From: support Date: Thu, 2 Feb 2023 13:28:22 +0000 (+0000) Subject: Built motion from commit fd055180.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=a5ce5049bde87c2c25d8b87b9feaf0abe7965fa4;p=motion2.git Built motion from commit fd055180.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4f16427..55666ab 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-02T12:10:12.809Z", + "time": "2023-02-02T13:19:12.717Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 08ca2f8..5f6d914 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-02T12:10:12.809Z", + "time": "2023-02-02T13:19:12.717Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index e165920..83afe3c 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 _0xe7b3=['urlForward[body]','sequelize','VIRTUAL','getDataValue','contactManager','integration','motionbar','jscripty','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x29a3a5,_0x4873c8){var _0x37fe1d=function(_0x26920b){while(--_0x26920b){_0x29a3a5['push'](_0x29a3a5['shift']());}};_0x37fe1d(++_0x4873c8);}(_0xe7b3,0xd2));var _0x3e7b=function(_0x13edd2,_0x165577){_0x13edd2=_0x13edd2-0x0;var _0x53f5eb=_0xe7b3[_0x13edd2];return _0x53f5eb;};'use strict';var Sequelize=require(_0x3e7b('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e7b('0x1')],'get':function(_0x14baf0){return this[_0x3e7b('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x3e7b('0x3'),_0x3e7b('0x4'),_0x3e7b('0x5'),_0x3e7b('0x6'),'urlForward','browser',_0x3e7b('0x7'),_0x3e7b('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x3e7b('0x9')},'data1':{'type':Sequelize[_0x3e7b('0xa')](0x1000),'comment':_0x3e7b('0xb')},'data2':{'type':Sequelize[_0x3e7b('0xa')](0x1000),'comment':_0x3e7b('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3e7b('0xd')},'data4':{'type':Sequelize[_0x3e7b('0xa')](0x1000),'comments':_0x3e7b('0xe')},'data5':{'type':Sequelize[_0x3e7b('0xa')](0x1000),'comments':_0x3e7b('0xf')},'data6':{'type':Sequelize[_0x3e7b('0xa')],'comments':_0x3e7b('0x10')},'data7':{'type':Sequelize[_0x3e7b('0x11')],'comments':_0x3e7b('0x12')}}; \ No newline at end of file +var _0x4134=['integration','jscripty','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','STRING','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','contactManager'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x4134,0x89));var _0x4413=function(_0x4be9f5,_0x57ad55){_0x4be9f5=_0x4be9f5-0x0;var _0xe5636=_0x4134[_0x4be9f5];return _0xe5636;};'use strict';var Sequelize=require(_0x4413('0x0'));module['exports']={'name':{'type':Sequelize[_0x4413('0x1')],'get':function(_0x11dc8f){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x4413('0x2'),_0x4413('0x3'),'motionbar',_0x4413('0x4'),'urlForward','browser','bot','script']],'msg':_0x4413('0x5')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4413('0x6')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4413('0x7')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x4413('0x8')},'data5':{'type':Sequelize[_0x4413('0x9')](0x1000),'comments':_0x4413('0xa')},'data6':{'type':Sequelize['STRING'],'comments':_0x4413('0xb')},'data7':{'type':Sequelize[_0x4413('0xc')],'comments':_0x4413('0xd')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c6f8b6d..117047a 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 _0x2d36=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','stack','name','send','update','body','params','Action','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x2d36,0x73));var _0x62d3=function(_0xeda3ff,_0x1736fe){_0xeda3ff=_0xeda3ff-0x0;var _0x4b0c13=_0x2d36[_0xeda3ff];return _0x4b0c13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62d3('0x0'));var zipdir=require(_0x62d3('0x1'));var jsonpatch=require(_0x62d3('0x2'));var rp=require(_0x62d3('0x3'));var moment=require(_0x62d3('0x4'));var BPromise=require(_0x62d3('0x5'));var Mustache=require(_0x62d3('0x6'));var util=require('util');var path=require('path');var sox=require(_0x62d3('0x7'));var csv=require(_0x62d3('0x8'));var ejs=require(_0x62d3('0x9'));var fs=require('fs');var fs_extra=require(_0x62d3('0xa'));var _=require(_0x62d3('0xb'));var squel=require(_0x62d3('0xc'));var crypto=require(_0x62d3('0xd'));var jsforce=require(_0x62d3('0xe'));var deskjs=require(_0x62d3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x62d3('0x10'));var Redis=require(_0x62d3('0x11'));var authService=require(_0x62d3('0x12'));var qs=require(_0x62d3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62d3('0x14'));var logger=require(_0x62d3('0x15'))('api');var utils=require(_0x62d3('0x16'));var config=require(_0x62d3('0x17'));var licenseUtil=require(_0x62d3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b5ca0,_0x1e2595){_0x1e2595=_0x1e2595||0xcc;return function(_0x3f3607){if(_0x3f3607){return _0x4b5ca0['sendStatus'](_0x1e2595);}return _0x4b5ca0[_0x62d3('0x19')](_0x1e2595)[_0x62d3('0x1a')]();};}function respondWithResult(_0x24e7eb,_0x28f4f6){_0x28f4f6=_0x28f4f6||0xc8;return function(_0x2caa56){if(_0x2caa56){return _0x24e7eb[_0x62d3('0x19')](_0x28f4f6)[_0x62d3('0x1b')](_0x2caa56);}};}function respondWithFilteredResult(_0x220f6e,_0x79b4ef){return function(_0x58f9e6){if(_0x58f9e6){var _0x251dba=typeof _0x79b4ef[_0x62d3('0x1c')]===_0x62d3('0x1d')&&typeof _0x79b4ef[_0x62d3('0x1e')]===_0x62d3('0x1d');var _0x2fe3ee=_0x58f9e6['count'];var _0x7225fa=_0x251dba?0x0:_0x79b4ef[_0x62d3('0x1c')];var _0xd66ea1=_0x251dba?_0x58f9e6[_0x62d3('0x1f')]:_0x79b4ef[_0x62d3('0x1c')]+_0x79b4ef[_0x62d3('0x1e')];var _0x287713;if(_0xd66ea1>=_0x2fe3ee){_0xd66ea1=_0x2fe3ee;_0x287713=0xc8;}else{_0x287713=0xce;}_0x220f6e['status'](_0x287713);return _0x220f6e['set'](_0x62d3('0x20'),_0x7225fa+'-'+_0xd66ea1+'/'+_0x2fe3ee)['json'](_0x58f9e6);}return null;};}function patchUpdates(_0x3086d4){return function(_0x57e941){try{jsonpatch[_0x62d3('0x21')](_0x57e941,_0x3086d4,!![]);}catch(_0x364f7a){return BPromise[_0x62d3('0x22')](_0x364f7a);}return _0x57e941['save']();};}function saveUpdates(_0x4ff8ac,_0x3312e5){return function(_0x878997){if(_0x878997){return _0x878997['update'](_0x4ff8ac)[_0x62d3('0x23')](function(_0x774995){return _0x774995;});}return null;};}function removeEntity(_0x227981,_0x19d629){return function(_0x50a491){if(_0x50a491){return _0x50a491[_0x62d3('0x24')]()['then'](function(){_0x227981[_0x62d3('0x19')](0xcc)[_0x62d3('0x1a')]();});}};}function handleEntityNotFound(_0x4d6aca,_0x4e7bf9){return function(_0x4f0eeb){if(!_0x4f0eeb){_0x4d6aca['sendStatus'](0x194);}return _0x4f0eeb;};}function handleError(_0x177ac4,_0x432722){_0x432722=_0x432722||0x1f4;return function(_0x2dd7aa){logger['error'](_0x2dd7aa[_0x62d3('0x25')]);if(_0x2dd7aa[_0x62d3('0x26')]){delete _0x2dd7aa[_0x62d3('0x26')];}_0x177ac4[_0x62d3('0x19')](_0x432722)[_0x62d3('0x27')](_0x2dd7aa);};}exports[_0x62d3('0x28')]=function(_0x199e44,_0x52c8da){if(_0x199e44[_0x62d3('0x29')]['id']){delete _0x199e44['body']['id'];}return db['Action']['find']({'where':{'id':_0x199e44[_0x62d3('0x2a')]['id']}})[_0x62d3('0x23')](handleEntityNotFound(_0x52c8da,null))[_0x62d3('0x23')](saveUpdates(_0x199e44[_0x62d3('0x29')],null))['then'](respondWithResult(_0x52c8da,null))['catch'](handleError(_0x52c8da,null));};exports[_0x62d3('0x24')]=function(_0x5a7668,_0x47597d){return db[_0x62d3('0x2b')][_0x62d3('0x2c')]({'where':{'id':_0x5a7668['params']['id']}})[_0x62d3('0x23')](handleEntityNotFound(_0x47597d,null))[_0x62d3('0x23')](removeEntity(_0x47597d,null))['catch'](handleError(_0x47597d,null));}; \ No newline at end of file +var _0xf416=['bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','status','sendStatus','error','stack','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xdf6852,_0x463851){var _0x1f8f7c=function(_0x2c76d8){while(--_0x2c76d8){_0xdf6852['push'](_0xdf6852['shift']());}};_0x1f8f7c(++_0x463851);}(_0xf416,0x199));var _0x6f41=function(_0x501d6e,_0x17ec39){_0x501d6e=_0x501d6e-0x0;var _0x679768=_0xf416[_0x501d6e];return _0x679768;};'use strict';var emlformat=require(_0x6f41('0x0'));var rimraf=require(_0x6f41('0x1'));var zipdir=require(_0x6f41('0x2'));var jsonpatch=require(_0x6f41('0x3'));var rp=require(_0x6f41('0x4'));var moment=require('moment');var BPromise=require(_0x6f41('0x5'));var Mustache=require(_0x6f41('0x6'));var util=require(_0x6f41('0x7'));var path=require('path');var sox=require(_0x6f41('0x8'));var csv=require(_0x6f41('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f41('0xa'));var _=require('lodash');var squel=require(_0x6f41('0xb'));var crypto=require(_0x6f41('0xc'));var jsforce=require(_0x6f41('0xd'));var deskjs=require(_0x6f41('0xe'));var toCsv=require(_0x6f41('0x9'));var querystring=require(_0x6f41('0xf'));var Papa=require(_0x6f41('0x10'));var Redis=require(_0x6f41('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f41('0x12'));var as=require(_0x6f41('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f41('0x14'))(_0x6f41('0x15'));var utils=require(_0x6f41('0x16'));var config=require(_0x6f41('0x17'));var licenseUtil=require(_0x6f41('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2432ce,_0x1e4bee){_0x1e4bee=_0x1e4bee||0xcc;return function(_0x16ab96){if(_0x16ab96){return _0x2432ce['sendStatus'](_0x1e4bee);}return _0x2432ce['status'](_0x1e4bee)['end']();};}function respondWithResult(_0x53faf9,_0x2fae71){_0x2fae71=_0x2fae71||0xc8;return function(_0x441cc1){if(_0x441cc1){return _0x53faf9['status'](_0x2fae71)[_0x6f41('0x19')](_0x441cc1);}};}function respondWithFilteredResult(_0x21e19e,_0x364631){return function(_0x58bbfd){if(_0x58bbfd){var _0x542ebc=typeof _0x364631[_0x6f41('0x1a')]===_0x6f41('0x1b')&&typeof _0x364631[_0x6f41('0x1c')]==='undefined';var _0x474be1=_0x58bbfd['count'];var _0x5d3a06=_0x542ebc?0x0:_0x364631['offset'];var _0x12e046=_0x542ebc?_0x58bbfd[_0x6f41('0x1d')]:_0x364631[_0x6f41('0x1a')]+_0x364631[_0x6f41('0x1c')];var _0x438115;if(_0x12e046>=_0x474be1){_0x12e046=_0x474be1;_0x438115=0xc8;}else{_0x438115=0xce;}_0x21e19e['status'](_0x438115);return _0x21e19e[_0x6f41('0x1e')](_0x6f41('0x1f'),_0x5d3a06+'-'+_0x12e046+'/'+_0x474be1)[_0x6f41('0x19')](_0x58bbfd);}return null;};}function patchUpdates(_0x4ec7bc){return function(_0x4c036a){try{jsonpatch[_0x6f41('0x20')](_0x4c036a,_0x4ec7bc,!![]);}catch(_0x5d80db){return BPromise['reject'](_0x5d80db);}return _0x4c036a['save']();};}function saveUpdates(_0x787418,_0x1f4f75){return function(_0x477d34){if(_0x477d34){return _0x477d34[_0x6f41('0x21')](_0x787418)['then'](function(_0x16b9b2){return _0x16b9b2;});}return null;};}function removeEntity(_0x1f967e,_0x7bf27a){return function(_0x3cbd21){if(_0x3cbd21){return _0x3cbd21[_0x6f41('0x22')]()[_0x6f41('0x23')](function(){_0x1f967e[_0x6f41('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa16438,_0x115975){return function(_0x3360d7){if(!_0x3360d7){_0xa16438[_0x6f41('0x25')](0x194);}return _0x3360d7;};}function handleError(_0x5844b6,_0x5040f1){_0x5040f1=_0x5040f1||0x1f4;return function(_0x5f4086){logger[_0x6f41('0x26')](_0x5f4086[_0x6f41('0x27')]);if(_0x5f4086['name']){delete _0x5f4086['name'];}_0x5844b6[_0x6f41('0x24')](_0x5040f1)[_0x6f41('0x28')](_0x5f4086);};}exports[_0x6f41('0x21')]=function(_0x53dd43,_0x182157){if(_0x53dd43[_0x6f41('0x29')]['id']){delete _0x53dd43['body']['id'];}return db[_0x6f41('0x2a')][_0x6f41('0x2b')]({'where':{'id':_0x53dd43[_0x6f41('0x2c')]['id']}})[_0x6f41('0x23')](handleEntityNotFound(_0x182157,null))[_0x6f41('0x23')](saveUpdates(_0x53dd43[_0x6f41('0x29')],null))['then'](respondWithResult(_0x182157,null))[_0x6f41('0x2d')](handleError(_0x182157,null));};exports[_0x6f41('0x22')]=function(_0x412d97,_0x565301){return db[_0x6f41('0x2a')][_0x6f41('0x2b')]({'where':{'id':_0x412d97[_0x6f41('0x2c')]['id']}})[_0x6f41('0x23')](handleEntityNotFound(_0x565301,null))['then'](removeEntity(_0x565301,null))[_0x6f41('0x2d')](handleError(_0x565301,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index c8de35f..cb0a455 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 _0x6ff4=['request-promise','path','rimraf','../../config/environment','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4326eb,_0x1801c5){var _0x2735a3=function(_0x4b1f8d){while(--_0x4b1f8d){_0x4326eb['push'](_0x4326eb['shift']());}};_0x2735a3(++_0x1801c5);}(_0x6ff4,0x1ce));var _0x46ff=function(_0x34ae6c,_0xbba594){_0x34ae6c=_0x34ae6c-0x0;var _0x29cc87=_0x6ff4[_0x34ae6c];return _0x29cc87;};'use strict';var _=require(_0x46ff('0x0'));var util=require(_0x46ff('0x1'));var logger=require(_0x46ff('0x2'))(_0x46ff('0x3'));var moment=require(_0x46ff('0x4'));var BPromise=require(_0x46ff('0x5'));var rp=require(_0x46ff('0x6'));var fs=require('fs');var path=require(_0x46ff('0x7'));var rimraf=require(_0x46ff('0x8'));var config=require(_0x46ff('0x9'));var attributes=require('./action.attributes');module['exports']=function(_0x2b6271,_0x1cfba1){return _0x2b6271[_0x46ff('0xa')]('Action',attributes,{'tableName':_0x46ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17a5=['../../config/logger','moment','request-promise','rimraf','./action.attributes','exports','define','Action','tools_actions','util'];(function(_0x4a2384,_0x1586a7){var _0x5eee54=function(_0x1a130a){while(--_0x1a130a){_0x4a2384['push'](_0x4a2384['shift']());}};_0x5eee54(++_0x1586a7);}(_0x17a5,0x1d5));var _0x517a=function(_0xdfbe21,_0xbc92de){_0xdfbe21=_0xdfbe21-0x0;var _0x5e1e86=_0x17a5[_0xdfbe21];return _0x5e1e86;};'use strict';var _=require('lodash');var util=require(_0x517a('0x0'));var logger=require(_0x517a('0x1'))('api');var moment=require(_0x517a('0x2'));var BPromise=require('bluebird');var rp=require(_0x517a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x517a('0x4'));var config=require('../../config/environment');var attributes=require(_0x517a('0x5'));module[_0x517a('0x6')]=function(_0x3c34f8,_0x4db37b){return _0x3c34f8[_0x517a('0x7')](_0x517a('0x8'),attributes,{'tableName':_0x517a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 0ce75f2..f67859f 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58ab46,_0x197f7f){var _0x28c5f6=function(_0x320a59){while(--_0x320a59){_0x58ab46['push'](_0x58ab46['shift']());}};_0x28c5f6(++_0x197f7f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0x7fbe[_0x456032];return _0x1a53cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x53ec,0x192));var _0xc53e=function(_0x10eb38,_0x2086bd){_0x10eb38=_0x10eb38-0x0;var _0x5af9b5=_0x53ec[_0x10eb38];return _0x5af9b5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 531826d..9a49986 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 _0xf9c0=['isAuthenticated','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9c0,0x177));var _0x0f9c=function(_0xa4aae,_0x9e1982){_0xa4aae=_0xa4aae-0x0;var _0x3b4b91=_0xf9c0[_0xa4aae];return _0x3b4b91;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x0f9c('0x1'));var router=express[_0x0f9c('0x2')]();var fs_extra=require(_0x0f9c('0x3'));var auth=require(_0x0f9c('0x4'));var interaction=require(_0x0f9c('0x5'));var config=require(_0x0f9c('0x6'));var controller=require('./action.controller');router[_0x0f9c('0x7')](_0x0f9c('0x8'),auth[_0x0f9c('0x9')](),controller['update']);router['delete'](_0x0f9c('0x8'),auth[_0x0f9c('0x9')](),controller[_0x0f9c('0xa')]);module[_0x0f9c('0xb')]=router; \ No newline at end of file +var _0x007d=['connect-timeout','express','fs-extra','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','destroy','exports','multer','util'];(function(_0xd8151c,_0x55918f){var _0x2e9c71=function(_0x12c66d){while(--_0x12c66d){_0xd8151c['push'](_0xd8151c['shift']());}};_0x2e9c71(++_0x55918f);}(_0x007d,0x11e));var _0xd007=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x007d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd007('0x0'));var util=require(_0xd007('0x1'));var path=require('path');var timeout=require(_0xd007('0x2'));var express=require(_0xd007('0x3'));var router=express['Router']();var fs_extra=require(_0xd007('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd007('0x5'));var config=require('../../config/environment');var controller=require(_0xd007('0x6'));router[_0xd007('0x7')](_0xd007('0x8'),auth[_0xd007('0x9')](),controller['update']);router['delete'](_0xd007('0x8'),auth[_0xd007('0x9')](),controller[_0xd007('0xa')]);module[_0xd007('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 554ae89..dc10eaa 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0xf24f30,_0x77205b){var _0x364bea=function(_0x562a10){while(--_0x562a10){_0xf24f30['push'](_0xf24f30['shift']());}};_0x364bea(++_0x77205b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x7c09=['exports','STRING','TEXT'];(function(_0x262d66,_0x3eb656){var _0x549a57=function(_0x5b0dc5){while(--_0x5b0dc5){_0x262d66['push'](_0x262d66['shift']());}};_0x549a57(++_0x3eb656);}(_0x7c09,0x102));var _0x97c0=function(_0x54a132,_0x481e8f){_0x54a132=_0x54a132-0x0;var _0x30aef6=_0x7c09[_0x54a132];return _0x30aef6;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1fee5d0..0bce553 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 _0xc9d8=['end','status','offset','undefined','limit','count','set','Content-Range','json','save','destroy','then','CustomReports','UserProfileResource','error','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%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\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','right_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','Sequelize','keyBy','orderBy','order','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','IS\x20EMPTY','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xc9d8,0x138));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c9d('0x0'));var rimraf=require(_0x8c9d('0x1'));var zipdir=require(_0x8c9d('0x2'));var jsonpatch=require(_0x8c9d('0x3'));var rp=require(_0x8c9d('0x4'));var moment=require(_0x8c9d('0x5'));var BPromise=require(_0x8c9d('0x6'));var Mustache=require(_0x8c9d('0x7'));var util=require(_0x8c9d('0x8'));var path=require('path');var sox=require(_0x8c9d('0x9'));var csv=require(_0x8c9d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c9d('0xb'));var _=require(_0x8c9d('0xc'));var squel=require(_0x8c9d('0xd'));var crypto=require(_0x8c9d('0xe'));var jsforce=require(_0x8c9d('0xf'));var deskjs=require(_0x8c9d('0x10'));var toCsv=require(_0x8c9d('0xa'));var querystring=require(_0x8c9d('0x11'));var Papa=require(_0x8c9d('0x12'));var Redis=require(_0x8c9d('0x13'));var authService=require(_0x8c9d('0x14'));var qs=require(_0x8c9d('0x15'));var as=require(_0x8c9d('0x16'));var hardwareService=require(_0x8c9d('0x17'));var logger=require(_0x8c9d('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x8c9d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c9d('0x1a'))['db'];var dbH=require(_0x8c9d('0x1a'))['dbH'];function respondWithStatusCode(_0x443a3b,_0x5c56f3){_0x5c56f3=_0x5c56f3||0xcc;return function(_0x40355a){if(_0x40355a){return _0x443a3b[_0x8c9d('0x1b')](_0x5c56f3);}return _0x443a3b['status'](_0x5c56f3)[_0x8c9d('0x1c')]();};}function respondWithResult(_0x1004e1,_0x4fb794){_0x4fb794=_0x4fb794||0xc8;return function(_0x1022b6){if(_0x1022b6){return _0x1004e1[_0x8c9d('0x1d')](_0x4fb794)['json'](_0x1022b6);}};}function respondWithFilteredResult(_0x3a6092,_0x1227c3){return function(_0x38fa03){if(_0x38fa03){var _0x90974a=typeof _0x1227c3[_0x8c9d('0x1e')]===_0x8c9d('0x1f')&&typeof _0x1227c3[_0x8c9d('0x20')]===_0x8c9d('0x1f');var _0x3a65c5=_0x38fa03[_0x8c9d('0x21')];var _0xf4439=_0x90974a?0x0:_0x1227c3[_0x8c9d('0x1e')];var _0x3ded4a=_0x90974a?_0x38fa03[_0x8c9d('0x21')]:_0x1227c3['offset']+_0x1227c3[_0x8c9d('0x20')];var _0x3b1f3f;if(_0x3ded4a>=_0x3a65c5){_0x3ded4a=_0x3a65c5;_0x3b1f3f=0xc8;}else{_0x3b1f3f=0xce;}_0x3a6092['status'](_0x3b1f3f);return _0x3a6092[_0x8c9d('0x22')](_0x8c9d('0x23'),_0xf4439+'-'+_0x3ded4a+'/'+_0x3a65c5)[_0x8c9d('0x24')](_0x38fa03);}return null;};}function patchUpdates(_0x56e8cb){return function(_0x2538bb){try{jsonpatch['apply'](_0x2538bb,_0x56e8cb,!![]);}catch(_0x50c57c){return BPromise['reject'](_0x50c57c);}return _0x2538bb[_0x8c9d('0x25')]();};}function saveUpdates(_0x2c06ce,_0x18e2b6){return function(_0x4fefcf){if(_0x4fefcf){return _0x4fefcf['update'](_0x2c06ce)['then'](function(_0x1cd59e){return _0x1cd59e;});}return null;};}function removeEntity(_0x2e407,_0x24b1fb){return function(_0x1d2a96){if(_0x1d2a96){return _0x1d2a96[_0x8c9d('0x26')]()[_0x8c9d('0x27')](function(){var _0x20be5a=_0x1d2a96['get']({'plain':!![]});var _0x5812a3=_0x8c9d('0x28');return db[_0x8c9d('0x29')][_0x8c9d('0x26')]({'where':{'type':_0x5812a3,'resourceId':_0x20be5a['id']}})[_0x8c9d('0x27')](function(){return _0x1d2a96;});})[_0x8c9d('0x27')](function(){_0x2e407[_0x8c9d('0x1d')](0xcc)[_0x8c9d('0x1c')]();});}};}function handleEntityNotFound(_0x282555,_0xcfe4d9){return function(_0x2afaf7){if(!_0x2afaf7){_0x282555[_0x8c9d('0x1b')](0x194);}return _0x2afaf7;};}function handleError(_0x431ece,_0x40bf56){_0x40bf56=_0x40bf56||0x1f4;return function(_0x243e2a){logger[_0x8c9d('0x2a')](_0x243e2a['stack']);if(_0x243e2a[_0x8c9d('0x2b')]){delete _0x243e2a['name'];}_0x431ece[_0x8c9d('0x1d')](_0x40bf56)['send'](_0x243e2a);};}exports['index']=function(_0x5f2eb8,_0x47ef32){var _0x1fc196={},_0x389a95={},_0x41eb8b={'count':0x0,'rows':[]};var _0x11a8dc=_[_0x8c9d('0x2c')](db[_0x8c9d('0x2d')][_0x8c9d('0x2e')],function(_0x25ed04){return{'name':_0x25ed04[_0x8c9d('0x2f')],'type':_0x25ed04[_0x8c9d('0x30')][_0x8c9d('0x31')]};});_0x389a95['model']=_[_0x8c9d('0x2c')](_0x11a8dc,_0x8c9d('0x2b'));_0x389a95[_0x8c9d('0x32')]=_[_0x8c9d('0x33')](_0x5f2eb8[_0x8c9d('0x32')]);_0x389a95[_0x8c9d('0x34')]=_[_0x8c9d('0x35')](_0x389a95[_0x8c9d('0x36')],_0x389a95[_0x8c9d('0x32')]);_0x1fc196[_0x8c9d('0x37')]=_[_0x8c9d('0x35')](_0x389a95[_0x8c9d('0x36')],qs[_0x8c9d('0x38')](_0x5f2eb8['query']['fields']));_0x1fc196['attributes']=_0x1fc196[_0x8c9d('0x37')][_0x8c9d('0x39')]?_0x1fc196[_0x8c9d('0x37')]:_0x389a95[_0x8c9d('0x36')];if(!_0x5f2eb8['query'][_0x8c9d('0x3a')](_0x8c9d('0x3b'))){_0x1fc196[_0x8c9d('0x20')]=qs[_0x8c9d('0x20')](_0x5f2eb8[_0x8c9d('0x32')]['limit']);_0x1fc196[_0x8c9d('0x1e')]=qs[_0x8c9d('0x1e')](_0x5f2eb8[_0x8c9d('0x32')][_0x8c9d('0x1e')]);}_0x1fc196['order']=qs[_0x8c9d('0x3c')](_0x5f2eb8[_0x8c9d('0x32')][_0x8c9d('0x3c')]);_0x1fc196[_0x8c9d('0x3d')]=qs[_0x8c9d('0x34')](_[_0x8c9d('0x3e')](_0x5f2eb8['query'],_0x389a95['filters']),_0x11a8dc);if(_0x5f2eb8[_0x8c9d('0x32')]['filter']){_0x1fc196[_0x8c9d('0x3d')]=_[_0x8c9d('0x3f')](_0x1fc196['where'],{'$or':_[_0x8c9d('0x2c')](_0x11a8dc,function(_0x27b4aa){if(_0x27b4aa[_0x8c9d('0x30')]!=='VIRTUAL'){var _0xd5862c={};_0xd5862c[_0x27b4aa[_0x8c9d('0x2b')]]={'$like':'%'+_0x5f2eb8[_0x8c9d('0x32')][_0x8c9d('0x40')]+'%'};return _0xd5862c;}})});}_0x1fc196=_[_0x8c9d('0x3f')]({},_0x1fc196,_0x5f2eb8[_0x8c9d('0x41')]);var _0x36de0f={'where':_0x1fc196['where']};return db['AnalyticCustomReport']['count'](_0x36de0f)[_0x8c9d('0x27')](function(_0x7bd851){_0x41eb8b['count']=_0x7bd851;if(_0x5f2eb8[_0x8c9d('0x32')][_0x8c9d('0x42')]){_0x1fc196[_0x8c9d('0x43')]=[{'all':!![]}];}return db[_0x8c9d('0x2d')][_0x8c9d('0x44')](_0x1fc196);})['then'](function(_0x1639e7){_0x41eb8b[_0x8c9d('0x45')]=_0x1639e7;return _0x41eb8b;})[_0x8c9d('0x27')](respondWithFilteredResult(_0x47ef32,_0x1fc196))['catch'](handleError(_0x47ef32,null));};exports[_0x8c9d('0x46')]=function(_0x1eebf4,_0x490f58){var _0x50dba7={'raw':![],'where':{'id':_0x1eebf4[_0x8c9d('0x47')]['id']}},_0x3ef263={};_0x3ef263[_0x8c9d('0x36')]=_['keys'](db[_0x8c9d('0x2d')]['rawAttributes']);_0x3ef263['query']=_[_0x8c9d('0x33')](_0x1eebf4[_0x8c9d('0x32')]);_0x3ef263[_0x8c9d('0x34')]=_[_0x8c9d('0x35')](_0x3ef263[_0x8c9d('0x36')],_0x3ef263['query']);_0x50dba7['attributes']=_['intersection'](_0x3ef263[_0x8c9d('0x36')],qs[_0x8c9d('0x38')](_0x1eebf4[_0x8c9d('0x32')][_0x8c9d('0x38')]));_0x50dba7[_0x8c9d('0x37')]=_0x50dba7[_0x8c9d('0x37')]['length']?_0x50dba7[_0x8c9d('0x37')]:_0x3ef263[_0x8c9d('0x36')];if(_0x1eebf4[_0x8c9d('0x32')][_0x8c9d('0x42')]){_0x50dba7[_0x8c9d('0x43')]=[{'all':!![]}];}_0x50dba7=_['merge']({},_0x50dba7,_0x1eebf4[_0x8c9d('0x41')]);return db[_0x8c9d('0x2d')][_0x8c9d('0x48')](_0x50dba7)[_0x8c9d('0x27')](handleEntityNotFound(_0x490f58,null))['then'](respondWithResult(_0x490f58,null))[_0x8c9d('0x49')](handleError(_0x490f58,null));};exports[_0x8c9d('0x4a')]=function(_0x51dd2f,_0x4f1498){return db[_0x8c9d('0x2d')][_0x8c9d('0x4a')](_0x51dd2f[_0x8c9d('0x4b')],{})[_0x8c9d('0x27')](function(_0x3a2484){var _0x11fccd=_0x51dd2f[_0x8c9d('0x4c')][_0x8c9d('0x4d')]({'plain':!![]});if(!_0x11fccd)throw new Error(_0x8c9d('0x4e'));if(_0x11fccd[_0x8c9d('0x4f')]===_0x8c9d('0x4c')){var _0xba0366=_0x3a2484[_0x8c9d('0x4d')]({'plain':!![]});var _0x3d4205=_0x8c9d('0x50');return db[_0x8c9d('0x51')][_0x8c9d('0x48')]({'where':{'name':_0x3d4205,'userProfileId':_0x11fccd[_0x8c9d('0x52')]},'raw':!![]})[_0x8c9d('0x27')](function(_0x12bb72){if(_0x12bb72&&_0x12bb72[_0x8c9d('0x53')]===0x0){return db['UserProfileResource'][_0x8c9d('0x4a')]({'name':_0xba0366[_0x8c9d('0x2b')],'resourceId':_0xba0366['id'],'type':_0x8c9d('0x28'),'sectionId':_0x12bb72['id']},{})[_0x8c9d('0x27')](function(){return _0x3a2484;});}else{return _0x3a2484;}})[_0x8c9d('0x49')](function(_0x275412){logger[_0x8c9d('0x2a')](_0x8c9d('0x54'),_0x275412);throw _0x275412;});}return _0x3a2484;})[_0x8c9d('0x27')](respondWithResult(_0x4f1498,0xc9))[_0x8c9d('0x49')](handleError(_0x4f1498,null));};exports[_0x8c9d('0x55')]=function(_0x3755fe,_0x677876){if(_0x3755fe[_0x8c9d('0x4b')]['id']){delete _0x3755fe[_0x8c9d('0x4b')]['id'];}return db['AnalyticCustomReport'][_0x8c9d('0x48')]({'where':{'id':_0x3755fe[_0x8c9d('0x47')]['id']}})[_0x8c9d('0x27')](handleEntityNotFound(_0x677876,null))[_0x8c9d('0x27')](saveUpdates(_0x3755fe[_0x8c9d('0x4b')],null))[_0x8c9d('0x27')](respondWithResult(_0x677876,null))[_0x8c9d('0x49')](handleError(_0x677876,null));};exports[_0x8c9d('0x26')]=function(_0x61ed8a,_0x320eac){return db['AnalyticCustomReport'][_0x8c9d('0x48')]({'where':{'id':_0x61ed8a[_0x8c9d('0x47')]['id']}})[_0x8c9d('0x27')](handleEntityNotFound(_0x320eac,null))['then'](removeEntity(_0x320eac,null))[_0x8c9d('0x49')](handleError(_0x320eac,null));};exports[_0x8c9d('0x56')]=function(_0x100076,_0xc09499){var _0x16e352=0xa;var _0x1d351d=['join',_0x8c9d('0x57'),'right_join',_0x8c9d('0x58')];var _0x305e9a={'SUM':_0x8c9d('0x59'),'COUNT':_0x8c9d('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8c9d('0x5b'),'MIN':_0x8c9d('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x8c9d('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x8c9d('0x5e')};var _0x157d0d={'SEC_TO_TIME':_0x8c9d('0x5f'),'DATE':'DATE(%s)','HOUR':_0x8c9d('0x60'),'ROUND':_0x8c9d('0x61'),'UNIX_TIMESTAMP':_0x8c9d('0x62')};var _0x5422c2=function(_0x431081){return!_[_0x8c9d('0x63')]([_0x8c9d('0x64'),_0x8c9d('0x65'),'IS\x20EMPTY',_0x8c9d('0x66')],_0x431081);};var _0x1d05a0=function(_0x4b5626){if(!_0x4b5626||!_0x4b5626[_0x8c9d('0x67')][_0x8c9d('0x39')]){return'';}for(var _0x5020fd='(',_0xeb6bb5=0x0;_0xeb6bb5<_0x4b5626[_0x8c9d('0x67')][_0x8c9d('0x39')];_0xeb6bb5+=0x1){_0xeb6bb5>0x0&&(_0x5020fd+='\x20'+_0x4b5626[_0x8c9d('0x68')]+'\x20');_0x5020fd+=_0x4b5626[_0x8c9d('0x67')][_0xeb6bb5][_0x8c9d('0x69')]?_0x1d05a0(_0x4b5626[_0x8c9d('0x67')][_0xeb6bb5][_0x8c9d('0x69')]):_0x4b5626[_0x8c9d('0x67')][_0xeb6bb5][_0x8c9d('0x6a')]+'\x20'+_0x4b5626['rules'][_0xeb6bb5][_0x8c9d('0x6b')]+(_0x5422c2(_0x4b5626[_0x8c9d('0x67')][_0xeb6bb5][_0x8c9d('0x6b')])?'\x20'+_0x4b5626[_0x8c9d('0x67')][_0xeb6bb5][_0x8c9d('0x6c')]:'');}return _0x5020fd+')';};var _0x2563e2={'where':{'id':_0x100076[_0x8c9d('0x47')]['id']}},_0x465ebc,_0x3ce5a2,_0x2b7ab1,_0x3c1548,_0x11ca65;_0x2563e2=_['merge']({},_0x2563e2,_0x100076[_0x8c9d('0x41')]);return db[_0x8c9d('0x2d')]['find'](_0x2563e2)[_0x8c9d('0x27')](function(_0x1786f7){if(_0x1786f7){_0x465ebc=_0x1786f7;return _0x1786f7[_0x8c9d('0x6d')]();}return null;})['then'](function(_0x5465cc){if(_0x5465cc){if(!_0x5465cc[_0x8c9d('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x8c9d('0x6e'),0x193);}_0x3ce5a2=_0x5465cc;return db[_0x8c9d('0x6f')][_0x8c9d('0x44')]({'raw':!![]});}return null;})[_0x8c9d('0x27')](function(_0x34f94a){if(_0x34f94a){_0x2b7ab1=_['keyBy'](_0x34f94a,'id');var _0x3503b0;var _0x16e08a=squel[_0x8c9d('0x70')]();_0x16e08a['from'](_0x465ebc[_0x8c9d('0x71')]);for(var _0x49bbcc=0x0;_0x49bbcc<_0x3ce5a2[_0x8c9d('0x39')];_0x49bbcc+=0x1){_0x3503b0=_0x3ce5a2[_0x49bbcc]['MetricId']?_0x2b7ab1[_0x3ce5a2[_0x49bbcc][_0x8c9d('0x72')]][_0x8c9d('0x73')]:_0x3ce5a2[_0x49bbcc]['field'];_0x3503b0=_0x3ce5a2[_0x49bbcc]['function']?_[_0x8c9d('0x74')](_0x305e9a[_0x3ce5a2[_0x49bbcc][_0x8c9d('0x75')]],'%s',_0x3503b0):_0x3503b0;_0x3503b0=_0x3ce5a2[_0x49bbcc][_0x8c9d('0x76')]?_[_0x8c9d('0x74')](_0x157d0d[_0x3ce5a2[_0x49bbcc]['format']],'%s',_0x3503b0):_0x3503b0;if(_0x3ce5a2[_0x49bbcc][_0x8c9d('0x77')]){_0x16e08a[_0x8c9d('0x69')](_0x3503b0);}_0x3ce5a2[_0x49bbcc]['orderBy']&&_0x16e08a['order'](_0x3503b0,_0x3ce5a2[_0x49bbcc]['orderBy']===_0x8c9d('0x78')?![]:!![]);_0x16e08a[_0x8c9d('0x6a')](_0x3503b0,_0x3ce5a2[_0x49bbcc][_0x8c9d('0x79')]||_0x3503b0);}if(_0x465ebc['joins']){_0x465ebc[_0x8c9d('0x7a')]=JSON[_0x8c9d('0x7b')](_0x465ebc['joins']);for(var _0x3b262c=0x0;_0x3b262c<_0x465ebc[_0x8c9d('0x7a')][_0x8c9d('0x39')];_0x3b262c+=0x1){if(_0x465ebc[_0x8c9d('0x7a')][_0x3b262c][_0x8c9d('0x30')]&&_['includes'](_0x1d351d,_0x465ebc['joins'][_0x3b262c]['type'])&&_0x465ebc[_0x8c9d('0x7a')][_0x3b262c][_0x8c9d('0x7c')]&&_0x465ebc[_0x8c9d('0x7a')][_0x3b262c][_0x8c9d('0x7d')]&&_0x465ebc[_0x8c9d('0x7a')][_0x3b262c][_0x8c9d('0x7e')]){_0x16e08a[_0x465ebc[_0x8c9d('0x7a')][_0x3b262c]['type']](_0x465ebc['joins'][_0x3b262c][_0x8c9d('0x7d')],null,util[_0x8c9d('0x76')](_0x8c9d('0x7f'),_0x465ebc['table'],_0x465ebc[_0x8c9d('0x7a')][_0x3b262c][_0x8c9d('0x7c')],_0x465ebc[_0x8c9d('0x7a')][_0x3b262c][_0x8c9d('0x7d')],_0x465ebc[_0x8c9d('0x7a')][_0x3b262c]['foreignKey']));}}}if(_0x465ebc['conditions']){_0x465ebc[_0x8c9d('0x80')]=JSON[_0x8c9d('0x7b')](_0x465ebc[_0x8c9d('0x80')]);_0x16e08a['where'](_0x1d05a0(_0x465ebc['conditions'][_0x8c9d('0x69')]));}_0x11ca65=_0x16e08a[_0x8c9d('0x81')]();_0x16e08a[_0x8c9d('0x20')](_0x16e352);_0x16e08a[_0x8c9d('0x1e')](0x0);logger[_0x8c9d('0x82')](_0x8c9d('0x83'),_0x16e08a[_0x8c9d('0x84')]());return dbH['sequelize'][_0x8c9d('0x32')](_0x16e08a[_0x8c9d('0x84')](),{'type':dbH[_0x8c9d('0x85')][_0x8c9d('0x86')][_0x8c9d('0x87')]});}})['then'](respondWithResult(_0xc09499,null))[_0x8c9d('0x49')](handleError(_0xc09499,null));};function runReport(_0x4659f9,_0x1fbb32,_0x59db8b){var _0x2860e9=_0x1fbb32[_0x8c9d('0x2b')];var _0x17196b=0xa;var _0x3f1d38=[_0x8c9d('0x88'),'left_join',_0x8c9d('0x89'),_0x8c9d('0x58')];var _0xaa9b2b={'SUM':_0x8c9d('0x59'),'COUNT':_0x8c9d('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x8c9d('0x5c'),'AVG':_0x8c9d('0x8a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x8c9d('0x8b'),'GROUP_CONCAT DESC':_0x8c9d('0x5e')};var _0x2548d3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8c9d('0x8c'),'HOUR':_0x8c9d('0x60'),'ROUND':_0x8c9d('0x61'),'UNIX_TIMESTAMP':_0x8c9d('0x62')};var _0x33b8bb=function(_0x3b2069){return!_[_0x8c9d('0x63')]([_0x8c9d('0x64'),_0x8c9d('0x65'),'IS\x20EMPTY',_0x8c9d('0x66')],_0x3b2069);};var _0x3fce1e=function(_0x589608){if(!_0x589608||!_0x589608[_0x8c9d('0x67')][_0x8c9d('0x39')]){return'';}for(var _0x45f2a7='(',_0x77a7e5=0x0;_0x77a7e5<_0x589608[_0x8c9d('0x67')][_0x8c9d('0x39')];_0x77a7e5+=0x1){_0x77a7e5>0x0&&(_0x45f2a7+='\x20'+_0x589608[_0x8c9d('0x68')]+'\x20');_0x45f2a7+=_0x589608[_0x8c9d('0x67')][_0x77a7e5][_0x8c9d('0x69')]?_0x3fce1e(_0x589608['rules'][_0x77a7e5][_0x8c9d('0x69')]):_0x589608[_0x8c9d('0x67')][_0x77a7e5][_0x8c9d('0x6a')]+'\x20'+_0x589608[_0x8c9d('0x67')][_0x77a7e5][_0x8c9d('0x6b')]+(_0x33b8bb(_0x589608[_0x8c9d('0x67')][_0x77a7e5]['condition'])?'\x20'+_0x589608[_0x8c9d('0x67')][_0x77a7e5][_0x8c9d('0x6c')]:'');}return _0x45f2a7+')';};var _0x32cf4c={'where':{'id':_0x4659f9['id']}},_0x194331,_0x6c9f5e,_0x47b04e,_0x149142,_0x2490b7;_0x32cf4c=_[_0x8c9d('0x3f')]({},_0x32cf4c,_0x59db8b);return db['AnalyticCustomReport'][_0x8c9d('0x48')](_0x32cf4c)[_0x8c9d('0x27')](function(_0x1bb9a0){if(_0x1bb9a0){_0x194331=_0x1bb9a0;return _0x1bb9a0[_0x8c9d('0x6d')]();}return null;})[_0x8c9d('0x27')](function(_0x4d7c40){if(_0x4d7c40){if(!_0x4d7c40[_0x8c9d('0x39')]){throw new db[(_0x8c9d('0x8d'))]['ValidationErrorItem'](_0x8c9d('0x6e'),0x193);}_0x6c9f5e=_0x4d7c40;return db[_0x8c9d('0x6f')][_0x8c9d('0x44')]({'raw':!![]});}return null;})[_0x8c9d('0x27')](function(_0x1f8e89){if(_0x1f8e89){_0x47b04e=_[_0x8c9d('0x8e')](_0x1f8e89,'id');var _0x1f2580;var _0x124ea0=squel[_0x8c9d('0x70')]();_0x124ea0['from'](_0x194331['table']);for(var _0x4ed751=0x0;_0x4ed751<_0x6c9f5e[_0x8c9d('0x39')];_0x4ed751+=0x1){_0x1f2580=_0x6c9f5e[_0x4ed751][_0x8c9d('0x72')]?_0x47b04e[_0x6c9f5e[_0x4ed751][_0x8c9d('0x72')]][_0x8c9d('0x73')]:_0x6c9f5e[_0x4ed751][_0x8c9d('0x6a')];_0x1f2580=_0x6c9f5e[_0x4ed751]['function']?_[_0x8c9d('0x74')](_0xaa9b2b[_0x6c9f5e[_0x4ed751]['function']],'%s',_0x1f2580):_0x1f2580;_0x1f2580=_0x6c9f5e[_0x4ed751][_0x8c9d('0x76')]?_[_0x8c9d('0x74')](_0x2548d3[_0x6c9f5e[_0x4ed751][_0x8c9d('0x76')]],'%s',_0x1f2580):_0x1f2580;if(_0x6c9f5e[_0x4ed751][_0x8c9d('0x77')]){_0x124ea0[_0x8c9d('0x69')](_0x1f2580);}_0x6c9f5e[_0x4ed751][_0x8c9d('0x8f')]&&_0x124ea0[_0x8c9d('0x90')](_0x1f2580,_0x6c9f5e[_0x4ed751]['orderBy']==='DESC'?![]:!![]);_0x124ea0[_0x8c9d('0x6a')](_0x1f2580,_0x6c9f5e[_0x4ed751]['alias']||_0x1f2580);}if(_0x194331[_0x8c9d('0x7a')]){_0x194331[_0x8c9d('0x7a')]=JSON[_0x8c9d('0x7b')](_0x194331[_0x8c9d('0x7a')]);for(var _0x3cdbfe=0x0;_0x3cdbfe<_0x194331[_0x8c9d('0x7a')][_0x8c9d('0x39')];_0x3cdbfe+=0x1){if(_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x30')]&&_['includes'](_0x3f1d38,_0x194331['joins'][_0x3cdbfe][_0x8c9d('0x30')])&&_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x7c')]&&_0x194331[_0x8c9d('0x7a')][_0x3cdbfe]['foreignTable']&&_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x7e')]){_0x124ea0[_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x30')]](_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x7d')],null,util[_0x8c9d('0x76')]('%s.%s\x20=\x20%s.%s',_0x194331['table'],_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x7c')],_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x7d')],_0x194331[_0x8c9d('0x7a')][_0x3cdbfe][_0x8c9d('0x7e')]));}}}if(_0x194331[_0x8c9d('0x80')]){_0x194331['conditions']=JSON[_0x8c9d('0x7b')](_0x194331['conditions']);_0x124ea0[_0x8c9d('0x3d')](_0x3fce1e(_0x194331[_0x8c9d('0x80')][_0x8c9d('0x69')]));}_0x2490b7=_0x124ea0[_0x8c9d('0x81')]();_0x124ea0[_0x8c9d('0x20')](_0x17196b);_0x124ea0[_0x8c9d('0x1e')](0x0);return;}})[_0x8c9d('0x27')](function(){if(_0x1fbb32[_0x8c9d('0x91')]===_0x8c9d('0x92')){return null;}var _0x190257=_[_0x8c9d('0x3f')](_0x1fbb32,{'name':_0x1fbb32[_0x8c9d('0x93')]||_0x1fbb32[_0x8c9d('0x2b')]||_0x194331[_0x8c9d('0x2b')],'basename':_0x2860e9,'savename':util[_0x8c9d('0x76')](_0x8c9d('0x94'),_0x1fbb32[_0x8c9d('0x2b')]||_0x194331[_0x8c9d('0x2b')],require(_0x8c9d('0x95'))['generate'](0x4),_0x1fbb32[_0x8c9d('0x91')]||_0x8c9d('0x96')),'reportId':_0x194331['id'],'reportType':'custom'});return db[_0x8c9d('0x97')][_0x8c9d('0x4a')](_0x190257,{'raw':!![]});})[_0x8c9d('0x27')](function(_0x243aca){if(_0x194331['table']==='cdr'){_0x2490b7['where'](_0x194331[_0x8c9d('0x71')]+_0x8c9d('0x98'),_0x1fbb32[_0x8c9d('0x99')],_0x1fbb32[_0x8c9d('0x9a')]);}else{_0x2490b7['where'](_0x194331[_0x8c9d('0x71')]+_0x8c9d('0x9b'),_0x1fbb32[_0x8c9d('0x99')],_0x1fbb32[_0x8c9d('0x9a')]);}if(_0x243aca){logger[_0x8c9d('0x9c')](_0x8c9d('0x9d'),_0x2490b7[_0x8c9d('0x84')]());require(_0x8c9d('0x9e'))[_0x8c9d('0x9f')](path[_0x8c9d('0x88')](__dirname,_0x8c9d('0xa0'),_0x243aca[_0x8c9d('0x91')]),[_0x243aca['id'],_0x2490b7[_0x8c9d('0x84')](),path[_0x8c9d('0x88')](__dirname,_0x8c9d('0xa1'),_0x243aca[_0x8c9d('0xa2')]),_0x2860e9]);return _0x243aca;}else{var _0x496ba2=squel[_0x8c9d('0x70')]();_0x496ba2[_0x8c9d('0xa3')]('('+_0x2490b7[_0x8c9d('0x84')]()+')',_0x8c9d('0xa4'));_0x496ba2[_0x8c9d('0x6a')](_0x8c9d('0xa5'),_0x8c9d('0x21'));_0x2490b7[_0x8c9d('0x20')](_0x1fbb32[_0x8c9d('0x20')]||_0x17196b);_0x2490b7[_0x8c9d('0x1e')](_0x1fbb32[_0x8c9d('0x1e')]||0x0);return dbH[_0x8c9d('0x85')]['query'](_0x496ba2['toString'](),{'type':dbH[_0x8c9d('0x85')]['QueryTypes'][_0x8c9d('0x87')]})[_0x8c9d('0x27')](function(_0x1a157c){if(!_0x1a157c['length']){_0x149142=0x0;}else{_0x149142=_0x1a157c[0x0]['count']||0x0;}return dbH[_0x8c9d('0x85')][_0x8c9d('0x32')](_0x2490b7[_0x8c9d('0x84')](),{'type':dbH[_0x8c9d('0x85')][_0x8c9d('0x86')]['SELECT']});})[_0x8c9d('0x27')](function(_0xec5c79){return{'rows':_0xec5c79||[],'count':_0x149142};});}});}exports[_0x8c9d('0xa6')]=function(_0x4c2ad4,_0x562aa7){return runReport(_0x4c2ad4['params'],_0x4c2ad4['query'],_0x4c2ad4[_0x8c9d('0x41')])[_0x8c9d('0x27')](respondWithResult(_0x562aa7,null))[_0x8c9d('0x49')](handleError(_0x562aa7,null));};exports['runReport']=runReport;exports[_0x8c9d('0x32')]=function(_0x5dafe8,_0x34afbd){var _0x5ea95f=0xa;var _0x3ccbba=[_0x8c9d('0x88'),_0x8c9d('0x57'),'right_join','cross_join'];var _0x66b87c={'SUM':_0x8c9d('0x59'),'COUNT':_0x8c9d('0x5a'),'COUNT DISTINCT':_0x8c9d('0xa7'),'MAX':_0x8c9d('0x5b'),'MIN':_0x8c9d('0x5c'),'AVG':_0x8c9d('0x8a'),'GROUP_CONCAT':_0x8c9d('0x5d'),'GROUP_CONCAT ASC':_0x8c9d('0x8b'),'GROUP_CONCAT DESC':_0x8c9d('0x5e')};var _0xf0ead9={'SEC_TO_TIME':_0x8c9d('0x5f'),'DATE':_0x8c9d('0x8c'),'HOUR':_0x8c9d('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2360b2=function(_0x3c4056){return!_['includes']([_0x8c9d('0x64'),'IS\x20NOT\x20NULL',_0x8c9d('0xa8'),_0x8c9d('0x66')],_0x3c4056);};var _0x9bbee6=function(_0x1bcdde){if(!_0x1bcdde||!_0x1bcdde[_0x8c9d('0x67')][_0x8c9d('0x39')]){return'';}for(var _0x47006b='(',_0x596983=0x0;_0x596983<_0x1bcdde[_0x8c9d('0x67')][_0x8c9d('0x39')];_0x596983+=0x1){_0x596983>0x0&&(_0x47006b+='\x20'+_0x1bcdde[_0x8c9d('0x68')]+'\x20');_0x47006b+=_0x1bcdde[_0x8c9d('0x67')][_0x596983]['group']?_0x9bbee6(_0x1bcdde[_0x8c9d('0x67')][_0x596983]['group']):_0x1bcdde[_0x8c9d('0x67')][_0x596983]['field']+'\x20'+_0x1bcdde[_0x8c9d('0x67')][_0x596983][_0x8c9d('0x6b')]+(_0x2360b2(_0x1bcdde['rules'][_0x596983][_0x8c9d('0x6b')])?'\x20'+_0x1bcdde[_0x8c9d('0x67')][_0x596983]['value']:'');}return _0x47006b+')';};var _0x4e223a={'where':{'id':_0x5dafe8['params']['id']}},_0x4fb17c,_0x419929,_0x29492c,_0x398151,_0x4d6be2;_0x4e223a=_[_0x8c9d('0x3f')]({},_0x4e223a,_0x5dafe8[_0x8c9d('0x41')]);return db[_0x8c9d('0x2d')][_0x8c9d('0x48')](_0x4e223a)[_0x8c9d('0x27')](function(_0xdd5493){if(_0xdd5493){_0x4fb17c=_0xdd5493;return _0xdd5493[_0x8c9d('0x6d')]();}return null;})[_0x8c9d('0x27')](function(_0x1642b5){if(_0x1642b5){if(!_0x1642b5['length']){throw new db[(_0x8c9d('0x8d'))][(_0x8c9d('0xa9'))](_0x8c9d('0x6e'),0x193);}_0x419929=_0x1642b5;return db[_0x8c9d('0x6f')][_0x8c9d('0x44')]({'raw':!![]});}return null;})[_0x8c9d('0x27')](function(_0x8da741){if(_0x8da741){_0x29492c=_[_0x8c9d('0x8e')](_0x8da741,'id');var _0x3d2b9b;var _0x330d6f=squel[_0x8c9d('0x70')]();_0x330d6f[_0x8c9d('0xa3')](_0x4fb17c['table']);for(var _0x3b4567=0x0;_0x3b4567<_0x419929[_0x8c9d('0x39')];_0x3b4567+=0x1){_0x3d2b9b=_0x419929[_0x3b4567]['MetricId']?_0x29492c[_0x419929[_0x3b4567]['MetricId']]['metric']:_0x419929[_0x3b4567]['field'];_0x3d2b9b=_0x419929[_0x3b4567]['function']?_['replace'](_0x66b87c[_0x419929[_0x3b4567][_0x8c9d('0x75')]],'%s',_0x3d2b9b):_0x3d2b9b;_0x3d2b9b=_0x419929[_0x3b4567]['format']?_[_0x8c9d('0x74')](_0xf0ead9[_0x419929[_0x3b4567]['format']],'%s',_0x3d2b9b):_0x3d2b9b;if(_0x419929[_0x3b4567][_0x8c9d('0x77')]){_0x330d6f[_0x8c9d('0x69')](_0x3d2b9b);}_0x419929[_0x3b4567]['orderBy']&&_0x330d6f['order'](_0x3d2b9b,_0x419929[_0x3b4567]['orderBy']===_0x8c9d('0x78')?![]:!![]);_0x330d6f[_0x8c9d('0x6a')](_0x3d2b9b,_0x419929[_0x3b4567]['alias']||_0x3d2b9b);}if(_0x4fb17c[_0x8c9d('0x7a')]){_0x4fb17c['joins']=JSON[_0x8c9d('0x7b')](_0x4fb17c[_0x8c9d('0x7a')]);for(var _0xb28293=0x0;_0xb28293<_0x4fb17c[_0x8c9d('0x7a')]['length'];_0xb28293+=0x1){if(_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x30')]&&_[_0x8c9d('0x63')](_0x3ccbba,_0x4fb17c[_0x8c9d('0x7a')][_0xb28293]['type'])&&_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x7c')]&&_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x7d')]&&_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x7e')]){_0x330d6f[_0x4fb17c[_0x8c9d('0x7a')][_0xb28293]['type']](_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x7d')],null,util[_0x8c9d('0x76')](_0x8c9d('0x7f'),_0x4fb17c[_0x8c9d('0x71')],_0x4fb17c['joins'][_0xb28293][_0x8c9d('0x7c')],_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x7d')],_0x4fb17c[_0x8c9d('0x7a')][_0xb28293][_0x8c9d('0x7e')]));}}}if(_0x4fb17c[_0x8c9d('0x80')]){_0x4fb17c['conditions']=JSON[_0x8c9d('0x7b')](_0x4fb17c['conditions']);_0x330d6f[_0x8c9d('0x3d')](_0x9bbee6(_0x4fb17c[_0x8c9d('0x80')][_0x8c9d('0x69')]));}_0x4d6be2=_0x330d6f[_0x8c9d('0x81')]();_0x330d6f['limit'](_0x5ea95f);_0x330d6f['offset'](0x0);logger[_0x8c9d('0x82')](_0x8c9d('0x83'),_0x330d6f['toString']());return dbH[_0x8c9d('0x85')]['query'](_0x330d6f[_0x8c9d('0x84')](),{'type':dbH[_0x8c9d('0x85')][_0x8c9d('0x86')][_0x8c9d('0x87')]});}})['then'](function(){return{'sql':_0x4d6be2['toString']()};})['then'](respondWithResult(_0x34afbd,null))[_0x8c9d('0x49')](handleError(_0x34afbd,null));}; \ No newline at end of file +var _0xbb9e=['stack','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','fields','length','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','replace','format','orderBy','order','DESC','alias','joins','parse','includes','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','foreignTable','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','left_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','groupBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','function','debug','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','get','UserProfileResource','end','error'];(function(_0x5a194c,_0x315e13){var _0xa3e3ba=function(_0x2b1273){while(--_0x2b1273){_0x5a194c['push'](_0x5a194c['shift']());}};_0xa3e3ba(++_0x315e13);}(_0xbb9e,0x11e));var _0xebb9=function(_0x5d77be,_0x11ed48){_0x5d77be=_0x5d77be-0x0;var _0x2fb36c=_0xbb9e[_0x5d77be];return _0x2fb36c;};'use strict';var emlformat=require(_0xebb9('0x0'));var rimraf=require(_0xebb9('0x1'));var zipdir=require(_0xebb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebb9('0x3'));var moment=require('moment');var BPromise=require(_0xebb9('0x4'));var Mustache=require('mustache');var util=require(_0xebb9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xebb9('0x6'));var ejs=require(_0xebb9('0x7'));var fs=require('fs');var fs_extra=require(_0xebb9('0x8'));var _=require('lodash');var squel=require(_0xebb9('0x9'));var crypto=require(_0xebb9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xebb9('0xb'));var toCsv=require(_0xebb9('0x6'));var querystring=require(_0xebb9('0xc'));var Papa=require(_0xebb9('0xd'));var Redis=require(_0xebb9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xebb9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebb9('0x10'));var logger=require(_0xebb9('0x11'))(_0xebb9('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xebb9('0x13'));var db=require(_0xebb9('0x14'))['db'];var dbH=require('../../mysqldb')[_0xebb9('0x15')];function respondWithStatusCode(_0x2b63a8,_0x596655){_0x596655=_0x596655||0xcc;return function(_0x491b08){if(_0x491b08){return _0x2b63a8[_0xebb9('0x16')](_0x596655);}return _0x2b63a8[_0xebb9('0x17')](_0x596655)['end']();};}function respondWithResult(_0x209c9f,_0xa910e9){_0xa910e9=_0xa910e9||0xc8;return function(_0xbdb7fb){if(_0xbdb7fb){return _0x209c9f[_0xebb9('0x17')](_0xa910e9)[_0xebb9('0x18')](_0xbdb7fb);}};}function respondWithFilteredResult(_0x4ac9bb,_0x2ed7b4){return function(_0x4ac45d){if(_0x4ac45d){var _0x19442c=typeof _0x2ed7b4['offset']==='undefined'&&typeof _0x2ed7b4['limit']===_0xebb9('0x19');var _0x39e90f=_0x4ac45d[_0xebb9('0x1a')];var _0x11ed8=_0x19442c?0x0:_0x2ed7b4[_0xebb9('0x1b')];var _0x305618=_0x19442c?_0x4ac45d[_0xebb9('0x1a')]:_0x2ed7b4[_0xebb9('0x1b')]+_0x2ed7b4[_0xebb9('0x1c')];var _0x5df964;if(_0x305618>=_0x39e90f){_0x305618=_0x39e90f;_0x5df964=0xc8;}else{_0x5df964=0xce;}_0x4ac9bb[_0xebb9('0x17')](_0x5df964);return _0x4ac9bb[_0xebb9('0x1d')](_0xebb9('0x1e'),_0x11ed8+'-'+_0x305618+'/'+_0x39e90f)['json'](_0x4ac45d);}return null;};}function patchUpdates(_0x3cbfa6){return function(_0x4b66fe){try{jsonpatch['apply'](_0x4b66fe,_0x3cbfa6,!![]);}catch(_0x337da9){return BPromise[_0xebb9('0x1f')](_0x337da9);}return _0x4b66fe[_0xebb9('0x20')]();};}function saveUpdates(_0x577ff1,_0x24aa14){return function(_0x155018){if(_0x155018){return _0x155018['update'](_0x577ff1)[_0xebb9('0x21')](function(_0x308406){return _0x308406;});}return null;};}function removeEntity(_0x4a1a6a,_0x4a14b9){return function(_0x4b190d){if(_0x4b190d){return _0x4b190d['destroy']()['then'](function(){var _0x161855=_0x4b190d[_0xebb9('0x22')]({'plain':!![]});var _0x3bde42='CustomReports';return db[_0xebb9('0x23')]['destroy']({'where':{'type':_0x3bde42,'resourceId':_0x161855['id']}})[_0xebb9('0x21')](function(){return _0x4b190d;});})[_0xebb9('0x21')](function(){_0x4a1a6a[_0xebb9('0x17')](0xcc)[_0xebb9('0x24')]();});}};}function handleEntityNotFound(_0x3dc296,_0xafe3a3){return function(_0x16e021){if(!_0x16e021){_0x3dc296[_0xebb9('0x16')](0x194);}return _0x16e021;};}function handleError(_0x5994c3,_0x2d7c85){_0x2d7c85=_0x2d7c85||0x1f4;return function(_0x3e3f62){logger[_0xebb9('0x25')](_0x3e3f62[_0xebb9('0x26')]);if(_0x3e3f62['name']){delete _0x3e3f62['name'];}_0x5994c3[_0xebb9('0x17')](_0x2d7c85)[_0xebb9('0x27')](_0x3e3f62);};}exports['index']=function(_0xf8c6f4,_0xffbc38){var _0x166e3f={},_0x1c33a4={},_0x3e2dca={'count':0x0,'rows':[]};var _0x1d5811=_[_0xebb9('0x28')](db[_0xebb9('0x29')][_0xebb9('0x2a')],function(_0x536266){return{'name':_0x536266[_0xebb9('0x2b')],'type':_0x536266['type'][_0xebb9('0x2c')]};});_0x1c33a4[_0xebb9('0x2d')]=_['map'](_0x1d5811,_0xebb9('0x2e'));_0x1c33a4[_0xebb9('0x2f')]=_[_0xebb9('0x30')](_0xf8c6f4['query']);_0x1c33a4[_0xebb9('0x31')]=_['intersection'](_0x1c33a4[_0xebb9('0x2d')],_0x1c33a4[_0xebb9('0x2f')]);_0x166e3f[_0xebb9('0x32')]=_['intersection'](_0x1c33a4[_0xebb9('0x2d')],qs['fields'](_0xf8c6f4[_0xebb9('0x2f')]['fields']));_0x166e3f['attributes']=_0x166e3f['attributes']['length']?_0x166e3f[_0xebb9('0x32')]:_0x1c33a4[_0xebb9('0x2d')];if(!_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x33')]('nolimit')){_0x166e3f[_0xebb9('0x1c')]=qs[_0xebb9('0x1c')](_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x1c')]);_0x166e3f[_0xebb9('0x1b')]=qs['offset'](_0xf8c6f4['query'][_0xebb9('0x1b')]);}_0x166e3f['order']=qs['sort'](_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x34')]);_0x166e3f['where']=qs[_0xebb9('0x31')](_[_0xebb9('0x35')](_0xf8c6f4[_0xebb9('0x2f')],_0x1c33a4[_0xebb9('0x31')]),_0x1d5811);if(_0xf8c6f4[_0xebb9('0x2f')][_0xebb9('0x36')]){_0x166e3f[_0xebb9('0x37')]=_[_0xebb9('0x38')](_0x166e3f[_0xebb9('0x37')],{'$or':_[_0xebb9('0x28')](_0x1d5811,function(_0x374437){if(_0x374437[_0xebb9('0x39')]!==_0xebb9('0x3a')){var _0x257e74={};_0x257e74[_0x374437['name']]={'$like':'%'+_0xf8c6f4['query'][_0xebb9('0x36')]+'%'};return _0x257e74;}})});}_0x166e3f=_[_0xebb9('0x38')]({},_0x166e3f,_0xf8c6f4[_0xebb9('0x3b')]);var _0x5a88d1={'where':_0x166e3f[_0xebb9('0x37')]};return db[_0xebb9('0x29')][_0xebb9('0x1a')](_0x5a88d1)[_0xebb9('0x21')](function(_0x102126){_0x3e2dca['count']=_0x102126;if(_0xf8c6f4['query'][_0xebb9('0x3c')]){_0x166e3f[_0xebb9('0x3d')]=[{'all':!![]}];}return db[_0xebb9('0x29')][_0xebb9('0x3e')](_0x166e3f);})[_0xebb9('0x21')](function(_0x353dfa){_0x3e2dca[_0xebb9('0x3f')]=_0x353dfa;return _0x3e2dca;})[_0xebb9('0x21')](respondWithFilteredResult(_0xffbc38,_0x166e3f))[_0xebb9('0x40')](handleError(_0xffbc38,null));};exports[_0xebb9('0x41')]=function(_0x3e5306,_0xce287c){var _0x58ca9e={'raw':![],'where':{'id':_0x3e5306[_0xebb9('0x42')]['id']}},_0x138651={};_0x138651[_0xebb9('0x2d')]=_[_0xebb9('0x30')](db[_0xebb9('0x29')][_0xebb9('0x2a')]);_0x138651[_0xebb9('0x2f')]=_[_0xebb9('0x30')](_0x3e5306[_0xebb9('0x2f')]);_0x138651['filters']=_[_0xebb9('0x43')](_0x138651[_0xebb9('0x2d')],_0x138651[_0xebb9('0x2f')]);_0x58ca9e[_0xebb9('0x32')]=_[_0xebb9('0x43')](_0x138651[_0xebb9('0x2d')],qs['fields'](_0x3e5306[_0xebb9('0x2f')][_0xebb9('0x44')]));_0x58ca9e['attributes']=_0x58ca9e[_0xebb9('0x32')][_0xebb9('0x45')]?_0x58ca9e[_0xebb9('0x32')]:_0x138651[_0xebb9('0x2d')];if(_0x3e5306[_0xebb9('0x2f')][_0xebb9('0x3c')]){_0x58ca9e[_0xebb9('0x3d')]=[{'all':!![]}];}_0x58ca9e=_[_0xebb9('0x38')]({},_0x58ca9e,_0x3e5306['options']);return db['AnalyticCustomReport']['find'](_0x58ca9e)[_0xebb9('0x21')](handleEntityNotFound(_0xce287c,null))[_0xebb9('0x21')](respondWithResult(_0xce287c,null))[_0xebb9('0x40')](handleError(_0xce287c,null));};exports['create']=function(_0x59b9dc,_0x4115c0){return db['AnalyticCustomReport']['create'](_0x59b9dc[_0xebb9('0x46')],{})[_0xebb9('0x21')](function(_0x3a975d){var _0xa682b=_0x59b9dc[_0xebb9('0x47')]['get']({'plain':!![]});if(!_0xa682b)throw new Error(_0xebb9('0x48'));if(_0xa682b['role']===_0xebb9('0x47')){var _0x55f861=_0x3a975d[_0xebb9('0x22')]({'plain':!![]});var _0x6bb57e='Reports';return db['UserProfileSection'][_0xebb9('0x49')]({'where':{'name':_0x6bb57e,'userProfileId':_0xa682b['userProfileId']},'raw':!![]})[_0xebb9('0x21')](function(_0x33ab6c){if(_0x33ab6c&&_0x33ab6c[_0xebb9('0x4a')]===0x0){return db[_0xebb9('0x23')][_0xebb9('0x4b')]({'name':_0x55f861[_0xebb9('0x2e')],'resourceId':_0x55f861['id'],'type':_0xebb9('0x4c'),'sectionId':_0x33ab6c['id']},{})[_0xebb9('0x21')](function(){return _0x3a975d;});}else{return _0x3a975d;}})['catch'](function(_0x47dede){logger[_0xebb9('0x25')](_0xebb9('0x4d'),_0x47dede);throw _0x47dede;});}return _0x3a975d;})[_0xebb9('0x21')](respondWithResult(_0x4115c0,0xc9))[_0xebb9('0x40')](handleError(_0x4115c0,null));};exports[_0xebb9('0x4e')]=function(_0x5385a9,_0x477e3b){if(_0x5385a9['body']['id']){delete _0x5385a9['body']['id'];}return db[_0xebb9('0x29')][_0xebb9('0x49')]({'where':{'id':_0x5385a9['params']['id']}})[_0xebb9('0x21')](handleEntityNotFound(_0x477e3b,null))['then'](saveUpdates(_0x5385a9[_0xebb9('0x46')],null))[_0xebb9('0x21')](respondWithResult(_0x477e3b,null))[_0xebb9('0x40')](handleError(_0x477e3b,null));};exports['destroy']=function(_0x4c7dd2,_0x4248f1){return db[_0xebb9('0x29')][_0xebb9('0x49')]({'where':{'id':_0x4c7dd2[_0xebb9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4248f1,null))[_0xebb9('0x21')](removeEntity(_0x4248f1,null))[_0xebb9('0x40')](handleError(_0x4248f1,null));};exports[_0xebb9('0x4f')]=function(_0x1f2e3f,_0x1c197d){var _0x1caaa=0xa;var _0x734350=['join','left_join',_0xebb9('0x50'),_0xebb9('0x51')];var _0x361b50={'SUM':_0xebb9('0x52'),'COUNT':_0xebb9('0x53'),'COUNT DISTINCT':_0xebb9('0x54'),'MAX':'MAX(%s)','MIN':_0xebb9('0x55'),'AVG':_0xebb9('0x56'),'GROUP_CONCAT':_0xebb9('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xebb9('0x58')};var _0x5a676b={'SEC_TO_TIME':_0xebb9('0x59'),'DATE':_0xebb9('0x5a'),'HOUR':_0xebb9('0x5b'),'ROUND':_0xebb9('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x37b29d=function(_0x19e390){return!_['includes'](['IS\x20NULL',_0xebb9('0x5d'),_0xebb9('0x5e'),_0xebb9('0x5f')],_0x19e390);};var _0x2732d2=function(_0x251f08){if(!_0x251f08||!_0x251f08[_0xebb9('0x60')][_0xebb9('0x45')]){return'';}for(var _0x1df289='(',_0x121eb2=0x0;_0x121eb2<_0x251f08['rules'][_0xebb9('0x45')];_0x121eb2+=0x1){_0x121eb2>0x0&&(_0x1df289+='\x20'+_0x251f08[_0xebb9('0x61')]+'\x20');_0x1df289+=_0x251f08['rules'][_0x121eb2][_0xebb9('0x62')]?_0x2732d2(_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x62')]):_0x251f08[_0xebb9('0x60')][_0x121eb2]['field']+'\x20'+_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x63')]+(_0x37b29d(_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x63')])?'\x20'+_0x251f08[_0xebb9('0x60')][_0x121eb2][_0xebb9('0x64')]:'');}return _0x1df289+')';};var _0x39cea6={'where':{'id':_0x1f2e3f[_0xebb9('0x42')]['id']}},_0x4579f4,_0x3525ec,_0x5dcfc1,_0x4ae4d6,_0x443130;_0x39cea6=_[_0xebb9('0x38')]({},_0x39cea6,_0x1f2e3f[_0xebb9('0x3b')]);return db[_0xebb9('0x29')]['find'](_0x39cea6)[_0xebb9('0x21')](function(_0x2f33a0){if(_0x2f33a0){_0x4579f4=_0x2f33a0;return _0x2f33a0[_0xebb9('0x65')]();}return null;})[_0xebb9('0x21')](function(_0x255969){if(_0x255969){if(!_0x255969[_0xebb9('0x45')]){throw new db[(_0xebb9('0x66'))][(_0xebb9('0x67'))](_0xebb9('0x68'),0x193);}_0x3525ec=_0x255969;return db[_0xebb9('0x69')][_0xebb9('0x3e')]({'raw':!![]});}return null;})[_0xebb9('0x21')](function(_0x1eb045){if(_0x1eb045){_0x5dcfc1=_[_0xebb9('0x6a')](_0x1eb045,'id');var _0x4100f3;var _0x14406b=squel[_0xebb9('0x6b')]();_0x14406b[_0xebb9('0x6c')](_0x4579f4['table']);for(var _0x1415b1=0x0;_0x1415b1<_0x3525ec[_0xebb9('0x45')];_0x1415b1+=0x1){_0x4100f3=_0x3525ec[_0x1415b1][_0xebb9('0x6d')]?_0x5dcfc1[_0x3525ec[_0x1415b1][_0xebb9('0x6d')]][_0xebb9('0x6e')]:_0x3525ec[_0x1415b1][_0xebb9('0x6f')];_0x4100f3=_0x3525ec[_0x1415b1]['function']?_[_0xebb9('0x70')](_0x361b50[_0x3525ec[_0x1415b1]['function']],'%s',_0x4100f3):_0x4100f3;_0x4100f3=_0x3525ec[_0x1415b1]['format']?_[_0xebb9('0x70')](_0x5a676b[_0x3525ec[_0x1415b1][_0xebb9('0x71')]],'%s',_0x4100f3):_0x4100f3;if(_0x3525ec[_0x1415b1]['groupBy']){_0x14406b[_0xebb9('0x62')](_0x4100f3);}_0x3525ec[_0x1415b1][_0xebb9('0x72')]&&_0x14406b[_0xebb9('0x73')](_0x4100f3,_0x3525ec[_0x1415b1]['orderBy']===_0xebb9('0x74')?![]:!![]);_0x14406b[_0xebb9('0x6f')](_0x4100f3,_0x3525ec[_0x1415b1][_0xebb9('0x75')]||_0x4100f3);}if(_0x4579f4[_0xebb9('0x76')]){_0x4579f4['joins']=JSON[_0xebb9('0x77')](_0x4579f4[_0xebb9('0x76')]);for(var _0x382fed=0x0;_0x382fed<_0x4579f4[_0xebb9('0x76')][_0xebb9('0x45')];_0x382fed+=0x1){if(_0x4579f4[_0xebb9('0x76')][_0x382fed][_0xebb9('0x39')]&&_[_0xebb9('0x78')](_0x734350,_0x4579f4[_0xebb9('0x76')][_0x382fed]['type'])&&_0x4579f4[_0xebb9('0x76')][_0x382fed]['parentKey']&&_0x4579f4[_0xebb9('0x76')][_0x382fed]['foreignTable']&&_0x4579f4[_0xebb9('0x76')][_0x382fed][_0xebb9('0x79')]){_0x14406b[_0x4579f4[_0xebb9('0x76')][_0x382fed]['type']](_0x4579f4['joins'][_0x382fed]['foreignTable'],null,util[_0xebb9('0x71')](_0xebb9('0x7a'),_0x4579f4[_0xebb9('0x7b')],_0x4579f4['joins'][_0x382fed][_0xebb9('0x7c')],_0x4579f4[_0xebb9('0x76')][_0x382fed][_0xebb9('0x7d')],_0x4579f4['joins'][_0x382fed][_0xebb9('0x79')]));}}}if(_0x4579f4[_0xebb9('0x7e')]){_0x4579f4['conditions']=JSON[_0xebb9('0x77')](_0x4579f4['conditions']);_0x14406b[_0xebb9('0x37')](_0x2732d2(_0x4579f4['conditions'][_0xebb9('0x62')]));}_0x443130=_0x14406b[_0xebb9('0x7f')]();_0x14406b[_0xebb9('0x1c')](_0x1caaa);_0x14406b[_0xebb9('0x1b')](0x0);logger['debug'](_0xebb9('0x80'),_0x14406b['toString']());return dbH[_0xebb9('0x81')]['query'](_0x14406b[_0xebb9('0x82')](),{'type':dbH[_0xebb9('0x81')][_0xebb9('0x83')][_0xebb9('0x84')]});}})[_0xebb9('0x21')](respondWithResult(_0x1c197d,null))[_0xebb9('0x40')](handleError(_0x1c197d,null));};function runReport(_0x2cc099,_0x573e34,_0x501aea){var _0x38fe62=_0x573e34['name'];var _0x2a7f64=0xa;var _0x4e3d08=[_0xebb9('0x85'),_0xebb9('0x86'),_0xebb9('0x50'),_0xebb9('0x51')];var _0x353d35={'SUM':_0xebb9('0x52'),'COUNT':_0xebb9('0x53'),'COUNT DISTINCT':_0xebb9('0x54'),'MAX':_0xebb9('0x87'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xebb9('0x88'),'GROUP_CONCAT DESC':_0xebb9('0x58')};var _0x3d5b12={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xebb9('0x5a'),'HOUR':_0xebb9('0x5b'),'ROUND':_0xebb9('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2366d2=function(_0x221561){return!_[_0xebb9('0x78')]([_0xebb9('0x89'),_0xebb9('0x5d'),'IS\x20EMPTY',_0xebb9('0x5f')],_0x221561);};var _0x35b66d=function(_0x1f69b2){if(!_0x1f69b2||!_0x1f69b2[_0xebb9('0x60')][_0xebb9('0x45')]){return'';}for(var _0x3de965='(',_0x54dbdf=0x0;_0x54dbdf<_0x1f69b2[_0xebb9('0x60')][_0xebb9('0x45')];_0x54dbdf+=0x1){_0x54dbdf>0x0&&(_0x3de965+='\x20'+_0x1f69b2[_0xebb9('0x61')]+'\x20');_0x3de965+=_0x1f69b2['rules'][_0x54dbdf][_0xebb9('0x62')]?_0x35b66d(_0x1f69b2['rules'][_0x54dbdf]['group']):_0x1f69b2[_0xebb9('0x60')][_0x54dbdf][_0xebb9('0x6f')]+'\x20'+_0x1f69b2['rules'][_0x54dbdf][_0xebb9('0x63')]+(_0x2366d2(_0x1f69b2[_0xebb9('0x60')][_0x54dbdf]['condition'])?'\x20'+_0x1f69b2[_0xebb9('0x60')][_0x54dbdf][_0xebb9('0x64')]:'');}return _0x3de965+')';};var _0x1a4149={'where':{'id':_0x2cc099['id']}},_0x5e8413,_0x4c8513,_0x5102f0,_0x25b164,_0x425b05;_0x1a4149=_[_0xebb9('0x38')]({},_0x1a4149,_0x501aea);return db[_0xebb9('0x29')][_0xebb9('0x49')](_0x1a4149)['then'](function(_0x385e2f){if(_0x385e2f){_0x5e8413=_0x385e2f;return _0x385e2f[_0xebb9('0x65')]();}return null;})[_0xebb9('0x21')](function(_0x47325c){if(_0x47325c){if(!_0x47325c[_0xebb9('0x45')]){throw new db['Sequelize'][(_0xebb9('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4c8513=_0x47325c;return db[_0xebb9('0x69')][_0xebb9('0x3e')]({'raw':!![]});}return null;})[_0xebb9('0x21')](function(_0x6ab956){if(_0x6ab956){_0x5102f0=_['keyBy'](_0x6ab956,'id');var _0x507a1b;var _0x4c99cf=squel['select']();_0x4c99cf[_0xebb9('0x6c')](_0x5e8413[_0xebb9('0x7b')]);for(var _0xcf3bfc=0x0;_0xcf3bfc<_0x4c8513[_0xebb9('0x45')];_0xcf3bfc+=0x1){_0x507a1b=_0x4c8513[_0xcf3bfc][_0xebb9('0x6d')]?_0x5102f0[_0x4c8513[_0xcf3bfc][_0xebb9('0x6d')]][_0xebb9('0x6e')]:_0x4c8513[_0xcf3bfc][_0xebb9('0x6f')];_0x507a1b=_0x4c8513[_0xcf3bfc]['function']?_[_0xebb9('0x70')](_0x353d35[_0x4c8513[_0xcf3bfc]['function']],'%s',_0x507a1b):_0x507a1b;_0x507a1b=_0x4c8513[_0xcf3bfc]['format']?_[_0xebb9('0x70')](_0x3d5b12[_0x4c8513[_0xcf3bfc][_0xebb9('0x71')]],'%s',_0x507a1b):_0x507a1b;if(_0x4c8513[_0xcf3bfc][_0xebb9('0x8a')]){_0x4c99cf[_0xebb9('0x62')](_0x507a1b);}_0x4c8513[_0xcf3bfc][_0xebb9('0x72')]&&_0x4c99cf[_0xebb9('0x73')](_0x507a1b,_0x4c8513[_0xcf3bfc][_0xebb9('0x72')]===_0xebb9('0x74')?![]:!![]);_0x4c99cf['field'](_0x507a1b,_0x4c8513[_0xcf3bfc][_0xebb9('0x75')]||_0x507a1b);}if(_0x5e8413[_0xebb9('0x76')]){_0x5e8413[_0xebb9('0x76')]=JSON[_0xebb9('0x77')](_0x5e8413[_0xebb9('0x76')]);for(var _0x497e2d=0x0;_0x497e2d<_0x5e8413['joins'][_0xebb9('0x45')];_0x497e2d+=0x1){if(_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x39')]&&_['includes'](_0x4e3d08,_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x39')])&&_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x7c')]&&_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x7d')]&&_0x5e8413[_0xebb9('0x76')][_0x497e2d][_0xebb9('0x79')]){_0x4c99cf[_0x5e8413['joins'][_0x497e2d][_0xebb9('0x39')]](_0x5e8413[_0xebb9('0x76')][_0x497e2d]['foreignTable'],null,util[_0xebb9('0x71')](_0xebb9('0x7a'),_0x5e8413['table'],_0x5e8413[_0xebb9('0x76')][_0x497e2d]['parentKey'],_0x5e8413[_0xebb9('0x76')][_0x497e2d]['foreignTable'],_0x5e8413['joins'][_0x497e2d]['foreignKey']));}}}if(_0x5e8413[_0xebb9('0x7e')]){_0x5e8413[_0xebb9('0x7e')]=JSON[_0xebb9('0x77')](_0x5e8413[_0xebb9('0x7e')]);_0x4c99cf[_0xebb9('0x37')](_0x35b66d(_0x5e8413[_0xebb9('0x7e')][_0xebb9('0x62')]));}_0x425b05=_0x4c99cf['clone']();_0x4c99cf[_0xebb9('0x1c')](_0x2a7f64);_0x4c99cf[_0xebb9('0x1b')](0x0);return;}})[_0xebb9('0x21')](function(){if(_0x573e34[_0xebb9('0x8b')]===_0xebb9('0x8c')){return null;}var _0x451bae=_[_0xebb9('0x38')](_0x573e34,{'name':_0x573e34[_0xebb9('0x8d')]||_0x573e34[_0xebb9('0x2e')]||_0x5e8413[_0xebb9('0x2e')],'basename':_0x38fe62,'savename':util[_0xebb9('0x71')](_0xebb9('0x8e'),_0x573e34[_0xebb9('0x2e')]||_0x5e8413[_0xebb9('0x2e')],require(_0xebb9('0x8f'))[_0xebb9('0x90')](0x4),_0x573e34[_0xebb9('0x8b')]||_0xebb9('0x91')),'reportId':_0x5e8413['id'],'reportType':_0xebb9('0x92')});return db['AnalyticExtractedReport'][_0xebb9('0x4b')](_0x451bae,{'raw':!![]});})[_0xebb9('0x21')](function(_0x7fcb8a){if(_0x5e8413['table']===_0xebb9('0x93')){_0x425b05['where'](_0x5e8413[_0xebb9('0x7b')]+_0xebb9('0x94'),_0x573e34[_0xebb9('0x95')],_0x573e34[_0xebb9('0x96')]);}else{_0x425b05[_0xebb9('0x37')](_0x5e8413['table']+_0xebb9('0x97'),_0x573e34[_0xebb9('0x95')],_0x573e34[_0xebb9('0x96')]);}if(_0x7fcb8a){logger['info'](_0xebb9('0x98'),_0x425b05[_0xebb9('0x82')]());require('child_process')[_0xebb9('0x99')](path[_0xebb9('0x85')](__dirname,_0xebb9('0x9a'),_0x7fcb8a[_0xebb9('0x8b')]),[_0x7fcb8a['id'],_0x425b05['toString'](),path[_0xebb9('0x85')](__dirname,_0xebb9('0x9b'),_0x7fcb8a[_0xebb9('0x9c')]),_0x38fe62]);return _0x7fcb8a;}else{var _0x4be535=squel[_0xebb9('0x6b')]();_0x4be535[_0xebb9('0x6c')]('('+_0x425b05[_0xebb9('0x82')]()+')',_0xebb9('0x9d'));_0x4be535[_0xebb9('0x6f')](_0xebb9('0x9e'),_0xebb9('0x1a'));_0x425b05[_0xebb9('0x1c')](_0x573e34[_0xebb9('0x1c')]||_0x2a7f64);_0x425b05['offset'](_0x573e34[_0xebb9('0x1b')]||0x0);return dbH[_0xebb9('0x81')][_0xebb9('0x2f')](_0x4be535[_0xebb9('0x82')](),{'type':dbH[_0xebb9('0x81')]['QueryTypes']['SELECT']})[_0xebb9('0x21')](function(_0x195904){if(!_0x195904[_0xebb9('0x45')]){_0x25b164=0x0;}else{_0x25b164=_0x195904[0x0][_0xebb9('0x1a')]||0x0;}return dbH['sequelize'][_0xebb9('0x2f')](_0x425b05['toString'](),{'type':dbH[_0xebb9('0x81')][_0xebb9('0x83')]['SELECT']});})[_0xebb9('0x21')](function(_0x394065){return{'rows':_0x394065||[],'count':_0x25b164};});}});}exports['run']=function(_0x65d6ed,_0x1c09fe){return runReport(_0x65d6ed[_0xebb9('0x42')],_0x65d6ed[_0xebb9('0x2f')],_0x65d6ed['options'])[_0xebb9('0x21')](respondWithResult(_0x1c09fe,null))[_0xebb9('0x40')](handleError(_0x1c09fe,null));};exports[_0xebb9('0x9f')]=runReport;exports[_0xebb9('0x2f')]=function(_0x5867af,_0x10a40b){var _0x943392=0xa;var _0x1bdf62=['join','left_join',_0xebb9('0x50'),_0xebb9('0x51')];var _0x15cdf8={'SUM':'SUM(%s)','COUNT':_0xebb9('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xebb9('0x87'),'MIN':_0xebb9('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xebb9('0x57'),'GROUP_CONCAT ASC':_0xebb9('0x88'),'GROUP_CONCAT DESC':_0xebb9('0x58')};var _0x4ff385={'SEC_TO_TIME':_0xebb9('0x59'),'DATE':_0xebb9('0x5a'),'HOUR':_0xebb9('0x5b'),'ROUND':_0xebb9('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ab074=function(_0x1c844f){return!_['includes']([_0xebb9('0x89'),'IS\x20NOT\x20NULL',_0xebb9('0x5e'),_0xebb9('0x5f')],_0x1c844f);};var _0x15c4ba=function(_0x43db8b){if(!_0x43db8b||!_0x43db8b[_0xebb9('0x60')][_0xebb9('0x45')]){return'';}for(var _0x466751='(',_0x52ed4b=0x0;_0x52ed4b<_0x43db8b[_0xebb9('0x60')][_0xebb9('0x45')];_0x52ed4b+=0x1){_0x52ed4b>0x0&&(_0x466751+='\x20'+_0x43db8b[_0xebb9('0x61')]+'\x20');_0x466751+=_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x62')]?_0x15c4ba(_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x62')]):_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x6f')]+'\x20'+_0x43db8b[_0xebb9('0x60')][_0x52ed4b]['condition']+(_0x1ab074(_0x43db8b[_0xebb9('0x60')][_0x52ed4b]['condition'])?'\x20'+_0x43db8b[_0xebb9('0x60')][_0x52ed4b][_0xebb9('0x64')]:'');}return _0x466751+')';};var _0x29208f={'where':{'id':_0x5867af['params']['id']}},_0x43cfd3,_0x2a0f69,_0x549444,_0x456b21,_0x22f4dc;_0x29208f=_['merge']({},_0x29208f,_0x5867af[_0xebb9('0x3b')]);return db[_0xebb9('0x29')][_0xebb9('0x49')](_0x29208f)['then'](function(_0x503402){if(_0x503402){_0x43cfd3=_0x503402;return _0x503402['getFields']();}return null;})[_0xebb9('0x21')](function(_0x3f54e5){if(_0x3f54e5){if(!_0x3f54e5[_0xebb9('0x45')]){throw new db[(_0xebb9('0x66'))][(_0xebb9('0x67'))](_0xebb9('0x68'),0x193);}_0x2a0f69=_0x3f54e5;return db[_0xebb9('0x69')][_0xebb9('0x3e')]({'raw':!![]});}return null;})[_0xebb9('0x21')](function(_0x1f0a5d){if(_0x1f0a5d){_0x549444=_[_0xebb9('0x6a')](_0x1f0a5d,'id');var _0x31add8;var _0x272a3b=squel[_0xebb9('0x6b')]();_0x272a3b['from'](_0x43cfd3[_0xebb9('0x7b')]);for(var _0x285295=0x0;_0x285295<_0x2a0f69[_0xebb9('0x45')];_0x285295+=0x1){_0x31add8=_0x2a0f69[_0x285295][_0xebb9('0x6d')]?_0x549444[_0x2a0f69[_0x285295][_0xebb9('0x6d')]]['metric']:_0x2a0f69[_0x285295][_0xebb9('0x6f')];_0x31add8=_0x2a0f69[_0x285295][_0xebb9('0xa0')]?_[_0xebb9('0x70')](_0x15cdf8[_0x2a0f69[_0x285295][_0xebb9('0xa0')]],'%s',_0x31add8):_0x31add8;_0x31add8=_0x2a0f69[_0x285295][_0xebb9('0x71')]?_[_0xebb9('0x70')](_0x4ff385[_0x2a0f69[_0x285295][_0xebb9('0x71')]],'%s',_0x31add8):_0x31add8;if(_0x2a0f69[_0x285295][_0xebb9('0x8a')]){_0x272a3b['group'](_0x31add8);}_0x2a0f69[_0x285295][_0xebb9('0x72')]&&_0x272a3b[_0xebb9('0x73')](_0x31add8,_0x2a0f69[_0x285295][_0xebb9('0x72')]===_0xebb9('0x74')?![]:!![]);_0x272a3b[_0xebb9('0x6f')](_0x31add8,_0x2a0f69[_0x285295][_0xebb9('0x75')]||_0x31add8);}if(_0x43cfd3['joins']){_0x43cfd3[_0xebb9('0x76')]=JSON[_0xebb9('0x77')](_0x43cfd3['joins']);for(var _0xee197b=0x0;_0xee197b<_0x43cfd3['joins']['length'];_0xee197b+=0x1){if(_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x39')]&&_[_0xebb9('0x78')](_0x1bdf62,_0x43cfd3[_0xebb9('0x76')][_0xee197b]['type'])&&_0x43cfd3['joins'][_0xee197b]['parentKey']&&_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x7d')]&&_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x79')]){_0x272a3b[_0x43cfd3[_0xebb9('0x76')][_0xee197b]['type']](_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x7d')],null,util[_0xebb9('0x71')](_0xebb9('0x7a'),_0x43cfd3[_0xebb9('0x7b')],_0x43cfd3[_0xebb9('0x76')][_0xee197b]['parentKey'],_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x7d')],_0x43cfd3[_0xebb9('0x76')][_0xee197b][_0xebb9('0x79')]));}}}if(_0x43cfd3[_0xebb9('0x7e')]){_0x43cfd3[_0xebb9('0x7e')]=JSON[_0xebb9('0x77')](_0x43cfd3[_0xebb9('0x7e')]);_0x272a3b['where'](_0x15c4ba(_0x43cfd3[_0xebb9('0x7e')][_0xebb9('0x62')]));}_0x22f4dc=_0x272a3b[_0xebb9('0x7f')]();_0x272a3b['limit'](_0x943392);_0x272a3b[_0xebb9('0x1b')](0x0);logger[_0xebb9('0xa1')](_0xebb9('0x80'),_0x272a3b[_0xebb9('0x82')]());return dbH['sequelize'][_0xebb9('0x2f')](_0x272a3b[_0xebb9('0x82')](),{'type':dbH[_0xebb9('0x81')][_0xebb9('0x83')]['SELECT']});}})['then'](function(){return{'sql':_0x22f4dc['toString']()};})['then'](respondWithResult(_0x10a40b,null))[_0xebb9('0x40')](handleError(_0x10a40b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 3778fdb..050df8b 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 _0x370a=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x1c461e,_0x1b98ff){var _0x1dce4f=function(_0x5cbdf0){while(--_0x5cbdf0){_0x1c461e['push'](_0x1c461e['shift']());}};_0x1dce4f(++_0x1b98ff);}(_0x370a,0xfb));var _0xa370=function(_0x56fb4a,_0x1a66ec){_0x56fb4a=_0x56fb4a-0x0;var _0x4e47fd=_0x370a[_0x56fb4a];return _0x4e47fd;};'use strict';var _=require(_0xa370('0x0'));var util=require(_0xa370('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa370('0x2'));var BPromise=require(_0xa370('0x3'));var rp=require(_0xa370('0x4'));var fs=require('fs');var path=require(_0xa370('0x5'));var rimraf=require(_0xa370('0x6'));var config=require(_0xa370('0x7'));var attributes=require(_0xa370('0x8'));module[_0xa370('0x9')]=function(_0x3d9271,_0x335d4c){return _0x3d9271[_0xa370('0xa')](_0xa370('0xb'),attributes,{'tableName':_0xa370('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57a9=['bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0x30de86,_0x3f067c){var _0x84c896=function(_0x59c517){while(--_0x59c517){_0x30de86['push'](_0x30de86['shift']());}};_0x84c896(++_0x3f067c);}(_0x57a9,0x158));var _0x957a=function(_0xf92e67,_0x5de510){_0xf92e67=_0xf92e67-0x0;var _0x23438d=_0x57a9[_0xf92e67];return _0x23438d;};'use strict';var _=require(_0x957a('0x0'));var util=require(_0x957a('0x1'));var logger=require(_0x957a('0x2'))(_0x957a('0x3'));var moment=require('moment');var BPromise=require(_0x957a('0x4'));var rp=require(_0x957a('0x5'));var fs=require('fs');var path=require(_0x957a('0x6'));var rimraf=require('rimraf');var config=require(_0x957a('0x7'));var attributes=require(_0x957a('0x8'));module[_0x957a('0x9')]=function(_0x19417e,_0x2792b1){return _0x19417e[_0x957a('0xa')](_0x957a('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 974cb72..8f8c8bf 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 _0x2911=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5f0864,_0x413e01){var _0x5700dc=function(_0x1677cf){while(--_0x1677cf){_0x5f0864['push'](_0x5f0864['shift']());}};_0x5700dc(++_0x413e01);}(_0x2911,0x163));var _0x1291=function(_0x2bd440,_0x46c53d){_0x2bd440=_0x2bd440-0x0;var _0xc57de4=_0x2911[_0x2bd440];return _0xc57de4;};'use strict';var _=require(_0x1291('0x0'));var util=require(_0x1291('0x1'));var moment=require(_0x1291('0x2'));var BPromise=require(_0x1291('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1291('0x4'));var db=require(_0x1291('0x5'))['db'];var utils=require(_0x1291('0x6'));var logger=require(_0x1291('0x7'))(_0x1291('0x8'));var config=require(_0x1291('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1291('0xa')][_0x1291('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14939f,_0x323755,_0x28001b){return new BPromise(function(_0x3b591c,_0x1641fb){return client[_0x1291('0xc')](_0x14939f,_0x28001b)['then'](function(_0x4cba96){logger['info'](_0x1291('0xd'),_0x323755,_0x1291('0xe'));logger[_0x1291('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x323755,_0x1291('0xe'),JSON['stringify'](_0x4cba96));if(_0x4cba96[_0x1291('0x10')]){if(_0x4cba96[_0x1291('0x10')][_0x1291('0x11')]===0x1f4){logger[_0x1291('0x10')](_0x1291('0xd'),_0x323755,_0x4cba96[_0x1291('0x10')][_0x1291('0x12')]);return _0x1641fb(_0x4cba96[_0x1291('0x10')]['message']);}logger[_0x1291('0x10')](_0x1291('0xd'),_0x323755,_0x4cba96['error'][_0x1291('0x12')]);return _0x3b591c(_0x4cba96[_0x1291('0x10')][_0x1291('0x12')]);}else{logger[_0x1291('0x13')](_0x1291('0xd'),_0x323755,_0x1291('0xe'));_0x3b591c(_0x4cba96[_0x1291('0x14')][_0x1291('0x12')]);}})[_0x1291('0x15')](function(_0x2c6569){logger[_0x1291('0x10')](_0x1291('0xd'),_0x323755,_0x2c6569);_0x1641fb(_0x2c6569);});});} \ No newline at end of file +var _0x05d0=['rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x05d0,0x1ad));var _0x005d=function(_0x381aea,_0x340970){_0x381aea=_0x381aea-0x0;var _0x29a7c3=_0x05d0[_0x381aea];return _0x29a7c3;};'use strict';var _=require(_0x005d('0x0'));var util=require(_0x005d('0x1'));var moment=require(_0x005d('0x2'));var BPromise=require('bluebird');var rs=require(_0x005d('0x3'));var fs=require('fs');var Redis=require(_0x005d('0x4'));var db=require(_0x005d('0x5'))['db'];var utils=require(_0x005d('0x6'));var logger=require(_0x005d('0x7'))(_0x005d('0x8'));var config=require(_0x005d('0x9'));var jayson=require(_0x005d('0xa'));var client=jayson[_0x005d('0xb')][_0x005d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2aeabc,_0x4cf4bf,_0x14373f){return new BPromise(function(_0x50dee8,_0x25583b){return client['request'](_0x2aeabc,_0x14373f)['then'](function(_0x163c2b){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x4cf4bf,_0x005d('0xd'));logger[_0x005d('0xe')](_0x005d('0xf'),_0x4cf4bf,_0x005d('0xd'),JSON[_0x005d('0x10')](_0x163c2b));if(_0x163c2b['error']){if(_0x163c2b[_0x005d('0x11')][_0x005d('0x12')]===0x1f4){logger[_0x005d('0x11')](_0x005d('0x13'),_0x4cf4bf,_0x163c2b[_0x005d('0x11')][_0x005d('0x14')]);return _0x25583b(_0x163c2b[_0x005d('0x11')]['message']);}logger[_0x005d('0x11')](_0x005d('0x13'),_0x4cf4bf,_0x163c2b['error'][_0x005d('0x14')]);return _0x50dee8(_0x163c2b[_0x005d('0x11')][_0x005d('0x14')]);}else{logger[_0x005d('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4cf4bf,'request\x20sent');_0x50dee8(_0x163c2b[_0x005d('0x16')]['message']);}})['catch'](function(_0x40793d){logger[_0x005d('0x11')](_0x005d('0x13'),_0x4cf4bf,_0x40793d);_0x25583b(_0x40793d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 880bc2c..767c688 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 _0xa275=['post','create','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','/:id/query','query'];(function(_0x4e0e01,_0x2e1f1b){var _0x2389bd=function(_0x9c8e06){while(--_0x9c8e06){_0x4e0e01['push'](_0x4e0e01['shift']());}};_0x2389bd(++_0x2e1f1b);}(_0xa275,0x1d3));var _0x5a27=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa275[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5a27('0x0'));var util=require('util');var path=require(_0x5a27('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a27('0x2'));var router=express[_0x5a27('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5a27('0x4'));var interaction=require(_0x5a27('0x5'));var config=require(_0x5a27('0x6'));var controller=require(_0x5a27('0x7'));router[_0x5a27('0x8')]('/',auth[_0x5a27('0x9')](),controller['index']);router['get'](_0x5a27('0xa'),auth[_0x5a27('0x9')](),controller[_0x5a27('0xb')]);router['get'](_0x5a27('0xc'),auth[_0x5a27('0x9')](),controller['preview']);router['get'](_0x5a27('0xd'),auth['isAuthenticated'](),controller['run']);router[_0x5a27('0x8')](_0x5a27('0xe'),auth['isAuthenticated'](),controller[_0x5a27('0xf')]);router[_0x5a27('0x10')]('/',auth['isAuthenticated'](),controller[_0x5a27('0x11')]);router['put']('/:id',auth[_0x5a27('0x9')](),controller[_0x5a27('0x12')]);router[_0x5a27('0x13')](_0x5a27('0xa'),auth['isAuthenticated'](),controller[_0x5a27('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd753=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','multer'];(function(_0x298bf2,_0x183093){var _0x39d076=function(_0xcb9356){while(--_0xcb9356){_0x298bf2['push'](_0x298bf2['shift']());}};_0x39d076(++_0x183093);}(_0xd753,0x137));var _0x3d75=function(_0x3f645e,_0x14b15b){_0x3f645e=_0x3f645e-0x0;var _0x277d67=_0xd753[_0x3f645e];return _0x277d67;};'use strict';var multer=require(_0x3d75('0x0'));var util=require(_0x3d75('0x1'));var path=require('path');var timeout=require(_0x3d75('0x2'));var express=require(_0x3d75('0x3'));var router=express[_0x3d75('0x4')]();var fs_extra=require(_0x3d75('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d75('0x6'));var config=require(_0x3d75('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x3d75('0x8')]('/',auth[_0x3d75('0x9')](),controller[_0x3d75('0xa')]);router[_0x3d75('0x8')](_0x3d75('0xb'),auth['isAuthenticated'](),controller[_0x3d75('0xc')]);router[_0x3d75('0x8')](_0x3d75('0xd'),auth[_0x3d75('0x9')](),controller['preview']);router['get'](_0x3d75('0xe'),auth[_0x3d75('0x9')](),controller[_0x3d75('0xf')]);router[_0x3d75('0x8')](_0x3d75('0x10'),auth[_0x3d75('0x9')](),controller[_0x3d75('0x11')]);router[_0x3d75('0x12')]('/',auth['isAuthenticated'](),controller[_0x3d75('0x13')]);router[_0x3d75('0x14')]('/:id',auth[_0x3d75('0x9')](),controller[_0x3d75('0x15')]);router[_0x3d75('0x16')](_0x3d75('0xb'),auth[_0x3d75('0x9')](),controller['destroy']);module[_0x3d75('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 10818e7..bf7ccc1 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 _0x7da7=['TEXT','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7da7,0x10d));var _0x77da=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7da7[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x77da('0x2')]},'conditions':{'type':Sequelize[_0x77da('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x4417e2,_0x4d53b1){var _0x58b483=function(_0x1857be){while(--_0x1857be){_0x4417e2['push'](_0x4417e2['shift']());}};_0x58b483(++_0x4d53b1);}(_0x814b,0x1a2));var _0xb814=function(_0x9a7ea6,_0x1807a2){_0x9a7ea6=_0x9a7ea6-0x0;var _0x1c2040=_0x814b[_0x9a7ea6];return _0x1c2040;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7b84b4f..5988d08 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x16b495,_0x2eedfb){var _0x2b0c87=function(_0xfbbf7e){while(--_0xfbbf7e){_0x16b495['push'](_0x16b495['shift']());}};_0x2b0c87(++_0x2eedfb);}(_0x1967,0x173));var _0x7196=function(_0x7e46a7,_0x51ed98){_0x7e46a7=_0x7e46a7-0x0;var _0x41aec6=_0x1967[_0x7e46a7];return _0x41aec6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x426f3a,_0x3ad8bb){var _0x1f01b3=function(_0x2b96e4){while(--_0x2b96e4){_0x426f3a['push'](_0x426f3a['shift']());}};_0x1f01b3(++_0x3ad8bb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5408c9,_0x19f8e7){_0x5408c9=_0x5408c9-0x0;var _0x4512df=_0x3f8a[_0x5408c9];return _0x4512df;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 9dc04e8..258c62c 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 _0x3596=['moment','bluebird','path','rimraf','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','api'];(function(_0x10449b,_0xc645ce){var _0x333339=function(_0x4db72b){while(--_0x4db72b){_0x10449b['push'](_0x10449b['shift']());}};_0x333339(++_0xc645ce);}(_0x3596,0x8c));var _0x6359=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x3596[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x6359('0x0'));var util=require(_0x6359('0x1'));var logger=require('../../config/logger')(_0x6359('0x2'));var moment=require(_0x6359('0x3'));var BPromise=require(_0x6359('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6359('0x5'));var rimraf=require(_0x6359('0x6'));var config=require('../../config/environment');var attributes=require(_0x6359('0x7'));module[_0x6359('0x8')]=function(_0x1c2afc,_0x36b6d0){return _0x1c2afc[_0x6359('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x6359('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e2e=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x307008,_0x5344cf){var _0x41c656=function(_0x4e4c2a){while(--_0x4e4c2a){_0x307008['push'](_0x307008['shift']());}};_0x41c656(++_0x5344cf);}(_0x8e2e,0x172));var _0xe8e2=function(_0x105c50,_0x29ba3e){_0x105c50=_0x105c50-0x0;var _0x570327=_0x8e2e[_0x105c50];return _0x570327;};'use strict';var _=require(_0xe8e2('0x0'));var util=require(_0xe8e2('0x1'));var logger=require(_0xe8e2('0x2'))(_0xe8e2('0x3'));var moment=require('moment');var BPromise=require(_0xe8e2('0x4'));var rp=require(_0xe8e2('0x5'));var fs=require('fs');var path=require(_0xe8e2('0x6'));var rimraf=require(_0xe8e2('0x7'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xe8e2('0x8')]=function(_0x2b5a2d,_0x18480f){return _0x2b5a2d[_0xe8e2('0x9')](_0xe8e2('0xa'),attributes,{'tableName':_0xe8e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index d6a0d84..4970ba0 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 _0x1df1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','util','ioredis'];(function(_0x1ae976,_0x1ec9b8){var _0x43c3be=function(_0x5365d5){while(--_0x5365d5){_0x1ae976['push'](_0x1ae976['shift']());}};_0x43c3be(++_0x1ec9b8);}(_0x1df1,0x1f2));var _0x11df=function(_0x1e18c0,_0x44146e){_0x1e18c0=_0x1e18c0-0x0;var _0xdb46a2=_0x1df1[_0x1e18c0];return _0xdb46a2;};'use strict';var _=require('lodash');var util=require(_0x11df('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11df('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x11df('0x2'));var config=require(_0x11df('0x3'));var jayson=require(_0x11df('0x4'));var client=jayson[_0x11df('0x5')][_0x11df('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1b0785,_0x2d08b0,_0x4d7c83){return new BPromise(function(_0x4ea6c9,_0x1582c5){return client[_0x11df('0x7')](_0x1b0785,_0x4d7c83)[_0x11df('0x8')](function(_0x2bee7e){logger[_0x11df('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d08b0,_0x11df('0xa'));logger[_0x11df('0xb')](_0x11df('0xc'),_0x2d08b0,_0x11df('0xa'),JSON[_0x11df('0xd')](_0x2bee7e));if(_0x2bee7e[_0x11df('0xe')]){if(_0x2bee7e[_0x11df('0xe')][_0x11df('0xf')]===0x1f4){logger[_0x11df('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2d08b0,_0x2bee7e[_0x11df('0xe')][_0x11df('0x10')]);return _0x1582c5(_0x2bee7e[_0x11df('0xe')][_0x11df('0x10')]);}logger[_0x11df('0xe')](_0x11df('0x11'),_0x2d08b0,_0x2bee7e[_0x11df('0xe')][_0x11df('0x10')]);return _0x4ea6c9(_0x2bee7e[_0x11df('0xe')][_0x11df('0x10')]);}else{logger[_0x11df('0x9')](_0x11df('0x11'),_0x2d08b0,_0x11df('0xa'));_0x4ea6c9(_0x2bee7e[_0x11df('0x12')][_0x11df('0x10')]);}})[_0x11df('0x13')](function(_0x2289fc){logger[_0x11df('0xe')](_0x11df('0x11'),_0x2d08b0,_0x2289fc);_0x1582c5(_0x2289fc);});});} \ No newline at end of file +var _0x2318=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x52ce8b,_0x51a3c1){var _0x5a7e57=function(_0x54f3d2){while(--_0x54f3d2){_0x52ce8b['push'](_0x52ce8b['shift']());}};_0x5a7e57(++_0x51a3c1);}(_0x2318,0x103));var _0x8231=function(_0x27d7ca,_0x111288){_0x27d7ca=_0x27d7ca-0x0;var _0x10f817=_0x2318[_0x27d7ca];return _0x10f817;};'use strict';var _=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var moment=require(_0x8231('0x2'));var BPromise=require(_0x8231('0x3'));var rs=require(_0x8231('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8231('0x5'))['db'];var utils=require(_0x8231('0x6'));var logger=require(_0x8231('0x7'))('rpc');var config=require(_0x8231('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8231('0x9')][_0x8231('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba3a9c,_0x29fe0b,_0x3fec98){return new BPromise(function(_0x2f6512,_0x454324){return client[_0x8231('0xb')](_0xba3a9c,_0x3fec98)[_0x8231('0xc')](function(_0x28a7fa){logger[_0x8231('0xd')](_0x8231('0xe'),_0x29fe0b,_0x8231('0xf'));logger[_0x8231('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x29fe0b,_0x8231('0xf'),JSON[_0x8231('0x11')](_0x28a7fa));if(_0x28a7fa[_0x8231('0x12')]){if(_0x28a7fa['error'][_0x8231('0x13')]===0x1f4){logger['error'](_0x8231('0xe'),_0x29fe0b,_0x28a7fa[_0x8231('0x12')]['message']);return _0x454324(_0x28a7fa[_0x8231('0x12')][_0x8231('0x14')]);}logger['error'](_0x8231('0xe'),_0x29fe0b,_0x28a7fa['error']['message']);return _0x2f6512(_0x28a7fa[_0x8231('0x12')][_0x8231('0x14')]);}else{logger[_0x8231('0xd')](_0x8231('0xe'),_0x29fe0b,_0x8231('0xf'));_0x2f6512(_0x28a7fa['result'][_0x8231('0x14')]);}})['catch'](function(_0x11a519){logger[_0x8231('0x12')](_0x8231('0xe'),_0x29fe0b,_0x11a519);_0x454324(_0x11a519);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 59fd31c..dc2eac2 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 _0x7f0d=['preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show'];(function(_0x49335f,_0x46042c){var _0x144233=function(_0x52534b){while(--_0x52534b){_0x49335f['push'](_0x49335f['shift']());}};_0x144233(++_0x46042c);}(_0x7f0d,0x113));var _0xd7f0=function(_0x4a20ae,_0x402a4e){_0x4a20ae=_0x4a20ae-0x0;var _0x2cc779=_0x7f0d[_0x4a20ae];return _0x2cc779;};'use strict';var multer=require(_0xd7f0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd7f0('0x1'));var express=require(_0xd7f0('0x2'));var router=express[_0xd7f0('0x3')]();var fs_extra=require(_0xd7f0('0x4'));var auth=require(_0xd7f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd7f0('0x6'));var controller=require(_0xd7f0('0x7'));router[_0xd7f0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd7f0('0x9')]);router[_0xd7f0('0x8')](_0xd7f0('0xa'),auth[_0xd7f0('0xb')](),controller[_0xd7f0('0xc')]);router[_0xd7f0('0x8')]('/:id/preview',auth[_0xd7f0('0xb')](),controller[_0xd7f0('0xd')]);router[_0xd7f0('0x8')](_0xd7f0('0xe'),auth[_0xd7f0('0xb')](),controller[_0xd7f0('0xf')]);router['get'](_0xd7f0('0x10'),auth[_0xd7f0('0xb')](),controller[_0xd7f0('0x11')]);router[_0xd7f0('0x12')]('/',auth[_0xd7f0('0xb')](),controller[_0xd7f0('0x13')]);router[_0xd7f0('0x14')](_0xd7f0('0xa'),auth[_0xd7f0('0xb')](),controller[_0xd7f0('0x15')]);router[_0xd7f0('0x16')](_0xd7f0('0xa'),auth['isAuthenticated'](),controller[_0xd7f0('0x17')]);module['exports']=router; \ No newline at end of file +var _0x13c6=['isAuthenticated','preview','/:id/run','/:id/query','query','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/preview'];(function(_0x2258c3,_0x38fa00){var _0x84c586=function(_0x130a2b){while(--_0x130a2b){_0x2258c3['push'](_0x2258c3['shift']());}};_0x84c586(++_0x38fa00);}(_0x13c6,0xb2));var _0x613c=function(_0x52338b,_0x295a6c){_0x52338b=_0x52338b-0x0;var _0x546138=_0x13c6[_0x52338b];return _0x546138;};'use strict';var multer=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var path=require(_0x613c('0x2'));var timeout=require(_0x613c('0x3'));var express=require(_0x613c('0x4'));var router=express[_0x613c('0x5')]();var fs_extra=require(_0x613c('0x6'));var auth=require(_0x613c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x613c('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x613c('0x9')]('/',auth['isAuthenticated'](),controller[_0x613c('0xa')]);router[_0x613c('0x9')](_0x613c('0xb'),auth['isAuthenticated'](),controller[_0x613c('0xc')]);router[_0x613c('0x9')](_0x613c('0xd'),auth[_0x613c('0xe')](),controller[_0x613c('0xf')]);router[_0x613c('0x9')](_0x613c('0x10'),auth['isAuthenticated'](),controller['run']);router[_0x613c('0x9')](_0x613c('0x11'),auth[_0x613c('0xe')](),controller[_0x613c('0x12')]);router[_0x613c('0x13')]('/',auth['isAuthenticated'](),controller[_0x613c('0x14')]);router['put'](_0x613c('0xb'),auth[_0x613c('0xe')](),controller[_0x613c('0x15')]);router[_0x613c('0x16')](_0x613c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x613c('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 71b8f44..e9632ec 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 _0x3085=['xlsx','DATE','Loading','manual','scheduled','INTEGER','exports','STRING','ENUM','csv','pdf'];(function(_0x2df2d0,_0x1d6ea8){var _0x3c4438=function(_0x456da2){while(--_0x456da2){_0x2df2d0['push'](_0x2df2d0['shift']());}};_0x3c4438(++_0x1d6ea8);}(_0x3085,0x150));var _0x5308=function(_0x377666,_0x21ead1){_0x377666=_0x377666-0x0;var _0x3889c6=_0x3085[_0x377666];return _0x3889c6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5308('0x0')]={'name':{'type':Sequelize[_0x5308('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x5308('0x2')](_0x5308('0x3'),_0x5308('0x4'),_0x5308('0x5')),'allowNull':![],'defaultValue':_0x5308('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x5308('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x5308('0x1')],'defaultValue':_0x5308('0x7')},'type':{'type':Sequelize[_0x5308('0x2')](_0x5308('0x8'),_0x5308('0x9')),'allowNull':![],'defaultValue':_0x5308('0x8')},'reportId':{'type':Sequelize[_0x5308('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6edd=['DATE','ENUM','manual','UNSIGNED','exports','STRING','csv'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x6edd,0x177));var _0xd6ed=function(_0x97abee,_0x2f7f31){_0x97abee=_0x97abee-0x0;var _0x4c734e=_0x6edd[_0x97abee];return _0x4c734e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xd6ed('0x0')]={'name':{'type':Sequelize[_0xd6ed('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd6ed('0x2'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xd6ed('0x2')},'savename':{'type':Sequelize[_0xd6ed('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd6ed('0x3')]},'endDate':{'type':Sequelize[_0xd6ed('0x3')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xd6ed('0x4')](_0xd6ed('0x5'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xd6ed('0x6')]},'reportType':{'type':Sequelize[_0xd6ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 95979f5..baa49e7 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 _0xdaf5=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','model','query','keys','attributes','intersection','fields','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','length','find','create','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','existsSync','join','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','server/files/reports','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','squel','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'];(function(_0x59347a,_0x1dd138){var _0x487c22=function(_0x3a6fc7){while(--_0x3a6fc7){_0x59347a['push'](_0x59347a['shift']());}};_0x487c22(++_0x1dd138);}(_0xdaf5,0x1f0));var _0x5daf=function(_0x3fd66d,_0x410d26){_0x3fd66d=_0x3fd66d-0x0;var _0x5a6464=_0xdaf5[_0x3fd66d];return _0x5a6464;};'use strict';var emlformat=require(_0x5daf('0x0'));var rimraf=require(_0x5daf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5daf('0x2'));var rp=require('request-promise');var moment=require(_0x5daf('0x3'));var BPromise=require(_0x5daf('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5daf('0x5'));var sox=require(_0x5daf('0x6'));var csv=require(_0x5daf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5daf('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5daf('0x9'));var toCsv=require(_0x5daf('0x7'));var querystring=require(_0x5daf('0xa'));var Papa=require(_0x5daf('0xb'));var Redis=require('ioredis');var authService=require(_0x5daf('0xc'));var qs=require(_0x5daf('0xd'));var as=require(_0x5daf('0xe'));var hardwareService=require(_0x5daf('0xf'));var logger=require(_0x5daf('0x10'))('api');var utils=require(_0x5daf('0x11'));var config=require(_0x5daf('0x12'));var licenseUtil=require(_0x5daf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cfda8,_0x33ba94){_0x33ba94=_0x33ba94||0xcc;return function(_0x99230d){if(_0x99230d){return _0x5cfda8[_0x5daf('0x14')](_0x33ba94);}return _0x5cfda8[_0x5daf('0x15')](_0x33ba94)[_0x5daf('0x16')]();};}function respondWithResult(_0x4fad4c,_0x37b59c){_0x37b59c=_0x37b59c||0xc8;return function(_0x6c8c7){if(_0x6c8c7){return _0x4fad4c[_0x5daf('0x15')](_0x37b59c)[_0x5daf('0x17')](_0x6c8c7);}};}function respondWithFilteredResult(_0x188385,_0x5ab418){return function(_0x4974a7){if(_0x4974a7){var _0x3e8684=typeof _0x5ab418[_0x5daf('0x18')]===_0x5daf('0x19')&&typeof _0x5ab418['limit']===_0x5daf('0x19');var _0x40f2f3=_0x4974a7[_0x5daf('0x1a')];var _0x4c9237=_0x3e8684?0x0:_0x5ab418['offset'];var _0x290fbe=_0x3e8684?_0x4974a7[_0x5daf('0x1a')]:_0x5ab418[_0x5daf('0x18')]+_0x5ab418[_0x5daf('0x1b')];var _0x5138bd;if(_0x290fbe>=_0x40f2f3){_0x290fbe=_0x40f2f3;_0x5138bd=0xc8;}else{_0x5138bd=0xce;}_0x188385[_0x5daf('0x15')](_0x5138bd);return _0x188385[_0x5daf('0x1c')](_0x5daf('0x1d'),_0x4c9237+'-'+_0x290fbe+'/'+_0x40f2f3)['json'](_0x4974a7);}return null;};}function patchUpdates(_0x2904d8){return function(_0x48af85){try{jsonpatch[_0x5daf('0x1e')](_0x48af85,_0x2904d8,!![]);}catch(_0x290673){return BPromise['reject'](_0x290673);}return _0x48af85[_0x5daf('0x1f')]();};}function saveUpdates(_0x223da0,_0x5e34f2){return function(_0x346585){if(_0x346585){return _0x346585['update'](_0x223da0)[_0x5daf('0x20')](function(_0x47efd0){return _0x47efd0;});}return null;};}function removeEntity(_0x4c5d0f,_0x186898){return function(_0x1483a6){if(_0x1483a6){return _0x1483a6[_0x5daf('0x21')]()[_0x5daf('0x20')](function(){var _0x29a43b=_0x1483a6[_0x5daf('0x22')]({'plain':!![]});var _0x27f06e='ExtractedReports';return db['UserProfileResource'][_0x5daf('0x21')]({'where':{'type':_0x27f06e,'resourceId':_0x29a43b['id']}})[_0x5daf('0x20')](function(){return _0x1483a6;});})[_0x5daf('0x20')](function(){_0x4c5d0f[_0x5daf('0x15')](0xcc)[_0x5daf('0x16')]();});}};}function handleEntityNotFound(_0x42d37b,_0x1a18af){return function(_0x52ce6d){if(!_0x52ce6d){_0x42d37b[_0x5daf('0x14')](0x194);}return _0x52ce6d;};}function handleError(_0x5550a3,_0x2ba8ee){_0x2ba8ee=_0x2ba8ee||0x1f4;return function(_0x32ccea){logger[_0x5daf('0x23')](_0x32ccea[_0x5daf('0x24')]);if(_0x32ccea[_0x5daf('0x25')]){delete _0x32ccea['name'];}_0x5550a3[_0x5daf('0x15')](_0x2ba8ee)[_0x5daf('0x26')](_0x32ccea);};}exports[_0x5daf('0x27')]=function(_0x52fa52,_0x1b5f69){var _0x4fbe3e={},_0x91d547={},_0x79d5a2={'count':0x0,'rows':[]};var _0xa0fd68=_[_0x5daf('0x28')](db[_0x5daf('0x29')]['rawAttributes'],function(_0x4875f8){return{'name':_0x4875f8[_0x5daf('0x2a')],'type':_0x4875f8[_0x5daf('0x2b')]['key']};});_0x91d547[_0x5daf('0x2c')]=_[_0x5daf('0x28')](_0xa0fd68,'name');_0x91d547[_0x5daf('0x2d')]=_[_0x5daf('0x2e')](_0x52fa52[_0x5daf('0x2d')]);_0x91d547['filters']=_['intersection'](_0x91d547[_0x5daf('0x2c')],_0x91d547[_0x5daf('0x2d')]);_0x4fbe3e[_0x5daf('0x2f')]=_[_0x5daf('0x30')](_0x91d547['model'],qs[_0x5daf('0x31')](_0x52fa52['query'][_0x5daf('0x31')]));_0x4fbe3e['attributes']=_0x4fbe3e[_0x5daf('0x2f')]['length']?_0x4fbe3e[_0x5daf('0x2f')]:_0x91d547[_0x5daf('0x2c')];if(!_0x52fa52[_0x5daf('0x2d')]['hasOwnProperty'](_0x5daf('0x32'))){_0x4fbe3e[_0x5daf('0x1b')]=qs[_0x5daf('0x1b')](_0x52fa52[_0x5daf('0x2d')][_0x5daf('0x1b')]);_0x4fbe3e['offset']=qs[_0x5daf('0x18')](_0x52fa52[_0x5daf('0x2d')][_0x5daf('0x18')]);}_0x4fbe3e['order']=qs['sort'](_0x52fa52[_0x5daf('0x2d')]['sort']);_0x4fbe3e[_0x5daf('0x33')]=qs[_0x5daf('0x34')](_[_0x5daf('0x35')](_0x52fa52[_0x5daf('0x2d')],_0x91d547['filters']),_0xa0fd68);if(_0x52fa52[_0x5daf('0x2d')][_0x5daf('0x36')]){_0x4fbe3e[_0x5daf('0x33')]=_[_0x5daf('0x37')](_0x4fbe3e[_0x5daf('0x33')],{'$or':_['map'](_0xa0fd68,function(_0x392220){if(_0x392220[_0x5daf('0x2b')]!==_0x5daf('0x38')){var _0x136766={};_0x136766[_0x392220[_0x5daf('0x25')]]={'$like':'%'+_0x52fa52[_0x5daf('0x2d')][_0x5daf('0x36')]+'%'};return _0x136766;}})});}_0x4fbe3e=_[_0x5daf('0x37')]({},_0x4fbe3e,_0x52fa52[_0x5daf('0x39')]);var _0x4009af={'where':_0x4fbe3e[_0x5daf('0x33')]};return db['AnalyticExtractedReport']['count'](_0x4009af)[_0x5daf('0x20')](function(_0x4a8c47){_0x79d5a2[_0x5daf('0x1a')]=_0x4a8c47;if(_0x52fa52[_0x5daf('0x2d')][_0x5daf('0x3a')]){_0x4fbe3e['include']=[{'all':!![]}];}return db[_0x5daf('0x29')]['findAll'](_0x4fbe3e);})[_0x5daf('0x20')](function(_0x50ecd9){_0x79d5a2[_0x5daf('0x3b')]=_0x50ecd9;return _0x79d5a2;})[_0x5daf('0x20')](respondWithFilteredResult(_0x1b5f69,_0x4fbe3e))[_0x5daf('0x3c')](handleError(_0x1b5f69,null));};exports['show']=function(_0xa03280,_0x8c3f25){var _0x3514cb={'raw':!![],'where':{'id':_0xa03280[_0x5daf('0x3d')]['id']}},_0x3353a0={};_0x3353a0['model']=_[_0x5daf('0x2e')](db['AnalyticExtractedReport'][_0x5daf('0x3e')]);_0x3353a0[_0x5daf('0x2d')]=_['keys'](_0xa03280[_0x5daf('0x2d')]);_0x3353a0[_0x5daf('0x34')]=_['intersection'](_0x3353a0[_0x5daf('0x2c')],_0x3353a0[_0x5daf('0x2d')]);_0x3514cb[_0x5daf('0x2f')]=_[_0x5daf('0x30')](_0x3353a0[_0x5daf('0x2c')],qs[_0x5daf('0x31')](_0xa03280['query']['fields']));_0x3514cb[_0x5daf('0x2f')]=_0x3514cb[_0x5daf('0x2f')][_0x5daf('0x3f')]?_0x3514cb[_0x5daf('0x2f')]:_0x3353a0[_0x5daf('0x2c')];if(_0xa03280[_0x5daf('0x2d')]['includeAll']){_0x3514cb['include']=[{'all':!![]}];}_0x3514cb=_[_0x5daf('0x37')]({},_0x3514cb,_0xa03280[_0x5daf('0x39')]);return db[_0x5daf('0x29')][_0x5daf('0x40')](_0x3514cb)[_0x5daf('0x20')](handleEntityNotFound(_0x8c3f25,null))['then'](respondWithResult(_0x8c3f25,null))[_0x5daf('0x3c')](handleError(_0x8c3f25,null));};exports['create']=function(_0xbe692e,_0x2fee99){return db['AnalyticExtractedReport'][_0x5daf('0x41')](_0xbe692e['body'],{})[_0x5daf('0x20')](function(_0x1d534f){var _0x1783a6=_0xbe692e[_0x5daf('0x42')][_0x5daf('0x22')]({'plain':!![]});if(!_0x1783a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1783a6['role']===_0x5daf('0x42')){var _0x101bcc=_0x1d534f[_0x5daf('0x22')]({'plain':!![]});var _0x2d6e71=_0x5daf('0x43');return db[_0x5daf('0x44')][_0x5daf('0x40')]({'where':{'name':_0x2d6e71,'userProfileId':_0x1783a6[_0x5daf('0x45')]},'raw':!![]})[_0x5daf('0x20')](function(_0x2ebfb0){if(_0x2ebfb0&&_0x2ebfb0[_0x5daf('0x46')]===0x0){return db[_0x5daf('0x47')][_0x5daf('0x41')]({'name':_0x101bcc[_0x5daf('0x25')],'resourceId':_0x101bcc['id'],'type':_0x2ebfb0['name'],'sectionId':_0x2ebfb0['id']},{})['then'](function(){return _0x1d534f;});}else{return _0x1d534f;}})[_0x5daf('0x3c')](function(_0x24ab25){logger['error'](_0x5daf('0x48'),_0x24ab25);throw _0x24ab25;});}return _0x1d534f;})[_0x5daf('0x20')](respondWithResult(_0x2fee99,0xc9))[_0x5daf('0x3c')](handleError(_0x2fee99,null));};exports['update']=function(_0x20a312,_0xb79a82){if(_0x20a312[_0x5daf('0x49')]['id']){delete _0x20a312['body']['id'];}return db['AnalyticExtractedReport'][_0x5daf('0x40')]({'where':{'id':_0x20a312[_0x5daf('0x3d')]['id']}})[_0x5daf('0x20')](handleEntityNotFound(_0xb79a82,null))[_0x5daf('0x20')](saveUpdates(_0x20a312[_0x5daf('0x49')],null))['then'](respondWithResult(_0xb79a82,null))['catch'](handleError(_0xb79a82,null));};exports[_0x5daf('0x21')]=function(_0x739575,_0x56a892){return db['AnalyticExtractedReport'][_0x5daf('0x40')]({'where':{'id':_0x739575[_0x5daf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x56a892,null))['then'](removeEntity(_0x56a892,null))[_0x5daf('0x3c')](handleError(_0x56a892,null));};exports['download']=function(_0x149bc7,_0x14bbe6,_0x4b3b7e){return db[_0x5daf('0x29')]['find']({'where':{'id':_0x149bc7[_0x5daf('0x3d')]['id']},'attributes':[_0x5daf('0x25'),_0x5daf('0x4a'),_0x5daf('0x4b'),_0x5daf('0x4c')],'raw':!![]})[_0x5daf('0x20')](handleEntityNotFound(_0x14bbe6,null))[_0x5daf('0x20')](function(_0x4a389b){if(_0x4a389b){if(!fs[_0x5daf('0x4d')](path[_0x5daf('0x4e')](config['root'],'server/files/reports',_0x4a389b[_0x5daf('0x4b')]))){throw new db['Sequelize'][(_0x5daf('0x4f'))](_0x5daf('0x50'));}if(_0x149bc7[_0x5daf('0x2d')][_0x5daf('0x51')]){return _0x14bbe6['sendStatus'](0xc8);}return _0x14bbe6[_0x5daf('0x52')](path[_0x5daf('0x4e')](config['root'],_0x5daf('0x53'),_0x4a389b[_0x5daf('0x4b')]),util['format'](_0x5daf('0x54'),_0x4a389b[_0x5daf('0x4a')]||_0x4a389b[_0x5daf('0x25')],_0x4a389b[_0x5daf('0x4c')][_0x5daf('0x55')]()));}})['catch'](handleError(_0x14bbe6,null));}; \ No newline at end of file +var _0x6517=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','root','server/files/reports','savename','Sequelize','exists','download','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports'];(function(_0x59b229,_0x17f45b){var _0x4cf6a5=function(_0x391efa){while(--_0x391efa){_0x59b229['push'](_0x59b229['shift']());}};_0x4cf6a5(++_0x17f45b);}(_0x6517,0xca));var _0x7651=function(_0x4b49e7,_0x141f78){_0x4b49e7=_0x4b49e7-0x0;var _0x156258=_0x6517[_0x4b49e7];return _0x156258;};'use strict';var emlformat=require(_0x7651('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7651('0x1'));var jsonpatch=require(_0x7651('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7651('0x3'));var Mustache=require('mustache');var util=require(_0x7651('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7651('0x5'));var ejs=require(_0x7651('0x6'));var fs=require('fs');var fs_extra=require(_0x7651('0x7'));var _=require(_0x7651('0x8'));var squel=require(_0x7651('0x9'));var crypto=require(_0x7651('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7651('0xb'));var toCsv=require(_0x7651('0x5'));var querystring=require(_0x7651('0xc'));var Papa=require(_0x7651('0xd'));var Redis=require(_0x7651('0xe'));var authService=require(_0x7651('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7651('0x10'));var hardwareService=require(_0x7651('0x11'));var logger=require('../../config/logger')(_0x7651('0x12'));var utils=require('../../config/utils');var config=require(_0x7651('0x13'));var licenseUtil=require(_0x7651('0x14'));var db=require(_0x7651('0x15'))['db'];function respondWithStatusCode(_0x5985de,_0x4a50bb){_0x4a50bb=_0x4a50bb||0xcc;return function(_0x2d7036){if(_0x2d7036){return _0x5985de[_0x7651('0x16')](_0x4a50bb);}return _0x5985de[_0x7651('0x17')](_0x4a50bb)[_0x7651('0x18')]();};}function respondWithResult(_0x1518d1,_0xa2913f){_0xa2913f=_0xa2913f||0xc8;return function(_0x1f1472){if(_0x1f1472){return _0x1518d1[_0x7651('0x17')](_0xa2913f)[_0x7651('0x19')](_0x1f1472);}};}function respondWithFilteredResult(_0x30f8bc,_0x33b0b7){return function(_0x467d5c){if(_0x467d5c){var _0x330d68=typeof _0x33b0b7[_0x7651('0x1a')]===_0x7651('0x1b')&&typeof _0x33b0b7[_0x7651('0x1c')]===_0x7651('0x1b');var _0x5a22b4=_0x467d5c[_0x7651('0x1d')];var _0x4c933f=_0x330d68?0x0:_0x33b0b7['offset'];var _0x44965d=_0x330d68?_0x467d5c[_0x7651('0x1d')]:_0x33b0b7['offset']+_0x33b0b7[_0x7651('0x1c')];var _0x58a3cb;if(_0x44965d>=_0x5a22b4){_0x44965d=_0x5a22b4;_0x58a3cb=0xc8;}else{_0x58a3cb=0xce;}_0x30f8bc[_0x7651('0x17')](_0x58a3cb);return _0x30f8bc['set'](_0x7651('0x1e'),_0x4c933f+'-'+_0x44965d+'/'+_0x5a22b4)[_0x7651('0x19')](_0x467d5c);}return null;};}function patchUpdates(_0x23b692){return function(_0x4835df){try{jsonpatch[_0x7651('0x1f')](_0x4835df,_0x23b692,!![]);}catch(_0x56afee){return BPromise[_0x7651('0x20')](_0x56afee);}return _0x4835df[_0x7651('0x21')]();};}function saveUpdates(_0x2eb5da,_0x59785e){return function(_0x12a667){if(_0x12a667){return _0x12a667[_0x7651('0x22')](_0x2eb5da)[_0x7651('0x23')](function(_0x584056){return _0x584056;});}return null;};}function removeEntity(_0x7a4c4b,_0x220482){return function(_0x5caef8){if(_0x5caef8){return _0x5caef8[_0x7651('0x24')]()[_0x7651('0x23')](function(){var _0x3d2d9a=_0x5caef8[_0x7651('0x25')]({'plain':!![]});var _0x14e071='ExtractedReports';return db[_0x7651('0x26')]['destroy']({'where':{'type':_0x14e071,'resourceId':_0x3d2d9a['id']}})['then'](function(){return _0x5caef8;});})[_0x7651('0x23')](function(){_0x7a4c4b['status'](0xcc)[_0x7651('0x18')]();});}};}function handleEntityNotFound(_0x5549de,_0x748c1c){return function(_0x44b0c1){if(!_0x44b0c1){_0x5549de['sendStatus'](0x194);}return _0x44b0c1;};}function handleError(_0x1a9c20,_0x22f9aa){_0x22f9aa=_0x22f9aa||0x1f4;return function(_0x451595){logger[_0x7651('0x27')](_0x451595[_0x7651('0x28')]);if(_0x451595[_0x7651('0x29')]){delete _0x451595[_0x7651('0x29')];}_0x1a9c20[_0x7651('0x17')](_0x22f9aa)[_0x7651('0x2a')](_0x451595);};}exports[_0x7651('0x2b')]=function(_0x36d189,_0x4b6d6b){var _0x413cc5={},_0x1b61b3={},_0x28ed85={'count':0x0,'rows':[]};var _0x5715a3=_[_0x7651('0x2c')](db[_0x7651('0x2d')][_0x7651('0x2e')],function(_0x272307){return{'name':_0x272307[_0x7651('0x2f')],'type':_0x272307['type']['key']};});_0x1b61b3[_0x7651('0x30')]=_[_0x7651('0x2c')](_0x5715a3,_0x7651('0x29'));_0x1b61b3[_0x7651('0x31')]=_['keys'](_0x36d189[_0x7651('0x31')]);_0x1b61b3[_0x7651('0x32')]=_[_0x7651('0x33')](_0x1b61b3[_0x7651('0x30')],_0x1b61b3[_0x7651('0x31')]);_0x413cc5[_0x7651('0x34')]=_['intersection'](_0x1b61b3[_0x7651('0x30')],qs[_0x7651('0x35')](_0x36d189['query'][_0x7651('0x35')]));_0x413cc5['attributes']=_0x413cc5[_0x7651('0x34')][_0x7651('0x36')]?_0x413cc5[_0x7651('0x34')]:_0x1b61b3[_0x7651('0x30')];if(!_0x36d189[_0x7651('0x31')][_0x7651('0x37')](_0x7651('0x38'))){_0x413cc5[_0x7651('0x1c')]=qs[_0x7651('0x1c')](_0x36d189[_0x7651('0x31')][_0x7651('0x1c')]);_0x413cc5[_0x7651('0x1a')]=qs[_0x7651('0x1a')](_0x36d189[_0x7651('0x31')][_0x7651('0x1a')]);}_0x413cc5['order']=qs[_0x7651('0x39')](_0x36d189['query'][_0x7651('0x39')]);_0x413cc5[_0x7651('0x3a')]=qs['filters'](_['pick'](_0x36d189[_0x7651('0x31')],_0x1b61b3[_0x7651('0x32')]),_0x5715a3);if(_0x36d189[_0x7651('0x31')][_0x7651('0x3b')]){_0x413cc5[_0x7651('0x3a')]=_['merge'](_0x413cc5[_0x7651('0x3a')],{'$or':_['map'](_0x5715a3,function(_0x21de96){if(_0x21de96[_0x7651('0x3c')]!==_0x7651('0x3d')){var _0xf3f1c5={};_0xf3f1c5[_0x21de96[_0x7651('0x29')]]={'$like':'%'+_0x36d189[_0x7651('0x31')][_0x7651('0x3b')]+'%'};return _0xf3f1c5;}})});}_0x413cc5=_['merge']({},_0x413cc5,_0x36d189[_0x7651('0x3e')]);var _0xcb08c2={'where':_0x413cc5[_0x7651('0x3a')]};return db[_0x7651('0x2d')][_0x7651('0x1d')](_0xcb08c2)[_0x7651('0x23')](function(_0x6c21fd){_0x28ed85['count']=_0x6c21fd;if(_0x36d189['query'][_0x7651('0x3f')]){_0x413cc5[_0x7651('0x40')]=[{'all':!![]}];}return db[_0x7651('0x2d')][_0x7651('0x41')](_0x413cc5);})[_0x7651('0x23')](function(_0x52138e){_0x28ed85[_0x7651('0x42')]=_0x52138e;return _0x28ed85;})['then'](respondWithFilteredResult(_0x4b6d6b,_0x413cc5))[_0x7651('0x43')](handleError(_0x4b6d6b,null));};exports['show']=function(_0x1e4432,_0x1ca909){var _0x3c1c81={'raw':!![],'where':{'id':_0x1e4432[_0x7651('0x44')]['id']}},_0x3f19b9={};_0x3f19b9[_0x7651('0x30')]=_[_0x7651('0x45')](db[_0x7651('0x2d')]['rawAttributes']);_0x3f19b9['query']=_[_0x7651('0x45')](_0x1e4432[_0x7651('0x31')]);_0x3f19b9[_0x7651('0x32')]=_[_0x7651('0x33')](_0x3f19b9[_0x7651('0x30')],_0x3f19b9[_0x7651('0x31')]);_0x3c1c81[_0x7651('0x34')]=_[_0x7651('0x33')](_0x3f19b9['model'],qs[_0x7651('0x35')](_0x1e4432['query'][_0x7651('0x35')]));_0x3c1c81['attributes']=_0x3c1c81[_0x7651('0x34')][_0x7651('0x36')]?_0x3c1c81[_0x7651('0x34')]:_0x3f19b9['model'];if(_0x1e4432['query'][_0x7651('0x3f')]){_0x3c1c81['include']=[{'all':!![]}];}_0x3c1c81=_['merge']({},_0x3c1c81,_0x1e4432[_0x7651('0x3e')]);return db['AnalyticExtractedReport'][_0x7651('0x46')](_0x3c1c81)[_0x7651('0x23')](handleEntityNotFound(_0x1ca909,null))[_0x7651('0x23')](respondWithResult(_0x1ca909,null))[_0x7651('0x43')](handleError(_0x1ca909,null));};exports['create']=function(_0x336d42,_0x4fdc9f){return db['AnalyticExtractedReport'][_0x7651('0x47')](_0x336d42[_0x7651('0x48')],{})['then'](function(_0x41160b){var _0x41cad6=_0x336d42[_0x7651('0x49')][_0x7651('0x25')]({'plain':!![]});if(!_0x41cad6)throw new Error(_0x7651('0x4a'));if(_0x41cad6[_0x7651('0x4b')]===_0x7651('0x49')){var _0x26ef0f=_0x41160b[_0x7651('0x25')]({'plain':!![]});var _0x3c3072=_0x7651('0x4c');return db[_0x7651('0x4d')]['find']({'where':{'name':_0x3c3072,'userProfileId':_0x41cad6[_0x7651('0x4e')]},'raw':!![]})[_0x7651('0x23')](function(_0x165ea4){if(_0x165ea4&&_0x165ea4[_0x7651('0x4f')]===0x0){return db['UserProfileResource'][_0x7651('0x47')]({'name':_0x26ef0f['name'],'resourceId':_0x26ef0f['id'],'type':_0x165ea4[_0x7651('0x29')],'sectionId':_0x165ea4['id']},{})[_0x7651('0x23')](function(){return _0x41160b;});}else{return _0x41160b;}})['catch'](function(_0x543b5d){logger[_0x7651('0x27')](_0x7651('0x50'),_0x543b5d);throw _0x543b5d;});}return _0x41160b;})[_0x7651('0x23')](respondWithResult(_0x4fdc9f,0xc9))[_0x7651('0x43')](handleError(_0x4fdc9f,null));};exports[_0x7651('0x22')]=function(_0x4b9feb,_0x523bb3){if(_0x4b9feb[_0x7651('0x48')]['id']){delete _0x4b9feb[_0x7651('0x48')]['id'];}return db['AnalyticExtractedReport'][_0x7651('0x46')]({'where':{'id':_0x4b9feb[_0x7651('0x44')]['id']}})[_0x7651('0x23')](handleEntityNotFound(_0x523bb3,null))[_0x7651('0x23')](saveUpdates(_0x4b9feb[_0x7651('0x48')],null))[_0x7651('0x23')](respondWithResult(_0x523bb3,null))[_0x7651('0x43')](handleError(_0x523bb3,null));};exports[_0x7651('0x24')]=function(_0x3d87b8,_0x12289a){return db[_0x7651('0x2d')][_0x7651('0x46')]({'where':{'id':_0x3d87b8[_0x7651('0x44')]['id']}})['then'](handleEntityNotFound(_0x12289a,null))[_0x7651('0x23')](removeEntity(_0x12289a,null))[_0x7651('0x43')](handleError(_0x12289a,null));};exports['download']=function(_0x2234aa,_0x340ef9,_0x396deb){return db[_0x7651('0x2d')][_0x7651('0x46')]({'where':{'id':_0x2234aa[_0x7651('0x44')]['id']},'attributes':[_0x7651('0x29'),_0x7651('0x51'),'savename',_0x7651('0x52')],'raw':!![]})[_0x7651('0x23')](handleEntityNotFound(_0x340ef9,null))['then'](function(_0x31c976){if(_0x31c976){if(!fs[_0x7651('0x53')](path['join'](config[_0x7651('0x54')],_0x7651('0x55'),_0x31c976[_0x7651('0x56')]))){throw new db[(_0x7651('0x57'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x2234aa['query'][_0x7651('0x58')]){return _0x340ef9[_0x7651('0x16')](0xc8);}return _0x340ef9[_0x7651('0x59')](path['join'](config[_0x7651('0x54')],'server/files/reports',_0x31c976['savename']),util[_0x7651('0x5a')](_0x7651('0x5b'),_0x31c976[_0x7651('0x51')]||_0x31c976[_0x7651('0x29')],_0x31c976['output'][_0x7651('0x5c')]()));}})[_0x7651('0x43')](handleError(_0x340ef9,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b95f470..dae15a0 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 _0x5c6c=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x5c6c,0xf0));var _0xc5c6=function(_0x2e5ba9,_0x54115f){_0x2e5ba9=_0x2e5ba9-0x0;var _0x4c5488=_0x5c6c[_0x2e5ba9];return _0x4c5488;};'use strict';var _=require(_0xc5c6('0x0'));var util=require(_0xc5c6('0x1'));var logger=require(_0xc5c6('0x2'))(_0xc5c6('0x3'));var moment=require('moment');var BPromise=require(_0xc5c6('0x4'));var rp=require(_0xc5c6('0x5'));var fs=require('fs');var path=require(_0xc5c6('0x6'));var rimraf=require(_0xc5c6('0x7'));var config=require(_0xc5c6('0x8'));var attributes=require(_0xc5c6('0x9'));module[_0xc5c6('0xa')]=function(_0x483828,_0x2927b6){return _0x483828['define'](_0xc5c6('0xb'),attributes,{'tableName':_0xc5c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd975=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x16f89f,_0x3a8f2e){var _0x4968a8=function(_0x363eff){while(--_0x363eff){_0x16f89f['push'](_0x16f89f['shift']());}};_0x4968a8(++_0x3a8f2e);}(_0xd975,0xfe));var _0x5d97=function(_0x4ebe3d,_0x439c56){_0x4ebe3d=_0x4ebe3d-0x0;var _0x4adf00=_0xd975[_0x4ebe3d];return _0x4adf00;};'use strict';var _=require(_0x5d97('0x0'));var util=require(_0x5d97('0x1'));var logger=require(_0x5d97('0x2'))(_0x5d97('0x3'));var moment=require(_0x5d97('0x4'));var BPromise=require(_0x5d97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d97('0x6'));var rimraf=require(_0x5d97('0x7'));var config=require(_0x5d97('0x8'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x3f5e05,_0x12f073){return _0x3f5e05[_0x5d97('0x9')](_0x5d97('0xa'),attributes,{'tableName':_0x5d97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index b78c7f0..a072997 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 _0x8135=['util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8135,0x17b));var _0x5813=function(_0x59144a,_0x1d9de2){_0x59144a=_0x59144a-0x0;var _0x10f69f=_0x8135[_0x59144a];return _0x10f69f;};'use strict';var _=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var moment=require(_0x5813('0x2'));var BPromise=require(_0x5813('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5813('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5813('0x5'));var config=require(_0x5813('0x6'));var jayson=require(_0x5813('0x7'));var client=jayson[_0x5813('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17e6cb,_0x4b77b3,_0x4ec8dd){return new BPromise(function(_0x34f21d,_0x20ff48){return client[_0x5813('0x9')](_0x17e6cb,_0x4ec8dd)[_0x5813('0xa')](function(_0x2d8f1f){logger[_0x5813('0xb')](_0x5813('0xc'),_0x4b77b3,_0x5813('0xd'));logger[_0x5813('0xe')](_0x5813('0xf'),_0x4b77b3,'request\x20sent',JSON['stringify'](_0x2d8f1f));if(_0x2d8f1f['error']){if(_0x2d8f1f['error'][_0x5813('0x10')]===0x1f4){logger[_0x5813('0x11')](_0x5813('0xc'),_0x4b77b3,_0x2d8f1f['error'][_0x5813('0x12')]);return _0x20ff48(_0x2d8f1f[_0x5813('0x11')][_0x5813('0x12')]);}logger['error'](_0x5813('0xc'),_0x4b77b3,_0x2d8f1f[_0x5813('0x11')][_0x5813('0x12')]);return _0x34f21d(_0x2d8f1f[_0x5813('0x11')][_0x5813('0x12')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4b77b3,_0x5813('0xd'));_0x34f21d(_0x2d8f1f['result'][_0x5813('0x12')]);}})[_0x5813('0x13')](function(_0x496012){logger['error'](_0x5813('0xc'),_0x4b77b3,_0x496012);_0x20ff48(_0x496012);});});} \ No newline at end of file +var _0xf4cf=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf4cf,0x1e0));var _0xff4c=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xf4cf[_0xa8883];return _0x479426;};'use strict';var _=require(_0xff4c('0x0'));var util=require(_0xff4c('0x1'));var moment=require(_0xff4c('0x2'));var BPromise=require(_0xff4c('0x3'));var rs=require(_0xff4c('0x4'));var fs=require('fs');var Redis=require(_0xff4c('0x5'));var db=require(_0xff4c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xff4c('0x7'));var config=require('../../config/environment');var jayson=require(_0xff4c('0x8'));var client=jayson[_0xff4c('0x9')][_0xff4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9679a1,_0x351121,_0x566b18){return new BPromise(function(_0x294309,_0x1cc9c9){return client[_0xff4c('0xb')](_0x9679a1,_0x566b18)[_0xff4c('0xc')](function(_0xf17d3d){logger[_0xff4c('0xd')](_0xff4c('0xe'),_0x351121,_0xff4c('0xf'));logger[_0xff4c('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x351121,_0xff4c('0xf'),JSON[_0xff4c('0x11')](_0xf17d3d));if(_0xf17d3d[_0xff4c('0x12')]){if(_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x13')]===0x1f4){logger[_0xff4c('0x12')](_0xff4c('0xe'),_0x351121,_0xf17d3d['error']['message']);return _0x1cc9c9(_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x14')]);}logger[_0xff4c('0x12')](_0xff4c('0xe'),_0x351121,_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x14')]);return _0x294309(_0xf17d3d[_0xff4c('0x12')][_0xff4c('0x14')]);}else{logger[_0xff4c('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x351121,_0xff4c('0xf'));_0x294309(_0xf17d3d[_0xff4c('0x15')][_0xff4c('0x14')]);}})[_0xff4c('0x16')](function(_0x188f33){logger[_0xff4c('0x12')](_0xff4c('0xe'),_0x351121,_0x188f33);_0x1cc9c9(_0x188f33);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ec2798b..e90e4c7 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 _0x9e38=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0x9e38,0xb9));var _0x89e3=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x9e38[_0x1034bb];return _0x453fdb;};'use strict';var multer=require(_0x89e3('0x0'));var util=require(_0x89e3('0x1'));var path=require(_0x89e3('0x2'));var timeout=require(_0x89e3('0x3'));var express=require(_0x89e3('0x4'));var router=express[_0x89e3('0x5')]();var fs_extra=require(_0x89e3('0x6'));var auth=require(_0x89e3('0x7'));var interaction=require(_0x89e3('0x8'));var config=require(_0x89e3('0x9'));var controller=require(_0x89e3('0xa'));router[_0x89e3('0xb')]('/',auth['isAuthenticated'](),controller[_0x89e3('0xc')]);router[_0x89e3('0xb')](_0x89e3('0xd'),auth['isAuthenticated'](),controller[_0x89e3('0xe')]);router['get'](_0x89e3('0xf'),auth[_0x89e3('0x10')](),controller[_0x89e3('0x11')]);router[_0x89e3('0x12')]('/',auth[_0x89e3('0x10')](),controller[_0x89e3('0x13')]);router[_0x89e3('0x14')](_0x89e3('0xd'),auth[_0x89e3('0x10')](),controller[_0x89e3('0x15')]);router[_0x89e3('0x16')](_0x89e3('0xd'),auth[_0x89e3('0x10')](),controller[_0x89e3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6210=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','put','update','delete','destroy','multer','Router'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x6210,0x1a0));var _0x0621=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x6210[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x0621('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0621('0x1')]();var fs_extra=require(_0x0621('0x2'));var auth=require(_0x0621('0x3'));var interaction=require(_0x0621('0x4'));var config=require(_0x0621('0x5'));var controller=require(_0x0621('0x6'));router[_0x0621('0x7')]('/',auth[_0x0621('0x8')](),controller[_0x0621('0x9')]);router['get'](_0x0621('0xa'),auth[_0x0621('0x8')](),controller[_0x0621('0xb')]);router[_0x0621('0x7')](_0x0621('0xc'),auth[_0x0621('0x8')](),controller['download']);router[_0x0621('0xd')]('/',auth[_0x0621('0x8')](),controller[_0x0621('0xe')]);router[_0x0621('0xf')](_0x0621('0xa'),auth['isAuthenticated'](),controller[_0x0621('0x10')]);router[_0x0621('0x11')]('/:id',auth[_0x0621('0x8')](),controller[_0x0621('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 36a6a02..204ebf4 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 _0x215a=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x116e3b,_0x13f263){var _0x2d489d=function(_0x581316){while(--_0x581316){_0x116e3b['push'](_0x116e3b['shift']());}};_0x2d489d(++_0x13f263);}(_0x215a,0x1ac));var _0xa215=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x215a[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0xa215('0x0'));module[_0xa215('0x1')]={'field':{'type':Sequelize[_0xa215('0x2')]},'alias':{'type':Sequelize[_0xa215('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xa215('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xa215('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b7f=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x15a9df,_0x3eb9f3){var _0x20af34=function(_0x53e140){while(--_0x53e140){_0x15a9df['push'](_0x15a9df['shift']());}};_0x20af34(++_0x3eb9f3);}(_0x5b7f,0x81));var _0xf5b7=function(_0xd0424e,_0x16522d){_0xd0424e=_0xd0424e-0x0;var _0x3c60db=_0x5b7f[_0xd0424e];return _0x3c60db;};'use strict';var Sequelize=require(_0xf5b7('0x0'));module[_0xf5b7('0x1')]={'field':{'type':Sequelize[_0xf5b7('0x2')]},'alias':{'type':Sequelize[_0xf5b7('0x3')]},'function':{'type':Sequelize[_0xf5b7('0x3')]},'format':{'type':Sequelize[_0xf5b7('0x3')]},'groupBy':{'type':Sequelize[_0xf5b7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf5b7('0x3')]},'custom':{'type':Sequelize[_0xf5b7('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 a82fcba..133e024 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 _0x75b8=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','destroy','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x4a9765,_0x323732){var _0x1c363c=function(_0x4667d8){while(--_0x4667d8){_0x4a9765['push'](_0x4a9765['shift']());}};_0x1c363c(++_0x323732);}(_0x75b8,0x9e));var _0x875b=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x75b8[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x875b('0x0'));var rimraf=require(_0x875b('0x1'));var zipdir=require(_0x875b('0x2'));var jsonpatch=require(_0x875b('0x3'));var rp=require(_0x875b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x875b('0x5'));var util=require(_0x875b('0x6'));var path=require(_0x875b('0x7'));var sox=require(_0x875b('0x8'));var csv=require(_0x875b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x875b('0xa'));var _=require(_0x875b('0xb'));var squel=require(_0x875b('0xc'));var crypto=require(_0x875b('0xd'));var jsforce=require(_0x875b('0xe'));var deskjs=require(_0x875b('0xf'));var toCsv=require(_0x875b('0x9'));var querystring=require(_0x875b('0x10'));var Papa=require('papaparse');var Redis=require(_0x875b('0x11'));var authService=require(_0x875b('0x12'));var qs=require(_0x875b('0x13'));var as=require(_0x875b('0x14'));var hardwareService=require(_0x875b('0x15'));var logger=require(_0x875b('0x16'))(_0x875b('0x17'));var utils=require(_0x875b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x875b('0x19'))['db'];function respondWithStatusCode(_0x496d5b,_0x4f9bcf){_0x4f9bcf=_0x4f9bcf||0xcc;return function(_0x1061c3){if(_0x1061c3){return _0x496d5b[_0x875b('0x1a')](_0x4f9bcf);}return _0x496d5b['status'](_0x4f9bcf)['end']();};}function respondWithResult(_0x115db0,_0x5f4402){_0x5f4402=_0x5f4402||0xc8;return function(_0x1d8847){if(_0x1d8847){return _0x115db0[_0x875b('0x1b')](_0x5f4402)[_0x875b('0x1c')](_0x1d8847);}};}function respondWithFilteredResult(_0x36b33c,_0x243438){return function(_0x30e766){if(_0x30e766){var _0x132950=typeof _0x243438[_0x875b('0x1d')]===_0x875b('0x1e')&&typeof _0x243438[_0x875b('0x1f')]==='undefined';var _0x5a645e=_0x30e766[_0x875b('0x20')];var _0x49d137=_0x132950?0x0:_0x243438['offset'];var _0x2b4ac5=_0x132950?_0x30e766[_0x875b('0x20')]:_0x243438[_0x875b('0x1d')]+_0x243438['limit'];var _0x2d34f3;if(_0x2b4ac5>=_0x5a645e){_0x2b4ac5=_0x5a645e;_0x2d34f3=0xc8;}else{_0x2d34f3=0xce;}_0x36b33c[_0x875b('0x1b')](_0x2d34f3);return _0x36b33c[_0x875b('0x21')](_0x875b('0x22'),_0x49d137+'-'+_0x2b4ac5+'/'+_0x5a645e)[_0x875b('0x1c')](_0x30e766);}return null;};}function patchUpdates(_0x1a6db1){return function(_0x5cb629){try{jsonpatch[_0x875b('0x23')](_0x5cb629,_0x1a6db1,!![]);}catch(_0x39d494){return BPromise['reject'](_0x39d494);}return _0x5cb629['save']();};}function saveUpdates(_0x28013f,_0x283655){return function(_0x26082d){if(_0x26082d){return _0x26082d[_0x875b('0x24')](_0x28013f)[_0x875b('0x25')](function(_0xa23638){return _0xa23638;});}return null;};}function removeEntity(_0xe6258e,_0x371381){return function(_0x2de15e){if(_0x2de15e){return _0x2de15e['destroy']()['then'](function(){_0xe6258e[_0x875b('0x1b')](0xcc)[_0x875b('0x26')]();});}};}function handleEntityNotFound(_0x1cdb7e,_0x1e83ac){return function(_0x2e6531){if(!_0x2e6531){_0x1cdb7e[_0x875b('0x1a')](0x194);}return _0x2e6531;};}function handleError(_0x1d933b,_0x2ab3bf){_0x2ab3bf=_0x2ab3bf||0x1f4;return function(_0x338384){logger['error'](_0x338384[_0x875b('0x27')]);if(_0x338384['name']){delete _0x338384[_0x875b('0x28')];}_0x1d933b[_0x875b('0x1b')](_0x2ab3bf)[_0x875b('0x29')](_0x338384);};}exports[_0x875b('0x2a')]=function(_0x5a9106,_0x276bea){var _0x48c128={},_0x22d332={},_0xd871ba={'count':0x0,'rows':[]};var _0x3815b4=_[_0x875b('0x2b')](db[_0x875b('0x2c')][_0x875b('0x2d')],function(_0x5d46c2){return{'name':_0x5d46c2[_0x875b('0x2e')],'type':_0x5d46c2[_0x875b('0x2f')][_0x875b('0x30')]};});_0x22d332[_0x875b('0x31')]=_[_0x875b('0x2b')](_0x3815b4,_0x875b('0x28'));_0x22d332[_0x875b('0x32')]=_[_0x875b('0x33')](_0x5a9106[_0x875b('0x32')]);_0x22d332[_0x875b('0x34')]=_[_0x875b('0x35')](_0x22d332[_0x875b('0x31')],_0x22d332[_0x875b('0x32')]);_0x48c128[_0x875b('0x36')]=_[_0x875b('0x35')](_0x22d332[_0x875b('0x31')],qs['fields'](_0x5a9106[_0x875b('0x32')][_0x875b('0x37')]));_0x48c128[_0x875b('0x36')]=_0x48c128[_0x875b('0x36')][_0x875b('0x38')]?_0x48c128[_0x875b('0x36')]:_0x22d332['model'];if(!_0x5a9106['query']['hasOwnProperty'](_0x875b('0x39'))){_0x48c128['limit']=qs[_0x875b('0x1f')](_0x5a9106[_0x875b('0x32')][_0x875b('0x1f')]);_0x48c128[_0x875b('0x1d')]=qs[_0x875b('0x1d')](_0x5a9106[_0x875b('0x32')][_0x875b('0x1d')]);}_0x48c128[_0x875b('0x3a')]=qs[_0x875b('0x3b')](_0x5a9106[_0x875b('0x32')][_0x875b('0x3b')]);_0x48c128[_0x875b('0x3c')]=qs[_0x875b('0x34')](_['pick'](_0x5a9106[_0x875b('0x32')],_0x22d332[_0x875b('0x34')]),_0x3815b4);if(_0x5a9106[_0x875b('0x32')][_0x875b('0x3d')]){_0x48c128[_0x875b('0x3c')]=_[_0x875b('0x3e')](_0x48c128[_0x875b('0x3c')],{'$or':_['map'](_0x3815b4,function(_0x3f1b30){if(_0x3f1b30['type']!==_0x875b('0x3f')){var _0x50c385={};_0x50c385[_0x3f1b30[_0x875b('0x28')]]={'$like':'%'+_0x5a9106[_0x875b('0x32')][_0x875b('0x3d')]+'%'};return _0x50c385;}})});}_0x48c128=_[_0x875b('0x3e')]({},_0x48c128,_0x5a9106[_0x875b('0x40')]);var _0x43c7a5={'where':_0x48c128['where']};return db[_0x875b('0x2c')][_0x875b('0x20')](_0x43c7a5)[_0x875b('0x25')](function(_0x4c0a26){_0xd871ba[_0x875b('0x20')]=_0x4c0a26;if(_0x5a9106[_0x875b('0x32')]['includeAll']){_0x48c128[_0x875b('0x41')]=[{'all':!![]}];}return db[_0x875b('0x2c')][_0x875b('0x42')](_0x48c128);})[_0x875b('0x25')](function(_0x16008a){_0xd871ba[_0x875b('0x43')]=_0x16008a;return _0xd871ba;})['then'](respondWithFilteredResult(_0x276bea,_0x48c128))[_0x875b('0x44')](handleError(_0x276bea,null));};exports[_0x875b('0x45')]=function(_0xe23ee5,_0x2ac976){var _0x913fdb={'raw':![],'where':{'id':_0xe23ee5[_0x875b('0x46')]['id']}},_0x4a5a4d={};_0x4a5a4d[_0x875b('0x31')]=_[_0x875b('0x33')](db[_0x875b('0x2c')][_0x875b('0x2d')]);_0x4a5a4d[_0x875b('0x32')]=_[_0x875b('0x33')](_0xe23ee5[_0x875b('0x32')]);_0x4a5a4d['filters']=_[_0x875b('0x35')](_0x4a5a4d[_0x875b('0x31')],_0x4a5a4d[_0x875b('0x32')]);_0x913fdb[_0x875b('0x36')]=_['intersection'](_0x4a5a4d[_0x875b('0x31')],qs[_0x875b('0x37')](_0xe23ee5['query']['fields']));_0x913fdb[_0x875b('0x36')]=_0x913fdb['attributes'][_0x875b('0x38')]?_0x913fdb[_0x875b('0x36')]:_0x4a5a4d[_0x875b('0x31')];if(_0xe23ee5[_0x875b('0x32')][_0x875b('0x47')]){_0x913fdb['include']=[{'all':!![]}];}_0x913fdb=_[_0x875b('0x3e')]({},_0x913fdb,_0xe23ee5[_0x875b('0x40')]);return db['AnalyticFieldReport'][_0x875b('0x48')](_0x913fdb)[_0x875b('0x25')](handleEntityNotFound(_0x2ac976,null))[_0x875b('0x25')](respondWithResult(_0x2ac976,null))[_0x875b('0x44')](handleError(_0x2ac976,null));};exports[_0x875b('0x49')]=function(_0x277123,_0x5923d1){return db[_0x875b('0x2c')][_0x875b('0x49')](_0x277123[_0x875b('0x4a')],{})[_0x875b('0x25')](respondWithResult(_0x5923d1,0xc9))[_0x875b('0x44')](handleError(_0x5923d1,null));};exports['bulkCreate']=function(_0x3d36fb,_0x513f23){return db[_0x875b('0x2c')][_0x875b('0x4b')](_0x3d36fb[_0x875b('0x4a')],{'raw':![],'individualHooks':!![]})[_0x875b('0x25')](respondWithResult(_0x513f23,0xc9))['catch'](handleError(_0x513f23,null));};exports[_0x875b('0x24')]=function(_0x48e78b,_0x4b5ab6){if(_0x48e78b[_0x875b('0x4a')]['id']){delete _0x48e78b[_0x875b('0x4a')]['id'];}return db[_0x875b('0x2c')][_0x875b('0x48')]({'where':{'id':_0x48e78b[_0x875b('0x46')]['id']}})[_0x875b('0x25')](handleEntityNotFound(_0x4b5ab6,null))[_0x875b('0x25')](saveUpdates(_0x48e78b[_0x875b('0x4a')],null))['then'](respondWithResult(_0x4b5ab6,null))['catch'](handleError(_0x4b5ab6,null));};exports['destroy']=function(_0xab7327,_0x5d3b60){return db['AnalyticFieldReport'][_0x875b('0x48')]({'where':{'id':_0xab7327[_0x875b('0x46')]['id']}})[_0x875b('0x25')](handleEntityNotFound(_0x5d3b60,null))[_0x875b('0x25')](removeEntity(_0x5d3b60,null))[_0x875b('0x44')](handleError(_0x5d3b60,null));};exports[_0x875b('0x4c')]=function(_0x547aa5,_0x39cec0){return db[_0x875b('0x2c')]['destroy']({'where':{'id':_0x547aa5[_0x875b('0x32')][_0x875b('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x875b('0x25')](respondWithResult(_0x39cec0,0xcc))[_0x875b('0x44')](handleError(_0x39cec0,null));};exports[_0x875b('0x4e')]=function(_0xbd5532,_0x1e2bbd,_0x13ff44){return db[_0x875b('0x4f')][_0x875b('0x50')]({'where':{'id':_0xbd5532[_0x875b('0x46')]['id']}})[_0x875b('0x25')](handleEntityNotFound(_0x1e2bbd,null))[_0x875b('0x25')](function(_0x20161f){if(_0x20161f){return db[_0x875b('0x51')][_0x875b('0x52')](function(_0x5b1461){return db['AnalyticFieldReport'][_0x875b('0x53')]({'where':{'CustomReportId':_0xbd5532[_0x875b('0x46')]['id']},'transaction':_0x5b1461})[_0x875b('0x25')](function(_0x3666cb){var _0x53f924=_[_0x875b('0x2b')](_0xbd5532[_0x875b('0x4a')],function(_0x30b611){delete _0x30b611['id'];_0x30b611[_0x875b('0x54')]=_0xbd5532[_0x875b('0x46')]['id'];return _0x30b611;});return db[_0x875b('0x2c')]['bulkCreate'](_0x53f924,{'transaction':_0x5b1461});});})[_0x875b('0x25')](function(){return db[_0x875b('0x2c')][_0x875b('0x42')]({'where':{'CustomReportId':_0xbd5532[_0x875b('0x46')]['id']}});});}})['then'](respondWithResult(_0x1e2bbd,null))['catch'](handleError(_0x1e2bbd,null));}; \ No newline at end of file +var _0x8c0e=['includeAll','catch','create','body','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params'];(function(_0x29518d,_0x1e5f3c){var _0x307961=function(_0x2a948e){while(--_0x2a948e){_0x29518d['push'](_0x29518d['shift']());}};_0x307961(++_0x1e5f3c);}(_0x8c0e,0x1a6));var _0xe8c0=function(_0x5dcac6,_0x16c78e){_0x5dcac6=_0x5dcac6-0x0;var _0x2b156d=_0x8c0e[_0x5dcac6];return _0x2b156d;};'use strict';var emlformat=require(_0xe8c0('0x0'));var rimraf=require(_0xe8c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8c0('0x2'));var rp=require(_0xe8c0('0x3'));var moment=require(_0xe8c0('0x4'));var BPromise=require(_0xe8c0('0x5'));var Mustache=require(_0xe8c0('0x6'));var util=require(_0xe8c0('0x7'));var path=require(_0xe8c0('0x8'));var sox=require('sox');var csv=require(_0xe8c0('0x9'));var ejs=require(_0xe8c0('0xa'));var fs=require('fs');var fs_extra=require(_0xe8c0('0xb'));var _=require(_0xe8c0('0xc'));var squel=require(_0xe8c0('0xd'));var crypto=require(_0xe8c0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe8c0('0xf'));var toCsv=require(_0xe8c0('0x9'));var querystring=require(_0xe8c0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe8c0('0x11'));var hardwareService=require(_0xe8c0('0x12'));var logger=require('../../config/logger')(_0xe8c0('0x13'));var utils=require(_0xe8c0('0x14'));var config=require(_0xe8c0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24165a,_0x19c661){_0x19c661=_0x19c661||0xcc;return function(_0xcb594f){if(_0xcb594f){return _0x24165a[_0xe8c0('0x16')](_0x19c661);}return _0x24165a['status'](_0x19c661)[_0xe8c0('0x17')]();};}function respondWithResult(_0x29fe7d,_0x2f844a){_0x2f844a=_0x2f844a||0xc8;return function(_0x131d38){if(_0x131d38){return _0x29fe7d[_0xe8c0('0x18')](_0x2f844a)[_0xe8c0('0x19')](_0x131d38);}};}function respondWithFilteredResult(_0x2ee2dd,_0x3cac3a){return function(_0x419f14){if(_0x419f14){var _0x5f743c=typeof _0x3cac3a[_0xe8c0('0x1a')]===_0xe8c0('0x1b')&&typeof _0x3cac3a[_0xe8c0('0x1c')]===_0xe8c0('0x1b');var _0x35fdf4=_0x419f14[_0xe8c0('0x1d')];var _0x194d3b=_0x5f743c?0x0:_0x3cac3a[_0xe8c0('0x1a')];var _0x424575=_0x5f743c?_0x419f14['count']:_0x3cac3a[_0xe8c0('0x1a')]+_0x3cac3a[_0xe8c0('0x1c')];var _0x22c249;if(_0x424575>=_0x35fdf4){_0x424575=_0x35fdf4;_0x22c249=0xc8;}else{_0x22c249=0xce;}_0x2ee2dd[_0xe8c0('0x18')](_0x22c249);return _0x2ee2dd[_0xe8c0('0x1e')](_0xe8c0('0x1f'),_0x194d3b+'-'+_0x424575+'/'+_0x35fdf4)['json'](_0x419f14);}return null;};}function patchUpdates(_0x3094e3){return function(_0x343049){try{jsonpatch[_0xe8c0('0x20')](_0x343049,_0x3094e3,!![]);}catch(_0x1835c4){return BPromise[_0xe8c0('0x21')](_0x1835c4);}return _0x343049[_0xe8c0('0x22')]();};}function saveUpdates(_0x48c46e,_0xe3e420){return function(_0x1d2dfa){if(_0x1d2dfa){return _0x1d2dfa[_0xe8c0('0x23')](_0x48c46e)[_0xe8c0('0x24')](function(_0x5570e4){return _0x5570e4;});}return null;};}function removeEntity(_0x398112,_0x1e18c9){return function(_0x4dc38d){if(_0x4dc38d){return _0x4dc38d[_0xe8c0('0x25')]()[_0xe8c0('0x24')](function(){_0x398112[_0xe8c0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2504b4,_0x49e2e3){return function(_0x4f1855){if(!_0x4f1855){_0x2504b4[_0xe8c0('0x16')](0x194);}return _0x4f1855;};}function handleError(_0x550d10,_0x401b1a){_0x401b1a=_0x401b1a||0x1f4;return function(_0x1bceac){logger[_0xe8c0('0x26')](_0x1bceac['stack']);if(_0x1bceac[_0xe8c0('0x27')]){delete _0x1bceac['name'];}_0x550d10['status'](_0x401b1a)[_0xe8c0('0x28')](_0x1bceac);};}exports[_0xe8c0('0x29')]=function(_0x342c19,_0x248c02){var _0x285e10={},_0x4997cd={},_0x11c4a5={'count':0x0,'rows':[]};var _0x460da2=_[_0xe8c0('0x2a')](db[_0xe8c0('0x2b')][_0xe8c0('0x2c')],function(_0x14939e){return{'name':_0x14939e[_0xe8c0('0x2d')],'type':_0x14939e[_0xe8c0('0x2e')][_0xe8c0('0x2f')]};});_0x4997cd[_0xe8c0('0x30')]=_[_0xe8c0('0x2a')](_0x460da2,'name');_0x4997cd['query']=_[_0xe8c0('0x31')](_0x342c19[_0xe8c0('0x32')]);_0x4997cd[_0xe8c0('0x33')]=_['intersection'](_0x4997cd[_0xe8c0('0x30')],_0x4997cd[_0xe8c0('0x32')]);_0x285e10[_0xe8c0('0x34')]=_[_0xe8c0('0x35')](_0x4997cd['model'],qs[_0xe8c0('0x36')](_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x36')]));_0x285e10[_0xe8c0('0x34')]=_0x285e10['attributes'][_0xe8c0('0x37')]?_0x285e10['attributes']:_0x4997cd[_0xe8c0('0x30')];if(!_0x342c19[_0xe8c0('0x32')]['hasOwnProperty'](_0xe8c0('0x38'))){_0x285e10[_0xe8c0('0x1c')]=qs[_0xe8c0('0x1c')](_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x1c')]);_0x285e10['offset']=qs[_0xe8c0('0x1a')](_0x342c19['query'][_0xe8c0('0x1a')]);}_0x285e10[_0xe8c0('0x39')]=qs['sort'](_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x3a')]);_0x285e10[_0xe8c0('0x3b')]=qs[_0xe8c0('0x33')](_[_0xe8c0('0x3c')](_0x342c19[_0xe8c0('0x32')],_0x4997cd['filters']),_0x460da2);if(_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x3d')]){_0x285e10[_0xe8c0('0x3b')]=_[_0xe8c0('0x3e')](_0x285e10[_0xe8c0('0x3b')],{'$or':_[_0xe8c0('0x2a')](_0x460da2,function(_0x2b6b9c){if(_0x2b6b9c[_0xe8c0('0x2e')]!==_0xe8c0('0x3f')){var _0x51e3f6={};_0x51e3f6[_0x2b6b9c[_0xe8c0('0x27')]]={'$like':'%'+_0x342c19[_0xe8c0('0x32')][_0xe8c0('0x3d')]+'%'};return _0x51e3f6;}})});}_0x285e10=_[_0xe8c0('0x3e')]({},_0x285e10,_0x342c19[_0xe8c0('0x40')]);var _0x2cc35e={'where':_0x285e10[_0xe8c0('0x3b')]};return db[_0xe8c0('0x2b')][_0xe8c0('0x1d')](_0x2cc35e)['then'](function(_0x1f14d4){_0x11c4a5[_0xe8c0('0x1d')]=_0x1f14d4;if(_0x342c19['query']['includeAll']){_0x285e10[_0xe8c0('0x41')]=[{'all':!![]}];}return db[_0xe8c0('0x2b')][_0xe8c0('0x42')](_0x285e10);})[_0xe8c0('0x24')](function(_0x1dc5fa){_0x11c4a5[_0xe8c0('0x43')]=_0x1dc5fa;return _0x11c4a5;})[_0xe8c0('0x24')](respondWithFilteredResult(_0x248c02,_0x285e10))['catch'](handleError(_0x248c02,null));};exports[_0xe8c0('0x44')]=function(_0x583510,_0x2bfe37){var _0x5dcf92={'raw':![],'where':{'id':_0x583510[_0xe8c0('0x45')]['id']}},_0x2d0be2={};_0x2d0be2['model']=_['keys'](db[_0xe8c0('0x2b')][_0xe8c0('0x2c')]);_0x2d0be2[_0xe8c0('0x32')]=_[_0xe8c0('0x31')](_0x583510[_0xe8c0('0x32')]);_0x2d0be2[_0xe8c0('0x33')]=_['intersection'](_0x2d0be2[_0xe8c0('0x30')],_0x2d0be2[_0xe8c0('0x32')]);_0x5dcf92[_0xe8c0('0x34')]=_['intersection'](_0x2d0be2[_0xe8c0('0x30')],qs[_0xe8c0('0x36')](_0x583510[_0xe8c0('0x32')]['fields']));_0x5dcf92[_0xe8c0('0x34')]=_0x5dcf92[_0xe8c0('0x34')][_0xe8c0('0x37')]?_0x5dcf92['attributes']:_0x2d0be2[_0xe8c0('0x30')];if(_0x583510[_0xe8c0('0x32')][_0xe8c0('0x46')]){_0x5dcf92[_0xe8c0('0x41')]=[{'all':!![]}];}_0x5dcf92=_['merge']({},_0x5dcf92,_0x583510['options']);return db[_0xe8c0('0x2b')]['find'](_0x5dcf92)['then'](handleEntityNotFound(_0x2bfe37,null))[_0xe8c0('0x24')](respondWithResult(_0x2bfe37,null))[_0xe8c0('0x47')](handleError(_0x2bfe37,null));};exports[_0xe8c0('0x48')]=function(_0x1db4ec,_0x3b4511){return db[_0xe8c0('0x2b')][_0xe8c0('0x48')](_0x1db4ec[_0xe8c0('0x49')],{})[_0xe8c0('0x24')](respondWithResult(_0x3b4511,0xc9))[_0xe8c0('0x47')](handleError(_0x3b4511,null));};exports['bulkCreate']=function(_0x1b48c6,_0x3d1dd4){return db[_0xe8c0('0x2b')]['bulkCreate'](_0x1b48c6[_0xe8c0('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3d1dd4,0xc9))[_0xe8c0('0x47')](handleError(_0x3d1dd4,null));};exports[_0xe8c0('0x23')]=function(_0xdfec37,_0x2ee64c){if(_0xdfec37[_0xe8c0('0x49')]['id']){delete _0xdfec37[_0xe8c0('0x49')]['id'];}return db[_0xe8c0('0x2b')][_0xe8c0('0x4a')]({'where':{'id':_0xdfec37[_0xe8c0('0x45')]['id']}})[_0xe8c0('0x24')](handleEntityNotFound(_0x2ee64c,null))['then'](saveUpdates(_0xdfec37[_0xe8c0('0x49')],null))[_0xe8c0('0x24')](respondWithResult(_0x2ee64c,null))[_0xe8c0('0x47')](handleError(_0x2ee64c,null));};exports[_0xe8c0('0x25')]=function(_0x35e381,_0x1c5d9c){return db[_0xe8c0('0x2b')][_0xe8c0('0x4a')]({'where':{'id':_0x35e381[_0xe8c0('0x45')]['id']}})[_0xe8c0('0x24')](handleEntityNotFound(_0x1c5d9c,null))[_0xe8c0('0x24')](removeEntity(_0x1c5d9c,null))['catch'](handleError(_0x1c5d9c,null));};exports[_0xe8c0('0x4b')]=function(_0x30c6e5,_0x23f304){return db[_0xe8c0('0x2b')][_0xe8c0('0x25')]({'where':{'id':_0x30c6e5[_0xe8c0('0x32')][_0xe8c0('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xe8c0('0x24')](respondWithResult(_0x23f304,0xcc))[_0xe8c0('0x47')](handleError(_0x23f304,null));};exports[_0xe8c0('0x4d')]=function(_0x311ad2,_0x94160e,_0x4b37f8){return db[_0xe8c0('0x4e')][_0xe8c0('0x4f')]({'where':{'id':_0x311ad2['params']['id']}})[_0xe8c0('0x24')](handleEntityNotFound(_0x94160e,null))['then'](function(_0x2b27d5){if(_0x2b27d5){return db[_0xe8c0('0x50')]['transaction'](function(_0x9ee13b){return db[_0xe8c0('0x2b')][_0xe8c0('0x25')]({'where':{'CustomReportId':_0x311ad2[_0xe8c0('0x45')]['id']},'transaction':_0x9ee13b})[_0xe8c0('0x24')](function(_0x1cf7cc){var _0x1c23c4=_[_0xe8c0('0x2a')](_0x311ad2[_0xe8c0('0x49')],function(_0x3a0ebd){delete _0x3a0ebd['id'];_0x3a0ebd['CustomReportId']=_0x311ad2[_0xe8c0('0x45')]['id'];return _0x3a0ebd;});return db[_0xe8c0('0x2b')][_0xe8c0('0x51')](_0x1c23c4,{'transaction':_0x9ee13b});});})[_0xe8c0('0x24')](function(){return db[_0xe8c0('0x2b')]['findAll']({'where':{'CustomReportId':_0x311ad2[_0xe8c0('0x45')]['id']}});});}})[_0xe8c0('0x24')](respondWithResult(_0x94160e,null))[_0xe8c0('0x47')](handleError(_0x94160e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index bc8093b..7d3c60e 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 _0x9bec=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticFieldReport.attributes','define'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x9bec,0xda));var _0xc9be=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x9bec[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xc9be('0x0'));var util=require(_0xc9be('0x1'));var logger=require(_0xc9be('0x2'))(_0xc9be('0x3'));var moment=require(_0xc9be('0x4'));var BPromise=require(_0xc9be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9be('0x6'));var rimraf=require(_0xc9be('0x7'));var config=require('../../config/environment');var attributes=require(_0xc9be('0x8'));module['exports']=function(_0x362b2b,_0x401a3c){return _0x362b2b[_0xc9be('0x9')](_0xc9be('0xa'),attributes,{'tableName':_0xc9be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eef=['request-promise','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','api','moment'];(function(_0x758c4c,_0x590551){var _0x59dd93=function(_0x50f870){while(--_0x50f870){_0x758c4c['push'](_0x758c4c['shift']());}};_0x59dd93(++_0x590551);}(_0x7eef,0xba));var _0xf7ee=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x7eef[_0x146a85];return _0x1b59bf;};'use strict';var _=require(_0xf7ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf7ee('0x1'));var moment=require(_0xf7ee('0x2'));var BPromise=require('bluebird');var rp=require(_0xf7ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf7ee('0x4'));var attributes=require(_0xf7ee('0x5'));module[_0xf7ee('0x6')]=function(_0x3089ac,_0x12fac8){return _0x3089ac['define'](_0xf7ee('0x7'),attributes,{'tableName':_0xf7ee('0x8'),'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 2092d02..e240810 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 _0x3242=['bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x45365d,_0x267e43){var _0x23a842=function(_0xc1e1ff){while(--_0xc1e1ff){_0x45365d['push'](_0x45365d['shift']());}};_0x23a842(++_0x267e43);}(_0x3242,0x105));var _0x2324=function(_0x5d8c33,_0x3017c8){_0x5d8c33=_0x5d8c33-0x0;var _0x4117b1=_0x3242[_0x5d8c33];return _0x4117b1;};'use strict';var _=require(_0x2324('0x0'));var util=require(_0x2324('0x1'));var moment=require(_0x2324('0x2'));var BPromise=require(_0x2324('0x3'));var rs=require(_0x2324('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2324('0x5'));var logger=require('../../config/logger')(_0x2324('0x6'));var config=require('../../config/environment');var jayson=require(_0x2324('0x7'));var client=jayson[_0x2324('0x8')][_0x2324('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b618f,_0x23aa61,_0x4ee896){return new BPromise(function(_0x1788c1,_0x562749){return client[_0x2324('0xa')](_0x4b618f,_0x4ee896)[_0x2324('0xb')](function(_0x5622c9){logger[_0x2324('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x23aa61,'request\x20sent');logger[_0x2324('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x23aa61,_0x2324('0xe'),JSON[_0x2324('0xf')](_0x5622c9));if(_0x5622c9[_0x2324('0x10')]){if(_0x5622c9['error'][_0x2324('0x11')]===0x1f4){logger[_0x2324('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x23aa61,_0x5622c9[_0x2324('0x10')][_0x2324('0x12')]);return _0x562749(_0x5622c9[_0x2324('0x10')]['message']);}logger[_0x2324('0x10')](_0x2324('0x13'),_0x23aa61,_0x5622c9[_0x2324('0x10')][_0x2324('0x12')]);return _0x1788c1(_0x5622c9[_0x2324('0x10')][_0x2324('0x12')]);}else{logger[_0x2324('0xc')](_0x2324('0x13'),_0x23aa61,'request\x20sent');_0x1788c1(_0x5622c9[_0x2324('0x14')][_0x2324('0x12')]);}})[_0x2324('0x15')](function(_0x20e990){logger['error'](_0x2324('0x13'),_0x23aa61,_0x20e990);_0x562749(_0x20e990);});});} \ No newline at end of file +var _0x7efa=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x49daf3,_0x2f3779){var _0x5dff0a=function(_0x2b567b){while(--_0x2b567b){_0x49daf3['push'](_0x49daf3['shift']());}};_0x5dff0a(++_0x2f3779);}(_0x7efa,0x1cb));var _0xa7ef=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7efa[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var moment=require(_0xa7ef('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7ef('0x3'));var fs=require('fs');var Redis=require(_0xa7ef('0x4'));var db=require(_0xa7ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7ef('0x6'))('rpc');var config=require(_0xa7ef('0x7'));var jayson=require(_0xa7ef('0x8'));var client=jayson[_0xa7ef('0x9')][_0xa7ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cf8a,_0x242f16,_0x1cb36a){return new BPromise(function(_0x580282,_0xc04145){return client[_0xa7ef('0xb')](_0x4cf8a,_0x1cb36a)[_0xa7ef('0xc')](function(_0x232600){logger[_0xa7ef('0xd')](_0xa7ef('0xe'),_0x242f16,_0xa7ef('0xf'));logger[_0xa7ef('0x10')](_0xa7ef('0x11'),_0x242f16,'request\x20sent',JSON[_0xa7ef('0x12')](_0x232600));if(_0x232600[_0xa7ef('0x13')]){if(_0x232600[_0xa7ef('0x13')][_0xa7ef('0x14')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x242f16,_0x232600[_0xa7ef('0x13')][_0xa7ef('0x15')]);return _0xc04145(_0x232600[_0xa7ef('0x13')][_0xa7ef('0x15')]);}logger['error'](_0xa7ef('0xe'),_0x242f16,_0x232600['error']['message']);return _0x580282(_0x232600[_0xa7ef('0x13')][_0xa7ef('0x15')]);}else{logger[_0xa7ef('0xd')](_0xa7ef('0xe'),_0x242f16,_0xa7ef('0xf'));_0x580282(_0x232600[_0xa7ef('0x16')][_0xa7ef('0x15')]);}})['catch'](function(_0x40ddc1){logger[_0xa7ef('0x13')](_0xa7ef('0xe'),_0x242f16,_0x40ddc1);_0xc04145(_0x40ddc1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index dd57d2c..8c8dc27 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(_0x1d6688,_0x1e887d){var _0xb94e97=function(_0x3658cd){while(--_0x3658cd){_0x1d6688['push'](_0x1d6688['shift']());}};_0xb94e97(++_0x1e887d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0xb12b49,_0x50c6d6){var _0x592f07=function(_0x63460d){while(--_0x63460d){_0xb12b49['push'](_0xb12b49['shift']());}};_0x592f07(++_0x50c6d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 05d476d..b633b69 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 _0x2697=['exports','STRING','name','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2697,0x120));var _0x7269=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x2697[_0xdeefbd];return _0x4ff63f;};'use strict';var Sequelize=require('sequelize');module[_0x7269('0x0')]={'name':{'type':Sequelize[_0x7269('0x1')],'allowNull':![],'unique':_0x7269('0x2')},'table':{'type':Sequelize[_0x7269('0x1')]},'metric':{'type':Sequelize[_0x7269('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x23a3=['TEXT','STRING','name'];(function(_0x459437,_0x139ded){var _0x576989=function(_0x58a29b){while(--_0x58a29b){_0x459437['push'](_0x459437['shift']());}};_0x576989(++_0x139ded);}(_0x23a3,0x131));var _0x323a=function(_0x399822,_0x3667ef){_0x399822=_0x399822-0x0;var _0x943381=_0x23a3[_0x399822];return _0x943381;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x323a('0x0')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x323a('0x1')]},'description':{'type':Sequelize[_0x323a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a89bf82..16842e9 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 _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5524a4,_0x5808eb){var _0x2033ec=function(_0xdd3ce5){while(--_0xdd3ce5){_0x5524a4['push'](_0x5524a4['shift']());}};_0x2033ec(++_0x5808eb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4aa350,_0x12a9eb){_0x4aa350=_0x4aa350-0x0;var _0x32a16f=_0x7fbe[_0x4aa350];return _0x32a16f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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','sendStatus','end','status','json'];(function(_0x2c407a,_0x46124a){var _0x1211c5=function(_0x2028e2){while(--_0x2028e2){_0x2c407a['push'](_0x2c407a['shift']());}};_0x1211c5(++_0x46124a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x48ac19,_0x3c29fc){_0x48ac19=_0x48ac19-0x0;var _0x1cd27d=_0xe5b3[_0x48ac19];return _0x1cd27d;};'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'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2543f49..5c2a322 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 _0xf8af=['bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment'];(function(_0x5397d4,_0x2b4b0d){var _0x33746c=function(_0xc1626c){while(--_0xc1626c){_0x5397d4['push'](_0x5397d4['shift']());}};_0x33746c(++_0x2b4b0d);}(_0xf8af,0x8b));var _0xff8a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf8af[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xff8a('0x0'));var util=require('util');var logger=require(_0xff8a('0x1'))(_0xff8a('0x2'));var moment=require(_0xff8a('0x3'));var BPromise=require(_0xff8a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff8a('0x5'));var rimraf=require(_0xff8a('0x6'));var config=require(_0xff8a('0x7'));var attributes=require(_0xff8a('0x8'));module['exports']=function(_0x5a4a51,_0x1fc99e){return _0x5a4a51['define'](_0xff8a('0x9'),attributes,{'tableName':_0xff8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x576b=['define','AnalyticMetric','analytics_metrics','api','moment','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x576b,0x1d9));var _0xb576=function(_0x123015,_0x43dd0f){_0x123015=_0x123015-0x0;var _0x237557=_0x576b[_0x123015];return _0x237557;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb576('0x0'));var moment=require(_0xb576('0x1'));var BPromise=require('bluebird');var rp=require(_0xb576('0x2'));var fs=require('fs');var path=require(_0xb576('0x3'));var rimraf=require('rimraf');var config=require(_0xb576('0x4'));var attributes=require(_0xb576('0x5'));module[_0xb576('0x6')]=function(_0x3039d9,_0x11427a){return _0x3039d9[_0xb576('0x7')](_0xb576('0x8'),attributes,{'tableName':_0xb576('0x9'),'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 4e556cd..c6543d2 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 _0x3c98=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x30a5e5,_0x4ba8a0){var _0x15d571=function(_0x1285a5){while(--_0x1285a5){_0x30a5e5['push'](_0x30a5e5['shift']());}};_0x15d571(++_0x4ba8a0);}(_0x3c98,0xc6));var _0x83c9=function(_0x4081da,_0x7e4af9){_0x4081da=_0x4081da-0x0;var _0x5b2533=_0x3c98[_0x4081da];return _0x5b2533;};'use strict';var _=require(_0x83c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x83c9('0x1'));var fs=require('fs');var Redis=require(_0x83c9('0x2'));var db=require(_0x83c9('0x3'))['db'];var utils=require(_0x83c9('0x4'));var logger=require('../../config/logger')(_0x83c9('0x5'));var config=require(_0x83c9('0x6'));var jayson=require(_0x83c9('0x7'));var client=jayson['client'][_0x83c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf2c93c,_0x690129,_0x4c9369){return new BPromise(function(_0x20f0c5,_0x824f35){return client[_0x83c9('0x9')](_0xf2c93c,_0x4c9369)[_0x83c9('0xa')](function(_0x58bb0f){logger[_0x83c9('0xb')](_0x83c9('0xc'),_0x690129,_0x83c9('0xd'));logger[_0x83c9('0xe')](_0x83c9('0xf'),_0x690129,_0x83c9('0xd'),JSON['stringify'](_0x58bb0f));if(_0x58bb0f[_0x83c9('0x10')]){if(_0x58bb0f[_0x83c9('0x10')]['code']===0x1f4){logger[_0x83c9('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x690129,_0x58bb0f[_0x83c9('0x10')]['message']);return _0x824f35(_0x58bb0f[_0x83c9('0x10')]['message']);}logger[_0x83c9('0x10')](_0x83c9('0xc'),_0x690129,_0x58bb0f[_0x83c9('0x10')][_0x83c9('0x11')]);return _0x20f0c5(_0x58bb0f[_0x83c9('0x10')][_0x83c9('0x11')]);}else{logger[_0x83c9('0xb')](_0x83c9('0xc'),_0x690129,_0x83c9('0xd'));_0x20f0c5(_0x58bb0f['result'][_0x83c9('0x11')]);}})[_0x83c9('0x12')](function(_0x110323){logger[_0x83c9('0x10')](_0x83c9('0xc'),_0x690129,_0x110323);_0x824f35(_0x110323);});});} \ No newline at end of file +var _0x8afb=['rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x484f06,_0x36e4ac){var _0x332d44=function(_0x1db42e){while(--_0x1db42e){_0x484f06['push'](_0x484f06['shift']());}};_0x332d44(++_0x36e4ac);}(_0x8afb,0x127));var _0xb8af=function(_0x2f0832,_0x268977){_0x2f0832=_0x2f0832-0x0;var _0x52db08=_0x8afb[_0x2f0832];return _0x52db08;};'use strict';var _=require(_0xb8af('0x0'));var util=require('util');var moment=require(_0xb8af('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8af('0x2'))['db'];var utils=require(_0xb8af('0x3'));var logger=require(_0xb8af('0x4'))(_0xb8af('0x5'));var config=require('../../config/environment');var jayson=require(_0xb8af('0x6'));var client=jayson[_0xb8af('0x7')][_0xb8af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ec809,_0x863764,_0x2ca671){return new BPromise(function(_0x42abf5,_0x474d8b){return client[_0xb8af('0x9')](_0x4ec809,_0x2ca671)[_0xb8af('0xa')](function(_0x27c184){logger[_0xb8af('0xb')](_0xb8af('0xc'),_0x863764,'request\x20sent');logger[_0xb8af('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x863764,_0xb8af('0xe'),JSON[_0xb8af('0xf')](_0x27c184));if(_0x27c184['error']){if(_0x27c184['error'][_0xb8af('0x10')]===0x1f4){logger[_0xb8af('0x11')](_0xb8af('0xc'),_0x863764,_0x27c184['error'][_0xb8af('0x12')]);return _0x474d8b(_0x27c184[_0xb8af('0x11')]['message']);}logger[_0xb8af('0x11')](_0xb8af('0xc'),_0x863764,_0x27c184['error'][_0xb8af('0x12')]);return _0x42abf5(_0x27c184['error'][_0xb8af('0x12')]);}else{logger[_0xb8af('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x863764,_0xb8af('0xe'));_0x42abf5(_0x27c184[_0xb8af('0x13')][_0xb8af('0x12')]);}})['catch'](function(_0xc4fccf){logger[_0xb8af('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x863764,_0xc4fccf);_0x474d8b(_0xc4fccf);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 972a379..5c340c4 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 _0x5c91=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54a2da,_0x51925b){var _0x20297e=function(_0x16fb4d){while(--_0x16fb4d){_0x54a2da['push'](_0x54a2da['shift']());}};_0x20297e(++_0x51925b);}(_0x5c91,0x1e9));var _0x15c9=function(_0x3f18d9,_0x3b2f8f){_0x3f18d9=_0x3f18d9-0x0;var _0x243ff4=_0x5c91[_0x3f18d9];return _0x243ff4;};'use strict';var multer=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var path=require(_0x15c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x15c9('0x3'));var router=express[_0x15c9('0x4')]();var fs_extra=require(_0x15c9('0x5'));var auth=require(_0x15c9('0x6'));var interaction=require(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var controller=require('./analyticMetric.controller');router[_0x15c9('0x9')]('/',auth[_0x15c9('0xa')](),controller[_0x15c9('0xb')]);router[_0x15c9('0x9')](_0x15c9('0xc'),auth['isAuthenticated'](),controller[_0x15c9('0xd')]);router[_0x15c9('0xe')]('/',auth[_0x15c9('0xa')](),controller['create']);router[_0x15c9('0xf')](_0x15c9('0xc'),auth[_0x15c9('0xa')](),controller['update']);router['delete'](_0x15c9('0xc'),auth[_0x15c9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfd8f=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xfd8f,0xae));var _0xffd8=function(_0x2b72ca,_0x17a97a){_0x2b72ca=_0x2b72ca-0x0;var _0x2e662d=_0xfd8f[_0x2b72ca];return _0x2e662d;};'use strict';var multer=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var path=require('path');var timeout=require(_0xffd8('0x2'));var express=require(_0xffd8('0x3'));var router=express[_0xffd8('0x4')]();var fs_extra=require(_0xffd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xffd8('0x6'));var config=require(_0xffd8('0x7'));var controller=require('./analyticMetric.controller');router[_0xffd8('0x8')]('/',auth[_0xffd8('0x9')](),controller[_0xffd8('0xa')]);router[_0xffd8('0x8')](_0xffd8('0xb'),auth[_0xffd8('0x9')](),controller['show']);router[_0xffd8('0xc')]('/',auth[_0xffd8('0x9')](),controller[_0xffd8('0xd')]);router[_0xffd8('0xe')]('/:id',auth[_0xffd8('0x9')](),controller[_0xffd8('0xf')]);router[_0xffd8('0x10')](_0xffd8('0xb'),auth[_0xffd8('0x9')](),controller[_0xffd8('0x11')]);module[_0xffd8('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9d4a258..ed2943c 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 _0xf73a=['exports','sequelize'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf73a,0x115));var _0xaf73=function(_0x3d3bf7,_0x3d8ecf){_0x3d3bf7=_0x3d3bf7-0x0;var _0x16bd6d=_0xf73a[_0x3d3bf7];return _0x16bd6d;};'use strict';var Sequelize=require(_0xaf73('0x0'));module[_0xaf73('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xf2d7=['exports','sequelize'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0xf2d7,0x157));var _0x7f2d=function(_0x58c53f,_0x39dbf8){_0x58c53f=_0x58c53f-0x0;var _0x355c2a=_0xf2d7[_0x58c53f];return _0x355c2a;};'use strict';var Sequelize=require(_0x7f2d('0x0'));module[_0x7f2d('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b4e9b6a..3b5fc7f 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 _0xd8bd=['index','map','AnalyticTreeReport','rawAttributes','key','name','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','send'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xd8bd,0xb0));var _0xdd8b=function(_0x57f135,_0x54061b){_0x57f135=_0x57f135-0x0;var _0x166438=_0xd8bd[_0x57f135];return _0x166438;};'use strict';var emlformat=require(_0xdd8b('0x0'));var rimraf=require(_0xdd8b('0x1'));var zipdir=require(_0xdd8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd8b('0x3'));var Mustache=require(_0xdd8b('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdd8b('0x5'));var ejs=require(_0xdd8b('0x6'));var fs=require('fs');var fs_extra=require(_0xdd8b('0x7'));var _=require(_0xdd8b('0x8'));var squel=require('squel');var crypto=require(_0xdd8b('0x9'));var jsforce=require(_0xdd8b('0xa'));var deskjs=require(_0xdd8b('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdd8b('0xc'));var Papa=require(_0xdd8b('0xd'));var Redis=require(_0xdd8b('0xe'));var authService=require(_0xdd8b('0xf'));var qs=require(_0xdd8b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd8b('0x11'))(_0xdd8b('0x12'));var utils=require('../../config/utils');var config=require(_0xdd8b('0x13'));var licenseUtil=require(_0xdd8b('0x14'));var db=require(_0xdd8b('0x15'))['db'];function respondWithStatusCode(_0x5c6dd7,_0x40165b){_0x40165b=_0x40165b||0xcc;return function(_0x3dd77b){if(_0x3dd77b){return _0x5c6dd7[_0xdd8b('0x16')](_0x40165b);}return _0x5c6dd7[_0xdd8b('0x17')](_0x40165b)['end']();};}function respondWithResult(_0x27a4f2,_0x27d57a){_0x27d57a=_0x27d57a||0xc8;return function(_0x27b476){if(_0x27b476){return _0x27a4f2[_0xdd8b('0x17')](_0x27d57a)['json'](_0x27b476);}};}function respondWithFilteredResult(_0x43534a,_0x38680a){return function(_0x15f99a){if(_0x15f99a){var _0x1e535d=typeof _0x38680a[_0xdd8b('0x18')]===_0xdd8b('0x19')&&typeof _0x38680a[_0xdd8b('0x1a')]==='undefined';var _0x53e523=_0x15f99a['count'];var _0x47015b=_0x1e535d?0x0:_0x38680a[_0xdd8b('0x18')];var _0x2d4256=_0x1e535d?_0x15f99a[_0xdd8b('0x1b')]:_0x38680a['offset']+_0x38680a[_0xdd8b('0x1a')];var _0x4e2b42;if(_0x2d4256>=_0x53e523){_0x2d4256=_0x53e523;_0x4e2b42=0xc8;}else{_0x4e2b42=0xce;}_0x43534a[_0xdd8b('0x17')](_0x4e2b42);return _0x43534a[_0xdd8b('0x1c')](_0xdd8b('0x1d'),_0x47015b+'-'+_0x2d4256+'/'+_0x53e523)[_0xdd8b('0x1e')](_0x15f99a);}return null;};}function patchUpdates(_0x5db4a7){return function(_0x551d68){try{jsonpatch[_0xdd8b('0x1f')](_0x551d68,_0x5db4a7,!![]);}catch(_0x38439e){return BPromise['reject'](_0x38439e);}return _0x551d68[_0xdd8b('0x20')]();};}function saveUpdates(_0x5043b9,_0x46b93c){return function(_0x2aba8e){if(_0x2aba8e){return _0x2aba8e[_0xdd8b('0x21')](_0x5043b9)[_0xdd8b('0x22')](function(_0x20c4ee){return _0x20c4ee;});}return null;};}function removeEntity(_0x3f5c64,_0x334cd4){return function(_0x323384){if(_0x323384){return _0x323384[_0xdd8b('0x23')]()['then'](function(){_0x3f5c64[_0xdd8b('0x17')](0xcc)[_0xdd8b('0x24')]();});}};}function handleEntityNotFound(_0x2ccead,_0xa7e4ea){return function(_0x4c90fd){if(!_0x4c90fd){_0x2ccead['sendStatus'](0x194);}return _0x4c90fd;};}function handleError(_0x4e0998,_0x1b8305){_0x1b8305=_0x1b8305||0x1f4;return function(_0x4248e1){logger[_0xdd8b('0x25')](_0x4248e1[_0xdd8b('0x26')]);if(_0x4248e1['name']){delete _0x4248e1['name'];}_0x4e0998['status'](_0x1b8305)[_0xdd8b('0x27')](_0x4248e1);};}exports[_0xdd8b('0x28')]=function(_0x188c95,_0x237f4a){var _0x48331d={},_0x1a6d5c={},_0x2e9158={'count':0x0,'rows':[]};var _0xadd297=_[_0xdd8b('0x29')](db[_0xdd8b('0x2a')][_0xdd8b('0x2b')],function(_0x3724b4){return{'name':_0x3724b4['fieldName'],'type':_0x3724b4['type'][_0xdd8b('0x2c')]};});_0x1a6d5c['model']=_[_0xdd8b('0x29')](_0xadd297,_0xdd8b('0x2d'));_0x1a6d5c[_0xdd8b('0x2e')]=_[_0xdd8b('0x2f')](_0x188c95[_0xdd8b('0x2e')]);_0x1a6d5c[_0xdd8b('0x30')]=_[_0xdd8b('0x31')](_0x1a6d5c['model'],_0x1a6d5c['query']);_0x48331d[_0xdd8b('0x32')]=_['intersection'](_0x1a6d5c[_0xdd8b('0x33')],qs[_0xdd8b('0x34')](_0x188c95[_0xdd8b('0x2e')][_0xdd8b('0x34')]));_0x48331d[_0xdd8b('0x32')]=_0x48331d[_0xdd8b('0x32')][_0xdd8b('0x35')]?_0x48331d[_0xdd8b('0x32')]:_0x1a6d5c[_0xdd8b('0x33')];if(!_0x188c95['query']['hasOwnProperty']('nolimit')){_0x48331d[_0xdd8b('0x1a')]=qs['limit'](_0x188c95[_0xdd8b('0x2e')][_0xdd8b('0x1a')]);_0x48331d[_0xdd8b('0x18')]=qs['offset'](_0x188c95[_0xdd8b('0x2e')][_0xdd8b('0x18')]);}_0x48331d[_0xdd8b('0x36')]=qs[_0xdd8b('0x37')](_0x188c95[_0xdd8b('0x2e')][_0xdd8b('0x37')]);_0x48331d[_0xdd8b('0x38')]=qs[_0xdd8b('0x30')](_[_0xdd8b('0x39')](_0x188c95[_0xdd8b('0x2e')],_0x1a6d5c[_0xdd8b('0x30')]),_0xadd297);if(_0x188c95[_0xdd8b('0x2e')][_0xdd8b('0x3a')]){_0x48331d[_0xdd8b('0x38')]=_['merge'](_0x48331d['where'],{'$or':_[_0xdd8b('0x29')](_0xadd297,function(_0x700aef){if(_0x700aef[_0xdd8b('0x3b')]!==_0xdd8b('0x3c')){var _0x30170b={};_0x30170b[_0x700aef['name']]={'$like':'%'+_0x188c95[_0xdd8b('0x2e')]['filter']+'%'};return _0x30170b;}})});}_0x48331d=_[_0xdd8b('0x3d')]({},_0x48331d,_0x188c95['options']);var _0x3afaa6={'where':_0x48331d[_0xdd8b('0x38')]};return db[_0xdd8b('0x2a')][_0xdd8b('0x1b')](_0x3afaa6)[_0xdd8b('0x22')](function(_0x129d66){_0x2e9158[_0xdd8b('0x1b')]=_0x129d66;if(_0x188c95[_0xdd8b('0x2e')][_0xdd8b('0x3e')]){_0x48331d[_0xdd8b('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xdd8b('0x40')](_0x48331d);})[_0xdd8b('0x22')](function(_0x31c599){_0x2e9158[_0xdd8b('0x41')]=_0x31c599;return _0x2e9158;})[_0xdd8b('0x22')](respondWithFilteredResult(_0x237f4a,_0x48331d))[_0xdd8b('0x42')](handleError(_0x237f4a,null));};exports[_0xdd8b('0x43')]=function(_0x8ab2be,_0xc15427){var _0x10dcc9={'raw':!![],'where':{'id':_0x8ab2be['params']['id']}},_0x3c599c={};_0x3c599c[_0xdd8b('0x33')]=_[_0xdd8b('0x2f')](db[_0xdd8b('0x2a')][_0xdd8b('0x2b')]);_0x3c599c[_0xdd8b('0x2e')]=_[_0xdd8b('0x2f')](_0x8ab2be[_0xdd8b('0x2e')]);_0x3c599c[_0xdd8b('0x30')]=_[_0xdd8b('0x31')](_0x3c599c[_0xdd8b('0x33')],_0x3c599c[_0xdd8b('0x2e')]);_0x10dcc9['attributes']=_[_0xdd8b('0x31')](_0x3c599c[_0xdd8b('0x33')],qs[_0xdd8b('0x34')](_0x8ab2be[_0xdd8b('0x2e')]['fields']));_0x10dcc9['attributes']=_0x10dcc9['attributes']['length']?_0x10dcc9[_0xdd8b('0x32')]:_0x3c599c['model'];if(_0x8ab2be['query']['includeAll']){_0x10dcc9[_0xdd8b('0x3f')]=[{'all':!![]}];}_0x10dcc9=_[_0xdd8b('0x3d')]({},_0x10dcc9,_0x8ab2be['options']);return db['AnalyticTreeReport'][_0xdd8b('0x44')](_0x10dcc9)[_0xdd8b('0x22')](handleEntityNotFound(_0xc15427,null))[_0xdd8b('0x22')](respondWithResult(_0xc15427,null))['catch'](handleError(_0xc15427,null));};exports[_0xdd8b('0x45')]=function(_0x3e91f2,_0x1e3144){return db[_0xdd8b('0x2a')][_0xdd8b('0x45')](_0x3e91f2[_0xdd8b('0x46')],{})['then'](respondWithResult(_0x1e3144,0xc9))[_0xdd8b('0x42')](handleError(_0x1e3144,null));};exports[_0xdd8b('0x21')]=function(_0x156d8f,_0x3f9751){if(_0x156d8f[_0xdd8b('0x46')]['id']){delete _0x156d8f['body']['id'];}return db[_0xdd8b('0x2a')][_0xdd8b('0x44')]({'where':{'id':_0x156d8f[_0xdd8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f9751,null))[_0xdd8b('0x22')](saveUpdates(_0x156d8f[_0xdd8b('0x46')],null))['then'](respondWithResult(_0x3f9751,null))[_0xdd8b('0x42')](handleError(_0x3f9751,null));};exports[_0xdd8b('0x23')]=function(_0x63ae9,_0x240c74){return db[_0xdd8b('0x2a')]['find']({'where':{'id':_0x63ae9[_0xdd8b('0x47')]['id']}})[_0xdd8b('0x22')](handleEntityNotFound(_0x240c74,null))[_0xdd8b('0x22')](removeEntity(_0x240c74,null))[_0xdd8b('0x42')](handleError(_0x240c74,null));}; \ No newline at end of file +var _0xc431=['AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','length','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map'];(function(_0x20d56d,_0x29c493){var _0xfd33f2=function(_0x2fc23d){while(--_0x2fc23d){_0x20d56d['push'](_0x20d56d['shift']());}};_0xfd33f2(++_0x29c493);}(_0xc431,0x6d));var _0x1c43=function(_0x29a234,_0x1b10a1){_0x29a234=_0x29a234-0x0;var _0x4736c6=_0xc431[_0x29a234];return _0x4736c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c43('0x0'));var zipdir=require(_0x1c43('0x1'));var jsonpatch=require(_0x1c43('0x2'));var rp=require('request-promise');var moment=require(_0x1c43('0x3'));var BPromise=require(_0x1c43('0x4'));var Mustache=require(_0x1c43('0x5'));var util=require(_0x1c43('0x6'));var path=require(_0x1c43('0x7'));var sox=require('sox');var csv=require(_0x1c43('0x8'));var ejs=require(_0x1c43('0x9'));var fs=require('fs');var fs_extra=require(_0x1c43('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c43('0xb'));var jsforce=require(_0x1c43('0xc'));var deskjs=require(_0x1c43('0xd'));var toCsv=require(_0x1c43('0x8'));var querystring=require(_0x1c43('0xe'));var Papa=require('papaparse');var Redis=require(_0x1c43('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c43('0x10'));var as=require(_0x1c43('0x11'));var hardwareService=require(_0x1c43('0x12'));var logger=require(_0x1c43('0x13'))(_0x1c43('0x14'));var utils=require('../../config/utils');var config=require(_0x1c43('0x15'));var licenseUtil=require(_0x1c43('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd57a,_0x412ac0){_0x412ac0=_0x412ac0||0xcc;return function(_0x5c3ec7){if(_0x5c3ec7){return _0x5dd57a['sendStatus'](_0x412ac0);}return _0x5dd57a['status'](_0x412ac0)['end']();};}function respondWithResult(_0x4da6c3,_0x589b0d){_0x589b0d=_0x589b0d||0xc8;return function(_0x1a50fb){if(_0x1a50fb){return _0x4da6c3[_0x1c43('0x17')](_0x589b0d)[_0x1c43('0x18')](_0x1a50fb);}};}function respondWithFilteredResult(_0x3ea29b,_0x43094f){return function(_0x1327a9){if(_0x1327a9){var _0x534097=typeof _0x43094f[_0x1c43('0x19')]===_0x1c43('0x1a')&&typeof _0x43094f['limit']===_0x1c43('0x1a');var _0xca13bc=_0x1327a9['count'];var _0x10fae1=_0x534097?0x0:_0x43094f[_0x1c43('0x19')];var _0x33676a=_0x534097?_0x1327a9['count']:_0x43094f[_0x1c43('0x19')]+_0x43094f[_0x1c43('0x1b')];var _0x7b1862;if(_0x33676a>=_0xca13bc){_0x33676a=_0xca13bc;_0x7b1862=0xc8;}else{_0x7b1862=0xce;}_0x3ea29b[_0x1c43('0x17')](_0x7b1862);return _0x3ea29b[_0x1c43('0x1c')](_0x1c43('0x1d'),_0x10fae1+'-'+_0x33676a+'/'+_0xca13bc)[_0x1c43('0x18')](_0x1327a9);}return null;};}function patchUpdates(_0x2b80a3){return function(_0x2e1c28){try{jsonpatch['apply'](_0x2e1c28,_0x2b80a3,!![]);}catch(_0xcaa29){return BPromise[_0x1c43('0x1e')](_0xcaa29);}return _0x2e1c28[_0x1c43('0x1f')]();};}function saveUpdates(_0x164e51,_0x38c5d4){return function(_0x4bca34){if(_0x4bca34){return _0x4bca34[_0x1c43('0x20')](_0x164e51)[_0x1c43('0x21')](function(_0x1382b7){return _0x1382b7;});}return null;};}function removeEntity(_0x3c68b4,_0x4b194){return function(_0x10267d){if(_0x10267d){return _0x10267d['destroy']()[_0x1c43('0x21')](function(){_0x3c68b4[_0x1c43('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e90e,_0x1b83e0){return function(_0x26a105){if(!_0x26a105){_0x58e90e[_0x1c43('0x22')](0x194);}return _0x26a105;};}function handleError(_0xebb50c,_0x3474d5){_0x3474d5=_0x3474d5||0x1f4;return function(_0x1cc0ad){logger[_0x1c43('0x23')](_0x1cc0ad[_0x1c43('0x24')]);if(_0x1cc0ad['name']){delete _0x1cc0ad[_0x1c43('0x25')];}_0xebb50c[_0x1c43('0x17')](_0x3474d5)[_0x1c43('0x26')](_0x1cc0ad);};}exports[_0x1c43('0x27')]=function(_0x2ff694,_0x2c539b){var _0x516b57={},_0x22534e={},_0x41baad={'count':0x0,'rows':[]};var _0x2f1980=_[_0x1c43('0x28')](db[_0x1c43('0x29')][_0x1c43('0x2a')],function(_0x4acc90){return{'name':_0x4acc90[_0x1c43('0x2b')],'type':_0x4acc90[_0x1c43('0x2c')][_0x1c43('0x2d')]};});_0x22534e['model']=_[_0x1c43('0x28')](_0x2f1980,_0x1c43('0x25'));_0x22534e[_0x1c43('0x2e')]=_[_0x1c43('0x2f')](_0x2ff694[_0x1c43('0x2e')]);_0x22534e[_0x1c43('0x30')]=_['intersection'](_0x22534e[_0x1c43('0x31')],_0x22534e[_0x1c43('0x2e')]);_0x516b57['attributes']=_[_0x1c43('0x32')](_0x22534e[_0x1c43('0x31')],qs['fields'](_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x33')]));_0x516b57[_0x1c43('0x34')]=_0x516b57['attributes']['length']?_0x516b57[_0x1c43('0x34')]:_0x22534e['model'];if(!_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x35')](_0x1c43('0x36'))){_0x516b57[_0x1c43('0x1b')]=qs['limit'](_0x2ff694[_0x1c43('0x2e')]['limit']);_0x516b57['offset']=qs[_0x1c43('0x19')](_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x19')]);}_0x516b57[_0x1c43('0x37')]=qs[_0x1c43('0x38')](_0x2ff694[_0x1c43('0x2e')]['sort']);_0x516b57[_0x1c43('0x39')]=qs[_0x1c43('0x30')](_[_0x1c43('0x3a')](_0x2ff694[_0x1c43('0x2e')],_0x22534e[_0x1c43('0x30')]),_0x2f1980);if(_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x3b')]){_0x516b57['where']=_[_0x1c43('0x3c')](_0x516b57['where'],{'$or':_[_0x1c43('0x28')](_0x2f1980,function(_0x5c2e79){if(_0x5c2e79['type']!==_0x1c43('0x3d')){var _0xe93cce={};_0xe93cce[_0x5c2e79[_0x1c43('0x25')]]={'$like':'%'+_0x2ff694['query'][_0x1c43('0x3b')]+'%'};return _0xe93cce;}})});}_0x516b57=_[_0x1c43('0x3c')]({},_0x516b57,_0x2ff694[_0x1c43('0x3e')]);var _0x521c94={'where':_0x516b57[_0x1c43('0x39')]};return db[_0x1c43('0x29')][_0x1c43('0x3f')](_0x521c94)['then'](function(_0x351c25){_0x41baad[_0x1c43('0x3f')]=_0x351c25;if(_0x2ff694[_0x1c43('0x2e')][_0x1c43('0x40')]){_0x516b57[_0x1c43('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x516b57);})['then'](function(_0x206d6b){_0x41baad[_0x1c43('0x42')]=_0x206d6b;return _0x41baad;})[_0x1c43('0x21')](respondWithFilteredResult(_0x2c539b,_0x516b57))['catch'](handleError(_0x2c539b,null));};exports[_0x1c43('0x43')]=function(_0xb4aefe,_0x2d4c44){var _0x21c143={'raw':!![],'where':{'id':_0xb4aefe[_0x1c43('0x44')]['id']}},_0x33c2a5={};_0x33c2a5['model']=_[_0x1c43('0x2f')](db[_0x1c43('0x29')][_0x1c43('0x2a')]);_0x33c2a5['query']=_[_0x1c43('0x2f')](_0xb4aefe[_0x1c43('0x2e')]);_0x33c2a5[_0x1c43('0x30')]=_['intersection'](_0x33c2a5[_0x1c43('0x31')],_0x33c2a5[_0x1c43('0x2e')]);_0x21c143[_0x1c43('0x34')]=_['intersection'](_0x33c2a5[_0x1c43('0x31')],qs[_0x1c43('0x33')](_0xb4aefe['query']['fields']));_0x21c143['attributes']=_0x21c143[_0x1c43('0x34')][_0x1c43('0x45')]?_0x21c143['attributes']:_0x33c2a5['model'];if(_0xb4aefe[_0x1c43('0x2e')][_0x1c43('0x40')]){_0x21c143[_0x1c43('0x41')]=[{'all':!![]}];}_0x21c143=_['merge']({},_0x21c143,_0xb4aefe[_0x1c43('0x3e')]);return db['AnalyticTreeReport'][_0x1c43('0x46')](_0x21c143)['then'](handleEntityNotFound(_0x2d4c44,null))[_0x1c43('0x21')](respondWithResult(_0x2d4c44,null))['catch'](handleError(_0x2d4c44,null));};exports['create']=function(_0x4e03ba,_0x57cf64){return db[_0x1c43('0x29')][_0x1c43('0x47')](_0x4e03ba[_0x1c43('0x48')],{})[_0x1c43('0x21')](respondWithResult(_0x57cf64,0xc9))[_0x1c43('0x49')](handleError(_0x57cf64,null));};exports[_0x1c43('0x20')]=function(_0x463bfc,_0x29f1a2){if(_0x463bfc[_0x1c43('0x48')]['id']){delete _0x463bfc['body']['id'];}return db[_0x1c43('0x29')]['find']({'where':{'id':_0x463bfc[_0x1c43('0x44')]['id']}})[_0x1c43('0x21')](handleEntityNotFound(_0x29f1a2,null))[_0x1c43('0x21')](saveUpdates(_0x463bfc[_0x1c43('0x48')],null))[_0x1c43('0x21')](respondWithResult(_0x29f1a2,null))[_0x1c43('0x49')](handleError(_0x29f1a2,null));};exports[_0x1c43('0x4a')]=function(_0x41420b,_0x979efa){return db[_0x1c43('0x29')][_0x1c43('0x46')]({'where':{'id':_0x41420b[_0x1c43('0x44')]['id']}})[_0x1c43('0x21')](handleEntityNotFound(_0x979efa,null))[_0x1c43('0x21')](removeEntity(_0x979efa,null))['catch'](handleError(_0x979efa,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ea46fd9..9dd7899 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 _0x0b3f=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees'];(function(_0x237c9f,_0xad81c4){var _0x1be536=function(_0x1bfaea){while(--_0x1bfaea){_0x237c9f['push'](_0x237c9f['shift']());}};_0x1be536(++_0xad81c4);}(_0x0b3f,0x6c));var _0xf0b3=function(_0x46d463,_0x2e8e61){_0x46d463=_0x46d463-0x0;var _0x3f9c94=_0x0b3f[_0x46d463];return _0x3f9c94;};'use strict';var _=require(_0xf0b3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf0b3('0x1'));var moment=require(_0xf0b3('0x2'));var BPromise=require(_0xf0b3('0x3'));var rp=require(_0xf0b3('0x4'));var fs=require('fs');var path=require(_0xf0b3('0x5'));var rimraf=require(_0xf0b3('0x6'));var config=require(_0xf0b3('0x7'));var attributes=require(_0xf0b3('0x8'));module[_0xf0b3('0x9')]=function(_0x240d83,_0x4f1f62){return _0x240d83[_0xf0b3('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0xf0b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x728c=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticTreeReport.attributes','exports','define'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x728c,0x1f0));var _0xc728=function(_0x41859b,_0x4d2525){_0x41859b=_0x41859b-0x0;var _0x303ac9=_0x728c[_0x41859b];return _0x303ac9;};'use strict';var _=require(_0xc728('0x0'));var util=require(_0xc728('0x1'));var logger=require(_0xc728('0x2'))(_0xc728('0x3'));var moment=require(_0xc728('0x4'));var BPromise=require(_0xc728('0x5'));var rp=require(_0xc728('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc728('0x7'));var config=require('../../config/environment');var attributes=require(_0xc728('0x8'));module[_0xc728('0x9')]=function(_0x198004,_0x50777c){return _0x198004[_0xc728('0xa')](_0xc728('0xb'),attributes,{'tableName':_0xc728('0xc'),'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 55d70f8..8e11a53 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x27bc6d,_0x5cc68f){var _0x1131f1=function(_0xc3f2f5){while(--_0xc3f2f5){_0x27bc6d['push'](_0x27bc6d['shift']());}};_0x1131f1(++_0x5cc68f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x367e14,_0x1aec22){var _0x3bf76e=function(_0x112fc4){while(--_0x112fc4){_0x367e14['push'](_0x367e14['shift']());}};_0x3bf76e(++_0x1aec22);}(_0x1261,0x144));var _0x1126=function(_0x11f598,_0x5a2990){_0x11f598=_0x11f598-0x0;var _0x2a37dc=_0x1261[_0x11f598];return _0x2a37dc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 595c00e..e60bb50 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 _0x46fd=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x3addde,_0x251294){var _0x55364e=function(_0x36812e){while(--_0x36812e){_0x3addde['push'](_0x3addde['shift']());}};_0x55364e(++_0x251294);}(_0x46fd,0x1eb));var _0xd46f=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x46fd[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0xd46f('0x0'));var util=require(_0xd46f('0x1'));var path=require(_0xd46f('0x2'));var timeout=require(_0xd46f('0x3'));var express=require(_0xd46f('0x4'));var router=express['Router']();var fs_extra=require(_0xd46f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd46f('0x6'));var config=require(_0xd46f('0x7'));var controller=require(_0xd46f('0x8'));router['get']('/',auth[_0xd46f('0x9')](),controller[_0xd46f('0xa')]);router[_0xd46f('0xb')](_0xd46f('0xc'),auth[_0xd46f('0x9')](),controller[_0xd46f('0xd')]);router[_0xd46f('0xe')]('/',auth[_0xd46f('0x9')](),controller[_0xd46f('0xf')]);router[_0xd46f('0x10')](_0xd46f('0xc'),auth[_0xd46f('0x9')](),controller[_0xd46f('0x11')]);router['delete'](_0xd46f('0xc'),auth[_0xd46f('0x9')](),controller[_0xd46f('0x12')]);module[_0xd46f('0x13')]=router; \ No newline at end of file +var _0x67e4=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer'];(function(_0x4dc953,_0x20cbc6){var _0x49fcd0=function(_0x6adb52){while(--_0x6adb52){_0x4dc953['push'](_0x4dc953['shift']());}};_0x49fcd0(++_0x20cbc6);}(_0x67e4,0x11f));var _0x467e=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x67e4[_0x28e2cd];return _0x11fd46;};'use strict';var multer=require(_0x467e('0x0'));var util=require('util');var path=require(_0x467e('0x1'));var timeout=require('connect-timeout');var express=require(_0x467e('0x2'));var router=express['Router']();var fs_extra=require(_0x467e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x467e('0x4'));var config=require(_0x467e('0x5'));var controller=require(_0x467e('0x6'));router[_0x467e('0x7')]('/',auth[_0x467e('0x8')](),controller[_0x467e('0x9')]);router[_0x467e('0x7')](_0x467e('0xa'),auth[_0x467e('0x8')](),controller[_0x467e('0xb')]);router[_0x467e('0xc')]('/',auth[_0x467e('0x8')](),controller[_0x467e('0xd')]);router['put'](_0x467e('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x467e('0xa'),auth[_0x467e('0x8')](),controller[_0x467e('0xe')]);module[_0x467e('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5295b52..8854faf 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 _0xbb53=['STRING','sequelize','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xbb53,0x121));var _0x3bb5=function(_0x5a80b3,_0x574647){_0x5a80b3=_0x5a80b3-0x0;var _0x2ab3c0=_0xbb53[_0x5a80b3];return _0x2ab3c0;};'use strict';var Sequelize=require(_0x3bb5('0x0'));module[_0x3bb5('0x1')]={'name':{'type':Sequelize[_0x3bb5('0x2')]},'basename':{'type':Sequelize[_0x3bb5('0x2')]},'type':{'type':Sequelize[_0x3bb5('0x2')]}}; \ No newline at end of file +var _0x448b=['exports','STRING','sequelize'];(function(_0x1ba57f,_0xb81938){var _0x5a7f02=function(_0x32b234){while(--_0x32b234){_0x1ba57f['push'](_0x1ba57f['shift']());}};_0x5a7f02(++_0xb81938);}(_0x448b,0x125));var _0xb448=function(_0x4c5087,_0x521a29){_0x4c5087=_0x4c5087-0x0;var _0x4c4b67=_0x448b[_0x4c5087];return _0x4c4b67;};'use strict';var Sequelize=require(_0xb448('0x0'));module[_0xb448('0x1')]={'name':{'type':Sequelize[_0xb448('0x2')]},'basename':{'type':Sequelize[_0xb448('0x2')]},'type':{'type':Sequelize[_0xb448('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e2a4422..1a37d03 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 _0xacf4=['findAll','rows','catch','show','params','intersection','find','clone','get','omit','createdAt','body','updatedAt','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','send','map','Attachment','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','include'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xacf4,0x186));var _0x4acf=function(_0x4bf457,_0x14dcf4){_0x4bf457=_0x4bf457-0x0;var _0x232be2=_0xacf4[_0x4bf457];return _0x232be2;};'use strict';var emlformat=require(_0x4acf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require(_0x4acf('0x7'));var sox=require(_0x4acf('0x8'));var csv=require('to-csv');var ejs=require(_0x4acf('0x9'));var fs=require('fs');var fs_extra=require(_0x4acf('0xa'));var _=require('lodash');var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4acf('0xd'));var toCsv=require(_0x4acf('0xe'));var querystring=require('querystring');var Papa=require(_0x4acf('0xf'));var Redis=require(_0x4acf('0x10'));var authService=require(_0x4acf('0x11'));var qs=require(_0x4acf('0x12'));var as=require(_0x4acf('0x13'));var hardwareService=require(_0x4acf('0x14'));var logger=require(_0x4acf('0x15'))('api');var utils=require(_0x4acf('0x16'));var config=require(_0x4acf('0x17'));var licenseUtil=require(_0x4acf('0x18'));var db=require(_0x4acf('0x19'))['db'];function respondWithStatusCode(_0x2f30c1,_0x4ddfce){_0x4ddfce=_0x4ddfce||0xcc;return function(_0x391e31){if(_0x391e31){return _0x2f30c1[_0x4acf('0x1a')](_0x4ddfce);}return _0x2f30c1[_0x4acf('0x1b')](_0x4ddfce)[_0x4acf('0x1c')]();};}function respondWithResult(_0x4486f4,_0x115242){_0x115242=_0x115242||0xc8;return function(_0x55d9e2){if(_0x55d9e2){return _0x4486f4[_0x4acf('0x1b')](_0x115242)[_0x4acf('0x1d')](_0x55d9e2);}};}function respondWithFilteredResult(_0x1a8caf,_0x5b146b){return function(_0x4ecaec){if(_0x4ecaec){var _0x2d2552=typeof _0x5b146b['offset']===_0x4acf('0x1e')&&typeof _0x5b146b[_0x4acf('0x1f')]==='undefined';var _0x2e4c00=_0x4ecaec[_0x4acf('0x20')];var _0x214d1e=_0x2d2552?0x0:_0x5b146b[_0x4acf('0x21')];var _0x2fbe89=_0x2d2552?_0x4ecaec[_0x4acf('0x20')]:_0x5b146b[_0x4acf('0x21')]+_0x5b146b['limit'];var _0x3f73e3;if(_0x2fbe89>=_0x2e4c00){_0x2fbe89=_0x2e4c00;_0x3f73e3=0xc8;}else{_0x3f73e3=0xce;}_0x1a8caf[_0x4acf('0x1b')](_0x3f73e3);return _0x1a8caf[_0x4acf('0x22')](_0x4acf('0x23'),_0x214d1e+'-'+_0x2fbe89+'/'+_0x2e4c00)[_0x4acf('0x1d')](_0x4ecaec);}return null;};}function patchUpdates(_0x39b2c3){return function(_0x4379ea){try{jsonpatch['apply'](_0x4379ea,_0x39b2c3,!![]);}catch(_0x1a6a6a){return BPromise[_0x4acf('0x24')](_0x1a6a6a);}return _0x4379ea[_0x4acf('0x25')]();};}function saveUpdates(_0x4e54dd,_0x436f4e){return function(_0x55ca5b){if(_0x55ca5b){return _0x55ca5b[_0x4acf('0x26')](_0x4e54dd)[_0x4acf('0x27')](function(_0x152b3c){return _0x152b3c;});}return null;};}function removeEntity(_0x5d5011,_0x485319){return function(_0x410968){if(_0x410968){return _0x410968[_0x4acf('0x28')]()['then'](function(){_0x5d5011['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a3fd,_0x4c82f4){return function(_0x523c08){if(!_0x523c08){_0x47a3fd['sendStatus'](0x194);}return _0x523c08;};}function handleError(_0x2f980c,_0x4a9fcc){_0x4a9fcc=_0x4a9fcc||0x1f4;return function(_0x17f496){logger[_0x4acf('0x29')](_0x17f496['stack']);if(_0x17f496['name']){delete _0x17f496['name'];}_0x2f980c['status'](_0x4a9fcc)[_0x4acf('0x2a')](_0x17f496);};}exports['index']=function(_0x517264,_0x390928){var _0x32366b={},_0x45e9e6={},_0x3e3115={'count':0x0,'rows':[]};var _0x17325d=_[_0x4acf('0x2b')](db[_0x4acf('0x2c')][_0x4acf('0x2d')],function(_0x58e8af){return{'name':_0x58e8af[_0x4acf('0x2e')],'type':_0x58e8af[_0x4acf('0x2f')]['key']};});_0x45e9e6[_0x4acf('0x30')]=_[_0x4acf('0x2b')](_0x17325d,_0x4acf('0x31'));_0x45e9e6[_0x4acf('0x32')]=_[_0x4acf('0x33')](_0x517264[_0x4acf('0x32')]);_0x45e9e6[_0x4acf('0x34')]=_['intersection'](_0x45e9e6[_0x4acf('0x30')],_0x45e9e6[_0x4acf('0x32')]);_0x32366b['attributes']=_['intersection'](_0x45e9e6['model'],qs['fields'](_0x517264[_0x4acf('0x32')][_0x4acf('0x35')]));_0x32366b['attributes']=_0x32366b[_0x4acf('0x36')][_0x4acf('0x37')]?_0x32366b[_0x4acf('0x36')]:_0x45e9e6['model'];if(!_0x517264[_0x4acf('0x32')]['hasOwnProperty'](_0x4acf('0x38'))){_0x32366b[_0x4acf('0x1f')]=qs[_0x4acf('0x1f')](_0x517264['query'][_0x4acf('0x1f')]);_0x32366b['offset']=qs['offset'](_0x517264[_0x4acf('0x32')][_0x4acf('0x21')]);}_0x32366b[_0x4acf('0x39')]=qs['sort'](_0x517264[_0x4acf('0x32')][_0x4acf('0x3a')]);_0x32366b[_0x4acf('0x3b')]=qs[_0x4acf('0x34')](_['pick'](_0x517264[_0x4acf('0x32')],_0x45e9e6[_0x4acf('0x34')]),_0x17325d);if(_0x517264[_0x4acf('0x32')][_0x4acf('0x3c')]){_0x32366b[_0x4acf('0x3b')]=_[_0x4acf('0x3d')](_0x32366b[_0x4acf('0x3b')],{'$or':_['map'](_0x17325d,function(_0x4ed1d1){if(_0x4ed1d1[_0x4acf('0x2f')]!=='VIRTUAL'){var _0xe42309={};_0xe42309[_0x4ed1d1['name']]={'$like':'%'+_0x517264['query'][_0x4acf('0x3c')]+'%'};return _0xe42309;}})});}_0x32366b=_[_0x4acf('0x3d')]({},_0x32366b,_0x517264[_0x4acf('0x3e')]);var _0x23212b={'where':_0x32366b['where']};return db['Attachment'][_0x4acf('0x20')](_0x23212b)[_0x4acf('0x27')](function(_0x36f948){_0x3e3115[_0x4acf('0x20')]=_0x36f948;if(_0x517264[_0x4acf('0x32')][_0x4acf('0x3f')]){_0x32366b[_0x4acf('0x40')]=[{'all':!![]}];}return db['Attachment'][_0x4acf('0x41')](_0x32366b);})[_0x4acf('0x27')](function(_0x2b1725){_0x3e3115[_0x4acf('0x42')]=_0x2b1725;return _0x3e3115;})['then'](respondWithFilteredResult(_0x390928,_0x32366b))[_0x4acf('0x43')](handleError(_0x390928,null));};exports[_0x4acf('0x44')]=function(_0x18e440,_0x403feb){var _0x12072d={'raw':!![],'where':{'id':_0x18e440[_0x4acf('0x45')]['id']}},_0x3d5c6f={};_0x3d5c6f[_0x4acf('0x30')]=_[_0x4acf('0x33')](db[_0x4acf('0x2c')][_0x4acf('0x2d')]);_0x3d5c6f[_0x4acf('0x32')]=_['keys'](_0x18e440['query']);_0x3d5c6f[_0x4acf('0x34')]=_[_0x4acf('0x46')](_0x3d5c6f[_0x4acf('0x30')],_0x3d5c6f[_0x4acf('0x32')]);_0x12072d['attributes']=_['intersection'](_0x3d5c6f['model'],qs[_0x4acf('0x35')](_0x18e440['query'][_0x4acf('0x35')]));_0x12072d['attributes']=_0x12072d[_0x4acf('0x36')][_0x4acf('0x37')]?_0x12072d[_0x4acf('0x36')]:_0x3d5c6f[_0x4acf('0x30')];if(_0x18e440[_0x4acf('0x32')][_0x4acf('0x3f')]){_0x12072d[_0x4acf('0x40')]=[{'all':!![]}];}_0x12072d=_['merge']({},_0x12072d,_0x18e440[_0x4acf('0x3e')]);return db[_0x4acf('0x2c')][_0x4acf('0x47')](_0x12072d)[_0x4acf('0x27')](handleEntityNotFound(_0x403feb,null))[_0x4acf('0x27')](respondWithResult(_0x403feb,null))[_0x4acf('0x43')](handleError(_0x403feb,null));};exports[_0x4acf('0x48')]=function(_0x138c7c,_0xc6ebec){var _0x4318bb={'where':{'id':_0x138c7c['params']['id']}},_0x1d0bdd={};_0x1d0bdd[_0x4acf('0x30')]=_[_0x4acf('0x33')](db[_0x4acf('0x2c')]['rawAttributes']);_0x4318bb[_0x4acf('0x36')]=_[_0x4acf('0x46')](_0x1d0bdd['model'],qs[_0x4acf('0x35')](_0x138c7c['query'][_0x4acf('0x35')]));_0x4318bb[_0x4acf('0x36')]=_0x4318bb[_0x4acf('0x36')][_0x4acf('0x37')]?_0x4318bb[_0x4acf('0x36')]:_0x1d0bdd[_0x4acf('0x30')];if(_0x138c7c['query']['includeAll']){_0x4318bb[_0x4acf('0x40')]=[{'all':!![]}];}_0x4318bb=_[_0x4acf('0x3d')]({},_0x4318bb,_0x138c7c[_0x4acf('0x3e')]);return db[_0x4acf('0x2c')][_0x4acf('0x47')](_0x4318bb)[_0x4acf('0x27')](handleEntityNotFound(_0xc6ebec,null))[_0x4acf('0x27')](function(_0xbeac2){if(_0xbeac2){var _0xb33f98=_0xbeac2[_0x4acf('0x49')]({'plain':!![]});_0xb33f98=qs[_0x4acf('0x4a')](_0xb33f98,['id',_0x4acf('0x4b'),'updatedAt']);_0x138c7c[_0x4acf('0x4c')]=_['omit'](_0x138c7c['body'],['id',_0x4acf('0x4b'),_0x4acf('0x4d')]);return db[_0x4acf('0x2c')][_0x4acf('0x4e')](_[_0x4acf('0x3d')](_0xb33f98,_0x138c7c['body']),{'include':_0x138c7c[_0x4acf('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x4acf('0x27')](respondWithResult(_0xc6ebec,0xc9))[_0x4acf('0x43')](handleError(_0xc6ebec,null));};exports['update']=function(_0x450359,_0x528cdc){if(_0x450359[_0x4acf('0x4c')]['id']){delete _0x450359[_0x4acf('0x4c')]['id'];}return db['Attachment'][_0x4acf('0x47')]({'where':{'id':_0x450359['params']['id']}})[_0x4acf('0x27')](handleEntityNotFound(_0x528cdc,null))['then'](saveUpdates(_0x450359[_0x4acf('0x4c')],null))['then'](respondWithResult(_0x528cdc,null))['catch'](handleError(_0x528cdc,null));};exports['destroy']=function(_0x38b8ca,_0x176d15){return db['Attachment'][_0x4acf('0x47')]({'where':{'id':_0x38b8ca[_0x4acf('0x45')]['id']}})[_0x4acf('0x27')](handleEntityNotFound(_0x176d15,null))[_0x4acf('0x27')](removeEntity(_0x176d15,null))[_0x4acf('0x43')](handleError(_0x176d15,null));};exports[_0x4acf('0x4e')]=function(_0x3bbe39,_0x2c62dd,_0xe20668){_0x3bbe39[_0x4acf('0x4c')][_0x4acf('0x31')]=_0x3bbe39[_0x4acf('0x4f')][_0x4acf('0x50')];_0x3bbe39[_0x4acf('0x4c')]['basename']=_0x3bbe39['file'][_0x4acf('0x51')];_0x3bbe39['body']['type']=_0x3bbe39[_0x4acf('0x4f')][_0x4acf('0x52')];return db[_0x4acf('0x2c')][_0x4acf('0x4e')](_0x3bbe39[_0x4acf('0x4c')])[_0x4acf('0x27')](respondWithResult(_0x2c62dd,0xc9))['catch'](handleError(_0x2c62dd,null));};exports[_0x4acf('0x53')]=function(_0x2e2ed7,_0xa9a7ba,_0x1096d8){return db[_0x4acf('0x2c')][_0x4acf('0x54')]({'where':{'id':_0x2e2ed7[_0x4acf('0x45')]['id']},'raw':!![]})[_0x4acf('0x27')](handleEntityNotFound(_0xa9a7ba,null))[_0x4acf('0x27')](function(_0xd345fe){if(_0xd345fe){var _0x591e89=_0xd345fe[_0x4acf('0x55')]!==null;var _0x48e823=path[_0x4acf('0x56')](config[_0x4acf('0x57')],_0x4acf('0x58'));if(_0x591e89){_0x48e823=path['join'](_0x48e823,_0x4acf('0x59'));}var _0x4216b6=path[_0x4acf('0x56')](_0x48e823,_0xd345fe[_0x4acf('0x5a')]);return _0xa9a7ba['download'](_0x4216b6);}})[_0x4acf('0x43')](handleError(_0xa9a7ba,null));}; \ No newline at end of file +var _0x155b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','Attachment','includeAll','rows','show','params','include','find','catch','get','omit','createdAt','updatedAt','body','create','destroy','file','originalname','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes'];(function(_0x46505f,_0x26e394){var _0x2aa7af=function(_0x26df29){while(--_0x26df29){_0x46505f['push'](_0x46505f['shift']());}};_0x2aa7af(++_0x26e394);}(_0x155b,0x12e));var _0xb155=function(_0x65efc5,_0x5d978c){_0x65efc5=_0x65efc5-0x0;var _0x4c387a=_0x155b[_0x65efc5];return _0x4c387a;};'use strict';var emlformat=require(_0xb155('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb155('0x1'));var jsonpatch=require(_0xb155('0x2'));var rp=require(_0xb155('0x3'));var moment=require(_0xb155('0x4'));var BPromise=require(_0xb155('0x5'));var Mustache=require('mustache');var util=require(_0xb155('0x6'));var path=require(_0xb155('0x7'));var sox=require(_0xb155('0x8'));var csv=require(_0xb155('0x9'));var ejs=require(_0xb155('0xa'));var fs=require('fs');var fs_extra=require(_0xb155('0xb'));var _=require('lodash');var squel=require(_0xb155('0xc'));var crypto=require(_0xb155('0xd'));var jsforce=require(_0xb155('0xe'));var deskjs=require(_0xb155('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb155('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb155('0x11'));var hardwareService=require(_0xb155('0x12'));var logger=require(_0xb155('0x13'))(_0xb155('0x14'));var utils=require(_0xb155('0x15'));var config=require(_0xb155('0x16'));var licenseUtil=require(_0xb155('0x17'));var db=require(_0xb155('0x18'))['db'];function respondWithStatusCode(_0x330eaa,_0x1367c8){_0x1367c8=_0x1367c8||0xcc;return function(_0x20cebd){if(_0x20cebd){return _0x330eaa[_0xb155('0x19')](_0x1367c8);}return _0x330eaa[_0xb155('0x1a')](_0x1367c8)[_0xb155('0x1b')]();};}function respondWithResult(_0x402ec4,_0x8fac87){_0x8fac87=_0x8fac87||0xc8;return function(_0x2fb88d){if(_0x2fb88d){return _0x402ec4[_0xb155('0x1a')](_0x8fac87)[_0xb155('0x1c')](_0x2fb88d);}};}function respondWithFilteredResult(_0x48b06d,_0x37159c){return function(_0xe119e6){if(_0xe119e6){var _0x118017=typeof _0x37159c[_0xb155('0x1d')]===_0xb155('0x1e')&&typeof _0x37159c[_0xb155('0x1f')]===_0xb155('0x1e');var _0x3e7aa6=_0xe119e6[_0xb155('0x20')];var _0x3de179=_0x118017?0x0:_0x37159c['offset'];var _0x347002=_0x118017?_0xe119e6[_0xb155('0x20')]:_0x37159c[_0xb155('0x1d')]+_0x37159c[_0xb155('0x1f')];var _0x21776c;if(_0x347002>=_0x3e7aa6){_0x347002=_0x3e7aa6;_0x21776c=0xc8;}else{_0x21776c=0xce;}_0x48b06d['status'](_0x21776c);return _0x48b06d[_0xb155('0x21')](_0xb155('0x22'),_0x3de179+'-'+_0x347002+'/'+_0x3e7aa6)['json'](_0xe119e6);}return null;};}function patchUpdates(_0xacc21b){return function(_0x41bfc8){try{jsonpatch[_0xb155('0x23')](_0x41bfc8,_0xacc21b,!![]);}catch(_0x1884c7){return BPromise['reject'](_0x1884c7);}return _0x41bfc8[_0xb155('0x24')]();};}function saveUpdates(_0x411381,_0x3a6a28){return function(_0x4184a9){if(_0x4184a9){return _0x4184a9[_0xb155('0x25')](_0x411381)[_0xb155('0x26')](function(_0x179813){return _0x179813;});}return null;};}function removeEntity(_0x18d27c,_0x188ef7){return function(_0x5d334c){if(_0x5d334c){return _0x5d334c['destroy']()['then'](function(){_0x18d27c[_0xb155('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7898d8,_0x52609e){return function(_0x41d68c){if(!_0x41d68c){_0x7898d8[_0xb155('0x19')](0x194);}return _0x41d68c;};}function handleError(_0x3b7112,_0x4dfbb2){_0x4dfbb2=_0x4dfbb2||0x1f4;return function(_0x1d9ba0){logger[_0xb155('0x27')](_0x1d9ba0[_0xb155('0x28')]);if(_0x1d9ba0['name']){delete _0x1d9ba0[_0xb155('0x29')];}_0x3b7112[_0xb155('0x1a')](_0x4dfbb2)[_0xb155('0x2a')](_0x1d9ba0);};}exports[_0xb155('0x2b')]=function(_0x5f3ca2,_0x3854a6){var _0x4a85a5={},_0x4c1c76={},_0x57b299={'count':0x0,'rows':[]};var _0x3e84b1=_[_0xb155('0x2c')](db['Attachment'][_0xb155('0x2d')],function(_0xbb61c5){return{'name':_0xbb61c5[_0xb155('0x2e')],'type':_0xbb61c5[_0xb155('0x2f')][_0xb155('0x30')]};});_0x4c1c76[_0xb155('0x31')]=_['map'](_0x3e84b1,'name');_0x4c1c76[_0xb155('0x32')]=_[_0xb155('0x33')](_0x5f3ca2[_0xb155('0x32')]);_0x4c1c76[_0xb155('0x34')]=_[_0xb155('0x35')](_0x4c1c76[_0xb155('0x31')],_0x4c1c76[_0xb155('0x32')]);_0x4a85a5[_0xb155('0x36')]=_[_0xb155('0x35')](_0x4c1c76['model'],qs[_0xb155('0x37')](_0x5f3ca2[_0xb155('0x32')]['fields']));_0x4a85a5[_0xb155('0x36')]=_0x4a85a5[_0xb155('0x36')][_0xb155('0x38')]?_0x4a85a5[_0xb155('0x36')]:_0x4c1c76[_0xb155('0x31')];if(!_0x5f3ca2[_0xb155('0x32')]['hasOwnProperty'](_0xb155('0x39'))){_0x4a85a5[_0xb155('0x1f')]=qs[_0xb155('0x1f')](_0x5f3ca2[_0xb155('0x32')]['limit']);_0x4a85a5['offset']=qs[_0xb155('0x1d')](_0x5f3ca2[_0xb155('0x32')][_0xb155('0x1d')]);}_0x4a85a5['order']=qs[_0xb155('0x3a')](_0x5f3ca2[_0xb155('0x32')][_0xb155('0x3a')]);_0x4a85a5[_0xb155('0x3b')]=qs[_0xb155('0x34')](_['pick'](_0x5f3ca2[_0xb155('0x32')],_0x4c1c76[_0xb155('0x34')]),_0x3e84b1);if(_0x5f3ca2[_0xb155('0x32')][_0xb155('0x3c')]){_0x4a85a5[_0xb155('0x3b')]=_['merge'](_0x4a85a5[_0xb155('0x3b')],{'$or':_['map'](_0x3e84b1,function(_0x1bee29){if(_0x1bee29['type']!=='VIRTUAL'){var _0x4c08a4={};_0x4c08a4[_0x1bee29[_0xb155('0x29')]]={'$like':'%'+_0x5f3ca2[_0xb155('0x32')][_0xb155('0x3c')]+'%'};return _0x4c08a4;}})});}_0x4a85a5=_[_0xb155('0x3d')]({},_0x4a85a5,_0x5f3ca2[_0xb155('0x3e')]);var _0x2f820a={'where':_0x4a85a5['where']};return db[_0xb155('0x3f')][_0xb155('0x20')](_0x2f820a)[_0xb155('0x26')](function(_0x190757){_0x57b299['count']=_0x190757;if(_0x5f3ca2['query'][_0xb155('0x40')]){_0x4a85a5['include']=[{'all':!![]}];}return db[_0xb155('0x3f')]['findAll'](_0x4a85a5);})['then'](function(_0x27b842){_0x57b299[_0xb155('0x41')]=_0x27b842;return _0x57b299;})['then'](respondWithFilteredResult(_0x3854a6,_0x4a85a5))['catch'](handleError(_0x3854a6,null));};exports[_0xb155('0x42')]=function(_0x56e636,_0x347ce7){var _0x363cce={'raw':!![],'where':{'id':_0x56e636[_0xb155('0x43')]['id']}},_0x4562aa={};_0x4562aa[_0xb155('0x31')]=_[_0xb155('0x33')](db['Attachment']['rawAttributes']);_0x4562aa[_0xb155('0x32')]=_['keys'](_0x56e636[_0xb155('0x32')]);_0x4562aa[_0xb155('0x34')]=_[_0xb155('0x35')](_0x4562aa[_0xb155('0x31')],_0x4562aa[_0xb155('0x32')]);_0x363cce[_0xb155('0x36')]=_[_0xb155('0x35')](_0x4562aa[_0xb155('0x31')],qs[_0xb155('0x37')](_0x56e636[_0xb155('0x32')]['fields']));_0x363cce['attributes']=_0x363cce[_0xb155('0x36')]['length']?_0x363cce[_0xb155('0x36')]:_0x4562aa['model'];if(_0x56e636[_0xb155('0x32')][_0xb155('0x40')]){_0x363cce[_0xb155('0x44')]=[{'all':!![]}];}_0x363cce=_['merge']({},_0x363cce,_0x56e636[_0xb155('0x3e')]);return db[_0xb155('0x3f')][_0xb155('0x45')](_0x363cce)[_0xb155('0x26')](handleEntityNotFound(_0x347ce7,null))[_0xb155('0x26')](respondWithResult(_0x347ce7,null))[_0xb155('0x46')](handleError(_0x347ce7,null));};exports['clone']=function(_0x326bad,_0x2cabe4){var _0x28dfaa={'where':{'id':_0x326bad[_0xb155('0x43')]['id']}},_0xf84c88={};_0xf84c88[_0xb155('0x31')]=_[_0xb155('0x33')](db['Attachment']['rawAttributes']);_0x28dfaa[_0xb155('0x36')]=_['intersection'](_0xf84c88[_0xb155('0x31')],qs[_0xb155('0x37')](_0x326bad[_0xb155('0x32')][_0xb155('0x37')]));_0x28dfaa[_0xb155('0x36')]=_0x28dfaa['attributes'][_0xb155('0x38')]?_0x28dfaa[_0xb155('0x36')]:_0xf84c88[_0xb155('0x31')];if(_0x326bad['query'][_0xb155('0x40')]){_0x28dfaa[_0xb155('0x44')]=[{'all':!![]}];}_0x28dfaa=_[_0xb155('0x3d')]({},_0x28dfaa,_0x326bad[_0xb155('0x3e')]);return db[_0xb155('0x3f')][_0xb155('0x45')](_0x28dfaa)[_0xb155('0x26')](handleEntityNotFound(_0x2cabe4,null))['then'](function(_0xf04ab1){if(_0xf04ab1){var _0x45af67=_0xf04ab1[_0xb155('0x47')]({'plain':!![]});_0x45af67=qs[_0xb155('0x48')](_0x45af67,['id',_0xb155('0x49'),_0xb155('0x4a')]);_0x326bad['body']=_['omit'](_0x326bad[_0xb155('0x4b')],['id',_0xb155('0x49'),'updatedAt']);return db[_0xb155('0x3f')][_0xb155('0x4c')](_['merge'](_0x45af67,_0x326bad[_0xb155('0x4b')]),{'include':_0x326bad[_0xb155('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xb155('0x26')](respondWithResult(_0x2cabe4,0xc9))['catch'](handleError(_0x2cabe4,null));};exports['update']=function(_0x3dba6a,_0x3faa2b){if(_0x3dba6a[_0xb155('0x4b')]['id']){delete _0x3dba6a[_0xb155('0x4b')]['id'];}return db[_0xb155('0x3f')]['find']({'where':{'id':_0x3dba6a[_0xb155('0x43')]['id']}})[_0xb155('0x26')](handleEntityNotFound(_0x3faa2b,null))[_0xb155('0x26')](saveUpdates(_0x3dba6a[_0xb155('0x4b')],null))[_0xb155('0x26')](respondWithResult(_0x3faa2b,null))[_0xb155('0x46')](handleError(_0x3faa2b,null));};exports[_0xb155('0x4d')]=function(_0x48a383,_0x4b464f){return db['Attachment'][_0xb155('0x45')]({'where':{'id':_0x48a383['params']['id']}})[_0xb155('0x26')](handleEntityNotFound(_0x4b464f,null))[_0xb155('0x26')](removeEntity(_0x4b464f,null))['catch'](handleError(_0x4b464f,null));};exports[_0xb155('0x4c')]=function(_0x3b6cca,_0x11b487,_0x139385){_0x3b6cca[_0xb155('0x4b')][_0xb155('0x29')]=_0x3b6cca[_0xb155('0x4e')][_0xb155('0x4f')];_0x3b6cca[_0xb155('0x4b')]['basename']=_0x3b6cca['file']['filename'];_0x3b6cca['body'][_0xb155('0x2f')]=_0x3b6cca['file']['mimetype'];return db[_0xb155('0x3f')]['create'](_0x3b6cca[_0xb155('0x4b')])['then'](respondWithResult(_0x11b487,0xc9))[_0xb155('0x46')](handleError(_0x11b487,null));};exports[_0xb155('0x50')]=function(_0x378b55,_0x5cbf16,_0x2ca952){return db[_0xb155('0x3f')][_0xb155('0x51')]({'where':{'id':_0x378b55['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5cbf16,null))[_0xb155('0x26')](function(_0x5d9726){if(_0x5d9726){var _0x4b842d=_0x5d9726[_0xb155('0x52')]!==null;var _0x3a5d1c=path[_0xb155('0x53')](config['root'],_0xb155('0x54'));if(_0x4b842d){_0x3a5d1c=path[_0xb155('0x53')](_0x3a5d1c,_0xb155('0x55'));}var _0x1528f5=path['join'](_0x3a5d1c,_0x5d9726[_0xb155('0x56')]);return _0x5cbf16[_0xb155('0x50')](_0x1528f5);}})['catch'](handleError(_0x5cbf16,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3decb4c..5c750e0 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 _0xc832=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash'];(function(_0x239a3d,_0xc087f4){var _0x1a43de=function(_0x2b2391){while(--_0x2b2391){_0x239a3d['push'](_0x239a3d['shift']());}};_0x1a43de(++_0xc087f4);}(_0xc832,0xf6));var _0x2c83=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xc832[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x2c83('0x0'));var util=require(_0x2c83('0x1'));var logger=require(_0x2c83('0x2'))(_0x2c83('0x3'));var moment=require('moment');var BPromise=require(_0x2c83('0x4'));var rp=require(_0x2c83('0x5'));var fs=require('fs');var path=require(_0x2c83('0x6'));var rimraf=require(_0x2c83('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c83('0x8'));module[_0x2c83('0x9')]=function(_0x44fefc,_0x424a78){return _0x44fefc[_0x2c83('0xa')](_0x2c83('0xb'),attributes,{'tableName':_0x2c83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0095=['./attachment.attributes','define','attachments','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0xe1a01b,_0x2657f7){var _0x2559b1=function(_0x304d72){while(--_0x304d72){_0xe1a01b['push'](_0xe1a01b['shift']());}};_0x2559b1(++_0x2657f7);}(_0x0095,0xf3));var _0x5009=function(_0x1f46c0,_0x1148b0){_0x1f46c0=_0x1f46c0-0x0;var _0x34d79d=_0x0095[_0x1f46c0];return _0x34d79d;};'use strict';var _=require(_0x5009('0x0'));var util=require(_0x5009('0x1'));var logger=require(_0x5009('0x2'))(_0x5009('0x3'));var moment=require('moment');var BPromise=require(_0x5009('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5009('0x5'));var rimraf=require('rimraf');var config=require(_0x5009('0x6'));var attributes=require(_0x5009('0x7'));module['exports']=function(_0x435cef,_0xd44a7a){return _0x435cef[_0x5009('0x8')]('Attachment',attributes,{'tableName':_0x5009('0x9'),'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 618b947..3e47a2d 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 _0x559a=['request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x5207d6,_0x2eb625){var _0x2c7443=function(_0x3201d2){while(--_0x3201d2){_0x5207d6['push'](_0x5207d6['shift']());}};_0x2c7443(++_0x2eb625);}(_0x559a,0xb3));var _0xa559=function(_0x1b3381,_0x568e87){_0x1b3381=_0x1b3381-0x0;var _0x114fec=_0x559a[_0x1b3381];return _0x114fec;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require('moment');var BPromise=require(_0xa559('0x2'));var rs=require(_0xa559('0x3'));var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require(_0xa559('0x6'));var logger=require(_0xa559('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa559('0x8'));var client=jayson[_0xa559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edab4,_0x1a5cec,_0x4eada1){return new BPromise(function(_0xb8055,_0x218e3b){return client[_0xa559('0xa')](_0x2edab4,_0x4eada1)[_0xa559('0xb')](function(_0x48aa9a){logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,_0xa559('0xe'));logger[_0xa559('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1a5cec,'request\x20sent',JSON[_0xa559('0x10')](_0x48aa9a));if(_0x48aa9a[_0xa559('0x11')]){if(_0x48aa9a['error'][_0xa559('0x12')]===0x1f4){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a['error'][_0xa559('0x13')]);return _0x218e3b(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a[_0xa559('0x11')]['message']);return _0xb8055(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}else{logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,'request\x20sent');_0xb8055(_0x48aa9a[_0xa559('0x14')]['message']);}})[_0xa559('0x15')](function(_0x1387b6){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x1387b6);_0x218e3b(_0x1387b6);});});}exports[_0xa559('0x16')]=function(_0x163405){var _0xd21ebf=this;return new Promise(function(_0x1a4c42,_0x16f090){return db[_0xa559('0x17')][_0xa559('0x18')](_0x163405[_0xa559('0x19')],{'raw':_0x163405[_0xa559('0x1a')]?_0x163405['options']['raw']===undefined?!![]:![]:!![]})[_0xa559('0xb')](function(_0x3aa532){logger['info'](_0xa559('0x16'),_0x163405);logger[_0xa559('0xf')](_0xa559('0x16'),_0x163405,JSON[_0xa559('0x10')](_0x3aa532));_0x1a4c42(_0x3aa532);})[_0xa559('0x15')](function(_0x2dd8cf){logger['error'](_0xa559('0x16'),_0x2dd8cf['message'],_0x163405);_0x16f090(_0xd21ebf[_0xa559('0x11')](0x1f4,_0x2dd8cf[_0xa559('0x13')]));});});}; \ No newline at end of file +var _0x131e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','Attachment,\x20%s,\x20%s','catch','Attachment','create','options','raw','CreateAttachment','bluebird','randomstring'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x131e,0x1ec));var _0xe131=function(_0x3da04d,_0x1594e0){_0x3da04d=_0x3da04d-0x0;var _0x1f062c=_0x131e[_0x3da04d];return _0x1f062c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('Attachment,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('Attachment,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});}exports['CreateAttachment']=function(_0x400f6b){var _0x2e2bf8=this;return new Promise(function(_0x3bbca8,_0x1a1e03){return db[_0xe131('0x15')][_0xe131('0x16')](_0x400f6b['body'],{'raw':_0x400f6b[_0xe131('0x17')]?_0x400f6b[_0xe131('0x17')][_0xe131('0x18')]===undefined?!![]:![]:!![]})[_0xe131('0xb')](function(_0x2d6c6b){logger['info']('CreateAttachment',_0x400f6b);logger[_0xe131('0xe')](_0xe131('0x19'),_0x400f6b,JSON['stringify'](_0x2d6c6b));_0x3bbca8(_0x2d6c6b);})[_0xe131('0x14')](function(_0x55b0c5){logger['error'](_0xe131('0x19'),_0x55b0c5[_0xe131('0x12')],_0x400f6b);_0x1a1e03(_0x2e2bf8[_0xe131('0x11')](0x1f4,_0x55b0c5[_0xe131('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 29d2f95..24aae88 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x2bd6c9,_0x36a113){var _0x147850=function(_0x5b729a){while(--_0x5b729a){_0x2bd6c9['push'](_0x2bd6c9['shift']());}};_0x147850(++_0x36a113);}(_0xadb5,0xad));var _0x5adb=function(_0x575f66,_0x4d744c){_0x575f66=_0x575f66-0x0;var _0x2db7a5=_0xadb5[_0x575f66];return _0x2db7a5;};'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('./attachment.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('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=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(_0x3e1e5f,_0x3bd21b){var _0x5cddc3=function(_0x311318){while(--_0x311318){_0x3e1e5f['push'](_0x3e1e5f['shift']());}};_0x5cddc3(++_0x3bd21b);}(_0xb10b,0x12a));var _0xbb10=function(_0x1026d2,_0x42fe66){_0x1026d2=_0x1026d2-0x0;var _0x4a6773=_0xb10b[_0x1026d2];return _0x4a6773;};'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/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 58819e9..bc8f75e 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc20=['admin','user','agent','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','json','passport','passport-local','moment','activedirectory2','util','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online'];(function(_0x360e5c,_0x1d60de){var _0x3629ea=function(_0x3f12b6){while(--_0x3f12b6){_0x360e5c['push'](_0x360e5c['shift']());}};_0x3629ea(++_0x1d60de);}(_0xcc20,0x114));var _0x0cc2=function(_0x18d9cb,_0x4df904){_0x18d9cb=_0x18d9cb-0x0;var _0x5ba26d=_0xcc20[_0x18d9cb];return _0x5ba26d;};'use strict';var passport=require(_0x0cc2('0x0'));var LocalStrategy=require(_0x0cc2('0x1'))['Strategy'];var moment=require(_0x0cc2('0x2'));var ActiveDirectory=require(_0x0cc2('0x3'));var BPromise=require('bluebird');var util=require(_0x0cc2('0x4'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x0cc2('0x5'));var config=require(_0x0cc2('0x6'));var logger=require(_0x0cc2('0x7'))('api');function isActiveDirectoryConfigured(_0x390b91){var _0x169d72=![];if(typeof _0x390b91['activedirectory']!==_0x0cc2('0x8')){_0x169d72=_0x390b91[_0x0cc2('0x9')][_0x0cc2('0xa')]&&_0x390b91[_0x0cc2('0x9')][_0x0cc2('0xb')]&&_0x390b91[_0x0cc2('0x9')]['domain'];}return _0x169d72;}function adAuthenticate(_0x30a25c,_0x2d91c8,_0x4977eb){return new BPromise(function(_0x3d705c,_0x52fcf2){try{var _0x230fb1=new ActiveDirectory(_0x30a25c);_0x230fb1[_0x0cc2('0xc')](_0x2d91c8,_0x4977eb,function(_0x1ba5a8,_0x16575d){if(_0x1ba5a8){logger[_0x0cc2('0xd')](_0x0cc2('0xe'),_0x2d91c8,util[_0x0cc2('0xf')](_0x1ba5a8,{'showHidden':![],'depth':null}));_0x52fcf2(_0x0cc2('0x10'));}else if(!_0x16575d){logger[_0x0cc2('0xd')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2d91c8);_0x52fcf2('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3d705c(_0x16575d);}});}catch(_0x50c282){_0x52fcf2(_0x50c282);}});}function ActiveDirectoryAuthenticate(_0x26a506,_0x39fb38,_0x3e2e5e,_0x5b0869){var _0x151644,_0x29b1fd;if(!isActiveDirectoryConfigured(config)){logger[_0x0cc2('0xd')](_0x0cc2('0x11'),_0x39fb38);return _0x5b0869(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0cc2('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0x0cc2('0x13'),_0x0cc2('0x14')],'raw':!![]})[_0x0cc2('0x15')](function(_0x48522a){_0x151644=_0x48522a;if(!_0x151644['adSsoEnabled']){logger[_0x0cc2('0xd')](_0x0cc2('0x16'),_0x39fb38);throw new Error(_0x0cc2('0x10'));}return _0x26a506[_0x0cc2('0x17')]({'attributes':['id',_0x0cc2('0x18'),_0x0cc2('0x19'),_0x0cc2('0x1a'),_0x0cc2('0x1b'),_0x0cc2('0x1c'),_0x0cc2('0x1d'),_0x0cc2('0x1e'),_0x0cc2('0x1f')],'where':{'name':_0x39fb38,'role':{'$or':[_0x0cc2('0x20'),_0x0cc2('0x21'),_0x0cc2('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0x3aefc5){if(!_0x3aefc5||_0x3aefc5&&_0x3aefc5[_0x0cc2('0x18')]!==_0x39fb38){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x29b1fd=_0x3aefc5;var _0x398f8c=_0x29b1fd[_0x0cc2('0x18')]+'@'+config[_0x0cc2('0x9')]['domain'];return adAuthenticate(config['activedirectory'],_0x398f8c,_0x3e2e5e);})[_0x0cc2('0x15')](function(_0x4ef0ee){if(_0x29b1fd[_0x0cc2('0x1c')]){throw new Error(_0x0cc2('0x10'));}if(_0x151644['blockDuration']>0x0){if(_0x29b1fd[_0x0cc2('0x1d')]){if(moment(_0x29b1fd['blockedAt'])['add'](_0x151644[_0x0cc2('0x14')],_0x0cc2('0x23'))>moment()){throw new Error(_0x0cc2('0x10'));}return utils[_0x0cc2('0x24')](_0x29b1fd,0x0,![],null)[_0x0cc2('0x15')](function(){return utils[_0x0cc2('0x25')](_0x29b1fd);})[_0x0cc2('0x15')](function(){return _0x5b0869(null,_0x29b1fd);});}else{return utils['getLicense'](_0x29b1fd)[_0x0cc2('0x15')](function(){return _0x5b0869(null,_0x29b1fd);});}}else{return utils[_0x0cc2('0x25')](_0x29b1fd)['then'](function(){return _0x5b0869(null,_0x29b1fd);});}})[_0x0cc2('0x26')](function(_0x5414e5){return _0x5b0869(null,![],_0x5414e5);});}function handleError(_0x3996d4,_0x3c8adb,_0x2f7b92){return _0x3996d4[_0x0cc2('0x27')](_0x3c8adb||0x1f4)['send']({'message':_0x2f7b92?_0x2f7b92[_0x0cc2('0x28')]||_0x2f7b92:''});}exports[_0x0cc2('0x29')]=function(_0x499174,_0x57de66,_0x52dfbf){passport[_0x0cc2('0xc')](_0x0cc2('0x2a'),function(_0x204490,_0x47e8e3,_0x34c28c){var _0x4a4311=_0x204490||_0x34c28c;if(_0x4a4311){return handleError(_0x57de66,0x191,_0x4a4311);}if(!_0x47e8e3){return handleError(_0x57de66,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2ef2cd={'payload':{'id':_0x47e8e3['id'],'role':_0x47e8e3[_0x0cc2('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2ef2cd)['then'](function(_0x27b49c){_0x57de66[_0x0cc2('0x2b')]({'id':_0x47e8e3['id'],'token':_0x27b49c,'statusCall':'','isAlreadyLogged':_0x47e8e3[_0x0cc2('0x1f')]});});}})(_0x499174,_0x57de66,_0x52dfbf);};passport['use'](_0x0cc2('0x2a'),new LocalStrategy({'usernameField':'name','passwordField':_0x0cc2('0x19')},function(_0x17238e,_0x5c7efb,_0x26757c){return ActiveDirectoryAuthenticate(db['User'],_0x17238e,_0x5c7efb,_0x26757c);})); \ No newline at end of file +var _0x85a7=['domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','online','admin','disabled','add','clearBlockUser','getLicense','catch','status','send','message','ad-login','signToken','json','use','passport','passport-local','Strategy','moment','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','baseDN','url'];(function(_0x13d580,_0x53a187){var _0x5e124b=function(_0x5abc88){while(--_0x5abc88){_0x13d580['push'](_0x13d580['shift']());}};_0x5e124b(++_0x53a187);}(_0x85a7,0xa7));var _0x785a=function(_0x1040d1,_0x432965){_0x1040d1=_0x1040d1-0x0;var _0x25607d=_0x85a7[_0x1040d1];return _0x25607d;};'use strict';var passport=require(_0x785a('0x0'));var LocalStrategy=require(_0x785a('0x1'))[_0x785a('0x2')];var moment=require(_0x785a('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x785a('0x4'));var util=require(_0x785a('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x785a('0x6'));var utils=require(_0x785a('0x7'));var config=require(_0x785a('0x8'));var logger=require('../../config/logger')(_0x785a('0x9'));function isActiveDirectoryConfigured(_0x2547d1){var _0xcf33a6=![];if(typeof _0x2547d1[_0x785a('0xa')]!=='undefined'){_0xcf33a6=_0x2547d1[_0x785a('0xa')][_0x785a('0xb')]&&_0x2547d1['activedirectory'][_0x785a('0xc')]&&_0x2547d1[_0x785a('0xa')][_0x785a('0xd')];}return _0xcf33a6;}function adAuthenticate(_0x5af56b,_0x3c6111,_0x1d9350){return new BPromise(function(_0x143a0e,_0x3cf9da){try{var _0x5a0a6f=new ActiveDirectory(_0x5af56b);_0x5a0a6f[_0x785a('0xe')](_0x3c6111,_0x1d9350,function(_0x5016ac,_0x42356e){if(_0x5016ac){logger[_0x785a('0xf')]('Error\x20authenticate\x20%s:\x20%s',_0x3c6111,util[_0x785a('0x10')](_0x5016ac,{'showHidden':![],'depth':null}));_0x3cf9da(_0x785a('0x11'));}else if(!_0x42356e){logger[_0x785a('0xf')](_0x785a('0x12'),_0x3c6111);_0x3cf9da(_0x785a('0x11'));}else{_0x143a0e(_0x42356e);}});}catch(_0x88751f){_0x3cf9da(_0x88751f);}});}function ActiveDirectoryAuthenticate(_0x36dfc3,_0x39032c,_0x429d4b,_0xaab5b3){var _0x3fdf8f,_0x7c298c;if(!isActiveDirectoryConfigured(config)){logger[_0x785a('0xf')](_0x785a('0x13'),_0x39032c);return _0xaab5b3(null,![],{'message':_0x785a('0x11')});}return db['Setting'][_0x785a('0x14')]({'where':{'id':0x1},'attributes':[_0x785a('0x15'),_0x785a('0x16')],'raw':!![]})[_0x785a('0x17')](function(_0x1ac834){_0x3fdf8f=_0x1ac834;if(!_0x3fdf8f[_0x785a('0x15')]){logger[_0x785a('0xf')](_0x785a('0x18'),_0x39032c);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x36dfc3[_0x785a('0x14')]({'attributes':['id',_0x785a('0x19'),_0x785a('0x1a'),_0x785a('0x1b'),_0x785a('0x1c'),'disabled',_0x785a('0x1d'),_0x785a('0x1e'),_0x785a('0x1f')],'where':{'name':_0x39032c,'role':{'$or':[_0x785a('0x20'),'user','agent']},'adSsoEnabled':!![]}});})[_0x785a('0x17')](function(_0x3161f7){if(!_0x3161f7||_0x3161f7&&_0x3161f7[_0x785a('0x19')]!==_0x39032c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x7c298c=_0x3161f7;var _0x4aa5bb=_0x7c298c[_0x785a('0x19')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x785a('0xa')],_0x4aa5bb,_0x429d4b);})[_0x785a('0x17')](function(_0x5c6005){if(_0x7c298c[_0x785a('0x21')]){throw new Error(_0x785a('0x11'));}if(_0x3fdf8f[_0x785a('0x16')]>0x0){if(_0x7c298c[_0x785a('0x1d')]){if(moment(_0x7c298c[_0x785a('0x1e')])[_0x785a('0x22')](_0x3fdf8f[_0x785a('0x16')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x785a('0x23')](_0x7c298c,0x0,![],null)[_0x785a('0x17')](function(){return utils[_0x785a('0x24')](_0x7c298c);})[_0x785a('0x17')](function(){return _0xaab5b3(null,_0x7c298c);});}else{return utils['getLicense'](_0x7c298c)[_0x785a('0x17')](function(){return _0xaab5b3(null,_0x7c298c);});}}else{return utils['getLicense'](_0x7c298c)[_0x785a('0x17')](function(){return _0xaab5b3(null,_0x7c298c);});}})[_0x785a('0x25')](function(_0x29284c){return _0xaab5b3(null,![],_0x29284c);});}function handleError(_0x574238,_0x31f74b,_0x51c36d){return _0x574238[_0x785a('0x26')](_0x31f74b||0x1f4)[_0x785a('0x27')]({'message':_0x51c36d?_0x51c36d[_0x785a('0x28')]||_0x51c36d:''});}exports['login']=function(_0x333df1,_0x2c6b14,_0xee3958){passport[_0x785a('0xe')](_0x785a('0x29'),function(_0x2e9e51,_0x9cf079,_0x14ce32){var _0x334a40=_0x2e9e51||_0x14ce32;if(_0x334a40){return handleError(_0x2c6b14,0x191,_0x334a40);}if(!_0x9cf079){return handleError(_0x2c6b14,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4f9666={'payload':{'id':_0x9cf079['id'],'role':_0x9cf079[_0x785a('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x785a('0x2a')](_0x4f9666)['then'](function(_0x18cdb1){_0x2c6b14[_0x785a('0x2b')]({'id':_0x9cf079['id'],'token':_0x18cdb1,'statusCall':'','isAlreadyLogged':_0x9cf079[_0x785a('0x1f')]});});}})(_0x333df1,_0x2c6b14,_0xee3958);};passport[_0x785a('0x2c')](_0x785a('0x29'),new LocalStrategy({'usernameField':_0x785a('0x19'),'passwordField':_0x785a('0x1a')},function(_0xfbe339,_0x2cdecb,_0x503a6c){return ActiveDirectoryAuthenticate(db['User'],_0xfbe339,_0x2cdecb,_0x503a6c);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index b11b2f4..2583bad 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x238b=['exports','express','Router','login'];(function(_0x1b4155,_0x2396c9){var _0x106480=function(_0x5769bc){while(--_0x5769bc){_0x1b4155['push'](_0x1b4155['shift']());}};_0x106480(++_0x2396c9);}(_0x238b,0xd1));var _0xb238=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x238b[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0xb238('0x0'));var router=express[_0xb238('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xb238('0x2')]);module[_0xb238('0x3')]=router; \ No newline at end of file +var _0xd5ad=['exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x28f0cf,_0x460cda){var _0x5bac1f=function(_0x70e0b8){while(--_0x70e0b8){_0x28f0cf['push'](_0x28f0cf['shift']());}};_0x5bac1f(++_0x460cda);}(_0xd5ad,0x18c));var _0xdd5a=function(_0x1ce859,_0x2ae1f1){_0x1ce859=_0x1ce859-0x0;var _0x5b2df0=_0xd5ad[_0x1ce859];return _0x5b2df0;};'use strict';var express=require(_0xdd5a('0x0'));var router=express[_0xdd5a('0x1')]();var controller=require(_0xdd5a('0x2'));router[_0xdd5a('0x3')]('/',controller['login']);module[_0xdd5a('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index cd037c4..6050f1b 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x7a54,0x106));var _0x47a5=function(_0x11b9ff,_0x4ea87e){_0x11b9ff=_0x11b9ff-0x0;var _0x436e8d=_0x7a54[_0x11b9ff];return _0x436e8d;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x7a54,0x106));var _0x47a5=function(_0xce52a9,_0x41cedd){_0xce52a9=_0xce52a9-0x0;var _0x32bd2b=_0x7a54[_0xce52a9];return _0x32bd2b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 986f749..55bc81e 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 _0xc42d=['callback','setTokenCookie','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x36f56b,_0x4f7224){var _0x34fe0d=function(_0x3dcf3c){while(--_0x3dcf3c){_0x36f56b['push'](_0x36f56b['shift']());}};_0x34fe0d(++_0x4f7224);}(_0xc42d,0x1dc));var _0xdc42=function(_0x34ddd4,_0x143395){_0x34ddd4=_0x34ddd4-0x0;var _0x82e9a9=_0xc42d[_0x34ddd4];return _0x82e9a9;};'use strict';var express=require(_0xdc42('0x0'));var passport=require(_0xdc42('0x1'));var router=express[_0xdc42('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xdc42('0x3'));var authService=require(_0xdc42('0x4'));router[_0xdc42('0x5')]('/',controller[_0xdc42('0x6')]);router['get'](_0xdc42('0x7'),controller[_0xdc42('0x8')],authService['isMiddleware'],userController[_0xdc42('0x6')],authService[_0xdc42('0x9')]);module[_0xdc42('0xa')]=router; \ No newline at end of file +var _0xa220=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','exports','passport'];(function(_0x5036fe,_0x188b6f){var _0x5a76d9=function(_0x3fdd77){while(--_0x3fdd77){_0x5036fe['push'](_0x5036fe['shift']());}};_0x5a76d9(++_0x188b6f);}(_0xa220,0x167));var _0x0a22=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa220[_0x42cae2];return _0x5f256f;};'use strict';var express=require('express');var passport=require(_0x0a22('0x0'));var router=express['Router']();var controller=require(_0x0a22('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x0a22('0x2'));router[_0x0a22('0x3')]('/',controller[_0x0a22('0x4')]);router[_0x0a22('0x3')](_0x0a22('0x5'),controller[_0x0a22('0x6')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0x0a22('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6742e61..2da515b 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 _0x2c33=['client','Setting','findOne','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','allowedLoginAttempts','blockDuration','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','body','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','randomstring','moment','../../config/utils'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x2c33,0xef));var _0x32c3=function(_0x4abed2,_0x567260){_0x4abed2=_0x4abed2-0x0;var _0x5c6928=_0x2c33[_0x4abed2];return _0x5c6928;};'use strict';var util=require(_0x32c3('0x0'));var passport=require('passport');var LocalStrategy=require(_0x32c3('0x1'))['Strategy'];var jayson=require(_0x32c3('0x2'));var _=require(_0x32c3('0x3'));var rs=require(_0x32c3('0x4'));var moment=require(_0x32c3('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x32c3('0x6'));var client=jayson[_0x32c3('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x1431a2,_0x3f6196,_0x146e60,_0x23d2e4){var _0x358fab,_0x2b3a40;return db[_0x32c3('0x8')][_0x32c3('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x32c3('0xa')](function(_0x43787c){_0x358fab=_0x43787c;return _0x1431a2[_0x32c3('0x9')]({'attributes':['id',_0x32c3('0xb'),_0x32c3('0xc'),_0x32c3('0xd'),_0x32c3('0xe'),'disabled',_0x32c3('0xf'),_0x32c3('0x10'),_0x32c3('0x11')],'where':{'name':_0x3f6196,'role':{'$or':[_0x32c3('0x12'),_0x32c3('0x13'),'agent']}}});})[_0x32c3('0xa')](function(_0x1e8109){if(!_0x1e8109||_0x1e8109&&_0x1e8109['name']!==_0x3f6196){throw new Error(_0x32c3('0x14'));}else{_0x2b3a40=_0x1e8109;return _0x2b3a40;}})[_0x32c3('0xa')](function(){_0x2b3a40[_0x32c3('0x15')](_0x146e60,function(_0x520656,_0x17fcd0){var _0x5f0a82=_0x2b3a40[_0x32c3('0x11')]+0x1;if(_0x520656){return _0x23d2e4(_0x520656);}else if(!_0x17fcd0){if(_0x2b3a40['disabled']){return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});}else if(_0x358fab['allowedLoginAttempts']>0x0){if(_0x2b3a40[_0x32c3('0xf')]){if(_0x358fab['blockDuration']>0x0){if(moment(_0x2b3a40[_0x32c3('0x10')])['add'](_0x358fab['blockDuration'],_0x32c3('0x16'))>moment()){return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});}else{return utils[_0x32c3('0x17')](_0x2b3a40,_0x5f0a82,![],null)[_0x32c3('0xa')](function(){return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});});}}else{return _0x23d2e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5f0a82>=_0x358fab['allowedLoginAttempts']){return utils[_0x32c3('0x17')](_0x2b3a40,0x0,!![],moment())[_0x32c3('0xa')](function(){return _0x23d2e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x32c3('0x17')](_0x2b3a40,_0x5f0a82,![],null)[_0x32c3('0xa')](function(){return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});});}}}else{return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});}}else{if(_0x2b3a40['disabled']){return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});}else if(_0x358fab[_0x32c3('0x18')]>0x0){if(_0x2b3a40[_0x32c3('0xf')]){if(_0x358fab[_0x32c3('0x19')]>0x0){if(moment(_0x2b3a40[_0x32c3('0x10')])['add'](_0x358fab[_0x32c3('0x19')],_0x32c3('0x16'))>moment()){return _0x23d2e4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2b3a40,0x0,![],null)['then'](function(){return utils[_0x32c3('0x1a')](_0x2b3a40);})[_0x32c3('0xa')](function(){return _0x23d2e4(null,_0x2b3a40);});}}else{return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});}}else{return utils[_0x32c3('0x17')](_0x2b3a40,0x0,![],null)[_0x32c3('0xa')](function(){return utils[_0x32c3('0x1a')](_0x2b3a40);})[_0x32c3('0xa')](function(){return _0x23d2e4(null,_0x2b3a40);})['catch'](function(_0x33504b){return _0x23d2e4(null,![],_0x33504b);});}}else{if(_0x2b3a40[_0x32c3('0xf')]){return _0x23d2e4(null,![],{'message':_0x32c3('0x14')});}else{return utils[_0x32c3('0x1a')](_0x2b3a40)[_0x32c3('0xa')](function(){return _0x23d2e4(null,_0x2b3a40);});}}}});})[_0x32c3('0x1b')](function(_0x40d958){return _0x23d2e4(null,![],_0x40d958);});}function sendServiceMail(_0x4ff120){return db[_0x32c3('0x1c')][_0x32c3('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x32c3('0xb'),_0x32c3('0x1e')],'include':[{'model':db[_0x32c3('0x1f')],'as':_0x32c3('0x20'),'include':[{'model':db['CloudProvider'],'as':_0x32c3('0x21')}]}]})[_0x32c3('0xa')](function(_0x446931){if(!_0x446931){throw new Error(_0x32c3('0x22'));}var _0x1d824d=_0x446931['getSmtpOptions']();var _0xc3a024={'account':_0x1d824d,'message':_[_0x32c3('0x23')]({'from':util[_0x32c3('0x24')](_0x32c3('0x25'),_0x446931[_0x32c3('0xb')],_0x446931[_0x32c3('0x1e')]||_0x446931[_0x32c3('0x20')][_0x32c3('0x13')])},_0x4ff120)};return client[_0x32c3('0x26')](_0x32c3('0x27'),_0xc3a024);})[_0x32c3('0xa')](function(_0x44afd1){if(_0x44afd1['error']){throw new Error(util[_0x32c3('0x24')](_0x32c3('0x28'),_0x44afd1[_0x32c3('0x29')][_0x32c3('0x2a')]||JSON[_0x32c3('0x2b')](_0x44afd1[_0x32c3('0x29')])));}return!![];});}function handleError(_0x34e2a7,_0x1804c1,_0x3147f9){return _0x34e2a7['status'](_0x1804c1||0x1f4)[_0x32c3('0x2c')]({'message':_0x3147f9?_0x3147f9['message']||_0x3147f9:''});}exports[_0x32c3('0x2d')]=function(_0x34ba66,_0x2ed3f7,_0x58b256){passport[_0x32c3('0x15')]('local-login',function(_0x3ccc2d,_0x20b9b1,_0x234c89){var _0x1db448=_0x3ccc2d||_0x234c89;if(_0x1db448){return handleError(_0x2ed3f7,0x191,_0x1db448);}if(!_0x20b9b1){return handleError(_0x2ed3f7,0x194,{'message':_0x32c3('0x2e')});}else{var _0xd610b8={'payload':{'id':_0x20b9b1['id'],'role':_0x20b9b1[_0x32c3('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x32c3('0x2f')](_0xd610b8)[_0x32c3('0xa')](function(_0x4a2cfc){_0x2ed3f7[_0x32c3('0x30')]({'id':_0x20b9b1['id'],'token':_0x4a2cfc,'statusCall':'','isAlreadyLogged':_0x20b9b1[_0x32c3('0x31')]});});}})(_0x34ba66,_0x2ed3f7,_0x58b256);};exports[_0x32c3('0x32')]=function(_0x44a0c7,_0x198f7c){if(!_0x44a0c7['body']['email']){return handleError(_0x198f7c,0x1f4,{'message':_0x32c3('0x33')});}var _0x3ebd26=rs['generate']();_0x44a0c7['body'][_0x32c3('0x1e')]=_0x44a0c7['body'][_0x32c3('0x1e')][_0x32c3('0x34')]()[_0x32c3('0x35')]();var _0x3622e7;return db['Setting'][_0x32c3('0x9')]({'where':{'id':0x1},'attributes':[_0x32c3('0x18'),_0x32c3('0x19')],'raw':!![]})[_0x32c3('0xa')](function(_0x1f5cfa){_0x3622e7=_0x1f5cfa;return db[_0x32c3('0x36')][_0x32c3('0x1d')]({'where':{'email':_0x44a0c7[_0x32c3('0x37')][_0x32c3('0x1e')]}});})[_0x32c3('0xa')](function(_0x5bca50){if(!_0x5bca50){throw new Error(_0x32c3('0x38'));}if(_0x5bca50['disabled']){throw new Error(_0x32c3('0x39'));}if(_0x5bca50[_0x32c3('0xf')]){if(moment(_0x5bca50['blockedAt'])['add'](_0x3622e7['blockDuration'],_0x32c3('0x16'))>moment()){throw new Error(_0x32c3('0x3a'));}else{_0x5bca50[_0x32c3('0xf')]=![];_0x5bca50[_0x32c3('0x10')]=null;}}_0x5bca50[_0x32c3('0x3b')]=_0x3ebd26;_0x5bca50['resetPasswordExpires']=Date[_0x32c3('0x3c')]()+0x36ee80;return _0x5bca50['save']();})['then'](function(){return sendServiceMail({'to':_0x44a0c7[_0x32c3('0x37')][_0x32c3('0x1e')],'subject':_0x32c3('0x3d'),'text':_0x32c3('0x3e')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x32c3('0x3f')+_0x44a0c7[_0x32c3('0x40')][_0x32c3('0x41')]+_0x32c3('0x42')+_0x3ebd26+'\x0a\x0a'+_0x32c3('0x43')});})['then'](function(){_0x198f7c[_0x32c3('0x44')](0xc8)['send']({'message':_0x32c3('0x45')});})[_0x32c3('0x1b')](function(_0x16d758){return handleError(_0x198f7c,0x1f4,_0x16d758);});};exports[_0x32c3('0x46')]=function(_0x463f68,_0x121101){return db['User'][_0x32c3('0x1d')]({'where':{'resetPasswordToken':_0x463f68[_0x32c3('0x47')][_0x32c3('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x32c3('0xa')](function(_0x4d240b){if(!_0x4d240b){throw new Error(_0x32c3('0x49'));}return db[_0x32c3('0x8')][_0x32c3('0x9')]({'attributes':['id',_0x32c3('0x4a'),_0x32c3('0x4b'),_0x32c3('0x4c')]})['then'](function(_0x813920){if(_0x813920[_0x32c3('0x4a')])authService['validatePasswordPattern'](_0x463f68[_0x32c3('0x37')]['password']);if(!_0x813920[_0x32c3('0x4b')]||!_0x4d240b[_0x32c3('0x4d')])return _0x4d240b;authService[_0x32c3('0x4e')](_0x463f68[_0x32c3('0x37')][_0x32c3('0xc')],_0x4d240b[_0x32c3('0x4d')],_0x813920[_0x32c3('0x4c')]);return _0x4d240b;})['then'](function(){_0x4d240b['password']=_0x463f68['body']['password'];_0x4d240b['resetPasswordToken']=null;_0x4d240b[_0x32c3('0x4f')]=null;return _0x4d240b['save']();});})[_0x32c3('0xa')](function(){_0x121101[_0x32c3('0x44')](0xc8)['send']({'message':_0x32c3('0x50')});})[_0x32c3('0x1b')](function(_0x368d10){return handleError(_0x121101,0x1f4,_0x368d10);});};passport[_0x32c3('0x51')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0xa0988b,_0x170754,_0x1d1476){return localAuthenticate(db[_0x32c3('0x36')],_0xa0988b,_0x170754,_0x1d1476);})); \ No newline at end of file +var _0x7a6b=['Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','password','role','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','then','getLicense','catch','MailAccount','name','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','Setting','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util'];(function(_0x2c658a,_0x18d39e){var _0x26806e=function(_0x1943f7){while(--_0x1943f7){_0x2c658a['push'](_0x2c658a['shift']());}};_0x26806e(++_0x18d39e);}(_0x7a6b,0xf5));var _0xb7a6=function(_0x13a45f,_0x533e58){_0x13a45f=_0x13a45f-0x0;var _0x145ef3=_0x7a6b[_0x13a45f];return _0x145ef3;};'use strict';var util=require(_0xb7a6('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0xb7a6('0x1')];var jayson=require('jayson/promise');var _=require(_0xb7a6('0x2'));var rs=require(_0xb7a6('0x3'));var moment=require(_0xb7a6('0x4'));var db=require(_0xb7a6('0x5'))['db'];var authService=require(_0xb7a6('0x6'));var utils=require(_0xb7a6('0x7'));var client=jayson['client'][_0xb7a6('0x8')]({'port':0x232b});function localAuthenticate(_0xe364a1,_0x2cf874,_0x31cfe2,_0x4d6916){var _0x3b988d,_0x590516;return db['Setting'][_0xb7a6('0x9')]({'where':{'id':0x1},'attributes':[_0xb7a6('0xa'),_0xb7a6('0xb')],'raw':!![]})['then'](function(_0x28b293){_0x3b988d=_0x28b293;return _0xe364a1[_0xb7a6('0x9')]({'attributes':['id','name',_0xb7a6('0xc'),'salt',_0xb7a6('0xd'),_0xb7a6('0xe'),_0xb7a6('0xf'),_0xb7a6('0x10'),_0xb7a6('0x11')],'where':{'name':_0x2cf874,'role':{'$or':['admin',_0xb7a6('0x12'),_0xb7a6('0x13')]}}});})['then'](function(_0x1930b3){if(!_0x1930b3||_0x1930b3&&_0x1930b3['name']!==_0x2cf874){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x590516=_0x1930b3;return _0x590516;}})['then'](function(){_0x590516[_0xb7a6('0x14')](_0x31cfe2,function(_0x389adc,_0x4a5e42){var _0x3959b5=_0x590516[_0xb7a6('0x11')]+0x1;if(_0x389adc){return _0x4d6916(_0x389adc);}else if(!_0x4a5e42){if(_0x590516[_0xb7a6('0xe')]){return _0x4d6916(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b988d[_0xb7a6('0xa')]>0x0){if(_0x590516[_0xb7a6('0xf')]){if(_0x3b988d[_0xb7a6('0xb')]>0x0){if(moment(_0x590516[_0xb7a6('0x10')])[_0xb7a6('0x15')](_0x3b988d[_0xb7a6('0xb')],'minutes')>moment()){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else{return utils[_0xb7a6('0x17')](_0x590516,_0x3959b5,![],null)[_0xb7a6('0x18')](function(){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});});}}else{return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}}else{if(_0x3959b5>=_0x3b988d[_0xb7a6('0xa')]){return utils['clearBlockUser'](_0x590516,0x0,!![],moment())['then'](function(){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});});}else{return utils['clearBlockUser'](_0x590516,_0x3959b5,![],null)[_0xb7a6('0x18')](function(){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});});}}}else{return _0x4d6916(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x590516[_0xb7a6('0xe')]){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else if(_0x3b988d[_0xb7a6('0xa')]>0x0){if(_0x590516[_0xb7a6('0xf')]){if(_0x3b988d['blockDuration']>0x0){if(moment(_0x590516['blockedAt'])[_0xb7a6('0x15')](_0x3b988d[_0xb7a6('0xb')],'minutes')>moment()){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else{return utils[_0xb7a6('0x17')](_0x590516,0x0,![],null)[_0xb7a6('0x18')](function(){return utils[_0xb7a6('0x19')](_0x590516);})[_0xb7a6('0x18')](function(){return _0x4d6916(null,_0x590516);});}}else{return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}}else{return utils[_0xb7a6('0x17')](_0x590516,0x0,![],null)[_0xb7a6('0x18')](function(){return utils[_0xb7a6('0x19')](_0x590516);})[_0xb7a6('0x18')](function(){return _0x4d6916(null,_0x590516);})[_0xb7a6('0x1a')](function(_0x432700){return _0x4d6916(null,![],_0x432700);});}}else{if(_0x590516[_0xb7a6('0xf')]){return _0x4d6916(null,![],{'message':_0xb7a6('0x16')});}else{return utils['getLicense'](_0x590516)[_0xb7a6('0x18')](function(){return _0x4d6916(null,_0x590516);});}}}});})[_0xb7a6('0x1a')](function(_0x4d50cb){return _0x4d6916(null,![],_0x4d50cb);});}function sendServiceMail(_0x510fc8){return db[_0xb7a6('0x1b')]['find']({'where':{'service':!![]},'attributes':['id',_0xb7a6('0x1c'),_0xb7a6('0x1d')],'include':[{'model':db[_0xb7a6('0x1e')],'as':_0xb7a6('0x1f'),'include':[{'model':db[_0xb7a6('0x20')],'as':_0xb7a6('0x20')}]}]})[_0xb7a6('0x18')](function(_0x2b413c){if(!_0x2b413c){throw new Error(_0xb7a6('0x21'));}var _0x25289c=_0x2b413c['getSmtpOptions']();var _0x32b8b8={'account':_0x25289c,'message':_[_0xb7a6('0x22')]({'from':util[_0xb7a6('0x23')](_0xb7a6('0x24'),_0x2b413c[_0xb7a6('0x1c')],_0x2b413c['email']||_0x2b413c['Smtp'][_0xb7a6('0x12')])},_0x510fc8)};return client['request'](_0xb7a6('0x25'),_0x32b8b8);})['then'](function(_0x4dd876){if(_0x4dd876['error']){throw new Error(util[_0xb7a6('0x23')](_0xb7a6('0x26'),_0x4dd876[_0xb7a6('0x27')]['message']||JSON[_0xb7a6('0x28')](_0x4dd876[_0xb7a6('0x27')])));}return!![];});}function handleError(_0x2f90d7,_0x477062,_0x3a0279){return _0x2f90d7['status'](_0x477062||0x1f4)['send']({'message':_0x3a0279?_0x3a0279[_0xb7a6('0x29')]||_0x3a0279:''});}exports[_0xb7a6('0x2a')]=function(_0x5b8d88,_0x14aadb,_0x863d0a){passport[_0xb7a6('0x14')](_0xb7a6('0x2b'),function(_0x4058d7,_0xdfc794,_0x289064){var _0x4774eb=_0x4058d7||_0x289064;if(_0x4774eb){return handleError(_0x14aadb,0x191,_0x4774eb);}if(!_0xdfc794){return handleError(_0x14aadb,0x194,{'message':_0xb7a6('0x2c')});}else{var _0x43ac32={'payload':{'id':_0xdfc794['id'],'role':_0xdfc794[_0xb7a6('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xb7a6('0x2d')](_0x43ac32)[_0xb7a6('0x18')](function(_0x4e6d1d){_0x14aadb[_0xb7a6('0x2e')]({'id':_0xdfc794['id'],'token':_0x4e6d1d,'statusCall':'','isAlreadyLogged':_0xdfc794[_0xb7a6('0x2f')]});});}})(_0x5b8d88,_0x14aadb,_0x863d0a);};exports[_0xb7a6('0x30')]=function(_0xa867e2,_0x1eb4c6){if(!_0xa867e2['body'][_0xb7a6('0x1d')]){return handleError(_0x1eb4c6,0x1f4,{'message':_0xb7a6('0x31')});}var _0x15da70=rs[_0xb7a6('0x32')]();_0xa867e2[_0xb7a6('0x33')][_0xb7a6('0x1d')]=_0xa867e2[_0xb7a6('0x33')][_0xb7a6('0x1d')][_0xb7a6('0x34')]()['toLowerCase']();var _0x2e615a;return db[_0xb7a6('0x35')][_0xb7a6('0x9')]({'where':{'id':0x1},'attributes':[_0xb7a6('0xa'),_0xb7a6('0xb')],'raw':!![]})[_0xb7a6('0x18')](function(_0x25a2fb){_0x2e615a=_0x25a2fb;return db[_0xb7a6('0x36')][_0xb7a6('0x37')]({'where':{'email':_0xa867e2['body'][_0xb7a6('0x1d')]}});})[_0xb7a6('0x18')](function(_0x43aea2){if(!_0x43aea2){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x43aea2[_0xb7a6('0xe')]){throw new Error(_0xb7a6('0x38'));}if(_0x43aea2[_0xb7a6('0xf')]){if(moment(_0x43aea2[_0xb7a6('0x10')])[_0xb7a6('0x15')](_0x2e615a[_0xb7a6('0xb')],_0xb7a6('0x39'))>moment()){throw new Error(_0xb7a6('0x3a'));}else{_0x43aea2['blocked']=![];_0x43aea2[_0xb7a6('0x10')]=null;}}_0x43aea2[_0xb7a6('0x3b')]=_0x15da70;_0x43aea2[_0xb7a6('0x3c')]=Date[_0xb7a6('0x3d')]()+0x36ee80;return _0x43aea2[_0xb7a6('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0xa867e2['body'][_0xb7a6('0x1d')],'subject':_0xb7a6('0x3f'),'text':_0xb7a6('0x40')+_0xb7a6('0x41')+_0xb7a6('0x42')+_0xa867e2[_0xb7a6('0x43')][_0xb7a6('0x44')]+_0xb7a6('0x45')+_0x15da70+'\x0a\x0a'+_0xb7a6('0x46')});})[_0xb7a6('0x18')](function(){_0x1eb4c6['status'](0xc8)[_0xb7a6('0x47')]({'message':_0xb7a6('0x48')});})[_0xb7a6('0x1a')](function(_0x261530){return handleError(_0x1eb4c6,0x1f4,_0x261530);});};exports['reset']=function(_0xde5df1,_0x241e4){return db[_0xb7a6('0x36')][_0xb7a6('0x37')]({'where':{'resetPasswordToken':_0xde5df1['params'][_0xb7a6('0x49')],'resetPasswordExpires':{'$gt':Date[_0xb7a6('0x3d')]()}}})[_0xb7a6('0x18')](function(_0x11d7e3){if(!_0x11d7e3){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xb7a6('0x35')][_0xb7a6('0x9')]({'attributes':['id',_0xb7a6('0x4a'),_0xb7a6('0x4b'),_0xb7a6('0x4c')]})[_0xb7a6('0x18')](function(_0x561a0c){if(_0x561a0c[_0xb7a6('0x4a')])authService[_0xb7a6('0x4d')](_0xde5df1[_0xb7a6('0x33')][_0xb7a6('0xc')]);if(!_0x561a0c[_0xb7a6('0x4b')]||!_0x11d7e3[_0xb7a6('0x4e')])return _0x11d7e3;authService[_0xb7a6('0x4f')](_0xde5df1[_0xb7a6('0x33')][_0xb7a6('0xc')],_0x11d7e3[_0xb7a6('0x4e')],_0x561a0c[_0xb7a6('0x4c')]);return _0x11d7e3;})['then'](function(){_0x11d7e3[_0xb7a6('0xc')]=_0xde5df1['body'][_0xb7a6('0xc')];_0x11d7e3['resetPasswordToken']=null;_0x11d7e3[_0xb7a6('0x3c')]=null;return _0x11d7e3['save']();});})[_0xb7a6('0x18')](function(){_0x241e4['status'](0xc8)[_0xb7a6('0x47')]({'message':_0xb7a6('0x50')});})[_0xb7a6('0x1a')](function(_0x53e426){return handleError(_0x241e4,0x1f4,_0x53e426);});};passport[_0xb7a6('0x51')](_0xb7a6('0x2b'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x14d22e,_0x24596a,_0x2bdb43){return localAuthenticate(db[_0xb7a6('0x36')],_0x14d22e,_0x24596a,_0x2bdb43);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index d929fa6..fdc2387 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 _0xab5a=['reset','Router','post','login','/forgot'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xab5a,0x1cd));var _0xaab5=function(_0xc67aef,_0x36a9ba){_0xc67aef=_0xc67aef-0x0;var _0x23a974=_0xab5a[_0xc67aef];return _0x23a974;};'use strict';var express=require('express');var router=express[_0xaab5('0x0')]();var controller=require('./authLocal.controller');router[_0xaab5('0x1')]('/',controller[_0xaab5('0x2')]);router[_0xaab5('0x1')](_0xaab5('0x3'),controller['forgot']);router[_0xaab5('0x1')]('/reset/:token',controller[_0xaab5('0x4')]);module['exports']=router; \ No newline at end of file +var _0xfd8b=['exports','express','Router','login','post','forgot','/reset/:token','reset'];(function(_0xd0b573,_0x3cbc25){var _0x1d31e0=function(_0x42fa21){while(--_0x42fa21){_0xd0b573['push'](_0xd0b573['shift']());}};_0x1d31e0(++_0x3cbc25);}(_0xfd8b,0x1d9));var _0xbfd8=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0xfd8b[_0x221b8c];return _0x3fab9f;};'use strict';var express=require(_0xbfd8('0x0'));var router=express[_0xbfd8('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0xbfd8('0x2')]);router[_0xbfd8('0x3')]('/forgot',controller[_0xbfd8('0x4')]);router['post'](_0xbfd8('0x5'),controller[_0xbfd8('0x6')]);module[_0xbfd8('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e58e9a7..793f710 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 _0x1a00=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x52d358,_0x51d6fd){var _0x386ffb=function(_0x3ea9ab){while(--_0x3ea9ab){_0x52d358['push'](_0x52d358['shift']());}};_0x386ffb(++_0x51d6fd);}(_0x1a00,0x96));var _0x01a0=function(_0x3ce3cd,_0x508147){_0x3ce3cd=_0x3ce3cd-0x0;var _0x12d8d8=_0x1a00[_0x3ce3cd];return _0x12d8d8;};'use strict';var Sequelize=require(_0x01a0('0x0'));module[_0x01a0('0x1')]={'name':{'type':Sequelize[_0x01a0('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x01a0('0x2')]},'status':{'type':Sequelize[_0x01a0('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x01a0('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x4129=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x58be00,_0xf98889){var _0x4b9818=function(_0xb574c2){while(--_0xb574c2){_0x58be00['push'](_0x58be00['shift']());}};_0x4b9818(++_0xf98889);}(_0x4129,0xd7));var _0x9412=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4129[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x9412('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9412('0x1')]},'description':{'type':Sequelize[_0x9412('0x1')]},'status':{'type':Sequelize[_0x9412('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9412('0x3')],'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 61a1cbb..eae9ddd 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 _0x708f=['pick','filters','filter','merge','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','update','body','addConditions','Condition','ids','getConditions','findOne','keys','sort','nolimit','limit','Action','addActions','omit','getActions','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','json','reject','save','then','destroy','error','stack','send','index','Automation','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','order','where'];(function(_0x31a9ae,_0x2a1716){var _0x23a1d0=function(_0x740fab){while(--_0x740fab){_0x31a9ae['push'](_0x31a9ae['shift']());}};_0x23a1d0(++_0x2a1716);}(_0x708f,0xc7));var _0xf708=function(_0x1a613b,_0x381801){_0x1a613b=_0x1a613b-0x0;var _0x5b80f0=_0x708f[_0x1a613b];return _0x5b80f0;};'use strict';var emlformat=require(_0xf708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf708('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf708('0x2'));var moment=require(_0xf708('0x3'));var BPromise=require(_0xf708('0x4'));var Mustache=require(_0xf708('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf708('0x6'));var csv=require(_0xf708('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf708('0x8'));var _=require(_0xf708('0x9'));var squel=require(_0xf708('0xa'));var crypto=require(_0xf708('0xb'));var jsforce=require(_0xf708('0xc'));var deskjs=require(_0xf708('0xd'));var toCsv=require(_0xf708('0x7'));var querystring=require('querystring');var Papa=require(_0xf708('0xe'));var Redis=require(_0xf708('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf708('0x10'));var hardwareService=require(_0xf708('0x11'));var logger=require(_0xf708('0x12'))(_0xf708('0x13'));var utils=require(_0xf708('0x14'));var config=require(_0xf708('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf708('0x16'))['db'];function respondWithStatusCode(_0x3b959d,_0x316e93){_0x316e93=_0x316e93||0xcc;return function(_0x151c32){if(_0x151c32){return _0x3b959d[_0xf708('0x17')](_0x316e93);}return _0x3b959d[_0xf708('0x18')](_0x316e93)[_0xf708('0x19')]();};}function respondWithResult(_0xe9c51d,_0x37e132){_0x37e132=_0x37e132||0xc8;return function(_0x1caf7b){if(_0x1caf7b){return _0xe9c51d[_0xf708('0x18')](_0x37e132)['json'](_0x1caf7b);}};}function respondWithFilteredResult(_0x469d14,_0x3dda9e){return function(_0x107b6b){if(_0x107b6b){var _0x3aea42=typeof _0x3dda9e['offset']===_0xf708('0x1a')&&typeof _0x3dda9e['limit']===_0xf708('0x1a');var _0x238b35=_0x107b6b[_0xf708('0x1b')];var _0x6ac8c8=_0x3aea42?0x0:_0x3dda9e[_0xf708('0x1c')];var _0x5cedb6=_0x3aea42?_0x107b6b['count']:_0x3dda9e[_0xf708('0x1c')]+_0x3dda9e['limit'];var _0x3ee2e5;if(_0x5cedb6>=_0x238b35){_0x5cedb6=_0x238b35;_0x3ee2e5=0xc8;}else{_0x3ee2e5=0xce;}_0x469d14[_0xf708('0x18')](_0x3ee2e5);return _0x469d14['set'](_0xf708('0x1d'),_0x6ac8c8+'-'+_0x5cedb6+'/'+_0x238b35)[_0xf708('0x1e')](_0x107b6b);}return null;};}function patchUpdates(_0x6b31b1){return function(_0x3e59af){try{jsonpatch['apply'](_0x3e59af,_0x6b31b1,!![]);}catch(_0x187315){return BPromise[_0xf708('0x1f')](_0x187315);}return _0x3e59af[_0xf708('0x20')]();};}function saveUpdates(_0x23873c,_0x336c57){return function(_0x551e66){if(_0x551e66){return _0x551e66['update'](_0x23873c)[_0xf708('0x21')](function(_0x1cd749){return _0x1cd749;});}return null;};}function removeEntity(_0xec5a1d,_0x576c99){return function(_0x13718e){if(_0x13718e){return _0x13718e[_0xf708('0x22')]()['then'](function(){_0xec5a1d[_0xf708('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41596f,_0x512782){return function(_0x288118){if(!_0x288118){_0x41596f[_0xf708('0x17')](0x194);}return _0x288118;};}function handleError(_0x273fbd,_0x49fa30){_0x49fa30=_0x49fa30||0x1f4;return function(_0xa71dc4){logger[_0xf708('0x23')](_0xa71dc4[_0xf708('0x24')]);if(_0xa71dc4['name']){delete _0xa71dc4['name'];}_0x273fbd[_0xf708('0x18')](_0x49fa30)[_0xf708('0x25')](_0xa71dc4);};}exports[_0xf708('0x26')]=function(_0x1e2e22,_0x56859c){var _0x440e79={},_0x5c5141={},_0xf655e={'count':0x0,'rows':[]};var _0x195eac=_['map'](db[_0xf708('0x27')][_0xf708('0x28')],function(_0x52da8b){return{'name':_0x52da8b[_0xf708('0x29')],'type':_0x52da8b[_0xf708('0x2a')][_0xf708('0x2b')]};});_0x5c5141[_0xf708('0x2c')]=_[_0xf708('0x2d')](_0x195eac,_0xf708('0x2e'));_0x5c5141[_0xf708('0x2f')]=_['keys'](_0x1e2e22['query']);_0x5c5141['filters']=_[_0xf708('0x30')](_0x5c5141[_0xf708('0x2c')],_0x5c5141[_0xf708('0x2f')]);_0x440e79[_0xf708('0x31')]=_[_0xf708('0x30')](_0x5c5141[_0xf708('0x2c')],qs[_0xf708('0x32')](_0x1e2e22['query'][_0xf708('0x32')]));_0x440e79[_0xf708('0x31')]=_0x440e79['attributes']['length']?_0x440e79[_0xf708('0x31')]:_0x5c5141[_0xf708('0x2c')];if(!_0x1e2e22[_0xf708('0x2f')]['hasOwnProperty']('nolimit')){_0x440e79['limit']=qs['limit'](_0x1e2e22[_0xf708('0x2f')]['limit']);_0x440e79[_0xf708('0x1c')]=qs[_0xf708('0x1c')](_0x1e2e22[_0xf708('0x2f')][_0xf708('0x1c')]);}_0x440e79[_0xf708('0x33')]=qs['sort'](_0x1e2e22[_0xf708('0x2f')]['sort']);_0x440e79[_0xf708('0x34')]=qs['filters'](_[_0xf708('0x35')](_0x1e2e22['query'],_0x5c5141[_0xf708('0x36')]),_0x195eac);if(_0x1e2e22[_0xf708('0x2f')][_0xf708('0x37')]){_0x440e79[_0xf708('0x34')]=_[_0xf708('0x38')](_0x440e79[_0xf708('0x34')],{'$or':_[_0xf708('0x2d')](_0x195eac,function(_0xb1ed3d){if(_0xb1ed3d[_0xf708('0x2a')]!=='VIRTUAL'){var _0x4445fd={};_0x4445fd[_0xb1ed3d[_0xf708('0x2e')]]={'$like':'%'+_0x1e2e22['query'][_0xf708('0x37')]+'%'};return _0x4445fd;}})});}_0x440e79=_[_0xf708('0x38')]({},_0x440e79,_0x1e2e22['options']);var _0x29e0a4={'where':_0x440e79[_0xf708('0x34')]};return db[_0xf708('0x27')][_0xf708('0x1b')](_0x29e0a4)[_0xf708('0x21')](function(_0x155d4d){_0xf655e[_0xf708('0x1b')]=_0x155d4d;if(_0x1e2e22[_0xf708('0x2f')]['includeAll']){_0x440e79[_0xf708('0x39')]=[{'all':!![]}];}return db[_0xf708('0x27')][_0xf708('0x3a')](_0x440e79);})[_0xf708('0x21')](function(_0x1382c3){_0xf655e[_0xf708('0x3b')]=_0x1382c3;return _0xf655e;})[_0xf708('0x21')](respondWithFilteredResult(_0x56859c,_0x440e79))[_0xf708('0x3c')](handleError(_0x56859c,null));};exports[_0xf708('0x3d')]=function(_0x1b90de,_0x4dfb54){var _0x15ebcf={'raw':![],'where':{'id':_0x1b90de[_0xf708('0x3e')]['id']}},_0x286535={};_0x286535[_0xf708('0x2c')]=_['keys'](db[_0xf708('0x27')][_0xf708('0x28')]);_0x286535[_0xf708('0x2f')]=_['keys'](_0x1b90de['query']);_0x286535[_0xf708('0x36')]=_['intersection'](_0x286535[_0xf708('0x2c')],_0x286535['query']);_0x15ebcf[_0xf708('0x31')]=_[_0xf708('0x30')](_0x286535[_0xf708('0x2c')],qs[_0xf708('0x32')](_0x1b90de[_0xf708('0x2f')][_0xf708('0x32')]));_0x15ebcf[_0xf708('0x31')]=_0x15ebcf[_0xf708('0x31')][_0xf708('0x3f')]?_0x15ebcf[_0xf708('0x31')]:_0x286535[_0xf708('0x2c')];if(_0x1b90de[_0xf708('0x2f')][_0xf708('0x40')]){_0x15ebcf[_0xf708('0x39')]=[{'all':!![]}];}_0x15ebcf=_[_0xf708('0x38')]({},_0x15ebcf,_0x1b90de[_0xf708('0x41')]);return db[_0xf708('0x27')][_0xf708('0x42')](_0x15ebcf)[_0xf708('0x21')](handleEntityNotFound(_0x4dfb54,null))['then'](respondWithResult(_0x4dfb54,null))['catch'](handleError(_0x4dfb54,null));};exports['create']=function(_0x193ff8,_0xc5a809){return db[_0xf708('0x27')][_0xf708('0x43')](_0x193ff8['body'],{})[_0xf708('0x21')](respondWithResult(_0xc5a809,0xc9))[_0xf708('0x3c')](handleError(_0xc5a809,null));};exports[_0xf708('0x44')]=function(_0xcd6ee8,_0x3c07c5){if(_0xcd6ee8[_0xf708('0x45')]['id']){delete _0xcd6ee8[_0xf708('0x45')]['id'];}return db[_0xf708('0x27')][_0xf708('0x42')]({'where':{'id':_0xcd6ee8[_0xf708('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3c07c5,null))[_0xf708('0x21')](saveUpdates(_0xcd6ee8['body'],null))[_0xf708('0x21')](respondWithResult(_0x3c07c5,null))[_0xf708('0x3c')](handleError(_0x3c07c5,null));};exports[_0xf708('0x22')]=function(_0xc01004,_0x3553d8){return db[_0xf708('0x27')][_0xf708('0x42')]({'where':{'id':_0xc01004[_0xf708('0x3e')]['id']}})[_0xf708('0x21')](handleEntityNotFound(_0x3553d8,null))[_0xf708('0x21')](removeEntity(_0x3553d8,null))[_0xf708('0x3c')](handleError(_0x3553d8,null));};exports[_0xf708('0x46')]=function(_0x5355b3,_0x437313,_0x5cda7e){return db[_0xf708('0x47')][_0xf708('0x42')]({'where':{'id':_0x5355b3[_0xf708('0x3e')]['id']}})[_0xf708('0x21')](handleEntityNotFound(_0x437313,null))[_0xf708('0x21')](function(_0x2dca06){if(_0x2dca06){return _0x2dca06[_0xf708('0x46')](_0x5355b3[_0xf708('0x45')][_0xf708('0x48')],_['omit'](_0x5355b3['body'],[_0xf708('0x48'),'id'])||{});}})[_0xf708('0x21')](respondWithResult(_0x437313,null))[_0xf708('0x3c')](handleError(_0x437313,null));};exports[_0xf708('0x49')]=function(_0x45ffed,_0xddc8fd,_0x970ed9){var _0x322cd9={};var _0x564d67={};var _0x3ec77d;var _0x1c71f9;return db[_0xf708('0x27')][_0xf708('0x4a')]({'where':{'id':_0x45ffed[_0xf708('0x3e')]['id']}})[_0xf708('0x21')](handleEntityNotFound(_0xddc8fd,null))[_0xf708('0x21')](function(_0x26838d){if(_0x26838d){_0x3ec77d=_0x26838d;_0x564d67[_0xf708('0x2c')]=_[_0xf708('0x4b')](db[_0xf708('0x47')][_0xf708('0x28')]);_0x564d67[_0xf708('0x2f')]=_[_0xf708('0x4b')](_0x45ffed[_0xf708('0x2f')]);_0x564d67[_0xf708('0x36')]=_[_0xf708('0x30')](_0x564d67[_0xf708('0x2c')],_0x564d67[_0xf708('0x2f')]);_0x322cd9[_0xf708('0x31')]=_[_0xf708('0x30')](_0x564d67['model'],qs[_0xf708('0x32')](_0x45ffed[_0xf708('0x2f')][_0xf708('0x32')]));_0x322cd9[_0xf708('0x31')]=_0x322cd9[_0xf708('0x31')]['length']?_0x322cd9[_0xf708('0x31')]:_0x564d67[_0xf708('0x2c')];_0x322cd9['order']=qs[_0xf708('0x4c')](_0x45ffed[_0xf708('0x2f')][_0xf708('0x4c')]);_0x322cd9['where']=qs[_0xf708('0x36')](_[_0xf708('0x35')](_0x45ffed[_0xf708('0x2f')],_0x564d67[_0xf708('0x36')]));if(_0x45ffed[_0xf708('0x2f')][_0xf708('0x37')]){_0x322cd9[_0xf708('0x34')]=_[_0xf708('0x38')](_0x322cd9[_0xf708('0x34')],{'$or':_[_0xf708('0x2d')](_0x322cd9[_0xf708('0x31')],function(_0x2d6a40){var _0x2cb8e0={};_0x2cb8e0[_0x2d6a40]={'$like':'%'+_0x45ffed[_0xf708('0x2f')][_0xf708('0x37')]+'%'};return _0x2cb8e0;})});}_0x322cd9=_[_0xf708('0x38')]({},_0x322cd9,_0x45ffed[_0xf708('0x41')]);return _0x3ec77d['getConditions'](_0x322cd9);}})[_0xf708('0x21')](function(_0x4a0899){if(_0x4a0899){_0x1c71f9=_0x4a0899[_0xf708('0x3f')];if(!_0x45ffed[_0xf708('0x2f')]['hasOwnProperty'](_0xf708('0x4d'))){_0x322cd9[_0xf708('0x4e')]=qs['limit'](_0x45ffed[_0xf708('0x2f')][_0xf708('0x4e')]);_0x322cd9[_0xf708('0x1c')]=qs['offset'](_0x45ffed[_0xf708('0x2f')][_0xf708('0x1c')]);}return _0x3ec77d['getConditions'](_0x322cd9);}})[_0xf708('0x21')](function(_0x3b811e){if(_0x3b811e){return _0x3b811e?{'count':_0x1c71f9,'rows':_0x3b811e}:null;}})['then'](respondWithResult(_0xddc8fd,null))[_0xf708('0x3c')](handleError(_0xddc8fd,null));};exports['addActions']=function(_0xadd558,_0x121e83,_0x301e18){return db[_0xf708('0x4f')][_0xf708('0x42')]({'where':{'id':_0xadd558[_0xf708('0x3e')]['id']}})[_0xf708('0x21')](handleEntityNotFound(_0x121e83,null))[_0xf708('0x21')](function(_0x32020b){if(_0x32020b){return _0x32020b[_0xf708('0x50')](_0xadd558[_0xf708('0x45')][_0xf708('0x48')],_[_0xf708('0x51')](_0xadd558[_0xf708('0x45')],[_0xf708('0x48'),'id'])||{});}})['then'](respondWithResult(_0x121e83,null))[_0xf708('0x3c')](handleError(_0x121e83,null));};exports['getActions']=function(_0x4b3d5b,_0x302dbb,_0x3b92be){var _0x5c63d9={};var _0x3bb9ac={};var _0x1aebfc;var _0x170d92;return db[_0xf708('0x27')][_0xf708('0x4a')]({'where':{'id':_0x4b3d5b[_0xf708('0x3e')]['id']}})[_0xf708('0x21')](handleEntityNotFound(_0x302dbb,null))[_0xf708('0x21')](function(_0x222e7e){if(_0x222e7e){_0x1aebfc=_0x222e7e;_0x3bb9ac[_0xf708('0x2c')]=_[_0xf708('0x4b')](db[_0xf708('0x4f')][_0xf708('0x28')]);_0x3bb9ac[_0xf708('0x2f')]=_['keys'](_0x4b3d5b[_0xf708('0x2f')]);_0x3bb9ac['filters']=_['intersection'](_0x3bb9ac[_0xf708('0x2c')],_0x3bb9ac[_0xf708('0x2f')]);_0x5c63d9[_0xf708('0x31')]=_[_0xf708('0x30')](_0x3bb9ac[_0xf708('0x2c')],qs['fields'](_0x4b3d5b[_0xf708('0x2f')]['fields']));_0x5c63d9[_0xf708('0x31')]=_0x5c63d9[_0xf708('0x31')][_0xf708('0x3f')]?_0x5c63d9['attributes']:_0x3bb9ac[_0xf708('0x2c')];_0x5c63d9[_0xf708('0x33')]=qs[_0xf708('0x4c')](_0x4b3d5b[_0xf708('0x2f')][_0xf708('0x4c')]);_0x5c63d9[_0xf708('0x34')]=qs['filters'](_[_0xf708('0x35')](_0x4b3d5b[_0xf708('0x2f')],_0x3bb9ac[_0xf708('0x36')]));if(_0x4b3d5b['query'][_0xf708('0x37')]){_0x5c63d9[_0xf708('0x34')]=_[_0xf708('0x38')](_0x5c63d9[_0xf708('0x34')],{'$or':_[_0xf708('0x2d')](_0x5c63d9['attributes'],function(_0x525874){var _0xafc2aa={};_0xafc2aa[_0x525874]={'$like':'%'+_0x4b3d5b[_0xf708('0x2f')]['filter']+'%'};return _0xafc2aa;})});}_0x5c63d9=_[_0xf708('0x38')]({},_0x5c63d9,_0x4b3d5b['options']);return _0x1aebfc[_0xf708('0x52')](_0x5c63d9);}})[_0xf708('0x21')](function(_0x41ef79){if(_0x41ef79){_0x170d92=_0x41ef79['length'];if(!_0x4b3d5b['query'][_0xf708('0x53')]('nolimit')){_0x5c63d9['limit']=qs[_0xf708('0x4e')](_0x4b3d5b[_0xf708('0x2f')][_0xf708('0x4e')]);_0x5c63d9[_0xf708('0x1c')]=qs[_0xf708('0x1c')](_0x4b3d5b['query'][_0xf708('0x1c')]);}return _0x1aebfc[_0xf708('0x52')](_0x5c63d9);}})[_0xf708('0x21')](function(_0x4f62f5){if(_0x4f62f5){return _0x4f62f5?{'count':_0x170d92,'rows':_0x4f62f5}:null;}})[_0xf708('0x21')](respondWithResult(_0x302dbb,null))[_0xf708('0x3c')](handleError(_0x302dbb,null));}; \ No newline at end of file +var _0x7552=['update','then','destroy','error','name','map','Automation','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','include','show','params','includeAll','options','catch','create','body','find','addConditions','Condition','omit','ids','findOne','keys','order','pick','getConditions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save'];(function(_0x15fdee,_0x3191d1){var _0x57ce2d=function(_0xe2c813){while(--_0xe2c813){_0x15fdee['push'](_0x15fdee['shift']());}};_0x57ce2d(++_0x3191d1);}(_0x7552,0x11c));var _0x2755=function(_0x244881,_0x468437){_0x244881=_0x244881-0x0;var _0xefae95=_0x7552[_0x244881];return _0xefae95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2755('0x0'));var zipdir=require(_0x2755('0x1'));var jsonpatch=require(_0x2755('0x2'));var rp=require(_0x2755('0x3'));var moment=require(_0x2755('0x4'));var BPromise=require(_0x2755('0x5'));var Mustache=require('mustache');var util=require(_0x2755('0x6'));var path=require(_0x2755('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2755('0x8'));var fs=require('fs');var fs_extra=require(_0x2755('0x9'));var _=require(_0x2755('0xa'));var squel=require(_0x2755('0xb'));var crypto=require(_0x2755('0xc'));var jsforce=require(_0x2755('0xd'));var deskjs=require(_0x2755('0xe'));var toCsv=require(_0x2755('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2755('0x10'));var authService=require(_0x2755('0x11'));var qs=require(_0x2755('0x12'));var as=require(_0x2755('0x13'));var hardwareService=require(_0x2755('0x14'));var logger=require(_0x2755('0x15'))(_0x2755('0x16'));var utils=require(_0x2755('0x17'));var config=require(_0x2755('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13b2ef,_0x428429){_0x428429=_0x428429||0xcc;return function(_0x4c848d){if(_0x4c848d){return _0x13b2ef[_0x2755('0x19')](_0x428429);}return _0x13b2ef[_0x2755('0x1a')](_0x428429)[_0x2755('0x1b')]();};}function respondWithResult(_0x1d7920,_0x422bb3){_0x422bb3=_0x422bb3||0xc8;return function(_0x1a9c50){if(_0x1a9c50){return _0x1d7920[_0x2755('0x1a')](_0x422bb3)['json'](_0x1a9c50);}};}function respondWithFilteredResult(_0x2ca7bc,_0x5ae116){return function(_0x37e765){if(_0x37e765){var _0x34a314=typeof _0x5ae116[_0x2755('0x1c')]===_0x2755('0x1d')&&typeof _0x5ae116['limit']===_0x2755('0x1d');var _0x28a00f=_0x37e765[_0x2755('0x1e')];var _0x9c524f=_0x34a314?0x0:_0x5ae116[_0x2755('0x1c')];var _0x5839a8=_0x34a314?_0x37e765['count']:_0x5ae116[_0x2755('0x1c')]+_0x5ae116[_0x2755('0x1f')];var _0xb35f91;if(_0x5839a8>=_0x28a00f){_0x5839a8=_0x28a00f;_0xb35f91=0xc8;}else{_0xb35f91=0xce;}_0x2ca7bc['status'](_0xb35f91);return _0x2ca7bc['set'](_0x2755('0x20'),_0x9c524f+'-'+_0x5839a8+'/'+_0x28a00f)['json'](_0x37e765);}return null;};}function patchUpdates(_0x1a4dcd){return function(_0x4b0513){try{jsonpatch[_0x2755('0x21')](_0x4b0513,_0x1a4dcd,!![]);}catch(_0x58db78){return BPromise[_0x2755('0x22')](_0x58db78);}return _0x4b0513[_0x2755('0x23')]();};}function saveUpdates(_0x31cdec,_0xc3d357){return function(_0x4929b7){if(_0x4929b7){return _0x4929b7[_0x2755('0x24')](_0x31cdec)[_0x2755('0x25')](function(_0x5d0391){return _0x5d0391;});}return null;};}function removeEntity(_0x3f0018,_0x529bdd){return function(_0x41dac){if(_0x41dac){return _0x41dac[_0x2755('0x26')]()[_0x2755('0x25')](function(){_0x3f0018[_0x2755('0x1a')](0xcc)[_0x2755('0x1b')]();});}};}function handleEntityNotFound(_0x44124c,_0x27242a){return function(_0x4cc0cf){if(!_0x4cc0cf){_0x44124c[_0x2755('0x19')](0x194);}return _0x4cc0cf;};}function handleError(_0x599249,_0x23b61f){_0x23b61f=_0x23b61f||0x1f4;return function(_0x59e2c5){logger[_0x2755('0x27')](_0x59e2c5['stack']);if(_0x59e2c5[_0x2755('0x28')]){delete _0x59e2c5[_0x2755('0x28')];}_0x599249[_0x2755('0x1a')](_0x23b61f)['send'](_0x59e2c5);};}exports['index']=function(_0x3026c9,_0x31a35f){var _0x401659={},_0xd55771={},_0x35fadb={'count':0x0,'rows':[]};var _0x216b86=_[_0x2755('0x29')](db[_0x2755('0x2a')][_0x2755('0x2b')],function(_0x5381e8){return{'name':_0x5381e8[_0x2755('0x2c')],'type':_0x5381e8[_0x2755('0x2d')][_0x2755('0x2e')]};});_0xd55771[_0x2755('0x2f')]=_[_0x2755('0x29')](_0x216b86,_0x2755('0x28'));_0xd55771['query']=_['keys'](_0x3026c9[_0x2755('0x30')]);_0xd55771['filters']=_[_0x2755('0x31')](_0xd55771['model'],_0xd55771[_0x2755('0x30')]);_0x401659[_0x2755('0x32')]=_['intersection'](_0xd55771[_0x2755('0x2f')],qs['fields'](_0x3026c9[_0x2755('0x30')][_0x2755('0x33')]));_0x401659[_0x2755('0x32')]=_0x401659[_0x2755('0x32')][_0x2755('0x34')]?_0x401659[_0x2755('0x32')]:_0xd55771[_0x2755('0x2f')];if(!_0x3026c9[_0x2755('0x30')][_0x2755('0x35')](_0x2755('0x36'))){_0x401659[_0x2755('0x1f')]=qs[_0x2755('0x1f')](_0x3026c9['query'][_0x2755('0x1f')]);_0x401659[_0x2755('0x1c')]=qs[_0x2755('0x1c')](_0x3026c9['query']['offset']);}_0x401659['order']=qs[_0x2755('0x37')](_0x3026c9[_0x2755('0x30')][_0x2755('0x37')]);_0x401659[_0x2755('0x38')]=qs[_0x2755('0x39')](_['pick'](_0x3026c9[_0x2755('0x30')],_0xd55771[_0x2755('0x39')]),_0x216b86);if(_0x3026c9[_0x2755('0x30')][_0x2755('0x3a')]){_0x401659[_0x2755('0x38')]=_[_0x2755('0x3b')](_0x401659[_0x2755('0x38')],{'$or':_['map'](_0x216b86,function(_0x438a6d){if(_0x438a6d[_0x2755('0x2d')]!=='VIRTUAL'){var _0x1fc52d={};_0x1fc52d[_0x438a6d[_0x2755('0x28')]]={'$like':'%'+_0x3026c9[_0x2755('0x30')][_0x2755('0x3a')]+'%'};return _0x1fc52d;}})});}_0x401659=_[_0x2755('0x3b')]({},_0x401659,_0x3026c9['options']);var _0x1e8e7d={'where':_0x401659['where']};return db[_0x2755('0x2a')]['count'](_0x1e8e7d)['then'](function(_0x33146d){_0x35fadb[_0x2755('0x1e')]=_0x33146d;if(_0x3026c9[_0x2755('0x30')]['includeAll']){_0x401659[_0x2755('0x3c')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x401659);})['then'](function(_0x5ae143){_0x35fadb['rows']=_0x5ae143;return _0x35fadb;})[_0x2755('0x25')](respondWithFilteredResult(_0x31a35f,_0x401659))['catch'](handleError(_0x31a35f,null));};exports[_0x2755('0x3d')]=function(_0x40f9b4,_0x4b40d8){var _0x1d9635={'raw':![],'where':{'id':_0x40f9b4[_0x2755('0x3e')]['id']}},_0x5f16be={};_0x5f16be[_0x2755('0x2f')]=_['keys'](db[_0x2755('0x2a')][_0x2755('0x2b')]);_0x5f16be[_0x2755('0x30')]=_['keys'](_0x40f9b4['query']);_0x5f16be[_0x2755('0x39')]=_[_0x2755('0x31')](_0x5f16be[_0x2755('0x2f')],_0x5f16be[_0x2755('0x30')]);_0x1d9635[_0x2755('0x32')]=_[_0x2755('0x31')](_0x5f16be[_0x2755('0x2f')],qs['fields'](_0x40f9b4[_0x2755('0x30')][_0x2755('0x33')]));_0x1d9635['attributes']=_0x1d9635[_0x2755('0x32')][_0x2755('0x34')]?_0x1d9635['attributes']:_0x5f16be[_0x2755('0x2f')];if(_0x40f9b4[_0x2755('0x30')][_0x2755('0x3f')]){_0x1d9635[_0x2755('0x3c')]=[{'all':!![]}];}_0x1d9635=_[_0x2755('0x3b')]({},_0x1d9635,_0x40f9b4[_0x2755('0x40')]);return db[_0x2755('0x2a')]['find'](_0x1d9635)[_0x2755('0x25')](handleEntityNotFound(_0x4b40d8,null))[_0x2755('0x25')](respondWithResult(_0x4b40d8,null))[_0x2755('0x41')](handleError(_0x4b40d8,null));};exports['create']=function(_0x5c8c4e,_0x1e4e11){return db[_0x2755('0x2a')][_0x2755('0x42')](_0x5c8c4e[_0x2755('0x43')],{})['then'](respondWithResult(_0x1e4e11,0xc9))[_0x2755('0x41')](handleError(_0x1e4e11,null));};exports[_0x2755('0x24')]=function(_0x4e9644,_0x3fe9da){if(_0x4e9644[_0x2755('0x43')]['id']){delete _0x4e9644[_0x2755('0x43')]['id'];}return db[_0x2755('0x2a')][_0x2755('0x44')]({'where':{'id':_0x4e9644[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x3fe9da,null))[_0x2755('0x25')](saveUpdates(_0x4e9644[_0x2755('0x43')],null))[_0x2755('0x25')](respondWithResult(_0x3fe9da,null))[_0x2755('0x41')](handleError(_0x3fe9da,null));};exports[_0x2755('0x26')]=function(_0x4b1dc0,_0x137247){return db[_0x2755('0x2a')][_0x2755('0x44')]({'where':{'id':_0x4b1dc0[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x137247,null))[_0x2755('0x25')](removeEntity(_0x137247,null))[_0x2755('0x41')](handleError(_0x137247,null));};exports[_0x2755('0x45')]=function(_0x8038f9,_0x502497,_0x1e842e){return db[_0x2755('0x46')][_0x2755('0x44')]({'where':{'id':_0x8038f9[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x502497,null))[_0x2755('0x25')](function(_0x23f583){if(_0x23f583){return _0x23f583['addConditions'](_0x8038f9[_0x2755('0x43')]['ids'],_[_0x2755('0x47')](_0x8038f9[_0x2755('0x43')],[_0x2755('0x48'),'id'])||{});}})[_0x2755('0x25')](respondWithResult(_0x502497,null))[_0x2755('0x41')](handleError(_0x502497,null));};exports['getConditions']=function(_0x52ffb0,_0x439a13,_0x118b4f){var _0x1d1701={};var _0x3b3e5a={};var _0x568fb5;var _0x57232e;return db['Automation'][_0x2755('0x49')]({'where':{'id':_0x52ffb0[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x439a13,null))[_0x2755('0x25')](function(_0x2ed3d3){if(_0x2ed3d3){_0x568fb5=_0x2ed3d3;_0x3b3e5a[_0x2755('0x2f')]=_[_0x2755('0x4a')](db['Condition'][_0x2755('0x2b')]);_0x3b3e5a[_0x2755('0x30')]=_[_0x2755('0x4a')](_0x52ffb0[_0x2755('0x30')]);_0x3b3e5a[_0x2755('0x39')]=_[_0x2755('0x31')](_0x3b3e5a[_0x2755('0x2f')],_0x3b3e5a[_0x2755('0x30')]);_0x1d1701[_0x2755('0x32')]=_['intersection'](_0x3b3e5a['model'],qs[_0x2755('0x33')](_0x52ffb0[_0x2755('0x30')][_0x2755('0x33')]));_0x1d1701['attributes']=_0x1d1701['attributes'][_0x2755('0x34')]?_0x1d1701['attributes']:_0x3b3e5a[_0x2755('0x2f')];_0x1d1701[_0x2755('0x4b')]=qs[_0x2755('0x37')](_0x52ffb0['query']['sort']);_0x1d1701['where']=qs[_0x2755('0x39')](_[_0x2755('0x4c')](_0x52ffb0[_0x2755('0x30')],_0x3b3e5a['filters']));if(_0x52ffb0[_0x2755('0x30')][_0x2755('0x3a')]){_0x1d1701['where']=_[_0x2755('0x3b')](_0x1d1701['where'],{'$or':_[_0x2755('0x29')](_0x1d1701['attributes'],function(_0x53850a){var _0x50d699={};_0x50d699[_0x53850a]={'$like':'%'+_0x52ffb0[_0x2755('0x30')][_0x2755('0x3a')]+'%'};return _0x50d699;})});}_0x1d1701=_[_0x2755('0x3b')]({},_0x1d1701,_0x52ffb0[_0x2755('0x40')]);return _0x568fb5[_0x2755('0x4d')](_0x1d1701);}})[_0x2755('0x25')](function(_0x2663e5){if(_0x2663e5){_0x57232e=_0x2663e5[_0x2755('0x34')];if(!_0x52ffb0['query']['hasOwnProperty']('nolimit')){_0x1d1701[_0x2755('0x1f')]=qs[_0x2755('0x1f')](_0x52ffb0['query'][_0x2755('0x1f')]);_0x1d1701[_0x2755('0x1c')]=qs['offset'](_0x52ffb0[_0x2755('0x30')][_0x2755('0x1c')]);}return _0x568fb5[_0x2755('0x4d')](_0x1d1701);}})[_0x2755('0x25')](function(_0x4f3d89){if(_0x4f3d89){return _0x4f3d89?{'count':_0x57232e,'rows':_0x4f3d89}:null;}})[_0x2755('0x25')](respondWithResult(_0x439a13,null))[_0x2755('0x41')](handleError(_0x439a13,null));};exports['addActions']=function(_0x2ec3d0,_0x36ee1b,_0x46eeb3){return db[_0x2755('0x4e')]['find']({'where':{'id':_0x2ec3d0[_0x2755('0x3e')]['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x36ee1b,null))[_0x2755('0x25')](function(_0x1f034e){if(_0x1f034e){return _0x1f034e['addActions'](_0x2ec3d0[_0x2755('0x43')][_0x2755('0x48')],_[_0x2755('0x47')](_0x2ec3d0['body'],[_0x2755('0x48'),'id'])||{});}})[_0x2755('0x25')](respondWithResult(_0x36ee1b,null))[_0x2755('0x41')](handleError(_0x36ee1b,null));};exports['getActions']=function(_0x4c45b0,_0x2efecd,_0x435a80){var _0x1bbc70={};var _0x46330f={};var _0xf01d64;var _0xd11e88;return db[_0x2755('0x2a')][_0x2755('0x49')]({'where':{'id':_0x4c45b0['params']['id']}})[_0x2755('0x25')](handleEntityNotFound(_0x2efecd,null))[_0x2755('0x25')](function(_0xb2ff38){if(_0xb2ff38){_0xf01d64=_0xb2ff38;_0x46330f[_0x2755('0x2f')]=_[_0x2755('0x4a')](db[_0x2755('0x4e')][_0x2755('0x2b')]);_0x46330f['query']=_[_0x2755('0x4a')](_0x4c45b0[_0x2755('0x30')]);_0x46330f[_0x2755('0x39')]=_[_0x2755('0x31')](_0x46330f[_0x2755('0x2f')],_0x46330f['query']);_0x1bbc70['attributes']=_[_0x2755('0x31')](_0x46330f[_0x2755('0x2f')],qs[_0x2755('0x33')](_0x4c45b0[_0x2755('0x30')][_0x2755('0x33')]));_0x1bbc70[_0x2755('0x32')]=_0x1bbc70[_0x2755('0x32')][_0x2755('0x34')]?_0x1bbc70['attributes']:_0x46330f[_0x2755('0x2f')];_0x1bbc70[_0x2755('0x4b')]=qs['sort'](_0x4c45b0[_0x2755('0x30')][_0x2755('0x37')]);_0x1bbc70['where']=qs[_0x2755('0x39')](_[_0x2755('0x4c')](_0x4c45b0['query'],_0x46330f['filters']));if(_0x4c45b0['query'][_0x2755('0x3a')]){_0x1bbc70[_0x2755('0x38')]=_['merge'](_0x1bbc70['where'],{'$or':_['map'](_0x1bbc70['attributes'],function(_0x2ac0a8){var _0x5967d6={};_0x5967d6[_0x2ac0a8]={'$like':'%'+_0x4c45b0['query'][_0x2755('0x3a')]+'%'};return _0x5967d6;})});}_0x1bbc70=_[_0x2755('0x3b')]({},_0x1bbc70,_0x4c45b0[_0x2755('0x40')]);return _0xf01d64[_0x2755('0x4f')](_0x1bbc70);}})[_0x2755('0x25')](function(_0x3fea2d){if(_0x3fea2d){_0xd11e88=_0x3fea2d[_0x2755('0x34')];if(!_0x4c45b0[_0x2755('0x30')][_0x2755('0x35')](_0x2755('0x36'))){_0x1bbc70[_0x2755('0x1f')]=qs[_0x2755('0x1f')](_0x4c45b0[_0x2755('0x30')][_0x2755('0x1f')]);_0x1bbc70[_0x2755('0x1c')]=qs['offset'](_0x4c45b0[_0x2755('0x30')][_0x2755('0x1c')]);}return _0xf01d64[_0x2755('0x4f')](_0x1bbc70);}})['then'](function(_0x5ed979){if(_0x5ed979){return _0x5ed979?{'count':_0xd11e88,'rows':_0x5ed979}:null;}})[_0x2755('0x25')](respondWithResult(_0x2efecd,null))[_0x2755('0x41')](handleError(_0x2efecd,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 3fbc196..f2c7cb8 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 _0xa80f=['define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x30b2c6,_0x1eafe8){var _0x42052d=function(_0xfeb539){while(--_0xfeb539){_0x30b2c6['push'](_0x30b2c6['shift']());}};_0x42052d(++_0x1eafe8);}(_0xa80f,0x17c));var _0xfa80=function(_0x5a57c6,_0x394b7d){_0x5a57c6=_0x5a57c6-0x0;var _0x509601=_0xa80f[_0x5a57c6];return _0x509601;};'use strict';var _=require(_0xfa80('0x0'));var util=require(_0xfa80('0x1'));var logger=require(_0xfa80('0x2'))(_0xfa80('0x3'));var moment=require(_0xfa80('0x4'));var BPromise=require(_0xfa80('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa80('0x6'));var rimraf=require(_0xfa80('0x7'));var config=require(_0xfa80('0x8'));var attributes=require(_0xfa80('0x9'));module['exports']=function(_0xe5a2a0,_0x1c5bd7){return _0xe5a2a0[_0xfa80('0xa')](_0xfa80('0xb'),attributes,{'tableName':_0xfa80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af9=['api','moment','request-promise','rimraf','exports','define','Automation','tools_automations','lodash','../../config/logger'];(function(_0x275621,_0x524302){var _0x2ad056=function(_0x1e962f){while(--_0x1e962f){_0x275621['push'](_0x275621['shift']());}};_0x2ad056(++_0x524302);}(_0x4af9,0xda));var _0x94af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4af9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x94af('0x0'));var util=require('util');var logger=require(_0x94af('0x1'))(_0x94af('0x2'));var moment=require(_0x94af('0x3'));var BPromise=require('bluebird');var rp=require(_0x94af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94af('0x5'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x94af('0x6')]=function(_0x354c4b,_0x222989){return _0x354c4b[_0x94af('0x7')](_0x94af('0x8'),attributes,{'tableName':_0x94af('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 e742f0e..ee1218c 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 _0x0b0e=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','debug'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c5ad6,_0x47b7bf){_0x3c5ad6=_0x3c5ad6-0x0;var _0x3154f2=_0x0b0e[_0x3c5ad6];return _0x3154f2;};'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});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Automation,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x146ebc,_0x1124d0){_0x146ebc=_0x146ebc-0x0;var _0x22c869=_0xb03e[_0x146ebc];return _0x22c869;};'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')]('Automation,\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')]('Automation,\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);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3ed5275..25e6e75 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 _0xd0a2=['/:id','/:id/conditions','/:id/actions','getActions','post','create','addConditions','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index'];(function(_0x105e11,_0x128087){var _0x3cc2e5=function(_0x3aec6d){while(--_0x3aec6d){_0x105e11['push'](_0x105e11['shift']());}};_0x3cc2e5(++_0x128087);}(_0xd0a2,0x128));var _0x2d0a=function(_0xfadc1a,_0xc6a189){_0xfadc1a=_0xfadc1a-0x0;var _0x1be3a4=_0xd0a2[_0xfadc1a];return _0x1be3a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d0a('0x0'));var timeout=require(_0x2d0a('0x1'));var express=require(_0x2d0a('0x2'));var router=express[_0x2d0a('0x3')]();var fs_extra=require(_0x2d0a('0x4'));var auth=require(_0x2d0a('0x5'));var interaction=require(_0x2d0a('0x6'));var config=require(_0x2d0a('0x7'));var controller=require(_0x2d0a('0x8'));router[_0x2d0a('0x9')]('/',auth[_0x2d0a('0xa')](),controller[_0x2d0a('0xb')]);router[_0x2d0a('0x9')](_0x2d0a('0xc'),auth[_0x2d0a('0xa')](),controller['show']);router[_0x2d0a('0x9')](_0x2d0a('0xd'),auth[_0x2d0a('0xa')](),controller['getConditions']);router[_0x2d0a('0x9')](_0x2d0a('0xe'),auth[_0x2d0a('0xa')](),controller[_0x2d0a('0xf')]);router[_0x2d0a('0x10')]('/',auth[_0x2d0a('0xa')](),controller[_0x2d0a('0x11')]);router[_0x2d0a('0x10')]('/:id/conditions',auth[_0x2d0a('0xa')](),controller[_0x2d0a('0x12')]);router[_0x2d0a('0x10')](_0x2d0a('0xe'),auth[_0x2d0a('0xa')](),controller['addActions']);router[_0x2d0a('0x13')](_0x2d0a('0xc'),auth[_0x2d0a('0xa')](),controller['update']);router[_0x2d0a('0x14')](_0x2d0a('0xc'),auth[_0x2d0a('0xa')](),controller['destroy']);module[_0x2d0a('0x15')]=router; \ No newline at end of file +var _0x7df1=['/:id/actions','post','/:id/conditions','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','show','getConditions'];(function(_0x3dacef,_0x513c82){var _0x14e9b5=function(_0xb1ba8c){while(--_0xb1ba8c){_0x3dacef['push'](_0x3dacef['shift']());}};_0x14e9b5(++_0x513c82);}(_0x7df1,0xe4));var _0x17df=function(_0x3d8b32,_0x5381e0){_0x3d8b32=_0x3d8b32-0x0;var _0xf081c3=_0x7df1[_0x3d8b32];return _0xf081c3;};'use strict';var multer=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var path=require(_0x17df('0x2'));var timeout=require('connect-timeout');var express=require(_0x17df('0x3'));var router=express[_0x17df('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x17df('0x5'));var config=require(_0x17df('0x6'));var controller=require(_0x17df('0x7'));router['get']('/',auth[_0x17df('0x8')](),controller['index']);router[_0x17df('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x17df('0xa')]);router[_0x17df('0x9')]('/:id/conditions',auth[_0x17df('0x8')](),controller[_0x17df('0xb')]);router[_0x17df('0x9')](_0x17df('0xc'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x17df('0x8')](),controller['create']);router[_0x17df('0xd')](_0x17df('0xe'),auth['isAuthenticated'](),controller['addConditions']);router[_0x17df('0xd')](_0x17df('0xc'),auth[_0x17df('0x8')](),controller['addActions']);router[_0x17df('0xf')](_0x17df('0x10'),auth[_0x17df('0x8')](),controller[_0x17df('0x11')]);router[_0x17df('0x12')](_0x17df('0x10'),auth[_0x17df('0x8')](),controller[_0x17df('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index eebafd1..73e26ed 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 _0x4e63=['exports','ENUM','STRING','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e63,0x1ad));var _0x34e6=function(_0x200770,_0x4391ed){_0x200770=_0x200770-0x0;var _0x303db6=_0x4e63[_0x200770];return _0x303db6;};'use strict';var Sequelize=require('sequelize');module[_0x34e6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x34e6('0x1')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x34e6('0x2')]},'active':{'type':Sequelize[_0x34e6('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x34e6('0x4')](0x4)[_0x34e6('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x34e6('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x34e6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x34e6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x34e6('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x34e6('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0x9')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x34e6('0x4')](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'comment':_0x34e6('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x34e6('0xe')},'dialTimezone':{'type':Sequelize[_0x34e6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x34e6('0x2')],'defaultValue':_0x34e6('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x34e6('0x1')](_0x34e6('0x10'),_0x34e6('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x34e6('0x3')],'defaultValue':0x0,'comment':_0x34e6('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x34e6('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x34e6('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x34e6('0x4')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x34e6('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x34e6('0x4')](0x9)[_0x34e6('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x34e6('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x34e6('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x34e6('0x4')](0x9)[_0x34e6('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x34e6('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x34e6('0x4')](0x9)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x34e6('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x34e6('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x34e6('0x4')](0x9)[_0x34e6('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x34e6('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x34e6('0x1')](_0x34e6('0x1a'),_0x34e6('0x1b')),'defaultValue':_0x34e6('0x1a')},'dialPrefix':{'type':Sequelize[_0x34e6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x34e6('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x34e6('0x1c')},'dialCutDigit':{'type':Sequelize[_0x34e6('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x34e6('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x34e6('0x4')](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x34e6('0x4')](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x34e6('0x4')](0x5)[_0x34e6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x34e6('0x4')](0x3)[_0x34e6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x34e6('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x34e6('0x26')}}; \ No newline at end of file +var _0xf9ae=['onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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)','exports','name','ENUM','ivr','STRING','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf9ae,0x19b));var _0xef9a=function(_0x5c77b1,_0x180269){_0x5c77b1=_0x5c77b1-0x0;var _0x401464=_0xf9ae[_0x5c77b1];return _0x401464;};'use strict';var Sequelize=require('sequelize');module[_0xef9a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xef9a('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xef9a('0x2')](_0xef9a('0x3')),'allowNull':![],'defaultValue':_0xef9a('0x3')},'description':{'type':Sequelize[_0xef9a('0x4')]},'active':{'type':Sequelize[_0xef9a('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xef9a('0x6')](0x4)[_0xef9a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xef9a('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xef9a('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'comment':_0xef9a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xef9a('0xf')},'dialTimezone':{'type':Sequelize[_0xef9a('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xef9a('0x4')],'defaultValue':_0xef9a('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xef9a('0x2')]('always',_0xef9a('0x11'),_0xef9a('0x12')),'defaultValue':_0xef9a('0x13')},'dialAMDActive':{'type':Sequelize[_0xef9a('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xef9a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xef9a('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xef9a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xef9a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xef9a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xef9a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xef9a('0x6')](0x9)[_0xef9a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xef9a('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xef9a('0x6')](0x9)[_0xef9a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xef9a('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xef9a('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xef9a('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xef9a('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xef9a('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xef9a('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xef9a('0x6')](0x9)[_0xef9a('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xef9a('0x2')]('DESC',_0xef9a('0x1c')),'defaultValue':_0xef9a('0x1d')},'dialPrefix':{'type':Sequelize[_0xef9a('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xef9a('0x1e')},'dialCutDigit':{'type':Sequelize[_0xef9a('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xef9a('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xef9a('0x6')](0x3)[_0xef9a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xef9a('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xef9a('0x6')](0x5)[_0xef9a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fcddeb3..a75c7a8 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 _0xa571=['status','json','undefined','limit','count','offset','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','params','getHoppers','CmHopper','pick','CampaignId','filter','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','format','addLists','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','select','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','NOW()','insert','into','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa571,0x107));var _0x1a57=function(_0x26cc10,_0x24dd3b){_0x26cc10=_0x26cc10-0x0;var _0xb7cbec=_0xa571[_0x26cc10];return _0xb7cbec;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){var _0x26cdd3=_0x35d5dc[_0x1a57('0x23')]({'plain':!![]});var _0x2f9454=_0x1a57('0x24');return db[_0x1a57('0x25')][_0x1a57('0x22')]({'where':{'type':_0x2f9454,'resourceId':_0x26cdd3['id']}})[_0x1a57('0x21')](function(){return _0x35d5dc;});})[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x26')]();});}};}function handleEntityNotFound(_0x5a53c8,_0x530401){return function(_0x139d8c){if(!_0x139d8c){_0x5a53c8[_0x1a57('0x18')](0x194);}return _0x139d8c;};}function handleError(_0x545041,_0x46dac6){_0x46dac6=_0x46dac6||0x1f4;return function(_0x54f6a5){logger[_0x1a57('0x27')](_0x54f6a5[_0x1a57('0x28')]);if(_0x54f6a5['name']){delete _0x54f6a5[_0x1a57('0x29')];}_0x545041[_0x1a57('0x19')](_0x46dac6)[_0x1a57('0x2a')](_0x54f6a5);};}exports[_0x1a57('0x2b')]=function(_0x492b90,_0x366d5f){var _0x396832={},_0x4374f0={},_0x160536={'count':0x0,'rows':[]};var _0x5763ba=_[_0x1a57('0x2c')](db[_0x1a57('0x2d')][_0x1a57('0x2e')],function(_0x32f79f){return{'name':_0x32f79f[_0x1a57('0x2f')],'type':_0x32f79f[_0x1a57('0x30')][_0x1a57('0x31')]};});_0x4374f0[_0x1a57('0x32')]=_[_0x1a57('0x2c')](_0x5763ba,'name');_0x4374f0[_0x1a57('0x33')]=_[_0x1a57('0x34')](_0x492b90['query']);_0x4374f0['filters']=_[_0x1a57('0x35')](_0x4374f0[_0x1a57('0x32')],_0x4374f0[_0x1a57('0x33')]);_0x396832[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x4374f0[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x492b90[_0x1a57('0x33')][_0x1a57('0x37')]));_0x396832[_0x1a57('0x36')]=_0x396832[_0x1a57('0x36')][_0x1a57('0x38')]?_0x396832[_0x1a57('0x36')]:_0x4374f0[_0x1a57('0x32')];if(!_0x492b90[_0x1a57('0x33')][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x396832[_0x1a57('0x1c')]=qs['limit'](_0x492b90[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x396832[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x492b90[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x396832[_0x1a57('0x3b')]=qs[_0x1a57('0x3c')](_0x492b90[_0x1a57('0x33')]['sort']);_0x396832['where']=qs['filters'](_['pick'](_0x492b90[_0x1a57('0x33')],_0x4374f0[_0x1a57('0x3d')]),_0x5763ba);if(_0x492b90[_0x1a57('0x33')]['filter']){_0x396832[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x396832[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x5763ba,function(_0x5bf186){if(_0x5bf186[_0x1a57('0x30')]!=='VIRTUAL'){var _0xd39e5a={};_0xd39e5a[_0x5bf186[_0x1a57('0x29')]]={'$like':'%'+_0x492b90[_0x1a57('0x33')]['filter']+'%'};return _0xd39e5a;}})});}_0x396832=_[_0x1a57('0x3f')]({},_0x396832,_0x492b90[_0x1a57('0x40')]);var _0x61e9f6={'where':_0x396832[_0x1a57('0x3e')]};return db[_0x1a57('0x2d')]['count'](_0x61e9f6)[_0x1a57('0x21')](function(_0x47e998){_0x160536['count']=_0x47e998;if(_0x492b90[_0x1a57('0x33')]['includeAll']){_0x396832[_0x1a57('0x41')]=[{'all':!![]}];}return db[_0x1a57('0x2d')][_0x1a57('0x42')](_0x396832);})['then'](function(_0x188a50){_0x160536[_0x1a57('0x43')]=_0x188a50;return _0x160536;})[_0x1a57('0x21')](respondWithFilteredResult(_0x366d5f,_0x396832))[_0x1a57('0x44')](handleError(_0x366d5f,null));};exports['show']=function(_0xc7bab4,_0x150fb6){var _0x4fdd29={'raw':![],'where':{'id':_0xc7bab4['params']['id']}},_0x32d05b={};_0x32d05b['model']=_[_0x1a57('0x34')](db[_0x1a57('0x2d')][_0x1a57('0x2e')]);_0x32d05b[_0x1a57('0x33')]=_['keys'](_0xc7bab4[_0x1a57('0x33')]);_0x32d05b[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0x32d05b[_0x1a57('0x32')],_0x32d05b[_0x1a57('0x33')]);_0x4fdd29['attributes']=_[_0x1a57('0x35')](_0x32d05b[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0xc7bab4[_0x1a57('0x33')]['fields']));_0x4fdd29[_0x1a57('0x36')]=_0x4fdd29['attributes'][_0x1a57('0x38')]?_0x4fdd29[_0x1a57('0x36')]:_0x32d05b[_0x1a57('0x32')];if(_0xc7bab4[_0x1a57('0x33')][_0x1a57('0x45')]){_0x4fdd29[_0x1a57('0x41')]=[{'all':!![]}];}_0x4fdd29=_[_0x1a57('0x3f')]({},_0x4fdd29,_0xc7bab4[_0x1a57('0x40')]);return db[_0x1a57('0x2d')][_0x1a57('0x46')](_0x4fdd29)[_0x1a57('0x21')](handleEntityNotFound(_0x150fb6,null))[_0x1a57('0x21')](respondWithResult(_0x150fb6,null))[_0x1a57('0x44')](handleError(_0x150fb6,null));};exports['create']=function(_0xf4d056,_0x480aff){return db[_0x1a57('0x2d')][_0x1a57('0x47')](_0xf4d056[_0x1a57('0x48')],{})[_0x1a57('0x21')](function(_0x323af1){var _0x3cbb9e=_0xf4d056[_0x1a57('0x49')][_0x1a57('0x23')]({'plain':!![]});if(!_0x3cbb9e)throw new Error(_0x1a57('0x4a'));if(_0x3cbb9e['role']===_0x1a57('0x49')){var _0x439a42=_0x323af1['get']({'plain':!![]});var _0x15f1f5=_0x1a57('0x24');return db['UserProfileSection'][_0x1a57('0x46')]({'where':{'name':_0x15f1f5,'userProfileId':_0x3cbb9e[_0x1a57('0x4b')]},'raw':!![]})['then'](function(_0x4d3177){if(_0x4d3177&&_0x4d3177['autoAssociation']===0x0){return db[_0x1a57('0x25')][_0x1a57('0x47')]({'name':_0x439a42['name'],'resourceId':_0x439a42['id'],'type':_0x4d3177[_0x1a57('0x29')],'sectionId':_0x4d3177['id']},{})[_0x1a57('0x21')](function(){return _0x323af1;});}else{return _0x323af1;}})['catch'](function(_0x5e510e){logger['error'](_0x1a57('0x4c'),_0x5e510e);throw _0x5e510e;});}return _0x323af1;})[_0x1a57('0x21')](respondWithResult(_0x480aff,0xc9))[_0x1a57('0x44')](handleError(_0x480aff,null));};exports[_0x1a57('0x4d')]=function(_0x28738e,_0x33379c){var _0xd64b3a={'where':{'id':_0x28738e['params']['id']}},_0x1f705b={};_0x1f705b['model']=_['keys'](db['Campaign']['rawAttributes']);_0xd64b3a[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x1f705b[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x28738e[_0x1a57('0x33')][_0x1a57('0x37')]));_0xd64b3a[_0x1a57('0x36')]=_0xd64b3a[_0x1a57('0x36')]['length']?_0xd64b3a['attributes']:_0x1f705b['model'];if(_0x28738e[_0x1a57('0x33')]['includeAll']){_0xd64b3a[_0x1a57('0x41')]=[{'all':!![]}];}_0xd64b3a=_[_0x1a57('0x3f')]({},_0xd64b3a,_0x28738e[_0x1a57('0x40')]);return db[_0x1a57('0x2d')][_0x1a57('0x46')](_0xd64b3a)[_0x1a57('0x21')](handleEntityNotFound(_0x33379c,null))[_0x1a57('0x21')](function(_0x561add){if(_0x561add){var _0x4e56b5=_0x561add['get']({'plain':!![]});_0x4e56b5=qs[_0x1a57('0x4e')](_0x4e56b5,['id',_0x1a57('0x4f'),_0x1a57('0x50')]);_0x28738e[_0x1a57('0x48')]=_[_0x1a57('0x4e')](_0x28738e[_0x1a57('0x48')],['id',_0x1a57('0x4f'),'updatedAt']);return db['Campaign'][_0x1a57('0x47')](_[_0x1a57('0x3f')](_0x4e56b5,_0x28738e[_0x1a57('0x48')]),{'include':_0x28738e[_0x1a57('0x33')][_0x1a57('0x45')]?[{'all':!![]}]:undefined})[_0x1a57('0x21')](function(_0x59a731){var _0x47db75=_0x28738e[_0x1a57('0x49')][_0x1a57('0x23')]({'plain':!![]});if(!_0x47db75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47db75['role']===_0x1a57('0x49')){var _0x3a8806=_0x59a731[_0x1a57('0x23')]({'plain':!![]});var _0x10ceb8=_0x1a57('0x24');return db[_0x1a57('0x51')][_0x1a57('0x46')]({'where':{'name':_0x10ceb8,'userProfileId':_0x47db75['userProfileId']},'raw':!![]})['then'](function(_0x2fbf49){if(_0x2fbf49&&_0x2fbf49[_0x1a57('0x52')]===0x0){return db[_0x1a57('0x25')][_0x1a57('0x47')]({'name':_0x3a8806['name'],'resourceId':_0x3a8806['id'],'type':_0x2fbf49[_0x1a57('0x29')],'sectionId':_0x2fbf49['id']},{})[_0x1a57('0x21')](function(){return _0x59a731;});}else{return _0x59a731;}})[_0x1a57('0x44')](function(_0x33c8d4){logger[_0x1a57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33c8d4);throw _0x33c8d4;});}return _0x59a731;});}})['then'](respondWithResult(_0x33379c,0xc9))['catch'](handleError(_0x33379c,null));};exports[_0x1a57('0x20')]=function(_0x223ba5,_0x1e2df1){if(_0x223ba5[_0x1a57('0x48')]['id']){delete _0x223ba5[_0x1a57('0x48')]['id'];}return db[_0x1a57('0x2d')][_0x1a57('0x46')]({'where':{'id':_0x223ba5[_0x1a57('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e2df1,null))[_0x1a57('0x21')](saveUpdates(_0x223ba5[_0x1a57('0x48')],null))['then'](respondWithResult(_0x1e2df1,null))['catch'](handleError(_0x1e2df1,null));};exports[_0x1a57('0x22')]=function(_0x5be7b4,_0x2ebd9c){return db[_0x1a57('0x2d')][_0x1a57('0x46')]({'where':{'id':_0x5be7b4[_0x1a57('0x53')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x2ebd9c,null))[_0x1a57('0x21')](removeEntity(_0x2ebd9c,null))[_0x1a57('0x44')](handleError(_0x2ebd9c,null));};exports[_0x1a57('0x54')]=function(_0x5ae6ae,_0x7783ec,_0xc33b56){var _0x5e5b2f={'raw':!![],'where':{}};var _0x24b56c={};var _0x392f49={'count':0x0,'rows':[]};return db[_0x1a57('0x2d')]['findOne']({'where':{'id':_0x5ae6ae['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x7783ec,null))[_0x1a57('0x21')](function(_0x3c5840){if(_0x3c5840){_0x24b56c[_0x1a57('0x32')]=_['keys'](db[_0x1a57('0x55')][_0x1a57('0x2e')]);_0x24b56c[_0x1a57('0x33')]=_[_0x1a57('0x34')](_0x5ae6ae[_0x1a57('0x33')]);_0x24b56c['filters']=_[_0x1a57('0x35')](_0x24b56c[_0x1a57('0x32')],_0x24b56c[_0x1a57('0x33')]);_0x5e5b2f[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x24b56c[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x5ae6ae[_0x1a57('0x33')][_0x1a57('0x37')]));_0x5e5b2f[_0x1a57('0x36')]=_0x5e5b2f[_0x1a57('0x36')]['length']?_0x5e5b2f[_0x1a57('0x36')]:_0x24b56c[_0x1a57('0x32')];if(!_0x5ae6ae['query'][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x5e5b2f['limit']=qs[_0x1a57('0x1c')](_0x5ae6ae[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x5e5b2f[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x5ae6ae[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x5e5b2f[_0x1a57('0x3b')]=qs['sort'](_0x5ae6ae[_0x1a57('0x33')][_0x1a57('0x3c')]);_0x5e5b2f['where']=qs[_0x1a57('0x3d')](_[_0x1a57('0x56')](_0x5ae6ae[_0x1a57('0x33')],_0x24b56c[_0x1a57('0x3d')]));_0x5e5b2f[_0x1a57('0x3e')][_0x1a57('0x57')]=_0x3c5840['id'];if(_0x5ae6ae[_0x1a57('0x33')][_0x1a57('0x58')]){_0x5e5b2f[_0x1a57('0x3e')]=_['merge'](_0x5e5b2f[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x5e5b2f[_0x1a57('0x36')],function(_0x1e4d4e){var _0x12ae08={};_0x12ae08[_0x1e4d4e]={'$like':'%'+_0x5ae6ae['query'][_0x1a57('0x58')]+'%'};return _0x12ae08;})});}_0x5e5b2f=_[_0x1a57('0x3f')]({},_0x5e5b2f,_0x5ae6ae[_0x1a57('0x40')]);return db[_0x1a57('0x55')][_0x1a57('0x1d')]({'where':_0x5e5b2f[_0x1a57('0x3e')]})[_0x1a57('0x21')](function(_0x2831f7){_0x392f49['count']=_0x2831f7;if(_0x5ae6ae[_0x1a57('0x33')][_0x1a57('0x45')]){_0x5e5b2f[_0x1a57('0x41')]=[{'all':!![]}];}return db[_0x1a57('0x55')]['findAll'](_0x5e5b2f);})['then'](function(_0x49f809){_0x392f49['rows']=_0x49f809;return _0x392f49;});}})['then'](respondWithFilteredResult(_0x7783ec,_0x5e5b2f))[_0x1a57('0x44')](handleError(_0x7783ec,null));};exports[_0x1a57('0x59')]=function(_0x5e640b,_0x3219ce,_0x19f1d5){var _0x5f4509={'raw':!![],'where':{}};var _0x758985={};var _0x1fbcb1={'count':0x0,'rows':[]};return db[_0x1a57('0x2d')][_0x1a57('0x5a')]({'where':{'id':_0x5e640b['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x3219ce,null))[_0x1a57('0x21')](function(_0x4c66e3){if(_0x4c66e3){_0x758985[_0x1a57('0x32')]=_[_0x1a57('0x34')](db[_0x1a57('0x5b')][_0x1a57('0x2e')]);_0x758985[_0x1a57('0x33')]=_[_0x1a57('0x34')](_0x5e640b[_0x1a57('0x33')]);_0x758985['filters']=_[_0x1a57('0x35')](_0x758985['model'],_0x758985[_0x1a57('0x33')]);_0x5f4509[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x758985[_0x1a57('0x32')],qs['fields'](_0x5e640b[_0x1a57('0x33')][_0x1a57('0x37')]));_0x5f4509[_0x1a57('0x36')]=_0x5f4509['attributes'][_0x1a57('0x38')]?_0x5f4509[_0x1a57('0x36')]:_0x758985[_0x1a57('0x32')];if(!_0x5e640b['query'][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x5f4509[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x5e640b[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x5f4509[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x5e640b[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x5f4509[_0x1a57('0x3b')]=qs['sort'](_0x5e640b[_0x1a57('0x33')]['sort']);_0x5f4509[_0x1a57('0x3e')]=qs['filters'](_['pick'](_0x5e640b['query'],_0x758985['filters']));_0x5f4509[_0x1a57('0x3e')][_0x1a57('0x57')]=_0x4c66e3['id'];if(_0x5e640b[_0x1a57('0x33')]['filter']){_0x5f4509[_0x1a57('0x3e')]=_['merge'](_0x5f4509[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x5f4509[_0x1a57('0x36')],function(_0x597c28){var _0x1000e5={};_0x1000e5[_0x597c28]={'$like':'%'+_0x5e640b[_0x1a57('0x33')]['filter']+'%'};return _0x1000e5;})});}_0x5f4509=_['merge']({},_0x5f4509,_0x5e640b[_0x1a57('0x40')]);return db['CmHopperHistory'][_0x1a57('0x1d')]({'where':_0x5f4509[_0x1a57('0x3e')]})['then'](function(_0x45afe5){_0x1fbcb1[_0x1a57('0x1d')]=_0x45afe5;if(_0x5e640b['query'][_0x1a57('0x45')]){_0x5f4509[_0x1a57('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x5f4509);})[_0x1a57('0x21')](function(_0x4dd78e){_0x1fbcb1[_0x1a57('0x43')]=_0x4dd78e;return _0x1fbcb1;});}})[_0x1a57('0x21')](respondWithFilteredResult(_0x3219ce,_0x5f4509))[_0x1a57('0x44')](handleError(_0x3219ce,null));};exports[_0x1a57('0x5c')]=function(_0x1e4456,_0x46337f,_0x3770b9){var _0x4db879={'raw':!![],'where':{}};var _0xe7a762={};var _0x272589={'count':0x0,'rows':[]};return db[_0x1a57('0x2d')]['findOne']({'where':{'id':_0x1e4456['params']['id']}})['then'](handleEntityNotFound(_0x46337f,null))[_0x1a57('0x21')](function(_0x297300){if(_0x297300){_0xe7a762['model']=_['keys'](db[_0x1a57('0x5d')][_0x1a57('0x2e')]);_0xe7a762[_0x1a57('0x33')]=_['keys'](_0x1e4456[_0x1a57('0x33')]);_0xe7a762[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0xe7a762[_0x1a57('0x32')],_0xe7a762['query']);_0x4db879[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0xe7a762[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x1e4456[_0x1a57('0x33')][_0x1a57('0x37')]));_0x4db879[_0x1a57('0x36')]=_0x4db879[_0x1a57('0x36')][_0x1a57('0x38')]?_0x4db879['attributes']:_0xe7a762[_0x1a57('0x32')];if(!_0x1e4456[_0x1a57('0x33')][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x4db879[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x1e4456[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x4db879[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x1e4456[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x4db879[_0x1a57('0x3b')]=qs['sort'](_0x1e4456[_0x1a57('0x33')][_0x1a57('0x3c')]);_0x4db879[_0x1a57('0x3e')]=qs[_0x1a57('0x3d')](_[_0x1a57('0x56')](_0x1e4456[_0x1a57('0x33')],_0xe7a762['filters']));_0x4db879[_0x1a57('0x3e')][_0x1a57('0x57')]=_0x297300['id'];if(_0x1e4456[_0x1a57('0x33')][_0x1a57('0x58')]){_0x4db879[_0x1a57('0x3e')]=_['merge'](_0x4db879[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x4db879['attributes'],function(_0x29bdca){var _0x350dbd={};_0x350dbd[_0x29bdca]={'$like':'%'+_0x1e4456[_0x1a57('0x33')][_0x1a57('0x58')]+'%'};return _0x350dbd;})});}_0x4db879=_['merge']({},_0x4db879,_0x1e4456['options']);return db[_0x1a57('0x5d')][_0x1a57('0x1d')]({'where':_0x4db879['where']})[_0x1a57('0x21')](function(_0x67d85){_0x272589[_0x1a57('0x1d')]=_0x67d85;if(_0x1e4456[_0x1a57('0x33')][_0x1a57('0x45')]){_0x4db879[_0x1a57('0x41')]=[{'all':!![]}];}return db[_0x1a57('0x5d')][_0x1a57('0x42')](_0x4db879);})[_0x1a57('0x21')](function(_0x26d7b8){_0x272589[_0x1a57('0x43')]=_0x26d7b8;return _0x272589;});}})[_0x1a57('0x21')](respondWithFilteredResult(_0x46337f,_0x4db879))['catch'](handleError(_0x46337f,null));};exports[_0x1a57('0x5e')]=function(_0x31805d,_0x30295e,_0x739c6b){var _0x2c40de={'raw':!![],'where':{}};var _0x771d07={};var _0x3d4cab={'count':0x0,'rows':[]};return db[_0x1a57('0x2d')][_0x1a57('0x5a')]({'where':{'id':_0x31805d['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x30295e,null))[_0x1a57('0x21')](function(_0x1ff4fa){if(_0x1ff4fa){_0x771d07[_0x1a57('0x32')]=_[_0x1a57('0x34')](db[_0x1a57('0x5f')][_0x1a57('0x2e')]);_0x771d07['query']=_[_0x1a57('0x34')](_0x31805d[_0x1a57('0x33')]);_0x771d07[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0x771d07[_0x1a57('0x32')],_0x771d07[_0x1a57('0x33')]);_0x2c40de[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x771d07[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x31805d[_0x1a57('0x33')]['fields']));_0x2c40de['attributes']=_0x2c40de[_0x1a57('0x36')]['length']?_0x2c40de[_0x1a57('0x36')]:_0x771d07[_0x1a57('0x32')];if(!_0x31805d[_0x1a57('0x33')][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x2c40de[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x31805d[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x2c40de[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x31805d[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x2c40de['order']=qs['sort'](_0x31805d[_0x1a57('0x33')]['sort']);_0x2c40de[_0x1a57('0x3e')]=qs[_0x1a57('0x3d')](_['pick'](_0x31805d[_0x1a57('0x33')],_0x771d07[_0x1a57('0x3d')]));_0x2c40de[_0x1a57('0x3e')][_0x1a57('0x57')]=_0x1ff4fa['id'];if(_0x31805d[_0x1a57('0x33')][_0x1a57('0x58')]){_0x2c40de[_0x1a57('0x3e')]=_['merge'](_0x2c40de[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x2c40de['attributes'],function(_0x2d37cd){var _0x10217b={};_0x10217b[_0x2d37cd]={'$like':'%'+_0x31805d[_0x1a57('0x33')]['filter']+'%'};return _0x10217b;})});}_0x2c40de=_[_0x1a57('0x3f')]({},_0x2c40de,_0x31805d['options']);return db['CmHopperBlack'][_0x1a57('0x1d')]({'where':_0x2c40de['where']})['then'](function(_0x1779ab){_0x3d4cab[_0x1a57('0x1d')]=_0x1779ab;if(_0x31805d[_0x1a57('0x33')][_0x1a57('0x45')]){_0x2c40de['include']=[{'all':!![]}];}return db[_0x1a57('0x5f')][_0x1a57('0x42')](_0x2c40de);})['then'](function(_0x308e36){_0x3d4cab[_0x1a57('0x43')]=_0x308e36;return _0x3d4cab;});}})[_0x1a57('0x21')](respondWithFilteredResult(_0x30295e,_0x2c40de))[_0x1a57('0x44')](handleError(_0x30295e,null));};exports['getLists']=function(_0x5656e5,_0x2dbb1e,_0x2036f1){var _0x190395={};var _0x37b838={};var _0x561d62;var _0x533af1;return db[_0x1a57('0x2d')]['findOne']({'where':{'id':_0x5656e5['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x2dbb1e,null))[_0x1a57('0x21')](function(_0x44b6f8){if(_0x44b6f8){_0x561d62=_0x44b6f8;_0x37b838[_0x1a57('0x32')]=_[_0x1a57('0x34')](db[_0x1a57('0x60')][_0x1a57('0x2e')]);_0x37b838[_0x1a57('0x33')]=_[_0x1a57('0x34')](_0x5656e5[_0x1a57('0x33')]);_0x37b838[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0x37b838[_0x1a57('0x32')],_0x37b838['query']);_0x190395[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x37b838[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x5656e5[_0x1a57('0x33')][_0x1a57('0x37')]));_0x190395[_0x1a57('0x36')]=_0x190395[_0x1a57('0x36')][_0x1a57('0x38')]?_0x190395[_0x1a57('0x36')]:_0x37b838['model'];_0x190395[_0x1a57('0x3b')]=qs[_0x1a57('0x3c')](_0x5656e5[_0x1a57('0x33')][_0x1a57('0x3c')]);_0x190395[_0x1a57('0x3e')]=qs[_0x1a57('0x3d')](_[_0x1a57('0x56')](_0x5656e5[_0x1a57('0x33')],_0x37b838['filters']));if(_0x5656e5[_0x1a57('0x33')][_0x1a57('0x58')]){_0x190395['where']=_[_0x1a57('0x3f')](_0x190395[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x190395['attributes'],function(_0xdaf58b){var _0x5247c5={};_0x5247c5[_0xdaf58b]={'$like':'%'+_0x5656e5[_0x1a57('0x33')][_0x1a57('0x58')]+'%'};return _0x5247c5;})});}_0x190395=_[_0x1a57('0x3f')]({},_0x190395,_0x5656e5[_0x1a57('0x40')]);return _0x561d62[_0x1a57('0x61')](_0x190395);}})['then'](function(_0x337ce5){if(_0x337ce5){_0x533af1=_0x337ce5[_0x1a57('0x38')];if(!_0x5656e5[_0x1a57('0x33')][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x190395[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x5656e5[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x190395[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x5656e5[_0x1a57('0x33')]['offset']);}return _0x561d62['getLists'](_0x190395);}})[_0x1a57('0x21')](function(_0x4d0799){if(_0x4d0799){return _0x4d0799?{'count':_0x533af1,'rows':_0x4d0799}:null;}})[_0x1a57('0x21')](respondWithResult(_0x2dbb1e,null))[_0x1a57('0x44')](handleError(_0x2dbb1e,null));};exports['addLists']=function(_0x2f9860,_0x8bfcb,_0x4f8f97){var _0x30c86b,_0x584f30;var _0x38d08b=[];var _0x33622a=moment()[_0x1a57('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1a57('0x2d')][_0x1a57('0x46')]({'where':{'id':_0x2f9860[_0x1a57('0x53')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x8bfcb,null))['then'](function(_0x85bec5){if(_0x85bec5){_0x584f30=_0x85bec5;return _0x85bec5[_0x1a57('0x63')](_0x2f9860['body'][_0x1a57('0x64')],_[_0x1a57('0x4e')](_0x2f9860[_0x1a57('0x48')],[_0x1a57('0x64'),'id'])||{});}return null;})['spread'](function(_0x186d91){var _0x6bab68;var _0x2fcd4a;_0x30c86b=_0x186d91||[];var _0x56e2a2=[];if(_0x186d91){for(var _0x8698fe=0x0;_0x8698fe<_0x186d91[_0x1a57('0x38')];_0x8698fe+=0x1){var _0x3e1944=_0x186d91[_0x8698fe]['get']({'plain':!![]});_0x584f30['dialCheckDuplicateType']=_0x2f9860[_0x1a57('0x48')][_0x1a57('0x65')]?_0x2f9860[_0x1a57('0x48')]['dialCheckDuplicateType']:_0x584f30[_0x1a57('0x65')];switch(_0x584f30['dialCheckDuplicateType']){case _0x1a57('0x66'):_0x6bab68=squel['insert']()['into'](_0x1a57('0x67'))[_0x1a57('0x68')]([_0x1a57('0x69'),_0x1a57('0x6a'),_0x1a57('0x6b'),_0x1a57('0x6c'),_0x1a57('0x57'),_0x1a57('0x4f'),'updatedAt'],squel['select']()['field'](_0x1a57('0x69'),'phone')[_0x1a57('0x6d')]('NOW()',_0x1a57('0x6a'))[_0x1a57('0x6d')]('id',_0x1a57('0x6b'))[_0x1a57('0x6d')](_0x3e1944[_0x1a57('0x6e')][_0x1a57('0x6f')](),'ListId')[_0x1a57('0x6d')](_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')](),_0x1a57('0x57'))[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27','createdAt')[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27','updatedAt')[_0x1a57('0x70')](_0x1a57('0x71'))[_0x1a57('0x3e')](_0x1a57('0x72'))['where'](_0x1a57('0x73'),_0x3e1944['CmListId']['toString']())[_0x1a57('0x3e')](_0x1a57('0x74'))[_0x1a57('0x3e')](_0x1a57('0x75'),squel['select']()['field'](_0x1a57('0x76'))[_0x1a57('0x70')]('cm_hopper_final')[_0x1a57('0x3e')]('CampaignId\x20=\x20?',_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')]()))[_0x1a57('0x3e')](_0x1a57('0x75'),squel[_0x1a57('0x77')]()[_0x1a57('0x6d')](_0x1a57('0x78'))[_0x1a57('0x70')](_0x1a57('0x67'))[_0x1a57('0x3e')](_0x1a57('0x79'),_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')]())))[_0x1a57('0x6f')]();break;case _0x1a57('0x7a'):_0x6bab68=squel['insert']()['into']('cm_hopper')[_0x1a57('0x68')]([_0x1a57('0x69'),_0x1a57('0x6a'),'ContactId','ListId',_0x1a57('0x57'),_0x1a57('0x4f'),_0x1a57('0x50')],squel[_0x1a57('0x77')]()[_0x1a57('0x6d')]('phone',_0x1a57('0x69'))[_0x1a57('0x6d')](_0x1a57('0x7b'),_0x1a57('0x6a'))[_0x1a57('0x6d')]('id',_0x1a57('0x6b'))[_0x1a57('0x6d')](_0x3e1944[_0x1a57('0x6e')]['toString'](),'ListId')['field'](_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')](),_0x1a57('0x57'))[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27',_0x1a57('0x4f'))[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27',_0x1a57('0x50'))[_0x1a57('0x70')](_0x1a57('0x71'))['where'](_0x1a57('0x72'))[_0x1a57('0x3e')](_0x1a57('0x73'),_0x3e1944[_0x1a57('0x6e')]['toString']())[_0x1a57('0x3e')](_0x1a57('0x74'))['where'](_0x1a57('0x75'),squel[_0x1a57('0x77')]()[_0x1a57('0x6d')]('COALESCE(phone,\x27\x27)')['from'](_0x1a57('0x67'))[_0x1a57('0x3e')](_0x1a57('0x79'),_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')]())))[_0x1a57('0x6f')]();break;default:_0x6bab68=squel[_0x1a57('0x7c')]()['into'](_0x1a57('0x67'))[_0x1a57('0x68')]([_0x1a57('0x69'),_0x1a57('0x6a'),_0x1a57('0x6b'),'ListId','CampaignId',_0x1a57('0x4f'),_0x1a57('0x50')],squel[_0x1a57('0x77')]()[_0x1a57('0x6d')](_0x1a57('0x69'),'phone')[_0x1a57('0x6d')](_0x1a57('0x7b'),_0x1a57('0x6a'))[_0x1a57('0x6d')]('id',_0x1a57('0x6b'))[_0x1a57('0x6d')](_0x3e1944[_0x1a57('0x6e')][_0x1a57('0x6f')](),'ListId')['field'](_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')](),_0x1a57('0x57'))[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27',_0x1a57('0x4f'))['field']('\x27'+_0x33622a+'\x27','updatedAt')[_0x1a57('0x70')](_0x1a57('0x71'))[_0x1a57('0x3e')](_0x1a57('0x72'))['where']('ListId\x20=\x20?',_0x3e1944[_0x1a57('0x6e')][_0x1a57('0x6f')]())[_0x1a57('0x3e')](_0x1a57('0x74')))[_0x1a57('0x6f')]();}_0x2fcd4a=squel[_0x1a57('0x7c')]()[_0x1a57('0x7d')]('cm_hopper_additional_phones')[_0x1a57('0x68')](['cmHopperId',_0x1a57('0x6a'),_0x1a57('0x69'),_0x1a57('0x7e'),_0x1a57('0x4f'),_0x1a57('0x50')],squel[_0x1a57('0x77')]()['field'](_0x1a57('0x7f'),'id')['field'](_0x1a57('0x7b'),'scheduledAt')[_0x1a57('0x6d')](_0x1a57('0x80'),'phone')[_0x1a57('0x6d')](_0x1a57('0x81'),_0x1a57('0x7e'))[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27','createdAt')[_0x1a57('0x6d')]('\x27'+_0x33622a+'\x27',_0x1a57('0x50'))[_0x1a57('0x70')](_0x1a57('0x82'),'ci')[_0x1a57('0x83')]('cm_hopper','h',_0x1a57('0x84'))[_0x1a57('0x3e')](_0x1a57('0x85'),_0x3e1944[_0x1a57('0x6e')][_0x1a57('0x6f')]())[_0x1a57('0x3e')](_0x1a57('0x86'),_0x2f9860[_0x1a57('0x53')]['id'][_0x1a57('0x6f')]())['where'](_0x1a57('0x87'),_0x33622a))['toString']();_0x56e2a2[_0x1a57('0x88')](db[_0x1a57('0x89')]['query'](_0x6bab68));_0x38d08b[_0x1a57('0x88')](db[_0x1a57('0x89')][_0x1a57('0x33')](_0x2fcd4a));}return BPromise[_0x1a57('0x8a')](_0x56e2a2);}})['then'](function(){return BPromise[_0x1a57('0x8a')](_0x38d08b);})[_0x1a57('0x21')](function(){return _0x30c86b;})['then'](respondWithResult(_0x8bfcb,null))[_0x1a57('0x44')](handleError(_0x8bfcb,null));};exports[_0x1a57('0x8b')]=function(_0x2d944e,_0x2d528a,_0x13fa27){return db[_0x1a57('0x2d')][_0x1a57('0x46')]({'where':{'id':_0x2d944e[_0x1a57('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d528a,null))[_0x1a57('0x21')](function(_0x51b73d){if(_0x51b73d){return _0x51b73d[_0x1a57('0x8b')](_0x2d944e[_0x1a57('0x33')][_0x1a57('0x64')]);}})[_0x1a57('0x21')](function(_0x221622){if(_0x221622){return db[_0x1a57('0x55')][_0x1a57('0x22')]({'where':{'ListId':_0x2d944e[_0x1a57('0x33')]['ids'],'CampaignId':_0x2d944e[_0x1a57('0x53')]['id']}})[_0x1a57('0x21')](function(){return _0x221622;});}})[_0x1a57('0x21')](respondWithStatusCode(_0x2d528a,null))[_0x1a57('0x44')](handleError(_0x2d528a,null));};exports[_0x1a57('0x8c')]=function(_0x4896da,_0x5df8e0,_0x291d5d){var _0x3d7632={};var _0x1440df={};var _0x116a92;var _0x4b9f41;return db[_0x1a57('0x2d')][_0x1a57('0x5a')]({'where':{'id':_0x4896da['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x5df8e0,null))['then'](function(_0x4d7d88){if(_0x4d7d88){_0x116a92=_0x4d7d88;_0x1440df[_0x1a57('0x32')]=_[_0x1a57('0x34')](db['CmList'][_0x1a57('0x2e')]);_0x1440df[_0x1a57('0x33')]=_[_0x1a57('0x34')](_0x4896da[_0x1a57('0x33')]);_0x1440df[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0x1440df[_0x1a57('0x32')],_0x1440df[_0x1a57('0x33')]);_0x3d7632[_0x1a57('0x36')]=_['intersection'](_0x1440df[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x4896da[_0x1a57('0x33')][_0x1a57('0x37')]));_0x3d7632[_0x1a57('0x36')]=_0x3d7632[_0x1a57('0x36')][_0x1a57('0x38')]?_0x3d7632['attributes']:_0x1440df[_0x1a57('0x32')];_0x3d7632[_0x1a57('0x3b')]=qs[_0x1a57('0x3c')](_0x4896da['query'][_0x1a57('0x3c')]);_0x3d7632[_0x1a57('0x3e')]=qs[_0x1a57('0x3d')](_['pick'](_0x4896da[_0x1a57('0x33')],_0x1440df['filters']));if(_0x4896da['query']['filter']){_0x3d7632[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x3d7632[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x3d7632['attributes'],function(_0x4138bd){var _0x1d400e={};_0x1d400e[_0x4138bd]={'$like':'%'+_0x4896da[_0x1a57('0x33')]['filter']+'%'};return _0x1d400e;})});}_0x3d7632=_[_0x1a57('0x3f')]({},_0x3d7632,_0x4896da[_0x1a57('0x40')]);return _0x116a92[_0x1a57('0x8c')](_0x3d7632);}})[_0x1a57('0x21')](function(_0x4d8aeb){if(_0x4d8aeb){_0x4b9f41=_0x4d8aeb[_0x1a57('0x38')];if(!_0x4896da[_0x1a57('0x33')][_0x1a57('0x39')]('nolimit')){_0x3d7632[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x4896da[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x3d7632[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x4896da[_0x1a57('0x33')][_0x1a57('0x1e')]);}return _0x116a92['getBlackLists'](_0x3d7632);}})[_0x1a57('0x21')](function(_0xeaebb5){if(_0xeaebb5){return _0xeaebb5?{'count':_0x4b9f41,'rows':_0xeaebb5}:null;}})[_0x1a57('0x21')](respondWithResult(_0x5df8e0,null))[_0x1a57('0x44')](handleError(_0x5df8e0,null));};exports[_0x1a57('0x8d')]=function(_0x5d9afb,_0x1a863d,_0x4cfdef){var _0x2f2698,_0x2b2165;var _0x412c11=[];var _0x4363d1=moment()[_0x1a57('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x1a57('0x46')]({'where':{'id':_0x5d9afb[_0x1a57('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a863d,null))[_0x1a57('0x21')](function(_0x278fa7){if(_0x278fa7){_0x2b2165=_0x278fa7;return _0x278fa7[_0x1a57('0x8d')](_0x5d9afb['body']['ids'],_['omit'](_0x5d9afb[_0x1a57('0x48')],['ids','id'])||{});}return null;})[_0x1a57('0x8e')](function(_0x56c92b){var _0x3876c1;var _0x287766;_0x2f2698=_0x56c92b||[];var _0x13abb5=[];if(_0x56c92b){for(var _0x5cae61=0x0;_0x5cae61<_0x56c92b['length'];_0x5cae61+=0x1){var _0x154e08=_0x56c92b[_0x5cae61][_0x1a57('0x23')]({'plain':!![]});_0x3876c1=squel[_0x1a57('0x7c')]()[_0x1a57('0x7d')]('cm_hopper_black')['fromQuery']([_0x1a57('0x69'),_0x1a57('0x6b'),'ListId',_0x1a57('0x57'),_0x1a57('0x4f'),_0x1a57('0x50')],squel[_0x1a57('0x77')]()[_0x1a57('0x6d')]('phone','phone')[_0x1a57('0x6d')]('id',_0x1a57('0x6b'))['field'](_0x154e08[_0x1a57('0x6e')]['toString'](),'ListId')[_0x1a57('0x6d')](_0x5d9afb[_0x1a57('0x53')]['id'][_0x1a57('0x6f')](),_0x1a57('0x57'))['field'](_0x1a57('0x7b'),_0x1a57('0x4f'))[_0x1a57('0x6d')](_0x1a57('0x7b'),'updatedAt')[_0x1a57('0x70')](_0x1a57('0x71'))[_0x1a57('0x3e')](_0x1a57('0x72'))[_0x1a57('0x3e')](_0x1a57('0x73'),_0x154e08[_0x1a57('0x6e')]['toString']())[_0x1a57('0x3e')](_0x1a57('0x74')))[_0x1a57('0x6f')]();_0x13abb5[_0x1a57('0x88')](db['sequelize']['query'](_0x3876c1));}return BPromise[_0x1a57('0x8a')](_0x13abb5);}})[_0x1a57('0x21')](function(){return _0x2f2698;})[_0x1a57('0x21')](respondWithResult(_0x1a863d,null))[_0x1a57('0x44')](handleError(_0x1a863d,null));};exports[_0x1a57('0x8f')]=function(_0x3e7879,_0x373d43,_0x54189e){return db['Campaign']['find']({'where':{'id':_0x3e7879['params']['id']}})['then'](handleEntityNotFound(_0x373d43,null))[_0x1a57('0x21')](function(_0x31783b){if(_0x31783b){return _0x31783b['removeBlackLists'](_0x3e7879[_0x1a57('0x33')][_0x1a57('0x64')]);}})[_0x1a57('0x21')](function(_0x1c12ce){if(_0x1c12ce){return db[_0x1a57('0x5f')][_0x1a57('0x22')]({'where':{'ListId':_0x3e7879[_0x1a57('0x33')][_0x1a57('0x64')],'CampaignId':_0x3e7879[_0x1a57('0x53')]['id']}})[_0x1a57('0x21')](function(){return _0x1c12ce;});}})[_0x1a57('0x21')](respondWithStatusCode(_0x373d43,null))[_0x1a57('0x44')](handleError(_0x373d43,null));}; \ No newline at end of file +var _0x1596=['UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','phone','ListId','field','NOW()','ContactId','toString','from','cm_contacts','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','fromQuery','scheduledAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','CmHopper','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','IvrCampaigns','error','name','send','index','map','Campaign','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1596,0x16f));var _0x6159=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1596[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x6159('0x0'));var rimraf=require(_0x6159('0x1'));var zipdir=require(_0x6159('0x2'));var jsonpatch=require(_0x6159('0x3'));var rp=require('request-promise');var moment=require(_0x6159('0x4'));var BPromise=require(_0x6159('0x5'));var Mustache=require(_0x6159('0x6'));var util=require('util');var path=require(_0x6159('0x7'));var sox=require(_0x6159('0x8'));var csv=require(_0x6159('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6159('0xa'));var _=require(_0x6159('0xb'));var squel=require(_0x6159('0xc'));var crypto=require(_0x6159('0xd'));var jsforce=require(_0x6159('0xe'));var deskjs=require(_0x6159('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6159('0x10'));var Papa=require('papaparse');var Redis=require(_0x6159('0x11'));var authService=require(_0x6159('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6159('0x13'));var hardwareService=require(_0x6159('0x14'));var logger=require(_0x6159('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x6159('0x16'));var licenseUtil=require(_0x6159('0x17'));var db=require(_0x6159('0x18'))['db'];function respondWithStatusCode(_0x366dda,_0x2864b5){_0x2864b5=_0x2864b5||0xcc;return function(_0x2d2f8b){if(_0x2d2f8b){return _0x366dda[_0x6159('0x19')](_0x2864b5);}return _0x366dda[_0x6159('0x1a')](_0x2864b5)[_0x6159('0x1b')]();};}function respondWithResult(_0x17cb83,_0x2e0cd9){_0x2e0cd9=_0x2e0cd9||0xc8;return function(_0x1c50e5){if(_0x1c50e5){return _0x17cb83[_0x6159('0x1a')](_0x2e0cd9)[_0x6159('0x1c')](_0x1c50e5);}};}function respondWithFilteredResult(_0x3572c0,_0xe3f67d){return function(_0x210fe8){if(_0x210fe8){var _0x35b27c=typeof _0xe3f67d['offset']==='undefined'&&typeof _0xe3f67d[_0x6159('0x1d')]===_0x6159('0x1e');var _0x143c7f=_0x210fe8['count'];var _0x368d1f=_0x35b27c?0x0:_0xe3f67d[_0x6159('0x1f')];var _0x141199=_0x35b27c?_0x210fe8[_0x6159('0x20')]:_0xe3f67d['offset']+_0xe3f67d[_0x6159('0x1d')];var _0x47deee;if(_0x141199>=_0x143c7f){_0x141199=_0x143c7f;_0x47deee=0xc8;}else{_0x47deee=0xce;}_0x3572c0[_0x6159('0x1a')](_0x47deee);return _0x3572c0[_0x6159('0x21')](_0x6159('0x22'),_0x368d1f+'-'+_0x141199+'/'+_0x143c7f)['json'](_0x210fe8);}return null;};}function patchUpdates(_0x54f210){return function(_0x2ece57){try{jsonpatch['apply'](_0x2ece57,_0x54f210,!![]);}catch(_0x31dd68){return BPromise[_0x6159('0x23')](_0x31dd68);}return _0x2ece57[_0x6159('0x24')]();};}function saveUpdates(_0x1f1ec5,_0x4a0863){return function(_0x1fe11d){if(_0x1fe11d){return _0x1fe11d[_0x6159('0x25')](_0x1f1ec5)[_0x6159('0x26')](function(_0x130d73){return _0x130d73;});}return null;};}function removeEntity(_0xba9d9,_0x29024f){return function(_0x5685a7){if(_0x5685a7){return _0x5685a7[_0x6159('0x27')]()['then'](function(){var _0x478722=_0x5685a7['get']({'plain':!![]});var _0x4bf0c1=_0x6159('0x28');return db['UserProfileResource'][_0x6159('0x27')]({'where':{'type':_0x4bf0c1,'resourceId':_0x478722['id']}})['then'](function(){return _0x5685a7;});})[_0x6159('0x26')](function(){_0xba9d9[_0x6159('0x1a')](0xcc)[_0x6159('0x1b')]();});}};}function handleEntityNotFound(_0x4059ef,_0x587247){return function(_0x524354){if(!_0x524354){_0x4059ef[_0x6159('0x19')](0x194);}return _0x524354;};}function handleError(_0x7167b4,_0x26a959){_0x26a959=_0x26a959||0x1f4;return function(_0x4fa594){logger[_0x6159('0x29')](_0x4fa594['stack']);if(_0x4fa594[_0x6159('0x2a')]){delete _0x4fa594[_0x6159('0x2a')];}_0x7167b4[_0x6159('0x1a')](_0x26a959)[_0x6159('0x2b')](_0x4fa594);};}exports[_0x6159('0x2c')]=function(_0x16545b,_0x426411){var _0x351ff2={},_0x142c8c={},_0x843b6b={'count':0x0,'rows':[]};var _0x4cd683=_[_0x6159('0x2d')](db[_0x6159('0x2e')][_0x6159('0x2f')],function(_0x17d2b0){return{'name':_0x17d2b0['fieldName'],'type':_0x17d2b0['type'][_0x6159('0x30')]};});_0x142c8c[_0x6159('0x31')]=_[_0x6159('0x2d')](_0x4cd683,_0x6159('0x2a'));_0x142c8c['query']=_[_0x6159('0x32')](_0x16545b[_0x6159('0x33')]);_0x142c8c[_0x6159('0x34')]=_[_0x6159('0x35')](_0x142c8c['model'],_0x142c8c[_0x6159('0x33')]);_0x351ff2[_0x6159('0x36')]=_[_0x6159('0x35')](_0x142c8c[_0x6159('0x31')],qs[_0x6159('0x37')](_0x16545b[_0x6159('0x33')][_0x6159('0x37')]));_0x351ff2[_0x6159('0x36')]=_0x351ff2[_0x6159('0x36')][_0x6159('0x38')]?_0x351ff2[_0x6159('0x36')]:_0x142c8c[_0x6159('0x31')];if(!_0x16545b[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x351ff2[_0x6159('0x1d')]=qs['limit'](_0x16545b[_0x6159('0x33')][_0x6159('0x1d')]);_0x351ff2[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x16545b[_0x6159('0x33')][_0x6159('0x1f')]);}_0x351ff2[_0x6159('0x3b')]=qs[_0x6159('0x3c')](_0x16545b[_0x6159('0x33')][_0x6159('0x3c')]);_0x351ff2['where']=qs[_0x6159('0x34')](_['pick'](_0x16545b['query'],_0x142c8c[_0x6159('0x34')]),_0x4cd683);if(_0x16545b['query'][_0x6159('0x3d')]){_0x351ff2[_0x6159('0x3e')]=_['merge'](_0x351ff2[_0x6159('0x3e')],{'$or':_[_0x6159('0x2d')](_0x4cd683,function(_0x5b4420){if(_0x5b4420[_0x6159('0x3f')]!==_0x6159('0x40')){var _0x9e93c4={};_0x9e93c4[_0x5b4420[_0x6159('0x2a')]]={'$like':'%'+_0x16545b['query'][_0x6159('0x3d')]+'%'};return _0x9e93c4;}})});}_0x351ff2=_[_0x6159('0x41')]({},_0x351ff2,_0x16545b[_0x6159('0x42')]);var _0x4e3e2e={'where':_0x351ff2[_0x6159('0x3e')]};return db[_0x6159('0x2e')][_0x6159('0x20')](_0x4e3e2e)[_0x6159('0x26')](function(_0x4f26d3){_0x843b6b['count']=_0x4f26d3;if(_0x16545b[_0x6159('0x33')][_0x6159('0x43')]){_0x351ff2[_0x6159('0x44')]=[{'all':!![]}];}return db[_0x6159('0x2e')][_0x6159('0x45')](_0x351ff2);})['then'](function(_0x6bfa40){_0x843b6b[_0x6159('0x46')]=_0x6bfa40;return _0x843b6b;})[_0x6159('0x26')](respondWithFilteredResult(_0x426411,_0x351ff2))[_0x6159('0x47')](handleError(_0x426411,null));};exports['show']=function(_0x453107,_0x312906){var _0x54a6f4={'raw':![],'where':{'id':_0x453107[_0x6159('0x48')]['id']}},_0x3b9f46={};_0x3b9f46[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x2e')][_0x6159('0x2f')]);_0x3b9f46[_0x6159('0x33')]=_[_0x6159('0x32')](_0x453107[_0x6159('0x33')]);_0x3b9f46[_0x6159('0x34')]=_['intersection'](_0x3b9f46['model'],_0x3b9f46[_0x6159('0x33')]);_0x54a6f4[_0x6159('0x36')]=_[_0x6159('0x35')](_0x3b9f46[_0x6159('0x31')],qs['fields'](_0x453107[_0x6159('0x33')][_0x6159('0x37')]));_0x54a6f4[_0x6159('0x36')]=_0x54a6f4[_0x6159('0x36')][_0x6159('0x38')]?_0x54a6f4[_0x6159('0x36')]:_0x3b9f46[_0x6159('0x31')];if(_0x453107[_0x6159('0x33')][_0x6159('0x43')]){_0x54a6f4[_0x6159('0x44')]=[{'all':!![]}];}_0x54a6f4=_[_0x6159('0x41')]({},_0x54a6f4,_0x453107[_0x6159('0x42')]);return db[_0x6159('0x2e')][_0x6159('0x49')](_0x54a6f4)['then'](handleEntityNotFound(_0x312906,null))[_0x6159('0x26')](respondWithResult(_0x312906,null))['catch'](handleError(_0x312906,null));};exports[_0x6159('0x4a')]=function(_0x4d581f,_0x45e002){return db['Campaign']['create'](_0x4d581f[_0x6159('0x4b')],{})['then'](function(_0x36b3b8){var _0x3ff676=_0x4d581f[_0x6159('0x4c')][_0x6159('0x4d')]({'plain':!![]});if(!_0x3ff676)throw new Error(_0x6159('0x4e'));if(_0x3ff676[_0x6159('0x4f')]===_0x6159('0x4c')){var _0x534864=_0x36b3b8[_0x6159('0x4d')]({'plain':!![]});var _0x7cacb4='IvrCampaigns';return db[_0x6159('0x50')][_0x6159('0x49')]({'where':{'name':_0x7cacb4,'userProfileId':_0x3ff676['userProfileId']},'raw':!![]})['then'](function(_0x49b85d){if(_0x49b85d&&_0x49b85d[_0x6159('0x51')]===0x0){return db[_0x6159('0x52')][_0x6159('0x4a')]({'name':_0x534864[_0x6159('0x2a')],'resourceId':_0x534864['id'],'type':_0x49b85d[_0x6159('0x2a')],'sectionId':_0x49b85d['id']},{})[_0x6159('0x26')](function(){return _0x36b3b8;});}else{return _0x36b3b8;}})['catch'](function(_0x420354){logger['error'](_0x6159('0x53'),_0x420354);throw _0x420354;});}return _0x36b3b8;})[_0x6159('0x26')](respondWithResult(_0x45e002,0xc9))[_0x6159('0x47')](handleError(_0x45e002,null));};exports[_0x6159('0x54')]=function(_0x2140a2,_0x19a73f){var _0x991e46={'where':{'id':_0x2140a2[_0x6159('0x48')]['id']}},_0x773b21={};_0x773b21[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x2e')][_0x6159('0x2f')]);_0x991e46[_0x6159('0x36')]=_[_0x6159('0x35')](_0x773b21[_0x6159('0x31')],qs[_0x6159('0x37')](_0x2140a2[_0x6159('0x33')][_0x6159('0x37')]));_0x991e46[_0x6159('0x36')]=_0x991e46[_0x6159('0x36')][_0x6159('0x38')]?_0x991e46[_0x6159('0x36')]:_0x773b21['model'];if(_0x2140a2[_0x6159('0x33')]['includeAll']){_0x991e46[_0x6159('0x44')]=[{'all':!![]}];}_0x991e46=_['merge']({},_0x991e46,_0x2140a2[_0x6159('0x42')]);return db['Campaign'][_0x6159('0x49')](_0x991e46)[_0x6159('0x26')](handleEntityNotFound(_0x19a73f,null))['then'](function(_0x5bbf0d){if(_0x5bbf0d){var _0x29659c=_0x5bbf0d[_0x6159('0x4d')]({'plain':!![]});_0x29659c=qs[_0x6159('0x55')](_0x29659c,['id',_0x6159('0x56'),_0x6159('0x57')]);_0x2140a2[_0x6159('0x4b')]=_[_0x6159('0x55')](_0x2140a2['body'],['id',_0x6159('0x56'),'updatedAt']);return db[_0x6159('0x2e')][_0x6159('0x4a')](_['merge'](_0x29659c,_0x2140a2['body']),{'include':_0x2140a2['query'][_0x6159('0x43')]?[{'all':!![]}]:undefined})[_0x6159('0x26')](function(_0x41fd1c){var _0x56f1ce=_0x2140a2[_0x6159('0x4c')]['get']({'plain':!![]});if(!_0x56f1ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56f1ce[_0x6159('0x4f')]==='user'){var _0x33d698=_0x41fd1c[_0x6159('0x4d')]({'plain':!![]});var _0x591882=_0x6159('0x28');return db[_0x6159('0x50')]['find']({'where':{'name':_0x591882,'userProfileId':_0x56f1ce[_0x6159('0x58')]},'raw':!![]})['then'](function(_0x2666d1){if(_0x2666d1&&_0x2666d1[_0x6159('0x51')]===0x0){return db[_0x6159('0x52')][_0x6159('0x4a')]({'name':_0x33d698['name'],'resourceId':_0x33d698['id'],'type':_0x2666d1['name'],'sectionId':_0x2666d1['id']},{})['then'](function(){return _0x41fd1c;});}else{return _0x41fd1c;}})[_0x6159('0x47')](function(_0x35857b){logger['error'](_0x6159('0x53'),_0x35857b);throw _0x35857b;});}return _0x41fd1c;});}})[_0x6159('0x26')](respondWithResult(_0x19a73f,0xc9))[_0x6159('0x47')](handleError(_0x19a73f,null));};exports[_0x6159('0x25')]=function(_0x459214,_0x1803c){if(_0x459214['body']['id']){delete _0x459214['body']['id'];}return db[_0x6159('0x2e')][_0x6159('0x49')]({'where':{'id':_0x459214[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x1803c,null))[_0x6159('0x26')](saveUpdates(_0x459214[_0x6159('0x4b')],null))[_0x6159('0x26')](respondWithResult(_0x1803c,null))['catch'](handleError(_0x1803c,null));};exports[_0x6159('0x27')]=function(_0x3e87ef,_0xf6e08e){return db[_0x6159('0x2e')]['find']({'where':{'id':_0x3e87ef[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0xf6e08e,null))[_0x6159('0x26')](removeEntity(_0xf6e08e,null))[_0x6159('0x47')](handleError(_0xf6e08e,null));};exports[_0x6159('0x59')]=function(_0x271498,_0x199a36,_0x529fbc){var _0x5cf685={'raw':!![],'where':{}};var _0x317c21={};var _0x4ef7db={'count':0x0,'rows':[]};return db['Campaign'][_0x6159('0x5a')]({'where':{'id':_0x271498[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x199a36,null))[_0x6159('0x26')](function(_0xdbb84e){if(_0xdbb84e){_0x317c21[_0x6159('0x31')]=_[_0x6159('0x32')](db['CmHopper'][_0x6159('0x2f')]);_0x317c21[_0x6159('0x33')]=_[_0x6159('0x32')](_0x271498[_0x6159('0x33')]);_0x317c21[_0x6159('0x34')]=_['intersection'](_0x317c21['model'],_0x317c21[_0x6159('0x33')]);_0x5cf685[_0x6159('0x36')]=_['intersection'](_0x317c21[_0x6159('0x31')],qs[_0x6159('0x37')](_0x271498['query'][_0x6159('0x37')]));_0x5cf685['attributes']=_0x5cf685[_0x6159('0x36')]['length']?_0x5cf685[_0x6159('0x36')]:_0x317c21['model'];if(!_0x271498[_0x6159('0x33')][_0x6159('0x39')]('nolimit')){_0x5cf685[_0x6159('0x1d')]=qs['limit'](_0x271498[_0x6159('0x33')]['limit']);_0x5cf685[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x271498[_0x6159('0x33')][_0x6159('0x1f')]);}_0x5cf685['order']=qs['sort'](_0x271498[_0x6159('0x33')][_0x6159('0x3c')]);_0x5cf685[_0x6159('0x3e')]=qs['filters'](_[_0x6159('0x5b')](_0x271498[_0x6159('0x33')],_0x317c21[_0x6159('0x34')]));_0x5cf685['where'][_0x6159('0x5c')]=_0xdbb84e['id'];if(_0x271498['query'][_0x6159('0x3d')]){_0x5cf685['where']=_[_0x6159('0x41')](_0x5cf685[_0x6159('0x3e')],{'$or':_[_0x6159('0x2d')](_0x5cf685['attributes'],function(_0x3a8dca){var _0x34fb2f={};_0x34fb2f[_0x3a8dca]={'$like':'%'+_0x271498[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x34fb2f;})});}_0x5cf685=_[_0x6159('0x41')]({},_0x5cf685,_0x271498['options']);return db['CmHopper'][_0x6159('0x20')]({'where':_0x5cf685[_0x6159('0x3e')]})[_0x6159('0x26')](function(_0x25cbca){_0x4ef7db['count']=_0x25cbca;if(_0x271498[_0x6159('0x33')][_0x6159('0x43')]){_0x5cf685[_0x6159('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5cf685);})[_0x6159('0x26')](function(_0x59ebba){_0x4ef7db['rows']=_0x59ebba;return _0x4ef7db;});}})['then'](respondWithFilteredResult(_0x199a36,_0x5cf685))['catch'](handleError(_0x199a36,null));};exports[_0x6159('0x5d')]=function(_0x5f1653,_0x5cda27,_0x2aa0a7){var _0x3d88ce={'raw':!![],'where':{}};var _0x418337={};var _0x1ea80c={'count':0x0,'rows':[]};return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x5f1653[_0x6159('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cda27,null))['then'](function(_0x5536d5){if(_0x5536d5){_0x418337[_0x6159('0x31')]=_['keys'](db[_0x6159('0x5e')]['rawAttributes']);_0x418337[_0x6159('0x33')]=_[_0x6159('0x32')](_0x5f1653['query']);_0x418337[_0x6159('0x34')]=_['intersection'](_0x418337[_0x6159('0x31')],_0x418337[_0x6159('0x33')]);_0x3d88ce['attributes']=_[_0x6159('0x35')](_0x418337[_0x6159('0x31')],qs[_0x6159('0x37')](_0x5f1653['query']['fields']));_0x3d88ce['attributes']=_0x3d88ce[_0x6159('0x36')]['length']?_0x3d88ce['attributes']:_0x418337['model'];if(!_0x5f1653[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x3d88ce[_0x6159('0x1d')]=qs[_0x6159('0x1d')](_0x5f1653['query'][_0x6159('0x1d')]);_0x3d88ce['offset']=qs[_0x6159('0x1f')](_0x5f1653[_0x6159('0x33')][_0x6159('0x1f')]);}_0x3d88ce['order']=qs[_0x6159('0x3c')](_0x5f1653[_0x6159('0x33')][_0x6159('0x3c')]);_0x3d88ce[_0x6159('0x3e')]=qs[_0x6159('0x34')](_[_0x6159('0x5b')](_0x5f1653[_0x6159('0x33')],_0x418337[_0x6159('0x34')]));_0x3d88ce[_0x6159('0x3e')][_0x6159('0x5c')]=_0x5536d5['id'];if(_0x5f1653[_0x6159('0x33')]['filter']){_0x3d88ce[_0x6159('0x3e')]=_[_0x6159('0x41')](_0x3d88ce[_0x6159('0x3e')],{'$or':_['map'](_0x3d88ce['attributes'],function(_0x21059a){var _0x415916={};_0x415916[_0x21059a]={'$like':'%'+_0x5f1653[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x415916;})});}_0x3d88ce=_[_0x6159('0x41')]({},_0x3d88ce,_0x5f1653[_0x6159('0x42')]);return db[_0x6159('0x5e')][_0x6159('0x20')]({'where':_0x3d88ce['where']})[_0x6159('0x26')](function(_0x53fd10){_0x1ea80c[_0x6159('0x20')]=_0x53fd10;if(_0x5f1653[_0x6159('0x33')][_0x6159('0x43')]){_0x3d88ce[_0x6159('0x44')]=[{'all':!![]}];}return db[_0x6159('0x5e')][_0x6159('0x45')](_0x3d88ce);})[_0x6159('0x26')](function(_0x6d39c){_0x1ea80c[_0x6159('0x46')]=_0x6d39c;return _0x1ea80c;});}})[_0x6159('0x26')](respondWithFilteredResult(_0x5cda27,_0x3d88ce))['catch'](handleError(_0x5cda27,null));};exports[_0x6159('0x5f')]=function(_0xcf35ec,_0x31e2c3,_0x4b3ac1){var _0x534df4={'raw':!![],'where':{}};var _0x23e1f3={};var _0xf1665d={'count':0x0,'rows':[]};return db['Campaign'][_0x6159('0x5a')]({'where':{'id':_0xcf35ec[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x31e2c3,null))[_0x6159('0x26')](function(_0x4ee3a3){if(_0x4ee3a3){_0x23e1f3[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x60')][_0x6159('0x2f')]);_0x23e1f3['query']=_[_0x6159('0x32')](_0xcf35ec[_0x6159('0x33')]);_0x23e1f3[_0x6159('0x34')]=_[_0x6159('0x35')](_0x23e1f3['model'],_0x23e1f3[_0x6159('0x33')]);_0x534df4['attributes']=_[_0x6159('0x35')](_0x23e1f3['model'],qs['fields'](_0xcf35ec['query'][_0x6159('0x37')]));_0x534df4['attributes']=_0x534df4[_0x6159('0x36')][_0x6159('0x38')]?_0x534df4[_0x6159('0x36')]:_0x23e1f3[_0x6159('0x31')];if(!_0xcf35ec[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x534df4[_0x6159('0x1d')]=qs['limit'](_0xcf35ec[_0x6159('0x33')][_0x6159('0x1d')]);_0x534df4[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0xcf35ec[_0x6159('0x33')][_0x6159('0x1f')]);}_0x534df4['order']=qs[_0x6159('0x3c')](_0xcf35ec[_0x6159('0x33')][_0x6159('0x3c')]);_0x534df4[_0x6159('0x3e')]=qs[_0x6159('0x34')](_[_0x6159('0x5b')](_0xcf35ec[_0x6159('0x33')],_0x23e1f3[_0x6159('0x34')]));_0x534df4[_0x6159('0x3e')]['CampaignId']=_0x4ee3a3['id'];if(_0xcf35ec[_0x6159('0x33')][_0x6159('0x3d')]){_0x534df4[_0x6159('0x3e')]=_[_0x6159('0x41')](_0x534df4[_0x6159('0x3e')],{'$or':_[_0x6159('0x2d')](_0x534df4[_0x6159('0x36')],function(_0x3f9721){var _0x368526={};_0x368526[_0x3f9721]={'$like':'%'+_0xcf35ec[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x368526;})});}_0x534df4=_[_0x6159('0x41')]({},_0x534df4,_0xcf35ec[_0x6159('0x42')]);return db[_0x6159('0x60')][_0x6159('0x20')]({'where':_0x534df4[_0x6159('0x3e')]})['then'](function(_0x5cd4e2){_0xf1665d[_0x6159('0x20')]=_0x5cd4e2;if(_0xcf35ec[_0x6159('0x33')][_0x6159('0x43')]){_0x534df4[_0x6159('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6159('0x45')](_0x534df4);})['then'](function(_0x3a0d23){_0xf1665d['rows']=_0x3a0d23;return _0xf1665d;});}})[_0x6159('0x26')](respondWithFilteredResult(_0x31e2c3,_0x534df4))[_0x6159('0x47')](handleError(_0x31e2c3,null));};exports[_0x6159('0x61')]=function(_0x3666a1,_0xced867,_0x33000a){var _0x16a2f5={'raw':!![],'where':{}};var _0x132f78={};var _0x1643ea={'count':0x0,'rows':[]};return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x3666a1[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0xced867,null))['then'](function(_0x1f52ba){if(_0x1f52ba){_0x132f78[_0x6159('0x31')]=_[_0x6159('0x32')](db[_0x6159('0x62')][_0x6159('0x2f')]);_0x132f78[_0x6159('0x33')]=_[_0x6159('0x32')](_0x3666a1[_0x6159('0x33')]);_0x132f78[_0x6159('0x34')]=_[_0x6159('0x35')](_0x132f78[_0x6159('0x31')],_0x132f78[_0x6159('0x33')]);_0x16a2f5[_0x6159('0x36')]=_[_0x6159('0x35')](_0x132f78[_0x6159('0x31')],qs[_0x6159('0x37')](_0x3666a1[_0x6159('0x33')]['fields']));_0x16a2f5[_0x6159('0x36')]=_0x16a2f5[_0x6159('0x36')]['length']?_0x16a2f5[_0x6159('0x36')]:_0x132f78['model'];if(!_0x3666a1[_0x6159('0x33')][_0x6159('0x39')]('nolimit')){_0x16a2f5['limit']=qs['limit'](_0x3666a1[_0x6159('0x33')]['limit']);_0x16a2f5[_0x6159('0x1f')]=qs['offset'](_0x3666a1[_0x6159('0x33')][_0x6159('0x1f')]);}_0x16a2f5[_0x6159('0x3b')]=qs['sort'](_0x3666a1[_0x6159('0x33')][_0x6159('0x3c')]);_0x16a2f5[_0x6159('0x3e')]=qs[_0x6159('0x34')](_['pick'](_0x3666a1[_0x6159('0x33')],_0x132f78[_0x6159('0x34')]));_0x16a2f5[_0x6159('0x3e')]['CampaignId']=_0x1f52ba['id'];if(_0x3666a1[_0x6159('0x33')][_0x6159('0x3d')]){_0x16a2f5[_0x6159('0x3e')]=_['merge'](_0x16a2f5[_0x6159('0x3e')],{'$or':_['map'](_0x16a2f5[_0x6159('0x36')],function(_0x52ad69){var _0x1c1a85={};_0x1c1a85[_0x52ad69]={'$like':'%'+_0x3666a1[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x1c1a85;})});}_0x16a2f5=_['merge']({},_0x16a2f5,_0x3666a1[_0x6159('0x42')]);return db['CmHopperBlack'][_0x6159('0x20')]({'where':_0x16a2f5['where']})['then'](function(_0x21781c){_0x1643ea[_0x6159('0x20')]=_0x21781c;if(_0x3666a1[_0x6159('0x33')][_0x6159('0x43')]){_0x16a2f5['include']=[{'all':!![]}];}return db[_0x6159('0x62')][_0x6159('0x45')](_0x16a2f5);})[_0x6159('0x26')](function(_0x35f224){_0x1643ea[_0x6159('0x46')]=_0x35f224;return _0x1643ea;});}})[_0x6159('0x26')](respondWithFilteredResult(_0xced867,_0x16a2f5))[_0x6159('0x47')](handleError(_0xced867,null));};exports[_0x6159('0x63')]=function(_0x3662d6,_0x2e53b9,_0x102e79){var _0x574811={};var _0x46dec7={};var _0x3acd55;var _0x4b79b2;return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x3662d6['params']['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x2e53b9,null))[_0x6159('0x26')](function(_0x11467d){if(_0x11467d){_0x3acd55=_0x11467d;_0x46dec7[_0x6159('0x31')]=_['keys'](db[_0x6159('0x64')][_0x6159('0x2f')]);_0x46dec7[_0x6159('0x33')]=_[_0x6159('0x32')](_0x3662d6[_0x6159('0x33')]);_0x46dec7[_0x6159('0x34')]=_[_0x6159('0x35')](_0x46dec7[_0x6159('0x31')],_0x46dec7[_0x6159('0x33')]);_0x574811[_0x6159('0x36')]=_[_0x6159('0x35')](_0x46dec7[_0x6159('0x31')],qs[_0x6159('0x37')](_0x3662d6['query'][_0x6159('0x37')]));_0x574811[_0x6159('0x36')]=_0x574811[_0x6159('0x36')][_0x6159('0x38')]?_0x574811[_0x6159('0x36')]:_0x46dec7[_0x6159('0x31')];_0x574811['order']=qs[_0x6159('0x3c')](_0x3662d6['query']['sort']);_0x574811['where']=qs[_0x6159('0x34')](_[_0x6159('0x5b')](_0x3662d6['query'],_0x46dec7[_0x6159('0x34')]));if(_0x3662d6['query'][_0x6159('0x3d')]){_0x574811['where']=_['merge'](_0x574811['where'],{'$or':_[_0x6159('0x2d')](_0x574811[_0x6159('0x36')],function(_0x1f4a8c){var _0x13afaa={};_0x13afaa[_0x1f4a8c]={'$like':'%'+_0x3662d6[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x13afaa;})});}_0x574811=_[_0x6159('0x41')]({},_0x574811,_0x3662d6['options']);return _0x3acd55[_0x6159('0x63')](_0x574811);}})[_0x6159('0x26')](function(_0x1404aa){if(_0x1404aa){_0x4b79b2=_0x1404aa['length'];if(!_0x3662d6['query'][_0x6159('0x39')](_0x6159('0x3a'))){_0x574811[_0x6159('0x1d')]=qs[_0x6159('0x1d')](_0x3662d6['query'][_0x6159('0x1d')]);_0x574811[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x3662d6[_0x6159('0x33')]['offset']);}return _0x3acd55[_0x6159('0x63')](_0x574811);}})[_0x6159('0x26')](function(_0x199944){if(_0x199944){return _0x199944?{'count':_0x4b79b2,'rows':_0x199944}:null;}})[_0x6159('0x26')](respondWithResult(_0x2e53b9,null))[_0x6159('0x47')](handleError(_0x2e53b9,null));};exports['addLists']=function(_0x2f672d,_0x3d8038,_0x4becd2){var _0x594ce3,_0x5b71c6;var _0x260a0b=[];var _0x3b2d4d=moment()[_0x6159('0x65')](_0x6159('0x66'));return db[_0x6159('0x2e')]['find']({'where':{'id':_0x2f672d[_0x6159('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d8038,null))[_0x6159('0x26')](function(_0x172e73){if(_0x172e73){_0x5b71c6=_0x172e73;return _0x172e73[_0x6159('0x67')](_0x2f672d[_0x6159('0x4b')][_0x6159('0x68')],_[_0x6159('0x55')](_0x2f672d[_0x6159('0x4b')],[_0x6159('0x68'),'id'])||{});}return null;})[_0x6159('0x69')](function(_0x2213de){var _0x4e2b70;var _0x29c03f;_0x594ce3=_0x2213de||[];var _0x5042c9=[];if(_0x2213de){for(var _0x6b7ec4=0x0;_0x6b7ec4<_0x2213de[_0x6159('0x38')];_0x6b7ec4+=0x1){var _0x1bfe66=_0x2213de[_0x6b7ec4][_0x6159('0x4d')]({'plain':!![]});_0x5b71c6['dialCheckDuplicateType']=_0x2f672d[_0x6159('0x4b')][_0x6159('0x6a')]?_0x2f672d[_0x6159('0x4b')][_0x6159('0x6a')]:_0x5b71c6[_0x6159('0x6a')];switch(_0x5b71c6[_0x6159('0x6a')]){case'always':_0x4e2b70=squel[_0x6159('0x6b')]()[_0x6159('0x6c')](_0x6159('0x6d'))['fromQuery']([_0x6159('0x6e'),'scheduledAt','ContactId',_0x6159('0x6f'),'CampaignId',_0x6159('0x56'),'updatedAt'],squel['select']()[_0x6159('0x70')](_0x6159('0x6e'),'phone')['field'](_0x6159('0x71'),'scheduledAt')[_0x6159('0x70')]('id',_0x6159('0x72'))['field'](_0x1bfe66['CmListId'][_0x6159('0x73')](),_0x6159('0x6f'))['field'](_0x2f672d[_0x6159('0x48')]['id']['toString'](),_0x6159('0x5c'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x56'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27','updatedAt')[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')]('deletedAt\x20IS\x20NULL')[_0x6159('0x3e')]('ListId\x20=\x20?',_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())['where'](_0x6159('0x77'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6159('0x78')]()['field'](_0x6159('0x79'))[_0x6159('0x74')](_0x6159('0x7a'))['where']('CampaignId\x20=\x20?',_0x2f672d[_0x6159('0x48')]['id']['toString']()))[_0x6159('0x3e')](_0x6159('0x7b'),squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x7c'))[_0x6159('0x74')](_0x6159('0x6d'))['where']('CampaignId\x20=\x20?',_0x2f672d['params']['id'][_0x6159('0x73')]())))[_0x6159('0x73')]();break;case'onlyIfOpen':_0x4e2b70=squel[_0x6159('0x6b')]()[_0x6159('0x6c')]('cm_hopper')[_0x6159('0x7d')]([_0x6159('0x6e'),_0x6159('0x7e'),_0x6159('0x72'),'ListId',_0x6159('0x5c'),'createdAt',_0x6159('0x57')],squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x6e'),_0x6159('0x6e'))[_0x6159('0x70')]('NOW()',_0x6159('0x7e'))[_0x6159('0x70')]('id',_0x6159('0x72'))['field'](_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')](),_0x6159('0x6f'))['field'](_0x2f672d[_0x6159('0x48')]['id'][_0x6159('0x73')](),_0x6159('0x5c'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x56'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x57'))[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')](_0x6159('0x7f'))[_0x6159('0x3e')](_0x6159('0x80'),_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())['where'](_0x6159('0x77'))[_0x6159('0x3e')](_0x6159('0x7b'),squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x7c'))[_0x6159('0x74')](_0x6159('0x6d'))[_0x6159('0x3e')](_0x6159('0x81'),_0x2f672d[_0x6159('0x48')]['id']['toString']())))[_0x6159('0x73')]();break;default:_0x4e2b70=squel[_0x6159('0x6b')]()['into'](_0x6159('0x6d'))['fromQuery']([_0x6159('0x6e'),_0x6159('0x7e'),_0x6159('0x72'),'ListId',_0x6159('0x5c'),_0x6159('0x56'),_0x6159('0x57')],squel[_0x6159('0x78')]()[_0x6159('0x70')](_0x6159('0x6e'),_0x6159('0x6e'))[_0x6159('0x70')]('NOW()','scheduledAt')[_0x6159('0x70')]('id',_0x6159('0x72'))['field'](_0x1bfe66['CmListId'][_0x6159('0x73')](),'ListId')[_0x6159('0x70')](_0x2f672d[_0x6159('0x48')]['id'][_0x6159('0x73')](),_0x6159('0x5c'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27',_0x6159('0x56'))['field']('\x27'+_0x3b2d4d+'\x27',_0x6159('0x57'))[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')]('deletedAt\x20IS\x20NULL')[_0x6159('0x3e')](_0x6159('0x80'),_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())[_0x6159('0x3e')](_0x6159('0x77')))['toString']();}_0x29c03f=squel[_0x6159('0x6b')]()[_0x6159('0x6c')](_0x6159('0x82'))[_0x6159('0x7d')]([_0x6159('0x83'),_0x6159('0x7e'),_0x6159('0x6e'),_0x6159('0x84'),_0x6159('0x56'),_0x6159('0x57')],squel[_0x6159('0x78')]()['field'](_0x6159('0x85'),'id')[_0x6159('0x70')]('NOW()',_0x6159('0x7e'))[_0x6159('0x70')](_0x6159('0x86'),_0x6159('0x6e'))[_0x6159('0x70')](_0x6159('0x87'),_0x6159('0x84'))[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27','createdAt')[_0x6159('0x70')]('\x27'+_0x3b2d4d+'\x27','updatedAt')[_0x6159('0x74')](_0x6159('0x88'),'ci')['join']('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x6159('0x3e')](_0x6159('0x89'),_0x1bfe66[_0x6159('0x76')][_0x6159('0x73')]())[_0x6159('0x3e')](_0x6159('0x8a'),_0x2f672d['params']['id'][_0x6159('0x73')]())[_0x6159('0x3e')](_0x6159('0x8b'),_0x3b2d4d))[_0x6159('0x73')]();_0x5042c9['push'](db[_0x6159('0x8c')][_0x6159('0x33')](_0x4e2b70));_0x260a0b[_0x6159('0x8d')](db[_0x6159('0x8c')]['query'](_0x29c03f));}return BPromise[_0x6159('0x8e')](_0x5042c9);}})[_0x6159('0x26')](function(){return BPromise[_0x6159('0x8e')](_0x260a0b);})[_0x6159('0x26')](function(){return _0x594ce3;})[_0x6159('0x26')](respondWithResult(_0x3d8038,null))[_0x6159('0x47')](handleError(_0x3d8038,null));};exports[_0x6159('0x8f')]=function(_0x4f5585,_0x166cff,_0x241cc4){return db['Campaign']['find']({'where':{'id':_0x4f5585[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x166cff,null))[_0x6159('0x26')](function(_0x5237f5){if(_0x5237f5){return _0x5237f5[_0x6159('0x8f')](_0x4f5585[_0x6159('0x33')][_0x6159('0x68')]);}})[_0x6159('0x26')](function(_0x1e2c5a){if(_0x1e2c5a){return db[_0x6159('0x90')][_0x6159('0x27')]({'where':{'ListId':_0x4f5585[_0x6159('0x33')]['ids'],'CampaignId':_0x4f5585['params']['id']}})[_0x6159('0x26')](function(){return _0x1e2c5a;});}})[_0x6159('0x26')](respondWithStatusCode(_0x166cff,null))[_0x6159('0x47')](handleError(_0x166cff,null));};exports[_0x6159('0x91')]=function(_0x30f953,_0xd75647,_0x5acb0c){var _0x12d2c4={};var _0x4ed37d={};var _0x2af794;var _0x170d85;return db[_0x6159('0x2e')][_0x6159('0x5a')]({'where':{'id':_0x30f953[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0xd75647,null))[_0x6159('0x26')](function(_0x33f0e6){if(_0x33f0e6){_0x2af794=_0x33f0e6;_0x4ed37d['model']=_[_0x6159('0x32')](db['CmList'][_0x6159('0x2f')]);_0x4ed37d[_0x6159('0x33')]=_['keys'](_0x30f953['query']);_0x4ed37d[_0x6159('0x34')]=_[_0x6159('0x35')](_0x4ed37d[_0x6159('0x31')],_0x4ed37d[_0x6159('0x33')]);_0x12d2c4[_0x6159('0x36')]=_['intersection'](_0x4ed37d[_0x6159('0x31')],qs[_0x6159('0x37')](_0x30f953['query']['fields']));_0x12d2c4[_0x6159('0x36')]=_0x12d2c4[_0x6159('0x36')]['length']?_0x12d2c4[_0x6159('0x36')]:_0x4ed37d['model'];_0x12d2c4[_0x6159('0x3b')]=qs[_0x6159('0x3c')](_0x30f953['query']['sort']);_0x12d2c4[_0x6159('0x3e')]=qs['filters'](_[_0x6159('0x5b')](_0x30f953['query'],_0x4ed37d[_0x6159('0x34')]));if(_0x30f953[_0x6159('0x33')][_0x6159('0x3d')]){_0x12d2c4['where']=_[_0x6159('0x41')](_0x12d2c4['where'],{'$or':_[_0x6159('0x2d')](_0x12d2c4[_0x6159('0x36')],function(_0x5df74f){var _0x46b7ac={};_0x46b7ac[_0x5df74f]={'$like':'%'+_0x30f953[_0x6159('0x33')][_0x6159('0x3d')]+'%'};return _0x46b7ac;})});}_0x12d2c4=_['merge']({},_0x12d2c4,_0x30f953[_0x6159('0x42')]);return _0x2af794[_0x6159('0x91')](_0x12d2c4);}})['then'](function(_0x238110){if(_0x238110){_0x170d85=_0x238110['length'];if(!_0x30f953[_0x6159('0x33')][_0x6159('0x39')](_0x6159('0x3a'))){_0x12d2c4[_0x6159('0x1d')]=qs[_0x6159('0x1d')](_0x30f953['query'][_0x6159('0x1d')]);_0x12d2c4[_0x6159('0x1f')]=qs[_0x6159('0x1f')](_0x30f953['query'][_0x6159('0x1f')]);}return _0x2af794[_0x6159('0x91')](_0x12d2c4);}})[_0x6159('0x26')](function(_0x5580b0){if(_0x5580b0){return _0x5580b0?{'count':_0x170d85,'rows':_0x5580b0}:null;}})['then'](respondWithResult(_0xd75647,null))[_0x6159('0x47')](handleError(_0xd75647,null));};exports[_0x6159('0x92')]=function(_0x3e6f5e,_0x1ee452,_0x323e47){var _0x2b477c,_0x4296c8;var _0x2107fc=[];var _0x265ff4=moment()[_0x6159('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x6159('0x49')]({'where':{'id':_0x3e6f5e[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x1ee452,null))[_0x6159('0x26')](function(_0x2c0697){if(_0x2c0697){_0x4296c8=_0x2c0697;return _0x2c0697[_0x6159('0x92')](_0x3e6f5e[_0x6159('0x4b')][_0x6159('0x68')],_[_0x6159('0x55')](_0x3e6f5e['body'],[_0x6159('0x68'),'id'])||{});}return null;})[_0x6159('0x69')](function(_0x173623){var _0x18c33f;var _0x2fe1ef;_0x2b477c=_0x173623||[];var _0x5e0f04=[];if(_0x173623){for(var _0xfff1f8=0x0;_0xfff1f8<_0x173623[_0x6159('0x38')];_0xfff1f8+=0x1){var _0x57f7e1=_0x173623[_0xfff1f8]['get']({'plain':!![]});_0x18c33f=squel[_0x6159('0x6b')]()['into'](_0x6159('0x93'))[_0x6159('0x7d')](['phone',_0x6159('0x72'),_0x6159('0x6f'),_0x6159('0x5c'),_0x6159('0x56'),_0x6159('0x57')],squel[_0x6159('0x78')]()['field'](_0x6159('0x6e'),_0x6159('0x6e'))['field']('id','ContactId')['field'](_0x57f7e1['CmListId']['toString'](),_0x6159('0x6f'))[_0x6159('0x70')](_0x3e6f5e[_0x6159('0x48')]['id'][_0x6159('0x73')](),_0x6159('0x5c'))[_0x6159('0x70')](_0x6159('0x71'),'createdAt')[_0x6159('0x70')]('NOW()',_0x6159('0x57'))[_0x6159('0x74')](_0x6159('0x75'))[_0x6159('0x3e')](_0x6159('0x7f'))[_0x6159('0x3e')](_0x6159('0x80'),_0x57f7e1[_0x6159('0x76')][_0x6159('0x73')]())['where'](_0x6159('0x77')))[_0x6159('0x73')]();_0x5e0f04['push'](db[_0x6159('0x8c')][_0x6159('0x33')](_0x18c33f));}return BPromise[_0x6159('0x8e')](_0x5e0f04);}})[_0x6159('0x26')](function(){return _0x2b477c;})['then'](respondWithResult(_0x1ee452,null))[_0x6159('0x47')](handleError(_0x1ee452,null));};exports[_0x6159('0x94')]=function(_0x15a275,_0x4fe624,_0x104690){return db[_0x6159('0x2e')][_0x6159('0x49')]({'where':{'id':_0x15a275[_0x6159('0x48')]['id']}})[_0x6159('0x26')](handleEntityNotFound(_0x4fe624,null))[_0x6159('0x26')](function(_0x52069a){if(_0x52069a){return _0x52069a[_0x6159('0x94')](_0x15a275[_0x6159('0x33')][_0x6159('0x68')]);}})[_0x6159('0x26')](function(_0x25f393){if(_0x25f393){return db[_0x6159('0x62')][_0x6159('0x27')]({'where':{'ListId':_0x15a275[_0x6159('0x33')][_0x6159('0x68')],'CampaignId':_0x15a275[_0x6159('0x48')]['id']}})[_0x6159('0x26')](function(){return _0x25f393;});}})[_0x6159('0x26')](respondWithStatusCode(_0x4fe624,null))[_0x6159('0x47')](handleError(_0x4fe624,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9c5e4a1..6b6bebb 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a3558de..b6567c0 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 _0x12fd=['catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Campaign,\x20%s,\x20%s','result'];(function(_0x343e70,_0xe5f373){var _0x2742fd=function(_0x27e56e){while(--_0x27e56e){_0x343e70['push'](_0x343e70['shift']());}};_0x2742fd(++_0xe5f373);}(_0x12fd,0x199));var _0xd12f=function(_0x5105ca,_0x2f2589){_0x5105ca=_0x5105ca-0x0;var _0x567724=_0x12fd[_0x5105ca];return _0x567724;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var moment=require(_0xd12f('0x2'));var BPromise=require(_0xd12f('0x3'));var rs=require(_0xd12f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd12f('0x5'))['db'];var utils=require(_0xd12f('0x6'));var logger=require(_0xd12f('0x7'))(_0xd12f('0x8'));var config=require(_0xd12f('0x9'));var jayson=require(_0xd12f('0xa'));var client=jayson['client'][_0xd12f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca6e6,_0x285abf,_0x193e89){return new BPromise(function(_0x62de68,_0x40aaf8){return client['request'](_0x5ca6e6,_0x193e89)[_0xd12f('0xc')](function(_0x539473){logger[_0xd12f('0xd')]('Campaign,\x20%s,\x20%s',_0x285abf,'request\x20sent');logger['debug'](_0xd12f('0xe'),_0x285abf,_0xd12f('0xf'),JSON['stringify'](_0x539473));if(_0x539473['error']){if(_0x539473['error']['code']===0x1f4){logger[_0xd12f('0x10')]('Campaign,\x20%s,\x20%s',_0x285abf,_0x539473[_0xd12f('0x10')][_0xd12f('0x11')]);return _0x40aaf8(_0x539473['error'][_0xd12f('0x11')]);}logger[_0xd12f('0x10')]('Campaign,\x20%s,\x20%s',_0x285abf,_0x539473['error']['message']);return _0x62de68(_0x539473[_0xd12f('0x10')][_0xd12f('0x11')]);}else{logger[_0xd12f('0xd')](_0xd12f('0x12'),_0x285abf,_0xd12f('0xf'));_0x62de68(_0x539473[_0xd12f('0x13')][_0xd12f('0x11')]);}})[_0xd12f('0x14')](function(_0x4769a2){logger['error']('Campaign,\x20%s,\x20%s',_0x285abf,_0x4769a2);_0x40aaf8(_0x4769a2);});});}exports[_0xd12f('0x15')]=function(_0x45ff4d){var _0x58a653=this;return new Promise(function(_0x14c619,_0x12c884){return db[_0xd12f('0x16')]['findAll']({'raw':_0x45ff4d['options']?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x18')]===undefined?!![]:![]:!![],'where':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x19')]||null:null,'attributes':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d['options'][_0xd12f('0x1a')]||null:null,'limit':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x1b')]||null:null,'include':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x1c')]?_[_0xd12f('0x1d')](_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x1c')],function(_0x42eb92){return{'model':db[_0x42eb92[_0xd12f('0x1e')]],'as':_0x42eb92['as'],'attributes':_0x42eb92[_0xd12f('0x1a')],'include':_0x42eb92[_0xd12f('0x1c')]?_[_0xd12f('0x1d')](_0x42eb92[_0xd12f('0x1c')],function(_0x2218fe){return{'model':db[_0x2218fe[_0xd12f('0x1e')]],'as':_0x2218fe['as'],'attributes':_0x2218fe[_0xd12f('0x1a')],'include':_0x2218fe[_0xd12f('0x1c')]?_[_0xd12f('0x1d')](_0x2218fe[_0xd12f('0x1c')],function(_0x3d71be){return{'model':db[_0x3d71be['model']],'as':_0x3d71be['as'],'attributes':_0x3d71be[_0xd12f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x163f95){logger[_0xd12f('0xd')]('GetCampaign',_0x45ff4d);logger[_0xd12f('0x1f')]('GetCampaign',_0x45ff4d,JSON[_0xd12f('0x20')](_0x163f95));_0x14c619(_0x163f95);})[_0xd12f('0x14')](function(_0x3418de){logger[_0xd12f('0x10')]('GetCampaign',_0x3418de['message'],_0x45ff4d);_0x12c884(_0x58a653[_0xd12f('0x10')](0x1f4,_0x3418de['message']));});});}; \ No newline at end of file +var _0x4584=['info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x57a699,_0x29e647){var _0x88b917=function(_0x498acc){while(--_0x498acc){_0x57a699['push'](_0x57a699['shift']());}};_0x88b917(++_0x29e647);}(_0x4584,0x1cf));var _0x4458=function(_0x58712a,_0x1d88a9){_0x58712a=_0x58712a-0x0;var _0x342032=_0x4584[_0x58712a];return _0x342032;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');var moment=require(_0x4458('0x1'));var BPromise=require(_0x4458('0x2'));var rs=require(_0x4458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4458('0x4'));var logger=require(_0x4458('0x5'))(_0x4458('0x6'));var config=require(_0x4458('0x7'));var jayson=require(_0x4458('0x8'));var client=jayson[_0x4458('0x9')][_0x4458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215b2d,_0x102b5f,_0x51da14){return new BPromise(function(_0x14bb0f,_0x83fb96){return client[_0x4458('0xb')](_0x215b2d,_0x51da14)[_0x4458('0xc')](function(_0x1ab8c3){logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));logger[_0x4458('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x102b5f,_0x4458('0xf'),JSON[_0x4458('0x11')](_0x1ab8c3));if(_0x1ab8c3[_0x4458('0x12')]){if(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x13')]===0x1f4){logger['error'](_0x4458('0xe'),_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x83fb96(_0x1ab8c3['error'][_0x4458('0x14')]);}logger[_0x4458('0x12')]('Campaign,\x20%s,\x20%s',_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x14bb0f(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x14')]);}else{logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));_0x14bb0f(_0x1ab8c3[_0x4458('0x15')][_0x4458('0x14')]);}})['catch'](function(_0x31e500){logger['error'](_0x4458('0xe'),_0x102b5f,_0x31e500);_0x83fb96(_0x31e500);});});}exports[_0x4458('0x16')]=function(_0x130d39){var _0x587cbb=this;return new Promise(function(_0x319247,_0x422e35){return db[_0x4458('0x17')][_0x4458('0x18')]({'raw':_0x130d39[_0x4458('0x19')]?_0x130d39[_0x4458('0x19')][_0x4458('0x1a')]===undefined?!![]:![]:!![],'where':_0x130d39[_0x4458('0x19')]?_0x130d39[_0x4458('0x19')][_0x4458('0x1b')]||null:null,'attributes':_0x130d39['options']?_0x130d39[_0x4458('0x19')][_0x4458('0x1c')]||null:null,'limit':_0x130d39[_0x4458('0x19')]?_0x130d39['options'][_0x4458('0x1d')]||null:null,'include':_0x130d39[_0x4458('0x19')]?_0x130d39['options'][_0x4458('0x1e')]?_[_0x4458('0x1f')](_0x130d39['options'][_0x4458('0x1e')],function(_0x17e482){return{'model':db[_0x17e482[_0x4458('0x20')]],'as':_0x17e482['as'],'attributes':_0x17e482['attributes'],'include':_0x17e482[_0x4458('0x1e')]?_['map'](_0x17e482[_0x4458('0x1e')],function(_0x504a86){return{'model':db[_0x504a86['model']],'as':_0x504a86['as'],'attributes':_0x504a86[_0x4458('0x1c')],'include':_0x504a86[_0x4458('0x1e')]?_[_0x4458('0x1f')](_0x504a86[_0x4458('0x1e')],function(_0x153a98){return{'model':db[_0x153a98[_0x4458('0x20')]],'as':_0x153a98['as'],'attributes':_0x153a98[_0x4458('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4458('0xc')](function(_0x452ec4){logger[_0x4458('0xd')](_0x4458('0x16'),_0x130d39);logger['debug'](_0x4458('0x16'),_0x130d39,JSON['stringify'](_0x452ec4));_0x319247(_0x452ec4);})[_0x4458('0x21')](function(_0x5f22be){logger[_0x4458('0x12')](_0x4458('0x16'),_0x5f22be[_0x4458('0x14')],_0x130d39);_0x422e35(_0x587cbb[_0x4458('0x12')](0x1f4,_0x5f22be[_0x4458('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 92c71d8..a383605 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 _0x30c6=['create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x3cf346,_0x3b8a44){var _0x33f272=function(_0x5d4056){while(--_0x5d4056){_0x3cf346['push'](_0x3cf346['shift']());}};_0x33f272(++_0x3b8a44);}(_0x30c6,0x171));var _0x630c=function(_0x459885,_0x5dcd09){_0x459885=_0x459885-0x0;var _0x39372f=_0x30c6[_0x459885];return _0x39372f;};'use strict';var multer=require(_0x630c('0x0'));var util=require('util');var path=require(_0x630c('0x1'));var timeout=require(_0x630c('0x2'));var express=require(_0x630c('0x3'));var router=express[_0x630c('0x4')]();var fs_extra=require(_0x630c('0x5'));var auth=require(_0x630c('0x6'));var interaction=require(_0x630c('0x7'));var config=require(_0x630c('0x8'));var controller=require(_0x630c('0x9'));router[_0x630c('0xa')]('/',auth[_0x630c('0xb')](),controller[_0x630c('0xc')]);router[_0x630c('0xa')](_0x630c('0xd'),auth[_0x630c('0xb')](),controller[_0x630c('0xe')]);router[_0x630c('0xa')]('/:id/hoppers',auth[_0x630c('0xb')](),controller[_0x630c('0xf')]);router[_0x630c('0xa')](_0x630c('0x10'),auth[_0x630c('0xb')](),controller[_0x630c('0x11')]);router[_0x630c('0xa')](_0x630c('0x12'),auth['isAuthenticated'](),controller[_0x630c('0x13')]);router['get'](_0x630c('0x14'),auth['isAuthenticated'](),controller[_0x630c('0x15')]);router['get'](_0x630c('0x16'),auth[_0x630c('0xb')](),controller[_0x630c('0x17')]);router[_0x630c('0xa')](_0x630c('0x18'),auth['isAuthenticated'](),controller[_0x630c('0x19')]);router[_0x630c('0x1a')]('/',auth['isAuthenticated'](),controller[_0x630c('0x1b')]);router['post'](_0x630c('0x1c'),auth[_0x630c('0xb')](),controller[_0x630c('0x1d')]);router[_0x630c('0x1a')]('/:id/lists',auth[_0x630c('0xb')](),controller[_0x630c('0x1e')]);router[_0x630c('0x1a')](_0x630c('0x18'),auth[_0x630c('0xb')](),controller[_0x630c('0x1f')]);router[_0x630c('0x20')](_0x630c('0xd'),auth['isAuthenticated'](),controller[_0x630c('0x21')]);router[_0x630c('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x630c('0x23')]);router[_0x630c('0x22')](_0x630c('0x16'),auth[_0x630c('0xb')](),controller['removeLists']);router[_0x630c('0x22')](_0x630c('0x18'),auth[_0x630c('0xb')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x7cb9=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0x7cb9,0x160));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x97cb('0x0'));var util=require(_0x97cb('0x1'));var path=require(_0x97cb('0x2'));var timeout=require(_0x97cb('0x3'));var express=require(_0x97cb('0x4'));var router=express[_0x97cb('0x5')]();var fs_extra=require(_0x97cb('0x6'));var auth=require(_0x97cb('0x7'));var interaction=require(_0x97cb('0x8'));var config=require(_0x97cb('0x9'));var controller=require(_0x97cb('0xa'));router[_0x97cb('0xb')]('/',auth[_0x97cb('0xc')](),controller[_0x97cb('0xd')]);router[_0x97cb('0xb')](_0x97cb('0xe'),auth['isAuthenticated'](),controller[_0x97cb('0xf')]);router[_0x97cb('0xb')]('/:id/hoppers',auth[_0x97cb('0xc')](),controller[_0x97cb('0x10')]);router[_0x97cb('0xb')](_0x97cb('0x11'),auth[_0x97cb('0xc')](),controller['getHopperHistories']);router[_0x97cb('0xb')](_0x97cb('0x12'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x13')]);router['get'](_0x97cb('0x14'),auth['isAuthenticated'](),controller[_0x97cb('0x15')]);router[_0x97cb('0xb')](_0x97cb('0x16'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x17')]);router[_0x97cb('0xb')](_0x97cb('0x18'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x19')]);router[_0x97cb('0x1a')]('/',auth[_0x97cb('0xc')](),controller[_0x97cb('0x1b')]);router[_0x97cb('0x1a')]('/:id/clone',auth[_0x97cb('0xc')](),controller[_0x97cb('0x1c')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x97cb('0x1d')]);router[_0x97cb('0x1a')]('/:id/blacklists',auth[_0x97cb('0xc')](),controller[_0x97cb('0x1e')]);router[_0x97cb('0x1f')](_0x97cb('0xe'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x20')]);router[_0x97cb('0x21')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x97cb('0x21')](_0x97cb('0x16'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x22')]);router[_0x97cb('0x21')](_0x97cb('0x18'),auth[_0x97cb('0xc')](),controller[_0x97cb('0x23')]);module[_0x97cb('0x24')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 68f5b86..a3dd274 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 _0x9d25=['TEXT','getDataValue','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9d25,0xde));var _0x59d2=function(_0x15b78c,_0x364a98){_0x15b78c=_0x15b78c-0x0;var _0x46804e=_0x9d25[_0x15b78c];return _0x46804e;};'use strict';var Sequelize=require(_0x59d2('0x0'));module[_0x59d2('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x59d2('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x59d2('0x3')]('key');}}}; \ No newline at end of file +var _0xeab6=['key','sequelize','TEXT','medium','STRING','VIRTUAL','getDataValue'];(function(_0x575f22,_0x4413e3){var _0xaf149a=function(_0x493d89){while(--_0x493d89){_0x575f22['push'](_0x575f22['shift']());}};_0xaf149a(++_0x4413e3);}(_0xeab6,0x19e));var _0x6eab=function(_0xc6b104,_0x1d805a){_0xc6b104=_0xc6b104-0x0;var _0x1c6fce=_0xeab6[_0xc6b104];return _0x1c6fce;};'use strict';var Sequelize=require(_0x6eab('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x6eab('0x1')],'length':_0x6eab('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6eab('0x3')]},'name':{'type':Sequelize[_0x6eab('0x4')],'get':function(){return this[_0x6eab('0x5')](_0x6eab('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e578443..6400540 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 _0x3d79=['SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','end','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','filters','pick','filter','where','merge','options','count','include','findAll','catch','params','keys','length','includeAll','find','body','create','MailAccountId'];(function(_0x15ee93,_0x62af92){var _0x48cc71=function(_0x36bb89){while(--_0x36bb89){_0x15ee93['push'](_0x15ee93['shift']());}};_0x48cc71(++_0x62af92);}(_0x3d79,0x186));var _0x93d7=function(_0x101d07,_0x1a9a15){_0x101d07=_0x101d07-0x0;var _0xdcca9d=_0x3d79[_0x101d07];return _0xdcca9d;};'use strict';var emlformat=require(_0x93d7('0x0'));var rimraf=require(_0x93d7('0x1'));var zipdir=require(_0x93d7('0x2'));var jsonpatch=require(_0x93d7('0x3'));var rp=require(_0x93d7('0x4'));var moment=require('moment');var BPromise=require(_0x93d7('0x5'));var Mustache=require(_0x93d7('0x6'));var util=require(_0x93d7('0x7'));var path=require(_0x93d7('0x8'));var sox=require('sox');var csv=require(_0x93d7('0x9'));var ejs=require(_0x93d7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93d7('0xb'));var squel=require(_0x93d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x93d7('0xd'));var deskjs=require(_0x93d7('0xe'));var toCsv=require(_0x93d7('0x9'));var querystring=require(_0x93d7('0xf'));var Papa=require(_0x93d7('0x10'));var Redis=require(_0x93d7('0x11'));var authService=require(_0x93d7('0x12'));var qs=require(_0x93d7('0x13'));var as=require(_0x93d7('0x14'));var hardwareService=require(_0x93d7('0x15'));var logger=require(_0x93d7('0x16'))(_0x93d7('0x17'));var utils=require(_0x93d7('0x18'));var config=require(_0x93d7('0x19'));var licenseUtil=require(_0x93d7('0x1a'));var db=require(_0x93d7('0x1b'))['db'];function respondWithStatusCode(_0x5b8cd2,_0x410201){_0x410201=_0x410201||0xcc;return function(_0xe67c1c){if(_0xe67c1c){return _0x5b8cd2[_0x93d7('0x1c')](_0x410201);}return _0x5b8cd2['status'](_0x410201)['end']();};}function respondWithResult(_0x414953,_0x5f11ba){_0x5f11ba=_0x5f11ba||0xc8;return function(_0xd77f2c){if(_0xd77f2c){return _0x414953[_0x93d7('0x1d')](_0x5f11ba)[_0x93d7('0x1e')](_0xd77f2c);}};}function respondWithFilteredResult(_0x268cca,_0x416820){return function(_0x2debcb){if(_0x2debcb){var _0x11caee=typeof _0x416820['offset']==='undefined'&&typeof _0x416820[_0x93d7('0x1f')]===_0x93d7('0x20');var _0x3e7003=_0x2debcb['count'];var _0x2b0a34=_0x11caee?0x0:_0x416820[_0x93d7('0x21')];var _0x4b3c86=_0x11caee?_0x2debcb['count']:_0x416820[_0x93d7('0x21')]+_0x416820[_0x93d7('0x1f')];var _0x53b120;if(_0x4b3c86>=_0x3e7003){_0x4b3c86=_0x3e7003;_0x53b120=0xc8;}else{_0x53b120=0xce;}_0x268cca[_0x93d7('0x1d')](_0x53b120);return _0x268cca[_0x93d7('0x22')](_0x93d7('0x23'),_0x2b0a34+'-'+_0x4b3c86+'/'+_0x3e7003)[_0x93d7('0x1e')](_0x2debcb);}return null;};}function patchUpdates(_0x5d5f41){return function(_0x486aad){try{jsonpatch[_0x93d7('0x24')](_0x486aad,_0x5d5f41,!![]);}catch(_0x329d98){return BPromise[_0x93d7('0x25')](_0x329d98);}return _0x486aad[_0x93d7('0x26')]();};}function saveUpdates(_0x4fd91b,_0x40df40){return function(_0x1ab8a1){if(_0x1ab8a1){return _0x1ab8a1[_0x93d7('0x27')](_0x4fd91b)['then'](function(_0x3d15f2){return _0x3d15f2;});}return null;};}function removeEntity(_0x2c581b,_0x2ddb05){return function(_0x2e94db){if(_0x2e94db){return _0x2e94db[_0x93d7('0x28')]()[_0x93d7('0x29')](function(){var _0x1a9feb=_0x2e94db[_0x93d7('0x2a')]({'plain':!![]});var _0x4dbccd='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x4dbccd,'resourceId':_0x1a9feb['id']}})[_0x93d7('0x29')](function(){return _0x2e94db;});})[_0x93d7('0x29')](function(){_0x2c581b[_0x93d7('0x1d')](0xcc)[_0x93d7('0x2b')]();});}};}function handleEntityNotFound(_0x1355ab,_0x160526){return function(_0x3b4212){if(!_0x3b4212){_0x1355ab[_0x93d7('0x1c')](0x194);}return _0x3b4212;};}function handleError(_0x571dfc,_0x55c41d){_0x55c41d=_0x55c41d||0x1f4;return function(_0x3f7ead){logger[_0x93d7('0x2c')](_0x3f7ead[_0x93d7('0x2d')]);if(_0x3f7ead[_0x93d7('0x2e')]){delete _0x3f7ead[_0x93d7('0x2e')];}_0x571dfc[_0x93d7('0x1d')](_0x55c41d)[_0x93d7('0x2f')](_0x3f7ead);};}exports[_0x93d7('0x30')]=function(_0xe6476,_0x3c45d8){var _0x43c562={},_0xa23382={},_0x4220bb={'count':0x0,'rows':[]};var _0x1bfe70=_['map'](db[_0x93d7('0x31')][_0x93d7('0x32')],function(_0x29c16e){return{'name':_0x29c16e[_0x93d7('0x33')],'type':_0x29c16e[_0x93d7('0x34')][_0x93d7('0x35')]};});_0xa23382[_0x93d7('0x36')]=_[_0x93d7('0x37')](_0x1bfe70,'name');_0xa23382['query']=_['keys'](_0xe6476[_0x93d7('0x38')]);_0xa23382['filters']=_[_0x93d7('0x39')](_0xa23382[_0x93d7('0x36')],_0xa23382[_0x93d7('0x38')]);_0x43c562[_0x93d7('0x3a')]=_['intersection'](_0xa23382['model'],qs[_0x93d7('0x3b')](_0xe6476[_0x93d7('0x38')][_0x93d7('0x3b')]));_0x43c562[_0x93d7('0x3a')]=_0x43c562['attributes']['length']?_0x43c562[_0x93d7('0x3a')]:_0xa23382[_0x93d7('0x36')];if(!_0xe6476[_0x93d7('0x38')][_0x93d7('0x3c')](_0x93d7('0x3d'))){_0x43c562[_0x93d7('0x1f')]=qs['limit'](_0xe6476[_0x93d7('0x38')][_0x93d7('0x1f')]);_0x43c562[_0x93d7('0x21')]=qs[_0x93d7('0x21')](_0xe6476[_0x93d7('0x38')][_0x93d7('0x21')]);}_0x43c562['order']=qs['sort'](_0xe6476[_0x93d7('0x38')]['sort']);_0x43c562['where']=qs[_0x93d7('0x3e')](_[_0x93d7('0x3f')](_0xe6476['query'],_0xa23382[_0x93d7('0x3e')]),_0x1bfe70);if(_0xe6476[_0x93d7('0x38')][_0x93d7('0x40')]){_0x43c562[_0x93d7('0x41')]=_['merge'](_0x43c562[_0x93d7('0x41')],{'$or':[{'key':{'$like':'%'+_0xe6476[_0x93d7('0x38')][_0x93d7('0x40')]+'%'}},{'value':{'$like':'%'+_0xe6476[_0x93d7('0x38')][_0x93d7('0x40')]+'%'}}]});}_0x43c562=_[_0x93d7('0x42')]({},_0x43c562,_0xe6476[_0x93d7('0x43')]);var _0x1ac4c6={'where':_0x43c562[_0x93d7('0x41')]};return db[_0x93d7('0x31')][_0x93d7('0x44')](_0x1ac4c6)['then'](function(_0x52f124){_0x4220bb['count']=_0x52f124;if(_0xe6476[_0x93d7('0x38')]['includeAll']){_0x43c562[_0x93d7('0x45')]=[{'all':!![]}];}return db[_0x93d7('0x31')][_0x93d7('0x46')](_0x43c562);})['then'](function(_0x1b7137){_0x4220bb['rows']=_0x1b7137;return _0x4220bb;})['then'](respondWithFilteredResult(_0x3c45d8,_0x43c562))[_0x93d7('0x47')](handleError(_0x3c45d8,null));};exports['show']=function(_0x5b55cb,_0x1387fd){var _0x5c2b6f={'raw':!![],'where':{'id':_0x5b55cb[_0x93d7('0x48')]['id']}},_0x5b5da8={};_0x5b5da8[_0x93d7('0x36')]=_[_0x93d7('0x49')](db[_0x93d7('0x31')][_0x93d7('0x32')]);_0x5b5da8[_0x93d7('0x38')]=_['keys'](_0x5b55cb[_0x93d7('0x38')]);_0x5b5da8[_0x93d7('0x3e')]=_['intersection'](_0x5b5da8['model'],_0x5b5da8['query']);_0x5c2b6f['attributes']=_[_0x93d7('0x39')](_0x5b5da8[_0x93d7('0x36')],qs[_0x93d7('0x3b')](_0x5b55cb[_0x93d7('0x38')][_0x93d7('0x3b')]));_0x5c2b6f[_0x93d7('0x3a')]=_0x5c2b6f[_0x93d7('0x3a')][_0x93d7('0x4a')]?_0x5c2b6f[_0x93d7('0x3a')]:_0x5b5da8[_0x93d7('0x36')];if(_0x5b55cb[_0x93d7('0x38')][_0x93d7('0x4b')]){_0x5c2b6f['include']=[{'all':!![]}];}_0x5c2b6f=_[_0x93d7('0x42')]({},_0x5c2b6f,_0x5b55cb[_0x93d7('0x43')]);return db[_0x93d7('0x31')][_0x93d7('0x4c')](_0x5c2b6f)[_0x93d7('0x29')](handleEntityNotFound(_0x1387fd,null))[_0x93d7('0x29')](respondWithResult(_0x1387fd,null))[_0x93d7('0x47')](handleError(_0x1387fd,null));};exports['update']=function(_0x3a00ef,_0xdd7c6a){if(_0x3a00ef['body']['id']){delete _0x3a00ef['body']['id'];}return db[_0x93d7('0x31')][_0x93d7('0x4c')]({'where':{'id':_0x3a00ef[_0x93d7('0x48')]['id']}})[_0x93d7('0x29')](handleEntityNotFound(_0xdd7c6a,null))[_0x93d7('0x29')](saveUpdates(_0x3a00ef[_0x93d7('0x4d')],null))[_0x93d7('0x29')](respondWithResult(_0xdd7c6a,null))[_0x93d7('0x47')](handleError(_0xdd7c6a,null));};exports['destroy']=function(_0x1ad59f,_0x963579){return db[_0x93d7('0x31')][_0x93d7('0x4c')]({'where':{'id':_0x1ad59f[_0x93d7('0x48')]['id']}})['then'](handleEntityNotFound(_0x963579,null))[_0x93d7('0x29')](removeEntity(_0x963579,null))['catch'](handleError(_0x963579,null));};exports[_0x93d7('0x4e')]=function(_0x43ac54,_0x2f3691){var _0x2d831a={'key':_0x43ac54[_0x93d7('0x4d')][_0x93d7('0x35')]};if(_0x43ac54[_0x93d7('0x4d')][_0x93d7('0x4f')]){_0x2d831a[_0x93d7('0x4f')]=_0x43ac54[_0x93d7('0x4d')][_0x93d7('0x4f')];}else if(_0x43ac54[_0x93d7('0x4d')]['SmsAccountId']){_0x2d831a[_0x93d7('0x50')]=_0x43ac54['body']['SmsAccountId'];}else if(_0x43ac54['body']['OpenchannelAccountId']){_0x2d831a[_0x93d7('0x51')]=_0x43ac54[_0x93d7('0x4d')][_0x93d7('0x51')];}else if(_0x43ac54[_0x93d7('0x4d')][_0x93d7('0x52')]){_0x2d831a['ChatWebsiteId']=_0x43ac54['body'][_0x93d7('0x52')];}return db[_0x93d7('0x31')][_0x93d7('0x4c')]({'where':_0x2d831a})['then'](function(_0x436c2f){if(_0x436c2f){throw new db[(_0x93d7('0x53'))]['ValidationError'](_0x93d7('0x54'));}return db['CannedAnswer']['create'](_0x43ac54['body']);})[_0x93d7('0x29')](function(_0xc15d77){var _0x2107c3=_0x43ac54[_0x93d7('0x55')][_0x93d7('0x2a')]({'plain':!![]});if(!_0x2107c3)throw new Error(_0x93d7('0x56'));if(_0x2107c3[_0x93d7('0x57')]===_0x93d7('0x55')){var _0x51e8b6=_0xc15d77[_0x93d7('0x2a')]({'plain':!![]});return db[_0x93d7('0x58')][_0x93d7('0x4c')]({'where':{'name':_0x93d7('0x59'),'userProfileId':_0x2107c3[_0x93d7('0x5a')]},'raw':!![]})['then'](function(_0x27518a){if(_0x27518a&&_0x27518a[_0x93d7('0x5b')]===0x0){return db[_0x93d7('0x5c')][_0x93d7('0x4e')]({'name':_0x51e8b6[_0x93d7('0x2e')],'resourceId':_0x51e8b6['id'],'type':_0x27518a[_0x93d7('0x2e')],'sectionId':_0x27518a['id']},{})[_0x93d7('0x29')](function(){return _0xc15d77;});}else{return _0xc15d77;}})[_0x93d7('0x47')](function(_0x1a6d92){logger[_0x93d7('0x2c')](_0x93d7('0x5d'),_0x1a6d92);throw _0x1a6d92;});}return _0xc15d77;})[_0x93d7('0x29')](respondWithResult(_0x2f3691,0xc9))[_0x93d7('0x47')](handleError(_0x2f3691,null));}; \ No newline at end of file +var _0xbac9=['set','Content-Range','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','include','show','params','keys','CannedAnswer','intersection','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x264530,_0xbfb41){var _0xe1e19e=function(_0x2a501a){while(--_0x2a501a){_0x264530['push'](_0x264530['shift']());}};_0xe1e19e(++_0xbfb41);}(_0xbac9,0x86));var _0x9bac=function(_0x212721,_0x1c0edc){_0x212721=_0x212721-0x0;var _0x369f08=_0xbac9[_0x212721];return _0x369f08;};'use strict';var emlformat=require(_0x9bac('0x0'));var rimraf=require(_0x9bac('0x1'));var zipdir=require(_0x9bac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bac('0x3'));var moment=require(_0x9bac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bac('0x5'));var util=require(_0x9bac('0x6'));var path=require(_0x9bac('0x7'));var sox=require(_0x9bac('0x8'));var csv=require(_0x9bac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bac('0xa'));var squel=require(_0x9bac('0xb'));var crypto=require(_0x9bac('0xc'));var jsforce=require(_0x9bac('0xd'));var deskjs=require(_0x9bac('0xe'));var toCsv=require(_0x9bac('0x9'));var querystring=require(_0x9bac('0xf'));var Papa=require(_0x9bac('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9bac('0x11'));var as=require(_0x9bac('0x12'));var hardwareService=require(_0x9bac('0x13'));var logger=require('../../config/logger')(_0x9bac('0x14'));var utils=require(_0x9bac('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9bac('0x16'))['db'];function respondWithStatusCode(_0x5da6a8,_0xe7561b){_0xe7561b=_0xe7561b||0xcc;return function(_0x372323){if(_0x372323){return _0x5da6a8['sendStatus'](_0xe7561b);}return _0x5da6a8[_0x9bac('0x17')](_0xe7561b)[_0x9bac('0x18')]();};}function respondWithResult(_0x4fb951,_0x245ba9){_0x245ba9=_0x245ba9||0xc8;return function(_0x31ce63){if(_0x31ce63){return _0x4fb951[_0x9bac('0x17')](_0x245ba9)[_0x9bac('0x19')](_0x31ce63);}};}function respondWithFilteredResult(_0x74419f,_0x12f225){return function(_0x19d265){if(_0x19d265){var _0x264270=typeof _0x12f225[_0x9bac('0x1a')]===_0x9bac('0x1b')&&typeof _0x12f225[_0x9bac('0x1c')]===_0x9bac('0x1b');var _0x22930a=_0x19d265['count'];var _0xb808b2=_0x264270?0x0:_0x12f225[_0x9bac('0x1a')];var _0x26fcba=_0x264270?_0x19d265[_0x9bac('0x1d')]:_0x12f225['offset']+_0x12f225[_0x9bac('0x1c')];var _0x3a9d7c;if(_0x26fcba>=_0x22930a){_0x26fcba=_0x22930a;_0x3a9d7c=0xc8;}else{_0x3a9d7c=0xce;}_0x74419f[_0x9bac('0x17')](_0x3a9d7c);return _0x74419f[_0x9bac('0x1e')](_0x9bac('0x1f'),_0xb808b2+'-'+_0x26fcba+'/'+_0x22930a)[_0x9bac('0x19')](_0x19d265);}return null;};}function patchUpdates(_0x242400){return function(_0x530604){try{jsonpatch[_0x9bac('0x20')](_0x530604,_0x242400,!![]);}catch(_0x24e1be){return BPromise[_0x9bac('0x21')](_0x24e1be);}return _0x530604[_0x9bac('0x22')]();};}function saveUpdates(_0x5373cf,_0xc6155b){return function(_0x5a3246){if(_0x5a3246){return _0x5a3246[_0x9bac('0x23')](_0x5373cf)[_0x9bac('0x24')](function(_0x1314c9){return _0x1314c9;});}return null;};}function removeEntity(_0xbb1800,_0x15762a){return function(_0x5ba4df){if(_0x5ba4df){return _0x5ba4df['destroy']()[_0x9bac('0x24')](function(){var _0x23dc19=_0x5ba4df[_0x9bac('0x25')]({'plain':!![]});var _0x47d0b2=_0x9bac('0x26');return db[_0x9bac('0x27')]['destroy']({'where':{'type':_0x47d0b2,'resourceId':_0x23dc19['id']}})[_0x9bac('0x24')](function(){return _0x5ba4df;});})[_0x9bac('0x24')](function(){_0xbb1800[_0x9bac('0x17')](0xcc)[_0x9bac('0x18')]();});}};}function handleEntityNotFound(_0x45525b,_0x3af06e){return function(_0x28f695){if(!_0x28f695){_0x45525b[_0x9bac('0x28')](0x194);}return _0x28f695;};}function handleError(_0x5902cf,_0x346237){_0x346237=_0x346237||0x1f4;return function(_0x26434d){logger['error'](_0x26434d[_0x9bac('0x29')]);if(_0x26434d[_0x9bac('0x2a')]){delete _0x26434d[_0x9bac('0x2a')];}_0x5902cf['status'](_0x346237)[_0x9bac('0x2b')](_0x26434d);};}exports[_0x9bac('0x2c')]=function(_0x429808,_0x3a94ad){var _0x368657={},_0x191ff6={},_0x289077={'count':0x0,'rows':[]};var _0x4aa371=_[_0x9bac('0x2d')](db['CannedAnswer'][_0x9bac('0x2e')],function(_0x462533){return{'name':_0x462533[_0x9bac('0x2f')],'type':_0x462533[_0x9bac('0x30')][_0x9bac('0x31')]};});_0x191ff6[_0x9bac('0x32')]=_[_0x9bac('0x2d')](_0x4aa371,'name');_0x191ff6[_0x9bac('0x33')]=_['keys'](_0x429808['query']);_0x191ff6['filters']=_['intersection'](_0x191ff6[_0x9bac('0x32')],_0x191ff6[_0x9bac('0x33')]);_0x368657[_0x9bac('0x34')]=_['intersection'](_0x191ff6[_0x9bac('0x32')],qs[_0x9bac('0x35')](_0x429808['query'][_0x9bac('0x35')]));_0x368657[_0x9bac('0x34')]=_0x368657['attributes'][_0x9bac('0x36')]?_0x368657[_0x9bac('0x34')]:_0x191ff6[_0x9bac('0x32')];if(!_0x429808[_0x9bac('0x33')][_0x9bac('0x37')](_0x9bac('0x38'))){_0x368657[_0x9bac('0x1c')]=qs['limit'](_0x429808[_0x9bac('0x33')][_0x9bac('0x1c')]);_0x368657[_0x9bac('0x1a')]=qs[_0x9bac('0x1a')](_0x429808['query'][_0x9bac('0x1a')]);}_0x368657['order']=qs['sort'](_0x429808[_0x9bac('0x33')][_0x9bac('0x39')]);_0x368657['where']=qs[_0x9bac('0x3a')](_['pick'](_0x429808[_0x9bac('0x33')],_0x191ff6[_0x9bac('0x3a')]),_0x4aa371);if(_0x429808[_0x9bac('0x33')][_0x9bac('0x3b')]){_0x368657[_0x9bac('0x3c')]=_[_0x9bac('0x3d')](_0x368657[_0x9bac('0x3c')],{'$or':[{'key':{'$like':'%'+_0x429808[_0x9bac('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x429808[_0x9bac('0x33')][_0x9bac('0x3b')]+'%'}}]});}_0x368657=_[_0x9bac('0x3d')]({},_0x368657,_0x429808[_0x9bac('0x3e')]);var _0x1acfe4={'where':_0x368657['where']};return db['CannedAnswer'][_0x9bac('0x1d')](_0x1acfe4)[_0x9bac('0x24')](function(_0x2dd43a){_0x289077[_0x9bac('0x1d')]=_0x2dd43a;if(_0x429808[_0x9bac('0x33')]['includeAll']){_0x368657[_0x9bac('0x3f')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x368657);})[_0x9bac('0x24')](function(_0x15bad8){_0x289077['rows']=_0x15bad8;return _0x289077;})['then'](respondWithFilteredResult(_0x3a94ad,_0x368657))['catch'](handleError(_0x3a94ad,null));};exports[_0x9bac('0x40')]=function(_0x46963d,_0x57172f){var _0x3d0881={'raw':!![],'where':{'id':_0x46963d[_0x9bac('0x41')]['id']}},_0x13faa4={};_0x13faa4[_0x9bac('0x32')]=_[_0x9bac('0x42')](db[_0x9bac('0x43')][_0x9bac('0x2e')]);_0x13faa4[_0x9bac('0x33')]=_[_0x9bac('0x42')](_0x46963d['query']);_0x13faa4[_0x9bac('0x3a')]=_[_0x9bac('0x44')](_0x13faa4['model'],_0x13faa4[_0x9bac('0x33')]);_0x3d0881[_0x9bac('0x34')]=_[_0x9bac('0x44')](_0x13faa4[_0x9bac('0x32')],qs[_0x9bac('0x35')](_0x46963d['query']['fields']));_0x3d0881['attributes']=_0x3d0881[_0x9bac('0x34')][_0x9bac('0x36')]?_0x3d0881[_0x9bac('0x34')]:_0x13faa4[_0x9bac('0x32')];if(_0x46963d['query']['includeAll']){_0x3d0881[_0x9bac('0x3f')]=[{'all':!![]}];}_0x3d0881=_[_0x9bac('0x3d')]({},_0x3d0881,_0x46963d[_0x9bac('0x3e')]);return db[_0x9bac('0x43')][_0x9bac('0x45')](_0x3d0881)[_0x9bac('0x24')](handleEntityNotFound(_0x57172f,null))[_0x9bac('0x24')](respondWithResult(_0x57172f,null))['catch'](handleError(_0x57172f,null));};exports[_0x9bac('0x23')]=function(_0x2cae0a,_0x4bb85d){if(_0x2cae0a['body']['id']){delete _0x2cae0a['body']['id'];}return db[_0x9bac('0x43')][_0x9bac('0x45')]({'where':{'id':_0x2cae0a[_0x9bac('0x41')]['id']}})[_0x9bac('0x24')](handleEntityNotFound(_0x4bb85d,null))[_0x9bac('0x24')](saveUpdates(_0x2cae0a[_0x9bac('0x46')],null))['then'](respondWithResult(_0x4bb85d,null))[_0x9bac('0x47')](handleError(_0x4bb85d,null));};exports['destroy']=function(_0x391336,_0x5a2e3a){return db[_0x9bac('0x43')][_0x9bac('0x45')]({'where':{'id':_0x391336[_0x9bac('0x41')]['id']}})[_0x9bac('0x24')](handleEntityNotFound(_0x5a2e3a,null))[_0x9bac('0x24')](removeEntity(_0x5a2e3a,null))[_0x9bac('0x47')](handleError(_0x5a2e3a,null));};exports[_0x9bac('0x48')]=function(_0x217bd3,_0x5f3aa3){var _0x1df92f={'key':_0x217bd3[_0x9bac('0x46')]['key']};if(_0x217bd3[_0x9bac('0x46')][_0x9bac('0x49')]){_0x1df92f[_0x9bac('0x49')]=_0x217bd3[_0x9bac('0x46')][_0x9bac('0x49')];}else if(_0x217bd3[_0x9bac('0x46')][_0x9bac('0x4a')]){_0x1df92f[_0x9bac('0x4a')]=_0x217bd3[_0x9bac('0x46')][_0x9bac('0x4a')];}else if(_0x217bd3[_0x9bac('0x46')]['OpenchannelAccountId']){_0x1df92f[_0x9bac('0x4b')]=_0x217bd3[_0x9bac('0x46')][_0x9bac('0x4b')];}else if(_0x217bd3['body'][_0x9bac('0x4c')]){_0x1df92f[_0x9bac('0x4c')]=_0x217bd3[_0x9bac('0x46')]['ChatWebsiteId'];}return db[_0x9bac('0x43')][_0x9bac('0x45')]({'where':_0x1df92f})[_0x9bac('0x24')](function(_0x335d2d){if(_0x335d2d){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x9bac('0x43')][_0x9bac('0x48')](_0x217bd3[_0x9bac('0x46')]);})['then'](function(_0x315369){var _0xa5d6ea=_0x217bd3[_0x9bac('0x4d')][_0x9bac('0x25')]({'plain':!![]});if(!_0xa5d6ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa5d6ea[_0x9bac('0x4e')]===_0x9bac('0x4d')){var _0x2ee60e=_0x315369[_0x9bac('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9bac('0x26'),'userProfileId':_0xa5d6ea['userProfileId']},'raw':!![]})['then'](function(_0x2cb933){if(_0x2cb933&&_0x2cb933[_0x9bac('0x4f')]===0x0){return db[_0x9bac('0x27')][_0x9bac('0x48')]({'name':_0x2ee60e['name'],'resourceId':_0x2ee60e['id'],'type':_0x2cb933[_0x9bac('0x2a')],'sectionId':_0x2cb933['id']},{})[_0x9bac('0x24')](function(){return _0x315369;});}else{return _0x315369;}})[_0x9bac('0x47')](function(_0x303e7f){logger[_0x9bac('0x50')](_0x9bac('0x51'),_0x303e7f);throw _0x303e7f;});}return _0x315369;})[_0x9bac('0x24')](respondWithResult(_0x5f3aa3,0xc9))[_0x9bac('0x47')](handleError(_0x5f3aa3,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 209500f..0736d51 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 _0x96f8=['util','api','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x93a6ee,_0x253344){var _0xb5ee31=function(_0x41cc23){while(--_0x41cc23){_0x93a6ee['push'](_0x93a6ee['shift']());}};_0xb5ee31(++_0x253344);}(_0x96f8,0x1db));var _0x896f=function(_0x44b68f,_0x5313e9){_0x44b68f=_0x44b68f-0x0;var _0x4ee6b8=_0x96f8[_0x44b68f];return _0x4ee6b8;};'use strict';var _=require(_0x896f('0x0'));var util=require(_0x896f('0x1'));var logger=require('../../config/logger')(_0x896f('0x2'));var moment=require('moment');var BPromise=require(_0x896f('0x3'));var rp=require(_0x896f('0x4'));var fs=require('fs');var path=require(_0x896f('0x5'));var rimraf=require('rimraf');var config=require(_0x896f('0x6'));var attributes=require(_0x896f('0x7'));module[_0x896f('0x8')]=function(_0x465f84,_0x453273){return _0x465f84[_0x896f('0x9')](_0x896f('0xa'),attributes,{'tableName':_0x896f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x896f('0xc'),'collate':_0x896f('0xd')});}; \ No newline at end of file +var _0x3c66=['define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x3c66,0xdc));var _0x63c6=function(_0x588b13,_0x245938){_0x588b13=_0x588b13-0x0;var _0x3861ec=_0x3c66[_0x588b13];return _0x3861ec;};'use strict';var _=require(_0x63c6('0x0'));var util=require(_0x63c6('0x1'));var logger=require('../../config/logger')(_0x63c6('0x2'));var moment=require(_0x63c6('0x3'));var BPromise=require(_0x63c6('0x4'));var rp=require(_0x63c6('0x5'));var fs=require('fs');var path=require(_0x63c6('0x6'));var rimraf=require('rimraf');var config=require(_0x63c6('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0xd79c07,_0x4677cf){return _0xd79c07[_0x63c6('0x8')]('CannedAnswer',attributes,{'tableName':_0x63c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63c6('0xa'),'collate':_0x63c6('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e9727aa..58a0c93 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(_0x50222c,_0x139e18){var _0x2b01fd=function(_0x2a2cd4){while(--_0x2a2cd4){_0x50222c['push'](_0x50222c['shift']());}};_0x2b01fd(++_0x139e18);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x3b4621,_0x4d2c4d){var _0x5f5120=function(_0x11fcf3){while(--_0x11fcf3){_0x3b4621['push'](_0x3b4621['shift']());}};_0x5f5120(++_0x4d2c4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 97a17fa..7e0a9ac 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 _0x4d23=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','get','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x57d7aa,_0x44a62f){var _0xe6f3f2=function(_0x25e1a6){while(--_0x25e1a6){_0x57d7aa['push'](_0x57d7aa['shift']());}};_0xe6f3f2(++_0x44a62f);}(_0x4d23,0x82));var _0x34d2=function(_0xd985de,_0x1a704a){_0xd985de=_0xd985de-0x0;var _0x1d9e79=_0x4d23[_0xd985de];return _0x1d9e79;};'use strict';var multer=require('multer');var util=require(_0x34d2('0x0'));var path=require(_0x34d2('0x1'));var timeout=require(_0x34d2('0x2'));var express=require(_0x34d2('0x3'));var router=express[_0x34d2('0x4')]();var fs_extra=require(_0x34d2('0x5'));var auth=require(_0x34d2('0x6'));var interaction=require(_0x34d2('0x7'));var config=require(_0x34d2('0x8'));var controller=require(_0x34d2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x34d2('0xa')]);router[_0x34d2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x34d2('0xc')]);router[_0x34d2('0xd')]('/',auth[_0x34d2('0xe')](),controller[_0x34d2('0xf')]);router[_0x34d2('0x10')](_0x34d2('0x11'),auth[_0x34d2('0xe')](),controller[_0x34d2('0x12')]);router[_0x34d2('0x13')]('/:id',auth[_0x34d2('0xe')](),controller[_0x34d2('0x14')]);module[_0x34d2('0x15')]=router; \ No newline at end of file +var _0xbd1e=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x2faa2b,_0x1af296){var _0x3d0ec7=function(_0x363f29){while(--_0x363f29){_0x2faa2b['push'](_0x2faa2b['shift']());}};_0x3d0ec7(++_0x1af296);}(_0xbd1e,0x14b));var _0xebd1=function(_0x70bb8,_0x1da278){_0x70bb8=_0x70bb8-0x0;var _0x48ba84=_0xbd1e[_0x70bb8];return _0x48ba84;};'use strict';var multer=require(_0xebd1('0x0'));var util=require(_0xebd1('0x1'));var path=require(_0xebd1('0x2'));var timeout=require('connect-timeout');var express=require(_0xebd1('0x3'));var router=express['Router']();var fs_extra=require(_0xebd1('0x4'));var auth=require(_0xebd1('0x5'));var interaction=require(_0xebd1('0x6'));var config=require(_0xebd1('0x7'));var controller=require(_0xebd1('0x8'));router['get']('/',auth[_0xebd1('0x9')](),controller[_0xebd1('0xa')]);router[_0xebd1('0xb')](_0xebd1('0xc'),auth[_0xebd1('0x9')](),controller[_0xebd1('0xd')]);router[_0xebd1('0xe')]('/',auth[_0xebd1('0x9')](),controller[_0xebd1('0xf')]);router[_0xebd1('0x10')](_0xebd1('0xc'),auth[_0xebd1('0x9')](),controller[_0xebd1('0x11')]);router['delete'](_0xebd1('0xc'),auth[_0xebd1('0x9')](),controller[_0xebd1('0x12')]);module[_0xebd1('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 9222921..dce03da 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 _0x117d=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x52538f,_0x203635){var _0x12d71b=function(_0x10486b){while(--_0x10486b){_0x52538f['push'](_0x52538f['shift']());}};_0x12d71b(++_0x203635);}(_0x117d,0xac));var _0xd117=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x117d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd117('0x0'));module[_0xd117('0x1')]={'calldate':{'type':Sequelize[_0xd117('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xd117('0x3')]},'src':{'type':Sequelize[_0xd117('0x3')]},'dst':{'type':Sequelize[_0xd117('0x3')]},'dcontext':{'type':Sequelize[_0xd117('0x3')]},'channel':{'type':Sequelize[_0xd117('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xd117('0x3')]},'lastdata':{'type':Sequelize[_0xd117('0x3')]},'duration':{'type':Sequelize[_0xd117('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd117('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd117('0x3')]},'userfield':{'type':Sequelize[_0xd117('0x3')]},'uniqueid':{'type':Sequelize[_0xd117('0x3')]},'linkedid':{'type':Sequelize[_0xd117('0x3')]},'sequence':{'type':Sequelize[_0xd117('0x3')]},'peeraccount':{'type':Sequelize[_0xd117('0x3')]},'type':{'type':Sequelize[_0xd117('0x3')]},'tag':{'type':Sequelize[_0xd117('0x3')]}}; \ No newline at end of file +var _0x3b43=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3b43,0x71));var _0x33b4=function(_0x107da1,_0x1de358){_0x107da1=_0x107da1-0x0;var _0x5c4ced=_0x3b43[_0x107da1];return _0x5c4ced;};'use strict';var Sequelize=require(_0x33b4('0x0'));module[_0x33b4('0x1')]={'calldate':{'type':Sequelize[_0x33b4('0x2')],'allowNull':![],'defaultValue':_0x33b4('0x3')},'clid':{'type':Sequelize[_0x33b4('0x4')]},'src':{'type':Sequelize[_0x33b4('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x33b4('0x4')]},'channel':{'type':Sequelize[_0x33b4('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x33b4('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x33b4('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x33b4('0x4')]},'amaflags':{'type':Sequelize[_0x33b4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x33b4('0x4')]},'userfield':{'type':Sequelize[_0x33b4('0x4')]},'uniqueid':{'type':Sequelize[_0x33b4('0x4')]},'linkedid':{'type':Sequelize[_0x33b4('0x4')]},'sequence':{'type':Sequelize[_0x33b4('0x4')]},'peeraccount':{'type':Sequelize[_0x33b4('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x33b4('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1632751..b0ee079 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 _0x6c32=['name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','error'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x26c3('0x0'));var rimraf=require(_0x26c3('0x1'));var zipdir=require(_0x26c3('0x2'));var jsonpatch=require(_0x26c3('0x3'));var rp=require(_0x26c3('0x4'));var moment=require(_0x26c3('0x5'));var BPromise=require(_0x26c3('0x6'));var Mustache=require(_0x26c3('0x7'));var util=require(_0x26c3('0x8'));var path=require('path');var sox=require(_0x26c3('0x9'));var csv=require(_0x26c3('0xa'));var ejs=require(_0x26c3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c3('0xc'));var squel=require('squel');var crypto=require(_0x26c3('0xd'));var jsforce=require(_0x26c3('0xe'));var deskjs=require(_0x26c3('0xf'));var toCsv=require(_0x26c3('0xa'));var querystring=require(_0x26c3('0x10'));var Papa=require(_0x26c3('0x11'));var Redis=require(_0x26c3('0x12'));var authService=require(_0x26c3('0x13'));var qs=require(_0x26c3('0x14'));var as=require(_0x26c3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26c3('0x16'));var licenseUtil=require(_0x26c3('0x17'));var db=require(_0x26c3('0x18'))['db'];function respondWithStatusCode(_0x457fc9,_0x4b8d92){_0x4b8d92=_0x4b8d92||0xcc;return function(_0x4c7b94){if(_0x4c7b94){return _0x457fc9[_0x26c3('0x19')](_0x4b8d92);}return _0x457fc9[_0x26c3('0x1a')](_0x4b8d92)[_0x26c3('0x1b')]();};}function respondWithResult(_0x3cd3c7,_0x17c399){_0x17c399=_0x17c399||0xc8;return function(_0x568d0b){if(_0x568d0b){return _0x3cd3c7['status'](_0x17c399)[_0x26c3('0x1c')](_0x568d0b);}};}function respondWithFilteredResult(_0xc14c69,_0x4f4256){return function(_0x4ed7c1){if(_0x4ed7c1){var _0x124cb3=typeof _0x4f4256['offset']===_0x26c3('0x1d')&&typeof _0x4f4256['limit']==='undefined';var _0x3931d5=_0x4ed7c1['count'];var _0x38fe17=_0x124cb3?0x0:_0x4f4256['offset'];var _0x170039=_0x124cb3?_0x4ed7c1[_0x26c3('0x1e')]:_0x4f4256[_0x26c3('0x1f')]+_0x4f4256[_0x26c3('0x20')];var _0x20317d;if(_0x170039>=_0x3931d5){_0x170039=_0x3931d5;_0x20317d=0xc8;}else{_0x20317d=0xce;}_0xc14c69['status'](_0x20317d);return _0xc14c69['set'](_0x26c3('0x21'),_0x38fe17+'-'+_0x170039+'/'+_0x3931d5)[_0x26c3('0x1c')](_0x4ed7c1);}return null;};}function patchUpdates(_0x480b76){return function(_0x5344e7){try{jsonpatch[_0x26c3('0x22')](_0x5344e7,_0x480b76,!![]);}catch(_0x5c2f7d){return BPromise['reject'](_0x5c2f7d);}return _0x5344e7[_0x26c3('0x23')]();};}function saveUpdates(_0x4eb863,_0x21034d){return function(_0x4a76b5){if(_0x4a76b5){return _0x4a76b5[_0x26c3('0x24')](_0x4eb863)['then'](function(_0x449548){return _0x449548;});}return null;};}function removeEntity(_0x146b69,_0x2f1648){return function(_0xdc0f2c){if(_0xdc0f2c){return _0xdc0f2c[_0x26c3('0x25')]()[_0x26c3('0x26')](function(){_0x146b69[_0x26c3('0x1a')](0xcc)[_0x26c3('0x1b')]();});}};}function handleEntityNotFound(_0x85a057,_0x3f6a18){return function(_0x52dae1){if(!_0x52dae1){_0x85a057[_0x26c3('0x19')](0x194);}return _0x52dae1;};}function handleError(_0x4c7696,_0x50d85e){_0x50d85e=_0x50d85e||0x1f4;return function(_0x44b4f8){logger[_0x26c3('0x27')](_0x44b4f8['stack']);if(_0x44b4f8[_0x26c3('0x28')]){delete _0x44b4f8['name'];}_0x4c7696[_0x26c3('0x1a')](_0x50d85e)[_0x26c3('0x29')](_0x44b4f8);};}exports[_0x26c3('0x2a')]=function(_0x130fcc,_0x3dbda5){var _0x50cd11={},_0x1d3331={},_0x27f556={'count':0x0,'rows':[]};var _0xebb766=_[_0x26c3('0x2b')](db[_0x26c3('0x2c')][_0x26c3('0x2d')],function(_0x5557b8){return{'name':_0x5557b8[_0x26c3('0x2e')],'type':_0x5557b8[_0x26c3('0x2f')][_0x26c3('0x30')]};});_0x1d3331['model']=_[_0x26c3('0x2b')](_0xebb766,_0x26c3('0x28'));_0x1d3331[_0x26c3('0x31')]=_[_0x26c3('0x32')](_0x130fcc[_0x26c3('0x31')]);_0x1d3331[_0x26c3('0x33')]=_['intersection'](_0x1d3331[_0x26c3('0x34')],_0x1d3331[_0x26c3('0x31')]);_0x50cd11['attributes']=_['intersection'](_0x1d3331['model'],qs['fields'](_0x130fcc['query'][_0x26c3('0x35')]));_0x50cd11[_0x26c3('0x36')]=_0x50cd11['attributes'][_0x26c3('0x37')]?_0x50cd11[_0x26c3('0x36')]:_0x1d3331['model'];if(!_0x130fcc['query'][_0x26c3('0x38')]('nolimit')){_0x50cd11[_0x26c3('0x20')]=qs['limit'](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x20')]);_0x50cd11[_0x26c3('0x1f')]=qs[_0x26c3('0x1f')](_0x130fcc[_0x26c3('0x31')]['offset']);}_0x50cd11[_0x26c3('0x39')]=qs[_0x26c3('0x3a')](_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3a')]);_0x50cd11[_0x26c3('0x3b')]=qs[_0x26c3('0x33')](_['pick'](_0x130fcc['query'],_0x1d3331[_0x26c3('0x33')]),_0xebb766);if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x3c')]){_0x50cd11[_0x26c3('0x3b')]=_[_0x26c3('0x3d')](_0x50cd11['where'],{'$or':_['map'](_0xebb766,function(_0x4c2df1){if(_0x4c2df1[_0x26c3('0x2f')]!==_0x26c3('0x3e')){var _0x832ef2={};_0x832ef2[_0x4c2df1[_0x26c3('0x28')]]={'$like':'%'+_0x130fcc[_0x26c3('0x31')]['filter']+'%'};return _0x832ef2;}})});}_0x50cd11=_['merge']({},_0x50cd11,_0x130fcc[_0x26c3('0x3f')]);var _0x16e680={'where':_0x50cd11[_0x26c3('0x3b')]};return db[_0x26c3('0x2c')]['count'](_0x16e680)[_0x26c3('0x26')](function(_0x2b4bdf){_0x27f556[_0x26c3('0x1e')]=_0x2b4bdf;if(_0x130fcc[_0x26c3('0x31')][_0x26c3('0x40')]){_0x50cd11[_0x26c3('0x41')]=[{'all':!![]}];}return db[_0x26c3('0x2c')][_0x26c3('0x42')](_0x50cd11);})[_0x26c3('0x26')](function(_0x1c0d6c){_0x27f556[_0x26c3('0x43')]=_0x1c0d6c;return _0x27f556;})[_0x26c3('0x26')](respondWithFilteredResult(_0x3dbda5,_0x50cd11))[_0x26c3('0x44')](handleError(_0x3dbda5,null));};exports['show']=function(_0x2f775b,_0x2ecb43){var _0xfb596a={'raw':!![],'where':{'id':_0x2f775b[_0x26c3('0x45')]['id']}},_0x46ebfb={};_0x46ebfb[_0x26c3('0x34')]=_['keys'](db[_0x26c3('0x2c')]['rawAttributes']);_0x46ebfb[_0x26c3('0x31')]=_['keys'](_0x2f775b[_0x26c3('0x31')]);_0x46ebfb[_0x26c3('0x33')]=_['intersection'](_0x46ebfb[_0x26c3('0x34')],_0x46ebfb[_0x26c3('0x31')]);_0xfb596a[_0x26c3('0x36')]=_[_0x26c3('0x46')](_0x46ebfb[_0x26c3('0x34')],qs['fields'](_0x2f775b[_0x26c3('0x31')]['fields']));_0xfb596a[_0x26c3('0x36')]=_0xfb596a['attributes']['length']?_0xfb596a[_0x26c3('0x36')]:_0x46ebfb[_0x26c3('0x34')];if(_0x2f775b[_0x26c3('0x31')]['includeAll']){_0xfb596a[_0x26c3('0x41')]=[{'all':!![]}];}_0xfb596a=_[_0x26c3('0x3d')]({},_0xfb596a,_0x2f775b[_0x26c3('0x3f')]);return db[_0x26c3('0x2c')][_0x26c3('0x47')](_0xfb596a)[_0x26c3('0x26')](handleEntityNotFound(_0x2ecb43,null))['then'](respondWithResult(_0x2ecb43,null))[_0x26c3('0x44')](handleError(_0x2ecb43,null));};exports[_0x26c3('0x48')]=function(_0x378982,_0x133cf7){return db['Cdr'][_0x26c3('0x48')](_0x378982[_0x26c3('0x49')],{})['then'](respondWithResult(_0x133cf7,0xc9))[_0x26c3('0x44')](handleError(_0x133cf7,null));};exports[_0x26c3('0x24')]=function(_0x522fe2,_0x4566ab){if(_0x522fe2['body']['id']){delete _0x522fe2[_0x26c3('0x49')]['id'];}return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x522fe2[_0x26c3('0x45')]['id']}})[_0x26c3('0x26')](handleEntityNotFound(_0x4566ab,null))[_0x26c3('0x26')](saveUpdates(_0x522fe2[_0x26c3('0x49')],null))['then'](respondWithResult(_0x4566ab,null))[_0x26c3('0x44')](handleError(_0x4566ab,null));};exports['destroy']=function(_0x4ada42,_0x3b3e31){return db[_0x26c3('0x2c')][_0x26c3('0x47')]({'where':{'id':_0x4ada42['params']['id']}})['then'](handleEntityNotFound(_0x3b3e31,null))[_0x26c3('0x26')](removeEntity(_0x3b3e31,null))[_0x26c3('0x44')](handleError(_0x3b3e31,null));};exports[_0x26c3('0x4a')]=function(_0x4d1ec7,_0x446453){return db[_0x26c3('0x2c')][_0x26c3('0x4a')]()['then'](respondWithResult(_0x446453,null))[_0x26c3('0x44')](handleError(_0x446453,null));}; \ No newline at end of file +var _0xf725=['save','update','then','destroy','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','rawAttributes','length','include','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x483dfa,_0x1942b9){var _0x5ccfee=function(_0x1b8c95){while(--_0x1b8c95){_0x483dfa['push'](_0x483dfa['shift']());}};_0x5ccfee(++_0x1942b9);}(_0xf725,0x7e));var _0x5f72=function(_0x2f20ad,_0x137cfc){_0x2f20ad=_0x2f20ad-0x0;var _0x5dd3ae=_0xf725[_0x2f20ad];return _0x5dd3ae;};'use strict';var emlformat=require(_0x5f72('0x0'));var rimraf=require(_0x5f72('0x1'));var zipdir=require(_0x5f72('0x2'));var jsonpatch=require(_0x5f72('0x3'));var rp=require(_0x5f72('0x4'));var moment=require(_0x5f72('0x5'));var BPromise=require(_0x5f72('0x6'));var Mustache=require(_0x5f72('0x7'));var util=require(_0x5f72('0x8'));var path=require(_0x5f72('0x9'));var sox=require('sox');var csv=require(_0x5f72('0xa'));var ejs=require(_0x5f72('0xb'));var fs=require('fs');var fs_extra=require(_0x5f72('0xc'));var _=require(_0x5f72('0xd'));var squel=require(_0x5f72('0xe'));var crypto=require(_0x5f72('0xf'));var jsforce=require(_0x5f72('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f72('0x11'));var Papa=require(_0x5f72('0x12'));var Redis=require('ioredis');var authService=require(_0x5f72('0x13'));var qs=require(_0x5f72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f72('0x15'));var logger=require(_0x5f72('0x16'))(_0x5f72('0x17'));var utils=require(_0x5f72('0x18'));var config=require(_0x5f72('0x19'));var licenseUtil=require(_0x5f72('0x1a'));var db=require(_0x5f72('0x1b'))['db'];function respondWithStatusCode(_0x537d7d,_0x1ac591){_0x1ac591=_0x1ac591||0xcc;return function(_0x3307ed){if(_0x3307ed){return _0x537d7d[_0x5f72('0x1c')](_0x1ac591);}return _0x537d7d[_0x5f72('0x1d')](_0x1ac591)[_0x5f72('0x1e')]();};}function respondWithResult(_0x57007a,_0x43d1fd){_0x43d1fd=_0x43d1fd||0xc8;return function(_0x4f81e9){if(_0x4f81e9){return _0x57007a['status'](_0x43d1fd)[_0x5f72('0x1f')](_0x4f81e9);}};}function respondWithFilteredResult(_0x5a036c,_0x3267a){return function(_0x4adc76){if(_0x4adc76){var _0x317eed=typeof _0x3267a['offset']===_0x5f72('0x20')&&typeof _0x3267a[_0x5f72('0x21')]==='undefined';var _0xea99d5=_0x4adc76[_0x5f72('0x22')];var _0x1497d4=_0x317eed?0x0:_0x3267a['offset'];var _0x490d14=_0x317eed?_0x4adc76['count']:_0x3267a[_0x5f72('0x23')]+_0x3267a[_0x5f72('0x21')];var _0x269dae;if(_0x490d14>=_0xea99d5){_0x490d14=_0xea99d5;_0x269dae=0xc8;}else{_0x269dae=0xce;}_0x5a036c[_0x5f72('0x1d')](_0x269dae);return _0x5a036c[_0x5f72('0x24')](_0x5f72('0x25'),_0x1497d4+'-'+_0x490d14+'/'+_0xea99d5)[_0x5f72('0x1f')](_0x4adc76);}return null;};}function patchUpdates(_0x5859fc){return function(_0x151a67){try{jsonpatch[_0x5f72('0x26')](_0x151a67,_0x5859fc,!![]);}catch(_0xd6dff9){return BPromise[_0x5f72('0x27')](_0xd6dff9);}return _0x151a67[_0x5f72('0x28')]();};}function saveUpdates(_0x2c599a,_0x30235e){return function(_0x367716){if(_0x367716){return _0x367716[_0x5f72('0x29')](_0x2c599a)[_0x5f72('0x2a')](function(_0x21c7d2){return _0x21c7d2;});}return null;};}function removeEntity(_0x530009,_0x433935){return function(_0x21f4a3){if(_0x21f4a3){return _0x21f4a3[_0x5f72('0x2b')]()[_0x5f72('0x2a')](function(){_0x530009['status'](0xcc)[_0x5f72('0x1e')]();});}};}function handleEntityNotFound(_0x3d05bc,_0x5c3325){return function(_0x447019){if(!_0x447019){_0x3d05bc[_0x5f72('0x1c')](0x194);}return _0x447019;};}function handleError(_0x347723,_0x521174){_0x521174=_0x521174||0x1f4;return function(_0x58ff77){logger[_0x5f72('0x2c')](_0x58ff77[_0x5f72('0x2d')]);if(_0x58ff77[_0x5f72('0x2e')]){delete _0x58ff77[_0x5f72('0x2e')];}_0x347723[_0x5f72('0x1d')](_0x521174)[_0x5f72('0x2f')](_0x58ff77);};}exports[_0x5f72('0x30')]=function(_0x59af82,_0x1b12cd){var _0x49eea5={},_0xc8ca5a={},_0x35fa31={'count':0x0,'rows':[]};var _0x7cce31=_[_0x5f72('0x31')](db[_0x5f72('0x32')]['rawAttributes'],function(_0x502057){return{'name':_0x502057[_0x5f72('0x33')],'type':_0x502057[_0x5f72('0x34')][_0x5f72('0x35')]};});_0xc8ca5a[_0x5f72('0x36')]=_[_0x5f72('0x31')](_0x7cce31,_0x5f72('0x2e'));_0xc8ca5a[_0x5f72('0x37')]=_['keys'](_0x59af82[_0x5f72('0x37')]);_0xc8ca5a[_0x5f72('0x38')]=_[_0x5f72('0x39')](_0xc8ca5a[_0x5f72('0x36')],_0xc8ca5a[_0x5f72('0x37')]);_0x49eea5['attributes']=_[_0x5f72('0x39')](_0xc8ca5a[_0x5f72('0x36')],qs[_0x5f72('0x3a')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x3a')]));_0x49eea5[_0x5f72('0x3b')]=_0x49eea5['attributes']['length']?_0x49eea5[_0x5f72('0x3b')]:_0xc8ca5a[_0x5f72('0x36')];if(!_0x59af82['query'][_0x5f72('0x3c')](_0x5f72('0x3d'))){_0x49eea5[_0x5f72('0x21')]=qs[_0x5f72('0x21')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x21')]);_0x49eea5[_0x5f72('0x23')]=qs[_0x5f72('0x23')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x23')]);}_0x49eea5[_0x5f72('0x3e')]=qs[_0x5f72('0x3f')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x3f')]);_0x49eea5['where']=qs[_0x5f72('0x38')](_['pick'](_0x59af82['query'],_0xc8ca5a[_0x5f72('0x38')]),_0x7cce31);if(_0x59af82[_0x5f72('0x37')][_0x5f72('0x40')]){_0x49eea5[_0x5f72('0x41')]=_[_0x5f72('0x42')](_0x49eea5[_0x5f72('0x41')],{'$or':_['map'](_0x7cce31,function(_0x1b9692){if(_0x1b9692[_0x5f72('0x34')]!==_0x5f72('0x43')){var _0x40d988={};_0x40d988[_0x1b9692[_0x5f72('0x2e')]]={'$like':'%'+_0x59af82[_0x5f72('0x37')][_0x5f72('0x40')]+'%'};return _0x40d988;}})});}_0x49eea5=_[_0x5f72('0x42')]({},_0x49eea5,_0x59af82[_0x5f72('0x44')]);var _0x2b8549={'where':_0x49eea5[_0x5f72('0x41')]};return db[_0x5f72('0x32')][_0x5f72('0x22')](_0x2b8549)[_0x5f72('0x2a')](function(_0xefdf17){_0x35fa31['count']=_0xefdf17;if(_0x59af82['query'][_0x5f72('0x45')]){_0x49eea5['include']=[{'all':!![]}];}return db['Cdr'][_0x5f72('0x46')](_0x49eea5);})[_0x5f72('0x2a')](function(_0x57d320){_0x35fa31[_0x5f72('0x47')]=_0x57d320;return _0x35fa31;})[_0x5f72('0x2a')](respondWithFilteredResult(_0x1b12cd,_0x49eea5))['catch'](handleError(_0x1b12cd,null));};exports[_0x5f72('0x48')]=function(_0x2314ea,_0x4f2d4a){var _0xcfefc5={'raw':!![],'where':{'id':_0x2314ea['params']['id']}},_0x4f57a6={};_0x4f57a6[_0x5f72('0x36')]=_[_0x5f72('0x49')](db[_0x5f72('0x32')][_0x5f72('0x4a')]);_0x4f57a6[_0x5f72('0x37')]=_[_0x5f72('0x49')](_0x2314ea[_0x5f72('0x37')]);_0x4f57a6['filters']=_[_0x5f72('0x39')](_0x4f57a6[_0x5f72('0x36')],_0x4f57a6[_0x5f72('0x37')]);_0xcfefc5[_0x5f72('0x3b')]=_['intersection'](_0x4f57a6[_0x5f72('0x36')],qs[_0x5f72('0x3a')](_0x2314ea[_0x5f72('0x37')][_0x5f72('0x3a')]));_0xcfefc5['attributes']=_0xcfefc5[_0x5f72('0x3b')][_0x5f72('0x4b')]?_0xcfefc5[_0x5f72('0x3b')]:_0x4f57a6[_0x5f72('0x36')];if(_0x2314ea['query'][_0x5f72('0x45')]){_0xcfefc5[_0x5f72('0x4c')]=[{'all':!![]}];}_0xcfefc5=_['merge']({},_0xcfefc5,_0x2314ea[_0x5f72('0x44')]);return db[_0x5f72('0x32')]['find'](_0xcfefc5)[_0x5f72('0x2a')](handleEntityNotFound(_0x4f2d4a,null))[_0x5f72('0x2a')](respondWithResult(_0x4f2d4a,null))[_0x5f72('0x4d')](handleError(_0x4f2d4a,null));};exports['create']=function(_0xc30598,_0x5efa48){return db[_0x5f72('0x32')][_0x5f72('0x4e')](_0xc30598['body'],{})[_0x5f72('0x2a')](respondWithResult(_0x5efa48,0xc9))[_0x5f72('0x4d')](handleError(_0x5efa48,null));};exports[_0x5f72('0x29')]=function(_0x302fff,_0x506774){if(_0x302fff[_0x5f72('0x4f')]['id']){delete _0x302fff[_0x5f72('0x4f')]['id'];}return db[_0x5f72('0x32')][_0x5f72('0x50')]({'where':{'id':_0x302fff['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x506774,null))['then'](saveUpdates(_0x302fff[_0x5f72('0x4f')],null))[_0x5f72('0x2a')](respondWithResult(_0x506774,null))[_0x5f72('0x4d')](handleError(_0x506774,null));};exports[_0x5f72('0x2b')]=function(_0x142089,_0x3f071c){return db[_0x5f72('0x32')][_0x5f72('0x50')]({'where':{'id':_0x142089[_0x5f72('0x51')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x3f071c,null))['then'](removeEntity(_0x3f071c,null))[_0x5f72('0x4d')](handleError(_0x3f071c,null));};exports[_0x5f72('0x52')]=function(_0x5c5d94,_0x30e03){return db[_0x5f72('0x32')]['describe']()[_0x5f72('0x2a')](respondWithResult(_0x30e03,null))[_0x5f72('0x4d')](handleError(_0x30e03,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index dd55244..de2774d 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(_0x581f97,_0x122d3f){var _0xd67f57=function(_0x305f8d){while(--_0x305f8d){_0x581f97['push'](_0x581f97['shift']());}};_0xd67f57(++_0x122d3f);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3218ca,_0x1f2034){var _0x3a0275=function(_0x43f384){while(--_0x43f384){_0x3218ca['push'](_0x3218ca['shift']());}};_0x3a0275(++_0x1f2034);}(_0x7a54,0x106));var _0x47a5=function(_0x36c0a5,_0x56db03){_0x36c0a5=_0x36c0a5-0x0;var _0x4fab3a=_0x7a54[_0x36c0a5];return _0x4fab3a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8e998c7..af9ea7a 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 _0x9e65=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xeba6a7,_0x587d8c){var _0x4f52a6=function(_0x371b2d){while(--_0x371b2d){_0xeba6a7['push'](_0xeba6a7['shift']());}};_0x4f52a6(++_0x587d8c);}(_0x9e65,0x170));var _0x59e6=function(_0x50c00a,_0x2afdb8){_0x50c00a=_0x50c00a-0x0;var _0x37e299=_0x9e65[_0x50c00a];return _0x37e299;};'use strict';var _=require(_0x59e6('0x0'));var util=require('util');var moment=require(_0x59e6('0x1'));var BPromise=require('bluebird');var rs=require(_0x59e6('0x2'));var fs=require('fs');var Redis=require(_0x59e6('0x3'));var db=require(_0x59e6('0x4'))['db'];var utils=require(_0x59e6('0x5'));var logger=require(_0x59e6('0x6'))(_0x59e6('0x7'));var config=require(_0x59e6('0x8'));var jayson=require(_0x59e6('0x9'));var client=jayson[_0x59e6('0xa')][_0x59e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0c2c,_0x36e922,_0x24ce33){return new BPromise(function(_0x57525a,_0x495791){return client[_0x59e6('0xc')](_0x4b0c2c,_0x24ce33)[_0x59e6('0xd')](function(_0x33b616){logger[_0x59e6('0xe')](_0x59e6('0xf'),_0x36e922,_0x59e6('0x10'));logger[_0x59e6('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x36e922,_0x59e6('0x10'),JSON[_0x59e6('0x12')](_0x33b616));if(_0x33b616[_0x59e6('0x13')]){if(_0x33b616['error']['code']===0x1f4){logger[_0x59e6('0x13')](_0x59e6('0xf'),_0x36e922,_0x33b616[_0x59e6('0x13')]['message']);return _0x495791(_0x33b616[_0x59e6('0x13')][_0x59e6('0x14')]);}logger[_0x59e6('0x13')](_0x59e6('0xf'),_0x36e922,_0x33b616['error'][_0x59e6('0x14')]);return _0x57525a(_0x33b616[_0x59e6('0x13')][_0x59e6('0x14')]);}else{logger[_0x59e6('0xe')](_0x59e6('0xf'),_0x36e922,_0x59e6('0x10'));_0x57525a(_0x33b616['result']['message']);}})[_0x59e6('0x15')](function(_0x2d67ee){logger['error'](_0x59e6('0xf'),_0x36e922,_0x2d67ee);_0x495791(_0x2d67ee);});});} \ No newline at end of file +var _0xebc7=['lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xebc7,0x118));var _0x7ebc=function(_0x2fc28e,_0x53e804){_0x2fc28e=_0x2fc28e-0x0;var _0x3f6923=_0xebc7[_0x2fc28e];return _0x3f6923;};'use strict';var _=require(_0x7ebc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7ebc('0x1'));var rs=require(_0x7ebc('0x2'));var fs=require('fs');var Redis=require(_0x7ebc('0x3'));var db=require(_0x7ebc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ebc('0x5'));var config=require(_0x7ebc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7ebc('0x7')][_0x7ebc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f0ea5,_0x3d33b8,_0x156f80){return new BPromise(function(_0x376683,_0x52e971){return client[_0x7ebc('0x9')](_0x4f0ea5,_0x156f80)['then'](function(_0x45e301){logger['info']('Cdr,\x20%s,\x20%s',_0x3d33b8,_0x7ebc('0xa'));logger[_0x7ebc('0xb')](_0x7ebc('0xc'),_0x3d33b8,'request\x20sent',JSON['stringify'](_0x45e301));if(_0x45e301[_0x7ebc('0xd')]){if(_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xe')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x3d33b8,_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);return _0x52e971(_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);}logger[_0x7ebc('0xd')](_0x7ebc('0x10'),_0x3d33b8,_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);return _0x376683(_0x45e301[_0x7ebc('0xd')][_0x7ebc('0xf')]);}else{logger[_0x7ebc('0x11')](_0x7ebc('0x10'),_0x3d33b8,_0x7ebc('0xa'));_0x376683(_0x45e301[_0x7ebc('0x12')][_0x7ebc('0xf')]);}})[_0x7ebc('0x13')](function(_0x257ce4){logger[_0x7ebc('0xd')]('Cdr,\x20%s,\x20%s',_0x3d33b8,_0x257ce4);_0x52e971(_0x257ce4);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 89b2de3..bf5826e 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x56b794,_0x50003f){var _0x80c80=function(_0x54dc03){while(--_0x54dc03){_0x56b794['push'](_0x56b794['shift']());}};_0x80c80(++_0x50003f);}(_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'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xb03f9,_0x588391){var _0x3ec30a=function(_0x3ef5e7){while(--_0x3ef5e7){_0xb03f9['push'](_0xb03f9['shift']());}};_0x3ec30a(++_0x588391);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 29e14c0..a027eea 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 _0x9ee3=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x9ee3,0x11d));var _0x39ee=function(_0x1de9a2,_0x38b784){_0x1de9a2=_0x1de9a2-0x0;var _0x2ca2b4=_0x9ee3[_0x1de9a2];return _0x2ca2b4;};'use strict';var Sequelize=require(_0x39ee('0x0'));module[_0x39ee('0x1')]={'priority':{'type':Sequelize[_0x39ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x39ee('0x3')],'allowNull':![],'defaultValue':_0x39ee('0x4')},'appdata':{'type':Sequelize[_0x39ee('0x5')]()},'description':{'type':Sequelize[_0x39ee('0x3')]},'interval':{'type':Sequelize[_0x39ee('0x3')],'defaultValue':_0x39ee('0x6')}}; \ No newline at end of file +var _0xfc18=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x479db7,_0x2e5a83){var _0x4a8fad=function(_0x5c4669){while(--_0x5c4669){_0x479db7['push'](_0x479db7['shift']());}};_0x4a8fad(++_0x2e5a83);}(_0xfc18,0xa2));var _0x8fc1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xfc18[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require(_0x8fc1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8fc1('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8fc1('0x2')},'appdata':{'type':Sequelize[_0x8fc1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8fc1('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 858e60f..c7cc166 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 _0x063c=['json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','error','stack','name','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','merge','ChatApplication','find','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x40e006,_0x43182b){var _0x59c350=function(_0x2af04b){while(--_0x2af04b){_0x40e006['push'](_0x40e006['shift']());}};_0x59c350(++_0x43182b);}(_0x063c,0xba));var _0xc063=function(_0x3091ea,_0x43ce06){_0x3091ea=_0x3091ea-0x0;var _0x4f99e7=_0x063c[_0x3091ea];return _0x4f99e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc063('0x0'));var zipdir=require(_0xc063('0x1'));var jsonpatch=require(_0xc063('0x2'));var rp=require(_0xc063('0x3'));var moment=require(_0xc063('0x4'));var BPromise=require(_0xc063('0x5'));var Mustache=require('mustache');var util=require(_0xc063('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc063('0x7'));var fs=require('fs');var fs_extra=require(_0xc063('0x8'));var _=require('lodash');var squel=require(_0xc063('0x9'));var crypto=require(_0xc063('0xa'));var jsforce=require(_0xc063('0xb'));var deskjs=require(_0xc063('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc063('0xd'));var Papa=require(_0xc063('0xe'));var Redis=require('ioredis');var authService=require(_0xc063('0xf'));var qs=require(_0xc063('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc063('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc063('0x12'));var licenseUtil=require(_0xc063('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8fc3dc,_0x5d0d2a){_0x5d0d2a=_0x5d0d2a||0xcc;return function(_0x14f55e){if(_0x14f55e){return _0x8fc3dc[_0xc063('0x14')](_0x5d0d2a);}return _0x8fc3dc[_0xc063('0x15')](_0x5d0d2a)['end']();};}function respondWithResult(_0x364264,_0x1249b2){_0x1249b2=_0x1249b2||0xc8;return function(_0x21b8da){if(_0x21b8da){return _0x364264[_0xc063('0x15')](_0x1249b2)[_0xc063('0x16')](_0x21b8da);}};}function respondWithFilteredResult(_0x391910,_0xf7fe54){return function(_0xac1724){if(_0xac1724){var _0x3baaeb=typeof _0xf7fe54['offset']===_0xc063('0x17')&&typeof _0xf7fe54[_0xc063('0x18')]==='undefined';var _0x89bb1e=_0xac1724[_0xc063('0x19')];var _0x4dcef1=_0x3baaeb?0x0:_0xf7fe54[_0xc063('0x1a')];var _0x13cc09=_0x3baaeb?_0xac1724[_0xc063('0x19')]:_0xf7fe54[_0xc063('0x1a')]+_0xf7fe54['limit'];var _0x234f33;if(_0x13cc09>=_0x89bb1e){_0x13cc09=_0x89bb1e;_0x234f33=0xc8;}else{_0x234f33=0xce;}_0x391910[_0xc063('0x15')](_0x234f33);return _0x391910[_0xc063('0x1b')]('Content-Range',_0x4dcef1+'-'+_0x13cc09+'/'+_0x89bb1e)[_0xc063('0x16')](_0xac1724);}return null;};}function patchUpdates(_0x5fa053){return function(_0x5741e0){try{jsonpatch[_0xc063('0x1c')](_0x5741e0,_0x5fa053,!![]);}catch(_0x4606eb){return BPromise[_0xc063('0x1d')](_0x4606eb);}return _0x5741e0[_0xc063('0x1e')]();};}function saveUpdates(_0x1ba785,_0x4a82eb){return function(_0x59c960){if(_0x59c960){return _0x59c960['update'](_0x1ba785)[_0xc063('0x1f')](function(_0x552560){return _0x552560;});}return null;};}function removeEntity(_0x4fb406,_0x481a6b){return function(_0x382f79){if(_0x382f79){return _0x382f79[_0xc063('0x20')]()[_0xc063('0x1f')](function(){_0x4fb406[_0xc063('0x15')](0xcc)[_0xc063('0x21')]();});}};}function handleEntityNotFound(_0x49f26e,_0x5a0d10){return function(_0x7317e7){if(!_0x7317e7){_0x49f26e['sendStatus'](0x194);}return _0x7317e7;};}function handleError(_0x36ba5a,_0x43e592){_0x43e592=_0x43e592||0x1f4;return function(_0x7db21a){logger[_0xc063('0x22')](_0x7db21a[_0xc063('0x23')]);if(_0x7db21a[_0xc063('0x24')]){delete _0x7db21a[_0xc063('0x24')];}_0x36ba5a[_0xc063('0x15')](_0x43e592)['send'](_0x7db21a);};}exports[_0xc063('0x25')]=function(_0xb48cc9,_0x5a623d){var _0x3a18bd={'raw':!![],'where':{'id':_0xb48cc9[_0xc063('0x26')]['id']}},_0x3359cd={};_0x3359cd[_0xc063('0x27')]=_[_0xc063('0x28')](db['ChatApplication'][_0xc063('0x29')]);_0x3359cd[_0xc063('0x2a')]=_['keys'](_0xb48cc9['query']);_0x3359cd['filters']=_[_0xc063('0x2b')](_0x3359cd['model'],_0x3359cd[_0xc063('0x2a')]);_0x3a18bd[_0xc063('0x2c')]=_[_0xc063('0x2b')](_0x3359cd[_0xc063('0x27')],qs['fields'](_0xb48cc9[_0xc063('0x2a')][_0xc063('0x2d')]));_0x3a18bd[_0xc063('0x2c')]=_0x3a18bd['attributes'][_0xc063('0x2e')]?_0x3a18bd['attributes']:_0x3359cd[_0xc063('0x27')];if(_0xb48cc9[_0xc063('0x2a')]['includeAll']){_0x3a18bd['include']=[{'all':!![]}];}_0x3a18bd=_[_0xc063('0x2f')]({},_0x3a18bd,_0xb48cc9['options']);return db[_0xc063('0x30')][_0xc063('0x31')](_0x3a18bd)[_0xc063('0x1f')](handleEntityNotFound(_0x5a623d,null))['then'](respondWithResult(_0x5a623d,null))['catch'](handleError(_0x5a623d,null));};exports['update']=function(_0x40fee0,_0x4ee218){if(_0x40fee0[_0xc063('0x32')]['id']){delete _0x40fee0['body']['id'];}return db[_0xc063('0x30')][_0xc063('0x31')]({'where':{'id':_0x40fee0[_0xc063('0x26')]['id']}})[_0xc063('0x1f')](handleEntityNotFound(_0x4ee218,null))['then'](saveUpdates(_0x40fee0[_0xc063('0x32')],null))[_0xc063('0x1f')](respondWithResult(_0x4ee218,null))[_0xc063('0x33')](handleError(_0x4ee218,null));};exports['destroy']=function(_0xcd344b,_0xb6b651){return db[_0xc063('0x30')][_0xc063('0x31')]({'where':{'id':_0xcd344b[_0xc063('0x26')]['id']}})[_0xc063('0x1f')](handleEntityNotFound(_0xb6b651,null))[_0xc063('0x1f')](removeEntity(_0xb6b651,null))[_0xc063('0x33')](handleError(_0xb6b651,null));}; \ No newline at end of file +var _0x0db9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','show','model','keys','rawAttributes','query','intersection','fields','attributes','includeAll','include','merge','options','catch','body','ChatApplication','find','destroy','params','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x0db9,0xa3));var _0x90db=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x0db9[_0x2cc569];return _0x1bfc2e;};'use strict';var emlformat=require(_0x90db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90db('0x1'));var moment=require(_0x90db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90db('0x3'));var util=require('util');var path=require(_0x90db('0x4'));var sox=require(_0x90db('0x5'));var csv=require('to-csv');var ejs=require(_0x90db('0x6'));var fs=require('fs');var fs_extra=require(_0x90db('0x7'));var _=require(_0x90db('0x8'));var squel=require(_0x90db('0x9'));var crypto=require(_0x90db('0xa'));var jsforce=require(_0x90db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90db('0xc'));var querystring=require(_0x90db('0xd'));var Papa=require(_0x90db('0xe'));var Redis=require(_0x90db('0xf'));var authService=require(_0x90db('0x10'));var qs=require(_0x90db('0x11'));var as=require(_0x90db('0x12'));var hardwareService=require(_0x90db('0x13'));var logger=require(_0x90db('0x14'))(_0x90db('0x15'));var utils=require(_0x90db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90db('0x17'));var db=require(_0x90db('0x18'))['db'];function respondWithStatusCode(_0x45ad3c,_0x436327){_0x436327=_0x436327||0xcc;return function(_0x1b410d){if(_0x1b410d){return _0x45ad3c[_0x90db('0x19')](_0x436327);}return _0x45ad3c[_0x90db('0x1a')](_0x436327)[_0x90db('0x1b')]();};}function respondWithResult(_0x7826f7,_0x309aea){_0x309aea=_0x309aea||0xc8;return function(_0x334e22){if(_0x334e22){return _0x7826f7[_0x90db('0x1a')](_0x309aea)[_0x90db('0x1c')](_0x334e22);}};}function respondWithFilteredResult(_0xda2abe,_0x544226){return function(_0x3124d4){if(_0x3124d4){var _0x5ef456=typeof _0x544226[_0x90db('0x1d')]===_0x90db('0x1e')&&typeof _0x544226[_0x90db('0x1f')]===_0x90db('0x1e');var _0x32ff04=_0x3124d4[_0x90db('0x20')];var _0x15e33e=_0x5ef456?0x0:_0x544226[_0x90db('0x1d')];var _0x24a16a=_0x5ef456?_0x3124d4[_0x90db('0x20')]:_0x544226['offset']+_0x544226[_0x90db('0x1f')];var _0x445a22;if(_0x24a16a>=_0x32ff04){_0x24a16a=_0x32ff04;_0x445a22=0xc8;}else{_0x445a22=0xce;}_0xda2abe['status'](_0x445a22);return _0xda2abe['set'](_0x90db('0x21'),_0x15e33e+'-'+_0x24a16a+'/'+_0x32ff04)[_0x90db('0x1c')](_0x3124d4);}return null;};}function patchUpdates(_0x300dc2){return function(_0x3a58c4){try{jsonpatch[_0x90db('0x22')](_0x3a58c4,_0x300dc2,!![]);}catch(_0x168eaf){return BPromise[_0x90db('0x23')](_0x168eaf);}return _0x3a58c4['save']();};}function saveUpdates(_0xb45340,_0x1aeab9){return function(_0x23934a){if(_0x23934a){return _0x23934a[_0x90db('0x24')](_0xb45340)['then'](function(_0x43028e){return _0x43028e;});}return null;};}function removeEntity(_0x5a98f6,_0x459068){return function(_0x19f9c6){if(_0x19f9c6){return _0x19f9c6['destroy']()[_0x90db('0x25')](function(){_0x5a98f6[_0x90db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8469,_0x3e3fbd){return function(_0x5b3c09){if(!_0x5b3c09){_0x2f8469[_0x90db('0x19')](0x194);}return _0x5b3c09;};}function handleError(_0xe026cf,_0x1cc660){_0x1cc660=_0x1cc660||0x1f4;return function(_0x94cd84){logger['error'](_0x94cd84[_0x90db('0x26')]);if(_0x94cd84[_0x90db('0x27')]){delete _0x94cd84[_0x90db('0x27')];}_0xe026cf[_0x90db('0x1a')](_0x1cc660)[_0x90db('0x28')](_0x94cd84);};}exports[_0x90db('0x29')]=function(_0x44b5b6,_0x3c7f67){var _0x4c6311={'raw':!![],'where':{'id':_0x44b5b6['params']['id']}},_0x3489d1={};_0x3489d1[_0x90db('0x2a')]=_[_0x90db('0x2b')](db['ChatApplication'][_0x90db('0x2c')]);_0x3489d1[_0x90db('0x2d')]=_[_0x90db('0x2b')](_0x44b5b6[_0x90db('0x2d')]);_0x3489d1['filters']=_[_0x90db('0x2e')](_0x3489d1[_0x90db('0x2a')],_0x3489d1[_0x90db('0x2d')]);_0x4c6311['attributes']=_['intersection'](_0x3489d1[_0x90db('0x2a')],qs[_0x90db('0x2f')](_0x44b5b6[_0x90db('0x2d')]['fields']));_0x4c6311[_0x90db('0x30')]=_0x4c6311[_0x90db('0x30')]['length']?_0x4c6311[_0x90db('0x30')]:_0x3489d1[_0x90db('0x2a')];if(_0x44b5b6['query'][_0x90db('0x31')]){_0x4c6311[_0x90db('0x32')]=[{'all':!![]}];}_0x4c6311=_[_0x90db('0x33')]({},_0x4c6311,_0x44b5b6[_0x90db('0x34')]);return db['ChatApplication']['find'](_0x4c6311)[_0x90db('0x25')](handleEntityNotFound(_0x3c7f67,null))['then'](respondWithResult(_0x3c7f67,null))[_0x90db('0x35')](handleError(_0x3c7f67,null));};exports[_0x90db('0x24')]=function(_0x45cebb,_0x540176){if(_0x45cebb[_0x90db('0x36')]['id']){delete _0x45cebb['body']['id'];}return db[_0x90db('0x37')][_0x90db('0x38')]({'where':{'id':_0x45cebb['params']['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x540176,null))[_0x90db('0x25')](saveUpdates(_0x45cebb[_0x90db('0x36')],null))[_0x90db('0x25')](respondWithResult(_0x540176,null))[_0x90db('0x35')](handleError(_0x540176,null));};exports[_0x90db('0x39')]=function(_0x4de656,_0x88789f){return db[_0x90db('0x37')]['find']({'where':{'id':_0x4de656[_0x90db('0x3a')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x88789f,null))[_0x90db('0x25')](removeEntity(_0x88789f,null))['catch'](handleError(_0x88789f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a5b1d7c..18a5810 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 _0x5d01=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x434634,_0x2b232d){var _0x5d866b=function(_0x5d2691){while(--_0x5d2691){_0x434634['push'](_0x434634['shift']());}};_0x5d866b(++_0x2b232d);}(_0x5d01,0xe5));var _0x15d0=function(_0x25d33a,_0x3859b9){_0x25d33a=_0x25d33a-0x0;var _0x4ede62=_0x5d01[_0x25d33a];return _0x4ede62;};'use strict';var _=require(_0x15d0('0x0'));var util=require('util');var logger=require(_0x15d0('0x1'))(_0x15d0('0x2'));var moment=require('moment');var BPromise=require(_0x15d0('0x3'));var rp=require(_0x15d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15d0('0x5'));var attributes=require(_0x15d0('0x6'));module[_0x15d0('0x7')]=function(_0x1b0e27,_0x2af55d){return _0x1b0e27[_0x15d0('0x8')](_0x15d0('0x9'),attributes,{'tableName':_0x15d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x15d0('0xb')});}; \ No newline at end of file +var _0xe45c=['../../config/environment','exports','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x484e5c,_0x13f5d2){var _0x5d65ef=function(_0x3bde98){while(--_0x3bde98){_0x484e5c['push'](_0x484e5c['shift']());}};_0x5d65ef(++_0x13f5d2);}(_0xe45c,0xae));var _0xce45=function(_0x570886,_0xda87f0){_0x570886=_0x570886-0x0;var _0x1b7471=_0xe45c[_0x570886];return _0x1b7471;};'use strict';var _=require(_0xce45('0x0'));var util=require(_0xce45('0x1'));var logger=require(_0xce45('0x2'))(_0xce45('0x3'));var moment=require('moment');var BPromise=require(_0xce45('0x4'));var rp=require(_0xce45('0x5'));var fs=require('fs');var path=require(_0xce45('0x6'));var rimraf=require(_0xce45('0x7'));var config=require(_0xce45('0x8'));var attributes=require('./chatApplication.attributes');module[_0xce45('0x9')]=function(_0x1007ee,_0x1abde5){return _0x1007ee['define'](_0xce45('0xa'),attributes,{'tableName':_0xce45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce45('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7c2fb38..5f00744 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 _0xe0fe=['http','request','then','info','request\x20sent','debug','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x144efb,_0x1e9c15){var _0x3b7832=function(_0x9a6cd){while(--_0x9a6cd){_0x144efb['push'](_0x144efb['shift']());}};_0x3b7832(++_0x1e9c15);}(_0xe0fe,0x108));var _0xee0f=function(_0x166614,_0x548d47){_0x166614=_0x166614-0x0;var _0x4a1307=_0xe0fe[_0x166614];return _0x4a1307;};'use strict';var _=require(_0xee0f('0x0'));var util=require(_0xee0f('0x1'));var moment=require(_0xee0f('0x2'));var BPromise=require(_0xee0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee0f('0x4'));var logger=require('../../config/logger')(_0xee0f('0x5'));var config=require(_0xee0f('0x6'));var jayson=require(_0xee0f('0x7'));var client=jayson[_0xee0f('0x8')][_0xee0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa63d33,_0x36c4ea,_0x314cf6){return new BPromise(function(_0x4d7ee0,_0x440dc9){return client[_0xee0f('0xa')](_0xa63d33,_0x314cf6)[_0xee0f('0xb')](function(_0x5594cd){logger[_0xee0f('0xc')]('ChatApplication,\x20%s,\x20%s',_0x36c4ea,_0xee0f('0xd'));logger[_0xee0f('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x36c4ea,_0xee0f('0xd'),JSON[_0xee0f('0xf')](_0x5594cd));if(_0x5594cd[_0xee0f('0x10')]){if(_0x5594cd[_0xee0f('0x10')][_0xee0f('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x36c4ea,_0x5594cd[_0xee0f('0x10')][_0xee0f('0x12')]);return _0x440dc9(_0x5594cd['error'][_0xee0f('0x12')]);}logger[_0xee0f('0x10')](_0xee0f('0x13'),_0x36c4ea,_0x5594cd[_0xee0f('0x10')][_0xee0f('0x12')]);return _0x4d7ee0(_0x5594cd[_0xee0f('0x10')][_0xee0f('0x12')]);}else{logger[_0xee0f('0xc')](_0xee0f('0x13'),_0x36c4ea,_0xee0f('0xd'));_0x4d7ee0(_0x5594cd[_0xee0f('0x14')][_0xee0f('0x12')]);}})['catch'](function(_0x3590a5){logger[_0xee0f('0x10')](_0xee0f('0x13'),_0x36c4ea,_0x3590a5);_0x440dc9(_0x3590a5);});});} \ No newline at end of file +var _0xe8e0=['stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x45bcb1,_0x46cad0){var _0x4bd6a3=function(_0x1f197f){while(--_0x1f197f){_0x45bcb1['push'](_0x45bcb1['shift']());}};_0x4bd6a3(++_0x46cad0);}(_0xe8e0,0x138));var _0x0e8e=function(_0x263e15,_0x5d14f8){_0x263e15=_0x263e15-0x0;var _0x2d2dfb=_0xe8e0[_0x263e15];return _0x2d2dfb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0e8e('0x0'));var rs=require(_0x0e8e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e8e('0x2'));var logger=require(_0x0e8e('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e8e('0x4'));var client=jayson[_0x0e8e('0x5')][_0x0e8e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a27a1,_0x18be5a,_0x1190a2){return new BPromise(function(_0x2958e5,_0x322ce8){return client[_0x0e8e('0x7')](_0x5a27a1,_0x1190a2)['then'](function(_0x416b6b){logger[_0x0e8e('0x8')]('ChatApplication,\x20%s,\x20%s',_0x18be5a,'request\x20sent');logger['debug'](_0x0e8e('0x9'),_0x18be5a,_0x0e8e('0xa'),JSON[_0x0e8e('0xb')](_0x416b6b));if(_0x416b6b[_0x0e8e('0xc')]){if(_0x416b6b[_0x0e8e('0xc')][_0x0e8e('0xd')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x18be5a,_0x416b6b[_0x0e8e('0xc')]['message']);return _0x322ce8(_0x416b6b['error']['message']);}logger[_0x0e8e('0xc')](_0x0e8e('0xe'),_0x18be5a,_0x416b6b[_0x0e8e('0xc')]['message']);return _0x2958e5(_0x416b6b[_0x0e8e('0xc')][_0x0e8e('0xf')]);}else{logger[_0x0e8e('0x8')](_0x0e8e('0xe'),_0x18be5a,'request\x20sent');_0x2958e5(_0x416b6b['result']['message']);}})[_0x0e8e('0x10')](function(_0x4826d4){logger[_0x0e8e('0xc')](_0x0e8e('0xe'),_0x18be5a,_0x4826d4);_0x322ce8(_0x4826d4);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0632e1f..5cefd02 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 _0xd2ca=['fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd2ca,0x1cb));var _0xad2c=function(_0x4c4c82,_0x24a215){_0x4c4c82=_0x4c4c82-0x0;var _0xab2ece=_0xd2ca[_0x4c4c82];return _0xab2ece;};'use strict';var multer=require(_0xad2c('0x0'));var util=require(_0xad2c('0x1'));var path=require(_0xad2c('0x2'));var timeout=require(_0xad2c('0x3'));var express=require(_0xad2c('0x4'));var router=express[_0xad2c('0x5')]();var fs_extra=require(_0xad2c('0x6'));var auth=require(_0xad2c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xad2c('0x8')](_0xad2c('0x9'),auth[_0xad2c('0xa')](),controller[_0xad2c('0xb')]);router[_0xad2c('0xc')](_0xad2c('0x9'),auth[_0xad2c('0xa')](),controller[_0xad2c('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xad2c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0302=['multer','util','path','connect-timeout','express','Router','fs-extra','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x281e76,_0x8bde50){var _0x5ecce5=function(_0x2382bc){while(--_0x2382bc){_0x281e76['push'](_0x281e76['shift']());}};_0x5ecce5(++_0x8bde50);}(_0x0302,0x1b0));var _0x2030=function(_0x2ee4a5,_0x3f6f7c){_0x2ee4a5=_0x2ee4a5-0x0;var _0x5590c9=_0x0302[_0x2ee4a5];return _0x5590c9;};'use strict';var multer=require(_0x2030('0x0'));var util=require(_0x2030('0x1'));var path=require(_0x2030('0x2'));var timeout=require(_0x2030('0x3'));var express=require(_0x2030('0x4'));var router=express[_0x2030('0x5')]();var fs_extra=require(_0x2030('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2030('0x7'));router['get'](_0x2030('0x8'),auth[_0x2030('0x9')](),controller[_0x2030('0xa')]);router[_0x2030('0xb')]('/:id',auth[_0x2030('0x9')](),controller[_0x2030('0xc')]);router[_0x2030('0xd')](_0x2030('0x8'),auth[_0x2030('0x9')](),controller[_0x2030('0xe')]);module[_0x2030('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 550e978..8a03756 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 _0x94aa=['BOOLEAN','sequelize'];(function(_0x5a92ad,_0x2219a6){var _0x2466f8=function(_0x4ad04e){while(--_0x4ad04e){_0x5a92ad['push'](_0x5a92ad['shift']());}};_0x2466f8(++_0x2219a6);}(_0x94aa,0x65));var _0xa94a=function(_0x5bee26,_0x3d4891){_0x5bee26=_0x5bee26-0x0;var _0x557587=_0x94aa[_0x5bee26];return _0x557587;};'use strict';var Sequelize=require(_0xa94a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa94a('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6636=['BOOLEAN','sequelize','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6636,0x119));var _0x6663=function(_0x4320f9,_0x583285){_0x4320f9=_0x4320f9-0x0;var _0x5c71a9=_0x6636[_0x4320f9];return _0x5c71a9;};'use strict';var Sequelize=require(_0x6663('0x0'));module[_0x6663('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6663('0x2')]},'write':{'type':Sequelize[_0x6663('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 69f9012..15e5a19 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 _0x3d4c=['findOne','keys','User','sort','nolimit','getMembers','removeMembers','addMessage','ChatGroupId','$gte','split','hasOwnProperty','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','type','key','model','query','intersection','attributes','fields','length','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','describe','ChatInternalMessage','toInteger','addMembers','ids','omit'];(function(_0x154cbb,_0x43c57f){var _0x494584=function(_0x971bd9){while(--_0x971bd9){_0x154cbb['push'](_0x154cbb['shift']());}};_0x494584(++_0x43c57f);}(_0x3d4c,0x12a));var _0xc3d4=function(_0x32612f,_0x353794){_0x32612f=_0x32612f-0x0;var _0x1d2bc6=_0x3d4c[_0x32612f];return _0x1d2bc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3d4('0x0'));var zipdir=require(_0xc3d4('0x1'));var jsonpatch=require(_0xc3d4('0x2'));var rp=require(_0xc3d4('0x3'));var moment=require(_0xc3d4('0x4'));var BPromise=require(_0xc3d4('0x5'));var Mustache=require('mustache');var util=require(_0xc3d4('0x6'));var path=require(_0xc3d4('0x7'));var sox=require('sox');var csv=require(_0xc3d4('0x8'));var ejs=require(_0xc3d4('0x9'));var fs=require('fs');var fs_extra=require(_0xc3d4('0xa'));var _=require(_0xc3d4('0xb'));var squel=require(_0xc3d4('0xc'));var crypto=require(_0xc3d4('0xd'));var jsforce=require(_0xc3d4('0xe'));var deskjs=require(_0xc3d4('0xf'));var toCsv=require(_0xc3d4('0x8'));var querystring=require('querystring');var Papa=require(_0xc3d4('0x10'));var Redis=require('ioredis');var authService=require(_0xc3d4('0x11'));var qs=require(_0xc3d4('0x12'));var as=require(_0xc3d4('0x13'));var hardwareService=require(_0xc3d4('0x14'));var logger=require('../../config/logger')(_0xc3d4('0x15'));var utils=require(_0xc3d4('0x16'));var config=require(_0xc3d4('0x17'));var licenseUtil=require(_0xc3d4('0x18'));var db=require(_0xc3d4('0x19'))['db'];config[_0xc3d4('0x1a')]=_[_0xc3d4('0x1b')](config[_0xc3d4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc3d4('0x1a')]));require(_0xc3d4('0x1c'))[_0xc3d4('0x1d')](socket);function respondWithStatusCode(_0x18b12c,_0x28d16e){_0x28d16e=_0x28d16e||0xcc;return function(_0x56e563){if(_0x56e563){return _0x18b12c[_0xc3d4('0x1e')](_0x28d16e);}return _0x18b12c[_0xc3d4('0x1f')](_0x28d16e)[_0xc3d4('0x20')]();};}function respondWithResult(_0x257403,_0x37be54){_0x37be54=_0x37be54||0xc8;return function(_0x32fb11){if(_0x32fb11){return _0x257403[_0xc3d4('0x1f')](_0x37be54)[_0xc3d4('0x21')](_0x32fb11);}};}function respondWithFilteredResult(_0x458b75,_0x3598a3){return function(_0x4437b8){if(_0x4437b8){var _0x25a6c9=typeof _0x3598a3[_0xc3d4('0x22')]===_0xc3d4('0x23')&&typeof _0x3598a3[_0xc3d4('0x24')]===_0xc3d4('0x23');var _0x5289df=_0x4437b8[_0xc3d4('0x25')];var _0x4dd3e5=_0x25a6c9?0x0:_0x3598a3[_0xc3d4('0x22')];var _0x41e9b3=_0x25a6c9?_0x4437b8[_0xc3d4('0x25')]:_0x3598a3[_0xc3d4('0x22')]+_0x3598a3['limit'];var _0x1bf898;if(_0x41e9b3>=_0x5289df){_0x41e9b3=_0x5289df;_0x1bf898=0xc8;}else{_0x1bf898=0xce;}_0x458b75['status'](_0x1bf898);return _0x458b75[_0xc3d4('0x26')]('Content-Range',_0x4dd3e5+'-'+_0x41e9b3+'/'+_0x5289df)[_0xc3d4('0x21')](_0x4437b8);}return null;};}function patchUpdates(_0x1b1434){return function(_0x1b2c07){try{jsonpatch[_0xc3d4('0x27')](_0x1b2c07,_0x1b1434,!![]);}catch(_0x53c430){return BPromise['reject'](_0x53c430);}return _0x1b2c07[_0xc3d4('0x28')]();};}function saveUpdates(_0x5d1538,_0x53d986){return function(_0x56ad56){if(_0x56ad56){return _0x56ad56[_0xc3d4('0x29')](_0x5d1538)[_0xc3d4('0x2a')](function(_0x27f025){return _0x27f025;});}return null;};}function removeEntity(_0x51f9f1,_0x59262){return function(_0x2916fe){if(_0x2916fe){return _0x2916fe[_0xc3d4('0x2b')]()['then'](function(){_0x51f9f1[_0xc3d4('0x1f')](0xcc)[_0xc3d4('0x20')]();});}};}function handleEntityNotFound(_0x3710a0,_0x1c2cba){return function(_0x4b3871){if(!_0x4b3871){_0x3710a0[_0xc3d4('0x1e')](0x194);}return _0x4b3871;};}function handleError(_0x23817e,_0x51ab94){_0x51ab94=_0x51ab94||0x1f4;return function(_0x1d3be){logger[_0xc3d4('0x2c')](_0x1d3be[_0xc3d4('0x2d')]);if(_0x1d3be['name']){delete _0x1d3be[_0xc3d4('0x2e')];}_0x23817e[_0xc3d4('0x1f')](_0x51ab94)[_0xc3d4('0x2f')](_0x1d3be);};}exports['index']=function(_0x32a548,_0xc4242b){var _0x5d182d={},_0x345094={},_0x6cd03a={'count':0x0,'rows':[]};var _0x3590b7=_[_0xc3d4('0x30')](db[_0xc3d4('0x31')][_0xc3d4('0x32')],function(_0x1fa3d9){return{'name':_0x1fa3d9['fieldName'],'type':_0x1fa3d9[_0xc3d4('0x33')][_0xc3d4('0x34')]};});_0x345094[_0xc3d4('0x35')]=_[_0xc3d4('0x30')](_0x3590b7,_0xc3d4('0x2e'));_0x345094['query']=_['keys'](_0x32a548[_0xc3d4('0x36')]);_0x345094['filters']=_[_0xc3d4('0x37')](_0x345094[_0xc3d4('0x35')],_0x345094[_0xc3d4('0x36')]);_0x5d182d[_0xc3d4('0x38')]=_['intersection'](_0x345094['model'],qs[_0xc3d4('0x39')](_0x32a548[_0xc3d4('0x36')][_0xc3d4('0x39')]));_0x5d182d[_0xc3d4('0x38')]=_0x5d182d[_0xc3d4('0x38')][_0xc3d4('0x3a')]?_0x5d182d[_0xc3d4('0x38')]:_0x345094[_0xc3d4('0x35')];if(!_0x32a548[_0xc3d4('0x36')]['hasOwnProperty']('nolimit')){_0x5d182d[_0xc3d4('0x24')]=qs[_0xc3d4('0x24')](_0x32a548['query'][_0xc3d4('0x24')]);_0x5d182d[_0xc3d4('0x22')]=qs[_0xc3d4('0x22')](_0x32a548[_0xc3d4('0x36')][_0xc3d4('0x22')]);}_0x5d182d[_0xc3d4('0x3b')]=qs['sort'](_0x32a548[_0xc3d4('0x36')]['sort']);_0x5d182d[_0xc3d4('0x3c')]=qs['filters'](_[_0xc3d4('0x3d')](_0x32a548[_0xc3d4('0x36')],_0x345094['filters']),_0x3590b7);if(_0x32a548['query'][_0xc3d4('0x3e')]){_0x5d182d[_0xc3d4('0x3c')]=_[_0xc3d4('0x3f')](_0x5d182d['where'],{'$or':_[_0xc3d4('0x30')](_0x3590b7,function(_0x2c3952){if(_0x2c3952[_0xc3d4('0x33')]!=='VIRTUAL'){var _0x1dde41={};_0x1dde41[_0x2c3952[_0xc3d4('0x2e')]]={'$like':'%'+_0x32a548['query'][_0xc3d4('0x3e')]+'%'};return _0x1dde41;}})});}_0x5d182d=_['merge']({},_0x5d182d,_0x32a548[_0xc3d4('0x40')]);var _0x437858={'where':_0x5d182d[_0xc3d4('0x3c')]};return db[_0xc3d4('0x31')][_0xc3d4('0x25')](_0x437858)[_0xc3d4('0x2a')](function(_0x56f6ef){_0x6cd03a[_0xc3d4('0x25')]=_0x56f6ef;if(_0x32a548[_0xc3d4('0x36')][_0xc3d4('0x41')]){_0x5d182d[_0xc3d4('0x42')]=[{'all':!![]}];}return db[_0xc3d4('0x31')][_0xc3d4('0x43')](_0x5d182d);})['then'](function(_0x144120){_0x6cd03a[_0xc3d4('0x44')]=_0x144120;return _0x6cd03a;})[_0xc3d4('0x2a')](respondWithFilteredResult(_0xc4242b,_0x5d182d))[_0xc3d4('0x45')](handleError(_0xc4242b,null));};exports[_0xc3d4('0x46')]=function(_0x379604,_0x1a418e){var _0xc0fc89={'raw':!![],'where':{'id':_0x379604[_0xc3d4('0x47')]['id']}},_0x5dfe66={};_0x5dfe66[_0xc3d4('0x35')]=_['keys'](db[_0xc3d4('0x31')][_0xc3d4('0x32')]);_0x5dfe66[_0xc3d4('0x36')]=_['keys'](_0x379604[_0xc3d4('0x36')]);_0x5dfe66[_0xc3d4('0x48')]=_[_0xc3d4('0x37')](_0x5dfe66[_0xc3d4('0x35')],_0x5dfe66[_0xc3d4('0x36')]);_0xc0fc89['attributes']=_[_0xc3d4('0x37')](_0x5dfe66[_0xc3d4('0x35')],qs[_0xc3d4('0x39')](_0x379604[_0xc3d4('0x36')][_0xc3d4('0x39')]));_0xc0fc89[_0xc3d4('0x38')]=_0xc0fc89[_0xc3d4('0x38')]['length']?_0xc0fc89[_0xc3d4('0x38')]:_0x5dfe66['model'];if(_0x379604[_0xc3d4('0x36')][_0xc3d4('0x41')]){_0xc0fc89[_0xc3d4('0x42')]=[{'all':!![]}];}_0xc0fc89=_[_0xc3d4('0x3f')]({},_0xc0fc89,_0x379604[_0xc3d4('0x40')]);return db[_0xc3d4('0x31')][_0xc3d4('0x49')](_0xc0fc89)[_0xc3d4('0x2a')](handleEntityNotFound(_0x1a418e,null))[_0xc3d4('0x2a')](respondWithResult(_0x1a418e,null))[_0xc3d4('0x45')](handleError(_0x1a418e,null));};exports[_0xc3d4('0x4a')]=function(_0x250884,_0x9cbaaa){return db[_0xc3d4('0x31')][_0xc3d4('0x4a')](_0x250884['body'],{})[_0xc3d4('0x2a')](respondWithResult(_0x9cbaaa,0xc9))[_0xc3d4('0x45')](handleError(_0x9cbaaa,null));};exports[_0xc3d4('0x29')]=function(_0x51ae7b,_0x338a14){if(_0x51ae7b[_0xc3d4('0x4b')]['id']){delete _0x51ae7b[_0xc3d4('0x4b')]['id'];}return db[_0xc3d4('0x31')][_0xc3d4('0x49')]({'where':{'id':_0x51ae7b['params']['id']}})[_0xc3d4('0x2a')](handleEntityNotFound(_0x338a14,null))['then'](saveUpdates(_0x51ae7b[_0xc3d4('0x4b')],null))[_0xc3d4('0x2a')](respondWithResult(_0x338a14,null))[_0xc3d4('0x45')](handleError(_0x338a14,null));};exports[_0xc3d4('0x2b')]=function(_0x370610,_0x7bfadb){return db['ChatGroup']['find']({'where':{'id':_0x370610[_0xc3d4('0x47')]['id']}})[_0xc3d4('0x2a')](handleEntityNotFound(_0x7bfadb,null))[_0xc3d4('0x2a')](removeEntity(_0x7bfadb,null))[_0xc3d4('0x45')](handleError(_0x7bfadb,null));};exports[_0xc3d4('0x4c')]=function(_0x32ae4f,_0x24ab39){return db[_0xc3d4('0x31')][_0xc3d4('0x4c')]()['then'](respondWithResult(_0x24ab39,null))[_0xc3d4('0x45')](handleError(_0x24ab39,null));};exports['getUnread']=function(_0x1af5e9,_0x59609c,_0x2d6d5a){return db[_0xc3d4('0x4d')]['count']({'where':{'ChatGroupId':_0x1af5e9[_0xc3d4('0x47')]['id'],'ToId':_0x1af5e9['user']['id'],'read':![]}})[_0xc3d4('0x2a')](function(_0x3f2063){return{'id':_[_0xc3d4('0x4e')](_0x1af5e9[_0xc3d4('0x47')]['id']),'count':_0x3f2063};})[_0xc3d4('0x2a')](respondWithResult(_0x59609c,null))['catch'](handleError(_0x59609c,null));};exports[_0xc3d4('0x4f')]=function(_0xd46579,_0x15137e,_0x390c8f){return db[_0xc3d4('0x31')][_0xc3d4('0x49')]({'where':{'id':_0xd46579[_0xc3d4('0x47')]['id']}})['then'](handleEntityNotFound(_0x15137e,null))[_0xc3d4('0x2a')](function(_0xaa12b8){if(_0xaa12b8){return _0xaa12b8[_0xc3d4('0x4f')](_0xd46579['body'][_0xc3d4('0x50')],_[_0xc3d4('0x51')](_0xd46579['body'],[_0xc3d4('0x50'),'id'])||{});}})['then'](respondWithResult(_0x15137e,null))[_0xc3d4('0x45')](handleError(_0x15137e,null));};exports['getMembers']=function(_0x382269,_0x50eeff,_0x1cefa4){var _0x4adb5d={};var _0x577ac5={};var _0x183801;var _0x46cc15;return db[_0xc3d4('0x31')][_0xc3d4('0x52')]({'where':{'id':_0x382269[_0xc3d4('0x47')]['id']}})[_0xc3d4('0x2a')](handleEntityNotFound(_0x50eeff,null))['then'](function(_0x1ae8cd){if(_0x1ae8cd){_0x183801=_0x1ae8cd;_0x577ac5[_0xc3d4('0x35')]=_[_0xc3d4('0x53')](db[_0xc3d4('0x54')][_0xc3d4('0x32')]);_0x577ac5['query']=_['keys'](_0x382269[_0xc3d4('0x36')]);_0x577ac5[_0xc3d4('0x48')]=_[_0xc3d4('0x37')](_0x577ac5['model'],_0x577ac5['query']);_0x4adb5d[_0xc3d4('0x38')]=_[_0xc3d4('0x37')](_0x577ac5['model'],qs['fields'](_0x382269['query'][_0xc3d4('0x39')]));_0x4adb5d[_0xc3d4('0x38')]=_0x4adb5d['attributes']['length']?_0x4adb5d['attributes']:_0x577ac5[_0xc3d4('0x35')];_0x4adb5d[_0xc3d4('0x3b')]=qs[_0xc3d4('0x55')](_0x382269['query'][_0xc3d4('0x55')]);_0x4adb5d[_0xc3d4('0x3c')]=qs[_0xc3d4('0x48')](_[_0xc3d4('0x3d')](_0x382269['query'],_0x577ac5[_0xc3d4('0x48')]));if(_0x382269[_0xc3d4('0x36')][_0xc3d4('0x3e')]){_0x4adb5d[_0xc3d4('0x3c')]=_['merge'](_0x4adb5d[_0xc3d4('0x3c')],{'$or':_[_0xc3d4('0x30')](_0x4adb5d[_0xc3d4('0x38')],function(_0x29b8d6){var _0x1edf7d={};_0x1edf7d[_0x29b8d6]={'$like':'%'+_0x382269[_0xc3d4('0x36')][_0xc3d4('0x3e')]+'%'};return _0x1edf7d;})});}_0x4adb5d=_[_0xc3d4('0x3f')]({},_0x4adb5d,_0x382269['options']);return _0x183801['getMembers'](_0x4adb5d);}})[_0xc3d4('0x2a')](function(_0x438548){if(_0x438548){_0x46cc15=_0x438548[_0xc3d4('0x3a')];if(!_0x382269[_0xc3d4('0x36')]['hasOwnProperty'](_0xc3d4('0x56'))){_0x4adb5d[_0xc3d4('0x24')]=qs[_0xc3d4('0x24')](_0x382269[_0xc3d4('0x36')][_0xc3d4('0x24')]);_0x4adb5d[_0xc3d4('0x22')]=qs[_0xc3d4('0x22')](_0x382269[_0xc3d4('0x36')][_0xc3d4('0x22')]);}return _0x183801[_0xc3d4('0x57')](_0x4adb5d);}})['then'](function(_0x3ad302){if(_0x3ad302){return _0x3ad302?{'count':_0x46cc15,'rows':_0x3ad302}:null;}})[_0xc3d4('0x2a')](respondWithResult(_0x50eeff,null))[_0xc3d4('0x45')](handleError(_0x50eeff,null));};exports[_0xc3d4('0x58')]=function(_0x2cf1d6,_0x7c46bc,_0x4c64a1){return db[_0xc3d4('0x31')][_0xc3d4('0x49')]({'where':{'id':_0x2cf1d6[_0xc3d4('0x47')]['id']}})[_0xc3d4('0x2a')](handleEntityNotFound(_0x7c46bc,null))[_0xc3d4('0x2a')](function(_0x430fb7){if(_0x430fb7){return _0x430fb7[_0xc3d4('0x58')](_0x2cf1d6[_0xc3d4('0x36')]['ids']);}})[_0xc3d4('0x2a')](respondWithStatusCode(_0x7c46bc,null))['catch'](handleError(_0x7c46bc,null));};exports[_0xc3d4('0x59')]=function(_0x198b43,_0xef0f73,_0x2cacf8){if(_0x198b43[_0xc3d4('0x4b')]['id']){delete _0x198b43['body']['id'];}return db[_0xc3d4('0x31')]['find']({'where':{'id':_0x198b43[_0xc3d4('0x47')]['id']}})[_0xc3d4('0x2a')](handleEntityNotFound(_0xef0f73,null))['then'](function(_0x7b13db){if(_0x7b13db){_0x198b43[_0xc3d4('0x4b')][_0xc3d4('0x5a')]=_0x7b13db['id'];return db[_0xc3d4('0x4d')][_0xc3d4('0x4a')](_0x198b43['body']);}})[_0xc3d4('0x2a')](respondWithResult(_0xef0f73,null))[_0xc3d4('0x45')](handleError(_0xef0f73,null));};exports['getMessages']=function(_0x6f1bad,_0x36fa6e,_0x3cb4a2){var _0x3f861f={};var _0x1a77e5={};var _0x527b15;var _0x2b5e67;return db[_0xc3d4('0x31')][_0xc3d4('0x52')]({'where':{'id':_0x6f1bad[_0xc3d4('0x47')]['id']}})[_0xc3d4('0x2a')](handleEntityNotFound(_0x36fa6e,null))[_0xc3d4('0x2a')](function(_0x162f91){if(_0x162f91){_0x527b15=_0x162f91;_0x1a77e5['model']=_[_0xc3d4('0x53')](db[_0xc3d4('0x4d')][_0xc3d4('0x32')]);_0x1a77e5[_0xc3d4('0x36')]=_[_0xc3d4('0x53')](_0x6f1bad[_0xc3d4('0x36')]);_0x1a77e5[_0xc3d4('0x48')]=_['intersection'](_0x1a77e5[_0xc3d4('0x35')],_0x1a77e5[_0xc3d4('0x36')]);_0x3f861f[_0xc3d4('0x38')]=_[_0xc3d4('0x37')](_0x1a77e5['model'],qs[_0xc3d4('0x39')](_0x6f1bad[_0xc3d4('0x36')][_0xc3d4('0x39')]));_0x3f861f[_0xc3d4('0x38')]=_0x3f861f[_0xc3d4('0x38')][_0xc3d4('0x3a')]?_0x3f861f['attributes']:_0x1a77e5['model'];_0x3f861f[_0xc3d4('0x3b')]=qs['sort'](_0x6f1bad[_0xc3d4('0x36')][_0xc3d4('0x55')]);_0x3f861f[_0xc3d4('0x3c')]=qs[_0xc3d4('0x48')](_[_0xc3d4('0x3d')](_0x6f1bad['query'],_0x1a77e5[_0xc3d4('0x48')]));if(_0x6f1bad[_0xc3d4('0x36')]['filter']){_0x3f861f[_0xc3d4('0x3c')]=_[_0xc3d4('0x3f')](_0x3f861f[_0xc3d4('0x3c')],{'$or':_[_0xc3d4('0x30')](_0x3f861f[_0xc3d4('0x38')],function(_0xb66961){var _0x546d59={};_0x546d59[_0xb66961]={'$like':'%'+_0x6f1bad['query'][_0xc3d4('0x3e')]+'%'};return _0x546d59;})});}if(_0x6f1bad[_0xc3d4('0x36')][_0xc3d4('0x5b')]){var _0x60352c=_0x6f1bad[_0xc3d4('0x36')][_0xc3d4('0x5b')][_0xc3d4('0x5c')](',');var _0x355e0b={};_0x355e0b[_0x60352c[0x0]]={'$gte':moment(_0x60352c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3f861f['where']=_['merge'](_0x3f861f['where'],_0x355e0b);}_0x3f861f=_[_0xc3d4('0x3f')]({},_0x3f861f,_0x6f1bad[_0xc3d4('0x40')]);return _0x527b15['getMessages'](_0x3f861f);}})[_0xc3d4('0x2a')](function(_0x6c5fa9){if(_0x6c5fa9){_0x2b5e67=_0x6c5fa9[_0xc3d4('0x3a')];if(!_0x6f1bad[_0xc3d4('0x36')][_0xc3d4('0x5d')](_0xc3d4('0x56'))){_0x3f861f['limit']=qs[_0xc3d4('0x24')](_0x6f1bad[_0xc3d4('0x36')][_0xc3d4('0x24')]);_0x3f861f['offset']=qs[_0xc3d4('0x22')](_0x6f1bad['query'][_0xc3d4('0x22')]);}return _0x527b15[_0xc3d4('0x5e')](_0x3f861f);}})[_0xc3d4('0x2a')](function(_0x5d9379){if(_0x5d9379){return _0x5d9379?{'count':_0x2b5e67,'rows':_0x5d9379}:null;}})[_0xc3d4('0x2a')](respondWithResult(_0x36fa6e,null))[_0xc3d4('0x45')](handleError(_0x36fa6e,null));}; \ No newline at end of file +var _0x692f=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatGroup','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','user','addMembers','ids','omit','getMembers','findOne','pick','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x445c46,_0x3cebeb){var _0x26bcf4=function(_0x3f7426){while(--_0x3f7426){_0x445c46['push'](_0x445c46['shift']());}};_0x26bcf4(++_0x3cebeb);}(_0x692f,0x184));var _0xf692=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0x692f[_0x480fc2];return _0x540a95;};'use strict';var emlformat=require(_0xf692('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf692('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf692('0x2'));var moment=require(_0xf692('0x3'));var BPromise=require(_0xf692('0x4'));var Mustache=require(_0xf692('0x5'));var util=require(_0xf692('0x6'));var path=require(_0xf692('0x7'));var sox=require(_0xf692('0x8'));var csv=require('to-csv');var ejs=require(_0xf692('0x9'));var fs=require('fs');var fs_extra=require(_0xf692('0xa'));var _=require(_0xf692('0xb'));var squel=require(_0xf692('0xc'));var crypto=require(_0xf692('0xd'));var jsforce=require(_0xf692('0xe'));var deskjs=require(_0xf692('0xf'));var toCsv=require(_0xf692('0x10'));var querystring=require(_0xf692('0x11'));var Papa=require(_0xf692('0x12'));var Redis=require(_0xf692('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf692('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf692('0x15'));var logger=require(_0xf692('0x16'))(_0xf692('0x17'));var utils=require(_0xf692('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf692('0x19'))['db'];config[_0xf692('0x1a')]=_[_0xf692('0x1b')](config[_0xf692('0x1a')],{'host':_0xf692('0x1c'),'port':0x18eb});var socket=require(_0xf692('0x1d'))(new Redis(config[_0xf692('0x1a')]));require('./chatGroup.socket')[_0xf692('0x1e')](socket);function respondWithStatusCode(_0x110183,_0x8064e0){_0x8064e0=_0x8064e0||0xcc;return function(_0x401ff2){if(_0x401ff2){return _0x110183[_0xf692('0x1f')](_0x8064e0);}return _0x110183[_0xf692('0x20')](_0x8064e0)[_0xf692('0x21')]();};}function respondWithResult(_0x327be2,_0x50b6ed){_0x50b6ed=_0x50b6ed||0xc8;return function(_0x893de5){if(_0x893de5){return _0x327be2[_0xf692('0x20')](_0x50b6ed)[_0xf692('0x22')](_0x893de5);}};}function respondWithFilteredResult(_0x5c6ca0,_0x1dddde){return function(_0x45b7be){if(_0x45b7be){var _0x302f8e=typeof _0x1dddde[_0xf692('0x23')]==='undefined'&&typeof _0x1dddde[_0xf692('0x24')]===_0xf692('0x25');var _0x4d3159=_0x45b7be['count'];var _0x1914af=_0x302f8e?0x0:_0x1dddde[_0xf692('0x23')];var _0x235694=_0x302f8e?_0x45b7be[_0xf692('0x26')]:_0x1dddde['offset']+_0x1dddde[_0xf692('0x24')];var _0x15df0c;if(_0x235694>=_0x4d3159){_0x235694=_0x4d3159;_0x15df0c=0xc8;}else{_0x15df0c=0xce;}_0x5c6ca0[_0xf692('0x20')](_0x15df0c);return _0x5c6ca0[_0xf692('0x27')](_0xf692('0x28'),_0x1914af+'-'+_0x235694+'/'+_0x4d3159)[_0xf692('0x22')](_0x45b7be);}return null;};}function patchUpdates(_0x4af974){return function(_0x224174){try{jsonpatch[_0xf692('0x29')](_0x224174,_0x4af974,!![]);}catch(_0x1b7bda){return BPromise[_0xf692('0x2a')](_0x1b7bda);}return _0x224174[_0xf692('0x2b')]();};}function saveUpdates(_0x59cb73,_0x5c1cb8){return function(_0x3d9960){if(_0x3d9960){return _0x3d9960[_0xf692('0x2c')](_0x59cb73)[_0xf692('0x2d')](function(_0x13307d){return _0x13307d;});}return null;};}function removeEntity(_0x5707fb,_0x3b66e8){return function(_0x45e754){if(_0x45e754){return _0x45e754[_0xf692('0x2e')]()[_0xf692('0x2d')](function(){_0x5707fb[_0xf692('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f28c0,_0x421d58){return function(_0x4b8076){if(!_0x4b8076){_0x3f28c0['sendStatus'](0x194);}return _0x4b8076;};}function handleError(_0x1845ba,_0x155631){_0x155631=_0x155631||0x1f4;return function(_0x38660c){logger[_0xf692('0x2f')](_0x38660c[_0xf692('0x30')]);if(_0x38660c[_0xf692('0x31')]){delete _0x38660c[_0xf692('0x31')];}_0x1845ba[_0xf692('0x20')](_0x155631)[_0xf692('0x32')](_0x38660c);};}exports[_0xf692('0x33')]=function(_0x2ba01b,_0x11341e){var _0x395502={},_0x2a744f={},_0x55922b={'count':0x0,'rows':[]};var _0x4fa321=_['map'](db[_0xf692('0x34')]['rawAttributes'],function(_0x39c06a){return{'name':_0x39c06a[_0xf692('0x35')],'type':_0x39c06a[_0xf692('0x36')][_0xf692('0x37')]};});_0x2a744f['model']=_[_0xf692('0x38')](_0x4fa321,'name');_0x2a744f[_0xf692('0x39')]=_[_0xf692('0x3a')](_0x2ba01b[_0xf692('0x39')]);_0x2a744f[_0xf692('0x3b')]=_[_0xf692('0x3c')](_0x2a744f[_0xf692('0x3d')],_0x2a744f[_0xf692('0x39')]);_0x395502[_0xf692('0x3e')]=_[_0xf692('0x3c')](_0x2a744f[_0xf692('0x3d')],qs['fields'](_0x2ba01b[_0xf692('0x39')][_0xf692('0x3f')]));_0x395502[_0xf692('0x3e')]=_0x395502[_0xf692('0x3e')][_0xf692('0x40')]?_0x395502[_0xf692('0x3e')]:_0x2a744f[_0xf692('0x3d')];if(!_0x2ba01b['query'][_0xf692('0x41')](_0xf692('0x42'))){_0x395502[_0xf692('0x24')]=qs[_0xf692('0x24')](_0x2ba01b['query'][_0xf692('0x24')]);_0x395502['offset']=qs[_0xf692('0x23')](_0x2ba01b[_0xf692('0x39')]['offset']);}_0x395502[_0xf692('0x43')]=qs[_0xf692('0x44')](_0x2ba01b[_0xf692('0x39')]['sort']);_0x395502['where']=qs[_0xf692('0x3b')](_['pick'](_0x2ba01b[_0xf692('0x39')],_0x2a744f['filters']),_0x4fa321);if(_0x2ba01b[_0xf692('0x39')][_0xf692('0x45')]){_0x395502[_0xf692('0x46')]=_[_0xf692('0x47')](_0x395502[_0xf692('0x46')],{'$or':_[_0xf692('0x38')](_0x4fa321,function(_0x1e795b){if(_0x1e795b[_0xf692('0x36')]!==_0xf692('0x48')){var _0x4f9b65={};_0x4f9b65[_0x1e795b[_0xf692('0x31')]]={'$like':'%'+_0x2ba01b[_0xf692('0x39')][_0xf692('0x45')]+'%'};return _0x4f9b65;}})});}_0x395502=_[_0xf692('0x47')]({},_0x395502,_0x2ba01b[_0xf692('0x49')]);var _0x5cf399={'where':_0x395502[_0xf692('0x46')]};return db['ChatGroup'][_0xf692('0x26')](_0x5cf399)['then'](function(_0x950929){_0x55922b[_0xf692('0x26')]=_0x950929;if(_0x2ba01b[_0xf692('0x39')][_0xf692('0x4a')]){_0x395502[_0xf692('0x4b')]=[{'all':!![]}];}return db[_0xf692('0x34')][_0xf692('0x4c')](_0x395502);})[_0xf692('0x2d')](function(_0x319605){_0x55922b[_0xf692('0x4d')]=_0x319605;return _0x55922b;})[_0xf692('0x2d')](respondWithFilteredResult(_0x11341e,_0x395502))[_0xf692('0x4e')](handleError(_0x11341e,null));};exports[_0xf692('0x4f')]=function(_0xe37e82,_0xe8bcdf){var _0x3b1d93={'raw':!![],'where':{'id':_0xe37e82[_0xf692('0x50')]['id']}},_0x4ac60b={};_0x4ac60b[_0xf692('0x3d')]=_[_0xf692('0x3a')](db[_0xf692('0x34')][_0xf692('0x51')]);_0x4ac60b[_0xf692('0x39')]=_[_0xf692('0x3a')](_0xe37e82['query']);_0x4ac60b[_0xf692('0x3b')]=_[_0xf692('0x3c')](_0x4ac60b['model'],_0x4ac60b[_0xf692('0x39')]);_0x3b1d93[_0xf692('0x3e')]=_[_0xf692('0x3c')](_0x4ac60b[_0xf692('0x3d')],qs['fields'](_0xe37e82['query'][_0xf692('0x3f')]));_0x3b1d93[_0xf692('0x3e')]=_0x3b1d93[_0xf692('0x3e')][_0xf692('0x40')]?_0x3b1d93[_0xf692('0x3e')]:_0x4ac60b['model'];if(_0xe37e82[_0xf692('0x39')][_0xf692('0x4a')]){_0x3b1d93[_0xf692('0x4b')]=[{'all':!![]}];}_0x3b1d93=_[_0xf692('0x47')]({},_0x3b1d93,_0xe37e82[_0xf692('0x49')]);return db['ChatGroup'][_0xf692('0x52')](_0x3b1d93)[_0xf692('0x2d')](handleEntityNotFound(_0xe8bcdf,null))[_0xf692('0x2d')](respondWithResult(_0xe8bcdf,null))[_0xf692('0x4e')](handleError(_0xe8bcdf,null));};exports[_0xf692('0x53')]=function(_0x198f21,_0x135a93){return db[_0xf692('0x34')][_0xf692('0x53')](_0x198f21[_0xf692('0x54')],{})[_0xf692('0x2d')](respondWithResult(_0x135a93,0xc9))[_0xf692('0x4e')](handleError(_0x135a93,null));};exports['update']=function(_0x1a3eb3,_0x432e52){if(_0x1a3eb3[_0xf692('0x54')]['id']){delete _0x1a3eb3[_0xf692('0x54')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1a3eb3['params']['id']}})['then'](handleEntityNotFound(_0x432e52,null))[_0xf692('0x2d')](saveUpdates(_0x1a3eb3['body'],null))['then'](respondWithResult(_0x432e52,null))[_0xf692('0x4e')](handleError(_0x432e52,null));};exports[_0xf692('0x2e')]=function(_0xb0a5c7,_0x597aef){return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0xb0a5c7[_0xf692('0x50')]['id']}})[_0xf692('0x2d')](handleEntityNotFound(_0x597aef,null))[_0xf692('0x2d')](removeEntity(_0x597aef,null))[_0xf692('0x4e')](handleError(_0x597aef,null));};exports['describe']=function(_0x827a78,_0x45a316){return db['ChatGroup'][_0xf692('0x55')]()['then'](respondWithResult(_0x45a316,null))['catch'](handleError(_0x45a316,null));};exports['getUnread']=function(_0xf98dd9,_0x47962f,_0x5a01c5){return db['ChatInternalMessage'][_0xf692('0x26')]({'where':{'ChatGroupId':_0xf98dd9[_0xf692('0x50')]['id'],'ToId':_0xf98dd9[_0xf692('0x56')]['id'],'read':![]}})[_0xf692('0x2d')](function(_0x1b61b0){return{'id':_['toInteger'](_0xf98dd9[_0xf692('0x50')]['id']),'count':_0x1b61b0};})[_0xf692('0x2d')](respondWithResult(_0x47962f,null))[_0xf692('0x4e')](handleError(_0x47962f,null));};exports[_0xf692('0x57')]=function(_0x414150,_0x29192e,_0xc33cd2){return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0x414150[_0xf692('0x50')]['id']}})['then'](handleEntityNotFound(_0x29192e,null))[_0xf692('0x2d')](function(_0x122eb2){if(_0x122eb2){return _0x122eb2[_0xf692('0x57')](_0x414150[_0xf692('0x54')][_0xf692('0x58')],_[_0xf692('0x59')](_0x414150[_0xf692('0x54')],[_0xf692('0x58'),'id'])||{});}})[_0xf692('0x2d')](respondWithResult(_0x29192e,null))['catch'](handleError(_0x29192e,null));};exports[_0xf692('0x5a')]=function(_0x4112b7,_0x342852,_0x3a5e02){var _0x46749f={};var _0x51d7f6={};var _0x49123d;var _0x773874;return db[_0xf692('0x34')][_0xf692('0x5b')]({'where':{'id':_0x4112b7[_0xf692('0x50')]['id']}})[_0xf692('0x2d')](handleEntityNotFound(_0x342852,null))[_0xf692('0x2d')](function(_0x11e17f){if(_0x11e17f){_0x49123d=_0x11e17f;_0x51d7f6[_0xf692('0x3d')]=_[_0xf692('0x3a')](db['User'][_0xf692('0x51')]);_0x51d7f6[_0xf692('0x39')]=_[_0xf692('0x3a')](_0x4112b7[_0xf692('0x39')]);_0x51d7f6[_0xf692('0x3b')]=_['intersection'](_0x51d7f6['model'],_0x51d7f6[_0xf692('0x39')]);_0x46749f[_0xf692('0x3e')]=_['intersection'](_0x51d7f6[_0xf692('0x3d')],qs[_0xf692('0x3f')](_0x4112b7[_0xf692('0x39')]['fields']));_0x46749f[_0xf692('0x3e')]=_0x46749f['attributes'][_0xf692('0x40')]?_0x46749f['attributes']:_0x51d7f6['model'];_0x46749f[_0xf692('0x43')]=qs['sort'](_0x4112b7[_0xf692('0x39')][_0xf692('0x44')]);_0x46749f[_0xf692('0x46')]=qs[_0xf692('0x3b')](_[_0xf692('0x5c')](_0x4112b7[_0xf692('0x39')],_0x51d7f6[_0xf692('0x3b')]));if(_0x4112b7[_0xf692('0x39')][_0xf692('0x45')]){_0x46749f[_0xf692('0x46')]=_[_0xf692('0x47')](_0x46749f[_0xf692('0x46')],{'$or':_[_0xf692('0x38')](_0x46749f['attributes'],function(_0x329e65){var _0x4af8be={};_0x4af8be[_0x329e65]={'$like':'%'+_0x4112b7[_0xf692('0x39')]['filter']+'%'};return _0x4af8be;})});}_0x46749f=_[_0xf692('0x47')]({},_0x46749f,_0x4112b7['options']);return _0x49123d[_0xf692('0x5a')](_0x46749f);}})[_0xf692('0x2d')](function(_0x405c11){if(_0x405c11){_0x773874=_0x405c11['length'];if(!_0x4112b7[_0xf692('0x39')][_0xf692('0x41')](_0xf692('0x42'))){_0x46749f[_0xf692('0x24')]=qs[_0xf692('0x24')](_0x4112b7[_0xf692('0x39')][_0xf692('0x24')]);_0x46749f[_0xf692('0x23')]=qs['offset'](_0x4112b7[_0xf692('0x39')]['offset']);}return _0x49123d[_0xf692('0x5a')](_0x46749f);}})[_0xf692('0x2d')](function(_0x4eb826){if(_0x4eb826){return _0x4eb826?{'count':_0x773874,'rows':_0x4eb826}:null;}})[_0xf692('0x2d')](respondWithResult(_0x342852,null))[_0xf692('0x4e')](handleError(_0x342852,null));};exports[_0xf692('0x5d')]=function(_0x9c7a85,_0x378bc7,_0x1aefda){return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0x9c7a85['params']['id']}})['then'](handleEntityNotFound(_0x378bc7,null))[_0xf692('0x2d')](function(_0x307b93){if(_0x307b93){return _0x307b93[_0xf692('0x5d')](_0x9c7a85[_0xf692('0x39')][_0xf692('0x58')]);}})['then'](respondWithStatusCode(_0x378bc7,null))['catch'](handleError(_0x378bc7,null));};exports[_0xf692('0x5e')]=function(_0x4e5e8e,_0x1f0843,_0x4301fe){if(_0x4e5e8e[_0xf692('0x54')]['id']){delete _0x4e5e8e[_0xf692('0x54')]['id'];}return db[_0xf692('0x34')][_0xf692('0x52')]({'where':{'id':_0x4e5e8e[_0xf692('0x50')]['id']}})[_0xf692('0x2d')](handleEntityNotFound(_0x1f0843,null))[_0xf692('0x2d')](function(_0x21d0af){if(_0x21d0af){_0x4e5e8e[_0xf692('0x54')][_0xf692('0x5f')]=_0x21d0af['id'];return db[_0xf692('0x60')]['create'](_0x4e5e8e[_0xf692('0x54')]);}})[_0xf692('0x2d')](respondWithResult(_0x1f0843,null))['catch'](handleError(_0x1f0843,null));};exports[_0xf692('0x61')]=function(_0x30fa08,_0x2c5e04,_0x51cf04){var _0x246cae={};var _0x1c1a43={};var _0x526ca9;var _0x2faf30;return db[_0xf692('0x34')][_0xf692('0x5b')]({'where':{'id':_0x30fa08[_0xf692('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c5e04,null))[_0xf692('0x2d')](function(_0x2eb70d){if(_0x2eb70d){_0x526ca9=_0x2eb70d;_0x1c1a43[_0xf692('0x3d')]=_[_0xf692('0x3a')](db[_0xf692('0x60')]['rawAttributes']);_0x1c1a43[_0xf692('0x39')]=_['keys'](_0x30fa08[_0xf692('0x39')]);_0x1c1a43['filters']=_[_0xf692('0x3c')](_0x1c1a43[_0xf692('0x3d')],_0x1c1a43['query']);_0x246cae[_0xf692('0x3e')]=_['intersection'](_0x1c1a43['model'],qs[_0xf692('0x3f')](_0x30fa08[_0xf692('0x39')][_0xf692('0x3f')]));_0x246cae[_0xf692('0x3e')]=_0x246cae['attributes'][_0xf692('0x40')]?_0x246cae[_0xf692('0x3e')]:_0x1c1a43[_0xf692('0x3d')];_0x246cae[_0xf692('0x43')]=qs['sort'](_0x30fa08[_0xf692('0x39')][_0xf692('0x44')]);_0x246cae[_0xf692('0x46')]=qs[_0xf692('0x3b')](_['pick'](_0x30fa08[_0xf692('0x39')],_0x1c1a43[_0xf692('0x3b')]));if(_0x30fa08[_0xf692('0x39')][_0xf692('0x45')]){_0x246cae['where']=_[_0xf692('0x47')](_0x246cae[_0xf692('0x46')],{'$or':_[_0xf692('0x38')](_0x246cae[_0xf692('0x3e')],function(_0x588ca6){var _0x3cc206={};_0x3cc206[_0x588ca6]={'$like':'%'+_0x30fa08[_0xf692('0x39')]['filter']+'%'};return _0x3cc206;})});}if(_0x30fa08[_0xf692('0x39')][_0xf692('0x62')]){var _0xeae014=_0x30fa08[_0xf692('0x39')]['$gte']['split'](',');var _0x5485d1={};_0x5485d1[_0xeae014[0x0]]={'$gte':moment(_0xeae014[0x1])['format'](_0xf692('0x63'))};_0x246cae['where']=_[_0xf692('0x47')](_0x246cae['where'],_0x5485d1);}_0x246cae=_['merge']({},_0x246cae,_0x30fa08[_0xf692('0x49')]);return _0x526ca9[_0xf692('0x61')](_0x246cae);}})['then'](function(_0x5aed88){if(_0x5aed88){_0x2faf30=_0x5aed88['length'];if(!_0x30fa08[_0xf692('0x39')]['hasOwnProperty']('nolimit')){_0x246cae[_0xf692('0x24')]=qs[_0xf692('0x24')](_0x30fa08[_0xf692('0x39')]['limit']);_0x246cae[_0xf692('0x23')]=qs[_0xf692('0x23')](_0x30fa08[_0xf692('0x39')][_0xf692('0x23')]);}return _0x526ca9[_0xf692('0x61')](_0x246cae);}})['then'](function(_0x2a0854){if(_0x2a0854){return _0x2a0854?{'count':_0x2faf30,'rows':_0x2a0854}:null;}})[_0xf692('0x2d')](respondWithResult(_0x2c5e04,null))[_0xf692('0x4e')](handleError(_0x2c5e04,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 727ab96..fe93928 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 _0x85d6=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85d6,0x135));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x685d('0x0'));var ChatGroup=require(_0x685d('0x1'))['db'][_0x685d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x685d('0x3')](0x0);var events={'afterCreate':_0x685d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x447935){return function(_0x5074f9,_0xa4c797,_0x362db4){ChatGroupEvents[_0x685d('0x5')](_0x447935+':'+_0x5074f9['id'],_0x5074f9);ChatGroupEvents[_0x685d('0x5')](_0x447935,_0x5074f9);_0x362db4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x685d('0x6')](e,emitEvent(event));}}module[_0x685d('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x71af=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x71af,0x194));var _0xf71a=function(_0xb0adba,_0x4399a9){_0xb0adba=_0xb0adba-0x0;var _0x2da679=_0x71af[_0xb0adba];return _0x2da679;};'use strict';var EventEmitter=require(_0xf71a('0x0'));var ChatGroup=require(_0xf71a('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf71a('0x2')](0x0);var events={'afterCreate':_0xf71a('0x3'),'afterUpdate':_0xf71a('0x4'),'afterDestroy':_0xf71a('0x5')};function emitEvent(_0x2158ea){return function(_0xee5102,_0x4863d6,_0x580200){ChatGroupEvents[_0xf71a('0x6')](_0x2158ea+':'+_0xee5102['id'],_0xee5102);ChatGroupEvents[_0xf71a('0x6')](_0x2158ea,_0xee5102);_0x580200(null);};}for(var e in events){if(events[_0xf71a('0x7')](e)){var event=events[e];ChatGroup[_0xf71a('0x8')](e,emitEvent(event));}}module[_0xf71a('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c34e454..e90ccd6 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 _0xfb7d=['exports','ChatGroup','chat_groups','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes'];(function(_0x421c08,_0x524eba){var _0x107a0b=function(_0x250416){while(--_0x250416){_0x421c08['push'](_0x421c08['shift']());}};_0x107a0b(++_0x524eba);}(_0xfb7d,0x1bf));var _0xdfb7=function(_0x40a8a4,_0x3bd1ed){_0x40a8a4=_0x40a8a4-0x0;var _0x23af3b=_0xfb7d[_0x40a8a4];return _0x23af3b;};'use strict';var _=require(_0xdfb7('0x0'));var util=require(_0xdfb7('0x1'));var logger=require(_0xdfb7('0x2'))(_0xdfb7('0x3'));var moment=require('moment');var BPromise=require(_0xdfb7('0x4'));var rp=require(_0xdfb7('0x5'));var fs=require('fs');var path=require(_0xdfb7('0x6'));var rimraf=require(_0xdfb7('0x7'));var config=require('../../config/environment');var attributes=require(_0xdfb7('0x8'));module[_0xdfb7('0x9')]=function(_0x38bf51,_0x308d85){return _0x38bf51['define'](_0xdfb7('0xa'),attributes,{'tableName':_0xdfb7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb834=['ChatGroup','chat_groups','../../config/logger','api','moment','path','rimraf','./chatGroup.attributes','exports'];(function(_0x3c17fb,_0x5f20ff){var _0x38e1f6=function(_0x1464ca){while(--_0x1464ca){_0x3c17fb['push'](_0x3c17fb['shift']());}};_0x38e1f6(++_0x5f20ff);}(_0xb834,0xda));var _0x4b83=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0xb834[_0x573c9e];return _0x5d0714;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b83('0x0'))(_0x4b83('0x1'));var moment=require(_0x4b83('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b83('0x3'));var rimraf=require(_0x4b83('0x4'));var config=require('../../config/environment');var attributes=require(_0x4b83('0x5'));module[_0x4b83('0x6')]=function(_0xc4495f,_0x5b3170){return _0xc4495f['define'](_0x4b83('0x7'),attributes,{'tableName':_0x4b83('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index a9d1948..d985860 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 _0x1cc7=['result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x1cc7,0x15a));var _0x71cc=function(_0x25f2a0,_0x93ce33){_0x25f2a0=_0x25f2a0-0x0;var _0x566d49=_0x1cc7[_0x25f2a0];return _0x566d49;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var moment=require(_0x71cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71cc('0x3'))['db'];var utils=require(_0x71cc('0x4'));var logger=require(_0x71cc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71cc('0x6')]['http']({'port':0x232a});config[_0x71cc('0x7')]=_[_0x71cc('0x8')](config[_0x71cc('0x7')],{'host':_0x71cc('0x9'),'port':0x18eb});var socket=require(_0x71cc('0xa'))(new Redis(config['redis']));require(_0x71cc('0xb'))[_0x71cc('0xc')](socket);function respondWithRpcPromise(_0x47759a,_0x5ae8e7,_0x554044){return new BPromise(function(_0x50a7b7,_0x4b7514){return client[_0x71cc('0xd')](_0x47759a,_0x554044)[_0x71cc('0xe')](function(_0x37e34b){logger['info'](_0x71cc('0xf'),_0x5ae8e7,'request\x20sent');logger[_0x71cc('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5ae8e7,_0x71cc('0x11'),JSON['stringify'](_0x37e34b));if(_0x37e34b[_0x71cc('0x12')]){if(_0x37e34b[_0x71cc('0x12')][_0x71cc('0x13')]===0x1f4){logger[_0x71cc('0x12')](_0x71cc('0xf'),_0x5ae8e7,_0x37e34b['error'][_0x71cc('0x14')]);return _0x4b7514(_0x37e34b[_0x71cc('0x12')][_0x71cc('0x14')]);}logger[_0x71cc('0x12')](_0x71cc('0xf'),_0x5ae8e7,_0x37e34b[_0x71cc('0x12')][_0x71cc('0x14')]);return _0x50a7b7(_0x37e34b['error'][_0x71cc('0x14')]);}else{logger[_0x71cc('0x15')](_0x71cc('0xf'),_0x5ae8e7,_0x71cc('0x11'));_0x50a7b7(_0x37e34b[_0x71cc('0x16')][_0x71cc('0x14')]);}})['catch'](function(_0x366690){logger[_0x71cc('0x12')]('ChatGroup,\x20%s,\x20%s',_0x5ae8e7,_0x366690);_0x4b7514(_0x366690);});});} \ No newline at end of file +var _0xe009=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','request\x20sent','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x233331,_0x177c38){var _0x3dff68=function(_0x6b3de9){while(--_0x6b3de9){_0x233331['push'](_0x233331['shift']());}};_0x3dff68(++_0x177c38);}(_0xe009,0x122));var _0x9e00=function(_0x2ae91b,_0x16b0f2){_0x2ae91b=_0x2ae91b-0x0;var _0x350099=_0xe009[_0x2ae91b];return _0x350099;};'use strict';var _=require(_0x9e00('0x0'));var util=require(_0x9e00('0x1'));var moment=require(_0x9e00('0x2'));var BPromise=require(_0x9e00('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e00('0x5'));var logger=require(_0x9e00('0x6'))(_0x9e00('0x7'));var config=require(_0x9e00('0x8'));var jayson=require(_0x9e00('0x9'));var client=jayson[_0x9e00('0xa')][_0x9e00('0xb')]({'port':0x232a});config[_0x9e00('0xc')]=_[_0x9e00('0xd')](config[_0x9e00('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e00('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x9e00('0xf')](socket);function respondWithRpcPromise(_0x9d62ed,_0x9aa2b6,_0x278208){return new BPromise(function(_0x4a73fc,_0x1fcd0c){return client[_0x9e00('0x10')](_0x9d62ed,_0x278208)[_0x9e00('0x11')](function(_0x484db6){logger[_0x9e00('0x12')]('ChatGroup,\x20%s,\x20%s',_0x9aa2b6,'request\x20sent');logger[_0x9e00('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x9aa2b6,_0x9e00('0x14'),JSON[_0x9e00('0x15')](_0x484db6));if(_0x484db6[_0x9e00('0x16')]){if(_0x484db6[_0x9e00('0x16')][_0x9e00('0x17')]===0x1f4){logger[_0x9e00('0x16')]('ChatGroup,\x20%s,\x20%s',_0x9aa2b6,_0x484db6['error'][_0x9e00('0x18')]);return _0x1fcd0c(_0x484db6['error'][_0x9e00('0x18')]);}logger[_0x9e00('0x16')](_0x9e00('0x19'),_0x9aa2b6,_0x484db6[_0x9e00('0x16')]['message']);return _0x4a73fc(_0x484db6['error']['message']);}else{logger['info'](_0x9e00('0x19'),_0x9aa2b6,'request\x20sent');_0x4a73fc(_0x484db6[_0x9e00('0x1a')][_0x9e00('0x18')]);}})['catch'](function(_0x3113bd){logger[_0x9e00('0x16')](_0x9e00('0x19'),_0x9aa2b6,_0x3113bd);_0x1fcd0c(_0x3113bd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 7863088..d55d504 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 _0xfd12=['emit','removeListener','./chatGroup.events','save','remove','update'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0xfd12,0xf8));var _0x2fd1=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xfd12[_0x249e96];return _0x17444c;};'use strict';var ChatGroupEvents=require(_0x2fd1('0x0'));var events=[_0x2fd1('0x1'),_0x2fd1('0x2'),_0x2fd1('0x3')];function createListener(_0x1889ae,_0x47c394){return function(_0x12bf5d){_0x47c394[_0x2fd1('0x4')](_0x1889ae,_0x12bf5d);};}function removeListener(_0x4a5aef,_0x58368d){return function(){ChatGroupEvents[_0x2fd1('0x5')](_0x4a5aef,_0x58368d);};}exports['register']=function(_0x238d53){for(var _0x3e6c6d=0x0,_0x1ed3ce=events['length'];_0x3e6c6d<_0x1ed3ce;_0x3e6c6d++){var _0x3fdf32=events[_0x3e6c6d];var _0x4df54d=createListener('chatGroup:'+_0x3fdf32,_0x238d53);ChatGroupEvents['on'](_0x3fdf32,_0x4df54d);}}; \ No newline at end of file +var _0x683a=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x44379c,_0x63c052){var _0x2254a9=function(_0x5df134){while(--_0x5df134){_0x44379c['push'](_0x44379c['shift']());}};_0x2254a9(++_0x63c052);}(_0x683a,0x189));var _0xa683=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x683a[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0xa683('0x0'));var events=[_0xa683('0x1'),_0xa683('0x2'),_0xa683('0x3')];function createListener(_0x123040,_0x55d636){return function(_0x508d77){_0x55d636[_0xa683('0x4')](_0x123040,_0x508d77);};}function removeListener(_0x57f35a,_0x41af92){return function(){ChatGroupEvents[_0xa683('0x5')](_0x57f35a,_0x41af92);};}exports[_0xa683('0x6')]=function(_0x1dd7ca){for(var _0x1ba059=0x0,_0x45d4e4=events[_0xa683('0x7')];_0x1ba059<_0x45d4e4;_0x1ba059++){var _0x2cb23b=events[_0x1ba059];var _0x1e34c9=createListener(_0xa683('0x8')+_0x2cb23b,_0x1dd7ca);ChatGroupEvents['on'](_0x2cb23b,_0x1e34c9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index b29fed8..c264832 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 _0xa127=['/describe','isAuthenticated','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMessage','/:id','update','delete','removeMembers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','index','get'];(function(_0xbb8e1f,_0x2612f6){var _0x49172c=function(_0xb2b222){while(--_0xb2b222){_0xbb8e1f['push'](_0xbb8e1f['shift']());}};_0x49172c(++_0x2612f6);}(_0xa127,0x16c));var _0x7a12=function(_0x37c30d,_0x468ca2){_0x37c30d=_0x37c30d-0x0;var _0x3142ba=_0xa127[_0x37c30d];return _0x3142ba;};'use strict';var multer=require(_0x7a12('0x0'));var util=require(_0x7a12('0x1'));var path=require('path');var timeout=require(_0x7a12('0x2'));var express=require(_0x7a12('0x3'));var router=express[_0x7a12('0x4')]();var fs_extra=require(_0x7a12('0x5'));var auth=require(_0x7a12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a12('0x7'));var controller=require(_0x7a12('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7a12('0x9')]);router[_0x7a12('0xa')](_0x7a12('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7a12('0xa')]('/:id',auth[_0x7a12('0xc')](),controller['show']);router[_0x7a12('0xa')](_0x7a12('0xd'),auth[_0x7a12('0xc')](),controller[_0x7a12('0xe')]);router[_0x7a12('0xa')](_0x7a12('0xf'),auth[_0x7a12('0xc')](),controller[_0x7a12('0x10')]);router[_0x7a12('0xa')](_0x7a12('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7a12('0x12')]('/',auth[_0x7a12('0xc')](),controller['create']);router[_0x7a12('0x12')](_0x7a12('0xf'),auth[_0x7a12('0xc')](),controller['addMembers']);router[_0x7a12('0x12')](_0x7a12('0x11'),auth[_0x7a12('0xc')](),controller[_0x7a12('0x13')]);router['put'](_0x7a12('0x14'),auth[_0x7a12('0xc')](),controller[_0x7a12('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7a12('0x16')]('/:id/members',auth[_0x7a12('0xc')](),controller[_0x7a12('0x17')]);module[_0x7a12('0x18')]=router; \ No newline at end of file +var _0x6c2e=['addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create'];(function(_0x57a776,_0x260c94){var _0x195520=function(_0x4e4ac3){while(--_0x4e4ac3){_0x57a776['push'](_0x57a776['shift']());}};_0x195520(++_0x260c94);}(_0x6c2e,0xf8));var _0xe6c2=function(_0x33e665,_0x6cbf9e){_0x33e665=_0x33e665-0x0;var _0x5ad37c=_0x6c2e[_0x33e665];return _0x5ad37c;};'use strict';var multer=require(_0xe6c2('0x0'));var util=require(_0xe6c2('0x1'));var path=require('path');var timeout=require(_0xe6c2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe6c2('0x3'));var auth=require(_0xe6c2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6c2('0x5'));var controller=require(_0xe6c2('0x6'));router[_0xe6c2('0x7')]('/',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x9')]);router[_0xe6c2('0x7')](_0xe6c2('0xa'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0xb')]);router[_0xe6c2('0x7')](_0xe6c2('0xc'),auth['isAuthenticated'](),controller[_0xe6c2('0xd')]);router[_0xe6c2('0x7')](_0xe6c2('0xe'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0xf')]);router[_0xe6c2('0x7')](_0xe6c2('0x10'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x11')]);router['get'](_0xe6c2('0x12'),auth['isAuthenticated'](),controller[_0xe6c2('0x13')]);router[_0xe6c2('0x14')]('/',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x15')]);router[_0xe6c2('0x14')](_0xe6c2('0x10'),auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x16')]);router[_0xe6c2('0x14')](_0xe6c2('0x12'),auth['isAuthenticated'](),controller[_0xe6c2('0x17')]);router[_0xe6c2('0x18')](_0xe6c2('0xc'),auth['isAuthenticated'](),controller[_0xe6c2('0x19')]);router[_0xe6c2('0x1a')]('/:id',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x1b')]);router[_0xe6c2('0x1a')]('/:id/members',auth[_0xe6c2('0x8')](),controller[_0xe6c2('0x1c')]);module[_0xe6c2('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 52b4af4..42bfc97 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 _0x7bd8=['out','exports','BOOLEAN','INTEGER','ENUM','star','STRING','TEXT','DATE'];(function(_0x2df387,_0x1d3ea1){var _0x3b1708=function(_0x49c05b){while(--_0x49c05b){_0x2df387['push'](_0x2df387['shift']());}};_0x3b1708(++_0x1d3ea1);}(_0x7bd8,0xe2));var _0x87bd=function(_0x13665d,_0x55849d){_0x13665d=_0x13665d-0x0;var _0x2b55f4=_0x7bd8[_0x13665d];return _0x2b55f4;};'use strict';var Sequelize=require('sequelize');module[_0x87bd('0x0')]={'closed':{'type':Sequelize[_0x87bd('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x87bd('0x2')]},'ratingType':{'type':Sequelize[_0x87bd('0x3')]('star','thumb'),'defaultValue':_0x87bd('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x87bd('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x87bd('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x87bd('0x5')]},'note':{'type':Sequelize[_0x87bd('0x5')]},'browserName':{'type':Sequelize[_0x87bd('0x5')]},'browserVersion':{'type':Sequelize[_0x87bd('0x5')]},'osName':{'type':Sequelize[_0x87bd('0x5')]},'osVersion':{'type':Sequelize[_0x87bd('0x5')]},'deviceModel':{'type':Sequelize[_0x87bd('0x5')]},'deviceVendor':{'type':Sequelize[_0x87bd('0x5')]},'deviceType':{'type':Sequelize[_0x87bd('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x87bd('0x5')]},'formData':{'type':Sequelize[_0x87bd('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x87bd('0x7')]},'lastMsgAt':{'type':Sequelize[_0x87bd('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x87bd('0x3')]('in',_0x87bd('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x87bd('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x87bd('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x87bd('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x87bd('0x2')]}}; \ No newline at end of file +var _0xf760=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize','exports'];(function(_0x27da43,_0x12984a){var _0x357d34=function(_0x5e3145){while(--_0x5e3145){_0x27da43['push'](_0x27da43['shift']());}};_0x357d34(++_0x12984a);}(_0xf760,0x1b6));var _0x0f76=function(_0x5335f8,_0x53fdf8){_0x5335f8=_0x5335f8-0x0;var _0x335558=_0xf760[_0x5335f8];return _0x335558;};'use strict';var Sequelize=require(_0x0f76('0x0'));module[_0x0f76('0x1')]={'closed':{'type':Sequelize[_0x0f76('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0f76('0x3')]},'ratingType':{'type':Sequelize[_0x0f76('0x4')](_0x0f76('0x5'),_0x0f76('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x0f76('0x7')]},'pathTranscript':{'type':Sequelize[_0x0f76('0x7')]},'mailTranscript':{'type':Sequelize[_0x0f76('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0f76('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0f76('0x8')]},'thirdDisposition':{'type':Sequelize[_0x0f76('0x8')]},'note':{'type':Sequelize[_0x0f76('0x8')]},'browserName':{'type':Sequelize[_0x0f76('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x0f76('0x8')]},'osVersion':{'type':Sequelize[_0x0f76('0x8')]},'deviceModel':{'type':Sequelize[_0x0f76('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x0f76('0x7')]},'customerIp':{'type':Sequelize[_0x0f76('0x8')]},'formData':{'type':Sequelize[_0x0f76('0x7')](_0x0f76('0xa'))},'read1stAt':{'type':Sequelize[_0x0f76('0x9')]},'lastMsgAt':{'type':Sequelize[_0x0f76('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x0f76('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0f76('0x8')]},'customerPort':{'type':Sequelize[_0x0f76('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x0f76('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x0f76('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 8a63861..dd5074d 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 _0x6be2=['keys','filters','intersection','fields','length','attributes','includeAll','options','ChatInteraction','find','create','update','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooNote','vidaooMetadata','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','parse','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','attachmentUpload','originalname','file','filename','type','mimetype','Attachment','attachmentDownload','closed','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','basename','download','close','mailTranscript','transcript-%s.txt','Messages','User','ChatWebsite','CmContact','ContactId','format','UserId','System','customer','Visitor','agentIdentifier','%s%d','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','appendFileSync','Smtp','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','hasOwnProperty','nolimit','secret','push','addTags','Tag','emit','chatInteractionTags:save','removeTags','server','tmp','files','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Account','Owner','get','mkdirSync','N.A.','createdAt','toString','closedAt','osName','customerPort','tail','createReadStream','pipe','value','renderFile','downloadInteraction.ejs','.pdf','Chat','err','unlinkSync','rimraf','zip-dir','moment','mustache','util','path','ejs','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','sendStatus','end','json','offset','undefined','limit','count','set','destroy','status','name','send','render','merge','body','agent','interaction','account','map','rawAttributes','key','getOptions','findAll','chat','query','user','catch','show','params','model'];(function(_0x290ced,_0x2ca190){var _0x39ceae=function(_0x1e3cdf){while(--_0x1e3cdf){_0x290ced['push'](_0x290ced['shift']());}};_0x39ceae(++_0x2ca190);}(_0x6be2,0x147));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0x26be('0x0'));var zipdir=require(_0x26be('0x1'));var rp=require('request-promise');var moment=require(_0x26be('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x26be('0x3'));var util=require(_0x26be('0x4'));var path=require(_0x26be('0x5'));var ejs=require(_0x26be('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x26be('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x26be('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x26be('0x9'));var config=require('../../config/environment');var db=require(_0x26be('0xa'))['db'];config[_0x26be('0xb')]=_[_0x26be('0xc')](config[_0x26be('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x26be('0xb')]));require(_0x26be('0xd'))[_0x26be('0xe')](socket);var jayson=require(_0x26be('0xf'));var client=jayson[_0x26be('0x10')][_0x26be('0x11')]({'port':0x232b});var client9004=jayson[_0x26be('0x10')][_0x26be('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x227629,_0x2707b6,_0x1b34b3,_0x4ff5e9){return new BPromise(function(_0x12bd2d,_0x1f1ac0){var _0x18767a=_0x4ff5e9||client;return _0x18767a['request'](_0x227629,_0x1b34b3)[_0x26be('0x12')](function(_0x5eba44){logger[_0x26be('0x13')](_0x26be('0x14'),_0x2707b6,'request\x20sent');logger[_0x26be('0x15')](_0x26be('0x16'),_0x2707b6,'request\x20sent',JSON[_0x26be('0x17')](_0x5eba44));if(_0x5eba44['error']){if(_0x5eba44['error'][_0x26be('0x18')]===0x1f4){logger[_0x26be('0x19')](_0x26be('0x14'),_0x2707b6,_0x5eba44['error'][_0x26be('0x1a')]);return _0x1f1ac0(_0x5eba44[_0x26be('0x19')][_0x26be('0x1a')]);}logger[_0x26be('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x2707b6,_0x5eba44[_0x26be('0x19')][_0x26be('0x1a')]);return _0x12bd2d(_0x5eba44['error'][_0x26be('0x1a')]);}else{logger[_0x26be('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x2707b6,_0x26be('0x1b'));_0x12bd2d(_0x5eba44[_0x26be('0x1c')][_0x26be('0x1a')]);}})['catch'](function(_0x5d18f1){logger[_0x26be('0x19')](_0x26be('0x14'),_0x2707b6,_0x5d18f1);_0x1f1ac0(_0x5d18f1);});});}function respondWithStatusCode(_0x3a8639,_0x59bb01){_0x59bb01=_0x59bb01||0xcc;return function(_0x581c2b){if(_0x581c2b){return _0x3a8639[_0x26be('0x1d')](_0x59bb01);}return _0x3a8639['status'](_0x59bb01)[_0x26be('0x1e')]();};}function respondWithResult(_0x369d32,_0x262c94){_0x262c94=_0x262c94||0xc8;return function(_0x1db451){if(_0x1db451){return _0x369d32['status'](_0x262c94)[_0x26be('0x1f')](_0x1db451);}};}function respondWithFilteredResult(_0x3d0424,_0x56a983){return function(_0xf80e5d){if(_0xf80e5d){var _0x1fc1de=typeof _0x56a983[_0x26be('0x20')]===_0x26be('0x21')&&typeof _0x56a983[_0x26be('0x22')]==='undefined';var _0x2bb3e1=_0xf80e5d[_0x26be('0x23')];var _0x503bed=_0x1fc1de?0x0:_0x56a983[_0x26be('0x20')];var _0x5c4801=_0x1fc1de?_0xf80e5d[_0x26be('0x23')]:_0x56a983[_0x26be('0x20')]+_0x56a983[_0x26be('0x22')];var _0x31391c;if(_0x5c4801>=_0x2bb3e1){_0x5c4801=_0x2bb3e1;_0x31391c=0xc8;}else{_0x31391c=0xce;}_0x3d0424['status'](_0x31391c);return _0x3d0424[_0x26be('0x24')]('Content-Range',_0x503bed+'-'+_0x5c4801+'/'+_0x2bb3e1)[_0x26be('0x1f')](_0xf80e5d);}return null;};}function saveUpdates(_0x4feca1){return function(_0x556801){if(_0x556801){return _0x556801['update'](_0x4feca1)[_0x26be('0x12')](function(_0xe8215e){return _0xe8215e;});}return null;};}function removeEntity(_0x4b7a45){return function(_0x3fb781){if(_0x3fb781){return _0x3fb781[_0x26be('0x25')]()[_0x26be('0x12')](function(){_0x4b7a45[_0x26be('0x26')](0xcc)[_0x26be('0x1e')]();});}};}function handleEntityNotFound(_0x40caea){return function(_0x4635cd){if(!_0x4635cd){_0x40caea[_0x26be('0x1d')](0x194);}return _0x4635cd;};}function handleError(_0x4fdda1,_0x284b08){_0x284b08=_0x284b08||0x1f4;return function(_0x5bf73a){logger[_0x26be('0x19')](_0x5bf73a['stack']);if(_0x5bf73a[_0x26be('0x27')]){delete _0x5bf73a['name'];}_0x4fdda1[_0x26be('0x26')](_0x284b08)[_0x26be('0x28')](_0x5bf73a);};}function getMustacheRender(_0x4028ab,_0x9ec039){return Mustache[_0x26be('0x29')](_0x4028ab,_[_0x26be('0x2a')](_0x9ec039[_0x26be('0x2b')],{'contact':_0x9ec039['contact'],'message':_0x9ec039[_0x26be('0x1a')],'agent':_0x9ec039[_0x26be('0x2c')],'interaction':_0x9ec039[_0x26be('0x2d')],'account':_0x9ec039[_0x26be('0x2e')]}))||'';}exports['index']=function(_0x303104,_0xbdc6d2){var _0x574a46={};var _0x48f029=_[_0x26be('0x2f')](db['ChatInteraction'][_0x26be('0x30')],function(_0x2cf6fd){return{'name':_0x2cf6fd['fieldName'],'type':_0x2cf6fd['type'][_0x26be('0x31')]};});_0x574a46=qs[_0x26be('0x32')](_0x48f029,_0x303104);return interaction[_0x26be('0x33')](_0x26be('0x34'),_0x303104[_0x26be('0x35')],_0x303104[_0x26be('0x36')],_0x574a46,_0x48f029)[_0x26be('0x12')](respondWithFilteredResult(_0xbdc6d2,_0x574a46))[_0x26be('0x37')](handleError(_0xbdc6d2,null));};exports[_0x26be('0x38')]=function(_0xe4115c,_0x401d76){var _0x8d6858={'raw':![],'where':{'id':_0xe4115c[_0x26be('0x39')]['id']}},_0x1e27ba={};_0x1e27ba[_0x26be('0x3a')]=_[_0x26be('0x3b')](db['ChatInteraction'][_0x26be('0x30')]);_0x1e27ba['query']=_['keys'](_0xe4115c[_0x26be('0x35')]);_0x1e27ba[_0x26be('0x3c')]=_[_0x26be('0x3d')](_0x1e27ba[_0x26be('0x3a')],_0x1e27ba[_0x26be('0x35')]);_0x8d6858['attributes']=_[_0x26be('0x3d')](_0x1e27ba[_0x26be('0x3a')],qs[_0x26be('0x3e')](_0xe4115c[_0x26be('0x35')][_0x26be('0x3e')]));_0x8d6858['attributes']=_0x8d6858['attributes'][_0x26be('0x3f')]?_0x8d6858[_0x26be('0x40')]:_0x1e27ba[_0x26be('0x3a')];if(_0xe4115c[_0x26be('0x35')][_0x26be('0x41')]){_0x8d6858['include']=[{'all':!![]}];}_0x8d6858=_['merge']({},_0x8d6858,_0xe4115c[_0x26be('0x42')]);return db[_0x26be('0x43')][_0x26be('0x44')](_0x8d6858)[_0x26be('0x12')](handleEntityNotFound(_0x401d76,null))[_0x26be('0x12')](respondWithResult(_0x401d76,null))[_0x26be('0x37')](handleError(_0x401d76,null));};exports[_0x26be('0x45')]=function(_0x3771d8,_0x45ac59){return db[_0x26be('0x43')][_0x26be('0x45')](_0x3771d8['body'],{})[_0x26be('0x12')](respondWithResult(_0x45ac59,0xc9))['catch'](handleError(_0x45ac59,null));};exports[_0x26be('0x46')]=function(_0x39c9d8,_0xcc04de){if(_0x39c9d8[_0x26be('0x2b')]['id']){delete _0x39c9d8['body']['id'];}return db[_0x26be('0x43')]['find']({'where':{'id':_0x39c9d8['params']['id']}})[_0x26be('0x12')](handleEntityNotFound(_0xcc04de,null))[_0x26be('0x12')](saveUpdates(_0x39c9d8['body'],null))[_0x26be('0x12')](respondWithResult(_0xcc04de,null))[_0x26be('0x37')](handleError(_0xcc04de,null));};exports[_0x26be('0x25')]=function(_0x3552fe,_0x52c7a3){return db['ChatInteraction'][_0x26be('0x44')]({'where':{'id':_0x3552fe[_0x26be('0x39')]['id']}})[_0x26be('0x12')](handleEntityNotFound(_0x52c7a3,null))[_0x26be('0x12')](removeEntity(_0x52c7a3,null))[_0x26be('0x37')](handleError(_0x52c7a3,null));};exports[_0x26be('0x47')]=function(_0x64cec,_0x226b5b){return db['ChatInteraction'][_0x26be('0x47')]()[_0x26be('0x12')](respondWithResult(_0x226b5b,null))[_0x26be('0x37')](handleError(_0x226b5b,null));};exports['createVidaooSession']=function(_0x450090,_0xbc932e){var _0x1fb3a5=_0x450090[_0x26be('0x39')]['id'];var _0x93c47e;var _0x5e2284;var _0x4b7b5b;return db['ChatInteraction'][_0x26be('0x48')]({'where':{'id':_0x1fb3a5}})[_0x26be('0x12')](function(_0x1b4c9b){_0x93c47e=_0x1b4c9b;return db['ChatWebsite'][_0x26be('0x48')]({'where':{'id':_0x1b4c9b[_0x26be('0x49')]},'attributes':['id',_0x26be('0x4a'),'vidaooEscalation','vidaooTopic',_0x26be('0x4b'),_0x26be('0x4c')],'raw':!![]});})['then'](function(_0x520896){if(_0x520896&&_0x520896['vidaooApiKey']&&_0x520896['vidaooEscalation']){_0x5e2284=_0x520896;var _0x28c39e={'interaction':{'id':_0x1fb3a5},'agent':{'id':_0x450090[_0x26be('0x36')]['id'],'name':_0x450090[_0x26be('0x36')][_0x26be('0x27')],'fullname':_0x450090[_0x26be('0x36')][_0x26be('0x4d')],'email':_0x450090['user'][_0x26be('0x4e')]},'contact':_0x450090[_0x26be('0x2b')][_0x26be('0x4f')],'account':_0x450090[_0x26be('0x2b')][_0x26be('0x2e')]};var _0xf6cb84={'rejectUnauthorized':![],'method':'POST','url':_0x26be('0x50'),'headers':{'X-APIKEY':_0x520896[_0x26be('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x450090[_0x26be('0x36')][_0x26be('0x4e')]],'buttons':null,'topic':_0x5e2284[_0x26be('0x51')],'note':_['isNull'](_0x5e2284['vidaooNote'])?null:getMustacheRender(_0x5e2284[_0x26be('0x4b')],_0x28c39e),'metadata':null},'redirect':_0x26be('0x52'),'json':!![]};try{if(!_[_0x26be('0x53')](_0x5e2284[_0x26be('0x4c')])){var _0x354243=getMustacheRender(_0x5e2284['vidaooMetadata'],_0x28c39e);var _0x304cd4=JSON[_0x26be('0x54')](_0x354243);_0xf6cb84[_0x26be('0x2b')]['metadata']=_0x304cd4;}}catch(_0x228679){throw new db[(_0x26be('0x55'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xf6cb84);}else{throw new db[(_0x26be('0x55'))]['ValidationError'](_0x26be('0x56'));}})['then'](function(_0x5ca608){_0x4b7b5b=_0x5ca608;if(_0x4b7b5b['id']){var _0x1fa23c={'body':_0x4b7b5b[_0x26be('0x57')],'ChatWebsiteId':_0x5e2284['id'],'ChatInteractionId':_0x93c47e['id'],'direction':_0x26be('0x58'),'UserId':_0x450090[_0x26be('0x36')]['id']};return db[_0x26be('0x59')]['create'](_0x1fa23c,{});}else{throw new db[(_0x26be('0x55'))][(_0x26be('0x5a'))](_0x26be('0x5b'));}})[_0x26be('0x12')](function(){return _0x93c47e[_0x26be('0x5c')]({'vidaooSessionId':_0x4b7b5b['id']});})[_0x26be('0x12')](respondWithResult(_0xbc932e,null))[_0x26be('0x37')](handleError(_0xbc932e,null));};exports[_0x26be('0x5d')]=function(_0x5d9516,_0x28dece){if(_0x5d9516[_0x26be('0x2b')]['id']){delete _0x5d9516[_0x26be('0x2b')]['id'];}return db[_0x26be('0x43')]['find']({'where':{'id':_0x5d9516['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x26be('0x12')](handleEntityNotFound(_0x28dece,null))['then'](saveUpdates(_0x5d9516[_0x26be('0x2b')],null))[_0x26be('0x12')](respondWithResult(_0x28dece,null))['catch'](handleError(_0x28dece,null));};exports[_0x26be('0x5e')]=function(_0x16bf8b,_0x5500ce){if(_0x16bf8b[_0x26be('0x2b')]['id']){delete _0x16bf8b[_0x26be('0x2b')]['id'];}return db[_0x26be('0x43')][_0x26be('0x44')]({'where':{'id':_0x16bf8b[_0x26be('0x39')]['id']}})[_0x26be('0x12')](function(_0x22943c){if(!_0x22943c){logger[_0x26be('0x19')](_0x26be('0x5f'),'abandon',0x194,_0x26be('0x60'));_0x5500ce[_0x26be('0x1d')](0x194);}else{if(_0x22943c['UserId']){throw new db[(_0x26be('0x55'))][(_0x26be('0x5a'))](_0x26be('0x61'));}}return _0x22943c;})[_0x26be('0x12')](function(_0x46f9a1){if(_0x46f9a1){return _0x46f9a1['update']({'closed':_0x16bf8b[_0x26be('0x2b')]['closed'],'disposition':_0x16bf8b[_0x26be('0x2b')][_0x26be('0x62')]})[_0x26be('0x12')](function(_0x4977d5){return _0x4977d5;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x26be('0x5e'),_0x16bf8b[_0x26be('0x2b')],client9004);})[_0x26be('0x12')](respondWithResult(_0x5500ce,null))[_0x26be('0x37')](handleError(_0x5500ce,null));};exports[_0x26be('0x63')]=function(_0x3c806f,_0x1c1150){_0x3c806f[_0x26be('0x2b')][_0x26be('0x27')]=_0x3c806f['file'][_0x26be('0x64')];_0x3c806f['body']['basename']=_0x3c806f[_0x26be('0x65')][_0x26be('0x66')];_0x3c806f[_0x26be('0x2b')][_0x26be('0x67')]=_0x3c806f[_0x26be('0x65')][_0x26be('0x68')];return db[_0x26be('0x69')][_0x26be('0x45')](_0x3c806f[_0x26be('0x2b')])[_0x26be('0x12')](respondWithResult(_0x1c1150,0xc9))['catch'](handleError(_0x1c1150,null));};exports[_0x26be('0x6a')]=function(_0x2d645a,_0x525269){return db['ChatInteraction'][_0x26be('0x48')]({'where':{'id':_0x2d645a[_0x26be('0x39')]['id']},'raw':!![]})[_0x26be('0x12')](handleEntityNotFound(_0x525269,null))[_0x26be('0x12')](function(_0xb0dc1d){if(_0xb0dc1d){if(_0xb0dc1d[_0x26be('0x6b')]){return _0x525269[_0x26be('0x26')](0x193)[_0x26be('0x1f')]({'status':0x193,'message':'Unauthorized'});}return db[_0x26be('0x69')]['findOne']({'where':{'id':_0x2d645a[_0x26be('0x35')][_0x26be('0x6c')]},'raw':!![]})[_0x26be('0x12')](handleEntityNotFound(_0x525269,null));}})['then'](function(_0x39049e){if(_0x39049e){var _0x26ed51=_0x39049e[_0x26be('0x6d')]!==null;var _0x403f93=path[_0x26be('0x6e')](config[_0x26be('0x6f')],_0x26be('0x70'));if(_0x26ed51){_0x403f93=path[_0x26be('0x6e')](_0x403f93,'offline-chat/');}var _0x58be41=path[_0x26be('0x6e')](_0x403f93,_0x39049e[_0x26be('0x71')]);return _0x525269[_0x26be('0x72')](_0x58be41);}})[_0x26be('0x37')](handleError(_0x525269,null));};exports[_0x26be('0x73')]=function(_0x4b94e5,_0x536d7c){var _0x3513e2=null;var _0x168148=null;var _0xe2cfca=null;if(_0x4b94e5['body']['id']){delete _0x4b94e5[_0x26be('0x2b')]['id'];}if(_0x4b94e5[_0x26be('0x2b')][_0x26be('0x74')]){_0xe2cfca=path[_0x26be('0x6e')](config['root'],'server/files/chat/upload/',util['format'](_0x26be('0x75'),Date['now']()));_0x4b94e5[_0x26be('0x2b')]['pathTranscript']=_0xe2cfca;}return db[_0x26be('0x43')][_0x26be('0x44')]({'where':{'id':_0x4b94e5[_0x26be('0x39')]['id']},'include':[{'model':db[_0x26be('0x59')],'as':_0x26be('0x76'),'include':[{'model':db[_0x26be('0x77')],'as':'User'}]}]})[_0x26be('0x12')](handleEntityNotFound(_0x536d7c,null))[_0x26be('0x12')](saveUpdates(_0x4b94e5[_0x26be('0x2b')],null))[_0x26be('0x12')](function(_0x2eef68){if(_0x2eef68){_0x3513e2=_0x2eef68;return db[_0x26be('0x78')][_0x26be('0x44')]({'where':{'id':_0x3513e2['ChatWebsiteId']}});}})['then'](function(_0x2e2415){if(_0x2e2415){_0x168148=_0x2e2415;return db[_0x26be('0x79')][_0x26be('0x44')]({'where':{'id':_0x3513e2[_0x26be('0x7a')]}});}})[_0x26be('0x12')](function(_0x2f2e1c){if(_0x2f2e1c){if(_0xe2cfca){var _0x19ca4c=null;for(var _0xbf5ca5=0x1;_0xbf5ca5<_0x3513e2[_0x26be('0x76')]['length'];++_0xbf5ca5){_0x19ca4c=_0x3513e2['Messages'][_0xbf5ca5];var _0x415a8e=_0x19ca4c['UserId']?util[_0x26be('0x7b')]('%s%d',_0x168148['agentAlias'],_0x19ca4c[_0x26be('0x7c')]):_0x26be('0x7d');var _0x1a702f=_0x4b94e5[_0x26be('0x2b')][_0x26be('0x7e')]||util[_0x26be('0x7b')]('%s%d',_0x26be('0x7f'),_0x19ca4c[_0x26be('0x7a')]);switch(_0x168148[_0x26be('0x80')]){case'website_alias':_0x415a8e=_0x19ca4c['UserId']?util[_0x26be('0x7b')](_0x26be('0x81'),_0x168148[_0x26be('0x82')],_0x19ca4c['UserId']):_0x26be('0x7d');break;case _0x26be('0x83'):_0x415a8e=_0x19ca4c[_0x26be('0x7c')]?_0x19ca4c[_0x26be('0x77')][_0x26be('0x84')]||_0x19ca4c[_0x26be('0x77')][_0x26be('0x4d')]:_0x26be('0x7d');break;case _0x26be('0x85'):_0x415a8e=_0x19ca4c[_0x26be('0x7c')]?_0x19ca4c[_0x26be('0x77')][_0x26be('0x4d')]:_0x26be('0x7d');break;default:_0x415a8e=_0x19ca4c['UserId']?util[_0x26be('0x7b')]('%s%d',_0x168148[_0x26be('0x82')],_0x19ca4c[_0x26be('0x7c')]):_0x26be('0x7d');}var _0x2c322a=util['format'](_0x26be('0x86'),moment(_0x19ca4c['createdAt'])[_0x26be('0x7b')]('MM/DD/YYYY\x20HH:mm:ss'),_0x19ca4c['direction']==='in'?_0x1a702f:_0x415a8e,_0x19ca4c[_0x26be('0x2b')]);if(!_0x19ca4c['secret']){fs[_0x26be('0x87')](_0xe2cfca,_0x2c322a);}}return db['MailAccount'][_0x26be('0x48')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x26be('0x88'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x26be('0x12')](function(_0x4efbdc){if(!_0x4efbdc||!_0x4efbdc[_0x26be('0x88')]||!_0x4b94e5['body'])return _0x3513e2;var _0x3d3a28=_0x4efbdc[_0x26be('0x89')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x3d3a28,'message':{'from':util[_0x26be('0x7b')](_0x26be('0x8a'),_0x4efbdc[_0x26be('0x27')],_0x4efbdc['email']||_0x4efbdc['Smtp'][_0x26be('0x36')]),'to':_0x4b94e5['body'][_0x26be('0x74')],'subject':_0x26be('0x8b'),'text':util[_0x26be('0x7b')](_0x26be('0x8c'),_0x4b94e5[_0x26be('0x2b')]['mailTranscript']),'attachments':[{'path':_0xe2cfca}]}})[_0x26be('0x12')](function(){return _0x3513e2;})[_0x26be('0x37')](function(_0x67e664){logger[_0x26be('0x19')](_0x67e664);});})[_0x26be('0x12')](respondWithStatusCode(_0x536d7c,0xc8))[_0x26be('0x37')](handleError(_0x536d7c,null));};exports['addMessage']=function(_0x12a217,_0x5e150a){return db[_0x26be('0x59')][_0x26be('0x44')]({'where':{'id':_0x12a217[_0x26be('0x39')]['id']}})[_0x26be('0x12')](handleEntityNotFound(_0x5e150a,null))[_0x26be('0x12')](function(_0x2c6689){if(_0x2c6689){return _0x2c6689[_0x26be('0x8d')](_0x12a217['body'][_0x26be('0x8e')],_[_0x26be('0x8f')](_0x12a217['body'],[_0x26be('0x8e'),'id'])||{});}})['then'](respondWithResult(_0x5e150a,null))['catch'](handleError(_0x5e150a,null));};exports[_0x26be('0x90')]=function(_0x1e93d0,_0x41ec6e){var _0x3e2d84={'raw':![],'where':{}};var _0x576c4f={};var _0x1a8cc7={'count':0x0,'rows':[]};return db[_0x26be('0x43')]['findOne']({'where':{'id':_0x1e93d0['params']['id']}})[_0x26be('0x12')](handleEntityNotFound(_0x41ec6e,null))['then'](function(_0x355302){if(_0x355302){_0x576c4f[_0x26be('0x3a')]=_['keys'](db[_0x26be('0x59')][_0x26be('0x30')]);_0x576c4f[_0x26be('0x35')]=_[_0x26be('0x3b')](_0x1e93d0[_0x26be('0x35')]);_0x576c4f[_0x26be('0x3c')]=_[_0x26be('0x3d')](_0x576c4f['model'],_0x576c4f[_0x26be('0x35')]);_0x3e2d84[_0x26be('0x40')]=_[_0x26be('0x3d')](_0x576c4f[_0x26be('0x3a')],qs['fields'](_0x1e93d0[_0x26be('0x35')][_0x26be('0x3e')]));_0x3e2d84[_0x26be('0x40')]=_0x3e2d84['attributes'][_0x26be('0x3f')]?_0x3e2d84[_0x26be('0x40')]:_0x576c4f[_0x26be('0x3a')];if(!_0x1e93d0['query']['hasOwnProperty']('nolimit')){_0x3e2d84[_0x26be('0x22')]=qs[_0x26be('0x22')](_0x1e93d0['query'][_0x26be('0x22')]);_0x3e2d84[_0x26be('0x20')]=qs[_0x26be('0x20')](_0x1e93d0[_0x26be('0x35')][_0x26be('0x20')]);}_0x3e2d84[_0x26be('0x91')]=qs[_0x26be('0x92')](_0x1e93d0[_0x26be('0x35')][_0x26be('0x92')]);_0x3e2d84[_0x26be('0x93')]=qs[_0x26be('0x3c')](_[_0x26be('0x94')](_0x1e93d0[_0x26be('0x35')],_0x576c4f[_0x26be('0x3c')]));_0x3e2d84['where'][_0x26be('0x95')]=_0x355302['id'];if(_0x1e93d0[_0x26be('0x35')][_0x26be('0x96')]){_0x3e2d84[_0x26be('0x93')]=_[_0x26be('0x2a')](_0x3e2d84['where'],{'$or':_['map'](_0x3e2d84[_0x26be('0x40')],function(_0x187928){var _0x5b823d={};_0x5b823d[_0x187928]={'$like':'%'+_0x1e93d0['query']['filter']+'%'};return _0x5b823d;})});}if(_0x1e93d0[_0x26be('0x35')][_0x26be('0x97')]){var _0x5afe8d=_0x1e93d0[_0x26be('0x35')][_0x26be('0x97')]['split'](',');var _0x1bd6a2={};_0x1bd6a2[_0x5afe8d[0x0]]={'$gte':moment(_0x5afe8d[0x1])[_0x26be('0x7b')](_0x26be('0x98'))};_0x3e2d84[_0x26be('0x93')]=_[_0x26be('0x2a')](_0x3e2d84[_0x26be('0x93')],_0x1bd6a2);}_0x3e2d84=_[_0x26be('0x2a')]({},_0x3e2d84,_0x1e93d0[_0x26be('0x42')]);return db[_0x26be('0x59')]['count']({'where':_0x3e2d84['where']})[_0x26be('0x12')](function(_0x4b9a21){_0x1a8cc7[_0x26be('0x23')]=_0x4b9a21;if(_0x1e93d0[_0x26be('0x35')][_0x26be('0x41')]){_0x3e2d84[_0x26be('0x99')]=[{'all':!![]}];}return db[_0x26be('0x59')][_0x26be('0x33')](_0x3e2d84);})['then'](function(_0x1ee155){_0x1a8cc7[_0x26be('0x9a')]=_0x1ee155;return _0x1a8cc7;});}})['then'](respondWithFilteredResult(_0x41ec6e,_0x3e2d84))[_0x26be('0x37')](handleError(_0x41ec6e,null));};exports[_0x26be('0x9b')]=function(_0x377369,_0x5226ae){var _0x1b3573={'where':{}},_0x3096b4={},_0x4cdd91={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x377369[_0x26be('0x39')]['id']}})['then'](handleEntityNotFound(_0x5226ae,null))[_0x26be('0x12')](function(_0x2a71cc){if(_0x2a71cc){_0x3096b4[_0x26be('0x3a')]=_[_0x26be('0x3b')](db[_0x26be('0x59')][_0x26be('0x30')]);_0x3096b4[_0x26be('0x35')]=_[_0x26be('0x3b')](_0x377369[_0x26be('0x35')]);_0x3096b4['filters']=_[_0x26be('0x3d')](_0x3096b4[_0x26be('0x3a')],_0x3096b4['query']);_0x1b3573[_0x26be('0x40')]=_[_0x26be('0x3d')](_0x3096b4[_0x26be('0x3a')],qs['fields'](_0x377369['query'][_0x26be('0x3e')]));_0x1b3573[_0x26be('0x40')]=_0x1b3573['attributes']['length']?_0x1b3573[_0x26be('0x40')]:_0x3096b4[_0x26be('0x3a')];if(!_0x377369[_0x26be('0x35')][_0x26be('0x9c')](_0x26be('0x9d'))){_0x1b3573[_0x26be('0x22')]=qs[_0x26be('0x22')](_0x377369[_0x26be('0x35')][_0x26be('0x22')]);_0x1b3573[_0x26be('0x20')]=qs[_0x26be('0x20')](_0x377369[_0x26be('0x35')][_0x26be('0x20')]);}_0x1b3573[_0x26be('0x91')]=qs[_0x26be('0x92')](_0x377369[_0x26be('0x35')][_0x26be('0x92')]);_0x1b3573['where']=qs['filters'](_['pick'](_0x377369[_0x26be('0x35')],_0x3096b4['filters']));_0x1b3573['where'][_0x26be('0x95')]=_0x2a71cc['id'];if(_0x377369['query']['filter']){_0x1b3573[_0x26be('0x93')]=_[_0x26be('0x2a')](_0x1b3573[_0x26be('0x93')],{'$or':_[_0x26be('0x2f')](_0x1b3573['attributes'],function(_0x24fa9d){var _0x9698ff={};_0x9698ff[_0x24fa9d]={'$like':'%'+_0x377369[_0x26be('0x35')][_0x26be('0x96')]+'%'};return _0x9698ff;})});}_0x1b3573[_0x26be('0x93')][_0x26be('0x9e')]=![];if(_0x377369[_0x26be('0x35')]['id']){_0x1b3573['where']['id']={'$gt':_0x377369[_0x26be('0x35')]['id']};}_0x1b3573=_[_0x26be('0x2a')]({},_0x1b3573,_0x377369['options']);return db['ChatMessage'][_0x26be('0x23')]({'where':_0x1b3573[_0x26be('0x93')]})[_0x26be('0x12')](function(_0x293c58){_0x4cdd91[_0x26be('0x23')]=_0x293c58;_0x1b3573[_0x26be('0x99')]=[];if(_0x377369['query']['includeAgent']){_0x1b3573['include'][_0x26be('0x9f')]({'model':db[_0x26be('0x77')],'as':_0x26be('0x77'),'attributes':['id',_0x26be('0x4d'),'alias']});}if(_0x377369[_0x26be('0x35')][_0x26be('0x41')]){_0x1b3573[_0x26be('0x99')]=[{'all':!![]}];}return db[_0x26be('0x59')][_0x26be('0x33')](_0x1b3573);})[_0x26be('0x12')](function(_0x59ebe3){_0x4cdd91['rows']=_0x59ebe3;return _0x4cdd91;});}})[_0x26be('0x12')](respondWithFilteredResult(_0x5226ae,_0x1b3573))[_0x26be('0x37')](handleError(_0x5226ae,null));};exports[_0x26be('0xa0')]=function(_0x210614,_0x4c3927){return db[_0x26be('0x43')][_0x26be('0x44')]({'where':{'id':_0x210614[_0x26be('0x39')]['id']}})['then'](handleEntityNotFound(_0x4c3927,null))['then'](function(_0x4efbda){if(_0x4efbda){return _0x4efbda['setTags'](_0x210614[_0x26be('0x2b')][_0x26be('0x8e')],_[_0x26be('0x8f')](_0x210614[_0x26be('0x2b')],['ids','id'])||{})['spread'](function(){return db[_0x26be('0xa1')][_0x26be('0x33')]({'attributes':['id',_0x26be('0x27'),'color'],'where':{'id':_0x210614[_0x26be('0x2b')][_0x26be('0x8e')]}});})['then'](function(_0x37931e){socket[_0x26be('0xa2')](_0x26be('0xa3'),{'id':Number(_0x210614[_0x26be('0x39')]['id']),'tags':_0x37931e||[]});return{'id':Number(_0x210614[_0x26be('0x39')]['id']),'tags':_0x37931e||[]};});}})[_0x26be('0x12')](respondWithResult(_0x4c3927,null))[_0x26be('0x37')](handleError(_0x4c3927,null));};exports[_0x26be('0xa4')]=function(_0x5645b3,_0x2dce38){return db[_0x26be('0x43')][_0x26be('0x44')]({'where':{'id':_0x5645b3[_0x26be('0x39')]['id']}})[_0x26be('0x12')](handleEntityNotFound(_0x2dce38,null))['then'](function(_0xc8417d){if(_0xc8417d){return _0xc8417d['removeTags'](_0x5645b3['query'][_0x26be('0x8e')]);}})[_0x26be('0x12')](respondWithStatusCode(_0x2dce38,null))['catch'](handleError(_0x2dce38,null));};exports[_0x26be('0x72')]=function(_0x517c78,_0x19f33b){var _0x5ecdac=moment()['unix']()['toString']();var _0x2e8e01=path['join'](config['root'],_0x26be('0xa5'),'files',_0x26be('0xa6'));var _0x6778a7=path[_0x26be('0x6e')](config['root'],_0x26be('0xa5'),_0x26be('0xa7'),'attachments');var _0x4fb209=path[_0x26be('0x6e')](_0x2e8e01,_0x5ecdac);var _0x38bc3d=util[_0x26be('0x7b')](_0x26be('0xa8'),_0x517c78[_0x26be('0x39')]['id'],_0x5ecdac);var _0x3887cc=path[_0x26be('0x6e')](_0x2e8e01,_0x38bc3d);var _0xa91f20=[];_0xa91f20[_0x26be('0x9f')]({'model':db[_0x26be('0x77')],'as':_0x26be('0x77'),'attributes':['id',_0x26be('0x4d')],'raw':!![]});_0xa91f20[_0x26be('0x9f')]({'model':db['CmContact'],'as':_0x26be('0xa9'),'attributes':['id',_0x26be('0xaa'),_0x26be('0xab')],'raw':!![]});if(_0x517c78[_0x26be('0x35')]['attachments']){_0xa91f20['push']({'model':db[_0x26be('0x69')],'as':_0x26be('0x69'),'raw':!![]});}var _0x30a080=[{'model':db[_0x26be('0x59')],'as':'Messages','attributes':['id',_0x26be('0x2b'),'createdAt',_0x26be('0xac'),_0x26be('0x9e'),'read'],'include':_0xa91f20}];_0x30a080[_0x26be('0x9f')]({'model':db[_0x26be('0x78')],'as':_0x26be('0xad'),'attributes':['id',_0x26be('0x27')]});_0x30a080[_0x26be('0x9f')]({'model':db['User'],'as':_0x26be('0xae'),'attributes':['id',_0x26be('0x4d')]});return db[_0x26be('0x43')][_0x26be('0x44')]({'where':{'id':_0x517c78['params']['id']},'include':_0x30a080})[_0x26be('0x12')](handleEntityNotFound(_0x19f33b,null))[_0x26be('0x12')](function(_0x1e49e5){if(_0x1e49e5){var _0x1ee765=_0x1e49e5[_0x26be('0xaf')]({'plain':!![]});fs[_0x26be('0xb0')](_0x4fb209);var _0x11a958={'channel':'Chat','account':_0x1ee765[_0x26be('0xad')][_0x26be('0x27')],'agent':_0x1ee765[_0x26be('0xae')]?_0x1ee765[_0x26be('0xae')][_0x26be('0x4d')]:_0x26be('0xb1'),'createdAt':moment(_0x1ee765[_0x26be('0xb2')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x26be('0xb3')](),'closedAt':_0x1ee765['closed']?moment(_0x1ee765[_0x26be('0xb4')])[_0x26be('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1ee765[_0x26be('0x62')],'chatInfo':{'browser':_0x1ee765['browserName'],'os':_0x1ee765[_0x26be('0xb5')],'referer':_0x1ee765['referer'],'customerIp':_0x1ee765['customerIp'],'customerPort':_0x1ee765[_0x26be('0xb6')]?_0x1ee765[_0x26be('0xb6')]:_0x26be('0xb1')},'messages':_(_0x1ee765[_0x26be('0x76')])[_0x26be('0xb7')]()[_0x26be('0x96')]({'secret':![]})[_0x26be('0x2f')](function(_0x1b6609){if(_0x1b6609[_0x26be('0x69')]){var _0x142af2=path[_0x26be('0x6e')](_0x6778a7,_0x1b6609['Attachment'][_0x26be('0x71')]);if(fs['existsSync'](_0x142af2)){fs[_0x26be('0xb8')](_0x142af2)[_0x26be('0xb9')](fs['createWriteStream'](path[_0x26be('0x6e')](_0x4fb209,_0x1b6609[_0x26be('0x69')][_0x26be('0x71')])));}}return{'date':moment(_0x1b6609[_0x26be('0xb2')])[_0x26be('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x26be('0xb3')](),'sender':_0x1b6609[_0x26be('0xac')]===_0x26be('0x58')?_0x1b6609[_0x26be('0x77')]?_0x1b6609[_0x26be('0x77')]['fullname']:_0x26be('0x7d'):_0x1b6609['Contact'][_0x26be('0xaa')]+(_0x1b6609[_0x26be('0xa9')]['lastName']?'\x20'+_0x1b6609['Contact'][_0x26be('0xab')]:''),'body':_0x1b6609[_0x26be('0x69')]?_0x1b6609[_0x26be('0x69')][_0x26be('0x71')]:_0x1b6609['body'],'direction':_0x1b6609['direction']==='out'?'A':'C','secret':_0x1b6609[_0x26be('0x9e')],'read':_0x1b6609['read'],'attachment':_0x1b6609[_0x26be('0x69')]};})[_0x26be('0xba')]()};return ejs[_0x26be('0xbb')](path[_0x26be('0x6e')](config[_0x26be('0x6f')],_0x26be('0xa5'),'views',_0x26be('0xbc')),{'interaction':_0x11a958})[_0x26be('0x12')](function(_0x16f2fa){var _0x5b7a45=path['join'](_0x4fb209,'transcript-'+_0x1ee765['id']+'-'+_0x5ecdac+_0x26be('0xbd'));var _0x30c144={'path':_0x5b7a45,'channel':_0x26be('0xbe'),'interactionId':_0x1ee765['id']};return pdf['createPdfFromHTML'](_0x16f2fa,_0x30c144);})[_0x26be('0x12')](function(){return new Promise(function(_0x6b6235,_0x55e04f){zipdir(_0x4fb209,{'saveTo':_0x3887cc},function(_0x30c00d,_0xf1da64){if(_0x30c00d)return _0x55e04f(_0x30c00d);return _0x6b6235(_0xf1da64);});})[_0x26be('0x12')](function(){return new BPromise(function(_0x2ee780,_0xc957a6){rimraf(_0x4fb209,function(_0x1bf669){if(_0x1bf669)_0xc957a6(_0x1bf669);return _0x2ee780();});});})[_0x26be('0x12')](function(){return _0x19f33b[_0x26be('0x72')](_0x3887cc,_0x38bc3d,function(_0x23063f){if(_0x23063f){logger[_0x26be('0x19')](_0x26be('0xbf'),_0x23063f);}else{fs[_0x26be('0xc0')](_0x3887cc);}});});});}else{return _0x19f33b[_0x26be('0x1d')](0xc8);}})[_0x26be('0x37')](handleError(_0x19f33b,null));}; \ No newline at end of file +var _0x9a2e=['Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','User','ChatWebsite','ContactId','length','Messages','UserId','%s%d','agentAlias','customer','format','agentIdentifier','agent_alias','alias','System','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','hasOwnProperty','nolimit','sort','where','pick','ChatInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','order','includeAgent','push','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','secret','Account','get','mkdirSync','Chat','Owner','closedAt','osName','customerIp','customerPort','tail','filter','existsSync','createReadStream','createWriteStream','lastName','basename','read','value','downloadInteraction.ejs','transcript-','err','zip-dir','request-promise','bluebird','path','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','name','send','render','body','agent','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','show','model','keys','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','update','params','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','file','originalname','filename','mimetype'];(function(_0x705836,_0x391b3a){var _0x15be6b=function(_0x1b08a7){while(--_0x1b08a7){_0x705836['push'](_0x705836['shift']());}};_0x15be6b(++_0x391b3a);}(_0x9a2e,0x12a));var _0xe9a2=function(_0x27976d,_0x1cc15f){_0x27976d=_0x27976d-0x0;var _0x5d3357=_0x9a2e[_0x27976d];return _0x5d3357;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe9a2('0x0'));var rp=require(_0xe9a2('0x1'));var moment=require('moment');var BPromise=require(_0xe9a2('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe9a2('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9a2('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xe9a2('0x5'));var pdf=require(_0xe9a2('0x6'));var logger=require(_0xe9a2('0x7'))(_0xe9a2('0x8'));var config=require(_0xe9a2('0x9'));var db=require(_0xe9a2('0xa'))['db'];config[_0xe9a2('0xb')]=_[_0xe9a2('0xc')](config[_0xe9a2('0xb')],{'host':_0xe9a2('0xd'),'port':0x18eb});var socket=require(_0xe9a2('0xe'))(new Redis(config[_0xe9a2('0xb')]));require(_0xe9a2('0xf'))[_0xe9a2('0x10')](socket);var jayson=require(_0xe9a2('0x11'));var client=jayson[_0xe9a2('0x12')]['http']({'port':0x232b});var client9004=jayson[_0xe9a2('0x12')][_0xe9a2('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x2a09ba,_0x1750f5,_0x42cd88,_0x4b466b){return new BPromise(function(_0x4ce3d2,_0xce919c){var _0x49e2ce=_0x4b466b||client;return _0x49e2ce[_0xe9a2('0x14')](_0x2a09ba,_0x42cd88)[_0xe9a2('0x15')](function(_0x42b2e0){logger[_0xe9a2('0x16')](_0xe9a2('0x17'),_0x1750f5,_0xe9a2('0x18'));logger[_0xe9a2('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1750f5,'request\x20sent',JSON['stringify'](_0x42b2e0));if(_0x42b2e0['error']){if(_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1b')]===0x1f4){logger[_0xe9a2('0x1a')](_0xe9a2('0x17'),_0x1750f5,_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);return _0xce919c(_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);}logger[_0xe9a2('0x1a')](_0xe9a2('0x17'),_0x1750f5,_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);return _0x4ce3d2(_0x42b2e0[_0xe9a2('0x1a')][_0xe9a2('0x1c')]);}else{logger[_0xe9a2('0x16')](_0xe9a2('0x17'),_0x1750f5,_0xe9a2('0x18'));_0x4ce3d2(_0x42b2e0[_0xe9a2('0x1d')]['message']);}})[_0xe9a2('0x1e')](function(_0x2fed32){logger[_0xe9a2('0x1a')](_0xe9a2('0x17'),_0x1750f5,_0x2fed32);_0xce919c(_0x2fed32);});});}function respondWithStatusCode(_0x11ea3c,_0x135031){_0x135031=_0x135031||0xcc;return function(_0x4e31a6){if(_0x4e31a6){return _0x11ea3c[_0xe9a2('0x1f')](_0x135031);}return _0x11ea3c[_0xe9a2('0x20')](_0x135031)[_0xe9a2('0x21')]();};}function respondWithResult(_0x216f7e,_0xaae22){_0xaae22=_0xaae22||0xc8;return function(_0x10c466){if(_0x10c466){return _0x216f7e['status'](_0xaae22)[_0xe9a2('0x22')](_0x10c466);}};}function respondWithFilteredResult(_0x282b73,_0x5b30d1){return function(_0x4bd54d){if(_0x4bd54d){var _0x23e3c7=typeof _0x5b30d1[_0xe9a2('0x23')]===_0xe9a2('0x24')&&typeof _0x5b30d1[_0xe9a2('0x25')]===_0xe9a2('0x24');var _0x497e6f=_0x4bd54d['count'];var _0x3d5cbd=_0x23e3c7?0x0:_0x5b30d1[_0xe9a2('0x23')];var _0x51e516=_0x23e3c7?_0x4bd54d[_0xe9a2('0x26')]:_0x5b30d1[_0xe9a2('0x23')]+_0x5b30d1[_0xe9a2('0x25')];var _0x39fc87;if(_0x51e516>=_0x497e6f){_0x51e516=_0x497e6f;_0x39fc87=0xc8;}else{_0x39fc87=0xce;}_0x282b73[_0xe9a2('0x20')](_0x39fc87);return _0x282b73[_0xe9a2('0x27')](_0xe9a2('0x28'),_0x3d5cbd+'-'+_0x51e516+'/'+_0x497e6f)[_0xe9a2('0x22')](_0x4bd54d);}return null;};}function saveUpdates(_0x24a424){return function(_0x17c9f3){if(_0x17c9f3){return _0x17c9f3['update'](_0x24a424)[_0xe9a2('0x15')](function(_0x3a1903){return _0x3a1903;});}return null;};}function removeEntity(_0x15213f){return function(_0x419fc9){if(_0x419fc9){return _0x419fc9[_0xe9a2('0x29')]()[_0xe9a2('0x15')](function(){_0x15213f[_0xe9a2('0x20')](0xcc)[_0xe9a2('0x21')]();});}};}function handleEntityNotFound(_0x18ea0a){return function(_0x3ff333){if(!_0x3ff333){_0x18ea0a['sendStatus'](0x194);}return _0x3ff333;};}function handleError(_0x22dbdb,_0x8e2add){_0x8e2add=_0x8e2add||0x1f4;return function(_0x499e86){logger[_0xe9a2('0x1a')](_0x499e86['stack']);if(_0x499e86[_0xe9a2('0x2a')]){delete _0x499e86['name'];}_0x22dbdb['status'](_0x8e2add)[_0xe9a2('0x2b')](_0x499e86);};}function getMustacheRender(_0x10f16f,_0x459df8){return Mustache[_0xe9a2('0x2c')](_0x10f16f,_['merge'](_0x459df8[_0xe9a2('0x2d')],{'contact':_0x459df8['contact'],'message':_0x459df8[_0xe9a2('0x1c')],'agent':_0x459df8[_0xe9a2('0x2e')],'interaction':_0x459df8['interaction'],'account':_0x459df8[_0xe9a2('0x2f')]}))||'';}exports[_0xe9a2('0x30')]=function(_0x135b90,_0x31b203){var _0x445d4c={};var _0x38254a=_[_0xe9a2('0x31')](db[_0xe9a2('0x32')][_0xe9a2('0x33')],function(_0x40785c){return{'name':_0x40785c[_0xe9a2('0x34')],'type':_0x40785c[_0xe9a2('0x35')][_0xe9a2('0x36')]};});_0x445d4c=qs[_0xe9a2('0x37')](_0x38254a,_0x135b90);return interaction[_0xe9a2('0x38')](_0xe9a2('0x39'),_0x135b90['query'],_0x135b90[_0xe9a2('0x3a')],_0x445d4c,_0x38254a)['then'](respondWithFilteredResult(_0x31b203,_0x445d4c))['catch'](handleError(_0x31b203,null));};exports[_0xe9a2('0x3b')]=function(_0x33247b,_0x45240f){var _0x44f4af={'raw':![],'where':{'id':_0x33247b['params']['id']}},_0x1ab33c={};_0x1ab33c[_0xe9a2('0x3c')]=_[_0xe9a2('0x3d')](db[_0xe9a2('0x32')][_0xe9a2('0x33')]);_0x1ab33c[_0xe9a2('0x3e')]=_[_0xe9a2('0x3d')](_0x33247b[_0xe9a2('0x3e')]);_0x1ab33c[_0xe9a2('0x3f')]=_['intersection'](_0x1ab33c[_0xe9a2('0x3c')],_0x1ab33c[_0xe9a2('0x3e')]);_0x44f4af['attributes']=_[_0xe9a2('0x40')](_0x1ab33c[_0xe9a2('0x3c')],qs[_0xe9a2('0x41')](_0x33247b[_0xe9a2('0x3e')][_0xe9a2('0x41')]));_0x44f4af[_0xe9a2('0x42')]=_0x44f4af['attributes']['length']?_0x44f4af[_0xe9a2('0x42')]:_0x1ab33c[_0xe9a2('0x3c')];if(_0x33247b[_0xe9a2('0x3e')][_0xe9a2('0x43')]){_0x44f4af[_0xe9a2('0x44')]=[{'all':!![]}];}_0x44f4af=_[_0xe9a2('0x45')]({},_0x44f4af,_0x33247b[_0xe9a2('0x46')]);return db[_0xe9a2('0x32')][_0xe9a2('0x47')](_0x44f4af)[_0xe9a2('0x15')](handleEntityNotFound(_0x45240f,null))[_0xe9a2('0x15')](respondWithResult(_0x45240f,null))[_0xe9a2('0x1e')](handleError(_0x45240f,null));};exports['create']=function(_0x259343,_0x59a11e){return db[_0xe9a2('0x32')]['create'](_0x259343[_0xe9a2('0x2d')],{})[_0xe9a2('0x15')](respondWithResult(_0x59a11e,0xc9))[_0xe9a2('0x1e')](handleError(_0x59a11e,null));};exports[_0xe9a2('0x48')]=function(_0xda6ad1,_0x4682ed){if(_0xda6ad1['body']['id']){delete _0xda6ad1[_0xe9a2('0x2d')]['id'];}return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0xda6ad1['params']['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x4682ed,null))['then'](saveUpdates(_0xda6ad1[_0xe9a2('0x2d')],null))[_0xe9a2('0x15')](respondWithResult(_0x4682ed,null))[_0xe9a2('0x1e')](handleError(_0x4682ed,null));};exports[_0xe9a2('0x29')]=function(_0x1ef7a7,_0x5853bc){return db[_0xe9a2('0x32')]['find']({'where':{'id':_0x1ef7a7[_0xe9a2('0x49')]['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x5853bc,null))[_0xe9a2('0x15')](removeEntity(_0x5853bc,null))[_0xe9a2('0x1e')](handleError(_0x5853bc,null));};exports[_0xe9a2('0x4a')]=function(_0x4c968c,_0x4db074){return db[_0xe9a2('0x32')][_0xe9a2('0x4a')]()[_0xe9a2('0x15')](respondWithResult(_0x4db074,null))['catch'](handleError(_0x4db074,null));};exports[_0xe9a2('0x4b')]=function(_0x27ec84,_0x4c68f4){var _0x5216ca=_0x27ec84[_0xe9a2('0x49')]['id'];var _0x552712;var _0x3cad60;var _0x1722ea;return db['ChatInteraction'][_0xe9a2('0x4c')]({'where':{'id':_0x5216ca}})[_0xe9a2('0x15')](function(_0x146377){_0x552712=_0x146377;return db['ChatWebsite'][_0xe9a2('0x4c')]({'where':{'id':_0x146377['ChatWebsiteId']},'attributes':['id',_0xe9a2('0x4d'),_0xe9a2('0x4e'),'vidaooTopic',_0xe9a2('0x4f'),_0xe9a2('0x50')],'raw':!![]});})[_0xe9a2('0x15')](function(_0x2fd406){if(_0x2fd406&&_0x2fd406[_0xe9a2('0x4d')]&&_0x2fd406[_0xe9a2('0x4e')]){_0x3cad60=_0x2fd406;var _0x4ebaa9={'interaction':{'id':_0x5216ca},'agent':{'id':_0x27ec84['user']['id'],'name':_0x27ec84[_0xe9a2('0x3a')][_0xe9a2('0x2a')],'fullname':_0x27ec84['user'][_0xe9a2('0x51')],'email':_0x27ec84[_0xe9a2('0x3a')][_0xe9a2('0x52')]},'contact':_0x27ec84[_0xe9a2('0x2d')][_0xe9a2('0x53')],'account':_0x27ec84['body'][_0xe9a2('0x2f')]};var _0x1d76aa={'rejectUnauthorized':![],'method':_0xe9a2('0x54'),'url':_0xe9a2('0x55'),'headers':{'X-APIKEY':_0x2fd406[_0xe9a2('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x27ec84[_0xe9a2('0x3a')][_0xe9a2('0x52')]],'buttons':null,'topic':_0x3cad60[_0xe9a2('0x56')],'note':_[_0xe9a2('0x57')](_0x3cad60[_0xe9a2('0x4f')])?null:getMustacheRender(_0x3cad60[_0xe9a2('0x4f')],_0x4ebaa9),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3cad60['vidaooMetadata'])){var _0x2698df=getMustacheRender(_0x3cad60['vidaooMetadata'],_0x4ebaa9);var _0x20a657=JSON[_0xe9a2('0x58')](_0x2698df);_0x1d76aa[_0xe9a2('0x2d')][_0xe9a2('0x59')]=_0x20a657;}}catch(_0x4cca42){throw new db[(_0xe9a2('0x5a'))][(_0xe9a2('0x5b'))](_0xe9a2('0x5c'));}return rp(_0x1d76aa);}else{throw new db[(_0xe9a2('0x5a'))][(_0xe9a2('0x5b'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe9a2('0x15')](function(_0x31e1d8){_0x1722ea=_0x31e1d8;if(_0x1722ea['id']){var _0x379d7f={'body':_0x1722ea[_0xe9a2('0x5d')],'ChatWebsiteId':_0x3cad60['id'],'ChatInteractionId':_0x552712['id'],'direction':_0xe9a2('0x5e'),'UserId':_0x27ec84[_0xe9a2('0x3a')]['id']};return db[_0xe9a2('0x5f')][_0xe9a2('0x60')](_0x379d7f,{});}else{throw new db['Sequelize'][(_0xe9a2('0x5b'))](_0xe9a2('0x61'));}})[_0xe9a2('0x15')](function(){return _0x552712[_0xe9a2('0x62')]({'vidaooSessionId':_0x1722ea['id']});})[_0xe9a2('0x15')](respondWithResult(_0x4c68f4,null))[_0xe9a2('0x1e')](handleError(_0x4c68f4,null));};exports['customUpdate']=function(_0x4301e3,_0x527671){if(_0x4301e3[_0xe9a2('0x2d')]['id']){delete _0x4301e3[_0xe9a2('0x2d')]['id'];}return db[_0xe9a2('0x32')]['find']({'where':{'id':_0x4301e3[_0xe9a2('0x49')]['id']},'include':[{'model':db[_0xe9a2('0x63')],'as':_0xe9a2('0x64')}]})[_0xe9a2('0x15')](handleEntityNotFound(_0x527671,null))[_0xe9a2('0x15')](saveUpdates(_0x4301e3[_0xe9a2('0x2d')],null))[_0xe9a2('0x15')](respondWithResult(_0x527671,null))[_0xe9a2('0x1e')](handleError(_0x527671,null));};exports[_0xe9a2('0x65')]=function(_0x374ef5,_0x376a63){if(_0x374ef5[_0xe9a2('0x2d')]['id']){delete _0x374ef5[_0xe9a2('0x2d')]['id'];}return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x374ef5[_0xe9a2('0x49')]['id']}})[_0xe9a2('0x15')](function(_0x575cc6){if(!_0x575cc6){logger['error'](_0xe9a2('0x66'),_0xe9a2('0x65'),0x194,_0xe9a2('0x67'));_0x376a63[_0xe9a2('0x1f')](0x194);}else{if(_0x575cc6['UserId']){throw new db['Sequelize'][(_0xe9a2('0x5b'))]('Interaction\x20already\x20assigned');}}return _0x575cc6;})['then'](function(_0x3448f9){if(_0x3448f9){return _0x3448f9[_0xe9a2('0x48')]({'closed':_0x374ef5[_0xe9a2('0x2d')][_0xe9a2('0x68')],'disposition':_0x374ef5['body'][_0xe9a2('0x69')]})[_0xe9a2('0x15')](function(_0x372d3c){return _0x372d3c;});}})[_0xe9a2('0x15')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x374ef5[_0xe9a2('0x2d')],client9004);})[_0xe9a2('0x15')](respondWithResult(_0x376a63,null))[_0xe9a2('0x1e')](handleError(_0x376a63,null));};exports['attachmentUpload']=function(_0x523e57,_0xe0649d){_0x523e57[_0xe9a2('0x2d')][_0xe9a2('0x2a')]=_0x523e57[_0xe9a2('0x6a')][_0xe9a2('0x6b')];_0x523e57[_0xe9a2('0x2d')]['basename']=_0x523e57[_0xe9a2('0x6a')][_0xe9a2('0x6c')];_0x523e57[_0xe9a2('0x2d')]['type']=_0x523e57['file'][_0xe9a2('0x6d')];return db[_0xe9a2('0x6e')]['create'](_0x523e57[_0xe9a2('0x2d')])[_0xe9a2('0x15')](respondWithResult(_0xe0649d,0xc9))[_0xe9a2('0x1e')](handleError(_0xe0649d,null));};exports[_0xe9a2('0x6f')]=function(_0x4152a7,_0x4a806b){return db[_0xe9a2('0x32')][_0xe9a2('0x4c')]({'where':{'id':_0x4152a7[_0xe9a2('0x49')]['id']},'raw':!![]})[_0xe9a2('0x15')](handleEntityNotFound(_0x4a806b,null))[_0xe9a2('0x15')](function(_0x2a2658){if(_0x2a2658){if(_0x2a2658['closed']){return _0x4a806b[_0xe9a2('0x20')](0x193)[_0xe9a2('0x22')]({'status':0x193,'message':_0xe9a2('0x70')});}return db[_0xe9a2('0x6e')][_0xe9a2('0x4c')]({'where':{'id':_0x4152a7[_0xe9a2('0x3e')][_0xe9a2('0x71')]},'raw':!![]})[_0xe9a2('0x15')](handleEntityNotFound(_0x4a806b,null));}})[_0xe9a2('0x15')](function(_0x3e9109){if(_0x3e9109){var _0x3da02e=_0x3e9109[_0xe9a2('0x72')]!==null;var _0x3467fd=path['join'](config[_0xe9a2('0x73')],'server/files/attachments/');if(_0x3da02e){_0x3467fd=path[_0xe9a2('0x74')](_0x3467fd,_0xe9a2('0x75'));}var _0x1f833a=path[_0xe9a2('0x74')](_0x3467fd,_0x3e9109['basename']);return _0x4a806b[_0xe9a2('0x76')](_0x1f833a);}})[_0xe9a2('0x1e')](handleError(_0x4a806b,null));};exports[_0xe9a2('0x77')]=function(_0x414d43,_0x4f34ac){var _0x47ed8b=null;var _0x55c2d5=null;var _0x4fe647=null;if(_0x414d43['body']['id']){delete _0x414d43[_0xe9a2('0x2d')]['id'];}if(_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x78')]){_0x4fe647=path['join'](config[_0xe9a2('0x73')],_0xe9a2('0x79'),util['format'](_0xe9a2('0x7a'),Date['now']()));_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x7b')]=_0x4fe647;}return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x414d43[_0xe9a2('0x49')]['id']},'include':[{'model':db[_0xe9a2('0x5f')],'as':'Messages','include':[{'model':db[_0xe9a2('0x7c')],'as':_0xe9a2('0x7c')}]}]})[_0xe9a2('0x15')](handleEntityNotFound(_0x4f34ac,null))[_0xe9a2('0x15')](saveUpdates(_0x414d43[_0xe9a2('0x2d')],null))[_0xe9a2('0x15')](function(_0x5a1a10){if(_0x5a1a10){_0x47ed8b=_0x5a1a10;return db[_0xe9a2('0x7d')]['find']({'where':{'id':_0x47ed8b['ChatWebsiteId']}});}})[_0xe9a2('0x15')](function(_0x43e907){if(_0x43e907){_0x55c2d5=_0x43e907;return db[_0xe9a2('0x63')][_0xe9a2('0x47')]({'where':{'id':_0x47ed8b[_0xe9a2('0x7e')]}});}})['then'](function(_0x44c63a){if(_0x44c63a){if(_0x4fe647){var _0x53dec0=null;for(var _0x1e9d57=0x1;_0x1e9d57<_0x47ed8b['Messages'][_0xe9a2('0x7f')];++_0x1e9d57){_0x53dec0=_0x47ed8b[_0xe9a2('0x80')][_0x1e9d57];var _0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?util['format'](_0xe9a2('0x82'),_0x55c2d5[_0xe9a2('0x83')],_0x53dec0[_0xe9a2('0x81')]):'System';var _0x1d9fdf=_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x84')]||util[_0xe9a2('0x85')]('%s%d','Visitor',_0x53dec0[_0xe9a2('0x7e')]);switch(_0x55c2d5[_0xe9a2('0x86')]){case'website_alias':_0x20d0d7=_0x53dec0['UserId']?util['format'](_0xe9a2('0x82'),_0x55c2d5['agentAlias'],_0x53dec0[_0xe9a2('0x81')]):'System';break;case _0xe9a2('0x87'):_0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?_0x53dec0[_0xe9a2('0x7c')][_0xe9a2('0x88')]||_0x53dec0[_0xe9a2('0x7c')][_0xe9a2('0x51')]:'System';break;case'agent_fullname':_0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?_0x53dec0[_0xe9a2('0x7c')][_0xe9a2('0x51')]:_0xe9a2('0x89');break;default:_0x20d0d7=_0x53dec0[_0xe9a2('0x81')]?util[_0xe9a2('0x85')]('%s%d',_0x55c2d5[_0xe9a2('0x83')],_0x53dec0[_0xe9a2('0x81')]):'System';}var _0x2b5057=util[_0xe9a2('0x85')](_0xe9a2('0x8a'),moment(_0x53dec0[_0xe9a2('0x8b')])['format'](_0xe9a2('0x8c')),_0x53dec0[_0xe9a2('0x8d')]==='in'?_0x1d9fdf:_0x20d0d7,_0x53dec0[_0xe9a2('0x2d')]);if(!_0x53dec0['secret']){fs[_0xe9a2('0x8e')](_0x4fe647,_0x2b5057);}}return db[_0xe9a2('0x8f')][_0xe9a2('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0xe9a2('0x90')],'as':_0xe9a2('0x91'),'raw':!![],'include':[{'model':db[_0xe9a2('0x92')],'as':_0xe9a2('0x92'),'raw':!![]}]}]});}}})['then'](function(_0x210451){if(!_0x210451||!_0x210451[_0xe9a2('0x91')]||!_0x414d43[_0xe9a2('0x2d')])return _0x47ed8b;var _0x4ed904=_0x210451[_0xe9a2('0x93')]();return respondWithRpcPromise(_0xe9a2('0x94'),'sendMail',{'account':_0x4ed904,'message':{'from':util[_0xe9a2('0x85')]('\x22%s\x22\x20<%s>',_0x210451[_0xe9a2('0x2a')],_0x210451[_0xe9a2('0x52')]||_0x210451[_0xe9a2('0x91')]['user']),'to':_0x414d43['body'][_0xe9a2('0x78')],'subject':_0xe9a2('0x95'),'text':util[_0xe9a2('0x85')](_0xe9a2('0x96'),_0x414d43[_0xe9a2('0x2d')][_0xe9a2('0x78')]),'attachments':[{'path':_0x4fe647}]}})[_0xe9a2('0x15')](function(){return _0x47ed8b;})[_0xe9a2('0x1e')](function(_0xb8fc6c){logger[_0xe9a2('0x1a')](_0xb8fc6c);});})[_0xe9a2('0x15')](respondWithStatusCode(_0x4f34ac,0xc8))[_0xe9a2('0x1e')](handleError(_0x4f34ac,null));};exports[_0xe9a2('0x97')]=function(_0x3870fc,_0x58860d){return db[_0xe9a2('0x5f')][_0xe9a2('0x47')]({'where':{'id':_0x3870fc[_0xe9a2('0x49')]['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x58860d,null))[_0xe9a2('0x15')](function(_0x282fe7){if(_0x282fe7){return _0x282fe7['addMessage'](_0x3870fc[_0xe9a2('0x2d')][_0xe9a2('0x98')],_['omit'](_0x3870fc['body'],[_0xe9a2('0x98'),'id'])||{});}})['then'](respondWithResult(_0x58860d,null))[_0xe9a2('0x1e')](handleError(_0x58860d,null));};exports['getMessages']=function(_0x12abcd,_0x236d8f){var _0x4cd863={'raw':![],'where':{}};var _0x416263={};var _0x3386e9={'count':0x0,'rows':[]};return db[_0xe9a2('0x32')]['findOne']({'where':{'id':_0x12abcd['params']['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x236d8f,null))[_0xe9a2('0x15')](function(_0x57907a){if(_0x57907a){_0x416263['model']=_[_0xe9a2('0x3d')](db[_0xe9a2('0x5f')][_0xe9a2('0x33')]);_0x416263[_0xe9a2('0x3e')]=_[_0xe9a2('0x3d')](_0x12abcd[_0xe9a2('0x3e')]);_0x416263[_0xe9a2('0x3f')]=_[_0xe9a2('0x40')](_0x416263[_0xe9a2('0x3c')],_0x416263['query']);_0x4cd863[_0xe9a2('0x42')]=_[_0xe9a2('0x40')](_0x416263[_0xe9a2('0x3c')],qs[_0xe9a2('0x41')](_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x41')]));_0x4cd863[_0xe9a2('0x42')]=_0x4cd863[_0xe9a2('0x42')]['length']?_0x4cd863['attributes']:_0x416263['model'];if(!_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x99')](_0xe9a2('0x9a'))){_0x4cd863[_0xe9a2('0x25')]=qs[_0xe9a2('0x25')](_0x12abcd['query']['limit']);_0x4cd863[_0xe9a2('0x23')]=qs[_0xe9a2('0x23')](_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x23')]);}_0x4cd863['order']=qs[_0xe9a2('0x9b')](_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x9b')]);_0x4cd863[_0xe9a2('0x9c')]=qs[_0xe9a2('0x3f')](_[_0xe9a2('0x9d')](_0x12abcd['query'],_0x416263[_0xe9a2('0x3f')]));_0x4cd863[_0xe9a2('0x9c')][_0xe9a2('0x9e')]=_0x57907a['id'];if(_0x12abcd[_0xe9a2('0x3e')]['filter']){_0x4cd863[_0xe9a2('0x9c')]=_[_0xe9a2('0x45')](_0x4cd863[_0xe9a2('0x9c')],{'$or':_[_0xe9a2('0x31')](_0x4cd863[_0xe9a2('0x42')],function(_0x119ab8){var _0x5bbb84={};_0x5bbb84[_0x119ab8]={'$like':'%'+_0x12abcd[_0xe9a2('0x3e')]['filter']+'%'};return _0x5bbb84;})});}if(_0x12abcd['query'][_0xe9a2('0x9f')]){var _0x393da7=_0x12abcd[_0xe9a2('0x3e')][_0xe9a2('0x9f')][_0xe9a2('0xa0')](',');var _0x256fd2={};_0x256fd2[_0x393da7[0x0]]={'$gte':moment(_0x393da7[0x1])['format'](_0xe9a2('0xa1'))};_0x4cd863[_0xe9a2('0x9c')]=_[_0xe9a2('0x45')](_0x4cd863['where'],_0x256fd2);}_0x4cd863=_[_0xe9a2('0x45')]({},_0x4cd863,_0x12abcd['options']);return db[_0xe9a2('0x5f')][_0xe9a2('0x26')]({'where':_0x4cd863[_0xe9a2('0x9c')]})['then'](function(_0x2079eb){_0x3386e9[_0xe9a2('0x26')]=_0x2079eb;if(_0x12abcd['query'][_0xe9a2('0x43')]){_0x4cd863[_0xe9a2('0x44')]=[{'all':!![]}];}return db[_0xe9a2('0x5f')][_0xe9a2('0x38')](_0x4cd863);})[_0xe9a2('0x15')](function(_0x49b1a8){_0x3386e9[_0xe9a2('0xa2')]=_0x49b1a8;return _0x3386e9;});}})['then'](respondWithFilteredResult(_0x236d8f,_0x4cd863))[_0xe9a2('0x1e')](handleError(_0x236d8f,null));};exports[_0xe9a2('0xa3')]=function(_0x22bb59,_0x524d2d){var _0x3a398e={'where':{}},_0x39c85c={},_0x136708={'count':0x0,'rows':[]};return db[_0xe9a2('0x32')]['findOne']({'where':{'id':_0x22bb59['params']['id']}})[_0xe9a2('0x15')](handleEntityNotFound(_0x524d2d,null))[_0xe9a2('0x15')](function(_0x1434a4){if(_0x1434a4){_0x39c85c[_0xe9a2('0x3c')]=_['keys'](db[_0xe9a2('0x5f')]['rawAttributes']);_0x39c85c[_0xe9a2('0x3e')]=_['keys'](_0x22bb59['query']);_0x39c85c[_0xe9a2('0x3f')]=_['intersection'](_0x39c85c['model'],_0x39c85c[_0xe9a2('0x3e')]);_0x3a398e[_0xe9a2('0x42')]=_[_0xe9a2('0x40')](_0x39c85c['model'],qs['fields'](_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x41')]));_0x3a398e[_0xe9a2('0x42')]=_0x3a398e[_0xe9a2('0x42')]['length']?_0x3a398e[_0xe9a2('0x42')]:_0x39c85c[_0xe9a2('0x3c')];if(!_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x99')](_0xe9a2('0x9a'))){_0x3a398e['limit']=qs[_0xe9a2('0x25')](_0x22bb59[_0xe9a2('0x3e')]['limit']);_0x3a398e['offset']=qs['offset'](_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x23')]);}_0x3a398e[_0xe9a2('0xa4')]=qs[_0xe9a2('0x9b')](_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x9b')]);_0x3a398e[_0xe9a2('0x9c')]=qs['filters'](_[_0xe9a2('0x9d')](_0x22bb59[_0xe9a2('0x3e')],_0x39c85c[_0xe9a2('0x3f')]));_0x3a398e['where'][_0xe9a2('0x9e')]=_0x1434a4['id'];if(_0x22bb59[_0xe9a2('0x3e')]['filter']){_0x3a398e[_0xe9a2('0x9c')]=_['merge'](_0x3a398e[_0xe9a2('0x9c')],{'$or':_['map'](_0x3a398e[_0xe9a2('0x42')],function(_0x10f800){var _0xf1968d={};_0xf1968d[_0x10f800]={'$like':'%'+_0x22bb59[_0xe9a2('0x3e')]['filter']+'%'};return _0xf1968d;})});}_0x3a398e[_0xe9a2('0x9c')]['secret']=![];if(_0x22bb59['query']['id']){_0x3a398e[_0xe9a2('0x9c')]['id']={'$gt':_0x22bb59[_0xe9a2('0x3e')]['id']};}_0x3a398e=_[_0xe9a2('0x45')]({},_0x3a398e,_0x22bb59[_0xe9a2('0x46')]);return db[_0xe9a2('0x5f')]['count']({'where':_0x3a398e['where']})[_0xe9a2('0x15')](function(_0x590307){_0x136708[_0xe9a2('0x26')]=_0x590307;_0x3a398e['include']=[];if(_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0xa5')]){_0x3a398e[_0xe9a2('0x44')][_0xe9a2('0xa6')]({'model':db[_0xe9a2('0x7c')],'as':_0xe9a2('0x7c'),'attributes':['id',_0xe9a2('0x51'),_0xe9a2('0x88')]});}if(_0x22bb59[_0xe9a2('0x3e')][_0xe9a2('0x43')]){_0x3a398e['include']=[{'all':!![]}];}return db['ChatMessage'][_0xe9a2('0x38')](_0x3a398e);})[_0xe9a2('0x15')](function(_0x4f492b){_0x136708[_0xe9a2('0xa2')]=_0x4f492b;return _0x136708;});}})[_0xe9a2('0x15')](respondWithFilteredResult(_0x524d2d,_0x3a398e))[_0xe9a2('0x1e')](handleError(_0x524d2d,null));};exports[_0xe9a2('0xa7')]=function(_0x3a8b38,_0x50da38){return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x3a8b38[_0xe9a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x50da38,null))[_0xe9a2('0x15')](function(_0x5ba59e){if(_0x5ba59e){return _0x5ba59e[_0xe9a2('0xa8')](_0x3a8b38[_0xe9a2('0x2d')][_0xe9a2('0x98')],_['omit'](_0x3a8b38['body'],[_0xe9a2('0x98'),'id'])||{})[_0xe9a2('0xa9')](function(){return db[_0xe9a2('0xaa')]['findAll']({'attributes':['id',_0xe9a2('0x2a'),'color'],'where':{'id':_0x3a8b38['body'][_0xe9a2('0x98')]}});})[_0xe9a2('0x15')](function(_0xcc3509){socket[_0xe9a2('0xab')](_0xe9a2('0xac'),{'id':Number(_0x3a8b38[_0xe9a2('0x49')]['id']),'tags':_0xcc3509||[]});return{'id':Number(_0x3a8b38[_0xe9a2('0x49')]['id']),'tags':_0xcc3509||[]};});}})[_0xe9a2('0x15')](respondWithResult(_0x50da38,null))[_0xe9a2('0x1e')](handleError(_0x50da38,null));};exports[_0xe9a2('0xad')]=function(_0x169434,_0x44d67e){return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x169434[_0xe9a2('0x49')]['id']}})['then'](handleEntityNotFound(_0x44d67e,null))[_0xe9a2('0x15')](function(_0x5107f1){if(_0x5107f1){return _0x5107f1[_0xe9a2('0xad')](_0x169434[_0xe9a2('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x44d67e,null))[_0xe9a2('0x1e')](handleError(_0x44d67e,null));};exports[_0xe9a2('0x76')]=function(_0x277e79,_0x4ac3ba){var _0x1a2b83=moment()[_0xe9a2('0xae')]()[_0xe9a2('0xaf')]();var _0x140bd9=path[_0xe9a2('0x74')](config[_0xe9a2('0x73')],_0xe9a2('0xb0'),_0xe9a2('0xb1'),_0xe9a2('0xb2'));var _0x3ebc56=path[_0xe9a2('0x74')](config['root'],'server',_0xe9a2('0xb1'),_0xe9a2('0xb3'));var _0x4e7205=path[_0xe9a2('0x74')](_0x140bd9,_0x1a2b83);var _0x1538c6=util[_0xe9a2('0x85')](_0xe9a2('0xb4'),_0x277e79[_0xe9a2('0x49')]['id'],_0x1a2b83);var _0x2a91bf=path[_0xe9a2('0x74')](_0x140bd9,_0x1538c6);var _0x59853f=[];_0x59853f[_0xe9a2('0xa6')]({'model':db['User'],'as':_0xe9a2('0x7c'),'attributes':['id',_0xe9a2('0x51')],'raw':!![]});_0x59853f['push']({'model':db[_0xe9a2('0x63')],'as':_0xe9a2('0x64'),'attributes':['id',_0xe9a2('0xb5'),'lastName'],'raw':!![]});if(_0x277e79['query'][_0xe9a2('0xb3')]){_0x59853f['push']({'model':db['Attachment'],'as':_0xe9a2('0x6e'),'raw':!![]});}var _0x424e96=[{'model':db[_0xe9a2('0x5f')],'as':_0xe9a2('0x80'),'attributes':['id',_0xe9a2('0x2d'),'createdAt','direction',_0xe9a2('0xb6'),'read'],'include':_0x59853f}];_0x424e96['push']({'model':db[_0xe9a2('0x7d')],'as':_0xe9a2('0xb7'),'attributes':['id',_0xe9a2('0x2a')]});_0x424e96[_0xe9a2('0xa6')]({'model':db[_0xe9a2('0x7c')],'as':'Owner','attributes':['id',_0xe9a2('0x51')]});return db[_0xe9a2('0x32')][_0xe9a2('0x47')]({'where':{'id':_0x277e79[_0xe9a2('0x49')]['id']},'include':_0x424e96})[_0xe9a2('0x15')](handleEntityNotFound(_0x4ac3ba,null))[_0xe9a2('0x15')](function(_0x59e64d){if(_0x59e64d){var _0x290fd9=_0x59e64d[_0xe9a2('0xb8')]({'plain':!![]});fs[_0xe9a2('0xb9')](_0x4e7205);var _0x1e08b6={'channel':_0xe9a2('0xba'),'account':_0x290fd9['Account'][_0xe9a2('0x2a')],'agent':_0x290fd9['Owner']?_0x290fd9[_0xe9a2('0xbb')][_0xe9a2('0x51')]:'N.A.','createdAt':moment(_0x290fd9[_0xe9a2('0x8b')])[_0xe9a2('0x85')](_0xe9a2('0xa1'))['toString'](),'closedAt':_0x290fd9[_0xe9a2('0x68')]?moment(_0x290fd9[_0xe9a2('0xbc')])[_0xe9a2('0x85')](_0xe9a2('0xa1'))[_0xe9a2('0xaf')]():'','disposition':_0x290fd9[_0xe9a2('0x69')],'chatInfo':{'browser':_0x290fd9['browserName'],'os':_0x290fd9[_0xe9a2('0xbd')],'referer':_0x290fd9['referer'],'customerIp':_0x290fd9[_0xe9a2('0xbe')],'customerPort':_0x290fd9[_0xe9a2('0xbf')]?_0x290fd9[_0xe9a2('0xbf')]:'N.A.'},'messages':_(_0x290fd9['Messages'])[_0xe9a2('0xc0')]()[_0xe9a2('0xc1')]({'secret':![]})[_0xe9a2('0x31')](function(_0x366888){if(_0x366888[_0xe9a2('0x6e')]){var _0xef6a4c=path[_0xe9a2('0x74')](_0x3ebc56,_0x366888[_0xe9a2('0x6e')]['basename']);if(fs[_0xe9a2('0xc2')](_0xef6a4c)){fs[_0xe9a2('0xc3')](_0xef6a4c)['pipe'](fs[_0xe9a2('0xc4')](path['join'](_0x4e7205,_0x366888[_0xe9a2('0x6e')]['basename'])));}}return{'date':moment(_0x366888[_0xe9a2('0x8b')])['format'](_0xe9a2('0xa1'))[_0xe9a2('0xaf')](),'sender':_0x366888[_0xe9a2('0x8d')]===_0xe9a2('0x5e')?_0x366888['User']?_0x366888['User'][_0xe9a2('0x51')]:_0xe9a2('0x89'):_0x366888[_0xe9a2('0x64')]['firstName']+(_0x366888[_0xe9a2('0x64')][_0xe9a2('0xc5')]?'\x20'+_0x366888[_0xe9a2('0x64')]['lastName']:''),'body':_0x366888[_0xe9a2('0x6e')]?_0x366888[_0xe9a2('0x6e')][_0xe9a2('0xc6')]:_0x366888['body'],'direction':_0x366888[_0xe9a2('0x8d')]===_0xe9a2('0x5e')?'A':'C','secret':_0x366888[_0xe9a2('0xb6')],'read':_0x366888[_0xe9a2('0xc7')],'attachment':_0x366888['Attachment']};})[_0xe9a2('0xc8')]()};return ejs['renderFile'](path[_0xe9a2('0x74')](config[_0xe9a2('0x73')],_0xe9a2('0xb0'),'views',_0xe9a2('0xc9')),{'interaction':_0x1e08b6})[_0xe9a2('0x15')](function(_0x490aad){var _0x17d437=path[_0xe9a2('0x74')](_0x4e7205,_0xe9a2('0xca')+_0x290fd9['id']+'-'+_0x1a2b83+'.pdf');var _0x5dc253={'path':_0x17d437,'channel':_0xe9a2('0xba'),'interactionId':_0x290fd9['id']};return pdf['createPdfFromHTML'](_0x490aad,_0x5dc253);})['then'](function(){return new Promise(function(_0x41f40d,_0x3fb957){zipdir(_0x4e7205,{'saveTo':_0x2a91bf},function(_0x1d4ec8,_0x5a5b05){if(_0x1d4ec8)return _0x3fb957(_0x1d4ec8);return _0x41f40d(_0x5a5b05);});})[_0xe9a2('0x15')](function(){return new BPromise(function(_0x14f8ed,_0x2c9238){rimraf(_0x4e7205,function(_0x745470){if(_0x745470)_0x2c9238(_0x745470);return _0x14f8ed();});});})[_0xe9a2('0x15')](function(){return _0x4ac3ba['download'](_0x2a91bf,_0x1538c6,function(_0x4dc85a){if(_0x4dc85a){logger['error'](_0xe9a2('0xcb'),_0x4dc85a);}else{fs['unlinkSync'](_0x2a91bf);}});});});}else{return _0x4ac3ba[_0xe9a2('0x1f')](0xc8);}})[_0xe9a2('0x1e')](handleError(_0x4ac3ba,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 69e518b..7dffc10 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 _0xce1c=['ChatInteraction','ChatMessage','save','update','remove','getUsers','then','setDataValue','map','findAll','length','emit','hook','events','../../mysqldb'];(function(_0x263039,_0x31b9a7){var _0x452e7b=function(_0x359a2c){while(--_0x359a2c){_0x263039['push'](_0x263039['shift']());}};_0x452e7b(++_0x31b9a7);}(_0xce1c,0x10c));var _0xcce1=function(_0x391f75,_0x40b55e){_0x391f75=_0x391f75-0x0;var _0x379e5b=_0xce1c[_0x391f75];return _0x379e5b;};'use strict';var EventEmitter=require(_0xcce1('0x0'));var ChatInteraction=require(_0xcce1('0x1'))['db'][_0xcce1('0x2')];var ChatMessage=require(_0xcce1('0x1'))['db'][_0xcce1('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcce1('0x4'),'afterUpdate':_0xcce1('0x5'),'afterDestroy':_0xcce1('0x6')};function emitEvent(_0x781c1f){return function(_0x4a9dd6,_0x4093c5,_0x2aa747){_0x4a9dd6[_0xcce1('0x7')]({'attributes':['id'],'raw':!![]})[_0xcce1('0x8')](function(_0x21da4f){_0x4a9dd6[_0xcce1('0x9')]('Users',_0x21da4f[_0xcce1('0xa')](function(_0x4c2e34){return{'id':_0x4c2e34['id']};}));return ChatMessage[_0xcce1('0xb')]({'where':{'ChatInteractionId':_0x4a9dd6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcce1('0x8')](function(_0x350de2){_0x4a9dd6[_0xcce1('0x9')]('unreadMessages',_0x350de2[_0xcce1('0xc')]);ChatInteractionEvents[_0xcce1('0xd')](_0x781c1f+':'+_0x4a9dd6['id'],_0x4a9dd6);ChatInteractionEvents[_0xcce1('0xd')](_0x781c1f,_0x4a9dd6);_0x2aa747(null);})['catch'](_0x2aa747(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xcce1('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xdfe3=['ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','emit','catch','exports','../../mysqldb'];(function(_0x40f64d,_0x3f88fa){var _0x53171c=function(_0x5d4ded){while(--_0x5d4ded){_0x40f64d['push'](_0x40f64d['shift']());}};_0x53171c(++_0x3f88fa);}(_0xdfe3,0x67));var _0x3dfe=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xdfe3[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x3dfe('0x0'))['db'][_0x3dfe('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3dfe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dfe('0x3'),'afterDestroy':_0x3dfe('0x4')};function emitEvent(_0x185da8){return function(_0x4c74a9,_0x806125,_0x1dcdac){_0x4c74a9[_0x3dfe('0x5')]({'attributes':['id'],'raw':!![]})[_0x3dfe('0x6')](function(_0x592770){_0x4c74a9[_0x3dfe('0x7')](_0x3dfe('0x8'),_0x592770['map'](function(_0x40cbcd){return{'id':_0x40cbcd['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4c74a9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f7e81){_0x4c74a9[_0x3dfe('0x7')](_0x3dfe('0x9'),_0x3f7e81['length']);ChatInteractionEvents[_0x3dfe('0xa')](_0x185da8+':'+_0x4c74a9['id'],_0x4c74a9);ChatInteractionEvents[_0x3dfe('0xa')](_0x185da8,_0x4c74a9);_0x1dcdac(null);})[_0x3dfe('0xb')](_0x1dcdac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x3dfe('0xc')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 77080ca..cc28a19 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 _0xe53c=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x174752,_0x4d9f12){var _0xa311a0=function(_0x237b09){while(--_0x237b09){_0x174752['push'](_0x174752['shift']());}};_0xa311a0(++_0x4d9f12);}(_0xe53c,0x137));var _0xce53=function(_0x5c98ea,_0xa782aa){_0x5c98ea=_0x5c98ea-0x0;var _0x51e853=_0xe53c[_0x5c98ea];return _0x51e853;};'use strict';var _=require(_0xce53('0x0'));var util=require(_0xce53('0x1'));var logger=require(_0xce53('0x2'))('api');var moment=require(_0xce53('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce53('0x4'));var config=require(_0xce53('0x5'));var attributes=require(_0xce53('0x6'));module['exports']=function(_0x44fb0e,_0x285fde){return _0x44fb0e[_0xce53('0x7')](_0xce53('0x8'),attributes,{'tableName':_0xce53('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8817da,_0x3c7873,_0xd49c50){if(_0x8817da[_0xce53('0xa')](_0xce53('0xb'))){_0x8817da[_0xce53('0xc')]=moment()[_0xce53('0xd')](_0xce53('0xe'));}_0xd49c50(null,_0x8817da);}},'charset':_0xce53('0xf'),'collate':_0xce53('0x10')});}; \ No newline at end of file +var _0xec6e=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatInteraction.attributes','exports','define'];(function(_0x5b19fe,_0x1671fa){var _0x4e2b4d=function(_0x5e2326){while(--_0x5e2326){_0x5b19fe['push'](_0x5b19fe['shift']());}};_0x4e2b4d(++_0x1671fa);}(_0xec6e,0x1aa));var _0xeec6=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0xec6e[_0x5c883f];return _0x4210cc;};'use strict';var _=require(_0xeec6('0x0'));var util=require(_0xeec6('0x1'));var logger=require(_0xeec6('0x2'))(_0xeec6('0x3'));var moment=require(_0xeec6('0x4'));var BPromise=require(_0xeec6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeec6('0x6'));var rimraf=require(_0xeec6('0x7'));var config=require('../../config/environment');var attributes=require(_0xeec6('0x8'));module[_0xeec6('0x9')]=function(_0x388d29,_0x1674f2){return _0x388d29[_0xeec6('0xa')](_0xeec6('0xb'),attributes,{'tableName':_0xeec6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19af09,_0x246274,_0x970213){if(_0x19af09[_0xeec6('0xd')](_0xeec6('0xe'))){_0x19af09[_0xeec6('0xf')]=moment()[_0xeec6('0x10')](_0xeec6('0x11'));}_0x970213(null,_0x19af09);}},'charset':'utf8mb4','collate':_0xeec6('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6cfb7a3..f1cbe5a 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 _0x2fb3=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','limit','AddTagsToChatInteraction','where','then','addTags','ids','omit','spread','info','AddTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fb3,0x9c));var _0x32fb=function(_0x567405,_0x4675dd){_0x567405=_0x567405-0x0;var _0x23079f=_0x2fb3[_0x567405];return _0x23079f;};'use strict';var _=require(_0x32fb('0x0'));var util=require('util');var moment=require(_0x32fb('0x1'));var BPromise=require(_0x32fb('0x2'));var rs=require(_0x32fb('0x3'));var fs=require('fs');var Redis=require(_0x32fb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x32fb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x32fb('0x6'));var client=jayson['client'][_0x32fb('0x7')]({'port':0x232a});config[_0x32fb('0x8')]=_[_0x32fb('0x9')](config[_0x32fb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x32fb('0xa'))(new Redis(config['redis']));require(_0x32fb('0xb'))['register'](socket);function respondWithRpcPromise(_0x4954be,_0x2648a5,_0x226845){return new BPromise(function(_0x5e1328,_0x149b60){return client[_0x32fb('0xc')](_0x4954be,_0x226845)['then'](function(_0x54a6a0){logger['info'](_0x32fb('0xd'),_0x2648a5,'request\x20sent');logger[_0x32fb('0xe')](_0x32fb('0xf'),_0x2648a5,'request\x20sent',JSON[_0x32fb('0x10')](_0x54a6a0));if(_0x54a6a0[_0x32fb('0x11')]){if(_0x54a6a0['error'][_0x32fb('0x12')]===0x1f4){logger['error'](_0x32fb('0xd'),_0x2648a5,_0x54a6a0[_0x32fb('0x11')][_0x32fb('0x13')]);return _0x149b60(_0x54a6a0[_0x32fb('0x11')][_0x32fb('0x13')]);}logger[_0x32fb('0x11')](_0x32fb('0xd'),_0x2648a5,_0x54a6a0[_0x32fb('0x11')][_0x32fb('0x13')]);return _0x5e1328(_0x54a6a0[_0x32fb('0x11')]['message']);}else{logger['info'](_0x32fb('0xd'),_0x2648a5,_0x32fb('0x14'));_0x5e1328(_0x54a6a0[_0x32fb('0x15')][_0x32fb('0x13')]);}})[_0x32fb('0x16')](function(_0x5d37e1){logger[_0x32fb('0x11')](_0x32fb('0xd'),_0x2648a5,_0x5d37e1);_0x149b60(_0x5d37e1);});});}exports[_0x32fb('0x17')]=function(_0x55610e){var _0x55fd45=this;return new Promise(function(_0x15b91f,_0x5c4974){return db[_0x32fb('0x18')][_0x32fb('0x19')](_0x55610e[_0x32fb('0x1a')],{'raw':_0x55610e[_0x32fb('0x1b')]?_0x55610e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55610e[_0x32fb('0x1b')]?_0x55610e[_0x32fb('0x1b')]['where']||null:null,'attributes':_0x55610e['options']?_0x55610e[_0x32fb('0x1b')][_0x32fb('0x1c')]||null:null,'limit':_0x55610e[_0x32fb('0x1b')]?_0x55610e['options'][_0x32fb('0x1d')]||null:null})['then'](function(_0x3e2994){logger['info']('UpdateChatInteraction',_0x55610e);logger[_0x32fb('0xe')](_0x32fb('0x17'),_0x55610e,JSON[_0x32fb('0x10')](_0x3e2994));_0x15b91f(_0x3e2994);})['catch'](function(_0x120637){logger[_0x32fb('0x11')]('UpdateChatInteraction',_0x120637[_0x32fb('0x13')],_0x55610e);_0x5c4974(_0x55fd45[_0x32fb('0x11')](0x1f4,_0x120637[_0x32fb('0x13')]));});});};exports[_0x32fb('0x1e')]=function(_0x418b09){return new Promise(function(_0x37163c,_0x2b493e){return db[_0x32fb('0x18')]['find']({'where':_0x418b09[_0x32fb('0x1b')]?_0x418b09['options'][_0x32fb('0x1f')]||null:null})[_0x32fb('0x20')](function(_0x449798){if(_0x449798){return _0x449798[_0x32fb('0x21')](_0x418b09[_0x32fb('0x1a')][_0x32fb('0x22')],_[_0x32fb('0x23')](_0x418b09[_0x32fb('0x1a')],[_0x32fb('0x22'),'id'])||{});}})[_0x32fb('0x24')](function(_0x3335d4){logger[_0x32fb('0x25')]('AddTags',_0x418b09);logger[_0x32fb('0xe')](_0x32fb('0x26'),_0x418b09,JSON[_0x32fb('0x10')](_0x3335d4));_0x37163c(_0x3335d4);})[_0x32fb('0x16')](function(_0x55b7ee){logger[_0x32fb('0x11')]('AddTags',_0x55b7ee[_0x32fb('0x13')],_0x418b09);_0x2b493e(_this[_0x32fb('0x11')](0x1f4,_0x55b7ee['message']));});});}; \ No newline at end of file +var _0xd8bb=['redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x507b5f,_0xc798c8){var _0x30af9d=function(_0x225f1d){while(--_0x225f1d){_0x507b5f['push'](_0x507b5f['shift']());}};_0x30af9d(++_0xc798c8);}(_0xd8bb,0x1cf));var _0xbd8b=function(_0x577398,_0x3da6d7){_0x577398=_0x577398-0x0;var _0x46da2f=_0xd8bb[_0x577398];return _0x46da2f;};'use strict';var _=require('lodash');var util=require(_0xbd8b('0x0'));var moment=require(_0xbd8b('0x1'));var BPromise=require(_0xbd8b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd8b('0x3'));var db=require(_0xbd8b('0x4'))['db'];var utils=require(_0xbd8b('0x5'));var logger=require(_0xbd8b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbd8b('0x7'));var client=jayson[_0xbd8b('0x8')][_0xbd8b('0x9')]({'port':0x232a});config[_0xbd8b('0xa')]=_[_0xbd8b('0xb')](config['redis'],{'host':_0xbd8b('0xc'),'port':0x18eb});var socket=require(_0xbd8b('0xd'))(new Redis(config['redis']));require(_0xbd8b('0xe'))[_0xbd8b('0xf')](socket);function respondWithRpcPromise(_0x61bf75,_0x35feeb,_0x397ca9){return new BPromise(function(_0xed869a,_0x3a13a4){return client[_0xbd8b('0x10')](_0x61bf75,_0x397ca9)[_0xbd8b('0x11')](function(_0xc2dccc){logger[_0xbd8b('0x12')](_0xbd8b('0x13'),_0x35feeb,'request\x20sent');logger[_0xbd8b('0x14')](_0xbd8b('0x15'),_0x35feeb,_0xbd8b('0x16'),JSON[_0xbd8b('0x17')](_0xc2dccc));if(_0xc2dccc[_0xbd8b('0x18')]){if(_0xc2dccc['error'][_0xbd8b('0x19')]===0x1f4){logger[_0xbd8b('0x18')](_0xbd8b('0x13'),_0x35feeb,_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);return _0x3a13a4(_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);}logger[_0xbd8b('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x35feeb,_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);return _0xed869a(_0xc2dccc[_0xbd8b('0x18')][_0xbd8b('0x1a')]);}else{logger[_0xbd8b('0x12')](_0xbd8b('0x13'),_0x35feeb,'request\x20sent');_0xed869a(_0xc2dccc[_0xbd8b('0x1b')]['message']);}})[_0xbd8b('0x1c')](function(_0x530310){logger[_0xbd8b('0x18')](_0xbd8b('0x13'),_0x35feeb,_0x530310);_0x3a13a4(_0x530310);});});}exports[_0xbd8b('0x1d')]=function(_0x34a4c0){var _0x21ee60=this;return new Promise(function(_0x57b152,_0x174a47){return db['ChatInteraction'][_0xbd8b('0x1e')](_0x34a4c0[_0xbd8b('0x1f')],{'raw':_0x34a4c0[_0xbd8b('0x20')]?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34a4c0[_0xbd8b('0x20')]?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x22')]||null:null,'attributes':_0x34a4c0['options']?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x23')]||null:null,'limit':_0x34a4c0['options']?_0x34a4c0[_0xbd8b('0x20')][_0xbd8b('0x24')]||null:null})[_0xbd8b('0x11')](function(_0x444f97){logger['info'](_0xbd8b('0x1d'),_0x34a4c0);logger[_0xbd8b('0x14')]('UpdateChatInteraction',_0x34a4c0,JSON[_0xbd8b('0x17')](_0x444f97));_0x57b152(_0x444f97);})[_0xbd8b('0x1c')](function(_0x414acc){logger['error'](_0xbd8b('0x1d'),_0x414acc[_0xbd8b('0x1a')],_0x34a4c0);_0x174a47(_0x21ee60[_0xbd8b('0x18')](0x1f4,_0x414acc[_0xbd8b('0x1a')]));});});};exports[_0xbd8b('0x25')]=function(_0x2b0630){return new Promise(function(_0x4e8bdc,_0x686609){return db[_0xbd8b('0x26')][_0xbd8b('0x27')]({'where':_0x2b0630['options']?_0x2b0630[_0xbd8b('0x20')]['where']||null:null})[_0xbd8b('0x11')](function(_0x2b56ba){if(_0x2b56ba){return _0x2b56ba[_0xbd8b('0x28')](_0x2b0630['body'][_0xbd8b('0x29')],_['omit'](_0x2b0630[_0xbd8b('0x1f')],[_0xbd8b('0x29'),'id'])||{});}})['spread'](function(_0x140516){logger[_0xbd8b('0x12')](_0xbd8b('0x2a'),_0x2b0630);logger[_0xbd8b('0x14')](_0xbd8b('0x2a'),_0x2b0630,JSON[_0xbd8b('0x17')](_0x140516));_0x4e8bdc(_0x140516);})[_0xbd8b('0x1c')](function(_0x5c23b9){logger[_0xbd8b('0x18')](_0xbd8b('0x2a'),_0x5c23b9[_0xbd8b('0x1a')],_0x2b0630);_0x686609(_this[_0xbd8b('0x18')](0x1f4,_0x5c23b9[_0xbd8b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c362b7a..5c88167 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 _0xd32d=['save','remove','emit','removeListener','register','./chatInteraction.events'];(function(_0x5b0332,_0x469074){var _0x55e280=function(_0x4619d9){while(--_0x4619d9){_0x5b0332['push'](_0x5b0332['shift']());}};_0x55e280(++_0x469074);}(_0xd32d,0x15b));var _0xdd32=function(_0x8f360c,_0x166c6e){_0x8f360c=_0x8f360c-0x0;var _0x37182b=_0xd32d[_0x8f360c];return _0x37182b;};'use strict';var ChatInteractionEvents=require(_0xdd32('0x0'));var events=[_0xdd32('0x1'),_0xdd32('0x2'),'update'];function createListener(_0x848a2b,_0x1df8ad){return function(_0x577087){_0x1df8ad[_0xdd32('0x3')](_0x848a2b,_0x577087);};}function removeListener(_0x4b36b2,_0x5089a1){return function(){ChatInteractionEvents[_0xdd32('0x4')](_0x4b36b2,_0x5089a1);};}exports[_0xdd32('0x5')]=function(_0xf87ad2){for(var _0x12f0a2=0x0,_0x179d27=events['length'];_0x12f0a2<_0x179d27;_0x12f0a2++){var _0x486537=events[_0x12f0a2];var _0x57e8b0=createListener('chatInteraction:'+_0x486537,_0xf87ad2);ChatInteractionEvents['on'](_0x486537,_0x57e8b0);}}; \ No newline at end of file +var _0xf0e5=['remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x5d36d9,_0x1b7e5e){var _0xb4ed5f=function(_0x50152a){while(--_0x50152a){_0x5d36d9['push'](_0x5d36d9['shift']());}};_0xb4ed5f(++_0x1b7e5e);}(_0xf0e5,0x1e3));var _0x5f0e=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xf0e5[_0x263a74];return _0x2aa86c;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x5f0e('0x0'),_0x5f0e('0x1')];function createListener(_0xb1c2b4,_0x29e869){return function(_0x53f8b8){_0x29e869[_0x5f0e('0x2')](_0xb1c2b4,_0x53f8b8);};}function removeListener(_0x2881e9,_0x7d51ee){return function(){ChatInteractionEvents[_0x5f0e('0x3')](_0x2881e9,_0x7d51ee);};}exports[_0x5f0e('0x4')]=function(_0x24b01d){for(var _0x23ef12=0x0,_0x3aa22b=events[_0x5f0e('0x5')];_0x23ef12<_0x3aa22b;_0x23ef12++){var _0x3c8679=events[_0x23ef12];var _0x305854=createListener(_0x5f0e('0x6')+_0x3c8679,_0x24b01d);ChatInteractionEvents['on'](_0x3c8679,_0x305854);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 49677d6..2675d11 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 _0x337e=['connect-timeout','express','Router','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','/:id/abandon','delete','chatinteraction:destroy','destroy','exports','multer','util','path'];(function(_0x4eb367,_0x45d85b){var _0x5aea99=function(_0x32d2e6){while(--_0x32d2e6){_0x4eb367['push'](_0x4eb367['shift']());}};_0x5aea99(++_0x45d85b);}(_0x337e,0x12f));var _0xe337=function(_0x250337,_0x54267b){_0x250337=_0x250337-0x0;var _0x10c225=_0x337e[_0x250337];return _0x10c225;};'use strict';var multer=require(_0xe337('0x0'));var util=require(_0xe337('0x1'));var path=require(_0xe337('0x2'));var timeout=require(_0xe337('0x3'));var express=require(_0xe337('0x4'));var router=express[_0xe337('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe337('0x6'));var controller=require(_0xe337('0x7'));router[_0xe337('0x8')]('/',auth[_0xe337('0x9')](),controller[_0xe337('0xa')]);router[_0xe337('0x8')](_0xe337('0xb'),auth[_0xe337('0x9')](),controller['describe']);router['get'](_0xe337('0xc'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xe337('0x8')]('/:id/attachment_download',auth[_0xe337('0xd')](),controller[_0xe337('0xe')]);router[_0xe337('0x8')]('/:id/messages',auth[_0xe337('0x9')](),controller[_0xe337('0xf')]);router[_0xe337('0x8')](_0xe337('0x10'),auth[_0xe337('0xd')](),controller[_0xe337('0x11')]);router['get'](_0xe337('0x12'),auth[_0xe337('0x9')](),controller[_0xe337('0x13')]);router[_0xe337('0x14')]('/',auth[_0xe337('0x9')](),controller[_0xe337('0x15')]);router[_0xe337('0x14')](_0xe337('0x16'),auth[_0xe337('0x9')](),controller[_0xe337('0x17')]);var upload=multer({'storage':multer[_0xe337('0x18')]({'destination':function(_0x1c8d89,_0x55d8bc,_0x47176e){_0x47176e(null,path['join'](config[_0xe337('0x19')],'server/files/attachments/'));},'filename':function(_0x47e1a7,_0x506cda,_0x6d181b){_0x6d181b(null,util[_0xe337('0x1a')](_0xe337('0x1b'),Date[_0xe337('0x1c')](),_0x506cda[_0xe337('0x1d')][_0xe337('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe337('0x14')](_0xe337('0x1f'),upload[_0xe337('0x20')](_0xe337('0x21')),controller[_0xe337('0x22')]);router['post'](_0xe337('0x23'),auth[_0xe337('0xd')](),controller[_0xe337('0x24')]);router['post'](_0xe337('0x25'),auth['isAuthenticated'](),interaction['tracked'](_0xe337('0x26'),_0xe337('0x27')),controller[_0xe337('0x28')]);router[_0xe337('0x29')](_0xe337('0xc'),auth['isAuthenticated'](),interaction[_0xe337('0x2a')](_0xe337('0x26'),_0xe337('0x2b')),controller[_0xe337('0x2c')]);router[_0xe337('0x29')](_0xe337('0x2d'),controller['customUpdate']);router[_0xe337('0x29')](_0xe337('0x2e'),auth[_0xe337('0xd')](),controller['abandon']);router[_0xe337('0x29')]('/:id/close',controller['close']);router[_0xe337('0x2f')]('/:id',auth[_0xe337('0x9')](),interaction[_0xe337('0x2a')](_0xe337('0x26'),_0xe337('0x30')),controller[_0xe337('0x31')]);router['delete'](_0xe337('0x25'),auth[_0xe337('0x9')](),controller['removeTags']);module[_0xe337('0x32')]=router; \ No newline at end of file +var _0xcc0d=['/:id/messages','getMessages','/:id/download','post','/:id/vidaoo','root','format','originalname','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','/:id','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','attachmentDownload'];(function(_0x30df8d,_0x40b784){var _0x458428=function(_0x5ef49d){while(--_0x5ef49d){_0x30df8d['push'](_0x30df8d['shift']());}};_0x458428(++_0x40b784);}(_0xcc0d,0x187));var _0xdcc0=function(_0x585761,_0x276e8e){_0x585761=_0x585761-0x0;var _0x14a673=_0xcc0d[_0x585761];return _0x14a673;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdcc0('0x0'));var timeout=require(_0xdcc0('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdcc0('0x2'));var auth=require(_0xdcc0('0x3'));var interaction=require(_0xdcc0('0x4'));var config=require(_0xdcc0('0x5'));var controller=require(_0xdcc0('0x6'));router[_0xdcc0('0x7')]('/',auth[_0xdcc0('0x8')](),controller[_0xdcc0('0x9')]);router['get'](_0xdcc0('0xa'),auth[_0xdcc0('0x8')](),controller[_0xdcc0('0xb')]);router[_0xdcc0('0x7')]('/:id',auth[_0xdcc0('0xc')](),controller['show']);router[_0xdcc0('0x7')]('/:id/attachment_download',auth[_0xdcc0('0xc')](),controller[_0xdcc0('0xd')]);router[_0xdcc0('0x7')](_0xdcc0('0xe'),auth[_0xdcc0('0x8')](),controller[_0xdcc0('0xf')]);router[_0xdcc0('0x7')]('/:id/my_messages',auth[_0xdcc0('0xc')](),controller['getMyMessages']);router[_0xdcc0('0x7')](_0xdcc0('0x10'),auth['isAuthenticated'](),controller['download']);router[_0xdcc0('0x11')]('/',auth[_0xdcc0('0x8')](),controller['create']);router['post'](_0xdcc0('0x12'),auth[_0xdcc0('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x406269,_0x19b1bf,_0x1f1946){_0x1f1946(null,path['join'](config[_0xdcc0('0x13')],'server/files/attachments/'));},'filename':function(_0x1473c0,_0x55fadc,_0x2179ab){_0x2179ab(null,util[_0xdcc0('0x14')]('%s-%s',Date['now'](),_0x55fadc[_0xdcc0('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xdcc0('0x16'),upload[_0xdcc0('0x17')]('file'),controller[_0xdcc0('0x18')]);router[_0xdcc0('0x11')](_0xdcc0('0xe'),auth[_0xdcc0('0xc')](),controller[_0xdcc0('0x19')]);router[_0xdcc0('0x11')](_0xdcc0('0x1a'),auth[_0xdcc0('0x8')](),interaction['tracked'](_0xdcc0('0x1b'),_0xdcc0('0x1c')),controller[_0xdcc0('0x1d')]);router[_0xdcc0('0x1e')](_0xdcc0('0x1f'),auth[_0xdcc0('0x8')](),interaction[_0xdcc0('0x20')]('chat',_0xdcc0('0x21')),controller[_0xdcc0('0x22')]);router[_0xdcc0('0x1e')](_0xdcc0('0x23'),controller[_0xdcc0('0x24')]);router[_0xdcc0('0x1e')](_0xdcc0('0x25'),auth['isChatInteractionAuthorized'](),controller[_0xdcc0('0x26')]);router[_0xdcc0('0x1e')](_0xdcc0('0x27'),controller[_0xdcc0('0x28')]);router['delete']('/:id',auth[_0xdcc0('0x8')](),interaction[_0xdcc0('0x20')]('chat',_0xdcc0('0x29')),controller[_0xdcc0('0x2a')]);router['delete']('/:id/tags',auth[_0xdcc0('0x8')](),controller[_0xdcc0('0x2b')]);module[_0xdcc0('0x2c')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0734a9d..58ea7aa 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 _0xc8da=['medium','INTEGER','sequelize','exports'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc8da,0x1de));var _0xac8d=function(_0x42960a,_0x4932f0){_0x42960a=_0x42960a-0x0;var _0x44bcc5=_0xc8da[_0x42960a];return _0x44bcc5;};'use strict';var Sequelize=require(_0xac8d('0x0'));module[_0xac8d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xac8d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xac8d('0x3')]}}; \ No newline at end of file +var _0xb7ee=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0x5b5c87,_0x101049){var _0x26605d=function(_0x6f0e0e){while(--_0x6f0e0e){_0x5b5c87['push'](_0x5b5c87['shift']());}};_0x26605d(++_0x101049);}(_0xb7ee,0xff));var _0xeb7e=function(_0x12dfa1,_0x36ff32){_0x12dfa1=_0x12dfa1-0x0;var _0x5db581=_0xb7ee[_0x12dfa1];return _0x5db581;};'use strict';var Sequelize=require(_0xeb7e('0x0'));module[_0xeb7e('0x1')]={'body':{'type':Sequelize[_0xeb7e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeb7e('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xeb7e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 11712e2..0fbd080 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 _0xc562=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','status','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','ChatInternalMessage','findAll','rows','catch','includeAll','include','create','body','find','params','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','user','fullname','userpic','lastLoginAt','VoiceQueue','VoiceQueues','UserProfileSection','Agents','UserProfileResource','isEmpty','role','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x9f897b,_0x2bc0f7){var _0x595177=function(_0x45f07f){while(--_0x45f07f){_0x9f897b['push'](_0x9f897b['shift']());}};_0x595177(++_0x2bc0f7);}(_0xc562,0xcb));var _0x2c56=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc562[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x2c56('0x0'));var rimraf=require(_0x2c56('0x1'));var zipdir=require(_0x2c56('0x2'));var jsonpatch=require(_0x2c56('0x3'));var rp=require('request-promise');var moment=require(_0x2c56('0x4'));var BPromise=require(_0x2c56('0x5'));var Mustache=require(_0x2c56('0x6'));var util=require(_0x2c56('0x7'));var path=require(_0x2c56('0x8'));var sox=require(_0x2c56('0x9'));var csv=require(_0x2c56('0xa'));var ejs=require(_0x2c56('0xb'));var fs=require('fs');var fs_extra=require(_0x2c56('0xc'));var _=require('lodash');var squel=require(_0x2c56('0xd'));var crypto=require(_0x2c56('0xe'));var jsforce=require(_0x2c56('0xf'));var deskjs=require(_0x2c56('0x10'));var toCsv=require(_0x2c56('0xa'));var querystring=require(_0x2c56('0x11'));var Papa=require(_0x2c56('0x12'));var Redis=require(_0x2c56('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2c56('0x14'));var as=require(_0x2c56('0x15'));var hardwareService=require(_0x2c56('0x16'));var logger=require(_0x2c56('0x17'))(_0x2c56('0x18'));var utils=require(_0x2c56('0x19'));var config=require(_0x2c56('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2c56('0x1b')]=_[_0x2c56('0x1c')](config['redis'],{'host':_0x2c56('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c56('0x1b')]));require('./chatInternalMessage.socket')[_0x2c56('0x1e')](socket);function respondWithStatusCode(_0x4ca55c,_0x336c11){_0x336c11=_0x336c11||0xcc;return function(_0x432d2f){if(_0x432d2f){return _0x4ca55c['sendStatus'](_0x336c11);}return _0x4ca55c[_0x2c56('0x1f')](_0x336c11)['end']();};}function respondWithResult(_0x5527bd,_0x49898d){_0x49898d=_0x49898d||0xc8;return function(_0x37cef5){if(_0x37cef5){return _0x5527bd[_0x2c56('0x1f')](_0x49898d)[_0x2c56('0x20')](_0x37cef5);}};}function respondWithFilteredResult(_0x2e019d,_0xd133a8){return function(_0x2bb6c5){if(_0x2bb6c5){var _0x3d05cd=typeof _0xd133a8[_0x2c56('0x21')]===_0x2c56('0x22')&&typeof _0xd133a8[_0x2c56('0x23')]==='undefined';var _0x452dc1=_0x2bb6c5['count'];var _0x358d5e=_0x3d05cd?0x0:_0xd133a8[_0x2c56('0x21')];var _0x334a92=_0x3d05cd?_0x2bb6c5[_0x2c56('0x24')]:_0xd133a8[_0x2c56('0x21')]+_0xd133a8[_0x2c56('0x23')];var _0x1b29a6;if(_0x334a92>=_0x452dc1){_0x334a92=_0x452dc1;_0x1b29a6=0xc8;}else{_0x1b29a6=0xce;}_0x2e019d[_0x2c56('0x1f')](_0x1b29a6);return _0x2e019d[_0x2c56('0x25')]('Content-Range',_0x358d5e+'-'+_0x334a92+'/'+_0x452dc1)[_0x2c56('0x20')](_0x2bb6c5);}return null;};}function patchUpdates(_0x3075e2){return function(_0x4cf47c){try{jsonpatch[_0x2c56('0x26')](_0x4cf47c,_0x3075e2,!![]);}catch(_0x817a76){return BPromise['reject'](_0x817a76);}return _0x4cf47c[_0x2c56('0x27')]();};}function saveUpdates(_0x523914,_0x4886b4){return function(_0x3a6591){if(_0x3a6591){return _0x3a6591[_0x2c56('0x28')](_0x523914)[_0x2c56('0x29')](function(_0x1d2972){return _0x1d2972;});}return null;};}function removeEntity(_0x4b8011,_0x3e7ed8){return function(_0x85a9df){if(_0x85a9df){return _0x85a9df['destroy']()[_0x2c56('0x29')](function(){_0x4b8011['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc83f3,_0x49e14b){return function(_0x46c210){if(!_0x46c210){_0xfc83f3[_0x2c56('0x2a')](0x194);}return _0x46c210;};}function handleError(_0x3553b2,_0x338e2f){_0x338e2f=_0x338e2f||0x1f4;return function(_0x1cfb11){logger[_0x2c56('0x2b')](_0x1cfb11[_0x2c56('0x2c')]);if(_0x1cfb11[_0x2c56('0x2d')]){delete _0x1cfb11[_0x2c56('0x2d')];}_0x3553b2['status'](_0x338e2f)[_0x2c56('0x2e')](_0x1cfb11);};}exports[_0x2c56('0x2f')]=function(_0x4d646d,_0x23390c){var _0x3bbfb7={},_0x127214={},_0x4831f5={'count':0x0,'rows':[]};var _0x4e2789=_[_0x2c56('0x30')](db['ChatInternalMessage'][_0x2c56('0x31')],function(_0x345857){return{'name':_0x345857[_0x2c56('0x32')],'type':_0x345857['type'][_0x2c56('0x33')]};});_0x127214['model']=_['map'](_0x4e2789,_0x2c56('0x2d'));_0x127214[_0x2c56('0x34')]=_[_0x2c56('0x35')](_0x4d646d[_0x2c56('0x34')]);_0x127214[_0x2c56('0x36')]=_[_0x2c56('0x37')](_0x127214[_0x2c56('0x38')],_0x127214['query']);_0x3bbfb7[_0x2c56('0x39')]=_[_0x2c56('0x37')](_0x127214[_0x2c56('0x38')],qs['fields'](_0x4d646d[_0x2c56('0x34')][_0x2c56('0x3a')]));_0x3bbfb7[_0x2c56('0x39')]=_0x3bbfb7[_0x2c56('0x39')][_0x2c56('0x3b')]?_0x3bbfb7['attributes']:_0x127214[_0x2c56('0x38')];if(!_0x4d646d[_0x2c56('0x34')][_0x2c56('0x3c')]('nolimit')){_0x3bbfb7['limit']=qs['limit'](_0x4d646d[_0x2c56('0x34')]['limit']);_0x3bbfb7[_0x2c56('0x21')]=qs[_0x2c56('0x21')](_0x4d646d[_0x2c56('0x34')][_0x2c56('0x21')]);}_0x3bbfb7[_0x2c56('0x3d')]=qs[_0x2c56('0x3e')](_0x4d646d[_0x2c56('0x34')]['sort']);_0x3bbfb7['where']=qs['filters'](_[_0x2c56('0x3f')](_0x4d646d[_0x2c56('0x34')],_0x127214[_0x2c56('0x36')]),_0x4e2789);if(_0x4d646d['query'][_0x2c56('0x40')]){_0x3bbfb7[_0x2c56('0x41')]=_[_0x2c56('0x42')](_0x3bbfb7[_0x2c56('0x41')],{'$or':_[_0x2c56('0x30')](_0x4e2789,function(_0x5a0b70){if(_0x5a0b70[_0x2c56('0x43')]!==_0x2c56('0x44')){var _0x42353c={};_0x42353c[_0x5a0b70['name']]={'$like':'%'+_0x4d646d[_0x2c56('0x34')][_0x2c56('0x40')]+'%'};return _0x42353c;}})});}_0x3bbfb7=_['merge']({},_0x3bbfb7,_0x4d646d[_0x2c56('0x45')]);var _0x2a9100={'where':_0x3bbfb7['where']};return db['ChatInternalMessage'][_0x2c56('0x24')](_0x2a9100)['then'](function(_0x2754e4){_0x4831f5[_0x2c56('0x24')]=_0x2754e4;if(_0x4d646d['query']['includeAll']){_0x3bbfb7['include']=[{'all':!![]}];}return db[_0x2c56('0x46')][_0x2c56('0x47')](_0x3bbfb7);})[_0x2c56('0x29')](function(_0x161c0e){_0x4831f5[_0x2c56('0x48')]=_0x161c0e;return _0x4831f5;})['then'](respondWithFilteredResult(_0x23390c,_0x3bbfb7))[_0x2c56('0x49')](handleError(_0x23390c,null));};exports['show']=function(_0x17ca5c,_0x37e386){var _0x22671e={'raw':!![],'where':{'id':_0x17ca5c['params']['id']}},_0x314641={};_0x314641[_0x2c56('0x38')]=_[_0x2c56('0x35')](db[_0x2c56('0x46')]['rawAttributes']);_0x314641['query']=_[_0x2c56('0x35')](_0x17ca5c['query']);_0x314641[_0x2c56('0x36')]=_['intersection'](_0x314641[_0x2c56('0x38')],_0x314641[_0x2c56('0x34')]);_0x22671e['attributes']=_[_0x2c56('0x37')](_0x314641[_0x2c56('0x38')],qs['fields'](_0x17ca5c[_0x2c56('0x34')][_0x2c56('0x3a')]));_0x22671e[_0x2c56('0x39')]=_0x22671e[_0x2c56('0x39')][_0x2c56('0x3b')]?_0x22671e['attributes']:_0x314641[_0x2c56('0x38')];if(_0x17ca5c[_0x2c56('0x34')][_0x2c56('0x4a')]){_0x22671e[_0x2c56('0x4b')]=[{'all':!![]}];}_0x22671e=_['merge']({},_0x22671e,_0x17ca5c[_0x2c56('0x45')]);return db[_0x2c56('0x46')]['find'](_0x22671e)[_0x2c56('0x29')](handleEntityNotFound(_0x37e386,null))[_0x2c56('0x29')](respondWithResult(_0x37e386,null))[_0x2c56('0x49')](handleError(_0x37e386,null));};exports[_0x2c56('0x4c')]=function(_0x5799a5,_0x3806e0){return db[_0x2c56('0x46')][_0x2c56('0x4c')](_0x5799a5['body'],{})[_0x2c56('0x29')](respondWithResult(_0x3806e0,0xc9))[_0x2c56('0x49')](handleError(_0x3806e0,null));};exports['update']=function(_0x554c94,_0x3cd0b5){if(_0x554c94['body']['id']){delete _0x554c94[_0x2c56('0x4d')]['id'];}return db[_0x2c56('0x46')][_0x2c56('0x4e')]({'where':{'id':_0x554c94[_0x2c56('0x4f')]['id']}})[_0x2c56('0x29')](handleEntityNotFound(_0x3cd0b5,null))[_0x2c56('0x29')](saveUpdates(_0x554c94[_0x2c56('0x4d')],null))[_0x2c56('0x29')](respondWithResult(_0x3cd0b5,null))[_0x2c56('0x49')](handleError(_0x3cd0b5,null));};exports[_0x2c56('0x50')]=function(_0x498d07,_0x4fb189){return db['ChatInternalMessage']['find']({'where':{'id':_0x498d07['params']['id']}})[_0x2c56('0x29')](handleEntityNotFound(_0x4fb189,null))[_0x2c56('0x29')](removeEntity(_0x4fb189,null))[_0x2c56('0x49')](handleError(_0x4fb189,null));};exports[_0x2c56('0x51')]=function(_0x27eac4,_0x462db9){return db[_0x2c56('0x46')][_0x2c56('0x51')]()[_0x2c56('0x29')](respondWithResult(_0x462db9,null))[_0x2c56('0x49')](handleError(_0x462db9,null));};function wrapUser(_0x3d82d4){return function(_0x404ca8){var _0x3a7b84=_0x3d82d4[_0x2c56('0x52')]({'plain':!![]});_0x3a7b84[_0x2c56('0x53')]=[];if(_0x404ca8){_0x3a7b84[_0x2c56('0x54')]=_0x404ca8[_0x2c56('0x55')];_0x3a7b84[_0x2c56('0x56')]=_0x404ca8;}else{_0x3a7b84['lastMessageAt']=moment(0x0)[_0x2c56('0x57')](_0x2c56('0x58'));_0x3a7b84[_0x2c56('0x56')]={};}return _0x3a7b84;};}exports['getUsers']=function(_0x1d2a13,_0x164e39,_0x3a1e37){var _0x32506e=[];return db[_0x2c56('0x59')]['findAll']({'where':{'role':[_0x2c56('0x5a'),'admin',_0x2c56('0x5b')]},'attributes':['id',_0x2c56('0x5c'),'name','role',_0x2c56('0x5d'),'internal','online',_0x2c56('0x5e'),'allowmessenger','showWebBar'],'order':qs[_0x2c56('0x3e')]('-online'),'include':[{'model':db[_0x2c56('0x5f')],'as':_0x2c56('0x60'),'attributes':['id',_0x2c56('0x2d'),_0x2c56('0x43')],'through':{'attributes':[]}}]})[_0x2c56('0x29')](function(_0x2fac1b){if(_0x2fac1b){var _0x2f6244=_0x1d2a13[_0x2c56('0x5b')][_0x2c56('0x52')]({'plain':!![]});if(!_0x2f6244)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f6244['role']===_0x2c56('0x5b')){return db[_0x2c56('0x61')][_0x2c56('0x4e')]({'where':{'name':_0x2c56('0x62'),'userProfileId':_0x2f6244['userProfileId']},'raw':!![]})[_0x2c56('0x29')](function(_0x1e6894){if(_0x1e6894){if(_0x1e6894['autoAssociation']===0x0){return db[_0x2c56('0x63')][_0x2c56('0x47')]({'where':{'sectionId':_0x1e6894['id']},'raw':!![]})[_0x2c56('0x29')](function(_0x1d8bcc){var _0x53883f=[];if(_[_0x2c56('0x64')](_0x1d8bcc)){_0x53883f=_[_0x2c56('0x40')](_0x2fac1b,function(_0x4f092f){if(_0x4f092f[_0x2c56('0x65')]!==_0x2c56('0x5a')){return _0x4f092f;}});return _0x53883f;}else{for(var _0x41d81a=0x0;_0x41d81a<_0x2fac1b[_0x2c56('0x3b')];_0x41d81a++){var _0x5d3873=_0x2fac1b[_0x41d81a];if(_0x5d3873[_0x2c56('0x65')]===_0x2c56('0x5a')){var _0x32c496=_['find'](_0x1d8bcc,function(_0x42bc09){return _0x42bc09['resourceId']===_0x5d3873['id'];});if(_0x32c496)_0x53883f[_0x2c56('0x66')](_0x5d3873);}else{_0x53883f['push'](_0x5d3873);}}return _0x53883f;}});}else{return _0x2fac1b;}}else{var _0x40a5db=_[_0x2c56('0x40')](_0x2fac1b,function(_0x54b06a){if(_0x54b06a[_0x2c56('0x65')]!=='agent'){return _0x54b06a;}});return _0x40a5db;}});}else{return _0x2fac1b;}}})[_0x2c56('0x29')](function(_0xa4a69){var _0x16af69=[];if(_0xa4a69){_0x32506e=_0xa4a69;for(var _0x738ddd=0x0;_0x738ddd<_0xa4a69[_0x2c56('0x3b')];_0x738ddd+=0x1){_0x32506e[_0x738ddd][_0x2c56('0x53')]=[];_0x16af69['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x1d2a13[_0x2c56('0x5b')]['id'],_0xa4a69[_0x738ddd]['id']],'ToId':[_0x1d2a13[_0x2c56('0x5b')]['id'],_0xa4a69[_0x738ddd]['id']],'ChatGroupId':null},'attributes':['id',_0x2c56('0x55'),_0x2c56('0x67'),_0x2c56('0x68'),_0x2c56('0x69'),_0x2c56('0x4d')],'order':qs[_0x2c56('0x3e')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2c56('0x29')](wrapUser(_0xa4a69[_0x738ddd])));}return BPromise[_0x2c56('0x6a')](_0x16af69);}return[];})[_0x2c56('0x29')](function(_0x2229d1){return{'rows':_0x2229d1,'count':_0x2229d1[_0x2c56('0x3b')]};})['then'](respondWithResult(_0x164e39,null))[_0x2c56('0x49')](handleError(_0x164e39,null));}; \ No newline at end of file +var _0x4749=['map','VIRTUAL','options','includeAll','findAll','catch','keys','rawAttributes','include','find','create','body','params','destroy','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','agent','FromId','-createdAt','all','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','ChatInternalMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge'];(function(_0xea23f8,_0x2b76d2){var _0x437658=function(_0x22af97){while(--_0x22af97){_0xea23f8['push'](_0xea23f8['shift']());}};_0x437658(++_0x2b76d2);}(_0x4749,0x1da));var _0x9474=function(_0x258717,_0x3060cc){_0x258717=_0x258717-0x0;var _0x15a6ae=_0x4749[_0x258717];return _0x15a6ae;};'use strict';var emlformat=require(_0x9474('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9474('0x1'));var moment=require('moment');var BPromise=require(_0x9474('0x2'));var Mustache=require(_0x9474('0x3'));var util=require('util');var path=require(_0x9474('0x4'));var sox=require(_0x9474('0x5'));var csv=require(_0x9474('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9474('0x7'));var squel=require(_0x9474('0x8'));var crypto=require('crypto');var jsforce=require(_0x9474('0x9'));var deskjs=require(_0x9474('0xa'));var toCsv=require(_0x9474('0x6'));var querystring=require(_0x9474('0xb'));var Papa=require(_0x9474('0xc'));var Redis=require(_0x9474('0xd'));var authService=require(_0x9474('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9474('0xf'));var hardwareService=require(_0x9474('0x10'));var logger=require(_0x9474('0x11'))(_0x9474('0x12'));var utils=require(_0x9474('0x13'));var config=require(_0x9474('0x14'));var licenseUtil=require(_0x9474('0x15'));var db=require(_0x9474('0x16'))['db'];config[_0x9474('0x17')]=_['defaults'](config[_0x9474('0x17')],{'host':_0x9474('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9474('0x17')]));require(_0x9474('0x19'))[_0x9474('0x1a')](socket);function respondWithStatusCode(_0x2d0d02,_0x4a95ab){_0x4a95ab=_0x4a95ab||0xcc;return function(_0x149065){if(_0x149065){return _0x2d0d02[_0x9474('0x1b')](_0x4a95ab);}return _0x2d0d02[_0x9474('0x1c')](_0x4a95ab)[_0x9474('0x1d')]();};}function respondWithResult(_0x36eac5,_0x544d2d){_0x544d2d=_0x544d2d||0xc8;return function(_0x5bd2f5){if(_0x5bd2f5){return _0x36eac5[_0x9474('0x1c')](_0x544d2d)['json'](_0x5bd2f5);}};}function respondWithFilteredResult(_0x538aaf,_0x55e1b2){return function(_0x19691b){if(_0x19691b){var _0xae8d68=typeof _0x55e1b2[_0x9474('0x1e')]===_0x9474('0x1f')&&typeof _0x55e1b2['limit']===_0x9474('0x1f');var _0x126321=_0x19691b[_0x9474('0x20')];var _0x8c1668=_0xae8d68?0x0:_0x55e1b2['offset'];var _0x34f4c7=_0xae8d68?_0x19691b[_0x9474('0x20')]:_0x55e1b2[_0x9474('0x1e')]+_0x55e1b2[_0x9474('0x21')];var _0x49aa21;if(_0x34f4c7>=_0x126321){_0x34f4c7=_0x126321;_0x49aa21=0xc8;}else{_0x49aa21=0xce;}_0x538aaf[_0x9474('0x1c')](_0x49aa21);return _0x538aaf[_0x9474('0x22')](_0x9474('0x23'),_0x8c1668+'-'+_0x34f4c7+'/'+_0x126321)[_0x9474('0x24')](_0x19691b);}return null;};}function patchUpdates(_0x5cc757){return function(_0x3f2de7){try{jsonpatch['apply'](_0x3f2de7,_0x5cc757,!![]);}catch(_0x1a0377){return BPromise[_0x9474('0x25')](_0x1a0377);}return _0x3f2de7[_0x9474('0x26')]();};}function saveUpdates(_0x1fce66,_0x4b1f12){return function(_0x4f0830){if(_0x4f0830){return _0x4f0830[_0x9474('0x27')](_0x1fce66)[_0x9474('0x28')](function(_0x2f95fd){return _0x2f95fd;});}return null;};}function removeEntity(_0x37dd31,_0x57d0d6){return function(_0x2a967a){if(_0x2a967a){return _0x2a967a['destroy']()['then'](function(){_0x37dd31[_0x9474('0x1c')](0xcc)[_0x9474('0x1d')]();});}};}function handleEntityNotFound(_0x3f10f3,_0x4c1a29){return function(_0x59da74){if(!_0x59da74){_0x3f10f3[_0x9474('0x1b')](0x194);}return _0x59da74;};}function handleError(_0x9f0047,_0x5bb564){_0x5bb564=_0x5bb564||0x1f4;return function(_0x1f50f5){logger[_0x9474('0x29')](_0x1f50f5[_0x9474('0x2a')]);if(_0x1f50f5[_0x9474('0x2b')]){delete _0x1f50f5[_0x9474('0x2b')];}_0x9f0047[_0x9474('0x1c')](_0x5bb564)[_0x9474('0x2c')](_0x1f50f5);};}exports['index']=function(_0x40b5b6,_0x21b347){var _0x4dfd8c={},_0x101f86={},_0x42a3b1={'count':0x0,'rows':[]};var _0x3f65e4=_['map'](db[_0x9474('0x2d')]['rawAttributes'],function(_0x5cf875){return{'name':_0x5cf875[_0x9474('0x2e')],'type':_0x5cf875[_0x9474('0x2f')][_0x9474('0x30')]};});_0x101f86[_0x9474('0x31')]=_['map'](_0x3f65e4,_0x9474('0x2b'));_0x101f86[_0x9474('0x32')]=_['keys'](_0x40b5b6['query']);_0x101f86[_0x9474('0x33')]=_[_0x9474('0x34')](_0x101f86[_0x9474('0x31')],_0x101f86['query']);_0x4dfd8c[_0x9474('0x35')]=_['intersection'](_0x101f86['model'],qs[_0x9474('0x36')](_0x40b5b6[_0x9474('0x32')]['fields']));_0x4dfd8c[_0x9474('0x35')]=_0x4dfd8c[_0x9474('0x35')][_0x9474('0x37')]?_0x4dfd8c[_0x9474('0x35')]:_0x101f86[_0x9474('0x31')];if(!_0x40b5b6[_0x9474('0x32')]['hasOwnProperty'](_0x9474('0x38'))){_0x4dfd8c[_0x9474('0x21')]=qs[_0x9474('0x21')](_0x40b5b6[_0x9474('0x32')]['limit']);_0x4dfd8c[_0x9474('0x1e')]=qs['offset'](_0x40b5b6[_0x9474('0x32')][_0x9474('0x1e')]);}_0x4dfd8c['order']=qs[_0x9474('0x39')](_0x40b5b6['query'][_0x9474('0x39')]);_0x4dfd8c[_0x9474('0x3a')]=qs['filters'](_['pick'](_0x40b5b6[_0x9474('0x32')],_0x101f86[_0x9474('0x33')]),_0x3f65e4);if(_0x40b5b6[_0x9474('0x32')][_0x9474('0x3b')]){_0x4dfd8c[_0x9474('0x3a')]=_[_0x9474('0x3c')](_0x4dfd8c[_0x9474('0x3a')],{'$or':_[_0x9474('0x3d')](_0x3f65e4,function(_0xa49c5){if(_0xa49c5[_0x9474('0x2f')]!==_0x9474('0x3e')){var _0x410d33={};_0x410d33[_0xa49c5[_0x9474('0x2b')]]={'$like':'%'+_0x40b5b6[_0x9474('0x32')]['filter']+'%'};return _0x410d33;}})});}_0x4dfd8c=_[_0x9474('0x3c')]({},_0x4dfd8c,_0x40b5b6[_0x9474('0x3f')]);var _0x455035={'where':_0x4dfd8c[_0x9474('0x3a')]};return db[_0x9474('0x2d')][_0x9474('0x20')](_0x455035)[_0x9474('0x28')](function(_0x47f198){_0x42a3b1[_0x9474('0x20')]=_0x47f198;if(_0x40b5b6[_0x9474('0x32')][_0x9474('0x40')]){_0x4dfd8c['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x9474('0x41')](_0x4dfd8c);})[_0x9474('0x28')](function(_0x1daa8c){_0x42a3b1['rows']=_0x1daa8c;return _0x42a3b1;})[_0x9474('0x28')](respondWithFilteredResult(_0x21b347,_0x4dfd8c))[_0x9474('0x42')](handleError(_0x21b347,null));};exports['show']=function(_0x54c1ad,_0x4892b6){var _0x2542c5={'raw':!![],'where':{'id':_0x54c1ad['params']['id']}},_0x479e4f={};_0x479e4f[_0x9474('0x31')]=_[_0x9474('0x43')](db['ChatInternalMessage'][_0x9474('0x44')]);_0x479e4f[_0x9474('0x32')]=_['keys'](_0x54c1ad[_0x9474('0x32')]);_0x479e4f['filters']=_['intersection'](_0x479e4f[_0x9474('0x31')],_0x479e4f[_0x9474('0x32')]);_0x2542c5[_0x9474('0x35')]=_['intersection'](_0x479e4f[_0x9474('0x31')],qs[_0x9474('0x36')](_0x54c1ad[_0x9474('0x32')][_0x9474('0x36')]));_0x2542c5['attributes']=_0x2542c5[_0x9474('0x35')][_0x9474('0x37')]?_0x2542c5[_0x9474('0x35')]:_0x479e4f['model'];if(_0x54c1ad[_0x9474('0x32')][_0x9474('0x40')]){_0x2542c5[_0x9474('0x45')]=[{'all':!![]}];}_0x2542c5=_['merge']({},_0x2542c5,_0x54c1ad['options']);return db[_0x9474('0x2d')][_0x9474('0x46')](_0x2542c5)[_0x9474('0x28')](handleEntityNotFound(_0x4892b6,null))['then'](respondWithResult(_0x4892b6,null))[_0x9474('0x42')](handleError(_0x4892b6,null));};exports['create']=function(_0xb7037d,_0x13d683){return db[_0x9474('0x2d')][_0x9474('0x47')](_0xb7037d[_0x9474('0x48')],{})['then'](respondWithResult(_0x13d683,0xc9))[_0x9474('0x42')](handleError(_0x13d683,null));};exports[_0x9474('0x27')]=function(_0xd515ca,_0x40f4e4){if(_0xd515ca[_0x9474('0x48')]['id']){delete _0xd515ca[_0x9474('0x48')]['id'];}return db[_0x9474('0x2d')][_0x9474('0x46')]({'where':{'id':_0xd515ca[_0x9474('0x49')]['id']}})[_0x9474('0x28')](handleEntityNotFound(_0x40f4e4,null))[_0x9474('0x28')](saveUpdates(_0xd515ca['body'],null))[_0x9474('0x28')](respondWithResult(_0x40f4e4,null))[_0x9474('0x42')](handleError(_0x40f4e4,null));};exports[_0x9474('0x4a')]=function(_0x22cfaa,_0x5a1685){return db[_0x9474('0x2d')][_0x9474('0x46')]({'where':{'id':_0x22cfaa[_0x9474('0x49')]['id']}})[_0x9474('0x28')](handleEntityNotFound(_0x5a1685,null))['then'](removeEntity(_0x5a1685,null))['catch'](handleError(_0x5a1685,null));};exports['describe']=function(_0x314719,_0x34949a){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x34949a,null))[_0x9474('0x42')](handleError(_0x34949a,null));};function wrapUser(_0x2a2fb5){return function(_0x172443){var _0x2a1c95=_0x2a2fb5[_0x9474('0x4b')]({'plain':!![]});_0x2a1c95[_0x9474('0x4c')]=[];if(_0x172443){_0x2a1c95[_0x9474('0x4d')]=_0x172443[_0x9474('0x4e')];_0x2a1c95[_0x9474('0x4f')]=_0x172443;}else{_0x2a1c95['lastMessageAt']=moment(0x0)[_0x9474('0x50')](_0x9474('0x51'));_0x2a1c95['lastMessage']={};}return _0x2a1c95;};}exports[_0x9474('0x52')]=function(_0x17a29d,_0x69c4bd,_0x51754c){var _0x1f691c=[];return db['User'][_0x9474('0x41')]({'where':{'role':['agent',_0x9474('0x53'),'user']},'attributes':['id','fullname','name',_0x9474('0x54'),_0x9474('0x55'),_0x9474('0x56'),_0x9474('0x57'),_0x9474('0x58'),_0x9474('0x59'),_0x9474('0x5a')],'order':qs[_0x9474('0x39')](_0x9474('0x5b')),'include':[{'model':db[_0x9474('0x5c')],'as':_0x9474('0x5d'),'attributes':['id',_0x9474('0x2b'),_0x9474('0x2f')],'through':{'attributes':[]}}]})['then'](function(_0x1fb122){if(_0x1fb122){var _0x115d92=_0x17a29d[_0x9474('0x5e')][_0x9474('0x4b')]({'plain':!![]});if(!_0x115d92)throw new Error(_0x9474('0x5f'));if(_0x115d92[_0x9474('0x54')]===_0x9474('0x5e')){return db[_0x9474('0x60')][_0x9474('0x46')]({'where':{'name':_0x9474('0x61'),'userProfileId':_0x115d92['userProfileId']},'raw':!![]})[_0x9474('0x28')](function(_0x70afc1){if(_0x70afc1){if(_0x70afc1[_0x9474('0x62')]===0x0){return db[_0x9474('0x63')]['findAll']({'where':{'sectionId':_0x70afc1['id']},'raw':!![]})[_0x9474('0x28')](function(_0xff9fde){var _0x5a7da7=[];if(_[_0x9474('0x64')](_0xff9fde)){_0x5a7da7=_[_0x9474('0x3b')](_0x1fb122,function(_0x61761f){if(_0x61761f[_0x9474('0x54')]!=='agent'){return _0x61761f;}});return _0x5a7da7;}else{for(var _0x386ccd=0x0;_0x386ccd<_0x1fb122['length'];_0x386ccd++){var _0xcc1b5=_0x1fb122[_0x386ccd];if(_0xcc1b5[_0x9474('0x54')]==='agent'){var _0xd99753=_[_0x9474('0x46')](_0xff9fde,function(_0x1d148a){return _0x1d148a[_0x9474('0x65')]===_0xcc1b5['id'];});if(_0xd99753)_0x5a7da7['push'](_0xcc1b5);}else{_0x5a7da7[_0x9474('0x66')](_0xcc1b5);}}return _0x5a7da7;}});}else{return _0x1fb122;}}else{var _0x182806=_[_0x9474('0x3b')](_0x1fb122,function(_0x41b66d){if(_0x41b66d[_0x9474('0x54')]!==_0x9474('0x67')){return _0x41b66d;}});return _0x182806;}});}else{return _0x1fb122;}}})[_0x9474('0x28')](function(_0x2c2f38){var _0x225a3a=[];if(_0x2c2f38){_0x1f691c=_0x2c2f38;for(var _0x519e49=0x0;_0x519e49<_0x2c2f38[_0x9474('0x37')];_0x519e49+=0x1){_0x1f691c[_0x519e49][_0x9474('0x4c')]=[];_0x225a3a[_0x9474('0x66')](db[_0x9474('0x2d')][_0x9474('0x46')]({'where':{'FromId':[_0x17a29d[_0x9474('0x5e')]['id'],_0x2c2f38[_0x519e49]['id']],'ToId':[_0x17a29d[_0x9474('0x5e')]['id'],_0x2c2f38[_0x519e49]['id']],'ChatGroupId':null},'attributes':['id',_0x9474('0x4e'),_0x9474('0x68'),'ToId','read','body'],'order':qs[_0x9474('0x39')](_0x9474('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9474('0x28')](wrapUser(_0x2c2f38[_0x519e49])));}return BPromise[_0x9474('0x6a')](_0x225a3a);}return[];})[_0x9474('0x28')](function(_0x7d6234){return{'rows':_0x7d6234,'count':_0x7d6234[_0x9474('0x37')]};})[_0x9474('0x28')](respondWithResult(_0x69c4bd,null))[_0x9474('0x42')](handleError(_0x69c4bd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 485a356..756a989 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 _0x4390=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','emit','hook'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x4390,0x88));var _0x0439=function(_0x89c25f,_0x447499){_0x89c25f=_0x89c25f-0x0;var _0x730ea5=_0x4390[_0x89c25f];return _0x730ea5;};'use strict';var EventEmitter=require(_0x0439('0x0'));var ChatInternalMessage=require(_0x0439('0x1'))['db'][_0x0439('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0439('0x3')](0x0);var events={'afterCreate':_0x0439('0x4'),'afterUpdate':_0x0439('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4ac968){return function(_0x5c8030,_0x196901,_0x25142f){ChatInternalMessageEvents[_0x0439('0x6')](_0x4ac968+':'+_0x5c8030['id'],_0x5c8030);ChatInternalMessageEvents[_0x0439('0x6')](_0x4ac968,_0x5c8030);_0x25142f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x0439('0x7')](e,emitEvent(event));}}module[_0x0439('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x93e8=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x392ddc,_0xead658){var _0x220027=function(_0x12b700){while(--_0x12b700){_0x392ddc['push'](_0x392ddc['shift']());}};_0x220027(++_0xead658);}(_0x93e8,0x176));var _0x893e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x93e8[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0x893e('0x0'));var ChatInternalMessage=require(_0x893e('0x1'))['db'][_0x893e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x893e('0x3')](0x0);var events={'afterCreate':_0x893e('0x4'),'afterUpdate':_0x893e('0x5'),'afterDestroy':_0x893e('0x6')};function emitEvent(_0x37f8db){return function(_0x4e8b9a,_0x5c01c0,_0x6d00be){ChatInternalMessageEvents[_0x893e('0x7')](_0x37f8db+':'+_0x4e8b9a['id'],_0x4e8b9a);ChatInternalMessageEvents['emit'](_0x37f8db,_0x4e8b9a);_0x6d00be(null);};}for(var e in events){if(events[_0x893e('0x8')](e)){var event=events[e];ChatInternalMessage[_0x893e('0x9')](e,emitEvent(event));}}module[_0x893e('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3579865..52f56ec 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 _0x4b53=['../../config/environment','exports','ChatInternalMessage','chat_internal_messages','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x4b53,0x1dd));var _0x34b5=function(_0xe23b4b,_0x208e2a){_0xe23b4b=_0xe23b4b-0x0;var _0x9a972a=_0x4b53[_0xe23b4b];return _0x9a972a;};'use strict';var _=require(_0x34b5('0x0'));var util=require(_0x34b5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x34b5('0x2'));var BPromise=require(_0x34b5('0x3'));var rp=require(_0x34b5('0x4'));var fs=require('fs');var path=require(_0x34b5('0x5'));var rimraf=require(_0x34b5('0x6'));var config=require(_0x34b5('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x34b5('0x8')]=function(_0x57a948,_0x3d833c){return _0x57a948['define'](_0x34b5('0x9'),attributes,{'tableName':_0x34b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2dd0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2dd0,0x1ba));var _0x02dd=function(_0x476798,_0x4e4bbd){_0x476798=_0x476798-0x0;var _0x4ea9c7=_0x2dd0[_0x476798];return _0x4ea9c7;};'use strict';var _=require(_0x02dd('0x0'));var util=require('util');var logger=require(_0x02dd('0x1'))(_0x02dd('0x2'));var moment=require(_0x02dd('0x3'));var BPromise=require(_0x02dd('0x4'));var rp=require(_0x02dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02dd('0x6'));var config=require(_0x02dd('0x7'));var attributes=require(_0x02dd('0x8'));module[_0x02dd('0x9')]=function(_0x45779d,_0x435617){return _0x45779d['define']('ChatInternalMessage',attributes,{'tableName':_0x02dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x02dd('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c413853..d366401 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 _0xe95b=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x3247bd,_0x2bf86b){var _0x2fa768=function(_0xde652){while(--_0xde652){_0x3247bd['push'](_0x3247bd['shift']());}};_0x2fa768(++_0x2bf86b);}(_0xe95b,0x107));var _0xbe95=function(_0x2a3fc4,_0x3c038e){_0x2a3fc4=_0x2a3fc4-0x0;var _0x431759=_0xe95b[_0x2a3fc4];return _0x431759;};'use strict';var _=require(_0xbe95('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbe95('0x1'));var rs=require(_0xbe95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe95('0x3'));var logger=require(_0xbe95('0x4'))('rpc');var config=require(_0xbe95('0x5'));var jayson=require(_0xbe95('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xbe95('0x7')],{'host':_0xbe95('0x8'),'port':0x18eb});var socket=require(_0xbe95('0x9'))(new Redis(config[_0xbe95('0x7')]));require(_0xbe95('0xa'))[_0xbe95('0xb')](socket);function respondWithRpcPromise(_0x6442a2,_0xa9029d,_0xb3c5fd){return new BPromise(function(_0x53a02f,_0x37b226){return client[_0xbe95('0xc')](_0x6442a2,_0xb3c5fd)['then'](function(_0x1f1ac2){logger[_0xbe95('0xd')](_0xbe95('0xe'),_0xa9029d,_0xbe95('0xf'));logger[_0xbe95('0x10')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xa9029d,_0xbe95('0xf'),JSON[_0xbe95('0x11')](_0x1f1ac2));if(_0x1f1ac2[_0xbe95('0x12')]){if(_0x1f1ac2['error']['code']===0x1f4){logger[_0xbe95('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0xa9029d,_0x1f1ac2[_0xbe95('0x12')][_0xbe95('0x13')]);return _0x37b226(_0x1f1ac2[_0xbe95('0x12')][_0xbe95('0x13')]);}logger[_0xbe95('0x12')](_0xbe95('0xe'),_0xa9029d,_0x1f1ac2[_0xbe95('0x12')][_0xbe95('0x13')]);return _0x53a02f(_0x1f1ac2['error'][_0xbe95('0x13')]);}else{logger[_0xbe95('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0xa9029d,_0xbe95('0xf'));_0x53a02f(_0x1f1ac2[_0xbe95('0x14')][_0xbe95('0x13')]);}})[_0xbe95('0x15')](function(_0x11827f){logger['error'](_0xbe95('0xe'),_0xa9029d,_0x11827f);_0x37b226(_0x11827f);});});} \ No newline at end of file +var _0x3464=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e60b2,_0x5f2d9e){var _0x3514b8=function(_0x5115b1){while(--_0x5115b1){_0x2e60b2['push'](_0x2e60b2['shift']());}};_0x3514b8(++_0x5f2d9e);}(_0x3464,0x16e));var _0x4346=function(_0x25a31f,_0x1cf424){_0x25a31f=_0x25a31f-0x0;var _0x3c03e2=_0x3464[_0x25a31f];return _0x3c03e2;};'use strict';var _=require(_0x4346('0x0'));var util=require(_0x4346('0x1'));var moment=require(_0x4346('0x2'));var BPromise=require(_0x4346('0x3'));var rs=require(_0x4346('0x4'));var fs=require('fs');var Redis=require(_0x4346('0x5'));var db=require(_0x4346('0x6'))['db'];var utils=require(_0x4346('0x7'));var logger=require(_0x4346('0x8'))(_0x4346('0x9'));var config=require(_0x4346('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4346('0xb')]['http']({'port':0x232a});config[_0x4346('0xc')]=_[_0x4346('0xd')](config[_0x4346('0xc')],{'host':_0x4346('0xe'),'port':0x18eb});var socket=require(_0x4346('0xf'))(new Redis(config[_0x4346('0xc')]));require(_0x4346('0x10'))[_0x4346('0x11')](socket);function respondWithRpcPromise(_0x195c6d,_0xc6a466,_0x3d0aa0){return new BPromise(function(_0x47d05b,_0x2aac79){return client[_0x4346('0x12')](_0x195c6d,_0x3d0aa0)['then'](function(_0x1b377c){logger[_0x4346('0x13')](_0x4346('0x14'),_0xc6a466,_0x4346('0x15'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xc6a466,_0x4346('0x15'),JSON[_0x4346('0x16')](_0x1b377c));if(_0x1b377c[_0x4346('0x17')]){if(_0x1b377c[_0x4346('0x17')][_0x4346('0x18')]===0x1f4){logger[_0x4346('0x17')](_0x4346('0x14'),_0xc6a466,_0x1b377c[_0x4346('0x17')][_0x4346('0x19')]);return _0x2aac79(_0x1b377c[_0x4346('0x17')][_0x4346('0x19')]);}logger[_0x4346('0x17')](_0x4346('0x14'),_0xc6a466,_0x1b377c['error']['message']);return _0x47d05b(_0x1b377c[_0x4346('0x17')][_0x4346('0x19')]);}else{logger[_0x4346('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0xc6a466,_0x4346('0x15'));_0x47d05b(_0x1b377c['result'][_0x4346('0x19')]);}})['catch'](function(_0x31abd0){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0xc6a466,_0x31abd0);_0x2aac79(_0x31abd0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 247418d..11aca95 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 _0x503d=['remove','update','length','./chatInternalMessage.events','save'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x503d,0x161));var _0xd503=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0x503d[_0x4f6f84];return _0x20d989;};'use strict';var ChatInternalMessageEvents=require(_0xd503('0x0'));var events=[_0xd503('0x1'),_0xd503('0x2'),_0xd503('0x3')];function createListener(_0x58ea37,_0x10e0a5){return function(_0x4ca480){_0x10e0a5['emit'](_0x58ea37,_0x4ca480);};}function removeListener(_0x3413e0,_0x49140d){return function(){ChatInternalMessageEvents['removeListener'](_0x3413e0,_0x49140d);};}exports['register']=function(_0x3592b3){for(var _0x9ba85d=0x0,_0x4f131d=events[_0xd503('0x4')];_0x9ba85d<_0x4f131d;_0x9ba85d++){var _0x18d7f9=events[_0x9ba85d];var _0x4fad98=createListener('chatInternalMessage:'+_0x18d7f9,_0x3592b3);ChatInternalMessageEvents['on'](_0x18d7f9,_0x4fad98);}}; \ No newline at end of file +var _0x535b=['./chatInternalMessage.events','emit','removeListener','length','chatInternalMessage:'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x535b,0x87));var _0xb535=function(_0x51c4b2,_0x512fff){_0x51c4b2=_0x51c4b2-0x0;var _0x35578f=_0x535b[_0x51c4b2];return _0x35578f;};'use strict';var ChatInternalMessageEvents=require(_0xb535('0x0'));var events=['save','remove','update'];function createListener(_0x357e4b,_0x18fce4){return function(_0x8c1312){_0x18fce4[_0xb535('0x1')](_0x357e4b,_0x8c1312);};}function removeListener(_0x293e30,_0x5647d0){return function(){ChatInternalMessageEvents[_0xb535('0x2')](_0x293e30,_0x5647d0);};}exports['register']=function(_0x5e9b43){for(var _0x4a7608=0x0,_0x556969=events[_0xb535('0x3')];_0x4a7608<_0x556969;_0x4a7608++){var _0x515c92=events[_0x4a7608];var _0x1406b0=createListener(_0xb535('0x4')+_0x515c92,_0x5e9b43);ChatInternalMessageEvents['on'](_0x515c92,_0x1406b0);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 692a194..4f6b1ba 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 _0x7dfa=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','getUsers','show','post'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7dfa,0xa7));var _0xa7df=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x7dfa[_0x3f3f40];return _0x403b7a;};'use strict';var multer=require(_0xa7df('0x0'));var util=require(_0xa7df('0x1'));var path=require(_0xa7df('0x2'));var timeout=require(_0xa7df('0x3'));var express=require(_0xa7df('0x4'));var router=express['Router']();var fs_extra=require(_0xa7df('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa7df('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xa7df('0x7')]('/',auth[_0xa7df('0x8')](),controller[_0xa7df('0x9')]);router[_0xa7df('0x7')]('/describe',auth[_0xa7df('0x8')](),controller['describe']);router['get']('/users',auth[_0xa7df('0x8')](),controller[_0xa7df('0xa')]);router['get']('/:id',auth[_0xa7df('0x8')](),controller[_0xa7df('0xb')]);router[_0xa7df('0xc')]('/',auth['isAuthenticated'](),controller[_0xa7df('0xd')]);router[_0xa7df('0xe')](_0xa7df('0xf'),controller[_0xa7df('0x10')]);router[_0xa7df('0x11')](_0xa7df('0xf'),auth[_0xa7df('0x8')](),controller[_0xa7df('0x12')]);module[_0xa7df('0x13')]=router; \ No newline at end of file +var _0x15ea=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','isAuthenticated','describe','/users','getUsers','/:id','show','create','delete','destroy','exports','multer','util'];(function(_0x1e99d7,_0x18fa1f){var _0x3970bf=function(_0x453284){while(--_0x453284){_0x1e99d7['push'](_0x1e99d7['shift']());}};_0x3970bf(++_0x18fa1f);}(_0x15ea,0xfa));var _0xa15e=function(_0x1393cc,_0x3d0294){_0x1393cc=_0x1393cc-0x0;var _0x4fd93f=_0x15ea[_0x1393cc];return _0x4fd93f;};'use strict';var multer=require(_0xa15e('0x0'));var util=require(_0xa15e('0x1'));var path=require('path');var timeout=require(_0xa15e('0x2'));var express=require('express');var router=express[_0xa15e('0x3')]();var fs_extra=require(_0xa15e('0x4'));var auth=require(_0xa15e('0x5'));var interaction=require(_0xa15e('0x6'));var config=require(_0xa15e('0x7'));var controller=require(_0xa15e('0x8'));router[_0xa15e('0x9')]('/',auth['isAuthenticated'](),controller[_0xa15e('0xa')]);router[_0xa15e('0x9')]('/describe',auth[_0xa15e('0xb')](),controller[_0xa15e('0xc')]);router['get'](_0xa15e('0xd'),auth['isAuthenticated'](),controller[_0xa15e('0xe')]);router[_0xa15e('0x9')](_0xa15e('0xf'),auth['isAuthenticated'](),controller[_0xa15e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa15e('0x11')]);router['put'](_0xa15e('0xf'),controller['update']);router[_0xa15e('0x12')](_0xa15e('0xf'),auth[_0xa15e('0xb')](),controller[_0xa15e('0x13')]);module[_0xa15e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c450ece..b81faea 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 _0x1c3d=['TEXT','medium','BOOLEAN','out','DATE','STRING','exports'];(function(_0x42152d,_0x27738d){var _0x7c79a5=function(_0xe78d9e){while(--_0xe78d9e){_0x42152d['push'](_0x42152d['shift']());}};_0x7c79a5(++_0x27738d);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x43c341,_0x4aa2ca){_0x43c341=_0x43c341-0x0;var _0xf8e420=_0x1c3d[_0x43c341];return _0xf8e420;};'use strict';var Sequelize=require('sequelize');module[_0xd1c3('0x0')]={'body':{'type':Sequelize[_0xd1c3('0x1')](_0xd1c3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd1c3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xd1c3('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd1c3('0x5')]},'providerName':{'type':Sequelize[_0xd1c3('0x6')]},'providerResponse':{'type':Sequelize[_0xd1c3('0x1')]}}; \ No newline at end of file +var _0xfd7b=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x58e5de,_0x2c3cda){var _0x9cac27=function(_0x496095){while(--_0x496095){_0x58e5de['push'](_0x58e5de['shift']());}};_0x9cac27(++_0x2c3cda);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xfd7b[_0x4953da];return _0x2d3780;};'use strict';var Sequelize=require(_0xbfd7('0x0'));module[_0xbfd7('0x1')]={'body':{'type':Sequelize[_0xbfd7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfd7('0x4')]('in','out'),'defaultValue':_0xbfd7('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbfd7('0x6')]},'providerName':{'type':Sequelize[_0xbfd7('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 912b21f..66616a5 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 _0x9cc4=['interface','channel','motionChannel','event','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','email','SIP/%s','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','ChatInteraction','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual'];(function(_0x3eedaf,_0x60001){var _0x123065=function(_0x2f0bc8){while(--_0x2f0bc8){_0x3eedaf['push'](_0x3eedaf['shift']());}};_0x123065(++_0x60001);}(_0x9cc4,0x1b4));var _0x49cc=function(_0x188a8c,_0x4b4ed0){_0x188a8c=_0x188a8c-0x0;var _0x5242af=_0x9cc4[_0x188a8c];return _0x5242af;};'use strict';var emlformat=require(_0x49cc('0x0'));var rimraf=require(_0x49cc('0x1'));var zipdir=require(_0x49cc('0x2'));var jsonpatch=require(_0x49cc('0x3'));var rp=require(_0x49cc('0x4'));var moment=require(_0x49cc('0x5'));var BPromise=require(_0x49cc('0x6'));var Mustache=require(_0x49cc('0x7'));var util=require(_0x49cc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49cc('0x9'));var ejs=require(_0x49cc('0xa'));var fs=require('fs');var fs_extra=require(_0x49cc('0xb'));var _=require('lodash');var squel=require(_0x49cc('0xc'));var crypto=require(_0x49cc('0xd'));var jsforce=require(_0x49cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x49cc('0x9'));var querystring=require(_0x49cc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x49cc('0x10'));var qs=require(_0x49cc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49cc('0x12'));var logger=require(_0x49cc('0x13'))(_0x49cc('0x14'));var utils=require(_0x49cc('0x15'));var config=require(_0x49cc('0x16'));var licenseUtil=require(_0x49cc('0x17'));var db=require(_0x49cc('0x18'))['db'];config[_0x49cc('0x19')]=_[_0x49cc('0x1a')](config[_0x49cc('0x19')],{'host':_0x49cc('0x1b'),'port':0x18eb});var socket=require(_0x49cc('0x1c'))(new Redis(config[_0x49cc('0x19')]));require('./chatMessage.socket')[_0x49cc('0x1d')](socket);var jayson=require(_0x49cc('0x1e'));var client=jayson[_0x49cc('0x1f')][_0x49cc('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x49cc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x577866,_0x43410a,_0x211205,_0xcca17a){return new BPromise(function(_0x121dbe,_0x47528e){var _0xf98867=_0xcca17a||client;return _0xf98867[_0x49cc('0x21')](_0x577866,_0x211205)['then'](function(_0x4b6a0f){logger[_0x49cc('0x22')](_0x49cc('0x23'),_0x43410a,_0x49cc('0x24'));logger[_0x49cc('0x25')](_0x49cc('0x26'),_0x43410a,_0x49cc('0x24'),JSON['stringify'](_0x4b6a0f));if(_0x4b6a0f[_0x49cc('0x27')]){if(_0x4b6a0f[_0x49cc('0x27')][_0x49cc('0x28')]===0x1f4){logger[_0x49cc('0x27')](_0x49cc('0x23'),_0x43410a,_0x4b6a0f[_0x49cc('0x27')][_0x49cc('0x29')]);return _0x47528e(_0x4b6a0f['error'][_0x49cc('0x29')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x43410a,_0x4b6a0f[_0x49cc('0x27')]['message']);return _0x121dbe(_0x4b6a0f['error'][_0x49cc('0x29')]);}else{logger[_0x49cc('0x22')](_0x49cc('0x23'),_0x43410a,'request\x20sent');_0x121dbe(_0x4b6a0f[_0x49cc('0x2a')][_0x49cc('0x29')]);}})[_0x49cc('0x2b')](function(_0x5a40c7){logger['error']('ChatMessage,\x20%s,\x20%s',_0x43410a,_0x5a40c7);_0x47528e(_0x5a40c7);});});}function respondWithStatusCode(_0x10c85f,_0x15965e){_0x15965e=_0x15965e||0xcc;return function(_0x2f76c0){if(_0x2f76c0){return _0x10c85f['sendStatus'](_0x15965e);}return _0x10c85f['status'](_0x15965e)[_0x49cc('0x2c')]();};}function respondWithResult(_0x36e76c,_0x2024a9){_0x2024a9=_0x2024a9||0xc8;return function(_0x4a44a0){if(_0x4a44a0){return _0x36e76c[_0x49cc('0x2d')](_0x2024a9)[_0x49cc('0x2e')](_0x4a44a0);}};}function respondWithFilteredResult(_0x50054b,_0x4162ec){return function(_0x41a0c0){if(_0x41a0c0){var _0x271216=typeof _0x4162ec[_0x49cc('0x2f')]===_0x49cc('0x30')&&typeof _0x4162ec['limit']===_0x49cc('0x30');var _0x7c067a=_0x41a0c0[_0x49cc('0x31')];var _0x1223e8=_0x271216?0x0:_0x4162ec[_0x49cc('0x2f')];var _0x5d3ee9=_0x271216?_0x41a0c0[_0x49cc('0x31')]:_0x4162ec[_0x49cc('0x2f')]+_0x4162ec[_0x49cc('0x32')];var _0x484da1;if(_0x5d3ee9>=_0x7c067a){_0x5d3ee9=_0x7c067a;_0x484da1=0xc8;}else{_0x484da1=0xce;}_0x50054b['status'](_0x484da1);return _0x50054b['set']('Content-Range',_0x1223e8+'-'+_0x5d3ee9+'/'+_0x7c067a)[_0x49cc('0x2e')](_0x41a0c0);}return null;};}function patchUpdates(_0x7edfc){return function(_0x41c2de){try{jsonpatch[_0x49cc('0x33')](_0x41c2de,_0x7edfc,!![]);}catch(_0x34adec){return BPromise[_0x49cc('0x34')](_0x34adec);}return _0x41c2de[_0x49cc('0x35')]();};}function saveUpdates(_0x5219a4,_0x55465b){return function(_0x598f72){if(_0x598f72){return _0x598f72[_0x49cc('0x36')](_0x5219a4)[_0x49cc('0x37')](function(_0xd3ac61){return _0xd3ac61;});}return null;};}function removeEntity(_0x7e0e7,_0x583b8e){return function(_0x578acb){if(_0x578acb){return _0x578acb[_0x49cc('0x38')]()[_0x49cc('0x37')](function(){_0x7e0e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a0f3,_0x57b04b){return function(_0x398ce4){if(!_0x398ce4){_0x48a0f3[_0x49cc('0x39')](0x194);}return _0x398ce4;};}function handleError(_0x14c111,_0x563697){_0x563697=_0x563697||0x1f4;return function(_0x45135d){logger['error'](_0x45135d[_0x49cc('0x3a')]);if(_0x45135d[_0x49cc('0x3b')]){delete _0x45135d['name'];}_0x14c111['status'](_0x563697)[_0x49cc('0x3c')](_0x45135d);};}exports[_0x49cc('0x3d')]=function(_0x3955b0,_0x1f1ddd){var _0x16027f={},_0x5616e5={},_0x4793ab={'count':0x0,'rows':[]};var _0x472905=_[_0x49cc('0x3e')](db[_0x49cc('0x3f')][_0x49cc('0x40')],function(_0x4e4176){return{'name':_0x4e4176[_0x49cc('0x41')],'type':_0x4e4176[_0x49cc('0x42')]['key']};});_0x5616e5[_0x49cc('0x43')]=_['map'](_0x472905,_0x49cc('0x3b'));_0x5616e5[_0x49cc('0x44')]=_[_0x49cc('0x45')](_0x3955b0[_0x49cc('0x44')]);_0x5616e5[_0x49cc('0x46')]=_[_0x49cc('0x47')](_0x5616e5['model'],_0x5616e5[_0x49cc('0x44')]);_0x16027f[_0x49cc('0x48')]=_['intersection'](_0x5616e5[_0x49cc('0x43')],qs[_0x49cc('0x49')](_0x3955b0[_0x49cc('0x44')][_0x49cc('0x49')]));_0x16027f['attributes']=_0x16027f[_0x49cc('0x48')][_0x49cc('0x4a')]?_0x16027f[_0x49cc('0x48')]:_0x5616e5['model'];if(!_0x3955b0[_0x49cc('0x44')][_0x49cc('0x4b')](_0x49cc('0x4c'))){_0x16027f[_0x49cc('0x32')]=qs[_0x49cc('0x32')](_0x3955b0[_0x49cc('0x44')][_0x49cc('0x32')]);_0x16027f[_0x49cc('0x2f')]=qs[_0x49cc('0x2f')](_0x3955b0[_0x49cc('0x44')][_0x49cc('0x2f')]);}_0x16027f[_0x49cc('0x4d')]=qs['sort'](_0x3955b0[_0x49cc('0x44')][_0x49cc('0x4e')]);_0x16027f[_0x49cc('0x4f')]=qs[_0x49cc('0x46')](_[_0x49cc('0x50')](_0x3955b0['query'],_0x5616e5[_0x49cc('0x46')]),_0x472905);if(_0x3955b0['query'][_0x49cc('0x51')]){_0x16027f[_0x49cc('0x4f')]=_[_0x49cc('0x52')](_0x16027f[_0x49cc('0x4f')],{'$or':_[_0x49cc('0x3e')](_0x472905,function(_0x53f7ba){if(_0x53f7ba[_0x49cc('0x42')]!==_0x49cc('0x53')){var _0x5b5fdf={};_0x5b5fdf[_0x53f7ba['name']]={'$like':'%'+_0x3955b0['query'][_0x49cc('0x51')]+'%'};return _0x5b5fdf;}})});}_0x16027f=_[_0x49cc('0x52')]({},_0x16027f,_0x3955b0[_0x49cc('0x54')]);var _0x5b9670={'where':_0x16027f[_0x49cc('0x4f')]};return db[_0x49cc('0x3f')]['count'](_0x5b9670)[_0x49cc('0x37')](function(_0x241c5f){_0x4793ab[_0x49cc('0x31')]=_0x241c5f;if(_0x3955b0[_0x49cc('0x44')][_0x49cc('0x55')]){_0x16027f[_0x49cc('0x56')]=[{'all':!![]}];}return db[_0x49cc('0x3f')][_0x49cc('0x57')](_0x16027f);})[_0x49cc('0x37')](function(_0x239935){_0x4793ab[_0x49cc('0x58')]=_0x239935;return _0x4793ab;})[_0x49cc('0x37')](respondWithFilteredResult(_0x1f1ddd,_0x16027f))['catch'](handleError(_0x1f1ddd,null));};exports[_0x49cc('0x59')]=function(_0x26b1f1,_0x44faab){var _0x286b24={'raw':!![],'where':{'id':_0x26b1f1[_0x49cc('0x5a')]['id']}},_0x54ed68={};_0x54ed68[_0x49cc('0x43')]=_[_0x49cc('0x45')](db[_0x49cc('0x3f')][_0x49cc('0x40')]);_0x54ed68['query']=_[_0x49cc('0x45')](_0x26b1f1[_0x49cc('0x44')]);_0x54ed68['filters']=_[_0x49cc('0x47')](_0x54ed68['model'],_0x54ed68[_0x49cc('0x44')]);_0x286b24[_0x49cc('0x48')]=_[_0x49cc('0x47')](_0x54ed68[_0x49cc('0x43')],qs[_0x49cc('0x49')](_0x26b1f1[_0x49cc('0x44')][_0x49cc('0x49')]));_0x286b24['attributes']=_0x286b24[_0x49cc('0x48')][_0x49cc('0x4a')]?_0x286b24['attributes']:_0x54ed68['model'];if(_0x26b1f1[_0x49cc('0x44')]['includeAll']){_0x286b24[_0x49cc('0x56')]=[{'all':!![]}];}_0x286b24=_['merge']({},_0x286b24,_0x26b1f1[_0x49cc('0x54')]);return db[_0x49cc('0x3f')]['find'](_0x286b24)[_0x49cc('0x37')](handleEntityNotFound(_0x44faab,null))['then'](respondWithResult(_0x44faab,null))[_0x49cc('0x2b')](handleError(_0x44faab,null));};exports[_0x49cc('0x5b')]=function(_0x1067fd,_0x464c08){return db[_0x49cc('0x3f')][_0x49cc('0x5b')](_0x1067fd[_0x49cc('0x5c')],{})[_0x49cc('0x37')](respondWithResult(_0x464c08,0xc9))['catch'](handleError(_0x464c08,null));};exports[_0x49cc('0x36')]=function(_0x15e74f,_0x378791){if(_0x15e74f[_0x49cc('0x5c')]['id']){delete _0x15e74f[_0x49cc('0x5c')]['id'];}return db[_0x49cc('0x3f')][_0x49cc('0x5d')]({'where':{'id':_0x15e74f[_0x49cc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x378791,null))[_0x49cc('0x37')](saveUpdates(_0x15e74f[_0x49cc('0x5c')],null))[_0x49cc('0x37')](respondWithResult(_0x378791,null))['catch'](handleError(_0x378791,null));};exports[_0x49cc('0x38')]=function(_0x1fd2e5,_0x3d9a12){return db[_0x49cc('0x3f')][_0x49cc('0x5d')]({'where':{'id':_0x1fd2e5[_0x49cc('0x5a')]['id']}})[_0x49cc('0x37')](handleEntityNotFound(_0x3d9a12,null))[_0x49cc('0x37')](removeEntity(_0x3d9a12,null))['catch'](handleError(_0x3d9a12,null));};exports[_0x49cc('0x5e')]=function(_0x2d5111,_0x1d9e76){return db[_0x49cc('0x3f')][_0x49cc('0x5e')]()['then'](respondWithResult(_0x1d9e76,null))['catch'](handleError(_0x1d9e76,null));};var interaction_log=require(_0x49cc('0x13'))(_0x49cc('0x5f'));exports[_0x49cc('0x60')]=function(_0x27144a,_0x36dc2a,_0x3fde5c){var _0x514c2b={'agent':{},'channel':_0x49cc('0x61')};if(_0x27144a['body']['id']){delete _0x27144a['body']['id'];}_0x27144a[_0x49cc('0x5c')][_0x49cc('0x62')]=!![];_0x27144a[_0x49cc('0x5c')][_0x49cc('0x63')]=moment()[_0x49cc('0x64')](_0x49cc('0x65'));_0x27144a['body'][_0x49cc('0x66')]=_0x27144a[_0x49cc('0x5c')][_0x49cc('0x66')]||_0x27144a['user']['id'];_0x514c2b[_0x49cc('0x67')]['id']=_0x27144a[_0x49cc('0x5c')]['UserId'];return db['ChatMessage'][_0x49cc('0x5d')]({'where':{'id':_0x27144a['params']['id'],'UserId':null}})[_0x49cc('0x37')](handleEntityNotFound(_0x36dc2a,null))[_0x49cc('0x37')](saveUpdates(_0x27144a['body'],null))[_0x49cc('0x37')](function(_0x4e0a06){if(_0x4e0a06){_0x514c2b[_0x49cc('0x29')]=_0x4e0a06['get']({'plain':!![]});return db[_0x49cc('0x68')][_0x49cc('0x5d')]({'where':{'id':_0x4e0a06['ChatInteractionId']}});}return null;})[_0x49cc('0x37')](handleEntityNotFound(_0x36dc2a,null))[_0x49cc('0x37')](function(_0x2c6329){if(_0x2c6329){return _0x2c6329[_0x49cc('0x36')]({'UserId':_0x27144a[_0x49cc('0x5c')]['UserId'],'read1stAt':_[_0x49cc('0x69')](_0x2c6329[_0x49cc('0x6a')])?moment()[_0x49cc('0x64')](_0x49cc('0x65')):undefined});}return null;})[_0x49cc('0x37')](function(_0x4d6f12){if(_0x4d6f12){_0x514c2b[_0x49cc('0x6b')]=_0x4d6f12[_0x49cc('0x6c')]({'plain':!![]});interaction_log[_0x49cc('0x22')](_0x49cc('0x6d'),_0x27144a[_0x49cc('0x6e')]['id'],_0x27144a[_0x49cc('0x6e')][_0x49cc('0x3b')],_0x27144a['user'][_0x49cc('0x6f')],_0x514c2b['interaction']['id'],_0x27144a[_0x49cc('0x5c')]?JSON[_0x49cc('0x70')](_0x27144a[_0x49cc('0x5c')]):_0x49cc('0x71'));return respondWithRpcPromise(_0x49cc('0x72'),_0x49cc('0x73'),_0x514c2b);}return null;})[_0x49cc('0x37')](function(_0x2c71d1){var _0x4ab23a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c71d1[_0x49cc('0x29')][_0x49cc('0x74')];return db['sequelize'][_0x49cc('0x44')](_0x4ab23a,{'type':db[_0x49cc('0x75')][_0x49cc('0x76')][_0x49cc('0x77')],'raw':!![]})[_0x49cc('0x37')](function(_0x2c86ef){return _0x2c86ef;});})['then'](function(_0xf851ab){if(_0xf851ab){_0x514c2b['message'][_0x49cc('0x78')]=_0xf851ab[0x0];if(!_0x27144a[_0x49cc('0x5c')][_0x49cc('0x66')])return;return db['User'][_0x49cc('0x5d')]({'where':{'id':_0x27144a[_0x49cc('0x5c')][_0x49cc('0x66')],'role':_0x49cc('0x67')},'attributes':['id',_0x49cc('0x3b'),_0x49cc('0x79'),'email',_0x49cc('0x7a')],'raw':!![]});}return null;})[_0x49cc('0x37')](function(_0x1d407b){if(!_0x1d407b)return null;_0x514c2b[_0x49cc('0x29')][_0x49cc('0x67')]=_0x1d407b;return _0x514c2b;})[_0x49cc('0x37')](function(_0x313a6e){if(_0x313a6e){if(_0x27144a[_0x49cc('0x5c')][_0x49cc('0x7b')]){_0x514c2b[_0x49cc('0x29')][_0x49cc('0x7c')]=util[_0x49cc('0x64')]('SIP/%s',_0x27144a[_0x49cc('0x6e')]['name']);_0x514c2b['message']['channel']=_0x514c2b[_0x49cc('0x7d')];_0x514c2b[_0x49cc('0x29')][_0x49cc('0x7e')]=_0x514c2b[_0x49cc('0x7d')];_0x514c2b[_0x49cc('0x29')][_0x49cc('0x7f')]=_0x49cc('0x60');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0x49cc('0x52')](_0x514c2b['message'],JSON[_0x49cc('0x80')](_0x514c2b[_0x49cc('0x6b')][_0x49cc('0x81')]))},client9002)[_0x49cc('0x37')](function(){return _0x514c2b;});}return _0x514c2b;}return null;})[_0x49cc('0x37')](respondWithResult(_0x36dc2a,null))[_0x49cc('0x2b')](handleError(_0x36dc2a,null));};var interaction_log=require('../../config/logger')(_0x49cc('0x5f'));exports[_0x49cc('0x34')]=function(_0x293fe2,_0x5b61d6,_0x4c8e5e){var _0x43eb79={'agent':{},'channel':_0x49cc('0x61')};if(_0x293fe2[_0x49cc('0x5c')]['id']){delete _0x293fe2[_0x49cc('0x5c')]['id'];}_0x293fe2[_0x49cc('0x5c')][_0x49cc('0x66')]=_0x293fe2['body']['UserId']||_0x293fe2['user']['id'];_0x43eb79[_0x49cc('0x67')]['id']=_0x293fe2['body'][_0x49cc('0x66')];return db[_0x49cc('0x3f')][_0x49cc('0x5d')]({'where':{'id':_0x293fe2['params']['id'],'UserId':null}})[_0x49cc('0x37')](handleEntityNotFound(_0x5b61d6,null))[_0x49cc('0x37')](function(_0x5377d9){if(_0x5377d9){_0x43eb79['message']=_0x5377d9[_0x49cc('0x6c')]({'plain':!![]});return db[_0x49cc('0x68')]['find']({'where':{'id':_0x5377d9[_0x49cc('0x82')]}});}return null;})[_0x49cc('0x37')](handleEntityNotFound(_0x5b61d6,null))[_0x49cc('0x37')](function(_0x5dda2b){if(_0x5dda2b){_0x43eb79[_0x49cc('0x6b')]=_0x5dda2b[_0x49cc('0x6c')]({'plain':!![]});interaction_log[_0x49cc('0x22')](_0x49cc('0x83'),_0x293fe2[_0x49cc('0x6e')]['id'],_0x293fe2[_0x49cc('0x6e')][_0x49cc('0x3b')],_0x293fe2[_0x49cc('0x6e')]['role'],_0x43eb79[_0x49cc('0x6b')]['id'],_0x293fe2[_0x49cc('0x5c')]?JSON[_0x49cc('0x70')](_0x293fe2[_0x49cc('0x5c')]):_0x49cc('0x71'));return respondWithRpcPromise(_0x49cc('0x84'),_0x49cc('0x85'),_0x43eb79);}return null;})[_0x49cc('0x37')](function(_0x28961b){var _0x1daf19='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28961b[_0x49cc('0x29')][_0x49cc('0x74')];return db[_0x49cc('0x86')][_0x49cc('0x44')](_0x1daf19,{'type':db[_0x49cc('0x75')][_0x49cc('0x76')][_0x49cc('0x77')],'raw':!![]})[_0x49cc('0x37')](function(_0x3099df){return _0x3099df;});})[_0x49cc('0x37')](function(_0x38b231){if(_0x38b231){_0x43eb79['message']['contact']=_0x38b231[0x0];if(!_0x293fe2[_0x49cc('0x5c')][_0x49cc('0x66')])return;return db[_0x49cc('0x87')][_0x49cc('0x5d')]({'where':{'id':_0x293fe2[_0x49cc('0x5c')][_0x49cc('0x66')],'role':'agent'},'attributes':['id','name','fullname',_0x49cc('0x88'),_0x49cc('0x7a')],'raw':!![]});}return null;})[_0x49cc('0x37')](function(_0x4bc2eb){if(!_0x4bc2eb)return null;_0x43eb79[_0x49cc('0x29')][_0x49cc('0x67')]=_0x4bc2eb;return _0x43eb79;})[_0x49cc('0x37')](function(_0x535b76){if(_0x535b76){_0x535b76['message'][_0x49cc('0x7c')]=util[_0x49cc('0x64')](_0x49cc('0x89'),_0x293fe2[_0x49cc('0x6e')]['name']);_0x535b76[_0x49cc('0x29')]['channel']=_0x43eb79['channel'];_0x535b76[_0x49cc('0x29')][_0x49cc('0x7e')]=_0x43eb79[_0x49cc('0x7d')];_0x535b76['message']['event']=_0x49cc('0x34');respondWithRpcPromise(_0x49cc('0x8a'),_0x49cc('0x8a'),{'event':_0x49cc('0x8b'),'message':_[_0x49cc('0x52')](_0x43eb79[_0x49cc('0x29')],JSON[_0x49cc('0x80')](_0x43eb79[_0x49cc('0x6b')][_0x49cc('0x81')]))},client9002);return _0x43eb79;}return null;})[_0x49cc('0x37')](respondWithResult(_0x5b61d6,null))['catch'](handleError(_0x5b61d6,null));}; \ No newline at end of file +var _0x38fd=['util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','ChatMessage','includeAll','include','rows','show','intersection','find','create','body','params','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x37e23b,_0x9a5f01){var _0x3f1e87=function(_0x15c85e){while(--_0x15c85e){_0x37e23b['push'](_0x37e23b['shift']());}};_0x3f1e87(++_0x9a5f01);}(_0x38fd,0x7e));var _0xd38f=function(_0x5801d8,_0x4ecd3a){_0x5801d8=_0x5801d8-0x0;var _0xb03bfa=_0x38fd[_0x5801d8];return _0xb03bfa;};'use strict';var emlformat=require(_0xd38f('0x0'));var rimraf=require(_0xd38f('0x1'));var zipdir=require(_0xd38f('0x2'));var jsonpatch=require(_0xd38f('0x3'));var rp=require(_0xd38f('0x4'));var moment=require(_0xd38f('0x5'));var BPromise=require(_0xd38f('0x6'));var Mustache=require(_0xd38f('0x7'));var util=require(_0xd38f('0x8'));var path=require(_0xd38f('0x9'));var sox=require(_0xd38f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd38f('0xb'));var _=require('lodash');var squel=require(_0xd38f('0xc'));var crypto=require(_0xd38f('0xd'));var jsforce=require(_0xd38f('0xe'));var deskjs=require(_0xd38f('0xf'));var toCsv=require(_0xd38f('0x10'));var querystring=require('querystring');var Papa=require(_0xd38f('0x11'));var Redis=require('ioredis');var authService=require(_0xd38f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd38f('0x13'));var hardwareService=require(_0xd38f('0x14'));var logger=require(_0xd38f('0x15'))(_0xd38f('0x16'));var utils=require('../../config/utils');var config=require(_0xd38f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd38f('0x18'))['db'];config[_0xd38f('0x19')]=_[_0xd38f('0x1a')](config[_0xd38f('0x19')],{'host':_0xd38f('0x1b'),'port':0x18eb});var socket=require(_0xd38f('0x1c'))(new Redis(config[_0xd38f('0x19')]));require(_0xd38f('0x1d'))['register'](socket);var jayson=require(_0xd38f('0x1e'));var client=jayson['client'][_0xd38f('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd38f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f88,_0x555fc5,_0x47caa0,_0x19fdfb){return new BPromise(function(_0x26b154,_0x5a8cbb){var _0x3b2b65=_0x19fdfb||client;return _0x3b2b65[_0xd38f('0x20')](_0x4b1f88,_0x47caa0)[_0xd38f('0x21')](function(_0x49ac34){logger[_0xd38f('0x22')](_0xd38f('0x23'),_0x555fc5,_0xd38f('0x24'));logger[_0xd38f('0x25')](_0xd38f('0x26'),_0x555fc5,_0xd38f('0x24'),JSON['stringify'](_0x49ac34));if(_0x49ac34['error']){if(_0x49ac34[_0xd38f('0x27')][_0xd38f('0x28')]===0x1f4){logger[_0xd38f('0x27')](_0xd38f('0x23'),_0x555fc5,_0x49ac34['error'][_0xd38f('0x29')]);return _0x5a8cbb(_0x49ac34[_0xd38f('0x27')][_0xd38f('0x29')]);}logger[_0xd38f('0x27')](_0xd38f('0x23'),_0x555fc5,_0x49ac34[_0xd38f('0x27')][_0xd38f('0x29')]);return _0x26b154(_0x49ac34[_0xd38f('0x27')]['message']);}else{logger[_0xd38f('0x22')](_0xd38f('0x23'),_0x555fc5,_0xd38f('0x24'));_0x26b154(_0x49ac34[_0xd38f('0x2a')][_0xd38f('0x29')]);}})[_0xd38f('0x2b')](function(_0x3aae32){logger[_0xd38f('0x27')](_0xd38f('0x23'),_0x555fc5,_0x3aae32);_0x5a8cbb(_0x3aae32);});});}function respondWithStatusCode(_0x2f2347,_0x3fc1bd){_0x3fc1bd=_0x3fc1bd||0xcc;return function(_0x118e5e){if(_0x118e5e){return _0x2f2347[_0xd38f('0x2c')](_0x3fc1bd);}return _0x2f2347[_0xd38f('0x2d')](_0x3fc1bd)[_0xd38f('0x2e')]();};}function respondWithResult(_0x57b69d,_0x59b646){_0x59b646=_0x59b646||0xc8;return function(_0x284254){if(_0x284254){return _0x57b69d[_0xd38f('0x2d')](_0x59b646)['json'](_0x284254);}};}function respondWithFilteredResult(_0x2eae13,_0x1eb358){return function(_0xc3ec69){if(_0xc3ec69){var _0x53f7b1=typeof _0x1eb358[_0xd38f('0x2f')]==='undefined'&&typeof _0x1eb358[_0xd38f('0x30')]===_0xd38f('0x31');var _0xb49d3c=_0xc3ec69[_0xd38f('0x32')];var _0x3bcf5e=_0x53f7b1?0x0:_0x1eb358[_0xd38f('0x2f')];var _0x4d585a=_0x53f7b1?_0xc3ec69[_0xd38f('0x32')]:_0x1eb358[_0xd38f('0x2f')]+_0x1eb358[_0xd38f('0x30')];var _0x4fbc1c;if(_0x4d585a>=_0xb49d3c){_0x4d585a=_0xb49d3c;_0x4fbc1c=0xc8;}else{_0x4fbc1c=0xce;}_0x2eae13[_0xd38f('0x2d')](_0x4fbc1c);return _0x2eae13[_0xd38f('0x33')](_0xd38f('0x34'),_0x3bcf5e+'-'+_0x4d585a+'/'+_0xb49d3c)['json'](_0xc3ec69);}return null;};}function patchUpdates(_0x5cb82b){return function(_0xcc57c9){try{jsonpatch['apply'](_0xcc57c9,_0x5cb82b,!![]);}catch(_0x174a75){return BPromise[_0xd38f('0x35')](_0x174a75);}return _0xcc57c9[_0xd38f('0x36')]();};}function saveUpdates(_0x14a557,_0x487e0b){return function(_0x2fe457){if(_0x2fe457){return _0x2fe457[_0xd38f('0x37')](_0x14a557)['then'](function(_0x617ac0){return _0x617ac0;});}return null;};}function removeEntity(_0x4e5659,_0x37aa10){return function(_0x5ed714){if(_0x5ed714){return _0x5ed714[_0xd38f('0x38')]()[_0xd38f('0x21')](function(){_0x4e5659[_0xd38f('0x2d')](0xcc)[_0xd38f('0x2e')]();});}};}function handleEntityNotFound(_0x3cdcdd,_0x54f207){return function(_0x27aa7f){if(!_0x27aa7f){_0x3cdcdd[_0xd38f('0x2c')](0x194);}return _0x27aa7f;};}function handleError(_0x4fb4c5,_0x6e5b13){_0x6e5b13=_0x6e5b13||0x1f4;return function(_0x5e8e91){logger[_0xd38f('0x27')](_0x5e8e91['stack']);if(_0x5e8e91[_0xd38f('0x39')]){delete _0x5e8e91[_0xd38f('0x39')];}_0x4fb4c5['status'](_0x6e5b13)[_0xd38f('0x3a')](_0x5e8e91);};}exports[_0xd38f('0x3b')]=function(_0x44bb52,_0x1f042a){var _0x4ca695={},_0x442976={},_0x436d84={'count':0x0,'rows':[]};var _0xbe7c4b=_[_0xd38f('0x3c')](db['ChatMessage'][_0xd38f('0x3d')],function(_0x5672dc){return{'name':_0x5672dc[_0xd38f('0x3e')],'type':_0x5672dc[_0xd38f('0x3f')][_0xd38f('0x40')]};});_0x442976[_0xd38f('0x41')]=_[_0xd38f('0x3c')](_0xbe7c4b,_0xd38f('0x39'));_0x442976[_0xd38f('0x42')]=_[_0xd38f('0x43')](_0x44bb52[_0xd38f('0x42')]);_0x442976['filters']=_['intersection'](_0x442976[_0xd38f('0x41')],_0x442976[_0xd38f('0x42')]);_0x4ca695[_0xd38f('0x44')]=_['intersection'](_0x442976['model'],qs[_0xd38f('0x45')](_0x44bb52[_0xd38f('0x42')][_0xd38f('0x45')]));_0x4ca695[_0xd38f('0x44')]=_0x4ca695[_0xd38f('0x44')][_0xd38f('0x46')]?_0x4ca695[_0xd38f('0x44')]:_0x442976[_0xd38f('0x41')];if(!_0x44bb52['query']['hasOwnProperty'](_0xd38f('0x47'))){_0x4ca695[_0xd38f('0x30')]=qs[_0xd38f('0x30')](_0x44bb52[_0xd38f('0x42')]['limit']);_0x4ca695[_0xd38f('0x2f')]=qs['offset'](_0x44bb52[_0xd38f('0x42')][_0xd38f('0x2f')]);}_0x4ca695[_0xd38f('0x48')]=qs[_0xd38f('0x49')](_0x44bb52[_0xd38f('0x42')][_0xd38f('0x49')]);_0x4ca695[_0xd38f('0x4a')]=qs['filters'](_['pick'](_0x44bb52[_0xd38f('0x42')],_0x442976['filters']),_0xbe7c4b);if(_0x44bb52[_0xd38f('0x42')][_0xd38f('0x4b')]){_0x4ca695['where']=_['merge'](_0x4ca695['where'],{'$or':_['map'](_0xbe7c4b,function(_0x58151b){if(_0x58151b['type']!==_0xd38f('0x4c')){var _0x566b6b={};_0x566b6b[_0x58151b[_0xd38f('0x39')]]={'$like':'%'+_0x44bb52[_0xd38f('0x42')][_0xd38f('0x4b')]+'%'};return _0x566b6b;}})});}_0x4ca695=_[_0xd38f('0x4d')]({},_0x4ca695,_0x44bb52[_0xd38f('0x4e')]);var _0x2b25e3={'where':_0x4ca695[_0xd38f('0x4a')]};return db[_0xd38f('0x4f')][_0xd38f('0x32')](_0x2b25e3)[_0xd38f('0x21')](function(_0x2e9f2a){_0x436d84[_0xd38f('0x32')]=_0x2e9f2a;if(_0x44bb52[_0xd38f('0x42')][_0xd38f('0x50')]){_0x4ca695[_0xd38f('0x51')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4ca695);})['then'](function(_0x935881){_0x436d84[_0xd38f('0x52')]=_0x935881;return _0x436d84;})[_0xd38f('0x21')](respondWithFilteredResult(_0x1f042a,_0x4ca695))[_0xd38f('0x2b')](handleError(_0x1f042a,null));};exports[_0xd38f('0x53')]=function(_0x5c8503,_0x38dcb6){var _0x1d9bde={'raw':!![],'where':{'id':_0x5c8503['params']['id']}},_0x3a88d7={};_0x3a88d7['model']=_[_0xd38f('0x43')](db[_0xd38f('0x4f')][_0xd38f('0x3d')]);_0x3a88d7[_0xd38f('0x42')]=_[_0xd38f('0x43')](_0x5c8503[_0xd38f('0x42')]);_0x3a88d7['filters']=_[_0xd38f('0x54')](_0x3a88d7[_0xd38f('0x41')],_0x3a88d7[_0xd38f('0x42')]);_0x1d9bde[_0xd38f('0x44')]=_[_0xd38f('0x54')](_0x3a88d7['model'],qs[_0xd38f('0x45')](_0x5c8503[_0xd38f('0x42')][_0xd38f('0x45')]));_0x1d9bde[_0xd38f('0x44')]=_0x1d9bde[_0xd38f('0x44')][_0xd38f('0x46')]?_0x1d9bde[_0xd38f('0x44')]:_0x3a88d7[_0xd38f('0x41')];if(_0x5c8503['query'][_0xd38f('0x50')]){_0x1d9bde[_0xd38f('0x51')]=[{'all':!![]}];}_0x1d9bde=_['merge']({},_0x1d9bde,_0x5c8503[_0xd38f('0x4e')]);return db[_0xd38f('0x4f')][_0xd38f('0x55')](_0x1d9bde)['then'](handleEntityNotFound(_0x38dcb6,null))[_0xd38f('0x21')](respondWithResult(_0x38dcb6,null))[_0xd38f('0x2b')](handleError(_0x38dcb6,null));};exports[_0xd38f('0x56')]=function(_0x5d1c52,_0x412bca){return db[_0xd38f('0x4f')]['create'](_0x5d1c52[_0xd38f('0x57')],{})[_0xd38f('0x21')](respondWithResult(_0x412bca,0xc9))[_0xd38f('0x2b')](handleError(_0x412bca,null));};exports[_0xd38f('0x37')]=function(_0x5d901e,_0xf36ccc){if(_0x5d901e[_0xd38f('0x57')]['id']){delete _0x5d901e[_0xd38f('0x57')]['id'];}return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x5d901e[_0xd38f('0x58')]['id']}})['then'](handleEntityNotFound(_0xf36ccc,null))['then'](saveUpdates(_0x5d901e[_0xd38f('0x57')],null))['then'](respondWithResult(_0xf36ccc,null))[_0xd38f('0x2b')](handleError(_0xf36ccc,null));};exports[_0xd38f('0x38')]=function(_0x1c5309,_0x38794b){return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x1c5309[_0xd38f('0x58')]['id']}})[_0xd38f('0x21')](handleEntityNotFound(_0x38794b,null))[_0xd38f('0x21')](removeEntity(_0x38794b,null))[_0xd38f('0x2b')](handleError(_0x38794b,null));};exports['describe']=function(_0xd2f302,_0x26d777){return db['ChatMessage'][_0xd38f('0x59')]()['then'](respondWithResult(_0x26d777,null))['catch'](handleError(_0x26d777,null));};var interaction_log=require(_0xd38f('0x15'))(_0xd38f('0x5a'));exports[_0xd38f('0x5b')]=function(_0x5ec94b,_0x4462a9,_0x31c69e){var _0x38dbec={'agent':{},'channel':_0xd38f('0x5c')};if(_0x5ec94b[_0xd38f('0x57')]['id']){delete _0x5ec94b[_0xd38f('0x57')]['id'];}_0x5ec94b['body'][_0xd38f('0x5d')]=!![];_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x5e')]=moment()[_0xd38f('0x5f')](_0xd38f('0x60'));_0x5ec94b['body'][_0xd38f('0x61')]=_0x5ec94b[_0xd38f('0x57')]['UserId']||_0x5ec94b[_0xd38f('0x62')]['id'];_0x38dbec['agent']['id']=_0x5ec94b['body'][_0xd38f('0x61')];return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x5ec94b[_0xd38f('0x58')]['id'],'UserId':null}})[_0xd38f('0x21')](handleEntityNotFound(_0x4462a9,null))[_0xd38f('0x21')](saveUpdates(_0x5ec94b[_0xd38f('0x57')],null))['then'](function(_0x421d9e){if(_0x421d9e){_0x38dbec[_0xd38f('0x29')]=_0x421d9e[_0xd38f('0x63')]({'plain':!![]});return db[_0xd38f('0x64')][_0xd38f('0x55')]({'where':{'id':_0x421d9e[_0xd38f('0x65')]}});}return null;})[_0xd38f('0x21')](handleEntityNotFound(_0x4462a9,null))[_0xd38f('0x21')](function(_0x319e56){if(_0x319e56){return _0x319e56[_0xd38f('0x37')]({'UserId':_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x61')],'read1stAt':_[_0xd38f('0x66')](_0x319e56[_0xd38f('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd38f('0x21')](function(_0x43f49a){if(_0x43f49a){_0x38dbec[_0xd38f('0x68')]=_0x43f49a[_0xd38f('0x63')]({'plain':!![]});interaction_log[_0xd38f('0x22')](_0xd38f('0x69'),_0x5ec94b[_0xd38f('0x62')]['id'],_0x5ec94b[_0xd38f('0x62')]['name'],_0x5ec94b[_0xd38f('0x62')][_0xd38f('0x6a')],_0x38dbec[_0xd38f('0x68')]['id'],_0x5ec94b[_0xd38f('0x57')]?JSON[_0xd38f('0x6b')](_0x5ec94b[_0xd38f('0x57')]):_0xd38f('0x6c'));return respondWithRpcPromise(_0xd38f('0x6d'),_0xd38f('0x6e'),_0x38dbec);}return null;})['then'](function(_0x4dd755){var _0x474999=_0xd38f('0x6f')+_0x4dd755[_0xd38f('0x29')][_0xd38f('0x70')];return db[_0xd38f('0x71')][_0xd38f('0x42')](_0x474999,{'type':db[_0xd38f('0x72')][_0xd38f('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x385506){return _0x385506;});})[_0xd38f('0x21')](function(_0x2647e8){if(_0x2647e8){_0x38dbec[_0xd38f('0x29')][_0xd38f('0x74')]=_0x2647e8[0x0];if(!_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x61')])return;return db[_0xd38f('0x75')][_0xd38f('0x55')]({'where':{'id':_0x5ec94b[_0xd38f('0x57')][_0xd38f('0x61')],'role':_0xd38f('0x76')},'attributes':['id',_0xd38f('0x39'),'fullname',_0xd38f('0x77'),_0xd38f('0x78')],'raw':!![]});}return null;})[_0xd38f('0x21')](function(_0x491535){if(!_0x491535)return null;_0x38dbec[_0xd38f('0x29')][_0xd38f('0x76')]=_0x491535;return _0x38dbec;})[_0xd38f('0x21')](function(_0x25cf48){if(_0x25cf48){if(_0x5ec94b[_0xd38f('0x57')]['manual']){_0x38dbec[_0xd38f('0x29')][_0xd38f('0x79')]=util[_0xd38f('0x5f')](_0xd38f('0x7a'),_0x5ec94b[_0xd38f('0x62')][_0xd38f('0x39')]);_0x38dbec['message'][_0xd38f('0x7b')]=_0x38dbec[_0xd38f('0x7b')];_0x38dbec[_0xd38f('0x29')][_0xd38f('0x7c')]=_0x38dbec[_0xd38f('0x7b')];_0x38dbec[_0xd38f('0x29')][_0xd38f('0x7d')]=_0xd38f('0x5b');return respondWithRpcPromise(_0xd38f('0x7e'),_0xd38f('0x7e'),{'event':_0xd38f('0x7f'),'message':_[_0xd38f('0x4d')](_0x38dbec[_0xd38f('0x29')],JSON['parse'](_0x38dbec[_0xd38f('0x68')]['formData']))},client9002)['then'](function(){return _0x38dbec;});}return _0x38dbec;}return null;})[_0xd38f('0x21')](respondWithResult(_0x4462a9,null))[_0xd38f('0x2b')](handleError(_0x4462a9,null));};var interaction_log=require(_0xd38f('0x15'))(_0xd38f('0x5a'));exports[_0xd38f('0x35')]=function(_0x30e758,_0x471d13,_0x22f25b){var _0x27aa01={'agent':{},'channel':'chat'};if(_0x30e758[_0xd38f('0x57')]['id']){delete _0x30e758[_0xd38f('0x57')]['id'];}_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')]=_0x30e758['body']['UserId']||_0x30e758[_0xd38f('0x62')]['id'];_0x27aa01['agent']['id']=_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')];return db[_0xd38f('0x4f')][_0xd38f('0x55')]({'where':{'id':_0x30e758[_0xd38f('0x58')]['id'],'UserId':null}})[_0xd38f('0x21')](handleEntityNotFound(_0x471d13,null))[_0xd38f('0x21')](function(_0x534b93){if(_0x534b93){_0x27aa01[_0xd38f('0x29')]=_0x534b93[_0xd38f('0x63')]({'plain':!![]});return db[_0xd38f('0x64')]['find']({'where':{'id':_0x534b93[_0xd38f('0x65')]}});}return null;})[_0xd38f('0x21')](handleEntityNotFound(_0x471d13,null))['then'](function(_0x35af27){if(_0x35af27){_0x27aa01[_0xd38f('0x68')]=_0x35af27[_0xd38f('0x63')]({'plain':!![]});interaction_log[_0xd38f('0x22')](_0xd38f('0x80'),_0x30e758[_0xd38f('0x62')]['id'],_0x30e758[_0xd38f('0x62')][_0xd38f('0x39')],_0x30e758[_0xd38f('0x62')][_0xd38f('0x6a')],_0x27aa01[_0xd38f('0x68')]['id'],_0x30e758['body']?JSON[_0xd38f('0x6b')](_0x30e758[_0xd38f('0x57')]):_0xd38f('0x6c'));return respondWithRpcPromise(_0xd38f('0x81'),_0xd38f('0x82'),_0x27aa01);}return null;})[_0xd38f('0x21')](function(_0x4107cb){var _0x4bfb8b=_0xd38f('0x6f')+_0x4107cb[_0xd38f('0x29')][_0xd38f('0x70')];return db[_0xd38f('0x71')][_0xd38f('0x42')](_0x4bfb8b,{'type':db['Sequelize']['QueryTypes'][_0xd38f('0x83')],'raw':!![]})[_0xd38f('0x21')](function(_0x426b65){return _0x426b65;});})[_0xd38f('0x21')](function(_0xd2d303){if(_0xd2d303){_0x27aa01[_0xd38f('0x29')]['contact']=_0xd2d303[0x0];if(!_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')])return;return db[_0xd38f('0x75')][_0xd38f('0x55')]({'where':{'id':_0x30e758[_0xd38f('0x57')][_0xd38f('0x61')],'role':_0xd38f('0x76')},'attributes':['id',_0xd38f('0x39'),'fullname',_0xd38f('0x77'),'internal'],'raw':!![]});}return null;})[_0xd38f('0x21')](function(_0x5abd7a){if(!_0x5abd7a)return null;_0x27aa01[_0xd38f('0x29')][_0xd38f('0x76')]=_0x5abd7a;return _0x27aa01;})['then'](function(_0x595dc1){if(_0x595dc1){_0x595dc1[_0xd38f('0x29')]['interface']=util[_0xd38f('0x5f')](_0xd38f('0x7a'),_0x30e758[_0xd38f('0x62')][_0xd38f('0x39')]);_0x595dc1['message']['channel']=_0x27aa01[_0xd38f('0x7b')];_0x595dc1['message']['motionChannel']=_0x27aa01[_0xd38f('0x7b')];_0x595dc1[_0xd38f('0x29')][_0xd38f('0x7d')]=_0xd38f('0x35');respondWithRpcPromise(_0xd38f('0x7e'),_0xd38f('0x7e'),{'event':_0xd38f('0x84'),'message':_[_0xd38f('0x4d')](_0x27aa01[_0xd38f('0x29')],JSON[_0xd38f('0x85')](_0x27aa01[_0xd38f('0x68')]['formData']))},client9002);return _0x27aa01;}return null;})[_0xd38f('0x21')](respondWithResult(_0x471d13,null))[_0xd38f('0x2b')](handleError(_0x471d13,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5db0ab9..de91402 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 _0x55b2=['update','remove','emit','hasOwnProperty','hook','exports','ChatMessage','setMaxListeners'];(function(_0x1c8314,_0x512e7e){var _0x4bfc4b=function(_0x2d8410){while(--_0x2d8410){_0x1c8314['push'](_0x1c8314['shift']());}};_0x4bfc4b(++_0x512e7e);}(_0x55b2,0x186));var _0x255b=function(_0x2ac766,_0x514088){_0x2ac766=_0x2ac766-0x0;var _0x3b31c8=_0x55b2[_0x2ac766];return _0x3b31c8;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x255b('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x255b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x255b('0x2'),'afterDestroy':_0x255b('0x3')};function emitEvent(_0x1fefaf){return function(_0x1a741d,_0x5bd4ec,_0x549cc1){ChatMessageEvents[_0x255b('0x4')](_0x1fefaf+':'+_0x1a741d['id'],_0x1a741d);ChatMessageEvents[_0x255b('0x4')](_0x1fefaf,_0x1a741d);_0x549cc1(null);};}for(var e in events){if(events[_0x255b('0x5')](e)){var event=events[e];ChatMessage[_0x255b('0x6')](e,emitEvent(event));}}module[_0x255b('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x2d2b=['../../mysqldb','ChatMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x124926,_0x1af73f){var _0x560e76=function(_0x18c60b){while(--_0x18c60b){_0x124926['push'](_0x124926['shift']());}};_0x560e76(++_0x1af73f);}(_0x2d2b,0x10d));var _0xb2d2=function(_0x23d78f,_0x37f247){_0x23d78f=_0x23d78f-0x0;var _0x11f02c=_0x2d2b[_0x23d78f];return _0x11f02c;};'use strict';var EventEmitter=require(_0xb2d2('0x0'));var ChatMessage=require(_0xb2d2('0x1'))['db'][_0xb2d2('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb2d2('0x3')](0x0);var events={'afterCreate':_0xb2d2('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b3705){return function(_0x1787f0,_0x2a2f59,_0x433109){ChatMessageEvents[_0xb2d2('0x5')](_0x1b3705+':'+_0x1787f0['id'],_0x1787f0);ChatMessageEvents[_0xb2d2('0x5')](_0x1b3705,_0x1787f0);_0x433109(null);};}for(var e in events){if(events[_0xb2d2('0x6')](e)){var event=events[e];ChatMessage[_0xb2d2('0x7')](e,emitEvent(event));}}module[_0xb2d2('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a89f8e3..b1c99cf 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 _0x9e93=['then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne'];(function(_0x51ddfe,_0x63fe43){var _0x17c2da=function(_0x124196){while(--_0x124196){_0x51ddfe['push'](_0x51ddfe['shift']());}};_0x17c2da(++_0x63fe43);}(_0x9e93,0xca));var _0x39e9=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x9e93[_0x22cc16];return _0x399b70;};'use strict';var _=require(_0x39e9('0x0'));var util=require('util');var logger=require(_0x39e9('0x1'))('api');var moment=require(_0x39e9('0x2'));var BPromise=require(_0x39e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x39e9('0x4'));var config=require(_0x39e9('0x5'));var attributes=require(_0x39e9('0x6'));module[_0x39e9('0x7')]=function(_0x4edb6,_0x4b8aa4){return _0x4edb6['define'](_0x39e9('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x39e9('0x9'),'fields':[_0x39e9('0xa')],'type':_0x39e9('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58848f,_0xc4e8b0,_0x5d824f){var _0x46ce34=_0x4edb6[_0x39e9('0xc')];var _0x2a2607=_0x58848f[_0x39e9('0xd')]({'plain':!![]});if(_0x2a2607[_0x39e9('0xe')][_0x39e9('0xf')]()==='in'||_0x2a2607['direction'][_0x39e9('0xf')]()===_0x39e9('0x10')&&!_0x2a2607[_0x39e9('0x11')]&&!_[_0x39e9('0x12')](_0x2a2607[_0x39e9('0x13')])){_0x46ce34[_0x39e9('0x14')][_0x39e9('0x15')]({'where':{'id':_0x2a2607['ChatInteractionId']}})[_0x39e9('0x16')](function(_0x3f87a4){if(_0x3f87a4){_0x3f87a4['update']({'lastMsgAt':_0x2a2607[_0x39e9('0x17')],'lastMsgDirection':_0x2a2607[_0x39e9('0xe')]['toLowerCase']()});}})[_0x39e9('0x18')](function(_0x46e593){console[_0x39e9('0x19')](_0x46e593);});}_0x5d824f();}},'charset':_0x39e9('0x1a'),'collate':_0x39e9('0x1b')});}; \ No newline at end of file +var _0xfb54=['./chatMessage.attributes','exports','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','ChatInteractionId','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x484156,_0x266ff1){var _0x5a4bef=function(_0x1894e0){while(--_0x1894e0){_0x484156['push'](_0x484156['shift']());}};_0x5a4bef(++_0x266ff1);}(_0xfb54,0x153));var _0x4fb5=function(_0xdc94d5,_0x2dbb36){_0xdc94d5=_0xdc94d5-0x0;var _0x5d9ef2=_0xfb54[_0xdc94d5];return _0x5d9ef2;};'use strict';var _=require(_0x4fb5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4fb5('0x1'));var BPromise=require(_0x4fb5('0x2'));var rp=require(_0x4fb5('0x3'));var fs=require('fs');var path=require(_0x4fb5('0x4'));var rimraf=require('rimraf');var config=require(_0x4fb5('0x5'));var attributes=require(_0x4fb5('0x6'));module[_0x4fb5('0x7')]=function(_0x14c042,_0x55a027){return _0x14c042['define']('ChatMessage',attributes,{'tableName':_0x4fb5('0x8'),'paranoid':![],'indexes':[{'name':_0x4fb5('0x9'),'fields':['body'],'type':_0x4fb5('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2814f6,_0x1c2b80,_0x38d9a5){var _0x1f9567=_0x14c042[_0x4fb5('0xb')];var _0x7eec35=_0x2814f6[_0x4fb5('0xc')]({'plain':!![]});if(_0x7eec35[_0x4fb5('0xd')][_0x4fb5('0xe')]()==='in'||_0x7eec35[_0x4fb5('0xd')][_0x4fb5('0xe')]()===_0x4fb5('0xf')&&!_0x7eec35[_0x4fb5('0x10')]&&!_[_0x4fb5('0x11')](_0x7eec35['UserId'])){_0x1f9567['ChatInteraction'][_0x4fb5('0x12')]({'where':{'id':_0x7eec35[_0x4fb5('0x13')]}})['then'](function(_0x36bf40){if(_0x36bf40){_0x36bf40['update']({'lastMsgAt':_0x7eec35[_0x4fb5('0x14')],'lastMsgDirection':_0x7eec35[_0x4fb5('0xd')][_0x4fb5('0xe')]()});}})['catch'](function(_0x169933){console['error'](_0x169933);});}_0x38d9a5();}},'charset':_0x4fb5('0x15'),'collate':_0x4fb5('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 589a861..d459845 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 _0x1014=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','error','ChatMessage,\x20%s,\x20%s','message','request\x20sent','catch','CreateChatMessage','create','options','raw','stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x31dcf3,_0x4536e7){var _0xdeb0ac=function(_0x3fb898){while(--_0x3fb898){_0x31dcf3['push'](_0x31dcf3['shift']());}};_0xdeb0ac(++_0x4536e7);}(_0x1014,0x1c7));var _0x4101=function(_0x379fb9,_0x487244){_0x379fb9=_0x379fb9-0x0;var _0x542669=_0x1014[_0x379fb9];return _0x542669;};'use strict';var _=require('lodash');var util=require(_0x4101('0x0'));var moment=require('moment');var BPromise=require(_0x4101('0x1'));var rs=require(_0x4101('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4101('0x3'))['db'];var utils=require(_0x4101('0x4'));var logger=require('../../config/logger')(_0x4101('0x5'));var config=require(_0x4101('0x6'));var jayson=require(_0x4101('0x7'));var client=jayson[_0x4101('0x8')][_0x4101('0x9')]({'port':0x232a});config[_0x4101('0xa')]=_[_0x4101('0xb')](config[_0x4101('0xa')],{'host':_0x4101('0xc'),'port':0x18eb});var socket=require(_0x4101('0xd'))(new Redis(config[_0x4101('0xa')]));require('./chatMessage.socket')[_0x4101('0xe')](socket);function respondWithRpcPromise(_0x2f98ed,_0x57728d,_0x769161){return new BPromise(function(_0x154aae,_0x27e99b){return client[_0x4101('0xf')](_0x2f98ed,_0x769161)[_0x4101('0x10')](function(_0x1f1471){logger[_0x4101('0x11')]('ChatMessage,\x20%s,\x20%s',_0x57728d,'request\x20sent');logger[_0x4101('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57728d,'request\x20sent',JSON['stringify'](_0x1f1471));if(_0x1f1471[_0x4101('0x13')]){if(_0x1f1471[_0x4101('0x13')]['code']===0x1f4){logger[_0x4101('0x13')](_0x4101('0x14'),_0x57728d,_0x1f1471[_0x4101('0x13')][_0x4101('0x15')]);return _0x27e99b(_0x1f1471[_0x4101('0x13')][_0x4101('0x15')]);}logger[_0x4101('0x13')](_0x4101('0x14'),_0x57728d,_0x1f1471[_0x4101('0x13')][_0x4101('0x15')]);return _0x154aae(_0x1f1471[_0x4101('0x13')]['message']);}else{logger[_0x4101('0x11')](_0x4101('0x14'),_0x57728d,_0x4101('0x16'));_0x154aae(_0x1f1471['result'][_0x4101('0x15')]);}})[_0x4101('0x17')](function(_0x44f73e){logger[_0x4101('0x13')]('ChatMessage,\x20%s,\x20%s',_0x57728d,_0x44f73e);_0x27e99b(_0x44f73e);});});}exports[_0x4101('0x18')]=function(_0x2cb011){var _0x7f7e79=this;return new Promise(function(_0x13b129,_0xd88bcb){return db['ChatMessage'][_0x4101('0x19')](_0x2cb011['body'],{'raw':_0x2cb011[_0x4101('0x1a')]?_0x2cb011[_0x4101('0x1a')][_0x4101('0x1b')]===undefined?!![]:![]:!![]})[_0x4101('0x10')](function(_0x238134){logger[_0x4101('0x11')](_0x4101('0x18'),_0x2cb011);logger[_0x4101('0x12')](_0x4101('0x18'),_0x2cb011,JSON[_0x4101('0x1c')](_0x238134));_0x13b129(_0x238134);})[_0x4101('0x17')](function(_0x436a51){logger[_0x4101('0x13')]('CreateChatMessage',_0x436a51['message'],_0x2cb011);_0xd88bcb(_0x7f7e79[_0x4101('0x13')](0x1f4,_0x436a51['message']));});});}; \ No newline at end of file +var _0xbc22=['options','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','body'];(function(_0x486341,_0x207631){var _0x5c7706=function(_0x4d8331){while(--_0x4d8331){_0x486341['push'](_0x486341['shift']());}};_0x5c7706(++_0x207631);}(_0xbc22,0x79));var _0x2bc2=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xbc22[_0x4a8bad];return _0x30cf32;};'use strict';var _=require('lodash');var util=require(_0x2bc2('0x0'));var moment=require('moment');var BPromise=require(_0x2bc2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bc2('0x2'));var db=require(_0x2bc2('0x3'))['db'];var utils=require(_0x2bc2('0x4'));var logger=require(_0x2bc2('0x5'))(_0x2bc2('0x6'));var config=require(_0x2bc2('0x7'));var jayson=require(_0x2bc2('0x8'));var client=jayson[_0x2bc2('0x9')]['http']({'port':0x232a});config[_0x2bc2('0xa')]=_[_0x2bc2('0xb')](config[_0x2bc2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bc2('0xc'))(new Redis(config[_0x2bc2('0xa')]));require(_0x2bc2('0xd'))[_0x2bc2('0xe')](socket);function respondWithRpcPromise(_0xeb4c0e,_0x31fb07,_0x3af1cf){return new BPromise(function(_0x540a15,_0x3224f4){return client[_0x2bc2('0xf')](_0xeb4c0e,_0x3af1cf)[_0x2bc2('0x10')](function(_0x20629c){logger['info']('ChatMessage,\x20%s,\x20%s',_0x31fb07,_0x2bc2('0x11'));logger[_0x2bc2('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x31fb07,_0x2bc2('0x11'),JSON[_0x2bc2('0x13')](_0x20629c));if(_0x20629c[_0x2bc2('0x14')]){if(_0x20629c[_0x2bc2('0x14')]['code']===0x1f4){logger[_0x2bc2('0x14')](_0x2bc2('0x15'),_0x31fb07,_0x20629c['error'][_0x2bc2('0x16')]);return _0x3224f4(_0x20629c[_0x2bc2('0x14')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x31fb07,_0x20629c['error'][_0x2bc2('0x16')]);return _0x540a15(_0x20629c['error'][_0x2bc2('0x16')]);}else{logger[_0x2bc2('0x17')]('ChatMessage,\x20%s,\x20%s',_0x31fb07,'request\x20sent');_0x540a15(_0x20629c[_0x2bc2('0x18')]['message']);}})[_0x2bc2('0x19')](function(_0x415992){logger[_0x2bc2('0x14')](_0x2bc2('0x15'),_0x31fb07,_0x415992);_0x3224f4(_0x415992);});});}exports[_0x2bc2('0x1a')]=function(_0x406333){var _0x54bb55=this;return new Promise(function(_0x358d22,_0x358065){return db[_0x2bc2('0x1b')]['create'](_0x406333[_0x2bc2('0x1c')],{'raw':_0x406333[_0x2bc2('0x1d')]?_0x406333[_0x2bc2('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x2bc2('0x10')](function(_0x523dc1){logger[_0x2bc2('0x17')](_0x2bc2('0x1a'),_0x406333);logger['debug'](_0x2bc2('0x1a'),_0x406333,JSON['stringify'](_0x523dc1));_0x358d22(_0x523dc1);})['catch'](function(_0x154885){logger['error'](_0x2bc2('0x1a'),_0x154885[_0x2bc2('0x16')],_0x406333);_0x358065(_0x54bb55['error'](0x1f4,_0x154885[_0x2bc2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 200259d..56817d0 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 _0x9335=['register','length','chatMessage:','./chatMessage.events','save','update','emit'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0x9335,0xab));var _0x5933=function(_0x249e84,_0x4348b6){_0x249e84=_0x249e84-0x0;var _0x41115b=_0x9335[_0x249e84];return _0x41115b;};'use strict';var ChatMessageEvents=require(_0x5933('0x0'));var events=[_0x5933('0x1'),'remove',_0x5933('0x2')];function createListener(_0x407b89,_0x3617bd){return function(_0x1a529c){_0x3617bd[_0x5933('0x3')](_0x407b89,_0x1a529c);};}function removeListener(_0xc3fbd1,_0x310370){return function(){ChatMessageEvents['removeListener'](_0xc3fbd1,_0x310370);};}exports[_0x5933('0x4')]=function(_0x4de024){for(var _0x553710=0x0,_0x21f4c1=events[_0x5933('0x5')];_0x553710<_0x21f4c1;_0x553710++){var _0x21ab46=events[_0x553710];var _0x59c5cb=createListener(_0x5933('0x6')+_0x21ab46,_0x4de024);ChatMessageEvents['on'](_0x21ab46,_0x59c5cb);}}; \ No newline at end of file +var _0xcee8=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x4975c5,_0x1ca463){var _0x5ebf72=function(_0x3dfd32){while(--_0x3dfd32){_0x4975c5['push'](_0x4975c5['shift']());}};_0x5ebf72(++_0x1ca463);}(_0xcee8,0xb1));var _0x8cee=function(_0x455792,_0x374066){_0x455792=_0x455792-0x0;var _0x1fc9b2=_0xcee8[_0x455792];return _0x1fc9b2;};'use strict';var ChatMessageEvents=require(_0x8cee('0x0'));var events=[_0x8cee('0x1'),_0x8cee('0x2'),_0x8cee('0x3')];function createListener(_0x1c570c,_0x6608db){return function(_0x5b82bd){_0x6608db[_0x8cee('0x4')](_0x1c570c,_0x5b82bd);};}function removeListener(_0x4e4143,_0xffd42d){return function(){ChatMessageEvents[_0x8cee('0x5')](_0x4e4143,_0xffd42d);};}exports['register']=function(_0x295471){for(var _0xfea4e3=0x0,_0x4f57f1=events['length'];_0xfea4e3<_0x4f57f1;_0xfea4e3++){var _0x341c63=events[_0xfea4e3];var _0x49a070=createListener(_0x8cee('0x6')+_0x341c63,_0x295471);ChatMessageEvents['on'](_0x341c63,_0x49a070);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4708f2a..c38ca6c 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 _0x2d9a=['reject','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','chat','create','update','put','/:id/reject'];(function(_0x5e89d2,_0x167d2c){var _0x2e81f3=function(_0x451fe1){while(--_0x451fe1){_0x5e89d2['push'](_0x5e89d2['shift']());}};_0x2e81f3(++_0x167d2c);}(_0x2d9a,0x128));var _0xa2d9=function(_0xb29bef,_0x45aff1){_0xb29bef=_0xb29bef-0x0;var _0x878163=_0x2d9a[_0xb29bef];return _0x878163;};'use strict';var multer=require(_0xa2d9('0x0'));var util=require('util');var path=require(_0xa2d9('0x1'));var timeout=require(_0xa2d9('0x2'));var express=require(_0xa2d9('0x3'));var router=express[_0xa2d9('0x4')]();var fs_extra=require(_0xa2d9('0x5'));var auth=require(_0xa2d9('0x6'));var interaction=require(_0xa2d9('0x7'));var config=require('../../config/environment');var controller=require(_0xa2d9('0x8'));router[_0xa2d9('0x9')]('/',auth[_0xa2d9('0xa')](),controller['index']);router['get'](_0xa2d9('0xb'),auth[_0xa2d9('0xa')](),controller[_0xa2d9('0xc')]);router[_0xa2d9('0x9')](_0xa2d9('0xd'),auth[_0xa2d9('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xa2d9('0xe'),'chatmessage:create'),controller[_0xa2d9('0xf')]);router['put']('/:id',controller[_0xa2d9('0x10')]);router[_0xa2d9('0x11')]('/:id/accept',auth[_0xa2d9('0xa')](),controller['accept']);router[_0xa2d9('0x11')](_0xa2d9('0x12'),auth['isAuthenticated'](),controller[_0xa2d9('0x13')]);router['delete'](_0xa2d9('0xd'),auth[_0xa2d9('0xa')](),controller[_0xa2d9('0x14')]);module['exports']=router; \ No newline at end of file +var _0x12ca=['chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat'];(function(_0x4e680e,_0x5bcf97){var _0x48ee25=function(_0x49eccc){while(--_0x49eccc){_0x4e680e['push'](_0x4e680e['shift']());}};_0x48ee25(++_0x5bcf97);}(_0x12ca,0x134));var _0xa12c=function(_0x2abca8,_0x4c63d3){_0x2abca8=_0x2abca8-0x0;var _0x45d797=_0x12ca[_0x2abca8];return _0x45d797;};'use strict';var multer=require('multer');var util=require(_0xa12c('0x0'));var path=require(_0xa12c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa12c('0x2')]();var fs_extra=require(_0xa12c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa12c('0x4'));var config=require(_0xa12c('0x5'));var controller=require(_0xa12c('0x6'));router[_0xa12c('0x7')]('/',auth['isAuthenticated'](),controller[_0xa12c('0x8')]);router[_0xa12c('0x7')](_0xa12c('0x9'),auth[_0xa12c('0xa')](),controller[_0xa12c('0xb')]);router['get'](_0xa12c('0xc'),auth['isAuthenticated'](),controller[_0xa12c('0xd')]);router[_0xa12c('0xe')]('/',auth[_0xa12c('0xa')](),interaction[_0xa12c('0xf')](_0xa12c('0x10'),_0xa12c('0x11')),controller[_0xa12c('0x12')]);router['put']('/:id',controller[_0xa12c('0x13')]);router[_0xa12c('0x14')](_0xa12c('0x15'),auth[_0xa12c('0xa')](),controller[_0xa12c('0x16')]);router[_0xa12c('0x14')](_0xa12c('0x17'),auth[_0xa12c('0xa')](),controller['reject']);router['delete'](_0xa12c('0xc'),auth[_0xa12c('0xa')](),controller[_0xa12c('0x18')]);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 96ab9c0..aedda8f 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x0b0e[_0x2d48fa];return _0x4645b7;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x45e5a3,_0x1c7c77){var _0x5ed3a9=function(_0x2d50b2){while(--_0x2d50b2){_0x45e5a3['push'](_0x45e5a3['shift']());}};_0x5ed3a9(++_0x1c7c77);}(_0xdb28,0x106));var _0x8db2=function(_0x3cd52e,_0x14377e){_0x3cd52e=_0x3cd52e-0x0;var _0x754e56=_0xdb28[_0x3cd52e];return _0x754e56;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 32f2076..fdc87be 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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0xa5e637,_0x1ac25e){_0xa5e637=_0xa5e637-0x0;var _0x31b55b=_0x7a54[_0xa5e637];return _0x31b55b;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x48384c,_0x5e89a4){_0x48384c=_0x48384c-0x0;var _0x2f46e3=_0x7a54[_0x48384c];return _0x2f46e3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 04010e2..641aa12 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf81=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x225134,_0x2ef082){var _0x470b2b=function(_0xd56bf8){while(--_0xd56bf8){_0x225134['push'](_0x225134['shift']());}};_0x470b2b(++_0x2ef082);}(_0xcf81,0x199));var _0x1cf8=function(_0x191b8b,_0x1c3fdd){_0x191b8b=_0x191b8b-0x0;var _0x128968=_0xcf81[_0x191b8b];return _0x128968;};'use strict';var EventEmitter=require(_0x1cf8('0x0'));var ChatOfflineMessage=require(_0x1cf8('0x1'))['db'][_0x1cf8('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1cf8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1cf8('0x4')};function emitEvent(_0x56e81d){return function(_0x6d1583,_0x288172,_0x578612){ChatOfflineMessageEvents[_0x1cf8('0x5')](_0x56e81d+':'+_0x6d1583['id'],_0x6d1583);ChatOfflineMessageEvents[_0x1cf8('0x5')](_0x56e81d,_0x6d1583);_0x578612(null);};}for(var e in events){if(events[_0x1cf8('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x1cf8('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe899=['hasOwnProperty','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe899,0x1cc));var _0x9e89=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0xe899[_0x3f6e26];return _0x474345;};'use strict';var EventEmitter=require(_0x9e89('0x0'));var ChatOfflineMessage=require(_0x9e89('0x1'))['db'][_0x9e89('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9e89('0x3')](0x0);var events={'afterCreate':_0x9e89('0x4'),'afterUpdate':_0x9e89('0x5'),'afterDestroy':_0x9e89('0x6')};function emitEvent(_0xc2aa22){return function(_0x5d129f,_0x277f6a,_0x1815f3){ChatOfflineMessageEvents['emit'](_0xc2aa22+':'+_0x5d129f['id'],_0x5d129f);ChatOfflineMessageEvents[_0x9e89('0x7')](_0xc2aa22,_0x5d129f);_0x1815f3(null);};}for(var e in events){if(events[_0x9e89('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5061964..b7bff3b 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 _0xcbd7=['utf8mb4','utf8mb4_unicode_ci','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x3e6a58,_0x4bbd5f){var _0xcb5ea4=function(_0x47ec63){while(--_0x47ec63){_0x3e6a58['push'](_0x3e6a58['shift']());}};_0xcb5ea4(++_0x4bbd5f);}(_0xcbd7,0x18e));var _0x7cbd=function(_0x30e62a,_0x254c90){_0x30e62a=_0x30e62a-0x0;var _0x20347d=_0xcbd7[_0x30e62a];return _0x20347d;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x7cbd('0x0')]=function(_0x289e11){return _0x289e11[_0x7cbd('0x1')](_0x7cbd('0x2'),attributes,{'tableName':_0x7cbd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cbd('0x4'),'collate':_0x7cbd('0x5')});}; \ No newline at end of file +var _0x3c49=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x55bbe3,_0x5acd20){var _0x3d5455=function(_0x3a912f){while(--_0x3a912f){_0x55bbe3['push'](_0x55bbe3['shift']());}};_0x3d5455(++_0x5acd20);}(_0x3c49,0x1ed));var _0x93c4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3c49[_0x1facfa];return _0x9ec701;};'use strict';var attributes=require(_0x93c4('0x0'));module[_0x93c4('0x1')]=function(_0x2fc691){return _0x2fc691[_0x93c4('0x2')](_0x93c4('0x3'),attributes,{'tableName':_0x93c4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x93c4('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 98f079a..5780917 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 _0x2a9a=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','catch'];(function(_0x630336,_0x586598){var _0x7c6754=function(_0x5c054f){while(--_0x5c054f){_0x630336['push'](_0x630336['shift']());}};_0x7c6754(++_0x586598);}(_0x2a9a,0x64));var _0xa2a9=function(_0x376c6d,_0x40ac36){_0x376c6d=_0x376c6d-0x0;var _0x2c1dc1=_0x2a9a[_0x376c6d];return _0x2c1dc1;};'use strict';var _=require(_0xa2a9('0x0'));var util=require('util');var moment=require(_0xa2a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2a9('0x2'));var db=require(_0xa2a9('0x3'))['db'];var utils=require(_0xa2a9('0x4'));var logger=require(_0xa2a9('0x5'))(_0xa2a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa2a9('0x7'));var client=jayson[_0xa2a9('0x8')][_0xa2a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bd1f3,_0x5c1fb2,_0x5d933f){return new BPromise(function(_0x540979,_0x523164){return client[_0xa2a9('0xa')](_0x2bd1f3,_0x5d933f)[_0xa2a9('0xb')](function(_0x3eaaa6){logger[_0xa2a9('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c1fb2,_0xa2a9('0xd'));logger[_0xa2a9('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5c1fb2,_0xa2a9('0xd'),JSON[_0xa2a9('0xf')](_0x3eaaa6));if(_0x3eaaa6[_0xa2a9('0x10')]){if(_0x3eaaa6[_0xa2a9('0x10')]['code']===0x1f4){logger[_0xa2a9('0x10')](_0xa2a9('0x11'),_0x5c1fb2,_0x3eaaa6[_0xa2a9('0x10')][_0xa2a9('0x12')]);return _0x523164(_0x3eaaa6[_0xa2a9('0x10')][_0xa2a9('0x12')]);}logger['error'](_0xa2a9('0x11'),_0x5c1fb2,_0x3eaaa6[_0xa2a9('0x10')]['message']);return _0x540979(_0x3eaaa6['error']['message']);}else{logger[_0xa2a9('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c1fb2,_0xa2a9('0xd'));_0x540979(_0x3eaaa6['result'][_0xa2a9('0x12')]);}})[_0xa2a9('0x13')](function(_0x657934){logger[_0xa2a9('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c1fb2,_0x657934);_0x523164(_0x657934);});});} \ No newline at end of file +var _0x13c6=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x499608,_0x187e5b){var _0x29eddf=function(_0x47ccfd){while(--_0x47ccfd){_0x499608['push'](_0x499608['shift']());}};_0x29eddf(++_0x187e5b);}(_0x13c6,0x94));var _0x613c=function(_0x179207,_0x3f1af5){_0x179207=_0x179207-0x0;var _0x5585c8=_0x13c6[_0x179207];return _0x5585c8;};'use strict';var _=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var moment=require(_0x613c('0x2'));var BPromise=require(_0x613c('0x3'));var rs=require(_0x613c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x613c('0x5'));var logger=require('../../config/logger')(_0x613c('0x6'));var config=require(_0x613c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x411bda,_0x266b12,_0x2d3865){return new BPromise(function(_0x2d99df,_0x3306ec){return client[_0x613c('0x9')](_0x411bda,_0x2d3865)[_0x613c('0xa')](function(_0x1dfa38){logger[_0x613c('0xb')](_0x613c('0xc'),_0x266b12,_0x613c('0xd'));logger[_0x613c('0xe')](_0x613c('0xf'),_0x266b12,'request\x20sent',JSON['stringify'](_0x1dfa38));if(_0x1dfa38['error']){if(_0x1dfa38[_0x613c('0x10')][_0x613c('0x11')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x266b12,_0x1dfa38[_0x613c('0x10')]['message']);return _0x3306ec(_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);}logger[_0x613c('0x10')](_0x613c('0xc'),_0x266b12,_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);return _0x2d99df(_0x1dfa38[_0x613c('0x10')][_0x613c('0x12')]);}else{logger['info'](_0x613c('0xc'),_0x266b12,_0x613c('0xd'));_0x2d99df(_0x1dfa38[_0x613c('0x13')][_0x613c('0x12')]);}})['catch'](function(_0x23e600){logger[_0x613c('0x10')](_0x613c('0xc'),_0x266b12,_0x23e600);_0x3306ec(_0x23e600);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 0a46b9b..9fbc502 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 _0x4cba=['/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x94ae20,_0x1799f2){var _0x5edd9f=function(_0x5ad310){while(--_0x5ad310){_0x94ae20['push'](_0x94ae20['shift']());}};_0x5edd9f(++_0x1799f2);}(_0x4cba,0xf1));var _0xa4cb=function(_0x29467a,_0x405f73){_0x29467a=_0x29467a-0x0;var _0xaec2df=_0x4cba[_0x29467a];return _0xaec2df;};'use strict';var multer=require('multer');var util=require(_0xa4cb('0x0'));var path=require(_0xa4cb('0x1'));var timeout=require(_0xa4cb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa4cb('0x3'));var auth=require(_0xa4cb('0x4'));var interaction=require(_0xa4cb('0x5'));var config=require(_0xa4cb('0x6'));var controller=require(_0xa4cb('0x7'));router[_0xa4cb('0x8')]('/',auth[_0xa4cb('0x9')](),controller[_0xa4cb('0xa')]);router[_0xa4cb('0x8')](_0xa4cb('0xb'),auth['isAuthenticated'](),controller[_0xa4cb('0xc')]);router[_0xa4cb('0x8')](_0xa4cb('0xd'),auth[_0xa4cb('0x9')](),controller[_0xa4cb('0xe')]);router[_0xa4cb('0xf')]('/',auth[_0xa4cb('0x9')](),controller[_0xa4cb('0x10')]);router[_0xa4cb('0x11')](_0xa4cb('0xd'),auth[_0xa4cb('0x9')](),controller['update']);router[_0xa4cb('0x12')](_0xa4cb('0xd'),auth['isAuthenticated'](),controller[_0xa4cb('0x13')]);module[_0xa4cb('0x14')]=router; \ No newline at end of file +var _0x03e0=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','isAuthenticated','describe','/:id','show','update','delete','multer'];(function(_0x217523,_0x5d793a){var _0x43e3e1=function(_0x477f77){while(--_0x477f77){_0x217523['push'](_0x217523['shift']());}};_0x43e3e1(++_0x5d793a);}(_0x03e0,0x1a8));var _0x003e=function(_0x3083d0,_0x4998ef){_0x3083d0=_0x3083d0-0x0;var _0x3abb1c=_0x03e0[_0x3083d0];return _0x3abb1c;};'use strict';var multer=require(_0x003e('0x0'));var util=require('util');var path=require(_0x003e('0x1'));var timeout=require('connect-timeout');var express=require(_0x003e('0x2'));var router=express[_0x003e('0x3')]();var fs_extra=require(_0x003e('0x4'));var auth=require(_0x003e('0x5'));var interaction=require(_0x003e('0x6'));var config=require(_0x003e('0x7'));var controller=require(_0x003e('0x8'));router[_0x003e('0x9')]('/',auth['isAuthenticated'](),controller[_0x003e('0xa')]);router[_0x003e('0x9')]('/describe',auth[_0x003e('0xb')](),controller[_0x003e('0xc')]);router[_0x003e('0x9')](_0x003e('0xd'),auth['isAuthenticated'](),controller[_0x003e('0xe')]);router['post']('/',auth[_0x003e('0xb')](),controller['create']);router['put'](_0x003e('0xd'),auth['isAuthenticated'](),controller[_0x003e('0xf')]);router[_0x003e('0x10')](_0x003e('0xd'),auth[_0x003e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a4130ca..3808878 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 _0x5738=['INTEGER','exports','STRING','ENUM','mouseOver','timeout'];(function(_0xf0cae2,_0x22a2bc){var _0x36f427=function(_0x4a8b4d){while(--_0x4a8b4d){_0xf0cae2['push'](_0xf0cae2['shift']());}};_0x36f427(++_0x22a2bc);}(_0x5738,0x7f));var _0x8573=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x5738[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require('sequelize');module[_0x8573('0x0')]={'name':{'type':Sequelize[_0x8573('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8573('0x2')](_0x8573('0x3'),_0x8573('0x4')),'defaultValue':_0x8573('0x3')},'selector':{'type':Sequelize[_0x8573('0x1')]},'timeout':{'type':Sequelize[_0x8573('0x5')]}}; \ No newline at end of file +var _0x9a24=['INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0x7fb404,_0x35907e){var _0x14d9c1=function(_0x1b0e69){while(--_0x1b0e69){_0x7fb404['push'](_0x7fb404['shift']());}};_0x14d9c1(++_0x35907e);}(_0x9a24,0x1d7));var _0x49a2=function(_0x1f2696,_0x22ea03){_0x1f2696=_0x1f2696-0x0;var _0x73a5fa=_0x9a24[_0x1f2696];return _0x73a5fa;};'use strict';var Sequelize=require('sequelize');module[_0x49a2('0x0')]={'name':{'type':Sequelize[_0x49a2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49a2('0x2')](_0x49a2('0x3'),'timeout'),'defaultValue':_0x49a2('0x3')},'selector':{'type':Sequelize[_0x49a2('0x1')]},'timeout':{'type':Sequelize[_0x49a2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a31db03..ee22bc6 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 _0xc3b5=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x43b922,_0x5e33fd){var _0x9dba94=function(_0x39e138){while(--_0x39e138){_0x43b922['push'](_0x43b922['shift']());}};_0x9dba94(++_0x5e33fd);}(_0xc3b5,0x6f));var _0x5c3b=function(_0xffc2e7,_0x5bc33c){_0xffc2e7=_0xffc2e7-0x0;var _0x3bc22a=_0xc3b5[_0xffc2e7];return _0x3bc22a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5c3b('0x0'));var jsonpatch=require(_0x5c3b('0x1'));var rp=require(_0x5c3b('0x2'));var moment=require(_0x5c3b('0x3'));var BPromise=require(_0x5c3b('0x4'));var Mustache=require(_0x5c3b('0x5'));var util=require(_0x5c3b('0x6'));var path=require(_0x5c3b('0x7'));var sox=require('sox');var csv=require(_0x5c3b('0x8'));var ejs=require(_0x5c3b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c3b('0xa'));var squel=require(_0x5c3b('0xb'));var crypto=require(_0x5c3b('0xc'));var jsforce=require(_0x5c3b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c3b('0x8'));var querystring=require(_0x5c3b('0xe'));var Papa=require(_0x5c3b('0xf'));var Redis=require(_0x5c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c3b('0x11'));var as=require(_0x5c3b('0x12'));var hardwareService=require(_0x5c3b('0x13'));var logger=require(_0x5c3b('0x14'))(_0x5c3b('0x15'));var utils=require('../../config/utils');var config=require(_0x5c3b('0x16'));var licenseUtil=require(_0x5c3b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2815,_0x3b953d){_0x3b953d=_0x3b953d||0xcc;return function(_0x507c2e){if(_0x507c2e){return _0x1b2815[_0x5c3b('0x18')](_0x3b953d);}return _0x1b2815[_0x5c3b('0x19')](_0x3b953d)[_0x5c3b('0x1a')]();};}function respondWithResult(_0x2384b9,_0x315e68){_0x315e68=_0x315e68||0xc8;return function(_0x3fef28){if(_0x3fef28){return _0x2384b9[_0x5c3b('0x19')](_0x315e68)['json'](_0x3fef28);}};}function respondWithFilteredResult(_0x2f7ab2,_0x5b55be){return function(_0x4cf80d){if(_0x4cf80d){var _0x195c1e=typeof _0x5b55be[_0x5c3b('0x1b')]===_0x5c3b('0x1c')&&typeof _0x5b55be['limit']===_0x5c3b('0x1c');var _0x229e28=_0x4cf80d[_0x5c3b('0x1d')];var _0x59f71b=_0x195c1e?0x0:_0x5b55be[_0x5c3b('0x1b')];var _0x34144d=_0x195c1e?_0x4cf80d['count']:_0x5b55be[_0x5c3b('0x1b')]+_0x5b55be[_0x5c3b('0x1e')];var _0x2b2307;if(_0x34144d>=_0x229e28){_0x34144d=_0x229e28;_0x2b2307=0xc8;}else{_0x2b2307=0xce;}_0x2f7ab2[_0x5c3b('0x19')](_0x2b2307);return _0x2f7ab2[_0x5c3b('0x1f')](_0x5c3b('0x20'),_0x59f71b+'-'+_0x34144d+'/'+_0x229e28)[_0x5c3b('0x21')](_0x4cf80d);}return null;};}function patchUpdates(_0x1af39c){return function(_0xc63307){try{jsonpatch[_0x5c3b('0x22')](_0xc63307,_0x1af39c,!![]);}catch(_0x4ec8c1){return BPromise['reject'](_0x4ec8c1);}return _0xc63307[_0x5c3b('0x23')]();};}function saveUpdates(_0x143022,_0x5942f1){return function(_0x439d8e){if(_0x439d8e){return _0x439d8e['update'](_0x143022)[_0x5c3b('0x24')](function(_0xb8006){return _0xb8006;});}return null;};}function removeEntity(_0x2bb9dc,_0xe9261d){return function(_0x529c39){if(_0x529c39){return _0x529c39[_0x5c3b('0x25')]()[_0x5c3b('0x24')](function(){_0x2bb9dc['status'](0xcc)[_0x5c3b('0x1a')]();});}};}function handleEntityNotFound(_0x2c8682,_0x3a8141){return function(_0x3c3991){if(!_0x3c3991){_0x2c8682['sendStatus'](0x194);}return _0x3c3991;};}function handleError(_0x15ae38,_0x20469d){_0x20469d=_0x20469d||0x1f4;return function(_0x2099dc){logger[_0x5c3b('0x26')](_0x2099dc[_0x5c3b('0x27')]);if(_0x2099dc[_0x5c3b('0x28')]){delete _0x2099dc['name'];}_0x15ae38['status'](_0x20469d)['send'](_0x2099dc);};}exports[_0x5c3b('0x29')]=function(_0x3e6832,_0x59b640){var _0xd93418={'raw':!![],'where':{'id':_0x3e6832[_0x5c3b('0x2a')]['id']}},_0x15044e={};_0x15044e[_0x5c3b('0x2b')]=_[_0x5c3b('0x2c')](db[_0x5c3b('0x2d')][_0x5c3b('0x2e')]);_0x15044e[_0x5c3b('0x2f')]=_[_0x5c3b('0x2c')](_0x3e6832[_0x5c3b('0x2f')]);_0x15044e[_0x5c3b('0x30')]=_[_0x5c3b('0x31')](_0x15044e['model'],_0x15044e[_0x5c3b('0x2f')]);_0xd93418[_0x5c3b('0x32')]=_[_0x5c3b('0x31')](_0x15044e[_0x5c3b('0x2b')],qs[_0x5c3b('0x33')](_0x3e6832[_0x5c3b('0x2f')][_0x5c3b('0x33')]));_0xd93418[_0x5c3b('0x32')]=_0xd93418[_0x5c3b('0x32')][_0x5c3b('0x34')]?_0xd93418[_0x5c3b('0x32')]:_0x15044e[_0x5c3b('0x2b')];if(_0x3e6832[_0x5c3b('0x2f')][_0x5c3b('0x35')]){_0xd93418[_0x5c3b('0x36')]=[{'all':!![]}];}_0xd93418=_[_0x5c3b('0x37')]({},_0xd93418,_0x3e6832[_0x5c3b('0x38')]);return db['ChatProactiveAction'][_0x5c3b('0x39')](_0xd93418)[_0x5c3b('0x24')](handleEntityNotFound(_0x59b640,null))[_0x5c3b('0x24')](respondWithResult(_0x59b640,null))[_0x5c3b('0x3a')](handleError(_0x59b640,null));};exports['create']=function(_0x35939b,_0x39c159){return db['ChatProactiveAction'][_0x5c3b('0x3b')](_0x35939b[_0x5c3b('0x3c')],{})[_0x5c3b('0x24')](respondWithResult(_0x39c159,0xc9))[_0x5c3b('0x3a')](handleError(_0x39c159,null));};exports[_0x5c3b('0x3d')]=function(_0x27e7f7,_0x27b34d){if(_0x27e7f7[_0x5c3b('0x3c')]['id']){delete _0x27e7f7[_0x5c3b('0x3c')]['id'];}return db['ChatProactiveAction'][_0x5c3b('0x39')]({'where':{'id':_0x27e7f7[_0x5c3b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x27b34d,null))['then'](saveUpdates(_0x27e7f7[_0x5c3b('0x3c')],null))[_0x5c3b('0x24')](respondWithResult(_0x27b34d,null))[_0x5c3b('0x3a')](handleError(_0x27b34d,null));};exports[_0x5c3b('0x25')]=function(_0x223dc8,_0x406bf9){return db[_0x5c3b('0x2d')]['find']({'where':{'id':_0x223dc8['params']['id']}})[_0x5c3b('0x24')](handleEntityNotFound(_0x406bf9,null))[_0x5c3b('0x24')](removeEntity(_0x406bf9,null))[_0x5c3b('0x3a')](handleError(_0x406bf9,null));}; \ No newline at end of file +var _0xc3a8=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','show','params','keys','ChatProactiveAction','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x16eb61,_0x43dfa2){_0x16eb61=_0x16eb61-0x0;var _0x46905c=_0xc3a8[_0x16eb61];return _0x46905c;};'use strict';var emlformat=require(_0x8c3a('0x0'));var rimraf=require(_0x8c3a('0x1'));var zipdir=require(_0x8c3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c3a('0x3'));var moment=require('moment');var BPromise=require(_0x8c3a('0x4'));var Mustache=require(_0x8c3a('0x5'));var util=require(_0x8c3a('0x6'));var path=require(_0x8c3a('0x7'));var sox=require('sox');var csv=require(_0x8c3a('0x8'));var ejs=require(_0x8c3a('0x9'));var fs=require('fs');var fs_extra=require(_0x8c3a('0xa'));var _=require(_0x8c3a('0xb'));var squel=require(_0x8c3a('0xc'));var crypto=require(_0x8c3a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c3a('0xe'));var toCsv=require(_0x8c3a('0x8'));var querystring=require(_0x8c3a('0xf'));var Papa=require(_0x8c3a('0x10'));var Redis=require(_0x8c3a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c3a('0x12'));var as=require(_0x8c3a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c3a('0x14'))(_0x8c3a('0x15'));var utils=require(_0x8c3a('0x16'));var config=require(_0x8c3a('0x17'));var licenseUtil=require(_0x8c3a('0x18'));var db=require(_0x8c3a('0x19'))['db'];function respondWithStatusCode(_0x5eb124,_0x99edce){_0x99edce=_0x99edce||0xcc;return function(_0x57e0ec){if(_0x57e0ec){return _0x5eb124['sendStatus'](_0x99edce);}return _0x5eb124[_0x8c3a('0x1a')](_0x99edce)[_0x8c3a('0x1b')]();};}function respondWithResult(_0x271d3d,_0x31f3d4){_0x31f3d4=_0x31f3d4||0xc8;return function(_0x290298){if(_0x290298){return _0x271d3d[_0x8c3a('0x1a')](_0x31f3d4)[_0x8c3a('0x1c')](_0x290298);}};}function respondWithFilteredResult(_0x513e00,_0x43b853){return function(_0x5be4ea){if(_0x5be4ea){var _0x1d8b7b=typeof _0x43b853[_0x8c3a('0x1d')]===_0x8c3a('0x1e')&&typeof _0x43b853[_0x8c3a('0x1f')]===_0x8c3a('0x1e');var _0x54fe05=_0x5be4ea['count'];var _0x51acdb=_0x1d8b7b?0x0:_0x43b853['offset'];var _0x29502b=_0x1d8b7b?_0x5be4ea[_0x8c3a('0x20')]:_0x43b853[_0x8c3a('0x1d')]+_0x43b853[_0x8c3a('0x1f')];var _0x365ab8;if(_0x29502b>=_0x54fe05){_0x29502b=_0x54fe05;_0x365ab8=0xc8;}else{_0x365ab8=0xce;}_0x513e00[_0x8c3a('0x1a')](_0x365ab8);return _0x513e00['set'](_0x8c3a('0x21'),_0x51acdb+'-'+_0x29502b+'/'+_0x54fe05)[_0x8c3a('0x1c')](_0x5be4ea);}return null;};}function patchUpdates(_0x4f77df){return function(_0x1590a7){try{jsonpatch['apply'](_0x1590a7,_0x4f77df,!![]);}catch(_0x3efbc4){return BPromise[_0x8c3a('0x22')](_0x3efbc4);}return _0x1590a7[_0x8c3a('0x23')]();};}function saveUpdates(_0x58ca7a,_0x429ca6){return function(_0xb78cfc){if(_0xb78cfc){return _0xb78cfc[_0x8c3a('0x24')](_0x58ca7a)[_0x8c3a('0x25')](function(_0x718982){return _0x718982;});}return null;};}function removeEntity(_0x3c5f12,_0x427917){return function(_0x5546c3){if(_0x5546c3){return _0x5546c3[_0x8c3a('0x26')]()['then'](function(){_0x3c5f12[_0x8c3a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9f4bf,_0xe50c44){return function(_0x530e9c){if(!_0x530e9c){_0xb9f4bf[_0x8c3a('0x27')](0x194);}return _0x530e9c;};}function handleError(_0x4a1c24,_0x9cc5a8){_0x9cc5a8=_0x9cc5a8||0x1f4;return function(_0x295fb9){logger[_0x8c3a('0x28')](_0x295fb9['stack']);if(_0x295fb9['name']){delete _0x295fb9[_0x8c3a('0x29')];}_0x4a1c24[_0x8c3a('0x1a')](_0x9cc5a8)['send'](_0x295fb9);};}exports[_0x8c3a('0x2a')]=function(_0x2f77b1,_0x4ae1e4){var _0xd5353d={'raw':!![],'where':{'id':_0x2f77b1[_0x8c3a('0x2b')]['id']}},_0x31cad9={};_0x31cad9['model']=_[_0x8c3a('0x2c')](db[_0x8c3a('0x2d')]['rawAttributes']);_0x31cad9[_0x8c3a('0x2e')]=_[_0x8c3a('0x2c')](_0x2f77b1['query']);_0x31cad9[_0x8c3a('0x2f')]=_[_0x8c3a('0x30')](_0x31cad9[_0x8c3a('0x31')],_0x31cad9['query']);_0xd5353d[_0x8c3a('0x32')]=_[_0x8c3a('0x30')](_0x31cad9[_0x8c3a('0x31')],qs[_0x8c3a('0x33')](_0x2f77b1['query']['fields']));_0xd5353d[_0x8c3a('0x32')]=_0xd5353d[_0x8c3a('0x32')][_0x8c3a('0x34')]?_0xd5353d[_0x8c3a('0x32')]:_0x31cad9[_0x8c3a('0x31')];if(_0x2f77b1['query'][_0x8c3a('0x35')]){_0xd5353d[_0x8c3a('0x36')]=[{'all':!![]}];}_0xd5353d=_[_0x8c3a('0x37')]({},_0xd5353d,_0x2f77b1[_0x8c3a('0x38')]);return db[_0x8c3a('0x2d')]['find'](_0xd5353d)[_0x8c3a('0x25')](handleEntityNotFound(_0x4ae1e4,null))['then'](respondWithResult(_0x4ae1e4,null))[_0x8c3a('0x39')](handleError(_0x4ae1e4,null));};exports['create']=function(_0x8170c1,_0x51aa22){return db[_0x8c3a('0x2d')][_0x8c3a('0x3a')](_0x8170c1[_0x8c3a('0x3b')],{})[_0x8c3a('0x25')](respondWithResult(_0x51aa22,0xc9))['catch'](handleError(_0x51aa22,null));};exports[_0x8c3a('0x24')]=function(_0x3bf20b,_0x3586e2){if(_0x3bf20b['body']['id']){delete _0x3bf20b[_0x8c3a('0x3b')]['id'];}return db[_0x8c3a('0x2d')][_0x8c3a('0x3c')]({'where':{'id':_0x3bf20b[_0x8c3a('0x2b')]['id']}})[_0x8c3a('0x25')](handleEntityNotFound(_0x3586e2,null))[_0x8c3a('0x25')](saveUpdates(_0x3bf20b[_0x8c3a('0x3b')],null))[_0x8c3a('0x25')](respondWithResult(_0x3586e2,null))[_0x8c3a('0x39')](handleError(_0x3586e2,null));};exports[_0x8c3a('0x26')]=function(_0x3ae65c,_0x582cdc){return db[_0x8c3a('0x2d')][_0x8c3a('0x3c')]({'where':{'id':_0x3ae65c[_0x8c3a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x582cdc,null))[_0x8c3a('0x25')](removeEntity(_0x582cdc,null))['catch'](handleError(_0x582cdc,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index fcf0969..b55d3cf 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 _0x1160=['api','moment','bluebird','path','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1160,0xfa));var _0x0116=function(_0x10e8ed,_0x384a0d){_0x10e8ed=_0x10e8ed-0x0;var _0x4aea4a=_0x1160[_0x10e8ed];return _0x4aea4a;};'use strict';var _=require(_0x0116('0x0'));var util=require(_0x0116('0x1'));var logger=require(_0x0116('0x2'))(_0x0116('0x3'));var moment=require(_0x0116('0x4'));var BPromise=require(_0x0116('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0116('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0116('0x7'));module[_0x0116('0x8')]=function(_0x23e3e1,_0x110dc7){return _0x23e3e1['define'](_0x0116('0x9'),attributes,{'tableName':_0x0116('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b5=['../../config/logger','moment','path','rimraf','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xc5b5,0x1c1));var _0x5c5b=function(_0x490c02,_0x2faa1b){_0x490c02=_0x490c02-0x0;var _0x4604ab=_0xc5b5[_0x490c02];return _0x4604ab;};'use strict';var _=require(_0x5c5b('0x0'));var util=require('util');var logger=require(_0x5c5b('0x1'))('api');var moment=require(_0x5c5b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c5b('0x3'));var rimraf=require(_0x5c5b('0x4'));var config=require('../../config/environment');var attributes=require(_0x5c5b('0x5'));module['exports']=function(_0x570087,_0x49d5ee){return _0x570087[_0x5c5b('0x6')](_0x5c5b('0x7'),attributes,{'tableName':_0x5c5b('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 42b58e2..8e882c3 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 _0x20bc=['http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1263c1,_0x287a24){var _0x59639e=function(_0xf1c73c){while(--_0xf1c73c){_0x1263c1['push'](_0x1263c1['shift']());}};_0x59639e(++_0x287a24);}(_0x20bc,0xb5));var _0xc20b=function(_0x56fb7d,_0x539ea1){_0x56fb7d=_0x56fb7d-0x0;var _0x3be1c3=_0x20bc[_0x56fb7d];return _0x3be1c3;};'use strict';var _=require(_0xc20b('0x0'));var util=require(_0xc20b('0x1'));var moment=require('moment');var BPromise=require(_0xc20b('0x2'));var rs=require(_0xc20b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc20b('0x4'))['db'];var utils=require(_0xc20b('0x5'));var logger=require(_0xc20b('0x6'))(_0xc20b('0x7'));var config=require(_0xc20b('0x8'));var jayson=require(_0xc20b('0x9'));var client=jayson[_0xc20b('0xa')][_0xc20b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c171b,_0x16db57,_0x30d929){return new BPromise(function(_0x15a272,_0x65d1f8){return client['request'](_0x3c171b,_0x30d929)[_0xc20b('0xc')](function(_0x974295){logger['info'](_0xc20b('0xd'),_0x16db57,_0xc20b('0xe'));logger[_0xc20b('0xf')](_0xc20b('0x10'),_0x16db57,'request\x20sent',JSON[_0xc20b('0x11')](_0x974295));if(_0x974295[_0xc20b('0x12')]){if(_0x974295['error'][_0xc20b('0x13')]===0x1f4){logger[_0xc20b('0x12')](_0xc20b('0xd'),_0x16db57,_0x974295[_0xc20b('0x12')][_0xc20b('0x14')]);return _0x65d1f8(_0x974295[_0xc20b('0x12')]['message']);}logger[_0xc20b('0x12')](_0xc20b('0xd'),_0x16db57,_0x974295[_0xc20b('0x12')][_0xc20b('0x14')]);return _0x15a272(_0x974295['error']['message']);}else{logger[_0xc20b('0x15')](_0xc20b('0xd'),_0x16db57,_0xc20b('0xe'));_0x15a272(_0x974295[_0xc20b('0x16')]['message']);}})[_0xc20b('0x17')](function(_0x37c42f){logger[_0xc20b('0x12')](_0xc20b('0xd'),_0x16db57,_0x37c42f);_0x65d1f8(_0x37c42f);});});} \ No newline at end of file +var _0xa54f=['../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xa54f,0x1e9));var _0xfa54=function(_0x27694f,_0x150986){_0x27694f=_0x27694f-0x0;var _0xce032d=_0xa54f[_0x27694f];return _0xce032d;};'use strict';var _=require(_0xfa54('0x0'));var util=require('util');var moment=require(_0xfa54('0x1'));var BPromise=require(_0xfa54('0x2'));var rs=require(_0xfa54('0x3'));var fs=require('fs');var Redis=require(_0xfa54('0x4'));var db=require(_0xfa54('0x5'))['db'];var utils=require(_0xfa54('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfa54('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10afa6,_0x4bb498,_0x1a69bf){return new BPromise(function(_0x4befd7,_0x5777bb){return client[_0xfa54('0x9')](_0x10afa6,_0x1a69bf)[_0xfa54('0xa')](function(_0x362544){logger[_0xfa54('0xb')](_0xfa54('0xc'),_0x4bb498,_0xfa54('0xd'));logger[_0xfa54('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4bb498,_0xfa54('0xd'),JSON['stringify'](_0x362544));if(_0x362544[_0xfa54('0xf')]){if(_0x362544[_0xfa54('0xf')][_0xfa54('0x10')]===0x1f4){logger['error'](_0xfa54('0xc'),_0x4bb498,_0x362544['error'][_0xfa54('0x11')]);return _0x5777bb(_0x362544[_0xfa54('0xf')][_0xfa54('0x11')]);}logger[_0xfa54('0xf')](_0xfa54('0xc'),_0x4bb498,_0x362544['error'][_0xfa54('0x11')]);return _0x4befd7(_0x362544['error'][_0xfa54('0x11')]);}else{logger[_0xfa54('0xb')](_0xfa54('0xc'),_0x4bb498,_0xfa54('0xd'));_0x4befd7(_0x362544[_0xfa54('0x12')]['message']);}})['catch'](function(_0x5ef68f){logger[_0xfa54('0xf')](_0xfa54('0xc'),_0x4bb498,_0x5ef68f);_0x5777bb(_0x5ef68f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 45ef55c..f6db09f 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 _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x471eec,_0x97e5f7){var _0x42818f=function(_0x3f90cf){while(--_0x3f90cf){_0x471eec['push'](_0x471eec['shift']());}};_0x42818f(++_0x97e5f7);}(_0x326f,0xd1));var _0xf326=function(_0xd84df2,_0x517955){_0xd84df2=_0xd84df2-0x0;var _0x3cf1e2=_0x326f[_0xd84df2];return _0x3cf1e2;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x5f031a,_0x3f65cd){var _0x1a777a=function(_0x549230){while(--_0x549230){_0x5f031a['push'](_0x5f031a['shift']());}};_0x1a777a(++_0x3f65cd);}(_0x55ca,0x126));var _0xa55c=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x55ca[_0x1d291d];return _0x44cc4e;};'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')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('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 0acc2f6..83e1cb0 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 _0x4863=['beepall','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x1da2ad,_0x56f599){var _0x269367=function(_0x41e8c1){while(--_0x41e8c1){_0x1da2ad['push'](_0x1da2ad['shift']());}};_0x269367(++_0x56f599);}(_0x4863,0x1c1));var _0x3486=function(_0x2aea57,_0x2d9ab3){_0x2aea57=_0x2aea57-0x0;var _0x1ed997=_0x4863[_0x2aea57];return _0x1ed997;};'use strict';var Sequelize=require(_0x3486('0x0'));module[_0x3486('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3486('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3486('0x3')]},'timeout':{'type':Sequelize[_0x3486('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3486('0x5')](_0x3486('0x6'),_0x3486('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x46c8=['sequelize','STRING','name','ENUM','beepall','roundrobin'];(function(_0x16eec5,_0x46b882){var _0x470ec8=function(_0x4592cf){while(--_0x4592cf){_0x16eec5['push'](_0x16eec5['shift']());}};_0x470ec8(++_0x46b882);}(_0x46c8,0x108));var _0x846c=function(_0x223a62,_0xbd9202){_0x223a62=_0x223a62-0x0;var _0x582902=_0x46c8[_0x223a62];return _0x582902;};'use strict';var Sequelize=require(_0x846c('0x0'));module['exports']={'name':{'type':Sequelize[_0x846c('0x1')],'unique':_0x846c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x846c('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x846c('0x3')]('rrmemory',_0x846c('0x4'),_0x846c('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ed40581..72b5141 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 _0x271c=['where','include','query','findAll','rows','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','limit','sort','ChatQueueId','filter','findAndCountAll','UserId','agent','format','%s/%s','SIP','chatPause','createdAt','updatedAt','Team','order','pick','getTeams','addTeams','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','ids','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','undefined','count','offset','set','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','getOptions'];(function(_0x261e36,_0x1d284f){var _0x40f5a5=function(_0xb53476){while(--_0xb53476){_0x261e36['push'](_0x261e36['shift']());}};_0x40f5a5(++_0x1d284f);}(_0x271c,0x156));var _0xc271=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x271c[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require(_0xc271('0x0'));var util=require(_0xc271('0x1'));var _=require('lodash');var squel=require(_0xc271('0x2'));var Redis=require(_0xc271('0x3'));var qs=require(_0xc271('0x4'));var logger=require(_0xc271('0x5'))('api');var config=require(_0xc271('0x6'));var db=require(_0xc271('0x7'))['db'];config[_0xc271('0x8')]=_['defaults'](config['redis'],{'host':_0xc271('0x9'),'port':0x18eb});var socket=require(_0xc271('0xa'))(new Redis(config[_0xc271('0x8')]));require(_0xc271('0xb'))[_0xc271('0xc')](socket);function respondWithStatusCode(_0x2b6169,_0x26102f){_0x26102f=_0x26102f||0xcc;return function(_0x5607b7){if(_0x5607b7){return _0x2b6169[_0xc271('0xd')](_0x26102f);}return _0x2b6169[_0xc271('0xe')](_0x26102f)[_0xc271('0xf')]();};}function respondWithResult(_0x5b79e3,_0x11d837){_0x11d837=_0x11d837||0xc8;return function(_0x10202c){if(_0x10202c){return _0x5b79e3[_0xc271('0xe')](_0x11d837)['json'](_0x10202c);}};}function respondWithFilteredResult(_0x36757b,_0x11d740){return function(_0x19d609){if(_0x19d609){var _0x4c1414=typeof _0x11d740['offset']===_0xc271('0x10')&&typeof _0x11d740['limit']===_0xc271('0x10');var _0x445c84=_0x19d609[_0xc271('0x11')];var _0x163fcc=_0x4c1414?0x0:_0x11d740['offset'];var _0x763f52=_0x4c1414?_0x19d609[_0xc271('0x11')]:_0x11d740[_0xc271('0x12')]+_0x11d740['limit'];var _0x54cab9;if(_0x763f52>=_0x445c84){_0x763f52=_0x445c84;_0x54cab9=0xc8;}else{_0x54cab9=0xce;}_0x36757b[_0xc271('0xe')](_0x54cab9);return _0x36757b[_0xc271('0x13')]('Content-Range',_0x163fcc+'-'+_0x763f52+'/'+_0x445c84)['json'](_0x19d609);}return null;};}function saveUpdates(_0x5c48d6){return function(_0x210a11){if(_0x210a11){return _0x210a11['update'](_0x5c48d6)[_0xc271('0x14')](function(_0x3f890f){return _0x3f890f;});}return null;};}function removeEntity(_0x40deec){return function(_0x3a8691){if(_0x3a8691){return _0x3a8691[_0xc271('0x15')]()[_0xc271('0x14')](function(){var _0x1132ee=_0x3a8691[_0xc271('0x16')]({'plain':!![]});var _0x48c591=_0xc271('0x17');return db[_0xc271('0x18')][_0xc271('0x15')]({'where':{'type':_0x48c591,'resourceId':_0x1132ee['id']}})[_0xc271('0x14')](function(){return _0x3a8691;});})[_0xc271('0x14')](function(){_0x40deec[_0xc271('0xe')](0xcc)[_0xc271('0xf')]();});}};}function handleEntityNotFound(_0x3909e8){return function(_0x5249f8){if(!_0x5249f8){_0x3909e8['sendStatus'](0x194);}return _0x5249f8;};}function handleError(_0x5c7d0b,_0x21254f){_0x21254f=_0x21254f||0x1f4;return function(_0x4e7320){logger[_0xc271('0x19')](_0x4e7320[_0xc271('0x1a')]);if(_0x4e7320[_0xc271('0x1b')]){delete _0x4e7320[_0xc271('0x1b')];}_0x5c7d0b['status'](_0x21254f)[_0xc271('0x1c')](_0x4e7320);};}exports[_0xc271('0x1d')]=function(_0x347c16,_0xbd806e){var _0x116bf1={};var _0x12048b={'count':0x0,'rows':[]};var _0x34bccc=_[_0xc271('0x1e')](db[_0xc271('0x1f')][_0xc271('0x20')],function(_0x356254){return{'name':_0x356254[_0xc271('0x21')],'type':_0x356254['type'][_0xc271('0x22')]};});_0x116bf1=qs[_0xc271('0x23')](_0x34bccc,_0x347c16);var _0x2bc7cc={'where':_0x116bf1[_0xc271('0x24')]};return db[_0xc271('0x1f')][_0xc271('0x11')](_0x2bc7cc)[_0xc271('0x14')](function(_0x44800a){_0x12048b[_0xc271('0x11')]=_0x44800a;_0x116bf1[_0xc271('0x25')]=qs['include'](_0x347c16[_0xc271('0x26')]);return db[_0xc271('0x1f')][_0xc271('0x27')](_0x116bf1);})['then'](function(_0x43aec7){_0x12048b[_0xc271('0x28')]=_0x43aec7;return _0x12048b;})[_0xc271('0x14')](respondWithFilteredResult(_0xbd806e,_0x116bf1))[_0xc271('0x29')](handleError(_0xbd806e,null));};exports[_0xc271('0x2a')]=function(_0x4f1140,_0x41501f){var _0x531d6f={'raw':!![],'where':{'id':_0x4f1140['params']['id']}},_0x5b3c9c={};_0x5b3c9c[_0xc271('0x2b')]=_['keys'](db[_0xc271('0x1f')]['rawAttributes']);_0x5b3c9c[_0xc271('0x26')]=_[_0xc271('0x2c')](_0x4f1140['query']);_0x5b3c9c[_0xc271('0x2d')]=_['intersection'](_0x5b3c9c[_0xc271('0x2b')],_0x5b3c9c[_0xc271('0x26')]);_0x531d6f['attributes']=_[_0xc271('0x2e')](_0x5b3c9c['model'],qs['fields'](_0x4f1140[_0xc271('0x26')][_0xc271('0x2f')]));_0x531d6f[_0xc271('0x30')]=_0x531d6f[_0xc271('0x30')][_0xc271('0x31')]?_0x531d6f[_0xc271('0x30')]:_0x5b3c9c[_0xc271('0x2b')];if(_0x4f1140[_0xc271('0x26')][_0xc271('0x32')]){_0x531d6f[_0xc271('0x25')]=[{'all':!![]}];}_0x531d6f=_[_0xc271('0x33')]({},_0x531d6f,_0x4f1140[_0xc271('0x34')]);return db[_0xc271('0x1f')][_0xc271('0x35')](_0x531d6f)['then'](handleEntityNotFound(_0x41501f,null))[_0xc271('0x14')](respondWithResult(_0x41501f,null))[_0xc271('0x29')](handleError(_0x41501f,null));};exports[_0xc271('0x36')]=function(_0x1f4dd2,_0xf3c77d){return db[_0xc271('0x1f')][_0xc271('0x36')](_0x1f4dd2[_0xc271('0x37')],{})[_0xc271('0x14')](function(_0x2b9fba){var _0x1e052=_0x1f4dd2[_0xc271('0x38')][_0xc271('0x16')]({'plain':!![]});if(!_0x1e052)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e052['role']===_0xc271('0x38')){var _0x3f79c2=_0x2b9fba['get']({'plain':!![]});var _0x482ea8='ChatQueues';return db[_0xc271('0x39')][_0xc271('0x35')]({'where':{'name':_0x482ea8,'userProfileId':_0x1e052['userProfileId']},'raw':!![]})[_0xc271('0x14')](function(_0x2cbc59){if(_0x2cbc59&&_0x2cbc59[_0xc271('0x3a')]===0x0){return db[_0xc271('0x18')][_0xc271('0x36')]({'name':_0x3f79c2['name'],'resourceId':_0x3f79c2['id'],'type':_0x2cbc59[_0xc271('0x1b')],'sectionId':_0x2cbc59['id']},{})[_0xc271('0x14')](function(){return _0x2b9fba;});}else{return _0x2b9fba;}})[_0xc271('0x29')](function(_0x224fb4){logger[_0xc271('0x19')](_0xc271('0x3b'),_0x224fb4);throw _0x224fb4;});}return _0x2b9fba;})[_0xc271('0x14')](respondWithResult(_0xf3c77d,0xc9))[_0xc271('0x29')](handleError(_0xf3c77d,null));};exports[_0xc271('0x3c')]=function(_0x48fce3,_0x227b9e){if(_0x48fce3[_0xc271('0x37')]['id']){delete _0x48fce3[_0xc271('0x37')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x48fce3[_0xc271('0x3d')]['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x227b9e,null))[_0xc271('0x14')](saveUpdates(_0x48fce3[_0xc271('0x37')],null))[_0xc271('0x14')](respondWithResult(_0x227b9e,null))[_0xc271('0x29')](handleError(_0x227b9e,null));};exports[_0xc271('0x15')]=function(_0x186cd8,_0x5f1171){return db[_0xc271('0x1f')]['find']({'where':{'id':_0x186cd8['params']['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x5f1171,null))[_0xc271('0x14')](removeEntity(_0x5f1171,null))['catch'](handleError(_0x5f1171,null));};exports[_0xc271('0x3e')]=function(_0x2affa8,_0x43233c){return db[_0xc271('0x1f')][_0xc271('0x3e')]()[_0xc271('0x14')](respondWithResult(_0x43233c,null))[_0xc271('0x29')](handleError(_0x43233c,null));};exports[_0xc271('0x3f')]=function(_0x51d3ac,_0x2c5c96){var _0x320db3={'raw':!![],'where':{}},_0x5898f5={},_0x3cc029;return db['ChatQueue'][_0xc271('0x40')]({'where':{'id':_0x51d3ac[_0xc271('0x3d')]['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x2c5c96,null))[_0xc271('0x14')](function(_0x146e33){if(_0x146e33){_0x3cc029=_0x146e33['get']({'plain':!![]});_0x5898f5[_0xc271('0x2b')]=_[_0xc271('0x2c')](db[_0xc271('0x41')][_0xc271('0x20')]);_0x5898f5[_0xc271('0x26')]=_[_0xc271('0x2c')](_0x51d3ac['query']);_0x5898f5[_0xc271('0x2d')]=_['intersection'](_0x5898f5[_0xc271('0x2b')],_0x5898f5['query']);_0x320db3['attributes']=_[_0xc271('0x2e')](_0x5898f5[_0xc271('0x2b')],qs[_0xc271('0x2f')](_0x51d3ac[_0xc271('0x26')]['fields']));_0x320db3['attributes']=_0x320db3[_0xc271('0x30')]['length']?_0x320db3[_0xc271('0x30')]:_0x5898f5['model'];if(!_0x51d3ac[_0xc271('0x26')][_0xc271('0x42')](_0xc271('0x43'))){_0x320db3[_0xc271('0x44')]=qs[_0xc271('0x44')](_0x51d3ac[_0xc271('0x26')]['limit']);_0x320db3[_0xc271('0x12')]=qs[_0xc271('0x12')](_0x51d3ac[_0xc271('0x26')][_0xc271('0x12')]);}_0x320db3['order']=qs['sort'](_0x51d3ac[_0xc271('0x26')][_0xc271('0x45')]);_0x320db3[_0xc271('0x24')]=qs[_0xc271('0x2d')](_['pick'](_0x51d3ac['query'],_0x5898f5[_0xc271('0x2d')]));_0x320db3[_0xc271('0x24')][_0xc271('0x46')]=_0x146e33['id'];if(_0x51d3ac[_0xc271('0x26')][_0xc271('0x47')]){_0x320db3[_0xc271('0x24')]=_[_0xc271('0x33')](_0x320db3[_0xc271('0x24')],{'$or':_[_0xc271('0x1e')](_0x320db3[_0xc271('0x30')],function(_0xfa84b8){var _0x508b2f={};_0x508b2f[_0xfa84b8]={'$like':'%'+_0x51d3ac[_0xc271('0x26')][_0xc271('0x47')]+'%'};return _0x508b2f;})});}_0x320db3=_[_0xc271('0x33')]({},_0x320db3,_0x51d3ac[_0xc271('0x34')]);return db[_0xc271('0x41')]['findAll'](_0x320db3);}})['then'](function(_0xf8987e){if(_0xf8987e){return db['User'][_0xc271('0x48')]({'where':{'id':_[_0xc271('0x1e')](_0xf8987e,_0xc271('0x49')),'role':_0xc271('0x4a')},'attributes':['id',_0xc271('0x1b'),'chatPause','updatedAt','createdAt']});}})[_0xc271('0x14')](function(_0x61ed2f){if(_0x61ed2f){return{'count':_0x61ed2f[_0xc271('0x11')],'rows':_[_0xc271('0x1e')](_0x61ed2f['rows'],function(_0x2536d8){return{'membername':_0x2536d8['name'],'UserId':_0x2536d8['id'],'queue_name':_0x3cc029[_0xc271('0x1b')],'ChatQueueId':_0x3cc029['id'],'interface':util[_0xc271('0x4b')](_0xc271('0x4c'),_0xc271('0x4d'),_0x2536d8[_0xc271('0x1b')]),'penalty':0x0,'paused':_0x2536d8[_0xc271('0x4e')],'createdAt':_0x2536d8[_0xc271('0x4f')],'updatedAt':_0x2536d8[_0xc271('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc271('0x14')](respondWithFilteredResult(_0x2c5c96,_0x320db3))[_0xc271('0x29')](handleError(_0x2c5c96,null));};exports['getTeams']=function(_0x16ce6a,_0x4a02e2){var _0x208efe={};var _0x44519f={};var _0x351333;var _0x128291;return db[_0xc271('0x1f')]['findOne']({'where':{'id':_0x16ce6a[_0xc271('0x3d')]['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x4a02e2,null))[_0xc271('0x14')](function(_0x3aa4d8){if(_0x3aa4d8){_0x351333=_0x3aa4d8;_0x44519f[_0xc271('0x2b')]=_[_0xc271('0x2c')](db[_0xc271('0x51')][_0xc271('0x20')]);_0x44519f[_0xc271('0x26')]=_[_0xc271('0x2c')](_0x16ce6a[_0xc271('0x26')]);_0x44519f['filters']=_[_0xc271('0x2e')](_0x44519f[_0xc271('0x2b')],_0x44519f[_0xc271('0x26')]);_0x208efe[_0xc271('0x30')]=_[_0xc271('0x2e')](_0x44519f[_0xc271('0x2b')],qs[_0xc271('0x2f')](_0x16ce6a['query'][_0xc271('0x2f')]));_0x208efe[_0xc271('0x30')]=_0x208efe['attributes'][_0xc271('0x31')]?_0x208efe[_0xc271('0x30')]:_0x44519f[_0xc271('0x2b')];_0x208efe[_0xc271('0x52')]=qs[_0xc271('0x45')](_0x16ce6a[_0xc271('0x26')][_0xc271('0x45')]);_0x208efe['where']=qs[_0xc271('0x2d')](_[_0xc271('0x53')](_0x16ce6a[_0xc271('0x26')],_0x44519f[_0xc271('0x2d')]));if(_0x16ce6a['query'][_0xc271('0x47')]){_0x208efe['where']=_['merge'](_0x208efe[_0xc271('0x24')],{'$or':_[_0xc271('0x1e')](_0x208efe[_0xc271('0x30')],function(_0x5ef708){var _0x1bf4d7={};_0x1bf4d7[_0x5ef708]={'$like':'%'+_0x16ce6a[_0xc271('0x26')][_0xc271('0x47')]+'%'};return _0x1bf4d7;})});}_0x208efe=_['merge']({},_0x208efe,_0x16ce6a['options']);return _0x351333[_0xc271('0x54')](_0x208efe);}})[_0xc271('0x14')](function(_0x387e8b){if(_0x387e8b){_0x128291=_0x387e8b[_0xc271('0x31')];if(!_0x16ce6a[_0xc271('0x26')][_0xc271('0x42')](_0xc271('0x43'))){_0x208efe[_0xc271('0x44')]=qs[_0xc271('0x44')](_0x16ce6a[_0xc271('0x26')][_0xc271('0x44')]);_0x208efe['offset']=qs[_0xc271('0x12')](_0x16ce6a[_0xc271('0x26')]['offset']);}return _0x351333['getTeams'](_0x208efe);}})[_0xc271('0x14')](function(_0x28a5fa){if(_0x28a5fa){return _0x28a5fa?{'count':_0x128291,'rows':_0x28a5fa}:null;}})[_0xc271('0x14')](respondWithResult(_0x4a02e2,null))[_0xc271('0x29')](handleError(_0x4a02e2,null));};exports[_0xc271('0x55')]=function(_0x15c561,_0x55394c){var _0x2c9e8b=_0x15c561[_0xc271('0x37')]['ids'];return db[_0xc271('0x51')]['findAll']({'where':{'id':_0x2c9e8b},'attributes':['id'],'include':[{'model':db[_0xc271('0x56')],'as':_0xc271('0x57'),'attributes':['id',_0xc271('0x1b'),_0xc271('0x58'),_0xc271('0x59'),_0xc271('0x5a')],'raw':!![]}]})[_0xc271('0x14')](function(_0x1440f2){if(_0x1440f2){var _0x18fa0d=_[_0xc271('0x5b')](_0x1440f2,function(_0x345b16){var _0x3d980c=_0x345b16['get']({'plain':!![]});return _0x3d980c[_0xc271('0x57')];});return db[_0xc271('0x1f')]['find']({'where':{'id':_0x15c561[_0xc271('0x3d')]['id']}})[_0xc271('0x14')](function(_0x19b19a){return db['sequelize'][_0xc271('0x5c')](function(_0x119d6b){return _0x19b19a[_0xc271('0x55')](_0x2c9e8b,{'transaction':_0x119d6b})[_0xc271('0x14')](function(){return BPromise[_0xc271('0x5d')](_0x18fa0d,function(_0x345075){return db[_0xc271('0x41')][_0xc271('0x5e')]({'where':{'UserId':_0x345075['id'],'ChatQueueId':_0x15c561['params']['id']},'transaction':_0x119d6b});});})[_0xc271('0x14')](function(){_0x18fa0d[_0xc271('0x5f')](function(_0x2c8726){socket['emit']('userChatQueue:save',{'UserId':_0x2c8726['id'],'ChatQueueId':_0x19b19a['id']});});});});});}})[_0xc271('0x14')](respondWithStatusCode(_0x55394c,null))[_0xc271('0x29')](handleError(_0x55394c,null));};exports['removeTeams']=function(_0x1da0c6,_0xe297a5){return db['Team'][_0xc271('0x27')]({'where':{'id':_0x1da0c6['query'][_0xc271('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc271('0x57'),'attributes':['id'],'raw':!![]}]})[_0xc271('0x14')](handleEntityNotFound(_0xe297a5,null))[_0xc271('0x14')](function(_0x3d9476){var _0x2d9be8=_['map'](_0x3d9476,'id');var _0x3f5575=[];var _0x3e2c39=[];var _0x22c1e8=squel[_0xc271('0x61')]();_0x22c1e8[_0xc271('0x62')](_0xc271('0x63'))[_0xc271('0x64')](_0xc271('0x65'),'tq')['join'](_0xc271('0x66'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc271('0x24')](_0xc271('0x67'),_0x1da0c6[_0xc271('0x3d')]['id']);for(var _0xe9989c=0x0;_0xe9989c<_0x3d9476[_0xc271('0x31')];_0xe9989c+=0x1){let _0x12257d=_0x3d9476[_0xe9989c];for(var _0x2f91e4=0x0;_0x2f91e4<_0x12257d['Agents'][_0xc271('0x31')];_0x2f91e4+=0x1){let _0x2f03c9=_0x12257d['Agents'][_0x2f91e4];var _0x1d41c8=_0x22c1e8[_0xc271('0x68')]();_0x1d41c8['where'](_0xc271('0x69'),_0x2f03c9['id']);_0x3e2c39['push'](db['sequelize'][_0xc271('0x26')](_0x1d41c8['toString'](),{'type':db[_0xc271('0x6a')][_0xc271('0x6b')][_0xc271('0x6c')]})[_0xc271('0x14')](function(_0x27c378){if(_0x27c378['length']===0x1){return _0x2f03c9['id'];}else{var _0x13aa51=_[_0xc271('0x6d')](_['map'](_0x27c378,_0xc271('0x6e')),function(_0x1fee1e){return _[_0xc271('0x6f')](_0x2d9be8,_0x1fee1e);});if(_0x13aa51){return _0x2f03c9['id'];}}}));}}return BPromise[_0xc271('0x70')](_0x3e2c39)[_0xc271('0x14')](function(_0x362ee3){_0x3f5575=_(_0x3f5575)[_0xc271('0x71')](_0x362ee3)['compact']()[_0xc271('0x72')]();return db[_0xc271('0x1f')][_0xc271('0x35')]({'where':{'id':_0x1da0c6[_0xc271('0x3d')]['id']}})[_0xc271('0x14')](function(_0x4a7dd3){return db['sequelize'][_0xc271('0x5c')](function(_0xa8332f){return _0x4a7dd3[_0xc271('0x73')](_0x1da0c6[_0xc271('0x26')][_0xc271('0x60')],{'transaction':_0xa8332f})[_0xc271('0x14')](function(){if(!_[_0xc271('0x74')](_0x3f5575)){return _0x4a7dd3[_0xc271('0x75')](_0x3f5575,{'transaction':_0xa8332f});}})[_0xc271('0x14')](function(){_0x3f5575[_0xc271('0x5f')](function(_0x2954f3){socket[_0xc271('0x76')](_0xc271('0x77'),{'UserId':_0x2954f3,'ChatQueueId':_0x4a7dd3['id']});});});});});});})['then'](respondWithStatusCode(_0xe297a5,null))[_0xc271('0x29')](handleError(_0xe297a5,null));};exports['addAgents']=function(_0x3ed1da,_0x3788b2){return db['ChatQueue'][_0xc271('0x35')]({'where':{'id':_0x3ed1da[_0xc271('0x3d')]['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x3788b2,null))[_0xc271('0x14')](function(_0x358d6f){if(_0x358d6f){return _0x358d6f[_0xc271('0x78')](_0x3ed1da[_0xc271('0x37')][_0xc271('0x60')],_[_0xc271('0x79')](_0x3ed1da[_0xc271('0x37')],[_0xc271('0x60'),'id'])||{})[_0xc271('0x7a')](function(_0x3727da){for(var _0x4859b3=0x0;_0x4859b3<_0x3ed1da[_0xc271('0x37')][_0xc271('0x60')][_0xc271('0x31')];_0x4859b3+=0x1){socket[_0xc271('0x76')](_0xc271('0x7b'),{'UserId':Number(_0x3ed1da[_0xc271('0x37')]['ids'][_0x4859b3]),'ChatQueueId':Number(_0x3ed1da['params']['id'])});}return _0x3727da;});}})[_0xc271('0x14')](respondWithResult(_0x3788b2,null))[_0xc271('0x29')](handleError(_0x3788b2,null));};exports['removeAgents']=function(_0x5ed932,_0x3dcf22){return db[_0xc271('0x1f')][_0xc271('0x35')]({'where':{'id':_0x5ed932['params']['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x3dcf22,null))[_0xc271('0x14')](function(_0x6baddc){if(_0x6baddc){return _0x6baddc[_0xc271('0x75')](_0x5ed932[_0xc271('0x26')][_0xc271('0x60')])[_0xc271('0x14')](function(){if(_[_0xc271('0x7c')](_0x5ed932['query'][_0xc271('0x60')])){for(var _0x1ab8a8=0x0;_0x1ab8a8<_0x5ed932[_0xc271('0x26')][_0xc271('0x60')]['length'];_0x1ab8a8+=0x1){socket[_0xc271('0x76')](_0xc271('0x77'),{'UserId':Number(_0x5ed932[_0xc271('0x26')][_0xc271('0x60')][_0x1ab8a8]),'ChatQueueId':Number(_0x5ed932[_0xc271('0x3d')]['id'])});}}else{socket[_0xc271('0x76')](_0xc271('0x77'),{'UserId':Number(_0x5ed932[_0xc271('0x26')]['ids']),'ChatQueueId':Number(_0x5ed932[_0xc271('0x3d')]['id'])});}});}})[_0xc271('0x14')](respondWithStatusCode(_0x3dcf22,null))['catch'](handleError(_0x3dcf22,null));};exports[_0xc271('0x7d')]=function(_0x23b120,_0x12eda0){var _0xf8a161={};var _0xe4f7b8={};var _0xad6455;var _0x552e75;return db[_0xc271('0x1f')][_0xc271('0x40')]({'where':{'id':_0x23b120['params']['id']}})[_0xc271('0x14')](handleEntityNotFound(_0x12eda0,null))[_0xc271('0x14')](function(_0x33fe7e){if(_0x33fe7e){_0xad6455=_0x33fe7e;_0xe4f7b8[_0xc271('0x2b')]=_[_0xc271('0x2c')](db[_0xc271('0x56')]['rawAttributes']);_0xe4f7b8[_0xc271('0x26')]=_[_0xc271('0x2c')](_0x23b120[_0xc271('0x26')]);_0xe4f7b8[_0xc271('0x2d')]=_[_0xc271('0x2e')](_0xe4f7b8[_0xc271('0x2b')],_0xe4f7b8[_0xc271('0x26')]);_0xf8a161[_0xc271('0x30')]=_['intersection'](_0xe4f7b8[_0xc271('0x2b')],qs[_0xc271('0x2f')](_0x23b120[_0xc271('0x26')][_0xc271('0x2f')]));_0xf8a161[_0xc271('0x30')]=_0xf8a161[_0xc271('0x30')][_0xc271('0x31')]?_0xf8a161[_0xc271('0x30')]:_0xe4f7b8['model'];_0xf8a161[_0xc271('0x52')]=qs[_0xc271('0x45')](_0x23b120[_0xc271('0x26')][_0xc271('0x45')]);_0xf8a161[_0xc271('0x24')]=qs[_0xc271('0x2d')](_[_0xc271('0x53')](_0x23b120[_0xc271('0x26')],_0xe4f7b8['filters']));if(_0x23b120[_0xc271('0x26')][_0xc271('0x47')]){_0xf8a161['where']=_[_0xc271('0x33')](_0xf8a161[_0xc271('0x24')],{'$or':_[_0xc271('0x1e')](_0xf8a161[_0xc271('0x30')],function(_0x3d890e){var _0x4f0c1d={};_0x4f0c1d[_0x3d890e]={'$like':'%'+_0x23b120['query'][_0xc271('0x47')]+'%'};return _0x4f0c1d;})});}_0xf8a161=_[_0xc271('0x33')]({},_0xf8a161,_0x23b120[_0xc271('0x34')]);return _0xad6455[_0xc271('0x7d')](_0xf8a161);}})[_0xc271('0x14')](function(_0x2e25ed){if(_0x2e25ed){_0x552e75=_0x2e25ed[_0xc271('0x31')];if(!_0x23b120['query']['hasOwnProperty'](_0xc271('0x43'))){_0xf8a161[_0xc271('0x44')]=qs['limit'](_0x23b120[_0xc271('0x26')][_0xc271('0x44')]);_0xf8a161['offset']=qs[_0xc271('0x12')](_0x23b120[_0xc271('0x26')][_0xc271('0x12')]);}return _0xad6455[_0xc271('0x7d')](_0xf8a161);}})['then'](function(_0x3b8d03){if(_0x3b8d03){return _0x3b8d03?{'count':_0x552e75,'rows':_0x3b8d03}:null;}})[_0xc271('0x14')](respondWithResult(_0x12eda0,null))[_0xc271('0x29')](handleError(_0x12eda0,null));}; \ No newline at end of file +var _0xede7=['forEach','emit','userChatQueue:save','removeTeams','ids','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','ChatQueues','UserProfileResource','error','name','send','map','key','getOptions','ChatQueue','include','query','findAll','rows','catch','show','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','where','pick','ChatQueueId','filter','options','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate'];(function(_0x76dd04,_0x3435b2){var _0x169555=function(_0x1319f6){while(--_0x1319f6){_0x76dd04['push'](_0x76dd04['shift']());}};_0x169555(++_0x3435b2);}(_0xede7,0x187));var _0x7ede=function(_0x398bdb,_0x1d0c93){_0x398bdb=_0x398bdb-0x0;var _0x7ec9a4=_0xede7[_0x398bdb];return _0x7ec9a4;};'use strict';var BPromise=require(_0x7ede('0x0'));var util=require('util');var _=require(_0x7ede('0x1'));var squel=require(_0x7ede('0x2'));var Redis=require(_0x7ede('0x3'));var qs=require(_0x7ede('0x4'));var logger=require(_0x7ede('0x5'))(_0x7ede('0x6'));var config=require('../../config/environment');var db=require(_0x7ede('0x7'))['db'];config[_0x7ede('0x8')]=_[_0x7ede('0x9')](config['redis'],{'host':_0x7ede('0xa'),'port':0x18eb});var socket=require(_0x7ede('0xb'))(new Redis(config[_0x7ede('0x8')]));require(_0x7ede('0xc'))[_0x7ede('0xd')](socket);function respondWithStatusCode(_0x944e0b,_0x2ba383){_0x2ba383=_0x2ba383||0xcc;return function(_0xe75dd9){if(_0xe75dd9){return _0x944e0b[_0x7ede('0xe')](_0x2ba383);}return _0x944e0b[_0x7ede('0xf')](_0x2ba383)[_0x7ede('0x10')]();};}function respondWithResult(_0x2ea530,_0x5bc2f9){_0x5bc2f9=_0x5bc2f9||0xc8;return function(_0x2c6517){if(_0x2c6517){return _0x2ea530['status'](_0x5bc2f9)['json'](_0x2c6517);}};}function respondWithFilteredResult(_0x509336,_0x5ed352){return function(_0x1e1676){if(_0x1e1676){var _0x10cc44=typeof _0x5ed352[_0x7ede('0x11')]===_0x7ede('0x12')&&typeof _0x5ed352[_0x7ede('0x13')]===_0x7ede('0x12');var _0x457924=_0x1e1676[_0x7ede('0x14')];var _0x2ce0f1=_0x10cc44?0x0:_0x5ed352[_0x7ede('0x11')];var _0x4f05d0=_0x10cc44?_0x1e1676[_0x7ede('0x14')]:_0x5ed352[_0x7ede('0x11')]+_0x5ed352[_0x7ede('0x13')];var _0x57e7e8;if(_0x4f05d0>=_0x457924){_0x4f05d0=_0x457924;_0x57e7e8=0xc8;}else{_0x57e7e8=0xce;}_0x509336[_0x7ede('0xf')](_0x57e7e8);return _0x509336[_0x7ede('0x15')](_0x7ede('0x16'),_0x2ce0f1+'-'+_0x4f05d0+'/'+_0x457924)[_0x7ede('0x17')](_0x1e1676);}return null;};}function saveUpdates(_0x29f022){return function(_0x4217e5){if(_0x4217e5){return _0x4217e5[_0x7ede('0x18')](_0x29f022)[_0x7ede('0x19')](function(_0x157d4b){return _0x157d4b;});}return null;};}function removeEntity(_0x447d0b){return function(_0x1ed269){if(_0x1ed269){return _0x1ed269[_0x7ede('0x1a')]()['then'](function(){var _0x24a312=_0x1ed269['get']({'plain':!![]});var _0x34a44e=_0x7ede('0x1b');return db[_0x7ede('0x1c')][_0x7ede('0x1a')]({'where':{'type':_0x34a44e,'resourceId':_0x24a312['id']}})[_0x7ede('0x19')](function(){return _0x1ed269;});})['then'](function(){_0x447d0b[_0x7ede('0xf')](0xcc)[_0x7ede('0x10')]();});}};}function handleEntityNotFound(_0x454bc5){return function(_0x3312e4){if(!_0x3312e4){_0x454bc5['sendStatus'](0x194);}return _0x3312e4;};}function handleError(_0x3d8ed6,_0x220d6b){_0x220d6b=_0x220d6b||0x1f4;return function(_0x1209c5){logger[_0x7ede('0x1d')](_0x1209c5['stack']);if(_0x1209c5[_0x7ede('0x1e')]){delete _0x1209c5[_0x7ede('0x1e')];}_0x3d8ed6[_0x7ede('0xf')](_0x220d6b)[_0x7ede('0x1f')](_0x1209c5);};}exports['index']=function(_0x50a03c,_0x5786b1){var _0x3ed927={};var _0x4c4a2a={'count':0x0,'rows':[]};var _0x28f287=_[_0x7ede('0x20')](db['ChatQueue']['rawAttributes'],function(_0x3f44d8){return{'name':_0x3f44d8['fieldName'],'type':_0x3f44d8['type'][_0x7ede('0x21')]};});_0x3ed927=qs[_0x7ede('0x22')](_0x28f287,_0x50a03c);var _0x28d311={'where':_0x3ed927['where']};return db[_0x7ede('0x23')][_0x7ede('0x14')](_0x28d311)[_0x7ede('0x19')](function(_0x285560){_0x4c4a2a['count']=_0x285560;_0x3ed927[_0x7ede('0x24')]=qs['include'](_0x50a03c[_0x7ede('0x25')]);return db[_0x7ede('0x23')][_0x7ede('0x26')](_0x3ed927);})[_0x7ede('0x19')](function(_0x303cc2){_0x4c4a2a[_0x7ede('0x27')]=_0x303cc2;return _0x4c4a2a;})[_0x7ede('0x19')](respondWithFilteredResult(_0x5786b1,_0x3ed927))[_0x7ede('0x28')](handleError(_0x5786b1,null));};exports[_0x7ede('0x29')]=function(_0x29cf9e,_0x4ca287){var _0x233ac4={'raw':!![],'where':{'id':_0x29cf9e['params']['id']}},_0x3a7405={};_0x3a7405[_0x7ede('0x2a')]=_[_0x7ede('0x2b')](db['ChatQueue'][_0x7ede('0x2c')]);_0x3a7405[_0x7ede('0x25')]=_[_0x7ede('0x2b')](_0x29cf9e['query']);_0x3a7405[_0x7ede('0x2d')]=_[_0x7ede('0x2e')](_0x3a7405[_0x7ede('0x2a')],_0x3a7405['query']);_0x233ac4['attributes']=_[_0x7ede('0x2e')](_0x3a7405[_0x7ede('0x2a')],qs[_0x7ede('0x2f')](_0x29cf9e[_0x7ede('0x25')][_0x7ede('0x2f')]));_0x233ac4[_0x7ede('0x30')]=_0x233ac4[_0x7ede('0x30')][_0x7ede('0x31')]?_0x233ac4[_0x7ede('0x30')]:_0x3a7405[_0x7ede('0x2a')];if(_0x29cf9e[_0x7ede('0x25')][_0x7ede('0x32')]){_0x233ac4[_0x7ede('0x24')]=[{'all':!![]}];}_0x233ac4=_[_0x7ede('0x33')]({},_0x233ac4,_0x29cf9e['options']);return db[_0x7ede('0x23')][_0x7ede('0x34')](_0x233ac4)['then'](handleEntityNotFound(_0x4ca287,null))[_0x7ede('0x19')](respondWithResult(_0x4ca287,null))[_0x7ede('0x28')](handleError(_0x4ca287,null));};exports[_0x7ede('0x35')]=function(_0x17eb8,_0x9f498){return db[_0x7ede('0x23')][_0x7ede('0x35')](_0x17eb8[_0x7ede('0x36')],{})[_0x7ede('0x19')](function(_0x4499ff){var _0xa1801b=_0x17eb8[_0x7ede('0x37')][_0x7ede('0x38')]({'plain':!![]});if(!_0xa1801b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1801b[_0x7ede('0x39')]===_0x7ede('0x37')){var _0x298a78=_0x4499ff[_0x7ede('0x38')]({'plain':!![]});var _0x2c7bc3=_0x7ede('0x1b');return db[_0x7ede('0x3a')][_0x7ede('0x34')]({'where':{'name':_0x2c7bc3,'userProfileId':_0xa1801b['userProfileId']},'raw':!![]})[_0x7ede('0x19')](function(_0x599baa){if(_0x599baa&&_0x599baa[_0x7ede('0x3b')]===0x0){return db[_0x7ede('0x1c')][_0x7ede('0x35')]({'name':_0x298a78[_0x7ede('0x1e')],'resourceId':_0x298a78['id'],'type':_0x599baa[_0x7ede('0x1e')],'sectionId':_0x599baa['id']},{})[_0x7ede('0x19')](function(){return _0x4499ff;});}else{return _0x4499ff;}})['catch'](function(_0x243e95){logger[_0x7ede('0x1d')](_0x7ede('0x3c'),_0x243e95);throw _0x243e95;});}return _0x4499ff;})[_0x7ede('0x19')](respondWithResult(_0x9f498,0xc9))[_0x7ede('0x28')](handleError(_0x9f498,null));};exports['update']=function(_0x3649c1,_0x6eba2f){if(_0x3649c1['body']['id']){delete _0x3649c1[_0x7ede('0x36')]['id'];}return db[_0x7ede('0x23')]['find']({'where':{'id':_0x3649c1[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x6eba2f,null))[_0x7ede('0x19')](saveUpdates(_0x3649c1[_0x7ede('0x36')],null))[_0x7ede('0x19')](respondWithResult(_0x6eba2f,null))[_0x7ede('0x28')](handleError(_0x6eba2f,null));};exports['destroy']=function(_0x1deacd,_0x5b6d4b){return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x1deacd[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x5b6d4b,null))[_0x7ede('0x19')](removeEntity(_0x5b6d4b,null))[_0x7ede('0x28')](handleError(_0x5b6d4b,null));};exports[_0x7ede('0x3e')]=function(_0x37b070,_0x1236bb){return db[_0x7ede('0x23')][_0x7ede('0x3e')]()[_0x7ede('0x19')](respondWithResult(_0x1236bb,null))['catch'](handleError(_0x1236bb,null));};exports['getMembers']=function(_0x15b3e9,_0x5daf2e){var _0x2a2b5e={'raw':!![],'where':{}},_0x538a6a={},_0x24e009;return db['ChatQueue'][_0x7ede('0x3f')]({'where':{'id':_0x15b3e9[_0x7ede('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5daf2e,null))['then'](function(_0x33a71a){if(_0x33a71a){_0x24e009=_0x33a71a[_0x7ede('0x38')]({'plain':!![]});_0x538a6a[_0x7ede('0x2a')]=_[_0x7ede('0x2b')](db[_0x7ede('0x40')][_0x7ede('0x2c')]);_0x538a6a[_0x7ede('0x25')]=_[_0x7ede('0x2b')](_0x15b3e9[_0x7ede('0x25')]);_0x538a6a[_0x7ede('0x2d')]=_[_0x7ede('0x2e')](_0x538a6a[_0x7ede('0x2a')],_0x538a6a[_0x7ede('0x25')]);_0x2a2b5e[_0x7ede('0x30')]=_[_0x7ede('0x2e')](_0x538a6a['model'],qs['fields'](_0x15b3e9[_0x7ede('0x25')]['fields']));_0x2a2b5e[_0x7ede('0x30')]=_0x2a2b5e[_0x7ede('0x30')]['length']?_0x2a2b5e['attributes']:_0x538a6a[_0x7ede('0x2a')];if(!_0x15b3e9[_0x7ede('0x25')][_0x7ede('0x41')](_0x7ede('0x42'))){_0x2a2b5e[_0x7ede('0x13')]=qs[_0x7ede('0x13')](_0x15b3e9[_0x7ede('0x25')][_0x7ede('0x13')]);_0x2a2b5e[_0x7ede('0x11')]=qs[_0x7ede('0x11')](_0x15b3e9['query'][_0x7ede('0x11')]);}_0x2a2b5e[_0x7ede('0x43')]=qs['sort'](_0x15b3e9['query'][_0x7ede('0x44')]);_0x2a2b5e[_0x7ede('0x45')]=qs[_0x7ede('0x2d')](_[_0x7ede('0x46')](_0x15b3e9[_0x7ede('0x25')],_0x538a6a[_0x7ede('0x2d')]));_0x2a2b5e[_0x7ede('0x45')][_0x7ede('0x47')]=_0x33a71a['id'];if(_0x15b3e9[_0x7ede('0x25')][_0x7ede('0x48')]){_0x2a2b5e['where']=_[_0x7ede('0x33')](_0x2a2b5e[_0x7ede('0x45')],{'$or':_[_0x7ede('0x20')](_0x2a2b5e[_0x7ede('0x30')],function(_0x3c1de7){var _0x4efbee={};_0x4efbee[_0x3c1de7]={'$like':'%'+_0x15b3e9[_0x7ede('0x25')]['filter']+'%'};return _0x4efbee;})});}_0x2a2b5e=_[_0x7ede('0x33')]({},_0x2a2b5e,_0x15b3e9[_0x7ede('0x49')]);return db[_0x7ede('0x40')]['findAll'](_0x2a2b5e);}})['then'](function(_0x5008f1){if(_0x5008f1){return db[_0x7ede('0x4a')][_0x7ede('0x4b')]({'where':{'id':_[_0x7ede('0x20')](_0x5008f1,_0x7ede('0x4c')),'role':_0x7ede('0x4d')},'attributes':['id',_0x7ede('0x1e'),_0x7ede('0x4e'),_0x7ede('0x4f'),_0x7ede('0x50')]});}})[_0x7ede('0x19')](function(_0x509ba4){if(_0x509ba4){return{'count':_0x509ba4['count'],'rows':_[_0x7ede('0x20')](_0x509ba4[_0x7ede('0x27')],function(_0x102c34){return{'membername':_0x102c34['name'],'UserId':_0x102c34['id'],'queue_name':_0x24e009[_0x7ede('0x1e')],'ChatQueueId':_0x24e009['id'],'interface':util[_0x7ede('0x51')](_0x7ede('0x52'),'SIP',_0x102c34['name']),'penalty':0x0,'paused':_0x102c34['chatPause'],'createdAt':_0x102c34[_0x7ede('0x50')],'updatedAt':_0x102c34['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ede('0x19')](respondWithFilteredResult(_0x5daf2e,_0x2a2b5e))[_0x7ede('0x28')](handleError(_0x5daf2e,null));};exports[_0x7ede('0x53')]=function(_0x1c02d7,_0x2506a6){var _0x16b210={};var _0x3d6129={};var _0x416bcb;var _0x476a0d;return db[_0x7ede('0x23')][_0x7ede('0x3f')]({'where':{'id':_0x1c02d7[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x2506a6,null))[_0x7ede('0x19')](function(_0x3edcfa){if(_0x3edcfa){_0x416bcb=_0x3edcfa;_0x3d6129['model']=_['keys'](db[_0x7ede('0x54')][_0x7ede('0x2c')]);_0x3d6129['query']=_[_0x7ede('0x2b')](_0x1c02d7['query']);_0x3d6129[_0x7ede('0x2d')]=_[_0x7ede('0x2e')](_0x3d6129[_0x7ede('0x2a')],_0x3d6129[_0x7ede('0x25')]);_0x16b210[_0x7ede('0x30')]=_['intersection'](_0x3d6129[_0x7ede('0x2a')],qs[_0x7ede('0x2f')](_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x2f')]));_0x16b210['attributes']=_0x16b210[_0x7ede('0x30')][_0x7ede('0x31')]?_0x16b210[_0x7ede('0x30')]:_0x3d6129['model'];_0x16b210[_0x7ede('0x43')]=qs['sort'](_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x44')]);_0x16b210[_0x7ede('0x45')]=qs['filters'](_[_0x7ede('0x46')](_0x1c02d7[_0x7ede('0x25')],_0x3d6129[_0x7ede('0x2d')]));if(_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x48')]){_0x16b210[_0x7ede('0x45')]=_[_0x7ede('0x33')](_0x16b210[_0x7ede('0x45')],{'$or':_[_0x7ede('0x20')](_0x16b210[_0x7ede('0x30')],function(_0x2d132a){var _0x5162f4={};_0x5162f4[_0x2d132a]={'$like':'%'+_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x48')]+'%'};return _0x5162f4;})});}_0x16b210=_[_0x7ede('0x33')]({},_0x16b210,_0x1c02d7[_0x7ede('0x49')]);return _0x416bcb[_0x7ede('0x53')](_0x16b210);}})['then'](function(_0x5a5dd7){if(_0x5a5dd7){_0x476a0d=_0x5a5dd7[_0x7ede('0x31')];if(!_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x41')](_0x7ede('0x42'))){_0x16b210[_0x7ede('0x13')]=qs[_0x7ede('0x13')](_0x1c02d7['query'][_0x7ede('0x13')]);_0x16b210[_0x7ede('0x11')]=qs[_0x7ede('0x11')](_0x1c02d7[_0x7ede('0x25')][_0x7ede('0x11')]);}return _0x416bcb[_0x7ede('0x53')](_0x16b210);}})[_0x7ede('0x19')](function(_0x5227b7){if(_0x5227b7){return _0x5227b7?{'count':_0x476a0d,'rows':_0x5227b7}:null;}})['then'](respondWithResult(_0x2506a6,null))[_0x7ede('0x28')](handleError(_0x2506a6,null));};exports[_0x7ede('0x55')]=function(_0x547ff1,_0x2f81ee){var _0x35f163=_0x547ff1[_0x7ede('0x36')]['ids'];return db[_0x7ede('0x54')][_0x7ede('0x26')]({'where':{'id':_0x35f163},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7ede('0x56'),'attributes':['id',_0x7ede('0x1e'),_0x7ede('0x57'),_0x7ede('0x58'),'interface'],'raw':!![]}]})[_0x7ede('0x19')](function(_0x323bfc){if(_0x323bfc){var _0x400b0c=_[_0x7ede('0x59')](_0x323bfc,function(_0x43f81f){var _0x45fc1b=_0x43f81f[_0x7ede('0x38')]({'plain':!![]});return _0x45fc1b[_0x7ede('0x56')];});return db[_0x7ede('0x23')]['find']({'where':{'id':_0x547ff1['params']['id']}})['then'](function(_0x38ced4){return db[_0x7ede('0x5a')][_0x7ede('0x5b')](function(_0x3375f7){return _0x38ced4[_0x7ede('0x55')](_0x35f163,{'transaction':_0x3375f7})['then'](function(){return BPromise['each'](_0x400b0c,function(_0x40eaba){return db[_0x7ede('0x40')][_0x7ede('0x5c')]({'where':{'UserId':_0x40eaba['id'],'ChatQueueId':_0x547ff1[_0x7ede('0x3d')]['id']},'transaction':_0x3375f7});});})[_0x7ede('0x19')](function(){_0x400b0c[_0x7ede('0x5d')](function(_0x1007dd){socket[_0x7ede('0x5e')](_0x7ede('0x5f'),{'UserId':_0x1007dd['id'],'ChatQueueId':_0x38ced4['id']});});});});});}})[_0x7ede('0x19')](respondWithStatusCode(_0x2f81ee,null))[_0x7ede('0x28')](handleError(_0x2f81ee,null));};exports[_0x7ede('0x60')]=function(_0x19edb4,_0x24d3b6){return db['Team'][_0x7ede('0x26')]({'where':{'id':_0x19edb4[_0x7ede('0x25')][_0x7ede('0x61')]},'attributes':['id'],'include':[{'model':db[_0x7ede('0x4a')],'as':_0x7ede('0x56'),'attributes':['id'],'raw':!![]}]})[_0x7ede('0x19')](handleEntityNotFound(_0x24d3b6,null))[_0x7ede('0x19')](function(_0x1b3450){var _0x339126=_[_0x7ede('0x20')](_0x1b3450,'id');var _0x1415af=[];var _0xd6643a=[];var _0xd06d8a=squel['select']();_0xd06d8a[_0x7ede('0x62')](_0x7ede('0x63'))['from'](_0x7ede('0x64'),'tq')[_0x7ede('0x65')](_0x7ede('0x66'),'ut',_0x7ede('0x67'))[_0x7ede('0x45')]('ChatQueueId\x20=\x20?',_0x19edb4[_0x7ede('0x3d')]['id']);for(var _0x212320=0x0;_0x212320<_0x1b3450[_0x7ede('0x31')];_0x212320+=0x1){let _0x1653fd=_0x1b3450[_0x212320];for(var _0x2d584e=0x0;_0x2d584e<_0x1653fd['Agents'][_0x7ede('0x31')];_0x2d584e+=0x1){let _0x50660d=_0x1653fd[_0x7ede('0x56')][_0x2d584e];var _0x3303e1=_0xd06d8a[_0x7ede('0x68')]();_0x3303e1[_0x7ede('0x45')](_0x7ede('0x69'),_0x50660d['id']);_0xd6643a[_0x7ede('0x6a')](db['sequelize'][_0x7ede('0x25')](_0x3303e1['toString'](),{'type':db[_0x7ede('0x5a')]['QueryTypes']['SELECT']})[_0x7ede('0x19')](function(_0x4fb27e){if(_0x4fb27e[_0x7ede('0x31')]===0x1){return _0x50660d['id'];}else{var _0x1203cf=_[_0x7ede('0x6b')](_[_0x7ede('0x20')](_0x4fb27e,_0x7ede('0x6c')),function(_0x24de4b){return _[_0x7ede('0x6d')](_0x339126,_0x24de4b);});if(_0x1203cf){return _0x50660d['id'];}}}));}}return BPromise[_0x7ede('0x6e')](_0xd6643a)[_0x7ede('0x19')](function(_0x78c6e1){_0x1415af=_(_0x1415af)[_0x7ede('0x6f')](_0x78c6e1)['compact']()[_0x7ede('0x70')]();return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x19edb4[_0x7ede('0x3d')]['id']}})[_0x7ede('0x19')](function(_0xcff138){return db[_0x7ede('0x5a')][_0x7ede('0x5b')](function(_0x58ded8){return _0xcff138[_0x7ede('0x60')](_0x19edb4[_0x7ede('0x25')][_0x7ede('0x61')],{'transaction':_0x58ded8})[_0x7ede('0x19')](function(){if(!_[_0x7ede('0x71')](_0x1415af)){return _0xcff138['removeAgents'](_0x1415af,{'transaction':_0x58ded8});}})[_0x7ede('0x19')](function(){_0x1415af[_0x7ede('0x5d')](function(_0x378f7a){socket['emit'](_0x7ede('0x72'),{'UserId':_0x378f7a,'ChatQueueId':_0xcff138['id']});});});});});});})['then'](respondWithStatusCode(_0x24d3b6,null))[_0x7ede('0x28')](handleError(_0x24d3b6,null));};exports[_0x7ede('0x73')]=function(_0x4f2240,_0x4593c3){return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x4f2240[_0x7ede('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4593c3,null))[_0x7ede('0x19')](function(_0x1f2b47){if(_0x1f2b47){return _0x1f2b47['addAgents'](_0x4f2240['body'][_0x7ede('0x61')],_[_0x7ede('0x74')](_0x4f2240[_0x7ede('0x36')],[_0x7ede('0x61'),'id'])||{})[_0x7ede('0x75')](function(_0x5cfc51){for(var _0x261a5c=0x0;_0x261a5c<_0x4f2240[_0x7ede('0x36')][_0x7ede('0x61')]['length'];_0x261a5c+=0x1){socket[_0x7ede('0x5e')](_0x7ede('0x5f'),{'UserId':Number(_0x4f2240[_0x7ede('0x36')][_0x7ede('0x61')][_0x261a5c]),'ChatQueueId':Number(_0x4f2240[_0x7ede('0x3d')]['id'])});}return _0x5cfc51;});}})['then'](respondWithResult(_0x4593c3,null))[_0x7ede('0x28')](handleError(_0x4593c3,null));};exports[_0x7ede('0x76')]=function(_0x3235d0,_0x18f562){return db[_0x7ede('0x23')][_0x7ede('0x34')]({'where':{'id':_0x3235d0['params']['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0x18f562,null))['then'](function(_0x1a599e){if(_0x1a599e){return _0x1a599e['removeAgents'](_0x3235d0[_0x7ede('0x25')]['ids'])['then'](function(){if(_[_0x7ede('0x77')](_0x3235d0[_0x7ede('0x25')][_0x7ede('0x61')])){for(var _0x4ec037=0x0;_0x4ec037<_0x3235d0[_0x7ede('0x25')][_0x7ede('0x61')][_0x7ede('0x31')];_0x4ec037+=0x1){socket[_0x7ede('0x5e')](_0x7ede('0x72'),{'UserId':Number(_0x3235d0[_0x7ede('0x25')][_0x7ede('0x61')][_0x4ec037]),'ChatQueueId':Number(_0x3235d0[_0x7ede('0x3d')]['id'])});}}else{socket[_0x7ede('0x5e')](_0x7ede('0x72'),{'UserId':Number(_0x3235d0['query'][_0x7ede('0x61')]),'ChatQueueId':Number(_0x3235d0[_0x7ede('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x18f562,null))[_0x7ede('0x28')](handleError(_0x18f562,null));};exports[_0x7ede('0x78')]=function(_0x31b08a,_0xccb022){var _0x99bd14={};var _0x18effa={};var _0x598513;var _0x461087;return db[_0x7ede('0x23')]['findOne']({'where':{'id':_0x31b08a['params']['id']}})[_0x7ede('0x19')](handleEntityNotFound(_0xccb022,null))[_0x7ede('0x19')](function(_0x560750){if(_0x560750){_0x598513=_0x560750;_0x18effa[_0x7ede('0x2a')]=_[_0x7ede('0x2b')](db['User'][_0x7ede('0x2c')]);_0x18effa[_0x7ede('0x25')]=_[_0x7ede('0x2b')](_0x31b08a[_0x7ede('0x25')]);_0x18effa[_0x7ede('0x2d')]=_['intersection'](_0x18effa[_0x7ede('0x2a')],_0x18effa['query']);_0x99bd14['attributes']=_[_0x7ede('0x2e')](_0x18effa[_0x7ede('0x2a')],qs[_0x7ede('0x2f')](_0x31b08a['query'][_0x7ede('0x2f')]));_0x99bd14['attributes']=_0x99bd14[_0x7ede('0x30')][_0x7ede('0x31')]?_0x99bd14[_0x7ede('0x30')]:_0x18effa[_0x7ede('0x2a')];_0x99bd14['order']=qs['sort'](_0x31b08a[_0x7ede('0x25')][_0x7ede('0x44')]);_0x99bd14[_0x7ede('0x45')]=qs[_0x7ede('0x2d')](_[_0x7ede('0x46')](_0x31b08a[_0x7ede('0x25')],_0x18effa[_0x7ede('0x2d')]));if(_0x31b08a[_0x7ede('0x25')]['filter']){_0x99bd14['where']=_[_0x7ede('0x33')](_0x99bd14[_0x7ede('0x45')],{'$or':_[_0x7ede('0x20')](_0x99bd14[_0x7ede('0x30')],function(_0x21f4f9){var _0x1968ec={};_0x1968ec[_0x21f4f9]={'$like':'%'+_0x31b08a[_0x7ede('0x25')][_0x7ede('0x48')]+'%'};return _0x1968ec;})});}_0x99bd14=_[_0x7ede('0x33')]({},_0x99bd14,_0x31b08a[_0x7ede('0x49')]);return _0x598513['getAgents'](_0x99bd14);}})['then'](function(_0x4e1ddb){if(_0x4e1ddb){_0x461087=_0x4e1ddb['length'];if(!_0x31b08a[_0x7ede('0x25')][_0x7ede('0x41')](_0x7ede('0x42'))){_0x99bd14[_0x7ede('0x13')]=qs[_0x7ede('0x13')](_0x31b08a[_0x7ede('0x25')][_0x7ede('0x13')]);_0x99bd14[_0x7ede('0x11')]=qs['offset'](_0x31b08a['query'][_0x7ede('0x11')]);}return _0x598513[_0x7ede('0x78')](_0x99bd14);}})[_0x7ede('0x19')](function(_0x513714){if(_0x513714){return _0x513714?{'count':_0x461087,'rows':_0x513714}:null;}})['then'](respondWithResult(_0xccb022,null))[_0x7ede('0x28')](handleError(_0xccb022,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9cd08f4..651c59f 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 _0x7188=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x7bf686,_0x4c445e){var _0x3c47bc=function(_0x2ecd47){while(--_0x2ecd47){_0x7bf686['push'](_0x7bf686['shift']());}};_0x3c47bc(++_0x4c445e);}(_0x7188,0x172));var _0x8718=function(_0x3da241,_0xeba26a){_0x3da241=_0x3da241-0x0;var _0x43e156=_0x7188[_0x3da241];return _0x43e156;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x8718('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x8718('0x1')](0x0);var events={'afterCreate':_0x8718('0x2'),'afterUpdate':_0x8718('0x3'),'afterDestroy':_0x8718('0x4')};function emitEvent(_0x1020ae){return function(_0x200595,_0x48fa22,_0xedcd4d){ChatQueueEvents[_0x8718('0x5')](_0x1020ae+':'+_0x200595['id'],_0x200595);ChatQueueEvents['emit'](_0x1020ae,_0x200595);_0xedcd4d(null);};}for(var e in events){if(events[_0x8718('0x6')](e)){var event=events[e];ChatQueue[_0x8718('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x0911=['hasOwnProperty','hook','exports','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x4a130c,_0x4283a4){var _0x2c75e9=function(_0x564252){while(--_0x564252){_0x4a130c['push'](_0x4a130c['shift']());}};_0x2c75e9(++_0x4283a4);}(_0x0911,0xed));var _0x1091=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x0911[_0x5ca5bc];return _0x26ca86;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x1091('0x0'))['db'][_0x1091('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1091('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1091('0x3'),'afterDestroy':_0x1091('0x4')};function emitEvent(_0x4517f9){return function(_0x1202e2,_0x53f2f5,_0x1ab2ed){ChatQueueEvents['emit'](_0x4517f9+':'+_0x1202e2['id'],_0x1202e2);ChatQueueEvents[_0x1091('0x5')](_0x4517f9,_0x1202e2);_0x1ab2ed(null);};}for(var e in events){if(events[_0x1091('0x6')](e)){var event=events[e];ChatQueue[_0x1091('0x7')](e,emitEvent(event));}}module[_0x1091('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a8197c6..aca24c9 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 _0x7fbd=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatQueue.attributes','define','ChatQueue','chat_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fbd,0xfc));var _0xd7fb=function(_0x1d4760,_0x5a58e7){_0x1d4760=_0x1d4760-0x0;var _0x233074=_0x7fbd[_0x1d4760];return _0x233074;};'use strict';var _=require(_0xd7fb('0x0'));var util=require(_0xd7fb('0x1'));var logger=require(_0xd7fb('0x2'))(_0xd7fb('0x3'));var moment=require(_0xd7fb('0x4'));var BPromise=require(_0xd7fb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7fb('0x6'));var rimraf=require(_0xd7fb('0x7'));var config=require('../../config/environment');var attributes=require(_0xd7fb('0x8'));module['exports']=function(_0x1eaa7a,_0x229e6f){return _0x1eaa7a[_0xd7fb('0x9')](_0xd7fb('0xa'),attributes,{'tableName':_0xd7fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb76=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x60d09,_0x26cd05){var _0x515079=function(_0x5e951a){while(--_0x5e951a){_0x60d09['push'](_0x60d09['shift']());}};_0x515079(++_0x26cd05);}(_0xbb76,0x14d));var _0x6bb7=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0xbb76[_0x333fed];return _0x12cac2;};'use strict';var _=require(_0x6bb7('0x0'));var util=require(_0x6bb7('0x1'));var logger=require(_0x6bb7('0x2'))('api');var moment=require(_0x6bb7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bb7('0x4'));var rimraf=require('rimraf');var config=require(_0x6bb7('0x5'));var attributes=require(_0x6bb7('0x6'));module[_0x6bb7('0x7')]=function(_0x161690,_0x554632){return _0x161690[_0x6bb7('0x8')](_0x6bb7('0x9'),attributes,{'tableName':_0x6bb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index c6d531f..1486b55 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 _0xab75=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetChatQueue','ChatQueue','options','raw','limit','include','map','model','attributes','catch','ShowChatQueue','find','where'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xab75,0x11f));var _0x5ab7=function(_0x459a2d,_0x2aadbf){_0x459a2d=_0x459a2d-0x0;var _0x148a0c=_0xab75[_0x459a2d];return _0x148a0c;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var moment=require(_0x5ab7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ab7('0x3'));var db=require(_0x5ab7('0x4'))['db'];var utils=require(_0x5ab7('0x5'));var logger=require('../../config/logger')(_0x5ab7('0x6'));var config=require(_0x5ab7('0x7'));var jayson=require(_0x5ab7('0x8'));var client=jayson[_0x5ab7('0x9')][_0x5ab7('0xa')]({'port':0x232a});config[_0x5ab7('0xb')]=_[_0x5ab7('0xc')](config[_0x5ab7('0xb')],{'host':_0x5ab7('0xd'),'port':0x18eb});var socket=require(_0x5ab7('0xe'))(new Redis(config[_0x5ab7('0xb')]));require('./chatQueue.socket')[_0x5ab7('0xf')](socket);function respondWithRpcPromise(_0x16bbf4,_0x523404,_0x33ffe3){return new BPromise(function(_0x12e9a2,_0x45a8b8){return client[_0x5ab7('0x10')](_0x16bbf4,_0x33ffe3)[_0x5ab7('0x11')](function(_0x4e8f14){logger['info'](_0x5ab7('0x12'),_0x523404,_0x5ab7('0x13'));logger[_0x5ab7('0x14')](_0x5ab7('0x15'),_0x523404,_0x5ab7('0x13'),JSON[_0x5ab7('0x16')](_0x4e8f14));if(_0x4e8f14[_0x5ab7('0x17')]){if(_0x4e8f14[_0x5ab7('0x17')][_0x5ab7('0x18')]===0x1f4){logger[_0x5ab7('0x17')](_0x5ab7('0x12'),_0x523404,_0x4e8f14['error'][_0x5ab7('0x19')]);return _0x45a8b8(_0x4e8f14[_0x5ab7('0x17')][_0x5ab7('0x19')]);}logger[_0x5ab7('0x17')](_0x5ab7('0x12'),_0x523404,_0x4e8f14[_0x5ab7('0x17')][_0x5ab7('0x19')]);return _0x12e9a2(_0x4e8f14[_0x5ab7('0x17')][_0x5ab7('0x19')]);}else{logger[_0x5ab7('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x523404,_0x5ab7('0x13'));_0x12e9a2(_0x4e8f14[_0x5ab7('0x1b')][_0x5ab7('0x19')]);}})['catch'](function(_0x1522eb){logger[_0x5ab7('0x17')](_0x5ab7('0x12'),_0x523404,_0x1522eb);_0x45a8b8(_0x1522eb);});});}exports[_0x5ab7('0x1c')]=function(_0x4b9182){var _0x1167be=this;return new Promise(function(_0x20dc68,_0x38dc30){return db[_0x5ab7('0x1d')]['findAll']({'raw':_0x4b9182[_0x5ab7('0x1e')]?_0x4b9182['options'][_0x5ab7('0x1f')]===undefined?!![]:![]:!![],'where':_0x4b9182[_0x5ab7('0x1e')]?_0x4b9182[_0x5ab7('0x1e')]['where']||null:null,'attributes':_0x4b9182['options']?_0x4b9182[_0x5ab7('0x1e')]['attributes']||null:null,'limit':_0x4b9182[_0x5ab7('0x1e')]?_0x4b9182[_0x5ab7('0x1e')][_0x5ab7('0x20')]||null:null,'include':_0x4b9182[_0x5ab7('0x1e')]?_0x4b9182['options'][_0x5ab7('0x21')]?_[_0x5ab7('0x22')](_0x4b9182['options']['include'],function(_0x158235){return{'model':db[_0x158235['model']],'as':_0x158235['as'],'attributes':_0x158235['attributes'],'include':_0x158235[_0x5ab7('0x21')]?_[_0x5ab7('0x22')](_0x158235[_0x5ab7('0x21')],function(_0x25bf65){return{'model':db[_0x25bf65[_0x5ab7('0x23')]],'as':_0x25bf65['as'],'attributes':_0x25bf65[_0x5ab7('0x24')],'include':_0x25bf65[_0x5ab7('0x21')]?_['map'](_0x25bf65[_0x5ab7('0x21')],function(_0x20f930){return{'model':db[_0x20f930[_0x5ab7('0x23')]],'as':_0x20f930['as'],'attributes':_0x20f930[_0x5ab7('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e4b14){logger[_0x5ab7('0x1a')](_0x5ab7('0x1c'),_0x4b9182);logger[_0x5ab7('0x14')]('GetChatQueue',_0x4b9182,JSON[_0x5ab7('0x16')](_0x4e4b14));_0x20dc68(_0x4e4b14);})[_0x5ab7('0x25')](function(_0x51ae7a){logger[_0x5ab7('0x17')](_0x5ab7('0x1c'),_0x51ae7a[_0x5ab7('0x19')],_0x4b9182);_0x38dc30(_0x1167be['error'](0x1f4,_0x51ae7a[_0x5ab7('0x19')]));});});};exports[_0x5ab7('0x26')]=function(_0x1389a2){var _0x2bdc1e=this;return new Promise(function(_0x241f84,_0x51b08a){return db['ChatQueue'][_0x5ab7('0x27')]({'raw':_0x1389a2['options']?_0x1389a2['options']['raw']===undefined?!![]:![]:!![],'where':_0x1389a2[_0x5ab7('0x1e')]?_0x1389a2[_0x5ab7('0x1e')][_0x5ab7('0x28')]||null:null,'attributes':_0x1389a2[_0x5ab7('0x1e')]?_0x1389a2['options'][_0x5ab7('0x24')]||null:null,'include':_0x1389a2['options']?_0x1389a2[_0x5ab7('0x1e')][_0x5ab7('0x21')]?_['map'](_0x1389a2[_0x5ab7('0x1e')][_0x5ab7('0x21')],function(_0x13a54d){return{'model':db[_0x13a54d[_0x5ab7('0x23')]],'as':_0x13a54d['as'],'attributes':_0x13a54d['attributes'],'include':_0x13a54d[_0x5ab7('0x21')]?_[_0x5ab7('0x22')](_0x13a54d[_0x5ab7('0x21')],function(_0x24221){return{'model':db[_0x24221[_0x5ab7('0x23')]],'as':_0x24221['as'],'attributes':_0x24221['attributes'],'include':_0x24221[_0x5ab7('0x21')]?_[_0x5ab7('0x22')](_0x24221[_0x5ab7('0x21')],function(_0x520122){return{'model':db[_0x520122[_0x5ab7('0x23')]],'as':_0x520122['as'],'attributes':_0x520122['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ab7('0x11')](function(_0x280b29){logger[_0x5ab7('0x1a')](_0x5ab7('0x26'),_0x1389a2);logger[_0x5ab7('0x14')](_0x5ab7('0x26'),_0x1389a2,JSON[_0x5ab7('0x16')](_0x280b29));_0x241f84(_0x280b29);})[_0x5ab7('0x25')](function(_0x5c5a03){logger[_0x5ab7('0x17')](_0x5ab7('0x26'),_0x5c5a03[_0x5ab7('0x19')],_0x1389a2);_0x51b08a(_0x2bdc1e['error'](0x1f4,_0x5c5a03['message']));});});}; \ No newline at end of file +var _0x4060=['ChatQueue','findAll','options','attributes','limit','include','map','model','catch','ShowChatQueue','find','raw','where','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetChatQueue'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x4060,0x89));var _0x0406=function(_0x53a5f2,_0x5e3a35){_0x53a5f2=_0x53a5f2-0x0;var _0x4666ac=_0x4060[_0x53a5f2];return _0x4666ac;};'use strict';var _=require('lodash');var util=require(_0x0406('0x0'));var moment=require('moment');var BPromise=require(_0x0406('0x1'));var rs=require(_0x0406('0x2'));var fs=require('fs');var Redis=require(_0x0406('0x3'));var db=require(_0x0406('0x4'))['db'];var utils=require(_0x0406('0x5'));var logger=require(_0x0406('0x6'))('rpc');var config=require(_0x0406('0x7'));var jayson=require(_0x0406('0x8'));var client=jayson['client'][_0x0406('0x9')]({'port':0x232a});config[_0x0406('0xa')]=_['defaults'](config[_0x0406('0xa')],{'host':_0x0406('0xb'),'port':0x18eb});var socket=require(_0x0406('0xc'))(new Redis(config[_0x0406('0xa')]));require(_0x0406('0xd'))[_0x0406('0xe')](socket);function respondWithRpcPromise(_0x22a46d,_0x397bb5,_0x514b78){return new BPromise(function(_0x93f6da,_0x28bccc){return client[_0x0406('0xf')](_0x22a46d,_0x514b78)[_0x0406('0x10')](function(_0x40af0a){logger[_0x0406('0x11')](_0x0406('0x12'),_0x397bb5,_0x0406('0x13'));logger['debug'](_0x0406('0x14'),_0x397bb5,_0x0406('0x13'),JSON[_0x0406('0x15')](_0x40af0a));if(_0x40af0a['error']){if(_0x40af0a['error'][_0x0406('0x16')]===0x1f4){logger[_0x0406('0x17')](_0x0406('0x12'),_0x397bb5,_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);return _0x28bccc(_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);}logger[_0x0406('0x17')](_0x0406('0x12'),_0x397bb5,_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);return _0x93f6da(_0x40af0a[_0x0406('0x17')][_0x0406('0x18')]);}else{logger['info'](_0x0406('0x12'),_0x397bb5,_0x0406('0x13'));_0x93f6da(_0x40af0a[_0x0406('0x19')]['message']);}})['catch'](function(_0x41a8c1){logger['error']('ChatQueue,\x20%s,\x20%s',_0x397bb5,_0x41a8c1);_0x28bccc(_0x41a8c1);});});}exports[_0x0406('0x1a')]=function(_0x5a4914){var _0x462fb8=this;return new Promise(function(_0x21ff6a,_0x3696b3){return db[_0x0406('0x1b')][_0x0406('0x1c')]({'raw':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')]['where']||null:null,'attributes':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')][_0x0406('0x1e')]||null:null,'limit':_0x5a4914[_0x0406('0x1d')]?_0x5a4914[_0x0406('0x1d')][_0x0406('0x1f')]||null:null,'include':_0x5a4914['options']?_0x5a4914['options'][_0x0406('0x20')]?_[_0x0406('0x21')](_0x5a4914[_0x0406('0x1d')][_0x0406('0x20')],function(_0x56bbe2){return{'model':db[_0x56bbe2[_0x0406('0x22')]],'as':_0x56bbe2['as'],'attributes':_0x56bbe2[_0x0406('0x1e')],'include':_0x56bbe2[_0x0406('0x20')]?_['map'](_0x56bbe2['include'],function(_0x5eb69c){return{'model':db[_0x5eb69c['model']],'as':_0x5eb69c['as'],'attributes':_0x5eb69c['attributes'],'include':_0x5eb69c[_0x0406('0x20')]?_['map'](_0x5eb69c[_0x0406('0x20')],function(_0x59a683){return{'model':db[_0x59a683['model']],'as':_0x59a683['as'],'attributes':_0x59a683[_0x0406('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0406('0x10')](function(_0x134b80){logger[_0x0406('0x11')]('GetChatQueue',_0x5a4914);logger['debug']('GetChatQueue',_0x5a4914,JSON[_0x0406('0x15')](_0x134b80));_0x21ff6a(_0x134b80);})[_0x0406('0x23')](function(_0x2ebed6){logger[_0x0406('0x17')](_0x0406('0x1a'),_0x2ebed6[_0x0406('0x18')],_0x5a4914);_0x3696b3(_0x462fb8[_0x0406('0x17')](0x1f4,_0x2ebed6['message']));});});};exports[_0x0406('0x24')]=function(_0x5357e5){var _0x3cc40b=this;return new Promise(function(_0x391857,_0xf39b71){return db[_0x0406('0x1b')][_0x0406('0x25')]({'raw':_0x5357e5[_0x0406('0x1d')]?_0x5357e5['options'][_0x0406('0x26')]===undefined?!![]:![]:!![],'where':_0x5357e5[_0x0406('0x1d')]?_0x5357e5[_0x0406('0x1d')][_0x0406('0x27')]||null:null,'attributes':_0x5357e5[_0x0406('0x1d')]?_0x5357e5['options'][_0x0406('0x1e')]||null:null,'include':_0x5357e5['options']?_0x5357e5['options']['include']?_['map'](_0x5357e5[_0x0406('0x1d')][_0x0406('0x20')],function(_0x3dbe3e){return{'model':db[_0x3dbe3e[_0x0406('0x22')]],'as':_0x3dbe3e['as'],'attributes':_0x3dbe3e['attributes'],'include':_0x3dbe3e['include']?_[_0x0406('0x21')](_0x3dbe3e[_0x0406('0x20')],function(_0x4e420a){return{'model':db[_0x4e420a[_0x0406('0x22')]],'as':_0x4e420a['as'],'attributes':_0x4e420a['attributes'],'include':_0x4e420a[_0x0406('0x20')]?_[_0x0406('0x21')](_0x4e420a[_0x0406('0x20')],function(_0x29bdb5){return{'model':db[_0x29bdb5[_0x0406('0x22')]],'as':_0x29bdb5['as'],'attributes':_0x29bdb5['attributes']};}):[]};}):[]};}):[]:[]})[_0x0406('0x10')](function(_0x229ab1){logger['info'](_0x0406('0x24'),_0x5357e5);logger[_0x0406('0x28')](_0x0406('0x24'),_0x5357e5,JSON[_0x0406('0x15')](_0x229ab1));_0x391857(_0x229ab1);})['catch'](function(_0x2b6c69){logger[_0x0406('0x17')]('ShowChatQueue',_0x2b6c69[_0x0406('0x18')],_0x5357e5);_0xf39b71(_0x3cc40b[_0x0406('0x17')](0x1f4,_0x2b6c69[_0x0406('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 17afa26..af5b4ed 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 _0xdace=['remove','update','emit','register','length','./chatQueue.events'];(function(_0x42b4e2,_0x317256){var _0x39f763=function(_0x5e10e4){while(--_0x5e10e4){_0x42b4e2['push'](_0x42b4e2['shift']());}};_0x39f763(++_0x317256);}(_0xdace,0xc5));var _0xedac=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xdace[_0x1f71d8];return _0x10b045;};'use strict';var ChatQueueEvents=require(_0xedac('0x0'));var events=['save',_0xedac('0x1'),_0xedac('0x2')];function createListener(_0x46eba0,_0x518516){return function(_0x413d77){_0x518516[_0xedac('0x3')](_0x46eba0,_0x413d77);};}function removeListener(_0x15d3bd,_0xefb142){return function(){ChatQueueEvents['removeListener'](_0x15d3bd,_0xefb142);};}exports[_0xedac('0x4')]=function(_0x1cba89){for(var _0x39328a=0x0,_0x5ecbd3=events[_0xedac('0x5')];_0x39328a<_0x5ecbd3;_0x39328a++){var _0x21440e=events[_0x39328a];var _0x162eea=createListener('chatQueue:'+_0x21440e,_0x1cba89);ChatQueueEvents['on'](_0x21440e,_0x162eea);}}; \ No newline at end of file +var _0xd0bb=['chatQueue:','./chatQueue.events','save','remove','emit','register','length'];(function(_0x454024,_0x58ac85){var _0x47b17e=function(_0x1274ae){while(--_0x1274ae){_0x454024['push'](_0x454024['shift']());}};_0x47b17e(++_0x58ac85);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3d0678,_0x10e9ae){_0x3d0678=_0x3d0678-0x0;var _0x7f9a43=_0xd0bb[_0x3d0678];return _0x7f9a43;};'use strict';var ChatQueueEvents=require(_0xbd0b('0x0'));var events=[_0xbd0b('0x1'),_0xbd0b('0x2'),'update'];function createListener(_0x68ea36,_0x4ab08f){return function(_0x39b03a){_0x4ab08f[_0xbd0b('0x3')](_0x68ea36,_0x39b03a);};}function removeListener(_0x53e6ce,_0x432acf){return function(){ChatQueueEvents['removeListener'](_0x53e6ce,_0x432acf);};}exports[_0xbd0b('0x4')]=function(_0x1b2499){for(var _0x158b5c=0x0,_0x37c205=events[_0xbd0b('0x5')];_0x158b5c<_0x37c205;_0x158b5c++){var _0x5eb975=events[_0x158b5c];var _0x2a4075=createListener(_0xbd0b('0x6')+_0x5eb975,_0x1b2499);ChatQueueEvents['on'](_0x5eb975,_0x2a4075);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f9fa0e4..8c8972f 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x4b9ce5,_0x93f34d){_0x4b9ce5=_0x4b9ce5-0x0;var _0x862c13=_0x3e74[_0x4b9ce5];return _0x862c13;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _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(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x5fc3[_0x382c73];return _0x1dd0bf;};'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 a64f6d9..460deaa 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 _0x864a=['exports','STRING','DATE','moment','sequelize'];(function(_0x165189,_0x19a741){var _0x44826b=function(_0x25bf5a){while(--_0x25bf5a){_0x165189['push'](_0x165189['shift']());}};_0x44826b(++_0x19a741);}(_0x864a,0x8a));var _0xa864=function(_0xc537a4,_0x278e4e){_0xc537a4=_0xc537a4-0x0;var _0x2f67bd=_0x864a[_0xc537a4];return _0x2f67bd;};'use strict';var moment=require(_0xa864('0x0'));var Sequelize=require(_0xa864('0x1'));module[_0xa864('0x2')]={'uniqueid':{'type':Sequelize[_0xa864('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa864('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3827=['STRING','DATE','moment'];(function(_0x97a9a9,_0x301335){var _0x221cc9=function(_0x38efcb){while(--_0x38efcb){_0x97a9a9['push'](_0x97a9a9['shift']());}};_0x221cc9(++_0x301335);}(_0x3827,0x1c4));var _0x7382=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x3827[_0x62c958];return _0x57ec61;};'use strict';var moment=require(_0x7382('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7382('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7382('0x1')]},'joinAt':{'type':Sequelize[_0x7382('0x2')]},'leaveAt':{'type':Sequelize[_0x7382('0x2')]},'acceptAt':{'type':Sequelize[_0x7382('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5ac8b7d..f22962a 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 _0x7d10=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','ChatQueueReport','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','describe','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','type','key','model','map','keys','query','filters'];(function(_0x378266,_0x11fd6a){var _0x20eb3e=function(_0x4b04c3){while(--_0x4b04c3){_0x378266['push'](_0x378266['shift']());}};_0x20eb3e(++_0x11fd6a);}(_0x7d10,0x1ce));var _0x07d1=function(_0xbe3f94,_0x2f2eee){_0xbe3f94=_0xbe3f94-0x0;var _0x5bb088=_0x7d10[_0xbe3f94];return _0x5bb088;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07d1('0x0'));var zipdir=require(_0x07d1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07d1('0x2'));var moment=require(_0x07d1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x07d1('0x4'));var util=require(_0x07d1('0x5'));var path=require('path');var sox=require(_0x07d1('0x6'));var csv=require(_0x07d1('0x7'));var ejs=require(_0x07d1('0x8'));var fs=require('fs');var fs_extra=require(_0x07d1('0x9'));var _=require('lodash');var squel=require(_0x07d1('0xa'));var crypto=require(_0x07d1('0xb'));var jsforce=require(_0x07d1('0xc'));var deskjs=require(_0x07d1('0xd'));var toCsv=require(_0x07d1('0x7'));var querystring=require(_0x07d1('0xe'));var Papa=require(_0x07d1('0xf'));var Redis=require(_0x07d1('0x10'));var authService=require(_0x07d1('0x11'));var qs=require(_0x07d1('0x12'));var as=require(_0x07d1('0x13'));var hardwareService=require(_0x07d1('0x14'));var logger=require(_0x07d1('0x15'))(_0x07d1('0x16'));var utils=require(_0x07d1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x07d1('0x18'))['db'];function respondWithStatusCode(_0x427deb,_0x1625b4){_0x1625b4=_0x1625b4||0xcc;return function(_0x29c764){if(_0x29c764){return _0x427deb[_0x07d1('0x19')](_0x1625b4);}return _0x427deb[_0x07d1('0x1a')](_0x1625b4)[_0x07d1('0x1b')]();};}function respondWithResult(_0x19725b,_0x19ce74){_0x19ce74=_0x19ce74||0xc8;return function(_0x15bc80){if(_0x15bc80){return _0x19725b['status'](_0x19ce74)[_0x07d1('0x1c')](_0x15bc80);}};}function respondWithFilteredResult(_0x22fec9,_0x1c528d){return function(_0x3e1ee7){if(_0x3e1ee7){var _0x5f28f6=typeof _0x1c528d[_0x07d1('0x1d')]===_0x07d1('0x1e')&&typeof _0x1c528d[_0x07d1('0x1f')]==='undefined';var _0xd282ae=_0x3e1ee7[_0x07d1('0x20')];var _0x1e90dd=_0x5f28f6?0x0:_0x1c528d[_0x07d1('0x1d')];var _0x2f9a13=_0x5f28f6?_0x3e1ee7[_0x07d1('0x20')]:_0x1c528d[_0x07d1('0x1d')]+_0x1c528d['limit'];var _0x536f1b;if(_0x2f9a13>=_0xd282ae){_0x2f9a13=_0xd282ae;_0x536f1b=0xc8;}else{_0x536f1b=0xce;}_0x22fec9[_0x07d1('0x1a')](_0x536f1b);return _0x22fec9['set'](_0x07d1('0x21'),_0x1e90dd+'-'+_0x2f9a13+'/'+_0xd282ae)['json'](_0x3e1ee7);}return null;};}function patchUpdates(_0x2b5153){return function(_0x19e9de){try{jsonpatch[_0x07d1('0x22')](_0x19e9de,_0x2b5153,!![]);}catch(_0x42dd1f){return BPromise[_0x07d1('0x23')](_0x42dd1f);}return _0x19e9de[_0x07d1('0x24')]();};}function saveUpdates(_0x723829,_0xd9d94c){return function(_0x43b86c){if(_0x43b86c){return _0x43b86c['update'](_0x723829)['then'](function(_0x557e33){return _0x557e33;});}return null;};}function removeEntity(_0x3f5b53,_0x4f2e25){return function(_0x30755f){if(_0x30755f){return _0x30755f[_0x07d1('0x25')]()[_0x07d1('0x26')](function(){_0x3f5b53[_0x07d1('0x1a')](0xcc)[_0x07d1('0x1b')]();});}};}function handleEntityNotFound(_0x4d8b90,_0x1e9021){return function(_0x16b55c){if(!_0x16b55c){_0x4d8b90[_0x07d1('0x19')](0x194);}return _0x16b55c;};}function handleError(_0x3faa21,_0x2d717a){_0x2d717a=_0x2d717a||0x1f4;return function(_0x58e370){logger[_0x07d1('0x27')](_0x58e370[_0x07d1('0x28')]);if(_0x58e370[_0x07d1('0x29')]){delete _0x58e370[_0x07d1('0x29')];}_0x3faa21[_0x07d1('0x1a')](_0x2d717a)['send'](_0x58e370);};}exports['index']=function(_0x3a0254,_0x604380){var _0x513cf0={},_0x3ba5df={},_0x12cb9c={'count':0x0,'rows':[]};var _0x564b13=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x42a910){return{'name':_0x42a910['fieldName'],'type':_0x42a910[_0x07d1('0x2a')][_0x07d1('0x2b')]};});_0x3ba5df[_0x07d1('0x2c')]=_[_0x07d1('0x2d')](_0x564b13,_0x07d1('0x29'));_0x3ba5df['query']=_[_0x07d1('0x2e')](_0x3a0254[_0x07d1('0x2f')]);_0x3ba5df[_0x07d1('0x30')]=_[_0x07d1('0x31')](_0x3ba5df[_0x07d1('0x2c')],_0x3ba5df[_0x07d1('0x2f')]);_0x513cf0[_0x07d1('0x32')]=_[_0x07d1('0x31')](_0x3ba5df[_0x07d1('0x2c')],qs[_0x07d1('0x33')](_0x3a0254['query']['fields']));_0x513cf0['attributes']=_0x513cf0[_0x07d1('0x32')]['length']?_0x513cf0[_0x07d1('0x32')]:_0x3ba5df['model'];if(!_0x3a0254['query'][_0x07d1('0x34')](_0x07d1('0x35'))){_0x513cf0[_0x07d1('0x1f')]=qs[_0x07d1('0x1f')](_0x3a0254[_0x07d1('0x2f')][_0x07d1('0x1f')]);_0x513cf0[_0x07d1('0x1d')]=qs['offset'](_0x3a0254[_0x07d1('0x2f')][_0x07d1('0x1d')]);}_0x513cf0['order']=qs[_0x07d1('0x36')](_0x3a0254[_0x07d1('0x2f')][_0x07d1('0x36')]);_0x513cf0[_0x07d1('0x37')]=qs[_0x07d1('0x30')](_[_0x07d1('0x38')](_0x3a0254['query'],_0x3ba5df['filters']),_0x564b13);if(_0x3a0254[_0x07d1('0x2f')]['filter']){_0x513cf0['where']=_[_0x07d1('0x39')](_0x513cf0[_0x07d1('0x37')],{'$or':_[_0x07d1('0x2d')](_0x564b13,function(_0x1a6ea3){if(_0x1a6ea3[_0x07d1('0x2a')]!==_0x07d1('0x3a')){var _0x252718={};_0x252718[_0x1a6ea3['name']]={'$like':'%'+_0x3a0254[_0x07d1('0x2f')]['filter']+'%'};return _0x252718;}})});}_0x513cf0=_['merge']({},_0x513cf0,_0x3a0254[_0x07d1('0x3b')]);var _0x1529eb={'where':_0x513cf0[_0x07d1('0x37')]};return db[_0x07d1('0x3c')]['count'](_0x1529eb)['then'](function(_0x145775){_0x12cb9c[_0x07d1('0x20')]=_0x145775;if(_0x3a0254[_0x07d1('0x2f')]['includeAll']){_0x513cf0[_0x07d1('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x07d1('0x3e')](_0x513cf0);})[_0x07d1('0x26')](function(_0xa4b063){_0x12cb9c[_0x07d1('0x3f')]=_0xa4b063;return _0x12cb9c;})[_0x07d1('0x26')](respondWithFilteredResult(_0x604380,_0x513cf0))[_0x07d1('0x40')](handleError(_0x604380,null));};exports[_0x07d1('0x41')]=function(_0x5836dd,_0x4e4154){var _0x2c3d91={'raw':!![],'where':{'id':_0x5836dd[_0x07d1('0x42')]['id']}},_0x3016cb={};_0x3016cb[_0x07d1('0x2c')]=_['keys'](db['ChatQueueReport'][_0x07d1('0x43')]);_0x3016cb[_0x07d1('0x2f')]=_[_0x07d1('0x2e')](_0x5836dd[_0x07d1('0x2f')]);_0x3016cb[_0x07d1('0x30')]=_['intersection'](_0x3016cb[_0x07d1('0x2c')],_0x3016cb[_0x07d1('0x2f')]);_0x2c3d91[_0x07d1('0x32')]=_[_0x07d1('0x31')](_0x3016cb[_0x07d1('0x2c')],qs[_0x07d1('0x33')](_0x5836dd[_0x07d1('0x2f')][_0x07d1('0x33')]));_0x2c3d91[_0x07d1('0x32')]=_0x2c3d91[_0x07d1('0x32')]['length']?_0x2c3d91['attributes']:_0x3016cb[_0x07d1('0x2c')];if(_0x5836dd[_0x07d1('0x2f')]['includeAll']){_0x2c3d91[_0x07d1('0x3d')]=[{'all':!![]}];}_0x2c3d91=_[_0x07d1('0x39')]({},_0x2c3d91,_0x5836dd[_0x07d1('0x3b')]);return db[_0x07d1('0x3c')]['find'](_0x2c3d91)[_0x07d1('0x26')](handleEntityNotFound(_0x4e4154,null))['then'](respondWithResult(_0x4e4154,null))[_0x07d1('0x40')](handleError(_0x4e4154,null));};exports[_0x07d1('0x44')]=function(_0x4918a9,_0xa0e6aa){return db[_0x07d1('0x3c')][_0x07d1('0x44')](_0x4918a9[_0x07d1('0x45')],{})['then'](respondWithResult(_0xa0e6aa,0xc9))[_0x07d1('0x40')](handleError(_0xa0e6aa,null));};exports[_0x07d1('0x46')]=function(_0x17e32c,_0x15da90){if(_0x17e32c[_0x07d1('0x45')]['id']){delete _0x17e32c['body']['id'];}return db[_0x07d1('0x3c')][_0x07d1('0x47')]({'where':{'id':_0x17e32c['params']['id']}})[_0x07d1('0x26')](handleEntityNotFound(_0x15da90,null))['then'](saveUpdates(_0x17e32c[_0x07d1('0x45')],null))[_0x07d1('0x26')](respondWithResult(_0x15da90,null))[_0x07d1('0x40')](handleError(_0x15da90,null));};exports[_0x07d1('0x25')]=function(_0x59bff2,_0x41d642){return db[_0x07d1('0x3c')][_0x07d1('0x47')]({'where':{'id':_0x59bff2[_0x07d1('0x42')]['id']}})[_0x07d1('0x26')](handleEntityNotFound(_0x41d642,null))[_0x07d1('0x26')](removeEntity(_0x41d642,null))[_0x07d1('0x40')](handleError(_0x41d642,null));};exports[_0x07d1('0x48')]=function(_0x513fad,_0x126b8a){return db[_0x07d1('0x3c')][_0x07d1('0x48')]()[_0x07d1('0x26')](respondWithResult(_0x126b8a,null))[_0x07d1('0x40')](handleError(_0x126b8a,null));}; \ No newline at end of file +var _0x9264=['key','model','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','show','params','keys','includeAll','include','options','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4926('0x0'));var rimraf=require(_0x4926('0x1'));var zipdir=require(_0x4926('0x2'));var jsonpatch=require(_0x4926('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4926('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4926('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4926('0x6'));var _=require(_0x4926('0x7'));var squel=require('squel');var crypto=require(_0x4926('0x8'));var jsforce=require(_0x4926('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4926('0xa'));var querystring=require(_0x4926('0xb'));var Papa=require(_0x4926('0xc'));var Redis=require('ioredis');var authService=require(_0x4926('0xd'));var qs=require(_0x4926('0xe'));var as=require(_0x4926('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4926('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4926('0x11'));var licenseUtil=require(_0x4926('0x12'));var db=require(_0x4926('0x13'))['db'];function respondWithStatusCode(_0x5423a3,_0xd3cbc){_0xd3cbc=_0xd3cbc||0xcc;return function(_0x21eae1){if(_0x21eae1){return _0x5423a3[_0x4926('0x14')](_0xd3cbc);}return _0x5423a3[_0x4926('0x15')](_0xd3cbc)[_0x4926('0x16')]();};}function respondWithResult(_0x2a2105,_0x2f466b){_0x2f466b=_0x2f466b||0xc8;return function(_0x1a280b){if(_0x1a280b){return _0x2a2105[_0x4926('0x15')](_0x2f466b)[_0x4926('0x17')](_0x1a280b);}};}function respondWithFilteredResult(_0xac0db7,_0x1fbb5d){return function(_0x3018cb){if(_0x3018cb){var _0x1ac74f=typeof _0x1fbb5d['offset']===_0x4926('0x18')&&typeof _0x1fbb5d[_0x4926('0x19')]===_0x4926('0x18');var _0x5736dd=_0x3018cb['count'];var _0x1dd78e=_0x1ac74f?0x0:_0x1fbb5d['offset'];var _0x214e36=_0x1ac74f?_0x3018cb[_0x4926('0x1a')]:_0x1fbb5d['offset']+_0x1fbb5d[_0x4926('0x19')];var _0x49461e;if(_0x214e36>=_0x5736dd){_0x214e36=_0x5736dd;_0x49461e=0xc8;}else{_0x49461e=0xce;}_0xac0db7[_0x4926('0x15')](_0x49461e);return _0xac0db7[_0x4926('0x1b')](_0x4926('0x1c'),_0x1dd78e+'-'+_0x214e36+'/'+_0x5736dd)[_0x4926('0x17')](_0x3018cb);}return null;};}function patchUpdates(_0x5b7588){return function(_0x59dc6a){try{jsonpatch[_0x4926('0x1d')](_0x59dc6a,_0x5b7588,!![]);}catch(_0x588c7a){return BPromise['reject'](_0x588c7a);}return _0x59dc6a[_0x4926('0x1e')]();};}function saveUpdates(_0x309c71,_0x55d055){return function(_0xfd1095){if(_0xfd1095){return _0xfd1095['update'](_0x309c71)[_0x4926('0x1f')](function(_0x55e459){return _0x55e459;});}return null;};}function removeEntity(_0x10d0b2,_0x34d600){return function(_0x2df18c){if(_0x2df18c){return _0x2df18c[_0x4926('0x20')]()['then'](function(){_0x10d0b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c02e7,_0xbfbe1b){return function(_0x43c077){if(!_0x43c077){_0x1c02e7[_0x4926('0x14')](0x194);}return _0x43c077;};}function handleError(_0x51be4f,_0x508dea){_0x508dea=_0x508dea||0x1f4;return function(_0x55413a){logger[_0x4926('0x21')](_0x55413a[_0x4926('0x22')]);if(_0x55413a[_0x4926('0x23')]){delete _0x55413a['name'];}_0x51be4f['status'](_0x508dea)['send'](_0x55413a);};}exports[_0x4926('0x24')]=function(_0x3f06a3,_0xbfe28d){var _0x4bd08d={},_0x180421={},_0x9d610c={'count':0x0,'rows':[]};var _0x3f4a69=_[_0x4926('0x25')](db[_0x4926('0x26')][_0x4926('0x27')],function(_0x5a44a9){return{'name':_0x5a44a9[_0x4926('0x28')],'type':_0x5a44a9[_0x4926('0x29')][_0x4926('0x2a')]};});_0x180421[_0x4926('0x2b')]=_[_0x4926('0x25')](_0x3f4a69,_0x4926('0x23'));_0x180421[_0x4926('0x2c')]=_['keys'](_0x3f06a3[_0x4926('0x2c')]);_0x180421[_0x4926('0x2d')]=_['intersection'](_0x180421[_0x4926('0x2b')],_0x180421[_0x4926('0x2c')]);_0x4bd08d[_0x4926('0x2e')]=_[_0x4926('0x2f')](_0x180421[_0x4926('0x2b')],qs[_0x4926('0x30')](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x30')]));_0x4bd08d[_0x4926('0x2e')]=_0x4bd08d[_0x4926('0x2e')][_0x4926('0x31')]?_0x4bd08d[_0x4926('0x2e')]:_0x180421[_0x4926('0x2b')];if(!_0x3f06a3[_0x4926('0x2c')]['hasOwnProperty'](_0x4926('0x32'))){_0x4bd08d[_0x4926('0x19')]=qs[_0x4926('0x19')](_0x3f06a3[_0x4926('0x2c')]['limit']);_0x4bd08d[_0x4926('0x33')]=qs[_0x4926('0x33')](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x33')]);}_0x4bd08d[_0x4926('0x34')]=qs['sort'](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x35')]);_0x4bd08d[_0x4926('0x36')]=qs['filters'](_[_0x4926('0x37')](_0x3f06a3[_0x4926('0x2c')],_0x180421[_0x4926('0x2d')]),_0x3f4a69);if(_0x3f06a3[_0x4926('0x2c')][_0x4926('0x38')]){_0x4bd08d[_0x4926('0x36')]=_['merge'](_0x4bd08d[_0x4926('0x36')],{'$or':_[_0x4926('0x25')](_0x3f4a69,function(_0x3c5595){if(_0x3c5595[_0x4926('0x29')]!==_0x4926('0x39')){var _0x5237f4={};_0x5237f4[_0x3c5595[_0x4926('0x23')]]={'$like':'%'+_0x3f06a3[_0x4926('0x2c')][_0x4926('0x38')]+'%'};return _0x5237f4;}})});}_0x4bd08d=_[_0x4926('0x3a')]({},_0x4bd08d,_0x3f06a3['options']);var _0x505de3={'where':_0x4bd08d['where']};return db[_0x4926('0x26')][_0x4926('0x1a')](_0x505de3)[_0x4926('0x1f')](function(_0x1d97db){_0x9d610c[_0x4926('0x1a')]=_0x1d97db;if(_0x3f06a3['query']['includeAll']){_0x4bd08d['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x4926('0x3b')](_0x4bd08d);})[_0x4926('0x1f')](function(_0x4380da){_0x9d610c[_0x4926('0x3c')]=_0x4380da;return _0x9d610c;})[_0x4926('0x1f')](respondWithFilteredResult(_0xbfe28d,_0x4bd08d))['catch'](handleError(_0xbfe28d,null));};exports[_0x4926('0x3d')]=function(_0x203f24,_0x218631){var _0x9dc879={'raw':!![],'where':{'id':_0x203f24[_0x4926('0x3e')]['id']}},_0x437800={};_0x437800[_0x4926('0x2b')]=_[_0x4926('0x3f')](db[_0x4926('0x26')][_0x4926('0x27')]);_0x437800['query']=_['keys'](_0x203f24[_0x4926('0x2c')]);_0x437800['filters']=_[_0x4926('0x2f')](_0x437800[_0x4926('0x2b')],_0x437800[_0x4926('0x2c')]);_0x9dc879['attributes']=_[_0x4926('0x2f')](_0x437800[_0x4926('0x2b')],qs[_0x4926('0x30')](_0x203f24[_0x4926('0x2c')][_0x4926('0x30')]));_0x9dc879[_0x4926('0x2e')]=_0x9dc879[_0x4926('0x2e')][_0x4926('0x31')]?_0x9dc879[_0x4926('0x2e')]:_0x437800[_0x4926('0x2b')];if(_0x203f24[_0x4926('0x2c')][_0x4926('0x40')]){_0x9dc879[_0x4926('0x41')]=[{'all':!![]}];}_0x9dc879=_[_0x4926('0x3a')]({},_0x9dc879,_0x203f24[_0x4926('0x42')]);return db['ChatQueueReport'][_0x4926('0x43')](_0x9dc879)[_0x4926('0x1f')](handleEntityNotFound(_0x218631,null))['then'](respondWithResult(_0x218631,null))[_0x4926('0x44')](handleError(_0x218631,null));};exports[_0x4926('0x45')]=function(_0x416968,_0x572c91){return db[_0x4926('0x26')][_0x4926('0x45')](_0x416968[_0x4926('0x46')],{})[_0x4926('0x1f')](respondWithResult(_0x572c91,0xc9))[_0x4926('0x44')](handleError(_0x572c91,null));};exports[_0x4926('0x47')]=function(_0x43764f,_0x12a89b){if(_0x43764f['body']['id']){delete _0x43764f[_0x4926('0x46')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x43764f[_0x4926('0x3e')]['id']}})[_0x4926('0x1f')](handleEntityNotFound(_0x12a89b,null))['then'](saveUpdates(_0x43764f[_0x4926('0x46')],null))[_0x4926('0x1f')](respondWithResult(_0x12a89b,null))[_0x4926('0x44')](handleError(_0x12a89b,null));};exports[_0x4926('0x20')]=function(_0x15d338,_0x84f5b0){return db['ChatQueueReport']['find']({'where':{'id':_0x15d338['params']['id']}})['then'](handleEntityNotFound(_0x84f5b0,null))[_0x4926('0x1f')](removeEntity(_0x84f5b0,null))[_0x4926('0x44')](handleError(_0x84f5b0,null));};exports[_0x4926('0x48')]=function(_0x298818,_0x1abcdd){return db[_0x4926('0x26')]['describe']()[_0x4926('0x1f')](respondWithResult(_0x1abcdd,null))[_0x4926('0x44')](handleError(_0x1abcdd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2413509..1149803 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(_0x1fbd2b,_0xe9949d){var _0x46dece=function(_0x32dbcd){while(--_0x32dbcd){_0x1fbd2b['push'](_0x1fbd2b['shift']());}};_0x46dece(++_0xe9949d);}(_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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x10cf47,_0x37ecd9){var _0x4c5b51=function(_0x390360){while(--_0x390360){_0x10cf47['push'](_0x10cf47['shift']());}};_0x4c5b51(++_0x37ecd9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index efa0577..d5a25cb 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 _0xa928=['create','options','update','raw','where','attributes','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa928,0x93));var _0x8a92=function(_0x1a30ae,_0x517b4b){_0x1a30ae=_0x1a30ae-0x0;var _0x45fc2b=_0xa928[_0x1a30ae];return _0x45fc2b;};'use strict';var _=require(_0x8a92('0x0'));var util=require(_0x8a92('0x1'));var moment=require(_0x8a92('0x2'));var BPromise=require(_0x8a92('0x3'));var rs=require(_0x8a92('0x4'));var fs=require('fs');var Redis=require(_0x8a92('0x5'));var db=require(_0x8a92('0x6'))['db'];var utils=require(_0x8a92('0x7'));var logger=require(_0x8a92('0x8'))(_0x8a92('0x9'));var config=require(_0x8a92('0xa'));var jayson=require(_0x8a92('0xb'));var client=jayson[_0x8a92('0xc')][_0x8a92('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1eb32a,_0x238bc4,_0x41b83c){return new BPromise(function(_0x2d2336,_0x16290e){return client[_0x8a92('0xe')](_0x1eb32a,_0x41b83c)[_0x8a92('0xf')](function(_0x1e6ef0){logger[_0x8a92('0x10')](_0x8a92('0x11'),_0x238bc4,'request\x20sent');logger[_0x8a92('0x12')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x238bc4,_0x8a92('0x13'),JSON[_0x8a92('0x14')](_0x1e6ef0));if(_0x1e6ef0['error']){if(_0x1e6ef0[_0x8a92('0x15')][_0x8a92('0x16')]===0x1f4){logger['error'](_0x8a92('0x11'),_0x238bc4,_0x1e6ef0['error']['message']);return _0x16290e(_0x1e6ef0[_0x8a92('0x15')][_0x8a92('0x17')]);}logger[_0x8a92('0x15')](_0x8a92('0x11'),_0x238bc4,_0x1e6ef0[_0x8a92('0x15')][_0x8a92('0x17')]);return _0x2d2336(_0x1e6ef0[_0x8a92('0x15')][_0x8a92('0x17')]);}else{logger[_0x8a92('0x10')](_0x8a92('0x11'),_0x238bc4,_0x8a92('0x13'));_0x2d2336(_0x1e6ef0[_0x8a92('0x18')]['message']);}})[_0x8a92('0x19')](function(_0x4d2a34){logger[_0x8a92('0x15')](_0x8a92('0x11'),_0x238bc4,_0x4d2a34);_0x16290e(_0x4d2a34);});});}exports[_0x8a92('0x1a')]=function(_0x2ecd45){var _0x2e311a=this;return new Promise(function(_0xa455ec,_0x46ae4a){return db[_0x8a92('0x1b')][_0x8a92('0x1c')](_0x2ecd45['body'],{'raw':_0x2ecd45[_0x8a92('0x1d')]?_0x2ecd45[_0x8a92('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x8a92('0xf')](function(_0x2272fd){logger[_0x8a92('0x10')](_0x8a92('0x1a'),_0x2ecd45);logger[_0x8a92('0x12')](_0x8a92('0x1a'),_0x2ecd45,JSON['stringify'](_0x2272fd));_0xa455ec(_0x2272fd);})['catch'](function(_0x46ab31){logger[_0x8a92('0x15')]('CreateChatQueueReport',_0x46ab31['message'],_0x2ecd45);_0x46ae4a(_0x2e311a[_0x8a92('0x15')](0x1f4,_0x46ab31[_0x8a92('0x17')]));});});};exports['UpdateChatQueueReport']=function(_0x255699){var _0x21ce0a=this;return new Promise(function(_0x2c19a1,_0x134dfb){return db[_0x8a92('0x1b')][_0x8a92('0x1e')](_0x255699['body'],{'raw':_0x255699[_0x8a92('0x1d')]?_0x255699[_0x8a92('0x1d')][_0x8a92('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x255699[_0x8a92('0x1d')]?_0x255699[_0x8a92('0x1d')][_0x8a92('0x20')]||null:null,'attributes':_0x255699['options']?_0x255699['options'][_0x8a92('0x21')]||null:null,'limit':_0x255699['options']?_0x255699['options']['limit']||null:null})[_0x8a92('0xf')](function(_0x397158){logger[_0x8a92('0x10')](_0x8a92('0x22'),_0x255699);logger[_0x8a92('0x12')]('UpdateChatQueueReport',_0x255699,JSON[_0x8a92('0x14')](_0x397158));_0x2c19a1(_0x397158);})[_0x8a92('0x19')](function(_0x1eedae){logger[_0x8a92('0x15')](_0x8a92('0x22'),_0x1eedae[_0x8a92('0x17')],_0x255699);_0x134dfb(_0x21ce0a[_0x8a92('0x15')](0x1f4,_0x1eedae[_0x8a92('0x17')]));});});}; \ No newline at end of file +var _0xdcc1=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xdcc1,0x15f));var _0x1dcc=function(_0x3b8868,_0x582cfd){_0x3b8868=_0x3b8868-0x0;var _0x504818=_0xdcc1[_0x3b8868];return _0x504818;};'use strict';var _=require(_0x1dcc('0x0'));var util=require('util');var moment=require(_0x1dcc('0x1'));var BPromise=require(_0x1dcc('0x2'));var rs=require(_0x1dcc('0x3'));var fs=require('fs');var Redis=require(_0x1dcc('0x4'));var db=require(_0x1dcc('0x5'))['db'];var utils=require(_0x1dcc('0x6'));var logger=require(_0x1dcc('0x7'))(_0x1dcc('0x8'));var config=require(_0x1dcc('0x9'));var jayson=require(_0x1dcc('0xa'));var client=jayson[_0x1dcc('0xb')][_0x1dcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x548fd5,_0x3ac3ad,_0xa00a3){return new BPromise(function(_0x100a9e,_0x362c46){return client[_0x1dcc('0xd')](_0x548fd5,_0xa00a3)[_0x1dcc('0xe')](function(_0x39c716){logger[_0x1dcc('0xf')](_0x1dcc('0x10'),_0x3ac3ad,_0x1dcc('0x11'));logger[_0x1dcc('0x12')](_0x1dcc('0x13'),_0x3ac3ad,_0x1dcc('0x11'),JSON[_0x1dcc('0x14')](_0x39c716));if(_0x39c716[_0x1dcc('0x15')]){if(_0x39c716[_0x1dcc('0x15')][_0x1dcc('0x16')]===0x1f4){logger[_0x1dcc('0x15')](_0x1dcc('0x10'),_0x3ac3ad,_0x39c716[_0x1dcc('0x15')]['message']);return _0x362c46(_0x39c716[_0x1dcc('0x15')][_0x1dcc('0x17')]);}logger[_0x1dcc('0x15')](_0x1dcc('0x10'),_0x3ac3ad,_0x39c716['error']['message']);return _0x100a9e(_0x39c716[_0x1dcc('0x15')][_0x1dcc('0x17')]);}else{logger[_0x1dcc('0xf')](_0x1dcc('0x10'),_0x3ac3ad,'request\x20sent');_0x100a9e(_0x39c716[_0x1dcc('0x18')][_0x1dcc('0x17')]);}})[_0x1dcc('0x19')](function(_0x522406){logger[_0x1dcc('0x15')](_0x1dcc('0x10'),_0x3ac3ad,_0x522406);_0x362c46(_0x522406);});});}exports[_0x1dcc('0x1a')]=function(_0xcc8b18){var _0x23f38f=this;return new Promise(function(_0x132c04,_0x30b0fa){return db[_0x1dcc('0x1b')][_0x1dcc('0x1c')](_0xcc8b18['body'],{'raw':_0xcc8b18[_0x1dcc('0x1d')]?_0xcc8b18['options'][_0x1dcc('0x1e')]===undefined?!![]:![]:!![]})[_0x1dcc('0xe')](function(_0x3cf4cf){logger[_0x1dcc('0xf')]('CreateChatQueueReport',_0xcc8b18);logger[_0x1dcc('0x12')](_0x1dcc('0x1a'),_0xcc8b18,JSON['stringify'](_0x3cf4cf));_0x132c04(_0x3cf4cf);})['catch'](function(_0x5b01d6){logger[_0x1dcc('0x15')](_0x1dcc('0x1a'),_0x5b01d6['message'],_0xcc8b18);_0x30b0fa(_0x23f38f[_0x1dcc('0x15')](0x1f4,_0x5b01d6[_0x1dcc('0x17')]));});});};exports[_0x1dcc('0x1f')]=function(_0x5d4958){var _0x4d3843=this;return new Promise(function(_0x5ce00c,_0x2404a1){return db['ChatQueueReport'][_0x1dcc('0x20')](_0x5d4958[_0x1dcc('0x21')],{'raw':_0x5d4958[_0x1dcc('0x1d')]?_0x5d4958[_0x1dcc('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d4958[_0x1dcc('0x1d')]?_0x5d4958[_0x1dcc('0x1d')][_0x1dcc('0x22')]||null:null,'attributes':_0x5d4958[_0x1dcc('0x1d')]?_0x5d4958[_0x1dcc('0x1d')][_0x1dcc('0x23')]||null:null,'limit':_0x5d4958['options']?_0x5d4958[_0x1dcc('0x1d')]['limit']||null:null})['then'](function(_0xf24d04){logger[_0x1dcc('0xf')](_0x1dcc('0x1f'),_0x5d4958);logger[_0x1dcc('0x12')](_0x1dcc('0x1f'),_0x5d4958,JSON[_0x1dcc('0x14')](_0xf24d04));_0x5ce00c(_0xf24d04);})[_0x1dcc('0x19')](function(_0x416426){logger['error']('UpdateChatQueueReport',_0x416426['message'],_0x5d4958);_0x2404a1(_0x4d3843[_0x1dcc('0x15')](0x1f4,_0x416426['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f2dbbc5..6d8062d 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 _0x31fb=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy'];(function(_0x3dc6a5,_0x44a6c1){var _0x8961d9=function(_0x4cf66c){while(--_0x4cf66c){_0x3dc6a5['push'](_0x3dc6a5['shift']());}};_0x8961d9(++_0x44a6c1);}(_0x31fb,0x17d));var _0xb31f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x31fb[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xb31f('0x0'));var util=require(_0xb31f('0x1'));var path=require('path');var timeout=require(_0xb31f('0x2'));var express=require(_0xb31f('0x3'));var router=express[_0xb31f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb31f('0x5'));var interaction=require(_0xb31f('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb31f('0x7')]);router[_0xb31f('0x8')](_0xb31f('0x9'),auth[_0xb31f('0xa')](),controller['describe']);router[_0xb31f('0x8')](_0xb31f('0xb'),auth[_0xb31f('0xa')](),controller[_0xb31f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb31f('0xd')]);router[_0xb31f('0xe')](_0xb31f('0xb'),auth[_0xb31f('0xa')](),controller[_0xb31f('0xf')]);router[_0xb31f('0x10')]('/:id',auth[_0xb31f('0xa')](),controller[_0xb31f('0x11')]);module[_0xb31f('0x12')]=router; \ No newline at end of file +var _0x5545=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4e7544,_0x17891b){var _0x1c20ee=function(_0x2c068b){while(--_0x2c068b){_0x4e7544['push'](_0x4e7544['shift']());}};_0x1c20ee(++_0x17891b);}(_0x5545,0x9e));var _0x5554=function(_0x16906e,_0x4dbb0d){_0x16906e=_0x16906e-0x0;var _0x59c212=_0x5545[_0x16906e];return _0x59c212;};'use strict';var multer=require(_0x5554('0x0'));var util=require(_0x5554('0x1'));var path=require(_0x5554('0x2'));var timeout=require(_0x5554('0x3'));var express=require(_0x5554('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5554('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5554('0x6'));var controller=require(_0x5554('0x7'));router[_0x5554('0x8')]('/',auth[_0x5554('0x9')](),controller['index']);router[_0x5554('0x8')](_0x5554('0xa'),auth['isAuthenticated'](),controller[_0x5554('0xb')]);router[_0x5554('0x8')](_0x5554('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5554('0xd')]('/',auth[_0x5554('0x9')](),controller[_0x5554('0xe')]);router[_0x5554('0xf')](_0x5554('0xc'),auth['isAuthenticated'](),controller[_0x5554('0x10')]);router[_0x5554('0x11')](_0x5554('0xc'),auth['isAuthenticated'](),controller[_0x5554('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index eef28f4..508d3dd 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(_0x5b5f67,_0x1cf60e){var _0x2191f9=function(_0x544235){while(--_0x544235){_0x5b5f67['push'](_0x5b5f67['shift']());}};_0x2191f9(++_0x1cf60e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xcb91[_0x903228];return _0xcec81d;};'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(_0x26b985,_0xab9d1){var _0x23d808=function(_0x4b264b){while(--_0x4b264b){_0x26b985['push'](_0x26b985['shift']());}};_0x23d808(++_0xab9d1);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4184f4,_0x1cf45b){_0x4184f4=_0x4184f4-0x0;var _0x3c0e5c=_0xf4eb[_0x4184f4];return _0x3c0e5c;};'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 7d6c8c8..2effe19 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 _0x78d2=['includeAll','include','findAll','rows','params','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x78d2,0x17d));var _0x278d=function(_0x18d36f,_0x31b65f){_0x18d36f=_0x18d36f-0x0;var _0x10034d=_0x78d2[_0x18d36f];return _0x10034d;};'use strict';var emlformat=require(_0x278d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x278d('0x1'));var jsonpatch=require(_0x278d('0x2'));var rp=require(_0x278d('0x3'));var moment=require(_0x278d('0x4'));var BPromise=require(_0x278d('0x5'));var Mustache=require(_0x278d('0x6'));var util=require(_0x278d('0x7'));var path=require(_0x278d('0x8'));var sox=require(_0x278d('0x9'));var csv=require('to-csv');var ejs=require(_0x278d('0xa'));var fs=require('fs');var fs_extra=require(_0x278d('0xb'));var _=require(_0x278d('0xc'));var squel=require(_0x278d('0xd'));var crypto=require(_0x278d('0xe'));var jsforce=require(_0x278d('0xf'));var deskjs=require(_0x278d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x278d('0x11'));var Papa=require('papaparse');var Redis=require(_0x278d('0x12'));var authService=require(_0x278d('0x13'));var qs=require(_0x278d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x278d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x278d('0x16'));var config=require(_0x278d('0x17'));var licenseUtil=require(_0x278d('0x18'));var db=require(_0x278d('0x19'))['db'];function respondWithStatusCode(_0x291e77,_0x58f780){_0x58f780=_0x58f780||0xcc;return function(_0x388895){if(_0x388895){return _0x291e77[_0x278d('0x1a')](_0x58f780);}return _0x291e77[_0x278d('0x1b')](_0x58f780)[_0x278d('0x1c')]();};}function respondWithResult(_0x1722fa,_0x2cd203){_0x2cd203=_0x2cd203||0xc8;return function(_0x3e55cd){if(_0x3e55cd){return _0x1722fa[_0x278d('0x1b')](_0x2cd203)[_0x278d('0x1d')](_0x3e55cd);}};}function respondWithFilteredResult(_0x19f1c8,_0x577220){return function(_0x3c3904){if(_0x3c3904){var _0x5e2880=typeof _0x577220[_0x278d('0x1e')]==='undefined'&&typeof _0x577220[_0x278d('0x1f')]===_0x278d('0x20');var _0x233cc0=_0x3c3904[_0x278d('0x21')];var _0x50cc5c=_0x5e2880?0x0:_0x577220[_0x278d('0x1e')];var _0x261c5d=_0x5e2880?_0x3c3904[_0x278d('0x21')]:_0x577220[_0x278d('0x1e')]+_0x577220['limit'];var _0x3eaa86;if(_0x261c5d>=_0x233cc0){_0x261c5d=_0x233cc0;_0x3eaa86=0xc8;}else{_0x3eaa86=0xce;}_0x19f1c8[_0x278d('0x1b')](_0x3eaa86);return _0x19f1c8[_0x278d('0x22')](_0x278d('0x23'),_0x50cc5c+'-'+_0x261c5d+'/'+_0x233cc0)[_0x278d('0x1d')](_0x3c3904);}return null;};}function patchUpdates(_0x2b10fa){return function(_0xb48aa0){try{jsonpatch['apply'](_0xb48aa0,_0x2b10fa,!![]);}catch(_0x42e5c3){return BPromise['reject'](_0x42e5c3);}return _0xb48aa0['save']();};}function saveUpdates(_0x41ce85,_0x5d92c1){return function(_0x2c4bd3){if(_0x2c4bd3){return _0x2c4bd3[_0x278d('0x24')](_0x41ce85)[_0x278d('0x25')](function(_0x34f16e){return _0x34f16e;});}return null;};}function removeEntity(_0x278c9b,_0x561829){return function(_0x60fed6){if(_0x60fed6){return _0x60fed6['destroy']()[_0x278d('0x25')](function(){_0x278c9b[_0x278d('0x1b')](0xcc)[_0x278d('0x1c')]();});}};}function handleEntityNotFound(_0x556087,_0x47328b){return function(_0x49d8b8){if(!_0x49d8b8){_0x556087[_0x278d('0x1a')](0x194);}return _0x49d8b8;};}function handleError(_0x206b1e,_0x487720){_0x487720=_0x487720||0x1f4;return function(_0x263425){logger[_0x278d('0x26')](_0x263425[_0x278d('0x27')]);if(_0x263425[_0x278d('0x28')]){delete _0x263425['name'];}_0x206b1e[_0x278d('0x1b')](_0x487720)['send'](_0x263425);};}exports[_0x278d('0x29')]=function(_0x1b16d9,_0x59bf85){var _0x4d3738={},_0x122c52={},_0x580915={'count':0x0,'rows':[]};var _0x3343fb=_['map'](db[_0x278d('0x2a')][_0x278d('0x2b')],function(_0x3dbf15){return{'name':_0x3dbf15[_0x278d('0x2c')],'type':_0x3dbf15[_0x278d('0x2d')]['key']};});_0x122c52[_0x278d('0x2e')]=_[_0x278d('0x2f')](_0x3343fb,_0x278d('0x28'));_0x122c52[_0x278d('0x30')]=_[_0x278d('0x31')](_0x1b16d9['query']);_0x122c52['filters']=_['intersection'](_0x122c52['model'],_0x122c52[_0x278d('0x30')]);_0x4d3738['attributes']=_[_0x278d('0x32')](_0x122c52['model'],qs[_0x278d('0x33')](_0x1b16d9['query'][_0x278d('0x33')]));_0x4d3738[_0x278d('0x34')]=_0x4d3738[_0x278d('0x34')][_0x278d('0x35')]?_0x4d3738[_0x278d('0x34')]:_0x122c52[_0x278d('0x2e')];if(!_0x1b16d9[_0x278d('0x30')][_0x278d('0x36')]('nolimit')){_0x4d3738[_0x278d('0x1f')]=qs['limit'](_0x1b16d9['query']['limit']);_0x4d3738[_0x278d('0x1e')]=qs['offset'](_0x1b16d9[_0x278d('0x30')][_0x278d('0x1e')]);}_0x4d3738[_0x278d('0x37')]=qs[_0x278d('0x38')](_0x1b16d9['query']['sort']);_0x4d3738[_0x278d('0x39')]=qs[_0x278d('0x3a')](_[_0x278d('0x3b')](_0x1b16d9[_0x278d('0x30')],_0x122c52[_0x278d('0x3a')]),_0x3343fb);if(_0x1b16d9['query'][_0x278d('0x3c')]){_0x4d3738['where']=_[_0x278d('0x3d')](_0x4d3738['where'],{'$or':_[_0x278d('0x2f')](_0x3343fb,function(_0x1f3712){if(_0x1f3712['type']!=='VIRTUAL'){var _0x2ab4f6={};_0x2ab4f6[_0x1f3712[_0x278d('0x28')]]={'$like':'%'+_0x1b16d9[_0x278d('0x30')]['filter']+'%'};return _0x2ab4f6;}})});}_0x4d3738=_[_0x278d('0x3d')]({},_0x4d3738,_0x1b16d9[_0x278d('0x3e')]);var _0x158660={'where':_0x4d3738[_0x278d('0x39')]};return db['ChatTransferReport'][_0x278d('0x21')](_0x158660)[_0x278d('0x25')](function(_0x24ade6){_0x580915[_0x278d('0x21')]=_0x24ade6;if(_0x1b16d9['query'][_0x278d('0x3f')]){_0x4d3738[_0x278d('0x40')]=[{'all':!![]}];}return db[_0x278d('0x2a')][_0x278d('0x41')](_0x4d3738);})['then'](function(_0x598f1a){_0x580915[_0x278d('0x42')]=_0x598f1a;return _0x580915;})[_0x278d('0x25')](respondWithFilteredResult(_0x59bf85,_0x4d3738))['catch'](handleError(_0x59bf85,null));};exports['show']=function(_0xf5b715,_0x329557){var _0x124f65={'raw':!![],'where':{'id':_0xf5b715[_0x278d('0x43')]['id']}},_0x9023ad={};_0x9023ad[_0x278d('0x2e')]=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x9023ad[_0x278d('0x30')]=_['keys'](_0xf5b715['query']);_0x9023ad[_0x278d('0x3a')]=_[_0x278d('0x32')](_0x9023ad[_0x278d('0x2e')],_0x9023ad[_0x278d('0x30')]);_0x124f65[_0x278d('0x34')]=_['intersection'](_0x9023ad['model'],qs[_0x278d('0x33')](_0xf5b715[_0x278d('0x30')][_0x278d('0x33')]));_0x124f65[_0x278d('0x34')]=_0x124f65['attributes'][_0x278d('0x35')]?_0x124f65[_0x278d('0x34')]:_0x9023ad[_0x278d('0x2e')];if(_0xf5b715[_0x278d('0x30')][_0x278d('0x3f')]){_0x124f65[_0x278d('0x40')]=[{'all':!![]}];}_0x124f65=_[_0x278d('0x3d')]({},_0x124f65,_0xf5b715[_0x278d('0x3e')]);return db[_0x278d('0x2a')][_0x278d('0x44')](_0x124f65)[_0x278d('0x25')](handleEntityNotFound(_0x329557,null))[_0x278d('0x25')](respondWithResult(_0x329557,null))[_0x278d('0x45')](handleError(_0x329557,null));};exports[_0x278d('0x46')]=function(_0x245209,_0x53dfa1){return db['ChatTransferReport'][_0x278d('0x46')](_0x245209['body'],{})['then'](respondWithResult(_0x53dfa1,0xc9))[_0x278d('0x45')](handleError(_0x53dfa1,null));};exports[_0x278d('0x24')]=function(_0x4c7152,_0x2928e8){if(_0x4c7152[_0x278d('0x47')]['id']){delete _0x4c7152[_0x278d('0x47')]['id'];}return db['ChatTransferReport'][_0x278d('0x44')]({'where':{'id':_0x4c7152[_0x278d('0x43')]['id']}})[_0x278d('0x25')](handleEntityNotFound(_0x2928e8,null))[_0x278d('0x25')](saveUpdates(_0x4c7152['body'],null))[_0x278d('0x25')](respondWithResult(_0x2928e8,null))[_0x278d('0x45')](handleError(_0x2928e8,null));};exports[_0x278d('0x48')]=function(_0x8bb6c3,_0x3735e0){return db[_0x278d('0x2a')]['find']({'where':{'id':_0x8bb6c3[_0x278d('0x43')]['id']}})['then'](handleEntityNotFound(_0x3735e0,null))[_0x278d('0x25')](removeEntity(_0x3735e0,null))[_0x278d('0x45')](handleError(_0x3735e0,null));};exports[_0x278d('0x49')]=function(_0x3a0312,_0x3c309b){return db['ChatTransferReport']['describe']()[_0x278d('0x25')](respondWithResult(_0x3c309b,null))[_0x278d('0x45')](handleError(_0x3c309b,null));}; \ No newline at end of file +var _0xaa38=['sort','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','ChatTransferReport','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0xaa38,0x1da));var _0x8aa3=function(_0x1a2455,_0x578d37){_0x1a2455=_0x1a2455-0x0;var _0x336ea1=_0xaa38[_0x1a2455];return _0x336ea1;};'use strict';var emlformat=require(_0x8aa3('0x0'));var rimraf=require(_0x8aa3('0x1'));var zipdir=require(_0x8aa3('0x2'));var jsonpatch=require(_0x8aa3('0x3'));var rp=require(_0x8aa3('0x4'));var moment=require(_0x8aa3('0x5'));var BPromise=require(_0x8aa3('0x6'));var Mustache=require(_0x8aa3('0x7'));var util=require(_0x8aa3('0x8'));var path=require(_0x8aa3('0x9'));var sox=require(_0x8aa3('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa3('0xb'));var _=require(_0x8aa3('0xc'));var squel=require(_0x8aa3('0xd'));var crypto=require(_0x8aa3('0xe'));var jsforce=require(_0x8aa3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8aa3('0x10'));var querystring=require(_0x8aa3('0x11'));var Papa=require(_0x8aa3('0x12'));var Redis=require(_0x8aa3('0x13'));var authService=require(_0x8aa3('0x14'));var qs=require(_0x8aa3('0x15'));var as=require(_0x8aa3('0x16'));var hardwareService=require(_0x8aa3('0x17'));var logger=require(_0x8aa3('0x18'))(_0x8aa3('0x19'));var utils=require(_0x8aa3('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8aa3('0x1b'))['db'];function respondWithStatusCode(_0x3ed657,_0x97e0d6){_0x97e0d6=_0x97e0d6||0xcc;return function(_0x5331e4){if(_0x5331e4){return _0x3ed657[_0x8aa3('0x1c')](_0x97e0d6);}return _0x3ed657[_0x8aa3('0x1d')](_0x97e0d6)[_0x8aa3('0x1e')]();};}function respondWithResult(_0x2ffcfc,_0x2dfad2){_0x2dfad2=_0x2dfad2||0xc8;return function(_0x154b0f){if(_0x154b0f){return _0x2ffcfc['status'](_0x2dfad2)[_0x8aa3('0x1f')](_0x154b0f);}};}function respondWithFilteredResult(_0x82331e,_0x5d8f66){return function(_0x4ea09e){if(_0x4ea09e){var _0x5a6a45=typeof _0x5d8f66[_0x8aa3('0x20')]===_0x8aa3('0x21')&&typeof _0x5d8f66['limit']===_0x8aa3('0x21');var _0x129b8b=_0x4ea09e[_0x8aa3('0x22')];var _0x17ebb7=_0x5a6a45?0x0:_0x5d8f66[_0x8aa3('0x20')];var _0x1317bb=_0x5a6a45?_0x4ea09e[_0x8aa3('0x22')]:_0x5d8f66[_0x8aa3('0x20')]+_0x5d8f66['limit'];var _0x4b9d0a;if(_0x1317bb>=_0x129b8b){_0x1317bb=_0x129b8b;_0x4b9d0a=0xc8;}else{_0x4b9d0a=0xce;}_0x82331e[_0x8aa3('0x1d')](_0x4b9d0a);return _0x82331e['set'](_0x8aa3('0x23'),_0x17ebb7+'-'+_0x1317bb+'/'+_0x129b8b)[_0x8aa3('0x1f')](_0x4ea09e);}return null;};}function patchUpdates(_0x307244){return function(_0x400a19){try{jsonpatch[_0x8aa3('0x24')](_0x400a19,_0x307244,!![]);}catch(_0x369ab2){return BPromise['reject'](_0x369ab2);}return _0x400a19[_0x8aa3('0x25')]();};}function saveUpdates(_0x5d340c,_0x419197){return function(_0x24f4da){if(_0x24f4da){return _0x24f4da[_0x8aa3('0x26')](_0x5d340c)[_0x8aa3('0x27')](function(_0x215b74){return _0x215b74;});}return null;};}function removeEntity(_0x1cede2,_0x1b8a79){return function(_0x2b734b){if(_0x2b734b){return _0x2b734b['destroy']()[_0x8aa3('0x27')](function(){_0x1cede2[_0x8aa3('0x1d')](0xcc)[_0x8aa3('0x1e')]();});}};}function handleEntityNotFound(_0xa1bc81,_0x59ba5e){return function(_0x2e3749){if(!_0x2e3749){_0xa1bc81[_0x8aa3('0x1c')](0x194);}return _0x2e3749;};}function handleError(_0x2f1a7f,_0x21f223){_0x21f223=_0x21f223||0x1f4;return function(_0x273207){logger[_0x8aa3('0x28')](_0x273207[_0x8aa3('0x29')]);if(_0x273207[_0x8aa3('0x2a')]){delete _0x273207[_0x8aa3('0x2a')];}_0x2f1a7f[_0x8aa3('0x1d')](_0x21f223)[_0x8aa3('0x2b')](_0x273207);};}exports[_0x8aa3('0x2c')]=function(_0x55726b,_0x51624a){var _0x4ceae9={},_0x1649b2={},_0x53edab={'count':0x0,'rows':[]};var _0x3c3a14=_['map'](db['ChatTransferReport'][_0x8aa3('0x2d')],function(_0x4cce1d){return{'name':_0x4cce1d[_0x8aa3('0x2e')],'type':_0x4cce1d[_0x8aa3('0x2f')]['key']};});_0x1649b2[_0x8aa3('0x30')]=_[_0x8aa3('0x31')](_0x3c3a14,_0x8aa3('0x2a'));_0x1649b2[_0x8aa3('0x32')]=_[_0x8aa3('0x33')](_0x55726b[_0x8aa3('0x32')]);_0x1649b2[_0x8aa3('0x34')]=_[_0x8aa3('0x35')](_0x1649b2[_0x8aa3('0x30')],_0x1649b2[_0x8aa3('0x32')]);_0x4ceae9[_0x8aa3('0x36')]=_[_0x8aa3('0x35')](_0x1649b2[_0x8aa3('0x30')],qs[_0x8aa3('0x37')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x37')]));_0x4ceae9[_0x8aa3('0x36')]=_0x4ceae9[_0x8aa3('0x36')]['length']?_0x4ceae9[_0x8aa3('0x36')]:_0x1649b2[_0x8aa3('0x30')];if(!_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x38')]('nolimit')){_0x4ceae9[_0x8aa3('0x39')]=qs[_0x8aa3('0x39')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x39')]);_0x4ceae9[_0x8aa3('0x20')]=qs[_0x8aa3('0x20')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x20')]);}_0x4ceae9['order']=qs[_0x8aa3('0x3a')](_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x3a')]);_0x4ceae9['where']=qs[_0x8aa3('0x34')](_['pick'](_0x55726b[_0x8aa3('0x32')],_0x1649b2['filters']),_0x3c3a14);if(_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x3b')]){_0x4ceae9[_0x8aa3('0x3c')]=_[_0x8aa3('0x3d')](_0x4ceae9['where'],{'$or':_[_0x8aa3('0x31')](_0x3c3a14,function(_0x46c31c){if(_0x46c31c[_0x8aa3('0x2f')]!==_0x8aa3('0x3e')){var _0x21f516={};_0x21f516[_0x46c31c[_0x8aa3('0x2a')]]={'$like':'%'+_0x55726b['query'][_0x8aa3('0x3b')]+'%'};return _0x21f516;}})});}_0x4ceae9=_[_0x8aa3('0x3d')]({},_0x4ceae9,_0x55726b[_0x8aa3('0x3f')]);var _0x781c94={'where':_0x4ceae9[_0x8aa3('0x3c')]};return db['ChatTransferReport']['count'](_0x781c94)[_0x8aa3('0x27')](function(_0x34305d){_0x53edab[_0x8aa3('0x22')]=_0x34305d;if(_0x55726b[_0x8aa3('0x32')][_0x8aa3('0x40')]){_0x4ceae9[_0x8aa3('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4ceae9);})[_0x8aa3('0x27')](function(_0xc46166){_0x53edab['rows']=_0xc46166;return _0x53edab;})[_0x8aa3('0x27')](respondWithFilteredResult(_0x51624a,_0x4ceae9))[_0x8aa3('0x42')](handleError(_0x51624a,null));};exports[_0x8aa3('0x43')]=function(_0x720086,_0x378449){var _0x59c17a={'raw':!![],'where':{'id':_0x720086[_0x8aa3('0x44')]['id']}},_0x38e917={};_0x38e917[_0x8aa3('0x30')]=_[_0x8aa3('0x33')](db['ChatTransferReport'][_0x8aa3('0x2d')]);_0x38e917[_0x8aa3('0x32')]=_[_0x8aa3('0x33')](_0x720086[_0x8aa3('0x32')]);_0x38e917[_0x8aa3('0x34')]=_[_0x8aa3('0x35')](_0x38e917['model'],_0x38e917[_0x8aa3('0x32')]);_0x59c17a['attributes']=_['intersection'](_0x38e917[_0x8aa3('0x30')],qs[_0x8aa3('0x37')](_0x720086[_0x8aa3('0x32')][_0x8aa3('0x37')]));_0x59c17a[_0x8aa3('0x36')]=_0x59c17a[_0x8aa3('0x36')][_0x8aa3('0x45')]?_0x59c17a[_0x8aa3('0x36')]:_0x38e917[_0x8aa3('0x30')];if(_0x720086[_0x8aa3('0x32')][_0x8aa3('0x40')]){_0x59c17a[_0x8aa3('0x41')]=[{'all':!![]}];}_0x59c17a=_['merge']({},_0x59c17a,_0x720086[_0x8aa3('0x3f')]);return db['ChatTransferReport'][_0x8aa3('0x46')](_0x59c17a)[_0x8aa3('0x27')](handleEntityNotFound(_0x378449,null))[_0x8aa3('0x27')](respondWithResult(_0x378449,null))[_0x8aa3('0x42')](handleError(_0x378449,null));};exports[_0x8aa3('0x47')]=function(_0x726e21,_0x577a47){return db[_0x8aa3('0x48')]['create'](_0x726e21['body'],{})[_0x8aa3('0x27')](respondWithResult(_0x577a47,0xc9))[_0x8aa3('0x42')](handleError(_0x577a47,null));};exports[_0x8aa3('0x26')]=function(_0x5b7517,_0x239397){if(_0x5b7517[_0x8aa3('0x49')]['id']){delete _0x5b7517[_0x8aa3('0x49')]['id'];}return db[_0x8aa3('0x48')][_0x8aa3('0x46')]({'where':{'id':_0x5b7517[_0x8aa3('0x44')]['id']}})['then'](handleEntityNotFound(_0x239397,null))[_0x8aa3('0x27')](saveUpdates(_0x5b7517['body'],null))[_0x8aa3('0x27')](respondWithResult(_0x239397,null))['catch'](handleError(_0x239397,null));};exports[_0x8aa3('0x4a')]=function(_0x1453ec,_0x31efdc){return db['ChatTransferReport'][_0x8aa3('0x46')]({'where':{'id':_0x1453ec[_0x8aa3('0x44')]['id']}})[_0x8aa3('0x27')](handleEntityNotFound(_0x31efdc,null))[_0x8aa3('0x27')](removeEntity(_0x31efdc,null))[_0x8aa3('0x42')](handleError(_0x31efdc,null));};exports[_0x8aa3('0x4b')]=function(_0x3f27e3,_0x5b09dd){return db[_0x8aa3('0x48')][_0x8aa3('0x4b')]()[_0x8aa3('0x27')](respondWithResult(_0x5b09dd,null))[_0x8aa3('0x42')](handleError(_0x5b09dd,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7aa8cf1..9350cca 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 _0x234f=['exports','define','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0x234f,0x87));var _0xf234=function(_0x3a42c2,_0x1860f5){_0x3a42c2=_0x3a42c2-0x0;var _0x525455=_0x234f[_0x3a42c2];return _0x525455;};'use strict';var _=require('lodash');var util=require(_0xf234('0x0'));var logger=require(_0xf234('0x1'))('api');var moment=require(_0xf234('0x2'));var BPromise=require(_0xf234('0x3'));var rp=require(_0xf234('0x4'));var fs=require('fs');var path=require(_0xf234('0x5'));var rimraf=require(_0xf234('0x6'));var config=require(_0xf234('0x7'));var attributes=require(_0xf234('0x8'));module[_0xf234('0x9')]=function(_0x397f4a,_0x5076af){return _0x397f4a[_0xf234('0xa')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf234('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4604=['ChatTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports'];(function(_0x45de85,_0x21c71d){var _0x28146d=function(_0x35d8a8){while(--_0x35d8a8){_0x45de85['push'](_0x45de85['shift']());}};_0x28146d(++_0x21c71d);}(_0x4604,0x152));var _0x4460=function(_0x46415b,_0x513b58){_0x46415b=_0x46415b-0x0;var _0x5bf723=_0x4604[_0x46415b];return _0x5bf723;};'use strict';var _=require(_0x4460('0x0'));var util=require('util');var logger=require(_0x4460('0x1'))('api');var moment=require(_0x4460('0x2'));var BPromise=require(_0x4460('0x3'));var rp=require(_0x4460('0x4'));var fs=require('fs');var path=require(_0x4460('0x5'));var rimraf=require(_0x4460('0x6'));var config=require(_0x4460('0x7'));var attributes=require(_0x4460('0x8'));module[_0x4460('0x9')]=function(_0xf7f02a,_0x1c0d5d){return _0xf7f02a['define'](_0x4460('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4460('0xb'),'fields':[_0x4460('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 3f37643..7a82e9e 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 _0x0b5b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x520449,_0x45e8de){var _0x4d38ff=function(_0x4b2287){while(--_0x4b2287){_0x520449['push'](_0x520449['shift']());}};_0x4d38ff(++_0x45e8de);}(_0x0b5b,0xe9));var _0xb0b5=function(_0x1acf69,_0x2a6dea){_0x1acf69=_0x1acf69-0x0;var _0x17c66e=_0x0b5b[_0x1acf69];return _0x17c66e;};'use strict';var _=require(_0xb0b5('0x0'));var util=require(_0xb0b5('0x1'));var moment=require(_0xb0b5('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0b5('0x3'));var fs=require('fs');var Redis=require(_0xb0b5('0x4'));var db=require(_0xb0b5('0x5'))['db'];var utils=require(_0xb0b5('0x6'));var logger=require(_0xb0b5('0x7'))(_0xb0b5('0x8'));var config=require(_0xb0b5('0x9'));var jayson=require(_0xb0b5('0xa'));var client=jayson[_0xb0b5('0xb')][_0xb0b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1673cc,_0x444b22,_0x21022a){return new BPromise(function(_0x2bc935,_0xfb8d1d){return client[_0xb0b5('0xd')](_0x1673cc,_0x21022a)[_0xb0b5('0xe')](function(_0xa2d61e){logger[_0xb0b5('0xf')](_0xb0b5('0x10'),_0x444b22,_0xb0b5('0x11'));logger[_0xb0b5('0x12')](_0xb0b5('0x13'),_0x444b22,_0xb0b5('0x11'),JSON[_0xb0b5('0x14')](_0xa2d61e));if(_0xa2d61e[_0xb0b5('0x15')]){if(_0xa2d61e['error'][_0xb0b5('0x16')]===0x1f4){logger[_0xb0b5('0x15')](_0xb0b5('0x10'),_0x444b22,_0xa2d61e[_0xb0b5('0x15')][_0xb0b5('0x17')]);return _0xfb8d1d(_0xa2d61e[_0xb0b5('0x15')]['message']);}logger['error'](_0xb0b5('0x10'),_0x444b22,_0xa2d61e[_0xb0b5('0x15')][_0xb0b5('0x17')]);return _0x2bc935(_0xa2d61e[_0xb0b5('0x15')][_0xb0b5('0x17')]);}else{logger['info'](_0xb0b5('0x10'),_0x444b22,_0xb0b5('0x11'));_0x2bc935(_0xa2d61e[_0xb0b5('0x18')][_0xb0b5('0x17')]);}})[_0xb0b5('0x19')](function(_0x2b1f8c){logger[_0xb0b5('0x15')](_0xb0b5('0x10'),_0x444b22,_0x2b1f8c);_0xfb8d1d(_0x2b1f8c);});});} \ No newline at end of file +var _0xb48a=['error','code','request\x20sent','result','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4561b5,_0x3459cb){var _0x13f689=function(_0x5877b3){while(--_0x5877b3){_0x4561b5['push'](_0x4561b5['shift']());}};_0x13f689(++_0x3459cb);}(_0xb48a,0x17c));var _0xab48=function(_0x3cd46c,_0x48428e){_0x3cd46c=_0x3cd46c-0x0;var _0x3f6ab1=_0xb48a[_0x3cd46c];return _0x3f6ab1;};'use strict';var _=require(_0xab48('0x0'));var util=require(_0xab48('0x1'));var moment=require(_0xab48('0x2'));var BPromise=require('bluebird');var rs=require(_0xab48('0x3'));var fs=require('fs');var Redis=require(_0xab48('0x4'));var db=require(_0xab48('0x5'))['db'];var utils=require(_0xab48('0x6'));var logger=require(_0xab48('0x7'))('rpc');var config=require(_0xab48('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56f73a,_0x1cc165,_0x2fe624){return new BPromise(function(_0x2fdd2c,_0x5c9000){return client['request'](_0x56f73a,_0x2fe624)[_0xab48('0xa')](function(_0x2f3aa9){logger[_0xab48('0xb')](_0xab48('0xc'),_0x1cc165,'request\x20sent');logger[_0xab48('0xd')](_0xab48('0xe'),_0x1cc165,'request\x20sent',JSON[_0xab48('0xf')](_0x2f3aa9));if(_0x2f3aa9['error']){if(_0x2f3aa9[_0xab48('0x10')][_0xab48('0x11')]===0x1f4){logger[_0xab48('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x1cc165,_0x2f3aa9[_0xab48('0x10')]['message']);return _0x5c9000(_0x2f3aa9[_0xab48('0x10')]['message']);}logger[_0xab48('0x10')](_0xab48('0xc'),_0x1cc165,_0x2f3aa9[_0xab48('0x10')]['message']);return _0x2fdd2c(_0x2f3aa9[_0xab48('0x10')]['message']);}else{logger[_0xab48('0xb')](_0xab48('0xc'),_0x1cc165,_0xab48('0x12'));_0x2fdd2c(_0x2f3aa9[_0xab48('0x13')][_0xab48('0x14')]);}})[_0xab48('0x15')](function(_0x54a894){logger['error'](_0xab48('0xc'),_0x1cc165,_0x54a894);_0x5c9000(_0x54a894);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9c14514..d7f9c27 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 _0x45b8=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x33c638,_0x462bff){var _0x18a079=function(_0x336610){while(--_0x336610){_0x33c638['push'](_0x33c638['shift']());}};_0x18a079(++_0x462bff);}(_0x45b8,0x1d7));var _0x845b=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x45b8[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require('multer');var util=require(_0x845b('0x0'));var path=require(_0x845b('0x1'));var timeout=require(_0x845b('0x2'));var express=require(_0x845b('0x3'));var router=express[_0x845b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x845b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x845b('0x6'));var controller=require(_0x845b('0x7'));router[_0x845b('0x8')]('/',auth[_0x845b('0x9')](),controller[_0x845b('0xa')]);router['get'](_0x845b('0xb'),auth[_0x845b('0x9')](),controller[_0x845b('0xc')]);router['get'](_0x845b('0xd'),auth[_0x845b('0x9')](),controller[_0x845b('0xe')]);router['post']('/',auth[_0x845b('0x9')](),controller[_0x845b('0xf')]);router[_0x845b('0x10')](_0x845b('0xd'),auth[_0x845b('0x9')](),controller[_0x845b('0x11')]);router[_0x845b('0x12')](_0x845b('0xd'),auth[_0x845b('0x9')](),controller['destroy']);module[_0x845b('0x13')]=router; \ No newline at end of file +var _0xe0be=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','show','post','put','/:id','update','destroy','util','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xe0be,0x1a0));var _0xee0b=function(_0x5f3e13,_0x5332fb){_0x5f3e13=_0x5f3e13-0x0;var _0x3d95a5=_0xe0be[_0x5f3e13];return _0x3d95a5;};'use strict';var multer=require('multer');var util=require(_0xee0b('0x0'));var path=require('path');var timeout=require(_0xee0b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xee0b('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xee0b('0x3'));var config=require(_0xee0b('0x4'));var controller=require(_0xee0b('0x5'));router[_0xee0b('0x6')]('/',auth[_0xee0b('0x7')](),controller['index']);router[_0xee0b('0x6')]('/describe',auth[_0xee0b('0x7')](),controller[_0xee0b('0x8')]);router[_0xee0b('0x6')]('/:id',auth[_0xee0b('0x7')](),controller[_0xee0b('0x9')]);router[_0xee0b('0xa')]('/',auth[_0xee0b('0x7')](),controller['create']);router[_0xee0b('0xb')](_0xee0b('0xc'),auth[_0xee0b('0x7')](),controller[_0xee0b('0xd')]);router['delete']('/:id',auth[_0xee0b('0x7')](),controller[_0xee0b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index daa5925..aebcf13 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 _0xfb50=['mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','input','name','text','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','mandatoryDispositionPauseId'];(function(_0x1ca993,_0x243c1e){var _0x150e5e=function(_0xaf1a3e){while(--_0xaf1a3e){_0x1ca993['push'](_0x1ca993['shift']());}};_0x150e5e(++_0x243c1e);}(_0xfb50,0x10b));var _0x0fb5=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xfb50[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require(_0x0fb5('0x0'));var rs=require(_0x0fb5('0x1'));module[_0x0fb5('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![],'unique':_0x0fb5('0x4')},'description':{'type':Sequelize[_0x0fb5('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x5')},'key':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x6')},'customerAlias':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![],'defaultValue':_0x0fb5('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![],'defaultValue':_0x0fb5('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fb5('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0fb5('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0fb5('0x3')]},'animation':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x0fb5('0xb'),_0x0fb5('0xc')),'defaultValue':_0x0fb5('0xb')},'header_online':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0xe')},'header_offline':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0xf')},'download_transcript':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0fb5('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0fb5('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x14')},'placeholderMessage':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x15')},'closingMessage':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x16')},'closingMessageButton':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x17')},'conditionAgreement':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x18')},'ratingType':{'type':Sequelize[_0x0fb5('0x19')](_0x0fb5('0x1a'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x0fb5('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0fb5('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0fb5('0x1b'),'variable':null,'config':{'placeholder':_0x0fb5('0x1c'),'type':_0x0fb5('0x1d'),'required':!![]},'props':{'title':_0x0fb5('0x1c'),'helpText':''}},{'type':_0x0fb5('0x1b'),'props':{'title':_0x0fb5('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0fb5('0x5'),'type':_0x0fb5('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0fb5('0x1e')]('onlineForm')?JSON['parse'](this[_0x0fb5('0x1e')](_0x0fb5('0x1f'))):{};},'set':function(_0x50c3d9){return this[_0x0fb5('0x20')]('onlineForm',JSON['stringify'](_0x50c3d9));}},'offlineForm':{'type':Sequelize[_0x0fb5('0x10')],'defaultValue':function(){return JSON[_0x0fb5('0x21')]({'items':[{'type':_0x0fb5('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0fb5('0x5'),'type':'email'},'variable':null},{'type':_0x0fb5('0x22'),'config':{'placeholder':_0x0fb5('0x23')},'props':{'title':_0x0fb5('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x0fb5('0x24'))?JSON[_0x0fb5('0x25')](this[_0x0fb5('0x1e')]('offlineForm')):{};},'set':function(_0x43cb61){return this[_0x0fb5('0x20')](_0x0fb5('0x24'),JSON[_0x0fb5('0x21')](_0x43cb61));}},'token':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':function(){return rs[_0x0fb5('0x26')]();}},'autoclose':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0fb5('0x3')]},'forwardOffline':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0fb5('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x27')},'waitingMessage':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x17')},'sendUnmanaged':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0fb5('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0fb5('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0fb5('0x10')],'defaultValue':function(){return _0x0fb5('0x2b');}},'notificationSound':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0fb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0fb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x2d')},'verticalAlignment':{'type':Sequelize[_0x0fb5('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':_0x0fb5('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x0fb5('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0fb5('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fb5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0fb5('0x2f')},'systemAvatar':{'type':Sequelize[_0x0fb5('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0fb5('0x9')],'comment':_0x0fb5('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x0fb5('0xa')],'defaultValue':![],'comment':_0x0fb5('0x31'),'set':function(_0x33134a){if(!_0x33134a)this[_0x0fb5('0x20')](_0x0fb5('0x32'),null);this[_0x0fb5('0x20')](_0x0fb5('0x33'),_0x33134a);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0fb5('0x3')]},'vidaooTopic':{'type':Sequelize[_0x0fb5('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x0fb5('0x3')],'defaultValue':function(){return _0x0fb5('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0fb5('0x10')]}}; \ No newline at end of file +var _0x0ab9=['stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb'];(function(_0x5e33d5,_0x967036){var _0x41fcd5=function(_0x49ae20){while(--_0x49ae20){_0x5e33d5['push'](_0x5e33d5['shift']());}};_0x41fcd5(++_0x967036);}(_0x0ab9,0xd7));var _0x90ab=function(_0x185b54,_0x2ff7b4){_0x185b54=_0x185b54-0x0;var _0x225ec9=_0x0ab9[_0x185b54];return _0x225ec9;};'use strict';var Sequelize=require(_0x90ab('0x0'));var rs=require(_0x90ab('0x1'));module['exports']={'name':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'unique':_0x90ab('0x3')},'description':{'type':Sequelize[_0x90ab('0x2')]},'mapKey':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x5')},'customerAlias':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x90ab('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x90ab('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x90ab('0x9')](_0x90ab('0xa'),_0x90ab('0xb')),'defaultValue':_0x90ab('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0xc')},'start_chat_button':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x90ab('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x90ab('0xf')]},'closingQuestion':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x12')},'closingMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x14')},'skipMessageButton':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x15')},'conditionAgreement':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x16')},'ratingType':{'type':Sequelize[_0x90ab('0x9')](_0x90ab('0x17'),_0x90ab('0x18')),'defaultValue':_0x90ab('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x90ab('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x90ab('0xf')],'defaultValue':function(){return JSON[_0x90ab('0x19')]({'items':[{'type':_0x90ab('0x1a'),'variable':null,'config':{'placeholder':_0x90ab('0x1b'),'type':_0x90ab('0x1c'),'required':!![]},'props':{'title':_0x90ab('0x1b'),'helpText':''}},{'type':_0x90ab('0x1a'),'props':{'title':_0x90ab('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x90ab('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x90ab('0x1d'))?JSON[_0x90ab('0x1e')](this[_0x90ab('0x1f')]('onlineForm')):{};},'set':function(_0xb26300){return this[_0x90ab('0x20')](_0x90ab('0x1d'),JSON[_0x90ab('0x19')](_0xb26300));}},'offlineForm':{'type':Sequelize[_0x90ab('0xf')],'defaultValue':function(){return JSON[_0x90ab('0x19')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x90ab('0x4')},'variable':null},{'type':_0x90ab('0x21'),'config':{'placeholder':_0x90ab('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x90ab('0x1f')]('offlineForm')?JSON[_0x90ab('0x1e')](this[_0x90ab('0x1f')]('offlineForm')):{};},'set':function(_0xdb3c09){return this['setDataValue'](_0x90ab('0x23'),JSON[_0x90ab('0x19')](_0xdb3c09));}},'token':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':function(){return rs[_0x90ab('0x24')]();}},'autoclose':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x90ab('0x2')]},'waitingTitle':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x25')},'waitingMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x15')},'sendUnmanaged':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x90ab('0xf')],'defaultValue':function(){return _0x90ab('0x28');}},'notificationSound':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x90ab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x2a')},'messagesAlignment':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':_0x90ab('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x90ab('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':_0x90ab('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x90ab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x90ab('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x90ab('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9004b8){if(!_0x9004b8)this[_0x90ab('0x20')](_0x90ab('0x2e'),null);this['setDataValue']('mandatoryDisposition',_0x9004b8);}},'vidaooEscalation':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x90ab('0x2')]},'vidaooTopic':{'type':Sequelize[_0x90ab('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x90ab('0x2')],'defaultValue':function(){return _0x90ab('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x90ab('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x90ab('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1e53e6c..71c7df1 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 _0x202c=['offlineMessageSubject','toPairsIn','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','internal','Tags','color','tag','getSnippet','interval','getProactiveActions','custom','increment','chatLicenseExceeded','readFileSync','origin','http://localhost:9000','address','remote','x-real-ip','connection','replace','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','ejs','fs-extra','lodash','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','api','../../config/environment','APIBadRequestError','APINotFoundError','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','result','message','sendStatus','status','json','undefined','limit','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','name','send','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','unknown','version','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','Pause','ChatWebsite','rawAttributes','fieldName','key','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','length','find','catch','create','forEach','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','testWildcardValidity','params','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','agentAvatar','join','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','CompanyId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','Contacts','DESC','Intervals','account','orderBy','Applications','priority','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','applications','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','ListId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','utf8','render','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','forwardOfflineAddress'];(function(_0x2365db,_0x4ea500){var _0x2bee41=function(_0x617f7b){while(--_0x617f7b){_0x2365db['push'](_0x2365db['shift']());}};_0x2bee41(++_0x4ea500);}(_0x202c,0x178));var _0xc202=function(_0x1c30bf,_0x68313b){_0x1c30bf=_0x1c30bf-0x0;var _0x5adc49=_0x202c[_0x1c30bf];return _0x5adc49;};'use strict';var Mustache=require(_0xc202('0x0'));var util=require('util');var path=require('path');var ejs=require(_0xc202('0x1'));var fs=require('fs');var fs_extra=require(_0xc202('0x2'));var _=require(_0xc202('0x3'));var querystring=require('querystring');var htmlToText=require(_0xc202('0x4'));var Redis=require(_0xc202('0x5'));var jayson=require(_0xc202('0x6'));var qs=require(_0xc202('0x7'));var logger=require('../../config/logger')(_0xc202('0x8'));var config=require(_0xc202('0x9'));var APIBadRequestError=require('../../errors/api')[_0xc202('0xa')];var APINotFoundError=require('../../errors/api')[_0xc202('0xb')];var APIOutOfIntervalError=require(_0xc202('0xc'))[_0xc202('0xd')];var APIHandleError=require(_0xc202('0xc'))[_0xc202('0xe')];var APIConflictError=require(_0xc202('0xc'))[_0xc202('0xf')];var wildcardUtils=require(_0xc202('0x10'));var URL=require(_0xc202('0x11'))[_0xc202('0x12')];var db=require(_0xc202('0x13'))['db'];config[_0xc202('0x14')]=_[_0xc202('0x15')](config['redis'],{'host':_0xc202('0x16'),'port':0x18eb});var socket=require(_0xc202('0x17'))(new Redis(config[_0xc202('0x14')]));require(_0xc202('0x18'))[_0xc202('0x19')](socket);var client=jayson[_0xc202('0x1a')][_0xc202('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xc202('0x1b')]({'port':0x232a});var client9003=jayson[_0xc202('0x1a')]['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x2dafa5,_0x4a333c,_0x2f18ec,_0x5971a6){return new Promise(function(_0x19af73,_0x1d580c){var _0x3018c8=_0x5971a6||client;return _0x3018c8[_0xc202('0x1c')](_0x2dafa5,_0x2f18ec)[_0xc202('0x1d')](function(_0x2419c5){logger[_0xc202('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x4a333c,_0xc202('0x1f'));logger[_0xc202('0x20')](_0xc202('0x21'),_0x4a333c,'request\x20sent',JSON['stringify'](_0x2419c5));if(_0x2419c5[_0xc202('0x22')]){if(_0x2419c5[_0xc202('0x22')][_0xc202('0x23')]===0x1f4){logger[_0xc202('0x22')](_0xc202('0x24'),_0x4a333c,_0x2419c5['error']['message']);return _0x1d580c(_0x2419c5[_0xc202('0x22')]['message']);}logger[_0xc202('0x22')](_0xc202('0x24'),_0x4a333c,_0x2419c5['error']['message']);return _0x19af73(_0x2419c5[_0xc202('0x22')]['message']);}else{logger[_0xc202('0x1e')](_0xc202('0x24'),_0x4a333c,_0xc202('0x1f'));_0x19af73(_0x2419c5[_0xc202('0x25')][_0xc202('0x26')]);}})['catch'](function(_0x59f84d){logger[_0xc202('0x22')](_0xc202('0x24'),_0x4a333c,_0x59f84d);_0x1d580c(_0x59f84d);});});}function respondWithStatusCode(_0x459bc2,_0x4ff3e3){_0x4ff3e3=_0x4ff3e3||0xcc;return function(_0xdd5798){if(_0xdd5798){return _0x459bc2[_0xc202('0x27')](_0x4ff3e3);}return _0x459bc2['status'](_0x4ff3e3)['end']();};}function respondWithResult(_0x257dfe,_0x2f8011){_0x2f8011=_0x2f8011||0xc8;return function(_0xd88a43){if(_0xd88a43){return _0x257dfe[_0xc202('0x28')](_0x2f8011)[_0xc202('0x29')](_0xd88a43);}};}function respondWithFilteredResult(_0x483357,_0x114abb){return function(_0x32f56c){if(_0x32f56c){var _0x4f01fa=typeof _0x114abb['offset']===_0xc202('0x2a')&&typeof _0x114abb[_0xc202('0x2b')]===_0xc202('0x2a');var _0x189211=_0x32f56c['count'];var _0x1f09cf=_0x4f01fa?0x0:_0x114abb[_0xc202('0x2c')];var _0x3c3f22=_0x4f01fa?_0x32f56c['count']:_0x114abb[_0xc202('0x2c')]+_0x114abb[_0xc202('0x2b')];var _0xf1fe4c;if(_0x3c3f22>=_0x189211){_0x3c3f22=_0x189211;_0xf1fe4c=0xc8;}else{_0xf1fe4c=0xce;}_0x483357[_0xc202('0x28')](_0xf1fe4c);return _0x483357[_0xc202('0x2d')](_0xc202('0x2e'),_0x1f09cf+'-'+_0x3c3f22+'/'+_0x189211)[_0xc202('0x29')](_0x32f56c);}return null;};}function saveUpdates(_0x358b35){return function(_0x561070){if(_0x561070){return _0x561070[_0xc202('0x2f')](_0x358b35)[_0xc202('0x1d')](function(_0x442653){return _0x442653;});}return null;};}function removeEntity(_0x50c547){return function(_0x38e439){if(_0x38e439){return _0x38e439[_0xc202('0x30')]()[_0xc202('0x1d')](function(){var _0x5a59a4=_0x38e439[_0xc202('0x31')]({'plain':!![]});var _0x501db2=_0xc202('0x32');return db[_0xc202('0x33')][_0xc202('0x30')]({'where':{'type':_0x501db2,'resourceId':_0x5a59a4['id']}})[_0xc202('0x1d')](function(){return _0x38e439;});})[_0xc202('0x1d')](function(){_0x50c547[_0xc202('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed50bd){return function(_0x5087e3){if(!_0x5087e3){_0xed50bd[_0xc202('0x27')](0x194);}return _0x5087e3;};}function handleError(_0x52e163,_0x244489){_0x244489=_0x244489||0x1f4;return function(_0x147272){logger[_0xc202('0x22')](_0x147272['stack']);if(_0x147272[_0xc202('0x34')]){delete _0x147272[_0xc202('0x34')];}_0x52e163[_0xc202('0x28')](_0x244489)[_0xc202('0x35')](_0x147272);};}function createInteractionObject(_0x306889,_0x2afa4e,_0x578344,_0x16608b){var _0x1e57c3=require(_0xc202('0x36'));var _0x4a8d2b=new _0x1e57c3();var _0x41e42b=_0x4a8d2b[_0xc202('0x37')](_0x578344[_0xc202('0x38')])[_0xc202('0x39')]();var _0x5bfaa2=_0x2afa4e['customerIp'];if(_0x578344[_0xc202('0x3a')]){_0x5bfaa2=_0x578344['cf-connecting-ip'];}else if(_0x578344[_0xc202('0x3b')]){_0x5bfaa2=_[_0xc202('0x3c')](_0x578344[_0xc202('0x3b')][_0xc202('0x3d')](','));}return{'ContactId':_0x16608b['id'],'ChatWebsiteId':_0x306889,'from':(_0x16608b[_0xc202('0x3e')]||'')+'\x20'+(_0x16608b[_0xc202('0x3f')]||''),'customerIp':_0x5bfaa2,'customerPort':_0x578344['x-real-port']?_0x578344[_0xc202('0x40')]:null,'referer':_0x2afa4e[_0xc202('0x41')],'browserName':_0x41e42b[_0xc202('0x42')][_0xc202('0x34')]&&_0x41e42b[_0xc202('0x42')]['version']?util[_0xc202('0x43')](_0xc202('0x44'),_0x41e42b[_0xc202('0x42')][_0xc202('0x34')],_0x41e42b[_0xc202('0x42')]['version']):_0xc202('0x45'),'browserVersion':_0x41e42b['browser'][_0xc202('0x46')]||'unknown','osName':util[_0xc202('0x43')](_0xc202('0x44'),_0x41e42b['os'][_0xc202('0x34')],_0x41e42b['os'][_0xc202('0x46')]),'osVersion':_0x41e42b['os']['version'],'deviceModel':_0x41e42b[_0xc202('0x47')][_0xc202('0x48')]&&_0x41e42b[_0xc202('0x47')][_0xc202('0x49')]?util[_0xc202('0x43')](_0xc202('0x4a'),_0x41e42b[_0xc202('0x47')][_0xc202('0x48')],_0x41e42b[_0xc202('0x47')][_0xc202('0x49')],_0x41e42b[_0xc202('0x47')][_0xc202('0x4b')]):null,'deviceVendor':_0x41e42b[_0xc202('0x47')][_0xc202('0x49')],'deviceType':_0x41e42b[_0xc202('0x47')][_0xc202('0x4b')],'formData':JSON[_0xc202('0x4c')](_0x2afa4e)};}exports[_0xc202('0x4d')]=function(_0x9f8ab3,_0x38e9c8){var _0x484013={'include':[{'model':db[_0xc202('0x4e')],'as':'mandatoryDispositionPause'}]},_0x39f2c1={},_0x187934={'count':0x0,'rows':[]};var _0x4ae64d=_['map'](db[_0xc202('0x4f')][_0xc202('0x50')],function(_0x1ae220){return{'name':_0x1ae220[_0xc202('0x51')],'type':_0x1ae220[_0xc202('0x4b')][_0xc202('0x52')]};});_0x39f2c1[_0xc202('0x48')]=_[_0xc202('0x53')](_0x4ae64d,_0xc202('0x34'));_0x39f2c1[_0xc202('0x54')]=_[_0xc202('0x55')](_0x9f8ab3[_0xc202('0x54')]);_0x39f2c1[_0xc202('0x56')]=_['intersection'](_0x39f2c1[_0xc202('0x48')],_0x39f2c1[_0xc202('0x54')]);_0x484013['attributes']=_[_0xc202('0x57')](_0x39f2c1[_0xc202('0x48')],qs[_0xc202('0x58')](_0x9f8ab3[_0xc202('0x54')][_0xc202('0x58')]));_0x484013['attributes']=_0x484013[_0xc202('0x59')]['length']?_0x484013[_0xc202('0x59')]:_0x39f2c1['model'];if(!_0x9f8ab3[_0xc202('0x54')][_0xc202('0x5a')]('nolimit')){_0x484013[_0xc202('0x2b')]=qs[_0xc202('0x2b')](_0x9f8ab3['query']['limit']);_0x484013['offset']=qs[_0xc202('0x2c')](_0x9f8ab3['query'][_0xc202('0x2c')]);}_0x484013[_0xc202('0x5b')]=qs[_0xc202('0x5c')](_0x9f8ab3[_0xc202('0x54')][_0xc202('0x5c')]);_0x484013[_0xc202('0x5d')]=qs[_0xc202('0x56')](_[_0xc202('0x5e')](_0x9f8ab3[_0xc202('0x54')],_0x39f2c1[_0xc202('0x56')]),_0x4ae64d);if(_0x9f8ab3[_0xc202('0x54')][_0xc202('0x5f')]){_0x484013[_0xc202('0x5d')]=_['merge'](_0x484013[_0xc202('0x5d')],{'$or':_['map'](_0x4ae64d,function(_0x5a7f2c){if(_0x5a7f2c[_0xc202('0x4b')]!==_0xc202('0x60')){var _0x40f55f={};_0x40f55f[_0x5a7f2c['name']]={'$like':'%'+_0x9f8ab3[_0xc202('0x54')]['filter']+'%'};return _0x40f55f;}})});}_0x484013=_[_0xc202('0x61')]({},_0x484013,_0x9f8ab3[_0xc202('0x62')]);var _0x5464ea={'where':_0x484013[_0xc202('0x5d')]};return db[_0xc202('0x4f')]['count'](_0x5464ea)[_0xc202('0x1d')](function(_0x499e75){_0x187934[_0xc202('0x63')]=_0x499e75;if(_0x9f8ab3[_0xc202('0x54')][_0xc202('0x64')]){_0x484013[_0xc202('0x65')]=[{'all':!![]}];}return db[_0xc202('0x4f')][_0xc202('0x66')](_0x484013);})[_0xc202('0x1d')](function(_0x5dc65f){_0x187934[_0xc202('0x67')]=_0x5dc65f;return _0x187934;})[_0xc202('0x1d')](respondWithFilteredResult(_0x38e9c8,_0x484013))['catch'](handleError(_0x38e9c8,null));};exports[_0xc202('0x68')]=function(_0x4860cf,_0x28ba39){var _0x4a2a48={'raw':![],'where':{'id':_0x4860cf['params']['id']},'include':[{'model':db[_0xc202('0x4e')],'as':'mandatoryDispositionPause'}]},_0x3642d2={};_0x3642d2['model']=_[_0xc202('0x55')](db[_0xc202('0x4f')][_0xc202('0x50')]);_0x3642d2[_0xc202('0x54')]=_[_0xc202('0x55')](_0x4860cf[_0xc202('0x54')]);_0x3642d2[_0xc202('0x56')]=_[_0xc202('0x57')](_0x3642d2[_0xc202('0x48')],_0x3642d2[_0xc202('0x54')]);_0x4a2a48['attributes']=_[_0xc202('0x57')](_0x3642d2[_0xc202('0x48')],qs['fields'](_0x4860cf[_0xc202('0x54')][_0xc202('0x58')]));_0x4a2a48[_0xc202('0x59')]=_0x4a2a48[_0xc202('0x59')][_0xc202('0x69')]?_0x4a2a48[_0xc202('0x59')]:_0x3642d2[_0xc202('0x48')];if(_0x4860cf[_0xc202('0x54')]['includeAll']){_0x4a2a48[_0xc202('0x65')]=[{'all':!![]}];}_0x4a2a48=_[_0xc202('0x61')]({},_0x4a2a48,_0x4860cf[_0xc202('0x62')]);return db[_0xc202('0x4f')][_0xc202('0x6a')](_0x4a2a48)['then'](handleEntityNotFound(_0x28ba39,null))[_0xc202('0x1d')](respondWithResult(_0x28ba39,null))[_0xc202('0x6b')](handleError(_0x28ba39,null));};exports[_0xc202('0x6c')]=function(_0x5ae21d,_0x7f638c){var _0x4dfb2f=null;_0x5ae21d['body']['address'][_0xc202('0x3d')](',')[_0xc202('0x6d')](_0x189884=>{if(_0x189884[_0xc202('0x6e')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x189884[_0xc202('0x6e')]())){_0x4dfb2f=new APIBadRequestError('\x22'+_0x189884['trim']()+_0xc202('0x6f'));}});if(_0x4dfb2f){return handleError(_0x7f638c,null)(_0x4dfb2f);}return db[_0xc202('0x4f')]['create'](_0x5ae21d[_0xc202('0x70')],{})[_0xc202('0x1d')](function(_0xea479f){var _0x4d9423=_0x5ae21d['user']['get']({'plain':!![]});if(!_0x4d9423)throw new Error(_0xc202('0x71'));if(_0x4d9423[_0xc202('0x72')]==='user'){var _0x44d834=_0xea479f[_0xc202('0x31')]({'plain':!![]});var _0x5a97d5=_0xc202('0x32');return db['UserProfileSection'][_0xc202('0x6a')]({'where':{'name':_0x5a97d5,'userProfileId':_0x4d9423[_0xc202('0x73')]},'raw':!![]})[_0xc202('0x1d')](function(_0x436c8e){if(_0x436c8e&&_0x436c8e[_0xc202('0x74')]===0x0){return db['UserProfileResource']['create']({'name':_0x44d834[_0xc202('0x34')],'resourceId':_0x44d834['id'],'type':_0x436c8e[_0xc202('0x34')],'sectionId':_0x436c8e['id']},{})[_0xc202('0x1d')](function(){return _0xea479f;});}else{return _0xea479f;}})[_0xc202('0x6b')](function(_0x4171d8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4171d8);throw _0x4171d8;});}return _0xea479f;})[_0xc202('0x1d')](respondWithResult(_0x7f638c,0xc9))[_0xc202('0x6b')](handleError(_0x7f638c,null));};exports[_0xc202('0x2f')]=function(_0x44cbd2,_0x6dc70e){var _0x1dd5c0=null;_0x44cbd2['body']['address'][_0xc202('0x3d')](',')[_0xc202('0x6d')](_0x16229b=>{if(_0x16229b['trim']()!==''&&!wildcardUtils[_0xc202('0x75')](_0x16229b[_0xc202('0x6e')]())){_0x1dd5c0=new APIBadRequestError('\x22'+_0x16229b['trim']()+_0xc202('0x6f'));}});if(_0x1dd5c0){return handleError(_0x6dc70e,null)(_0x1dd5c0);}if(_0x44cbd2[_0xc202('0x70')]['id']){delete _0x44cbd2['body']['id'];}return db[_0xc202('0x4f')][_0xc202('0x6a')]({'where':{'id':_0x44cbd2[_0xc202('0x76')]['id']},'include':[{'model':db[_0xc202('0x4e')],'as':_0xc202('0x77')}]})['then'](handleEntityNotFound(_0x6dc70e,null))[_0xc202('0x1d')](saveUpdates(_0x44cbd2['body'],null))[_0xc202('0x1d')](respondWithResult(_0x6dc70e,null))[_0xc202('0x6b')](handleError(_0x6dc70e,null));};exports['destroy']=function(_0x2d149a,_0x5b8a32){return db[_0xc202('0x4f')][_0xc202('0x6a')]({'where':{'id':_0x2d149a[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x5b8a32,null))['then'](removeEntity(_0x5b8a32,null))[_0xc202('0x6b')](handleError(_0x5b8a32,null));};exports[_0xc202('0x78')]=function(_0x3b8197,_0x3d33e5){return db[_0xc202('0x4f')][_0xc202('0x78')]()['then'](respondWithResult(_0x3d33e5,null))[_0xc202('0x6b')](handleError(_0x3d33e5,null));};exports[_0xc202('0x79')]=function(_0x4e4604,_0x1f7734){if(_0x4e4604[_0xc202('0x70')]['id']){delete _0x4e4604['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x4e4604[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x1f7734,null))[_0xc202('0x1d')](function(_0x51e2df){if(_0x51e2df){_0x4e4604[_0xc202('0x70')][_0xc202('0x7a')]=_0x51e2df['id'];return db[_0xc202('0x7b')][_0xc202('0x6c')](_0x4e4604[_0xc202('0x70')]);}})['then'](respondWithResult(_0x1f7734,null))[_0xc202('0x6b')](handleError(_0x1f7734,null));};exports[_0xc202('0x7c')]=function(_0x963cc,_0x3b7c1c){var _0x20621b={'raw':![],'where':{}};var _0x291848={};var _0x429ebc={'count':0x0,'rows':[]};return db[_0xc202('0x4f')][_0xc202('0x7d')]({'where':{'id':_0x963cc[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x3b7c1c,null))['then'](function(_0x274c94){if(_0x274c94){_0x291848[_0xc202('0x48')]=_['keys'](db[_0xc202('0x7b')][_0xc202('0x50')]);_0x291848[_0xc202('0x54')]=_[_0xc202('0x55')](_0x963cc[_0xc202('0x54')]);_0x291848['filters']=_[_0xc202('0x57')](_0x291848['model'],_0x291848[_0xc202('0x54')]);_0x20621b[_0xc202('0x59')]=_[_0xc202('0x57')](_0x291848[_0xc202('0x48')],qs['fields'](_0x963cc[_0xc202('0x54')][_0xc202('0x58')]));_0x20621b[_0xc202('0x59')]=_0x20621b[_0xc202('0x59')][_0xc202('0x69')]?_0x20621b[_0xc202('0x59')]:_0x291848[_0xc202('0x48')];if(!_0x963cc[_0xc202('0x54')][_0xc202('0x5a')](_0xc202('0x7e'))){_0x20621b[_0xc202('0x2b')]=qs['limit'](_0x963cc['query'][_0xc202('0x2b')]);_0x20621b[_0xc202('0x2c')]=qs[_0xc202('0x2c')](_0x963cc[_0xc202('0x54')]['offset']);}_0x20621b[_0xc202('0x5b')]=qs['sort'](_0x963cc['query'][_0xc202('0x5c')]);_0x20621b[_0xc202('0x5d')]=qs['filters'](_['pick'](_0x963cc['query'],_0x291848[_0xc202('0x56')]));_0x20621b[_0xc202('0x5d')]['ChatWebsiteId']=_0x274c94['id'];if(_0x963cc[_0xc202('0x54')][_0xc202('0x5f')]){_0x20621b[_0xc202('0x5d')]=_[_0xc202('0x61')](_0x20621b['where'],{'$or':_[_0xc202('0x53')](_0x20621b[_0xc202('0x59')],function(_0x330f97){var _0x1c50cb={};_0x1c50cb[_0x330f97]={'$like':'%'+_0x963cc['query'][_0xc202('0x5f')]+'%'};return _0x1c50cb;})});}_0x20621b=_['merge']({},_0x20621b,_0x963cc['options']);return db[_0xc202('0x7b')][_0xc202('0x63')]({'where':_0x20621b[_0xc202('0x5d')]})[_0xc202('0x1d')](function(_0xaf2f5c){_0x429ebc['count']=_0xaf2f5c;if(_0x963cc[_0xc202('0x54')][_0xc202('0x64')]){_0x20621b[_0xc202('0x65')]=[{'all':!![]}];}return db['Disposition'][_0xc202('0x66')](_0x20621b);})[_0xc202('0x1d')](function(_0xe0c7b2){_0x429ebc['rows']=_0xe0c7b2;return _0x429ebc;});}})[_0xc202('0x1d')](respondWithFilteredResult(_0x3b7c1c,_0x20621b))[_0xc202('0x6b')](handleError(_0x3b7c1c,null));};exports[_0xc202('0x7f')]=function(_0x27fdb4,_0x558384){return db[_0xc202('0x4f')][_0xc202('0x6a')]({'where':{'id':_0x27fdb4[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x558384,null))['then'](function(_0x2a2f56){if(_0x2a2f56){return _0x2a2f56['removeDispositions'](_0x27fdb4[_0xc202('0x54')][_0xc202('0x80')]);}})[_0xc202('0x1d')](respondWithStatusCode(_0x558384,null))['catch'](handleError(_0x558384,null));};exports[_0xc202('0x81')]=function(_0xc3e1f6,_0x130c8b){if(_0xc3e1f6[_0xc202('0x70')]['id']){delete _0xc3e1f6[_0xc202('0x70')]['id'];}return db[_0xc202('0x4f')][_0xc202('0x6a')]({'where':{'id':_0xc3e1f6['params']['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x130c8b,null))[_0xc202('0x1d')](function(_0x4bb3fa){if(_0x4bb3fa){_0xc3e1f6[_0xc202('0x70')][_0xc202('0x7a')]=_0x4bb3fa['id'];return db[_0xc202('0x82')]['create'](_0xc3e1f6[_0xc202('0x70')]);}})[_0xc202('0x1d')](respondWithResult(_0x130c8b,null))['catch'](handleError(_0x130c8b,null));};exports['getAnswers']=function(_0x100ca6,_0xf3eda3){var _0x3f68ba={'raw':![],'where':{}};var _0x3c2d12={};var _0xf2094a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc202('0x7d')]({'where':{'id':_0x100ca6[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0xf3eda3,null))[_0xc202('0x1d')](function(_0x2a2a3e){if(_0x2a2a3e){_0x3c2d12[_0xc202('0x48')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x3c2d12[_0xc202('0x54')]=_[_0xc202('0x55')](_0x100ca6[_0xc202('0x54')]);_0x3c2d12[_0xc202('0x56')]=_['intersection'](_0x3c2d12['model'],_0x3c2d12[_0xc202('0x54')]);_0x3f68ba[_0xc202('0x59')]=_[_0xc202('0x57')](_0x3c2d12[_0xc202('0x48')],qs[_0xc202('0x58')](_0x100ca6[_0xc202('0x54')][_0xc202('0x58')]));_0x3f68ba[_0xc202('0x59')]=_0x3f68ba[_0xc202('0x59')][_0xc202('0x69')]?_0x3f68ba[_0xc202('0x59')]:_0x3c2d12[_0xc202('0x48')];if(!_0x100ca6[_0xc202('0x54')][_0xc202('0x5a')](_0xc202('0x7e'))){_0x3f68ba[_0xc202('0x2b')]=qs[_0xc202('0x2b')](_0x100ca6[_0xc202('0x54')][_0xc202('0x2b')]);_0x3f68ba[_0xc202('0x2c')]=qs['offset'](_0x100ca6[_0xc202('0x54')]['offset']);}_0x3f68ba['order']=qs[_0xc202('0x5c')](_0x100ca6['query']['sort']);_0x3f68ba[_0xc202('0x5d')]=qs[_0xc202('0x56')](_[_0xc202('0x5e')](_0x100ca6[_0xc202('0x54')],_0x3c2d12['filters']));_0x3f68ba[_0xc202('0x5d')][_0xc202('0x7a')]=_0x2a2a3e['id'];if(_0x100ca6[_0xc202('0x54')][_0xc202('0x5f')]){_0x3f68ba[_0xc202('0x5d')]=_['merge'](_0x3f68ba[_0xc202('0x5d')],{'$or':_['map'](_0x3f68ba[_0xc202('0x59')],function(_0x1b3c73){var _0x186b17={};_0x186b17[_0x1b3c73]={'$like':'%'+_0x100ca6['query']['filter']+'%'};return _0x186b17;})});}_0x3f68ba=_[_0xc202('0x61')]({},_0x3f68ba,_0x100ca6[_0xc202('0x62')]);return db[_0xc202('0x82')][_0xc202('0x63')]({'where':_0x3f68ba['where']})[_0xc202('0x1d')](function(_0x23e3f0){_0xf2094a['count']=_0x23e3f0;if(_0x100ca6[_0xc202('0x54')][_0xc202('0x64')]){_0x3f68ba[_0xc202('0x65')]=[{'all':!![]}];}return db[_0xc202('0x82')][_0xc202('0x66')](_0x3f68ba);})[_0xc202('0x1d')](function(_0x1b8507){_0xf2094a['rows']=_0x1b8507;return _0xf2094a;});}})[_0xc202('0x1d')](respondWithFilteredResult(_0xf3eda3,_0x3f68ba))[_0xc202('0x6b')](handleError(_0xf3eda3,null));};exports[_0xc202('0x83')]=function(_0x31bcfa,_0x3da1f6){return db[_0xc202('0x4f')]['find']({'where':{'id':_0x31bcfa[_0xc202('0x76')]['id']}})['then'](handleEntityNotFound(_0x3da1f6,null))['then'](function(_0x1cacd7){if(_0x1cacd7){return _0x1cacd7['removeAnswers'](_0x31bcfa[_0xc202('0x54')][_0xc202('0x80')]);}})[_0xc202('0x1d')](respondWithStatusCode(_0x3da1f6,null))[_0xc202('0x6b')](handleError(_0x3da1f6,null));};exports[_0xc202('0x84')]=function(_0x17c92f,_0x16c444){_0x17c92f[_0xc202('0x70')][_0xc202('0x85')]=_0x17c92f[_0xc202('0x86')][_0xc202('0x87')];return db['ChatWebsite'][_0xc202('0x6a')]({'where':{'id':_0x17c92f[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x16c444,null))[_0xc202('0x1d')](saveUpdates(_0x17c92f['body'],null))[_0xc202('0x1d')](respondWithResult(_0x16c444,null))[_0xc202('0x6b')](handleError(_0x16c444,null));};exports['addAvatar']=function(_0x3f09aa,_0x31bed9){_0x3f09aa[_0xc202('0x70')]['agentAvatar']=_0x3f09aa[_0xc202('0x86')][_0xc202('0x87')];return db[_0xc202('0x4f')]['find']({'where':{'id':_0x3f09aa[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x31bed9,null))['then'](saveUpdates(_0x3f09aa[_0xc202('0x70')],null))[_0xc202('0x1d')](respondWithResult(_0x31bed9,null))[_0xc202('0x6b')](handleError(_0x31bed9,null));};exports[_0xc202('0x88')]=function(_0x36def4,_0x22b25c){_0x36def4[_0xc202('0x70')]['customerAvatar']=_0x36def4[_0xc202('0x86')][_0xc202('0x87')];return db[_0xc202('0x4f')]['find']({'where':{'id':_0x36def4[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x22b25c,null))[_0xc202('0x1d')](saveUpdates(_0x36def4[_0xc202('0x70')],null))['then'](respondWithResult(_0x22b25c,null))['catch'](handleError(_0x22b25c,null));};exports['addSystemAvatar']=function(_0xb1d213,_0xa3293c){_0xb1d213[_0xc202('0x70')]['systemAvatar']=_0xb1d213['file']['filename'];return db['ChatWebsite'][_0xc202('0x6a')]({'where':{'id':_0xb1d213[_0xc202('0x76')]['id']}})['then'](handleEntityNotFound(_0xa3293c,null))['then'](saveUpdates(_0xb1d213[_0xc202('0x70')],null))[_0xc202('0x1d')](respondWithResult(_0xa3293c,null))[_0xc202('0x6b')](handleError(_0xa3293c,null));};exports[_0xc202('0x89')]=function(_0x416b2a,_0xa58f72){var _0x1f33dd=path['join'](config[_0xc202('0x8a')],_0xc202('0x8b'));var _0x161d84={'where':{'id':_0x416b2a['params']['id']},'attributes':['id',_0xc202('0x85')],'raw':!![]};var _0x236f7d=![];return require(_0xc202('0x8c'))[_0xc202('0x8d')]()['then'](function(_0xacffae){if(_0xacffae){_0x236f7d=_0xacffae['custom'];}})[_0xc202('0x1d')](function(){return db['ChatWebsite'][_0xc202('0x6a')](_0x161d84);})['then'](handleEntityNotFound(_0xa58f72,null))[_0xc202('0x1d')](function(_0x112b2e){if(_0x112b2e){if(!_[_0xc202('0x8e')](_0x112b2e[_0xc202('0x85')])){if(fs[_0xc202('0x8f')](path['join'](config[_0xc202('0x8a')],_0xc202('0x90'),_0x112b2e[_0xc202('0x85')]))&&_0x236f7d){_0x1f33dd=path['join'](config[_0xc202('0x8a')],_0xc202('0x90'),_0x112b2e[_0xc202('0x85')]);}}return _0xa58f72[_0xc202('0x91')](_0x1f33dd);}})['catch'](handleError(_0xa58f72,null));};exports[_0xc202('0x92')]=function(_0x37557a,_0x1d2f46){var _0x2fe360=path['join'](config[_0xc202('0x8a')],'server/files/images/avatars/default_avatar.png');var _0x2b4fd8={'where':{'id':_0x37557a[_0xc202('0x76')]['id']},'attributes':['id',_0xc202('0x93')],'raw':!![]};return db[_0xc202('0x4f')][_0xc202('0x6a')](_0x2b4fd8)['then'](handleEntityNotFound(_0x1d2f46,null))[_0xc202('0x1d')](function(_0x2892b2){if(_0x2892b2){if(!_['isNil'](_0x2892b2['agentAvatar'])){if(fs['existsSync'](path[_0xc202('0x94')](config[_0xc202('0x8a')],'server/files/images/avatars/',_0x2892b2['agentAvatar']))){_0x2fe360=path[_0xc202('0x94')](config[_0xc202('0x8a')],_0xc202('0x95'),_0x2892b2[_0xc202('0x93')]);}}return _0x1d2f46[_0xc202('0x91')](_0x2fe360);}})['catch'](handleError(_0x1d2f46,null));};exports[_0xc202('0x96')]=function(_0x7fe0e3,_0xc2e3de){var _0xcfb0cc=path[_0xc202('0x94')](config[_0xc202('0x8a')],'server/files/images/avatars/customer_avatar.png');var _0x462e41={'where':{'id':_0x7fe0e3[_0xc202('0x76')]['id']},'attributes':['id','customerAvatar',_0xc202('0x97')],'raw':!![]};return db[_0xc202('0x4f')]['find'](_0x462e41)[_0xc202('0x1d')](handleEntityNotFound(_0xc2e3de,null))[_0xc202('0x1d')](function(_0x55b895){if(_0x55b895){if(!_['isNil'](_0x55b895[_0xc202('0x98')])){if(fs[_0xc202('0x8f')](path[_0xc202('0x94')](config[_0xc202('0x8a')],_0xc202('0x95'),_0x55b895[_0xc202('0x98')]))&&_0x55b895['showCustomerAvatar']){_0xcfb0cc=path[_0xc202('0x94')](config['root'],'server/files/images/avatars/',_0x55b895['customerAvatar']);}}return _0xc2e3de[_0xc202('0x91')](_0xcfb0cc);}})['catch'](handleError(_0xc2e3de,null));};exports[_0xc202('0x99')]=function(_0x4b3d78,_0x335884){var _0x1271fd=path[_0xc202('0x94')](config[_0xc202('0x8a')],_0xc202('0x9a'));var _0xff16e2={'where':{'id':_0x4b3d78[_0xc202('0x76')]['id']},'attributes':['id',_0xc202('0x9b')],'raw':!![]};return db[_0xc202('0x4f')]['find'](_0xff16e2)[_0xc202('0x1d')](handleEntityNotFound(_0x335884,null))[_0xc202('0x1d')](function(_0x108dc5){if(_0x108dc5){if(!_['isNil'](_0x108dc5['systemAvatar'])){if(fs['existsSync'](path[_0xc202('0x94')](config['root'],_0xc202('0x95'),_0x108dc5[_0xc202('0x9b')]))){_0x1271fd=path[_0xc202('0x94')](config[_0xc202('0x8a')],_0xc202('0x95'),_0x108dc5[_0xc202('0x9b')]);}}return _0x335884[_0xc202('0x91')](_0x1271fd);}})[_0xc202('0x6b')](handleError(_0x335884,null));};function checkWebsiteInterval(_0x30b4de){var _0x379423=_0x30b4de[_0xc202('0x9c')];if(!_0x379423){return Promise[_0xc202('0x9d')](_0x30b4de);}var _0x3efa0b=_0x30b4de[_0xc202('0x9e')]||undefined;return _0x379423[_0xc202('0x9f')](_0x3efa0b)[_0xc202('0x1d')](function(_0x26351f){if(!_0x26351f){throw new APIOutOfIntervalError();}return _0x30b4de;});}exports[_0xc202('0xa0')]=function(_0x392125,_0x28b1cb){var _0x3a2e64={'body':_0x392125[_0xc202('0x70')],'channel':_0xc202('0xa1')};var _0x4cdcc8=[];var _0x2a12e1=[];var _0x3c1042={};var _0x180c0b=![];if(_0x392125[_0xc202('0x70')]['id']){delete _0x392125[_0xc202('0x70')]['id'];}if(_[_0xc202('0x8e')](_0x392125[_0xc202('0x70')][_0xc202('0xa2')])){throw new APIBadRequestError(_0xc202('0xa3'));}if(_[_0xc202('0x8e')](_0x392125[_0xc202('0x70')][_0xc202('0xa4')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xc202('0xa5')](_0x392125['body'][_0xc202('0x70')])){throw new APIBadRequestError(_0xc202('0xa6'));}var _0x52b876=_0x392125[_0xc202('0x70')]['customerIp']&&_0x392125['body'][_0xc202('0x41')];return db[_0xc202('0xa7')][_0xc202('0x78')]()[_0xc202('0x1d')](function(_0x1b5980){if(!_0x1b5980){throw new Error('No\x20available\x20attributes');}_0x4cdcc8=Object[_0xc202('0x55')](_0x1b5980)[_0xc202('0x5f')](function(_0x4332e1){return![_0xc202('0xa8'),'updatedAt']['includes'](_0x4332e1);});_0x2a12e1=Object[_0xc202('0x55')](_0x1b5980)['filter'](function(_0x4122fe){return![_0xc202('0xa8'),_0xc202('0xa9'),_0xc202('0xaa'),'ListId'][_0xc202('0xab')](_0x4122fe);});if(!_['includes'](_0x2a12e1,_0x392125[_0xc202('0x70')][_0xc202('0xa4')])){throw new APIBadRequestError(_0xc202('0xac')+_0x2a12e1[_0xc202('0x94')](',\x20'));}_0x3c1042[_0x392125[_0xc202('0x70')][_0xc202('0xa4')]]=_0x392125[_0xc202('0x70')][_0xc202('0xa2')];})[_0xc202('0x1d')](function(){return db['ChatWebsite'][_0xc202('0x6a')]({'where':{'id':_0x392125[_0xc202('0x76')]['id']},'include':[{'model':db['CmList'],'as':_0xc202('0xad'),'include':[{'model':db[_0xc202('0xa7')],'as':_0xc202('0xae'),'where':_0x3c1042,'limit':0x1,'order':[[_0xc202('0xa9'),_0xc202('0xaf')]]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db['Interval'],'as':_0xc202('0x9c'),'include':[{'model':db[_0xc202('0x9c')],'as':_0xc202('0xb0'),'attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0x552308){if(!_0x552308){throw new APINotFoundError(util[_0xc202('0x43')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x392125[_0xc202('0x76')]['id']));}if(_0x52b876){return checkWebsiteInterval(_0x552308);}return _0x552308;})[_0xc202('0x1d')](function(_0x30c7ab){_0x3a2e64[_0xc202('0xb1')]=_0x30c7ab;_0x3a2e64['applications']=_[_0xc202('0xb2')](_0x30c7ab[_0xc202('0xb3')],[_0xc202('0xb4')],['asc']);if(_0x3a2e64[_0xc202('0xb1')][_0xc202('0xb3')]){delete _0x3a2e64[_0xc202('0xb1')]['Applications'];}_0x3a2e64[_0xc202('0xb5')]=_0x30c7ab[_0xc202('0xad')]||{'id':_0x30c7ab['ListId']};if(_0x3a2e64[_0xc202('0xb5')]&&_0x3a2e64['list'][_0xc202('0xae')]['length']){return _0x3a2e64[_0xc202('0xb5')][_0xc202('0xae')][0x0];}var _0x5bcab0=_[_0xc202('0x15')](_0x392125[_0xc202('0x70')],{'firstName':_0x392125[_0xc202('0x70')]['from'],'ListId':_0x30c7ab['ListId']});_0x5bcab0[_0x392125[_0xc202('0x70')][_0xc202('0xa4')]]=_0x392125[_0xc202('0x70')][_0xc202('0xa2')];return db['CmContact'][_0xc202('0x6c')](_0x5bcab0,{'fields':_0x4cdcc8,'raw':!![]});})['then'](function(_0x3fda23){_0x3a2e64[_0xc202('0xb6')]=_0x3fda23;var _0x35fdb5=createInteractionObject(_0x392125[_0xc202('0x76')]['id'],_0x392125['body'],_0x392125[_0xc202('0xb7')],_0x3fda23);var _0x3da9d6={'ChatWebsiteId':_0x392125['params']['id']};if(_0x392125[_0xc202('0x70')][_0xc202('0xb8')]){_0x3da9d6[_0xc202('0xb8')]=_0x392125[_0xc202('0x70')][_0xc202('0xb8')];_0x3da9d6[_0xc202('0xb9')]=![];return db[_0xc202('0xba')][_0xc202('0x6a')]({'where':_0x3da9d6})[_0xc202('0x1d')](function(_0x335ce5){var _0x1bdcd0=_0x392125[_0xc202('0x70')]['customerIp']&&_0x392125[_0xc202('0x70')]['referer'];if(_0x335ce5){_0x180c0b=!![];return _0x335ce5;}else if(!_0x1bdcd0&&_0x335ce5&&_0x335ce5['closed']){throw new APIConflictError(_0xc202('0xbb'));}_0x35fdb5[_0xc202('0xb8')]=_0x392125[_0xc202('0x70')][_0xc202('0xb8')];_0x35fdb5[_0xc202('0xbc')]=_0x392125['body']['externalUrl'];return db[_0xc202('0xba')][_0xc202('0x6c')](_0x35fdb5);});}_0x3da9d6[_0xc202('0xbd')]=_0x3fda23['id'];if(_0x392125[_0xc202('0x70')][_0xc202('0xbe')]&&_0x392125[_0xc202('0x70')]['interaction']['id']){_0x3da9d6['id']=_0x392125['body'][_0xc202('0xbe')]['id'];return db[_0xc202('0xba')][_0xc202('0x6a')]({'where':_0x3da9d6})['then'](function(_0x5a6d7e){var _0xe68860=_0x392125[_0xc202('0x70')]['customerIp']&&_0x392125[_0xc202('0x70')][_0xc202('0x41')];if(!_0xe68860&&_0x5a6d7e&&_0x5a6d7e['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x5a6d7e){_0x180c0b=!![];return _0x5a6d7e;}else{return db[_0xc202('0xba')]['create'](_0x35fdb5);}});}return db['ChatInteraction'][_0xc202('0x6c')](_0x35fdb5);})[_0xc202('0x1d')](function(_0xfdf0fd){if(!_0x180c0b){return _0xfdf0fd;}var _0x1367b7={'from':(_0x3a2e64['contact']['firstName']||'')+'\x20'+(_0x3a2e64[_0xc202('0xb6')][_0xc202('0x3f')]||'')};if(_0x392125[_0xc202('0x70')][_0xc202('0xb8')]&&_0x392125[_0xc202('0x70')]['messageId']&&_0x392125[_0xc202('0x70')][_0xc202('0xb8')]!=_0x392125[_0xc202('0x70')]['messageId']){_0x1367b7[_0xc202('0xb8')]=_0x392125['body'][_0xc202('0xbf')];}return _0xfdf0fd[_0xc202('0x2f')](_0x1367b7);})['then'](function(_0x32184b){_0x3a2e64['interaction']=_0x32184b[_0xc202('0x31')]({'plain':!![]});_0x3a2e64[_0xc202('0xbe')][_0xc202('0xc0')]=!_0x180c0b;if(_0x3a2e64[_0xc202('0xbe')]['created']){if(_0x3a2e64['account'][_0xc202('0xc1')]){_0x3a2e64['applications'][_0xc202('0xc2')]({'id':0x0,'priority':_0x3a2e64[_0xc202('0xc3')][_0xc202('0x69')]+0x1,'app':_0xc202('0xc4'),'appdata':_0xc202('0xc5'),'interval':_0xc202('0xc6')});}}return db[_0xc202('0xc7')][_0xc202('0x6c')]({'body':_0x392125[_0xc202('0x70')][_0xc202('0x70')],'ChatWebsiteId':_0x392125[_0xc202('0x76')]['id'],'ChatInteractionId':_0x32184b['id'],'direction':'in','ContactId':_0x3a2e64['contact']['id'],'AttachmentId':_0x392125[_0xc202('0x70')][_0xc202('0xc8')]});})[_0xc202('0x1d')](function(_0x59043d){_0x3a2e64[_0xc202('0x26')]=_0x59043d;if(!_0x3a2e64['interaction']['UserId']){return;}return db[_0xc202('0xc9')][_0xc202('0x6a')]({'attributes':['id',_0xc202('0x34')],'where':{'id':_0x3a2e64[_0xc202('0xbe')][_0xc202('0xca')]}});})[_0xc202('0x1d')](function(_0x4963da){if(_0x4963da){_0x3a2e64[_0xc202('0xc3')][_0xc202('0xcb')]({'id':0x0,'priority':0x0,'app':_0xc202('0xcc'),'appdata':_0x4963da[_0xc202('0x34')]+','+(_0x3a2e64[_0xc202('0xb1')][_0xc202('0xcd')]||0xa),'interval':_0xc202('0xc6')});_0x3a2e64[_0xc202('0xce')]=!![];}if(!_0x3a2e64['interaction'][_0xc202('0xcf')]){return;}return db[_0xc202('0xd0')][_0xc202('0x6a')]({'attributes':['id',_0xc202('0x34')],'where':{'id':_0x3a2e64[_0xc202('0xbe')][_0xc202('0xcf')]}});})[_0xc202('0x1d')](function(_0x569881){if(_0x569881){_0x3a2e64[_0xc202('0xc3')][_0xc202('0xcb')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x569881[_0xc202('0x34')]+','+(_0x3a2e64[_0xc202('0xb1')][_0xc202('0xd1')]||0x12c),'interval':_0xc202('0xc6')});}return respondWithRpcPromise(_0xc202('0xd2'),_0xc202('0xd3'),_0x3a2e64);})[_0xc202('0x1d')](function(_0x39679b){respondWithRpcPromise(_0xc202('0xd4'),_0xc202('0xd4'),{'event':'notify','message':_0x39679b},client9002);return _0x39679b;})[_0xc202('0x1d')](respondWithResult(_0x28b1cb,null))[_0xc202('0x6b')](APIHandleError(_0x28b1cb));};exports[_0xc202('0xd5')]=function(_0x45eab9,_0x3d5ea7){var _0x20f958,_0x4efa8e,_0x553dab;var _0x1ca42d=[];var _0xc5679f={};var _0x2b6b6b=_0x45eab9[_0xc202('0xd6')]||[];var _0x3cb323=[];var _0x56553b;return db[_0xc202('0xa7')][_0xc202('0x78')]()[_0xc202('0x1d')](function(_0x22c560){if(!_0x22c560){throw new db[(_0xc202('0xd7'))][(_0xc202('0xd8'))](_0xc202('0xd9'));}_0x1ca42d=_[_0xc202('0xda')](_['keys'](_0x22c560),[_0xc202('0xa8'),_0xc202('0xa9'),_0xc202('0xaa'),_0xc202('0xdb')]);if(_0x45eab9[_0xc202('0x70')]['id']){delete _0x45eab9[_0xc202('0x70')]['id'];}if(_[_0xc202('0x8e')](_0x45eab9[_0xc202('0x70')][_0xc202('0xa2')])){throw _0x3d5ea7[_0xc202('0x28')](0x1f4)[_0xc202('0x35')](new db[(_0xc202('0xd7'))][(_0xc202('0xd8'))](_0xc202('0xdc')));}if(_[_0xc202('0x8e')](_0x45eab9[_0xc202('0x70')][_0xc202('0x70')])||_0x45eab9[_0xc202('0x70')][_0xc202('0x70')]===''){throw _0x3d5ea7['status'](0x1f4)[_0xc202('0x35')](new db[(_0xc202('0xd7'))][(_0xc202('0xd8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc202('0x8e')](_0x45eab9['body'][_0xc202('0xdd')])){throw _0x3d5ea7['status'](0x1f4)[_0xc202('0x35')](new db[(_0xc202('0xd7'))][(_0xc202('0xd8'))](_0xc202('0xde')+_0x1ca42d));}if(!_[_0xc202('0xab')](_0x1ca42d,_0x45eab9['body']['mapKeyOffline'])){throw _0x3d5ea7['status'](0x1f4)[_0xc202('0x35')](new db['Sequelize'][(_0xc202('0xd8'))](_0xc202('0xdf')+_0x1ca42d));}_0xc5679f[_0x45eab9['body']['mapKeyOffline']]=_0x45eab9[_0xc202('0x70')][_0xc202('0xa2')];})['then'](function(){return db['ChatWebsite'][_0xc202('0x6a')]({'where':{'id':_0x45eab9[_0xc202('0x76')]['id']},'include':[{'model':db[_0xc202('0xe0')],'as':_0xc202('0xad')},{'model':db[_0xc202('0xe1')],'as':_0xc202('0xe1')}]});})[_0xc202('0x1d')](handleEntityNotFound(_0x3d5ea7,null))[_0xc202('0x1d')](function(_0x12b519){if(_0x12b519&&_0x12b519['List']){_0x4efa8e=_0x12b519;var _0x34538d=_[_0xc202('0x15')](_0x45eab9[_0xc202('0x70')],{'firstName':_0x45eab9[_0xc202('0x70')][_0xc202('0xa2')],'phone':_0x45eab9[_0xc202('0x70')][_0xc202('0xa2')],'ListId':_0x12b519[_0xc202('0xdb')]});_0x34538d[_0x45eab9[_0xc202('0x70')][_0xc202('0xdd')]]=_0x45eab9['body'][_0xc202('0xa2')];return db[_0xc202('0xa7')][_0xc202('0xe2')]({'where':_0xc5679f,'defaults':_0x34538d});}})[_0xc202('0xe3')](function(_0x58243f){if(_0x58243f){_0x553dab=_0x58243f;var _0x4b94f6=fs['readFileSync'](path[_0xc202('0x94')](config[_0xc202('0x8a')],'server/files/templates/chatOfflineMessage.ejs'),_0xc202('0xe4'));var _0x1fd98b=ejs[_0xc202('0xe5')](_0x4b94f6,{'body':_['toPairs'](_0x45eab9['body'][_0xc202('0x70')]),'bodyTitle':_0x4efa8e['offlineMessageBody']});return db['ChatOfflineMessage'][_0xc202('0x6c')]({'body':_0x1fd98b,'plainBody':htmlToText[_0xc202('0xe6')](_0x1fd98b),'ContactId':_0x58243f['id'],'ChatWebsiteId':_0x4efa8e['id']});}})[_0xc202('0x1d')](function(_0x417f99){_0x56553b=_0x417f99;if(_0x2b6b6b[_0xc202('0x69')]){var _0xd981a9=_0x2b6b6b[_0xc202('0x53')](function(_0x5438cf){return{'name':_0x5438cf[_0xc202('0xe7')],'basename':_0x5438cf[_0xc202('0x87')],'type':_0x5438cf[_0xc202('0xe8')],'ChatOfflineMessageId':_0x417f99['id']};});_0x3cb323=_0xd981a9['map'](_0x213a6d=>{var _0x5c3a6b={'filename':_0x213a6d['name'],'path':path[_0xc202('0x94')](config[_0xc202('0x8a')],_0xc202('0xe9'),_0xc202('0xd6'),_0xc202('0xea'),_0xc202('0xeb'),_0x213a6d['basename'])};return _0x5c3a6b;});if(!_0x4efa8e[_0xc202('0xec')]){return db[_0xc202('0xed')][_0xc202('0xee')](function(_0x54ee3e){return db[_0xc202('0xef')]['bulkCreate'](_0xd981a9,{'transaction':_0x54ee3e});});}}})[_0xc202('0x1d')](function(){if(_0x56553b){_0x20f958=_0x56553b;return db[_0xc202('0xe1')][_0xc202('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0xc202('0xf0')],'as':_0xc202('0xf1'),'raw':!![],'include':[{'model':db[_0xc202('0xf2')],'as':_0xc202('0xf2'),'raw':!![]}]}]});}})[_0xc202('0x1d')](function(_0x2e0f8c){if(_0x2e0f8c&&_0x2e0f8c[_0xc202('0xf1')]&&_0x4efa8e[_0xc202('0xf3')]&&_0x4efa8e['forwardOfflineAddress']){var _0x6f15d=_0x2e0f8c['getSmtpOptions']();return respondWithRpcPromise(_0xc202('0xf4'),_0xc202('0xf5'),{'account':_0x6f15d,'message':{'from':util[_0xc202('0x43')](_0xc202('0xf6'),_0x2e0f8c['name'],_0x2e0f8c[_0xc202('0xf7')]||_0x2e0f8c['Smtp'][_0xc202('0xf8')]),'to':_0x4efa8e[_0xc202('0xf9')],'subject':_0x4efa8e[_0xc202('0xfa')],'html':_0x20f958['body'],'attachments':_0x3cb323}},client9003)[_0xc202('0x1d')](function(){return _0x20f958;})[_0xc202('0x6b')](function(_0x4a1b1a){logger['error'](_0x4a1b1a);});}})[_0xc202('0x1d')](function(){if(_0x4efa8e&&_0x4efa8e[_0xc202('0xec')]&&_0x4efa8e['MailAccountId']){var _0x47963d=[];if(_0x2b6b6b[_0xc202('0x69')]){_0x47963d=_0x2b6b6b[_0xc202('0x53')](function(_0x1f62a0){return{'name':_0x1f62a0[_0xc202('0xe7')],'basename':_0x1f62a0['filename'],'type':_0x1f62a0[_0xc202('0xe8')],'ChatOfflineMessageId':_0x56553b['id']};});}var _0x2f5fd7;if(!_['isNil'](_0x4efa8e['subjectOffline'])){var _0x28e6e3=_[_0xc202('0x53')](_0x45eab9['body'],function(_0x5ae204){return _0x5ae204;});var _0x4e811d=_[_0xc202('0xfb')](_0x28e6e3)[0x0];var _0x1128b9=_['mapValues'](_0x4e811d,function(_0x2d1f45){return _0x2d1f45;});_0x2f5fd7=_0x1128b9[0x1][_0x4efa8e[_0xc202('0xfc')]];}var _0x329572={'from':_0x553dab[_0xc202('0xf7')],'firstName':_0x553dab[_0xc202('0x3e')],'lastName':_0x553dab[_0xc202('0x3f')],'mapKey':_0xc202('0xf7'),'message':{'from':_0x553dab[_0xc202('0xf7')],'to':_0x4efa8e[_0xc202('0xe1')][_0xc202('0xf7')],'cc':'','subject':_[_0xc202('0x8e')](_0x2f5fd7)?_0x4efa8e[_0xc202('0xfa')]:_0x2f5fd7,'messageId':'','sentAt':new Date(),'attach':_0x47963d[_0xc202('0x69')],'attachments':_0x47963d,'originChannel':_0xc202('0xfd'),'ChatWebsiteId':_0x4efa8e['id'],'ChatOfflineMessageId':_0x20f958['id'],'originTo':_0x4efa8e['MailAccount'][_0xc202('0xf7')]},'body':_0x20f958[_0xc202('0x70')]};var _0x5e91e4={'account':{'id':_0x4efa8e[_0xc202('0xfe')]},'body':_0x329572,'log':_0xc202('0xff')};return respondWithRpcPromise('NotifyMailAccount',_0xc202('0x100'),_0x5e91e4,client9001)['then'](function(){return _0x20f958;})[_0xc202('0x6b')](function(_0x349393){logger[_0xc202('0x22')](_0x349393);});}return;})[_0xc202('0x1d')](function(){if(_0x20f958){return _0x20f958;}})[_0xc202('0x1d')](respondWithResult(_0x3d5ea7,null))[_0xc202('0x6b')](function(){for(var _0x12f70f of _0x2b6b6b){var _0x432253=path[_0xc202('0x94')](config[_0xc202('0x8a')],_0xc202('0xe9'),_0xc202('0xd6'),_0xc202('0xea'),_0xc202('0xeb'),_0x12f70f[_0xc202('0x87')]);fs_extra[_0xc202('0x101')](_0x432253)['catch'](function(_0x109dc9){logger[_0xc202('0x22')](_0xc202('0x102'),_0x432253,_0x109dc9);});}});};exports['addInteraction']=function(_0x168281,_0x1c4245){return db[_0xc202('0xba')][_0xc202('0x6a')]({'where':{'id':_0x168281['params']['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x1c4245,null))['then'](function(_0x2033da){if(_0x2033da){return _0x2033da[_0xc202('0x103')](_0x168281[_0xc202('0x70')][_0xc202('0x80')],_[_0xc202('0x104')](_0x168281[_0xc202('0x70')],[_0xc202('0x80'),'id'])||{});}})[_0xc202('0x1d')](respondWithResult(_0x1c4245,null))[_0xc202('0x6b')](handleError(_0x1c4245,null));};exports['getInteractions']=function(_0x495314,_0x413380){var _0x431397={'raw':![],'where':{}};var _0x541fc4={};var _0xf9792={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x495314[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x413380,null))[_0xc202('0x1d')](function(_0x1ba783){if(_0x1ba783){_0x541fc4[_0xc202('0x48')]=_['keys'](db[_0xc202('0xba')][_0xc202('0x50')]);_0x541fc4['query']=_[_0xc202('0x55')](_0x495314[_0xc202('0x54')]);_0x541fc4[_0xc202('0x56')]=_['intersection'](_0x541fc4[_0xc202('0x48')],_0x541fc4['query']);_0x431397[_0xc202('0x59')]=_['intersection'](_0x541fc4[_0xc202('0x48')],qs[_0xc202('0x58')](_0x495314[_0xc202('0x54')][_0xc202('0x58')]));_0x431397[_0xc202('0x59')]=_0x431397[_0xc202('0x59')][_0xc202('0x69')]?_0x431397[_0xc202('0x59')]:_0x541fc4['model'];if(!_0x495314[_0xc202('0x54')][_0xc202('0x5a')](_0xc202('0x7e'))){_0x431397['limit']=qs[_0xc202('0x2b')](_0x495314[_0xc202('0x54')][_0xc202('0x2b')]);_0x431397[_0xc202('0x2c')]=qs[_0xc202('0x2c')](_0x495314[_0xc202('0x54')][_0xc202('0x2c')]);}_0x431397['order']=qs[_0xc202('0x5c')](_0x495314[_0xc202('0x54')][_0xc202('0x5c')]);_0x431397[_0xc202('0x5d')]=qs[_0xc202('0x56')](_[_0xc202('0x5e')](_0x495314[_0xc202('0x54')],_0x541fc4['filters']));_0x431397[_0xc202('0x5d')]['ChatWebsiteId']=_0x1ba783['id'];if(_0x495314[_0xc202('0x54')][_0xc202('0x5f')]){_0x431397[_0xc202('0x5d')]=_[_0xc202('0x61')](_0x431397[_0xc202('0x5d')],{'$or':_[_0xc202('0x53')](_0x431397[_0xc202('0x59')],function(_0x5e5522){var _0x3998ae={};_0x3998ae[_0x5e5522]={'$like':'%'+_0x495314[_0xc202('0x54')]['filter']+'%'};return _0x3998ae;})});}_0x431397=_[_0xc202('0x61')]({},_0x431397,_0x495314[_0xc202('0x62')]);return db[_0xc202('0xba')]['count']({'where':_0x431397[_0xc202('0x5d')]})[_0xc202('0x1d')](function(_0x2e1b42){_0xf9792['count']=_0x2e1b42;if(_0x495314[_0xc202('0x54')][_0xc202('0x64')]){_0x431397[_0xc202('0x65')]=[{'model':db[_0xc202('0xa7')],'as':_0xc202('0x105'),'required':![]},{'model':db[_0xc202('0xc9')],'as':'Owner','attributes':[_0xc202('0x34'),_0xc202('0x106'),_0xc202('0x107')],'required':![]},{'model':db['Tag'],'as':_0xc202('0x108'),'attributes':['id',_0xc202('0x34'),_0xc202('0x109')],'where':_0x495314[_0xc202('0x54')][_0xc202('0x10a')]?{'id':_0x495314[_0xc202('0x54')][_0xc202('0x10a')]}:undefined,'required':_0x495314[_0xc202('0x54')][_0xc202('0x10a')]?!![]:![]}];}return db[_0xc202('0xba')][_0xc202('0x66')](_0x431397);})[_0xc202('0x1d')](function(_0x10cb76){_0xf9792[_0xc202('0x67')]=_0x10cb76;return _0xf9792;});}})['then'](respondWithFilteredResult(_0x413380,_0x431397))[_0xc202('0x6b')](handleError(_0x413380,null));};exports[_0xc202('0x10b')]=function(_0x574c42,_0x1ce067){var _0x5398b2=0x0;var _0x1cad99=0x0;var _0x22fa07=![];var _0x11f203;var _0x5667e6;return db[_0xc202('0x4f')][_0xc202('0x6a')]({'where':{'id':_0x574c42[_0xc202('0x76')]['id']},'include':[{'model':db[_0xc202('0x9c')],'as':_0xc202('0x9c'),'include':[{'model':db[_0xc202('0x9c')],'as':_0xc202('0xb0'),'attributes':['id',_0xc202('0x10c')]}]}]})[_0xc202('0x1d')](handleEntityNotFound(_0x1ce067,null))[_0xc202('0x1d')](function(_0x21bb38){if(_0x21bb38){_0x11f203=_0x21bb38;return _0x21bb38[_0xc202('0x10d')]({'raw':!![]});}})['then'](function(_0x20c408){if(_0x11f203){if(_0x20c408){_0x5667e6=_0x20c408;}}return require(_0xc202('0x8c'))[_0xc202('0x8d')]();})[_0xc202('0x1d')](function(_0x4fa995){if(_0x4fa995){_0x1cad99=_0x4fa995['virtual'];_0x22fa07=_0x4fa995[_0xc202('0x10e')];}})[_0xc202('0x1d')](function(){return db['ChatInteraction'][_0xc202('0x63')]({'where':{'closed':![]}});})[_0xc202('0x1d')](function(_0x5645fe){_0x5398b2=_0x5645fe;if(_0x1cad99&&_0x5645fe>_0x1cad99){return db['License'][_0xc202('0x7d')]({'where':{'id':0x1}})['then'](function(_0x295345){if(_0x295345){_0x295345[_0xc202('0x10f')](_0xc202('0x110'));}});}})[_0xc202('0x1d')](function(){var _0x395aa7=_0x11f203[_0xc202('0x9c')];var _0x5842d0=_0x11f203[_0xc202('0x9e')]||undefined;return _0x395aa7?_0x395aa7['ifTime'](_0x5842d0):!![];})[_0xc202('0x1d')](function(_0x130542){var _0x43a30e=fs[_0xc202('0x111')](path[_0xc202('0x94')](config[_0xc202('0x8a')],'server/files/chat/iframe.ejs'),_0xc202('0xe4'));var _0x15cebb='3.10.1';var _0x3318f2=![];var _0x3df8a6,_0x271ac3;if(_0x574c42['headers']['referer']){_0x3df8a6=new URL(_0x574c42[_0xc202('0xb7')][_0xc202('0x41')])[_0xc202('0x112')];}else if(_0x574c42[_0xc202('0xb7')][_0xc202('0x112')]){_0x3df8a6=new URL(_0x574c42['headers']['origin'])[_0xc202('0x112')];}else{_0x3df8a6=_0xc202('0x113');}_0x271ac3=typeof _0x11f203[_0xc202('0x114')][_0xc202('0x3d')](',')[_0xc202('0x6a')](function(_0x5d435e){return wildcardUtils['testWebsiteWithWildcard'](_0x5d435e,_0x3df8a6);})!==_0xc202('0x2a');var _0x590be4={'chatVersion':_0x15cebb,'chatWebsiteAddressOrigin':_0x271ac3?_0x3df8a6:_0x11f203[_0xc202('0x114')],'remote':_0x11f203[_0xc202('0x115')],'query':querystring['stringify'](_[_0xc202('0x61')](_0x11f203[_0xc202('0x31')]({'plain':!![]}),{'customerIp':_0x574c42[_0xc202('0xb7')][_0xc202('0x3b')]||_0x574c42['headers'][_0xc202('0x116')]||_0x574c42[_0xc202('0x117')]['remoteAddress']||_0x574c42['ip'],'referer':_0x574c42[_0xc202('0xb7')][_0xc202('0x41')],'openedInteractions':_0x5398b2,'maxInteractions':_0x1cad99,'virtual':_0x22fa07['virtual'],'online':_0x130542,'custom':_0x22fa07,'address':_0x271ac3?_0x3df8a6:null}))[_0xc202('0x118')](/'/g,'\x5c\x27')};_0x1ce067['send'](ejs['render'](Mustache[_0xc202('0xe5')](_0x43a30e,_0x590be4),{'proactiveActions':_0x5667e6,'alignment':_0x11f203['alignment'],'verticalAlignment':_0x11f203['verticalAlignment'],'div_color':_0x11f203[_0xc202('0x109')],'labelText':_0x11f203[_0xc202('0x119')],'text_color':_0x11f203[_0xc202('0x11a')],'text_button_color':_0x11f203[_0xc202('0x11b')],'button_color':_0x11f203[_0xc202('0x11c')],'background_color':_0x11f203[_0xc202('0x11d')],'hideWhenOffline':_0x11f203[_0xc202('0x11e')],'intervalId':_0x11f203[_0xc202('0x11f')],'isDevelopment':_0x3318f2,'chatVersion':_0x15cebb}));})[_0xc202('0x6b')](handleError(_0x1ce067,null));};exports['addApplications']=function(_0x4c5ff1,_0x35c279){var _0x33c584=_0x4c5ff1['params']['id'];var _0x45da3e=_0x4c5ff1[_0xc202('0x70')];var _0x21bca1=0xc8;var _0x13e5ac=null;return db['sequelize'][_0xc202('0xee')]({'isolationLevel':db[_0xc202('0xed')][_0xc202('0x120')][_0xc202('0x121')][_0xc202('0x122')]},function(_0xda11ce){return db[_0xc202('0x4f')][_0xc202('0x7d')]({'where':{'id':_0x33c584},'transaction':_0xda11ce})['then'](function(_0xb1ad01){if(_0xb1ad01){return db[_0xc202('0x123')][_0xc202('0x30')]({'where':{'ChatWebsiteId':_0x33c584},'transaction':_0xda11ce})['then'](function(){var _0xfb699f=_['map'](_0x45da3e,function(_0x43f08c){_0x43f08c[_0xc202('0x7a')]=_0x33c584;return _0x43f08c;});return db[_0xc202('0x123')][_0xc202('0x124')](_0xfb699f,{'transaction':_0xda11ce});});}else{_0x21bca1=0x194;_0x13e5ac=[];}});})[_0xc202('0x1d')](function(){if(_0x21bca1!==0x194){return db[_0xc202('0x123')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x33c584},'order':_0xc202('0xb4')})['then'](function(_0x30581b){_0x13e5ac=_0x30581b;});}})[_0xc202('0x6b')](function(_0x50edd5){_0x21bca1=0x1f4;logger[_0xc202('0x22')](_0x50edd5[_0xc202('0x125')]);if(_0x50edd5[_0xc202('0x34')]){delete _0x50edd5['name'];}_0x13e5ac=_0x50edd5;})[_0xc202('0x126')](function(){if(_0x13e5ac===null){_0x35c279['sendStatus'](_0x21bca1);}else{if(_0x21bca1===0x1f4){_0x35c279[_0xc202('0x28')](_0x21bca1)['send'](_0x13e5ac);}else{_0x35c279[_0xc202('0x28')](_0x21bca1)['json'](_0x13e5ac);}}});};exports[_0xc202('0x127')]=function(_0x458e18,_0x241669){var _0x564f29={};var _0x3df3bf={};var _0x49e94d;var _0x51d4ec;return db[_0xc202('0x4f')][_0xc202('0x7d')]({'where':{'id':_0x458e18[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x241669,null))[_0xc202('0x1d')](function(_0x502ab3){if(_0x502ab3){_0x49e94d=_0x502ab3;_0x3df3bf[_0xc202('0x48')]=_['keys'](db['ChatApplication'][_0xc202('0x50')]);_0x3df3bf[_0xc202('0x54')]=_[_0xc202('0x55')](_0x458e18['query']);_0x3df3bf[_0xc202('0x56')]=_[_0xc202('0x57')](_0x3df3bf['model'],_0x3df3bf[_0xc202('0x54')]);_0x564f29[_0xc202('0x59')]=_[_0xc202('0x57')](_0x3df3bf[_0xc202('0x48')],qs[_0xc202('0x58')](_0x458e18[_0xc202('0x54')][_0xc202('0x58')]));_0x564f29['attributes']=_0x564f29[_0xc202('0x59')][_0xc202('0x69')]?_0x564f29['attributes']:_0x3df3bf[_0xc202('0x48')];_0x564f29[_0xc202('0x5b')]=qs[_0xc202('0x5c')](_0x458e18[_0xc202('0x54')][_0xc202('0x5c')]);_0x564f29['where']=qs[_0xc202('0x56')](_['pick'](_0x458e18['query'],_0x3df3bf[_0xc202('0x56')]));if(_0x458e18[_0xc202('0x54')]['filter']){_0x564f29[_0xc202('0x5d')]=_[_0xc202('0x61')](_0x564f29[_0xc202('0x5d')],{'$or':_[_0xc202('0x53')](_0x564f29[_0xc202('0x59')],function(_0x170c56){var _0x1df94e={};_0x1df94e[_0x170c56]={'$like':'%'+_0x458e18[_0xc202('0x54')][_0xc202('0x5f')]+'%'};return _0x1df94e;})});}_0x564f29=_[_0xc202('0x61')]({},_0x564f29,_0x458e18['options']);return _0x49e94d[_0xc202('0x127')](_0x564f29);}})[_0xc202('0x1d')](function(_0x3e23ca){if(_0x3e23ca){_0x51d4ec=_0x3e23ca[_0xc202('0x69')];if(!_0x458e18[_0xc202('0x54')][_0xc202('0x5a')]('nolimit')){_0x564f29['limit']=qs['limit'](_0x458e18[_0xc202('0x54')]['limit']);_0x564f29['offset']=qs[_0xc202('0x2c')](_0x458e18[_0xc202('0x54')]['offset']);}return _0x49e94d['getApplications'](_0x564f29);}})['then'](function(_0x1a523c){if(_0x1a523c){return _0x1a523c?{'count':_0x51d4ec,'rows':_0x1a523c}:null;}})['then'](respondWithResult(_0x241669,null))[_0xc202('0x6b')](handleError(_0x241669,null));};exports[_0xc202('0x128')]=function(_0x21aff8,_0x347fbb){return db[_0xc202('0x129')][_0xc202('0x6a')]({'where':{'id':_0x21aff8[_0xc202('0x76')]['id']}})['then'](handleEntityNotFound(_0x347fbb,null))[_0xc202('0x1d')](function(_0x5d23f7){if(_0x5d23f7){return _0x5d23f7[_0xc202('0x128')](_0x21aff8[_0xc202('0x70')][_0xc202('0x80')],_[_0xc202('0x104')](_0x21aff8[_0xc202('0x70')],[_0xc202('0x80'),'id'])||{});}})['then'](respondWithResult(_0x347fbb,null))[_0xc202('0x6b')](handleError(_0x347fbb,null));};exports[_0xc202('0x10d')]=function(_0x1cdf57,_0x1f3e6a){var _0xd9dd75={};var _0x17130d={};var _0x350b15;var _0x3d9c89;return db['ChatWebsite'][_0xc202('0x7d')]({'where':{'id':_0x1cdf57['params']['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x1f3e6a,null))['then'](function(_0x252772){if(_0x252772){_0x350b15=_0x252772;_0x17130d[_0xc202('0x48')]=_[_0xc202('0x55')](db[_0xc202('0x12a')][_0xc202('0x50')]);_0x17130d['query']=_[_0xc202('0x55')](_0x1cdf57[_0xc202('0x54')]);_0x17130d[_0xc202('0x56')]=_[_0xc202('0x57')](_0x17130d[_0xc202('0x48')],_0x17130d[_0xc202('0x54')]);_0xd9dd75[_0xc202('0x59')]=_['intersection'](_0x17130d['model'],qs['fields'](_0x1cdf57['query'][_0xc202('0x58')]));_0xd9dd75[_0xc202('0x59')]=_0xd9dd75[_0xc202('0x59')][_0xc202('0x69')]?_0xd9dd75[_0xc202('0x59')]:_0x17130d[_0xc202('0x48')];_0xd9dd75['order']=qs[_0xc202('0x5c')](_0x1cdf57[_0xc202('0x54')][_0xc202('0x5c')]);_0xd9dd75[_0xc202('0x5d')]=qs['filters'](_[_0xc202('0x5e')](_0x1cdf57[_0xc202('0x54')],_0x17130d['filters']));if(_0x1cdf57[_0xc202('0x54')]['filter']){_0xd9dd75[_0xc202('0x5d')]=_['merge'](_0xd9dd75['where'],{'$or':_[_0xc202('0x53')](_0xd9dd75['attributes'],function(_0x5b0e5b){var _0x26988d={};_0x26988d[_0x5b0e5b]={'$like':'%'+_0x1cdf57[_0xc202('0x54')][_0xc202('0x5f')]+'%'};return _0x26988d;})});}_0xd9dd75=_[_0xc202('0x61')]({},_0xd9dd75,_0x1cdf57[_0xc202('0x62')]);return _0x350b15['getProactiveActions'](_0xd9dd75);}})['then'](function(_0x31dc3c){if(_0x31dc3c){_0x3d9c89=_0x31dc3c[_0xc202('0x69')];if(!_0x1cdf57['query'][_0xc202('0x5a')]('nolimit')){_0xd9dd75[_0xc202('0x2b')]=qs['limit'](_0x1cdf57[_0xc202('0x54')][_0xc202('0x2b')]);_0xd9dd75['offset']=qs['offset'](_0x1cdf57[_0xc202('0x54')][_0xc202('0x2c')]);}return _0x350b15[_0xc202('0x10d')](_0xd9dd75);}})[_0xc202('0x1d')](function(_0x42b7b6){if(_0x42b7b6){return _0x42b7b6?{'count':_0x3d9c89,'rows':_0x42b7b6}:null;}})[_0xc202('0x1d')](respondWithResult(_0x1f3e6a,null))[_0xc202('0x6b')](handleError(_0x1f3e6a,null));};exports['getFields']=function(_0x3fd086,_0x422baf){var _0x4a7c78=_0x3fd086[_0xc202('0x54')][_0xc202('0x12b')]===_0xc202('0x12c')?'offlineForm':_0xc202('0x12d');return db[_0xc202('0x4f')][_0xc202('0x6a')]({'attributes':['id',_0x4a7c78],'where':{'id':_0x3fd086[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x422baf,null))['then'](function(_0x254d69){if(_0x254d69){var _0x599219=_0x254d69[_0x4a7c78];var _0x3b39a6=_0x599219&&_0x599219[_0xc202('0x12e')]?_0x599219[_0xc202('0x12e')]:[];_0x422baf['send']({'fromKey':_['isNil'](_0x599219[_0xc202('0x12f')])?undefined:_0x599219[_0xc202('0x12f')],'count':_0x3b39a6[_0xc202('0x69')],'rows':_0x3b39a6});}})['catch'](handleError(_0x422baf,null));};exports['getOfflineMessages']=function(_0x1d1b81,_0x5aa4b9){var _0x910f81={'raw':![],'where':{}};var _0x5e1225={};var _0x469bfe={'count':0x0,'rows':[]};return db[_0xc202('0x4f')][_0xc202('0x7d')]({'where':{'id':_0x1d1b81[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x5aa4b9,null))['then'](function(_0x562960){if(_0x562960){_0x5e1225[_0xc202('0x48')]=_['keys'](db[_0xc202('0x130')]['rawAttributes']);_0x5e1225['query']=_[_0xc202('0x55')](_0x1d1b81[_0xc202('0x54')]);_0x5e1225[_0xc202('0x56')]=_[_0xc202('0x57')](_0x5e1225['model'],_0x5e1225[_0xc202('0x54')]);_0x910f81[_0xc202('0x59')]=_[_0xc202('0x57')](_0x5e1225[_0xc202('0x48')],qs[_0xc202('0x58')](_0x1d1b81['query']['fields']));_0x910f81[_0xc202('0x59')]=_0x910f81[_0xc202('0x59')][_0xc202('0x69')]?_0x910f81[_0xc202('0x59')]:_0x5e1225[_0xc202('0x48')];if(!_0x1d1b81['query']['hasOwnProperty']('nolimit')){_0x910f81['limit']=qs[_0xc202('0x2b')](_0x1d1b81[_0xc202('0x54')][_0xc202('0x2b')]);_0x910f81[_0xc202('0x2c')]=qs['offset'](_0x1d1b81[_0xc202('0x54')][_0xc202('0x2c')]);}_0x910f81[_0xc202('0x5b')]=qs[_0xc202('0x5c')](_0x1d1b81['query'][_0xc202('0x5c')]);_0x910f81[_0xc202('0x5d')]=qs[_0xc202('0x56')](_[_0xc202('0x5e')](_0x1d1b81['query'],_0x5e1225['filters']));_0x910f81[_0xc202('0x5d')]['ChatWebsiteId']=_0x562960['id'];if(_0x1d1b81[_0xc202('0x54')][_0xc202('0x5f')]){_0x910f81[_0xc202('0x5d')]=_[_0xc202('0x61')](_0x910f81['where'],{'$or':_[_0xc202('0x53')](_0x910f81[_0xc202('0x59')],function(_0x29a9fc){var _0x28719a={};_0x28719a[_0x29a9fc]={'$like':'%'+_0x1d1b81[_0xc202('0x54')]['filter']+'%'};return _0x28719a;})});}_0x910f81=_[_0xc202('0x61')]({},_0x910f81,_0x1d1b81[_0xc202('0x62')]);return db[_0xc202('0x130')][_0xc202('0x63')]({'where':_0x910f81[_0xc202('0x5d')]})[_0xc202('0x1d')](function(_0x3a03e2){_0x469bfe[_0xc202('0x63')]=_0x3a03e2;if(_0x1d1b81[_0xc202('0x54')][_0xc202('0x64')]){_0x910f81[_0xc202('0x65')]=[{'all':!![]}];}else{_0x910f81[_0xc202('0x65')]=[{'model':db[_0xc202('0xa7')],'as':_0xc202('0x105'),'required':![]},{'model':db['Attachment'],'as':_0xc202('0x131'),'required':![]}];}return db['ChatOfflineMessage'][_0xc202('0x66')](_0x910f81);})[_0xc202('0x1d')](function(_0x11e865){_0x469bfe[_0xc202('0x67')]=_0x11e865;return _0x469bfe;});}})[_0xc202('0x1d')](respondWithFilteredResult(_0x5aa4b9,_0x910f81))[_0xc202('0x6b')](handleError(_0x5aa4b9,null));};exports[_0xc202('0x132')]=function(_0x54152a,_0x54f951){return db[_0xc202('0x4f')]['find']({'where':{'id':_0x54152a[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x54f951,null))['then'](function(_0x216405){if(_0x216405){return _0x216405[_0xc202('0x132')](_0x54152a[_0xc202('0x70')][_0xc202('0x80')],_['omit'](_0x54152a[_0xc202('0x70')],[_0xc202('0x80'),'id'])||{})['spread'](function(_0x55aea6){for(var _0x4ea2e1=0x0;_0x4ea2e1<_0x54152a[_0xc202('0x70')]['ids'][_0xc202('0x69')];_0x4ea2e1+=0x1){socket['emit'](_0xc202('0x133'),{'UserId':Number(_0x54152a[_0xc202('0x70')][_0xc202('0x80')][_0x4ea2e1]),'ChatWebsiteId':Number(_0x54152a[_0xc202('0x76')]['id'])});}return _0x55aea6;});}})['then'](respondWithResult(_0x54f951,null))['catch'](handleError(_0x54f951,null));};exports[_0xc202('0x134')]=function(_0x48c265,_0x2f0bfb){return db[_0xc202('0x4f')][_0xc202('0x6a')]({'where':{'id':_0x48c265[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x2f0bfb,null))['then'](function(_0xac55a1){if(_0xac55a1){return _0xac55a1[_0xc202('0x134')](_0x48c265[_0xc202('0x54')][_0xc202('0x80')])[_0xc202('0x1d')](function(){if(_[_0xc202('0x135')](_0x48c265[_0xc202('0x54')]['ids'])){for(var _0x511242=0x0;_0x511242<_0x48c265['query'][_0xc202('0x80')]['length'];_0x511242+=0x1){socket['emit'](_0xc202('0x136'),{'UserId':Number(_0x48c265[_0xc202('0x54')]['ids'][_0x511242]),'ChatWebsiteId':Number(_0x48c265[_0xc202('0x76')]['id'])});}}else{socket[_0xc202('0x137')](_0xc202('0x136'),{'UserId':Number(_0x48c265[_0xc202('0x54')]['ids']),'ChatWebsiteId':Number(_0x48c265[_0xc202('0x76')]['id'])});}});}})[_0xc202('0x1d')](respondWithStatusCode(_0x2f0bfb,null))[_0xc202('0x6b')](handleError(_0x2f0bfb,null));};exports[_0xc202('0x138')]=function(_0x764ea3,_0x43331c){var _0x43bb37={};var _0x41076d={};var _0x136a25;var _0x5dcf4b;return db[_0xc202('0x4f')]['findOne']({'where':{'id':_0x764ea3[_0xc202('0x76')]['id']}})[_0xc202('0x1d')](handleEntityNotFound(_0x43331c,null))[_0xc202('0x1d')](function(_0x525262){if(_0x525262){_0x136a25=_0x525262;_0x41076d['model']=_[_0xc202('0x55')](db[_0xc202('0xc9')]['rawAttributes']);_0x41076d[_0xc202('0x54')]=_[_0xc202('0x55')](_0x764ea3[_0xc202('0x54')]);_0x41076d['filters']=_[_0xc202('0x57')](_0x41076d[_0xc202('0x48')],_0x41076d[_0xc202('0x54')]);_0x43bb37[_0xc202('0x59')]=_[_0xc202('0x57')](_0x41076d[_0xc202('0x48')],qs['fields'](_0x764ea3[_0xc202('0x54')]['fields']));_0x43bb37[_0xc202('0x59')]=_0x43bb37[_0xc202('0x59')]['length']?_0x43bb37[_0xc202('0x59')]:_0x41076d[_0xc202('0x48')];_0x43bb37[_0xc202('0x5b')]=qs[_0xc202('0x5c')](_0x764ea3[_0xc202('0x54')][_0xc202('0x5c')]);_0x43bb37[_0xc202('0x5d')]=qs['filters'](_[_0xc202('0x5e')](_0x764ea3[_0xc202('0x54')],_0x41076d[_0xc202('0x56')]));if(_0x764ea3[_0xc202('0x54')][_0xc202('0x5f')]){_0x43bb37[_0xc202('0x5d')]=_['merge'](_0x43bb37[_0xc202('0x5d')],{'$or':_['map'](_0x43bb37[_0xc202('0x59')],function(_0x542a36){var _0x17de40={};_0x17de40[_0x542a36]={'$like':'%'+_0x764ea3[_0xc202('0x54')]['filter']+'%'};return _0x17de40;})});}_0x43bb37=_[_0xc202('0x61')]({},_0x43bb37,_0x764ea3[_0xc202('0x62')]);return _0x136a25['getAgents'](_0x43bb37);}})['then'](function(_0x4006ae){if(_0x4006ae){_0x5dcf4b=_0x4006ae[_0xc202('0x69')];if(!_0x764ea3[_0xc202('0x54')][_0xc202('0x5a')](_0xc202('0x7e'))){_0x43bb37[_0xc202('0x2b')]=qs[_0xc202('0x2b')](_0x764ea3[_0xc202('0x54')][_0xc202('0x2b')]);_0x43bb37[_0xc202('0x2c')]=qs[_0xc202('0x2c')](_0x764ea3[_0xc202('0x54')][_0xc202('0x2c')]);}return _0x136a25['getAgents'](_0x43bb37);}})[_0xc202('0x1d')](function(_0x5ebfd1){if(_0x5ebfd1){return _0x5ebfd1?{'count':_0x5dcf4b,'rows':_0x5ebfd1}:null;}})[_0xc202('0x1d')](respondWithResult(_0x43331c,null))[_0xc202('0x6b')](handleError(_0x43331c,null));}; \ No newline at end of file +var _0x9bde=['query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','ChatWebsite','include','findAll','rows','show','params','keys','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','hasOwnProperty','order','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','Body\x20is\x20mandatory','updatedAt','includes','createdAt','CompanyId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','contact','messageId','update','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','Start','startRouting','EventManager','offline','ValidationError','no\x20available\x20attributes','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','subjectOffline','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','omit','includeAll','internal','Tags','tag','getSnippet','interval','getProactiveActions','virtual','increment','server/files/chat/iframe.ejs','utf8','headers','origin','http://localhost:9000','remote','connection','replace','alignment','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','bulkCreate','findAndCountAll','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','fromKey','Contact','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','url','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','then','get','ChatWebsites','UserProfileResource','destroy','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','device','model','vendor','format','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bde,0xe1));var _0xe9bd=function(_0x275cbe,_0x5545b5){_0x275cbe=_0x275cbe-0x0;var _0x49144f=_0x9bde[_0x275cbe];return _0x49144f;};'use strict';var Mustache=require('mustache');var util=require(_0xe9bd('0x0'));var path=require('path');var ejs=require(_0xe9bd('0x1'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9bd('0x2'));var querystring=require(_0xe9bd('0x3'));var htmlToText=require(_0xe9bd('0x4'));var Redis=require(_0xe9bd('0x5'));var jayson=require(_0xe9bd('0x6'));var qs=require(_0xe9bd('0x7'));var logger=require(_0xe9bd('0x8'))('api');var config=require(_0xe9bd('0x9'));var APIBadRequestError=require(_0xe9bd('0xa'))[_0xe9bd('0xb')];var APINotFoundError=require(_0xe9bd('0xa'))[_0xe9bd('0xc')];var APIOutOfIntervalError=require(_0xe9bd('0xa'))[_0xe9bd('0xd')];var APIHandleError=require(_0xe9bd('0xa'))[_0xe9bd('0xe')];var APIConflictError=require(_0xe9bd('0xa'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xe9bd('0xf'))[_0xe9bd('0x10')];var db=require(_0xe9bd('0x11'))['db'];config['redis']=_[_0xe9bd('0x12')](config[_0xe9bd('0x13')],{'host':_0xe9bd('0x14'),'port':0x18eb});var socket=require(_0xe9bd('0x15'))(new Redis(config['redis']));require(_0xe9bd('0x16'))['register'](socket);var client=jayson[_0xe9bd('0x17')][_0xe9bd('0x18')]({'port':0x232c});var client9002=jayson[_0xe9bd('0x17')]['http']({'port':0x232a});var client9003=jayson['client'][_0xe9bd('0x18')]({'port':0x232b});var client9001=jayson[_0xe9bd('0x17')][_0xe9bd('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x46a59b,_0x3360bd,_0x389e7b,_0x45a9f2){return new Promise(function(_0x573350,_0x1d11a0){var _0x464a1b=_0x45a9f2||client;return _0x464a1b[_0xe9bd('0x19')](_0x46a59b,_0x389e7b)['then'](function(_0x36f03d){logger[_0xe9bd('0x1a')](_0xe9bd('0x1b'),_0x3360bd,_0xe9bd('0x1c'));logger['debug'](_0xe9bd('0x1d'),_0x3360bd,'request\x20sent',JSON[_0xe9bd('0x1e')](_0x36f03d));if(_0x36f03d['error']){if(_0x36f03d[_0xe9bd('0x1f')][_0xe9bd('0x20')]===0x1f4){logger[_0xe9bd('0x1f')](_0xe9bd('0x1b'),_0x3360bd,_0x36f03d[_0xe9bd('0x1f')][_0xe9bd('0x21')]);return _0x1d11a0(_0x36f03d[_0xe9bd('0x1f')]['message']);}logger[_0xe9bd('0x1f')](_0xe9bd('0x1b'),_0x3360bd,_0x36f03d['error'][_0xe9bd('0x21')]);return _0x573350(_0x36f03d['error'][_0xe9bd('0x21')]);}else{logger[_0xe9bd('0x1a')](_0xe9bd('0x1b'),_0x3360bd,_0xe9bd('0x1c'));_0x573350(_0x36f03d['result'][_0xe9bd('0x21')]);}})[_0xe9bd('0x22')](function(_0x2c9a57){logger[_0xe9bd('0x1f')](_0xe9bd('0x1b'),_0x3360bd,_0x2c9a57);_0x1d11a0(_0x2c9a57);});});}function respondWithStatusCode(_0xb52d45,_0x399f3c){_0x399f3c=_0x399f3c||0xcc;return function(_0x43ea90){if(_0x43ea90){return _0xb52d45[_0xe9bd('0x23')](_0x399f3c);}return _0xb52d45['status'](_0x399f3c)[_0xe9bd('0x24')]();};}function respondWithResult(_0x38fdfa,_0x5ba1d6){_0x5ba1d6=_0x5ba1d6||0xc8;return function(_0x3b13b7){if(_0x3b13b7){return _0x38fdfa[_0xe9bd('0x25')](_0x5ba1d6)[_0xe9bd('0x26')](_0x3b13b7);}};}function respondWithFilteredResult(_0x429055,_0x141b95){return function(_0x183601){if(_0x183601){var _0x519f48=typeof _0x141b95['offset']===_0xe9bd('0x27')&&typeof _0x141b95['limit']===_0xe9bd('0x27');var _0x1f2c0e=_0x183601[_0xe9bd('0x28')];var _0x36aa80=_0x519f48?0x0:_0x141b95[_0xe9bd('0x29')];var _0x509e36=_0x519f48?_0x183601['count']:_0x141b95[_0xe9bd('0x29')]+_0x141b95[_0xe9bd('0x2a')];var _0x3f96a0;if(_0x509e36>=_0x1f2c0e){_0x509e36=_0x1f2c0e;_0x3f96a0=0xc8;}else{_0x3f96a0=0xce;}_0x429055[_0xe9bd('0x25')](_0x3f96a0);return _0x429055[_0xe9bd('0x2b')](_0xe9bd('0x2c'),_0x36aa80+'-'+_0x509e36+'/'+_0x1f2c0e)[_0xe9bd('0x26')](_0x183601);}return null;};}function saveUpdates(_0x66213a){return function(_0x45703e){if(_0x45703e){return _0x45703e['update'](_0x66213a)[_0xe9bd('0x2d')](function(_0x81a31f){return _0x81a31f;});}return null;};}function removeEntity(_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x2d')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x2e')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x2f');return db[_0xe9bd('0x30')][_0xe9bd('0x31')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x2d')](function(){return _0x5117bc;});})[_0xe9bd('0x2d')](function(){_0x390a43[_0xe9bd('0x25')](0xcc)[_0xe9bd('0x24')]();});}};}function handleEntityNotFound(_0x549dd1){return function(_0x2ad46e){if(!_0x2ad46e){_0x549dd1[_0xe9bd('0x23')](0x194);}return _0x2ad46e;};}function handleError(_0xc50476,_0x8ff624){_0x8ff624=_0x8ff624||0x1f4;return function(_0x264ba0){logger[_0xe9bd('0x1f')](_0x264ba0['stack']);if(_0x264ba0[_0xe9bd('0x32')]){delete _0x264ba0[_0xe9bd('0x32')];}_0xc50476['status'](_0x8ff624)[_0xe9bd('0x33')](_0x264ba0);};}function createInteractionObject(_0x264c87,_0x4c7d47,_0x4b1da0,_0x2785e6){var _0xdf43b9=require('user-agent-parser');var _0x2d1289=new _0xdf43b9();var _0x3ea705=_0x2d1289[_0xe9bd('0x34')](_0x4b1da0['user-agent'])[_0xe9bd('0x35')]();var _0x4d1945=_0x4c7d47[_0xe9bd('0x36')];if(_0x4b1da0[_0xe9bd('0x37')]){_0x4d1945=_0x4b1da0[_0xe9bd('0x37')];}else if(_0x4b1da0[_0xe9bd('0x38')]){_0x4d1945=_['first'](_0x4b1da0[_0xe9bd('0x38')][_0xe9bd('0x39')](','));}return{'ContactId':_0x2785e6['id'],'ChatWebsiteId':_0x264c87,'from':(_0x2785e6[_0xe9bd('0x3a')]||'')+'\x20'+(_0x2785e6[_0xe9bd('0x3b')]||''),'customerIp':_0x4d1945,'customerPort':_0x4b1da0[_0xe9bd('0x3c')]?_0x4b1da0[_0xe9bd('0x3c')]:null,'referer':_0x4c7d47[_0xe9bd('0x3d')],'browserName':_0x3ea705[_0xe9bd('0x3e')][_0xe9bd('0x32')]&&_0x3ea705[_0xe9bd('0x3e')]['version']?util['format'](_0xe9bd('0x3f'),_0x3ea705['browser'][_0xe9bd('0x32')],_0x3ea705[_0xe9bd('0x3e')][_0xe9bd('0x40')]):'unknown','browserVersion':_0x3ea705[_0xe9bd('0x3e')][_0xe9bd('0x40')]||_0xe9bd('0x41'),'osName':util['format'](_0xe9bd('0x3f'),_0x3ea705['os'][_0xe9bd('0x32')],_0x3ea705['os'][_0xe9bd('0x40')]),'osVersion':_0x3ea705['os'][_0xe9bd('0x40')],'deviceModel':_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x43')]&&_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x44')]?util[_0xe9bd('0x45')](_0xe9bd('0x46'),_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x43')],_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x44')],_0x3ea705[_0xe9bd('0x42')]['type']):null,'deviceVendor':_0x3ea705['device'][_0xe9bd('0x44')],'deviceType':_0x3ea705[_0xe9bd('0x42')][_0xe9bd('0x47')],'formData':JSON['stringify'](_0x4c7d47)};}exports['index']=function(_0x43cf7d,_0x3f6f22){var _0x165942={'include':[{'model':db[_0xe9bd('0x48')],'as':_0xe9bd('0x49')}]},_0x15da40={},_0x39fb61={'count':0x0,'rows':[]};var _0x512899=_[_0xe9bd('0x4a')](db['ChatWebsite'][_0xe9bd('0x4b')],function(_0x2277f9){return{'name':_0x2277f9[_0xe9bd('0x4c')],'type':_0x2277f9[_0xe9bd('0x47')][_0xe9bd('0x4d')]};});_0x15da40['model']=_[_0xe9bd('0x4a')](_0x512899,_0xe9bd('0x32'));_0x15da40[_0xe9bd('0x4e')]=_['keys'](_0x43cf7d[_0xe9bd('0x4e')]);_0x15da40[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x15da40['model'],_0x15da40[_0xe9bd('0x4e')]);_0x165942[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x15da40[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x43cf7d['query'][_0xe9bd('0x52')]));_0x165942['attributes']=_0x165942[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x165942[_0xe9bd('0x51')]:_0x15da40[_0xe9bd('0x43')];if(!_0x43cf7d[_0xe9bd('0x4e')]['hasOwnProperty'](_0xe9bd('0x54'))){_0x165942['limit']=qs[_0xe9bd('0x2a')](_0x43cf7d[_0xe9bd('0x4e')]['limit']);_0x165942['offset']=qs[_0xe9bd('0x29')](_0x43cf7d['query'][_0xe9bd('0x29')]);}_0x165942['order']=qs[_0xe9bd('0x55')](_0x43cf7d[_0xe9bd('0x4e')]['sort']);_0x165942[_0xe9bd('0x56')]=qs['filters'](_[_0xe9bd('0x57')](_0x43cf7d[_0xe9bd('0x4e')],_0x15da40[_0xe9bd('0x4f')]),_0x512899);if(_0x43cf7d['query'][_0xe9bd('0x58')]){_0x165942[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x165942[_0xe9bd('0x56')],{'$or':_['map'](_0x512899,function(_0x56362e){if(_0x56362e[_0xe9bd('0x47')]!=='VIRTUAL'){var _0x43c83c={};_0x43c83c[_0x56362e[_0xe9bd('0x32')]]={'$like':'%'+_0x43cf7d[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x43c83c;}})});}_0x165942=_[_0xe9bd('0x59')]({},_0x165942,_0x43cf7d[_0xe9bd('0x5a')]);var _0x373057={'where':_0x165942[_0xe9bd('0x56')]};return db[_0xe9bd('0x5b')][_0xe9bd('0x28')](_0x373057)[_0xe9bd('0x2d')](function(_0x78fab0){_0x39fb61['count']=_0x78fab0;if(_0x43cf7d['query']['includeAll']){_0x165942[_0xe9bd('0x5c')]=[{'all':!![]}];}return db['ChatWebsite'][_0xe9bd('0x5d')](_0x165942);})[_0xe9bd('0x2d')](function(_0x90db01){_0x39fb61[_0xe9bd('0x5e')]=_0x90db01;return _0x39fb61;})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x3f6f22,_0x165942))[_0xe9bd('0x22')](handleError(_0x3f6f22,null));};exports[_0xe9bd('0x5f')]=function(_0x46797c,_0x61b691){var _0x57f24e={'raw':![],'where':{'id':_0x46797c[_0xe9bd('0x60')]['id']},'include':[{'model':db[_0xe9bd('0x48')],'as':_0xe9bd('0x49')}]},_0x242f9f={};_0x242f9f['model']=_[_0xe9bd('0x61')](db[_0xe9bd('0x5b')][_0xe9bd('0x4b')]);_0x242f9f['query']=_[_0xe9bd('0x61')](_0x46797c[_0xe9bd('0x4e')]);_0x242f9f[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x242f9f['model'],_0x242f9f['query']);_0x57f24e[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x242f9f[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x46797c['query']['fields']));_0x57f24e[_0xe9bd('0x51')]=_0x57f24e[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x57f24e[_0xe9bd('0x51')]:_0x242f9f[_0xe9bd('0x43')];if(_0x46797c[_0xe9bd('0x4e')]['includeAll']){_0x57f24e[_0xe9bd('0x5c')]=[{'all':!![]}];}_0x57f24e=_['merge']({},_0x57f24e,_0x46797c[_0xe9bd('0x5a')]);return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x57f24e)[_0xe9bd('0x2d')](handleEntityNotFound(_0x61b691,null))['then'](respondWithResult(_0x61b691,null))[_0xe9bd('0x22')](handleError(_0x61b691,null));};exports[_0xe9bd('0x63')]=function(_0x3b0190,_0x4f35c4){var _0x20731c=null;_0x3b0190[_0xe9bd('0x64')][_0xe9bd('0x65')][_0xe9bd('0x39')](',')[_0xe9bd('0x66')](_0x16b66c=>{if(_0x16b66c[_0xe9bd('0x67')]()!==''&&!wildcardUtils[_0xe9bd('0x68')](_0x16b66c[_0xe9bd('0x67')]())){_0x20731c=new APIBadRequestError('\x22'+_0x16b66c[_0xe9bd('0x67')]()+_0xe9bd('0x69'));}});if(_0x20731c){return handleError(_0x4f35c4,null)(_0x20731c);}return db[_0xe9bd('0x5b')]['create'](_0x3b0190[_0xe9bd('0x64')],{})[_0xe9bd('0x2d')](function(_0x481368){var _0x2c2d78=_0x3b0190[_0xe9bd('0x6a')]['get']({'plain':!![]});if(!_0x2c2d78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c2d78[_0xe9bd('0x6b')]===_0xe9bd('0x6a')){var _0x4ec6ec=_0x481368['get']({'plain':!![]});var _0x4a6422=_0xe9bd('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x4a6422,'userProfileId':_0x2c2d78['userProfileId']},'raw':!![]})['then'](function(_0x1fc88d){if(_0x1fc88d&&_0x1fc88d[_0xe9bd('0x6c')]===0x0){return db[_0xe9bd('0x30')]['create']({'name':_0x4ec6ec[_0xe9bd('0x32')],'resourceId':_0x4ec6ec['id'],'type':_0x1fc88d[_0xe9bd('0x32')],'sectionId':_0x1fc88d['id']},{})[_0xe9bd('0x2d')](function(){return _0x481368;});}else{return _0x481368;}})[_0xe9bd('0x22')](function(_0x5dc598){logger[_0xe9bd('0x1f')](_0xe9bd('0x6d'),_0x5dc598);throw _0x5dc598;});}return _0x481368;})[_0xe9bd('0x2d')](respondWithResult(_0x4f35c4,0xc9))['catch'](handleError(_0x4f35c4,null));};exports['update']=function(_0x3e68fb,_0x2530e1){var _0x1f41fc=null;_0x3e68fb[_0xe9bd('0x64')][_0xe9bd('0x65')][_0xe9bd('0x39')](',')[_0xe9bd('0x66')](_0x22c5ed=>{if(_0x22c5ed['trim']()!==''&&!wildcardUtils[_0xe9bd('0x68')](_0x22c5ed[_0xe9bd('0x67')]())){_0x1f41fc=new APIBadRequestError('\x22'+_0x22c5ed[_0xe9bd('0x67')]()+_0xe9bd('0x69'));}});if(_0x1f41fc){return handleError(_0x2530e1,null)(_0x1f41fc);}if(_0x3e68fb[_0xe9bd('0x64')]['id']){delete _0x3e68fb['body']['id'];}return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x3e68fb['params']['id']},'include':[{'model':db[_0xe9bd('0x48')],'as':_0xe9bd('0x49')}]})['then'](handleEntityNotFound(_0x2530e1,null))[_0xe9bd('0x2d')](saveUpdates(_0x3e68fb[_0xe9bd('0x64')],null))[_0xe9bd('0x2d')](respondWithResult(_0x2530e1,null))[_0xe9bd('0x22')](handleError(_0x2530e1,null));};exports['destroy']=function(_0x3c1ab9,_0x41fb41){return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x3c1ab9[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x41fb41,null))[_0xe9bd('0x2d')](removeEntity(_0x41fb41,null))[_0xe9bd('0x22')](handleError(_0x41fb41,null));};exports[_0xe9bd('0x6e')]=function(_0x466a89,_0x5e127b){return db[_0xe9bd('0x5b')][_0xe9bd('0x6e')]()[_0xe9bd('0x2d')](respondWithResult(_0x5e127b,null))[_0xe9bd('0x22')](handleError(_0x5e127b,null));};exports[_0xe9bd('0x6f')]=function(_0x8f51aa,_0x18a387){if(_0x8f51aa[_0xe9bd('0x64')]['id']){delete _0x8f51aa[_0xe9bd('0x64')]['id'];}return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x8f51aa[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x18a387,null))[_0xe9bd('0x2d')](function(_0x383e0c){if(_0x383e0c){_0x8f51aa[_0xe9bd('0x64')][_0xe9bd('0x70')]=_0x383e0c['id'];return db['Disposition'][_0xe9bd('0x63')](_0x8f51aa[_0xe9bd('0x64')]);}})['then'](respondWithResult(_0x18a387,null))[_0xe9bd('0x22')](handleError(_0x18a387,null));};exports[_0xe9bd('0x71')]=function(_0x2d86b6,_0x2083c4){var _0x242110={'raw':![],'where':{}};var _0x332228={};var _0x28331d={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2d86b6[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x2083c4,null))[_0xe9bd('0x2d')](function(_0x1b863f){if(_0x1b863f){_0x332228[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db[_0xe9bd('0x72')]['rawAttributes']);_0x332228[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x2d86b6[_0xe9bd('0x4e')]);_0x332228[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x332228[_0xe9bd('0x43')],_0x332228[_0xe9bd('0x4e')]);_0x242110['attributes']=_['intersection'](_0x332228['model'],qs[_0xe9bd('0x52')](_0x2d86b6['query']['fields']));_0x242110['attributes']=_0x242110[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x242110[_0xe9bd('0x51')]:_0x332228[_0xe9bd('0x43')];if(!_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x242110[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x2d86b6['query'][_0xe9bd('0x2a')]);_0x242110['offset']=qs[_0xe9bd('0x29')](_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x242110[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x2d86b6['query']['sort']);_0x242110['where']=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x2d86b6['query'],_0x332228[_0xe9bd('0x4f')]));_0x242110[_0xe9bd('0x56')][_0xe9bd('0x70')]=_0x1b863f['id'];if(_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x58')]){_0x242110['where']=_[_0xe9bd('0x59')](_0x242110[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x242110[_0xe9bd('0x51')],function(_0x399429){var _0x1f9829={};_0x1f9829[_0x399429]={'$like':'%'+_0x2d86b6[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x1f9829;})});}_0x242110=_[_0xe9bd('0x59')]({},_0x242110,_0x2d86b6[_0xe9bd('0x5a')]);return db['Disposition']['count']({'where':_0x242110['where']})['then'](function(_0x4039c7){_0x28331d[_0xe9bd('0x28')]=_0x4039c7;if(_0x2d86b6[_0xe9bd('0x4e')]['includeAll']){_0x242110[_0xe9bd('0x5c')]=[{'all':!![]}];}return db[_0xe9bd('0x72')]['findAll'](_0x242110);})['then'](function(_0xb607c0){_0x28331d[_0xe9bd('0x5e')]=_0xb607c0;return _0x28331d;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x2083c4,_0x242110))[_0xe9bd('0x22')](handleError(_0x2083c4,null));};exports[_0xe9bd('0x75')]=function(_0x59364c,_0x5bd400){return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x59364c[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x5bd400,null))[_0xe9bd('0x2d')](function(_0x1880e7){if(_0x1880e7){return _0x1880e7[_0xe9bd('0x75')](_0x59364c[_0xe9bd('0x4e')][_0xe9bd('0x76')]);}})[_0xe9bd('0x2d')](respondWithStatusCode(_0x5bd400,null))[_0xe9bd('0x22')](handleError(_0x5bd400,null));};exports['addAnswer']=function(_0xb1203d,_0x5b8938){if(_0xb1203d[_0xe9bd('0x64')]['id']){delete _0xb1203d['body']['id'];}return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0xb1203d['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x5b8938,null))['then'](function(_0x2efc16){if(_0x2efc16){_0xb1203d[_0xe9bd('0x64')][_0xe9bd('0x70')]=_0x2efc16['id'];return db[_0xe9bd('0x77')][_0xe9bd('0x63')](_0xb1203d[_0xe9bd('0x64')]);}})['then'](respondWithResult(_0x5b8938,null))[_0xe9bd('0x22')](handleError(_0x5b8938,null));};exports[_0xe9bd('0x78')]=function(_0x4ee8a3,_0x46461d){var _0x180117={'raw':![],'where':{}};var _0x141fe2={};var _0x59897b={'count':0x0,'rows':[]};return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0x4ee8a3[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x46461d,null))[_0xe9bd('0x2d')](function(_0x48d4a2){if(_0x48d4a2){_0x141fe2[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db['CannedAnswer'][_0xe9bd('0x4b')]);_0x141fe2[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x4ee8a3[_0xe9bd('0x4e')]);_0x141fe2['filters']=_[_0xe9bd('0x50')](_0x141fe2[_0xe9bd('0x43')],_0x141fe2[_0xe9bd('0x4e')]);_0x180117[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x141fe2[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x4ee8a3['query'][_0xe9bd('0x52')]));_0x180117['attributes']=_0x180117[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x180117[_0xe9bd('0x51')]:_0x141fe2['model'];if(!_0x4ee8a3[_0xe9bd('0x4e')]['hasOwnProperty'](_0xe9bd('0x54'))){_0x180117[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x4ee8a3[_0xe9bd('0x4e')][_0xe9bd('0x2a')]);_0x180117[_0xe9bd('0x29')]=qs[_0xe9bd('0x29')](_0x4ee8a3[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x180117[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x4ee8a3['query'][_0xe9bd('0x55')]);_0x180117[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_['pick'](_0x4ee8a3[_0xe9bd('0x4e')],_0x141fe2[_0xe9bd('0x4f')]));_0x180117['where']['ChatWebsiteId']=_0x48d4a2['id'];if(_0x4ee8a3['query']['filter']){_0x180117[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x180117[_0xe9bd('0x56')],{'$or':_['map'](_0x180117[_0xe9bd('0x51')],function(_0x3b72cd){var _0x51fab7={};_0x51fab7[_0x3b72cd]={'$like':'%'+_0x4ee8a3[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x51fab7;})});}_0x180117=_[_0xe9bd('0x59')]({},_0x180117,_0x4ee8a3[_0xe9bd('0x5a')]);return db[_0xe9bd('0x77')]['count']({'where':_0x180117[_0xe9bd('0x56')]})[_0xe9bd('0x2d')](function(_0x5cc2ff){_0x59897b['count']=_0x5cc2ff;if(_0x4ee8a3['query']['includeAll']){_0x180117[_0xe9bd('0x5c')]=[{'all':!![]}];}return db[_0xe9bd('0x77')][_0xe9bd('0x5d')](_0x180117);})[_0xe9bd('0x2d')](function(_0x4d9cfa){_0x59897b['rows']=_0x4d9cfa;return _0x59897b;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x46461d,_0x180117))[_0xe9bd('0x22')](handleError(_0x46461d,null));};exports[_0xe9bd('0x7a')]=function(_0x4ee46c,_0x220f1f){return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x4ee46c['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x220f1f,null))[_0xe9bd('0x2d')](function(_0x346da7){if(_0x346da7){return _0x346da7[_0xe9bd('0x7a')](_0x4ee46c[_0xe9bd('0x4e')][_0xe9bd('0x76')]);}})[_0xe9bd('0x2d')](respondWithStatusCode(_0x220f1f,null))[_0xe9bd('0x22')](handleError(_0x220f1f,null));};exports[_0xe9bd('0x7b')]=function(_0x47f09c,_0x3484df){_0x47f09c[_0xe9bd('0x64')][_0xe9bd('0x7c')]=_0x47f09c[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x47f09c[_0xe9bd('0x60')]['id']}})['then'](handleEntityNotFound(_0x3484df,null))[_0xe9bd('0x2d')](saveUpdates(_0x47f09c['body'],null))[_0xe9bd('0x2d')](respondWithResult(_0x3484df,null))[_0xe9bd('0x22')](handleError(_0x3484df,null));};exports['addAvatar']=function(_0x343479,_0x2c4665){_0x343479['body'][_0xe9bd('0x7f')]=_0x343479[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x343479[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x2c4665,null))['then'](saveUpdates(_0x343479[_0xe9bd('0x64')],null))[_0xe9bd('0x2d')](respondWithResult(_0x2c4665,null))[_0xe9bd('0x22')](handleError(_0x2c4665,null));};exports['addCustomerAvatar']=function(_0x1454e5,_0x23ee4e){_0x1454e5[_0xe9bd('0x64')][_0xe9bd('0x80')]=_0x1454e5[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x1454e5[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x23ee4e,null))[_0xe9bd('0x2d')](saveUpdates(_0x1454e5['body'],null))[_0xe9bd('0x2d')](respondWithResult(_0x23ee4e,null))['catch'](handleError(_0x23ee4e,null));};exports['addSystemAvatar']=function(_0x4e1eb8,_0x1939ed){_0x4e1eb8['body']['systemAvatar']=_0x4e1eb8[_0xe9bd('0x7d')][_0xe9bd('0x7e')];return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x4e1eb8[_0xe9bd('0x60')]['id']}})['then'](handleEntityNotFound(_0x1939ed,null))['then'](saveUpdates(_0x4e1eb8[_0xe9bd('0x64')],null))['then'](respondWithResult(_0x1939ed,null))['catch'](handleError(_0x1939ed,null));};exports[_0xe9bd('0x81')]=function(_0x1771b1,_0x3b14dc){var _0x4fa1e1=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x84'));var _0x5ebe24={'where':{'id':_0x1771b1[_0xe9bd('0x60')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x573640=![];return require(_0xe9bd('0x85'))[_0xe9bd('0x86')]()[_0xe9bd('0x2d')](function(_0x3d168b){if(_0x3d168b){_0x573640=_0x3d168b[_0xe9bd('0x87')];}})['then'](function(){return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x5ebe24);})[_0xe9bd('0x2d')](handleEntityNotFound(_0x3b14dc,null))[_0xe9bd('0x2d')](function(_0x351fcd){if(_0x351fcd){if(!_[_0xe9bd('0x88')](_0x351fcd['sitepic'])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8a'),_0x351fcd[_0xe9bd('0x7c')]))&&_0x573640){_0x4fa1e1=path[_0xe9bd('0x82')](config['root'],_0xe9bd('0x8a'),_0x351fcd[_0xe9bd('0x7c')]);}}return _0x3b14dc['download'](_0x4fa1e1);}})[_0xe9bd('0x22')](handleError(_0x3b14dc,null));};exports[_0xe9bd('0x8b')]=function(_0x316022,_0x1e63d3){var _0x5befe7=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8c'));var _0xcee066={'where':{'id':_0x316022[_0xe9bd('0x60')]['id']},'attributes':['id',_0xe9bd('0x7f')],'raw':!![]};return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0xcee066)[_0xe9bd('0x2d')](handleEntityNotFound(_0x1e63d3,null))['then'](function(_0x2fa992){if(_0x2fa992){if(!_[_0xe9bd('0x88')](_0x2fa992[_0xe9bd('0x7f')])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8d'),_0x2fa992['agentAvatar']))){_0x5befe7=path[_0xe9bd('0x82')](config['root'],_0xe9bd('0x8d'),_0x2fa992[_0xe9bd('0x7f')]);}}return _0x1e63d3[_0xe9bd('0x8e')](_0x5befe7);}})[_0xe9bd('0x22')](handleError(_0x1e63d3,null));};exports[_0xe9bd('0x8f')]=function(_0x2b8645,_0x5bf65b){var _0x33b1fe=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],'server/files/images/avatars/customer_avatar.png');var _0x457536={'where':{'id':_0x2b8645[_0xe9bd('0x60')]['id']},'attributes':['id',_0xe9bd('0x80'),_0xe9bd('0x90')],'raw':!![]};return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x457536)[_0xe9bd('0x2d')](handleEntityNotFound(_0x5bf65b,null))[_0xe9bd('0x2d')](function(_0x20a8ce){if(_0x20a8ce){if(!_[_0xe9bd('0x88')](_0x20a8ce['customerAvatar'])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],'server/files/images/avatars/',_0x20a8ce[_0xe9bd('0x80')]))&&_0x20a8ce[_0xe9bd('0x90')]){_0x33b1fe=path[_0xe9bd('0x82')](config['root'],'server/files/images/avatars/',_0x20a8ce[_0xe9bd('0x80')]);}}return _0x5bf65b[_0xe9bd('0x8e')](_0x33b1fe);}})[_0xe9bd('0x22')](handleError(_0x5bf65b,null));};exports[_0xe9bd('0x91')]=function(_0x25ee5d,_0x464102){var _0xc57d62=path['join'](config[_0xe9bd('0x83')],_0xe9bd('0x92'));var _0x4cdea7={'where':{'id':_0x25ee5d[_0xe9bd('0x60')]['id']},'attributes':['id',_0xe9bd('0x93')],'raw':!![]};return db[_0xe9bd('0x5b')][_0xe9bd('0x62')](_0x4cdea7)[_0xe9bd('0x2d')](handleEntityNotFound(_0x464102,null))[_0xe9bd('0x2d')](function(_0x428a2e){if(_0x428a2e){if(!_[_0xe9bd('0x88')](_0x428a2e[_0xe9bd('0x93')])){if(fs[_0xe9bd('0x89')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0x8d'),_0x428a2e[_0xe9bd('0x93')]))){_0xc57d62=path[_0xe9bd('0x82')](config['root'],_0xe9bd('0x8d'),_0x428a2e[_0xe9bd('0x93')]);}}return _0x464102[_0xe9bd('0x8e')](_0xc57d62);}})[_0xe9bd('0x22')](handleError(_0x464102,null));};function checkWebsiteInterval(_0x217eff){var _0x552d2a=_0x217eff[_0xe9bd('0x94')];if(!_0x552d2a){return Promise[_0xe9bd('0x95')](_0x217eff);}var _0x1eeb25=_0x217eff[_0xe9bd('0x96')]||undefined;return _0x552d2a[_0xe9bd('0x97')](_0x1eeb25)[_0xe9bd('0x2d')](function(_0x1b40a8){if(!_0x1b40a8){throw new APIOutOfIntervalError();}return _0x217eff;});}exports[_0xe9bd('0x98')]=function(_0x3c1785,_0xab57a8){var _0x2a8861={'body':_0x3c1785[_0xe9bd('0x64')],'channel':_0xe9bd('0x99')};var _0x5953ca=[];var _0x1412ed=[];var _0x3acd14={};var _0x1f6f2e=![];if(_0x3c1785[_0xe9bd('0x64')]['id']){delete _0x3c1785[_0xe9bd('0x64')]['id'];}if(_[_0xe9bd('0x88')](_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9a')])){throw new APIBadRequestError(_0xe9bd('0x9b'));}if(_[_0xe9bd('0x88')](_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9c')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xe9bd('0x9d')](_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x64')])){throw new APIBadRequestError(_0xe9bd('0x9e'));}var _0x1958fa=_0x3c1785['body'][_0xe9bd('0x36')]&&_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x3d')];return db['CmContact'][_0xe9bd('0x6e')]()[_0xe9bd('0x2d')](function(_0x496640){if(!_0x496640){throw new Error('No\x20available\x20attributes');}_0x5953ca=Object['keys'](_0x496640)[_0xe9bd('0x58')](function(_0x46017e){return!['createdAt',_0xe9bd('0x9f')][_0xe9bd('0xa0')](_0x46017e);});_0x1412ed=Object[_0xe9bd('0x61')](_0x496640)['filter'](function(_0x15ad87){return![_0xe9bd('0xa1'),_0xe9bd('0x9f'),_0xe9bd('0xa2'),'ListId'][_0xe9bd('0xa0')](_0x15ad87);});if(!_[_0xe9bd('0xa0')](_0x1412ed,_0x3c1785['body'][_0xe9bd('0x9c')])){throw new APIBadRequestError(_0xe9bd('0xa3')+_0x1412ed[_0xe9bd('0x82')](',\x20'));}_0x3acd14[_0x3c1785[_0xe9bd('0x64')]['mapKey']]=_0x3c1785['body']['from'];})[_0xe9bd('0x2d')](function(){return db['ChatWebsite'][_0xe9bd('0x62')]({'where':{'id':_0x3c1785[_0xe9bd('0x60')]['id']},'include':[{'model':db[_0xe9bd('0xa4')],'as':_0xe9bd('0xa5'),'include':[{'model':db[_0xe9bd('0xa6')],'as':_0xe9bd('0xa7'),'where':_0x3acd14,'limit':0x1,'order':[['updatedAt',_0xe9bd('0xa8')]]}]},{'model':db[_0xe9bd('0xa9')],'as':_0xe9bd('0xaa')},{'model':db[_0xe9bd('0x94')],'as':_0xe9bd('0x94'),'include':[{'model':db[_0xe9bd('0x94')],'as':_0xe9bd('0xab'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xe9bd('0x2d')](function(_0x40abfd){if(!_0x40abfd){throw new APINotFoundError(util[_0xe9bd('0x45')](_0xe9bd('0xac'),_0x3c1785['params']['id']));}if(_0x1958fa){return checkWebsiteInterval(_0x40abfd);}return _0x40abfd;})[_0xe9bd('0x2d')](function(_0x16ff7b){_0x2a8861[_0xe9bd('0xad')]=_0x16ff7b;_0x2a8861[_0xe9bd('0xae')]=_[_0xe9bd('0xaf')](_0x16ff7b[_0xe9bd('0xaa')],[_0xe9bd('0xb0')],[_0xe9bd('0xb1')]);if(_0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xaa')]){delete _0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xaa')];}_0x2a8861[_0xe9bd('0xb2')]=_0x16ff7b['List']||{'id':_0x16ff7b[_0xe9bd('0xb3')]};if(_0x2a8861[_0xe9bd('0xb2')]&&_0x2a8861['list'][_0xe9bd('0xa7')][_0xe9bd('0x53')]){return _0x2a8861[_0xe9bd('0xb2')]['Contacts'][0x0];}var _0x29d6c9=_[_0xe9bd('0x12')](_0x3c1785[_0xe9bd('0x64')],{'firstName':_0x3c1785[_0xe9bd('0x64')]['from'],'ListId':_0x16ff7b[_0xe9bd('0xb3')]});_0x29d6c9[_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9c')]]=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x9a')];return db[_0xe9bd('0xa6')]['create'](_0x29d6c9,{'fields':_0x5953ca,'raw':!![]});})[_0xe9bd('0x2d')](function(_0x55d50f){_0x2a8861['contact']=_0x55d50f;var _0x3fc20a=createInteractionObject(_0x3c1785['params']['id'],_0x3c1785[_0xe9bd('0x64')],_0x3c1785['headers'],_0x55d50f);var _0x2febfb={'ChatWebsiteId':_0x3c1785[_0xe9bd('0x60')]['id']};if(_0x3c1785['body'][_0xe9bd('0xb4')]){_0x2febfb[_0xe9bd('0xb4')]=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb4')];_0x2febfb[_0xe9bd('0xb5')]=![];return db[_0xe9bd('0xb6')][_0xe9bd('0x62')]({'where':_0x2febfb})['then'](function(_0x23be6d){var _0x1e8c01=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x36')]&&_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x3d')];if(_0x23be6d){_0x1f6f2e=!![];return _0x23be6d;}else if(!_0x1e8c01&&_0x23be6d&&_0x23be6d['closed']){throw new APIConflictError(_0xe9bd('0xb7'));}_0x3fc20a[_0xe9bd('0xb4')]=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb4')];_0x3fc20a[_0xe9bd('0xb8')]=_0x3c1785['body']['externalUrl'];return db['ChatInteraction'][_0xe9bd('0x63')](_0x3fc20a);});}_0x2febfb['ContactId']=_0x55d50f['id'];if(_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb9')]&&_0x3c1785['body'][_0xe9bd('0xb9')]['id']){_0x2febfb['id']=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xb9')]['id'];return db[_0xe9bd('0xb6')][_0xe9bd('0x62')]({'where':_0x2febfb})[_0xe9bd('0x2d')](function(_0x914313){var _0x54eeed=_0x3c1785['body'][_0xe9bd('0x36')]&&_0x3c1785['body']['referer'];if(!_0x54eeed&&_0x914313&&_0x914313[_0xe9bd('0xb5')]){throw new APIConflictError(_0xe9bd('0xb7'));}else if(_0x914313){_0x1f6f2e=!![];return _0x914313;}else{return db[_0xe9bd('0xb6')][_0xe9bd('0x63')](_0x3fc20a);}});}return db[_0xe9bd('0xb6')][_0xe9bd('0x63')](_0x3fc20a);})[_0xe9bd('0x2d')](function(_0x4339cd){if(!_0x1f6f2e){return _0x4339cd;}var _0xe55ad1={'from':(_0x2a8861[_0xe9bd('0xba')][_0xe9bd('0x3a')]||'')+'\x20'+(_0x2a8861['contact'][_0xe9bd('0x3b')]||'')};if(_0x3c1785['body'][_0xe9bd('0xb4')]&&_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xbb')]&&_0x3c1785[_0xe9bd('0x64')]['threadId']!=_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0xbb')]){_0xe55ad1[_0xe9bd('0xb4')]=_0x3c1785['body']['messageId'];}return _0x4339cd[_0xe9bd('0xbc')](_0xe55ad1);})[_0xe9bd('0x2d')](function(_0x6e1fd3){_0x2a8861[_0xe9bd('0xb9')]=_0x6e1fd3[_0xe9bd('0x2e')]({'plain':!![]});_0x2a8861[_0xe9bd('0xb9')]['created']=!_0x1f6f2e;if(_0x2a8861[_0xe9bd('0xb9')][_0xe9bd('0xbd')]){if(_0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xbe')]){_0x2a8861['applications'][_0xe9bd('0xbf')]({'id':0x0,'priority':_0x2a8861[_0xe9bd('0xae')][_0xe9bd('0x53')]+0x1,'app':'close','appdata':_0xe9bd('0xc0'),'interval':_0xe9bd('0xc1')});}}return db[_0xe9bd('0xc2')][_0xe9bd('0x63')]({'body':_0x3c1785[_0xe9bd('0x64')][_0xe9bd('0x64')],'ChatWebsiteId':_0x3c1785[_0xe9bd('0x60')]['id'],'ChatInteractionId':_0x6e1fd3['id'],'direction':'in','ContactId':_0x2a8861['contact']['id'],'AttachmentId':_0x3c1785['body'][_0xe9bd('0xc3')]});})[_0xe9bd('0x2d')](function(_0x1e6b83){_0x2a8861['message']=_0x1e6b83;if(!_0x2a8861['interaction'][_0xe9bd('0xc4')]){return;}return db[_0xe9bd('0xc5')][_0xe9bd('0x62')]({'attributes':['id','name'],'where':{'id':_0x2a8861[_0xe9bd('0xb9')]['UserId']}});})[_0xe9bd('0x2d')](function(_0xe52e79){if(_0xe52e79){_0x2a8861[_0xe9bd('0xae')][_0xe9bd('0xc6')]({'id':0x0,'priority':0x0,'app':_0xe9bd('0xc7'),'appdata':_0xe52e79[_0xe9bd('0x32')]+','+(_0x2a8861[_0xe9bd('0xad')][_0xe9bd('0xc8')]||0xa),'interval':_0xe9bd('0xc1')});_0x2a8861['forcedOwnership']=!![];}if(!_0x2a8861['interaction'][_0xe9bd('0xc9')]){return;}return db[_0xe9bd('0xca')][_0xe9bd('0x62')]({'attributes':['id',_0xe9bd('0x32')],'where':{'id':_0x2a8861[_0xe9bd('0xb9')][_0xe9bd('0xc9')]}});})[_0xe9bd('0x2d')](function(_0xdfc5ca){if(_0xdfc5ca){_0x2a8861['applications'][_0xe9bd('0xc6')]({'id':0x0,'priority':0x1,'app':_0xe9bd('0xcb'),'appdata':_0xdfc5ca['name']+','+(_0x2a8861[_0xe9bd('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0xe9bd('0xc1')});}return respondWithRpcPromise(_0xe9bd('0xcc'),_0xe9bd('0xcd'),_0x2a8861);})['then'](function(_0x4c7419){respondWithRpcPromise(_0xe9bd('0xce'),'EventManager',{'event':_0xe9bd('0x98'),'message':_0x4c7419},client9002);return _0x4c7419;})[_0xe9bd('0x2d')](respondWithResult(_0xab57a8,null))[_0xe9bd('0x22')](APIHandleError(_0xab57a8));};exports[_0xe9bd('0xcf')]=function(_0x2256c2,_0x4eb22e){var _0x3000a9,_0x2648bd,_0x993518;var _0x2c9342=[];var _0x30c3ed={};var _0x156dfc=_0x2256c2['files']||[];var _0x39e8e5=[];var _0x5a2edb;return db[_0xe9bd('0xa6')]['describe']()[_0xe9bd('0x2d')](function(_0x1ec28e){if(!_0x1ec28e){throw new db['Sequelize'][(_0xe9bd('0xd0'))](_0xe9bd('0xd1'));}_0x2c9342=_['difference'](_[_0xe9bd('0x61')](_0x1ec28e),['createdAt','updatedAt','CompanyId',_0xe9bd('0xb3')]);if(_0x2256c2[_0xe9bd('0x64')]['id']){delete _0x2256c2['body']['id'];}if(_['isNil'](_0x2256c2[_0xe9bd('0x64')]['from'])){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db['Sequelize'][(_0xe9bd('0xd0'))](_0xe9bd('0xd2')));}if(_[_0xe9bd('0x88')](_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x64')])||_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x64')]===''){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db[(_0xe9bd('0xd3'))][(_0xe9bd('0xd0'))](_0xe9bd('0xd4')));}if(_[_0xe9bd('0x88')](_0x2256c2['body'][_0xe9bd('0xd5')])){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db[(_0xe9bd('0xd3'))][(_0xe9bd('0xd0'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c9342));}if(!_[_0xe9bd('0xa0')](_0x2c9342,_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0xd5')])){throw _0x4eb22e[_0xe9bd('0x25')](0x1f4)[_0xe9bd('0x33')](new db[(_0xe9bd('0xd3'))][(_0xe9bd('0xd0'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c9342));}_0x30c3ed[_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0xd5')]]=_0x2256c2['body'][_0xe9bd('0x9a')];})[_0xe9bd('0x2d')](function(){return db[_0xe9bd('0x5b')][_0xe9bd('0x62')]({'where':{'id':_0x2256c2[_0xe9bd('0x60')]['id']},'include':[{'model':db[_0xe9bd('0xa4')],'as':_0xe9bd('0xa5')},{'model':db[_0xe9bd('0xd6')],'as':'MailAccount'}]});})[_0xe9bd('0x2d')](handleEntityNotFound(_0x4eb22e,null))[_0xe9bd('0x2d')](function(_0x381ad4){if(_0x381ad4&&_0x381ad4['List']){_0x2648bd=_0x381ad4;var _0x351200=_[_0xe9bd('0x12')](_0x2256c2['body'],{'firstName':_0x2256c2['body'][_0xe9bd('0x9a')],'phone':_0x2256c2['body'][_0xe9bd('0x9a')],'ListId':_0x381ad4[_0xe9bd('0xb3')]});_0x351200[_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0xd5')]]=_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x9a')];return db[_0xe9bd('0xa6')][_0xe9bd('0xd7')]({'where':_0x30c3ed,'defaults':_0x351200});}})['spread'](function(_0x199b78){if(_0x199b78){_0x993518=_0x199b78;var _0x418136=fs[_0xe9bd('0xd8')](path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0xd9')),'utf8');var _0x29ead4=ejs[_0xe9bd('0xda')](_0x418136,{'body':_[_0xe9bd('0xdb')](_0x2256c2[_0xe9bd('0x64')][_0xe9bd('0x64')]),'bodyTitle':_0x2648bd[_0xe9bd('0xdc')]});return db[_0xe9bd('0xdd')][_0xe9bd('0x63')]({'body':_0x29ead4,'plainBody':htmlToText['fromString'](_0x29ead4),'ContactId':_0x199b78['id'],'ChatWebsiteId':_0x2648bd['id']});}})['then'](function(_0x332b06){_0x5a2edb=_0x332b06;if(_0x156dfc[_0xe9bd('0x53')]){var _0x423da1=_0x156dfc[_0xe9bd('0x4a')](function(_0x2db8f4){return{'name':_0x2db8f4[_0xe9bd('0xde')],'basename':_0x2db8f4[_0xe9bd('0x7e')],'type':_0x2db8f4[_0xe9bd('0xdf')],'ChatOfflineMessageId':_0x332b06['id']};});_0x39e8e5=_0x423da1[_0xe9bd('0x4a')](_0x2301ce=>{var _0x4a781d={'filename':_0x2301ce[_0xe9bd('0x32')],'path':path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0xe0'),_0xe9bd('0xe1'),_0xe9bd('0xe2'),_0xe9bd('0xe3'),_0x2301ce['basename'])};return _0x4a781d;});if(!_0x2648bd[_0xe9bd('0xe4')]){return db[_0xe9bd('0xe5')][_0xe9bd('0xe6')](function(_0x23b222){return db[_0xe9bd('0xe7')]['bulkCreate'](_0x423da1,{'transaction':_0x23b222});});}}})[_0xe9bd('0x2d')](function(){if(_0x5a2edb){_0x3000a9=_0x5a2edb;return db[_0xe9bd('0xd6')][_0xe9bd('0x79')]({'where':{'service':!![]},'include':[{'model':db[_0xe9bd('0xe8')],'as':_0xe9bd('0xe9'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe9bd('0xea'),'raw':!![]}]}]});}})['then'](function(_0x34ae3d){if(_0x34ae3d&&_0x34ae3d[_0xe9bd('0xe9')]&&_0x2648bd[_0xe9bd('0xeb')]&&_0x2648bd['forwardOfflineAddress']){var _0x5b3190=_0x34ae3d[_0xe9bd('0xec')]();return respondWithRpcPromise(_0xe9bd('0xed'),_0xe9bd('0xee'),{'account':_0x5b3190,'message':{'from':util['format'](_0xe9bd('0xef'),_0x34ae3d[_0xe9bd('0x32')],_0x34ae3d[_0xe9bd('0xf0')]||_0x34ae3d[_0xe9bd('0xe9')][_0xe9bd('0x6a')]),'to':_0x2648bd[_0xe9bd('0xf1')],'subject':_0x2648bd[_0xe9bd('0xf2')],'html':_0x3000a9[_0xe9bd('0x64')],'attachments':_0x39e8e5}},client9003)[_0xe9bd('0x2d')](function(){return _0x3000a9;})[_0xe9bd('0x22')](function(_0x1bae64){logger[_0xe9bd('0x1f')](_0x1bae64);});}})[_0xe9bd('0x2d')](function(){if(_0x2648bd&&_0x2648bd[_0xe9bd('0xe4')]&&_0x2648bd['MailAccountId']){var _0x3fe9ca=[];if(_0x156dfc[_0xe9bd('0x53')]){_0x3fe9ca=_0x156dfc['map'](function(_0x94a906){return{'name':_0x94a906[_0xe9bd('0xde')],'basename':_0x94a906[_0xe9bd('0x7e')],'type':_0x94a906[_0xe9bd('0xdf')],'ChatOfflineMessageId':_0x5a2edb['id']};});}var _0x52e35a;if(!_[_0xe9bd('0x88')](_0x2648bd[_0xe9bd('0xf3')])){var _0x287fab=_[_0xe9bd('0x4a')](_0x2256c2[_0xe9bd('0x64')],function(_0x4c25cb){return _0x4c25cb;});var _0x3107f0=_['toPairsIn'](_0x287fab)[0x0];var _0xc162df=_[_0xe9bd('0xf4')](_0x3107f0,function(_0x8f8874){return _0x8f8874;});_0x52e35a=_0xc162df[0x1][_0x2648bd[_0xe9bd('0xf3')]];}var _0x240cd0={'from':_0x993518['email'],'firstName':_0x993518[_0xe9bd('0x3a')],'lastName':_0x993518[_0xe9bd('0x3b')],'mapKey':_0xe9bd('0xf0'),'message':{'from':_0x993518[_0xe9bd('0xf0')],'to':_0x2648bd[_0xe9bd('0xd6')][_0xe9bd('0xf0')],'cc':'','subject':_[_0xe9bd('0x88')](_0x52e35a)?_0x2648bd['offlineMessageSubject']:_0x52e35a,'messageId':'','sentAt':new Date(),'attach':_0x3fe9ca[_0xe9bd('0x53')],'attachments':_0x3fe9ca,'originChannel':_0xe9bd('0xf5'),'ChatWebsiteId':_0x2648bd['id'],'ChatOfflineMessageId':_0x3000a9['id'],'originTo':_0x2648bd[_0xe9bd('0xd6')][_0xe9bd('0xf0')]},'body':_0x3000a9[_0xe9bd('0x64')]};var _0x5f3e76={'account':{'id':_0x2648bd[_0xe9bd('0xf6')]},'body':_0x240cd0,'log':_0xe9bd('0xf7')};return respondWithRpcPromise(_0xe9bd('0xf7'),_0xe9bd('0xf8'),_0x5f3e76,client9001)[_0xe9bd('0x2d')](function(){return _0x3000a9;})[_0xe9bd('0x22')](function(_0xe79615){logger[_0xe9bd('0x1f')](_0xe79615);});}return;})[_0xe9bd('0x2d')](function(){if(_0x3000a9){return _0x3000a9;}})[_0xe9bd('0x2d')](respondWithResult(_0x4eb22e,null))[_0xe9bd('0x22')](function(){for(var _0x3a563a of _0x156dfc){var _0x11461a=path[_0xe9bd('0x82')](config[_0xe9bd('0x83')],_0xe9bd('0xe0'),_0xe9bd('0xe1'),_0xe9bd('0xe2'),_0xe9bd('0xe3'),_0x3a563a[_0xe9bd('0x7e')]);fs_extra['remove'](_0x11461a)[_0xe9bd('0x22')](function(_0x1189fb){logger[_0xe9bd('0x1f')](_0xe9bd('0xf9'),_0x11461a,_0x1189fb);});}});};exports['addInteraction']=function(_0x28756c,_0x5e04d5){return db['ChatInteraction']['find']({'where':{'id':_0x28756c['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x5e04d5,null))[_0xe9bd('0x2d')](function(_0x950ca7){if(_0x950ca7){return _0x950ca7['addInteraction'](_0x28756c[_0xe9bd('0x64')]['ids'],_[_0xe9bd('0xfa')](_0x28756c[_0xe9bd('0x64')],['ids','id'])||{});}})[_0xe9bd('0x2d')](respondWithResult(_0x5e04d5,null))['catch'](handleError(_0x5e04d5,null));};exports['getInteractions']=function(_0x237de3,_0x3a1813){var _0x1ae682={'raw':![],'where':{}};var _0x58ca5e={};var _0x2c1177={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe9bd('0x79')]({'where':{'id':_0x237de3['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x3a1813,null))[_0xe9bd('0x2d')](function(_0x38aa10){if(_0x38aa10){_0x58ca5e['model']=_[_0xe9bd('0x61')](db['ChatInteraction'][_0xe9bd('0x4b')]);_0x58ca5e[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x237de3[_0xe9bd('0x4e')]);_0x58ca5e[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x58ca5e[_0xe9bd('0x43')],_0x58ca5e[_0xe9bd('0x4e')]);_0x1ae682[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x58ca5e[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x1ae682[_0xe9bd('0x51')]=_0x1ae682[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x1ae682[_0xe9bd('0x51')]:_0x58ca5e[_0xe9bd('0x43')];if(!_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x73')]('nolimit')){_0x1ae682[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x237de3['query'][_0xe9bd('0x2a')]);_0x1ae682[_0xe9bd('0x29')]=qs[_0xe9bd('0x29')](_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x1ae682['order']=qs[_0xe9bd('0x55')](_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x1ae682[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x237de3[_0xe9bd('0x4e')],_0x58ca5e[_0xe9bd('0x4f')]));_0x1ae682[_0xe9bd('0x56')][_0xe9bd('0x70')]=_0x38aa10['id'];if(_0x237de3['query'][_0xe9bd('0x58')]){_0x1ae682[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x1ae682[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x1ae682[_0xe9bd('0x51')],function(_0x46f48b){var _0x44403c={};_0x44403c[_0x46f48b]={'$like':'%'+_0x237de3['query'][_0xe9bd('0x58')]+'%'};return _0x44403c;})});}_0x1ae682=_[_0xe9bd('0x59')]({},_0x1ae682,_0x237de3[_0xe9bd('0x5a')]);return db[_0xe9bd('0xb6')]['count']({'where':_0x1ae682[_0xe9bd('0x56')]})[_0xe9bd('0x2d')](function(_0x298c03){_0x2c1177[_0xe9bd('0x28')]=_0x298c03;if(_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0xfb')]){_0x1ae682[_0xe9bd('0x5c')]=[{'model':db[_0xe9bd('0xa6')],'as':'Contact','required':![]},{'model':db[_0xe9bd('0xc5')],'as':'Owner','attributes':['name','fullname',_0xe9bd('0xfc')],'required':![]},{'model':db['Tag'],'as':_0xe9bd('0xfd'),'attributes':['id','name','color'],'where':_0x237de3[_0xe9bd('0x4e')]['tag']?{'id':_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0xfe')]}:undefined,'required':_0x237de3[_0xe9bd('0x4e')][_0xe9bd('0xfe')]?!![]:![]}];}return db[_0xe9bd('0xb6')][_0xe9bd('0x5d')](_0x1ae682);})['then'](function(_0x379afa){_0x2c1177[_0xe9bd('0x5e')]=_0x379afa;return _0x2c1177;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x3a1813,_0x1ae682))['catch'](handleError(_0x3a1813,null));};exports[_0xe9bd('0xff')]=function(_0x3c0224,_0x513d7e){var _0x364dc2=0x0;var _0x3da15a=0x0;var _0x44af86=![];var _0x794246;var _0x415fdf;return db['ChatWebsite']['find']({'where':{'id':_0x3c0224[_0xe9bd('0x60')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0xe9bd('0xab'),'attributes':['id',_0xe9bd('0x100')]}]}]})[_0xe9bd('0x2d')](handleEntityNotFound(_0x513d7e,null))[_0xe9bd('0x2d')](function(_0xeb2582){if(_0xeb2582){_0x794246=_0xeb2582;return _0xeb2582[_0xe9bd('0x101')]({'raw':!![]});}})[_0xe9bd('0x2d')](function(_0x49077e){if(_0x794246){if(_0x49077e){_0x415fdf=_0x49077e;}}return require(_0xe9bd('0x85'))[_0xe9bd('0x86')]();})[_0xe9bd('0x2d')](function(_0x5e2013){if(_0x5e2013){_0x3da15a=_0x5e2013[_0xe9bd('0x102')];_0x44af86=_0x5e2013[_0xe9bd('0x87')];}})[_0xe9bd('0x2d')](function(){return db['ChatInteraction'][_0xe9bd('0x28')]({'where':{'closed':![]}});})[_0xe9bd('0x2d')](function(_0xbf887){_0x364dc2=_0xbf887;if(_0x3da15a&&_0xbf887>_0x3da15a){return db['License'][_0xe9bd('0x79')]({'where':{'id':0x1}})[_0xe9bd('0x2d')](function(_0xfe63bf){if(_0xfe63bf){_0xfe63bf[_0xe9bd('0x103')]('chatLicenseExceeded');}});}})[_0xe9bd('0x2d')](function(){var _0x3988df=_0x794246[_0xe9bd('0x94')];var _0x1628d4=_0x794246['timezone']||undefined;return _0x3988df?_0x3988df[_0xe9bd('0x97')](_0x1628d4):!![];})[_0xe9bd('0x2d')](function(_0x3262b5){var _0x13f1d7=fs[_0xe9bd('0xd8')](path['join'](config[_0xe9bd('0x83')],_0xe9bd('0x104')),_0xe9bd('0x105'));var _0x34d333='3.10.1';var _0xc7c9a8=![];var _0x3d7e87,_0x225a35;if(_0x3c0224[_0xe9bd('0x106')]['referer']){_0x3d7e87=new URL(_0x3c0224[_0xe9bd('0x106')][_0xe9bd('0x3d')])[_0xe9bd('0x107')];}else if(_0x3c0224[_0xe9bd('0x106')]['origin']){_0x3d7e87=new URL(_0x3c0224[_0xe9bd('0x106')][_0xe9bd('0x107')])[_0xe9bd('0x107')];}else{_0x3d7e87=_0xe9bd('0x108');}_0x225a35=typeof _0x794246[_0xe9bd('0x65')][_0xe9bd('0x39')](',')[_0xe9bd('0x62')](function(_0x3f44d9){return wildcardUtils['testWebsiteWithWildcard'](_0x3f44d9,_0x3d7e87);})!==_0xe9bd('0x27');var _0xb835d7={'chatVersion':_0x34d333,'chatWebsiteAddressOrigin':_0x225a35?_0x3d7e87:_0x794246[_0xe9bd('0x65')],'remote':_0x794246[_0xe9bd('0x109')],'query':querystring['stringify'](_[_0xe9bd('0x59')](_0x794246[_0xe9bd('0x2e')]({'plain':!![]}),{'customerIp':_0x3c0224[_0xe9bd('0x106')][_0xe9bd('0x38')]||_0x3c0224['headers']['x-real-ip']||_0x3c0224[_0xe9bd('0x10a')]['remoteAddress']||_0x3c0224['ip'],'referer':_0x3c0224['headers'][_0xe9bd('0x3d')],'openedInteractions':_0x364dc2,'maxInteractions':_0x3da15a,'virtual':_0x44af86['virtual'],'online':_0x3262b5,'custom':_0x44af86,'address':_0x225a35?_0x3d7e87:null}))[_0xe9bd('0x10b')](/'/g,'\x5c\x27')};_0x513d7e[_0xe9bd('0x33')](ejs[_0xe9bd('0xda')](Mustache[_0xe9bd('0xda')](_0x13f1d7,_0xb835d7),{'proactiveActions':_0x415fdf,'alignment':_0x794246[_0xe9bd('0x10c')],'verticalAlignment':_0x794246[_0xe9bd('0x10d')],'div_color':_0x794246[_0xe9bd('0x10e')],'labelText':_0x794246[_0xe9bd('0x10f')],'text_color':_0x794246[_0xe9bd('0x110')],'text_button_color':_0x794246[_0xe9bd('0x111')],'button_color':_0x794246[_0xe9bd('0x112')],'background_color':_0x794246[_0xe9bd('0x113')],'hideWhenOffline':_0x794246[_0xe9bd('0x114')],'intervalId':_0x794246[_0xe9bd('0x115')],'isDevelopment':_0xc7c9a8,'chatVersion':_0x34d333}));})[_0xe9bd('0x22')](handleError(_0x513d7e,null));};exports[_0xe9bd('0x116')]=function(_0x52ffd7,_0x38c5d6){var _0x3a801e=_0x52ffd7[_0xe9bd('0x60')]['id'];var _0x367e1f=_0x52ffd7[_0xe9bd('0x64')];var _0x4f9ce9=0xc8;var _0x13076f=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xe9bd('0xe5')][_0xe9bd('0x117')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5029a4){return db[_0xe9bd('0x5b')]['findOne']({'where':{'id':_0x3a801e},'transaction':_0x5029a4})['then'](function(_0x22a1fe){if(_0x22a1fe){return db['ChatApplication'][_0xe9bd('0x31')]({'where':{'ChatWebsiteId':_0x3a801e},'transaction':_0x5029a4})[_0xe9bd('0x2d')](function(){var _0x17907b=_[_0xe9bd('0x4a')](_0x367e1f,function(_0x54a544){_0x54a544[_0xe9bd('0x70')]=_0x3a801e;return _0x54a544;});return db[_0xe9bd('0xa9')][_0xe9bd('0x118')](_0x17907b,{'transaction':_0x5029a4});});}else{_0x4f9ce9=0x194;_0x13076f=[];}});})[_0xe9bd('0x2d')](function(){if(_0x4f9ce9!==0x194){return db[_0xe9bd('0xa9')][_0xe9bd('0x119')]({'where':{'ChatWebsiteId':_0x3a801e},'order':_0xe9bd('0xb0')})['then'](function(_0x51801a){_0x13076f=_0x51801a;});}})['catch'](function(_0x57bb20){_0x4f9ce9=0x1f4;logger[_0xe9bd('0x1f')](_0x57bb20[_0xe9bd('0x11a')]);if(_0x57bb20[_0xe9bd('0x32')]){delete _0x57bb20[_0xe9bd('0x32')];}_0x13076f=_0x57bb20;})[_0xe9bd('0x11b')](function(){if(_0x13076f===null){_0x38c5d6[_0xe9bd('0x23')](_0x4f9ce9);}else{if(_0x4f9ce9===0x1f4){_0x38c5d6[_0xe9bd('0x25')](_0x4f9ce9)[_0xe9bd('0x33')](_0x13076f);}else{_0x38c5d6['status'](_0x4f9ce9)[_0xe9bd('0x26')](_0x13076f);}}});};exports[_0xe9bd('0x11c')]=function(_0x2dcbb5,_0x34c059){var _0x16b9ff={};var _0x6fafa8={};var _0x510de3;var _0x1a68ff;return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0x2dcbb5[_0xe9bd('0x60')]['id']}})['then'](handleEntityNotFound(_0x34c059,null))['then'](function(_0x5344b2){if(_0x5344b2){_0x510de3=_0x5344b2;_0x6fafa8[_0xe9bd('0x43')]=_['keys'](db[_0xe9bd('0xa9')][_0xe9bd('0x4b')]);_0x6fafa8[_0xe9bd('0x4e')]=_[_0xe9bd('0x61')](_0x2dcbb5[_0xe9bd('0x4e')]);_0x6fafa8[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x6fafa8[_0xe9bd('0x43')],_0x6fafa8['query']);_0x16b9ff[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x6fafa8[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x2dcbb5[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x16b9ff[_0xe9bd('0x51')]=_0x16b9ff['attributes'][_0xe9bd('0x53')]?_0x16b9ff[_0xe9bd('0x51')]:_0x6fafa8[_0xe9bd('0x43')];_0x16b9ff[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x2dcbb5['query'][_0xe9bd('0x55')]);_0x16b9ff[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_['pick'](_0x2dcbb5['query'],_0x6fafa8[_0xe9bd('0x4f')]));if(_0x2dcbb5[_0xe9bd('0x4e')][_0xe9bd('0x58')]){_0x16b9ff[_0xe9bd('0x56')]=_[_0xe9bd('0x59')](_0x16b9ff['where'],{'$or':_[_0xe9bd('0x4a')](_0x16b9ff[_0xe9bd('0x51')],function(_0x230dc3){var _0x293858={};_0x293858[_0x230dc3]={'$like':'%'+_0x2dcbb5[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x293858;})});}_0x16b9ff=_[_0xe9bd('0x59')]({},_0x16b9ff,_0x2dcbb5[_0xe9bd('0x5a')]);return _0x510de3[_0xe9bd('0x11c')](_0x16b9ff);}})['then'](function(_0x3ebd5d){if(_0x3ebd5d){_0x1a68ff=_0x3ebd5d[_0xe9bd('0x53')];if(!_0x2dcbb5['query'][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x16b9ff[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x2dcbb5['query'][_0xe9bd('0x2a')]);_0x16b9ff['offset']=qs[_0xe9bd('0x29')](_0x2dcbb5[_0xe9bd('0x4e')]['offset']);}return _0x510de3[_0xe9bd('0x11c')](_0x16b9ff);}})[_0xe9bd('0x2d')](function(_0x2eb64d){if(_0x2eb64d){return _0x2eb64d?{'count':_0x1a68ff,'rows':_0x2eb64d}:null;}})['then'](respondWithResult(_0x34c059,null))[_0xe9bd('0x22')](handleError(_0x34c059,null));};exports[_0xe9bd('0x11d')]=function(_0x352484,_0x46f994){return db['chatProactiveAction'][_0xe9bd('0x62')]({'where':{'id':_0x352484[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x46f994,null))[_0xe9bd('0x2d')](function(_0x9ca060){if(_0x9ca060){return _0x9ca060[_0xe9bd('0x11d')](_0x352484[_0xe9bd('0x64')][_0xe9bd('0x76')],_['omit'](_0x352484[_0xe9bd('0x64')],[_0xe9bd('0x76'),'id'])||{});}})[_0xe9bd('0x2d')](respondWithResult(_0x46f994,null))[_0xe9bd('0x22')](handleError(_0x46f994,null));};exports['getProactiveActions']=function(_0xcce209,_0x1b7d5b){var _0x2f0a5d={};var _0x5a1e21={};var _0x4a3260;var _0x11dc0d;return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0xcce209[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x1b7d5b,null))['then'](function(_0x5c9f1a){if(_0x5c9f1a){_0x4a3260=_0x5c9f1a;_0x5a1e21[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db[_0xe9bd('0x11e')][_0xe9bd('0x4b')]);_0x5a1e21[_0xe9bd('0x4e')]=_['keys'](_0xcce209[_0xe9bd('0x4e')]);_0x5a1e21[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x5a1e21[_0xe9bd('0x43')],_0x5a1e21[_0xe9bd('0x4e')]);_0x2f0a5d['attributes']=_[_0xe9bd('0x50')](_0x5a1e21['model'],qs[_0xe9bd('0x52')](_0xcce209['query']['fields']));_0x2f0a5d['attributes']=_0x2f0a5d[_0xe9bd('0x51')][_0xe9bd('0x53')]?_0x2f0a5d[_0xe9bd('0x51')]:_0x5a1e21[_0xe9bd('0x43')];_0x2f0a5d[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x2f0a5d[_0xe9bd('0x56')]=qs[_0xe9bd('0x4f')](_['pick'](_0xcce209[_0xe9bd('0x4e')],_0x5a1e21[_0xe9bd('0x4f')]));if(_0xcce209['query'][_0xe9bd('0x58')]){_0x2f0a5d['where']=_['merge'](_0x2f0a5d[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x2f0a5d[_0xe9bd('0x51')],function(_0x5d756a){var _0x5d5a7a={};_0x5d5a7a[_0x5d756a]={'$like':'%'+_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x5d5a7a;})});}_0x2f0a5d=_[_0xe9bd('0x59')]({},_0x2f0a5d,_0xcce209['options']);return _0x4a3260[_0xe9bd('0x101')](_0x2f0a5d);}})[_0xe9bd('0x2d')](function(_0x1096f4){if(_0x1096f4){_0x11dc0d=_0x1096f4['length'];if(!_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x2f0a5d[_0xe9bd('0x2a')]=qs['limit'](_0xcce209[_0xe9bd('0x4e')][_0xe9bd('0x2a')]);_0x2f0a5d[_0xe9bd('0x29')]=qs[_0xe9bd('0x29')](_0xcce209['query'][_0xe9bd('0x29')]);}return _0x4a3260[_0xe9bd('0x101')](_0x2f0a5d);}})[_0xe9bd('0x2d')](function(_0x5eefaf){if(_0x5eefaf){return _0x5eefaf?{'count':_0x11dc0d,'rows':_0x5eefaf}:null;}})[_0xe9bd('0x2d')](respondWithResult(_0x1b7d5b,null))[_0xe9bd('0x22')](handleError(_0x1b7d5b,null));};exports[_0xe9bd('0x11f')]=function(_0x47c137,_0x4ab2e9){var _0x52dc90=_0x47c137['query'][_0xe9bd('0x120')]===_0xe9bd('0x121')?_0xe9bd('0x122'):_0xe9bd('0x123');return db['ChatWebsite']['find']({'attributes':['id',_0x52dc90],'where':{'id':_0x47c137[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x4ab2e9,null))['then'](function(_0x24d661){if(_0x24d661){var _0x565b57=_0x24d661[_0x52dc90];var _0x4b0a01=_0x565b57&&_0x565b57['items']?_0x565b57['items']:[];_0x4ab2e9[_0xe9bd('0x33')]({'fromKey':_[_0xe9bd('0x88')](_0x565b57[_0xe9bd('0x124')])?undefined:_0x565b57[_0xe9bd('0x124')],'count':_0x4b0a01[_0xe9bd('0x53')],'rows':_0x4b0a01});}})[_0xe9bd('0x22')](handleError(_0x4ab2e9,null));};exports['getOfflineMessages']=function(_0x5eb33b,_0x15e9a9){var _0x142f33={'raw':![],'where':{}};var _0x17a4c8={};var _0x457c02={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5eb33b['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x15e9a9,null))['then'](function(_0x25f0ef){if(_0x25f0ef){_0x17a4c8[_0xe9bd('0x43')]=_['keys'](db['ChatOfflineMessage'][_0xe9bd('0x4b')]);_0x17a4c8['query']=_[_0xe9bd('0x61')](_0x5eb33b[_0xe9bd('0x4e')]);_0x17a4c8[_0xe9bd('0x4f')]=_[_0xe9bd('0x50')](_0x17a4c8[_0xe9bd('0x43')],_0x17a4c8['query']);_0x142f33[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0x17a4c8[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x142f33['attributes']=_0x142f33[_0xe9bd('0x51')]['length']?_0x142f33[_0xe9bd('0x51')]:_0x17a4c8[_0xe9bd('0x43')];if(!_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x73')]('nolimit')){_0x142f33[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x2a')]);_0x142f33['offset']=qs[_0xe9bd('0x29')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}_0x142f33['order']=qs[_0xe9bd('0x55')](_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x142f33['where']=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x5eb33b[_0xe9bd('0x4e')],_0x17a4c8[_0xe9bd('0x4f')]));_0x142f33[_0xe9bd('0x56')][_0xe9bd('0x70')]=_0x25f0ef['id'];if(_0x5eb33b[_0xe9bd('0x4e')]['filter']){_0x142f33['where']=_[_0xe9bd('0x59')](_0x142f33[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x142f33['attributes'],function(_0x5c96f9){var _0x1dc840={};_0x1dc840[_0x5c96f9]={'$like':'%'+_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0x58')]+'%'};return _0x1dc840;})});}_0x142f33=_['merge']({},_0x142f33,_0x5eb33b[_0xe9bd('0x5a')]);return db[_0xe9bd('0xdd')][_0xe9bd('0x28')]({'where':_0x142f33[_0xe9bd('0x56')]})[_0xe9bd('0x2d')](function(_0x476af9){_0x457c02[_0xe9bd('0x28')]=_0x476af9;if(_0x5eb33b[_0xe9bd('0x4e')][_0xe9bd('0xfb')]){_0x142f33['include']=[{'all':!![]}];}else{_0x142f33['include']=[{'model':db[_0xe9bd('0xa6')],'as':_0xe9bd('0x125'),'required':![]},{'model':db[_0xe9bd('0xe7')],'as':_0xe9bd('0x126'),'required':![]}];}return db['ChatOfflineMessage'][_0xe9bd('0x5d')](_0x142f33);})[_0xe9bd('0x2d')](function(_0x8ec7a3){_0x457c02[_0xe9bd('0x5e')]=_0x8ec7a3;return _0x457c02;});}})[_0xe9bd('0x2d')](respondWithFilteredResult(_0x15e9a9,_0x142f33))['catch'](handleError(_0x15e9a9,null));};exports[_0xe9bd('0x127')]=function(_0x259361,_0x4212f6){return db[_0xe9bd('0x5b')]['find']({'where':{'id':_0x259361['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x4212f6,null))['then'](function(_0x3e45ba){if(_0x3e45ba){return _0x3e45ba[_0xe9bd('0x127')](_0x259361[_0xe9bd('0x64')][_0xe9bd('0x76')],_[_0xe9bd('0xfa')](_0x259361['body'],['ids','id'])||{})[_0xe9bd('0x128')](function(_0x5690ee){for(var _0x4210c7=0x0;_0x4210c7<_0x259361[_0xe9bd('0x64')]['ids']['length'];_0x4210c7+=0x1){socket[_0xe9bd('0x129')](_0xe9bd('0x12a'),{'UserId':Number(_0x259361[_0xe9bd('0x64')][_0xe9bd('0x76')][_0x4210c7]),'ChatWebsiteId':Number(_0x259361['params']['id'])});}return _0x5690ee;});}})[_0xe9bd('0x2d')](respondWithResult(_0x4212f6,null))[_0xe9bd('0x22')](handleError(_0x4212f6,null));};exports[_0xe9bd('0x12b')]=function(_0x2b7c73,_0xb75604){return db[_0xe9bd('0x5b')][_0xe9bd('0x62')]({'where':{'id':_0x2b7c73['params']['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0xb75604,null))['then'](function(_0x3ccd6f){if(_0x3ccd6f){return _0x3ccd6f[_0xe9bd('0x12b')](_0x2b7c73['query'][_0xe9bd('0x76')])[_0xe9bd('0x2d')](function(){if(_[_0xe9bd('0x12c')](_0x2b7c73[_0xe9bd('0x4e')][_0xe9bd('0x76')])){for(var _0x1ce2e7=0x0;_0x1ce2e7<_0x2b7c73['query'][_0xe9bd('0x76')][_0xe9bd('0x53')];_0x1ce2e7+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2b7c73[_0xe9bd('0x4e')]['ids'][_0x1ce2e7]),'ChatWebsiteId':Number(_0x2b7c73[_0xe9bd('0x60')]['id'])});}}else{socket[_0xe9bd('0x129')](_0xe9bd('0x12d'),{'UserId':Number(_0x2b7c73[_0xe9bd('0x4e')]['ids']),'ChatWebsiteId':Number(_0x2b7c73[_0xe9bd('0x60')]['id'])});}});}})[_0xe9bd('0x2d')](respondWithStatusCode(_0xb75604,null))[_0xe9bd('0x22')](handleError(_0xb75604,null));};exports[_0xe9bd('0x12e')]=function(_0x33c25d,_0x337721){var _0x4703c7={};var _0xc877fd={};var _0x14fcdc;var _0x3f3e29;return db[_0xe9bd('0x5b')][_0xe9bd('0x79')]({'where':{'id':_0x33c25d[_0xe9bd('0x60')]['id']}})[_0xe9bd('0x2d')](handleEntityNotFound(_0x337721,null))['then'](function(_0x3f929f){if(_0x3f929f){_0x14fcdc=_0x3f929f;_0xc877fd[_0xe9bd('0x43')]=_[_0xe9bd('0x61')](db[_0xe9bd('0xc5')][_0xe9bd('0x4b')]);_0xc877fd[_0xe9bd('0x4e')]=_['keys'](_0x33c25d[_0xe9bd('0x4e')]);_0xc877fd[_0xe9bd('0x4f')]=_['intersection'](_0xc877fd[_0xe9bd('0x43')],_0xc877fd[_0xe9bd('0x4e')]);_0x4703c7[_0xe9bd('0x51')]=_[_0xe9bd('0x50')](_0xc877fd[_0xe9bd('0x43')],qs[_0xe9bd('0x52')](_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x52')]));_0x4703c7[_0xe9bd('0x51')]=_0x4703c7[_0xe9bd('0x51')]['length']?_0x4703c7[_0xe9bd('0x51')]:_0xc877fd[_0xe9bd('0x43')];_0x4703c7[_0xe9bd('0x74')]=qs[_0xe9bd('0x55')](_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x55')]);_0x4703c7['where']=qs[_0xe9bd('0x4f')](_[_0xe9bd('0x57')](_0x33c25d[_0xe9bd('0x4e')],_0xc877fd[_0xe9bd('0x4f')]));if(_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x58')]){_0x4703c7['where']=_[_0xe9bd('0x59')](_0x4703c7[_0xe9bd('0x56')],{'$or':_[_0xe9bd('0x4a')](_0x4703c7[_0xe9bd('0x51')],function(_0x43b790){var _0x15485c={};_0x15485c[_0x43b790]={'$like':'%'+_0x33c25d[_0xe9bd('0x4e')]['filter']+'%'};return _0x15485c;})});}_0x4703c7=_[_0xe9bd('0x59')]({},_0x4703c7,_0x33c25d[_0xe9bd('0x5a')]);return _0x14fcdc['getAgents'](_0x4703c7);}})[_0xe9bd('0x2d')](function(_0x1cf9f0){if(_0x1cf9f0){_0x3f3e29=_0x1cf9f0[_0xe9bd('0x53')];if(!_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x73')](_0xe9bd('0x54'))){_0x4703c7[_0xe9bd('0x2a')]=qs[_0xe9bd('0x2a')](_0x33c25d[_0xe9bd('0x4e')]['limit']);_0x4703c7['offset']=qs['offset'](_0x33c25d[_0xe9bd('0x4e')][_0xe9bd('0x29')]);}return _0x14fcdc[_0xe9bd('0x12e')](_0x4703c7);}})['then'](function(_0x21ac1f){if(_0x21ac1f){return _0x21ac1f?{'count':_0x3f3e29,'rows':_0x21ac1f}:null;}})[_0xe9bd('0x2d')](respondWithResult(_0x337721,null))[_0xe9bd('0x22')](handleError(_0x337721,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2297396..200a8f3 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 _0xb0b9=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x4716ec,_0x34b4c9){var _0x6e31b0=function(_0x3dbf0a){while(--_0x3dbf0a){_0x4716ec['push'](_0x4716ec['shift']());}};_0x6e31b0(++_0x34b4c9);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x77d8b3,_0xbcb559){_0x77d8b3=_0x77d8b3-0x0;var _0x3306d4=_0xb0b9[_0x77d8b3];return _0x3306d4;};'use strict';var EventEmitter=require(_0x9b0b('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9b0b('0x1')](0x0);var events={'afterCreate':_0x9b0b('0x2'),'afterUpdate':_0x9b0b('0x3'),'afterDestroy':_0x9b0b('0x4')};function emitEvent(_0x1888ce){return function(_0xeb15c0,_0x311e29,_0x271b79){ChatWebsiteEvents[_0x9b0b('0x5')](_0x1888ce+':'+_0xeb15c0['id'],_0xeb15c0);ChatWebsiteEvents[_0x9b0b('0x5')](_0x1888ce,_0xeb15c0);_0x271b79(null);};}for(var e in events){if(events[_0x9b0b('0x6')](e)){var event=events[e];ChatWebsite[_0x9b0b('0x7')](e,emitEvent(event));}}module[_0x9b0b('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x2392=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x11bb60,_0x3dc734){var _0x37357e=function(_0x1b6a33){while(--_0x1b6a33){_0x11bb60['push'](_0x11bb60['shift']());}};_0x37357e(++_0x3dc734);}(_0x2392,0xd0));var _0x2239=function(_0x2308f0,_0x3e2ecc){_0x2308f0=_0x2308f0-0x0;var _0x9146b=_0x2392[_0x2308f0];return _0x9146b;};'use strict';var EventEmitter=require(_0x2239('0x0'));var ChatWebsite=require(_0x2239('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2239('0x2')](0x0);var events={'afterCreate':_0x2239('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x277193){return function(_0x420e52,_0x3f3b7c,_0x42dcec){ChatWebsiteEvents[_0x2239('0x4')](_0x277193+':'+_0x420e52['id'],_0x420e52);ChatWebsiteEvents[_0x2239('0x4')](_0x277193,_0x420e52);_0x42dcec(null);};}for(var e in events){if(events[_0x2239('0x5')](e)){var event=events[e];ChatWebsite[_0x2239('0x6')](e,emitEvent(event));}}module[_0x2239('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ae0f035..07e0fad 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 _0xb2db=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','ChatWebsite','chat_websites','lodash','util'];(function(_0x208f5e,_0x466ecf){var _0x502ccc=function(_0x3a9071){while(--_0x3a9071){_0x208f5e['push'](_0x208f5e['shift']());}};_0x502ccc(++_0x466ecf);}(_0xb2db,0x15a));var _0xbb2d=function(_0x163cce,_0x688663){_0x163cce=_0x163cce-0x0;var _0x10bd6b=_0xb2db[_0x163cce];return _0x10bd6b;};'use strict';var _=require(_0xbb2d('0x0'));var util=require(_0xbb2d('0x1'));var logger=require('../../config/logger')(_0xbb2d('0x2'));var moment=require(_0xbb2d('0x3'));var BPromise=require(_0xbb2d('0x4'));var rp=require(_0xbb2d('0x5'));var fs=require('fs');var path=require(_0xbb2d('0x6'));var rimraf=require(_0xbb2d('0x7'));var config=require(_0xbb2d('0x8'));var attributes=require(_0xbb2d('0x9'));module['exports']=function(_0x1121a7,_0x554b0a){return _0x1121a7['define'](_0xbb2d('0xa'),attributes,{'tableName':_0xbb2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7503=['define','ChatWebsite','chat_websites','../../config/logger','api','moment','rimraf','../../config/environment','exports'];(function(_0x401ade,_0x465ef6){var _0x24c85e=function(_0x43cbc7){while(--_0x43cbc7){_0x401ade['push'](_0x401ade['shift']());}};_0x24c85e(++_0x465ef6);}(_0x7503,0x1e0));var _0x3750=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x7503[_0x414f67];return _0x338537;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3750('0x0'))(_0x3750('0x1'));var moment=require(_0x3750('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3750('0x3'));var config=require(_0x3750('0x4'));var attributes=require('./chatWebsite.attributes');module[_0x3750('0x5')]=function(_0x1bf8db,_0x5ccbe9){return _0x1bf8db[_0x3750('0x6')](_0x3750('0x7'),attributes,{'tableName':_0x3750('0x8'),'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 72234a2..b82a349 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 _0xabb0=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','util','moment'];(function(_0x36ac5e,_0x5a8b5d){var _0x4fadf2=function(_0x3bcb4e){while(--_0x3bcb4e){_0x36ac5e['push'](_0x36ac5e['shift']());}};_0x4fadf2(++_0x5a8b5d);}(_0xabb0,0x116));var _0x0abb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabb0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0abb('0x0'));var moment=require(_0x0abb('0x1'));var BPromise=require(_0x0abb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0abb('0x3'));var db=require(_0x0abb('0x4'))['db'];var utils=require(_0x0abb('0x5'));var logger=require(_0x0abb('0x6'))(_0x0abb('0x7'));var config=require(_0x0abb('0x8'));var jayson=require(_0x0abb('0x9'));var client=jayson[_0x0abb('0xa')][_0x0abb('0xb')]({'port':0x232a});config[_0x0abb('0xc')]=_[_0x0abb('0xd')](config[_0x0abb('0xc')],{'host':_0x0abb('0xe'),'port':0x18eb});var socket=require(_0x0abb('0xf'))(new Redis(config['redis']));require(_0x0abb('0x10'))['register'](socket);function respondWithRpcPromise(_0x2d9923,_0x138e05,_0x4946f7){return new BPromise(function(_0x47f595,_0x26b003){return client[_0x0abb('0x11')](_0x2d9923,_0x4946f7)[_0x0abb('0x12')](function(_0x5d800f){logger[_0x0abb('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x138e05,_0x0abb('0x14'));logger[_0x0abb('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x138e05,_0x0abb('0x14'),JSON[_0x0abb('0x16')](_0x5d800f));if(_0x5d800f[_0x0abb('0x17')]){if(_0x5d800f[_0x0abb('0x17')][_0x0abb('0x18')]===0x1f4){logger[_0x0abb('0x17')](_0x0abb('0x19'),_0x138e05,_0x5d800f['error'][_0x0abb('0x1a')]);return _0x26b003(_0x5d800f[_0x0abb('0x17')]['message']);}logger['error'](_0x0abb('0x19'),_0x138e05,_0x5d800f[_0x0abb('0x17')][_0x0abb('0x1a')]);return _0x47f595(_0x5d800f[_0x0abb('0x17')][_0x0abb('0x1a')]);}else{logger[_0x0abb('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x138e05,'request\x20sent');_0x47f595(_0x5d800f[_0x0abb('0x1b')][_0x0abb('0x1a')]);}})['catch'](function(_0x5d1460){logger[_0x0abb('0x17')](_0x0abb('0x19'),_0x138e05,_0x5d1460);_0x26b003(_0x5d1460);});});} \ No newline at end of file +var _0xb49a=['../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x550b54,_0x406a8f){var _0x2e7863=function(_0x1659d8){while(--_0x1659d8){_0x550b54['push'](_0x550b54['shift']());}};_0x2e7863(++_0x406a8f);}(_0xb49a,0x9d));var _0xab49=function(_0x6d394d,_0x185b80){_0x6d394d=_0x6d394d-0x0;var _0x1f0621=_0xb49a[_0x6d394d];return _0x1f0621;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab49('0x0'));var BPromise=require(_0xab49('0x1'));var rs=require(_0xab49('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab49('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab49('0x5'));var client=jayson[_0xab49('0x6')]['http']({'port':0x232a});config[_0xab49('0x7')]=_[_0xab49('0x8')](config[_0xab49('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xab49('0x9'))(new Redis(config[_0xab49('0x7')]));require(_0xab49('0xa'))['register'](socket);function respondWithRpcPromise(_0x3a79fa,_0x394c52,_0x43117b){return new BPromise(function(_0x1a9e6d,_0xd7cc42){return client[_0xab49('0xb')](_0x3a79fa,_0x43117b)[_0xab49('0xc')](function(_0x2bbfcc){logger[_0xab49('0xd')](_0xab49('0xe'),_0x394c52,_0xab49('0xf'));logger[_0xab49('0x10')](_0xab49('0x11'),_0x394c52,'request\x20sent',JSON[_0xab49('0x12')](_0x2bbfcc));if(_0x2bbfcc[_0xab49('0x13')]){if(_0x2bbfcc[_0xab49('0x13')]['code']===0x1f4){logger[_0xab49('0x13')](_0xab49('0xe'),_0x394c52,_0x2bbfcc['error'][_0xab49('0x14')]);return _0xd7cc42(_0x2bbfcc[_0xab49('0x13')][_0xab49('0x14')]);}logger[_0xab49('0x13')](_0xab49('0xe'),_0x394c52,_0x2bbfcc[_0xab49('0x13')]['message']);return _0x1a9e6d(_0x2bbfcc[_0xab49('0x13')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x394c52,_0xab49('0xf'));_0x1a9e6d(_0x2bbfcc[_0xab49('0x15')][_0xab49('0x14')]);}})[_0xab49('0x16')](function(_0x28cd7b){logger[_0xab49('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x394c52,_0x28cd7b);_0xd7cc42(_0x28cd7b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2c6599b..a133cef 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 _0x3ddd=['removeListener','register','chatWebsite:','save','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3ddd,0x1bf));var _0xd3dd=function(_0xa5e8d7,_0x2baefd){_0xa5e8d7=_0xa5e8d7-0x0;var _0x4e6b0c=_0x3ddd[_0xa5e8d7];return _0x4e6b0c;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xd3dd('0x0'),'remove',_0xd3dd('0x1')];function createListener(_0x126f9a,_0x2bc8bf){return function(_0x1789aa){_0x2bc8bf[_0xd3dd('0x2')](_0x126f9a,_0x1789aa);};}function removeListener(_0x587612,_0xe4fabd){return function(){ChatWebsiteEvents[_0xd3dd('0x3')](_0x587612,_0xe4fabd);};}exports[_0xd3dd('0x4')]=function(_0x72f2a3){for(var _0x1e71b1=0x0,_0x57d15a=events['length'];_0x1e71b1<_0x57d15a;_0x1e71b1++){var _0x4c3aba=events[_0x1e71b1];var _0x195649=createListener(_0xd3dd('0x5')+_0x4c3aba,_0x72f2a3);ChatWebsiteEvents['on'](_0x4c3aba,_0x195649);}}; \ No newline at end of file +var _0xfbef=['length','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xfbef,0x69));var _0xffbe=function(_0x31a69c,_0xf01fa5){_0x31a69c=_0x31a69c-0x0;var _0x129a04=_0xfbef[_0x31a69c];return _0x129a04;};'use strict';var ChatWebsiteEvents=require(_0xffbe('0x0'));var events=[_0xffbe('0x1'),_0xffbe('0x2'),_0xffbe('0x3')];function createListener(_0x4e4b04,_0x5b2039){return function(_0x2d8dd7){_0x5b2039[_0xffbe('0x4')](_0x4e4b04,_0x2d8dd7);};}function removeListener(_0x4103ab,_0x27bfb4){return function(){ChatWebsiteEvents[_0xffbe('0x5')](_0x4103ab,_0x27bfb4);};}exports[_0xffbe('0x6')]=function(_0x111d7a){for(var _0x56018e=0x0,_0x1fb5de=events[_0xffbe('0x7')];_0x56018e<_0x1fb5de;_0x56018e++){var _0x468ebf=events[_0x56018e];var _0x5db5e0=createListener('chatWebsite:'+_0x468ebf,_0x111d7a);ChatWebsiteEvents['on'](_0x468ebf,_0x5db5e0);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index d7bb8ae..e4aa780 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6f9=['test','exports','../../../utils/misc','escapeRegExp','replace','localhost'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd6f9[_0x513aa5];return _0x1a1a7c;};var escapeRegExp=require(_0x9d6f('0x0'))[_0x9d6f('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0x2ddc4a){var _0x2eb1a8=!![];try{new URL(_0x2ddc4a[_0x9d6f('0x2')]('*',_0x9d6f('0x3')));}catch(_0x5d8c7f){_0x2eb1a8=![];}return _0x2eb1a8&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x9d6f('0x4')](_0x2ddc4a);}function testWebsiteWithWildcard(_0x39810d,_0x3ffd28){var _0x5ec60d;var _0x12d741=escapeRegExp(_0x39810d['trim']()['replace'](/\/$/,''))[_0x9d6f('0x2')]('\x5c*','([\x5cw]+)');try{new URL(_0x39810d[_0x9d6f('0x2')]('\x5c*',_0x9d6f('0x3')));_0x5ec60d=new RegExp(_0x12d741)[_0x9d6f('0x4')](_0x3ffd28);}catch(_0x5f7600){_0x5ec60d=![];}return _0x5ec60d;}module[_0x9d6f('0x5')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xd4a2=['../../../utils/misc','URL','localhost','test','replace','([\x5cw]+)','exports'];(function(_0x5ed5e4,_0x15d7fc){var _0xcc956a=function(_0x53130a){while(--_0x53130a){_0x5ed5e4['push'](_0x5ed5e4['shift']());}};_0xcc956a(++_0x15d7fc);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2b158b,_0x224c8d){_0x2b158b=_0x2b158b-0x0;var _0x46ba5b=_0xd4a2[_0x2b158b];return _0x46ba5b;};var escapeRegExp=require(_0x2d4a('0x0'))['escapeRegExp'];var URL=require('url')[_0x2d4a('0x1')];function testWildcardValidity(_0x576ffe){var _0x2a8a71=!![];try{new URL(_0x576ffe['replace']('*',_0x2d4a('0x2')));}catch(_0x5d435a){_0x2a8a71=![];}return _0x2a8a71&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x2d4a('0x3')](_0x576ffe);}function testWebsiteWithWildcard(_0x40d744,_0x2624b5){var _0x3a88e2;var _0x1ca10b=escapeRegExp(_0x40d744['trim']()[_0x2d4a('0x4')](/\/$/,''))[_0x2d4a('0x4')]('\x5c*',_0x2d4a('0x5'));try{new URL(_0x40d744[_0x2d4a('0x4')]('\x5c*',_0x2d4a('0x2')));_0x3a88e2=new RegExp(_0x1ca10b)[_0x2d4a('0x3')](_0x2624b5);}catch(_0xb9f016){_0x3a88e2=![];}return _0x3a88e2;}module[_0x2d4a('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7b9d38e..7dc314f 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 _0xb7d6=['get','/describe','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','format','now','file','addLogo','join','server/files/images/avatars/','%s-%s','originalname','/:id/avatar','single','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','index'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0xb7d6,0x8a));var _0x6b7d=function(_0x4d3d33,_0x450541){_0x4d3d33=_0x4d3d33-0x0;var _0x386f63=_0xb7d6[_0x4d3d33];return _0x386f63;};'use strict';var multer=require('multer');var util=require(_0x6b7d('0x0'));var path=require(_0x6b7d('0x1'));var timeout=require(_0x6b7d('0x2'));var express=require(_0x6b7d('0x3'));var router=express[_0x6b7d('0x4')]();var fs_extra=require(_0x6b7d('0x5'));var auth=require(_0x6b7d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b7d('0x7'));var controller=require(_0x6b7d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6b7d('0x9')]);router[_0x6b7d('0xa')](_0x6b7d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6b7d('0xa')]('/:id',auth[_0x6b7d('0xc')](),controller[_0x6b7d('0xd')]);router[_0x6b7d('0xa')](_0x6b7d('0xe'),auth[_0x6b7d('0xc')](),controller['getDispositions']);router[_0x6b7d('0xa')](_0x6b7d('0xf'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x10')]);router['get'](_0x6b7d('0x11'),controller[_0x6b7d('0x12')]);router['get']('/:id/avatar',controller[_0x6b7d('0x13')]);router[_0x6b7d('0xa')](_0x6b7d('0x14'),controller['getCustomerAvatar']);router[_0x6b7d('0xa')](_0x6b7d('0x15'),controller[_0x6b7d('0x16')]);router[_0x6b7d('0xa')](_0x6b7d('0x17'),auth[_0x6b7d('0xc')](),controller['getInteractions']);router[_0x6b7d('0xa')](_0x6b7d('0x18'),controller['getSnippet']);router[_0x6b7d('0xa')](_0x6b7d('0x19'),auth[_0x6b7d('0xc')](),controller['getApplications']);router[_0x6b7d('0xa')](_0x6b7d('0x1a'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x6b7d('0x1b'),controller[_0x6b7d('0x1c')]);router['get'](_0x6b7d('0x1d'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x1e')]);router[_0x6b7d('0xa')](_0x6b7d('0x1f'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x20')]);router[_0x6b7d('0x21')]('/',auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x22')]);router[_0x6b7d('0x21')](_0x6b7d('0xe'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x23')]);router[_0x6b7d('0x21')](_0x6b7d('0xf'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x24')]);var upload=multer({'storage':multer[_0x6b7d('0x25')]({'destination':function(_0x59fac2,_0x15c1d1,_0x239ca8){_0x239ca8(null,path['join'](config[_0x6b7d('0x26')],'server/files/images/logos/'));},'filename':function(_0x4a4d0b,_0xbe47e9,_0x31001d){_0x31001d(null,util[_0x6b7d('0x27')]('%s-%s',Date[_0x6b7d('0x28')](),_0xbe47e9['originalname']));}})});router[_0x6b7d('0x21')]('/:id/logo',upload['single'](_0x6b7d('0x29')),controller[_0x6b7d('0x2a')]);var upload=multer({'storage':multer[_0x6b7d('0x25')]({'destination':function(_0x20db57,_0x3850d6,_0x1e613d){_0x1e613d(null,path[_0x6b7d('0x2b')](config[_0x6b7d('0x26')],_0x6b7d('0x2c')));},'filename':function(_0x141566,_0x5a997f,_0x5a3002){_0x5a3002(null,util[_0x6b7d('0x27')](_0x6b7d('0x2d'),Date[_0x6b7d('0x28')](),_0x5a997f[_0x6b7d('0x2e')]));}})});router[_0x6b7d('0x21')](_0x6b7d('0x2f'),upload[_0x6b7d('0x30')](_0x6b7d('0x29')),controller[_0x6b7d('0x31')]);var upload=multer({'storage':multer[_0x6b7d('0x25')]({'destination':function(_0x577f62,_0x273417,_0x2964df){_0x2964df(null,path[_0x6b7d('0x2b')](config[_0x6b7d('0x26')],'server/files/images/avatars/'));},'filename':function(_0xceb7fa,_0xace21e,_0x167756){_0x167756(null,util[_0x6b7d('0x27')](_0x6b7d('0x2d'),Date[_0x6b7d('0x28')](),_0xace21e[_0x6b7d('0x2e')]));}})});router[_0x6b7d('0x21')](_0x6b7d('0x14'),upload['single'](_0x6b7d('0x29')),controller[_0x6b7d('0x32')]);var upload=multer({'storage':multer[_0x6b7d('0x25')]({'destination':function(_0x38f6e3,_0x36f025,_0x145be3){_0x145be3(null,path[_0x6b7d('0x2b')](config[_0x6b7d('0x26')],'server/files/images/avatars/'));},'filename':function(_0x1f2119,_0x36c475,_0x586ad4){_0x586ad4(null,util['format'](_0x6b7d('0x2d'),Date[_0x6b7d('0x28')](),_0x36c475[_0x6b7d('0x2e')]));}})});router[_0x6b7d('0x21')](_0x6b7d('0x15'),upload[_0x6b7d('0x30')](_0x6b7d('0x29')),controller['addSystemAvatar']);router[_0x6b7d('0x21')](_0x6b7d('0x33'),controller[_0x6b7d('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x945392,_0x4acea9,_0x1a3166){const _0x1731b7=path[_0x6b7d('0x2b')](config['root'],_0x6b7d('0x35'),_0x6b7d('0x36'),_0x6b7d('0x37'));fs_extra[_0x6b7d('0x38')](_0x1731b7,function(){_0x1a3166(null,_0x1731b7);});},'filename':function(_0x1005da,_0x5d8c55,_0xe1f7b8){const _0x477cf2=_0x5d8c55[_0x6b7d('0x2e')][_0x6b7d('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x354b6e=path[_0x6b7d('0x3a')](_0x477cf2);const _0x576464=Date[_0x6b7d('0x28')]()+'-'+_0x477cf2[_0x6b7d('0x39')](_0x354b6e,'')+_0x354b6e;_0xe1f7b8(null,_0x576464);}})});router[_0x6b7d('0x21')](_0x6b7d('0x3b'),offlineUploadMulter[_0x6b7d('0x3c')](),controller[_0x6b7d('0x3d')]);router['post']('/:id/interactions',auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x3e')]);router[_0x6b7d('0x21')](_0x6b7d('0x19'),auth['isAuthenticated'](),controller[_0x6b7d('0x3f')]);router[_0x6b7d('0x21')](_0x6b7d('0x1a'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x40')]);router['post'](_0x6b7d('0x1f'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x41')]);router[_0x6b7d('0x42')](_0x6b7d('0x43'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x44')]);router['delete']('/:id',auth[_0x6b7d('0xc')](),controller['destroy']);router[_0x6b7d('0x45')](_0x6b7d('0xe'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x46')]);router[_0x6b7d('0x45')](_0x6b7d('0xf'),auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x47')]);router['delete']('/:id/users',auth[_0x6b7d('0xc')](),controller[_0x6b7d('0x48')]);module[_0x6b7d('0x49')]=router; \ No newline at end of file +var _0xcef5=['root','server/files/images/logos/','format','%s-%s','originalname','single','addLogo','server/files/images/avatars/','now','/:id/avatar','file','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','addInteraction','addApplications','/:id/users','addAgents','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','getAgents','post','create','addDisposition','addAnswer','diskStorage','join'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcef5,0xec));var _0x5cef=function(_0x5115ad,_0x3e199d){_0x5115ad=_0x5115ad-0x0;var _0xa47006=_0xcef5[_0x5115ad];return _0xa47006;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5cef('0x0'));var express=require(_0x5cef('0x1'));var router=express[_0x5cef('0x2')]();var fs_extra=require(_0x5cef('0x3'));var auth=require(_0x5cef('0x4'));var interaction=require(_0x5cef('0x5'));var config=require(_0x5cef('0x6'));var controller=require(_0x5cef('0x7'));router[_0x5cef('0x8')]('/',auth[_0x5cef('0x9')](),controller[_0x5cef('0xa')]);router[_0x5cef('0x8')](_0x5cef('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x5cef('0x9')](),controller[_0x5cef('0xc')]);router[_0x5cef('0x8')](_0x5cef('0xd'),auth[_0x5cef('0x9')](),controller[_0x5cef('0xe')]);router['get'](_0x5cef('0xf'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x10')]);router[_0x5cef('0x8')](_0x5cef('0x11'),controller[_0x5cef('0x12')]);router[_0x5cef('0x8')]('/:id/avatar',controller[_0x5cef('0x13')]);router['get'](_0x5cef('0x14'),controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0x5cef('0x15')]);router[_0x5cef('0x8')](_0x5cef('0x16'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x17')]);router['get']('/:id/snippet',controller[_0x5cef('0x18')]);router[_0x5cef('0x8')](_0x5cef('0x19'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5cef('0x8')](_0x5cef('0x1a'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x1b')]);router['get']('/:id/fields',controller[_0x5cef('0x1c')]);router[_0x5cef('0x8')]('/:id/offline_messages',auth[_0x5cef('0x9')](),controller['getOfflineMessages']);router[_0x5cef('0x8')]('/:id/users',auth[_0x5cef('0x9')](),controller[_0x5cef('0x1d')]);router[_0x5cef('0x1e')]('/',auth[_0x5cef('0x9')](),controller[_0x5cef('0x1f')]);router[_0x5cef('0x1e')](_0x5cef('0xd'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x20')]);router['post'](_0x5cef('0xf'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x21')]);var upload=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x11fe3f,_0x34e478,_0x9413a0){_0x9413a0(null,path[_0x5cef('0x23')](config[_0x5cef('0x24')],_0x5cef('0x25')));},'filename':function(_0x513dd5,_0x1cee41,_0x3511dd){_0x3511dd(null,util[_0x5cef('0x26')](_0x5cef('0x27'),Date['now'](),_0x1cee41[_0x5cef('0x28')]));}})});router['post']('/:id/logo',upload[_0x5cef('0x29')]('file'),controller[_0x5cef('0x2a')]);var upload=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x273fc7,_0x3384ea,_0x32b6a8){_0x32b6a8(null,path[_0x5cef('0x23')](config[_0x5cef('0x24')],_0x5cef('0x2b')));},'filename':function(_0x51f3a4,_0x3eae48,_0x3f8166){_0x3f8166(null,util[_0x5cef('0x26')]('%s-%s',Date[_0x5cef('0x2c')](),_0x3eae48[_0x5cef('0x28')]));}})});router[_0x5cef('0x1e')](_0x5cef('0x2d'),upload[_0x5cef('0x29')](_0x5cef('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x504378,_0x4a5c6f,_0x1cdcb0){_0x1cdcb0(null,path['join'](config[_0x5cef('0x24')],_0x5cef('0x2b')));},'filename':function(_0xb7bcdf,_0x59fb69,_0x29088c){_0x29088c(null,util[_0x5cef('0x26')]('%s-%s',Date['now'](),_0x59fb69[_0x5cef('0x28')]));}})});router[_0x5cef('0x1e')]('/:id/customer_avatar',upload['single'](_0x5cef('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x333bcf,_0x484ac3,_0x53b6ab){_0x53b6ab(null,path['join'](config[_0x5cef('0x24')],_0x5cef('0x2b')));},'filename':function(_0x57af9d,_0x41154e,_0x4d09ca){_0x4d09ca(null,util[_0x5cef('0x26')](_0x5cef('0x27'),Date[_0x5cef('0x2c')](),_0x41154e[_0x5cef('0x28')]));}})});router[_0x5cef('0x1e')](_0x5cef('0x2f'),upload[_0x5cef('0x29')](_0x5cef('0x2e')),controller[_0x5cef('0x30')]);router['post'](_0x5cef('0x31'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x5cef('0x22')]({'destination':function(_0x3b20ba,_0x5f0e6f,_0x1c5b65){const _0x57f868=path[_0x5cef('0x23')](config['root'],_0x5cef('0x32'),_0x5cef('0x33'),_0x5cef('0x34'));fs_extra[_0x5cef('0x35')](_0x57f868,function(){_0x1c5b65(null,_0x57f868);});},'filename':function(_0x182f61,_0x25c8df,_0x59fbc4){const _0x2a1b9a=_0x25c8df['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xd8ae88=path[_0x5cef('0x36')](_0x2a1b9a);const _0x3f990f=Date[_0x5cef('0x2c')]()+'-'+_0x2a1b9a[_0x5cef('0x37')](_0xd8ae88,'')+_0xd8ae88;_0x59fbc4(null,_0x3f990f);}})});router['post'](_0x5cef('0x38'),offlineUploadMulter[_0x5cef('0x39')](),controller['offline']);router[_0x5cef('0x1e')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x5cef('0x3a')]);router[_0x5cef('0x1e')](_0x5cef('0x19'),auth['isAuthenticated'](),controller[_0x5cef('0x3b')]);router[_0x5cef('0x1e')](_0x5cef('0x1a'),auth[_0x5cef('0x9')](),controller['addProactiveActions']);router['post'](_0x5cef('0x3c'),auth['isAuthenticated'](),controller[_0x5cef('0x3d')]);router[_0x5cef('0x3e')](_0x5cef('0x3f'),auth['isAuthenticated'](),controller[_0x5cef('0x40')]);router[_0x5cef('0x41')](_0x5cef('0x3f'),auth[_0x5cef('0x9')](),controller[_0x5cef('0x42')]);router[_0x5cef('0x41')](_0x5cef('0xd'),auth[_0x5cef('0x9')](),controller['removeDispositions']);router[_0x5cef('0x41')](_0x5cef('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x5cef('0x3c'),auth[_0x5cef('0x9')](),controller['removeAgents']);module[_0x5cef('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 9685c37..823b697 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1653=['use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','production','app','client-side-logger','expressEndpoint','/client-logs'];(function(_0x38e0c4,_0xe994c3){var _0x536e88=function(_0x150aee){while(--_0x150aee){_0x38e0c4['push'](_0x38e0c4['shift']());}};_0x536e88(++_0xe994c3);}(_0x1653,0x1cb));var _0x3165=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x1653[_0x2e58c7];return _0x26eb00;};var beaverLogger=require(_0x3165('0x0'));var express=require(_0x3165('0x1'));var auth=require(_0x3165('0x2'));var config=require('../config/environment');var router=express[_0x3165('0x3')]();var isProduction=config['env']===_0x3165('0x4')||![];function clientSideLogs(_0x5ba265,_0x1b4cc1,_0x21fba7){var _0x109cbe=_0x5ba265[_0x3165('0x5')]['get'](_0x3165('0x6'));if(!_0x109cbe){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x3165('0x7')]({'uri':_0x3165('0x8'),'logger':_0x109cbe,'enableCors':!isProduction})(_0x5ba265,_0x1b4cc1,_0x21fba7);}router[_0x3165('0x9')](auth[_0x3165('0xa')](),clientSideLogs);module[_0x3165('0xb')]=router; \ No newline at end of file +var _0x2940=['beaver-logger/server','express','../components/auth/service','../config/environment','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x2940,0xb4));var _0x0294=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x2940[_0x1fafa5];return _0xcf08c9;};var beaverLogger=require(_0x0294('0x0'));var express=require(_0x0294('0x1'));var auth=require(_0x0294('0x2'));var config=require(_0x0294('0x3'));var router=express['Router']();var isProduction=config['env']===_0x0294('0x4')||![];function clientSideLogs(_0x12caab,_0x174db1,_0x18798c){var _0x4002db=_0x12caab['app'][_0x0294('0x5')](_0x0294('0x6'));if(!_0x4002db){throw new Error(_0x0294('0x7'));}return beaverLogger[_0x0294('0x8')]({'uri':_0x0294('0x9'),'logger':_0x4002db,'enableCors':!isProduction})(_0x12caab,_0x174db1,_0x18798c);}router['use'](auth[_0x0294('0xa')](),clientSideLogs);module[_0x0294('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index eb6febd..f449af6 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 _0xbd61=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x54c080,_0x38a0c8){var _0x504070=function(_0x237922){while(--_0x237922){_0x54c080['push'](_0x54c080['shift']());}};_0x504070(++_0x38a0c8);}(_0xbd61,0xfc));var _0x1bd6=function(_0x34b1e4,_0x55c6f6){_0x34b1e4=_0x34b1e4-0x0;var _0x20da42=_0xbd61[_0x34b1e4];return _0x20da42;};'use strict';var Sequelize=require(_0x1bd6('0x0'));module[_0x1bd6('0x1')]={'name':{'type':Sequelize[_0x1bd6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x1bd6('0x3'),_0x1bd6('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1bd6('0x5'),_0x1bd6('0x6'))},'data1':{'type':Sequelize[_0x1bd6('0x2')],'comment':_0x1bd6('0x7')},'data2':{'type':Sequelize[_0x1bd6('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x1bd6('0x2')],'comment':_0x1bd6('0x8')},'data4':{'type':Sequelize[_0x1bd6('0x2')],'comment':_0x1bd6('0x9')},'data5':{'type':Sequelize[_0x1bd6('0xa')],'comment':_0x1bd6('0xb')},'data6':{'type':Sequelize[_0x1bd6('0xa')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x1bd6('0xa')],'comment':_0x1bd6('0xc')}}; \ No newline at end of file +var _0xfbad=['ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x3d3ae9,_0x334c52){var _0x31b364=function(_0x6aa61c){while(--_0x6aa61c){_0x3d3ae9['push'](_0x3d3ae9['shift']());}};_0x31b364(++_0x334c52);}(_0xfbad,0x129));var _0xdfba=function(_0xc86286,_0x47ec96){_0xc86286=_0xc86286-0x0;var _0x5df59d=_0xfbad[_0xc86286];return _0x5df59d;};'use strict';var Sequelize=require(_0xdfba('0x0'));module[_0xdfba('0x1')]={'name':{'type':Sequelize[_0xdfba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdfba('0x3')](_0xdfba('0x4'),_0xdfba('0x5'),_0xdfba('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdfba('0x3')](_0xdfba('0x7'),_0xdfba('0x8'))},'data1':{'type':Sequelize[_0xdfba('0x2')],'comment':_0xdfba('0x9')},'data2':{'type':Sequelize[_0xdfba('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xdfba('0x2')],'comment':_0xdfba('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0xdfba('0xb')},'data5':{'type':Sequelize[_0xdfba('0xc')],'comment':_0xdfba('0xd')},'data6':{'type':Sequelize[_0xdfba('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xdfba('0xc')],'comment':_0xdfba('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a900d92..2f366d5 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 _0x991f=['CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','MicrosoftAzure','decryptString','data3','show','keys','includeAll','service','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','params','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','error','get','parse','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','set','update','then','stack','name','padEnd','index','map'];(function(_0x239065,_0x5bde46){var _0x4cda34=function(_0x3f0e4e){while(--_0x3f0e4e){_0x239065['push'](_0x239065['shift']());}};_0x4cda34(++_0x5bde46);}(_0x991f,0x15c));var _0xf991=function(_0x5d7beb,_0x12270){_0x5d7beb=_0x5d7beb-0x0;var _0xe2a97a=_0x991f[_0x5d7beb];return _0xe2a97a;};'use strict';var _=require(_0xf991('0x0'));var Redis=require(_0xf991('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xf991('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var db=require(_0xf991('0x3'))['db'];var oauth=require(_0xf991('0x4'));config[_0xf991('0x5')]=_[_0xf991('0x6')](config['redis'],{'host':_0xf991('0x7'),'port':0x18eb});var socket=require(_0xf991('0x8'))(new Redis(config[_0xf991('0x5')]));var redis=new Redis(config[_0xf991('0x5')]);function respondWithStatusCode(_0x3dd9ea,_0x58529f){_0x58529f=_0x58529f||0xcc;return function(_0x56df8f){if(_0x56df8f){return _0x3dd9ea[_0xf991('0x9')](_0x58529f);}return _0x3dd9ea[_0xf991('0xa')](_0x58529f)[_0xf991('0xb')]();};}function respondWithResult(_0x471a56,_0x1f330e){_0x1f330e=_0x1f330e||0xc8;return function(_0x49d4bf){if(_0x49d4bf){return _0x471a56[_0xf991('0xa')](_0x1f330e)[_0xf991('0xc')](_0x49d4bf);}};}function respondWithFilteredResult(_0x339e19,_0x443bf0){return function(_0x58ac17){if(_0x58ac17){var _0xdffa06=typeof _0x443bf0[_0xf991('0xd')]==='undefined'&&typeof _0x443bf0[_0xf991('0xe')]===_0xf991('0xf');var _0x3c9653=_0x58ac17['count'];var _0x154003=_0xdffa06?0x0:_0x443bf0['offset'];var _0x633cb5=_0xdffa06?_0x58ac17['count']:_0x443bf0[_0xf991('0xd')]+_0x443bf0[_0xf991('0xe')];var _0x3aa7ba;if(_0x633cb5>=_0x3c9653){_0x633cb5=_0x3c9653;_0x3aa7ba=0xc8;}else{_0x3aa7ba=0xce;}_0x339e19[_0xf991('0xa')](_0x3aa7ba);return _0x339e19[_0xf991('0x10')]('Content-Range',_0x154003+'-'+_0x633cb5+'/'+_0x3c9653)[_0xf991('0xc')](_0x58ac17);}return null;};}function saveUpdates(_0x2db03d){return function(_0x36ddb4){if(_0x36ddb4){return _0x36ddb4[_0xf991('0x11')](_0x2db03d)['then'](function(_0x4042d6){return _0x4042d6;});}return null;};}function removeEntity(_0x3b4a15){return function(_0x4d7cc9){if(_0x4d7cc9){return _0x4d7cc9['destroy']()[_0xf991('0x12')](function(){_0x3b4a15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db9f6){return function(_0x382a7b){if(!_0x382a7b){_0x2db9f6['sendStatus'](0x194);}return _0x382a7b;};}function handleError(_0x29eac3,_0x3c5e60){_0x3c5e60=_0x3c5e60||0x1f4;return function(_0x3e7472){logger['error'](_0x3e7472[_0xf991('0x13')]);if(_0x3e7472[_0xf991('0x14')]){delete _0x3e7472[_0xf991('0x14')];}_0x29eac3['status'](_0x3c5e60)['send'](_0x3e7472);};}function maskClientSecret(_0x12e785){return _[_0xf991('0x15')](_0x12e785['slice'](0x0,0x3),0x14,'*');}exports[_0xf991('0x16')]=function(_0x208d7b,_0x4c0edf){var _0x46ba23={},_0x358bc5={},_0x35b24d={'count':0x0,'rows':[]};var _0x491f61=_[_0xf991('0x17')](db[_0xf991('0x18')][_0xf991('0x19')],function(_0x84c901){return{'name':_0x84c901[_0xf991('0x1a')],'type':_0x84c901[_0xf991('0x1b')][_0xf991('0x1c')]};});_0x358bc5[_0xf991('0x1d')]=_[_0xf991('0x17')](_0x491f61,_0xf991('0x14'));_0x358bc5[_0xf991('0x1e')]=_['keys'](_0x208d7b[_0xf991('0x1e')]);_0x358bc5[_0xf991('0x1f')]=_[_0xf991('0x20')](_0x358bc5[_0xf991('0x1d')],_0x358bc5['query']);_0x46ba23[_0xf991('0x21')]=_[_0xf991('0x20')](_0x358bc5[_0xf991('0x1d')],qs[_0xf991('0x22')](_0x208d7b[_0xf991('0x1e')][_0xf991('0x22')]));_0x46ba23['attributes']=_0x46ba23['attributes'][_0xf991('0x23')]?_0x46ba23[_0xf991('0x21')]:_0x358bc5[_0xf991('0x1d')];if(!_0x208d7b[_0xf991('0x1e')][_0xf991('0x24')]('nolimit')){_0x46ba23[_0xf991('0xe')]=qs[_0xf991('0xe')](_0x208d7b['query'][_0xf991('0xe')]);_0x46ba23[_0xf991('0xd')]=qs['offset'](_0x208d7b[_0xf991('0x1e')][_0xf991('0xd')]);}_0x46ba23[_0xf991('0x25')]=qs['sort'](_0x208d7b[_0xf991('0x1e')][_0xf991('0x26')]);_0x46ba23[_0xf991('0x27')]=qs[_0xf991('0x1f')](_[_0xf991('0x28')](_0x208d7b[_0xf991('0x1e')],_0x358bc5[_0xf991('0x1f')]),_0x491f61);if(_0x208d7b['query'][_0xf991('0x29')]){_0x46ba23[_0xf991('0x27')]=_[_0xf991('0x2a')](_0x46ba23['where'],{'$or':_[_0xf991('0x17')](_0x491f61,function(_0x1c7fa8){if(_0x1c7fa8[_0xf991('0x1b')]!==_0xf991('0x2b')){var _0x324fa9={};_0x324fa9[_0x1c7fa8[_0xf991('0x14')]]={'$like':'%'+_0x208d7b[_0xf991('0x1e')][_0xf991('0x29')]+'%'};return _0x324fa9;}})});}_0x46ba23=_[_0xf991('0x2a')]({},_0x46ba23,_0x208d7b[_0xf991('0x2c')]);var _0xfde4d0={'where':_0x46ba23[_0xf991('0x27')]};return db[_0xf991('0x18')]['count'](_0xfde4d0)['then'](function(_0x268c90){_0x35b24d[_0xf991('0x2d')]=_0x268c90;if(_0x208d7b[_0xf991('0x1e')]['includeAll']){_0x46ba23[_0xf991('0x2e')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x46ba23);})[_0xf991('0x12')](function(_0xd5224e){_0x35b24d[_0xf991('0x2f')]=_[_0xf991('0x17')](_0xd5224e,function(_0x3f92fe){if(_0x3f92fe['service']===_0xf991('0x30')){var _0x1c9d24=encryptor[_0xf991('0x31')](_0x3f92fe[_0xf991('0x32')]);_0x3f92fe[_0xf991('0x32')]=maskClientSecret(_0x1c9d24);}return _0x3f92fe;});return _0x35b24d;})[_0xf991('0x12')](respondWithFilteredResult(_0x4c0edf,_0x46ba23))['catch'](handleError(_0x4c0edf,null));};exports[_0xf991('0x33')]=function(_0x1d2223,_0x3aa36f){var _0x1fe5cb={'raw':!![],'where':{'id':_0x1d2223['params']['id']}},_0x169737={};_0x169737[_0xf991('0x1d')]=_[_0xf991('0x34')](db[_0xf991('0x18')]['rawAttributes']);_0x169737['query']=_[_0xf991('0x34')](_0x1d2223[_0xf991('0x1e')]);_0x169737[_0xf991('0x1f')]=_[_0xf991('0x20')](_0x169737[_0xf991('0x1d')],_0x169737[_0xf991('0x1e')]);_0x1fe5cb['attributes']=_['intersection'](_0x169737['model'],qs[_0xf991('0x22')](_0x1d2223[_0xf991('0x1e')][_0xf991('0x22')]));_0x1fe5cb['attributes']=_0x1fe5cb[_0xf991('0x21')][_0xf991('0x23')]?_0x1fe5cb[_0xf991('0x21')]:_0x169737[_0xf991('0x1d')];if(_0x1d2223[_0xf991('0x1e')][_0xf991('0x35')]){_0x1fe5cb[_0xf991('0x2e')]=[{'all':!![]}];}_0x1fe5cb=_[_0xf991('0x2a')]({},_0x1fe5cb,_0x1d2223[_0xf991('0x2c')]);return db[_0xf991('0x18')]['find'](_0x1fe5cb)[_0xf991('0x12')](handleEntityNotFound(_0x3aa36f,null))[_0xf991('0x12')](function(_0x22aa89){if(_0x22aa89[_0xf991('0x36')]===_0xf991('0x30')){var _0x4c1007=encryptor['decryptString'](_0x22aa89['data3']);_0x22aa89['data3']=maskClientSecret(_0x4c1007);}return _0x22aa89;})[_0xf991('0x12')](respondWithResult(_0x3aa36f,null))[_0xf991('0x37')](handleError(_0x3aa36f,null));};exports[_0xf991('0x38')]=function(_0x407c0a,_0x3c9bc1){if(!_0x407c0a[_0xf991('0x39')][_0xf991('0x14')])throw new Error(_0xf991('0x3a'));if(!_0x407c0a[_0xf991('0x39')][_0xf991('0x36')])throw new Error(_0xf991('0x3b'));var _0x544ed7=db[_0xf991('0x18')][_0xf991('0x19')]['service'][_0xf991('0x3c')];if(!_0x544ed7[_0xf991('0x3d')](_0x407c0a[_0xf991('0x39')][_0xf991('0x36')]))throw new Error(_0xf991('0x3e')+_0x544ed7[_0xf991('0x3f')](',\x20'));if(_0x407c0a['body'][_0xf991('0x36')]===_0xf991('0x30')&&_0x407c0a[_0xf991('0x39')]['data3']){_0x407c0a[_0xf991('0x39')]['data3']=encryptor[_0xf991('0x40')](_0x407c0a['body'][_0xf991('0x32')]);}return db[_0xf991('0x18')][_0xf991('0x38')](_0x407c0a[_0xf991('0x39')],{})[_0xf991('0x12')](respondWithResult(_0x3c9bc1,0xc9))[_0xf991('0x37')](handleError(_0x3c9bc1,null));};exports[_0xf991('0x11')]=function(_0x1d48ef,_0x2a3ddd){if(_0x1d48ef['body']['id']){delete _0x1d48ef[_0xf991('0x39')]['id'];}return db[_0xf991('0x18')][_0xf991('0x41')]({'where':{'id':_0x1d48ef[_0xf991('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a3ddd,null))[_0xf991('0x12')](function(_0x1f809e){if(_0x1f809e['service']===_0xf991('0x30')&&_0x1d48ef[_0xf991('0x39')]['data3']){_0x1d48ef[_0xf991('0x39')]['data3']=encryptor[_0xf991('0x40')](_0x1d48ef['body'][_0xf991('0x32')]);}return _0x1f809e;})[_0xf991('0x12')](saveUpdates(_0x1d48ef[_0xf991('0x39')],null))[_0xf991('0x12')](respondWithResult(_0x2a3ddd,null))[_0xf991('0x37')](handleError(_0x2a3ddd,null));};exports['destroy']=function(_0x3777e3,_0x3fa686){return db[_0xf991('0x18')][_0xf991('0x41')]({'where':{'id':_0x3777e3[_0xf991('0x42')]['id']}})[_0xf991('0x12')](handleEntityNotFound(_0x3fa686,null))['then'](removeEntity(_0x3fa686,null))['catch'](handleError(_0x3fa686,null));};exports[_0xf991('0x43')]=function(_0x404c53,_0x5937da){return db['CloudProvider']['findOne']({'where':{'id':_0x404c53[_0xf991('0x42')]['id']},'raw':!![]})[_0xf991('0x12')](function(_0x392bf7){if(!_0x392bf7)return _0x5937da['sendStatus'](0x194);return{'url':oauth[_0xf991('0x44')](_0x392bf7,_0x404c53[_0xf991('0x45')]['id'])};})[_0xf991('0x12')](respondWithResult(_0x5937da,null))[_0xf991('0x37')](handleError(_0x5937da,null));};exports['oauth2MicrosoftCallback']=function(_0x37af08,_0x1430f2){var _0x3e0d54=_0x37af08[_0xf991('0x39')];var _0x17fafd;var _0x456210;if(_0x3e0d54[_0xf991('0x46')])throw _0x3e0d54;redis[_0xf991('0x47')](_0x3e0d54['state'])[_0xf991('0x12')](function(_0x2c5d64){if(!_0x2c5d64)throw new Error('Invalid\x20state\x20parameter');_0x17fafd=JSON[_0xf991('0x48')](_0x2c5d64);var _0x2d7e57=Buffer['from'](_0x3e0d54['state'],_0xf991('0x49'))['toString']('ascii');_0x456210=JSON[_0xf991('0x48')](_0x2d7e57);if(!oauth[_0xf991('0x4a')](_0x3e0d54[_0xf991('0x4b')],_0x17fafd[_0xf991('0x4c')]))throw new Error(_0xf991('0x4d'));redis[_0xf991('0x4e')](_0x3e0d54[_0xf991('0x4f')]);return oauth[_0xf991('0x50')](_0x3e0d54[_0xf991('0x51')],_0x17fafd);})[_0xf991('0x12')](function(_0x726b33){_0x17fafd[_0xf991('0x52')]=_0x726b33['access_token'];_0x17fafd[_0xf991('0x53')]=_0x726b33[_0xf991('0x54')];return db[_0xf991('0x18')][_0xf991('0x11')]({'data5':_0x17fafd[_0xf991('0x52')],'data6':_0x17fafd[_0xf991('0x53')]},{'where':{'id':_0x17fafd['id']}});})[_0xf991('0x12')](function(){oauth[_0xf991('0x55')](_0x17fafd);socket[_0xf991('0x56')](_0xf991('0x57'),{'id':_0x456210['id']});return;})[_0xf991('0x12')](respondWithStatusCode(_0x1430f2,null))['catch'](function(_0x6fda83){if(_0x456210){socket[_0xf991('0x56')]('microsoftAuthorization:error',{'id':_0x456210['id']});}if(!_0x17fafd){logger['error'](_0xf991('0x58'),_0x6fda83);return _0x1430f2[_0xf991('0xa')](0x1f4)[_0xf991('0x59')](_0x6fda83[_0xf991('0x5a')]);}logger['error'](_0xf991('0x5b'),_0x17fafd['id'],JSON[_0xf991('0x5c')](_0x6fda83));});}; \ No newline at end of file +var _0xe236=['show','params','includeAll','include','find','body','Name\x20parameter\x20not\x20specified','values','includes','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','stack','name','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','merge','options','service','MicrosoftAzure','decryptString','data3','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe236,0x136));var _0x6e23=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0xe236[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require('lodash');var Redis=require(_0x6e23('0x0'));var qs=require(_0x6e23('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x6e23('0x2'))(_0x6e23('0x3'));var db=require(_0x6e23('0x4'))['db'];var oauth=require(_0x6e23('0x5'));config[_0x6e23('0x6')]=_[_0x6e23('0x7')](config[_0x6e23('0x6')],{'host':_0x6e23('0x8'),'port':0x18eb});var socket=require(_0x6e23('0x9'))(new Redis(config[_0x6e23('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5d44f3,_0x3b5538){_0x3b5538=_0x3b5538||0xcc;return function(_0x1c42cc){if(_0x1c42cc){return _0x5d44f3[_0x6e23('0xa')](_0x3b5538);}return _0x5d44f3[_0x6e23('0xb')](_0x3b5538)['end']();};}function respondWithResult(_0xbfe41e,_0x5d6547){_0x5d6547=_0x5d6547||0xc8;return function(_0x51bd18){if(_0x51bd18){return _0xbfe41e[_0x6e23('0xb')](_0x5d6547)['json'](_0x51bd18);}};}function respondWithFilteredResult(_0x9910ea,_0x2adfd6){return function(_0x4eb056){if(_0x4eb056){var _0x3eb104=typeof _0x2adfd6[_0x6e23('0xc')]===_0x6e23('0xd')&&typeof _0x2adfd6['limit']==='undefined';var _0x12e000=_0x4eb056[_0x6e23('0xe')];var _0x576aa3=_0x3eb104?0x0:_0x2adfd6['offset'];var _0x851b76=_0x3eb104?_0x4eb056[_0x6e23('0xe')]:_0x2adfd6['offset']+_0x2adfd6[_0x6e23('0xf')];var _0x3aa387;if(_0x851b76>=_0x12e000){_0x851b76=_0x12e000;_0x3aa387=0xc8;}else{_0x3aa387=0xce;}_0x9910ea[_0x6e23('0xb')](_0x3aa387);return _0x9910ea[_0x6e23('0x10')](_0x6e23('0x11'),_0x576aa3+'-'+_0x851b76+'/'+_0x12e000)[_0x6e23('0x12')](_0x4eb056);}return null;};}function saveUpdates(_0x5691c0){return function(_0x4f0666){if(_0x4f0666){return _0x4f0666[_0x6e23('0x13')](_0x5691c0)[_0x6e23('0x14')](function(_0x2ebaaf){return _0x2ebaaf;});}return null;};}function removeEntity(_0x43807c){return function(_0xe6dace){if(_0xe6dace){return _0xe6dace[_0x6e23('0x15')]()[_0x6e23('0x14')](function(){_0x43807c[_0x6e23('0xb')](0xcc)[_0x6e23('0x16')]();});}};}function handleEntityNotFound(_0x3db11b){return function(_0x4a6300){if(!_0x4a6300){_0x3db11b['sendStatus'](0x194);}return _0x4a6300;};}function handleError(_0x500e3b,_0x1df26d){_0x1df26d=_0x1df26d||0x1f4;return function(_0x38ac20){logger['error'](_0x38ac20[_0x6e23('0x17')]);if(_0x38ac20['name']){delete _0x38ac20[_0x6e23('0x18')];}_0x500e3b[_0x6e23('0xb')](_0x1df26d)['send'](_0x38ac20);};}function maskClientSecret(_0x5f31a9){return _['padEnd'](_0x5f31a9[_0x6e23('0x19')](0x0,0x3),0x14,'*');}exports[_0x6e23('0x1a')]=function(_0x520dce,_0xb8f65f){var _0x1e9f4c={},_0x51667c={},_0x5b4fc9={'count':0x0,'rows':[]};var _0x32b003=_['map'](db[_0x6e23('0x1b')][_0x6e23('0x1c')],function(_0xb0f322){return{'name':_0xb0f322[_0x6e23('0x1d')],'type':_0xb0f322[_0x6e23('0x1e')][_0x6e23('0x1f')]};});_0x51667c[_0x6e23('0x20')]=_['map'](_0x32b003,_0x6e23('0x18'));_0x51667c[_0x6e23('0x21')]=_[_0x6e23('0x22')](_0x520dce['query']);_0x51667c[_0x6e23('0x23')]=_[_0x6e23('0x24')](_0x51667c[_0x6e23('0x20')],_0x51667c['query']);_0x1e9f4c[_0x6e23('0x25')]=_[_0x6e23('0x24')](_0x51667c[_0x6e23('0x20')],qs['fields'](_0x520dce[_0x6e23('0x21')][_0x6e23('0x26')]));_0x1e9f4c['attributes']=_0x1e9f4c[_0x6e23('0x25')][_0x6e23('0x27')]?_0x1e9f4c[_0x6e23('0x25')]:_0x51667c[_0x6e23('0x20')];if(!_0x520dce[_0x6e23('0x21')][_0x6e23('0x28')](_0x6e23('0x29'))){_0x1e9f4c[_0x6e23('0xf')]=qs[_0x6e23('0xf')](_0x520dce['query'][_0x6e23('0xf')]);_0x1e9f4c['offset']=qs[_0x6e23('0xc')](_0x520dce[_0x6e23('0x21')][_0x6e23('0xc')]);}_0x1e9f4c['order']=qs['sort'](_0x520dce[_0x6e23('0x21')][_0x6e23('0x2a')]);_0x1e9f4c[_0x6e23('0x2b')]=qs[_0x6e23('0x23')](_[_0x6e23('0x2c')](_0x520dce[_0x6e23('0x21')],_0x51667c[_0x6e23('0x23')]),_0x32b003);if(_0x520dce['query'][_0x6e23('0x2d')]){_0x1e9f4c[_0x6e23('0x2b')]=_['merge'](_0x1e9f4c['where'],{'$or':_[_0x6e23('0x2e')](_0x32b003,function(_0xe2104d){if(_0xe2104d[_0x6e23('0x1e')]!=='VIRTUAL'){var _0x51b60f={};_0x51b60f[_0xe2104d[_0x6e23('0x18')]]={'$like':'%'+_0x520dce[_0x6e23('0x21')][_0x6e23('0x2d')]+'%'};return _0x51b60f;}})});}_0x1e9f4c=_[_0x6e23('0x2f')]({},_0x1e9f4c,_0x520dce[_0x6e23('0x30')]);var _0x4b9d36={'where':_0x1e9f4c[_0x6e23('0x2b')]};return db[_0x6e23('0x1b')]['count'](_0x4b9d36)[_0x6e23('0x14')](function(_0x171fd7){_0x5b4fc9[_0x6e23('0xe')]=_0x171fd7;if(_0x520dce[_0x6e23('0x21')]['includeAll']){_0x1e9f4c['include']=[{'all':!![]}];}return db[_0x6e23('0x1b')]['findAll'](_0x1e9f4c);})['then'](function(_0x4636a4){_0x5b4fc9['rows']=_['map'](_0x4636a4,function(_0x9ebe90){if(_0x9ebe90[_0x6e23('0x31')]===_0x6e23('0x32')){var _0x553b3d=encryptor[_0x6e23('0x33')](_0x9ebe90['data3']);_0x9ebe90[_0x6e23('0x34')]=maskClientSecret(_0x553b3d);}return _0x9ebe90;});return _0x5b4fc9;})['then'](respondWithFilteredResult(_0xb8f65f,_0x1e9f4c))[_0x6e23('0x35')](handleError(_0xb8f65f,null));};exports[_0x6e23('0x36')]=function(_0x1cfb5c,_0x247135){var _0xb88ec1={'raw':!![],'where':{'id':_0x1cfb5c[_0x6e23('0x37')]['id']}},_0x1a9098={};_0x1a9098['model']=_['keys'](db[_0x6e23('0x1b')]['rawAttributes']);_0x1a9098[_0x6e23('0x21')]=_[_0x6e23('0x22')](_0x1cfb5c['query']);_0x1a9098[_0x6e23('0x23')]=_[_0x6e23('0x24')](_0x1a9098[_0x6e23('0x20')],_0x1a9098['query']);_0xb88ec1[_0x6e23('0x25')]=_[_0x6e23('0x24')](_0x1a9098[_0x6e23('0x20')],qs[_0x6e23('0x26')](_0x1cfb5c[_0x6e23('0x21')]['fields']));_0xb88ec1[_0x6e23('0x25')]=_0xb88ec1[_0x6e23('0x25')][_0x6e23('0x27')]?_0xb88ec1[_0x6e23('0x25')]:_0x1a9098[_0x6e23('0x20')];if(_0x1cfb5c[_0x6e23('0x21')][_0x6e23('0x38')]){_0xb88ec1[_0x6e23('0x39')]=[{'all':!![]}];}_0xb88ec1=_[_0x6e23('0x2f')]({},_0xb88ec1,_0x1cfb5c[_0x6e23('0x30')]);return db[_0x6e23('0x1b')][_0x6e23('0x3a')](_0xb88ec1)[_0x6e23('0x14')](handleEntityNotFound(_0x247135,null))[_0x6e23('0x14')](function(_0x2eecb1){if(_0x2eecb1[_0x6e23('0x31')]===_0x6e23('0x32')){var _0x385956=encryptor[_0x6e23('0x33')](_0x2eecb1[_0x6e23('0x34')]);_0x2eecb1['data3']=maskClientSecret(_0x385956);}return _0x2eecb1;})[_0x6e23('0x14')](respondWithResult(_0x247135,null))[_0x6e23('0x35')](handleError(_0x247135,null));};exports['create']=function(_0x3f616c,_0x169120){if(!_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x18')])throw new Error(_0x6e23('0x3c'));if(!_0x3f616c['body'][_0x6e23('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x2931f0=db[_0x6e23('0x1b')][_0x6e23('0x1c')][_0x6e23('0x31')][_0x6e23('0x3d')];if(!_0x2931f0[_0x6e23('0x3e')](_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x31')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x2931f0[_0x6e23('0x3f')](',\x20'));if(_0x3f616c['body'][_0x6e23('0x31')]===_0x6e23('0x32')&&_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x34')]){_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x34')]=encryptor[_0x6e23('0x40')](_0x3f616c[_0x6e23('0x3b')][_0x6e23('0x34')]);}return db['CloudProvider'][_0x6e23('0x41')](_0x3f616c[_0x6e23('0x3b')],{})['then'](respondWithResult(_0x169120,0xc9))[_0x6e23('0x35')](handleError(_0x169120,null));};exports[_0x6e23('0x13')]=function(_0x56a15f,_0x63db8e){if(_0x56a15f[_0x6e23('0x3b')]['id']){delete _0x56a15f[_0x6e23('0x3b')]['id'];}return db[_0x6e23('0x1b')][_0x6e23('0x3a')]({'where':{'id':_0x56a15f[_0x6e23('0x37')]['id']}})[_0x6e23('0x14')](handleEntityNotFound(_0x63db8e,null))[_0x6e23('0x14')](function(_0x485f23){if(_0x485f23[_0x6e23('0x31')]==='MicrosoftAzure'&&_0x56a15f[_0x6e23('0x3b')][_0x6e23('0x34')]){_0x56a15f['body'][_0x6e23('0x34')]=encryptor[_0x6e23('0x40')](_0x56a15f[_0x6e23('0x3b')]['data3']);}return _0x485f23;})[_0x6e23('0x14')](saveUpdates(_0x56a15f['body'],null))['then'](respondWithResult(_0x63db8e,null))[_0x6e23('0x35')](handleError(_0x63db8e,null));};exports[_0x6e23('0x15')]=function(_0x457c4f,_0x54c058){return db['CloudProvider'][_0x6e23('0x3a')]({'where':{'id':_0x457c4f[_0x6e23('0x37')]['id']}})[_0x6e23('0x14')](handleEntityNotFound(_0x54c058,null))[_0x6e23('0x14')](removeEntity(_0x54c058,null))[_0x6e23('0x35')](handleError(_0x54c058,null));};exports[_0x6e23('0x42')]=function(_0x4cef1e,_0xe0539a){return db[_0x6e23('0x1b')][_0x6e23('0x43')]({'where':{'id':_0x4cef1e[_0x6e23('0x37')]['id']},'raw':!![]})['then'](function(_0x1fe5d1){if(!_0x1fe5d1)return _0xe0539a[_0x6e23('0xa')](0x194);return{'url':oauth[_0x6e23('0x44')](_0x1fe5d1,_0x4cef1e[_0x6e23('0x45')]['id'])};})[_0x6e23('0x14')](respondWithResult(_0xe0539a,null))[_0x6e23('0x35')](handleError(_0xe0539a,null));};exports[_0x6e23('0x46')]=function(_0x8e0d89,_0x45f3ef){var _0x59718a=_0x8e0d89[_0x6e23('0x3b')];var _0x536c9f;var _0x243b0b;if(_0x59718a[_0x6e23('0x47')])throw _0x59718a;redis[_0x6e23('0x48')](_0x59718a[_0x6e23('0x49')])[_0x6e23('0x14')](function(_0x46eb44){if(!_0x46eb44)throw new Error(_0x6e23('0x4a'));_0x536c9f=JSON[_0x6e23('0x4b')](_0x46eb44);var _0x378b60=Buffer[_0x6e23('0x4c')](_0x59718a[_0x6e23('0x49')],_0x6e23('0x4d'))['toString']('ascii');_0x243b0b=JSON[_0x6e23('0x4b')](_0x378b60);if(!oauth[_0x6e23('0x4e')](_0x59718a[_0x6e23('0x4f')],_0x536c9f[_0x6e23('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x59718a[_0x6e23('0x49')]);return oauth[_0x6e23('0x51')](_0x59718a['code'],_0x536c9f);})[_0x6e23('0x14')](function(_0x273c3c){_0x536c9f['data5']=_0x273c3c['access_token'];_0x536c9f[_0x6e23('0x52')]=_0x273c3c[_0x6e23('0x53')];return db[_0x6e23('0x1b')][_0x6e23('0x13')]({'data5':_0x536c9f['data5'],'data6':_0x536c9f[_0x6e23('0x52')]},{'where':{'id':_0x536c9f['id']}});})[_0x6e23('0x14')](function(){oauth['startRefreshInterval'](_0x536c9f);socket[_0x6e23('0x54')](_0x6e23('0x55'),{'id':_0x243b0b['id']});return;})[_0x6e23('0x14')](respondWithStatusCode(_0x45f3ef,null))['catch'](function(_0x39076d){if(_0x243b0b){socket[_0x6e23('0x54')](_0x6e23('0x56'),{'id':_0x243b0b['id']});}if(!_0x536c9f){logger[_0x6e23('0x47')](_0x6e23('0x57'),_0x39076d);return _0x45f3ef[_0x6e23('0xb')](0x1f4)['send'](_0x39076d[_0x6e23('0x58')]);}logger[_0x6e23('0x47')](_0x6e23('0x59'),_0x536c9f['id'],JSON[_0x6e23('0x5a')](_0x39076d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 438380e..6dfa3e5 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 _0x895b=['moment','path','rimraf','../../config/environment','define','CloudProvider','cloud_providers','lodash','util','api'];(function(_0x426e3b,_0x2b013b){var _0x662459=function(_0x3d5280){while(--_0x3d5280){_0x426e3b['push'](_0x426e3b['shift']());}};_0x662459(++_0x2b013b);}(_0x895b,0x18d));var _0xb895=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x895b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb895('0x0'));var util=require(_0xb895('0x1'));var logger=require('../../config/logger')(_0xb895('0x2'));var moment=require(_0xb895('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb895('0x4'));var rimraf=require(_0xb895('0x5'));var config=require(_0xb895('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x1776b5,_0xb11b1b){return _0x1776b5[_0xb895('0x7')](_0xb895('0x8'),attributes,{'tableName':_0xb895('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2964=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x341a17,_0x2a5857){var _0x205e03=function(_0x4054bb){while(--_0x4054bb){_0x341a17['push'](_0x341a17['shift']());}};_0x205e03(++_0x2a5857);}(_0x2964,0x68));var _0x4296=function(_0x2f48cd,_0x34d2b7){_0x2f48cd=_0x2f48cd-0x0;var _0x3ef4b0=_0x2964[_0x2f48cd];return _0x3ef4b0;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var logger=require(_0x4296('0x2'))('api');var moment=require(_0x4296('0x3'));var BPromise=require(_0x4296('0x4'));var rp=require(_0x4296('0x5'));var fs=require('fs');var path=require(_0x4296('0x6'));var rimraf=require(_0x4296('0x7'));var config=require(_0x4296('0x8'));var attributes=require(_0x4296('0x9'));module['exports']=function(_0x284302,_0x113c0){return _0x284302[_0x4296('0xa')](_0x4296('0xb'),attributes,{'tableName':_0x4296('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index aad91c5..11696d5 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d96=['authorization_code','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','map','type','Dynamics365','push','/.default','join','data7','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','response_type','redirect_uri','response_mode','form_post','state','nonce','login','value','oauth2Claims','oauth2/','data1','set','decode','iss','issuer','aud','audience','isAfter','unix','exp','then','CloudProvider','findOne','data6','data4','decryptString','data3','POST','access_token','update','data5','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s'];(function(_0x18c864,_0x5724b1){var _0x5c5373=function(_0x1e3d7b){while(--_0x1e3d7b){_0x18c864['push'](_0x18c864['shift']());}};_0x5c5373(++_0x5724b1);}(_0x8d96,0xa6));var _0x68d9=function(_0x470ada,_0x453059){_0x470ada=_0x470ada-0x0;var _0x5a71e0=_0x8d96[_0x470ada];return _0x5a71e0;};'use strict';var _=require(_0x68d9('0x0'));var crypto=require(_0x68d9('0x1'));var jwt=require(_0x68d9('0x2'));var moment=require(_0x68d9('0x3'));var Redis=require(_0x68d9('0x4'));var rp=require(_0x68d9('0x5'));var util=require(_0x68d9('0x6'));var encryptor=require(_0x68d9('0x7'));var config=require('../../config/environment');var logger=require(_0x68d9('0x8'))(_0x68d9('0x9'));var schedule=require(_0x68d9('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x68d9('0xb')],{'host':_0x68d9('0xc'),'port':0x18eb});var redis=new Redis(config[_0x68d9('0xb')]);var MICROSOFT_AUTH_URL=_0x68d9('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x68d9('0xe'),'email','offline_access',_0x68d9('0xf'),'https://outlook.office.com/POP.AccessAsUser.All',_0x68d9('0x10')],'Dynamics365':[_0x68d9('0x11'),_0x68d9('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x68d9('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4a9b27){var _0x116179=_[_0x68d9('0x14')](AZURE_AUTH_SCOPES[_0x4a9b27[_0x68d9('0x15')]]);if(_0x4a9b27[_0x68d9('0x15')]===_0x68d9('0x16'))_0x116179[_0x68d9('0x17')](_0x4a9b27['data7']+_0x68d9('0x18'));return _0x116179[_0x68d9('0x19')]('\x20');}function getAccessTokenScope(_0x257f6d){if(_0x257f6d[_0x68d9('0x15')]==='Outlook365')return _0x68d9('0xf');if(_0x257f6d[_0x68d9('0x15')]===_0x68d9('0x16'))return _0x257f6d[_0x68d9('0x1a')]+_0x68d9('0x18');}function generateMicrosoftAuthorizationUrl(_0x1d42ff,_0xd3feb5){var _0x399c2e=MICROSOFT_AUTH_URL[_0x68d9('0x1b')](_0x68d9('0x1c'),_0x1d42ff[_0x68d9('0x1d')]);var _0x51e3b5=[_0x68d9('0x1e'),_0x68d9('0x1f')];var _0x6e99f=Buffer[_0x68d9('0x20')](JSON[_0x68d9('0x21')]({'id':_0xd3feb5}))[_0x68d9('0x22')](_0x68d9('0x23'));var _0x4774a4=crypto[_0x68d9('0x24')](0x10)[_0x68d9('0x22')]('hex');var _0x3204e8=getAuthorizationScopes(_0x1d42ff);var _0x4a6dbf=[{'key':_0x68d9('0x25'),'value':_0x1d42ff['data1']},{'key':_0x68d9('0x26'),'value':encodeURIComponent(_0x51e3b5[_0x68d9('0x19')]('\x20'))},{'key':_0x68d9('0x27'),'value':_0x1d42ff['data4']},{'key':_0x68d9('0x28'),'value':_0x68d9('0x29')},{'key':'scope','value':encodeURIComponent(_0x3204e8)},{'key':_0x68d9('0x2a'),'value':_0x6e99f},{'key':_0x68d9('0x2b'),'value':_0x4774a4},{'key':'prompt','value':_0x68d9('0x2c')}];var _0x3b3fe2=_0x399c2e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x68d9('0x14')](_0x4a6dbf,function(_0x586529){return _0x586529['key']+'='+_0x586529[_0x68d9('0x2d')];})[_0x68d9('0x19')]('&');_0x1d42ff[_0x68d9('0x2e')]={'issuer':_0x399c2e[_0x68d9('0x1b')](_0x68d9('0x2f'),''),'audience':_0x1d42ff[_0x68d9('0x30')],'state':_0x6e99f,'nonce':_0x4774a4};redis[_0x68d9('0x31')](_0x6e99f,JSON['stringify'](_0x1d42ff));return _0x3b3fe2;}function isValidIdToken(_0x3de123,_0x3c3b98){try{var _0x22b6e1=jwt[_0x68d9('0x32')](_0x3de123,{'complete':!![]});var _0x29b968=_0x22b6e1['payload'];if(_0x29b968[_0x68d9('0x33')]!==_0x3c3b98[_0x68d9('0x34')])return![];if(_0x29b968[_0x68d9('0x35')]!==_0x3c3b98[_0x68d9('0x36')])return![];if(_0x29b968[_0x68d9('0x2b')]!==_0x3c3b98[_0x68d9('0x2b')])return![];if(moment()[_0x68d9('0x37')](moment[_0x68d9('0x38')](_0x29b968[_0x68d9('0x39')])))return![];return!![];}catch(_0x521bcd){throw _0x521bcd;}}function refreshOauth2MicrosoftAccessToken(_0x4a1fa4){return Promise['resolve']()[_0x68d9('0x3a')](function(){if(_0x4a1fa4['data3'])return _0x4a1fa4;return db[_0x68d9('0x3b')][_0x68d9('0x3c')]({'where':{'id':_0x4a1fa4['id']},'raw':!![]});})['then'](function(_0x2c6534){var _0x4e3871={'grant_type':'refresh_token','refresh_token':_0x2c6534[_0x68d9('0x3d')],'scope':getAccessTokenScope(_0x2c6534),'redirect_uri':_0x2c6534[_0x68d9('0x3e')],'client_id':_0x2c6534['data1'],'client_secret':encryptor[_0x68d9('0x3f')](_0x2c6534[_0x68d9('0x40')])};var _0x2ff640={'method':_0x68d9('0x41'),'uri':MICROSOFT_AUTH_URL[_0x68d9('0x1b')](_0x68d9('0x1c'),_0x2c6534[_0x68d9('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4e3871,'json':!![]};return rp(_0x2ff640);})[_0x68d9('0x3a')](function(_0x507c5f){_0x4a1fa4['data5']=_0x507c5f[_0x68d9('0x42')];_0x4a1fa4[_0x68d9('0x3d')]=_0x507c5f['refresh_token'];return db[_0x68d9('0x3b')][_0x68d9('0x43')]({'data5':_0x4a1fa4[_0x68d9('0x44')],'data6':_0x4a1fa4[_0x68d9('0x3d')]},{'where':{'id':_0x4a1fa4['id']}});})['then'](function(){return _0x4a1fa4;})['catch'](function(_0x4e29e9){logger[_0x68d9('0x45')](_0x68d9('0x46'),_0x4a1fa4['id'],_0x4e29e9);});}function getOauth2MicrosoftAccessToken(_0x2e014a,_0x40221d){var _0x12de98={'grant_type':_0x68d9('0x47'),'code':_0x2e014a,'scope':getAccessTokenScope(_0x40221d),'redirect_uri':_0x40221d[_0x68d9('0x3e')],'client_id':_0x40221d['data1'],'client_secret':encryptor[_0x68d9('0x3f')](_0x40221d['data3'])};var _0x2939b0={'method':_0x68d9('0x41'),'uri':MICROSOFT_AUTH_URL[_0x68d9('0x1b')](_0x68d9('0x1c'),_0x40221d[_0x68d9('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12de98,'json':!![]};return rp(_0x2939b0);}function startRefreshInterval(_0x96b677){var _0xb5ddf3=schedule[_0x68d9('0x48')];if(_0xb5ddf3[_0x96b677['id']])clearInterval(_0xb5ddf3[_0x96b677['id']]);_0xb5ddf3[_0x96b677['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x68d9('0x49')](this,{'id':_0x96b677['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x68d9('0x48')]=_0xb5ddf3;}function startAllRefreshIntervals(){return db[_0x68d9('0x3b')][_0x68d9('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x68d9('0x3a')](function(_0x2aae20){var _0x3f0ce0=_0x2aae20[_0x68d9('0x14')](function(_0x11c616){return refreshOauth2MicrosoftAccessToken(_0x11c616)[_0x68d9('0x3a')](function(_0x53f47b){startRefreshInterval(_0x53f47b);});});return Promise[_0x68d9('0x4b')](_0x3f0ce0);})[_0x68d9('0x4c')](function(_0x394abd){var _0x2535a6=_0x394abd?util['inspect'](_0x394abd,{'showHidden':![],'depth':null}):'';logger[_0x68d9('0x45')](_0x68d9('0x4d'),_0x2535a6);});}module[_0x68d9('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xad66=['all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','hex','client_id','data1','response_type','join','data4','response_mode','form_post','scope','state','nonce','key','value','oauth2Claims','decode','iss','audience','exp','resolve','CloudProvider','findOne','then','refresh_token','data6','data3','POST','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','bind','intervals','findAll'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0xad66,0xe5));var _0x6ad6=function(_0x5e06f0,_0x12f101){_0x5e06f0=_0x5e06f0-0x0;var _0x57673c=_0xad66[_0x5e06f0];return _0x57673c;};'use strict';var _=require(_0x6ad6('0x0'));var crypto=require(_0x6ad6('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x6ad6('0x2'));var Redis=require(_0x6ad6('0x3'));var rp=require(_0x6ad6('0x4'));var util=require(_0x6ad6('0x5'));var encryptor=require(_0x6ad6('0x6'));var config=require(_0x6ad6('0x7'));var logger=require('../../config/logger')(_0x6ad6('0x8'));var schedule=require(_0x6ad6('0x9'));var db=require(_0x6ad6('0xa'))['db'];config[_0x6ad6('0xb')]=_[_0x6ad6('0xc')](config[_0x6ad6('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x6ad6('0xb')]);var MICROSOFT_AUTH_URL=_0x6ad6('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x6ad6('0xe'),_0x6ad6('0xf'),'email','offline_access',_0x6ad6('0x10'),_0x6ad6('0x11'),_0x6ad6('0x12')],'Dynamics365':['openid',_0x6ad6('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x6ad6('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xbf9d22){var _0x5c970e=_[_0x6ad6('0x15')](AZURE_AUTH_SCOPES[_0xbf9d22['type']]);if(_0xbf9d22[_0x6ad6('0x16')]===_0x6ad6('0x17'))_0x5c970e[_0x6ad6('0x18')](_0xbf9d22[_0x6ad6('0x19')]+_0x6ad6('0x1a'));return _0x5c970e['join']('\x20');}function getAccessTokenScope(_0x5c69b2){if(_0x5c69b2[_0x6ad6('0x16')]==='Outlook365')return _0x6ad6('0x10');if(_0x5c69b2['type']===_0x6ad6('0x17'))return _0x5c69b2[_0x6ad6('0x19')]+_0x6ad6('0x1a');}function generateMicrosoftAuthorizationUrl(_0x1796cd,_0x49c889){var _0x277814=MICROSOFT_AUTH_URL[_0x6ad6('0x1b')](_0x6ad6('0x1c'),_0x1796cd[_0x6ad6('0x1d')]);var _0x21f974=[_0x6ad6('0x1e'),_0x6ad6('0x1f')];var _0x1b0ced=Buffer[_0x6ad6('0x20')](JSON['stringify']({'id':_0x49c889}))[_0x6ad6('0x21')](_0x6ad6('0x22'));var _0x518f1f=crypto['randomBytes'](0x10)[_0x6ad6('0x21')](_0x6ad6('0x23'));var _0x5cf3ec=getAuthorizationScopes(_0x1796cd);var _0xef93be=[{'key':_0x6ad6('0x24'),'value':_0x1796cd[_0x6ad6('0x25')]},{'key':_0x6ad6('0x26'),'value':encodeURIComponent(_0x21f974[_0x6ad6('0x27')]('\x20'))},{'key':'redirect_uri','value':_0x1796cd[_0x6ad6('0x28')]},{'key':_0x6ad6('0x29'),'value':_0x6ad6('0x2a')},{'key':_0x6ad6('0x2b'),'value':encodeURIComponent(_0x5cf3ec)},{'key':_0x6ad6('0x2c'),'value':_0x1b0ced},{'key':_0x6ad6('0x2d'),'value':_0x518f1f},{'key':'prompt','value':'login'}];var _0x45111e=_0x277814+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xef93be,function(_0x22efa8){return _0x22efa8[_0x6ad6('0x2e')]+'='+_0x22efa8[_0x6ad6('0x2f')];})[_0x6ad6('0x27')]('&');_0x1796cd[_0x6ad6('0x30')]={'issuer':_0x277814[_0x6ad6('0x1b')]('oauth2/',''),'audience':_0x1796cd['data1'],'state':_0x1b0ced,'nonce':_0x518f1f};redis['set'](_0x1b0ced,JSON['stringify'](_0x1796cd));return _0x45111e;}function isValidIdToken(_0x52c4d2,_0x405dd1){try{var _0x106acc=jwt[_0x6ad6('0x31')](_0x52c4d2,{'complete':!![]});var _0x3eb8ef=_0x106acc['payload'];if(_0x3eb8ef[_0x6ad6('0x32')]!==_0x405dd1['issuer'])return![];if(_0x3eb8ef['aud']!==_0x405dd1[_0x6ad6('0x33')])return![];if(_0x3eb8ef[_0x6ad6('0x2d')]!==_0x405dd1['nonce'])return![];if(moment()['isAfter'](moment['unix'](_0x3eb8ef[_0x6ad6('0x34')])))return![];return!![];}catch(_0x1a8f7a){throw _0x1a8f7a;}}function refreshOauth2MicrosoftAccessToken(_0x329eef){return Promise[_0x6ad6('0x35')]()['then'](function(){if(_0x329eef['data3'])return _0x329eef;return db[_0x6ad6('0x36')][_0x6ad6('0x37')]({'where':{'id':_0x329eef['id']},'raw':!![]});})[_0x6ad6('0x38')](function(_0x4b8392){var _0x93870d={'grant_type':_0x6ad6('0x39'),'refresh_token':_0x4b8392[_0x6ad6('0x3a')],'scope':getAccessTokenScope(_0x4b8392),'redirect_uri':_0x4b8392[_0x6ad6('0x28')],'client_id':_0x4b8392[_0x6ad6('0x25')],'client_secret':encryptor['decryptString'](_0x4b8392[_0x6ad6('0x3b')])};var _0xb6f93a={'method':_0x6ad6('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x6ad6('0x1b')](_0x6ad6('0x1c'),_0x4b8392[_0x6ad6('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x93870d,'json':!![]};return rp(_0xb6f93a);})[_0x6ad6('0x38')](function(_0x34bf15){_0x329eef[_0x6ad6('0x3d')]=_0x34bf15[_0x6ad6('0x3e')];_0x329eef[_0x6ad6('0x3a')]=_0x34bf15[_0x6ad6('0x39')];return db[_0x6ad6('0x36')]['update']({'data5':_0x329eef[_0x6ad6('0x3d')],'data6':_0x329eef['data6']},{'where':{'id':_0x329eef['id']}});})[_0x6ad6('0x38')](function(){return _0x329eef;})[_0x6ad6('0x3f')](function(_0x55b4cb){logger[_0x6ad6('0x40')](_0x6ad6('0x41'),_0x329eef['id'],_0x55b4cb);});}function getOauth2MicrosoftAccessToken(_0x415c99,_0x2d702b){var _0x51a4d8={'grant_type':_0x6ad6('0x42'),'code':_0x415c99,'scope':getAccessTokenScope(_0x2d702b),'redirect_uri':_0x2d702b[_0x6ad6('0x28')],'client_id':_0x2d702b[_0x6ad6('0x25')],'client_secret':encryptor[_0x6ad6('0x43')](_0x2d702b[_0x6ad6('0x3b')])};var _0x233a8d={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x6ad6('0x1c'),_0x2d702b[_0x6ad6('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x51a4d8,'json':!![]};return rp(_0x233a8d);}function startRefreshInterval(_0x1353ca){var _0x5a03d1=schedule['intervals'];if(_0x5a03d1[_0x1353ca['id']])clearInterval(_0x5a03d1[_0x1353ca['id']]);_0x5a03d1[_0x1353ca['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x6ad6('0x44')](this,{'id':_0x1353ca['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x6ad6('0x45')]=_0x5a03d1;}function startAllRefreshIntervals(){return db[_0x6ad6('0x36')][_0x6ad6('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6ad6('0x38')](function(_0x528198){var _0x5101cc=_0x528198[_0x6ad6('0x15')](function(_0x1344b9){return refreshOauth2MicrosoftAccessToken(_0x1344b9)[_0x6ad6('0x38')](function(_0x492ca8){startRefreshInterval(_0x492ca8);});});return Promise[_0x6ad6('0x47')](_0x5101cc);})[_0x6ad6('0x3f')](function(_0x49d3e8){var _0x56768c=_0x49d3e8?util[_0x6ad6('0x48')](_0x49d3e8,{'showHidden':![],'depth':null}):'';logger[_0x6ad6('0x40')](_0x6ad6('0x49'),_0x56768c);});}module[_0x6ad6('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index de729f5..cda2b7f 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 _0xbd9e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','moment','randomstring'];(function(_0x10c45e,_0x3e5237){var _0x425d90=function(_0x1b9eb9){while(--_0x1b9eb9){_0x10c45e['push'](_0x10c45e['shift']());}};_0x425d90(++_0x3e5237);}(_0xbd9e,0x108));var _0xebd9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xbd9e[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebd9('0x0'));var BPromise=require('bluebird');var rs=require(_0xebd9('0x1'));var fs=require('fs');var Redis=require(_0xebd9('0x2'));var db=require(_0xebd9('0x3'))['db'];var utils=require(_0xebd9('0x4'));var logger=require(_0xebd9('0x5'))('rpc');var config=require(_0xebd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xebd9('0x7')][_0xebd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe1bf09,_0x23c503,_0x285c28){return new BPromise(function(_0x1f7734,_0x55e858){return client[_0xebd9('0x9')](_0xe1bf09,_0x285c28)[_0xebd9('0xa')](function(_0x12d27a){logger[_0xebd9('0xb')](_0xebd9('0xc'),_0x23c503,'request\x20sent');logger[_0xebd9('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x23c503,_0xebd9('0xe'),JSON['stringify'](_0x12d27a));if(_0x12d27a[_0xebd9('0xf')]){if(_0x12d27a[_0xebd9('0xf')]['code']===0x1f4){logger[_0xebd9('0xf')](_0xebd9('0xc'),_0x23c503,_0x12d27a['error'][_0xebd9('0x10')]);return _0x55e858(_0x12d27a[_0xebd9('0xf')][_0xebd9('0x10')]);}logger[_0xebd9('0xf')]('CloudProvider,\x20%s,\x20%s',_0x23c503,_0x12d27a[_0xebd9('0xf')][_0xebd9('0x10')]);return _0x1f7734(_0x12d27a[_0xebd9('0xf')][_0xebd9('0x10')]);}else{logger[_0xebd9('0xb')](_0xebd9('0xc'),_0x23c503,_0xebd9('0xe'));_0x1f7734(_0x12d27a[_0xebd9('0x11')][_0xebd9('0x10')]);}})[_0xebd9('0x12')](function(_0x37cdf3){logger[_0xebd9('0xf')](_0xebd9('0xc'),_0x23c503,_0x37cdf3);_0x55e858(_0x37cdf3);});});} \ No newline at end of file +var _0xa329=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x2af2a5,_0x4089fa){var _0x4ef35e=function(_0x5605d7){while(--_0x5605d7){_0x2af2a5['push'](_0x2af2a5['shift']());}};_0x4ef35e(++_0x4089fa);}(_0xa329,0x162));var _0x9a32=function(_0x4212c9,_0x26c526){_0x4212c9=_0x4212c9-0x0;var _0x6b7476=_0xa329[_0x4212c9];return _0x6b7476;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var moment=require('moment');var BPromise=require(_0x9a32('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a32('0x3'));var db=require(_0x9a32('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a32('0x5'));var config=require(_0x9a32('0x6'));var jayson=require(_0x9a32('0x7'));var client=jayson[_0x9a32('0x8')][_0x9a32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x235b92,_0x4a8fba,_0x5b8b5e){return new BPromise(function(_0x4dc7f8,_0x344b35){return client[_0x9a32('0xa')](_0x235b92,_0x5b8b5e)['then'](function(_0x38f6cc){logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));logger[_0x9a32('0xe')](_0x9a32('0xf'),_0x4a8fba,'request\x20sent',JSON[_0x9a32('0x10')](_0x38f6cc));if(_0x38f6cc[_0x9a32('0x11')]){if(_0x38f6cc['error']['code']===0x1f4){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error']['message']);return _0x344b35(_0x38f6cc[_0x9a32('0x11')][_0x9a32('0x12')]);}logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x38f6cc['error'][_0x9a32('0x12')]);return _0x4dc7f8(_0x38f6cc[_0x9a32('0x11')]['message']);}else{logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x4a8fba,_0x9a32('0xd'));_0x4dc7f8(_0x38f6cc[_0x9a32('0x13')][_0x9a32('0x12')]);}})[_0x9a32('0x14')](function(_0x4fa645){logger[_0x9a32('0x11')](_0x9a32('0xc'),_0x4a8fba,_0x4fa645);_0x344b35(_0x4fa645);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f7decf4..d4402e5 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0xe31b33,_0x56e7c2){var _0x506ea6=function(_0x512c40){while(--_0x512c40){_0xe31b33['push'](_0xe31b33['shift']());}};_0x506ea6(++_0x56e7c2);}(_0x2ef3,0xba));var _0x32ef=function(_0x44a88c,_0x4eb614){_0x44a88c=_0x44a88c-0x0;var _0xa0f93d=_0x2ef3[_0x44a88c];return _0xa0f93d;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x1261,0x144));var _0x1126=function(_0x28e0f1,_0xd1bfa0){_0x28e0f1=_0x28e0f1-0x0;var _0x13aedc=_0x1261[_0x28e0f1];return _0x13aedc;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4865311..5d55c32 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 _0x0863=['STRING','name','sequelize','exports'];(function(_0x39475,_0xfc9d3e){var _0x58e849=function(_0x4fe977){while(--_0x4fe977){_0x39475['push'](_0x39475['shift']());}};_0x58e849(++_0xfc9d3e);}(_0x0863,0x126));var _0x3086=function(_0x1a085c,_0x5d0b09){_0x1a085c=_0x1a085c-0x0;var _0x2444db=_0x0863[_0x1a085c];return _0x2444db;};'use strict';var Sequelize=require(_0x3086('0x0'));module[_0x3086('0x1')]={'name':{'type':Sequelize[_0x3086('0x2')],'unique':_0x3086('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3086('0x2')]},'companyId':{'type':Sequelize[_0x3086('0x2')]},'website':{'type':Sequelize[_0x3086('0x2')]},'phone':{'type':Sequelize[_0x3086('0x2')]},'fax':{'type':Sequelize[_0x3086('0x2')]},'type':{'type':Sequelize[_0x3086('0x2')]},'street':{'type':Sequelize[_0x3086('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3086('0x2')]},'country':{'type':Sequelize[_0x3086('0x2')]},'email':{'type':Sequelize[_0x3086('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3086('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x3086('0x2')]},'sCountry':{'type':Sequelize[_0x3086('0x2')]},'description':{'type':Sequelize[_0x3086('0x2')]}}; \ No newline at end of file +var _0xa7ac=['STRING','exports','name'];(function(_0x4d4437,_0x196f65){var _0x4a89db=function(_0x597cfc){while(--_0x597cfc){_0x4d4437['push'](_0x4d4437['shift']());}};_0x4a89db(++_0x196f65);}(_0xa7ac,0x14e));var _0xca7a=function(_0x24f927,_0x53d117){_0x24f927=_0x24f927-0x0;var _0x528c44=_0xa7ac[_0x24f927];return _0x528c44;};'use strict';var Sequelize=require('sequelize');module[_0xca7a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xca7a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xca7a('0x2')]},'website':{'type':Sequelize[_0xca7a('0x2')]},'phone':{'type':Sequelize[_0xca7a('0x2')]},'fax':{'type':Sequelize[_0xca7a('0x2')]},'type':{'type':Sequelize[_0xca7a('0x2')]},'street':{'type':Sequelize[_0xca7a('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xca7a('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xca7a('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xca7a('0x2')]},'sCity':{'type':Sequelize[_0xca7a('0x2')]},'sCountry':{'type':Sequelize[_0xca7a('0x2')]},'description':{'type':Sequelize[_0xca7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index afc7d73..79b30b7 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 _0x7c41=['order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','CmContact','addContacts','ids','omit','getContacts','findOne','map','length','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','name','send','index','CmCompany','describe','model','keys','filters','attributes','intersection','fields','hasOwnProperty','query'];(function(_0x3cc1ef,_0x4d8511){var _0x4df6c8=function(_0x406a18){while(--_0x406a18){_0x3cc1ef['push'](_0x3cc1ef['shift']());}};_0x4df6c8(++_0x4d8511);}(_0x7c41,0x174));var _0x17c4=function(_0x259c9f,_0x447312){_0x259c9f=_0x259c9f-0x0;var _0x187ae4=_0x7c41[_0x259c9f];return _0x187ae4;};'use strict';var emlformat=require(_0x17c4('0x0'));var rimraf=require(_0x17c4('0x1'));var zipdir=require(_0x17c4('0x2'));var jsonpatch=require(_0x17c4('0x3'));var rp=require('request-promise');var moment=require(_0x17c4('0x4'));var BPromise=require(_0x17c4('0x5'));var Mustache=require(_0x17c4('0x6'));var util=require('util');var path=require(_0x17c4('0x7'));var sox=require('sox');var csv=require(_0x17c4('0x8'));var ejs=require(_0x17c4('0x9'));var fs=require('fs');var fs_extra=require(_0x17c4('0xa'));var _=require(_0x17c4('0xb'));var squel=require(_0x17c4('0xc'));var crypto=require(_0x17c4('0xd'));var jsforce=require(_0x17c4('0xe'));var deskjs=require(_0x17c4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x17c4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x17c4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17c4('0x12'));var logger=require(_0x17c4('0x13'))(_0x17c4('0x14'));var utils=require(_0x17c4('0x15'));var config=require(_0x17c4('0x16'));var licenseUtil=require(_0x17c4('0x17'));var db=require(_0x17c4('0x18'))['db'];function respondWithStatusCode(_0x421a92,_0x478c82){_0x478c82=_0x478c82||0xcc;return function(_0x4757fc){if(_0x4757fc){return _0x421a92['sendStatus'](_0x478c82);}return _0x421a92[_0x17c4('0x19')](_0x478c82)['end']();};}function respondWithResult(_0x564898,_0xb38b8a){_0xb38b8a=_0xb38b8a||0xc8;return function(_0x4e58d3){if(_0x4e58d3){return _0x564898[_0x17c4('0x19')](_0xb38b8a)[_0x17c4('0x1a')](_0x4e58d3);}};}function respondWithFilteredResult(_0x2a27ee,_0x3a9dc3){return function(_0x1ea27b){if(_0x1ea27b){var _0x167d34=typeof _0x3a9dc3[_0x17c4('0x1b')]===_0x17c4('0x1c')&&typeof _0x3a9dc3[_0x17c4('0x1d')]===_0x17c4('0x1c');var _0x1ea306=_0x1ea27b[_0x17c4('0x1e')];var _0x15916e=_0x167d34?0x0:_0x3a9dc3[_0x17c4('0x1b')];var _0x348f0c=_0x167d34?_0x1ea27b[_0x17c4('0x1e')]:_0x3a9dc3[_0x17c4('0x1b')]+_0x3a9dc3[_0x17c4('0x1d')];var _0x3d0cec;if(_0x348f0c>=_0x1ea306){_0x348f0c=_0x1ea306;_0x3d0cec=0xc8;}else{_0x3d0cec=0xce;}_0x2a27ee[_0x17c4('0x19')](_0x3d0cec);return _0x2a27ee['set'](_0x17c4('0x1f'),_0x15916e+'-'+_0x348f0c+'/'+_0x1ea306)[_0x17c4('0x1a')](_0x1ea27b);}return null;};}function patchUpdates(_0x1246f4){return function(_0x455766){try{jsonpatch[_0x17c4('0x20')](_0x455766,_0x1246f4,!![]);}catch(_0xddd813){return BPromise[_0x17c4('0x21')](_0xddd813);}return _0x455766[_0x17c4('0x22')]();};}function saveUpdates(_0xddddc8,_0x5d6b03){return function(_0x528658){if(_0x528658){return _0x528658[_0x17c4('0x23')](_0xddddc8)[_0x17c4('0x24')](function(_0x13ab21){return _0x13ab21;});}return null;};}function removeEntity(_0x4e7cf9,_0x5cf11a){return function(_0x4037d3){if(_0x4037d3){return _0x4037d3['destroy']()['then'](function(){var _0x14eb6d=_0x4037d3[_0x17c4('0x25')]({'plain':!![]});var _0x24ca20='Companies';return db[_0x17c4('0x26')]['destroy']({'where':{'type':_0x24ca20,'resourceId':_0x14eb6d['id']}})['then'](function(){return _0x4037d3;});})[_0x17c4('0x24')](function(){_0x4e7cf9[_0x17c4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa54d50,_0x1cbe24){return function(_0x404bd9){if(!_0x404bd9){_0xa54d50['sendStatus'](0x194);}return _0x404bd9;};}function handleError(_0x214b2,_0x32762a){_0x32762a=_0x32762a||0x1f4;return function(_0x529f35){logger[_0x17c4('0x27')](_0x529f35['stack']);if(_0x529f35[_0x17c4('0x28')]){delete _0x529f35[_0x17c4('0x28')];}_0x214b2[_0x17c4('0x19')](_0x32762a)[_0x17c4('0x29')](_0x529f35);};}exports[_0x17c4('0x2a')]=function(_0x642f4d,_0x5b02ba){var _0x18265a={},_0x3bec97={},_0x24adf0={'count':0x0,'rows':[]};return db[_0x17c4('0x2b')][_0x17c4('0x2c')]()[_0x17c4('0x24')](function(_0x424cce){_0x3bec97[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](_0x424cce);_0x3bec97['query']=_[_0x17c4('0x2e')](_0x642f4d['query']);_0x3bec97[_0x17c4('0x2f')]=_['intersection'](_0x3bec97[_0x17c4('0x2d')],_0x3bec97['query']);_0x18265a[_0x17c4('0x30')]=_[_0x17c4('0x31')](_0x3bec97[_0x17c4('0x2d')],qs[_0x17c4('0x32')](_0x642f4d['query']['fields']));_0x18265a[_0x17c4('0x30')]=_0x18265a[_0x17c4('0x30')]['length']?_0x18265a[_0x17c4('0x30')]:_0x3bec97['model'];if(!_0x642f4d['query'][_0x17c4('0x33')]('nolimit')){_0x18265a[_0x17c4('0x1d')]=qs[_0x17c4('0x1d')](_0x642f4d['query']['limit']);_0x18265a[_0x17c4('0x1b')]=qs['offset'](_0x642f4d[_0x17c4('0x34')][_0x17c4('0x1b')]);}_0x18265a[_0x17c4('0x35')]=qs['sort'](_0x642f4d[_0x17c4('0x34')][_0x17c4('0x36')]);_0x18265a[_0x17c4('0x37')]=qs[_0x17c4('0x2f')](_[_0x17c4('0x38')](_0x642f4d[_0x17c4('0x34')],_0x3bec97['filters']),_0x424cce);if(_0x642f4d[_0x17c4('0x34')][_0x17c4('0x39')]){_0x18265a[_0x17c4('0x37')]=_[_0x17c4('0x3a')](_0x18265a[_0x17c4('0x37')],{'$or':_['map'](_0x18265a[_0x17c4('0x30')],function(_0x37f08c){var _0x502484={};_0x502484[_0x37f08c]={'$like':'%'+_0x642f4d[_0x17c4('0x34')][_0x17c4('0x39')]+'%'};return _0x502484;})});}_0x18265a=_[_0x17c4('0x3a')]({},_0x18265a,_0x642f4d[_0x17c4('0x3b')]);var _0x3d7dc3={'where':_0x18265a['where']};return db[_0x17c4('0x2b')][_0x17c4('0x1e')](_0x3d7dc3)['then'](function(_0x48f30c){_0x24adf0[_0x17c4('0x1e')]=_0x48f30c;if(_0x642f4d[_0x17c4('0x34')][_0x17c4('0x3c')]){_0x18265a[_0x17c4('0x3d')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x18265a);})[_0x17c4('0x24')](function(_0x3543e6){_0x24adf0[_0x17c4('0x3e')]=_0x3543e6;return _0x24adf0;})[_0x17c4('0x24')](respondWithFilteredResult(_0x5b02ba,_0x18265a))[_0x17c4('0x3f')](handleError(_0x5b02ba,null));})['catch'](handleError(_0x5b02ba,null));};exports[_0x17c4('0x40')]=function(_0x168246,_0x60045d){var _0x220e3a={'raw':![],'where':{'id':_0x168246[_0x17c4('0x41')]['id']}},_0x59d0bb={};_0x59d0bb[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](db[_0x17c4('0x2b')][_0x17c4('0x42')]);_0x59d0bb['query']=_[_0x17c4('0x2e')](_0x168246[_0x17c4('0x34')]);_0x59d0bb[_0x17c4('0x2f')]=_[_0x17c4('0x31')](_0x59d0bb[_0x17c4('0x2d')],_0x59d0bb[_0x17c4('0x34')]);_0x220e3a[_0x17c4('0x30')]=_[_0x17c4('0x31')](_0x59d0bb[_0x17c4('0x2d')],qs['fields'](_0x168246['query'][_0x17c4('0x32')]));_0x220e3a[_0x17c4('0x30')]=_0x220e3a[_0x17c4('0x30')]['length']?_0x220e3a[_0x17c4('0x30')]:_0x59d0bb[_0x17c4('0x2d')];if(_0x168246['query'][_0x17c4('0x3c')]){_0x220e3a[_0x17c4('0x3d')]=[{'all':!![]}];}_0x220e3a=_[_0x17c4('0x3a')]({},_0x220e3a,_0x168246[_0x17c4('0x3b')]);return db['CmCompany'][_0x17c4('0x43')](_0x220e3a)[_0x17c4('0x24')](handleEntityNotFound(_0x60045d,null))['then'](respondWithResult(_0x60045d,null))[_0x17c4('0x3f')](handleError(_0x60045d,null));};exports[_0x17c4('0x44')]=function(_0x4927e3,_0x4ebe26){return db[_0x17c4('0x2b')][_0x17c4('0x44')](_0x4927e3['body'],{})[_0x17c4('0x24')](function(_0x429e75){var _0x16a81c=_0x4927e3[_0x17c4('0x45')][_0x17c4('0x25')]({'plain':!![]});if(!_0x16a81c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16a81c[_0x17c4('0x46')]===_0x17c4('0x45')){var _0x2d093d=_0x429e75[_0x17c4('0x25')]({'plain':!![]});var _0x37590f='Companies';return db[_0x17c4('0x47')]['find']({'where':{'name':_0x37590f,'userProfileId':_0x16a81c['userProfileId']},'raw':!![]})[_0x17c4('0x24')](function(_0x4ed826){if(_0x4ed826&&_0x4ed826[_0x17c4('0x48')]===0x0){return db[_0x17c4('0x26')]['create']({'name':_0x2d093d[_0x17c4('0x28')],'resourceId':_0x2d093d['id'],'type':_0x4ed826['name'],'sectionId':_0x4ed826['id']},{})[_0x17c4('0x24')](function(){return _0x429e75;});}else{return _0x429e75;}})[_0x17c4('0x3f')](function(_0x413b4c){logger[_0x17c4('0x27')](_0x17c4('0x49'),_0x413b4c);throw _0x413b4c;});}return _0x429e75;})[_0x17c4('0x24')](respondWithResult(_0x4ebe26,0xc9))[_0x17c4('0x3f')](handleError(_0x4ebe26,null));};exports['update']=function(_0x40bfde,_0x148fd7){if(_0x40bfde[_0x17c4('0x4a')]['id']){delete _0x40bfde[_0x17c4('0x4a')]['id'];}return db[_0x17c4('0x2b')][_0x17c4('0x43')]({'where':{'id':_0x40bfde[_0x17c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x148fd7,null))[_0x17c4('0x24')](saveUpdates(_0x40bfde['body'],null))['then'](respondWithResult(_0x148fd7,null))['catch'](handleError(_0x148fd7,null));};exports[_0x17c4('0x4b')]=function(_0x87e683,_0x27ab94){return db['CmCompany']['find']({'where':{'id':_0x87e683['params']['id']}})['then'](handleEntityNotFound(_0x27ab94,null))[_0x17c4('0x24')](removeEntity(_0x27ab94,null))[_0x17c4('0x3f')](handleError(_0x27ab94,null));};exports[_0x17c4('0x2c')]=function(_0x32eacf,_0x298930){return db[_0x17c4('0x2b')]['describe']()['then'](respondWithResult(_0x298930,null))[_0x17c4('0x3f')](handleError(_0x298930,null));};exports['addContacts']=function(_0x47d3ca,_0x545718,_0x118aae){return db[_0x17c4('0x4c')][_0x17c4('0x43')]({'where':{'id':_0x47d3ca[_0x17c4('0x41')]['id']}})[_0x17c4('0x24')](handleEntityNotFound(_0x545718,null))[_0x17c4('0x24')](function(_0x958d70){if(_0x958d70){return _0x958d70[_0x17c4('0x4d')](_0x47d3ca[_0x17c4('0x4a')][_0x17c4('0x4e')],_[_0x17c4('0x4f')](_0x47d3ca[_0x17c4('0x4a')],[_0x17c4('0x4e'),'id'])||{});}})[_0x17c4('0x24')](respondWithResult(_0x545718,null))[_0x17c4('0x3f')](handleError(_0x545718,null));};exports[_0x17c4('0x50')]=function(_0x43f093,_0x314030,_0x1ef938){var _0x1686ba={};var _0x1a5f84={};var _0x1f516b;var _0x2689d2;return db[_0x17c4('0x2b')][_0x17c4('0x51')]({'where':{'id':_0x43f093[_0x17c4('0x41')]['id']}})[_0x17c4('0x24')](handleEntityNotFound(_0x314030,null))['then'](function(_0x1baf5e){if(_0x1baf5e){_0x1f516b=_0x1baf5e;_0x1a5f84[_0x17c4('0x2d')]=_[_0x17c4('0x2e')](db['CmContact']['rawAttributes']);_0x1a5f84[_0x17c4('0x34')]=_['keys'](_0x43f093['query']);_0x1a5f84['filters']=_[_0x17c4('0x31')](_0x1a5f84['model'],_0x1a5f84['query']);_0x1686ba[_0x17c4('0x30')]=_['intersection'](_0x1a5f84['model'],qs['fields'](_0x43f093[_0x17c4('0x34')][_0x17c4('0x32')]));_0x1686ba[_0x17c4('0x30')]=_0x1686ba[_0x17c4('0x30')]['length']?_0x1686ba['attributes']:_0x1a5f84[_0x17c4('0x2d')];_0x1686ba['order']=qs['sort'](_0x43f093['query']['sort']);_0x1686ba['where']=qs[_0x17c4('0x2f')](_['pick'](_0x43f093['query'],_0x1a5f84['filters']));if(_0x43f093[_0x17c4('0x34')][_0x17c4('0x39')]){_0x1686ba[_0x17c4('0x37')]=_['merge'](_0x1686ba[_0x17c4('0x37')],{'$or':_[_0x17c4('0x52')](_0x1686ba[_0x17c4('0x30')],function(_0x2e44a3){var _0x1e4988={};_0x1e4988[_0x2e44a3]={'$like':'%'+_0x43f093['query']['filter']+'%'};return _0x1e4988;})});}_0x1686ba=_[_0x17c4('0x3a')]({},_0x1686ba,_0x43f093['options']);return _0x1f516b[_0x17c4('0x50')](_0x1686ba);}})['then'](function(_0x26ef04){if(_0x26ef04){_0x2689d2=_0x26ef04[_0x17c4('0x53')];if(!_0x43f093[_0x17c4('0x34')][_0x17c4('0x33')](_0x17c4('0x54'))){_0x1686ba[_0x17c4('0x1d')]=qs['limit'](_0x43f093[_0x17c4('0x34')][_0x17c4('0x1d')]);_0x1686ba[_0x17c4('0x1b')]=qs[_0x17c4('0x1b')](_0x43f093[_0x17c4('0x34')]['offset']);}return _0x1f516b['getContacts'](_0x1686ba);}})[_0x17c4('0x24')](function(_0x1929fe){if(_0x1929fe){return _0x1929fe?{'count':_0x2689d2,'rows':_0x1929fe}:null;}})['then'](respondWithResult(_0x314030,null))[_0x17c4('0x3f')](handleError(_0x314030,null));}; \ No newline at end of file +var _0xee93=['show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','ids','getContacts','findOne','nolimit','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','stack','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','map','merge','include','findAll','rows','catch'];(function(_0xf7831f,_0x1c6188){var _0x3f88e7=function(_0x2c6d4e){while(--_0x2c6d4e){_0xf7831f['push'](_0xf7831f['shift']());}};_0x3f88e7(++_0x1c6188);}(_0xee93,0xb7));var _0x3ee9=function(_0x5071e6,_0x2d2133){_0x5071e6=_0x5071e6-0x0;var _0x1d70c0=_0xee93[_0x5071e6];return _0x1d70c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ee9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ee9('0x1'));var rp=require('request-promise');var moment=require(_0x3ee9('0x2'));var BPromise=require(_0x3ee9('0x3'));var Mustache=require('mustache');var util=require(_0x3ee9('0x4'));var path=require(_0x3ee9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ee9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ee9('0x7'));var squel=require(_0x3ee9('0x8'));var crypto=require(_0x3ee9('0x9'));var jsforce=require(_0x3ee9('0xa'));var deskjs=require(_0x3ee9('0xb'));var toCsv=require(_0x3ee9('0xc'));var querystring=require(_0x3ee9('0xd'));var Papa=require(_0x3ee9('0xe'));var Redis=require(_0x3ee9('0xf'));var authService=require(_0x3ee9('0x10'));var qs=require(_0x3ee9('0x11'));var as=require(_0x3ee9('0x12'));var hardwareService=require(_0x3ee9('0x13'));var logger=require(_0x3ee9('0x14'))(_0x3ee9('0x15'));var utils=require(_0x3ee9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3ee9('0x17'))['db'];function respondWithStatusCode(_0x6a06c4,_0x34306f){_0x34306f=_0x34306f||0xcc;return function(_0x508e6f){if(_0x508e6f){return _0x6a06c4[_0x3ee9('0x18')](_0x34306f);}return _0x6a06c4[_0x3ee9('0x19')](_0x34306f)[_0x3ee9('0x1a')]();};}function respondWithResult(_0x161493,_0x1232a3){_0x1232a3=_0x1232a3||0xc8;return function(_0x8bb3a2){if(_0x8bb3a2){return _0x161493[_0x3ee9('0x19')](_0x1232a3)[_0x3ee9('0x1b')](_0x8bb3a2);}};}function respondWithFilteredResult(_0x4ffa1e,_0x3904d8){return function(_0x331297){if(_0x331297){var _0x2a6b64=typeof _0x3904d8[_0x3ee9('0x1c')]==='undefined'&&typeof _0x3904d8[_0x3ee9('0x1d')]===_0x3ee9('0x1e');var _0x1a7058=_0x331297[_0x3ee9('0x1f')];var _0x3d34f1=_0x2a6b64?0x0:_0x3904d8[_0x3ee9('0x1c')];var _0x24692a=_0x2a6b64?_0x331297[_0x3ee9('0x1f')]:_0x3904d8['offset']+_0x3904d8[_0x3ee9('0x1d')];var _0x496793;if(_0x24692a>=_0x1a7058){_0x24692a=_0x1a7058;_0x496793=0xc8;}else{_0x496793=0xce;}_0x4ffa1e[_0x3ee9('0x19')](_0x496793);return _0x4ffa1e['set'](_0x3ee9('0x20'),_0x3d34f1+'-'+_0x24692a+'/'+_0x1a7058)[_0x3ee9('0x1b')](_0x331297);}return null;};}function patchUpdates(_0x4cd0e0){return function(_0x2d72b6){try{jsonpatch[_0x3ee9('0x21')](_0x2d72b6,_0x4cd0e0,!![]);}catch(_0x338252){return BPromise[_0x3ee9('0x22')](_0x338252);}return _0x2d72b6[_0x3ee9('0x23')]();};}function saveUpdates(_0x5f331b,_0x1d97fc){return function(_0x327dbc){if(_0x327dbc){return _0x327dbc[_0x3ee9('0x24')](_0x5f331b)[_0x3ee9('0x25')](function(_0x1d395f){return _0x1d395f;});}return null;};}function removeEntity(_0x5f4309,_0x398930){return function(_0x51e0e3){if(_0x51e0e3){return _0x51e0e3['destroy']()[_0x3ee9('0x25')](function(){var _0x49709d=_0x51e0e3[_0x3ee9('0x26')]({'plain':!![]});var _0x340def=_0x3ee9('0x27');return db[_0x3ee9('0x28')][_0x3ee9('0x29')]({'where':{'type':_0x340def,'resourceId':_0x49709d['id']}})[_0x3ee9('0x25')](function(){return _0x51e0e3;});})[_0x3ee9('0x25')](function(){_0x5f4309[_0x3ee9('0x19')](0xcc)[_0x3ee9('0x1a')]();});}};}function handleEntityNotFound(_0x37ae69,_0x3dc86e){return function(_0x37a396){if(!_0x37a396){_0x37ae69[_0x3ee9('0x18')](0x194);}return _0x37a396;};}function handleError(_0x5e22da,_0x204d99){_0x204d99=_0x204d99||0x1f4;return function(_0xb49ff6){logger['error'](_0xb49ff6[_0x3ee9('0x2a')]);if(_0xb49ff6[_0x3ee9('0x2b')]){delete _0xb49ff6[_0x3ee9('0x2b')];}_0x5e22da[_0x3ee9('0x19')](_0x204d99)['send'](_0xb49ff6);};}exports[_0x3ee9('0x2c')]=function(_0x331ab3,_0x20e902){var _0x539bdb={},_0x2ca988={},_0x482ab4={'count':0x0,'rows':[]};return db[_0x3ee9('0x2d')][_0x3ee9('0x2e')]()[_0x3ee9('0x25')](function(_0x3a6463){_0x2ca988[_0x3ee9('0x2f')]=_[_0x3ee9('0x30')](_0x3a6463);_0x2ca988['query']=_['keys'](_0x331ab3[_0x3ee9('0x31')]);_0x2ca988['filters']=_[_0x3ee9('0x32')](_0x2ca988[_0x3ee9('0x2f')],_0x2ca988[_0x3ee9('0x31')]);_0x539bdb[_0x3ee9('0x33')]=_[_0x3ee9('0x32')](_0x2ca988[_0x3ee9('0x2f')],qs[_0x3ee9('0x34')](_0x331ab3[_0x3ee9('0x31')]['fields']));_0x539bdb[_0x3ee9('0x33')]=_0x539bdb['attributes'][_0x3ee9('0x35')]?_0x539bdb[_0x3ee9('0x33')]:_0x2ca988['model'];if(!_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x36')]('nolimit')){_0x539bdb[_0x3ee9('0x1d')]=qs[_0x3ee9('0x1d')](_0x331ab3['query'][_0x3ee9('0x1d')]);_0x539bdb[_0x3ee9('0x1c')]=qs[_0x3ee9('0x1c')](_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x1c')]);}_0x539bdb[_0x3ee9('0x37')]=qs[_0x3ee9('0x38')](_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x38')]);_0x539bdb[_0x3ee9('0x39')]=qs[_0x3ee9('0x3a')](_['pick'](_0x331ab3[_0x3ee9('0x31')],_0x2ca988[_0x3ee9('0x3a')]),_0x3a6463);if(_0x331ab3[_0x3ee9('0x31')][_0x3ee9('0x3b')]){_0x539bdb[_0x3ee9('0x39')]=_['merge'](_0x539bdb['where'],{'$or':_[_0x3ee9('0x3c')](_0x539bdb['attributes'],function(_0x1704a6){var _0x26e08d={};_0x26e08d[_0x1704a6]={'$like':'%'+_0x331ab3[_0x3ee9('0x31')]['filter']+'%'};return _0x26e08d;})});}_0x539bdb=_[_0x3ee9('0x3d')]({},_0x539bdb,_0x331ab3['options']);var _0x4c21aa={'where':_0x539bdb['where']};return db[_0x3ee9('0x2d')]['count'](_0x4c21aa)['then'](function(_0x20a4e5){_0x482ab4[_0x3ee9('0x1f')]=_0x20a4e5;if(_0x331ab3[_0x3ee9('0x31')]['includeAll']){_0x539bdb[_0x3ee9('0x3e')]=[{'all':!![]}];}return db[_0x3ee9('0x2d')][_0x3ee9('0x3f')](_0x539bdb);})['then'](function(_0x2dedea){_0x482ab4[_0x3ee9('0x40')]=_0x2dedea;return _0x482ab4;})[_0x3ee9('0x25')](respondWithFilteredResult(_0x20e902,_0x539bdb))[_0x3ee9('0x41')](handleError(_0x20e902,null));})[_0x3ee9('0x41')](handleError(_0x20e902,null));};exports[_0x3ee9('0x42')]=function(_0x321c03,_0x4903e9){var _0x479eb7={'raw':![],'where':{'id':_0x321c03[_0x3ee9('0x43')]['id']}},_0xbe2438={};_0xbe2438[_0x3ee9('0x2f')]=_[_0x3ee9('0x30')](db[_0x3ee9('0x2d')]['rawAttributes']);_0xbe2438[_0x3ee9('0x31')]=_[_0x3ee9('0x30')](_0x321c03['query']);_0xbe2438['filters']=_[_0x3ee9('0x32')](_0xbe2438['model'],_0xbe2438[_0x3ee9('0x31')]);_0x479eb7[_0x3ee9('0x33')]=_[_0x3ee9('0x32')](_0xbe2438[_0x3ee9('0x2f')],qs[_0x3ee9('0x34')](_0x321c03[_0x3ee9('0x31')][_0x3ee9('0x34')]));_0x479eb7[_0x3ee9('0x33')]=_0x479eb7['attributes'][_0x3ee9('0x35')]?_0x479eb7[_0x3ee9('0x33')]:_0xbe2438[_0x3ee9('0x2f')];if(_0x321c03[_0x3ee9('0x31')]['includeAll']){_0x479eb7[_0x3ee9('0x3e')]=[{'all':!![]}];}_0x479eb7=_[_0x3ee9('0x3d')]({},_0x479eb7,_0x321c03[_0x3ee9('0x44')]);return db[_0x3ee9('0x2d')][_0x3ee9('0x45')](_0x479eb7)[_0x3ee9('0x25')](handleEntityNotFound(_0x4903e9,null))[_0x3ee9('0x25')](respondWithResult(_0x4903e9,null))[_0x3ee9('0x41')](handleError(_0x4903e9,null));};exports[_0x3ee9('0x46')]=function(_0x223289,_0x3e7a1e){return db[_0x3ee9('0x2d')]['create'](_0x223289[_0x3ee9('0x47')],{})[_0x3ee9('0x25')](function(_0x19ea60){var _0xae10d=_0x223289['user'][_0x3ee9('0x26')]({'plain':!![]});if(!_0xae10d)throw new Error(_0x3ee9('0x48'));if(_0xae10d[_0x3ee9('0x49')]==='user'){var _0xf7456a=_0x19ea60[_0x3ee9('0x26')]({'plain':!![]});var _0x54073a=_0x3ee9('0x27');return db[_0x3ee9('0x4a')][_0x3ee9('0x45')]({'where':{'name':_0x54073a,'userProfileId':_0xae10d[_0x3ee9('0x4b')]},'raw':!![]})[_0x3ee9('0x25')](function(_0x519049){if(_0x519049&&_0x519049[_0x3ee9('0x4c')]===0x0){return db[_0x3ee9('0x28')][_0x3ee9('0x46')]({'name':_0xf7456a[_0x3ee9('0x2b')],'resourceId':_0xf7456a['id'],'type':_0x519049['name'],'sectionId':_0x519049['id']},{})[_0x3ee9('0x25')](function(){return _0x19ea60;});}else{return _0x19ea60;}})[_0x3ee9('0x41')](function(_0x44616e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44616e);throw _0x44616e;});}return _0x19ea60;})[_0x3ee9('0x25')](respondWithResult(_0x3e7a1e,0xc9))['catch'](handleError(_0x3e7a1e,null));};exports[_0x3ee9('0x24')]=function(_0x58b4ac,_0x3ba862){if(_0x58b4ac[_0x3ee9('0x47')]['id']){delete _0x58b4ac[_0x3ee9('0x47')]['id'];}return db['CmCompany'][_0x3ee9('0x45')]({'where':{'id':_0x58b4ac[_0x3ee9('0x43')]['id']}})[_0x3ee9('0x25')](handleEntityNotFound(_0x3ba862,null))[_0x3ee9('0x25')](saveUpdates(_0x58b4ac[_0x3ee9('0x47')],null))[_0x3ee9('0x25')](respondWithResult(_0x3ba862,null))[_0x3ee9('0x41')](handleError(_0x3ba862,null));};exports[_0x3ee9('0x29')]=function(_0x1da407,_0x483cbe){return db[_0x3ee9('0x2d')][_0x3ee9('0x45')]({'where':{'id':_0x1da407['params']['id']}})[_0x3ee9('0x25')](handleEntityNotFound(_0x483cbe,null))[_0x3ee9('0x25')](removeEntity(_0x483cbe,null))[_0x3ee9('0x41')](handleError(_0x483cbe,null));};exports[_0x3ee9('0x2e')]=function(_0x900814,_0x29cefc){return db[_0x3ee9('0x2d')]['describe']()[_0x3ee9('0x25')](respondWithResult(_0x29cefc,null))[_0x3ee9('0x41')](handleError(_0x29cefc,null));};exports[_0x3ee9('0x4d')]=function(_0x401846,_0x58cb8b,_0x37d7ec){return db[_0x3ee9('0x4e')][_0x3ee9('0x45')]({'where':{'id':_0x401846[_0x3ee9('0x43')]['id']}})[_0x3ee9('0x25')](handleEntityNotFound(_0x58cb8b,null))[_0x3ee9('0x25')](function(_0x3fc687){if(_0x3fc687){return _0x3fc687[_0x3ee9('0x4d')](_0x401846[_0x3ee9('0x47')][_0x3ee9('0x4f')],_['omit'](_0x401846[_0x3ee9('0x47')],[_0x3ee9('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x58cb8b,null))['catch'](handleError(_0x58cb8b,null));};exports[_0x3ee9('0x50')]=function(_0x147eed,_0xcfa16f,_0x4d3bf2){var _0x1d67c0={};var _0x442ff3={};var _0x3c8340;var _0x286600;return db[_0x3ee9('0x2d')][_0x3ee9('0x51')]({'where':{'id':_0x147eed['params']['id']}})['then'](handleEntityNotFound(_0xcfa16f,null))[_0x3ee9('0x25')](function(_0x497f36){if(_0x497f36){_0x3c8340=_0x497f36;_0x442ff3['model']=_[_0x3ee9('0x30')](db[_0x3ee9('0x4e')]['rawAttributes']);_0x442ff3[_0x3ee9('0x31')]=_['keys'](_0x147eed[_0x3ee9('0x31')]);_0x442ff3[_0x3ee9('0x3a')]=_['intersection'](_0x442ff3[_0x3ee9('0x2f')],_0x442ff3[_0x3ee9('0x31')]);_0x1d67c0[_0x3ee9('0x33')]=_[_0x3ee9('0x32')](_0x442ff3[_0x3ee9('0x2f')],qs[_0x3ee9('0x34')](_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x34')]));_0x1d67c0['attributes']=_0x1d67c0[_0x3ee9('0x33')][_0x3ee9('0x35')]?_0x1d67c0['attributes']:_0x442ff3[_0x3ee9('0x2f')];_0x1d67c0[_0x3ee9('0x37')]=qs[_0x3ee9('0x38')](_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x38')]);_0x1d67c0[_0x3ee9('0x39')]=qs['filters'](_['pick'](_0x147eed[_0x3ee9('0x31')],_0x442ff3[_0x3ee9('0x3a')]));if(_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x3b')]){_0x1d67c0['where']=_['merge'](_0x1d67c0[_0x3ee9('0x39')],{'$or':_[_0x3ee9('0x3c')](_0x1d67c0[_0x3ee9('0x33')],function(_0x1f6d3a){var _0x23a7c5={};_0x23a7c5[_0x1f6d3a]={'$like':'%'+_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x3b')]+'%'};return _0x23a7c5;})});}_0x1d67c0=_['merge']({},_0x1d67c0,_0x147eed[_0x3ee9('0x44')]);return _0x3c8340[_0x3ee9('0x50')](_0x1d67c0);}})[_0x3ee9('0x25')](function(_0x252c2a){if(_0x252c2a){_0x286600=_0x252c2a[_0x3ee9('0x35')];if(!_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x36')](_0x3ee9('0x52'))){_0x1d67c0[_0x3ee9('0x1d')]=qs[_0x3ee9('0x1d')](_0x147eed[_0x3ee9('0x31')]['limit']);_0x1d67c0[_0x3ee9('0x1c')]=qs[_0x3ee9('0x1c')](_0x147eed[_0x3ee9('0x31')][_0x3ee9('0x1c')]);}return _0x3c8340[_0x3ee9('0x50')](_0x1d67c0);}})[_0x3ee9('0x25')](function(_0x2f260d){if(_0x2f260d){return _0x2f260d?{'count':_0x286600,'rows':_0x2f260d}:null;}})['then'](respondWithResult(_0xcfa16f,null))['catch'](handleError(_0xcfa16f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 76c4c57..98d578a 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 _0xcd56=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger'];(function(_0x4f921d,_0x5cf169){var _0x4382a8=function(_0x2a6721){while(--_0x2a6721){_0x4f921d['push'](_0x4f921d['shift']());}};_0x4382a8(++_0x5cf169);}(_0xcd56,0x66));var _0x6cd5=function(_0x3f883d,_0x28a22e){_0x3f883d=_0x3f883d-0x0;var _0x51bcb1=_0xcd56[_0x3f883d];return _0x51bcb1;};'use strict';var _=require('lodash');var util=require(_0x6cd5('0x0'));var logger=require(_0x6cd5('0x1'))(_0x6cd5('0x2'));var moment=require('moment');var BPromise=require(_0x6cd5('0x3'));var rp=require(_0x6cd5('0x4'));var fs=require('fs');var path=require(_0x6cd5('0x5'));var rimraf=require(_0x6cd5('0x6'));var config=require(_0x6cd5('0x7'));var attributes=require(_0x6cd5('0x8'));module[_0x6cd5('0x9')]=function(_0x196fb7,_0x163c9c){return _0x196fb7[_0x6cd5('0xa')](_0x6cd5('0xb'),attributes,{'tableName':_0x6cd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3243=['CmCompany','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0x3243,0x188));var _0x3324=function(_0x125217,_0x1732ba){_0x125217=_0x125217-0x0;var _0x67dfb1=_0x3243[_0x125217];return _0x67dfb1;};'use strict';var _=require('lodash');var util=require(_0x3324('0x0'));var logger=require(_0x3324('0x1'))(_0x3324('0x2'));var moment=require('moment');var BPromise=require(_0x3324('0x3'));var rp=require(_0x3324('0x4'));var fs=require('fs');var path=require(_0x3324('0x5'));var rimraf=require(_0x3324('0x6'));var config=require(_0x3324('0x7'));var attributes=require(_0x3324('0x8'));module[_0x3324('0x9')]=function(_0x3b07f0,_0x27336e){return _0x3b07f0[_0x3324('0xa')](_0x3324('0xb'),attributes,{'tableName':_0x3324('0xc'),'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 3a12170..0111047 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 _0x702b=['lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x702b,0x168));var _0xb702=function(_0x3fa173,_0x40a115){_0x3fa173=_0x3fa173-0x0;var _0x554d4b=_0x702b[_0x3fa173];return _0x554d4b;};'use strict';var _=require(_0xb702('0x0'));var util=require('util');var moment=require(_0xb702('0x1'));var BPromise=require(_0xb702('0x2'));var rs=require(_0xb702('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb702('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb702('0x5'));var config=require(_0xb702('0x6'));var jayson=require(_0xb702('0x7'));var client=jayson[_0xb702('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8e8e52,_0x14d43e,_0xd1a309){return new BPromise(function(_0x6af90f,_0x3418b0){return client['request'](_0x8e8e52,_0xd1a309)['then'](function(_0x580e32){logger[_0xb702('0x9')](_0xb702('0xa'),_0x14d43e,_0xb702('0xb'));logger[_0xb702('0xc')](_0xb702('0xd'),_0x14d43e,_0xb702('0xb'),JSON['stringify'](_0x580e32));if(_0x580e32[_0xb702('0xe')]){if(_0x580e32[_0xb702('0xe')][_0xb702('0xf')]===0x1f4){logger[_0xb702('0xe')](_0xb702('0xa'),_0x14d43e,_0x580e32['error'][_0xb702('0x10')]);return _0x3418b0(_0x580e32[_0xb702('0xe')][_0xb702('0x10')]);}logger[_0xb702('0xe')](_0xb702('0xa'),_0x14d43e,_0x580e32[_0xb702('0xe')][_0xb702('0x10')]);return _0x6af90f(_0x580e32['error'][_0xb702('0x10')]);}else{logger['info'](_0xb702('0xa'),_0x14d43e,'request\x20sent');_0x6af90f(_0x580e32[_0xb702('0x11')][_0xb702('0x10')]);}})['catch'](function(_0x1c5afd){logger[_0xb702('0xe')]('CmCompany,\x20%s,\x20%s',_0x14d43e,_0x1c5afd);_0x3418b0(_0x1c5afd);});});} \ No newline at end of file +var _0xd676=['request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x12adc,_0x1bb467){var _0x547ee0=function(_0x31af14){while(--_0x31af14){_0x12adc['push'](_0x12adc['shift']());}};_0x547ee0(++_0x1bb467);}(_0xd676,0x146));var _0x6d67=function(_0x48535c,_0x33c086){_0x48535c=_0x48535c-0x0;var _0x2cf084=_0xd676[_0x48535c];return _0x2cf084;};'use strict';var _=require(_0x6d67('0x0'));var util=require(_0x6d67('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d67('0x2'));var fs=require('fs');var Redis=require(_0x6d67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d67('0x4'));var logger=require(_0x6d67('0x5'))(_0x6d67('0x6'));var config=require('../../config/environment');var jayson=require(_0x6d67('0x7'));var client=jayson[_0x6d67('0x8')][_0x6d67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x496481,_0x3baee3,_0x1be523){return new BPromise(function(_0x411a33,_0xe22eac){return client[_0x6d67('0xa')](_0x496481,_0x1be523)[_0x6d67('0xb')](function(_0x5a2245){logger[_0x6d67('0xc')](_0x6d67('0xd'),_0x3baee3,'request\x20sent');logger[_0x6d67('0xe')](_0x6d67('0xf'),_0x3baee3,'request\x20sent',JSON['stringify'](_0x5a2245));if(_0x5a2245[_0x6d67('0x10')]){if(_0x5a2245[_0x6d67('0x10')]['code']===0x1f4){logger[_0x6d67('0x10')](_0x6d67('0xd'),_0x3baee3,_0x5a2245[_0x6d67('0x10')][_0x6d67('0x11')]);return _0xe22eac(_0x5a2245[_0x6d67('0x10')][_0x6d67('0x11')]);}logger[_0x6d67('0x10')](_0x6d67('0xd'),_0x3baee3,_0x5a2245[_0x6d67('0x10')][_0x6d67('0x11')]);return _0x411a33(_0x5a2245['error'][_0x6d67('0x11')]);}else{logger['info'](_0x6d67('0xd'),_0x3baee3,_0x6d67('0x12'));_0x411a33(_0x5a2245[_0x6d67('0x13')][_0x6d67('0x11')]);}})[_0x6d67('0x14')](function(_0x521aa3){logger[_0x6d67('0x10')](_0x6d67('0xd'),_0x3baee3,_0x521aa3);_0xe22eac(_0x521aa3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ba81400..309e6e4 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 _0x79bf=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util'];(function(_0x39bed8,_0xcf6104){var _0x5e4003=function(_0x445372){while(--_0x445372){_0x39bed8['push'](_0x39bed8['shift']());}};_0x5e4003(++_0xcf6104);}(_0x79bf,0x1df));var _0xf79b=function(_0x582210,_0x184c36){_0x582210=_0x582210-0x0;var _0x18cf58=_0x79bf[_0x582210];return _0x18cf58;};'use strict';var multer=require('multer');var util=require(_0xf79b('0x0'));var path=require('path');var timeout=require(_0xf79b('0x1'));var express=require('express');var router=express[_0xf79b('0x2')]();var fs_extra=require(_0xf79b('0x3'));var auth=require(_0xf79b('0x4'));var interaction=require(_0xf79b('0x5'));var config=require(_0xf79b('0x6'));var controller=require(_0xf79b('0x7'));router[_0xf79b('0x8')]('/',auth['isAuthenticated'](),controller[_0xf79b('0x9')]);router[_0xf79b('0x8')](_0xf79b('0xa'),auth['isAuthenticated'](),controller[_0xf79b('0xb')]);router[_0xf79b('0x8')](_0xf79b('0xc'),auth[_0xf79b('0xd')](),controller['show']);router['get'](_0xf79b('0xe'),auth[_0xf79b('0xd')](),controller[_0xf79b('0xf')]);router[_0xf79b('0x10')]('/',auth[_0xf79b('0xd')](),controller[_0xf79b('0x11')]);router[_0xf79b('0x10')]('/:id/contacts',auth[_0xf79b('0xd')](),controller[_0xf79b('0x12')]);router[_0xf79b('0x13')](_0xf79b('0xc'),auth[_0xf79b('0xd')](),controller[_0xf79b('0x14')]);router[_0xf79b('0x15')](_0xf79b('0xc'),auth[_0xf79b('0xd')](),controller[_0xf79b('0x16')]);module[_0xf79b('0x17')]=router; \ No newline at end of file +var _0x2f99=['post','create','addContacts','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','/describe','/:id/contacts'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x2f99,0x184));var _0x92f9=function(_0x29dedd,_0x3c7419){_0x29dedd=_0x29dedd-0x0;var _0x4e6d4f=_0x2f99[_0x29dedd];return _0x4e6d4f;};'use strict';var multer=require(_0x92f9('0x0'));var util=require(_0x92f9('0x1'));var path=require(_0x92f9('0x2'));var timeout=require(_0x92f9('0x3'));var express=require(_0x92f9('0x4'));var router=express['Router']();var fs_extra=require(_0x92f9('0x5'));var auth=require(_0x92f9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x92f9('0x7'));router[_0x92f9('0x8')]('/',auth[_0x92f9('0x9')](),controller['index']);router['get'](_0x92f9('0xa'),auth[_0x92f9('0x9')](),controller['describe']);router[_0x92f9('0x8')]('/:id',auth[_0x92f9('0x9')](),controller['show']);router[_0x92f9('0x8')](_0x92f9('0xb'),auth['isAuthenticated'](),controller['getContacts']);router[_0x92f9('0xc')]('/',auth['isAuthenticated'](),controller[_0x92f9('0xd')]);router[_0x92f9('0xc')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x92f9('0xe')]);router[_0x92f9('0xf')](_0x92f9('0x10'),auth[_0x92f9('0x9')](),controller['update']);router[_0x92f9('0x11')](_0x92f9('0x10'),auth[_0x92f9('0x9')](),controller[_0x92f9('0x12')]);module[_0x92f9('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 611eeed..60c50ad 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 _0x159f=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x159f,0xf6));var _0xf159=function(_0x352f4b,_0xa59ba5){_0x352f4b=_0x352f4b-0x0;var _0xcb68c4=_0x159f[_0x352f4b];return _0xcb68c4;};'use strict';var _=require(_0xf159('0x0'));var Sequelize=require('sequelize');module[_0xf159('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xf159('0x2')]},'street':{'type':Sequelize[_0xf159('0x2')]},'postalCode':{'type':Sequelize[_0xf159('0x2')]},'city':{'type':Sequelize[_0xf159('0x2')]},'country':{'type':Sequelize[_0xf159('0x2')]},'dateOfBirth':{'type':Sequelize[_0xf159('0x2')]},'description':{'type':Sequelize[_0xf159('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xf159('0x2')]},'fax':{'type':Sequelize[_0xf159('0x2')]},'email':{'type':Sequelize[_0xf159('0x2')]},'url':{'type':Sequelize[_0xf159('0x2')]},'facebook':{'type':Sequelize[_0xf159('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xf159('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xf159('0x2')]},'viber':{'type':Sequelize[_0xf159('0x2')]},'line':{'type':Sequelize[_0xf159('0x2')]},'wechat':{'type':Sequelize[_0xf159('0x2')]},'telegram':{'type':Sequelize[_0xf159('0x2')]},'UserId':{'type':Sequelize[_0xf159('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf159('0x4')](0x2)[_0xf159('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xf159('0x6')]},'dialTimezone':{'type':Sequelize[_0xf159('0x2')]},'utcOffset':{'type':Sequelize[_0xf159('0x4')]}}; \ No newline at end of file +var _0x0b34=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x1eafee,_0x3f5d73){var _0x356c18=function(_0x3f6514){while(--_0x3f6514){_0x1eafee['push'](_0x1eafee['shift']());}};_0x356c18(++_0x3f5d73);}(_0x0b34,0x6b));var _0x40b3=function(_0x58603b,_0x12e69d){_0x58603b=_0x58603b-0x0;var _0x34048d=_0x0b34[_0x58603b];return _0x34048d;};'use strict';var _=require(_0x40b3('0x0'));var Sequelize=require(_0x40b3('0x1'));module[_0x40b3('0x2')]={'firstName':{'type':Sequelize[_0x40b3('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x40b3('0x3')]},'street':{'type':Sequelize[_0x40b3('0x3')]},'postalCode':{'type':Sequelize[_0x40b3('0x3')]},'city':{'type':Sequelize[_0x40b3('0x3')]},'country':{'type':Sequelize[_0x40b3('0x3')]},'dateOfBirth':{'type':Sequelize[_0x40b3('0x3')]},'description':{'type':Sequelize[_0x40b3('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x40b3('0x3')]},'fax':{'type':Sequelize[_0x40b3('0x3')]},'email':{'type':Sequelize[_0x40b3('0x3')]},'url':{'type':Sequelize[_0x40b3('0x3')]},'facebook':{'type':Sequelize[_0x40b3('0x3')]},'fb_data':{'type':Sequelize[_0x40b3('0x3')]},'twitter':{'type':Sequelize[_0x40b3('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x40b3('0x3')]},'viber':{'type':Sequelize[_0x40b3('0x3')]},'line':{'type':Sequelize[_0x40b3('0x3')]},'wechat':{'type':Sequelize[_0x40b3('0x3')]},'telegram':{'type':Sequelize[_0x40b3('0x3')]},'UserId':{'type':Sequelize[_0x40b3('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x40b3('0x5')](0x2)[_0x40b3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x40b3('0x7')],'defaultValue':Sequelize[_0x40b3('0x8')]},'dialTimezone':{'type':Sequelize[_0x40b3('0x3')]},'utcOffset':{'type':Sequelize[_0x40b3('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3de4593..378796e 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 _0xc1b0=['rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals','uploadCsv','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','agent','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','importUpdates','error\x20child\x20process','getJourney','mail','chat','sms','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','voice','uniqueid','type','destination','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','DESC','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','findAndCountAll','reverse','value','slice','moment','bluebird','util','path','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','offset','undefined','count','limit','status','set','Content-Range','json','update','destroy','then','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','length','cf_','columnName','displayName','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','$or','push','where','ListId','findOrCreate','spread','contact','all','Tag','Tags','color','tag','Phones','ContactItemType','sequelize','literal','$and','CmCustomField','omit','map','format','cf_%d','pickBy','startsWith','isEmpty','table','cm_contacts','text','values','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','options','getTags','nolimit','setTags','ids','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','ItemType','ItemType.OrderBy','bulkCreate','hasOwnProperty','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId'];(function(_0x11b47c,_0x27df19){var _0x3d2286=function(_0x383c54){while(--_0x383c54){_0x11b47c['push'](_0x11b47c['shift']());}};_0x3d2286(++_0x27df19);}(_0xc1b0,0x69));var _0x0c1b=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xc1b0[_0x49e584];return _0x58b1be;};'use strict';var moment=require(_0x0c1b('0x0'));var BPromise=require(_0x0c1b('0x1'));var util=require(_0x0c1b('0x2'));var path=require(_0x0c1b('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c1b('0x4'));var Papa=require(_0x0c1b('0x5'));var Redis=require(_0x0c1b('0x6'));var contacts=require(_0x0c1b('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x0c1b('0x8'))(_0x0c1b('0x9'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x0c1b('0xa')]=_[_0x0c1b('0xb')](config[_0x0c1b('0xa')],{'host':_0x0c1b('0xc'),'port':0x18eb});var socket=require(_0x0c1b('0xd'))(new Redis(config[_0x0c1b('0xa')]));require(_0x0c1b('0xe'))[_0x0c1b('0xf')](socket);function respondWithResult(_0x542834,_0x5ab570){_0x5ab570=_0x5ab570||0xc8;return function(_0x4851f4){if(_0x4851f4){return _0x542834['status'](_0x5ab570)['json'](_0x4851f4);}};}function respondWithFilteredResult(_0x25034d,_0x49e537){return function(_0x3d42d8){if(_0x3d42d8){var _0x1c3f64=typeof _0x49e537[_0x0c1b('0x10')]===_0x0c1b('0x11')&&typeof _0x49e537['limit']===_0x0c1b('0x11');var _0x2eb274=_0x3d42d8[_0x0c1b('0x12')];var _0x349280=_0x1c3f64?0x0:_0x49e537[_0x0c1b('0x10')];var _0x3c7dd9=_0x1c3f64?_0x3d42d8[_0x0c1b('0x12')]:_0x49e537['offset']+_0x49e537[_0x0c1b('0x13')];var _0x2e3e5f;if(_0x3c7dd9>=_0x2eb274){_0x3c7dd9=_0x2eb274;_0x2e3e5f=0xc8;}else{_0x2e3e5f=0xce;}_0x25034d[_0x0c1b('0x14')](_0x2e3e5f);return _0x25034d[_0x0c1b('0x15')](_0x0c1b('0x16'),_0x349280+'-'+_0x3c7dd9+'/'+_0x2eb274)[_0x0c1b('0x17')](_0x3d42d8);}return null;};}function saveUpdates(_0x3e5684){return function(_0x2037d6){if(_0x2037d6){return _0x2037d6[_0x0c1b('0x18')](_0x3e5684)['then'](function(_0x5a3d40){return _0x5a3d40;});}return null;};}function removeEntity(_0x3d64af){return function(_0x1ad683){if(_0x1ad683){return _0x1ad683[_0x0c1b('0x19')]()[_0x0c1b('0x1a')](function(){_0x3d64af[_0x0c1b('0x14')](0xcc)[_0x0c1b('0x1b')]();});}};}function handleEntityNotFound(_0xa5634f){return function(_0x243b50){if(!_0x243b50){_0xa5634f[_0x0c1b('0x1c')](0x194);}return _0x243b50;};}function handleError(_0x2bb0e2,_0x2911de){_0x2911de=_0x2911de||0x1f4;return function(_0x319be5){logger['error'](_0x319be5[_0x0c1b('0x1d')]);if(_0x319be5[_0x0c1b('0x1e')]){delete _0x319be5[_0x0c1b('0x1e')];}_0x2bb0e2[_0x0c1b('0x14')](_0x2911de)[_0x0c1b('0x1f')](_0x319be5);};}exports[_0x0c1b('0x20')]=function(_0x3e8e33,_0x2656f5){var _0x58bbb6={};return contacts[_0x0c1b('0x21')]()[_0x0c1b('0x1a')](function(_0x59d423){_0x58bbb6=qs[_0x0c1b('0x22')](_0x59d423,_0x3e8e33);return contacts[_0x0c1b('0x23')](_0x3e8e33[_0x0c1b('0x24')],_0x3e8e33[_0x0c1b('0x25')],_0x58bbb6,_0x59d423);})[_0x0c1b('0x1a')](respondWithFilteredResult(_0x2656f5,_0x58bbb6))[_0x0c1b('0x26')](handleError(_0x2656f5,null));};exports[_0x0c1b('0x19')]=function(_0x28be5c,_0x37b311){return db[_0x0c1b('0x27')][_0x0c1b('0x28')]({'where':{'id':_0x28be5c[_0x0c1b('0x29')]['id']}})['then'](handleEntityNotFound(_0x37b311,null))['then'](removeEntity(_0x37b311,null))[_0x0c1b('0x26')](handleError(_0x37b311,null));};exports[_0x0c1b('0x21')]=function(_0x2bfddd,_0x17fc7e){return db['CmContact'][_0x0c1b('0x21')]()[_0x0c1b('0x1a')](function(_0x1fc0b1){delete _0x1fc0b1[_0x0c1b('0x2a')];for(var _0x3b7bfa=0x0;_0x3b7bfa0x0){return new Promise(function(_0x1ed831){var _0x1f1408=[];for(var _0x5aacd5=0x0;_0x5aacd5<_0x1d16be['length'];_0x5aacd5++){_0x1f1408[_0x0c1b('0x5b')](insertAdditionalPhones(_0x1d16be[_0x5aacd5][_0x0c1b('0x60')],_0x1d16be[_0x5aacd5][_0x0c1b('0x57')]));}Promise[_0x0c1b('0x61')](_0x1f1408)['then'](function(){_0x1ed831(0x1);});})[_0x0c1b('0x1a')](function(){return{'success':_0x4924ad,'failure':_0x40c3c9,'duplicates':_0x137cfd};});}else{return{'success':_0x4924ad,'failure':_0x40c3c9,'duplicates':_0x137cfd};}}})[_0x0c1b('0x1a')](respondWithResult(_0x235e4f,0xc9))[_0x0c1b('0x26')](handleError(_0x235e4f,null));};exports['show']=function(_0x4771eb,_0x236966){var _0x29135f;return db[_0x0c1b('0x27')][_0x0c1b('0x21')]()[_0x0c1b('0x1a')](function(_0x8808f3){return db['CmContact']['find']({'where':{'id':_0x4771eb[_0x0c1b('0x29')]['id']},'include':[{'model':db[_0x0c1b('0x62')],'as':_0x0c1b('0x63'),'attributes':['id',_0x0c1b('0x1e'),_0x0c1b('0x64')],'required':_0x4771eb[_0x0c1b('0x24')][_0x0c1b('0x65')]?!![]:![]},{'model':db[_0x0c1b('0x49')],'as':_0x0c1b('0x66'),'where':{'CmContactId':_0x4771eb[_0x0c1b('0x29')]['id']},'required':![],'include':[{'model':db[_0x0c1b('0x67')],'as':'ItemType'}]}],'order':[db[_0x0c1b('0x68')][_0x0c1b('0x69')]('Phones.OrderBy')],'attributes':_[_0x0c1b('0x2b')](_0x8808f3)});})[_0x0c1b('0x1a')](function(_0x4e5ab1){if(!_[_0x0c1b('0x53')](_0x4e5ab1)){_0x29135f=_0x4e5ab1[_0x0c1b('0x37')]({'plain':!![]});var _0x359d9f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4e5ab1&&_0x4e5ab1[_0x0c1b('0x5d')]){if(_0x4e5ab1['ListId']){_0x359d9f[_0x0c1b('0x5c')][_0x0c1b('0x6a')]['push']({'ListId':{'$ne':_0x4e5ab1[_0x0c1b('0x5d')]}});}}return db[_0x0c1b('0x6b')]['findAll'](_0x359d9f);}})[_0x0c1b('0x1a')](function(_0x86bf74){if(!_[_0x0c1b('0x53')](_0x86bf74)){return _[_0x0c1b('0x6c')](_0x29135f,_[_0x0c1b('0x6d')](_0x86bf74,function(_0x3c2ba8){return util[_0x0c1b('0x6e')](_0x0c1b('0x6f'),_0x3c2ba8['id']);}));}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x236966,null))[_0x0c1b('0x1a')](respondWithResult(_0x236966,null))['catch'](handleError(_0x236966,null));};exports[_0x0c1b('0x18')]=function(_0x3ddec0,_0x24d505){var _0x1fe3ff;if(_0x3ddec0[_0x0c1b('0x35')]['id']){delete _0x3ddec0[_0x0c1b('0x35')]['id'];}if(!_['isNil'](_0x3ddec0[_0x0c1b('0x35')]['dialTimezone'])){var _0x105d2b=_0x3ddec0[_0x0c1b('0x35')][_0x0c1b('0x54')];if(!_[_0x0c1b('0x53')](shared['timezones'][_0x105d2b]))_0x3ddec0[_0x0c1b('0x35')][_0x0c1b('0x56')]=shared[_0x0c1b('0x55')][_0x105d2b]['utcOffset'];}return db['CmContact']['find']({'where':{'id':_0x3ddec0[_0x0c1b('0x29')]['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x24d505,null))[_0x0c1b('0x1a')](saveUpdates(_0x3ddec0[_0x0c1b('0x35')],null))[_0x0c1b('0x1a')](function(_0x992a96){_0x1fe3ff=_0x992a96;var _0x3de197={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x992a96&&_0x992a96[_0x0c1b('0x5d')]){if(_0x992a96[_0x0c1b('0x5d')]){_0x3de197[_0x0c1b('0x5c')]['$and']['push']({'ListId':{'$ne':_0x992a96[_0x0c1b('0x5d')]}});}}return db[_0x0c1b('0x6b')][_0x0c1b('0x23')](_0x3de197);})[_0x0c1b('0x1a')](function(_0x224001){if(_0x224001){return _['omit'](_[_0x0c1b('0x70')](_0x3ddec0[_0x0c1b('0x35')],function(_0x2e5483,_0x655430){return _[_0x0c1b('0x71')](_0x655430,_0x0c1b('0x2d'));}),_['map'](_0x224001,function(_0x27eb5f){return util[_0x0c1b('0x6e')]('cf_%d',_0x27eb5f['id']);}));}})[_0x0c1b('0x1a')](function(_0x10fb3c){if(_0x10fb3c&&!_[_0x0c1b('0x72')](_0x10fb3c)){var _0x3fb41d=squel[_0x0c1b('0x18')]()[_0x0c1b('0x73')](_0x0c1b('0x74'))['setFields'](_0x10fb3c)['where']('id\x20=\x20?',_0x3ddec0[_0x0c1b('0x29')]['id'])['toParam']();return db['sequelize']['query'](_0x3fb41d[_0x0c1b('0x75')],{'replacements':_0x3fb41d[_0x0c1b('0x76')]});}})[_0x0c1b('0x1a')](function(){if(_0x3ddec0['body'][_0x0c1b('0x77')]&&_0x1fe3ff){return db[_0x0c1b('0x3c')]['update']({'phone':_0x3ddec0[_0x0c1b('0x35')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x1fe3ff['id']}});}})[_0x0c1b('0x1a')](function(){return _0x1fe3ff;})[_0x0c1b('0x1a')](respondWithResult(_0x24d505,null))[_0x0c1b('0x26')](handleError(_0x24d505,null));};exports['getTags']=function(_0x1b66f6,_0x355117){var _0x22d347={};var _0x1961da={};var _0x516bb1;var _0x1cae31;return db['CmContact'][_0x0c1b('0x78')]({'where':{'id':_0x1b66f6[_0x0c1b('0x29')]['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x355117,null))[_0x0c1b('0x1a')](function(_0x5b5790){if(_0x5b5790){_0x516bb1=_0x5b5790;_0x1961da[_0x0c1b('0x79')]=_[_0x0c1b('0x2b')](db[_0x0c1b('0x62')][_0x0c1b('0x7a')]);_0x1961da[_0x0c1b('0x24')]=_[_0x0c1b('0x2b')](_0x1b66f6[_0x0c1b('0x24')]);_0x1961da[_0x0c1b('0x7b')]=_[_0x0c1b('0x7c')](_0x1961da[_0x0c1b('0x79')],_0x1961da[_0x0c1b('0x24')]);_0x22d347[_0x0c1b('0x7d')]=_['intersection'](_0x1961da[_0x0c1b('0x79')],qs[_0x0c1b('0x7e')](_0x1b66f6[_0x0c1b('0x24')][_0x0c1b('0x7e')]));_0x22d347[_0x0c1b('0x7d')]=_0x22d347[_0x0c1b('0x7d')]['length']?_0x22d347['attributes']:_0x1961da[_0x0c1b('0x79')];_0x22d347[_0x0c1b('0x7f')]=qs[_0x0c1b('0x80')](_0x1b66f6[_0x0c1b('0x24')][_0x0c1b('0x80')]);_0x22d347['where']=qs[_0x0c1b('0x7b')](_[_0x0c1b('0x81')](_0x1b66f6[_0x0c1b('0x24')],_0x1961da['filters']));if(_0x1b66f6[_0x0c1b('0x24')][_0x0c1b('0x82')]){_0x22d347[_0x0c1b('0x5c')]=_[_0x0c1b('0x83')](_0x22d347['where'],{'$or':_[_0x0c1b('0x6d')](_0x22d347['attributes'],function(_0x286728){var _0x1e4bbe={};_0x1e4bbe[_0x286728]={'$like':'%'+_0x1b66f6['query'][_0x0c1b('0x82')]+'%'};return _0x1e4bbe;})});}_0x22d347=_[_0x0c1b('0x83')]({},_0x22d347,_0x1b66f6[_0x0c1b('0x84')]);return _0x516bb1[_0x0c1b('0x85')](_0x22d347);}})[_0x0c1b('0x1a')](function(_0x47c86e){if(_0x47c86e){_0x1cae31=_0x47c86e[_0x0c1b('0x2c')];if(!_0x1b66f6['query']['hasOwnProperty'](_0x0c1b('0x86'))){_0x22d347['limit']=qs[_0x0c1b('0x13')](_0x1b66f6[_0x0c1b('0x24')]['limit']);_0x22d347[_0x0c1b('0x10')]=qs[_0x0c1b('0x10')](_0x1b66f6['query'][_0x0c1b('0x10')]);}return _0x516bb1[_0x0c1b('0x85')](_0x22d347);}})['then'](function(_0x3cf5d0){if(_0x3cf5d0){return _0x3cf5d0?{'count':_0x1cae31,'rows':_0x3cf5d0}:null;}})[_0x0c1b('0x1a')](respondWithResult(_0x355117,null))[_0x0c1b('0x26')](handleError(_0x355117,null));};exports[_0x0c1b('0x87')]=function(_0x48c6a3,_0x540e09){if(_0x48c6a3['body']['id']){delete _0x48c6a3[_0x0c1b('0x35')]['id'];}return db[_0x0c1b('0x27')]['findOne']({'where':{'id':_0x48c6a3[_0x0c1b('0x29')]['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x540e09,null))[_0x0c1b('0x1a')](function(_0x257aae){if(_0x257aae){return _0x257aae[_0x0c1b('0x87')](_0x48c6a3[_0x0c1b('0x35')][_0x0c1b('0x88')]||[]);}return null;})[_0x0c1b('0x1a')](respondWithResult(_0x540e09,null))[_0x0c1b('0x26')](handleError(_0x540e09,null));};exports['setAdditionalPhones']=function(_0x521b6a,_0x513dbc){var _0x25c4a8=[];_0x25c4a8[_0x0c1b('0x5b')](addAdditionalPhones(_0x521b6a[_0x0c1b('0x35')]));Promise['all'](_0x25c4a8)[_0x0c1b('0x1a')](function(){_0x25c4a8=[];_0x25c4a8[_0x0c1b('0x5b')](deleteCmHopperPhones(_0x521b6a[_0x0c1b('0x35')]['id']));_0x25c4a8[_0x0c1b('0x5b')](addCmHopperPhones(_0x521b6a[_0x0c1b('0x35')]['id']));Promise['all'](_0x25c4a8)[_0x0c1b('0x1a')](function(){return[0x1];})[_0x0c1b('0x1a')](respondWithResult(_0x513dbc,null));});};function addAdditionalPhones(_0x48179b){var _0xb1c339;return new Promise(function(_0x4e29c5){return db[_0x0c1b('0x49')][_0x0c1b('0x19')]({'where':{'CmContactId':_0x48179b['id']}})[_0x0c1b('0x1a')](function(){db[_0x0c1b('0x67')][_0x0c1b('0x23')]({'raw':!![],'attributes':['id',_0x0c1b('0x89')]})[_0x0c1b('0x1a')](function(_0x31893c){var _0x154997=[];for(var _0x3546af=0x0;_0x3546af<_0x48179b['items']['length'];_0x3546af++){var _0xac015c=_0x48179b[_0x0c1b('0x8a')]?_[_0x0c1b('0x53')](_0x48179b['item_types'][_0x3546af])?'':_0x48179b['item_types'][_0x3546af]:_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8c')]?_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8c')]:'';var _0x5b834a=_[_0x0c1b('0x53')](_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8d')])?'':_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8d')];var _0x57065c=_0xac015c+':'+_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x77')]+'§'+_0x5b834a;if(_[_0x0c1b('0x53')](_0xb1c339))_0xb1c339=_0x57065c;else _0xb1c339+=';'+_0x57065c;var _0x35ca73=null;var _0x2a4b7e=null;if(_0x48179b[_0x0c1b('0x8a')]){if(!_[_0x0c1b('0x53')](_0x48179b[_0x0c1b('0x8a')][_0x3546af])){_0x2a4b7e=_[_0x0c1b('0x28')](_0x31893c,function(_0x9b53c3){return _0x9b53c3['id']===_0x48179b[_0x0c1b('0x8a')][_0x3546af];});if(!_['isNil'](_0x2a4b7e)){_0x35ca73=_0x2a4b7e[_0x0c1b('0x89')];}}}else{if(!_[_0x0c1b('0x53')](_0x48179b['items'][_0x3546af])){_0x2a4b7e=_[_0x0c1b('0x28')](_0x31893c,function(_0x2488d1){return _0x2488d1['id']===_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8c')];});if(!_[_0x0c1b('0x53')](_0x2a4b7e)){_0x35ca73=_0x3546af;}}}if(_[_0x0c1b('0x53')](_0x35ca73)){_0x35ca73=0x64;}_0x154997['push'](addAdditionalPhone(_0x48179b['id'],_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x77')],_0x48179b[_0x0c1b('0x8a')]?_[_0x0c1b('0x53')](_0x48179b[_0x0c1b('0x8a')][_0x3546af])?null:_0x48179b[_0x0c1b('0x8a')][_0x3546af]:_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8c')]?_0x48179b[_0x0c1b('0x8b')][_0x3546af][_0x0c1b('0x8c')]:null,_0x35ca73,_0x5b834a));}Promise[_0x0c1b('0x61')](_0x154997)[_0x0c1b('0x1a')](function(){db['CmContact'][_0x0c1b('0x18')]({'AdditionalPhones':_0xb1c339},{'where':{'id':_0x48179b['id']}})['then'](function(){_0x4e29c5(0x1);});});});});});}function addAdditionalPhone(_0x3204ee,_0x1a0ece,_0x32f393,_0x8efa38,_0x7b970c){return db[_0x0c1b('0x49')][_0x0c1b('0x28')]({'where':{'CmContactId':_0x3204ee,'item':_0x1a0ece}})[_0x0c1b('0x1a')](function(_0x41118f){if(_0x41118f)logger['info'](_0x0c1b('0x8e'),_0x41118f);else{db['CmContactHasItem'][_0x0c1b('0x40')]({'CmContactId':_0x3204ee,'item':_0x1a0ece,'ItemTypeId':_0x32f393,'OrderBy':_0x8efa38,'ItemClass':'PHONE','description':_0x7b970c});}});}function deleteCmHopperPhones(_0x1166de){return new Promise(function(_0x5a0b6f){return db[_0x0c1b('0x3c')][_0x0c1b('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1166de}})[_0x0c1b('0x1a')](function(_0x3523ab){db[_0x0c1b('0x8f')][_0x0c1b('0x19')]({'where':{'CmHopperId':{'$in':_[_0x0c1b('0x6d')](_0x3523ab,'id')}}});})['then'](function(){_0x5a0b6f(0x1);});});}function addCmHopperPhones(_0x5eec64){return new Promise(function(_0x510151){return db[_0x0c1b('0x3c')][_0x0c1b('0x23')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5eec64}})[_0x0c1b('0x1a')](function(_0x48db9c){var _0x1685ee=[];_[_0x0c1b('0x6d')](_0x48db9c,function(_0x2b4f48){_0x1685ee[_0x0c1b('0x5b')](createCmHopperPhone(_0x5eec64,_0x2b4f48['id']));});Promise[_0x0c1b('0x61')](_0x1685ee)[_0x0c1b('0x1a')](function(){_0x510151(0x1);});});});}function createCmHopperPhone(_0x2c96b9,_0x43f999){return new Promise(function(_0x49af4e){db[_0x0c1b('0x49')]['findAll']({'raw':!![],'attributes':[_0x0c1b('0x90'),_0x0c1b('0x89')],'where':{'CmContactId':_0x2c96b9,'ItemClass':_0x0c1b('0x91')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x0c1b('0x92')}],'order':['OrderBy',db[_0x0c1b('0x68')][_0x0c1b('0x69')]('`ItemType`.OrderBy')]})[_0x0c1b('0x1a')](function(_0x7317b9){var _0x42a88c=0x1;var _0x1bee90=_[_0x0c1b('0x6d')](_0x7317b9,function(_0x564c03){_0x564c03['CmHopperId']=_0x43f999;_0x564c03[_0x0c1b('0x77')]=_0x564c03[_0x0c1b('0x90')];_0x564c03[_0x0c1b('0x89')]=_0x42a88c;delete _0x564c03[_0x0c1b('0x93')];_0x42a88c=_0x42a88c+0x1;return _0x564c03;});return db['CmHopperAdditionalPhone'][_0x0c1b('0x94')](_0x1bee90,{});})[_0x0c1b('0x1a')](function(){_0x49af4e(0x1);});});}function insertAdditionalPhones(_0x294f5a,_0xfc51f8){return new Promise(function(_0x446120){var _0x5603b8=[];for(var _0x74065d=0x0;_0x74065d<_0xfc51f8['length'];_0x74065d++){var _0x38f570=_0xfc51f8[_0x74065d];_0x5603b8[_0x0c1b('0x5b')](parseContactItemType(_0x38f570));}Promise['all'](_0x5603b8)[_0x0c1b('0x1a')](function(){var _0x1c1db1={'id':_0x294f5a['id'],'items':_0xfc51f8};return addAdditionalPhones(_0x1c1db1)[_0x0c1b('0x1a')](function(){return addCmHopperPhones(_0x294f5a['id']);});})['then'](function(){_0x446120(_0x294f5a);});});}function parseContactItemType(_0x3d4d39){return new Promise(function(_0x3a99fb){if(_0x3d4d39[_0x0c1b('0x95')](_0x0c1b('0x8c'))){_0x3a99fb(_0x3d4d39);}else{return db['ContactItemType'][_0x0c1b('0x28')]({'where':{'name':_0x3d4d39['ItemType']}})[_0x0c1b('0x1a')](function(_0x4e22cc){if(_[_0x0c1b('0x53')](_0x4e22cc))_0x3d4d39[_0x0c1b('0x8c')]=null;else _0x3d4d39[_0x0c1b('0x8c')]=_0x4e22cc['id'];_0x3a99fb(_0x3d4d39);});}});}exports[_0x0c1b('0x96')]=function(_0xe8d0c7,_0x4d1bc6){return db[_0x0c1b('0x49')][_0x0c1b('0x23')]({'raw':!![],'where':{'CmContactId':_0xe8d0c7['params']['id'],'ItemClass':_0x0c1b('0x91')},'include':[{'model':db[_0x0c1b('0x67')],'as':_0x0c1b('0x92')}],'order':[[_0x0c1b('0x89')],[db[_0x0c1b('0x68')][_0x0c1b('0x69')]('`ItemType`.OrderBy')]]})[_0x0c1b('0x1a')](function(_0x4821f3){return _0x4821f3;})[_0x0c1b('0x1a')](respondWithResult(_0x4d1bc6,null))[_0x0c1b('0x26')](handleError(_0x4d1bc6,null));};exports[_0x0c1b('0x97')]=function(_0x2463de,_0x21a124){return db[_0x0c1b('0x49')]['findAll']({'raw':!![],'where':{'CmContactId':_0x2463de['body'][_0x0c1b('0x98')]}})[_0x0c1b('0x1a')](function(_0x5e70d1){var _0x52e4d7=_[_0x0c1b('0x6d')](_0x5e70d1,function(_0x5520e9){_0x5520e9[_0x0c1b('0x99')]=_0x2463de['body'][_0x0c1b('0x9a')];return _0x5520e9;});return db[_0x0c1b('0x49')][_0x0c1b('0x94')](_0x52e4d7,{});})['then'](function(){return addCmHopperPhones(_0x2463de[_0x0c1b('0x35')][_0x0c1b('0x9a')]);})[_0x0c1b('0x1a')](function(){return['ok'];})[_0x0c1b('0x1a')](respondWithResult(_0x21a124,null))[_0x0c1b('0x26')](handleError(_0x21a124,null));};exports[_0x0c1b('0x9b')]=function(_0x36d8e5,_0x21f42a){var _0xebf63f=[];_0xebf63f[_0x0c1b('0x5b')](createCmHopperPhone(_0x36d8e5[_0x0c1b('0x35')]['id'],_0x36d8e5['body'][_0x0c1b('0x9c')]));Promise[_0x0c1b('0x61')](_0xebf63f)[_0x0c1b('0x1a')](function(){return[0x1];})[_0x0c1b('0x1a')](respondWithResult(_0x21f42a,null));};exports[_0x0c1b('0x9d')]=function(_0x44b138,_0x2be99d){var _0x2504a8={'raw':![],'where':{}};var _0x4aabf0={};var _0x3c38f6={'count':0x0,'rows':[]};return db[_0x0c1b('0x27')][_0x0c1b('0x78')]({'where':{'id':_0x44b138['params']['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x2be99d,null))['then'](function(_0x3694c5){if(_0x3694c5){_0x4aabf0['model']=_[_0x0c1b('0x2b')](db[_0x0c1b('0x3c')]['rawAttributes']);_0x4aabf0[_0x0c1b('0x24')]=_[_0x0c1b('0x2b')](_0x44b138['query']);_0x4aabf0[_0x0c1b('0x7b')]=_['intersection'](_0x4aabf0[_0x0c1b('0x79')],_0x4aabf0[_0x0c1b('0x24')]);_0x2504a8[_0x0c1b('0x7d')]=_[_0x0c1b('0x7c')](_0x4aabf0[_0x0c1b('0x79')],qs[_0x0c1b('0x7e')](_0x44b138['query'][_0x0c1b('0x7e')]));_0x2504a8[_0x0c1b('0x7d')]=_0x2504a8[_0x0c1b('0x7d')]['length']?_0x2504a8[_0x0c1b('0x7d')]:_0x4aabf0['model'];if(!_0x44b138[_0x0c1b('0x24')]['hasOwnProperty'](_0x0c1b('0x86'))){_0x2504a8[_0x0c1b('0x13')]=qs[_0x0c1b('0x13')](_0x44b138[_0x0c1b('0x24')]['limit']);_0x2504a8['offset']=qs[_0x0c1b('0x10')](_0x44b138[_0x0c1b('0x24')][_0x0c1b('0x10')]);}_0x2504a8[_0x0c1b('0x7f')]=qs['sort'](_0x44b138[_0x0c1b('0x24')][_0x0c1b('0x80')]);_0x2504a8[_0x0c1b('0x5c')]=qs[_0x0c1b('0x7b')](_['pick'](_0x44b138['query'],_0x4aabf0[_0x0c1b('0x7b')]));_0x2504a8[_0x0c1b('0x5c')][_0x0c1b('0x9e')]=_0x3694c5['id'];if(_0x44b138[_0x0c1b('0x24')]['filter']){_0x2504a8[_0x0c1b('0x5c')]=_[_0x0c1b('0x83')](_0x2504a8[_0x0c1b('0x5c')],{'$or':_[_0x0c1b('0x6d')](_0x2504a8['attributes'],function(_0x24f239){var _0x55ba21={};_0x55ba21[_0x24f239]={'$like':'%'+_0x44b138[_0x0c1b('0x24')][_0x0c1b('0x82')]+'%'};return _0x55ba21;})});}_0x2504a8=_[_0x0c1b('0x83')]({},_0x2504a8,_0x44b138[_0x0c1b('0x84')]);return db['CmHopper']['count']({'where':_0x2504a8['where']})[_0x0c1b('0x1a')](function(_0x4a58c8){_0x3c38f6[_0x0c1b('0x12')]=_0x4a58c8;if(_0x44b138[_0x0c1b('0x24')][_0x0c1b('0x9f')]){_0x2504a8['include']=[{'all':!![]}];}return db[_0x0c1b('0x3c')][_0x0c1b('0x23')](_0x2504a8);})[_0x0c1b('0x1a')](function(_0xd3969e){_0x3c38f6[_0x0c1b('0xa0')]=_0xd3969e;return _0x3c38f6;});}})[_0x0c1b('0x1a')](respondWithFilteredResult(_0x2be99d,_0x2504a8))[_0x0c1b('0x26')](handleError(_0x2be99d,null));};exports[_0x0c1b('0xa1')]=function(_0x33ba90,_0x24c5cb){var _0xa345c6={'raw':!![],'where':{}};var _0x7fb9cd={};var _0xbff65b={'count':0x0,'rows':[]};return db[_0x0c1b('0x27')][_0x0c1b('0x78')]({'where':{'id':_0x33ba90[_0x0c1b('0x29')]['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x24c5cb,null))[_0x0c1b('0x1a')](function(_0x21df18){if(_0x21df18){_0x7fb9cd['model']=_[_0x0c1b('0x2b')](db['CmHopperHistory'][_0x0c1b('0x7a')]);_0x7fb9cd[_0x0c1b('0x24')]=_[_0x0c1b('0x2b')](_0x33ba90[_0x0c1b('0x24')]);_0x7fb9cd[_0x0c1b('0x7b')]=_['intersection'](_0x7fb9cd[_0x0c1b('0x79')],_0x7fb9cd[_0x0c1b('0x24')]);_0xa345c6[_0x0c1b('0x7d')]=_[_0x0c1b('0x7c')](_0x7fb9cd['model'],qs[_0x0c1b('0x7e')](_0x33ba90[_0x0c1b('0x24')][_0x0c1b('0x7e')]));_0xa345c6[_0x0c1b('0x7d')]=_0xa345c6[_0x0c1b('0x7d')][_0x0c1b('0x2c')]?_0xa345c6['attributes']:_0x7fb9cd[_0x0c1b('0x79')];if(!_0x33ba90[_0x0c1b('0x24')]['hasOwnProperty'](_0x0c1b('0x86'))){_0xa345c6[_0x0c1b('0x13')]=qs[_0x0c1b('0x13')](_0x33ba90[_0x0c1b('0x24')]['limit']);_0xa345c6[_0x0c1b('0x10')]=qs['offset'](_0x33ba90['query'][_0x0c1b('0x10')]);}_0xa345c6[_0x0c1b('0x7f')]=qs[_0x0c1b('0x80')](_0x33ba90['query'][_0x0c1b('0x80')]);_0xa345c6['where']=qs[_0x0c1b('0x7b')](_[_0x0c1b('0x81')](_0x33ba90[_0x0c1b('0x24')],_0x7fb9cd[_0x0c1b('0x7b')]));_0xa345c6[_0x0c1b('0x5c')][_0x0c1b('0x9e')]=_0x21df18['id'];if(_0x33ba90[_0x0c1b('0x24')]['filter']){_0xa345c6[_0x0c1b('0x5c')]=_[_0x0c1b('0x83')](_0xa345c6[_0x0c1b('0x5c')],{'$or':_[_0x0c1b('0x6d')](_0xa345c6[_0x0c1b('0x7d')],function(_0xbc343c){var _0x693521={};_0x693521[_0xbc343c]={'$like':'%'+_0x33ba90['query']['filter']+'%'};return _0x693521;})});}_0xa345c6=_[_0x0c1b('0x83')]({},_0xa345c6,_0x33ba90[_0x0c1b('0x84')]);return db[_0x0c1b('0x4b')]['count']({'where':_0xa345c6[_0x0c1b('0x5c')]})[_0x0c1b('0x1a')](function(_0x43b8dd){_0xbff65b[_0x0c1b('0x12')]=_0x43b8dd;if(_0x33ba90[_0x0c1b('0x24')][_0x0c1b('0x9f')]){_0xa345c6[_0x0c1b('0xa2')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0c1b('0x23')](_0xa345c6);})[_0x0c1b('0x1a')](function(_0x184fac){_0xbff65b[_0x0c1b('0xa0')]=_0x184fac;return _0xbff65b;});}})[_0x0c1b('0x1a')](respondWithFilteredResult(_0x24c5cb,_0xa345c6))['catch'](handleError(_0x24c5cb,null));};exports[_0x0c1b('0xa3')]=function(_0x45a680,_0xdb54f6){var _0x3e291d={'raw':!![],'where':{}};var _0x3aefe3={};var _0x455060={'count':0x0,'rows':[]};return db[_0x0c1b('0x27')][_0x0c1b('0x78')]({'where':{'id':_0x45a680['params']['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0xdb54f6,null))[_0x0c1b('0x1a')](function(_0x33ee4a){if(_0x33ee4a){_0x3aefe3[_0x0c1b('0x79')]=_[_0x0c1b('0x2b')](db[_0x0c1b('0x4a')][_0x0c1b('0x7a')]);_0x3aefe3[_0x0c1b('0x24')]=_[_0x0c1b('0x2b')](_0x45a680[_0x0c1b('0x24')]);_0x3aefe3[_0x0c1b('0x7b')]=_[_0x0c1b('0x7c')](_0x3aefe3[_0x0c1b('0x79')],_0x3aefe3[_0x0c1b('0x24')]);_0x3e291d['attributes']=_['intersection'](_0x3aefe3[_0x0c1b('0x79')],qs[_0x0c1b('0x7e')](_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x7e')]));_0x3e291d['attributes']=_0x3e291d[_0x0c1b('0x7d')][_0x0c1b('0x2c')]?_0x3e291d[_0x0c1b('0x7d')]:_0x3aefe3[_0x0c1b('0x79')];if(!_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x95')](_0x0c1b('0x86'))){_0x3e291d[_0x0c1b('0x13')]=qs[_0x0c1b('0x13')](_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x13')]);_0x3e291d[_0x0c1b('0x10')]=qs[_0x0c1b('0x10')](_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x10')]);}_0x3e291d[_0x0c1b('0x7f')]=qs[_0x0c1b('0x80')](_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x80')]);_0x3e291d['where']=qs[_0x0c1b('0x7b')](_[_0x0c1b('0x81')](_0x45a680[_0x0c1b('0x24')],_0x3aefe3['filters']));_0x3e291d['where']['ContactId']=_0x33ee4a['id'];if(_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x82')]){_0x3e291d[_0x0c1b('0x5c')]=_[_0x0c1b('0x83')](_0x3e291d['where'],{'$or':_[_0x0c1b('0x6d')](_0x3e291d[_0x0c1b('0x7d')],function(_0x4ab320){var _0x1c0cec={};_0x1c0cec[_0x4ab320]={'$like':'%'+_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x82')]+'%'};return _0x1c0cec;})});}_0x3e291d=_[_0x0c1b('0x83')]({},_0x3e291d,_0x45a680[_0x0c1b('0x84')]);return db['CmHopperFinal'][_0x0c1b('0x12')]({'where':_0x3e291d[_0x0c1b('0x5c')]})[_0x0c1b('0x1a')](function(_0x553379){_0x455060[_0x0c1b('0x12')]=_0x553379;if(_0x45a680[_0x0c1b('0x24')][_0x0c1b('0x9f')]){_0x3e291d[_0x0c1b('0xa2')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x0c1b('0x23')](_0x3e291d);})[_0x0c1b('0x1a')](function(_0x2d2843){_0x455060[_0x0c1b('0xa0')]=_0x2d2843;return _0x455060;});}})['then'](respondWithFilteredResult(_0xdb54f6,_0x3e291d))[_0x0c1b('0x26')](handleError(_0xdb54f6,null));};exports['getJscriptySessions']=function(_0x703387,_0x50d22c){var _0xc9c1bc={'raw':!![],'where':{}};var _0x2edfd7={};var _0x304303={'count':0x0,'rows':[]};return db[_0x0c1b('0x27')][_0x0c1b('0x78')]({'where':{'id':_0x703387['params']['id']}})[_0x0c1b('0x1a')](handleEntityNotFound(_0x50d22c,null))[_0x0c1b('0x1a')](function(_0x4fd9b9){if(_0x4fd9b9){_0x2edfd7[_0x0c1b('0x79')]=_[_0x0c1b('0x2b')](db[_0x0c1b('0x51')][_0x0c1b('0x7a')]);_0x2edfd7[_0x0c1b('0x24')]=_[_0x0c1b('0x2b')](_0x703387[_0x0c1b('0x24')]);_0x2edfd7[_0x0c1b('0x7b')]=_['intersection'](_0x2edfd7[_0x0c1b('0x79')],_0x2edfd7[_0x0c1b('0x24')]);_0xc9c1bc['attributes']=_[_0x0c1b('0x7c')](_0x2edfd7[_0x0c1b('0x79')],qs[_0x0c1b('0x7e')](_0x703387['query'][_0x0c1b('0x7e')]));_0xc9c1bc[_0x0c1b('0x7d')]=_0xc9c1bc[_0x0c1b('0x7d')][_0x0c1b('0x2c')]?_0xc9c1bc[_0x0c1b('0x7d')]:_0x2edfd7['model'];if(!_0x703387[_0x0c1b('0x24')][_0x0c1b('0x95')](_0x0c1b('0x86'))){_0xc9c1bc['limit']=qs[_0x0c1b('0x13')](_0x703387[_0x0c1b('0x24')][_0x0c1b('0x13')]);_0xc9c1bc[_0x0c1b('0x10')]=qs[_0x0c1b('0x10')](_0x703387['query'][_0x0c1b('0x10')]);}_0xc9c1bc[_0x0c1b('0x7f')]=qs[_0x0c1b('0x80')](_0x703387[_0x0c1b('0x24')][_0x0c1b('0x80')]);_0xc9c1bc['where']=qs['filters'](_[_0x0c1b('0x81')](_0x703387['query'],_0x2edfd7[_0x0c1b('0x7b')]));_0xc9c1bc[_0x0c1b('0x5c')][_0x0c1b('0x9e')]=_0x4fd9b9['id'];if(_0x703387[_0x0c1b('0x24')][_0x0c1b('0x82')]){_0xc9c1bc['where']=_[_0x0c1b('0x83')](_0xc9c1bc[_0x0c1b('0x5c')],{'$or':_[_0x0c1b('0x6d')](_0xc9c1bc[_0x0c1b('0x7d')],function(_0x23008b){var _0x21ce77={};_0x21ce77[_0x23008b]={'$like':'%'+_0x703387['query'][_0x0c1b('0x82')]+'%'};return _0x21ce77;})});}_0xc9c1bc=_[_0x0c1b('0x83')]({},_0xc9c1bc,_0x703387[_0x0c1b('0x84')]);return db['JscriptySessionReport'][_0x0c1b('0x12')]({'where':_0xc9c1bc[_0x0c1b('0x5c')]})[_0x0c1b('0x1a')](function(_0x22d06e){_0x304303['count']=_0x22d06e;if(_0x703387['query'][_0x0c1b('0x9f')]){_0xc9c1bc['include']=[{'all':!![]}];}return db[_0x0c1b('0x51')][_0x0c1b('0x23')](_0xc9c1bc);})[_0x0c1b('0x1a')](function(_0x13783c){_0x304303[_0x0c1b('0xa0')]=_0x13783c;return _0x304303;});}})[_0x0c1b('0x1a')](respondWithFilteredResult(_0x50d22c,_0xc9c1bc))['catch'](handleError(_0x50d22c,null));};exports[_0x0c1b('0xa4')]=function(_0x3f6bf2,_0x356b7f){try{if(!_0x3f6bf2[_0x0c1b('0x35')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x3f6bf2[_0x0c1b('0x35')]['binding_keys']){throw new Error(_0x0c1b('0xa5'));}if(!_0x3f6bf2['body'][_0x0c1b('0xa6')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0xa7')]){throw new Error(_0x0c1b('0xa8'));}var _0x56e91e=_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0xa9')]['split'](',');var _0x239143=_0x3f6bf2[_0x0c1b('0x35')]['binding_values'][_0x0c1b('0xaa')](',');if(!_0x56e91e[_0x0c1b('0x2c')]||!_0x239143[_0x0c1b('0x2c')]||_0x56e91e[_0x0c1b('0x2c')]!==_0x239143[_0x0c1b('0x2c')]){throw new Error(_0x0c1b('0xab'));}_0x3f6bf2['body'][_0x0c1b('0x7e')]=_[_0x0c1b('0xac')](_0x56e91e,_0x239143);if(!_0x3f6bf2[_0x0c1b('0x35')]['fields'][_0x0c1b('0x77')]){throw new Error(_0x0c1b('0xad'));}if(!_0x3f6bf2[_0x0c1b('0x35')]['fields'][_0x0c1b('0xae')]){throw new Error(_0x0c1b('0xaf'));}var _0x2275d4=path['join'](config[_0x0c1b('0xb0')],_0x0c1b('0xb1'),_0x3f6bf2[_0x0c1b('0xb2')][_0x0c1b('0xb3')]);fs['chmodSync'](_0x2275d4,parseInt(_0x0c1b('0xb4'),0x8));var _0x4a6f3d=require(_0x0c1b('0xb5'))[_0x0c1b('0xb6')](path[_0x0c1b('0x3a')](__dirname,_0x0c1b('0xb7')),[_0x2275d4,_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0xa9')],_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0xa6')],_0x3f6bf2['body']['ListId'],_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0xb8')],_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0x59')],_0x3f6bf2[_0x0c1b('0x35')][_0x0c1b('0xa7')]]);return _0x356b7f[_0x0c1b('0x14')](0xc8)[_0x0c1b('0x17')]({'message':_0x0c1b('0xb9'),'pid':_0x4a6f3d[_0x0c1b('0xba')]});}catch(_0x69eea4){return _0x356b7f[_0x0c1b('0x14')](0x1f4)['send'](_0x69eea4);}};exports[_0x0c1b('0xbb')]=function(_0x3ea97b,_0x4b12db){var _0x5f32a6=fs[_0x0c1b('0xbc')](_0x3ea97b[_0x0c1b('0xb2')]['path']);Papa[_0x0c1b('0xbd')](_0x5f32a6,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x572933){return _0x4b12db[_0x0c1b('0x14')](0xc8)[_0x0c1b('0x17')]({'file':_0x3ea97b[_0x0c1b('0xb2')],'fields':_0x572933[_0x0c1b('0xbe')][_0x0c1b('0x7e')]});}});};exports['import']=function(_0x113e92,_0x3d7a9f){return db[_0x0c1b('0xbf')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0c1b('0xc0')}})[_0x0c1b('0x1a')](function(_0x529b0b){var _0x731874=![];if(!_0x113e92[_0x0c1b('0x35')][_0x0c1b('0x5d')]){throw new Error(_0x0c1b('0xc1'));}if(!_0x113e92[_0x0c1b('0x35')]['binding']['phone']){throw new Error(_0x0c1b('0xad'));}if(!_0x113e92[_0x0c1b('0x35')][_0x0c1b('0xc2')][_0x0c1b('0xae')]){throw new Error(_0x0c1b('0xaf'));}if(!_0x113e92[_0x0c1b('0x35')]['socket_timestamp']){throw new Error(_0x0c1b('0xa8'));}var _0x576cf7=require(_0x0c1b('0xb5'))['fork'](path[_0x0c1b('0x3a')](__dirname,_0x0c1b('0xc3')),[_0x113e92[_0x0c1b('0x29')]['id'],JSON['stringify'](_0x113e92[_0x0c1b('0x35')]),JSON[_0x0c1b('0xc4')](_0x529b0b)]);_0x576cf7['on'](_0x0c1b('0xc5'),function(){_0x731874=!![];return _0x3d7a9f[_0x0c1b('0x14')](0xc8)[_0x0c1b('0x17')]({'message':_0x0c1b('0xc6'),'pid':_0x576cf7['pid']});});_0x576cf7['on'](_0x0c1b('0xc7'),function(_0x453e88){if(_0x453e88&&!_0x731874){return _0x3d7a9f[_0x0c1b('0x14')](0x1f4)[_0x0c1b('0x17')]({'message':'error\x20child\x20process','pid':_0x576cf7[_0x0c1b('0xba')]});}});})[_0x0c1b('0x26')](handleError(_0x3d7a9f,null));};exports[_0x0c1b('0xc8')]=function(_0x4333d7,_0x33e259){return db[_0x0c1b('0xbf')][_0x0c1b('0x23')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x0c1b('0x1a')](function(_0x1f82f0){var _0x10c62c=![];if(!_0x4333d7[_0x0c1b('0x35')][_0x0c1b('0x5d')]){throw new Error(_0x0c1b('0xc1'));}if(!_0x4333d7[_0x0c1b('0x35')][_0x0c1b('0xc2')][_0x0c1b('0x77')]){throw new Error(_0x0c1b('0xad'));}if(!_0x4333d7['body'][_0x0c1b('0xc2')][_0x0c1b('0xae')]){throw new Error(_0x0c1b('0xaf'));}if(!_0x4333d7[_0x0c1b('0x35')][_0x0c1b('0xa7')]){throw new Error(_0x0c1b('0xa8'));}var _0x2a3f81=require(_0x0c1b('0xb5'))['fork'](path[_0x0c1b('0x3a')](__dirname,'../../components/import/cm/csvUpdates'),[_0x4333d7[_0x0c1b('0x29')]['id'],JSON[_0x0c1b('0xc4')](_0x4333d7[_0x0c1b('0x35')]),JSON['stringify'](_0x1f82f0)]);_0x2a3f81['on']('message',function(){_0x10c62c=!![];return _0x33e259[_0x0c1b('0x14')](0xc8)[_0x0c1b('0x17')]({'message':_0x0c1b('0xc6'),'pid':_0x2a3f81[_0x0c1b('0xba')]});});_0x2a3f81['on'](_0x0c1b('0xc7'),function(_0x480b05){if(_0x480b05&&!_0x10c62c){return _0x33e259['status'](0x1f4)[_0x0c1b('0x17')]({'message':_0x0c1b('0xc9'),'pid':_0x2a3f81[_0x0c1b('0xba')]});}});})[_0x0c1b('0x26')](handleError(_0x33e259,null));};exports[_0x0c1b('0xca')]=function(_0x677981,_0x1d2b4c){var _0xe70c0c=[_0x0c1b('0xcb'),_0x0c1b('0xcc'),_0x0c1b('0xcd'),'openchannel',_0x0c1b('0xce'),_0x0c1b('0xcf'),'voice'];var _0x2fb5b0={'offset':0x0,'order':qs[_0x0c1b('0x80')](_0x0c1b('0xd0'))},_0x38d77c={'count':0x0,'rows':[]};Promise['resolve']()[_0x0c1b('0x1a')](function(){if(_0x677981[_0x0c1b('0x24')][_0x0c1b('0xd1')]){if(!_[_0x0c1b('0xd2')](_0xe70c0c,_0x677981['query'][_0x0c1b('0xd1')][_0x0c1b('0xd3')]())){throw new Error(_0x0c1b('0xd4'));}_0xe70c0c=[_0x677981[_0x0c1b('0x24')][_0x0c1b('0xd1')][_0x0c1b('0xd3')]()];}if(_0x677981[_0x0c1b('0x24')][_0x0c1b('0xd5')]){try{var _0x3cea0f=JSON[_0x0c1b('0xbd')](_0x677981[_0x0c1b('0x24')][_0x0c1b('0xd5')]);if(!moment(_0x3cea0f['from'])['isValid']()){throw new Error(_0x0c1b('0xd6'));}if(!moment(_0x3cea0f['to'])[_0x0c1b('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x21f5bc){throw new Error(_0x0c1b('0xd8'));}}if(!_0x677981[_0x0c1b('0x24')]['hasOwnProperty'](_0x0c1b('0x86'))){_0x2fb5b0['limit']=qs[_0x0c1b('0x13')](_0x677981[_0x0c1b('0x24')][_0x0c1b('0x13')]||0xa);_0x2fb5b0[_0x0c1b('0x10')]=qs[_0x0c1b('0x10')](_0x677981[_0x0c1b('0x24')][_0x0c1b('0x10')]);}var _0x2dac0e=_0xe70c0c[_0x0c1b('0x6d')](function(_0x485e69){if(_0x485e69===_0x0c1b('0xd9')){var _0x4666e4={'attributes':['id',_0x0c1b('0xda'),_0x0c1b('0xdb'),'source',_0x0c1b('0xdc'),_0x0c1b('0xdd'),'starttime',_0x0c1b('0xde'),_0x0c1b('0xdf'),_0x0c1b('0xe0'),_0x0c1b('0xe1'),_0x0c1b('0xe2'),_0x0c1b('0xe3'),_0x0c1b('0xe4'),'UserId'],'where':{'ContactId':_0x677981[_0x0c1b('0x29')]['id']},'include':[{'model':db[_0x0c1b('0xbf')],'as':'User','attributes':['id','name','fullname',_0x0c1b('0x30')]}],'order':[[_0x0c1b('0xe1'),'DESC']]};if(_0x677981['query'][_0x0c1b('0xd5')]){_0x4666e4[_0x0c1b('0x5c')][_0x0c1b('0xe1')]={'$gte':_0x3cea0f[_0x0c1b('0x36')],'$lte':_0x3cea0f['to']};}return db['VoiceCallReport']['findAndCountAll'](_0x4666e4)['then'](function(_0x5346fa){_0x38d77c[_0x0c1b('0x12')]+=_0x5346fa['count'];return _['map'](_0x5346fa['rows'],function(_0x2bad13){var _0x3638ce=_0x2bad13[_0x0c1b('0x37')]({'plain':!![]});_0x3638ce[_0x0c1b('0xd1')]=_0x485e69;if(_0x3638ce[_0x0c1b('0xbf')]){_0x3638ce['User']={'id':_0x3638ce['User']['id'],'name':_0x3638ce['User'][_0x0c1b('0x1e')],'fullname':_0x3638ce[_0x0c1b('0xbf')][_0x0c1b('0xe5')],'alias':_0x3638ce[_0x0c1b('0xbf')][_0x0c1b('0x30')]};}return _0x3638ce;});});}else{var _0x808c7d=_[_0x0c1b('0xe6')](_0x485e69)+(_0x485e69===_0x0c1b('0xcc')?_0x0c1b('0xe7'):_0x0c1b('0xe8'));var _0x2629f2={'attributes':['id',_0x0c1b('0xe9'),_0x0c1b('0xea'),_0x0c1b('0xe1'),_0x0c1b('0xe0'),_0x0c1b('0xeb'),_0x0c1b('0xec'),_0x0c1b('0xed'),_0x0c1b('0xee'),_0x808c7d+'Id'],'where':{'ContactId':_0x677981[_0x0c1b('0x29')]['id']},'include':[{'model':db[_0x808c7d],'as':_0x0c1b('0xe8'),'attributes':['id','name',_0x0c1b('0xef')]},{'model':db[_0x0c1b('0xbf')],'as':_0x0c1b('0xf0'),'attributes':['id',_0x0c1b('0x1e'),_0x0c1b('0xe5')]},{'model':db[_0x0c1b('0x62')],'as':'Tags','attributes':['id',_0x0c1b('0x1e'),_0x0c1b('0x64')],'through':{'attributes':[]}}],'order':[[_0x0c1b('0xe1'),_0x0c1b('0xf1')]]};if(_0x677981[_0x0c1b('0x24')]['range']){_0x2629f2[_0x0c1b('0x5c')][_0x0c1b('0xe1')]={'$gte':_0x3cea0f['from'],'$lte':_0x3cea0f['to']};}switch(_0x485e69){case _0x0c1b('0xcc'):_0x2629f2[_0x0c1b('0x7d')]['push'](_0x0c1b('0xf2'),_0x0c1b('0xf3'),'customerPort',_0x0c1b('0xf4'),_0x0c1b('0xf5'),_0x0c1b('0xf6'),_0x0c1b('0xf7'),_0x0c1b('0xf8'),_0x0c1b('0xf9'));break;case _0x0c1b('0xcb'):_0x2629f2['attributes'][_0x0c1b('0x5b')](_0x0c1b('0xfa'),_0x0c1b('0xfb'));break;case _0x0c1b('0xfc'):_0x2629f2[_0x0c1b('0x7d')][_0x0c1b('0x5b')](_0x0c1b('0xfd'),_0x0c1b('0xfe'));break;}return db[_[_0x0c1b('0xe6')](_0x485e69)+_0x0c1b('0xff')][_0x0c1b('0x100')](_0x2629f2)[_0x0c1b('0x1a')](function(_0x3d798b){_0x38d77c[_0x0c1b('0x12')]+=_0x3d798b[_0x0c1b('0x12')];return _[_0x0c1b('0x6d')](_0x3d798b[_0x0c1b('0xa0')],function(_0x1a66e9){var _0x194a30=_0x1a66e9[_0x0c1b('0x37')]({'plain':!![]});_0x194a30[_0x0c1b('0xd1')]=_0x485e69;if(_0x194a30[_0x0c1b('0xf0')]){_0x194a30[_0x0c1b('0xf0')]={'id':_0x194a30[_0x0c1b('0xf0')]['id'],'name':_0x194a30[_0x0c1b('0xf0')]['name'],'fullname':_0x194a30[_0x0c1b('0xf0')][_0x0c1b('0xe5')]};}return _0x194a30;});});}});return Promise[_0x0c1b('0x61')](_0x2dac0e);})[_0x0c1b('0x1a')](function(_0x16cfaf){return _(_0x16cfaf)['flatten']()['sortBy'](_0x0c1b('0xe1'))[_0x0c1b('0x101')]()[_0x0c1b('0x102')]();})[_0x0c1b('0x1a')](function(_0x8700bd){_0x38d77c[_0x0c1b('0xa0')]=_0x2fb5b0['limit']?_0x8700bd[_0x0c1b('0x103')](_0x2fb5b0[_0x0c1b('0x10')],_0x2fb5b0[_0x0c1b('0x10')]+_0x2fb5b0[_0x0c1b('0x13')]):_0x8700bd;return _0x38d77c;})[_0x0c1b('0x1a')](respondWithFilteredResult(_0x1d2b4c,_0x2fb5b0))[_0x0c1b('0x26')](handleError(_0x1d2b4c,null));}; \ No newline at end of file +var _0x3b19=['name','send','index','describe','getOptions','findAll','query','catch','CmContact','find','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','cf_','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','tags','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','each','duplicates','$or','push','where','ListId','findOrCreate','hasOwnProperty','contact','show','params','Tag','Tags','color','tag','CmContactHasItem','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','text','phone','getTags','findOne','model','rawAttributes','filters','attributes','fields','sort','pick','filter','options','nolimit','setTags','ids','all','items','item_types','ItemTypeId','OrderBy','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','item','ItemType.OrderBy','bulkCreate','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','intersection','includeAll','rows','ContactId','include','getHopperFinals','getJscriptySessions','order','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','VoiceCallReport','findAndCountAll','fullname','startCase','chat','Website','closed','closedAt','note','secondDisposition','thirdDisposition','Account','key','Owner','browserName','customerIp','deviceModel','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','bluebird','util','path','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','end','sendStatus','error','stack'];(function(_0x26960e,_0x1d9cd3){var _0x19112e=function(_0x295f6e){while(--_0x295f6e){_0x26960e['push'](_0x26960e['shift']());}};_0x19112e(++_0x1d9cd3);}(_0x3b19,0x1e9));var _0x93b1=function(_0x12119e,_0x2c61e6){_0x12119e=_0x12119e-0x0;var _0x42cf30=_0x3b19[_0x12119e];return _0x42cf30;};'use strict';var moment=require('moment');var BPromise=require(_0x93b1('0x0'));var util=require(_0x93b1('0x1'));var path=require(_0x93b1('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93b1('0x3'));var Papa=require(_0x93b1('0x4'));var Redis=require('ioredis');var contacts=require(_0x93b1('0x5'));var qs=require(_0x93b1('0x6'));var logger=require(_0x93b1('0x7'))(_0x93b1('0x8'));var config=require(_0x93b1('0x9'));var shared=require(_0x93b1('0xa'));var db=require(_0x93b1('0xb'))['db'];config[_0x93b1('0xc')]=_[_0x93b1('0xd')](config[_0x93b1('0xc')],{'host':_0x93b1('0xe'),'port':0x18eb});var socket=require(_0x93b1('0xf'))(new Redis(config[_0x93b1('0xc')]));require(_0x93b1('0x10'))['register'](socket);function respondWithResult(_0x806052,_0x5b49dd){_0x5b49dd=_0x5b49dd||0xc8;return function(_0x82db05){if(_0x82db05){return _0x806052[_0x93b1('0x11')](_0x5b49dd)['json'](_0x82db05);}};}function respondWithFilteredResult(_0x5c4728,_0x3244d8){return function(_0x52f65d){if(_0x52f65d){var _0x3d02f7=typeof _0x3244d8[_0x93b1('0x12')]===_0x93b1('0x13')&&typeof _0x3244d8[_0x93b1('0x14')]===_0x93b1('0x13');var _0x3617d7=_0x52f65d[_0x93b1('0x15')];var _0x250646=_0x3d02f7?0x0:_0x3244d8[_0x93b1('0x12')];var _0x436403=_0x3d02f7?_0x52f65d['count']:_0x3244d8[_0x93b1('0x12')]+_0x3244d8[_0x93b1('0x14')];var _0x160a4b;if(_0x436403>=_0x3617d7){_0x436403=_0x3617d7;_0x160a4b=0xc8;}else{_0x160a4b=0xce;}_0x5c4728[_0x93b1('0x11')](_0x160a4b);return _0x5c4728[_0x93b1('0x16')](_0x93b1('0x17'),_0x250646+'-'+_0x436403+'/'+_0x3617d7)[_0x93b1('0x18')](_0x52f65d);}return null;};}function saveUpdates(_0xdf2815){return function(_0x29712b){if(_0x29712b){return _0x29712b['update'](_0xdf2815)[_0x93b1('0x19')](function(_0x325f5e){return _0x325f5e;});}return null;};}function removeEntity(_0x573758){return function(_0x205718){if(_0x205718){return _0x205718[_0x93b1('0x1a')]()[_0x93b1('0x19')](function(){_0x573758[_0x93b1('0x11')](0xcc)[_0x93b1('0x1b')]();});}};}function handleEntityNotFound(_0xa87f8b){return function(_0x417ec5){if(!_0x417ec5){_0xa87f8b[_0x93b1('0x1c')](0x194);}return _0x417ec5;};}function handleError(_0x1f0877,_0x28d5b4){_0x28d5b4=_0x28d5b4||0x1f4;return function(_0x48a401){logger[_0x93b1('0x1d')](_0x48a401[_0x93b1('0x1e')]);if(_0x48a401[_0x93b1('0x1f')]){delete _0x48a401['name'];}_0x1f0877[_0x93b1('0x11')](_0x28d5b4)[_0x93b1('0x20')](_0x48a401);};}exports[_0x93b1('0x21')]=function(_0x22a17c,_0x4fb3a0){var _0x2c8257={};return contacts[_0x93b1('0x22')]()[_0x93b1('0x19')](function(_0x358f00){_0x2c8257=qs[_0x93b1('0x23')](_0x358f00,_0x22a17c);return contacts[_0x93b1('0x24')](_0x22a17c[_0x93b1('0x25')],_0x22a17c['user'],_0x2c8257,_0x358f00);})['then'](respondWithFilteredResult(_0x4fb3a0,_0x2c8257))[_0x93b1('0x26')](handleError(_0x4fb3a0,null));};exports['destroy']=function(_0x32a888,_0x210932){return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'id':_0x32a888['params']['id']}})['then'](handleEntityNotFound(_0x210932,null))['then'](removeEntity(_0x210932,null))[_0x93b1('0x26')](handleError(_0x210932,null));};exports[_0x93b1('0x22')]=function(_0x3d3724,_0x2f3c0b){return db[_0x93b1('0x27')]['describe']()['then'](function(_0x3b2fc7){delete _0x3b2fc7['tags'];for(var _0xf71b9f=0x0;_0xf71b9f0x0){return new Promise(function(_0x547bbe){var _0x3b7dbf=[];for(var _0x151281=0x0;_0x151281<_0x44a164[_0x93b1('0x2a')];_0x151281++){_0x3b7dbf[_0x93b1('0x63')](insertAdditionalPhones(_0x44a164[_0x151281][_0x93b1('0x68')],_0x44a164[_0x151281][_0x93b1('0x5f')]));}Promise['all'](_0x3b7dbf)[_0x93b1('0x19')](function(){_0x547bbe(0x1);});})[_0x93b1('0x19')](function(){return{'success':_0x282c8c,'failure':_0x558f18,'duplicates':_0x345ed2};});}else{return{'success':_0x282c8c,'failure':_0x558f18,'duplicates':_0x345ed2};}}})[_0x93b1('0x19')](respondWithResult(_0x294109,0xc9))[_0x93b1('0x26')](handleError(_0x294109,null));};exports[_0x93b1('0x69')]=function(_0x1669ce,_0x2da332){var _0x4585e8;return db['CmContact'][_0x93b1('0x22')]()[_0x93b1('0x19')](function(_0x2cc9dd){return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'id':_0x1669ce[_0x93b1('0x6a')]['id']},'include':[{'model':db[_0x93b1('0x6b')],'as':_0x93b1('0x6c'),'attributes':['id',_0x93b1('0x1f'),_0x93b1('0x6d')],'required':_0x1669ce['query'][_0x93b1('0x6e')]?!![]:![]},{'model':db[_0x93b1('0x6f')],'as':'Phones','where':{'CmContactId':_0x1669ce['params']['id']},'required':![],'include':[{'model':db[_0x93b1('0x70')],'as':_0x93b1('0x71')}]}],'order':[db[_0x93b1('0x72')][_0x93b1('0x73')](_0x93b1('0x74'))],'attributes':_[_0x93b1('0x29')](_0x2cc9dd)});})[_0x93b1('0x19')](function(_0x1ffc7a){if(!_[_0x93b1('0x5b')](_0x1ffc7a)){_0x4585e8=_0x1ffc7a[_0x93b1('0x3b')]({'plain':!![]});var _0x14eeae={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1ffc7a&&_0x1ffc7a[_0x93b1('0x65')]){if(_0x1ffc7a[_0x93b1('0x65')]){_0x14eeae[_0x93b1('0x64')][_0x93b1('0x75')][_0x93b1('0x63')]({'ListId':{'$ne':_0x1ffc7a[_0x93b1('0x65')]}});}}return db[_0x93b1('0x2f')][_0x93b1('0x24')](_0x14eeae);}})[_0x93b1('0x19')](function(_0x9ff21){if(!_[_0x93b1('0x5b')](_0x9ff21)){return _[_0x93b1('0x76')](_0x4585e8,_[_0x93b1('0x77')](_0x9ff21,function(_0x1e0c7b){return util[_0x93b1('0x78')](_0x93b1('0x79'),_0x1e0c7b['id']);}));}})[_0x93b1('0x19')](handleEntityNotFound(_0x2da332,null))[_0x93b1('0x19')](respondWithResult(_0x2da332,null))[_0x93b1('0x26')](handleError(_0x2da332,null));};exports[_0x93b1('0x47')]=function(_0x3ae233,_0x35c0f1){var _0x2b643e;if(_0x3ae233['body']['id']){delete _0x3ae233[_0x93b1('0x39')]['id'];}if(!_[_0x93b1('0x5b')](_0x3ae233[_0x93b1('0x39')][_0x93b1('0x5c')])){var _0x242cf2=_0x3ae233[_0x93b1('0x39')][_0x93b1('0x5c')];if(!_['isNil'](shared[_0x93b1('0x5e')][_0x242cf2]))_0x3ae233[_0x93b1('0x39')][_0x93b1('0x5d')]=shared['timezones'][_0x242cf2][_0x93b1('0x5d')];}return db[_0x93b1('0x27')][_0x93b1('0x28')]({'where':{'id':_0x3ae233['params']['id']}})['then'](handleEntityNotFound(_0x35c0f1,null))[_0x93b1('0x19')](saveUpdates(_0x3ae233['body'],null))[_0x93b1('0x19')](function(_0x4dcc7e){_0x2b643e=_0x4dcc7e;var _0x3bf905={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4dcc7e&&_0x4dcc7e[_0x93b1('0x65')]){if(_0x4dcc7e[_0x93b1('0x65')]){_0x3bf905['where'][_0x93b1('0x75')][_0x93b1('0x63')]({'ListId':{'$ne':_0x4dcc7e[_0x93b1('0x65')]}});}}return db[_0x93b1('0x2f')][_0x93b1('0x24')](_0x3bf905);})['then'](function(_0x522c2b){if(_0x522c2b){return _[_0x93b1('0x76')](_[_0x93b1('0x7a')](_0x3ae233[_0x93b1('0x39')],function(_0x3e62f0,_0x420b96){return _['startsWith'](_0x420b96,_0x93b1('0x30'));}),_[_0x93b1('0x77')](_0x522c2b,function(_0x38b1d7){return util[_0x93b1('0x78')]('cf_%d',_0x38b1d7['id']);}));}})[_0x93b1('0x19')](function(_0x373241){if(_0x373241&&!_[_0x93b1('0x7b')](_0x373241)){var _0x5ddbca=squel['update']()[_0x93b1('0x7c')](_0x93b1('0x7d'))[_0x93b1('0x7e')](_0x373241)[_0x93b1('0x64')](_0x93b1('0x7f'),_0x3ae233[_0x93b1('0x6a')]['id'])['toParam']();return db[_0x93b1('0x72')]['query'](_0x5ddbca[_0x93b1('0x80')],{'replacements':_0x5ddbca[_0x93b1('0x34')]});}})[_0x93b1('0x19')](function(){if(_0x3ae233[_0x93b1('0x39')][_0x93b1('0x81')]&&_0x2b643e){return db['CmHopper'][_0x93b1('0x47')]({'phone':_0x3ae233[_0x93b1('0x39')][_0x93b1('0x81')],'OrderBy':0x0},{'where':{'ContactId':_0x2b643e['id']}});}})[_0x93b1('0x19')](function(){return _0x2b643e;})['then'](respondWithResult(_0x35c0f1,null))['catch'](handleError(_0x35c0f1,null));};exports[_0x93b1('0x82')]=function(_0x261e6b,_0x4db787){var _0x5ac867={};var _0x5b6d77={};var _0xdae9e4;var _0x4e3bf3;return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x261e6b[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x4db787,null))[_0x93b1('0x19')](function(_0x13c5f3){if(_0x13c5f3){_0xdae9e4=_0x13c5f3;_0x5b6d77[_0x93b1('0x84')]=_[_0x93b1('0x29')](db[_0x93b1('0x6b')][_0x93b1('0x85')]);_0x5b6d77['query']=_[_0x93b1('0x29')](_0x261e6b[_0x93b1('0x25')]);_0x5b6d77[_0x93b1('0x86')]=_['intersection'](_0x5b6d77[_0x93b1('0x84')],_0x5b6d77['query']);_0x5ac867[_0x93b1('0x87')]=_['intersection'](_0x5b6d77[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x261e6b[_0x93b1('0x25')][_0x93b1('0x88')]));_0x5ac867[_0x93b1('0x87')]=_0x5ac867[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x5ac867[_0x93b1('0x87')]:_0x5b6d77[_0x93b1('0x84')];_0x5ac867['order']=qs['sort'](_0x261e6b[_0x93b1('0x25')][_0x93b1('0x89')]);_0x5ac867[_0x93b1('0x64')]=qs['filters'](_[_0x93b1('0x8a')](_0x261e6b['query'],_0x5b6d77['filters']));if(_0x261e6b[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x5ac867[_0x93b1('0x64')]=_['merge'](_0x5ac867[_0x93b1('0x64')],{'$or':_['map'](_0x5ac867[_0x93b1('0x87')],function(_0xe0b9a){var _0x47e3be={};_0x47e3be[_0xe0b9a]={'$like':'%'+_0x261e6b[_0x93b1('0x25')]['filter']+'%'};return _0x47e3be;})});}_0x5ac867=_[_0x93b1('0x38')]({},_0x5ac867,_0x261e6b[_0x93b1('0x8c')]);return _0xdae9e4[_0x93b1('0x82')](_0x5ac867);}})[_0x93b1('0x19')](function(_0x3bfed9){if(_0x3bfed9){_0x4e3bf3=_0x3bfed9[_0x93b1('0x2a')];if(!_0x261e6b[_0x93b1('0x25')]['hasOwnProperty'](_0x93b1('0x8d'))){_0x5ac867[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x261e6b['query'][_0x93b1('0x14')]);_0x5ac867['offset']=qs[_0x93b1('0x12')](_0x261e6b['query'][_0x93b1('0x12')]);}return _0xdae9e4[_0x93b1('0x82')](_0x5ac867);}})[_0x93b1('0x19')](function(_0x527b60){if(_0x527b60){return _0x527b60?{'count':_0x4e3bf3,'rows':_0x527b60}:null;}})[_0x93b1('0x19')](respondWithResult(_0x4db787,null))['catch'](handleError(_0x4db787,null));};exports[_0x93b1('0x8e')]=function(_0x52a99b,_0x18d76c){if(_0x52a99b[_0x93b1('0x39')]['id']){delete _0x52a99b[_0x93b1('0x39')]['id'];}return db['CmContact'][_0x93b1('0x83')]({'where':{'id':_0x52a99b[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x18d76c,null))[_0x93b1('0x19')](function(_0x2c31f4){if(_0x2c31f4){return _0x2c31f4[_0x93b1('0x8e')](_0x52a99b[_0x93b1('0x39')][_0x93b1('0x8f')]||[]);}return null;})[_0x93b1('0x19')](respondWithResult(_0x18d76c,null))[_0x93b1('0x26')](handleError(_0x18d76c,null));};exports['setAdditionalPhones']=function(_0x427aa2,_0x1a7567){var _0x1865b8=[];_0x1865b8[_0x93b1('0x63')](addAdditionalPhones(_0x427aa2[_0x93b1('0x39')]));Promise[_0x93b1('0x90')](_0x1865b8)[_0x93b1('0x19')](function(){_0x1865b8=[];_0x1865b8[_0x93b1('0x63')](deleteCmHopperPhones(_0x427aa2[_0x93b1('0x39')]['id']));_0x1865b8[_0x93b1('0x63')](addCmHopperPhones(_0x427aa2[_0x93b1('0x39')]['id']));Promise[_0x93b1('0x90')](_0x1865b8)['then'](function(){return[0x1];})['then'](respondWithResult(_0x1a7567,null));});};function addAdditionalPhones(_0x52b32b){var _0x4c0940;return new Promise(function(_0x2c77b1){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x52b32b['id']}})['then'](function(){db[_0x93b1('0x70')][_0x93b1('0x24')]({'raw':!![],'attributes':['id','OrderBy']})[_0x93b1('0x19')](function(_0x524591){var _0x568403=[];for(var _0x14745a=0x0;_0x14745a<_0x52b32b[_0x93b1('0x91')]['length'];_0x14745a++){var _0xcd53b=_0x52b32b[_0x93b1('0x92')]?_[_0x93b1('0x5b')](_0x52b32b[_0x93b1('0x92')][_0x14745a])?'':_0x52b32b[_0x93b1('0x92')][_0x14745a]:_0x52b32b[_0x93b1('0x91')][_0x14745a]['ItemTypeId']?_0x52b32b[_0x93b1('0x91')][_0x14745a][_0x93b1('0x93')]:'';var _0x3d39cd=_[_0x93b1('0x5b')](_0x52b32b['items'][_0x14745a]['description'])?'':_0x52b32b[_0x93b1('0x91')][_0x14745a]['description'];var _0x38de1c=_0xcd53b+':'+_0x52b32b[_0x93b1('0x91')][_0x14745a]['phone']+'§'+_0x3d39cd;if(_[_0x93b1('0x5b')](_0x4c0940))_0x4c0940=_0x38de1c;else _0x4c0940+=';'+_0x38de1c;var _0x5afd44=null;var _0x1be878=null;if(_0x52b32b[_0x93b1('0x92')]){if(!_[_0x93b1('0x5b')](_0x52b32b[_0x93b1('0x92')][_0x14745a])){_0x1be878=_['find'](_0x524591,function(_0x4718b3){return _0x4718b3['id']===_0x52b32b[_0x93b1('0x92')][_0x14745a];});if(!_[_0x93b1('0x5b')](_0x1be878)){_0x5afd44=_0x1be878[_0x93b1('0x94')];}}}else{if(!_[_0x93b1('0x5b')](_0x52b32b[_0x93b1('0x91')][_0x14745a])){_0x1be878=_[_0x93b1('0x28')](_0x524591,function(_0x5792fa){return _0x5792fa['id']===_0x52b32b[_0x93b1('0x91')][_0x14745a][_0x93b1('0x93')];});if(!_[_0x93b1('0x5b')](_0x1be878)){_0x5afd44=_0x14745a;}}}if(_['isNil'](_0x5afd44)){_0x5afd44=0x64;}_0x568403['push'](addAdditionalPhone(_0x52b32b['id'],_0x52b32b['items'][_0x14745a][_0x93b1('0x81')],_0x52b32b['item_types']?_[_0x93b1('0x5b')](_0x52b32b['item_types'][_0x14745a])?null:_0x52b32b[_0x93b1('0x92')][_0x14745a]:_0x52b32b[_0x93b1('0x91')][_0x14745a][_0x93b1('0x93')]?_0x52b32b['items'][_0x14745a][_0x93b1('0x93')]:null,_0x5afd44,_0x3d39cd));}Promise['all'](_0x568403)['then'](function(){db[_0x93b1('0x27')]['update']({'AdditionalPhones':_0x4c0940},{'where':{'id':_0x52b32b['id']}})[_0x93b1('0x19')](function(){_0x2c77b1(0x1);});});});});});}function addAdditionalPhone(_0xcef0ad,_0xd0aeff,_0x33ba7c,_0x38d24d,_0x2abab7){return db[_0x93b1('0x6f')]['find']({'where':{'CmContactId':_0xcef0ad,'item':_0xd0aeff}})[_0x93b1('0x19')](function(_0x17eeca){if(_0x17eeca)logger[_0x93b1('0x35')]('contact\x20phone\x20exists',_0x17eeca);else{db[_0x93b1('0x6f')][_0x93b1('0x45')]({'CmContactId':_0xcef0ad,'item':_0xd0aeff,'ItemTypeId':_0x33ba7c,'OrderBy':_0x38d24d,'ItemClass':_0x93b1('0x95'),'description':_0x2abab7});}});}function deleteCmHopperPhones(_0x33ac47){return new Promise(function(_0x5bb169){return db['CmHopper'][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x33ac47}})[_0x93b1('0x19')](function(_0x3f02d3){db[_0x93b1('0x96')][_0x93b1('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x93b1('0x77')](_0x3f02d3,'id')}}});})[_0x93b1('0x19')](function(){_0x5bb169(0x1);});});}function addCmHopperPhones(_0x465aad){return new Promise(function(_0x7c0f4c){return db[_0x93b1('0x41')][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x465aad}})[_0x93b1('0x19')](function(_0x540b23){var _0x46d2a8=[];_[_0x93b1('0x77')](_0x540b23,function(_0x3bac08){_0x46d2a8[_0x93b1('0x63')](createCmHopperPhone(_0x465aad,_0x3bac08['id']));});Promise[_0x93b1('0x90')](_0x46d2a8)['then'](function(){_0x7c0f4c(0x1);});});});}function createCmHopperPhone(_0x2d3d4b,_0x13b5b2){return new Promise(function(_0x375b79){db[_0x93b1('0x6f')][_0x93b1('0x24')]({'raw':!![],'attributes':['item',_0x93b1('0x94')],'where':{'CmContactId':_0x2d3d4b,'ItemClass':_0x93b1('0x95')},'include':[{'model':db['ContactItemType'],'attributes':[_0x93b1('0x94')],'as':_0x93b1('0x71')}],'order':[_0x93b1('0x94'),db[_0x93b1('0x72')][_0x93b1('0x73')](_0x93b1('0x97'))]})[_0x93b1('0x19')](function(_0x2e8f22){var _0x1c97bd=0x1;var _0x53e801=_[_0x93b1('0x77')](_0x2e8f22,function(_0x1c115f){_0x1c115f['CmHopperId']=_0x13b5b2;_0x1c115f[_0x93b1('0x81')]=_0x1c115f[_0x93b1('0x98')];_0x1c115f[_0x93b1('0x94')]=_0x1c97bd;delete _0x1c115f[_0x93b1('0x99')];_0x1c97bd=_0x1c97bd+0x1;return _0x1c115f;});return db[_0x93b1('0x96')][_0x93b1('0x9a')](_0x53e801,{});})[_0x93b1('0x19')](function(){_0x375b79(0x1);});});}function insertAdditionalPhones(_0x1a4b27,_0x2dd626){return new Promise(function(_0x1a7d3d){var _0xbf05d4=[];for(var _0x484033=0x0;_0x484033<_0x2dd626[_0x93b1('0x2a')];_0x484033++){var _0x23e0b0=_0x2dd626[_0x484033];_0xbf05d4['push'](parseContactItemType(_0x23e0b0));}Promise[_0x93b1('0x90')](_0xbf05d4)[_0x93b1('0x19')](function(){var _0xbcc02c={'id':_0x1a4b27['id'],'items':_0x2dd626};return addAdditionalPhones(_0xbcc02c)[_0x93b1('0x19')](function(){return addCmHopperPhones(_0x1a4b27['id']);});})[_0x93b1('0x19')](function(){_0x1a7d3d(_0x1a4b27);});});}function parseContactItemType(_0x484fe1){return new Promise(function(_0x3e5366){if(_0x484fe1[_0x93b1('0x67')](_0x93b1('0x93'))){_0x3e5366(_0x484fe1);}else{return db['ContactItemType'][_0x93b1('0x28')]({'where':{'name':_0x484fe1['ItemType']}})[_0x93b1('0x19')](function(_0x406f20){if(_['isNil'](_0x406f20))_0x484fe1['ItemTypeId']=null;else _0x484fe1['ItemTypeId']=_0x406f20['id'];_0x3e5366(_0x484fe1);});}});}exports['getAdditionalPhones']=function(_0x4c6a07,_0x3ce48c){return db[_0x93b1('0x6f')][_0x93b1('0x24')]({'raw':!![],'where':{'CmContactId':_0x4c6a07[_0x93b1('0x6a')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[['OrderBy'],[db['sequelize'][_0x93b1('0x73')]('`ItemType`.OrderBy')]]})[_0x93b1('0x19')](function(_0xca82c2){return _0xca82c2;})[_0x93b1('0x19')](respondWithResult(_0x3ce48c,null))[_0x93b1('0x26')](handleError(_0x3ce48c,null));};exports[_0x93b1('0x9b')]=function(_0x345da2,_0x13617b){return db[_0x93b1('0x6f')]['findAll']({'raw':!![],'where':{'CmContactId':_0x345da2[_0x93b1('0x39')][_0x93b1('0x9c')]}})[_0x93b1('0x19')](function(_0x4d8020){var _0x204222=_['map'](_0x4d8020,function(_0x44e1b6){_0x44e1b6[_0x93b1('0x9d')]=_0x345da2[_0x93b1('0x39')][_0x93b1('0x9e')];return _0x44e1b6;});return db[_0x93b1('0x6f')]['bulkCreate'](_0x204222,{});})[_0x93b1('0x19')](function(){return addCmHopperPhones(_0x345da2[_0x93b1('0x39')][_0x93b1('0x9e')]);})['then'](function(){return['ok'];})[_0x93b1('0x19')](respondWithResult(_0x13617b,null))[_0x93b1('0x26')](handleError(_0x13617b,null));};exports[_0x93b1('0x9f')]=function(_0x28f657,_0x56612d){var _0x1e1574=[];_0x1e1574[_0x93b1('0x63')](createCmHopperPhone(_0x28f657[_0x93b1('0x39')]['id'],_0x28f657[_0x93b1('0x39')]['hopperId']));Promise[_0x93b1('0x90')](_0x1e1574)[_0x93b1('0x19')](function(){return[0x1];})[_0x93b1('0x19')](respondWithResult(_0x56612d,null));};exports[_0x93b1('0xa0')]=function(_0x5dd16d,_0x10dd9c){var _0x39f0ac={'raw':![],'where':{}};var _0x39a74c={};var _0x3f32e6={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x5dd16d[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x10dd9c,null))[_0x93b1('0x19')](function(_0x311a59){if(_0x311a59){_0x39a74c[_0x93b1('0x84')]=_[_0x93b1('0x29')](db[_0x93b1('0x41')]['rawAttributes']);_0x39a74c[_0x93b1('0x25')]=_[_0x93b1('0x29')](_0x5dd16d[_0x93b1('0x25')]);_0x39a74c[_0x93b1('0x86')]=_['intersection'](_0x39a74c['model'],_0x39a74c[_0x93b1('0x25')]);_0x39f0ac[_0x93b1('0x87')]=_[_0x93b1('0xa1')](_0x39a74c[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x88')]));_0x39f0ac[_0x93b1('0x87')]=_0x39f0ac[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x39f0ac[_0x93b1('0x87')]:_0x39a74c[_0x93b1('0x84')];if(!_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x39f0ac[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x5dd16d['query'][_0x93b1('0x14')]);_0x39f0ac[_0x93b1('0x12')]=qs[_0x93b1('0x12')](_0x5dd16d['query'][_0x93b1('0x12')]);}_0x39f0ac['order']=qs[_0x93b1('0x89')](_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x89')]);_0x39f0ac[_0x93b1('0x64')]=qs[_0x93b1('0x86')](_[_0x93b1('0x8a')](_0x5dd16d['query'],_0x39a74c[_0x93b1('0x86')]));_0x39f0ac['where']['ContactId']=_0x311a59['id'];if(_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x39f0ac[_0x93b1('0x64')]=_[_0x93b1('0x38')](_0x39f0ac[_0x93b1('0x64')],{'$or':_[_0x93b1('0x77')](_0x39f0ac[_0x93b1('0x87')],function(_0x3c6d9f){var _0x1343ce={};_0x1343ce[_0x3c6d9f]={'$like':'%'+_0x5dd16d[_0x93b1('0x25')][_0x93b1('0x8b')]+'%'};return _0x1343ce;})});}_0x39f0ac=_['merge']({},_0x39f0ac,_0x5dd16d[_0x93b1('0x8c')]);return db[_0x93b1('0x41')][_0x93b1('0x15')]({'where':_0x39f0ac['where']})['then'](function(_0x458bb4){_0x3f32e6[_0x93b1('0x15')]=_0x458bb4;if(_0x5dd16d['query'][_0x93b1('0xa2')]){_0x39f0ac['include']=[{'all':!![]}];}return db[_0x93b1('0x41')][_0x93b1('0x24')](_0x39f0ac);})[_0x93b1('0x19')](function(_0x65d9bf){_0x3f32e6[_0x93b1('0xa3')]=_0x65d9bf;return _0x3f32e6;});}})['then'](respondWithFilteredResult(_0x10dd9c,_0x39f0ac))[_0x93b1('0x26')](handleError(_0x10dd9c,null));};exports['getHopperHistories']=function(_0x54fae1,_0x55200f){var _0x54909e={'raw':!![],'where':{}};var _0x14a67f={};var _0x26444f={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x54fae1[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x55200f,null))[_0x93b1('0x19')](function(_0x9305f9){if(_0x9305f9){_0x14a67f[_0x93b1('0x84')]=_[_0x93b1('0x29')](db['CmHopperHistory'][_0x93b1('0x85')]);_0x14a67f['query']=_[_0x93b1('0x29')](_0x54fae1[_0x93b1('0x25')]);_0x14a67f[_0x93b1('0x86')]=_['intersection'](_0x14a67f['model'],_0x14a67f['query']);_0x54909e['attributes']=_['intersection'](_0x14a67f[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x54fae1['query'][_0x93b1('0x88')]));_0x54909e[_0x93b1('0x87')]=_0x54909e[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x54909e['attributes']:_0x14a67f[_0x93b1('0x84')];if(!_0x54fae1[_0x93b1('0x25')][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x54909e['limit']=qs[_0x93b1('0x14')](_0x54fae1[_0x93b1('0x25')]['limit']);_0x54909e[_0x93b1('0x12')]=qs[_0x93b1('0x12')](_0x54fae1[_0x93b1('0x25')][_0x93b1('0x12')]);}_0x54909e['order']=qs[_0x93b1('0x89')](_0x54fae1[_0x93b1('0x25')][_0x93b1('0x89')]);_0x54909e[_0x93b1('0x64')]=qs['filters'](_['pick'](_0x54fae1[_0x93b1('0x25')],_0x14a67f['filters']));_0x54909e[_0x93b1('0x64')][_0x93b1('0xa4')]=_0x9305f9['id'];if(_0x54fae1[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x54909e[_0x93b1('0x64')]=_['merge'](_0x54909e['where'],{'$or':_[_0x93b1('0x77')](_0x54909e['attributes'],function(_0x594b76){var _0x58b44d={};_0x58b44d[_0x594b76]={'$like':'%'+_0x54fae1[_0x93b1('0x25')]['filter']+'%'};return _0x58b44d;})});}_0x54909e=_[_0x93b1('0x38')]({},_0x54909e,_0x54fae1[_0x93b1('0x8c')]);return db[_0x93b1('0x50')][_0x93b1('0x15')]({'where':_0x54909e[_0x93b1('0x64')]})['then'](function(_0x4838f4){_0x26444f[_0x93b1('0x15')]=_0x4838f4;if(_0x54fae1[_0x93b1('0x25')][_0x93b1('0xa2')]){_0x54909e[_0x93b1('0xa5')]=[{'all':!![]}];}return db[_0x93b1('0x50')][_0x93b1('0x24')](_0x54909e);})['then'](function(_0x57bfe3){_0x26444f[_0x93b1('0xa3')]=_0x57bfe3;return _0x26444f;});}})['then'](respondWithFilteredResult(_0x55200f,_0x54909e))['catch'](handleError(_0x55200f,null));};exports[_0x93b1('0xa6')]=function(_0x3dde41,_0x50f553){var _0x133527={'raw':!![],'where':{}};var _0x31d190={};var _0x35eafe={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x3dde41[_0x93b1('0x6a')]['id']}})[_0x93b1('0x19')](handleEntityNotFound(_0x50f553,null))[_0x93b1('0x19')](function(_0x44bf2a){if(_0x44bf2a){_0x31d190[_0x93b1('0x84')]=_['keys'](db[_0x93b1('0x4f')][_0x93b1('0x85')]);_0x31d190['query']=_[_0x93b1('0x29')](_0x3dde41[_0x93b1('0x25')]);_0x31d190[_0x93b1('0x86')]=_[_0x93b1('0xa1')](_0x31d190[_0x93b1('0x84')],_0x31d190['query']);_0x133527[_0x93b1('0x87')]=_[_0x93b1('0xa1')](_0x31d190[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x3dde41[_0x93b1('0x25')]['fields']));_0x133527[_0x93b1('0x87')]=_0x133527['attributes'][_0x93b1('0x2a')]?_0x133527[_0x93b1('0x87')]:_0x31d190[_0x93b1('0x84')];if(!_0x3dde41['query'][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x133527['limit']=qs[_0x93b1('0x14')](_0x3dde41['query'][_0x93b1('0x14')]);_0x133527['offset']=qs[_0x93b1('0x12')](_0x3dde41[_0x93b1('0x25')]['offset']);}_0x133527['order']=qs[_0x93b1('0x89')](_0x3dde41[_0x93b1('0x25')][_0x93b1('0x89')]);_0x133527[_0x93b1('0x64')]=qs[_0x93b1('0x86')](_[_0x93b1('0x8a')](_0x3dde41[_0x93b1('0x25')],_0x31d190['filters']));_0x133527[_0x93b1('0x64')]['ContactId']=_0x44bf2a['id'];if(_0x3dde41[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x133527[_0x93b1('0x64')]=_['merge'](_0x133527[_0x93b1('0x64')],{'$or':_[_0x93b1('0x77')](_0x133527['attributes'],function(_0x4bcf9c){var _0x4ee62a={};_0x4ee62a[_0x4bcf9c]={'$like':'%'+_0x3dde41[_0x93b1('0x25')]['filter']+'%'};return _0x4ee62a;})});}_0x133527=_[_0x93b1('0x38')]({},_0x133527,_0x3dde41[_0x93b1('0x8c')]);return db[_0x93b1('0x4f')]['count']({'where':_0x133527[_0x93b1('0x64')]})[_0x93b1('0x19')](function(_0x3b50f8){_0x35eafe['count']=_0x3b50f8;if(_0x3dde41['query'][_0x93b1('0xa2')]){_0x133527[_0x93b1('0xa5')]=[{'all':!![]}];}return db[_0x93b1('0x4f')][_0x93b1('0x24')](_0x133527);})['then'](function(_0x47b8fd){_0x35eafe['rows']=_0x47b8fd;return _0x35eafe;});}})[_0x93b1('0x19')](respondWithFilteredResult(_0x50f553,_0x133527))[_0x93b1('0x26')](handleError(_0x50f553,null));};exports[_0x93b1('0xa7')]=function(_0x59cc0c,_0x2d805a){var _0x9aaf69={'raw':!![],'where':{}};var _0x1ee13b={};var _0x103682={'count':0x0,'rows':[]};return db[_0x93b1('0x27')][_0x93b1('0x83')]({'where':{'id':_0x59cc0c['params']['id']}})['then'](handleEntityNotFound(_0x2d805a,null))[_0x93b1('0x19')](function(_0x53563c){if(_0x53563c){_0x1ee13b[_0x93b1('0x84')]=_[_0x93b1('0x29')](db['JscriptySessionReport']['rawAttributes']);_0x1ee13b['query']=_[_0x93b1('0x29')](_0x59cc0c[_0x93b1('0x25')]);_0x1ee13b[_0x93b1('0x86')]=_[_0x93b1('0xa1')](_0x1ee13b[_0x93b1('0x84')],_0x1ee13b[_0x93b1('0x25')]);_0x9aaf69[_0x93b1('0x87')]=_[_0x93b1('0xa1')](_0x1ee13b[_0x93b1('0x84')],qs[_0x93b1('0x88')](_0x59cc0c['query'][_0x93b1('0x88')]));_0x9aaf69['attributes']=_0x9aaf69[_0x93b1('0x87')][_0x93b1('0x2a')]?_0x9aaf69[_0x93b1('0x87')]:_0x1ee13b[_0x93b1('0x84')];if(!_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x67')](_0x93b1('0x8d'))){_0x9aaf69[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x59cc0c['query'][_0x93b1('0x14')]);_0x9aaf69[_0x93b1('0x12')]=qs[_0x93b1('0x12')](_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x12')]);}_0x9aaf69[_0x93b1('0xa8')]=qs[_0x93b1('0x89')](_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x89')]);_0x9aaf69['where']=qs[_0x93b1('0x86')](_[_0x93b1('0x8a')](_0x59cc0c['query'],_0x1ee13b[_0x93b1('0x86')]));_0x9aaf69[_0x93b1('0x64')]['ContactId']=_0x53563c['id'];if(_0x59cc0c[_0x93b1('0x25')][_0x93b1('0x8b')]){_0x9aaf69[_0x93b1('0x64')]=_['merge'](_0x9aaf69['where'],{'$or':_[_0x93b1('0x77')](_0x9aaf69[_0x93b1('0x87')],function(_0x3af6ad){var _0x3d1925={};_0x3d1925[_0x3af6ad]={'$like':'%'+_0x59cc0c['query'][_0x93b1('0x8b')]+'%'};return _0x3d1925;})});}_0x9aaf69=_[_0x93b1('0x38')]({},_0x9aaf69,_0x59cc0c[_0x93b1('0x8c')]);return db[_0x93b1('0x57')][_0x93b1('0x15')]({'where':_0x9aaf69[_0x93b1('0x64')]})[_0x93b1('0x19')](function(_0x598bf1){_0x103682[_0x93b1('0x15')]=_0x598bf1;if(_0x59cc0c[_0x93b1('0x25')][_0x93b1('0xa2')]){_0x9aaf69['include']=[{'all':!![]}];}return db[_0x93b1('0x57')][_0x93b1('0x24')](_0x9aaf69);})[_0x93b1('0x19')](function(_0x47efa7){_0x103682[_0x93b1('0xa3')]=_0x47efa7;return _0x103682;});}})[_0x93b1('0x19')](respondWithFilteredResult(_0x2d805a,_0x9aaf69))[_0x93b1('0x26')](handleError(_0x2d805a,null));};exports[_0x93b1('0xa9')]=function(_0x1a4192,_0x4cc861){try{if(!_0x1a4192[_0x93b1('0x39')][_0x93b1('0x65')]){throw new Error(_0x93b1('0xaa'));}if(!_0x1a4192[_0x93b1('0x39')][_0x93b1('0xab')]){throw new Error(_0x93b1('0xac'));}if(!_0x1a4192['body'][_0x93b1('0xad')]){throw new Error(_0x93b1('0xae'));}if(!_0x1a4192[_0x93b1('0x39')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x54f2ec=_0x1a4192[_0x93b1('0x39')]['binding_keys'][_0x93b1('0xaf')](',');var _0x1ad04c=_0x1a4192['body']['binding_values'][_0x93b1('0xaf')](',');if(!_0x54f2ec[_0x93b1('0x2a')]||!_0x1ad04c[_0x93b1('0x2a')]||_0x54f2ec[_0x93b1('0x2a')]!==_0x1ad04c[_0x93b1('0x2a')]){throw new Error(_0x93b1('0xb0'));}_0x1a4192[_0x93b1('0x39')][_0x93b1('0x88')]=_[_0x93b1('0xb1')](_0x54f2ec,_0x1ad04c);if(!_0x1a4192[_0x93b1('0x39')][_0x93b1('0x88')][_0x93b1('0x81')]){throw new Error(_0x93b1('0xb2'));}if(!_0x1a4192['body']['fields'][_0x93b1('0xb3')]){throw new Error(_0x93b1('0xb4'));}var _0x266504=path['join'](config['root'],_0x93b1('0xb5'),_0x1a4192[_0x93b1('0xb6')]['filename']);fs[_0x93b1('0xb7')](_0x266504,parseInt(_0x93b1('0xb8'),0x8));var _0x1604f7=require(_0x93b1('0xb9'))[_0x93b1('0xba')](path[_0x93b1('0x3f')](__dirname,_0x93b1('0xbb')),[_0x266504,_0x1a4192[_0x93b1('0x39')][_0x93b1('0xab')],_0x1a4192[_0x93b1('0x39')][_0x93b1('0xad')],_0x1a4192[_0x93b1('0x39')]['ListId'],_0x1a4192['body'][_0x93b1('0xbc')],_0x1a4192[_0x93b1('0x39')][_0x93b1('0x61')],_0x1a4192[_0x93b1('0x39')]['socket_timestamp']]);return _0x4cc861[_0x93b1('0x11')](0xc8)[_0x93b1('0x18')]({'message':_0x93b1('0xbd'),'pid':_0x1604f7[_0x93b1('0xbe')]});}catch(_0x38c11a){return _0x4cc861['status'](0x1f4)[_0x93b1('0x20')](_0x38c11a);}};exports['upload']=function(_0x3978a6,_0x5663d5){var _0x6ee2c6=fs[_0x93b1('0xbf')](_0x3978a6['file']['path']);Papa[_0x93b1('0xc0')](_0x6ee2c6,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2ce60e){return _0x5663d5[_0x93b1('0x11')](0xc8)[_0x93b1('0x18')]({'file':_0x3978a6[_0x93b1('0xb6')],'fields':_0x2ce60e[_0x93b1('0xc1')][_0x93b1('0x88')]});}});};exports[_0x93b1('0xc2')]=function(_0x55414c,_0x50109d){return db[_0x93b1('0xc3')][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0x93b1('0xc4')}})[_0x93b1('0x19')](function(_0x78b4c3){var _0xb6ee5e=![];if(!_0x55414c[_0x93b1('0x39')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x55414c[_0x93b1('0x39')][_0x93b1('0xc5')][_0x93b1('0x81')]){throw new Error(_0x93b1('0xb2'));}if(!_0x55414c['body'][_0x93b1('0xc5')][_0x93b1('0xb3')]){throw new Error(_0x93b1('0xb4'));}if(!_0x55414c[_0x93b1('0x39')]['socket_timestamp']){throw new Error(_0x93b1('0xc6'));}var _0x3584a7=require(_0x93b1('0xb9'))[_0x93b1('0xba')](path['join'](__dirname,_0x93b1('0xc7')),[_0x55414c[_0x93b1('0x6a')]['id'],JSON[_0x93b1('0xc8')](_0x55414c[_0x93b1('0x39')]),JSON[_0x93b1('0xc8')](_0x78b4c3)]);_0x3584a7['on'](_0x93b1('0xc9'),function(){_0xb6ee5e=!![];return _0x50109d[_0x93b1('0x11')](0xc8)['json']({'message':_0x93b1('0xca'),'pid':_0x3584a7['pid']});});_0x3584a7['on'](_0x93b1('0xcb'),function(_0x19dcc0){if(_0x19dcc0&&!_0xb6ee5e){return _0x50109d['status'](0x1f4)[_0x93b1('0x18')]({'message':_0x93b1('0xcc'),'pid':_0x3584a7[_0x93b1('0xbe')]});}});})['catch'](handleError(_0x50109d,null));};exports[_0x93b1('0xcd')]=function(_0x51c1f2,_0x634e34){return db[_0x93b1('0xc3')][_0x93b1('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0x93b1('0xc4')}})[_0x93b1('0x19')](function(_0x265111){var _0x1fcb5f=![];if(!_0x51c1f2[_0x93b1('0x39')]['ListId']){throw new Error(_0x93b1('0xaa'));}if(!_0x51c1f2[_0x93b1('0x39')][_0x93b1('0xc5')][_0x93b1('0x81')]){throw new Error(_0x93b1('0xb2'));}if(!_0x51c1f2[_0x93b1('0x39')][_0x93b1('0xc5')][_0x93b1('0xb3')]){throw new Error(_0x93b1('0xb4'));}if(!_0x51c1f2[_0x93b1('0x39')]['socket_timestamp']){throw new Error(_0x93b1('0xc6'));}var _0x5bb8d7=require('child_process')['fork'](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x51c1f2['params']['id'],JSON[_0x93b1('0xc8')](_0x51c1f2[_0x93b1('0x39')]),JSON[_0x93b1('0xc8')](_0x265111)]);_0x5bb8d7['on'](_0x93b1('0xc9'),function(){_0x1fcb5f=!![];return _0x634e34[_0x93b1('0x11')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x5bb8d7[_0x93b1('0xbe')]});});_0x5bb8d7['on'](_0x93b1('0xcb'),function(_0x5ef2ed){if(_0x5ef2ed&&!_0x1fcb5f){return _0x634e34[_0x93b1('0x11')](0x1f4)['json']({'message':_0x93b1('0xcc'),'pid':_0x5bb8d7[_0x93b1('0xbe')]});}});})[_0x93b1('0x26')](handleError(_0x634e34,null));};exports[_0x93b1('0xce')]=function(_0x30fd24,_0x247668){var _0x619033=[_0x93b1('0xcf'),'chat',_0x93b1('0xd0'),_0x93b1('0xd1'),_0x93b1('0xd2'),_0x93b1('0xd3'),_0x93b1('0xd4')];var _0x146d3f={'offset':0x0,'order':qs['sort'](_0x93b1('0xd5'))},_0x1acd98={'count':0x0,'rows':[]};Promise['resolve']()[_0x93b1('0x19')](function(){if(_0x30fd24[_0x93b1('0x25')]['channel']){if(!_[_0x93b1('0xd6')](_0x619033,_0x30fd24['query'][_0x93b1('0xd7')][_0x93b1('0xd8')]())){throw new Error(_0x93b1('0xd9'));}_0x619033=[_0x30fd24[_0x93b1('0x25')]['channel'][_0x93b1('0xd8')]()];}if(_0x30fd24[_0x93b1('0x25')]['range']){try{var _0x397b71=JSON[_0x93b1('0xc0')](_0x30fd24[_0x93b1('0x25')][_0x93b1('0xda')]);if(!moment(_0x397b71[_0x93b1('0x3a')])[_0x93b1('0xdb')]()){throw new Error(_0x93b1('0xdc'));}if(!moment(_0x397b71['to'])[_0x93b1('0xdb')]()){throw new Error(_0x93b1('0xdd'));}}catch(_0x21b231){throw new Error(_0x93b1('0xde'));}}if(!_0x30fd24[_0x93b1('0x25')][_0x93b1('0x67')]('nolimit')){_0x146d3f[_0x93b1('0x14')]=qs[_0x93b1('0x14')](_0x30fd24[_0x93b1('0x25')][_0x93b1('0x14')]||0xa);_0x146d3f['offset']=qs[_0x93b1('0x12')](_0x30fd24[_0x93b1('0x25')][_0x93b1('0x12')]);}var _0x446ab2=_0x619033[_0x93b1('0x77')](function(_0x4b0598){if(_0x4b0598==='voice'){var _0x4f5271={'attributes':['id',_0x93b1('0xdf'),'type',_0x93b1('0xe0'),'destination',_0x93b1('0xe1'),_0x93b1('0xe2'),_0x93b1('0xe3'),_0x93b1('0xe4'),'note',_0x93b1('0xe5'),_0x93b1('0xe6'),_0x93b1('0xe7'),_0x93b1('0xe8'),_0x93b1('0xe9')],'where':{'ContactId':_0x30fd24['params']['id']},'include':[{'model':db[_0x93b1('0xc3')],'as':'User','attributes':['id',_0x93b1('0x1f'),'fullname',_0x93b1('0x31')]}],'order':[[_0x93b1('0xe5'),_0x93b1('0xea')]]};if(_0x30fd24[_0x93b1('0x25')][_0x93b1('0xda')]){_0x4f5271['where'][_0x93b1('0xe5')]={'$gte':_0x397b71['from'],'$lte':_0x397b71['to']};}return db[_0x93b1('0xeb')][_0x93b1('0xec')](_0x4f5271)['then'](function(_0x381492){_0x1acd98[_0x93b1('0x15')]+=_0x381492[_0x93b1('0x15')];return _[_0x93b1('0x77')](_0x381492[_0x93b1('0xa3')],function(_0x81a01b){var _0x4fa092=_0x81a01b[_0x93b1('0x3b')]({'plain':!![]});_0x4fa092[_0x93b1('0xd7')]=_0x4b0598;if(_0x4fa092[_0x93b1('0xc3')]){_0x4fa092[_0x93b1('0xc3')]={'id':_0x4fa092['User']['id'],'name':_0x4fa092[_0x93b1('0xc3')]['name'],'fullname':_0x4fa092['User'][_0x93b1('0xed')],'alias':_0x4fa092[_0x93b1('0xc3')][_0x93b1('0x31')]};}return _0x4fa092;});});}else{var _0x3da461=_[_0x93b1('0xee')](_0x4b0598)+(_0x4b0598===_0x93b1('0xef')?_0x93b1('0xf0'):'Account');var _0xc9a7f={'attributes':['id',_0x93b1('0xf1'),_0x93b1('0xf2'),_0x93b1('0xe5'),_0x93b1('0xf3'),'disposition',_0x93b1('0xf4'),_0x93b1('0xf5'),_0x93b1('0xe9'),_0x3da461+'Id'],'where':{'ContactId':_0x30fd24['params']['id']},'include':[{'model':db[_0x3da461],'as':_0x93b1('0xf6'),'attributes':['id',_0x93b1('0x1f'),_0x93b1('0xf7')]},{'model':db['User'],'as':_0x93b1('0xf8'),'attributes':['id',_0x93b1('0x1f'),_0x93b1('0xed')]},{'model':db[_0x93b1('0x6b')],'as':_0x93b1('0x6c'),'attributes':['id','name',_0x93b1('0x6d')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x30fd24[_0x93b1('0x25')][_0x93b1('0xda')]){_0xc9a7f[_0x93b1('0x64')][_0x93b1('0xe5')]={'$gte':_0x397b71[_0x93b1('0x3a')],'$lte':_0x397b71['to']};}switch(_0x4b0598){case _0x93b1('0xef'):_0xc9a7f[_0x93b1('0x87')][_0x93b1('0x63')](_0x93b1('0xf9'),_0x93b1('0xfa'),'customerPort',_0x93b1('0xfb'),'osName','ratingMessage','ratingType','ratingValue','referer');break;case _0x93b1('0xcf'):_0xc9a7f[_0x93b1('0x87')][_0x93b1('0x63')]('subject',_0x93b1('0xfc'));break;case _0x93b1('0xd1'):_0xc9a7f[_0x93b1('0x87')][_0x93b1('0x63')](_0x93b1('0xfd'),_0x93b1('0xfe'));break;}return db[_[_0x93b1('0xee')](_0x4b0598)+_0x93b1('0xff')][_0x93b1('0xec')](_0xc9a7f)[_0x93b1('0x19')](function(_0x3112a5){_0x1acd98[_0x93b1('0x15')]+=_0x3112a5[_0x93b1('0x15')];return _[_0x93b1('0x77')](_0x3112a5['rows'],function(_0x36794f){var _0x384ffe=_0x36794f[_0x93b1('0x3b')]({'plain':!![]});_0x384ffe[_0x93b1('0xd7')]=_0x4b0598;if(_0x384ffe[_0x93b1('0xf8')]){_0x384ffe[_0x93b1('0xf8')]={'id':_0x384ffe['Owner']['id'],'name':_0x384ffe[_0x93b1('0xf8')][_0x93b1('0x1f')],'fullname':_0x384ffe[_0x93b1('0xf8')]['fullname']};}return _0x384ffe;});});}});return Promise[_0x93b1('0x90')](_0x446ab2);})[_0x93b1('0x19')](function(_0x3083c5){return _(_0x3083c5)[_0x93b1('0x100')]()[_0x93b1('0x101')](_0x93b1('0xe5'))[_0x93b1('0x102')]()[_0x93b1('0x103')]();})[_0x93b1('0x19')](function(_0x2bcae3){_0x1acd98[_0x93b1('0xa3')]=_0x146d3f[_0x93b1('0x14')]?_0x2bcae3['slice'](_0x146d3f[_0x93b1('0x12')],_0x146d3f[_0x93b1('0x12')]+_0x146d3f[_0x93b1('0x14')]):_0x2bcae3;return _0x1acd98;})[_0x93b1('0x19')](respondWithFilteredResult(_0x247668,_0x146d3f))['catch'](handleError(_0x247668,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 4db2d4a..e83dfdc 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff67=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x5a2205,_0x372206){var _0xfbafee=function(_0x369f65){while(--_0x369f65){_0x5a2205['push'](_0x5a2205['shift']());}};_0xfbafee(++_0x372206);}(_0xff67,0x1c6));var _0x7ff6=function(_0x5eb3aa,_0x4ccea8){_0x5eb3aa=_0x5eb3aa-0x0;var _0x59a2d2=_0xff67[_0x5eb3aa];return _0x59a2d2;};'use strict';var EventEmitter=require(_0x7ff6('0x0'));var CmContact=require(_0x7ff6('0x1'))['db'][_0x7ff6('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x7ff6('0x3')](0x0);var events={'afterCreate':_0x7ff6('0x4'),'afterUpdate':_0x7ff6('0x5'),'afterDestroy':_0x7ff6('0x6')};function emitEvent(_0x2e8396){return function(_0x26517f,_0x462ec2,_0x34e858){CmContactEvents[_0x7ff6('0x7')](_0x2e8396+':'+_0x26517f['id'],_0x26517f);CmContactEvents['emit'](_0x2e8396,_0x26517f);_0x34e858(null);};}for(var e in events){if(events[_0x7ff6('0x8')](e)){var event=events[e];CmContact[_0x7ff6('0x9')](e,emitEvent(event));}}module[_0x7ff6('0xa')]=CmContactEvents; \ No newline at end of file +var _0xb8bd=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit'];(function(_0x23b5be,_0x3f488a){var _0x414f5a=function(_0x4bad4e){while(--_0x4bad4e){_0x23b5be['push'](_0x23b5be['shift']());}};_0x414f5a(++_0x3f488a);}(_0xb8bd,0x100));var _0xdb8b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xb8bd[_0x19b3f9];return _0x18c3f6;};'use strict';var EventEmitter=require(_0xdb8b('0x0'));var CmContact=require(_0xdb8b('0x1'))['db'][_0xdb8b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xdb8b('0x3')](0x0);var events={'afterCreate':_0xdb8b('0x4'),'afterUpdate':_0xdb8b('0x5'),'afterDestroy':_0xdb8b('0x6')};function emitEvent(_0x896e16){return function(_0x555ee5,_0x4b6c92,_0x4b183a){CmContactEvents['emit'](_0x896e16+':'+_0x555ee5['id'],_0x555ee5);CmContactEvents[_0xdb8b('0x7')](_0x896e16,_0x555ee5);_0x4b183a(null);};}for(var e in events){if(events[_0xdb8b('0x8')](e)){var event=events[e];CmContact[_0xdb8b('0x9')](e,emitEvent(event));}}module[_0xdb8b('0xa')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 9a6606b..303e7cb 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35e3=['dialCheckDuplicateType','CmList','Lists','ListId','map','all','Campaign','BlackLists','CmHopperBlack','exports','CmContact','fti_cm_contacts','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','push','info','inspect','catch','lodash','util','../../config/logger','api','moment','./cmContact.attributes','YYYY-MM-DD\x20HH:mm:ss','resolve','findOne','then','isNil','dialTimezone','timezones','scheduledat','add','minutes','format','phone','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','always','onlyIfOpen','VoiceQueue','findAll','outbound'];(function(_0x395718,_0x20322d){var _0x3028b8=function(_0x416f5c){while(--_0x416f5c){_0x395718['push'](_0x395718['shift']());}};_0x3028b8(++_0x20322d);}(_0x35e3,0xe6));var _0x335e=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x35e3[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x335e('0x0'));var util=require(_0x335e('0x1'));var logger=require(_0x335e('0x2'))(_0x335e('0x3'));var moment=require(_0x335e('0x4'));var shared=require('../../config/environment/shared');var attributes=require(_0x335e('0x5'));function getTimezoneCallbackAt(_0x2525e1,_0x316315,_0x1bfdf8,_0x210a7e){var _0x4427f7=_0x210a7e?'Campaign':'VoiceQueue';var _0x4cf0dd=_0x1bfdf8['scheduledat']?_0x1bfdf8['scheduledat']:moment()['format'](_0x335e('0x6'));if(_['isNil'](_0x1bfdf8['dialTimezone'])){return Promise[_0x335e('0x7')](_0x4cf0dd);}return _0x2525e1[_0x4427f7][_0x335e('0x8')]({'where':{'id':_0x316315}})[_0x335e('0x9')](function(_0x5a10f8){if(_[_0x335e('0xa')](_0x5a10f8)||_['isNil'](_0x5a10f8[_0x335e('0xb')])){return Promise[_0x335e('0x7')](_0x4cf0dd);}var _0x168fb8=shared[_0x335e('0xc')];var _0x20dcf7=_0x168fb8[_0x5a10f8[_0x335e('0xb')]];var _0x12df1f=_0x168fb8[_0x1bfdf8[_0x335e('0xb')]];if(_[_0x335e('0xa')](_0x20dcf7)&&_['isNil'](_0x12df1f)){return Promise[_0x335e('0x7')](_0x4cf0dd);}var _0x403fa7=_0x20dcf7['utcOffset']-_0x12df1f['utcOffset'];var _0x459923=_0x1bfdf8[_0x335e('0xd')]?_0x1bfdf8[_0x335e('0xd')]:moment();_0x4cf0dd=moment(_0x459923)[_0x335e('0xe')](_0x403fa7,_0x335e('0xf'))[_0x335e('0x10')](_0x335e('0x6'));return Promise[_0x335e('0x7')](_0x4cf0dd);});}function getNewHopperPayload(_0x851773){return{'phone':_0x851773[_0x335e('0x11')],'ContactId':_0x851773['id'],'ListId':_0x851773['ListId'],'scheduledat':_0x851773['scheduledat']?_0x851773[_0x335e('0xd')]:moment()[_0x335e('0x10')](_0x335e('0x6')),'priority':_0x851773[_0x335e('0x12')]?_0x851773[_0x335e('0x12')]:0x2,'callback':_0x851773[_0x335e('0x13')]?!![]:![],'callbackuniqueid':_0x851773[_0x335e('0x13')]?_0x851773[_0x335e('0x13')]:undefined,'callbackat':_0x851773['callbackUniqueid']?moment()[_0x335e('0x10')](_0x335e('0x6')):undefined};}function handleAlwaysCheckDuplicate(_0x3315b8,_0x58fa1b,_0x50dc83,_0x43ae79){var _0x392ac0={'phone':_0x50dc83[_0x335e('0x11')]};var _0x471cb9={'calleridnum':_0x50dc83[_0x335e('0x11')]};if(_0x43ae79){Object['assign'](_0x392ac0,{'CampaignId':_0x58fa1b['id']});Object[_0x335e('0x14')](_0x471cb9,{'CampaignId':_0x58fa1b['id']});}else{Object[_0x335e('0x14')](_0x392ac0,{'VoiceQueueId':_0x58fa1b['id']});Object[_0x335e('0x14')](_0x471cb9,{'VoiceQueueId':_0x58fa1b['id']});}return _0x3315b8[_0x335e('0x15')]['findOne']({'where':_0x392ac0})[_0x335e('0x9')](function(_0x5c9af1){if(_0x5c9af1){throw new Error(_0x335e('0x16')+_0x50dc83['phone']+_0x335e('0x17')+_0x58fa1b['id']);}return _0x3315b8[_0x335e('0x18')][_0x335e('0x8')]({'where':_0x471cb9});})[_0x335e('0x9')](function(_0x491312){if(_0x491312){throw new Error(_0x335e('0x19')+_0x50dc83[_0x335e('0x11')]+_0x335e('0x17')+_0x58fa1b['id']);}var _0x30247f=getNewHopperPayload(_0x50dc83);if(_0x43ae79){_0x30247f[_0x335e('0x1a')]=_0x58fa1b['id'];}else{_0x30247f['VoiceQueueId']=_0x58fa1b['id'];}return _0x3315b8[_0x335e('0x15')]['create'](_0x30247f);});}function handleOnlyIfOpenCheckDuplicate(_0x436f1b,_0x22f52d,_0x2c1408,_0x22a69f){var _0x1da7e4={'phone':_0x2c1408['phone']};if(_0x22a69f){Object['assign'](_0x1da7e4,{'CampaignId':_0x22f52d['id']});}else{Object['assign'](_0x1da7e4,{'VoiceQueueId':_0x22f52d['id']});}return _0x436f1b[_0x335e('0x15')][_0x335e('0x8')]({'where':_0x1da7e4})[_0x335e('0x9')](function(_0x1f24b2){if(_0x1f24b2){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x2c1408['phone']+_0x335e('0x17')+_0x22f52d['id']);}var _0x42b33e=getNewHopperPayload(_0x2c1408);if(_0x22a69f){_0x42b33e[_0x335e('0x1a')]=_0x22f52d['id'];}else{_0x42b33e[_0x335e('0x1b')]=_0x22f52d['id'];}return _0x436f1b[_0x335e('0x15')][_0x335e('0x1c')](_0x42b33e);});}function handleNeverCheckDuplicate(_0xbbe068,_0x96647d,_0x26564d){var _0x360084=getNewHopperPayload(_0x26564d);_0x360084[_0x335e('0x1b')]=_0x96647d['id'];return _0xbbe068[_0x335e('0x15')]['create'](_0x360084);}function handleCheckDuplicate(_0x1ab7af,_0x88753e,_0x22a22b,_0x4a0c47){return getTimezoneCallbackAt(_0x1ab7af,_0x88753e,_0x22a22b,_0x4a0c47)[_0x335e('0x9')](function(_0xe2dbbf){_0x22a22b[_0x335e('0xd')]=_0xe2dbbf;switch(_0x88753e['dialCheckDuplicateType']){case _0x335e('0x1d'):return handleAlwaysCheckDuplicate(_0x1ab7af,_0x88753e,_0x22a22b,_0x4a0c47);case _0x335e('0x1e'):return handleOnlyIfOpenCheckDuplicate(_0x1ab7af,_0x88753e,_0x22a22b,_0x4a0c47);default:return handleNeverCheckDuplicate(_0x1ab7af,_0x88753e,_0x22a22b);}});}function createHopperForVoiceQueues(_0x3ef36f,_0x155f69){return _0x3ef36f[_0x335e('0x1f')][_0x335e('0x20')]({'where':{'type':_0x335e('0x21')},'attributes':['id',_0x335e('0x22'),_0x335e('0xb')],'include':[{'model':_0x3ef36f[_0x335e('0x23')],'as':_0x335e('0x24'),'where':{'id':_0x155f69[_0x335e('0x25')]}}],'raw':!![]})[_0x335e('0x9')](function(_0x1f5f05){var _0x26c29a=_0x1f5f05[_0x335e('0x26')](function(_0x2f7118){return handleCheckDuplicate(_0x3ef36f,_0x2f7118,_0x155f69,![]);});return Promise[_0x335e('0x27')](_0x26c29a);});}function createHopperForCampaigns(_0x4e63ca,_0x3397d3){return _0x4e63ca[_0x335e('0x28')][_0x335e('0x20')]({'attributes':['id','dialCheckDuplicateType',_0x335e('0xb')],'include':[{'model':_0x4e63ca[_0x335e('0x23')],'as':'Lists','where':{'id':_0x3397d3[_0x335e('0x25')]}}],'raw':!![]})[_0x335e('0x9')](function(_0x2f235c){var _0x53bec2=_0x2f235c[_0x335e('0x26')](function(_0x2e9bae){return handleCheckDuplicate(_0x4e63ca,_0x2e9bae,_0x3397d3,!![]);});return Promise[_0x335e('0x27')](_0x53bec2);});}function createHopperBlackForVoiceQueues(_0x4b9871,_0x32b29c){return _0x4b9871[_0x335e('0x1f')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x4b9871[_0x335e('0x23')],'as':_0x335e('0x29'),'where':{'id':_0x32b29c['ListId']}}],'raw':!![]})[_0x335e('0x9')](function(_0x5302d9){var _0x917c58=_0x5302d9[_0x335e('0x26')](function(_0x503c6f){return _0x4b9871[_0x335e('0x2a')]['create']({'phone':_0x32b29c[_0x335e('0x11')],'ContactId':_0x32b29c['id'],'ListId':_0x32b29c[_0x335e('0x25')],'VoiceQueueId':_0x503c6f['id']});});return Promise[_0x335e('0x27')](_0x917c58);});}function createHopperBlackForCampaigns(_0x127e2d,_0x537be4){return _0x127e2d['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x127e2d[_0x335e('0x23')],'as':_0x335e('0x29'),'where':{'id':_0x537be4[_0x335e('0x25')]}}],'raw':!![]})[_0x335e('0x9')](function(_0x2a26f6){var _0x1ac79c=_0x2a26f6[_0x335e('0x26')](function(_0x70194b){return _0x127e2d[_0x335e('0x2a')][_0x335e('0x1c')]({'phone':_0x537be4[_0x335e('0x11')],'ContactId':_0x537be4['id'],'ListId':_0x537be4[_0x335e('0x25')],'CampaignId':_0x70194b['id']});});return Promise[_0x335e('0x27')](_0x1ac79c);});}module[_0x335e('0x2b')]=function(_0x495e4e){return _0x495e4e['define'](_0x335e('0x2c'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x335e('0x11'),'fields':[_0x335e('0x11')]},{'name':_0x335e('0x2d'),'fields':['firstName',_0x335e('0x2e'),'phone','mobile',_0x335e('0x2f'),_0x335e('0x30')],'type':_0x335e('0x31')}],'timestamps':!![],'charset':_0x335e('0x32'),'collate':_0x335e('0x33'),'hooks':{'afterCreate':function(_0x532368,_0xae08f7,_0x2061e2){var _0x4164a3=_0x495e4e[_0x335e('0x34')];var _0x275dfb=_0x532368[_0x335e('0x35')]({'plain':!![]});if(!_0x275dfb['ListId']){logger[_0x335e('0x36')](_0x335e('0x37')+_0x275dfb['id']);return _0x2061e2();}if(!_0x275dfb[_0x335e('0x11')]){return _0x2061e2();}return createHopperForVoiceQueues(_0x4164a3,_0x275dfb)[_0x335e('0x9')](function(){return createHopperBlackForVoiceQueues(_0x4164a3,_0x275dfb);})[_0x335e('0x9')](function(){return createHopperForCampaigns(_0x4164a3,_0x275dfb);})[_0x335e('0x9')](function(){return createHopperBlackForCampaigns(_0x4164a3,_0x275dfb);})[_0x335e('0x9')](function(){return _0x2061e2();})['catch'](function(_0x25e351){logger['error'](_0x335e('0x38'),_0x25e351[_0x335e('0x39')]);_0x2061e2();});},'afterDestroy':function(_0x5471ff,_0x4c0960,_0xb1d959){var _0x12cccd=_0x495e4e['models'];var _0x4dbf8e=_0x5471ff[_0x335e('0x35')]({'plain':!![]});return _0x12cccd[_0x335e('0x15')]['findAll']({'raw':!![],'where':{'ListId':_0x4dbf8e[_0x335e('0x25')],'ContactId':_0x4dbf8e['id']}})[_0x335e('0x9')](function(_0x584844){if(!_[_0x335e('0x3a')](_0x584844)){var _0x39a25d=[];for(var _0x4bbe3b=0x0;_0x4bbe3b<_0x584844[_0x335e('0x3b')];_0x4bbe3b+=0x1){var _0x26fbf2=_0x12cccd[_0x335e('0x15')][_0x335e('0x3c')]({'where':{'ListId':_0x584844[_0x4bbe3b]['ListId'],'ContactId':_0x584844[_0x4bbe3b][_0x335e('0x3d')],'VoiceQueueId':_0x584844[_0x4bbe3b]['VoiceQueueId'],'CampaignId':_0x584844[_0x4bbe3b][_0x335e('0x1a')]}});_0x39a25d[_0x335e('0x3e')](_0x26fbf2);}return Promise[_0x335e('0x27')](_0x39a25d);}})[_0x335e('0x9')](function(_0x3e8fdc){logger[_0x335e('0x3f')]('[CmContact][afterDestroy][Succesfull]',util[_0x335e('0x40')](_0x3e8fdc,{'showHidden':![],'depth':null}));_0xb1d959();})[_0x335e('0x41')](function(_0x23b3c0){logger[_0x335e('0x36')]('[CmContact][afterDestroy][Error]',util[_0x335e('0x40')](_0x23b3c0,{'showHidden':![],'depth':null}));_0xb1d959(_0x23b3c0);});}}});}; \ No newline at end of file +var _0x3882=['cm_contacts','fti_cm_contacts','mobile','fax','email','FULLTEXT','utf8mb4','models','error','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','../../config/logger','api','moment','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','minutes','ListId','priority','callbackUniqueid','assign','CmHopper','phone','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','\x20in\x20Campaign\x20with\x20id\x20','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','dialCheckDuplicateType','CmHopperBlack','all','exports','define','CmContact'];(function(_0x395e3c,_0x2e9e9f){var _0xc08d78=function(_0x29a5d3){while(--_0x29a5d3){_0x395e3c['push'](_0x395e3c['shift']());}};_0xc08d78(++_0x2e9e9f);}(_0x3882,0x155));var _0x2388=function(_0x3f9e8c,_0x4f6caf){_0x3f9e8c=_0x3f9e8c-0x0;var _0x590945=_0x3882[_0x3f9e8c];return _0x590945;};'use strict';var _=require(_0x2388('0x0'));var util=require('util');var logger=require(_0x2388('0x1'))(_0x2388('0x2'));var moment=require(_0x2388('0x3'));var shared=require('../../config/environment/shared');var attributes=require(_0x2388('0x4'));function getTimezoneCallbackAt(_0x1836ce,_0x1ce9f4,_0x5e93fa,_0x570065){var _0x200d71=_0x570065?_0x2388('0x5'):_0x2388('0x6');var _0x2c3df4=_0x5e93fa['scheduledat']?_0x5e93fa[_0x2388('0x7')]:moment()[_0x2388('0x8')](_0x2388('0x9'));if(_[_0x2388('0xa')](_0x5e93fa[_0x2388('0xb')])){return Promise[_0x2388('0xc')](_0x2c3df4);}return _0x1836ce[_0x200d71][_0x2388('0xd')]({'where':{'id':_0x1ce9f4}})[_0x2388('0xe')](function(_0x2a4767){if(_['isNil'](_0x2a4767)||_['isNil'](_0x2a4767[_0x2388('0xb')])){return Promise[_0x2388('0xc')](_0x2c3df4);}var _0x21f228=shared[_0x2388('0xf')];var _0x17d6cd=_0x21f228[_0x2a4767['dialTimezone']];var _0x4f985d=_0x21f228[_0x5e93fa[_0x2388('0xb')]];if(_[_0x2388('0xa')](_0x17d6cd)&&_[_0x2388('0xa')](_0x4f985d)){return Promise[_0x2388('0xc')](_0x2c3df4);}var _0x44b61d=_0x17d6cd[_0x2388('0x10')]-_0x4f985d[_0x2388('0x10')];var _0x4211fd=_0x5e93fa[_0x2388('0x7')]?_0x5e93fa[_0x2388('0x7')]:moment();_0x2c3df4=moment(_0x4211fd)['add'](_0x44b61d,_0x2388('0x11'))[_0x2388('0x8')](_0x2388('0x9'));return Promise[_0x2388('0xc')](_0x2c3df4);});}function getNewHopperPayload(_0x35b004){return{'phone':_0x35b004['phone'],'ContactId':_0x35b004['id'],'ListId':_0x35b004[_0x2388('0x12')],'scheduledat':_0x35b004['scheduledat']?_0x35b004[_0x2388('0x7')]:moment()[_0x2388('0x8')](_0x2388('0x9')),'priority':_0x35b004['priority']?_0x35b004[_0x2388('0x13')]:0x2,'callback':_0x35b004[_0x2388('0x14')]?!![]:![],'callbackuniqueid':_0x35b004['callbackUniqueid']?_0x35b004['callbackUniqueid']:undefined,'callbackat':_0x35b004[_0x2388('0x14')]?moment()[_0x2388('0x8')](_0x2388('0x9')):undefined};}function handleAlwaysCheckDuplicate(_0x21c05a,_0x25468f,_0x360e8f,_0x4c0704){var _0x546d7c={'phone':_0x360e8f['phone']};var _0x44c2c9={'calleridnum':_0x360e8f['phone']};if(_0x4c0704){Object[_0x2388('0x15')](_0x546d7c,{'CampaignId':_0x25468f['id']});Object[_0x2388('0x15')](_0x44c2c9,{'CampaignId':_0x25468f['id']});}else{Object[_0x2388('0x15')](_0x546d7c,{'VoiceQueueId':_0x25468f['id']});Object[_0x2388('0x15')](_0x44c2c9,{'VoiceQueueId':_0x25468f['id']});}return _0x21c05a[_0x2388('0x16')][_0x2388('0xd')]({'where':_0x546d7c})[_0x2388('0xe')](function(_0x30b719){if(_0x30b719){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x360e8f[_0x2388('0x17')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x25468f['id']);}return _0x21c05a[_0x2388('0x18')][_0x2388('0xd')]({'where':_0x44c2c9});})[_0x2388('0xe')](function(_0xeebbb0){if(_0xeebbb0){throw new Error(_0x2388('0x19')+_0x360e8f[_0x2388('0x17')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x25468f['id']);}var _0x3bc7f0=getNewHopperPayload(_0x360e8f);if(_0x4c0704){_0x3bc7f0[_0x2388('0x1a')]=_0x25468f['id'];}else{_0x3bc7f0[_0x2388('0x1b')]=_0x25468f['id'];}return _0x21c05a[_0x2388('0x16')][_0x2388('0x1c')](_0x3bc7f0);});}function handleOnlyIfOpenCheckDuplicate(_0xc53b17,_0x4af570,_0x457101,_0x3b9c1a){var _0x5e5677={'phone':_0x457101[_0x2388('0x17')]};if(_0x3b9c1a){Object[_0x2388('0x15')](_0x5e5677,{'CampaignId':_0x4af570['id']});}else{Object[_0x2388('0x15')](_0x5e5677,{'VoiceQueueId':_0x4af570['id']});}return _0xc53b17[_0x2388('0x16')][_0x2388('0xd')]({'where':_0x5e5677})[_0x2388('0xe')](function(_0x33f9fd){if(_0x33f9fd){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x457101[_0x2388('0x17')]+_0x2388('0x1d')+_0x4af570['id']);}var _0x26c16e=getNewHopperPayload(_0x457101);if(_0x3b9c1a){_0x26c16e[_0x2388('0x1a')]=_0x4af570['id'];}else{_0x26c16e['VoiceQueueId']=_0x4af570['id'];}return _0xc53b17['CmHopper'][_0x2388('0x1c')](_0x26c16e);});}function handleNeverCheckDuplicate(_0x3bdd25,_0x1a8b45,_0x2a046b){var _0x57d7ac=getNewHopperPayload(_0x2a046b);_0x57d7ac['VoiceQueueId']=_0x1a8b45['id'];return _0x3bdd25[_0x2388('0x16')]['create'](_0x57d7ac);}function handleCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4){return getTimezoneCallbackAt(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4)[_0x2388('0xe')](function(_0x59133f){_0x4d2fd2[_0x2388('0x7')]=_0x59133f;switch(_0x766ea3['dialCheckDuplicateType']){case _0x2388('0x1e'):return handleAlwaysCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4);case _0x2388('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2,_0x97eea4);default:return handleNeverCheckDuplicate(_0x448500,_0x766ea3,_0x4d2fd2);}});}function createHopperForVoiceQueues(_0x3845f2,_0x2da6c7){return _0x3845f2[_0x2388('0x6')][_0x2388('0x20')]({'where':{'type':_0x2388('0x21')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x3845f2[_0x2388('0x22')],'as':_0x2388('0x23'),'where':{'id':_0x2da6c7[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0x4a17ee){var _0xcd04dd=_0x4a17ee[_0x2388('0x24')](function(_0x3c077b){return handleCheckDuplicate(_0x3845f2,_0x3c077b,_0x2da6c7,![]);});return Promise['all'](_0xcd04dd);});}function createHopperForCampaigns(_0x48596c,_0x4130db){return _0x48596c[_0x2388('0x5')][_0x2388('0x20')]({'attributes':['id',_0x2388('0x25'),_0x2388('0xb')],'include':[{'model':_0x48596c[_0x2388('0x22')],'as':_0x2388('0x23'),'where':{'id':_0x4130db[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0x5c3b24){var _0x23f0e6=_0x5c3b24['map'](function(_0x2f0a5b){return handleCheckDuplicate(_0x48596c,_0x2f0a5b,_0x4130db,!![]);});return Promise['all'](_0x23f0e6);});}function createHopperBlackForVoiceQueues(_0xacce48,_0x1c16c1){return _0xacce48[_0x2388('0x6')][_0x2388('0x20')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0xacce48[_0x2388('0x22')],'as':'BlackLists','where':{'id':_0x1c16c1[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0xf6f397){var _0x167a7f=_0xf6f397[_0x2388('0x24')](function(_0x3ddb5e){return _0xacce48[_0x2388('0x26')][_0x2388('0x1c')]({'phone':_0x1c16c1['phone'],'ContactId':_0x1c16c1['id'],'ListId':_0x1c16c1['ListId'],'VoiceQueueId':_0x3ddb5e['id']});});return Promise[_0x2388('0x27')](_0x167a7f);});}function createHopperBlackForCampaigns(_0x4021f7,_0x377272){return _0x4021f7[_0x2388('0x5')]['findAll']({'attributes':['id'],'include':[{'model':_0x4021f7[_0x2388('0x22')],'as':'BlackLists','where':{'id':_0x377272[_0x2388('0x12')]}}],'raw':!![]})[_0x2388('0xe')](function(_0x120e6e){var _0x595d37=_0x120e6e[_0x2388('0x24')](function(_0x2e1327){return _0x4021f7[_0x2388('0x26')][_0x2388('0x1c')]({'phone':_0x377272['phone'],'ContactId':_0x377272['id'],'ListId':_0x377272[_0x2388('0x12')],'CampaignId':_0x2e1327['id']});});return Promise[_0x2388('0x27')](_0x595d37);});}module[_0x2388('0x28')]=function(_0x890551){return _0x890551[_0x2388('0x29')](_0x2388('0x2a'),attributes,{'tableName':_0x2388('0x2b'),'paranoid':!![],'indexes':[{'name':_0x2388('0x17'),'fields':['phone']},{'name':_0x2388('0x2c'),'fields':['firstName','lastName','phone',_0x2388('0x2d'),_0x2388('0x2e'),_0x2388('0x2f')],'type':_0x2388('0x30')}],'timestamps':!![],'charset':_0x2388('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4e5dc1,_0xe37289,_0x2b1378){var _0x483d03=_0x890551[_0x2388('0x32')];var _0x3f0b9f=_0x4e5dc1['get']({'plain':!![]});if(!_0x3f0b9f[_0x2388('0x12')]){logger[_0x2388('0x33')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x3f0b9f['id']);return _0x2b1378();}if(!_0x3f0b9f[_0x2388('0x17')]){return _0x2b1378();}return createHopperForVoiceQueues(_0x483d03,_0x3f0b9f)['then'](function(){return createHopperBlackForVoiceQueues(_0x483d03,_0x3f0b9f);})[_0x2388('0xe')](function(){return createHopperForCampaigns(_0x483d03,_0x3f0b9f);})[_0x2388('0xe')](function(){return createHopperBlackForCampaigns(_0x483d03,_0x3f0b9f);})[_0x2388('0xe')](function(){return _0x2b1378();})[_0x2388('0x34')](function(_0x2082cb){logger['error'](_0x2388('0x35'),_0x2082cb[_0x2388('0x36')]);_0x2b1378();});},'afterDestroy':function(_0x5c820e,_0x220f04,_0xe2a93){var _0x2e20f9=_0x890551['models'];var _0x590d88=_0x5c820e['get']({'plain':!![]});return _0x2e20f9[_0x2388('0x16')][_0x2388('0x20')]({'raw':!![],'where':{'ListId':_0x590d88[_0x2388('0x12')],'ContactId':_0x590d88['id']}})[_0x2388('0xe')](function(_0x4ca58b){if(!_[_0x2388('0x37')](_0x4ca58b)){var _0x249061=[];for(var _0x44d270=0x0;_0x44d270<_0x4ca58b[_0x2388('0x38')];_0x44d270+=0x1){var _0x3889c9=_0x2e20f9['CmHopper'][_0x2388('0x39')]({'where':{'ListId':_0x4ca58b[_0x44d270][_0x2388('0x12')],'ContactId':_0x4ca58b[_0x44d270][_0x2388('0x3a')],'VoiceQueueId':_0x4ca58b[_0x44d270]['VoiceQueueId'],'CampaignId':_0x4ca58b[_0x44d270][_0x2388('0x1a')]}});_0x249061[_0x2388('0x3b')](_0x3889c9);}return Promise['all'](_0x249061);}})[_0x2388('0xe')](function(_0x4c9bce){logger[_0x2388('0x3c')](_0x2388('0x3d'),util['inspect'](_0x4c9bce,{'showHidden':![],'depth':null}));_0xe2a93();})[_0x2388('0x34')](function(_0x461adb){logger[_0x2388('0x33')](_0x2388('0x3e'),util[_0x2388('0x3f')](_0x461adb,{'showHidden':![],'depth':null}));_0xe2a93(_0x461adb);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 1c7057a..10d94a1 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x448ad2,_0x3ea8fa){var _0x2e94e2=function(_0x593ae0){while(--_0x593ae0){_0x448ad2['push'](_0x448ad2['shift']());}};_0x2e94e2(++_0x3ea8fa);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x8d375a,_0x1ca2cc){var _0x495fc0=function(_0x433d5e){while(--_0x433d5e){_0x8d375a['push'](_0x8d375a['shift']());}};_0x495fc0(++_0x1ca2cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 1fb5919..1f85dee 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf5c=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x1c2421,_0x1c152c){var _0x5867b2=function(_0x16e49c){while(--_0x16e49c){_0x1c2421['push'](_0x1c2421['shift']());}};_0x5867b2(++_0x1c152c);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x13fb84,_0x4839f6){_0x13fb84=_0x13fb84-0x0;var _0x71607a=_0xbf5c[_0x13fb84];return _0x71607a;};'use strict';var Sequelize=require(_0xcbf5('0x0'));module[_0xcbf5('0x1')]={'CmContactId':{'type':Sequelize[_0xcbf5('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xcbf5('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xcbf5('0x3')],'defaultValue':_0xcbf5('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xcbf5('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xc737=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0xd2f8f2,_0x496932){var _0x217eb5=function(_0x56d270){while(--_0x56d270){_0xd2f8f2['push'](_0xd2f8f2['shift']());}};_0x217eb5(++_0x496932);}(_0xc737,0x154));var _0x7c73=function(_0x1e0ea8,_0x793b6b){_0x1e0ea8=_0x1e0ea8-0x0;var _0x34ad3c=_0xc737[_0x1e0ea8];return _0x34ad3c;};'use strict';var Sequelize=require(_0x7c73('0x0'));module[_0x7c73('0x1')]={'CmContactId':{'type':Sequelize[_0x7c73('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7c73('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7c73('0x3')],'defaultValue':_0x7c73('0x4')},'OrderBy':{'type':Sequelize[_0x7c73('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 4c01e01..94b32d9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67df=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','params','keys','intersection','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x67df,0x1d4));var _0xf67d=function(_0x225207,_0x174002){_0x225207=_0x225207-0x0;var _0x5f9aad=_0x67df[_0x225207];return _0x5f9aad;};'use strict';var emlformat=require(_0xf67d('0x0'));var rimraf=require(_0xf67d('0x1'));var zipdir=require(_0xf67d('0x2'));var jsonpatch=require(_0xf67d('0x3'));var rp=require(_0xf67d('0x4'));var moment=require(_0xf67d('0x5'));var BPromise=require(_0xf67d('0x6'));var Mustache=require(_0xf67d('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf67d('0x8'));var csv=require(_0xf67d('0x9'));var ejs=require(_0xf67d('0xa'));var fs=require('fs');var fs_extra=require(_0xf67d('0xb'));var _=require(_0xf67d('0xc'));var squel=require(_0xf67d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf67d('0xe'));var toCsv=require(_0xf67d('0x9'));var querystring=require(_0xf67d('0xf'));var Papa=require(_0xf67d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf67d('0x11'));var logger=require(_0xf67d('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf67d('0x13'));var db=require(_0xf67d('0x14'))['db'];function respondWithStatusCode(_0x27b7bc,_0x515f8d){_0x515f8d=_0x515f8d||0xcc;return function(_0x1d5e8f){if(_0x1d5e8f){return _0x27b7bc[_0xf67d('0x15')](_0x515f8d);}return _0x27b7bc[_0xf67d('0x16')](_0x515f8d)[_0xf67d('0x17')]();};}function respondWithResult(_0x481080,_0x1a11a8){_0x1a11a8=_0x1a11a8||0xc8;return function(_0x147250){if(_0x147250){return _0x481080[_0xf67d('0x16')](_0x1a11a8)[_0xf67d('0x18')](_0x147250);}};}function respondWithFilteredResult(_0x321d64,_0x4722e5){return function(_0x35fb19){if(_0x35fb19){var _0x59420c=typeof _0x4722e5[_0xf67d('0x19')]===_0xf67d('0x1a')&&typeof _0x4722e5[_0xf67d('0x1b')]===_0xf67d('0x1a');var _0x423174=_0x35fb19[_0xf67d('0x1c')];var _0x19621c=_0x59420c?0x0:_0x4722e5['offset'];var _0x2362ef=_0x59420c?_0x35fb19['count']:_0x4722e5[_0xf67d('0x19')]+_0x4722e5[_0xf67d('0x1b')];var _0x4a9ed7;if(_0x2362ef>=_0x423174){_0x2362ef=_0x423174;_0x4a9ed7=0xc8;}else{_0x4a9ed7=0xce;}_0x321d64[_0xf67d('0x16')](_0x4a9ed7);return _0x321d64['set']('Content-Range',_0x19621c+'-'+_0x2362ef+'/'+_0x423174)['json'](_0x35fb19);}return null;};}function patchUpdates(_0x7b3e60){return function(_0x4c8298){try{jsonpatch[_0xf67d('0x1d')](_0x4c8298,_0x7b3e60,!![]);}catch(_0x2b3503){return BPromise[_0xf67d('0x1e')](_0x2b3503);}return _0x4c8298[_0xf67d('0x1f')]();};}function saveUpdates(_0x5c5441,_0x58a512){return function(_0x26dc02){if(_0x26dc02){return _0x26dc02[_0xf67d('0x20')](_0x5c5441)[_0xf67d('0x21')](function(_0x598424){return _0x598424;});}return null;};}function removeEntity(_0x252d9c,_0x53b0ac){return function(_0x5a2e28){if(_0x5a2e28){return _0x5a2e28[_0xf67d('0x22')]()[_0xf67d('0x21')](function(){var _0x4c7d52=_0x5a2e28['get']({'plain':!![]});var _0x44e1fe=_0xf67d('0x23');return db[_0xf67d('0x24')]['destroy']({'where':{'type':_0x44e1fe,'resourceId':_0x4c7d52['id']}})['then'](function(){return _0x5a2e28;});})[_0xf67d('0x21')](function(){_0x252d9c[_0xf67d('0x16')](0xcc)[_0xf67d('0x17')]();});}};}function handleEntityNotFound(_0x7a3bdb,_0x4b9542){return function(_0x2f52c2){if(!_0x2f52c2){_0x7a3bdb[_0xf67d('0x15')](0x194);}return _0x2f52c2;};}function handleError(_0x39cb8c,_0x47014b){_0x47014b=_0x47014b||0x1f4;return function(_0x30093c){logger[_0xf67d('0x25')](_0x30093c[_0xf67d('0x26')]);if(_0x30093c[_0xf67d('0x27')]){delete _0x30093c[_0xf67d('0x27')];}_0x39cb8c[_0xf67d('0x16')](_0x47014b)[_0xf67d('0x28')](_0x30093c);};}exports[_0xf67d('0x29')]=function(_0x44d385,_0x52afde){var _0x5286a7={},_0x30af65={},_0x275250={'count':0x0,'rows':[]};var _0x307903=_['map'](db[_0xf67d('0x2a')][_0xf67d('0x2b')],function(_0x15e2da){return{'name':_0x15e2da[_0xf67d('0x2c')],'type':_0x15e2da[_0xf67d('0x2d')]['key']};});_0x30af65[_0xf67d('0x2e')]=_[_0xf67d('0x2f')](_0x307903,'name');_0x30af65[_0xf67d('0x30')]=_['keys'](_0x44d385[_0xf67d('0x30')]);_0x30af65[_0xf67d('0x31')]=_['intersection'](_0x30af65['model'],_0x30af65['query']);_0x5286a7[_0xf67d('0x32')]=_['intersection'](_0x30af65[_0xf67d('0x2e')],qs['fields'](_0x44d385[_0xf67d('0x30')]['fields']));_0x5286a7[_0xf67d('0x32')]=_0x5286a7[_0xf67d('0x32')][_0xf67d('0x33')]?_0x5286a7[_0xf67d('0x32')]:_0x30af65[_0xf67d('0x2e')];if(!_0x44d385['query'][_0xf67d('0x34')](_0xf67d('0x35'))){_0x5286a7[_0xf67d('0x1b')]=qs[_0xf67d('0x1b')](_0x44d385[_0xf67d('0x30')][_0xf67d('0x1b')]);_0x5286a7[_0xf67d('0x19')]=qs[_0xf67d('0x19')](_0x44d385['query'][_0xf67d('0x19')]);}_0x5286a7[_0xf67d('0x36')]=qs[_0xf67d('0x37')](_0x44d385['query'][_0xf67d('0x37')]);_0x5286a7[_0xf67d('0x38')]=qs[_0xf67d('0x31')](_[_0xf67d('0x39')](_0x44d385[_0xf67d('0x30')],_0x30af65['filters']),_0x307903);if(_0x44d385['query']['filter']){_0x5286a7[_0xf67d('0x38')]=_[_0xf67d('0x3a')](_0x5286a7[_0xf67d('0x38')],{'$or':_[_0xf67d('0x2f')](_0x307903,function(_0x199710){if(_0x199710['type']!=='VIRTUAL'){var _0x1fa406={};_0x1fa406[_0x199710['name']]={'$like':'%'+_0x44d385['query']['filter']+'%'};return _0x1fa406;}})});}_0x5286a7=_[_0xf67d('0x3a')]({},_0x5286a7,_0x44d385['options']);var _0x266bcc={'where':_0x5286a7[_0xf67d('0x38')]};return db[_0xf67d('0x2a')][_0xf67d('0x1c')](_0x266bcc)[_0xf67d('0x21')](function(_0x3f0755){_0x275250[_0xf67d('0x1c')]=_0x3f0755;if(_0x44d385[_0xf67d('0x30')][_0xf67d('0x3b')]){_0x5286a7[_0xf67d('0x3c')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xf67d('0x3d')](_0x5286a7);})[_0xf67d('0x21')](function(_0x5e6438){_0x275250[_0xf67d('0x3e')]=_0x5e6438;return _0x275250;})[_0xf67d('0x21')](respondWithFilteredResult(_0x52afde,_0x5286a7))[_0xf67d('0x3f')](handleError(_0x52afde,null));};exports['show']=function(_0x1d868f,_0x4c7d7e){var _0x4a59fa={'raw':!![],'where':{'id':_0x1d868f[_0xf67d('0x40')]['id']}},_0x51150e={};_0x51150e[_0xf67d('0x2e')]=_[_0xf67d('0x41')](db[_0xf67d('0x2a')][_0xf67d('0x2b')]);_0x51150e[_0xf67d('0x30')]=_['keys'](_0x1d868f['query']);_0x51150e[_0xf67d('0x31')]=_[_0xf67d('0x42')](_0x51150e[_0xf67d('0x2e')],_0x51150e[_0xf67d('0x30')]);_0x4a59fa[_0xf67d('0x32')]=_['intersection'](_0x51150e[_0xf67d('0x2e')],qs[_0xf67d('0x43')](_0x1d868f[_0xf67d('0x30')]['fields']));_0x4a59fa['attributes']=_0x4a59fa[_0xf67d('0x32')][_0xf67d('0x33')]?_0x4a59fa[_0xf67d('0x32')]:_0x51150e['model'];if(_0x1d868f['query'][_0xf67d('0x3b')]){_0x4a59fa[_0xf67d('0x3c')]=[{'all':!![]}];}_0x4a59fa=_['merge']({},_0x4a59fa,_0x1d868f['options']);return db['CmContactHasItem'][_0xf67d('0x44')](_0x4a59fa)[_0xf67d('0x21')](handleEntityNotFound(_0x4c7d7e,null))[_0xf67d('0x21')](respondWithResult(_0x4c7d7e,null))[_0xf67d('0x3f')](handleError(_0x4c7d7e,null));};exports[_0xf67d('0x45')]=function(_0xf0b8e,_0x37d0f1){return db['CmContactHasItem']['create'](_0xf0b8e[_0xf67d('0x46')],{})['then'](function(_0x805545){var _0x60f37c=_0xf0b8e[_0xf67d('0x47')]['get']({'plain':!![]});if(!_0x60f37c)throw new Error(_0xf67d('0x48'));if(_0x60f37c[_0xf67d('0x49')]===_0xf67d('0x47')){var _0x49e7d1=_0x805545[_0xf67d('0x4a')]({'plain':!![]});var _0x2f124f=_0xf67d('0x23');return db[_0xf67d('0x4b')]['find']({'where':{'name':_0x2f124f,'userProfileId':_0x60f37c[_0xf67d('0x4c')]},'raw':!![]})[_0xf67d('0x21')](function(_0x18064d){if(_0x18064d&&_0x18064d[_0xf67d('0x4d')]===0x0){return db[_0xf67d('0x24')][_0xf67d('0x45')]({'name':_0x49e7d1[_0xf67d('0x27')],'resourceId':_0x49e7d1['id'],'type':_0x18064d[_0xf67d('0x27')],'sectionId':_0x18064d['id']},{})[_0xf67d('0x21')](function(){return _0x805545;});}else{return _0x805545;}})['catch'](function(_0x31a83d){logger['error'](_0xf67d('0x4e'),_0x31a83d);throw _0x31a83d;});}return _0x805545;})[_0xf67d('0x21')](respondWithResult(_0x37d0f1,0xc9))[_0xf67d('0x3f')](handleError(_0x37d0f1,null));};exports[_0xf67d('0x20')]=function(_0x3e52d2,_0x2e8057){if(_0x3e52d2['body']['id']){delete _0x3e52d2[_0xf67d('0x46')]['id'];}return db[_0xf67d('0x2a')][_0xf67d('0x44')]({'where':{'id':_0x3e52d2[_0xf67d('0x40')]['id']}})[_0xf67d('0x21')](handleEntityNotFound(_0x2e8057,null))[_0xf67d('0x21')](saveUpdates(_0x3e52d2[_0xf67d('0x46')],null))[_0xf67d('0x21')](respondWithResult(_0x2e8057,null))[_0xf67d('0x3f')](handleError(_0x2e8057,null));};exports['destroy']=function(_0x4af150,_0x49f67c){return db['CmContactHasItem'][_0xf67d('0x44')]({'where':{'id':_0x4af150['params']['id']}})['then'](handleEntityNotFound(_0x49f67c,null))[_0xf67d('0x21')](removeEntity(_0x49f67c,null))[_0xf67d('0x3f')](handleError(_0x49f67c,null));}; \ No newline at end of file +var _0x4804=['error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','CmContactHasItem','findAll','rows','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation'];(function(_0x3ee99e,_0x4affec){var _0x1b56e1=function(_0x3857a2){while(--_0x3857a2){_0x3ee99e['push'](_0x3ee99e['shift']());}};_0x1b56e1(++_0x4affec);}(_0x4804,0xa7));var _0x4480=function(_0x1052c7,_0x2c115d){_0x1052c7=_0x1052c7-0x0;var _0xedd819=_0x4804[_0x1052c7];return _0xedd819;};'use strict';var emlformat=require(_0x4480('0x0'));var rimraf=require(_0x4480('0x1'));var zipdir=require(_0x4480('0x2'));var jsonpatch=require(_0x4480('0x3'));var rp=require(_0x4480('0x4'));var moment=require('moment');var BPromise=require(_0x4480('0x5'));var Mustache=require(_0x4480('0x6'));var util=require(_0x4480('0x7'));var path=require(_0x4480('0x8'));var sox=require('sox');var csv=require(_0x4480('0x9'));var ejs=require(_0x4480('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4480('0xb'));var crypto=require(_0x4480('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4480('0xd'));var toCsv=require(_0x4480('0x9'));var querystring=require(_0x4480('0xe'));var Papa=require('papaparse');var Redis=require(_0x4480('0xf'));var authService=require(_0x4480('0x10'));var qs=require(_0x4480('0x11'));var as=require(_0x4480('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4480('0x13'))(_0x4480('0x14'));var utils=require('../../config/utils');var config=require(_0x4480('0x15'));var licenseUtil=require(_0x4480('0x16'));var db=require(_0x4480('0x17'))['db'];function respondWithStatusCode(_0x5e9840,_0x39e9b0){_0x39e9b0=_0x39e9b0||0xcc;return function(_0x31b2d3){if(_0x31b2d3){return _0x5e9840[_0x4480('0x18')](_0x39e9b0);}return _0x5e9840[_0x4480('0x19')](_0x39e9b0)[_0x4480('0x1a')]();};}function respondWithResult(_0xc7ecc1,_0x2e056e){_0x2e056e=_0x2e056e||0xc8;return function(_0x14e5db){if(_0x14e5db){return _0xc7ecc1['status'](_0x2e056e)['json'](_0x14e5db);}};}function respondWithFilteredResult(_0x4bc638,_0x3836a6){return function(_0x475423){if(_0x475423){var _0x34385a=typeof _0x3836a6['offset']===_0x4480('0x1b')&&typeof _0x3836a6[_0x4480('0x1c')]===_0x4480('0x1b');var _0xa75f53=_0x475423[_0x4480('0x1d')];var _0x4feac0=_0x34385a?0x0:_0x3836a6[_0x4480('0x1e')];var _0x5d5c6f=_0x34385a?_0x475423[_0x4480('0x1d')]:_0x3836a6[_0x4480('0x1e')]+_0x3836a6[_0x4480('0x1c')];var _0x45cbe1;if(_0x5d5c6f>=_0xa75f53){_0x5d5c6f=_0xa75f53;_0x45cbe1=0xc8;}else{_0x45cbe1=0xce;}_0x4bc638['status'](_0x45cbe1);return _0x4bc638[_0x4480('0x1f')](_0x4480('0x20'),_0x4feac0+'-'+_0x5d5c6f+'/'+_0xa75f53)[_0x4480('0x21')](_0x475423);}return null;};}function patchUpdates(_0x4d8183){return function(_0x770a63){try{jsonpatch[_0x4480('0x22')](_0x770a63,_0x4d8183,!![]);}catch(_0x3cf069){return BPromise[_0x4480('0x23')](_0x3cf069);}return _0x770a63[_0x4480('0x24')]();};}function saveUpdates(_0x26054f,_0x2fc74d){return function(_0x3f4d26){if(_0x3f4d26){return _0x3f4d26[_0x4480('0x25')](_0x26054f)[_0x4480('0x26')](function(_0xa38f27){return _0xa38f27;});}return null;};}function removeEntity(_0x1e97d6,_0x54b27c){return function(_0x43e17a){if(_0x43e17a){return _0x43e17a['destroy']()[_0x4480('0x26')](function(){var _0x4244de=_0x43e17a[_0x4480('0x27')]({'plain':!![]});var _0x38f9bb=_0x4480('0x28');return db[_0x4480('0x29')][_0x4480('0x2a')]({'where':{'type':_0x38f9bb,'resourceId':_0x4244de['id']}})[_0x4480('0x26')](function(){return _0x43e17a;});})[_0x4480('0x26')](function(){_0x1e97d6[_0x4480('0x19')](0xcc)[_0x4480('0x1a')]();});}};}function handleEntityNotFound(_0x37416a,_0x215ca7){return function(_0x3497b0){if(!_0x3497b0){_0x37416a[_0x4480('0x18')](0x194);}return _0x3497b0;};}function handleError(_0x35f1f8,_0x279922){_0x279922=_0x279922||0x1f4;return function(_0x265b4f){logger['error'](_0x265b4f[_0x4480('0x2b')]);if(_0x265b4f[_0x4480('0x2c')]){delete _0x265b4f[_0x4480('0x2c')];}_0x35f1f8[_0x4480('0x19')](_0x279922)[_0x4480('0x2d')](_0x265b4f);};}exports[_0x4480('0x2e')]=function(_0x455113,_0x9f407b){var _0x53bb60={},_0x761e6f={},_0x537d52={'count':0x0,'rows':[]};var _0x46b13a=_['map'](db['CmContactHasItem'][_0x4480('0x2f')],function(_0x2bad1e){return{'name':_0x2bad1e[_0x4480('0x30')],'type':_0x2bad1e[_0x4480('0x31')]['key']};});_0x761e6f[_0x4480('0x32')]=_[_0x4480('0x33')](_0x46b13a,_0x4480('0x2c'));_0x761e6f['query']=_['keys'](_0x455113['query']);_0x761e6f['filters']=_[_0x4480('0x34')](_0x761e6f[_0x4480('0x32')],_0x761e6f[_0x4480('0x35')]);_0x53bb60['attributes']=_[_0x4480('0x34')](_0x761e6f[_0x4480('0x32')],qs[_0x4480('0x36')](_0x455113[_0x4480('0x35')][_0x4480('0x36')]));_0x53bb60[_0x4480('0x37')]=_0x53bb60[_0x4480('0x37')]['length']?_0x53bb60[_0x4480('0x37')]:_0x761e6f['model'];if(!_0x455113[_0x4480('0x35')][_0x4480('0x38')](_0x4480('0x39'))){_0x53bb60['limit']=qs[_0x4480('0x1c')](_0x455113[_0x4480('0x35')]['limit']);_0x53bb60[_0x4480('0x1e')]=qs[_0x4480('0x1e')](_0x455113[_0x4480('0x35')][_0x4480('0x1e')]);}_0x53bb60[_0x4480('0x3a')]=qs[_0x4480('0x3b')](_0x455113[_0x4480('0x35')][_0x4480('0x3b')]);_0x53bb60[_0x4480('0x3c')]=qs[_0x4480('0x3d')](_[_0x4480('0x3e')](_0x455113[_0x4480('0x35')],_0x761e6f[_0x4480('0x3d')]),_0x46b13a);if(_0x455113['query'][_0x4480('0x3f')]){_0x53bb60[_0x4480('0x3c')]=_[_0x4480('0x40')](_0x53bb60['where'],{'$or':_[_0x4480('0x33')](_0x46b13a,function(_0x1d8d8b){if(_0x1d8d8b[_0x4480('0x31')]!==_0x4480('0x41')){var _0xac751e={};_0xac751e[_0x1d8d8b[_0x4480('0x2c')]]={'$like':'%'+_0x455113[_0x4480('0x35')]['filter']+'%'};return _0xac751e;}})});}_0x53bb60=_[_0x4480('0x40')]({},_0x53bb60,_0x455113['options']);var _0x24e992={'where':_0x53bb60[_0x4480('0x3c')]};return db[_0x4480('0x42')]['count'](_0x24e992)[_0x4480('0x26')](function(_0x18a14a){_0x537d52[_0x4480('0x1d')]=_0x18a14a;if(_0x455113[_0x4480('0x35')]['includeAll']){_0x53bb60['include']=[{'all':!![]}];}return db[_0x4480('0x42')][_0x4480('0x43')](_0x53bb60);})[_0x4480('0x26')](function(_0x2d34c2){_0x537d52[_0x4480('0x44')]=_0x2d34c2;return _0x537d52;})[_0x4480('0x26')](respondWithFilteredResult(_0x9f407b,_0x53bb60))['catch'](handleError(_0x9f407b,null));};exports[_0x4480('0x45')]=function(_0x3a07b2,_0x956a42){var _0x5e2cc3={'raw':!![],'where':{'id':_0x3a07b2[_0x4480('0x46')]['id']}},_0x18a3e8={};_0x18a3e8[_0x4480('0x32')]=_[_0x4480('0x47')](db[_0x4480('0x42')]['rawAttributes']);_0x18a3e8[_0x4480('0x35')]=_['keys'](_0x3a07b2[_0x4480('0x35')]);_0x18a3e8[_0x4480('0x3d')]=_['intersection'](_0x18a3e8[_0x4480('0x32')],_0x18a3e8[_0x4480('0x35')]);_0x5e2cc3['attributes']=_['intersection'](_0x18a3e8[_0x4480('0x32')],qs['fields'](_0x3a07b2[_0x4480('0x35')][_0x4480('0x36')]));_0x5e2cc3[_0x4480('0x37')]=_0x5e2cc3['attributes'][_0x4480('0x48')]?_0x5e2cc3[_0x4480('0x37')]:_0x18a3e8['model'];if(_0x3a07b2[_0x4480('0x35')]['includeAll']){_0x5e2cc3['include']=[{'all':!![]}];}_0x5e2cc3=_['merge']({},_0x5e2cc3,_0x3a07b2[_0x4480('0x49')]);return db[_0x4480('0x42')][_0x4480('0x4a')](_0x5e2cc3)[_0x4480('0x26')](handleEntityNotFound(_0x956a42,null))['then'](respondWithResult(_0x956a42,null))[_0x4480('0x4b')](handleError(_0x956a42,null));};exports['create']=function(_0x1c853d,_0x4acede){return db[_0x4480('0x42')][_0x4480('0x4c')](_0x1c853d[_0x4480('0x4d')],{})[_0x4480('0x26')](function(_0x4d4be6){var _0x5b4e7f=_0x1c853d[_0x4480('0x4e')][_0x4480('0x27')]({'plain':!![]});if(!_0x5b4e7f)throw new Error(_0x4480('0x4f'));if(_0x5b4e7f['role']===_0x4480('0x4e')){var _0xe75c41=_0x4d4be6['get']({'plain':!![]});var _0x28cd32=_0x4480('0x28');return db['UserProfileSection'][_0x4480('0x4a')]({'where':{'name':_0x28cd32,'userProfileId':_0x5b4e7f[_0x4480('0x50')]},'raw':!![]})[_0x4480('0x26')](function(_0x5fd6b8){if(_0x5fd6b8&&_0x5fd6b8[_0x4480('0x51')]===0x0){return db[_0x4480('0x29')][_0x4480('0x4c')]({'name':_0xe75c41[_0x4480('0x2c')],'resourceId':_0xe75c41['id'],'type':_0x5fd6b8[_0x4480('0x2c')],'sectionId':_0x5fd6b8['id']},{})['then'](function(){return _0x4d4be6;});}else{return _0x4d4be6;}})[_0x4480('0x4b')](function(_0x563e56){logger[_0x4480('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x563e56);throw _0x563e56;});}return _0x4d4be6;})[_0x4480('0x26')](respondWithResult(_0x4acede,0xc9))[_0x4480('0x4b')](handleError(_0x4acede,null));};exports[_0x4480('0x25')]=function(_0x534a80,_0x5a0c55){if(_0x534a80['body']['id']){delete _0x534a80[_0x4480('0x4d')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x534a80[_0x4480('0x46')]['id']}})[_0x4480('0x26')](handleEntityNotFound(_0x5a0c55,null))[_0x4480('0x26')](saveUpdates(_0x534a80[_0x4480('0x4d')],null))[_0x4480('0x26')](respondWithResult(_0x5a0c55,null))[_0x4480('0x4b')](handleError(_0x5a0c55,null));};exports['destroy']=function(_0xfcb62d,_0x22d912){return db[_0x4480('0x42')][_0x4480('0x4a')]({'where':{'id':_0xfcb62d['params']['id']}})[_0x4480('0x26')](handleEntityNotFound(_0x22d912,null))[_0x4480('0x26')](removeEntity(_0x22d912,null))['catch'](handleError(_0x22d912,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 89c034e..2378fec 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x688f=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes','exports','cm_contact_has_items'];(function(_0x3753a4,_0x12108f){var _0x144233=function(_0x239733){while(--_0x239733){_0x3753a4['push'](_0x3753a4['shift']());}};_0x144233(++_0x12108f);}(_0x688f,0x78));var _0xf688=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x688f[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0xf688('0x0'));var util=require('util');var logger=require(_0xf688('0x1'))('api');var moment=require(_0xf688('0x2'));var BPromise=require(_0xf688('0x3'));var rp=require(_0xf688('0x4'));var fs=require('fs');var path=require(_0xf688('0x5'));var rimraf=require(_0xf688('0x6'));var config=require('../../config/environment');var attributes=require(_0xf688('0x7'));module[_0xf688('0x8')]=function(_0x1c7621,_0x341946){return _0x1c7621['define']('CmContactHasItem',attributes,{'tableName':_0xf688('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6bb=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x1ea04a,_0x47533d){var _0xcb93c0=function(_0x1fd97e){while(--_0x1fd97e){_0x1ea04a['push'](_0x1ea04a['shift']());}};_0xcb93c0(++_0x47533d);}(_0xc6bb,0xf4));var _0xbc6b=function(_0x3ab1a7,_0x5e6c94){_0x3ab1a7=_0x3ab1a7-0x0;var _0x732e65=_0xc6bb[_0x3ab1a7];return _0x732e65;};'use strict';var _=require(_0xbc6b('0x0'));var util=require(_0xbc6b('0x1'));var logger=require(_0xbc6b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbc6b('0x3'));var rp=require(_0xbc6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc6b('0x5'));var config=require(_0xbc6b('0x6'));var attributes=require(_0xbc6b('0x7'));module[_0xbc6b('0x8')]=function(_0x4a23d0,_0x5f0c56){return _0x4a23d0[_0xbc6b('0x9')](_0xbc6b('0xa'),attributes,{'tableName':_0xbc6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9d28fd0..b8c27f1 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb908=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x4321d3,_0x29a3e1){var _0x4061ec=function(_0x492ead){while(--_0x492ead){_0x4321d3['push'](_0x4321d3['shift']());}};_0x4061ec(++_0x29a3e1);}(_0xb908,0x12c));var _0x8b90=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xb908[_0x5280f4];return _0xba93e7;};'use strict';var _=require('lodash');var util=require(_0x8b90('0x0'));var moment=require(_0x8b90('0x1'));var BPromise=require(_0x8b90('0x2'));var rs=require(_0x8b90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b90('0x4'))['db'];var utils=require(_0x8b90('0x5'));var logger=require(_0x8b90('0x6'))(_0x8b90('0x7'));var config=require('../../config/environment');var jayson=require(_0x8b90('0x8'));var client=jayson[_0x8b90('0x9')][_0x8b90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ea36d,_0x532456,_0x59e7f3){return new BPromise(function(_0xe7106c,_0x5ab8cb){return client[_0x8b90('0xb')](_0x2ea36d,_0x59e7f3)['then'](function(_0x5159d9){logger[_0x8b90('0xc')](_0x8b90('0xd'),_0x532456,_0x8b90('0xe'));logger[_0x8b90('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x532456,_0x8b90('0xe'),JSON[_0x8b90('0x10')](_0x5159d9));if(_0x5159d9[_0x8b90('0x11')]){if(_0x5159d9[_0x8b90('0x11')]['code']===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x532456,_0x5159d9[_0x8b90('0x11')][_0x8b90('0x12')]);return _0x5ab8cb(_0x5159d9[_0x8b90('0x11')][_0x8b90('0x12')]);}logger[_0x8b90('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x532456,_0x5159d9['error']['message']);return _0xe7106c(_0x5159d9['error']['message']);}else{logger['info'](_0x8b90('0xd'),_0x532456,'request\x20sent');_0xe7106c(_0x5159d9['result'][_0x8b90('0x12')]);}})[_0x8b90('0x13')](function(_0x62379c){logger[_0x8b90('0x11')](_0x8b90('0xd'),_0x532456,_0x62379c);_0x5ab8cb(_0x62379c);});});} \ No newline at end of file +var _0x0a4e=['debug','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a4e,0xfd));var _0xe0a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a4e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe0a4('0x0'));var BPromise=require(_0xe0a4('0x1'));var rs=require(_0xe0a4('0x2'));var fs=require('fs');var Redis=require(_0xe0a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0a4('0x4'));var logger=require(_0xe0a4('0x5'))(_0xe0a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xe0a4('0x7'));var client=jayson[_0xe0a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbbee2e,_0xecb378,_0x1bdc5d){return new BPromise(function(_0x313ddb,_0x5b3db2){return client[_0xe0a4('0x9')](_0xbbee2e,_0x1bdc5d)[_0xe0a4('0xa')](function(_0x38b773){logger['info'](_0xe0a4('0xb'),_0xecb378,_0xe0a4('0xc'));logger[_0xe0a4('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0xecb378,_0xe0a4('0xc'),JSON[_0xe0a4('0xe')](_0x38b773));if(_0x38b773[_0xe0a4('0xf')]){if(_0x38b773['error'][_0xe0a4('0x10')]===0x1f4){logger[_0xe0a4('0xf')](_0xe0a4('0xb'),_0xecb378,_0x38b773[_0xe0a4('0xf')]['message']);return _0x5b3db2(_0x38b773['error'][_0xe0a4('0x11')]);}logger[_0xe0a4('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0xecb378,_0x38b773['error']['message']);return _0x313ddb(_0x38b773[_0xe0a4('0xf')][_0xe0a4('0x11')]);}else{logger['info'](_0xe0a4('0xb'),_0xecb378,'request\x20sent');_0x313ddb(_0x38b773[_0xe0a4('0x12')][_0xe0a4('0x11')]);}})['catch'](function(_0x22fbd8){logger[_0xe0a4('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0xecb378,_0x22fbd8);_0x5b3db2(_0x22fbd8);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4b1be9f..df5f6a5 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72a0=['delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x24ff84,_0x5ca84f){var _0x312638=function(_0x10fdc1){while(--_0x10fdc1){_0x24ff84['push'](_0x24ff84['shift']());}};_0x312638(++_0x5ca84f);}(_0x72a0,0x1ab));var _0x072a=function(_0x581ef8,_0x1afa03){_0x581ef8=_0x581ef8-0x0;var _0x31d532=_0x72a0[_0x581ef8];return _0x31d532;};'use strict';var multer=require('multer');var util=require(_0x072a('0x0'));var path=require(_0x072a('0x1'));var timeout=require(_0x072a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x072a('0x3'));var auth=require(_0x072a('0x4'));var interaction=require(_0x072a('0x5'));var config=require(_0x072a('0x6'));var controller=require(_0x072a('0x7'));router[_0x072a('0x8')]('/',auth[_0x072a('0x9')](),controller[_0x072a('0xa')]);router[_0x072a('0x8')](_0x072a('0xb'),auth['isAuthenticated'](),controller[_0x072a('0xc')]);router[_0x072a('0xd')]('/',auth[_0x072a('0x9')](),controller[_0x072a('0xe')]);router['put'](_0x072a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x072a('0xf')](_0x072a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x072a('0x10')]=router; \ No newline at end of file +var _0x655c=['../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x655c,0x15e));var _0xc655=function(_0x301d19,_0x2cf9e0){_0x301d19=_0x301d19-0x0;var _0x3659bc=_0x655c[_0x301d19];return _0x3659bc;};'use strict';var multer=require(_0xc655('0x0'));var util=require(_0xc655('0x1'));var path=require('path');var timeout=require(_0xc655('0x2'));var express=require(_0xc655('0x3'));var router=express[_0xc655('0x4')]();var fs_extra=require(_0xc655('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc655('0x6'));var config=require(_0xc655('0x7'));var controller=require(_0xc655('0x8'));router[_0xc655('0x9')]('/',auth[_0xc655('0xa')](),controller[_0xc655('0xb')]);router[_0xc655('0x9')](_0xc655('0xc'),auth[_0xc655('0xa')](),controller[_0xc655('0xd')]);router[_0xc655('0xe')]('/',auth[_0xc655('0xa')](),controller[_0xc655('0xf')]);router[_0xc655('0x10')]('/:id',auth[_0xc655('0xa')](),controller[_0xc655('0x11')]);router[_0xc655('0x12')](_0xc655('0xc'),auth[_0xc655('0xa')](),controller[_0xc655('0x13')]);module[_0xc655('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 367bc7c..f63273e 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 _0x04f3=['getDataValue','alias','STRING','TEXT','long','type','select','values','isArray','setDataValue','stringify','BOOLEAN','sequelize','lodash'];(function(_0x336a6e,_0x4c454f){var _0x4c0b21=function(_0x3590a0){while(--_0x3590a0){_0x336a6e['push'](_0x336a6e['shift']());}};_0x4c0b21(++_0x4c454f);}(_0x04f3,0x1e8));var _0x304f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x04f3[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x304f('0x0'));var _=require(_0x304f('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1c93d6){return this[_0x304f('0x2')](_0x304f('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x337791){this['setDataValue']('alias',_0x337791?_0x337791:this[_0x304f('0x2')]('name'));}},'type':{'type':Sequelize[_0x304f('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x304f('0x5')](_0x304f('0x6')),'get':function(){if(this['getDataValue'](_0x304f('0x7'))===_0x304f('0x8')){return JSON['parse'](this[_0x304f('0x2')](_0x304f('0x9')));}else{return this[_0x304f('0x2')](_0x304f('0x9'));}},'set':function(_0x3b157c){if(Array[_0x304f('0xa')](_0x3b157c)){this[_0x304f('0xb')](_0x304f('0x9'),JSON[_0x304f('0xc')](_0x3b157c));}else{this[_0x304f('0xb')]('values',_0x3b157c);}}},'required':{'type':Sequelize[_0x304f('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x304f('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0xc797=['setDataValue','values','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','name','TEXT','type','select','parse','isArray'];(function(_0x28a35e,_0x1b865c){var _0x7b5084=function(_0x4ef31c){while(--_0x4ef31c){_0x28a35e['push'](_0x28a35e['shift']());}};_0x7b5084(++_0x1b865c);}(_0xc797,0x148));var _0x7c79=function(_0x1be1a6,_0x4d898b){_0x1be1a6=_0x1be1a6-0x0;var _0x133af4=_0xc797[_0x1be1a6];return _0x133af4;};'use strict';var Sequelize=require(_0x7c79('0x0'));var _=require(_0x7c79('0x1'));module[_0x7c79('0x2')]={'name':{'type':Sequelize[_0x7c79('0x3')],'get':function(_0x4f85be){return this[_0x7c79('0x4')]('alias');}},'alias':{'type':Sequelize[_0x7c79('0x5')],'allowNull':![],'set':function(_0x3bec24){this['setDataValue']('alias',_0x3bec24?_0x3bec24:this[_0x7c79('0x4')](_0x7c79('0x6')));}},'type':{'type':Sequelize[_0x7c79('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x7c79('0x7')]('long'),'get':function(){if(this[_0x7c79('0x4')](_0x7c79('0x8'))===_0x7c79('0x9')){return JSON[_0x7c79('0xa')](this['getDataValue']('values'));}else{return this['getDataValue']('values');}},'set':function(_0x4730c9){if(Array[_0x7c79('0xb')](_0x4730c9)){this[_0x7c79('0xc')](_0x7c79('0xd'),JSON[_0x7c79('0xe')](_0x4730c9));}else{this[_0x7c79('0xc')](_0x7c79('0xd'),_0x4730c9);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7c79('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7c79('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a03c540..be81997 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 _0xff4c=['status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmCustomField','findAll','catch','show','find','update','params','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x188150,_0x4cb031){var _0x185ada=function(_0x1ce941){while(--_0x1ce941){_0x188150['push'](_0x188150['shift']());}};_0x185ada(++_0x4cb031);}(_0xff4c,0x1db));var _0xcff4=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xff4c[_0x16337a];return _0x422365;};'use strict';var emlformat=require(_0xcff4('0x0'));var rimraf=require(_0xcff4('0x1'));var zipdir=require(_0xcff4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcff4('0x3'));var moment=require('moment');var BPromise=require(_0xcff4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcff4('0x5'));var csv=require(_0xcff4('0x6'));var ejs=require(_0xcff4('0x7'));var fs=require('fs');var fs_extra=require(_0xcff4('0x8'));var _=require(_0xcff4('0x9'));var squel=require(_0xcff4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcff4('0x6'));var querystring=require('querystring');var Papa=require(_0xcff4('0xb'));var Redis=require(_0xcff4('0xc'));var authService=require(_0xcff4('0xd'));var qs=require(_0xcff4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcff4('0xf'));var logger=require(_0xcff4('0x10'))(_0xcff4('0x11'));var utils=require(_0xcff4('0x12'));var config=require(_0xcff4('0x13'));var licenseUtil=require(_0xcff4('0x14'));var db=require(_0xcff4('0x15'))['db'];function respondWithStatusCode(_0x8b51e1,_0x1fe4df){_0x1fe4df=_0x1fe4df||0xcc;return function(_0x3ff076){if(_0x3ff076){return _0x8b51e1[_0xcff4('0x16')](_0x1fe4df);}return _0x8b51e1[_0xcff4('0x17')](_0x1fe4df)[_0xcff4('0x18')]();};}function respondWithResult(_0x10c511,_0x467288){_0x467288=_0x467288||0xc8;return function(_0x34f5a0){if(_0x34f5a0){return _0x10c511[_0xcff4('0x17')](_0x467288)[_0xcff4('0x19')](_0x34f5a0);}};}function respondWithFilteredResult(_0xd2cbf2,_0x3da1b0){return function(_0x58d53c){if(_0x58d53c){var _0x5326cc=typeof _0x3da1b0['offset']===_0xcff4('0x1a')&&typeof _0x3da1b0[_0xcff4('0x1b')]==='undefined';var _0x109257=_0x58d53c[_0xcff4('0x1c')];var _0x17c188=_0x5326cc?0x0:_0x3da1b0[_0xcff4('0x1d')];var _0x344990=_0x5326cc?_0x58d53c['count']:_0x3da1b0['offset']+_0x3da1b0[_0xcff4('0x1b')];var _0x5e7b41;if(_0x344990>=_0x109257){_0x344990=_0x109257;_0x5e7b41=0xc8;}else{_0x5e7b41=0xce;}_0xd2cbf2['status'](_0x5e7b41);return _0xd2cbf2[_0xcff4('0x1e')](_0xcff4('0x1f'),_0x17c188+'-'+_0x344990+'/'+_0x109257)['json'](_0x58d53c);}return null;};}function patchUpdates(_0x2ec37d){return function(_0x23d41a){try{jsonpatch['apply'](_0x23d41a,_0x2ec37d,!![]);}catch(_0x47235a){return BPromise[_0xcff4('0x20')](_0x47235a);}return _0x23d41a[_0xcff4('0x21')]();};}function saveUpdates(_0x578356,_0x2f3890){return function(_0x4359e7){if(_0x4359e7){return _0x4359e7['update'](_0x578356)[_0xcff4('0x22')](function(_0x4f4844){return _0x4f4844;});}return null;};}function removeEntity(_0x773ca0,_0xd50bad){return function(_0x3bbb58){if(_0x3bbb58){return _0x3bbb58[_0xcff4('0x23')]()[_0xcff4('0x22')](function(){_0x773ca0['status'](0xcc)[_0xcff4('0x18')]();});}};}function handleEntityNotFound(_0x4bde60,_0x337e5e){return function(_0x72ebcd){if(!_0x72ebcd){_0x4bde60[_0xcff4('0x16')](0x194);}return _0x72ebcd;};}function handleError(_0x3e0dfd,_0x3e6a01){_0x3e6a01=_0x3e6a01||0x1f4;return function(_0x3c5d9d){logger[_0xcff4('0x24')](_0x3c5d9d[_0xcff4('0x25')]);if(_0x3c5d9d[_0xcff4('0x26')]){delete _0x3c5d9d[_0xcff4('0x26')];}_0x3e0dfd['status'](_0x3e6a01)[_0xcff4('0x27')](_0x3c5d9d);};}exports[_0xcff4('0x28')]=function(_0x23cf9f,_0x3cf73f){var _0x14b2ee={},_0x3e476e={},_0x27aa35={'count':0x0,'rows':[]};var _0x492dd5=_[_0xcff4('0x29')](db['CmCustomField'][_0xcff4('0x2a')],function(_0x10116e){return{'name':_0x10116e[_0xcff4('0x2b')],'type':_0x10116e[_0xcff4('0x2c')][_0xcff4('0x2d')]};});_0x3e476e[_0xcff4('0x2e')]=_[_0xcff4('0x2f')](_[_0xcff4('0x29')](_0x492dd5,_0xcff4('0x26')),['name']);_0x3e476e[_0xcff4('0x30')]=_[_0xcff4('0x31')](_0x23cf9f[_0xcff4('0x30')]);_0x3e476e[_0xcff4('0x32')]=_[_0xcff4('0x33')](_0x3e476e[_0xcff4('0x2e')],_0x3e476e[_0xcff4('0x30')]);_0x14b2ee[_0xcff4('0x34')]=_[_0xcff4('0x33')](_0x3e476e[_0xcff4('0x2e')],qs[_0xcff4('0x35')](_0x23cf9f[_0xcff4('0x30')][_0xcff4('0x35')]));_0x14b2ee[_0xcff4('0x34')]=_0x14b2ee[_0xcff4('0x34')][_0xcff4('0x36')]?_0x14b2ee[_0xcff4('0x34')]:_0x3e476e['model'];if(!_0x23cf9f[_0xcff4('0x30')][_0xcff4('0x37')](_0xcff4('0x38'))){_0x14b2ee[_0xcff4('0x1b')]=qs[_0xcff4('0x1b')](_0x23cf9f['query'][_0xcff4('0x1b')]);_0x14b2ee[_0xcff4('0x1d')]=qs['offset'](_0x23cf9f['query'][_0xcff4('0x1d')]);}_0x14b2ee[_0xcff4('0x39')]=qs[_0xcff4('0x3a')](_0x23cf9f[_0xcff4('0x30')][_0xcff4('0x3a')]);_0x14b2ee[_0xcff4('0x3b')]=qs[_0xcff4('0x32')](_['pick'](_0x23cf9f[_0xcff4('0x30')],_0x3e476e['filters']),_0x492dd5);if(_0x23cf9f[_0xcff4('0x30')][_0xcff4('0x3c')]){_0x14b2ee[_0xcff4('0x3b')]=_[_0xcff4('0x3d')](_0x14b2ee[_0xcff4('0x3b')],{'$or':_[_0xcff4('0x29')](_0x492dd5,function(_0x4e62a8){if(_0x4e62a8[_0xcff4('0x2c')]!==_0xcff4('0x3e')){var _0x381fdb={};_0x381fdb[_0x4e62a8[_0xcff4('0x26')]]={'$like':'%'+_0x23cf9f[_0xcff4('0x30')][_0xcff4('0x3c')]+'%'};return _0x381fdb;}})});}_0x14b2ee=_[_0xcff4('0x3d')]({},_0x14b2ee,_0x23cf9f[_0xcff4('0x3f')]);var _0x4d94fb={'where':_0x14b2ee['where']};return db[_0xcff4('0x40')]['count'](_0x4d94fb)['then'](function(_0x3a8c89){_0x27aa35[_0xcff4('0x1c')]=_0x3a8c89;if(_0x23cf9f[_0xcff4('0x30')]['includeAll']){_0x14b2ee['include']=[{'all':!![]}];}return db['CmCustomField'][_0xcff4('0x41')](_0x14b2ee);})[_0xcff4('0x22')](function(_0x496830){_0x27aa35['rows']=_0x496830;return _0x27aa35;})[_0xcff4('0x22')](respondWithFilteredResult(_0x3cf73f,_0x14b2ee))[_0xcff4('0x42')](handleError(_0x3cf73f,null));};exports[_0xcff4('0x43')]=function(_0x51f8f2,_0xb96fe6){var _0x581068={'raw':!![],'where':{'id':_0x51f8f2['params']['id']}},_0x14ebf6={};_0x14ebf6['model']=_['keys'](db[_0xcff4('0x40')]['rawAttributes']);_0x14ebf6[_0xcff4('0x30')]=_['keys'](_0x51f8f2[_0xcff4('0x30')]);_0x14ebf6[_0xcff4('0x32')]=_['intersection'](_0x14ebf6[_0xcff4('0x2e')],_0x14ebf6[_0xcff4('0x30')]);_0x581068[_0xcff4('0x34')]=_[_0xcff4('0x33')](_0x14ebf6[_0xcff4('0x2e')],qs[_0xcff4('0x35')](_0x51f8f2[_0xcff4('0x30')]['fields']));_0x581068[_0xcff4('0x34')]=_0x581068['attributes'][_0xcff4('0x36')]?_0x581068[_0xcff4('0x34')]:_0x14ebf6['model'];if(_0x51f8f2['query']['includeAll']){_0x581068['include']=[{'all':!![]}];}_0x581068=_['merge']({},_0x581068,_0x51f8f2[_0xcff4('0x3f')]);return db['CmCustomField'][_0xcff4('0x44')](_0x581068)[_0xcff4('0x22')](handleEntityNotFound(_0xb96fe6,null))[_0xcff4('0x22')](respondWithResult(_0xb96fe6,null))[_0xcff4('0x42')](handleError(_0xb96fe6,null));};exports[_0xcff4('0x45')]=function(_0xaf9801,_0x31d1ec){if(_0xaf9801['body']['id']){delete _0xaf9801['body']['id'];}return db[_0xcff4('0x40')][_0xcff4('0x44')]({'where':{'id':_0xaf9801[_0xcff4('0x46')]['id']}})[_0xcff4('0x22')](handleEntityNotFound(_0x31d1ec,null))['then'](saveUpdates(_0xaf9801[_0xcff4('0x47')],null))[_0xcff4('0x22')](respondWithResult(_0x31d1ec,null))[_0xcff4('0x42')](handleError(_0x31d1ec,null));};exports['destroy']=function(_0x60f06,_0x2b9126){return db[_0xcff4('0x40')]['find']({'where':{'id':_0x60f06['params']['id']}})[_0xcff4('0x22')](handleEntityNotFound(_0x2b9126,null))[_0xcff4('0x22')](removeEntity(_0x2b9126,null))[_0xcff4('0x42')](handleError(_0x2b9126,null));};exports['create']=function(_0x9b7914,_0x5a8c50){var _0x537de1;return db[_0xcff4('0x48')]['transaction'](function(_0x294bd0){return db[_0xcff4('0x40')][_0xcff4('0x49')](_0x9b7914[_0xcff4('0x47')],{'transaction':_0x294bd0})['then'](function(_0x5e3643){_0x537de1=_0x5e3643;var _0x1045cc={'type':db[_0xcff4('0x4a')][_0xcff4('0x4b')],'transaction':_0x294bd0};switch(_0x9b7914[_0xcff4('0x47')][_0xcff4('0x2c')]){case _0xcff4('0x4c'):_0x1045cc[_0xcff4('0x2c')]=db[_0xcff4('0x4a')]['TEXT'];break;case'number':_0x1045cc[_0xcff4('0x2c')]=db[_0xcff4('0x4a')][_0xcff4('0x4d')];break;case _0xcff4('0x4e'):_0x1045cc['type']=db[_0xcff4('0x4a')]['BOOLEAN'];_0x1045cc[_0xcff4('0x4f')]=![];break;default:}return db[_0xcff4('0x48')][_0xcff4('0x50')]['addColumn'](_0xcff4('0x51'),util['format'](_0xcff4('0x52'),_0x537de1['id']),_0x1045cc);})[_0xcff4('0x22')](function(){return _0x537de1;});})[_0xcff4('0x22')](respondWithResult(_0x5a8c50,0xc9))[_0xcff4('0x42')](handleError(_0x5a8c50,null));}; \ No newline at end of file +var _0x249b=['include','findAll','rows','catch','show','fields','length','merge','options','find','params','body','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','nolimit','sort','where','filters','filter','VIRTUAL','includeAll'];(function(_0x2bdca0,_0x549b10){var _0x15699e=function(_0x2b18ec){while(--_0x2b18ec){_0x2bdca0['push'](_0x2bdca0['shift']());}};_0x15699e(++_0x549b10);}(_0x249b,0x16a));var _0xb249=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x249b[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xb249('0x0'));var rimraf=require(_0xb249('0x1'));var zipdir=require(_0xb249('0x2'));var jsonpatch=require(_0xb249('0x3'));var rp=require(_0xb249('0x4'));var moment=require(_0xb249('0x5'));var BPromise=require(_0xb249('0x6'));var Mustache=require(_0xb249('0x7'));var util=require(_0xb249('0x8'));var path=require('path');var sox=require(_0xb249('0x9'));var csv=require(_0xb249('0xa'));var ejs=require(_0xb249('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb249('0xc'));var squel=require(_0xb249('0xd'));var crypto=require(_0xb249('0xe'));var jsforce=require(_0xb249('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb249('0xa'));var querystring=require(_0xb249('0x10'));var Papa=require(_0xb249('0x11'));var Redis=require(_0xb249('0x12'));var authService=require(_0xb249('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb249('0x14'));var hardwareService=require(_0xb249('0x15'));var logger=require(_0xb249('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb249('0x17'));var db=require(_0xb249('0x18'))['db'];function respondWithStatusCode(_0x5245ee,_0x26aded){_0x26aded=_0x26aded||0xcc;return function(_0x2f275a){if(_0x2f275a){return _0x5245ee[_0xb249('0x19')](_0x26aded);}return _0x5245ee[_0xb249('0x1a')](_0x26aded)[_0xb249('0x1b')]();};}function respondWithResult(_0x312afb,_0x560970){_0x560970=_0x560970||0xc8;return function(_0x2d9b8f){if(_0x2d9b8f){return _0x312afb[_0xb249('0x1a')](_0x560970)[_0xb249('0x1c')](_0x2d9b8f);}};}function respondWithFilteredResult(_0xf6023d,_0x1e6da8){return function(_0x3e1576){if(_0x3e1576){var _0xa46493=typeof _0x1e6da8['offset']===_0xb249('0x1d')&&typeof _0x1e6da8['limit']===_0xb249('0x1d');var _0x187541=_0x3e1576['count'];var _0x4f98fb=_0xa46493?0x0:_0x1e6da8[_0xb249('0x1e')];var _0x4698cd=_0xa46493?_0x3e1576[_0xb249('0x1f')]:_0x1e6da8[_0xb249('0x1e')]+_0x1e6da8[_0xb249('0x20')];var _0x2201e7;if(_0x4698cd>=_0x187541){_0x4698cd=_0x187541;_0x2201e7=0xc8;}else{_0x2201e7=0xce;}_0xf6023d[_0xb249('0x1a')](_0x2201e7);return _0xf6023d[_0xb249('0x21')]('Content-Range',_0x4f98fb+'-'+_0x4698cd+'/'+_0x187541)['json'](_0x3e1576);}return null;};}function patchUpdates(_0x243cf6){return function(_0x181d7e){try{jsonpatch[_0xb249('0x22')](_0x181d7e,_0x243cf6,!![]);}catch(_0x1b18ad){return BPromise[_0xb249('0x23')](_0x1b18ad);}return _0x181d7e[_0xb249('0x24')]();};}function saveUpdates(_0x2e1b82,_0x1c021e){return function(_0x53be45){if(_0x53be45){return _0x53be45[_0xb249('0x25')](_0x2e1b82)[_0xb249('0x26')](function(_0x4a217a){return _0x4a217a;});}return null;};}function removeEntity(_0x781287,_0x16cc0d){return function(_0x16a324){if(_0x16a324){return _0x16a324[_0xb249('0x27')]()[_0xb249('0x26')](function(){_0x781287[_0xb249('0x1a')](0xcc)[_0xb249('0x1b')]();});}};}function handleEntityNotFound(_0x4ad345,_0x1eed84){return function(_0x345d02){if(!_0x345d02){_0x4ad345['sendStatus'](0x194);}return _0x345d02;};}function handleError(_0x228eed,_0x3b8c22){_0x3b8c22=_0x3b8c22||0x1f4;return function(_0x13ebaa){logger[_0xb249('0x28')](_0x13ebaa[_0xb249('0x29')]);if(_0x13ebaa[_0xb249('0x2a')]){delete _0x13ebaa['name'];}_0x228eed[_0xb249('0x1a')](_0x3b8c22)[_0xb249('0x2b')](_0x13ebaa);};}exports[_0xb249('0x2c')]=function(_0x36e22c,_0x473d5d){var _0x3f7590={},_0x2756ad={},_0x14a27e={'count':0x0,'rows':[]};var _0x5bb3a0=_[_0xb249('0x2d')](db[_0xb249('0x2e')][_0xb249('0x2f')],function(_0x1b78d4){return{'name':_0x1b78d4[_0xb249('0x30')],'type':_0x1b78d4[_0xb249('0x31')][_0xb249('0x32')]};});_0x2756ad[_0xb249('0x33')]=_['differenceBy'](_['map'](_0x5bb3a0,_0xb249('0x2a')),[_0xb249('0x2a')]);_0x2756ad[_0xb249('0x34')]=_[_0xb249('0x35')](_0x36e22c[_0xb249('0x34')]);_0x2756ad['filters']=_['intersection'](_0x2756ad['model'],_0x2756ad[_0xb249('0x34')]);_0x3f7590['attributes']=_[_0xb249('0x36')](_0x2756ad['model'],qs['fields'](_0x36e22c['query']['fields']));_0x3f7590[_0xb249('0x37')]=_0x3f7590[_0xb249('0x37')]['length']?_0x3f7590[_0xb249('0x37')]:_0x2756ad[_0xb249('0x33')];if(!_0x36e22c[_0xb249('0x34')]['hasOwnProperty'](_0xb249('0x38'))){_0x3f7590['limit']=qs[_0xb249('0x20')](_0x36e22c[_0xb249('0x34')][_0xb249('0x20')]);_0x3f7590[_0xb249('0x1e')]=qs['offset'](_0x36e22c[_0xb249('0x34')][_0xb249('0x1e')]);}_0x3f7590['order']=qs[_0xb249('0x39')](_0x36e22c['query'][_0xb249('0x39')]);_0x3f7590[_0xb249('0x3a')]=qs[_0xb249('0x3b')](_['pick'](_0x36e22c['query'],_0x2756ad[_0xb249('0x3b')]),_0x5bb3a0);if(_0x36e22c[_0xb249('0x34')][_0xb249('0x3c')]){_0x3f7590[_0xb249('0x3a')]=_['merge'](_0x3f7590[_0xb249('0x3a')],{'$or':_[_0xb249('0x2d')](_0x5bb3a0,function(_0x49249f){if(_0x49249f[_0xb249('0x31')]!==_0xb249('0x3d')){var _0x4346d9={};_0x4346d9[_0x49249f['name']]={'$like':'%'+_0x36e22c[_0xb249('0x34')][_0xb249('0x3c')]+'%'};return _0x4346d9;}})});}_0x3f7590=_['merge']({},_0x3f7590,_0x36e22c['options']);var _0x540dc8={'where':_0x3f7590[_0xb249('0x3a')]};return db['CmCustomField'][_0xb249('0x1f')](_0x540dc8)[_0xb249('0x26')](function(_0x12a1b0){_0x14a27e[_0xb249('0x1f')]=_0x12a1b0;if(_0x36e22c['query'][_0xb249('0x3e')]){_0x3f7590[_0xb249('0x3f')]=[{'all':!![]}];}return db[_0xb249('0x2e')][_0xb249('0x40')](_0x3f7590);})[_0xb249('0x26')](function(_0x319f70){_0x14a27e[_0xb249('0x41')]=_0x319f70;return _0x14a27e;})['then'](respondWithFilteredResult(_0x473d5d,_0x3f7590))[_0xb249('0x42')](handleError(_0x473d5d,null));};exports[_0xb249('0x43')]=function(_0x4c2179,_0x32db1c){var _0x45e9f7={'raw':!![],'where':{'id':_0x4c2179['params']['id']}},_0x4b3c7b={};_0x4b3c7b[_0xb249('0x33')]=_['keys'](db[_0xb249('0x2e')][_0xb249('0x2f')]);_0x4b3c7b[_0xb249('0x34')]=_['keys'](_0x4c2179[_0xb249('0x34')]);_0x4b3c7b[_0xb249('0x3b')]=_[_0xb249('0x36')](_0x4b3c7b['model'],_0x4b3c7b[_0xb249('0x34')]);_0x45e9f7[_0xb249('0x37')]=_['intersection'](_0x4b3c7b['model'],qs['fields'](_0x4c2179[_0xb249('0x34')][_0xb249('0x44')]));_0x45e9f7['attributes']=_0x45e9f7[_0xb249('0x37')][_0xb249('0x45')]?_0x45e9f7[_0xb249('0x37')]:_0x4b3c7b[_0xb249('0x33')];if(_0x4c2179[_0xb249('0x34')][_0xb249('0x3e')]){_0x45e9f7['include']=[{'all':!![]}];}_0x45e9f7=_[_0xb249('0x46')]({},_0x45e9f7,_0x4c2179[_0xb249('0x47')]);return db[_0xb249('0x2e')]['find'](_0x45e9f7)[_0xb249('0x26')](handleEntityNotFound(_0x32db1c,null))['then'](respondWithResult(_0x32db1c,null))[_0xb249('0x42')](handleError(_0x32db1c,null));};exports[_0xb249('0x25')]=function(_0x283710,_0x1ae336){if(_0x283710['body']['id']){delete _0x283710['body']['id'];}return db[_0xb249('0x2e')][_0xb249('0x48')]({'where':{'id':_0x283710[_0xb249('0x49')]['id']}})[_0xb249('0x26')](handleEntityNotFound(_0x1ae336,null))['then'](saveUpdates(_0x283710[_0xb249('0x4a')],null))[_0xb249('0x26')](respondWithResult(_0x1ae336,null))[_0xb249('0x42')](handleError(_0x1ae336,null));};exports['destroy']=function(_0x38dfbf,_0x3b1b8f){return db[_0xb249('0x2e')][_0xb249('0x48')]({'where':{'id':_0x38dfbf[_0xb249('0x49')]['id']}})[_0xb249('0x26')](handleEntityNotFound(_0x3b1b8f,null))[_0xb249('0x26')](removeEntity(_0x3b1b8f,null))[_0xb249('0x42')](handleError(_0x3b1b8f,null));};exports[_0xb249('0x4b')]=function(_0x1c82b7,_0x5b4091){var _0x40ec81;return db['sequelize']['transaction'](function(_0x393e8f){return db[_0xb249('0x2e')]['create'](_0x1c82b7['body'],{'transaction':_0x393e8f})[_0xb249('0x26')](function(_0x32bbf3){_0x40ec81=_0x32bbf3;var _0x330898={'type':db[_0xb249('0x4c')]['TEXT'],'transaction':_0x393e8f};switch(_0x1c82b7[_0xb249('0x4a')][_0xb249('0x31')]){case'text':_0x330898[_0xb249('0x31')]=db[_0xb249('0x4c')][_0xb249('0x4d')];break;case _0xb249('0x4e'):_0x330898[_0xb249('0x31')]=db['Sequelize'][_0xb249('0x4f')];break;case _0xb249('0x50'):_0x330898['type']=db[_0xb249('0x4c')][_0xb249('0x51')];_0x330898[_0xb249('0x52')]=![];break;default:}return db['sequelize'][_0xb249('0x53')]['addColumn']('cm_contacts',util['format'](_0xb249('0x54'),_0x40ec81['id']),_0x330898);})[_0xb249('0x26')](function(){return _0x40ec81;});})['then'](respondWithResult(_0x5b4091,0xc9))[_0xb249('0x42')](handleError(_0x5b4091,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7aa6311..695618b 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 _0x2774=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','rimraf','../../config/environment'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2774,0xff));var _0x4277=function(_0x324664,_0x38852c){_0x324664=_0x324664-0x0;var _0x574899=_0x2774[_0x324664];return _0x574899;};'use strict';var _=require(_0x4277('0x0'));var util=require(_0x4277('0x1'));var logger=require(_0x4277('0x2'))('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(_0x4277('0x3'));var config=require(_0x4277('0x4'));var attributes=require(_0x4277('0x5'));module[_0x4277('0x6')]=function(_0x1e3f0b,_0x4871c6){return _0x1e3f0b[_0x4277('0x7')](_0x4277('0x8'),attributes,{'tableName':_0x4277('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd79f=['exports','define','CmCustomField','cm_custom_fields','util','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd79f,0x1e1));var _0xfd79=function(_0x37bf8e,_0xb7dc10){_0x37bf8e=_0x37bf8e-0x0;var _0x55596f=_0xd79f[_0x37bf8e];return _0x55596f;};'use strict';var _=require('lodash');var util=require(_0xfd79('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd79('0x1'));var fs=require('fs');var path=require(_0xfd79('0x2'));var rimraf=require(_0xfd79('0x3'));var config=require(_0xfd79('0x4'));var attributes=require('./cmCustomField.attributes');module[_0xfd79('0x5')]=function(_0x137b80,_0x2fcc8b){return _0x137b80[_0xfd79('0x6')](_0xfd79('0x7'),attributes,{'tableName':_0xfd79('0x8'),'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 71a1425..82079b0 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 _0x5732=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result'];(function(_0x39c7bb,_0x4ee817){var _0x52af11=function(_0x2b7c61){while(--_0x2b7c61){_0x39c7bb['push'](_0x39c7bb['shift']());}};_0x52af11(++_0x4ee817);}(_0x5732,0x177));var _0x2573=function(_0x20207a,_0x500268){_0x20207a=_0x20207a-0x0;var _0x4fd528=_0x5732[_0x20207a];return _0x4fd528;};'use strict';var _=require(_0x2573('0x0'));var util=require(_0x2573('0x1'));var moment=require(_0x2573('0x2'));var BPromise=require(_0x2573('0x3'));var rs=require(_0x2573('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2573('0x5'))['db'];var utils=require(_0x2573('0x6'));var logger=require('../../config/logger')(_0x2573('0x7'));var config=require(_0x2573('0x8'));var jayson=require(_0x2573('0x9'));var client=jayson[_0x2573('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3c94,_0x25d413,_0x2cccd9){return new BPromise(function(_0x572d75,_0xfe4a6d){return client['request'](_0x1f3c94,_0x2cccd9)[_0x2573('0xb')](function(_0x1777b7){logger[_0x2573('0xc')]('CmCustomField,\x20%s,\x20%s',_0x25d413,'request\x20sent');logger['debug'](_0x2573('0xd'),_0x25d413,_0x2573('0xe'),JSON[_0x2573('0xf')](_0x1777b7));if(_0x1777b7[_0x2573('0x10')]){if(_0x1777b7[_0x2573('0x10')][_0x2573('0x11')]===0x1f4){logger[_0x2573('0x10')](_0x2573('0x12'),_0x25d413,_0x1777b7[_0x2573('0x10')][_0x2573('0x13')]);return _0xfe4a6d(_0x1777b7[_0x2573('0x10')][_0x2573('0x13')]);}logger['error'](_0x2573('0x12'),_0x25d413,_0x1777b7[_0x2573('0x10')][_0x2573('0x13')]);return _0x572d75(_0x1777b7[_0x2573('0x10')]['message']);}else{logger[_0x2573('0xc')](_0x2573('0x12'),_0x25d413,'request\x20sent');_0x572d75(_0x1777b7[_0x2573('0x14')][_0x2573('0x13')]);}})[_0x2573('0x15')](function(_0x414228){logger[_0x2573('0x10')](_0x2573('0x12'),_0x25d413,_0x414228);_0xfe4a6d(_0x414228);});});} \ No newline at end of file +var _0xe490=['CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe490,0x7b));var _0x0e49=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe490[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0e49('0x0'));var util=require(_0x0e49('0x1'));var moment=require(_0x0e49('0x2'));var BPromise=require(_0x0e49('0x3'));var rs=require(_0x0e49('0x4'));var fs=require('fs');var Redis=require(_0x0e49('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e49('0x6'))(_0x0e49('0x7'));var config=require(_0x0e49('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0e49('0x9')][_0x0e49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56cce3,_0x4dddd8,_0xc8e972){return new BPromise(function(_0x3ec524,_0x41a561){return client[_0x0e49('0xb')](_0x56cce3,_0xc8e972)[_0x0e49('0xc')](function(_0x5df156){logger['info'](_0x0e49('0xd'),_0x4dddd8,'request\x20sent');logger[_0x0e49('0xe')](_0x0e49('0xf'),_0x4dddd8,_0x0e49('0x10'),JSON[_0x0e49('0x11')](_0x5df156));if(_0x5df156[_0x0e49('0x12')]){if(_0x5df156[_0x0e49('0x12')]['code']===0x1f4){logger[_0x0e49('0x12')](_0x0e49('0xd'),_0x4dddd8,_0x5df156[_0x0e49('0x12')]['message']);return _0x41a561(_0x5df156['error'][_0x0e49('0x13')]);}logger[_0x0e49('0x12')](_0x0e49('0xd'),_0x4dddd8,_0x5df156[_0x0e49('0x12')]['message']);return _0x3ec524(_0x5df156['error'][_0x0e49('0x13')]);}else{logger[_0x0e49('0x14')](_0x0e49('0xd'),_0x4dddd8,_0x0e49('0x10'));_0x3ec524(_0x5df156[_0x0e49('0x15')][_0x0e49('0x13')]);}})[_0x0e49('0x16')](function(_0x178360){logger[_0x0e49('0x12')](_0x0e49('0xd'),_0x4dddd8,_0x178360);_0x41a561(_0x178360);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index c3a4449..26b0669 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 _0xf0db=['get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x116f5f,_0x5ef066){var _0x2151cb=function(_0x4a0a4a){while(--_0x4a0a4a){_0x116f5f['push'](_0x116f5f['shift']());}};_0x2151cb(++_0x5ef066);}(_0xf0db,0x12b));var _0xbf0d=function(_0x25ec2b,_0x1a0b12){_0x25ec2b=_0x25ec2b-0x0;var _0x2eea15=_0xf0db[_0x25ec2b];return _0x2eea15;};'use strict';var multer=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var path=require('path');var timeout=require(_0xbf0d('0x2'));var express=require(_0xbf0d('0x3'));var router=express[_0xbf0d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf0d('0x5'));var interaction=require(_0xbf0d('0x6'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xbf0d('0x7')]('/',auth[_0xbf0d('0x8')](),controller[_0xbf0d('0x9')]);router[_0xbf0d('0x7')]('/:id',auth[_0xbf0d('0x8')](),controller[_0xbf0d('0xa')]);router[_0xbf0d('0xb')]('/',auth[_0xbf0d('0x8')](),controller[_0xbf0d('0xc')]);router[_0xbf0d('0xd')](_0xbf0d('0xe'),auth[_0xbf0d('0x8')](),controller['update']);router['delete'](_0xbf0d('0xe'),auth[_0xbf0d('0x8')](),controller[_0xbf0d('0xf')]);module[_0xbf0d('0x10')]=router; \ No newline at end of file +var _0x106f=['express','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x3f29df,_0x211940){var _0x17a91b=function(_0xebc4dd){while(--_0xebc4dd){_0x3f29df['push'](_0x3f29df['shift']());}};_0x17a91b(++_0x211940);}(_0x106f,0x162));var _0xf106=function(_0x39ac2d,_0x22848f){_0x39ac2d=_0x39ac2d-0x0;var _0x2c1be0=_0x106f[_0x39ac2d];return _0x2c1be0;};'use strict';var multer=require(_0xf106('0x0'));var util=require(_0xf106('0x1'));var path=require('path');var timeout=require(_0xf106('0x2'));var express=require(_0xf106('0x3'));var router=express['Router']();var fs_extra=require(_0xf106('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf106('0x5'));var config=require(_0xf106('0x6'));var controller=require(_0xf106('0x7'));router[_0xf106('0x8')]('/',auth[_0xf106('0x9')](),controller[_0xf106('0xa')]);router[_0xf106('0x8')]('/:id',auth[_0xf106('0x9')](),controller[_0xf106('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xf106('0x9')](),controller[_0xf106('0xc')]);router[_0xf106('0xd')](_0xf106('0xe'),auth[_0xf106('0x9')](),controller[_0xf106('0xf')]);module[_0xf106('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 8a09496..13eb53b 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 _0xd44f=['exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x4bc9b2,_0x411ba4){var _0x4f7057=function(_0x176727){while(--_0x176727){_0x4bc9b2['push'](_0x4bc9b2['shift']());}};_0x4f7057(++_0x411ba4);}(_0xd44f,0x132));var _0xfd44=function(_0x3b67e4,_0x2a5d46){_0x3b67e4=_0x3b67e4-0x0;var _0x21adcf=_0xd44f[_0x3b67e4];return _0x21adcf;};'use strict';var moment=require(_0xfd44('0x0'));var Sequelize=require(_0xfd44('0x1'));module[_0xfd44('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xfd44('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xfd44('0x4')],'defaultValue':moment()[_0xfd44('0x5')](_0xfd44('0x6'))},'countbusyretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfd44('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfd44('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfd44('0x4')]},'priority':{'type':Sequelize[_0xfd44('0x7')](0x2)[_0xfd44('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xfd44('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xfd44('0xa')},'ListId':{'type':Sequelize[_0xfd44('0x7')],'unique':_0xfd44('0xa')},'UserId':{'type':Sequelize[_0xfd44('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xfd44('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfd44('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xfd44('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfd44('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0xfd44('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xee96=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e53f8,_0x1c6895){var _0x49f0db=function(_0x3031eb){while(--_0x3031eb){_0x3e53f8['push'](_0x3e53f8['shift']());}};_0x49f0db(++_0x1c6895);}(_0xee96,0xc9));var _0x6ee9=function(_0x5908d7,_0x22cb37){_0x5908d7=_0x5908d7-0x0;var _0x4585c4=_0xee96[_0x5908d7];return _0x4585c4;};'use strict';var moment=require(_0x6ee9('0x0'));var Sequelize=require(_0x6ee9('0x1'));module[_0x6ee9('0x2')]={'phone':{'type':Sequelize[_0x6ee9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x6ee9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6ee9('0x5')],'defaultValue':moment()[_0x6ee9('0x6')](_0x6ee9('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6ee9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6ee9('0x5')]},'priority':{'type':Sequelize[_0x6ee9('0x8')](0x2)[_0x6ee9('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6ee9('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6ee9('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6ee9('0x8')],'unique':_0x6ee9('0xa')},'UserId':{'type':Sequelize[_0x6ee9('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x6ee9('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x6ee9('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6ee9('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6ee9('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6ee9('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 54c7d8c..35d5fef 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 _0x4c4e=['options','include','findAll','rows','show','params','includeAll','find','catch','create','body','update','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','sequelize','findOne','scheduledat','phone','LOCK','UPDATE','Company','CmList','List','Queue','dialActive','recallme','Contact','getOpenContacts','getVoiceQueues','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','then','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','filters','intersection','concat','$gt','$lt','$ne','$not','$notBetween','$iLike','$overlap','$contains','attributes','fields','length','sort','where','pick','filter','merge'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2537e2,_0x1f73a1){_0x2537e2=_0x2537e2-0x0;var _0x167aed=_0x4c4e[_0x2537e2];return _0x167aed;};'use strict';var moment=require(_0xe4c4('0x0'));var _=require('lodash');var qs=require(_0xe4c4('0x1'));var logger=require(_0xe4c4('0x2'))(_0xe4c4('0x3'));var shared=require('../../config/environment');var db=require(_0xe4c4('0x4'))['db'];function respondWithResult(_0x7d7655,_0x1a4483){_0x1a4483=_0x1a4483||0xc8;return function(_0x4cd652){if(_0x4cd652){return _0x7d7655[_0xe4c4('0x5')](_0x1a4483)['json'](_0x4cd652);}};}function respondWithFilteredResult(_0x177732,_0x1a12a6){return function(_0x262b64){if(_0x262b64){var _0xad105=typeof _0x1a12a6[_0xe4c4('0x6')]===_0xe4c4('0x7')&&typeof _0x1a12a6[_0xe4c4('0x8')]===_0xe4c4('0x7');var _0x4c953c=_0x262b64['count'];var _0x31f879=_0xad105?0x0:_0x1a12a6[_0xe4c4('0x6')];var _0x27ad42=_0xad105?_0x262b64[_0xe4c4('0x9')]:_0x1a12a6[_0xe4c4('0x6')]+_0x1a12a6[_0xe4c4('0x8')];var _0x50264f;if(_0x27ad42>=_0x4c953c){_0x27ad42=_0x4c953c;_0x50264f=0xc8;}else{_0x50264f=0xce;}_0x177732[_0xe4c4('0x5')](_0x50264f);return _0x177732[_0xe4c4('0xa')](_0xe4c4('0xb'),_0x31f879+'-'+_0x27ad42+'/'+_0x4c953c)[_0xe4c4('0xc')](_0x262b64);}return null;};}function saveUpdates(_0x50bfab,_0x262083){return function(_0x115802){if(_0x115802){return _0x115802['update'](_0x50bfab)[_0xe4c4('0xd')](function(_0x1a44e5){return _0x1a44e5;});}return null;};}function handleEntityNotFound(_0x5aa89b,_0x42ce9e){return function(_0x29766a){if(!_0x29766a){_0x5aa89b['sendStatus'](0x194);}return _0x29766a;};}function handleError(_0x307aa8,_0x465c9b){_0x465c9b=_0x465c9b||0x1f4;return function(_0x26ea05){logger[_0xe4c4('0xe')](_0x26ea05[_0xe4c4('0xf')]);if(_0x26ea05[_0xe4c4('0x10')]){delete _0x26ea05[_0xe4c4('0x10')];}_0x307aa8[_0xe4c4('0x5')](_0x465c9b)[_0xe4c4('0x11')](_0x26ea05);};}exports[_0xe4c4('0x12')]=function(_0x23b7e6,_0x42242c){var _0x3820c7={},_0x43a9ce={},_0x376585={'count':0x0,'rows':[]};var _0x5a32b5=_[_0xe4c4('0x13')](db[_0xe4c4('0x14')][_0xe4c4('0x15')],function(_0x317cc8){return{'name':_0x317cc8['fieldName'],'type':_0x317cc8[_0xe4c4('0x16')][_0xe4c4('0x17')]};});_0x43a9ce[_0xe4c4('0x18')]=_[_0xe4c4('0x13')](_0x5a32b5,_0xe4c4('0x10'));_0x43a9ce[_0xe4c4('0x19')]=_[_0xe4c4('0x1a')](_0x23b7e6[_0xe4c4('0x19')]);_0x43a9ce[_0xe4c4('0x1b')]=_[_0xe4c4('0x1c')](_0x43a9ce[_0xe4c4('0x18')],_0x43a9ce[_0xe4c4('0x19')]);_0x43a9ce[_0xe4c4('0x1b')]=_[_0xe4c4('0x1d')](_0x43a9ce[_0xe4c4('0x1b')],['$and','$or',_0xe4c4('0x1e'),'$gte',_0xe4c4('0x1f'),'$lte',_0xe4c4('0x20'),'$eq',_0xe4c4('0x21'),'$between',_0xe4c4('0x22'),'$in','$notIn','$like','$notLike',_0xe4c4('0x23'),'$notILike','$like',_0xe4c4('0x24'),_0xe4c4('0x25'),'$contained','$any']);_0x3820c7[_0xe4c4('0x26')]=_[_0xe4c4('0x1c')](_0x43a9ce['model'],qs[_0xe4c4('0x27')](_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x27')]));_0x3820c7['attributes']=_0x3820c7['attributes'][_0xe4c4('0x28')]?_0x3820c7[_0xe4c4('0x26')]:_0x43a9ce[_0xe4c4('0x18')];if(!_0x23b7e6[_0xe4c4('0x19')]['hasOwnProperty']('nolimit')){_0x3820c7[_0xe4c4('0x8')]=qs[_0xe4c4('0x8')](_0x23b7e6['query'][_0xe4c4('0x8')]);_0x3820c7[_0xe4c4('0x6')]=qs[_0xe4c4('0x6')](_0x23b7e6['query'][_0xe4c4('0x6')]);}_0x3820c7['order']=qs[_0xe4c4('0x29')](_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x29')]);_0x3820c7[_0xe4c4('0x2a')]=qs[_0xe4c4('0x1b')](_[_0xe4c4('0x2b')](_0x23b7e6[_0xe4c4('0x19')],_0x43a9ce[_0xe4c4('0x1b')]),_0x5a32b5);if(_0x23b7e6[_0xe4c4('0x19')][_0xe4c4('0x2c')]){_0x3820c7[_0xe4c4('0x2a')]=_[_0xe4c4('0x2d')](_0x3820c7['where'],{'$or':_[_0xe4c4('0x13')](_0x5a32b5,function(_0x25eb81){if(_0x25eb81[_0xe4c4('0x16')]!=='VIRTUAL'){var _0xac6cb4={};_0xac6cb4[_0x25eb81[_0xe4c4('0x10')]]={'$like':'%'+_0x23b7e6[_0xe4c4('0x19')]['filter']+'%'};return _0xac6cb4;}})});}_0x3820c7=_[_0xe4c4('0x2d')]({},_0x3820c7,_0x23b7e6[_0xe4c4('0x2e')]);var _0x4a3644={'where':_0x3820c7[_0xe4c4('0x2a')]};return db[_0xe4c4('0x14')][_0xe4c4('0x9')](_0x4a3644)[_0xe4c4('0xd')](function(_0x44f4eb){_0x376585[_0xe4c4('0x9')]=_0x44f4eb;if(_0x23b7e6[_0xe4c4('0x19')]['includeAll']){_0x3820c7[_0xe4c4('0x2f')]=[{'all':!![]}];}return db[_0xe4c4('0x14')][_0xe4c4('0x30')](_0x3820c7);})[_0xe4c4('0xd')](function(_0x4c5551){_0x376585[_0xe4c4('0x31')]=_0x4c5551;return _0x376585;})[_0xe4c4('0xd')](respondWithFilteredResult(_0x42242c,_0x3820c7))['catch'](handleError(_0x42242c,null));};exports[_0xe4c4('0x32')]=function(_0x185959,_0x4db15d){var _0x433f0c={'raw':!![],'where':{'id':_0x185959[_0xe4c4('0x33')]['id']}},_0x3cd4d3={};_0x3cd4d3[_0xe4c4('0x18')]=_[_0xe4c4('0x1a')](db[_0xe4c4('0x14')][_0xe4c4('0x15')]);_0x3cd4d3[_0xe4c4('0x19')]=_[_0xe4c4('0x1a')](_0x185959[_0xe4c4('0x19')]);_0x3cd4d3[_0xe4c4('0x1b')]=_[_0xe4c4('0x1c')](_0x3cd4d3['model'],_0x3cd4d3[_0xe4c4('0x19')]);_0x433f0c[_0xe4c4('0x26')]=_[_0xe4c4('0x1c')](_0x3cd4d3[_0xe4c4('0x18')],qs[_0xe4c4('0x27')](_0x185959[_0xe4c4('0x19')]['fields']));_0x433f0c[_0xe4c4('0x26')]=_0x433f0c['attributes'][_0xe4c4('0x28')]?_0x433f0c[_0xe4c4('0x26')]:_0x3cd4d3[_0xe4c4('0x18')];if(_0x185959[_0xe4c4('0x19')][_0xe4c4('0x34')]){_0x433f0c['include']=[{'all':!![]}];}_0x433f0c=_['merge']({},_0x433f0c,_0x185959[_0xe4c4('0x2e')]);return db[_0xe4c4('0x14')][_0xe4c4('0x35')](_0x433f0c)['then'](handleEntityNotFound(_0x4db15d,null))[_0xe4c4('0xd')](respondWithResult(_0x4db15d,null))[_0xe4c4('0x36')](handleError(_0x4db15d,null));};exports[_0xe4c4('0x37')]=function(_0x36e7b1,_0x54e073){return db[_0xe4c4('0x14')][_0xe4c4('0x37')](_0x36e7b1[_0xe4c4('0x38')],{})[_0xe4c4('0xd')](respondWithResult(_0x54e073,0xc9))[_0xe4c4('0x36')](handleError(_0x54e073,null));};exports[_0xe4c4('0x39')]=function(_0x1eda5e,_0x176712){if(_0x1eda5e[_0xe4c4('0x38')]['id']){delete _0x1eda5e['body']['id'];}return db[_0xe4c4('0x14')]['find']({'where':{'id':_0x1eda5e[_0xe4c4('0x33')]['id']}})[_0xe4c4('0xd')](handleEntityNotFound(_0x176712,null))[_0xe4c4('0xd')](saveUpdates(_0x1eda5e[_0xe4c4('0x38')],null))[_0xe4c4('0xd')](respondWithResult(_0x176712,null))[_0xe4c4('0x36')](handleError(_0x176712,null));};exports[_0xe4c4('0x3a')]=function(_0xeb6432,_0x36f8ad){return db[_0xe4c4('0x14')][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](respondWithResult(_0x36f8ad,null))[_0xe4c4('0x36')](handleError(_0x36f8ad,null));};exports[_0xe4c4('0x3b')]=function(_0x535bcc,_0x4922f5){var _0xe0e351;var _0x198961=_0x535bcc['params']['id'];return db[_0xe4c4('0x14')][_0xe4c4('0x35')]({'where':{'id':_0x535bcc[_0xe4c4('0x33')]['id']}})[_0xe4c4('0xd')](handleEntityNotFound(_0x4922f5,null))[_0xe4c4('0xd')](function(_0x5587b2){if(_0x5587b2){return _0x5587b2[_0xe4c4('0x3b')]()[_0xe4c4('0xd')](function(_0x4f6e03){return _0x4f6e03;});}})[_0xe4c4('0xd')](function(_0x24b0e7){_0xe0e351=_0x24b0e7;if(_0x24b0e7){if(_0x24b0e7['VoiceQueueId']||_0x24b0e7[_0xe4c4('0x3c')]){return db[_0x24b0e7['VoiceQueueId']?_0xe4c4('0x3d'):_0xe4c4('0x3e')][_0xe4c4('0x35')]({'where':{'id':_0x24b0e7[_0xe4c4('0x3f')]?_0x24b0e7[_0xe4c4('0x3f')]:_0x24b0e7['CampaignId']},'attributes':['id',_0xe4c4('0x10')],'raw':!![]});}}})[_0xe4c4('0xd')](function(_0x33bcec){var _0x2350d7={};if(_0x33bcec){_[_0xe4c4('0x2d')](_0x2350d7,_[_0xe4c4('0x40')](_0xe0e351[_0xe4c4('0x41')],[_0xe4c4('0x42'),_0xe4c4('0x43'),'id']));_0x2350d7[_0xe4c4('0x44')]=0x15;_0x2350d7[_0xe4c4('0x45')]=_0xe4c4('0x46');_0x2350d7[_0xe4c4('0x47')]=_0x33bcec[_0xe4c4('0x10')];_0x2350d7[_0xe4c4('0x48')]=_0x535bcc[_0xe4c4('0x49')]['name'];_0x2350d7[_0xe4c4('0x4a')]=_0x535bcc[_0xe4c4('0x49')]['id'];_0x2350d7[_0xe4c4('0x46')]=!![];_0x2350d7['deletedat']=moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'));_0x2350d7[_0xe4c4('0x4d')]=_0xe0e351['phone'];_0x2350d7[_0xe4c4('0x4e')]=_0xe0e351['VoiceQueueId']?_0xe4c4('0x4f'):_0xe4c4('0x50');return db[_0xe4c4('0x51')]['find']({'where':{'id':_0x2350d7['ContactId']},'attributes':[_0xe4c4('0x52'),_0xe4c4('0x53')]})[_0xe4c4('0xd')](function(_0x5edcae){if(!_[_0xe4c4('0x54')](_0x4922f5)&&!_['isNil'](_0x5edcae['firstName'])){_0x2350d7['calleridname']=_0x5edcae['firstName'];if(!_[_0xe4c4('0x54')](_0x5edcae[_0xe4c4('0x53')])){_0x2350d7[_0xe4c4('0x55')]+='\x20'+_0x5edcae[_0xe4c4('0x53')];}}})[_0xe4c4('0x56')](function(){return db[_0xe4c4('0x57')]['create'](_0x2350d7);});}})[_0xe4c4('0xd')](function(_0x44eb3b){return db[_0xe4c4('0x58')][_0xe4c4('0x3b')]({'where':{'CmHopperId':_0x198961}});})[_0xe4c4('0xd')](function(){return _0x4922f5[_0xe4c4('0x5')](0xcc)['end']();})['catch'](handleError(_0x4922f5,null));};exports[_0xe4c4('0x59')]=function(_0x6f374e,_0x1986ab){var _0x3c8e44=[];return db[_0xe4c4('0x51')][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](function(_0x24e1a2){_0x3c8e44=_[_0xe4c4('0x1a')](_0x24e1a2);return _0x6f374e['user']['getVoiceQueues']({'where':{'type':_0xe4c4('0x5a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xe4c4('0x5b'),_0xe4c4('0x5c')],'raw':!![]});})[_0xe4c4('0xd')](function(_0x58f2dd){if(_0x58f2dd&&_0x58f2dd[_0xe4c4('0x28')]){return db['sequelize'][_0xe4c4('0x5d')](function(_0x56ead3){var _0x5d6c0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'))},'VoiceQueueId':{'$in':_[_0xe4c4('0x13')](_0x58f2dd,'id')},'$or':[{'UserId':null},{'UserId':_0x6f374e['user']['id']}]};var _0x57e38e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x58f2dd)['filter']([_0xe4c4('0x5c'),0x0])[_0xe4c4('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x6f374e[_0xe4c4('0x49')]['id']}]};var _0x3850da={'$or':[_0x5d6c0a,_0x57e38e]};var _0x11115a=[];if(_0x6f374e['body']['direction']&&_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x5e')]===_0xe4c4('0x5f')){if(!_[_0xe4c4('0x60')](_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')])){_0x3850da['id']={'$in':_0x6f374e['body'][_0xe4c4('0x61')]};}_0x11115a=[[_0xe4c4('0x62'),_0xe4c4('0x63')],['scheduledAt',_0x58f2dd[0x0][_0xe4c4('0x5b')]===_0xe4c4('0x63')?_0xe4c4('0x64'):'ASC'],db['sequelize'][_0xe4c4('0x65')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xe4c4('0x60')](_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')])){_0x3850da['id']={'$notIn':_0x6f374e[_0xe4c4('0x38')][_0xe4c4('0x61')]};}_0x11115a=[[_0xe4c4('0x62'),_0xe4c4('0x64')],[_0xe4c4('0x66'),_0x58f2dd[0x0]['dialOrderByScheduledAt']],db[_0xe4c4('0x67')][_0xe4c4('0x65')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xe4c4('0x14')][_0xe4c4('0x68')]({'attributes':['id',_0xe4c4('0x69'),_0xe4c4('0x6a'),'recallme'],'where':_0x3850da,'order':_0x11115a,'transaction':_0x56ead3,'lock':_0x56ead3[_0xe4c4('0x6b')][_0xe4c4('0x6c')],'include':[{'model':db[_0xe4c4('0x51')],'as':'Contact','attributes':_0x3c8e44,'include':[{'model':db['CmCompany'],'as':_0xe4c4('0x6d'),'attributes':['id',_0xe4c4('0x10')]}]},{'model':db[_0xe4c4('0x6e')],'as':_0xe4c4('0x6f'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xe4c4('0x70'),'attributes':['id',_0xe4c4('0x10'),_0xe4c4('0x71')]}]})[_0xe4c4('0xd')](function(_0x1c9f4b){if(_0x1c9f4b){return _0x1c9f4b['update']({'UserId':_0x6f374e[_0xe4c4('0x49')]['id']},{'transaction':_0x56ead3});}});});}})['then'](handleEntityNotFound(_0x1986ab,null))[_0xe4c4('0xd')](respondWithResult(_0x1986ab,null))[_0xe4c4('0x36')](handleError(_0x1986ab,null));};exports['getPreviewRecall']=function(_0x570f1f,_0x4eddfd,_0x279075){var _0x250bb8=[];var _0x1f880f=_0x570f1f[_0xe4c4('0x33')]['id'];var _0x5b41e6=_0x570f1f['user']['id'];return db['CmContact'][_0xe4c4('0x3a')]()[_0xe4c4('0xd')](function(_0x4c10ef){_0x250bb8=_[_0xe4c4('0x1a')](_0x4c10ef);return db[_0xe4c4('0x67')][_0xe4c4('0x5d')](function(_0xb0a006){const _0x5cbc28={'id':_0x1f880f};return db['CmHopper'][_0xe4c4('0x68')]({'attributes':['id',_0xe4c4('0x69'),_0xe4c4('0x72')],'where':_0x5cbc28,'transaction':_0xb0a006,'lock':_0xb0a006[_0xe4c4('0x6b')][_0xe4c4('0x6c')],'include':[{'model':db[_0xe4c4('0x51')],'as':_0xe4c4('0x73'),'attributes':_0x250bb8,'include':[{'model':db['CmCompany'],'as':_0xe4c4('0x6d'),'attributes':['id',_0xe4c4('0x10')]}]},{'model':db[_0xe4c4('0x6e')],'as':_0xe4c4('0x6f'),'attributes':['id','name']},{'model':db[_0xe4c4('0x3d')],'as':_0xe4c4('0x70'),'attributes':['id',_0xe4c4('0x10'),_0xe4c4('0x71')]}]})['then'](function(_0x209602){if(_0x209602){return _0x209602[_0xe4c4('0x39')]({'UserId':_0x5b41e6},{'transaction':_0xb0a006});}});});})['then'](handleEntityNotFound(_0x4eddfd,null))['then'](respondWithResult(_0x4eddfd,null))[_0xe4c4('0x36')](handleError(_0x4eddfd,null));};exports[_0xe4c4('0x74')]=function(_0x3314d6,_0xe30faf){return _0x3314d6[_0xe4c4('0x49')][_0xe4c4('0x75')]({'where':{'type':_0xe4c4('0x5a'),'dialActive':!![],'dialMethod':_0xe4c4('0x76')},'attributes':['id'],'raw':!![]})['then'](function(_0x5ae9f0){if(_0x5ae9f0&&_0x5ae9f0[_0xe4c4('0x28')]){return db[_0xe4c4('0x14')][_0xe4c4('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe4c4('0x4b')](_0xe4c4('0x4c'))},'VoiceQueueId':{'$in':_['map'](_0x5ae9f0,'id')},'$or':[{'UserId':null},{'UserId':_0x3314d6[_0xe4c4('0x49')]['id']}]}});}return 0x0;})[_0xe4c4('0xd')](function(_0x425f38){if(!_[_0xe4c4('0x54')](_0x425f38)&&_[_0xe4c4('0x77')](_0x425f38)){return _0xe30faf[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')]({'contacts':_0x425f38});}else{logger[_0xe4c4('0xe')](_0xe4c4('0x78'),_0xe4c4('0x74'),0x194,_0xe4c4('0x79'));_0xe30faf[_0xe4c4('0x7a')](0x194);}})[_0xe4c4('0x36')](handleError(_0xe30faf,null));};exports[_0xe4c4('0x7b')]=function(_0x1ccdb2,_0x1295a4){var _0x52c3e0=shared['timezones'];var _0x340983=[];_['map'](_0x52c3e0,function(_0x46de38){_0x340983[_0xe4c4('0x7c')]({'id':_0x46de38[_0xe4c4('0x10')],'name':_0x46de38[_0xe4c4('0x10')],'utcOffset':_0x46de38[_0xe4c4('0x7d')]});});return _0x1295a4[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')]({'tz':_0x340983});};exports[_0xe4c4('0x7e')]=function(_0x371947,_0x1579fe){var _0x37bf48=shared[_0xe4c4('0x7f')];var _0x3030f6={};if(!_['isNil'](_0x37bf48[_0x371947[_0xe4c4('0x38')]['id']]))_0x3030f6=_0x37bf48[_0x371947[_0xe4c4('0x38')]['id']];return _0x1579fe[_0xe4c4('0x5')](0xc8)[_0xe4c4('0xc')](_0x3030f6);}; \ No newline at end of file +var _0x0bde=['moment','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','map','value','direction','prev','isEmpty','hopperIds','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','findOne','LOCK','CmCompany','CmList','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xe0bd('0x0'));var _=require('lodash');var qs=require(_0xe0bd('0x1'));var logger=require(_0xe0bd('0x2'))('api');var shared=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];function respondWithResult(_0x2294a7,_0x595deb){_0x595deb=_0x595deb||0xc8;return function(_0x95dfde){if(_0x95dfde){return _0x2294a7[_0xe0bd('0x5')](_0x595deb)[_0xe0bd('0x6')](_0x95dfde);}};}function respondWithFilteredResult(_0x3a3cd2,_0x37289f){return function(_0x1c8892){if(_0x1c8892){var _0x29faee=typeof _0x37289f[_0xe0bd('0x7')]===_0xe0bd('0x8')&&typeof _0x37289f[_0xe0bd('0x9')]===_0xe0bd('0x8');var _0x3c2ee1=_0x1c8892[_0xe0bd('0xa')];var _0x589149=_0x29faee?0x0:_0x37289f[_0xe0bd('0x7')];var _0x235122=_0x29faee?_0x1c8892['count']:_0x37289f[_0xe0bd('0x7')]+_0x37289f['limit'];var _0x175f8a;if(_0x235122>=_0x3c2ee1){_0x235122=_0x3c2ee1;_0x175f8a=0xc8;}else{_0x175f8a=0xce;}_0x3a3cd2[_0xe0bd('0x5')](_0x175f8a);return _0x3a3cd2[_0xe0bd('0xb')](_0xe0bd('0xc'),_0x589149+'-'+_0x235122+'/'+_0x3c2ee1)[_0xe0bd('0x6')](_0x1c8892);}return null;};}function saveUpdates(_0x16c3a9,_0x1905b2){return function(_0x500a9e){if(_0x500a9e){return _0x500a9e[_0xe0bd('0xd')](_0x16c3a9)[_0xe0bd('0xe')](function(_0x3dfc72){return _0x3dfc72;});}return null;};}function handleEntityNotFound(_0x5c76f1,_0x479438){return function(_0x48afde){if(!_0x48afde){_0x5c76f1[_0xe0bd('0xf')](0x194);}return _0x48afde;};}function handleError(_0x234c34,_0x3f5ef7){_0x3f5ef7=_0x3f5ef7||0x1f4;return function(_0x3042e1){logger[_0xe0bd('0x10')](_0x3042e1[_0xe0bd('0x11')]);if(_0x3042e1[_0xe0bd('0x12')]){delete _0x3042e1[_0xe0bd('0x12')];}_0x234c34['status'](_0x3f5ef7)['send'](_0x3042e1);};}exports[_0xe0bd('0x13')]=function(_0xd8746d,_0x1c4533){var _0x100b8f={},_0xa6be32={},_0x2a015c={'count':0x0,'rows':[]};var _0x5b23de=_['map'](db[_0xe0bd('0x14')][_0xe0bd('0x15')],function(_0x1187cf){return{'name':_0x1187cf[_0xe0bd('0x16')],'type':_0x1187cf[_0xe0bd('0x17')][_0xe0bd('0x18')]};});_0xa6be32[_0xe0bd('0x19')]=_['map'](_0x5b23de,'name');_0xa6be32[_0xe0bd('0x1a')]=_[_0xe0bd('0x1b')](_0xd8746d[_0xe0bd('0x1a')]);_0xa6be32[_0xe0bd('0x1c')]=_[_0xe0bd('0x1d')](_0xa6be32['model'],_0xa6be32[_0xe0bd('0x1a')]);_0xa6be32['filters']=_[_0xe0bd('0x1e')](_0xa6be32[_0xe0bd('0x1c')],[_0xe0bd('0x1f'),'$or',_0xe0bd('0x20'),_0xe0bd('0x21'),'$lt',_0xe0bd('0x22'),'$ne',_0xe0bd('0x23'),'$not',_0xe0bd('0x24'),_0xe0bd('0x25'),_0xe0bd('0x26'),'$notIn',_0xe0bd('0x27'),'$notLike',_0xe0bd('0x28'),_0xe0bd('0x29'),'$like','$overlap',_0xe0bd('0x2a'),_0xe0bd('0x2b'),_0xe0bd('0x2c')]);_0x100b8f[_0xe0bd('0x2d')]=_[_0xe0bd('0x1d')](_0xa6be32[_0xe0bd('0x19')],qs[_0xe0bd('0x2e')](_0xd8746d['query'][_0xe0bd('0x2e')]));_0x100b8f[_0xe0bd('0x2d')]=_0x100b8f[_0xe0bd('0x2d')][_0xe0bd('0x2f')]?_0x100b8f[_0xe0bd('0x2d')]:_0xa6be32[_0xe0bd('0x19')];if(!_0xd8746d['query'][_0xe0bd('0x30')](_0xe0bd('0x31'))){_0x100b8f[_0xe0bd('0x9')]=qs[_0xe0bd('0x9')](_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x9')]);_0x100b8f[_0xe0bd('0x7')]=qs[_0xe0bd('0x7')](_0xd8746d['query']['offset']);}_0x100b8f[_0xe0bd('0x32')]=qs[_0xe0bd('0x33')](_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x33')]);_0x100b8f[_0xe0bd('0x34')]=qs['filters'](_['pick'](_0xd8746d['query'],_0xa6be32[_0xe0bd('0x1c')]),_0x5b23de);if(_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x35')]){_0x100b8f[_0xe0bd('0x34')]=_[_0xe0bd('0x36')](_0x100b8f[_0xe0bd('0x34')],{'$or':_['map'](_0x5b23de,function(_0x1304d2){if(_0x1304d2[_0xe0bd('0x17')]!==_0xe0bd('0x37')){var _0x4e9272={};_0x4e9272[_0x1304d2[_0xe0bd('0x12')]]={'$like':'%'+_0xd8746d[_0xe0bd('0x1a')]['filter']+'%'};return _0x4e9272;}})});}_0x100b8f=_[_0xe0bd('0x36')]({},_0x100b8f,_0xd8746d[_0xe0bd('0x38')]);var _0x406b41={'where':_0x100b8f['where']};return db[_0xe0bd('0x14')]['count'](_0x406b41)[_0xe0bd('0xe')](function(_0x37a8b9){_0x2a015c[_0xe0bd('0xa')]=_0x37a8b9;if(_0xd8746d[_0xe0bd('0x1a')]['includeAll']){_0x100b8f[_0xe0bd('0x39')]=[{'all':!![]}];}return db[_0xe0bd('0x14')][_0xe0bd('0x3a')](_0x100b8f);})['then'](function(_0x54170b){_0x2a015c[_0xe0bd('0x3b')]=_0x54170b;return _0x2a015c;})[_0xe0bd('0xe')](respondWithFilteredResult(_0x1c4533,_0x100b8f))[_0xe0bd('0x3c')](handleError(_0x1c4533,null));};exports['show']=function(_0x5cc98d,_0x42a725){var _0x383b08={'raw':!![],'where':{'id':_0x5cc98d[_0xe0bd('0x3d')]['id']}},_0x324bb2={};_0x324bb2['model']=_[_0xe0bd('0x1b')](db[_0xe0bd('0x14')][_0xe0bd('0x15')]);_0x324bb2['query']=_['keys'](_0x5cc98d[_0xe0bd('0x1a')]);_0x324bb2[_0xe0bd('0x1c')]=_[_0xe0bd('0x1d')](_0x324bb2[_0xe0bd('0x19')],_0x324bb2['query']);_0x383b08[_0xe0bd('0x2d')]=_[_0xe0bd('0x1d')](_0x324bb2[_0xe0bd('0x19')],qs['fields'](_0x5cc98d['query'][_0xe0bd('0x2e')]));_0x383b08['attributes']=_0x383b08[_0xe0bd('0x2d')][_0xe0bd('0x2f')]?_0x383b08['attributes']:_0x324bb2[_0xe0bd('0x19')];if(_0x5cc98d[_0xe0bd('0x1a')][_0xe0bd('0x3e')]){_0x383b08['include']=[{'all':!![]}];}_0x383b08=_[_0xe0bd('0x36')]({},_0x383b08,_0x5cc98d[_0xe0bd('0x38')]);return db[_0xe0bd('0x14')][_0xe0bd('0x3f')](_0x383b08)[_0xe0bd('0xe')](handleEntityNotFound(_0x42a725,null))[_0xe0bd('0xe')](respondWithResult(_0x42a725,null))[_0xe0bd('0x3c')](handleError(_0x42a725,null));};exports[_0xe0bd('0x40')]=function(_0x5a02f9,_0x9505be){return db[_0xe0bd('0x14')][_0xe0bd('0x40')](_0x5a02f9[_0xe0bd('0x41')],{})[_0xe0bd('0xe')](respondWithResult(_0x9505be,0xc9))[_0xe0bd('0x3c')](handleError(_0x9505be,null));};exports[_0xe0bd('0xd')]=function(_0x5399b3,_0x59d38a){if(_0x5399b3[_0xe0bd('0x41')]['id']){delete _0x5399b3[_0xe0bd('0x41')]['id'];}return db[_0xe0bd('0x14')][_0xe0bd('0x3f')]({'where':{'id':_0x5399b3[_0xe0bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59d38a,null))[_0xe0bd('0xe')](saveUpdates(_0x5399b3['body'],null))['then'](respondWithResult(_0x59d38a,null))['catch'](handleError(_0x59d38a,null));};exports[_0xe0bd('0x42')]=function(_0x55dd83,_0x545cfb){return db[_0xe0bd('0x14')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](respondWithResult(_0x545cfb,null))[_0xe0bd('0x3c')](handleError(_0x545cfb,null));};exports[_0xe0bd('0x43')]=function(_0x220147,_0xe2b989){var _0x1c4464;var _0x137bed=_0x220147[_0xe0bd('0x3d')]['id'];return db['CmHopper'][_0xe0bd('0x3f')]({'where':{'id':_0x220147['params']['id']}})['then'](handleEntityNotFound(_0xe2b989,null))[_0xe0bd('0xe')](function(_0x292296){if(_0x292296){return _0x292296[_0xe0bd('0x43')]()['then'](function(_0x281a60){return _0x281a60;});}})[_0xe0bd('0xe')](function(_0x2ace8e){_0x1c4464=_0x2ace8e;if(_0x2ace8e){if(_0x2ace8e[_0xe0bd('0x44')]||_0x2ace8e[_0xe0bd('0x45')]){return db[_0x2ace8e[_0xe0bd('0x44')]?_0xe0bd('0x46'):_0xe0bd('0x47')][_0xe0bd('0x3f')]({'where':{'id':_0x2ace8e[_0xe0bd('0x44')]?_0x2ace8e[_0xe0bd('0x44')]:_0x2ace8e[_0xe0bd('0x45')]},'attributes':['id','name'],'raw':!![]});}}})[_0xe0bd('0xe')](function(_0xa761ae){var _0x530338={};if(_0xa761ae){_['merge'](_0x530338,_['omit'](_0x1c4464[_0xe0bd('0x48')],['createdAt','updatedAt','id']));_0x530338['state']=0x15;_0x530338[_0xe0bd('0x49')]=_0xe0bd('0x4a');_0x530338[_0xe0bd('0x4b')]=_0xa761ae[_0xe0bd('0x12')];_0x530338['membername']=_0x220147[_0xe0bd('0x4c')]['name'];_0x530338[_0xe0bd('0x4d')]=_0x220147[_0xe0bd('0x4c')]['id'];_0x530338[_0xe0bd('0x4a')]=!![];_0x530338[_0xe0bd('0x4e')]=moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'));_0x530338[_0xe0bd('0x51')]=_0x1c4464[_0xe0bd('0x52')];_0x530338[_0xe0bd('0x53')]=_0x1c4464[_0xe0bd('0x44')]?_0xe0bd('0x54'):_0xe0bd('0x55');return db[_0xe0bd('0x56')]['find']({'where':{'id':_0x530338[_0xe0bd('0x57')]},'attributes':['firstName',_0xe0bd('0x58')]})[_0xe0bd('0xe')](function(_0x302bae){if(!_[_0xe0bd('0x59')](_0xe2b989)&&!_[_0xe0bd('0x59')](_0x302bae[_0xe0bd('0x5a')])){_0x530338[_0xe0bd('0x5b')]=_0x302bae[_0xe0bd('0x5a')];if(!_[_0xe0bd('0x59')](_0x302bae['lastName'])){_0x530338['calleridname']+='\x20'+_0x302bae['lastName'];}}})[_0xe0bd('0x5c')](function(){return db[_0xe0bd('0x5d')][_0xe0bd('0x40')](_0x530338);});}})[_0xe0bd('0xe')](function(_0x3c12a2){return db[_0xe0bd('0x5e')][_0xe0bd('0x43')]({'where':{'CmHopperId':_0x137bed}});})[_0xe0bd('0xe')](function(){return _0xe2b989[_0xe0bd('0x5')](0xcc)['end']();})[_0xe0bd('0x3c')](handleError(_0xe2b989,null));};exports['getPreview']=function(_0x5f0226,_0x36fb12){var _0x38dfae=[];return db[_0xe0bd('0x56')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](function(_0x36f315){_0x38dfae=_[_0xe0bd('0x1b')](_0x36f315);return _0x5f0226['user'][_0xe0bd('0x5f')]({'where':{'type':_0xe0bd('0x60'),'dialActive':!![],'dialMethod':_0xe0bd('0x61')},'attributes':['id','dialOrderByScheduledAt',_0xe0bd('0x62')],'raw':!![]});})[_0xe0bd('0xe')](function(_0x593e24){if(_0x593e24&&_0x593e24[_0xe0bd('0x2f')]){return db[_0xe0bd('0x63')][_0xe0bd('0x64')](function(_0x26d6fc){var _0x5a43e0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x65')](_0x593e24,'id')},'$or':[{'UserId':null},{'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']}]};var _0x20a619={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x593e24)[_0xe0bd('0x35')]([_0xe0bd('0x62'),0x0])[_0xe0bd('0x65')]('id')[_0xe0bd('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']}]};var _0x2ddfd4={'$or':[_0x5a43e0,_0x20a619]};var _0xcd835d=[];if(_0x5f0226['body'][_0xe0bd('0x67')]&&_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x67')]===_0xe0bd('0x68')){if(!_[_0xe0bd('0x69')](_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x6a')])){_0x2ddfd4['id']={'$in':_0x5f0226['body'][_0xe0bd('0x6a')]};}_0xcd835d=[['priority',_0xe0bd('0x6b')],['scheduledAt',_0x593e24[0x0][_0xe0bd('0x6c')]===_0xe0bd('0x6b')?_0xe0bd('0x6d'):_0xe0bd('0x6b')],db[_0xe0bd('0x63')][_0xe0bd('0x6e')](_0xe0bd('0x6f')),['id',_0xe0bd('0x6d')]];}else{if(!_[_0xe0bd('0x69')](_0x5f0226[_0xe0bd('0x41')]['hopperIds'])){_0x2ddfd4['id']={'$notIn':_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x6a')]};}_0xcd835d=[[_0xe0bd('0x70'),_0xe0bd('0x6d')],[_0xe0bd('0x71'),_0x593e24[0x0][_0xe0bd('0x6c')]],db[_0xe0bd('0x63')][_0xe0bd('0x6e')](_0xe0bd('0x72')),['id',_0xe0bd('0x6b')]];}return db[_0xe0bd('0x14')]['findOne']({'attributes':['id',_0xe0bd('0x73'),_0xe0bd('0x52'),_0xe0bd('0x74')],'where':_0x2ddfd4,'order':_0xcd835d,'transaction':_0x26d6fc,'lock':_0x26d6fc['LOCK'][_0xe0bd('0x75')],'include':[{'model':db[_0xe0bd('0x56')],'as':_0xe0bd('0x76'),'attributes':_0x38dfae,'include':[{'model':db['CmCompany'],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x12')]}]},{'model':db['CmList'],'as':_0xe0bd('0x78'),'attributes':['id',_0xe0bd('0x12')]},{'model':db[_0xe0bd('0x46')],'as':_0xe0bd('0x79'),'attributes':['id','name','dialActive']}]})[_0xe0bd('0xe')](function(_0x4f2941){if(_0x4f2941){return _0x4f2941[_0xe0bd('0xd')]({'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']},{'transaction':_0x26d6fc});}});});}})[_0xe0bd('0xe')](handleEntityNotFound(_0x36fb12,null))[_0xe0bd('0xe')](respondWithResult(_0x36fb12,null))[_0xe0bd('0x3c')](handleError(_0x36fb12,null));};exports[_0xe0bd('0x7a')]=function(_0xcd7424,_0x4b0bd7,_0xa3b019){var _0x1b982d=[];var _0x379195=_0xcd7424['params']['id'];var _0x5be09e=_0xcd7424['user']['id'];return db[_0xe0bd('0x56')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](function(_0x12dd0c){_0x1b982d=_[_0xe0bd('0x1b')](_0x12dd0c);return db[_0xe0bd('0x63')]['transaction'](function(_0x7bd607){const _0x47a2d8={'id':_0x379195};return db['CmHopper'][_0xe0bd('0x7b')]({'attributes':['id',_0xe0bd('0x73'),_0xe0bd('0x74')],'where':_0x47a2d8,'transaction':_0x7bd607,'lock':_0x7bd607[_0xe0bd('0x7c')][_0xe0bd('0x75')],'include':[{'model':db[_0xe0bd('0x56')],'as':_0xe0bd('0x76'),'attributes':_0x1b982d,'include':[{'model':db[_0xe0bd('0x7d')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x12')]}]},{'model':db[_0xe0bd('0x7e')],'as':'List','attributes':['id',_0xe0bd('0x12')]},{'model':db[_0xe0bd('0x46')],'as':'Queue','attributes':['id',_0xe0bd('0x12'),_0xe0bd('0x7f')]}]})['then'](function(_0x536021){if(_0x536021){return _0x536021[_0xe0bd('0xd')]({'UserId':_0x5be09e},{'transaction':_0x7bd607});}});});})[_0xe0bd('0xe')](handleEntityNotFound(_0x4b0bd7,null))[_0xe0bd('0xe')](respondWithResult(_0x4b0bd7,null))['catch'](handleError(_0x4b0bd7,null));};exports['getOpenContacts']=function(_0x4e2b01,_0x4b8928){return _0x4e2b01[_0xe0bd('0x4c')]['getVoiceQueues']({'where':{'type':_0xe0bd('0x60'),'dialActive':!![],'dialMethod':_0xe0bd('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x3a8d82){if(_0x3a8d82&&_0x3a8d82[_0xe0bd('0x2f')]){return db[_0xe0bd('0x14')][_0xe0bd('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x65')](_0x3a8d82,'id')},'$or':[{'UserId':null},{'UserId':_0x4e2b01[_0xe0bd('0x4c')]['id']}]}});}return 0x0;})[_0xe0bd('0xe')](function(_0xa1342d){if(!_['isNil'](_0xa1342d)&&_[_0xe0bd('0x80')](_0xa1342d)){return _0x4b8928[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'contacts':_0xa1342d});}else{logger['error'](_0xe0bd('0x81'),_0xe0bd('0x82'),0x194,_0xe0bd('0x83'));_0x4b8928['sendStatus'](0x194);}})[_0xe0bd('0x3c')](handleError(_0x4b8928,null));};exports[_0xe0bd('0x84')]=function(_0x4d611a,_0x458846){var _0xe90d7e=shared[_0xe0bd('0x85')];var _0xbec78a=[];_[_0xe0bd('0x65')](_0xe90d7e,function(_0x9ce5a8){_0xbec78a['push']({'id':_0x9ce5a8[_0xe0bd('0x12')],'name':_0x9ce5a8[_0xe0bd('0x12')],'utcOffset':_0x9ce5a8[_0xe0bd('0x86')]});});return _0x458846[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'tz':_0xbec78a});};exports[_0xe0bd('0x87')]=function(_0x51b263,_0x4394c7){var _0x59e087=shared[_0xe0bd('0x85')];var _0x43fea2={};if(!_['isNil'](_0x59e087[_0x51b263[_0xe0bd('0x41')]['id']]))_0x43fea2=_0x59e087[_0x51b263[_0xe0bd('0x41')]['id']];return _0x4394c7[_0xe0bd('0x5')](0xc8)['json'](_0x43fea2);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4dddbd3..94d21a5 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 _0x5d17=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x312aa4,_0x52aefc){var _0x218fbd=function(_0x15331d){while(--_0x15331d){_0x312aa4['push'](_0x312aa4['shift']());}};_0x218fbd(++_0x52aefc);}(_0x5d17,0x114));var _0x75d1=function(_0x2e2d89,_0x4bb615){_0x2e2d89=_0x2e2d89-0x0;var _0x3aba90=_0x5d17[_0x2e2d89];return _0x3aba90;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]},{'name':_0x75d1('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x75d1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x82c31a,_0x15c638){var _0xccb997=function(_0x2ec860){while(--_0x2ec860){_0x82c31a['push'](_0x82c31a['shift']());}};_0xccb997(++_0x15c638);}(_0xacf4,0xe7));var _0x4acf=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xacf4[_0x25701b];return _0x3a8a2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 27ae174..65a2c35 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 _0x6bd7=['push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','findAll','UPDATE','all','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','name','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../config/logger','rpc','GetCmHopper','options','where','attributes','limit','include','map','model','then','info','debug','catch','message','ShowCmHopper','CmHopper','find','raw','stringify','error','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','voicePause','length','update','includes'];(function(_0x32bc56,_0x10faf7){var _0x1fda71=function(_0x21a9ec){while(--_0x21a9ec){_0x32bc56['push'](_0x32bc56['shift']());}};_0x1fda71(++_0x10faf7);}(_0x6bd7,0x71));var _0x76bd=function(_0x46b832,_0x454e18){_0x46b832=_0x46b832-0x0;var _0x42b328=_0x6bd7[_0x46b832];return _0x42b328;};'use strict';var _=require(_0x76bd('0x0'));var util=require(_0x76bd('0x1'));var moment=require('moment');var BPromise=require(_0x76bd('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x76bd('0x3'))(_0x76bd('0x4'));exports[_0x76bd('0x5')]=function(_0x1fafb0){var _0x1c1751=this;return new Promise(function(_0x5dd0e9,_0x262e56){return db['CmHopper']['findAll']({'raw':_0x1fafb0['options']?_0x1fafb0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1fafb0[_0x76bd('0x6')]?_0x1fafb0[_0x76bd('0x6')][_0x76bd('0x7')]||null:null,'attributes':_0x1fafb0[_0x76bd('0x6')]?_0x1fafb0[_0x76bd('0x6')][_0x76bd('0x8')]||null:null,'limit':_0x1fafb0[_0x76bd('0x6')]?_0x1fafb0[_0x76bd('0x6')][_0x76bd('0x9')]||null:null,'include':_0x1fafb0[_0x76bd('0x6')]?_0x1fafb0['options'][_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x1fafb0[_0x76bd('0x6')][_0x76bd('0xa')],function(_0x50a773){return{'model':db[_0x50a773[_0x76bd('0xc')]],'as':_0x50a773['as'],'attributes':_0x50a773[_0x76bd('0x8')],'include':_0x50a773[_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x50a773[_0x76bd('0xa')],function(_0x9353da){return{'model':db[_0x9353da[_0x76bd('0xc')]],'as':_0x9353da['as'],'attributes':_0x9353da['attributes'],'include':_0x9353da[_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x9353da[_0x76bd('0xa')],function(_0xee9a1b){return{'model':db[_0xee9a1b[_0x76bd('0xc')]],'as':_0xee9a1b['as'],'attributes':_0xee9a1b['attributes']};}):[]};}):[]};}):[]:[]})[_0x76bd('0xd')](function(_0x32091c){logger[_0x76bd('0xe')]('GetCmHopper',_0x1fafb0);logger[_0x76bd('0xf')]('GetCmHopper',_0x1fafb0,JSON['stringify'](_0x32091c));_0x5dd0e9(_0x32091c);})[_0x76bd('0x10')](function(_0x29b89c){logger['error'](_0x76bd('0x5'),_0x29b89c['message'],_0x1fafb0);_0x262e56(_0x1c1751['error'](0x1f4,_0x29b89c[_0x76bd('0x11')]));});});};exports[_0x76bd('0x12')]=function(_0x2881ab){var _0x17a7c5=this;return new Promise(function(_0x1e6092,_0x1e95c2){return db[_0x76bd('0x13')][_0x76bd('0x14')]({'raw':_0x2881ab[_0x76bd('0x6')]?_0x2881ab[_0x76bd('0x6')][_0x76bd('0x15')]===undefined?!![]:![]:!![],'where':_0x2881ab['options']?_0x2881ab[_0x76bd('0x6')][_0x76bd('0x7')]||null:null,'attributes':_0x2881ab[_0x76bd('0x6')]?_0x2881ab[_0x76bd('0x6')]['attributes']||null:null,'include':_0x2881ab[_0x76bd('0x6')]?_0x2881ab['options'][_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x2881ab['options'][_0x76bd('0xa')],function(_0x49c0df){return{'model':db[_0x49c0df[_0x76bd('0xc')]],'as':_0x49c0df['as'],'attributes':_0x49c0df['attributes'],'include':_0x49c0df[_0x76bd('0xa')]?_['map'](_0x49c0df['include'],function(_0x43e58d){return{'model':db[_0x43e58d[_0x76bd('0xc')]],'as':_0x43e58d['as'],'attributes':_0x43e58d[_0x76bd('0x8')],'include':_0x43e58d['include']?_[_0x76bd('0xb')](_0x43e58d[_0x76bd('0xa')],function(_0x13b619){return{'model':db[_0x13b619[_0x76bd('0xc')]],'as':_0x13b619['as'],'attributes':_0x13b619[_0x76bd('0x8')]};}):[]};}):[]};}):[]:[]})[_0x76bd('0xd')](function(_0x138a9e){logger[_0x76bd('0xe')](_0x76bd('0x12'),_0x2881ab);logger[_0x76bd('0xf')](_0x76bd('0x12'),_0x2881ab,JSON[_0x76bd('0x16')](_0x138a9e));_0x1e6092(_0x138a9e);})[_0x76bd('0x10')](function(_0x5f594f){logger[_0x76bd('0x17')](_0x76bd('0x12'),_0x5f594f[_0x76bd('0x11')],_0x2881ab);_0x1e95c2(_0x17a7c5[_0x76bd('0x17')](0x1f4,_0x5f594f[_0x76bd('0x11')]));});});};exports[_0x76bd('0x18')]=function(_0x432947){var _0x260b0d=this;return new Promise(function(_0x1b774d,_0x5ce0d3){return db['CmHopper']['create'](_0x432947[_0x76bd('0x19')],{'raw':_0x432947[_0x76bd('0x6')]?_0x432947['options']['raw']===undefined?!![]:![]:!![]})[_0x76bd('0xd')](function(_0x523452){logger[_0x76bd('0xe')](_0x76bd('0x18'),_0x432947);logger[_0x76bd('0xf')](_0x76bd('0x18'),_0x432947,JSON[_0x76bd('0x16')](_0x523452));_0x1b774d(_0x523452);})[_0x76bd('0x10')](function(_0x4a3f47){logger[_0x76bd('0x17')]('CreateCmHopper',_0x4a3f47['message'],_0x432947);_0x5ce0d3(_0x260b0d[_0x76bd('0x17')](0x1f4,_0x4a3f47[_0x76bd('0x11')]));});});};exports['UpdateCmHopper']=function(_0x3c9538){var _0x556ba4=this;return new Promise(function(_0x223d5f,_0x4280c7){return db[_0x76bd('0x13')]['update'](_0x3c9538[_0x76bd('0x19')],{'raw':_0x3c9538[_0x76bd('0x6')]?_0x3c9538[_0x76bd('0x6')][_0x76bd('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9538['options']?_0x3c9538[_0x76bd('0x6')][_0x76bd('0x7')]||null:null,'attributes':_0x3c9538[_0x76bd('0x6')]?_0x3c9538[_0x76bd('0x6')][_0x76bd('0x8')]||null:null,'limit':_0x3c9538['options']?_0x3c9538[_0x76bd('0x6')]['limit']||null:null})[_0x76bd('0xd')](function(_0x3543f0){logger[_0x76bd('0xe')](_0x76bd('0x1a'),_0x3c9538);logger[_0x76bd('0xe')](_0x76bd('0x1b'),JSON[_0x76bd('0x16')](_0x3c9538[_0x76bd('0x6')][_0x76bd('0x7')]),_0x3c9538[_0x76bd('0x19')]['active']);logger[_0x76bd('0xf')]('UpdateCmHopper',_0x3c9538,JSON[_0x76bd('0x16')](_0x3543f0));_0x223d5f(_0x3543f0);})['catch'](function(_0xf88b63){logger['error'](_0x76bd('0x1a'),_0xf88b63['message'],_0x3c9538);_0x4280c7(_0x556ba4[_0x76bd('0x17')](0x1f4,_0xf88b63[_0x76bd('0x11')]));});});};exports['DestroyCmHopper']=function(_0x2ce38b){var _0x2296fc=this;return new Promise(function(_0x10bc1c,_0x59e2a4){return db[_0x76bd('0x13')]['destroy']({'where':_0x2ce38b[_0x76bd('0x6')]?_0x2ce38b['options']['where']||null:null})[_0x76bd('0xd')](function(_0x3aa469){logger[_0x76bd('0xe')](_0x76bd('0x1c'),_0x2ce38b);logger[_0x76bd('0xf')](_0x76bd('0x1c'),_0x2ce38b,JSON['stringify'](_0x3aa469));_0x10bc1c(_0x3aa469);})['catch'](function(_0x3460ef){logger[_0x76bd('0x17')](_0x76bd('0x1c'),_0x3460ef[_0x76bd('0x11')],_0x2ce38b);_0x59e2a4(_0x2296fc[_0x76bd('0x17')](0x1f4,_0x3460ef[_0x76bd('0x11')]));});});};exports[_0x76bd('0x1d')]=function(_0x4d496f){var _0x4d7c2c=this;return new Promise(function(_0x502d11,_0x4b4a80){return db[_0x76bd('0x1e')][_0x76bd('0x1f')]()[_0x76bd('0xd')](function(_0x24b97d){return db[_0x76bd('0x20')][_0x76bd('0x21')](function(_0x2edf64){return db[_0x76bd('0x13')]['findAll']({'where':_0x4d496f[_0x76bd('0x6')]?_0x4d496f[_0x76bd('0x6')][_0x76bd('0x7')]||null:null,'attributes':_0x4d496f[_0x76bd('0x6')]?_0x4d496f['options'][_0x76bd('0x8')]||null:null,'limit':_0x4d496f[_0x76bd('0x6')]?_0x4d496f[_0x76bd('0x6')][_0x76bd('0x9')]||null:null,'order':_0x4d496f[_0x76bd('0x6')]?_0x4d496f[_0x76bd('0x6')][_0x76bd('0x22')]||null:null,'transaction':_0x2edf64,'lock':_0x2edf64[_0x76bd('0x23')]['UPDATE'],'include':[{'model':db[_0x76bd('0x1e')],'as':_0x76bd('0x24'),'attributes':_[_0x76bd('0x25')](_0x24b97d)},{'model':db[_0x76bd('0x26')],'as':'Agent','attributes':['id','name',_0x76bd('0x27')]}]})['then'](function(_0x2fc5ba){var _0x463019=[];var _0x176a4b=[];for(var _0xd3e383=0x0;_0xd3e383<_0x2fc5ba[_0x76bd('0x28')];_0xd3e383+=0x1){var _0x1ff4f2=_0x2fc5ba[_0xd3e383]['UserId'];if(_0x1ff4f2===null){_0x463019['push'](_0x2fc5ba[_0xd3e383][_0x76bd('0x29')](_0x4d496f[_0x76bd('0x19')],{'transaction':_0x2edf64}));}else if(!_0x176a4b[_0x76bd('0x2a')](_0x1ff4f2)){_0x176a4b[_0x76bd('0x2b')](_0x1ff4f2);_0x463019[_0x76bd('0x2b')](_0x2fc5ba[_0xd3e383][_0x76bd('0x29')](_0x4d496f[_0x76bd('0x19')],{'transaction':_0x2edf64}));}}return BPromise['all'](_0x463019);});})[_0x76bd('0xd')](function(_0x235684){logger[_0x76bd('0xe')](_0x76bd('0x1d'),_0x4d496f);if(_0x235684[_0x76bd('0x28')]>0x0){logger['info'](_0x76bd('0x2c'),_0x235684[0x0]['dataValues']['id'],_0x235684[0x0][_0x76bd('0x2d')][_0x76bd('0x2e')],_0x235684[0x0][_0x76bd('0x2d')]['active']);}logger[_0x76bd('0xf')](_0x76bd('0x1d'),_0x4d496f,JSON['stringify'](_0x235684));_0x502d11(_0x235684);})[_0x76bd('0x10')](function(_0x4ed770){logger[_0x76bd('0x17')](_0x76bd('0x1d'),_0x4ed770[_0x76bd('0x11')],_0x4d496f);_0x4b4a80(_0x4d7c2c[_0x76bd('0x17')](0x1f4,_0x4ed770['message']));});});});};exports['MoveContactManagedDialer']=function(_0x2cf83c){var _0x5dfb06=this;return new Promise(function(_0x2e7b7c,_0x35cc71){return db[_0x76bd('0x20')][_0x76bd('0x21')](function(_0x1b66dd){return db[_0x76bd('0x2f')][_0x76bd('0x30')](_0x2cf83c[_0x76bd('0x19')],{'raw':_0x2cf83c[_0x76bd('0x6')]?_0x2cf83c['options'][_0x76bd('0x15')]===undefined?!![]:![]:!![],'transaction':_0x1b66dd})[_0x76bd('0xd')](function(){logger[_0x76bd('0xe')](_0x76bd('0x31'),JSON[_0x76bd('0x16')](_0x2cf83c[_0x76bd('0x6')][_0x76bd('0x7')]),_0x2cf83c[_0x76bd('0x6')]['where'][_0x76bd('0x32')]);return db[_0x76bd('0x13')][_0x76bd('0x33')]({'where':_0x2cf83c[_0x76bd('0x6')]?_0x2cf83c[_0x76bd('0x6')]['where']||null:null,'transaction':_0x1b66dd});});})[_0x76bd('0xd')](function(_0x20db02){logger[_0x76bd('0xe')](_0x76bd('0x34'),_0x2cf83c);logger[_0x76bd('0xf')](_0x76bd('0x34'),_0x2cf83c,JSON[_0x76bd('0x16')](_0x20db02));_0x2e7b7c(_0x20db02);})[_0x76bd('0x10')](function(_0x3c6620){logger['error']('MoveContactManagedDialer',_0x3c6620[_0x76bd('0x11')],_0x2cf83c);_0x35cc71(_0x5dfb06[_0x76bd('0x17')](0x1f4,_0x3c6620[_0x76bd('0x11')]));});});};exports[_0x76bd('0x35')]=function(_0x36c3d9){var _0x5b954a=this;return new Promise(function(_0x1e2776,_0x14d38e){return db['CmHopper']['findAll']({'raw':_0x36c3d9['options']?_0x36c3d9[_0x76bd('0x6')][_0x76bd('0x15')]===undefined?!![]:![]:!![],'where':_0x36c3d9['options']?_0x36c3d9[_0x76bd('0x6')][_0x76bd('0x7')]||null:null,'attributes':[[db['sequelize']['fn'](_0x76bd('0x36'),db[_0x76bd('0x20')]['fn']('IF',db[_0x76bd('0x20')][_0x76bd('0x37')](_0x76bd('0x38')+util['format'](_0x76bd('0x39'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x76bd('0x3a')))),'contactsRescheduled']]})[_0x76bd('0xd')](function(_0x16c5d2){logger[_0x76bd('0xe')](_0x76bd('0x35'),_0x36c3d9);logger['debug'](_0x76bd('0x35'),_0x36c3d9,JSON[_0x76bd('0x16')](_0x16c5d2));_0x1e2776(_0x16c5d2);})[_0x76bd('0x10')](function(_0x27582f){logger[_0x76bd('0x17')](_0x76bd('0x35'),_0x27582f[_0x76bd('0x11')],_0x36c3d9);_0x14d38e(_0x5b954a[_0x76bd('0x17')](0x1f4,_0x27582f[_0x76bd('0x11')]));});});};exports[_0x76bd('0x3b')]=function(_0x28cf48){var _0x21b8fd=this;return new Promise(function(_0xec0bf2,_0x5cd0b0){return db[_0x76bd('0x1e')][_0x76bd('0x1f')]()[_0x76bd('0xd')](function(){return db[_0x76bd('0x20')][_0x76bd('0x21')](function(_0x5cf2d6){return db['CmHopper'][_0x76bd('0x3c')]({'where':_0x28cf48[_0x76bd('0x6')]?_0x28cf48[_0x76bd('0x6')][_0x76bd('0x7')]||null:null,'attributes':_0x28cf48[_0x76bd('0x6')]?_0x28cf48[_0x76bd('0x6')]['attributes']||null:null,'limit':0x1,'order':_0x28cf48[_0x76bd('0x6')]?_0x28cf48[_0x76bd('0x6')][_0x76bd('0x22')]||null:null,'group':db[_0x76bd('0x13')]['UserId'],'transaction':_0x5cf2d6,'lock':_0x5cf2d6[_0x76bd('0x23')][_0x76bd('0x3d')],'include':_0x28cf48[_0x76bd('0x6')]?_0x28cf48[_0x76bd('0x6')][_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x28cf48[_0x76bd('0x6')][_0x76bd('0xa')],function(_0x34a37d){return{'model':db[_0x34a37d['model']],'as':_0x34a37d['as'],'attributes':_0x34a37d[_0x76bd('0x8')],'include':_0x34a37d[_0x76bd('0xa')]?_['map'](_0x34a37d['include'],function(_0x116102){return{'model':db[_0x116102['model']],'as':_0x116102['as'],'attributes':_0x116102['attributes'],'include':_0x116102[_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x116102[_0x76bd('0xa')],function(_0x4fa1cf){return{'model':db[_0x4fa1cf[_0x76bd('0xc')]],'as':_0x4fa1cf['as'],'attributes':_0x4fa1cf[_0x76bd('0x8')]};}):[]};}):[]};}):[]:[]})[_0x76bd('0xd')](function(_0x568a8b){var _0xff70cb=[];for(var _0x4dee8e=0x0;_0x4dee8e<_0x568a8b[_0x76bd('0x28')];_0x4dee8e+=0x1){_0xff70cb[_0x76bd('0x2b')](_0x568a8b[_0x4dee8e]['update'](_0x28cf48[_0x76bd('0x19')],{'transaction':_0x5cf2d6}));}return BPromise[_0x76bd('0x3e')](_0xff70cb);});})[_0x76bd('0xd')](function(_0x270b61){logger[_0x76bd('0xe')](_0x76bd('0x3b'),_0x28cf48);logger[_0x76bd('0xf')](_0x76bd('0x3b'),_0x28cf48,JSON['stringify'](_0x270b61));_0xec0bf2(_0x270b61);})['catch'](function(_0x103dea){logger[_0x76bd('0x17')](_0x76bd('0x3b'),_0x103dea[_0x76bd('0x11')],_0x28cf48);_0x5cd0b0(_0x21b8fd[_0x76bd('0x17')](0x1f4,_0x103dea['message']));});});});};exports[_0x76bd('0x3f')]=function(_0x2f0068){var _0x1d8e46=this;return new Promise(function(_0x44913e,_0xd485ba){db[_0x76bd('0x1e')][_0x76bd('0x1f')]()[_0x76bd('0xd')](function(_0x51c9b8){return db['CmHopper'][_0x76bd('0x3c')]({'raw':_0x2f0068[_0x76bd('0x6')]?_0x2f0068[_0x76bd('0x6')][_0x76bd('0x15')]===undefined?!![]:![]:!![],'where':_0x2f0068[_0x76bd('0x6')]?_0x2f0068['options']['where']||null:null,'attributes':_0x2f0068[_0x76bd('0x6')]?_0x2f0068[_0x76bd('0x6')][_0x76bd('0x8')]||null:null,'limit':_0x2f0068[_0x76bd('0x6')]?_0x2f0068[_0x76bd('0x6')][_0x76bd('0x9')]||null:null,'include':_0x2f0068['options']?_0x2f0068[_0x76bd('0x6')][_0x76bd('0xa')]?_['map'](_0x2f0068[_0x76bd('0x6')]['include'],function(_0x2ae70e){return{'model':db[_0x2ae70e[_0x76bd('0xc')]],'as':_0x2ae70e['as'],'attributes':_0x2ae70e['as']==='Contact'?_['keys'](_0x51c9b8):_0x2ae70e[_0x76bd('0x8')],'include':_0x2ae70e[_0x76bd('0xa')]?_[_0x76bd('0xb')](_0x2ae70e[_0x76bd('0xa')],function(_0x1f229c){return{'model':db[_0x1f229c[_0x76bd('0xc')]],'as':_0x1f229c['as'],'attributes':_0x1f229c[_0x76bd('0x8')],'include':_0x1f229c['include']?_[_0x76bd('0xb')](_0x1f229c['include'],function(_0x536d75){return{'model':db[_0x536d75[_0x76bd('0xc')]],'as':_0x536d75['as'],'attributes':_0x536d75[_0x76bd('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc9e8){logger['info']('GetCmHopper',_0x2f0068);logger['debug']('GetCmHopper',_0x2f0068,JSON[_0x76bd('0x16')](_0x3dc9e8));_0x44913e(_0x3dc9e8);})[_0x76bd('0x10')](function(_0x305af9){logger[_0x76bd('0x17')](_0x76bd('0x5'),_0x305af9['message'],_0x2f0068);_0xd485ba(_0x1d8e46['error'](0x1f4,_0x305af9['message']));});});});};exports[_0x76bd('0x40')]=function(_0x1f8eb9){var _0x69fe33=this;return new Promise(function(_0x1adca4,_0x835410){return db[_0x76bd('0x1e')][_0x76bd('0x41')]({'raw':!![],'where':{'phone':_0x1f8eb9[_0x76bd('0x6')][_0x76bd('0x7')]['phone']},'attributes':['id',_0x76bd('0x42')],'order':[['id',_0x76bd('0x43')]]})[_0x76bd('0xd')](function(_0x186bb4){logger['info'](_0x76bd('0x44'),_0x1f8eb9);logger[_0x76bd('0xf')](_0x76bd('0x44'),_0x1f8eb9,JSON['stringify'](_0x186bb4));_0x1adca4(_0x186bb4);})[_0x76bd('0x10')](function(_0x71ef19){logger[_0x76bd('0x17')](_0x76bd('0x44'),_0x71ef19[_0x76bd('0x11')],_0x1f8eb9);_0x835410(_0x69fe33['error'](0x1f4,_0x71ef19[_0x76bd('0x11')]));});});};exports[_0x76bd('0x45')]=function(_0x297f03){var _0x2d7fd4=this;return new Promise(function(_0x1258be,_0x141712){return db[_0x76bd('0x20')]['transaction'](function(_0x267ff3){var _0x4a15f9=_0x297f03[_0x76bd('0x6')]&&_0x297f03[_0x76bd('0x6')][_0x76bd('0x7')]?_0x297f03[_0x76bd('0x6')][_0x76bd('0x7')]:{};return db[_0x76bd('0x13')][_0x76bd('0x29')](_0x297f03['body'],{'where':_0x4a15f9,'transaction':_0x267ff3})[_0x76bd('0xd')](function(_0x11c949){logger[_0x76bd('0xe')](_0x76bd('0x45'),_0x297f03);logger[_0x76bd('0xf')](_0x76bd('0x45'),_0x297f03,JSON[_0x76bd('0x16')](_0x11c949));_0x1258be(_0x11c949);})[_0x76bd('0x10')](function(_0x8ad67c){logger[_0x76bd('0x17')](_0x76bd('0x45'),_0x8ad67c[_0x76bd('0x11')],_0x297f03);_0x141712(_0x2d7fd4[_0x76bd('0x17')](0x1f4,_0x8ad67c[_0x76bd('0x11')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x368ea3){var _0x1db16f=this;var _0x3559c4=_0x368ea3[_0x76bd('0x19')][_0x76bd('0x7')]['voiceQueueIds'];var _0x5a999c=_0x368ea3[_0x76bd('0x19')][_0x76bd('0x7')][_0x76bd('0x46')];var _0x5af4c6=_0x368ea3[_0x76bd('0x19')][_0x76bd('0x7')]['availableAgentsIds'];return new Promise(function(_0x4a0beb,_0x5cf1af){return db[_0x76bd('0x13')][_0x76bd('0x3c')]({'where':{'voiceQueueId':{'$in':_0x3559c4},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x76bd('0x20')][_0x76bd('0x37')](_0x76bd('0x47')+_0x5a999c+_0x76bd('0x48')),'$gt':db['sequelize'][_0x76bd('0x37')](_0x76bd('0x49'))}},'UserId':{'$in':_0x5af4c6}},'include':[{'model':db[_0x76bd('0x1e')],'as':_0x76bd('0x24')},{'model':db['User'],'as':_0x76bd('0x4a'),'attributes':['id',_0x76bd('0x4b'),_0x76bd('0x27')]},{'model':db[_0x76bd('0x4c')],'as':'List'}]})[_0x76bd('0xd')](function(_0x2a7f67){if(_0x2a7f67[_0x76bd('0x28')]>0x0){return db[_0x76bd('0x20')][_0x76bd('0x21')](function(_0x201485){return db[_0x76bd('0x13')]['update']({'recallmeNotifiedDate':db[_0x76bd('0x20')][_0x76bd('0x37')]('NOW()')},{'where':{'id':{'$in':_[_0x76bd('0xb')](_0x2a7f67,'id')}},'transaction':_0x201485})[_0x76bd('0xd')](function(){_0x4a0beb(_0x2a7f67);})['catch'](function(_0x58d97d){logger[_0x76bd('0x17')](_0x76bd('0x4d'),_0x58d97d[_0x76bd('0x11')],_0x368ea3);_0x5cf1af(_0x1db16f[_0x76bd('0x17')](0x1f4,_0x58d97d[_0x76bd('0x11')]));});})[_0x76bd('0x10')](function(_0x1ba13e){logger[_0x76bd('0x17')]('CmHopperHandlePreviewRecallNotifications',_0x1ba13e[_0x76bd('0x11')],_0x368ea3);_0x5cf1af(_0x1db16f['error'](0x1f4,_0x1ba13e[_0x76bd('0x11')]));});}else{_0x4a0beb(_0x2a7f67);}});});}; \ No newline at end of file +var _0x8b00=['order','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','CreateCmHopper','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','LOCK','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe'];(function(_0x52b2ea,_0x29442f){var _0x452c6e=function(_0x1f0f3c){while(--_0x1f0f3c){_0x52b2ea['push'](_0x52b2ea['shift']());}};_0x452c6e(++_0x29442f);}(_0x8b00,0x100));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x08b0('0x0'));var moment=require(_0x08b0('0x1'));var BPromise=require(_0x08b0('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x08b0('0x3'))(_0x08b0('0x4'));exports[_0x08b0('0x5')]=function(_0x5bae3c){var _0x418ef0=this;return new Promise(function(_0x48ea10,_0x4e9f32){return db[_0x08b0('0x6')][_0x08b0('0x7')]({'raw':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0x9')]===undefined?!![]:![]:!![],'where':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c['options'][_0x08b0('0xa')]||null:null,'attributes':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'limit':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xc')]||null:null,'include':_0x5bae3c[_0x08b0('0x8')]?_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xd')]?_['map'](_0x5bae3c[_0x08b0('0x8')][_0x08b0('0xd')],function(_0x33f1c3){return{'model':db[_0x33f1c3[_0x08b0('0xe')]],'as':_0x33f1c3['as'],'attributes':_0x33f1c3['attributes'],'include':_0x33f1c3[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x33f1c3[_0x08b0('0xd')],function(_0x1f6b5f){return{'model':db[_0x1f6b5f[_0x08b0('0xe')]],'as':_0x1f6b5f['as'],'attributes':_0x1f6b5f[_0x08b0('0xb')],'include':_0x1f6b5f['include']?_['map'](_0x1f6b5f[_0x08b0('0xd')],function(_0x5b8de9){return{'model':db[_0x5b8de9[_0x08b0('0xe')]],'as':_0x5b8de9['as'],'attributes':_0x5b8de9[_0x08b0('0xb')]};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x1fc578){logger[_0x08b0('0x11')](_0x08b0('0x5'),_0x5bae3c);logger[_0x08b0('0x12')](_0x08b0('0x5'),_0x5bae3c,JSON[_0x08b0('0x13')](_0x1fc578));_0x48ea10(_0x1fc578);})[_0x08b0('0x14')](function(_0x3bbed7){logger['error'](_0x08b0('0x5'),_0x3bbed7[_0x08b0('0x15')],_0x5bae3c);_0x4e9f32(_0x418ef0[_0x08b0('0x16')](0x1f4,_0x3bbed7[_0x08b0('0x15')]));});});};exports[_0x08b0('0x17')]=function(_0xe68c88){var _0x2c96c8=this;return new Promise(function(_0x19f6be,_0x27b43a){return db[_0x08b0('0x6')][_0x08b0('0x18')]({'raw':_0xe68c88[_0x08b0('0x8')]?_0xe68c88['options'][_0x08b0('0x9')]===undefined?!![]:![]:!![],'where':_0xe68c88[_0x08b0('0x8')]?_0xe68c88['options']['where']||null:null,'attributes':_0xe68c88[_0x08b0('0x8')]?_0xe68c88[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'include':_0xe68c88['options']?_0xe68c88[_0x08b0('0x8')][_0x08b0('0xd')]?_[_0x08b0('0xf')](_0xe68c88[_0x08b0('0x8')]['include'],function(_0x20fbe2){return{'model':db[_0x20fbe2[_0x08b0('0xe')]],'as':_0x20fbe2['as'],'attributes':_0x20fbe2[_0x08b0('0xb')],'include':_0x20fbe2[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x20fbe2[_0x08b0('0xd')],function(_0x14df7a){return{'model':db[_0x14df7a[_0x08b0('0xe')]],'as':_0x14df7a['as'],'attributes':_0x14df7a[_0x08b0('0xb')],'include':_0x14df7a[_0x08b0('0xd')]?_['map'](_0x14df7a['include'],function(_0xf3508b){return{'model':db[_0xf3508b['model']],'as':_0xf3508b['as'],'attributes':_0xf3508b[_0x08b0('0xb')]};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x4fcfb0){logger[_0x08b0('0x11')](_0x08b0('0x17'),_0xe68c88);logger[_0x08b0('0x12')](_0x08b0('0x17'),_0xe68c88,JSON[_0x08b0('0x13')](_0x4fcfb0));_0x19f6be(_0x4fcfb0);})['catch'](function(_0x134ec8){logger[_0x08b0('0x16')](_0x08b0('0x17'),_0x134ec8[_0x08b0('0x15')],_0xe68c88);_0x27b43a(_0x2c96c8[_0x08b0('0x16')](0x1f4,_0x134ec8['message']));});});};exports[_0x08b0('0x19')]=function(_0x20892d){var _0xad8561=this;return new Promise(function(_0x4df42c,_0x3d63de){return db[_0x08b0('0x6')]['create'](_0x20892d[_0x08b0('0x1a')],{'raw':_0x20892d[_0x08b0('0x8')]?_0x20892d[_0x08b0('0x8')][_0x08b0('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x49da7f){logger[_0x08b0('0x11')](_0x08b0('0x19'),_0x20892d);logger[_0x08b0('0x12')](_0x08b0('0x19'),_0x20892d,JSON['stringify'](_0x49da7f));_0x4df42c(_0x49da7f);})[_0x08b0('0x14')](function(_0x1dbda9){logger['error'](_0x08b0('0x19'),_0x1dbda9[_0x08b0('0x15')],_0x20892d);_0x3d63de(_0xad8561[_0x08b0('0x16')](0x1f4,_0x1dbda9[_0x08b0('0x15')]));});});};exports['UpdateCmHopper']=function(_0x1b6b27){var _0x447aca=this;return new Promise(function(_0x2771d8,_0xc41a41){return db[_0x08b0('0x6')][_0x08b0('0x1b')](_0x1b6b27[_0x08b0('0x1a')],{'raw':_0x1b6b27[_0x08b0('0x8')]?_0x1b6b27[_0x08b0('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b6b27['options']?_0x1b6b27['options'][_0x08b0('0xa')]||null:null,'attributes':_0x1b6b27[_0x08b0('0x8')]?_0x1b6b27[_0x08b0('0x8')]['attributes']||null:null,'limit':_0x1b6b27[_0x08b0('0x8')]?_0x1b6b27[_0x08b0('0x8')][_0x08b0('0xc')]||null:null})[_0x08b0('0x10')](function(_0x3bfd58){logger[_0x08b0('0x11')](_0x08b0('0x1c'),_0x1b6b27);logger[_0x08b0('0x11')](_0x08b0('0x1d'),JSON['stringify'](_0x1b6b27[_0x08b0('0x8')][_0x08b0('0xa')]),_0x1b6b27['body'][_0x08b0('0x1e')]);logger[_0x08b0('0x12')](_0x08b0('0x1c'),_0x1b6b27,JSON[_0x08b0('0x13')](_0x3bfd58));_0x2771d8(_0x3bfd58);})[_0x08b0('0x14')](function(_0x4d83de){logger[_0x08b0('0x16')]('UpdateCmHopper',_0x4d83de['message'],_0x1b6b27);_0xc41a41(_0x447aca[_0x08b0('0x16')](0x1f4,_0x4d83de['message']));});});};exports[_0x08b0('0x1f')]=function(_0x47e3b5){var _0x15e56f=this;return new Promise(function(_0x58e021,_0x2333fe){return db['CmHopper'][_0x08b0('0x20')]({'where':_0x47e3b5[_0x08b0('0x8')]?_0x47e3b5['options'][_0x08b0('0xa')]||null:null})[_0x08b0('0x10')](function(_0xf400c8){logger[_0x08b0('0x11')]('DestroyCmHopper',_0x47e3b5);logger[_0x08b0('0x12')]('DestroyCmHopper',_0x47e3b5,JSON[_0x08b0('0x13')](_0xf400c8));_0x58e021(_0xf400c8);})[_0x08b0('0x14')](function(_0x22e9d3){logger[_0x08b0('0x16')]('DestroyCmHopper',_0x22e9d3[_0x08b0('0x15')],_0x47e3b5);_0x2333fe(_0x15e56f['error'](0x1f4,_0x22e9d3[_0x08b0('0x15')]));});});};exports['GetContactDialer']=function(_0x5bcfd8){var _0x5e0cb0=this;return new Promise(function(_0x3fbac1,_0x1e2911){return db[_0x08b0('0x21')][_0x08b0('0x22')]()[_0x08b0('0x10')](function(_0x30acdd){return db[_0x08b0('0x23')][_0x08b0('0x24')](function(_0x513251){return db['CmHopper']['findAll']({'where':_0x5bcfd8[_0x08b0('0x8')]?_0x5bcfd8[_0x08b0('0x8')]['where']||null:null,'attributes':_0x5bcfd8[_0x08b0('0x8')]?_0x5bcfd8[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'limit':_0x5bcfd8['options']?_0x5bcfd8[_0x08b0('0x8')][_0x08b0('0xc')]||null:null,'order':_0x5bcfd8['options']?_0x5bcfd8[_0x08b0('0x8')]['order']||null:null,'transaction':_0x513251,'lock':_0x513251[_0x08b0('0x25')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x08b0('0x26'),'attributes':_[_0x08b0('0x27')](_0x30acdd)},{'model':db[_0x08b0('0x28')],'as':_0x08b0('0x29'),'attributes':['id',_0x08b0('0x2a'),_0x08b0('0x2b')]}]})[_0x08b0('0x10')](function(_0x28f4b1){var _0x4b756f=[];var _0x263aeb=[];for(var _0x56bb4a=0x0;_0x56bb4a<_0x28f4b1['length'];_0x56bb4a+=0x1){var _0x3ca2fd=_0x28f4b1[_0x56bb4a][_0x08b0('0x2c')];if(_0x3ca2fd===null){_0x4b756f[_0x08b0('0x2d')](_0x28f4b1[_0x56bb4a][_0x08b0('0x1b')](_0x5bcfd8[_0x08b0('0x1a')],{'transaction':_0x513251}));}else if(!_0x263aeb[_0x08b0('0x2e')](_0x3ca2fd)){_0x263aeb[_0x08b0('0x2d')](_0x3ca2fd);_0x4b756f[_0x08b0('0x2d')](_0x28f4b1[_0x56bb4a][_0x08b0('0x1b')](_0x5bcfd8[_0x08b0('0x1a')],{'transaction':_0x513251}));}}return BPromise[_0x08b0('0x2f')](_0x4b756f);});})[_0x08b0('0x10')](function(_0xa39839){logger[_0x08b0('0x11')](_0x08b0('0x30'),_0x5bcfd8);if(_0xa39839[_0x08b0('0x31')]>0x0){logger[_0x08b0('0x11')](_0x08b0('0x32'),_0xa39839[0x0][_0x08b0('0x33')]['id'],_0xa39839[0x0][_0x08b0('0x33')][_0x08b0('0x34')],_0xa39839[0x0][_0x08b0('0x33')][_0x08b0('0x1e')]);}logger[_0x08b0('0x12')]('GetContactDialer',_0x5bcfd8,JSON[_0x08b0('0x13')](_0xa39839));_0x3fbac1(_0xa39839);})[_0x08b0('0x14')](function(_0xc2026f){logger['error'](_0x08b0('0x30'),_0xc2026f[_0x08b0('0x15')],_0x5bcfd8);_0x1e2911(_0x5e0cb0[_0x08b0('0x16')](0x1f4,_0xc2026f[_0x08b0('0x15')]));});});});};exports[_0x08b0('0x35')]=function(_0x56e62c){var _0x190a7b=this;return new Promise(function(_0x361bbe,_0x1c25da){return db[_0x08b0('0x23')]['transaction'](function(_0x363166){return db[_0x08b0('0x36')][_0x08b0('0x37')](_0x56e62c['body'],{'raw':_0x56e62c[_0x08b0('0x8')]?_0x56e62c[_0x08b0('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x363166})[_0x08b0('0x10')](function(){logger[_0x08b0('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x08b0('0x13')](_0x56e62c[_0x08b0('0x8')][_0x08b0('0xa')]),_0x56e62c['options'][_0x08b0('0xa')][_0x08b0('0x1e')]);return db[_0x08b0('0x6')][_0x08b0('0x20')]({'where':_0x56e62c['options']?_0x56e62c[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'transaction':_0x363166});});})[_0x08b0('0x10')](function(_0x51ed4e){logger['info'](_0x08b0('0x35'),_0x56e62c);logger[_0x08b0('0x12')](_0x08b0('0x35'),_0x56e62c,JSON['stringify'](_0x51ed4e));_0x361bbe(_0x51ed4e);})[_0x08b0('0x14')](function(_0x26d348){logger[_0x08b0('0x16')](_0x08b0('0x35'),_0x26d348['message'],_0x56e62c);_0x1c25da(_0x190a7b[_0x08b0('0x16')](0x1f4,_0x26d348[_0x08b0('0x15')]));});});};exports['CountReScheduled']=function(_0x195194){var _0x5f220e=this;return new Promise(function(_0x47db85,_0xa362f){return db[_0x08b0('0x6')]['findAll']({'raw':_0x195194[_0x08b0('0x8')]?_0x195194[_0x08b0('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x195194['options']?_0x195194[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'attributes':[[db[_0x08b0('0x23')]['fn'](_0x08b0('0x38'),db[_0x08b0('0x23')]['fn']('IF',db[_0x08b0('0x23')][_0x08b0('0x39')](_0x08b0('0x3a')+util[_0x08b0('0x3b')](_0x08b0('0x3c'),moment()[_0x08b0('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x08b0('0x3d')))),'contactsRescheduled']]})[_0x08b0('0x10')](function(_0x2e45b8){logger[_0x08b0('0x11')](_0x08b0('0x3e'),_0x195194);logger['debug'](_0x08b0('0x3e'),_0x195194,JSON[_0x08b0('0x13')](_0x2e45b8));_0x47db85(_0x2e45b8);})[_0x08b0('0x14')](function(_0x455a03){logger['error'](_0x08b0('0x3e'),_0x455a03[_0x08b0('0x15')],_0x195194);_0xa362f(_0x5f220e['error'](0x1f4,_0x455a03['message']));});});};exports[_0x08b0('0x3f')]=function(_0x450211){var _0x29e39e=this;return new Promise(function(_0x4db0c6,_0x224f56){return db['CmContact'][_0x08b0('0x22')]()[_0x08b0('0x10')](function(){return db[_0x08b0('0x23')][_0x08b0('0x24')](function(_0x322474){return db[_0x08b0('0x6')][_0x08b0('0x7')]({'where':_0x450211[_0x08b0('0x8')]?_0x450211[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'attributes':_0x450211['options']?_0x450211[_0x08b0('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x450211[_0x08b0('0x8')]?_0x450211['options'][_0x08b0('0x40')]||null:null,'group':db[_0x08b0('0x6')][_0x08b0('0x2c')],'transaction':_0x322474,'lock':_0x322474[_0x08b0('0x25')][_0x08b0('0x41')],'include':_0x450211[_0x08b0('0x8')]?_0x450211['options'][_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x450211[_0x08b0('0x8')]['include'],function(_0x2fa2f7){return{'model':db[_0x2fa2f7[_0x08b0('0xe')]],'as':_0x2fa2f7['as'],'attributes':_0x2fa2f7['attributes'],'include':_0x2fa2f7[_0x08b0('0xd')]?_['map'](_0x2fa2f7[_0x08b0('0xd')],function(_0x1a8b60){return{'model':db[_0x1a8b60[_0x08b0('0xe')]],'as':_0x1a8b60['as'],'attributes':_0x1a8b60['attributes'],'include':_0x1a8b60[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x1a8b60[_0x08b0('0xd')],function(_0x36b928){return{'model':db[_0x36b928[_0x08b0('0xe')]],'as':_0x36b928['as'],'attributes':_0x36b928[_0x08b0('0xb')]};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x215e2b){var _0x15364f=[];for(var _0x5e3204=0x0;_0x5e3204<_0x215e2b['length'];_0x5e3204+=0x1){_0x15364f[_0x08b0('0x2d')](_0x215e2b[_0x5e3204]['update'](_0x450211[_0x08b0('0x1a')],{'transaction':_0x322474}));}return BPromise[_0x08b0('0x2f')](_0x15364f);});})[_0x08b0('0x10')](function(_0x566172){logger[_0x08b0('0x11')](_0x08b0('0x3f'),_0x450211);logger[_0x08b0('0x12')](_0x08b0('0x3f'),_0x450211,JSON[_0x08b0('0x13')](_0x566172));_0x4db0c6(_0x566172);})['catch'](function(_0x3866f1){logger[_0x08b0('0x16')]('GetContactRecallMe',_0x3866f1[_0x08b0('0x15')],_0x450211);_0x224f56(_0x29e39e[_0x08b0('0x16')](0x1f4,_0x3866f1[_0x08b0('0x15')]));});});});};exports[_0x08b0('0x42')]=function(_0x10a87b){var _0x2aec93=this;return new Promise(function(_0x352b6f,_0x3f34c7){db['CmContact'][_0x08b0('0x22')]()[_0x08b0('0x10')](function(_0x3f1935){return db[_0x08b0('0x6')]['findAll']({'raw':_0x10a87b[_0x08b0('0x8')]?_0x10a87b[_0x08b0('0x8')][_0x08b0('0x9')]===undefined?!![]:![]:!![],'where':_0x10a87b[_0x08b0('0x8')]?_0x10a87b[_0x08b0('0x8')][_0x08b0('0xa')]||null:null,'attributes':_0x10a87b[_0x08b0('0x8')]?_0x10a87b[_0x08b0('0x8')][_0x08b0('0xb')]||null:null,'limit':_0x10a87b['options']?_0x10a87b[_0x08b0('0x8')][_0x08b0('0xc')]||null:null,'include':_0x10a87b['options']?_0x10a87b[_0x08b0('0x8')]['include']?_['map'](_0x10a87b[_0x08b0('0x8')][_0x08b0('0xd')],function(_0x318e1e){return{'model':db[_0x318e1e[_0x08b0('0xe')]],'as':_0x318e1e['as'],'attributes':_0x318e1e['as']===_0x08b0('0x26')?_[_0x08b0('0x27')](_0x3f1935):_0x318e1e[_0x08b0('0xb')],'include':_0x318e1e['include']?_[_0x08b0('0xf')](_0x318e1e[_0x08b0('0xd')],function(_0x2578f0){return{'model':db[_0x2578f0[_0x08b0('0xe')]],'as':_0x2578f0['as'],'attributes':_0x2578f0['attributes'],'include':_0x2578f0[_0x08b0('0xd')]?_[_0x08b0('0xf')](_0x2578f0[_0x08b0('0xd')],function(_0x212d55){return{'model':db[_0x212d55['model']],'as':_0x212d55['as'],'attributes':_0x212d55['attributes']};}):[]};}):[]};}):[]:[]})[_0x08b0('0x10')](function(_0x104597){logger[_0x08b0('0x11')](_0x08b0('0x5'),_0x10a87b);logger[_0x08b0('0x12')](_0x08b0('0x5'),_0x10a87b,JSON[_0x08b0('0x13')](_0x104597));_0x352b6f(_0x104597);})[_0x08b0('0x14')](function(_0xe276d2){logger['error'](_0x08b0('0x5'),_0xe276d2[_0x08b0('0x15')],_0x10a87b);_0x3f34c7(_0x2aec93['error'](0x1f4,_0xe276d2[_0x08b0('0x15')]));});});});};exports[_0x08b0('0x43')]=function(_0x4fa25c){var _0x29bd33=this;return new Promise(function(_0x355edf,_0x460091){return db[_0x08b0('0x21')][_0x08b0('0x44')]({'raw':!![],'where':{'phone':_0x4fa25c[_0x08b0('0x8')]['where']['phone']},'attributes':['id',_0x08b0('0x45')],'order':[['id',_0x08b0('0x46')]]})[_0x08b0('0x10')](function(_0x1aa8a0){logger[_0x08b0('0x11')](_0x08b0('0x47'),_0x4fa25c);logger['debug'](_0x08b0('0x47'),_0x4fa25c,JSON[_0x08b0('0x13')](_0x1aa8a0));_0x355edf(_0x1aa8a0);})['catch'](function(_0x214613){logger['error'](_0x08b0('0x47'),_0x214613[_0x08b0('0x15')],_0x4fa25c);_0x460091(_0x29bd33['error'](0x1f4,_0x214613[_0x08b0('0x15')]));});});};exports[_0x08b0('0x48')]=function(_0x1a776f){var _0x4db70a=this;return new Promise(function(_0x45d88f,_0x406fa4){return db[_0x08b0('0x23')][_0x08b0('0x24')](function(_0x4b01d9){var _0x5eb392=_0x1a776f[_0x08b0('0x8')]&&_0x1a776f[_0x08b0('0x8')][_0x08b0('0xa')]?_0x1a776f[_0x08b0('0x8')][_0x08b0('0xa')]:{};return db[_0x08b0('0x6')][_0x08b0('0x1b')](_0x1a776f['body'],{'where':_0x5eb392,'transaction':_0x4b01d9})[_0x08b0('0x10')](function(_0x204041){logger['info']('ResetActiveCalls',_0x1a776f);logger[_0x08b0('0x12')]('ResetActiveCalls',_0x1a776f,JSON['stringify'](_0x204041));_0x45d88f(_0x204041);})['catch'](function(_0x449b2e){logger[_0x08b0('0x16')](_0x08b0('0x48'),_0x449b2e[_0x08b0('0x15')],_0x1a776f);_0x406fa4(_0x4db70a[_0x08b0('0x16')](0x1f4,_0x449b2e['message']));});});});};exports[_0x08b0('0x49')]=function(_0x76bac1){var _0x23ba45=this;var _0x5e8bc2=_0x76bac1[_0x08b0('0x1a')][_0x08b0('0xa')][_0x08b0('0x4a')];var _0x1ad82e=_0x76bac1[_0x08b0('0x1a')][_0x08b0('0xa')]['interval'];var _0x2f8ebf=_0x76bac1[_0x08b0('0x1a')]['where'][_0x08b0('0x4b')];return new Promise(function(_0x4f9da8,_0x5557d1){return db[_0x08b0('0x6')][_0x08b0('0x7')]({'where':{'voiceQueueId':{'$in':_0x5e8bc2},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x08b0('0x23')]['literal'](_0x08b0('0x4c')+_0x1ad82e+_0x08b0('0x4d')),'$gt':db[_0x08b0('0x23')][_0x08b0('0x39')](_0x08b0('0x4e'))}},'UserId':{'$in':_0x2f8ebf}},'include':[{'model':db['CmContact'],'as':_0x08b0('0x26')},{'model':db[_0x08b0('0x28')],'as':_0x08b0('0x29'),'attributes':['id',_0x08b0('0x2a'),_0x08b0('0x2b')]},{'model':db[_0x08b0('0x4f')],'as':'List'}]})['then'](function(_0x106089){if(_0x106089['length']>0x0){return db['sequelize'][_0x08b0('0x24')](function(_0x5de735){return db[_0x08b0('0x6')]['update']({'recallmeNotifiedDate':db[_0x08b0('0x23')][_0x08b0('0x39')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x106089,'id')}},'transaction':_0x5de735})[_0x08b0('0x10')](function(){_0x4f9da8(_0x106089);})[_0x08b0('0x14')](function(_0x487a25){logger['error'](_0x08b0('0x49'),_0x487a25[_0x08b0('0x15')],_0x76bac1);_0x5557d1(_0x23ba45['error'](0x1f4,_0x487a25[_0x08b0('0x15')]));});})[_0x08b0('0x14')](function(_0x1d8873){logger[_0x08b0('0x16')](_0x08b0('0x49'),_0x1d8873[_0x08b0('0x15')],_0x76bac1);_0x5557d1(_0x23ba45[_0x08b0('0x16')](0x1f4,_0x1d8873[_0x08b0('0x15')]));});}else{_0x4f9da8(_0x106089);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c7819cf..e5e662e 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 _0x3ed4=['describe','/opencontacts','isAuthenticated','getOpenContacts','/timezones','getTimezones','show','post','create','/preview','getPreview','/timezone','getTimezone','/:id','update','delete','exports','express','Router','../../components/auth/service','index','get','/describe'];(function(_0xfcfe92,_0x14ea66){var _0x166ba1=function(_0x45f01a){while(--_0x45f01a){_0xfcfe92['push'](_0xfcfe92['shift']());}};_0x166ba1(++_0x14ea66);}(_0x3ed4,0x198));var _0x43ed=function(_0x383446,_0x1e0c93){_0x383446=_0x383446-0x0;var _0x40e10d=_0x3ed4[_0x383446];return _0x40e10d;};'use strict';var express=require(_0x43ed('0x0'));var router=express[_0x43ed('0x1')]();var auth=require(_0x43ed('0x2'));var controller=require('./cmHopper.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x43ed('0x3')]);router[_0x43ed('0x4')](_0x43ed('0x5'),auth['isAuthenticated'](),controller[_0x43ed('0x6')]);router[_0x43ed('0x4')](_0x43ed('0x7'),auth[_0x43ed('0x8')](),controller[_0x43ed('0x9')]);router['get'](_0x43ed('0xa'),auth[_0x43ed('0x8')](),controller[_0x43ed('0xb')]);router[_0x43ed('0x4')]('/:id',auth[_0x43ed('0x8')](),controller[_0x43ed('0xc')]);router[_0x43ed('0x4')]('/:id/previewrecall',auth[_0x43ed('0x8')](),controller['getPreviewRecall']);router[_0x43ed('0xd')]('/',auth['isAuthenticated'](),controller[_0x43ed('0xe')]);router[_0x43ed('0xd')](_0x43ed('0xf'),auth[_0x43ed('0x8')](),controller[_0x43ed('0x10')]);router[_0x43ed('0xd')](_0x43ed('0x11'),auth['isAuthenticated'](),controller[_0x43ed('0x12')]);router['put'](_0x43ed('0x13'),auth['isAuthenticated'](),controller[_0x43ed('0x14')]);router[_0x43ed('0x15')](_0x43ed('0x13'),auth[_0x43ed('0x8')](),controller['destroy']);module[_0x43ed('0x16')]=router; \ No newline at end of file +var _0x941b=['delete','exports','express','../../components/auth/service','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','getPreview','/timezone','getTimezone','update'];(function(_0x5b91dd,_0x2dfc38){var _0xf4117a=function(_0x5cb686){while(--_0x5cb686){_0x5b91dd['push'](_0x5b91dd['shift']());}};_0xf4117a(++_0x2dfc38);}(_0x941b,0x8e));var _0xb941=function(_0x2019d2,_0x5ec7d5){_0x2019d2=_0x2019d2-0x0;var _0x477b92=_0x941b[_0x2019d2];return _0x477b92;};'use strict';var express=require(_0xb941('0x0'));var router=express['Router']();var auth=require(_0xb941('0x1'));var controller=require(_0xb941('0x2'));router[_0xb941('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb941('0x3')](_0xb941('0x4'),auth[_0xb941('0x5')](),controller[_0xb941('0x6')]);router[_0xb941('0x3')](_0xb941('0x7'),auth[_0xb941('0x5')](),controller['getOpenContacts']);router[_0xb941('0x3')](_0xb941('0x8'),auth[_0xb941('0x5')](),controller[_0xb941('0x9')]);router['get'](_0xb941('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb941('0xb'),auth[_0xb941('0x5')](),controller[_0xb941('0xc')]);router[_0xb941('0xd')]('/',auth[_0xb941('0x5')](),controller['create']);router[_0xb941('0xd')]('/preview',auth[_0xb941('0x5')](),controller[_0xb941('0xe')]);router[_0xb941('0xd')](_0xb941('0xf'),auth['isAuthenticated'](),controller[_0xb941('0x10')]);router['put']('/:id',auth[_0xb941('0x5')](),controller[_0xb941('0x11')]);router[_0xb941('0x12')]('/:id',auth[_0xb941('0x5')](),controller['destroy']);module[_0xb941('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 9a4be51..8967134 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c1=['moment','exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x52d881,_0x3a47c9){var _0x41d8af=function(_0x43aa30){while(--_0x43aa30){_0x52d881['push'](_0x52d881['shift']());}};_0x41d8af(++_0x3a47c9);}(_0xb4c1,0xaf));var _0x1b4c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb4c1[_0xfae23b];return _0x200640;};'use strict';var moment=require(_0x1b4c('0x0'));var Sequelize=require('sequelize');module[_0x1b4c('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x1b4c('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1b4c('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1b4c('0x4')],'defaultValue':moment()[_0x1b4c('0x5')](_0x1b4c('0x6'))},'countbusyretry':{'type':Sequelize[_0x1b4c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1b4c('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1b4c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1b4c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1b4c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1ce6=['sequelize','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x54d24b,_0x4c07ba){var _0xe89b42=function(_0x17631b){while(--_0x17631b){_0x54d24b['push'](_0x54d24b['shift']());}};_0xe89b42(++_0x4c07ba);}(_0x1ce6,0x65));var _0x61ce=function(_0x278b72,_0xeb5c14){_0x278b72=_0x278b72-0x0;var _0x422d25=_0x1ce6[_0x278b72];return _0x422d25;};'use strict';var moment=require(_0x61ce('0x0'));var Sequelize=require(_0x61ce('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x61ce('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x61ce('0x3')],'defaultValue':moment()[_0x61ce('0x4')](_0x61ce('0x5'))},'countbusyretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x61ce('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 26c4601..f4deabf 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25ce=['model','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','index','map','CmHopperAdditionalPhone','type','key','query','keys','filters','intersection'];(function(_0x5c0ffe,_0x2d9b3b){var _0x2f2cec=function(_0x16eb67){while(--_0x16eb67){_0x5c0ffe['push'](_0x5c0ffe['shift']());}};_0x2f2cec(++_0x2d9b3b);}(_0x25ce,0x1bf));var _0xe25c=function(_0x327f41,_0x5c3672){_0x327f41=_0x327f41-0x0;var _0x3ffdae=_0x25ce[_0x327f41];return _0x3ffdae;};'use strict';var emlformat=require(_0xe25c('0x0'));var rimraf=require(_0xe25c('0x1'));var zipdir=require(_0xe25c('0x2'));var jsonpatch=require(_0xe25c('0x3'));var rp=require(_0xe25c('0x4'));var moment=require('moment');var BPromise=require(_0xe25c('0x5'));var Mustache=require(_0xe25c('0x6'));var util=require(_0xe25c('0x7'));var path=require(_0xe25c('0x8'));var sox=require(_0xe25c('0x9'));var csv=require(_0xe25c('0xa'));var ejs=require(_0xe25c('0xb'));var fs=require('fs');var fs_extra=require(_0xe25c('0xc'));var _=require(_0xe25c('0xd'));var squel=require(_0xe25c('0xe'));var crypto=require(_0xe25c('0xf'));var jsforce=require(_0xe25c('0x10'));var deskjs=require(_0xe25c('0x11'));var toCsv=require(_0xe25c('0xa'));var querystring=require(_0xe25c('0x12'));var Papa=require(_0xe25c('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe25c('0x14'));var as=require(_0xe25c('0x15'));var hardwareService=require(_0xe25c('0x16'));var logger=require(_0xe25c('0x17'))(_0xe25c('0x18'));var utils=require(_0xe25c('0x19'));var config=require(_0xe25c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe25c('0x1b'))['db'];function respondWithStatusCode(_0x16b225,_0x5c2339){_0x5c2339=_0x5c2339||0xcc;return function(_0x5edc5c){if(_0x5edc5c){return _0x16b225[_0xe25c('0x1c')](_0x5c2339);}return _0x16b225[_0xe25c('0x1d')](_0x5c2339)[_0xe25c('0x1e')]();};}function respondWithResult(_0x543a43,_0x9099d2){_0x9099d2=_0x9099d2||0xc8;return function(_0x2c11c1){if(_0x2c11c1){return _0x543a43['status'](_0x9099d2)[_0xe25c('0x1f')](_0x2c11c1);}};}function respondWithFilteredResult(_0x51f7d0,_0x558120){return function(_0x566071){if(_0x566071){var _0x1e2e53=typeof _0x558120[_0xe25c('0x20')]==='undefined'&&typeof _0x558120['limit']===_0xe25c('0x21');var _0x53c8c0=_0x566071[_0xe25c('0x22')];var _0x13a6c2=_0x1e2e53?0x0:_0x558120[_0xe25c('0x20')];var _0x52401b=_0x1e2e53?_0x566071[_0xe25c('0x22')]:_0x558120['offset']+_0x558120[_0xe25c('0x23')];var _0x2ecb66;if(_0x52401b>=_0x53c8c0){_0x52401b=_0x53c8c0;_0x2ecb66=0xc8;}else{_0x2ecb66=0xce;}_0x51f7d0['status'](_0x2ecb66);return _0x51f7d0['set'](_0xe25c('0x24'),_0x13a6c2+'-'+_0x52401b+'/'+_0x53c8c0)[_0xe25c('0x1f')](_0x566071);}return null;};}function patchUpdates(_0x395b36){return function(_0x4792cf){try{jsonpatch[_0xe25c('0x25')](_0x4792cf,_0x395b36,!![]);}catch(_0x283345){return BPromise[_0xe25c('0x26')](_0x283345);}return _0x4792cf['save']();};}function saveUpdates(_0x229744,_0x265195){return function(_0x4acbdf){if(_0x4acbdf){return _0x4acbdf[_0xe25c('0x27')](_0x229744)[_0xe25c('0x28')](function(_0x45cf69){return _0x45cf69;});}return null;};}function removeEntity(_0x1fd59e,_0x1f4c7a){return function(_0x23f875){if(_0x23f875){return _0x23f875[_0xe25c('0x29')]()['then'](function(){var _0x5cf7a4=_0x23f875[_0xe25c('0x2a')]({'plain':!![]});var _0x3acfe1=_0xe25c('0x2b');return db[_0xe25c('0x2c')]['destroy']({'where':{'type':_0x3acfe1,'resourceId':_0x5cf7a4['id']}})['then'](function(){return _0x23f875;});})[_0xe25c('0x28')](function(){_0x1fd59e[_0xe25c('0x1d')](0xcc)[_0xe25c('0x1e')]();});}};}function handleEntityNotFound(_0x945029,_0x5aeff6){return function(_0x528b56){if(!_0x528b56){_0x945029[_0xe25c('0x1c')](0x194);}return _0x528b56;};}function handleError(_0x5b1d07,_0x8d98ab){_0x8d98ab=_0x8d98ab||0x1f4;return function(_0x2e675c){logger[_0xe25c('0x2d')](_0x2e675c[_0xe25c('0x2e')]);if(_0x2e675c[_0xe25c('0x2f')]){delete _0x2e675c[_0xe25c('0x2f')];}_0x5b1d07[_0xe25c('0x1d')](_0x8d98ab)['send'](_0x2e675c);};}exports[_0xe25c('0x30')]=function(_0x30378f,_0x4e7d79){var _0x57942e={},_0x24f76b={},_0x262714={'count':0x0,'rows':[]};var _0x16d0d=_[_0xe25c('0x31')](db[_0xe25c('0x32')]['rawAttributes'],function(_0x1f782e){return{'name':_0x1f782e['fieldName'],'type':_0x1f782e[_0xe25c('0x33')][_0xe25c('0x34')]};});_0x24f76b['model']=_[_0xe25c('0x31')](_0x16d0d,_0xe25c('0x2f'));_0x24f76b[_0xe25c('0x35')]=_[_0xe25c('0x36')](_0x30378f['query']);_0x24f76b[_0xe25c('0x37')]=_[_0xe25c('0x38')](_0x24f76b[_0xe25c('0x39')],_0x24f76b[_0xe25c('0x35')]);_0x57942e['attributes']=_['intersection'](_0x24f76b[_0xe25c('0x39')],qs[_0xe25c('0x3a')](_0x30378f[_0xe25c('0x35')]['fields']));_0x57942e['attributes']=_0x57942e[_0xe25c('0x3b')]['length']?_0x57942e[_0xe25c('0x3b')]:_0x24f76b[_0xe25c('0x39')];if(!_0x30378f[_0xe25c('0x35')][_0xe25c('0x3c')]('nolimit')){_0x57942e[_0xe25c('0x23')]=qs['limit'](_0x30378f['query'][_0xe25c('0x23')]);_0x57942e[_0xe25c('0x20')]=qs[_0xe25c('0x20')](_0x30378f[_0xe25c('0x35')][_0xe25c('0x20')]);}_0x57942e[_0xe25c('0x3d')]=qs['sort'](_0x30378f[_0xe25c('0x35')][_0xe25c('0x3e')]);_0x57942e[_0xe25c('0x3f')]=qs[_0xe25c('0x37')](_[_0xe25c('0x40')](_0x30378f[_0xe25c('0x35')],_0x24f76b[_0xe25c('0x37')]),_0x16d0d);if(_0x30378f[_0xe25c('0x35')]['filter']){_0x57942e['where']=_['merge'](_0x57942e[_0xe25c('0x3f')],{'$or':_[_0xe25c('0x31')](_0x16d0d,function(_0x18ab40){if(_0x18ab40['type']!==_0xe25c('0x41')){var _0x2348a2={};_0x2348a2[_0x18ab40['name']]={'$like':'%'+_0x30378f[_0xe25c('0x35')][_0xe25c('0x42')]+'%'};return _0x2348a2;}})});}_0x57942e=_[_0xe25c('0x43')]({},_0x57942e,_0x30378f[_0xe25c('0x44')]);var _0x4f4e4e={'where':_0x57942e[_0xe25c('0x3f')]};return db[_0xe25c('0x32')][_0xe25c('0x22')](_0x4f4e4e)[_0xe25c('0x28')](function(_0x58b241){_0x262714[_0xe25c('0x22')]=_0x58b241;if(_0x30378f[_0xe25c('0x35')][_0xe25c('0x45')]){_0x57942e[_0xe25c('0x46')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xe25c('0x47')](_0x57942e);})['then'](function(_0x208f03){_0x262714[_0xe25c('0x48')]=_0x208f03;return _0x262714;})[_0xe25c('0x28')](respondWithFilteredResult(_0x4e7d79,_0x57942e))[_0xe25c('0x49')](handleError(_0x4e7d79,null));};exports[_0xe25c('0x4a')]=function(_0x151c4e,_0x36d711){var _0x40148f={'raw':!![],'where':{'id':_0x151c4e['params']['id']}},_0xb065d9={};_0xb065d9[_0xe25c('0x39')]=_[_0xe25c('0x36')](db['CmHopperAdditionalPhone'][_0xe25c('0x4b')]);_0xb065d9[_0xe25c('0x35')]=_[_0xe25c('0x36')](_0x151c4e['query']);_0xb065d9[_0xe25c('0x37')]=_[_0xe25c('0x38')](_0xb065d9['model'],_0xb065d9[_0xe25c('0x35')]);_0x40148f[_0xe25c('0x3b')]=_['intersection'](_0xb065d9[_0xe25c('0x39')],qs[_0xe25c('0x3a')](_0x151c4e[_0xe25c('0x35')][_0xe25c('0x3a')]));_0x40148f[_0xe25c('0x3b')]=_0x40148f[_0xe25c('0x3b')]['length']?_0x40148f['attributes']:_0xb065d9[_0xe25c('0x39')];if(_0x151c4e[_0xe25c('0x35')]['includeAll']){_0x40148f[_0xe25c('0x46')]=[{'all':!![]}];}_0x40148f=_['merge']({},_0x40148f,_0x151c4e['options']);return db[_0xe25c('0x32')]['find'](_0x40148f)['then'](handleEntityNotFound(_0x36d711,null))[_0xe25c('0x28')](respondWithResult(_0x36d711,null))['catch'](handleError(_0x36d711,null));};exports[_0xe25c('0x4c')]=function(_0x1b6ebf,_0x5414b7){return db[_0xe25c('0x32')]['create'](_0x1b6ebf['body'],{})[_0xe25c('0x28')](function(_0x5d203f){var _0x410c2f=_0x1b6ebf[_0xe25c('0x4d')][_0xe25c('0x2a')]({'plain':!![]});if(!_0x410c2f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c2f['role']===_0xe25c('0x4d')){var _0x57f690=_0x5d203f[_0xe25c('0x2a')]({'plain':!![]});var _0x575e87='CmHopperAdditionalPhones';return db[_0xe25c('0x4e')][_0xe25c('0x4f')]({'where':{'name':_0x575e87,'userProfileId':_0x410c2f[_0xe25c('0x50')]},'raw':!![]})['then'](function(_0x524721){if(_0x524721&&_0x524721['autoAssociation']===0x0){return db[_0xe25c('0x2c')][_0xe25c('0x4c')]({'name':_0x57f690[_0xe25c('0x2f')],'resourceId':_0x57f690['id'],'type':_0x524721[_0xe25c('0x2f')],'sectionId':_0x524721['id']},{})[_0xe25c('0x28')](function(){return _0x5d203f;});}else{return _0x5d203f;}})[_0xe25c('0x49')](function(_0x46a809){logger[_0xe25c('0x2d')](_0xe25c('0x51'),_0x46a809);throw _0x46a809;});}return _0x5d203f;})[_0xe25c('0x28')](respondWithResult(_0x5414b7,0xc9))[_0xe25c('0x49')](handleError(_0x5414b7,null));};exports['update']=function(_0x6f1fc2,_0x11adad){if(_0x6f1fc2[_0xe25c('0x52')]['id']){delete _0x6f1fc2['body']['id'];}return db[_0xe25c('0x32')]['find']({'where':{'id':_0x6f1fc2['params']['id']}})[_0xe25c('0x28')](handleEntityNotFound(_0x11adad,null))['then'](saveUpdates(_0x6f1fc2[_0xe25c('0x52')],null))[_0xe25c('0x28')](respondWithResult(_0x11adad,null))[_0xe25c('0x49')](handleError(_0x11adad,null));};exports[_0xe25c('0x29')]=function(_0x1d8175,_0x3c7826){return db['CmHopperAdditionalPhone'][_0xe25c('0x4f')]({'where':{'id':_0x1d8175[_0xe25c('0x53')]['id']}})[_0xe25c('0x28')](handleEntityNotFound(_0x3c7826,null))[_0xe25c('0x28')](removeEntity(_0x3c7826,null))[_0xe25c('0x49')](handleError(_0x3c7826,null));}; \ No newline at end of file +var _0xda20=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','CmHopperAdditionalPhones','destroy','error','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5dc129,_0x190ca0){var _0x4820e9=function(_0x35f227){while(--_0x35f227){_0x5dc129['push'](_0x5dc129['shift']());}};_0x4820e9(++_0x190ca0);}(_0xda20,0x18c));var _0x0da2=function(_0x8cb7ee,_0x10a869){_0x8cb7ee=_0x8cb7ee-0x0;var _0x3203ce=_0xda20[_0x8cb7ee];return _0x3203ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0da2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0da2('0x1'));var rp=require(_0x0da2('0x2'));var moment=require(_0x0da2('0x3'));var BPromise=require(_0x0da2('0x4'));var Mustache=require(_0x0da2('0x5'));var util=require(_0x0da2('0x6'));var path=require(_0x0da2('0x7'));var sox=require(_0x0da2('0x8'));var csv=require(_0x0da2('0x9'));var ejs=require(_0x0da2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0da2('0xb'));var squel=require(_0x0da2('0xc'));var crypto=require(_0x0da2('0xd'));var jsforce=require(_0x0da2('0xe'));var deskjs=require(_0x0da2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0da2('0x10'));var Papa=require(_0x0da2('0x11'));var Redis=require(_0x0da2('0x12'));var authService=require(_0x0da2('0x13'));var qs=require(_0x0da2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0da2('0x15'))(_0x0da2('0x16'));var utils=require(_0x0da2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0da2('0x18'));var db=require(_0x0da2('0x19'))['db'];function respondWithStatusCode(_0x31e0ce,_0x3e6503){_0x3e6503=_0x3e6503||0xcc;return function(_0xe46861){if(_0xe46861){return _0x31e0ce[_0x0da2('0x1a')](_0x3e6503);}return _0x31e0ce[_0x0da2('0x1b')](_0x3e6503)[_0x0da2('0x1c')]();};}function respondWithResult(_0x468c1c,_0x23a90f){_0x23a90f=_0x23a90f||0xc8;return function(_0x5f3b9b){if(_0x5f3b9b){return _0x468c1c['status'](_0x23a90f)['json'](_0x5f3b9b);}};}function respondWithFilteredResult(_0x386b99,_0x4c1d38){return function(_0x44e150){if(_0x44e150){var _0x26e352=typeof _0x4c1d38[_0x0da2('0x1d')]===_0x0da2('0x1e')&&typeof _0x4c1d38[_0x0da2('0x1f')]===_0x0da2('0x1e');var _0x215a1c=_0x44e150[_0x0da2('0x20')];var _0xf522c4=_0x26e352?0x0:_0x4c1d38[_0x0da2('0x1d')];var _0x7aa20e=_0x26e352?_0x44e150['count']:_0x4c1d38[_0x0da2('0x1d')]+_0x4c1d38[_0x0da2('0x1f')];var _0x34e94f;if(_0x7aa20e>=_0x215a1c){_0x7aa20e=_0x215a1c;_0x34e94f=0xc8;}else{_0x34e94f=0xce;}_0x386b99[_0x0da2('0x1b')](_0x34e94f);return _0x386b99[_0x0da2('0x21')](_0x0da2('0x22'),_0xf522c4+'-'+_0x7aa20e+'/'+_0x215a1c)[_0x0da2('0x23')](_0x44e150);}return null;};}function patchUpdates(_0xd3b168){return function(_0x4151a3){try{jsonpatch[_0x0da2('0x24')](_0x4151a3,_0xd3b168,!![]);}catch(_0x6c2d39){return BPromise[_0x0da2('0x25')](_0x6c2d39);}return _0x4151a3[_0x0da2('0x26')]();};}function saveUpdates(_0x1e6ad7,_0x552d62){return function(_0x5c509a){if(_0x5c509a){return _0x5c509a[_0x0da2('0x27')](_0x1e6ad7)[_0x0da2('0x28')](function(_0x240b55){return _0x240b55;});}return null;};}function removeEntity(_0xcff850,_0x238591){return function(_0x5d0beb){if(_0x5d0beb){return _0x5d0beb['destroy']()['then'](function(){var _0x518a9e=_0x5d0beb['get']({'plain':!![]});var _0x5441ad=_0x0da2('0x29');return db['UserProfileResource'][_0x0da2('0x2a')]({'where':{'type':_0x5441ad,'resourceId':_0x518a9e['id']}})[_0x0da2('0x28')](function(){return _0x5d0beb;});})[_0x0da2('0x28')](function(){_0xcff850[_0x0da2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa588d5,_0x257d04){return function(_0x5035c4){if(!_0x5035c4){_0xa588d5['sendStatus'](0x194);}return _0x5035c4;};}function handleError(_0x965916,_0x359bf0){_0x359bf0=_0x359bf0||0x1f4;return function(_0x4eef6e){logger[_0x0da2('0x2b')](_0x4eef6e['stack']);if(_0x4eef6e[_0x0da2('0x2c')]){delete _0x4eef6e['name'];}_0x965916['status'](_0x359bf0)['send'](_0x4eef6e);};}exports[_0x0da2('0x2d')]=function(_0xdcc642,_0x487064){var _0x1adfcc={},_0x382e4e={},_0x4677bd={'count':0x0,'rows':[]};var _0x37614d=_[_0x0da2('0x2e')](db[_0x0da2('0x2f')][_0x0da2('0x30')],function(_0x290006){return{'name':_0x290006[_0x0da2('0x31')],'type':_0x290006[_0x0da2('0x32')][_0x0da2('0x33')]};});_0x382e4e[_0x0da2('0x34')]=_[_0x0da2('0x2e')](_0x37614d,_0x0da2('0x2c'));_0x382e4e[_0x0da2('0x35')]=_[_0x0da2('0x36')](_0xdcc642[_0x0da2('0x35')]);_0x382e4e[_0x0da2('0x37')]=_[_0x0da2('0x38')](_0x382e4e[_0x0da2('0x34')],_0x382e4e['query']);_0x1adfcc[_0x0da2('0x39')]=_[_0x0da2('0x38')](_0x382e4e[_0x0da2('0x34')],qs[_0x0da2('0x3a')](_0xdcc642[_0x0da2('0x35')]['fields']));_0x1adfcc[_0x0da2('0x39')]=_0x1adfcc[_0x0da2('0x39')]['length']?_0x1adfcc[_0x0da2('0x39')]:_0x382e4e[_0x0da2('0x34')];if(!_0xdcc642[_0x0da2('0x35')]['hasOwnProperty'](_0x0da2('0x3b'))){_0x1adfcc[_0x0da2('0x1f')]=qs[_0x0da2('0x1f')](_0xdcc642['query'][_0x0da2('0x1f')]);_0x1adfcc[_0x0da2('0x1d')]=qs[_0x0da2('0x1d')](_0xdcc642['query'][_0x0da2('0x1d')]);}_0x1adfcc[_0x0da2('0x3c')]=qs[_0x0da2('0x3d')](_0xdcc642[_0x0da2('0x35')][_0x0da2('0x3d')]);_0x1adfcc[_0x0da2('0x3e')]=qs[_0x0da2('0x37')](_[_0x0da2('0x3f')](_0xdcc642[_0x0da2('0x35')],_0x382e4e[_0x0da2('0x37')]),_0x37614d);if(_0xdcc642['query']['filter']){_0x1adfcc[_0x0da2('0x3e')]=_[_0x0da2('0x40')](_0x1adfcc[_0x0da2('0x3e')],{'$or':_[_0x0da2('0x2e')](_0x37614d,function(_0x16cd62){if(_0x16cd62[_0x0da2('0x32')]!==_0x0da2('0x41')){var _0x4eedb6={};_0x4eedb6[_0x16cd62[_0x0da2('0x2c')]]={'$like':'%'+_0xdcc642[_0x0da2('0x35')]['filter']+'%'};return _0x4eedb6;}})});}_0x1adfcc=_[_0x0da2('0x40')]({},_0x1adfcc,_0xdcc642[_0x0da2('0x42')]);var _0x5456aa={'where':_0x1adfcc[_0x0da2('0x3e')]};return db[_0x0da2('0x2f')][_0x0da2('0x20')](_0x5456aa)[_0x0da2('0x28')](function(_0x162413){_0x4677bd[_0x0da2('0x20')]=_0x162413;if(_0xdcc642[_0x0da2('0x35')][_0x0da2('0x43')]){_0x1adfcc[_0x0da2('0x44')]=[{'all':!![]}];}return db[_0x0da2('0x2f')]['findAll'](_0x1adfcc);})[_0x0da2('0x28')](function(_0x5252b6){_0x4677bd['rows']=_0x5252b6;return _0x4677bd;})[_0x0da2('0x28')](respondWithFilteredResult(_0x487064,_0x1adfcc))['catch'](handleError(_0x487064,null));};exports[_0x0da2('0x45')]=function(_0x3ed35b,_0x115782){var _0x14626a={'raw':!![],'where':{'id':_0x3ed35b[_0x0da2('0x46')]['id']}},_0x33be7d={};_0x33be7d[_0x0da2('0x34')]=_[_0x0da2('0x36')](db[_0x0da2('0x2f')][_0x0da2('0x30')]);_0x33be7d[_0x0da2('0x35')]=_[_0x0da2('0x36')](_0x3ed35b['query']);_0x33be7d[_0x0da2('0x37')]=_['intersection'](_0x33be7d['model'],_0x33be7d['query']);_0x14626a['attributes']=_[_0x0da2('0x38')](_0x33be7d[_0x0da2('0x34')],qs[_0x0da2('0x3a')](_0x3ed35b['query'][_0x0da2('0x3a')]));_0x14626a['attributes']=_0x14626a['attributes'][_0x0da2('0x47')]?_0x14626a[_0x0da2('0x39')]:_0x33be7d[_0x0da2('0x34')];if(_0x3ed35b[_0x0da2('0x35')][_0x0da2('0x43')]){_0x14626a[_0x0da2('0x44')]=[{'all':!![]}];}_0x14626a=_[_0x0da2('0x40')]({},_0x14626a,_0x3ed35b[_0x0da2('0x42')]);return db[_0x0da2('0x2f')][_0x0da2('0x48')](_0x14626a)[_0x0da2('0x28')](handleEntityNotFound(_0x115782,null))[_0x0da2('0x28')](respondWithResult(_0x115782,null))['catch'](handleError(_0x115782,null));};exports['create']=function(_0x51563b,_0x14d91c){return db[_0x0da2('0x2f')][_0x0da2('0x49')](_0x51563b[_0x0da2('0x4a')],{})[_0x0da2('0x28')](function(_0x137620){var _0x574b6c=_0x51563b[_0x0da2('0x4b')][_0x0da2('0x4c')]({'plain':!![]});if(!_0x574b6c)throw new Error(_0x0da2('0x4d'));if(_0x574b6c['role']===_0x0da2('0x4b')){var _0x4df44d=_0x137620[_0x0da2('0x4c')]({'plain':!![]});var _0x5a7dfd='CmHopperAdditionalPhones';return db[_0x0da2('0x4e')][_0x0da2('0x48')]({'where':{'name':_0x5a7dfd,'userProfileId':_0x574b6c[_0x0da2('0x4f')]},'raw':!![]})[_0x0da2('0x28')](function(_0x50779b){if(_0x50779b&&_0x50779b[_0x0da2('0x50')]===0x0){return db[_0x0da2('0x51')]['create']({'name':_0x4df44d[_0x0da2('0x2c')],'resourceId':_0x4df44d['id'],'type':_0x50779b[_0x0da2('0x2c')],'sectionId':_0x50779b['id']},{})[_0x0da2('0x28')](function(){return _0x137620;});}else{return _0x137620;}})['catch'](function(_0x14ad90){logger[_0x0da2('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14ad90);throw _0x14ad90;});}return _0x137620;})[_0x0da2('0x28')](respondWithResult(_0x14d91c,0xc9))[_0x0da2('0x52')](handleError(_0x14d91c,null));};exports['update']=function(_0x39cc4f,_0x3181cb){if(_0x39cc4f['body']['id']){delete _0x39cc4f[_0x0da2('0x4a')]['id'];}return db[_0x0da2('0x2f')][_0x0da2('0x48')]({'where':{'id':_0x39cc4f['params']['id']}})[_0x0da2('0x28')](handleEntityNotFound(_0x3181cb,null))[_0x0da2('0x28')](saveUpdates(_0x39cc4f[_0x0da2('0x4a')],null))[_0x0da2('0x28')](respondWithResult(_0x3181cb,null))['catch'](handleError(_0x3181cb,null));};exports[_0x0da2('0x2a')]=function(_0x3f337e,_0x157a30){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x3f337e[_0x0da2('0x46')]['id']}})[_0x0da2('0x28')](handleEntityNotFound(_0x157a30,null))[_0x0da2('0x28')](removeEntity(_0x157a30,null))[_0x0da2('0x52')](handleError(_0x157a30,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index e9df46e..d7c80fd 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8828=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x3b157e,_0x3e021c){var _0x4a1dfb=function(_0x52597a){while(--_0x52597a){_0x3b157e['push'](_0x3b157e['shift']());}};_0x4a1dfb(++_0x3e021c);}(_0x8828,0x197));var _0x8882=function(_0x2573c6,_0x56ef90){_0x2573c6=_0x2573c6-0x0;var _0xad97d4=_0x8828[_0x2573c6];return _0xad97d4;};'use strict';var _=require('lodash');var util=require(_0x8882('0x0'));var logger=require('../../config/logger')(_0x8882('0x1'));var moment=require('moment');var BPromise=require(_0x8882('0x2'));var rp=require(_0x8882('0x3'));var fs=require('fs');var path=require(_0x8882('0x4'));var rimraf=require(_0x8882('0x5'));var config=require(_0x8882('0x6'));var attributes=require(_0x8882('0x7'));module['exports']=function(_0x28afb8,_0x42adc2){return _0x28afb8[_0x8882('0x8')](_0x8882('0x9'),attributes,{'tableName':_0x8882('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa230=['util','api','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xa230,0xbe));var _0x0a23=function(_0x5026c6,_0xc32c74){_0x5026c6=_0x5026c6-0x0;var _0xaf240f=_0xa230[_0x5026c6];return _0xaf240f;};'use strict';var _=require('lodash');var util=require(_0x0a23('0x0'));var logger=require('../../config/logger')(_0x0a23('0x1'));var moment=require('moment');var BPromise=require(_0x0a23('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a23('0x3'));var config=require(_0x0a23('0x4'));var attributes=require(_0x0a23('0x5'));module[_0x0a23('0x6')]=function(_0x2f8668,_0x295c08){return _0x2f8668[_0x0a23('0x7')](_0x0a23('0x8'),attributes,{'tableName':_0x0a23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 6bb14df..ad670e3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7405=['countbusyretry','SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','isNil','phone','createdAt','updatedAt','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry'];(function(_0x27b80c,_0x107e71){var _0x4cab2c=function(_0x3feb12){while(--_0x3feb12){_0x27b80c['push'](_0x27b80c['shift']());}};_0x4cab2c(++_0x107e71);}(_0x7405,0xb7));var _0x5740=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x7405[_0x1b6311];return _0x25aab6;};'use strict';var _=require(_0x5740('0x0'));var util=require(_0x5740('0x1'));var moment=require(_0x5740('0x2'));var BPromise=require('bluebird');var rs=require(_0x5740('0x3'));var fs=require('fs');var Redis=require(_0x5740('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5740('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5740('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5740('0x7')][_0x5740('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6952d1,_0x29bd5c,_0x2f6729){return new BPromise(function(_0x46e879,_0x3b0d27){return client[_0x5740('0x9')](_0x6952d1,_0x2f6729)['then'](function(_0x464f25){logger[_0x5740('0xa')](_0x5740('0xb'),_0x29bd5c,'request\x20sent');logger[_0x5740('0xc')](_0x5740('0xd'),_0x29bd5c,_0x5740('0xe'),JSON[_0x5740('0xf')](_0x464f25));if(_0x464f25['error']){if(_0x464f25[_0x5740('0x10')][_0x5740('0x11')]===0x1f4){logger[_0x5740('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x29bd5c,_0x464f25[_0x5740('0x10')]['message']);return _0x3b0d27(_0x464f25[_0x5740('0x10')][_0x5740('0x12')]);}logger[_0x5740('0x10')](_0x5740('0xb'),_0x29bd5c,_0x464f25['error'][_0x5740('0x12')]);return _0x46e879(_0x464f25[_0x5740('0x10')][_0x5740('0x12')]);}else{logger['info'](_0x5740('0xb'),_0x29bd5c,'request\x20sent');_0x46e879(_0x464f25['result'][_0x5740('0x12')]);}})[_0x5740('0x13')](function(_0x54af8a){logger['error'](_0x5740('0xb'),_0x29bd5c,_0x54af8a);_0x3b0d27(_0x54af8a);});});}exports[_0x5740('0x14')]=function(_0x20f031){var _0x873733=this;return new Promise(function(_0x53be76,_0x4d07ad){return db[_0x5740('0x15')][_0x5740('0x16')]({'raw':!![],'where':{'ContactId':_0x20f031[_0x5740('0x17')][_0x5740('0x18')],'ListId':_0x20f031['body'][_0x5740('0x19')],'VoiceQueueId':_0x20f031['body'][_0x5740('0x1a')]===undefined?null:_0x20f031[_0x5740('0x17')][_0x5740('0x1a')],'CampaignId':_0x20f031['body']['CampaignId']===undefined?null:_0x20f031['body'][_0x5740('0x1b')]}})[_0x5740('0x1c')](function(_0x16acfa){if(_0x16acfa!=null){return db[_0x5740('0x1d')][_0x5740('0x16')]({'raw':!![],'where':{'CmHopperId':_0x16acfa['id'],'OrderBy':{'$gt':_0x16acfa[_0x5740('0x1e')]}},'order':[[_0x5740('0x1e'),_0x5740('0x1f')]]})['then'](function(_0x2c9245){var _0x39fbb9=0x0;if(_0x2c9245){if(_0x2c9245['countbusyretry']+_0x2c9245[_0x5740('0x20')]+_0x2c9245[_0x5740('0x21')]+_0x2c9245[_0x5740('0x22')]+_0x2c9245[_0x5740('0x23')]+_0x2c9245[_0x5740('0x24')]+_0x2c9245[_0x5740('0x25')]+_0x2c9245[_0x5740('0x26')]<_0x20f031[_0x5740('0x27')][_0x5740('0x28')])_0x39fbb9=0x1;_0x53be76({'additional':_0x39fbb9});}else{return db[_0x5740('0x1d')][_0x5740('0x16')]({'raw':!![],'where':{'CmHopperId':_0x16acfa['id']},'order':[[_0x5740('0x1e'),'ASC']]})[_0x5740('0x1c')](function(_0x3a3358){var _0x49eaa2=0x0;if(_0x3a3358){if(_0x3a3358[_0x5740('0x29')]+_0x3a3358['countcongestionretry']+_0x3a3358['countnoanswerretry']+_0x3a3358[_0x5740('0x22')]+_0x3a3358[_0x5740('0x23')]+_0x3a3358[_0x5740('0x24')]+_0x3a3358[_0x5740('0x25')]+_0x3a3358['countagentrejectretry']<_0x20f031[_0x5740('0x27')]['dialGlobalMaxRetry'])_0x49eaa2=0x1;_0x53be76({'additional':_0x49eaa2});}else{_0x53be76({'additional':0x0});}})['catch'](function(_0x54c1ca){logger[_0x5740('0x10')](_0x5740('0x14'),_0x54c1ca[_0x5740('0x12')]);_0x4d07ad(_0x873733[_0x5740('0x10')](0x1f4,_0x54c1ca[_0x5740('0x12')]));});}})['catch'](function(_0x54a62d){logger[_0x5740('0x10')](_0x5740('0x14'),_0x54a62d[_0x5740('0x12')]);_0x4d07ad(_0x873733[_0x5740('0x10')](0x1f4,_0x54a62d[_0x5740('0x12')]));});}else _0x53be76({'additional':0x0});});});};exports[_0x5740('0x2a')]=function(_0x892e59){var _0x96c14=this;return new Promise(function(_0x8db521,_0xaa81cd){return db['CmHopper'][_0x5740('0x16')]({'raw':!![],'where':{'ContactId':_0x892e59[_0x5740('0x17')][_0x5740('0x18')],'ListId':_0x892e59['body']['ListId'],'VoiceQueueId':_0x892e59['body']['VoiceQueueId']===undefined?null:_0x892e59[_0x5740('0x17')][_0x5740('0x1a')],'CampaignId':_0x892e59[_0x5740('0x17')][_0x5740('0x1b')]===undefined?null:_0x892e59[_0x5740('0x17')]['CampaignId']}})['then'](function(_0x2ad735){if(_0x2ad735!=null){return db[_0x5740('0x1d')][_0x5740('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2ad735['id'],'OrderBy':{'$gte':_0x2ad735[_0x5740('0x1e')]}},'order':[[_0x5740('0x1e'),'ASC']]})[_0x5740('0x1c')](function(_0x3cddd0){if(_0x3cddd0)return activateAdditionalPhone(_0x2ad735,_0x892e59[_0x5740('0x17')],_0x3cddd0,_0x892e59[_0x5740('0x2b')],_0x892e59[_0x5740('0x2c')])['then'](function(_0x585d27){_0x8db521(_0x585d27);});else{return db[_0x5740('0x1d')][_0x5740('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2ad735['id']},'order':[['OrderBy','ASC']]})[_0x5740('0x1c')](function(_0x454eaf){if(_0x454eaf)return activateAdditionalPhone(_0x2ad735,_0x892e59[_0x5740('0x17')],_0x454eaf,_0x892e59[_0x5740('0x2b')],_0x892e59[_0x5740('0x2c')])[_0x5740('0x1c')](function(_0x1a0a80){_0x8db521(_0x1a0a80);});else{_0x8db521({'id':_0x2ad735['id'],'phone':''});}})[_0x5740('0x13')](function(_0x20f976){logger[_0x5740('0x10')](_0x5740('0x14'),_0x20f976[_0x5740('0x12')]);_0xaa81cd(_0x96c14['error'](0x1f4,_0x20f976[_0x5740('0x12')]));});}})[_0x5740('0x13')](function(_0x363283){logger[_0x5740('0x10')](_0x5740('0x14'),_0x363283[_0x5740('0x12')]);_0xaa81cd(_0x96c14['error'](0x1f4,_0x363283[_0x5740('0x12')]));});}else _0x8db521(0x1);});});};function activateAdditionalPhone(_0xb4b7f,_0x4c70db,_0x380a99,_0xf82afc,_0x30de79){return new Promise(function(_0x5c9027,_0xc2b45a){var _0x22ad5d;if(_['isNil'](_0x380a99[_0x5740('0x2d')])){_0x380a99['scheduledat']=moment();}if(moment()>moment(_0x380a99[_0x5740('0x2d')])){_0x22ad5d=moment()['add'](_0x30de79||0x3,_0x5740('0x2e'));}else{if(_0x380a99[_0x5740('0x1e')]==0x0){_0x22ad5d=moment(_0x380a99[_0x5740('0x2d')]);}else{_0x22ad5d=moment()[_0x5740('0x2f')](_0x30de79||0x3,_0x5740('0x2e'));}}if(_[_0x5740('0x30')](_0x22ad5d)){_0x22ad5d=moment()[_0x5740('0x2f')](_0x30de79||0x3,_0x5740('0x2e'));}var _0x3d5efb={'phone':_0xb4b7f[_0x5740('0x31')],'active':0x0,'OrderBy':_['isNil'](_0xb4b7f['OrderBy'])?0x0:_0xb4b7f['OrderBy'],'scheduledat':moment()[_0x5740('0x2f')](_0xf82afc||0x1,_0x5740('0x2e')),'countbusyretry':_0x4c70db['countbusyretry'],'countcongestionretry':_0x4c70db[_0x5740('0x20')],'countnoanswerretry':_0x4c70db['countnoanswerretry'],'countnosuchnumberretry':_0x4c70db['countnosuchnumberretry'],'countdropretry':_0x4c70db[_0x5740('0x23')],'countabandonedretry':_0x4c70db[_0x5740('0x24')],'countmachineretry':_0x4c70db[_0x5740('0x25')],'countagentrejectretry':_0x4c70db[_0x5740('0x26')],'createdAt':_0x4c70db[_0x5740('0x32')],'updatedAt':_0x4c70db[_0x5740('0x33')]};var _0x458b84={'CmHopperId':_0xb4b7f['id'],'phone':_0x380a99[_0x5740('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x380a99[_0x5740('0x1e')])?0x0:_0x380a99[_0x5740('0x1e')],'scheduledat':_0x22ad5d,'countbusyretry':_0x380a99[_0x5740('0x29')],'countcongestionretry':_0x380a99['countcongestionretry'],'countnoanswerretry':_0x380a99['countnoanswerretry'],'countnosuchnumberretry':_0x380a99['countnosuchnumberretry'],'countdropretry':_0x380a99[_0x5740('0x23')],'countabandonedretry':_0x380a99[_0x5740('0x24')],'countmachineretry':_0x380a99['countmachineretry'],'countagentrejectretry':_0x380a99['countagentrejectretry'],'createdAt':_0x380a99[_0x5740('0x32')],'updatedAt':_0x380a99[_0x5740('0x33')]};return db['sequelize'][_0x5740('0x34')](function(_0x299c9e){return db[_0x5740('0x1d')][_0x5740('0x35')](_0x3d5efb,{'where':{'id':_0x380a99['id']}},{'transaction':_0x299c9e})[_0x5740('0x1c')](function(){return db['CmHopper'][_0x5740('0x35')](_0x458b84,{'where':{'id':_0xb4b7f['id']}},{'transaction':_0x299c9e});});})[_0x5740('0x1c')](function(_0xebc858){_0x5c9027({'id':_0xb4b7f['id'],'phone':_0x380a99[_0x5740('0x31')]});})[_0x5740('0x13')](function(_0x5f0e62){logger[_0x5740('0x10')]('activateAdditionalPhone',_0x5f0e62[_0x5740('0x12')]);_0xc2b45a({'error':_0x5f0e62[_0x5740('0x12')]});});});}exports[_0x5740('0x36')]=function(_0x29406c){var _0x4b0b86=this;return new Promise(function(_0x20a307,_0x149c60){return db['CmHopper']['update'](_0x29406c[_0x5740('0x17')][_0x5740('0x37')],{'where':{'id':_0x29406c[_0x5740('0x17')]['id']}})[_0x5740('0x1c')](function(_0x38c975){_0x20a307(_0x38c975);})[_0x5740('0x13')](function(_0x15653a){logger[_0x5740('0x10')]('IncrementPreviewCounters',_0x15653a[_0x5740('0x12')]);_0x149c60(_0x4b0b86[_0x5740('0x10')](0x1f4,_0x15653a[_0x5740('0x12')]));});});}; \ No newline at end of file +var _0xc007=['CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countmachineretry','updatedAt','countcongestionretry','createdAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4c075b,_0x56c2e7){var _0x228448=function(_0x37c25c){while(--_0x37c25c){_0x4c075b['push'](_0x4c075b['shift']());}};_0x228448(++_0x56c2e7);}(_0xc007,0x183));var _0x7c00=function(_0x8a8a47,_0x2e7105){_0x8a8a47=_0x8a8a47-0x0;var _0x45a1c0=_0xc007[_0x8a8a47];return _0x45a1c0;};'use strict';var _=require(_0x7c00('0x0'));var util=require('util');var moment=require(_0x7c00('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c00('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c00('0x3'));var logger=require(_0x7c00('0x4'))(_0x7c00('0x5'));var config=require(_0x7c00('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7c00('0x7')][_0x7c00('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39df74,_0x15037b,_0x423fc8){return new BPromise(function(_0x53d7bf,_0x232ff6){return client[_0x7c00('0x9')](_0x39df74,_0x423fc8)[_0x7c00('0xa')](function(_0x5b9e62){logger[_0x7c00('0xb')](_0x7c00('0xc'),_0x15037b,'request\x20sent');logger[_0x7c00('0xd')](_0x7c00('0xe'),_0x15037b,_0x7c00('0xf'),JSON[_0x7c00('0x10')](_0x5b9e62));if(_0x5b9e62[_0x7c00('0x11')]){if(_0x5b9e62['error'][_0x7c00('0x12')]===0x1f4){logger[_0x7c00('0x11')](_0x7c00('0xc'),_0x15037b,_0x5b9e62[_0x7c00('0x11')][_0x7c00('0x13')]);return _0x232ff6(_0x5b9e62[_0x7c00('0x11')][_0x7c00('0x13')]);}logger[_0x7c00('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x15037b,_0x5b9e62[_0x7c00('0x11')][_0x7c00('0x13')]);return _0x53d7bf(_0x5b9e62[_0x7c00('0x11')]['message']);}else{logger[_0x7c00('0xb')](_0x7c00('0xc'),_0x15037b,_0x7c00('0xf'));_0x53d7bf(_0x5b9e62[_0x7c00('0x14')][_0x7c00('0x13')]);}})[_0x7c00('0x15')](function(_0x1950da){logger[_0x7c00('0x11')](_0x7c00('0xc'),_0x15037b,_0x1950da);_0x232ff6(_0x1950da);});});}exports[_0x7c00('0x16')]=function(_0x23794a){var _0x262576=this;return new Promise(function(_0x10819f,_0x5a985c){return db[_0x7c00('0x17')][_0x7c00('0x18')]({'raw':!![],'where':{'ContactId':_0x23794a[_0x7c00('0x19')][_0x7c00('0x1a')],'ListId':_0x23794a[_0x7c00('0x19')][_0x7c00('0x1b')],'VoiceQueueId':_0x23794a[_0x7c00('0x19')]['VoiceQueueId']===undefined?null:_0x23794a[_0x7c00('0x19')][_0x7c00('0x1c')],'CampaignId':_0x23794a[_0x7c00('0x19')][_0x7c00('0x1d')]===undefined?null:_0x23794a[_0x7c00('0x19')][_0x7c00('0x1d')]}})[_0x7c00('0xa')](function(_0x13beda){if(_0x13beda!=null){return db[_0x7c00('0x1e')][_0x7c00('0x18')]({'raw':!![],'where':{'CmHopperId':_0x13beda['id'],'OrderBy':{'$gt':_0x13beda[_0x7c00('0x1f')]}},'order':[['OrderBy',_0x7c00('0x20')]]})[_0x7c00('0xa')](function(_0x26e02d){var _0xca9d6a=0x0;if(_0x26e02d){if(_0x26e02d[_0x7c00('0x21')]+_0x26e02d['countcongestionretry']+_0x26e02d[_0x7c00('0x22')]+_0x26e02d['countnosuchnumberretry']+_0x26e02d[_0x7c00('0x23')]+_0x26e02d[_0x7c00('0x24')]+_0x26e02d['countmachineretry']+_0x26e02d[_0x7c00('0x25')]<_0x23794a[_0x7c00('0x26')][_0x7c00('0x27')])_0xca9d6a=0x1;_0x10819f({'additional':_0xca9d6a});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x13beda['id']},'order':[[_0x7c00('0x1f'),_0x7c00('0x20')]]})[_0x7c00('0xa')](function(_0x4669cb){var _0x297465=0x0;if(_0x4669cb){if(_0x4669cb['countbusyretry']+_0x4669cb['countcongestionretry']+_0x4669cb[_0x7c00('0x22')]+_0x4669cb[_0x7c00('0x28')]+_0x4669cb['countdropretry']+_0x4669cb[_0x7c00('0x24')]+_0x4669cb['countmachineretry']+_0x4669cb['countagentrejectretry']<_0x23794a[_0x7c00('0x26')]['dialGlobalMaxRetry'])_0x297465=0x1;_0x10819f({'additional':_0x297465});}else{_0x10819f({'additional':0x0});}})[_0x7c00('0x15')](function(_0x2bfdec){logger[_0x7c00('0x11')](_0x7c00('0x16'),_0x2bfdec[_0x7c00('0x13')]);_0x5a985c(_0x262576['error'](0x1f4,_0x2bfdec[_0x7c00('0x13')]));});}})[_0x7c00('0x15')](function(_0x5e0034){logger['error'](_0x7c00('0x16'),_0x5e0034[_0x7c00('0x13')]);_0x5a985c(_0x262576[_0x7c00('0x11')](0x1f4,_0x5e0034[_0x7c00('0x13')]));});}else _0x10819f({'additional':0x0});});});};exports[_0x7c00('0x29')]=function(_0x5ae6e2){var _0x5e6f5=this;return new Promise(function(_0xfb8fc9,_0x5250e3){return db[_0x7c00('0x17')][_0x7c00('0x18')]({'raw':!![],'where':{'ContactId':_0x5ae6e2[_0x7c00('0x19')]['ContactId'],'ListId':_0x5ae6e2[_0x7c00('0x19')]['ListId'],'VoiceQueueId':_0x5ae6e2[_0x7c00('0x19')][_0x7c00('0x1c')]===undefined?null:_0x5ae6e2[_0x7c00('0x19')][_0x7c00('0x1c')],'CampaignId':_0x5ae6e2['body']['CampaignId']===undefined?null:_0x5ae6e2[_0x7c00('0x19')][_0x7c00('0x1d')]}})[_0x7c00('0xa')](function(_0x2e79ae){if(_0x2e79ae!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2e79ae['id'],'OrderBy':{'$gte':_0x2e79ae[_0x7c00('0x1f')]}},'order':[[_0x7c00('0x1f'),_0x7c00('0x20')]]})['then'](function(_0x4f1b53){if(_0x4f1b53)return activateAdditionalPhone(_0x2e79ae,_0x5ae6e2[_0x7c00('0x19')],_0x4f1b53,_0x5ae6e2[_0x7c00('0x2a')],_0x5ae6e2[_0x7c00('0x2b')])[_0x7c00('0xa')](function(_0x5b6c4b){_0xfb8fc9(_0x5b6c4b);});else{return db['CmHopperAdditionalPhone'][_0x7c00('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2e79ae['id']},'order':[[_0x7c00('0x1f'),_0x7c00('0x20')]]})[_0x7c00('0xa')](function(_0x40a086){if(_0x40a086)return activateAdditionalPhone(_0x2e79ae,_0x5ae6e2[_0x7c00('0x19')],_0x40a086,_0x5ae6e2[_0x7c00('0x2a')],_0x5ae6e2[_0x7c00('0x2b')])['then'](function(_0x53e58f){_0xfb8fc9(_0x53e58f);});else{_0xfb8fc9({'id':_0x2e79ae['id'],'phone':''});}})['catch'](function(_0x341b68){logger[_0x7c00('0x11')](_0x7c00('0x16'),_0x341b68[_0x7c00('0x13')]);_0x5250e3(_0x5e6f5[_0x7c00('0x11')](0x1f4,_0x341b68[_0x7c00('0x13')]));});}})['catch'](function(_0xc1da47){logger[_0x7c00('0x11')]('VerifyAdditionalPhones',_0xc1da47[_0x7c00('0x13')]);_0x5250e3(_0x5e6f5[_0x7c00('0x11')](0x1f4,_0xc1da47['message']));});}else _0xfb8fc9(0x1);});});};function activateAdditionalPhone(_0x3ad245,_0x437696,_0xc3d551,_0x52c035,_0x8dd1bc){return new Promise(function(_0x42da4e,_0x5ecc15){var _0x11e81f;if(_['isNil'](_0xc3d551[_0x7c00('0x2c')])){_0xc3d551[_0x7c00('0x2c')]=moment();}if(moment()>moment(_0xc3d551['scheduledat'])){_0x11e81f=moment()[_0x7c00('0x2d')](_0x8dd1bc||0x3,_0x7c00('0x2e'));}else{if(_0xc3d551[_0x7c00('0x1f')]==0x0){_0x11e81f=moment(_0xc3d551[_0x7c00('0x2c')]);}else{_0x11e81f=moment()[_0x7c00('0x2d')](_0x8dd1bc||0x3,_0x7c00('0x2e'));}}if(_[_0x7c00('0x2f')](_0x11e81f)){_0x11e81f=moment()['add'](_0x8dd1bc||0x3,_0x7c00('0x2e'));}var _0x38bccb={'phone':_0x3ad245[_0x7c00('0x30')],'active':0x0,'OrderBy':_[_0x7c00('0x2f')](_0x3ad245[_0x7c00('0x1f')])?0x0:_0x3ad245[_0x7c00('0x1f')],'scheduledat':moment()[_0x7c00('0x2d')](_0x52c035||0x1,_0x7c00('0x2e')),'countbusyretry':_0x437696[_0x7c00('0x21')],'countcongestionretry':_0x437696['countcongestionretry'],'countnoanswerretry':_0x437696[_0x7c00('0x22')],'countnosuchnumberretry':_0x437696[_0x7c00('0x28')],'countdropretry':_0x437696[_0x7c00('0x23')],'countabandonedretry':_0x437696[_0x7c00('0x24')],'countmachineretry':_0x437696[_0x7c00('0x31')],'countagentrejectretry':_0x437696[_0x7c00('0x25')],'createdAt':_0x437696['createdAt'],'updatedAt':_0x437696[_0x7c00('0x32')]};var _0x3848b4={'CmHopperId':_0x3ad245['id'],'phone':_0xc3d551[_0x7c00('0x30')],'active':0x0,'OrderBy':_[_0x7c00('0x2f')](_0xc3d551[_0x7c00('0x1f')])?0x0:_0xc3d551[_0x7c00('0x1f')],'scheduledat':_0x11e81f,'countbusyretry':_0xc3d551[_0x7c00('0x21')],'countcongestionretry':_0xc3d551[_0x7c00('0x33')],'countnoanswerretry':_0xc3d551[_0x7c00('0x22')],'countnosuchnumberretry':_0xc3d551[_0x7c00('0x28')],'countdropretry':_0xc3d551['countdropretry'],'countabandonedretry':_0xc3d551[_0x7c00('0x24')],'countmachineretry':_0xc3d551[_0x7c00('0x31')],'countagentrejectretry':_0xc3d551[_0x7c00('0x25')],'createdAt':_0xc3d551[_0x7c00('0x34')],'updatedAt':_0xc3d551['updatedAt']};return db[_0x7c00('0x35')][_0x7c00('0x36')](function(_0x33df00){return db[_0x7c00('0x1e')]['update'](_0x38bccb,{'where':{'id':_0xc3d551['id']}},{'transaction':_0x33df00})[_0x7c00('0xa')](function(){return db['CmHopper'][_0x7c00('0x37')](_0x3848b4,{'where':{'id':_0x3ad245['id']}},{'transaction':_0x33df00});});})['then'](function(_0x3a995d){_0x42da4e({'id':_0x3ad245['id'],'phone':_0xc3d551[_0x7c00('0x30')]});})[_0x7c00('0x15')](function(_0x52c66a){logger[_0x7c00('0x11')]('activateAdditionalPhone',_0x52c66a[_0x7c00('0x13')]);_0x5ecc15({'error':_0x52c66a[_0x7c00('0x13')]});});});}exports[_0x7c00('0x38')]=function(_0x5c60f7){var _0x2b85e2=this;return new Promise(function(_0x1940e4,_0x1bea7b){return db[_0x7c00('0x17')]['update'](_0x5c60f7[_0x7c00('0x19')]['field'],{'where':{'id':_0x5c60f7['body']['id']}})[_0x7c00('0xa')](function(_0x25de78){_0x1940e4(_0x25de78);})[_0x7c00('0x15')](function(_0x1af7ee){logger['error'](_0x7c00('0x38'),_0x1af7ee['message']);_0x1bea7b(_0x2b85e2[_0x7c00('0x11')](0x1f4,_0x1af7ee[_0x7c00('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 2fa3438..4cae30c 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x421e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xa267d,_0x13b6e7){var _0x39898a=function(_0x1626a8){while(--_0x1626a8){_0xa267d['push'](_0xa267d['shift']());}};_0x39898a(++_0x13b6e7);}(_0x421e,0x1a1));var _0xe421=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x421e[_0x7ad123];return _0x37d073;};'use strict';var multer=require('multer');var util=require(_0xe421('0x0'));var path=require(_0xe421('0x1'));var timeout=require(_0xe421('0x2'));var express=require(_0xe421('0x3'));var router=express[_0xe421('0x4')]();var fs_extra=require(_0xe421('0x5'));var auth=require(_0xe421('0x6'));var interaction=require(_0xe421('0x7'));var config=require(_0xe421('0x8'));var controller=require(_0xe421('0x9'));router[_0xe421('0xa')]('/',auth[_0xe421('0xb')](),controller[_0xe421('0xc')]);router[_0xe421('0xa')](_0xe421('0xd'),auth['isAuthenticated'](),controller[_0xe421('0xe')]);router['post']('/',auth[_0xe421('0xb')](),controller[_0xe421('0xf')]);router[_0xe421('0x10')](_0xe421('0xd'),auth['isAuthenticated'](),controller[_0xe421('0x11')]);router[_0xe421('0x12')]('/:id',auth[_0xe421('0xb')](),controller[_0xe421('0x13')]);module[_0xe421('0x14')]=router; \ No newline at end of file +var _0x83e4=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x83e4,0x137));var _0x483e=function(_0x31c66c,_0x10ec18){_0x31c66c=_0x31c66c-0x0;var _0x44158d=_0x83e4[_0x31c66c];return _0x44158d;};'use strict';var multer=require(_0x483e('0x0'));var util=require(_0x483e('0x1'));var path=require('path');var timeout=require(_0x483e('0x2'));var express=require(_0x483e('0x3'));var router=express[_0x483e('0x4')]();var fs_extra=require(_0x483e('0x5'));var auth=require(_0x483e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x483e('0x7'));var controller=require(_0x483e('0x8'));router['get']('/',auth[_0x483e('0x9')](),controller[_0x483e('0xa')]);router[_0x483e('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x483e('0xc')](_0x483e('0xd'),auth['isAuthenticated'](),controller[_0x483e('0xe')]);router['delete'](_0x483e('0xd'),auth[_0x483e('0x9')](),controller[_0x483e('0xf')]);module[_0x483e('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4b7d66c..057050a 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 _0x3d30=['contactListQueue','exports','INTEGER'];(function(_0x4089af,_0x392728){var _0x411ad8=function(_0x39d2f6){while(--_0x39d2f6){_0x4089af['push'](_0x4089af['shift']());}};_0x411ad8(++_0x392728);}(_0x3d30,0x6a));var _0x03d3=function(_0x4d5488,_0x3f5190){_0x4d5488=_0x4d5488-0x0;var _0x4d2d3e=_0x3d30[_0x4d5488];return _0x4d2d3e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x03d3('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x03d3('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x03d3('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x03d3('0x2')}}; \ No newline at end of file +var _0x3432=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x298717,_0x34befe){var _0x599ca2=function(_0x399e96){while(--_0x399e96){_0x298717['push'](_0x298717['shift']());}};_0x599ca2(++_0x34befe);}(_0x3432,0x182));var _0x2343=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3432[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x2343('0x0'));var Sequelize=require(_0x2343('0x1'));module[_0x2343('0x2')]={'phone':{'type':Sequelize[_0x2343('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2343('0x4')],'unique':_0x2343('0x5')},'ListId':{'type':Sequelize[_0x2343('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x2343('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f5dbd31..c38f153 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 _0x0cde=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','keys','rawAttributes','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','json'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x0cde,0x1df));var _0xe0cd=function(_0x43b6e9,_0x817765){_0x43b6e9=_0x43b6e9-0x0;var _0x46e8d5=_0x0cde[_0x43b6e9];return _0x46e8d5;};'use strict';var emlformat=require(_0xe0cd('0x0'));var rimraf=require(_0xe0cd('0x1'));var zipdir=require(_0xe0cd('0x2'));var jsonpatch=require(_0xe0cd('0x3'));var rp=require(_0xe0cd('0x4'));var moment=require(_0xe0cd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe0cd('0x6'));var util=require(_0xe0cd('0x7'));var path=require('path');var sox=require(_0xe0cd('0x8'));var csv=require('to-csv');var ejs=require(_0xe0cd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0cd('0xa'));var _=require('lodash');var squel=require(_0xe0cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xe0cd('0xc'));var deskjs=require(_0xe0cd('0xd'));var toCsv=require(_0xe0cd('0xe'));var querystring=require(_0xe0cd('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0cd('0x10'));var authService=require(_0xe0cd('0x11'));var qs=require(_0xe0cd('0x12'));var as=require(_0xe0cd('0x13'));var hardwareService=require(_0xe0cd('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe0cd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x213f8b,_0x3a5225){_0x3a5225=_0x3a5225||0xcc;return function(_0x1fbe28){if(_0x1fbe28){return _0x213f8b[_0xe0cd('0x16')](_0x3a5225);}return _0x213f8b[_0xe0cd('0x17')](_0x3a5225)['end']();};}function respondWithResult(_0x4fb035,_0x5c1e6b){_0x5c1e6b=_0x5c1e6b||0xc8;return function(_0x5d8ccf){if(_0x5d8ccf){return _0x4fb035[_0xe0cd('0x17')](_0x5c1e6b)[_0xe0cd('0x18')](_0x5d8ccf);}};}function respondWithFilteredResult(_0x5409e6,_0x131719){return function(_0x4fb2a8){if(_0x4fb2a8){var _0x544fa3=typeof _0x131719['offset']===_0xe0cd('0x19')&&typeof _0x131719[_0xe0cd('0x1a')]===_0xe0cd('0x19');var _0x23b391=_0x4fb2a8[_0xe0cd('0x1b')];var _0x2a617d=_0x544fa3?0x0:_0x131719[_0xe0cd('0x1c')];var _0x55a0a5=_0x544fa3?_0x4fb2a8['count']:_0x131719[_0xe0cd('0x1c')]+_0x131719[_0xe0cd('0x1a')];var _0x3f66ae;if(_0x55a0a5>=_0x23b391){_0x55a0a5=_0x23b391;_0x3f66ae=0xc8;}else{_0x3f66ae=0xce;}_0x5409e6['status'](_0x3f66ae);return _0x5409e6[_0xe0cd('0x1d')](_0xe0cd('0x1e'),_0x2a617d+'-'+_0x55a0a5+'/'+_0x23b391)[_0xe0cd('0x18')](_0x4fb2a8);}return null;};}function patchUpdates(_0x50282b){return function(_0xa12945){try{jsonpatch[_0xe0cd('0x1f')](_0xa12945,_0x50282b,!![]);}catch(_0x4b4f7e){return BPromise[_0xe0cd('0x20')](_0x4b4f7e);}return _0xa12945[_0xe0cd('0x21')]();};}function saveUpdates(_0x170957,_0x248621){return function(_0x1705b2){if(_0x1705b2){return _0x1705b2[_0xe0cd('0x22')](_0x170957)[_0xe0cd('0x23')](function(_0xc13a86){return _0xc13a86;});}return null;};}function removeEntity(_0x5f1506,_0x93f876){return function(_0x28b69e){if(_0x28b69e){return _0x28b69e[_0xe0cd('0x24')]()[_0xe0cd('0x23')](function(){_0x5f1506[_0xe0cd('0x17')](0xcc)[_0xe0cd('0x25')]();});}};}function handleEntityNotFound(_0x381790,_0x33c90e){return function(_0x5783a4){if(!_0x5783a4){_0x381790['sendStatus'](0x194);}return _0x5783a4;};}function handleError(_0x3e6075,_0x4716e2){_0x4716e2=_0x4716e2||0x1f4;return function(_0x32ef6b){logger[_0xe0cd('0x26')](_0x32ef6b[_0xe0cd('0x27')]);if(_0x32ef6b[_0xe0cd('0x28')]){delete _0x32ef6b[_0xe0cd('0x28')];}_0x3e6075[_0xe0cd('0x17')](_0x4716e2)[_0xe0cd('0x29')](_0x32ef6b);};}exports[_0xe0cd('0x2a')]=function(_0x54628e,_0x153ce7){var _0x18241f={},_0x29f3d1={},_0x29186d={'count':0x0,'rows':[]};var _0x256735=_[_0xe0cd('0x2b')](db[_0xe0cd('0x2c')]['rawAttributes'],function(_0xfa3599){return{'name':_0xfa3599[_0xe0cd('0x2d')],'type':_0xfa3599[_0xe0cd('0x2e')]['key']};});_0x29f3d1['model']=_[_0xe0cd('0x2b')](_0x256735,_0xe0cd('0x28'));_0x29f3d1[_0xe0cd('0x2f')]=_['keys'](_0x54628e[_0xe0cd('0x2f')]);_0x29f3d1[_0xe0cd('0x30')]=_[_0xe0cd('0x31')](_0x29f3d1[_0xe0cd('0x32')],_0x29f3d1['query']);_0x18241f[_0xe0cd('0x33')]=_['intersection'](_0x29f3d1[_0xe0cd('0x32')],qs[_0xe0cd('0x34')](_0x54628e[_0xe0cd('0x2f')][_0xe0cd('0x34')]));_0x18241f[_0xe0cd('0x33')]=_0x18241f[_0xe0cd('0x33')][_0xe0cd('0x35')]?_0x18241f[_0xe0cd('0x33')]:_0x29f3d1[_0xe0cd('0x32')];if(!_0x54628e['query'][_0xe0cd('0x36')]('nolimit')){_0x18241f[_0xe0cd('0x1a')]=qs['limit'](_0x54628e[_0xe0cd('0x2f')]['limit']);_0x18241f['offset']=qs[_0xe0cd('0x1c')](_0x54628e[_0xe0cd('0x2f')][_0xe0cd('0x1c')]);}_0x18241f[_0xe0cd('0x37')]=qs[_0xe0cd('0x38')](_0x54628e[_0xe0cd('0x2f')][_0xe0cd('0x38')]);_0x18241f[_0xe0cd('0x39')]=qs[_0xe0cd('0x30')](_[_0xe0cd('0x3a')](_0x54628e['query'],_0x29f3d1[_0xe0cd('0x30')]),_0x256735);if(_0x54628e[_0xe0cd('0x2f')][_0xe0cd('0x3b')]){_0x18241f[_0xe0cd('0x39')]=_[_0xe0cd('0x3c')](_0x18241f[_0xe0cd('0x39')],{'$or':_[_0xe0cd('0x2b')](_0x256735,function(_0x10f384){if(_0x10f384[_0xe0cd('0x2e')]!==_0xe0cd('0x3d')){var _0x3dc521={};_0x3dc521[_0x10f384['name']]={'$like':'%'+_0x54628e[_0xe0cd('0x2f')][_0xe0cd('0x3b')]+'%'};return _0x3dc521;}})});}_0x18241f=_[_0xe0cd('0x3c')]({},_0x18241f,_0x54628e[_0xe0cd('0x3e')]);var _0x375ce6={'where':_0x18241f[_0xe0cd('0x39')]};return db[_0xe0cd('0x2c')][_0xe0cd('0x1b')](_0x375ce6)[_0xe0cd('0x23')](function(_0x1d7d97){_0x29186d[_0xe0cd('0x1b')]=_0x1d7d97;if(_0x54628e['query']['includeAll']){_0x18241f[_0xe0cd('0x3f')]=[{'all':!![]}];}return db[_0xe0cd('0x2c')][_0xe0cd('0x40')](_0x18241f);})[_0xe0cd('0x23')](function(_0xe1995){_0x29186d['rows']=_0xe1995;return _0x29186d;})[_0xe0cd('0x23')](respondWithFilteredResult(_0x153ce7,_0x18241f))['catch'](handleError(_0x153ce7,null));};exports['show']=function(_0xb7c91e,_0x2e2156){var _0x113aa1={'raw':!![],'where':{'id':_0xb7c91e[_0xe0cd('0x41')]['id']}},_0x127768={};_0x127768[_0xe0cd('0x32')]=_[_0xe0cd('0x42')](db['CmHopperBlack'][_0xe0cd('0x43')]);_0x127768[_0xe0cd('0x2f')]=_[_0xe0cd('0x42')](_0xb7c91e['query']);_0x127768[_0xe0cd('0x30')]=_['intersection'](_0x127768['model'],_0x127768[_0xe0cd('0x2f')]);_0x113aa1['attributes']=_['intersection'](_0x127768[_0xe0cd('0x32')],qs[_0xe0cd('0x34')](_0xb7c91e[_0xe0cd('0x2f')][_0xe0cd('0x34')]));_0x113aa1['attributes']=_0x113aa1[_0xe0cd('0x33')][_0xe0cd('0x35')]?_0x113aa1['attributes']:_0x127768[_0xe0cd('0x32')];if(_0xb7c91e[_0xe0cd('0x2f')]['includeAll']){_0x113aa1[_0xe0cd('0x3f')]=[{'all':!![]}];}_0x113aa1=_[_0xe0cd('0x3c')]({},_0x113aa1,_0xb7c91e['options']);return db[_0xe0cd('0x2c')]['find'](_0x113aa1)['then'](handleEntityNotFound(_0x2e2156,null))[_0xe0cd('0x23')](respondWithResult(_0x2e2156,null))[_0xe0cd('0x44')](handleError(_0x2e2156,null));};exports[_0xe0cd('0x22')]=function(_0x21c6f5,_0x402f23){if(_0x21c6f5[_0xe0cd('0x45')]['id']){delete _0x21c6f5[_0xe0cd('0x45')]['id'];}return db['CmHopperBlack'][_0xe0cd('0x46')]({'where':{'id':_0x21c6f5[_0xe0cd('0x41')]['id']}})[_0xe0cd('0x23')](handleEntityNotFound(_0x402f23,null))[_0xe0cd('0x23')](saveUpdates(_0x21c6f5[_0xe0cd('0x45')],null))[_0xe0cd('0x23')](respondWithResult(_0x402f23,null))[_0xe0cd('0x44')](handleError(_0x402f23,null));};exports[_0xe0cd('0x24')]=function(_0x5b9f02,_0x45c5ca){return db[_0xe0cd('0x2c')][_0xe0cd('0x46')]({'where':{'id':_0x5b9f02[_0xe0cd('0x41')]['id']}})['then'](handleEntityNotFound(_0x45c5ca,null))[_0xe0cd('0x23')](removeEntity(_0x45c5ca,null))[_0xe0cd('0x44')](handleError(_0x45c5ca,null));};exports[_0xe0cd('0x47')]=function(_0x397c13,_0x17f3fc){return db[_0xe0cd('0x2c')][_0xe0cd('0x47')]()['then'](respondWithResult(_0x17f3fc,null))['catch'](handleError(_0x17f3fc,null));}; \ No newline at end of file +var _0x9689=['sox','ejs','fs-extra','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','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','CmHopperBlack','count','includeAll','findAll','rows','catch','show','include','update','find','params','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x1ba95c,_0x5c21cf){var _0x1677b8=function(_0xbca31d){while(--_0xbca31d){_0x1ba95c['push'](_0x1ba95c['shift']());}};_0x1677b8(++_0x5c21cf);}(_0x9689,0xd4));var _0x9968=function(_0x2d5a81,_0x333908){_0x2d5a81=_0x2d5a81-0x0;var _0x2d5e86=_0x9689[_0x2d5a81];return _0x2d5e86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9968('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9968('0x1'));var rp=require(_0x9968('0x2'));var moment=require(_0x9968('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9968('0x4'));var util=require(_0x9968('0x5'));var path=require(_0x9968('0x6'));var sox=require(_0x9968('0x7'));var csv=require('to-csv');var ejs=require(_0x9968('0x8'));var fs=require('fs');var fs_extra=require(_0x9968('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9968('0xa'));var jsforce=require(_0x9968('0xb'));var deskjs=require(_0x9968('0xc'));var toCsv=require(_0x9968('0xd'));var querystring=require(_0x9968('0xe'));var Papa=require(_0x9968('0xf'));var Redis=require(_0x9968('0x10'));var authService=require(_0x9968('0x11'));var qs=require(_0x9968('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9968('0x13'));var logger=require('../../config/logger')(_0x9968('0x14'));var utils=require(_0x9968('0x15'));var config=require(_0x9968('0x16'));var licenseUtil=require(_0x9968('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45167d,_0x560aa5){_0x560aa5=_0x560aa5||0xcc;return function(_0x3ca0a2){if(_0x3ca0a2){return _0x45167d[_0x9968('0x18')](_0x560aa5);}return _0x45167d[_0x9968('0x19')](_0x560aa5)['end']();};}function respondWithResult(_0x2c0ac2,_0x44fd3c){_0x44fd3c=_0x44fd3c||0xc8;return function(_0x3cc909){if(_0x3cc909){return _0x2c0ac2[_0x9968('0x19')](_0x44fd3c)[_0x9968('0x1a')](_0x3cc909);}};}function respondWithFilteredResult(_0x54b5a1,_0x36a6c2){return function(_0x3607e1){if(_0x3607e1){var _0x3ff642=typeof _0x36a6c2['offset']==='undefined'&&typeof _0x36a6c2[_0x9968('0x1b')]===_0x9968('0x1c');var _0x446507=_0x3607e1['count'];var _0x4a59ba=_0x3ff642?0x0:_0x36a6c2[_0x9968('0x1d')];var _0x41d91a=_0x3ff642?_0x3607e1['count']:_0x36a6c2[_0x9968('0x1d')]+_0x36a6c2[_0x9968('0x1b')];var _0x44ecae;if(_0x41d91a>=_0x446507){_0x41d91a=_0x446507;_0x44ecae=0xc8;}else{_0x44ecae=0xce;}_0x54b5a1[_0x9968('0x19')](_0x44ecae);return _0x54b5a1[_0x9968('0x1e')](_0x9968('0x1f'),_0x4a59ba+'-'+_0x41d91a+'/'+_0x446507)[_0x9968('0x1a')](_0x3607e1);}return null;};}function patchUpdates(_0x25bf69){return function(_0x126fcb){try{jsonpatch[_0x9968('0x20')](_0x126fcb,_0x25bf69,!![]);}catch(_0x5f1551){return BPromise[_0x9968('0x21')](_0x5f1551);}return _0x126fcb[_0x9968('0x22')]();};}function saveUpdates(_0x55c7bd,_0x159ff2){return function(_0x57199c){if(_0x57199c){return _0x57199c['update'](_0x55c7bd)[_0x9968('0x23')](function(_0xdb7bc9){return _0xdb7bc9;});}return null;};}function removeEntity(_0x26346b,_0x2474d0){return function(_0x61254f){if(_0x61254f){return _0x61254f[_0x9968('0x24')]()[_0x9968('0x23')](function(){_0x26346b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x331c72,_0x523182){return function(_0x4604a0){if(!_0x4604a0){_0x331c72[_0x9968('0x18')](0x194);}return _0x4604a0;};}function handleError(_0x56e240,_0x1d0fdc){_0x1d0fdc=_0x1d0fdc||0x1f4;return function(_0x3ebb80){logger['error'](_0x3ebb80[_0x9968('0x25')]);if(_0x3ebb80['name']){delete _0x3ebb80[_0x9968('0x26')];}_0x56e240[_0x9968('0x19')](_0x1d0fdc)['send'](_0x3ebb80);};}exports[_0x9968('0x27')]=function(_0x1da2f8,_0x5a8817){var _0x41343e={},_0x7af923={},_0x34fec9={'count':0x0,'rows':[]};var _0x54cb26=_[_0x9968('0x28')](db['CmHopperBlack'][_0x9968('0x29')],function(_0x3d4d8d){return{'name':_0x3d4d8d[_0x9968('0x2a')],'type':_0x3d4d8d[_0x9968('0x2b')]['key']};});_0x7af923['model']=_[_0x9968('0x28')](_0x54cb26,_0x9968('0x26'));_0x7af923[_0x9968('0x2c')]=_[_0x9968('0x2d')](_0x1da2f8[_0x9968('0x2c')]);_0x7af923[_0x9968('0x2e')]=_[_0x9968('0x2f')](_0x7af923[_0x9968('0x30')],_0x7af923[_0x9968('0x2c')]);_0x41343e[_0x9968('0x31')]=_['intersection'](_0x7af923['model'],qs[_0x9968('0x32')](_0x1da2f8[_0x9968('0x2c')]['fields']));_0x41343e[_0x9968('0x31')]=_0x41343e['attributes'][_0x9968('0x33')]?_0x41343e[_0x9968('0x31')]:_0x7af923[_0x9968('0x30')];if(!_0x1da2f8['query'][_0x9968('0x34')]('nolimit')){_0x41343e[_0x9968('0x1b')]=qs['limit'](_0x1da2f8[_0x9968('0x2c')][_0x9968('0x1b')]);_0x41343e[_0x9968('0x1d')]=qs[_0x9968('0x1d')](_0x1da2f8[_0x9968('0x2c')][_0x9968('0x1d')]);}_0x41343e[_0x9968('0x35')]=qs[_0x9968('0x36')](_0x1da2f8[_0x9968('0x2c')][_0x9968('0x36')]);_0x41343e['where']=qs['filters'](_['pick'](_0x1da2f8[_0x9968('0x2c')],_0x7af923[_0x9968('0x2e')]),_0x54cb26);if(_0x1da2f8['query'][_0x9968('0x37')]){_0x41343e[_0x9968('0x38')]=_[_0x9968('0x39')](_0x41343e['where'],{'$or':_[_0x9968('0x28')](_0x54cb26,function(_0x42453a){if(_0x42453a[_0x9968('0x2b')]!==_0x9968('0x3a')){var _0x42dd9e={};_0x42dd9e[_0x42453a[_0x9968('0x26')]]={'$like':'%'+_0x1da2f8['query'][_0x9968('0x37')]+'%'};return _0x42dd9e;}})});}_0x41343e=_['merge']({},_0x41343e,_0x1da2f8[_0x9968('0x3b')]);var _0x107b7c={'where':_0x41343e[_0x9968('0x38')]};return db[_0x9968('0x3c')][_0x9968('0x3d')](_0x107b7c)[_0x9968('0x23')](function(_0xe6eb4f){_0x34fec9[_0x9968('0x3d')]=_0xe6eb4f;if(_0x1da2f8['query'][_0x9968('0x3e')]){_0x41343e['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x9968('0x3f')](_0x41343e);})['then'](function(_0x35c943){_0x34fec9[_0x9968('0x40')]=_0x35c943;return _0x34fec9;})[_0x9968('0x23')](respondWithFilteredResult(_0x5a8817,_0x41343e))[_0x9968('0x41')](handleError(_0x5a8817,null));};exports[_0x9968('0x42')]=function(_0x4c7f97,_0x12152c){var _0x8c903={'raw':!![],'where':{'id':_0x4c7f97['params']['id']}},_0x47a53b={};_0x47a53b[_0x9968('0x30')]=_['keys'](db['CmHopperBlack'][_0x9968('0x29')]);_0x47a53b[_0x9968('0x2c')]=_[_0x9968('0x2d')](_0x4c7f97[_0x9968('0x2c')]);_0x47a53b['filters']=_[_0x9968('0x2f')](_0x47a53b['model'],_0x47a53b[_0x9968('0x2c')]);_0x8c903[_0x9968('0x31')]=_['intersection'](_0x47a53b[_0x9968('0x30')],qs[_0x9968('0x32')](_0x4c7f97[_0x9968('0x2c')]['fields']));_0x8c903['attributes']=_0x8c903[_0x9968('0x31')][_0x9968('0x33')]?_0x8c903[_0x9968('0x31')]:_0x47a53b[_0x9968('0x30')];if(_0x4c7f97['query'][_0x9968('0x3e')]){_0x8c903[_0x9968('0x43')]=[{'all':!![]}];}_0x8c903=_[_0x9968('0x39')]({},_0x8c903,_0x4c7f97[_0x9968('0x3b')]);return db[_0x9968('0x3c')]['find'](_0x8c903)[_0x9968('0x23')](handleEntityNotFound(_0x12152c,null))['then'](respondWithResult(_0x12152c,null))['catch'](handleError(_0x12152c,null));};exports[_0x9968('0x44')]=function(_0x5d862f,_0x43b4e0){if(_0x5d862f['body']['id']){delete _0x5d862f['body']['id'];}return db[_0x9968('0x3c')][_0x9968('0x45')]({'where':{'id':_0x5d862f[_0x9968('0x46')]['id']}})[_0x9968('0x23')](handleEntityNotFound(_0x43b4e0,null))[_0x9968('0x23')](saveUpdates(_0x5d862f[_0x9968('0x47')],null))[_0x9968('0x23')](respondWithResult(_0x43b4e0,null))[_0x9968('0x41')](handleError(_0x43b4e0,null));};exports[_0x9968('0x24')]=function(_0x50b912,_0xe20a2b){return db[_0x9968('0x3c')][_0x9968('0x45')]({'where':{'id':_0x50b912['params']['id']}})[_0x9968('0x23')](handleEntityNotFound(_0xe20a2b,null))[_0x9968('0x23')](removeEntity(_0xe20a2b,null))[_0x9968('0x41')](handleError(_0xe20a2b,null));};exports[_0x9968('0x48')]=function(_0x28e634,_0x304233){return db['CmHopperBlack']['describe']()[_0x9968('0x23')](respondWithResult(_0x304233,null))[_0x9968('0x41')](handleError(_0x304233,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ffb8f87..de82908 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 _0xd38c=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1661f8,_0x3408e4){var _0x17ed20=function(_0x485964){while(--_0x485964){_0x1661f8['push'](_0x1661f8['shift']());}};_0x17ed20(++_0x3408e4);}(_0xd38c,0x166));var _0xcd38=function(_0xf8d01a,_0x2b713d){_0xf8d01a=_0xf8d01a-0x0;var _0x4d048d=_0xd38c[_0xf8d01a];return _0x4d048d;};'use strict';var _=require(_0xcd38('0x0'));var util=require('util');var logger=require(_0xcd38('0x1'))(_0xcd38('0x2'));var moment=require(_0xcd38('0x3'));var BPromise=require(_0xcd38('0x4'));var rp=require(_0xcd38('0x5'));var fs=require('fs');var path=require(_0xcd38('0x6'));var rimraf=require(_0xcd38('0x7'));var config=require(_0xcd38('0x8'));var attributes=require(_0xcd38('0x9'));module[_0xcd38('0xa')]=function(_0x360750,_0x52e0dd){return _0x360750[_0xcd38('0xb')](_0xcd38('0xc'),attributes,{'tableName':_0xcd38('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe546=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x3fa4fc,_0x4a3bf7){var _0x231594=function(_0x432485){while(--_0x432485){_0x3fa4fc['push'](_0x3fa4fc['shift']());}};_0x231594(++_0x4a3bf7);}(_0xe546,0x95));var _0x6e54=function(_0x22b466,_0x38498f){_0x22b466=_0x22b466-0x0;var _0x24c459=_0xe546[_0x22b466];return _0x24c459;};'use strict';var _=require(_0x6e54('0x0'));var util=require(_0x6e54('0x1'));var logger=require(_0x6e54('0x2'))(_0x6e54('0x3'));var moment=require(_0x6e54('0x4'));var BPromise=require(_0x6e54('0x5'));var rp=require(_0x6e54('0x6'));var fs=require('fs');var path=require(_0x6e54('0x7'));var rimraf=require('rimraf');var config=require(_0x6e54('0x8'));var attributes=require(_0x6e54('0x9'));module[_0x6e54('0xa')]=function(_0x26dda0,_0x2fa138){return _0x26dda0[_0x6e54('0xb')](_0x6e54('0xc'),attributes,{'tableName':_0x6e54('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index d51f66f..4f8aa8e 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 _0x568f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x23ed30,_0x116aff){var _0x9e6b82=function(_0x228702){while(--_0x228702){_0x23ed30['push'](_0x23ed30['shift']());}};_0x9e6b82(++_0x116aff);}(_0x568f,0xf3));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf568('0x0'));var util=require(_0xf568('0x1'));var moment=require(_0xf568('0x2'));var BPromise=require('bluebird');var rs=require(_0xf568('0x3'));var fs=require('fs');var Redis=require(_0xf568('0x4'));var db=require(_0xf568('0x5'))['db'];var utils=require(_0xf568('0x6'));var logger=require(_0xf568('0x7'))(_0xf568('0x8'));var config=require(_0xf568('0x9'));var jayson=require(_0xf568('0xa'));var client=jayson[_0xf568('0xb')][_0xf568('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52a099,_0x151074,_0x27056c){return new BPromise(function(_0x3b77f8,_0x19a251){return client['request'](_0x52a099,_0x27056c)[_0xf568('0xd')](function(_0x8df0e5){logger[_0xf568('0xe')](_0xf568('0xf'),_0x151074,'request\x20sent');logger[_0xf568('0x10')](_0xf568('0x11'),_0x151074,_0xf568('0x12'),JSON[_0xf568('0x13')](_0x8df0e5));if(_0x8df0e5['error']){if(_0x8df0e5[_0xf568('0x14')][_0xf568('0x15')]===0x1f4){logger[_0xf568('0x14')](_0xf568('0xf'),_0x151074,_0x8df0e5[_0xf568('0x14')][_0xf568('0x16')]);return _0x19a251(_0x8df0e5['error'][_0xf568('0x16')]);}logger[_0xf568('0x14')](_0xf568('0xf'),_0x151074,_0x8df0e5[_0xf568('0x14')]['message']);return _0x3b77f8(_0x8df0e5[_0xf568('0x14')][_0xf568('0x16')]);}else{logger[_0xf568('0xe')](_0xf568('0xf'),_0x151074,_0xf568('0x12'));_0x3b77f8(_0x8df0e5[_0xf568('0x17')][_0xf568('0x16')]);}})[_0xf568('0x18')](function(_0x2ecd74){logger['error'](_0xf568('0xf'),_0x151074,_0x2ecd74);_0x19a251(_0x2ecd74);});});}exports[_0xf568('0x19')]=function(_0x86b3e){var _0x22c500=this;return new Promise(function(_0x8c494b,_0x1198cc){return db[_0xf568('0x1a')][_0xf568('0x1b')]({'raw':_0x86b3e[_0xf568('0x1c')]?_0x86b3e[_0xf568('0x1c')][_0xf568('0x1d')]===undefined?!![]:![]:!![],'where':_0x86b3e[_0xf568('0x1c')]?_0x86b3e[_0xf568('0x1c')][_0xf568('0x1e')]||null:null,'attributes':_0x86b3e['options']?_0x86b3e['options'][_0xf568('0x1f')]||null:null,'limit':_0x86b3e[_0xf568('0x1c')]?_0x86b3e[_0xf568('0x1c')][_0xf568('0x20')]||null:null,'include':_0x86b3e[_0xf568('0x1c')]?_0x86b3e[_0xf568('0x1c')][_0xf568('0x21')]?_[_0xf568('0x22')](_0x86b3e[_0xf568('0x1c')]['include'],function(_0x3e12ce){return{'model':db[_0x3e12ce[_0xf568('0x23')]],'as':_0x3e12ce['as'],'attributes':_0x3e12ce[_0xf568('0x1f')],'include':_0x3e12ce['include']?_[_0xf568('0x22')](_0x3e12ce[_0xf568('0x21')],function(_0x3bac9e){return{'model':db[_0x3bac9e['model']],'as':_0x3bac9e['as'],'attributes':_0x3bac9e['attributes'],'include':_0x3bac9e[_0xf568('0x21')]?_[_0xf568('0x22')](_0x3bac9e['include'],function(_0x9126fc){return{'model':db[_0x9126fc[_0xf568('0x23')]],'as':_0x9126fc['as'],'attributes':_0x9126fc[_0xf568('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf568('0xd')](function(_0x400a1f){logger['info'](_0xf568('0x19'),_0x86b3e);logger['debug'](_0xf568('0x19'),_0x86b3e,JSON['stringify'](_0x400a1f));_0x8c494b(_0x400a1f);})[_0xf568('0x18')](function(_0x3114ab){logger['error'](_0xf568('0x19'),_0x3114ab[_0xf568('0x16')],_0x86b3e);_0x1198cc(_0x22c500[_0xf568('0x14')](0x1f4,_0x3114ab[_0xf568('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x30e463){var _0x50a633=this;return new Promise(function(_0x25efe5,_0x19dc56){return db[_0xf568('0x1a')][_0xf568('0x24')](_0x30e463[_0xf568('0x25')],{'raw':_0x30e463[_0xf568('0x1c')]?_0x30e463[_0xf568('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e463['options']?_0x30e463[_0xf568('0x1c')][_0xf568('0x1e')]||null:null,'attributes':_0x30e463['options']?_0x30e463[_0xf568('0x1c')][_0xf568('0x1f')]||null:null,'limit':_0x30e463[_0xf568('0x1c')]?_0x30e463[_0xf568('0x1c')][_0xf568('0x20')]||null:null})[_0xf568('0xd')](function(_0x36d089){logger[_0xf568('0xe')](_0xf568('0x26'),_0x30e463);logger[_0xf568('0x10')](_0xf568('0x26'),_0x30e463,JSON[_0xf568('0x13')](_0x36d089));_0x25efe5(_0x36d089);})['catch'](function(_0x520f7b){logger['error'](_0xf568('0x26'),_0x520f7b[_0xf568('0x16')],_0x30e463);_0x19dc56(_0x50a633[_0xf568('0x14')](0x1f4,_0x520f7b[_0xf568('0x16')]));});});};exports[_0xf568('0x27')]=function(_0x271541){var _0x53a7b1=this;return new Promise(function(_0x36bf17,_0x4e56e0){return db[_0xf568('0x1a')][_0xf568('0x28')]({'where':_0x271541[_0xf568('0x1c')]?_0x271541[_0xf568('0x1c')][_0xf568('0x1e')]||null:null})[_0xf568('0xd')](function(_0xa42a04){logger['info'](_0xf568('0x27'),_0x271541);logger[_0xf568('0x10')](_0xf568('0x27'),_0x271541,JSON['stringify'](_0xa42a04));_0x36bf17(_0xa42a04);})[_0xf568('0x18')](function(_0x445d8e){logger[_0xf568('0x14')](_0xf568('0x27'),_0x445d8e[_0xf568('0x16')],_0x271541);_0x4e56e0(_0x53a7b1[_0xf568('0x14')](0x1f4,_0x445d8e[_0xf568('0x16')]));});});}; \ No newline at end of file +var _0x64ea=['UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','stringify','catch'];(function(_0x32bdbf,_0x11689b){var _0x4bc887=function(_0x47d481){while(--_0x47d481){_0x32bdbf['push'](_0x32bdbf['shift']());}};_0x4bc887(++_0x11689b);}(_0x64ea,0x95));var _0xa64e=function(_0xe6e3e2,_0x2b01da){_0xe6e3e2=_0xe6e3e2-0x0;var _0x126571=_0x64ea[_0xe6e3e2];return _0x126571;};'use strict';var _=require(_0xa64e('0x0'));var util=require(_0xa64e('0x1'));var moment=require(_0xa64e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa64e('0x3'));var fs=require('fs');var Redis=require(_0xa64e('0x4'));var db=require(_0xa64e('0x5'))['db'];var utils=require(_0xa64e('0x6'));var logger=require(_0xa64e('0x7'))('rpc');var config=require(_0xa64e('0x8'));var jayson=require(_0xa64e('0x9'));var client=jayson[_0xa64e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a599d,_0x9080f8,_0x24344b){return new BPromise(function(_0x1d433a,_0x5a5ba8){return client['request'](_0x1a599d,_0x24344b)[_0xa64e('0xb')](function(_0x47ca78){logger[_0xa64e('0xc')](_0xa64e('0xd'),_0x9080f8,_0xa64e('0xe'));logger[_0xa64e('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x9080f8,_0xa64e('0xe'),JSON['stringify'](_0x47ca78));if(_0x47ca78[_0xa64e('0x10')]){if(_0x47ca78['error']['code']===0x1f4){logger[_0xa64e('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x9080f8,_0x47ca78[_0xa64e('0x10')][_0xa64e('0x11')]);return _0x5a5ba8(_0x47ca78[_0xa64e('0x10')][_0xa64e('0x11')]);}logger[_0xa64e('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x9080f8,_0x47ca78[_0xa64e('0x10')][_0xa64e('0x11')]);return _0x1d433a(_0x47ca78[_0xa64e('0x10')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x9080f8,_0xa64e('0xe'));_0x1d433a(_0x47ca78[_0xa64e('0x12')]['message']);}})['catch'](function(_0xec660){logger[_0xa64e('0x10')](_0xa64e('0xd'),_0x9080f8,_0xec660);_0x5a5ba8(_0xec660);});});}exports[_0xa64e('0x13')]=function(_0x2dbb2e){var _0x198fef=this;return new Promise(function(_0x4dcb18,_0x31cb1f){return db[_0xa64e('0x14')][_0xa64e('0x15')]({'raw':_0x2dbb2e[_0xa64e('0x16')]?_0x2dbb2e[_0xa64e('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2dbb2e[_0xa64e('0x16')]?_0x2dbb2e['options'][_0xa64e('0x17')]||null:null,'attributes':_0x2dbb2e['options']?_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x18')]||null:null,'limit':_0x2dbb2e['options']?_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x19')]||null:null,'include':_0x2dbb2e[_0xa64e('0x16')]?_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x1a')]?_['map'](_0x2dbb2e[_0xa64e('0x16')][_0xa64e('0x1a')],function(_0x288fed){return{'model':db[_0x288fed[_0xa64e('0x1b')]],'as':_0x288fed['as'],'attributes':_0x288fed['attributes'],'include':_0x288fed[_0xa64e('0x1a')]?_[_0xa64e('0x1c')](_0x288fed[_0xa64e('0x1a')],function(_0x2241db){return{'model':db[_0x2241db[_0xa64e('0x1b')]],'as':_0x2241db['as'],'attributes':_0x2241db[_0xa64e('0x18')],'include':_0x2241db[_0xa64e('0x1a')]?_[_0xa64e('0x1c')](_0x2241db['include'],function(_0x367506){return{'model':db[_0x367506[_0xa64e('0x1b')]],'as':_0x367506['as'],'attributes':_0x367506[_0xa64e('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa64e('0xb')](function(_0x5be4b0){logger[_0xa64e('0xc')]('GetCmHopperBlack',_0x2dbb2e);logger['debug']('GetCmHopperBlack',_0x2dbb2e,JSON[_0xa64e('0x1d')](_0x5be4b0));_0x4dcb18(_0x5be4b0);})[_0xa64e('0x1e')](function(_0x2a9eb8){logger[_0xa64e('0x10')](_0xa64e('0x13'),_0x2a9eb8[_0xa64e('0x11')],_0x2dbb2e);_0x31cb1f(_0x198fef[_0xa64e('0x10')](0x1f4,_0x2a9eb8['message']));});});};exports[_0xa64e('0x1f')]=function(_0xd38d29){var _0x377682=this;return new Promise(function(_0x399d07,_0x19d3ca){return db[_0xa64e('0x14')][_0xa64e('0x20')](_0xd38d29[_0xa64e('0x21')],{'raw':_0xd38d29['options']?_0xd38d29[_0xa64e('0x16')][_0xa64e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd38d29[_0xa64e('0x16')]?_0xd38d29[_0xa64e('0x16')][_0xa64e('0x17')]||null:null,'attributes':_0xd38d29[_0xa64e('0x16')]?_0xd38d29[_0xa64e('0x16')][_0xa64e('0x18')]||null:null,'limit':_0xd38d29[_0xa64e('0x16')]?_0xd38d29[_0xa64e('0x16')]['limit']||null:null})[_0xa64e('0xb')](function(_0x532e5e){logger[_0xa64e('0xc')](_0xa64e('0x1f'),_0xd38d29);logger[_0xa64e('0xf')](_0xa64e('0x1f'),_0xd38d29,JSON[_0xa64e('0x1d')](_0x532e5e));_0x399d07(_0x532e5e);})[_0xa64e('0x1e')](function(_0x20dbe9){logger[_0xa64e('0x10')](_0xa64e('0x1f'),_0x20dbe9[_0xa64e('0x11')],_0xd38d29);_0x19d3ca(_0x377682['error'](0x1f4,_0x20dbe9[_0xa64e('0x11')]));});});};exports[_0xa64e('0x23')]=function(_0x3d88d0){var _0x5210f6=this;return new Promise(function(_0x4e839f,_0x3fa1b0){return db[_0xa64e('0x14')]['destroy']({'where':_0x3d88d0[_0xa64e('0x16')]?_0x3d88d0['options'][_0xa64e('0x17')]||null:null})[_0xa64e('0xb')](function(_0x2c0337){logger[_0xa64e('0xc')](_0xa64e('0x23'),_0x3d88d0);logger[_0xa64e('0xf')](_0xa64e('0x23'),_0x3d88d0,JSON[_0xa64e('0x1d')](_0x2c0337));_0x4e839f(_0x2c0337);})['catch'](function(_0x31a751){logger[_0xa64e('0x10')](_0xa64e('0x23'),_0x31a751[_0xa64e('0x11')],_0x3d88d0);_0x3fa1b0(_0x5210f6[_0xa64e('0x10')](0x1f4,_0x31a751['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c4dacf7..d8a23b1 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 _0x4819=['show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','/describe','describe','get','/:id'];(function(_0x47d563,_0x13d257){var _0x46f9d8=function(_0x11d8ca){while(--_0x11d8ca){_0x47d563['push'](_0x47d563['shift']());}};_0x46f9d8(++_0x13d257);}(_0x4819,0xcd));var _0x9481=function(_0x55456f,_0x3f561a){_0x55456f=_0x55456f-0x0;var _0x34d223=_0x4819[_0x55456f];return _0x34d223;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router[_0x9481('0x11')](_0x9481('0xe'),auth[_0x9481('0xa')](),controller[_0x9481('0x12')]);module[_0x9481('0x13')]=router; \ No newline at end of file +var _0x2675=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','exports','multer','express','Router'];(function(_0x5ca22f,_0x25f406){var _0x58357d=function(_0x5938d0){while(--_0x5938d0){_0x5ca22f['push'](_0x5ca22f['shift']());}};_0x58357d(++_0x25f406);}(_0x2675,0x75));var _0x5267=function(_0x232bdd,_0x51e3f7){_0x232bdd=_0x232bdd-0x0;var _0x429ce9=_0x2675[_0x232bdd];return _0x429ce9;};'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')]('/',auth[_0x5267('0x7')](),controller[_0x5267('0x8')]);router[_0x5267('0x6')](_0x5267('0x9'),auth['isAuthenticated'](),controller[_0x5267('0xa')]);router[_0x5267('0x6')]('/:id',auth[_0x5267('0x7')](),controller['show']);router[_0x5267('0xb')](_0x5267('0xc'),auth[_0x5267('0x7')](),controller['update']);router[_0x5267('0xd')]('/:id',auth[_0x5267('0x7')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f761258..6fd476e 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 _0x1d1c=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x42a4b7,_0x2a8f76){var _0x44d32a=function(_0x2b7268){while(--_0x2b7268){_0x42a4b7['push'](_0x42a4b7['shift']());}};_0x44d32a(++_0x2a8f76);}(_0x1d1c,0xe0));var _0xc1d1=function(_0x108535,_0x4d2a30){_0x108535=_0x108535-0x0;var _0x51db74=_0x1d1c[_0x108535];return _0x51db74;};'use strict';var Sequelize=require(_0xc1d1('0x0'));var moment=require(_0xc1d1('0x1'));module[_0xc1d1('0x2')]={'state':{'type':Sequelize[_0xc1d1('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xc1d1('0x4')]},'scheduledat':{'type':Sequelize[_0xc1d1('0x5')]},'countbusyretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc1d1('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xc1d1('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc1d1('0x4')]},'starttime':{'type':Sequelize[_0xc1d1('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc1d1('0x5')]},'ringtime':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xc1d1('0x4')]},'campaigntype':{'type':Sequelize[_0xc1d1('0x4')]},'membername':{'type':Sequelize[_0xc1d1('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc1d1('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc1d1('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x36d531){var _0x185cc8=this[_0xc1d1('0x6')](_0xc1d1('0x7'));if(_0x185cc8&&_0x36d531){this[_0xc1d1('0x8')](_0xc1d1('0x9'),moment(_0x36d531)[_0xc1d1('0xa')](moment(_0x185cc8),_0xc1d1('0xb')));}}},'amd':{'type':Sequelize[_0xc1d1('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc1d1('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc1d1('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc1d1('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xc1d1('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc1d1('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xc1d1('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc1d1('0x5')]},'recallme':{'type':Sequelize[_0xc1d1('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc1d1('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf8c8=['getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0x2cff83,_0x53fad8){var _0x434ce5=function(_0x335409){while(--_0x335409){_0x2cff83['push'](_0x2cff83['shift']());}};_0x434ce5(++_0x53fad8);}(_0xf8c8,0xcc));var _0x8f8c=function(_0x3e1cf2,_0x43c83f){_0x3e1cf2=_0x3e1cf2-0x0;var _0x58bae5=_0xf8c8[_0x3e1cf2];return _0x58bae5;};'use strict';var Sequelize=require(_0x8f8c('0x0'));var moment=require('moment');module[_0x8f8c('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8f8c('0x2')]},'countbusyretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8f8c('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8f8c('0x4')]},'calleridnum':{'type':Sequelize[_0x8f8c('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8f8c('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8f8c('0x2')]},'droptime':{'type':Sequelize[_0x8f8c('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8f8c('0x4')]},'campaign':{'type':Sequelize[_0x8f8c('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8f8c('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x8f8c('0x4')]},'secondDisposition':{'type':Sequelize[_0x8f8c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8f8c('0x4')]},'dispositionat':{'type':Sequelize[_0x8f8c('0x2')],'set':function(_0x649b85){var _0x1d077c=this[_0x8f8c('0x5')](_0x8f8c('0x6'));if(_0x1d077c&&_0x649b85){this[_0x8f8c('0x7')](_0x8f8c('0x8'),moment(_0x649b85)[_0x8f8c('0x9')](moment(_0x1d077c),'seconds'));}}},'amd':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8f8c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8f8c('0x2')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8f8c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8f8c('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8f8c('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8f8c('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f8c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index c42ecca..73a4985 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 _0xfcf0=['noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null'];(function(_0x401821,_0x4f1094){var _0x3bbd50=function(_0x267b7c){while(--_0x267b7c){_0x401821['push'](_0x401821['shift']());}};_0x3bbd50(++_0x4f1094);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0xfcf0[_0x3fb030];return _0xd6899b;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')]()[_0x0fcf('0x24')](respondWithResult(_0x345188,null))['catch'](handleError(_0x345188,null));};exports['update']=function(_0x259c91,_0x243699){if(_0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')]){delete _0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')];}return db['CmHopperFinal'][_0x0fcf('0x49')]({'where':{'uniqueid':_0x259c91[_0x0fcf('0x43')]['id']}})['then'](handleEntityNotFound(_0x243699,null))[_0x0fcf('0x24')](saveUpdates(_0x259c91[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x243699,null))[_0x0fcf('0x42')](handleError(_0x243699,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xc514bf,_0x382448,_0x1bb062){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'VoiceQueueId':_0xc514bf[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x4e')))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')]['literal'](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0fcf('0x56')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),'abandonedContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x0fcf('0x58')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x59')))),_0x0fcf('0x5a')]]})[_0x0fcf('0x24')](handleEntityNotFound(_0x382448,null))[_0x0fcf('0x24')](respondWithResult(_0x382448,null))[_0x0fcf('0x42')](handleError(_0x382448,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x62d12e,_0x1dda2e,_0x6af0f5){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'CampaignId':_0x62d12e[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x5b')))),_0x0fcf('0x56')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),_0x0fcf('0x5c')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0fcf('0x24')](handleEntityNotFound(_0x1dda2e,null))[_0x0fcf('0x24')](respondWithResult(_0x1dda2e,null))['catch'](handleError(_0x1dda2e,null));};exports[_0x0fcf('0x5d')]=function(_0x3cb75a,_0x5936a6,_0x3d02c1){return db[_0x0fcf('0x5e')][_0x0fcf('0x49')]({'where':{'id':_0x3cb75a[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x5936a6,null))[_0x0fcf('0x24')](function(_0x4704c9){var _0x4b1f10;if(_0x4704c9){_0x4b1f10=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),'ContactId','ListId',_0x0fcf('0x65'),_0x0fcf('0x66'),_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),_0x0fcf('0x63'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x64'))['field']('ANY_VALUE(ContactId)',_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),'ListId')[_0x0fcf('0x6a')](_0x0fcf('0x6e'),_0x0fcf('0x65'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'createdAt')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')]('cm_hopper_final')[_0x0fcf('0x3d')]('VoiceQueueId\x20=\x20?',_0x3cb75a[_0x0fcf('0x43')]['id']['toString']())[_0x0fcf('0x3d')](_0x0fcf('0x70'),_0x3cb75a['body'][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()[_0x0fcf('0x6a')](_0x0fcf('0x75'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]())['where'](_0x0fcf('0x77')))[_0x0fcf('0x78')](_0x0fcf('0x6c')))[_0x0fcf('0x72')]();return db[_0x0fcf('0x4b')][_0x0fcf('0x33')](_0x4b1f10);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x5936a6,null))['catch'](handleError(_0x5936a6,null));};exports[_0x0fcf('0x79')]=function(_0x489c6d,_0x18645d,_0x9e933e){return db[_0x0fcf('0x7a')]['find']({'where':{'id':_0x489c6d['params']['id']}})['then'](handleEntityNotFound(_0x18645d,null))['then'](function(_0x301991){var _0x46bcc2;if(_0x301991){_0x46bcc2=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),_0x0fcf('0x6c'),_0x0fcf('0x7b'),_0x0fcf('0x7c'),'createdAt',_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),'phone')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'scheduledAt')['field'](_0x0fcf('0x7d'),_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),_0x0fcf('0x7b'))[_0x0fcf('0x6a')](_0x0fcf('0x7e'),_0x0fcf('0x7c'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x66'))['field'](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))['where'](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x70'),_0x489c6d[_0x0fcf('0x47')][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')](_0x0fcf('0x80'))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()['field']('calleridnum')[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x77')))['group'](_0x0fcf('0x6c')))['toString']();return db[_0x0fcf('0x4b')]['query'](_0x46bcc2);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x18645d,null))['catch'](handleError(_0x18645d,null));};exports['checkContactHopper']=function(_0x426625,_0x4ccae3,_0x2905fa){return db[_0x0fcf('0x81')][_0x0fcf('0x82')]({'where':{'VoiceQueueId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x65')],'CampaignId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x7c')],'ContactId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x6c')]}})[_0x0fcf('0x24')](handleEntityNotFound(_0x4ccae3,null))[_0x0fcf('0x24')](function(_0x274aa9){if(_0x274aa9){return _0x274aa9;}return null;})[_0x0fcf('0x24')](respondWithResult(_0x4ccae3,null))['catch'](handleError(_0x4ccae3,null));}; \ No newline at end of file +var _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','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','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','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','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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'];(function(_0x17a598,_0x2ccd8f){var _0x543be=function(_0x31b80c){while(--_0x31b80c){_0x17a598['push'](_0x17a598['shift']());}};_0x543be(++_0x2ccd8f);}(_0x5496,0x175));var _0x6549=function(_0x418193,_0x5e5620){_0x418193=_0x418193-0x0;var _0x657c52=_0x5496[_0x418193];return _0x657c52;};'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')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 14110c0..52f9ae2 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 _0x704f=['rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x400aea,_0x593caf){var _0x519e98=function(_0x5052fa){while(--_0x5052fa){_0x400aea['push'](_0x400aea['shift']());}};_0x519e98(++_0x593caf);}(_0x704f,0x159));var _0xf704=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x704f[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf704('0x0'))(_0xf704('0x1'));var moment=require(_0xf704('0x2'));var BPromise=require(_0xf704('0x3'));var rp=require(_0xf704('0x4'));var fs=require('fs');var path=require(_0xf704('0x5'));var rimraf=require(_0xf704('0x6'));var config=require('../../config/environment');var attributes=require(_0xf704('0x7'));module[_0xf704('0x8')]=function(_0x2f37b3,_0x4acf38){return _0x2f37b3['define'](_0xf704('0x9'),attributes,{'tableName':_0xf704('0xa'),'paranoid':![],'indexes':[{'name':_0xf704('0xb'),'fields':[_0xf704('0xb')]},{'name':_0xf704('0xc'),'fields':[_0xf704('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc915=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2add72,_0x25f4f3){var _0x246b81=function(_0x5e3c64){while(--_0x5e3c64){_0x2add72['push'](_0x2add72['shift']());}};_0x246b81(++_0x25f4f3);}(_0xc915,0xe8));var _0x5c91=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc915[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5c91('0x0'));var util=require(_0x5c91('0x1'));var logger=require(_0x5c91('0x2'))(_0x5c91('0x3'));var moment=require(_0x5c91('0x4'));var BPromise=require(_0x5c91('0x5'));var rp=require(_0x5c91('0x6'));var fs=require('fs');var path=require(_0x5c91('0x7'));var rimraf=require(_0x5c91('0x8'));var config=require(_0x5c91('0x9'));var attributes=require(_0x5c91('0xa'));module[_0x5c91('0xb')]=function(_0x4bc276,_0x598935){return _0x4bc276['define'](_0x5c91('0xc'),attributes,{'tableName':_0x5c91('0xd'),'paranoid':![],'indexes':[{'name':_0x5c91('0xe'),'fields':[_0x5c91('0xe')]},{'name':'uniqueid','fields':[_0x5c91('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 98e38ac..bd2ed0f 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(_0x15b986,_0xb23cb4){var _0x8ef479=function(_0x57c620){while(--_0x57c620){_0x15b986['push'](_0x15b986['shift']());}};_0x8ef479(++_0xb23cb4);}(_0xb10b,0x12a));var _0xbb10=function(_0x56a37a,_0xffb054){_0x56a37a=_0x56a37a-0x0;var _0x3a57ff=_0xb10b[_0x56a37a];return _0x3a57ff;};'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(_0x2607b8,_0x7c741b){var _0x284f5c=function(_0x2231b0){while(--_0x2231b0){_0x2607b8['push'](_0x2607b8['shift']());}};_0x284f5c(++_0x7c741b);}(_0xb10b,0x12a));var _0xbb10=function(_0x11280c,_0x4e8f92){_0x11280c=_0x11280c-0x0;var _0x5999ac=_0xb10b[_0x11280c];return _0x5999ac;};'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 7dacb94..db75c2c 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 _0x450a=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal'];(function(_0x249442,_0x374131){var _0x3922f1=function(_0x1b7da3){while(--_0x1b7da3){_0x249442['push'](_0x249442['shift']());}};_0x3922f1(++_0x374131);}(_0x450a,0x149));var _0xa450=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x450a[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xa450('0x0'));var util=require(_0xa450('0x1'));var path=require(_0xa450('0x2'));var timeout=require(_0xa450('0x3'));var express=require(_0xa450('0x4'));var router=express[_0xa450('0x5')]();var fs_extra=require(_0xa450('0x6'));var auth=require(_0xa450('0x7'));var interaction=require(_0xa450('0x8'));var config=require(_0xa450('0x9'));var controller=require('./cmHopperFinal.controller');router[_0xa450('0xa')]('/',auth[_0xa450('0xb')](),controller['index']);router['get'](_0xa450('0xc'),auth['isAuthenticated'](),controller[_0xa450('0xd')]);router[_0xa450('0xa')](_0xa450('0xe'),auth[_0xa450('0xb')](),controller[_0xa450('0xf')]);router['get'](_0xa450('0x10'),auth[_0xa450('0xb')](),controller[_0xa450('0x11')]);router[_0xa450('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xa450('0x12')]);router[_0xa450('0x13')](_0xa450('0x14'),auth[_0xa450('0xb')](),controller[_0xa450('0x15')]);router[_0xa450('0x13')](_0xa450('0x16'),auth[_0xa450('0xb')](),controller[_0xa450('0x17')]);router[_0xa450('0x13')](_0xa450('0x18'),auth['isAuthenticated'](),controller[_0xa450('0x19')]);router[_0xa450('0x1a')]('/:id',auth[_0xa450('0xb')](),controller[_0xa450('0x1b')]);module[_0xa450('0x1c')]=router; \ No newline at end of file +var _0xfefc=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show'];(function(_0x4948d6,_0x5f43e9){var _0x467067=function(_0x27e611){while(--_0x27e611){_0x4948d6['push'](_0x4948d6['shift']());}};_0x467067(++_0x5f43e9);}(_0xfefc,0xfa));var _0xcfef=function(_0x4e7904,_0xb5d01e){_0x4e7904=_0x4e7904-0x0;var _0x4f23e5=_0xfefc[_0x4e7904];return _0x4f23e5;};'use strict';var multer=require(_0xcfef('0x0'));var util=require(_0xcfef('0x1'));var path=require(_0xcfef('0x2'));var timeout=require(_0xcfef('0x3'));var express=require(_0xcfef('0x4'));var router=express['Router']();var fs_extra=require(_0xcfef('0x5'));var auth=require(_0xcfef('0x6'));var interaction=require(_0xcfef('0x7'));var config=require(_0xcfef('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xcfef('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfef('0xa')]);router[_0xcfef('0x9')]('/describe',auth[_0xcfef('0xb')](),controller['describe']);router['get'](_0xcfef('0xc'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xd')]);router[_0xcfef('0x9')](_0xcfef('0xe'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0xcfef('0xb')](),controller[_0xcfef('0x10')]);router[_0xcfef('0x11')](_0xcfef('0x12'),auth[_0xcfef('0xb')](),controller[_0xcfef('0x13')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xcfef('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xcfef('0x14'),auth['isAuthenticated'](),controller[_0xcfef('0x15')]);router[_0xcfef('0x16')](_0xcfef('0xc'),auth[_0xcfef('0xb')](),controller[_0xcfef('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 674077c..beb732a 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 _0xb679=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x109d27,_0xde5397){var _0x236ecb=function(_0x192fe0){while(--_0x192fe0){_0x109d27['push'](_0x109d27['shift']());}};_0x236ecb(++_0xde5397);}(_0xb679,0x1e8));var _0x9b67=function(_0x1dc915,_0x5a5c97){_0x1dc915=_0x1dc915-0x0;var _0x5d90a4=_0xb679[_0x1dc915];return _0x5d90a4;};'use strict';var Sequelize=require('sequelize');module[_0x9b67('0x0')]={'state':{'type':Sequelize[_0x9b67('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9b67('0x2')]},'scheduledat':{'type':Sequelize[_0x9b67('0x3')]},'countbusyretry':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9b67('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x9b67('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9b67('0x3')]},'responsetime':{'type':Sequelize[_0x9b67('0x3')]},'answertime':{'type':Sequelize[_0x9b67('0x3')]},'droptime':{'type':Sequelize[_0x9b67('0x3')]},'endtime':{'type':Sequelize[_0x9b67('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9b67('0x2')]},'campaign':{'type':Sequelize[_0x9b67('0x2')]},'campaigntype':{'type':Sequelize[_0x9b67('0x2')]},'membername':{'type':Sequelize[_0x9b67('0x2')]},'reason':{'type':Sequelize[_0x9b67('0x2')]},'amd':{'type':Sequelize[_0x9b67('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9b67('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9b67('0x3')]},'recallme':{'type':Sequelize[_0x9b67('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x9b67('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b67('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9b67('0x2')]}}; \ No newline at end of file +var _0x7f7e=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f7e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe7f7('0x0'));module['exports']={'state':{'type':Sequelize[_0xe7f7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe7f7('0x2')]},'scheduledat':{'type':Sequelize[_0xe7f7('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe7f7('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe7f7('0x2')]},'calleridname':{'type':Sequelize[_0xe7f7('0x2')]},'starttime':{'type':Sequelize[_0xe7f7('0x3')]},'responsetime':{'type':Sequelize[_0xe7f7('0x3')]},'answertime':{'type':Sequelize[_0xe7f7('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe7f7('0x3')]},'ringtime':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe7f7('0x2')]},'campaign':{'type':Sequelize[_0xe7f7('0x2')]},'campaigntype':{'type':Sequelize[_0xe7f7('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe7f7('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe7f7('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe7f7('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe7f7('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe7f7('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe7f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index cbb149c..6550b3b 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 _0x3ed6=['name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','findAll','rows','show','params','includeAll','include','catch','create','body','describe','update','uniqueid','eml-format','fast-json-patch','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/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','then','error','stack'];(function(_0x53b824,_0xe366b4){var _0x1f02a0=function(_0x4d3b4c){while(--_0x4d3b4c){_0x53b824['push'](_0x53b824['shift']());}};_0x1f02a0(++_0xe366b4);}(_0x3ed6,0x74));var _0x63ed=function(_0x337ebc,_0x4d4f12){_0x337ebc=_0x337ebc-0x0;var _0xef593b=_0x3ed6[_0x337ebc];return _0xef593b;};'use strict';var emlformat=require(_0x63ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x63ed('0x1'));var rp=require('request-promise');var moment=require(_0x63ed('0x2'));var BPromise=require(_0x63ed('0x3'));var Mustache=require(_0x63ed('0x4'));var util=require('util');var path=require(_0x63ed('0x5'));var sox=require(_0x63ed('0x6'));var csv=require(_0x63ed('0x7'));var ejs=require(_0x63ed('0x8'));var fs=require('fs');var fs_extra=require(_0x63ed('0x9'));var _=require('lodash');var squel=require(_0x63ed('0xa'));var crypto=require(_0x63ed('0xb'));var jsforce=require(_0x63ed('0xc'));var deskjs=require(_0x63ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x63ed('0xe'));var Papa=require(_0x63ed('0xf'));var Redis=require(_0x63ed('0x10'));var authService=require(_0x63ed('0x11'));var qs=require(_0x63ed('0x12'));var as=require(_0x63ed('0x13'));var hardwareService=require(_0x63ed('0x14'));var logger=require(_0x63ed('0x15'))(_0x63ed('0x16'));var utils=require(_0x63ed('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x63ed('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x181f88,_0x32803f){_0x32803f=_0x32803f||0xcc;return function(_0x203f80){if(_0x203f80){return _0x181f88[_0x63ed('0x19')](_0x32803f);}return _0x181f88[_0x63ed('0x1a')](_0x32803f)[_0x63ed('0x1b')]();};}function respondWithResult(_0x3c1d54,_0x12bf87){_0x12bf87=_0x12bf87||0xc8;return function(_0x50ef81){if(_0x50ef81){return _0x3c1d54[_0x63ed('0x1a')](_0x12bf87)[_0x63ed('0x1c')](_0x50ef81);}};}function respondWithFilteredResult(_0x33d06c,_0x52a972){return function(_0x48c0f7){if(_0x48c0f7){var _0x36b11a=typeof _0x52a972[_0x63ed('0x1d')]===_0x63ed('0x1e')&&typeof _0x52a972[_0x63ed('0x1f')]==='undefined';var _0x1ff19d=_0x48c0f7[_0x63ed('0x20')];var _0x1c353e=_0x36b11a?0x0:_0x52a972[_0x63ed('0x1d')];var _0x1b0b45=_0x36b11a?_0x48c0f7['count']:_0x52a972[_0x63ed('0x1d')]+_0x52a972[_0x63ed('0x1f')];var _0x5784a6;if(_0x1b0b45>=_0x1ff19d){_0x1b0b45=_0x1ff19d;_0x5784a6=0xc8;}else{_0x5784a6=0xce;}_0x33d06c[_0x63ed('0x1a')](_0x5784a6);return _0x33d06c['set']('Content-Range',_0x1c353e+'-'+_0x1b0b45+'/'+_0x1ff19d)['json'](_0x48c0f7);}return null;};}function patchUpdates(_0x283748){return function(_0x9bc097){try{jsonpatch[_0x63ed('0x21')](_0x9bc097,_0x283748,!![]);}catch(_0x3e876c){return BPromise[_0x63ed('0x22')](_0x3e876c);}return _0x9bc097[_0x63ed('0x23')]();};}function saveUpdates(_0x1c5bd1,_0x3356e9){return function(_0x56c156){if(_0x56c156){return _0x56c156['update'](_0x1c5bd1)['then'](function(_0xbd064a){return _0xbd064a;});}return null;};}function removeEntity(_0x4efd34,_0x2c4046){return function(_0x3d462e){if(_0x3d462e){return _0x3d462e[_0x63ed('0x24')]()[_0x63ed('0x25')](function(){_0x4efd34[_0x63ed('0x1a')](0xcc)[_0x63ed('0x1b')]();});}};}function handleEntityNotFound(_0x16f58e,_0x212dec){return function(_0x57b3ae){if(!_0x57b3ae){_0x16f58e[_0x63ed('0x19')](0x194);}return _0x57b3ae;};}function handleError(_0x2bf1bb,_0x5081e6){_0x5081e6=_0x5081e6||0x1f4;return function(_0x1c9af3){logger[_0x63ed('0x26')](_0x1c9af3[_0x63ed('0x27')]);if(_0x1c9af3[_0x63ed('0x28')]){delete _0x1c9af3[_0x63ed('0x28')];}_0x2bf1bb[_0x63ed('0x1a')](_0x5081e6)[_0x63ed('0x29')](_0x1c9af3);};}exports[_0x63ed('0x2a')]=function(_0x436d3f,_0x526f26){var _0x353a6a={},_0x570fc3={},_0x9b6140={'count':0x0,'rows':[]};var _0x211c93=_['map'](db['CmHopperHistory'][_0x63ed('0x2b')],function(_0x3319b7){return{'name':_0x3319b7[_0x63ed('0x2c')],'type':_0x3319b7[_0x63ed('0x2d')]['key']};});_0x570fc3[_0x63ed('0x2e')]=_[_0x63ed('0x2f')](_0x211c93,_0x63ed('0x28'));_0x570fc3[_0x63ed('0x30')]=_[_0x63ed('0x31')](_0x436d3f[_0x63ed('0x30')]);_0x570fc3[_0x63ed('0x32')]=_[_0x63ed('0x33')](_0x570fc3['model'],_0x570fc3[_0x63ed('0x30')]);_0x353a6a[_0x63ed('0x34')]=_[_0x63ed('0x33')](_0x570fc3[_0x63ed('0x2e')],qs[_0x63ed('0x35')](_0x436d3f[_0x63ed('0x30')][_0x63ed('0x35')]));_0x353a6a[_0x63ed('0x34')]=_0x353a6a['attributes'][_0x63ed('0x36')]?_0x353a6a[_0x63ed('0x34')]:_0x570fc3[_0x63ed('0x2e')];if(!_0x436d3f['query'][_0x63ed('0x37')](_0x63ed('0x38'))){_0x353a6a['limit']=qs[_0x63ed('0x1f')](_0x436d3f[_0x63ed('0x30')][_0x63ed('0x1f')]);_0x353a6a[_0x63ed('0x1d')]=qs[_0x63ed('0x1d')](_0x436d3f[_0x63ed('0x30')][_0x63ed('0x1d')]);}_0x353a6a[_0x63ed('0x39')]=qs[_0x63ed('0x3a')](_0x436d3f[_0x63ed('0x30')][_0x63ed('0x3a')]);_0x353a6a[_0x63ed('0x3b')]=qs[_0x63ed('0x32')](_[_0x63ed('0x3c')](_0x436d3f[_0x63ed('0x30')],_0x570fc3['filters']),_0x211c93);if(_0x436d3f['query'][_0x63ed('0x3d')]){_0x353a6a['where']=_[_0x63ed('0x3e')](_0x353a6a[_0x63ed('0x3b')],{'$or':_[_0x63ed('0x2f')](_0x211c93,function(_0x56bcfa){if(_0x56bcfa[_0x63ed('0x2d')]!==_0x63ed('0x3f')){var _0x3e46aa={};_0x3e46aa[_0x56bcfa[_0x63ed('0x28')]]={'$like':'%'+_0x436d3f[_0x63ed('0x30')]['filter']+'%'};return _0x3e46aa;}})});}_0x353a6a=_[_0x63ed('0x3e')]({},_0x353a6a,_0x436d3f[_0x63ed('0x40')]);var _0x4afd05={'where':_0x353a6a[_0x63ed('0x3b')]};return db[_0x63ed('0x41')][_0x63ed('0x20')](_0x4afd05)[_0x63ed('0x25')](function(_0x2bbe90){_0x9b6140[_0x63ed('0x20')]=_0x2bbe90;if(_0x436d3f[_0x63ed('0x30')]['includeAll']){_0x353a6a['include']=[{'all':!![]}];}return db[_0x63ed('0x41')][_0x63ed('0x42')](_0x353a6a);})[_0x63ed('0x25')](function(_0x131d1c){_0x9b6140[_0x63ed('0x43')]=_0x131d1c;return _0x9b6140;})[_0x63ed('0x25')](respondWithFilteredResult(_0x526f26,_0x353a6a))['catch'](handleError(_0x526f26,null));};exports[_0x63ed('0x44')]=function(_0x171e88,_0x3a4ecb){var _0x5c2958={'raw':!![],'where':{'id':_0x171e88[_0x63ed('0x45')]['id']}},_0x5d4419={};_0x5d4419[_0x63ed('0x2e')]=_[_0x63ed('0x31')](db[_0x63ed('0x41')][_0x63ed('0x2b')]);_0x5d4419[_0x63ed('0x30')]=_[_0x63ed('0x31')](_0x171e88[_0x63ed('0x30')]);_0x5d4419[_0x63ed('0x32')]=_['intersection'](_0x5d4419[_0x63ed('0x2e')],_0x5d4419[_0x63ed('0x30')]);_0x5c2958[_0x63ed('0x34')]=_[_0x63ed('0x33')](_0x5d4419[_0x63ed('0x2e')],qs[_0x63ed('0x35')](_0x171e88[_0x63ed('0x30')][_0x63ed('0x35')]));_0x5c2958[_0x63ed('0x34')]=_0x5c2958[_0x63ed('0x34')][_0x63ed('0x36')]?_0x5c2958[_0x63ed('0x34')]:_0x5d4419['model'];if(_0x171e88['query'][_0x63ed('0x46')]){_0x5c2958[_0x63ed('0x47')]=[{'all':!![]}];}_0x5c2958=_[_0x63ed('0x3e')]({},_0x5c2958,_0x171e88[_0x63ed('0x40')]);return db[_0x63ed('0x41')]['find'](_0x5c2958)[_0x63ed('0x25')](handleEntityNotFound(_0x3a4ecb,null))[_0x63ed('0x25')](respondWithResult(_0x3a4ecb,null))[_0x63ed('0x48')](handleError(_0x3a4ecb,null));};exports['create']=function(_0x5c1957,_0x1dd83e){return db[_0x63ed('0x41')][_0x63ed('0x49')](_0x5c1957[_0x63ed('0x4a')],{})['then'](respondWithResult(_0x1dd83e,0xc9))[_0x63ed('0x48')](handleError(_0x1dd83e,null));};exports[_0x63ed('0x4b')]=function(_0x2b2542,_0x427a2c){return db['CmHopperHistory'][_0x63ed('0x4b')]()['then'](respondWithResult(_0x427a2c,null))[_0x63ed('0x48')](handleError(_0x427a2c,null));};exports[_0x63ed('0x4c')]=function(_0x14a539,_0x20c813){if(_0x14a539[_0x63ed('0x4a')][_0x63ed('0x4d')]){delete _0x14a539['body'][_0x63ed('0x4d')];}return db[_0x63ed('0x41')]['find']({'where':{'uniqueid':_0x14a539[_0x63ed('0x45')]['id']}})[_0x63ed('0x25')](handleEntityNotFound(_0x20c813,null))['then'](saveUpdates(_0x14a539[_0x63ed('0x4a')],null))[_0x63ed('0x25')](respondWithResult(_0x20c813,null))['catch'](handleError(_0x20c813,null));}; \ No newline at end of file +var _0x5c39=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x50e4d0,_0x2496dc){var _0x350ef7=function(_0x7c9085){while(--_0x7c9085){_0x50e4d0['push'](_0x50e4d0['shift']());}};_0x350ef7(++_0x2496dc);}(_0x5c39,0x19b));var _0x95c3=function(_0x462d5d,_0xc6995f){_0x462d5d=_0x462d5d-0x0;var _0x261bc2=_0x5c39[_0x462d5d];return _0x261bc2;};'use strict';var emlformat=require(_0x95c3('0x0'));var rimraf=require(_0x95c3('0x1'));var zipdir=require(_0x95c3('0x2'));var jsonpatch=require(_0x95c3('0x3'));var rp=require(_0x95c3('0x4'));var moment=require(_0x95c3('0x5'));var BPromise=require(_0x95c3('0x6'));var Mustache=require(_0x95c3('0x7'));var util=require(_0x95c3('0x8'));var path=require(_0x95c3('0x9'));var sox=require('sox');var csv=require(_0x95c3('0xa'));var ejs=require(_0x95c3('0xb'));var fs=require('fs');var fs_extra=require(_0x95c3('0xc'));var _=require(_0x95c3('0xd'));var squel=require(_0x95c3('0xe'));var crypto=require(_0x95c3('0xf'));var jsforce=require(_0x95c3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x95c3('0xa'));var querystring=require(_0x95c3('0x11'));var Papa=require(_0x95c3('0x12'));var Redis=require(_0x95c3('0x13'));var authService=require(_0x95c3('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x95c3('0x15'));var hardwareService=require(_0x95c3('0x16'));var logger=require(_0x95c3('0x17'))(_0x95c3('0x18'));var utils=require(_0x95c3('0x19'));var config=require(_0x95c3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9cb2,_0xc877e){_0xc877e=_0xc877e||0xcc;return function(_0x42f0b8){if(_0x42f0b8){return _0x9cb2[_0x95c3('0x1b')](_0xc877e);}return _0x9cb2['status'](_0xc877e)[_0x95c3('0x1c')]();};}function respondWithResult(_0x363d13,_0x3035d6){_0x3035d6=_0x3035d6||0xc8;return function(_0x2e3079){if(_0x2e3079){return _0x363d13[_0x95c3('0x1d')](_0x3035d6)[_0x95c3('0x1e')](_0x2e3079);}};}function respondWithFilteredResult(_0xc3f4f,_0x2696ff){return function(_0x3a3dc9){if(_0x3a3dc9){var _0x366d2a=typeof _0x2696ff[_0x95c3('0x1f')]===_0x95c3('0x20')&&typeof _0x2696ff[_0x95c3('0x21')]===_0x95c3('0x20');var _0x19f108=_0x3a3dc9['count'];var _0x2b23cf=_0x366d2a?0x0:_0x2696ff[_0x95c3('0x1f')];var _0x27d5c9=_0x366d2a?_0x3a3dc9[_0x95c3('0x22')]:_0x2696ff[_0x95c3('0x1f')]+_0x2696ff[_0x95c3('0x21')];var _0x1870f1;if(_0x27d5c9>=_0x19f108){_0x27d5c9=_0x19f108;_0x1870f1=0xc8;}else{_0x1870f1=0xce;}_0xc3f4f[_0x95c3('0x1d')](_0x1870f1);return _0xc3f4f[_0x95c3('0x23')](_0x95c3('0x24'),_0x2b23cf+'-'+_0x27d5c9+'/'+_0x19f108)[_0x95c3('0x1e')](_0x3a3dc9);}return null;};}function patchUpdates(_0x3af86d){return function(_0x28d138){try{jsonpatch[_0x95c3('0x25')](_0x28d138,_0x3af86d,!![]);}catch(_0x191c96){return BPromise[_0x95c3('0x26')](_0x191c96);}return _0x28d138[_0x95c3('0x27')]();};}function saveUpdates(_0x2920d5,_0x3432bc){return function(_0x345827){if(_0x345827){return _0x345827[_0x95c3('0x28')](_0x2920d5)[_0x95c3('0x29')](function(_0x4cc6fc){return _0x4cc6fc;});}return null;};}function removeEntity(_0x5a4004,_0x4c4888){return function(_0xbf5cc8){if(_0xbf5cc8){return _0xbf5cc8['destroy']()[_0x95c3('0x29')](function(){_0x5a4004['status'](0xcc)[_0x95c3('0x1c')]();});}};}function handleEntityNotFound(_0x5c842b,_0x4a29e9){return function(_0x189195){if(!_0x189195){_0x5c842b[_0x95c3('0x1b')](0x194);}return _0x189195;};}function handleError(_0x201439,_0x2a338b){_0x2a338b=_0x2a338b||0x1f4;return function(_0x5c3152){logger[_0x95c3('0x2a')](_0x5c3152[_0x95c3('0x2b')]);if(_0x5c3152[_0x95c3('0x2c')]){delete _0x5c3152[_0x95c3('0x2c')];}_0x201439[_0x95c3('0x1d')](_0x2a338b)[_0x95c3('0x2d')](_0x5c3152);};}exports[_0x95c3('0x2e')]=function(_0x369a79,_0x3837f0){var _0x5d55d6={},_0x294327={},_0x20fe91={'count':0x0,'rows':[]};var _0x4fcaae=_[_0x95c3('0x2f')](db[_0x95c3('0x30')][_0x95c3('0x31')],function(_0x2bb9a6){return{'name':_0x2bb9a6['fieldName'],'type':_0x2bb9a6[_0x95c3('0x32')][_0x95c3('0x33')]};});_0x294327[_0x95c3('0x34')]=_[_0x95c3('0x2f')](_0x4fcaae,_0x95c3('0x2c'));_0x294327['query']=_[_0x95c3('0x35')](_0x369a79[_0x95c3('0x36')]);_0x294327['filters']=_[_0x95c3('0x37')](_0x294327[_0x95c3('0x34')],_0x294327[_0x95c3('0x36')]);_0x5d55d6[_0x95c3('0x38')]=_['intersection'](_0x294327[_0x95c3('0x34')],qs[_0x95c3('0x39')](_0x369a79['query'][_0x95c3('0x39')]));_0x5d55d6[_0x95c3('0x38')]=_0x5d55d6['attributes'][_0x95c3('0x3a')]?_0x5d55d6['attributes']:_0x294327[_0x95c3('0x34')];if(!_0x369a79[_0x95c3('0x36')][_0x95c3('0x3b')]('nolimit')){_0x5d55d6['limit']=qs[_0x95c3('0x21')](_0x369a79[_0x95c3('0x36')][_0x95c3('0x21')]);_0x5d55d6['offset']=qs[_0x95c3('0x1f')](_0x369a79[_0x95c3('0x36')][_0x95c3('0x1f')]);}_0x5d55d6[_0x95c3('0x3c')]=qs[_0x95c3('0x3d')](_0x369a79[_0x95c3('0x36')]['sort']);_0x5d55d6[_0x95c3('0x3e')]=qs[_0x95c3('0x3f')](_[_0x95c3('0x40')](_0x369a79['query'],_0x294327['filters']),_0x4fcaae);if(_0x369a79[_0x95c3('0x36')][_0x95c3('0x41')]){_0x5d55d6[_0x95c3('0x3e')]=_[_0x95c3('0x42')](_0x5d55d6[_0x95c3('0x3e')],{'$or':_['map'](_0x4fcaae,function(_0xc48a9a){if(_0xc48a9a[_0x95c3('0x32')]!==_0x95c3('0x43')){var _0x23d19f={};_0x23d19f[_0xc48a9a[_0x95c3('0x2c')]]={'$like':'%'+_0x369a79[_0x95c3('0x36')][_0x95c3('0x41')]+'%'};return _0x23d19f;}})});}_0x5d55d6=_[_0x95c3('0x42')]({},_0x5d55d6,_0x369a79[_0x95c3('0x44')]);var _0x1e6ddf={'where':_0x5d55d6[_0x95c3('0x3e')]};return db[_0x95c3('0x30')][_0x95c3('0x22')](_0x1e6ddf)[_0x95c3('0x29')](function(_0x15c091){_0x20fe91[_0x95c3('0x22')]=_0x15c091;if(_0x369a79[_0x95c3('0x36')][_0x95c3('0x45')]){_0x5d55d6[_0x95c3('0x46')]=[{'all':!![]}];}return db[_0x95c3('0x30')][_0x95c3('0x47')](_0x5d55d6);})[_0x95c3('0x29')](function(_0xc55700){_0x20fe91['rows']=_0xc55700;return _0x20fe91;})[_0x95c3('0x29')](respondWithFilteredResult(_0x3837f0,_0x5d55d6))[_0x95c3('0x48')](handleError(_0x3837f0,null));};exports[_0x95c3('0x49')]=function(_0x114109,_0x23734b){var _0x5812a7={'raw':!![],'where':{'id':_0x114109[_0x95c3('0x4a')]['id']}},_0x1934fe={};_0x1934fe[_0x95c3('0x34')]=_[_0x95c3('0x35')](db[_0x95c3('0x30')][_0x95c3('0x31')]);_0x1934fe['query']=_[_0x95c3('0x35')](_0x114109[_0x95c3('0x36')]);_0x1934fe[_0x95c3('0x3f')]=_[_0x95c3('0x37')](_0x1934fe[_0x95c3('0x34')],_0x1934fe[_0x95c3('0x36')]);_0x5812a7['attributes']=_[_0x95c3('0x37')](_0x1934fe[_0x95c3('0x34')],qs[_0x95c3('0x39')](_0x114109[_0x95c3('0x36')]['fields']));_0x5812a7[_0x95c3('0x38')]=_0x5812a7['attributes'][_0x95c3('0x3a')]?_0x5812a7[_0x95c3('0x38')]:_0x1934fe[_0x95c3('0x34')];if(_0x114109[_0x95c3('0x36')]['includeAll']){_0x5812a7[_0x95c3('0x46')]=[{'all':!![]}];}_0x5812a7=_['merge']({},_0x5812a7,_0x114109[_0x95c3('0x44')]);return db[_0x95c3('0x30')][_0x95c3('0x4b')](_0x5812a7)[_0x95c3('0x29')](handleEntityNotFound(_0x23734b,null))[_0x95c3('0x29')](respondWithResult(_0x23734b,null))['catch'](handleError(_0x23734b,null));};exports[_0x95c3('0x4c')]=function(_0x30f2ed,_0x34af46){return db['CmHopperHistory']['create'](_0x30f2ed[_0x95c3('0x4d')],{})['then'](respondWithResult(_0x34af46,0xc9))[_0x95c3('0x48')](handleError(_0x34af46,null));};exports['describe']=function(_0x5542cc,_0x251ed9){return db[_0x95c3('0x30')]['describe']()['then'](respondWithResult(_0x251ed9,null))['catch'](handleError(_0x251ed9,null));};exports[_0x95c3('0x28')]=function(_0x55dcb3,_0x393cb2){if(_0x55dcb3['body'][_0x95c3('0x4e')]){delete _0x55dcb3[_0x95c3('0x4d')][_0x95c3('0x4e')];}return db[_0x95c3('0x30')][_0x95c3('0x4b')]({'where':{'uniqueid':_0x55dcb3[_0x95c3('0x4a')]['id']}})[_0x95c3('0x29')](handleEntityNotFound(_0x393cb2,null))['then'](saveUpdates(_0x55dcb3[_0x95c3('0x4d')],null))[_0x95c3('0x29')](respondWithResult(_0x393cb2,null))['catch'](handleError(_0x393cb2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9efbde4..32c61cd 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 _0xf65d=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x40724c,_0x19b98){var _0x2beff1=function(_0x13a654){while(--_0x13a654){_0x40724c['push'](_0x40724c['shift']());}};_0x2beff1(++_0x19b98);}(_0xf65d,0x9f));var _0xdf65=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0xf65d[_0x5cf3c0];return _0x39a680;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('CmHopperHistory',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[{'name':_0xdf65('0xa'),'fields':[_0xdf65('0xa')]},{'name':_0xdf65('0xb'),'fields':[_0xdf65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd232=['request-promise','../../config/environment','define','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x254dd9,_0x1f91be){var _0x532451=function(_0x2e9812){while(--_0x2e9812){_0x254dd9['push'](_0x254dd9['shift']());}};_0x532451(++_0x1f91be);}(_0xd232,0x74));var _0x2d23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d23('0x0'));var util=require('util');var logger=require(_0x2d23('0x1'))(_0x2d23('0x2'));var moment=require(_0x2d23('0x3'));var BPromise=require(_0x2d23('0x4'));var rp=require(_0x2d23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d23('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1ddf08,_0x1662f2){return _0x1ddf08[_0x2d23('0x7')]('CmHopperHistory',attributes,{'tableName':_0x2d23('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x2d23('0x9')]},{'name':_0x2d23('0xa'),'fields':[_0x2d23('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 6326b12..32c1517 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 _0xe706=['GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','CmHopperHistory','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe706,0xa3));var _0x6e70=function(_0x44a94,_0x39f323){_0x44a94=_0x44a94-0x0;var _0x31ef56=_0xe706[_0x44a94];return _0x31ef56;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['CmHopperHistory'][_0x6e70('0x1a')](_0x5ea7a5[_0x6e70('0x1b')],{'raw':_0x5ea7a5[_0x6e70('0x1c')]?_0x5ea7a5[_0x6e70('0x1c')][_0x6e70('0x1d')]===undefined?!![]:![]:!![]})[_0x6e70('0xe')](function(_0x1b2453){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('CreateCmHopperHistory',_0x5ea7a5,JSON[_0x6e70('0x1e')](_0x1b2453));_0x173afe(_0x1b2453);})[_0x6e70('0x18')](function(_0x27b294){logger['error'](_0x6e70('0x19'),_0x27b294[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0x27b294['message']));});});};exports[_0x6e70('0x1f')]=function(_0x538b9c){var _0x50aec2=this;return new Promise(function(_0x4e97c7,_0x41e352){return db[_0x6e70('0x20')]['findAll']({'raw':_0x538b9c[_0x6e70('0x1c')]?_0x538b9c[_0x6e70('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x538b9c[_0x6e70('0x1c')]?_0x538b9c[_0x6e70('0x1c')][_0x6e70('0x21')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x6e70('0x22')][_0x6e70('0x23')]('id')),_0x6e70('0x24')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db['sequelize']['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x27')))),_0x6e70('0x28')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x29')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6e70('0x22')]['fn']('COUNT',db[_0x6e70('0x22')]['fn']('IF',db['sequelize'][_0x6e70('0x26')](_0x6e70('0x2a')))),_0x6e70('0x2b')],[db['sequelize']['fn'](_0x6e70('0x2c'),db[_0x6e70('0x22')]['fn']('IF',db['sequelize'][_0x6e70('0x26')](_0x6e70('0x2d')))),'predictiveIntervalAvgHoldtime'],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x2c'),db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x2e')))),_0x6e70('0x2f')]]})[_0x6e70('0xe')](function(_0xf146fd){logger[_0x6e70('0xf')]('AvgHandleTime',_0x538b9c);logger[_0x6e70('0x12')]('AvgHandleTime',_0x538b9c,JSON[_0x6e70('0x1e')](_0xf146fd));_0x4e97c7(_0xf146fd);})[_0x6e70('0x18')](function(_0x98c683){logger[_0x6e70('0x14')](_0x6e70('0x1f'),_0x98c683[_0x6e70('0x16')],_0x538b9c);_0x41e352(_0x50aec2[_0x6e70('0x14')](0x1f4,_0x98c683[_0x6e70('0x16')]));});});};exports[_0x6e70('0x30')]=function(_0x198dd1){var _0x2a5444=this;return new Promise(function(_0x23d5e2,_0x5594d3){return db['CmHopperHistory']['findAll']({'raw':_0x198dd1['options']?_0x198dd1[_0x6e70('0x1c')][_0x6e70('0x1d')]===undefined?!![]:![]:!![],'where':_0x198dd1[_0x6e70('0x1c')]?_0x198dd1[_0x6e70('0x1c')][_0x6e70('0x21')]||null:null,'attributes':[[_0x6e70('0x31'),'name'],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x32')))),_0x6e70('0x33')],[db[_0x6e70('0x22')]['fn']('COUNT',db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x34')))),_0x6e70('0x35')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x6e70('0x27')))),_0x6e70('0x36')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db['sequelize'][_0x6e70('0x26')](_0x6e70('0x37')))),_0x6e70('0x38')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6e70('0x22')]['literal'](_0x6e70('0x39')))),_0x6e70('0x3a')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db['sequelize']['fn']('IF',db[_0x6e70('0x22')]['literal'](_0x6e70('0x3b')))),_0x6e70('0x3c')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db['sequelize']['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x3d')))),_0x6e70('0x3e')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db['sequelize'][_0x6e70('0x26')](_0x6e70('0x3f')))),_0x6e70('0x40')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')]['literal'](_0x6e70('0x41')))),'outboundBlacklistCallsDay'],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x6e70('0x26')](_0x6e70('0x42')))),_0x6e70('0x43')],[db['sequelize']['fn']('COUNT',db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x44')))),_0x6e70('0x45')],[db[_0x6e70('0x22')]['fn']('COUNT',db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x46')))),_0x6e70('0x47')],[db['sequelize']['fn']('COUNT',db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x48')))),_0x6e70('0x45')],[db['sequelize']['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')][_0x6e70('0x26')](_0x6e70('0x49')))),'outboundReCallsDay']],'group':[_0x6e70('0x31')]})[_0x6e70('0xe')](function(_0x2c20d3){logger[_0x6e70('0xf')](_0x6e70('0x30'),_0x198dd1);logger[_0x6e70('0x12')]('GetVoiceQueueHopperHistory',_0x198dd1,JSON[_0x6e70('0x1e')](_0x2c20d3));_0x23d5e2(_0x2c20d3);})[_0x6e70('0x18')](function(_0x5c2396){logger[_0x6e70('0x14')](_0x6e70('0x30'),_0x5c2396['message'],_0x198dd1);_0x5594d3(_0x2a5444[_0x6e70('0x14')](0x1f4,_0x5c2396[_0x6e70('0x16')]));});});};exports[_0x6e70('0x4a')]=function(_0x46d536){var _0xfcadfe=this;return new Promise(function(_0x53f8fc,_0x385825){return db[_0x6e70('0x20')][_0x6e70('0x4b')]({'raw':_0x46d536[_0x6e70('0x1c')]?_0x46d536[_0x6e70('0x1c')][_0x6e70('0x1d')]===undefined?!![]:![]:!![],'where':_0x46d536[_0x6e70('0x1c')]?_0x46d536[_0x6e70('0x1c')][_0x6e70('0x21')]||null:null,'attributes':[[_0x6e70('0x31'),_0x6e70('0x4c')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')][_0x6e70('0x23')]('id')),_0x6e70('0x4d')],[db[_0x6e70('0x22')]['fn'](_0x6e70('0x25'),db[_0x6e70('0x22')]['fn']('IF',db[_0x6e70('0x22')]['literal'](_0x6e70('0x27')))),_0x6e70('0x4e')]],'group':[_0x6e70('0x31')]})[_0x6e70('0xe')](function(_0x36757e){logger[_0x6e70('0xf')]('GetCampaignHopperHistory',_0x46d536);logger[_0x6e70('0x12')](_0x6e70('0x4a'),_0x46d536,JSON['stringify'](_0x36757e));_0x53f8fc(_0x36757e);})[_0x6e70('0x18')](function(_0x692205){logger[_0x6e70('0x14')]('GetCampaignHopperHistory',_0x692205['message'],_0x46d536);_0x385825(_0xfcadfe[_0x6e70('0x14')](0x1f4,_0x692205[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0x52fc=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x52fc,0xc5));var _0xc52f=function(_0x4f86f6,_0x3420f5){_0x4f86f6=_0x4f86f6-0x0;var _0x25930c=_0x52fc[_0x4f86f6];return _0x25930c;};'use strict';var _=require(_0xc52f('0x0'));var util=require(_0xc52f('0x1'));var moment=require(_0xc52f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc52f('0x3'));var db=require(_0xc52f('0x4'))['db'];var utils=require(_0xc52f('0x5'));var logger=require(_0xc52f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc52f('0x7'));var client=jayson[_0xc52f('0x8')][_0xc52f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x523425,_0x4cae04,_0x4db523){return new BPromise(function(_0x4c73c8,_0x3d2845){return client['request'](_0x523425,_0x4db523)[_0xc52f('0xa')](function(_0x52db4a){logger[_0xc52f('0xb')](_0xc52f('0xc'),_0x4cae04,'request\x20sent');logger[_0xc52f('0xd')](_0xc52f('0xe'),_0x4cae04,_0xc52f('0xf'),JSON[_0xc52f('0x10')](_0x52db4a));if(_0x52db4a['error']){if(_0x52db4a[_0xc52f('0x11')]['code']===0x1f4){logger[_0xc52f('0x11')](_0xc52f('0xc'),_0x4cae04,_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);return _0x3d2845(_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);}logger['error'](_0xc52f('0xc'),_0x4cae04,_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);return _0x4c73c8(_0x52db4a[_0xc52f('0x11')][_0xc52f('0x12')]);}else{logger['info'](_0xc52f('0xc'),_0x4cae04,_0xc52f('0xf'));_0x4c73c8(_0x52db4a[_0xc52f('0x13')][_0xc52f('0x12')]);}})['catch'](function(_0x2a5863){logger[_0xc52f('0x11')](_0xc52f('0xc'),_0x4cae04,_0x2a5863);_0x3d2845(_0x2a5863);});});}exports[_0xc52f('0x14')]=function(_0x420a76){var _0x518ac1=this;return new Promise(function(_0x1299f9,_0x18c8fd){return db[_0xc52f('0x15')][_0xc52f('0x16')](_0x420a76[_0xc52f('0x17')],{'raw':_0x420a76['options']?_0x420a76[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5e3663){logger['info'](_0xc52f('0x14'),_0x420a76);logger[_0xc52f('0xd')]('CreateCmHopperHistory',_0x420a76,JSON[_0xc52f('0x10')](_0x5e3663));_0x1299f9(_0x5e3663);})[_0xc52f('0x1a')](function(_0xf4c28f){logger[_0xc52f('0x11')](_0xc52f('0x14'),_0xf4c28f['message'],_0x420a76);_0x18c8fd(_0x518ac1[_0xc52f('0x11')](0x1f4,_0xf4c28f['message']));});});};exports[_0xc52f('0x1b')]=function(_0x155536){var _0x3cf582=this;return new Promise(function(_0x42ecfe,_0x51b75f){return db[_0xc52f('0x15')][_0xc52f('0x1c')]({'raw':_0x155536[_0xc52f('0x18')]?_0x155536[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![],'where':_0x155536[_0xc52f('0x18')]?_0x155536['options'][_0xc52f('0x1d')]||null:null,'attributes':[[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db['sequelize'][_0xc52f('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xc52f('0x22')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db['sequelize']['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x23')))),_0xc52f('0x24')],[db[_0xc52f('0x1e')]['fn']('AVG',db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')](_0xc52f('0x25')))),_0xc52f('0x26')],[db[_0xc52f('0x1e')]['fn']('AVG',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xc52f('0x27')]]})[_0xc52f('0xa')](function(_0x2c1b82){logger['info'](_0xc52f('0x1b'),_0x155536);logger[_0xc52f('0xd')]('AvgHandleTime',_0x155536,JSON[_0xc52f('0x10')](_0x2c1b82));_0x42ecfe(_0x2c1b82);})[_0xc52f('0x1a')](function(_0x3ab9a3){logger['error']('AvgHandleTime',_0x3ab9a3[_0xc52f('0x12')],_0x155536);_0x51b75f(_0x3cf582[_0xc52f('0x11')](0x1f4,_0x3ab9a3[_0xc52f('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x40c5ca){var _0x608102=this;return new Promise(function(_0x4e881d,_0x1fc954){return db[_0xc52f('0x15')]['findAll']({'raw':_0x40c5ca[_0xc52f('0x18')]?_0x40c5ca[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![],'where':_0x40c5ca[_0xc52f('0x18')]?_0x40c5ca['options'][_0xc52f('0x1d')]||null:null,'attributes':[[_0xc52f('0x28'),_0xc52f('0x29')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xc52f('0x2a')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xc52f('0x2b')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal'](_0xc52f('0x2c')))),_0xc52f('0x2d')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0xc52f('0x2e')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x2f')))),_0xc52f('0x30')],[db['sequelize']['fn'](_0xc52f('0x1f'),db['sequelize']['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc52f('0x31')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')](_0xc52f('0x32')))),_0xc52f('0x33')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x34')))),_0xc52f('0x35')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db['sequelize']['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x36')))),_0xc52f('0x37')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize'][_0xc52f('0x21')](_0xc52f('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xc52f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc52f('0x39')))),_0xc52f('0x3a')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')][_0xc52f('0x21')](_0xc52f('0x3b')))),'outboundAnswerAgiCallsDay'],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xc52f('0x3c')))),_0xc52f('0x3a')],[db[_0xc52f('0x1e')]['fn']('COUNT',db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal'](_0xc52f('0x3d')))),'outboundReCallsDay']],'group':[_0xc52f('0x28')]})['then'](function(_0x10b7d6){logger['info']('GetVoiceQueueHopperHistory',_0x40c5ca);logger[_0xc52f('0xd')]('GetVoiceQueueHopperHistory',_0x40c5ca,JSON['stringify'](_0x10b7d6));_0x4e881d(_0x10b7d6);})[_0xc52f('0x1a')](function(_0xefc4a7){logger[_0xc52f('0x11')](_0xc52f('0x3e'),_0xefc4a7[_0xc52f('0x12')],_0x40c5ca);_0x1fc954(_0x608102['error'](0x1f4,_0xefc4a7[_0xc52f('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x425926){var _0x473476=this;return new Promise(function(_0xea51c7,_0x1efd76){return db[_0xc52f('0x15')][_0xc52f('0x1c')]({'raw':_0x425926[_0xc52f('0x18')]?_0x425926[_0xc52f('0x18')][_0xc52f('0x19')]===undefined?!![]:![]:!![],'where':_0x425926['options']?_0x425926['options']['where']||null:null,'attributes':[[_0xc52f('0x28'),_0xc52f('0x29')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')][_0xc52f('0x20')]('id')),_0xc52f('0x3f')],[db[_0xc52f('0x1e')]['fn'](_0xc52f('0x1f'),db[_0xc52f('0x1e')]['fn']('IF',db[_0xc52f('0x1e')]['literal'](_0xc52f('0x2c')))),_0xc52f('0x40')]],'group':['campaign']})[_0xc52f('0xa')](function(_0x4bdc99){logger['info'](_0xc52f('0x41'),_0x425926);logger[_0xc52f('0xd')](_0xc52f('0x41'),_0x425926,JSON[_0xc52f('0x10')](_0x4bdc99));_0xea51c7(_0x4bdc99);})[_0xc52f('0x1a')](function(_0x30767c){logger[_0xc52f('0x11')](_0xc52f('0x41'),_0x30767c['message'],_0x425926);_0x1efd76(_0x473476['error'](0x1f4,_0x30767c[_0xc52f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7110516..542d58d 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 _0x50c1=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','post','put','/:id','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc973f8,_0x1759ec){var _0x5cd9d5=function(_0x582522){while(--_0x582522){_0xc973f8['push'](_0xc973f8['shift']());}};_0x5cd9d5(++_0x1759ec);}(_0x50c1,0x118));var _0x150c=function(_0x135e66,_0x21ab7e){_0x135e66=_0x135e66-0x0;var _0x3df15e=_0x50c1[_0x135e66];return _0x3df15e;};'use strict';var multer=require(_0x150c('0x0'));var util=require(_0x150c('0x1'));var path=require(_0x150c('0x2'));var timeout=require(_0x150c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x150c('0x4'));var auth=require(_0x150c('0x5'));var interaction=require(_0x150c('0x6'));var config=require(_0x150c('0x7'));var controller=require(_0x150c('0x8'));router[_0x150c('0x9')]('/',auth[_0x150c('0xa')](),controller[_0x150c('0xb')]);router[_0x150c('0x9')](_0x150c('0xc'),auth[_0x150c('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x150c('0xd')]('/',auth[_0x150c('0xa')](),controller['create']);router[_0x150c('0xe')](_0x150c('0xf'),auth['isAuthenticated'](),controller[_0x150c('0x10')]);module[_0x150c('0x11')]=router; \ No newline at end of file +var _0xd46b=['../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','show','post','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4d2b16,_0x519757){var _0xe61122=function(_0x27e86d){while(--_0x27e86d){_0x4d2b16['push'](_0x4d2b16['shift']());}};_0xe61122(++_0x519757);}(_0xd46b,0x161));var _0xbd46=function(_0x2a9a82,_0xaca8e0){_0x2a9a82=_0x2a9a82-0x0;var _0x5f49a8=_0xd46b[_0x2a9a82];return _0x5f49a8;};'use strict';var multer=require(_0xbd46('0x0'));var util=require(_0xbd46('0x1'));var path=require(_0xbd46('0x2'));var timeout=require(_0xbd46('0x3'));var express=require(_0xbd46('0x4'));var router=express[_0xbd46('0x5')]();var fs_extra=require(_0xbd46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbd46('0x7'));var config=require(_0xbd46('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xbd46('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd46('0xa')]);router['get']('/describe',auth[_0xbd46('0xb')](),controller[_0xbd46('0xc')]);router[_0xbd46('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xbd46('0xd')]);router[_0xbd46('0xe')]('/',auth[_0xbd46('0xb')](),controller['create']);router['put'](_0xbd46('0xf'),auth[_0xbd46('0xb')](),controller[_0xbd46('0x10')]);module[_0xbd46('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f946b82..27a7e93 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 _0x56e6=['exports','STRING','name','sequelize'];(function(_0x3a43f5,_0xb1e4d8){var _0x1400e7=function(_0x407166){while(--_0x407166){_0x3a43f5['push'](_0x3a43f5['shift']());}};_0x1400e7(++_0xb1e4d8);}(_0x56e6,0x6b));var _0x656e=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0x56e6[_0xf91841];return _0x4b9c44;};'use strict';var Sequelize=require(_0x656e('0x0'));module[_0x656e('0x1')]={'name':{'type':Sequelize[_0x656e('0x2')],'unique':_0x656e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x656e('0x2')]},'dialPrefix':{'type':Sequelize[_0x656e('0x2')]}}; \ No newline at end of file +var _0xdb13=['name','exports','STRING'];(function(_0x2ac82b,_0x17fb40){var _0x21e03e=function(_0x4abd7b){while(--_0x4abd7b){_0x2ac82b['push'](_0x2ac82b['shift']());}};_0x21e03e(++_0x17fb40);}(_0xdb13,0x10c));var _0x3db1=function(_0x3b6aca,_0x1dcca5){_0x3b6aca=_0x3b6aca-0x0;var _0x30c0f7=_0xdb13[_0x3b6aca];return _0x30c0f7;};'use strict';var Sequelize=require('sequelize');module[_0x3db1('0x0')]={'name':{'type':Sequelize[_0x3db1('0x1')],'unique':_0x3db1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3db1('0x1')]},'dialPrefix':{'type':Sequelize[_0x3db1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e34e210..b9c30a1 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 _0x9920=['status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','send','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmList','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','getDispositions','Disposition','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','order','raw','getContactsCsv','ContactItemType','OrderBy','select','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','from','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9920,0x83));var _0x0992=function(_0x5ae5d2,_0x215e40){_0x5ae5d2=_0x5ae5d2-0x0;var _0x27c32b=_0x9920[_0x5ae5d2];return _0x27c32b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0992('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0992('0x1'));var rp=require(_0x0992('0x2'));var moment=require(_0x0992('0x3'));var BPromise=require(_0x0992('0x4'));var Mustache=require(_0x0992('0x5'));var util=require('util');var path=require(_0x0992('0x6'));var sox=require(_0x0992('0x7'));var csv=require(_0x0992('0x8'));var ejs=require(_0x0992('0x9'));var fs=require('fs');var fs_extra=require(_0x0992('0xa'));var _=require(_0x0992('0xb'));var squel=require(_0x0992('0xc'));var crypto=require('crypto');var jsforce=require(_0x0992('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0992('0x8'));var querystring=require(_0x0992('0xe'));var Papa=require('papaparse');var Redis=require(_0x0992('0xf'));var authService=require(_0x0992('0x10'));var qs=require(_0x0992('0x11'));var as=require(_0x0992('0x12'));var hardwareService=require(_0x0992('0x13'));var logger=require(_0x0992('0x14'))(_0x0992('0x15'));var utils=require(_0x0992('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0992('0x17'));var db=require(_0x0992('0x18'))['db'];var csv_results;config[_0x0992('0x19')]=_[_0x0992('0x1a')](config['redis'],{'host':_0x0992('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0992('0x19')]));require(_0x0992('0x1c'))[_0x0992('0x1d')](socket);function respondWithStatusCode(_0x621f9e,_0x5e3ad8){_0x5e3ad8=_0x5e3ad8||0xcc;return function(_0x5aa0e4){if(_0x5aa0e4){return _0x621f9e[_0x0992('0x1e')](_0x5e3ad8);}return _0x621f9e['status'](_0x5e3ad8)[_0x0992('0x1f')]();};}function respondWithResult(_0xf0cfa9,_0x31494f){_0x31494f=_0x31494f||0xc8;return function(_0x259101){if(_0x259101){return _0xf0cfa9[_0x0992('0x20')](_0x31494f)[_0x0992('0x21')](_0x259101);}};}function respondWithFilteredResult(_0x322c13,_0x5a9872){return function(_0x54da3e){if(_0x54da3e){var _0x41127b=typeof _0x5a9872['offset']===_0x0992('0x22')&&typeof _0x5a9872['limit']===_0x0992('0x22');var _0x43124c=_0x54da3e[_0x0992('0x23')];var _0xe0015c=_0x41127b?0x0:_0x5a9872[_0x0992('0x24')];var _0x34e57e=_0x41127b?_0x54da3e['count']:_0x5a9872['offset']+_0x5a9872[_0x0992('0x25')];var _0x554017;if(_0x34e57e>=_0x43124c){_0x34e57e=_0x43124c;_0x554017=0xc8;}else{_0x554017=0xce;}_0x322c13[_0x0992('0x20')](_0x554017);return _0x322c13[_0x0992('0x26')](_0x0992('0x27'),_0xe0015c+'-'+_0x34e57e+'/'+_0x43124c)[_0x0992('0x21')](_0x54da3e);}return null;};}function patchUpdates(_0x15ca81){return function(_0x4cccda){try{jsonpatch[_0x0992('0x28')](_0x4cccda,_0x15ca81,!![]);}catch(_0x2fb994){return BPromise['reject'](_0x2fb994);}return _0x4cccda[_0x0992('0x29')]();};}function saveUpdates(_0x46bf43,_0x3e591a){return function(_0x7be241){if(_0x7be241){return _0x7be241[_0x0992('0x2a')](_0x46bf43)[_0x0992('0x2b')](function(_0x599472){return _0x599472;});}return null;};}function removeEntity(_0x4b63d1,_0x2cef7b){return function(_0x5341c2){if(_0x5341c2){return _0x5341c2[_0x0992('0x2c')]()[_0x0992('0x2b')](function(){var _0x486d04=_0x5341c2[_0x0992('0x2d')]({'plain':!![]});var _0x668c31='Lists';return db['UserProfileResource']['destroy']({'where':{'type':_0x668c31,'resourceId':_0x486d04['id']}})[_0x0992('0x2b')](function(){return _0x5341c2;});})['then'](function(){_0x4b63d1[_0x0992('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58efb9,_0x387f4c){return function(_0x2bf5fd){if(!_0x2bf5fd){_0x58efb9['sendStatus'](0x194);}return _0x2bf5fd;};}function handleError(_0xb082ad,_0x371852){_0x371852=_0x371852||0x1f4;return function(_0x28d7e8){logger[_0x0992('0x2e')](_0x28d7e8[_0x0992('0x2f')]);if(_0x28d7e8[_0x0992('0x30')]){delete _0x28d7e8[_0x0992('0x30')];}_0xb082ad[_0x0992('0x20')](_0x371852)[_0x0992('0x31')](_0x28d7e8);};}exports['index']=function(_0x51a93a,_0x350731){var _0x225fcf={},_0x5e311d={},_0x1ed972={'count':0x0,'rows':[]};var _0x995c34=_['map'](db['CmList'][_0x0992('0x32')],function(_0x19166c){return{'name':_0x19166c['fieldName'],'type':_0x19166c[_0x0992('0x33')][_0x0992('0x34')]};});_0x5e311d['model']=_[_0x0992('0x35')](_0x995c34,'name');_0x5e311d['query']=_[_0x0992('0x36')](_0x51a93a[_0x0992('0x37')]);_0x5e311d[_0x0992('0x38')]=_[_0x0992('0x39')](_0x5e311d[_0x0992('0x3a')],_0x5e311d[_0x0992('0x37')]);_0x225fcf[_0x0992('0x3b')]=_[_0x0992('0x39')](_0x5e311d[_0x0992('0x3a')],qs[_0x0992('0x3c')](_0x51a93a['query']['fields']));_0x225fcf[_0x0992('0x3b')]=_0x225fcf['attributes'][_0x0992('0x3d')]?_0x225fcf[_0x0992('0x3b')]:_0x5e311d[_0x0992('0x3a')];if(!_0x51a93a['query'][_0x0992('0x3e')](_0x0992('0x3f'))){_0x225fcf['limit']=qs['limit'](_0x51a93a['query'][_0x0992('0x25')]);_0x225fcf['offset']=qs[_0x0992('0x24')](_0x51a93a[_0x0992('0x37')][_0x0992('0x24')]);}_0x225fcf['order']=qs[_0x0992('0x40')](_0x51a93a[_0x0992('0x37')]['sort']);_0x225fcf[_0x0992('0x41')]=qs['filters'](_[_0x0992('0x42')](_0x51a93a[_0x0992('0x37')],_0x5e311d[_0x0992('0x38')]),_0x995c34);if(_0x51a93a[_0x0992('0x37')][_0x0992('0x43')]){_0x225fcf[_0x0992('0x41')]=_['merge'](_0x225fcf['where'],{'$or':_[_0x0992('0x35')](_0x995c34,function(_0x227b64){if(_0x227b64[_0x0992('0x33')]!=='VIRTUAL'){var _0x575a7a={};_0x575a7a[_0x227b64[_0x0992('0x30')]]={'$like':'%'+_0x51a93a[_0x0992('0x37')][_0x0992('0x43')]+'%'};return _0x575a7a;}})});}_0x225fcf=_[_0x0992('0x44')]({},_0x225fcf,_0x51a93a[_0x0992('0x45')]);var _0x3c53d1={'where':_0x225fcf[_0x0992('0x41')]};return db[_0x0992('0x46')][_0x0992('0x23')](_0x3c53d1)[_0x0992('0x2b')](function(_0x288274){_0x1ed972[_0x0992('0x23')]=_0x288274;if(_0x51a93a[_0x0992('0x37')][_0x0992('0x47')]){_0x225fcf[_0x0992('0x48')]=[{'all':!![]}];}return db[_0x0992('0x46')][_0x0992('0x49')](_0x225fcf);})[_0x0992('0x2b')](function(_0x339c58){_0x1ed972[_0x0992('0x4a')]=_0x339c58;return _0x1ed972;})[_0x0992('0x2b')](respondWithFilteredResult(_0x350731,_0x225fcf))['catch'](handleError(_0x350731,null));};exports[_0x0992('0x4b')]=function(_0x13fa99,_0x3cb95){var _0x5da398={'raw':![],'where':{'id':_0x13fa99[_0x0992('0x4c')]['id']}},_0x1fc5fe={};_0x1fc5fe[_0x0992('0x3a')]=_[_0x0992('0x36')](db['CmList'][_0x0992('0x32')]);_0x1fc5fe['query']=_[_0x0992('0x36')](_0x13fa99[_0x0992('0x37')]);_0x1fc5fe[_0x0992('0x38')]=_[_0x0992('0x39')](_0x1fc5fe[_0x0992('0x3a')],_0x1fc5fe[_0x0992('0x37')]);_0x5da398['attributes']=_['intersection'](_0x1fc5fe[_0x0992('0x3a')],qs[_0x0992('0x3c')](_0x13fa99['query'][_0x0992('0x3c')]));_0x5da398['attributes']=_0x5da398[_0x0992('0x3b')]['length']?_0x5da398['attributes']:_0x1fc5fe[_0x0992('0x3a')];if(_0x13fa99[_0x0992('0x37')][_0x0992('0x47')]){_0x5da398[_0x0992('0x48')]=[{'all':!![]}];}_0x5da398=_[_0x0992('0x44')]({},_0x5da398,_0x13fa99['options']);return db[_0x0992('0x46')][_0x0992('0x4d')](_0x5da398)['then'](handleEntityNotFound(_0x3cb95,null))[_0x0992('0x2b')](respondWithResult(_0x3cb95,null))['catch'](handleError(_0x3cb95,null));};exports[_0x0992('0x4e')]=function(_0x20f7f4,_0x298f9a){return db[_0x0992('0x46')][_0x0992('0x4e')](_0x20f7f4[_0x0992('0x4f')],{})[_0x0992('0x2b')](function(_0x24a3cc){var _0x345bdf=_0x20f7f4[_0x0992('0x50')]['get']({'plain':!![]});if(!_0x345bdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x345bdf[_0x0992('0x51')]===_0x0992('0x50')){var _0x1d5905=_0x24a3cc[_0x0992('0x2d')]({'plain':!![]});var _0x587cdb='Lists';return db[_0x0992('0x52')]['find']({'where':{'name':_0x587cdb,'userProfileId':_0x345bdf[_0x0992('0x53')]},'raw':!![]})[_0x0992('0x2b')](function(_0x523805){if(_0x523805&&_0x523805['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d5905[_0x0992('0x30')],'resourceId':_0x1d5905['id'],'type':_0x523805['name'],'sectionId':_0x523805['id']},{})[_0x0992('0x2b')](function(){return _0x24a3cc;});}else{return _0x24a3cc;}})['catch'](function(_0x469f9b){logger[_0x0992('0x2e')](_0x0992('0x54'),_0x469f9b);throw _0x469f9b;});}return _0x24a3cc;})[_0x0992('0x2b')](respondWithResult(_0x298f9a,0xc9))[_0x0992('0x55')](handleError(_0x298f9a,null));};exports[_0x0992('0x2a')]=function(_0x4d705d,_0x1a6ccc){if(_0x4d705d[_0x0992('0x4f')]['id']){delete _0x4d705d[_0x0992('0x4f')]['id'];}return db[_0x0992('0x46')][_0x0992('0x4d')]({'where':{'id':_0x4d705d[_0x0992('0x4c')]['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x1a6ccc,null))[_0x0992('0x2b')](saveUpdates(_0x4d705d[_0x0992('0x4f')],null))[_0x0992('0x2b')](respondWithResult(_0x1a6ccc,null))[_0x0992('0x55')](handleError(_0x1a6ccc,null));};exports[_0x0992('0x2c')]=function(_0x5600e9,_0x3415a3){return db[_0x0992('0x46')][_0x0992('0x4d')]({'where':{'id':_0x5600e9[_0x0992('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3415a3,null))['then'](removeEntity(_0x3415a3,null))['catch'](handleError(_0x3415a3,null));};exports['describe']=function(_0x39b51f,_0x509751){return db[_0x0992('0x46')][_0x0992('0x56')]()[_0x0992('0x2b')](respondWithResult(_0x509751,null))[_0x0992('0x55')](handleError(_0x509751,null));};exports[_0x0992('0x57')]=function(_0x39ecb0,_0x1ad0f8,_0x2a8df0){if(_0x39ecb0[_0x0992('0x4f')]['id']){delete _0x39ecb0[_0x0992('0x4f')]['id'];}return db['CmList']['find']({'where':{'id':_0x39ecb0[_0x0992('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ad0f8,null))[_0x0992('0x2b')](function(_0x386d8c){if(_0x386d8c){_0x39ecb0['body']['ListId']=_0x386d8c['id'];return db['Disposition'][_0x0992('0x4e')](_0x39ecb0[_0x0992('0x4f')]);}})['then'](respondWithResult(_0x1ad0f8,null))[_0x0992('0x55')](handleError(_0x1ad0f8,null));};exports[_0x0992('0x58')]=function(_0x2ce784,_0x4449e4,_0x238e1a){var _0x37d3ac={'raw':![],'where':{}};var _0x2037d0={};var _0x578b3e={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x2ce784[_0x0992('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4449e4,null))[_0x0992('0x2b')](function(_0x118dd8){if(_0x118dd8){_0x2037d0['model']=_['keys'](db['Disposition'][_0x0992('0x32')]);_0x2037d0['query']=_[_0x0992('0x36')](_0x2ce784[_0x0992('0x37')]);_0x2037d0[_0x0992('0x38')]=_['intersection'](_0x2037d0[_0x0992('0x3a')],_0x2037d0[_0x0992('0x37')]);_0x37d3ac['attributes']=_[_0x0992('0x39')](_0x2037d0[_0x0992('0x3a')],qs['fields'](_0x2ce784[_0x0992('0x37')]['fields']));_0x37d3ac['attributes']=_0x37d3ac[_0x0992('0x3b')][_0x0992('0x3d')]?_0x37d3ac['attributes']:_0x2037d0[_0x0992('0x3a')];if(!_0x2ce784['query']['hasOwnProperty'](_0x0992('0x3f'))){_0x37d3ac[_0x0992('0x25')]=qs[_0x0992('0x25')](_0x2ce784[_0x0992('0x37')][_0x0992('0x25')]);_0x37d3ac[_0x0992('0x24')]=qs['offset'](_0x2ce784[_0x0992('0x37')][_0x0992('0x24')]);}_0x37d3ac['order']=qs['sort'](_0x2ce784[_0x0992('0x37')][_0x0992('0x40')]);_0x37d3ac[_0x0992('0x41')]=qs[_0x0992('0x38')](_[_0x0992('0x42')](_0x2ce784['query'],_0x2037d0[_0x0992('0x38')]));_0x37d3ac[_0x0992('0x41')]['ListId']=_0x118dd8['id'];if(_0x2ce784[_0x0992('0x37')][_0x0992('0x43')]){_0x37d3ac[_0x0992('0x41')]=_[_0x0992('0x44')](_0x37d3ac['where'],{'$or':_[_0x0992('0x35')](_0x37d3ac[_0x0992('0x3b')],function(_0x4b566a){var _0x1deca1={};_0x1deca1[_0x4b566a]={'$like':'%'+_0x2ce784['query']['filter']+'%'};return _0x1deca1;})});}_0x37d3ac=_[_0x0992('0x44')]({},_0x37d3ac,_0x2ce784[_0x0992('0x45')]);return db[_0x0992('0x59')][_0x0992('0x23')]({'where':_0x37d3ac['where']})[_0x0992('0x2b')](function(_0x39539f){_0x578b3e[_0x0992('0x23')]=_0x39539f;if(_0x2ce784[_0x0992('0x37')][_0x0992('0x47')]){_0x37d3ac['include']=[{'all':!![]}];}return db[_0x0992('0x59')][_0x0992('0x49')](_0x37d3ac);})[_0x0992('0x2b')](function(_0x14c084){_0x578b3e[_0x0992('0x4a')]=_0x14c084;return _0x578b3e;});}})[_0x0992('0x2b')](respondWithFilteredResult(_0x4449e4,_0x37d3ac))[_0x0992('0x55')](handleError(_0x4449e4,null));};exports[_0x0992('0x5a')]=function(_0x3f4588,_0x4d5aa9,_0xd5d15e){return db['CmList'][_0x0992('0x4d')]({'where':{'id':_0x3f4588[_0x0992('0x4c')]['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x4d5aa9,null))[_0x0992('0x2b')](function(_0x14531a){if(_0x14531a){return _0x14531a[_0x0992('0x5a')](_0x3f4588[_0x0992('0x37')][_0x0992('0x5b')]);}})[_0x0992('0x2b')](respondWithStatusCode(_0x4d5aa9,null))[_0x0992('0x55')](handleError(_0x4d5aa9,null));};exports['addContacts']=function(_0x1c36b5,_0x239163,_0x3524e1){return db[_0x0992('0x46')]['find']({'where':{'id':_0x1c36b5[_0x0992('0x4c')]['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x239163,null))[_0x0992('0x2b')](function(_0x5f2e87){if(_0x5f2e87){var _0x4aaf15=[];var _0x41bfb5={'success':[],'errors':[]};return db[_0x0992('0x5c')]['describe']()[_0x0992('0x2b')](function(_0x25affd){if(_0x1c36b5['body'][_0x0992('0x5d')]&&_[_0x0992('0x5e')](_0x1c36b5['body']['tags'])){if(_0x1c36b5[_0x0992('0x4f')][_0x0992('0x5d')][_0x0992('0x3d')]){_0x1c36b5[_0x0992('0x4f')][_0x0992('0x5d')]=_0x1c36b5[_0x0992('0x4f')][_0x0992('0x5d')][_0x0992('0x5f')](';')+';';}else{_0x1c36b5[_0x0992('0x4f')][_0x0992('0x5d')]=null;}}else{_0x1c36b5[_0x0992('0x4f')][_0x0992('0x5d')]=null;}if(_0x1c36b5[_0x0992('0x4f')]&&_[_0x0992('0x5e')](_0x1c36b5[_0x0992('0x4f')])){for(var _0xddf7cb=0x0;_0xddf7cb<_0x1c36b5[_0x0992('0x4f')][_0x0992('0x3d')];_0xddf7cb+=0x1){_0x1c36b5['body'][_0xddf7cb]['ListId']=_0x1c36b5[_0x0992('0x4c')]['id'];_0x4aaf15[_0x0992('0x60')](_0x1c36b5[_0x0992('0x4f')][_0xddf7cb]);}return BPromise[_0x0992('0x61')](_0x4aaf15,function(_0x463a15){return db[_0x0992('0x5c')]['create'](_[_0x0992('0x62')](_0x463a15,[_0x0992('0x5b'),'id'])||{},{'fields':_[_0x0992('0x36')](_0x25affd),'raw':!![]})[_0x0992('0x2b')](function(_0x6ae55c){_0x41bfb5[_0x0992('0x63')]['push'](_0x6ae55c[_0x0992('0x64')]);})[_0x0992('0x55')](function(_0x65f312){_0x41bfb5['errors'][_0x0992('0x60')]({'data':_0x463a15,'error':_0x65f312[_0x0992('0x65')]});});})['then'](function(_0x48aed5){return _0x41bfb5;})[_0x0992('0x55')](function(_0x197c25){return _0x197c25;});}else{_0x239163['status'](0x190)['json']({'message':_0x0992('0x66')});}});}})[_0x0992('0x2b')](respondWithResult(_0x239163,null))[_0x0992('0x55')](handleError(_0x239163,null));};exports[_0x0992('0x67')]=function(_0x190be0,_0x237ab6,_0x574c92){var _0x582244;return db[_0x0992('0x46')][_0x0992('0x4d')]({'where':{'id':_0x190be0[_0x0992('0x4c')]['id']},'include':[{'model':db[_0x0992('0x68')],'as':_0x0992('0x69')}]})[_0x0992('0x2b')](handleEntityNotFound(_0x237ab6,null))[_0x0992('0x2b')](function(_0xacf4f1){if(_0xacf4f1){_0x582244=_0xacf4f1;return db['CmContact'][_0x0992('0x32')];}})[_0x0992('0x2b')](function(_0x291f1f){if(_0x291f1f){var _0x4e2a56={};var _0x525b84={};_0x525b84[_0x0992('0x3a')]=_['concat'](_['keys'](_0x291f1f),_[_0x0992('0x35')](_0x582244['CustomFields'],function(_0x3f2ea6){return util[_0x0992('0x6a')](_0x0992('0x6b'),_0x3f2ea6['id']);}));_0x525b84['query']=_[_0x0992('0x36')](_0x190be0[_0x0992('0x37')]);_0x525b84[_0x0992('0x38')]=_['intersection'](_0x525b84[_0x0992('0x3a')],_0x525b84['query']);_0x4e2a56['attributes']=_['intersection'](_0x525b84[_0x0992('0x3a')],qs['fields'](_0x190be0[_0x0992('0x37')][_0x0992('0x3c')]));_0x4e2a56[_0x0992('0x3b')]=_0x4e2a56[_0x0992('0x3b')][_0x0992('0x3d')]?_0x4e2a56['attributes']:_0x525b84['model'];if(!_0x190be0[_0x0992('0x37')]['hasOwnProperty'](_0x0992('0x3f'))){_0x4e2a56[_0x0992('0x25')]=qs[_0x0992('0x25')](_0x190be0[_0x0992('0x37')]['limit']);_0x4e2a56[_0x0992('0x24')]=qs[_0x0992('0x24')](_0x190be0[_0x0992('0x37')]['offset']);}_0x4e2a56[_0x0992('0x6c')]=qs[_0x0992('0x40')](_0x190be0[_0x0992('0x37')][_0x0992('0x40')]);_0x4e2a56[_0x0992('0x41')]=qs[_0x0992('0x38')](_[_0x0992('0x42')](_0x190be0[_0x0992('0x37')],_0x525b84['filters']));_0x4e2a56[_0x0992('0x6d')]=!![];if(_0x190be0[_0x0992('0x37')][_0x0992('0x43')]){_0x4e2a56[_0x0992('0x41')]=_[_0x0992('0x44')](_0x4e2a56['where'],{'$or':_[_0x0992('0x35')](_0x4e2a56['attributes'],function(_0x2311f4){var _0x42d900={};_0x42d900[_0x2311f4]={'$like':'%'+_0x190be0[_0x0992('0x37')][_0x0992('0x43')]+'%'};return _0x42d900;})});}_0x4e2a56=_[_0x0992('0x44')]({},_0x4e2a56,_0x190be0['options']);return _0x582244[_0x0992('0x67')](_0x4e2a56);}})[_0x0992('0x2b')](respondWithResult(_0x237ab6,null))['catch'](handleError(_0x237ab6,null));};exports[_0x0992('0x6e')]=function(_0x3a1539,_0x58d53e,_0x463af8){var _0xf4367f;var _0x2dc79f;var _0x12a64e;var _0x55ae1e=_0x3a1539[_0x0992('0x4c')]['id'];csv_results=[];return db[_0x0992('0x6f')][_0x0992('0x49')]({'attributes':['id','name'],'raw':!![],'order':[_0x0992('0x70')]})[_0x0992('0x2b')](function(_0x310bae){_0xf4367f=_0x310bae;var _0x1f91db=_[_0x0992('0x36')](db[_0x0992('0x5c')]['rawAttributes']);return db[_0x0992('0x68')][_0x0992('0x49')]({'raw':!![],'attributes':['id','alias']})[_0x0992('0x2b')](function(_0x1b406d){_0x2dc79f=_0x1b406d;var _0x40ffb3=squel[_0x0992('0x71')]()[_0x0992('0x3c')](_0x1f91db)['from'](_0x0992('0x72'),'c')[_0x0992('0x41')]('c.ListId\x20=\x20?',_0x55ae1e)[_0x0992('0x41')](_0x0992('0x73'))['distinct']();for(var _0x4d6e71=0x0;_0x4d6e71<_0x2dc79f[_0x0992('0x3d')];_0x4d6e71++){_0x40ffb3[_0x0992('0x74')](_0x0992('0x75')+_0x2dc79f[_0x4d6e71]['id'],_0x0992('0x76')+_0x2dc79f[_0x4d6e71]['alias']);}for(var _0x4d6e71=0x0;_0x4d6e71<_0xf4367f[_0x0992('0x3d')];_0x4d6e71++){_0x40ffb3[_0x0992('0x74')](squel[_0x0992('0x71')]()[_0x0992('0x74')](_0x0992('0x77'))['from'](_0x0992('0x78'))[_0x0992('0x41')](_0x0992('0x79'),_0xf4367f[_0x4d6e71]['id'])['where'](_0x0992('0x7a')),'additionalPhone_'+_0xf4367f[_0x4d6e71]['name']);_0x40ffb3[_0x0992('0x74')](squel[_0x0992('0x71')]()[_0x0992('0x74')](_0x0992('0x7b'))[_0x0992('0x7c')]('cm_contact_has_items')['where'](_0x0992('0x79'),_0xf4367f[_0x4d6e71]['id'])['where'](_0x0992('0x7a')),'description_additionalPhone_'+_0xf4367f[_0x4d6e71][_0x0992('0x30')]);}var _0x31480e=[];_0x31480e[_0x0992('0x60')](_0x40ffb3[_0x0992('0x7d')]());BPromise[_0x0992('0x61')](_0x31480e,handleQuery)[_0x0992('0x2b')](function(_0x59768c){handleQuery(_0x40ffb3[_0x0992('0x7d')]());var _0x2c816a=csv_results[0x0];if(!_[_0x0992('0x7e')](_0x2c816a)){var _0x48bf91=toCsv(_0x2c816a);var _0x1e0cbc=Date[_0x0992('0x7f')]();fs[_0x0992('0x80')](util[_0x0992('0x6a')](_0x0992('0x81'),_0x55ae1e,_0x1e0cbc),_0x48bf91);_0x58d53e[_0x0992('0x82')](_0x0992('0x83'),_0x0992('0x84')+util[_0x0992('0x6a')](_0x0992('0x85'),_0x55ae1e,_0x1e0cbc));_0x58d53e[_0x0992('0x82')]('Content-type',_0x0992('0x86'));return _0x58d53e[_0x0992('0x87')](util['format'](_0x0992('0x81'),_0x55ae1e,_0x1e0cbc));}else{return _0x58d53e['sendStatus'](0xcc);}});});});};exports[_0x0992('0x88')]=function(_0x3e1079,_0x337950,_0x581e80){var _0xef9ffd;delete _0x3e1079[_0x0992('0x4f')]['id'];return db[_0x0992('0x46')][_0x0992('0x89')]({'where':{'id':_0x3e1079[_0x0992('0x4c')]['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x337950,null))['then'](function(_0x2ffacc){if(_0x2ffacc){return db[_0x0992('0x8a')][_0x0992('0x8b')](function(_0x21616d){return db[_0x0992('0x68')][_0x0992('0x4e')](_0x3e1079['body'],{'transaction':_0x21616d})[_0x0992('0x2b')](function(_0xe574d7){_0xef9ffd=_0xe574d7;return _0x2ffacc[_0x0992('0x8c')](_0xe574d7,{'transaction':_0x21616d});})[_0x0992('0x2b')](function(){var _0x51f30b={'type':db[_0x0992('0x8d')]['TEXT'],'transaction':_0x21616d};switch(_0x3e1079[_0x0992('0x4f')][_0x0992('0x33')]){case _0x0992('0x8e'):_0x51f30b[_0x0992('0x33')]=db['Sequelize'][_0x0992('0x8f')];break;case _0x0992('0x90'):_0x51f30b['type']=db['Sequelize'][_0x0992('0x91')];break;case _0x0992('0x92'):_0x51f30b['type']=db[_0x0992('0x8d')][_0x0992('0x93')];_0x51f30b[_0x0992('0x94')]=![];break;default:}return db['sequelize'][_0x0992('0x95')]['addColumn']('cm_contacts',util[_0x0992('0x6a')](_0x0992('0x96'),_0xef9ffd['id']),_0x51f30b);})[_0x0992('0x2b')](function(){return _0xef9ffd;});});}})[_0x0992('0x2b')](respondWithResult(_0x337950,null))['catch'](handleError(_0x337950,null));};exports[_0x0992('0x97')]=function(_0x2b48ff,_0x4ac65c,_0x5c2e71){var _0x90696c={};var _0x2ae207={};var _0x455f9b;var _0x29246f;return db[_0x0992('0x46')][_0x0992('0x89')]({'where':{'id':_0x2b48ff['params']['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x4ac65c,null))['then'](function(_0xc14df5){if(_0xc14df5){_0x455f9b=_0xc14df5;_0x2ae207['model']=_['keys'](db[_0x0992('0x68')]['rawAttributes']);_0x2ae207[_0x0992('0x37')]=_[_0x0992('0x36')](_0x2b48ff[_0x0992('0x37')]);_0x2ae207[_0x0992('0x38')]=_[_0x0992('0x39')](_0x2ae207['model'],_0x2ae207[_0x0992('0x37')]);_0x90696c[_0x0992('0x3b')]=_['intersection'](_0x2ae207[_0x0992('0x3a')],qs[_0x0992('0x3c')](_0x2b48ff[_0x0992('0x37')][_0x0992('0x3c')]));_0x90696c[_0x0992('0x3b')]=_0x90696c[_0x0992('0x3b')]['length']?_0x90696c[_0x0992('0x3b')]:_0x2ae207[_0x0992('0x3a')];_0x90696c['order']=qs[_0x0992('0x40')](_0x2b48ff[_0x0992('0x37')][_0x0992('0x40')]);_0x90696c[_0x0992('0x41')]=qs[_0x0992('0x38')](_[_0x0992('0x42')](_0x2b48ff[_0x0992('0x37')],_0x2ae207['filters']));_0x90696c[_0x0992('0x41')]=_['merge'](_0x90696c[_0x0992('0x41')],{'$or':[{'ListId':_0xc14df5['id']},{'ListId':null}]});if(_0x2b48ff[_0x0992('0x37')]['filter']){_0x90696c['where']=_[_0x0992('0x44')](_0x90696c['where'],{'$or':_[_0x0992('0x35')](_0x90696c['attributes'],function(_0x10edd2){var _0x21d885={};_0x21d885[_0x10edd2]={'$like':'%'+_0x2b48ff[_0x0992('0x37')][_0x0992('0x43')]+'%'};return _0x21d885;})});}_0x90696c=_[_0x0992('0x44')]({},_0x90696c,_0x2b48ff[_0x0992('0x45')]);return db[_0x0992('0x68')][_0x0992('0x98')](_0x90696c);}})['then'](respondWithResult(_0x4ac65c,null))['catch'](handleError(_0x4ac65c,null));};exports[_0x0992('0x99')]=function(_0x3e5110,_0x1e3958){return db[_0x0992('0x68')][_0x0992('0x98')]({'where':{'ListId':null}})[_0x0992('0x2b')](handleEntityNotFound(_0x1e3958,null))[_0x0992('0x2b')](function(_0x5cfa12){return _0x5cfa12;})[_0x0992('0x2b')](respondWithResult(_0x1e3958,null))[_0x0992('0x55')](handleError(_0x1e3958,null));};exports[_0x0992('0x9a')]=function(_0x5ede0f,_0x218ac9,_0x1f5e95){return db[_0x0992('0x46')][_0x0992('0x4d')]({'where':{'id':_0x5ede0f[_0x0992('0x4c')]['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x218ac9,null))[_0x0992('0x2b')](function(_0x37bb03){if(_0x37bb03){return _0x37bb03[_0x0992('0x9a')](_0x5ede0f[_0x0992('0x4f')][_0x0992('0x5b')],_[_0x0992('0x62')](_0x5ede0f[_0x0992('0x4f')],[_0x0992('0x5b'),'id'])||{})[_0x0992('0x9b')](function(_0x8235d0){for(var _0x1ae667=0x0;_0x1ae667<_0x5ede0f['body'][_0x0992('0x5b')][_0x0992('0x3d')];_0x1ae667+=0x1){socket[_0x0992('0x9c')](_0x0992('0x9d'),{'UserId':Number(_0x5ede0f[_0x0992('0x4f')]['ids'][_0x1ae667]),'CmListId':Number(_0x5ede0f[_0x0992('0x4c')]['id'])});}return _0x8235d0;});}})[_0x0992('0x2b')](respondWithResult(_0x218ac9,null))[_0x0992('0x55')](handleError(_0x218ac9,null));};exports[_0x0992('0x9e')]=function(_0x7ae3a5,_0x1cd743,_0x15ef42){return db['CmList']['find']({'where':{'id':_0x7ae3a5[_0x0992('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1cd743,null))[_0x0992('0x2b')](function(_0x6fccc5){if(_0x6fccc5){return _0x6fccc5[_0x0992('0x9e')](_0x7ae3a5[_0x0992('0x37')][_0x0992('0x5b')])[_0x0992('0x2b')](function(){if(_[_0x0992('0x5e')](_0x7ae3a5[_0x0992('0x37')][_0x0992('0x5b')])){for(var _0x2c32a7=0x0;_0x2c32a7<_0x7ae3a5[_0x0992('0x37')]['ids'][_0x0992('0x3d')];_0x2c32a7+=0x1){socket[_0x0992('0x9c')](_0x0992('0x9f'),{'UserId':Number(_0x7ae3a5[_0x0992('0x37')][_0x0992('0x5b')][_0x2c32a7]),'CmListId':Number(_0x7ae3a5['params']['id'])});}}else{socket[_0x0992('0x9c')](_0x0992('0x9f'),{'UserId':Number(_0x7ae3a5[_0x0992('0x37')][_0x0992('0x5b')]),'CmListId':Number(_0x7ae3a5['params']['id'])});}});}})[_0x0992('0x2b')](respondWithStatusCode(_0x1cd743,null))[_0x0992('0x55')](handleError(_0x1cd743,null));};exports[_0x0992('0xa0')]=function(_0x47d412,_0x43fba6,_0x1e6ff4){var _0x43d544={};var _0x182085={};var _0x16793c;var _0x1b591d;return db[_0x0992('0x46')][_0x0992('0x89')]({'where':{'id':_0x47d412[_0x0992('0x4c')]['id']}})[_0x0992('0x2b')](handleEntityNotFound(_0x43fba6,null))[_0x0992('0x2b')](function(_0x56e5c6){if(_0x56e5c6){_0x16793c=_0x56e5c6;_0x182085[_0x0992('0x3a')]=_['keys'](db[_0x0992('0xa1')]['rawAttributes']);_0x182085[_0x0992('0x37')]=_['keys'](_0x47d412['query']);_0x182085['filters']=_[_0x0992('0x39')](_0x182085['model'],_0x182085[_0x0992('0x37')]);_0x43d544[_0x0992('0x3b')]=_[_0x0992('0x39')](_0x182085['model'],qs[_0x0992('0x3c')](_0x47d412[_0x0992('0x37')][_0x0992('0x3c')]));_0x43d544[_0x0992('0x3b')]=_0x43d544['attributes'][_0x0992('0x3d')]?_0x43d544[_0x0992('0x3b')]:_0x182085[_0x0992('0x3a')];_0x43d544['order']=qs[_0x0992('0x40')](_0x47d412[_0x0992('0x37')][_0x0992('0x40')]);_0x43d544[_0x0992('0x41')]=qs['filters'](_['pick'](_0x47d412[_0x0992('0x37')],_0x182085[_0x0992('0x38')]));if(_0x47d412[_0x0992('0x37')][_0x0992('0x43')]){_0x43d544[_0x0992('0x41')]=_['merge'](_0x43d544['where'],{'$or':_['map'](_0x43d544['attributes'],function(_0x4a79e3){var _0x56d92e={};_0x56d92e[_0x4a79e3]={'$like':'%'+_0x47d412[_0x0992('0x37')][_0x0992('0x43')]+'%'};return _0x56d92e;})});}_0x43d544=_['merge']({},_0x43d544,_0x47d412[_0x0992('0x45')]);return _0x16793c[_0x0992('0xa0')](_0x43d544);}})[_0x0992('0x2b')](function(_0x5c2823){if(_0x5c2823){_0x1b591d=_0x5c2823[_0x0992('0x3d')];if(!_0x47d412['query'][_0x0992('0x3e')](_0x0992('0x3f'))){_0x43d544[_0x0992('0x25')]=qs['limit'](_0x47d412['query'][_0x0992('0x25')]);_0x43d544[_0x0992('0x24')]=qs['offset'](_0x47d412[_0x0992('0x37')]['offset']);}return _0x16793c[_0x0992('0xa0')](_0x43d544);}})[_0x0992('0x2b')](function(_0x433f4f){if(_0x433f4f){return _0x433f4f?{'count':_0x1b591d,'rows':_0x433f4f}:null;}})['then'](respondWithResult(_0x43fba6,null))[_0x0992('0x55')](handleError(_0x43fba6,null));};function handleQuery(_0x125cea){logger[_0x0992('0xa2')](_0x125cea);return db[_0x0992('0x8a')][_0x0992('0x37')](_0x125cea)[_0x0992('0x9b')](function(_0x372eaf){csv_results['push'](_0x372eaf);})[_0x0992('0x55')](function(_0x1f5777){logger[_0x0992('0x2e')](_0x1f5777[_0x0992('0x65')]);});} \ No newline at end of file +var _0x7b5c=['name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','include','CmList','findAll','rows','catch','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','addContacts','CmContact','isArray','tags','join','push','each','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','/tmp/list_%d_%s.csv','addCustomField','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../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','register','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','Lists','UserProfileResource','sendStatus'];(function(_0x19364f,_0x89ae19){var _0x498a70=function(_0x1e547e){while(--_0x1e547e){_0x19364f['push'](_0x19364f['shift']());}};_0x498a70(++_0x89ae19);}(_0x7b5c,0x11c));var _0xc7b5=function(_0x505a5c,_0x5a8f6f){_0x505a5c=_0x505a5c-0x0;var _0x3d14fc=_0x7b5c[_0x505a5c];return _0x3d14fc;};'use strict';var emlformat=require(_0xc7b5('0x0'));var rimraf=require(_0xc7b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7b5('0x2'));var rp=require(_0xc7b5('0x3'));var moment=require(_0xc7b5('0x4'));var BPromise=require(_0xc7b5('0x5'));var Mustache=require('mustache');var util=require(_0xc7b5('0x6'));var path=require(_0xc7b5('0x7'));var sox=require(_0xc7b5('0x8'));var csv=require(_0xc7b5('0x9'));var ejs=require(_0xc7b5('0xa'));var fs=require('fs');var fs_extra=require(_0xc7b5('0xb'));var _=require(_0xc7b5('0xc'));var squel=require(_0xc7b5('0xd'));var crypto=require('crypto');var jsforce=require(_0xc7b5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc7b5('0x9'));var querystring=require(_0xc7b5('0xf'));var Papa=require(_0xc7b5('0x10'));var Redis=require('ioredis');var authService=require(_0xc7b5('0x11'));var qs=require(_0xc7b5('0x12'));var as=require(_0xc7b5('0x13'));var hardwareService=require(_0xc7b5('0x14'));var logger=require(_0xc7b5('0x15'))(_0xc7b5('0x16'));var utils=require(_0xc7b5('0x17'));var config=require(_0xc7b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc7b5('0x19'))['db'];var csv_results;config['redis']=_[_0xc7b5('0x1a')](config[_0xc7b5('0x1b')],{'host':_0xc7b5('0x1c'),'port':0x18eb});var socket=require(_0xc7b5('0x1d'))(new Redis(config['redis']));require('./cmList.socket')[_0xc7b5('0x1e')](socket);function respondWithStatusCode(_0x4d62db,_0x443962){_0x443962=_0x443962||0xcc;return function(_0x4ce803){if(_0x4ce803){return _0x4d62db['sendStatus'](_0x443962);}return _0x4d62db[_0xc7b5('0x1f')](_0x443962)[_0xc7b5('0x20')]();};}function respondWithResult(_0x3b0dc3,_0x3071be){_0x3071be=_0x3071be||0xc8;return function(_0x2fcf9a){if(_0x2fcf9a){return _0x3b0dc3['status'](_0x3071be)[_0xc7b5('0x21')](_0x2fcf9a);}};}function respondWithFilteredResult(_0x1d5d9e,_0x297255){return function(_0x558523){if(_0x558523){var _0x5d46c8=typeof _0x297255[_0xc7b5('0x22')]===_0xc7b5('0x23')&&typeof _0x297255[_0xc7b5('0x24')]==='undefined';var _0x2c33bc=_0x558523['count'];var _0xcc010=_0x5d46c8?0x0:_0x297255[_0xc7b5('0x22')];var _0x9be3e3=_0x5d46c8?_0x558523['count']:_0x297255['offset']+_0x297255[_0xc7b5('0x24')];var _0x52c22a;if(_0x9be3e3>=_0x2c33bc){_0x9be3e3=_0x2c33bc;_0x52c22a=0xc8;}else{_0x52c22a=0xce;}_0x1d5d9e['status'](_0x52c22a);return _0x1d5d9e[_0xc7b5('0x25')](_0xc7b5('0x26'),_0xcc010+'-'+_0x9be3e3+'/'+_0x2c33bc)[_0xc7b5('0x21')](_0x558523);}return null;};}function patchUpdates(_0x41c172){return function(_0x24f9db){try{jsonpatch[_0xc7b5('0x27')](_0x24f9db,_0x41c172,!![]);}catch(_0x5b0755){return BPromise[_0xc7b5('0x28')](_0x5b0755);}return _0x24f9db[_0xc7b5('0x29')]();};}function saveUpdates(_0x341832,_0x484792){return function(_0x1f2608){if(_0x1f2608){return _0x1f2608[_0xc7b5('0x2a')](_0x341832)[_0xc7b5('0x2b')](function(_0x3d6c94){return _0x3d6c94;});}return null;};}function removeEntity(_0x593bdf,_0x24c408){return function(_0x42aa7b){if(_0x42aa7b){return _0x42aa7b[_0xc7b5('0x2c')]()['then'](function(){var _0x4d9b5e=_0x42aa7b['get']({'plain':!![]});var _0x20abe9=_0xc7b5('0x2d');return db[_0xc7b5('0x2e')][_0xc7b5('0x2c')]({'where':{'type':_0x20abe9,'resourceId':_0x4d9b5e['id']}})[_0xc7b5('0x2b')](function(){return _0x42aa7b;});})[_0xc7b5('0x2b')](function(){_0x593bdf[_0xc7b5('0x1f')](0xcc)[_0xc7b5('0x20')]();});}};}function handleEntityNotFound(_0x334e0a,_0x1d29d1){return function(_0x1b8fea){if(!_0x1b8fea){_0x334e0a[_0xc7b5('0x2f')](0x194);}return _0x1b8fea;};}function handleError(_0x950e4c,_0x1403b9){_0x1403b9=_0x1403b9||0x1f4;return function(_0x22e1b2){logger['error'](_0x22e1b2['stack']);if(_0x22e1b2[_0xc7b5('0x30')]){delete _0x22e1b2[_0xc7b5('0x30')];}_0x950e4c['status'](_0x1403b9)['send'](_0x22e1b2);};}exports[_0xc7b5('0x31')]=function(_0x1e5714,_0x51d7e1){var _0x525850={},_0x2bd40f={},_0x3411b7={'count':0x0,'rows':[]};var _0x53e917=_[_0xc7b5('0x32')](db['CmList'][_0xc7b5('0x33')],function(_0x2e712e){return{'name':_0x2e712e[_0xc7b5('0x34')],'type':_0x2e712e[_0xc7b5('0x35')][_0xc7b5('0x36')]};});_0x2bd40f[_0xc7b5('0x37')]=_[_0xc7b5('0x32')](_0x53e917,'name');_0x2bd40f[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x1e5714[_0xc7b5('0x38')]);_0x2bd40f[_0xc7b5('0x3a')]=_['intersection'](_0x2bd40f[_0xc7b5('0x37')],_0x2bd40f['query']);_0x525850['attributes']=_[_0xc7b5('0x3b')](_0x2bd40f[_0xc7b5('0x37')],qs[_0xc7b5('0x3c')](_0x1e5714['query'][_0xc7b5('0x3c')]));_0x525850[_0xc7b5('0x3d')]=_0x525850['attributes'][_0xc7b5('0x3e')]?_0x525850[_0xc7b5('0x3d')]:_0x2bd40f[_0xc7b5('0x37')];if(!_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x3f')](_0xc7b5('0x40'))){_0x525850[_0xc7b5('0x24')]=qs['limit'](_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x24')]);_0x525850[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x22')]);}_0x525850[_0xc7b5('0x41')]=qs[_0xc7b5('0x42')](_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x42')]);_0x525850[_0xc7b5('0x43')]=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x1e5714[_0xc7b5('0x38')],_0x2bd40f['filters']),_0x53e917);if(_0x1e5714[_0xc7b5('0x38')]['filter']){_0x525850[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x525850[_0xc7b5('0x43')],{'$or':_['map'](_0x53e917,function(_0x577301){if(_0x577301[_0xc7b5('0x35')]!==_0xc7b5('0x46')){var _0x5516f6={};_0x5516f6[_0x577301[_0xc7b5('0x30')]]={'$like':'%'+_0x1e5714[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x5516f6;}})});}_0x525850=_['merge']({},_0x525850,_0x1e5714[_0xc7b5('0x48')]);var _0x4ec432={'where':_0x525850[_0xc7b5('0x43')]};return db['CmList']['count'](_0x4ec432)[_0xc7b5('0x2b')](function(_0x3fc202){_0x3411b7[_0xc7b5('0x49')]=_0x3fc202;if(_0x1e5714['query']['includeAll']){_0x525850[_0xc7b5('0x4a')]=[{'all':!![]}];}return db[_0xc7b5('0x4b')][_0xc7b5('0x4c')](_0x525850);})[_0xc7b5('0x2b')](function(_0x4cd319){_0x3411b7[_0xc7b5('0x4d')]=_0x4cd319;return _0x3411b7;})[_0xc7b5('0x2b')](respondWithFilteredResult(_0x51d7e1,_0x525850))[_0xc7b5('0x4e')](handleError(_0x51d7e1,null));};exports['show']=function(_0x43cf6c,_0xd8d7a4){var _0x178536={'raw':![],'where':{'id':_0x43cf6c[_0xc7b5('0x4f')]['id']}},_0x2e3aae={};_0x2e3aae['model']=_[_0xc7b5('0x39')](db[_0xc7b5('0x4b')][_0xc7b5('0x33')]);_0x2e3aae['query']=_[_0xc7b5('0x39')](_0x43cf6c[_0xc7b5('0x38')]);_0x2e3aae[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x2e3aae[_0xc7b5('0x37')],_0x2e3aae[_0xc7b5('0x38')]);_0x178536[_0xc7b5('0x3d')]=_[_0xc7b5('0x3b')](_0x2e3aae[_0xc7b5('0x37')],qs[_0xc7b5('0x3c')](_0x43cf6c[_0xc7b5('0x38')][_0xc7b5('0x3c')]));_0x178536['attributes']=_0x178536[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x178536[_0xc7b5('0x3d')]:_0x2e3aae[_0xc7b5('0x37')];if(_0x43cf6c[_0xc7b5('0x38')][_0xc7b5('0x50')]){_0x178536[_0xc7b5('0x4a')]=[{'all':!![]}];}_0x178536=_[_0xc7b5('0x45')]({},_0x178536,_0x43cf6c['options']);return db[_0xc7b5('0x4b')][_0xc7b5('0x51')](_0x178536)[_0xc7b5('0x2b')](handleEntityNotFound(_0xd8d7a4,null))[_0xc7b5('0x2b')](respondWithResult(_0xd8d7a4,null))[_0xc7b5('0x4e')](handleError(_0xd8d7a4,null));};exports[_0xc7b5('0x52')]=function(_0x117dda,_0x3300da){return db[_0xc7b5('0x4b')][_0xc7b5('0x52')](_0x117dda[_0xc7b5('0x53')],{})[_0xc7b5('0x2b')](function(_0x2179f9){var _0xfdfd70=_0x117dda[_0xc7b5('0x54')][_0xc7b5('0x55')]({'plain':!![]});if(!_0xfdfd70)throw new Error(_0xc7b5('0x56'));if(_0xfdfd70['role']===_0xc7b5('0x54')){var _0x4c454=_0x2179f9['get']({'plain':!![]});var _0x2e401e=_0xc7b5('0x2d');return db[_0xc7b5('0x57')][_0xc7b5('0x51')]({'where':{'name':_0x2e401e,'userProfileId':_0xfdfd70['userProfileId']},'raw':!![]})[_0xc7b5('0x2b')](function(_0x1cfe77){if(_0x1cfe77&&_0x1cfe77[_0xc7b5('0x58')]===0x0){return db[_0xc7b5('0x2e')][_0xc7b5('0x52')]({'name':_0x4c454[_0xc7b5('0x30')],'resourceId':_0x4c454['id'],'type':_0x1cfe77[_0xc7b5('0x30')],'sectionId':_0x1cfe77['id']},{})[_0xc7b5('0x2b')](function(){return _0x2179f9;});}else{return _0x2179f9;}})[_0xc7b5('0x4e')](function(_0x4da7af){logger[_0xc7b5('0x59')](_0xc7b5('0x5a'),_0x4da7af);throw _0x4da7af;});}return _0x2179f9;})[_0xc7b5('0x2b')](respondWithResult(_0x3300da,0xc9))[_0xc7b5('0x4e')](handleError(_0x3300da,null));};exports['update']=function(_0x1d0be9,_0x285ce5){if(_0x1d0be9[_0xc7b5('0x53')]['id']){delete _0x1d0be9[_0xc7b5('0x53')]['id'];}return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x1d0be9[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x285ce5,null))[_0xc7b5('0x2b')](saveUpdates(_0x1d0be9[_0xc7b5('0x53')],null))[_0xc7b5('0x2b')](respondWithResult(_0x285ce5,null))[_0xc7b5('0x4e')](handleError(_0x285ce5,null));};exports['destroy']=function(_0x235afa,_0x3eb07e){return db[_0xc7b5('0x4b')]['find']({'where':{'id':_0x235afa[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x3eb07e,null))['then'](removeEntity(_0x3eb07e,null))[_0xc7b5('0x4e')](handleError(_0x3eb07e,null));};exports[_0xc7b5('0x5b')]=function(_0x3d3c0e,_0x2b3f07){return db[_0xc7b5('0x4b')][_0xc7b5('0x5b')]()['then'](respondWithResult(_0x2b3f07,null))[_0xc7b5('0x4e')](handleError(_0x2b3f07,null));};exports[_0xc7b5('0x5c')]=function(_0x28cec,_0x590121,_0x1d7f0e){if(_0x28cec['body']['id']){delete _0x28cec[_0xc7b5('0x53')]['id'];}return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x28cec[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x590121,null))[_0xc7b5('0x2b')](function(_0xc348e2){if(_0xc348e2){_0x28cec[_0xc7b5('0x53')][_0xc7b5('0x5d')]=_0xc348e2['id'];return db['Disposition'][_0xc7b5('0x52')](_0x28cec[_0xc7b5('0x53')]);}})[_0xc7b5('0x2b')](respondWithResult(_0x590121,null))[_0xc7b5('0x4e')](handleError(_0x590121,null));};exports[_0xc7b5('0x5e')]=function(_0x918a60,_0x25efeb,_0x11754f){var _0x5be4cb={'raw':![],'where':{}};var _0x5a4872={};var _0x1b3c9b={'count':0x0,'rows':[]};return db[_0xc7b5('0x4b')][_0xc7b5('0x5f')]({'where':{'id':_0x918a60[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x25efeb,null))[_0xc7b5('0x2b')](function(_0x4ded13){if(_0x4ded13){_0x5a4872[_0xc7b5('0x37')]=_[_0xc7b5('0x39')](db['Disposition'][_0xc7b5('0x33')]);_0x5a4872[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x918a60['query']);_0x5a4872[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x5a4872[_0xc7b5('0x37')],_0x5a4872['query']);_0x5be4cb[_0xc7b5('0x3d')]=_['intersection'](_0x5a4872['model'],qs[_0xc7b5('0x3c')](_0x918a60[_0xc7b5('0x38')]['fields']));_0x5be4cb['attributes']=_0x5be4cb[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x5be4cb[_0xc7b5('0x3d')]:_0x5a4872[_0xc7b5('0x37')];if(!_0x918a60[_0xc7b5('0x38')]['hasOwnProperty'](_0xc7b5('0x40'))){_0x5be4cb[_0xc7b5('0x24')]=qs[_0xc7b5('0x24')](_0x918a60[_0xc7b5('0x38')]['limit']);_0x5be4cb[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x22')]);}_0x5be4cb[_0xc7b5('0x41')]=qs['sort'](_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x42')]);_0x5be4cb['where']=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x918a60[_0xc7b5('0x38')],_0x5a4872['filters']));_0x5be4cb[_0xc7b5('0x43')]['ListId']=_0x4ded13['id'];if(_0x918a60[_0xc7b5('0x38')]['filter']){_0x5be4cb['where']=_[_0xc7b5('0x45')](_0x5be4cb[_0xc7b5('0x43')],{'$or':_[_0xc7b5('0x32')](_0x5be4cb['attributes'],function(_0x3fed15){var _0x37be0e={};_0x37be0e[_0x3fed15]={'$like':'%'+_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x37be0e;})});}_0x5be4cb=_[_0xc7b5('0x45')]({},_0x5be4cb,_0x918a60[_0xc7b5('0x48')]);return db[_0xc7b5('0x60')][_0xc7b5('0x49')]({'where':_0x5be4cb['where']})['then'](function(_0x2df419){_0x1b3c9b['count']=_0x2df419;if(_0x918a60[_0xc7b5('0x38')][_0xc7b5('0x50')]){_0x5be4cb['include']=[{'all':!![]}];}return db[_0xc7b5('0x60')]['findAll'](_0x5be4cb);})[_0xc7b5('0x2b')](function(_0x41174e){_0x1b3c9b[_0xc7b5('0x4d')]=_0x41174e;return _0x1b3c9b;});}})['then'](respondWithFilteredResult(_0x25efeb,_0x5be4cb))[_0xc7b5('0x4e')](handleError(_0x25efeb,null));};exports[_0xc7b5('0x61')]=function(_0x183779,_0x5acb43,_0x50a2ab){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x183779[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x5acb43,null))[_0xc7b5('0x2b')](function(_0x34093b){if(_0x34093b){return _0x34093b[_0xc7b5('0x61')](_0x183779[_0xc7b5('0x38')]['ids']);}})[_0xc7b5('0x2b')](respondWithStatusCode(_0x5acb43,null))[_0xc7b5('0x4e')](handleError(_0x5acb43,null));};exports[_0xc7b5('0x62')]=function(_0x2c20d1,_0x51131f,_0x3d1d9a){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x2c20d1[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x51131f,null))['then'](function(_0x567e1d){if(_0x567e1d){var _0x30fa6b=[];var _0x2d4437={'success':[],'errors':[]};return db[_0xc7b5('0x63')][_0xc7b5('0x5b')]()['then'](function(_0x588047){if(_0x2c20d1['body']['tags']&&_[_0xc7b5('0x64')](_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x65')])){if(_0x2c20d1[_0xc7b5('0x53')]['tags'][_0xc7b5('0x3e')]){_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x65')]=_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x65')][_0xc7b5('0x66')](';')+';';}else{_0x2c20d1['body'][_0xc7b5('0x65')]=null;}}else{_0x2c20d1[_0xc7b5('0x53')]['tags']=null;}if(_0x2c20d1[_0xc7b5('0x53')]&&_[_0xc7b5('0x64')](_0x2c20d1[_0xc7b5('0x53')])){for(var _0x59ef0c=0x0;_0x59ef0c<_0x2c20d1[_0xc7b5('0x53')][_0xc7b5('0x3e')];_0x59ef0c+=0x1){_0x2c20d1[_0xc7b5('0x53')][_0x59ef0c][_0xc7b5('0x5d')]=_0x2c20d1[_0xc7b5('0x4f')]['id'];_0x30fa6b[_0xc7b5('0x67')](_0x2c20d1[_0xc7b5('0x53')][_0x59ef0c]);}return BPromise[_0xc7b5('0x68')](_0x30fa6b,function(_0x906e7f){return db['CmContact']['create'](_[_0xc7b5('0x69')](_0x906e7f,[_0xc7b5('0x6a'),'id'])||{},{'fields':_['keys'](_0x588047),'raw':!![]})[_0xc7b5('0x2b')](function(_0x24546f){_0x2d4437[_0xc7b5('0x6b')][_0xc7b5('0x67')](_0x24546f[_0xc7b5('0x6c')]);})['catch'](function(_0x2f323d){_0x2d4437[_0xc7b5('0x6d')][_0xc7b5('0x67')]({'data':_0x906e7f,'error':_0x2f323d[_0xc7b5('0x6e')]});});})[_0xc7b5('0x2b')](function(_0x5168ed){return _0x2d4437;})[_0xc7b5('0x4e')](function(_0xc6dce){return _0xc6dce;});}else{_0x51131f[_0xc7b5('0x1f')](0x190)[_0xc7b5('0x21')]({'message':_0xc7b5('0x6f')});}});}})[_0xc7b5('0x2b')](respondWithResult(_0x51131f,null))['catch'](handleError(_0x51131f,null));};exports['getContacts']=function(_0x288a13,_0x1f8fc4,_0x196e9a){var _0x5de625;return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x288a13[_0xc7b5('0x4f')]['id']},'include':[{'model':db[_0xc7b5('0x70')],'as':_0xc7b5('0x71')}]})['then'](handleEntityNotFound(_0x1f8fc4,null))['then'](function(_0x319274){if(_0x319274){_0x5de625=_0x319274;return db[_0xc7b5('0x63')][_0xc7b5('0x33')];}})[_0xc7b5('0x2b')](function(_0x392ef9){if(_0x392ef9){var _0x247ddc={};var _0x232c47={};_0x232c47[_0xc7b5('0x37')]=_[_0xc7b5('0x72')](_[_0xc7b5('0x39')](_0x392ef9),_[_0xc7b5('0x32')](_0x5de625[_0xc7b5('0x71')],function(_0x57a92b){return util[_0xc7b5('0x73')]('cf_%d',_0x57a92b['id']);}));_0x232c47[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x288a13[_0xc7b5('0x38')]);_0x232c47[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x232c47['model'],_0x232c47[_0xc7b5('0x38')]);_0x247ddc[_0xc7b5('0x3d')]=_['intersection'](_0x232c47['model'],qs['fields'](_0x288a13['query']['fields']));_0x247ddc[_0xc7b5('0x3d')]=_0x247ddc[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x247ddc[_0xc7b5('0x3d')]:_0x232c47[_0xc7b5('0x37')];if(!_0x288a13[_0xc7b5('0x38')][_0xc7b5('0x3f')]('nolimit')){_0x247ddc['limit']=qs[_0xc7b5('0x24')](_0x288a13['query'][_0xc7b5('0x24')]);_0x247ddc[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x288a13[_0xc7b5('0x38')][_0xc7b5('0x22')]);}_0x247ddc['order']=qs[_0xc7b5('0x42')](_0x288a13['query'][_0xc7b5('0x42')]);_0x247ddc[_0xc7b5('0x43')]=qs[_0xc7b5('0x3a')](_['pick'](_0x288a13[_0xc7b5('0x38')],_0x232c47[_0xc7b5('0x3a')]));_0x247ddc['raw']=!![];if(_0x288a13[_0xc7b5('0x38')][_0xc7b5('0x47')]){_0x247ddc[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x247ddc[_0xc7b5('0x43')],{'$or':_['map'](_0x247ddc[_0xc7b5('0x3d')],function(_0x53c471){var _0x4e2786={};_0x4e2786[_0x53c471]={'$like':'%'+_0x288a13['query'][_0xc7b5('0x47')]+'%'};return _0x4e2786;})});}_0x247ddc=_[_0xc7b5('0x45')]({},_0x247ddc,_0x288a13[_0xc7b5('0x48')]);return _0x5de625['getContacts'](_0x247ddc);}})[_0xc7b5('0x2b')](respondWithResult(_0x1f8fc4,null))['catch'](handleError(_0x1f8fc4,null));};exports[_0xc7b5('0x74')]=function(_0x1d2d74,_0x2aeffe,_0x40d6d7){var _0x19df80;var _0x1b0d61;var _0x3fa865;var _0x30aefc=_0x1d2d74[_0xc7b5('0x4f')]['id'];csv_results=[];return db[_0xc7b5('0x75')][_0xc7b5('0x4c')]({'attributes':['id',_0xc7b5('0x30')],'raw':!![],'order':[_0xc7b5('0x76')]})[_0xc7b5('0x2b')](function(_0x38cc33){_0x19df80=_0x38cc33;var _0x5dc280=_[_0xc7b5('0x39')](db[_0xc7b5('0x63')][_0xc7b5('0x33')]);return db['CmCustomField'][_0xc7b5('0x4c')]({'raw':!![],'attributes':['id',_0xc7b5('0x77')]})[_0xc7b5('0x2b')](function(_0x3d0080){_0x1b0d61=_0x3d0080;var _0x9629f8=squel[_0xc7b5('0x78')]()[_0xc7b5('0x3c')](_0x5dc280)['from'](_0xc7b5('0x79'),'c')['where'](_0xc7b5('0x7a'),_0x30aefc)[_0xc7b5('0x43')]('c.deletedAt\x20is\x20null')[_0xc7b5('0x7b')]();for(var _0x5f5387=0x0;_0x5f5387<_0x1b0d61[_0xc7b5('0x3e')];_0x5f5387++){_0x9629f8[_0xc7b5('0x7c')](_0xc7b5('0x7d')+_0x1b0d61[_0x5f5387]['id'],_0xc7b5('0x7e')+_0x1b0d61[_0x5f5387][_0xc7b5('0x77')]);}for(var _0x5f5387=0x0;_0x5f5387<_0x19df80[_0xc7b5('0x3e')];_0x5f5387++){_0x9629f8['field'](squel[_0xc7b5('0x78')]()['field'](_0xc7b5('0x7f'))[_0xc7b5('0x80')](_0xc7b5('0x81'))[_0xc7b5('0x43')](_0xc7b5('0x82'),_0x19df80[_0x5f5387]['id'])[_0xc7b5('0x43')](_0xc7b5('0x83')),_0xc7b5('0x84')+_0x19df80[_0x5f5387][_0xc7b5('0x30')]);_0x9629f8[_0xc7b5('0x7c')](squel[_0xc7b5('0x78')]()[_0xc7b5('0x7c')](_0xc7b5('0x85'))['from'](_0xc7b5('0x81'))['where'](_0xc7b5('0x82'),_0x19df80[_0x5f5387]['id'])[_0xc7b5('0x43')](_0xc7b5('0x83')),'description_additionalPhone_'+_0x19df80[_0x5f5387][_0xc7b5('0x30')]);}var _0x38ce42=[];_0x38ce42[_0xc7b5('0x67')](_0x9629f8['toString']());BPromise['each'](_0x38ce42,handleQuery)[_0xc7b5('0x2b')](function(_0x2117fa){handleQuery(_0x9629f8['toString']());var _0x40f541=csv_results[0x0];if(!_[_0xc7b5('0x86')](_0x40f541)){var _0xeabbdb=toCsv(_0x40f541);var _0x3fdf18=Date[_0xc7b5('0x87')]();fs[_0xc7b5('0x88')](util[_0xc7b5('0x73')]('/tmp/list_%d_%s.csv',_0x30aefc,_0x3fdf18),_0xeabbdb);_0x2aeffe[_0xc7b5('0x89')](_0xc7b5('0x8a'),_0xc7b5('0x8b')+util[_0xc7b5('0x73')](_0xc7b5('0x8c'),_0x30aefc,_0x3fdf18));_0x2aeffe[_0xc7b5('0x89')]('Content-type',_0xc7b5('0x8d'));return _0x2aeffe['download'](util[_0xc7b5('0x73')](_0xc7b5('0x8e'),_0x30aefc,_0x3fdf18));}else{return _0x2aeffe[_0xc7b5('0x2f')](0xcc);}});});});};exports[_0xc7b5('0x8f')]=function(_0x38d0cc,_0x43d98b,_0x37eb80){var _0x381acc;delete _0x38d0cc[_0xc7b5('0x53')]['id'];return db[_0xc7b5('0x4b')][_0xc7b5('0x5f')]({'where':{'id':_0x38d0cc[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x43d98b,null))[_0xc7b5('0x2b')](function(_0x54050c){if(_0x54050c){return db['sequelize']['transaction'](function(_0x47987d){return db[_0xc7b5('0x70')][_0xc7b5('0x52')](_0x38d0cc[_0xc7b5('0x53')],{'transaction':_0x47987d})['then'](function(_0x2cd357){_0x381acc=_0x2cd357;return _0x54050c[_0xc7b5('0x90')](_0x2cd357,{'transaction':_0x47987d});})[_0xc7b5('0x2b')](function(){var _0x131ea4={'type':db['Sequelize'][_0xc7b5('0x91')],'transaction':_0x47987d};switch(_0x38d0cc[_0xc7b5('0x53')][_0xc7b5('0x35')]){case _0xc7b5('0x92'):_0x131ea4[_0xc7b5('0x35')]=db['Sequelize'][_0xc7b5('0x91')];break;case'number':_0x131ea4['type']=db[_0xc7b5('0x93')][_0xc7b5('0x94')];break;case _0xc7b5('0x95'):_0x131ea4[_0xc7b5('0x35')]=db[_0xc7b5('0x93')][_0xc7b5('0x96')];_0x131ea4[_0xc7b5('0x97')]=![];break;default:}return db[_0xc7b5('0x98')][_0xc7b5('0x99')]['addColumn']('cm_contacts',util[_0xc7b5('0x73')](_0xc7b5('0x9a'),_0x381acc['id']),_0x131ea4);})['then'](function(){return _0x381acc;});});}})[_0xc7b5('0x2b')](respondWithResult(_0x43d98b,null))[_0xc7b5('0x4e')](handleError(_0x43d98b,null));};exports[_0xc7b5('0x9b')]=function(_0x303e54,_0xeb5f57,_0x33912f){var _0x359d35={};var _0x17bfe6={};var _0x485fef;var _0x3d2911;return db[_0xc7b5('0x4b')]['findOne']({'where':{'id':_0x303e54[_0xc7b5('0x4f')]['id']}})['then'](handleEntityNotFound(_0xeb5f57,null))['then'](function(_0x1b9d84){if(_0x1b9d84){_0x485fef=_0x1b9d84;_0x17bfe6[_0xc7b5('0x37')]=_[_0xc7b5('0x39')](db[_0xc7b5('0x70')]['rawAttributes']);_0x17bfe6['query']=_[_0xc7b5('0x39')](_0x303e54[_0xc7b5('0x38')]);_0x17bfe6[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x17bfe6[_0xc7b5('0x37')],_0x17bfe6[_0xc7b5('0x38')]);_0x359d35['attributes']=_[_0xc7b5('0x3b')](_0x17bfe6[_0xc7b5('0x37')],qs[_0xc7b5('0x3c')](_0x303e54[_0xc7b5('0x38')]['fields']));_0x359d35[_0xc7b5('0x3d')]=_0x359d35['attributes'][_0xc7b5('0x3e')]?_0x359d35[_0xc7b5('0x3d')]:_0x17bfe6['model'];_0x359d35[_0xc7b5('0x41')]=qs['sort'](_0x303e54[_0xc7b5('0x38')][_0xc7b5('0x42')]);_0x359d35[_0xc7b5('0x43')]=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x303e54['query'],_0x17bfe6[_0xc7b5('0x3a')]));_0x359d35[_0xc7b5('0x43')]=_['merge'](_0x359d35[_0xc7b5('0x43')],{'$or':[{'ListId':_0x1b9d84['id']},{'ListId':null}]});if(_0x303e54[_0xc7b5('0x38')][_0xc7b5('0x47')]){_0x359d35[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x359d35[_0xc7b5('0x43')],{'$or':_['map'](_0x359d35['attributes'],function(_0x93353a){var _0x2c1421={};_0x2c1421[_0x93353a]={'$like':'%'+_0x303e54[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x2c1421;})});}_0x359d35=_[_0xc7b5('0x45')]({},_0x359d35,_0x303e54[_0xc7b5('0x48')]);return db[_0xc7b5('0x70')][_0xc7b5('0x9c')](_0x359d35);}})['then'](respondWithResult(_0xeb5f57,null))[_0xc7b5('0x4e')](handleError(_0xeb5f57,null));};exports[_0xc7b5('0x9d')]=function(_0x4d5bf1,_0x1412e4){return db[_0xc7b5('0x70')][_0xc7b5('0x9c')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1412e4,null))[_0xc7b5('0x2b')](function(_0x4ccdc6){return _0x4ccdc6;})[_0xc7b5('0x2b')](respondWithResult(_0x1412e4,null))[_0xc7b5('0x4e')](handleError(_0x1412e4,null));};exports[_0xc7b5('0x9e')]=function(_0x1e6eda,_0x362ce3,_0x17ae67){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x1e6eda['params']['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x362ce3,null))[_0xc7b5('0x2b')](function(_0x1bdaf7){if(_0x1bdaf7){return _0x1bdaf7[_0xc7b5('0x9e')](_0x1e6eda[_0xc7b5('0x53')][_0xc7b5('0x6a')],_['omit'](_0x1e6eda[_0xc7b5('0x53')],[_0xc7b5('0x6a'),'id'])||{})[_0xc7b5('0x9f')](function(_0x184484){for(var _0x517364=0x0;_0x517364<_0x1e6eda[_0xc7b5('0x53')][_0xc7b5('0x6a')]['length'];_0x517364+=0x1){socket[_0xc7b5('0xa0')](_0xc7b5('0xa1'),{'UserId':Number(_0x1e6eda[_0xc7b5('0x53')][_0xc7b5('0x6a')][_0x517364]),'CmListId':Number(_0x1e6eda[_0xc7b5('0x4f')]['id'])});}return _0x184484;});}})[_0xc7b5('0x2b')](respondWithResult(_0x362ce3,null))['catch'](handleError(_0x362ce3,null));};exports['removeAgents']=function(_0x102563,_0x1563a1,_0x78258c){return db[_0xc7b5('0x4b')][_0xc7b5('0x51')]({'where':{'id':_0x102563[_0xc7b5('0x4f')]['id']}})[_0xc7b5('0x2b')](handleEntityNotFound(_0x1563a1,null))['then'](function(_0x4b65b7){if(_0x4b65b7){return _0x4b65b7[_0xc7b5('0xa2')](_0x102563['query'][_0xc7b5('0x6a')])[_0xc7b5('0x2b')](function(){if(_[_0xc7b5('0x64')](_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')])){for(var _0x3b5374=0x0;_0x3b5374<_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')][_0xc7b5('0x3e')];_0x3b5374+=0x1){socket[_0xc7b5('0xa0')](_0xc7b5('0xa3'),{'UserId':Number(_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')][_0x3b5374]),'CmListId':Number(_0x102563[_0xc7b5('0x4f')]['id'])});}}else{socket[_0xc7b5('0xa0')](_0xc7b5('0xa3'),{'UserId':Number(_0x102563[_0xc7b5('0x38')][_0xc7b5('0x6a')]),'CmListId':Number(_0x102563[_0xc7b5('0x4f')]['id'])});}});}})[_0xc7b5('0x2b')](respondWithStatusCode(_0x1563a1,null))[_0xc7b5('0x4e')](handleError(_0x1563a1,null));};exports['getAgents']=function(_0x5eaf67,_0x461101,_0x1b82aa){var _0x4c0ffc={};var _0x46cf29={};var _0x6c0a10;var _0xa9a938;return db[_0xc7b5('0x4b')][_0xc7b5('0x5f')]({'where':{'id':_0x5eaf67[_0xc7b5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x461101,null))['then'](function(_0x29d379){if(_0x29d379){_0x6c0a10=_0x29d379;_0x46cf29[_0xc7b5('0x37')]=_[_0xc7b5('0x39')](db['User'][_0xc7b5('0x33')]);_0x46cf29[_0xc7b5('0x38')]=_[_0xc7b5('0x39')](_0x5eaf67[_0xc7b5('0x38')]);_0x46cf29[_0xc7b5('0x3a')]=_[_0xc7b5('0x3b')](_0x46cf29['model'],_0x46cf29['query']);_0x4c0ffc[_0xc7b5('0x3d')]=_[_0xc7b5('0x3b')](_0x46cf29['model'],qs[_0xc7b5('0x3c')](_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x3c')]));_0x4c0ffc['attributes']=_0x4c0ffc[_0xc7b5('0x3d')][_0xc7b5('0x3e')]?_0x4c0ffc[_0xc7b5('0x3d')]:_0x46cf29[_0xc7b5('0x37')];_0x4c0ffc[_0xc7b5('0x41')]=qs['sort'](_0x5eaf67['query'][_0xc7b5('0x42')]);_0x4c0ffc['where']=qs[_0xc7b5('0x3a')](_[_0xc7b5('0x44')](_0x5eaf67[_0xc7b5('0x38')],_0x46cf29['filters']));if(_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x47')]){_0x4c0ffc[_0xc7b5('0x43')]=_[_0xc7b5('0x45')](_0x4c0ffc['where'],{'$or':_[_0xc7b5('0x32')](_0x4c0ffc[_0xc7b5('0x3d')],function(_0x404f41){var _0x2dd810={};_0x2dd810[_0x404f41]={'$like':'%'+_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x47')]+'%'};return _0x2dd810;})});}_0x4c0ffc=_[_0xc7b5('0x45')]({},_0x4c0ffc,_0x5eaf67[_0xc7b5('0x48')]);return _0x6c0a10[_0xc7b5('0xa4')](_0x4c0ffc);}})[_0xc7b5('0x2b')](function(_0xe2e125){if(_0xe2e125){_0xa9a938=_0xe2e125[_0xc7b5('0x3e')];if(!_0x5eaf67['query'][_0xc7b5('0x3f')](_0xc7b5('0x40'))){_0x4c0ffc[_0xc7b5('0x24')]=qs[_0xc7b5('0x24')](_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x24')]);_0x4c0ffc['offset']=qs[_0xc7b5('0x22')](_0x5eaf67[_0xc7b5('0x38')][_0xc7b5('0x22')]);}return _0x6c0a10[_0xc7b5('0xa4')](_0x4c0ffc);}})[_0xc7b5('0x2b')](function(_0x595e96){if(_0x595e96){return _0x595e96?{'count':_0xa9a938,'rows':_0x595e96}:null;}})[_0xc7b5('0x2b')](respondWithResult(_0x461101,null))['catch'](handleError(_0x461101,null));};function handleQuery(_0x39758c){logger[_0xc7b5('0xa5')](_0x39758c);return db[_0xc7b5('0x98')][_0xc7b5('0x38')](_0x39758c)[_0xc7b5('0x9f')](function(_0x45e7d2){csv_results['push'](_0x45e7d2);})['catch'](function(_0x2587f1){logger[_0xc7b5('0x59')](_0x2587f1[_0xc7b5('0x6e')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3ec723a..269102f 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x5fc3,0xa8));var _0x35fc=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x5fc3[_0x51bda1];return _0x1ce08c;};'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 +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x35af53,_0x5966b1){var _0x6bbbce=function(_0x3a79c0){while(--_0x3a79c0){_0x35af53['push'](_0x35af53['shift']());}};_0x6bbbce(++_0x5966b1);}(_0x814b,0x1a2));var _0xb814=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x814b[_0x546aaf];return _0x1cbf6d;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a140872..6bd3a94 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x296841,_0xf3266a){var _0x45718b=function(_0x2dcce4){while(--_0x2dcce4){_0x296841['push'](_0x296841['shift']());}};_0x45718b(++_0xf3266a);}(_0xaa88,0x137));var _0x8aa8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xaa88[_0x3f465d];return _0x121ad1;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x9d3994,_0x29640e){var _0x11a55e=function(_0x2dd184){while(--_0x2dd184){_0x9d3994['push'](_0x9d3994['shift']());}};_0x11a55e(++_0x29640e);}(_0x5ff3,0x17d));var _0x35ff=function(_0xa9f5ff,_0x3f8807){_0xa9f5ff=_0xa9f5ff-0x0;var _0x2998a2=_0x5ff3[_0xa9f5ff];return _0x2998a2;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'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 30ef793..4f84cb2 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 _0x6f3c=['message','info','request\x20sent','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','error'];(function(_0x3d17e0,_0x56e2b){var _0xb0f7ee=function(_0x54cfee){while(--_0x54cfee){_0x3d17e0['push'](_0x3d17e0['shift']());}};_0xb0f7ee(++_0x56e2b);}(_0x6f3c,0x12f));var _0xc6f3=function(_0x565a0c,_0x4ae44a){_0x565a0c=_0x565a0c-0x0;var _0x251fbf=_0x6f3c[_0x565a0c];return _0x251fbf;};'use strict';var _=require('lodash');var util=require(_0xc6f3('0x0'));var moment=require(_0xc6f3('0x1'));var BPromise=require(_0xc6f3('0x2'));var rs=require(_0xc6f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6f3('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6f3('0x6'));var client=jayson[_0xc6f3('0x7')][_0xc6f3('0x8')]({'port':0x232a});config[_0xc6f3('0x9')]=_[_0xc6f3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc6f3('0xb'))(new Redis(config['redis']));require(_0xc6f3('0xc'))[_0xc6f3('0xd')](socket);function respondWithRpcPromise(_0x1ffa0c,_0x48e879,_0x572f76){return new BPromise(function(_0x26f42f,_0x355a03){return client[_0xc6f3('0xe')](_0x1ffa0c,_0x572f76)['then'](function(_0x1f6117){logger['info'](_0xc6f3('0xf'),_0x48e879,'request\x20sent');logger[_0xc6f3('0x10')](_0xc6f3('0x11'),_0x48e879,'request\x20sent',JSON['stringify'](_0x1f6117));if(_0x1f6117['error']){if(_0x1f6117['error']['code']===0x1f4){logger[_0xc6f3('0x12')](_0xc6f3('0xf'),_0x48e879,_0x1f6117[_0xc6f3('0x12')]['message']);return _0x355a03(_0x1f6117[_0xc6f3('0x12')][_0xc6f3('0x13')]);}logger[_0xc6f3('0x12')](_0xc6f3('0xf'),_0x48e879,_0x1f6117[_0xc6f3('0x12')][_0xc6f3('0x13')]);return _0x26f42f(_0x1f6117['error'][_0xc6f3('0x13')]);}else{logger[_0xc6f3('0x14')]('CmList,\x20%s,\x20%s',_0x48e879,_0xc6f3('0x15'));_0x26f42f(_0x1f6117['result'][_0xc6f3('0x13')]);}})[_0xc6f3('0x16')](function(_0x36a2d0){logger[_0xc6f3('0x12')]('CmList,\x20%s,\x20%s',_0x48e879,_0x36a2d0);_0x355a03(_0x36a2d0);});});} \ No newline at end of file +var _0xe35d=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2865fd,_0x3fce5e){var _0x2e6712=function(_0x239a35){while(--_0x239a35){_0x2865fd['push'](_0x2865fd['shift']());}};_0x2e6712(++_0x3fce5e);}(_0xe35d,0x105));var _0xde35=function(_0x51dc77,_0x456f7e){_0x51dc77=_0x51dc77-0x0;var _0x21a864=_0xe35d[_0x51dc77];return _0x21a864;};'use strict';var _=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var moment=require(_0xde35('0x2'));var BPromise=require(_0xde35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde35('0x4'));var db=require(_0xde35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde35('0x6'))(_0xde35('0x7'));var config=require(_0xde35('0x8'));var jayson=require(_0xde35('0x9'));var client=jayson[_0xde35('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xde35('0xb'),'port':0x18eb});var socket=require(_0xde35('0xc'))(new Redis(config[_0xde35('0xd')]));require('./cmList.socket')[_0xde35('0xe')](socket);function respondWithRpcPromise(_0x5af2cf,_0x499ecb,_0x155da6){return new BPromise(function(_0x258bef,_0x32e75f){return client[_0xde35('0xf')](_0x5af2cf,_0x155da6)[_0xde35('0x10')](function(_0x55bd63){logger['info'](_0xde35('0x11'),_0x499ecb,_0xde35('0x12'));logger['debug'](_0xde35('0x13'),_0x499ecb,'request\x20sent',JSON[_0xde35('0x14')](_0x55bd63));if(_0x55bd63[_0xde35('0x15')]){if(_0x55bd63[_0xde35('0x15')][_0xde35('0x16')]===0x1f4){logger[_0xde35('0x15')]('CmList,\x20%s,\x20%s',_0x499ecb,_0x55bd63[_0xde35('0x15')][_0xde35('0x17')]);return _0x32e75f(_0x55bd63[_0xde35('0x15')]['message']);}logger[_0xde35('0x15')](_0xde35('0x11'),_0x499ecb,_0x55bd63[_0xde35('0x15')]['message']);return _0x258bef(_0x55bd63[_0xde35('0x15')][_0xde35('0x17')]);}else{logger[_0xde35('0x18')](_0xde35('0x11'),_0x499ecb,_0xde35('0x12'));_0x258bef(_0x55bd63[_0xde35('0x19')]['message']);}})['catch'](function(_0x471bd7){logger[_0xde35('0x15')](_0xde35('0x11'),_0x499ecb,_0x471bd7);_0x32e75f(_0x471bd7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 709fc35..b0920af 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 _0xdd3e=['./cmList.events','save','update','register','cmList:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd3e,0x11d));var _0xedd3=function(_0x14d45c,_0xd726f1){_0x14d45c=_0x14d45c-0x0;var _0x29005f=_0xdd3e[_0x14d45c];return _0x29005f;};'use strict';var CmListEvents=require(_0xedd3('0x0'));var events=[_0xedd3('0x1'),'remove',_0xedd3('0x2')];function createListener(_0x2d3725,_0x7d8deb){return function(_0x59bd18){_0x7d8deb['emit'](_0x2d3725,_0x59bd18);};}function removeListener(_0x10c2a4,_0x4f8870){return function(){CmListEvents['removeListener'](_0x10c2a4,_0x4f8870);};}exports[_0xedd3('0x3')]=function(_0x2831b7){for(var _0x2f29ce=0x0,_0x1706fa=events['length'];_0x2f29ce<_0x1706fa;_0x2f29ce++){var _0x2823de=events[_0x2f29ce];var _0x1b4bd9=createListener(_0xedd3('0x4')+_0x2823de,_0x2831b7);CmListEvents['on'](_0x2823de,_0x1b4bd9);}}; \ No newline at end of file +var _0x1ed5=['cmList:','./cmList.events','save','remove','emit','removeListener','register','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1ed5,0xf1));var _0x51ed=function(_0x3d6ac0,_0x1c52e2){_0x3d6ac0=_0x3d6ac0-0x0;var _0x359130=_0x1ed5[_0x3d6ac0];return _0x359130;};'use strict';var CmListEvents=require(_0x51ed('0x0'));var events=[_0x51ed('0x1'),_0x51ed('0x2'),'update'];function createListener(_0x5ce2fc,_0x51133c){return function(_0x462efe){_0x51133c[_0x51ed('0x3')](_0x5ce2fc,_0x462efe);};}function removeListener(_0x1c88b5,_0x5eb6dd){return function(){CmListEvents[_0x51ed('0x4')](_0x1c88b5,_0x5eb6dd);};}exports[_0x51ed('0x5')]=function(_0x430097){for(var _0x331361=0x0,_0x5a9715=events[_0x51ed('0x6')];_0x331361<_0x5a9715;_0x331361++){var _0x2f1e04=events[_0x331361];var _0x577254=createListener(_0x51ed('0x7')+_0x2f1e04,_0x430097);CmListEvents['on'](_0x2f1e04,_0x577254);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8e3b65d..6651a53 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 _0x3512=['addAgents','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField'];(function(_0x181433,_0x259e41){var _0x5b7885=function(_0x4ad875){while(--_0x4ad875){_0x181433['push'](_0x181433['shift']());}};_0x5b7885(++_0x259e41);}(_0x3512,0x9e));var _0x2351=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3512[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x2351('0x0'));var util=require(_0x2351('0x1'));var path=require(_0x2351('0x2'));var timeout=require(_0x2351('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2351('0x4'));var auth=require(_0x2351('0x5'));var interaction=require(_0x2351('0x6'));var config=require(_0x2351('0x7'));var controller=require(_0x2351('0x8'));router[_0x2351('0x9')]('/',auth[_0x2351('0xa')](),controller[_0x2351('0xb')]);router['get'](_0x2351('0xc'),auth[_0x2351('0xa')](),controller[_0x2351('0xd')]);router['get'](_0x2351('0xe'),auth[_0x2351('0xa')](),controller[_0x2351('0xf')]);router[_0x2351('0x9')](_0x2351('0x10'),auth[_0x2351('0xa')](),controller[_0x2351('0x11')]);router[_0x2351('0x9')](_0x2351('0x12'),auth[_0x2351('0xa')](),controller[_0x2351('0x13')]);router[_0x2351('0x9')](_0x2351('0x14'),auth['isAuthenticated'](),controller['getContacts']);router['get'](_0x2351('0x15'),auth[_0x2351('0xa')](),controller[_0x2351('0x16')]);router[_0x2351('0x9')](_0x2351('0x17'),auth['isAuthenticated'](),controller[_0x2351('0x18')]);router[_0x2351('0x9')](_0x2351('0x19'),auth['isAuthenticated'](),controller[_0x2351('0x1a')]);router[_0x2351('0x1b')]('/',auth[_0x2351('0xa')](),controller[_0x2351('0x1c')]);router[_0x2351('0x1b')](_0x2351('0x12'),auth[_0x2351('0xa')](),controller[_0x2351('0x1d')]);router['post'](_0x2351('0x14'),auth[_0x2351('0xa')](),controller[_0x2351('0x1e')]);router[_0x2351('0x1b')]('/:id/fields',auth[_0x2351('0xa')](),controller[_0x2351('0x1f')]);router[_0x2351('0x1b')](_0x2351('0x19'),auth[_0x2351('0xa')](),controller[_0x2351('0x20')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2351('0x21')]);router['delete'](_0x2351('0x10'),auth[_0x2351('0xa')](),controller[_0x2351('0x22')]);router[_0x2351('0x23')](_0x2351('0x12'),auth[_0x2351('0xa')](),controller['removeDispositions']);router[_0x2351('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x2351('0x24')]);module[_0x2351('0x25')]=router; \ No newline at end of file +var _0xe85c=['isAuthenticated','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','getContacts','getContactsCsv','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','/:id/fields','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xe85c,0x1a6));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require('util');var path=require(_0xce85('0x1'));var timeout=require(_0xce85('0x2'));var express=require(_0xce85('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce85('0x4'));var interaction=require(_0xce85('0x5'));var config=require(_0xce85('0x6'));var controller=require('./cmList.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xce85('0x7')]);router[_0xce85('0x8')](_0xce85('0x9'),auth[_0xce85('0xa')](),controller[_0xce85('0xb')]);router[_0xce85('0x8')](_0xce85('0xc'),auth['isAuthenticated'](),controller[_0xce85('0xd')]);router['get'](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0xf')]);router[_0xce85('0x8')]('/:id/dispositions',auth[_0xce85('0xa')](),controller[_0xce85('0x10')]);router[_0xce85('0x8')]('/:id/contacts',auth[_0xce85('0xa')](),controller[_0xce85('0x11')]);router[_0xce85('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xce85('0x12')]);router[_0xce85('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xce85('0x13')]);router[_0xce85('0x8')](_0xce85('0x14'),auth[_0xce85('0xa')](),controller['getAgents']);router[_0xce85('0x15')]('/',auth[_0xce85('0xa')](),controller[_0xce85('0x16')]);router[_0xce85('0x15')](_0xce85('0x17'),auth[_0xce85('0xa')](),controller[_0xce85('0x18')]);router['post'](_0xce85('0x19'),auth[_0xce85('0xa')](),controller[_0xce85('0x1a')]);router[_0xce85('0x15')](_0xce85('0x1b'),auth[_0xce85('0xa')](),controller[_0xce85('0x1c')]);router[_0xce85('0x15')](_0xce85('0x14'),auth[_0xce85('0xa')](),controller['addAgents']);router[_0xce85('0x1d')](_0xce85('0xe'),auth[_0xce85('0xa')](),controller[_0xce85('0x1e')]);router[_0xce85('0x1f')](_0xce85('0xe'),auth['isAuthenticated'](),controller[_0xce85('0x20')]);router['delete'](_0xce85('0x17'),auth[_0xce85('0xa')](),controller[_0xce85('0x21')]);router['delete']('/:id/users',auth[_0xce85('0xa')](),controller[_0xce85('0x22')]);module[_0xce85('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 00a65a6..7073a99 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 _0x1530=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x1530,0x81));var _0x0153=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x1530[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x0153('0x0'));module[_0x0153('0x1')]={'name':{'type':Sequelize[_0x0153('0x2')],'get':function(_0x434145){return this[_0x0153('0x3')](_0x0153('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0153('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x0153('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xfa39=['sequelize','exports','getDataValue','field','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa39,0x145));var _0x9fa3=function(_0x52740f,_0x343961){_0x52740f=_0x52740f-0x0;var _0x1cbe11=_0xfa39[_0x52740f];return _0x1cbe11;};'use strict';var Sequelize=require(_0x9fa3('0x0'));module[_0x9fa3('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x32e6b7){return this[_0x9fa3('0x2')](_0x9fa3('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x9fa3('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 61b8f89..56f1ffa 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3d584b,_0x258f5f){var _0x4d1532=function(_0x34cd7e){while(--_0x34cd7e){_0x3d584b['push'](_0x3d584b['shift']());}};_0x4d1532(++_0x258f5f);}(_0x7a54,0x106));var _0x47a5=function(_0x21da52,_0x6af29){_0x21da52=_0x21da52-0x0;var _0x51f168=_0x7a54[_0x21da52];return _0x51f168;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x24c737,_0x10d8b3){var _0x1b95ad=function(_0x29c3c5){while(--_0x29c3c5){_0x24c737['push'](_0x24c737['shift']());}};_0x1b95ad(++_0x10d8b3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 a68aa56..d2bb11a 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 _0x2aaf=['moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','lodash','util','api'];(function(_0x15105b,_0x37c016){var _0x131594=function(_0x569028){while(--_0x569028){_0x15105b['push'](_0x15105b['shift']());}};_0x131594(++_0x37c016);}(_0x2aaf,0xc3));var _0xf2aa=function(_0x56943e,_0x51c224){_0x56943e=_0x56943e-0x0;var _0x234a0b=_0x2aaf[_0x56943e];return _0x234a0b;};'use strict';var _=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var logger=require('../../config/logger')(_0xf2aa('0x2'));var moment=require(_0xf2aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2aa('0x4'));var fs=require('fs');var path=require(_0xf2aa('0x5'));var rimraf=require(_0xf2aa('0x6'));var config=require(_0xf2aa('0x7'));var attributes=require(_0xf2aa('0x8'));module[_0xf2aa('0x9')]=function(_0x5c227c,_0x2854f2){return _0x5c227c['define'](_0xf2aa('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdca9=['tools_conditions','lodash','api','moment','rimraf','../../config/environment','exports','define'];(function(_0x4c117d,_0xf11d85){var _0x1d1319=function(_0x486ef0){while(--_0x486ef0){_0x4c117d['push'](_0x4c117d['shift']());}};_0x1d1319(++_0xf11d85);}(_0xdca9,0x151));var _0x9dca=function(_0x5e633a,_0x23f23e){_0x5e633a=_0x5e633a-0x0;var _0x2a7452=_0xdca9[_0x5e633a];return _0x2a7452;};'use strict';var _=require(_0x9dca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9dca('0x1'));var moment=require(_0x9dca('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9dca('0x3'));var config=require(_0x9dca('0x4'));var attributes=require('./condition.attributes');module[_0x9dca('0x5')]=function(_0x290e56,_0x3ff9af){return _0x290e56[_0x9dca('0x6')]('Condition',attributes,{'tableName':_0x9dca('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index a7d5a0b..2b69177 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 _0x74f8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x74f8,0x1cd));var _0x874f=function(_0x277504,_0x41a682){_0x277504=_0x277504-0x0;var _0x1ff6a0=_0x74f8[_0x277504];return _0x1ff6a0;};'use strict';var _=require(_0x874f('0x0'));var util=require('util');var moment=require(_0x874f('0x1'));var BPromise=require('bluebird');var rs=require(_0x874f('0x2'));var fs=require('fs');var Redis=require(_0x874f('0x3'));var db=require(_0x874f('0x4'))['db'];var utils=require(_0x874f('0x5'));var logger=require(_0x874f('0x6'))(_0x874f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x874f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5fc5f7,_0x50b275,_0x50074f){return new BPromise(function(_0x21a4b9,_0x3b5352){return client[_0x874f('0x9')](_0x5fc5f7,_0x50074f)[_0x874f('0xa')](function(_0x29976e){logger[_0x874f('0xb')]('Condition,\x20%s,\x20%s',_0x50b275,'request\x20sent');logger['debug'](_0x874f('0xc'),_0x50b275,_0x874f('0xd'),JSON[_0x874f('0xe')](_0x29976e));if(_0x29976e[_0x874f('0xf')]){if(_0x29976e['error'][_0x874f('0x10')]===0x1f4){logger['error'](_0x874f('0x11'),_0x50b275,_0x29976e[_0x874f('0xf')][_0x874f('0x12')]);return _0x3b5352(_0x29976e['error'][_0x874f('0x12')]);}logger['error'](_0x874f('0x11'),_0x50b275,_0x29976e[_0x874f('0xf')]['message']);return _0x21a4b9(_0x29976e[_0x874f('0xf')][_0x874f('0x12')]);}else{logger[_0x874f('0xb')](_0x874f('0x11'),_0x50b275,'request\x20sent');_0x21a4b9(_0x29976e[_0x874f('0x13')][_0x874f('0x12')]);}})[_0x874f('0x14')](function(_0x4db3d4){logger['error'](_0x874f('0x11'),_0x50b275,_0x4db3d4);_0x3b5352(_0x4db3d4);});});} \ No newline at end of file +var _0xc3b5=['code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59c7ba,_0x146833){var _0x36e1b2=function(_0x164237){while(--_0x164237){_0x59c7ba['push'](_0x59c7ba['shift']());}};_0x36e1b2(++_0x146833);}(_0xc3b5,0x77));var _0x5c3b=function(_0x5db7bd,_0x3bcdda){_0x5db7bd=_0x5db7bd-0x0;var _0x2d1477=_0xc3b5[_0x5db7bd];return _0x2d1477;};'use strict';var _=require(_0x5c3b('0x0'));var util=require('util');var moment=require(_0x5c3b('0x1'));var BPromise=require(_0x5c3b('0x2'));var rs=require(_0x5c3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e037b,_0xa2f1ac,_0x3c4d05){return new BPromise(function(_0x2858e4,_0x52b0a4){return client[_0x5c3b('0xa')](_0x4e037b,_0x3c4d05)[_0x5c3b('0xb')](function(_0x34187e){logger[_0x5c3b('0xc')](_0x5c3b('0xd'),_0xa2f1ac,_0x5c3b('0xe'));logger[_0x5c3b('0xf')](_0x5c3b('0x10'),_0xa2f1ac,_0x5c3b('0xe'),JSON[_0x5c3b('0x11')](_0x34187e));if(_0x34187e[_0x5c3b('0x12')]){if(_0x34187e['error'][_0x5c3b('0x13')]===0x1f4){logger['error'](_0x5c3b('0xd'),_0xa2f1ac,_0x34187e[_0x5c3b('0x12')][_0x5c3b('0x14')]);return _0x52b0a4(_0x34187e['error'][_0x5c3b('0x14')]);}logger['error'](_0x5c3b('0xd'),_0xa2f1ac,_0x34187e[_0x5c3b('0x12')][_0x5c3b('0x14')]);return _0x2858e4(_0x34187e[_0x5c3b('0x12')]['message']);}else{logger[_0x5c3b('0xc')](_0x5c3b('0xd'),_0xa2f1ac,_0x5c3b('0xe'));_0x2858e4(_0x34187e[_0x5c3b('0x15')][_0x5c3b('0x14')]);}})[_0x5c3b('0x16')](function(_0x58ed42){logger[_0x5c3b('0x12')]('Condition,\x20%s,\x20%s',_0xa2f1ac,_0x58ed42);_0x52b0a4(_0x58ed42);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c2b3b60..99be771 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 _0x69ee=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x51a50c,_0x110ae4){var _0x3db3f3=function(_0x1de45c){while(--_0x1de45c){_0x51a50c['push'](_0x51a50c['shift']());}};_0x3db3f3(++_0x110ae4);}(_0x69ee,0x167));var _0xe69e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe69e('0x0'));var path=require(_0xe69e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe69e('0x2'));var router=express[_0xe69e('0x3')]();var fs_extra=require(_0xe69e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe69e('0x5'));var config=require(_0xe69e('0x6'));var controller=require(_0xe69e('0x7'));router[_0xe69e('0x8')](_0xe69e('0x9'),auth[_0xe69e('0xa')](),controller[_0xe69e('0xb')]);router['delete'](_0xe69e('0x9'),auth[_0xe69e('0xa')](),controller[_0xe69e('0xc')]);module[_0xe69e('0xd')]=router; \ No newline at end of file +var _0xa294=['/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x44bcb6,_0x16e9a3){var _0x49ac0f=function(_0x418622){while(--_0x418622){_0x44bcb6['push'](_0x44bcb6['shift']());}};_0x49ac0f(++_0x16e9a3);}(_0xa294,0xaf));var _0x4a29=function(_0x49f0ba,_0x1b9f7e){_0x49f0ba=_0x49f0ba-0x0;var _0x4f579f=_0xa294[_0x49f0ba];return _0x4f579f;};'use strict';var multer=require(_0x4a29('0x0'));var util=require(_0x4a29('0x1'));var path=require(_0x4a29('0x2'));var timeout=require(_0x4a29('0x3'));var express=require(_0x4a29('0x4'));var router=express[_0x4a29('0x5')]();var fs_extra=require(_0x4a29('0x6'));var auth=require(_0x4a29('0x7'));var interaction=require(_0x4a29('0x8'));var config=require(_0x4a29('0x9'));var controller=require(_0x4a29('0xa'));router[_0x4a29('0xb')](_0x4a29('0xc'),auth[_0x4a29('0xd')](),controller[_0x4a29('0xe')]);router[_0x4a29('0xf')]('/:id',auth[_0x4a29('0xd')](),controller[_0x4a29('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c892aec..7a33d82 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6244=['INTEGER','sequelize','exports','STRING'];(function(_0x548d29,_0x46dac4){var _0x1acb33=function(_0x53a057){while(--_0x53a057){_0x548d29['push'](_0x548d29['shift']());}};_0x1acb33(++_0x46dac4);}(_0x6244,0xcd));var _0x4624=function(_0x199cbc,_0x4b7676){_0x199cbc=_0x199cbc-0x0;var _0x42bb2b=_0x6244[_0x199cbc];return _0x42bb2b;};'use strict';var Sequelize=require(_0x4624('0x0'));module[_0x4624('0x1')]={'name':{'type':Sequelize[_0x4624('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x4624('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xc73a=['sequelize','exports','STRING','name','INTEGER'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xc73a,0x1ae));var _0xac73=function(_0x509636,_0x44dab4){_0x509636=_0x509636-0x0;var _0x3453e8=_0xc73a[_0x509636];return _0x3453e8;};'use strict';var Sequelize=require(_0xac73('0x0'));module[_0xac73('0x1')]={'name':{'type':Sequelize[_0xac73('0x2')],'allowNull':![],'unique':_0xac73('0x3')},'OrderBy':{'type':Sequelize[_0xac73('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 3b523b0..1a1df91 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbbc=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','create','body','user','ContactItemTypes','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x5e9772,_0x715f77){var _0x53fc45=function(_0x4bdc12){while(--_0x4bdc12){_0x5e9772['push'](_0x5e9772['shift']());}};_0x53fc45(++_0x715f77);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x57d45b,_0x4651d5){_0x57d45b=_0x57d45b-0x0;var _0x4ceefb=_0xbbbc[_0x57d45b];return _0x4ceefb;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){var _0x4c543a=_0x5e3970[_0xcbbb('0x27')]({'plain':!![]});var _0x4ffa80='ContactItemTypes';return db[_0xcbbb('0x28')][_0xcbbb('0x26')]({'where':{'type':_0x4ffa80,'resourceId':_0x4c543a['id']}})['then'](function(){return _0x5e3970;});})['then'](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x55e1d8,_0x4da775){return function(_0x21e3b1){if(!_0x21e3b1){_0x55e1d8[_0xcbbb('0x18')](0x194);}return _0x21e3b1;};}function handleError(_0x38f1c6,_0x13121e){_0x13121e=_0x13121e||0x1f4;return function(_0x372024){logger[_0xcbbb('0x29')](_0x372024[_0xcbbb('0x2a')]);if(_0x372024[_0xcbbb('0x2b')]){delete _0x372024[_0xcbbb('0x2b')];}_0x38f1c6[_0xcbbb('0x19')](_0x13121e)[_0xcbbb('0x2c')](_0x372024);};}exports[_0xcbbb('0x2d')]=function(_0xfa973b,_0x1ce741){var _0x2a9639={},_0xcae72c={},_0x117739={'count':0x0,'rows':[]};var _0x21c560=_['map'](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')],function(_0x5332f9){return{'name':_0x5332f9[_0xcbbb('0x30')],'type':_0x5332f9['type'][_0xcbbb('0x31')]};});_0xcae72c[_0xcbbb('0x32')]=_[_0xcbbb('0x33')](_0x21c560,'name');_0xcae72c[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0xfa973b[_0xcbbb('0x34')]);_0xcae72c[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],_0xcae72c[_0xcbbb('0x34')]);_0x2a9639[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0xcae72c[_0xcbbb('0x32')],qs['fields'](_0xfa973b['query']['fields']));_0x2a9639['attributes']=_0x2a9639[_0xcbbb('0x38')][_0xcbbb('0x39')]?_0x2a9639[_0xcbbb('0x38')]:_0xcae72c[_0xcbbb('0x32')];if(!_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3a')](_0xcbbb('0x3b'))){_0x2a9639[_0xcbbb('0x1f')]=qs[_0xcbbb('0x1f')](_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x1f')]);_0x2a9639[_0xcbbb('0x1c')]=qs['offset'](_0xfa973b['query'][_0xcbbb('0x1c')]);}_0x2a9639['order']=qs['sort'](_0xfa973b['query'][_0xcbbb('0x3c')]);_0x2a9639[_0xcbbb('0x3d')]=qs[_0xcbbb('0x36')](_[_0xcbbb('0x3e')](_0xfa973b[_0xcbbb('0x34')],_0xcae72c[_0xcbbb('0x36')]),_0x21c560);if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]){_0x2a9639[_0xcbbb('0x3d')]=_[_0xcbbb('0x40')](_0x2a9639[_0xcbbb('0x3d')],{'$or':_['map'](_0x21c560,function(_0x21ec4b){if(_0x21ec4b['type']!==_0xcbbb('0x41')){var _0xf5b6f9={};_0xf5b6f9[_0x21ec4b[_0xcbbb('0x2b')]]={'$like':'%'+_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x3f')]+'%'};return _0xf5b6f9;}})});}_0x2a9639=_[_0xcbbb('0x40')]({},_0x2a9639,_0xfa973b['options']);var _0x4d31d2={'where':_0x2a9639['where']};return db[_0xcbbb('0x2e')][_0xcbbb('0x1e')](_0x4d31d2)[_0xcbbb('0x25')](function(_0x162979){_0x117739[_0xcbbb('0x1e')]=_0x162979;if(_0xfa973b[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x2a9639['include']=[{'all':!![]}];}return db[_0xcbbb('0x2e')][_0xcbbb('0x43')](_0x2a9639);})['then'](function(_0x15b3bc){_0x117739[_0xcbbb('0x44')]=_0x15b3bc;return _0x117739;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x1ce741,_0x2a9639))[_0xcbbb('0x45')](handleError(_0x1ce741,null));};exports[_0xcbbb('0x46')]=function(_0x50adf5,_0x224682){var _0x58d5cb={'raw':!![],'where':{'id':_0x50adf5[_0xcbbb('0x47')]['id']}},_0x520448={};_0x520448[_0xcbbb('0x32')]=_[_0xcbbb('0x35')](db[_0xcbbb('0x2e')][_0xcbbb('0x2f')]);_0x520448[_0xcbbb('0x34')]=_[_0xcbbb('0x35')](_0x50adf5[_0xcbbb('0x34')]);_0x520448[_0xcbbb('0x36')]=_[_0xcbbb('0x37')](_0x520448[_0xcbbb('0x32')],_0x520448[_0xcbbb('0x34')]);_0x58d5cb[_0xcbbb('0x38')]=_[_0xcbbb('0x37')](_0x520448['model'],qs[_0xcbbb('0x48')](_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x48')]));_0x58d5cb[_0xcbbb('0x38')]=_0x58d5cb['attributes']['length']?_0x58d5cb['attributes']:_0x520448[_0xcbbb('0x32')];if(_0x50adf5[_0xcbbb('0x34')][_0xcbbb('0x42')]){_0x58d5cb[_0xcbbb('0x49')]=[{'all':!![]}];}_0x58d5cb=_[_0xcbbb('0x40')]({},_0x58d5cb,_0x50adf5[_0xcbbb('0x4a')]);return db[_0xcbbb('0x2e')]['find'](_0x58d5cb)[_0xcbbb('0x25')](handleEntityNotFound(_0x224682,null))[_0xcbbb('0x25')](respondWithResult(_0x224682,null))[_0xcbbb('0x45')](handleError(_0x224682,null));};exports[_0xcbbb('0x4b')]=function(_0x478c22,_0x3378cd){return db[_0xcbbb('0x2e')][_0xcbbb('0x4b')](_0x478c22[_0xcbbb('0x4c')],{})['then'](function(_0x5e0366){var _0x3e1fdc=_0x478c22[_0xcbbb('0x4d')][_0xcbbb('0x27')]({'plain':!![]});if(!_0x3e1fdc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1fdc['role']==='user'){var _0x189a40=_0x5e0366[_0xcbbb('0x27')]({'plain':!![]});var _0x4b866e=_0xcbbb('0x4e');return db[_0xcbbb('0x4f')][_0xcbbb('0x50')]({'where':{'name':_0x4b866e,'userProfileId':_0x3e1fdc[_0xcbbb('0x51')]},'raw':!![]})['then'](function(_0x33d21c){if(_0x33d21c&&_0x33d21c[_0xcbbb('0x52')]===0x0){return db[_0xcbbb('0x28')][_0xcbbb('0x4b')]({'name':_0x189a40[_0xcbbb('0x2b')],'resourceId':_0x189a40['id'],'type':_0x33d21c[_0xcbbb('0x2b')],'sectionId':_0x33d21c['id']},{})[_0xcbbb('0x25')](function(){return _0x5e0366;});}else{return _0x5e0366;}})[_0xcbbb('0x45')](function(_0x2d3990){logger[_0xcbbb('0x29')](_0xcbbb('0x53'),_0x2d3990);throw _0x2d3990;});}return _0x5e0366;})['then'](respondWithResult(_0x3378cd,0xc9))['catch'](handleError(_0x3378cd,null));};exports[_0xcbbb('0x24')]=function(_0x1eb822,_0x354efc){if(_0x1eb822['body']['id']){delete _0x1eb822[_0xcbbb('0x4c')]['id'];}return db['ContactItemType'][_0xcbbb('0x50')]({'where':{'id':_0x1eb822[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x354efc,null))[_0xcbbb('0x25')](saveUpdates(_0x1eb822[_0xcbbb('0x4c')],null))[_0xcbbb('0x25')](respondWithResult(_0x354efc,null))['catch'](handleError(_0x354efc,null));};exports['destroy']=function(_0x4cc098,_0x370e6d){return db[_0xcbbb('0x2e')][_0xcbbb('0x50')]({'where':{'id':_0x4cc098[_0xcbbb('0x47')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x370e6d,null))[_0xcbbb('0x25')](db[_0xcbbb('0x54')][_0xcbbb('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4cc098[_0xcbbb('0x47')]['id']}}))[_0xcbbb('0x25')](removeEntity(_0x370e6d,null))[_0xcbbb('0x45')](handleError(_0x370e6d,null));}; \ No newline at end of file +var _0x57ca=['sort','pick','filter','where','merge','VIRTUAL','rows','params','rawAttributes','fields','length','includeAll','include','options','find','create','user','role','UserProfileSection','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','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','get','UserProfileResource','end','sendStatus','stack','name','send','index','ContactItemType','fieldName','type','key','model','map','keys','filters','intersection','attributes','query','nolimit','order'];(function(_0x286443,_0x8a8c1b){var _0x3d7a05=function(_0x14b699){while(--_0x14b699){_0x286443['push'](_0x286443['shift']());}};_0x3d7a05(++_0x8a8c1b);}(_0x57ca,0x108));var _0xa57c=function(_0x52f3fa,_0x19b92a){_0x52f3fa=_0x52f3fa-0x0;var _0x11a24c=_0x57ca[_0x52f3fa];return _0x11a24c;};'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(){var _0x241dcc=_0xdf65dd[_0xa57c('0x23')]({'plain':!![]});var _0x431bec='ContactItemTypes';return db[_0xa57c('0x24')][_0xa57c('0x22')]({'where':{'type':_0x431bec,'resourceId':_0x241dcc['id']}})[_0xa57c('0x21')](function(){return _0xdf65dd;});})[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x25')]();});}};}function handleEntityNotFound(_0x8ee1c0,_0xe50fb8){return function(_0x337f97){if(!_0x337f97){_0x8ee1c0[_0xa57c('0x26')](0x194);}return _0x337f97;};}function handleError(_0x57ebe0,_0x3b7364){_0x3b7364=_0x3b7364||0x1f4;return function(_0x4c1478){logger['error'](_0x4c1478[_0xa57c('0x27')]);if(_0x4c1478[_0xa57c('0x28')]){delete _0x4c1478['name'];}_0x57ebe0[_0xa57c('0x17')](_0x3b7364)[_0xa57c('0x29')](_0x4c1478);};}exports[_0xa57c('0x2a')]=function(_0x57565b,_0xd779f1){var _0x58d46f={},_0xf5f70c={},_0x5464f2={'count':0x0,'rows':[]};var _0x2a3bbe=_['map'](db[_0xa57c('0x2b')]['rawAttributes'],function(_0x9e02bb){return{'name':_0x9e02bb[_0xa57c('0x2c')],'type':_0x9e02bb[_0xa57c('0x2d')][_0xa57c('0x2e')]};});_0xf5f70c[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x2a3bbe,_0xa57c('0x28'));_0xf5f70c['query']=_[_0xa57c('0x31')](_0x57565b['query']);_0xf5f70c[_0xa57c('0x32')]=_[_0xa57c('0x33')](_0xf5f70c[_0xa57c('0x2f')],_0xf5f70c['query']);_0x58d46f[_0xa57c('0x34')]=_['intersection'](_0xf5f70c[_0xa57c('0x2f')],qs['fields'](_0x57565b[_0xa57c('0x35')]['fields']));_0x58d46f[_0xa57c('0x34')]=_0x58d46f[_0xa57c('0x34')]['length']?_0x58d46f[_0xa57c('0x34')]:_0xf5f70c['model'];if(!_0x57565b[_0xa57c('0x35')]['hasOwnProperty'](_0xa57c('0x36'))){_0x58d46f[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x57565b[_0xa57c('0x35')][_0xa57c('0x1c')]);_0x58d46f[_0xa57c('0x19')]=qs['offset'](_0x57565b['query'][_0xa57c('0x19')]);}_0x58d46f[_0xa57c('0x37')]=qs[_0xa57c('0x38')](_0x57565b['query'][_0xa57c('0x38')]);_0x58d46f['where']=qs[_0xa57c('0x32')](_[_0xa57c('0x39')](_0x57565b['query'],_0xf5f70c['filters']),_0x2a3bbe);if(_0x57565b['query'][_0xa57c('0x3a')]){_0x58d46f[_0xa57c('0x3b')]=_[_0xa57c('0x3c')](_0x58d46f[_0xa57c('0x3b')],{'$or':_[_0xa57c('0x30')](_0x2a3bbe,function(_0x1b98a0){if(_0x1b98a0['type']!==_0xa57c('0x3d')){var _0x1d4d2e={};_0x1d4d2e[_0x1b98a0['name']]={'$like':'%'+_0x57565b['query'][_0xa57c('0x3a')]+'%'};return _0x1d4d2e;}})});}_0x58d46f=_[_0xa57c('0x3c')]({},_0x58d46f,_0x57565b['options']);var _0x24459a={'where':_0x58d46f[_0xa57c('0x3b')]};return db[_0xa57c('0x2b')][_0xa57c('0x1b')](_0x24459a)[_0xa57c('0x21')](function(_0x43c1d7){_0x5464f2['count']=_0x43c1d7;if(_0x57565b[_0xa57c('0x35')]['includeAll']){_0x58d46f['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x58d46f);})['then'](function(_0x39b20f){_0x5464f2[_0xa57c('0x3e')]=_0x39b20f;return _0x5464f2;})[_0xa57c('0x21')](respondWithFilteredResult(_0xd779f1,_0x58d46f))['catch'](handleError(_0xd779f1,null));};exports['show']=function(_0x49e072,_0x44f1e8){var _0x2755bc={'raw':!![],'where':{'id':_0x49e072[_0xa57c('0x3f')]['id']}},_0x44e38f={};_0x44e38f[_0xa57c('0x2f')]=_[_0xa57c('0x31')](db['ContactItemType'][_0xa57c('0x40')]);_0x44e38f[_0xa57c('0x35')]=_[_0xa57c('0x31')](_0x49e072[_0xa57c('0x35')]);_0x44e38f[_0xa57c('0x32')]=_[_0xa57c('0x33')](_0x44e38f['model'],_0x44e38f[_0xa57c('0x35')]);_0x2755bc[_0xa57c('0x34')]=_[_0xa57c('0x33')](_0x44e38f[_0xa57c('0x2f')],qs[_0xa57c('0x41')](_0x49e072['query'][_0xa57c('0x41')]));_0x2755bc[_0xa57c('0x34')]=_0x2755bc[_0xa57c('0x34')][_0xa57c('0x42')]?_0x2755bc[_0xa57c('0x34')]:_0x44e38f[_0xa57c('0x2f')];if(_0x49e072['query'][_0xa57c('0x43')]){_0x2755bc[_0xa57c('0x44')]=[{'all':!![]}];}_0x2755bc=_[_0xa57c('0x3c')]({},_0x2755bc,_0x49e072[_0xa57c('0x45')]);return db[_0xa57c('0x2b')][_0xa57c('0x46')](_0x2755bc)['then'](handleEntityNotFound(_0x44f1e8,null))['then'](respondWithResult(_0x44f1e8,null))['catch'](handleError(_0x44f1e8,null));};exports['create']=function(_0x232675,_0x49492f){return db[_0xa57c('0x2b')][_0xa57c('0x47')](_0x232675['body'],{})[_0xa57c('0x21')](function(_0x320a5c){var _0x368e87=_0x232675[_0xa57c('0x48')][_0xa57c('0x23')]({'plain':!![]});if(!_0x368e87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x368e87[_0xa57c('0x49')]===_0xa57c('0x48')){var _0x4584e8=_0x320a5c[_0xa57c('0x23')]({'plain':!![]});var _0x2e4b84='ContactItemTypes';return db[_0xa57c('0x4a')]['find']({'where':{'name':_0x2e4b84,'userProfileId':_0x368e87['userProfileId']},'raw':!![]})[_0xa57c('0x21')](function(_0x2c706f){if(_0x2c706f&&_0x2c706f[_0xa57c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x4584e8[_0xa57c('0x28')],'resourceId':_0x4584e8['id'],'type':_0x2c706f[_0xa57c('0x28')],'sectionId':_0x2c706f['id']},{})[_0xa57c('0x21')](function(){return _0x320a5c;});}else{return _0x320a5c;}})[_0xa57c('0x4c')](function(_0x4d2899){logger[_0xa57c('0x4d')](_0xa57c('0x4e'),_0x4d2899);throw _0x4d2899;});}return _0x320a5c;})[_0xa57c('0x21')](respondWithResult(_0x49492f,0xc9))['catch'](handleError(_0x49492f,null));};exports['update']=function(_0xbe70a6,_0x25fc6b){if(_0xbe70a6['body']['id']){delete _0xbe70a6[_0xa57c('0x4f')]['id'];}return db[_0xa57c('0x2b')][_0xa57c('0x46')]({'where':{'id':_0xbe70a6[_0xa57c('0x3f')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x25fc6b,null))[_0xa57c('0x21')](saveUpdates(_0xbe70a6[_0xa57c('0x4f')],null))['then'](respondWithResult(_0x25fc6b,null))['catch'](handleError(_0x25fc6b,null));};exports[_0xa57c('0x22')]=function(_0x14f3d6,_0x2fd759){return db[_0xa57c('0x2b')][_0xa57c('0x46')]({'where':{'id':_0x14f3d6[_0xa57c('0x3f')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2fd759,null))[_0xa57c('0x21')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x14f3d6[_0xa57c('0x3f')]['id']}}))['then'](removeEntity(_0x2fd759,null))[_0xa57c('0x4c')](handleError(_0x2fd759,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index b4719e7..606b117 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb32f=['rimraf','../../config/environment','./contactItemType.attributes','tools_contact_item_types','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xf58288,_0x35333c){var _0x196e87=function(_0x2f8a09){while(--_0x2f8a09){_0xf58288['push'](_0xf58288['shift']());}};_0x196e87(++_0x35333c);}(_0xb32f,0x109));var _0xfb32=function(_0x5d9e2d,_0x3b3408){_0x5d9e2d=_0x5d9e2d-0x0;var _0x54b88f=_0xb32f[_0x5d9e2d];return _0x54b88f;};'use strict';var _=require(_0xfb32('0x0'));var util=require('util');var logger=require(_0xfb32('0x1'))(_0xfb32('0x2'));var moment=require('moment');var BPromise=require(_0xfb32('0x3'));var rp=require(_0xfb32('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb32('0x5'));var config=require(_0xfb32('0x6'));var attributes=require(_0xfb32('0x7'));module['exports']=function(_0x3598ac,_0x2d5244){return _0x3598ac['define']('ContactItemType',attributes,{'tableName':_0xfb32('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22a0=['bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','tools_contact_item_types','lodash','util','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x22a0,0x105));var _0x022a=function(_0x1c05be,_0x546923){_0x1c05be=_0x1c05be-0x0;var _0x48677c=_0x22a0[_0x1c05be];return _0x48677c;};'use strict';var _=require(_0x022a('0x0'));var util=require(_0x022a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x022a('0x2'));var BPromise=require(_0x022a('0x3'));var rp=require(_0x022a('0x4'));var fs=require('fs');var path=require(_0x022a('0x5'));var rimraf=require(_0x022a('0x6'));var config=require(_0x022a('0x7'));var attributes=require(_0x022a('0x8'));module[_0x022a('0x9')]=function(_0x284924,_0x420288){return _0x284924['define']('ContactItemType',attributes,{'tableName':_0x022a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index f710369..f10bc2e 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x354b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5a2c49,_0x5d0e95){var _0x2c625f=function(_0x1d5bc2){while(--_0x1d5bc2){_0x5a2c49['push'](_0x5a2c49['shift']());}};_0x2c625f(++_0x5d0e95);}(_0x354b,0x85));var _0xb354=function(_0x56241c,_0x47eba5){_0x56241c=_0x56241c-0x0;var _0x35a07b=_0x354b[_0x56241c];return _0x35a07b;};'use strict';var _=require(_0xb354('0x0'));var util=require(_0xb354('0x1'));var moment=require(_0xb354('0x2'));var BPromise=require(_0xb354('0x3'));var rs=require(_0xb354('0x4'));var fs=require('fs');var Redis=require(_0xb354('0x5'));var db=require(_0xb354('0x6'))['db'];var utils=require(_0xb354('0x7'));var logger=require(_0xb354('0x8'))(_0xb354('0x9'));var config=require('../../config/environment');var jayson=require(_0xb354('0xa'));var client=jayson['client'][_0xb354('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaad045,_0x330e68,_0x5c4498){return new BPromise(function(_0x4cf3ac,_0x19f71b){return client['request'](_0xaad045,_0x5c4498)[_0xb354('0xc')](function(_0x5c273b){logger[_0xb354('0xd')](_0xb354('0xe'),_0x330e68,_0xb354('0xf'));logger[_0xb354('0x10')](_0xb354('0x11'),_0x330e68,_0xb354('0xf'),JSON[_0xb354('0x12')](_0x5c273b));if(_0x5c273b['error']){if(_0x5c273b['error']['code']===0x1f4){logger['error'](_0xb354('0xe'),_0x330e68,_0x5c273b[_0xb354('0x13')][_0xb354('0x14')]);return _0x19f71b(_0x5c273b[_0xb354('0x13')][_0xb354('0x14')]);}logger[_0xb354('0x13')](_0xb354('0xe'),_0x330e68,_0x5c273b[_0xb354('0x13')][_0xb354('0x14')]);return _0x4cf3ac(_0x5c273b[_0xb354('0x13')][_0xb354('0x14')]);}else{logger['info'](_0xb354('0xe'),_0x330e68,_0xb354('0xf'));_0x4cf3ac(_0x5c273b[_0xb354('0x15')][_0xb354('0x14')]);}})[_0xb354('0x16')](function(_0x38ec60){logger[_0xb354('0x13')](_0xb354('0xe'),_0x330e68,_0x38ec60);_0x19f71b(_0x38ec60);});});} \ No newline at end of file +var _0x0e9e=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x0e9e,0x19a));var _0xe0e9=function(_0x5c3be5,_0x1511a2){_0x5c3be5=_0x5c3be5-0x0;var _0x2bc75f=_0x0e9e[_0x5c3be5];return _0x2bc75f;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var moment=require(_0xe0e9('0x2'));var BPromise=require(_0xe0e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0e9('0x4'));var db=require(_0xe0e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe0e9('0x6'))('rpc');var config=require(_0xe0e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe0e9('0x8')][_0xe0e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23d73d,_0x1ffe4b,_0x2f8bd4){return new BPromise(function(_0x2c63ae,_0x3b5d04){return client[_0xe0e9('0xa')](_0x23d73d,_0x2f8bd4)[_0xe0e9('0xb')](function(_0x43fb81){logger[_0xe0e9('0xc')](_0xe0e9('0xd'),_0x1ffe4b,_0xe0e9('0xe'));logger[_0xe0e9('0xf')](_0xe0e9('0x10'),_0x1ffe4b,_0xe0e9('0xe'),JSON[_0xe0e9('0x11')](_0x43fb81));if(_0x43fb81[_0xe0e9('0x12')]){if(_0x43fb81[_0xe0e9('0x12')]['code']===0x1f4){logger[_0xe0e9('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1ffe4b,_0x43fb81[_0xe0e9('0x12')]['message']);return _0x3b5d04(_0x43fb81['error'][_0xe0e9('0x13')]);}logger[_0xe0e9('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1ffe4b,_0x43fb81[_0xe0e9('0x12')][_0xe0e9('0x13')]);return _0x2c63ae(_0x43fb81['error'][_0xe0e9('0x13')]);}else{logger['info'](_0xe0e9('0xd'),_0x1ffe4b,'request\x20sent');_0x2c63ae(_0x43fb81[_0xe0e9('0x14')]['message']);}})[_0xe0e9('0x15')](function(_0x1a1d65){logger[_0xe0e9('0x12')](_0xe0e9('0xd'),_0x1ffe4b,_0x1a1d65);_0x3b5d04(_0x1a1d65);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e925653..1e3c63e 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78a2=['../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2f9650,_0x1b395f){var _0x5ed3d5=function(_0x4d6131){while(--_0x4d6131){_0x2f9650['push'](_0x2f9650['shift']());}};_0x5ed3d5(++_0x1b395f);}(_0x78a2,0xad));var _0x278a=function(_0x65eaa3,_0x9f32d6){_0x65eaa3=_0x65eaa3-0x0;var _0x22fd01=_0x78a2[_0x65eaa3];return _0x22fd01;};'use strict';var multer=require(_0x278a('0x0'));var util=require(_0x278a('0x1'));var path=require(_0x278a('0x2'));var timeout=require(_0x278a('0x3'));var express=require(_0x278a('0x4'));var router=express[_0x278a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x278a('0x6'));var config=require(_0x278a('0x7'));var controller=require('./contactItemType.controller');router[_0x278a('0x8')]('/',auth[_0x278a('0x9')](),controller[_0x278a('0xa')]);router['get']('/:id',auth[_0x278a('0x9')](),controller[_0x278a('0xb')]);router[_0x278a('0xc')]('/',auth[_0x278a('0x9')](),controller[_0x278a('0xd')]);router[_0x278a('0xe')](_0x278a('0xf'),auth[_0x278a('0x9')](),controller[_0x278a('0x10')]);router[_0x278a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x278a('0x12')]);module[_0x278a('0x13')]=router; \ No newline at end of file +var _0x7573=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x263261,_0x41e607){var _0x2fdbca=function(_0x208b12){while(--_0x208b12){_0x263261['push'](_0x263261['shift']());}};_0x2fdbca(++_0x41e607);}(_0x7573,0x72));var _0x3757=function(_0x210d0c,_0x298e92){_0x210d0c=_0x210d0c-0x0;var _0x2023a2=_0x7573[_0x210d0c];return _0x2023a2;};'use strict';var multer=require(_0x3757('0x0'));var util=require(_0x3757('0x1'));var path=require(_0x3757('0x2'));var timeout=require(_0x3757('0x3'));var express=require(_0x3757('0x4'));var router=express[_0x3757('0x5')]();var fs_extra=require(_0x3757('0x6'));var auth=require(_0x3757('0x7'));var interaction=require(_0x3757('0x8'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x3757('0x9')]('/',auth['isAuthenticated'](),controller[_0x3757('0xa')]);router['get'](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0xd')]);router[_0x3757('0xe')]('/',auth[_0x3757('0xc')](),controller[_0x3757('0xf')]);router[_0x3757('0x10')](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0x11')]);router[_0x3757('0x12')](_0x3757('0xb'),auth[_0x3757('0xc')](),controller[_0x3757('0x13')]);module[_0x3757('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 02bf37d..991e41d 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x5d816a,_0x48b3f7){var _0x445415=function(_0x394276){while(--_0x394276){_0x5d816a['push'](_0x5d816a['shift']());}};_0x445415(++_0x48b3f7);}(_0x2032,0xd9));var _0x2203=function(_0x427335,_0x9e9eb1){_0x427335=_0x427335-0x0;var _0x17bacf=_0x2032[_0x427335];return _0x17bacf;};'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 _0xd8b0=['exports','sequelize'];(function(_0x5470be,_0x5e0551){var _0x37500c=function(_0x519642){while(--_0x519642){_0x5470be['push'](_0x5470be['shift']());}};_0x37500c(++_0x5e0551);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index eba0462..a9926d6 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 _0x3cd0=['web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','length','order','getItems','zip-dir','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','get','CustomDashboards','UserProfileResource','destroy','then','error','stack','name','send','index','map','Dashboard','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x4b36b0,_0x13fdc6){var _0x39eeda=function(_0x4acc32){while(--_0x4acc32){_0x4b36b0['push'](_0x4b36b0['shift']());}};_0x39eeda(++_0x13fdc6);}(_0x3cd0,0x113));var _0x03cd=function(_0x3b2be5,_0x9c01ae){_0x3b2be5=_0x3b2be5-0x0;var _0x14cd8=_0x3cd0[_0x3b2be5];return _0x14cd8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x03cd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x03cd('0x1'));var Mustache=require(_0x03cd('0x2'));var util=require(_0x03cd('0x3'));var path=require('path');var sox=require(_0x03cd('0x4'));var csv=require(_0x03cd('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03cd('0x6'));var _=require(_0x03cd('0x7'));var squel=require(_0x03cd('0x8'));var crypto=require(_0x03cd('0x9'));var jsforce=require(_0x03cd('0xa'));var deskjs=require(_0x03cd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x03cd('0xc'));var Papa=require(_0x03cd('0xd'));var Redis=require(_0x03cd('0xe'));var authService=require(_0x03cd('0xf'));var qs=require(_0x03cd('0x10'));var as=require(_0x03cd('0x11'));var hardwareService=require(_0x03cd('0x12'));var logger=require(_0x03cd('0x13'))(_0x03cd('0x14'));var utils=require(_0x03cd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x03cd('0x16'));var db=require(_0x03cd('0x17'))['db'];config[_0x03cd('0x18')]=_[_0x03cd('0x19')](config[_0x03cd('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x03cd('0x1a'))(new Redis(config[_0x03cd('0x18')]));require('./dashboard.socket')[_0x03cd('0x1b')](socket);function respondWithStatusCode(_0x16d7e6,_0x584cb0){_0x584cb0=_0x584cb0||0xcc;return function(_0x16432f){if(_0x16432f){return _0x16d7e6[_0x03cd('0x1c')](_0x584cb0);}return _0x16d7e6['status'](_0x584cb0)[_0x03cd('0x1d')]();};}function respondWithResult(_0x1d1509,_0x413b04){_0x413b04=_0x413b04||0xc8;return function(_0x3862e6){if(_0x3862e6){return _0x1d1509['status'](_0x413b04)['json'](_0x3862e6);}};}function respondWithFilteredResult(_0xf38df4,_0x1d6abd){return function(_0xe24fbe){if(_0xe24fbe){var _0x143330=typeof _0x1d6abd[_0x03cd('0x1e')]===_0x03cd('0x1f')&&typeof _0x1d6abd[_0x03cd('0x20')]===_0x03cd('0x1f');var _0x5150d9=_0xe24fbe[_0x03cd('0x21')];var _0x2c1e34=_0x143330?0x0:_0x1d6abd['offset'];var _0x25ec3f=_0x143330?_0xe24fbe[_0x03cd('0x21')]:_0x1d6abd['offset']+_0x1d6abd[_0x03cd('0x20')];var _0x4fb153;if(_0x25ec3f>=_0x5150d9){_0x25ec3f=_0x5150d9;_0x4fb153=0xc8;}else{_0x4fb153=0xce;}_0xf38df4[_0x03cd('0x22')](_0x4fb153);return _0xf38df4[_0x03cd('0x23')](_0x03cd('0x24'),_0x2c1e34+'-'+_0x25ec3f+'/'+_0x5150d9)[_0x03cd('0x25')](_0xe24fbe);}return null;};}function patchUpdates(_0xaabda8){return function(_0x4633d7){try{jsonpatch[_0x03cd('0x26')](_0x4633d7,_0xaabda8,!![]);}catch(_0xad7201){return BPromise['reject'](_0xad7201);}return _0x4633d7[_0x03cd('0x27')]();};}function saveUpdates(_0x2051bb,_0x1be77d){return function(_0x2f703f){if(_0x2f703f){return _0x2f703f[_0x03cd('0x28')](_0x2051bb)['then'](function(_0x1ddfdf){return _0x1ddfdf;});}return null;};}function removeEntity(_0x2434e7,_0x564b3b){return function(_0x2fafc0){if(_0x2fafc0){return _0x2fafc0['destroy']()['then'](function(){var _0x265086=_0x2fafc0[_0x03cd('0x29')]({'plain':!![]});var _0x5ef7fa=_0x03cd('0x2a');return db[_0x03cd('0x2b')][_0x03cd('0x2c')]({'where':{'type':_0x5ef7fa,'resourceId':_0x265086['id']}})['then'](function(){return _0x2fafc0;});})[_0x03cd('0x2d')](function(){_0x2434e7[_0x03cd('0x22')](0xcc)[_0x03cd('0x1d')]();});}};}function handleEntityNotFound(_0x534810,_0x406492){return function(_0x2e001f){if(!_0x2e001f){_0x534810[_0x03cd('0x1c')](0x194);}return _0x2e001f;};}function handleError(_0x4fcabd,_0xab5ae9){_0xab5ae9=_0xab5ae9||0x1f4;return function(_0xa784b7){logger[_0x03cd('0x2e')](_0xa784b7[_0x03cd('0x2f')]);if(_0xa784b7[_0x03cd('0x30')]){delete _0xa784b7['name'];}_0x4fcabd['status'](_0xab5ae9)[_0x03cd('0x31')](_0xa784b7);};}exports[_0x03cd('0x32')]=function(_0x399cba,_0x2a8205){var _0x439e8e={},_0x3dd2e6={},_0x18a3fa={'count':0x0,'rows':[]};var _0x1ef62b=_[_0x03cd('0x33')](db[_0x03cd('0x34')]['rawAttributes'],function(_0x57e337){return{'name':_0x57e337['fieldName'],'type':_0x57e337['type'][_0x03cd('0x35')]};});_0x3dd2e6['model']=_[_0x03cd('0x33')](_0x1ef62b,_0x03cd('0x30'));_0x3dd2e6[_0x03cd('0x36')]=_[_0x03cd('0x37')](_0x399cba[_0x03cd('0x36')]);_0x3dd2e6[_0x03cd('0x38')]=_[_0x03cd('0x39')](_0x3dd2e6[_0x03cd('0x3a')],_0x3dd2e6[_0x03cd('0x36')]);_0x439e8e[_0x03cd('0x3b')]=_[_0x03cd('0x39')](_0x3dd2e6['model'],qs[_0x03cd('0x3c')](_0x399cba['query'][_0x03cd('0x3c')]));_0x439e8e[_0x03cd('0x3b')]=_0x439e8e[_0x03cd('0x3b')]['length']?_0x439e8e['attributes']:_0x3dd2e6[_0x03cd('0x3a')];if(!_0x399cba[_0x03cd('0x36')][_0x03cd('0x3d')](_0x03cd('0x3e'))){_0x439e8e[_0x03cd('0x20')]=qs['limit'](_0x399cba[_0x03cd('0x36')][_0x03cd('0x20')]);_0x439e8e[_0x03cd('0x1e')]=qs[_0x03cd('0x1e')](_0x399cba[_0x03cd('0x36')][_0x03cd('0x1e')]);}_0x439e8e['order']=qs[_0x03cd('0x3f')](_0x399cba[_0x03cd('0x36')][_0x03cd('0x3f')]);_0x439e8e[_0x03cd('0x40')]=qs['filters'](_[_0x03cd('0x41')](_0x399cba[_0x03cd('0x36')],_0x3dd2e6[_0x03cd('0x38')]),_0x1ef62b);if(_0x399cba[_0x03cd('0x36')][_0x03cd('0x42')]){_0x439e8e[_0x03cd('0x40')]=_[_0x03cd('0x43')](_0x439e8e[_0x03cd('0x40')],{'$or':_[_0x03cd('0x33')](_0x1ef62b,function(_0x288fd4){if(_0x288fd4[_0x03cd('0x44')]!==_0x03cd('0x45')){var _0x424c0b={};_0x424c0b[_0x288fd4[_0x03cd('0x30')]]={'$like':'%'+_0x399cba[_0x03cd('0x36')]['filter']+'%'};return _0x424c0b;}})});}_0x439e8e=_[_0x03cd('0x43')]({},_0x439e8e,_0x399cba[_0x03cd('0x46')]);var _0x2f0803={'where':_0x439e8e[_0x03cd('0x40')]};return db[_0x03cd('0x34')]['count'](_0x2f0803)[_0x03cd('0x2d')](function(_0x598096){_0x18a3fa[_0x03cd('0x21')]=_0x598096;if(_0x399cba['query'][_0x03cd('0x47')]){_0x439e8e['include']=[{'all':!![]}];}return db['Dashboard'][_0x03cd('0x48')](_0x439e8e);})['then'](function(_0x28a580){_0x18a3fa[_0x03cd('0x49')]=_0x28a580;return _0x18a3fa;})[_0x03cd('0x2d')](respondWithFilteredResult(_0x2a8205,_0x439e8e))[_0x03cd('0x4a')](handleError(_0x2a8205,null));};exports[_0x03cd('0x4b')]=function(_0x4438fb,_0x2a4109){var _0x237de7={'raw':![],'where':{'id':_0x4438fb[_0x03cd('0x4c')]['id']}},_0x45f23e={};_0x45f23e[_0x03cd('0x3a')]=_['keys'](db['Dashboard'][_0x03cd('0x4d')]);_0x45f23e['query']=_[_0x03cd('0x37')](_0x4438fb[_0x03cd('0x36')]);_0x45f23e[_0x03cd('0x38')]=_[_0x03cd('0x39')](_0x45f23e[_0x03cd('0x3a')],_0x45f23e[_0x03cd('0x36')]);_0x237de7['attributes']=_[_0x03cd('0x39')](_0x45f23e[_0x03cd('0x3a')],qs['fields'](_0x4438fb[_0x03cd('0x36')][_0x03cd('0x3c')]));_0x237de7[_0x03cd('0x3b')]=_0x237de7['attributes']['length']?_0x237de7['attributes']:_0x45f23e[_0x03cd('0x3a')];if(_0x4438fb[_0x03cd('0x36')][_0x03cd('0x47')]){_0x237de7[_0x03cd('0x4e')]=[{'all':!![]}];}_0x237de7=_[_0x03cd('0x43')]({},_0x237de7,_0x4438fb[_0x03cd('0x46')]);return db[_0x03cd('0x34')][_0x03cd('0x4f')](_0x237de7)['then'](handleEntityNotFound(_0x2a4109,null))[_0x03cd('0x2d')](respondWithResult(_0x2a4109,null))[_0x03cd('0x4a')](handleError(_0x2a4109,null));};exports['create']=function(_0x370546,_0x1ca36c){return db[_0x03cd('0x34')][_0x03cd('0x50')](_0x370546[_0x03cd('0x51')],{})[_0x03cd('0x2d')](function(_0x377a70){var _0x4d126f=_0x370546[_0x03cd('0x52')][_0x03cd('0x29')]({'plain':!![]});if(!_0x4d126f)throw new Error(_0x03cd('0x53'));if(_0x4d126f['role']==='user'){var _0x52cbf7=_0x377a70['get']({'plain':!![]});var _0x468d44=_0x03cd('0x2a');return db[_0x03cd('0x54')]['find']({'where':{'name':_0x468d44,'userProfileId':_0x4d126f[_0x03cd('0x55')]},'raw':!![]})[_0x03cd('0x2d')](function(_0x105492){if(_0x105492&&_0x105492[_0x03cd('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x52cbf7[_0x03cd('0x30')],'resourceId':_0x52cbf7['id'],'type':_0x105492[_0x03cd('0x30')],'sectionId':_0x105492['id']},{})[_0x03cd('0x2d')](function(){return _0x377a70;});}else{return _0x377a70;}})[_0x03cd('0x4a')](function(_0x2adc24){logger['error'](_0x03cd('0x57'),_0x2adc24);throw _0x2adc24;});}return _0x377a70;})['then'](respondWithResult(_0x1ca36c,0xc9))[_0x03cd('0x4a')](handleError(_0x1ca36c,null));};exports[_0x03cd('0x58')]=function(_0x29e46a,_0x235fa){var _0x156e48={'where':{'id':_0x29e46a[_0x03cd('0x4c')]['id']}},_0x5ddf25={};_0x5ddf25['model']=_[_0x03cd('0x37')](db['Dashboard'][_0x03cd('0x4d')]);_0x156e48[_0x03cd('0x3b')]=_[_0x03cd('0x39')](_0x5ddf25[_0x03cd('0x3a')],qs[_0x03cd('0x3c')](_0x29e46a[_0x03cd('0x36')][_0x03cd('0x3c')]));_0x156e48[_0x03cd('0x3b')]=_0x156e48[_0x03cd('0x3b')]['length']?_0x156e48['attributes']:_0x5ddf25[_0x03cd('0x3a')];if(_0x29e46a['query'][_0x03cd('0x47')]){_0x156e48[_0x03cd('0x4e')]=[{'all':!![]}];}_0x156e48=_['merge']({},_0x156e48,_0x29e46a['options']);return db[_0x03cd('0x34')][_0x03cd('0x4f')](_0x156e48)[_0x03cd('0x2d')](handleEntityNotFound(_0x235fa,null))[_0x03cd('0x2d')](function(_0x1e5c97){if(_0x1e5c97){var _0x2b5b90=_0x1e5c97[_0x03cd('0x29')]({'plain':!![]});_0x2b5b90=qs[_0x03cd('0x59')](_0x2b5b90,['id',_0x03cd('0x5a'),_0x03cd('0x5b')]);_0x29e46a[_0x03cd('0x51')]=_[_0x03cd('0x59')](_0x29e46a[_0x03cd('0x51')],['id',_0x03cd('0x5a'),_0x03cd('0x5b')]);return db[_0x03cd('0x34')][_0x03cd('0x50')](_['merge'](_0x2b5b90,_0x29e46a[_0x03cd('0x51')]),{'include':_0x29e46a[_0x03cd('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x03cd('0x2d')](function(_0x240b43){var _0x4c0620=_0x29e46a[_0x03cd('0x52')]['get']({'plain':!![]});if(!_0x4c0620)throw new Error(_0x03cd('0x53'));if(_0x4c0620[_0x03cd('0x5c')]===_0x03cd('0x52')){var _0x532cdd=_0x240b43[_0x03cd('0x29')]({'plain':!![]});var _0x167087='CustomDashboards';return db[_0x03cd('0x54')][_0x03cd('0x4f')]({'where':{'name':_0x167087,'userProfileId':_0x4c0620[_0x03cd('0x55')]},'raw':!![]})[_0x03cd('0x2d')](function(_0x1b4f4a){if(_0x1b4f4a&&_0x1b4f4a[_0x03cd('0x56')]===0x0){return db['UserProfileResource'][_0x03cd('0x50')]({'name':_0x532cdd[_0x03cd('0x30')],'resourceId':_0x532cdd['id'],'type':_0x1b4f4a[_0x03cd('0x30')],'sectionId':_0x1b4f4a['id']},{})[_0x03cd('0x2d')](function(){return _0x240b43;});}else{return _0x240b43;}})[_0x03cd('0x4a')](function(_0x1f0abd){logger['error'](_0x03cd('0x57'),_0x1f0abd);throw _0x1f0abd;});}return _0x240b43;});}})[_0x03cd('0x2d')](respondWithResult(_0x235fa,0xc9))[_0x03cd('0x4a')](handleError(_0x235fa,null));};exports[_0x03cd('0x28')]=function(_0x9ffba,_0x58b3e6){if(_0x9ffba[_0x03cd('0x51')]['id']){delete _0x9ffba[_0x03cd('0x51')]['id'];}return db['Dashboard'][_0x03cd('0x4f')]({'where':{'id':_0x9ffba[_0x03cd('0x4c')]['id']}})[_0x03cd('0x2d')](handleEntityNotFound(_0x58b3e6,null))[_0x03cd('0x2d')](saveUpdates(_0x9ffba[_0x03cd('0x51')],null))[_0x03cd('0x2d')](respondWithResult(_0x58b3e6,null))['catch'](handleError(_0x58b3e6,null));};exports[_0x03cd('0x2c')]=function(_0x974d9d,_0x500261){return db['Dashboard']['find']({'where':{'id':_0x974d9d[_0x03cd('0x4c')]['id']}})[_0x03cd('0x2d')](handleEntityNotFound(_0x500261,null))[_0x03cd('0x2d')](removeEntity(_0x500261,null))[_0x03cd('0x4a')](handleError(_0x500261,null));};function widgetAttributes(_0x521af7){try{switch(_0x521af7['type']){case _0x03cd('0x5d'):return[{'name':_0x03cd('0x5e'),'value':_0x521af7[_0x03cd('0x5e')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x0]?_0x521af7[_0x03cd('0x5f')][0x0]['value']:undefined)||'https://'}];case _0x03cd('0x60'):return[{'name':_0x03cd('0x61'),'value':_0x521af7['attrPath']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x0]?_0x521af7[_0x03cd('0x5f')][0x0]['value']:undefined)||''}];case _0x03cd('0x62'):return[{'name':'attrHourFormat','value':_0x521af7[_0x03cd('0x63')]||(_0x521af7['attrs']&&_0x521af7[_0x03cd('0x5f')][0x0]?_0x521af7[_0x03cd('0x5f')][0x0][_0x03cd('0x64')]:undefined)||_0x03cd('0x65')},{'name':_0x03cd('0x66'),'value':_0x521af7[_0x03cd('0x66')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x1]?_0x521af7['attrs'][0x1][_0x03cd('0x64')]:undefined)||_0x03cd('0x67')},{'name':_0x03cd('0x68'),'value':_0x521af7[_0x03cd('0x68')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x2]?_0x521af7[_0x03cd('0x5f')][0x2]['value']:undefined)||0xc}];case _0x03cd('0x69'):return[{'name':_0x03cd('0x6a'),'value':_0x521af7[_0x03cd('0x6a')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x0]?_0x521af7[_0x03cd('0x5f')][0x0][_0x03cd('0x64')]:undefined)||_0x03cd('0x6b')},{'name':_0x03cd('0x6c'),'value':_0x521af7['attrVoiceQueues']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x1]?_0x521af7[_0x03cd('0x5f')][0x1][_0x03cd('0x64')]:undefined)||[]},{'name':_0x03cd('0x68'),'value':_0x521af7[_0x03cd('0x68')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x2]?_0x521af7[_0x03cd('0x5f')][0x2][_0x03cd('0x64')]:undefined)||0x14},{'name':_0x03cd('0x6d'),'value':_0x521af7[_0x03cd('0x6d')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x3]?_0x521af7[_0x03cd('0x5f')][0x3][_0x03cd('0x64')]:undefined)||_0x03cd('0x6e')},{'name':_0x03cd('0x6f'),'value':_0x521af7['attrEmailAccounts']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x4]?_0x521af7['attrs'][0x4][_0x03cd('0x64')]:undefined)||''},{'name':_0x03cd('0x70'),'value':_0x521af7[_0x03cd('0x70')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x5]?_0x521af7[_0x03cd('0x5f')][0x5][_0x03cd('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x521af7['attrSmsAccounts']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x6]?_0x521af7[_0x03cd('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x521af7['attrOpenchannelAccounts']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x7]?_0x521af7[_0x03cd('0x5f')][0x7][_0x03cd('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x521af7[_0x03cd('0x71')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x8]?_0x521af7['attrs'][0x8][_0x03cd('0x64')]:undefined)||''},{'name':_0x03cd('0x72'),'value':_0x521af7[_0x03cd('0x72')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x9]?_0x521af7[_0x03cd('0x5f')][0x9]['value']:undefined)||''}];case _0x03cd('0x73'):case'pie-chart':return[{'name':_0x03cd('0x74'),'value':_0x521af7[_0x03cd('0x74')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x0]?_0x521af7[_0x03cd('0x5f')][0x0][_0x03cd('0x64')]:undefined)||_0x03cd('0x6b')},{'name':_0x03cd('0x75'),'value':_0x521af7[_0x03cd('0x75')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x1]?_0x521af7['attrs'][0x1][_0x03cd('0x64')]:undefined)||null},{'name':_0x03cd('0x76'),'value':_0x521af7[_0x03cd('0x76')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x2]?_0x521af7['attrs'][0x2]['value']:undefined)||null},{'name':_0x03cd('0x6c'),'value':_0x521af7[_0x03cd('0x6c')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x3]?_0x521af7[_0x03cd('0x5f')][0x3][_0x03cd('0x64')]:undefined)||[]},{'name':_0x03cd('0x6d'),'value':_0x521af7[_0x03cd('0x6d')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x4]?_0x521af7[_0x03cd('0x5f')][0x4][_0x03cd('0x64')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x521af7['attrEmailAccounts']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x5]?_0x521af7[_0x03cd('0x5f')][0x5][_0x03cd('0x64')]:undefined)||''},{'name':_0x03cd('0x70'),'value':_0x521af7[_0x03cd('0x70')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x6]?_0x521af7[_0x03cd('0x5f')][0x6][_0x03cd('0x64')]:undefined)||''},{'name':_0x03cd('0x77'),'value':_0x521af7['attrSmsAccounts']||(_0x521af7['attrs']&&_0x521af7[_0x03cd('0x5f')][0x7]?_0x521af7['attrs'][0x7][_0x03cd('0x64')]:undefined)||''},{'name':_0x03cd('0x78'),'value':_0x521af7[_0x03cd('0x78')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x8]?_0x521af7['attrs'][0x8][_0x03cd('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x521af7[_0x03cd('0x71')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x9]?_0x521af7[_0x03cd('0x5f')][0x9][_0x03cd('0x64')]:undefined)||''},{'name':_0x03cd('0x72'),'value':_0x521af7['attrChatWebsites']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0xa]?_0x521af7[_0x03cd('0x5f')][0xa][_0x03cd('0x64')]:undefined)||''}];case _0x03cd('0x79'):return[{'name':_0x03cd('0x7a'),'type':_0x521af7[_0x03cd('0x7b')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x0]?_0x521af7[_0x03cd('0x5f')][0x0][_0x03cd('0x44')]:undefined)||null,'value':_0x521af7[_0x03cd('0x7a')]||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7['attrs'][0x0]?_0x521af7[_0x03cd('0x5f')][0x0][_0x03cd('0x64')]:undefined)||null},{'name':'attrRefresh','value':_0x521af7['attrRefresh']||(_0x521af7[_0x03cd('0x5f')]&&_0x521af7[_0x03cd('0x5f')][0x1]?_0x521af7[_0x03cd('0x5f')][0x1][_0x03cd('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x44a922){logger['error'](_0x03cd('0x7c'),JSON[_0x03cd('0x7d')](_0x44a922));return[];}}exports[_0x03cd('0x7e')]=function(_0x5db586,_0x4724a6,_0x1dc806){if(_0x5db586[_0x03cd('0x51')]['id']){delete _0x5db586[_0x03cd('0x51')]['id'];}return db[_0x03cd('0x34')][_0x03cd('0x4f')]({'where':{'id':_0x5db586[_0x03cd('0x4c')]['id']}})[_0x03cd('0x2d')](handleEntityNotFound(_0x4724a6,null))[_0x03cd('0x2d')](function(_0x162610){if(_0x162610){_0x5db586['body'][_0x03cd('0x7f')]=_0x162610['id'];_0x5db586['body'][_0x03cd('0x5f')]=widgetAttributes(_0x5db586[_0x03cd('0x51')]);return db[_0x03cd('0x80')]['create'](_0x5db586[_0x03cd('0x51')]);}})[_0x03cd('0x2d')](respondWithResult(_0x4724a6,null))[_0x03cd('0x4a')](handleError(_0x4724a6,null));};exports['getItems']=function(_0x38cb42,_0x4c84aa,_0x28883a){var _0x271bc1={};var _0x43366d={};var _0x788b8;var _0x1e7684;return db[_0x03cd('0x34')]['findOne']({'where':{'id':_0x38cb42[_0x03cd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c84aa,null))[_0x03cd('0x2d')](function(_0x38753d){if(_0x38753d){_0x788b8=_0x38753d;_0x43366d[_0x03cd('0x3a')]=_[_0x03cd('0x37')](db[_0x03cd('0x80')][_0x03cd('0x4d')]);_0x43366d[_0x03cd('0x36')]=_[_0x03cd('0x37')](_0x38cb42[_0x03cd('0x36')]);_0x43366d['filters']=_[_0x03cd('0x39')](_0x43366d[_0x03cd('0x3a')],_0x43366d[_0x03cd('0x36')]);_0x271bc1['attributes']=_[_0x03cd('0x39')](_0x43366d[_0x03cd('0x3a')],qs[_0x03cd('0x3c')](_0x38cb42[_0x03cd('0x36')][_0x03cd('0x3c')]));_0x271bc1[_0x03cd('0x3b')]=_0x271bc1[_0x03cd('0x3b')][_0x03cd('0x81')]?_0x271bc1[_0x03cd('0x3b')]:_0x43366d['model'];_0x271bc1[_0x03cd('0x82')]=qs[_0x03cd('0x3f')](_0x38cb42[_0x03cd('0x36')][_0x03cd('0x3f')]);_0x271bc1['where']=qs[_0x03cd('0x38')](_['pick'](_0x38cb42[_0x03cd('0x36')],_0x43366d[_0x03cd('0x38')]));if(_0x38cb42[_0x03cd('0x36')][_0x03cd('0x42')]){_0x271bc1[_0x03cd('0x40')]=_[_0x03cd('0x43')](_0x271bc1[_0x03cd('0x40')],{'$or':_[_0x03cd('0x33')](_0x271bc1[_0x03cd('0x3b')],function(_0x2d708f){var _0x4577a2={};_0x4577a2[_0x2d708f]={'$like':'%'+_0x38cb42[_0x03cd('0x36')]['filter']+'%'};return _0x4577a2;})});}_0x271bc1=_[_0x03cd('0x43')]({},_0x271bc1,_0x38cb42[_0x03cd('0x46')]);return _0x788b8[_0x03cd('0x83')](_0x271bc1);}})['then'](function(_0x8f7ccf){if(_0x8f7ccf){_0x1e7684=_0x8f7ccf[_0x03cd('0x81')];if(!_0x38cb42[_0x03cd('0x36')][_0x03cd('0x3d')](_0x03cd('0x3e'))){_0x271bc1[_0x03cd('0x20')]=qs[_0x03cd('0x20')](_0x38cb42[_0x03cd('0x36')][_0x03cd('0x20')]);_0x271bc1[_0x03cd('0x1e')]=qs[_0x03cd('0x1e')](_0x38cb42[_0x03cd('0x36')][_0x03cd('0x1e')]);}return _0x788b8[_0x03cd('0x83')](_0x271bc1);}})[_0x03cd('0x2d')](function(_0x5729fb){if(_0x5729fb){return _0x5729fb?{'count':_0x1e7684,'rows':_0x5729fb}:null;}})[_0x03cd('0x2d')](respondWithResult(_0x4c84aa,null))[_0x03cd('0x4a')](handleError(_0x4c84aa,null));}; \ No newline at end of file +var _0xa980=['socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Dashboard','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','role','CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xa980,0x16d));var _0x0a98=function(_0x182d80,_0xfd0969){_0x182d80=_0x182d80-0x0;var _0x1e8dff=_0xa980[_0x182d80];return _0x1e8dff;};'use strict';var emlformat=require(_0x0a98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a98('0x1'));var jsonpatch=require(_0x0a98('0x2'));var rp=require(_0x0a98('0x3'));var moment=require(_0x0a98('0x4'));var BPromise=require(_0x0a98('0x5'));var Mustache=require(_0x0a98('0x6'));var util=require('util');var path=require(_0x0a98('0x7'));var sox=require(_0x0a98('0x8'));var csv=require(_0x0a98('0x9'));var ejs=require(_0x0a98('0xa'));var fs=require('fs');var fs_extra=require(_0x0a98('0xb'));var _=require(_0x0a98('0xc'));var squel=require(_0x0a98('0xd'));var crypto=require(_0x0a98('0xe'));var jsforce=require(_0x0a98('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0a98('0x9'));var querystring=require(_0x0a98('0x10'));var Papa=require(_0x0a98('0x11'));var Redis=require(_0x0a98('0x12'));var authService=require(_0x0a98('0x13'));var qs=require(_0x0a98('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a98('0x15'));var logger=require(_0x0a98('0x16'))(_0x0a98('0x17'));var utils=require(_0x0a98('0x18'));var config=require(_0x0a98('0x19'));var licenseUtil=require(_0x0a98('0x1a'));var db=require(_0x0a98('0x1b'))['db'];config[_0x0a98('0x1c')]=_[_0x0a98('0x1d')](config[_0x0a98('0x1c')],{'host':_0x0a98('0x1e'),'port':0x18eb});var socket=require(_0x0a98('0x1f'))(new Redis(config['redis']));require(_0x0a98('0x20'))[_0x0a98('0x21')](socket);function respondWithStatusCode(_0x21ff75,_0x599755){_0x599755=_0x599755||0xcc;return function(_0x4e4999){if(_0x4e4999){return _0x21ff75[_0x0a98('0x22')](_0x599755);}return _0x21ff75[_0x0a98('0x23')](_0x599755)['end']();};}function respondWithResult(_0xe6c514,_0x5cc349){_0x5cc349=_0x5cc349||0xc8;return function(_0x9141d4){if(_0x9141d4){return _0xe6c514[_0x0a98('0x23')](_0x5cc349)[_0x0a98('0x24')](_0x9141d4);}};}function respondWithFilteredResult(_0x2dc7ad,_0x280199){return function(_0x1608ea){if(_0x1608ea){var _0x2282c7=typeof _0x280199[_0x0a98('0x25')]===_0x0a98('0x26')&&typeof _0x280199[_0x0a98('0x27')]===_0x0a98('0x26');var _0x4c9232=_0x1608ea['count'];var _0x346eb6=_0x2282c7?0x0:_0x280199[_0x0a98('0x25')];var _0x2c3fea=_0x2282c7?_0x1608ea[_0x0a98('0x28')]:_0x280199['offset']+_0x280199['limit'];var _0x1d391b;if(_0x2c3fea>=_0x4c9232){_0x2c3fea=_0x4c9232;_0x1d391b=0xc8;}else{_0x1d391b=0xce;}_0x2dc7ad[_0x0a98('0x23')](_0x1d391b);return _0x2dc7ad['set'](_0x0a98('0x29'),_0x346eb6+'-'+_0x2c3fea+'/'+_0x4c9232)[_0x0a98('0x24')](_0x1608ea);}return null;};}function patchUpdates(_0x5e88b0){return function(_0xd6d9e){try{jsonpatch[_0x0a98('0x2a')](_0xd6d9e,_0x5e88b0,!![]);}catch(_0x573a75){return BPromise[_0x0a98('0x2b')](_0x573a75);}return _0xd6d9e[_0x0a98('0x2c')]();};}function saveUpdates(_0x331c28,_0x50fd6d){return function(_0x16e824){if(_0x16e824){return _0x16e824['update'](_0x331c28)[_0x0a98('0x2d')](function(_0x467c39){return _0x467c39;});}return null;};}function removeEntity(_0x45bf1e,_0x2391a5){return function(_0x569b71){if(_0x569b71){return _0x569b71[_0x0a98('0x2e')]()['then'](function(){var _0x3eed93=_0x569b71[_0x0a98('0x2f')]({'plain':!![]});var _0xee43c6='CustomDashboards';return db['UserProfileResource'][_0x0a98('0x2e')]({'where':{'type':_0xee43c6,'resourceId':_0x3eed93['id']}})['then'](function(){return _0x569b71;});})['then'](function(){_0x45bf1e[_0x0a98('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe1834,_0x421de1){return function(_0x43fd4d){if(!_0x43fd4d){_0xbe1834['sendStatus'](0x194);}return _0x43fd4d;};}function handleError(_0x35893c,_0x404e54){_0x404e54=_0x404e54||0x1f4;return function(_0x8c0257){logger['error'](_0x8c0257[_0x0a98('0x30')]);if(_0x8c0257[_0x0a98('0x31')]){delete _0x8c0257[_0x0a98('0x31')];}_0x35893c['status'](_0x404e54)[_0x0a98('0x32')](_0x8c0257);};}exports['index']=function(_0x201e2c,_0x23fd3b){var _0x55df8f={},_0x4ef8ae={},_0x439572={'count':0x0,'rows':[]};var _0x2301f5=_[_0x0a98('0x33')](db['Dashboard']['rawAttributes'],function(_0x9c026c){return{'name':_0x9c026c['fieldName'],'type':_0x9c026c[_0x0a98('0x34')][_0x0a98('0x35')]};});_0x4ef8ae[_0x0a98('0x36')]=_[_0x0a98('0x33')](_0x2301f5,_0x0a98('0x31'));_0x4ef8ae[_0x0a98('0x37')]=_[_0x0a98('0x38')](_0x201e2c[_0x0a98('0x37')]);_0x4ef8ae[_0x0a98('0x39')]=_[_0x0a98('0x3a')](_0x4ef8ae[_0x0a98('0x36')],_0x4ef8ae['query']);_0x55df8f[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x4ef8ae[_0x0a98('0x36')],qs[_0x0a98('0x3c')](_0x201e2c[_0x0a98('0x37')][_0x0a98('0x3c')]));_0x55df8f['attributes']=_0x55df8f[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0x55df8f[_0x0a98('0x3b')]:_0x4ef8ae[_0x0a98('0x36')];if(!_0x201e2c[_0x0a98('0x37')][_0x0a98('0x3e')](_0x0a98('0x3f'))){_0x55df8f['limit']=qs[_0x0a98('0x27')](_0x201e2c[_0x0a98('0x37')][_0x0a98('0x27')]);_0x55df8f['offset']=qs['offset'](_0x201e2c['query']['offset']);}_0x55df8f[_0x0a98('0x40')]=qs[_0x0a98('0x41')](_0x201e2c[_0x0a98('0x37')][_0x0a98('0x41')]);_0x55df8f['where']=qs['filters'](_[_0x0a98('0x42')](_0x201e2c[_0x0a98('0x37')],_0x4ef8ae[_0x0a98('0x39')]),_0x2301f5);if(_0x201e2c[_0x0a98('0x37')][_0x0a98('0x43')]){_0x55df8f[_0x0a98('0x44')]=_[_0x0a98('0x45')](_0x55df8f[_0x0a98('0x44')],{'$or':_['map'](_0x2301f5,function(_0x5ede10){if(_0x5ede10[_0x0a98('0x34')]!==_0x0a98('0x46')){var _0x41cb35={};_0x41cb35[_0x5ede10[_0x0a98('0x31')]]={'$like':'%'+_0x201e2c[_0x0a98('0x37')]['filter']+'%'};return _0x41cb35;}})});}_0x55df8f=_[_0x0a98('0x45')]({},_0x55df8f,_0x201e2c[_0x0a98('0x47')]);var _0x2ab73f={'where':_0x55df8f[_0x0a98('0x44')]};return db[_0x0a98('0x48')]['count'](_0x2ab73f)[_0x0a98('0x2d')](function(_0x83813f){_0x439572['count']=_0x83813f;if(_0x201e2c['query']['includeAll']){_0x55df8f[_0x0a98('0x49')]=[{'all':!![]}];}return db[_0x0a98('0x48')]['findAll'](_0x55df8f);})[_0x0a98('0x2d')](function(_0x558cf1){_0x439572[_0x0a98('0x4a')]=_0x558cf1;return _0x439572;})[_0x0a98('0x2d')](respondWithFilteredResult(_0x23fd3b,_0x55df8f))[_0x0a98('0x4b')](handleError(_0x23fd3b,null));};exports[_0x0a98('0x4c')]=function(_0x9e5511,_0x11cfee){var _0x5dbbfa={'raw':![],'where':{'id':_0x9e5511[_0x0a98('0x4d')]['id']}},_0x541766={};_0x541766[_0x0a98('0x36')]=_[_0x0a98('0x38')](db['Dashboard'][_0x0a98('0x4e')]);_0x541766[_0x0a98('0x37')]=_[_0x0a98('0x38')](_0x9e5511[_0x0a98('0x37')]);_0x541766[_0x0a98('0x39')]=_['intersection'](_0x541766[_0x0a98('0x36')],_0x541766[_0x0a98('0x37')]);_0x5dbbfa[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x541766[_0x0a98('0x36')],qs[_0x0a98('0x3c')](_0x9e5511['query'][_0x0a98('0x3c')]));_0x5dbbfa[_0x0a98('0x3b')]=_0x5dbbfa[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0x5dbbfa[_0x0a98('0x3b')]:_0x541766[_0x0a98('0x36')];if(_0x9e5511[_0x0a98('0x37')][_0x0a98('0x4f')]){_0x5dbbfa[_0x0a98('0x49')]=[{'all':!![]}];}_0x5dbbfa=_[_0x0a98('0x45')]({},_0x5dbbfa,_0x9e5511['options']);return db[_0x0a98('0x48')][_0x0a98('0x50')](_0x5dbbfa)[_0x0a98('0x2d')](handleEntityNotFound(_0x11cfee,null))[_0x0a98('0x2d')](respondWithResult(_0x11cfee,null))[_0x0a98('0x4b')](handleError(_0x11cfee,null));};exports[_0x0a98('0x51')]=function(_0x5e76f5,_0x4df194){return db[_0x0a98('0x48')][_0x0a98('0x51')](_0x5e76f5[_0x0a98('0x52')],{})['then'](function(_0x3dea73){var _0x202177=_0x5e76f5['user'][_0x0a98('0x2f')]({'plain':!![]});if(!_0x202177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x202177[_0x0a98('0x53')]==='user'){var _0x114a01=_0x3dea73['get']({'plain':!![]});var _0x3fcde5=_0x0a98('0x54');return db[_0x0a98('0x55')][_0x0a98('0x50')]({'where':{'name':_0x3fcde5,'userProfileId':_0x202177[_0x0a98('0x56')]},'raw':!![]})[_0x0a98('0x2d')](function(_0x4780d2){if(_0x4780d2&&_0x4780d2['autoAssociation']===0x0){return db[_0x0a98('0x57')]['create']({'name':_0x114a01[_0x0a98('0x31')],'resourceId':_0x114a01['id'],'type':_0x4780d2[_0x0a98('0x31')],'sectionId':_0x4780d2['id']},{})[_0x0a98('0x2d')](function(){return _0x3dea73;});}else{return _0x3dea73;}})[_0x0a98('0x4b')](function(_0x34ca17){logger[_0x0a98('0x58')](_0x0a98('0x59'),_0x34ca17);throw _0x34ca17;});}return _0x3dea73;})[_0x0a98('0x2d')](respondWithResult(_0x4df194,0xc9))[_0x0a98('0x4b')](handleError(_0x4df194,null));};exports[_0x0a98('0x5a')]=function(_0x2eaa6b,_0x579f7b){var _0xdb08cc={'where':{'id':_0x2eaa6b[_0x0a98('0x4d')]['id']}},_0x6448={};_0x6448[_0x0a98('0x36')]=_['keys'](db[_0x0a98('0x48')][_0x0a98('0x4e')]);_0xdb08cc[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x6448[_0x0a98('0x36')],qs[_0x0a98('0x3c')](_0x2eaa6b[_0x0a98('0x37')]['fields']));_0xdb08cc[_0x0a98('0x3b')]=_0xdb08cc[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0xdb08cc['attributes']:_0x6448[_0x0a98('0x36')];if(_0x2eaa6b[_0x0a98('0x37')][_0x0a98('0x4f')]){_0xdb08cc[_0x0a98('0x49')]=[{'all':!![]}];}_0xdb08cc=_[_0x0a98('0x45')]({},_0xdb08cc,_0x2eaa6b[_0x0a98('0x47')]);return db[_0x0a98('0x48')][_0x0a98('0x50')](_0xdb08cc)[_0x0a98('0x2d')](handleEntityNotFound(_0x579f7b,null))['then'](function(_0x529689){if(_0x529689){var _0x2a1135=_0x529689[_0x0a98('0x2f')]({'plain':!![]});_0x2a1135=qs['omit'](_0x2a1135,['id',_0x0a98('0x5b'),_0x0a98('0x5c')]);_0x2eaa6b[_0x0a98('0x52')]=_['omit'](_0x2eaa6b[_0x0a98('0x52')],['id','createdAt',_0x0a98('0x5c')]);return db[_0x0a98('0x48')][_0x0a98('0x51')](_[_0x0a98('0x45')](_0x2a1135,_0x2eaa6b[_0x0a98('0x52')]),{'include':_0x2eaa6b[_0x0a98('0x37')][_0x0a98('0x4f')]?[{'all':!![]}]:undefined})[_0x0a98('0x2d')](function(_0xbc8ce1){var _0x172190=_0x2eaa6b[_0x0a98('0x5d')][_0x0a98('0x2f')]({'plain':!![]});if(!_0x172190)throw new Error(_0x0a98('0x5e'));if(_0x172190[_0x0a98('0x53')]===_0x0a98('0x5d')){var _0x116193=_0xbc8ce1['get']({'plain':!![]});var _0x3639f7=_0x0a98('0x54');return db[_0x0a98('0x55')][_0x0a98('0x50')]({'where':{'name':_0x3639f7,'userProfileId':_0x172190[_0x0a98('0x56')]},'raw':!![]})[_0x0a98('0x2d')](function(_0x44915e){if(_0x44915e&&_0x44915e['autoAssociation']===0x0){return db[_0x0a98('0x57')][_0x0a98('0x51')]({'name':_0x116193['name'],'resourceId':_0x116193['id'],'type':_0x44915e['name'],'sectionId':_0x44915e['id']},{})[_0x0a98('0x2d')](function(){return _0xbc8ce1;});}else{return _0xbc8ce1;}})[_0x0a98('0x4b')](function(_0x21b0cb){logger[_0x0a98('0x58')](_0x0a98('0x59'),_0x21b0cb);throw _0x21b0cb;});}return _0xbc8ce1;});}})[_0x0a98('0x2d')](respondWithResult(_0x579f7b,0xc9))[_0x0a98('0x4b')](handleError(_0x579f7b,null));};exports[_0x0a98('0x5f')]=function(_0x239d6b,_0x5e78f7){if(_0x239d6b['body']['id']){delete _0x239d6b[_0x0a98('0x52')]['id'];}return db[_0x0a98('0x48')][_0x0a98('0x50')]({'where':{'id':_0x239d6b[_0x0a98('0x4d')]['id']}})[_0x0a98('0x2d')](handleEntityNotFound(_0x5e78f7,null))[_0x0a98('0x2d')](saveUpdates(_0x239d6b[_0x0a98('0x52')],null))['then'](respondWithResult(_0x5e78f7,null))['catch'](handleError(_0x5e78f7,null));};exports[_0x0a98('0x2e')]=function(_0x5281b3,_0x46cc81){return db[_0x0a98('0x48')][_0x0a98('0x50')]({'where':{'id':_0x5281b3[_0x0a98('0x4d')]['id']}})[_0x0a98('0x2d')](handleEntityNotFound(_0x46cc81,null))[_0x0a98('0x2d')](removeEntity(_0x46cc81,null))[_0x0a98('0x4b')](handleError(_0x46cc81,null));};function widgetAttributes(_0x42d850){try{switch(_0x42d850[_0x0a98('0x34')]){case _0x0a98('0x60'):return[{'name':_0x0a98('0x61'),'value':_0x42d850[_0x0a98('0x61')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0][_0x0a98('0x63')]:undefined)||_0x0a98('0x64')}];case _0x0a98('0x65'):return[{'name':_0x0a98('0x66'),'value':_0x42d850[_0x0a98('0x66')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0][_0x0a98('0x63')]:undefined)||''}];case _0x0a98('0x67'):return[{'name':_0x0a98('0x68'),'value':_0x42d850[_0x0a98('0x68')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0]['value']:undefined)||_0x0a98('0x69')},{'name':'attrTimezone','value':_0x42d850['attrTimezone']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x1]?_0x42d850['attrs'][0x1][_0x0a98('0x63')]:undefined)||_0x0a98('0x6a')},{'name':'attrFontSize','value':_0x42d850[_0x0a98('0x6b')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x2]?_0x42d850[_0x0a98('0x62')][0x2][_0x0a98('0x63')]:undefined)||0xc}];case'counter':return[{'name':_0x0a98('0x6c'),'value':_0x42d850[_0x0a98('0x6c')]||(_0x42d850['attrs']&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0][_0x0a98('0x63')]:undefined)||_0x0a98('0x6d')},{'name':_0x0a98('0x6e'),'value':_0x42d850[_0x0a98('0x6e')]||(_0x42d850['attrs']&&_0x42d850[_0x0a98('0x62')][0x1]?_0x42d850['attrs'][0x1][_0x0a98('0x63')]:undefined)||[]},{'name':_0x0a98('0x6b'),'value':_0x42d850[_0x0a98('0x6b')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x2]?_0x42d850[_0x0a98('0x62')][0x2][_0x0a98('0x63')]:undefined)||0x14},{'name':_0x0a98('0x6f'),'value':_0x42d850[_0x0a98('0x6f')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x3]?_0x42d850['attrs'][0x3][_0x0a98('0x63')]:undefined)||_0x0a98('0x70')},{'name':_0x0a98('0x71'),'value':_0x42d850[_0x0a98('0x71')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x4]?_0x42d850[_0x0a98('0x62')][0x4][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x72'),'value':_0x42d850[_0x0a98('0x72')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x5]?_0x42d850[_0x0a98('0x62')][0x5][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x73'),'value':_0x42d850['attrSmsAccounts']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x6]?_0x42d850['attrs'][0x6][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x74'),'value':_0x42d850[_0x0a98('0x74')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x7]?_0x42d850[_0x0a98('0x62')][0x7]['value']:undefined)||''},{'name':_0x0a98('0x75'),'value':_0x42d850[_0x0a98('0x75')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x8]?_0x42d850[_0x0a98('0x62')][0x8]['value']:undefined)||''},{'name':_0x0a98('0x76'),'value':_0x42d850[_0x0a98('0x76')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x9]?_0x42d850['attrs'][0x9][_0x0a98('0x63')]:undefined)||''}];case'multibar-chart':case _0x0a98('0x77'):return[{'name':_0x0a98('0x78'),'value':_0x42d850[_0x0a98('0x78')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x0]?_0x42d850[_0x0a98('0x62')][0x0]['value']:undefined)||_0x0a98('0x6d')},{'name':_0x0a98('0x79'),'value':_0x42d850[_0x0a98('0x79')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850['attrs'][0x1]?_0x42d850[_0x0a98('0x62')][0x1]['value']:undefined)||null},{'name':_0x0a98('0x7a'),'value':_0x42d850[_0x0a98('0x7a')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x2]?_0x42d850['attrs'][0x2]['value']:undefined)||null},{'name':_0x0a98('0x6e'),'value':_0x42d850[_0x0a98('0x6e')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x3]?_0x42d850[_0x0a98('0x62')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x42d850['attrChannel']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x4]?_0x42d850[_0x0a98('0x62')][0x4][_0x0a98('0x63')]:undefined)||_0x0a98('0x70')},{'name':_0x0a98('0x71'),'value':_0x42d850[_0x0a98('0x71')]||(_0x42d850['attrs']&&_0x42d850['attrs'][0x5]?_0x42d850[_0x0a98('0x62')][0x5][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x72'),'value':_0x42d850[_0x0a98('0x72')]||(_0x42d850['attrs']&&_0x42d850[_0x0a98('0x62')][0x6]?_0x42d850[_0x0a98('0x62')][0x6][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x73'),'value':_0x42d850['attrSmsAccounts']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x7]?_0x42d850[_0x0a98('0x62')][0x7]['value']:undefined)||''},{'name':_0x0a98('0x74'),'value':_0x42d850[_0x0a98('0x74')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x8]?_0x42d850[_0x0a98('0x62')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x42d850[_0x0a98('0x75')]||(_0x42d850['attrs']&&_0x42d850['attrs'][0x9]?_0x42d850['attrs'][0x9][_0x0a98('0x63')]:undefined)||''},{'name':_0x0a98('0x76'),'value':_0x42d850[_0x0a98('0x76')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0xa]?_0x42d850[_0x0a98('0x62')][0xa][_0x0a98('0x63')]:undefined)||''}];case _0x0a98('0x7b'):return[{'name':'attrReport','type':_0x42d850['reportType']||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850['attrs'][0x0][_0x0a98('0x34')]:undefined)||null,'value':_0x42d850[_0x0a98('0x7c')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x0]?_0x42d850[_0x0a98('0x62')][0x0]['value']:undefined)||null},{'name':_0x0a98('0x7d'),'value':_0x42d850[_0x0a98('0x7d')]||(_0x42d850[_0x0a98('0x62')]&&_0x42d850[_0x0a98('0x62')][0x1]?_0x42d850['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4c2c87){logger[_0x0a98('0x58')](_0x0a98('0x7e'),JSON['stringify'](_0x4c2c87));return[];}}exports[_0x0a98('0x7f')]=function(_0xb8ed54,_0x3905f3,_0x3cf86f){if(_0xb8ed54[_0x0a98('0x52')]['id']){delete _0xb8ed54[_0x0a98('0x52')]['id'];}return db[_0x0a98('0x48')]['find']({'where':{'id':_0xb8ed54[_0x0a98('0x4d')]['id']}})[_0x0a98('0x2d')](handleEntityNotFound(_0x3905f3,null))[_0x0a98('0x2d')](function(_0x27853e){if(_0x27853e){_0xb8ed54[_0x0a98('0x52')][_0x0a98('0x80')]=_0x27853e['id'];_0xb8ed54[_0x0a98('0x52')][_0x0a98('0x62')]=widgetAttributes(_0xb8ed54[_0x0a98('0x52')]);return db[_0x0a98('0x81')][_0x0a98('0x51')](_0xb8ed54['body']);}})[_0x0a98('0x2d')](respondWithResult(_0x3905f3,null))[_0x0a98('0x4b')](handleError(_0x3905f3,null));};exports[_0x0a98('0x82')]=function(_0x2bea19,_0x14a781,_0xa94c6){var _0x2bc482={};var _0x15f5d5={};var _0x2addae;var _0x6f83b4;return db[_0x0a98('0x48')][_0x0a98('0x83')]({'where':{'id':_0x2bea19[_0x0a98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14a781,null))[_0x0a98('0x2d')](function(_0x2be251){if(_0x2be251){_0x2addae=_0x2be251;_0x15f5d5['model']=_[_0x0a98('0x38')](db[_0x0a98('0x81')][_0x0a98('0x4e')]);_0x15f5d5[_0x0a98('0x37')]=_['keys'](_0x2bea19[_0x0a98('0x37')]);_0x15f5d5['filters']=_[_0x0a98('0x3a')](_0x15f5d5['model'],_0x15f5d5['query']);_0x2bc482[_0x0a98('0x3b')]=_[_0x0a98('0x3a')](_0x15f5d5['model'],qs[_0x0a98('0x3c')](_0x2bea19[_0x0a98('0x37')]['fields']));_0x2bc482['attributes']=_0x2bc482[_0x0a98('0x3b')][_0x0a98('0x3d')]?_0x2bc482[_0x0a98('0x3b')]:_0x15f5d5[_0x0a98('0x36')];_0x2bc482[_0x0a98('0x40')]=qs[_0x0a98('0x41')](_0x2bea19[_0x0a98('0x37')]['sort']);_0x2bc482[_0x0a98('0x44')]=qs[_0x0a98('0x39')](_[_0x0a98('0x42')](_0x2bea19[_0x0a98('0x37')],_0x15f5d5[_0x0a98('0x39')]));if(_0x2bea19[_0x0a98('0x37')]['filter']){_0x2bc482[_0x0a98('0x44')]=_[_0x0a98('0x45')](_0x2bc482['where'],{'$or':_[_0x0a98('0x33')](_0x2bc482[_0x0a98('0x3b')],function(_0x1b0f01){var _0x13c180={};_0x13c180[_0x1b0f01]={'$like':'%'+_0x2bea19[_0x0a98('0x37')]['filter']+'%'};return _0x13c180;})});}_0x2bc482=_[_0x0a98('0x45')]({},_0x2bc482,_0x2bea19[_0x0a98('0x47')]);return _0x2addae[_0x0a98('0x82')](_0x2bc482);}})[_0x0a98('0x2d')](function(_0x3f6a5c){if(_0x3f6a5c){_0x6f83b4=_0x3f6a5c[_0x0a98('0x3d')];if(!_0x2bea19[_0x0a98('0x37')][_0x0a98('0x3e')](_0x0a98('0x3f'))){_0x2bc482[_0x0a98('0x27')]=qs[_0x0a98('0x27')](_0x2bea19[_0x0a98('0x37')][_0x0a98('0x27')]);_0x2bc482[_0x0a98('0x25')]=qs[_0x0a98('0x25')](_0x2bea19[_0x0a98('0x37')][_0x0a98('0x25')]);}return _0x2addae[_0x0a98('0x82')](_0x2bc482);}})[_0x0a98('0x2d')](function(_0x123f39){if(_0x123f39){return _0x123f39?{'count':_0x6f83b4,'rows':_0x123f39}:null;}})[_0x0a98('0x2d')](respondWithResult(_0x14a781,null))[_0x0a98('0x4b')](handleError(_0x14a781,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 2cbbe77..694c656 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 _0x57e3=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x57e3,0xb3));var _0x357e=function(_0xf5d891,_0x32552e){_0xf5d891=_0xf5d891-0x0;var _0x559128=_0x57e3[_0xf5d891];return _0x559128;};'use strict';var EventEmitter=require(_0x357e('0x0'));var Dashboard=require(_0x357e('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x357e('0x2')](0x0);var events={'afterCreate':_0x357e('0x3'),'afterUpdate':'update','afterDestroy':_0x357e('0x4')};function emitEvent(_0x3990c9){return function(_0x27f0e7,_0xe2089e,_0xeb5135){DashboardEvents[_0x357e('0x5')](_0x3990c9+':'+_0x27f0e7['id'],_0x27f0e7);DashboardEvents['emit'](_0x3990c9,_0x27f0e7);_0xeb5135(null);};}for(var e in events){if(events[_0x357e('0x6')](e)){var event=events[e];Dashboard[_0x357e('0x7')](e,emitEvent(event));}}module[_0x357e('0x8')]=DashboardEvents; \ No newline at end of file +var _0x527b=['emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x527b,0xb7));var _0xb527=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x527b[_0x429948];return _0x35d5d1;};'use strict';var EventEmitter=require(_0xb527('0x0'));var Dashboard=require(_0xb527('0x1'))['db'][_0xb527('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb527('0x3')](0x0);var events={'afterCreate':_0xb527('0x4'),'afterUpdate':_0xb527('0x5'),'afterDestroy':_0xb527('0x6')};function emitEvent(_0x44c9d1){return function(_0x4672da,_0x441392,_0x55c289){DashboardEvents[_0xb527('0x7')](_0x44c9d1+':'+_0x4672da['id'],_0x4672da);DashboardEvents['emit'](_0x44c9d1,_0x4672da);_0x55c289(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb527('0x8')](e,emitEvent(event));}}module[_0xb527('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b37d560..41134c7 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 _0xeba0=['path','rimraf','../../config/environment','./dashboard.attributes','dashboards','lodash','util','moment','request-promise'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xeba0,0x1e2));var _0x0eba=function(_0x3cc29f,_0x353898){_0x3cc29f=_0x3cc29f-0x0;var _0x5609de=_0xeba0[_0x3cc29f];return _0x5609de;};'use strict';var _=require(_0x0eba('0x0'));var util=require(_0x0eba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0eba('0x2'));var BPromise=require('bluebird');var rp=require(_0x0eba('0x3'));var fs=require('fs');var path=require(_0x0eba('0x4'));var rimraf=require(_0x0eba('0x5'));var config=require(_0x0eba('0x6'));var attributes=require(_0x0eba('0x7'));module['exports']=function(_0x414f33,_0x4e765b){return _0x414f33['define']('Dashboard',attributes,{'tableName':_0x0eba('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d28=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15fdd6,_0x31810a){var _0xc7d9d1=function(_0x2e3af4){while(--_0x2e3af4){_0x15fdd6['push'](_0x15fdd6['shift']());}};_0xc7d9d1(++_0x31810a);}(_0x3d28,0x150));var _0x83d2=function(_0x41a9c0,_0x34d8fb){_0x41a9c0=_0x41a9c0-0x0;var _0x5e7cf6=_0x3d28[_0x41a9c0];return _0x5e7cf6;};'use strict';var _=require(_0x83d2('0x0'));var util=require(_0x83d2('0x1'));var logger=require(_0x83d2('0x2'))(_0x83d2('0x3'));var moment=require(_0x83d2('0x4'));var BPromise=require(_0x83d2('0x5'));var rp=require(_0x83d2('0x6'));var fs=require('fs');var path=require(_0x83d2('0x7'));var rimraf=require(_0x83d2('0x8'));var config=require(_0x83d2('0x9'));var attributes=require(_0x83d2('0xa'));module[_0x83d2('0xb')]=function(_0x1a9502,_0xfb8aee){return _0x1a9502[_0x83d2('0xc')](_0x83d2('0xd'),attributes,{'tableName':_0x83d2('0xe'),'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 1b3bb68..a754c90 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 _0x064c=['../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','ioredis'];(function(_0x192a81,_0x4b3e70){var _0x5721f9=function(_0x313c2a){while(--_0x313c2a){_0x192a81['push'](_0x192a81['shift']());}};_0x5721f9(++_0x4b3e70);}(_0x064c,0x87));var _0xc064=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x064c[_0x5581ba];return _0x1e927f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc064('0x0'));var rs=require(_0xc064('0x1'));var fs=require('fs');var Redis=require(_0xc064('0x2'));var db=require(_0xc064('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc064('0x4'));var config=require(_0xc064('0x5'));var jayson=require(_0xc064('0x6'));var client=jayson['client'][_0xc064('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc064('0x8')],{'host':_0xc064('0x9'),'port':0x18eb});var socket=require(_0xc064('0xa'))(new Redis(config['redis']));require(_0xc064('0xb'))[_0xc064('0xc')](socket);function respondWithRpcPromise(_0x1ccb50,_0x43345f,_0x547a4f){return new BPromise(function(_0x549d21,_0x188ccf){return client['request'](_0x1ccb50,_0x547a4f)[_0xc064('0xd')](function(_0x4d4d4f){logger['info'](_0xc064('0xe'),_0x43345f,_0xc064('0xf'));logger[_0xc064('0x10')](_0xc064('0x11'),_0x43345f,_0xc064('0xf'),JSON[_0xc064('0x12')](_0x4d4d4f));if(_0x4d4d4f[_0xc064('0x13')]){if(_0x4d4d4f[_0xc064('0x13')][_0xc064('0x14')]===0x1f4){logger[_0xc064('0x13')](_0xc064('0xe'),_0x43345f,_0x4d4d4f[_0xc064('0x13')][_0xc064('0x15')]);return _0x188ccf(_0x4d4d4f['error']['message']);}logger[_0xc064('0x13')](_0xc064('0xe'),_0x43345f,_0x4d4d4f['error'][_0xc064('0x15')]);return _0x549d21(_0x4d4d4f[_0xc064('0x13')][_0xc064('0x15')]);}else{logger['info'](_0xc064('0xe'),_0x43345f,_0xc064('0xf'));_0x549d21(_0x4d4d4f[_0xc064('0x16')][_0xc064('0x15')]);}})['catch'](function(_0x1796c7){logger[_0xc064('0x13')](_0xc064('0xe'),_0x43345f,_0x1796c7);_0x188ccf(_0x1796c7);});});} \ No newline at end of file +var _0x3ba0=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ba0,0xab));var _0x03ba=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3ba0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x03ba('0x0'));var util=require(_0x03ba('0x1'));var moment=require(_0x03ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x03ba('0x3'));var fs=require('fs');var Redis=require(_0x03ba('0x4'));var db=require(_0x03ba('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03ba('0x6'))('rpc');var config=require(_0x03ba('0x7'));var jayson=require(_0x03ba('0x8'));var client=jayson[_0x03ba('0x9')][_0x03ba('0xa')]({'port':0x232a});config[_0x03ba('0xb')]=_['defaults'](config[_0x03ba('0xb')],{'host':_0x03ba('0xc'),'port':0x18eb});var socket=require(_0x03ba('0xd'))(new Redis(config[_0x03ba('0xb')]));require(_0x03ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x498f2a,_0xeedc16,_0x119459){return new BPromise(function(_0x299a7a,_0x4e4d5e){return client[_0x03ba('0xf')](_0x498f2a,_0x119459)['then'](function(_0x33c6fb){logger['info'](_0x03ba('0x10'),_0xeedc16,_0x03ba('0x11'));logger[_0x03ba('0x12')](_0x03ba('0x13'),_0xeedc16,_0x03ba('0x11'),JSON[_0x03ba('0x14')](_0x33c6fb));if(_0x33c6fb[_0x03ba('0x15')]){if(_0x33c6fb[_0x03ba('0x15')][_0x03ba('0x16')]===0x1f4){logger[_0x03ba('0x15')]('Dashboard,\x20%s,\x20%s',_0xeedc16,_0x33c6fb[_0x03ba('0x15')]['message']);return _0x4e4d5e(_0x33c6fb['error'][_0x03ba('0x17')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0xeedc16,_0x33c6fb[_0x03ba('0x15')][_0x03ba('0x17')]);return _0x299a7a(_0x33c6fb['error'][_0x03ba('0x17')]);}else{logger[_0x03ba('0x18')]('Dashboard,\x20%s,\x20%s',_0xeedc16,_0x03ba('0x11'));_0x299a7a(_0x33c6fb[_0x03ba('0x19')][_0x03ba('0x17')]);}})[_0x03ba('0x1a')](function(_0x1a0a7b){logger[_0x03ba('0x15')](_0x03ba('0x10'),_0xeedc16,_0x1a0a7b);_0x4e4d5e(_0x1a0a7b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e616005..4b9eac9 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 _0x5482=['dashboard:','save','update','emit','removeListener'];(function(_0x23648e,_0x13c6f9){var _0x6de7b1=function(_0x5551f7){while(--_0x5551f7){_0x23648e['push'](_0x23648e['shift']());}};_0x6de7b1(++_0x13c6f9);}(_0x5482,0x8d));var _0x2548=function(_0x510ee9,_0xfd8b59){_0x510ee9=_0x510ee9-0x0;var _0xc4e23=_0x5482[_0x510ee9];return _0xc4e23;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x2548('0x0'),'remove',_0x2548('0x1')];function createListener(_0x12d1ea,_0x5b25d9){return function(_0x504e73){_0x5b25d9[_0x2548('0x2')](_0x12d1ea,_0x504e73);};}function removeListener(_0x1caa8a,_0x253d89){return function(){DashboardEvents[_0x2548('0x3')](_0x1caa8a,_0x253d89);};}exports['register']=function(_0x2a2bf5){for(var _0x4b27b9=0x0,_0x75eeac=events['length'];_0x4b27b9<_0x75eeac;_0x4b27b9++){var _0x3b17f3=events[_0x4b27b9];var _0x55eb89=createListener(_0x2548('0x4')+_0x3b17f3,_0x2a2bf5);DashboardEvents['on'](_0x3b17f3,_0x55eb89);}}; \ No newline at end of file +var _0x7461=['register','length','dashboard:','./dashboard.events','save','remove','update','removeListener'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0x7461,0xdb));var _0x1746=function(_0xec722a,_0x354472){_0xec722a=_0xec722a-0x0;var _0xbb0f9e=_0x7461[_0xec722a];return _0xbb0f9e;};'use strict';var DashboardEvents=require(_0x1746('0x0'));var events=[_0x1746('0x1'),_0x1746('0x2'),_0x1746('0x3')];function createListener(_0x2fc60c,_0x5b396e){return function(_0x4c93cb){_0x5b396e['emit'](_0x2fc60c,_0x4c93cb);};}function removeListener(_0x4aa336,_0x89a445){return function(){DashboardEvents[_0x1746('0x4')](_0x4aa336,_0x89a445);};}exports[_0x1746('0x5')]=function(_0x3c5416){for(var _0x2313d7=0x0,_0x165636=events[_0x1746('0x6')];_0x2313d7<_0x165636;_0x2313d7++){var _0x35946e=events[_0x2313d7];var _0x177aa8=createListener(_0x1746('0x7')+_0x35946e,_0x3c5416);DashboardEvents['on'](_0x35946e,_0x177aa8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e0758fd..1707c67 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 _0xb5c7=['put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xb5c7,0x10c));var _0x7b5c=function(_0x5c8a7a,_0x13a31d){_0x5c8a7a=_0x5c8a7a-0x0;var _0x1e899a=_0xb5c7[_0x5c8a7a];return _0x1e899a;};'use strict';var multer=require(_0x7b5c('0x0'));var util=require(_0x7b5c('0x1'));var path=require(_0x7b5c('0x2'));var timeout=require(_0x7b5c('0x3'));var express=require('express');var router=express[_0x7b5c('0x4')]();var fs_extra=require(_0x7b5c('0x5'));var auth=require(_0x7b5c('0x6'));var interaction=require(_0x7b5c('0x7'));var config=require(_0x7b5c('0x8'));var controller=require(_0x7b5c('0x9'));router[_0x7b5c('0xa')]('/',auth[_0x7b5c('0xb')](),controller['index']);router['get'](_0x7b5c('0xc'),auth['isAuthenticated'](),controller[_0x7b5c('0xd')]);router['get'](_0x7b5c('0xe'),auth['isAuthenticated'](),controller[_0x7b5c('0xf')]);router[_0x7b5c('0x10')]('/',auth[_0x7b5c('0xb')](),controller['create']);router[_0x7b5c('0x10')](_0x7b5c('0x11'),auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x12')]);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x7b5c('0x13')]);router[_0x7b5c('0x14')](_0x7b5c('0xc'),auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x15')]);router[_0x7b5c('0x16')](_0x7b5c('0xc'),auth['isAuthenticated'](),controller[_0x7b5c('0x17')]);module['exports']=router; \ No newline at end of file +var _0xeeea=['getItems','create','/:id/clone','clone','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items'];(function(_0x464416,_0x5e0681){var _0x10f38b=function(_0x543ea6){while(--_0x543ea6){_0x464416['push'](_0x464416['shift']());}};_0x10f38b(++_0x5e0681);}(_0xeeea,0xac));var _0xaeee=function(_0x30c18f,_0x3751e4){_0x30c18f=_0x30c18f-0x0;var _0x52ba0e=_0xeeea[_0x30c18f];return _0x52ba0e;};'use strict';var multer=require(_0xaeee('0x0'));var util=require(_0xaeee('0x1'));var path=require(_0xaeee('0x2'));var timeout=require(_0xaeee('0x3'));var express=require(_0xaeee('0x4'));var router=express[_0xaeee('0x5')]();var fs_extra=require(_0xaeee('0x6'));var auth=require(_0xaeee('0x7'));var interaction=require(_0xaeee('0x8'));var config=require(_0xaeee('0x9'));var controller=require(_0xaeee('0xa'));router[_0xaeee('0xb')]('/',auth[_0xaeee('0xc')](),controller[_0xaeee('0xd')]);router['get'](_0xaeee('0xe'),auth[_0xaeee('0xc')](),controller[_0xaeee('0xf')]);router[_0xaeee('0xb')](_0xaeee('0x10'),auth[_0xaeee('0xc')](),controller[_0xaeee('0x11')]);router['post']('/',auth[_0xaeee('0xc')](),controller[_0xaeee('0x12')]);router['post'](_0xaeee('0x13'),auth[_0xaeee('0xc')](),controller[_0xaeee('0x14')]);router[_0xaeee('0x15')](_0xaeee('0x10'),auth[_0xaeee('0xc')](),controller['addItem']);router[_0xaeee('0x16')]('/:id',auth[_0xaeee('0xc')](),controller[_0xaeee('0x17')]);router[_0xaeee('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xaeee('0x19')]);module[_0xaeee('0x1a')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ff365bb..1f17101 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 _0xbd51=['setDataValue','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','attrs','stringify'];(function(_0x50f87d,_0x4bdf62){var _0x265cae=function(_0x297a66){while(--_0x297a66){_0x50f87d['push'](_0x50f87d['shift']());}};_0x265cae(++_0x4bdf62);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x35b57e,_0x3c9998){_0x35b57e=_0x35b57e-0x0;var _0xafbdb1=_0xbd51[_0x35b57e];return _0xafbdb1;};'use strict';var Sequelize=require(_0x1bd5('0x0'));var squel=require('squel');var _=require(_0x1bd5('0x1'));module[_0x1bd5('0x2')]={'title':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1bd5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x1bd5('0x4')));}catch(_0x362b24){return[];}},'set':function(_0x43e6b6){try{this['setDataValue'](_0x1bd5('0x4'),JSON[_0x1bd5('0x5')](_0x43e6b6));}catch(_0x19077c){this[_0x1bd5('0x6')](_0x1bd5('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x1bd5('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1bd5('0x7')]},'col':{'type':Sequelize[_0x1bd5('0x7')]},'background':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x8'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1bd5('0x3')],'allowNull':![],'defaultValue':_0x1bd5('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1bd5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xabce[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('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 8d12379..d4d80d2 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 _0xb76d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','intersection','fields','attributes','length','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','value','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x378fa0,_0x31a420){var _0x2b7056=function(_0x1e193e){while(--_0x1e193e){_0x378fa0['push'](_0x378fa0['shift']());}};_0x2b7056(++_0x31a420);}(_0xb76d,0x119));var _0xdb76=function(_0x2379ab,_0x319275){_0x2379ab=_0x2379ab-0x0;var _0x3c5c87=_0xb76d[_0x2379ab];return _0x3c5c87;};'use strict';var emlformat=require(_0xdb76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb76('0x1'));var jsonpatch=require(_0xdb76('0x2'));var rp=require(_0xdb76('0x3'));var moment=require('moment');var BPromise=require(_0xdb76('0x4'));var Mustache=require(_0xdb76('0x5'));var util=require(_0xdb76('0x6'));var path=require(_0xdb76('0x7'));var sox=require(_0xdb76('0x8'));var csv=require(_0xdb76('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb76('0xa'));var _=require(_0xdb76('0xb'));var squel=require(_0xdb76('0xc'));var crypto=require(_0xdb76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdb76('0xe'));var toCsv=require(_0xdb76('0x9'));var querystring=require('querystring');var Papa=require(_0xdb76('0xf'));var Redis=require(_0xdb76('0x10'));var authService=require(_0xdb76('0x11'));var qs=require(_0xdb76('0x12'));var as=require(_0xdb76('0x13'));var hardwareService=require(_0xdb76('0x14'));var logger=require(_0xdb76('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdb76('0x16'));var licenseUtil=require(_0xdb76('0x17'));var db=require(_0xdb76('0x18'))['db'];config['redis']=_['defaults'](config[_0xdb76('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb76('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xdb76('0x1b')](socket);function respondWithStatusCode(_0x28d3a5,_0x1196fb){_0x1196fb=_0x1196fb||0xcc;return function(_0x8d2de2){if(_0x8d2de2){return _0x28d3a5['sendStatus'](_0x1196fb);}return _0x28d3a5[_0xdb76('0x1c')](_0x1196fb)[_0xdb76('0x1d')]();};}function respondWithResult(_0x5a1017,_0x385416){_0x385416=_0x385416||0xc8;return function(_0x1a61cf){if(_0x1a61cf){return _0x5a1017[_0xdb76('0x1c')](_0x385416)[_0xdb76('0x1e')](_0x1a61cf);}};}function respondWithFilteredResult(_0x388fb0,_0x1e3c5e){return function(_0x557649){if(_0x557649){var _0x175567=typeof _0x1e3c5e[_0xdb76('0x1f')]===_0xdb76('0x20')&&typeof _0x1e3c5e['limit']===_0xdb76('0x20');var _0xf06f1c=_0x557649[_0xdb76('0x21')];var _0x5921d4=_0x175567?0x0:_0x1e3c5e[_0xdb76('0x1f')];var _0x3984e2=_0x175567?_0x557649[_0xdb76('0x21')]:_0x1e3c5e[_0xdb76('0x1f')]+_0x1e3c5e[_0xdb76('0x22')];var _0xa574d4;if(_0x3984e2>=_0xf06f1c){_0x3984e2=_0xf06f1c;_0xa574d4=0xc8;}else{_0xa574d4=0xce;}_0x388fb0[_0xdb76('0x1c')](_0xa574d4);return _0x388fb0[_0xdb76('0x23')](_0xdb76('0x24'),_0x5921d4+'-'+_0x3984e2+'/'+_0xf06f1c)[_0xdb76('0x1e')](_0x557649);}return null;};}function patchUpdates(_0x3718e1){return function(_0x1b1f71){try{jsonpatch[_0xdb76('0x25')](_0x1b1f71,_0x3718e1,!![]);}catch(_0x560433){return BPromise[_0xdb76('0x26')](_0x560433);}return _0x1b1f71['save']();};}function saveUpdates(_0x12f479,_0x2290ed){return function(_0x4504eb){if(_0x4504eb){return _0x4504eb[_0xdb76('0x27')](_0x12f479)[_0xdb76('0x28')](function(_0x25d904){return _0x25d904;});}return null;};}function removeEntity(_0xec9e4b,_0x168dc4){return function(_0x3de9ad){if(_0x3de9ad){return _0x3de9ad[_0xdb76('0x29')]()[_0xdb76('0x28')](function(){_0xec9e4b['status'](0xcc)[_0xdb76('0x1d')]();});}};}function handleEntityNotFound(_0x57549a,_0x295317){return function(_0x25d034){if(!_0x25d034){_0x57549a[_0xdb76('0x2a')](0x194);}return _0x25d034;};}function handleError(_0x55d8c4,_0x5960cb){_0x5960cb=_0x5960cb||0x1f4;return function(_0x1ffce7){logger[_0xdb76('0x2b')](_0x1ffce7[_0xdb76('0x2c')]);if(_0x1ffce7['name']){delete _0x1ffce7[_0xdb76('0x2d')];}_0x55d8c4[_0xdb76('0x1c')](_0x5960cb)[_0xdb76('0x2e')](_0x1ffce7);};}exports[_0xdb76('0x2f')]=function(_0x296ec5,_0x13b7a0){var _0x1f152d={'raw':![],'where':{'id':_0x296ec5[_0xdb76('0x30')]['id']}},_0x12c9b9={};_0x12c9b9[_0xdb76('0x31')]=_['keys'](db[_0xdb76('0x32')][_0xdb76('0x33')]);_0x12c9b9[_0xdb76('0x34')]=_[_0xdb76('0x35')](_0x296ec5['query']);_0x12c9b9['filters']=_[_0xdb76('0x36')](_0x12c9b9[_0xdb76('0x31')],_0x12c9b9[_0xdb76('0x34')]);_0x1f152d['attributes']=_['intersection'](_0x12c9b9[_0xdb76('0x31')],qs['fields'](_0x296ec5['query'][_0xdb76('0x37')]));_0x1f152d[_0xdb76('0x38')]=_0x1f152d[_0xdb76('0x38')][_0xdb76('0x39')]?_0x1f152d[_0xdb76('0x38')]:_0x12c9b9['model'];if(_0x296ec5['query'][_0xdb76('0x3a')]){_0x1f152d[_0xdb76('0x3b')]=[{'all':!![]}];}_0x1f152d=_[_0xdb76('0x3c')]({},_0x1f152d,_0x296ec5['options']);return db['DashboardItem'][_0xdb76('0x3d')](_0x1f152d)[_0xdb76('0x28')](handleEntityNotFound(_0x13b7a0,null))[_0xdb76('0x28')](respondWithResult(_0x13b7a0,null))[_0xdb76('0x3e')](handleError(_0x13b7a0,null));};exports[_0xdb76('0x29')]=function(_0x12d52d,_0x271220){return db[_0xdb76('0x32')][_0xdb76('0x3d')]({'where':{'id':_0x12d52d['params']['id']}})[_0xdb76('0x28')](handleEntityNotFound(_0x271220,null))[_0xdb76('0x28')](removeEntity(_0x271220,null))['catch'](handleError(_0x271220,null));};function widgetAttributes(_0x14c994){try{switch(_0x14c994[_0xdb76('0x3f')]){case _0xdb76('0x40'):return[{'name':_0xdb76('0x41'),'value':_0x14c994[_0xdb76('0x41')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x0]?_0x14c994['attrs'][0x0]['value']:undefined)||_0xdb76('0x43')}];case _0xdb76('0x44'):return[{'name':'attrPath','value':_0x14c994[_0xdb76('0x45')]||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x0]?_0x14c994[_0xdb76('0x42')][0x0]['value']:undefined)||''}];case _0xdb76('0x46'):return[{'name':_0xdb76('0x47'),'value':_0x14c994[_0xdb76('0x47')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x0]?_0x14c994[_0xdb76('0x42')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x14c994[_0xdb76('0x48')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x1]?_0x14c994['attrs'][0x1]['value']:undefined)||_0xdb76('0x49')},{'name':'attrFontSize','value':_0x14c994['attrFontSize']||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x2]?_0x14c994[_0xdb76('0x42')][0x2][_0xdb76('0x4a')]:undefined)||0xc}];case _0xdb76('0x4b'):return[{'name':'attrMetric','value':_0x14c994[_0xdb76('0x4c')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x0]?_0x14c994['attrs'][0x0]['value']:undefined)||_0xdb76('0x4d')},{'name':_0xdb76('0x4e'),'value':_0x14c994[_0xdb76('0x4e')]||(_0x14c994['attrs']&&_0x14c994['attrs'][0x1]?_0x14c994[_0xdb76('0x42')][0x1][_0xdb76('0x4a')]:undefined)||[]},{'name':_0xdb76('0x4f'),'value':_0x14c994[_0xdb76('0x4f')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x2]?_0x14c994[_0xdb76('0x42')][0x2]['value']:undefined)||0x14},{'name':_0xdb76('0x50'),'value':_0x14c994['attrChannel']||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x3]?_0x14c994[_0xdb76('0x42')][0x3]['value']:undefined)||_0xdb76('0x51')},{'name':_0xdb76('0x52'),'value':_0x14c994['attrEmailAccounts']||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x4]?_0x14c994[_0xdb76('0x42')][0x4][_0xdb76('0x4a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x14c994[_0xdb76('0x53')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x5]?_0x14c994['attrs'][0x5][_0xdb76('0x4a')]:undefined)||''},{'name':_0xdb76('0x54'),'value':_0x14c994[_0xdb76('0x54')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x6]?_0x14c994['attrs'][0x6][_0xdb76('0x4a')]:undefined)||''},{'name':_0xdb76('0x55'),'value':_0x14c994[_0xdb76('0x55')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x7]?_0x14c994['attrs'][0x7][_0xdb76('0x4a')]:undefined)||''},{'name':_0xdb76('0x56'),'value':_0x14c994[_0xdb76('0x56')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x8]?_0x14c994[_0xdb76('0x42')][0x8]['value']:undefined)||''},{'name':_0xdb76('0x57'),'value':_0x14c994[_0xdb76('0x57')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x9]?_0x14c994[_0xdb76('0x42')][0x9][_0xdb76('0x4a')]:undefined)||''}];case _0xdb76('0x58'):case _0xdb76('0x59'):return[{'name':_0xdb76('0x5a'),'value':_0x14c994[_0xdb76('0x5a')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x0]?_0x14c994[_0xdb76('0x42')][0x0]['value']:undefined)||_0xdb76('0x4d')},{'name':_0xdb76('0x5b'),'value':_0x14c994[_0xdb76('0x5b')]||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x1]?_0x14c994['attrs'][0x1]['value']:undefined)||null},{'name':_0xdb76('0x5c'),'value':_0x14c994[_0xdb76('0x5c')]||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x2]?_0x14c994[_0xdb76('0x42')][0x2]['value']:undefined)||null},{'name':_0xdb76('0x4e'),'value':_0x14c994['attrVoiceQueues']||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x3]?_0x14c994[_0xdb76('0x42')][0x3][_0xdb76('0x4a')]:undefined)||[]},{'name':_0xdb76('0x50'),'value':_0x14c994['attrChannel']||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x4]?_0x14c994[_0xdb76('0x42')][0x4][_0xdb76('0x4a')]:undefined)||'voice'},{'name':_0xdb76('0x52'),'value':_0x14c994[_0xdb76('0x52')]||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x5]?_0x14c994[_0xdb76('0x42')][0x5][_0xdb76('0x4a')]:undefined)||''},{'name':_0xdb76('0x53'),'value':_0x14c994[_0xdb76('0x53')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994['attrs'][0x6]?_0x14c994[_0xdb76('0x42')][0x6]['value']:undefined)||''},{'name':_0xdb76('0x54'),'value':_0x14c994[_0xdb76('0x54')]||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0x7]?_0x14c994['attrs'][0x7][_0xdb76('0x4a')]:undefined)||''},{'name':_0xdb76('0x55'),'value':_0x14c994[_0xdb76('0x55')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x8]?_0x14c994[_0xdb76('0x42')][0x8]['value']:undefined)||''},{'name':_0xdb76('0x56'),'value':_0x14c994['attrWhatsappAccounts']||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x9]?_0x14c994[_0xdb76('0x42')][0x9][_0xdb76('0x4a')]:undefined)||''},{'name':_0xdb76('0x57'),'value':_0x14c994[_0xdb76('0x57')]||(_0x14c994['attrs']&&_0x14c994[_0xdb76('0x42')][0xa]?_0x14c994['attrs'][0xa]['value']:undefined)||''}];case _0xdb76('0x5d'):return[{'name':_0xdb76('0x5e'),'type':_0x14c994[_0xdb76('0x5f')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994[_0xdb76('0x42')][0x0]?_0x14c994[_0xdb76('0x42')][0x0][_0xdb76('0x3f')]:undefined)||null,'value':_0x14c994['attrReport']||(_0x14c994[_0xdb76('0x42')]&&_0x14c994['attrs'][0x0]?_0x14c994[_0xdb76('0x42')][0x0]['value']:undefined)||null},{'name':_0xdb76('0x60'),'value':_0x14c994[_0xdb76('0x60')]||(_0x14c994[_0xdb76('0x42')]&&_0x14c994['attrs'][0x1]?_0x14c994[_0xdb76('0x42')][0x1][_0xdb76('0x4a')]:undefined)||0x0}];default:return[];}}catch(_0x53cf26){logger[_0xdb76('0x2b')](_0xdb76('0x61'),JSON['stringify'](_0x53cf26));return[];}}exports[_0xdb76('0x62')]=function(_0x5460f3,_0x16b40b){if(_0x5460f3[_0xdb76('0x63')]){_0x5460f3[_0xdb76('0x63')]['attrs']=widgetAttributes(_0x5460f3[_0xdb76('0x63')]);}return db[_0xdb76('0x32')]['create'](_0x5460f3[_0xdb76('0x63')],{})[_0xdb76('0x28')](respondWithResult(_0x16b40b,0xc9))['catch'](handleError(_0x16b40b,null));};exports['update']=function(_0x5dbf84,_0x3ccb95){if(_0x5dbf84[_0xdb76('0x63')]['id']){delete _0x5dbf84['body']['id'];}_0x5dbf84['body']['attrs']=widgetAttributes(_0x5dbf84['body']);return db[_0xdb76('0x32')][_0xdb76('0x3d')]({'where':{'id':_0x5dbf84['params']['id']}})[_0xdb76('0x28')](handleEntityNotFound(_0x3ccb95,null))[_0xdb76('0x28')](saveUpdates(_0x5dbf84[_0xdb76('0x63')],null))[_0xdb76('0x28')](respondWithResult(_0x3ccb95,null))[_0xdb76('0x3e')](handleError(_0x3ccb95,null));}; \ No newline at end of file +var _0x095b=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart'];(function(_0x52d8dc,_0x41e3d9){var _0x2fa6bd=function(_0x4c8f14){while(--_0x4c8f14){_0x52d8dc['push'](_0x52d8dc['shift']());}};_0x2fa6bd(++_0x41e3d9);}(_0x095b,0x6e));var _0xb095=function(_0x28bdd6,_0x3794d1){_0x28bdd6=_0x28bdd6-0x0;var _0x45919b=_0x095b[_0x28bdd6];return _0x45919b;};'use strict';var emlformat=require(_0xb095('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb095('0x1'));var jsonpatch=require(_0xb095('0x2'));var rp=require(_0xb095('0x3'));var moment=require(_0xb095('0x4'));var BPromise=require(_0xb095('0x5'));var Mustache=require('mustache');var util=require(_0xb095('0x6'));var path=require(_0xb095('0x7'));var sox=require(_0xb095('0x8'));var csv=require(_0xb095('0x9'));var ejs=require(_0xb095('0xa'));var fs=require('fs');var fs_extra=require(_0xb095('0xb'));var _=require(_0xb095('0xc'));var squel=require(_0xb095('0xd'));var crypto=require(_0xb095('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb095('0xf'));var toCsv=require(_0xb095('0x9'));var querystring=require(_0xb095('0x10'));var Papa=require(_0xb095('0x11'));var Redis=require(_0xb095('0x12'));var authService=require(_0xb095('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb095('0x14'));var logger=require(_0xb095('0x15'))('api');var utils=require(_0xb095('0x16'));var config=require(_0xb095('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb095('0x18'))['db'];config['redis']=_[_0xb095('0x19')](config[_0xb095('0x1a')],{'host':_0xb095('0x1b'),'port':0x18eb});var socket=require(_0xb095('0x1c'))(new Redis(config[_0xb095('0x1a')]));require(_0xb095('0x1d'))[_0xb095('0x1e')](socket);function respondWithStatusCode(_0x4afb4d,_0x2d6e3b){_0x2d6e3b=_0x2d6e3b||0xcc;return function(_0x3a77f1){if(_0x3a77f1){return _0x4afb4d[_0xb095('0x1f')](_0x2d6e3b);}return _0x4afb4d[_0xb095('0x20')](_0x2d6e3b)[_0xb095('0x21')]();};}function respondWithResult(_0x2568f8,_0x5809b8){_0x5809b8=_0x5809b8||0xc8;return function(_0x52b48a){if(_0x52b48a){return _0x2568f8['status'](_0x5809b8)[_0xb095('0x22')](_0x52b48a);}};}function respondWithFilteredResult(_0x2c4e86,_0x1c509b){return function(_0x54d06){if(_0x54d06){var _0x44039f=typeof _0x1c509b[_0xb095('0x23')]==='undefined'&&typeof _0x1c509b[_0xb095('0x24')]===_0xb095('0x25');var _0x27e1d0=_0x54d06[_0xb095('0x26')];var _0x5c2674=_0x44039f?0x0:_0x1c509b[_0xb095('0x23')];var _0x212c53=_0x44039f?_0x54d06[_0xb095('0x26')]:_0x1c509b[_0xb095('0x23')]+_0x1c509b[_0xb095('0x24')];var _0x2af120;if(_0x212c53>=_0x27e1d0){_0x212c53=_0x27e1d0;_0x2af120=0xc8;}else{_0x2af120=0xce;}_0x2c4e86['status'](_0x2af120);return _0x2c4e86[_0xb095('0x27')]('Content-Range',_0x5c2674+'-'+_0x212c53+'/'+_0x27e1d0)['json'](_0x54d06);}return null;};}function patchUpdates(_0x4ef4a9){return function(_0x1dc3cd){try{jsonpatch['apply'](_0x1dc3cd,_0x4ef4a9,!![]);}catch(_0x39f9de){return BPromise[_0xb095('0x28')](_0x39f9de);}return _0x1dc3cd[_0xb095('0x29')]();};}function saveUpdates(_0x32d1e6,_0x4913f6){return function(_0x5bfe24){if(_0x5bfe24){return _0x5bfe24[_0xb095('0x2a')](_0x32d1e6)['then'](function(_0x3c6488){return _0x3c6488;});}return null;};}function removeEntity(_0x1bbe29,_0x1f1206){return function(_0x5a35db){if(_0x5a35db){return _0x5a35db[_0xb095('0x2b')]()[_0xb095('0x2c')](function(){_0x1bbe29[_0xb095('0x20')](0xcc)[_0xb095('0x21')]();});}};}function handleEntityNotFound(_0x2dcb77,_0xea61bd){return function(_0x183815){if(!_0x183815){_0x2dcb77[_0xb095('0x1f')](0x194);}return _0x183815;};}function handleError(_0x5ed6f7,_0x55233e){_0x55233e=_0x55233e||0x1f4;return function(_0xd6426c){logger[_0xb095('0x2d')](_0xd6426c['stack']);if(_0xd6426c[_0xb095('0x2e')]){delete _0xd6426c[_0xb095('0x2e')];}_0x5ed6f7[_0xb095('0x20')](_0x55233e)[_0xb095('0x2f')](_0xd6426c);};}exports[_0xb095('0x30')]=function(_0x2a06f5,_0xafd194){var _0x4d5a6d={'raw':![],'where':{'id':_0x2a06f5[_0xb095('0x31')]['id']}},_0x14760d={};_0x14760d[_0xb095('0x32')]=_[_0xb095('0x33')](db[_0xb095('0x34')][_0xb095('0x35')]);_0x14760d[_0xb095('0x36')]=_['keys'](_0x2a06f5['query']);_0x14760d['filters']=_['intersection'](_0x14760d['model'],_0x14760d[_0xb095('0x36')]);_0x4d5a6d[_0xb095('0x37')]=_[_0xb095('0x38')](_0x14760d[_0xb095('0x32')],qs[_0xb095('0x39')](_0x2a06f5[_0xb095('0x36')][_0xb095('0x39')]));_0x4d5a6d[_0xb095('0x37')]=_0x4d5a6d[_0xb095('0x37')][_0xb095('0x3a')]?_0x4d5a6d[_0xb095('0x37')]:_0x14760d['model'];if(_0x2a06f5[_0xb095('0x36')][_0xb095('0x3b')]){_0x4d5a6d[_0xb095('0x3c')]=[{'all':!![]}];}_0x4d5a6d=_['merge']({},_0x4d5a6d,_0x2a06f5['options']);return db[_0xb095('0x34')][_0xb095('0x3d')](_0x4d5a6d)[_0xb095('0x2c')](handleEntityNotFound(_0xafd194,null))[_0xb095('0x2c')](respondWithResult(_0xafd194,null))['catch'](handleError(_0xafd194,null));};exports['destroy']=function(_0x2e6214,_0x574994){return db[_0xb095('0x34')][_0xb095('0x3d')]({'where':{'id':_0x2e6214['params']['id']}})[_0xb095('0x2c')](handleEntityNotFound(_0x574994,null))[_0xb095('0x2c')](removeEntity(_0x574994,null))[_0xb095('0x3e')](handleError(_0x574994,null));};function widgetAttributes(_0x5d6bfa){try{switch(_0x5d6bfa[_0xb095('0x3f')]){case _0xb095('0x40'):return[{'name':'attrUrl','value':_0x5d6bfa[_0xb095('0x41')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||_0xb095('0x44')}];case _0xb095('0x45'):return[{'name':_0xb095('0x46'),'value':_0x5d6bfa['attrPath']||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||''}];case _0xb095('0x47'):return[{'name':_0xb095('0x48'),'value':_0x5d6bfa[_0xb095('0x48')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||_0xb095('0x49')},{'name':_0xb095('0x4a'),'value':_0x5d6bfa[_0xb095('0x4a')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa['attrs'][0x1]?_0x5d6bfa['attrs'][0x1][_0xb095('0x43')]:undefined)||_0xb095('0x4b')},{'name':'attrFontSize','value':_0x5d6bfa[_0xb095('0x4c')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x2]?_0x5d6bfa[_0xb095('0x42')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xb095('0x4d'),'value':_0x5d6bfa[_0xb095('0x4d')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa['attrs'][0x0]?_0x5d6bfa['attrs'][0x0]['value']:undefined)||_0xb095('0x4e')},{'name':'attrVoiceQueues','value':_0x5d6bfa[_0xb095('0x4f')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x1]?_0x5d6bfa['attrs'][0x1][_0xb095('0x43')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d6bfa['attrFontSize']||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x2]?_0x5d6bfa['attrs'][0x2][_0xb095('0x43')]:undefined)||0x14},{'name':'attrChannel','value':_0x5d6bfa[_0xb095('0x50')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x3]?_0x5d6bfa[_0xb095('0x42')][0x3][_0xb095('0x43')]:undefined)||'voice'},{'name':_0xb095('0x51'),'value':_0x5d6bfa[_0xb095('0x51')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x4]?_0x5d6bfa[_0xb095('0x42')][0x4]['value']:undefined)||''},{'name':_0xb095('0x52'),'value':_0x5d6bfa[_0xb095('0x52')]||(_0x5d6bfa['attrs']&&_0x5d6bfa['attrs'][0x5]?_0x5d6bfa[_0xb095('0x42')][0x5]['value']:undefined)||''},{'name':_0xb095('0x53'),'value':_0x5d6bfa[_0xb095('0x53')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x6]?_0x5d6bfa[_0xb095('0x42')][0x6][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x54'),'value':_0x5d6bfa[_0xb095('0x54')]||(_0x5d6bfa['attrs']&&_0x5d6bfa['attrs'][0x7]?_0x5d6bfa[_0xb095('0x42')][0x7][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x55'),'value':_0x5d6bfa['attrWhatsappAccounts']||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x8]?_0x5d6bfa[_0xb095('0x42')][0x8][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x56'),'value':_0x5d6bfa[_0xb095('0x56')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa['attrs'][0x9]?_0x5d6bfa[_0xb095('0x42')][0x9][_0xb095('0x43')]:undefined)||''}];case _0xb095('0x57'):case _0xb095('0x58'):return[{'name':_0xb095('0x59'),'value':_0x5d6bfa['attrSerie1']||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0][_0xb095('0x43')]:undefined)||_0xb095('0x4e')},{'name':_0xb095('0x5a'),'value':_0x5d6bfa[_0xb095('0x5a')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x1]?_0x5d6bfa[_0xb095('0x42')][0x1][_0xb095('0x43')]:undefined)||null},{'name':_0xb095('0x5b'),'value':_0x5d6bfa[_0xb095('0x5b')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x2]?_0x5d6bfa[_0xb095('0x42')][0x2]['value']:undefined)||null},{'name':_0xb095('0x4f'),'value':_0x5d6bfa[_0xb095('0x4f')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x3]?_0x5d6bfa['attrs'][0x3][_0xb095('0x43')]:undefined)||[]},{'name':_0xb095('0x50'),'value':_0x5d6bfa[_0xb095('0x50')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x4]?_0x5d6bfa[_0xb095('0x42')][0x4][_0xb095('0x43')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5d6bfa[_0xb095('0x51')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x5]?_0x5d6bfa['attrs'][0x5][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x52'),'value':_0x5d6bfa[_0xb095('0x52')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x6]?_0x5d6bfa[_0xb095('0x42')][0x6][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x53'),'value':_0x5d6bfa['attrSmsAccounts']||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x7]?_0x5d6bfa['attrs'][0x7][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x54'),'value':_0x5d6bfa[_0xb095('0x54')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x8]?_0x5d6bfa['attrs'][0x8][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x55'),'value':_0x5d6bfa[_0xb095('0x55')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x9]?_0x5d6bfa['attrs'][0x9][_0xb095('0x43')]:undefined)||''},{'name':_0xb095('0x56'),'value':_0x5d6bfa[_0xb095('0x56')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0xa]?_0x5d6bfa[_0xb095('0x42')][0xa]['value']:undefined)||''}];case _0xb095('0x5c'):return[{'name':_0xb095('0x5d'),'type':_0x5d6bfa[_0xb095('0x5e')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0]['type']:undefined)||null,'value':_0x5d6bfa[_0xb095('0x5d')]||(_0x5d6bfa['attrs']&&_0x5d6bfa[_0xb095('0x42')][0x0]?_0x5d6bfa[_0xb095('0x42')][0x0]['value']:undefined)||null},{'name':_0xb095('0x5f'),'value':_0x5d6bfa[_0xb095('0x5f')]||(_0x5d6bfa[_0xb095('0x42')]&&_0x5d6bfa[_0xb095('0x42')][0x1]?_0x5d6bfa[_0xb095('0x42')][0x1][_0xb095('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x3ba018){logger[_0xb095('0x2d')]('widgetAttributes:\x20%s',JSON[_0xb095('0x60')](_0x3ba018));return[];}}exports[_0xb095('0x61')]=function(_0x7a67f3,_0x39e26b){if(_0x7a67f3['body']){_0x7a67f3['body']['attrs']=widgetAttributes(_0x7a67f3[_0xb095('0x62')]);}return db['DashboardItem']['create'](_0x7a67f3[_0xb095('0x62')],{})['then'](respondWithResult(_0x39e26b,0xc9))[_0xb095('0x3e')](handleError(_0x39e26b,null));};exports[_0xb095('0x2a')]=function(_0x2c81b4,_0x43dbbe){if(_0x2c81b4[_0xb095('0x62')]['id']){delete _0x2c81b4[_0xb095('0x62')]['id'];}_0x2c81b4['body'][_0xb095('0x42')]=widgetAttributes(_0x2c81b4['body']);return db['DashboardItem'][_0xb095('0x3d')]({'where':{'id':_0x2c81b4['params']['id']}})[_0xb095('0x2c')](handleEntityNotFound(_0x43dbbe,null))[_0xb095('0x2c')](saveUpdates(_0x2c81b4['body'],null))[_0xb095('0x2c')](respondWithResult(_0x43dbbe,null))[_0xb095('0x3e')](handleError(_0x43dbbe,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6b2e4c4..17e6834 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 _0xbca0=['../../mysqldb','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3a1961,_0x49061f){var _0xd2cfd0=function(_0x2a8711){while(--_0x2a8711){_0x3a1961['push'](_0x3a1961['shift']());}};_0xd2cfd0(++_0x49061f);}(_0xbca0,0x8b));var _0x0bca=function(_0x3aa560,_0x4a0351){_0x3aa560=_0x3aa560-0x0;var _0x4530e2=_0xbca0[_0x3aa560];return _0x4530e2;};'use strict';var EventEmitter=require(_0x0bca('0x0'));var DashboardItem=require(_0x0bca('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0bca('0x2'),'afterDestroy':_0x0bca('0x3')};function emitEvent(_0x3ce28e){return function(_0x1a6cb5,_0x595711,_0x494f51){DashboardItemEvents[_0x0bca('0x4')](_0x3ce28e+':'+_0x1a6cb5['id'],_0x1a6cb5);DashboardItemEvents[_0x0bca('0x4')](_0x3ce28e,_0x1a6cb5);_0x494f51(null);};}for(var e in events){if(events[_0x0bca('0x5')](e)){var event=events[e];DashboardItem[_0x0bca('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x0037=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x15fa0c,_0x21eb62){var _0x3642d1=function(_0x3d8d8e){while(--_0x3d8d8e){_0x15fa0c['push'](_0x15fa0c['shift']());}};_0x3642d1(++_0x21eb62);}(_0x0037,0x127));var _0x7003=function(_0x2dca92,_0x352d9c){_0x2dca92=_0x2dca92-0x0;var _0x2503ab=_0x0037[_0x2dca92];return _0x2503ab;};'use strict';var EventEmitter=require(_0x7003('0x0'));var DashboardItem=require(_0x7003('0x1'))['db'][_0x7003('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7003('0x3')](0x0);var events={'afterCreate':_0x7003('0x4'),'afterUpdate':_0x7003('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5384a6){return function(_0x402081,_0x44f911,_0x35a820){DashboardItemEvents[_0x7003('0x6')](_0x5384a6+':'+_0x402081['id'],_0x402081);DashboardItemEvents[_0x7003('0x6')](_0x5384a6,_0x402081);_0x35a820(null);};}for(var e in events){if(events[_0x7003('0x7')](e)){var event=events[e];DashboardItem[_0x7003('0x8')](e,emitEvent(event));}}module[_0x7003('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index af97b06..709bf26 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 _0xf429=['define','DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x2b05c6,_0x3de96e){var _0x136811=function(_0x441478){while(--_0x441478){_0x2b05c6['push'](_0x2b05c6['shift']());}};_0x136811(++_0x3de96e);}(_0xf429,0xd4));var _0x9f42=function(_0x1a1460,_0x539531){_0x1a1460=_0x1a1460-0x0;var _0x33ab03=_0xf429[_0x1a1460];return _0x33ab03;};'use strict';var _=require('lodash');var util=require(_0x9f42('0x0'));var logger=require(_0x9f42('0x1'))(_0x9f42('0x2'));var moment=require('moment');var BPromise=require(_0x9f42('0x3'));var rp=require(_0x9f42('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f42('0x5'));var config=require(_0x9f42('0x6'));var attributes=require(_0x9f42('0x7'));module['exports']=function(_0x4d3ea7,_0x874a2b){return _0x4d3ea7[_0x9f42('0x8')](_0x9f42('0x9'),attributes,{'tableName':_0x9f42('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x252b=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x5c9600,_0x710564){var _0x2eec81=function(_0x264230){while(--_0x264230){_0x5c9600['push'](_0x5c9600['shift']());}};_0x2eec81(++_0x710564);}(_0x252b,0x117));var _0xb252=function(_0x27dd27,_0x397f9e){_0x27dd27=_0x27dd27-0x0;var _0x116fed=_0x252b[_0x27dd27];return _0x116fed;};'use strict';var _=require(_0xb252('0x0'));var util=require(_0xb252('0x1'));var logger=require(_0xb252('0x2'))('api');var moment=require(_0xb252('0x3'));var BPromise=require(_0xb252('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb252('0x5'));var rimraf=require(_0xb252('0x6'));var config=require(_0xb252('0x7'));var attributes=require(_0xb252('0x8'));module['exports']=function(_0x5e1afb,_0x292101){return _0x5e1afb[_0xb252('0x9')](_0xb252('0xa'),attributes,{'tableName':_0xb252('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 2db7b01..d7a3f81 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 _0x6218=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6218,0xcb));var _0x8621=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x6218[_0x44c844];return _0x1d51b7;};'use strict';var _=require('lodash');var util=require(_0x8621('0x0'));var moment=require(_0x8621('0x1'));var BPromise=require('bluebird');var rs=require(_0x8621('0x2'));var fs=require('fs');var Redis=require(_0x8621('0x3'));var db=require(_0x8621('0x4'))['db'];var utils=require(_0x8621('0x5'));var logger=require(_0x8621('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8621('0x7'));var client=jayson[_0x8621('0x8')]['http']({'port':0x232a});config['redis']=_[_0x8621('0x9')](config['redis'],{'host':_0x8621('0xa'),'port':0x18eb});var socket=require(_0x8621('0xb'))(new Redis(config[_0x8621('0xc')]));require(_0x8621('0xd'))[_0x8621('0xe')](socket);function respondWithRpcPromise(_0x2e2a23,_0x1314f4,_0x44fa17){return new BPromise(function(_0x2bd6e3,_0x2e8cda){return client[_0x8621('0xf')](_0x2e2a23,_0x44fa17)[_0x8621('0x10')](function(_0x9fcd2b){logger[_0x8621('0x11')](_0x8621('0x12'),_0x1314f4,_0x8621('0x13'));logger[_0x8621('0x14')](_0x8621('0x15'),_0x1314f4,'request\x20sent',JSON[_0x8621('0x16')](_0x9fcd2b));if(_0x9fcd2b[_0x8621('0x17')]){if(_0x9fcd2b[_0x8621('0x17')][_0x8621('0x18')]===0x1f4){logger[_0x8621('0x17')](_0x8621('0x12'),_0x1314f4,_0x9fcd2b['error'][_0x8621('0x19')]);return _0x2e8cda(_0x9fcd2b[_0x8621('0x17')][_0x8621('0x19')]);}logger['error'](_0x8621('0x12'),_0x1314f4,_0x9fcd2b[_0x8621('0x17')][_0x8621('0x19')]);return _0x2bd6e3(_0x9fcd2b[_0x8621('0x17')]['message']);}else{logger[_0x8621('0x11')](_0x8621('0x12'),_0x1314f4,_0x8621('0x13'));_0x2bd6e3(_0x9fcd2b[_0x8621('0x1a')][_0x8621('0x19')]);}})[_0x8621('0x1b')](function(_0x5e4736){logger['error'](_0x8621('0x12'),_0x1314f4,_0x5e4736);_0x2e8cda(_0x5e4736);});});} \ No newline at end of file +var _0x466e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x466e,0x121));var _0xe466=function(_0x208e96,_0x3d52c6){_0x208e96=_0x208e96-0x0;var _0x42344f=_0x466e[_0x208e96];return _0x42344f;};'use strict';var _=require(_0xe466('0x0'));var util=require(_0xe466('0x1'));var moment=require(_0xe466('0x2'));var BPromise=require(_0xe466('0x3'));var rs=require(_0xe466('0x4'));var fs=require('fs');var Redis=require(_0xe466('0x5'));var db=require(_0xe466('0x6'))['db'];var utils=require(_0xe466('0x7'));var logger=require(_0xe466('0x8'))(_0xe466('0x9'));var config=require(_0xe466('0xa'));var jayson=require(_0xe466('0xb'));var client=jayson[_0xe466('0xc')][_0xe466('0xd')]({'port':0x232a});config[_0xe466('0xe')]=_[_0xe466('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe466('0x10'))(new Redis(config[_0xe466('0xe')]));require(_0xe466('0x11'))['register'](socket);function respondWithRpcPromise(_0x43f259,_0x28b3c0,_0x305e16){return new BPromise(function(_0x1f031d,_0x1ba537){return client[_0xe466('0x12')](_0x43f259,_0x305e16)['then'](function(_0x521d79){logger[_0xe466('0x13')](_0xe466('0x14'),_0x28b3c0,'request\x20sent');logger[_0xe466('0x15')](_0xe466('0x16'),_0x28b3c0,_0xe466('0x17'),JSON['stringify'](_0x521d79));if(_0x521d79[_0xe466('0x18')]){if(_0x521d79[_0xe466('0x18')][_0xe466('0x19')]===0x1f4){logger[_0xe466('0x18')](_0xe466('0x14'),_0x28b3c0,_0x521d79[_0xe466('0x18')][_0xe466('0x1a')]);return _0x1ba537(_0x521d79[_0xe466('0x18')][_0xe466('0x1a')]);}logger[_0xe466('0x18')]('DashboardItem,\x20%s,\x20%s',_0x28b3c0,_0x521d79['error'][_0xe466('0x1a')]);return _0x1f031d(_0x521d79[_0xe466('0x18')][_0xe466('0x1a')]);}else{logger[_0xe466('0x13')](_0xe466('0x14'),_0x28b3c0,'request\x20sent');_0x1f031d(_0x521d79[_0xe466('0x1b')][_0xe466('0x1a')]);}})[_0xe466('0x1c')](function(_0x17177e){logger[_0xe466('0x18')](_0xe466('0x14'),_0x28b3c0,_0x17177e);_0x1ba537(_0x17177e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a7c42ad..a6d4643 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 _0xb4e5=['update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xb4e5,0x17d));var _0x5b4e=function(_0x2c4e2c,_0x2e8246){_0x2c4e2c=_0x2c4e2c-0x0;var _0x11b193=_0xb4e5[_0x2c4e2c];return _0x11b193;};'use strict';var DashboardItemEvents=require(_0x5b4e('0x0'));var events=[_0x5b4e('0x1'),_0x5b4e('0x2'),_0x5b4e('0x3')];function createListener(_0x8ab05c,_0x22828f){return function(_0x2c0912){_0x22828f['emit'](_0x8ab05c,_0x2c0912);};}function removeListener(_0x17589,_0x5deb75){return function(){DashboardItemEvents[_0x5b4e('0x4')](_0x17589,_0x5deb75);};}exports[_0x5b4e('0x5')]=function(_0xb2af1e){for(var _0x41fe3a=0x0,_0x20108c=events[_0x5b4e('0x6')];_0x41fe3a<_0x20108c;_0x41fe3a++){var _0x407702=events[_0x41fe3a];var _0x346a99=createListener(_0x5b4e('0x7')+_0x407702,_0xb2af1e);DashboardItemEvents['on'](_0x407702,_0x346a99);}}; \ No newline at end of file +var _0xbfa4=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register'];(function(_0x55ccf1,_0x47e4ef){var _0x5bb102=function(_0x46496a){while(--_0x46496a){_0x55ccf1['push'](_0x55ccf1['shift']());}};_0x5bb102(++_0x47e4ef);}(_0xbfa4,0xa2));var _0x4bfa=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xbfa4[_0x55e08b];return _0xd1a7ff;};'use strict';var DashboardItemEvents=require(_0x4bfa('0x0'));var events=[_0x4bfa('0x1'),_0x4bfa('0x2'),'update'];function createListener(_0x53feb0,_0x581a85){return function(_0x34076a){_0x581a85[_0x4bfa('0x3')](_0x53feb0,_0x34076a);};}function removeListener(_0x39bc15,_0x17dda3){return function(){DashboardItemEvents[_0x4bfa('0x4')](_0x39bc15,_0x17dda3);};}exports[_0x4bfa('0x5')]=function(_0x3de507){for(var _0x57da00=0x0,_0x295f87=events['length'];_0x57da00<_0x295f87;_0x57da00++){var _0xd3aa82=events[_0x57da00];var _0x486585=createListener(_0x4bfa('0x6')+_0xd3aa82,_0x3de507);DashboardItemEvents['on'](_0xd3aa82,_0x486585);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4e6ae19..682d5b0 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 _0x3772=['../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21edfa,_0x309ef2){var _0x286996=function(_0xe77b34){while(--_0xe77b34){_0x21edfa['push'](_0x21edfa['shift']());}};_0x286996(++_0x309ef2);}(_0x3772,0xbd));var _0x2377=function(_0x5d38c4,_0x451a17){_0x5d38c4=_0x5d38c4-0x0;var _0x2558eb=_0x3772[_0x5d38c4];return _0x2558eb;};'use strict';var multer=require(_0x2377('0x0'));var util=require(_0x2377('0x1'));var path=require(_0x2377('0x2'));var timeout=require(_0x2377('0x3'));var express=require(_0x2377('0x4'));var router=express[_0x2377('0x5')]();var fs_extra=require(_0x2377('0x6'));var auth=require(_0x2377('0x7'));var interaction=require(_0x2377('0x8'));var config=require(_0x2377('0x9'));var controller=require(_0x2377('0xa'));router['get'](_0x2377('0xb'),auth[_0x2377('0xc')](),controller['show']);router['post']('/',auth[_0x2377('0xc')](),controller[_0x2377('0xd')]);router[_0x2377('0xe')](_0x2377('0xb'),auth[_0x2377('0xc')](),controller[_0x2377('0xf')]);router[_0x2377('0x10')](_0x2377('0xb'),auth[_0x2377('0xc')](),controller[_0x2377('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5c0a=['isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','show','post'];(function(_0x22f775,_0x4c0e62){var _0x40eb51=function(_0x523ec0){while(--_0x523ec0){_0x22f775['push'](_0x22f775['shift']());}};_0x40eb51(++_0x4c0e62);}(_0x5c0a,0x11f));var _0xa5c0=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0x5c0a[_0x2ee974];return _0x20c5fb;};'use strict';var multer=require(_0xa5c0('0x0'));var util=require(_0xa5c0('0x1'));var path=require(_0xa5c0('0x2'));var timeout=require(_0xa5c0('0x3'));var express=require(_0xa5c0('0x4'));var router=express[_0xa5c0('0x5')]();var fs_extra=require(_0xa5c0('0x6'));var auth=require(_0xa5c0('0x7'));var interaction=require(_0xa5c0('0x8'));var config=require('../../config/environment');var controller=require(_0xa5c0('0x9'));router[_0xa5c0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa5c0('0xb')]);router[_0xa5c0('0xc')]('/',auth[_0xa5c0('0xd')](),controller[_0xa5c0('0xe')]);router[_0xa5c0('0xf')](_0xa5c0('0x10'),auth[_0xa5c0('0xd')](),controller['update']);router[_0xa5c0('0x11')](_0xa5c0('0x10'),auth['isAuthenticated'](),controller[_0xa5c0('0x12')]);module[_0xa5c0('0x13')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 1fa79d5..e5ade4c 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 _0x2f78=['ENUM','first','second','third','sequelize','STRING'];(function(_0x3f20a5,_0x5bbeda){var _0x168ec6=function(_0x2a64f5){while(--_0x2a64f5){_0x3f20a5['push'](_0x3f20a5['shift']());}};_0x168ec6(++_0x5bbeda);}(_0x2f78,0x1ba));var _0x82f7=function(_0x763658,_0x21834c){_0x763658=_0x763658-0x0;var _0x7aece4=_0x2f78[_0x763658];return _0x7aece4;};'use strict';var Sequelize=require(_0x82f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x82f7('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x82f7('0x2')](_0x82f7('0x3'),_0x82f7('0x4'),_0x82f7('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x82f7('0x1')]}}; \ No newline at end of file +var _0xdaaa=['exports','first','second','third','STRING','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdaaa,0xcb));var _0xadaa=function(_0x3c3246,_0x2b3c4c){_0x3c3246=_0x3c3246-0x0;var _0x5436f1=_0xdaaa[_0x3c3246];return _0x5436f1;};'use strict';var Sequelize=require(_0xadaa('0x0'));module[_0xadaa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xadaa('0x2'),_0xadaa('0x3'),_0xadaa('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xadaa('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7b571b0..04f1f5c 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 _0x3f54=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','includeAll','options','create','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5aadaa,_0xbfd961){var _0x546a2f=function(_0x3f0518){while(--_0x3f0518){_0x5aadaa['push'](_0x5aadaa['shift']());}};_0x546a2f(++_0xbfd961);}(_0x3f54,0xe4));var _0x43f5=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x3f54[_0x58eec7];return _0x25c5d3;};'use strict';var emlformat=require(_0x43f5('0x0'));var rimraf=require(_0x43f5('0x1'));var zipdir=require(_0x43f5('0x2'));var jsonpatch=require(_0x43f5('0x3'));var rp=require(_0x43f5('0x4'));var moment=require('moment');var BPromise=require(_0x43f5('0x5'));var Mustache=require('mustache');var util=require(_0x43f5('0x6'));var path=require(_0x43f5('0x7'));var sox=require(_0x43f5('0x8'));var csv=require(_0x43f5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43f5('0xa'));var _=require(_0x43f5('0xb'));var squel=require('squel');var crypto=require(_0x43f5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x43f5('0xd'));var toCsv=require(_0x43f5('0x9'));var querystring=require(_0x43f5('0xe'));var Papa=require(_0x43f5('0xf'));var Redis=require(_0x43f5('0x10'));var authService=require(_0x43f5('0x11'));var qs=require(_0x43f5('0x12'));var as=require(_0x43f5('0x13'));var hardwareService=require(_0x43f5('0x14'));var logger=require(_0x43f5('0x15'))(_0x43f5('0x16'));var utils=require(_0x43f5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x43f5('0x18'));var db=require(_0x43f5('0x19'))['db'];function respondWithStatusCode(_0x3c9e06,_0xfc6d32){_0xfc6d32=_0xfc6d32||0xcc;return function(_0x345441){if(_0x345441){return _0x3c9e06[_0x43f5('0x1a')](_0xfc6d32);}return _0x3c9e06[_0x43f5('0x1b')](_0xfc6d32)[_0x43f5('0x1c')]();};}function respondWithResult(_0x2a2cf9,_0x4dfde7){_0x4dfde7=_0x4dfde7||0xc8;return function(_0x15fd30){if(_0x15fd30){return _0x2a2cf9[_0x43f5('0x1b')](_0x4dfde7)['json'](_0x15fd30);}};}function respondWithFilteredResult(_0x4fa42a,_0x138938){return function(_0x205027){if(_0x205027){var _0xf27d57=typeof _0x138938[_0x43f5('0x1d')]===_0x43f5('0x1e')&&typeof _0x138938[_0x43f5('0x1f')]===_0x43f5('0x1e');var _0x4ab3f3=_0x205027['count'];var _0x48452d=_0xf27d57?0x0:_0x138938[_0x43f5('0x1d')];var _0x38f86c=_0xf27d57?_0x205027[_0x43f5('0x20')]:_0x138938[_0x43f5('0x1d')]+_0x138938[_0x43f5('0x1f')];var _0x282b99;if(_0x38f86c>=_0x4ab3f3){_0x38f86c=_0x4ab3f3;_0x282b99=0xc8;}else{_0x282b99=0xce;}_0x4fa42a[_0x43f5('0x1b')](_0x282b99);return _0x4fa42a[_0x43f5('0x21')](_0x43f5('0x22'),_0x48452d+'-'+_0x38f86c+'/'+_0x4ab3f3)['json'](_0x205027);}return null;};}function patchUpdates(_0x575b39){return function(_0x15514c){try{jsonpatch['apply'](_0x15514c,_0x575b39,!![]);}catch(_0x1a0f8b){return BPromise[_0x43f5('0x23')](_0x1a0f8b);}return _0x15514c[_0x43f5('0x24')]();};}function saveUpdates(_0x18f7f7,_0x445808){return function(_0x378445){if(_0x378445){return _0x378445[_0x43f5('0x25')](_0x18f7f7)[_0x43f5('0x26')](function(_0x138fe7){return _0x138fe7;});}return null;};}function removeEntity(_0x824a6a,_0x17597d){return function(_0x4de839){if(_0x4de839){return _0x4de839['destroy']()[_0x43f5('0x26')](function(){var _0x4baf66=_0x4de839[_0x43f5('0x27')]({'plain':!![]});var _0x3b43ef='Dispositions';return db[_0x43f5('0x28')][_0x43f5('0x29')]({'where':{'type':_0x3b43ef,'resourceId':_0x4baf66['id']}})['then'](function(){return _0x4de839;});})['then'](function(){_0x824a6a[_0x43f5('0x1b')](0xcc)[_0x43f5('0x1c')]();});}};}function handleEntityNotFound(_0xbf947d,_0x499234){return function(_0x167c75){if(!_0x167c75){_0xbf947d[_0x43f5('0x1a')](0x194);}return _0x167c75;};}function handleError(_0x3ee150,_0x7672fa){_0x7672fa=_0x7672fa||0x1f4;return function(_0x5e65d0){logger[_0x43f5('0x2a')](_0x5e65d0[_0x43f5('0x2b')]);if(_0x5e65d0[_0x43f5('0x2c')]){delete _0x5e65d0[_0x43f5('0x2c')];}_0x3ee150['status'](_0x7672fa)[_0x43f5('0x2d')](_0x5e65d0);};}exports[_0x43f5('0x2e')]=function(_0x1acea9,_0x147a09){var _0x847339={},_0x2f9f9f={},_0x2a0df3={'count':0x0,'rows':[]};var _0x1feb4f=_[_0x43f5('0x2f')](db[_0x43f5('0x30')][_0x43f5('0x31')],function(_0x3c6bfb){return{'name':_0x3c6bfb['fieldName'],'type':_0x3c6bfb['type']['key']};});_0x2f9f9f[_0x43f5('0x32')]=_[_0x43f5('0x2f')](_0x1feb4f,_0x43f5('0x2c'));_0x2f9f9f[_0x43f5('0x33')]=_[_0x43f5('0x34')](_0x1acea9['query']);_0x2f9f9f[_0x43f5('0x35')]=_[_0x43f5('0x36')](_0x2f9f9f[_0x43f5('0x32')],_0x2f9f9f['query']);_0x847339['attributes']=_[_0x43f5('0x36')](_0x2f9f9f[_0x43f5('0x32')],qs[_0x43f5('0x37')](_0x1acea9[_0x43f5('0x33')]['fields']));_0x847339['attributes']=_0x847339['attributes'][_0x43f5('0x38')]?_0x847339[_0x43f5('0x39')]:_0x2f9f9f['model'];if(!_0x1acea9[_0x43f5('0x33')][_0x43f5('0x3a')]('nolimit')){_0x847339[_0x43f5('0x1f')]=qs[_0x43f5('0x1f')](_0x1acea9[_0x43f5('0x33')][_0x43f5('0x1f')]);_0x847339[_0x43f5('0x1d')]=qs[_0x43f5('0x1d')](_0x1acea9['query'][_0x43f5('0x1d')]);}_0x847339[_0x43f5('0x3b')]=qs['sort'](_0x1acea9['query'][_0x43f5('0x3c')]);_0x847339[_0x43f5('0x3d')]=qs[_0x43f5('0x35')](_['pick'](_0x1acea9[_0x43f5('0x33')],_0x2f9f9f['filters']),_0x1feb4f);if(_0x1acea9[_0x43f5('0x33')][_0x43f5('0x3e')]){_0x847339[_0x43f5('0x3d')]=_[_0x43f5('0x3f')](_0x847339[_0x43f5('0x3d')],{'$or':_[_0x43f5('0x2f')](_0x1feb4f,function(_0x2fd356){if(_0x2fd356[_0x43f5('0x40')]!==_0x43f5('0x41')){var _0x4ab3fd={};_0x4ab3fd[_0x2fd356[_0x43f5('0x2c')]]={'$like':'%'+_0x1acea9[_0x43f5('0x33')][_0x43f5('0x3e')]+'%'};return _0x4ab3fd;}})});}_0x847339=_[_0x43f5('0x3f')]({},_0x847339,_0x1acea9['options']);var _0x9bb8cb={'where':_0x847339[_0x43f5('0x3d')]};return db['Disposition'][_0x43f5('0x20')](_0x9bb8cb)[_0x43f5('0x26')](function(_0x523d46){_0x2a0df3[_0x43f5('0x20')]=_0x523d46;if(_0x1acea9['query']['includeAll']){_0x847339['include']=[{'all':!![]}];}return db['Disposition'][_0x43f5('0x42')](_0x847339);})[_0x43f5('0x26')](function(_0x3f715d){_0x2a0df3[_0x43f5('0x43')]=_0x3f715d;return _0x2a0df3;})[_0x43f5('0x26')](respondWithFilteredResult(_0x147a09,_0x847339))[_0x43f5('0x44')](handleError(_0x147a09,null));};exports[_0x43f5('0x45')]=function(_0x5173bb,_0x29baaa){var _0x224e65={'raw':!![],'where':{'id':_0x5173bb[_0x43f5('0x46')]['id']}},_0x2d7f6b={};_0x2d7f6b[_0x43f5('0x32')]=_[_0x43f5('0x34')](db[_0x43f5('0x30')][_0x43f5('0x31')]);_0x2d7f6b[_0x43f5('0x33')]=_[_0x43f5('0x34')](_0x5173bb['query']);_0x2d7f6b['filters']=_[_0x43f5('0x36')](_0x2d7f6b[_0x43f5('0x32')],_0x2d7f6b[_0x43f5('0x33')]);_0x224e65[_0x43f5('0x39')]=_[_0x43f5('0x36')](_0x2d7f6b[_0x43f5('0x32')],qs[_0x43f5('0x37')](_0x5173bb[_0x43f5('0x33')][_0x43f5('0x37')]));_0x224e65['attributes']=_0x224e65['attributes'][_0x43f5('0x38')]?_0x224e65['attributes']:_0x2d7f6b[_0x43f5('0x32')];if(_0x5173bb['query'][_0x43f5('0x47')]){_0x224e65['include']=[{'all':!![]}];}_0x224e65=_['merge']({},_0x224e65,_0x5173bb[_0x43f5('0x48')]);return db[_0x43f5('0x30')]['find'](_0x224e65)[_0x43f5('0x26')](handleEntityNotFound(_0x29baaa,null))[_0x43f5('0x26')](respondWithResult(_0x29baaa,null))[_0x43f5('0x44')](handleError(_0x29baaa,null));};exports[_0x43f5('0x49')]=function(_0x5d4cd5,_0xa9362){return db['Disposition']['create'](_0x5d4cd5['body'],{})[_0x43f5('0x26')](function(_0xf80e7d){var _0x58110a=_0x5d4cd5[_0x43f5('0x4a')][_0x43f5('0x27')]({'plain':!![]});if(!_0x58110a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58110a['role']===_0x43f5('0x4a')){var _0x16d4aa=_0xf80e7d[_0x43f5('0x27')]({'plain':!![]});var _0x42c336=_0x43f5('0x4b');return db[_0x43f5('0x4c')]['find']({'where':{'name':_0x42c336,'userProfileId':_0x58110a[_0x43f5('0x4d')]},'raw':!![]})[_0x43f5('0x26')](function(_0x46b22e){if(_0x46b22e&&_0x46b22e[_0x43f5('0x4e')]===0x0){return db[_0x43f5('0x28')][_0x43f5('0x49')]({'name':_0x16d4aa[_0x43f5('0x2c')],'resourceId':_0x16d4aa['id'],'type':_0x46b22e[_0x43f5('0x2c')],'sectionId':_0x46b22e['id']},{})[_0x43f5('0x26')](function(){return _0xf80e7d;});}else{return _0xf80e7d;}})[_0x43f5('0x44')](function(_0x1d2046){logger['error'](_0x43f5('0x4f'),_0x1d2046);throw _0x1d2046;});}return _0xf80e7d;})[_0x43f5('0x26')](respondWithResult(_0xa9362,0xc9))[_0x43f5('0x44')](handleError(_0xa9362,null));};exports['update']=function(_0x419804,_0x59a227){if(_0x419804[_0x43f5('0x50')]['id']){delete _0x419804[_0x43f5('0x50')]['id'];}return db[_0x43f5('0x30')]['find']({'where':{'id':_0x419804['params']['id']}})[_0x43f5('0x26')](handleEntityNotFound(_0x59a227,null))[_0x43f5('0x26')](saveUpdates(_0x419804[_0x43f5('0x50')],null))[_0x43f5('0x26')](respondWithResult(_0x59a227,null))[_0x43f5('0x44')](handleError(_0x59a227,null));};exports[_0x43f5('0x29')]=function(_0x4ecae0,_0xef0981){return db['Disposition'][_0x43f5('0x51')]({'where':{'id':_0x4ecae0['params']['id']}})['then'](handleEntityNotFound(_0xef0981,null))[_0x43f5('0x26')](removeEntity(_0xef0981,null))['catch'](handleError(_0xef0981,null));}; \ No newline at end of file +var _0x2645=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Dispositions','end','error','name','send','map','Disposition','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch'];(function(_0x59458c,_0x4b7a30){var _0x1026fd=function(_0x502e46){while(--_0x502e46){_0x59458c['push'](_0x59458c['shift']());}};_0x1026fd(++_0x4b7a30);}(_0x2645,0xb0));var _0x5264=function(_0x2d932e,_0x52175f){_0x2d932e=_0x2d932e-0x0;var _0x308748=_0x2645[_0x2d932e];return _0x308748;};'use strict';var emlformat=require(_0x5264('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5264('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5264('0x2'));var moment=require(_0x5264('0x3'));var BPromise=require(_0x5264('0x4'));var Mustache=require(_0x5264('0x5'));var util=require(_0x5264('0x6'));var path=require(_0x5264('0x7'));var sox=require(_0x5264('0x8'));var csv=require(_0x5264('0x9'));var ejs=require(_0x5264('0xa'));var fs=require('fs');var fs_extra=require(_0x5264('0xb'));var _=require(_0x5264('0xc'));var squel=require(_0x5264('0xd'));var crypto=require(_0x5264('0xe'));var jsforce=require(_0x5264('0xf'));var deskjs=require(_0x5264('0x10'));var toCsv=require(_0x5264('0x9'));var querystring=require(_0x5264('0x11'));var Papa=require('papaparse');var Redis=require(_0x5264('0x12'));var authService=require(_0x5264('0x13'));var qs=require(_0x5264('0x14'));var as=require(_0x5264('0x15'));var hardwareService=require(_0x5264('0x16'));var logger=require('../../config/logger')(_0x5264('0x17'));var utils=require('../../config/utils');var config=require(_0x5264('0x18'));var licenseUtil=require(_0x5264('0x19'));var db=require(_0x5264('0x1a'))['db'];function respondWithStatusCode(_0x1a8172,_0x1c79ea){_0x1c79ea=_0x1c79ea||0xcc;return function(_0x4c78c2){if(_0x4c78c2){return _0x1a8172[_0x5264('0x1b')](_0x1c79ea);}return _0x1a8172[_0x5264('0x1c')](_0x1c79ea)['end']();};}function respondWithResult(_0x483dce,_0x472b8b){_0x472b8b=_0x472b8b||0xc8;return function(_0x3c6781){if(_0x3c6781){return _0x483dce[_0x5264('0x1c')](_0x472b8b)[_0x5264('0x1d')](_0x3c6781);}};}function respondWithFilteredResult(_0x5e4285,_0x6356d6){return function(_0x5313fc){if(_0x5313fc){var _0x52fee1=typeof _0x6356d6['offset']===_0x5264('0x1e')&&typeof _0x6356d6[_0x5264('0x1f')]==='undefined';var _0x208fb1=_0x5313fc[_0x5264('0x20')];var _0x2a5084=_0x52fee1?0x0:_0x6356d6[_0x5264('0x21')];var _0x2801fd=_0x52fee1?_0x5313fc[_0x5264('0x20')]:_0x6356d6[_0x5264('0x21')]+_0x6356d6[_0x5264('0x1f')];var _0x150efb;if(_0x2801fd>=_0x208fb1){_0x2801fd=_0x208fb1;_0x150efb=0xc8;}else{_0x150efb=0xce;}_0x5e4285[_0x5264('0x1c')](_0x150efb);return _0x5e4285[_0x5264('0x22')](_0x5264('0x23'),_0x2a5084+'-'+_0x2801fd+'/'+_0x208fb1)['json'](_0x5313fc);}return null;};}function patchUpdates(_0x22226d){return function(_0x38ac1a){try{jsonpatch['apply'](_0x38ac1a,_0x22226d,!![]);}catch(_0x2cec5d){return BPromise['reject'](_0x2cec5d);}return _0x38ac1a[_0x5264('0x24')]();};}function saveUpdates(_0x3edd29,_0x41fdbd){return function(_0x372263){if(_0x372263){return _0x372263[_0x5264('0x25')](_0x3edd29)[_0x5264('0x26')](function(_0x3585ff){return _0x3585ff;});}return null;};}function removeEntity(_0x54b4ae,_0x1fbd9a){return function(_0x40e994){if(_0x40e994){return _0x40e994[_0x5264('0x27')]()[_0x5264('0x26')](function(){var _0x3f07d0=_0x40e994[_0x5264('0x28')]({'plain':!![]});var _0x1b1a44=_0x5264('0x29');return db['UserProfileResource'][_0x5264('0x27')]({'where':{'type':_0x1b1a44,'resourceId':_0x3f07d0['id']}})[_0x5264('0x26')](function(){return _0x40e994;});})[_0x5264('0x26')](function(){_0x54b4ae[_0x5264('0x1c')](0xcc)[_0x5264('0x2a')]();});}};}function handleEntityNotFound(_0x2074c8,_0x1cef70){return function(_0x3b3517){if(!_0x3b3517){_0x2074c8[_0x5264('0x1b')](0x194);}return _0x3b3517;};}function handleError(_0xe74305,_0x14d748){_0x14d748=_0x14d748||0x1f4;return function(_0x30e52b){logger[_0x5264('0x2b')](_0x30e52b['stack']);if(_0x30e52b[_0x5264('0x2c')]){delete _0x30e52b[_0x5264('0x2c')];}_0xe74305[_0x5264('0x1c')](_0x14d748)[_0x5264('0x2d')](_0x30e52b);};}exports['index']=function(_0x34a7f1,_0x63514e){var _0x3fcef1={},_0x548c11={},_0x4b00b1={'count':0x0,'rows':[]};var _0x4e05e9=_[_0x5264('0x2e')](db[_0x5264('0x2f')]['rawAttributes'],function(_0x43f112){return{'name':_0x43f112[_0x5264('0x30')],'type':_0x43f112['type'][_0x5264('0x31')]};});_0x548c11[_0x5264('0x32')]=_['map'](_0x4e05e9,_0x5264('0x2c'));_0x548c11['query']=_['keys'](_0x34a7f1[_0x5264('0x33')]);_0x548c11[_0x5264('0x34')]=_[_0x5264('0x35')](_0x548c11['model'],_0x548c11[_0x5264('0x33')]);_0x3fcef1['attributes']=_[_0x5264('0x35')](_0x548c11[_0x5264('0x32')],qs[_0x5264('0x36')](_0x34a7f1[_0x5264('0x33')]['fields']));_0x3fcef1[_0x5264('0x37')]=_0x3fcef1[_0x5264('0x37')][_0x5264('0x38')]?_0x3fcef1['attributes']:_0x548c11['model'];if(!_0x34a7f1['query'][_0x5264('0x39')](_0x5264('0x3a'))){_0x3fcef1['limit']=qs['limit'](_0x34a7f1[_0x5264('0x33')][_0x5264('0x1f')]);_0x3fcef1[_0x5264('0x21')]=qs['offset'](_0x34a7f1[_0x5264('0x33')]['offset']);}_0x3fcef1[_0x5264('0x3b')]=qs[_0x5264('0x3c')](_0x34a7f1[_0x5264('0x33')][_0x5264('0x3c')]);_0x3fcef1['where']=qs[_0x5264('0x34')](_[_0x5264('0x3d')](_0x34a7f1['query'],_0x548c11[_0x5264('0x34')]),_0x4e05e9);if(_0x34a7f1['query'][_0x5264('0x3e')]){_0x3fcef1[_0x5264('0x3f')]=_[_0x5264('0x40')](_0x3fcef1[_0x5264('0x3f')],{'$or':_[_0x5264('0x2e')](_0x4e05e9,function(_0x533bbb){if(_0x533bbb['type']!==_0x5264('0x41')){var _0x3f399a={};_0x3f399a[_0x533bbb['name']]={'$like':'%'+_0x34a7f1['query'][_0x5264('0x3e')]+'%'};return _0x3f399a;}})});}_0x3fcef1=_[_0x5264('0x40')]({},_0x3fcef1,_0x34a7f1[_0x5264('0x42')]);var _0x19e789={'where':_0x3fcef1[_0x5264('0x3f')]};return db[_0x5264('0x2f')][_0x5264('0x20')](_0x19e789)[_0x5264('0x26')](function(_0x529ca5){_0x4b00b1[_0x5264('0x20')]=_0x529ca5;if(_0x34a7f1['query'][_0x5264('0x43')]){_0x3fcef1[_0x5264('0x44')]=[{'all':!![]}];}return db[_0x5264('0x2f')]['findAll'](_0x3fcef1);})['then'](function(_0x5180b3){_0x4b00b1[_0x5264('0x45')]=_0x5180b3;return _0x4b00b1;})[_0x5264('0x26')](respondWithFilteredResult(_0x63514e,_0x3fcef1))['catch'](handleError(_0x63514e,null));};exports[_0x5264('0x46')]=function(_0x282b20,_0x41f2e1){var _0x164b16={'raw':!![],'where':{'id':_0x282b20[_0x5264('0x47')]['id']}},_0x2000a7={};_0x2000a7[_0x5264('0x32')]=_['keys'](db[_0x5264('0x2f')]['rawAttributes']);_0x2000a7[_0x5264('0x33')]=_['keys'](_0x282b20['query']);_0x2000a7['filters']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],_0x2000a7[_0x5264('0x33')]);_0x164b16['attributes']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],qs[_0x5264('0x36')](_0x282b20[_0x5264('0x33')]['fields']));_0x164b16[_0x5264('0x37')]=_0x164b16[_0x5264('0x37')][_0x5264('0x38')]?_0x164b16['attributes']:_0x2000a7[_0x5264('0x32')];if(_0x282b20[_0x5264('0x33')]['includeAll']){_0x164b16[_0x5264('0x44')]=[{'all':!![]}];}_0x164b16=_[_0x5264('0x40')]({},_0x164b16,_0x282b20[_0x5264('0x42')]);return db['Disposition']['find'](_0x164b16)['then'](handleEntityNotFound(_0x41f2e1,null))[_0x5264('0x26')](respondWithResult(_0x41f2e1,null))[_0x5264('0x48')](handleError(_0x41f2e1,null));};exports[_0x5264('0x49')]=function(_0x5259a5,_0x1f9602){return db['Disposition'][_0x5264('0x49')](_0x5259a5[_0x5264('0x4a')],{})[_0x5264('0x26')](function(_0x4e3236){var _0x1f862f=_0x5259a5[_0x5264('0x4b')][_0x5264('0x28')]({'plain':!![]});if(!_0x1f862f)throw new Error(_0x5264('0x4c'));if(_0x1f862f[_0x5264('0x4d')]==='user'){var _0x1b659a=_0x4e3236['get']({'plain':!![]});var _0x1c4c2b='Dispositions';return db[_0x5264('0x4e')]['find']({'where':{'name':_0x1c4c2b,'userProfileId':_0x1f862f[_0x5264('0x4f')]},'raw':!![]})[_0x5264('0x26')](function(_0x51e171){if(_0x51e171&&_0x51e171[_0x5264('0x50')]===0x0){return db[_0x5264('0x51')]['create']({'name':_0x1b659a[_0x5264('0x2c')],'resourceId':_0x1b659a['id'],'type':_0x51e171[_0x5264('0x2c')],'sectionId':_0x51e171['id']},{})[_0x5264('0x26')](function(){return _0x4e3236;});}else{return _0x4e3236;}})[_0x5264('0x48')](function(_0x29172c){logger[_0x5264('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29172c);throw _0x29172c;});}return _0x4e3236;})[_0x5264('0x26')](respondWithResult(_0x1f9602,0xc9))['catch'](handleError(_0x1f9602,null));};exports[_0x5264('0x25')]=function(_0xf9ab47,_0x215858){if(_0xf9ab47['body']['id']){delete _0xf9ab47[_0x5264('0x4a')]['id'];}return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0xf9ab47[_0x5264('0x47')]['id']}})[_0x5264('0x26')](handleEntityNotFound(_0x215858,null))[_0x5264('0x26')](saveUpdates(_0xf9ab47[_0x5264('0x4a')],null))['then'](respondWithResult(_0x215858,null))[_0x5264('0x48')](handleError(_0x215858,null));};exports[_0x5264('0x27')]=function(_0x24b7dd,_0xf70d43){return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0x24b7dd[_0x5264('0x47')]['id']}})['then'](handleEntityNotFound(_0xf70d43,null))[_0x5264('0x26')](removeEntity(_0xf70d43,null))[_0x5264('0x48')](handleError(_0xf70d43,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index edf2fe1..809642b 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 _0xe855=['../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe855,0xb1));var _0x5e85=function(_0x66e8c6,_0x559e25){_0x66e8c6=_0x66e8c6-0x0;var _0x3af129=_0xe855[_0x66e8c6];return _0x3af129;};'use strict';var _=require(_0x5e85('0x0'));var util=require('util');var logger=require(_0x5e85('0x1'))(_0x5e85('0x2'));var moment=require(_0x5e85('0x3'));var BPromise=require(_0x5e85('0x4'));var rp=require(_0x5e85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e85('0x6'));var config=require(_0x5e85('0x7'));var attributes=require(_0x5e85('0x8'));module[_0x5e85('0x9')]=function(_0x3842eb,_0x38bb51){return _0x3842eb[_0x5e85('0xa')](_0x5e85('0xb'),attributes,{'tableName':_0x5e85('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5e85('0xd'),'fields':[_0x5e85('0xe'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x5e85('0xe'),_0x5e85('0xf')]},{'unique':!![],'name':'name_mail','fields':['name',_0x5e85('0x10')]},{'unique':!![],'name':_0x5e85('0x11'),'fields':[_0x5e85('0xe'),_0x5e85('0x12')]},{'unique':!![],'name':_0x5e85('0x13'),'fields':[_0x5e85('0xe'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0x5e85('0x14')]},{'unique':!![],'name':_0x5e85('0x15'),'fields':[_0x5e85('0xe'),_0x5e85('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92dd=['define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x4c0dd,_0x72eeba){var _0x1134a9=function(_0x5ed1ef){while(--_0x5ed1ef){_0x4c0dd['push'](_0x4c0dd['shift']());}};_0x1134a9(++_0x72eeba);}(_0x92dd,0xae));var _0xd92d=function(_0x54182c,_0x380843){_0x54182c=_0x54182c-0x0;var _0x25d0ad=_0x92dd[_0x54182c];return _0x25d0ad;};'use strict';var _=require(_0xd92d('0x0'));var util=require(_0xd92d('0x1'));var logger=require(_0xd92d('0x2'))(_0xd92d('0x3'));var moment=require(_0xd92d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd92d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd92d('0x6'));var config=require(_0xd92d('0x7'));var attributes=require(_0xd92d('0x8'));module[_0xd92d('0x9')]=function(_0x3919e4,_0x23474d){return _0x3919e4[_0xd92d('0xa')](_0xd92d('0xb'),attributes,{'tableName':_0xd92d('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd92d('0xd'),'fields':[_0xd92d('0xe'),_0xd92d('0xf')]},{'unique':!![],'name':_0xd92d('0x10'),'fields':[_0xd92d('0xe'),_0xd92d('0x11')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0xd92d('0x12'),'fields':[_0xd92d('0xe'),_0xd92d('0x13')]},{'unique':!![],'name':_0xd92d('0x14'),'fields':[_0xd92d('0xe'),_0xd92d('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0xd92d('0xe'),_0xd92d('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xd92d('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 578a260..405d360 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(_0x3a9656,_0x42b4aa){var _0x27c468=function(_0x25d1f2){while(--_0x25d1f2){_0x3a9656['push'](_0x3a9656['shift']());}};_0x27c468(++_0x42b4aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x57d8e5,_0x3fa755){var _0x2c478d=function(_0x463b46){while(--_0x463b46){_0x57d8e5['push'](_0x57d8e5['shift']());}};_0x2c478d(++_0x3fa755);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 e59cfae..2983061 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 _0x2683=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x2683,0x78));var _0x3268=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x2683[_0x3c2166];return _0x30ccc3;};'use strict';var multer=require('multer');var util=require(_0x3268('0x0'));var path=require(_0x3268('0x1'));var timeout=require(_0x3268('0x2'));var express=require(_0x3268('0x3'));var router=express[_0x3268('0x4')]();var fs_extra=require(_0x3268('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3268('0x6'));var controller=require(_0x3268('0x7'));router[_0x3268('0x8')]('/',auth[_0x3268('0x9')](),controller[_0x3268('0xa')]);router[_0x3268('0x8')](_0x3268('0xb'),auth[_0x3268('0x9')](),controller['show']);router[_0x3268('0xc')]('/',auth[_0x3268('0x9')](),controller[_0x3268('0xd')]);router['put']('/:id',auth[_0x3268('0x9')](),controller[_0x3268('0xe')]);router[_0x3268('0xf')](_0x3268('0xb'),auth['isAuthenticated'](),controller[_0x3268('0x10')]);module[_0x3268('0x11')]=router; \ No newline at end of file +var _0x7243=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0xd9c529,_0x19f8cc){var _0x146760=function(_0x1aa5e8){while(--_0x1aa5e8){_0xd9c529['push'](_0xd9c529['shift']());}};_0x146760(++_0x19f8cc);}(_0x7243,0xfe));var _0x3724=function(_0x485425,_0xe7d6c){_0x485425=_0x485425-0x0;var _0x434276=_0x7243[_0x485425];return _0x434276;};'use strict';var multer=require(_0x3724('0x0'));var util=require(_0x3724('0x1'));var path=require(_0x3724('0x2'));var timeout=require(_0x3724('0x3'));var express=require(_0x3724('0x4'));var router=express['Router']();var fs_extra=require(_0x3724('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3724('0x6'));var config=require(_0x3724('0x7'));var controller=require(_0x3724('0x8'));router[_0x3724('0x9')]('/',auth[_0x3724('0xa')](),controller[_0x3724('0xb')]);router[_0x3724('0x9')](_0x3724('0xc'),auth[_0x3724('0xa')](),controller[_0x3724('0xd')]);router[_0x3724('0xe')]('/',auth[_0x3724('0xa')](),controller[_0x3724('0xf')]);router[_0x3724('0x10')](_0x3724('0xc'),auth[_0x3724('0xa')](),controller[_0x3724('0x11')]);router[_0x3724('0x12')](_0x3724('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3724('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f94dc00..ced4d31 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 _0x9f5a=['sequelize','exports','STRING','yes','ENUM','2400','7200','9600','12000','14400','4800','INTEGER','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x1560fa,_0x18b163){_0x1560fa=_0x1560fa-0x0;var _0x10b728=_0x9f5a[_0x1560fa];return _0x10b728;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'name':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa9f5('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xa9f5('0x3'),'no'),'defaultValue':_0xa9f5('0x3')},'headerinfo':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xa9f5('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xa9f5('0x4')](_0xa9f5('0x5'),'4800',_0xa9f5('0x6'),_0xa9f5('0x7'),_0xa9f5('0x8'),_0xa9f5('0x9')),'defaultValue':_0xa9f5('0xa')},'maxrate':{'type':Sequelize[_0xa9f5('0x4')](_0xa9f5('0x5'),'4800',_0xa9f5('0x6'),_0xa9f5('0x7'),'12000',_0xa9f5('0x9')),'defaultValue':_0xa9f5('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa9f5('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa9f5('0x4')]('SIP',_0xa9f5('0xc'),_0xa9f5('0xd'),_0xa9f5('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa9f5('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9f5('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9f5('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa9f5('0x10')],'defaultValue':![],'comment':_0xa9f5('0x11'),'set':function(_0x230fc2){if(!_0x230fc2)this[_0xa9f5('0x12')](_0xa9f5('0x13'),null);this[_0xa9f5('0x12')](_0xa9f5('0x14'),_0x230fc2);}}}; \ No newline at end of file +var _0xd046=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','14400','9600','v17,v27,v29','ENUM','SIP','IAX','DADHI','KHOMP'];(function(_0x50c065,_0x54782d){var _0x488307=function(_0x2f525c){while(--_0x2f525c){_0x50c065['push'](_0x50c065['shift']());}};_0x488307(++_0x54782d);}(_0xd046,0x129));var _0x6d04=function(_0x2f6094,_0x2e1b19){_0x2f6094=_0x2f6094-0x0;var _0x16c30c=_0xd046[_0x2f6094];return _0x16c30c;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6d04('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x6d04('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x6d04('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6d04('0x4')},'minrate':{'type':Sequelize['ENUM']('2400',_0x6d04('0x5'),_0x6d04('0x6'),'9600','12000',_0x6d04('0x7')),'defaultValue':_0x6d04('0x5')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x6d04('0x5'),'7200',_0x6d04('0x8'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x6d04('0x1')],'defaultValue':_0x6d04('0x9')},'gateway':{'type':Sequelize[_0x6d04('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6d04('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6d04('0xa')](_0x6d04('0xb'),_0x6d04('0xc'),_0x6d04('0xd'),_0x6d04('0xe')),'defaultValue':_0x6d04('0xb')},'key':{'type':Sequelize[_0x6d04('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6d04('0xf')],'defaultValue':function(){return _0x6d04('0x10');}},'notificationSound':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d04('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d04('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x6d04('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x6d04('0x11')],'defaultValue':![],'comment':_0x6d04('0x14'),'set':function(_0x41dc21){if(!_0x41dc21)this[_0x6d04('0x15')](_0x6d04('0x16'),null);this['setDataValue'](_0x6d04('0x17'),_0x41dc21);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 0175f27..ad0fc36 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 _0x113f=['Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','map','type','merge','options','includeAll','include','rows','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','autoAssociation','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','order','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Owner','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x113f,0x102));var _0xf113=function(_0xf39e84,_0x825c93){_0xf39e84=_0xf39e84-0x0;var _0x58e41f=_0x113f[_0xf39e84];return _0x58e41f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf113('0x0'));var zipdir=require(_0xf113('0x1'));var jsonpatch=require(_0xf113('0x2'));var rp=require(_0xf113('0x3'));var moment=require(_0xf113('0x4'));var BPromise=require(_0xf113('0x5'));var Mustache=require(_0xf113('0x6'));var util=require(_0xf113('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('fs-extra');var _=require(_0xf113('0x8'));var squel=require(_0xf113('0x9'));var crypto=require(_0xf113('0xa'));var jsforce=require(_0xf113('0xb'));var deskjs=require(_0xf113('0xc'));var toCsv=require(_0xf113('0xd'));var querystring=require(_0xf113('0xe'));var Papa=require(_0xf113('0xf'));var Redis=require(_0xf113('0x10'));var authService=require(_0xf113('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf113('0x12'));var hardwareService=require(_0xf113('0x13'));var logger=require(_0xf113('0x14'))(_0xf113('0x15'));var utils=require(_0xf113('0x16'));var config=require(_0xf113('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf113('0x18')]=_[_0xf113('0x19')](config[_0xf113('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf113('0x1a'))(new Redis(config[_0xf113('0x18')]));require(_0xf113('0x1b'))[_0xf113('0x1c')](socket);var jayson=require(_0xf113('0x1d'));var client=jayson['client'][_0xf113('0x1e')]({'port':0x232c});var client9002=jayson[_0xf113('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14075d,_0x5de3a2,_0x1e41cd,_0x112ea5){return new BPromise(function(_0x378440,_0x229e7d){var _0x243248=_0x112ea5||client;return _0x243248[_0xf113('0x20')](_0x14075d,_0x1e41cd)[_0xf113('0x21')](function(_0xddab09){logger[_0xf113('0x22')](_0xf113('0x23'),_0x5de3a2,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5de3a2,_0xf113('0x24'),JSON[_0xf113('0x25')](_0xddab09));if(_0xddab09[_0xf113('0x26')]){if(_0xddab09[_0xf113('0x26')][_0xf113('0x27')]===0x1f4){logger['error'](_0xf113('0x23'),_0x5de3a2,_0xddab09['error'][_0xf113('0x28')]);return _0x229e7d(_0xddab09['error']['message']);}logger[_0xf113('0x26')]('FaxAccount,\x20%s,\x20%s',_0x5de3a2,_0xddab09['error'][_0xf113('0x28')]);return _0x378440(_0xddab09[_0xf113('0x26')][_0xf113('0x28')]);}else{logger[_0xf113('0x22')](_0xf113('0x23'),_0x5de3a2,_0xf113('0x24'));_0x378440(_0xddab09[_0xf113('0x29')][_0xf113('0x28')]);}})[_0xf113('0x2a')](function(_0x448742){logger[_0xf113('0x26')]('FaxAccount,\x20%s,\x20%s',_0x5de3a2,_0x448742);_0x229e7d(_0x448742);});});}function respondWithStatusCode(_0xaed233,_0x236273){_0x236273=_0x236273||0xcc;return function(_0x2f9c5c){if(_0x2f9c5c){return _0xaed233[_0xf113('0x2b')](_0x236273);}return _0xaed233[_0xf113('0x2c')](_0x236273)['end']();};}function respondWithResult(_0x32f8db,_0x2d150d){_0x2d150d=_0x2d150d||0xc8;return function(_0x566a6e){if(_0x566a6e){return _0x32f8db['status'](_0x2d150d)[_0xf113('0x2d')](_0x566a6e);}};}function respondWithFilteredResult(_0x2a7a33,_0x1421e7){return function(_0x47ba5f){if(_0x47ba5f){var _0x2b36c5=typeof _0x1421e7[_0xf113('0x2e')]===_0xf113('0x2f')&&typeof _0x1421e7[_0xf113('0x30')]===_0xf113('0x2f');var _0x2d9700=_0x47ba5f['count'];var _0x25950e=_0x2b36c5?0x0:_0x1421e7[_0xf113('0x2e')];var _0x5d876e=_0x2b36c5?_0x47ba5f[_0xf113('0x31')]:_0x1421e7[_0xf113('0x2e')]+_0x1421e7[_0xf113('0x30')];var _0x43bd6e;if(_0x5d876e>=_0x2d9700){_0x5d876e=_0x2d9700;_0x43bd6e=0xc8;}else{_0x43bd6e=0xce;}_0x2a7a33[_0xf113('0x2c')](_0x43bd6e);return _0x2a7a33[_0xf113('0x32')]('Content-Range',_0x25950e+'-'+_0x5d876e+'/'+_0x2d9700)[_0xf113('0x2d')](_0x47ba5f);}return null;};}function patchUpdates(_0x21f9e3){return function(_0x31a75c){try{jsonpatch[_0xf113('0x33')](_0x31a75c,_0x21f9e3,!![]);}catch(_0x4a3129){return BPromise['reject'](_0x4a3129);}return _0x31a75c[_0xf113('0x34')]();};}function saveUpdates(_0x2c9ac7,_0x1d9f20){return function(_0x3f542b){if(_0x3f542b){return _0x3f542b['update'](_0x2c9ac7)['then'](function(_0x2213a1){return _0x2213a1;});}return null;};}function removeEntity(_0x58f217,_0x3f5270){return function(_0x5f28a5){if(_0x5f28a5){return _0x5f28a5['destroy']()[_0xf113('0x21')](function(){var _0x988914=_0x5f28a5['get']({'plain':!![]});var _0x465397='FaxAccounts';return db[_0xf113('0x35')][_0xf113('0x36')]({'where':{'type':_0x465397,'resourceId':_0x988914['id']}})['then'](function(){return _0x5f28a5;});})['then'](function(){_0x58f217['status'](0xcc)[_0xf113('0x37')]();});}};}function handleEntityNotFound(_0x55ce47,_0x3ab51c){return function(_0x12e2e5){if(!_0x12e2e5){_0x55ce47[_0xf113('0x2b')](0x194);}return _0x12e2e5;};}function handleError(_0x5b6517,_0xbc175){_0xbc175=_0xbc175||0x1f4;return function(_0x3b19ff){logger[_0xf113('0x26')](_0x3b19ff[_0xf113('0x38')]);if(_0x3b19ff[_0xf113('0x39')]){delete _0x3b19ff[_0xf113('0x39')];}_0x5b6517[_0xf113('0x2c')](_0xbc175)[_0xf113('0x3a')](_0x3b19ff);};}exports[_0xf113('0x3b')]=function(_0x109c9d,_0x57e8f6){var _0x4bc753={'include':[{'model':db[_0xf113('0x3c')],'as':_0xf113('0x3d')}]},_0x35859a={},_0x2fdf95={'count':0x0,'rows':[]};var _0x80a58f=_['map'](db[_0xf113('0x3e')][_0xf113('0x3f')],function(_0x2c13d1){return{'name':_0x2c13d1['fieldName'],'type':_0x2c13d1['type'][_0xf113('0x40')]};});_0x35859a['model']=_['map'](_0x80a58f,_0xf113('0x39'));_0x35859a[_0xf113('0x41')]=_[_0xf113('0x42')](_0x109c9d['query']);_0x35859a[_0xf113('0x43')]=_[_0xf113('0x44')](_0x35859a[_0xf113('0x45')],_0x35859a[_0xf113('0x41')]);_0x4bc753[_0xf113('0x46')]=_['intersection'](_0x35859a[_0xf113('0x45')],qs[_0xf113('0x47')](_0x109c9d[_0xf113('0x41')][_0xf113('0x47')]));_0x4bc753[_0xf113('0x46')]=_0x4bc753[_0xf113('0x46')][_0xf113('0x48')]?_0x4bc753['attributes']:_0x35859a['model'];if(!_0x109c9d[_0xf113('0x41')]['hasOwnProperty'](_0xf113('0x49'))){_0x4bc753[_0xf113('0x30')]=qs[_0xf113('0x30')](_0x109c9d[_0xf113('0x41')][_0xf113('0x30')]);_0x4bc753['offset']=qs['offset'](_0x109c9d[_0xf113('0x41')][_0xf113('0x2e')]);}_0x4bc753['order']=qs[_0xf113('0x4a')](_0x109c9d[_0xf113('0x41')]['sort']);_0x4bc753[_0xf113('0x4b')]=qs[_0xf113('0x43')](_[_0xf113('0x4c')](_0x109c9d[_0xf113('0x41')],_0x35859a[_0xf113('0x43')]),_0x80a58f);if(_0x109c9d[_0xf113('0x41')][_0xf113('0x4d')]){_0x4bc753['where']=_['merge'](_0x4bc753['where'],{'$or':_[_0xf113('0x4e')](_0x80a58f,function(_0x1c3bde){if(_0x1c3bde[_0xf113('0x4f')]!=='VIRTUAL'){var _0x10bf0a={};_0x10bf0a[_0x1c3bde[_0xf113('0x39')]]={'$like':'%'+_0x109c9d[_0xf113('0x41')][_0xf113('0x4d')]+'%'};return _0x10bf0a;}})});}_0x4bc753=_[_0xf113('0x50')]({},_0x4bc753,_0x109c9d[_0xf113('0x51')]);var _0x5cc396={'where':_0x4bc753[_0xf113('0x4b')]};return db[_0xf113('0x3e')][_0xf113('0x31')](_0x5cc396)[_0xf113('0x21')](function(_0x253b38){_0x2fdf95['count']=_0x253b38;if(_0x109c9d[_0xf113('0x41')][_0xf113('0x52')]){_0x4bc753[_0xf113('0x53')]=[{'all':!![]}];}return db[_0xf113('0x3e')]['findAll'](_0x4bc753);})[_0xf113('0x21')](function(_0x1dc67e){_0x2fdf95[_0xf113('0x54')]=_0x1dc67e;return _0x2fdf95;})[_0xf113('0x21')](respondWithFilteredResult(_0x57e8f6,_0x4bc753))[_0xf113('0x2a')](handleError(_0x57e8f6,null));};exports[_0xf113('0x55')]=function(_0x2fb503,_0x131f4b){var _0xbb4244={'raw':![],'where':{'id':_0x2fb503[_0xf113('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1f6a29={};_0x1f6a29[_0xf113('0x45')]=_[_0xf113('0x42')](db['FaxAccount'][_0xf113('0x3f')]);_0x1f6a29[_0xf113('0x41')]=_[_0xf113('0x42')](_0x2fb503[_0xf113('0x41')]);_0x1f6a29[_0xf113('0x43')]=_[_0xf113('0x44')](_0x1f6a29[_0xf113('0x45')],_0x1f6a29['query']);_0xbb4244[_0xf113('0x46')]=_[_0xf113('0x44')](_0x1f6a29['model'],qs[_0xf113('0x47')](_0x2fb503[_0xf113('0x41')]['fields']));_0xbb4244['attributes']=_0xbb4244['attributes'][_0xf113('0x48')]?_0xbb4244[_0xf113('0x46')]:_0x1f6a29[_0xf113('0x45')];if(_0x2fb503[_0xf113('0x41')][_0xf113('0x52')]){_0xbb4244[_0xf113('0x53')]=[{'all':!![]}];}_0xbb4244=_[_0xf113('0x50')]({},_0xbb4244,_0x2fb503[_0xf113('0x51')]);return db[_0xf113('0x3e')][_0xf113('0x57')](_0xbb4244)[_0xf113('0x21')](handleEntityNotFound(_0x131f4b,null))[_0xf113('0x21')](respondWithResult(_0x131f4b,null))[_0xf113('0x2a')](handleError(_0x131f4b,null));};exports[_0xf113('0x58')]=function(_0x371ea8,_0x78b9bf){return db[_0xf113('0x3e')][_0xf113('0x58')](_0x371ea8[_0xf113('0x59')],{})['then'](function(_0x358ff4){var _0x533bd9=_0x371ea8['user'][_0xf113('0x5a')]({'plain':!![]});if(!_0x533bd9)throw new Error(_0xf113('0x5b'));if(_0x533bd9[_0xf113('0x5c')]===_0xf113('0x5d')){var _0x88bcad=_0x358ff4['get']({'plain':!![]});var _0x10e749=_0xf113('0x5e');return db[_0xf113('0x5f')][_0xf113('0x57')]({'where':{'name':_0x10e749,'userProfileId':_0x533bd9['userProfileId']},'raw':!![]})[_0xf113('0x21')](function(_0x55292a){if(_0x55292a&&_0x55292a[_0xf113('0x60')]===0x0){return db[_0xf113('0x35')][_0xf113('0x58')]({'name':_0x88bcad['name'],'resourceId':_0x88bcad['id'],'type':_0x55292a[_0xf113('0x39')],'sectionId':_0x55292a['id']},{})['then'](function(){return _0x358ff4;});}else{return _0x358ff4;}})[_0xf113('0x2a')](function(_0x45b26c){logger[_0xf113('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45b26c);throw _0x45b26c;});}return _0x358ff4;})[_0xf113('0x21')](respondWithResult(_0x78b9bf,0xc9))['catch'](handleError(_0x78b9bf,null));};exports[_0xf113('0x61')]=function(_0x5f4050,_0x205bf2){if(_0x5f4050['body']['id']){delete _0x5f4050[_0xf113('0x59')]['id'];}return db[_0xf113('0x3e')][_0xf113('0x57')]({'where':{'id':_0x5f4050[_0xf113('0x56')]['id']},'include':[{'model':db[_0xf113('0x3c')],'as':_0xf113('0x3d')}]})['then'](handleEntityNotFound(_0x205bf2,null))[_0xf113('0x21')](saveUpdates(_0x5f4050[_0xf113('0x59')],null))['then'](respondWithResult(_0x205bf2,null))[_0xf113('0x2a')](handleError(_0x205bf2,null));};exports[_0xf113('0x36')]=function(_0xcd5aa2,_0x266ac7){return db[_0xf113('0x3e')][_0xf113('0x57')]({'where':{'id':_0xcd5aa2['params']['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x266ac7,null))[_0xf113('0x21')](removeEntity(_0x266ac7,null))[_0xf113('0x2a')](handleError(_0x266ac7,null));};exports[_0xf113('0x62')]=function(_0x2dd962,_0x10aa12){return db[_0xf113('0x3e')][_0xf113('0x62')]()[_0xf113('0x21')](respondWithResult(_0x10aa12,null))['catch'](handleError(_0x10aa12,null));};exports[_0xf113('0x63')]=function(_0x445e05,_0x4e7ba1,_0xbfd073){if(_0x445e05[_0xf113('0x59')]['id']){delete _0x445e05[_0xf113('0x59')]['id'];}return db['FaxAccount'][_0xf113('0x57')]({'where':{'id':_0x445e05[_0xf113('0x56')]['id']}})['then'](handleEntityNotFound(_0x4e7ba1,null))[_0xf113('0x21')](function(_0x39c552){if(_0x39c552){_0x445e05[_0xf113('0x59')][_0xf113('0x64')]=_0x39c552['id'];return db[_0xf113('0x65')][_0xf113('0x58')](_0x445e05[_0xf113('0x59')]);}})[_0xf113('0x21')](respondWithResult(_0x4e7ba1,null))[_0xf113('0x2a')](handleError(_0x4e7ba1,null));};exports[_0xf113('0x66')]=function(_0x2d8684,_0xd6f73d,_0x23bf97){var _0x2c6ba5={'raw':![],'where':{}};var _0x1ba631={};var _0x2830ee={'count':0x0,'rows':[]};return db[_0xf113('0x3e')][_0xf113('0x67')]({'where':{'id':_0x2d8684[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0xd6f73d,null))[_0xf113('0x21')](function(_0x5720f2){if(_0x5720f2){_0x1ba631['model']=_[_0xf113('0x42')](db[_0xf113('0x65')]['rawAttributes']);_0x1ba631[_0xf113('0x41')]=_['keys'](_0x2d8684[_0xf113('0x41')]);_0x1ba631['filters']=_[_0xf113('0x44')](_0x1ba631[_0xf113('0x45')],_0x1ba631[_0xf113('0x41')]);_0x2c6ba5[_0xf113('0x46')]=_[_0xf113('0x44')](_0x1ba631[_0xf113('0x45')],qs[_0xf113('0x47')](_0x2d8684[_0xf113('0x41')][_0xf113('0x47')]));_0x2c6ba5[_0xf113('0x46')]=_0x2c6ba5[_0xf113('0x46')]['length']?_0x2c6ba5['attributes']:_0x1ba631[_0xf113('0x45')];if(!_0x2d8684[_0xf113('0x41')]['hasOwnProperty'](_0xf113('0x49'))){_0x2c6ba5[_0xf113('0x30')]=qs[_0xf113('0x30')](_0x2d8684['query'][_0xf113('0x30')]);_0x2c6ba5[_0xf113('0x2e')]=qs['offset'](_0x2d8684[_0xf113('0x41')]['offset']);}_0x2c6ba5['order']=qs['sort'](_0x2d8684[_0xf113('0x41')][_0xf113('0x4a')]);_0x2c6ba5[_0xf113('0x4b')]=qs[_0xf113('0x43')](_[_0xf113('0x4c')](_0x2d8684['query'],_0x1ba631['filters']));_0x2c6ba5[_0xf113('0x4b')][_0xf113('0x64')]=_0x5720f2['id'];if(_0x2d8684[_0xf113('0x41')][_0xf113('0x4d')]){_0x2c6ba5[_0xf113('0x4b')]=_[_0xf113('0x50')](_0x2c6ba5['where'],{'$or':_[_0xf113('0x4e')](_0x2c6ba5[_0xf113('0x46')],function(_0x409f99){var _0x57caaf={};_0x57caaf[_0x409f99]={'$like':'%'+_0x2d8684[_0xf113('0x41')][_0xf113('0x4d')]+'%'};return _0x57caaf;})});}_0x2c6ba5=_['merge']({},_0x2c6ba5,_0x2d8684[_0xf113('0x51')]);return db[_0xf113('0x65')][_0xf113('0x31')]({'where':_0x2c6ba5[_0xf113('0x4b')]})[_0xf113('0x21')](function(_0x9f37b9){_0x2830ee[_0xf113('0x31')]=_0x9f37b9;if(_0x2d8684[_0xf113('0x41')][_0xf113('0x52')]){_0x2c6ba5[_0xf113('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xf113('0x68')](_0x2c6ba5);})['then'](function(_0x365366){_0x2830ee['rows']=_0x365366;return _0x2830ee;});}})[_0xf113('0x21')](respondWithFilteredResult(_0xd6f73d,_0x2c6ba5))[_0xf113('0x2a')](handleError(_0xd6f73d,null));};exports[_0xf113('0x69')]=function(_0x3a26c7,_0x5b792f,_0x18c442){return db[_0xf113('0x3e')]['find']({'where':{'id':_0x3a26c7[_0xf113('0x56')]['id']}})['then'](handleEntityNotFound(_0x5b792f,null))[_0xf113('0x21')](function(_0x3a098e){if(_0x3a098e){return _0x3a098e[_0xf113('0x69')](_0x3a26c7[_0xf113('0x41')]['ids']);}})[_0xf113('0x21')](respondWithStatusCode(_0x5b792f,null))['catch'](handleError(_0x5b792f,null));};exports[_0xf113('0x6a')]=function(_0x51dbd0,_0x1eda80,_0x1a59c4){if(_0x51dbd0['body']['id']){delete _0x51dbd0[_0xf113('0x59')]['id'];}return db[_0xf113('0x3e')]['find']({'where':{'id':_0x51dbd0[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x1eda80,null))[_0xf113('0x21')](function(_0x14ad45){if(_0x14ad45){_0x51dbd0['body'][_0xf113('0x64')]=_0x14ad45['id'];return db[_0xf113('0x6b')][_0xf113('0x58')](_0x51dbd0[_0xf113('0x59')]);}})[_0xf113('0x21')](respondWithResult(_0x1eda80,null))['catch'](handleError(_0x1eda80,null));};exports[_0xf113('0x6c')]=function(_0xe9f468,_0x5792e1,_0x5570ef){var _0x272762={'raw':![],'where':{}};var _0x145e88={};var _0x246634={'count':0x0,'rows':[]};return db[_0xf113('0x3e')]['findOne']({'where':{'id':_0xe9f468['params']['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x5792e1,null))['then'](function(_0xd29507){if(_0xd29507){_0x145e88['model']=_[_0xf113('0x42')](db[_0xf113('0x6b')]['rawAttributes']);_0x145e88[_0xf113('0x41')]=_[_0xf113('0x42')](_0xe9f468[_0xf113('0x41')]);_0x145e88[_0xf113('0x43')]=_[_0xf113('0x44')](_0x145e88['model'],_0x145e88['query']);_0x272762[_0xf113('0x46')]=_[_0xf113('0x44')](_0x145e88['model'],qs[_0xf113('0x47')](_0xe9f468[_0xf113('0x41')]['fields']));_0x272762[_0xf113('0x46')]=_0x272762[_0xf113('0x46')][_0xf113('0x48')]?_0x272762[_0xf113('0x46')]:_0x145e88[_0xf113('0x45')];if(!_0xe9f468[_0xf113('0x41')][_0xf113('0x6d')](_0xf113('0x49'))){_0x272762[_0xf113('0x30')]=qs['limit'](_0xe9f468[_0xf113('0x41')][_0xf113('0x30')]);_0x272762['offset']=qs[_0xf113('0x2e')](_0xe9f468[_0xf113('0x41')][_0xf113('0x2e')]);}_0x272762[_0xf113('0x6e')]=qs[_0xf113('0x4a')](_0xe9f468[_0xf113('0x41')]['sort']);_0x272762[_0xf113('0x4b')]=qs[_0xf113('0x43')](_[_0xf113('0x4c')](_0xe9f468[_0xf113('0x41')],_0x145e88['filters']));_0x272762[_0xf113('0x4b')][_0xf113('0x64')]=_0xd29507['id'];if(_0xe9f468['query'][_0xf113('0x4d')]){_0x272762['where']=_['merge'](_0x272762[_0xf113('0x4b')],{'$or':_[_0xf113('0x4e')](_0x272762[_0xf113('0x46')],function(_0x27fa4d){var _0x18c5e1={};_0x18c5e1[_0x27fa4d]={'$like':'%'+_0xe9f468[_0xf113('0x41')][_0xf113('0x4d')]+'%'};return _0x18c5e1;})});}_0x272762=_[_0xf113('0x50')]({},_0x272762,_0xe9f468[_0xf113('0x51')]);return db[_0xf113('0x6b')][_0xf113('0x31')]({'where':_0x272762['where']})[_0xf113('0x21')](function(_0x1f27cb){_0x246634[_0xf113('0x31')]=_0x1f27cb;if(_0xe9f468['query'][_0xf113('0x52')]){_0x272762[_0xf113('0x53')]=[{'all':!![]}];}return db[_0xf113('0x6b')][_0xf113('0x68')](_0x272762);})['then'](function(_0x4bcced){_0x246634[_0xf113('0x54')]=_0x4bcced;return _0x246634;});}})[_0xf113('0x21')](respondWithFilteredResult(_0x5792e1,_0x272762))[_0xf113('0x2a')](handleError(_0x5792e1,null));};exports[_0xf113('0x6f')]=function(_0x59fefe,_0x3d5f1e,_0x2ab1fb){return db[_0xf113('0x3e')][_0xf113('0x57')]({'where':{'id':_0x59fefe[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x3d5f1e,null))[_0xf113('0x21')](function(_0x37fd77){if(_0x37fd77){return _0x37fd77[_0xf113('0x6f')](_0x59fefe['query'][_0xf113('0x70')]);}})[_0xf113('0x21')](respondWithStatusCode(_0x3d5f1e,null))[_0xf113('0x2a')](handleError(_0x3d5f1e,null));};exports[_0xf113('0x71')]=function(_0x4f19ff,_0x1ec1de,_0x263cba){return db['FaxInteraction'][_0xf113('0x57')]({'where':{'id':_0x4f19ff['params']['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x1ec1de,null))[_0xf113('0x21')](function(_0x566e24){if(_0x566e24){return _0x566e24['addInteraction'](_0x4f19ff[_0xf113('0x59')][_0xf113('0x70')],_[_0xf113('0x72')](_0x4f19ff[_0xf113('0x59')],[_0xf113('0x70'),'id'])||{});}})[_0xf113('0x21')](respondWithResult(_0x1ec1de,null))[_0xf113('0x2a')](handleError(_0x1ec1de,null));};exports[_0xf113('0x73')]=function(_0x86550f,_0x293403,_0x5570b5){var _0x29b3ad={'raw':![],'where':{}};var _0x1c50de={};var _0x1f5bb0={'count':0x0,'rows':[]};return db[_0xf113('0x3e')][_0xf113('0x67')]({'where':{'id':_0x86550f[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x293403,null))['then'](function(_0x5ec644){if(_0x5ec644){_0x1c50de['model']=_[_0xf113('0x42')](db[_0xf113('0x74')]['rawAttributes']);_0x1c50de[_0xf113('0x41')]=_[_0xf113('0x42')](_0x86550f[_0xf113('0x41')]);_0x1c50de[_0xf113('0x43')]=_[_0xf113('0x44')](_0x1c50de[_0xf113('0x45')],_0x1c50de[_0xf113('0x41')]);_0x29b3ad[_0xf113('0x46')]=_[_0xf113('0x44')](_0x1c50de[_0xf113('0x45')],qs[_0xf113('0x47')](_0x86550f['query'][_0xf113('0x47')]));_0x29b3ad[_0xf113('0x46')]=_0x29b3ad[_0xf113('0x46')]['length']?_0x29b3ad['attributes']:_0x1c50de['model'];if(!_0x86550f[_0xf113('0x41')]['hasOwnProperty']('nolimit')){_0x29b3ad['limit']=qs[_0xf113('0x30')](_0x86550f[_0xf113('0x41')][_0xf113('0x30')]);_0x29b3ad['offset']=qs[_0xf113('0x2e')](_0x86550f['query']['offset']);}_0x29b3ad[_0xf113('0x6e')]=qs[_0xf113('0x4a')](_0x86550f[_0xf113('0x41')][_0xf113('0x4a')]);_0x29b3ad[_0xf113('0x4b')]=qs[_0xf113('0x43')](_[_0xf113('0x4c')](_0x86550f[_0xf113('0x41')],_0x1c50de['filters']));_0x29b3ad['where'][_0xf113('0x64')]=_0x5ec644['id'];if(_0x86550f[_0xf113('0x41')]['filter']){_0x29b3ad[_0xf113('0x4b')]=_[_0xf113('0x50')](_0x29b3ad['where'],{'$or':_[_0xf113('0x4e')](_0x29b3ad[_0xf113('0x46')],function(_0x4d3a21){var _0x27ba1d={};_0x27ba1d[_0x4d3a21]={'$like':'%'+_0x86550f['query'][_0xf113('0x4d')]+'%'};return _0x27ba1d;})});}_0x29b3ad=_[_0xf113('0x50')]({},_0x29b3ad,_0x86550f[_0xf113('0x51')]);return db[_0xf113('0x74')][_0xf113('0x31')]({'where':_0x29b3ad[_0xf113('0x4b')]})[_0xf113('0x21')](function(_0x1d5310){_0x1f5bb0['count']=_0x1d5310;if(_0x86550f[_0xf113('0x41')][_0xf113('0x52')]){_0x29b3ad[_0xf113('0x53')]=[{'model':db[_0xf113('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xf113('0x76'),'attributes':[_0xf113('0x39'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xf113('0x77'),'attributes':['id','name',_0xf113('0x78')],'where':_0x86550f[_0xf113('0x41')][_0xf113('0x79')]?{'id':_0x86550f['query'][_0xf113('0x79')]}:undefined,'required':_0x86550f[_0xf113('0x41')][_0xf113('0x79')]?!![]:![]}];}return db[_0xf113('0x74')][_0xf113('0x68')](_0x29b3ad);})['then'](function(_0x1d74e4){_0x1f5bb0['rows']=_0x1d74e4;return _0x1f5bb0;});}})[_0xf113('0x21')](respondWithFilteredResult(_0x293403,_0x29b3ad))[_0xf113('0x2a')](handleError(_0x293403,null));};exports['addApplications']=function(_0x22ab3b,_0x254f34){var _0x24c455=_0x22ab3b['params']['id'];var _0x20bf87=_0x22ab3b[_0xf113('0x59')];var _0x3174ad=0xc8;var _0x36bf48=null;return db[_0xf113('0x7a')]['transaction']({'isolationLevel':db[_0xf113('0x7a')][_0xf113('0x7b')][_0xf113('0x7c')][_0xf113('0x7d')]},function(_0x233789){return db[_0xf113('0x3e')][_0xf113('0x67')]({'where':{'id':_0x24c455},'transaction':_0x233789})[_0xf113('0x21')](function(_0x36308c){if(_0x36308c){return db[_0xf113('0x7e')][_0xf113('0x36')]({'where':{'FaxAccountId':_0x24c455},'transaction':_0x233789})[_0xf113('0x21')](function(){var _0x3cd3e2=_[_0xf113('0x4e')](_0x20bf87,function(_0x568de3){_0x568de3[_0xf113('0x64')]=_0x24c455;return _0x568de3;});return db['FaxApplication'][_0xf113('0x7f')](_0x3cd3e2,{'transaction':_0x233789});});}else{_0x3174ad=0x194;_0x36bf48=[];}});})['then'](function(){if(_0x3174ad!==0x194){return db['FaxApplication'][_0xf113('0x80')]({'where':{'FaxAccountId':_0x24c455},'order':_0xf113('0x81')})[_0xf113('0x21')](function(_0x5de449){_0x36bf48=_0x5de449;});}})[_0xf113('0x2a')](function(_0x33dce0){_0x3174ad=0x1f4;logger[_0xf113('0x26')](_0x33dce0['stack']);if(_0x33dce0[_0xf113('0x39')]){delete _0x33dce0[_0xf113('0x39')];}_0x36bf48=_0x33dce0;})[_0xf113('0x82')](function(){if(_0x36bf48===null){_0x254f34['sendStatus'](_0x3174ad);}else{if(_0x3174ad===0x1f4){_0x254f34[_0xf113('0x2c')](_0x3174ad)[_0xf113('0x3a')](_0x36bf48);}else{_0x254f34[_0xf113('0x2c')](_0x3174ad)[_0xf113('0x2d')](_0x36bf48);}}});};exports['getApplications']=function(_0x55b0df,_0x5c828e,_0x2dc135){var _0x4c4236={};var _0x1d9a5b={};var _0x4abac4;var _0x55f42c;return db[_0xf113('0x3e')][_0xf113('0x67')]({'where':{'id':_0x55b0df[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x5c828e,null))[_0xf113('0x21')](function(_0x4cc457){if(_0x4cc457){_0x4abac4=_0x4cc457;_0x1d9a5b[_0xf113('0x45')]=_[_0xf113('0x42')](db['FaxApplication'][_0xf113('0x3f')]);_0x1d9a5b[_0xf113('0x41')]=_[_0xf113('0x42')](_0x55b0df[_0xf113('0x41')]);_0x1d9a5b[_0xf113('0x43')]=_[_0xf113('0x44')](_0x1d9a5b[_0xf113('0x45')],_0x1d9a5b[_0xf113('0x41')]);_0x4c4236[_0xf113('0x46')]=_[_0xf113('0x44')](_0x1d9a5b['model'],qs[_0xf113('0x47')](_0x55b0df['query']['fields']));_0x4c4236[_0xf113('0x46')]=_0x4c4236[_0xf113('0x46')][_0xf113('0x48')]?_0x4c4236[_0xf113('0x46')]:_0x1d9a5b['model'];_0x4c4236['order']=qs['sort'](_0x55b0df[_0xf113('0x41')][_0xf113('0x4a')]);_0x4c4236['where']=qs[_0xf113('0x43')](_[_0xf113('0x4c')](_0x55b0df[_0xf113('0x41')],_0x1d9a5b['filters']));if(_0x55b0df[_0xf113('0x41')][_0xf113('0x4d')]){_0x4c4236[_0xf113('0x4b')]=_[_0xf113('0x50')](_0x4c4236[_0xf113('0x4b')],{'$or':_[_0xf113('0x4e')](_0x4c4236[_0xf113('0x46')],function(_0x27d6c7){var _0x23f043={};_0x23f043[_0x27d6c7]={'$like':'%'+_0x55b0df[_0xf113('0x41')][_0xf113('0x4d')]+'%'};return _0x23f043;})});}_0x4c4236=_[_0xf113('0x50')]({},_0x4c4236,_0x55b0df[_0xf113('0x51')]);return _0x4abac4[_0xf113('0x83')](_0x4c4236);}})[_0xf113('0x21')](function(_0x181239){if(_0x181239){_0x55f42c=_0x181239[_0xf113('0x48')];if(!_0x55b0df[_0xf113('0x41')][_0xf113('0x6d')](_0xf113('0x49'))){_0x4c4236[_0xf113('0x30')]=qs[_0xf113('0x30')](_0x55b0df[_0xf113('0x41')]['limit']);_0x4c4236[_0xf113('0x2e')]=qs[_0xf113('0x2e')](_0x55b0df[_0xf113('0x41')][_0xf113('0x2e')]);}return _0x4abac4[_0xf113('0x83')](_0x4c4236);}})['then'](function(_0x25b662){if(_0x25b662){return _0x25b662?{'count':_0x55f42c,'rows':_0x25b662}:null;}})[_0xf113('0x21')](respondWithResult(_0x5c828e,null))[_0xf113('0x2a')](handleError(_0x5c828e,null));};function Extension(_0x2d3a24,_0x4a2fa2,_0x4699d6,_0xf5779d){this['context']=_0xf113('0x84');this[_0xf113('0x85')]=_0x2d3a24[_0xf113('0x86')];this[_0xf113('0x87')]=_0xf5779d;this[_0xf113('0x4f')]=_0xf113('0x88');this[_0xf113('0x89')]=_0xf113('0x8a');this[_0xf113('0x64')]=_0x2d3a24['id'];this[_0xf113('0x81')]=_0x4a2fa2;this[_0xf113('0x8b')]=_0x4699d6;}function createExtensionsReciveFax(_0x122696){var _0x143c7b=0x1;var _0x115d39=[];_0x115d39[_0xf113('0x8c')](new Extension(_0x122696,_0x143c7b,'',_0xf113('0x8d')));_0x143c7b+=0x1;_0x115d39[_0xf113('0x8c')](new Extension(_0x122696,_0x143c7b,_0xf113('0x8e'),_0xf113('0x8f')));_0x143c7b+=0x1;for(var _0x35722c in _0x122696){if(_0x122696[_0xf113('0x6d')](_0x35722c)&&(_0x35722c===_0xf113('0x90')||_0x35722c===_0xf113('0x86')||_0x35722c===_0xf113('0x91')||_0x35722c===_0xf113('0x92')||_0x35722c===_0xf113('0x93')||_0x35722c===_0xf113('0x94')||_0x35722c===_0xf113('0x95')||_0x35722c===_0xf113('0x96')||_0x35722c===_0xf113('0x97'))){_0x115d39['push'](new Extension(_0x122696,_0x143c7b,_0xf113('0x98')+_0x35722c+')='+_0x122696[_0x35722c],_0xf113('0x8f')));_0x143c7b+=0x1;}}_0x115d39[_0xf113('0x8c')](new Extension(_0x122696,_0x143c7b,'6',_0xf113('0x99')));_0x143c7b+=0x1;_0x115d39[_0xf113('0x8c')](new Extension(_0x122696,_0x143c7b,_0xf113('0x9a'),_0xf113('0x9b')));_0x143c7b=0x0;return _0x115d39;}exports[_0xf113('0x9c')]=function(_0x161a0f,_0x25c11c,_0xfbca){var _0x1b7dee;return db['sequelize'][_0xf113('0x9d')](function(_0x38ab45){return db[_0xf113('0x3e')][_0xf113('0x58')](_0x161a0f[_0xf113('0x59')],{'transaction':_0x38ab45})[_0xf113('0x21')](function(_0x3dd082){_0x1b7dee=_0x3dd082[_0xf113('0x5a')]({'plain':!![]});return db[_0xf113('0x9e')]['bulkCreate'](createExtensionsReciveFax(_0x1b7dee),{'transaction':_0x38ab45});});})[_0xf113('0x21')](function(){return _0x1b7dee;})[_0xf113('0x21')](respondWithResult(_0x25c11c,null))[_0xf113('0x2a')](handleError(_0x25c11c,null));};exports[_0xf113('0x9f')]=function(_0xef2655,_0x42cfb8,_0x22e631){var _0x188581;return db[_0xf113('0x7a')][_0xf113('0x9d')](function(_0x4674ad){return db[_0xf113('0x3e')][_0xf113('0x61')](_0xef2655[_0xf113('0x59')],{'where':{'id':_0xef2655[_0xf113('0x59')]['id']},'transaction':_0x4674ad})[_0xf113('0x21')](function(_0x5c2950){return db['VoiceExtension'][_0xf113('0x36')]({'where':{'FaxAccountId':_0xef2655[_0xf113('0x59')]['id']},'transaction':_0x4674ad})[_0xf113('0x21')](function(_0x387eae){return db[_0xf113('0x9e')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0xef2655[_0xf113('0x59')],[_0xf113('0xa0'),_0xf113('0x40'),'createdAt',_0xf113('0xa1'),'TrunkId',_0xf113('0xa2')])),{'transaction':_0x4674ad});});});})[_0xf113('0x21')](function(){return db[_0xf113('0x3e')][_0xf113('0xa3')](_0xef2655[_0xf113('0x59')]['id']);})[_0xf113('0x21')](respondWithResult(_0x42cfb8,null))[_0xf113('0x2a')](handleError(_0x42cfb8,null));};exports[_0xf113('0xa4')]=function(_0x537253,_0x2055ad,_0x428e2c){var _0x21d169={'raw':!![],'where':{}};var _0x5efe43={};var _0xba5085={'count':0x0,'rows':[]};return db[_0xf113('0x3e')]['findOne']({'where':{'id':_0x537253[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x2055ad,null))[_0xf113('0x21')](function(_0x1f68f8){if(_0x1f68f8){_0x5efe43[_0xf113('0x45')]=_['keys'](db['FaxMessage'][_0xf113('0x3f')]);_0x5efe43[_0xf113('0x41')]=_[_0xf113('0x42')](_0x537253[_0xf113('0x41')]);_0x5efe43['filters']=_[_0xf113('0x44')](_0x5efe43[_0xf113('0x45')],_0x5efe43[_0xf113('0x41')]);_0x21d169[_0xf113('0x46')]=_[_0xf113('0x44')](_0x5efe43[_0xf113('0x45')],qs[_0xf113('0x47')](_0x537253['query'][_0xf113('0x47')]));_0x21d169[_0xf113('0x46')]=_0x21d169[_0xf113('0x46')][_0xf113('0x48')]?_0x21d169[_0xf113('0x46')]:_0x5efe43[_0xf113('0x45')];if(!_0x537253[_0xf113('0x41')]['hasOwnProperty'](_0xf113('0x49'))){_0x21d169[_0xf113('0x30')]=qs[_0xf113('0x30')](_0x537253[_0xf113('0x41')][_0xf113('0x30')]);_0x21d169['offset']=qs[_0xf113('0x2e')](_0x537253['query'][_0xf113('0x2e')]);}_0x21d169[_0xf113('0x6e')]=qs[_0xf113('0x4a')](_0x537253[_0xf113('0x41')][_0xf113('0x4a')]);_0x21d169['where']=qs['filters'](_['pick'](_0x537253[_0xf113('0x41')],_0x5efe43[_0xf113('0x43')]));_0x21d169[_0xf113('0x4b')][_0xf113('0x64')]=_0x1f68f8['id'];if(_0x537253[_0xf113('0x41')][_0xf113('0x4d')]){_0x21d169[_0xf113('0x4b')]=_[_0xf113('0x50')](_0x21d169[_0xf113('0x4b')],{'$or':_[_0xf113('0x4e')](_0x21d169[_0xf113('0x46')],function(_0x4d84d6){var _0x4585b9={};_0x4585b9[_0x4d84d6]={'$like':'%'+_0x537253[_0xf113('0x41')][_0xf113('0x4d')]+'%'};return _0x4585b9;})});}if(_0x537253[_0xf113('0x41')][_0xf113('0xa5')]){var _0x6297fc=_0x537253[_0xf113('0x41')][_0xf113('0xa5')]['split'](',');var _0x400176={};_0x400176[_0x6297fc[0x0]]={'$gte':moment(_0x6297fc[0x1])['format'](_0xf113('0xa6'))};_0x21d169[_0xf113('0x4b')]=_[_0xf113('0x50')](_0x21d169['where'],_0x400176);}_0x21d169=_[_0xf113('0x50')]({},_0x21d169,_0x537253['options']);return db[_0xf113('0xa7')]['count']({'where':_0x21d169['where']})[_0xf113('0x21')](function(_0x1b9df2){_0xba5085['count']=_0x1b9df2;if(_0x537253[_0xf113('0x41')]['includeAll']){_0x21d169['include']=[{'all':!![]}];}return db[_0xf113('0xa7')][_0xf113('0x68')](_0x21d169);})[_0xf113('0x21')](function(_0x50bf09){_0xba5085[_0xf113('0x54')]=_0x50bf09;return _0xba5085;});}})[_0xf113('0x21')](respondWithFilteredResult(_0x2055ad,_0x21d169))['catch'](handleError(_0x2055ad,null));};exports[_0xf113('0x3a')]=function(_0x4cf482,_0x18900f,_0x470471){var _0x11aa81,_0x545cc8={},_0x995ce4;if(_0x4cf482[_0xf113('0x59')]['to']){_0x995ce4=_0x4cf482[_0xf113('0x59')]['to'][0x0];}return db['FaxAccount'][_0xf113('0x57')]({'where':{'id':_0x4cf482[_0xf113('0x56')]['id']},'include':[{'model':db[_0xf113('0xa8')],'as':'List','include':[{'model':db[_0xf113('0x75')],'as':_0xf113('0xa9'),'where':{'fax':_0x995ce4},'limit':0x1,'order':[[_0xf113('0xa1'),_0xf113('0xaa')]]}]}]})[_0xf113('0x21')](handleEntityNotFound(_0x18900f,null))[_0xf113('0x21')](function(_0x499258){_0x11aa81=_0x499258;if(_0x4cf482[_0xf113('0x59')]['attachments']&&_0x4cf482[_0xf113('0x59')][_0xf113('0xab')]['length']){for(var _0x33dc3f=0x0;_0x33dc3f<_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][_0xf113('0x48')];_0x33dc3f+=0x1){_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][_0x33dc3f]={'filename':_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][_0x33dc3f][_0xf113('0x39')],'id':_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][_0x33dc3f]['id'],'path':path['join'](config[_0xf113('0xac')],_0xf113('0xad'),_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][_0x33dc3f][_0xf113('0xae')])};}}return respondWithRpcPromise(_0xf113('0xaf'),_0xf113('0xaf'),{'FaxAccountId':_['isNil'](_0x4cf482[_0xf113('0x56')]['id'])?undefined:_0x4cf482[_0xf113('0x56')]['id'],'path':_[_0xf113('0xb0')](_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][0x0][_0xf113('0xb1')])?undefined:_0x4cf482['body'][_0xf113('0xab')][0x0][_0xf113('0xb1')],'fax':_[_0xf113('0xb0')](_0x4cf482[_0xf113('0x59')]['to'][0x0])?undefined:_0x4cf482[_0xf113('0x59')]['to'][0x0]},client9002);})[_0xf113('0x21')](function(){if(_0x11aa81){if(_[_0xf113('0xb0')](_0x4cf482[_0xf113('0x59')][_0xf113('0xb2')])){_0x4cf482['body'][_0xf113('0xb2')]=util[_0xf113('0xb3')](_0xf113('0xb4'),_0x11aa81['name'],_0x11aa81['fax']);}if(_0x11aa81['List']){if(_0x11aa81[_0xf113('0xb5')]['Contacts'][_0xf113('0x48')]){return _0x11aa81[_0xf113('0xb5')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xf113('0x19')](_0x4cf482[_0xf113('0x59')],{'firstName':_0x4cf482[_0xf113('0x59')]['to'][0x0],'phone':_0x4cf482['body']['to'][0x0],'fax':_0x4cf482['body']['to'][0x0],'ListId':_0x11aa81[_0xf113('0xa2')]}));}}else{throw new Error(_0xf113('0xb6'));}}else{throw new Error(_0xf113('0xb7'));}})[_0xf113('0x21')](function(_0x3456f6){if(_0x3456f6){return db['FaxInteraction'][_0xf113('0x57')]({'where':{'ContactId':_0x3456f6['id'],'closed':![],'FaxAccountId':_0x11aa81['id']}})['then'](function(_0x5e9288){if(_0x5e9288){return[_0x5e9288,![]];}return db[_0xf113('0x74')][_0xf113('0x58')]({'UserId':_0x4cf482[_0xf113('0x5d')]['id'],'ContactId':_0x3456f6['id'],'FaxAccountId':_0x11aa81['id'],'fax':_0x4cf482['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf113('0x50')](_0x4cf482[_0xf113('0x59')],{'read':![],'body':_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][0x0][_0xf113('0xb8')],'FaxAccountId':_0x11aa81['id'],'UserId':_0x4cf482['user']['id'],'ContactId':_0x3456f6['id'],'AttachmentId':_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xf113('0xa7')],'as':_0xf113('0xb9')}]})['then'](function(_0x50d6a2){return[_0x50d6a2,!![]];});});}else{throw new Error(_0xf113('0xba'));}})[_0xf113('0xbb')](function(_0x4360de,_0x57fbe5){if(_0x57fbe5){return _0x4360de;}return db['FaxMessage'][_0xf113('0x58')]({'direction':_0xf113('0xbc'),'read':![],'body':_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][0x0][_0xf113('0xb8')],'FaxAccountId':_0x11aa81['id'],'FaxInteractionId':_0x4360de['id'],'UserId':_0x4cf482[_0xf113('0x5d')]['id'],'ContactId':_0x4360de[_0xf113('0xbd')],'AttachmentId':_0x4cf482[_0xf113('0x59')]['attachments'][0x0]['id']})['then'](function(_0x4d45ee){_0x4360de['dataValues'][_0xf113('0xb9')]=[];_0x4360de['dataValues'][_0xf113('0xb9')][_0xf113('0x8c')](_0x4d45ee['dataValues']);return _0x4360de;});})[_0xf113('0x21')](function(_0x1e5256){respondWithRpcPromise(_0xf113('0xbe'),_0xf113('0xbe'),{'FaxAccountId':_['isNil'](_0x4cf482[_0xf113('0x56')]['id'])?undefined:_0x4cf482[_0xf113('0x56')]['id'],'path':_['isNil'](_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][0x0][_0xf113('0xb1')])?undefined:_0x4cf482['body'][_0xf113('0xab')][0x0][_0xf113('0xb1')],'fax':_[_0xf113('0xb0')](_0x4cf482[_0xf113('0x59')]['to'][0x0])?undefined:_0x4cf482['body']['to'][0x0],'AttachmentId':_0x4cf482[_0xf113('0x59')][_0xf113('0xab')][0x0]['id']},client9002)[_0xf113('0x21')](function(_0x535ba4){logger['info'](_0xf113('0xbf'),_0x535ba4);})[_0xf113('0x2a')](function(_0x463a8d){logger[_0xf113('0x22')]('SendFaxRpc,\x20%s',_0x463a8d);});return _0x1e5256;})['then'](respondWithResult(_0x18900f,null))['catch'](handleError(_0x18900f,null));};exports['addAgents']=function(_0x1c5191,_0x2101db,_0x9bb87c){return db[_0xf113('0x3e')]['find']({'where':{'id':_0x1c5191[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x2101db,null))['then'](function(_0x45da39){if(_0x45da39){return _0x45da39['addAgents'](_0x1c5191[_0xf113('0x59')][_0xf113('0x70')],_[_0xf113('0x72')](_0x1c5191[_0xf113('0x59')],[_0xf113('0x70'),'id'])||{})['spread'](function(_0x55a008){for(var _0x420f7e=0x0;_0x420f7e<_0x1c5191[_0xf113('0x59')][_0xf113('0x70')][_0xf113('0x48')];_0x420f7e+=0x1){socket[_0xf113('0xc0')](_0xf113('0xc1'),{'UserId':Number(_0x1c5191[_0xf113('0x59')][_0xf113('0x70')][_0x420f7e]),'FaxAccountId':Number(_0x1c5191[_0xf113('0x56')]['id'])});}return _0x55a008;});}})[_0xf113('0x21')](respondWithResult(_0x2101db,null))[_0xf113('0x2a')](handleError(_0x2101db,null));};exports[_0xf113('0xc2')]=function(_0x45a901,_0x5791fb,_0x97ccc){return db['FaxAccount'][_0xf113('0x57')]({'where':{'id':_0x45a901['params']['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x5791fb,null))[_0xf113('0x21')](function(_0x230586){if(_0x230586){return _0x230586[_0xf113('0xc2')](_0x45a901[_0xf113('0x41')]['ids'])[_0xf113('0x21')](function(){if(_[_0xf113('0xc3')](_0x45a901[_0xf113('0x41')][_0xf113('0x70')])){for(var _0x4fa791=0x0;_0x4fa791<_0x45a901[_0xf113('0x41')][_0xf113('0x70')]['length'];_0x4fa791+=0x1){socket['emit'](_0xf113('0xc4'),{'UserId':Number(_0x45a901['query']['ids'][_0x4fa791]),'FaxAccountId':Number(_0x45a901[_0xf113('0x56')]['id'])});}}else{socket[_0xf113('0xc0')](_0xf113('0xc4'),{'UserId':Number(_0x45a901['query'][_0xf113('0x70')]),'FaxAccountId':Number(_0x45a901[_0xf113('0x56')]['id'])});}});}})[_0xf113('0x21')](respondWithStatusCode(_0x5791fb,null))[_0xf113('0x2a')](handleError(_0x5791fb,null));};exports['getAgents']=function(_0x3dc5e4,_0x5d0a18,_0x228d8e){var _0x2f9771={};var _0x50247c={};var _0x548efd;var _0xb6843c;return db[_0xf113('0x3e')]['findOne']({'where':{'id':_0x3dc5e4[_0xf113('0x56')]['id']}})[_0xf113('0x21')](handleEntityNotFound(_0x5d0a18,null))['then'](function(_0x5c0681){if(_0x5c0681){_0x548efd=_0x5c0681;_0x50247c['model']=_[_0xf113('0x42')](db['User'][_0xf113('0x3f')]);_0x50247c[_0xf113('0x41')]=_['keys'](_0x3dc5e4[_0xf113('0x41')]);_0x50247c[_0xf113('0x43')]=_[_0xf113('0x44')](_0x50247c['model'],_0x50247c[_0xf113('0x41')]);_0x2f9771['attributes']=_[_0xf113('0x44')](_0x50247c[_0xf113('0x45')],qs['fields'](_0x3dc5e4[_0xf113('0x41')][_0xf113('0x47')]));_0x2f9771[_0xf113('0x46')]=_0x2f9771['attributes'][_0xf113('0x48')]?_0x2f9771[_0xf113('0x46')]:_0x50247c[_0xf113('0x45')];_0x2f9771[_0xf113('0x6e')]=qs[_0xf113('0x4a')](_0x3dc5e4['query'][_0xf113('0x4a')]);_0x2f9771[_0xf113('0x4b')]=qs['filters'](_[_0xf113('0x4c')](_0x3dc5e4[_0xf113('0x41')],_0x50247c['filters']));if(_0x3dc5e4[_0xf113('0x41')][_0xf113('0x4d')]){_0x2f9771[_0xf113('0x4b')]=_[_0xf113('0x50')](_0x2f9771[_0xf113('0x4b')],{'$or':_['map'](_0x2f9771[_0xf113('0x46')],function(_0x2acbf5){var _0x1f90ea={};_0x1f90ea[_0x2acbf5]={'$like':'%'+_0x3dc5e4[_0xf113('0x41')][_0xf113('0x4d')]+'%'};return _0x1f90ea;})});}_0x2f9771=_[_0xf113('0x50')]({},_0x2f9771,_0x3dc5e4[_0xf113('0x51')]);return _0x548efd['getAgents'](_0x2f9771);}})[_0xf113('0x21')](function(_0x49064f){if(_0x49064f){_0xb6843c=_0x49064f[_0xf113('0x48')];if(!_0x3dc5e4['query']['hasOwnProperty'](_0xf113('0x49'))){_0x2f9771[_0xf113('0x30')]=qs[_0xf113('0x30')](_0x3dc5e4[_0xf113('0x41')][_0xf113('0x30')]);_0x2f9771[_0xf113('0x2e')]=qs[_0xf113('0x2e')](_0x3dc5e4[_0xf113('0x41')][_0xf113('0x2e')]);}return _0x548efd[_0xf113('0xc5')](_0x2f9771);}})[_0xf113('0x21')](function(_0x3941be){if(_0x3941be){return _0x3941be?{'count':_0xb6843c,'rows':_0x3941be}:null;}})[_0xf113('0x21')](respondWithResult(_0x5d0a18,null))[_0xf113('0x2a')](handleError(_0x5d0a18,null));}; \ No newline at end of file +var _0x04f4=['addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','FaxAccount','findAll','rows','show','params','intersection','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','FaxAccountId','Disposition','includeAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','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','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','findById','FaxMessage','$gte','split','format','CmList','List','CmContact','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x04f4,0x18e));var _0x404f=function(_0x26bf1d,_0x1ff663){_0x26bf1d=_0x26bf1d-0x0;var _0xd2c50c=_0x04f4[_0x26bf1d];return _0xd2c50c;};'use strict';var emlformat=require(_0x404f('0x0'));var rimraf=require(_0x404f('0x1'));var zipdir=require(_0x404f('0x2'));var jsonpatch=require(_0x404f('0x3'));var rp=require(_0x404f('0x4'));var moment=require(_0x404f('0x5'));var BPromise=require(_0x404f('0x6'));var Mustache=require(_0x404f('0x7'));var util=require(_0x404f('0x8'));var path=require(_0x404f('0x9'));var sox=require(_0x404f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x404f('0xb'));var _=require(_0x404f('0xc'));var squel=require(_0x404f('0xd'));var crypto=require(_0x404f('0xe'));var jsforce=require(_0x404f('0xf'));var deskjs=require(_0x404f('0x10'));var toCsv=require(_0x404f('0x11'));var querystring=require(_0x404f('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x404f('0x13'));var as=require(_0x404f('0x14'));var hardwareService=require(_0x404f('0x15'));var logger=require(_0x404f('0x16'))('api');var utils=require(_0x404f('0x17'));var config=require(_0x404f('0x18'));var licenseUtil=require(_0x404f('0x19'));var db=require(_0x404f('0x1a'))['db'];config[_0x404f('0x1b')]=_['defaults'](config[_0x404f('0x1b')],{'host':_0x404f('0x1c'),'port':0x18eb});var socket=require(_0x404f('0x1d'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x404f('0x1e')](socket);var jayson=require(_0x404f('0x1f'));var client=jayson[_0x404f('0x20')][_0x404f('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x404f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x15a93d,_0x23676b,_0xaea59,_0x5a996e){return new BPromise(function(_0x46e85b,_0x38d950){var _0x1ed75b=_0x5a996e||client;return _0x1ed75b[_0x404f('0x22')](_0x15a93d,_0xaea59)[_0x404f('0x23')](function(_0x35fd18){logger[_0x404f('0x24')](_0x404f('0x25'),_0x23676b,'request\x20sent');logger[_0x404f('0x26')](_0x404f('0x27'),_0x23676b,_0x404f('0x28'),JSON['stringify'](_0x35fd18));if(_0x35fd18[_0x404f('0x29')]){if(_0x35fd18[_0x404f('0x29')][_0x404f('0x2a')]===0x1f4){logger[_0x404f('0x29')]('FaxAccount,\x20%s,\x20%s',_0x23676b,_0x35fd18[_0x404f('0x29')]['message']);return _0x38d950(_0x35fd18[_0x404f('0x29')][_0x404f('0x2b')]);}logger[_0x404f('0x29')]('FaxAccount,\x20%s,\x20%s',_0x23676b,_0x35fd18[_0x404f('0x29')][_0x404f('0x2b')]);return _0x46e85b(_0x35fd18[_0x404f('0x29')][_0x404f('0x2b')]);}else{logger[_0x404f('0x24')](_0x404f('0x25'),_0x23676b,_0x404f('0x28'));_0x46e85b(_0x35fd18[_0x404f('0x2c')][_0x404f('0x2b')]);}})[_0x404f('0x2d')](function(_0x34cb7a){logger[_0x404f('0x29')](_0x404f('0x25'),_0x23676b,_0x34cb7a);_0x38d950(_0x34cb7a);});});}function respondWithStatusCode(_0xac53be,_0x4b3b3a){_0x4b3b3a=_0x4b3b3a||0xcc;return function(_0x24ee1c){if(_0x24ee1c){return _0xac53be[_0x404f('0x2e')](_0x4b3b3a);}return _0xac53be[_0x404f('0x2f')](_0x4b3b3a)[_0x404f('0x30')]();};}function respondWithResult(_0x50bfb9,_0x338495){_0x338495=_0x338495||0xc8;return function(_0x3bb55d){if(_0x3bb55d){return _0x50bfb9[_0x404f('0x2f')](_0x338495)[_0x404f('0x31')](_0x3bb55d);}};}function respondWithFilteredResult(_0x3f328e,_0x48d4df){return function(_0x11723f){if(_0x11723f){var _0x51961f=typeof _0x48d4df[_0x404f('0x32')]===_0x404f('0x33')&&typeof _0x48d4df[_0x404f('0x34')]===_0x404f('0x33');var _0x56529b=_0x11723f[_0x404f('0x35')];var _0x5d9087=_0x51961f?0x0:_0x48d4df[_0x404f('0x32')];var _0x401cab=_0x51961f?_0x11723f[_0x404f('0x35')]:_0x48d4df['offset']+_0x48d4df[_0x404f('0x34')];var _0x3e53bb;if(_0x401cab>=_0x56529b){_0x401cab=_0x56529b;_0x3e53bb=0xc8;}else{_0x3e53bb=0xce;}_0x3f328e[_0x404f('0x2f')](_0x3e53bb);return _0x3f328e['set'](_0x404f('0x36'),_0x5d9087+'-'+_0x401cab+'/'+_0x56529b)['json'](_0x11723f);}return null;};}function patchUpdates(_0x39268f){return function(_0x4fcdea){try{jsonpatch['apply'](_0x4fcdea,_0x39268f,!![]);}catch(_0x7326a8){return BPromise[_0x404f('0x37')](_0x7326a8);}return _0x4fcdea[_0x404f('0x38')]();};}function saveUpdates(_0x491ae2,_0x5f5129){return function(_0x3242dc){if(_0x3242dc){return _0x3242dc['update'](_0x491ae2)[_0x404f('0x23')](function(_0x34e406){return _0x34e406;});}return null;};}function removeEntity(_0x180f67,_0x181f59){return function(_0x19e5cb){if(_0x19e5cb){return _0x19e5cb[_0x404f('0x39')]()[_0x404f('0x23')](function(){var _0x2202b2=_0x19e5cb[_0x404f('0x3a')]({'plain':!![]});var _0x4fac17=_0x404f('0x3b');return db[_0x404f('0x3c')][_0x404f('0x39')]({'where':{'type':_0x4fac17,'resourceId':_0x2202b2['id']}})['then'](function(){return _0x19e5cb;});})['then'](function(){_0x180f67[_0x404f('0x2f')](0xcc)[_0x404f('0x30')]();});}};}function handleEntityNotFound(_0x173a32,_0x16cca0){return function(_0x263de8){if(!_0x263de8){_0x173a32[_0x404f('0x2e')](0x194);}return _0x263de8;};}function handleError(_0x5014a5,_0x539d43){_0x539d43=_0x539d43||0x1f4;return function(_0x46b9f2){logger[_0x404f('0x29')](_0x46b9f2[_0x404f('0x3d')]);if(_0x46b9f2['name']){delete _0x46b9f2[_0x404f('0x3e')];}_0x5014a5[_0x404f('0x2f')](_0x539d43)[_0x404f('0x3f')](_0x46b9f2);};}exports['index']=function(_0x5f0273,_0x56e6e6){var _0x3b85dc={'include':[{'model':db[_0x404f('0x40')],'as':_0x404f('0x41')}]},_0xe199e7={},_0xd7e0f={'count':0x0,'rows':[]};var _0x318b69=_[_0x404f('0x42')](db['FaxAccount'][_0x404f('0x43')],function(_0x501afc){return{'name':_0x501afc[_0x404f('0x44')],'type':_0x501afc[_0x404f('0x45')][_0x404f('0x46')]};});_0xe199e7[_0x404f('0x47')]=_[_0x404f('0x42')](_0x318b69,_0x404f('0x3e'));_0xe199e7[_0x404f('0x48')]=_[_0x404f('0x49')](_0x5f0273[_0x404f('0x48')]);_0xe199e7['filters']=_['intersection'](_0xe199e7[_0x404f('0x47')],_0xe199e7[_0x404f('0x48')]);_0x3b85dc[_0x404f('0x4a')]=_['intersection'](_0xe199e7['model'],qs[_0x404f('0x4b')](_0x5f0273[_0x404f('0x48')][_0x404f('0x4b')]));_0x3b85dc['attributes']=_0x3b85dc[_0x404f('0x4a')][_0x404f('0x4c')]?_0x3b85dc[_0x404f('0x4a')]:_0xe199e7[_0x404f('0x47')];if(!_0x5f0273[_0x404f('0x48')]['hasOwnProperty'](_0x404f('0x4d'))){_0x3b85dc[_0x404f('0x34')]=qs['limit'](_0x5f0273[_0x404f('0x48')][_0x404f('0x34')]);_0x3b85dc[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x5f0273[_0x404f('0x48')][_0x404f('0x32')]);}_0x3b85dc[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x5f0273['query'][_0x404f('0x4f')]);_0x3b85dc[_0x404f('0x50')]=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x5f0273[_0x404f('0x48')],_0xe199e7[_0x404f('0x51')]),_0x318b69);if(_0x5f0273[_0x404f('0x48')][_0x404f('0x53')]){_0x3b85dc['where']=_[_0x404f('0x54')](_0x3b85dc[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x318b69,function(_0x157b99){if(_0x157b99[_0x404f('0x45')]!==_0x404f('0x55')){var _0x43f700={};_0x43f700[_0x157b99[_0x404f('0x3e')]]={'$like':'%'+_0x5f0273[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x43f700;}})});}_0x3b85dc=_[_0x404f('0x54')]({},_0x3b85dc,_0x5f0273[_0x404f('0x56')]);var _0x2f8063={'where':_0x3b85dc[_0x404f('0x50')]};return db['FaxAccount']['count'](_0x2f8063)['then'](function(_0x4cf501){_0xd7e0f[_0x404f('0x35')]=_0x4cf501;if(_0x5f0273['query']['includeAll']){_0x3b85dc[_0x404f('0x57')]=[{'all':!![]}];}return db[_0x404f('0x58')][_0x404f('0x59')](_0x3b85dc);})[_0x404f('0x23')](function(_0x4addf9){_0xd7e0f[_0x404f('0x5a')]=_0x4addf9;return _0xd7e0f;})[_0x404f('0x23')](respondWithFilteredResult(_0x56e6e6,_0x3b85dc))[_0x404f('0x2d')](handleError(_0x56e6e6,null));};exports[_0x404f('0x5b')]=function(_0x2c42a7,_0xe3d85b){var _0x1556f3={'raw':![],'where':{'id':_0x2c42a7[_0x404f('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x404f('0x41')}]},_0x17176f={};_0x17176f[_0x404f('0x47')]=_[_0x404f('0x49')](db[_0x404f('0x58')][_0x404f('0x43')]);_0x17176f[_0x404f('0x48')]=_[_0x404f('0x49')](_0x2c42a7[_0x404f('0x48')]);_0x17176f[_0x404f('0x51')]=_[_0x404f('0x5d')](_0x17176f[_0x404f('0x47')],_0x17176f['query']);_0x1556f3[_0x404f('0x4a')]=_[_0x404f('0x5d')](_0x17176f[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x2c42a7['query']['fields']));_0x1556f3[_0x404f('0x4a')]=_0x1556f3[_0x404f('0x4a')][_0x404f('0x4c')]?_0x1556f3[_0x404f('0x4a')]:_0x17176f[_0x404f('0x47')];if(_0x2c42a7[_0x404f('0x48')]['includeAll']){_0x1556f3[_0x404f('0x57')]=[{'all':!![]}];}_0x1556f3=_[_0x404f('0x54')]({},_0x1556f3,_0x2c42a7[_0x404f('0x56')]);return db[_0x404f('0x58')]['find'](_0x1556f3)['then'](handleEntityNotFound(_0xe3d85b,null))[_0x404f('0x23')](respondWithResult(_0xe3d85b,null))[_0x404f('0x2d')](handleError(_0xe3d85b,null));};exports[_0x404f('0x5e')]=function(_0x3fdc37,_0xcebea2){return db['FaxAccount'][_0x404f('0x5e')](_0x3fdc37[_0x404f('0x5f')],{})[_0x404f('0x23')](function(_0x59b9be){var _0x9987ff=_0x3fdc37[_0x404f('0x60')][_0x404f('0x3a')]({'plain':!![]});if(!_0x9987ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9987ff[_0x404f('0x61')]==='user'){var _0x2133ec=_0x59b9be['get']({'plain':!![]});var _0x56af32=_0x404f('0x3b');return db[_0x404f('0x62')]['find']({'where':{'name':_0x56af32,'userProfileId':_0x9987ff[_0x404f('0x63')]},'raw':!![]})[_0x404f('0x23')](function(_0x1356a6){if(_0x1356a6&&_0x1356a6[_0x404f('0x64')]===0x0){return db[_0x404f('0x3c')]['create']({'name':_0x2133ec[_0x404f('0x3e')],'resourceId':_0x2133ec['id'],'type':_0x1356a6[_0x404f('0x3e')],'sectionId':_0x1356a6['id']},{})['then'](function(){return _0x59b9be;});}else{return _0x59b9be;}})['catch'](function(_0x56c206){logger[_0x404f('0x29')](_0x404f('0x65'),_0x56c206);throw _0x56c206;});}return _0x59b9be;})['then'](respondWithResult(_0xcebea2,0xc9))[_0x404f('0x2d')](handleError(_0xcebea2,null));};exports[_0x404f('0x66')]=function(_0x454512,_0x4a0a29){if(_0x454512['body']['id']){delete _0x454512[_0x404f('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x454512['params']['id']},'include':[{'model':db[_0x404f('0x40')],'as':_0x404f('0x41')}]})[_0x404f('0x23')](handleEntityNotFound(_0x4a0a29,null))[_0x404f('0x23')](saveUpdates(_0x454512[_0x404f('0x5f')],null))[_0x404f('0x23')](respondWithResult(_0x4a0a29,null))[_0x404f('0x2d')](handleError(_0x4a0a29,null));};exports[_0x404f('0x39')]=function(_0x3047f0,_0x113e13){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x3047f0[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x113e13,null))[_0x404f('0x23')](removeEntity(_0x113e13,null))['catch'](handleError(_0x113e13,null));};exports[_0x404f('0x68')]=function(_0x4f2da4,_0x23a105){return db['FaxAccount']['describe']()['then'](respondWithResult(_0x23a105,null))[_0x404f('0x2d')](handleError(_0x23a105,null));};exports[_0x404f('0x69')]=function(_0x5e41fc,_0x24accd,_0x531469){if(_0x5e41fc[_0x404f('0x5f')]['id']){delete _0x5e41fc[_0x404f('0x5f')]['id'];}return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x5e41fc[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x24accd,null))[_0x404f('0x23')](function(_0x5ba06b){if(_0x5ba06b){_0x5e41fc[_0x404f('0x5f')]['FaxAccountId']=_0x5ba06b['id'];return db['Disposition']['create'](_0x5e41fc[_0x404f('0x5f')]);}})['then'](respondWithResult(_0x24accd,null))['catch'](handleError(_0x24accd,null));};exports['getDispositions']=function(_0x5aed29,_0x5cf9dd,_0x54a0a7){var _0x3108d0={'raw':![],'where':{}};var _0x4a0570={};var _0x183995={'count':0x0,'rows':[]};return db[_0x404f('0x58')]['findOne']({'where':{'id':_0x5aed29['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x5cf9dd,null))['then'](function(_0x1977a5){if(_0x1977a5){_0x4a0570[_0x404f('0x47')]=_[_0x404f('0x49')](db['Disposition'][_0x404f('0x43')]);_0x4a0570[_0x404f('0x48')]=_[_0x404f('0x49')](_0x5aed29['query']);_0x4a0570[_0x404f('0x51')]=_['intersection'](_0x4a0570['model'],_0x4a0570[_0x404f('0x48')]);_0x3108d0[_0x404f('0x4a')]=_[_0x404f('0x5d')](_0x4a0570[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x5aed29[_0x404f('0x48')][_0x404f('0x4b')]));_0x3108d0[_0x404f('0x4a')]=_0x3108d0[_0x404f('0x4a')][_0x404f('0x4c')]?_0x3108d0[_0x404f('0x4a')]:_0x4a0570[_0x404f('0x47')];if(!_0x5aed29['query']['hasOwnProperty']('nolimit')){_0x3108d0[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x5aed29['query'][_0x404f('0x34')]);_0x3108d0['offset']=qs['offset'](_0x5aed29[_0x404f('0x48')]['offset']);}_0x3108d0[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x5aed29[_0x404f('0x48')][_0x404f('0x4f')]);_0x3108d0['where']=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x5aed29['query'],_0x4a0570[_0x404f('0x51')]));_0x3108d0[_0x404f('0x50')][_0x404f('0x6a')]=_0x1977a5['id'];if(_0x5aed29[_0x404f('0x48')]['filter']){_0x3108d0[_0x404f('0x50')]=_[_0x404f('0x54')](_0x3108d0[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x3108d0['attributes'],function(_0x2dbae6){var _0x235e51={};_0x235e51[_0x2dbae6]={'$like':'%'+_0x5aed29[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x235e51;})});}_0x3108d0=_['merge']({},_0x3108d0,_0x5aed29[_0x404f('0x56')]);return db[_0x404f('0x6b')]['count']({'where':_0x3108d0[_0x404f('0x50')]})[_0x404f('0x23')](function(_0x862a2){_0x183995[_0x404f('0x35')]=_0x862a2;if(_0x5aed29[_0x404f('0x48')][_0x404f('0x6c')]){_0x3108d0['include']=[{'all':!![]}];}return db[_0x404f('0x6b')]['findAll'](_0x3108d0);})[_0x404f('0x23')](function(_0x55f413){_0x183995[_0x404f('0x5a')]=_0x55f413;return _0x183995;});}})['then'](respondWithFilteredResult(_0x5cf9dd,_0x3108d0))['catch'](handleError(_0x5cf9dd,null));};exports[_0x404f('0x6d')]=function(_0x1b68f5,_0x2d6649,_0x490d5d){return db[_0x404f('0x58')]['find']({'where':{'id':_0x1b68f5[_0x404f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2d6649,null))[_0x404f('0x23')](function(_0x1b34c6){if(_0x1b34c6){return _0x1b34c6[_0x404f('0x6d')](_0x1b68f5['query'][_0x404f('0x6e')]);}})[_0x404f('0x23')](respondWithStatusCode(_0x2d6649,null))['catch'](handleError(_0x2d6649,null));};exports['addAnswer']=function(_0x2548fc,_0x4fddda,_0x5a4ec3){if(_0x2548fc[_0x404f('0x5f')]['id']){delete _0x2548fc['body']['id'];}return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x2548fc['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x4fddda,null))[_0x404f('0x23')](function(_0x217400){if(_0x217400){_0x2548fc[_0x404f('0x5f')][_0x404f('0x6a')]=_0x217400['id'];return db['CannedAnswer'][_0x404f('0x5e')](_0x2548fc['body']);}})[_0x404f('0x23')](respondWithResult(_0x4fddda,null))['catch'](handleError(_0x4fddda,null));};exports[_0x404f('0x6f')]=function(_0x21b247,_0x23f6b4,_0x1b14a7){var _0x2e8051={'raw':![],'where':{}};var _0xc71687={};var _0xad30f6={'count':0x0,'rows':[]};return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x21b247['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x23f6b4,null))[_0x404f('0x23')](function(_0x3f5421){if(_0x3f5421){_0xc71687['model']=_[_0x404f('0x49')](db[_0x404f('0x71')]['rawAttributes']);_0xc71687['query']=_['keys'](_0x21b247[_0x404f('0x48')]);_0xc71687['filters']=_[_0x404f('0x5d')](_0xc71687[_0x404f('0x47')],_0xc71687[_0x404f('0x48')]);_0x2e8051['attributes']=_[_0x404f('0x5d')](_0xc71687[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x21b247['query'][_0x404f('0x4b')]));_0x2e8051['attributes']=_0x2e8051[_0x404f('0x4a')]['length']?_0x2e8051[_0x404f('0x4a')]:_0xc71687[_0x404f('0x47')];if(!_0x21b247[_0x404f('0x48')][_0x404f('0x72')](_0x404f('0x4d'))){_0x2e8051[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x21b247[_0x404f('0x48')]['limit']);_0x2e8051[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x21b247[_0x404f('0x48')][_0x404f('0x32')]);}_0x2e8051[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x21b247[_0x404f('0x48')]['sort']);_0x2e8051[_0x404f('0x50')]=qs[_0x404f('0x51')](_['pick'](_0x21b247[_0x404f('0x48')],_0xc71687[_0x404f('0x51')]));_0x2e8051[_0x404f('0x50')][_0x404f('0x6a')]=_0x3f5421['id'];if(_0x21b247[_0x404f('0x48')][_0x404f('0x53')]){_0x2e8051[_0x404f('0x50')]=_[_0x404f('0x54')](_0x2e8051[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x2e8051[_0x404f('0x4a')],function(_0x16321c){var _0x42ec61={};_0x42ec61[_0x16321c]={'$like':'%'+_0x21b247[_0x404f('0x48')]['filter']+'%'};return _0x42ec61;})});}_0x2e8051=_[_0x404f('0x54')]({},_0x2e8051,_0x21b247[_0x404f('0x56')]);return db[_0x404f('0x71')]['count']({'where':_0x2e8051['where']})[_0x404f('0x23')](function(_0x4b02b7){_0xad30f6[_0x404f('0x35')]=_0x4b02b7;if(_0x21b247['query'][_0x404f('0x6c')]){_0x2e8051[_0x404f('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x404f('0x59')](_0x2e8051);})[_0x404f('0x23')](function(_0x46e7de){_0xad30f6[_0x404f('0x5a')]=_0x46e7de;return _0xad30f6;});}})[_0x404f('0x23')](respondWithFilteredResult(_0x23f6b4,_0x2e8051))['catch'](handleError(_0x23f6b4,null));};exports[_0x404f('0x73')]=function(_0x1cf395,_0x509622,_0x9fa404){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x1cf395[_0x404f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x509622,null))['then'](function(_0x1c7076){if(_0x1c7076){return _0x1c7076[_0x404f('0x73')](_0x1cf395['query'][_0x404f('0x6e')]);}})[_0x404f('0x23')](respondWithStatusCode(_0x509622,null))[_0x404f('0x2d')](handleError(_0x509622,null));};exports[_0x404f('0x74')]=function(_0x20e861,_0x396233,_0x4b3012){return db['FaxInteraction'][_0x404f('0x67')]({'where':{'id':_0x20e861[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x396233,null))[_0x404f('0x23')](function(_0x15f71b){if(_0x15f71b){return _0x15f71b[_0x404f('0x74')](_0x20e861['body'][_0x404f('0x6e')],_[_0x404f('0x75')](_0x20e861[_0x404f('0x5f')],[_0x404f('0x6e'),'id'])||{});}})[_0x404f('0x23')](respondWithResult(_0x396233,null))[_0x404f('0x2d')](handleError(_0x396233,null));};exports[_0x404f('0x76')]=function(_0x3b705b,_0x16df9e,_0x3f6bed){var _0x278322={'raw':![],'where':{}};var _0x18f6d1={};var _0x29a4b3={'count':0x0,'rows':[]};return db[_0x404f('0x58')]['findOne']({'where':{'id':_0x3b705b[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x16df9e,null))['then'](function(_0x31e6f6){if(_0x31e6f6){_0x18f6d1['model']=_['keys'](db[_0x404f('0x77')]['rawAttributes']);_0x18f6d1['query']=_['keys'](_0x3b705b[_0x404f('0x48')]);_0x18f6d1[_0x404f('0x51')]=_['intersection'](_0x18f6d1['model'],_0x18f6d1[_0x404f('0x48')]);_0x278322['attributes']=_[_0x404f('0x5d')](_0x18f6d1[_0x404f('0x47')],qs['fields'](_0x3b705b[_0x404f('0x48')][_0x404f('0x4b')]));_0x278322[_0x404f('0x4a')]=_0x278322[_0x404f('0x4a')]['length']?_0x278322[_0x404f('0x4a')]:_0x18f6d1['model'];if(!_0x3b705b[_0x404f('0x48')][_0x404f('0x72')](_0x404f('0x4d'))){_0x278322[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x3b705b['query']['limit']);_0x278322[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x3b705b['query']['offset']);}_0x278322['order']=qs[_0x404f('0x4f')](_0x3b705b['query'][_0x404f('0x4f')]);_0x278322['where']=qs['filters'](_['pick'](_0x3b705b[_0x404f('0x48')],_0x18f6d1[_0x404f('0x51')]));_0x278322[_0x404f('0x50')]['FaxAccountId']=_0x31e6f6['id'];if(_0x3b705b[_0x404f('0x48')][_0x404f('0x53')]){_0x278322[_0x404f('0x50')]=_['merge'](_0x278322[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x278322['attributes'],function(_0x16cd88){var _0x1ee127={};_0x1ee127[_0x16cd88]={'$like':'%'+_0x3b705b[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x1ee127;})});}_0x278322=_[_0x404f('0x54')]({},_0x278322,_0x3b705b[_0x404f('0x56')]);return db['FaxInteraction'][_0x404f('0x35')]({'where':_0x278322[_0x404f('0x50')]})[_0x404f('0x23')](function(_0xa1a8b4){_0x29a4b3[_0x404f('0x35')]=_0xa1a8b4;if(_0x3b705b['query'][_0x404f('0x6c')]){_0x278322[_0x404f('0x57')]=[{'model':db['CmContact'],'as':_0x404f('0x78'),'required':![]},{'model':db[_0x404f('0x79')],'as':'Owner','attributes':[_0x404f('0x3e'),_0x404f('0x7a'),_0x404f('0x7b')],'required':![]},{'model':db[_0x404f('0x7c')],'as':'Tags','attributes':['id',_0x404f('0x3e'),_0x404f('0x7d')],'where':_0x3b705b[_0x404f('0x48')]['tag']?{'id':_0x3b705b['query'][_0x404f('0x7e')]}:undefined,'required':_0x3b705b[_0x404f('0x48')][_0x404f('0x7e')]?!![]:![]}];}return db['FaxInteraction'][_0x404f('0x59')](_0x278322);})['then'](function(_0x1fbfdb){_0x29a4b3['rows']=_0x1fbfdb;return _0x29a4b3;});}})[_0x404f('0x23')](respondWithFilteredResult(_0x16df9e,_0x278322))[_0x404f('0x2d')](handleError(_0x16df9e,null));};exports[_0x404f('0x7f')]=function(_0x405d55,_0x208524){var _0x5e7188=_0x405d55[_0x404f('0x5c')]['id'];var _0x14f1fc=_0x405d55[_0x404f('0x5f')];var _0x2383ce=0xc8;var _0x4b4d60=null;return db[_0x404f('0x80')][_0x404f('0x81')]({'isolationLevel':db[_0x404f('0x80')][_0x404f('0x82')][_0x404f('0x83')][_0x404f('0x84')]},function(_0x14fa2b){return db[_0x404f('0x58')]['findOne']({'where':{'id':_0x5e7188},'transaction':_0x14fa2b})['then'](function(_0xb45e4){if(_0xb45e4){return db[_0x404f('0x85')][_0x404f('0x39')]({'where':{'FaxAccountId':_0x5e7188},'transaction':_0x14fa2b})[_0x404f('0x23')](function(){var _0x5dd41d=_['map'](_0x14f1fc,function(_0x169114){_0x169114[_0x404f('0x6a')]=_0x5e7188;return _0x169114;});return db[_0x404f('0x85')]['bulkCreate'](_0x5dd41d,{'transaction':_0x14fa2b});});}else{_0x2383ce=0x194;_0x4b4d60=[];}});})[_0x404f('0x23')](function(){if(_0x2383ce!==0x194){return db[_0x404f('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x5e7188},'order':'priority'})[_0x404f('0x23')](function(_0xb911f7){_0x4b4d60=_0xb911f7;});}})[_0x404f('0x2d')](function(_0x33f233){_0x2383ce=0x1f4;logger[_0x404f('0x29')](_0x33f233[_0x404f('0x3d')]);if(_0x33f233[_0x404f('0x3e')]){delete _0x33f233[_0x404f('0x3e')];}_0x4b4d60=_0x33f233;})[_0x404f('0x86')](function(){if(_0x4b4d60===null){_0x208524[_0x404f('0x2e')](_0x2383ce);}else{if(_0x2383ce===0x1f4){_0x208524[_0x404f('0x2f')](_0x2383ce)[_0x404f('0x3f')](_0x4b4d60);}else{_0x208524[_0x404f('0x2f')](_0x2383ce)['json'](_0x4b4d60);}}});};exports[_0x404f('0x87')]=function(_0x32cc6e,_0x338cf2,_0x3a123e){var _0x20be50={};var _0x6f2aff={};var _0x223752;var _0x5f00c9;return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x32cc6e[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x338cf2,null))[_0x404f('0x23')](function(_0x381c29){if(_0x381c29){_0x223752=_0x381c29;_0x6f2aff[_0x404f('0x47')]=_[_0x404f('0x49')](db['FaxApplication'][_0x404f('0x43')]);_0x6f2aff[_0x404f('0x48')]=_[_0x404f('0x49')](_0x32cc6e[_0x404f('0x48')]);_0x6f2aff[_0x404f('0x51')]=_[_0x404f('0x5d')](_0x6f2aff[_0x404f('0x47')],_0x6f2aff[_0x404f('0x48')]);_0x20be50[_0x404f('0x4a')]=_[_0x404f('0x5d')](_0x6f2aff[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x32cc6e[_0x404f('0x48')]['fields']));_0x20be50[_0x404f('0x4a')]=_0x20be50['attributes'][_0x404f('0x4c')]?_0x20be50[_0x404f('0x4a')]:_0x6f2aff[_0x404f('0x47')];_0x20be50[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x32cc6e[_0x404f('0x48')][_0x404f('0x4f')]);_0x20be50[_0x404f('0x50')]=qs[_0x404f('0x51')](_['pick'](_0x32cc6e[_0x404f('0x48')],_0x6f2aff['filters']));if(_0x32cc6e[_0x404f('0x48')]['filter']){_0x20be50['where']=_[_0x404f('0x54')](_0x20be50[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x20be50[_0x404f('0x4a')],function(_0x542ac9){var _0x56821d={};_0x56821d[_0x542ac9]={'$like':'%'+_0x32cc6e[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x56821d;})});}_0x20be50=_[_0x404f('0x54')]({},_0x20be50,_0x32cc6e[_0x404f('0x56')]);return _0x223752[_0x404f('0x87')](_0x20be50);}})['then'](function(_0x26b5e0){if(_0x26b5e0){_0x5f00c9=_0x26b5e0['length'];if(!_0x32cc6e['query']['hasOwnProperty']('nolimit')){_0x20be50['limit']=qs['limit'](_0x32cc6e['query'][_0x404f('0x34')]);_0x20be50[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x32cc6e[_0x404f('0x48')]['offset']);}return _0x223752[_0x404f('0x87')](_0x20be50);}})[_0x404f('0x23')](function(_0x17ea68){if(_0x17ea68){return _0x17ea68?{'count':_0x5f00c9,'rows':_0x17ea68}:null;}})[_0x404f('0x23')](respondWithResult(_0x338cf2,null))['catch'](handleError(_0x338cf2,null));};function Extension(_0x4e5614,_0x4220fc,_0x4ff1f8,_0xadbde2){this[_0x404f('0x88')]=_0x404f('0x89');this[_0x404f('0x8a')]=_0x4e5614[_0x404f('0x8b')];this[_0x404f('0x8c')]=_0xadbde2;this['type']='system';this[_0x404f('0x8d')]='Fax\x20Extension';this[_0x404f('0x6a')]=_0x4e5614['id'];this['priority']=_0x4220fc;this['appdata']=_0x4ff1f8;}function createExtensionsReciveFax(_0x347115){var _0x4b91a7=0x1;var _0x61b440=[];_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,'','Answer'));_0x4b91a7+=0x1;_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,_0x404f('0x8f'),_0x404f('0x90')));_0x4b91a7+=0x1;for(var _0x14ae38 in _0x347115){if(_0x347115[_0x404f('0x72')](_0x14ae38)&&(_0x14ae38===_0x404f('0x91')||_0x14ae38===_0x404f('0x8b')||_0x14ae38===_0x404f('0x92')||_0x14ae38===_0x404f('0x93')||_0x14ae38===_0x404f('0x94')||_0x14ae38==='maxrate'||_0x14ae38===_0x404f('0x95')||_0x14ae38==='modem'||_0x14ae38===_0x404f('0x96'))){_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,'FAXOPT('+_0x14ae38+')='+_0x347115[_0x14ae38],'Set'));_0x4b91a7+=0x1;}}_0x61b440[_0x404f('0x8e')](new Extension(_0x347115,_0x4b91a7,'6',_0x404f('0x97')));_0x4b91a7+=0x1;_0x61b440['push'](new Extension(_0x347115,_0x4b91a7,_0x404f('0x98'),'ReceiveFax'));_0x4b91a7=0x0;return _0x61b440;}exports[_0x404f('0x99')]=function(_0x5361f8,_0x4a8c09,_0x1eedeb){var _0x314643;return db[_0x404f('0x80')][_0x404f('0x81')](function(_0x30d8c6){return db[_0x404f('0x58')][_0x404f('0x5e')](_0x5361f8[_0x404f('0x5f')],{'transaction':_0x30d8c6})[_0x404f('0x23')](function(_0xaf2faf){_0x314643=_0xaf2faf[_0x404f('0x3a')]({'plain':!![]});return db['VoiceExtension'][_0x404f('0x9a')](createExtensionsReciveFax(_0x314643),{'transaction':_0x30d8c6});});})[_0x404f('0x23')](function(){return _0x314643;})['then'](respondWithResult(_0x4a8c09,null))[_0x404f('0x2d')](handleError(_0x4a8c09,null));};exports[_0x404f('0x9b')]=function(_0x273529,_0x332bd8,_0x379dae){var _0x1bd28a;return db[_0x404f('0x80')][_0x404f('0x81')](function(_0x46ad4b){return db[_0x404f('0x58')][_0x404f('0x66')](_0x273529[_0x404f('0x5f')],{'where':{'id':_0x273529[_0x404f('0x5f')]['id']},'transaction':_0x46ad4b})[_0x404f('0x23')](function(_0x77f1db){return db[_0x404f('0x9c')][_0x404f('0x39')]({'where':{'FaxAccountId':_0x273529['body']['id']},'transaction':_0x46ad4b})[_0x404f('0x23')](function(_0x3cee1d){return db['VoiceExtension'][_0x404f('0x9a')](createExtensionsReciveFax(_[_0x404f('0x75')](_0x273529[_0x404f('0x5f')],[_0x404f('0x9d'),_0x404f('0x46'),_0x404f('0x9e'),'updatedAt',_0x404f('0x9f'),'ListId'])),{'transaction':_0x46ad4b});});});})[_0x404f('0x23')](function(){return db[_0x404f('0x58')][_0x404f('0xa0')](_0x273529[_0x404f('0x5f')]['id']);})['then'](respondWithResult(_0x332bd8,null))[_0x404f('0x2d')](handleError(_0x332bd8,null));};exports['getMessages']=function(_0x5e3d0b,_0x1ae28c,_0x777ec5){var _0x81437c={'raw':!![],'where':{}};var _0x56f206={};var _0x29a0f8={'count':0x0,'rows':[]};return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x5e3d0b['params']['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x1ae28c,null))[_0x404f('0x23')](function(_0x1d336e){if(_0x1d336e){_0x56f206[_0x404f('0x47')]=_[_0x404f('0x49')](db[_0x404f('0xa1')]['rawAttributes']);_0x56f206['query']=_[_0x404f('0x49')](_0x5e3d0b[_0x404f('0x48')]);_0x56f206[_0x404f('0x51')]=_[_0x404f('0x5d')](_0x56f206[_0x404f('0x47')],_0x56f206[_0x404f('0x48')]);_0x81437c['attributes']=_[_0x404f('0x5d')](_0x56f206[_0x404f('0x47')],qs['fields'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x4b')]));_0x81437c[_0x404f('0x4a')]=_0x81437c['attributes'][_0x404f('0x4c')]?_0x81437c[_0x404f('0x4a')]:_0x56f206[_0x404f('0x47')];if(!_0x5e3d0b[_0x404f('0x48')][_0x404f('0x72')](_0x404f('0x4d'))){_0x81437c[_0x404f('0x34')]=qs['limit'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x34')]);_0x81437c['offset']=qs['offset'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x32')]);}_0x81437c[_0x404f('0x4e')]=qs['sort'](_0x5e3d0b[_0x404f('0x48')][_0x404f('0x4f')]);_0x81437c['where']=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x5e3d0b['query'],_0x56f206[_0x404f('0x51')]));_0x81437c[_0x404f('0x50')][_0x404f('0x6a')]=_0x1d336e['id'];if(_0x5e3d0b['query'][_0x404f('0x53')]){_0x81437c[_0x404f('0x50')]=_[_0x404f('0x54')](_0x81437c[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x81437c[_0x404f('0x4a')],function(_0x45035e){var _0x4e5bb6={};_0x4e5bb6[_0x45035e]={'$like':'%'+_0x5e3d0b[_0x404f('0x48')][_0x404f('0x53')]+'%'};return _0x4e5bb6;})});}if(_0x5e3d0b[_0x404f('0x48')][_0x404f('0xa2')]){var _0x271210=_0x5e3d0b['query'][_0x404f('0xa2')][_0x404f('0xa3')](',');var _0x54c40e={};_0x54c40e[_0x271210[0x0]]={'$gte':moment(_0x271210[0x1])[_0x404f('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x81437c[_0x404f('0x50')]=_[_0x404f('0x54')](_0x81437c[_0x404f('0x50')],_0x54c40e);}_0x81437c=_[_0x404f('0x54')]({},_0x81437c,_0x5e3d0b[_0x404f('0x56')]);return db[_0x404f('0xa1')][_0x404f('0x35')]({'where':_0x81437c[_0x404f('0x50')]})[_0x404f('0x23')](function(_0x180736){_0x29a0f8[_0x404f('0x35')]=_0x180736;if(_0x5e3d0b[_0x404f('0x48')]['includeAll']){_0x81437c[_0x404f('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x404f('0x59')](_0x81437c);})[_0x404f('0x23')](function(_0x32fed6){_0x29a0f8[_0x404f('0x5a')]=_0x32fed6;return _0x29a0f8;});}})['then'](respondWithFilteredResult(_0x1ae28c,_0x81437c))[_0x404f('0x2d')](handleError(_0x1ae28c,null));};exports[_0x404f('0x3f')]=function(_0x1635b0,_0x12ee8f,_0x49282a){var _0x4815ee,_0x113f9e={},_0x26a79b;if(_0x1635b0[_0x404f('0x5f')]['to']){_0x26a79b=_0x1635b0[_0x404f('0x5f')]['to'][0x0];}return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x1635b0[_0x404f('0x5c')]['id']},'include':[{'model':db[_0x404f('0xa5')],'as':_0x404f('0xa6'),'include':[{'model':db[_0x404f('0xa7')],'as':_0x404f('0xa8'),'where':{'fax':_0x26a79b},'limit':0x1,'order':[[_0x404f('0xa9'),_0x404f('0xaa')]]}]}]})[_0x404f('0x23')](handleEntityNotFound(_0x12ee8f,null))[_0x404f('0x23')](function(_0x295c0c){_0x4815ee=_0x295c0c;if(_0x1635b0[_0x404f('0x5f')]['attachments']&&_0x1635b0['body'][_0x404f('0xab')][_0x404f('0x4c')]){for(var _0x1deb63=0x0;_0x1deb63<_0x1635b0['body'][_0x404f('0xab')][_0x404f('0x4c')];_0x1deb63+=0x1){_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][_0x1deb63]={'filename':_0x1635b0['body'][_0x404f('0xab')][_0x1deb63]['name'],'id':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][_0x1deb63]['id'],'path':path[_0x404f('0xac')](config[_0x404f('0xad')],_0x404f('0xae'),_0x1635b0['body']['attachments'][_0x1deb63][_0x404f('0xaf')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x404f('0xb0')](_0x1635b0['params']['id'])?undefined:_0x1635b0[_0x404f('0x5c')]['id'],'path':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0x9')])?undefined:_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0x9')],'fax':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5f')]['to'][0x0])?undefined:_0x1635b0[_0x404f('0x5f')]['to'][0x0]},client9002);})[_0x404f('0x23')](function(){if(_0x4815ee){if(_['isNil'](_0x1635b0[_0x404f('0x5f')][_0x404f('0xb1')])){_0x1635b0[_0x404f('0x5f')][_0x404f('0xb1')]=util[_0x404f('0xa4')](_0x404f('0xb2'),_0x4815ee['name'],_0x4815ee[_0x404f('0xb3')]);}if(_0x4815ee[_0x404f('0xa6')]){if(_0x4815ee['List']['Contacts'][_0x404f('0x4c')]){return _0x4815ee[_0x404f('0xa6')][_0x404f('0xa8')][0x0];}else{return db[_0x404f('0xa7')][_0x404f('0x5e')](_['defaults'](_0x1635b0[_0x404f('0x5f')],{'firstName':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'phone':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'fax':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'ListId':_0x4815ee['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x404f('0x23')](function(_0x4b1b3b){if(_0x4b1b3b){return db['FaxInteraction'][_0x404f('0x67')]({'where':{'ContactId':_0x4b1b3b['id'],'closed':![],'FaxAccountId':_0x4815ee['id']}})[_0x404f('0x23')](function(_0xaebfd7){if(_0xaebfd7){return[_0xaebfd7,![]];}return db[_0x404f('0x77')][_0x404f('0x5e')]({'UserId':_0x1635b0[_0x404f('0x60')]['id'],'ContactId':_0x4b1b3b['id'],'FaxAccountId':_0x4815ee['id'],'fax':_0x1635b0[_0x404f('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x404f('0x54')](_0x1635b0['body'],{'read':![],'body':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0xb4')],'FaxAccountId':_0x4815ee['id'],'UserId':_0x1635b0[_0x404f('0x60')]['id'],'ContactId':_0x4b1b3b['id'],'AttachmentId':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x404f('0xa1')],'as':'Messages'}]})[_0x404f('0x23')](function(_0x59883b){return[_0x59883b,!![]];});});}else{throw new Error(_0x404f('0xb5'));}})['spread'](function(_0x589545,_0x14573a){if(_0x14573a){return _0x589545;}return db[_0x404f('0xa1')][_0x404f('0x5e')]({'direction':'out','read':![],'body':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0xb4')],'FaxAccountId':_0x4815ee['id'],'FaxInteractionId':_0x589545['id'],'UserId':_0x1635b0['user']['id'],'ContactId':_0x589545[_0x404f('0xb6')],'AttachmentId':_0x1635b0['body'][_0x404f('0xab')][0x0]['id']})['then'](function(_0xf1be5c){_0x589545[_0x404f('0xb7')][_0x404f('0xb8')]=[];_0x589545[_0x404f('0xb7')][_0x404f('0xb8')][_0x404f('0x8e')](_0xf1be5c[_0x404f('0xb7')]);return _0x589545;});})[_0x404f('0x23')](function(_0x119afe){respondWithRpcPromise(_0x404f('0xb9'),_0x404f('0xb9'),{'FaxAccountId':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5c')]['id'])?undefined:_0x1635b0[_0x404f('0x5c')]['id'],'path':_[_0x404f('0xb0')](_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0][_0x404f('0x9')])?undefined:_0x1635b0[_0x404f('0x5f')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x1635b0['body']['to'][0x0])?undefined:_0x1635b0['body']['to'][0x0],'AttachmentId':_0x1635b0[_0x404f('0x5f')][_0x404f('0xab')][0x0]['id']},client9002)[_0x404f('0x23')](function(_0x5dd662){logger[_0x404f('0x24')]('SendFaxRpc,\x20%s',_0x5dd662);})['catch'](function(_0x1f7c07){logger[_0x404f('0x24')](_0x404f('0xba'),_0x1f7c07);});return _0x119afe;})['then'](respondWithResult(_0x12ee8f,null))[_0x404f('0x2d')](handleError(_0x12ee8f,null));};exports[_0x404f('0xbb')]=function(_0x4d9b44,_0x4a25dd,_0xfa37e1){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x4d9b44['params']['id']}})['then'](handleEntityNotFound(_0x4a25dd,null))['then'](function(_0xe2e5e6){if(_0xe2e5e6){return _0xe2e5e6[_0x404f('0xbb')](_0x4d9b44['body'][_0x404f('0x6e')],_[_0x404f('0x75')](_0x4d9b44[_0x404f('0x5f')],[_0x404f('0x6e'),'id'])||{})[_0x404f('0xbc')](function(_0x5b905e){for(var _0xebf22d=0x0;_0xebf22d<_0x4d9b44[_0x404f('0x5f')][_0x404f('0x6e')][_0x404f('0x4c')];_0xebf22d+=0x1){socket[_0x404f('0xbd')](_0x404f('0xbe'),{'UserId':Number(_0x4d9b44[_0x404f('0x5f')][_0x404f('0x6e')][_0xebf22d]),'FaxAccountId':Number(_0x4d9b44[_0x404f('0x5c')]['id'])});}return _0x5b905e;});}})[_0x404f('0x23')](respondWithResult(_0x4a25dd,null))[_0x404f('0x2d')](handleError(_0x4a25dd,null));};exports[_0x404f('0xbf')]=function(_0x5986df,_0x2e3491,_0x369e45){return db[_0x404f('0x58')][_0x404f('0x67')]({'where':{'id':_0x5986df[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x2e3491,null))['then'](function(_0x343e89){if(_0x343e89){return _0x343e89[_0x404f('0xbf')](_0x5986df[_0x404f('0x48')][_0x404f('0x6e')])[_0x404f('0x23')](function(){if(_[_0x404f('0xc0')](_0x5986df[_0x404f('0x48')][_0x404f('0x6e')])){for(var _0x552f68=0x0;_0x552f68<_0x5986df[_0x404f('0x48')][_0x404f('0x6e')]['length'];_0x552f68+=0x1){socket[_0x404f('0xbd')](_0x404f('0xc1'),{'UserId':Number(_0x5986df[_0x404f('0x48')][_0x404f('0x6e')][_0x552f68]),'FaxAccountId':Number(_0x5986df[_0x404f('0x5c')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5986df[_0x404f('0x48')][_0x404f('0x6e')]),'FaxAccountId':Number(_0x5986df[_0x404f('0x5c')]['id'])});}});}})[_0x404f('0x23')](respondWithStatusCode(_0x2e3491,null))[_0x404f('0x2d')](handleError(_0x2e3491,null));};exports[_0x404f('0xc2')]=function(_0x161163,_0x59f461,_0x4b6eca){var _0x4f50e7={};var _0x11488c={};var _0x4c1240;var _0x1cb4e3;return db[_0x404f('0x58')][_0x404f('0x70')]({'where':{'id':_0x161163[_0x404f('0x5c')]['id']}})[_0x404f('0x23')](handleEntityNotFound(_0x59f461,null))[_0x404f('0x23')](function(_0xa05a7d){if(_0xa05a7d){_0x4c1240=_0xa05a7d;_0x11488c[_0x404f('0x47')]=_['keys'](db[_0x404f('0x79')][_0x404f('0x43')]);_0x11488c['query']=_[_0x404f('0x49')](_0x161163[_0x404f('0x48')]);_0x11488c['filters']=_[_0x404f('0x5d')](_0x11488c['model'],_0x11488c[_0x404f('0x48')]);_0x4f50e7['attributes']=_[_0x404f('0x5d')](_0x11488c[_0x404f('0x47')],qs[_0x404f('0x4b')](_0x161163[_0x404f('0x48')]['fields']));_0x4f50e7[_0x404f('0x4a')]=_0x4f50e7['attributes']['length']?_0x4f50e7[_0x404f('0x4a')]:_0x11488c[_0x404f('0x47')];_0x4f50e7[_0x404f('0x4e')]=qs[_0x404f('0x4f')](_0x161163[_0x404f('0x48')][_0x404f('0x4f')]);_0x4f50e7['where']=qs[_0x404f('0x51')](_[_0x404f('0x52')](_0x161163[_0x404f('0x48')],_0x11488c[_0x404f('0x51')]));if(_0x161163[_0x404f('0x48')][_0x404f('0x53')]){_0x4f50e7['where']=_[_0x404f('0x54')](_0x4f50e7[_0x404f('0x50')],{'$or':_[_0x404f('0x42')](_0x4f50e7['attributes'],function(_0xef2a14){var _0x288f7c={};_0x288f7c[_0xef2a14]={'$like':'%'+_0x161163[_0x404f('0x48')]['filter']+'%'};return _0x288f7c;})});}_0x4f50e7=_[_0x404f('0x54')]({},_0x4f50e7,_0x161163[_0x404f('0x56')]);return _0x4c1240[_0x404f('0xc2')](_0x4f50e7);}})[_0x404f('0x23')](function(_0x511b55){if(_0x511b55){_0x1cb4e3=_0x511b55['length'];if(!_0x161163[_0x404f('0x48')][_0x404f('0x72')]('nolimit')){_0x4f50e7[_0x404f('0x34')]=qs[_0x404f('0x34')](_0x161163[_0x404f('0x48')]['limit']);_0x4f50e7[_0x404f('0x32')]=qs[_0x404f('0x32')](_0x161163[_0x404f('0x48')]['offset']);}return _0x4c1240[_0x404f('0xc2')](_0x4f50e7);}})[_0x404f('0x23')](function(_0x25479e){if(_0x25479e){return _0x25479e?{'count':_0x1cb4e3,'rows':_0x25479e}:null;}})[_0x404f('0x23')](respondWithResult(_0x59f461,null))[_0x404f('0x2d')](handleError(_0x59f461,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ccec7e1..72a1e2e 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 _0x228b=['../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hook','events'];(function(_0x1fc7b5,_0x5d4779){var _0x3ef5db=function(_0x1622cf){while(--_0x1622cf){_0x1fc7b5['push'](_0x1fc7b5['shift']());}};_0x3ef5db(++_0x5d4779);}(_0x228b,0x1e7));var _0xb228=function(_0x1edf25,_0x10b2eb){_0x1edf25=_0x1edf25-0x0;var _0x3904d8=_0x228b[_0x1edf25];return _0x3904d8;};'use strict';var EventEmitter=require(_0xb228('0x0'));var FaxAccount=require(_0xb228('0x1'))['db'][_0xb228('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb228('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb228('0x4'),'afterDestroy':_0xb228('0x5')};function emitEvent(_0x4b81b1){return function(_0x1e1f6f,_0x26edbe,_0x4bfaa3){FaxAccountEvents[_0xb228('0x6')](_0x4b81b1+':'+_0x1e1f6f['id'],_0x1e1f6f);FaxAccountEvents['emit'](_0x4b81b1,_0x1e1f6f);_0x4bfaa3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xb228('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xdc84=['remove','emit','hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners'];(function(_0x6ec1c9,_0xfafd07){var _0x5a51d4=function(_0x8d8bdc){while(--_0x8d8bdc){_0x6ec1c9['push'](_0x6ec1c9['shift']());}};_0x5a51d4(++_0xfafd07);}(_0xdc84,0x1ad));var _0x4dc8=function(_0x23292a,_0x1e08ea){_0x23292a=_0x23292a-0x0;var _0x4564f2=_0xdc84[_0x23292a];return _0x4564f2;};'use strict';var EventEmitter=require(_0x4dc8('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x4dc8('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4dc8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4dc8('0x3')};function emitEvent(_0xa1a37b){return function(_0x3dd167,_0x2d61fb,_0x29b46e){FaxAccountEvents[_0x4dc8('0x4')](_0xa1a37b+':'+_0x3dd167['id'],_0x3dd167);FaxAccountEvents[_0x4dc8('0x4')](_0xa1a37b,_0x3dd167);_0x29b46e(null);};}for(var e in events){if(events[_0x4dc8('0x5')](e)){var event=events[e];FaxAccount[_0x4dc8('0x6')](e,emitEvent(event));}}module[_0x4dc8('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5672eab..62f6873 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 _0x6f1f=['define','FaxAccount','fax_accounts','lodash','util','../../config/logger','request-promise','path','rimraf','./faxAccount.attributes'];(function(_0x5a979b,_0x17a473){var _0x1abd9a=function(_0x48e37c){while(--_0x48e37c){_0x5a979b['push'](_0x5a979b['shift']());}};_0x1abd9a(++_0x17a473);}(_0x6f1f,0xcb));var _0xf6f1=function(_0x2a58f0,_0x32f72c){_0x2a58f0=_0x2a58f0-0x0;var _0x5583f7=_0x6f1f[_0x2a58f0];return _0x5583f7;};'use strict';var _=require(_0xf6f1('0x0'));var util=require(_0xf6f1('0x1'));var logger=require(_0xf6f1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6f1('0x3'));var fs=require('fs');var path=require(_0xf6f1('0x4'));var rimraf=require(_0xf6f1('0x5'));var config=require('../../config/environment');var attributes=require(_0xf6f1('0x6'));module['exports']=function(_0x22fe69,_0x331109){return _0x22fe69[_0xf6f1('0x7')](_0xf6f1('0x8'),attributes,{'tableName':_0xf6f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b19=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x1b19,0x144));var _0x91b1=function(_0xecb62f,_0x23338a){_0xecb62f=_0xecb62f-0x0;var _0x5df9ba=_0x1b19[_0xecb62f];return _0x5df9ba;};'use strict';var _=require(_0x91b1('0x0'));var util=require(_0x91b1('0x1'));var logger=require(_0x91b1('0x2'))(_0x91b1('0x3'));var moment=require(_0x91b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x91b1('0x5'));var fs=require('fs');var path=require(_0x91b1('0x6'));var rimraf=require(_0x91b1('0x7'));var config=require(_0x91b1('0x8'));var attributes=require(_0x91b1('0x9'));module[_0x91b1('0xa')]=function(_0x33ab65,_0x141d0e){return _0x33ab65[_0x91b1('0xb')](_0x91b1('0xc'),attributes,{'tableName':_0x91b1('0xd'),'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 baace2f..0d8005d 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 _0xe064=['client','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetFaxAccount','FaxAccount','options','raw','where','include','map','model','attributes','then','catch','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','body','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','asc','List','length','create','contact','FaxInteraction','close','unmanaged','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4f1b23,_0x1f9eb8){var _0x5b92f6=function(_0x5388d8){while(--_0x5388d8){_0x4f1b23['push'](_0x4f1b23['shift']());}};_0x5b92f6(++_0x1f9eb8);}(_0xe064,0x15b));var _0x4e06=function(_0x2952d5,_0x5a22e1){_0x2952d5=_0x2952d5-0x0;var _0x11a097=_0xe064[_0x2952d5];return _0x11a097;};'use strict';var _=require(_0x4e06('0x0'));var util=require(_0x4e06('0x1'));var moment=require('moment');var BPromise=require(_0x4e06('0x2'));var rs=require(_0x4e06('0x3'));var fs=require('fs');var Redis=require(_0x4e06('0x4'));var db=require(_0x4e06('0x5'))['db'];var utils=require(_0x4e06('0x6'));var logger=require(_0x4e06('0x7'))('rpc');var config=require(_0x4e06('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4e06('0x9')]['http']({'port':0x232c});config['redis']=_[_0x4e06('0xa')](config[_0x4e06('0xb')],{'host':_0x4e06('0xc'),'port':0x18eb});var socket=require(_0x4e06('0xd'))(new Redis(config[_0x4e06('0xb')]));require(_0x4e06('0xe'))['register'](socket);function respondWithRpcPromise(_0x44ffe7,_0x2f9743,_0x4cf90a){return new BPromise(function(_0x3c8f8d,_0x1cec43){return client[_0x4e06('0xf')](_0x44ffe7,_0x4cf90a)['then'](function(_0x42580f){logger[_0x4e06('0x10')](_0x4e06('0x11'),_0x2f9743,'request\x20sent');logger[_0x4e06('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2f9743,_0x4e06('0x13'),JSON[_0x4e06('0x14')](_0x42580f));if(_0x42580f[_0x4e06('0x15')]){if(_0x42580f['error'][_0x4e06('0x16')]===0x1f4){logger[_0x4e06('0x15')](_0x4e06('0x11'),_0x2f9743,_0x42580f[_0x4e06('0x15')][_0x4e06('0x17')]);return _0x1cec43(_0x42580f['error'][_0x4e06('0x17')]);}logger[_0x4e06('0x15')]('FaxAccount,\x20%s,\x20%s',_0x2f9743,_0x42580f[_0x4e06('0x15')][_0x4e06('0x17')]);return _0x3c8f8d(_0x42580f['error'][_0x4e06('0x17')]);}else{logger['info'](_0x4e06('0x11'),_0x2f9743,'request\x20sent');_0x3c8f8d(_0x42580f['result'][_0x4e06('0x17')]);}})['catch'](function(_0x55f66d){logger[_0x4e06('0x15')]('FaxAccount,\x20%s,\x20%s',_0x2f9743,_0x55f66d);_0x1cec43(_0x55f66d);});});}exports[_0x4e06('0x18')]=function(_0x15d3f1){var _0x3d5e44=this;return new Promise(function(_0x31ae91,_0x15452c){return db[_0x4e06('0x19')]['findAll']({'raw':_0x15d3f1['options']?_0x15d3f1[_0x4e06('0x1a')][_0x4e06('0x1b')]===undefined?!![]:![]:!![],'where':_0x15d3f1[_0x4e06('0x1a')]?_0x15d3f1['options'][_0x4e06('0x1c')]||null:null,'attributes':_0x15d3f1['options']?_0x15d3f1[_0x4e06('0x1a')]['attributes']||null:null,'limit':_0x15d3f1[_0x4e06('0x1a')]?_0x15d3f1[_0x4e06('0x1a')]['limit']||null:null,'include':_0x15d3f1[_0x4e06('0x1a')]?_0x15d3f1[_0x4e06('0x1a')][_0x4e06('0x1d')]?_[_0x4e06('0x1e')](_0x15d3f1['options'][_0x4e06('0x1d')],function(_0x12be42){return{'model':db[_0x12be42[_0x4e06('0x1f')]],'as':_0x12be42['as'],'attributes':_0x12be42[_0x4e06('0x20')],'include':_0x12be42[_0x4e06('0x1d')]?_[_0x4e06('0x1e')](_0x12be42['include'],function(_0x2c47b1){return{'model':db[_0x2c47b1['model']],'as':_0x2c47b1['as'],'attributes':_0x2c47b1[_0x4e06('0x20')],'include':_0x2c47b1[_0x4e06('0x1d')]?_[_0x4e06('0x1e')](_0x2c47b1[_0x4e06('0x1d')],function(_0x318559){return{'model':db[_0x318559[_0x4e06('0x1f')]],'as':_0x318559['as'],'attributes':_0x318559[_0x4e06('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4e06('0x21')](function(_0x5b6cf5){logger[_0x4e06('0x10')](_0x4e06('0x18'),_0x15d3f1);logger['debug'](_0x4e06('0x18'),_0x15d3f1,JSON['stringify'](_0x5b6cf5));_0x31ae91(_0x5b6cf5);})[_0x4e06('0x22')](function(_0x346df4){logger[_0x4e06('0x15')](_0x4e06('0x18'),_0x346df4[_0x4e06('0x17')],_0x15d3f1);_0x15452c(_0x3d5e44[_0x4e06('0x15')](0x1f4,_0x346df4[_0x4e06('0x17')]));});});};exports[_0x4e06('0x23')]=function(_0x3a2fc3,_0x2368d8,_0x3eaa87){var _0xbe8d51=this;return new Promise(function(_0xa34152,_0x1880c7){var _0x4a5eee={'body':_0x3a2fc3['body'],'channel':_0x4e06('0x24')};var _0x2e6149=[];var _0x1a2746=[];var _0x59b64c={};return db[_0x4e06('0x25')][_0x4e06('0x26')]()['then'](function(_0x3f817b){if(!_0x3f817b){throw new db['Sequelize'][(_0x4e06('0x27'))](_0x4e06('0x28'));}_0x2e6149=_[_0x4e06('0x29')](_[_0x4e06('0x2a')](_0x3f817b),[_0x4e06('0x2b'),_0x4e06('0x2c')]);_0x1a2746=_[_0x4e06('0x29')](_[_0x4e06('0x2a')](_0x3f817b),[_0x4e06('0x2b'),'updatedAt',_0x4e06('0x2d'),_0x4e06('0x2e')]);if(_0x3a2fc3['body']['id']){delete _0x3a2fc3['body']['id'];}if(_[_0x4e06('0x2f')](_0x3a2fc3[_0x4e06('0x30')][_0x4e06('0x31')])){throw new db[(_0x4e06('0x32'))][(_0x4e06('0x27'))]('from\x20is\x20mandatory');}if(_[_0x4e06('0x2f')](_0x3a2fc3['body'][_0x4e06('0x30')])||_0x3a2fc3[_0x4e06('0x30')]['body']===''){throw new db[(_0x4e06('0x32'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3a2fc3[_0x4e06('0x30')][_0x4e06('0x33')])){throw new db[(_0x4e06('0x32'))][(_0x4e06('0x27'))](_0x4e06('0x34')+_0x1a2746);}if(!_[_0x4e06('0x35')](_0x1a2746,_0x3a2fc3[_0x4e06('0x30')][_0x4e06('0x33')])){throw new db[(_0x4e06('0x32'))]['ValidationError'](_0x4e06('0x36')+_0x1a2746);}_0x59b64c[_0x3a2fc3['body'][_0x4e06('0x33')]]=_0x3a2fc3[_0x4e06('0x30')]['from'];})['then'](function(){return db[_0x4e06('0x19')][_0x4e06('0x37')]({'where':{'id':_0x3a2fc3[_0x4e06('0x38')]['id']},'include':[{'model':db[_0x4e06('0x39')],'as':'List','include':[{'model':db[_0x4e06('0x25')],'as':_0x4e06('0x3a'),'where':_0x59b64c,'limit':0x1,'order':[['updatedAt',_0x4e06('0x3b')]]}]},{'model':db[_0x4e06('0x3c')],'as':_0x4e06('0x3d')}]});})[_0x4e06('0x21')](function(_0x3ade3b){if(_0x3ade3b&&_0x3ade3b['List']){var _0x36b8e3=_0x3ade3b[_0x4e06('0x3e')]({'plain':!![]});_0x4a5eee[_0x4e06('0x38')]=_0x36b8e3;_0x4a5eee['applications']=_0x36b8e3[_0x4e06('0x3d')];_0x4a5eee[_0x4e06('0x3f')]=_0x36b8e3['List'];_0x4a5eee[_0x4e06('0x40')]=_[_0x4e06('0x41')](_0x4a5eee[_0x4e06('0x40')],['priority'],[_0x4e06('0x42')]);if(_0x4a5eee['account'][_0x4e06('0x3d')]){delete _0x4a5eee[_0x4e06('0x38')][_0x4e06('0x3d')];}if(_0x4a5eee['account'][_0x4e06('0x43')]&&_0x4a5eee[_0x4e06('0x38')][_0x4e06('0x43')]['Contacts'][_0x4e06('0x44')]){return _0x4a5eee['account'][_0x4e06('0x43')][_0x4e06('0x3a')][0x0];}var _0x4fc361=_[_0x4e06('0xa')](_0x3a2fc3['body'],{'firstName':_0x3a2fc3[_0x4e06('0x30')][_0x4e06('0x31')],'ListId':_0x36b8e3['ListId']});_0x4fc361[_0x3a2fc3[_0x4e06('0x30')][_0x4e06('0x33')]]=_0x3a2fc3['body'][_0x4e06('0x31')];return db[_0x4e06('0x25')][_0x4e06('0x45')](_0x4fc361,{'fields':_0x2e6149,'raw':!![]});}})['then'](function(_0x3b99ce){_0x4a5eee[_0x4e06('0x46')]=_0x3b99ce;if(_0x3b99ce){var _0x3dc95c={'ContactId':_0x3b99ce['id'],'FaxAccountId':_0x3a2fc3[_0x4e06('0x38')]['id'],'fax':_0x3b99ce['fax']};return db['FaxInteraction'][_0x4e06('0x37')]({'where':{'ContactId':_0x3b99ce['id'],'closed':![],'FaxAccountId':_0x3a2fc3[_0x4e06('0x38')]['id']}})[_0x4e06('0x21')](function(_0x6769e7){if(_0x6769e7){return[_0x6769e7,![]];}return db[_0x4e06('0x47')][_0x4e06('0x45')](_0x3dc95c)['then'](function(_0x323e52){return[_0x323e52,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x22dd74,_0x2b38a2){var _0x2ec091=_0x22dd74['get']({'plain':!![]});if(_0x2b38a2){if(_0x4a5eee[_0x4e06('0x38')]['autoclose']){_0x4a5eee[_0x4e06('0x40')]['push']({'id':0x0,'priority':_0x4a5eee['applications'][_0x4e06('0x44')]+0x1,'app':_0x4e06('0x48'),'appdata':_0x4e06('0x49'),'interval':_0x4e06('0x4a')});}_0x2ec091['created']=!![];}else{_0x2ec091['created']=![];}_0x4a5eee[_0x4e06('0x4b')]=_0x2ec091;return db[_0x4e06('0x4c')][_0x4e06('0x45')]({'body':_0x3a2fc3[_0x4e06('0x30')]['body'],'FaxAccountId':_0x3a2fc3[_0x4e06('0x38')]['id'],'FaxInteractionId':_0x22dd74['id'],'direction':'in','ContactId':_0x22dd74[_0x4e06('0x4d')],'AttachmentId':_0x3a2fc3[_0x4e06('0x30')][_0x4e06('0x4e')]});})[_0x4e06('0x21')](function(_0x297302){_0x4a5eee[_0x4e06('0x17')]=_0x297302;if(!_0x4a5eee['interaction'][_0x4e06('0x4f')])return;return db[_0x4e06('0x50')][_0x4e06('0x37')]({'attributes':['id',_0x4e06('0x51')],'where':{'id':_0x4a5eee[_0x4e06('0x4b')]['UserId']}});})[_0x4e06('0x21')](function(_0x3a0f87){if(_0x3a0f87){_0x4a5eee[_0x4e06('0x40')][_0x4e06('0x52')]({'id':0x0,'priority':0x0,'app':_0x4e06('0x53'),'appdata':_0x3a0f87['name']+','+(_0x4a5eee[_0x4e06('0x38')]['waitForTheAssignedAgent']||0xa),'interval':_0x4e06('0x4a')});}if(!_0x4a5eee['interaction'][_0x4e06('0x54')])return;return db['FaxQueue'][_0x4e06('0x37')]({'attributes':['id',_0x4e06('0x51')],'where':{'id':_0x4a5eee[_0x4e06('0x4b')]['queueId']}});})[_0x4e06('0x21')](function(_0x5021a0){if(_0x5021a0){_0x4a5eee[_0x4e06('0x40')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4e06('0x55'),'appdata':_0x5021a0[_0x4e06('0x51')]+','+(_0x4a5eee[_0x4e06('0x38')][_0x4e06('0x56')]||0x12c),'interval':_0x4e06('0x4a')});}return respondWithRpcPromise(_0x4e06('0x57'),_0x4e06('0x58'),_0x4a5eee);})[_0x4e06('0x21')](function(_0x5211a7){_0xa34152(_0x5211a7);})[_0x4e06('0x22')](function(_0x2a5687){_0x1880c7(_0xbe8d51[_0x4e06('0x15')](0x1f4,_0x2a5687['message']));});});}; \ No newline at end of file +var _0xe94b=['spread','autoclose','push','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetFaxAccount','FaxAccount','findAll','raw','options','where','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','find','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','Contacts','CmContact','create','FaxInteraction','Contact\x20not\x20found'];(function(_0x183bc5,_0x53b410){var _0x3fa5c9=function(_0x1b1c2b){while(--_0x1b1c2b){_0x183bc5['push'](_0x183bc5['shift']());}};_0x3fa5c9(++_0x53b410);}(_0xe94b,0x127));var _0xbe94=function(_0x431c8e,_0x129e49){_0x431c8e=_0x431c8e-0x0;var _0x33c2a2=_0xe94b[_0x431c8e];return _0x33c2a2;};'use strict';var _=require(_0xbe94('0x0'));var util=require(_0xbe94('0x1'));var moment=require(_0xbe94('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe94('0x3'));var db=require(_0xbe94('0x4'))['db'];var utils=require(_0xbe94('0x5'));var logger=require(_0xbe94('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe94('0x7')][_0xbe94('0x8')]({'port':0x232c});config[_0xbe94('0x9')]=_[_0xbe94('0xa')](config[_0xbe94('0x9')],{'host':_0xbe94('0xb'),'port':0x18eb});var socket=require(_0xbe94('0xc'))(new Redis(config[_0xbe94('0x9')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x324ba5,_0x526fc3,_0x119c21){return new BPromise(function(_0x2dc572,_0x4da3f4){return client[_0xbe94('0xd')](_0x324ba5,_0x119c21)[_0xbe94('0xe')](function(_0xc739dd){logger[_0xbe94('0xf')](_0xbe94('0x10'),_0x526fc3,'request\x20sent');logger[_0xbe94('0x11')](_0xbe94('0x12'),_0x526fc3,'request\x20sent',JSON[_0xbe94('0x13')](_0xc739dd));if(_0xc739dd[_0xbe94('0x14')]){if(_0xc739dd['error'][_0xbe94('0x15')]===0x1f4){logger['error'](_0xbe94('0x10'),_0x526fc3,_0xc739dd[_0xbe94('0x14')]['message']);return _0x4da3f4(_0xc739dd['error'][_0xbe94('0x16')]);}logger['error'](_0xbe94('0x10'),_0x526fc3,_0xc739dd[_0xbe94('0x14')][_0xbe94('0x16')]);return _0x2dc572(_0xc739dd[_0xbe94('0x14')]['message']);}else{logger[_0xbe94('0xf')](_0xbe94('0x10'),_0x526fc3,_0xbe94('0x17'));_0x2dc572(_0xc739dd['result'][_0xbe94('0x16')]);}})['catch'](function(_0x2922fb){logger['error']('FaxAccount,\x20%s,\x20%s',_0x526fc3,_0x2922fb);_0x4da3f4(_0x2922fb);});});}exports[_0xbe94('0x18')]=function(_0xfa0438){var _0x40ee8e=this;return new Promise(function(_0x48d3af,_0x44206b){return db[_0xbe94('0x19')][_0xbe94('0x1a')]({'raw':_0xfa0438['options']?_0xfa0438['options'][_0xbe94('0x1b')]===undefined?!![]:![]:!![],'where':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x1d')]||null:null,'attributes':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x1e')]||null:null,'limit':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x1f')]||null:null,'include':_0xfa0438[_0xbe94('0x1c')]?_0xfa0438['options'][_0xbe94('0x20')]?_[_0xbe94('0x21')](_0xfa0438[_0xbe94('0x1c')][_0xbe94('0x20')],function(_0x273ff9){return{'model':db[_0x273ff9[_0xbe94('0x22')]],'as':_0x273ff9['as'],'attributes':_0x273ff9['attributes'],'include':_0x273ff9[_0xbe94('0x20')]?_[_0xbe94('0x21')](_0x273ff9[_0xbe94('0x20')],function(_0x4544b5){return{'model':db[_0x4544b5['model']],'as':_0x4544b5['as'],'attributes':_0x4544b5[_0xbe94('0x1e')],'include':_0x4544b5['include']?_[_0xbe94('0x21')](_0x4544b5[_0xbe94('0x20')],function(_0x2de05b){return{'model':db[_0x2de05b[_0xbe94('0x22')]],'as':_0x2de05b['as'],'attributes':_0x2de05b[_0xbe94('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbe94('0xe')](function(_0x330082){logger['info'](_0xbe94('0x18'),_0xfa0438);logger[_0xbe94('0x11')]('GetFaxAccount',_0xfa0438,JSON[_0xbe94('0x13')](_0x330082));_0x48d3af(_0x330082);})[_0xbe94('0x23')](function(_0x2e5da6){logger['error'](_0xbe94('0x18'),_0x2e5da6[_0xbe94('0x16')],_0xfa0438);_0x44206b(_0x40ee8e[_0xbe94('0x14')](0x1f4,_0x2e5da6[_0xbe94('0x16')]));});});};exports[_0xbe94('0x24')]=function(_0x1b306c,_0x1d76f2,_0x13c52a){var _0x459bc0=this;return new Promise(function(_0x2668d8,_0x3a0ba8){var _0x160390={'body':_0x1b306c[_0xbe94('0x25')],'channel':'fax'};var _0x4e6f45=[];var _0x370f4a=[];var _0x464277={};return db['CmContact']['describe']()[_0xbe94('0xe')](function(_0x335f8a){if(!_0x335f8a){throw new db['Sequelize']['ValidationError'](_0xbe94('0x26'));}_0x4e6f45=_[_0xbe94('0x27')](_[_0xbe94('0x28')](_0x335f8a),[_0xbe94('0x29'),_0xbe94('0x2a')]);_0x370f4a=_[_0xbe94('0x27')](_[_0xbe94('0x28')](_0x335f8a),[_0xbe94('0x29'),_0xbe94('0x2a'),_0xbe94('0x2b'),_0xbe94('0x2c')]);if(_0x1b306c[_0xbe94('0x25')]['id']){delete _0x1b306c['body']['id'];}if(_[_0xbe94('0x2d')](_0x1b306c[_0xbe94('0x25')][_0xbe94('0x2e')])){throw new db['Sequelize'][(_0xbe94('0x2f'))](_0xbe94('0x30'));}if(_[_0xbe94('0x2d')](_0x1b306c[_0xbe94('0x25')]['body'])||_0x1b306c['body'][_0xbe94('0x25')]===''){throw new db[(_0xbe94('0x31'))][(_0xbe94('0x2f'))](_0xbe94('0x32'));}if(_[_0xbe94('0x2d')](_0x1b306c[_0xbe94('0x25')][_0xbe94('0x33')])){throw new db['Sequelize'][(_0xbe94('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x370f4a);}if(!_['includes'](_0x370f4a,_0x1b306c[_0xbe94('0x25')]['mapKey'])){throw new db[(_0xbe94('0x31'))][(_0xbe94('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x370f4a);}_0x464277[_0x1b306c[_0xbe94('0x25')]['mapKey']]=_0x1b306c[_0xbe94('0x25')][_0xbe94('0x2e')];})['then'](function(){return db[_0xbe94('0x19')][_0xbe94('0x34')]({'where':{'id':_0x1b306c[_0xbe94('0x35')]['id']},'include':[{'model':db[_0xbe94('0x36')],'as':_0xbe94('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x464277,'limit':0x1,'order':[[_0xbe94('0x2a'),_0xbe94('0x38')]]}]},{'model':db[_0xbe94('0x39')],'as':_0xbe94('0x3a')}]});})[_0xbe94('0xe')](function(_0x4cb28a){if(_0x4cb28a&&_0x4cb28a[_0xbe94('0x37')]){var _0x4aee52=_0x4cb28a[_0xbe94('0x3b')]({'plain':!![]});_0x160390[_0xbe94('0x35')]=_0x4aee52;_0x160390[_0xbe94('0x3c')]=_0x4aee52[_0xbe94('0x3a')];_0x160390[_0xbe94('0x3d')]=_0x4aee52[_0xbe94('0x37')];_0x160390['applications']=_[_0xbe94('0x3e')](_0x160390[_0xbe94('0x3c')],['priority'],[_0xbe94('0x3f')]);if(_0x160390[_0xbe94('0x35')][_0xbe94('0x3a')]){delete _0x160390['account'][_0xbe94('0x3a')];}if(_0x160390[_0xbe94('0x35')][_0xbe94('0x37')]&&_0x160390[_0xbe94('0x35')]['List'][_0xbe94('0x40')]['length']){return _0x160390[_0xbe94('0x35')]['List']['Contacts'][0x0];}var _0x57bf34=_[_0xbe94('0xa')](_0x1b306c[_0xbe94('0x25')],{'firstName':_0x1b306c['body'][_0xbe94('0x2e')],'ListId':_0x4aee52['ListId']});_0x57bf34[_0x1b306c[_0xbe94('0x25')]['mapKey']]=_0x1b306c[_0xbe94('0x25')][_0xbe94('0x2e')];return db[_0xbe94('0x41')][_0xbe94('0x42')](_0x57bf34,{'fields':_0x4e6f45,'raw':!![]});}})[_0xbe94('0xe')](function(_0x359bd3){_0x160390['contact']=_0x359bd3;if(_0x359bd3){var _0x373160={'ContactId':_0x359bd3['id'],'FaxAccountId':_0x1b306c[_0xbe94('0x35')]['id'],'fax':_0x359bd3['fax']};return db[_0xbe94('0x43')][_0xbe94('0x34')]({'where':{'ContactId':_0x359bd3['id'],'closed':![],'FaxAccountId':_0x1b306c[_0xbe94('0x35')]['id']}})[_0xbe94('0xe')](function(_0x5850f2){if(_0x5850f2){return[_0x5850f2,![]];}return db[_0xbe94('0x43')][_0xbe94('0x42')](_0x373160)[_0xbe94('0xe')](function(_0x183f2e){return[_0x183f2e,!![]];});});}else{throw new Error(_0xbe94('0x44'));}})[_0xbe94('0x45')](function(_0x3d175d,_0x5a3861){var _0x314e4e=_0x3d175d[_0xbe94('0x3b')]({'plain':!![]});if(_0x5a3861){if(_0x160390[_0xbe94('0x35')][_0xbe94('0x46')]){_0x160390[_0xbe94('0x3c')][_0xbe94('0x47')]({'id':0x0,'priority':_0x160390[_0xbe94('0x3c')][_0xbe94('0x48')]+0x1,'app':_0xbe94('0x49'),'appdata':_0xbe94('0x4a'),'interval':'*,*,*,*'});}_0x314e4e[_0xbe94('0x4b')]=!![];}else{_0x314e4e[_0xbe94('0x4b')]=![];}_0x160390[_0xbe94('0x4c')]=_0x314e4e;return db[_0xbe94('0x4d')][_0xbe94('0x42')]({'body':_0x1b306c[_0xbe94('0x25')][_0xbe94('0x25')],'FaxAccountId':_0x1b306c[_0xbe94('0x35')]['id'],'FaxInteractionId':_0x3d175d['id'],'direction':'in','ContactId':_0x3d175d[_0xbe94('0x4e')],'AttachmentId':_0x1b306c[_0xbe94('0x25')][_0xbe94('0x4f')]});})['then'](function(_0x52870c){_0x160390[_0xbe94('0x16')]=_0x52870c;if(!_0x160390['interaction'][_0xbe94('0x50')])return;return db[_0xbe94('0x51')][_0xbe94('0x34')]({'attributes':['id',_0xbe94('0x52')],'where':{'id':_0x160390[_0xbe94('0x4c')][_0xbe94('0x50')]}});})[_0xbe94('0xe')](function(_0x33a8e5){if(_0x33a8e5){_0x160390[_0xbe94('0x3c')][_0xbe94('0x53')]({'id':0x0,'priority':0x0,'app':_0xbe94('0x54'),'appdata':_0x33a8e5[_0xbe94('0x52')]+','+(_0x160390[_0xbe94('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0xbe94('0x55')});}if(!_0x160390[_0xbe94('0x4c')][_0xbe94('0x56')])return;return db[_0xbe94('0x57')][_0xbe94('0x34')]({'attributes':['id',_0xbe94('0x52')],'where':{'id':_0x160390['interaction']['queueId']}});})['then'](function(_0x47cdb6){if(_0x47cdb6){_0x160390['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xbe94('0x58'),'appdata':_0x47cdb6[_0xbe94('0x52')]+','+(_0x160390['account'][_0xbe94('0x59')]||0x12c),'interval':_0xbe94('0x55')});}return respondWithRpcPromise('Start',_0xbe94('0x5a'),_0x160390);})['then'](function(_0x3f54db){_0x2668d8(_0x3f54db);})[_0xbe94('0x23')](function(_0x328f03){_0x3a0ba8(_0x459bc0[_0xbe94('0x14')](0x1f4,_0x328f03['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b67d811..0cc7435 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 _0xdcf1=['emit','register','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x5e544c,_0x3d902a){var _0x44f61c=function(_0x6ebcb5){while(--_0x6ebcb5){_0x5e544c['push'](_0x5e544c['shift']());}};_0x44f61c(++_0x3d902a);}(_0xdcf1,0x106));var _0x1dcf=function(_0x206f4b,_0x346117){_0x206f4b=_0x206f4b-0x0;var _0x20599c=_0xdcf1[_0x206f4b];return _0x20599c;};'use strict';var FaxAccountEvents=require(_0x1dcf('0x0'));var events=[_0x1dcf('0x1'),_0x1dcf('0x2'),_0x1dcf('0x3')];function createListener(_0x17d828,_0x872980){return function(_0x598437){_0x872980[_0x1dcf('0x4')](_0x17d828,_0x598437);};}function removeListener(_0x3e50a5,_0x175344){return function(){FaxAccountEvents['removeListener'](_0x3e50a5,_0x175344);};}exports[_0x1dcf('0x5')]=function(_0x358c93){for(var _0x145a66=0x0,_0x2ce354=events['length'];_0x145a66<_0x2ce354;_0x145a66++){var _0x797f81=events[_0x145a66];var _0x2a3c72=createListener(_0x1dcf('0x6')+_0x797f81,_0x358c93);FaxAccountEvents['on'](_0x797f81,_0x2a3c72);}}; \ No newline at end of file +var _0xac44=['length','faxAccount:','./faxAccount.events','update','emit','removeListener'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xac44,0x18e));var _0x4ac4=function(_0x358939,_0x4bc62e){_0x358939=_0x358939-0x0;var _0x5b8181=_0xac44[_0x358939];return _0x5b8181;};'use strict';var FaxAccountEvents=require(_0x4ac4('0x0'));var events=['save','remove',_0x4ac4('0x1')];function createListener(_0x2a02ad,_0x20229c){return function(_0x1aba32){_0x20229c[_0x4ac4('0x2')](_0x2a02ad,_0x1aba32);};}function removeListener(_0x13f8a9,_0xea9b09){return function(){FaxAccountEvents[_0x4ac4('0x3')](_0x13f8a9,_0xea9b09);};}exports['register']=function(_0x2c8f53){for(var _0x1997f0=0x0,_0x4cf3bc=events[_0x4ac4('0x4')];_0x1997f0<_0x4cf3bc;_0x1997f0++){var _0x17ca34=events[_0x1997f0];var _0x140eae=createListener(_0x4ac4('0x5')+_0x17ca34,_0x2c8f53);FaxAccountEvents['on'](_0x17ca34,_0x140eae);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4c0a246..bc8ec43 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 _0xa147=['addInteraction','addApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','/:id','/:id/dispositions','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers'];(function(_0x1cd1c6,_0x22e9e9){var _0x13b566=function(_0x26a2ad){while(--_0x26a2ad){_0x1cd1c6['push'](_0x1cd1c6['shift']());}};_0x13b566(++_0x22e9e9);}(_0xa147,0x83));var _0x7a14=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa147[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x7a14('0x0'));var util=require(_0x7a14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a14('0x2'));var router=express[_0x7a14('0x3')]();var fs_extra=require(_0x7a14('0x4'));var auth=require(_0x7a14('0x5'));var interaction=require(_0x7a14('0x6'));var config=require(_0x7a14('0x7'));var controller=require(_0x7a14('0x8'));router[_0x7a14('0x9')]('/',auth[_0x7a14('0xa')](),controller['index']);router['get'](_0x7a14('0xb'),auth[_0x7a14('0xa')](),controller['describe']);router['get'](_0x7a14('0xc'),auth[_0x7a14('0xa')](),controller['show']);router['get'](_0x7a14('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x7a14('0x9')]('/:id/canned_answers',auth[_0x7a14('0xa')](),controller[_0x7a14('0xe')]);router[_0x7a14('0x9')](_0x7a14('0xf'),auth[_0x7a14('0xa')](),controller['getInteractions']);router[_0x7a14('0x9')](_0x7a14('0x10'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x11')]);router[_0x7a14('0x9')](_0x7a14('0x12'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x13')]);router[_0x7a14('0x9')](_0x7a14('0x14'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x15')]);router['post']('/',auth[_0x7a14('0xa')](),controller['create']);router[_0x7a14('0x16')](_0x7a14('0xd'),auth['isAuthenticated'](),controller[_0x7a14('0x17')]);router[_0x7a14('0x16')](_0x7a14('0x18'),auth[_0x7a14('0xa')](),controller['addAnswer']);router[_0x7a14('0x16')](_0x7a14('0xf'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x19')]);router[_0x7a14('0x16')](_0x7a14('0x10'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x1a')]);router[_0x7a14('0x16')]('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x7a14('0x16')](_0x7a14('0x1b'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x1c')]);router['post'](_0x7a14('0x1d'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x1e')]);router[_0x7a14('0x16')](_0x7a14('0x14'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x1f')]);router[_0x7a14('0x20')](_0x7a14('0xc'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x21')]);router['delete'](_0x7a14('0xc'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x22')]);router[_0x7a14('0x23')](_0x7a14('0xd'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x24')]);router[_0x7a14('0x23')](_0x7a14('0x18'),auth[_0x7a14('0xa')](),controller[_0x7a14('0x25')]);router[_0x7a14('0x23')](_0x7a14('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7a14('0x26')]=router; \ No newline at end of file +var _0xa9b6=['send','/:id/users','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','describe','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send'];(function(_0x67d4ca,_0x455f15){var _0xc53c24=function(_0x3645e4){while(--_0x3645e4){_0x67d4ca['push'](_0x67d4ca['shift']());}};_0xc53c24(++_0x455f15);}(_0xa9b6,0x1c2));var _0x6a9b=function(_0x554f4a,_0x12998b){_0x554f4a=_0x554f4a-0x0;var _0x1a5eec=_0xa9b6[_0x554f4a];return _0x1a5eec;};'use strict';var multer=require(_0x6a9b('0x0'));var util=require(_0x6a9b('0x1'));var path=require(_0x6a9b('0x2'));var timeout=require(_0x6a9b('0x3'));var express=require(_0x6a9b('0x4'));var router=express[_0x6a9b('0x5')]();var fs_extra=require(_0x6a9b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6a9b('0x7'));var config=require(_0x6a9b('0x8'));var controller=require('./faxAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6a9b('0x9')]);router[_0x6a9b('0xa')](_0x6a9b('0xb'),auth['isAuthenticated'](),controller[_0x6a9b('0xc')]);router[_0x6a9b('0xa')]('/:id',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0xe')]);router[_0x6a9b('0xa')](_0x6a9b('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x6a9b('0xa')](_0x6a9b('0x10'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x11')]);router[_0x6a9b('0xa')](_0x6a9b('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x6a9b('0xa')](_0x6a9b('0x13'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x14')]);router[_0x6a9b('0xa')](_0x6a9b('0x15'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x16')]);router[_0x6a9b('0xa')]('/:id/users',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x17')]);router[_0x6a9b('0x18')]('/',auth['isAuthenticated'](),controller[_0x6a9b('0x19')]);router[_0x6a9b('0x18')]('/:id/dispositions',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x1a')]);router[_0x6a9b('0x18')]('/:id/canned_answers',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x1b')]);router['post'](_0x6a9b('0x12'),auth['isAuthenticated'](),controller[_0x6a9b('0x1c')]);router[_0x6a9b('0x18')](_0x6a9b('0x13'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x1d')]);router[_0x6a9b('0x18')](_0x6a9b('0x1e'),auth[_0x6a9b('0xd')](),controller['addAccountApplications']);router['post'](_0x6a9b('0x1f'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x20')]);router[_0x6a9b('0x18')](_0x6a9b('0x21'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x22')]);router['post'](_0x6a9b('0x23'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x24')]);router['put'](_0x6a9b('0x25'),auth['isAuthenticated'](),controller[_0x6a9b('0x26')]);router[_0x6a9b('0x27')]('/:id',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x28')]);router[_0x6a9b('0x27')](_0x6a9b('0xf'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x29')]);router[_0x6a9b('0x27')](_0x6a9b('0x10'),auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x2a')]);router[_0x6a9b('0x27')]('/:id/users',auth[_0x6a9b('0xd')](),controller[_0x6a9b('0x2b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b30606e..c91666b 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 _0x7fe9=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x642240,_0xd34510){var _0x5d89c9=function(_0x33e2c7){while(--_0x33e2c7){_0x642240['push'](_0x642240['shift']());}};_0x5d89c9(++_0xd34510);}(_0x7fe9,0x9d));var _0x97fe=function(_0x4463eb,_0x3cd3fb){_0x4463eb=_0x4463eb-0x0;var _0x1d20d5=_0x7fe9[_0x4463eb];return _0x1d20d5;};'use strict';var Sequelize=require('sequelize');module[_0x97fe('0x0')]={'priority':{'type':Sequelize[_0x97fe('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x97fe('0x2')],'allowNull':![],'defaultValue':_0x97fe('0x3')},'appdata':{'type':Sequelize[_0x97fe('0x4')]()},'description':{'type':Sequelize[_0x97fe('0x2')]},'interval':{'type':Sequelize[_0x97fe('0x2')],'defaultValue':_0x97fe('0x5')}}; \ No newline at end of file +var _0xb33a=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5767af,_0x30c2a0){var _0x192700=function(_0x209457){while(--_0x209457){_0x5767af['push'](_0x5767af['shift']());}};_0x192700(++_0x30c2a0);}(_0xb33a,0xdb));var _0xab33=function(_0x2bcaaa,_0x56fde6){_0x2bcaaa=_0x2bcaaa-0x0;var _0x11928e=_0xb33a[_0x2bcaaa];return _0x11928e;};'use strict';var Sequelize=require(_0xab33('0x0'));module[_0xab33('0x1')]={'priority':{'type':Sequelize[_0xab33('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xab33('0x3')],'allowNull':![],'defaultValue':_0xab33('0x4')},'appdata':{'type':Sequelize[_0xab33('0x5')]()},'description':{'type':Sequelize[_0xab33('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xab33('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5aa7ed4..477c0d0 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 _0xe2ed=['Content-Range','apply','reject','save','update','then','destroy','name','send','map','FaxApplication','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set'];(function(_0x21ec8c,_0x1e58c6){var _0x18f950=function(_0x4f08a3){while(--_0x4f08a3){_0x21ec8c['push'](_0x21ec8c['shift']());}};_0x18f950(++_0x1e58c6);}(_0xe2ed,0x14e));var _0xde2e=function(_0x43ee9d,_0x45bbf7){_0x43ee9d=_0x43ee9d-0x0;var _0x355ded=_0xe2ed[_0x43ee9d];return _0x355ded;};'use strict';var emlformat=require(_0xde2e('0x0'));var rimraf=require(_0xde2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde2e('0x2'));var rp=require(_0xde2e('0x3'));var moment=require(_0xde2e('0x4'));var BPromise=require(_0xde2e('0x5'));var Mustache=require(_0xde2e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xde2e('0x7'));var fs=require('fs');var fs_extra=require(_0xde2e('0x8'));var _=require(_0xde2e('0x9'));var squel=require(_0xde2e('0xa'));var crypto=require(_0xde2e('0xb'));var jsforce=require(_0xde2e('0xc'));var deskjs=require(_0xde2e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xde2e('0xe'));var Redis=require(_0xde2e('0xf'));var authService=require(_0xde2e('0x10'));var qs=require(_0xde2e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde2e('0x12'));var logger=require('../../config/logger')(_0xde2e('0x13'));var utils=require(_0xde2e('0x14'));var config=require(_0xde2e('0x15'));var licenseUtil=require(_0xde2e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29a1de,_0x204bf5){_0x204bf5=_0x204bf5||0xcc;return function(_0x2648ac){if(_0x2648ac){return _0x29a1de['sendStatus'](_0x204bf5);}return _0x29a1de[_0xde2e('0x17')](_0x204bf5)[_0xde2e('0x18')]();};}function respondWithResult(_0x2137d7,_0x156de7){_0x156de7=_0x156de7||0xc8;return function(_0x3a590f){if(_0x3a590f){return _0x2137d7[_0xde2e('0x17')](_0x156de7)[_0xde2e('0x19')](_0x3a590f);}};}function respondWithFilteredResult(_0x11dd70,_0x11d0c6){return function(_0x1f76d9){if(_0x1f76d9){var _0x240ca1=typeof _0x11d0c6[_0xde2e('0x1a')]==='undefined'&&typeof _0x11d0c6[_0xde2e('0x1b')]===_0xde2e('0x1c');var _0x5dda20=_0x1f76d9[_0xde2e('0x1d')];var _0x4daf78=_0x240ca1?0x0:_0x11d0c6[_0xde2e('0x1a')];var _0xff7c11=_0x240ca1?_0x1f76d9[_0xde2e('0x1d')]:_0x11d0c6[_0xde2e('0x1a')]+_0x11d0c6[_0xde2e('0x1b')];var _0x38faf3;if(_0xff7c11>=_0x5dda20){_0xff7c11=_0x5dda20;_0x38faf3=0xc8;}else{_0x38faf3=0xce;}_0x11dd70[_0xde2e('0x17')](_0x38faf3);return _0x11dd70[_0xde2e('0x1e')](_0xde2e('0x1f'),_0x4daf78+'-'+_0xff7c11+'/'+_0x5dda20)['json'](_0x1f76d9);}return null;};}function patchUpdates(_0x36ffa0){return function(_0x4eacca){try{jsonpatch[_0xde2e('0x20')](_0x4eacca,_0x36ffa0,!![]);}catch(_0x25d66b){return BPromise[_0xde2e('0x21')](_0x25d66b);}return _0x4eacca[_0xde2e('0x22')]();};}function saveUpdates(_0x4400ef,_0x2b3f91){return function(_0x418136){if(_0x418136){return _0x418136[_0xde2e('0x23')](_0x4400ef)[_0xde2e('0x24')](function(_0x2e559c){return _0x2e559c;});}return null;};}function removeEntity(_0x44c065,_0x1dadc2){return function(_0x465028){if(_0x465028){return _0x465028[_0xde2e('0x25')]()[_0xde2e('0x24')](function(){_0x44c065['status'](0xcc)[_0xde2e('0x18')]();});}};}function handleEntityNotFound(_0x1c1b37,_0x5ee0e1){return function(_0x3403f6){if(!_0x3403f6){_0x1c1b37['sendStatus'](0x194);}return _0x3403f6;};}function handleError(_0x4991d1,_0x230525){_0x230525=_0x230525||0x1f4;return function(_0x3dfe25){logger['error'](_0x3dfe25['stack']);if(_0x3dfe25[_0xde2e('0x26')]){delete _0x3dfe25[_0xde2e('0x26')];}_0x4991d1[_0xde2e('0x17')](_0x230525)[_0xde2e('0x27')](_0x3dfe25);};}exports['index']=function(_0x5589af,_0x28762a){var _0x217cb4={},_0x4b6c6b={},_0x45b9be={'count':0x0,'rows':[]};var _0x5dbb18=_[_0xde2e('0x28')](db[_0xde2e('0x29')][_0xde2e('0x2a')],function(_0x18334a){return{'name':_0x18334a[_0xde2e('0x2b')],'type':_0x18334a[_0xde2e('0x2c')]['key']};});_0x4b6c6b[_0xde2e('0x2d')]=_['map'](_0x5dbb18,'name');_0x4b6c6b['query']=_[_0xde2e('0x2e')](_0x5589af[_0xde2e('0x2f')]);_0x4b6c6b[_0xde2e('0x30')]=_['intersection'](_0x4b6c6b[_0xde2e('0x2d')],_0x4b6c6b[_0xde2e('0x2f')]);_0x217cb4[_0xde2e('0x31')]=_[_0xde2e('0x32')](_0x4b6c6b[_0xde2e('0x2d')],qs[_0xde2e('0x33')](_0x5589af[_0xde2e('0x2f')]['fields']));_0x217cb4[_0xde2e('0x31')]=_0x217cb4[_0xde2e('0x31')]['length']?_0x217cb4[_0xde2e('0x31')]:_0x4b6c6b[_0xde2e('0x2d')];if(!_0x5589af[_0xde2e('0x2f')][_0xde2e('0x34')](_0xde2e('0x35'))){_0x217cb4['limit']=qs[_0xde2e('0x1b')](_0x5589af[_0xde2e('0x2f')][_0xde2e('0x1b')]);_0x217cb4[_0xde2e('0x1a')]=qs[_0xde2e('0x1a')](_0x5589af[_0xde2e('0x2f')][_0xde2e('0x1a')]);}_0x217cb4[_0xde2e('0x36')]=qs[_0xde2e('0x37')](_0x5589af[_0xde2e('0x2f')][_0xde2e('0x37')]);_0x217cb4[_0xde2e('0x38')]=qs[_0xde2e('0x30')](_[_0xde2e('0x39')](_0x5589af[_0xde2e('0x2f')],_0x4b6c6b[_0xde2e('0x30')]),_0x5dbb18);if(_0x5589af['query'][_0xde2e('0x3a')]){_0x217cb4[_0xde2e('0x38')]=_[_0xde2e('0x3b')](_0x217cb4[_0xde2e('0x38')],{'$or':_[_0xde2e('0x28')](_0x5dbb18,function(_0x3efc69){if(_0x3efc69['type']!==_0xde2e('0x3c')){var _0x286d47={};_0x286d47[_0x3efc69['name']]={'$like':'%'+_0x5589af[_0xde2e('0x2f')]['filter']+'%'};return _0x286d47;}})});}_0x217cb4=_[_0xde2e('0x3b')]({},_0x217cb4,_0x5589af['options']);var _0x41a6e9={'where':_0x217cb4[_0xde2e('0x38')]};return db['FaxApplication'][_0xde2e('0x1d')](_0x41a6e9)[_0xde2e('0x24')](function(_0x296e51){_0x45b9be[_0xde2e('0x1d')]=_0x296e51;if(_0x5589af[_0xde2e('0x2f')][_0xde2e('0x3d')]){_0x217cb4[_0xde2e('0x3e')]=[{'all':!![]}];}return db[_0xde2e('0x29')][_0xde2e('0x3f')](_0x217cb4);})['then'](function(_0x339547){_0x45b9be[_0xde2e('0x40')]=_0x339547;return _0x45b9be;})['then'](respondWithFilteredResult(_0x28762a,_0x217cb4))[_0xde2e('0x41')](handleError(_0x28762a,null));};exports[_0xde2e('0x42')]=function(_0x3d37b2,_0xa5d68a){var _0x3bbe18={'raw':!![],'where':{'id':_0x3d37b2[_0xde2e('0x43')]['id']}},_0x1562f1={};_0x1562f1[_0xde2e('0x2d')]=_[_0xde2e('0x2e')](db[_0xde2e('0x29')]['rawAttributes']);_0x1562f1['query']=_[_0xde2e('0x2e')](_0x3d37b2[_0xde2e('0x2f')]);_0x1562f1['filters']=_[_0xde2e('0x32')](_0x1562f1[_0xde2e('0x2d')],_0x1562f1[_0xde2e('0x2f')]);_0x3bbe18[_0xde2e('0x31')]=_['intersection'](_0x1562f1['model'],qs[_0xde2e('0x33')](_0x3d37b2[_0xde2e('0x2f')][_0xde2e('0x33')]));_0x3bbe18['attributes']=_0x3bbe18[_0xde2e('0x31')][_0xde2e('0x44')]?_0x3bbe18[_0xde2e('0x31')]:_0x1562f1['model'];if(_0x3d37b2['query'][_0xde2e('0x3d')]){_0x3bbe18[_0xde2e('0x3e')]=[{'all':!![]}];}_0x3bbe18=_['merge']({},_0x3bbe18,_0x3d37b2[_0xde2e('0x45')]);return db[_0xde2e('0x29')]['find'](_0x3bbe18)[_0xde2e('0x24')](handleEntityNotFound(_0xa5d68a,null))[_0xde2e('0x24')](respondWithResult(_0xa5d68a,null))[_0xde2e('0x41')](handleError(_0xa5d68a,null));};exports[_0xde2e('0x46')]=function(_0x3bcb2e,_0x239ac5){return db[_0xde2e('0x29')][_0xde2e('0x46')](_0x3bcb2e[_0xde2e('0x47')],{})[_0xde2e('0x24')](respondWithResult(_0x239ac5,0xc9))['catch'](handleError(_0x239ac5,null));};exports[_0xde2e('0x23')]=function(_0x31426a,_0x10b71e){if(_0x31426a[_0xde2e('0x47')]['id']){delete _0x31426a[_0xde2e('0x47')]['id'];}return db[_0xde2e('0x29')]['find']({'where':{'id':_0x31426a[_0xde2e('0x43')]['id']}})[_0xde2e('0x24')](handleEntityNotFound(_0x10b71e,null))['then'](saveUpdates(_0x31426a[_0xde2e('0x47')],null))[_0xde2e('0x24')](respondWithResult(_0x10b71e,null))['catch'](handleError(_0x10b71e,null));};exports[_0xde2e('0x25')]=function(_0x2a617e,_0xf838e3){return db[_0xde2e('0x29')][_0xde2e('0x48')]({'where':{'id':_0x2a617e[_0xde2e('0x43')]['id']}})['then'](handleEntityNotFound(_0xf838e3,null))[_0xde2e('0x24')](removeEntity(_0xf838e3,null))[_0xde2e('0x41')](handleError(_0xf838e3,null));}; \ No newline at end of file +var _0x96ef=['model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','fieldName','type','key','query','filters','intersection'];(function(_0x550500,_0x8dd443){var _0x113660=function(_0x4d97d3){while(--_0x4d97d3){_0x550500['push'](_0x550500['shift']());}};_0x113660(++_0x8dd443);}(_0x96ef,0x17c));var _0xf96e=function(_0x43e1b4,_0x25d2fe){_0x43e1b4=_0x43e1b4-0x0;var _0x58c279=_0x96ef[_0x43e1b4];return _0x58c279;};'use strict';var emlformat=require(_0xf96e('0x0'));var rimraf=require(_0xf96e('0x1'));var zipdir=require(_0xf96e('0x2'));var jsonpatch=require(_0xf96e('0x3'));var rp=require('request-promise');var moment=require(_0xf96e('0x4'));var BPromise=require(_0xf96e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf96e('0x6'));var csv=require(_0xf96e('0x7'));var ejs=require(_0xf96e('0x8'));var fs=require('fs');var fs_extra=require(_0xf96e('0x9'));var _=require(_0xf96e('0xa'));var squel=require(_0xf96e('0xb'));var crypto=require(_0xf96e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf96e('0x7'));var querystring=require(_0xf96e('0xd'));var Papa=require(_0xf96e('0xe'));var Redis=require('ioredis');var authService=require(_0xf96e('0xf'));var qs=require(_0xf96e('0x10'));var as=require(_0xf96e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf96e('0x12'))('api');var utils=require(_0xf96e('0x13'));var config=require(_0xf96e('0x14'));var licenseUtil=require(_0xf96e('0x15'));var db=require(_0xf96e('0x16'))['db'];function respondWithStatusCode(_0x216244,_0x4bc5dc){_0x4bc5dc=_0x4bc5dc||0xcc;return function(_0x4326dd){if(_0x4326dd){return _0x216244['sendStatus'](_0x4bc5dc);}return _0x216244[_0xf96e('0x17')](_0x4bc5dc)['end']();};}function respondWithResult(_0x193d87,_0xb848d8){_0xb848d8=_0xb848d8||0xc8;return function(_0x5d00ae){if(_0x5d00ae){return _0x193d87[_0xf96e('0x17')](_0xb848d8)[_0xf96e('0x18')](_0x5d00ae);}};}function respondWithFilteredResult(_0x264500,_0x1561a4){return function(_0x3195b2){if(_0x3195b2){var _0x164054=typeof _0x1561a4[_0xf96e('0x19')]==='undefined'&&typeof _0x1561a4[_0xf96e('0x1a')]==='undefined';var _0x3c57e5=_0x3195b2[_0xf96e('0x1b')];var _0x1409c8=_0x164054?0x0:_0x1561a4[_0xf96e('0x19')];var _0x2905b8=_0x164054?_0x3195b2[_0xf96e('0x1b')]:_0x1561a4[_0xf96e('0x19')]+_0x1561a4[_0xf96e('0x1a')];var _0x3ed218;if(_0x2905b8>=_0x3c57e5){_0x2905b8=_0x3c57e5;_0x3ed218=0xc8;}else{_0x3ed218=0xce;}_0x264500[_0xf96e('0x17')](_0x3ed218);return _0x264500['set'](_0xf96e('0x1c'),_0x1409c8+'-'+_0x2905b8+'/'+_0x3c57e5)['json'](_0x3195b2);}return null;};}function patchUpdates(_0x1af16e){return function(_0x3d621b){try{jsonpatch[_0xf96e('0x1d')](_0x3d621b,_0x1af16e,!![]);}catch(_0xd5535f){return BPromise[_0xf96e('0x1e')](_0xd5535f);}return _0x3d621b[_0xf96e('0x1f')]();};}function saveUpdates(_0x50ce4f,_0x514f8e){return function(_0x448214){if(_0x448214){return _0x448214[_0xf96e('0x20')](_0x50ce4f)['then'](function(_0x6020e3){return _0x6020e3;});}return null;};}function removeEntity(_0x5909da,_0x5eb66b){return function(_0x3c69c4){if(_0x3c69c4){return _0x3c69c4[_0xf96e('0x21')]()[_0xf96e('0x22')](function(){_0x5909da[_0xf96e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13eefa,_0x26fb35){return function(_0x52d0e6){if(!_0x52d0e6){_0x13eefa[_0xf96e('0x23')](0x194);}return _0x52d0e6;};}function handleError(_0x830e17,_0x5487dc){_0x5487dc=_0x5487dc||0x1f4;return function(_0x25c557){logger['error'](_0x25c557[_0xf96e('0x24')]);if(_0x25c557[_0xf96e('0x25')]){delete _0x25c557[_0xf96e('0x25')];}_0x830e17[_0xf96e('0x17')](_0x5487dc)[_0xf96e('0x26')](_0x25c557);};}exports['index']=function(_0x4a3c63,_0x3747bf){var _0x17fbc9={},_0x4d8433={},_0x28c614={'count':0x0,'rows':[]};var _0x566215=_[_0xf96e('0x27')](db['FaxApplication']['rawAttributes'],function(_0x4b7df3){return{'name':_0x4b7df3[_0xf96e('0x28')],'type':_0x4b7df3[_0xf96e('0x29')][_0xf96e('0x2a')]};});_0x4d8433['model']=_[_0xf96e('0x27')](_0x566215,'name');_0x4d8433['query']=_['keys'](_0x4a3c63[_0xf96e('0x2b')]);_0x4d8433[_0xf96e('0x2c')]=_[_0xf96e('0x2d')](_0x4d8433[_0xf96e('0x2e')],_0x4d8433[_0xf96e('0x2b')]);_0x17fbc9[_0xf96e('0x2f')]=_[_0xf96e('0x2d')](_0x4d8433['model'],qs[_0xf96e('0x30')](_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x30')]));_0x17fbc9[_0xf96e('0x2f')]=_0x17fbc9[_0xf96e('0x2f')][_0xf96e('0x31')]?_0x17fbc9[_0xf96e('0x2f')]:_0x4d8433[_0xf96e('0x2e')];if(!_0x4a3c63[_0xf96e('0x2b')]['hasOwnProperty'](_0xf96e('0x32'))){_0x17fbc9[_0xf96e('0x1a')]=qs['limit'](_0x4a3c63['query']['limit']);_0x17fbc9[_0xf96e('0x19')]=qs[_0xf96e('0x19')](_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x19')]);}_0x17fbc9[_0xf96e('0x33')]=qs['sort'](_0x4a3c63['query'][_0xf96e('0x34')]);_0x17fbc9[_0xf96e('0x35')]=qs[_0xf96e('0x2c')](_[_0xf96e('0x36')](_0x4a3c63[_0xf96e('0x2b')],_0x4d8433[_0xf96e('0x2c')]),_0x566215);if(_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x37')]){_0x17fbc9[_0xf96e('0x35')]=_[_0xf96e('0x38')](_0x17fbc9[_0xf96e('0x35')],{'$or':_[_0xf96e('0x27')](_0x566215,function(_0x35c0cf){if(_0x35c0cf[_0xf96e('0x29')]!==_0xf96e('0x39')){var _0x30c271={};_0x30c271[_0x35c0cf['name']]={'$like':'%'+_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x37')]+'%'};return _0x30c271;}})});}_0x17fbc9=_[_0xf96e('0x38')]({},_0x17fbc9,_0x4a3c63[_0xf96e('0x3a')]);var _0x2dd567={'where':_0x17fbc9[_0xf96e('0x35')]};return db[_0xf96e('0x3b')][_0xf96e('0x1b')](_0x2dd567)[_0xf96e('0x22')](function(_0x2edda9){_0x28c614['count']=_0x2edda9;if(_0x4a3c63[_0xf96e('0x2b')][_0xf96e('0x3c')]){_0x17fbc9[_0xf96e('0x3d')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x17fbc9);})[_0xf96e('0x22')](function(_0x457335){_0x28c614[_0xf96e('0x3e')]=_0x457335;return _0x28c614;})[_0xf96e('0x22')](respondWithFilteredResult(_0x3747bf,_0x17fbc9))[_0xf96e('0x3f')](handleError(_0x3747bf,null));};exports[_0xf96e('0x40')]=function(_0x2df83a,_0x567dd4){var _0x31a1b4={'raw':!![],'where':{'id':_0x2df83a[_0xf96e('0x41')]['id']}},_0x5bc72={};_0x5bc72[_0xf96e('0x2e')]=_[_0xf96e('0x42')](db[_0xf96e('0x3b')][_0xf96e('0x43')]);_0x5bc72[_0xf96e('0x2b')]=_['keys'](_0x2df83a['query']);_0x5bc72['filters']=_[_0xf96e('0x2d')](_0x5bc72[_0xf96e('0x2e')],_0x5bc72[_0xf96e('0x2b')]);_0x31a1b4[_0xf96e('0x2f')]=_['intersection'](_0x5bc72[_0xf96e('0x2e')],qs[_0xf96e('0x30')](_0x2df83a['query'][_0xf96e('0x30')]));_0x31a1b4[_0xf96e('0x2f')]=_0x31a1b4['attributes'][_0xf96e('0x31')]?_0x31a1b4[_0xf96e('0x2f')]:_0x5bc72[_0xf96e('0x2e')];if(_0x2df83a['query'][_0xf96e('0x3c')]){_0x31a1b4[_0xf96e('0x3d')]=[{'all':!![]}];}_0x31a1b4=_[_0xf96e('0x38')]({},_0x31a1b4,_0x2df83a[_0xf96e('0x3a')]);return db['FaxApplication'][_0xf96e('0x44')](_0x31a1b4)['then'](handleEntityNotFound(_0x567dd4,null))[_0xf96e('0x22')](respondWithResult(_0x567dd4,null))[_0xf96e('0x3f')](handleError(_0x567dd4,null));};exports['create']=function(_0x255e5c,_0x32ace3){return db['FaxApplication'][_0xf96e('0x45')](_0x255e5c[_0xf96e('0x46')],{})[_0xf96e('0x22')](respondWithResult(_0x32ace3,0xc9))['catch'](handleError(_0x32ace3,null));};exports[_0xf96e('0x20')]=function(_0x37ac50,_0x401120){if(_0x37ac50[_0xf96e('0x46')]['id']){delete _0x37ac50[_0xf96e('0x46')]['id'];}return db[_0xf96e('0x3b')]['find']({'where':{'id':_0x37ac50[_0xf96e('0x41')]['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x401120,null))[_0xf96e('0x22')](saveUpdates(_0x37ac50['body'],null))[_0xf96e('0x22')](respondWithResult(_0x401120,null))[_0xf96e('0x3f')](handleError(_0x401120,null));};exports[_0xf96e('0x21')]=function(_0x2e1014,_0x5f4563){return db[_0xf96e('0x3b')][_0xf96e('0x44')]({'where':{'id':_0x2e1014[_0xf96e('0x41')]['id']}})[_0xf96e('0x22')](handleEntityNotFound(_0x5f4563,null))[_0xf96e('0x22')](removeEntity(_0x5f4563,null))[_0xf96e('0x3f')](handleError(_0x5f4563,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 351653f..08840b9 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 _0x1ee0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1ee0,0x1e8));var _0x01ee=function(_0x136f48,_0x14e54d){_0x136f48=_0x136f48-0x0;var _0x343726=_0x1ee0[_0x136f48];return _0x343726;};'use strict';var _=require(_0x01ee('0x0'));var util=require('util');var logger=require(_0x01ee('0x1'))('api');var moment=require(_0x01ee('0x2'));var BPromise=require(_0x01ee('0x3'));var rp=require(_0x01ee('0x4'));var fs=require('fs');var path=require(_0x01ee('0x5'));var rimraf=require(_0x01ee('0x6'));var config=require(_0x01ee('0x7'));var attributes=require(_0x01ee('0x8'));module[_0x01ee('0x9')]=function(_0x13a805,_0x1683f9){return _0x13a805[_0x01ee('0xa')]('FaxApplication',attributes,{'tableName':_0x01ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01ee('0xc'),'collate':_0x01ee('0xd')});}; \ No newline at end of file +var _0xcf27=['request-promise','path','rimraf','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xcf27,0x108));var _0x7cf2=function(_0x5d6014,_0x3d91e0){_0x5d6014=_0x5d6014-0x0;var _0x20ea66=_0xcf27[_0x5d6014];return _0x20ea66;};'use strict';var _=require(_0x7cf2('0x0'));var util=require(_0x7cf2('0x1'));var logger=require(_0x7cf2('0x2'))(_0x7cf2('0x3'));var moment=require(_0x7cf2('0x4'));var BPromise=require(_0x7cf2('0x5'));var rp=require(_0x7cf2('0x6'));var fs=require('fs');var path=require(_0x7cf2('0x7'));var rimraf=require(_0x7cf2('0x8'));var config=require('../../config/environment');var attributes=require(_0x7cf2('0x9'));module['exports']=function(_0x143909,_0x2ef843){return _0x143909[_0x7cf2('0xa')](_0x7cf2('0xb'),attributes,{'tableName':_0x7cf2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7cf2('0xd'),'collate':_0x7cf2('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 65f97e3..173d2a8 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 _0xc791=['info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc791,0xa9));var _0x1c79=function(_0x41e393,_0x35417e){_0x41e393=_0x41e393-0x0;var _0x27db09=_0xc791[_0x41e393];return _0x27db09;};'use strict';var _=require(_0x1c79('0x0'));var util=require(_0x1c79('0x1'));var moment=require('moment');var BPromise=require(_0x1c79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c79('0x3'))['db'];var utils=require(_0x1c79('0x4'));var logger=require(_0x1c79('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c79('0x6'));var client=jayson[_0x1c79('0x7')][_0x1c79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x504bd2,_0x2f9d08,_0x3c3f15){return new BPromise(function(_0x3ccb6c,_0xd0f367){return client[_0x1c79('0x9')](_0x504bd2,_0x3c3f15)[_0x1c79('0xa')](function(_0x2c2b53){logger[_0x1c79('0xb')](_0x1c79('0xc'),_0x2f9d08,'request\x20sent');logger[_0x1c79('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2f9d08,_0x1c79('0xe'),JSON['stringify'](_0x2c2b53));if(_0x2c2b53[_0x1c79('0xf')]){if(_0x2c2b53[_0x1c79('0xf')][_0x1c79('0x10')]===0x1f4){logger[_0x1c79('0xf')](_0x1c79('0xc'),_0x2f9d08,_0x2c2b53[_0x1c79('0xf')][_0x1c79('0x11')]);return _0xd0f367(_0x2c2b53[_0x1c79('0xf')][_0x1c79('0x11')]);}logger[_0x1c79('0xf')](_0x1c79('0xc'),_0x2f9d08,_0x2c2b53['error'][_0x1c79('0x11')]);return _0x3ccb6c(_0x2c2b53['error'][_0x1c79('0x11')]);}else{logger[_0x1c79('0xb')](_0x1c79('0xc'),_0x2f9d08,_0x1c79('0xe'));_0x3ccb6c(_0x2c2b53[_0x1c79('0x12')][_0x1c79('0x11')]);}})[_0x1c79('0x13')](function(_0x2aa740){logger[_0x1c79('0xf')](_0x1c79('0xc'),_0x2f9d08,_0x2aa740);_0xd0f367(_0x2aa740);});});}exports['UpdateFaxApplication']=function(_0x456b59){var _0x5893d6=this;return new Promise(function(_0x3a8544,_0x3a325e){return db[_0x1c79('0x14')][_0x1c79('0x15')](_0x456b59[_0x1c79('0x16')],{'raw':_0x456b59[_0x1c79('0x17')]?_0x456b59[_0x1c79('0x17')][_0x1c79('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456b59[_0x1c79('0x17')]?_0x456b59[_0x1c79('0x17')][_0x1c79('0x19')]||null:null,'attributes':_0x456b59[_0x1c79('0x17')]?_0x456b59['options'][_0x1c79('0x1a')]||null:null,'limit':_0x456b59[_0x1c79('0x17')]?_0x456b59['options'][_0x1c79('0x1b')]||null:null})[_0x1c79('0xa')](function(_0x4ed65c){logger['info'](_0x1c79('0x1c'),_0x456b59);logger[_0x1c79('0xd')](_0x1c79('0x1c'),_0x456b59,JSON[_0x1c79('0x1d')](_0x4ed65c));_0x3a8544(_0x4ed65c);})[_0x1c79('0x13')](function(_0x3a6fe9){logger['error'](_0x1c79('0x1c'),_0x3a6fe9[_0x1c79('0x11')],_0x456b59);_0x3a325e(_0x5893d6[_0x1c79('0xf')](0x1f4,_0x3a6fe9['message']));});});}; \ No newline at end of file +var _0xd07b=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','then','debug','lodash','util','moment','bluebird'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xd07b,0xfc));var _0xbd07=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd07b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xbd07('0x0'));var util=require(_0xbd07('0x1'));var moment=require(_0xbd07('0x2'));var BPromise=require(_0xbd07('0x3'));var rs=require(_0xbd07('0x4'));var fs=require('fs');var Redis=require(_0xbd07('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd07('0x6'));var logger=require('../../config/logger')(_0xbd07('0x7'));var config=require(_0xbd07('0x8'));var jayson=require(_0xbd07('0x9'));var client=jayson[_0xbd07('0xa')][_0xbd07('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e8f9c,_0x244e61,_0x1de79b){return new BPromise(function(_0x5caa9b,_0x53e573){return client[_0xbd07('0xc')](_0x1e8f9c,_0x1de79b)['then'](function(_0x4744bd){logger['info'](_0xbd07('0xd'),_0x244e61,'request\x20sent');logger['debug'](_0xbd07('0xe'),_0x244e61,_0xbd07('0xf'),JSON['stringify'](_0x4744bd));if(_0x4744bd[_0xbd07('0x10')]){if(_0x4744bd['error'][_0xbd07('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x244e61,_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);return _0x53e573(_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);}logger[_0xbd07('0x10')](_0xbd07('0xd'),_0x244e61,_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);return _0x5caa9b(_0x4744bd[_0xbd07('0x10')][_0xbd07('0x12')]);}else{logger[_0xbd07('0x13')](_0xbd07('0xd'),_0x244e61,_0xbd07('0xf'));_0x5caa9b(_0x4744bd[_0xbd07('0x14')][_0xbd07('0x12')]);}})[_0xbd07('0x15')](function(_0x3fefd6){logger[_0xbd07('0x10')]('FaxApplication,\x20%s,\x20%s',_0x244e61,_0x3fefd6);_0x53e573(_0x3fefd6);});});}exports[_0xbd07('0x16')]=function(_0x4e35bf){var _0x5e40df=this;return new Promise(function(_0x26317a,_0x275c17){return db[_0xbd07('0x17')][_0xbd07('0x18')](_0x4e35bf[_0xbd07('0x19')],{'raw':_0x4e35bf[_0xbd07('0x1a')]?_0x4e35bf[_0xbd07('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e35bf[_0xbd07('0x1a')]?_0x4e35bf[_0xbd07('0x1a')][_0xbd07('0x1b')]||null:null,'attributes':_0x4e35bf[_0xbd07('0x1a')]?_0x4e35bf[_0xbd07('0x1a')][_0xbd07('0x1c')]||null:null,'limit':_0x4e35bf['options']?_0x4e35bf[_0xbd07('0x1a')][_0xbd07('0x1d')]||null:null})[_0xbd07('0x1e')](function(_0x5dec3d){logger[_0xbd07('0x13')](_0xbd07('0x16'),_0x4e35bf);logger[_0xbd07('0x1f')](_0xbd07('0x16'),_0x4e35bf,JSON['stringify'](_0x5dec3d));_0x26317a(_0x5dec3d);})['catch'](function(_0x445c3d){logger['error'](_0xbd07('0x16'),_0x445c3d[_0xbd07('0x12')],_0x4e35bf);_0x275c17(_0x5e40df[_0xbd07('0x10')](0x1f4,_0x445c3d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 94df6df..e3c9078 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 _0xb688=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xb688,0xcf));var _0x8b68=function(_0x4c4fb8,_0x1feb04){_0x4c4fb8=_0x4c4fb8-0x0;var _0x45e53c=_0xb688[_0x4c4fb8];return _0x45e53c;};'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('0xe')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x10')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x13')]=router; \ No newline at end of file +var _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0xf7b4,0x152));var _0x4f7b=function(_0x490c02,_0x2faa1b){_0x490c02=_0x490c02-0x0;var _0x4604ab=_0xf7b4[_0x490c02];return _0x4604ab;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index f0dea30..3b800d6 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 _0xa30a=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x35d245,_0x5da6c1){var _0x490264=function(_0x577107){while(--_0x577107){_0x35d245['push'](_0x35d245['shift']());}};_0x490264(++_0x5da6c1);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'closed':{'type':Sequelize[_0xaa30('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaa30('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa30('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa30('0x3')]},'note':{'type':Sequelize[_0xaa30('0x3')]},'read1stAt':{'type':Sequelize[_0xaa30('0x4')]},'fax':{'type':Sequelize[_0xaa30('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaa30('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa30('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa30('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xaa30('0x7')]}}; \ No newline at end of file +var _0x47c5=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x27dce9,_0x10d2f8){var _0x1fec31=function(_0x6e3a9a){while(--_0x6e3a9a){_0x27dce9['push'](_0x27dce9['shift']());}};_0x1fec31(++_0x10d2f8);}(_0x47c5,0x165));var _0x547c=function(_0x5025f4,_0x4c575c){_0x5025f4=_0x5025f4-0x0;var _0x5b540e=_0x47c5[_0x5025f4];return _0x5b540e;};'use strict';var Sequelize=require(_0x547c('0x0'));module[_0x547c('0x1')]={'closed':{'type':Sequelize[_0x547c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x547c('0x3')]},'disposition':{'type':Sequelize[_0x547c('0x4')]},'secondDisposition':{'type':Sequelize[_0x547c('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x547c('0x4')]},'read1stAt':{'type':Sequelize[_0x547c('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x547c('0x5')]('in',_0x547c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x547c('0x5')]('in',_0x547c('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x547c('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b2dedc7..d988c22 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 _0x74fb=['intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','toString','join','root','files','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','zip-dir','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','user','catch','show','params','model','query','keys','filters'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x74fb,0x9b));var _0xb74f=function(_0x31da2c,_0x276d4d){_0x31da2c=_0x31da2c-0x0;var _0x191df1=_0x74fb[_0x31da2c];return _0x191df1;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb74f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0xb74f('0x1'));var fs=require('fs');var _=require(_0xb74f('0x2'));var Redis=require(_0xb74f('0x3'));var interaction=require('../../components/interaction/service');var qs=require(_0xb74f('0x4'));var logger=require(_0xb74f('0x5'))(_0xb74f('0x6'));var config=require('../../config/environment');var db=require(_0xb74f('0x7'))['db'];config[_0xb74f('0x8')]=_[_0xb74f('0x9')](config[_0xb74f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb74f('0xa'))(new Redis(config[_0xb74f('0x8')]));require(_0xb74f('0xb'))['register'](socket);function respondWithStatusCode(_0x2e14d2,_0x3273c9){_0x3273c9=_0x3273c9||0xcc;return function(_0x22543c){if(_0x22543c){return _0x2e14d2[_0xb74f('0xc')](_0x3273c9);}return _0x2e14d2[_0xb74f('0xd')](_0x3273c9)['end']();};}function respondWithResult(_0x25b25b,_0x3a055f){_0x3a055f=_0x3a055f||0xc8;return function(_0x5f566f){if(_0x5f566f){return _0x25b25b[_0xb74f('0xd')](_0x3a055f)[_0xb74f('0xe')](_0x5f566f);}};}function respondWithFilteredResult(_0x1fecb5,_0x52a53e){return function(_0x25e5a4){if(_0x25e5a4){var _0x479f60=typeof _0x52a53e[_0xb74f('0xf')]===_0xb74f('0x10')&&typeof _0x52a53e[_0xb74f('0x11')]===_0xb74f('0x10');var _0xa4af12=_0x25e5a4[_0xb74f('0x12')];var _0xd626bd=_0x479f60?0x0:_0x52a53e['offset'];var _0x405442=_0x479f60?_0x25e5a4[_0xb74f('0x12')]:_0x52a53e[_0xb74f('0xf')]+_0x52a53e[_0xb74f('0x11')];var _0x33b6b4;if(_0x405442>=_0xa4af12){_0x405442=_0xa4af12;_0x33b6b4=0xc8;}else{_0x33b6b4=0xce;}_0x1fecb5['status'](_0x33b6b4);return _0x1fecb5[_0xb74f('0x13')](_0xb74f('0x14'),_0xd626bd+'-'+_0x405442+'/'+_0xa4af12)['json'](_0x25e5a4);}return null;};}function saveUpdates(_0x4a0a22){return function(_0x3b1e09){if(_0x3b1e09){return _0x3b1e09[_0xb74f('0x15')](_0x4a0a22)[_0xb74f('0x16')](function(_0x254661){return _0x254661;});}return null;};}function removeEntity(_0x133772){return function(_0x451317){if(_0x451317){return _0x451317['destroy']()[_0xb74f('0x16')](function(){_0x133772[_0xb74f('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2c21b){return function(_0x2d9c39){if(!_0x2d9c39){_0xe2c21b['sendStatus'](0x194);}return _0x2d9c39;};}function handleError(_0x34dac0,_0xf49cb4){_0xf49cb4=_0xf49cb4||0x1f4;return function(_0xd30e75){logger[_0xb74f('0x17')](_0xd30e75[_0xb74f('0x18')]);if(_0xd30e75[_0xb74f('0x19')]){delete _0xd30e75[_0xb74f('0x19')];}_0x34dac0[_0xb74f('0xd')](_0xf49cb4)[_0xb74f('0x1a')](_0xd30e75);};}exports[_0xb74f('0x1b')]=function(_0x5d93c1,_0x24c5bc){var _0x51daa2={};var _0xfd7502=_[_0xb74f('0x1c')](db[_0xb74f('0x1d')][_0xb74f('0x1e')],function(_0x3d1500){return{'name':_0x3d1500[_0xb74f('0x1f')],'type':_0x3d1500[_0xb74f('0x20')][_0xb74f('0x21')]};});_0x51daa2=qs[_0xb74f('0x22')](_0xfd7502,_0x5d93c1);return interaction[_0xb74f('0x23')](_0xb74f('0x24'),_0x5d93c1['query'],_0x5d93c1[_0xb74f('0x25')],_0x51daa2,_0xfd7502)[_0xb74f('0x16')](respondWithFilteredResult(_0x24c5bc,_0x51daa2))[_0xb74f('0x26')](handleError(_0x24c5bc,null));};exports[_0xb74f('0x27')]=function(_0x36874c,_0x3edd9e){var _0x39e475={'raw':![],'where':{'id':_0x36874c[_0xb74f('0x28')]['id']}},_0x25b6c1={};_0x25b6c1[_0xb74f('0x29')]=_['keys'](db[_0xb74f('0x1d')][_0xb74f('0x1e')]);_0x25b6c1[_0xb74f('0x2a')]=_[_0xb74f('0x2b')](_0x36874c[_0xb74f('0x2a')]);_0x25b6c1[_0xb74f('0x2c')]=_[_0xb74f('0x2d')](_0x25b6c1['model'],_0x25b6c1['query']);_0x39e475[_0xb74f('0x2e')]=_['intersection'](_0x25b6c1[_0xb74f('0x29')],qs[_0xb74f('0x2f')](_0x36874c[_0xb74f('0x2a')][_0xb74f('0x2f')]));_0x39e475[_0xb74f('0x2e')]=_0x39e475['attributes'][_0xb74f('0x30')]?_0x39e475[_0xb74f('0x2e')]:_0x25b6c1[_0xb74f('0x29')];if(_0x36874c[_0xb74f('0x2a')][_0xb74f('0x31')]){_0x39e475[_0xb74f('0x32')]=[{'all':!![]}];}_0x39e475=_[_0xb74f('0x33')]({},_0x39e475,_0x36874c[_0xb74f('0x34')]);return db[_0xb74f('0x1d')][_0xb74f('0x35')](_0x39e475)['then'](handleEntityNotFound(_0x3edd9e,null))[_0xb74f('0x16')](respondWithResult(_0x3edd9e,null))[_0xb74f('0x26')](handleError(_0x3edd9e,null));};exports[_0xb74f('0x36')]=function(_0x1810fb,_0x3e8173){return db[_0xb74f('0x1d')][_0xb74f('0x36')](_0x1810fb[_0xb74f('0x37')],{})['then'](respondWithResult(_0x3e8173,0xc9))[_0xb74f('0x26')](handleError(_0x3e8173,null));};exports[_0xb74f('0x15')]=function(_0x2c7751,_0x2391ad){if(_0x2c7751['body']['id']){delete _0x2c7751[_0xb74f('0x37')]['id'];}return db[_0xb74f('0x1d')][_0xb74f('0x35')]({'where':{'id':_0x2c7751[_0xb74f('0x28')]['id']}})[_0xb74f('0x16')](handleEntityNotFound(_0x2391ad,null))[_0xb74f('0x16')](saveUpdates(_0x2c7751[_0xb74f('0x37')],null))[_0xb74f('0x16')](respondWithResult(_0x2391ad,null))[_0xb74f('0x26')](handleError(_0x2391ad,null));};exports['destroy']=function(_0x3a3bd9,_0x2f1ce5){return db['FaxInteraction'][_0xb74f('0x35')]({'where':{'id':_0x3a3bd9[_0xb74f('0x28')]['id']}})[_0xb74f('0x16')](handleEntityNotFound(_0x2f1ce5,null))[_0xb74f('0x16')](removeEntity(_0x2f1ce5,null))[_0xb74f('0x26')](handleError(_0x2f1ce5,null));};exports['describe']=function(_0x3e9e14,_0x5d6707){return db['FaxInteraction'][_0xb74f('0x38')]()['then'](respondWithResult(_0x5d6707,null))[_0xb74f('0x26')](handleError(_0x5d6707,null));};exports[_0xb74f('0x39')]=function(_0x56066e,_0x2e3006){return db[_0xb74f('0x3a')][_0xb74f('0x35')]({'where':{'id':_0x56066e['params']['id']}})['then'](handleEntityNotFound(_0x2e3006,null))[_0xb74f('0x16')](function(_0x522bd2){if(_0x522bd2){return _0x522bd2[_0xb74f('0x39')](_0x56066e[_0xb74f('0x37')][_0xb74f('0x3b')],_[_0xb74f('0x3c')](_0x56066e[_0xb74f('0x37')],[_0xb74f('0x3b'),'id'])||{});}})[_0xb74f('0x16')](respondWithResult(_0x2e3006,null))[_0xb74f('0x26')](handleError(_0x2e3006,null));};exports[_0xb74f('0x3d')]=function(_0x193f33,_0x227467){var _0x744202={'raw':![],'where':{}};var _0x344061={};var _0x477813={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xb74f('0x3e')]({'where':{'id':_0x193f33[_0xb74f('0x28')]['id']}})[_0xb74f('0x16')](handleEntityNotFound(_0x227467,null))[_0xb74f('0x16')](function(_0x4bcc9b){if(_0x4bcc9b){_0x344061[_0xb74f('0x29')]=_[_0xb74f('0x2b')](db[_0xb74f('0x3a')][_0xb74f('0x1e')]);_0x344061[_0xb74f('0x2a')]=_[_0xb74f('0x2b')](_0x193f33[_0xb74f('0x2a')]);_0x344061[_0xb74f('0x2c')]=_[_0xb74f('0x2d')](_0x344061['model'],_0x344061[_0xb74f('0x2a')]);_0x744202[_0xb74f('0x2e')]=_[_0xb74f('0x2d')](_0x344061[_0xb74f('0x29')],qs[_0xb74f('0x2f')](_0x193f33[_0xb74f('0x2a')][_0xb74f('0x2f')]));_0x744202['attributes']=_0x744202[_0xb74f('0x2e')][_0xb74f('0x30')]?_0x744202['attributes']:_0x344061['model'];if(!_0x193f33[_0xb74f('0x2a')]['hasOwnProperty']('nolimit')){_0x744202[_0xb74f('0x11')]=qs['limit'](_0x193f33['query'][_0xb74f('0x11')]);_0x744202['offset']=qs['offset'](_0x193f33['query']['offset']);}_0x744202[_0xb74f('0x3f')]=qs['sort'](_0x193f33[_0xb74f('0x2a')][_0xb74f('0x40')]);_0x744202[_0xb74f('0x41')]=qs[_0xb74f('0x2c')](_['pick'](_0x193f33[_0xb74f('0x2a')],_0x344061[_0xb74f('0x2c')]));_0x744202[_0xb74f('0x41')][_0xb74f('0x42')]=_0x4bcc9b['id'];if(_0x193f33[_0xb74f('0x2a')][_0xb74f('0x43')]){_0x744202[_0xb74f('0x41')]=_[_0xb74f('0x33')](_0x744202[_0xb74f('0x41')],{'$or':_[_0xb74f('0x1c')](_0x744202[_0xb74f('0x2e')],function(_0x3b771c){var _0x50dde9={};_0x50dde9[_0x3b771c]={'$like':'%'+_0x193f33['query'][_0xb74f('0x43')]+'%'};return _0x50dde9;})});}if(_0x193f33[_0xb74f('0x2a')][_0xb74f('0x44')]){var _0x4f48cf=_0x193f33['query'][_0xb74f('0x44')][_0xb74f('0x45')](',');var _0x5e1af0={};_0x5e1af0[_0x4f48cf[0x0]]={'$gte':moment(_0x4f48cf[0x1])[_0xb74f('0x46')](_0xb74f('0x47'))};_0x744202[_0xb74f('0x41')]=_[_0xb74f('0x33')](_0x744202[_0xb74f('0x41')],_0x5e1af0);}_0x744202=_[_0xb74f('0x33')]({},_0x744202,_0x193f33[_0xb74f('0x34')]);return db[_0xb74f('0x3a')][_0xb74f('0x12')]({'where':_0x744202[_0xb74f('0x41')]})[_0xb74f('0x16')](function(_0xd04c5){_0x477813[_0xb74f('0x12')]=_0xd04c5;if(_0x193f33[_0xb74f('0x2a')][_0xb74f('0x31')]){_0x744202[_0xb74f('0x32')]=[{'all':!![]}];}return db[_0xb74f('0x3a')][_0xb74f('0x23')](_0x744202);})[_0xb74f('0x16')](function(_0x389d94){_0x477813[_0xb74f('0x48')]=_0x389d94;return _0x477813;});}})[_0xb74f('0x16')](respondWithFilteredResult(_0x227467,_0x744202))[_0xb74f('0x26')](handleError(_0x227467,null));};exports[_0xb74f('0x49')]=function(_0x3fb914,_0x42ae8f){return db['FaxInteraction']['find']({'where':{'id':_0x3fb914['params']['id']}})[_0xb74f('0x16')](handleEntityNotFound(_0x42ae8f,null))[_0xb74f('0x16')](function(_0x255ad6){if(_0x255ad6){return _0x255ad6[_0xb74f('0x4a')](_0x3fb914[_0xb74f('0x37')]['ids'],_[_0xb74f('0x3c')](_0x3fb914[_0xb74f('0x37')],['ids','id'])||{})[_0xb74f('0x4b')](function(){return db[_0xb74f('0x4c')][_0xb74f('0x23')]({'attributes':['id',_0xb74f('0x19'),_0xb74f('0x4d')],'where':{'id':_0x3fb914[_0xb74f('0x37')][_0xb74f('0x3b')]}});})[_0xb74f('0x16')](function(_0x11ded3){socket[_0xb74f('0x4e')](_0xb74f('0x4f'),{'id':Number(_0x3fb914[_0xb74f('0x28')]['id']),'tags':_0x11ded3||[]});return{'id':Number(_0x3fb914['params']['id']),'tags':_0x11ded3||[]};});}})[_0xb74f('0x16')](respondWithResult(_0x42ae8f,null))[_0xb74f('0x26')](handleError(_0x42ae8f,null));};exports[_0xb74f('0x50')]=function(_0xa094ce,_0x1fd49f){return db[_0xb74f('0x1d')]['find']({'where':{'id':_0xa094ce[_0xb74f('0x28')]['id']}})[_0xb74f('0x16')](handleEntityNotFound(_0x1fd49f,null))[_0xb74f('0x16')](function(_0x211e25){if(_0x211e25){return _0x211e25[_0xb74f('0x50')](_0xa094ce[_0xb74f('0x2a')]['ids']);}})[_0xb74f('0x16')](respondWithStatusCode(_0x1fd49f,null))['catch'](handleError(_0x1fd49f,null));};exports[_0xb74f('0x51')]=function(_0x5c3bc9,_0x47662c){var _0x4adc3c=moment()['unix']()[_0xb74f('0x52')]();var _0x3c51a2=path[_0xb74f('0x53')](config['root'],'server','files','tmp');var _0x923495=path[_0xb74f('0x53')](config[_0xb74f('0x54')],'server',_0xb74f('0x55'),_0xb74f('0x56'));var _0x12b437=path[_0xb74f('0x53')](_0x3c51a2,_0x4adc3c);var _0x4750ed=util[_0xb74f('0x46')](_0xb74f('0x57'),_0x5c3bc9[_0xb74f('0x28')]['id'],_0x4adc3c);var _0x3b8679=path['join'](_0x3c51a2,_0x4750ed);var _0x42119e=[];_0x42119e['push']({'model':db['Attachment'],'as':_0xb74f('0x58'),'raw':!![]});var _0x1821f0=[{'model':db[_0xb74f('0x3a')],'as':'Messages','attributes':['id',_0xb74f('0x37'),_0xb74f('0x59')],'include':_0x42119e}];return db[_0xb74f('0x1d')][_0xb74f('0x35')]({'where':{'id':_0x5c3bc9[_0xb74f('0x28')]['id']},'include':_0x1821f0})[_0xb74f('0x16')](handleEntityNotFound(_0x47662c,null))['then'](function(_0xbb97f5){if(_0xbb97f5&&_0xbb97f5[_0xb74f('0x5a')]){var _0x5051bf=_0xbb97f5['get']({'plain':!![]});fs[_0xb74f('0x5b')](_0x12b437);for(var _0xbcc40b=0x0;_0xbcc40b<_0x5051bf['Messages'][_0xb74f('0x30')];_0xbcc40b++){var _0x5b400a=_0x5051bf[_0xb74f('0x5a')][_0xbcc40b]['Attachment'];if(_0x5b400a){var _0x2414ad=path['join'](_0x923495,_0x5b400a['basename']);if(fs[_0xb74f('0x5c')](_0x2414ad)){fs[_0xb74f('0x5d')](_0x2414ad)[_0xb74f('0x5e')](fs[_0xb74f('0x5f')](path[_0xb74f('0x53')](_0x12b437,_0x5b400a[_0xb74f('0x60')])));}}}return BPromise[_0xb74f('0x61')]()['then'](function(){return new BPromise(function(_0x3fdd6a,_0x42d10e){zipdir(_0x12b437,{'saveTo':_0x3b8679},function(_0x529756,_0x35443b){if(_0x529756)return _0x42d10e(_0x529756);return _0x3fdd6a(_0x35443b);});})[_0xb74f('0x16')](function(){return new BPromise(function(_0xc7c31f,_0xbca7f5){rimraf(_0x12b437,function(_0x4768a1){if(_0x4768a1)_0xbca7f5(_0x4768a1);return _0xc7c31f();});});})[_0xb74f('0x16')](function(){return _0x47662c[_0xb74f('0x51')](_0x3b8679,_0x4750ed,function(_0x5f448a){if(_0x5f448a){console[_0xb74f('0x62')](_0xb74f('0x63'),_0x5f448a);}else{fs['unlinkSync'](_0x3b8679);}});});});}else{return _0x47662c['sendStatus'](0xc8);}})[_0xb74f('0x26')](handleError(_0x47662c,null));}; \ No newline at end of file +var _0x8f85=['lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./faxInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','stack','name','send','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','length','include','options','find','create','body','describe','FaxMessage','addMessage','findOne','hasOwnProperty','sort','where','pick','FaxInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','ids','spread','Tag','color','emit','faxInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','resolve','download','log','err','unlinkSync','rimraf','bluebird','path'];(function(_0x328825,_0x2e7366){var _0x4aac3a=function(_0x2c7a8d){while(--_0x2c7a8d){_0x328825['push'](_0x328825['shift']());}};_0x4aac3a(++_0x2e7366);}(_0x8f85,0x64));var _0x58f8=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8f85[_0x342baa];return _0x1208f3;};'use strict';var rimraf=require(_0x58f8('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x58f8('0x1'));var util=require('util');var path=require(_0x58f8('0x2'));var fs=require('fs');var _=require(_0x58f8('0x3'));var Redis=require(_0x58f8('0x4'));var interaction=require(_0x58f8('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x58f8('0x6'))(_0x58f8('0x7'));var config=require(_0x58f8('0x8'));var db=require(_0x58f8('0x9'))['db'];config[_0x58f8('0xa')]=_[_0x58f8('0xb')](config[_0x58f8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58f8('0xa')]));require(_0x58f8('0xc'))[_0x58f8('0xd')](socket);function respondWithStatusCode(_0x2ea80a,_0x3aec92){_0x3aec92=_0x3aec92||0xcc;return function(_0x34365b){if(_0x34365b){return _0x2ea80a['sendStatus'](_0x3aec92);}return _0x2ea80a['status'](_0x3aec92)[_0x58f8('0xe')]();};}function respondWithResult(_0x29763a,_0x311fda){_0x311fda=_0x311fda||0xc8;return function(_0x542604){if(_0x542604){return _0x29763a[_0x58f8('0xf')](_0x311fda)[_0x58f8('0x10')](_0x542604);}};}function respondWithFilteredResult(_0x7a93a2,_0x561c3e){return function(_0x5e3954){if(_0x5e3954){var _0x39af74=typeof _0x561c3e[_0x58f8('0x11')]===_0x58f8('0x12')&&typeof _0x561c3e[_0x58f8('0x13')]==='undefined';var _0x2d6083=_0x5e3954[_0x58f8('0x14')];var _0x5cfd72=_0x39af74?0x0:_0x561c3e[_0x58f8('0x11')];var _0x445074=_0x39af74?_0x5e3954[_0x58f8('0x14')]:_0x561c3e['offset']+_0x561c3e[_0x58f8('0x13')];var _0x591da8;if(_0x445074>=_0x2d6083){_0x445074=_0x2d6083;_0x591da8=0xc8;}else{_0x591da8=0xce;}_0x7a93a2['status'](_0x591da8);return _0x7a93a2[_0x58f8('0x15')]('Content-Range',_0x5cfd72+'-'+_0x445074+'/'+_0x2d6083)[_0x58f8('0x10')](_0x5e3954);}return null;};}function saveUpdates(_0x57804b){return function(_0x5eee2e){if(_0x5eee2e){return _0x5eee2e[_0x58f8('0x16')](_0x57804b)[_0x58f8('0x17')](function(_0x4d2f52){return _0x4d2f52;});}return null;};}function removeEntity(_0x1df0bb){return function(_0x4f276d){if(_0x4f276d){return _0x4f276d[_0x58f8('0x18')]()[_0x58f8('0x17')](function(){_0x1df0bb[_0x58f8('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e9323){return function(_0x2dad2f){if(!_0x2dad2f){_0x4e9323[_0x58f8('0x19')](0x194);}return _0x2dad2f;};}function handleError(_0x290067,_0x407347){_0x407347=_0x407347||0x1f4;return function(_0x82a183){logger['error'](_0x82a183[_0x58f8('0x1a')]);if(_0x82a183[_0x58f8('0x1b')]){delete _0x82a183[_0x58f8('0x1b')];}_0x290067['status'](_0x407347)[_0x58f8('0x1c')](_0x82a183);};}exports[_0x58f8('0x1d')]=function(_0x37b6d5,_0x4043f6){var _0xbbb0aa={};var _0x1842c3=_[_0x58f8('0x1e')](db[_0x58f8('0x1f')]['rawAttributes'],function(_0x5e6c3d){return{'name':_0x5e6c3d[_0x58f8('0x20')],'type':_0x5e6c3d[_0x58f8('0x21')][_0x58f8('0x22')]};});_0xbbb0aa=qs[_0x58f8('0x23')](_0x1842c3,_0x37b6d5);return interaction[_0x58f8('0x24')](_0x58f8('0x25'),_0x37b6d5[_0x58f8('0x26')],_0x37b6d5[_0x58f8('0x27')],_0xbbb0aa,_0x1842c3)[_0x58f8('0x17')](respondWithFilteredResult(_0x4043f6,_0xbbb0aa))[_0x58f8('0x28')](handleError(_0x4043f6,null));};exports[_0x58f8('0x29')]=function(_0xdf960a,_0x25bb8a){var _0x4dab88={'raw':![],'where':{'id':_0xdf960a[_0x58f8('0x2a')]['id']}},_0x32ff34={};_0x32ff34['model']=_[_0x58f8('0x2b')](db[_0x58f8('0x1f')][_0x58f8('0x2c')]);_0x32ff34[_0x58f8('0x26')]=_['keys'](_0xdf960a['query']);_0x32ff34[_0x58f8('0x2d')]=_[_0x58f8('0x2e')](_0x32ff34[_0x58f8('0x2f')],_0x32ff34[_0x58f8('0x26')]);_0x4dab88[_0x58f8('0x30')]=_[_0x58f8('0x2e')](_0x32ff34[_0x58f8('0x2f')],qs[_0x58f8('0x31')](_0xdf960a[_0x58f8('0x26')][_0x58f8('0x31')]));_0x4dab88[_0x58f8('0x30')]=_0x4dab88[_0x58f8('0x30')][_0x58f8('0x32')]?_0x4dab88[_0x58f8('0x30')]:_0x32ff34[_0x58f8('0x2f')];if(_0xdf960a[_0x58f8('0x26')]['includeAll']){_0x4dab88[_0x58f8('0x33')]=[{'all':!![]}];}_0x4dab88=_['merge']({},_0x4dab88,_0xdf960a[_0x58f8('0x34')]);return db[_0x58f8('0x1f')][_0x58f8('0x35')](_0x4dab88)[_0x58f8('0x17')](handleEntityNotFound(_0x25bb8a,null))['then'](respondWithResult(_0x25bb8a,null))[_0x58f8('0x28')](handleError(_0x25bb8a,null));};exports[_0x58f8('0x36')]=function(_0x402504,_0x5ecd66){return db['FaxInteraction'][_0x58f8('0x36')](_0x402504[_0x58f8('0x37')],{})[_0x58f8('0x17')](respondWithResult(_0x5ecd66,0xc9))[_0x58f8('0x28')](handleError(_0x5ecd66,null));};exports['update']=function(_0x542071,_0x4c70ca){if(_0x542071[_0x58f8('0x37')]['id']){delete _0x542071[_0x58f8('0x37')]['id'];}return db[_0x58f8('0x1f')][_0x58f8('0x35')]({'where':{'id':_0x542071[_0x58f8('0x2a')]['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x4c70ca,null))[_0x58f8('0x17')](saveUpdates(_0x542071[_0x58f8('0x37')],null))[_0x58f8('0x17')](respondWithResult(_0x4c70ca,null))[_0x58f8('0x28')](handleError(_0x4c70ca,null));};exports[_0x58f8('0x18')]=function(_0x4ecc28,_0x2a3c28){return db['FaxInteraction'][_0x58f8('0x35')]({'where':{'id':_0x4ecc28[_0x58f8('0x2a')]['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x2a3c28,null))[_0x58f8('0x17')](removeEntity(_0x2a3c28,null))[_0x58f8('0x28')](handleError(_0x2a3c28,null));};exports['describe']=function(_0x180fe1,_0x21da7d){return db[_0x58f8('0x1f')][_0x58f8('0x38')]()['then'](respondWithResult(_0x21da7d,null))[_0x58f8('0x28')](handleError(_0x21da7d,null));};exports['addMessage']=function(_0x3ca656,_0x2f6ae6){return db[_0x58f8('0x39')][_0x58f8('0x35')]({'where':{'id':_0x3ca656[_0x58f8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2f6ae6,null))[_0x58f8('0x17')](function(_0x317a14){if(_0x317a14){return _0x317a14[_0x58f8('0x3a')](_0x3ca656[_0x58f8('0x37')]['ids'],_['omit'](_0x3ca656['body'],['ids','id'])||{});}})[_0x58f8('0x17')](respondWithResult(_0x2f6ae6,null))[_0x58f8('0x28')](handleError(_0x2f6ae6,null));};exports['getMessages']=function(_0xa3aa3f,_0x45a879){var _0x16022d={'raw':![],'where':{}};var _0x4fae9c={};var _0x17dc26={'count':0x0,'rows':[]};return db[_0x58f8('0x1f')][_0x58f8('0x3b')]({'where':{'id':_0xa3aa3f['params']['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x45a879,null))[_0x58f8('0x17')](function(_0x2a627e){if(_0x2a627e){_0x4fae9c[_0x58f8('0x2f')]=_[_0x58f8('0x2b')](db['FaxMessage']['rawAttributes']);_0x4fae9c[_0x58f8('0x26')]=_['keys'](_0xa3aa3f['query']);_0x4fae9c[_0x58f8('0x2d')]=_[_0x58f8('0x2e')](_0x4fae9c[_0x58f8('0x2f')],_0x4fae9c[_0x58f8('0x26')]);_0x16022d['attributes']=_[_0x58f8('0x2e')](_0x4fae9c[_0x58f8('0x2f')],qs[_0x58f8('0x31')](_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x31')]));_0x16022d[_0x58f8('0x30')]=_0x16022d[_0x58f8('0x30')][_0x58f8('0x32')]?_0x16022d[_0x58f8('0x30')]:_0x4fae9c[_0x58f8('0x2f')];if(!_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x3c')]('nolimit')){_0x16022d[_0x58f8('0x13')]=qs[_0x58f8('0x13')](_0xa3aa3f[_0x58f8('0x26')]['limit']);_0x16022d[_0x58f8('0x11')]=qs[_0x58f8('0x11')](_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x11')]);}_0x16022d['order']=qs[_0x58f8('0x3d')](_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x3d')]);_0x16022d[_0x58f8('0x3e')]=qs[_0x58f8('0x2d')](_[_0x58f8('0x3f')](_0xa3aa3f['query'],_0x4fae9c[_0x58f8('0x2d')]));_0x16022d[_0x58f8('0x3e')][_0x58f8('0x40')]=_0x2a627e['id'];if(_0xa3aa3f[_0x58f8('0x26')]['filter']){_0x16022d[_0x58f8('0x3e')]=_[_0x58f8('0x41')](_0x16022d['where'],{'$or':_[_0x58f8('0x1e')](_0x16022d['attributes'],function(_0x37f99a){var _0x34d578={};_0x34d578[_0x37f99a]={'$like':'%'+_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x42')]+'%'};return _0x34d578;})});}if(_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x43')]){var _0x4332b7=_0xa3aa3f[_0x58f8('0x26')][_0x58f8('0x43')][_0x58f8('0x44')](',');var _0x3ad35a={};_0x3ad35a[_0x4332b7[0x0]]={'$gte':moment(_0x4332b7[0x1])[_0x58f8('0x45')](_0x58f8('0x46'))};_0x16022d[_0x58f8('0x3e')]=_['merge'](_0x16022d[_0x58f8('0x3e')],_0x3ad35a);}_0x16022d=_[_0x58f8('0x41')]({},_0x16022d,_0xa3aa3f['options']);return db[_0x58f8('0x39')][_0x58f8('0x14')]({'where':_0x16022d[_0x58f8('0x3e')]})[_0x58f8('0x17')](function(_0x2f9000){_0x17dc26[_0x58f8('0x14')]=_0x2f9000;if(_0xa3aa3f['query'][_0x58f8('0x47')]){_0x16022d[_0x58f8('0x33')]=[{'all':!![]}];}return db[_0x58f8('0x39')][_0x58f8('0x24')](_0x16022d);})[_0x58f8('0x17')](function(_0x513fa9){_0x17dc26[_0x58f8('0x48')]=_0x513fa9;return _0x17dc26;});}})[_0x58f8('0x17')](respondWithFilteredResult(_0x45a879,_0x16022d))['catch'](handleError(_0x45a879,null));};exports[_0x58f8('0x49')]=function(_0x4cda7d,_0x127bca){return db['FaxInteraction']['find']({'where':{'id':_0x4cda7d[_0x58f8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x127bca,null))[_0x58f8('0x17')](function(_0x3bd9fb){if(_0x3bd9fb){return _0x3bd9fb[_0x58f8('0x4a')](_0x4cda7d[_0x58f8('0x37')][_0x58f8('0x4b')],_['omit'](_0x4cda7d['body'],['ids','id'])||{})[_0x58f8('0x4c')](function(){return db[_0x58f8('0x4d')][_0x58f8('0x24')]({'attributes':['id',_0x58f8('0x1b'),_0x58f8('0x4e')],'where':{'id':_0x4cda7d[_0x58f8('0x37')][_0x58f8('0x4b')]}});})[_0x58f8('0x17')](function(_0x2aa1e7){socket[_0x58f8('0x4f')](_0x58f8('0x50'),{'id':Number(_0x4cda7d[_0x58f8('0x2a')]['id']),'tags':_0x2aa1e7||[]});return{'id':Number(_0x4cda7d[_0x58f8('0x2a')]['id']),'tags':_0x2aa1e7||[]};});}})[_0x58f8('0x17')](respondWithResult(_0x127bca,null))[_0x58f8('0x28')](handleError(_0x127bca,null));};exports[_0x58f8('0x51')]=function(_0xa0dbb2,_0x3c4f19){return db['FaxInteraction'][_0x58f8('0x35')]({'where':{'id':_0xa0dbb2['params']['id']}})[_0x58f8('0x17')](handleEntityNotFound(_0x3c4f19,null))[_0x58f8('0x17')](function(_0x372540){if(_0x372540){return _0x372540[_0x58f8('0x51')](_0xa0dbb2[_0x58f8('0x26')][_0x58f8('0x4b')]);}})[_0x58f8('0x17')](respondWithStatusCode(_0x3c4f19,null))[_0x58f8('0x28')](handleError(_0x3c4f19,null));};exports['download']=function(_0x3736ce,_0x379314){var _0xcab93d=moment()['unix']()['toString']();var _0x195d71=path[_0x58f8('0x52')](config[_0x58f8('0x53')],_0x58f8('0x54'),_0x58f8('0x55'),_0x58f8('0x56'));var _0x455e11=path[_0x58f8('0x52')](config[_0x58f8('0x53')],_0x58f8('0x54'),_0x58f8('0x55'),_0x58f8('0x57'));var _0x666059=path['join'](_0x195d71,_0xcab93d);var _0x2f8a0b=util[_0x58f8('0x45')](_0x58f8('0x58'),_0x3736ce[_0x58f8('0x2a')]['id'],_0xcab93d);var _0x16e175=path[_0x58f8('0x52')](_0x195d71,_0x2f8a0b);var _0x16fd08=[];_0x16fd08[_0x58f8('0x59')]({'model':db[_0x58f8('0x5a')],'as':_0x58f8('0x5a'),'raw':!![]});var _0xac825c=[{'model':db[_0x58f8('0x39')],'as':_0x58f8('0x5b'),'attributes':['id',_0x58f8('0x37'),_0x58f8('0x5c')],'include':_0x16fd08}];return db[_0x58f8('0x1f')][_0x58f8('0x35')]({'where':{'id':_0x3736ce[_0x58f8('0x2a')]['id']},'include':_0xac825c})[_0x58f8('0x17')](handleEntityNotFound(_0x379314,null))['then'](function(_0x925ce7){if(_0x925ce7&&_0x925ce7['Messages']){var _0x1397f3=_0x925ce7[_0x58f8('0x5d')]({'plain':!![]});fs[_0x58f8('0x5e')](_0x666059);for(var _0xb4b54e=0x0;_0xb4b54e<_0x1397f3['Messages'][_0x58f8('0x32')];_0xb4b54e++){var _0x184abf=_0x1397f3[_0x58f8('0x5b')][_0xb4b54e][_0x58f8('0x5a')];if(_0x184abf){var _0x531329=path['join'](_0x455e11,_0x184abf[_0x58f8('0x5f')]);if(fs[_0x58f8('0x60')](_0x531329)){fs['createReadStream'](_0x531329)[_0x58f8('0x61')](fs['createWriteStream'](path['join'](_0x666059,_0x184abf[_0x58f8('0x5f')])));}}}return BPromise[_0x58f8('0x62')]()[_0x58f8('0x17')](function(){return new BPromise(function(_0x383b9e,_0x754033){zipdir(_0x666059,{'saveTo':_0x16e175},function(_0x334e26,_0x139532){if(_0x334e26)return _0x754033(_0x334e26);return _0x383b9e(_0x139532);});})[_0x58f8('0x17')](function(){return new BPromise(function(_0x4a7711,_0x1b7bc9){rimraf(_0x666059,function(_0x483aa5){if(_0x483aa5)_0x1b7bc9(_0x483aa5);return _0x4a7711();});});})[_0x58f8('0x17')](function(){return _0x379314[_0x58f8('0x63')](_0x16e175,_0x2f8a0b,function(_0x235c0e){if(_0x235c0e){console[_0x58f8('0x64')](_0x58f8('0x65'),_0x235c0e);}else{fs[_0x58f8('0x66')](_0x16e175);}});});});}else{return _0x379314[_0x58f8('0x19')](0xc8);}})['catch'](handleError(_0x379314,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ab9206e..21eae10 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 _0xc276=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','getUsers','then'];(function(_0x36f906,_0x259289){var _0x4cd5e9=function(_0xdced72){while(--_0xdced72){_0x36f906['push'](_0x36f906['shift']());}};_0x4cd5e9(++_0x259289);}(_0xc276,0x1de));var _0x6c27=function(_0xa58142,_0x4776ee){_0xa58142=_0xa58142-0x0;var _0x4a3ccc=_0xc276[_0xa58142];return _0x4a3ccc;};'use strict';var EventEmitter=require(_0x6c27('0x0'));var FaxInteraction=require(_0x6c27('0x1'))['db'][_0x6c27('0x2')];var FaxMessage=require(_0x6c27('0x1'))['db'][_0x6c27('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c27('0x4'),'afterUpdate':_0x6c27('0x5'),'afterDestroy':'remove'};function emitEvent(_0x885231){return function(_0x1f910d,_0x231aa6,_0x54aede){_0x1f910d[_0x6c27('0x6')]({'attributes':['id'],'raw':!![]})[_0x6c27('0x7')](function(_0x4a3827){_0x1f910d[_0x6c27('0x8')]('Users',_0x4a3827[_0x6c27('0x9')](function(_0x24cb47){return{'id':_0x24cb47['id']};}));return FaxMessage[_0x6c27('0xa')]({'where':{'FaxInteractionId':_0x1f910d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x16156c){_0x1f910d[_0x6c27('0x8')](_0x6c27('0xb'),_0x16156c[_0x6c27('0xc')]);FaxInteractionEvents[_0x6c27('0xd')](_0x885231+':'+_0x1f910d['id'],_0x1f910d);FaxInteractionEvents[_0x6c27('0xd')](_0x885231,_0x1f910d);_0x54aede(null);})[_0x6c27('0xe')](_0x54aede(null));};}for(var e in events){if(events[_0x6c27('0xf')](e)){var event=events[e];FaxInteraction[_0x6c27('0x10')](e,emitEvent(event));}}module[_0x6c27('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xddc4=['hook','exports','../../mysqldb','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x61e9ec,_0x80b3a7){var _0x5849d2=function(_0x2684b6){while(--_0x2684b6){_0x61e9ec['push'](_0x61e9ec['shift']());}};_0x5849d2(++_0x80b3a7);}(_0xddc4,0xe2));var _0x4ddc=function(_0x4802f5,_0x435971){_0x4802f5=_0x4802f5-0x0;var _0x2c99ba=_0xddc4[_0x4802f5];return _0x2c99ba;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x4ddc('0x0'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ddc('0x1'),'afterDestroy':'remove'};function emitEvent(_0x110637){return function(_0x18609a,_0x5ecbb1,_0x3c61f4){_0x18609a[_0x4ddc('0x2')]({'attributes':['id'],'raw':!![]})[_0x4ddc('0x3')](function(_0x33c046){_0x18609a[_0x4ddc('0x4')](_0x4ddc('0x5'),_0x33c046[_0x4ddc('0x6')](function(_0x2e59bb){return{'id':_0x2e59bb['id']};}));return FaxMessage[_0x4ddc('0x7')]({'where':{'FaxInteractionId':_0x18609a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4ddc('0x3')](function(_0x17e40e){_0x18609a['setDataValue'](_0x4ddc('0x8'),_0x17e40e['length']);FaxInteractionEvents[_0x4ddc('0x9')](_0x110637+':'+_0x18609a['id'],_0x18609a);FaxInteractionEvents[_0x4ddc('0x9')](_0x110637,_0x18609a);_0x3c61f4(null);})[_0x4ddc('0xa')](_0x3c61f4(null));};}for(var e in events){if(events[_0x4ddc('0xb')](e)){var event=events[e];FaxInteraction[_0x4ddc('0xc')](e,emitEvent(event));}}module[_0x4ddc('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 81b9efc..7730325 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 _0xde3a=['fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xde3a,0x140));var _0xade3=function(_0x18f8aa,_0x2e0696){_0x18f8aa=_0x18f8aa-0x0;var _0x506b84=_0xde3a[_0x18f8aa];return _0x506b84;};'use strict';var _=require(_0xade3('0x0'));var util=require(_0xade3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xade3('0x2'));var rp=require(_0xade3('0x3'));var fs=require('fs');var path=require(_0xade3('0x4'));var rimraf=require(_0xade3('0x5'));var config=require(_0xade3('0x6'));var attributes=require(_0xade3('0x7'));module[_0xade3('0x8')]=function(_0x3c5d92,_0x3a3078){return _0x3c5d92['define'](_0xade3('0x9'),attributes,{'tableName':_0xade3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42cb93,_0x364617,_0x11f798){if(_0x42cb93[_0xade3('0xb')](_0xade3('0xc'))){_0x42cb93['closedAt']=moment()[_0xade3('0xd')](_0xade3('0xe'));}_0x11f798(null,_0x42cb93);}}});}; \ No newline at end of file +var _0xdfc5=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird'];(function(_0x4dc212,_0x14a01d){var _0x34d4bb=function(_0x5181e4){while(--_0x5181e4){_0x4dc212['push'](_0x4dc212['shift']());}};_0x34d4bb(++_0x14a01d);}(_0xdfc5,0x13d));var _0x5dfc=function(_0xf169c5,_0x1ef3d3){_0xf169c5=_0xf169c5-0x0;var _0x17bc66=_0xdfc5[_0xf169c5];return _0x17bc66;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5dfc('0x0'));var moment=require(_0x5dfc('0x1'));var BPromise=require(_0x5dfc('0x2'));var rp=require(_0x5dfc('0x3'));var fs=require('fs');var path=require(_0x5dfc('0x4'));var rimraf=require(_0x5dfc('0x5'));var config=require(_0x5dfc('0x6'));var attributes=require(_0x5dfc('0x7'));module[_0x5dfc('0x8')]=function(_0x3b8246,_0x9011b5){return _0x3b8246[_0x5dfc('0x9')](_0x5dfc('0xa'),attributes,{'tableName':_0x5dfc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x576ebf,_0x45e89a,_0x117540){if(_0x576ebf[_0x5dfc('0xc')](_0x5dfc('0xd'))){_0x576ebf['closedAt']=moment()[_0x5dfc('0xe')](_0x5dfc('0xf'));}_0x117540(null,_0x576ebf);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1beaf37..e8ecec6 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 _0x363a=['client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','limit','catch','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0xaf41db,_0x2b713e){var _0x4c2398=function(_0x507eca){while(--_0x507eca){_0xaf41db['push'](_0xaf41db['shift']());}};_0x4c2398(++_0x2b713e);}(_0x363a,0x1af));var _0xa363=function(_0xe8360c,_0x4b51d5){_0xe8360c=_0xe8360c-0x0;var _0x377630=_0x363a[_0xe8360c];return _0x377630;};'use strict';var _=require('lodash');var util=require(_0xa363('0x0'));var moment=require(_0xa363('0x1'));var BPromise=require(_0xa363('0x2'));var rs=require(_0xa363('0x3'));var fs=require('fs');var Redis=require(_0xa363('0x4'));var db=require(_0xa363('0x5'))['db'];var utils=require(_0xa363('0x6'));var logger=require('../../config/logger')(_0xa363('0x7'));var config=require('../../config/environment');var jayson=require(_0xa363('0x8'));var client=jayson[_0xa363('0x9')][_0xa363('0xa')]({'port':0x232a});config[_0xa363('0xb')]=_[_0xa363('0xc')](config[_0xa363('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa363('0xd'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xa363('0xe')](socket);function respondWithRpcPromise(_0x5e101f,_0x59e7c6,_0x5dc1d5){return new BPromise(function(_0x1cf4b0,_0x487f34){return client[_0xa363('0xf')](_0x5e101f,_0x5dc1d5)[_0xa363('0x10')](function(_0x3f1ff3){logger[_0xa363('0x11')](_0xa363('0x12'),_0x59e7c6,_0xa363('0x13'));logger[_0xa363('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x59e7c6,_0xa363('0x13'),JSON[_0xa363('0x15')](_0x3f1ff3));if(_0x3f1ff3[_0xa363('0x16')]){if(_0x3f1ff3['error'][_0xa363('0x17')]===0x1f4){logger['error'](_0xa363('0x12'),_0x59e7c6,_0x3f1ff3[_0xa363('0x16')]['message']);return _0x487f34(_0x3f1ff3[_0xa363('0x16')]['message']);}logger['error'](_0xa363('0x12'),_0x59e7c6,_0x3f1ff3[_0xa363('0x16')][_0xa363('0x18')]);return _0x1cf4b0(_0x3f1ff3[_0xa363('0x16')]['message']);}else{logger[_0xa363('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x59e7c6,_0xa363('0x13'));_0x1cf4b0(_0x3f1ff3[_0xa363('0x19')][_0xa363('0x18')]);}})['catch'](function(_0x759066){logger[_0xa363('0x16')](_0xa363('0x12'),_0x59e7c6,_0x759066);_0x487f34(_0x759066);});});}exports[_0xa363('0x1a')]=function(_0x55121c){var _0x46f20e=this;return new Promise(function(_0x27865e,_0x23eb1b){return db[_0xa363('0x1b')]['update'](_0x55121c[_0xa363('0x1c')],{'raw':_0x55121c['options']?_0x55121c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55121c['options']?_0x55121c[_0xa363('0x1d')][_0xa363('0x1e')]||null:null,'attributes':_0x55121c[_0xa363('0x1d')]?_0x55121c[_0xa363('0x1d')][_0xa363('0x1f')]||null:null,'limit':_0x55121c['options']?_0x55121c['options'][_0xa363('0x20')]||null:null})['then'](function(_0x4fd27c){logger[_0xa363('0x11')](_0xa363('0x1a'),_0x55121c);logger['debug'](_0xa363('0x1a'),_0x55121c,JSON[_0xa363('0x15')](_0x4fd27c));_0x27865e(_0x4fd27c);})[_0xa363('0x21')](function(_0xe52c4a){logger[_0xa363('0x16')](_0xa363('0x1a'),_0xe52c4a['message'],_0x55121c);_0x23eb1b(_0x46f20e[_0xa363('0x16')](0x1f4,_0xe52c4a[_0xa363('0x18')]));});});};exports[_0xa363('0x22')]=function(_0x53eb1e){return new Promise(function(_0x5c7851,_0x41b9f0){return db[_0xa363('0x1b')][_0xa363('0x23')]({'where':_0x53eb1e[_0xa363('0x1d')]?_0x53eb1e[_0xa363('0x1d')][_0xa363('0x1e')]||null:null})[_0xa363('0x10')](function(_0x4f60b5){if(_0x4f60b5){return _0x4f60b5[_0xa363('0x24')](_0x53eb1e['body'][_0xa363('0x25')],_['omit'](_0x53eb1e['body'],[_0xa363('0x25'),'id'])||{});}})[_0xa363('0x26')](function(_0x1975e1){logger['info']('AddTags',_0x53eb1e);logger[_0xa363('0x14')](_0xa363('0x27'),_0x53eb1e,JSON[_0xa363('0x15')](_0x1975e1));_0x5c7851(_0x1975e1);})[_0xa363('0x21')](function(_0x46b987){logger[_0xa363('0x16')](_0xa363('0x27'),_0x46b987[_0xa363('0x18')],_0x53eb1e);_0x41b9f0(_this['error'](0x1f4,_0x46b987[_0xa363('0x18')]));});});}; \ No newline at end of file +var _0x68ee=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','then','catch','AddTagsToFaxInteraction','find','addTags','ids'];(function(_0xdc7a97,_0x1a098e){var _0x9a3b9a=function(_0x370c48){while(--_0x370c48){_0xdc7a97['push'](_0xdc7a97['shift']());}};_0x9a3b9a(++_0x1a098e);}(_0x68ee,0x7f));var _0xe68e=function(_0x3e4138,_0x140f9b){_0x3e4138=_0x3e4138-0x0;var _0x3c93cf=_0x68ee[_0x3e4138];return _0x3c93cf;};'use strict';var _=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var moment=require(_0xe68e('0x2'));var BPromise=require(_0xe68e('0x3'));var rs=require(_0xe68e('0x4'));var fs=require('fs');var Redis=require(_0xe68e('0x5'));var db=require(_0xe68e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe68e('0x7'))(_0xe68e('0x8'));var config=require(_0xe68e('0x9'));var jayson=require(_0xe68e('0xa'));var client=jayson[_0xe68e('0xb')]['http']({'port':0x232a});config[_0xe68e('0xc')]=_[_0xe68e('0xd')](config[_0xe68e('0xc')],{'host':_0xe68e('0xe'),'port':0x18eb});var socket=require(_0xe68e('0xf'))(new Redis(config[_0xe68e('0xc')]));require(_0xe68e('0x10'))[_0xe68e('0x11')](socket);function respondWithRpcPromise(_0x10ed05,_0x238998,_0x1eaf18){return new BPromise(function(_0x17c1f9,_0x133214){return client[_0xe68e('0x12')](_0x10ed05,_0x1eaf18)['then'](function(_0x7b1aad){logger[_0xe68e('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x238998,_0xe68e('0x14'));logger[_0xe68e('0x15')](_0xe68e('0x16'),_0x238998,_0xe68e('0x14'),JSON[_0xe68e('0x17')](_0x7b1aad));if(_0x7b1aad[_0xe68e('0x18')]){if(_0x7b1aad[_0xe68e('0x18')][_0xe68e('0x19')]===0x1f4){logger[_0xe68e('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x238998,_0x7b1aad[_0xe68e('0x18')]['message']);return _0x133214(_0x7b1aad['error']['message']);}logger[_0xe68e('0x18')](_0xe68e('0x1a'),_0x238998,_0x7b1aad['error'][_0xe68e('0x1b')]);return _0x17c1f9(_0x7b1aad[_0xe68e('0x18')]['message']);}else{logger[_0xe68e('0x13')](_0xe68e('0x1a'),_0x238998,_0xe68e('0x14'));_0x17c1f9(_0x7b1aad['result'][_0xe68e('0x1b')]);}})['catch'](function(_0x964288){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x238998,_0x964288);_0x133214(_0x964288);});});}exports[_0xe68e('0x1c')]=function(_0x51b4a6){var _0xf36977=this;return new Promise(function(_0x3a1051,_0x55e773){return db[_0xe68e('0x1d')][_0xe68e('0x1e')](_0x51b4a6[_0xe68e('0x1f')],{'raw':_0x51b4a6['options']?_0x51b4a6[_0xe68e('0x20')][_0xe68e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b4a6[_0xe68e('0x20')]?_0x51b4a6[_0xe68e('0x20')][_0xe68e('0x22')]||null:null,'attributes':_0x51b4a6[_0xe68e('0x20')]?_0x51b4a6[_0xe68e('0x20')]['attributes']||null:null,'limit':_0x51b4a6[_0xe68e('0x20')]?_0x51b4a6[_0xe68e('0x20')]['limit']||null:null})[_0xe68e('0x23')](function(_0x1d4f1f){logger['info']('UpdateFaxInteraction',_0x51b4a6);logger[_0xe68e('0x15')](_0xe68e('0x1c'),_0x51b4a6,JSON[_0xe68e('0x17')](_0x1d4f1f));_0x3a1051(_0x1d4f1f);})[_0xe68e('0x24')](function(_0x280174){logger[_0xe68e('0x18')]('UpdateFaxInteraction',_0x280174['message'],_0x51b4a6);_0x55e773(_0xf36977[_0xe68e('0x18')](0x1f4,_0x280174[_0xe68e('0x1b')]));});});};exports[_0xe68e('0x25')]=function(_0x469489){return new Promise(function(_0x279182,_0xf04e80){return db[_0xe68e('0x1d')][_0xe68e('0x26')]({'where':_0x469489['options']?_0x469489['options'][_0xe68e('0x22')]||null:null})['then'](function(_0x295d4d){if(_0x295d4d){return _0x295d4d[_0xe68e('0x27')](_0x469489[_0xe68e('0x1f')][_0xe68e('0x28')],_['omit'](_0x469489[_0xe68e('0x1f')],[_0xe68e('0x28'),'id'])||{});}})['spread'](function(_0x146dfd){logger['info'](_0xe68e('0x29'),_0x469489);logger[_0xe68e('0x15')](_0xe68e('0x29'),_0x469489,JSON[_0xe68e('0x17')](_0x146dfd));_0x279182(_0x146dfd);})['catch'](function(_0x35b961){logger[_0xe68e('0x18')](_0xe68e('0x29'),_0x35b961[_0xe68e('0x1b')],_0x469489);_0xf04e80(_this[_0xe68e('0x18')](0x1f4,_0x35b961[_0xe68e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f8c398b..92ef2cd 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 _0x70df=['remove','update','emit','register','./faxInteraction.events','save'];(function(_0x1f65f9,_0x28dca8){var _0x59d1b1=function(_0x5d1c3f){while(--_0x5d1c3f){_0x1f65f9['push'](_0x1f65f9['shift']());}};_0x59d1b1(++_0x28dca8);}(_0x70df,0xa6));var _0xf70d=function(_0x49f0b1,_0x2b9bd4){_0x49f0b1=_0x49f0b1-0x0;var _0xce6304=_0x70df[_0x49f0b1];return _0xce6304;};'use strict';var FaxInteractionEvents=require(_0xf70d('0x0'));var events=[_0xf70d('0x1'),_0xf70d('0x2'),_0xf70d('0x3')];function createListener(_0x15187d,_0x5d8582){return function(_0x5502ca){_0x5d8582[_0xf70d('0x4')](_0x15187d,_0x5502ca);};}function removeListener(_0xf25c9f,_0x1a7e14){return function(){FaxInteractionEvents['removeListener'](_0xf25c9f,_0x1a7e14);};}exports[_0xf70d('0x5')]=function(_0x5e71d6){for(var _0x14e56b=0x0,_0xf492cf=events['length'];_0x14e56b<_0xf492cf;_0x14e56b++){var _0x25d77b=events[_0x14e56b];var _0x30f382=createListener('faxInteraction:'+_0x25d77b,_0x5e71d6);FaxInteractionEvents['on'](_0x25d77b,_0x30f382);}}; \ No newline at end of file +var _0x2a48=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x40dc85,_0x14e2b5){var _0x5e9047=function(_0x3381ae){while(--_0x3381ae){_0x40dc85['push'](_0x40dc85['shift']());}};_0x5e9047(++_0x14e2b5);}(_0x2a48,0x1ec));var _0x82a4=function(_0x8e1179,_0x3c45e9){_0x8e1179=_0x8e1179-0x0;var _0x3fb2bc=_0x2a48[_0x8e1179];return _0x3fb2bc;};'use strict';var FaxInteractionEvents=require(_0x82a4('0x0'));var events=[_0x82a4('0x1'),_0x82a4('0x2'),_0x82a4('0x3')];function createListener(_0x14d0e6,_0x22be7f){return function(_0x15a550){_0x22be7f['emit'](_0x14d0e6,_0x15a550);};}function removeListener(_0xf56ba7,_0x18ed9a){return function(){FaxInteractionEvents[_0x82a4('0x4')](_0xf56ba7,_0x18ed9a);};}exports[_0x82a4('0x5')]=function(_0x56ba6f){for(var _0x52d356=0x0,_0x5ad3b5=events[_0x82a4('0x6')];_0x52d356<_0x5ad3b5;_0x52d356++){var _0xdb3035=events[_0x52d356];var _0x381c93=createListener(_0x82a4('0x7')+_0xdb3035,_0x56ba6f);FaxInteractionEvents['on'](_0xdb3035,_0x381c93);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 51d6c80..077f7b4 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 _0xc0c8=['faxinteraction:destroy','destroy','removeTags','exports','util','path','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete'];(function(_0x8a217e,_0x450bfc){var _0x3fc350=function(_0x55ed99){while(--_0x55ed99){_0x8a217e['push'](_0x8a217e['shift']());}};_0x3fc350(++_0x450bfc);}(_0xc0c8,0x109));var _0x8c0c=function(_0xd29265,_0x311ced){_0xd29265=_0xd29265-0x0;var _0xf4750c=_0xc0c8[_0xd29265];return _0xf4750c;};'use strict';var multer=require('multer');var util=require(_0x8c0c('0x0'));var path=require(_0x8c0c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8c0c('0x2'));var auth=require(_0x8c0c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8c0c('0x4'));var controller=require(_0x8c0c('0x5'));router[_0x8c0c('0x6')]('/',auth[_0x8c0c('0x7')](),controller['index']);router['get'](_0x8c0c('0x8'),auth[_0x8c0c('0x7')](),controller[_0x8c0c('0x9')]);router['get'](_0x8c0c('0xa'),auth['isAuthenticated'](),controller[_0x8c0c('0xb')]);router['get'](_0x8c0c('0xc'),auth[_0x8c0c('0x7')](),controller[_0x8c0c('0xd')]);router[_0x8c0c('0x6')]('/:id/download',auth[_0x8c0c('0x7')](),controller[_0x8c0c('0xe')]);router[_0x8c0c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8c0c('0xf')](_0x8c0c('0xc'),auth[_0x8c0c('0x7')](),controller[_0x8c0c('0x10')]);router[_0x8c0c('0xf')](_0x8c0c('0x11'),auth[_0x8c0c('0x7')](),interaction[_0x8c0c('0x12')](_0x8c0c('0x13'),_0x8c0c('0x14')),controller[_0x8c0c('0x15')]);router[_0x8c0c('0x16')](_0x8c0c('0xa'),auth[_0x8c0c('0x7')](),interaction[_0x8c0c('0x12')](_0x8c0c('0x13'),_0x8c0c('0x17')),controller['update']);router[_0x8c0c('0x18')](_0x8c0c('0xa'),auth[_0x8c0c('0x7')](),interaction[_0x8c0c('0x12')](_0x8c0c('0x13'),_0x8c0c('0x19')),controller[_0x8c0c('0x1a')]);router[_0x8c0c('0x18')](_0x8c0c('0x11'),auth[_0x8c0c('0x7')](),controller[_0x8c0c('0x1b')]);module[_0x8c0c('0x1c')]=router; \ No newline at end of file +var _0x25c6=['/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','exports','multer','util','path','express','Router','../../config/environment','./faxInteraction.controller','get','index','/describe','/:id'];(function(_0x248795,_0x43099b){var _0x2e9e7f=function(_0x4cf1f3){while(--_0x4cf1f3){_0x248795['push'](_0x248795['shift']());}};_0x2e9e7f(++_0x43099b);}(_0x25c6,0x15d));var _0x625c=function(_0x2b1b8d,_0x24ed2f){_0x2b1b8d=_0x2b1b8d-0x0;var _0x51f032=_0x25c6[_0x2b1b8d];return _0x51f032;};'use strict';var multer=require(_0x625c('0x0'));var util=require(_0x625c('0x1'));var path=require(_0x625c('0x2'));var timeout=require('connect-timeout');var express=require(_0x625c('0x3'));var router=express[_0x625c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x625c('0x5'));var controller=require(_0x625c('0x6'));router[_0x625c('0x7')]('/',auth['isAuthenticated'](),controller[_0x625c('0x8')]);router[_0x625c('0x7')](_0x625c('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x625c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x625c('0x7')](_0x625c('0xb'),auth[_0x625c('0xc')](),controller[_0x625c('0xd')]);router[_0x625c('0x7')](_0x625c('0xe'),auth[_0x625c('0xc')](),controller[_0x625c('0xf')]);router[_0x625c('0x10')]('/',auth[_0x625c('0xc')](),controller[_0x625c('0x11')]);router['post']('/:id/messages',auth[_0x625c('0xc')](),controller[_0x625c('0x12')]);router['post'](_0x625c('0x13'),auth[_0x625c('0xc')](),interaction[_0x625c('0x14')]('fax',_0x625c('0x15')),controller[_0x625c('0x16')]);router[_0x625c('0x17')](_0x625c('0xa'),auth[_0x625c('0xc')](),interaction[_0x625c('0x14')](_0x625c('0x18'),_0x625c('0x19')),controller[_0x625c('0x1a')]);router[_0x625c('0x1b')](_0x625c('0xa'),auth[_0x625c('0xc')](),interaction[_0x625c('0x14')](_0x625c('0x18'),_0x625c('0x1c')),controller['destroy']);router['delete'](_0x625c('0x13'),auth[_0x625c('0xc')](),controller['removeTags']);module[_0x625c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index e46112e..22fa6fe 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 _0x55d2=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x41e961,_0x234d36){var _0x1ba461=function(_0xbd7d7){while(--_0xbd7d7){_0x41e961['push'](_0x41e961['shift']());}};_0x1ba461(++_0x234d36);}(_0x55d2,0x9f));var _0x255d=function(_0x177f03,_0x23208f){_0x177f03=_0x177f03-0x0;var _0x85dc43=_0x55d2[_0x177f03];return _0x85dc43;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x255d('0x0')](_0x255d('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x255d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x255d('0x3')]('in',_0x255d('0x4')),'defaultValue':_0x255d('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x255d('0x5')]}}; \ No newline at end of file +var _0x50a6=['exports','BOOLEAN','out','TEXT','sequelize'];(function(_0x24d658,_0x196939){var _0x4b34dc=function(_0x5e396a){while(--_0x5e396a){_0x24d658['push'](_0x24d658['shift']());}};_0x4b34dc(++_0x196939);}(_0x50a6,0xa4));var _0x650a=function(_0x25a45a,_0x156e4b){_0x25a45a=_0x25a45a-0x0;var _0x237f87=_0x50a6[_0x25a45a];return _0x237f87;};'use strict';var Sequelize=require(_0x650a('0x0'));module[_0x650a('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x650a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x650a('0x3')),'defaultValue':_0x650a('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x650a('0x4')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b192670..0cbddaf 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 _0x297f=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','map','FaxMessage','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','rawAttributes','catch','body','find','params','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','contact','EventManager','create','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','root','server','files','attachments','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x297f,0x10f));var _0xf297=function(_0x3e64e5,_0xa6abd0){_0x3e64e5=_0x3e64e5-0x0;var _0x4c34d1=_0x297f[_0x3e64e5];return _0x4c34d1;};'use strict';var emlformat=require(_0xf297('0x0'));var rimraf=require(_0xf297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf297('0x2'));var rp=require(_0xf297('0x3'));var moment=require(_0xf297('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf297('0x5'));var util=require(_0xf297('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf297('0x7'));var fs=require('fs');var fs_extra=require(_0xf297('0x8'));var _=require(_0xf297('0x9'));var squel=require(_0xf297('0xa'));var crypto=require(_0xf297('0xb'));var jsforce=require(_0xf297('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf297('0xd'));var querystring=require(_0xf297('0xe'));var Papa=require(_0xf297('0xf'));var Redis=require(_0xf297('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf297('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf297('0x12'));var logger=require(_0xf297('0x13'))(_0xf297('0x14'));var utils=require(_0xf297('0x15'));var config=require(_0xf297('0x16'));var licenseUtil=require(_0xf297('0x17'));var db=require(_0xf297('0x18'))['db'];config[_0xf297('0x19')]=_[_0xf297('0x1a')](config[_0xf297('0x19')],{'host':_0xf297('0x1b'),'port':0x18eb});var socket=require(_0xf297('0x1c'))(new Redis(config[_0xf297('0x19')]));require(_0xf297('0x1d'))['register'](socket);var jayson=require(_0xf297('0x1e'));var client=jayson[_0xf297('0x1f')][_0xf297('0x20')]({'port':0x232c});var client9002=jayson[_0xf297('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56829d,_0x1f3220,_0x232f87,_0x8154c8){return new BPromise(function(_0x562aad,_0x48fbfd){var _0x2e93fa=_0x8154c8||client;return _0x2e93fa['request'](_0x56829d,_0x232f87)['then'](function(_0x31eba2){logger[_0xf297('0x21')]('FaxMessage,\x20%s,\x20%s',_0x1f3220,_0xf297('0x22'));logger[_0xf297('0x23')](_0xf297('0x24'),_0x1f3220,_0xf297('0x22'),JSON['stringify'](_0x31eba2));if(_0x31eba2['error']){if(_0x31eba2[_0xf297('0x25')][_0xf297('0x26')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1f3220,_0x31eba2[_0xf297('0x25')][_0xf297('0x27')]);return _0x48fbfd(_0x31eba2[_0xf297('0x25')][_0xf297('0x27')]);}logger[_0xf297('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1f3220,_0x31eba2[_0xf297('0x25')][_0xf297('0x27')]);return _0x562aad(_0x31eba2['error'][_0xf297('0x27')]);}else{logger[_0xf297('0x21')](_0xf297('0x28'),_0x1f3220,_0xf297('0x22'));_0x562aad(_0x31eba2[_0xf297('0x29')][_0xf297('0x27')]);}})['catch'](function(_0x18c616){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1f3220,_0x18c616);_0x48fbfd(_0x18c616);});});}function respondWithStatusCode(_0x43bd3d,_0x1355a7){_0x1355a7=_0x1355a7||0xcc;return function(_0x22c3f6){if(_0x22c3f6){return _0x43bd3d[_0xf297('0x2a')](_0x1355a7);}return _0x43bd3d[_0xf297('0x2b')](_0x1355a7)[_0xf297('0x2c')]();};}function respondWithResult(_0x506d6b,_0x3e202d){_0x3e202d=_0x3e202d||0xc8;return function(_0x392e77){if(_0x392e77){return _0x506d6b[_0xf297('0x2b')](_0x3e202d)[_0xf297('0x2d')](_0x392e77);}};}function respondWithFilteredResult(_0x444bd6,_0xc809fa){return function(_0x512cc2){if(_0x512cc2){var _0x112fa9=typeof _0xc809fa[_0xf297('0x2e')]===_0xf297('0x2f')&&typeof _0xc809fa[_0xf297('0x30')]===_0xf297('0x2f');var _0x4abc56=_0x512cc2[_0xf297('0x31')];var _0x4076ae=_0x112fa9?0x0:_0xc809fa[_0xf297('0x2e')];var _0x143918=_0x112fa9?_0x512cc2[_0xf297('0x31')]:_0xc809fa[_0xf297('0x2e')]+_0xc809fa['limit'];var _0x274661;if(_0x143918>=_0x4abc56){_0x143918=_0x4abc56;_0x274661=0xc8;}else{_0x274661=0xce;}_0x444bd6['status'](_0x274661);return _0x444bd6[_0xf297('0x32')](_0xf297('0x33'),_0x4076ae+'-'+_0x143918+'/'+_0x4abc56)[_0xf297('0x2d')](_0x512cc2);}return null;};}function patchUpdates(_0x255a6f){return function(_0x9aae5b){try{jsonpatch['apply'](_0x9aae5b,_0x255a6f,!![]);}catch(_0x58108c){return BPromise[_0xf297('0x34')](_0x58108c);}return _0x9aae5b[_0xf297('0x35')]();};}function saveUpdates(_0x3f835a,_0x3475c5){return function(_0x34ee06){if(_0x34ee06){return _0x34ee06[_0xf297('0x36')](_0x3f835a)[_0xf297('0x37')](function(_0x1c674e){return _0x1c674e;});}return null;};}function removeEntity(_0x3198b4,_0x258f7e){return function(_0x4bc0d9){if(_0x4bc0d9){return _0x4bc0d9[_0xf297('0x38')]()[_0xf297('0x37')](function(){_0x3198b4[_0xf297('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed3b6,_0x4b25db){return function(_0x411144){if(!_0x411144){_0x3ed3b6['sendStatus'](0x194);}return _0x411144;};}function handleError(_0x51cc33,_0xb1a28f){_0xb1a28f=_0xb1a28f||0x1f4;return function(_0xc11b3c){logger[_0xf297('0x25')](_0xc11b3c[_0xf297('0x39')]);if(_0xc11b3c[_0xf297('0x3a')]){delete _0xc11b3c[_0xf297('0x3a')];}_0x51cc33['status'](_0xb1a28f)['send'](_0xc11b3c);};}exports['index']=function(_0x4732a0,_0x24e264){var _0x46ab63={},_0x508fdc={},_0x2a3ef1={'count':0x0,'rows':[]};var _0x23d4c6=_[_0xf297('0x3b')](db[_0xf297('0x3c')]['rawAttributes'],function(_0x27a66c){return{'name':_0x27a66c[_0xf297('0x3d')],'type':_0x27a66c[_0xf297('0x3e')]['key']};});_0x508fdc['model']=_[_0xf297('0x3b')](_0x23d4c6,_0xf297('0x3a'));_0x508fdc['query']=_[_0xf297('0x3f')](_0x4732a0[_0xf297('0x40')]);_0x508fdc[_0xf297('0x41')]=_[_0xf297('0x42')](_0x508fdc[_0xf297('0x43')],_0x508fdc['query']);_0x46ab63[_0xf297('0x44')]=_[_0xf297('0x42')](_0x508fdc[_0xf297('0x43')],qs[_0xf297('0x45')](_0x4732a0[_0xf297('0x40')]['fields']));_0x46ab63[_0xf297('0x44')]=_0x46ab63[_0xf297('0x44')][_0xf297('0x46')]?_0x46ab63[_0xf297('0x44')]:_0x508fdc[_0xf297('0x43')];if(!_0x4732a0['query'][_0xf297('0x47')](_0xf297('0x48'))){_0x46ab63[_0xf297('0x30')]=qs[_0xf297('0x30')](_0x4732a0['query'][_0xf297('0x30')]);_0x46ab63['offset']=qs[_0xf297('0x2e')](_0x4732a0[_0xf297('0x40')][_0xf297('0x2e')]);}_0x46ab63[_0xf297('0x49')]=qs[_0xf297('0x4a')](_0x4732a0[_0xf297('0x40')][_0xf297('0x4a')]);_0x46ab63[_0xf297('0x4b')]=qs[_0xf297('0x41')](_[_0xf297('0x4c')](_0x4732a0[_0xf297('0x40')],_0x508fdc[_0xf297('0x41')]),_0x23d4c6);if(_0x4732a0[_0xf297('0x40')][_0xf297('0x4d')]){_0x46ab63[_0xf297('0x4b')]=_[_0xf297('0x4e')](_0x46ab63[_0xf297('0x4b')],{'$or':_[_0xf297('0x3b')](_0x23d4c6,function(_0x2bdbe7){if(_0x2bdbe7[_0xf297('0x3e')]!==_0xf297('0x4f')){var _0x302c14={};_0x302c14[_0x2bdbe7[_0xf297('0x3a')]]={'$like':'%'+_0x4732a0[_0xf297('0x40')][_0xf297('0x4d')]+'%'};return _0x302c14;}})});}_0x46ab63=_[_0xf297('0x4e')]({},_0x46ab63,_0x4732a0[_0xf297('0x50')]);var _0x534134={'where':_0x46ab63[_0xf297('0x4b')]};return db['FaxMessage']['count'](_0x534134)[_0xf297('0x37')](function(_0x252af8){_0x2a3ef1['count']=_0x252af8;if(_0x4732a0[_0xf297('0x40')][_0xf297('0x51')]){_0x46ab63[_0xf297('0x52')]=[{'all':!![]}];}return db[_0xf297('0x3c')]['findAll'](_0x46ab63);})[_0xf297('0x37')](function(_0x4d3f96){_0x2a3ef1['rows']=_0x4d3f96;return _0x2a3ef1;})[_0xf297('0x37')](respondWithFilteredResult(_0x24e264,_0x46ab63))['catch'](handleError(_0x24e264,null));};exports[_0xf297('0x53')]=function(_0x261f52,_0x3b692d){var _0x35ec8a={'raw':!![],'where':{'id':_0x261f52['params']['id']}},_0x14e125={};_0x14e125[_0xf297('0x43')]=_[_0xf297('0x3f')](db['FaxMessage'][_0xf297('0x54')]);_0x14e125['query']=_['keys'](_0x261f52[_0xf297('0x40')]);_0x14e125[_0xf297('0x41')]=_[_0xf297('0x42')](_0x14e125['model'],_0x14e125['query']);_0x35ec8a[_0xf297('0x44')]=_[_0xf297('0x42')](_0x14e125['model'],qs['fields'](_0x261f52[_0xf297('0x40')][_0xf297('0x45')]));_0x35ec8a['attributes']=_0x35ec8a[_0xf297('0x44')][_0xf297('0x46')]?_0x35ec8a[_0xf297('0x44')]:_0x14e125['model'];if(_0x261f52['query'][_0xf297('0x51')]){_0x35ec8a[_0xf297('0x52')]=[{'all':!![]}];}_0x35ec8a=_[_0xf297('0x4e')]({},_0x35ec8a,_0x261f52['options']);return db[_0xf297('0x3c')]['find'](_0x35ec8a)['then'](handleEntityNotFound(_0x3b692d,null))[_0xf297('0x37')](respondWithResult(_0x3b692d,null))[_0xf297('0x55')](handleError(_0x3b692d,null));};exports[_0xf297('0x36')]=function(_0x3d42c4,_0x12ea62){if(_0x3d42c4[_0xf297('0x56')]['id']){delete _0x3d42c4[_0xf297('0x56')]['id'];}return db[_0xf297('0x3c')][_0xf297('0x57')]({'where':{'id':_0x3d42c4[_0xf297('0x58')]['id']}})[_0xf297('0x37')](handleEntityNotFound(_0x12ea62,null))[_0xf297('0x37')](saveUpdates(_0x3d42c4[_0xf297('0x56')],null))[_0xf297('0x37')](respondWithResult(_0x12ea62,null))[_0xf297('0x55')](handleError(_0x12ea62,null));};exports[_0xf297('0x38')]=function(_0x34b26f,_0x132a32){return db[_0xf297('0x3c')][_0xf297('0x57')]({'where':{'id':_0x34b26f[_0xf297('0x58')]['id']}})[_0xf297('0x37')](handleEntityNotFound(_0x132a32,null))['then'](removeEntity(_0x132a32,null))[_0xf297('0x55')](handleError(_0x132a32,null));};exports['describe']=function(_0x32b9f5,_0x4053e4){return db[_0xf297('0x3c')][_0xf297('0x59')]()[_0xf297('0x37')](respondWithResult(_0x4053e4,null))['catch'](handleError(_0x4053e4,null));};var interaction_log=require(_0xf297('0x13'))(_0xf297('0x5a'));exports[_0xf297('0x5b')]=function(_0x39f463,_0x29d0dc,_0x16a23e){var _0x172008={'agent':{},'channel':_0xf297('0x5c')};if(_0x39f463[_0xf297('0x56')]['id']){delete _0x39f463[_0xf297('0x56')]['id'];}_0x39f463[_0xf297('0x56')]['read']=!![];_0x39f463['body'][_0xf297('0x5d')]=moment()[_0xf297('0x5e')](_0xf297('0x5f'));_0x39f463[_0xf297('0x56')]['UserId']=_0x39f463[_0xf297('0x56')][_0xf297('0x60')]||_0x39f463[_0xf297('0x61')]['id'];_0x172008['agent']['id']=_0x39f463[_0xf297('0x56')]['UserId'];return db[_0xf297('0x3c')]['find']({'where':{'id':_0x39f463['params']['id'],'UserId':null}})[_0xf297('0x37')](handleEntityNotFound(_0x29d0dc,null))[_0xf297('0x37')](saveUpdates(_0x39f463['body'],null))[_0xf297('0x37')](function(_0x3907a3){if(_0x3907a3){_0x172008[_0xf297('0x27')]=_0x3907a3['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3907a3[_0xf297('0x62')]}});}return null;})[_0xf297('0x37')](handleEntityNotFound(_0x29d0dc,null))[_0xf297('0x37')](function(_0x2a4bf7){if(_0x2a4bf7){return _0x2a4bf7['update']({'UserId':_0x39f463[_0xf297('0x56')]['UserId'],'read1stAt':_['isNil'](_0x2a4bf7[_0xf297('0x63')])?moment()[_0xf297('0x5e')](_0xf297('0x5f')):undefined});}return null;})[_0xf297('0x37')](function(_0x5cca92){if(_0x5cca92){_0x172008[_0xf297('0x64')]=_0x5cca92[_0xf297('0x65')]({'plain':!![]});interaction_log[_0xf297('0x21')](_0xf297('0x66'),_0x39f463['user']['id'],_0x39f463[_0xf297('0x61')]['name'],_0x39f463['user']['role'],_0x172008[_0xf297('0x64')]['id'],_0x39f463[_0xf297('0x56')]?JSON[_0xf297('0x67')](_0x39f463[_0xf297('0x56')]):'null');return respondWithRpcPromise(_0xf297('0x68'),_0xf297('0x69'),_0x172008);}return null;})[_0xf297('0x37')](function(_0x2f40bb){var _0x416423=_0xf297('0x6a')+_0x2f40bb[_0xf297('0x27')][_0xf297('0x6b')];return db[_0xf297('0x6c')][_0xf297('0x40')](_0x416423,{'type':db[_0xf297('0x6d')][_0xf297('0x6e')][_0xf297('0x6f')],'raw':!![]})[_0xf297('0x37')](function(_0x5dffa7){return _0x5dffa7;});})[_0xf297('0x37')](function(_0x5a0082){if(_0x5a0082){_0x172008['message']['contact']=_0x5a0082[0x0];if(!_0x39f463['body'][_0xf297('0x60')])return;return db[_0xf297('0x70')][_0xf297('0x57')]({'where':{'id':_0x39f463[_0xf297('0x56')]['UserId'],'role':_0xf297('0x71')},'attributes':['id',_0xf297('0x3a'),_0xf297('0x72'),_0xf297('0x73'),_0xf297('0x74')],'raw':!![]});}return null;})['then'](function(_0x5df7c4){if(!_0x5df7c4)return null;_0x172008[_0xf297('0x27')]['agent']=_0x5df7c4;return _0x172008;})['then'](function(_0x54ed85){if(_0x54ed85){if(_0x39f463[_0xf297('0x56')][_0xf297('0x75')]){_0x172008[_0xf297('0x27')][_0xf297('0x76')]=util[_0xf297('0x5e')](_0xf297('0x77'),_0x39f463[_0xf297('0x61')][_0xf297('0x3a')]);_0x172008['message'][_0xf297('0x78')]=_0x172008[_0xf297('0x78')];_0x172008['message'][_0xf297('0x79')]=_0x172008[_0xf297('0x78')];_0x172008[_0xf297('0x27')][_0xf297('0x7a')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x172008['message']},client9002)[_0xf297('0x37')](function(){return _0x172008;});}return _0x172008;}return null;})[_0xf297('0x37')](respondWithResult(_0x29d0dc,null))[_0xf297('0x55')](handleError(_0x29d0dc,null));};var interaction_log=require(_0xf297('0x13'))(_0xf297('0x5a'));exports[_0xf297('0x34')]=function(_0x347cf1,_0x3da588,_0x442c43){var _0x306278={'agent':{},'channel':_0xf297('0x5c')};if(_0x347cf1[_0xf297('0x56')]['id']){delete _0x347cf1[_0xf297('0x56')]['id'];}_0x347cf1[_0xf297('0x56')][_0xf297('0x60')]=_0x347cf1[_0xf297('0x56')]['UserId']||_0x347cf1[_0xf297('0x61')]['id'];_0x306278[_0xf297('0x71')]['id']=_0x347cf1[_0xf297('0x56')][_0xf297('0x60')];return db[_0xf297('0x3c')][_0xf297('0x57')]({'where':{'id':_0x347cf1[_0xf297('0x58')]['id'],'UserId':null}})[_0xf297('0x37')](handleEntityNotFound(_0x3da588,null))[_0xf297('0x37')](function(_0x4688dc){if(_0x4688dc){_0x306278[_0xf297('0x27')]=_0x4688dc[_0xf297('0x65')]({'plain':!![]});return db[_0xf297('0x7b')][_0xf297('0x57')]({'where':{'id':_0x4688dc['FaxInteractionId']}});}return null;})[_0xf297('0x37')](handleEntityNotFound(_0x3da588,null))[_0xf297('0x37')](function(_0x3c04d3){if(_0x3c04d3){_0x306278[_0xf297('0x64')]=_0x3c04d3['get']({'plain':!![]});interaction_log[_0xf297('0x21')](_0xf297('0x7c'),_0x347cf1[_0xf297('0x61')]['id'],_0x347cf1['user']['name'],_0x347cf1['user'][_0xf297('0x7d')],_0x306278[_0xf297('0x64')]['id'],_0x347cf1[_0xf297('0x56')]?JSON[_0xf297('0x67')](_0x347cf1[_0xf297('0x56')]):_0xf297('0x7e'));return respondWithRpcPromise(_0xf297('0x7f'),'rejectMessage',_0x306278);}return null;})[_0xf297('0x37')](function(_0x2d5e7e){var _0x5b9a54='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d5e7e[_0xf297('0x27')][_0xf297('0x6b')];return db['sequelize'][_0xf297('0x40')](_0x5b9a54,{'type':db[_0xf297('0x6d')][_0xf297('0x6e')]['SELECT'],'raw':!![]})[_0xf297('0x37')](function(_0x5225a6){return _0x5225a6;});})[_0xf297('0x37')](function(_0xf34db1){if(_0xf34db1){_0x306278[_0xf297('0x27')][_0xf297('0x80')]=_0xf34db1[0x0];if(!_0x347cf1[_0xf297('0x56')]['UserId'])return;return db[_0xf297('0x70')]['find']({'where':{'id':_0x347cf1['body'][_0xf297('0x60')],'role':'agent'},'attributes':['id',_0xf297('0x3a'),_0xf297('0x72'),_0xf297('0x73'),_0xf297('0x74')],'raw':!![]});}return null;})[_0xf297('0x37')](function(_0x50796f){if(!_0x50796f)return null;_0x306278[_0xf297('0x27')][_0xf297('0x71')]=_0x50796f;return _0x306278;})[_0xf297('0x37')](function(_0x3d477c){if(_0x3d477c){_0x3d477c[_0xf297('0x27')][_0xf297('0x76')]=util['format'](_0xf297('0x77'),_0x347cf1['user'][_0xf297('0x3a')]);_0x3d477c[_0xf297('0x27')][_0xf297('0x78')]=_0x306278[_0xf297('0x78')];_0x3d477c[_0xf297('0x27')][_0xf297('0x79')]=_0x306278[_0xf297('0x78')];_0x3d477c[_0xf297('0x27')][_0xf297('0x7a')]=_0xf297('0x34');respondWithRpcPromise('EventManager',_0xf297('0x81'),{'event':'rejectmessage','message':_0x3d477c['message']},client9002);return _0x306278;}return null;})['then'](respondWithResult(_0x3da588,null))[_0xf297('0x55')](handleError(_0x3da588,null));};exports[_0xf297('0x82')]=function(_0x20105f,_0x4299b4){var _0x3817e0;return db[_0xf297('0x3c')][_0xf297('0x82')](_0x20105f[_0xf297('0x56')],{})['then'](function(_0x2659e0){_0x3817e0=_0x2659e0;return db[_0xf297('0x83')][_0xf297('0x84')]({'where':{'id':_0x3817e0['ContactId']}});})[_0xf297('0x37')](function(_0x4a1a80){if(_[_0xf297('0x85')](_0x4a1a80)){return;}else{_0x3817e0[_0xf297('0x5c')]=_0x4a1a80['fax'];return db[_0xf297('0x86')][_0xf297('0x84')]({'where':{'id':_0x3817e0['AttachmentId']}});}})['then'](function(_0x3d9200){return respondWithRpcPromise('SendFax',_0xf297('0x87'),{'FaxAccountId':_['isNil'](_0x20105f[_0xf297('0x56')])?undefined:_0x20105f[_0xf297('0x56')][_0xf297('0x88')],'path':_['isNil'](_0x3d9200)?undefined:util['format'](_0xf297('0x89'),_0x3d9200['basename']),'fax':_[_0xf297('0x85')](_0x3817e0[_0xf297('0x5c')])?undefined:_0x3817e0['fax'],'AttachmentId':_0x3817e0[_0xf297('0x8a')]},client9002);})[_0xf297('0x37')](respondWithResult(_0x4299b4,0xc9))[_0xf297('0x55')](handleError(_0x4299b4,null));};exports[_0xf297('0x8b')]=function(_0x661bed,_0x3932f3){var _0xe91d7e=path[_0xf297('0x8c')](config[_0xf297('0x8d')],_0xf297('0x8e'),_0xf297('0x8f'),_0xf297('0x90'));return db['FaxMessage'][_0xf297('0x57')]({'where':{'id':_0x661bed[_0xf297('0x58')]['id']},'include':[{'model':db[_0xf297('0x86')],'as':'Attachment'}]})[_0xf297('0x37')](handleEntityNotFound(_0x3932f3,null))[_0xf297('0x37')](function(_0x2e7c7d){if(_0x2e7c7d){return _0x3932f3[_0xf297('0x8b')](path[_0xf297('0x8c')](_0xe91d7e,_0x2e7c7d[_0xf297('0x86')][_0xf297('0x91')]));}})[_0xf297('0x55')](handleError(_0x3932f3,null));}; \ No newline at end of file +var _0xd68f=['redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','fieldName','type','map','keys','query','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','catch','body','fax-interactions','accept','fax','read','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','email','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4c4d6d,_0x10ac62){var _0x4eacef=function(_0x589133){while(--_0x589133){_0x4c4d6d['push'](_0x4c4d6d['shift']());}};_0x4eacef(++_0x10ac62);}(_0xd68f,0x7d));var _0xfd68=function(_0x47c03f,_0x2928c3){_0x47c03f=_0x47c03f-0x0;var _0x6a92b6=_0xd68f[_0x47c03f];return _0x6a92b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd68('0x0'));var zipdir=require(_0xfd68('0x1'));var jsonpatch=require(_0xfd68('0x2'));var rp=require(_0xfd68('0x3'));var moment=require(_0xfd68('0x4'));var BPromise=require(_0xfd68('0x5'));var Mustache=require(_0xfd68('0x6'));var util=require('util');var path=require(_0xfd68('0x7'));var sox=require(_0xfd68('0x8'));var csv=require(_0xfd68('0x9'));var ejs=require(_0xfd68('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfd68('0xb'));var crypto=require(_0xfd68('0xc'));var jsforce=require(_0xfd68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfd68('0x9'));var querystring=require(_0xfd68('0xe'));var Papa=require(_0xfd68('0xf'));var Redis=require(_0xfd68('0x10'));var authService=require(_0xfd68('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd68('0x12'));var hardwareService=require(_0xfd68('0x13'));var logger=require(_0xfd68('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfd68('0x15')]=_[_0xfd68('0x16')](config[_0xfd68('0x15')],{'host':_0xfd68('0x17'),'port':0x18eb});var socket=require(_0xfd68('0x18'))(new Redis(config['redis']));require(_0xfd68('0x19'))[_0xfd68('0x1a')](socket);var jayson=require(_0xfd68('0x1b'));var client=jayson[_0xfd68('0x1c')][_0xfd68('0x1d')]({'port':0x232c});var client9002=jayson[_0xfd68('0x1c')][_0xfd68('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5e822a,_0x1903d8,_0x289cfe,_0x39a48d){return new BPromise(function(_0x30c05f,_0x1d486f){var _0x3a7c88=_0x39a48d||client;return _0x3a7c88[_0xfd68('0x1e')](_0x5e822a,_0x289cfe)[_0xfd68('0x1f')](function(_0x5b3f4d){logger[_0xfd68('0x20')](_0xfd68('0x21'),_0x1903d8,_0xfd68('0x22'));logger[_0xfd68('0x23')](_0xfd68('0x24'),_0x1903d8,_0xfd68('0x22'),JSON[_0xfd68('0x25')](_0x5b3f4d));if(_0x5b3f4d[_0xfd68('0x26')]){if(_0x5b3f4d[_0xfd68('0x26')][_0xfd68('0x27')]===0x1f4){logger[_0xfd68('0x26')](_0xfd68('0x21'),_0x1903d8,_0x5b3f4d[_0xfd68('0x26')][_0xfd68('0x28')]);return _0x1d486f(_0x5b3f4d['error'][_0xfd68('0x28')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x1903d8,_0x5b3f4d['error']['message']);return _0x30c05f(_0x5b3f4d[_0xfd68('0x26')][_0xfd68('0x28')]);}else{logger[_0xfd68('0x20')](_0xfd68('0x21'),_0x1903d8,'request\x20sent');_0x30c05f(_0x5b3f4d[_0xfd68('0x29')][_0xfd68('0x28')]);}})['catch'](function(_0x305eb2){logger[_0xfd68('0x26')](_0xfd68('0x21'),_0x1903d8,_0x305eb2);_0x1d486f(_0x305eb2);});});}function respondWithStatusCode(_0x2c44a0,_0x156bf8){_0x156bf8=_0x156bf8||0xcc;return function(_0x5dcdf0){if(_0x5dcdf0){return _0x2c44a0[_0xfd68('0x2a')](_0x156bf8);}return _0x2c44a0[_0xfd68('0x2b')](_0x156bf8)[_0xfd68('0x2c')]();};}function respondWithResult(_0x1fae13,_0x390c55){_0x390c55=_0x390c55||0xc8;return function(_0x4d1732){if(_0x4d1732){return _0x1fae13[_0xfd68('0x2b')](_0x390c55)['json'](_0x4d1732);}};}function respondWithFilteredResult(_0x43e9ba,_0x81f0b9){return function(_0x1227c8){if(_0x1227c8){var _0x29192d=typeof _0x81f0b9[_0xfd68('0x2d')]===_0xfd68('0x2e')&&typeof _0x81f0b9[_0xfd68('0x2f')]===_0xfd68('0x2e');var _0x207b7f=_0x1227c8[_0xfd68('0x30')];var _0x3ca4c0=_0x29192d?0x0:_0x81f0b9['offset'];var _0x4d0834=_0x29192d?_0x1227c8[_0xfd68('0x30')]:_0x81f0b9[_0xfd68('0x2d')]+_0x81f0b9['limit'];var _0x437418;if(_0x4d0834>=_0x207b7f){_0x4d0834=_0x207b7f;_0x437418=0xc8;}else{_0x437418=0xce;}_0x43e9ba[_0xfd68('0x2b')](_0x437418);return _0x43e9ba[_0xfd68('0x31')](_0xfd68('0x32'),_0x3ca4c0+'-'+_0x4d0834+'/'+_0x207b7f)[_0xfd68('0x33')](_0x1227c8);}return null;};}function patchUpdates(_0x223fef){return function(_0x180a6b){try{jsonpatch[_0xfd68('0x34')](_0x180a6b,_0x223fef,!![]);}catch(_0x8e045e){return BPromise[_0xfd68('0x35')](_0x8e045e);}return _0x180a6b[_0xfd68('0x36')]();};}function saveUpdates(_0x4c7e48,_0x1daafe){return function(_0x34faa7){if(_0x34faa7){return _0x34faa7[_0xfd68('0x37')](_0x4c7e48)[_0xfd68('0x1f')](function(_0x43dc25){return _0x43dc25;});}return null;};}function removeEntity(_0x4fcba6,_0x41f3c6){return function(_0x4a6f50){if(_0x4a6f50){return _0x4a6f50[_0xfd68('0x38')]()['then'](function(){_0x4fcba6[_0xfd68('0x2b')](0xcc)[_0xfd68('0x2c')]();});}};}function handleEntityNotFound(_0x1c465d,_0x4a96f6){return function(_0x51e60a){if(!_0x51e60a){_0x1c465d[_0xfd68('0x2a')](0x194);}return _0x51e60a;};}function handleError(_0x5a59fa,_0x765651){_0x765651=_0x765651||0x1f4;return function(_0x59663d){logger[_0xfd68('0x26')](_0x59663d[_0xfd68('0x39')]);if(_0x59663d[_0xfd68('0x3a')]){delete _0x59663d['name'];}_0x5a59fa[_0xfd68('0x2b')](_0x765651)[_0xfd68('0x3b')](_0x59663d);};}exports[_0xfd68('0x3c')]=function(_0x3b1d42,_0x2c5d66){var _0x1db121={},_0x5c0300={},_0x36c893={'count':0x0,'rows':[]};var _0x25e8ea=_['map'](db[_0xfd68('0x3d')]['rawAttributes'],function(_0x103de0){return{'name':_0x103de0[_0xfd68('0x3e')],'type':_0x103de0[_0xfd68('0x3f')]['key']};});_0x5c0300['model']=_[_0xfd68('0x40')](_0x25e8ea,_0xfd68('0x3a'));_0x5c0300['query']=_[_0xfd68('0x41')](_0x3b1d42[_0xfd68('0x42')]);_0x5c0300[_0xfd68('0x43')]=_[_0xfd68('0x44')](_0x5c0300[_0xfd68('0x45')],_0x5c0300[_0xfd68('0x42')]);_0x1db121['attributes']=_[_0xfd68('0x44')](_0x5c0300[_0xfd68('0x45')],qs[_0xfd68('0x46')](_0x3b1d42[_0xfd68('0x42')]['fields']));_0x1db121[_0xfd68('0x47')]=_0x1db121[_0xfd68('0x47')]['length']?_0x1db121['attributes']:_0x5c0300[_0xfd68('0x45')];if(!_0x3b1d42[_0xfd68('0x42')]['hasOwnProperty'](_0xfd68('0x48'))){_0x1db121[_0xfd68('0x2f')]=qs[_0xfd68('0x2f')](_0x3b1d42['query'][_0xfd68('0x2f')]);_0x1db121['offset']=qs[_0xfd68('0x2d')](_0x3b1d42['query'][_0xfd68('0x2d')]);}_0x1db121['order']=qs[_0xfd68('0x49')](_0x3b1d42[_0xfd68('0x42')][_0xfd68('0x49')]);_0x1db121[_0xfd68('0x4a')]=qs['filters'](_[_0xfd68('0x4b')](_0x3b1d42['query'],_0x5c0300[_0xfd68('0x43')]),_0x25e8ea);if(_0x3b1d42['query']['filter']){_0x1db121['where']=_[_0xfd68('0x4c')](_0x1db121[_0xfd68('0x4a')],{'$or':_['map'](_0x25e8ea,function(_0x1301d3){if(_0x1301d3[_0xfd68('0x3f')]!==_0xfd68('0x4d')){var _0x341699={};_0x341699[_0x1301d3[_0xfd68('0x3a')]]={'$like':'%'+_0x3b1d42['query'][_0xfd68('0x4e')]+'%'};return _0x341699;}})});}_0x1db121=_[_0xfd68('0x4c')]({},_0x1db121,_0x3b1d42[_0xfd68('0x4f')]);var _0x1d8d8d={'where':_0x1db121[_0xfd68('0x4a')]};return db[_0xfd68('0x3d')][_0xfd68('0x30')](_0x1d8d8d)[_0xfd68('0x1f')](function(_0x2198cf){_0x36c893['count']=_0x2198cf;if(_0x3b1d42['query'][_0xfd68('0x50')]){_0x1db121['include']=[{'all':!![]}];}return db[_0xfd68('0x3d')][_0xfd68('0x51')](_0x1db121);})[_0xfd68('0x1f')](function(_0x4a6a2f){_0x36c893[_0xfd68('0x52')]=_0x4a6a2f;return _0x36c893;})['then'](respondWithFilteredResult(_0x2c5d66,_0x1db121))['catch'](handleError(_0x2c5d66,null));};exports[_0xfd68('0x53')]=function(_0x22b314,_0x5d4d3b){var _0x1b7cb3={'raw':!![],'where':{'id':_0x22b314[_0xfd68('0x54')]['id']}},_0x303bb9={};_0x303bb9['model']=_[_0xfd68('0x41')](db[_0xfd68('0x3d')][_0xfd68('0x55')]);_0x303bb9['query']=_[_0xfd68('0x41')](_0x22b314[_0xfd68('0x42')]);_0x303bb9[_0xfd68('0x43')]=_[_0xfd68('0x44')](_0x303bb9[_0xfd68('0x45')],_0x303bb9[_0xfd68('0x42')]);_0x1b7cb3[_0xfd68('0x47')]=_['intersection'](_0x303bb9[_0xfd68('0x45')],qs[_0xfd68('0x46')](_0x22b314[_0xfd68('0x42')][_0xfd68('0x46')]));_0x1b7cb3['attributes']=_0x1b7cb3[_0xfd68('0x47')][_0xfd68('0x56')]?_0x1b7cb3[_0xfd68('0x47')]:_0x303bb9[_0xfd68('0x45')];if(_0x22b314[_0xfd68('0x42')][_0xfd68('0x50')]){_0x1b7cb3[_0xfd68('0x57')]=[{'all':!![]}];}_0x1b7cb3=_[_0xfd68('0x4c')]({},_0x1b7cb3,_0x22b314['options']);return db[_0xfd68('0x3d')][_0xfd68('0x58')](_0x1b7cb3)[_0xfd68('0x1f')](handleEntityNotFound(_0x5d4d3b,null))[_0xfd68('0x1f')](respondWithResult(_0x5d4d3b,null))[_0xfd68('0x59')](handleError(_0x5d4d3b,null));};exports[_0xfd68('0x37')]=function(_0x59883b,_0x52d09b){if(_0x59883b[_0xfd68('0x5a')]['id']){delete _0x59883b[_0xfd68('0x5a')]['id'];}return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x59883b[_0xfd68('0x54')]['id']}})[_0xfd68('0x1f')](handleEntityNotFound(_0x52d09b,null))[_0xfd68('0x1f')](saveUpdates(_0x59883b[_0xfd68('0x5a')],null))[_0xfd68('0x1f')](respondWithResult(_0x52d09b,null))[_0xfd68('0x59')](handleError(_0x52d09b,null));};exports[_0xfd68('0x38')]=function(_0x313c37,_0x4127cc){return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x313c37[_0xfd68('0x54')]['id']}})['then'](handleEntityNotFound(_0x4127cc,null))[_0xfd68('0x1f')](removeEntity(_0x4127cc,null))[_0xfd68('0x59')](handleError(_0x4127cc,null));};exports['describe']=function(_0x14e664,_0x5e8e81){return db['FaxMessage']['describe']()[_0xfd68('0x1f')](respondWithResult(_0x5e8e81,null))['catch'](handleError(_0x5e8e81,null));};var interaction_log=require('../../config/logger')(_0xfd68('0x5b'));exports[_0xfd68('0x5c')]=function(_0x323fea,_0x293fd2,_0x476d26){var _0x54b023={'agent':{},'channel':_0xfd68('0x5d')};if(_0x323fea[_0xfd68('0x5a')]['id']){delete _0x323fea[_0xfd68('0x5a')]['id'];}_0x323fea[_0xfd68('0x5a')][_0xfd68('0x5e')]=!![];_0x323fea[_0xfd68('0x5a')]['readAt']=moment()[_0xfd68('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x323fea['body']['UserId']=_0x323fea[_0xfd68('0x5a')][_0xfd68('0x60')]||_0x323fea[_0xfd68('0x61')]['id'];_0x54b023[_0xfd68('0x62')]['id']=_0x323fea[_0xfd68('0x5a')][_0xfd68('0x60')];return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x323fea[_0xfd68('0x54')]['id'],'UserId':null}})[_0xfd68('0x1f')](handleEntityNotFound(_0x293fd2,null))[_0xfd68('0x1f')](saveUpdates(_0x323fea[_0xfd68('0x5a')],null))[_0xfd68('0x1f')](function(_0x469bf7){if(_0x469bf7){_0x54b023[_0xfd68('0x28')]=_0x469bf7[_0xfd68('0x63')]({'plain':!![]});return db[_0xfd68('0x64')][_0xfd68('0x58')]({'where':{'id':_0x469bf7[_0xfd68('0x65')]}});}return null;})[_0xfd68('0x1f')](handleEntityNotFound(_0x293fd2,null))['then'](function(_0x11ae34){if(_0x11ae34){return _0x11ae34[_0xfd68('0x37')]({'UserId':_0x323fea['body']['UserId'],'read1stAt':_[_0xfd68('0x66')](_0x11ae34['read1stAt'])?moment()[_0xfd68('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x490663){if(_0x490663){_0x54b023[_0xfd68('0x67')]=_0x490663[_0xfd68('0x63')]({'plain':!![]});interaction_log[_0xfd68('0x20')](_0xfd68('0x68'),_0x323fea['user']['id'],_0x323fea[_0xfd68('0x61')][_0xfd68('0x3a')],_0x323fea['user'][_0xfd68('0x69')],_0x54b023[_0xfd68('0x67')]['id'],_0x323fea[_0xfd68('0x5a')]?JSON[_0xfd68('0x25')](_0x323fea[_0xfd68('0x5a')]):_0xfd68('0x6a'));return respondWithRpcPromise(_0xfd68('0x6b'),_0xfd68('0x6c'),_0x54b023);}return null;})[_0xfd68('0x1f')](function(_0x9242dd){var _0x11f45b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9242dd[_0xfd68('0x28')]['ContactId'];return db[_0xfd68('0x6d')][_0xfd68('0x42')](_0x11f45b,{'type':db[_0xfd68('0x6e')][_0xfd68('0x6f')][_0xfd68('0x70')],'raw':!![]})[_0xfd68('0x1f')](function(_0x1c4f77){return _0x1c4f77;});})[_0xfd68('0x1f')](function(_0x269040){if(_0x269040){_0x54b023[_0xfd68('0x28')][_0xfd68('0x71')]=_0x269040[0x0];if(!_0x323fea['body'][_0xfd68('0x60')])return;return db[_0xfd68('0x72')][_0xfd68('0x58')]({'where':{'id':_0x323fea[_0xfd68('0x5a')]['UserId'],'role':_0xfd68('0x62')},'attributes':['id',_0xfd68('0x3a'),_0xfd68('0x73'),'email',_0xfd68('0x74')],'raw':!![]});}return null;})[_0xfd68('0x1f')](function(_0x10e66c){if(!_0x10e66c)return null;_0x54b023[_0xfd68('0x28')][_0xfd68('0x62')]=_0x10e66c;return _0x54b023;})[_0xfd68('0x1f')](function(_0x15c25e){if(_0x15c25e){if(_0x323fea[_0xfd68('0x5a')][_0xfd68('0x75')]){_0x54b023[_0xfd68('0x28')][_0xfd68('0x76')]=util[_0xfd68('0x5f')](_0xfd68('0x77'),_0x323fea[_0xfd68('0x61')][_0xfd68('0x3a')]);_0x54b023['message'][_0xfd68('0x78')]=_0x54b023[_0xfd68('0x78')];_0x54b023[_0xfd68('0x28')][_0xfd68('0x79')]=_0x54b023[_0xfd68('0x78')];_0x54b023['message'][_0xfd68('0x7a')]='accept';return respondWithRpcPromise(_0xfd68('0x7b'),_0xfd68('0x7b'),{'event':'acceptmessage','message':_0x54b023[_0xfd68('0x28')]},client9002)[_0xfd68('0x1f')](function(){return _0x54b023;});}return _0x54b023;}return null;})['then'](respondWithResult(_0x293fd2,null))[_0xfd68('0x59')](handleError(_0x293fd2,null));};var interaction_log=require('../../config/logger')(_0xfd68('0x5b'));exports[_0xfd68('0x35')]=function(_0x580958,_0x4b26c3,_0xbde818){var _0x1bfa66={'agent':{},'channel':'fax'};if(_0x580958[_0xfd68('0x5a')]['id']){delete _0x580958[_0xfd68('0x5a')]['id'];}_0x580958['body'][_0xfd68('0x60')]=_0x580958[_0xfd68('0x5a')]['UserId']||_0x580958[_0xfd68('0x61')]['id'];_0x1bfa66[_0xfd68('0x62')]['id']=_0x580958['body'][_0xfd68('0x60')];return db[_0xfd68('0x3d')][_0xfd68('0x58')]({'where':{'id':_0x580958['params']['id'],'UserId':null}})[_0xfd68('0x1f')](handleEntityNotFound(_0x4b26c3,null))[_0xfd68('0x1f')](function(_0x3da332){if(_0x3da332){_0x1bfa66[_0xfd68('0x28')]=_0x3da332[_0xfd68('0x63')]({'plain':!![]});return db['FaxInteraction'][_0xfd68('0x58')]({'where':{'id':_0x3da332['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4b26c3,null))[_0xfd68('0x1f')](function(_0x54f2c1){if(_0x54f2c1){_0x1bfa66[_0xfd68('0x67')]=_0x54f2c1['get']({'plain':!![]});interaction_log[_0xfd68('0x20')](_0xfd68('0x7c'),_0x580958[_0xfd68('0x61')]['id'],_0x580958[_0xfd68('0x61')][_0xfd68('0x3a')],_0x580958['user']['role'],_0x1bfa66[_0xfd68('0x67')]['id'],_0x580958[_0xfd68('0x5a')]?JSON[_0xfd68('0x25')](_0x580958[_0xfd68('0x5a')]):_0xfd68('0x6a'));return respondWithRpcPromise(_0xfd68('0x7d'),_0xfd68('0x7e'),_0x1bfa66);}return null;})[_0xfd68('0x1f')](function(_0x1a6b79){var _0x13d55c=_0xfd68('0x7f')+_0x1a6b79[_0xfd68('0x28')][_0xfd68('0x80')];return db[_0xfd68('0x6d')][_0xfd68('0x42')](_0x13d55c,{'type':db['Sequelize'][_0xfd68('0x6f')][_0xfd68('0x70')],'raw':!![]})[_0xfd68('0x1f')](function(_0x29277a){return _0x29277a;});})[_0xfd68('0x1f')](function(_0x3d28f5){if(_0x3d28f5){_0x1bfa66['message']['contact']=_0x3d28f5[0x0];if(!_0x580958[_0xfd68('0x5a')][_0xfd68('0x60')])return;return db[_0xfd68('0x72')][_0xfd68('0x58')]({'where':{'id':_0x580958[_0xfd68('0x5a')]['UserId'],'role':_0xfd68('0x62')},'attributes':['id','name',_0xfd68('0x73'),_0xfd68('0x81'),'internal'],'raw':!![]});}return null;})[_0xfd68('0x1f')](function(_0x18277d){if(!_0x18277d)return null;_0x1bfa66['message'][_0xfd68('0x62')]=_0x18277d;return _0x1bfa66;})[_0xfd68('0x1f')](function(_0x3fa60d){if(_0x3fa60d){_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x76')]=util['format'](_0xfd68('0x77'),_0x580958['user'][_0xfd68('0x3a')]);_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x78')]=_0x1bfa66[_0xfd68('0x78')];_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x79')]=_0x1bfa66[_0xfd68('0x78')];_0x3fa60d[_0xfd68('0x28')][_0xfd68('0x7a')]=_0xfd68('0x35');respondWithRpcPromise(_0xfd68('0x7b'),_0xfd68('0x7b'),{'event':_0xfd68('0x82'),'message':_0x3fa60d['message']},client9002);return _0x1bfa66;}return null;})[_0xfd68('0x1f')](respondWithResult(_0x4b26c3,null))[_0xfd68('0x59')](handleError(_0x4b26c3,null));};exports[_0xfd68('0x83')]=function(_0x57d02f,_0x3607d5){var _0x26d29c;return db[_0xfd68('0x3d')][_0xfd68('0x83')](_0x57d02f[_0xfd68('0x5a')],{})[_0xfd68('0x1f')](function(_0x227b23){_0x26d29c=_0x227b23;return db[_0xfd68('0x84')][_0xfd68('0x85')]({'where':{'id':_0x26d29c[_0xfd68('0x80')]}});})[_0xfd68('0x1f')](function(_0x3ec834){if(_[_0xfd68('0x66')](_0x3ec834)){return;}else{_0x26d29c['fax']=_0x3ec834[_0xfd68('0x5d')];return db[_0xfd68('0x86')][_0xfd68('0x85')]({'where':{'id':_0x26d29c['AttachmentId']}});}})[_0xfd68('0x1f')](function(_0x5a740c){return respondWithRpcPromise(_0xfd68('0x87'),_0xfd68('0x87'),{'FaxAccountId':_[_0xfd68('0x66')](_0x57d02f[_0xfd68('0x5a')])?undefined:_0x57d02f[_0xfd68('0x5a')][_0xfd68('0x88')],'path':_['isNil'](_0x5a740c)?undefined:util['format'](_0xfd68('0x89'),_0x5a740c[_0xfd68('0x8a')]),'fax':_['isNil'](_0x26d29c[_0xfd68('0x5d')])?undefined:_0x26d29c['fax'],'AttachmentId':_0x26d29c[_0xfd68('0x8b')]},client9002);})['then'](respondWithResult(_0x3607d5,0xc9))[_0xfd68('0x59')](handleError(_0x3607d5,null));};exports[_0xfd68('0x8c')]=function(_0x2a6b11,_0x3b186c){var _0x54d422=path[_0xfd68('0x8d')](config[_0xfd68('0x8e')],_0xfd68('0x8f'),_0xfd68('0x90'),_0xfd68('0x91'));return db['FaxMessage'][_0xfd68('0x58')]({'where':{'id':_0x2a6b11[_0xfd68('0x54')]['id']},'include':[{'model':db[_0xfd68('0x86')],'as':_0xfd68('0x86')}]})[_0xfd68('0x1f')](handleEntityNotFound(_0x3b186c,null))[_0xfd68('0x1f')](function(_0x1faf4e){if(_0x1faf4e){return _0x3b186c[_0xfd68('0x8c')](path['join'](_0x54d422,_0x1faf4e[_0xfd68('0x86')][_0xfd68('0x8a')]));}})[_0xfd68('0x59')](handleError(_0x3b186c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ae85e0a..344a49e 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 _0x7c71=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update'];(function(_0x23e54c,_0x22e97){var _0x5466cf=function(_0x5a310b){while(--_0x5a310b){_0x23e54c['push'](_0x23e54c['shift']());}};_0x5466cf(++_0x22e97);}(_0x7c71,0x177));var _0x17c7=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x7c71[_0x507403];return _0x1327c;};'use strict';var EventEmitter=require(_0x17c7('0x0'));var FaxMessage=require(_0x17c7('0x1'))['db'][_0x17c7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x17c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x17c7('0x4'),'afterDestroy':_0x17c7('0x5')};function emitEvent(_0x3f9105){return function(_0x5a4923,_0x4fed29,_0xa4e319){FaxMessageEvents[_0x17c7('0x6')](_0x3f9105+':'+_0x5a4923['id'],_0x5a4923);FaxMessageEvents[_0x17c7('0x6')](_0x3f9105,_0x5a4923);_0xa4e319(null);};}for(var e in events){if(events[_0x17c7('0x7')](e)){var event=events[e];FaxMessage[_0x17c7('0x8')](e,emitEvent(event));}}module[_0x17c7('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xb90a=['setMaxListeners','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x13ce90,_0xdf634d){var _0x59ce8c=function(_0x3652d1){while(--_0x3652d1){_0x13ce90['push'](_0x13ce90['shift']());}};_0x59ce8c(++_0xdf634d);}(_0xb90a,0x12a));var _0xab90=function(_0x1c5ca3,_0x18dcc2){_0x1c5ca3=_0x1c5ca3-0x0;var _0x5db079=_0xb90a[_0x1c5ca3];return _0x5db079;};'use strict';var EventEmitter=require(_0xab90('0x0'));var FaxMessage=require(_0xab90('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xab90('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5eaa1d){return function(_0x57672e,_0x3912db,_0x178509){FaxMessageEvents['emit'](_0x5eaa1d+':'+_0x57672e['id'],_0x57672e);FaxMessageEvents['emit'](_0x5eaa1d,_0x57672e);_0x178509(null);};}for(var e in events){if(events[_0xab90('0x3')](e)){var event=events[e];FaxMessage[_0xab90('0x4')](e,emitEvent(event));}}module[_0xab90('0x5')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5cd0c1e..0873727 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 _0x86fd=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x86fd,0x195));var _0xd86f=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x86fd[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require(_0xd86f('0x0'));var util=require(_0xd86f('0x1'));var logger=require(_0xd86f('0x2'))(_0xd86f('0x3'));var moment=require(_0xd86f('0x4'));var BPromise=require(_0xd86f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd86f('0x6'));var rimraf=require(_0xd86f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd86f('0x8'));module[_0xd86f('0x9')]=function(_0x37363b,_0x2aa510){return _0x37363b[_0xd86f('0xa')](_0xd86f('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xd86f('0xc'),'fields':[_0xd86f('0xd')],'type':_0xd86f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50d322,_0x54085d,_0xfeebd9){var _0x59be8b=_0x37363b[_0xd86f('0xf')];var _0x166cb0=_0x50d322[_0xd86f('0x10')]({'plain':!![]});if(_0x166cb0[_0xd86f('0x11')]['toLowerCase']()==='in'||_0x166cb0[_0xd86f('0x11')][_0xd86f('0x12')]()===_0xd86f('0x13')&&!_0x166cb0[_0xd86f('0x14')]&&!_['isNil'](_0x166cb0[_0xd86f('0x15')])){_0x59be8b[_0xd86f('0x16')][_0xd86f('0x17')]({'where':{'id':_0x166cb0[_0xd86f('0x18')]}})['then'](function(_0x49a150){if(_0x49a150){_0x49a150[_0xd86f('0x19')]({'lastMsgAt':_0x166cb0[_0xd86f('0x1a')],'lastMsgDirection':_0x166cb0[_0xd86f('0x11')][_0xd86f('0x12')]()});}})[_0xd86f('0x1b')](function(_0x3427de){console[_0xd86f('0x1c')](_0x3427de);});}_0xfeebd9();}},'charset':_0xd86f('0x1d'),'collate':_0xd86f('0x1e')});}; \ No newline at end of file +var _0xe93c=['error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','catch'];(function(_0x7be910,_0x2b381b){var _0x496ddf=function(_0x3ac518){while(--_0x3ac518){_0x7be910['push'](_0x7be910['shift']());}};_0x496ddf(++_0x2b381b);}(_0xe93c,0xea));var _0xce93=function(_0x254f2b,_0x203e5f){_0x254f2b=_0x254f2b-0x0;var _0x2c5488=_0xe93c[_0x254f2b];return _0x2c5488;};'use strict';var _=require(_0xce93('0x0'));var util=require(_0xce93('0x1'));var logger=require(_0xce93('0x2'))(_0xce93('0x3'));var moment=require(_0xce93('0x4'));var BPromise=require(_0xce93('0x5'));var rp=require(_0xce93('0x6'));var fs=require('fs');var path=require(_0xce93('0x7'));var rimraf=require('rimraf');var config=require(_0xce93('0x8'));var attributes=require(_0xce93('0x9'));module[_0xce93('0xa')]=function(_0x4372b8,_0xba9816){return _0x4372b8[_0xce93('0xb')]('FaxMessage',attributes,{'tableName':_0xce93('0xc'),'paranoid':![],'indexes':[{'name':_0xce93('0xd'),'fields':[_0xce93('0xe')],'type':_0xce93('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11233e,_0x38a859,_0x1d31af){var _0x42723b=_0x4372b8[_0xce93('0x10')];var _0x21dfcc=_0x11233e[_0xce93('0x11')]({'plain':!![]});if(_0x21dfcc[_0xce93('0x12')][_0xce93('0x13')]()==='in'||_0x21dfcc[_0xce93('0x12')][_0xce93('0x13')]()===_0xce93('0x14')&&!_0x21dfcc['secret']&&!_['isNil'](_0x21dfcc[_0xce93('0x15')])){_0x42723b[_0xce93('0x16')][_0xce93('0x17')]({'where':{'id':_0x21dfcc[_0xce93('0x18')]}})[_0xce93('0x19')](function(_0x4e009f){if(_0x4e009f){_0x4e009f['update']({'lastMsgAt':_0x21dfcc['createdAt'],'lastMsgDirection':_0x21dfcc['direction'][_0xce93('0x13')]()});}})[_0xce93('0x1a')](function(_0x40c306){console[_0xce93('0x1b')](_0x40c306);});}_0x1d31af();}},'charset':_0xce93('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6090d3f..efa3c5f 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 _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xed1f,0x6a));var _0xfed1=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xed1f[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file +var _0x9957=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','body','options','raw','CreateFaxMessage','catch','UpdateFaxMessage','FaxMessage','where','attributes','lodash'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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});config[_0x7995('0xc')]=_[_0x7995('0xd')](config['redis'],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require(_0x7995('0xf'))(new Redis(config['redis']));require(_0x7995('0x10'))[_0x7995('0x11')](socket);function respondWithRpcPromise(_0x18c8a3,_0x35b5fe,_0x3c1d19){return new BPromise(function(_0x1e400a,_0x341672){return client['request'](_0x18c8a3,_0x3c1d19)[_0x7995('0x12')](function(_0x41c652){logger['info'](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));logger[_0x7995('0x15')](_0x7995('0x16'),_0x35b5fe,_0x7995('0x14'),JSON[_0x7995('0x17')](_0x41c652));if(_0x41c652[_0x7995('0x18')]){if(_0x41c652['error']['code']===0x1f4){logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);return _0x341672(_0x41c652[_0x7995('0x18')][_0x7995('0x19')]);}logger[_0x7995('0x18')](_0x7995('0x13'),_0x35b5fe,_0x41c652['error'][_0x7995('0x19')]);return _0x1e400a(_0x41c652['error'][_0x7995('0x19')]);}else{logger[_0x7995('0x1a')](_0x7995('0x13'),_0x35b5fe,_0x7995('0x14'));_0x1e400a(_0x41c652[_0x7995('0x1b')][_0x7995('0x19')]);}})['catch'](function(_0x54c9ae){logger[_0x7995('0x18')]('FaxMessage,\x20%s,\x20%s',_0x35b5fe,_0x54c9ae);_0x341672(_0x54c9ae);});});}exports['CreateFaxMessage']=function(_0x3ec178){var _0x3d463e=this;return new Promise(function(_0x4cbe10,_0x3a9b54){return db['FaxMessage']['create'](_0x3ec178[_0x7995('0x1c')],{'raw':_0x3ec178[_0x7995('0x1d')]?_0x3ec178[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![]})[_0x7995('0x12')](function(_0x1c278a){logger['info'](_0x7995('0x1f'),_0x3ec178);logger[_0x7995('0x15')](_0x7995('0x1f'),_0x3ec178,JSON[_0x7995('0x17')](_0x1c278a));_0x4cbe10(_0x1c278a);})[_0x7995('0x20')](function(_0x13bc35){logger[_0x7995('0x18')](_0x7995('0x1f'),_0x13bc35['message'],_0x3ec178);_0x3a9b54(_0x3d463e[_0x7995('0x18')](0x1f4,_0x13bc35[_0x7995('0x19')]));});});};exports[_0x7995('0x21')]=function(_0x268ce7){var _0x3a3fcf=this;return new Promise(function(_0x2a307e,_0x56691a){return db[_0x7995('0x22')]['update'](_0x268ce7[_0x7995('0x1c')],{'raw':_0x268ce7[_0x7995('0x1d')]?_0x268ce7[_0x7995('0x1d')][_0x7995('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options'][_0x7995('0x23')]||null:null,'attributes':_0x268ce7['options']?_0x268ce7[_0x7995('0x1d')][_0x7995('0x24')]||null:null,'limit':_0x268ce7[_0x7995('0x1d')]?_0x268ce7['options']['limit']||null:null})['then'](function(_0x3573be){logger[_0x7995('0x1a')](_0x7995('0x21'),_0x268ce7);logger[_0x7995('0x15')](_0x7995('0x21'),_0x268ce7,JSON[_0x7995('0x17')](_0x3573be));_0x2a307e(_0x3573be);})['catch'](function(_0x481c74){logger[_0x7995('0x18')]('UpdateFaxMessage',_0x481c74[_0x7995('0x19')],_0x268ce7);_0x56691a(_0x3a3fcf[_0x7995('0x18')](0x1f4,_0x481c74[_0x7995('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 87a29eb..5867a6f 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 _0x89d4=['length','faxMessage:','save','update','removeListener','register'];(function(_0x2ca02b,_0x375a3d){var _0x5f004c=function(_0x5d0997){while(--_0x5d0997){_0x2ca02b['push'](_0x2ca02b['shift']());}};_0x5f004c(++_0x375a3d);}(_0x89d4,0xb6));var _0x489d=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x89d4[_0x13b7fd];return _0x32a74a;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x489d('0x0'),'remove',_0x489d('0x1')];function createListener(_0xc695df,_0x55f054){return function(_0x5942a7){_0x55f054['emit'](_0xc695df,_0x5942a7);};}function removeListener(_0x53ebce,_0x17904f){return function(){FaxMessageEvents[_0x489d('0x2')](_0x53ebce,_0x17904f);};}exports[_0x489d('0x3')]=function(_0x2f39b0){for(var _0xe3adf9=0x0,_0x388787=events[_0x489d('0x4')];_0xe3adf9<_0x388787;_0xe3adf9++){var _0xe46962=events[_0xe3adf9];var _0xddb227=createListener(_0x489d('0x5')+_0xe46962,_0x2f39b0);FaxMessageEvents['on'](_0xe46962,_0xddb227);}}; \ No newline at end of file +var _0xc0ce=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0xc0ce,0x1b5));var _0xec0c=function(_0x22cc95,_0x31808f){_0x22cc95=_0x22cc95-0x0;var _0x2959d=_0xc0ce[_0x22cc95];return _0x2959d;};'use strict';var FaxMessageEvents=require(_0xec0c('0x0'));var events=[_0xec0c('0x1'),_0xec0c('0x2'),_0xec0c('0x3')];function createListener(_0x56a738,_0x58407f){return function(_0x44e652){_0x58407f[_0xec0c('0x4')](_0x56a738,_0x44e652);};}function removeListener(_0x358141,_0x4566f8){return function(){FaxMessageEvents[_0xec0c('0x5')](_0x358141,_0x4566f8);};}exports[_0xec0c('0x6')]=function(_0x1796ad){for(var _0x952184=0x0,_0x3893c0=events[_0xec0c('0x7')];_0x952184<_0x3893c0;_0x952184++){var _0x2b0da0=events[_0x952184];var _0xdddcee=createListener(_0xec0c('0x8')+_0x2b0da0,_0x1796ad);FaxMessageEvents['on'](_0x2b0da0,_0xdddcee);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 04e3016..ae7cf29 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 _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0xcea2,0x15a));var _0x2cea=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xcea2[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file +var _0xf4eb=['/:id/accept','accept','/:id/reject','delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','tracked','faxmessage:create','create','put'];(function(_0xe3025,_0x686182){var _0x592d0b=function(_0x4d249f){while(--_0x4d249f){_0xe3025['push'](_0xe3025['shift']());}};_0x592d0b(++_0x686182);}(_0xf4eb,0xec));var _0xbf4e=function(_0x313b62,_0x323e6f){_0x313b62=_0x313b62-0x0;var _0x3b316c=_0xf4eb[_0x313b62];return _0x3b316c;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xbf4e('0xc')]('fax',_0xbf4e('0xd')),controller[_0xbf4e('0xe')]);router['put'](_0xbf4e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);router[_0xbf4e('0xf')](_0xbf4e('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0xbf4e('0x13')](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 667bb19..d66143e 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 _0x2c8f=['ENUM','rrmemory','exports','INTEGER'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x2c8f,0x192));var _0xf2c8=function(_0x8d9771,_0x1a1d49){_0x8d9771=_0x8d9771-0x0;var _0x2d98f9=_0x2c8f[_0x8d9771];return _0x2d98f9;};'use strict';var Sequelize=require('sequelize');module[_0xf2c8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf2c8('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf2c8('0x2')](_0xf2c8('0x3'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf2c8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x83fc=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2bea8d,_0x5a4fb3){var _0x5537e8=function(_0x51872d){while(--_0x51872d){_0x2bea8d['push'](_0x2bea8d['shift']());}};_0x5537e8(++_0x5a4fb3);}(_0x83fc,0x181));var _0xc83f=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x83fc[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xc83f('0x0'));module[_0xc83f('0x1')]={'name':{'type':Sequelize[_0xc83f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc83f('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc83f('0x4')](_0xc83f('0x5'),_0xc83f('0x6'),_0xc83f('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc83f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 34ecf21..67907eb 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 _0xb182=['User','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','getTeams','Team','length','ids','voicePause','interface','flatMap','addTeams','each','findOrCreate','emit','userFaxQueue:save','Agents','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','then','destroy','FaxQueues','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','limit','order','sort','pick','FaxQueueId','filter','merge'];(function(_0x944bfd,_0x29d12c){var _0x5e7555=function(_0x47f006){while(--_0x47f006){_0x944bfd['push'](_0x944bfd['shift']());}};_0x5e7555(++_0x29d12c);}(_0xb182,0x121));var _0x2b18=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0xb182[_0xcf581b];return _0x4f454d;};'use strict';var BPromise=require('bluebird');var util=require(_0x2b18('0x0'));var _=require(_0x2b18('0x1'));var squel=require(_0x2b18('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x2b18('0x3'))(_0x2b18('0x4'));var config=require(_0x2b18('0x5'));var db=require('../../mysqldb')['db'];config[_0x2b18('0x6')]=_[_0x2b18('0x7')](config[_0x2b18('0x6')],{'host':_0x2b18('0x8'),'port':0x18eb});var socket=require(_0x2b18('0x9'))(new Redis(config[_0x2b18('0x6')]));require(_0x2b18('0xa'))['register'](socket);function respondWithStatusCode(_0x264ae2,_0x193e13){_0x193e13=_0x193e13||0xcc;return function(_0xfe8a8d){if(_0xfe8a8d){return _0x264ae2[_0x2b18('0xb')](_0x193e13);}return _0x264ae2[_0x2b18('0xc')](_0x193e13)[_0x2b18('0xd')]();};}function respondWithResult(_0x1311ad,_0x261b64){_0x261b64=_0x261b64||0xc8;return function(_0x440d50){if(_0x440d50){return _0x1311ad[_0x2b18('0xc')](_0x261b64)[_0x2b18('0xe')](_0x440d50);}};}function respondWithFilteredResult(_0x36bea7,_0xdb11bf){return function(_0x5225bf){if(_0x5225bf){var _0x42d679=typeof _0xdb11bf[_0x2b18('0xf')]==='undefined'&&typeof _0xdb11bf['limit']===_0x2b18('0x10');var _0xf2643c=_0x5225bf[_0x2b18('0x11')];var _0x1d20a0=_0x42d679?0x0:_0xdb11bf[_0x2b18('0xf')];var _0x195a26=_0x42d679?_0x5225bf[_0x2b18('0x11')]:_0xdb11bf[_0x2b18('0xf')]+_0xdb11bf['limit'];var _0x2ef594;if(_0x195a26>=_0xf2643c){_0x195a26=_0xf2643c;_0x2ef594=0xc8;}else{_0x2ef594=0xce;}_0x36bea7[_0x2b18('0xc')](_0x2ef594);return _0x36bea7[_0x2b18('0x12')]('Content-Range',_0x1d20a0+'-'+_0x195a26+'/'+_0xf2643c)[_0x2b18('0xe')](_0x5225bf);}return null;};}function saveUpdates(_0x52754f){return function(_0x5346e5){if(_0x5346e5){return _0x5346e5['update'](_0x52754f)[_0x2b18('0x13')](function(_0xc4714f){return _0xc4714f;});}return null;};}function removeEntity(_0x7210b2){return function(_0x149ee0){if(_0x149ee0){return _0x149ee0[_0x2b18('0x14')]()[_0x2b18('0x13')](function(){var _0x279914=_0x149ee0['get']({'plain':!![]});var _0x349557=_0x2b18('0x15');return db['UserProfileResource']['destroy']({'where':{'type':_0x349557,'resourceId':_0x279914['id']}})[_0x2b18('0x13')](function(){return _0x149ee0;});})[_0x2b18('0x13')](function(){_0x7210b2['status'](0xcc)[_0x2b18('0xd')]();});}};}function handleEntityNotFound(_0x43912d){return function(_0x309633){if(!_0x309633){_0x43912d[_0x2b18('0xb')](0x194);}return _0x309633;};}function handleError(_0x4e45d0,_0x1b1635){_0x1b1635=_0x1b1635||0x1f4;return function(_0x50539e){logger[_0x2b18('0x16')](_0x50539e[_0x2b18('0x17')]);if(_0x50539e[_0x2b18('0x18')]){delete _0x50539e['name'];}_0x4e45d0['status'](_0x1b1635)['send'](_0x50539e);};}exports[_0x2b18('0x19')]=function(_0x446655,_0x184d30){var _0x38e879={};var _0x3e52c2={'count':0x0,'rows':[]};var _0x3f0425=_[_0x2b18('0x1a')](db[_0x2b18('0x1b')][_0x2b18('0x1c')],function(_0x4e600b){return{'name':_0x4e600b[_0x2b18('0x1d')],'type':_0x4e600b[_0x2b18('0x1e')][_0x2b18('0x1f')]};});_0x38e879=qs[_0x2b18('0x20')](_0x3f0425,_0x446655);var _0x23ca0e={'where':_0x38e879[_0x2b18('0x21')]};return db[_0x2b18('0x1b')][_0x2b18('0x11')](_0x23ca0e)[_0x2b18('0x13')](function(_0x26afc0){_0x3e52c2[_0x2b18('0x11')]=_0x26afc0;_0x38e879[_0x2b18('0x22')]=qs[_0x2b18('0x22')](_0x446655[_0x2b18('0x23')]);return db[_0x2b18('0x1b')][_0x2b18('0x24')](_0x38e879);})[_0x2b18('0x13')](function(_0x2990b2){_0x3e52c2[_0x2b18('0x25')]=_0x2990b2;return _0x3e52c2;})[_0x2b18('0x13')](respondWithFilteredResult(_0x184d30,_0x38e879))[_0x2b18('0x26')](handleError(_0x184d30,null));};exports[_0x2b18('0x27')]=function(_0x56d8de,_0x3d1ba0){var _0x47487c={'raw':!![],'where':{'id':_0x56d8de[_0x2b18('0x28')]['id']}},_0xcacfef={};_0xcacfef['model']=_['keys'](db['FaxQueue'][_0x2b18('0x1c')]);_0xcacfef[_0x2b18('0x23')]=_[_0x2b18('0x29')](_0x56d8de[_0x2b18('0x23')]);_0xcacfef[_0x2b18('0x2a')]=_[_0x2b18('0x2b')](_0xcacfef[_0x2b18('0x2c')],_0xcacfef[_0x2b18('0x23')]);_0x47487c[_0x2b18('0x2d')]=_[_0x2b18('0x2b')](_0xcacfef[_0x2b18('0x2c')],qs[_0x2b18('0x2e')](_0x56d8de[_0x2b18('0x23')][_0x2b18('0x2e')]));_0x47487c['attributes']=_0x47487c['attributes']['length']?_0x47487c[_0x2b18('0x2d')]:_0xcacfef[_0x2b18('0x2c')];if(_0x56d8de[_0x2b18('0x23')][_0x2b18('0x2f')]){_0x47487c['include']=[{'all':!![]}];}_0x47487c=_['merge']({},_0x47487c,_0x56d8de[_0x2b18('0x30')]);return db[_0x2b18('0x1b')][_0x2b18('0x31')](_0x47487c)[_0x2b18('0x13')](handleEntityNotFound(_0x3d1ba0,null))[_0x2b18('0x13')](respondWithResult(_0x3d1ba0,null))[_0x2b18('0x26')](handleError(_0x3d1ba0,null));};exports[_0x2b18('0x32')]=function(_0x2efea5,_0x43c666){return db[_0x2b18('0x1b')][_0x2b18('0x32')](_0x2efea5[_0x2b18('0x33')],{})[_0x2b18('0x13')](function(_0x13c5e9){var _0x139761=_0x2efea5[_0x2b18('0x34')]['get']({'plain':!![]});if(!_0x139761)throw new Error(_0x2b18('0x35'));if(_0x139761[_0x2b18('0x36')]===_0x2b18('0x34')){var _0x444fa6=_0x13c5e9[_0x2b18('0x37')]({'plain':!![]});var _0x175659=_0x2b18('0x15');return db[_0x2b18('0x38')][_0x2b18('0x31')]({'where':{'name':_0x175659,'userProfileId':_0x139761[_0x2b18('0x39')]},'raw':!![]})[_0x2b18('0x13')](function(_0xd192ca){if(_0xd192ca&&_0xd192ca[_0x2b18('0x3a')]===0x0){return db[_0x2b18('0x3b')][_0x2b18('0x32')]({'name':_0x444fa6[_0x2b18('0x18')],'resourceId':_0x444fa6['id'],'type':_0xd192ca[_0x2b18('0x18')],'sectionId':_0xd192ca['id']},{})[_0x2b18('0x13')](function(){return _0x13c5e9;});}else{return _0x13c5e9;}})[_0x2b18('0x26')](function(_0xffbf0a){logger[_0x2b18('0x16')](_0x2b18('0x3c'),_0xffbf0a);throw _0xffbf0a;});}return _0x13c5e9;})[_0x2b18('0x13')](respondWithResult(_0x43c666,0xc9))['catch'](handleError(_0x43c666,null));};exports['update']=function(_0x7a8181,_0x39db64){if(_0x7a8181[_0x2b18('0x33')]['id']){delete _0x7a8181[_0x2b18('0x33')]['id'];}return db[_0x2b18('0x1b')][_0x2b18('0x31')]({'where':{'id':_0x7a8181['params']['id']}})['then'](handleEntityNotFound(_0x39db64,null))[_0x2b18('0x13')](saveUpdates(_0x7a8181[_0x2b18('0x33')],null))[_0x2b18('0x13')](respondWithResult(_0x39db64,null))[_0x2b18('0x26')](handleError(_0x39db64,null));};exports[_0x2b18('0x14')]=function(_0x591790,_0x525148){return db[_0x2b18('0x1b')][_0x2b18('0x31')]({'where':{'id':_0x591790['params']['id']}})['then'](handleEntityNotFound(_0x525148,null))[_0x2b18('0x13')](removeEntity(_0x525148,null))[_0x2b18('0x26')](handleError(_0x525148,null));};exports[_0x2b18('0x3d')]=function(_0x143aa6,_0x39ebfc){return db[_0x2b18('0x1b')][_0x2b18('0x3d')]()[_0x2b18('0x13')](respondWithResult(_0x39ebfc,null))['catch'](handleError(_0x39ebfc,null));};exports[_0x2b18('0x3e')]=function(_0x90dc90,_0x4f1e50){var _0x2e2ab5={'raw':!![],'where':{}},_0x4ac135={},_0x485036;return db['FaxQueue'][_0x2b18('0x3f')]({'where':{'id':_0x90dc90['params']['id']}})['then'](handleEntityNotFound(_0x4f1e50,null))[_0x2b18('0x13')](function(_0x51b872){if(_0x51b872){_0x485036=_0x51b872[_0x2b18('0x37')]({'plain':!![]});_0x4ac135[_0x2b18('0x2c')]=_[_0x2b18('0x29')](db[_0x2b18('0x40')][_0x2b18('0x1c')]);_0x4ac135[_0x2b18('0x23')]=_['keys'](_0x90dc90[_0x2b18('0x23')]);_0x4ac135[_0x2b18('0x2a')]=_[_0x2b18('0x2b')](_0x4ac135[_0x2b18('0x2c')],_0x4ac135[_0x2b18('0x23')]);_0x2e2ab5[_0x2b18('0x2d')]=_[_0x2b18('0x2b')](_0x4ac135[_0x2b18('0x2c')],qs['fields'](_0x90dc90[_0x2b18('0x23')][_0x2b18('0x2e')]));_0x2e2ab5[_0x2b18('0x2d')]=_0x2e2ab5[_0x2b18('0x2d')]['length']?_0x2e2ab5[_0x2b18('0x2d')]:_0x4ac135[_0x2b18('0x2c')];if(!_0x90dc90['query'][_0x2b18('0x41')](_0x2b18('0x42'))){_0x2e2ab5[_0x2b18('0x43')]=qs[_0x2b18('0x43')](_0x90dc90['query'][_0x2b18('0x43')]);_0x2e2ab5['offset']=qs['offset'](_0x90dc90[_0x2b18('0x23')]['offset']);}_0x2e2ab5[_0x2b18('0x44')]=qs[_0x2b18('0x45')](_0x90dc90[_0x2b18('0x23')][_0x2b18('0x45')]);_0x2e2ab5[_0x2b18('0x21')]=qs[_0x2b18('0x2a')](_[_0x2b18('0x46')](_0x90dc90[_0x2b18('0x23')],_0x4ac135['filters']));_0x2e2ab5[_0x2b18('0x21')][_0x2b18('0x47')]=_0x51b872['id'];if(_0x90dc90['query'][_0x2b18('0x48')]){_0x2e2ab5['where']=_['merge'](_0x2e2ab5[_0x2b18('0x21')],{'$or':_['map'](_0x2e2ab5['attributes'],function(_0x1b8349){var _0x3e9a72={};_0x3e9a72[_0x1b8349]={'$like':'%'+_0x90dc90[_0x2b18('0x23')][_0x2b18('0x48')]+'%'};return _0x3e9a72;})});}_0x2e2ab5=_[_0x2b18('0x49')]({},_0x2e2ab5,_0x90dc90['options']);return db[_0x2b18('0x40')][_0x2b18('0x24')](_0x2e2ab5);}})[_0x2b18('0x13')](function(_0x59d9c9){if(_0x59d9c9){return db[_0x2b18('0x4a')]['findAndCountAll']({'where':{'id':_[_0x2b18('0x1a')](_0x59d9c9,_0x2b18('0x4b')),'role':_0x2b18('0x4c')},'attributes':['id',_0x2b18('0x18'),_0x2b18('0x4d'),'updatedAt',_0x2b18('0x4e')]});}})['then'](function(_0x3479f1){if(_0x3479f1){return{'count':_0x3479f1[_0x2b18('0x11')],'rows':_[_0x2b18('0x1a')](_0x3479f1[_0x2b18('0x25')],function(_0x5312cc){return{'membername':_0x5312cc[_0x2b18('0x18')],'UserId':_0x5312cc['id'],'queue_name':_0x485036[_0x2b18('0x18')],'FaxQueueId':_0x485036['id'],'interface':util[_0x2b18('0x4f')](_0x2b18('0x50'),_0x2b18('0x51'),_0x5312cc['name']),'penalty':0x0,'paused':_0x5312cc[_0x2b18('0x4d')],'createdAt':_0x5312cc['createdAt'],'updatedAt':_0x5312cc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b18('0x13')](respondWithFilteredResult(_0x4f1e50,_0x2e2ab5))[_0x2b18('0x26')](handleError(_0x4f1e50,null));};exports[_0x2b18('0x52')]=function(_0x48a75b,_0x55d6aa){var _0x10701b={};var _0x37cf1e={};var _0x232955;var _0xae2206;return db[_0x2b18('0x1b')][_0x2b18('0x3f')]({'where':{'id':_0x48a75b['params']['id']}})[_0x2b18('0x13')](handleEntityNotFound(_0x55d6aa,null))[_0x2b18('0x13')](function(_0x2459d7){if(_0x2459d7){_0x232955=_0x2459d7;_0x37cf1e['model']=_[_0x2b18('0x29')](db[_0x2b18('0x53')][_0x2b18('0x1c')]);_0x37cf1e[_0x2b18('0x23')]=_[_0x2b18('0x29')](_0x48a75b[_0x2b18('0x23')]);_0x37cf1e[_0x2b18('0x2a')]=_[_0x2b18('0x2b')](_0x37cf1e[_0x2b18('0x2c')],_0x37cf1e[_0x2b18('0x23')]);_0x10701b[_0x2b18('0x2d')]=_[_0x2b18('0x2b')](_0x37cf1e[_0x2b18('0x2c')],qs[_0x2b18('0x2e')](_0x48a75b['query'][_0x2b18('0x2e')]));_0x10701b[_0x2b18('0x2d')]=_0x10701b[_0x2b18('0x2d')][_0x2b18('0x54')]?_0x10701b[_0x2b18('0x2d')]:_0x37cf1e['model'];_0x10701b[_0x2b18('0x44')]=qs[_0x2b18('0x45')](_0x48a75b['query'][_0x2b18('0x45')]);_0x10701b[_0x2b18('0x21')]=qs['filters'](_[_0x2b18('0x46')](_0x48a75b[_0x2b18('0x23')],_0x37cf1e[_0x2b18('0x2a')]));if(_0x48a75b['query'][_0x2b18('0x48')]){_0x10701b[_0x2b18('0x21')]=_[_0x2b18('0x49')](_0x10701b[_0x2b18('0x21')],{'$or':_[_0x2b18('0x1a')](_0x10701b['attributes'],function(_0x505afb){var _0x5432ba={};_0x5432ba[_0x505afb]={'$like':'%'+_0x48a75b['query'][_0x2b18('0x48')]+'%'};return _0x5432ba;})});}_0x10701b=_[_0x2b18('0x49')]({},_0x10701b,_0x48a75b[_0x2b18('0x30')]);return _0x232955[_0x2b18('0x52')](_0x10701b);}})['then'](function(_0x193af1){if(_0x193af1){_0xae2206=_0x193af1[_0x2b18('0x54')];if(!_0x48a75b[_0x2b18('0x23')][_0x2b18('0x41')](_0x2b18('0x42'))){_0x10701b[_0x2b18('0x43')]=qs['limit'](_0x48a75b[_0x2b18('0x23')][_0x2b18('0x43')]);_0x10701b[_0x2b18('0xf')]=qs[_0x2b18('0xf')](_0x48a75b[_0x2b18('0x23')][_0x2b18('0xf')]);}return _0x232955[_0x2b18('0x52')](_0x10701b);}})[_0x2b18('0x13')](function(_0x439259){if(_0x439259){return _0x439259?{'count':_0xae2206,'rows':_0x439259}:null;}})[_0x2b18('0x13')](respondWithResult(_0x55d6aa,null))[_0x2b18('0x26')](handleError(_0x55d6aa,null));};exports['addTeams']=function(_0x2b6c93,_0x42fa0d){var _0x819528=_0x2b6c93[_0x2b18('0x33')][_0x2b18('0x55')];return db[_0x2b18('0x53')][_0x2b18('0x24')]({'where':{'id':_0x819528},'attributes':['id'],'include':[{'model':db[_0x2b18('0x4a')],'as':'Agents','attributes':['id',_0x2b18('0x18'),'online',_0x2b18('0x56'),_0x2b18('0x57')],'raw':!![]}]})[_0x2b18('0x13')](function(_0x27c99d){if(_0x27c99d){var _0x533050=_[_0x2b18('0x58')](_0x27c99d,function(_0x2cec9e){var _0x22161e=_0x2cec9e[_0x2b18('0x37')]({'plain':!![]});return _0x22161e['Agents'];});return db['FaxQueue'][_0x2b18('0x31')]({'where':{'id':_0x2b6c93[_0x2b18('0x28')]['id']}})['then'](function(_0x1e3bdb){return db['sequelize']['transaction'](function(_0x1b647f){return _0x1e3bdb[_0x2b18('0x59')](_0x819528,{'transaction':_0x1b647f})['then'](function(){return BPromise[_0x2b18('0x5a')](_0x533050,function(_0x471ff4){return db[_0x2b18('0x40')][_0x2b18('0x5b')]({'where':{'UserId':_0x471ff4['id'],'FaxQueueId':_0x2b6c93[_0x2b18('0x28')]['id']},'transaction':_0x1b647f});});})[_0x2b18('0x13')](function(){_0x533050['forEach'](function(_0x2c18db){socket[_0x2b18('0x5c')](_0x2b18('0x5d'),{'UserId':_0x2c18db['id'],'FaxQueueId':_0x1e3bdb['id']});});});});});}})[_0x2b18('0x13')](respondWithStatusCode(_0x42fa0d,null))['catch'](handleError(_0x42fa0d,null));};exports['removeTeams']=function(_0x3ae081,_0x1855e1){return db['Team'][_0x2b18('0x24')]({'where':{'id':_0x3ae081[_0x2b18('0x23')][_0x2b18('0x55')]},'attributes':['id'],'include':[{'model':db[_0x2b18('0x4a')],'as':_0x2b18('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1855e1,null))[_0x2b18('0x13')](function(_0x4300e7){var _0x2fc8ec=_[_0x2b18('0x1a')](_0x4300e7,'id');var _0x3c5883=[];var _0xb9f6f8=[];var _0x5a471a=squel['select']();_0x5a471a[_0x2b18('0x5f')](_0x2b18('0x60'))[_0x2b18('0x61')](_0x2b18('0x62'),'tq')['join'](_0x2b18('0x63'),'ut',_0x2b18('0x64'))[_0x2b18('0x21')](_0x2b18('0x65'),_0x3ae081[_0x2b18('0x28')]['id']);for(var _0x5846f3=0x0;_0x5846f3<_0x4300e7[_0x2b18('0x54')];_0x5846f3+=0x1){let _0x1533f5=_0x4300e7[_0x5846f3];for(var _0x59b4ca=0x0;_0x59b4ca<_0x1533f5['Agents'][_0x2b18('0x54')];_0x59b4ca+=0x1){let _0xe16121=_0x1533f5[_0x2b18('0x5e')][_0x59b4ca];var _0x23fb88=_0x5a471a[_0x2b18('0x66')]();_0x23fb88['where'](_0x2b18('0x67'),_0xe16121['id']);_0xb9f6f8['push'](db['sequelize'][_0x2b18('0x23')](_0x23fb88['toString'](),{'type':db[_0x2b18('0x68')][_0x2b18('0x69')][_0x2b18('0x6a')]})[_0x2b18('0x13')](function(_0xd0db33){if(_0xd0db33[_0x2b18('0x54')]===0x1){return _0xe16121['id'];}else{var _0x1a8928=_[_0x2b18('0x6b')](_[_0x2b18('0x1a')](_0xd0db33,_0x2b18('0x6c')),function(_0x789c94){return _['includes'](_0x2fc8ec,_0x789c94);});if(_0x1a8928){return _0xe16121['id'];}}}));}}return BPromise['all'](_0xb9f6f8)[_0x2b18('0x13')](function(_0xc6b41b){_0x3c5883=_(_0x3c5883)['union'](_0xc6b41b)['compact']()[_0x2b18('0x6d')]();return db[_0x2b18('0x1b')][_0x2b18('0x31')]({'where':{'id':_0x3ae081['params']['id']}})[_0x2b18('0x13')](function(_0x4f0db9){return db['sequelize'][_0x2b18('0x6e')](function(_0x38298a){return _0x4f0db9[_0x2b18('0x6f')](_0x3ae081[_0x2b18('0x23')][_0x2b18('0x55')],{'transaction':_0x38298a})[_0x2b18('0x13')](function(){if(!_[_0x2b18('0x70')](_0x3c5883)){return _0x4f0db9[_0x2b18('0x71')](_0x3c5883,{'transaction':_0x38298a});}})[_0x2b18('0x13')](function(){_0x3c5883[_0x2b18('0x72')](function(_0x493beb){socket[_0x2b18('0x5c')](_0x2b18('0x73'),{'UserId':_0x493beb,'FaxQueueId':_0x4f0db9['id']});});});});});});})[_0x2b18('0x13')](respondWithStatusCode(_0x1855e1,null))[_0x2b18('0x26')](handleError(_0x1855e1,null));};exports[_0x2b18('0x74')]=function(_0x4ce8b1,_0x2f8c00){return db[_0x2b18('0x1b')][_0x2b18('0x31')]({'where':{'id':_0x4ce8b1['params']['id']}})['then'](handleEntityNotFound(_0x2f8c00,null))['then'](function(_0x38763d){if(_0x38763d){return _0x38763d[_0x2b18('0x74')](_0x4ce8b1[_0x2b18('0x33')][_0x2b18('0x55')],_[_0x2b18('0x75')](_0x4ce8b1[_0x2b18('0x33')],[_0x2b18('0x55'),'id'])||{})[_0x2b18('0x76')](function(_0x4f9b68){for(var _0x3a821f=0x0;_0x3a821f<_0x4ce8b1[_0x2b18('0x33')][_0x2b18('0x55')]['length'];_0x3a821f+=0x1){socket[_0x2b18('0x5c')](_0x2b18('0x5d'),{'UserId':Number(_0x4ce8b1[_0x2b18('0x33')][_0x2b18('0x55')][_0x3a821f]),'FaxQueueId':Number(_0x4ce8b1[_0x2b18('0x28')]['id'])});}return _0x4f9b68;});}})['then'](respondWithResult(_0x2f8c00,null))[_0x2b18('0x26')](handleError(_0x2f8c00,null));};exports['removeAgents']=function(_0x3f8a17,_0x1ad7e6){return db[_0x2b18('0x1b')][_0x2b18('0x31')]({'where':{'id':_0x3f8a17[_0x2b18('0x28')]['id']}})['then'](handleEntityNotFound(_0x1ad7e6,null))[_0x2b18('0x13')](function(_0x1a834c){if(_0x1a834c){return _0x1a834c[_0x2b18('0x71')](_0x3f8a17[_0x2b18('0x23')][_0x2b18('0x55')])[_0x2b18('0x13')](function(){if(_[_0x2b18('0x77')](_0x3f8a17['query'][_0x2b18('0x55')])){for(var _0x5b2922=0x0;_0x5b2922<_0x3f8a17[_0x2b18('0x23')][_0x2b18('0x55')]['length'];_0x5b2922+=0x1){socket[_0x2b18('0x5c')](_0x2b18('0x73'),{'UserId':Number(_0x3f8a17['query'][_0x2b18('0x55')][_0x5b2922]),'FaxQueueId':Number(_0x3f8a17['params']['id'])});}}else{socket[_0x2b18('0x5c')](_0x2b18('0x73'),{'UserId':Number(_0x3f8a17['query'][_0x2b18('0x55')]),'FaxQueueId':Number(_0x3f8a17[_0x2b18('0x28')]['id'])});}});}})[_0x2b18('0x13')](respondWithStatusCode(_0x1ad7e6,null))[_0x2b18('0x26')](handleError(_0x1ad7e6,null));};exports[_0x2b18('0x78')]=function(_0x13100d,_0x5d2717){var _0xf9f8d6={};var _0x4cba79={};var _0x4b5978;var _0x1ee1bb;return db[_0x2b18('0x1b')][_0x2b18('0x3f')]({'where':{'id':_0x13100d['params']['id']}})[_0x2b18('0x13')](handleEntityNotFound(_0x5d2717,null))['then'](function(_0x480258){if(_0x480258){_0x4b5978=_0x480258;_0x4cba79[_0x2b18('0x2c')]=_[_0x2b18('0x29')](db['User']['rawAttributes']);_0x4cba79['query']=_[_0x2b18('0x29')](_0x13100d[_0x2b18('0x23')]);_0x4cba79['filters']=_[_0x2b18('0x2b')](_0x4cba79[_0x2b18('0x2c')],_0x4cba79[_0x2b18('0x23')]);_0xf9f8d6[_0x2b18('0x2d')]=_[_0x2b18('0x2b')](_0x4cba79['model'],qs['fields'](_0x13100d[_0x2b18('0x23')][_0x2b18('0x2e')]));_0xf9f8d6['attributes']=_0xf9f8d6[_0x2b18('0x2d')]['length']?_0xf9f8d6['attributes']:_0x4cba79[_0x2b18('0x2c')];_0xf9f8d6[_0x2b18('0x44')]=qs[_0x2b18('0x45')](_0x13100d[_0x2b18('0x23')][_0x2b18('0x45')]);_0xf9f8d6['where']=qs[_0x2b18('0x2a')](_[_0x2b18('0x46')](_0x13100d[_0x2b18('0x23')],_0x4cba79[_0x2b18('0x2a')]));if(_0x13100d[_0x2b18('0x23')][_0x2b18('0x48')]){_0xf9f8d6[_0x2b18('0x21')]=_['merge'](_0xf9f8d6[_0x2b18('0x21')],{'$or':_['map'](_0xf9f8d6[_0x2b18('0x2d')],function(_0x39739e){var _0x22184f={};_0x22184f[_0x39739e]={'$like':'%'+_0x13100d[_0x2b18('0x23')][_0x2b18('0x48')]+'%'};return _0x22184f;})});}_0xf9f8d6=_[_0x2b18('0x49')]({},_0xf9f8d6,_0x13100d[_0x2b18('0x30')]);return _0x4b5978['getAgents'](_0xf9f8d6);}})['then'](function(_0x5cf22a){if(_0x5cf22a){_0x1ee1bb=_0x5cf22a['length'];if(!_0x13100d[_0x2b18('0x23')][_0x2b18('0x41')]('nolimit')){_0xf9f8d6[_0x2b18('0x43')]=qs[_0x2b18('0x43')](_0x13100d['query'][_0x2b18('0x43')]);_0xf9f8d6[_0x2b18('0xf')]=qs['offset'](_0x13100d[_0x2b18('0x23')][_0x2b18('0xf')]);}return _0x4b5978[_0x2b18('0x78')](_0xf9f8d6);}})['then'](function(_0x36362a){if(_0x36362a){return _0x36362a?{'count':_0x1ee1bb,'rows':_0x36362a}:null;}})[_0x2b18('0x13')](respondWithResult(_0x5d2717,null))[_0x2b18('0x26')](handleError(_0x5d2717,null));}; \ No newline at end of file +var _0xa46e=['field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','undefined','limit','offset','count','set','then','FaxQueues','UserProfileResource','destroy','error','name','send','rawAttributes','type','getOptions','where','FaxQueue','include','query','rows','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','update','describe','getMembers','findOne','UserFaxQueue','nolimit','order','sort','pick','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','filter','map','hasOwnProperty','addTeams','ids','User','online','voicePause','interface','Agents','sequelize','transaction','forEach','userFaxQueue:save','removeTeams'];(function(_0x202c3d,_0x3264ea){var _0x48b8e9=function(_0x5debd4){while(--_0x5debd4){_0x202c3d['push'](_0x202c3d['shift']());}};_0x48b8e9(++_0x3264ea);}(_0xa46e,0x8a));var _0xea46=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa46e[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var _=require('lodash');var squel=require(_0xea46('0x2'));var Redis=require(_0xea46('0x3'));var qs=require(_0xea46('0x4'));var logger=require('../../config/logger')(_0xea46('0x5'));var config=require('../../config/environment');var db=require(_0xea46('0x6'))['db'];config['redis']=_[_0xea46('0x7')](config['redis'],{'host':_0xea46('0x8'),'port':0x18eb});var socket=require(_0xea46('0x9'))(new Redis(config['redis']));require(_0xea46('0xa'))[_0xea46('0xb')](socket);function respondWithStatusCode(_0xe7d428,_0x3db7a2){_0x3db7a2=_0x3db7a2||0xcc;return function(_0x468322){if(_0x468322){return _0xe7d428['sendStatus'](_0x3db7a2);}return _0xe7d428['status'](_0x3db7a2)['end']();};}function respondWithResult(_0x2c82e,_0x45550a){_0x45550a=_0x45550a||0xc8;return function(_0x5ae8f9){if(_0x5ae8f9){return _0x2c82e[_0xea46('0xc')](_0x45550a)[_0xea46('0xd')](_0x5ae8f9);}};}function respondWithFilteredResult(_0x4560b1,_0x594694){return function(_0xa6d289){if(_0xa6d289){var _0x38e83b=typeof _0x594694['offset']===_0xea46('0xe')&&typeof _0x594694[_0xea46('0xf')]==='undefined';var _0x20955e=_0xa6d289['count'];var _0x3024af=_0x38e83b?0x0:_0x594694[_0xea46('0x10')];var _0x6c4bc4=_0x38e83b?_0xa6d289[_0xea46('0x11')]:_0x594694[_0xea46('0x10')]+_0x594694[_0xea46('0xf')];var _0x81ee45;if(_0x6c4bc4>=_0x20955e){_0x6c4bc4=_0x20955e;_0x81ee45=0xc8;}else{_0x81ee45=0xce;}_0x4560b1[_0xea46('0xc')](_0x81ee45);return _0x4560b1[_0xea46('0x12')]('Content-Range',_0x3024af+'-'+_0x6c4bc4+'/'+_0x20955e)[_0xea46('0xd')](_0xa6d289);}return null;};}function saveUpdates(_0xbf225e){return function(_0x3926cf){if(_0x3926cf){return _0x3926cf['update'](_0xbf225e)['then'](function(_0x19d5c1){return _0x19d5c1;});}return null;};}function removeEntity(_0x3f463d){return function(_0x5cf5dd){if(_0x5cf5dd){return _0x5cf5dd['destroy']()[_0xea46('0x13')](function(){var _0x9b7d04=_0x5cf5dd['get']({'plain':!![]});var _0x40316b=_0xea46('0x14');return db[_0xea46('0x15')][_0xea46('0x16')]({'where':{'type':_0x40316b,'resourceId':_0x9b7d04['id']}})['then'](function(){return _0x5cf5dd;});})[_0xea46('0x13')](function(){_0x3f463d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc43e){return function(_0x59e431){if(!_0x59e431){_0x1bc43e['sendStatus'](0x194);}return _0x59e431;};}function handleError(_0x5064d8,_0x3b25fe){_0x3b25fe=_0x3b25fe||0x1f4;return function(_0x36f982){logger[_0xea46('0x17')](_0x36f982['stack']);if(_0x36f982[_0xea46('0x18')]){delete _0x36f982['name'];}_0x5064d8[_0xea46('0xc')](_0x3b25fe)[_0xea46('0x19')](_0x36f982);};}exports['index']=function(_0xac33c3,_0x5480eb){var _0x2b3a8f={};var _0x114bf9={'count':0x0,'rows':[]};var _0xd4cf78=_['map'](db['FaxQueue'][_0xea46('0x1a')],function(_0x38ac07){return{'name':_0x38ac07['fieldName'],'type':_0x38ac07[_0xea46('0x1b')]['key']};});_0x2b3a8f=qs[_0xea46('0x1c')](_0xd4cf78,_0xac33c3);var _0x51ca27={'where':_0x2b3a8f[_0xea46('0x1d')]};return db[_0xea46('0x1e')][_0xea46('0x11')](_0x51ca27)[_0xea46('0x13')](function(_0x146995){_0x114bf9[_0xea46('0x11')]=_0x146995;_0x2b3a8f['include']=qs[_0xea46('0x1f')](_0xac33c3[_0xea46('0x20')]);return db[_0xea46('0x1e')]['findAll'](_0x2b3a8f);})[_0xea46('0x13')](function(_0x3cdf96){_0x114bf9[_0xea46('0x21')]=_0x3cdf96;return _0x114bf9;})['then'](respondWithFilteredResult(_0x5480eb,_0x2b3a8f))['catch'](handleError(_0x5480eb,null));};exports['show']=function(_0x64e2d0,_0x16f730){var _0x167ee9={'raw':!![],'where':{'id':_0x64e2d0[_0xea46('0x22')]['id']}},_0x17f101={};_0x17f101[_0xea46('0x23')]=_[_0xea46('0x24')](db[_0xea46('0x1e')][_0xea46('0x1a')]);_0x17f101[_0xea46('0x20')]=_[_0xea46('0x24')](_0x64e2d0['query']);_0x17f101[_0xea46('0x25')]=_[_0xea46('0x26')](_0x17f101[_0xea46('0x23')],_0x17f101[_0xea46('0x20')]);_0x167ee9[_0xea46('0x27')]=_[_0xea46('0x26')](_0x17f101[_0xea46('0x23')],qs['fields'](_0x64e2d0[_0xea46('0x20')][_0xea46('0x28')]));_0x167ee9[_0xea46('0x27')]=_0x167ee9[_0xea46('0x27')][_0xea46('0x29')]?_0x167ee9['attributes']:_0x17f101['model'];if(_0x64e2d0[_0xea46('0x20')][_0xea46('0x2a')]){_0x167ee9['include']=[{'all':!![]}];}_0x167ee9=_[_0xea46('0x2b')]({},_0x167ee9,_0x64e2d0[_0xea46('0x2c')]);return db[_0xea46('0x1e')][_0xea46('0x2d')](_0x167ee9)['then'](handleEntityNotFound(_0x16f730,null))['then'](respondWithResult(_0x16f730,null))[_0xea46('0x2e')](handleError(_0x16f730,null));};exports['create']=function(_0x7c34ce,_0xdec374){return db['FaxQueue'][_0xea46('0x2f')](_0x7c34ce[_0xea46('0x30')],{})['then'](function(_0xb90644){var _0xefad3e=_0x7c34ce['user'][_0xea46('0x31')]({'plain':!![]});if(!_0xefad3e)throw new Error(_0xea46('0x32'));if(_0xefad3e[_0xea46('0x33')]===_0xea46('0x34')){var _0x4a0287=_0xb90644[_0xea46('0x31')]({'plain':!![]});var _0x48c2be=_0xea46('0x14');return db[_0xea46('0x35')][_0xea46('0x2d')]({'where':{'name':_0x48c2be,'userProfileId':_0xefad3e['userProfileId']},'raw':!![]})[_0xea46('0x13')](function(_0xdb2e11){if(_0xdb2e11&&_0xdb2e11['autoAssociation']===0x0){return db[_0xea46('0x15')][_0xea46('0x2f')]({'name':_0x4a0287[_0xea46('0x18')],'resourceId':_0x4a0287['id'],'type':_0xdb2e11[_0xea46('0x18')],'sectionId':_0xdb2e11['id']},{})['then'](function(){return _0xb90644;});}else{return _0xb90644;}})[_0xea46('0x2e')](function(_0x1cc8f8){logger[_0xea46('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cc8f8);throw _0x1cc8f8;});}return _0xb90644;})[_0xea46('0x13')](respondWithResult(_0xdec374,0xc9))[_0xea46('0x2e')](handleError(_0xdec374,null));};exports[_0xea46('0x36')]=function(_0x32c81c,_0x3164c5){if(_0x32c81c[_0xea46('0x30')]['id']){delete _0x32c81c[_0xea46('0x30')]['id'];}return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x32c81c[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x3164c5,null))[_0xea46('0x13')](saveUpdates(_0x32c81c[_0xea46('0x30')],null))[_0xea46('0x13')](respondWithResult(_0x3164c5,null))[_0xea46('0x2e')](handleError(_0x3164c5,null));};exports['destroy']=function(_0x4798d1,_0x2299bb){return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x4798d1[_0xea46('0x22')]['id']}})['then'](handleEntityNotFound(_0x2299bb,null))['then'](removeEntity(_0x2299bb,null))['catch'](handleError(_0x2299bb,null));};exports[_0xea46('0x37')]=function(_0x709bd3,_0x53a4d9){return db[_0xea46('0x1e')][_0xea46('0x37')]()[_0xea46('0x13')](respondWithResult(_0x53a4d9,null))[_0xea46('0x2e')](handleError(_0x53a4d9,null));};exports[_0xea46('0x38')]=function(_0x5c5eed,_0x172db7){var _0x4bd3f2={'raw':!![],'where':{}},_0x22d9a2={},_0x18bcbf;return db[_0xea46('0x1e')][_0xea46('0x39')]({'where':{'id':_0x5c5eed[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x172db7,null))[_0xea46('0x13')](function(_0x52f134){if(_0x52f134){_0x18bcbf=_0x52f134[_0xea46('0x31')]({'plain':!![]});_0x22d9a2[_0xea46('0x23')]=_['keys'](db[_0xea46('0x3a')][_0xea46('0x1a')]);_0x22d9a2[_0xea46('0x20')]=_['keys'](_0x5c5eed['query']);_0x22d9a2[_0xea46('0x25')]=_[_0xea46('0x26')](_0x22d9a2[_0xea46('0x23')],_0x22d9a2[_0xea46('0x20')]);_0x4bd3f2[_0xea46('0x27')]=_[_0xea46('0x26')](_0x22d9a2[_0xea46('0x23')],qs[_0xea46('0x28')](_0x5c5eed[_0xea46('0x20')][_0xea46('0x28')]));_0x4bd3f2['attributes']=_0x4bd3f2[_0xea46('0x27')]['length']?_0x4bd3f2[_0xea46('0x27')]:_0x22d9a2[_0xea46('0x23')];if(!_0x5c5eed[_0xea46('0x20')]['hasOwnProperty'](_0xea46('0x3b'))){_0x4bd3f2[_0xea46('0xf')]=qs[_0xea46('0xf')](_0x5c5eed[_0xea46('0x20')]['limit']);_0x4bd3f2['offset']=qs[_0xea46('0x10')](_0x5c5eed[_0xea46('0x20')]['offset']);}_0x4bd3f2[_0xea46('0x3c')]=qs['sort'](_0x5c5eed[_0xea46('0x20')][_0xea46('0x3d')]);_0x4bd3f2[_0xea46('0x1d')]=qs[_0xea46('0x25')](_[_0xea46('0x3e')](_0x5c5eed[_0xea46('0x20')],_0x22d9a2[_0xea46('0x25')]));_0x4bd3f2['where']['FaxQueueId']=_0x52f134['id'];if(_0x5c5eed[_0xea46('0x20')]['filter']){_0x4bd3f2[_0xea46('0x1d')]=_[_0xea46('0x2b')](_0x4bd3f2[_0xea46('0x1d')],{'$or':_['map'](_0x4bd3f2[_0xea46('0x27')],function(_0x4fcd7b){var _0xc12018={};_0xc12018[_0x4fcd7b]={'$like':'%'+_0x5c5eed[_0xea46('0x20')]['filter']+'%'};return _0xc12018;})});}_0x4bd3f2=_['merge']({},_0x4bd3f2,_0x5c5eed[_0xea46('0x2c')]);return db[_0xea46('0x3a')][_0xea46('0x3f')](_0x4bd3f2);}})['then'](function(_0x287a41){if(_0x287a41){return db['User'][_0xea46('0x40')]({'where':{'id':_['map'](_0x287a41,_0xea46('0x41')),'role':_0xea46('0x42')},'attributes':['id',_0xea46('0x18'),_0xea46('0x43'),_0xea46('0x44'),'createdAt']});}})[_0xea46('0x13')](function(_0x2659bd){if(_0x2659bd){return{'count':_0x2659bd[_0xea46('0x11')],'rows':_['map'](_0x2659bd['rows'],function(_0x3f6a07){return{'membername':_0x3f6a07[_0xea46('0x18')],'UserId':_0x3f6a07['id'],'queue_name':_0x18bcbf[_0xea46('0x18')],'FaxQueueId':_0x18bcbf['id'],'interface':util[_0xea46('0x45')](_0xea46('0x46'),_0xea46('0x47'),_0x3f6a07[_0xea46('0x18')]),'penalty':0x0,'paused':_0x3f6a07[_0xea46('0x43')],'createdAt':_0x3f6a07[_0xea46('0x48')],'updatedAt':_0x3f6a07[_0xea46('0x44')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea46('0x13')](respondWithFilteredResult(_0x172db7,_0x4bd3f2))[_0xea46('0x2e')](handleError(_0x172db7,null));};exports[_0xea46('0x49')]=function(_0x219776,_0x38f80e){var _0x487b4e={};var _0x375875={};var _0x2c248c;var _0x397e98;return db[_0xea46('0x1e')]['findOne']({'where':{'id':_0x219776[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x38f80e,null))['then'](function(_0x17b3ab){if(_0x17b3ab){_0x2c248c=_0x17b3ab;_0x375875[_0xea46('0x23')]=_['keys'](db[_0xea46('0x4a')][_0xea46('0x1a')]);_0x375875[_0xea46('0x20')]=_['keys'](_0x219776[_0xea46('0x20')]);_0x375875[_0xea46('0x25')]=_[_0xea46('0x26')](_0x375875['model'],_0x375875['query']);_0x487b4e['attributes']=_[_0xea46('0x26')](_0x375875[_0xea46('0x23')],qs[_0xea46('0x28')](_0x219776[_0xea46('0x20')][_0xea46('0x28')]));_0x487b4e['attributes']=_0x487b4e[_0xea46('0x27')]['length']?_0x487b4e[_0xea46('0x27')]:_0x375875[_0xea46('0x23')];_0x487b4e[_0xea46('0x3c')]=qs['sort'](_0x219776['query'][_0xea46('0x3d')]);_0x487b4e[_0xea46('0x1d')]=qs['filters'](_[_0xea46('0x3e')](_0x219776[_0xea46('0x20')],_0x375875[_0xea46('0x25')]));if(_0x219776[_0xea46('0x20')][_0xea46('0x4b')]){_0x487b4e['where']=_[_0xea46('0x2b')](_0x487b4e[_0xea46('0x1d')],{'$or':_[_0xea46('0x4c')](_0x487b4e[_0xea46('0x27')],function(_0x2b85ee){var _0xd13bb7={};_0xd13bb7[_0x2b85ee]={'$like':'%'+_0x219776[_0xea46('0x20')][_0xea46('0x4b')]+'%'};return _0xd13bb7;})});}_0x487b4e=_['merge']({},_0x487b4e,_0x219776[_0xea46('0x2c')]);return _0x2c248c[_0xea46('0x49')](_0x487b4e);}})[_0xea46('0x13')](function(_0x7f99b2){if(_0x7f99b2){_0x397e98=_0x7f99b2[_0xea46('0x29')];if(!_0x219776[_0xea46('0x20')][_0xea46('0x4d')]('nolimit')){_0x487b4e['limit']=qs[_0xea46('0xf')](_0x219776[_0xea46('0x20')][_0xea46('0xf')]);_0x487b4e[_0xea46('0x10')]=qs[_0xea46('0x10')](_0x219776[_0xea46('0x20')][_0xea46('0x10')]);}return _0x2c248c[_0xea46('0x49')](_0x487b4e);}})[_0xea46('0x13')](function(_0x4edb04){if(_0x4edb04){return _0x4edb04?{'count':_0x397e98,'rows':_0x4edb04}:null;}})[_0xea46('0x13')](respondWithResult(_0x38f80e,null))['catch'](handleError(_0x38f80e,null));};exports[_0xea46('0x4e')]=function(_0x7fbb17,_0x2f36a1){var _0x3a4709=_0x7fbb17['body'][_0xea46('0x4f')];return db[_0xea46('0x4a')][_0xea46('0x3f')]({'where':{'id':_0x3a4709},'attributes':['id'],'include':[{'model':db[_0xea46('0x50')],'as':'Agents','attributes':['id',_0xea46('0x18'),_0xea46('0x51'),_0xea46('0x52'),_0xea46('0x53')],'raw':!![]}]})['then'](function(_0x427f12){if(_0x427f12){var _0x137bf5=_['flatMap'](_0x427f12,function(_0x574f62){var _0x32a9da=_0x574f62[_0xea46('0x31')]({'plain':!![]});return _0x32a9da[_0xea46('0x54')];});return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x7fbb17[_0xea46('0x22')]['id']}})[_0xea46('0x13')](function(_0xd62207){return db[_0xea46('0x55')][_0xea46('0x56')](function(_0xbafd55){return _0xd62207[_0xea46('0x4e')](_0x3a4709,{'transaction':_0xbafd55})[_0xea46('0x13')](function(){return BPromise['each'](_0x137bf5,function(_0x5fe06e){return db[_0xea46('0x3a')]['findOrCreate']({'where':{'UserId':_0x5fe06e['id'],'FaxQueueId':_0x7fbb17[_0xea46('0x22')]['id']},'transaction':_0xbafd55});});})[_0xea46('0x13')](function(){_0x137bf5[_0xea46('0x57')](function(_0x407f59){socket['emit'](_0xea46('0x58'),{'UserId':_0x407f59['id'],'FaxQueueId':_0xd62207['id']});});});});});}})['then'](respondWithStatusCode(_0x2f36a1,null))[_0xea46('0x2e')](handleError(_0x2f36a1,null));};exports[_0xea46('0x59')]=function(_0x2091aa,_0x199c97){return db['Team'][_0xea46('0x3f')]({'where':{'id':_0x2091aa['query'][_0xea46('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xea46('0x50')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea46('0x13')](handleEntityNotFound(_0x199c97,null))[_0xea46('0x13')](function(_0x523a2a){var _0xfb75fb=_[_0xea46('0x4c')](_0x523a2a,'id');var _0x5303f2=[];var _0x5e7a2c=[];var _0x47c40b=squel['select']();_0x47c40b[_0xea46('0x5a')](_0xea46('0x5b'))[_0xea46('0x5c')](_0xea46('0x5d'),'tq')[_0xea46('0x5e')](_0xea46('0x5f'),'ut',_0xea46('0x60'))[_0xea46('0x1d')]('FaxQueueId\x20=\x20?',_0x2091aa[_0xea46('0x22')]['id']);for(var _0x3e9151=0x0;_0x3e9151<_0x523a2a[_0xea46('0x29')];_0x3e9151+=0x1){let _0x182cc9=_0x523a2a[_0x3e9151];for(var _0x20875f=0x0;_0x20875f<_0x182cc9['Agents']['length'];_0x20875f+=0x1){let _0x29136d=_0x182cc9[_0xea46('0x54')][_0x20875f];var _0x3b4b90=_0x47c40b[_0xea46('0x61')]();_0x3b4b90[_0xea46('0x1d')]('ut.UserId\x20=\x20?',_0x29136d['id']);_0x5e7a2c[_0xea46('0x62')](db[_0xea46('0x55')]['query'](_0x3b4b90['toString'](),{'type':db[_0xea46('0x55')][_0xea46('0x63')][_0xea46('0x64')]})[_0xea46('0x13')](function(_0x354ff5){if(_0x354ff5['length']===0x1){return _0x29136d['id'];}else{var _0x299a48=_['every'](_[_0xea46('0x4c')](_0x354ff5,_0xea46('0x65')),function(_0x867af8){return _[_0xea46('0x66')](_0xfb75fb,_0x867af8);});if(_0x299a48){return _0x29136d['id'];}}}));}}return BPromise['all'](_0x5e7a2c)[_0xea46('0x13')](function(_0x35e967){_0x5303f2=_(_0x5303f2)[_0xea46('0x67')](_0x35e967)[_0xea46('0x68')]()[_0xea46('0x69')]();return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x2091aa[_0xea46('0x22')]['id']}})[_0xea46('0x13')](function(_0x59b475){return db[_0xea46('0x55')][_0xea46('0x56')](function(_0x4ea522){return _0x59b475[_0xea46('0x59')](_0x2091aa[_0xea46('0x20')][_0xea46('0x4f')],{'transaction':_0x4ea522})[_0xea46('0x13')](function(){if(!_['isEmpty'](_0x5303f2)){return _0x59b475[_0xea46('0x6a')](_0x5303f2,{'transaction':_0x4ea522});}})[_0xea46('0x13')](function(){_0x5303f2['forEach'](function(_0x5e477d){socket[_0xea46('0x6b')](_0xea46('0x6c'),{'UserId':_0x5e477d,'FaxQueueId':_0x59b475['id']});});});});});});})[_0xea46('0x13')](respondWithStatusCode(_0x199c97,null))[_0xea46('0x2e')](handleError(_0x199c97,null));};exports[_0xea46('0x6d')]=function(_0x4799fe,_0x218253){return db[_0xea46('0x1e')]['find']({'where':{'id':_0x4799fe[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x218253,null))[_0xea46('0x13')](function(_0x4e2c45){if(_0x4e2c45){return _0x4e2c45[_0xea46('0x6d')](_0x4799fe[_0xea46('0x30')][_0xea46('0x4f')],_[_0xea46('0x6e')](_0x4799fe['body'],[_0xea46('0x4f'),'id'])||{})[_0xea46('0x6f')](function(_0x2aaf72){for(var _0x20c8a3=0x0;_0x20c8a3<_0x4799fe['body'][_0xea46('0x4f')]['length'];_0x20c8a3+=0x1){socket[_0xea46('0x6b')](_0xea46('0x58'),{'UserId':Number(_0x4799fe[_0xea46('0x30')][_0xea46('0x4f')][_0x20c8a3]),'FaxQueueId':Number(_0x4799fe[_0xea46('0x22')]['id'])});}return _0x2aaf72;});}})[_0xea46('0x13')](respondWithResult(_0x218253,null))[_0xea46('0x2e')](handleError(_0x218253,null));};exports['removeAgents']=function(_0x33f5a3,_0x45a97d){return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x33f5a3['params']['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x45a97d,null))['then'](function(_0x20b4bf){if(_0x20b4bf){return _0x20b4bf['removeAgents'](_0x33f5a3['query'][_0xea46('0x4f')])[_0xea46('0x13')](function(){if(_[_0xea46('0x70')](_0x33f5a3[_0xea46('0x20')][_0xea46('0x4f')])){for(var _0x4db97e=0x0;_0x4db97e<_0x33f5a3[_0xea46('0x20')][_0xea46('0x4f')][_0xea46('0x29')];_0x4db97e+=0x1){socket[_0xea46('0x6b')](_0xea46('0x6c'),{'UserId':Number(_0x33f5a3[_0xea46('0x20')]['ids'][_0x4db97e]),'FaxQueueId':Number(_0x33f5a3[_0xea46('0x22')]['id'])});}}else{socket[_0xea46('0x6b')]('userFaxQueue:remove',{'UserId':Number(_0x33f5a3[_0xea46('0x20')]['ids']),'FaxQueueId':Number(_0x33f5a3[_0xea46('0x22')]['id'])});}});}})[_0xea46('0x13')](respondWithStatusCode(_0x45a97d,null))[_0xea46('0x2e')](handleError(_0x45a97d,null));};exports[_0xea46('0x71')]=function(_0x3a8e83,_0x39c6ae){var _0x5e4e96={};var _0x5f0cbc={};var _0x4c5c79;var _0x548ca1;return db[_0xea46('0x1e')]['findOne']({'where':{'id':_0x3a8e83[_0xea46('0x22')]['id']}})['then'](handleEntityNotFound(_0x39c6ae,null))[_0xea46('0x13')](function(_0x38e1ef){if(_0x38e1ef){_0x4c5c79=_0x38e1ef;_0x5f0cbc['model']=_[_0xea46('0x24')](db[_0xea46('0x50')]['rawAttributes']);_0x5f0cbc[_0xea46('0x20')]=_[_0xea46('0x24')](_0x3a8e83[_0xea46('0x20')]);_0x5f0cbc[_0xea46('0x25')]=_[_0xea46('0x26')](_0x5f0cbc[_0xea46('0x23')],_0x5f0cbc[_0xea46('0x20')]);_0x5e4e96[_0xea46('0x27')]=_[_0xea46('0x26')](_0x5f0cbc[_0xea46('0x23')],qs[_0xea46('0x28')](_0x3a8e83['query']['fields']));_0x5e4e96[_0xea46('0x27')]=_0x5e4e96[_0xea46('0x27')]['length']?_0x5e4e96['attributes']:_0x5f0cbc['model'];_0x5e4e96['order']=qs[_0xea46('0x3d')](_0x3a8e83[_0xea46('0x20')][_0xea46('0x3d')]);_0x5e4e96[_0xea46('0x1d')]=qs['filters'](_[_0xea46('0x3e')](_0x3a8e83[_0xea46('0x20')],_0x5f0cbc[_0xea46('0x25')]));if(_0x3a8e83[_0xea46('0x20')][_0xea46('0x4b')]){_0x5e4e96[_0xea46('0x1d')]=_[_0xea46('0x2b')](_0x5e4e96[_0xea46('0x1d')],{'$or':_['map'](_0x5e4e96[_0xea46('0x27')],function(_0xe92069){var _0x3b4067={};_0x3b4067[_0xe92069]={'$like':'%'+_0x3a8e83[_0xea46('0x20')][_0xea46('0x4b')]+'%'};return _0x3b4067;})});}_0x5e4e96=_[_0xea46('0x2b')]({},_0x5e4e96,_0x3a8e83[_0xea46('0x2c')]);return _0x4c5c79[_0xea46('0x71')](_0x5e4e96);}})[_0xea46('0x13')](function(_0x2cebac){if(_0x2cebac){_0x548ca1=_0x2cebac['length'];if(!_0x3a8e83[_0xea46('0x20')][_0xea46('0x4d')](_0xea46('0x3b'))){_0x5e4e96[_0xea46('0xf')]=qs[_0xea46('0xf')](_0x3a8e83[_0xea46('0x20')][_0xea46('0xf')]);_0x5e4e96[_0xea46('0x10')]=qs['offset'](_0x3a8e83[_0xea46('0x20')][_0xea46('0x10')]);}return _0x4c5c79['getAgents'](_0x5e4e96);}})[_0xea46('0x13')](function(_0x4df90c){if(_0x4df90c){return _0x4df90c?{'count':_0x548ca1,'rows':_0x4df90c}:null;}})[_0xea46('0x13')](respondWithResult(_0x39c6ae,null))['catch'](handleError(_0x39c6ae,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 599a755..6cffa39 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 _0x43aa=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update'];(function(_0x42f3e4,_0x2646fd){var _0x1d7aa6=function(_0x4a721d){while(--_0x4a721d){_0x42f3e4['push'](_0x42f3e4['shift']());}};_0x1d7aa6(++_0x2646fd);}(_0x43aa,0xc0));var _0xa43a=function(_0x33cc3f,_0x1661f1){_0x33cc3f=_0x33cc3f-0x0;var _0x4fdc9c=_0x43aa[_0x33cc3f];return _0x4fdc9c;};'use strict';var EventEmitter=require(_0xa43a('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa43a('0x1')](0x0);var events={'afterCreate':_0xa43a('0x2'),'afterUpdate':_0xa43a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2edfb3){return function(_0x5ca8dd,_0x1afdeb,_0x1fc4a7){FaxQueueEvents['emit'](_0x2edfb3+':'+_0x5ca8dd['id'],_0x5ca8dd);FaxQueueEvents[_0xa43a('0x4')](_0x2edfb3,_0x5ca8dd);_0x1fc4a7(null);};}for(var e in events){if(events[_0xa43a('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xa43a('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xa39b=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x419953,_0x37374c){var _0x176a18=function(_0x656d3f){while(--_0x656d3f){_0x419953['push'](_0x419953['shift']());}};_0x176a18(++_0x37374c);}(_0xa39b,0x18b));var _0xba39=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa39b[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0xba39('0x0'));var FaxQueue=require(_0xba39('0x1'))['db'][_0xba39('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xba39('0x3')](0x0);var events={'afterCreate':_0xba39('0x4'),'afterUpdate':_0xba39('0x5'),'afterDestroy':_0xba39('0x6')};function emitEvent(_0x2fbe49){return function(_0x2ccee1,_0x53c270,_0x4ccd94){FaxQueueEvents[_0xba39('0x7')](_0x2fbe49+':'+_0x2ccee1['id'],_0x2ccee1);FaxQueueEvents[_0xba39('0x7')](_0x2fbe49,_0x2ccee1);_0x4ccd94(null);};}for(var e in events){if(events[_0xba39('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xba39('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 10ece18..52cfd62 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 _0x63bd=['request-promise','rimraf','../../config/environment','define','fax_queues','lodash','util','../../config/logger','api'];(function(_0x1eefed,_0x3f8717){var _0x37f295=function(_0x1d213f){while(--_0x1d213f){_0x1eefed['push'](_0x1eefed['shift']());}};_0x37f295(++_0x3f8717);}(_0x63bd,0x83));var _0xd63b=function(_0x479aa9,_0x58e131){_0x479aa9=_0x479aa9-0x0;var _0x3396d3=_0x63bd[_0x479aa9];return _0x3396d3;};'use strict';var _=require(_0xd63b('0x0'));var util=require(_0xd63b('0x1'));var logger=require(_0xd63b('0x2'))(_0xd63b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd63b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd63b('0x5'));var config=require(_0xd63b('0x6'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x469927,_0x38f251){return _0x469927[_0xd63b('0x7')]('FaxQueue',attributes,{'tableName':_0xd63b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98c7=['fax_queues','lodash','util','../../config/logger','api','moment','rimraf','./faxQueue.attributes','define','FaxQueue'];(function(_0x34efa6,_0x343fe2){var _0x469490=function(_0xc1d725){while(--_0xc1d725){_0x34efa6['push'](_0x34efa6['shift']());}};_0x469490(++_0x343fe2);}(_0x98c7,0x15f));var _0x798c=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x98c7[_0x4e0b8c];return _0x633ecc;};'use strict';var _=require(_0x798c('0x0'));var util=require(_0x798c('0x1'));var logger=require(_0x798c('0x2'))(_0x798c('0x3'));var moment=require(_0x798c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x798c('0x5'));var config=require('../../config/environment');var attributes=require(_0x798c('0x6'));module['exports']=function(_0x2879b6,_0x32ee1d){return _0x2879b6[_0x798c('0x7')](_0x798c('0x8'),attributes,{'tableName':_0x798c('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 365280d..7744fbc 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 _0xeafd=['localhost','socket.io-emitter','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','attributes','limit','include','map','info','GetFaxQueue','debug','ShowFaxQueue','FaxQueue','find','where','model','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x41f29a,_0x11c7ec){var _0x326489=function(_0x2a2a9a){while(--_0x2a2a9a){_0x41f29a['push'](_0x41f29a['shift']());}};_0x326489(++_0x11c7ec);}(_0xeafd,0x111));var _0xdeaf=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xeafd[_0x24259d];return _0x5a701;};'use strict';var _=require(_0xdeaf('0x0'));var util=require(_0xdeaf('0x1'));var moment=require(_0xdeaf('0x2'));var BPromise=require(_0xdeaf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdeaf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeaf('0x5'));var logger=require(_0xdeaf('0x6'))(_0xdeaf('0x7'));var config=require(_0xdeaf('0x8'));var jayson=require(_0xdeaf('0x9'));var client=jayson[_0xdeaf('0xa')][_0xdeaf('0xb')]({'port':0x232a});config[_0xdeaf('0xc')]=_[_0xdeaf('0xd')](config[_0xdeaf('0xc')],{'host':_0xdeaf('0xe'),'port':0x18eb});var socket=require(_0xdeaf('0xf'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xdeaf('0x10')](socket);function respondWithRpcPromise(_0x44af33,_0x194d81,_0x4c269d){return new BPromise(function(_0x54abca,_0x1065a5){return client[_0xdeaf('0x11')](_0x44af33,_0x4c269d)[_0xdeaf('0x12')](function(_0x529142){logger['info'](_0xdeaf('0x13'),_0x194d81,_0xdeaf('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x194d81,_0xdeaf('0x14'),JSON[_0xdeaf('0x15')](_0x529142));if(_0x529142[_0xdeaf('0x16')]){if(_0x529142[_0xdeaf('0x16')]['code']===0x1f4){logger[_0xdeaf('0x16')]('FaxQueue,\x20%s,\x20%s',_0x194d81,_0x529142['error'][_0xdeaf('0x17')]);return _0x1065a5(_0x529142[_0xdeaf('0x16')][_0xdeaf('0x17')]);}logger['error'](_0xdeaf('0x13'),_0x194d81,_0x529142[_0xdeaf('0x16')][_0xdeaf('0x17')]);return _0x54abca(_0x529142[_0xdeaf('0x16')][_0xdeaf('0x17')]);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x194d81,_0xdeaf('0x14'));_0x54abca(_0x529142[_0xdeaf('0x18')][_0xdeaf('0x17')]);}})[_0xdeaf('0x19')](function(_0x2ed304){logger['error'](_0xdeaf('0x13'),_0x194d81,_0x2ed304);_0x1065a5(_0x2ed304);});});}exports['GetFaxQueue']=function(_0x15a7d2){var _0x393408=this;return new Promise(function(_0x9dbfef,_0x53b7fc){return db['FaxQueue'][_0xdeaf('0x1a')]({'raw':_0x15a7d2[_0xdeaf('0x1b')]?_0x15a7d2[_0xdeaf('0x1b')][_0xdeaf('0x1c')]===undefined?!![]:![]:!![],'where':_0x15a7d2['options']?_0x15a7d2[_0xdeaf('0x1b')]['where']||null:null,'attributes':_0x15a7d2[_0xdeaf('0x1b')]?_0x15a7d2[_0xdeaf('0x1b')][_0xdeaf('0x1d')]||null:null,'limit':_0x15a7d2['options']?_0x15a7d2[_0xdeaf('0x1b')][_0xdeaf('0x1e')]||null:null,'include':_0x15a7d2[_0xdeaf('0x1b')]?_0x15a7d2[_0xdeaf('0x1b')][_0xdeaf('0x1f')]?_['map'](_0x15a7d2['options']['include'],function(_0x6a7cf6){return{'model':db[_0x6a7cf6['model']],'as':_0x6a7cf6['as'],'attributes':_0x6a7cf6[_0xdeaf('0x1d')],'include':_0x6a7cf6[_0xdeaf('0x1f')]?_['map'](_0x6a7cf6[_0xdeaf('0x1f')],function(_0x240d0b){return{'model':db[_0x240d0b['model']],'as':_0x240d0b['as'],'attributes':_0x240d0b['attributes'],'include':_0x240d0b[_0xdeaf('0x1f')]?_[_0xdeaf('0x20')](_0x240d0b['include'],function(_0x5266ad){return{'model':db[_0x5266ad['model']],'as':_0x5266ad['as'],'attributes':_0x5266ad[_0xdeaf('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7d95b3){logger[_0xdeaf('0x21')](_0xdeaf('0x22'),_0x15a7d2);logger[_0xdeaf('0x23')](_0xdeaf('0x22'),_0x15a7d2,JSON[_0xdeaf('0x15')](_0x7d95b3));_0x9dbfef(_0x7d95b3);})[_0xdeaf('0x19')](function(_0x35aa0c){logger[_0xdeaf('0x16')](_0xdeaf('0x22'),_0x35aa0c['message'],_0x15a7d2);_0x53b7fc(_0x393408[_0xdeaf('0x16')](0x1f4,_0x35aa0c['message']));});});};exports[_0xdeaf('0x24')]=function(_0x5f3189){var _0x5e6e95=this;return new Promise(function(_0x4fd3c9,_0x56b529){return db[_0xdeaf('0x25')][_0xdeaf('0x26')]({'raw':_0x5f3189[_0xdeaf('0x1b')]?_0x5f3189[_0xdeaf('0x1b')][_0xdeaf('0x1c')]===undefined?!![]:![]:!![],'where':_0x5f3189[_0xdeaf('0x1b')]?_0x5f3189['options'][_0xdeaf('0x27')]||null:null,'attributes':_0x5f3189[_0xdeaf('0x1b')]?_0x5f3189[_0xdeaf('0x1b')][_0xdeaf('0x1d')]||null:null,'include':_0x5f3189[_0xdeaf('0x1b')]?_0x5f3189['options']['include']?_[_0xdeaf('0x20')](_0x5f3189[_0xdeaf('0x1b')]['include'],function(_0x19cce9){return{'model':db[_0x19cce9[_0xdeaf('0x28')]],'as':_0x19cce9['as'],'attributes':_0x19cce9['attributes'],'include':_0x19cce9[_0xdeaf('0x1f')]?_[_0xdeaf('0x20')](_0x19cce9[_0xdeaf('0x1f')],function(_0x21ed25){return{'model':db[_0x21ed25[_0xdeaf('0x28')]],'as':_0x21ed25['as'],'attributes':_0x21ed25[_0xdeaf('0x1d')],'include':_0x21ed25[_0xdeaf('0x1f')]?_[_0xdeaf('0x20')](_0x21ed25[_0xdeaf('0x1f')],function(_0x5c7d81){return{'model':db[_0x5c7d81[_0xdeaf('0x28')]],'as':_0x5c7d81['as'],'attributes':_0x5c7d81[_0xdeaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdeaf('0x12')](function(_0x584b80){logger['info'](_0xdeaf('0x24'),_0x5f3189);logger[_0xdeaf('0x23')]('ShowFaxQueue',_0x5f3189,JSON[_0xdeaf('0x15')](_0x584b80));_0x4fd3c9(_0x584b80);})['catch'](function(_0x48159f){logger[_0xdeaf('0x16')](_0xdeaf('0x24'),_0x48159f[_0xdeaf('0x17')],_0x5f3189);_0x56b529(_0x5e6e95[_0xdeaf('0x16')](0x1f4,_0x48159f[_0xdeaf('0x17')]));});});}; \ No newline at end of file +var _0x752d=['rpc','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFaxQueue','FaxQueue','options','raw','attributes','include','map','model','debug','where','ShowFaxQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x752d,0xfc));var _0xd752=function(_0x5da40d,_0x37e67f){_0x5da40d=_0x5da40d-0x0;var _0x568a5a=_0x752d[_0x5da40d];return _0x568a5a;};'use strict';var _=require(_0xd752('0x0'));var util=require(_0xd752('0x1'));var moment=require(_0xd752('0x2'));var BPromise=require(_0xd752('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd752('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd752('0x5'));var logger=require(_0xd752('0x6'))(_0xd752('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd752('0x8')][_0xd752('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd752('0xa')],{'host':_0xd752('0xb'),'port':0x18eb});var socket=require(_0xd752('0xc'))(new Redis(config[_0xd752('0xa')]));require(_0xd752('0xd'))[_0xd752('0xe')](socket);function respondWithRpcPromise(_0x28d169,_0x5b146e,_0x3f935e){return new BPromise(function(_0xae8b9,_0x1e23f1){return client[_0xd752('0xf')](_0x28d169,_0x3f935e)[_0xd752('0x10')](function(_0x1b201a){logger['info'](_0xd752('0x11'),_0x5b146e,_0xd752('0x12'));logger['debug'](_0xd752('0x13'),_0x5b146e,_0xd752('0x12'),JSON[_0xd752('0x14')](_0x1b201a));if(_0x1b201a['error']){if(_0x1b201a[_0xd752('0x15')]['code']===0x1f4){logger[_0xd752('0x15')](_0xd752('0x11'),_0x5b146e,_0x1b201a[_0xd752('0x15')][_0xd752('0x16')]);return _0x1e23f1(_0x1b201a[_0xd752('0x15')]['message']);}logger['error'](_0xd752('0x11'),_0x5b146e,_0x1b201a[_0xd752('0x15')]['message']);return _0xae8b9(_0x1b201a[_0xd752('0x15')][_0xd752('0x16')]);}else{logger[_0xd752('0x17')]('FaxQueue,\x20%s,\x20%s',_0x5b146e,'request\x20sent');_0xae8b9(_0x1b201a[_0xd752('0x18')][_0xd752('0x16')]);}})[_0xd752('0x19')](function(_0x35500a){logger['error']('FaxQueue,\x20%s,\x20%s',_0x5b146e,_0x35500a);_0x1e23f1(_0x35500a);});});}exports[_0xd752('0x1a')]=function(_0x20f24f){var _0x59e13e=this;return new Promise(function(_0x28b26b,_0x1e4911){return db[_0xd752('0x1b')]['findAll']({'raw':_0x20f24f[_0xd752('0x1c')]?_0x20f24f[_0xd752('0x1c')][_0xd752('0x1d')]===undefined?!![]:![]:!![],'where':_0x20f24f[_0xd752('0x1c')]?_0x20f24f[_0xd752('0x1c')]['where']||null:null,'attributes':_0x20f24f[_0xd752('0x1c')]?_0x20f24f[_0xd752('0x1c')][_0xd752('0x1e')]||null:null,'limit':_0x20f24f['options']?_0x20f24f[_0xd752('0x1c')]['limit']||null:null,'include':_0x20f24f['options']?_0x20f24f[_0xd752('0x1c')][_0xd752('0x1f')]?_[_0xd752('0x20')](_0x20f24f[_0xd752('0x1c')]['include'],function(_0x30c200){return{'model':db[_0x30c200[_0xd752('0x21')]],'as':_0x30c200['as'],'attributes':_0x30c200['attributes'],'include':_0x30c200[_0xd752('0x1f')]?_['map'](_0x30c200[_0xd752('0x1f')],function(_0x570070){return{'model':db[_0x570070[_0xd752('0x21')]],'as':_0x570070['as'],'attributes':_0x570070[_0xd752('0x1e')],'include':_0x570070['include']?_[_0xd752('0x20')](_0x570070[_0xd752('0x1f')],function(_0x260fbb){return{'model':db[_0x260fbb[_0xd752('0x21')]],'as':_0x260fbb['as'],'attributes':_0x260fbb[_0xd752('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd752('0x10')](function(_0x5cdc24){logger[_0xd752('0x17')](_0xd752('0x1a'),_0x20f24f);logger[_0xd752('0x22')](_0xd752('0x1a'),_0x20f24f,JSON[_0xd752('0x14')](_0x5cdc24));_0x28b26b(_0x5cdc24);})['catch'](function(_0x315369){logger['error'](_0xd752('0x1a'),_0x315369['message'],_0x20f24f);_0x1e4911(_0x59e13e[_0xd752('0x15')](0x1f4,_0x315369[_0xd752('0x16')]));});});};exports['ShowFaxQueue']=function(_0x2eca90){var _0x3da0fa=this;return new Promise(function(_0x4c4cf6,_0x1ff764){return db[_0xd752('0x1b')]['find']({'raw':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x1d')]===undefined?!![]:![]:!![],'where':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x23')]||null:null,'attributes':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x1e')]||null:null,'include':_0x2eca90[_0xd752('0x1c')]?_0x2eca90[_0xd752('0x1c')][_0xd752('0x1f')]?_[_0xd752('0x20')](_0x2eca90[_0xd752('0x1c')]['include'],function(_0x3eaa3f){return{'model':db[_0x3eaa3f[_0xd752('0x21')]],'as':_0x3eaa3f['as'],'attributes':_0x3eaa3f[_0xd752('0x1e')],'include':_0x3eaa3f[_0xd752('0x1f')]?_[_0xd752('0x20')](_0x3eaa3f['include'],function(_0x3b1a62){return{'model':db[_0x3b1a62[_0xd752('0x21')]],'as':_0x3b1a62['as'],'attributes':_0x3b1a62[_0xd752('0x1e')],'include':_0x3b1a62['include']?_[_0xd752('0x20')](_0x3b1a62[_0xd752('0x1f')],function(_0x150a38){return{'model':db[_0x150a38['model']],'as':_0x150a38['as'],'attributes':_0x150a38[_0xd752('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd752('0x10')](function(_0xfaedd6){logger[_0xd752('0x17')]('ShowFaxQueue',_0x2eca90);logger[_0xd752('0x22')](_0xd752('0x24'),_0x2eca90,JSON[_0xd752('0x14')](_0xfaedd6));_0x4c4cf6(_0xfaedd6);})[_0xd752('0x19')](function(_0x3d3694){logger[_0xd752('0x15')](_0xd752('0x24'),_0x3d3694[_0xd752('0x16')],_0x2eca90);_0x1ff764(_0x3da0fa[_0xd752('0x15')](0x1f4,_0x3d3694[_0xd752('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1c98e96..1874124 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 _0x7958=['register','length','faxQueue:','./faxQueue.events','save','remove','removeListener'];(function(_0x962de1,_0x361057){var _0x14085a=function(_0x220dae){while(--_0x220dae){_0x962de1['push'](_0x962de1['shift']());}};_0x14085a(++_0x361057);}(_0x7958,0x88));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x8795('0x0'));var events=[_0x8795('0x1'),_0x8795('0x2'),'update'];function createListener(_0xd7c663,_0x2c8f52){return function(_0x3d3b97){_0x2c8f52['emit'](_0xd7c663,_0x3d3b97);};}function removeListener(_0x3f9038,_0x2c0b67){return function(){FaxQueueEvents[_0x8795('0x3')](_0x3f9038,_0x2c0b67);};}exports[_0x8795('0x4')]=function(_0xe998eb){for(var _0x33466b=0x0,_0x31aafa=events[_0x8795('0x5')];_0x33466b<_0x31aafa;_0x33466b++){var _0x15245a=events[_0x33466b];var _0x2fcf69=createListener(_0x8795('0x6')+_0x15245a,_0xe998eb);FaxQueueEvents['on'](_0x15245a,_0x2fcf69);}}; \ No newline at end of file +var _0x1641=['register','length','faxQueue:','./faxQueue.events','save','remove','emit','removeListener'];(function(_0x5b4d27,_0x6145a4){var _0x5f429b=function(_0x16fbe6){while(--_0x16fbe6){_0x5b4d27['push'](_0x5b4d27['shift']());}};_0x5f429b(++_0x6145a4);}(_0x1641,0x153));var _0x1164=function(_0x50f177,_0x36c061){_0x50f177=_0x50f177-0x0;var _0x16da60=_0x1641[_0x50f177];return _0x16da60;};'use strict';var FaxQueueEvents=require(_0x1164('0x0'));var events=[_0x1164('0x1'),_0x1164('0x2'),'update'];function createListener(_0x9fcffe,_0x2ffaf6){return function(_0x1b8a72){_0x2ffaf6[_0x1164('0x3')](_0x9fcffe,_0x1b8a72);};}function removeListener(_0x27e41e,_0x281ac1){return function(){FaxQueueEvents[_0x1164('0x4')](_0x27e41e,_0x281ac1);};}exports[_0x1164('0x5')]=function(_0x3ad2f9){for(var _0x2b616c=0x0,_0x1f69d3=events[_0x1164('0x6')];_0x2b616c<_0x1f69d3;_0x2b616c++){var _0x3ab2b9=events[_0x2b616c];var _0xe3c4ec=createListener(_0x1164('0x7')+_0x3ab2b9,_0x3ad2f9);FaxQueueEvents['on'](_0x3ab2b9,_0xe3c4ec);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1276941..383e09c 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 _0x5e0e=['get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x54a024,_0x56ace9){var _0x35d9f0=function(_0x44c08a){while(--_0x44c08a){_0x54a024['push'](_0x54a024['shift']());}};_0x35d9f0(++_0x56ace9);}(_0x5e0e,0x89));var _0xe5e0=function(_0x4a57b0,_0x3ee928){_0x4a57b0=_0x4a57b0-0x0;var _0x5e82c8=_0x5e0e[_0x4a57b0];return _0x5e82c8;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5e0('0x7'));var controller=require('./faxQueue.controller');router[_0xe5e0('0x8')]('/',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xa')]);router[_0xe5e0('0x8')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller['describe']);router[_0xe5e0('0x8')](_0xe5e0('0xc'),auth['isAuthenticated'](),controller[_0xe5e0('0xd')]);router[_0xe5e0('0x8')](_0xe5e0('0xe'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xf')]);router[_0xe5e0('0x8')](_0xe5e0('0x10'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x11')]);router[_0xe5e0('0x8')](_0xe5e0('0x12'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x15')](_0xe5e0('0x10'),auth[_0xe5e0('0x9')](),controller['addTeams']);router[_0xe5e0('0x15')](_0xe5e0('0x12'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x16')]);router[_0xe5e0('0x17')](_0xe5e0('0xc'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x18')]);router[_0xe5e0('0x19')]('/:id',auth[_0xe5e0('0x9')](),controller['destroy']);router[_0xe5e0('0x19')]('/:id/teams',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x1a')]);router['delete'](_0xe5e0('0x12'),auth['isAuthenticated'](),controller[_0xe5e0('0x1b')]);module[_0xe5e0('0x1c')]=router; \ No newline at end of file +var _0x6c45=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout'];(function(_0xad3674,_0x4f92a6){var _0x4bb610=function(_0x3af295){while(--_0x3af295){_0xad3674['push'](_0xad3674['shift']());}};_0x4bb610(++_0x4f92a6);}(_0x6c45,0xb1));var _0x56c4=function(_0x4b14b7,_0x290d16){_0x4b14b7=_0x4b14b7-0x0;var _0x412314=_0x6c45[_0x4b14b7];return _0x412314;};'use strict';var multer=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var path=require('path');var timeout=require(_0x56c4('0x2'));var express=require(_0x56c4('0x3'));var router=express[_0x56c4('0x4')]();var fs_extra=require(_0x56c4('0x5'));var auth=require(_0x56c4('0x6'));var interaction=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var controller=require(_0x56c4('0x9'));router[_0x56c4('0xa')]('/',auth[_0x56c4('0xb')](),controller[_0x56c4('0xc')]);router[_0x56c4('0xa')](_0x56c4('0xd'),auth[_0x56c4('0xb')](),controller[_0x56c4('0xe')]);router[_0x56c4('0xa')](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x10')]);router[_0x56c4('0xa')]('/:id/members',auth[_0x56c4('0xb')](),controller[_0x56c4('0x11')]);router[_0x56c4('0xa')](_0x56c4('0x12'),auth['isAuthenticated'](),controller[_0x56c4('0x13')]);router[_0x56c4('0xa')](_0x56c4('0x14'),auth[_0x56c4('0xb')](),controller['getAgents']);router[_0x56c4('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x56c4('0x15')](_0x56c4('0x12'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x16')]);router[_0x56c4('0x15')]('/:id/users',auth[_0x56c4('0xb')](),controller[_0x56c4('0x17')]);router['put'](_0x56c4('0xf'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x18')]);router[_0x56c4('0x19')]('/:id',auth[_0x56c4('0xb')](),controller[_0x56c4('0x1a')]);router['delete'](_0x56c4('0x12'),auth[_0x56c4('0xb')](),controller[_0x56c4('0x1b')]);router[_0x56c4('0x19')]('/:id/users',auth[_0x56c4('0xb')](),controller[_0x56c4('0x1c')]);module[_0x56c4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ba24014..1783da4 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 _0x6799=['DATE','STRING'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x6799,0x1ed));var _0x9679=function(_0xfa15c3,_0x1d216a){_0xfa15c3=_0xfa15c3-0x0;var _0x1bdcea=_0x6799[_0xfa15c3];return _0x1bdcea;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9679('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x9679('0x0')]},'joinAt':{'type':Sequelize[_0x9679('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9679('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2888=['exports','STRING','DATE','moment','sequelize'];(function(_0x3b28a0,_0x12b276){var _0x3de84a=function(_0x17a826){while(--_0x17a826){_0x3b28a0['push'](_0x3b28a0['shift']());}};_0x3de84a(++_0x12b276);}(_0x2888,0x102));var _0x8288=function(_0x18b1d1,_0x47d888){_0x18b1d1=_0x18b1d1-0x0;var _0x5c5ba5=_0x2888[_0x18b1d1];return _0x5c5ba5;};'use strict';var moment=require(_0x8288('0x0'));var Sequelize=require(_0x8288('0x1'));module[_0x8288('0x2')]={'uniqueid':{'type':Sequelize[_0x8288('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8288('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8288('0x4')]},'acceptAt':{'type':Sequelize[_0x8288('0x4')]},'exitAt':{'type':Sequelize[_0x8288('0x4')]},'reason':{'type':Sequelize[_0x8288('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7820f9f..69b3a7c 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 _0xb11e=['ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','count','then','destroy','sendStatus','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0xc6b2ff,_0x1558d7){var _0x47f7a4=function(_0x1241f7){while(--_0x1241f7){_0xc6b2ff['push'](_0xc6b2ff['shift']());}};_0x47f7a4(++_0x1558d7);}(_0xb11e,0x7d));var _0xeb11=function(_0x34ca66,_0x42fa4d){_0x34ca66=_0x34ca66-0x0;var _0x450724=_0xb11e[_0x34ca66];return _0x450724;};'use strict';var emlformat=require(_0xeb11('0x0'));var rimraf=require(_0xeb11('0x1'));var zipdir=require(_0xeb11('0x2'));var jsonpatch=require(_0xeb11('0x3'));var rp=require(_0xeb11('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb11('0x5'));var util=require(_0xeb11('0x6'));var path=require(_0xeb11('0x7'));var sox=require(_0xeb11('0x8'));var csv=require('to-csv');var ejs=require(_0xeb11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb11('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb11('0xb'));var toCsv=require(_0xeb11('0xc'));var querystring=require(_0xeb11('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb11('0xe'));var authService=require(_0xeb11('0xf'));var qs=require(_0xeb11('0x10'));var as=require(_0xeb11('0x11'));var hardwareService=require(_0xeb11('0x12'));var logger=require(_0xeb11('0x13'))(_0xeb11('0x14'));var utils=require(_0xeb11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb11('0x16'));var db=require(_0xeb11('0x17'))['db'];function respondWithStatusCode(_0x15b1e4,_0x517962){_0x517962=_0x517962||0xcc;return function(_0x44b192){if(_0x44b192){return _0x15b1e4['sendStatus'](_0x517962);}return _0x15b1e4[_0xeb11('0x18')](_0x517962)['end']();};}function respondWithResult(_0x5d183d,_0x146cfa){_0x146cfa=_0x146cfa||0xc8;return function(_0x2e0d2c){if(_0x2e0d2c){return _0x5d183d[_0xeb11('0x18')](_0x146cfa)[_0xeb11('0x19')](_0x2e0d2c);}};}function respondWithFilteredResult(_0x4c6a67,_0x58d276){return function(_0x200730){if(_0x200730){var _0xd1a9bf=typeof _0x58d276[_0xeb11('0x1a')]==='undefined'&&typeof _0x58d276[_0xeb11('0x1b')]==='undefined';var _0x33a996=_0x200730[_0xeb11('0x1c')];var _0x139ff8=_0xd1a9bf?0x0:_0x58d276['offset'];var _0xf36770=_0xd1a9bf?_0x200730[_0xeb11('0x1c')]:_0x58d276['offset']+_0x58d276['limit'];var _0x1906db;if(_0xf36770>=_0x33a996){_0xf36770=_0x33a996;_0x1906db=0xc8;}else{_0x1906db=0xce;}_0x4c6a67[_0xeb11('0x18')](_0x1906db);return _0x4c6a67['set']('Content-Range',_0x139ff8+'-'+_0xf36770+'/'+_0x33a996)[_0xeb11('0x19')](_0x200730);}return null;};}function patchUpdates(_0xf057c){return function(_0x4dfe03){try{jsonpatch['apply'](_0x4dfe03,_0xf057c,!![]);}catch(_0x17af28){return BPromise['reject'](_0x17af28);}return _0x4dfe03['save']();};}function saveUpdates(_0x5779df,_0xeeb427){return function(_0x1caf4f){if(_0x1caf4f){return _0x1caf4f['update'](_0x5779df)[_0xeb11('0x1d')](function(_0x40a4cb){return _0x40a4cb;});}return null;};}function removeEntity(_0x53e48d,_0x1c526d){return function(_0x3b2e1a){if(_0x3b2e1a){return _0x3b2e1a[_0xeb11('0x1e')]()['then'](function(){_0x53e48d[_0xeb11('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b97b5,_0x8af064){return function(_0x2a4fc6){if(!_0x2a4fc6){_0x5b97b5[_0xeb11('0x1f')](0x194);}return _0x2a4fc6;};}function handleError(_0x59e3fb,_0x4d8cf8){_0x4d8cf8=_0x4d8cf8||0x1f4;return function(_0xca08dd){logger['error'](_0xca08dd[_0xeb11('0x20')]);if(_0xca08dd[_0xeb11('0x21')]){delete _0xca08dd[_0xeb11('0x21')];}_0x59e3fb[_0xeb11('0x18')](_0x4d8cf8)[_0xeb11('0x22')](_0xca08dd);};}exports['index']=function(_0x1d9bf7,_0x387fb7){var _0x4ee70a={},_0x104561={},_0x4bb5b8={'count':0x0,'rows':[]};var _0xa18410=_[_0xeb11('0x23')](db[_0xeb11('0x24')][_0xeb11('0x25')],function(_0x22e3d2){return{'name':_0x22e3d2[_0xeb11('0x26')],'type':_0x22e3d2[_0xeb11('0x27')][_0xeb11('0x28')]};});_0x104561[_0xeb11('0x29')]=_['map'](_0xa18410,_0xeb11('0x21'));_0x104561['query']=_[_0xeb11('0x2a')](_0x1d9bf7[_0xeb11('0x2b')]);_0x104561[_0xeb11('0x2c')]=_['intersection'](_0x104561['model'],_0x104561[_0xeb11('0x2b')]);_0x4ee70a[_0xeb11('0x2d')]=_[_0xeb11('0x2e')](_0x104561[_0xeb11('0x29')],qs['fields'](_0x1d9bf7[_0xeb11('0x2b')][_0xeb11('0x2f')]));_0x4ee70a[_0xeb11('0x2d')]=_0x4ee70a['attributes'][_0xeb11('0x30')]?_0x4ee70a['attributes']:_0x104561[_0xeb11('0x29')];if(!_0x1d9bf7['query'][_0xeb11('0x31')](_0xeb11('0x32'))){_0x4ee70a[_0xeb11('0x1b')]=qs[_0xeb11('0x1b')](_0x1d9bf7[_0xeb11('0x2b')][_0xeb11('0x1b')]);_0x4ee70a[_0xeb11('0x1a')]=qs['offset'](_0x1d9bf7[_0xeb11('0x2b')]['offset']);}_0x4ee70a[_0xeb11('0x33')]=qs['sort'](_0x1d9bf7[_0xeb11('0x2b')][_0xeb11('0x34')]);_0x4ee70a[_0xeb11('0x35')]=qs[_0xeb11('0x2c')](_['pick'](_0x1d9bf7[_0xeb11('0x2b')],_0x104561[_0xeb11('0x2c')]),_0xa18410);if(_0x1d9bf7[_0xeb11('0x2b')][_0xeb11('0x36')]){_0x4ee70a[_0xeb11('0x35')]=_[_0xeb11('0x37')](_0x4ee70a[_0xeb11('0x35')],{'$or':_[_0xeb11('0x23')](_0xa18410,function(_0x436aff){if(_0x436aff[_0xeb11('0x27')]!==_0xeb11('0x38')){var _0x25bc1a={};_0x25bc1a[_0x436aff[_0xeb11('0x21')]]={'$like':'%'+_0x1d9bf7[_0xeb11('0x2b')][_0xeb11('0x36')]+'%'};return _0x25bc1a;}})});}_0x4ee70a=_['merge']({},_0x4ee70a,_0x1d9bf7[_0xeb11('0x39')]);var _0x480bb9={'where':_0x4ee70a[_0xeb11('0x35')]};return db[_0xeb11('0x24')]['count'](_0x480bb9)['then'](function(_0x210dcc){_0x4bb5b8[_0xeb11('0x1c')]=_0x210dcc;if(_0x1d9bf7[_0xeb11('0x2b')][_0xeb11('0x3a')]){_0x4ee70a['include']=[{'all':!![]}];}return db[_0xeb11('0x24')][_0xeb11('0x3b')](_0x4ee70a);})[_0xeb11('0x1d')](function(_0xffa000){_0x4bb5b8['rows']=_0xffa000;return _0x4bb5b8;})['then'](respondWithFilteredResult(_0x387fb7,_0x4ee70a))[_0xeb11('0x3c')](handleError(_0x387fb7,null));};exports['show']=function(_0x7b589,_0xa750bf){var _0xfb67ee={'raw':!![],'where':{'id':_0x7b589[_0xeb11('0x3d')]['id']}},_0xdf32e7={};_0xdf32e7[_0xeb11('0x29')]=_['keys'](db['FaxQueueReport'][_0xeb11('0x25')]);_0xdf32e7[_0xeb11('0x2b')]=_[_0xeb11('0x2a')](_0x7b589['query']);_0xdf32e7[_0xeb11('0x2c')]=_[_0xeb11('0x2e')](_0xdf32e7[_0xeb11('0x29')],_0xdf32e7[_0xeb11('0x2b')]);_0xfb67ee[_0xeb11('0x2d')]=_['intersection'](_0xdf32e7['model'],qs[_0xeb11('0x2f')](_0x7b589['query'][_0xeb11('0x2f')]));_0xfb67ee[_0xeb11('0x2d')]=_0xfb67ee[_0xeb11('0x2d')][_0xeb11('0x30')]?_0xfb67ee[_0xeb11('0x2d')]:_0xdf32e7[_0xeb11('0x29')];if(_0x7b589['query'][_0xeb11('0x3a')]){_0xfb67ee[_0xeb11('0x3e')]=[{'all':!![]}];}_0xfb67ee=_[_0xeb11('0x37')]({},_0xfb67ee,_0x7b589[_0xeb11('0x39')]);return db[_0xeb11('0x24')]['find'](_0xfb67ee)[_0xeb11('0x1d')](handleEntityNotFound(_0xa750bf,null))[_0xeb11('0x1d')](respondWithResult(_0xa750bf,null))['catch'](handleError(_0xa750bf,null));};exports[_0xeb11('0x3f')]=function(_0x28d67a,_0x65e0ac){return db[_0xeb11('0x24')][_0xeb11('0x3f')](_0x28d67a['body'],{})['then'](respondWithResult(_0x65e0ac,0xc9))[_0xeb11('0x3c')](handleError(_0x65e0ac,null));};exports['update']=function(_0x355251,_0x2307ff){if(_0x355251[_0xeb11('0x40')]['id']){delete _0x355251[_0xeb11('0x40')]['id'];}return db['FaxQueueReport'][_0xeb11('0x41')]({'where':{'id':_0x355251[_0xeb11('0x3d')]['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x2307ff,null))[_0xeb11('0x1d')](saveUpdates(_0x355251[_0xeb11('0x40')],null))['then'](respondWithResult(_0x2307ff,null))['catch'](handleError(_0x2307ff,null));};exports['destroy']=function(_0x315f87,_0x371513){return db['FaxQueueReport']['find']({'where':{'id':_0x315f87[_0xeb11('0x3d')]['id']}})['then'](handleEntityNotFound(_0x371513,null))[_0xeb11('0x1d')](removeEntity(_0x371513,null))[_0xeb11('0x3c')](handleError(_0x371513,null));};exports[_0xeb11('0x42')]=function(_0x3e2134,_0x24ecdc){return db[_0xeb11('0x24')][_0xeb11('0x42')]()[_0xeb11('0x1d')](respondWithResult(_0x24ecdc,null))[_0xeb11('0x3c')](handleError(_0x24ecdc,null));}; \ No newline at end of file +var _0x3f59=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','find','create','body','catch','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x3f59,0x1b0));var _0x93f5=function(_0x595044,_0x983086){_0x595044=_0x595044-0x0;var _0x55f0be=_0x3f59[_0x595044];return _0x55f0be;};'use strict';var emlformat=require(_0x93f5('0x0'));var rimraf=require(_0x93f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93f5('0x2'));var rp=require(_0x93f5('0x3'));var moment=require(_0x93f5('0x4'));var BPromise=require(_0x93f5('0x5'));var Mustache=require(_0x93f5('0x6'));var util=require(_0x93f5('0x7'));var path=require(_0x93f5('0x8'));var sox=require(_0x93f5('0x9'));var csv=require(_0x93f5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93f5('0xb'));var squel=require(_0x93f5('0xc'));var crypto=require(_0x93f5('0xd'));var jsforce=require(_0x93f5('0xe'));var deskjs=require(_0x93f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93f5('0x10'));var qs=require(_0x93f5('0x11'));var as=require(_0x93f5('0x12'));var hardwareService=require(_0x93f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93f5('0x14'));var config=require(_0x93f5('0x15'));var licenseUtil=require(_0x93f5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x789645,_0x4ea7b4){_0x4ea7b4=_0x4ea7b4||0xcc;return function(_0x3e7e84){if(_0x3e7e84){return _0x789645[_0x93f5('0x17')](_0x4ea7b4);}return _0x789645[_0x93f5('0x18')](_0x4ea7b4)[_0x93f5('0x19')]();};}function respondWithResult(_0x3d85da,_0x45a275){_0x45a275=_0x45a275||0xc8;return function(_0x5d6001){if(_0x5d6001){return _0x3d85da[_0x93f5('0x18')](_0x45a275)[_0x93f5('0x1a')](_0x5d6001);}};}function respondWithFilteredResult(_0xe145df,_0x2ab5ce){return function(_0x316fb2){if(_0x316fb2){var _0x22bcd7=typeof _0x2ab5ce[_0x93f5('0x1b')]===_0x93f5('0x1c')&&typeof _0x2ab5ce[_0x93f5('0x1d')]===_0x93f5('0x1c');var _0x46a05d=_0x316fb2[_0x93f5('0x1e')];var _0x4df4ec=_0x22bcd7?0x0:_0x2ab5ce[_0x93f5('0x1b')];var _0x3180f2=_0x22bcd7?_0x316fb2[_0x93f5('0x1e')]:_0x2ab5ce[_0x93f5('0x1b')]+_0x2ab5ce[_0x93f5('0x1d')];var _0x569c0c;if(_0x3180f2>=_0x46a05d){_0x3180f2=_0x46a05d;_0x569c0c=0xc8;}else{_0x569c0c=0xce;}_0xe145df[_0x93f5('0x18')](_0x569c0c);return _0xe145df[_0x93f5('0x1f')](_0x93f5('0x20'),_0x4df4ec+'-'+_0x3180f2+'/'+_0x46a05d)[_0x93f5('0x1a')](_0x316fb2);}return null;};}function patchUpdates(_0x3fc4ab){return function(_0xb44720){try{jsonpatch[_0x93f5('0x21')](_0xb44720,_0x3fc4ab,!![]);}catch(_0x257aa8){return BPromise[_0x93f5('0x22')](_0x257aa8);}return _0xb44720[_0x93f5('0x23')]();};}function saveUpdates(_0x2ef296,_0xb59065){return function(_0x330869){if(_0x330869){return _0x330869['update'](_0x2ef296)[_0x93f5('0x24')](function(_0x27bde4){return _0x27bde4;});}return null;};}function removeEntity(_0x34f8ce,_0x3ffe51){return function(_0x365afd){if(_0x365afd){return _0x365afd[_0x93f5('0x25')]()['then'](function(){_0x34f8ce[_0x93f5('0x18')](0xcc)[_0x93f5('0x19')]();});}};}function handleEntityNotFound(_0x54955f,_0x107d91){return function(_0x43fad9){if(!_0x43fad9){_0x54955f['sendStatus'](0x194);}return _0x43fad9;};}function handleError(_0x5bb7d3,_0x403b45){_0x403b45=_0x403b45||0x1f4;return function(_0x11e86c){logger[_0x93f5('0x26')](_0x11e86c[_0x93f5('0x27')]);if(_0x11e86c['name']){delete _0x11e86c[_0x93f5('0x28')];}_0x5bb7d3['status'](_0x403b45)[_0x93f5('0x29')](_0x11e86c);};}exports[_0x93f5('0x2a')]=function(_0x56d867,_0x36d579){var _0x95e47e={},_0x136dc4={},_0x5e5cb5={'count':0x0,'rows':[]};var _0x3090a9=_['map'](db[_0x93f5('0x2b')]['rawAttributes'],function(_0x448b5a){return{'name':_0x448b5a[_0x93f5('0x2c')],'type':_0x448b5a['type'][_0x93f5('0x2d')]};});_0x136dc4[_0x93f5('0x2e')]=_[_0x93f5('0x2f')](_0x3090a9,_0x93f5('0x28'));_0x136dc4['query']=_[_0x93f5('0x30')](_0x56d867['query']);_0x136dc4[_0x93f5('0x31')]=_['intersection'](_0x136dc4[_0x93f5('0x2e')],_0x136dc4[_0x93f5('0x32')]);_0x95e47e[_0x93f5('0x33')]=_[_0x93f5('0x34')](_0x136dc4['model'],qs[_0x93f5('0x35')](_0x56d867[_0x93f5('0x32')][_0x93f5('0x35')]));_0x95e47e[_0x93f5('0x33')]=_0x95e47e['attributes'][_0x93f5('0x36')]?_0x95e47e['attributes']:_0x136dc4[_0x93f5('0x2e')];if(!_0x56d867[_0x93f5('0x32')][_0x93f5('0x37')](_0x93f5('0x38'))){_0x95e47e['limit']=qs[_0x93f5('0x1d')](_0x56d867['query'][_0x93f5('0x1d')]);_0x95e47e['offset']=qs['offset'](_0x56d867[_0x93f5('0x32')][_0x93f5('0x1b')]);}_0x95e47e[_0x93f5('0x39')]=qs['sort'](_0x56d867[_0x93f5('0x32')][_0x93f5('0x3a')]);_0x95e47e['where']=qs[_0x93f5('0x31')](_['pick'](_0x56d867[_0x93f5('0x32')],_0x136dc4['filters']),_0x3090a9);if(_0x56d867[_0x93f5('0x32')][_0x93f5('0x3b')]){_0x95e47e[_0x93f5('0x3c')]=_[_0x93f5('0x3d')](_0x95e47e[_0x93f5('0x3c')],{'$or':_['map'](_0x3090a9,function(_0x246f8e){if(_0x246f8e[_0x93f5('0x3e')]!==_0x93f5('0x3f')){var _0x2c7e9b={};_0x2c7e9b[_0x246f8e[_0x93f5('0x28')]]={'$like':'%'+_0x56d867[_0x93f5('0x32')]['filter']+'%'};return _0x2c7e9b;}})});}_0x95e47e=_[_0x93f5('0x3d')]({},_0x95e47e,_0x56d867[_0x93f5('0x40')]);var _0x421a4f={'where':_0x95e47e[_0x93f5('0x3c')]};return db[_0x93f5('0x2b')][_0x93f5('0x1e')](_0x421a4f)['then'](function(_0x2e86bd){_0x5e5cb5['count']=_0x2e86bd;if(_0x56d867[_0x93f5('0x32')][_0x93f5('0x41')]){_0x95e47e['include']=[{'all':!![]}];}return db[_0x93f5('0x2b')][_0x93f5('0x42')](_0x95e47e);})[_0x93f5('0x24')](function(_0x136e51){_0x5e5cb5['rows']=_0x136e51;return _0x5e5cb5;})[_0x93f5('0x24')](respondWithFilteredResult(_0x36d579,_0x95e47e))['catch'](handleError(_0x36d579,null));};exports[_0x93f5('0x43')]=function(_0x465fd4,_0x283261){var _0x24d2dc={'raw':!![],'where':{'id':_0x465fd4[_0x93f5('0x44')]['id']}},_0xd4d915={};_0xd4d915[_0x93f5('0x2e')]=_['keys'](db[_0x93f5('0x2b')][_0x93f5('0x45')]);_0xd4d915[_0x93f5('0x32')]=_[_0x93f5('0x30')](_0x465fd4[_0x93f5('0x32')]);_0xd4d915[_0x93f5('0x31')]=_[_0x93f5('0x34')](_0xd4d915[_0x93f5('0x2e')],_0xd4d915['query']);_0x24d2dc['attributes']=_[_0x93f5('0x34')](_0xd4d915['model'],qs[_0x93f5('0x35')](_0x465fd4['query'][_0x93f5('0x35')]));_0x24d2dc[_0x93f5('0x33')]=_0x24d2dc['attributes']['length']?_0x24d2dc[_0x93f5('0x33')]:_0xd4d915['model'];if(_0x465fd4[_0x93f5('0x32')][_0x93f5('0x41')]){_0x24d2dc['include']=[{'all':!![]}];}_0x24d2dc=_[_0x93f5('0x3d')]({},_0x24d2dc,_0x465fd4[_0x93f5('0x40')]);return db[_0x93f5('0x2b')][_0x93f5('0x46')](_0x24d2dc)['then'](handleEntityNotFound(_0x283261,null))[_0x93f5('0x24')](respondWithResult(_0x283261,null))['catch'](handleError(_0x283261,null));};exports[_0x93f5('0x47')]=function(_0x1af1c1,_0x548ee2){return db['FaxQueueReport'][_0x93f5('0x47')](_0x1af1c1[_0x93f5('0x48')],{})['then'](respondWithResult(_0x548ee2,0xc9))[_0x93f5('0x49')](handleError(_0x548ee2,null));};exports[_0x93f5('0x4a')]=function(_0xad4687,_0x576500){if(_0xad4687['body']['id']){delete _0xad4687[_0x93f5('0x48')]['id'];}return db[_0x93f5('0x2b')]['find']({'where':{'id':_0xad4687[_0x93f5('0x44')]['id']}})['then'](handleEntityNotFound(_0x576500,null))[_0x93f5('0x24')](saveUpdates(_0xad4687[_0x93f5('0x48')],null))[_0x93f5('0x24')](respondWithResult(_0x576500,null))[_0x93f5('0x49')](handleError(_0x576500,null));};exports[_0x93f5('0x25')]=function(_0x2e5524,_0x970bcf){return db[_0x93f5('0x2b')][_0x93f5('0x46')]({'where':{'id':_0x2e5524[_0x93f5('0x44')]['id']}})[_0x93f5('0x24')](handleEntityNotFound(_0x970bcf,null))[_0x93f5('0x24')](removeEntity(_0x970bcf,null))[_0x93f5('0x49')](handleError(_0x970bcf,null));};exports[_0x93f5('0x4b')]=function(_0x24b55b,_0xd2d30a){return db[_0x93f5('0x2b')][_0x93f5('0x4b')]()[_0x93f5('0x24')](respondWithResult(_0xd2d30a,null))['catch'](handleError(_0xd2d30a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ae4dd4b..9ee1071 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 _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x34a5cd,_0x21cfc8){var _0x50b81e=function(_0x1b44d7){while(--_0x1b44d7){_0x34a5cd['push'](_0x34a5cd['shift']());}};_0x50b81e(++_0x21cfc8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x39e0c7,_0x260935){var _0x5c0c22=function(_0xfc4fae){while(--_0xfc4fae){_0x39e0c7['push'](_0x39e0c7['shift']());}};_0x5c0c22(++_0x260935);}(_0x1261,0x144));var _0x1126=function(_0x161f85,_0x1b1968){_0x161f85=_0x161f85-0x0;var _0x3f98ad=_0x1261[_0x161f85];return _0x3f98ad;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('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 0299c04..2a5718c 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 _0x689f=['options','raw','debug','stringify','UpdateFaxQueueReport','body','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x5ae1a1,_0x38c7c4){var _0x1034aa=function(_0x5d4bb8){while(--_0x5d4bb8){_0x5ae1a1['push'](_0x5ae1a1['shift']());}};_0x1034aa(++_0x38c7c4);}(_0x689f,0xaa));var _0xf689=function(_0x4de752,_0x48e4dc){_0x4de752=_0x4de752-0x0;var _0x56792d=_0x689f[_0x4de752];return _0x56792d;};'use strict';var _=require(_0xf689('0x0'));var util=require(_0xf689('0x1'));var moment=require(_0xf689('0x2'));var BPromise=require('bluebird');var rs=require(_0xf689('0x3'));var fs=require('fs');var Redis=require(_0xf689('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf689('0x5'));var logger=require(_0xf689('0x6'))(_0xf689('0x7'));var config=require(_0xf689('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf689('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3d6c8,_0x257a69,_0x4772bd){return new BPromise(function(_0xdefc8b,_0x23d3e3){return client[_0xf689('0xa')](_0xf3d6c8,_0x4772bd)['then'](function(_0x2bd9ea){logger[_0xf689('0xb')](_0xf689('0xc'),_0x257a69,_0xf689('0xd'));logger['debug'](_0xf689('0xe'),_0x257a69,_0xf689('0xd'),JSON['stringify'](_0x2bd9ea));if(_0x2bd9ea['error']){if(_0x2bd9ea[_0xf689('0xf')][_0xf689('0x10')]===0x1f4){logger['error'](_0xf689('0xc'),_0x257a69,_0x2bd9ea[_0xf689('0xf')][_0xf689('0x11')]);return _0x23d3e3(_0x2bd9ea[_0xf689('0xf')][_0xf689('0x11')]);}logger[_0xf689('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x257a69,_0x2bd9ea[_0xf689('0xf')]['message']);return _0xdefc8b(_0x2bd9ea[_0xf689('0xf')][_0xf689('0x11')]);}else{logger['info'](_0xf689('0xc'),_0x257a69,_0xf689('0xd'));_0xdefc8b(_0x2bd9ea[_0xf689('0x12')][_0xf689('0x11')]);}})['catch'](function(_0x4d1870){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x257a69,_0x4d1870);_0x23d3e3(_0x4d1870);});});}exports[_0xf689('0x13')]=function(_0x468a63){var _0x15d299=this;return new Promise(function(_0x380e0d,_0x15ac5c){return db[_0xf689('0x14')][_0xf689('0x15')](_0x468a63['body'],{'raw':_0x468a63[_0xf689('0x16')]?_0x468a63[_0xf689('0x16')][_0xf689('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3efc3a){logger[_0xf689('0xb')](_0xf689('0x13'),_0x468a63);logger[_0xf689('0x18')]('CreateFaxQueueReport',_0x468a63,JSON[_0xf689('0x19')](_0x3efc3a));_0x380e0d(_0x3efc3a);})['catch'](function(_0x245b3e){logger[_0xf689('0xf')](_0xf689('0x13'),_0x245b3e[_0xf689('0x11')],_0x468a63);_0x15ac5c(_0x15d299['error'](0x1f4,_0x245b3e[_0xf689('0x11')]));});});};exports[_0xf689('0x1a')]=function(_0xa2d901){var _0x17baaa=this;return new Promise(function(_0x957054,_0x447e42){return db['FaxQueueReport']['update'](_0xa2d901[_0xf689('0x1b')],{'raw':_0xa2d901['options']?_0xa2d901[_0xf689('0x16')][_0xf689('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa2d901[_0xf689('0x16')]?_0xa2d901[_0xf689('0x16')][_0xf689('0x1c')]||null:null,'attributes':_0xa2d901[_0xf689('0x16')]?_0xa2d901[_0xf689('0x16')][_0xf689('0x1d')]||null:null,'limit':_0xa2d901['options']?_0xa2d901[_0xf689('0x16')][_0xf689('0x1e')]||null:null})[_0xf689('0x1f')](function(_0x14f991){logger[_0xf689('0xb')](_0xf689('0x1a'),_0xa2d901);logger['debug'](_0xf689('0x1a'),_0xa2d901,JSON[_0xf689('0x19')](_0x14f991));_0x957054(_0x14f991);})['catch'](function(_0x6b38da){logger[_0xf689('0xf')](_0xf689('0x1a'),_0x6b38da[_0xf689('0x11')],_0xa2d901);_0x447e42(_0x17baaa[_0xf689('0xf')](0x1f4,_0x6b38da[_0xf689('0x11')]));});});}; \ No newline at end of file +var _0x0998=['jayson/promise','http','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','update','where','attributes','UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e31d9,_0x296191){var _0x29f4ca=function(_0x4f2668){while(--_0x4f2668){_0x1e31d9['push'](_0x1e31d9['shift']());}};_0x29f4ca(++_0x296191);}(_0x0998,0x1b8));var _0x8099=function(_0x4d4d5d,_0xe3af6e){_0x4d4d5d=_0x4d4d5d-0x0;var _0x6e3b96=_0x0998[_0x4d4d5d];return _0x6e3b96;};'use strict';var _=require(_0x8099('0x0'));var util=require('util');var moment=require(_0x8099('0x1'));var BPromise=require(_0x8099('0x2'));var rs=require(_0x8099('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8099('0x4'))['db'];var utils=require(_0x8099('0x5'));var logger=require(_0x8099('0x6'))(_0x8099('0x7'));var config=require('../../config/environment');var jayson=require(_0x8099('0x8'));var client=jayson['client'][_0x8099('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ee5e,_0x3e5eb9,_0x499e31){return new BPromise(function(_0x37801c,_0x32fd92){return client['request'](_0x23ee5e,_0x499e31)['then'](function(_0x21feb2){logger[_0x8099('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x3e5eb9,_0x8099('0xb'));logger[_0x8099('0xc')](_0x8099('0xd'),_0x3e5eb9,_0x8099('0xb'),JSON[_0x8099('0xe')](_0x21feb2));if(_0x21feb2[_0x8099('0xf')]){if(_0x21feb2['error'][_0x8099('0x10')]===0x1f4){logger[_0x8099('0xf')](_0x8099('0x11'),_0x3e5eb9,_0x21feb2['error'][_0x8099('0x12')]);return _0x32fd92(_0x21feb2[_0x8099('0xf')]['message']);}logger[_0x8099('0xf')](_0x8099('0x11'),_0x3e5eb9,_0x21feb2[_0x8099('0xf')][_0x8099('0x12')]);return _0x37801c(_0x21feb2[_0x8099('0xf')]['message']);}else{logger[_0x8099('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x3e5eb9,_0x8099('0xb'));_0x37801c(_0x21feb2[_0x8099('0x13')]['message']);}})[_0x8099('0x14')](function(_0x38070b){logger[_0x8099('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x3e5eb9,_0x38070b);_0x32fd92(_0x38070b);});});}exports['CreateFaxQueueReport']=function(_0x3c9f7a){var _0x5b3c79=this;return new Promise(function(_0x58c234,_0x32a48b){return db[_0x8099('0x15')][_0x8099('0x16')](_0x3c9f7a[_0x8099('0x17')],{'raw':_0x3c9f7a[_0x8099('0x18')]?_0x3c9f7a['options'][_0x8099('0x19')]===undefined?!![]:![]:!![]})[_0x8099('0x1a')](function(_0x53984a){logger[_0x8099('0xa')](_0x8099('0x1b'),_0x3c9f7a);logger[_0x8099('0xc')]('CreateFaxQueueReport',_0x3c9f7a,JSON['stringify'](_0x53984a));_0x58c234(_0x53984a);})['catch'](function(_0x1c5195){logger[_0x8099('0xf')](_0x8099('0x1b'),_0x1c5195['message'],_0x3c9f7a);_0x32a48b(_0x5b3c79[_0x8099('0xf')](0x1f4,_0x1c5195['message']));});});};exports['UpdateFaxQueueReport']=function(_0x48d325){var _0x3a64af=this;return new Promise(function(_0x34bff3,_0x4ea3a1){return db[_0x8099('0x15')][_0x8099('0x1c')](_0x48d325[_0x8099('0x17')],{'raw':_0x48d325[_0x8099('0x18')]?_0x48d325[_0x8099('0x18')][_0x8099('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d325[_0x8099('0x18')]?_0x48d325[_0x8099('0x18')][_0x8099('0x1d')]||null:null,'attributes':_0x48d325[_0x8099('0x18')]?_0x48d325[_0x8099('0x18')][_0x8099('0x1e')]||null:null,'limit':_0x48d325['options']?_0x48d325['options']['limit']||null:null})[_0x8099('0x1a')](function(_0x5e6650){logger['info'](_0x8099('0x1f'),_0x48d325);logger[_0x8099('0xc')](_0x8099('0x1f'),_0x48d325,JSON['stringify'](_0x5e6650));_0x34bff3(_0x5e6650);})['catch'](function(_0x5deac9){logger[_0x8099('0xf')]('UpdateFaxQueueReport',_0x5deac9[_0x8099('0x12')],_0x48d325);_0x4ea3a1(_0x3a64af['error'](0x1f4,_0x5deac9[_0x8099('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a259213..f75d104 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 _0x54e7=['delete','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x2e382d,_0x2425d5){var _0x4be5ff=function(_0x427da6){while(--_0x427da6){_0x2e382d['push'](_0x2e382d['shift']());}};_0x4be5ff(++_0x2425d5);}(_0x54e7,0x82));var _0x754e=function(_0x1b435e,_0x435279){_0x1b435e=_0x1b435e-0x0;var _0x28f6c4=_0x54e7[_0x1b435e];return _0x28f6c4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x754e('0x0'));var express=require('express');var router=express[_0x754e('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x754e('0x2'));var interaction=require(_0x754e('0x3'));var config=require(_0x754e('0x4'));var controller=require(_0x754e('0x5'));router['get']('/',auth[_0x754e('0x6')](),controller[_0x754e('0x7')]);router[_0x754e('0x8')](_0x754e('0x9'),auth[_0x754e('0x6')](),controller[_0x754e('0xa')]);router[_0x754e('0x8')](_0x754e('0xb'),auth[_0x754e('0x6')](),controller['show']);router[_0x754e('0xc')]('/',auth[_0x754e('0x6')](),controller[_0x754e('0xd')]);router['put']('/:id',auth[_0x754e('0x6')](),controller['update']);router[_0x754e('0xe')]('/:id',auth[_0x754e('0x6')](),controller['destroy']);module[_0x754e('0xf')]=router; \ No newline at end of file +var _0x81c8=['update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x38e49b,_0x155520){var _0xfce9e0=function(_0x4e2eaa){while(--_0x4e2eaa){_0x38e49b['push'](_0x38e49b['shift']());}};_0xfce9e0(++_0x155520);}(_0x81c8,0x17f));var _0x881c=function(_0x30c169,_0x27e104){_0x30c169=_0x30c169-0x0;var _0x24bbc5=_0x81c8[_0x30c169];return _0x24bbc5;};'use strict';var multer=require(_0x881c('0x0'));var util=require('util');var path=require(_0x881c('0x1'));var timeout=require(_0x881c('0x2'));var express=require('express');var router=express[_0x881c('0x3')]();var fs_extra=require(_0x881c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x881c('0x5'));var config=require(_0x881c('0x6'));var controller=require(_0x881c('0x7'));router[_0x881c('0x8')]('/',auth[_0x881c('0x9')](),controller['index']);router[_0x881c('0x8')](_0x881c('0xa'),auth['isAuthenticated'](),controller[_0x881c('0xb')]);router['get'](_0x881c('0xc'),auth[_0x881c('0x9')](),controller[_0x881c('0xd')]);router[_0x881c('0xe')]('/',auth[_0x881c('0x9')](),controller[_0x881c('0xf')]);router[_0x881c('0x10')](_0x881c('0xc'),auth[_0x881c('0x9')](),controller[_0x881c('0x11')]);router[_0x881c('0x12')](_0x881c('0xc'),auth[_0x881c('0x9')](),controller['destroy']);module[_0x881c('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 18c885e..76fa19f 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x123e78,_0x5a9aee){var _0x1fb8b4=function(_0x52781e){while(--_0x52781e){_0x123e78['push'](_0x123e78['shift']());}};_0x1fb8b4(++_0x5a9aee);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2ac43f,_0x34794a){var _0x55531c=function(_0x4c2fe1){while(--_0x4c2fe1){_0x2ac43f['push'](_0x2ac43f['shift']());}};_0x55531c(++_0x34794a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 32086b7..435d92b 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 _0xe3c7=['findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','map','type','VIRTUAL','filter','merge','FaxTransferReport','includeAll','include'];(function(_0xe25f69,_0x189354){var _0x4d4507=function(_0x55b1c3){while(--_0x55b1c3){_0xe25f69['push'](_0xe25f69['shift']());}};_0x4d4507(++_0x189354);}(_0xe3c7,0x1f0));var _0x7e3c=function(_0x44d9e8,_0x2f0bc2){_0x44d9e8=_0x44d9e8-0x0;var _0x64816e=_0xe3c7[_0x44d9e8];return _0x64816e;};'use strict';var emlformat=require(_0x7e3c('0x0'));var rimraf=require(_0x7e3c('0x1'));var zipdir=require(_0x7e3c('0x2'));var jsonpatch=require(_0x7e3c('0x3'));var rp=require(_0x7e3c('0x4'));var moment=require(_0x7e3c('0x5'));var BPromise=require(_0x7e3c('0x6'));var Mustache=require(_0x7e3c('0x7'));var util=require('util');var path=require(_0x7e3c('0x8'));var sox=require(_0x7e3c('0x9'));var csv=require(_0x7e3c('0xa'));var ejs=require(_0x7e3c('0xb'));var fs=require('fs');var fs_extra=require(_0x7e3c('0xc'));var _=require(_0x7e3c('0xd'));var squel=require(_0x7e3c('0xe'));var crypto=require(_0x7e3c('0xf'));var jsforce=require(_0x7e3c('0x10'));var deskjs=require(_0x7e3c('0x11'));var toCsv=require(_0x7e3c('0xa'));var querystring=require(_0x7e3c('0x12'));var Papa=require(_0x7e3c('0x13'));var Redis=require(_0x7e3c('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x7e3c('0x15'));var as=require(_0x7e3c('0x16'));var hardwareService=require(_0x7e3c('0x17'));var logger=require(_0x7e3c('0x18'))(_0x7e3c('0x19'));var utils=require(_0x7e3c('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x7e3c('0x1b'));var db=require(_0x7e3c('0x1c'))['db'];function respondWithStatusCode(_0x5b3f00,_0x4381e2){_0x4381e2=_0x4381e2||0xcc;return function(_0x46c048){if(_0x46c048){return _0x5b3f00[_0x7e3c('0x1d')](_0x4381e2);}return _0x5b3f00[_0x7e3c('0x1e')](_0x4381e2)[_0x7e3c('0x1f')]();};}function respondWithResult(_0x50aa71,_0x14a33b){_0x14a33b=_0x14a33b||0xc8;return function(_0x36898c){if(_0x36898c){return _0x50aa71[_0x7e3c('0x1e')](_0x14a33b)[_0x7e3c('0x20')](_0x36898c);}};}function respondWithFilteredResult(_0x5d480a,_0x59679c){return function(_0x21278d){if(_0x21278d){var _0x1a3ed1=typeof _0x59679c['offset']==='undefined'&&typeof _0x59679c[_0x7e3c('0x21')]===_0x7e3c('0x22');var _0xfa4a3b=_0x21278d[_0x7e3c('0x23')];var _0x554b7a=_0x1a3ed1?0x0:_0x59679c[_0x7e3c('0x24')];var _0x1c585d=_0x1a3ed1?_0x21278d[_0x7e3c('0x23')]:_0x59679c[_0x7e3c('0x24')]+_0x59679c[_0x7e3c('0x21')];var _0x367e6c;if(_0x1c585d>=_0xfa4a3b){_0x1c585d=_0xfa4a3b;_0x367e6c=0xc8;}else{_0x367e6c=0xce;}_0x5d480a[_0x7e3c('0x1e')](_0x367e6c);return _0x5d480a[_0x7e3c('0x25')](_0x7e3c('0x26'),_0x554b7a+'-'+_0x1c585d+'/'+_0xfa4a3b)[_0x7e3c('0x20')](_0x21278d);}return null;};}function patchUpdates(_0x106ae2){return function(_0x24aa6e){try{jsonpatch[_0x7e3c('0x27')](_0x24aa6e,_0x106ae2,!![]);}catch(_0x28d77e){return BPromise['reject'](_0x28d77e);}return _0x24aa6e[_0x7e3c('0x28')]();};}function saveUpdates(_0x3eff6a,_0x3f0217){return function(_0x390430){if(_0x390430){return _0x390430[_0x7e3c('0x29')](_0x3eff6a)[_0x7e3c('0x2a')](function(_0x35b45a){return _0x35b45a;});}return null;};}function removeEntity(_0x105aa8,_0x39a3b6){return function(_0x1d38f9){if(_0x1d38f9){return _0x1d38f9[_0x7e3c('0x2b')]()[_0x7e3c('0x2a')](function(){_0x105aa8[_0x7e3c('0x1e')](0xcc)[_0x7e3c('0x1f')]();});}};}function handleEntityNotFound(_0x310758,_0xbe630c){return function(_0x1748d5){if(!_0x1748d5){_0x310758[_0x7e3c('0x1d')](0x194);}return _0x1748d5;};}function handleError(_0x27413b,_0xb70b2e){_0xb70b2e=_0xb70b2e||0x1f4;return function(_0xd7d925){logger[_0x7e3c('0x2c')](_0xd7d925[_0x7e3c('0x2d')]);if(_0xd7d925['name']){delete _0xd7d925[_0x7e3c('0x2e')];}_0x27413b[_0x7e3c('0x1e')](_0xb70b2e)[_0x7e3c('0x2f')](_0xd7d925);};}exports[_0x7e3c('0x30')]=function(_0x589b6c,_0x17c264){var _0x7bbe92={},_0x5b6a8c={},_0x3518b4={'count':0x0,'rows':[]};var _0x88159d=_['map'](db['FaxTransferReport'][_0x7e3c('0x31')],function(_0x5cb8e0){return{'name':_0x5cb8e0['fieldName'],'type':_0x5cb8e0['type']['key']};});_0x5b6a8c['model']=_['map'](_0x88159d,_0x7e3c('0x2e'));_0x5b6a8c[_0x7e3c('0x32')]=_[_0x7e3c('0x33')](_0x589b6c[_0x7e3c('0x32')]);_0x5b6a8c[_0x7e3c('0x34')]=_['intersection'](_0x5b6a8c[_0x7e3c('0x35')],_0x5b6a8c['query']);_0x7bbe92['attributes']=_[_0x7e3c('0x36')](_0x5b6a8c[_0x7e3c('0x35')],qs[_0x7e3c('0x37')](_0x589b6c['query'][_0x7e3c('0x37')]));_0x7bbe92[_0x7e3c('0x38')]=_0x7bbe92['attributes'][_0x7e3c('0x39')]?_0x7bbe92['attributes']:_0x5b6a8c[_0x7e3c('0x35')];if(!_0x589b6c[_0x7e3c('0x32')]['hasOwnProperty'](_0x7e3c('0x3a'))){_0x7bbe92[_0x7e3c('0x21')]=qs[_0x7e3c('0x21')](_0x589b6c[_0x7e3c('0x32')][_0x7e3c('0x21')]);_0x7bbe92['offset']=qs[_0x7e3c('0x24')](_0x589b6c['query'][_0x7e3c('0x24')]);}_0x7bbe92[_0x7e3c('0x3b')]=qs[_0x7e3c('0x3c')](_0x589b6c[_0x7e3c('0x32')][_0x7e3c('0x3c')]);_0x7bbe92[_0x7e3c('0x3d')]=qs['filters'](_[_0x7e3c('0x3e')](_0x589b6c[_0x7e3c('0x32')],_0x5b6a8c[_0x7e3c('0x34')]),_0x88159d);if(_0x589b6c['query']['filter']){_0x7bbe92[_0x7e3c('0x3d')]=_['merge'](_0x7bbe92[_0x7e3c('0x3d')],{'$or':_[_0x7e3c('0x3f')](_0x88159d,function(_0x2772ce){if(_0x2772ce[_0x7e3c('0x40')]!==_0x7e3c('0x41')){var _0x791445={};_0x791445[_0x2772ce['name']]={'$like':'%'+_0x589b6c[_0x7e3c('0x32')][_0x7e3c('0x42')]+'%'};return _0x791445;}})});}_0x7bbe92=_[_0x7e3c('0x43')]({},_0x7bbe92,_0x589b6c['options']);var _0x2b1c1a={'where':_0x7bbe92[_0x7e3c('0x3d')]};return db[_0x7e3c('0x44')][_0x7e3c('0x23')](_0x2b1c1a)['then'](function(_0x224863){_0x3518b4['count']=_0x224863;if(_0x589b6c[_0x7e3c('0x32')][_0x7e3c('0x45')]){_0x7bbe92[_0x7e3c('0x46')]=[{'all':!![]}];}return db[_0x7e3c('0x44')][_0x7e3c('0x47')](_0x7bbe92);})[_0x7e3c('0x2a')](function(_0x8b253c){_0x3518b4[_0x7e3c('0x48')]=_0x8b253c;return _0x3518b4;})['then'](respondWithFilteredResult(_0x17c264,_0x7bbe92))[_0x7e3c('0x49')](handleError(_0x17c264,null));};exports[_0x7e3c('0x4a')]=function(_0x54e7ec,_0x5162f8){var _0x2ca58a={'raw':!![],'where':{'id':_0x54e7ec['params']['id']}},_0x2f8d46={};_0x2f8d46[_0x7e3c('0x35')]=_[_0x7e3c('0x33')](db[_0x7e3c('0x44')]['rawAttributes']);_0x2f8d46[_0x7e3c('0x32')]=_[_0x7e3c('0x33')](_0x54e7ec[_0x7e3c('0x32')]);_0x2f8d46[_0x7e3c('0x34')]=_[_0x7e3c('0x36')](_0x2f8d46['model'],_0x2f8d46[_0x7e3c('0x32')]);_0x2ca58a[_0x7e3c('0x38')]=_['intersection'](_0x2f8d46['model'],qs['fields'](_0x54e7ec[_0x7e3c('0x32')][_0x7e3c('0x37')]));_0x2ca58a[_0x7e3c('0x38')]=_0x2ca58a[_0x7e3c('0x38')][_0x7e3c('0x39')]?_0x2ca58a['attributes']:_0x2f8d46[_0x7e3c('0x35')];if(_0x54e7ec['query'][_0x7e3c('0x45')]){_0x2ca58a[_0x7e3c('0x46')]=[{'all':!![]}];}_0x2ca58a=_[_0x7e3c('0x43')]({},_0x2ca58a,_0x54e7ec[_0x7e3c('0x4b')]);return db['FaxTransferReport'][_0x7e3c('0x4c')](_0x2ca58a)[_0x7e3c('0x2a')](handleEntityNotFound(_0x5162f8,null))['then'](respondWithResult(_0x5162f8,null))['catch'](handleError(_0x5162f8,null));};exports[_0x7e3c('0x4d')]=function(_0x4277bb,_0x55ef78){return db[_0x7e3c('0x44')]['create'](_0x4277bb['body'],{})[_0x7e3c('0x2a')](respondWithResult(_0x55ef78,0xc9))['catch'](handleError(_0x55ef78,null));};exports[_0x7e3c('0x29')]=function(_0x2e9d03,_0x2a1d4c){if(_0x2e9d03[_0x7e3c('0x4e')]['id']){delete _0x2e9d03['body']['id'];}return db[_0x7e3c('0x44')][_0x7e3c('0x4c')]({'where':{'id':_0x2e9d03[_0x7e3c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a1d4c,null))[_0x7e3c('0x2a')](saveUpdates(_0x2e9d03['body'],null))[_0x7e3c('0x2a')](respondWithResult(_0x2a1d4c,null))[_0x7e3c('0x49')](handleError(_0x2a1d4c,null));};exports[_0x7e3c('0x2b')]=function(_0x15e2e4,_0x1b9499){return db[_0x7e3c('0x44')][_0x7e3c('0x4c')]({'where':{'id':_0x15e2e4[_0x7e3c('0x4f')]['id']}})[_0x7e3c('0x2a')](handleEntityNotFound(_0x1b9499,null))['then'](removeEntity(_0x1b9499,null))[_0x7e3c('0x49')](handleError(_0x1b9499,null));};exports[_0x7e3c('0x50')]=function(_0x2b6b36,_0x2365f4){return db[_0x7e3c('0x44')][_0x7e3c('0x50')]()['then'](respondWithResult(_0x2365f4,null))[_0x7e3c('0x49')](handleError(_0x2365f4,null));}; \ No newline at end of file +var _0x670c=['error','stack','name','send','index','map','fieldName','type','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','FaxTransferReport','include','findAll','rows','show','params','rawAttributes','length','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x25fcf7,_0x306546){var _0x29f3fd=function(_0x2ebc61){while(--_0x2ebc61){_0x25fcf7['push'](_0x25fcf7['shift']());}};_0x29f3fd(++_0x306546);}(_0x670c,0x1a2));var _0xc670=function(_0x311f87,_0x35a0e0){_0x311f87=_0x311f87-0x0;var _0x23eccb=_0x670c[_0x311f87];return _0x23eccb;};'use strict';var emlformat=require(_0xc670('0x0'));var rimraf=require(_0xc670('0x1'));var zipdir=require(_0xc670('0x2'));var jsonpatch=require(_0xc670('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc670('0x4'));var Mustache=require('mustache');var util=require(_0xc670('0x5'));var path=require('path');var sox=require(_0xc670('0x6'));var csv=require(_0xc670('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc670('0x8'));var _=require('lodash');var squel=require(_0xc670('0x9'));var crypto=require(_0xc670('0xa'));var jsforce=require(_0xc670('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc670('0x7'));var querystring=require(_0xc670('0xc'));var Papa=require('papaparse');var Redis=require(_0xc670('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc670('0xe'));var as=require(_0xc670('0xf'));var hardwareService=require(_0xc670('0x10'));var logger=require(_0xc670('0x11'))(_0xc670('0x12'));var utils=require('../../config/utils');var config=require(_0xc670('0x13'));var licenseUtil=require(_0xc670('0x14'));var db=require(_0xc670('0x15'))['db'];function respondWithStatusCode(_0x4266f1,_0x26442b){_0x26442b=_0x26442b||0xcc;return function(_0x30faaa){if(_0x30faaa){return _0x4266f1[_0xc670('0x16')](_0x26442b);}return _0x4266f1[_0xc670('0x17')](_0x26442b)[_0xc670('0x18')]();};}function respondWithResult(_0x4c755f,_0x24330b){_0x24330b=_0x24330b||0xc8;return function(_0x160c81){if(_0x160c81){return _0x4c755f[_0xc670('0x17')](_0x24330b)[_0xc670('0x19')](_0x160c81);}};}function respondWithFilteredResult(_0x3df6ef,_0x9ea5ac){return function(_0x8e0ed8){if(_0x8e0ed8){var _0x5b8ed4=typeof _0x9ea5ac[_0xc670('0x1a')]==='undefined'&&typeof _0x9ea5ac[_0xc670('0x1b')]===_0xc670('0x1c');var _0x47a428=_0x8e0ed8[_0xc670('0x1d')];var _0x3d71ae=_0x5b8ed4?0x0:_0x9ea5ac[_0xc670('0x1a')];var _0x948716=_0x5b8ed4?_0x8e0ed8['count']:_0x9ea5ac['offset']+_0x9ea5ac[_0xc670('0x1b')];var _0x181304;if(_0x948716>=_0x47a428){_0x948716=_0x47a428;_0x181304=0xc8;}else{_0x181304=0xce;}_0x3df6ef[_0xc670('0x17')](_0x181304);return _0x3df6ef[_0xc670('0x1e')](_0xc670('0x1f'),_0x3d71ae+'-'+_0x948716+'/'+_0x47a428)[_0xc670('0x19')](_0x8e0ed8);}return null;};}function patchUpdates(_0x344659){return function(_0x5aa8aa){try{jsonpatch[_0xc670('0x20')](_0x5aa8aa,_0x344659,!![]);}catch(_0x5010b2){return BPromise[_0xc670('0x21')](_0x5010b2);}return _0x5aa8aa[_0xc670('0x22')]();};}function saveUpdates(_0x435a98,_0xec7f75){return function(_0x4aed99){if(_0x4aed99){return _0x4aed99[_0xc670('0x23')](_0x435a98)[_0xc670('0x24')](function(_0x49dcbf){return _0x49dcbf;});}return null;};}function removeEntity(_0x1e5bef,_0x82d412){return function(_0x29d9e9){if(_0x29d9e9){return _0x29d9e9[_0xc670('0x25')]()[_0xc670('0x24')](function(){_0x1e5bef[_0xc670('0x17')](0xcc)[_0xc670('0x18')]();});}};}function handleEntityNotFound(_0x339395,_0x27d6db){return function(_0x14ae27){if(!_0x14ae27){_0x339395['sendStatus'](0x194);}return _0x14ae27;};}function handleError(_0x271ed3,_0x5ca8d2){_0x5ca8d2=_0x5ca8d2||0x1f4;return function(_0x283384){logger[_0xc670('0x26')](_0x283384[_0xc670('0x27')]);if(_0x283384[_0xc670('0x28')]){delete _0x283384[_0xc670('0x28')];}_0x271ed3[_0xc670('0x17')](_0x5ca8d2)[_0xc670('0x29')](_0x283384);};}exports[_0xc670('0x2a')]=function(_0x27739e,_0x481daa){var _0x1ce34e={},_0x1ae0a4={},_0x2ccf93={'count':0x0,'rows':[]};var _0xde84c5=_[_0xc670('0x2b')](db['FaxTransferReport']['rawAttributes'],function(_0x344138){return{'name':_0x344138[_0xc670('0x2c')],'type':_0x344138[_0xc670('0x2d')]['key']};});_0x1ae0a4[_0xc670('0x2e')]=_[_0xc670('0x2b')](_0xde84c5,'name');_0x1ae0a4['query']=_[_0xc670('0x2f')](_0x27739e[_0xc670('0x30')]);_0x1ae0a4['filters']=_[_0xc670('0x31')](_0x1ae0a4['model'],_0x1ae0a4['query']);_0x1ce34e[_0xc670('0x32')]=_[_0xc670('0x31')](_0x1ae0a4['model'],qs[_0xc670('0x33')](_0x27739e[_0xc670('0x30')][_0xc670('0x33')]));_0x1ce34e[_0xc670('0x32')]=_0x1ce34e['attributes']['length']?_0x1ce34e['attributes']:_0x1ae0a4['model'];if(!_0x27739e['query']['hasOwnProperty'](_0xc670('0x34'))){_0x1ce34e['limit']=qs[_0xc670('0x1b')](_0x27739e[_0xc670('0x30')][_0xc670('0x1b')]);_0x1ce34e[_0xc670('0x1a')]=qs[_0xc670('0x1a')](_0x27739e[_0xc670('0x30')][_0xc670('0x1a')]);}_0x1ce34e[_0xc670('0x35')]=qs[_0xc670('0x36')](_0x27739e[_0xc670('0x30')]['sort']);_0x1ce34e[_0xc670('0x37')]=qs['filters'](_[_0xc670('0x38')](_0x27739e[_0xc670('0x30')],_0x1ae0a4[_0xc670('0x39')]),_0xde84c5);if(_0x27739e[_0xc670('0x30')][_0xc670('0x3a')]){_0x1ce34e[_0xc670('0x37')]=_['merge'](_0x1ce34e['where'],{'$or':_[_0xc670('0x2b')](_0xde84c5,function(_0x1aadc8){if(_0x1aadc8[_0xc670('0x2d')]!==_0xc670('0x3b')){var _0x421681={};_0x421681[_0x1aadc8[_0xc670('0x28')]]={'$like':'%'+_0x27739e[_0xc670('0x30')]['filter']+'%'};return _0x421681;}})});}_0x1ce34e=_[_0xc670('0x3c')]({},_0x1ce34e,_0x27739e[_0xc670('0x3d')]);var _0x57e6e6={'where':_0x1ce34e['where']};return db[_0xc670('0x3e')][_0xc670('0x1d')](_0x57e6e6)[_0xc670('0x24')](function(_0x452a7b){_0x2ccf93['count']=_0x452a7b;if(_0x27739e[_0xc670('0x30')]['includeAll']){_0x1ce34e[_0xc670('0x3f')]=[{'all':!![]}];}return db[_0xc670('0x3e')][_0xc670('0x40')](_0x1ce34e);})['then'](function(_0x3a4227){_0x2ccf93[_0xc670('0x41')]=_0x3a4227;return _0x2ccf93;})[_0xc670('0x24')](respondWithFilteredResult(_0x481daa,_0x1ce34e))['catch'](handleError(_0x481daa,null));};exports[_0xc670('0x42')]=function(_0x5e16c6,_0x4af128){var _0x53972f={'raw':!![],'where':{'id':_0x5e16c6[_0xc670('0x43')]['id']}},_0xbd5c59={};_0xbd5c59['model']=_[_0xc670('0x2f')](db['FaxTransferReport'][_0xc670('0x44')]);_0xbd5c59[_0xc670('0x30')]=_[_0xc670('0x2f')](_0x5e16c6[_0xc670('0x30')]);_0xbd5c59[_0xc670('0x39')]=_['intersection'](_0xbd5c59[_0xc670('0x2e')],_0xbd5c59['query']);_0x53972f['attributes']=_['intersection'](_0xbd5c59['model'],qs[_0xc670('0x33')](_0x5e16c6[_0xc670('0x30')][_0xc670('0x33')]));_0x53972f[_0xc670('0x32')]=_0x53972f[_0xc670('0x32')][_0xc670('0x45')]?_0x53972f[_0xc670('0x32')]:_0xbd5c59[_0xc670('0x2e')];if(_0x5e16c6[_0xc670('0x30')][_0xc670('0x46')]){_0x53972f[_0xc670('0x3f')]=[{'all':!![]}];}_0x53972f=_[_0xc670('0x3c')]({},_0x53972f,_0x5e16c6[_0xc670('0x3d')]);return db['FaxTransferReport']['find'](_0x53972f)[_0xc670('0x24')](handleEntityNotFound(_0x4af128,null))[_0xc670('0x24')](respondWithResult(_0x4af128,null))[_0xc670('0x47')](handleError(_0x4af128,null));};exports[_0xc670('0x48')]=function(_0x5110eb,_0x43979d){return db[_0xc670('0x3e')][_0xc670('0x48')](_0x5110eb[_0xc670('0x49')],{})[_0xc670('0x24')](respondWithResult(_0x43979d,0xc9))[_0xc670('0x47')](handleError(_0x43979d,null));};exports['update']=function(_0x54f977,_0x1d4652){if(_0x54f977['body']['id']){delete _0x54f977[_0xc670('0x49')]['id'];}return db[_0xc670('0x3e')][_0xc670('0x4a')]({'where':{'id':_0x54f977[_0xc670('0x43')]['id']}})[_0xc670('0x24')](handleEntityNotFound(_0x1d4652,null))[_0xc670('0x24')](saveUpdates(_0x54f977[_0xc670('0x49')],null))[_0xc670('0x24')](respondWithResult(_0x1d4652,null))[_0xc670('0x47')](handleError(_0x1d4652,null));};exports[_0xc670('0x25')]=function(_0x4d903d,_0x3f8819){return db[_0xc670('0x3e')][_0xc670('0x4a')]({'where':{'id':_0x4d903d[_0xc670('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f8819,null))[_0xc670('0x24')](removeEntity(_0x3f8819,null))[_0xc670('0x47')](handleError(_0x3f8819,null));};exports[_0xc670('0x4b')]=function(_0x1c1f17,_0x574ded){return db['FaxTransferReport']['describe']()[_0xc670('0x24')](respondWithResult(_0x574ded,null))[_0xc670('0x47')](handleError(_0x574ded,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index cf07711..7832f23 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 _0xa4a9=['path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2b6f59,_0x3e02a5){var _0x4541b0=function(_0x1f6b2e){while(--_0x1f6b2e){_0x2b6f59['push'](_0x2b6f59['shift']());}};_0x4541b0(++_0x3e02a5);}(_0xa4a9,0x126));var _0x9a4a=function(_0x28f153,_0x4852ed){_0x28f153=_0x28f153-0x0;var _0x56b861=_0xa4a9[_0x28f153];return _0x56b861;};'use strict';var _=require(_0x9a4a('0x0'));var util=require(_0x9a4a('0x1'));var logger=require('../../config/logger')(_0x9a4a('0x2'));var moment=require(_0x9a4a('0x3'));var BPromise=require(_0x9a4a('0x4'));var rp=require(_0x9a4a('0x5'));var fs=require('fs');var path=require(_0x9a4a('0x6'));var rimraf=require(_0x9a4a('0x7'));var config=require(_0x9a4a('0x8'));var attributes=require(_0x9a4a('0x9'));module[_0x9a4a('0xa')]=function(_0x31f124,_0x30eaa3){return _0x31f124[_0x9a4a('0xb')](_0x9a4a('0xc'),attributes,{'tableName':_0x9a4a('0xd'),'paranoid':![],'indexes':[{'name':_0x9a4a('0xe'),'fields':[_0x9a4a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7dff=['bluebird','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x3109e6,_0x4f9a6d){var _0x4f5bf1=function(_0x783d4b){while(--_0x783d4b){_0x3109e6['push'](_0x3109e6['shift']());}};_0x4f5bf1(++_0x4f9a6d);}(_0x7dff,0x75));var _0xf7df=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7dff[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xf7df('0x0'));var util=require('util');var logger=require(_0xf7df('0x1'))('api');var moment=require(_0xf7df('0x2'));var BPromise=require(_0xf7df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7df('0x4'));var rimraf=require(_0xf7df('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7df('0x6'));module[_0xf7df('0x7')]=function(_0x1a49b7,_0x45b1b8){return _0x1a49b7[_0xf7df('0x8')](_0xf7df('0x9'),attributes,{'tableName':_0xf7df('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf7df('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 31f33ca..c8fa9bf 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 _0x4b78=['FaxTransferReport,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d86e7,_0x1c0fcc){var _0x59e023=function(_0x5d7b43){while(--_0x5d7b43){_0x1d86e7['push'](_0x1d86e7['shift']());}};_0x59e023(++_0x1c0fcc);}(_0x4b78,0x145));var _0x84b7=function(_0xc6ea63,_0x1212a1){_0xc6ea63=_0xc6ea63-0x0;var _0x54b41b=_0x4b78[_0xc6ea63];return _0x54b41b;};'use strict';var _=require(_0x84b7('0x0'));var util=require(_0x84b7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84b7('0x2'));var fs=require('fs');var Redis=require(_0x84b7('0x3'));var db=require(_0x84b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x84b7('0x5'))(_0x84b7('0x6'));var config=require(_0x84b7('0x7'));var jayson=require(_0x84b7('0x8'));var client=jayson[_0x84b7('0x9')][_0x84b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17c29a,_0x5e6685,_0x103e69){return new BPromise(function(_0xd179d6,_0x4cd0f5){return client[_0x84b7('0xb')](_0x17c29a,_0x103e69)[_0x84b7('0xc')](function(_0x35c3f4){logger[_0x84b7('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x5e6685,_0x84b7('0xe'));logger[_0x84b7('0xf')](_0x84b7('0x10'),_0x5e6685,_0x84b7('0xe'),JSON[_0x84b7('0x11')](_0x35c3f4));if(_0x35c3f4[_0x84b7('0x12')]){if(_0x35c3f4[_0x84b7('0x12')][_0x84b7('0x13')]===0x1f4){logger[_0x84b7('0x12')](_0x84b7('0x14'),_0x5e6685,_0x35c3f4[_0x84b7('0x12')][_0x84b7('0x15')]);return _0x4cd0f5(_0x35c3f4['error'][_0x84b7('0x15')]);}logger[_0x84b7('0x12')](_0x84b7('0x14'),_0x5e6685,_0x35c3f4['error']['message']);return _0xd179d6(_0x35c3f4['error'][_0x84b7('0x15')]);}else{logger[_0x84b7('0xd')](_0x84b7('0x14'),_0x5e6685,'request\x20sent');_0xd179d6(_0x35c3f4['result'][_0x84b7('0x15')]);}})[_0x84b7('0x16')](function(_0x5dea04){logger[_0x84b7('0x12')](_0x84b7('0x14'),_0x5e6685,_0x5dea04);_0x4cd0f5(_0x5dea04);});});} \ No newline at end of file +var _0x0fd6=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4aedbc,_0x301199){var _0x24d4dc=function(_0x46e939){while(--_0x46e939){_0x4aedbc['push'](_0x4aedbc['shift']());}};_0x24d4dc(++_0x301199);}(_0x0fd6,0xc7));var _0x60fd=function(_0x4fbd07,_0x385ad4){_0x4fbd07=_0x4fbd07-0x0;var _0x307836=_0x0fd6[_0x4fbd07];return _0x307836;};'use strict';var _=require(_0x60fd('0x0'));var util=require(_0x60fd('0x1'));var moment=require('moment');var BPromise=require(_0x60fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60fd('0x3'))['db'];var utils=require(_0x60fd('0x4'));var logger=require(_0x60fd('0x5'))('rpc');var config=require(_0x60fd('0x6'));var jayson=require(_0x60fd('0x7'));var client=jayson['client'][_0x60fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b8952,_0x566322,_0x33cbc9){return new BPromise(function(_0x3e4ada,_0x56084c){return client[_0x60fd('0x9')](_0x2b8952,_0x33cbc9)['then'](function(_0x46f05b){logger[_0x60fd('0xa')](_0x60fd('0xb'),_0x566322,_0x60fd('0xc'));logger['debug'](_0x60fd('0xd'),_0x566322,_0x60fd('0xc'),JSON[_0x60fd('0xe')](_0x46f05b));if(_0x46f05b[_0x60fd('0xf')]){if(_0x46f05b[_0x60fd('0xf')][_0x60fd('0x10')]===0x1f4){logger[_0x60fd('0xf')](_0x60fd('0xb'),_0x566322,_0x46f05b[_0x60fd('0xf')][_0x60fd('0x11')]);return _0x56084c(_0x46f05b[_0x60fd('0xf')][_0x60fd('0x11')]);}logger[_0x60fd('0xf')](_0x60fd('0xb'),_0x566322,_0x46f05b['error'][_0x60fd('0x11')]);return _0x3e4ada(_0x46f05b['error'][_0x60fd('0x11')]);}else{logger[_0x60fd('0xa')](_0x60fd('0xb'),_0x566322,_0x60fd('0xc'));_0x3e4ada(_0x46f05b[_0x60fd('0x12')][_0x60fd('0x11')]);}})[_0x60fd('0x13')](function(_0x206c96){logger['error'](_0x60fd('0xb'),_0x566322,_0x206c96);_0x56084c(_0x206c96);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4719550..edc6bbe 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 _0xae3c=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3fdcc5,_0x1c3d31){var _0x16a5ce=function(_0x49c6cb){while(--_0x49c6cb){_0x3fdcc5['push'](_0x3fdcc5['shift']());}};_0x16a5ce(++_0x1c3d31);}(_0xae3c,0x148));var _0xcae3=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xae3c[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0xcae3('0x0'));var util=require(_0xcae3('0x1'));var path=require(_0xcae3('0x2'));var timeout=require(_0xcae3('0x3'));var express=require(_0xcae3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcae3('0x5'));var interaction=require(_0xcae3('0x6'));var config=require(_0xcae3('0x7'));var controller=require('./faxTransferReport.controller');router[_0xcae3('0x8')]('/',auth[_0xcae3('0x9')](),controller[_0xcae3('0xa')]);router[_0xcae3('0x8')](_0xcae3('0xb'),auth[_0xcae3('0x9')](),controller['describe']);router[_0xcae3('0x8')](_0xcae3('0xc'),auth[_0xcae3('0x9')](),controller[_0xcae3('0xd')]);router[_0xcae3('0xe')]('/',auth[_0xcae3('0x9')](),controller['create']);router[_0xcae3('0xf')]('/:id',auth[_0xcae3('0x9')](),controller[_0xcae3('0x10')]);router[_0xcae3('0x11')](_0xcae3('0xc'),auth[_0xcae3('0x9')](),controller[_0xcae3('0x12')]);module[_0xcae3('0x13')]=router; \ No newline at end of file +var _0x8aa0=['update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create','put'];(function(_0x333d32,_0x3562f8){var _0x128f4f=function(_0x580ca3){while(--_0x580ca3){_0x333d32['push'](_0x333d32['shift']());}};_0x128f4f(++_0x3562f8);}(_0x8aa0,0x9c));var _0x08aa=function(_0x115ccf,_0x38a146){_0x115ccf=_0x115ccf-0x0;var _0x489567=_0x8aa0[_0x115ccf];return _0x489567;};'use strict';var multer=require(_0x08aa('0x0'));var util=require(_0x08aa('0x1'));var path=require('path');var timeout=require(_0x08aa('0x2'));var express=require(_0x08aa('0x3'));var router=express['Router']();var fs_extra=require(_0x08aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x08aa('0x5'));var config=require(_0x08aa('0x6'));var controller=require('./faxTransferReport.controller');router[_0x08aa('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x08aa('0x8'),auth[_0x08aa('0x9')](),controller[_0x08aa('0xa')]);router[_0x08aa('0x7')](_0x08aa('0xb'),auth[_0x08aa('0x9')](),controller['show']);router[_0x08aa('0xc')]('/',auth[_0x08aa('0x9')](),controller[_0x08aa('0xd')]);router[_0x08aa('0xe')](_0x08aa('0xb'),auth[_0x08aa('0x9')](),controller[_0x08aa('0xf')]);router[_0x08aa('0x10')]('/:id',auth[_0x08aa('0x9')](),controller[_0x08aa('0x11')]);module[_0x08aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 01d2b03..74a01a9 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 _0x6519=['show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x2f098c,_0x159232){var _0xe8f6ef=function(_0x3ae036){while(--_0x3ae036){_0x2f098c['push'](_0x2f098c['shift']());}};_0xe8f6ef(++_0x159232);}(_0x6519,0x163));var _0x9651=function(_0x43bc0e,_0x18864e){_0x43bc0e=_0x43bc0e-0x0;var _0x5b4081=_0x6519[_0x43bc0e];return _0x5b4081;};'use strict';var multer=require(_0x9651('0x0'));var util=require(_0x9651('0x1'));var path=require(_0x9651('0x2'));var timeout=require(_0x9651('0x3'));var express=require(_0x9651('0x4'));var router=express[_0x9651('0x5')]();var fs_extra=require(_0x9651('0x6'));var auth=require(_0x9651('0x7'));var interaction=require(_0x9651('0x8'));var config=require(_0x9651('0x9'));var controller=require('./intDeskAccount.controller');router[_0x9651('0xa')]('/',auth['isAuthenticated'](),controller[_0x9651('0xb')]);router[_0x9651('0xa')](_0x9651('0xc'),auth['isAuthenticated'](),controller[_0x9651('0xd')]);router[_0x9651('0xa')](_0x9651('0xe'),auth[_0x9651('0xf')](),controller[_0x9651('0x10')]);router[_0x9651('0xa')]('/:id/fields',auth[_0x9651('0xf')](),controller[_0x9651('0x11')]);router['post']('/',auth[_0x9651('0xf')](),controller['create']);router[_0x9651('0x12')](_0x9651('0xe'),auth[_0x9651('0xf')](),controller[_0x9651('0x13')]);router[_0x9651('0x14')]('/:id',auth[_0x9651('0xf')](),controller['update']);router[_0x9651('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9651('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5ae7=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x5ae7,0x13c));var _0x75ae=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ae7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x75ae('0x0'));var util=require('util');var path=require(_0x75ae('0x1'));var timeout=require(_0x75ae('0x2'));var express=require(_0x75ae('0x3'));var router=express[_0x75ae('0x4')]();var fs_extra=require(_0x75ae('0x5'));var auth=require(_0x75ae('0x6'));var interaction=require(_0x75ae('0x7'));var config=require(_0x75ae('0x8'));var controller=require('./intDeskAccount.controller');router[_0x75ae('0x9')]('/',auth[_0x75ae('0xa')](),controller[_0x75ae('0xb')]);router[_0x75ae('0x9')](_0x75ae('0xc'),auth[_0x75ae('0xa')](),controller[_0x75ae('0xd')]);router[_0x75ae('0x9')](_0x75ae('0xe'),auth[_0x75ae('0xa')](),controller['getConfigurations']);router[_0x75ae('0x9')](_0x75ae('0xf'),auth[_0x75ae('0xa')](),controller[_0x75ae('0x10')]);router[_0x75ae('0x11')]('/',auth[_0x75ae('0xa')](),controller[_0x75ae('0x12')]);router[_0x75ae('0x11')](_0x75ae('0xe'),auth[_0x75ae('0xa')](),controller[_0x75ae('0x13')]);router[_0x75ae('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x75ae('0x15')]);router[_0x75ae('0x16')](_0x75ae('0xc'),auth['isAuthenticated'](),controller[_0x75ae('0x17')]);module[_0x75ae('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d2b8504..118beec 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 _0xfa4d=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x2fe853,_0x1891ef){var _0x424021=function(_0xd455cc){while(--_0xd455cc){_0x2fe853['push'](_0x2fe853['shift']());}};_0x424021(++_0x1891ef);}(_0xfa4d,0x1e3));var _0xdfa4=function(_0x5302ad,_0x1e9a92){_0x5302ad=_0x5302ad-0x0;var _0x96331f=_0xfa4d[_0x5302ad];return _0x96331f;};'use strict';var Sequelize=require(_0xdfa4('0x0'));module[_0xdfa4('0x1')]={'name':{'type':Sequelize[_0xdfa4('0x2')]},'description':{'type':Sequelize[_0xdfa4('0x2')]},'username':{'type':Sequelize[_0xdfa4('0x2')]},'remoteUri':{'type':Sequelize[_0xdfa4('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xdfa4('0x3')),'defaultValue':_0xdfa4('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xdfa4('0x2')]},'token':{'type':Sequelize[_0xdfa4('0x2')]},'tokenSecret':{'type':Sequelize[_0xdfa4('0x2')]},'serverUrl':{'type':Sequelize[_0xdfa4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdfa4('0x4')](_0xdfa4('0x5'),_0xdfa4('0x6')),'defaultValue':_0xdfa4('0x5')}}; \ No newline at end of file +var _0xef63=['integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x57cf77,_0x184f21){var _0x4e6cfc=function(_0x56c542){while(--_0x56c542){_0x57cf77['push'](_0x57cf77['shift']());}};_0x4e6cfc(++_0x184f21);}(_0xef63,0x181));var _0x3ef6=function(_0x497494,_0x4eaf15){_0x497494=_0x497494-0x0;var _0x130954=_0xef63[_0x497494];return _0x130954;};'use strict';var Sequelize=require(_0x3ef6('0x0'));module[_0x3ef6('0x1')]={'name':{'type':Sequelize[_0x3ef6('0x2')]},'description':{'type':Sequelize[_0x3ef6('0x2')]},'username':{'type':Sequelize[_0x3ef6('0x2')]},'remoteUri':{'type':Sequelize[_0x3ef6('0x2')]},'authType':{'type':Sequelize[_0x3ef6('0x3')]('basic'),'defaultValue':_0x3ef6('0x4')},'password':{'type':Sequelize[_0x3ef6('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3ef6('0x2')]},'token':{'type':Sequelize[_0x3ef6('0x2')]},'tokenSecret':{'type':Sequelize[_0x3ef6('0x2')]},'serverUrl':{'type':Sequelize[_0x3ef6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3ef6('0x3')](_0x3ef6('0x5'),'newTab'),'defaultValue':_0x3ef6('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fc654bd..cad4034 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 _0xbffb=['DeskField','Descriptions','getFields','priority','remoteUri','username','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','Authorization','Basic\x20%s','format','password','toString','concat','_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','DeskAccount','includeAll','include','findAll','rows','show','params','options','find','body','catch','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','create'];(function(_0x510b94,_0x4dbbc0){var _0xd3e601=function(_0x478d3a){while(--_0x478d3a){_0x510b94['push'](_0x510b94['shift']());}};_0xd3e601(++_0x4dbbc0);}(_0xbffb,0x17a));var _0xbbff=function(_0x35e205,_0x51285b){_0x35e205=_0x35e205-0x0;var _0x70425=_0xbffb[_0x35e205];return _0x70425;};'use strict';var emlformat=require(_0xbbff('0x0'));var rimraf=require(_0xbbff('0x1'));var zipdir=require(_0xbbff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbbff('0x3'));var Mustache=require('mustache');var util=require(_0xbbff('0x4'));var path=require(_0xbbff('0x5'));var sox=require(_0xbbff('0x6'));var csv=require('to-csv');var ejs=require(_0xbbff('0x7'));var fs=require('fs');var fs_extra=require(_0xbbff('0x8'));var _=require(_0xbbff('0x9'));var squel=require(_0xbbff('0xa'));var crypto=require('crypto');var jsforce=require(_0xbbff('0xb'));var deskjs=require(_0xbbff('0xc'));var toCsv=require(_0xbbff('0xd'));var querystring=require(_0xbbff('0xe'));var Papa=require(_0xbbff('0xf'));var Redis=require(_0xbbff('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbbff('0x11'));var as=require(_0xbbff('0x12'));var hardwareService=require(_0xbbff('0x13'));var logger=require(_0xbbff('0x14'))(_0xbbff('0x15'));var utils=require(_0xbbff('0x16'));var config=require(_0xbbff('0x17'));var licenseUtil=require(_0xbbff('0x18'));var db=require(_0xbbff('0x19'))['db'];var integrations=require(_0xbbff('0x1a'));function respondWithStatusCode(_0xb5a7f,_0x2f5e38){_0x2f5e38=_0x2f5e38||0xcc;return function(_0x1d6cba){if(_0x1d6cba){return _0xb5a7f[_0xbbff('0x1b')](_0x2f5e38);}return _0xb5a7f['status'](_0x2f5e38)[_0xbbff('0x1c')]();};}function respondWithResult(_0x347c13,_0x2e2a78){_0x2e2a78=_0x2e2a78||0xc8;return function(_0x1cff5a){if(_0x1cff5a){return _0x347c13[_0xbbff('0x1d')](_0x2e2a78)[_0xbbff('0x1e')](_0x1cff5a);}};}function respondWithFilteredResult(_0x47187b,_0x154234){return function(_0x1fbfee){if(_0x1fbfee){var _0x45dc4e=typeof _0x154234[_0xbbff('0x1f')]===_0xbbff('0x20')&&typeof _0x154234['limit']==='undefined';var _0x2fad2e=_0x1fbfee[_0xbbff('0x21')];var _0x5b7f78=_0x45dc4e?0x0:_0x154234[_0xbbff('0x1f')];var _0x5130ae=_0x45dc4e?_0x1fbfee[_0xbbff('0x21')]:_0x154234['offset']+_0x154234[_0xbbff('0x22')];var _0x16d041;if(_0x5130ae>=_0x2fad2e){_0x5130ae=_0x2fad2e;_0x16d041=0xc8;}else{_0x16d041=0xce;}_0x47187b[_0xbbff('0x1d')](_0x16d041);return _0x47187b['set'](_0xbbff('0x23'),_0x5b7f78+'-'+_0x5130ae+'/'+_0x2fad2e)[_0xbbff('0x1e')](_0x1fbfee);}return null;};}function patchUpdates(_0x4060c8){return function(_0xcd0b85){try{jsonpatch[_0xbbff('0x24')](_0xcd0b85,_0x4060c8,!![]);}catch(_0x34a01d){return BPromise['reject'](_0x34a01d);}return _0xcd0b85[_0xbbff('0x25')]();};}function saveUpdates(_0x34f198,_0x4a91de){return function(_0xe1e6fa){if(_0xe1e6fa){return _0xe1e6fa[_0xbbff('0x26')](_0x34f198)['then'](function(_0x23f728){return _0x23f728;});}return null;};}function removeEntity(_0x38a2a4,_0x34b13e){return function(_0x27d27e){if(_0x27d27e){return _0x27d27e[_0xbbff('0x27')]()[_0xbbff('0x28')](function(){_0x38a2a4[_0xbbff('0x1d')](0xcc)[_0xbbff('0x1c')]();});}};}function handleEntityNotFound(_0x225208,_0x563450){return function(_0x56f278){if(!_0x56f278){_0x225208[_0xbbff('0x1b')](0x194);}return _0x56f278;};}function handleError(_0x332178,_0x1d326e){_0x1d326e=_0x1d326e||0x1f4;return function(_0x228546){logger['error'](_0x228546[_0xbbff('0x29')]);if(_0x228546[_0xbbff('0x2a')]){delete _0x228546[_0xbbff('0x2a')];}_0x332178[_0xbbff('0x1d')](_0x1d326e)[_0xbbff('0x2b')](_0x228546);};}exports[_0xbbff('0x2c')]=function(_0x1f770a,_0x139a3d){var _0x3ac32a={},_0x33ae12={},_0x40b74c={'count':0x0,'rows':[]};var _0x319ad8=_[_0xbbff('0x2d')](db['DeskAccount'][_0xbbff('0x2e')],function(_0x31c864){return{'name':_0x31c864[_0xbbff('0x2f')],'type':_0x31c864[_0xbbff('0x30')][_0xbbff('0x31')]};});_0x33ae12['model']=_[_0xbbff('0x2d')](_0x319ad8,_0xbbff('0x2a'));_0x33ae12[_0xbbff('0x32')]=_[_0xbbff('0x33')](_0x1f770a[_0xbbff('0x32')]);_0x33ae12[_0xbbff('0x34')]=_[_0xbbff('0x35')](_0x33ae12[_0xbbff('0x36')],_0x33ae12[_0xbbff('0x32')]);_0x3ac32a[_0xbbff('0x37')]=_['intersection'](_0x33ae12['model'],qs[_0xbbff('0x38')](_0x1f770a['query'][_0xbbff('0x38')]));_0x3ac32a[_0xbbff('0x37')]=_0x3ac32a[_0xbbff('0x37')][_0xbbff('0x39')]?_0x3ac32a['attributes']:_0x33ae12[_0xbbff('0x36')];if(!_0x1f770a['query'][_0xbbff('0x3a')](_0xbbff('0x3b'))){_0x3ac32a['limit']=qs['limit'](_0x1f770a['query'][_0xbbff('0x22')]);_0x3ac32a['offset']=qs[_0xbbff('0x1f')](_0x1f770a[_0xbbff('0x32')][_0xbbff('0x1f')]);}_0x3ac32a[_0xbbff('0x3c')]=qs[_0xbbff('0x3d')](_0x1f770a[_0xbbff('0x32')]['sort']);_0x3ac32a[_0xbbff('0x3e')]=qs[_0xbbff('0x34')](_[_0xbbff('0x3f')](_0x1f770a[_0xbbff('0x32')],_0x33ae12[_0xbbff('0x34')]),_0x319ad8);if(_0x1f770a[_0xbbff('0x32')][_0xbbff('0x40')]){_0x3ac32a[_0xbbff('0x3e')]=_[_0xbbff('0x41')](_0x3ac32a[_0xbbff('0x3e')],{'$or':_[_0xbbff('0x2d')](_0x319ad8,function(_0x55d578){if(_0x55d578[_0xbbff('0x30')]!==_0xbbff('0x42')){var _0x2ad9b0={};_0x2ad9b0[_0x55d578[_0xbbff('0x2a')]]={'$like':'%'+_0x1f770a[_0xbbff('0x32')][_0xbbff('0x40')]+'%'};return _0x2ad9b0;}})});}_0x3ac32a=_[_0xbbff('0x41')]({},_0x3ac32a,_0x1f770a['options']);var _0x42e653={'where':_0x3ac32a['where']};return db[_0xbbff('0x43')]['count'](_0x42e653)[_0xbbff('0x28')](function(_0x5dd056){_0x40b74c[_0xbbff('0x21')]=_0x5dd056;if(_0x1f770a[_0xbbff('0x32')][_0xbbff('0x44')]){_0x3ac32a[_0xbbff('0x45')]=[{'all':!![]}];}return db[_0xbbff('0x43')][_0xbbff('0x46')](_0x3ac32a);})[_0xbbff('0x28')](function(_0x5dda93){_0x40b74c[_0xbbff('0x47')]=_0x5dda93;return _0x40b74c;})[_0xbbff('0x28')](respondWithFilteredResult(_0x139a3d,_0x3ac32a))['catch'](handleError(_0x139a3d,null));};exports[_0xbbff('0x48')]=function(_0x1e92d2,_0x4e5dd6){var _0x234010={'raw':![],'where':{'id':_0x1e92d2[_0xbbff('0x49')]['id']}},_0x2096c8={};_0x2096c8['model']=_[_0xbbff('0x33')](db[_0xbbff('0x43')]['rawAttributes']);_0x2096c8[_0xbbff('0x32')]=_[_0xbbff('0x33')](_0x1e92d2[_0xbbff('0x32')]);_0x2096c8[_0xbbff('0x34')]=_['intersection'](_0x2096c8[_0xbbff('0x36')],_0x2096c8[_0xbbff('0x32')]);_0x234010[_0xbbff('0x37')]=_[_0xbbff('0x35')](_0x2096c8['model'],qs['fields'](_0x1e92d2[_0xbbff('0x32')][_0xbbff('0x38')]));_0x234010[_0xbbff('0x37')]=_0x234010['attributes'][_0xbbff('0x39')]?_0x234010[_0xbbff('0x37')]:_0x2096c8[_0xbbff('0x36')];if(_0x1e92d2[_0xbbff('0x32')][_0xbbff('0x44')]){_0x234010[_0xbbff('0x45')]=[{'all':!![]}];}_0x234010=_[_0xbbff('0x41')]({},_0x234010,_0x1e92d2[_0xbbff('0x4a')]);return db[_0xbbff('0x43')][_0xbbff('0x4b')](_0x234010)[_0xbbff('0x28')](handleEntityNotFound(_0x4e5dd6,null))[_0xbbff('0x28')](respondWithResult(_0x4e5dd6,null))['catch'](handleError(_0x4e5dd6,null));};exports['create']=function(_0x1e73d0,_0xe85c85){return db[_0xbbff('0x43')]['create'](_0x1e73d0[_0xbbff('0x4c')],{})[_0xbbff('0x28')](respondWithResult(_0xe85c85,0xc9))[_0xbbff('0x4d')](handleError(_0xe85c85,null));};exports['update']=function(_0x3781f4,_0xd2ddd6){if(_0x3781f4[_0xbbff('0x4c')]['id']){delete _0x3781f4[_0xbbff('0x4c')]['id'];}return db[_0xbbff('0x43')]['find']({'where':{'id':_0x3781f4[_0xbbff('0x49')]['id']}})[_0xbbff('0x28')](handleEntityNotFound(_0xd2ddd6,null))[_0xbbff('0x28')](saveUpdates(_0x3781f4[_0xbbff('0x4c')],null))['then'](respondWithResult(_0xd2ddd6,null))[_0xbbff('0x4d')](handleError(_0xd2ddd6,null));};exports['destroy']=function(_0x4011b6,_0x440d88){return db['DeskAccount'][_0xbbff('0x4b')]({'where':{'id':_0x4011b6[_0xbbff('0x49')]['id']}})[_0xbbff('0x28')](handleEntityNotFound(_0x440d88,null))[_0xbbff('0x28')](removeEntity(_0x440d88,null))[_0xbbff('0x4d')](handleError(_0x440d88,null));};exports[_0xbbff('0x4e')]=function(_0x3aa03c,_0x49c7a5,_0x24daad){var _0x304c71={};var _0xeb74b1={};var _0x56e76b;var _0x4c32dd;return db[_0xbbff('0x43')][_0xbbff('0x4f')]({'where':{'id':_0x3aa03c[_0xbbff('0x49')]['id']}})[_0xbbff('0x28')](handleEntityNotFound(_0x49c7a5,null))[_0xbbff('0x28')](function(_0x208f85){if(_0x208f85){_0x56e76b=_0x208f85;_0xeb74b1[_0xbbff('0x36')]=_[_0xbbff('0x33')](db[_0xbbff('0x50')]['rawAttributes']);_0xeb74b1[_0xbbff('0x32')]=_[_0xbbff('0x33')](_0x3aa03c['query']);_0xeb74b1[_0xbbff('0x34')]=_[_0xbbff('0x35')](_0xeb74b1[_0xbbff('0x36')],_0xeb74b1['query']);_0x304c71[_0xbbff('0x37')]=_[_0xbbff('0x35')](_0xeb74b1[_0xbbff('0x36')],qs[_0xbbff('0x38')](_0x3aa03c[_0xbbff('0x32')][_0xbbff('0x38')]));_0x304c71[_0xbbff('0x37')]=_0x304c71[_0xbbff('0x37')][_0xbbff('0x39')]?_0x304c71[_0xbbff('0x37')]:_0xeb74b1[_0xbbff('0x36')];_0x304c71[_0xbbff('0x3c')]=qs[_0xbbff('0x3d')](_0x3aa03c[_0xbbff('0x32')][_0xbbff('0x3d')]);_0x304c71['where']=qs[_0xbbff('0x34')](_[_0xbbff('0x3f')](_0x3aa03c[_0xbbff('0x32')],_0xeb74b1[_0xbbff('0x34')]));if(_0x3aa03c[_0xbbff('0x32')][_0xbbff('0x40')]){_0x304c71[_0xbbff('0x3e')]=_[_0xbbff('0x41')](_0x304c71[_0xbbff('0x3e')],{'$or':_[_0xbbff('0x2d')](_0x304c71[_0xbbff('0x37')],function(_0x3bb4ca){var _0xe33dc8={};_0xe33dc8[_0x3bb4ca]={'$like':'%'+_0x3aa03c[_0xbbff('0x32')]['filter']+'%'};return _0xe33dc8;})});}_0x304c71=_[_0xbbff('0x41')]({},_0x304c71,_0x3aa03c[_0xbbff('0x4a')]);return _0x56e76b['getConfigurations'](_0x304c71);}})[_0xbbff('0x28')](function(_0xd7b2c6){if(_0xd7b2c6){_0x4c32dd=_0xd7b2c6[_0xbbff('0x39')];if(!_0x3aa03c[_0xbbff('0x32')][_0xbbff('0x3a')]('nolimit')){_0x304c71[_0xbbff('0x22')]=qs['limit'](_0x3aa03c[_0xbbff('0x32')][_0xbbff('0x22')]);_0x304c71[_0xbbff('0x1f')]=qs[_0xbbff('0x1f')](_0x3aa03c[_0xbbff('0x32')][_0xbbff('0x1f')]);}return _0x56e76b[_0xbbff('0x4e')](_0x304c71);}})['then'](function(_0x30a457){if(_0x30a457){return _0x30a457?{'count':_0x4c32dd,'rows':_0x30a457}:null;}})[_0xbbff('0x28')](respondWithResult(_0x49c7a5,null))[_0xbbff('0x4d')](handleError(_0x49c7a5,null));};exports[_0xbbff('0x51')]=function(_0x42aa29,_0x5e7441,_0x3d25de){if(_0x42aa29[_0xbbff('0x4c')]['id']){delete _0x42aa29[_0xbbff('0x4c')]['id'];}return db[_0xbbff('0x43')]['findOne']({'where':{'id':_0x42aa29['params']['id']}})[_0xbbff('0x28')](handleEntityNotFound(_0x5e7441,null))[_0xbbff('0x28')](function(_0x48f3e1){if(_0x48f3e1){_0x42aa29[_0xbbff('0x4c')]['AccountId']=_0x48f3e1['id'];_0x42aa29['body'][_0xbbff('0x52')]=integrations[_0xbbff('0x53')](_0x42aa29[_0xbbff('0x4c')][_0xbbff('0x54')],_0x42aa29['body'][_0xbbff('0x30')]);_0x42aa29[_0xbbff('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x42aa29['body'][_0xbbff('0x54')],_0x42aa29[_0xbbff('0x4c')]['type']);return db[_0xbbff('0x50')][_0xbbff('0x55')](_0x42aa29[_0xbbff('0x4c')],{'include':[{'model':db[_0xbbff('0x56')],'as':_0xbbff('0x52')},{'model':db[_0xbbff('0x56')],'as':_0xbbff('0x57')}]});}return null;})[_0xbbff('0x28')](respondWithResult(_0x5e7441,null))['catch'](handleError(_0x5e7441,null));};exports[_0xbbff('0x58')]=function(_0x506a77,_0x505bb5,_0x50e41a){var _0x2c8527=[{'name':'priority','label':_0xbbff('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1004b0='';return db[_0xbbff('0x43')][_0xbbff('0x4f')]({'where':{'id':_0x506a77[_0xbbff('0x49')]['id']},'attributes':['id',_0xbbff('0x5a'),'authType',_0xbbff('0x5b'),'password',_0xbbff('0x5c'),_0xbbff('0x5d'),_0xbbff('0x5e'),_0xbbff('0x5f')]})[_0xbbff('0x28')](handleEntityNotFound(_0x505bb5,null))['then'](function(_0x2980da){if(_0x2980da){_0x1004b0=_0x2980da[_0xbbff('0x5a')];var _0x3b84f3=_0x1004b0['slice'](-0x1);if(_0x3b84f3==='/'){_0x1004b0=_0x1004b0[_0xbbff('0x60')](0x0,_0x1004b0[_0xbbff('0x61')](_0x3b84f3));}var _0x397727={'method':_0xbbff('0x62'),'uri':util['format'](_0xbbff('0x63'),_0x1004b0),'headers':{'Content-Type':_0xbbff('0x64'),'Accept':'application/json'},'json':!![]};if(_0x2980da[_0xbbff('0x65')]===_0xbbff('0x66')){_0x397727['headers'][_0xbbff('0x67')]=util['format'](_0xbbff('0x68'),new Buffer(util[_0xbbff('0x69')]('%s:%s',_0x2980da[_0xbbff('0x5b')],_0x2980da[_0xbbff('0x6a')]))[_0xbbff('0x6b')]('base64'));}return rp(_0x397727)['then'](function(_0x1a0166){return _0x2c8527[_0xbbff('0x6c')](_['map'](_0x1a0166[_0xbbff('0x6d')][_0xbbff('0x6e')],function(_0x519081){return{'id':_0x519081['name'],'name':_0x519081[_0xbbff('0x2a')],'type':_0x519081[_0xbbff('0x30')],'active':_0x519081['active'],'label':_0x519081[_0xbbff('0x6f')],'custom':!![]};}));});}})[_0xbbff('0x28')](function(_0x2d65fd){return{'count':_0x2d65fd['length'],'rows':_0x2d65fd};})[_0xbbff('0x28')](respondWithResult(_0x505bb5,null))[_0xbbff('0x4d')](function(_0x30dc29){var _0x4619a0=_0x506a77[_0xbbff('0x32')][_0xbbff('0x70')]?0x1f4:_0x30dc29['statusCode']||0x1f4;logger['error'](_0xbbff('0x71'),_0xbbff('0x58'),_0x4619a0,JSON[_0xbbff('0x72')](_0x30dc29));delete _0x30dc29[_0xbbff('0x2a')];if(_0x4619a0===0x191){_0x4619a0=0x190;}_0x505bb5[_0xbbff('0x1d')](_0x4619a0)[_0xbbff('0x2b')](_0x506a77[_0xbbff('0x32')][_0xbbff('0x70')]?{'message':_0xbbff('0x73'),'statusCode':_0x30dc29['statusCode']}:_0x30dc29);});}; \ No newline at end of file +var _0x02dd=['status','end','json','offset','limit','count','apply','reject','save','destroy','then','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','Subjects','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','authType','headers','Authorization','%s:%s','toString','concat','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x5449ec,_0x5a408d){var _0x14cc1d=function(_0x596506){while(--_0x596506){_0x5449ec['push'](_0x5449ec['shift']());}};_0x14cc1d(++_0x5a408d);}(_0x02dd,0x1a4));var _0xd02d=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x02dd[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xd02d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd02d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd02d('0x2'));var moment=require(_0xd02d('0x3'));var BPromise=require(_0xd02d('0x4'));var Mustache=require(_0xd02d('0x5'));var util=require(_0xd02d('0x6'));var path=require('path');var sox=require(_0xd02d('0x7'));var csv=require(_0xd02d('0x8'));var ejs=require(_0xd02d('0x9'));var fs=require('fs');var fs_extra=require(_0xd02d('0xa'));var _=require(_0xd02d('0xb'));var squel=require(_0xd02d('0xc'));var crypto=require(_0xd02d('0xd'));var jsforce=require(_0xd02d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd02d('0x8'));var querystring=require(_0xd02d('0xf'));var Papa=require(_0xd02d('0x10'));var Redis=require(_0xd02d('0x11'));var authService=require(_0xd02d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd02d('0x13'));var hardwareService=require(_0xd02d('0x14'));var logger=require('../../config/logger')(_0xd02d('0x15'));var utils=require(_0xd02d('0x16'));var config=require(_0xd02d('0x17'));var licenseUtil=require(_0xd02d('0x18'));var db=require(_0xd02d('0x19'))['db'];var integrations=require(_0xd02d('0x1a'));function respondWithStatusCode(_0x3b0037,_0x2acc8a){_0x2acc8a=_0x2acc8a||0xcc;return function(_0x5d774d){if(_0x5d774d){return _0x3b0037[_0xd02d('0x1b')](_0x2acc8a);}return _0x3b0037[_0xd02d('0x1c')](_0x2acc8a)[_0xd02d('0x1d')]();};}function respondWithResult(_0x41a663,_0x28a2ad){_0x28a2ad=_0x28a2ad||0xc8;return function(_0x3ad8a7){if(_0x3ad8a7){return _0x41a663['status'](_0x28a2ad)[_0xd02d('0x1e')](_0x3ad8a7);}};}function respondWithFilteredResult(_0xb1db57,_0x3a2503){return function(_0x9e9ef4){if(_0x9e9ef4){var _0x176f0a=typeof _0x3a2503[_0xd02d('0x1f')]==='undefined'&&typeof _0x3a2503[_0xd02d('0x20')]==='undefined';var _0x2a5e11=_0x9e9ef4[_0xd02d('0x21')];var _0x5beded=_0x176f0a?0x0:_0x3a2503['offset'];var _0x4e3c16=_0x176f0a?_0x9e9ef4['count']:_0x3a2503[_0xd02d('0x1f')]+_0x3a2503[_0xd02d('0x20')];var _0x278fe8;if(_0x4e3c16>=_0x2a5e11){_0x4e3c16=_0x2a5e11;_0x278fe8=0xc8;}else{_0x278fe8=0xce;}_0xb1db57[_0xd02d('0x1c')](_0x278fe8);return _0xb1db57['set']('Content-Range',_0x5beded+'-'+_0x4e3c16+'/'+_0x2a5e11)[_0xd02d('0x1e')](_0x9e9ef4);}return null;};}function patchUpdates(_0x5134c4){return function(_0x5753b0){try{jsonpatch[_0xd02d('0x22')](_0x5753b0,_0x5134c4,!![]);}catch(_0x3a5e1a){return BPromise[_0xd02d('0x23')](_0x3a5e1a);}return _0x5753b0[_0xd02d('0x24')]();};}function saveUpdates(_0x3e942c,_0x1de9e4){return function(_0x1c98dd){if(_0x1c98dd){return _0x1c98dd['update'](_0x3e942c)['then'](function(_0x1a893c){return _0x1a893c;});}return null;};}function removeEntity(_0x363ff0,_0x2f9e78){return function(_0x78a3fb){if(_0x78a3fb){return _0x78a3fb[_0xd02d('0x25')]()[_0xd02d('0x26')](function(){_0x363ff0[_0xd02d('0x1c')](0xcc)[_0xd02d('0x1d')]();});}};}function handleEntityNotFound(_0x5f71d9,_0x3cdad2){return function(_0x267fb9){if(!_0x267fb9){_0x5f71d9[_0xd02d('0x1b')](0x194);}return _0x267fb9;};}function handleError(_0x3c7197,_0x3e78a0){_0x3e78a0=_0x3e78a0||0x1f4;return function(_0x2d3fb3){logger[_0xd02d('0x27')](_0x2d3fb3[_0xd02d('0x28')]);if(_0x2d3fb3['name']){delete _0x2d3fb3[_0xd02d('0x29')];}_0x3c7197['status'](_0x3e78a0)[_0xd02d('0x2a')](_0x2d3fb3);};}exports['index']=function(_0x30d433,_0x49a1cd){var _0x583fbf={},_0x362029={},_0x497291={'count':0x0,'rows':[]};var _0x235dea=_[_0xd02d('0x2b')](db[_0xd02d('0x2c')][_0xd02d('0x2d')],function(_0x37b062){return{'name':_0x37b062[_0xd02d('0x2e')],'type':_0x37b062[_0xd02d('0x2f')][_0xd02d('0x30')]};});_0x362029[_0xd02d('0x31')]=_[_0xd02d('0x2b')](_0x235dea,_0xd02d('0x29'));_0x362029['query']=_['keys'](_0x30d433[_0xd02d('0x32')]);_0x362029[_0xd02d('0x33')]=_[_0xd02d('0x34')](_0x362029[_0xd02d('0x31')],_0x362029[_0xd02d('0x32')]);_0x583fbf[_0xd02d('0x35')]=_[_0xd02d('0x34')](_0x362029[_0xd02d('0x31')],qs[_0xd02d('0x36')](_0x30d433[_0xd02d('0x32')][_0xd02d('0x36')]));_0x583fbf['attributes']=_0x583fbf[_0xd02d('0x35')][_0xd02d('0x37')]?_0x583fbf[_0xd02d('0x35')]:_0x362029[_0xd02d('0x31')];if(!_0x30d433[_0xd02d('0x32')]['hasOwnProperty'](_0xd02d('0x38'))){_0x583fbf[_0xd02d('0x20')]=qs[_0xd02d('0x20')](_0x30d433[_0xd02d('0x32')][_0xd02d('0x20')]);_0x583fbf[_0xd02d('0x1f')]=qs[_0xd02d('0x1f')](_0x30d433[_0xd02d('0x32')][_0xd02d('0x1f')]);}_0x583fbf[_0xd02d('0x39')]=qs['sort'](_0x30d433[_0xd02d('0x32')][_0xd02d('0x3a')]);_0x583fbf[_0xd02d('0x3b')]=qs[_0xd02d('0x33')](_[_0xd02d('0x3c')](_0x30d433[_0xd02d('0x32')],_0x362029[_0xd02d('0x33')]),_0x235dea);if(_0x30d433[_0xd02d('0x32')][_0xd02d('0x3d')]){_0x583fbf['where']=_[_0xd02d('0x3e')](_0x583fbf[_0xd02d('0x3b')],{'$or':_[_0xd02d('0x2b')](_0x235dea,function(_0x41959f){if(_0x41959f[_0xd02d('0x2f')]!=='VIRTUAL'){var _0xaa5f06={};_0xaa5f06[_0x41959f[_0xd02d('0x29')]]={'$like':'%'+_0x30d433[_0xd02d('0x32')]['filter']+'%'};return _0xaa5f06;}})});}_0x583fbf=_[_0xd02d('0x3e')]({},_0x583fbf,_0x30d433[_0xd02d('0x3f')]);var _0x27890a={'where':_0x583fbf[_0xd02d('0x3b')]};return db[_0xd02d('0x2c')][_0xd02d('0x21')](_0x27890a)[_0xd02d('0x26')](function(_0x349783){_0x497291[_0xd02d('0x21')]=_0x349783;if(_0x30d433[_0xd02d('0x32')][_0xd02d('0x40')]){_0x583fbf[_0xd02d('0x41')]=[{'all':!![]}];}return db[_0xd02d('0x2c')][_0xd02d('0x42')](_0x583fbf);})[_0xd02d('0x26')](function(_0x578937){_0x497291[_0xd02d('0x43')]=_0x578937;return _0x497291;})[_0xd02d('0x26')](respondWithFilteredResult(_0x49a1cd,_0x583fbf))[_0xd02d('0x44')](handleError(_0x49a1cd,null));};exports[_0xd02d('0x45')]=function(_0x26e1ee,_0xc44e32){var _0x25a072={'raw':![],'where':{'id':_0x26e1ee['params']['id']}},_0x535b32={};_0x535b32[_0xd02d('0x31')]=_[_0xd02d('0x46')](db[_0xd02d('0x2c')]['rawAttributes']);_0x535b32[_0xd02d('0x32')]=_['keys'](_0x26e1ee[_0xd02d('0x32')]);_0x535b32[_0xd02d('0x33')]=_[_0xd02d('0x34')](_0x535b32[_0xd02d('0x31')],_0x535b32[_0xd02d('0x32')]);_0x25a072['attributes']=_[_0xd02d('0x34')](_0x535b32[_0xd02d('0x31')],qs[_0xd02d('0x36')](_0x26e1ee['query'][_0xd02d('0x36')]));_0x25a072[_0xd02d('0x35')]=_0x25a072['attributes'][_0xd02d('0x37')]?_0x25a072[_0xd02d('0x35')]:_0x535b32[_0xd02d('0x31')];if(_0x26e1ee[_0xd02d('0x32')]['includeAll']){_0x25a072[_0xd02d('0x41')]=[{'all':!![]}];}_0x25a072=_[_0xd02d('0x3e')]({},_0x25a072,_0x26e1ee[_0xd02d('0x3f')]);return db[_0xd02d('0x2c')][_0xd02d('0x47')](_0x25a072)[_0xd02d('0x26')](handleEntityNotFound(_0xc44e32,null))[_0xd02d('0x26')](respondWithResult(_0xc44e32,null))[_0xd02d('0x44')](handleError(_0xc44e32,null));};exports[_0xd02d('0x48')]=function(_0x3f4c3e,_0x96130e){return db[_0xd02d('0x2c')]['create'](_0x3f4c3e[_0xd02d('0x49')],{})[_0xd02d('0x26')](respondWithResult(_0x96130e,0xc9))[_0xd02d('0x44')](handleError(_0x96130e,null));};exports[_0xd02d('0x4a')]=function(_0x40cbf5,_0x28c096){if(_0x40cbf5['body']['id']){delete _0x40cbf5[_0xd02d('0x49')]['id'];}return db['DeskAccount'][_0xd02d('0x47')]({'where':{'id':_0x40cbf5[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x28c096,null))[_0xd02d('0x26')](saveUpdates(_0x40cbf5['body'],null))[_0xd02d('0x26')](respondWithResult(_0x28c096,null))[_0xd02d('0x44')](handleError(_0x28c096,null));};exports[_0xd02d('0x25')]=function(_0x49c9bc,_0x3eec2e){return db[_0xd02d('0x2c')]['find']({'where':{'id':_0x49c9bc[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x3eec2e,null))[_0xd02d('0x26')](removeEntity(_0x3eec2e,null))[_0xd02d('0x44')](handleError(_0x3eec2e,null));};exports[_0xd02d('0x4c')]=function(_0x2c8cd0,_0x1452c0,_0x44a2b0){var _0x50c27b={};var _0x230d58={};var _0x53483e;var _0x7651d8;return db['DeskAccount'][_0xd02d('0x4d')]({'where':{'id':_0x2c8cd0[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x1452c0,null))[_0xd02d('0x26')](function(_0x1f7f37){if(_0x1f7f37){_0x53483e=_0x1f7f37;_0x230d58[_0xd02d('0x31')]=_['keys'](db['DeskConfiguration'][_0xd02d('0x2d')]);_0x230d58[_0xd02d('0x32')]=_[_0xd02d('0x46')](_0x2c8cd0['query']);_0x230d58[_0xd02d('0x33')]=_[_0xd02d('0x34')](_0x230d58[_0xd02d('0x31')],_0x230d58[_0xd02d('0x32')]);_0x50c27b[_0xd02d('0x35')]=_[_0xd02d('0x34')](_0x230d58[_0xd02d('0x31')],qs[_0xd02d('0x36')](_0x2c8cd0[_0xd02d('0x32')]['fields']));_0x50c27b['attributes']=_0x50c27b[_0xd02d('0x35')][_0xd02d('0x37')]?_0x50c27b[_0xd02d('0x35')]:_0x230d58['model'];_0x50c27b[_0xd02d('0x39')]=qs[_0xd02d('0x3a')](_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x3a')]);_0x50c27b[_0xd02d('0x3b')]=qs[_0xd02d('0x33')](_[_0xd02d('0x3c')](_0x2c8cd0[_0xd02d('0x32')],_0x230d58[_0xd02d('0x33')]));if(_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x3d')]){_0x50c27b[_0xd02d('0x3b')]=_['merge'](_0x50c27b[_0xd02d('0x3b')],{'$or':_[_0xd02d('0x2b')](_0x50c27b[_0xd02d('0x35')],function(_0x1deb49){var _0x1d1757={};_0x1d1757[_0x1deb49]={'$like':'%'+_0x2c8cd0['query'][_0xd02d('0x3d')]+'%'};return _0x1d1757;})});}_0x50c27b=_['merge']({},_0x50c27b,_0x2c8cd0[_0xd02d('0x3f')]);return _0x53483e['getConfigurations'](_0x50c27b);}})[_0xd02d('0x26')](function(_0x120039){if(_0x120039){_0x7651d8=_0x120039['length'];if(!_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x4e')](_0xd02d('0x38'))){_0x50c27b[_0xd02d('0x20')]=qs['limit'](_0x2c8cd0[_0xd02d('0x32')][_0xd02d('0x20')]);_0x50c27b[_0xd02d('0x1f')]=qs[_0xd02d('0x1f')](_0x2c8cd0['query'][_0xd02d('0x1f')]);}return _0x53483e[_0xd02d('0x4c')](_0x50c27b);}})[_0xd02d('0x26')](function(_0x32de45){if(_0x32de45){return _0x32de45?{'count':_0x7651d8,'rows':_0x32de45}:null;}})[_0xd02d('0x26')](respondWithResult(_0x1452c0,null))[_0xd02d('0x44')](handleError(_0x1452c0,null));};exports[_0xd02d('0x4f')]=function(_0x335754,_0x4af829,_0x2cb78e){if(_0x335754[_0xd02d('0x49')]['id']){delete _0x335754[_0xd02d('0x49')]['id'];}return db[_0xd02d('0x2c')][_0xd02d('0x4d')]({'where':{'id':_0x335754[_0xd02d('0x4b')]['id']}})[_0xd02d('0x26')](handleEntityNotFound(_0x4af829,null))[_0xd02d('0x26')](function(_0x4cddaa){if(_0x4cddaa){_0x335754[_0xd02d('0x49')]['AccountId']=_0x4cddaa['id'];_0x335754[_0xd02d('0x49')]['Subjects']=integrations[_0xd02d('0x50')](_0x335754[_0xd02d('0x49')][_0xd02d('0x51')],_0x335754[_0xd02d('0x49')][_0xd02d('0x2f')]);_0x335754['body'][_0xd02d('0x52')]=integrations[_0xd02d('0x53')](_0x335754['body'][_0xd02d('0x51')],_0x335754[_0xd02d('0x49')][_0xd02d('0x2f')]);return db[_0xd02d('0x54')][_0xd02d('0x48')](_0x335754['body'],{'include':[{'model':db[_0xd02d('0x55')],'as':_0xd02d('0x56')},{'model':db['DeskField'],'as':_0xd02d('0x52')}]});}return null;})['then'](respondWithResult(_0x4af829,null))[_0xd02d('0x44')](handleError(_0x4af829,null));};exports[_0xd02d('0x57')]=function(_0x457608,_0x2cd232,_0x4833ca){var _0x31762e=[{'name':_0xd02d('0x58'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x34ce2f='';return db[_0xd02d('0x2c')][_0xd02d('0x4d')]({'where':{'id':_0x457608[_0xd02d('0x4b')]['id']},'attributes':['id',_0xd02d('0x59'),'authType',_0xd02d('0x5a'),_0xd02d('0x5b'),_0xd02d('0x5c'),_0xd02d('0x5d'),'token',_0xd02d('0x5e')]})[_0xd02d('0x26')](handleEntityNotFound(_0x2cd232,null))[_0xd02d('0x26')](function(_0x3996cd){if(_0x3996cd){_0x34ce2f=_0x3996cd[_0xd02d('0x59')];var _0x4b6d43=_0x34ce2f[_0xd02d('0x5f')](-0x1);if(_0x4b6d43==='/'){_0x34ce2f=_0x34ce2f[_0xd02d('0x60')](0x0,_0x34ce2f[_0xd02d('0x61')](_0x4b6d43));}var _0x9c267a={'method':_0xd02d('0x62'),'uri':util[_0xd02d('0x63')]('%s/custom_fields',_0x34ce2f),'headers':{'Content-Type':_0xd02d('0x64'),'Accept':_0xd02d('0x64')},'json':!![]};if(_0x3996cd[_0xd02d('0x65')]==='basic'){_0x9c267a[_0xd02d('0x66')][_0xd02d('0x67')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0xd02d('0x68'),_0x3996cd[_0xd02d('0x5a')],_0x3996cd['password']))[_0xd02d('0x69')]('base64'));}return rp(_0x9c267a)['then'](function(_0x4ce2aa){return _0x31762e[_0xd02d('0x6a')](_['map'](_0x4ce2aa['_embedded'][_0xd02d('0x6b')],function(_0x1d1cb8){return{'id':_0x1d1cb8[_0xd02d('0x29')],'name':_0x1d1cb8[_0xd02d('0x29')],'type':_0x1d1cb8[_0xd02d('0x2f')],'active':_0x1d1cb8['active'],'label':_0x1d1cb8[_0xd02d('0x6c')],'custom':!![]};}));});}})['then'](function(_0x441f4f){return{'count':_0x441f4f[_0xd02d('0x37')],'rows':_0x441f4f};})[_0xd02d('0x26')](respondWithResult(_0x2cd232,null))[_0xd02d('0x44')](function(_0x4127de){var _0x5db9cd=_0x457608[_0xd02d('0x32')]['test']?0x1f4:_0x4127de[_0xd02d('0x6d')]||0x1f4;logger['error'](_0xd02d('0x6e'),_0xd02d('0x57'),_0x5db9cd,JSON['stringify'](_0x4127de));delete _0x4127de['name'];if(_0x5db9cd===0x191){_0x5db9cd=0x190;}_0x2cd232['status'](_0x5db9cd)[_0xd02d('0x2a')](_0x457608[_0xd02d('0x32')][_0xd02d('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4127de[_0xd02d('0x6d')]}:_0x4127de);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b1a1acd..6555b40 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 _0xecf8=['../../config/logger','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xecf8,0xfb));var _0x8ecf=function(_0xd50518,_0x255c1b){_0xd50518=_0xd50518-0x0;var _0x55f86f=_0xecf8[_0xd50518];return _0x55f86f;};'use strict';var _=require('lodash');var util=require(_0x8ecf('0x0'));var logger=require(_0x8ecf('0x1'))(_0x8ecf('0x2'));var moment=require(_0x8ecf('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ecf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ecf('0x5'));var attributes=require(_0x8ecf('0x6'));var integrations=require(_0x8ecf('0x7'));module[_0x8ecf('0x8')]=function(_0x342d1e,_0x2b9ddd){return _0x342d1e[_0x8ecf('0x9')](_0x8ecf('0xa'),attributes,{'tableName':_0x8ecf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fbc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','util','../../config/logger'];(function(_0x1a656f,_0x42eeda){var _0x523fa6=function(_0x1afd3c){while(--_0x1afd3c){_0x1a656f['push'](_0x1a656f['shift']());}};_0x523fa6(++_0x42eeda);}(_0x3fbc,0xe8));var _0xc3fb=function(_0xc4bb1f,_0x2405c9){_0xc4bb1f=_0xc4bb1f-0x0;var _0x4b3759=_0x3fbc[_0xc4bb1f];return _0x4b3759;};'use strict';var _=require('lodash');var util=require(_0xc3fb('0x0'));var logger=require(_0xc3fb('0x1'))(_0xc3fb('0x2'));var moment=require(_0xc3fb('0x3'));var BPromise=require(_0xc3fb('0x4'));var rp=require(_0xc3fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3fb('0x6'));var config=require(_0xc3fb('0x7'));var attributes=require(_0xc3fb('0x8'));var integrations=require(_0xc3fb('0x9'));module['exports']=function(_0x31dee2,_0x52d6b4){return _0x31dee2[_0xc3fb('0xa')](_0xc3fb('0xb'),attributes,{'tableName':_0xc3fb('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 1ce8ad5..ee5272c 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 _0x9d70=['include','map','model','catch','ShowDeskAccount','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','code','error','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x3d9918,_0x208cff){var _0xd9bb25=function(_0x1d922b){while(--_0x1d922b){_0x3d9918['push'](_0x3d9918['shift']());}};_0xd9bb25(++_0x208cff);}(_0x9d70,0x1e1));var _0x09d7=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x9d70[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require(_0x09d7('0x0'));var moment=require(_0x09d7('0x1'));var BPromise=require(_0x09d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09d7('0x3'));var db=require(_0x09d7('0x4'))['db'];var utils=require(_0x09d7('0x5'));var logger=require(_0x09d7('0x6'))(_0x09d7('0x7'));var config=require(_0x09d7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x09d7('0x9')][_0x09d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4239f7,_0x59da6b,_0x210a87){return new BPromise(function(_0x3b604b,_0xb08386){return client['request'](_0x4239f7,_0x210a87)[_0x09d7('0xb')](function(_0xa3881f){logger[_0x09d7('0xc')]('DeskAccount,\x20%s,\x20%s',_0x59da6b,_0x09d7('0xd'));logger[_0x09d7('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x59da6b,'request\x20sent',JSON[_0x09d7('0xf')](_0xa3881f));if(_0xa3881f['error']){if(_0xa3881f['error'][_0x09d7('0x10')]===0x1f4){logger[_0x09d7('0x11')](_0x09d7('0x12'),_0x59da6b,_0xa3881f[_0x09d7('0x11')][_0x09d7('0x13')]);return _0xb08386(_0xa3881f[_0x09d7('0x11')][_0x09d7('0x13')]);}logger[_0x09d7('0x11')](_0x09d7('0x12'),_0x59da6b,_0xa3881f[_0x09d7('0x11')][_0x09d7('0x13')]);return _0x3b604b(_0xa3881f[_0x09d7('0x11')][_0x09d7('0x13')]);}else{logger[_0x09d7('0xc')](_0x09d7('0x12'),_0x59da6b,_0x09d7('0xd'));_0x3b604b(_0xa3881f[_0x09d7('0x14')]['message']);}})['catch'](function(_0xdeceb){logger[_0x09d7('0x11')](_0x09d7('0x12'),_0x59da6b,_0xdeceb);_0xb08386(_0xdeceb);});});}exports[_0x09d7('0x15')]=function(_0x9a1cfd){var _0x2423a9=this;return new Promise(function(_0x3b8814,_0x4008ce){return db[_0x09d7('0x16')][_0x09d7('0x17')]({'raw':_0x9a1cfd[_0x09d7('0x18')]?_0x9a1cfd['options'][_0x09d7('0x19')]===undefined?!![]:![]:!![],'where':_0x9a1cfd['options']?_0x9a1cfd[_0x09d7('0x18')][_0x09d7('0x1a')]||null:null,'attributes':_0x9a1cfd[_0x09d7('0x18')]?_0x9a1cfd[_0x09d7('0x18')][_0x09d7('0x1b')]||null:null,'limit':_0x9a1cfd[_0x09d7('0x18')]?_0x9a1cfd[_0x09d7('0x18')][_0x09d7('0x1c')]||null:null,'include':_0x9a1cfd[_0x09d7('0x18')]?_0x9a1cfd[_0x09d7('0x18')][_0x09d7('0x1d')]?_[_0x09d7('0x1e')](_0x9a1cfd[_0x09d7('0x18')][_0x09d7('0x1d')],function(_0x1ee895){return{'model':db[_0x1ee895[_0x09d7('0x1f')]],'as':_0x1ee895['as'],'attributes':_0x1ee895[_0x09d7('0x1b')],'include':_0x1ee895[_0x09d7('0x1d')]?_[_0x09d7('0x1e')](_0x1ee895[_0x09d7('0x1d')],function(_0x416bf2){return{'model':db[_0x416bf2[_0x09d7('0x1f')]],'as':_0x416bf2['as'],'attributes':_0x416bf2[_0x09d7('0x1b')],'include':_0x416bf2[_0x09d7('0x1d')]?_[_0x09d7('0x1e')](_0x416bf2[_0x09d7('0x1d')],function(_0x36201e){return{'model':db[_0x36201e['model']],'as':_0x36201e['as'],'attributes':_0x36201e[_0x09d7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x09d7('0xb')](function(_0x2fe511){logger['info']('GetDeskAccount',_0x9a1cfd);logger[_0x09d7('0xe')]('GetDeskAccount',_0x9a1cfd,JSON[_0x09d7('0xf')](_0x2fe511));_0x3b8814(_0x2fe511);})[_0x09d7('0x20')](function(_0x24e7a7){logger[_0x09d7('0x11')](_0x09d7('0x15'),_0x24e7a7[_0x09d7('0x13')],_0x9a1cfd);_0x4008ce(_0x2423a9[_0x09d7('0x11')](0x1f4,_0x24e7a7[_0x09d7('0x13')]));});});};exports[_0x09d7('0x21')]=function(_0x58c3a6){var _0x48820f=this;return new Promise(function(_0x367395,_0x41a37e){return db[_0x09d7('0x16')]['find']({'raw':_0x58c3a6[_0x09d7('0x18')]?_0x58c3a6[_0x09d7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58c3a6[_0x09d7('0x18')]?_0x58c3a6[_0x09d7('0x18')][_0x09d7('0x1a')]||null:null,'attributes':_0x58c3a6[_0x09d7('0x18')]?_0x58c3a6['options'][_0x09d7('0x1b')]||null:null,'include':_0x58c3a6[_0x09d7('0x18')]?_0x58c3a6['options'][_0x09d7('0x1d')]?_[_0x09d7('0x1e')](_0x58c3a6[_0x09d7('0x18')][_0x09d7('0x1d')],function(_0x56a9cb){return{'model':db[_0x56a9cb[_0x09d7('0x1f')]],'as':_0x56a9cb['as'],'attributes':_0x56a9cb[_0x09d7('0x1b')],'include':_0x56a9cb[_0x09d7('0x1d')]?_['map'](_0x56a9cb['include'],function(_0x32d94e){return{'model':db[_0x32d94e[_0x09d7('0x1f')]],'as':_0x32d94e['as'],'attributes':_0x32d94e['attributes'],'include':_0x32d94e[_0x09d7('0x1d')]?_[_0x09d7('0x1e')](_0x32d94e[_0x09d7('0x1d')],function(_0x4351c2){return{'model':db[_0x4351c2[_0x09d7('0x1f')]],'as':_0x4351c2['as'],'attributes':_0x4351c2[_0x09d7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x09d7('0xb')](function(_0x134330){logger[_0x09d7('0xc')](_0x09d7('0x21'),_0x58c3a6);logger[_0x09d7('0xe')](_0x09d7('0x21'),_0x58c3a6,JSON[_0x09d7('0xf')](_0x134330));_0x367395(_0x134330);})['catch'](function(_0x13bbeb){logger[_0x09d7('0x11')](_0x09d7('0x21'),_0x13bbeb[_0x09d7('0x13')],_0x58c3a6);_0x41a37e(_0x48820f['error'](0x1f4,_0x13bbeb[_0x09d7('0x13')]));});});}; \ No newline at end of file +var _0x869c=['debug','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x28e911,_0x541615){var _0xc09e2a=function(_0x1379f6){while(--_0x1379f6){_0x28e911['push'](_0x28e911['shift']());}};_0xc09e2a(++_0x541615);}(_0x869c,0x150));var _0xc869=function(_0x4090e2,_0x3c77ee){_0x4090e2=_0x4090e2-0x0;var _0x44b887=_0x869c[_0x4090e2];return _0x44b887;};'use strict';var _=require(_0xc869('0x0'));var util=require(_0xc869('0x1'));var moment=require(_0xc869('0x2'));var BPromise=require(_0xc869('0x3'));var rs=require(_0xc869('0x4'));var fs=require('fs');var Redis=require(_0xc869('0x5'));var db=require(_0xc869('0x6'))['db'];var utils=require(_0xc869('0x7'));var logger=require('../../config/logger')(_0xc869('0x8'));var config=require(_0xc869('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc869('0xa')][_0xc869('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578827,_0x3f62f5,_0x53e280){return new BPromise(function(_0x23cad3,_0x559bf4){return client[_0xc869('0xc')](_0x578827,_0x53e280)[_0xc869('0xd')](function(_0x3dce50){logger[_0xc869('0xe')](_0xc869('0xf'),_0x3f62f5,'request\x20sent');logger['debug'](_0xc869('0x10'),_0x3f62f5,_0xc869('0x11'),JSON['stringify'](_0x3dce50));if(_0x3dce50[_0xc869('0x12')]){if(_0x3dce50[_0xc869('0x12')][_0xc869('0x13')]===0x1f4){logger['error'](_0xc869('0xf'),_0x3f62f5,_0x3dce50[_0xc869('0x12')]['message']);return _0x559bf4(_0x3dce50[_0xc869('0x12')][_0xc869('0x14')]);}logger[_0xc869('0x12')](_0xc869('0xf'),_0x3f62f5,_0x3dce50['error']['message']);return _0x23cad3(_0x3dce50[_0xc869('0x12')]['message']);}else{logger['info'](_0xc869('0xf'),_0x3f62f5,_0xc869('0x11'));_0x23cad3(_0x3dce50[_0xc869('0x15')][_0xc869('0x14')]);}})[_0xc869('0x16')](function(_0x489a60){logger['error'](_0xc869('0xf'),_0x3f62f5,_0x489a60);_0x559bf4(_0x489a60);});});}exports[_0xc869('0x17')]=function(_0x326111){var _0x5d1cae=this;return new Promise(function(_0x40a6a7,_0x4cd585){return db[_0xc869('0x18')][_0xc869('0x19')]({'raw':_0x326111[_0xc869('0x1a')]?_0x326111[_0xc869('0x1a')][_0xc869('0x1b')]===undefined?!![]:![]:!![],'where':_0x326111['options']?_0x326111['options'][_0xc869('0x1c')]||null:null,'attributes':_0x326111['options']?_0x326111['options'][_0xc869('0x1d')]||null:null,'limit':_0x326111['options']?_0x326111[_0xc869('0x1a')][_0xc869('0x1e')]||null:null,'include':_0x326111[_0xc869('0x1a')]?_0x326111['options'][_0xc869('0x1f')]?_[_0xc869('0x20')](_0x326111[_0xc869('0x1a')]['include'],function(_0x3f48f4){return{'model':db[_0x3f48f4['model']],'as':_0x3f48f4['as'],'attributes':_0x3f48f4[_0xc869('0x1d')],'include':_0x3f48f4['include']?_[_0xc869('0x20')](_0x3f48f4[_0xc869('0x1f')],function(_0x4a7c19){return{'model':db[_0x4a7c19[_0xc869('0x21')]],'as':_0x4a7c19['as'],'attributes':_0x4a7c19[_0xc869('0x1d')],'include':_0x4a7c19[_0xc869('0x1f')]?_[_0xc869('0x20')](_0x4a7c19['include'],function(_0x190369){return{'model':db[_0x190369[_0xc869('0x21')]],'as':_0x190369['as'],'attributes':_0x190369[_0xc869('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b725d){logger[_0xc869('0xe')]('GetDeskAccount',_0x326111);logger[_0xc869('0x22')](_0xc869('0x17'),_0x326111,JSON['stringify'](_0x5b725d));_0x40a6a7(_0x5b725d);})[_0xc869('0x16')](function(_0x43fdf7){logger[_0xc869('0x12')](_0xc869('0x17'),_0x43fdf7[_0xc869('0x14')],_0x326111);_0x4cd585(_0x5d1cae[_0xc869('0x12')](0x1f4,_0x43fdf7[_0xc869('0x14')]));});});};exports['ShowDeskAccount']=function(_0x181c0f){var _0x28458b=this;return new Promise(function(_0x4201e0,_0x2c320c){return db[_0xc869('0x18')][_0xc869('0x23')]({'raw':_0x181c0f['options']?_0x181c0f[_0xc869('0x1a')][_0xc869('0x1b')]===undefined?!![]:![]:!![],'where':_0x181c0f['options']?_0x181c0f['options'][_0xc869('0x1c')]||null:null,'attributes':_0x181c0f[_0xc869('0x1a')]?_0x181c0f[_0xc869('0x1a')][_0xc869('0x1d')]||null:null,'include':_0x181c0f['options']?_0x181c0f['options'][_0xc869('0x1f')]?_['map'](_0x181c0f['options'][_0xc869('0x1f')],function(_0x18ef52){return{'model':db[_0x18ef52[_0xc869('0x21')]],'as':_0x18ef52['as'],'attributes':_0x18ef52[_0xc869('0x1d')],'include':_0x18ef52[_0xc869('0x1f')]?_[_0xc869('0x20')](_0x18ef52[_0xc869('0x1f')],function(_0x16b101){return{'model':db[_0x16b101[_0xc869('0x21')]],'as':_0x16b101['as'],'attributes':_0x16b101[_0xc869('0x1d')],'include':_0x16b101[_0xc869('0x1f')]?_[_0xc869('0x20')](_0x16b101[_0xc869('0x1f')],function(_0x1cad33){return{'model':db[_0x1cad33[_0xc869('0x21')]],'as':_0x1cad33['as'],'attributes':_0x1cad33[_0xc869('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x223e0d){logger['info']('ShowDeskAccount',_0x181c0f);logger[_0xc869('0x22')]('ShowDeskAccount',_0x181c0f,JSON[_0xc869('0x24')](_0x223e0d));_0x4201e0(_0x223e0d);})[_0xc869('0x16')](function(_0x271ed2){logger[_0xc869('0x12')]('ShowDeskAccount',_0x271ed2['message'],_0x181c0f);_0x2c320c(_0x28458b[_0xc869('0x12')](0x1f4,_0x271ed2['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index eb8e5e9..cacd7d5 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(_0x236f93,_0x374b6e){var _0x5eef36=function(_0x32173d){while(--_0x32173d){_0x236f93['push'](_0x236f93['shift']());}};_0x5eef36(++_0x374b6e);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x4db07d,_0x41b038){var _0xd4ec5a=function(_0x5f3cf0){while(--_0x5f3cf0){_0x4db07d['push'](_0x4db07d['shift']());}};_0xd4ec5a(++_0x41b038);}(_0xedd9,0xfc));var _0x9edd=function(_0x341978,_0x444c42){_0x341978=_0x341978-0x0;var _0x223840=_0xedd9[_0x341978];return _0x223840;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 04ec686..1293883 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 _0xebd8=['STRING','sequelize','exports'];(function(_0x3f4ff9,_0x2f2483){var _0x297ad1=function(_0x1334c6){while(--_0x1334c6){_0x3f4ff9['push'](_0x3f4ff9['shift']());}};_0x297ad1(++_0x2f2483);}(_0xebd8,0x1d5));var _0x8ebd=function(_0x3faf32,_0x3fbf16){_0x3faf32=_0x3faf32-0x0;var _0x3aa981=_0xebd8[_0x3faf32];return _0x3aa981;};'use strict';var Sequelize=require(_0x8ebd('0x0'));module[_0x8ebd('0x1')]={'name':{'type':Sequelize[_0x8ebd('0x2')]},'description':{'type':Sequelize[_0x8ebd('0x2')]}}; \ No newline at end of file +var _0x2d38=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d38,0x145));var _0x82d3=function(_0x500a1f,_0x14745f){_0x500a1f=_0x500a1f-0x0;var _0x2f5bd7=_0x2d38[_0x500a1f];return _0x2f5bd7;};'use strict';var Sequelize=require(_0x82d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x82d3('0x1')]},'description':{'type':Sequelize[_0x82d3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 150d335..deeb9fa 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 _0x6c27=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','DeskConfiguration','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','name','options','includeAll','findAll','catch','show','rawAttributes','include','merge','find','create','body','params','getFields','findOne','length','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x49b153,_0x194075){var _0x127ef2=function(_0x2338e1){while(--_0x2338e1){_0x49b153['push'](_0x49b153['shift']());}};_0x127ef2(++_0x194075);}(_0x6c27,0xf2));var _0x76c2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6c27[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x76c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76c2('0x1'));var jsonpatch=require(_0x76c2('0x2'));var rp=require(_0x76c2('0x3'));var moment=require(_0x76c2('0x4'));var BPromise=require(_0x76c2('0x5'));var Mustache=require(_0x76c2('0x6'));var util=require('util');var path=require(_0x76c2('0x7'));var sox=require(_0x76c2('0x8'));var csv=require(_0x76c2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76c2('0xa'));var _=require(_0x76c2('0xb'));var squel=require(_0x76c2('0xc'));var crypto=require('crypto');var jsforce=require(_0x76c2('0xd'));var deskjs=require(_0x76c2('0xe'));var toCsv=require(_0x76c2('0x9'));var querystring=require(_0x76c2('0xf'));var Papa=require(_0x76c2('0x10'));var Redis=require(_0x76c2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x76c2('0x12'));var as=require(_0x76c2('0x13'));var hardwareService=require(_0x76c2('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x76c2('0x15'));var config=require(_0x76c2('0x16'));var licenseUtil=require(_0x76c2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae67f6,_0x266f40){_0x266f40=_0x266f40||0xcc;return function(_0x3b6942){if(_0x3b6942){return _0xae67f6[_0x76c2('0x18')](_0x266f40);}return _0xae67f6[_0x76c2('0x19')](_0x266f40)[_0x76c2('0x1a')]();};}function respondWithResult(_0x500f43,_0x2c08e9){_0x2c08e9=_0x2c08e9||0xc8;return function(_0x559d2f){if(_0x559d2f){return _0x500f43[_0x76c2('0x19')](_0x2c08e9)[_0x76c2('0x1b')](_0x559d2f);}};}function respondWithFilteredResult(_0x58b091,_0xb7015a){return function(_0x146eb4){if(_0x146eb4){var _0x47b1eb=typeof _0xb7015a[_0x76c2('0x1c')]===_0x76c2('0x1d')&&typeof _0xb7015a[_0x76c2('0x1e')]===_0x76c2('0x1d');var _0x4ca5bf=_0x146eb4[_0x76c2('0x1f')];var _0x1e0e24=_0x47b1eb?0x0:_0xb7015a[_0x76c2('0x1c')];var _0x4b5d1e=_0x47b1eb?_0x146eb4['count']:_0xb7015a[_0x76c2('0x1c')]+_0xb7015a[_0x76c2('0x1e')];var _0x383765;if(_0x4b5d1e>=_0x4ca5bf){_0x4b5d1e=_0x4ca5bf;_0x383765=0xc8;}else{_0x383765=0xce;}_0x58b091['status'](_0x383765);return _0x58b091[_0x76c2('0x20')](_0x76c2('0x21'),_0x1e0e24+'-'+_0x4b5d1e+'/'+_0x4ca5bf)[_0x76c2('0x1b')](_0x146eb4);}return null;};}function patchUpdates(_0x34d5b8){return function(_0x52fc0c){try{jsonpatch[_0x76c2('0x22')](_0x52fc0c,_0x34d5b8,!![]);}catch(_0x497567){return BPromise[_0x76c2('0x23')](_0x497567);}return _0x52fc0c[_0x76c2('0x24')]();};}function saveUpdates(_0x54565e,_0x39c007){return function(_0x23f6bf){if(_0x23f6bf){return _0x23f6bf[_0x76c2('0x25')](_0x54565e)[_0x76c2('0x26')](function(_0x3950f4){return _0x3950f4;});}return null;};}function removeEntity(_0x3c5bf3,_0x253d7c){return function(_0x43f768){if(_0x43f768){return _0x43f768[_0x76c2('0x27')]()[_0x76c2('0x26')](function(){_0x3c5bf3[_0x76c2('0x19')](0xcc)[_0x76c2('0x1a')]();});}};}function handleEntityNotFound(_0x5a6268,_0x4f0f88){return function(_0x522fa9){if(!_0x522fa9){_0x5a6268[_0x76c2('0x18')](0x194);}return _0x522fa9;};}function handleError(_0x4d8c07,_0x2a3744){_0x2a3744=_0x2a3744||0x1f4;return function(_0x95e512){logger[_0x76c2('0x28')](_0x95e512[_0x76c2('0x29')]);if(_0x95e512['name']){delete _0x95e512['name'];}_0x4d8c07['status'](_0x2a3744)['send'](_0x95e512);};}exports[_0x76c2('0x2a')]=function(_0x3951b3,_0x4c8555){var _0x12172c={},_0x22f440={},_0x5d67d7={'count':0x0,'rows':[]};var _0xa1cb78=_[_0x76c2('0x2b')](db[_0x76c2('0x2c')]['rawAttributes'],function(_0x18b635){return{'name':_0x18b635[_0x76c2('0x2d')],'type':_0x18b635['type'][_0x76c2('0x2e')]};});_0x22f440[_0x76c2('0x2f')]=_[_0x76c2('0x2b')](_0xa1cb78,'name');_0x22f440[_0x76c2('0x30')]=_[_0x76c2('0x31')](_0x3951b3[_0x76c2('0x30')]);_0x22f440['filters']=_[_0x76c2('0x32')](_0x22f440[_0x76c2('0x2f')],_0x22f440[_0x76c2('0x30')]);_0x12172c[_0x76c2('0x33')]=_[_0x76c2('0x32')](_0x22f440[_0x76c2('0x2f')],qs[_0x76c2('0x34')](_0x3951b3[_0x76c2('0x30')]['fields']));_0x12172c[_0x76c2('0x33')]=_0x12172c[_0x76c2('0x33')]['length']?_0x12172c['attributes']:_0x22f440[_0x76c2('0x2f')];if(!_0x3951b3[_0x76c2('0x30')][_0x76c2('0x35')](_0x76c2('0x36'))){_0x12172c[_0x76c2('0x1e')]=qs[_0x76c2('0x1e')](_0x3951b3[_0x76c2('0x30')]['limit']);_0x12172c[_0x76c2('0x1c')]=qs[_0x76c2('0x1c')](_0x3951b3['query'][_0x76c2('0x1c')]);}_0x12172c[_0x76c2('0x37')]=qs[_0x76c2('0x38')](_0x3951b3[_0x76c2('0x30')]['sort']);_0x12172c[_0x76c2('0x39')]=qs['filters'](_[_0x76c2('0x3a')](_0x3951b3[_0x76c2('0x30')],_0x22f440[_0x76c2('0x3b')]),_0xa1cb78);if(_0x3951b3['query'][_0x76c2('0x3c')]){_0x12172c[_0x76c2('0x39')]=_['merge'](_0x12172c[_0x76c2('0x39')],{'$or':_[_0x76c2('0x2b')](_0xa1cb78,function(_0x525a3d){if(_0x525a3d['type']!==_0x76c2('0x3d')){var _0x26d8be={};_0x26d8be[_0x525a3d[_0x76c2('0x3e')]]={'$like':'%'+_0x3951b3[_0x76c2('0x30')][_0x76c2('0x3c')]+'%'};return _0x26d8be;}})});}_0x12172c=_['merge']({},_0x12172c,_0x3951b3[_0x76c2('0x3f')]);var _0x3e328c={'where':_0x12172c['where']};return db[_0x76c2('0x2c')][_0x76c2('0x1f')](_0x3e328c)[_0x76c2('0x26')](function(_0x3536d9){_0x5d67d7[_0x76c2('0x1f')]=_0x3536d9;if(_0x3951b3['query'][_0x76c2('0x40')]){_0x12172c['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x76c2('0x41')](_0x12172c);})[_0x76c2('0x26')](function(_0x4ba32c){_0x5d67d7['rows']=_0x4ba32c;return _0x5d67d7;})[_0x76c2('0x26')](respondWithFilteredResult(_0x4c8555,_0x12172c))[_0x76c2('0x42')](handleError(_0x4c8555,null));};exports[_0x76c2('0x43')]=function(_0x4653a3,_0x29fbbe){var _0x7b1e10={'raw':![],'where':{'id':_0x4653a3['params']['id']}},_0x5d27ea={};_0x5d27ea['model']=_[_0x76c2('0x31')](db[_0x76c2('0x2c')][_0x76c2('0x44')]);_0x5d27ea[_0x76c2('0x30')]=_[_0x76c2('0x31')](_0x4653a3[_0x76c2('0x30')]);_0x5d27ea[_0x76c2('0x3b')]=_['intersection'](_0x5d27ea[_0x76c2('0x2f')],_0x5d27ea[_0x76c2('0x30')]);_0x7b1e10['attributes']=_[_0x76c2('0x32')](_0x5d27ea['model'],qs[_0x76c2('0x34')](_0x4653a3[_0x76c2('0x30')]['fields']));_0x7b1e10[_0x76c2('0x33')]=_0x7b1e10[_0x76c2('0x33')]['length']?_0x7b1e10['attributes']:_0x5d27ea[_0x76c2('0x2f')];if(_0x4653a3['query']['includeAll']){_0x7b1e10[_0x76c2('0x45')]=[{'all':!![]}];}_0x7b1e10=_[_0x76c2('0x46')]({},_0x7b1e10,_0x4653a3['options']);return db[_0x76c2('0x2c')][_0x76c2('0x47')](_0x7b1e10)[_0x76c2('0x26')](handleEntityNotFound(_0x29fbbe,null))[_0x76c2('0x26')](respondWithResult(_0x29fbbe,null))[_0x76c2('0x42')](handleError(_0x29fbbe,null));};exports[_0x76c2('0x48')]=function(_0x41901e,_0x59575f){return db[_0x76c2('0x2c')][_0x76c2('0x48')](_0x41901e[_0x76c2('0x49')],{})[_0x76c2('0x26')](respondWithResult(_0x59575f,0xc9))[_0x76c2('0x42')](handleError(_0x59575f,null));};exports[_0x76c2('0x25')]=function(_0x37da85,_0xa7dca4){if(_0x37da85[_0x76c2('0x49')]['id']){delete _0x37da85[_0x76c2('0x49')]['id'];}return db['DeskConfiguration'][_0x76c2('0x47')]({'where':{'id':_0x37da85[_0x76c2('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa7dca4,null))[_0x76c2('0x26')](saveUpdates(_0x37da85[_0x76c2('0x49')],null))[_0x76c2('0x26')](respondWithResult(_0xa7dca4,null))[_0x76c2('0x42')](handleError(_0xa7dca4,null));};exports[_0x76c2('0x27')]=function(_0x5de819,_0x3caf4d){return db[_0x76c2('0x2c')][_0x76c2('0x47')]({'where':{'id':_0x5de819[_0x76c2('0x4a')]['id']}})[_0x76c2('0x26')](handleEntityNotFound(_0x3caf4d,null))[_0x76c2('0x26')](removeEntity(_0x3caf4d,null))[_0x76c2('0x42')](handleError(_0x3caf4d,null));};exports[_0x76c2('0x4b')]=function(_0x19579e,_0x1700eb,_0x512a7b){var _0x46a5b7={};var _0x9c02a2={};var _0x59ac94;var _0x21d8cc;return db[_0x76c2('0x2c')][_0x76c2('0x4c')]({'where':{'id':_0x19579e[_0x76c2('0x4a')]['id']}})[_0x76c2('0x26')](handleEntityNotFound(_0x1700eb,null))[_0x76c2('0x26')](function(_0x3aeda9){if(_0x3aeda9){_0x59ac94=_0x3aeda9;_0x9c02a2[_0x76c2('0x2f')]=_[_0x76c2('0x31')](db['DeskField'][_0x76c2('0x44')]);_0x9c02a2['query']=_[_0x76c2('0x31')](_0x19579e[_0x76c2('0x30')]);_0x9c02a2[_0x76c2('0x3b')]=_['intersection'](_0x9c02a2[_0x76c2('0x2f')],_0x9c02a2[_0x76c2('0x30')]);_0x46a5b7['attributes']=_[_0x76c2('0x32')](_0x9c02a2[_0x76c2('0x2f')],qs[_0x76c2('0x34')](_0x19579e['query']['fields']));_0x46a5b7[_0x76c2('0x33')]=_0x46a5b7[_0x76c2('0x33')][_0x76c2('0x4d')]?_0x46a5b7[_0x76c2('0x33')]:_0x9c02a2[_0x76c2('0x2f')];_0x46a5b7[_0x76c2('0x37')]=qs['sort'](_0x19579e[_0x76c2('0x30')]['sort']);_0x46a5b7[_0x76c2('0x39')]=qs[_0x76c2('0x3b')](_[_0x76c2('0x3a')](_0x19579e['query'],_0x9c02a2['filters']));if(_0x19579e[_0x76c2('0x30')][_0x76c2('0x3c')]){_0x46a5b7[_0x76c2('0x39')]=_['merge'](_0x46a5b7['where'],{'$or':_['map'](_0x46a5b7[_0x76c2('0x33')],function(_0x14d726){var _0x45c314={};_0x45c314[_0x14d726]={'$like':'%'+_0x19579e[_0x76c2('0x30')]['filter']+'%'};return _0x45c314;})});}_0x46a5b7=_[_0x76c2('0x46')]({},_0x46a5b7,_0x19579e[_0x76c2('0x3f')]);return _0x59ac94['getFields'](_0x46a5b7);}})[_0x76c2('0x26')](function(_0xb3bcef){if(_0xb3bcef){_0x21d8cc=_0xb3bcef[_0x76c2('0x4d')];if(!_0x19579e[_0x76c2('0x30')]['hasOwnProperty'](_0x76c2('0x36'))){_0x46a5b7[_0x76c2('0x1e')]=qs['limit'](_0x19579e[_0x76c2('0x30')][_0x76c2('0x1e')]);_0x46a5b7[_0x76c2('0x1c')]=qs[_0x76c2('0x1c')](_0x19579e[_0x76c2('0x30')][_0x76c2('0x1c')]);}return _0x59ac94[_0x76c2('0x4b')](_0x46a5b7);}})[_0x76c2('0x26')](function(_0x1c7d1d){if(_0x1c7d1d){return _0x1c7d1d?{'count':_0x21d8cc,'rows':_0x1c7d1d}:null;}})[_0x76c2('0x26')](respondWithResult(_0x1700eb,null))[_0x76c2('0x42')](handleError(_0x1700eb,null));};exports[_0x76c2('0x4e')]=function(_0x1ea947,_0x3d0a72,_0x556737){var _0x1fe7f={};var _0x1a1b94={};var _0x17639c;var _0x233f19;return db[_0x76c2('0x2c')][_0x76c2('0x4c')]({'where':{'id':_0x1ea947[_0x76c2('0x4a')]['id']}})[_0x76c2('0x26')](handleEntityNotFound(_0x3d0a72,null))[_0x76c2('0x26')](function(_0xd84046){if(_0xd84046){_0x17639c=_0xd84046;_0x1a1b94[_0x76c2('0x2f')]=_[_0x76c2('0x31')](db[_0x76c2('0x4f')][_0x76c2('0x44')]);_0x1a1b94[_0x76c2('0x30')]=_[_0x76c2('0x31')](_0x1ea947[_0x76c2('0x30')]);_0x1a1b94[_0x76c2('0x3b')]=_[_0x76c2('0x32')](_0x1a1b94[_0x76c2('0x2f')],_0x1a1b94[_0x76c2('0x30')]);_0x1fe7f[_0x76c2('0x33')]=_[_0x76c2('0x32')](_0x1a1b94[_0x76c2('0x2f')],qs[_0x76c2('0x34')](_0x1ea947[_0x76c2('0x30')][_0x76c2('0x34')]));_0x1fe7f['attributes']=_0x1fe7f[_0x76c2('0x33')][_0x76c2('0x4d')]?_0x1fe7f[_0x76c2('0x33')]:_0x1a1b94[_0x76c2('0x2f')];_0x1fe7f[_0x76c2('0x37')]=qs['sort'](_0x1ea947[_0x76c2('0x30')][_0x76c2('0x38')]);_0x1fe7f[_0x76c2('0x39')]=qs[_0x76c2('0x3b')](_[_0x76c2('0x3a')](_0x1ea947[_0x76c2('0x30')],_0x1a1b94[_0x76c2('0x3b')]));if(_0x1ea947['query']['filter']){_0x1fe7f[_0x76c2('0x39')]=_['merge'](_0x1fe7f[_0x76c2('0x39')],{'$or':_[_0x76c2('0x2b')](_0x1fe7f[_0x76c2('0x33')],function(_0x65ed38){var _0x77c4ed={};_0x77c4ed[_0x65ed38]={'$like':'%'+_0x1ea947[_0x76c2('0x30')][_0x76c2('0x3c')]+'%'};return _0x77c4ed;})});}_0x1fe7f=_[_0x76c2('0x46')]({},_0x1fe7f,_0x1ea947[_0x76c2('0x3f')]);return _0x17639c['getSubjects'](_0x1fe7f);}})['then'](function(_0x494e7f){if(_0x494e7f){_0x233f19=_0x494e7f[_0x76c2('0x4d')];if(!_0x1ea947[_0x76c2('0x30')][_0x76c2('0x35')]('nolimit')){_0x1fe7f[_0x76c2('0x1e')]=qs[_0x76c2('0x1e')](_0x1ea947[_0x76c2('0x30')]['limit']);_0x1fe7f[_0x76c2('0x1c')]=qs[_0x76c2('0x1c')](_0x1ea947[_0x76c2('0x30')][_0x76c2('0x1c')]);}return _0x17639c[_0x76c2('0x4e')](_0x1fe7f);}})[_0x76c2('0x26')](function(_0x3288fe){if(_0x3288fe){return _0x3288fe?{'count':_0x233f19,'rows':_0x3288fe}:null;}})['then'](respondWithResult(_0x3d0a72,null))[_0x76c2('0x42')](handleError(_0x3d0a72,null));};exports[_0x76c2('0x50')]=function(_0x43a9d5,_0x79f8f0,_0xea945a){var _0x20efc0={};var _0x158ac8={};var _0x147cf3;var _0x73e429;return db['DeskConfiguration'][_0x76c2('0x4c')]({'where':{'id':_0x43a9d5['params']['id']}})[_0x76c2('0x26')](handleEntityNotFound(_0x79f8f0,null))['then'](function(_0x51c434){if(_0x51c434){_0x147cf3=_0x51c434;_0x158ac8['model']=_[_0x76c2('0x31')](db[_0x76c2('0x4f')][_0x76c2('0x44')]);_0x158ac8[_0x76c2('0x30')]=_[_0x76c2('0x31')](_0x43a9d5['query']);_0x158ac8[_0x76c2('0x3b')]=_['intersection'](_0x158ac8[_0x76c2('0x2f')],_0x158ac8[_0x76c2('0x30')]);_0x20efc0[_0x76c2('0x33')]=_[_0x76c2('0x32')](_0x158ac8['model'],qs[_0x76c2('0x34')](_0x43a9d5[_0x76c2('0x30')][_0x76c2('0x34')]));_0x20efc0[_0x76c2('0x33')]=_0x20efc0[_0x76c2('0x33')][_0x76c2('0x4d')]?_0x20efc0[_0x76c2('0x33')]:_0x158ac8[_0x76c2('0x2f')];_0x20efc0[_0x76c2('0x37')]=qs['sort'](_0x43a9d5[_0x76c2('0x30')][_0x76c2('0x38')]);_0x20efc0[_0x76c2('0x39')]=qs[_0x76c2('0x3b')](_[_0x76c2('0x3a')](_0x43a9d5['query'],_0x158ac8[_0x76c2('0x3b')]));if(_0x43a9d5['query'][_0x76c2('0x3c')]){_0x20efc0['where']=_[_0x76c2('0x46')](_0x20efc0[_0x76c2('0x39')],{'$or':_[_0x76c2('0x2b')](_0x20efc0[_0x76c2('0x33')],function(_0x560947){var _0x16e43c={};_0x16e43c[_0x560947]={'$like':'%'+_0x43a9d5[_0x76c2('0x30')][_0x76c2('0x3c')]+'%'};return _0x16e43c;})});}_0x20efc0=_['merge']({},_0x20efc0,_0x43a9d5['options']);return _0x147cf3[_0x76c2('0x50')](_0x20efc0);}})['then'](function(_0x11e0fb){if(_0x11e0fb){_0x73e429=_0x11e0fb[_0x76c2('0x4d')];if(!_0x43a9d5[_0x76c2('0x30')]['hasOwnProperty'](_0x76c2('0x36'))){_0x20efc0[_0x76c2('0x1e')]=qs[_0x76c2('0x1e')](_0x43a9d5['query']['limit']);_0x20efc0[_0x76c2('0x1c')]=qs[_0x76c2('0x1c')](_0x43a9d5['query']['offset']);}return _0x147cf3[_0x76c2('0x50')](_0x20efc0);}})[_0x76c2('0x26')](function(_0xddcdf9){if(_0xddcdf9){return _0xddcdf9?{'count':_0x73e429,'rows':_0xddcdf9}:null;}})['then'](respondWithResult(_0x79f8f0,null))[_0x76c2('0x42')](handleError(_0x79f8f0,null));};exports[_0x76c2('0x51')]=function(_0x1052f1,_0x5effbd,_0x20a21b){var _0x3a8f04={};var _0x2d6538={};var _0x17de27;var _0x1adf9d;return db[_0x76c2('0x2c')][_0x76c2('0x4c')]({'where':{'id':_0x1052f1[_0x76c2('0x4a')]['id']}})[_0x76c2('0x26')](handleEntityNotFound(_0x5effbd,null))['then'](function(_0x159f62){if(_0x159f62){_0x17de27=_0x159f62;_0x2d6538[_0x76c2('0x2f')]=_[_0x76c2('0x31')](db['Tag'][_0x76c2('0x44')]);_0x2d6538[_0x76c2('0x30')]=_['keys'](_0x1052f1[_0x76c2('0x30')]);_0x2d6538[_0x76c2('0x3b')]=_[_0x76c2('0x32')](_0x2d6538[_0x76c2('0x2f')],_0x2d6538[_0x76c2('0x30')]);_0x3a8f04[_0x76c2('0x33')]=_['intersection'](_0x2d6538[_0x76c2('0x2f')],qs['fields'](_0x1052f1[_0x76c2('0x30')][_0x76c2('0x34')]));_0x3a8f04['attributes']=_0x3a8f04['attributes']['length']?_0x3a8f04['attributes']:_0x2d6538[_0x76c2('0x2f')];_0x3a8f04[_0x76c2('0x37')]=qs[_0x76c2('0x38')](_0x1052f1[_0x76c2('0x30')][_0x76c2('0x38')]);_0x3a8f04['where']=qs[_0x76c2('0x3b')](_[_0x76c2('0x3a')](_0x1052f1[_0x76c2('0x30')],_0x2d6538[_0x76c2('0x3b')]));if(_0x1052f1[_0x76c2('0x30')]['filter']){_0x3a8f04[_0x76c2('0x39')]=_[_0x76c2('0x46')](_0x3a8f04[_0x76c2('0x39')],{'$or':_[_0x76c2('0x2b')](_0x3a8f04[_0x76c2('0x33')],function(_0x31d9e8){var _0x817b93={};_0x817b93[_0x31d9e8]={'$like':'%'+_0x1052f1[_0x76c2('0x30')][_0x76c2('0x3c')]+'%'};return _0x817b93;})});}_0x3a8f04=_['merge']({},_0x3a8f04,_0x1052f1[_0x76c2('0x3f')]);return _0x17de27['getTags'](_0x3a8f04);}})[_0x76c2('0x26')](function(_0x1a37f6){if(_0x1a37f6){_0x1adf9d=_0x1a37f6['length'];if(!_0x1052f1[_0x76c2('0x30')]['hasOwnProperty'](_0x76c2('0x36'))){_0x3a8f04['limit']=qs[_0x76c2('0x1e')](_0x1052f1[_0x76c2('0x30')][_0x76c2('0x1e')]);_0x3a8f04[_0x76c2('0x1c')]=qs[_0x76c2('0x1c')](_0x1052f1[_0x76c2('0x30')][_0x76c2('0x1c')]);}return _0x17de27[_0x76c2('0x51')](_0x3a8f04);}})['then'](function(_0x1d6a9c){if(_0x1d6a9c){return _0x1d6a9c?{'count':_0x1adf9d,'rows':_0x1d6a9c}:null;}})[_0x76c2('0x26')](respondWithResult(_0x5effbd,null))['catch'](handleError(_0x5effbd,null));};exports[_0x76c2('0x52')]=function(_0x50333f,_0x5159d6,_0x2d9278){if(_0x50333f[_0x76c2('0x49')]['id']){delete _0x50333f['body']['id'];}return db[_0x76c2('0x2c')][_0x76c2('0x4c')]({'where':{'id':_0x50333f[_0x76c2('0x4a')]['id']}})[_0x76c2('0x26')](handleEntityNotFound(_0x5159d6,null))['then'](function(_0x447282){if(_0x447282){return _0x447282[_0x76c2('0x52')](_0x50333f[_0x76c2('0x49')][_0x76c2('0x53')]||[]);}return null;})[_0x76c2('0x26')](respondWithResult(_0x5159d6,null))[_0x76c2('0x42')](handleError(_0x5159d6,null));}; \ No newline at end of file +var _0xc056=['sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','catch','create','body','find','getFields','findOne','DeskField','order','pick','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x825c1,_0x4dc284){var _0x25944=function(_0x285d9d){while(--_0x285d9d){_0x825c1['push'](_0x825c1['shift']());}};_0x25944(++_0x4dc284);}(_0xc056,0x1a2));var _0x6c05=function(_0x1b61ee,_0x50ab35){_0x1b61ee=_0x1b61ee-0x0;var _0x471dc6=_0xc056[_0x1b61ee];return _0x471dc6;};'use strict';var emlformat=require(_0x6c05('0x0'));var rimraf=require(_0x6c05('0x1'));var zipdir=require(_0x6c05('0x2'));var jsonpatch=require(_0x6c05('0x3'));var rp=require('request-promise');var moment=require(_0x6c05('0x4'));var BPromise=require(_0x6c05('0x5'));var Mustache=require(_0x6c05('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c05('0x7'));var csv=require(_0x6c05('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c05('0x9'));var _=require('lodash');var squel=require(_0x6c05('0xa'));var crypto=require(_0x6c05('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6c05('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c05('0xd'));var Papa=require('papaparse');var Redis=require(_0x6c05('0xe'));var authService=require(_0x6c05('0xf'));var qs=require(_0x6c05('0x10'));var as=require(_0x6c05('0x11'));var hardwareService=require(_0x6c05('0x12'));var logger=require(_0x6c05('0x13'))(_0x6c05('0x14'));var utils=require(_0x6c05('0x15'));var config=require(_0x6c05('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48f794,_0x2063aa){_0x2063aa=_0x2063aa||0xcc;return function(_0x11dec6){if(_0x11dec6){return _0x48f794['sendStatus'](_0x2063aa);}return _0x48f794[_0x6c05('0x17')](_0x2063aa)[_0x6c05('0x18')]();};}function respondWithResult(_0x4637cb,_0x21063e){_0x21063e=_0x21063e||0xc8;return function(_0x223d6a){if(_0x223d6a){return _0x4637cb[_0x6c05('0x17')](_0x21063e)[_0x6c05('0x19')](_0x223d6a);}};}function respondWithFilteredResult(_0x2b9b9b,_0x515fbf){return function(_0xf2c406){if(_0xf2c406){var _0x430a5a=typeof _0x515fbf['offset']===_0x6c05('0x1a')&&typeof _0x515fbf[_0x6c05('0x1b')]==='undefined';var _0x4aa44f=_0xf2c406[_0x6c05('0x1c')];var _0x4bb613=_0x430a5a?0x0:_0x515fbf[_0x6c05('0x1d')];var _0xfe6e8b=_0x430a5a?_0xf2c406['count']:_0x515fbf[_0x6c05('0x1d')]+_0x515fbf['limit'];var _0x436de5;if(_0xfe6e8b>=_0x4aa44f){_0xfe6e8b=_0x4aa44f;_0x436de5=0xc8;}else{_0x436de5=0xce;}_0x2b9b9b[_0x6c05('0x17')](_0x436de5);return _0x2b9b9b['set'](_0x6c05('0x1e'),_0x4bb613+'-'+_0xfe6e8b+'/'+_0x4aa44f)[_0x6c05('0x19')](_0xf2c406);}return null;};}function patchUpdates(_0x22b434){return function(_0x47a2c8){try{jsonpatch[_0x6c05('0x1f')](_0x47a2c8,_0x22b434,!![]);}catch(_0xb72b1){return BPromise['reject'](_0xb72b1);}return _0x47a2c8[_0x6c05('0x20')]();};}function saveUpdates(_0x562ea1,_0x3867a9){return function(_0x111064){if(_0x111064){return _0x111064[_0x6c05('0x21')](_0x562ea1)[_0x6c05('0x22')](function(_0x5f138b){return _0x5f138b;});}return null;};}function removeEntity(_0x5e97e4,_0x3e7bd5){return function(_0x3703e7){if(_0x3703e7){return _0x3703e7[_0x6c05('0x23')]()['then'](function(){_0x5e97e4[_0x6c05('0x17')](0xcc)[_0x6c05('0x18')]();});}};}function handleEntityNotFound(_0x20afb7,_0x5da324){return function(_0x45a511){if(!_0x45a511){_0x20afb7[_0x6c05('0x24')](0x194);}return _0x45a511;};}function handleError(_0x2b16c8,_0x27a562){_0x27a562=_0x27a562||0x1f4;return function(_0x4ab7ef){logger[_0x6c05('0x25')](_0x4ab7ef[_0x6c05('0x26')]);if(_0x4ab7ef[_0x6c05('0x27')]){delete _0x4ab7ef[_0x6c05('0x27')];}_0x2b16c8[_0x6c05('0x17')](_0x27a562)[_0x6c05('0x28')](_0x4ab7ef);};}exports[_0x6c05('0x29')]=function(_0x9b196a,_0x4c672e){var _0x4a0bbf={},_0x2ec0e0={},_0x454b9f={'count':0x0,'rows':[]};var _0x24cb87=_[_0x6c05('0x2a')](db[_0x6c05('0x2b')][_0x6c05('0x2c')],function(_0x4def96){return{'name':_0x4def96[_0x6c05('0x2d')],'type':_0x4def96[_0x6c05('0x2e')][_0x6c05('0x2f')]};});_0x2ec0e0['model']=_[_0x6c05('0x2a')](_0x24cb87,_0x6c05('0x27'));_0x2ec0e0[_0x6c05('0x30')]=_['keys'](_0x9b196a[_0x6c05('0x30')]);_0x2ec0e0[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x2ec0e0['model'],_0x2ec0e0[_0x6c05('0x30')]);_0x4a0bbf[_0x6c05('0x33')]=_['intersection'](_0x2ec0e0['model'],qs[_0x6c05('0x34')](_0x9b196a[_0x6c05('0x30')][_0x6c05('0x34')]));_0x4a0bbf[_0x6c05('0x33')]=_0x4a0bbf[_0x6c05('0x33')]['length']?_0x4a0bbf['attributes']:_0x2ec0e0[_0x6c05('0x35')];if(!_0x9b196a[_0x6c05('0x30')]['hasOwnProperty'](_0x6c05('0x36'))){_0x4a0bbf[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0x9b196a[_0x6c05('0x30')]['limit']);_0x4a0bbf[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0x9b196a[_0x6c05('0x30')]['offset']);}_0x4a0bbf['order']=qs[_0x6c05('0x37')](_0x9b196a[_0x6c05('0x30')][_0x6c05('0x37')]);_0x4a0bbf[_0x6c05('0x38')]=qs[_0x6c05('0x31')](_['pick'](_0x9b196a[_0x6c05('0x30')],_0x2ec0e0[_0x6c05('0x31')]),_0x24cb87);if(_0x9b196a[_0x6c05('0x30')][_0x6c05('0x39')]){_0x4a0bbf[_0x6c05('0x38')]=_[_0x6c05('0x3a')](_0x4a0bbf[_0x6c05('0x38')],{'$or':_[_0x6c05('0x2a')](_0x24cb87,function(_0x516a69){if(_0x516a69['type']!==_0x6c05('0x3b')){var _0x1678f8={};_0x1678f8[_0x516a69[_0x6c05('0x27')]]={'$like':'%'+_0x9b196a[_0x6c05('0x30')][_0x6c05('0x39')]+'%'};return _0x1678f8;}})});}_0x4a0bbf=_[_0x6c05('0x3a')]({},_0x4a0bbf,_0x9b196a[_0x6c05('0x3c')]);var _0x493896={'where':_0x4a0bbf[_0x6c05('0x38')]};return db[_0x6c05('0x2b')][_0x6c05('0x1c')](_0x493896)['then'](function(_0x21b910){_0x454b9f['count']=_0x21b910;if(_0x9b196a[_0x6c05('0x30')]['includeAll']){_0x4a0bbf[_0x6c05('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x6c05('0x3e')](_0x4a0bbf);})[_0x6c05('0x22')](function(_0x2b1453){_0x454b9f[_0x6c05('0x3f')]=_0x2b1453;return _0x454b9f;})['then'](respondWithFilteredResult(_0x4c672e,_0x4a0bbf))['catch'](handleError(_0x4c672e,null));};exports[_0x6c05('0x40')]=function(_0x61eae,_0x5276ec){var _0x2fdfd1={'raw':![],'where':{'id':_0x61eae[_0x6c05('0x41')]['id']}},_0x26f739={};_0x26f739['model']=_[_0x6c05('0x42')](db[_0x6c05('0x2b')][_0x6c05('0x2c')]);_0x26f739[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x61eae[_0x6c05('0x30')]);_0x26f739[_0x6c05('0x31')]=_['intersection'](_0x26f739['model'],_0x26f739[_0x6c05('0x30')]);_0x2fdfd1[_0x6c05('0x33')]=_[_0x6c05('0x32')](_0x26f739[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x61eae['query'][_0x6c05('0x34')]));_0x2fdfd1[_0x6c05('0x33')]=_0x2fdfd1[_0x6c05('0x33')][_0x6c05('0x43')]?_0x2fdfd1['attributes']:_0x26f739['model'];if(_0x61eae[_0x6c05('0x30')][_0x6c05('0x44')]){_0x2fdfd1[_0x6c05('0x3d')]=[{'all':!![]}];}_0x2fdfd1=_[_0x6c05('0x3a')]({},_0x2fdfd1,_0x61eae[_0x6c05('0x3c')]);return db['DeskConfiguration']['find'](_0x2fdfd1)[_0x6c05('0x22')](handleEntityNotFound(_0x5276ec,null))[_0x6c05('0x22')](respondWithResult(_0x5276ec,null))[_0x6c05('0x45')](handleError(_0x5276ec,null));};exports[_0x6c05('0x46')]=function(_0x14d5e5,_0x59d1d9){return db[_0x6c05('0x2b')]['create'](_0x14d5e5[_0x6c05('0x47')],{})[_0x6c05('0x22')](respondWithResult(_0x59d1d9,0xc9))['catch'](handleError(_0x59d1d9,null));};exports[_0x6c05('0x21')]=function(_0x334230,_0x429efe){if(_0x334230['body']['id']){delete _0x334230[_0x6c05('0x47')]['id'];}return db[_0x6c05('0x2b')][_0x6c05('0x48')]({'where':{'id':_0x334230['params']['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x429efe,null))['then'](saveUpdates(_0x334230['body'],null))[_0x6c05('0x22')](respondWithResult(_0x429efe,null))[_0x6c05('0x45')](handleError(_0x429efe,null));};exports[_0x6c05('0x23')]=function(_0x1d58b9,_0xd6d10f){return db[_0x6c05('0x2b')][_0x6c05('0x48')]({'where':{'id':_0x1d58b9[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0xd6d10f,null))['then'](removeEntity(_0xd6d10f,null))[_0x6c05('0x45')](handleError(_0xd6d10f,null));};exports[_0x6c05('0x49')]=function(_0xf30876,_0x54b9f6,_0x3b21ba){var _0x227c91={};var _0x49335e={};var _0x5ed2f9;var _0x50be11;return db[_0x6c05('0x2b')][_0x6c05('0x4a')]({'where':{'id':_0xf30876[_0x6c05('0x41')]['id']}})['then'](handleEntityNotFound(_0x54b9f6,null))[_0x6c05('0x22')](function(_0x1ce1ca){if(_0x1ce1ca){_0x5ed2f9=_0x1ce1ca;_0x49335e[_0x6c05('0x35')]=_[_0x6c05('0x42')](db[_0x6c05('0x4b')][_0x6c05('0x2c')]);_0x49335e[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0xf30876['query']);_0x49335e[_0x6c05('0x31')]=_['intersection'](_0x49335e[_0x6c05('0x35')],_0x49335e['query']);_0x227c91[_0x6c05('0x33')]=_[_0x6c05('0x32')](_0x49335e[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0xf30876[_0x6c05('0x30')]['fields']));_0x227c91[_0x6c05('0x33')]=_0x227c91[_0x6c05('0x33')][_0x6c05('0x43')]?_0x227c91[_0x6c05('0x33')]:_0x49335e[_0x6c05('0x35')];_0x227c91[_0x6c05('0x4c')]=qs[_0x6c05('0x37')](_0xf30876[_0x6c05('0x30')][_0x6c05('0x37')]);_0x227c91['where']=qs[_0x6c05('0x31')](_[_0x6c05('0x4d')](_0xf30876[_0x6c05('0x30')],_0x49335e['filters']));if(_0xf30876[_0x6c05('0x30')][_0x6c05('0x39')]){_0x227c91['where']=_[_0x6c05('0x3a')](_0x227c91['where'],{'$or':_['map'](_0x227c91[_0x6c05('0x33')],function(_0x390962){var _0x3a2755={};_0x3a2755[_0x390962]={'$like':'%'+_0xf30876['query'][_0x6c05('0x39')]+'%'};return _0x3a2755;})});}_0x227c91=_[_0x6c05('0x3a')]({},_0x227c91,_0xf30876[_0x6c05('0x3c')]);return _0x5ed2f9['getFields'](_0x227c91);}})['then'](function(_0x18d133){if(_0x18d133){_0x50be11=_0x18d133[_0x6c05('0x43')];if(!_0xf30876[_0x6c05('0x30')][_0x6c05('0x4e')]('nolimit')){_0x227c91[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0xf30876['query'][_0x6c05('0x1b')]);_0x227c91[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0xf30876['query']['offset']);}return _0x5ed2f9['getFields'](_0x227c91);}})[_0x6c05('0x22')](function(_0x3ad8c9){if(_0x3ad8c9){return _0x3ad8c9?{'count':_0x50be11,'rows':_0x3ad8c9}:null;}})[_0x6c05('0x22')](respondWithResult(_0x54b9f6,null))[_0x6c05('0x45')](handleError(_0x54b9f6,null));};exports['getSubjects']=function(_0x58fda0,_0x53d023,_0x489eb3){var _0x313e4d={};var _0x2e8f55={};var _0x5c5d78;var _0x15f8eb;return db['DeskConfiguration'][_0x6c05('0x4a')]({'where':{'id':_0x58fda0[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x53d023,null))[_0x6c05('0x22')](function(_0x501326){if(_0x501326){_0x5c5d78=_0x501326;_0x2e8f55['model']=_[_0x6c05('0x42')](db[_0x6c05('0x4b')][_0x6c05('0x2c')]);_0x2e8f55[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x58fda0[_0x6c05('0x30')]);_0x2e8f55[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x2e8f55[_0x6c05('0x35')],_0x2e8f55[_0x6c05('0x30')]);_0x313e4d['attributes']=_['intersection'](_0x2e8f55[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x58fda0['query'][_0x6c05('0x34')]));_0x313e4d[_0x6c05('0x33')]=_0x313e4d[_0x6c05('0x33')][_0x6c05('0x43')]?_0x313e4d['attributes']:_0x2e8f55[_0x6c05('0x35')];_0x313e4d[_0x6c05('0x4c')]=qs[_0x6c05('0x37')](_0x58fda0[_0x6c05('0x30')][_0x6c05('0x37')]);_0x313e4d['where']=qs[_0x6c05('0x31')](_[_0x6c05('0x4d')](_0x58fda0[_0x6c05('0x30')],_0x2e8f55['filters']));if(_0x58fda0[_0x6c05('0x30')]['filter']){_0x313e4d['where']=_[_0x6c05('0x3a')](_0x313e4d[_0x6c05('0x38')],{'$or':_[_0x6c05('0x2a')](_0x313e4d[_0x6c05('0x33')],function(_0x8a6895){var _0x56c0c4={};_0x56c0c4[_0x8a6895]={'$like':'%'+_0x58fda0[_0x6c05('0x30')]['filter']+'%'};return _0x56c0c4;})});}_0x313e4d=_[_0x6c05('0x3a')]({},_0x313e4d,_0x58fda0[_0x6c05('0x3c')]);return _0x5c5d78[_0x6c05('0x4f')](_0x313e4d);}})[_0x6c05('0x22')](function(_0x428024){if(_0x428024){_0x15f8eb=_0x428024[_0x6c05('0x43')];if(!_0x58fda0[_0x6c05('0x30')]['hasOwnProperty'](_0x6c05('0x36'))){_0x313e4d[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0x58fda0['query']['limit']);_0x313e4d[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0x58fda0[_0x6c05('0x30')][_0x6c05('0x1d')]);}return _0x5c5d78[_0x6c05('0x4f')](_0x313e4d);}})['then'](function(_0x413340){if(_0x413340){return _0x413340?{'count':_0x15f8eb,'rows':_0x413340}:null;}})['then'](respondWithResult(_0x53d023,null))[_0x6c05('0x45')](handleError(_0x53d023,null));};exports[_0x6c05('0x50')]=function(_0x3d18dc,_0x22443d,_0x9de535){var _0x25f76c={};var _0x189b39={};var _0x4da18b;var _0x4af4f9;return db['DeskConfiguration'][_0x6c05('0x4a')]({'where':{'id':_0x3d18dc[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x22443d,null))[_0x6c05('0x22')](function(_0x147401){if(_0x147401){_0x4da18b=_0x147401;_0x189b39[_0x6c05('0x35')]=_[_0x6c05('0x42')](db[_0x6c05('0x4b')][_0x6c05('0x2c')]);_0x189b39[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x3d18dc[_0x6c05('0x30')]);_0x189b39[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x189b39[_0x6c05('0x35')],_0x189b39[_0x6c05('0x30')]);_0x25f76c[_0x6c05('0x33')]=_['intersection'](_0x189b39[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x3d18dc['query'][_0x6c05('0x34')]));_0x25f76c[_0x6c05('0x33')]=_0x25f76c[_0x6c05('0x33')][_0x6c05('0x43')]?_0x25f76c[_0x6c05('0x33')]:_0x189b39[_0x6c05('0x35')];_0x25f76c[_0x6c05('0x4c')]=qs[_0x6c05('0x37')](_0x3d18dc[_0x6c05('0x30')][_0x6c05('0x37')]);_0x25f76c[_0x6c05('0x38')]=qs[_0x6c05('0x31')](_['pick'](_0x3d18dc[_0x6c05('0x30')],_0x189b39[_0x6c05('0x31')]));if(_0x3d18dc['query'][_0x6c05('0x39')]){_0x25f76c[_0x6c05('0x38')]=_['merge'](_0x25f76c[_0x6c05('0x38')],{'$or':_['map'](_0x25f76c[_0x6c05('0x33')],function(_0x1cc117){var _0x5090f5={};_0x5090f5[_0x1cc117]={'$like':'%'+_0x3d18dc['query'][_0x6c05('0x39')]+'%'};return _0x5090f5;})});}_0x25f76c=_[_0x6c05('0x3a')]({},_0x25f76c,_0x3d18dc[_0x6c05('0x3c')]);return _0x4da18b[_0x6c05('0x50')](_0x25f76c);}})[_0x6c05('0x22')](function(_0xdfa78f){if(_0xdfa78f){_0x4af4f9=_0xdfa78f[_0x6c05('0x43')];if(!_0x3d18dc[_0x6c05('0x30')][_0x6c05('0x4e')](_0x6c05('0x36'))){_0x25f76c[_0x6c05('0x1b')]=qs[_0x6c05('0x1b')](_0x3d18dc[_0x6c05('0x30')][_0x6c05('0x1b')]);_0x25f76c['offset']=qs['offset'](_0x3d18dc[_0x6c05('0x30')]['offset']);}return _0x4da18b[_0x6c05('0x50')](_0x25f76c);}})[_0x6c05('0x22')](function(_0x10d433){if(_0x10d433){return _0x10d433?{'count':_0x4af4f9,'rows':_0x10d433}:null;}})[_0x6c05('0x22')](respondWithResult(_0x22443d,null))[_0x6c05('0x45')](handleError(_0x22443d,null));};exports['getTags']=function(_0x2f653f,_0x199480,_0x562cbb){var _0x328f09={};var _0x40c46f={};var _0x22a08a;var _0x52f813;return db[_0x6c05('0x2b')][_0x6c05('0x4a')]({'where':{'id':_0x2f653f['params']['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0x199480,null))[_0x6c05('0x22')](function(_0x53405e){if(_0x53405e){_0x22a08a=_0x53405e;_0x40c46f[_0x6c05('0x35')]=_[_0x6c05('0x42')](db[_0x6c05('0x51')]['rawAttributes']);_0x40c46f[_0x6c05('0x30')]=_[_0x6c05('0x42')](_0x2f653f['query']);_0x40c46f[_0x6c05('0x31')]=_[_0x6c05('0x32')](_0x40c46f['model'],_0x40c46f['query']);_0x328f09[_0x6c05('0x33')]=_[_0x6c05('0x32')](_0x40c46f[_0x6c05('0x35')],qs[_0x6c05('0x34')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x34')]));_0x328f09[_0x6c05('0x33')]=_0x328f09[_0x6c05('0x33')][_0x6c05('0x43')]?_0x328f09[_0x6c05('0x33')]:_0x40c46f[_0x6c05('0x35')];_0x328f09['order']=qs[_0x6c05('0x37')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x37')]);_0x328f09['where']=qs[_0x6c05('0x31')](_[_0x6c05('0x4d')](_0x2f653f['query'],_0x40c46f[_0x6c05('0x31')]));if(_0x2f653f['query']['filter']){_0x328f09['where']=_[_0x6c05('0x3a')](_0x328f09['where'],{'$or':_['map'](_0x328f09[_0x6c05('0x33')],function(_0x4ce1cd){var _0x1eb652={};_0x1eb652[_0x4ce1cd]={'$like':'%'+_0x2f653f[_0x6c05('0x30')][_0x6c05('0x39')]+'%'};return _0x1eb652;})});}_0x328f09=_['merge']({},_0x328f09,_0x2f653f[_0x6c05('0x3c')]);return _0x22a08a[_0x6c05('0x52')](_0x328f09);}})[_0x6c05('0x22')](function(_0x40b32d){if(_0x40b32d){_0x52f813=_0x40b32d['length'];if(!_0x2f653f[_0x6c05('0x30')][_0x6c05('0x4e')](_0x6c05('0x36'))){_0x328f09['limit']=qs[_0x6c05('0x1b')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x1b')]);_0x328f09[_0x6c05('0x1d')]=qs[_0x6c05('0x1d')](_0x2f653f[_0x6c05('0x30')][_0x6c05('0x1d')]);}return _0x22a08a['getTags'](_0x328f09);}})['then'](function(_0x50e5ff){if(_0x50e5ff){return _0x50e5ff?{'count':_0x52f813,'rows':_0x50e5ff}:null;}})[_0x6c05('0x22')](respondWithResult(_0x199480,null))['catch'](handleError(_0x199480,null));};exports[_0x6c05('0x53')]=function(_0x12c679,_0xc0ee9a,_0x2c762c){if(_0x12c679[_0x6c05('0x47')]['id']){delete _0x12c679[_0x6c05('0x47')]['id'];}return db[_0x6c05('0x2b')]['findOne']({'where':{'id':_0x12c679[_0x6c05('0x41')]['id']}})[_0x6c05('0x22')](handleEntityNotFound(_0xc0ee9a,null))[_0x6c05('0x22')](function(_0x1f5d5b){if(_0x1f5d5b){return _0x1f5d5b[_0x6c05('0x53')](_0x12c679[_0x6c05('0x47')][_0x6c05('0x54')]||[]);}return null;})[_0x6c05('0x22')](respondWithResult(_0xc0ee9a,null))[_0x6c05('0x45')](handleError(_0xc0ee9a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5b37799..933e932 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 _0xa8e1=['moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','lodash','util','api'];(function(_0x3fbe4d,_0x416d1c){var _0x20b31b=function(_0xf01c94){while(--_0xf01c94){_0x3fbe4d['push'](_0x3fbe4d['shift']());}};_0x20b31b(++_0x416d1c);}(_0xa8e1,0xe4));var _0x1a8e=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xa8e1[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x1a8e('0x0'));var util=require(_0x1a8e('0x1'));var logger=require('../../config/logger')(_0x1a8e('0x2'));var moment=require(_0x1a8e('0x3'));var BPromise=require(_0x1a8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a8e('0x5'));var rimraf=require(_0x1a8e('0x6'));var config=require(_0x1a8e('0x7'));var attributes=require(_0x1a8e('0x8'));module[_0x1a8e('0x9')]=function(_0x1c231a,_0x3450b4){return _0x1c231a['define'](_0x1a8e('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48ef=['exports','define','DeskConfiguration','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x149105,_0x43dded){var _0x327a27=function(_0x3911b0){while(--_0x3911b0){_0x149105['push'](_0x149105['shift']());}};_0x327a27(++_0x43dded);}(_0x48ef,0x9d));var _0xf48e=function(_0x57d671,_0x1a101c){_0x57d671=_0x57d671-0x0;var _0x450dfe=_0x48ef[_0x57d671];return _0x450dfe;};'use strict';var _=require(_0xf48e('0x0'));var util=require(_0xf48e('0x1'));var logger=require('../../config/logger')(_0xf48e('0x2'));var moment=require(_0xf48e('0x3'));var BPromise=require('bluebird');var rp=require(_0xf48e('0x4'));var fs=require('fs');var path=require(_0xf48e('0x5'));var rimraf=require(_0xf48e('0x6'));var config=require(_0xf48e('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xf48e('0x8')]=function(_0x3bb169,_0x19c6ad){return _0x3bb169[_0xf48e('0x9')](_0xf48e('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9f448f1..9d62a9d 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 _0xd159=['rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xd159,0x19d));var _0x9d15=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd159[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x9d15('0x0'));var util=require(_0x9d15('0x1'));var moment=require(_0x9d15('0x2'));var BPromise=require(_0x9d15('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d15('0x4'));var db=require(_0x9d15('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d15('0x6'))(_0x9d15('0x7'));var config=require(_0x9d15('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d15('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x414cba,_0x849cd1,_0x23a702){return new BPromise(function(_0x5b1a6e,_0xcaa861){return client[_0x9d15('0xa')](_0x414cba,_0x23a702)[_0x9d15('0xb')](function(_0x2b51f7){logger[_0x9d15('0xc')](_0x9d15('0xd'),_0x849cd1,_0x9d15('0xe'));logger[_0x9d15('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x849cd1,_0x9d15('0xe'),JSON['stringify'](_0x2b51f7));if(_0x2b51f7[_0x9d15('0x10')]){if(_0x2b51f7[_0x9d15('0x10')][_0x9d15('0x11')]===0x1f4){logger[_0x9d15('0x10')](_0x9d15('0xd'),_0x849cd1,_0x2b51f7[_0x9d15('0x10')][_0x9d15('0x12')]);return _0xcaa861(_0x2b51f7[_0x9d15('0x10')]['message']);}logger[_0x9d15('0x10')](_0x9d15('0xd'),_0x849cd1,_0x2b51f7['error'][_0x9d15('0x12')]);return _0x5b1a6e(_0x2b51f7['error'][_0x9d15('0x12')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x849cd1,'request\x20sent');_0x5b1a6e(_0x2b51f7['result'][_0x9d15('0x12')]);}})[_0x9d15('0x13')](function(_0x5e4ba5){logger[_0x9d15('0x10')](_0x9d15('0xd'),_0x849cd1,_0x5e4ba5);_0xcaa861(_0x5e4ba5);});});} \ No newline at end of file +var _0x2eba=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2eba,0xc7));var _0xa2eb=function(_0x5da100,_0x1bc2dd){_0x5da100=_0x5da100-0x0;var _0x18dd66=_0x2eba[_0x5da100];return _0x18dd66;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var moment=require(_0xa2eb('0x1'));var BPromise=require(_0xa2eb('0x2'));var rs=require(_0xa2eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2eb('0x4'));var logger=require('../../config/logger')(_0xa2eb('0x5'));var config=require(_0xa2eb('0x6'));var jayson=require(_0xa2eb('0x7'));var client=jayson[_0xa2eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545db3,_0x56b33a,_0x4ed534){return new BPromise(function(_0x550a3c,_0x56408f){return client[_0xa2eb('0x9')](_0x545db3,_0x4ed534)[_0xa2eb('0xa')](function(_0x5480a1){logger['info'](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));logger[_0xa2eb('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x56b33a,_0xa2eb('0xc'),JSON[_0xa2eb('0xe')](_0x5480a1));if(_0x5480a1['error']){if(_0x5480a1[_0xa2eb('0xf')]['code']===0x1f4){logger[_0xa2eb('0xf')](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x56408f(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}logger['error'](_0xa2eb('0xb'),_0x56b33a,_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);return _0x550a3c(_0x5480a1[_0xa2eb('0xf')][_0xa2eb('0x10')]);}else{logger[_0xa2eb('0x11')](_0xa2eb('0xb'),_0x56b33a,_0xa2eb('0xc'));_0x550a3c(_0x5480a1[_0xa2eb('0x12')][_0xa2eb('0x10')]);}})[_0xa2eb('0x13')](function(_0x3a02d5){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x56b33a,_0x3a02d5);_0x56408f(_0x3a02d5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 59468c2..99f980e 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 _0xf44e=['/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index'];(function(_0xa93eec,_0x1a135e){var _0x1d1cb6=function(_0x44c7ef){while(--_0x44c7ef){_0xa93eec['push'](_0xa93eec['shift']());}};_0x1d1cb6(++_0x1a135e);}(_0xf44e,0x1d5));var _0xef44=function(_0x49a53d,_0x57cd3f){_0x49a53d=_0x49a53d-0x0;var _0x2e231e=_0xf44e[_0x49a53d];return _0x2e231e;};'use strict';var multer=require(_0xef44('0x0'));var util=require('util');var path=require(_0xef44('0x1'));var timeout=require(_0xef44('0x2'));var express=require('express');var router=express[_0xef44('0x3')]();var fs_extra=require(_0xef44('0x4'));var auth=require(_0xef44('0x5'));var interaction=require(_0xef44('0x6'));var config=require(_0xef44('0x7'));var controller=require(_0xef44('0x8'));router[_0xef44('0x9')]('/',auth['isAuthenticated'](),controller[_0xef44('0xa')]);router[_0xef44('0x9')](_0xef44('0xb'),auth['isAuthenticated'](),controller[_0xef44('0xc')]);router[_0xef44('0xd')]('/',auth[_0xef44('0xe')](),controller[_0xef44('0xf')]);router[_0xef44('0x10')](_0xef44('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xef44('0x11')]('/:id',auth[_0xef44('0xe')](),controller[_0xef44('0x12')]);module[_0xef44('0x13')]=router; \ No newline at end of file +var _0xa0a3=['put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','create'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x471bef,_0x5d881d){_0x471bef=_0x471bef-0x0;var _0x12de86=_0xa0a3[_0x471bef];return _0x12de86;};'use strict';var multer=require('multer');var util=require(_0x3a0a('0x0'));var path=require(_0x3a0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a0a('0x2'));var router=express[_0x3a0a('0x3')]();var fs_extra=require(_0x3a0a('0x4'));var auth=require(_0x3a0a('0x5'));var interaction=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var controller=require(_0x3a0a('0x8'));router[_0x3a0a('0x9')]('/',auth[_0x3a0a('0xa')](),controller[_0x3a0a('0xb')]);router[_0x3a0a('0x9')](_0x3a0a('0xc'),auth[_0x3a0a('0xa')](),controller['show']);router['post']('/',auth[_0x3a0a('0xa')](),controller[_0x3a0a('0xd')]);router[_0x3a0a('0xe')](_0x3a0a('0xc'),auth[_0x3a0a('0xa')](),controller[_0x3a0a('0xf')]);router[_0x3a0a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3a0a('0x11')]);module[_0x3a0a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 04e809e..1e28b12 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 _0xa896=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist'];(function(_0x33fe5b,_0x3bd553){var _0x49fd5f=function(_0x57ae95){while(--_0x57ae95){_0x33fe5b['push'](_0x33fe5b['shift']());}};_0x49fd5f(++_0x3bd553);}(_0xa896,0x1a1));var _0x6a89=function(_0x2e8859,_0xd6b892){_0x2e8859=_0x2e8859-0x0;var _0x4f34bb=_0xa896[_0x2e8859];return _0x4f34bb;};'use strict';var Sequelize=require(_0x6a89('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6a89('0x1'),_0x6a89('0x2'),_0x6a89('0x3'),_0x6a89('0x4'),_0x6a89('0x5')),'defaultValue':_0x6a89('0x1')},'content':{'type':Sequelize[_0x6a89('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6a89('0x7')](_0x6a89('0x1'),_0x6a89('0x2'),_0x6a89('0x3'))},'keyContent':{'type':Sequelize[_0x6a89('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6a89('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a89('0x6')]}}; \ No newline at end of file +var _0x9ca4=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0x9ca4,0x143));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49ca('0x0'));module[_0x49ca('0x1')]={'type':{'type':Sequelize[_0x49ca('0x2')](_0x49ca('0x3'),_0x49ca('0x4'),_0x49ca('0x5'),_0x49ca('0x6'),_0x49ca('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49ca('0x8')]},'keyType':{'type':Sequelize[_0x49ca('0x2')](_0x49ca('0x3'),_0x49ca('0x4'),_0x49ca('0x5'))},'keyContent':{'type':Sequelize[_0x49ca('0x8')]},'idField':{'type':Sequelize[_0x49ca('0x8')]},'nameField':{'type':Sequelize[_0x49ca('0x8')]},'customField':{'type':Sequelize[_0x49ca('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49ca('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 780dca1..73a45e5 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 _0x01d9=['map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x547b78,_0x3fb16e){var _0x28f987=function(_0x59d284){while(--_0x59d284){_0x547b78['push'](_0x547b78['shift']());}};_0x28f987(++_0x3fb16e);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['DeskField'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['DeskField'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file +var _0x4e86=['stack','send','map','DeskField','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','VIRTUAL','name','where','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','end','sendStatus','error'];(function(_0x283217,_0x286dc9){var _0x2efe89=function(_0x43ca65){while(--_0x43ca65){_0x283217['push'](_0x283217['shift']());}};_0x2efe89(++_0x286dc9);}(_0x4e86,0xf3));var _0x64e8=function(_0x51ade4,_0x190d60){_0x51ade4=_0x51ade4-0x0;var _0x13ac0d=_0x4e86[_0x51ade4];return _0x13ac0d;};'use strict';var emlformat=require(_0x64e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64e8('0x1'));var jsonpatch=require(_0x64e8('0x2'));var rp=require('request-promise');var moment=require(_0x64e8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x64e8('0x4'));var path=require('path');var sox=require(_0x64e8('0x5'));var csv=require(_0x64e8('0x6'));var ejs=require(_0x64e8('0x7'));var fs=require('fs');var fs_extra=require(_0x64e8('0x8'));var _=require(_0x64e8('0x9'));var squel=require(_0x64e8('0xa'));var crypto=require(_0x64e8('0xb'));var jsforce=require(_0x64e8('0xc'));var deskjs=require(_0x64e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64e8('0xe'));var Papa=require('papaparse');var Redis=require(_0x64e8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x64e8('0x10'));var as=require(_0x64e8('0x11'));var hardwareService=require(_0x64e8('0x12'));var logger=require(_0x64e8('0x13'))(_0x64e8('0x14'));var utils=require(_0x64e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64e8('0x16'))['db'];function respondWithStatusCode(_0x398eb5,_0x454bec){_0x454bec=_0x454bec||0xcc;return function(_0x1545a5){if(_0x1545a5){return _0x398eb5['sendStatus'](_0x454bec);}return _0x398eb5[_0x64e8('0x17')](_0x454bec)['end']();};}function respondWithResult(_0x6618b8,_0x4b4c32){_0x4b4c32=_0x4b4c32||0xc8;return function(_0x13e9fa){if(_0x13e9fa){return _0x6618b8[_0x64e8('0x17')](_0x4b4c32)[_0x64e8('0x18')](_0x13e9fa);}};}function respondWithFilteredResult(_0x5c0c13,_0x9c3e78){return function(_0x2b89f4){if(_0x2b89f4){var _0x43a515=typeof _0x9c3e78[_0x64e8('0x19')]===_0x64e8('0x1a')&&typeof _0x9c3e78[_0x64e8('0x1b')]===_0x64e8('0x1a');var _0x2d923b=_0x2b89f4['count'];var _0x4a1638=_0x43a515?0x0:_0x9c3e78['offset'];var _0x3cbd68=_0x43a515?_0x2b89f4[_0x64e8('0x1c')]:_0x9c3e78[_0x64e8('0x19')]+_0x9c3e78[_0x64e8('0x1b')];var _0x47015d;if(_0x3cbd68>=_0x2d923b){_0x3cbd68=_0x2d923b;_0x47015d=0xc8;}else{_0x47015d=0xce;}_0x5c0c13[_0x64e8('0x17')](_0x47015d);return _0x5c0c13['set']('Content-Range',_0x4a1638+'-'+_0x3cbd68+'/'+_0x2d923b)[_0x64e8('0x18')](_0x2b89f4);}return null;};}function patchUpdates(_0x2b6e56){return function(_0x2e9898){try{jsonpatch[_0x64e8('0x1d')](_0x2e9898,_0x2b6e56,!![]);}catch(_0x32be33){return BPromise['reject'](_0x32be33);}return _0x2e9898[_0x64e8('0x1e')]();};}function saveUpdates(_0x5e5466,_0x45056e){return function(_0x1a44cc){if(_0x1a44cc){return _0x1a44cc[_0x64e8('0x1f')](_0x5e5466)[_0x64e8('0x20')](function(_0x22e4f5){return _0x22e4f5;});}return null;};}function removeEntity(_0x5cb4a2,_0x14b8b4){return function(_0x4f66af){if(_0x4f66af){return _0x4f66af[_0x64e8('0x21')]()['then'](function(){_0x5cb4a2[_0x64e8('0x17')](0xcc)[_0x64e8('0x22')]();});}};}function handleEntityNotFound(_0x45656c,_0xfa29eb){return function(_0x23b7d4){if(!_0x23b7d4){_0x45656c[_0x64e8('0x23')](0x194);}return _0x23b7d4;};}function handleError(_0x2b6b57,_0x4e175f){_0x4e175f=_0x4e175f||0x1f4;return function(_0x4e5cfa){logger[_0x64e8('0x24')](_0x4e5cfa[_0x64e8('0x25')]);if(_0x4e5cfa['name']){delete _0x4e5cfa['name'];}_0x2b6b57[_0x64e8('0x17')](_0x4e175f)[_0x64e8('0x26')](_0x4e5cfa);};}exports['index']=function(_0x3915fe,_0x6976e5){var _0x5726e4={},_0xd5fd87={},_0x128880={'count':0x0,'rows':[]};var _0x5cdd18=_[_0x64e8('0x27')](db[_0x64e8('0x28')][_0x64e8('0x29')],function(_0x169e00){return{'name':_0x169e00['fieldName'],'type':_0x169e00[_0x64e8('0x2a')]['key']};});_0xd5fd87[_0x64e8('0x2b')]=_['map'](_0x5cdd18,'name');_0xd5fd87['query']=_[_0x64e8('0x2c')](_0x3915fe[_0x64e8('0x2d')]);_0xd5fd87[_0x64e8('0x2e')]=_[_0x64e8('0x2f')](_0xd5fd87[_0x64e8('0x2b')],_0xd5fd87[_0x64e8('0x2d')]);_0x5726e4[_0x64e8('0x30')]=_[_0x64e8('0x2f')](_0xd5fd87['model'],qs[_0x64e8('0x31')](_0x3915fe['query']['fields']));_0x5726e4[_0x64e8('0x30')]=_0x5726e4[_0x64e8('0x30')][_0x64e8('0x32')]?_0x5726e4['attributes']:_0xd5fd87[_0x64e8('0x2b')];if(!_0x3915fe['query']['hasOwnProperty'](_0x64e8('0x33'))){_0x5726e4[_0x64e8('0x1b')]=qs[_0x64e8('0x1b')](_0x3915fe['query']['limit']);_0x5726e4[_0x64e8('0x19')]=qs[_0x64e8('0x19')](_0x3915fe['query'][_0x64e8('0x19')]);}_0x5726e4['order']=qs[_0x64e8('0x34')](_0x3915fe[_0x64e8('0x2d')]['sort']);_0x5726e4['where']=qs[_0x64e8('0x2e')](_[_0x64e8('0x35')](_0x3915fe[_0x64e8('0x2d')],_0xd5fd87[_0x64e8('0x2e')]),_0x5cdd18);if(_0x3915fe[_0x64e8('0x2d')][_0x64e8('0x36')]){_0x5726e4['where']=_[_0x64e8('0x37')](_0x5726e4['where'],{'$or':_['map'](_0x5cdd18,function(_0x30881c){if(_0x30881c['type']!==_0x64e8('0x38')){var _0x4fb785={};_0x4fb785[_0x30881c[_0x64e8('0x39')]]={'$like':'%'+_0x3915fe[_0x64e8('0x2d')][_0x64e8('0x36')]+'%'};return _0x4fb785;}})});}_0x5726e4=_['merge']({},_0x5726e4,_0x3915fe['options']);var _0x105500={'where':_0x5726e4[_0x64e8('0x3a')]};return db[_0x64e8('0x28')]['count'](_0x105500)['then'](function(_0x39286f){_0x128880[_0x64e8('0x1c')]=_0x39286f;if(_0x3915fe[_0x64e8('0x2d')][_0x64e8('0x3b')]){_0x5726e4[_0x64e8('0x3c')]=[{'all':!![]}];}return db[_0x64e8('0x28')][_0x64e8('0x3d')](_0x5726e4);})[_0x64e8('0x20')](function(_0x59fb21){_0x128880[_0x64e8('0x3e')]=_0x59fb21;return _0x128880;})['then'](respondWithFilteredResult(_0x6976e5,_0x5726e4))[_0x64e8('0x3f')](handleError(_0x6976e5,null));};exports[_0x64e8('0x40')]=function(_0x32fcd9,_0x12a98){var _0x269244={'raw':!![],'where':{'id':_0x32fcd9[_0x64e8('0x41')]['id']}},_0x1b745d={};_0x1b745d[_0x64e8('0x2b')]=_['keys'](db[_0x64e8('0x28')]['rawAttributes']);_0x1b745d[_0x64e8('0x2d')]=_[_0x64e8('0x2c')](_0x32fcd9[_0x64e8('0x2d')]);_0x1b745d[_0x64e8('0x2e')]=_[_0x64e8('0x2f')](_0x1b745d[_0x64e8('0x2b')],_0x1b745d[_0x64e8('0x2d')]);_0x269244[_0x64e8('0x30')]=_[_0x64e8('0x2f')](_0x1b745d['model'],qs[_0x64e8('0x31')](_0x32fcd9[_0x64e8('0x2d')]['fields']));_0x269244[_0x64e8('0x30')]=_0x269244[_0x64e8('0x30')]['length']?_0x269244['attributes']:_0x1b745d[_0x64e8('0x2b')];if(_0x32fcd9[_0x64e8('0x2d')][_0x64e8('0x3b')]){_0x269244[_0x64e8('0x3c')]=[{'all':!![]}];}_0x269244=_[_0x64e8('0x37')]({},_0x269244,_0x32fcd9[_0x64e8('0x42')]);return db['DeskField']['find'](_0x269244)[_0x64e8('0x20')](handleEntityNotFound(_0x12a98,null))[_0x64e8('0x20')](respondWithResult(_0x12a98,null))['catch'](handleError(_0x12a98,null));};exports['create']=function(_0x4522eb,_0x21954a){return db[_0x64e8('0x28')][_0x64e8('0x43')](_0x4522eb[_0x64e8('0x44')],{})[_0x64e8('0x20')](respondWithResult(_0x21954a,0xc9))[_0x64e8('0x3f')](handleError(_0x21954a,null));};exports[_0x64e8('0x1f')]=function(_0xc966a7,_0x526bce){if(_0xc966a7['body']['id']){delete _0xc966a7[_0x64e8('0x44')]['id'];}return db[_0x64e8('0x28')][_0x64e8('0x45')]({'where':{'id':_0xc966a7[_0x64e8('0x41')]['id']}})[_0x64e8('0x20')](handleEntityNotFound(_0x526bce,null))[_0x64e8('0x20')](saveUpdates(_0xc966a7[_0x64e8('0x44')],null))['then'](respondWithResult(_0x526bce,null))[_0x64e8('0x3f')](handleError(_0x526bce,null));};exports[_0x64e8('0x21')]=function(_0x568798,_0x2a7e83){return db[_0x64e8('0x28')][_0x64e8('0x45')]({'where':{'id':_0x568798[_0x64e8('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a7e83,null))[_0x64e8('0x20')](removeEntity(_0x2a7e83,null))[_0x64e8('0x3f')](handleError(_0x2a7e83,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index da11d22..82744cd 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 _0x676a=['define','DeskField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x9fb085,_0x2251a3){var _0x400c75=function(_0x1455ed){while(--_0x1455ed){_0x9fb085['push'](_0x9fb085['shift']());}};_0x400c75(++_0x2251a3);}(_0x676a,0x1ef));var _0xa676=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x676a[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0xa676('0x0'));var util=require(_0xa676('0x1'));var logger=require(_0xa676('0x2'))(_0xa676('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa676('0x4'));var fs=require('fs');var path=require(_0xa676('0x5'));var rimraf=require(_0xa676('0x6'));var config=require(_0xa676('0x7'));var attributes=require(_0xa676('0x8'));module['exports']=function(_0x2bf33c,_0x215f5f){return _0x2bf33c[_0xa676('0x9')](_0xa676('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xa676('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3620=['FieldId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index'];(function(_0x32bdd4,_0x143a69){var _0x4b54d3=function(_0x5c38d6){while(--_0x5c38d6){_0x32bdd4['push'](_0x32bdd4['shift']());}};_0x4b54d3(++_0x143a69);}(_0x3620,0x181));var _0x0362=function(_0x56e9bc,_0x15a8e1){_0x56e9bc=_0x56e9bc-0x0;var _0x6d7561=_0x3620[_0x56e9bc];return _0x6d7561;};'use strict';var _=require(_0x0362('0x0'));var util=require(_0x0362('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0362('0x2'));var BPromise=require(_0x0362('0x3'));var rp=require(_0x0362('0x4'));var fs=require('fs');var path=require(_0x0362('0x5'));var rimraf=require('rimraf');var config=require(_0x0362('0x6'));var attributes=require(_0x0362('0x7'));module[_0x0362('0x8')]=function(_0x2c4be5,_0x11a75b){return _0x2c4be5['define'](_0x0362('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x0362('0xa'),'fields':['idField',_0x0362('0xb')],'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 7b83714..370876f 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 _0xabca=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1e1c0d,_0x3c0b66){var _0x40adc7=function(_0x43de95){while(--_0x43de95){_0x1e1c0d['push'](_0x1e1c0d['shift']());}};_0x40adc7(++_0x3c0b66);}(_0xabca,0x6f));var _0xaabc=function(_0x47df6a,_0x293395){_0x47df6a=_0x47df6a-0x0;var _0x2c9f47=_0xabca[_0x47df6a];return _0x2c9f47;};'use strict';var _=require(_0xaabc('0x0'));var util=require(_0xaabc('0x1'));var moment=require(_0xaabc('0x2'));var BPromise=require(_0xaabc('0x3'));var rs=require(_0xaabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaabc('0x5'))['db'];var utils=require(_0xaabc('0x6'));var logger=require(_0xaabc('0x7'))('rpc');var config=require(_0xaabc('0x8'));var jayson=require(_0xaabc('0x9'));var client=jayson[_0xaabc('0xa')][_0xaabc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19178f,_0x5015f4,_0x228ab9){return new BPromise(function(_0x56c71b,_0x12cda8){return client['request'](_0x19178f,_0x228ab9)[_0xaabc('0xc')](function(_0x2414a8){logger[_0xaabc('0xd')](_0xaabc('0xe'),_0x5015f4,'request\x20sent');logger[_0xaabc('0xf')](_0xaabc('0x10'),_0x5015f4,_0xaabc('0x11'),JSON[_0xaabc('0x12')](_0x2414a8));if(_0x2414a8[_0xaabc('0x13')]){if(_0x2414a8[_0xaabc('0x13')]['code']===0x1f4){logger[_0xaabc('0x13')](_0xaabc('0xe'),_0x5015f4,_0x2414a8[_0xaabc('0x13')][_0xaabc('0x14')]);return _0x12cda8(_0x2414a8[_0xaabc('0x13')][_0xaabc('0x14')]);}logger[_0xaabc('0x13')]('DeskField,\x20%s,\x20%s',_0x5015f4,_0x2414a8[_0xaabc('0x13')][_0xaabc('0x14')]);return _0x56c71b(_0x2414a8[_0xaabc('0x13')][_0xaabc('0x14')]);}else{logger[_0xaabc('0xd')](_0xaabc('0xe'),_0x5015f4,_0xaabc('0x11'));_0x56c71b(_0x2414a8['result']['message']);}})[_0xaabc('0x15')](function(_0x4afb20){logger[_0xaabc('0x13')](_0xaabc('0xe'),_0x5015f4,_0x4afb20);_0x12cda8(_0x4afb20);});});} \ No newline at end of file +var _0x8983=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3b1c0c,_0x3d8063){var _0x5120bc=function(_0x2fce52){while(--_0x2fce52){_0x3b1c0c['push'](_0x3b1c0c['shift']());}};_0x5120bc(++_0x3d8063);}(_0x8983,0xf6));var _0x3898=function(_0x5e728b,_0x12269f){_0x5e728b=_0x5e728b-0x0;var _0x1620ca=_0x8983[_0x5e728b];return _0x1620ca;};'use strict';var _=require(_0x3898('0x0'));var util=require(_0x3898('0x1'));var moment=require(_0x3898('0x2'));var BPromise=require('bluebird');var rs=require(_0x3898('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3898('0x4'))['db'];var utils=require(_0x3898('0x5'));var logger=require(_0x3898('0x6'))(_0x3898('0x7'));var config=require(_0x3898('0x8'));var jayson=require(_0x3898('0x9'));var client=jayson[_0x3898('0xa')][_0x3898('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370d07,_0x72c58c,_0xafcef0){return new BPromise(function(_0x280f59,_0x55caa2){return client[_0x3898('0xc')](_0x370d07,_0xafcef0)[_0x3898('0xd')](function(_0x3e24ef){logger[_0x3898('0xe')](_0x3898('0xf'),_0x72c58c,_0x3898('0x10'));logger['debug'](_0x3898('0x11'),_0x72c58c,'request\x20sent',JSON[_0x3898('0x12')](_0x3e24ef));if(_0x3e24ef[_0x3898('0x13')]){if(_0x3e24ef['error'][_0x3898('0x14')]===0x1f4){logger[_0x3898('0x13')](_0x3898('0xf'),_0x72c58c,_0x3e24ef[_0x3898('0x13')]['message']);return _0x55caa2(_0x3e24ef[_0x3898('0x13')][_0x3898('0x15')]);}logger[_0x3898('0x13')](_0x3898('0xf'),_0x72c58c,_0x3e24ef[_0x3898('0x13')]['message']);return _0x280f59(_0x3e24ef[_0x3898('0x13')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x72c58c,_0x3898('0x10'));_0x280f59(_0x3e24ef[_0x3898('0x16')][_0x3898('0x15')]);}})[_0x3898('0x17')](function(_0x1196de){logger[_0x3898('0x13')](_0x3898('0xf'),_0x72c58c,_0x1196de);_0x55caa2(_0x1196de);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index cadf3ea..b915554 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 _0x63a8=['show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x63a8,0x113));var _0x863a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x63a8[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x863a('0x0'));var path=require(_0x863a('0x1'));var timeout=require(_0x863a('0x2'));var express=require(_0x863a('0x3'));var router=express[_0x863a('0x4')]();var fs_extra=require(_0x863a('0x5'));var auth=require(_0x863a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x863a('0x7'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x863a('0x8')]);router[_0x863a('0x9')](_0x863a('0xa'),auth['isAuthenticated'](),controller[_0x863a('0xb')]);router[_0x863a('0x9')](_0x863a('0xc'),auth[_0x863a('0xd')](),controller[_0x863a('0xe')]);router[_0x863a('0x9')](_0x863a('0xf'),auth['isAuthenticated'](),controller[_0x863a('0x10')]);router['post']('/',auth[_0x863a('0xd')](),controller[_0x863a('0x11')]);router['post'](_0x863a('0xc'),auth[_0x863a('0xd')](),controller['addConfiguration']);router[_0x863a('0x12')]('/:id',auth[_0x863a('0xd')](),controller[_0x863a('0x13')]);router['delete']('/:id',auth[_0x863a('0xd')](),controller[_0x863a('0x14')]);module[_0x863a('0x15')]=router; \ No newline at end of file +var _0x6ea4=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x6ea4,0x160));var _0x46ea=function(_0x5a4a1f,_0x3f90b6){_0x5a4a1f=_0x5a4a1f-0x0;var _0x43db26=_0x6ea4[_0x5a4a1f];return _0x43db26;};'use strict';var multer=require('multer');var util=require(_0x46ea('0x0'));var path=require(_0x46ea('0x1'));var timeout=require(_0x46ea('0x2'));var express=require('express');var router=express[_0x46ea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x46ea('0x4'));var interaction=require(_0x46ea('0x5'));var config=require(_0x46ea('0x6'));var controller=require(_0x46ea('0x7'));router[_0x46ea('0x8')]('/',auth[_0x46ea('0x9')](),controller[_0x46ea('0xa')]);router[_0x46ea('0x8')](_0x46ea('0xb'),auth[_0x46ea('0x9')](),controller[_0x46ea('0xc')]);router[_0x46ea('0x8')](_0x46ea('0xd'),auth['isAuthenticated'](),controller[_0x46ea('0xe')]);router['get'](_0x46ea('0xf'),auth[_0x46ea('0x9')](),controller[_0x46ea('0x10')]);router['post']('/',auth[_0x46ea('0x9')](),controller[_0x46ea('0x11')]);router[_0x46ea('0x12')](_0x46ea('0xd'),auth[_0x46ea('0x9')](),controller[_0x46ea('0x13')]);router[_0x46ea('0x14')]('/:id',auth[_0x46ea('0x9')](),controller['update']);router[_0x46ea('0x15')]('/:id',auth[_0x46ea('0x9')](),controller[_0x46ea('0x16')]);module[_0x46ea('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 5d7ed74..ef5c5ba 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 _0xbdb9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x170353,_0x1e3129){var _0x715fcb=function(_0x52899b){while(--_0x52899b){_0x170353['push'](_0x170353['shift']());}};_0x715fcb(++_0x1e3129);}(_0xbdb9,0xac));var _0x9bdb=function(_0x2a683c,_0x5ef6bc){_0x2a683c=_0x2a683c-0x0;var _0x1c383d=_0xbdb9[_0x2a683c];return _0x1c383d;};'use strict';var Sequelize=require(_0x9bdb('0x0'));module[_0x9bdb('0x1')]={'name':{'type':Sequelize[_0x9bdb('0x2')]},'username':{'type':Sequelize[_0x9bdb('0x2')]},'password':{'type':Sequelize[_0x9bdb('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9bdb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x9bdb('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7d10=['exports','STRING','BOOLEAN'];(function(_0x4b97d7,_0x1c9b1a){var _0x4a19c5=function(_0x1b73fb){while(--_0x1b73fb){_0x4b97d7['push'](_0x4b97d7['shift']());}};_0x4a19c5(++_0x1c9b1a);}(_0x7d10,0x1ce));var _0x07d1=function(_0x4dfda7,_0x5d71eb){_0x4dfda7=_0x4dfda7-0x0;var _0x2a95da=_0x7d10[_0x4dfda7];return _0x2a95da;};'use strict';var Sequelize=require('sequelize');module[_0x07d1('0x0')]={'name':{'type':Sequelize[_0x07d1('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x07d1('0x1')]},'remoteUri':{'type':Sequelize[_0x07d1('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x07d1('0x1')]},'clientSecret':{'type':Sequelize[_0x07d1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x07d1('0x1')]},'modernAuthentication':{'type':Sequelize[_0x07d1('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8b03ec7..bffbfae 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 _0x1ecf=['versionnumber','concat','findOne','username','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','/oauth2/token','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','statusCode','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','Dynamics365Account','includeAll','include','findAll','rows','catch','params','keys','length','options','create','body','find','getConfigurations','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode'];(function(_0x17499b,_0x1b2ffd){var _0x5d2b45=function(_0x55f4e2){while(--_0x55f4e2){_0x17499b['push'](_0x17499b['shift']());}};_0x5d2b45(++_0x1b2ffd);}(_0x1ecf,0xf4));var _0xf1ec=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x1ecf[_0x27dba4];return _0x35ec9d;};'use strict';var rp=require(_0xf1ec('0x0'));var util=require(_0xf1ec('0x1'));var _=require('lodash');var qs=require(_0xf1ec('0x2'));var logger=require(_0xf1ec('0x3'))(_0xf1ec('0x4'));var db=require(_0xf1ec('0x5'))['db'];var integrations=require(_0xf1ec('0x6'));function respondWithResult(_0x1401ef,_0x36ea01){_0x36ea01=_0x36ea01||0xc8;return function(_0x7a2992){if(_0x7a2992){return _0x1401ef[_0xf1ec('0x7')](_0x36ea01)[_0xf1ec('0x8')](_0x7a2992);}};}function respondWithFilteredResult(_0x61b052,_0x369ba3){return function(_0x1ea5c6){if(_0x1ea5c6){var _0x16db86=typeof _0x369ba3[_0xf1ec('0x9')]===_0xf1ec('0xa')&&typeof _0x369ba3[_0xf1ec('0xb')]===_0xf1ec('0xa');var _0xe57e36=_0x1ea5c6[_0xf1ec('0xc')];var _0x587a69=_0x16db86?0x0:_0x369ba3[_0xf1ec('0x9')];var _0x3635eb=_0x16db86?_0x1ea5c6[_0xf1ec('0xc')]:_0x369ba3['offset']+_0x369ba3[_0xf1ec('0xb')];var _0x34b0d6;if(_0x3635eb>=_0xe57e36){_0x3635eb=_0xe57e36;_0x34b0d6=0xc8;}else{_0x34b0d6=0xce;}_0x61b052[_0xf1ec('0x7')](_0x34b0d6);return _0x61b052['set'](_0xf1ec('0xd'),_0x587a69+'-'+_0x3635eb+'/'+_0xe57e36)[_0xf1ec('0x8')](_0x1ea5c6);}return null;};}function saveUpdates(_0x2d54af){return function(_0x5b9e0d){if(_0x5b9e0d){return _0x5b9e0d[_0xf1ec('0xe')](_0x2d54af)['then'](function(_0x38d6e5){return _0x38d6e5;});}return null;};}function removeEntity(_0xfb1e81){return function(_0x62d932){if(_0x62d932){return _0x62d932[_0xf1ec('0xf')]()[_0xf1ec('0x10')](function(){_0xfb1e81[_0xf1ec('0x7')](0xcc)[_0xf1ec('0x11')]();});}};}function handleEntityNotFound(_0x522cf3){return function(_0x112d7c){if(!_0x112d7c){_0x522cf3[_0xf1ec('0x12')](0x194);}return _0x112d7c;};}function handleError(_0x2e0f74,_0x2deb38){_0x2deb38=_0x2deb38||0x1f4;return function(_0x1199c2){logger[_0xf1ec('0x13')](_0x1199c2[_0xf1ec('0x14')]);if(_0x1199c2[_0xf1ec('0x15')]){delete _0x1199c2[_0xf1ec('0x15')];}_0x2e0f74[_0xf1ec('0x7')](_0x2deb38)[_0xf1ec('0x16')](_0x1199c2);};}exports[_0xf1ec('0x17')]=function(_0x534065,_0x300bb3){var _0x45fac0={},_0x39eaeb={},_0x2eb360={'count':0x0,'rows':[]};var _0x37808e=_[_0xf1ec('0x18')](db['Dynamics365Account'][_0xf1ec('0x19')],function(_0x134c5a){return{'name':_0x134c5a[_0xf1ec('0x1a')],'type':_0x134c5a[_0xf1ec('0x1b')]['key']};});_0x39eaeb[_0xf1ec('0x1c')]=_[_0xf1ec('0x18')](_0x37808e,_0xf1ec('0x15'));_0x39eaeb[_0xf1ec('0x1d')]=_['keys'](_0x534065[_0xf1ec('0x1d')]);_0x39eaeb[_0xf1ec('0x1e')]=_['intersection'](_0x39eaeb[_0xf1ec('0x1c')],_0x39eaeb[_0xf1ec('0x1d')]);_0x45fac0['attributes']=_[_0xf1ec('0x1f')](_0x39eaeb['model'],qs['fields'](_0x534065[_0xf1ec('0x1d')][_0xf1ec('0x20')]));_0x45fac0[_0xf1ec('0x21')]=_0x45fac0[_0xf1ec('0x21')]['length']?_0x45fac0[_0xf1ec('0x21')]:_0x39eaeb[_0xf1ec('0x1c')];if(!_0x534065[_0xf1ec('0x1d')][_0xf1ec('0x22')]('nolimit')){_0x45fac0['limit']=qs['limit'](_0x534065['query'][_0xf1ec('0xb')]);_0x45fac0[_0xf1ec('0x9')]=qs[_0xf1ec('0x9')](_0x534065[_0xf1ec('0x1d')][_0xf1ec('0x9')]);}_0x45fac0[_0xf1ec('0x23')]=qs['sort'](_0x534065[_0xf1ec('0x1d')][_0xf1ec('0x24')]);_0x45fac0[_0xf1ec('0x25')]=qs[_0xf1ec('0x1e')](_[_0xf1ec('0x26')](_0x534065[_0xf1ec('0x1d')],_0x39eaeb['filters']),_0x37808e);if(_0x534065[_0xf1ec('0x1d')]['filter']){_0x45fac0[_0xf1ec('0x25')]=_[_0xf1ec('0x27')](_0x45fac0[_0xf1ec('0x25')],{'$or':_[_0xf1ec('0x18')](_0x37808e,function(_0x448091){if(_0x448091[_0xf1ec('0x1b')]!==_0xf1ec('0x28')){var _0x5e0b3f={};_0x5e0b3f[_0x448091[_0xf1ec('0x15')]]={'$like':'%'+_0x534065[_0xf1ec('0x1d')][_0xf1ec('0x29')]+'%'};return _0x5e0b3f;}})});}_0x45fac0=_[_0xf1ec('0x27')]({},_0x45fac0,_0x534065['options']);var _0x21bd23={'where':_0x45fac0[_0xf1ec('0x25')]};return db[_0xf1ec('0x2a')]['count'](_0x21bd23)['then'](function(_0x15bde2){_0x2eb360[_0xf1ec('0xc')]=_0x15bde2;if(_0x534065[_0xf1ec('0x1d')][_0xf1ec('0x2b')]){_0x45fac0[_0xf1ec('0x2c')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xf1ec('0x2d')](_0x45fac0);})[_0xf1ec('0x10')](function(_0x4d867a){_0x2eb360[_0xf1ec('0x2e')]=_0x4d867a;return _0x2eb360;})[_0xf1ec('0x10')](respondWithFilteredResult(_0x300bb3,_0x45fac0))[_0xf1ec('0x2f')](handleError(_0x300bb3,null));};exports['show']=function(_0x521648,_0x3f384a){var _0x2475aa={'raw':![],'where':{'id':_0x521648[_0xf1ec('0x30')]['id']}},_0x3f3eb3={};_0x3f3eb3[_0xf1ec('0x1c')]=_[_0xf1ec('0x31')](db[_0xf1ec('0x2a')][_0xf1ec('0x19')]);_0x3f3eb3['query']=_[_0xf1ec('0x31')](_0x521648[_0xf1ec('0x1d')]);_0x3f3eb3[_0xf1ec('0x1e')]=_[_0xf1ec('0x1f')](_0x3f3eb3[_0xf1ec('0x1c')],_0x3f3eb3['query']);_0x2475aa[_0xf1ec('0x21')]=_[_0xf1ec('0x1f')](_0x3f3eb3[_0xf1ec('0x1c')],qs[_0xf1ec('0x20')](_0x521648[_0xf1ec('0x1d')][_0xf1ec('0x20')]));_0x2475aa[_0xf1ec('0x21')]=_0x2475aa['attributes'][_0xf1ec('0x32')]?_0x2475aa[_0xf1ec('0x21')]:_0x3f3eb3[_0xf1ec('0x1c')];if(_0x521648[_0xf1ec('0x1d')][_0xf1ec('0x2b')]){_0x2475aa[_0xf1ec('0x2c')]=[{'all':!![]}];}_0x2475aa=_[_0xf1ec('0x27')]({},_0x2475aa,_0x521648[_0xf1ec('0x33')]);return db[_0xf1ec('0x2a')]['find'](_0x2475aa)[_0xf1ec('0x10')](handleEntityNotFound(_0x3f384a,null))[_0xf1ec('0x10')](respondWithResult(_0x3f384a,null))[_0xf1ec('0x2f')](handleError(_0x3f384a,null));};exports[_0xf1ec('0x34')]=function(_0x48f7eb,_0x38702b){return db[_0xf1ec('0x2a')][_0xf1ec('0x34')](_0x48f7eb[_0xf1ec('0x35')],{})[_0xf1ec('0x10')](respondWithResult(_0x38702b,0xc9))[_0xf1ec('0x2f')](handleError(_0x38702b,null));};exports[_0xf1ec('0xe')]=function(_0x3ab8eb,_0x372a76){if(_0x3ab8eb[_0xf1ec('0x35')]['id']){delete _0x3ab8eb[_0xf1ec('0x35')]['id'];}return db[_0xf1ec('0x2a')][_0xf1ec('0x36')]({'where':{'id':_0x3ab8eb[_0xf1ec('0x30')]['id']}})[_0xf1ec('0x10')](handleEntityNotFound(_0x372a76,null))[_0xf1ec('0x10')](saveUpdates(_0x3ab8eb[_0xf1ec('0x35')],null))[_0xf1ec('0x10')](respondWithResult(_0x372a76,null))['catch'](handleError(_0x372a76,null));};exports[_0xf1ec('0xf')]=function(_0x158699,_0x144054){return db[_0xf1ec('0x2a')][_0xf1ec('0x36')]({'where':{'id':_0x158699['params']['id']}})[_0xf1ec('0x10')](handleEntityNotFound(_0x144054,null))[_0xf1ec('0x10')](removeEntity(_0x144054,null))['catch'](handleError(_0x144054,null));};exports[_0xf1ec('0x37')]=function(_0x8a2b63,_0x3c9d08){var _0x293e60={};var _0x2143cc={};var _0x18340e;var _0x6803a9;return db[_0xf1ec('0x2a')]['findOne']({'where':{'id':_0x8a2b63[_0xf1ec('0x30')]['id']}})[_0xf1ec('0x10')](handleEntityNotFound(_0x3c9d08,null))[_0xf1ec('0x10')](function(_0x24afbf){if(_0x24afbf){_0x18340e=_0x24afbf;_0x2143cc[_0xf1ec('0x1c')]=_[_0xf1ec('0x31')](db['Dynamics365Configuration'][_0xf1ec('0x19')]);_0x2143cc[_0xf1ec('0x1d')]=_[_0xf1ec('0x31')](_0x8a2b63[_0xf1ec('0x1d')]);_0x2143cc[_0xf1ec('0x1e')]=_[_0xf1ec('0x1f')](_0x2143cc['model'],_0x2143cc[_0xf1ec('0x1d')]);_0x293e60['attributes']=_[_0xf1ec('0x1f')](_0x2143cc[_0xf1ec('0x1c')],qs[_0xf1ec('0x20')](_0x8a2b63[_0xf1ec('0x1d')]['fields']));_0x293e60['attributes']=_0x293e60[_0xf1ec('0x21')]['length']?_0x293e60[_0xf1ec('0x21')]:_0x2143cc[_0xf1ec('0x1c')];_0x293e60[_0xf1ec('0x23')]=qs[_0xf1ec('0x24')](_0x8a2b63[_0xf1ec('0x1d')]['sort']);_0x293e60[_0xf1ec('0x25')]=qs[_0xf1ec('0x1e')](_['pick'](_0x8a2b63[_0xf1ec('0x1d')],_0x2143cc[_0xf1ec('0x1e')]));if(_0x8a2b63[_0xf1ec('0x1d')][_0xf1ec('0x29')]){_0x293e60['where']=_['merge'](_0x293e60[_0xf1ec('0x25')],{'$or':_['map'](_0x293e60[_0xf1ec('0x21')],function(_0x467819){var _0x27d943={};_0x27d943[_0x467819]={'$like':'%'+_0x8a2b63[_0xf1ec('0x1d')][_0xf1ec('0x29')]+'%'};return _0x27d943;})});}_0x293e60=_[_0xf1ec('0x27')]({},_0x293e60,_0x8a2b63[_0xf1ec('0x33')]);return _0x18340e[_0xf1ec('0x37')](_0x293e60);}})[_0xf1ec('0x10')](function(_0x4e4c10){if(_0x4e4c10){_0x6803a9=_0x4e4c10[_0xf1ec('0x32')];if(!_0x8a2b63[_0xf1ec('0x1d')]['hasOwnProperty'](_0xf1ec('0x38'))){_0x293e60[_0xf1ec('0xb')]=qs[_0xf1ec('0xb')](_0x8a2b63[_0xf1ec('0x1d')][_0xf1ec('0xb')]);_0x293e60[_0xf1ec('0x9')]=qs[_0xf1ec('0x9')](_0x8a2b63[_0xf1ec('0x1d')][_0xf1ec('0x9')]);}return _0x18340e[_0xf1ec('0x37')](_0x293e60);}})[_0xf1ec('0x10')](function(_0x10b69e){if(_0x10b69e){return _0x10b69e?{'count':_0x6803a9,'rows':_0x10b69e}:null;}})[_0xf1ec('0x10')](respondWithResult(_0x3c9d08,null))['catch'](handleError(_0x3c9d08,null));};exports['addConfiguration']=function(_0x4ab00a,_0x22af54){if(_0x4ab00a['body']['id']){delete _0x4ab00a['body']['id'];}return db[_0xf1ec('0x2a')]['findOne']({'where':{'id':_0x4ab00a[_0xf1ec('0x30')]['id']}})[_0xf1ec('0x10')](handleEntityNotFound(_0x22af54,null))['then'](function(_0x3ec095){if(_0x3ec095){_0x4ab00a['body'][_0xf1ec('0x39')]=_0x3ec095['id'];_0x4ab00a['body'][_0xf1ec('0x3a')]=integrations[_0xf1ec('0x3b')](_0x4ab00a[_0xf1ec('0x35')][_0xf1ec('0x3c')],_0x4ab00a['body'][_0xf1ec('0x1b')]);_0x4ab00a[_0xf1ec('0x35')][_0xf1ec('0x3d')]=integrations['getDescriptions'](_0x4ab00a[_0xf1ec('0x35')]['channel'],_0x4ab00a[_0xf1ec('0x35')]['type']);return db['Dynamics365Configuration'][_0xf1ec('0x34')](_0x4ab00a[_0xf1ec('0x35')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xf1ec('0x3e')],'as':'Descriptions'}]});}return null;})[_0xf1ec('0x10')](respondWithResult(_0x22af54,null))[_0xf1ec('0x2f')](handleError(_0x22af54,null));};function sanitizeRemoteUri(_0xbb6508){var _0x44db83=_0xbb6508['slice'](-0x1);if(_0x44db83==='/')return _0xbb6508[_0xf1ec('0x3f')](0x0,_0xbb6508[_0xf1ec('0x40')](_0x44db83));return _0xbb6508;}function getWebApiUrl(_0x49ac2a){return util['format'](_0xf1ec('0x41'),_0x49ac2a);}exports[_0xf1ec('0x42')]=function(_0x2fbbef,_0xf89fb9){var _0x29f6bd=_0x2fbbef[_0xf1ec('0x1d')]['ticketType'];var _0x35ef40=_0x29f6bd===_0xf1ec('0x43')?_0xf1ec('0x44'):_0xf1ec('0x45');var _0x507e33='';var _0x26ebe6='';var _0x376471='';var _0x4c8885='';var _0x77facb='';var _0x7d9a64='';var _0x384423='';var _0x272ef3='';var _0x2fbfd2=[_0xf1ec('0x46'),'description',_0xf1ec('0x47'),_0xf1ec('0x48'),_0xf1ec('0x49'),_0xf1ec('0x4a'),'phonenumber',_0xf1ec('0x4b'),_0xf1ec('0x4c'),_0xf1ec('0x4d')];var _0x3dd326=['accountidname','accountidyominame','actualserviceunits','billedserviceunits',_0xf1ec('0x4e'),_0xf1ec('0x4f'),_0xf1ec('0x50'),_0xf1ec('0x51'),'createdbyexternalpartyname',_0xf1ec('0x52'),_0xf1ec('0x53'),_0xf1ec('0x54'),_0xf1ec('0x55'),_0xf1ec('0x56'),_0xf1ec('0x57'),'customeridname','customeridtype',_0xf1ec('0x58'),_0xf1ec('0x59'),_0xf1ec('0x5a'),_0xf1ec('0x5b'),'entityimage_url',_0xf1ec('0x5c'),'exchangerate',_0xf1ec('0x5d'),_0xf1ec('0x5e'),_0xf1ec('0x5f'),_0xf1ec('0x60'),'kbarticleidname',_0xf1ec('0x61'),_0xf1ec('0x62'),_0xf1ec('0x63'),_0xf1ec('0x64'),_0xf1ec('0x65'),_0xf1ec('0x66'),_0xf1ec('0x67'),_0xf1ec('0x68'),_0xf1ec('0x69'),_0xf1ec('0x6a'),'msdyn_iotalertname','numberofchildincidents',_0xf1ec('0x6b'),_0xf1ec('0x6c'),_0xf1ec('0x6d'),_0xf1ec('0x6e'),'owneridyominame','parentcaseidname','primarycontactidname',_0xf1ec('0x6f'),_0xf1ec('0x70'),_0xf1ec('0x71'),'productserialnumber','resolveby',_0xf1ec('0x72'),_0xf1ec('0x73'),_0xf1ec('0x74'),_0xf1ec('0x75'),'sentimentvalue',_0xf1ec('0x76'),'slaname',_0xf1ec('0x77'),'statecode','statuscode',_0xf1ec('0x78'),_0xf1ec('0x79'),_0xf1ec('0x7a'),_0xf1ec('0x7b'),_0xf1ec('0x7c'),_0xf1ec('0x7d'),_0xf1ec('0x7e')];var _0x78ee1=_0x2fbfd2[_0xf1ec('0x7f')](_0x3dd326);return db[_0xf1ec('0x2a')][_0xf1ec('0x80')]({'where':{'id':_0x2fbbef['params']['id']},'attributes':['id',_0xf1ec('0x81'),'password',_0xf1ec('0x82'),_0xf1ec('0x83'),_0xf1ec('0x84'),'clientSecret',_0xf1ec('0x85')],'include':[{'model':db[_0xf1ec('0x86')],'as':_0xf1ec('0x86'),'attributes':['id','data5',_0xf1ec('0x87')]}]})[_0xf1ec('0x10')](handleEntityNotFound(_0xf89fb9,null))[_0xf1ec('0x10')](function(_0x514c17){if(_0x514c17){if(_0x514c17[_0xf1ec('0x85')]){_0x514c17[_0xf1ec('0x88')]=_0x514c17[_0xf1ec('0x86')][_0xf1ec('0x89')];_0x272ef3=sanitizeRemoteUri(_0x514c17[_0xf1ec('0x86')][_0xf1ec('0x87')]);_0x384423=getWebApiUrl(_0x272ef3);return _0x514c17;}_0x272ef3=sanitizeRemoteUri(_0x514c17['remoteUri']);_0x384423=getWebApiUrl(_0x272ef3);var _0x41209d={'method':_0xf1ec('0x8a'),'uri':_0xf1ec('0x8b')+_0x514c17['tenantId']+_0xf1ec('0x8c'),'form':{'client_id':_0x514c17[_0xf1ec('0x84')],'resource':_0x272ef3,'username':_0x514c17[_0xf1ec('0x81')],'password':_0x514c17['password'],'grant_type':_0xf1ec('0x8d'),'client_secret':_0x514c17[_0xf1ec('0x8e')]},'json':!![]};return rp(_0x41209d);}})[_0xf1ec('0x10')](function(_0x12c829){_0x7d9a64=_0x12c829[_0xf1ec('0x88')];var _0x34faf5={'method':_0xf1ec('0x8f'),'uri':encodeURI(_0x384423+_0xf1ec('0x90')+_0x35ef40+'\x27'),'headers':{'Authorization':_0xf1ec('0x91')+_0x7d9a64,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x34faf5);})['then'](function(_0xb468){var _0x16805f=_0xb468[_0xf1ec('0x92')][0x0];var _0x205595=_0x16805f[_0xf1ec('0x93')];var _0x4e2e27={'method':_0xf1ec('0x8f'),'uri':_0x384423+_0xf1ec('0x94')+_0x205595+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xf1ec('0x91')+_0x7d9a64,'If-None-Match':null,'OData-Version':_0xf1ec('0x95')},'json':!![]};return rp(_0x4e2e27);})['then'](function(_0x43b362){_0x507e33=_0x43b362;_0x26ebe6=_0x507e33[_0xf1ec('0x96')];_0x26ebe6=_['remove'](_0x26ebe6,function(_0x2b11f5){return!_0x78ee1['includes'](_0x2b11f5[_0xf1ec('0x97')]);});var _0x47a3f6=[];var _0x604a05=[];_0x26ebe6[_0xf1ec('0x98')](function(_0x48c08c){if(_0x48c08c['@odata.type']){var _0x1c52cb=_0x48c08c[_0xf1ec('0x99')][_0xf1ec('0x3f')](_0x48c08c[_0xf1ec('0x99')][_0xf1ec('0x40')]('.')+0x1);if(_0x1c52cb===_0xf1ec('0x9a')){_0x47a3f6['push'](getSelectList(_0x384423,_0x29f6bd,_0x604a05,_0x507e33['MetadataId'],_0x48c08c[_0xf1ec('0x93')],_0x7d9a64));}}});return Promise[_0xf1ec('0x9b')](_0x47a3f6);})['then'](function(_0x3336b4){_0x376471=_0x3336b4[0x0];var _0x58c1b4=[];var _0x458bc7=[];_0x26ebe6[_0xf1ec('0x98')](function(_0x27e5b9){if(!_['isNil'](_0x27e5b9[_0xf1ec('0x99')])){var _0x5ebaca=_0x27e5b9[_0xf1ec('0x99')][_0xf1ec('0x3f')](_0x27e5b9[_0xf1ec('0x99')][_0xf1ec('0x40')]('.')+0x1);if(_0x5ebaca==='BooleanAttributeMetadata'){_0x58c1b4['push'](getBooleanList(_0x384423,_0x29f6bd,_0x458bc7,_0x507e33[_0xf1ec('0x93')],_0x27e5b9[_0xf1ec('0x93')],_0x7d9a64));}}});return Promise[_0xf1ec('0x9b')](_0x58c1b4);})['then'](function(_0x5222cd){_0x4c8885=_0x5222cd[0x0];var _0x287bbf=[];var _0x31b6ba=[];_0x26ebe6['forEach'](function(_0x41d2a2){if(_0x41d2a2['@odata.type']){var _0x5c3051=_0x41d2a2[_0xf1ec('0x99')][_0xf1ec('0x3f')](_0x41d2a2['@odata.type'][_0xf1ec('0x40')]('.')+0x1);if(_0x5c3051===_0xf1ec('0x9c')||_0x5c3051===_0xf1ec('0x9d')||_0x5c3051===_0xf1ec('0x9e')||_0x5c3051===_0xf1ec('0x9f')||_0x5c3051===_0xf1ec('0xa0')||_0x5c3051===_0xf1ec('0xa1')||_0x5c3051===_0xf1ec('0xa2')||_0x5c3051===_0xf1ec('0xa3')||_0x5c3051===_0xf1ec('0xa4')||_0x5c3051===_0xf1ec('0xa5')){_0x287bbf[_0xf1ec('0xa6')](getInputList(_0x384423,_0x29f6bd,_0x5c3051,_0x31b6ba,_0x507e33['MetadataId'],_0x41d2a2['MetadataId'],_0x7d9a64));}}});return Promise['all'](_0x287bbf);})[_0xf1ec('0x10')](function(_0x2d5f0d){_0x77facb=_0x2d5f0d[0x0];var _0x2c8c04=_0x376471['concat'](_0x4c8885)[_0xf1ec('0x7f')](_0x77facb);var _0x5d617b={'count':_0x2c8c04['length'],'rows':_0x2c8c04};return _0x5d617b;})[_0xf1ec('0x10')](respondWithResult(_0xf89fb9,null))[_0xf1ec('0x2f')](function(_0x382e9b){var _0x2a40ac=_0x2fbbef[_0xf1ec('0x1d')]['test']?0x1f4:_0x382e9b[_0xf1ec('0xa7')]||0x1f4;logger[_0xf1ec('0x13')](_0x382e9b[_0xf1ec('0x14')]);delete _0x382e9b[_0xf1ec('0x15')];if(_0x2a40ac===0x191){_0x2a40ac=0x190;}_0xf89fb9['status'](_0x2a40ac)[_0xf1ec('0x16')](_0x2fbbef[_0xf1ec('0x1d')][_0xf1ec('0xa8')]?{'message':_0xf1ec('0xa9'),'statusCode':_0x382e9b[_0xf1ec('0xa7')]}:_0x382e9b);});};function getSelectList(_0x560c44,_0x19b19d,_0x11a15a,_0x141b7b,_0x382560,_0x5483da){var _0x3f5de2={'method':_0xf1ec('0x8f'),'uri':_0x560c44+_0xf1ec('0x94')+_0x141b7b+')/Attributes('+_0x382560+_0xf1ec('0xaa')+_0xf1ec('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x5483da,'If-None-Match':null,'OData-Version':_0xf1ec('0x95')},'json':!![]};return rp(_0x3f5de2)[_0xf1ec('0x10')](function(_0x121c22){var _0x573dd7=[];var _0x3f0f38=_0x121c22['OptionSet']['Options'];_0x3f0f38[_0xf1ec('0x98')](function(_0x38d583){_0x573dd7[_0xf1ec('0xa6')]({'name':_0x38d583['Label'][_0xf1ec('0xac')][_0xf1ec('0xad')],'value':String(_0x38d583[_0xf1ec('0xae')])});});var _0x374a48={'id':_0x19b19d+'_'+_0x121c22[_0xf1ec('0x97')],'name':_0x121c22[_0xf1ec('0xaf')][_0xf1ec('0xac')][_0xf1ec('0xad')],'custom':![],'options':_0x573dd7};_0x11a15a[_0xf1ec('0xa6')](_0x374a48);return _0x11a15a;});}function getBooleanList(_0x4a4d34,_0x3bca99,_0x36c198,_0x3da661,_0x5853cd,_0x2b5e12){var _0x499f68={'method':_0xf1ec('0x8f'),'uri':_0x4a4d34+_0xf1ec('0x94')+_0x3da661+_0xf1ec('0xb0')+_0x5853cd+_0xf1ec('0xb1'),'headers':{'Authorization':_0xf1ec('0x91')+_0x2b5e12,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x499f68)[_0xf1ec('0x10')](function(_0x55d3da){var _0x21cfd3=[];_0x21cfd3['push']({'name':_0x55d3da[_0xf1ec('0xb2')][_0xf1ec('0xb3')]['Label']['UserLocalizedLabel'][_0xf1ec('0xad')],'value':_0xf1ec('0xb4')},{'name':_0x55d3da[_0xf1ec('0xb2')][_0xf1ec('0xb5')]['Label'][_0xf1ec('0xac')]['Label'],'value':_0xf1ec('0xb6')});var _0x307697={'id':_0x3bca99+'_'+_0x55d3da[_0xf1ec('0x97')],'name':_0x55d3da[_0xf1ec('0xaf')][_0xf1ec('0xac')]['Label'],'custom':![],'options':_0x21cfd3};_0x36c198['push'](_0x307697);return _0x36c198;});}function getInputList(_0x4e3d65,_0x395983,_0x53231d,_0x6ee0cf,_0x321668,_0x340ac9,_0x476831){var _0xc77ca1={'method':_0xf1ec('0x8f'),'uri':_0x4e3d65+'EntityDefinitions('+_0x321668+')/Attributes('+_0x340ac9+_0xf1ec('0xb7')+_0x53231d+_0xf1ec('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x476831,'If-None-Match':null,'OData-Version':_0xf1ec('0x95')},'json':!![]};return rp(_0xc77ca1)[_0xf1ec('0x10')](function(_0x4289dc){var _0x16c58a={'id':_0x395983+'_'+_0x4289dc['LogicalName'],'name':_0x4289dc[_0xf1ec('0xaf')][_0xf1ec('0xac')]?_0x4289dc[_0xf1ec('0xaf')][_0xf1ec('0xac')][_0xf1ec('0xad')]:_0x4289dc[_0xf1ec('0x97')],'custom':![],'options':[]};_0x6ee0cf['push'](_0x16c58a);return _0x6ee0cf;});} \ No newline at end of file +var _0x62ed=['all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','send','test',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','Content-Range','then','destroy','end','sendStatus','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','params','catch','create','update','body','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','clientId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','clientSecret','GET','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','BooleanAttributeMetadata'];(function(_0x1a424b,_0x3d344d){var _0x775933=function(_0x16482c){while(--_0x16482c){_0x1a424b['push'](_0x1a424b['shift']());}};_0x775933(++_0x3d344d);}(_0x62ed,0x18e));var _0xd62e=function(_0x5ad11f,_0x11fb2f){_0x5ad11f=_0x5ad11f-0x0;var _0x46b06f=_0x62ed[_0x5ad11f];return _0x46b06f;};'use strict';var rp=require('request-promise');var util=require(_0xd62e('0x0'));var _=require(_0xd62e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd62e('0x2'))(_0xd62e('0x3'));var db=require(_0xd62e('0x4'))['db'];var integrations=require(_0xd62e('0x5'));function respondWithResult(_0x2c395c,_0x53f931){_0x53f931=_0x53f931||0xc8;return function(_0x563313){if(_0x563313){return _0x2c395c[_0xd62e('0x6')](_0x53f931)[_0xd62e('0x7')](_0x563313);}};}function respondWithFilteredResult(_0x80162e,_0xb590b7){return function(_0x1dfe81){if(_0x1dfe81){var _0x4f9b92=typeof _0xb590b7['offset']===_0xd62e('0x8')&&typeof _0xb590b7[_0xd62e('0x9')]===_0xd62e('0x8');var _0x55d9ce=_0x1dfe81[_0xd62e('0xa')];var _0x589db1=_0x4f9b92?0x0:_0xb590b7[_0xd62e('0xb')];var _0x1e4071=_0x4f9b92?_0x1dfe81['count']:_0xb590b7[_0xd62e('0xb')]+_0xb590b7[_0xd62e('0x9')];var _0x585a34;if(_0x1e4071>=_0x55d9ce){_0x1e4071=_0x55d9ce;_0x585a34=0xc8;}else{_0x585a34=0xce;}_0x80162e[_0xd62e('0x6')](_0x585a34);return _0x80162e['set'](_0xd62e('0xc'),_0x589db1+'-'+_0x1e4071+'/'+_0x55d9ce)[_0xd62e('0x7')](_0x1dfe81);}return null;};}function saveUpdates(_0x4c4b0d){return function(_0x6a6125){if(_0x6a6125){return _0x6a6125['update'](_0x4c4b0d)[_0xd62e('0xd')](function(_0x149148){return _0x149148;});}return null;};}function removeEntity(_0x5bf8fd){return function(_0x4b3d23){if(_0x4b3d23){return _0x4b3d23[_0xd62e('0xe')]()['then'](function(){_0x5bf8fd['status'](0xcc)[_0xd62e('0xf')]();});}};}function handleEntityNotFound(_0xc3f675){return function(_0x26ba16){if(!_0x26ba16){_0xc3f675[_0xd62e('0x10')](0x194);}return _0x26ba16;};}function handleError(_0x4c7a39,_0x4adec4){_0x4adec4=_0x4adec4||0x1f4;return function(_0x13951b){logger['error'](_0x13951b[_0xd62e('0x11')]);if(_0x13951b[_0xd62e('0x12')]){delete _0x13951b[_0xd62e('0x12')];}_0x4c7a39['status'](_0x4adec4)['send'](_0x13951b);};}exports[_0xd62e('0x13')]=function(_0x4a37ab,_0x3434ef){var _0x288f16={},_0x143aad={},_0x4bd0da={'count':0x0,'rows':[]};var _0x4630c3=_[_0xd62e('0x14')](db[_0xd62e('0x15')][_0xd62e('0x16')],function(_0x37a040){return{'name':_0x37a040[_0xd62e('0x17')],'type':_0x37a040[_0xd62e('0x18')]['key']};});_0x143aad['model']=_[_0xd62e('0x14')](_0x4630c3,_0xd62e('0x12'));_0x143aad['query']=_[_0xd62e('0x19')](_0x4a37ab[_0xd62e('0x1a')]);_0x143aad[_0xd62e('0x1b')]=_[_0xd62e('0x1c')](_0x143aad[_0xd62e('0x1d')],_0x143aad[_0xd62e('0x1a')]);_0x288f16[_0xd62e('0x1e')]=_['intersection'](_0x143aad[_0xd62e('0x1d')],qs[_0xd62e('0x1f')](_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x1f')]));_0x288f16[_0xd62e('0x1e')]=_0x288f16[_0xd62e('0x1e')][_0xd62e('0x20')]?_0x288f16[_0xd62e('0x1e')]:_0x143aad[_0xd62e('0x1d')];if(!_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x21')]('nolimit')){_0x288f16[_0xd62e('0x9')]=qs[_0xd62e('0x9')](_0x4a37ab[_0xd62e('0x1a')]['limit']);_0x288f16[_0xd62e('0xb')]=qs['offset'](_0x4a37ab['query']['offset']);}_0x288f16[_0xd62e('0x22')]=qs[_0xd62e('0x23')](_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x23')]);_0x288f16[_0xd62e('0x24')]=qs[_0xd62e('0x1b')](_[_0xd62e('0x25')](_0x4a37ab[_0xd62e('0x1a')],_0x143aad['filters']),_0x4630c3);if(_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x26')]){_0x288f16[_0xd62e('0x24')]=_[_0xd62e('0x27')](_0x288f16[_0xd62e('0x24')],{'$or':_['map'](_0x4630c3,function(_0x279c4f){if(_0x279c4f['type']!==_0xd62e('0x28')){var _0x50b9fd={};_0x50b9fd[_0x279c4f[_0xd62e('0x12')]]={'$like':'%'+_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x26')]+'%'};return _0x50b9fd;}})});}_0x288f16=_['merge']({},_0x288f16,_0x4a37ab['options']);var _0x770c79={'where':_0x288f16[_0xd62e('0x24')]};return db[_0xd62e('0x15')][_0xd62e('0xa')](_0x770c79)['then'](function(_0x3d7caa){_0x4bd0da['count']=_0x3d7caa;if(_0x4a37ab[_0xd62e('0x1a')][_0xd62e('0x29')]){_0x288f16[_0xd62e('0x2a')]=[{'all':!![]}];}return db[_0xd62e('0x15')]['findAll'](_0x288f16);})[_0xd62e('0xd')](function(_0x355fb4){_0x4bd0da[_0xd62e('0x2b')]=_0x355fb4;return _0x4bd0da;})['then'](respondWithFilteredResult(_0x3434ef,_0x288f16))['catch'](handleError(_0x3434ef,null));};exports[_0xd62e('0x2c')]=function(_0x3f189e,_0x42028f){var _0x2eef35={'raw':![],'where':{'id':_0x3f189e[_0xd62e('0x2d')]['id']}},_0x541b48={};_0x541b48[_0xd62e('0x1d')]=_[_0xd62e('0x19')](db['Dynamics365Account'][_0xd62e('0x16')]);_0x541b48[_0xd62e('0x1a')]=_[_0xd62e('0x19')](_0x3f189e['query']);_0x541b48['filters']=_[_0xd62e('0x1c')](_0x541b48[_0xd62e('0x1d')],_0x541b48[_0xd62e('0x1a')]);_0x2eef35[_0xd62e('0x1e')]=_[_0xd62e('0x1c')](_0x541b48['model'],qs[_0xd62e('0x1f')](_0x3f189e['query']['fields']));_0x2eef35[_0xd62e('0x1e')]=_0x2eef35[_0xd62e('0x1e')][_0xd62e('0x20')]?_0x2eef35['attributes']:_0x541b48[_0xd62e('0x1d')];if(_0x3f189e[_0xd62e('0x1a')][_0xd62e('0x29')]){_0x2eef35['include']=[{'all':!![]}];}_0x2eef35=_[_0xd62e('0x27')]({},_0x2eef35,_0x3f189e['options']);return db[_0xd62e('0x15')]['find'](_0x2eef35)[_0xd62e('0xd')](handleEntityNotFound(_0x42028f,null))[_0xd62e('0xd')](respondWithResult(_0x42028f,null))[_0xd62e('0x2e')](handleError(_0x42028f,null));};exports['create']=function(_0xe77a68,_0x4d2731){return db['Dynamics365Account'][_0xd62e('0x2f')](_0xe77a68['body'],{})[_0xd62e('0xd')](respondWithResult(_0x4d2731,0xc9))[_0xd62e('0x2e')](handleError(_0x4d2731,null));};exports[_0xd62e('0x30')]=function(_0x2050d1,_0x426933){if(_0x2050d1[_0xd62e('0x31')]['id']){delete _0x2050d1[_0xd62e('0x31')]['id'];}return db[_0xd62e('0x15')][_0xd62e('0x32')]({'where':{'id':_0x2050d1[_0xd62e('0x2d')]['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x426933,null))[_0xd62e('0xd')](saveUpdates(_0x2050d1['body'],null))[_0xd62e('0xd')](respondWithResult(_0x426933,null))[_0xd62e('0x2e')](handleError(_0x426933,null));};exports[_0xd62e('0xe')]=function(_0x5730b7,_0x490911){return db['Dynamics365Account']['find']({'where':{'id':_0x5730b7[_0xd62e('0x2d')]['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x490911,null))[_0xd62e('0xd')](removeEntity(_0x490911,null))[_0xd62e('0x2e')](handleError(_0x490911,null));};exports[_0xd62e('0x33')]=function(_0x391659,_0x5b453c){var _0x5225a5={};var _0x409efc={};var _0x1b3153;var _0x3f23b1;return db[_0xd62e('0x15')][_0xd62e('0x34')]({'where':{'id':_0x391659[_0xd62e('0x2d')]['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x5b453c,null))['then'](function(_0x59bee3){if(_0x59bee3){_0x1b3153=_0x59bee3;_0x409efc[_0xd62e('0x1d')]=_[_0xd62e('0x19')](db[_0xd62e('0x35')][_0xd62e('0x16')]);_0x409efc['query']=_['keys'](_0x391659[_0xd62e('0x1a')]);_0x409efc[_0xd62e('0x1b')]=_['intersection'](_0x409efc[_0xd62e('0x1d')],_0x409efc['query']);_0x5225a5[_0xd62e('0x1e')]=_[_0xd62e('0x1c')](_0x409efc[_0xd62e('0x1d')],qs[_0xd62e('0x1f')](_0x391659[_0xd62e('0x1a')][_0xd62e('0x1f')]));_0x5225a5[_0xd62e('0x1e')]=_0x5225a5[_0xd62e('0x1e')][_0xd62e('0x20')]?_0x5225a5[_0xd62e('0x1e')]:_0x409efc['model'];_0x5225a5[_0xd62e('0x22')]=qs[_0xd62e('0x23')](_0x391659[_0xd62e('0x1a')]['sort']);_0x5225a5[_0xd62e('0x24')]=qs[_0xd62e('0x1b')](_[_0xd62e('0x25')](_0x391659[_0xd62e('0x1a')],_0x409efc['filters']));if(_0x391659['query']['filter']){_0x5225a5[_0xd62e('0x24')]=_[_0xd62e('0x27')](_0x5225a5[_0xd62e('0x24')],{'$or':_[_0xd62e('0x14')](_0x5225a5['attributes'],function(_0xeddf3c){var _0x103af8={};_0x103af8[_0xeddf3c]={'$like':'%'+_0x391659['query'][_0xd62e('0x26')]+'%'};return _0x103af8;})});}_0x5225a5=_[_0xd62e('0x27')]({},_0x5225a5,_0x391659['options']);return _0x1b3153[_0xd62e('0x33')](_0x5225a5);}})['then'](function(_0x286599){if(_0x286599){_0x3f23b1=_0x286599[_0xd62e('0x20')];if(!_0x391659[_0xd62e('0x1a')][_0xd62e('0x21')](_0xd62e('0x36'))){_0x5225a5[_0xd62e('0x9')]=qs[_0xd62e('0x9')](_0x391659['query'][_0xd62e('0x9')]);_0x5225a5['offset']=qs['offset'](_0x391659[_0xd62e('0x1a')][_0xd62e('0xb')]);}return _0x1b3153[_0xd62e('0x33')](_0x5225a5);}})[_0xd62e('0xd')](function(_0x5599a4){if(_0x5599a4){return _0x5599a4?{'count':_0x3f23b1,'rows':_0x5599a4}:null;}})[_0xd62e('0xd')](respondWithResult(_0x5b453c,null))[_0xd62e('0x2e')](handleError(_0x5b453c,null));};exports[_0xd62e('0x37')]=function(_0x17790c,_0x423222){if(_0x17790c[_0xd62e('0x31')]['id']){delete _0x17790c[_0xd62e('0x31')]['id'];}return db[_0xd62e('0x15')]['findOne']({'where':{'id':_0x17790c['params']['id']}})[_0xd62e('0xd')](handleEntityNotFound(_0x423222,null))[_0xd62e('0xd')](function(_0x1b6080){if(_0x1b6080){_0x17790c[_0xd62e('0x31')]['AccountId']=_0x1b6080['id'];_0x17790c[_0xd62e('0x31')][_0xd62e('0x38')]=integrations[_0xd62e('0x39')](_0x17790c[_0xd62e('0x31')][_0xd62e('0x3a')],_0x17790c[_0xd62e('0x31')][_0xd62e('0x18')]);_0x17790c[_0xd62e('0x31')][_0xd62e('0x3b')]=integrations[_0xd62e('0x3c')](_0x17790c['body'][_0xd62e('0x3a')],_0x17790c[_0xd62e('0x31')][_0xd62e('0x18')]);return db[_0xd62e('0x35')]['create'](_0x17790c[_0xd62e('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':_0xd62e('0x38')},{'model':db[_0xd62e('0x3d')],'as':'Descriptions'}]});}return null;})[_0xd62e('0xd')](respondWithResult(_0x423222,null))['catch'](handleError(_0x423222,null));};function sanitizeRemoteUri(_0x5f335a){var _0x55c427=_0x5f335a[_0xd62e('0x3e')](-0x1);if(_0x55c427==='/')return _0x5f335a[_0xd62e('0x3f')](0x0,_0x5f335a[_0xd62e('0x40')](_0x55c427));return _0x5f335a;}function getWebApiUrl(_0xdfbf16){return util[_0xd62e('0x41')]('%s/api/data/v9.0/',_0xdfbf16);}exports[_0xd62e('0x42')]=function(_0x43bc31,_0x16407d){var _0x586873=_0x43bc31[_0xd62e('0x1a')][_0xd62e('0x43')];var _0x39cd6d=_0x586873===_0xd62e('0x44')?_0xd62e('0x45'):_0xd62e('0x46');var _0x234be8='';var _0xc9508e='';var _0x24ceba='';var _0x28f200='';var _0x376a70='';var _0x66b88='';var _0x3d6f37='';var _0x2f35f8='';var _0x132c59=[_0xd62e('0x47'),_0xd62e('0x48'),'customerid',_0xd62e('0x49'),'caseorigincode',_0xd62e('0x4a'),_0xd62e('0x4b'),_0xd62e('0x4c'),_0xd62e('0x4d'),_0xd62e('0x4e')];var _0x574305=[_0xd62e('0x4f'),'accountidyominame',_0xd62e('0x50'),_0xd62e('0x51'),_0xd62e('0x52'),'contactidyominame','contractdetailidname',_0xd62e('0x53'),_0xd62e('0x54'),_0xd62e('0x55'),'createdbyname',_0xd62e('0x56'),_0xd62e('0x57'),'createdonbehalfbyname',_0xd62e('0x58'),_0xd62e('0x59'),_0xd62e('0x5a'),_0xd62e('0x5b'),'emailaddress',_0xd62e('0x5c'),_0xd62e('0x5d'),_0xd62e('0x5e'),'escalatedon',_0xd62e('0x5f'),_0xd62e('0x60'),_0xd62e('0x61'),_0xd62e('0x62'),_0xd62e('0x63'),_0xd62e('0x64'),_0xd62e('0x65'),_0xd62e('0x66'),_0xd62e('0x67'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xd62e('0x68'),_0xd62e('0x69'),_0xd62e('0x6a'),'modifiedonbehalfbyyominame',_0xd62e('0x6b'),_0xd62e('0x6c'),_0xd62e('0x6d'),'onholdtime',_0xd62e('0x6e'),'owneridname',_0xd62e('0x6f'),'owneridyominame',_0xd62e('0x70'),_0xd62e('0x71'),_0xd62e('0x72'),'prioritycodename',_0xd62e('0x73'),_0xd62e('0x74'),'resolveby','resolvebykpiidname','responseby',_0xd62e('0x75'),'responsiblecontactidyominame',_0xd62e('0x76'),_0xd62e('0x77'),_0xd62e('0x78'),_0xd62e('0x79'),_0xd62e('0x7a'),_0xd62e('0x7b'),'subjectidname',_0xd62e('0x7c'),_0xd62e('0x7d'),_0xd62e('0x7e'),_0xd62e('0x7f'),_0xd62e('0x80'),_0xd62e('0x81')];var _0x279439=_0x132c59[_0xd62e('0x82')](_0x574305);return db[_0xd62e('0x15')][_0xd62e('0x34')]({'where':{'id':_0x43bc31['params']['id']},'attributes':['id',_0xd62e('0x83'),'password',_0xd62e('0x84'),'tenantId',_0xd62e('0x85'),'clientSecret',_0xd62e('0x86')],'include':[{'model':db[_0xd62e('0x87')],'as':_0xd62e('0x87'),'attributes':['id',_0xd62e('0x88'),_0xd62e('0x89')]}]})[_0xd62e('0xd')](handleEntityNotFound(_0x16407d,null))['then'](function(_0x18d38b){if(_0x18d38b){if(_0x18d38b[_0xd62e('0x86')]){_0x18d38b[_0xd62e('0x8a')]=_0x18d38b[_0xd62e('0x87')][_0xd62e('0x88')];_0x2f35f8=sanitizeRemoteUri(_0x18d38b['CloudProvider'][_0xd62e('0x89')]);_0x3d6f37=getWebApiUrl(_0x2f35f8);return _0x18d38b;}_0x2f35f8=sanitizeRemoteUri(_0x18d38b[_0xd62e('0x84')]);_0x3d6f37=getWebApiUrl(_0x2f35f8);var _0x2a1e06={'method':_0xd62e('0x8b'),'uri':_0xd62e('0x8c')+_0x18d38b[_0xd62e('0x8d')]+_0xd62e('0x8e'),'form':{'client_id':_0x18d38b['clientId'],'resource':_0x2f35f8,'username':_0x18d38b[_0xd62e('0x83')],'password':_0x18d38b[_0xd62e('0x8f')],'grant_type':_0xd62e('0x8f'),'client_secret':_0x18d38b[_0xd62e('0x90')]},'json':!![]};return rp(_0x2a1e06);}})[_0xd62e('0xd')](function(_0x1e0a6e){_0x66b88=_0x1e0a6e[_0xd62e('0x8a')];var _0x1bb343={'method':_0xd62e('0x91'),'uri':encodeURI(_0x3d6f37+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x39cd6d+'\x27'),'headers':{'Authorization':_0xd62e('0x92')+_0x66b88,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x1bb343);})[_0xd62e('0xd')](function(_0xbdd3b){var _0x2f1816=_0xbdd3b['value'][0x0];var _0x545e80=_0x2f1816['MetadataId'];var _0x4dd823={'method':_0xd62e('0x91'),'uri':_0x3d6f37+_0xd62e('0x94')+_0x545e80+_0xd62e('0x95'),'headers':{'Authorization':_0xd62e('0x92')+_0x66b88,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x4dd823);})['then'](function(_0x242659){_0x234be8=_0x242659;_0xc9508e=_0x234be8[_0xd62e('0x96')];_0xc9508e=_[_0xd62e('0x97')](_0xc9508e,function(_0x462719){return!_0x279439[_0xd62e('0x98')](_0x462719[_0xd62e('0x99')]);});var _0x28cc0d=[];var _0x14d57e=[];_0xc9508e[_0xd62e('0x9a')](function(_0x5dcf0){if(_0x5dcf0[_0xd62e('0x9b')]){var _0x34948a=_0x5dcf0[_0xd62e('0x9b')][_0xd62e('0x3f')](_0x5dcf0[_0xd62e('0x9b')][_0xd62e('0x40')]('.')+0x1);if(_0x34948a===_0xd62e('0x9c')){_0x28cc0d[_0xd62e('0x9d')](getSelectList(_0x3d6f37,_0x586873,_0x14d57e,_0x234be8[_0xd62e('0x9e')],_0x5dcf0['MetadataId'],_0x66b88));}}});return Promise['all'](_0x28cc0d);})[_0xd62e('0xd')](function(_0x27f5fb){_0x24ceba=_0x27f5fb[0x0];var _0x288c00=[];var _0x163142=[];_0xc9508e[_0xd62e('0x9a')](function(_0x5bc7ea){if(!_['isNil'](_0x5bc7ea['@odata.type'])){var _0x28350b=_0x5bc7ea[_0xd62e('0x9b')][_0xd62e('0x3f')](_0x5bc7ea['@odata.type'][_0xd62e('0x40')]('.')+0x1);if(_0x28350b===_0xd62e('0x9f')){_0x288c00['push'](getBooleanList(_0x3d6f37,_0x586873,_0x163142,_0x234be8[_0xd62e('0x9e')],_0x5bc7ea['MetadataId'],_0x66b88));}}});return Promise[_0xd62e('0xa0')](_0x288c00);})[_0xd62e('0xd')](function(_0x5b04fc){_0x28f200=_0x5b04fc[0x0];var _0x1bd1c8=[];var _0x46a72c=[];_0xc9508e[_0xd62e('0x9a')](function(_0x5a359d){if(_0x5a359d[_0xd62e('0x9b')]){var _0x290ec6=_0x5a359d['@odata.type'][_0xd62e('0x3f')](_0x5a359d[_0xd62e('0x9b')][_0xd62e('0x40')]('.')+0x1);if(_0x290ec6===_0xd62e('0xa1')||_0x290ec6===_0xd62e('0xa2')||_0x290ec6===_0xd62e('0xa3')||_0x290ec6===_0xd62e('0xa4')||_0x290ec6==='MemoAttributeMetadata'||_0x290ec6===_0xd62e('0xa5')||_0x290ec6===_0xd62e('0xa6')||_0x290ec6===_0xd62e('0xa7')||_0x290ec6===_0xd62e('0xa8')||_0x290ec6==='DecimalAttributeMetadata'){_0x1bd1c8[_0xd62e('0x9d')](getInputList(_0x3d6f37,_0x586873,_0x290ec6,_0x46a72c,_0x234be8[_0xd62e('0x9e')],_0x5a359d[_0xd62e('0x9e')],_0x66b88));}}});return Promise[_0xd62e('0xa0')](_0x1bd1c8);})[_0xd62e('0xd')](function(_0x3a2eb9){_0x376a70=_0x3a2eb9[0x0];var _0x5094ba=_0x24ceba[_0xd62e('0x82')](_0x28f200)[_0xd62e('0x82')](_0x376a70);var _0x47bc74={'count':_0x5094ba[_0xd62e('0x20')],'rows':_0x5094ba};return _0x47bc74;})[_0xd62e('0xd')](respondWithResult(_0x16407d,null))['catch'](function(_0x56c1da){var _0x10e3e1=_0x43bc31['query']['test']?0x1f4:_0x56c1da[_0xd62e('0xa9')]||0x1f4;logger['error'](_0x56c1da[_0xd62e('0x11')]);delete _0x56c1da[_0xd62e('0x12')];if(_0x10e3e1===0x191){_0x10e3e1=0x190;}_0x16407d[_0xd62e('0x6')](_0x10e3e1)[_0xd62e('0xaa')](_0x43bc31[_0xd62e('0x1a')][_0xd62e('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x56c1da[_0xd62e('0xa9')]}:_0x56c1da);});};function getSelectList(_0x550206,_0x3c569e,_0xfae86f,_0x3d7749,_0x414f22,_0x12427e){var _0x54b567={'method':_0xd62e('0x91'),'uri':_0x550206+_0xd62e('0x94')+_0x3d7749+')/Attributes('+_0x414f22+_0xd62e('0xac')+_0xd62e('0xad'),'headers':{'Authorization':_0xd62e('0x92')+_0x12427e,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x54b567)['then'](function(_0x53982b){var _0x1142da=[];var _0x345dc6=_0x53982b['OptionSet'][_0xd62e('0xae')];_0x345dc6[_0xd62e('0x9a')](function(_0x5da52a){_0x1142da['push']({'name':_0x5da52a[_0xd62e('0xaf')][_0xd62e('0xb0')]['Label'],'value':String(_0x5da52a[_0xd62e('0xb1')])});});var _0x8e2c6a={'id':_0x3c569e+'_'+_0x53982b[_0xd62e('0x99')],'name':_0x53982b[_0xd62e('0xb2')][_0xd62e('0xb0')]['Label'],'custom':![],'options':_0x1142da};_0xfae86f['push'](_0x8e2c6a);return _0xfae86f;});}function getBooleanList(_0x16750a,_0x17b26e,_0x1be131,_0x51b8af,_0x712cf9,_0x327a2e){var _0x167d51={'method':_0xd62e('0x91'),'uri':_0x16750a+_0xd62e('0x94')+_0x51b8af+')/Attributes('+_0x712cf9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xd62e('0x92')+_0x327a2e,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x167d51)[_0xd62e('0xd')](function(_0x2d36c8){var _0x52f6d6=[];_0x52f6d6[_0xd62e('0x9d')]({'name':_0x2d36c8[_0xd62e('0xb3')][_0xd62e('0xb4')][_0xd62e('0xaf')][_0xd62e('0xb0')][_0xd62e('0xaf')],'value':_0xd62e('0xb5')},{'name':_0x2d36c8[_0xd62e('0xb3')][_0xd62e('0xb6')][_0xd62e('0xaf')][_0xd62e('0xb0')][_0xd62e('0xaf')],'value':_0xd62e('0xb7')});var _0x40a8cf={'id':_0x17b26e+'_'+_0x2d36c8['LogicalName'],'name':_0x2d36c8[_0xd62e('0xb2')][_0xd62e('0xb0')]['Label'],'custom':![],'options':_0x52f6d6};_0x1be131[_0xd62e('0x9d')](_0x40a8cf);return _0x1be131;});}function getInputList(_0x195a11,_0x1c92ef,_0x2f8d1c,_0x560372,_0x243581,_0x349eab,_0x24383d){var _0x282dcc={'method':_0xd62e('0x91'),'uri':_0x195a11+'EntityDefinitions('+_0x243581+')/Attributes('+_0x349eab+_0xd62e('0xb8')+_0x2f8d1c+_0xd62e('0xb9'),'headers':{'Authorization':_0xd62e('0x92')+_0x24383d,'If-None-Match':null,'OData-Version':_0xd62e('0x93')},'json':!![]};return rp(_0x282dcc)[_0xd62e('0xd')](function(_0xaa186d){var _0x15e530={'id':_0x1c92ef+'_'+_0xaa186d[_0xd62e('0x99')],'name':_0xaa186d['DisplayName'][_0xd62e('0xb0')]?_0xaa186d['DisplayName']['UserLocalizedLabel'][_0xd62e('0xaf')]:_0xaa186d[_0xd62e('0x99')],'custom':![],'options':[]};_0x560372[_0xd62e('0x9d')](_0x15e530);return _0x560372;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 40db769..80e8942 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x5233ec,_0x4a7573){var _0x2267b6=function(_0x5785c7){while(--_0x5785c7){_0x5233ec['push'](_0x5233ec['shift']());}};_0x2267b6(++_0x4a7573);}(_0x757a,0xde));var _0xa757=function(_0x10e0d0,_0x17a382){_0x10e0d0=_0x10e0d0-0x0;var _0x4c964a=_0x757a[_0x10e0d0];return _0x4c964a;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x231bc8,_0x147fe2){var _0x136927=function(_0x3246a6){while(--_0x3246a6){_0x231bc8['push'](_0x231bc8['shift']());}};_0x136927(++_0x147fe2);}(_0x757a,0xde));var _0xa757=function(_0x175532,_0x19acec){_0x175532=_0x175532-0x0;var _0x43a059=_0x757a[_0x175532];return _0x43a059;};'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 f2483ca..216c3f8 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 _0xa29e=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','raw','options','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x36939b,_0x533400){var _0x10a109=function(_0x32c7a1){while(--_0x32c7a1){_0x36939b['push'](_0x36939b['shift']());}};_0x10a109(++_0x533400);}(_0xa29e,0x85));var _0xea29=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0xa29e[_0x217cfd];return _0x1e887f;};'use strict';var _=require(_0xea29('0x0'));var util=require(_0xea29('0x1'));var moment=require('moment');var BPromise=require(_0xea29('0x2'));var rs=require(_0xea29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea29('0x4'))['db'];var utils=require(_0xea29('0x5'));var logger=require(_0xea29('0x6'))(_0xea29('0x7'));var config=require(_0xea29('0x8'));var jayson=require(_0xea29('0x9'));var client=jayson[_0xea29('0xa')][_0xea29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c34c0,_0x18e933,_0xcc4354){return new BPromise(function(_0x48d7c7,_0x9d264){return client[_0xea29('0xc')](_0x1c34c0,_0xcc4354)[_0xea29('0xd')](function(_0x42cec1){logger[_0xea29('0xe')](_0xea29('0xf'),_0x18e933,_0xea29('0x10'));logger[_0xea29('0x11')](_0xea29('0x12'),_0x18e933,_0xea29('0x10'),JSON[_0xea29('0x13')](_0x42cec1));if(_0x42cec1[_0xea29('0x14')]){if(_0x42cec1['error'][_0xea29('0x15')]===0x1f4){logger[_0xea29('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x18e933,_0x42cec1['error'][_0xea29('0x16')]);return _0x9d264(_0x42cec1['error'][_0xea29('0x16')]);}logger[_0xea29('0x14')](_0xea29('0xf'),_0x18e933,_0x42cec1[_0xea29('0x14')][_0xea29('0x16')]);return _0x48d7c7(_0x42cec1['error'][_0xea29('0x16')]);}else{logger['info'](_0xea29('0xf'),_0x18e933,'request\x20sent');_0x48d7c7(_0x42cec1[_0xea29('0x17')][_0xea29('0x16')]);}})[_0xea29('0x18')](function(_0x23b9c8){logger[_0xea29('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x18e933,_0x23b9c8);_0x9d264(_0x23b9c8);});});}exports[_0xea29('0x19')]=function(_0x3ed0df){var _0x534cf1=this;return new Promise(function(_0x369295,_0x40cb69){return db[_0xea29('0x1a')]['findAll']({'raw':_0x3ed0df['options']?_0x3ed0df['options'][_0xea29('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ed0df['options']?_0x3ed0df[_0xea29('0x1c')][_0xea29('0x1d')]||null:null,'attributes':_0x3ed0df['options']?_0x3ed0df['options'][_0xea29('0x1e')]||null:null,'limit':_0x3ed0df[_0xea29('0x1c')]?_0x3ed0df['options'][_0xea29('0x1f')]||null:null,'include':_0x3ed0df['options']?_0x3ed0df[_0xea29('0x1c')][_0xea29('0x20')]?_[_0xea29('0x21')](_0x3ed0df[_0xea29('0x1c')]['include'],function(_0x748908){return{'model':db[_0x748908['model']],'as':_0x748908['as'],'attributes':_0x748908[_0xea29('0x1e')],'include':_0x748908[_0xea29('0x20')]?_['map'](_0x748908['include'],function(_0x450bdb){return{'model':db[_0x450bdb['model']],'as':_0x450bdb['as'],'attributes':_0x450bdb[_0xea29('0x1e')],'include':_0x450bdb[_0xea29('0x20')]?_['map'](_0x450bdb[_0xea29('0x20')],function(_0x2bc6ee){return{'model':db[_0x2bc6ee[_0xea29('0x22')]],'as':_0x2bc6ee['as'],'attributes':_0x2bc6ee['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b6c5){logger[_0xea29('0xe')](_0xea29('0x19'),_0x3ed0df);logger[_0xea29('0x11')]('GetDynamics365Account',_0x3ed0df,JSON[_0xea29('0x13')](_0x59b6c5));_0x369295(_0x59b6c5);})[_0xea29('0x18')](function(_0x260776){logger[_0xea29('0x14')](_0xea29('0x19'),_0x260776[_0xea29('0x16')],_0x3ed0df);_0x40cb69(_0x534cf1['error'](0x1f4,_0x260776[_0xea29('0x16')]));});});};exports[_0xea29('0x23')]=function(_0x514f4f){var _0x39ba84=this;return new Promise(function(_0x38d54d,_0x4386df){return db['Dynamics365Account'][_0xea29('0x24')]({'raw':_0x514f4f[_0xea29('0x1c')]?_0x514f4f[_0xea29('0x1c')][_0xea29('0x1b')]===undefined?!![]:![]:!![],'where':_0x514f4f[_0xea29('0x1c')]?_0x514f4f[_0xea29('0x1c')][_0xea29('0x1d')]||null:null,'attributes':_0x514f4f[_0xea29('0x1c')]?_0x514f4f[_0xea29('0x1c')][_0xea29('0x1e')]||null:null,'include':_0x514f4f[_0xea29('0x1c')]?_0x514f4f[_0xea29('0x1c')][_0xea29('0x20')]?_['map'](_0x514f4f[_0xea29('0x1c')][_0xea29('0x20')],function(_0x5ba1d1){return{'model':db[_0x5ba1d1[_0xea29('0x22')]],'as':_0x5ba1d1['as'],'attributes':_0x5ba1d1[_0xea29('0x1e')],'include':_0x5ba1d1[_0xea29('0x20')]?_[_0xea29('0x21')](_0x5ba1d1['include'],function(_0xb7aeec){return{'model':db[_0xb7aeec['model']],'as':_0xb7aeec['as'],'attributes':_0xb7aeec[_0xea29('0x1e')],'include':_0xb7aeec['include']?_[_0xea29('0x21')](_0xb7aeec[_0xea29('0x20')],function(_0x5c27b9){return{'model':db[_0x5c27b9[_0xea29('0x22')]],'as':_0x5c27b9['as'],'attributes':_0x5c27b9[_0xea29('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xea29('0xd')](function(_0x103e16){logger[_0xea29('0xe')](_0xea29('0x23'),_0x514f4f);logger[_0xea29('0x11')](_0xea29('0x23'),_0x514f4f,JSON[_0xea29('0x13')](_0x103e16));_0x38d54d(_0x103e16);})[_0xea29('0x18')](function(_0x7c2593){logger['error'](_0xea29('0x23'),_0x7c2593[_0xea29('0x16')],_0x514f4f);_0x4386df(_0x39ba84[_0xea29('0x14')](0x1f4,_0x7c2593['message']));});});}; \ No newline at end of file +var _0xd1fe=['jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','attributes','model','ShowDynamics365Account','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f4613,_0x234c4f){var _0x3bb842=function(_0x278897){while(--_0x278897){_0x2f4613['push'](_0x2f4613['shift']());}};_0x3bb842(++_0x234c4f);}(_0xd1fe,0x145));var _0xed1f=function(_0xbbee58,_0x239bfa){_0xbbee58=_0xbbee58-0x0;var _0x56d11b=_0xd1fe[_0xbbee58];return _0x56d11b;};'use strict';var _=require(_0xed1f('0x0'));var util=require(_0xed1f('0x1'));var moment=require(_0xed1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xed1f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed1f('0x4'));var logger=require(_0xed1f('0x5'))(_0xed1f('0x6'));var config=require(_0xed1f('0x7'));var jayson=require(_0xed1f('0x8'));var client=jayson[_0xed1f('0x9')][_0xed1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xda3607,_0x1143bd,_0xf5038d){return new BPromise(function(_0x2e4392,_0x3fe2c9){return client[_0xed1f('0xb')](_0xda3607,_0xf5038d)[_0xed1f('0xc')](function(_0x4bd78c){logger[_0xed1f('0xd')](_0xed1f('0xe'),_0x1143bd,'request\x20sent');logger[_0xed1f('0xf')](_0xed1f('0x10'),_0x1143bd,_0xed1f('0x11'),JSON[_0xed1f('0x12')](_0x4bd78c));if(_0x4bd78c[_0xed1f('0x13')]){if(_0x4bd78c[_0xed1f('0x13')][_0xed1f('0x14')]===0x1f4){logger[_0xed1f('0x13')](_0xed1f('0xe'),_0x1143bd,_0x4bd78c[_0xed1f('0x13')][_0xed1f('0x15')]);return _0x3fe2c9(_0x4bd78c[_0xed1f('0x13')][_0xed1f('0x15')]);}logger[_0xed1f('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x1143bd,_0x4bd78c['error']['message']);return _0x2e4392(_0x4bd78c[_0xed1f('0x13')]['message']);}else{logger[_0xed1f('0xd')](_0xed1f('0xe'),_0x1143bd,_0xed1f('0x11'));_0x2e4392(_0x4bd78c[_0xed1f('0x16')][_0xed1f('0x15')]);}})[_0xed1f('0x17')](function(_0x436b41){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1143bd,_0x436b41);_0x3fe2c9(_0x436b41);});});}exports[_0xed1f('0x18')]=function(_0x581ea6){var _0x3c280c=this;return new Promise(function(_0x5f4c0d,_0x1e756d){return db[_0xed1f('0x19')][_0xed1f('0x1a')]({'raw':_0x581ea6['options']?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x581ea6[_0xed1f('0x1b')]?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1d')]||null:null,'attributes':_0x581ea6[_0xed1f('0x1b')]?_0x581ea6[_0xed1f('0x1b')]['attributes']||null:null,'limit':_0x581ea6['options']?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1e')]||null:null,'include':_0x581ea6[_0xed1f('0x1b')]?_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x581ea6[_0xed1f('0x1b')][_0xed1f('0x1f')],function(_0x6716e5){return{'model':db[_0x6716e5['model']],'as':_0x6716e5['as'],'attributes':_0x6716e5[_0xed1f('0x21')],'include':_0x6716e5[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x6716e5[_0xed1f('0x1f')],function(_0x1ab460){return{'model':db[_0x1ab460[_0xed1f('0x22')]],'as':_0x1ab460['as'],'attributes':_0x1ab460[_0xed1f('0x21')],'include':_0x1ab460[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x1ab460[_0xed1f('0x1f')],function(_0x6e7e2f){return{'model':db[_0x6e7e2f[_0xed1f('0x22')]],'as':_0x6e7e2f['as'],'attributes':_0x6e7e2f[_0xed1f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed1f('0xc')](function(_0x22eb49){logger[_0xed1f('0xd')](_0xed1f('0x18'),_0x581ea6);logger[_0xed1f('0xf')](_0xed1f('0x18'),_0x581ea6,JSON['stringify'](_0x22eb49));_0x5f4c0d(_0x22eb49);})[_0xed1f('0x17')](function(_0x11a7ca){logger['error'](_0xed1f('0x18'),_0x11a7ca[_0xed1f('0x15')],_0x581ea6);_0x1e756d(_0x3c280c[_0xed1f('0x13')](0x1f4,_0x11a7ca[_0xed1f('0x15')]));});});};exports[_0xed1f('0x23')]=function(_0x541e46){var _0xd3b497=this;return new Promise(function(_0x4420f3,_0x924921){return db[_0xed1f('0x19')][_0xed1f('0x24')]({'raw':_0x541e46['options']?_0x541e46[_0xed1f('0x1b')][_0xed1f('0x1c')]===undefined?!![]:![]:!![],'where':_0x541e46[_0xed1f('0x1b')]?_0x541e46['options'][_0xed1f('0x1d')]||null:null,'attributes':_0x541e46[_0xed1f('0x1b')]?_0x541e46['options'][_0xed1f('0x21')]||null:null,'include':_0x541e46[_0xed1f('0x1b')]?_0x541e46[_0xed1f('0x1b')][_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x541e46[_0xed1f('0x1b')]['include'],function(_0x4a771b){return{'model':db[_0x4a771b[_0xed1f('0x22')]],'as':_0x4a771b['as'],'attributes':_0x4a771b['attributes'],'include':_0x4a771b[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x4a771b[_0xed1f('0x1f')],function(_0x211c51){return{'model':db[_0x211c51[_0xed1f('0x22')]],'as':_0x211c51['as'],'attributes':_0x211c51[_0xed1f('0x21')],'include':_0x211c51[_0xed1f('0x1f')]?_[_0xed1f('0x20')](_0x211c51[_0xed1f('0x1f')],function(_0x10b2f2){return{'model':db[_0x10b2f2[_0xed1f('0x22')]],'as':_0x10b2f2['as'],'attributes':_0x10b2f2[_0xed1f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed1f('0xc')](function(_0x37a1ad){logger[_0xed1f('0xd')](_0xed1f('0x23'),_0x541e46);logger[_0xed1f('0xf')](_0xed1f('0x23'),_0x541e46,JSON[_0xed1f('0x12')](_0x37a1ad));_0x4420f3(_0x37a1ad);})['catch'](function(_0x1fa3a6){logger['error'](_0xed1f('0x23'),_0x1fa3a6[_0xed1f('0x15')],_0x541e46);_0x924921(_0xd3b497[_0xed1f('0x13')](0x1f4,_0x1fa3a6['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4e45632..4eb7c7d 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 _0xfbf1=['fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf1,0x10b));var _0x1fbf=function(_0x1d4bd1,_0x14729b){_0x1d4bd1=_0x1d4bd1-0x0;var _0x3323fb=_0xfbf1[_0x1d4bd1];return _0x3323fb;};'use strict';var multer=require('multer');var util=require(_0x1fbf('0x0'));var path=require('path');var timeout=require(_0x1fbf('0x1'));var express=require('express');var router=express[_0x1fbf('0x2')]();var fs_extra=require(_0x1fbf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1fbf('0x4'));var config=require('../../config/environment');var controller=require(_0x1fbf('0x5'));router[_0x1fbf('0x6')]('/',auth[_0x1fbf('0x7')](),controller[_0x1fbf('0x8')]);router[_0x1fbf('0x6')](_0x1fbf('0x9'),auth['isAuthenticated'](),controller[_0x1fbf('0xa')]);router['get'](_0x1fbf('0xb'),auth[_0x1fbf('0x7')](),controller[_0x1fbf('0xc')]);router[_0x1fbf('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x1fbf('0xd')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x1fbf('0xe')]);router['post']('/',auth[_0x1fbf('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1fbf('0xf')](_0x1fbf('0x9'),auth[_0x1fbf('0x7')](),controller[_0x1fbf('0x10')]);module[_0x1fbf('0x11')]=router; \ No newline at end of file +var _0x225b=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x225b,0xb1));var _0xb225=function(_0x126489,_0x1fa25b){_0x126489=_0x126489-0x0;var _0x29e58b=_0x225b[_0x126489];return _0x29e58b;};'use strict';var multer=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var path=require('path');var timeout=require(_0xb225('0x2'));var express=require(_0xb225('0x3'));var router=express['Router']();var fs_extra=require(_0xb225('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb225('0x5'));var config=require('../../config/environment');var controller=require(_0xb225('0x6'));router[_0xb225('0x7')]('/',auth[_0xb225('0x8')](),controller[_0xb225('0x9')]);router[_0xb225('0x7')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller['show']);router[_0xb225('0x7')](_0xb225('0xb'),auth[_0xb225('0x8')](),controller[_0xb225('0xc')]);router['get'](_0xb225('0xd'),auth[_0xb225('0x8')](),controller[_0xb225('0xe')]);router['get'](_0xb225('0xf'),auth[_0xb225('0x8')](),controller[_0xb225('0x10')]);router[_0xb225('0x11')]('/',auth[_0xb225('0x8')](),controller['create']);router[_0xb225('0x12')](_0xb225('0xa'),auth[_0xb225('0x8')](),controller[_0xb225('0x13')]);router[_0xb225('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb225('0x15')]);module[_0xb225('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b568f35..abc2a4d 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 _0xe4bf=['nothing','BOOLEAN','exports','STRING','ENUM','incident','contact'];(function(_0x3c8893,_0x3bb73e){var _0x3f9f4b=function(_0x427a21){while(--_0x427a21){_0x3c8893['push'](_0x3c8893['shift']());}};_0x3f9f4b(++_0x3bb73e);}(_0xe4bf,0xb1));var _0xfe4b=function(_0x68c4d9,_0x419b3c){_0x68c4d9=_0x68c4d9-0x0;var _0x62da93=_0xe4bf[_0x68c4d9];return _0x62da93;};'use strict';var Sequelize=require('sequelize');module[_0xfe4b('0x0')]={'name':{'type':Sequelize[_0xfe4b('0x1')]},'description':{'type':Sequelize[_0xfe4b('0x1')]},'ticketType':{'type':Sequelize[_0xfe4b('0x2')]('incident','phonecall'),'defaultValue':_0xfe4b('0x3')},'moduleCreate':{'type':Sequelize[_0xfe4b('0x2')](_0xfe4b('0x4'),_0xfe4b('0x5')),'defaultValue':_0xfe4b('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xfe4b('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xfe4b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2b56=['BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact','nothing'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0x2b56,0x109));var _0x62b5=function(_0x3e42ee,_0x11abfc){_0x3e42ee=_0x3e42ee-0x0;var _0x310f87=_0x2b56[_0x3e42ee];return _0x310f87;};'use strict';var Sequelize=require(_0x62b5('0x0'));module[_0x62b5('0x1')]={'name':{'type':Sequelize[_0x62b5('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x62b5('0x3')](_0x62b5('0x4'),'phonecall'),'defaultValue':_0x62b5('0x4')},'moduleCreate':{'type':Sequelize[_0x62b5('0x3')](_0x62b5('0x5'),_0x62b5('0x6')),'defaultValue':_0x62b5('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x62b5('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x62b5('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6f5d99c..c8fe150 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 _0x6fe9=['intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','length','includeAll','find','catch','body','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters'];(function(_0x5e4364,_0xddefe5){var _0x463eaa=function(_0x12a2e6){while(--_0x12a2e6){_0x5e4364['push'](_0x5e4364['shift']());}};_0x463eaa(++_0xddefe5);}(_0x6fe9,0x102));var _0x96fe=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6fe9[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x96fe('0x0'));var rimraf=require(_0x96fe('0x1'));var zipdir=require(_0x96fe('0x2'));var jsonpatch=require(_0x96fe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x96fe('0x4'));var util=require(_0x96fe('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96fe('0x6'));var squel=require(_0x96fe('0x7'));var crypto=require(_0x96fe('0x8'));var jsforce=require(_0x96fe('0x9'));var deskjs=require(_0x96fe('0xa'));var toCsv=require('to-csv');var querystring=require(_0x96fe('0xb'));var Papa=require(_0x96fe('0xc'));var Redis=require(_0x96fe('0xd'));var authService=require(_0x96fe('0xe'));var qs=require(_0x96fe('0xf'));var as=require(_0x96fe('0x10'));var hardwareService=require(_0x96fe('0x11'));var logger=require(_0x96fe('0x12'))(_0x96fe('0x13'));var utils=require(_0x96fe('0x14'));var config=require(_0x96fe('0x15'));var licenseUtil=require(_0x96fe('0x16'));var db=require(_0x96fe('0x17'))['db'];function respondWithStatusCode(_0x3929c2,_0x2e169f){_0x2e169f=_0x2e169f||0xcc;return function(_0x67ae04){if(_0x67ae04){return _0x3929c2['sendStatus'](_0x2e169f);}return _0x3929c2['status'](_0x2e169f)[_0x96fe('0x18')]();};}function respondWithResult(_0x385cbe,_0xe16440){_0xe16440=_0xe16440||0xc8;return function(_0x544447){if(_0x544447){return _0x385cbe[_0x96fe('0x19')](_0xe16440)[_0x96fe('0x1a')](_0x544447);}};}function respondWithFilteredResult(_0x58e680,_0x9c8c36){return function(_0x4b314c){if(_0x4b314c){var _0x12b956=typeof _0x9c8c36['offset']===_0x96fe('0x1b')&&typeof _0x9c8c36['limit']===_0x96fe('0x1b');var _0x518488=_0x4b314c[_0x96fe('0x1c')];var _0x151813=_0x12b956?0x0:_0x9c8c36[_0x96fe('0x1d')];var _0x168f0f=_0x12b956?_0x4b314c['count']:_0x9c8c36[_0x96fe('0x1d')]+_0x9c8c36[_0x96fe('0x1e')];var _0x3d482c;if(_0x168f0f>=_0x518488){_0x168f0f=_0x518488;_0x3d482c=0xc8;}else{_0x3d482c=0xce;}_0x58e680[_0x96fe('0x19')](_0x3d482c);return _0x58e680[_0x96fe('0x1f')](_0x96fe('0x20'),_0x151813+'-'+_0x168f0f+'/'+_0x518488)[_0x96fe('0x1a')](_0x4b314c);}return null;};}function patchUpdates(_0x55617c){return function(_0x541d67){try{jsonpatch[_0x96fe('0x21')](_0x541d67,_0x55617c,!![]);}catch(_0x365991){return BPromise['reject'](_0x365991);}return _0x541d67[_0x96fe('0x22')]();};}function saveUpdates(_0x209b8f,_0x5d0107){return function(_0xf101d9){if(_0xf101d9){return _0xf101d9['update'](_0x209b8f)[_0x96fe('0x23')](function(_0x1505a5){return _0x1505a5;});}return null;};}function removeEntity(_0x572fe7,_0x382415){return function(_0x1a892f){if(_0x1a892f){return _0x1a892f[_0x96fe('0x24')]()[_0x96fe('0x23')](function(){_0x572fe7[_0x96fe('0x19')](0xcc)[_0x96fe('0x18')]();});}};}function handleEntityNotFound(_0x2deeca,_0xaa3e14){return function(_0x5c437d){if(!_0x5c437d){_0x2deeca[_0x96fe('0x25')](0x194);}return _0x5c437d;};}function handleError(_0x1f4386,_0x4d7721){_0x4d7721=_0x4d7721||0x1f4;return function(_0x32c7e1){logger['error'](_0x32c7e1[_0x96fe('0x26')]);if(_0x32c7e1['name']){delete _0x32c7e1[_0x96fe('0x27')];}_0x1f4386[_0x96fe('0x19')](_0x4d7721)[_0x96fe('0x28')](_0x32c7e1);};}exports['index']=function(_0x223ee1,_0x3e9b01){var _0x55b420={},_0x353e5a={},_0x21481c={'count':0x0,'rows':[]};var _0x5d18dd=_[_0x96fe('0x29')](db[_0x96fe('0x2a')][_0x96fe('0x2b')],function(_0x49c0e9){return{'name':_0x49c0e9['fieldName'],'type':_0x49c0e9[_0x96fe('0x2c')][_0x96fe('0x2d')]};});_0x353e5a[_0x96fe('0x2e')]=_[_0x96fe('0x29')](_0x5d18dd,_0x96fe('0x27'));_0x353e5a[_0x96fe('0x2f')]=_[_0x96fe('0x30')](_0x223ee1[_0x96fe('0x2f')]);_0x353e5a[_0x96fe('0x31')]=_[_0x96fe('0x32')](_0x353e5a[_0x96fe('0x2e')],_0x353e5a[_0x96fe('0x2f')]);_0x55b420['attributes']=_['intersection'](_0x353e5a[_0x96fe('0x2e')],qs[_0x96fe('0x33')](_0x223ee1[_0x96fe('0x2f')][_0x96fe('0x33')]));_0x55b420[_0x96fe('0x34')]=_0x55b420[_0x96fe('0x34')]['length']?_0x55b420[_0x96fe('0x34')]:_0x353e5a[_0x96fe('0x2e')];if(!_0x223ee1['query'][_0x96fe('0x35')](_0x96fe('0x36'))){_0x55b420['limit']=qs[_0x96fe('0x1e')](_0x223ee1[_0x96fe('0x2f')][_0x96fe('0x1e')]);_0x55b420[_0x96fe('0x1d')]=qs[_0x96fe('0x1d')](_0x223ee1[_0x96fe('0x2f')][_0x96fe('0x1d')]);}_0x55b420['order']=qs[_0x96fe('0x37')](_0x223ee1[_0x96fe('0x2f')][_0x96fe('0x37')]);_0x55b420[_0x96fe('0x38')]=qs[_0x96fe('0x31')](_[_0x96fe('0x39')](_0x223ee1[_0x96fe('0x2f')],_0x353e5a[_0x96fe('0x31')]),_0x5d18dd);if(_0x223ee1[_0x96fe('0x2f')]['filter']){_0x55b420[_0x96fe('0x38')]=_[_0x96fe('0x3a')](_0x55b420[_0x96fe('0x38')],{'$or':_[_0x96fe('0x29')](_0x5d18dd,function(_0x5909a4){if(_0x5909a4[_0x96fe('0x2c')]!==_0x96fe('0x3b')){var _0x3cd160={};_0x3cd160[_0x5909a4[_0x96fe('0x27')]]={'$like':'%'+_0x223ee1[_0x96fe('0x2f')][_0x96fe('0x3c')]+'%'};return _0x3cd160;}})});}_0x55b420=_[_0x96fe('0x3a')]({},_0x55b420,_0x223ee1[_0x96fe('0x3d')]);var _0x39ba35={'where':_0x55b420[_0x96fe('0x38')]};return db[_0x96fe('0x2a')][_0x96fe('0x1c')](_0x39ba35)[_0x96fe('0x23')](function(_0x3f13b7){_0x21481c[_0x96fe('0x1c')]=_0x3f13b7;if(_0x223ee1['query']['includeAll']){_0x55b420[_0x96fe('0x3e')]=[{'all':!![]}];}return db[_0x96fe('0x2a')][_0x96fe('0x3f')](_0x55b420);})[_0x96fe('0x23')](function(_0x4c1c18){_0x21481c['rows']=_0x4c1c18;return _0x21481c;})[_0x96fe('0x23')](respondWithFilteredResult(_0x3e9b01,_0x55b420))['catch'](handleError(_0x3e9b01,null));};exports[_0x96fe('0x40')]=function(_0x362beb,_0xfb4c5a){var _0x2112f2={'raw':![],'where':{'id':_0x362beb[_0x96fe('0x41')]['id']}},_0x42abc6={};_0x42abc6['model']=_[_0x96fe('0x30')](db['Dynamics365Configuration'][_0x96fe('0x2b')]);_0x42abc6['query']=_['keys'](_0x362beb[_0x96fe('0x2f')]);_0x42abc6[_0x96fe('0x31')]=_[_0x96fe('0x32')](_0x42abc6[_0x96fe('0x2e')],_0x42abc6[_0x96fe('0x2f')]);_0x2112f2['attributes']=_[_0x96fe('0x32')](_0x42abc6[_0x96fe('0x2e')],qs[_0x96fe('0x33')](_0x362beb[_0x96fe('0x2f')][_0x96fe('0x33')]));_0x2112f2[_0x96fe('0x34')]=_0x2112f2[_0x96fe('0x34')][_0x96fe('0x42')]?_0x2112f2[_0x96fe('0x34')]:_0x42abc6[_0x96fe('0x2e')];if(_0x362beb[_0x96fe('0x2f')][_0x96fe('0x43')]){_0x2112f2[_0x96fe('0x3e')]=[{'all':!![]}];}_0x2112f2=_[_0x96fe('0x3a')]({},_0x2112f2,_0x362beb[_0x96fe('0x3d')]);return db[_0x96fe('0x2a')][_0x96fe('0x44')](_0x2112f2)[_0x96fe('0x23')](handleEntityNotFound(_0xfb4c5a,null))[_0x96fe('0x23')](respondWithResult(_0xfb4c5a,null))[_0x96fe('0x45')](handleError(_0xfb4c5a,null));};exports['create']=function(_0x27745c,_0x5c6425){return db[_0x96fe('0x2a')]['create'](_0x27745c[_0x96fe('0x46')],{})[_0x96fe('0x23')](respondWithResult(_0x5c6425,0xc9))[_0x96fe('0x45')](handleError(_0x5c6425,null));};exports['update']=function(_0x40c61c,_0x93d4fd){if(_0x40c61c[_0x96fe('0x46')]['id']){delete _0x40c61c[_0x96fe('0x46')]['id'];}return db[_0x96fe('0x2a')]['find']({'where':{'id':_0x40c61c[_0x96fe('0x41')]['id']}})[_0x96fe('0x23')](handleEntityNotFound(_0x93d4fd,null))[_0x96fe('0x23')](saveUpdates(_0x40c61c[_0x96fe('0x46')],null))[_0x96fe('0x23')](respondWithResult(_0x93d4fd,null))[_0x96fe('0x45')](handleError(_0x93d4fd,null));};exports[_0x96fe('0x24')]=function(_0x444c65,_0x5bee3e){return db[_0x96fe('0x2a')]['find']({'where':{'id':_0x444c65['params']['id']}})[_0x96fe('0x23')](handleEntityNotFound(_0x5bee3e,null))[_0x96fe('0x23')](removeEntity(_0x5bee3e,null))[_0x96fe('0x45')](handleError(_0x5bee3e,null));};exports[_0x96fe('0x47')]=function(_0x402541,_0x41444c,_0x14f8d1){var _0x424c65={};var _0x16f45a={};var _0xec13d7;var _0xcec80f;return db[_0x96fe('0x2a')][_0x96fe('0x48')]({'where':{'id':_0x402541[_0x96fe('0x41')]['id']}})[_0x96fe('0x23')](handleEntityNotFound(_0x41444c,null))[_0x96fe('0x23')](function(_0x52c8d2){if(_0x52c8d2){_0xec13d7=_0x52c8d2;_0x16f45a[_0x96fe('0x2e')]=_[_0x96fe('0x30')](db[_0x96fe('0x49')]['rawAttributes']);_0x16f45a[_0x96fe('0x2f')]=_['keys'](_0x402541[_0x96fe('0x2f')]);_0x16f45a[_0x96fe('0x31')]=_[_0x96fe('0x32')](_0x16f45a[_0x96fe('0x2e')],_0x16f45a[_0x96fe('0x2f')]);_0x424c65[_0x96fe('0x34')]=_[_0x96fe('0x32')](_0x16f45a[_0x96fe('0x2e')],qs[_0x96fe('0x33')](_0x402541[_0x96fe('0x2f')][_0x96fe('0x33')]));_0x424c65[_0x96fe('0x34')]=_0x424c65[_0x96fe('0x34')][_0x96fe('0x42')]?_0x424c65['attributes']:_0x16f45a['model'];_0x424c65[_0x96fe('0x4a')]=qs['sort'](_0x402541[_0x96fe('0x2f')]['sort']);_0x424c65[_0x96fe('0x38')]=qs[_0x96fe('0x31')](_['pick'](_0x402541[_0x96fe('0x2f')],_0x16f45a[_0x96fe('0x31')]));if(_0x402541['query'][_0x96fe('0x3c')]){_0x424c65['where']=_['merge'](_0x424c65[_0x96fe('0x38')],{'$or':_[_0x96fe('0x29')](_0x424c65[_0x96fe('0x34')],function(_0x26aaaf){var _0x29a9b2={};_0x29a9b2[_0x26aaaf]={'$like':'%'+_0x402541['query'][_0x96fe('0x3c')]+'%'};return _0x29a9b2;})});}_0x424c65=_[_0x96fe('0x3a')]({},_0x424c65,_0x402541[_0x96fe('0x3d')]);return _0xec13d7['getFields'](_0x424c65);}})[_0x96fe('0x23')](function(_0x168122){if(_0x168122){_0xcec80f=_0x168122[_0x96fe('0x42')];if(!_0x402541['query'][_0x96fe('0x35')]('nolimit')){_0x424c65[_0x96fe('0x1e')]=qs['limit'](_0x402541[_0x96fe('0x2f')][_0x96fe('0x1e')]);_0x424c65[_0x96fe('0x1d')]=qs[_0x96fe('0x1d')](_0x402541[_0x96fe('0x2f')]['offset']);}return _0xec13d7[_0x96fe('0x47')](_0x424c65);}})[_0x96fe('0x23')](function(_0xba805e){if(_0xba805e){return _0xba805e?{'count':_0xcec80f,'rows':_0xba805e}:null;}})[_0x96fe('0x23')](respondWithResult(_0x41444c,null))[_0x96fe('0x45')](handleError(_0x41444c,null));};exports[_0x96fe('0x4b')]=function(_0x3f30e9,_0x21d460,_0x27235d){var _0x4d2644={};var _0x550bc6={};var _0xe18e6b;var _0x54fdfd;return db[_0x96fe('0x2a')][_0x96fe('0x48')]({'where':{'id':_0x3f30e9['params']['id']}})[_0x96fe('0x23')](handleEntityNotFound(_0x21d460,null))[_0x96fe('0x23')](function(_0x502752){if(_0x502752){_0xe18e6b=_0x502752;_0x550bc6[_0x96fe('0x2e')]=_['keys'](db[_0x96fe('0x49')][_0x96fe('0x2b')]);_0x550bc6[_0x96fe('0x2f')]=_[_0x96fe('0x30')](_0x3f30e9[_0x96fe('0x2f')]);_0x550bc6[_0x96fe('0x31')]=_[_0x96fe('0x32')](_0x550bc6[_0x96fe('0x2e')],_0x550bc6[_0x96fe('0x2f')]);_0x4d2644[_0x96fe('0x34')]=_[_0x96fe('0x32')](_0x550bc6['model'],qs['fields'](_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x33')]));_0x4d2644[_0x96fe('0x34')]=_0x4d2644[_0x96fe('0x34')][_0x96fe('0x42')]?_0x4d2644[_0x96fe('0x34')]:_0x550bc6[_0x96fe('0x2e')];_0x4d2644['order']=qs[_0x96fe('0x37')](_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x37')]);_0x4d2644[_0x96fe('0x38')]=qs[_0x96fe('0x31')](_[_0x96fe('0x39')](_0x3f30e9[_0x96fe('0x2f')],_0x550bc6[_0x96fe('0x31')]));if(_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x3c')]){_0x4d2644['where']=_[_0x96fe('0x3a')](_0x4d2644[_0x96fe('0x38')],{'$or':_[_0x96fe('0x29')](_0x4d2644[_0x96fe('0x34')],function(_0x46106c){var _0x12f33f={};_0x12f33f[_0x46106c]={'$like':'%'+_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x3c')]+'%'};return _0x12f33f;})});}_0x4d2644=_[_0x96fe('0x3a')]({},_0x4d2644,_0x3f30e9[_0x96fe('0x3d')]);return _0xe18e6b['getSubjects'](_0x4d2644);}})[_0x96fe('0x23')](function(_0x2cf124){if(_0x2cf124){_0x54fdfd=_0x2cf124['length'];if(!_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x35')]('nolimit')){_0x4d2644[_0x96fe('0x1e')]=qs[_0x96fe('0x1e')](_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x1e')]);_0x4d2644['offset']=qs[_0x96fe('0x1d')](_0x3f30e9[_0x96fe('0x2f')][_0x96fe('0x1d')]);}return _0xe18e6b['getSubjects'](_0x4d2644);}})[_0x96fe('0x23')](function(_0x351f27){if(_0x351f27){return _0x351f27?{'count':_0x54fdfd,'rows':_0x351f27}:null;}})[_0x96fe('0x23')](respondWithResult(_0x21d460,null))[_0x96fe('0x45')](handleError(_0x21d460,null));};exports['getDescriptions']=function(_0x268d02,_0x3b3e12,_0x15d8de){var _0x52caed={};var _0x483398={};var _0x2dacb6;var _0xa9c65;return db[_0x96fe('0x2a')][_0x96fe('0x48')]({'where':{'id':_0x268d02[_0x96fe('0x41')]['id']}})[_0x96fe('0x23')](handleEntityNotFound(_0x3b3e12,null))[_0x96fe('0x23')](function(_0x3a7b2c){if(_0x3a7b2c){_0x2dacb6=_0x3a7b2c;_0x483398[_0x96fe('0x2e')]=_[_0x96fe('0x30')](db[_0x96fe('0x49')][_0x96fe('0x2b')]);_0x483398['query']=_[_0x96fe('0x30')](_0x268d02[_0x96fe('0x2f')]);_0x483398['filters']=_[_0x96fe('0x32')](_0x483398[_0x96fe('0x2e')],_0x483398[_0x96fe('0x2f')]);_0x52caed['attributes']=_[_0x96fe('0x32')](_0x483398['model'],qs[_0x96fe('0x33')](_0x268d02[_0x96fe('0x2f')]['fields']));_0x52caed[_0x96fe('0x34')]=_0x52caed[_0x96fe('0x34')]['length']?_0x52caed['attributes']:_0x483398['model'];_0x52caed['order']=qs[_0x96fe('0x37')](_0x268d02[_0x96fe('0x2f')]['sort']);_0x52caed[_0x96fe('0x38')]=qs['filters'](_[_0x96fe('0x39')](_0x268d02['query'],_0x483398[_0x96fe('0x31')]));if(_0x268d02[_0x96fe('0x2f')][_0x96fe('0x3c')]){_0x52caed[_0x96fe('0x38')]=_[_0x96fe('0x3a')](_0x52caed['where'],{'$or':_[_0x96fe('0x29')](_0x52caed[_0x96fe('0x34')],function(_0x57ef60){var _0x18c7d6={};_0x18c7d6[_0x57ef60]={'$like':'%'+_0x268d02[_0x96fe('0x2f')]['filter']+'%'};return _0x18c7d6;})});}_0x52caed=_['merge']({},_0x52caed,_0x268d02[_0x96fe('0x3d')]);return _0x2dacb6[_0x96fe('0x4c')](_0x52caed);}})['then'](function(_0x2d53cb){if(_0x2d53cb){_0xa9c65=_0x2d53cb[_0x96fe('0x42')];if(!_0x268d02[_0x96fe('0x2f')][_0x96fe('0x35')](_0x96fe('0x36'))){_0x52caed['limit']=qs[_0x96fe('0x1e')](_0x268d02[_0x96fe('0x2f')][_0x96fe('0x1e')]);_0x52caed[_0x96fe('0x1d')]=qs[_0x96fe('0x1d')](_0x268d02[_0x96fe('0x2f')]['offset']);}return _0x2dacb6[_0x96fe('0x4c')](_0x52caed);}})[_0x96fe('0x23')](function(_0x2ba59c){if(_0x2ba59c){return _0x2ba59c?{'count':_0xa9c65,'rows':_0x2ba59c}:null;}})[_0x96fe('0x23')](respondWithResult(_0x3b3e12,null))[_0x96fe('0x45')](handleError(_0x3b3e12,null));}; \ No newline at end of file +var _0x7ebb=['sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','index','map','Dynamics365Configuration','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x58fac8,_0x5ec989){var _0x4a560e=function(_0x1edf34){while(--_0x1edf34){_0x58fac8['push'](_0x58fac8['shift']());}};_0x4a560e(++_0x5ec989);}(_0x7ebb,0x13a));var _0xb7eb=function(_0x5e9c3a,_0x13acc2){_0x5e9c3a=_0x5e9c3a-0x0;var _0x12ccb4=_0x7ebb[_0x5e9c3a];return _0x12ccb4;};'use strict';var emlformat=require(_0xb7eb('0x0'));var rimraf=require(_0xb7eb('0x1'));var zipdir=require(_0xb7eb('0x2'));var jsonpatch=require(_0xb7eb('0x3'));var rp=require(_0xb7eb('0x4'));var moment=require(_0xb7eb('0x5'));var BPromise=require(_0xb7eb('0x6'));var Mustache=require(_0xb7eb('0x7'));var util=require(_0xb7eb('0x8'));var path=require(_0xb7eb('0x9'));var sox=require(_0xb7eb('0xa'));var csv=require(_0xb7eb('0xb'));var ejs=require(_0xb7eb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7eb('0xd'));var squel=require(_0xb7eb('0xe'));var crypto=require(_0xb7eb('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb7eb('0xb'));var querystring=require(_0xb7eb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb7eb('0x11'));var qs=require(_0xb7eb('0x12'));var as=require(_0xb7eb('0x13'));var hardwareService=require(_0xb7eb('0x14'));var logger=require(_0xb7eb('0x15'))(_0xb7eb('0x16'));var utils=require(_0xb7eb('0x17'));var config=require(_0xb7eb('0x18'));var licenseUtil=require(_0xb7eb('0x19'));var db=require(_0xb7eb('0x1a'))['db'];function respondWithStatusCode(_0x46a5ce,_0x374e19){_0x374e19=_0x374e19||0xcc;return function(_0x158069){if(_0x158069){return _0x46a5ce[_0xb7eb('0x1b')](_0x374e19);}return _0x46a5ce[_0xb7eb('0x1c')](_0x374e19)[_0xb7eb('0x1d')]();};}function respondWithResult(_0xb5b9ae,_0x5e5133){_0x5e5133=_0x5e5133||0xc8;return function(_0x483e15){if(_0x483e15){return _0xb5b9ae[_0xb7eb('0x1c')](_0x5e5133)['json'](_0x483e15);}};}function respondWithFilteredResult(_0x227634,_0x4094a2){return function(_0x3a723d){if(_0x3a723d){var _0x46943d=typeof _0x4094a2[_0xb7eb('0x1e')]===_0xb7eb('0x1f')&&typeof _0x4094a2[_0xb7eb('0x20')]==='undefined';var _0x1685c8=_0x3a723d[_0xb7eb('0x21')];var _0x376e3c=_0x46943d?0x0:_0x4094a2[_0xb7eb('0x1e')];var _0x4afb5c=_0x46943d?_0x3a723d[_0xb7eb('0x21')]:_0x4094a2['offset']+_0x4094a2['limit'];var _0x4e5ec4;if(_0x4afb5c>=_0x1685c8){_0x4afb5c=_0x1685c8;_0x4e5ec4=0xc8;}else{_0x4e5ec4=0xce;}_0x227634[_0xb7eb('0x1c')](_0x4e5ec4);return _0x227634[_0xb7eb('0x22')](_0xb7eb('0x23'),_0x376e3c+'-'+_0x4afb5c+'/'+_0x1685c8)[_0xb7eb('0x24')](_0x3a723d);}return null;};}function patchUpdates(_0x44cec7){return function(_0x5bf011){try{jsonpatch['apply'](_0x5bf011,_0x44cec7,!![]);}catch(_0xfb473c){return BPromise[_0xb7eb('0x25')](_0xfb473c);}return _0x5bf011[_0xb7eb('0x26')]();};}function saveUpdates(_0x4c8bd0,_0x200823){return function(_0x243392){if(_0x243392){return _0x243392[_0xb7eb('0x27')](_0x4c8bd0)[_0xb7eb('0x28')](function(_0x1b9e3b){return _0x1b9e3b;});}return null;};}function removeEntity(_0x5a5729,_0x2698ae){return function(_0x263593){if(_0x263593){return _0x263593[_0xb7eb('0x29')]()['then'](function(){_0x5a5729[_0xb7eb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1170ba,_0x5871c8){return function(_0x271b15){if(!_0x271b15){_0x1170ba['sendStatus'](0x194);}return _0x271b15;};}function handleError(_0xae1231,_0x16cd4a){_0x16cd4a=_0x16cd4a||0x1f4;return function(_0x1d81ad){logger['error'](_0x1d81ad[_0xb7eb('0x2a')]);if(_0x1d81ad[_0xb7eb('0x2b')]){delete _0x1d81ad[_0xb7eb('0x2b')];}_0xae1231['status'](_0x16cd4a)['send'](_0x1d81ad);};}exports[_0xb7eb('0x2c')]=function(_0x3026d8,_0x23b35d){var _0x1fbb60={},_0x20c44c={},_0x5e657e={'count':0x0,'rows':[]};var _0xa69664=_[_0xb7eb('0x2d')](db[_0xb7eb('0x2e')][_0xb7eb('0x2f')],function(_0x564de0){return{'name':_0x564de0['fieldName'],'type':_0x564de0[_0xb7eb('0x30')]['key']};});_0x20c44c['model']=_[_0xb7eb('0x2d')](_0xa69664,'name');_0x20c44c['query']=_[_0xb7eb('0x31')](_0x3026d8[_0xb7eb('0x32')]);_0x20c44c[_0xb7eb('0x33')]=_['intersection'](_0x20c44c[_0xb7eb('0x34')],_0x20c44c['query']);_0x1fbb60[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x20c44c[_0xb7eb('0x34')],qs[_0xb7eb('0x37')](_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x1fbb60[_0xb7eb('0x35')]=_0x1fbb60[_0xb7eb('0x35')][_0xb7eb('0x38')]?_0x1fbb60[_0xb7eb('0x35')]:_0x20c44c[_0xb7eb('0x34')];if(!_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x39')]('nolimit')){_0x1fbb60[_0xb7eb('0x20')]=qs[_0xb7eb('0x20')](_0x3026d8['query']['limit']);_0x1fbb60[_0xb7eb('0x1e')]=qs[_0xb7eb('0x1e')](_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x1e')]);}_0x1fbb60[_0xb7eb('0x3a')]=qs[_0xb7eb('0x3b')](_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x3b')]);_0x1fbb60[_0xb7eb('0x3c')]=qs[_0xb7eb('0x33')](_[_0xb7eb('0x3d')](_0x3026d8[_0xb7eb('0x32')],_0x20c44c[_0xb7eb('0x33')]),_0xa69664);if(_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x3e')]){_0x1fbb60[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x1fbb60['where'],{'$or':_[_0xb7eb('0x2d')](_0xa69664,function(_0x23f41f){if(_0x23f41f[_0xb7eb('0x30')]!==_0xb7eb('0x40')){var _0x246870={};_0x246870[_0x23f41f['name']]={'$like':'%'+_0x3026d8[_0xb7eb('0x32')][_0xb7eb('0x3e')]+'%'};return _0x246870;}})});}_0x1fbb60=_[_0xb7eb('0x3f')]({},_0x1fbb60,_0x3026d8[_0xb7eb('0x41')]);var _0x13a82a={'where':_0x1fbb60[_0xb7eb('0x3c')]};return db[_0xb7eb('0x2e')][_0xb7eb('0x21')](_0x13a82a)['then'](function(_0x4e8c10){_0x5e657e[_0xb7eb('0x21')]=_0x4e8c10;if(_0x3026d8[_0xb7eb('0x32')]['includeAll']){_0x1fbb60[_0xb7eb('0x42')]=[{'all':!![]}];}return db[_0xb7eb('0x2e')]['findAll'](_0x1fbb60);})[_0xb7eb('0x28')](function(_0x2fbffe){_0x5e657e[_0xb7eb('0x43')]=_0x2fbffe;return _0x5e657e;})[_0xb7eb('0x28')](respondWithFilteredResult(_0x23b35d,_0x1fbb60))[_0xb7eb('0x44')](handleError(_0x23b35d,null));};exports[_0xb7eb('0x45')]=function(_0x25e74c,_0x1c6346){var _0x472880={'raw':![],'where':{'id':_0x25e74c[_0xb7eb('0x46')]['id']}},_0x45010e={};_0x45010e['model']=_[_0xb7eb('0x31')](db[_0xb7eb('0x2e')][_0xb7eb('0x2f')]);_0x45010e[_0xb7eb('0x32')]=_[_0xb7eb('0x31')](_0x25e74c[_0xb7eb('0x32')]);_0x45010e[_0xb7eb('0x33')]=_[_0xb7eb('0x36')](_0x45010e['model'],_0x45010e[_0xb7eb('0x32')]);_0x472880[_0xb7eb('0x35')]=_['intersection'](_0x45010e[_0xb7eb('0x34')],qs['fields'](_0x25e74c['query'][_0xb7eb('0x37')]));_0x472880[_0xb7eb('0x35')]=_0x472880['attributes'][_0xb7eb('0x38')]?_0x472880[_0xb7eb('0x35')]:_0x45010e[_0xb7eb('0x34')];if(_0x25e74c[_0xb7eb('0x32')][_0xb7eb('0x47')]){_0x472880[_0xb7eb('0x42')]=[{'all':!![]}];}_0x472880=_[_0xb7eb('0x3f')]({},_0x472880,_0x25e74c[_0xb7eb('0x41')]);return db[_0xb7eb('0x2e')][_0xb7eb('0x48')](_0x472880)[_0xb7eb('0x28')](handleEntityNotFound(_0x1c6346,null))[_0xb7eb('0x28')](respondWithResult(_0x1c6346,null))[_0xb7eb('0x44')](handleError(_0x1c6346,null));};exports[_0xb7eb('0x49')]=function(_0x16f1f2,_0x5d930e){return db[_0xb7eb('0x2e')][_0xb7eb('0x49')](_0x16f1f2[_0xb7eb('0x4a')],{})[_0xb7eb('0x28')](respondWithResult(_0x5d930e,0xc9))[_0xb7eb('0x44')](handleError(_0x5d930e,null));};exports[_0xb7eb('0x27')]=function(_0x4e7372,_0x70abe7){if(_0x4e7372[_0xb7eb('0x4a')]['id']){delete _0x4e7372[_0xb7eb('0x4a')]['id'];}return db[_0xb7eb('0x2e')][_0xb7eb('0x48')]({'where':{'id':_0x4e7372[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x70abe7,null))[_0xb7eb('0x28')](saveUpdates(_0x4e7372['body'],null))[_0xb7eb('0x28')](respondWithResult(_0x70abe7,null))['catch'](handleError(_0x70abe7,null));};exports['destroy']=function(_0x430f4f,_0x1a92f7){return db[_0xb7eb('0x2e')][_0xb7eb('0x48')]({'where':{'id':_0x430f4f[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x1a92f7,null))[_0xb7eb('0x28')](removeEntity(_0x1a92f7,null))[_0xb7eb('0x44')](handleError(_0x1a92f7,null));};exports[_0xb7eb('0x4b')]=function(_0x345f5e,_0x334237,_0x4d06fe){var _0x3c83af={};var _0x5e3f17={};var _0x4f0fb0;var _0x23deb1;return db[_0xb7eb('0x2e')][_0xb7eb('0x4c')]({'where':{'id':_0x345f5e[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x334237,null))[_0xb7eb('0x28')](function(_0x3e500f){if(_0x3e500f){_0x4f0fb0=_0x3e500f;_0x5e3f17['model']=_[_0xb7eb('0x31')](db[_0xb7eb('0x4d')][_0xb7eb('0x2f')]);_0x5e3f17[_0xb7eb('0x32')]=_[_0xb7eb('0x31')](_0x345f5e[_0xb7eb('0x32')]);_0x5e3f17[_0xb7eb('0x33')]=_[_0xb7eb('0x36')](_0x5e3f17[_0xb7eb('0x34')],_0x5e3f17['query']);_0x3c83af[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x5e3f17[_0xb7eb('0x34')],qs['fields'](_0x345f5e[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x3c83af[_0xb7eb('0x35')]=_0x3c83af[_0xb7eb('0x35')][_0xb7eb('0x38')]?_0x3c83af['attributes']:_0x5e3f17[_0xb7eb('0x34')];_0x3c83af[_0xb7eb('0x3a')]=qs[_0xb7eb('0x3b')](_0x345f5e['query'][_0xb7eb('0x3b')]);_0x3c83af[_0xb7eb('0x3c')]=qs['filters'](_[_0xb7eb('0x3d')](_0x345f5e[_0xb7eb('0x32')],_0x5e3f17[_0xb7eb('0x33')]));if(_0x345f5e[_0xb7eb('0x32')][_0xb7eb('0x3e')]){_0x3c83af[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x3c83af[_0xb7eb('0x3c')],{'$or':_[_0xb7eb('0x2d')](_0x3c83af['attributes'],function(_0x337344){var _0x3068e3={};_0x3068e3[_0x337344]={'$like':'%'+_0x345f5e[_0xb7eb('0x32')]['filter']+'%'};return _0x3068e3;})});}_0x3c83af=_[_0xb7eb('0x3f')]({},_0x3c83af,_0x345f5e[_0xb7eb('0x41')]);return _0x4f0fb0[_0xb7eb('0x4b')](_0x3c83af);}})[_0xb7eb('0x28')](function(_0x555353){if(_0x555353){_0x23deb1=_0x555353[_0xb7eb('0x38')];if(!_0x345f5e['query'][_0xb7eb('0x39')]('nolimit')){_0x3c83af[_0xb7eb('0x20')]=qs[_0xb7eb('0x20')](_0x345f5e[_0xb7eb('0x32')]['limit']);_0x3c83af['offset']=qs[_0xb7eb('0x1e')](_0x345f5e[_0xb7eb('0x32')][_0xb7eb('0x1e')]);}return _0x4f0fb0[_0xb7eb('0x4b')](_0x3c83af);}})['then'](function(_0x28f5a9){if(_0x28f5a9){return _0x28f5a9?{'count':_0x23deb1,'rows':_0x28f5a9}:null;}})['then'](respondWithResult(_0x334237,null))[_0xb7eb('0x44')](handleError(_0x334237,null));};exports[_0xb7eb('0x4e')]=function(_0x17e526,_0x214a4c,_0x3e2b36){var _0x581170={};var _0x3938c5={};var _0x4d65a5;var _0x35ff21;return db[_0xb7eb('0x2e')]['findOne']({'where':{'id':_0x17e526[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x214a4c,null))[_0xb7eb('0x28')](function(_0x3c1237){if(_0x3c1237){_0x4d65a5=_0x3c1237;_0x3938c5[_0xb7eb('0x34')]=_['keys'](db[_0xb7eb('0x4d')]['rawAttributes']);_0x3938c5['query']=_[_0xb7eb('0x31')](_0x17e526[_0xb7eb('0x32')]);_0x3938c5[_0xb7eb('0x33')]=_['intersection'](_0x3938c5[_0xb7eb('0x34')],_0x3938c5[_0xb7eb('0x32')]);_0x581170[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x3938c5['model'],qs['fields'](_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x581170[_0xb7eb('0x35')]=_0x581170[_0xb7eb('0x35')]['length']?_0x581170[_0xb7eb('0x35')]:_0x3938c5['model'];_0x581170[_0xb7eb('0x3a')]=qs['sort'](_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x3b')]);_0x581170[_0xb7eb('0x3c')]=qs[_0xb7eb('0x33')](_['pick'](_0x17e526['query'],_0x3938c5[_0xb7eb('0x33')]));if(_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x3e')]){_0x581170[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x581170['where'],{'$or':_[_0xb7eb('0x2d')](_0x581170[_0xb7eb('0x35')],function(_0x36c8bb){var _0x1ffeab={};_0x1ffeab[_0x36c8bb]={'$like':'%'+_0x17e526[_0xb7eb('0x32')][_0xb7eb('0x3e')]+'%'};return _0x1ffeab;})});}_0x581170=_[_0xb7eb('0x3f')]({},_0x581170,_0x17e526[_0xb7eb('0x41')]);return _0x4d65a5[_0xb7eb('0x4e')](_0x581170);}})[_0xb7eb('0x28')](function(_0x3d5976){if(_0x3d5976){_0x35ff21=_0x3d5976[_0xb7eb('0x38')];if(!_0x17e526[_0xb7eb('0x32')]['hasOwnProperty'](_0xb7eb('0x4f'))){_0x581170['limit']=qs['limit'](_0x17e526['query'][_0xb7eb('0x20')]);_0x581170[_0xb7eb('0x1e')]=qs[_0xb7eb('0x1e')](_0x17e526['query'][_0xb7eb('0x1e')]);}return _0x4d65a5[_0xb7eb('0x4e')](_0x581170);}})[_0xb7eb('0x28')](function(_0x11ba04){if(_0x11ba04){return _0x11ba04?{'count':_0x35ff21,'rows':_0x11ba04}:null;}})['then'](respondWithResult(_0x214a4c,null))[_0xb7eb('0x44')](handleError(_0x214a4c,null));};exports[_0xb7eb('0x50')]=function(_0x4a9ec0,_0x40cecc,_0x472f44){var _0x16d9f3={};var _0x46c47d={};var _0x4e3f5f;var _0x7e5633;return db[_0xb7eb('0x2e')][_0xb7eb('0x4c')]({'where':{'id':_0x4a9ec0[_0xb7eb('0x46')]['id']}})[_0xb7eb('0x28')](handleEntityNotFound(_0x40cecc,null))[_0xb7eb('0x28')](function(_0x2a3144){if(_0x2a3144){_0x4e3f5f=_0x2a3144;_0x46c47d[_0xb7eb('0x34')]=_['keys'](db[_0xb7eb('0x4d')][_0xb7eb('0x2f')]);_0x46c47d['query']=_['keys'](_0x4a9ec0[_0xb7eb('0x32')]);_0x46c47d[_0xb7eb('0x33')]=_[_0xb7eb('0x36')](_0x46c47d[_0xb7eb('0x34')],_0x46c47d[_0xb7eb('0x32')]);_0x16d9f3[_0xb7eb('0x35')]=_[_0xb7eb('0x36')](_0x46c47d[_0xb7eb('0x34')],qs['fields'](_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x37')]));_0x16d9f3[_0xb7eb('0x35')]=_0x16d9f3['attributes'][_0xb7eb('0x38')]?_0x16d9f3[_0xb7eb('0x35')]:_0x46c47d[_0xb7eb('0x34')];_0x16d9f3[_0xb7eb('0x3a')]=qs['sort'](_0x4a9ec0[_0xb7eb('0x32')]['sort']);_0x16d9f3['where']=qs[_0xb7eb('0x33')](_[_0xb7eb('0x3d')](_0x4a9ec0[_0xb7eb('0x32')],_0x46c47d['filters']));if(_0x4a9ec0['query'][_0xb7eb('0x3e')]){_0x16d9f3[_0xb7eb('0x3c')]=_[_0xb7eb('0x3f')](_0x16d9f3[_0xb7eb('0x3c')],{'$or':_[_0xb7eb('0x2d')](_0x16d9f3[_0xb7eb('0x35')],function(_0x1e9b50){var _0x4f4cc4={};_0x4f4cc4[_0x1e9b50]={'$like':'%'+_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x3e')]+'%'};return _0x4f4cc4;})});}_0x16d9f3=_['merge']({},_0x16d9f3,_0x4a9ec0['options']);return _0x4e3f5f[_0xb7eb('0x50')](_0x16d9f3);}})[_0xb7eb('0x28')](function(_0x59a3be){if(_0x59a3be){_0x7e5633=_0x59a3be[_0xb7eb('0x38')];if(!_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x39')](_0xb7eb('0x4f'))){_0x16d9f3[_0xb7eb('0x20')]=qs['limit'](_0x4a9ec0[_0xb7eb('0x32')][_0xb7eb('0x20')]);_0x16d9f3[_0xb7eb('0x1e')]=qs[_0xb7eb('0x1e')](_0x4a9ec0['query'][_0xb7eb('0x1e')]);}return _0x4e3f5f[_0xb7eb('0x50')](_0x16d9f3);}})[_0xb7eb('0x28')](function(_0x1ce567){if(_0x1ce567){return _0x1ce567?{'count':_0x7e5633,'rows':_0x1ce567}:null;}})['then'](respondWithResult(_0x40cecc,null))[_0xb7eb('0x44')](handleError(_0x40cecc,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fc87f42..fd78ef6 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x52d30e,_0x1b0809){var _0xfd52ef=function(_0x18499e){while(--_0x18499e){_0x52d30e['push'](_0x52d30e['shift']());}};_0xfd52ef(++_0x1b0809);}(_0x54ef,0x112));var _0xf54e=function(_0x1a278d,_0x4689a0){_0x1a278d=_0x1a278d-0x0;var _0x55d574=_0x54ef[_0x1a278d];return _0x55d574;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e9a2b,_0x7ec646){var _0xf3697d=function(_0x442769){while(--_0x442769){_0x1e9a2b['push'](_0x1e9a2b['shift']());}};_0xf3697d(++_0x7ec646);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0xb4e6[_0x2e9187];return _0x1fc3a8;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index e8798e4..77ab930 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 _0xed93=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','moment'];(function(_0x467946,_0x58d051){var _0x5be916=function(_0x163b83){while(--_0x163b83){_0x467946['push'](_0x467946['shift']());}};_0x5be916(++_0x58d051);}(_0xed93,0x1cc));var _0x3ed9=function(_0x260eb3,_0xe8c2b){_0x260eb3=_0x260eb3-0x0;var _0x283366=_0xed93[_0x260eb3];return _0x283366;};'use strict';var _=require('lodash');var util=require(_0x3ed9('0x0'));var moment=require(_0x3ed9('0x1'));var BPromise=require(_0x3ed9('0x2'));var rs=require(_0x3ed9('0x3'));var fs=require('fs');var Redis=require(_0x3ed9('0x4'));var db=require(_0x3ed9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ed9('0x6'))(_0x3ed9('0x7'));var config=require(_0x3ed9('0x8'));var jayson=require(_0x3ed9('0x9'));var client=jayson[_0x3ed9('0xa')][_0x3ed9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aac77,_0x124923,_0x1569c1){return new BPromise(function(_0x3b992b,_0x33a222){return client[_0x3ed9('0xc')](_0x2aac77,_0x1569c1)[_0x3ed9('0xd')](function(_0x17885a){logger[_0x3ed9('0xe')](_0x3ed9('0xf'),_0x124923,_0x3ed9('0x10'));logger[_0x3ed9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x124923,'request\x20sent',JSON['stringify'](_0x17885a));if(_0x17885a['error']){if(_0x17885a['error']['code']===0x1f4){logger[_0x3ed9('0x12')](_0x3ed9('0xf'),_0x124923,_0x17885a['error']['message']);return _0x33a222(_0x17885a[_0x3ed9('0x12')][_0x3ed9('0x13')]);}logger['error'](_0x3ed9('0xf'),_0x124923,_0x17885a[_0x3ed9('0x12')][_0x3ed9('0x13')]);return _0x3b992b(_0x17885a[_0x3ed9('0x12')][_0x3ed9('0x13')]);}else{logger['info'](_0x3ed9('0xf'),_0x124923,'request\x20sent');_0x3b992b(_0x17885a[_0x3ed9('0x14')][_0x3ed9('0x13')]);}})[_0x3ed9('0x15')](function(_0x14bffd){logger[_0x3ed9('0x12')](_0x3ed9('0xf'),_0x124923,_0x14bffd);_0x33a222(_0x14bffd);});});} \ No newline at end of file +var _0x4728=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f349f,_0x50dca8){var _0xe6e53=function(_0x3d94f1){while(--_0x3d94f1){_0x1f349f['push'](_0x1f349f['shift']());}};_0xe6e53(++_0x50dca8);}(_0x4728,0xd1));var _0x8472=function(_0x3a5dd1,_0x5ed411){_0x3a5dd1=_0x3a5dd1-0x0;var _0x40878b=_0x4728[_0x3a5dd1];return _0x40878b;};'use strict';var _=require(_0x8472('0x0'));var util=require('util');var moment=require(_0x8472('0x1'));var BPromise=require(_0x8472('0x2'));var rs=require(_0x8472('0x3'));var fs=require('fs');var Redis=require(_0x8472('0x4'));var db=require(_0x8472('0x5'))['db'];var utils=require(_0x8472('0x6'));var logger=require(_0x8472('0x7'))(_0x8472('0x8'));var config=require('../../config/environment');var jayson=require(_0x8472('0x9'));var client=jayson['client'][_0x8472('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f65e,_0x485c95,_0xb9a77d){return new BPromise(function(_0x27710f,_0x32f2e8){return client[_0x8472('0xb')](_0x27f65e,_0xb9a77d)[_0x8472('0xc')](function(_0x40f214){logger[_0x8472('0xd')](_0x8472('0xe'),_0x485c95,_0x8472('0xf'));logger[_0x8472('0x10')](_0x8472('0x11'),_0x485c95,_0x8472('0xf'),JSON[_0x8472('0x12')](_0x40f214));if(_0x40f214['error']){if(_0x40f214[_0x8472('0x13')][_0x8472('0x14')]===0x1f4){logger[_0x8472('0x13')](_0x8472('0xe'),_0x485c95,_0x40f214[_0x8472('0x13')][_0x8472('0x15')]);return _0x32f2e8(_0x40f214['error']['message']);}logger['error'](_0x8472('0xe'),_0x485c95,_0x40f214[_0x8472('0x13')]['message']);return _0x27710f(_0x40f214[_0x8472('0x13')][_0x8472('0x15')]);}else{logger[_0x8472('0xd')](_0x8472('0xe'),_0x485c95,_0x8472('0xf'));_0x27710f(_0x40f214[_0x8472('0x16')][_0x8472('0x15')]);}})['catch'](function(_0x4daba0){logger[_0x8472('0x13')](_0x8472('0xe'),_0x485c95,_0x4daba0);_0x32f2e8(_0x4daba0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f298f84..1d2509f 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 _0x3c6a=['isAuthenticated','index','get','show','post','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x17546e,_0x16c9cf){var _0x5b2bc7=function(_0x5b65fd){while(--_0x5b65fd){_0x17546e['push'](_0x17546e['shift']());}};_0x5b2bc7(++_0x16c9cf);}(_0x3c6a,0x1ca));var _0xa3c6=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x3c6a[_0x36bff5];return _0x80ade5;};'use strict';var multer=require(_0xa3c6('0x0'));var util=require('util');var path=require(_0xa3c6('0x1'));var timeout=require(_0xa3c6('0x2'));var express=require(_0xa3c6('0x3'));var router=express[_0xa3c6('0x4')]();var fs_extra=require(_0xa3c6('0x5'));var auth=require(_0xa3c6('0x6'));var interaction=require(_0xa3c6('0x7'));var config=require(_0xa3c6('0x8'));var controller=require(_0xa3c6('0x9'));router['get']('/',auth[_0xa3c6('0xa')](),controller[_0xa3c6('0xb')]);router[_0xa3c6('0xc')]('/:id',auth[_0xa3c6('0xa')](),controller[_0xa3c6('0xd')]);router[_0xa3c6('0xe')]('/',auth[_0xa3c6('0xa')](),controller['create']);router['put'](_0xa3c6('0xf'),auth[_0xa3c6('0xa')](),controller['update']);router[_0xa3c6('0x10')]('/:id',auth[_0xa3c6('0xa')](),controller['destroy']);module[_0xa3c6('0x11')]=router; \ No newline at end of file +var _0x2448=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','post','put','/:id','destroy','exports','multer'];(function(_0x194867,_0x3a36a8){var _0x222dac=function(_0x417f20){while(--_0x417f20){_0x194867['push'](_0x194867['shift']());}};_0x222dac(++_0x3a36a8);}(_0x2448,0x11c));var _0x8244=function(_0x40bb55,_0x507f65){_0x40bb55=_0x40bb55-0x0;var _0x28d0e6=_0x2448[_0x40bb55];return _0x28d0e6;};'use strict';var multer=require(_0x8244('0x0'));var util=require(_0x8244('0x1'));var path=require(_0x8244('0x2'));var timeout=require(_0x8244('0x3'));var express=require(_0x8244('0x4'));var router=express[_0x8244('0x5')]();var fs_extra=require(_0x8244('0x6'));var auth=require(_0x8244('0x7'));var interaction=require(_0x8244('0x8'));var config=require(_0x8244('0x9'));var controller=require(_0x8244('0xa'));router[_0x8244('0xb')]('/',auth[_0x8244('0xc')](),controller[_0x8244('0xd')]);router[_0x8244('0xb')]('/:id',auth[_0x8244('0xc')](),controller['show']);router[_0x8244('0xe')]('/',auth[_0x8244('0xc')](),controller['create']);router[_0x8244('0xf')](_0x8244('0x10'),auth[_0x8244('0xc')](),controller['update']);router['delete'](_0x8244('0x10'),auth['isAuthenticated'](),controller[_0x8244('0x11')]);module[_0x8244('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 1ceafb7..4467e9a 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 _0xc0ba=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x1eeaf9,_0x501459){var _0x12d4c2=function(_0x3e5d3b){while(--_0x3e5d3b){_0x1eeaf9['push'](_0x1eeaf9['shift']());}};_0x12d4c2(++_0x501459);}(_0xc0ba,0x1db));var _0xac0b=function(_0x499227,_0x3a8c2c){_0x499227=_0x499227-0x0;var _0xec1c0a=_0xc0ba[_0x499227];return _0xec1c0a;};'use strict';var Sequelize=require(_0xac0b('0x0'));module[_0xac0b('0x1')]={'type':{'type':Sequelize[_0xac0b('0x2')](_0xac0b('0x3'),_0xac0b('0x4'),_0xac0b('0x5'),_0xac0b('0x6'),_0xac0b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xac0b('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xac0b('0x2')](_0xac0b('0x3'),_0xac0b('0x4'),_0xac0b('0x5'))},'keyContent':{'type':Sequelize[_0xac0b('0x8')]},'idField':{'type':Sequelize[_0xac0b('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xac0b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac0b('0x8')]}}; \ No newline at end of file +var _0x8f89=['keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM','variable'];(function(_0x2fa03c,_0x474599){var _0x4ee622=function(_0x34e31d){while(--_0x34e31d){_0x2fa03c['push'](_0x2fa03c['shift']());}};_0x4ee622(++_0x474599);}(_0x8f89,0x171));var _0x98f8=function(_0x499541,_0x49a73e){_0x499541=_0x499541-0x0;var _0x563c05=_0x8f89[_0x499541];return _0x563c05;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x98f8('0x0')]('string',_0x98f8('0x1'),'customVariable',_0x98f8('0x2'),_0x98f8('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x98f8('0x4')]},'key':{'type':Sequelize[_0x98f8('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0x98f8('0x1'),_0x98f8('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x98f8('0x4')]},'nameField':{'type':Sequelize[_0x98f8('0x4')]},'customField':{'type':Sequelize[_0x98f8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a12590a..e62fa1d 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 _0xe3d4=['merge','options','includeAll','include','rows','catch','params','keys','Dynamics365Field','find','create','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','error','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x128495,_0x32ea3a){var _0x5323c1=function(_0x14911c){while(--_0x14911c){_0x128495['push'](_0x128495['shift']());}};_0x5323c1(++_0x32ea3a);}(_0xe3d4,0x99));var _0x4e3d=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0xe3d4[_0x101802];return _0x5d61ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e3d('0x0'));var zipdir=require(_0x4e3d('0x1'));var jsonpatch=require(_0x4e3d('0x2'));var rp=require('request-promise');var moment=require(_0x4e3d('0x3'));var BPromise=require(_0x4e3d('0x4'));var Mustache=require(_0x4e3d('0x5'));var util=require(_0x4e3d('0x6'));var path=require(_0x4e3d('0x7'));var sox=require('sox');var csv=require(_0x4e3d('0x8'));var ejs=require(_0x4e3d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4e3d('0xa'));var crypto=require(_0x4e3d('0xb'));var jsforce=require(_0x4e3d('0xc'));var deskjs=require(_0x4e3d('0xd'));var toCsv=require(_0x4e3d('0x8'));var querystring=require(_0x4e3d('0xe'));var Papa=require(_0x4e3d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e3d('0x10'));var hardwareService=require(_0x4e3d('0x11'));var logger=require(_0x4e3d('0x12'))(_0x4e3d('0x13'));var utils=require('../../config/utils');var config=require(_0x4e3d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e689e,_0x576acd){_0x576acd=_0x576acd||0xcc;return function(_0x2a9a44){if(_0x2a9a44){return _0x2e689e[_0x4e3d('0x15')](_0x576acd);}return _0x2e689e[_0x4e3d('0x16')](_0x576acd)['end']();};}function respondWithResult(_0x1dd9d1,_0x42ca3d){_0x42ca3d=_0x42ca3d||0xc8;return function(_0x393eb8){if(_0x393eb8){return _0x1dd9d1[_0x4e3d('0x16')](_0x42ca3d)[_0x4e3d('0x17')](_0x393eb8);}};}function respondWithFilteredResult(_0x512180,_0x546789){return function(_0xe6ae4){if(_0xe6ae4){var _0x788aa=typeof _0x546789[_0x4e3d('0x18')]===_0x4e3d('0x19')&&typeof _0x546789[_0x4e3d('0x1a')]==='undefined';var _0x2d87d9=_0xe6ae4[_0x4e3d('0x1b')];var _0x343fa1=_0x788aa?0x0:_0x546789['offset'];var _0x4902ed=_0x788aa?_0xe6ae4['count']:_0x546789['offset']+_0x546789[_0x4e3d('0x1a')];var _0x5734f8;if(_0x4902ed>=_0x2d87d9){_0x4902ed=_0x2d87d9;_0x5734f8=0xc8;}else{_0x5734f8=0xce;}_0x512180[_0x4e3d('0x16')](_0x5734f8);return _0x512180[_0x4e3d('0x1c')](_0x4e3d('0x1d'),_0x343fa1+'-'+_0x4902ed+'/'+_0x2d87d9)[_0x4e3d('0x17')](_0xe6ae4);}return null;};}function patchUpdates(_0x24278c){return function(_0x57c1d9){try{jsonpatch[_0x4e3d('0x1e')](_0x57c1d9,_0x24278c,!![]);}catch(_0x3442){return BPromise[_0x4e3d('0x1f')](_0x3442);}return _0x57c1d9[_0x4e3d('0x20')]();};}function saveUpdates(_0x37d635,_0x13419d){return function(_0x886df2){if(_0x886df2){return _0x886df2['update'](_0x37d635)['then'](function(_0xbb4e6d){return _0xbb4e6d;});}return null;};}function removeEntity(_0x2db4cd,_0x3c9330){return function(_0x28fa05){if(_0x28fa05){return _0x28fa05[_0x4e3d('0x21')]()[_0x4e3d('0x22')](function(){_0x2db4cd['status'](0xcc)[_0x4e3d('0x23')]();});}};}function handleEntityNotFound(_0x137f87,_0x26615b){return function(_0x259efb){if(!_0x259efb){_0x137f87['sendStatus'](0x194);}return _0x259efb;};}function handleError(_0x33b0b5,_0x872470){_0x872470=_0x872470||0x1f4;return function(_0x24f818){logger[_0x4e3d('0x24')](_0x24f818['stack']);if(_0x24f818['name']){delete _0x24f818[_0x4e3d('0x25')];}_0x33b0b5['status'](_0x872470)['send'](_0x24f818);};}exports[_0x4e3d('0x26')]=function(_0x45c6d2,_0x1ad6c2){var _0x59eb28={},_0x2b9b0f={},_0x55b4a6={'count':0x0,'rows':[]};var _0x265c14=_['map'](db['Dynamics365Field'][_0x4e3d('0x27')],function(_0x3262d9){return{'name':_0x3262d9[_0x4e3d('0x28')],'type':_0x3262d9[_0x4e3d('0x29')][_0x4e3d('0x2a')]};});_0x2b9b0f[_0x4e3d('0x2b')]=_[_0x4e3d('0x2c')](_0x265c14,_0x4e3d('0x25'));_0x2b9b0f[_0x4e3d('0x2d')]=_['keys'](_0x45c6d2[_0x4e3d('0x2d')]);_0x2b9b0f[_0x4e3d('0x2e')]=_[_0x4e3d('0x2f')](_0x2b9b0f['model'],_0x2b9b0f[_0x4e3d('0x2d')]);_0x59eb28[_0x4e3d('0x30')]=_[_0x4e3d('0x2f')](_0x2b9b0f[_0x4e3d('0x2b')],qs[_0x4e3d('0x31')](_0x45c6d2[_0x4e3d('0x2d')][_0x4e3d('0x31')]));_0x59eb28['attributes']=_0x59eb28[_0x4e3d('0x30')]['length']?_0x59eb28['attributes']:_0x2b9b0f[_0x4e3d('0x2b')];if(!_0x45c6d2['query'][_0x4e3d('0x32')](_0x4e3d('0x33'))){_0x59eb28[_0x4e3d('0x1a')]=qs['limit'](_0x45c6d2[_0x4e3d('0x2d')]['limit']);_0x59eb28[_0x4e3d('0x18')]=qs[_0x4e3d('0x18')](_0x45c6d2[_0x4e3d('0x2d')][_0x4e3d('0x18')]);}_0x59eb28[_0x4e3d('0x34')]=qs[_0x4e3d('0x35')](_0x45c6d2[_0x4e3d('0x2d')]['sort']);_0x59eb28[_0x4e3d('0x36')]=qs['filters'](_['pick'](_0x45c6d2[_0x4e3d('0x2d')],_0x2b9b0f[_0x4e3d('0x2e')]),_0x265c14);if(_0x45c6d2[_0x4e3d('0x2d')][_0x4e3d('0x37')]){_0x59eb28[_0x4e3d('0x36')]=_['merge'](_0x59eb28[_0x4e3d('0x36')],{'$or':_[_0x4e3d('0x2c')](_0x265c14,function(_0x14035e){if(_0x14035e[_0x4e3d('0x29')]!==_0x4e3d('0x38')){var _0x50f0dc={};_0x50f0dc[_0x14035e[_0x4e3d('0x25')]]={'$like':'%'+_0x45c6d2[_0x4e3d('0x2d')][_0x4e3d('0x37')]+'%'};return _0x50f0dc;}})});}_0x59eb28=_[_0x4e3d('0x39')]({},_0x59eb28,_0x45c6d2[_0x4e3d('0x3a')]);var _0x1a3920={'where':_0x59eb28[_0x4e3d('0x36')]};return db['Dynamics365Field'][_0x4e3d('0x1b')](_0x1a3920)['then'](function(_0x248831){_0x55b4a6[_0x4e3d('0x1b')]=_0x248831;if(_0x45c6d2[_0x4e3d('0x2d')][_0x4e3d('0x3b')]){_0x59eb28[_0x4e3d('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x59eb28);})[_0x4e3d('0x22')](function(_0x5da854){_0x55b4a6[_0x4e3d('0x3d')]=_0x5da854;return _0x55b4a6;})[_0x4e3d('0x22')](respondWithFilteredResult(_0x1ad6c2,_0x59eb28))[_0x4e3d('0x3e')](handleError(_0x1ad6c2,null));};exports['show']=function(_0x4aab0b,_0x5e98ec){var _0x1cf28a={'raw':!![],'where':{'id':_0x4aab0b[_0x4e3d('0x3f')]['id']}},_0x272614={};_0x272614['model']=_[_0x4e3d('0x40')](db[_0x4e3d('0x41')]['rawAttributes']);_0x272614[_0x4e3d('0x2d')]=_[_0x4e3d('0x40')](_0x4aab0b['query']);_0x272614[_0x4e3d('0x2e')]=_[_0x4e3d('0x2f')](_0x272614[_0x4e3d('0x2b')],_0x272614['query']);_0x1cf28a[_0x4e3d('0x30')]=_[_0x4e3d('0x2f')](_0x272614[_0x4e3d('0x2b')],qs[_0x4e3d('0x31')](_0x4aab0b[_0x4e3d('0x2d')][_0x4e3d('0x31')]));_0x1cf28a[_0x4e3d('0x30')]=_0x1cf28a[_0x4e3d('0x30')]['length']?_0x1cf28a[_0x4e3d('0x30')]:_0x272614[_0x4e3d('0x2b')];if(_0x4aab0b[_0x4e3d('0x2d')]['includeAll']){_0x1cf28a['include']=[{'all':!![]}];}_0x1cf28a=_[_0x4e3d('0x39')]({},_0x1cf28a,_0x4aab0b['options']);return db['Dynamics365Field'][_0x4e3d('0x42')](_0x1cf28a)[_0x4e3d('0x22')](handleEntityNotFound(_0x5e98ec,null))[_0x4e3d('0x22')](respondWithResult(_0x5e98ec,null))[_0x4e3d('0x3e')](handleError(_0x5e98ec,null));};exports[_0x4e3d('0x43')]=function(_0x313960,_0x14cac9){return db['Dynamics365Field'][_0x4e3d('0x43')](_0x313960[_0x4e3d('0x44')],{})[_0x4e3d('0x22')](respondWithResult(_0x14cac9,0xc9))[_0x4e3d('0x3e')](handleError(_0x14cac9,null));};exports[_0x4e3d('0x45')]=function(_0x59be59,_0x346997){if(_0x59be59[_0x4e3d('0x44')]['id']){delete _0x59be59[_0x4e3d('0x44')]['id'];}return db[_0x4e3d('0x41')]['find']({'where':{'id':_0x59be59['params']['id']}})[_0x4e3d('0x22')](handleEntityNotFound(_0x346997,null))[_0x4e3d('0x22')](saveUpdates(_0x59be59[_0x4e3d('0x44')],null))[_0x4e3d('0x22')](respondWithResult(_0x346997,null))[_0x4e3d('0x3e')](handleError(_0x346997,null));};exports[_0x4e3d('0x21')]=function(_0x1c8460,_0x283be4){return db[_0x4e3d('0x41')][_0x4e3d('0x42')]({'where':{'id':_0x1c8460[_0x4e3d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x283be4,null))[_0x4e3d('0x22')](removeEntity(_0x283be4,null))['catch'](handleError(_0x283be4,null));}; \ No newline at end of file +var _0xf714=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','create','body','find','destroy','params','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf714,0x1f4));var _0x4f71=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0xf714[_0x2980de];return _0x81a4ca;};'use strict';var emlformat=require(_0x4f71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f71('0x1'));var rp=require(_0x4f71('0x2'));var moment=require('moment');var BPromise=require(_0x4f71('0x3'));var Mustache=require('mustache');var util=require(_0x4f71('0x4'));var path=require(_0x4f71('0x5'));var sox=require(_0x4f71('0x6'));var csv=require(_0x4f71('0x7'));var ejs=require(_0x4f71('0x8'));var fs=require('fs');var fs_extra=require(_0x4f71('0x9'));var _=require(_0x4f71('0xa'));var squel=require(_0x4f71('0xb'));var crypto=require(_0x4f71('0xc'));var jsforce=require(_0x4f71('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f71('0x7'));var querystring=require(_0x4f71('0xe'));var Papa=require(_0x4f71('0xf'));var Redis=require(_0x4f71('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f71('0x11'));var as=require(_0x4f71('0x12'));var hardwareService=require(_0x4f71('0x13'));var logger=require(_0x4f71('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4f71('0x15'));var licenseUtil=require(_0x4f71('0x16'));var db=require(_0x4f71('0x17'))['db'];function respondWithStatusCode(_0x3cd596,_0x367cc2){_0x367cc2=_0x367cc2||0xcc;return function(_0x360a39){if(_0x360a39){return _0x3cd596['sendStatus'](_0x367cc2);}return _0x3cd596[_0x4f71('0x18')](_0x367cc2)['end']();};}function respondWithResult(_0x3693ba,_0xf2d765){_0xf2d765=_0xf2d765||0xc8;return function(_0x3f4e5f){if(_0x3f4e5f){return _0x3693ba[_0x4f71('0x18')](_0xf2d765)[_0x4f71('0x19')](_0x3f4e5f);}};}function respondWithFilteredResult(_0x5009cc,_0x45042e){return function(_0x1f621b){if(_0x1f621b){var _0x4a492b=typeof _0x45042e[_0x4f71('0x1a')]==='undefined'&&typeof _0x45042e[_0x4f71('0x1b')]===_0x4f71('0x1c');var _0x26b3ed=_0x1f621b[_0x4f71('0x1d')];var _0x56fab2=_0x4a492b?0x0:_0x45042e['offset'];var _0x2b4771=_0x4a492b?_0x1f621b[_0x4f71('0x1d')]:_0x45042e['offset']+_0x45042e[_0x4f71('0x1b')];var _0x248e1e;if(_0x2b4771>=_0x26b3ed){_0x2b4771=_0x26b3ed;_0x248e1e=0xc8;}else{_0x248e1e=0xce;}_0x5009cc['status'](_0x248e1e);return _0x5009cc[_0x4f71('0x1e')](_0x4f71('0x1f'),_0x56fab2+'-'+_0x2b4771+'/'+_0x26b3ed)[_0x4f71('0x19')](_0x1f621b);}return null;};}function patchUpdates(_0x105651){return function(_0x40682a){try{jsonpatch[_0x4f71('0x20')](_0x40682a,_0x105651,!![]);}catch(_0xe04367){return BPromise[_0x4f71('0x21')](_0xe04367);}return _0x40682a[_0x4f71('0x22')]();};}function saveUpdates(_0x1f09b2,_0x9b80aa){return function(_0x2504c9){if(_0x2504c9){return _0x2504c9[_0x4f71('0x23')](_0x1f09b2)['then'](function(_0xa66849){return _0xa66849;});}return null;};}function removeEntity(_0x43d37f,_0x2af998){return function(_0x4a571a){if(_0x4a571a){return _0x4a571a['destroy']()[_0x4f71('0x24')](function(){_0x43d37f[_0x4f71('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dac9,_0x4bad8e){return function(_0x4eb956){if(!_0x4eb956){_0x25dac9['sendStatus'](0x194);}return _0x4eb956;};}function handleError(_0x3511be,_0xb9681e){_0xb9681e=_0xb9681e||0x1f4;return function(_0x5a85da){logger[_0x4f71('0x25')](_0x5a85da[_0x4f71('0x26')]);if(_0x5a85da[_0x4f71('0x27')]){delete _0x5a85da['name'];}_0x3511be[_0x4f71('0x18')](_0xb9681e)[_0x4f71('0x28')](_0x5a85da);};}exports[_0x4f71('0x29')]=function(_0x58a883,_0x34b14a){var _0x24de30={},_0x43d9a2={},_0x1bb612={'count':0x0,'rows':[]};var _0x1ea68b=_[_0x4f71('0x2a')](db[_0x4f71('0x2b')][_0x4f71('0x2c')],function(_0x5ae9d4){return{'name':_0x5ae9d4[_0x4f71('0x2d')],'type':_0x5ae9d4['type'][_0x4f71('0x2e')]};});_0x43d9a2[_0x4f71('0x2f')]=_['map'](_0x1ea68b,_0x4f71('0x27'));_0x43d9a2[_0x4f71('0x30')]=_[_0x4f71('0x31')](_0x58a883[_0x4f71('0x30')]);_0x43d9a2[_0x4f71('0x32')]=_['intersection'](_0x43d9a2[_0x4f71('0x2f')],_0x43d9a2[_0x4f71('0x30')]);_0x24de30[_0x4f71('0x33')]=_[_0x4f71('0x34')](_0x43d9a2[_0x4f71('0x2f')],qs[_0x4f71('0x35')](_0x58a883[_0x4f71('0x30')][_0x4f71('0x35')]));_0x24de30[_0x4f71('0x33')]=_0x24de30[_0x4f71('0x33')][_0x4f71('0x36')]?_0x24de30['attributes']:_0x43d9a2[_0x4f71('0x2f')];if(!_0x58a883['query'][_0x4f71('0x37')]('nolimit')){_0x24de30[_0x4f71('0x1b')]=qs['limit'](_0x58a883[_0x4f71('0x30')]['limit']);_0x24de30['offset']=qs[_0x4f71('0x1a')](_0x58a883['query'][_0x4f71('0x1a')]);}_0x24de30[_0x4f71('0x38')]=qs['sort'](_0x58a883[_0x4f71('0x30')]['sort']);_0x24de30[_0x4f71('0x39')]=qs[_0x4f71('0x32')](_[_0x4f71('0x3a')](_0x58a883[_0x4f71('0x30')],_0x43d9a2['filters']),_0x1ea68b);if(_0x58a883['query'][_0x4f71('0x3b')]){_0x24de30[_0x4f71('0x39')]=_[_0x4f71('0x3c')](_0x24de30[_0x4f71('0x39')],{'$or':_['map'](_0x1ea68b,function(_0x2f2796){if(_0x2f2796['type']!==_0x4f71('0x3d')){var _0x5ae5f9={};_0x5ae5f9[_0x2f2796[_0x4f71('0x27')]]={'$like':'%'+_0x58a883[_0x4f71('0x30')][_0x4f71('0x3b')]+'%'};return _0x5ae5f9;}})});}_0x24de30=_[_0x4f71('0x3c')]({},_0x24de30,_0x58a883['options']);var _0x18975b={'where':_0x24de30[_0x4f71('0x39')]};return db[_0x4f71('0x2b')][_0x4f71('0x1d')](_0x18975b)[_0x4f71('0x24')](function(_0x3789eb){_0x1bb612[_0x4f71('0x1d')]=_0x3789eb;if(_0x58a883[_0x4f71('0x30')][_0x4f71('0x3e')]){_0x24de30['include']=[{'all':!![]}];}return db[_0x4f71('0x2b')][_0x4f71('0x3f')](_0x24de30);})[_0x4f71('0x24')](function(_0x319a1e){_0x1bb612[_0x4f71('0x40')]=_0x319a1e;return _0x1bb612;})[_0x4f71('0x24')](respondWithFilteredResult(_0x34b14a,_0x24de30))[_0x4f71('0x41')](handleError(_0x34b14a,null));};exports[_0x4f71('0x42')]=function(_0x1edb5c,_0x418b09){var _0x2a3eb2={'raw':!![],'where':{'id':_0x1edb5c['params']['id']}},_0x1c95ae={};_0x1c95ae['model']=_[_0x4f71('0x31')](db[_0x4f71('0x2b')][_0x4f71('0x2c')]);_0x1c95ae[_0x4f71('0x30')]=_['keys'](_0x1edb5c[_0x4f71('0x30')]);_0x1c95ae['filters']=_[_0x4f71('0x34')](_0x1c95ae[_0x4f71('0x2f')],_0x1c95ae[_0x4f71('0x30')]);_0x2a3eb2[_0x4f71('0x33')]=_[_0x4f71('0x34')](_0x1c95ae[_0x4f71('0x2f')],qs[_0x4f71('0x35')](_0x1edb5c[_0x4f71('0x30')][_0x4f71('0x35')]));_0x2a3eb2[_0x4f71('0x33')]=_0x2a3eb2[_0x4f71('0x33')][_0x4f71('0x36')]?_0x2a3eb2[_0x4f71('0x33')]:_0x1c95ae[_0x4f71('0x2f')];if(_0x1edb5c[_0x4f71('0x30')][_0x4f71('0x3e')]){_0x2a3eb2[_0x4f71('0x43')]=[{'all':!![]}];}_0x2a3eb2=_[_0x4f71('0x3c')]({},_0x2a3eb2,_0x1edb5c[_0x4f71('0x44')]);return db[_0x4f71('0x2b')]['find'](_0x2a3eb2)[_0x4f71('0x24')](handleEntityNotFound(_0x418b09,null))[_0x4f71('0x24')](respondWithResult(_0x418b09,null))[_0x4f71('0x41')](handleError(_0x418b09,null));};exports['create']=function(_0x167570,_0x4e3760){return db[_0x4f71('0x2b')][_0x4f71('0x45')](_0x167570[_0x4f71('0x46')],{})[_0x4f71('0x24')](respondWithResult(_0x4e3760,0xc9))[_0x4f71('0x41')](handleError(_0x4e3760,null));};exports['update']=function(_0x49a2ee,_0x22f800){if(_0x49a2ee[_0x4f71('0x46')]['id']){delete _0x49a2ee[_0x4f71('0x46')]['id'];}return db[_0x4f71('0x2b')][_0x4f71('0x47')]({'where':{'id':_0x49a2ee['params']['id']}})[_0x4f71('0x24')](handleEntityNotFound(_0x22f800,null))[_0x4f71('0x24')](saveUpdates(_0x49a2ee['body'],null))[_0x4f71('0x24')](respondWithResult(_0x22f800,null))[_0x4f71('0x41')](handleError(_0x22f800,null));};exports[_0x4f71('0x48')]=function(_0x121b79,_0x2efdae){return db['Dynamics365Field'][_0x4f71('0x47')]({'where':{'id':_0x121b79[_0x4f71('0x49')]['id']}})[_0x4f71('0x24')](handleEntityNotFound(_0x2efdae,null))[_0x4f71('0x24')](removeEntity(_0x2efdae,null))[_0x4f71('0x41')](handleError(_0x2efdae,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e8289d6..fe3592a 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 _0x7cb0=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x46588f,_0x2aa977){var _0xa10917=function(_0x2616bf){while(--_0x2616bf){_0x46588f['push'](_0x46588f['shift']());}};_0xa10917(++_0x2aa977);}(_0x7cb0,0x17c));var _0x07cb=function(_0x15165e,_0x47648c){_0x15165e=_0x15165e-0x0;var _0x3383e3=_0x7cb0[_0x15165e];return _0x3383e3;};'use strict';var _=require('lodash');var util=require(_0x07cb('0x0'));var logger=require(_0x07cb('0x1'))(_0x07cb('0x2'));var moment=require(_0x07cb('0x3'));var BPromise=require(_0x07cb('0x4'));var rp=require(_0x07cb('0x5'));var fs=require('fs');var path=require(_0x07cb('0x6'));var rimraf=require(_0x07cb('0x7'));var config=require(_0x07cb('0x8'));var attributes=require(_0x07cb('0x9'));module['exports']=function(_0x5da6e9,_0xa6b9c2){return _0x5da6e9['define'](_0x07cb('0xa'),attributes,{'tableName':_0x07cb('0xb'),'paranoid':![],'indexes':[{'name':_0x07cb('0xc'),'fields':[_0x07cb('0xd'),_0x07cb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x607b=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','../../config/logger','api','bluebird'];(function(_0x113273,_0x24a297){var _0x5d4d87=function(_0x153b17){while(--_0x153b17){_0x113273['push'](_0x113273['shift']());}};_0x5d4d87(++_0x24a297);}(_0x607b,0x1f4));var _0xb607=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x607b[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xb607('0x0'));var util=require('util');var logger=require(_0xb607('0x1'))(_0xb607('0x2'));var moment=require('moment');var BPromise=require(_0xb607('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb607('0x4'));var config=require(_0xb607('0x5'));var attributes=require(_0xb607('0x6'));module[_0xb607('0x7')]=function(_0x42505a,_0x1c104e){return _0x42505a[_0xb607('0x8')](_0xb607('0x9'),attributes,{'tableName':_0xb607('0xa'),'paranoid':![],'indexes':[{'name':_0xb607('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 66091a7..0b85436 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 _0xcac0=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x218a78,_0x173e9d){var _0x4f4deb=function(_0x34ce17){while(--_0x34ce17){_0x218a78['push'](_0x218a78['shift']());}};_0x4f4deb(++_0x173e9d);}(_0xcac0,0x1cf));var _0x0cac=function(_0x365b0e,_0x3122d3){_0x365b0e=_0x365b0e-0x0;var _0x5ca753=_0xcac0[_0x365b0e];return _0x5ca753;};'use strict';var _=require(_0x0cac('0x0'));var util=require(_0x0cac('0x1'));var moment=require(_0x0cac('0x2'));var BPromise=require(_0x0cac('0x3'));var rs=require(_0x0cac('0x4'));var fs=require('fs');var Redis=require(_0x0cac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0cac('0x6'));var logger=require('../../config/logger')(_0x0cac('0x7'));var config=require(_0x0cac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0cac('0x9')][_0x0cac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19642a,_0x3af094,_0x2d1a09){return new BPromise(function(_0x32f743,_0x4a57ea){return client['request'](_0x19642a,_0x2d1a09)[_0x0cac('0xb')](function(_0x497bf4){logger['info'](_0x0cac('0xc'),_0x3af094,_0x0cac('0xd'));logger[_0x0cac('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3af094,_0x0cac('0xd'),JSON[_0x0cac('0xf')](_0x497bf4));if(_0x497bf4['error']){if(_0x497bf4[_0x0cac('0x10')][_0x0cac('0x11')]===0x1f4){logger[_0x0cac('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3af094,_0x497bf4['error']['message']);return _0x4a57ea(_0x497bf4[_0x0cac('0x10')][_0x0cac('0x12')]);}logger[_0x0cac('0x10')](_0x0cac('0xc'),_0x3af094,_0x497bf4[_0x0cac('0x10')][_0x0cac('0x12')]);return _0x32f743(_0x497bf4[_0x0cac('0x10')][_0x0cac('0x12')]);}else{logger[_0x0cac('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x3af094,_0x0cac('0xd'));_0x32f743(_0x497bf4['result'][_0x0cac('0x12')]);}})[_0x0cac('0x14')](function(_0x3e3bd7){logger[_0x0cac('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3af094,_0x3e3bd7);_0x4a57ea(_0x3e3bd7);});});} \ No newline at end of file +var _0xb1aa=['../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x279262,_0xa15cd5){var _0x2e41bb=function(_0x317132){while(--_0x317132){_0x279262['push'](_0x279262['shift']());}};_0x2e41bb(++_0xa15cd5);}(_0xb1aa,0xcc));var _0xab1a=function(_0x5ee236,_0x3ed8e4){_0x5ee236=_0x5ee236-0x0;var _0x1563b6=_0xb1aa[_0x5ee236];return _0x1563b6;};'use strict';var _=require(_0xab1a('0x0'));var util=require('util');var moment=require(_0xab1a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab1a('0x2'))['db'];var utils=require(_0xab1a('0x3'));var logger=require(_0xab1a('0x4'))(_0xab1a('0x5'));var config=require(_0xab1a('0x6'));var jayson=require(_0xab1a('0x7'));var client=jayson[_0xab1a('0x8')][_0xab1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555cf7,_0x5bb063,_0x4babdc){return new BPromise(function(_0x5eaf96,_0x34ae4b){return client[_0xab1a('0xa')](_0x555cf7,_0x4babdc)[_0xab1a('0xb')](function(_0x5df8ce){logger['info'](_0xab1a('0xc'),_0x5bb063,_0xab1a('0xd'));logger[_0xab1a('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5bb063,_0xab1a('0xd'),JSON['stringify'](_0x5df8ce));if(_0x5df8ce[_0xab1a('0xf')]){if(_0x5df8ce[_0xab1a('0xf')][_0xab1a('0x10')]===0x1f4){logger[_0xab1a('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x5bb063,_0x5df8ce['error'][_0xab1a('0x11')]);return _0x34ae4b(_0x5df8ce[_0xab1a('0xf')][_0xab1a('0x11')]);}logger['error'](_0xab1a('0xc'),_0x5bb063,_0x5df8ce['error'][_0xab1a('0x11')]);return _0x5eaf96(_0x5df8ce[_0xab1a('0xf')][_0xab1a('0x11')]);}else{logger[_0xab1a('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5bb063,_0xab1a('0xd'));_0x5eaf96(_0x5df8ce[_0xab1a('0x13')]['message']);}})[_0xab1a('0x14')](function(_0xac0e96){logger[_0xab1a('0xf')](_0xab1a('0xc'),_0x5bb063,_0xac0e96);_0x34ae4b(_0xac0e96);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index fd72b13..fac1047 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 _0xba29=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x4e9ea6,_0x346aee){var _0x94d7b=function(_0x4dc010){while(--_0x4dc010){_0x4e9ea6['push'](_0x4e9ea6['shift']());}};_0x94d7b(++_0x346aee);}(_0xba29,0x6e));var _0x9ba2=function(_0x214d89,_0x4b0bee){_0x214d89=_0x214d89-0x0;var _0x2577ee=_0xba29[_0x214d89];return _0x2577ee;};'use strict';var multer=require(_0x9ba2('0x0'));var util=require('util');var path=require(_0x9ba2('0x1'));var timeout=require(_0x9ba2('0x2'));var express=require(_0x9ba2('0x3'));var router=express[_0x9ba2('0x4')]();var fs_extra=require(_0x9ba2('0x5'));var auth=require(_0x9ba2('0x6'));var interaction=require(_0x9ba2('0x7'));var config=require(_0x9ba2('0x8'));var controller=require(_0x9ba2('0x9'));router['get']('/',auth[_0x9ba2('0xa')](),controller[_0x9ba2('0xb')]);router[_0x9ba2('0xc')]('/:id',auth[_0x9ba2('0xa')](),controller[_0x9ba2('0xd')]);router['get'](_0x9ba2('0xe'),auth['isAuthenticated'](),controller[_0x9ba2('0xf')]);router[_0x9ba2('0xc')](_0x9ba2('0x10'),auth[_0x9ba2('0xa')](),controller['getFields']);router[_0x9ba2('0x11')]('/',auth[_0x9ba2('0xa')](),controller['create']);router[_0x9ba2('0x11')](_0x9ba2('0xe'),auth['isAuthenticated'](),controller[_0x9ba2('0x12')]);router['put'](_0x9ba2('0x13'),auth[_0x9ba2('0xa')](),controller['update']);router[_0x9ba2('0x14')](_0x9ba2('0x13'),auth[_0x9ba2('0xa')](),controller[_0x9ba2('0x15')]);module[_0x9ba2('0x16')]=router; \ No newline at end of file +var _0xc92b=['isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x2d18c1,_0x441187){var _0x5db21b=function(_0x5d00fa){while(--_0x5d00fa){_0x2d18c1['push'](_0x2d18c1['shift']());}};_0x5db21b(++_0x441187);}(_0xc92b,0xed));var _0xbc92=function(_0x7539e8,_0x2feed0){_0x7539e8=_0x7539e8-0x0;var _0x10223d=_0xc92b[_0x7539e8];return _0x10223d;};'use strict';var multer=require(_0xbc92('0x0'));var util=require(_0xbc92('0x1'));var path=require(_0xbc92('0x2'));var timeout=require(_0xbc92('0x3'));var express=require('express');var router=express[_0xbc92('0x4')]();var fs_extra=require(_0xbc92('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbc92('0x6'));var config=require(_0xbc92('0x7'));var controller=require(_0xbc92('0x8'));router[_0xbc92('0x9')]('/',auth[_0xbc92('0xa')](),controller['index']);router[_0xbc92('0x9')](_0xbc92('0xb'),auth[_0xbc92('0xa')](),controller[_0xbc92('0xc')]);router[_0xbc92('0x9')]('/:id/configurations',auth[_0xbc92('0xa')](),controller[_0xbc92('0xd')]);router[_0xbc92('0x9')](_0xbc92('0xe'),auth['isAuthenticated'](),controller[_0xbc92('0xf')]);router['post']('/',auth[_0xbc92('0xa')](),controller[_0xbc92('0x10')]);router[_0xbc92('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xbc92('0xb'),auth[_0xbc92('0xa')](),controller['update']);router['delete'](_0xbc92('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc92('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3dfbf8d..b6cf674 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 _0x056b=['username','remoteUri','exports','STRING'];(function(_0x10909e,_0x21281e){var _0x4e0a8a=function(_0x550cf4){while(--_0x550cf4){_0x10909e['push'](_0x10909e['shift']());}};_0x4e0a8a(++_0x21281e);}(_0x056b,0xb6));var _0xb056=function(_0x11cfca,_0x4f3bc6){_0x11cfca=_0x11cfca-0x0;var _0x2c8cd6=_0x056b[_0x11cfca];return _0x2c8cd6;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x68b3=['sequelize','exports','STRING','remoteUri'];(function(_0x542ce8,_0x475277){var _0x2409eb=function(_0x1c1e37){while(--_0x1c1e37){_0x542ce8['push'](_0x542ce8['shift']());}};_0x2409eb(++_0x475277);}(_0x68b3,0x1d8));var _0x368b=function(_0x287f51,_0x1295aa){_0x287f51=_0x287f51-0x0;var _0x5e04c4=_0x68b3[_0x287f51];return _0x5e04c4;};'use strict';var Sequelize=require(_0x368b('0x0'));module[_0x368b('0x1')]={'name':{'type':Sequelize[_0x368b('0x2')]},'description':{'type':Sequelize[_0x368b('0x2')]},'username':{'type':Sequelize[_0x368b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x368b('0x2')]},'remoteUri':{'type':Sequelize[_0x368b('0x2')],'unique':_0x368b('0x3')},'serverUrl':{'type':Sequelize[_0x368b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d0d73e9..44572f4 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 _0xfbe2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','Subjects','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','agent','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xfbe2,0x1da));var _0x2fbe=function(_0x1032bd,_0x263dcc){_0x1032bd=_0x1032bd-0x0;var _0x85db08=_0xfbe2[_0x1032bd];return _0x85db08;};'use strict';var emlformat=require(_0x2fbe('0x0'));var rimraf=require(_0x2fbe('0x1'));var zipdir=require(_0x2fbe('0x2'));var jsonpatch=require(_0x2fbe('0x3'));var rp=require('request-promise');var moment=require(_0x2fbe('0x4'));var BPromise=require(_0x2fbe('0x5'));var Mustache=require(_0x2fbe('0x6'));var util=require('util');var path=require(_0x2fbe('0x7'));var sox=require(_0x2fbe('0x8'));var csv=require(_0x2fbe('0x9'));var ejs=require(_0x2fbe('0xa'));var fs=require('fs');var fs_extra=require(_0x2fbe('0xb'));var _=require(_0x2fbe('0xc'));var squel=require(_0x2fbe('0xd'));var crypto=require(_0x2fbe('0xe'));var jsforce=require(_0x2fbe('0xf'));var deskjs=require(_0x2fbe('0x10'));var toCsv=require(_0x2fbe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fbe('0x11'));var authService=require(_0x2fbe('0x12'));var qs=require(_0x2fbe('0x13'));var as=require(_0x2fbe('0x14'));var hardwareService=require(_0x2fbe('0x15'));var logger=require(_0x2fbe('0x16'))(_0x2fbe('0x17'));var utils=require(_0x2fbe('0x18'));var config=require(_0x2fbe('0x19'));var licenseUtil=require(_0x2fbe('0x1a'));var db=require(_0x2fbe('0x1b'))['db'];var integrations=require(_0x2fbe('0x1c'));function respondWithStatusCode(_0x421387,_0x12be84){_0x12be84=_0x12be84||0xcc;return function(_0x511986){if(_0x511986){return _0x421387[_0x2fbe('0x1d')](_0x12be84);}return _0x421387[_0x2fbe('0x1e')](_0x12be84)[_0x2fbe('0x1f')]();};}function respondWithResult(_0x2dcfbb,_0x19777a){_0x19777a=_0x19777a||0xc8;return function(_0x1cff2a){if(_0x1cff2a){return _0x2dcfbb['status'](_0x19777a)[_0x2fbe('0x20')](_0x1cff2a);}};}function respondWithFilteredResult(_0x312970,_0x556a98){return function(_0x19d8fd){if(_0x19d8fd){var _0x56aa7d=typeof _0x556a98['offset']===_0x2fbe('0x21')&&typeof _0x556a98[_0x2fbe('0x22')]===_0x2fbe('0x21');var _0x7a2f2b=_0x19d8fd[_0x2fbe('0x23')];var _0x1dc730=_0x56aa7d?0x0:_0x556a98[_0x2fbe('0x24')];var _0x3fefe7=_0x56aa7d?_0x19d8fd[_0x2fbe('0x23')]:_0x556a98[_0x2fbe('0x24')]+_0x556a98[_0x2fbe('0x22')];var _0x4eed5a;if(_0x3fefe7>=_0x7a2f2b){_0x3fefe7=_0x7a2f2b;_0x4eed5a=0xc8;}else{_0x4eed5a=0xce;}_0x312970[_0x2fbe('0x1e')](_0x4eed5a);return _0x312970[_0x2fbe('0x25')](_0x2fbe('0x26'),_0x1dc730+'-'+_0x3fefe7+'/'+_0x7a2f2b)['json'](_0x19d8fd);}return null;};}function patchUpdates(_0x4c8f8f){return function(_0x451f1a){try{jsonpatch[_0x2fbe('0x27')](_0x451f1a,_0x4c8f8f,!![]);}catch(_0x2efbb3){return BPromise['reject'](_0x2efbb3);}return _0x451f1a[_0x2fbe('0x28')]();};}function saveUpdates(_0x1e3462,_0x30e978){return function(_0x489b46){if(_0x489b46){return _0x489b46[_0x2fbe('0x29')](_0x1e3462)[_0x2fbe('0x2a')](function(_0x5c1315){return _0x5c1315;});}return null;};}function removeEntity(_0x41f262,_0x5ba00e){return function(_0x14755c){if(_0x14755c){return _0x14755c[_0x2fbe('0x2b')]()[_0x2fbe('0x2a')](function(){_0x41f262[_0x2fbe('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4255,_0x81e1fc){return function(_0x4590a2){if(!_0x4590a2){_0x5e4255[_0x2fbe('0x1d')](0x194);}return _0x4590a2;};}function handleError(_0x477e8c,_0x2a6bc8){_0x2a6bc8=_0x2a6bc8||0x1f4;return function(_0x5b52c0){logger['error'](_0x5b52c0[_0x2fbe('0x2c')]);if(_0x5b52c0[_0x2fbe('0x2d')]){delete _0x5b52c0[_0x2fbe('0x2d')];}_0x477e8c[_0x2fbe('0x1e')](_0x2a6bc8)['send'](_0x5b52c0);};}exports[_0x2fbe('0x2e')]=function(_0x5bf90c,_0x1fdf03){var _0x467760={},_0x37732d={},_0x1c9735={'count':0x0,'rows':[]};var _0x1d9376=_[_0x2fbe('0x2f')](db[_0x2fbe('0x30')][_0x2fbe('0x31')],function(_0xccf503){return{'name':_0xccf503[_0x2fbe('0x32')],'type':_0xccf503[_0x2fbe('0x33')][_0x2fbe('0x34')]};});_0x37732d['model']=_[_0x2fbe('0x2f')](_0x1d9376,_0x2fbe('0x2d'));_0x37732d[_0x2fbe('0x35')]=_['keys'](_0x5bf90c['query']);_0x37732d[_0x2fbe('0x36')]=_['intersection'](_0x37732d[_0x2fbe('0x37')],_0x37732d[_0x2fbe('0x35')]);_0x467760[_0x2fbe('0x38')]=_[_0x2fbe('0x39')](_0x37732d[_0x2fbe('0x37')],qs['fields'](_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x3a')]));_0x467760['attributes']=_0x467760['attributes']['length']?_0x467760[_0x2fbe('0x38')]:_0x37732d[_0x2fbe('0x37')];if(!_0x5bf90c['query']['hasOwnProperty']('nolimit')){_0x467760['limit']=qs[_0x2fbe('0x22')](_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x22')]);_0x467760[_0x2fbe('0x24')]=qs[_0x2fbe('0x24')](_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x24')]);}_0x467760[_0x2fbe('0x3b')]=qs[_0x2fbe('0x3c')](_0x5bf90c['query'][_0x2fbe('0x3c')]);_0x467760[_0x2fbe('0x3d')]=qs[_0x2fbe('0x36')](_[_0x2fbe('0x3e')](_0x5bf90c[_0x2fbe('0x35')],_0x37732d[_0x2fbe('0x36')]),_0x1d9376);if(_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x3f')]){_0x467760['where']=_[_0x2fbe('0x40')](_0x467760['where'],{'$or':_[_0x2fbe('0x2f')](_0x1d9376,function(_0x11bf78){if(_0x11bf78[_0x2fbe('0x33')]!==_0x2fbe('0x41')){var _0x5df9a2={};_0x5df9a2[_0x11bf78['name']]={'$like':'%'+_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x3f')]+'%'};return _0x5df9a2;}})});}_0x467760=_[_0x2fbe('0x40')]({},_0x467760,_0x5bf90c[_0x2fbe('0x42')]);var _0x34bd86={'where':_0x467760[_0x2fbe('0x3d')]};return db[_0x2fbe('0x30')][_0x2fbe('0x23')](_0x34bd86)[_0x2fbe('0x2a')](function(_0x577b3f){_0x1c9735[_0x2fbe('0x23')]=_0x577b3f;if(_0x5bf90c[_0x2fbe('0x35')][_0x2fbe('0x43')]){_0x467760[_0x2fbe('0x44')]=[{'all':!![]}];}return db[_0x2fbe('0x30')][_0x2fbe('0x45')](_0x467760);})[_0x2fbe('0x2a')](function(_0x1b0bf0){_0x1c9735[_0x2fbe('0x46')]=_0x1b0bf0;return _0x1c9735;})[_0x2fbe('0x2a')](respondWithFilteredResult(_0x1fdf03,_0x467760))['catch'](handleError(_0x1fdf03,null));};exports[_0x2fbe('0x47')]=function(_0x3b4ffd,_0x1e4edd){var _0x414c0c={'raw':![],'where':{'id':_0x3b4ffd[_0x2fbe('0x48')]['id']}},_0x5b6f4a={};_0x5b6f4a[_0x2fbe('0x37')]=_[_0x2fbe('0x49')](db[_0x2fbe('0x30')][_0x2fbe('0x31')]);_0x5b6f4a['query']=_[_0x2fbe('0x49')](_0x3b4ffd[_0x2fbe('0x35')]);_0x5b6f4a[_0x2fbe('0x36')]=_[_0x2fbe('0x39')](_0x5b6f4a[_0x2fbe('0x37')],_0x5b6f4a[_0x2fbe('0x35')]);_0x414c0c[_0x2fbe('0x38')]=_[_0x2fbe('0x39')](_0x5b6f4a[_0x2fbe('0x37')],qs[_0x2fbe('0x3a')](_0x3b4ffd['query']['fields']));_0x414c0c['attributes']=_0x414c0c[_0x2fbe('0x38')][_0x2fbe('0x4a')]?_0x414c0c[_0x2fbe('0x38')]:_0x5b6f4a['model'];if(_0x3b4ffd['query']['includeAll']){_0x414c0c[_0x2fbe('0x44')]=[{'all':!![]}];}_0x414c0c=_[_0x2fbe('0x40')]({},_0x414c0c,_0x3b4ffd[_0x2fbe('0x42')]);return db[_0x2fbe('0x30')][_0x2fbe('0x4b')](_0x414c0c)[_0x2fbe('0x2a')](handleEntityNotFound(_0x1e4edd,null))[_0x2fbe('0x2a')](respondWithResult(_0x1e4edd,null))[_0x2fbe('0x4c')](handleError(_0x1e4edd,null));};exports['create']=function(_0x4597b0,_0xa6dceb){return db[_0x2fbe('0x30')][_0x2fbe('0x4d')](_0x4597b0['body'],{})[_0x2fbe('0x2a')](respondWithResult(_0xa6dceb,0xc9))[_0x2fbe('0x4c')](handleError(_0xa6dceb,null));};exports['update']=function(_0x4a213c,_0x2a3187){if(_0x4a213c['body']['id']){delete _0x4a213c[_0x2fbe('0x4e')]['id'];}return db[_0x2fbe('0x30')]['find']({'where':{'id':_0x4a213c['params']['id']}})[_0x2fbe('0x2a')](handleEntityNotFound(_0x2a3187,null))[_0x2fbe('0x2a')](saveUpdates(_0x4a213c[_0x2fbe('0x4e')],null))['then'](respondWithResult(_0x2a3187,null))['catch'](handleError(_0x2a3187,null));};exports[_0x2fbe('0x2b')]=function(_0x271a7f,_0x1dc755){return db[_0x2fbe('0x30')]['find']({'where':{'id':_0x271a7f[_0x2fbe('0x48')]['id']}})[_0x2fbe('0x2a')](handleEntityNotFound(_0x1dc755,null))['then'](removeEntity(_0x1dc755,null))[_0x2fbe('0x4c')](handleError(_0x1dc755,null));};exports[_0x2fbe('0x4f')]=function(_0x3f3151,_0x558ead,_0x3308f1){var _0x4fd22b={};var _0x4735a1={};var _0x17ce09;var _0x2bdfb0;return db[_0x2fbe('0x30')][_0x2fbe('0x50')]({'where':{'id':_0x3f3151[_0x2fbe('0x48')]['id']}})['then'](handleEntityNotFound(_0x558ead,null))[_0x2fbe('0x2a')](function(_0x5d5a5f){if(_0x5d5a5f){_0x17ce09=_0x5d5a5f;_0x4735a1[_0x2fbe('0x37')]=_[_0x2fbe('0x49')](db['FreshdeskConfiguration'][_0x2fbe('0x31')]);_0x4735a1[_0x2fbe('0x35')]=_['keys'](_0x3f3151['query']);_0x4735a1[_0x2fbe('0x36')]=_[_0x2fbe('0x39')](_0x4735a1[_0x2fbe('0x37')],_0x4735a1[_0x2fbe('0x35')]);_0x4fd22b[_0x2fbe('0x38')]=_[_0x2fbe('0x39')](_0x4735a1['model'],qs['fields'](_0x3f3151['query'][_0x2fbe('0x3a')]));_0x4fd22b[_0x2fbe('0x38')]=_0x4fd22b[_0x2fbe('0x38')][_0x2fbe('0x4a')]?_0x4fd22b[_0x2fbe('0x38')]:_0x4735a1[_0x2fbe('0x37')];_0x4fd22b[_0x2fbe('0x3b')]=qs[_0x2fbe('0x3c')](_0x3f3151[_0x2fbe('0x35')]['sort']);_0x4fd22b[_0x2fbe('0x3d')]=qs[_0x2fbe('0x36')](_[_0x2fbe('0x3e')](_0x3f3151[_0x2fbe('0x35')],_0x4735a1[_0x2fbe('0x36')]));if(_0x3f3151['query'][_0x2fbe('0x3f')]){_0x4fd22b['where']=_['merge'](_0x4fd22b[_0x2fbe('0x3d')],{'$or':_[_0x2fbe('0x2f')](_0x4fd22b[_0x2fbe('0x38')],function(_0x8a7a22){var _0x2df572={};_0x2df572[_0x8a7a22]={'$like':'%'+_0x3f3151[_0x2fbe('0x35')][_0x2fbe('0x3f')]+'%'};return _0x2df572;})});}_0x4fd22b=_[_0x2fbe('0x40')]({},_0x4fd22b,_0x3f3151[_0x2fbe('0x42')]);return _0x17ce09[_0x2fbe('0x4f')](_0x4fd22b);}})[_0x2fbe('0x2a')](function(_0x247c68){if(_0x247c68){_0x2bdfb0=_0x247c68[_0x2fbe('0x4a')];if(!_0x3f3151[_0x2fbe('0x35')][_0x2fbe('0x51')]('nolimit')){_0x4fd22b['limit']=qs[_0x2fbe('0x22')](_0x3f3151['query'][_0x2fbe('0x22')]);_0x4fd22b[_0x2fbe('0x24')]=qs['offset'](_0x3f3151[_0x2fbe('0x35')]['offset']);}return _0x17ce09[_0x2fbe('0x4f')](_0x4fd22b);}})[_0x2fbe('0x2a')](function(_0x415e76){if(_0x415e76){return _0x415e76?{'count':_0x2bdfb0,'rows':_0x415e76}:null;}})[_0x2fbe('0x2a')](respondWithResult(_0x558ead,null))[_0x2fbe('0x4c')](handleError(_0x558ead,null));};exports[_0x2fbe('0x52')]=function(_0x4b12be,_0x559682,_0x23d8c7){if(_0x4b12be[_0x2fbe('0x4e')]['id']){delete _0x4b12be[_0x2fbe('0x4e')]['id'];}return db[_0x2fbe('0x30')][_0x2fbe('0x50')]({'where':{'id':_0x4b12be[_0x2fbe('0x48')]['id']}})['then'](handleEntityNotFound(_0x559682,null))[_0x2fbe('0x2a')](function(_0x451626){if(_0x451626){_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x53')]=_0x451626['id'];_0x4b12be['body']['Subjects']=integrations[_0x2fbe('0x54')](_0x4b12be['body']['channel'],_0x4b12be[_0x2fbe('0x4e')]['type']);_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x55')]=integrations['getDescriptions'](_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x56')],_0x4b12be[_0x2fbe('0x4e')][_0x2fbe('0x33')]);return db[_0x2fbe('0x57')][_0x2fbe('0x4d')](_0x4b12be[_0x2fbe('0x4e')],{'include':[{'model':db[_0x2fbe('0x58')],'as':_0x2fbe('0x59')},{'model':db[_0x2fbe('0x58')],'as':_0x2fbe('0x55')}]});}return null;})[_0x2fbe('0x2a')](respondWithResult(_0x559682,null))['catch'](handleError(_0x559682,null));};exports['getFields']=function(_0x48f2cc,_0x241796,_0x30c763){var _0x33cfe1='';return db['FreshdeskAccount'][_0x2fbe('0x50')]({'where':{'id':_0x48f2cc[_0x2fbe('0x48')]['id']},'attributes':['id',_0x2fbe('0x5a'),'apiKey']})[_0x2fbe('0x2a')](handleEntityNotFound(_0x241796,null))[_0x2fbe('0x2a')](function(_0x37b02f){if(_0x37b02f){_0x33cfe1=_0x37b02f[_0x2fbe('0x5a')];var _0x3c5a8b=_0x33cfe1[_0x2fbe('0x5b')](-0x1);if(_0x3c5a8b==='/'){_0x33cfe1=_0x33cfe1[_0x2fbe('0x5c')](0x0,_0x33cfe1[_0x2fbe('0x5d')](_0x3c5a8b));}return rp({'method':_0x2fbe('0x5e'),'uri':util[_0x2fbe('0x5f')](_0x2fbe('0x60'),_0x33cfe1,_0x2fbe('0x61')),'headers':{'Authorization':util[_0x2fbe('0x5f')](_0x2fbe('0x62'),new Buffer(util[_0x2fbe('0x5f')](_0x2fbe('0x63'),_0x37b02f['apiKey']))['toString']('base64'))},'json':!![]});}})['then'](function(_0x24d7ae){if(_0x24d7ae){var _0x2fbc02=[_0x2fbe('0x64'),_0x2fbe('0x65'),_0x2fbe('0x66'),'description',_0x2fbe('0x1e'),_0x2fbe('0x67'),_0x2fbe('0x68'),_0x2fbe('0x69'),_0x2fbe('0x6a'),_0x2fbe('0x68'),_0x2fbe('0x6b')];_['remove'](_0x24d7ae,function(_0x27634b){return _0x2fbc02[_0x2fbe('0x6c')](_0x27634b['name'])||!_0x27634b[_0x2fbe('0x6d')]&&_0x27634b['type']!==_0x2fbe('0x6e')&&_0x27634b[_0x2fbe('0x33')]!==_0x2fbe('0x6f');});return{'count':_0x24d7ae[_0x2fbe('0x4a')],'rows':_[_0x2fbe('0x2f')](_0x24d7ae,function(_0x3c72f2){return{'id':_0x3c72f2['name'],'name':_0x3c72f2[_0x2fbe('0x70')],'custom':!_0x3c72f2[_0x2fbe('0x6d')],'options':_0x3c72f2[_0x2fbe('0x71')]?_['map'](_0x3c72f2[_0x2fbe('0x71')],function(_0x2be9c4){return{'name':_[_0x2fbe('0x72')](_0x2be9c4),'value':_0x2be9c4};}):[]};})};}})[_0x2fbe('0x2a')](respondWithResult(_0x241796,null))[_0x2fbe('0x4c')](function(_0x4323f6){var _0x1ceddb=_0x48f2cc[_0x2fbe('0x35')]['test']?0x1f4:_0x4323f6[_0x2fbe('0x73')]||0x1f4;logger[_0x2fbe('0x74')](_0x2fbe('0x75'),_0x2fbe('0x76'),_0x1ceddb,JSON[_0x2fbe('0x77')](_0x4323f6));delete _0x4323f6[_0x2fbe('0x2d')];if(_0x1ceddb===0x191){_0x1ceddb=0x190;}_0x241796['status'](_0x1ceddb)[_0x2fbe('0x78')](_0x48f2cc[_0x2fbe('0x35')][_0x2fbe('0x79')]?{'message':_0x2fbe('0x7a'),'statusCode':_0x4323f6['statusCode']}:_0x4323f6);});}; \ No newline at end of file +var _0x590a=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','index','FreshdeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_dropdown','map','default','capitalize','test'];(function(_0x26fca8,_0x45356c){var _0x1e43df=function(_0x2fb827){while(--_0x2fb827){_0x26fca8['push'](_0x26fca8['shift']());}};_0x1e43df(++_0x45356c);}(_0x590a,0x159));var _0xa590=function(_0x56a1cb,_0x144273){_0x56a1cb=_0x56a1cb-0x0;var _0x690753=_0x590a[_0x56a1cb];return _0x690753;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa590('0x0'));var zipdir=require(_0xa590('0x1'));var jsonpatch=require(_0xa590('0x2'));var rp=require(_0xa590('0x3'));var moment=require(_0xa590('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa590('0x5'));var path=require(_0xa590('0x6'));var sox=require(_0xa590('0x7'));var csv=require('to-csv');var ejs=require(_0xa590('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa590('0x9'));var squel=require(_0xa590('0xa'));var crypto=require(_0xa590('0xb'));var jsforce=require(_0xa590('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa590('0xd'));var Papa=require('papaparse');var Redis=require(_0xa590('0xe'));var authService=require(_0xa590('0xf'));var qs=require(_0xa590('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa590('0x11'));var logger=require(_0xa590('0x12'))(_0xa590('0x13'));var utils=require(_0xa590('0x14'));var config=require(_0xa590('0x15'));var licenseUtil=require(_0xa590('0x16'));var db=require(_0xa590('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5bc467,_0x252e2b){_0x252e2b=_0x252e2b||0xcc;return function(_0xb67661){if(_0xb67661){return _0x5bc467[_0xa590('0x18')](_0x252e2b);}return _0x5bc467[_0xa590('0x19')](_0x252e2b)['end']();};}function respondWithResult(_0xdf68af,_0x3c1fee){_0x3c1fee=_0x3c1fee||0xc8;return function(_0x5d914f){if(_0x5d914f){return _0xdf68af['status'](_0x3c1fee)[_0xa590('0x1a')](_0x5d914f);}};}function respondWithFilteredResult(_0x5ec6e2,_0x165b81){return function(_0x6ca5c8){if(_0x6ca5c8){var _0x1d218c=typeof _0x165b81[_0xa590('0x1b')]===_0xa590('0x1c')&&typeof _0x165b81[_0xa590('0x1d')]===_0xa590('0x1c');var _0x458a80=_0x6ca5c8[_0xa590('0x1e')];var _0xc1f37a=_0x1d218c?0x0:_0x165b81[_0xa590('0x1b')];var _0x360a1e=_0x1d218c?_0x6ca5c8[_0xa590('0x1e')]:_0x165b81[_0xa590('0x1b')]+_0x165b81[_0xa590('0x1d')];var _0x219d01;if(_0x360a1e>=_0x458a80){_0x360a1e=_0x458a80;_0x219d01=0xc8;}else{_0x219d01=0xce;}_0x5ec6e2[_0xa590('0x19')](_0x219d01);return _0x5ec6e2[_0xa590('0x1f')](_0xa590('0x20'),_0xc1f37a+'-'+_0x360a1e+'/'+_0x458a80)[_0xa590('0x1a')](_0x6ca5c8);}return null;};}function patchUpdates(_0x23381b){return function(_0x378e4e){try{jsonpatch['apply'](_0x378e4e,_0x23381b,!![]);}catch(_0x1fb3fd){return BPromise[_0xa590('0x21')](_0x1fb3fd);}return _0x378e4e['save']();};}function saveUpdates(_0x489a13,_0x2ccb4e){return function(_0x16113c){if(_0x16113c){return _0x16113c[_0xa590('0x22')](_0x489a13)[_0xa590('0x23')](function(_0x24d901){return _0x24d901;});}return null;};}function removeEntity(_0x4d63e2,_0x1805d8){return function(_0x35596f){if(_0x35596f){return _0x35596f[_0xa590('0x24')]()[_0xa590('0x23')](function(){_0x4d63e2[_0xa590('0x19')](0xcc)[_0xa590('0x25')]();});}};}function handleEntityNotFound(_0x5a1396,_0x3a9c51){return function(_0x4fdc6e){if(!_0x4fdc6e){_0x5a1396[_0xa590('0x18')](0x194);}return _0x4fdc6e;};}function handleError(_0x41bd71,_0x46f7dd){_0x46f7dd=_0x46f7dd||0x1f4;return function(_0x4dac12){logger[_0xa590('0x26')](_0x4dac12[_0xa590('0x27')]);if(_0x4dac12[_0xa590('0x28')]){delete _0x4dac12[_0xa590('0x28')];}_0x41bd71['status'](_0x46f7dd)['send'](_0x4dac12);};}exports[_0xa590('0x29')]=function(_0x391f8c,_0x6928e4){var _0x115e45={},_0x3b47f1={},_0x35a179={'count':0x0,'rows':[]};var _0x2aa769=_['map'](db[_0xa590('0x2a')][_0xa590('0x2b')],function(_0x1a0f9a){return{'name':_0x1a0f9a[_0xa590('0x2c')],'type':_0x1a0f9a[_0xa590('0x2d')][_0xa590('0x2e')]};});_0x3b47f1['model']=_['map'](_0x2aa769,'name');_0x3b47f1[_0xa590('0x2f')]=_['keys'](_0x391f8c['query']);_0x3b47f1[_0xa590('0x30')]=_[_0xa590('0x31')](_0x3b47f1[_0xa590('0x32')],_0x3b47f1[_0xa590('0x2f')]);_0x115e45['attributes']=_[_0xa590('0x31')](_0x3b47f1[_0xa590('0x32')],qs['fields'](_0x391f8c[_0xa590('0x2f')][_0xa590('0x33')]));_0x115e45[_0xa590('0x34')]=_0x115e45[_0xa590('0x34')][_0xa590('0x35')]?_0x115e45['attributes']:_0x3b47f1[_0xa590('0x32')];if(!_0x391f8c['query'][_0xa590('0x36')](_0xa590('0x37'))){_0x115e45[_0xa590('0x1d')]=qs[_0xa590('0x1d')](_0x391f8c['query'][_0xa590('0x1d')]);_0x115e45[_0xa590('0x1b')]=qs[_0xa590('0x1b')](_0x391f8c[_0xa590('0x2f')][_0xa590('0x1b')]);}_0x115e45[_0xa590('0x38')]=qs['sort'](_0x391f8c[_0xa590('0x2f')][_0xa590('0x39')]);_0x115e45[_0xa590('0x3a')]=qs[_0xa590('0x30')](_[_0xa590('0x3b')](_0x391f8c[_0xa590('0x2f')],_0x3b47f1[_0xa590('0x30')]),_0x2aa769);if(_0x391f8c[_0xa590('0x2f')][_0xa590('0x3c')]){_0x115e45[_0xa590('0x3a')]=_[_0xa590('0x3d')](_0x115e45['where'],{'$or':_['map'](_0x2aa769,function(_0x4997e3){if(_0x4997e3[_0xa590('0x2d')]!==_0xa590('0x3e')){var _0x283e03={};_0x283e03[_0x4997e3[_0xa590('0x28')]]={'$like':'%'+_0x391f8c[_0xa590('0x2f')][_0xa590('0x3c')]+'%'};return _0x283e03;}})});}_0x115e45=_['merge']({},_0x115e45,_0x391f8c[_0xa590('0x3f')]);var _0x41835f={'where':_0x115e45[_0xa590('0x3a')]};return db[_0xa590('0x2a')][_0xa590('0x1e')](_0x41835f)[_0xa590('0x23')](function(_0xf858d4){_0x35a179['count']=_0xf858d4;if(_0x391f8c[_0xa590('0x2f')]['includeAll']){_0x115e45[_0xa590('0x40')]=[{'all':!![]}];}return db[_0xa590('0x2a')][_0xa590('0x41')](_0x115e45);})[_0xa590('0x23')](function(_0x2895d4){_0x35a179[_0xa590('0x42')]=_0x2895d4;return _0x35a179;})[_0xa590('0x23')](respondWithFilteredResult(_0x6928e4,_0x115e45))[_0xa590('0x43')](handleError(_0x6928e4,null));};exports[_0xa590('0x44')]=function(_0x3f637c,_0x2e9e38){var _0x5408f4={'raw':![],'where':{'id':_0x3f637c[_0xa590('0x45')]['id']}},_0x16431f={};_0x16431f[_0xa590('0x32')]=_[_0xa590('0x46')](db[_0xa590('0x2a')]['rawAttributes']);_0x16431f['query']=_[_0xa590('0x46')](_0x3f637c[_0xa590('0x2f')]);_0x16431f[_0xa590('0x30')]=_[_0xa590('0x31')](_0x16431f['model'],_0x16431f[_0xa590('0x2f')]);_0x5408f4['attributes']=_[_0xa590('0x31')](_0x16431f['model'],qs[_0xa590('0x33')](_0x3f637c['query'][_0xa590('0x33')]));_0x5408f4['attributes']=_0x5408f4['attributes'][_0xa590('0x35')]?_0x5408f4[_0xa590('0x34')]:_0x16431f[_0xa590('0x32')];if(_0x3f637c[_0xa590('0x2f')][_0xa590('0x47')]){_0x5408f4[_0xa590('0x40')]=[{'all':!![]}];}_0x5408f4=_['merge']({},_0x5408f4,_0x3f637c['options']);return db[_0xa590('0x2a')]['find'](_0x5408f4)[_0xa590('0x23')](handleEntityNotFound(_0x2e9e38,null))[_0xa590('0x23')](respondWithResult(_0x2e9e38,null))[_0xa590('0x43')](handleError(_0x2e9e38,null));};exports[_0xa590('0x48')]=function(_0x3bc106,_0x48f82f){return db['FreshdeskAccount'][_0xa590('0x48')](_0x3bc106[_0xa590('0x49')],{})[_0xa590('0x23')](respondWithResult(_0x48f82f,0xc9))['catch'](handleError(_0x48f82f,null));};exports[_0xa590('0x22')]=function(_0x513486,_0x196b84){if(_0x513486[_0xa590('0x49')]['id']){delete _0x513486[_0xa590('0x49')]['id'];}return db[_0xa590('0x2a')]['find']({'where':{'id':_0x513486[_0xa590('0x45')]['id']}})[_0xa590('0x23')](handleEntityNotFound(_0x196b84,null))['then'](saveUpdates(_0x513486['body'],null))[_0xa590('0x23')](respondWithResult(_0x196b84,null))[_0xa590('0x43')](handleError(_0x196b84,null));};exports[_0xa590('0x24')]=function(_0x7daa1b,_0x515088){return db[_0xa590('0x2a')]['find']({'where':{'id':_0x7daa1b[_0xa590('0x45')]['id']}})[_0xa590('0x23')](handleEntityNotFound(_0x515088,null))[_0xa590('0x23')](removeEntity(_0x515088,null))['catch'](handleError(_0x515088,null));};exports[_0xa590('0x4a')]=function(_0x2f5ace,_0x2b53ce,_0x11b99f){var _0x22c2a5={};var _0x13900e={};var _0x20e879;var _0xf3f60e;return db[_0xa590('0x2a')]['findOne']({'where':{'id':_0x2f5ace[_0xa590('0x45')]['id']}})[_0xa590('0x23')](handleEntityNotFound(_0x2b53ce,null))[_0xa590('0x23')](function(_0x4c9d59){if(_0x4c9d59){_0x20e879=_0x4c9d59;_0x13900e['model']=_['keys'](db[_0xa590('0x4b')][_0xa590('0x2b')]);_0x13900e[_0xa590('0x2f')]=_[_0xa590('0x46')](_0x2f5ace[_0xa590('0x2f')]);_0x13900e['filters']=_['intersection'](_0x13900e[_0xa590('0x32')],_0x13900e[_0xa590('0x2f')]);_0x22c2a5[_0xa590('0x34')]=_['intersection'](_0x13900e[_0xa590('0x32')],qs[_0xa590('0x33')](_0x2f5ace['query']['fields']));_0x22c2a5[_0xa590('0x34')]=_0x22c2a5[_0xa590('0x34')][_0xa590('0x35')]?_0x22c2a5[_0xa590('0x34')]:_0x13900e[_0xa590('0x32')];_0x22c2a5['order']=qs[_0xa590('0x39')](_0x2f5ace[_0xa590('0x2f')][_0xa590('0x39')]);_0x22c2a5[_0xa590('0x3a')]=qs[_0xa590('0x30')](_[_0xa590('0x3b')](_0x2f5ace[_0xa590('0x2f')],_0x13900e[_0xa590('0x30')]));if(_0x2f5ace[_0xa590('0x2f')]['filter']){_0x22c2a5[_0xa590('0x3a')]=_['merge'](_0x22c2a5[_0xa590('0x3a')],{'$or':_['map'](_0x22c2a5[_0xa590('0x34')],function(_0x46727a){var _0x3e3ec8={};_0x3e3ec8[_0x46727a]={'$like':'%'+_0x2f5ace['query']['filter']+'%'};return _0x3e3ec8;})});}_0x22c2a5=_[_0xa590('0x3d')]({},_0x22c2a5,_0x2f5ace['options']);return _0x20e879[_0xa590('0x4a')](_0x22c2a5);}})['then'](function(_0x46890a){if(_0x46890a){_0xf3f60e=_0x46890a['length'];if(!_0x2f5ace[_0xa590('0x2f')]['hasOwnProperty']('nolimit')){_0x22c2a5[_0xa590('0x1d')]=qs[_0xa590('0x1d')](_0x2f5ace[_0xa590('0x2f')][_0xa590('0x1d')]);_0x22c2a5['offset']=qs[_0xa590('0x1b')](_0x2f5ace[_0xa590('0x2f')][_0xa590('0x1b')]);}return _0x20e879[_0xa590('0x4a')](_0x22c2a5);}})[_0xa590('0x23')](function(_0xcb7399){if(_0xcb7399){return _0xcb7399?{'count':_0xf3f60e,'rows':_0xcb7399}:null;}})['then'](respondWithResult(_0x2b53ce,null))[_0xa590('0x43')](handleError(_0x2b53ce,null));};exports[_0xa590('0x4c')]=function(_0x552bcd,_0x9583c,_0x4e9d74){if(_0x552bcd[_0xa590('0x49')]['id']){delete _0x552bcd[_0xa590('0x49')]['id'];}return db[_0xa590('0x2a')][_0xa590('0x4d')]({'where':{'id':_0x552bcd[_0xa590('0x45')]['id']}})['then'](handleEntityNotFound(_0x9583c,null))[_0xa590('0x23')](function(_0x524a3f){if(_0x524a3f){_0x552bcd[_0xa590('0x49')][_0xa590('0x4e')]=_0x524a3f['id'];_0x552bcd[_0xa590('0x49')][_0xa590('0x4f')]=integrations[_0xa590('0x50')](_0x552bcd[_0xa590('0x49')]['channel'],_0x552bcd[_0xa590('0x49')]['type']);_0x552bcd[_0xa590('0x49')][_0xa590('0x51')]=integrations['getDescriptions'](_0x552bcd[_0xa590('0x49')][_0xa590('0x52')],_0x552bcd[_0xa590('0x49')][_0xa590('0x2d')]);return db[_0xa590('0x4b')]['create'](_0x552bcd[_0xa590('0x49')],{'include':[{'model':db[_0xa590('0x53')],'as':_0xa590('0x4f')},{'model':db[_0xa590('0x53')],'as':_0xa590('0x51')}]});}return null;})['then'](respondWithResult(_0x9583c,null))[_0xa590('0x43')](handleError(_0x9583c,null));};exports['getFields']=function(_0x203d3e,_0x300f55,_0x223b48){var _0x3ef2f1='';return db[_0xa590('0x2a')][_0xa590('0x4d')]({'where':{'id':_0x203d3e[_0xa590('0x45')]['id']},'attributes':['id',_0xa590('0x54'),_0xa590('0x55')]})[_0xa590('0x23')](handleEntityNotFound(_0x300f55,null))[_0xa590('0x23')](function(_0x3af4b6){if(_0x3af4b6){_0x3ef2f1=_0x3af4b6[_0xa590('0x54')];var _0x5b65eb=_0x3ef2f1['slice'](-0x1);if(_0x5b65eb==='/'){_0x3ef2f1=_0x3ef2f1[_0xa590('0x56')](0x0,_0x3ef2f1[_0xa590('0x57')](_0x5b65eb));}return rp({'method':'GET','uri':util[_0xa590('0x58')](_0xa590('0x59'),_0x3ef2f1,_0xa590('0x5a')),'headers':{'Authorization':util[_0xa590('0x58')](_0xa590('0x5b'),new Buffer(util['format'](_0xa590('0x5c'),_0x3af4b6[_0xa590('0x55')]))['toString']('base64'))},'json':!![]});}})[_0xa590('0x23')](function(_0x2b195a){if(_0x2b195a){var _0x5b4083=[_0xa590('0x5d'),'subject',_0xa590('0x5e'),_0xa590('0x5f'),'status',_0xa590('0x60'),_0xa590('0x61'),_0xa590('0x62'),_0xa590('0x63'),'group','company'];_[_0xa590('0x64')](_0x2b195a,function(_0x1c75f6){return _0x5b4083[_0xa590('0x65')](_0x1c75f6['name'])||!_0x1c75f6['default']&&_0x1c75f6['type']!=='custom_text'&&_0x1c75f6['type']!==_0xa590('0x66');});return{'count':_0x2b195a[_0xa590('0x35')],'rows':_[_0xa590('0x67')](_0x2b195a,function(_0x361909){return{'id':_0x361909[_0xa590('0x28')],'name':_0x361909['label'],'custom':!_0x361909[_0xa590('0x68')],'options':_0x361909['choices']?_[_0xa590('0x67')](_0x361909['choices'],function(_0x408e0c){return{'name':_[_0xa590('0x69')](_0x408e0c),'value':_0x408e0c};}):[]};})};}})[_0xa590('0x23')](respondWithResult(_0x300f55,null))['catch'](function(_0x3dd7d3){var _0x53e4e0=_0x203d3e[_0xa590('0x2f')][_0xa590('0x6a')]?0x1f4:_0x3dd7d3[_0xa590('0x6b')]||0x1f4;logger['error'](_0xa590('0x6c'),_0xa590('0x6d'),_0x53e4e0,JSON[_0xa590('0x6e')](_0x3dd7d3));delete _0x3dd7d3[_0xa590('0x28')];if(_0x53e4e0===0x191){_0x53e4e0=0x190;}_0x300f55['status'](_0x53e4e0)[_0xa590('0x6f')](_0x203d3e[_0xa590('0x2f')]['test']?{'message':_0xa590('0x70'),'statusCode':_0x3dd7d3['statusCode']}:_0x3dd7d3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 80ca2e9..72ebac9 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 _0x5e38=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','moment','bluebird','request-promise','../../components/integrations/configuration','exports'];(function(_0x4f77bf,_0x5e9da7){var _0x2faf36=function(_0xcb6b88){while(--_0xcb6b88){_0x4f77bf['push'](_0x4f77bf['shift']());}};_0x2faf36(++_0x5e9da7);}(_0x5e38,0x1c5));var _0x85e3=function(_0x5425fa,_0x16459a){_0x5425fa=_0x5425fa-0x0;var _0x85e40f=_0x5e38[_0x5425fa];return _0x85e40f;};'use strict';var _=require(_0x85e3('0x0'));var util=require(_0x85e3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x85e3('0x2'));var BPromise=require(_0x85e3('0x3'));var rp=require(_0x85e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x85e3('0x5'));module[_0x85e3('0x6')]=function(_0x18fcf2,_0x912b46){return _0x18fcf2[_0x85e3('0x7')](_0x85e3('0x8'),attributes,{'tableName':_0x85e3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5aea=['../../components/integrations/configuration','exports','define','moment','request-promise','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3fec16,_0x22dbe3){var _0xe89ab9=function(_0x5c2f84){while(--_0x5c2f84){_0x3fec16['push'](_0x3fec16['shift']());}};_0xe89ab9(++_0x22dbe3);}(_0x5aea,0xe3));var _0xa5ae=function(_0x4e74cc,_0x4e8643){_0x4e74cc=_0x4e74cc-0x0;var _0x12cc5a=_0x5aea[_0x4e74cc];return _0x12cc5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa5ae('0x0'));var BPromise=require('bluebird');var rp=require(_0xa5ae('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa5ae('0x2'));var attributes=require(_0xa5ae('0x3'));var integrations=require(_0xa5ae('0x4'));module[_0xa5ae('0x5')]=function(_0x2eb41e,_0x55b4d8){return _0x2eb41e[_0xa5ae('0x6')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index c51baef..a6f4d0b 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 _0x0124=['rpc','../../config/environment','jayson/promise','http','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','FreshdeskAccount,\x20%s,\x20%s','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','model','map','stringify','catch','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c574e,_0x491053){var _0x1101f7=function(_0x5285c2){while(--_0x5285c2){_0x2c574e['push'](_0x2c574e['shift']());}};_0x1101f7(++_0x491053);}(_0x0124,0x108));var _0x4012=function(_0x42ec8f,_0x43ac68){_0x42ec8f=_0x42ec8f-0x0;var _0x3475e5=_0x0124[_0x42ec8f];return _0x3475e5;};'use strict';var _=require(_0x4012('0x0'));var util=require(_0x4012('0x1'));var moment=require(_0x4012('0x2'));var BPromise=require(_0x4012('0x3'));var rs=require(_0x4012('0x4'));var fs=require('fs');var Redis=require(_0x4012('0x5'));var db=require(_0x4012('0x6'))['db'];var utils=require(_0x4012('0x7'));var logger=require('../../config/logger')(_0x4012('0x8'));var config=require(_0x4012('0x9'));var jayson=require(_0x4012('0xa'));var client=jayson['client'][_0x4012('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9b3f75,_0x45e58a,_0x48e0f4){return new BPromise(function(_0x32147f,_0x2b33a7){return client['request'](_0x9b3f75,_0x48e0f4)[_0x4012('0xc')](function(_0x1f2528){logger[_0x4012('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x45e58a,'request\x20sent');logger[_0x4012('0xe')](_0x4012('0xf'),_0x45e58a,_0x4012('0x10'),JSON['stringify'](_0x1f2528));if(_0x1f2528[_0x4012('0x11')]){if(_0x1f2528[_0x4012('0x11')]['code']===0x1f4){logger[_0x4012('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x45e58a,_0x1f2528[_0x4012('0x11')][_0x4012('0x12')]);return _0x2b33a7(_0x1f2528[_0x4012('0x11')][_0x4012('0x12')]);}logger[_0x4012('0x11')](_0x4012('0x13'),_0x45e58a,_0x1f2528['error'][_0x4012('0x12')]);return _0x32147f(_0x1f2528['error'][_0x4012('0x12')]);}else{logger[_0x4012('0xd')](_0x4012('0x13'),_0x45e58a,'request\x20sent');_0x32147f(_0x1f2528[_0x4012('0x14')]['message']);}})['catch'](function(_0x1c708e){logger[_0x4012('0x11')](_0x4012('0x13'),_0x45e58a,_0x1c708e);_0x2b33a7(_0x1c708e);});});}exports[_0x4012('0x15')]=function(_0x2cfa08){var _0x9b786d=this;return new Promise(function(_0x2f59cd,_0x43ca84){return db[_0x4012('0x16')][_0x4012('0x17')]({'raw':_0x2cfa08['options']?_0x2cfa08[_0x4012('0x18')][_0x4012('0x19')]===undefined?!![]:![]:!![],'where':_0x2cfa08[_0x4012('0x18')]?_0x2cfa08[_0x4012('0x18')][_0x4012('0x1a')]||null:null,'attributes':_0x2cfa08[_0x4012('0x18')]?_0x2cfa08[_0x4012('0x18')][_0x4012('0x1b')]||null:null,'limit':_0x2cfa08[_0x4012('0x18')]?_0x2cfa08[_0x4012('0x18')]['limit']||null:null,'include':_0x2cfa08[_0x4012('0x18')]?_0x2cfa08[_0x4012('0x18')]['include']?_['map'](_0x2cfa08[_0x4012('0x18')][_0x4012('0x1c')],function(_0x168b4d){return{'model':db[_0x168b4d[_0x4012('0x1d')]],'as':_0x168b4d['as'],'attributes':_0x168b4d[_0x4012('0x1b')],'include':_0x168b4d['include']?_[_0x4012('0x1e')](_0x168b4d[_0x4012('0x1c')],function(_0x25ab11){return{'model':db[_0x25ab11[_0x4012('0x1d')]],'as':_0x25ab11['as'],'attributes':_0x25ab11['attributes'],'include':_0x25ab11[_0x4012('0x1c')]?_[_0x4012('0x1e')](_0x25ab11[_0x4012('0x1c')],function(_0x223245){return{'model':db[_0x223245['model']],'as':_0x223245['as'],'attributes':_0x223245[_0x4012('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4012('0xc')](function(_0x3c0101){logger['info'](_0x4012('0x15'),_0x2cfa08);logger['debug'](_0x4012('0x15'),_0x2cfa08,JSON[_0x4012('0x1f')](_0x3c0101));_0x2f59cd(_0x3c0101);})[_0x4012('0x20')](function(_0x119533){logger['error']('GetFreshdeskAccount',_0x119533[_0x4012('0x12')],_0x2cfa08);_0x43ca84(_0x9b786d['error'](0x1f4,_0x119533[_0x4012('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x516233){var _0x25b160=this;return new Promise(function(_0x531eb8,_0x472c1a){return db['FreshdeskAccount']['find']({'raw':_0x516233[_0x4012('0x18')]?_0x516233[_0x4012('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x516233[_0x4012('0x18')]?_0x516233[_0x4012('0x18')][_0x4012('0x1a')]||null:null,'attributes':_0x516233[_0x4012('0x18')]?_0x516233[_0x4012('0x18')]['attributes']||null:null,'include':_0x516233[_0x4012('0x18')]?_0x516233[_0x4012('0x18')][_0x4012('0x1c')]?_['map'](_0x516233['options']['include'],function(_0x2689e8){return{'model':db[_0x2689e8[_0x4012('0x1d')]],'as':_0x2689e8['as'],'attributes':_0x2689e8[_0x4012('0x1b')],'include':_0x2689e8[_0x4012('0x1c')]?_[_0x4012('0x1e')](_0x2689e8[_0x4012('0x1c')],function(_0x3385ff){return{'model':db[_0x3385ff[_0x4012('0x1d')]],'as':_0x3385ff['as'],'attributes':_0x3385ff[_0x4012('0x1b')],'include':_0x3385ff[_0x4012('0x1c')]?_[_0x4012('0x1e')](_0x3385ff[_0x4012('0x1c')],function(_0x1ea79a){return{'model':db[_0x1ea79a[_0x4012('0x1d')]],'as':_0x1ea79a['as'],'attributes':_0x1ea79a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x475a59){logger[_0x4012('0xd')](_0x4012('0x21'),_0x516233);logger[_0x4012('0xe')](_0x4012('0x21'),_0x516233,JSON[_0x4012('0x1f')](_0x475a59));_0x531eb8(_0x475a59);})[_0x4012('0x20')](function(_0x500869){logger[_0x4012('0x11')](_0x4012('0x21'),_0x500869['message'],_0x516233);_0x472c1a(_0x25b160[_0x4012('0x11')](0x1f4,_0x500869[_0x4012('0x12')]));});});}; \ No newline at end of file +var _0x25ca=['rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','include','map','attributes','model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25ca,0xf0));var _0xa25c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x25ca[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xa25c('0x0'));var util=require(_0xa25c('0x1'));var moment=require(_0xa25c('0x2'));var BPromise=require(_0xa25c('0x3'));var rs=require(_0xa25c('0x4'));var fs=require('fs');var Redis=require(_0xa25c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa25c('0x6'));var logger=require(_0xa25c('0x7'))(_0xa25c('0x8'));var config=require(_0xa25c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa25c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5804e5,_0x1055d7,_0x5c219d){return new BPromise(function(_0x3d3ba9,_0x3513fa){return client[_0xa25c('0xb')](_0x5804e5,_0x5c219d)[_0xa25c('0xc')](function(_0x4598fd){logger[_0xa25c('0xd')](_0xa25c('0xe'),_0x1055d7,_0xa25c('0xf'));logger[_0xa25c('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1055d7,_0xa25c('0xf'),JSON[_0xa25c('0x11')](_0x4598fd));if(_0x4598fd[_0xa25c('0x12')]){if(_0x4598fd[_0xa25c('0x12')]['code']===0x1f4){logger['error'](_0xa25c('0xe'),_0x1055d7,_0x4598fd[_0xa25c('0x12')]['message']);return _0x3513fa(_0x4598fd[_0xa25c('0x12')][_0xa25c('0x13')]);}logger[_0xa25c('0x12')](_0xa25c('0xe'),_0x1055d7,_0x4598fd['error'][_0xa25c('0x13')]);return _0x3d3ba9(_0x4598fd[_0xa25c('0x12')]['message']);}else{logger[_0xa25c('0xd')](_0xa25c('0xe'),_0x1055d7,_0xa25c('0xf'));_0x3d3ba9(_0x4598fd[_0xa25c('0x14')][_0xa25c('0x13')]);}})[_0xa25c('0x15')](function(_0x33b726){logger['error'](_0xa25c('0xe'),_0x1055d7,_0x33b726);_0x3513fa(_0x33b726);});});}exports[_0xa25c('0x16')]=function(_0x216638){var _0x3cee14=this;return new Promise(function(_0x507a2c,_0x1b37aa){return db[_0xa25c('0x17')]['findAll']({'raw':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')][_0xa25c('0x19')]||null:null,'attributes':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')]['attributes']||null:null,'limit':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')]['limit']||null:null,'include':_0x216638[_0xa25c('0x18')]?_0x216638[_0xa25c('0x18')][_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x216638[_0xa25c('0x18')][_0xa25c('0x1a')],function(_0x37912e){return{'model':db[_0x37912e['model']],'as':_0x37912e['as'],'attributes':_0x37912e[_0xa25c('0x1c')],'include':_0x37912e[_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x37912e[_0xa25c('0x1a')],function(_0x1f8915){return{'model':db[_0x1f8915[_0xa25c('0x1d')]],'as':_0x1f8915['as'],'attributes':_0x1f8915['attributes'],'include':_0x1f8915[_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x1f8915[_0xa25c('0x1a')],function(_0x586a71){return{'model':db[_0x586a71[_0xa25c('0x1d')]],'as':_0x586a71['as'],'attributes':_0x586a71[_0xa25c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa25c('0xc')](function(_0x32321a){logger['info'](_0xa25c('0x16'),_0x216638);logger[_0xa25c('0x10')](_0xa25c('0x16'),_0x216638,JSON[_0xa25c('0x11')](_0x32321a));_0x507a2c(_0x32321a);})['catch'](function(_0x35069e){logger['error'](_0xa25c('0x16'),_0x35069e[_0xa25c('0x13')],_0x216638);_0x1b37aa(_0x3cee14['error'](0x1f4,_0x35069e[_0xa25c('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x3879ba){var _0x1367fa=this;return new Promise(function(_0x547bc5,_0xed8ba2){return db[_0xa25c('0x17')]['find']({'raw':_0x3879ba[_0xa25c('0x18')]?_0x3879ba[_0xa25c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3879ba[_0xa25c('0x18')]?_0x3879ba['options'][_0xa25c('0x19')]||null:null,'attributes':_0x3879ba[_0xa25c('0x18')]?_0x3879ba[_0xa25c('0x18')][_0xa25c('0x1c')]||null:null,'include':_0x3879ba['options']?_0x3879ba[_0xa25c('0x18')][_0xa25c('0x1a')]?_[_0xa25c('0x1b')](_0x3879ba['options'][_0xa25c('0x1a')],function(_0x7accc3){return{'model':db[_0x7accc3[_0xa25c('0x1d')]],'as':_0x7accc3['as'],'attributes':_0x7accc3[_0xa25c('0x1c')],'include':_0x7accc3['include']?_[_0xa25c('0x1b')](_0x7accc3[_0xa25c('0x1a')],function(_0x20ae43){return{'model':db[_0x20ae43[_0xa25c('0x1d')]],'as':_0x20ae43['as'],'attributes':_0x20ae43[_0xa25c('0x1c')],'include':_0x20ae43['include']?_[_0xa25c('0x1b')](_0x20ae43[_0xa25c('0x1a')],function(_0x380cf2){return{'model':db[_0x380cf2[_0xa25c('0x1d')]],'as':_0x380cf2['as'],'attributes':_0x380cf2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa25c('0xc')](function(_0x58e823){logger[_0xa25c('0xd')]('ShowFreshdeskAccount',_0x3879ba);logger[_0xa25c('0x10')](_0xa25c('0x1e'),_0x3879ba,JSON['stringify'](_0x58e823));_0x547bc5(_0x58e823);})[_0xa25c('0x15')](function(_0x14d42f){logger[_0xa25c('0x12')](_0xa25c('0x1e'),_0x14d42f[_0xa25c('0x13')],_0x3879ba);_0xed8ba2(_0x1367fa[_0xa25c('0x12')](0x1f4,_0x14d42f[_0xa25c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6da622a..becf6bb 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 _0xc1ef=['update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags'];(function(_0x4f4609,_0x44dea9){var _0x5c9ab3=function(_0x5cf14b){while(--_0x5cf14b){_0x4f4609['push'](_0x4f4609['shift']());}};_0x5c9ab3(++_0x44dea9);}(_0xc1ef,0xaa));var _0xfc1e=function(_0xf28b8,_0x186d5c){_0xf28b8=_0xf28b8-0x0;var _0x1c80ba=_0xc1ef[_0xf28b8];return _0x1c80ba;};'use strict';var multer=require(_0xfc1e('0x0'));var util=require(_0xfc1e('0x1'));var path=require('path');var timeout=require(_0xfc1e('0x2'));var express=require(_0xfc1e('0x3'));var router=express[_0xfc1e('0x4')]();var fs_extra=require(_0xfc1e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc1e('0x6'));var config=require(_0xfc1e('0x7'));var controller=require(_0xfc1e('0x8'));router['get']('/',auth[_0xfc1e('0x9')](),controller['index']);router[_0xfc1e('0xa')](_0xfc1e('0xb'),auth[_0xfc1e('0x9')](),controller[_0xfc1e('0xc')]);router[_0xfc1e('0xa')](_0xfc1e('0xd'),auth[_0xfc1e('0x9')](),controller[_0xfc1e('0xe')]);router[_0xfc1e('0xa')](_0xfc1e('0xf'),auth[_0xfc1e('0x9')](),controller['getSubjects']);router[_0xfc1e('0xa')](_0xfc1e('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0xfc1e('0x11')]);router[_0xfc1e('0x12')]('/',auth[_0xfc1e('0x9')](),controller[_0xfc1e('0x13')]);router['post'](_0xfc1e('0x14'),auth[_0xfc1e('0x9')](),controller[_0xfc1e('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfc1e('0x16')]);router['delete'](_0xfc1e('0xb'),auth['isAuthenticated'](),controller[_0xfc1e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4d35=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete'];(function(_0x4f5e67,_0x163a00){var _0xa8e9dc=function(_0x3f69ae){while(--_0x3f69ae){_0x4f5e67['push'](_0x4f5e67['shift']());}};_0xa8e9dc(++_0x163a00);}(_0x4d35,0x66));var _0x54d3=function(_0x2e0e04,_0x232842){_0x2e0e04=_0x2e0e04-0x0;var _0x19dfad=_0x4d35[_0x2e0e04];return _0x19dfad;};'use strict';var multer=require(_0x54d3('0x0'));var util=require(_0x54d3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x54d3('0x2'));var router=express[_0x54d3('0x3')]();var fs_extra=require(_0x54d3('0x4'));var auth=require(_0x54d3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x54d3('0x6')]('/',auth[_0x54d3('0x7')](),controller[_0x54d3('0x8')]);router[_0x54d3('0x6')](_0x54d3('0x9'),auth[_0x54d3('0x7')](),controller['show']);router['get'](_0x54d3('0xa'),auth[_0x54d3('0x7')](),controller[_0x54d3('0xb')]);router[_0x54d3('0x6')](_0x54d3('0xc'),auth[_0x54d3('0x7')](),controller[_0x54d3('0xd')]);router['get'](_0x54d3('0xe'),auth[_0x54d3('0x7')](),controller[_0x54d3('0xf')]);router[_0x54d3('0x6')]('/:id/tags',auth[_0x54d3('0x7')](),controller[_0x54d3('0x10')]);router[_0x54d3('0x11')]('/',auth[_0x54d3('0x7')](),controller[_0x54d3('0x12')]);router[_0x54d3('0x11')](_0x54d3('0x13'),auth[_0x54d3('0x7')](),controller['setTags']);router[_0x54d3('0x14')](_0x54d3('0x9'),auth[_0x54d3('0x7')](),controller[_0x54d3('0x15')]);router[_0x54d3('0x16')]('/:id',auth[_0x54d3('0x7')](),controller[_0x54d3('0x17')]);module[_0x54d3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 92b0a5a..d4bb2ce 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 _0x0f11=['sequelize','exports','STRING'];(function(_0x44451e,_0x3e0201){var _0x2a4582=function(_0x57dac9){while(--_0x57dac9){_0x44451e['push'](_0x44451e['shift']());}};_0x2a4582(++_0x3e0201);}(_0x0f11,0x1c5));var _0x10f1=function(_0x27d9a9,_0x29bc13){_0x27d9a9=_0x27d9a9-0x0;var _0x39bea1=_0x0f11[_0x27d9a9];return _0x39bea1;};'use strict';var Sequelize=require(_0x10f1('0x0'));module[_0x10f1('0x1')]={'name':{'type':Sequelize[_0x10f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed6c=['STRING','sequelize','exports'];(function(_0x2e7a77,_0x11f7d8){var _0x331f44=function(_0x5577df){while(--_0x5577df){_0x2e7a77['push'](_0x2e7a77['shift']());}};_0x331f44(++_0x11f7d8);}(_0xed6c,0x106));var _0xced6=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xed6c[_0x20ef64];return _0x3707d8;};'use strict';var Sequelize=require(_0xced6('0x0'));module[_0xced6('0x1')]={'name':{'type':Sequelize[_0xced6('0x2')]},'description':{'type':Sequelize[_0xced6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 73fb5a8..32db871 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 _0x5f1c=['limit','count','set','Content-Range','update','then','error','name','send','map','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','options','includeAll','include','FreshdeskConfiguration','findAll','rows','catch','show','params','keys','merge','find','create','body','destroy','getFields','rawAttributes','order','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x28c7a7,_0x55a356){var _0x50610f=function(_0x3a4038){while(--_0x3a4038){_0x28c7a7['push'](_0x28c7a7['shift']());}};_0x50610f(++_0x55a356);}(_0x5f1c,0x81));var _0xc5f1=function(_0x10818f,_0xb2057e){_0x10818f=_0x10818f-0x0;var _0x53900b=_0x5f1c[_0x10818f];return _0x53900b;};'use strict';var emlformat=require(_0xc5f1('0x0'));var rimraf=require(_0xc5f1('0x1'));var zipdir=require(_0xc5f1('0x2'));var jsonpatch=require(_0xc5f1('0x3'));var rp=require('request-promise');var moment=require(_0xc5f1('0x4'));var BPromise=require(_0xc5f1('0x5'));var Mustache=require('mustache');var util=require(_0xc5f1('0x6'));var path=require('path');var sox=require(_0xc5f1('0x7'));var csv=require(_0xc5f1('0x8'));var ejs=require(_0xc5f1('0x9'));var fs=require('fs');var fs_extra=require(_0xc5f1('0xa'));var _=require('lodash');var squel=require(_0xc5f1('0xb'));var crypto=require(_0xc5f1('0xc'));var jsforce=require(_0xc5f1('0xd'));var deskjs=require(_0xc5f1('0xe'));var toCsv=require(_0xc5f1('0x8'));var querystring=require(_0xc5f1('0xf'));var Papa=require(_0xc5f1('0x10'));var Redis=require(_0xc5f1('0x11'));var authService=require(_0xc5f1('0x12'));var qs=require(_0xc5f1('0x13'));var as=require(_0xc5f1('0x14'));var hardwareService=require(_0xc5f1('0x15'));var logger=require(_0xc5f1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc5f1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5f1('0x18'))['db'];function respondWithStatusCode(_0xb3b169,_0x21bdea){_0x21bdea=_0x21bdea||0xcc;return function(_0x45cbc3){if(_0x45cbc3){return _0xb3b169[_0xc5f1('0x19')](_0x21bdea);}return _0xb3b169[_0xc5f1('0x1a')](_0x21bdea)[_0xc5f1('0x1b')]();};}function respondWithResult(_0x23040b,_0x81e6ca){_0x81e6ca=_0x81e6ca||0xc8;return function(_0x164c27){if(_0x164c27){return _0x23040b[_0xc5f1('0x1a')](_0x81e6ca)[_0xc5f1('0x1c')](_0x164c27);}};}function respondWithFilteredResult(_0x2990e8,_0x17571){return function(_0x4c4d09){if(_0x4c4d09){var _0x2c8ccf=typeof _0x17571[_0xc5f1('0x1d')]===_0xc5f1('0x1e')&&typeof _0x17571[_0xc5f1('0x1f')]===_0xc5f1('0x1e');var _0x1d6ef5=_0x4c4d09[_0xc5f1('0x20')];var _0xf0db6=_0x2c8ccf?0x0:_0x17571[_0xc5f1('0x1d')];var _0x212903=_0x2c8ccf?_0x4c4d09[_0xc5f1('0x20')]:_0x17571[_0xc5f1('0x1d')]+_0x17571[_0xc5f1('0x1f')];var _0x1773f8;if(_0x212903>=_0x1d6ef5){_0x212903=_0x1d6ef5;_0x1773f8=0xc8;}else{_0x1773f8=0xce;}_0x2990e8[_0xc5f1('0x1a')](_0x1773f8);return _0x2990e8[_0xc5f1('0x21')](_0xc5f1('0x22'),_0xf0db6+'-'+_0x212903+'/'+_0x1d6ef5)[_0xc5f1('0x1c')](_0x4c4d09);}return null;};}function patchUpdates(_0x4cc293){return function(_0x3958aa){try{jsonpatch['apply'](_0x3958aa,_0x4cc293,!![]);}catch(_0x5dbd76){return BPromise['reject'](_0x5dbd76);}return _0x3958aa['save']();};}function saveUpdates(_0x56bbc6,_0x3e2562){return function(_0x43dc18){if(_0x43dc18){return _0x43dc18[_0xc5f1('0x23')](_0x56bbc6)['then'](function(_0x327383){return _0x327383;});}return null;};}function removeEntity(_0x8ec966,_0xc926f5){return function(_0x36be2c){if(_0x36be2c){return _0x36be2c['destroy']()[_0xc5f1('0x24')](function(){_0x8ec966[_0xc5f1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25846c,_0x51fa24){return function(_0x491eff){if(!_0x491eff){_0x25846c['sendStatus'](0x194);}return _0x491eff;};}function handleError(_0x1c669a,_0x112d5c){_0x112d5c=_0x112d5c||0x1f4;return function(_0x276ac4){logger[_0xc5f1('0x25')](_0x276ac4['stack']);if(_0x276ac4['name']){delete _0x276ac4[_0xc5f1('0x26')];}_0x1c669a[_0xc5f1('0x1a')](_0x112d5c)[_0xc5f1('0x27')](_0x276ac4);};}exports['index']=function(_0x502b43,_0x1e6457){var _0x5a5a09={},_0x149f8d={},_0x5ab74f={'count':0x0,'rows':[]};var _0x7ac96d=_[_0xc5f1('0x28')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x3dd1b7){return{'name':_0x3dd1b7['fieldName'],'type':_0x3dd1b7['type'][_0xc5f1('0x29')]};});_0x149f8d[_0xc5f1('0x2a')]=_[_0xc5f1('0x28')](_0x7ac96d,_0xc5f1('0x26'));_0x149f8d[_0xc5f1('0x2b')]=_['keys'](_0x502b43['query']);_0x149f8d['filters']=_[_0xc5f1('0x2c')](_0x149f8d[_0xc5f1('0x2a')],_0x149f8d[_0xc5f1('0x2b')]);_0x5a5a09[_0xc5f1('0x2d')]=_[_0xc5f1('0x2c')](_0x149f8d[_0xc5f1('0x2a')],qs[_0xc5f1('0x2e')](_0x502b43[_0xc5f1('0x2b')][_0xc5f1('0x2e')]));_0x5a5a09['attributes']=_0x5a5a09[_0xc5f1('0x2d')][_0xc5f1('0x2f')]?_0x5a5a09['attributes']:_0x149f8d['model'];if(!_0x502b43[_0xc5f1('0x2b')][_0xc5f1('0x30')](_0xc5f1('0x31'))){_0x5a5a09['limit']=qs['limit'](_0x502b43['query'][_0xc5f1('0x1f')]);_0x5a5a09['offset']=qs[_0xc5f1('0x1d')](_0x502b43[_0xc5f1('0x2b')][_0xc5f1('0x1d')]);}_0x5a5a09['order']=qs[_0xc5f1('0x32')](_0x502b43[_0xc5f1('0x2b')][_0xc5f1('0x32')]);_0x5a5a09['where']=qs[_0xc5f1('0x33')](_[_0xc5f1('0x34')](_0x502b43[_0xc5f1('0x2b')],_0x149f8d[_0xc5f1('0x33')]),_0x7ac96d);if(_0x502b43[_0xc5f1('0x2b')][_0xc5f1('0x35')]){_0x5a5a09['where']=_['merge'](_0x5a5a09[_0xc5f1('0x36')],{'$or':_[_0xc5f1('0x28')](_0x7ac96d,function(_0x2ba067){if(_0x2ba067['type']!=='VIRTUAL'){var _0x3a7b0f={};_0x3a7b0f[_0x2ba067[_0xc5f1('0x26')]]={'$like':'%'+_0x502b43['query'][_0xc5f1('0x35')]+'%'};return _0x3a7b0f;}})});}_0x5a5a09=_['merge']({},_0x5a5a09,_0x502b43[_0xc5f1('0x37')]);var _0x437c6a={'where':_0x5a5a09['where']};return db['FreshdeskConfiguration'][_0xc5f1('0x20')](_0x437c6a)['then'](function(_0x548a4d){_0x5ab74f['count']=_0x548a4d;if(_0x502b43['query'][_0xc5f1('0x38')]){_0x5a5a09[_0xc5f1('0x39')]=[{'all':!![]}];}return db[_0xc5f1('0x3a')][_0xc5f1('0x3b')](_0x5a5a09);})[_0xc5f1('0x24')](function(_0xcd9b08){_0x5ab74f[_0xc5f1('0x3c')]=_0xcd9b08;return _0x5ab74f;})[_0xc5f1('0x24')](respondWithFilteredResult(_0x1e6457,_0x5a5a09))[_0xc5f1('0x3d')](handleError(_0x1e6457,null));};exports[_0xc5f1('0x3e')]=function(_0x217545,_0x9e5bba){var _0x5c1cec={'raw':![],'where':{'id':_0x217545[_0xc5f1('0x3f')]['id']}},_0x3bd93c={};_0x3bd93c['model']=_['keys'](db[_0xc5f1('0x3a')]['rawAttributes']);_0x3bd93c['query']=_[_0xc5f1('0x40')](_0x217545[_0xc5f1('0x2b')]);_0x3bd93c['filters']=_[_0xc5f1('0x2c')](_0x3bd93c['model'],_0x3bd93c['query']);_0x5c1cec[_0xc5f1('0x2d')]=_[_0xc5f1('0x2c')](_0x3bd93c[_0xc5f1('0x2a')],qs[_0xc5f1('0x2e')](_0x217545[_0xc5f1('0x2b')]['fields']));_0x5c1cec[_0xc5f1('0x2d')]=_0x5c1cec[_0xc5f1('0x2d')]['length']?_0x5c1cec[_0xc5f1('0x2d')]:_0x3bd93c['model'];if(_0x217545[_0xc5f1('0x2b')]['includeAll']){_0x5c1cec['include']=[{'all':!![]}];}_0x5c1cec=_[_0xc5f1('0x41')]({},_0x5c1cec,_0x217545[_0xc5f1('0x37')]);return db[_0xc5f1('0x3a')][_0xc5f1('0x42')](_0x5c1cec)[_0xc5f1('0x24')](handleEntityNotFound(_0x9e5bba,null))[_0xc5f1('0x24')](respondWithResult(_0x9e5bba,null))[_0xc5f1('0x3d')](handleError(_0x9e5bba,null));};exports[_0xc5f1('0x43')]=function(_0x38c636,_0x1f3158){return db['FreshdeskConfiguration']['create'](_0x38c636['body'],{})[_0xc5f1('0x24')](respondWithResult(_0x1f3158,0xc9))[_0xc5f1('0x3d')](handleError(_0x1f3158,null));};exports['update']=function(_0x1733ff,_0x484863){if(_0x1733ff[_0xc5f1('0x44')]['id']){delete _0x1733ff['body']['id'];}return db[_0xc5f1('0x3a')][_0xc5f1('0x42')]({'where':{'id':_0x1733ff[_0xc5f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x484863,null))[_0xc5f1('0x24')](saveUpdates(_0x1733ff[_0xc5f1('0x44')],null))[_0xc5f1('0x24')](respondWithResult(_0x484863,null))['catch'](handleError(_0x484863,null));};exports[_0xc5f1('0x45')]=function(_0x4a62f6,_0x10aebc){return db[_0xc5f1('0x3a')][_0xc5f1('0x42')]({'where':{'id':_0x4a62f6[_0xc5f1('0x3f')]['id']}})[_0xc5f1('0x24')](handleEntityNotFound(_0x10aebc,null))[_0xc5f1('0x24')](removeEntity(_0x10aebc,null))['catch'](handleError(_0x10aebc,null));};exports[_0xc5f1('0x46')]=function(_0x1cd730,_0x320056,_0x545e70){var _0x5e54bd={};var _0x353cdf={};var _0x423877;var _0x4a9d33;return db[_0xc5f1('0x3a')]['findOne']({'where':{'id':_0x1cd730['params']['id']}})[_0xc5f1('0x24')](handleEntityNotFound(_0x320056,null))[_0xc5f1('0x24')](function(_0x314112){if(_0x314112){_0x423877=_0x314112;_0x353cdf[_0xc5f1('0x2a')]=_[_0xc5f1('0x40')](db['FreshdeskField'][_0xc5f1('0x47')]);_0x353cdf['query']=_[_0xc5f1('0x40')](_0x1cd730[_0xc5f1('0x2b')]);_0x353cdf[_0xc5f1('0x33')]=_['intersection'](_0x353cdf['model'],_0x353cdf[_0xc5f1('0x2b')]);_0x5e54bd['attributes']=_[_0xc5f1('0x2c')](_0x353cdf['model'],qs[_0xc5f1('0x2e')](_0x1cd730['query']['fields']));_0x5e54bd[_0xc5f1('0x2d')]=_0x5e54bd[_0xc5f1('0x2d')][_0xc5f1('0x2f')]?_0x5e54bd['attributes']:_0x353cdf[_0xc5f1('0x2a')];_0x5e54bd[_0xc5f1('0x48')]=qs[_0xc5f1('0x32')](_0x1cd730['query'][_0xc5f1('0x32')]);_0x5e54bd['where']=qs['filters'](_['pick'](_0x1cd730[_0xc5f1('0x2b')],_0x353cdf[_0xc5f1('0x33')]));if(_0x1cd730[_0xc5f1('0x2b')][_0xc5f1('0x35')]){_0x5e54bd[_0xc5f1('0x36')]=_[_0xc5f1('0x41')](_0x5e54bd[_0xc5f1('0x36')],{'$or':_[_0xc5f1('0x28')](_0x5e54bd[_0xc5f1('0x2d')],function(_0x18855c){var _0x1ec1bd={};_0x1ec1bd[_0x18855c]={'$like':'%'+_0x1cd730[_0xc5f1('0x2b')][_0xc5f1('0x35')]+'%'};return _0x1ec1bd;})});}_0x5e54bd=_[_0xc5f1('0x41')]({},_0x5e54bd,_0x1cd730[_0xc5f1('0x37')]);return _0x423877[_0xc5f1('0x46')](_0x5e54bd);}})['then'](function(_0x94e09a){if(_0x94e09a){_0x4a9d33=_0x94e09a[_0xc5f1('0x2f')];if(!_0x1cd730[_0xc5f1('0x2b')][_0xc5f1('0x30')](_0xc5f1('0x31'))){_0x5e54bd[_0xc5f1('0x1f')]=qs['limit'](_0x1cd730[_0xc5f1('0x2b')]['limit']);_0x5e54bd[_0xc5f1('0x1d')]=qs[_0xc5f1('0x1d')](_0x1cd730['query'][_0xc5f1('0x1d')]);}return _0x423877[_0xc5f1('0x46')](_0x5e54bd);}})[_0xc5f1('0x24')](function(_0x33143d){if(_0x33143d){return _0x33143d?{'count':_0x4a9d33,'rows':_0x33143d}:null;}})[_0xc5f1('0x24')](respondWithResult(_0x320056,null))[_0xc5f1('0x3d')](handleError(_0x320056,null));};exports['getSubjects']=function(_0x555095,_0x14dbbf,_0x25776b){var _0x2ea54a={};var _0x10187b={};var _0x5625df;var _0x123dc2;return db[_0xc5f1('0x3a')][_0xc5f1('0x49')]({'where':{'id':_0x555095[_0xc5f1('0x3f')]['id']}})[_0xc5f1('0x24')](handleEntityNotFound(_0x14dbbf,null))[_0xc5f1('0x24')](function(_0x3506f3){if(_0x3506f3){_0x5625df=_0x3506f3;_0x10187b[_0xc5f1('0x2a')]=_[_0xc5f1('0x40')](db[_0xc5f1('0x4a')]['rawAttributes']);_0x10187b[_0xc5f1('0x2b')]=_[_0xc5f1('0x40')](_0x555095['query']);_0x10187b[_0xc5f1('0x33')]=_[_0xc5f1('0x2c')](_0x10187b[_0xc5f1('0x2a')],_0x10187b['query']);_0x2ea54a[_0xc5f1('0x2d')]=_[_0xc5f1('0x2c')](_0x10187b['model'],qs[_0xc5f1('0x2e')](_0x555095[_0xc5f1('0x2b')][_0xc5f1('0x2e')]));_0x2ea54a['attributes']=_0x2ea54a[_0xc5f1('0x2d')][_0xc5f1('0x2f')]?_0x2ea54a[_0xc5f1('0x2d')]:_0x10187b['model'];_0x2ea54a[_0xc5f1('0x48')]=qs[_0xc5f1('0x32')](_0x555095[_0xc5f1('0x2b')]['sort']);_0x2ea54a[_0xc5f1('0x36')]=qs[_0xc5f1('0x33')](_[_0xc5f1('0x34')](_0x555095[_0xc5f1('0x2b')],_0x10187b[_0xc5f1('0x33')]));if(_0x555095[_0xc5f1('0x2b')]['filter']){_0x2ea54a[_0xc5f1('0x36')]=_[_0xc5f1('0x41')](_0x2ea54a[_0xc5f1('0x36')],{'$or':_['map'](_0x2ea54a['attributes'],function(_0x537b78){var _0x519c52={};_0x519c52[_0x537b78]={'$like':'%'+_0x555095[_0xc5f1('0x2b')][_0xc5f1('0x35')]+'%'};return _0x519c52;})});}_0x2ea54a=_[_0xc5f1('0x41')]({},_0x2ea54a,_0x555095['options']);return _0x5625df[_0xc5f1('0x4b')](_0x2ea54a);}})[_0xc5f1('0x24')](function(_0x10061c){if(_0x10061c){_0x123dc2=_0x10061c['length'];if(!_0x555095['query'][_0xc5f1('0x30')](_0xc5f1('0x31'))){_0x2ea54a['limit']=qs[_0xc5f1('0x1f')](_0x555095[_0xc5f1('0x2b')][_0xc5f1('0x1f')]);_0x2ea54a[_0xc5f1('0x1d')]=qs[_0xc5f1('0x1d')](_0x555095[_0xc5f1('0x2b')][_0xc5f1('0x1d')]);}return _0x5625df['getSubjects'](_0x2ea54a);}})[_0xc5f1('0x24')](function(_0x22468c){if(_0x22468c){return _0x22468c?{'count':_0x123dc2,'rows':_0x22468c}:null;}})[_0xc5f1('0x24')](respondWithResult(_0x14dbbf,null))['catch'](handleError(_0x14dbbf,null));};exports[_0xc5f1('0x4c')]=function(_0x56ed42,_0x18eada,_0x1e2869){var _0x30ef7a={};var _0x7e7928={};var _0xc2f9d2;var _0xacc892;return db[_0xc5f1('0x3a')][_0xc5f1('0x49')]({'where':{'id':_0x56ed42[_0xc5f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x18eada,null))['then'](function(_0x4cd16d){if(_0x4cd16d){_0xc2f9d2=_0x4cd16d;_0x7e7928[_0xc5f1('0x2a')]=_[_0xc5f1('0x40')](db['FreshdeskField'][_0xc5f1('0x47')]);_0x7e7928[_0xc5f1('0x2b')]=_[_0xc5f1('0x40')](_0x56ed42[_0xc5f1('0x2b')]);_0x7e7928[_0xc5f1('0x33')]=_['intersection'](_0x7e7928[_0xc5f1('0x2a')],_0x7e7928[_0xc5f1('0x2b')]);_0x30ef7a[_0xc5f1('0x2d')]=_[_0xc5f1('0x2c')](_0x7e7928['model'],qs['fields'](_0x56ed42['query'][_0xc5f1('0x2e')]));_0x30ef7a[_0xc5f1('0x2d')]=_0x30ef7a[_0xc5f1('0x2d')][_0xc5f1('0x2f')]?_0x30ef7a[_0xc5f1('0x2d')]:_0x7e7928[_0xc5f1('0x2a')];_0x30ef7a['order']=qs['sort'](_0x56ed42['query'][_0xc5f1('0x32')]);_0x30ef7a[_0xc5f1('0x36')]=qs[_0xc5f1('0x33')](_[_0xc5f1('0x34')](_0x56ed42[_0xc5f1('0x2b')],_0x7e7928[_0xc5f1('0x33')]));if(_0x56ed42['query'][_0xc5f1('0x35')]){_0x30ef7a['where']=_[_0xc5f1('0x41')](_0x30ef7a[_0xc5f1('0x36')],{'$or':_[_0xc5f1('0x28')](_0x30ef7a[_0xc5f1('0x2d')],function(_0x2bdd5a){var _0x2bf2fb={};_0x2bf2fb[_0x2bdd5a]={'$like':'%'+_0x56ed42[_0xc5f1('0x2b')][_0xc5f1('0x35')]+'%'};return _0x2bf2fb;})});}_0x30ef7a=_[_0xc5f1('0x41')]({},_0x30ef7a,_0x56ed42[_0xc5f1('0x37')]);return _0xc2f9d2[_0xc5f1('0x4c')](_0x30ef7a);}})[_0xc5f1('0x24')](function(_0x180009){if(_0x180009){_0xacc892=_0x180009[_0xc5f1('0x2f')];if(!_0x56ed42[_0xc5f1('0x2b')][_0xc5f1('0x30')](_0xc5f1('0x31'))){_0x30ef7a[_0xc5f1('0x1f')]=qs[_0xc5f1('0x1f')](_0x56ed42[_0xc5f1('0x2b')]['limit']);_0x30ef7a[_0xc5f1('0x1d')]=qs[_0xc5f1('0x1d')](_0x56ed42[_0xc5f1('0x2b')][_0xc5f1('0x1d')]);}return _0xc2f9d2[_0xc5f1('0x4c')](_0x30ef7a);}})[_0xc5f1('0x24')](function(_0x186593){if(_0x186593){return _0x186593?{'count':_0xacc892,'rows':_0x186593}:null;}})['then'](respondWithResult(_0x18eada,null))[_0xc5f1('0x3d')](handleError(_0x18eada,null));};exports[_0xc5f1('0x4d')]=function(_0x4e8586,_0x2276e3,_0x33d5f7){var _0x1cbcba={};var _0x2bcaee={};var _0x29c3c1;var _0x28d2c9;return db['FreshdeskConfiguration'][_0xc5f1('0x49')]({'where':{'id':_0x4e8586[_0xc5f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2276e3,null))[_0xc5f1('0x24')](function(_0x134a79){if(_0x134a79){_0x29c3c1=_0x134a79;_0x2bcaee['model']=_[_0xc5f1('0x40')](db[_0xc5f1('0x4e')][_0xc5f1('0x47')]);_0x2bcaee[_0xc5f1('0x2b')]=_[_0xc5f1('0x40')](_0x4e8586[_0xc5f1('0x2b')]);_0x2bcaee[_0xc5f1('0x33')]=_['intersection'](_0x2bcaee[_0xc5f1('0x2a')],_0x2bcaee[_0xc5f1('0x2b')]);_0x1cbcba[_0xc5f1('0x2d')]=_['intersection'](_0x2bcaee[_0xc5f1('0x2a')],qs[_0xc5f1('0x2e')](_0x4e8586[_0xc5f1('0x2b')][_0xc5f1('0x2e')]));_0x1cbcba[_0xc5f1('0x2d')]=_0x1cbcba['attributes']['length']?_0x1cbcba[_0xc5f1('0x2d')]:_0x2bcaee[_0xc5f1('0x2a')];_0x1cbcba[_0xc5f1('0x48')]=qs['sort'](_0x4e8586[_0xc5f1('0x2b')]['sort']);_0x1cbcba[_0xc5f1('0x36')]=qs[_0xc5f1('0x33')](_[_0xc5f1('0x34')](_0x4e8586[_0xc5f1('0x2b')],_0x2bcaee[_0xc5f1('0x33')]));if(_0x4e8586[_0xc5f1('0x2b')][_0xc5f1('0x35')]){_0x1cbcba[_0xc5f1('0x36')]=_[_0xc5f1('0x41')](_0x1cbcba['where'],{'$or':_[_0xc5f1('0x28')](_0x1cbcba['attributes'],function(_0x12c576){var _0xffb6c2={};_0xffb6c2[_0x12c576]={'$like':'%'+_0x4e8586[_0xc5f1('0x2b')][_0xc5f1('0x35')]+'%'};return _0xffb6c2;})});}_0x1cbcba=_[_0xc5f1('0x41')]({},_0x1cbcba,_0x4e8586['options']);return _0x29c3c1['getTags'](_0x1cbcba);}})[_0xc5f1('0x24')](function(_0x473fd9){if(_0x473fd9){_0x28d2c9=_0x473fd9[_0xc5f1('0x2f')];if(!_0x4e8586['query'][_0xc5f1('0x30')](_0xc5f1('0x31'))){_0x1cbcba[_0xc5f1('0x1f')]=qs[_0xc5f1('0x1f')](_0x4e8586[_0xc5f1('0x2b')][_0xc5f1('0x1f')]);_0x1cbcba[_0xc5f1('0x1d')]=qs['offset'](_0x4e8586[_0xc5f1('0x2b')][_0xc5f1('0x1d')]);}return _0x29c3c1[_0xc5f1('0x4d')](_0x1cbcba);}})[_0xc5f1('0x24')](function(_0x506664){if(_0x506664){return _0x506664?{'count':_0x28d2c9,'rows':_0x506664}:null;}})[_0xc5f1('0x24')](respondWithResult(_0x2276e3,null))[_0xc5f1('0x3d')](handleError(_0x2276e3,null));};exports[_0xc5f1('0x4f')]=function(_0x42b90d,_0xb52836,_0x40e01a){if(_0x42b90d[_0xc5f1('0x44')]['id']){delete _0x42b90d['body']['id'];}return db[_0xc5f1('0x3a')][_0xc5f1('0x49')]({'where':{'id':_0x42b90d[_0xc5f1('0x3f')]['id']}})[_0xc5f1('0x24')](handleEntityNotFound(_0xb52836,null))[_0xc5f1('0x24')](function(_0x1cced2){if(_0x1cced2){return _0x1cced2[_0xc5f1('0x4f')](_0x42b90d['body']['ids']||[]);}return null;})['then'](respondWithResult(_0xb52836,null))[_0xc5f1('0x3d')](handleError(_0xb52836,null));}; \ No newline at end of file +var _0xed1a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','FreshdeskField','pick','nolimit','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis'];(function(_0x3f219e,_0x26be85){var _0xa486f7=function(_0x4e73ad){while(--_0x4e73ad){_0x3f219e['push'](_0x3f219e['shift']());}};_0xa486f7(++_0x26be85);}(_0xed1a,0x91));var _0xaed1=function(_0x1e6773,_0x138124){_0x1e6773=_0x1e6773-0x0;var _0x4c81a0=_0xed1a[_0x1e6773];return _0x4c81a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaed1('0x0'));var zipdir=require(_0xaed1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaed1('0x2'));var moment=require(_0xaed1('0x3'));var BPromise=require(_0xaed1('0x4'));var Mustache=require(_0xaed1('0x5'));var util=require(_0xaed1('0x6'));var path=require('path');var sox=require(_0xaed1('0x7'));var csv=require(_0xaed1('0x8'));var ejs=require(_0xaed1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaed1('0xa'));var squel=require(_0xaed1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaed1('0xc'));var toCsv=require(_0xaed1('0x8'));var querystring=require(_0xaed1('0xd'));var Papa=require('papaparse');var Redis=require(_0xaed1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xaed1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaed1('0x10'));var logger=require(_0xaed1('0x11'))(_0xaed1('0x12'));var utils=require(_0xaed1('0x13'));var config=require(_0xaed1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52ff62,_0x121b34){_0x121b34=_0x121b34||0xcc;return function(_0x518174){if(_0x518174){return _0x52ff62[_0xaed1('0x15')](_0x121b34);}return _0x52ff62[_0xaed1('0x16')](_0x121b34)[_0xaed1('0x17')]();};}function respondWithResult(_0x560936,_0x210948){_0x210948=_0x210948||0xc8;return function(_0x57aefc){if(_0x57aefc){return _0x560936['status'](_0x210948)[_0xaed1('0x18')](_0x57aefc);}};}function respondWithFilteredResult(_0x28eaaf,_0x41d3b7){return function(_0x1bfe4e){if(_0x1bfe4e){var _0x284762=typeof _0x41d3b7[_0xaed1('0x19')]==='undefined'&&typeof _0x41d3b7[_0xaed1('0x1a')]==='undefined';var _0x20097b=_0x1bfe4e[_0xaed1('0x1b')];var _0xdb1308=_0x284762?0x0:_0x41d3b7[_0xaed1('0x19')];var _0x26fe50=_0x284762?_0x1bfe4e[_0xaed1('0x1b')]:_0x41d3b7['offset']+_0x41d3b7[_0xaed1('0x1a')];var _0x4903ba;if(_0x26fe50>=_0x20097b){_0x26fe50=_0x20097b;_0x4903ba=0xc8;}else{_0x4903ba=0xce;}_0x28eaaf[_0xaed1('0x16')](_0x4903ba);return _0x28eaaf[_0xaed1('0x1c')](_0xaed1('0x1d'),_0xdb1308+'-'+_0x26fe50+'/'+_0x20097b)[_0xaed1('0x18')](_0x1bfe4e);}return null;};}function patchUpdates(_0xe561b9){return function(_0x34a1f6){try{jsonpatch[_0xaed1('0x1e')](_0x34a1f6,_0xe561b9,!![]);}catch(_0x4e0b9b){return BPromise['reject'](_0x4e0b9b);}return _0x34a1f6['save']();};}function saveUpdates(_0x35a9bd,_0x385467){return function(_0x244bb3){if(_0x244bb3){return _0x244bb3[_0xaed1('0x1f')](_0x35a9bd)[_0xaed1('0x20')](function(_0x5a6e0b){return _0x5a6e0b;});}return null;};}function removeEntity(_0x22bac8,_0x22ba25){return function(_0x5168d3){if(_0x5168d3){return _0x5168d3[_0xaed1('0x21')]()['then'](function(){_0x22bac8[_0xaed1('0x16')](0xcc)[_0xaed1('0x17')]();});}};}function handleEntityNotFound(_0x2c31b9,_0x44c75f){return function(_0x4d6f63){if(!_0x4d6f63){_0x2c31b9['sendStatus'](0x194);}return _0x4d6f63;};}function handleError(_0xa13460,_0x171f8d){_0x171f8d=_0x171f8d||0x1f4;return function(_0x367c2c){logger[_0xaed1('0x22')](_0x367c2c['stack']);if(_0x367c2c['name']){delete _0x367c2c[_0xaed1('0x23')];}_0xa13460['status'](_0x171f8d)[_0xaed1('0x24')](_0x367c2c);};}exports[_0xaed1('0x25')]=function(_0x4b15be,_0x588e62){var _0x3151a7={},_0x34a383={},_0x1f3190={'count':0x0,'rows':[]};var _0x41c268=_[_0xaed1('0x26')](db[_0xaed1('0x27')][_0xaed1('0x28')],function(_0x475d13){return{'name':_0x475d13[_0xaed1('0x29')],'type':_0x475d13[_0xaed1('0x2a')][_0xaed1('0x2b')]};});_0x34a383[_0xaed1('0x2c')]=_['map'](_0x41c268,_0xaed1('0x23'));_0x34a383[_0xaed1('0x2d')]=_[_0xaed1('0x2e')](_0x4b15be[_0xaed1('0x2d')]);_0x34a383[_0xaed1('0x2f')]=_['intersection'](_0x34a383[_0xaed1('0x2c')],_0x34a383['query']);_0x3151a7[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x34a383[_0xaed1('0x2c')],qs['fields'](_0x4b15be[_0xaed1('0x2d')][_0xaed1('0x32')]));_0x3151a7[_0xaed1('0x30')]=_0x3151a7[_0xaed1('0x30')]['length']?_0x3151a7[_0xaed1('0x30')]:_0x34a383[_0xaed1('0x2c')];if(!_0x4b15be['query']['hasOwnProperty']('nolimit')){_0x3151a7[_0xaed1('0x1a')]=qs['limit'](_0x4b15be[_0xaed1('0x2d')][_0xaed1('0x1a')]);_0x3151a7[_0xaed1('0x19')]=qs[_0xaed1('0x19')](_0x4b15be['query'][_0xaed1('0x19')]);}_0x3151a7[_0xaed1('0x33')]=qs[_0xaed1('0x34')](_0x4b15be['query'][_0xaed1('0x34')]);_0x3151a7[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_['pick'](_0x4b15be['query'],_0x34a383[_0xaed1('0x2f')]),_0x41c268);if(_0x4b15be[_0xaed1('0x2d')]['filter']){_0x3151a7['where']=_[_0xaed1('0x36')](_0x3151a7[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x41c268,function(_0x35d00e){if(_0x35d00e[_0xaed1('0x2a')]!==_0xaed1('0x37')){var _0x16dc5f={};_0x16dc5f[_0x35d00e[_0xaed1('0x23')]]={'$like':'%'+_0x4b15be['query'][_0xaed1('0x38')]+'%'};return _0x16dc5f;}})});}_0x3151a7=_[_0xaed1('0x36')]({},_0x3151a7,_0x4b15be[_0xaed1('0x39')]);var _0x568c22={'where':_0x3151a7[_0xaed1('0x35')]};return db[_0xaed1('0x27')]['count'](_0x568c22)[_0xaed1('0x20')](function(_0x30f15d){_0x1f3190['count']=_0x30f15d;if(_0x4b15be[_0xaed1('0x2d')][_0xaed1('0x3a')]){_0x3151a7[_0xaed1('0x3b')]=[{'all':!![]}];}return db[_0xaed1('0x27')][_0xaed1('0x3c')](_0x3151a7);})[_0xaed1('0x20')](function(_0x35f5b8){_0x1f3190['rows']=_0x35f5b8;return _0x1f3190;})['then'](respondWithFilteredResult(_0x588e62,_0x3151a7))[_0xaed1('0x3d')](handleError(_0x588e62,null));};exports[_0xaed1('0x3e')]=function(_0x571576,_0x11f038){var _0x549e6a={'raw':![],'where':{'id':_0x571576[_0xaed1('0x3f')]['id']}},_0x5da5ba={};_0x5da5ba[_0xaed1('0x2c')]=_[_0xaed1('0x2e')](db[_0xaed1('0x27')]['rawAttributes']);_0x5da5ba[_0xaed1('0x2d')]=_[_0xaed1('0x2e')](_0x571576[_0xaed1('0x2d')]);_0x5da5ba[_0xaed1('0x2f')]=_[_0xaed1('0x31')](_0x5da5ba['model'],_0x5da5ba[_0xaed1('0x2d')]);_0x549e6a[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x5da5ba[_0xaed1('0x2c')],qs['fields'](_0x571576[_0xaed1('0x2d')][_0xaed1('0x32')]));_0x549e6a[_0xaed1('0x30')]=_0x549e6a['attributes'][_0xaed1('0x40')]?_0x549e6a[_0xaed1('0x30')]:_0x5da5ba['model'];if(_0x571576[_0xaed1('0x2d')]['includeAll']){_0x549e6a['include']=[{'all':!![]}];}_0x549e6a=_['merge']({},_0x549e6a,_0x571576[_0xaed1('0x39')]);return db[_0xaed1('0x27')]['find'](_0x549e6a)[_0xaed1('0x20')](handleEntityNotFound(_0x11f038,null))[_0xaed1('0x20')](respondWithResult(_0x11f038,null))['catch'](handleError(_0x11f038,null));};exports[_0xaed1('0x41')]=function(_0x51133f,_0x6f9386){return db[_0xaed1('0x27')]['create'](_0x51133f[_0xaed1('0x42')],{})[_0xaed1('0x20')](respondWithResult(_0x6f9386,0xc9))[_0xaed1('0x3d')](handleError(_0x6f9386,null));};exports[_0xaed1('0x1f')]=function(_0x12fb4a,_0x5b897b){if(_0x12fb4a[_0xaed1('0x42')]['id']){delete _0x12fb4a[_0xaed1('0x42')]['id'];}return db[_0xaed1('0x27')]['find']({'where':{'id':_0x12fb4a['params']['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x5b897b,null))[_0xaed1('0x20')](saveUpdates(_0x12fb4a[_0xaed1('0x42')],null))['then'](respondWithResult(_0x5b897b,null))[_0xaed1('0x3d')](handleError(_0x5b897b,null));};exports[_0xaed1('0x21')]=function(_0x130e39,_0x3fd6a5){return db['FreshdeskConfiguration'][_0xaed1('0x43')]({'where':{'id':_0x130e39[_0xaed1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3fd6a5,null))[_0xaed1('0x20')](removeEntity(_0x3fd6a5,null))[_0xaed1('0x3d')](handleError(_0x3fd6a5,null));};exports[_0xaed1('0x44')]=function(_0x687d26,_0x445bcf,_0xeb9154){var _0x3aae93={};var _0x47d945={};var _0x17d2a2;var _0x384979;return db['FreshdeskConfiguration'][_0xaed1('0x45')]({'where':{'id':_0x687d26['params']['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x445bcf,null))[_0xaed1('0x20')](function(_0x15d986){if(_0x15d986){_0x17d2a2=_0x15d986;_0x47d945[_0xaed1('0x2c')]=_['keys'](db['FreshdeskField'][_0xaed1('0x28')]);_0x47d945[_0xaed1('0x2d')]=_[_0xaed1('0x2e')](_0x687d26[_0xaed1('0x2d')]);_0x47d945['filters']=_[_0xaed1('0x31')](_0x47d945['model'],_0x47d945[_0xaed1('0x2d')]);_0x3aae93['attributes']=_[_0xaed1('0x31')](_0x47d945[_0xaed1('0x2c')],qs[_0xaed1('0x32')](_0x687d26[_0xaed1('0x2d')]['fields']));_0x3aae93['attributes']=_0x3aae93['attributes'][_0xaed1('0x40')]?_0x3aae93[_0xaed1('0x30')]:_0x47d945[_0xaed1('0x2c')];_0x3aae93[_0xaed1('0x33')]=qs['sort'](_0x687d26[_0xaed1('0x2d')][_0xaed1('0x34')]);_0x3aae93[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_['pick'](_0x687d26[_0xaed1('0x2d')],_0x47d945[_0xaed1('0x2f')]));if(_0x687d26[_0xaed1('0x2d')][_0xaed1('0x38')]){_0x3aae93[_0xaed1('0x35')]=_[_0xaed1('0x36')](_0x3aae93[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x3aae93[_0xaed1('0x30')],function(_0x5153f2){var _0x5707d8={};_0x5707d8[_0x5153f2]={'$like':'%'+_0x687d26[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x5707d8;})});}_0x3aae93=_['merge']({},_0x3aae93,_0x687d26[_0xaed1('0x39')]);return _0x17d2a2['getFields'](_0x3aae93);}})[_0xaed1('0x20')](function(_0x435d0e){if(_0x435d0e){_0x384979=_0x435d0e['length'];if(!_0x687d26[_0xaed1('0x2d')][_0xaed1('0x46')]('nolimit')){_0x3aae93[_0xaed1('0x1a')]=qs[_0xaed1('0x1a')](_0x687d26[_0xaed1('0x2d')][_0xaed1('0x1a')]);_0x3aae93[_0xaed1('0x19')]=qs[_0xaed1('0x19')](_0x687d26['query'][_0xaed1('0x19')]);}return _0x17d2a2[_0xaed1('0x44')](_0x3aae93);}})[_0xaed1('0x20')](function(_0xafc980){if(_0xafc980){return _0xafc980?{'count':_0x384979,'rows':_0xafc980}:null;}})[_0xaed1('0x20')](respondWithResult(_0x445bcf,null))[_0xaed1('0x3d')](handleError(_0x445bcf,null));};exports[_0xaed1('0x47')]=function(_0x2bc779,_0x55d79,_0x2c9f66){var _0x44ad79={};var _0x5cd0d6={};var _0x3220ea;var _0x4e477b;return db[_0xaed1('0x27')][_0xaed1('0x45')]({'where':{'id':_0x2bc779[_0xaed1('0x3f')]['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x55d79,null))[_0xaed1('0x20')](function(_0x3ac395){if(_0x3ac395){_0x3220ea=_0x3ac395;_0x5cd0d6[_0xaed1('0x2c')]=_[_0xaed1('0x2e')](db[_0xaed1('0x48')][_0xaed1('0x28')]);_0x5cd0d6[_0xaed1('0x2d')]=_['keys'](_0x2bc779[_0xaed1('0x2d')]);_0x5cd0d6[_0xaed1('0x2f')]=_['intersection'](_0x5cd0d6[_0xaed1('0x2c')],_0x5cd0d6['query']);_0x44ad79[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x5cd0d6[_0xaed1('0x2c')],qs['fields'](_0x2bc779[_0xaed1('0x2d')]['fields']));_0x44ad79['attributes']=_0x44ad79[_0xaed1('0x30')][_0xaed1('0x40')]?_0x44ad79[_0xaed1('0x30')]:_0x5cd0d6[_0xaed1('0x2c')];_0x44ad79['order']=qs[_0xaed1('0x34')](_0x2bc779[_0xaed1('0x2d')]['sort']);_0x44ad79[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_[_0xaed1('0x49')](_0x2bc779[_0xaed1('0x2d')],_0x5cd0d6[_0xaed1('0x2f')]));if(_0x2bc779['query']['filter']){_0x44ad79[_0xaed1('0x35')]=_[_0xaed1('0x36')](_0x44ad79[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x44ad79[_0xaed1('0x30')],function(_0x22d8d3){var _0x139cfb={};_0x139cfb[_0x22d8d3]={'$like':'%'+_0x2bc779[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x139cfb;})});}_0x44ad79=_[_0xaed1('0x36')]({},_0x44ad79,_0x2bc779[_0xaed1('0x39')]);return _0x3220ea['getSubjects'](_0x44ad79);}})[_0xaed1('0x20')](function(_0x328475){if(_0x328475){_0x4e477b=_0x328475[_0xaed1('0x40')];if(!_0x2bc779[_0xaed1('0x2d')][_0xaed1('0x46')](_0xaed1('0x4a'))){_0x44ad79[_0xaed1('0x1a')]=qs['limit'](_0x2bc779[_0xaed1('0x2d')]['limit']);_0x44ad79[_0xaed1('0x19')]=qs['offset'](_0x2bc779[_0xaed1('0x2d')][_0xaed1('0x19')]);}return _0x3220ea[_0xaed1('0x47')](_0x44ad79);}})[_0xaed1('0x20')](function(_0x30282f){if(_0x30282f){return _0x30282f?{'count':_0x4e477b,'rows':_0x30282f}:null;}})[_0xaed1('0x20')](respondWithResult(_0x55d79,null))['catch'](handleError(_0x55d79,null));};exports[_0xaed1('0x4b')]=function(_0x2ef006,_0x518da9,_0x4e39bb){var _0x548fcc={};var _0x54a251={};var _0x25c2d7;var _0x21338a;return db[_0xaed1('0x27')]['findOne']({'where':{'id':_0x2ef006['params']['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x518da9,null))[_0xaed1('0x20')](function(_0x781da1){if(_0x781da1){_0x25c2d7=_0x781da1;_0x54a251[_0xaed1('0x2c')]=_['keys'](db[_0xaed1('0x48')]['rawAttributes']);_0x54a251['query']=_[_0xaed1('0x2e')](_0x2ef006[_0xaed1('0x2d')]);_0x54a251['filters']=_[_0xaed1('0x31')](_0x54a251['model'],_0x54a251['query']);_0x548fcc[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0x54a251[_0xaed1('0x2c')],qs[_0xaed1('0x32')](_0x2ef006[_0xaed1('0x2d')]['fields']));_0x548fcc['attributes']=_0x548fcc[_0xaed1('0x30')]['length']?_0x548fcc['attributes']:_0x54a251[_0xaed1('0x2c')];_0x548fcc[_0xaed1('0x33')]=qs[_0xaed1('0x34')](_0x2ef006['query'][_0xaed1('0x34')]);_0x548fcc[_0xaed1('0x35')]=qs['filters'](_[_0xaed1('0x49')](_0x2ef006[_0xaed1('0x2d')],_0x54a251[_0xaed1('0x2f')]));if(_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x38')]){_0x548fcc[_0xaed1('0x35')]=_['merge'](_0x548fcc['where'],{'$or':_[_0xaed1('0x26')](_0x548fcc[_0xaed1('0x30')],function(_0x9e01fe){var _0x6ff006={};_0x6ff006[_0x9e01fe]={'$like':'%'+_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x6ff006;})});}_0x548fcc=_['merge']({},_0x548fcc,_0x2ef006[_0xaed1('0x39')]);return _0x25c2d7[_0xaed1('0x4b')](_0x548fcc);}})['then'](function(_0x117095){if(_0x117095){_0x21338a=_0x117095['length'];if(!_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x46')](_0xaed1('0x4a'))){_0x548fcc[_0xaed1('0x1a')]=qs['limit'](_0x2ef006[_0xaed1('0x2d')][_0xaed1('0x1a')]);_0x548fcc[_0xaed1('0x19')]=qs[_0xaed1('0x19')](_0x2ef006['query']['offset']);}return _0x25c2d7[_0xaed1('0x4b')](_0x548fcc);}})[_0xaed1('0x20')](function(_0x22bfd1){if(_0x22bfd1){return _0x22bfd1?{'count':_0x21338a,'rows':_0x22bfd1}:null;}})[_0xaed1('0x20')](respondWithResult(_0x518da9,null))[_0xaed1('0x3d')](handleError(_0x518da9,null));};exports[_0xaed1('0x4c')]=function(_0x2b6332,_0x43534b,_0x53316a){var _0x370055={};var _0xca32dd={};var _0x1c579e;var _0x850c9;return db['FreshdeskConfiguration'][_0xaed1('0x45')]({'where':{'id':_0x2b6332['params']['id']}})['then'](handleEntityNotFound(_0x43534b,null))[_0xaed1('0x20')](function(_0x272784){if(_0x272784){_0x1c579e=_0x272784;_0xca32dd['model']=_[_0xaed1('0x2e')](db[_0xaed1('0x4d')][_0xaed1('0x28')]);_0xca32dd['query']=_[_0xaed1('0x2e')](_0x2b6332[_0xaed1('0x2d')]);_0xca32dd[_0xaed1('0x2f')]=_[_0xaed1('0x31')](_0xca32dd[_0xaed1('0x2c')],_0xca32dd['query']);_0x370055[_0xaed1('0x30')]=_[_0xaed1('0x31')](_0xca32dd[_0xaed1('0x2c')],qs[_0xaed1('0x32')](_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x32')]));_0x370055[_0xaed1('0x30')]=_0x370055[_0xaed1('0x30')][_0xaed1('0x40')]?_0x370055[_0xaed1('0x30')]:_0xca32dd[_0xaed1('0x2c')];_0x370055['order']=qs['sort'](_0x2b6332[_0xaed1('0x2d')]['sort']);_0x370055[_0xaed1('0x35')]=qs[_0xaed1('0x2f')](_[_0xaed1('0x49')](_0x2b6332[_0xaed1('0x2d')],_0xca32dd[_0xaed1('0x2f')]));if(_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x38')]){_0x370055['where']=_[_0xaed1('0x36')](_0x370055[_0xaed1('0x35')],{'$or':_[_0xaed1('0x26')](_0x370055[_0xaed1('0x30')],function(_0x422219){var _0x3cdd38={};_0x3cdd38[_0x422219]={'$like':'%'+_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x38')]+'%'};return _0x3cdd38;})});}_0x370055=_[_0xaed1('0x36')]({},_0x370055,_0x2b6332[_0xaed1('0x39')]);return _0x1c579e['getTags'](_0x370055);}})['then'](function(_0x4bf66a){if(_0x4bf66a){_0x850c9=_0x4bf66a[_0xaed1('0x40')];if(!_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x46')](_0xaed1('0x4a'))){_0x370055[_0xaed1('0x1a')]=qs[_0xaed1('0x1a')](_0x2b6332['query'][_0xaed1('0x1a')]);_0x370055[_0xaed1('0x19')]=qs['offset'](_0x2b6332[_0xaed1('0x2d')][_0xaed1('0x19')]);}return _0x1c579e['getTags'](_0x370055);}})['then'](function(_0x4f879a){if(_0x4f879a){return _0x4f879a?{'count':_0x850c9,'rows':_0x4f879a}:null;}})[_0xaed1('0x20')](respondWithResult(_0x43534b,null))[_0xaed1('0x3d')](handleError(_0x43534b,null));};exports[_0xaed1('0x4e')]=function(_0x173f71,_0x12bf84,_0x3a40e5){if(_0x173f71['body']['id']){delete _0x173f71[_0xaed1('0x42')]['id'];}return db[_0xaed1('0x27')][_0xaed1('0x45')]({'where':{'id':_0x173f71[_0xaed1('0x3f')]['id']}})[_0xaed1('0x20')](handleEntityNotFound(_0x12bf84,null))[_0xaed1('0x20')](function(_0x2f467c){if(_0x2f467c){return _0x2f467c[_0xaed1('0x4e')](_0x173f71['body'][_0xaed1('0x4f')]||[]);}return null;})[_0xaed1('0x20')](respondWithResult(_0x12bf84,null))[_0xaed1('0x3d')](handleError(_0x12bf84,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6f1376a..0a6d9ff 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 _0x8628=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x8628,0x1cc));var _0x8862=function(_0x17e686,_0x30d14a){_0x17e686=_0x17e686-0x0;var _0x6a2f97=_0x8628[_0x17e686];return _0x6a2f97;};'use strict';var _=require(_0x8862('0x0'));var util=require(_0x8862('0x1'));var logger=require(_0x8862('0x2'))('api');var moment=require(_0x8862('0x3'));var BPromise=require(_0x8862('0x4'));var rp=require(_0x8862('0x5'));var fs=require('fs');var path=require(_0x8862('0x6'));var rimraf=require(_0x8862('0x7'));var config=require(_0x8862('0x8'));var attributes=require(_0x8862('0x9'));module[_0x8862('0xa')]=function(_0x437c89,_0x395f63){return _0x437c89['define'](_0x8862('0xb'),attributes,{'tableName':_0x8862('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1980=['../../config/environment','exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1980,0xd5));var _0x0198=function(_0x240a4c,_0x46ec17){_0x240a4c=_0x240a4c-0x0;var _0xf57ea4=_0x1980[_0x240a4c];return _0xf57ea4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0198('0x0'))(_0x0198('0x1'));var moment=require(_0x0198('0x2'));var BPromise=require(_0x0198('0x3'));var rp=require(_0x0198('0x4'));var fs=require('fs');var path=require(_0x0198('0x5'));var rimraf=require(_0x0198('0x6'));var config=require(_0x0198('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x0198('0x8')]=function(_0x4f9c84,_0x353c0c){return _0x4f9c84[_0x0198('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 2ab3109..0acb1f1 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 _0x952a=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1b594f,_0x36cdcc){var _0x2b691e=function(_0x5dcdf0){while(--_0x5dcdf0){_0x1b594f['push'](_0x1b594f['shift']());}};_0x2b691e(++_0x36cdcc);}(_0x952a,0x11e));var _0xa952=function(_0x4d970d,_0x4b9767){_0x4d970d=_0x4d970d-0x0;var _0xc3536c=_0x952a[_0x4d970d];return _0xc3536c;};'use strict';var _=require(_0xa952('0x0'));var util=require(_0xa952('0x1'));var moment=require('moment');var BPromise=require(_0xa952('0x2'));var rs=require(_0xa952('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa952('0x4'))['db'];var utils=require(_0xa952('0x5'));var logger=require(_0xa952('0x6'))(_0xa952('0x7'));var config=require(_0xa952('0x8'));var jayson=require(_0xa952('0x9'));var client=jayson[_0xa952('0xa')][_0xa952('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28e60f,_0x1ee957,_0x58176d){return new BPromise(function(_0x5abe52,_0x584d5a){return client[_0xa952('0xc')](_0x28e60f,_0x58176d)[_0xa952('0xd')](function(_0x3ffdd3){logger[_0xa952('0xe')](_0xa952('0xf'),_0x1ee957,_0xa952('0x10'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ee957,'request\x20sent',JSON[_0xa952('0x11')](_0x3ffdd3));if(_0x3ffdd3[_0xa952('0x12')]){if(_0x3ffdd3[_0xa952('0x12')][_0xa952('0x13')]===0x1f4){logger[_0xa952('0x12')](_0xa952('0xf'),_0x1ee957,_0x3ffdd3[_0xa952('0x12')][_0xa952('0x14')]);return _0x584d5a(_0x3ffdd3[_0xa952('0x12')][_0xa952('0x14')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1ee957,_0x3ffdd3['error']['message']);return _0x5abe52(_0x3ffdd3['error']['message']);}else{logger[_0xa952('0xe')](_0xa952('0xf'),_0x1ee957,_0xa952('0x10'));_0x5abe52(_0x3ffdd3[_0xa952('0x15')][_0xa952('0x14')]);}})['catch'](function(_0x38866e){logger[_0xa952('0x12')](_0xa952('0xf'),_0x1ee957,_0x38866e);_0x584d5a(_0x38866e);});});} \ No newline at end of file +var _0x8bca=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x404fa0,_0xf828f7){var _0x1d7c6b=function(_0x40b247){while(--_0x40b247){_0x404fa0['push'](_0x404fa0['shift']());}};_0x1d7c6b(++_0xf828f7);}(_0x8bca,0x7b));var _0xa8bc=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x8bca[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xa8bc('0x0'));var util=require(_0xa8bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa8bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8bc('0x3'))['db'];var utils=require(_0xa8bc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8bc('0x5'));var jayson=require(_0xa8bc('0x6'));var client=jayson[_0xa8bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97e309,_0x5ca4da,_0x439846){return new BPromise(function(_0x4b061b,_0x323382){return client[_0xa8bc('0x8')](_0x97e309,_0x439846)[_0xa8bc('0x9')](function(_0xa548d8){logger[_0xa8bc('0xa')](_0xa8bc('0xb'),_0x5ca4da,'request\x20sent');logger[_0xa8bc('0xc')](_0xa8bc('0xd'),_0x5ca4da,_0xa8bc('0xe'),JSON[_0xa8bc('0xf')](_0xa548d8));if(_0xa548d8[_0xa8bc('0x10')]){if(_0xa548d8['error']['code']===0x1f4){logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0x5ca4da,_0xa548d8[_0xa8bc('0x10')]['message']);return _0x323382(_0xa548d8['error']['message']);}logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0x5ca4da,_0xa548d8[_0xa8bc('0x10')][_0xa8bc('0x11')]);return _0x4b061b(_0xa548d8['error'][_0xa8bc('0x11')]);}else{logger['info'](_0xa8bc('0xb'),_0x5ca4da,'request\x20sent');_0x4b061b(_0xa548d8[_0xa8bc('0x12')][_0xa8bc('0x11')]);}})['catch'](function(_0x1fec7f){logger[_0xa8bc('0x10')](_0xa8bc('0xb'),_0x5ca4da,_0x1fec7f);_0x323382(_0x1fec7f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6bd9c07..7bb2871 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 _0x0175=['exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x37472d,_0x3deab9){var _0x36aa63=function(_0xba9460){while(--_0xba9460){_0x37472d['push'](_0x37472d['shift']());}};_0x36aa63(++_0x3deab9);}(_0x0175,0x91));var _0x5017=function(_0x4105a8,_0x198324){_0x4105a8=_0x4105a8-0x0;var _0x553f0c=_0x0175[_0x4105a8];return _0x553f0c;};'use strict';var multer=require(_0x5017('0x0'));var util=require(_0x5017('0x1'));var path=require(_0x5017('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5017('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5017('0x4'));var config=require(_0x5017('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x5017('0x6')]('/',auth[_0x5017('0x7')](),controller[_0x5017('0x8')]);router[_0x5017('0x6')](_0x5017('0x9'),auth[_0x5017('0x7')](),controller[_0x5017('0xa')]);router[_0x5017('0xb')]('/',auth[_0x5017('0x7')](),controller[_0x5017('0xc')]);router[_0x5017('0xd')](_0x5017('0x9'),auth[_0x5017('0x7')](),controller[_0x5017('0xe')]);router[_0x5017('0xf')](_0x5017('0x9'),auth['isAuthenticated'](),controller[_0x5017('0x10')]);module[_0x5017('0x11')]=router; \ No newline at end of file +var _0xf452=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','/:id','isAuthenticated','show','post','create','put','update','delete','exports'];(function(_0x1745b1,_0x2e6a46){var _0x25bf24=function(_0x6270){while(--_0x6270){_0x1745b1['push'](_0x1745b1['shift']());}};_0x25bf24(++_0x2e6a46);}(_0xf452,0x7e));var _0x2f45=function(_0x3a220e,_0x519fac){_0x3a220e=_0x3a220e-0x0;var _0x344a65=_0xf452[_0x3a220e];return _0x344a65;};'use strict';var multer=require(_0x2f45('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2f45('0x1'));var express=require(_0x2f45('0x2'));var router=express[_0x2f45('0x3')]();var fs_extra=require(_0x2f45('0x4'));var auth=require(_0x2f45('0x5'));var interaction=require(_0x2f45('0x6'));var config=require(_0x2f45('0x7'));var controller=require(_0x2f45('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller[_0x2f45('0xb')]);router[_0x2f45('0xc')]('/',auth[_0x2f45('0xa')](),controller[_0x2f45('0xd')]);router[_0x2f45('0xe')](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller[_0x2f45('0xf')]);router[_0x2f45('0x10')](_0x2f45('0x9'),auth[_0x2f45('0xa')](),controller['destroy']);module[_0x2f45('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 83dad81..aa0fd4f 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 _0x7300=['string','variable','customVariable','STRING','sequelize','ENUM'];(function(_0x211d41,_0x496467){var _0x39f43f=function(_0x52bc05){while(--_0x52bc05){_0x211d41['push'](_0x211d41['shift']());}};_0x39f43f(++_0x496467);}(_0x7300,0x1f0));var _0x0730=function(_0x4131b8,_0x3c4617){_0x4131b8=_0x4131b8-0x0;var _0x210598=_0x7300[_0x4131b8];return _0x210598;};'use strict';var Sequelize=require(_0x0730('0x0'));module['exports']={'type':{'type':Sequelize[_0x0730('0x1')](_0x0730('0x2'),_0x0730('0x3'),_0x0730('0x4'),'keyValue','picklist'),'defaultValue':_0x0730('0x2')},'content':{'type':Sequelize[_0x0730('0x5')]},'key':{'type':Sequelize[_0x0730('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x0730('0x2'),'variable',_0x0730('0x4'))},'keyContent':{'type':Sequelize[_0x0730('0x5')]},'idField':{'type':Sequelize[_0x0730('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7728=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x4fc145,_0x119cf2){var _0x1b0be2=function(_0x5ab1a3){while(--_0x5ab1a3){_0x4fc145['push'](_0x4fc145['shift']());}};_0x1b0be2(++_0x119cf2);}(_0x7728,0x19b));var _0x8772=function(_0x36acb3,_0x204e94){_0x36acb3=_0x36acb3-0x0;var _0x13976c=_0x7728[_0x36acb3];return _0x13976c;};'use strict';var Sequelize=require(_0x8772('0x0'));module[_0x8772('0x1')]={'type':{'type':Sequelize[_0x8772('0x2')]('string',_0x8772('0x3'),_0x8772('0x4'),_0x8772('0x5'),_0x8772('0x6')),'defaultValue':_0x8772('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8772('0x8')]},'keyType':{'type':Sequelize[_0x8772('0x2')](_0x8772('0x7'),'variable',_0x8772('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8772('0x8')]},'nameField':{'type':Sequelize[_0x8772('0x8')]},'customField':{'type':Sequelize[_0x8772('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4a65ebe..ad43f2a 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 _0x49e9=['status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','FreshdeskField','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5b2b0b[_0x949e('0x33')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs['fields'](_0x5b9f28['query'][_0x949e('0x34')]));_0x5b2b0b[_0x949e('0x33')]=_0x5b2b0b[_0x949e('0x33')][_0x949e('0x35')]?_0x5b2b0b['attributes']:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x36')](_0x949e('0x37'))){_0x5b2b0b[_0x949e('0x1c')]=qs[_0x949e('0x1c')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x1c')]);_0x5b2b0b['offset']=qs['offset'](_0x5b9f28[_0x949e('0x2e')]['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x38')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x38')]);_0x5b2b0b[_0x949e('0x39')]=qs[_0x949e('0x30')](_[_0x949e('0x3a')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34[_0x949e('0x30')]),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3b')]){_0x5b2b0b[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5b2b0b[_0x949e('0x39')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0x26ad2b){if(_0x26ad2b[_0x949e('0x3d')]!==_0x949e('0x3e')){var _0x498fa3={};_0x498fa3[_0x26ad2b[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28['query'][_0x949e('0x3b')]+'%'};return _0x498fa3;}})});}_0x5b2b0b=_[_0x949e('0x3c')]({},_0x5b2b0b,_0x5b9f28['options']);var _0x5084dc={'where':_0x5b2b0b['where']};return db[_0x949e('0x2b')][_0x949e('0x1d')](_0x5084dc)['then'](function(_0x59c024){_0x4e169d['count']=_0x59c024;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3f')]){_0x5b2b0b['include']=[{'all':!![]}];}return db[_0x949e('0x2b')][_0x949e('0x40')](_0x5b2b0b);})['then'](function(_0x3a1bc7){_0x4e169d[_0x949e('0x41')]=_0x3a1bc7;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x42')](handleError(_0x1867d9,null));};exports['show']=function(_0x58b34b,_0x2bca69){var _0x590aa7={'raw':!![],'where':{'id':_0x58b34b[_0x949e('0x43')]['id']}},_0x7201da={};_0x7201da[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')]['rawAttributes']);_0x7201da['query']=_[_0x949e('0x2f')](_0x58b34b['query']);_0x7201da[_0x949e('0x30')]=_[_0x949e('0x31')](_0x7201da[_0x949e('0x32')],_0x7201da[_0x949e('0x2e')]);_0x590aa7[_0x949e('0x33')]=_[_0x949e('0x31')](_0x7201da['model'],qs['fields'](_0x58b34b[_0x949e('0x2e')][_0x949e('0x34')]));_0x590aa7[_0x949e('0x33')]=_0x590aa7[_0x949e('0x33')][_0x949e('0x35')]?_0x590aa7['attributes']:_0x7201da[_0x949e('0x32')];if(_0x58b34b[_0x949e('0x2e')]['includeAll']){_0x590aa7[_0x949e('0x44')]=[{'all':!![]}];}_0x590aa7=_[_0x949e('0x3c')]({},_0x590aa7,_0x58b34b[_0x949e('0x45')]);return db[_0x949e('0x2b')][_0x949e('0x46')](_0x590aa7)[_0x949e('0x25')](handleEntityNotFound(_0x2bca69,null))[_0x949e('0x25')](respondWithResult(_0x2bca69,null))[_0x949e('0x42')](handleError(_0x2bca69,null));};exports[_0x949e('0x47')]=function(_0x4913f5,_0x1599ea){return db['FreshdeskField'][_0x949e('0x47')](_0x4913f5[_0x949e('0x48')],{})['then'](respondWithResult(_0x1599ea,0xc9))[_0x949e('0x42')](handleError(_0x1599ea,null));};exports[_0x949e('0x49')]=function(_0x121355,_0x2e2b6a){if(_0x121355[_0x949e('0x48')]['id']){delete _0x121355[_0x949e('0x48')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x46')]({'where':{'id':_0x121355['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x2e2b6a,null))[_0x949e('0x25')](saveUpdates(_0x121355[_0x949e('0x48')],null))[_0x949e('0x25')](respondWithResult(_0x2e2b6a,null))[_0x949e('0x42')](handleError(_0x2e2b6a,null));};exports['destroy']=function(_0x5f23b2,_0x46a4fe){return db[_0x949e('0x2b')]['find']({'where':{'id':_0x5f23b2[_0x949e('0x43')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x46a4fe,null))[_0x949e('0x25')](removeEntity(_0x46a4fe,null))[_0x949e('0x42')](handleError(_0x46a4fe,null));}; \ No newline at end of file +var _0x1b32=['lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','findAll','rows','show','params','fields','length','includeAll','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x1b32,0x85));var _0x21b3=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1b32[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];function respondWithStatusCode(_0x40cc5a,_0x2c7abb){_0x2c7abb=_0x2c7abb||0xcc;return function(_0x3bff49){if(_0x3bff49){return _0x40cc5a[_0x21b3('0x19')](_0x2c7abb);}return _0x40cc5a[_0x21b3('0x1a')](_0x2c7abb)['end']();};}function respondWithResult(_0xa537ad,_0x810f46){_0x810f46=_0x810f46||0xc8;return function(_0x43bede){if(_0x43bede){return _0xa537ad['status'](_0x810f46)[_0x21b3('0x1b')](_0x43bede);}};}function respondWithFilteredResult(_0x4c931d,_0x3f7b4a){return function(_0x579a37){if(_0x579a37){var _0x15662a=typeof _0x3f7b4a[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x3f7b4a[_0x21b3('0x1e')]==='undefined';var _0x3f7e7a=_0x579a37['count'];var _0x408c17=_0x15662a?0x0:_0x3f7b4a[_0x21b3('0x1c')];var _0xaf1eba=_0x15662a?_0x579a37[_0x21b3('0x1f')]:_0x3f7b4a['offset']+_0x3f7b4a[_0x21b3('0x1e')];var _0x1e31bb;if(_0xaf1eba>=_0x3f7e7a){_0xaf1eba=_0x3f7e7a;_0x1e31bb=0xc8;}else{_0x1e31bb=0xce;}_0x4c931d[_0x21b3('0x1a')](_0x1e31bb);return _0x4c931d['set'](_0x21b3('0x20'),_0x408c17+'-'+_0xaf1eba+'/'+_0x3f7e7a)[_0x21b3('0x1b')](_0x579a37);}return null;};}function patchUpdates(_0x2f996d){return function(_0x3fe141){try{jsonpatch[_0x21b3('0x21')](_0x3fe141,_0x2f996d,!![]);}catch(_0x1be234){return BPromise[_0x21b3('0x22')](_0x1be234);}return _0x3fe141['save']();};}function saveUpdates(_0xbb78f3,_0x54695b){return function(_0x139672){if(_0x139672){return _0x139672[_0x21b3('0x23')](_0xbb78f3)[_0x21b3('0x24')](function(_0x4fcb87){return _0x4fcb87;});}return null;};}function removeEntity(_0x19ba2c,_0x5bda6e){return function(_0x3ee234){if(_0x3ee234){return _0x3ee234[_0x21b3('0x25')]()[_0x21b3('0x24')](function(){_0x19ba2c[_0x21b3('0x1a')](0xcc)[_0x21b3('0x26')]();});}};}function handleEntityNotFound(_0x2e3221,_0x58822d){return function(_0x5b752c){if(!_0x5b752c){_0x2e3221['sendStatus'](0x194);}return _0x5b752c;};}function handleError(_0x3ca89d,_0x2e3758){_0x2e3758=_0x2e3758||0x1f4;return function(_0x3c1a3b){logger[_0x21b3('0x27')](_0x3c1a3b[_0x21b3('0x28')]);if(_0x3c1a3b['name']){delete _0x3c1a3b[_0x21b3('0x29')];}_0x3ca89d['status'](_0x2e3758)[_0x21b3('0x2a')](_0x3c1a3b);};}exports['index']=function(_0x469e42,_0xf48fc7){var _0x81ee7e={},_0x4f6432={},_0x291e52={'count':0x0,'rows':[]};var _0x300977=_[_0x21b3('0x2b')](db[_0x21b3('0x2c')][_0x21b3('0x2d')],function(_0x210c49){return{'name':_0x210c49[_0x21b3('0x2e')],'type':_0x210c49['type']['key']};});_0x4f6432[_0x21b3('0x2f')]=_[_0x21b3('0x2b')](_0x300977,'name');_0x4f6432[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x469e42[_0x21b3('0x30')]);_0x4f6432[_0x21b3('0x32')]=_[_0x21b3('0x33')](_0x4f6432[_0x21b3('0x2f')],_0x4f6432[_0x21b3('0x30')]);_0x81ee7e[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x4f6432['model'],qs['fields'](_0x469e42[_0x21b3('0x30')]['fields']));_0x81ee7e[_0x21b3('0x34')]=_0x81ee7e[_0x21b3('0x34')]['length']?_0x81ee7e[_0x21b3('0x34')]:_0x4f6432[_0x21b3('0x2f')];if(!_0x469e42[_0x21b3('0x30')][_0x21b3('0x35')]('nolimit')){_0x81ee7e[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x1e')]);_0x81ee7e['offset']=qs[_0x21b3('0x1c')](_0x469e42['query'][_0x21b3('0x1c')]);}_0x81ee7e[_0x21b3('0x36')]=qs[_0x21b3('0x37')](_0x469e42[_0x21b3('0x30')][_0x21b3('0x37')]);_0x81ee7e[_0x21b3('0x38')]=qs[_0x21b3('0x32')](_['pick'](_0x469e42['query'],_0x4f6432[_0x21b3('0x32')]),_0x300977);if(_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]){_0x81ee7e[_0x21b3('0x38')]=_['merge'](_0x81ee7e[_0x21b3('0x38')],{'$or':_[_0x21b3('0x2b')](_0x300977,function(_0x128564){if(_0x128564[_0x21b3('0x3a')]!==_0x21b3('0x3b')){var _0xb028ca={};_0xb028ca[_0x128564[_0x21b3('0x29')]]={'$like':'%'+_0x469e42[_0x21b3('0x30')][_0x21b3('0x39')]+'%'};return _0xb028ca;}})});}_0x81ee7e=_[_0x21b3('0x3c')]({},_0x81ee7e,_0x469e42[_0x21b3('0x3d')]);var _0x4facfc={'where':_0x81ee7e[_0x21b3('0x38')]};return db[_0x21b3('0x2c')]['count'](_0x4facfc)[_0x21b3('0x24')](function(_0x5f2623){_0x291e52[_0x21b3('0x1f')]=_0x5f2623;if(_0x469e42[_0x21b3('0x30')]['includeAll']){_0x81ee7e['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x21b3('0x3e')](_0x81ee7e);})[_0x21b3('0x24')](function(_0x3e6501){_0x291e52[_0x21b3('0x3f')]=_0x3e6501;return _0x291e52;})['then'](respondWithFilteredResult(_0xf48fc7,_0x81ee7e))['catch'](handleError(_0xf48fc7,null));};exports[_0x21b3('0x40')]=function(_0x492eaf,_0x1c97e7){var _0x28adbc={'raw':!![],'where':{'id':_0x492eaf[_0x21b3('0x41')]['id']}},_0x306bf2={};_0x306bf2[_0x21b3('0x2f')]=_['keys'](db[_0x21b3('0x2c')][_0x21b3('0x2d')]);_0x306bf2[_0x21b3('0x30')]=_[_0x21b3('0x31')](_0x492eaf[_0x21b3('0x30')]);_0x306bf2[_0x21b3('0x32')]=_['intersection'](_0x306bf2['model'],_0x306bf2[_0x21b3('0x30')]);_0x28adbc[_0x21b3('0x34')]=_[_0x21b3('0x33')](_0x306bf2['model'],qs[_0x21b3('0x42')](_0x492eaf[_0x21b3('0x30')][_0x21b3('0x42')]));_0x28adbc[_0x21b3('0x34')]=_0x28adbc[_0x21b3('0x34')][_0x21b3('0x43')]?_0x28adbc['attributes']:_0x306bf2[_0x21b3('0x2f')];if(_0x492eaf[_0x21b3('0x30')][_0x21b3('0x44')]){_0x28adbc['include']=[{'all':!![]}];}_0x28adbc=_['merge']({},_0x28adbc,_0x492eaf['options']);return db[_0x21b3('0x2c')][_0x21b3('0x45')](_0x28adbc)[_0x21b3('0x24')](handleEntityNotFound(_0x1c97e7,null))[_0x21b3('0x24')](respondWithResult(_0x1c97e7,null))[_0x21b3('0x46')](handleError(_0x1c97e7,null));};exports[_0x21b3('0x47')]=function(_0xc51c1d,_0x30d48b){return db[_0x21b3('0x2c')]['create'](_0xc51c1d['body'],{})['then'](respondWithResult(_0x30d48b,0xc9))[_0x21b3('0x46')](handleError(_0x30d48b,null));};exports[_0x21b3('0x23')]=function(_0x4046cd,_0x2e4add){if(_0x4046cd[_0x21b3('0x48')]['id']){delete _0x4046cd[_0x21b3('0x48')]['id'];}return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x4046cd[_0x21b3('0x41')]['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0x2e4add,null))['then'](saveUpdates(_0x4046cd[_0x21b3('0x48')],null))[_0x21b3('0x24')](respondWithResult(_0x2e4add,null))[_0x21b3('0x46')](handleError(_0x2e4add,null));};exports[_0x21b3('0x25')]=function(_0x34509e,_0x2c7019){return db[_0x21b3('0x2c')][_0x21b3('0x45')]({'where':{'id':_0x34509e[_0x21b3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c7019,null))[_0x21b3('0x24')](removeEntity(_0x2c7019,null))[_0x21b3('0x46')](handleError(_0x2c7019,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5d410c1..829e133 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 _0xb73b=['rimraf','./intFreshdeskField.attributes','FreshdeskField','freshdesk_unique_index','idField','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5af812,_0x43d252){var _0x1489f2=function(_0x1c7fa9){while(--_0x1c7fa9){_0x5af812['push'](_0x5af812['shift']());}};_0x1489f2(++_0x43d252);}(_0xb73b,0x14f));var _0xbb73=function(_0x2b1661,_0x12fb47){_0x2b1661=_0x2b1661-0x0;var _0x32ca92=_0xb73b[_0x2b1661];return _0x32ca92;};'use strict';var _=require(_0xbb73('0x0'));var util=require(_0xbb73('0x1'));var logger=require('../../config/logger')(_0xbb73('0x2'));var moment=require(_0xbb73('0x3'));var BPromise=require(_0xbb73('0x4'));var rp=require(_0xbb73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb73('0x6'));var config=require('../../config/environment');var attributes=require(_0xbb73('0x7'));module['exports']=function(_0x32262,_0x33b17c){return _0x32262['define'](_0xbb73('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xbb73('0x9'),'fields':[_0xbb73('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x525e=['../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x525e,0x78));var _0xe525=function(_0x50f6fc,_0x197e4d){_0x50f6fc=_0x50f6fc-0x0;var _0x161ddb=_0x525e[_0x50f6fc];return _0x161ddb;};'use strict';var _=require(_0xe525('0x0'));var util=require(_0xe525('0x1'));var logger=require(_0xe525('0x2'))(_0xe525('0x3'));var moment=require(_0xe525('0x4'));var BPromise=require(_0xe525('0x5'));var rp=require(_0xe525('0x6'));var fs=require('fs');var path=require(_0xe525('0x7'));var rimraf=require('rimraf');var config=require(_0xe525('0x8'));var attributes=require(_0xe525('0x9'));module[_0xe525('0xa')]=function(_0x59a6b6,_0x4c68a3){return _0x59a6b6[_0xe525('0xb')]('FreshdeskField',attributes,{'tableName':_0xe525('0xc'),'paranoid':![],'indexes':[{'name':_0xe525('0xd'),'fields':[_0xe525('0xe'),_0xe525('0xf')],'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 887e1df..88bf2e2 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 _0x390e=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x4a6e60,_0x199e30){var _0x14f4cb=function(_0x4ea705){while(--_0x4ea705){_0x4a6e60['push'](_0x4a6e60['shift']());}};_0x14f4cb(++_0x199e30);}(_0x390e,0x106));var _0xe390=function(_0x15fe06,_0x41d46c){_0x15fe06=_0x15fe06-0x0;var _0x24aaa4=_0x390e[_0x15fe06];return _0x24aaa4;};'use strict';var _=require(_0xe390('0x0'));var util=require(_0xe390('0x1'));var moment=require('moment');var BPromise=require(_0xe390('0x2'));var rs=require(_0xe390('0x3'));var fs=require('fs');var Redis=require(_0xe390('0x4'));var db=require(_0xe390('0x5'))['db'];var utils=require(_0xe390('0x6'));var logger=require(_0xe390('0x7'))(_0xe390('0x8'));var config=require(_0xe390('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe390('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x446de5,_0x2aafa2,_0x494a6f){return new BPromise(function(_0x28fb19,_0x36be8b){return client[_0xe390('0xb')](_0x446de5,_0x494a6f)[_0xe390('0xc')](function(_0x3b9791){logger[_0xe390('0xd')](_0xe390('0xe'),_0x2aafa2,_0xe390('0xf'));logger[_0xe390('0x10')](_0xe390('0x11'),_0x2aafa2,'request\x20sent',JSON[_0xe390('0x12')](_0x3b9791));if(_0x3b9791[_0xe390('0x13')]){if(_0x3b9791['error'][_0xe390('0x14')]===0x1f4){logger['error'](_0xe390('0xe'),_0x2aafa2,_0x3b9791[_0xe390('0x13')][_0xe390('0x15')]);return _0x36be8b(_0x3b9791[_0xe390('0x13')][_0xe390('0x15')]);}logger['error'](_0xe390('0xe'),_0x2aafa2,_0x3b9791[_0xe390('0x13')]['message']);return _0x28fb19(_0x3b9791['error']['message']);}else{logger[_0xe390('0xd')](_0xe390('0xe'),_0x2aafa2,_0xe390('0xf'));_0x28fb19(_0x3b9791['result'][_0xe390('0x15')]);}})[_0xe390('0x16')](function(_0x120a91){logger[_0xe390('0x13')](_0xe390('0xe'),_0x2aafa2,_0x120a91);_0x36be8b(_0x120a91);});});} \ No newline at end of file +var _0x5c91=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4443f6,_0x256b10){var _0x4885de=function(_0x2a51c5){while(--_0x2a51c5){_0x4443f6['push'](_0x4443f6['shift']());}};_0x4885de(++_0x256b10);}(_0x5c91,0x1df));var _0x15c9=function(_0x4e5ee2,_0x46666d){_0x4e5ee2=_0x4e5ee2-0x0;var _0x151961=_0x5c91[_0x4e5ee2];return _0x151961;};'use strict';var _=require('lodash');var util=require(_0x15c9('0x0'));var moment=require('moment');var BPromise=require(_0x15c9('0x1'));var rs=require(_0x15c9('0x2'));var fs=require('fs');var Redis=require(_0x15c9('0x3'));var db=require(_0x15c9('0x4'))['db'];var utils=require(_0x15c9('0x5'));var logger=require(_0x15c9('0x6'))(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31515e,_0x454cac,_0x412329){return new BPromise(function(_0x16bc56,_0x269dc6){return client[_0x15c9('0xc')](_0x31515e,_0x412329)[_0x15c9('0xd')](function(_0x5bc3aa){logger[_0x15c9('0xe')](_0x15c9('0xf'),_0x454cac,_0x15c9('0x10'));logger['debug'](_0x15c9('0x11'),_0x454cac,_0x15c9('0x10'),JSON['stringify'](_0x5bc3aa));if(_0x5bc3aa[_0x15c9('0x12')]){if(_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x13')]===0x1f4){logger[_0x15c9('0x12')](_0x15c9('0xf'),_0x454cac,_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x14')]);return _0x269dc6(_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x14')]);}logger['error'](_0x15c9('0xf'),_0x454cac,_0x5bc3aa[_0x15c9('0x12')][_0x15c9('0x14')]);return _0x16bc56(_0x5bc3aa[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x454cac,_0x15c9('0x10'));_0x16bc56(_0x5bc3aa[_0x15c9('0x15')]['message']);}})['catch'](function(_0x248577){logger[_0x15c9('0x12')](_0x15c9('0xf'),_0x454cac,_0x248577);_0x269dc6(_0x248577);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 1de6708..9276417 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 _0x0713=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete'];(function(_0x17411f,_0x3067fb){var _0x4e0501=function(_0xd3105c){while(--_0xd3105c){_0x17411f['push'](_0x17411f['shift']());}};_0x4e0501(++_0x3067fb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getConfigurations']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x10')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['put']('/:id',auth[_0x3071('0x9')](),controller['update']);router[_0x3071('0x13')](_0x3071('0xb'),auth['isAuthenticated'](),controller[_0x3071('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1d2d=['multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports'];(function(_0x44c0a9,_0xa5507b){var _0x5dcc53=function(_0x4a8848){while(--_0x4a8848){_0x44c0a9['push'](_0x44c0a9['shift']());}};_0x5dcc53(++_0xa5507b);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5333c1,_0xbeccbd){_0x5333c1=_0x5333c1-0x0;var _0x3c4155=_0x1d2d[_0x5333c1];return _0x3c4155;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var fs_extra=require(_0xd1d2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d2('0x6'));var controller=require(_0xd1d2('0x7'));router[_0xd1d2('0x8')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0x8')]('/:id',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x8')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0x8')](_0xd1d2('0xe'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x11')]);router['post'](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x12')]);router[_0xd1d2('0x13')](_0xd1d2('0x14'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x15')]);router[_0xd1d2('0x16')](_0xd1d2('0x14'),auth[_0xd1d2('0x9')](),controller['destroy']);module[_0xd1d2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 040ba34..e69dd48 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 _0xbbbc=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4e46e4,_0x47e97d){var _0xa22824=function(_0xff0dd5){while(--_0xff0dd5){_0x4e46e4['push'](_0x4e46e4['shift']());}};_0xa22824(++_0x47e97d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2a4aef,_0x4ab35d){_0x2a4aef=_0x2a4aef-0x0;var _0xdab266=_0xbbbc[_0x2a4aef];return _0xdab266;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'name':{'type':Sequelize[_0xcbbb('0x2')]},'description':{'type':Sequelize[_0xcbbb('0x2')]},'username':{'type':Sequelize[_0xcbbb('0x2')],'unique':_0xcbbb('0x3')},'apiKey':{'type':Sequelize[_0xcbbb('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcbbb('0x4')},'serverUrl':{'type':Sequelize[_0xcbbb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2c0e46,_0x428bbf){var _0x50b247=function(_0x13d93b){while(--_0x13d93b){_0x2c0e46['push'](_0x2c0e46['shift']());}};_0x50b247(++_0x428bbf);}(_0x2ef3,0xba));var _0x32ef=function(_0x404686,_0x152e7a){_0x404686=_0x404686-0x0;var _0x596ee3=_0x2ef3[_0x404686];return _0x596ee3;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'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 65b940d..68404cd 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 _0x052b=['username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','limit','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','keys','filters','includeAll','find','create','catch','body','getConfigurations','FreshsalesConfiguration','sort','hasOwnProperty','findOne','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields'];(function(_0x2904a8,_0x73180){var _0x4aae50=function(_0x491df9){while(--_0x491df9){_0x2904a8['push'](_0x2904a8['shift']());}};_0x4aae50(++_0x73180);}(_0x052b,0x1ab));var _0xb052=function(_0x138d07,_0x32371b){_0x138d07=_0x138d07-0x0;var _0x4bd240=_0x052b[_0x138d07];return _0x4bd240;};'use strict';var emlformat=require(_0xb052('0x0'));var rimraf=require(_0xb052('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb052('0x2'));var moment=require('moment');var BPromise=require(_0xb052('0x3'));var Mustache=require(_0xb052('0x4'));var util=require(_0xb052('0x5'));var path=require(_0xb052('0x6'));var sox=require('sox');var csv=require(_0xb052('0x7'));var ejs=require(_0xb052('0x8'));var fs=require('fs');var fs_extra=require(_0xb052('0x9'));var _=require('lodash');var squel=require(_0xb052('0xa'));var crypto=require(_0xb052('0xb'));var jsforce=require(_0xb052('0xc'));var deskjs=require(_0xb052('0xd'));var toCsv=require(_0xb052('0x7'));var querystring=require(_0xb052('0xe'));var Papa=require(_0xb052('0xf'));var Redis=require(_0xb052('0x10'));var authService=require(_0xb052('0x11'));var qs=require(_0xb052('0x12'));var as=require(_0xb052('0x13'));var hardwareService=require(_0xb052('0x14'));var logger=require(_0xb052('0x15'))(_0xb052('0x16'));var utils=require(_0xb052('0x17'));var config=require(_0xb052('0x18'));var licenseUtil=require(_0xb052('0x19'));var db=require(_0xb052('0x1a'))['db'];var integrations=require(_0xb052('0x1b'));function respondWithStatusCode(_0x419b9a,_0x563b79){_0x563b79=_0x563b79||0xcc;return function(_0x6112c){if(_0x6112c){return _0x419b9a[_0xb052('0x1c')](_0x563b79);}return _0x419b9a[_0xb052('0x1d')](_0x563b79)[_0xb052('0x1e')]();};}function respondWithResult(_0x2cd84c,_0x87767){_0x87767=_0x87767||0xc8;return function(_0x27f904){if(_0x27f904){return _0x2cd84c[_0xb052('0x1d')](_0x87767)[_0xb052('0x1f')](_0x27f904);}};}function respondWithFilteredResult(_0x39c2fb,_0x4e0d0d){return function(_0x150dc6){if(_0x150dc6){var _0xf07266=typeof _0x4e0d0d[_0xb052('0x20')]===_0xb052('0x21')&&typeof _0x4e0d0d['limit']===_0xb052('0x21');var _0x3fac4c=_0x150dc6[_0xb052('0x22')];var _0x10dba8=_0xf07266?0x0:_0x4e0d0d[_0xb052('0x20')];var _0x45d257=_0xf07266?_0x150dc6[_0xb052('0x22')]:_0x4e0d0d[_0xb052('0x20')]+_0x4e0d0d['limit'];var _0x1f9932;if(_0x45d257>=_0x3fac4c){_0x45d257=_0x3fac4c;_0x1f9932=0xc8;}else{_0x1f9932=0xce;}_0x39c2fb[_0xb052('0x1d')](_0x1f9932);return _0x39c2fb['set']('Content-Range',_0x10dba8+'-'+_0x45d257+'/'+_0x3fac4c)[_0xb052('0x1f')](_0x150dc6);}return null;};}function patchUpdates(_0x15e3d6){return function(_0x59c2b0){try{jsonpatch[_0xb052('0x23')](_0x59c2b0,_0x15e3d6,!![]);}catch(_0x417d78){return BPromise[_0xb052('0x24')](_0x417d78);}return _0x59c2b0[_0xb052('0x25')]();};}function saveUpdates(_0x893c0,_0x3fe1d7){return function(_0x41179f){if(_0x41179f){return _0x41179f[_0xb052('0x26')](_0x893c0)[_0xb052('0x27')](function(_0x90a34){return _0x90a34;});}return null;};}function removeEntity(_0x2d7696,_0xc40ca0){return function(_0x595b09){if(_0x595b09){return _0x595b09[_0xb052('0x28')]()[_0xb052('0x27')](function(){_0x2d7696[_0xb052('0x1d')](0xcc)[_0xb052('0x1e')]();});}};}function handleEntityNotFound(_0x1bcf5a,_0x22872b){return function(_0x57c5ae){if(!_0x57c5ae){_0x1bcf5a['sendStatus'](0x194);}return _0x57c5ae;};}function handleError(_0x17b5d6,_0x497cf8){_0x497cf8=_0x497cf8||0x1f4;return function(_0x218720){logger[_0xb052('0x29')](_0x218720['stack']);if(_0x218720[_0xb052('0x2a')]){delete _0x218720['name'];}_0x17b5d6[_0xb052('0x1d')](_0x497cf8)[_0xb052('0x2b')](_0x218720);};}exports[_0xb052('0x2c')]=function(_0x1059c2,_0x5989ce){var _0x2306a3={},_0x532ffb={},_0x358452={'count':0x0,'rows':[]};var _0x38e6cd=_[_0xb052('0x2d')](db[_0xb052('0x2e')][_0xb052('0x2f')],function(_0x3da85d){return{'name':_0x3da85d[_0xb052('0x30')],'type':_0x3da85d[_0xb052('0x31')][_0xb052('0x32')]};});_0x532ffb[_0xb052('0x33')]=_[_0xb052('0x2d')](_0x38e6cd,_0xb052('0x2a'));_0x532ffb['query']=_['keys'](_0x1059c2[_0xb052('0x34')]);_0x532ffb['filters']=_['intersection'](_0x532ffb[_0xb052('0x33')],_0x532ffb[_0xb052('0x34')]);_0x2306a3['attributes']=_[_0xb052('0x35')](_0x532ffb[_0xb052('0x33')],qs[_0xb052('0x36')](_0x1059c2[_0xb052('0x34')][_0xb052('0x36')]));_0x2306a3[_0xb052('0x37')]=_0x2306a3[_0xb052('0x37')][_0xb052('0x38')]?_0x2306a3['attributes']:_0x532ffb['model'];if(!_0x1059c2['query']['hasOwnProperty'](_0xb052('0x39'))){_0x2306a3['limit']=qs[_0xb052('0x3a')](_0x1059c2[_0xb052('0x34')][_0xb052('0x3a')]);_0x2306a3['offset']=qs[_0xb052('0x20')](_0x1059c2[_0xb052('0x34')][_0xb052('0x20')]);}_0x2306a3['order']=qs['sort'](_0x1059c2[_0xb052('0x34')]['sort']);_0x2306a3[_0xb052('0x3b')]=qs['filters'](_[_0xb052('0x3c')](_0x1059c2[_0xb052('0x34')],_0x532ffb['filters']),_0x38e6cd);if(_0x1059c2[_0xb052('0x34')]['filter']){_0x2306a3[_0xb052('0x3b')]=_[_0xb052('0x3d')](_0x2306a3['where'],{'$or':_['map'](_0x38e6cd,function(_0x3bda33){if(_0x3bda33[_0xb052('0x31')]!==_0xb052('0x3e')){var _0x2a9198={};_0x2a9198[_0x3bda33['name']]={'$like':'%'+_0x1059c2[_0xb052('0x34')][_0xb052('0x3f')]+'%'};return _0x2a9198;}})});}_0x2306a3=_[_0xb052('0x3d')]({},_0x2306a3,_0x1059c2[_0xb052('0x40')]);var _0x5c0c67={'where':_0x2306a3[_0xb052('0x3b')]};return db[_0xb052('0x2e')][_0xb052('0x22')](_0x5c0c67)[_0xb052('0x27')](function(_0x2f99dc){_0x358452[_0xb052('0x22')]=_0x2f99dc;if(_0x1059c2[_0xb052('0x34')]['includeAll']){_0x2306a3[_0xb052('0x41')]=[{'all':!![]}];}return db[_0xb052('0x2e')]['findAll'](_0x2306a3);})[_0xb052('0x27')](function(_0x29528e){_0x358452[_0xb052('0x42')]=_0x29528e;return _0x358452;})[_0xb052('0x27')](respondWithFilteredResult(_0x5989ce,_0x2306a3))['catch'](handleError(_0x5989ce,null));};exports[_0xb052('0x43')]=function(_0x4e8583,_0x74db7b){var _0x30c4f0={'raw':![],'where':{'id':_0x4e8583[_0xb052('0x44')]['id']}},_0xfe8e0b={};_0xfe8e0b[_0xb052('0x33')]=_[_0xb052('0x45')](db[_0xb052('0x2e')]['rawAttributes']);_0xfe8e0b['query']=_[_0xb052('0x45')](_0x4e8583[_0xb052('0x34')]);_0xfe8e0b[_0xb052('0x46')]=_[_0xb052('0x35')](_0xfe8e0b['model'],_0xfe8e0b[_0xb052('0x34')]);_0x30c4f0[_0xb052('0x37')]=_[_0xb052('0x35')](_0xfe8e0b[_0xb052('0x33')],qs[_0xb052('0x36')](_0x4e8583[_0xb052('0x34')][_0xb052('0x36')]));_0x30c4f0['attributes']=_0x30c4f0[_0xb052('0x37')][_0xb052('0x38')]?_0x30c4f0['attributes']:_0xfe8e0b[_0xb052('0x33')];if(_0x4e8583[_0xb052('0x34')][_0xb052('0x47')]){_0x30c4f0[_0xb052('0x41')]=[{'all':!![]}];}_0x30c4f0=_[_0xb052('0x3d')]({},_0x30c4f0,_0x4e8583[_0xb052('0x40')]);return db[_0xb052('0x2e')][_0xb052('0x48')](_0x30c4f0)['then'](handleEntityNotFound(_0x74db7b,null))[_0xb052('0x27')](respondWithResult(_0x74db7b,null))['catch'](handleError(_0x74db7b,null));};exports['create']=function(_0x2e7a26,_0x45353b){return db[_0xb052('0x2e')][_0xb052('0x49')](_0x2e7a26['body'],{})['then'](respondWithResult(_0x45353b,0xc9))[_0xb052('0x4a')](handleError(_0x45353b,null));};exports['update']=function(_0x33db30,_0x56ab9e){if(_0x33db30[_0xb052('0x4b')]['id']){delete _0x33db30[_0xb052('0x4b')]['id'];}return db[_0xb052('0x2e')][_0xb052('0x48')]({'where':{'id':_0x33db30[_0xb052('0x44')]['id']}})['then'](handleEntityNotFound(_0x56ab9e,null))[_0xb052('0x27')](saveUpdates(_0x33db30[_0xb052('0x4b')],null))[_0xb052('0x27')](respondWithResult(_0x56ab9e,null))[_0xb052('0x4a')](handleError(_0x56ab9e,null));};exports['destroy']=function(_0x5b6ac2,_0x4d39f9){return db[_0xb052('0x2e')][_0xb052('0x48')]({'where':{'id':_0x5b6ac2['params']['id']}})[_0xb052('0x27')](handleEntityNotFound(_0x4d39f9,null))[_0xb052('0x27')](removeEntity(_0x4d39f9,null))['catch'](handleError(_0x4d39f9,null));};exports[_0xb052('0x4c')]=function(_0x5d9e0a,_0x4718f3,_0xa25b1a){var _0x4f86ab={};var _0x600d7c={};var _0x3c5c65;var _0x3ec77e;return db[_0xb052('0x2e')]['findOne']({'where':{'id':_0x5d9e0a[_0xb052('0x44')]['id']}})[_0xb052('0x27')](handleEntityNotFound(_0x4718f3,null))['then'](function(_0xb623df){if(_0xb623df){_0x3c5c65=_0xb623df;_0x600d7c[_0xb052('0x33')]=_['keys'](db[_0xb052('0x4d')][_0xb052('0x2f')]);_0x600d7c[_0xb052('0x34')]=_[_0xb052('0x45')](_0x5d9e0a[_0xb052('0x34')]);_0x600d7c[_0xb052('0x46')]=_[_0xb052('0x35')](_0x600d7c[_0xb052('0x33')],_0x600d7c[_0xb052('0x34')]);_0x4f86ab[_0xb052('0x37')]=_['intersection'](_0x600d7c[_0xb052('0x33')],qs['fields'](_0x5d9e0a[_0xb052('0x34')]['fields']));_0x4f86ab[_0xb052('0x37')]=_0x4f86ab['attributes'][_0xb052('0x38')]?_0x4f86ab[_0xb052('0x37')]:_0x600d7c['model'];_0x4f86ab['order']=qs[_0xb052('0x4e')](_0x5d9e0a[_0xb052('0x34')][_0xb052('0x4e')]);_0x4f86ab[_0xb052('0x3b')]=qs[_0xb052('0x46')](_[_0xb052('0x3c')](_0x5d9e0a[_0xb052('0x34')],_0x600d7c['filters']));if(_0x5d9e0a[_0xb052('0x34')]['filter']){_0x4f86ab[_0xb052('0x3b')]=_[_0xb052('0x3d')](_0x4f86ab[_0xb052('0x3b')],{'$or':_[_0xb052('0x2d')](_0x4f86ab[_0xb052('0x37')],function(_0xa72cb8){var _0x1af636={};_0x1af636[_0xa72cb8]={'$like':'%'+_0x5d9e0a[_0xb052('0x34')][_0xb052('0x3f')]+'%'};return _0x1af636;})});}_0x4f86ab=_['merge']({},_0x4f86ab,_0x5d9e0a['options']);return _0x3c5c65[_0xb052('0x4c')](_0x4f86ab);}})[_0xb052('0x27')](function(_0x31b7c6){if(_0x31b7c6){_0x3ec77e=_0x31b7c6[_0xb052('0x38')];if(!_0x5d9e0a[_0xb052('0x34')][_0xb052('0x4f')](_0xb052('0x39'))){_0x4f86ab[_0xb052('0x3a')]=qs[_0xb052('0x3a')](_0x5d9e0a['query'][_0xb052('0x3a')]);_0x4f86ab['offset']=qs['offset'](_0x5d9e0a['query'][_0xb052('0x20')]);}return _0x3c5c65[_0xb052('0x4c')](_0x4f86ab);}})[_0xb052('0x27')](function(_0x2f6eae){if(_0x2f6eae){return _0x2f6eae?{'count':_0x3ec77e,'rows':_0x2f6eae}:null;}})[_0xb052('0x27')](respondWithResult(_0x4718f3,null))['catch'](handleError(_0x4718f3,null));};exports['addConfiguration']=function(_0x23866a,_0xe97a43,_0x4046cb){if(_0x23866a['body']['id']){delete _0x23866a[_0xb052('0x4b')]['id'];}return db[_0xb052('0x2e')][_0xb052('0x50')]({'where':{'id':_0x23866a['params']['id']}})['then'](handleEntityNotFound(_0xe97a43,null))[_0xb052('0x27')](function(_0x332534){if(_0x332534){_0x23866a[_0xb052('0x4b')]['AccountId']=_0x332534['id'];_0x23866a[_0xb052('0x4b')][_0xb052('0x51')]=integrations[_0xb052('0x52')](_0x23866a[_0xb052('0x4b')][_0xb052('0x53')],_0x23866a['body'][_0xb052('0x31')]);_0x23866a['body']['Descriptions']=integrations[_0xb052('0x54')](_0x23866a[_0xb052('0x4b')]['channel'],_0x23866a[_0xb052('0x4b')][_0xb052('0x31')]);return db[_0xb052('0x4d')][_0xb052('0x49')](_0x23866a[_0xb052('0x4b')],{'include':[{'model':db[_0xb052('0x55')],'as':_0xb052('0x51')},{'model':db[_0xb052('0x55')],'as':_0xb052('0x56')}]});}return null;})[_0xb052('0x27')](respondWithResult(_0xe97a43,null))['catch'](handleError(_0xe97a43,null));};exports[_0xb052('0x57')]=function(_0x66331d,_0x889730,_0x17e856){var _0x582ace='';var _0x1d8c1f='';return db['FreshsalesAccount'][_0xb052('0x50')]({'where':{'id':_0x66331d[_0xb052('0x44')]['id']},'attributes':['id',_0xb052('0x58'),'remoteUri',_0xb052('0x59')]})['then'](handleEntityNotFound(_0x889730,null))[_0xb052('0x27')](function(_0x1c3c2b){if(_0x1c3c2b){_0x1d8c1f=_0x1c3c2b[_0xb052('0x58')];_0x582ace=_0x1c3c2b[_0xb052('0x5a')];var _0x56d674=_0x1c3c2b[_0xb052('0x5a')][_0xb052('0x5b')](-0x1);if(_0x56d674==='/'){_0x582ace=_0x582ace[_0xb052('0x5c')](0x0,_0x582ace[_0xb052('0x5d')](_0x56d674));}return rp({'method':_0xb052('0x5e'),'uri':util[_0xb052('0x5f')](_0xb052('0x60'),_0x582ace,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x1c3c2b[_0xb052('0x59')]},'json':!![]});}})[_0xb052('0x27')](function(_0x510134){if(_0x510134){var _0x557b97=_0x510134[_0xb052('0x61')];var _0x4a03c1=![];var _0x437ca7=null;for(_0x437ca7=0x0;_0x437ca7<_0x557b97[_0xb052('0x38')];_0x437ca7++){if(_0x557b97[_0x437ca7]['email']===_0x1d8c1f){_0x4a03c1=!![];}}if(_0x4a03c1){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xb052('0x27')](respondWithResult(_0x889730,null))[_0xb052('0x4a')](function(_0x56a6c4){var _0x5c7bd7=_0x66331d['query'][_0xb052('0x62')]?0x1f4:_0x56a6c4[_0xb052('0x63')]||0x1f4;logger[_0xb052('0x29')](_0xb052('0x64'),_0xb052('0x57'),_0x5c7bd7,JSON[_0xb052('0x65')](_0x56a6c4));delete _0x56a6c4[_0xb052('0x2a')];if(_0x5c7bd7===0x191){_0x5c7bd7=0x190;}_0x889730[_0xb052('0x1d')](_0x5c7bd7)[_0xb052('0x2b')](_0x66331d[_0xb052('0x34')][_0xb052('0x62')]?{'message':_0xb052('0x66'),'statusCode':_0x56a6c4[_0xb052('0x63')]}:_0x56a6c4);});}; \ No newline at end of file +var _0x1e5a=['sendStatus','error','stack','name','send','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','filter','map','VIRTUAL','merge','options','findAll','rows','show','params','fields','find','catch','create','body','FreshsalesConfiguration','order','pick','nolimit','getConfigurations','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x1e5a,0x164));var _0xa1e5=function(_0x1b7d9c,_0x59b000){_0x1b7d9c=_0x1b7d9c-0x0;var _0x439e9d=_0x1e5a[_0x1b7d9c];return _0x439e9d;};'use strict';var emlformat=require(_0xa1e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1e5('0x1'));var jsonpatch=require(_0xa1e5('0x2'));var rp=require(_0xa1e5('0x3'));var moment=require(_0xa1e5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1e5('0x5'));var path=require(_0xa1e5('0x6'));var sox=require('sox');var csv=require(_0xa1e5('0x7'));var ejs=require(_0xa1e5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa1e5('0x9'));var crypto=require('crypto');var jsforce=require(_0xa1e5('0xa'));var deskjs=require(_0xa1e5('0xb'));var toCsv=require(_0xa1e5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa1e5('0xc'));var qs=require(_0xa1e5('0xd'));var as=require(_0xa1e5('0xe'));var hardwareService=require(_0xa1e5('0xf'));var logger=require(_0xa1e5('0x10'))(_0xa1e5('0x11'));var utils=require(_0xa1e5('0x12'));var config=require(_0xa1e5('0x13'));var licenseUtil=require(_0xa1e5('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa1e5('0x15'));function respondWithStatusCode(_0x3b7829,_0x4bd4f8){_0x4bd4f8=_0x4bd4f8||0xcc;return function(_0x355b60){if(_0x355b60){return _0x3b7829['sendStatus'](_0x4bd4f8);}return _0x3b7829[_0xa1e5('0x16')](_0x4bd4f8)[_0xa1e5('0x17')]();};}function respondWithResult(_0x34dee3,_0x282ab5){_0x282ab5=_0x282ab5||0xc8;return function(_0x1243d5){if(_0x1243d5){return _0x34dee3[_0xa1e5('0x16')](_0x282ab5)['json'](_0x1243d5);}};}function respondWithFilteredResult(_0x1739f2,_0x2c53bd){return function(_0x5f4fad){if(_0x5f4fad){var _0x3997db=typeof _0x2c53bd[_0xa1e5('0x18')]===_0xa1e5('0x19')&&typeof _0x2c53bd['limit']===_0xa1e5('0x19');var _0x5a5e4e=_0x5f4fad[_0xa1e5('0x1a')];var _0x5e4b76=_0x3997db?0x0:_0x2c53bd['offset'];var _0x3658ee=_0x3997db?_0x5f4fad[_0xa1e5('0x1a')]:_0x2c53bd[_0xa1e5('0x18')]+_0x2c53bd[_0xa1e5('0x1b')];var _0x1961ba;if(_0x3658ee>=_0x5a5e4e){_0x3658ee=_0x5a5e4e;_0x1961ba=0xc8;}else{_0x1961ba=0xce;}_0x1739f2[_0xa1e5('0x16')](_0x1961ba);return _0x1739f2[_0xa1e5('0x1c')]('Content-Range',_0x5e4b76+'-'+_0x3658ee+'/'+_0x5a5e4e)[_0xa1e5('0x1d')](_0x5f4fad);}return null;};}function patchUpdates(_0x3cdcd3){return function(_0x5cb823){try{jsonpatch[_0xa1e5('0x1e')](_0x5cb823,_0x3cdcd3,!![]);}catch(_0x5d8a14){return BPromise[_0xa1e5('0x1f')](_0x5d8a14);}return _0x5cb823[_0xa1e5('0x20')]();};}function saveUpdates(_0x23131a,_0x33ef68){return function(_0x2047f2){if(_0x2047f2){return _0x2047f2[_0xa1e5('0x21')](_0x23131a)[_0xa1e5('0x22')](function(_0x3b7015){return _0x3b7015;});}return null;};}function removeEntity(_0x55166a,_0x57c76e){return function(_0x5dd49c){if(_0x5dd49c){return _0x5dd49c[_0xa1e5('0x23')]()[_0xa1e5('0x22')](function(){_0x55166a[_0xa1e5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5903bb,_0x2bd1cb){return function(_0x44582e){if(!_0x44582e){_0x5903bb[_0xa1e5('0x24')](0x194);}return _0x44582e;};}function handleError(_0x39ed62,_0x1c2df5){_0x1c2df5=_0x1c2df5||0x1f4;return function(_0x4d1601){logger[_0xa1e5('0x25')](_0x4d1601[_0xa1e5('0x26')]);if(_0x4d1601[_0xa1e5('0x27')]){delete _0x4d1601[_0xa1e5('0x27')];}_0x39ed62[_0xa1e5('0x16')](_0x1c2df5)[_0xa1e5('0x28')](_0x4d1601);};}exports['index']=function(_0x3d8f97,_0x19c4a5){var _0xa7d783={},_0x183355={},_0x5ddfd9={'count':0x0,'rows':[]};var _0x43d9f3=_['map'](db[_0xa1e5('0x29')][_0xa1e5('0x2a')],function(_0x4e39f6){return{'name':_0x4e39f6['fieldName'],'type':_0x4e39f6[_0xa1e5('0x2b')][_0xa1e5('0x2c')]};});_0x183355['model']=_['map'](_0x43d9f3,_0xa1e5('0x27'));_0x183355[_0xa1e5('0x2d')]=_[_0xa1e5('0x2e')](_0x3d8f97['query']);_0x183355[_0xa1e5('0x2f')]=_[_0xa1e5('0x30')](_0x183355[_0xa1e5('0x31')],_0x183355['query']);_0xa7d783['attributes']=_[_0xa1e5('0x30')](_0x183355[_0xa1e5('0x31')],qs['fields'](_0x3d8f97[_0xa1e5('0x2d')]['fields']));_0xa7d783[_0xa1e5('0x32')]=_0xa7d783['attributes'][_0xa1e5('0x33')]?_0xa7d783[_0xa1e5('0x32')]:_0x183355['model'];if(!_0x3d8f97['query'][_0xa1e5('0x34')]('nolimit')){_0xa7d783[_0xa1e5('0x1b')]=qs[_0xa1e5('0x1b')](_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x1b')]);_0xa7d783['offset']=qs[_0xa1e5('0x18')](_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x18')]);}_0xa7d783['order']=qs[_0xa1e5('0x35')](_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x35')]);_0xa7d783[_0xa1e5('0x36')]=qs[_0xa1e5('0x2f')](_['pick'](_0x3d8f97['query'],_0x183355[_0xa1e5('0x2f')]),_0x43d9f3);if(_0x3d8f97[_0xa1e5('0x2d')][_0xa1e5('0x37')]){_0xa7d783[_0xa1e5('0x36')]=_['merge'](_0xa7d783[_0xa1e5('0x36')],{'$or':_[_0xa1e5('0x38')](_0x43d9f3,function(_0x344741){if(_0x344741[_0xa1e5('0x2b')]!==_0xa1e5('0x39')){var _0x2e5178={};_0x2e5178[_0x344741[_0xa1e5('0x27')]]={'$like':'%'+_0x3d8f97['query'][_0xa1e5('0x37')]+'%'};return _0x2e5178;}})});}_0xa7d783=_[_0xa1e5('0x3a')]({},_0xa7d783,_0x3d8f97[_0xa1e5('0x3b')]);var _0x6d2749={'where':_0xa7d783['where']};return db['FreshsalesAccount'][_0xa1e5('0x1a')](_0x6d2749)[_0xa1e5('0x22')](function(_0x4c08f0){_0x5ddfd9['count']=_0x4c08f0;if(_0x3d8f97['query']['includeAll']){_0xa7d783['include']=[{'all':!![]}];}return db[_0xa1e5('0x29')][_0xa1e5('0x3c')](_0xa7d783);})[_0xa1e5('0x22')](function(_0x30349c){_0x5ddfd9[_0xa1e5('0x3d')]=_0x30349c;return _0x5ddfd9;})[_0xa1e5('0x22')](respondWithFilteredResult(_0x19c4a5,_0xa7d783))['catch'](handleError(_0x19c4a5,null));};exports[_0xa1e5('0x3e')]=function(_0x5b64e,_0x3efe07){var _0x119f28={'raw':![],'where':{'id':_0x5b64e[_0xa1e5('0x3f')]['id']}},_0x3a72f6={};_0x3a72f6[_0xa1e5('0x31')]=_[_0xa1e5('0x2e')](db[_0xa1e5('0x29')][_0xa1e5('0x2a')]);_0x3a72f6[_0xa1e5('0x2d')]=_[_0xa1e5('0x2e')](_0x5b64e[_0xa1e5('0x2d')]);_0x3a72f6[_0xa1e5('0x2f')]=_['intersection'](_0x3a72f6[_0xa1e5('0x31')],_0x3a72f6[_0xa1e5('0x2d')]);_0x119f28[_0xa1e5('0x32')]=_['intersection'](_0x3a72f6[_0xa1e5('0x31')],qs[_0xa1e5('0x40')](_0x5b64e[_0xa1e5('0x2d')][_0xa1e5('0x40')]));_0x119f28[_0xa1e5('0x32')]=_0x119f28[_0xa1e5('0x32')][_0xa1e5('0x33')]?_0x119f28['attributes']:_0x3a72f6[_0xa1e5('0x31')];if(_0x5b64e[_0xa1e5('0x2d')]['includeAll']){_0x119f28['include']=[{'all':!![]}];}_0x119f28=_[_0xa1e5('0x3a')]({},_0x119f28,_0x5b64e['options']);return db[_0xa1e5('0x29')][_0xa1e5('0x41')](_0x119f28)['then'](handleEntityNotFound(_0x3efe07,null))[_0xa1e5('0x22')](respondWithResult(_0x3efe07,null))[_0xa1e5('0x42')](handleError(_0x3efe07,null));};exports[_0xa1e5('0x43')]=function(_0x16d6f8,_0x25079a){return db[_0xa1e5('0x29')][_0xa1e5('0x43')](_0x16d6f8[_0xa1e5('0x44')],{})[_0xa1e5('0x22')](respondWithResult(_0x25079a,0xc9))[_0xa1e5('0x42')](handleError(_0x25079a,null));};exports[_0xa1e5('0x21')]=function(_0x3a4a58,_0x4d3a10){if(_0x3a4a58[_0xa1e5('0x44')]['id']){delete _0x3a4a58['body']['id'];}return db['FreshsalesAccount'][_0xa1e5('0x41')]({'where':{'id':_0x3a4a58[_0xa1e5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d3a10,null))[_0xa1e5('0x22')](saveUpdates(_0x3a4a58['body'],null))[_0xa1e5('0x22')](respondWithResult(_0x4d3a10,null))[_0xa1e5('0x42')](handleError(_0x4d3a10,null));};exports['destroy']=function(_0x19492a,_0x5f0cef){return db[_0xa1e5('0x29')][_0xa1e5('0x41')]({'where':{'id':_0x19492a[_0xa1e5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5f0cef,null))[_0xa1e5('0x22')](removeEntity(_0x5f0cef,null))[_0xa1e5('0x42')](handleError(_0x5f0cef,null));};exports['getConfigurations']=function(_0x243add,_0x14991e,_0x4e4038){var _0x1566ba={};var _0x1c237f={};var _0x5f0c97;var _0x3317b2;return db[_0xa1e5('0x29')]['findOne']({'where':{'id':_0x243add['params']['id']}})[_0xa1e5('0x22')](handleEntityNotFound(_0x14991e,null))[_0xa1e5('0x22')](function(_0x40780a){if(_0x40780a){_0x5f0c97=_0x40780a;_0x1c237f[_0xa1e5('0x31')]=_[_0xa1e5('0x2e')](db[_0xa1e5('0x45')]['rawAttributes']);_0x1c237f[_0xa1e5('0x2d')]=_[_0xa1e5('0x2e')](_0x243add[_0xa1e5('0x2d')]);_0x1c237f[_0xa1e5('0x2f')]=_[_0xa1e5('0x30')](_0x1c237f[_0xa1e5('0x31')],_0x1c237f[_0xa1e5('0x2d')]);_0x1566ba[_0xa1e5('0x32')]=_[_0xa1e5('0x30')](_0x1c237f[_0xa1e5('0x31')],qs[_0xa1e5('0x40')](_0x243add[_0xa1e5('0x2d')][_0xa1e5('0x40')]));_0x1566ba[_0xa1e5('0x32')]=_0x1566ba[_0xa1e5('0x32')][_0xa1e5('0x33')]?_0x1566ba[_0xa1e5('0x32')]:_0x1c237f[_0xa1e5('0x31')];_0x1566ba[_0xa1e5('0x46')]=qs[_0xa1e5('0x35')](_0x243add[_0xa1e5('0x2d')][_0xa1e5('0x35')]);_0x1566ba[_0xa1e5('0x36')]=qs['filters'](_[_0xa1e5('0x47')](_0x243add['query'],_0x1c237f['filters']));if(_0x243add['query'][_0xa1e5('0x37')]){_0x1566ba[_0xa1e5('0x36')]=_[_0xa1e5('0x3a')](_0x1566ba['where'],{'$or':_[_0xa1e5('0x38')](_0x1566ba[_0xa1e5('0x32')],function(_0x2ef3df){var _0x536962={};_0x536962[_0x2ef3df]={'$like':'%'+_0x243add['query']['filter']+'%'};return _0x536962;})});}_0x1566ba=_[_0xa1e5('0x3a')]({},_0x1566ba,_0x243add['options']);return _0x5f0c97['getConfigurations'](_0x1566ba);}})[_0xa1e5('0x22')](function(_0x10eeed){if(_0x10eeed){_0x3317b2=_0x10eeed['length'];if(!_0x243add[_0xa1e5('0x2d')][_0xa1e5('0x34')](_0xa1e5('0x48'))){_0x1566ba['limit']=qs[_0xa1e5('0x1b')](_0x243add[_0xa1e5('0x2d')]['limit']);_0x1566ba[_0xa1e5('0x18')]=qs['offset'](_0x243add['query'][_0xa1e5('0x18')]);}return _0x5f0c97[_0xa1e5('0x49')](_0x1566ba);}})[_0xa1e5('0x22')](function(_0x170462){if(_0x170462){return _0x170462?{'count':_0x3317b2,'rows':_0x170462}:null;}})[_0xa1e5('0x22')](respondWithResult(_0x14991e,null))['catch'](handleError(_0x14991e,null));};exports['addConfiguration']=function(_0x87b9f4,_0x27fe6d,_0x980ffa){if(_0x87b9f4[_0xa1e5('0x44')]['id']){delete _0x87b9f4[_0xa1e5('0x44')]['id'];}return db['FreshsalesAccount'][_0xa1e5('0x4a')]({'where':{'id':_0x87b9f4['params']['id']}})[_0xa1e5('0x22')](handleEntityNotFound(_0x27fe6d,null))[_0xa1e5('0x22')](function(_0x34b65b){if(_0x34b65b){_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x4b')]=_0x34b65b['id'];_0x87b9f4['body']['Subjects']=integrations[_0xa1e5('0x4c')](_0x87b9f4[_0xa1e5('0x44')]['channel'],_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x2b')]);_0x87b9f4['body'][_0xa1e5('0x4d')]=integrations[_0xa1e5('0x4e')](_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x4f')],_0x87b9f4[_0xa1e5('0x44')][_0xa1e5('0x2b')]);return db[_0xa1e5('0x45')][_0xa1e5('0x43')](_0x87b9f4[_0xa1e5('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0xa1e5('0x50')},{'model':db[_0xa1e5('0x51')],'as':'Descriptions'}]});}return null;})[_0xa1e5('0x22')](respondWithResult(_0x27fe6d,null))['catch'](handleError(_0x27fe6d,null));};exports[_0xa1e5('0x52')]=function(_0x15af1d,_0x67df10,_0x2f8d1a){var _0x426f54='';var _0x29a509='';return db[_0xa1e5('0x29')][_0xa1e5('0x4a')]({'where':{'id':_0x15af1d[_0xa1e5('0x3f')]['id']},'attributes':['id',_0xa1e5('0x53'),'remoteUri','apiKey']})[_0xa1e5('0x22')](handleEntityNotFound(_0x67df10,null))['then'](function(_0x36ed6c){if(_0x36ed6c){_0x29a509=_0x36ed6c[_0xa1e5('0x53')];_0x426f54=_0x36ed6c['remoteUri'];var _0x22a2ce=_0x36ed6c[_0xa1e5('0x54')][_0xa1e5('0x55')](-0x1);if(_0x22a2ce==='/'){_0x426f54=_0x426f54[_0xa1e5('0x56')](0x0,_0x426f54[_0xa1e5('0x57')](_0x22a2ce));}return rp({'method':_0xa1e5('0x58'),'uri':util[_0xa1e5('0x59')]('%s%s',_0x426f54,_0xa1e5('0x5a')),'headers':{'Authorization':_0xa1e5('0x5b')+_0x36ed6c['apiKey']},'json':!![]});}})[_0xa1e5('0x22')](function(_0x15b6bb){if(_0x15b6bb){var _0x2aa511=_0x15b6bb[_0xa1e5('0x5c')];var _0x3626d5=![];var _0x1b4b0f=null;for(_0x1b4b0f=0x0;_0x1b4b0f<_0x2aa511[_0xa1e5('0x33')];_0x1b4b0f++){if(_0x2aa511[_0x1b4b0f][_0xa1e5('0x5d')]===_0x29a509){_0x3626d5=!![];}}if(_0x3626d5){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xa1e5('0x22')](respondWithResult(_0x67df10,null))[_0xa1e5('0x42')](function(_0x4da82e){var _0x1d9471=_0x15af1d['query'][_0xa1e5('0x5e')]?0x1f4:_0x4da82e['statusCode']||0x1f4;logger['error'](_0xa1e5('0x5f'),_0xa1e5('0x52'),_0x1d9471,JSON['stringify'](_0x4da82e));delete _0x4da82e[_0xa1e5('0x27')];if(_0x1d9471===0x191){_0x1d9471=0x190;}_0x67df10['status'](_0x1d9471)[_0xa1e5('0x28')](_0x15af1d[_0xa1e5('0x2d')]['test']?{'message':_0xa1e5('0x60'),'statusCode':_0x4da82e[_0xa1e5('0x61')]}:_0x4da82e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c1e0ce5..f219c8b 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 _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0x5430,0x10c));var _0x0543=function(_0x4a5362,_0x40727f){_0x4a5362=_0x4a5362-0x0;var _0x536f67=_0x5430[_0x4a5362];return _0x536f67;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x2e3f40,_0x47410c){var _0x28abc1=function(_0x472028){while(--_0x472028){_0x2e3f40['push'](_0x2e3f40['shift']());}};_0x28abc1(++_0x47410c);}(_0xdb28,0x106));var _0x8db2=function(_0x273ee3,_0x2dd4d5){_0x273ee3=_0x273ee3-0x0;var _0x2dc76a=_0xdb28[_0x273ee3];return _0x2dc76a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x8db2('0x9'));module[_0x8db2('0xa')]=function(_0x5f42ee,_0x494b40){return _0x5f42ee[_0x8db2('0xb')](_0x8db2('0xc'),attributes,{'tableName':_0x8db2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index ce53293..31dfa97 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 _0x7278=['stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x56a0e8,_0x4e35b6){var _0x264de3=function(_0x455505){while(--_0x455505){_0x56a0e8['push'](_0x56a0e8['shift']());}};_0x264de3(++_0x4e35b6);}(_0x7278,0x161));var _0x8727=function(_0x236e7f,_0x4491d4){_0x236e7f=_0x236e7f-0x0;var _0x55dc93=_0x7278[_0x236e7f];return _0x55dc93;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var moment=require(_0x8727('0x2'));var BPromise=require(_0x8727('0x3'));var rs=require(_0x8727('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8727('0x5'))['db'];var utils=require(_0x8727('0x6'));var logger=require(_0x8727('0x7'))(_0x8727('0x8'));var config=require(_0x8727('0x9'));var jayson=require(_0x8727('0xa'));var client=jayson[_0x8727('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd1902,_0x2f491c,_0xffd783){return new BPromise(function(_0x435911,_0x4160c3){return client['request'](_0xfd1902,_0xffd783)['then'](function(_0x4df6f8){logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));logger[_0x8727('0xf')](_0x8727('0x10'),_0x2f491c,_0x8727('0xe'),JSON[_0x8727('0x11')](_0x4df6f8));if(_0x4df6f8[_0x8727('0x12')]){if(_0x4df6f8['error'][_0x8727('0x13')]===0x1f4){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8['error'][_0x8727('0x14')]);return _0x4160c3(_0x4df6f8[_0x8727('0x12')]['message']);}logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);return _0x435911(_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);}else{logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));_0x435911(_0x4df6f8[_0x8727('0x15')]['message']);}})[_0x8727('0x16')](function(_0x1f9538){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x1f9538);_0x4160c3(_0x1f9538);});});}exports[_0x8727('0x17')]=function(_0xba0af5){var _0x533e6d=this;return new Promise(function(_0x575d29,_0x1a90ed){return db['FreshsalesAccount'][_0x8727('0x18')]({'raw':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1a')]===undefined?!![]:![]:!![],'where':_0xba0af5[_0x8727('0x19')]?_0xba0af5['options'][_0x8727('0x1b')]||null:null,'attributes':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1c')]||null:null,'limit':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1d')]||null:null,'include':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1e')]?_[_0x8727('0x1f')](_0xba0af5[_0x8727('0x19')]['include'],function(_0x464a32){return{'model':db[_0x464a32[_0x8727('0x20')]],'as':_0x464a32['as'],'attributes':_0x464a32['attributes'],'include':_0x464a32['include']?_[_0x8727('0x1f')](_0x464a32[_0x8727('0x1e')],function(_0x15e8bf){return{'model':db[_0x15e8bf['model']],'as':_0x15e8bf['as'],'attributes':_0x15e8bf[_0x8727('0x1c')],'include':_0x15e8bf[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x15e8bf[_0x8727('0x1e')],function(_0x2c8cd5){return{'model':db[_0x2c8cd5[_0x8727('0x20')]],'as':_0x2c8cd5['as'],'attributes':_0x2c8cd5[_0x8727('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x21')](function(_0x5d03f2){logger[_0x8727('0xc')](_0x8727('0x17'),_0xba0af5);logger['debug'](_0x8727('0x17'),_0xba0af5,JSON[_0x8727('0x11')](_0x5d03f2));_0x575d29(_0x5d03f2);})[_0x8727('0x16')](function(_0x228ca9){logger[_0x8727('0x12')](_0x8727('0x17'),_0x228ca9['message'],_0xba0af5);_0x1a90ed(_0x533e6d[_0x8727('0x12')](0x1f4,_0x228ca9['message']));});});};exports[_0x8727('0x22')]=function(_0x47e9f9){var _0x44ed83=this;return new Promise(function(_0x391d60,_0x152a53){return db[_0x8727('0x23')][_0x8727('0x24')]({'raw':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')][_0x8727('0x1b')]||null:null,'attributes':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')][_0x8727('0x1c')]||null:null,'include':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')][_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x47e9f9[_0x8727('0x19')][_0x8727('0x1e')],function(_0x54bff3){return{'model':db[_0x54bff3['model']],'as':_0x54bff3['as'],'attributes':_0x54bff3[_0x8727('0x1c')],'include':_0x54bff3[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x54bff3[_0x8727('0x1e')],function(_0x52220f){return{'model':db[_0x52220f[_0x8727('0x20')]],'as':_0x52220f['as'],'attributes':_0x52220f[_0x8727('0x1c')],'include':_0x52220f[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x52220f[_0x8727('0x1e')],function(_0x5b96cc){return{'model':db[_0x5b96cc[_0x8727('0x20')]],'as':_0x5b96cc['as'],'attributes':_0x5b96cc[_0x8727('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x21')](function(_0x1b0e88){logger[_0x8727('0xc')](_0x8727('0x22'),_0x47e9f9);logger[_0x8727('0xf')](_0x8727('0x22'),_0x47e9f9,JSON[_0x8727('0x11')](_0x1b0e88));_0x391d60(_0x1b0e88);})[_0x8727('0x16')](function(_0x396f12){logger[_0x8727('0x12')]('ShowFreshsalesAccount',_0x396f12[_0x8727('0x14')],_0x47e9f9);_0x152a53(_0x44ed83[_0x8727('0x12')](0x1f4,_0x396f12[_0x8727('0x14')]));});});}; \ No newline at end of file +var _0x0a6b=['find','map','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','then','debug','stringify','catch','ShowFreshsalesAccount'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1668a9,_0x478d00){_0x1668a9=_0x1668a9-0x0;var _0x4d8dc2=_0x0a6b[_0x1668a9];return _0x4d8dc2;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')]({'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x582fc2['options']?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'include':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4b0479){return{'model':db[_0x4b0479[_0xb0a6('0x19')]],'as':_0x4b0479['as'],'attributes':_0x4b0479[_0xb0a6('0x16')],'include':_0x4b0479['include']?_[_0xb0a6('0x20')](_0x4b0479[_0xb0a6('0x18')],function(_0x52e397){return{'model':db[_0x52e397['model']],'as':_0x52e397['as'],'attributes':_0x52e397[_0xb0a6('0x16')],'include':_0x52e397[_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x52e397[_0xb0a6('0x18')],function(_0x4310ae){return{'model':db[_0x4310ae[_0xb0a6('0x19')]],'as':_0x4310ae['as'],'attributes':_0x4310ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x5c280e){logger[_0xb0a6('0x8')](_0xb0a6('0x1e'),_0x582fc2);logger['debug']('ShowFreshsalesAccount',_0x582fc2,JSON['stringify'](_0x5c280e));_0x309a91(_0x5c280e);})[_0xb0a6('0x1d')](function(_0xd484f){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0xd484f[_0xb0a6('0xe')],_0x582fc2);_0x114f91(_0x131e46['error'](0x1f4,_0xd484f[_0xb0a6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c27952c..5394268 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 _0x72e8=['getSubjects','/:id/descriptions','/:id/fields','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0x72e8,0x13c));var _0x872e=function(_0x1dc56b,_0x51a505){_0x1dc56b=_0x1dc56b-0x0;var _0x4c3d8a=_0x72e8[_0x1dc56b];return _0x4c3d8a;};'use strict';var multer=require(_0x872e('0x0'));var util=require(_0x872e('0x1'));var path=require(_0x872e('0x2'));var timeout=require(_0x872e('0x3'));var express=require(_0x872e('0x4'));var router=express[_0x872e('0x5')]();var fs_extra=require(_0x872e('0x6'));var auth=require(_0x872e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x872e('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x872e('0x9')]('/',auth[_0x872e('0xa')](),controller['index']);router[_0x872e('0x9')](_0x872e('0xb'),auth[_0x872e('0xa')](),controller[_0x872e('0xc')]);router[_0x872e('0x9')](_0x872e('0xd'),auth['isAuthenticated'](),controller[_0x872e('0xe')]);router['get'](_0x872e('0xf'),auth[_0x872e('0xa')](),controller['getDescriptions']);router[_0x872e('0x9')](_0x872e('0x10'),auth[_0x872e('0xa')](),controller['getFields']);router[_0x872e('0x11')]('/',auth[_0x872e('0xa')](),controller[_0x872e('0x12')]);router[_0x872e('0x13')](_0x872e('0xb'),auth[_0x872e('0xa')](),controller['update']);router['delete'](_0x872e('0xb'),auth[_0x872e('0xa')](),controller[_0x872e('0x14')]);module[_0x872e('0x15')]=router; \ No newline at end of file +var _0x49d2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x4339df,_0x568b7d){var _0x38c44c=function(_0x41983d){while(--_0x41983d){_0x4339df['push'](_0x4339df['shift']());}};_0x38c44c(++_0x568b7d);}(_0x49d2,0x67));var _0x249d=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x49d2[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0x249d('0x0'));var util=require(_0x249d('0x1'));var path=require(_0x249d('0x2'));var timeout=require(_0x249d('0x3'));var express=require('express');var router=express[_0x249d('0x4')]();var fs_extra=require(_0x249d('0x5'));var auth=require(_0x249d('0x6'));var interaction=require(_0x249d('0x7'));var config=require(_0x249d('0x8'));var controller=require(_0x249d('0x9'));router[_0x249d('0xa')]('/',auth[_0x249d('0xb')](),controller[_0x249d('0xc')]);router[_0x249d('0xa')](_0x249d('0xd'),auth[_0x249d('0xb')](),controller[_0x249d('0xe')]);router[_0x249d('0xa')](_0x249d('0xf'),auth[_0x249d('0xb')](),controller[_0x249d('0x10')]);router[_0x249d('0xa')](_0x249d('0x11'),auth[_0x249d('0xb')](),controller[_0x249d('0x12')]);router['get'](_0x249d('0x13'),auth[_0x249d('0xb')](),controller['getFields']);router[_0x249d('0x14')]('/',auth[_0x249d('0xb')](),controller[_0x249d('0x15')]);router[_0x249d('0x16')](_0x249d('0xd'),auth[_0x249d('0xb')](),controller[_0x249d('0x17')]);router[_0x249d('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x249d('0x19')]);module[_0x249d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d1a8e9d..86bc7f2 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 _0x0be0=['exports'];(function(_0xcb412e,_0x25e6a2){var _0x314a24=function(_0x2e4323){while(--_0x2e4323){_0xcb412e['push'](_0xcb412e['shift']());}};_0x314a24(++_0x25e6a2);}(_0x0be0,0x143));var _0x00be=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x0be0[_0x411add];return _0x238242;};'use strict';var Sequelize=require('sequelize');module[_0x00be('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xddbb=['sequelize','exports','STRING'];(function(_0x5e1aae,_0xbc39f3){var _0x5078ff=function(_0x5072f9){while(--_0x5072f9){_0x5e1aae['push'](_0x5e1aae['shift']());}};_0x5078ff(++_0xbc39f3);}(_0xddbb,0x1a7));var _0xbddb=function(_0x5bf517,_0x470378){_0x5bf517=_0x5bf517-0x0;var _0x3bde4f=_0xddbb[_0x5bf517];return _0x3bde4f;};'use strict';var Sequelize=require(_0xbddb('0x0'));module[_0xbddb('0x1')]={'name':{'type':Sequelize[_0xbddb('0x2')]},'description':{'type':Sequelize[_0xbddb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index df1c277..5177361 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 _0x6cf9=['catch','getFields','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','update','destroy','then','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','create','body','getSubjects','findOne','FreshsalesField','order','getDescriptions'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x6cf9,0x192));var _0x96cf=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x6cf9[_0x10bcc4];return _0x2da988;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x96cf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96cf('0x1'));var moment=require(_0x96cf('0x2'));var BPromise=require(_0x96cf('0x3'));var Mustache=require(_0x96cf('0x4'));var util=require('util');var path=require(_0x96cf('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x96cf('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96cf('0x7'));var squel=require(_0x96cf('0x8'));var crypto=require(_0x96cf('0x9'));var jsforce=require(_0x96cf('0xa'));var deskjs=require(_0x96cf('0xb'));var toCsv=require(_0x96cf('0xc'));var querystring=require(_0x96cf('0xd'));var Papa=require(_0x96cf('0xe'));var Redis=require(_0x96cf('0xf'));var authService=require(_0x96cf('0x10'));var qs=require(_0x96cf('0x11'));var as=require(_0x96cf('0x12'));var hardwareService=require(_0x96cf('0x13'));var logger=require(_0x96cf('0x14'))('api');var utils=require(_0x96cf('0x15'));var config=require(_0x96cf('0x16'));var licenseUtil=require(_0x96cf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfdf161,_0x2d4a12){_0x2d4a12=_0x2d4a12||0xcc;return function(_0x30f80e){if(_0x30f80e){return _0xfdf161[_0x96cf('0x18')](_0x2d4a12);}return _0xfdf161[_0x96cf('0x19')](_0x2d4a12)[_0x96cf('0x1a')]();};}function respondWithResult(_0xd19b1,_0x402c43){_0x402c43=_0x402c43||0xc8;return function(_0x1b2d03){if(_0x1b2d03){return _0xd19b1[_0x96cf('0x19')](_0x402c43)[_0x96cf('0x1b')](_0x1b2d03);}};}function respondWithFilteredResult(_0x1ae1f2,_0x445339){return function(_0x5eb6d6){if(_0x5eb6d6){var _0x3cc4e7=typeof _0x445339['offset']===_0x96cf('0x1c')&&typeof _0x445339[_0x96cf('0x1d')]===_0x96cf('0x1c');var _0x2f827d=_0x5eb6d6['count'];var _0x59619c=_0x3cc4e7?0x0:_0x445339[_0x96cf('0x1e')];var _0x169f50=_0x3cc4e7?_0x5eb6d6['count']:_0x445339[_0x96cf('0x1e')]+_0x445339[_0x96cf('0x1d')];var _0x5431f1;if(_0x169f50>=_0x2f827d){_0x169f50=_0x2f827d;_0x5431f1=0xc8;}else{_0x5431f1=0xce;}_0x1ae1f2[_0x96cf('0x19')](_0x5431f1);return _0x1ae1f2[_0x96cf('0x1f')](_0x96cf('0x20'),_0x59619c+'-'+_0x169f50+'/'+_0x2f827d)['json'](_0x5eb6d6);}return null;};}function patchUpdates(_0x1a6c83){return function(_0x5f0e8d){try{jsonpatch[_0x96cf('0x21')](_0x5f0e8d,_0x1a6c83,!![]);}catch(_0x2a21eb){return BPromise[_0x96cf('0x22')](_0x2a21eb);}return _0x5f0e8d['save']();};}function saveUpdates(_0x38ad33,_0x6cd6a6){return function(_0x162d07){if(_0x162d07){return _0x162d07[_0x96cf('0x23')](_0x38ad33)['then'](function(_0x1cfe78){return _0x1cfe78;});}return null;};}function removeEntity(_0x596f14,_0x8f4c2a){return function(_0x212840){if(_0x212840){return _0x212840[_0x96cf('0x24')]()[_0x96cf('0x25')](function(){_0x596f14['status'](0xcc)[_0x96cf('0x1a')]();});}};}function handleEntityNotFound(_0x36866d,_0x1f084f){return function(_0x23398d){if(!_0x23398d){_0x36866d[_0x96cf('0x18')](0x194);}return _0x23398d;};}function handleError(_0x5593ce,_0x24f104){_0x24f104=_0x24f104||0x1f4;return function(_0x1489d1){logger['error'](_0x1489d1[_0x96cf('0x26')]);if(_0x1489d1[_0x96cf('0x27')]){delete _0x1489d1[_0x96cf('0x27')];}_0x5593ce[_0x96cf('0x19')](_0x24f104)['send'](_0x1489d1);};}exports[_0x96cf('0x28')]=function(_0x3ddc4a,_0x20feed){var _0x38d52b={},_0x5eeefe={},_0x117d7a={'count':0x0,'rows':[]};var _0x3a6c75=_[_0x96cf('0x29')](db[_0x96cf('0x2a')][_0x96cf('0x2b')],function(_0x2ea54f){return{'name':_0x2ea54f[_0x96cf('0x2c')],'type':_0x2ea54f[_0x96cf('0x2d')][_0x96cf('0x2e')]};});_0x5eeefe[_0x96cf('0x2f')]=_[_0x96cf('0x29')](_0x3a6c75,_0x96cf('0x27'));_0x5eeefe['query']=_[_0x96cf('0x30')](_0x3ddc4a[_0x96cf('0x31')]);_0x5eeefe[_0x96cf('0x32')]=_[_0x96cf('0x33')](_0x5eeefe['model'],_0x5eeefe['query']);_0x38d52b[_0x96cf('0x34')]=_[_0x96cf('0x33')](_0x5eeefe['model'],qs[_0x96cf('0x35')](_0x3ddc4a[_0x96cf('0x31')][_0x96cf('0x35')]));_0x38d52b['attributes']=_0x38d52b[_0x96cf('0x34')][_0x96cf('0x36')]?_0x38d52b[_0x96cf('0x34')]:_0x5eeefe[_0x96cf('0x2f')];if(!_0x3ddc4a[_0x96cf('0x31')][_0x96cf('0x37')](_0x96cf('0x38'))){_0x38d52b['limit']=qs[_0x96cf('0x1d')](_0x3ddc4a[_0x96cf('0x31')]['limit']);_0x38d52b['offset']=qs[_0x96cf('0x1e')](_0x3ddc4a[_0x96cf('0x31')][_0x96cf('0x1e')]);}_0x38d52b['order']=qs[_0x96cf('0x39')](_0x3ddc4a[_0x96cf('0x31')][_0x96cf('0x39')]);_0x38d52b[_0x96cf('0x3a')]=qs[_0x96cf('0x32')](_[_0x96cf('0x3b')](_0x3ddc4a[_0x96cf('0x31')],_0x5eeefe['filters']),_0x3a6c75);if(_0x3ddc4a[_0x96cf('0x31')][_0x96cf('0x3c')]){_0x38d52b['where']=_[_0x96cf('0x3d')](_0x38d52b[_0x96cf('0x3a')],{'$or':_[_0x96cf('0x29')](_0x3a6c75,function(_0x80661e){if(_0x80661e[_0x96cf('0x2d')]!==_0x96cf('0x3e')){var _0xcd6af2={};_0xcd6af2[_0x80661e[_0x96cf('0x27')]]={'$like':'%'+_0x3ddc4a[_0x96cf('0x31')][_0x96cf('0x3c')]+'%'};return _0xcd6af2;}})});}_0x38d52b=_[_0x96cf('0x3d')]({},_0x38d52b,_0x3ddc4a[_0x96cf('0x3f')]);var _0x5ed5cc={'where':_0x38d52b[_0x96cf('0x3a')]};return db[_0x96cf('0x2a')][_0x96cf('0x40')](_0x5ed5cc)[_0x96cf('0x25')](function(_0x184f83){_0x117d7a[_0x96cf('0x40')]=_0x184f83;if(_0x3ddc4a['query'][_0x96cf('0x41')]){_0x38d52b['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x96cf('0x42')](_0x38d52b);})['then'](function(_0x1f958b){_0x117d7a[_0x96cf('0x43')]=_0x1f958b;return _0x117d7a;})[_0x96cf('0x25')](respondWithFilteredResult(_0x20feed,_0x38d52b))['catch'](handleError(_0x20feed,null));};exports['show']=function(_0x27cd0e,_0x44b82f){var _0x35c69d={'raw':![],'where':{'id':_0x27cd0e[_0x96cf('0x44')]['id']}},_0x576151={};_0x576151[_0x96cf('0x2f')]=_[_0x96cf('0x30')](db[_0x96cf('0x2a')][_0x96cf('0x2b')]);_0x576151[_0x96cf('0x31')]=_['keys'](_0x27cd0e[_0x96cf('0x31')]);_0x576151[_0x96cf('0x32')]=_[_0x96cf('0x33')](_0x576151['model'],_0x576151[_0x96cf('0x31')]);_0x35c69d[_0x96cf('0x34')]=_[_0x96cf('0x33')](_0x576151[_0x96cf('0x2f')],qs[_0x96cf('0x35')](_0x27cd0e[_0x96cf('0x31')][_0x96cf('0x35')]));_0x35c69d[_0x96cf('0x34')]=_0x35c69d[_0x96cf('0x34')][_0x96cf('0x36')]?_0x35c69d[_0x96cf('0x34')]:_0x576151[_0x96cf('0x2f')];if(_0x27cd0e['query']['includeAll']){_0x35c69d[_0x96cf('0x45')]=[{'all':!![]}];}_0x35c69d=_['merge']({},_0x35c69d,_0x27cd0e[_0x96cf('0x3f')]);return db[_0x96cf('0x2a')][_0x96cf('0x46')](_0x35c69d)[_0x96cf('0x25')](handleEntityNotFound(_0x44b82f,null))['then'](respondWithResult(_0x44b82f,null))['catch'](handleError(_0x44b82f,null));};exports[_0x96cf('0x47')]=function(_0x4e91e3,_0x534a21){return db[_0x96cf('0x2a')][_0x96cf('0x47')](_0x4e91e3['body'],{})[_0x96cf('0x25')](respondWithResult(_0x534a21,0xc9))['catch'](handleError(_0x534a21,null));};exports[_0x96cf('0x23')]=function(_0x5989c8,_0x5e3530){if(_0x5989c8[_0x96cf('0x48')]['id']){delete _0x5989c8[_0x96cf('0x48')]['id'];}return db[_0x96cf('0x2a')][_0x96cf('0x46')]({'where':{'id':_0x5989c8[_0x96cf('0x44')]['id']}})[_0x96cf('0x25')](handleEntityNotFound(_0x5e3530,null))['then'](saveUpdates(_0x5989c8[_0x96cf('0x48')],null))[_0x96cf('0x25')](respondWithResult(_0x5e3530,null))['catch'](handleError(_0x5e3530,null));};exports[_0x96cf('0x24')]=function(_0x39c8cb,_0x57a2e2){return db[_0x96cf('0x2a')][_0x96cf('0x46')]({'where':{'id':_0x39c8cb[_0x96cf('0x44')]['id']}})[_0x96cf('0x25')](handleEntityNotFound(_0x57a2e2,null))[_0x96cf('0x25')](removeEntity(_0x57a2e2,null))['catch'](handleError(_0x57a2e2,null));};exports[_0x96cf('0x49')]=function(_0x5ea11d,_0x21809f,_0x43bf45){var _0x396de4={};var _0x4fcd98={};var _0x9bccfd;var _0x2babe3;return db['FreshsalesConfiguration'][_0x96cf('0x4a')]({'where':{'id':_0x5ea11d[_0x96cf('0x44')]['id']}})['then'](handleEntityNotFound(_0x21809f,null))[_0x96cf('0x25')](function(_0x600d30){if(_0x600d30){_0x9bccfd=_0x600d30;_0x4fcd98[_0x96cf('0x2f')]=_[_0x96cf('0x30')](db[_0x96cf('0x4b')][_0x96cf('0x2b')]);_0x4fcd98['query']=_['keys'](_0x5ea11d[_0x96cf('0x31')]);_0x4fcd98[_0x96cf('0x32')]=_[_0x96cf('0x33')](_0x4fcd98[_0x96cf('0x2f')],_0x4fcd98[_0x96cf('0x31')]);_0x396de4[_0x96cf('0x34')]=_['intersection'](_0x4fcd98[_0x96cf('0x2f')],qs[_0x96cf('0x35')](_0x5ea11d[_0x96cf('0x31')]['fields']));_0x396de4[_0x96cf('0x34')]=_0x396de4[_0x96cf('0x34')][_0x96cf('0x36')]?_0x396de4['attributes']:_0x4fcd98[_0x96cf('0x2f')];_0x396de4[_0x96cf('0x4c')]=qs[_0x96cf('0x39')](_0x5ea11d[_0x96cf('0x31')][_0x96cf('0x39')]);_0x396de4[_0x96cf('0x3a')]=qs[_0x96cf('0x32')](_['pick'](_0x5ea11d[_0x96cf('0x31')],_0x4fcd98[_0x96cf('0x32')]));if(_0x5ea11d[_0x96cf('0x31')][_0x96cf('0x3c')]){_0x396de4['where']=_[_0x96cf('0x3d')](_0x396de4['where'],{'$or':_[_0x96cf('0x29')](_0x396de4[_0x96cf('0x34')],function(_0x15b5b5){var _0x160746={};_0x160746[_0x15b5b5]={'$like':'%'+_0x5ea11d['query']['filter']+'%'};return _0x160746;})});}_0x396de4=_['merge']({},_0x396de4,_0x5ea11d[_0x96cf('0x3f')]);return _0x9bccfd['getSubjects'](_0x396de4);}})[_0x96cf('0x25')](function(_0x3c1b60){if(_0x3c1b60){_0x2babe3=_0x3c1b60[_0x96cf('0x36')];if(!_0x5ea11d[_0x96cf('0x31')]['hasOwnProperty']('nolimit')){_0x396de4[_0x96cf('0x1d')]=qs[_0x96cf('0x1d')](_0x5ea11d[_0x96cf('0x31')][_0x96cf('0x1d')]);_0x396de4[_0x96cf('0x1e')]=qs['offset'](_0x5ea11d[_0x96cf('0x31')][_0x96cf('0x1e')]);}return _0x9bccfd[_0x96cf('0x49')](_0x396de4);}})[_0x96cf('0x25')](function(_0x342388){if(_0x342388){return _0x342388?{'count':_0x2babe3,'rows':_0x342388}:null;}})['then'](respondWithResult(_0x21809f,null))['catch'](handleError(_0x21809f,null));};exports[_0x96cf('0x4d')]=function(_0x131c79,_0x5f4a85,_0x49fcc4){var _0x5a7a85={};var _0x4ffc9c={};var _0x5120ea;var _0x1ab838;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x131c79[_0x96cf('0x44')]['id']}})[_0x96cf('0x25')](handleEntityNotFound(_0x5f4a85,null))[_0x96cf('0x25')](function(_0x5acd20){if(_0x5acd20){_0x5120ea=_0x5acd20;_0x4ffc9c['model']=_[_0x96cf('0x30')](db['FreshsalesField']['rawAttributes']);_0x4ffc9c['query']=_[_0x96cf('0x30')](_0x131c79[_0x96cf('0x31')]);_0x4ffc9c[_0x96cf('0x32')]=_[_0x96cf('0x33')](_0x4ffc9c['model'],_0x4ffc9c[_0x96cf('0x31')]);_0x5a7a85[_0x96cf('0x34')]=_[_0x96cf('0x33')](_0x4ffc9c[_0x96cf('0x2f')],qs[_0x96cf('0x35')](_0x131c79[_0x96cf('0x31')][_0x96cf('0x35')]));_0x5a7a85[_0x96cf('0x34')]=_0x5a7a85[_0x96cf('0x34')]['length']?_0x5a7a85[_0x96cf('0x34')]:_0x4ffc9c[_0x96cf('0x2f')];_0x5a7a85['order']=qs[_0x96cf('0x39')](_0x131c79[_0x96cf('0x31')][_0x96cf('0x39')]);_0x5a7a85[_0x96cf('0x3a')]=qs['filters'](_['pick'](_0x131c79['query'],_0x4ffc9c[_0x96cf('0x32')]));if(_0x131c79[_0x96cf('0x31')]['filter']){_0x5a7a85[_0x96cf('0x3a')]=_[_0x96cf('0x3d')](_0x5a7a85['where'],{'$or':_['map'](_0x5a7a85[_0x96cf('0x34')],function(_0x33ed89){var _0x361da7={};_0x361da7[_0x33ed89]={'$like':'%'+_0x131c79[_0x96cf('0x31')]['filter']+'%'};return _0x361da7;})});}_0x5a7a85=_[_0x96cf('0x3d')]({},_0x5a7a85,_0x131c79[_0x96cf('0x3f')]);return _0x5120ea[_0x96cf('0x4d')](_0x5a7a85);}})[_0x96cf('0x25')](function(_0x4b7b81){if(_0x4b7b81){_0x1ab838=_0x4b7b81[_0x96cf('0x36')];if(!_0x131c79[_0x96cf('0x31')]['hasOwnProperty'](_0x96cf('0x38'))){_0x5a7a85[_0x96cf('0x1d')]=qs['limit'](_0x131c79[_0x96cf('0x31')]['limit']);_0x5a7a85[_0x96cf('0x1e')]=qs[_0x96cf('0x1e')](_0x131c79[_0x96cf('0x31')][_0x96cf('0x1e')]);}return _0x5120ea[_0x96cf('0x4d')](_0x5a7a85);}})[_0x96cf('0x25')](function(_0x1ac2cb){if(_0x1ac2cb){return _0x1ac2cb?{'count':_0x1ab838,'rows':_0x1ac2cb}:null;}})[_0x96cf('0x25')](respondWithResult(_0x5f4a85,null))[_0x96cf('0x4e')](handleError(_0x5f4a85,null));};exports[_0x96cf('0x4f')]=function(_0x19ba24,_0x12a9aa,_0x420882){var _0x309139={};var _0x261d33={};var _0x4756e5;var _0x2d0cb5;return db[_0x96cf('0x2a')][_0x96cf('0x4a')]({'where':{'id':_0x19ba24['params']['id']}})[_0x96cf('0x25')](handleEntityNotFound(_0x12a9aa,null))[_0x96cf('0x25')](function(_0x490c2d){if(_0x490c2d){_0x4756e5=_0x490c2d;_0x261d33['model']=_[_0x96cf('0x30')](db[_0x96cf('0x4b')][_0x96cf('0x2b')]);_0x261d33['query']=_['keys'](_0x19ba24[_0x96cf('0x31')]);_0x261d33[_0x96cf('0x32')]=_['intersection'](_0x261d33[_0x96cf('0x2f')],_0x261d33[_0x96cf('0x31')]);_0x309139['attributes']=_[_0x96cf('0x33')](_0x261d33[_0x96cf('0x2f')],qs['fields'](_0x19ba24[_0x96cf('0x31')][_0x96cf('0x35')]));_0x309139['attributes']=_0x309139[_0x96cf('0x34')][_0x96cf('0x36')]?_0x309139[_0x96cf('0x34')]:_0x261d33[_0x96cf('0x2f')];_0x309139[_0x96cf('0x4c')]=qs['sort'](_0x19ba24['query'][_0x96cf('0x39')]);_0x309139[_0x96cf('0x3a')]=qs['filters'](_[_0x96cf('0x3b')](_0x19ba24[_0x96cf('0x31')],_0x261d33[_0x96cf('0x32')]));if(_0x19ba24[_0x96cf('0x31')][_0x96cf('0x3c')]){_0x309139[_0x96cf('0x3a')]=_['merge'](_0x309139['where'],{'$or':_[_0x96cf('0x29')](_0x309139[_0x96cf('0x34')],function(_0x4df5c8){var _0x348927={};_0x348927[_0x4df5c8]={'$like':'%'+_0x19ba24[_0x96cf('0x31')][_0x96cf('0x3c')]+'%'};return _0x348927;})});}_0x309139=_[_0x96cf('0x3d')]({},_0x309139,_0x19ba24[_0x96cf('0x3f')]);return _0x4756e5['getFields'](_0x309139);}})['then'](function(_0x374ba6){if(_0x374ba6){_0x2d0cb5=_0x374ba6['length'];if(!_0x19ba24['query']['hasOwnProperty'](_0x96cf('0x38'))){_0x309139[_0x96cf('0x1d')]=qs[_0x96cf('0x1d')](_0x19ba24[_0x96cf('0x31')]['limit']);_0x309139[_0x96cf('0x1e')]=qs[_0x96cf('0x1e')](_0x19ba24[_0x96cf('0x31')][_0x96cf('0x1e')]);}return _0x4756e5[_0x96cf('0x4f')](_0x309139);}})[_0x96cf('0x25')](function(_0x1aad8c){if(_0x1aad8c){return _0x1aad8c?{'count':_0x2d0cb5,'rows':_0x1aad8c}:null;}})[_0x96cf('0x25')](respondWithResult(_0x12a9aa,null))['catch'](handleError(_0x12a9aa,null));}; \ No newline at end of file +var _0x7089=['undefined','limit','count','set','Content-Range','apply','reject','save','update','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getSubjects','FreshsalesField','order','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x469190,_0x1f69f3){var _0x3e3a56=function(_0x5913b5){while(--_0x5913b5){_0x469190['push'](_0x469190['shift']());}};_0x3e3a56(++_0x1f69f3);}(_0x7089,0xd8));var _0x9708=function(_0x52f463,_0x3dee60){_0x52f463=_0x52f463-0x0;var _0x55e932=_0x7089[_0x52f463];return _0x55e932;};'use strict';var emlformat=require(_0x9708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9708('0x1'));var jsonpatch=require(_0x9708('0x2'));var rp=require('request-promise');var moment=require(_0x9708('0x3'));var BPromise=require(_0x9708('0x4'));var Mustache=require(_0x9708('0x5'));var util=require('util');var path=require(_0x9708('0x6'));var sox=require(_0x9708('0x7'));var csv=require('to-csv');var ejs=require(_0x9708('0x8'));var fs=require('fs');var fs_extra=require(_0x9708('0x9'));var _=require(_0x9708('0xa'));var squel=require('squel');var crypto=require(_0x9708('0xb'));var jsforce=require(_0x9708('0xc'));var deskjs=require(_0x9708('0xd'));var toCsv=require(_0x9708('0xe'));var querystring=require('querystring');var Papa=require(_0x9708('0xf'));var Redis=require(_0x9708('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9708('0x11'));var logger=require(_0x9708('0x12'))(_0x9708('0x13'));var utils=require(_0x9708('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9708('0x15'))['db'];function respondWithStatusCode(_0xa548fa,_0x3f6bab){_0x3f6bab=_0x3f6bab||0xcc;return function(_0x577fb7){if(_0x577fb7){return _0xa548fa[_0x9708('0x16')](_0x3f6bab);}return _0xa548fa['status'](_0x3f6bab)[_0x9708('0x17')]();};}function respondWithResult(_0x31397f,_0x138a65){_0x138a65=_0x138a65||0xc8;return function(_0x1c5d95){if(_0x1c5d95){return _0x31397f[_0x9708('0x18')](_0x138a65)[_0x9708('0x19')](_0x1c5d95);}};}function respondWithFilteredResult(_0x1eddc0,_0x3bcae4){return function(_0x980735){if(_0x980735){var _0x154a6a=typeof _0x3bcae4[_0x9708('0x1a')]===_0x9708('0x1b')&&typeof _0x3bcae4[_0x9708('0x1c')]===_0x9708('0x1b');var _0xbe3004=_0x980735[_0x9708('0x1d')];var _0x453835=_0x154a6a?0x0:_0x3bcae4[_0x9708('0x1a')];var _0x5935fd=_0x154a6a?_0x980735[_0x9708('0x1d')]:_0x3bcae4['offset']+_0x3bcae4[_0x9708('0x1c')];var _0x5e41d7;if(_0x5935fd>=_0xbe3004){_0x5935fd=_0xbe3004;_0x5e41d7=0xc8;}else{_0x5e41d7=0xce;}_0x1eddc0[_0x9708('0x18')](_0x5e41d7);return _0x1eddc0[_0x9708('0x1e')](_0x9708('0x1f'),_0x453835+'-'+_0x5935fd+'/'+_0xbe3004)[_0x9708('0x19')](_0x980735);}return null;};}function patchUpdates(_0x2ee0b1){return function(_0x3cd803){try{jsonpatch[_0x9708('0x20')](_0x3cd803,_0x2ee0b1,!![]);}catch(_0x117ce2){return BPromise[_0x9708('0x21')](_0x117ce2);}return _0x3cd803[_0x9708('0x22')]();};}function saveUpdates(_0x3bea52,_0x5055ba){return function(_0x2186c8){if(_0x2186c8){return _0x2186c8[_0x9708('0x23')](_0x3bea52)['then'](function(_0x59a10c){return _0x59a10c;});}return null;};}function removeEntity(_0x152c6e,_0x554af6){return function(_0x2eb3eb){if(_0x2eb3eb){return _0x2eb3eb['destroy']()['then'](function(){_0x152c6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bbbf,_0x4bc5c5){return function(_0x51145e){if(!_0x51145e){_0x29bbbf[_0x9708('0x16')](0x194);}return _0x51145e;};}function handleError(_0x22f944,_0x224eb7){_0x224eb7=_0x224eb7||0x1f4;return function(_0x4fd3cd){logger[_0x9708('0x24')](_0x4fd3cd['stack']);if(_0x4fd3cd[_0x9708('0x25')]){delete _0x4fd3cd[_0x9708('0x25')];}_0x22f944[_0x9708('0x18')](_0x224eb7)[_0x9708('0x26')](_0x4fd3cd);};}exports[_0x9708('0x27')]=function(_0x4c079d,_0x59398b){var _0x4643cb={},_0x193c84={},_0x361fd2={'count':0x0,'rows':[]};var _0x227fe5=_[_0x9708('0x28')](db[_0x9708('0x29')][_0x9708('0x2a')],function(_0x2a77a7){return{'name':_0x2a77a7[_0x9708('0x2b')],'type':_0x2a77a7['type'][_0x9708('0x2c')]};});_0x193c84[_0x9708('0x2d')]=_['map'](_0x227fe5,_0x9708('0x25'));_0x193c84[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x4c079d[_0x9708('0x2e')]);_0x193c84[_0x9708('0x30')]=_[_0x9708('0x31')](_0x193c84['model'],_0x193c84[_0x9708('0x2e')]);_0x4643cb[_0x9708('0x32')]=_[_0x9708('0x31')](_0x193c84[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x4c079d[_0x9708('0x2e')][_0x9708('0x33')]));_0x4643cb['attributes']=_0x4643cb[_0x9708('0x32')][_0x9708('0x34')]?_0x4643cb['attributes']:_0x193c84['model'];if(!_0x4c079d[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x4643cb[_0x9708('0x1c')]=qs['limit'](_0x4c079d[_0x9708('0x2e')]['limit']);_0x4643cb[_0x9708('0x1a')]=qs['offset'](_0x4c079d[_0x9708('0x2e')][_0x9708('0x1a')]);}_0x4643cb['order']=qs[_0x9708('0x37')](_0x4c079d[_0x9708('0x2e')]['sort']);_0x4643cb[_0x9708('0x38')]=qs[_0x9708('0x30')](_[_0x9708('0x39')](_0x4c079d[_0x9708('0x2e')],_0x193c84['filters']),_0x227fe5);if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]){_0x4643cb['where']=_[_0x9708('0x3b')](_0x4643cb[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x227fe5,function(_0x304bd2){if(_0x304bd2[_0x9708('0x3c')]!==_0x9708('0x3d')){var _0x42f2d0={};_0x42f2d0[_0x304bd2['name']]={'$like':'%'+_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x42f2d0;}})});}_0x4643cb=_[_0x9708('0x3b')]({},_0x4643cb,_0x4c079d[_0x9708('0x3e')]);var _0x50b3f3={'where':_0x4643cb[_0x9708('0x38')]};return db['FreshsalesConfiguration'][_0x9708('0x1d')](_0x50b3f3)[_0x9708('0x3f')](function(_0x2b6175){_0x361fd2[_0x9708('0x1d')]=_0x2b6175;if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x40')]){_0x4643cb['include']=[{'all':!![]}];}return db[_0x9708('0x29')][_0x9708('0x41')](_0x4643cb);})[_0x9708('0x3f')](function(_0x11f406){_0x361fd2[_0x9708('0x42')]=_0x11f406;return _0x361fd2;})[_0x9708('0x3f')](respondWithFilteredResult(_0x59398b,_0x4643cb))[_0x9708('0x43')](handleError(_0x59398b,null));};exports[_0x9708('0x44')]=function(_0x1b770a,_0x294451){var _0x339b6e={'raw':![],'where':{'id':_0x1b770a[_0x9708('0x45')]['id']}},_0x2bd19f={};_0x2bd19f[_0x9708('0x2d')]=_[_0x9708('0x2f')](db['FreshsalesConfiguration'][_0x9708('0x2a')]);_0x2bd19f[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x1b770a[_0x9708('0x2e')]);_0x2bd19f[_0x9708('0x30')]=_['intersection'](_0x2bd19f[_0x9708('0x2d')],_0x2bd19f['query']);_0x339b6e[_0x9708('0x32')]=_[_0x9708('0x31')](_0x2bd19f['model'],qs[_0x9708('0x33')](_0x1b770a[_0x9708('0x2e')][_0x9708('0x33')]));_0x339b6e['attributes']=_0x339b6e[_0x9708('0x32')]['length']?_0x339b6e[_0x9708('0x32')]:_0x2bd19f[_0x9708('0x2d')];if(_0x1b770a['query']['includeAll']){_0x339b6e[_0x9708('0x46')]=[{'all':!![]}];}_0x339b6e=_[_0x9708('0x3b')]({},_0x339b6e,_0x1b770a[_0x9708('0x3e')]);return db[_0x9708('0x29')][_0x9708('0x47')](_0x339b6e)['then'](handleEntityNotFound(_0x294451,null))['then'](respondWithResult(_0x294451,null))['catch'](handleError(_0x294451,null));};exports['create']=function(_0x36f1e5,_0x3d045b){return db[_0x9708('0x29')][_0x9708('0x48')](_0x36f1e5[_0x9708('0x49')],{})[_0x9708('0x3f')](respondWithResult(_0x3d045b,0xc9))[_0x9708('0x43')](handleError(_0x3d045b,null));};exports[_0x9708('0x23')]=function(_0x13cf6a,_0x505da8){if(_0x13cf6a[_0x9708('0x49')]['id']){delete _0x13cf6a['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x13cf6a['params']['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x505da8,null))[_0x9708('0x3f')](saveUpdates(_0x13cf6a['body'],null))[_0x9708('0x3f')](respondWithResult(_0x505da8,null))[_0x9708('0x43')](handleError(_0x505da8,null));};exports[_0x9708('0x4a')]=function(_0x44b577,_0x5a59b6){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x44b577[_0x9708('0x45')]['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x5a59b6,null))[_0x9708('0x3f')](removeEntity(_0x5a59b6,null))['catch'](handleError(_0x5a59b6,null));};exports[_0x9708('0x4b')]=function(_0x165e20,_0x41bf46,_0x27863e){var _0x28e39e={};var _0x5ae18c={};var _0x323487;var _0x2e471f;return db[_0x9708('0x29')]['findOne']({'where':{'id':_0x165e20[_0x9708('0x45')]['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x41bf46,null))[_0x9708('0x3f')](function(_0x27ca8c){if(_0x27ca8c){_0x323487=_0x27ca8c;_0x5ae18c[_0x9708('0x2d')]=_[_0x9708('0x2f')](db[_0x9708('0x4c')]['rawAttributes']);_0x5ae18c[_0x9708('0x2e')]=_['keys'](_0x165e20[_0x9708('0x2e')]);_0x5ae18c[_0x9708('0x30')]=_[_0x9708('0x31')](_0x5ae18c[_0x9708('0x2d')],_0x5ae18c[_0x9708('0x2e')]);_0x28e39e['attributes']=_[_0x9708('0x31')](_0x5ae18c[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x165e20[_0x9708('0x2e')][_0x9708('0x33')]));_0x28e39e[_0x9708('0x32')]=_0x28e39e[_0x9708('0x32')][_0x9708('0x34')]?_0x28e39e[_0x9708('0x32')]:_0x5ae18c[_0x9708('0x2d')];_0x28e39e[_0x9708('0x4d')]=qs[_0x9708('0x37')](_0x165e20[_0x9708('0x2e')][_0x9708('0x37')]);_0x28e39e['where']=qs[_0x9708('0x30')](_['pick'](_0x165e20[_0x9708('0x2e')],_0x5ae18c[_0x9708('0x30')]));if(_0x165e20[_0x9708('0x2e')][_0x9708('0x3a')]){_0x28e39e[_0x9708('0x38')]=_[_0x9708('0x3b')](_0x28e39e[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x28e39e[_0x9708('0x32')],function(_0x1a02f8){var _0x156995={};_0x156995[_0x1a02f8]={'$like':'%'+_0x165e20[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x156995;})});}_0x28e39e=_[_0x9708('0x3b')]({},_0x28e39e,_0x165e20['options']);return _0x323487[_0x9708('0x4b')](_0x28e39e);}})['then'](function(_0x45b333){if(_0x45b333){_0x2e471f=_0x45b333[_0x9708('0x34')];if(!_0x165e20[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x28e39e[_0x9708('0x1c')]=qs[_0x9708('0x1c')](_0x165e20[_0x9708('0x2e')][_0x9708('0x1c')]);_0x28e39e['offset']=qs[_0x9708('0x1a')](_0x165e20[_0x9708('0x2e')][_0x9708('0x1a')]);}return _0x323487[_0x9708('0x4b')](_0x28e39e);}})[_0x9708('0x3f')](function(_0x21b718){if(_0x21b718){return _0x21b718?{'count':_0x2e471f,'rows':_0x21b718}:null;}})[_0x9708('0x3f')](respondWithResult(_0x41bf46,null))[_0x9708('0x43')](handleError(_0x41bf46,null));};exports[_0x9708('0x4e')]=function(_0x5e5bb8,_0x21ecbf,_0x5ae09c){var _0x38cb2b={};var _0x4e1784={};var _0x1d39df;var _0x5f33b5;return db[_0x9708('0x29')][_0x9708('0x4f')]({'where':{'id':_0x5e5bb8[_0x9708('0x45')]['id']}})[_0x9708('0x3f')](handleEntityNotFound(_0x21ecbf,null))[_0x9708('0x3f')](function(_0x5e4a9a){if(_0x5e4a9a){_0x1d39df=_0x5e4a9a;_0x4e1784[_0x9708('0x2d')]=_['keys'](db[_0x9708('0x4c')][_0x9708('0x2a')]);_0x4e1784[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x5e5bb8[_0x9708('0x2e')]);_0x4e1784[_0x9708('0x30')]=_[_0x9708('0x31')](_0x4e1784[_0x9708('0x2d')],_0x4e1784[_0x9708('0x2e')]);_0x38cb2b[_0x9708('0x32')]=_[_0x9708('0x31')](_0x4e1784[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x5e5bb8['query']['fields']));_0x38cb2b[_0x9708('0x32')]=_0x38cb2b[_0x9708('0x32')]['length']?_0x38cb2b['attributes']:_0x4e1784[_0x9708('0x2d')];_0x38cb2b[_0x9708('0x4d')]=qs[_0x9708('0x37')](_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x37')]);_0x38cb2b[_0x9708('0x38')]=qs['filters'](_[_0x9708('0x39')](_0x5e5bb8[_0x9708('0x2e')],_0x4e1784[_0x9708('0x30')]));if(_0x5e5bb8['query'][_0x9708('0x3a')]){_0x38cb2b[_0x9708('0x38')]=_[_0x9708('0x3b')](_0x38cb2b[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x38cb2b['attributes'],function(_0x5096f1){var _0x32e4d6={};_0x32e4d6[_0x5096f1]={'$like':'%'+_0x5e5bb8['query'][_0x9708('0x3a')]+'%'};return _0x32e4d6;})});}_0x38cb2b=_[_0x9708('0x3b')]({},_0x38cb2b,_0x5e5bb8[_0x9708('0x3e')]);return _0x1d39df['getDescriptions'](_0x38cb2b);}})[_0x9708('0x3f')](function(_0x190807){if(_0x190807){_0x5f33b5=_0x190807[_0x9708('0x34')];if(!_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x38cb2b['limit']=qs[_0x9708('0x1c')](_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x1c')]);_0x38cb2b[_0x9708('0x1a')]=qs['offset'](_0x5e5bb8[_0x9708('0x2e')][_0x9708('0x1a')]);}return _0x1d39df['getDescriptions'](_0x38cb2b);}})[_0x9708('0x3f')](function(_0x2eb536){if(_0x2eb536){return _0x2eb536?{'count':_0x5f33b5,'rows':_0x2eb536}:null;}})['then'](respondWithResult(_0x21ecbf,null))[_0x9708('0x43')](handleError(_0x21ecbf,null));};exports['getFields']=function(_0x536639,_0x2834bf,_0x326807){var _0x5d8c57={};var _0x2e9328={};var _0x5b2f0f;var _0x682578;return db[_0x9708('0x29')]['findOne']({'where':{'id':_0x536639['params']['id']}})['then'](handleEntityNotFound(_0x2834bf,null))[_0x9708('0x3f')](function(_0x34dfe4){if(_0x34dfe4){_0x5b2f0f=_0x34dfe4;_0x2e9328[_0x9708('0x2d')]=_['keys'](db['FreshsalesField'][_0x9708('0x2a')]);_0x2e9328['query']=_['keys'](_0x536639['query']);_0x2e9328[_0x9708('0x30')]=_['intersection'](_0x2e9328['model'],_0x2e9328[_0x9708('0x2e')]);_0x5d8c57['attributes']=_['intersection'](_0x2e9328[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x536639[_0x9708('0x2e')][_0x9708('0x33')]));_0x5d8c57['attributes']=_0x5d8c57[_0x9708('0x32')][_0x9708('0x34')]?_0x5d8c57[_0x9708('0x32')]:_0x2e9328[_0x9708('0x2d')];_0x5d8c57[_0x9708('0x4d')]=qs['sort'](_0x536639[_0x9708('0x2e')][_0x9708('0x37')]);_0x5d8c57[_0x9708('0x38')]=qs[_0x9708('0x30')](_['pick'](_0x536639[_0x9708('0x2e')],_0x2e9328[_0x9708('0x30')]));if(_0x536639[_0x9708('0x2e')][_0x9708('0x3a')]){_0x5d8c57[_0x9708('0x38')]=_[_0x9708('0x3b')](_0x5d8c57['where'],{'$or':_['map'](_0x5d8c57['attributes'],function(_0x33e17f){var _0x14be86={};_0x14be86[_0x33e17f]={'$like':'%'+_0x536639[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x14be86;})});}_0x5d8c57=_[_0x9708('0x3b')]({},_0x5d8c57,_0x536639[_0x9708('0x3e')]);return _0x5b2f0f['getFields'](_0x5d8c57);}})[_0x9708('0x3f')](function(_0x35d6fc){if(_0x35d6fc){_0x682578=_0x35d6fc['length'];if(!_0x536639[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x5d8c57['limit']=qs[_0x9708('0x1c')](_0x536639[_0x9708('0x2e')][_0x9708('0x1c')]);_0x5d8c57['offset']=qs[_0x9708('0x1a')](_0x536639[_0x9708('0x2e')]['offset']);}return _0x5b2f0f[_0x9708('0x50')](_0x5d8c57);}})[_0x9708('0x3f')](function(_0x529bfa){if(_0x529bfa){return _0x529bfa?{'count':_0x682578,'rows':_0x529bfa}:null;}})['then'](respondWithResult(_0x2834bf,null))[_0x9708('0x43')](handleError(_0x2834bf,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d79e1e4..ccfa962 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 _0xc235=['int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','FreshsalesConfiguration'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc235,0x145));var _0x5c23=function(_0x284240,_0x555b56){_0x284240=_0x284240-0x0;var _0x390667=_0xc235[_0x284240];return _0x390667;};'use strict';var _=require(_0x5c23('0x0'));var util=require(_0x5c23('0x1'));var logger=require('../../config/logger')(_0x5c23('0x2'));var moment=require(_0x5c23('0x3'));var BPromise=require(_0x5c23('0x4'));var rp=require(_0x5c23('0x5'));var fs=require('fs');var path=require(_0x5c23('0x6'));var rimraf=require(_0x5c23('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5c23('0x8')]=function(_0x185b3a,_0x5ba033){return _0x185b3a[_0x5c23('0x9')](_0x5c23('0xa'),attributes,{'tableName':_0x5c23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6de0=['../../config/logger','api','bluebird','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','util'];(function(_0x4c209c,_0x7b9730){var _0x10b718=function(_0x42c934){while(--_0x42c934){_0x4c209c['push'](_0x4c209c['shift']());}};_0x10b718(++_0x7b9730);}(_0x6de0,0xce));var _0x06de=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6de0[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require('lodash');var util=require(_0x06de('0x0'));var logger=require(_0x06de('0x1'))(_0x06de('0x2'));var moment=require('moment');var BPromise=require(_0x06de('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x06de('0x4'));var config=require(_0x06de('0x5'));var attributes=require(_0x06de('0x6'));module[_0x06de('0x7')]=function(_0x1c15ba,_0x34e462){return _0x1c15ba['define']('FreshsalesConfiguration',attributes,{'tableName':_0x06de('0x8'),'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 95e7755..b7d9f52 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 _0x5f53=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x29112d,_0x4de18e){var _0x3bd2d9=function(_0x183399){while(--_0x183399){_0x29112d['push'](_0x29112d['shift']());}};_0x3bd2d9(++_0x4de18e);}(_0x5f53,0x7c));var _0x35f5=function(_0x45d6a9,_0x549ec9){_0x45d6a9=_0x45d6a9-0x0;var _0x3f42a2=_0x5f53[_0x45d6a9];return _0x3f42a2;};'use strict';var _=require(_0x35f5('0x0'));var util=require(_0x35f5('0x1'));var moment=require(_0x35f5('0x2'));var BPromise=require(_0x35f5('0x3'));var rs=require(_0x35f5('0x4'));var fs=require('fs');var Redis=require(_0x35f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35f5('0x6'))('rpc');var config=require(_0x35f5('0x7'));var jayson=require(_0x35f5('0x8'));var client=jayson[_0x35f5('0x9')][_0x35f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5b34,_0x1e7ca2,_0x1600e8){return new BPromise(function(_0x3f0ce6,_0x1593af){return client[_0x35f5('0xb')](_0x3f5b34,_0x1600e8)[_0x35f5('0xc')](function(_0x2e53cf){logger[_0x35f5('0xd')](_0x35f5('0xe'),_0x1e7ca2,_0x35f5('0xf'));logger[_0x35f5('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1e7ca2,_0x35f5('0xf'),JSON[_0x35f5('0x11')](_0x2e53cf));if(_0x2e53cf['error']){if(_0x2e53cf['error'][_0x35f5('0x12')]===0x1f4){logger[_0x35f5('0x13')](_0x35f5('0xe'),_0x1e7ca2,_0x2e53cf[_0x35f5('0x13')]['message']);return _0x1593af(_0x2e53cf[_0x35f5('0x13')][_0x35f5('0x14')]);}logger[_0x35f5('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1e7ca2,_0x2e53cf['error']['message']);return _0x3f0ce6(_0x2e53cf[_0x35f5('0x13')]['message']);}else{logger['info'](_0x35f5('0xe'),_0x1e7ca2,_0x35f5('0xf'));_0x3f0ce6(_0x2e53cf[_0x35f5('0x15')][_0x35f5('0x14')]);}})['catch'](function(_0x4e19ee){logger[_0x35f5('0x13')](_0x35f5('0xe'),_0x1e7ca2,_0x4e19ee);_0x1593af(_0x4e19ee);});});} \ No newline at end of file +var _0xc9f8=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc9f8,0x1c3));var _0x8c9f=function(_0x5a4d99,_0x4a1a69){_0x5a4d99=_0x5a4d99-0x0;var _0x4f9907=_0xc9f8[_0x5a4d99];return _0x4f9907;};'use strict';var _=require(_0x8c9f('0x0'));var util=require(_0x8c9f('0x1'));var moment=require(_0x8c9f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c9f('0x3'));var fs=require('fs');var Redis=require(_0x8c9f('0x4'));var db=require(_0x8c9f('0x5'))['db'];var utils=require(_0x8c9f('0x6'));var logger=require(_0x8c9f('0x7'))(_0x8c9f('0x8'));var config=require(_0x8c9f('0x9'));var jayson=require(_0x8c9f('0xa'));var client=jayson['client'][_0x8c9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535e11,_0xa3a25c,_0x58487d){return new BPromise(function(_0x1f5c81,_0x3ce71a){return client[_0x8c9f('0xc')](_0x535e11,_0x58487d)[_0x8c9f('0xd')](function(_0x17e7ae){logger['info'](_0x8c9f('0xe'),_0xa3a25c,_0x8c9f('0xf'));logger[_0x8c9f('0x10')](_0x8c9f('0x11'),_0xa3a25c,_0x8c9f('0xf'),JSON[_0x8c9f('0x12')](_0x17e7ae));if(_0x17e7ae[_0x8c9f('0x13')]){if(_0x17e7ae['error'][_0x8c9f('0x14')]===0x1f4){logger['error'](_0x8c9f('0xe'),_0xa3a25c,_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);return _0x3ce71a(_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);}logger['error'](_0x8c9f('0xe'),_0xa3a25c,_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);return _0x1f5c81(_0x17e7ae[_0x8c9f('0x13')][_0x8c9f('0x15')]);}else{logger[_0x8c9f('0x16')](_0x8c9f('0xe'),_0xa3a25c,_0x8c9f('0xf'));_0x1f5c81(_0x17e7ae[_0x8c9f('0x17')][_0x8c9f('0x15')]);}})[_0x8c9f('0x18')](function(_0x57e44d){logger['error'](_0x8c9f('0xe'),_0xa3a25c,_0x57e44d);_0x3ce71a(_0x57e44d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9808338..83bd1a3 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 _0xe5b3=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','show','post','/:id'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2df56c,_0x26b29e){_0x2df56c=_0x2df56c-0x0;var _0x3ab486=_0xe5b3[_0x2df56c];return _0x3ab486;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/:id',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xe')]('/',auth[_0x3e5b('0xc')](),controller['create']);router['put'](_0x3e5b('0xf'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xf'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1094=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x1094,0x143));var _0x4109=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x1094[_0xf48cce];return _0x2a5c38;};'use strict';var multer=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var path=require('path');var timeout=require(_0x4109('0x2'));var express=require('express');var router=express[_0x4109('0x3')]();var fs_extra=require(_0x4109('0x4'));var auth=require(_0x4109('0x5'));var interaction=require(_0x4109('0x6'));var config=require(_0x4109('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x4109('0x8')]('/',auth[_0x4109('0x9')](),controller[_0x4109('0xa')]);router[_0x4109('0x8')](_0x4109('0xb'),auth[_0x4109('0x9')](),controller['show']);router[_0x4109('0xc')]('/',auth[_0x4109('0x9')](),controller[_0x4109('0xd')]);router[_0x4109('0xe')](_0x4109('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4109('0xf')]('/:id',auth[_0x4109('0x9')](),controller[_0x4109('0x10')]);module[_0x4109('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4d2efb0..6a29898 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 _0x9942=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x6dd412,_0x3b5aec){var _0x2923fd=function(_0x2642e6){while(--_0x2642e6){_0x6dd412['push'](_0x6dd412['shift']());}};_0x2923fd(++_0x3b5aec);}(_0x9942,0xfc));var _0x2994=function(_0x5e2ac7,_0x45265d){_0x5e2ac7=_0x5e2ac7-0x0;var _0x4fb946=_0x9942[_0x5e2ac7];return _0x4fb946;};'use strict';var Sequelize=require('sequelize');module[_0x2994('0x0')]={'type':{'type':Sequelize[_0x2994('0x1')](_0x2994('0x2'),_0x2994('0x3'),_0x2994('0x4'),_0x2994('0x5'),_0x2994('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2994('0x7')]},'keyType':{'type':Sequelize[_0x2994('0x1')](_0x2994('0x2'),_0x2994('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2994('0x7')]},'nameField':{'type':Sequelize[_0x2994('0x7')]},'customField':{'type':Sequelize[_0x2994('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2994('0x7')]}}; \ No newline at end of file +var _0x19e9=['customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x155e04,_0x28cd61){var _0x4590d0=function(_0x3f685b){while(--_0x3f685b){_0x155e04['push'](_0x155e04['shift']());}};_0x4590d0(++_0x28cd61);}(_0x19e9,0xe4));var _0x919e=function(_0x2f844d,_0x179122){_0x2f844d=_0x2f844d-0x0;var _0x57e229=_0x19e9[_0x2f844d];return _0x57e229;};'use strict';var Sequelize=require('sequelize');module[_0x919e('0x0')]={'type':{'type':Sequelize[_0x919e('0x1')](_0x919e('0x2'),_0x919e('0x3'),_0x919e('0x4'),_0x919e('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x919e('0x6')]},'key':{'type':Sequelize[_0x919e('0x6')]},'keyType':{'type':Sequelize[_0x919e('0x1')](_0x919e('0x2'),_0x919e('0x3'),_0x919e('0x4'))},'keyContent':{'type':Sequelize[_0x919e('0x6')]},'idField':{'type':Sequelize[_0x919e('0x6')]},'nameField':{'type':Sequelize[_0x919e('0x6')]},'customField':{'type':Sequelize[_0x919e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x919e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 6aa2fdd..50ccd2a 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 _0x0204=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','query','keys','intersection','model','fields'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x0204,0xe9));var _0x4020=function(_0xd9d5d1,_0x1eb93a){_0xd9d5d1=_0xd9d5d1-0x0;var _0x41b8c0=_0x0204[_0xd9d5d1];return _0x41b8c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4020('0x0'));var zipdir=require(_0x4020('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4020('0x2'));var moment=require('moment');var BPromise=require(_0x4020('0x3'));var Mustache=require(_0x4020('0x4'));var util=require(_0x4020('0x5'));var path=require('path');var sox=require(_0x4020('0x6'));var csv=require(_0x4020('0x7'));var ejs=require(_0x4020('0x8'));var fs=require('fs');var fs_extra=require(_0x4020('0x9'));var _=require(_0x4020('0xa'));var squel=require(_0x4020('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4020('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4020('0xd'));var Papa=require(_0x4020('0xe'));var Redis=require('ioredis');var authService=require(_0x4020('0xf'));var qs=require(_0x4020('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4020('0x11'));var logger=require(_0x4020('0x12'))('api');var utils=require(_0x4020('0x13'));var config=require(_0x4020('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4020('0x15'))['db'];function respondWithStatusCode(_0x3383ef,_0x4422ef){_0x4422ef=_0x4422ef||0xcc;return function(_0x21d689){if(_0x21d689){return _0x3383ef[_0x4020('0x16')](_0x4422ef);}return _0x3383ef[_0x4020('0x17')](_0x4422ef)[_0x4020('0x18')]();};}function respondWithResult(_0xe62329,_0x5c1990){_0x5c1990=_0x5c1990||0xc8;return function(_0x1f1b79){if(_0x1f1b79){return _0xe62329[_0x4020('0x17')](_0x5c1990)[_0x4020('0x19')](_0x1f1b79);}};}function respondWithFilteredResult(_0x30175a,_0x10bb22){return function(_0x11d63f){if(_0x11d63f){var _0x1482d1=typeof _0x10bb22[_0x4020('0x1a')]===_0x4020('0x1b')&&typeof _0x10bb22[_0x4020('0x1c')]===_0x4020('0x1b');var _0x25ca21=_0x11d63f[_0x4020('0x1d')];var _0x3a702c=_0x1482d1?0x0:_0x10bb22[_0x4020('0x1a')];var _0xbabf43=_0x1482d1?_0x11d63f[_0x4020('0x1d')]:_0x10bb22[_0x4020('0x1a')]+_0x10bb22['limit'];var _0x1f388c;if(_0xbabf43>=_0x25ca21){_0xbabf43=_0x25ca21;_0x1f388c=0xc8;}else{_0x1f388c=0xce;}_0x30175a[_0x4020('0x17')](_0x1f388c);return _0x30175a[_0x4020('0x1e')](_0x4020('0x1f'),_0x3a702c+'-'+_0xbabf43+'/'+_0x25ca21)[_0x4020('0x19')](_0x11d63f);}return null;};}function patchUpdates(_0x43e358){return function(_0x3851b0){try{jsonpatch['apply'](_0x3851b0,_0x43e358,!![]);}catch(_0x54b766){return BPromise['reject'](_0x54b766);}return _0x3851b0['save']();};}function saveUpdates(_0x2ad65b,_0x2706bb){return function(_0x354b83){if(_0x354b83){return _0x354b83[_0x4020('0x20')](_0x2ad65b)[_0x4020('0x21')](function(_0x2fac8b){return _0x2fac8b;});}return null;};}function removeEntity(_0x103648,_0x4db58b){return function(_0x5d8730){if(_0x5d8730){return _0x5d8730['destroy']()[_0x4020('0x21')](function(){_0x103648[_0x4020('0x17')](0xcc)[_0x4020('0x18')]();});}};}function handleEntityNotFound(_0x1ebb6f,_0x410800){return function(_0x11325a){if(!_0x11325a){_0x1ebb6f['sendStatus'](0x194);}return _0x11325a;};}function handleError(_0x45b7c1,_0x5398a8){_0x5398a8=_0x5398a8||0x1f4;return function(_0x38c13a){logger[_0x4020('0x22')](_0x38c13a[_0x4020('0x23')]);if(_0x38c13a[_0x4020('0x24')]){delete _0x38c13a[_0x4020('0x24')];}_0x45b7c1[_0x4020('0x17')](_0x5398a8)[_0x4020('0x25')](_0x38c13a);};}exports['index']=function(_0x5ba550,_0x4fc917){var _0x3638b9={},_0x5dfab4={},_0x3dc43b={'count':0x0,'rows':[]};var _0x5ce3e6=_[_0x4020('0x26')](db[_0x4020('0x27')][_0x4020('0x28')],function(_0x413671){return{'name':_0x413671[_0x4020('0x29')],'type':_0x413671['type']['key']};});_0x5dfab4['model']=_[_0x4020('0x26')](_0x5ce3e6,_0x4020('0x24'));_0x5dfab4[_0x4020('0x2a')]=_[_0x4020('0x2b')](_0x5ba550[_0x4020('0x2a')]);_0x5dfab4['filters']=_[_0x4020('0x2c')](_0x5dfab4[_0x4020('0x2d')],_0x5dfab4[_0x4020('0x2a')]);_0x3638b9['attributes']=_[_0x4020('0x2c')](_0x5dfab4[_0x4020('0x2d')],qs['fields'](_0x5ba550[_0x4020('0x2a')][_0x4020('0x2e')]));_0x3638b9[_0x4020('0x2f')]=_0x3638b9[_0x4020('0x2f')][_0x4020('0x30')]?_0x3638b9[_0x4020('0x2f')]:_0x5dfab4[_0x4020('0x2d')];if(!_0x5ba550[_0x4020('0x2a')][_0x4020('0x31')]('nolimit')){_0x3638b9[_0x4020('0x1c')]=qs[_0x4020('0x1c')](_0x5ba550[_0x4020('0x2a')][_0x4020('0x1c')]);_0x3638b9[_0x4020('0x1a')]=qs['offset'](_0x5ba550[_0x4020('0x2a')]['offset']);}_0x3638b9[_0x4020('0x32')]=qs[_0x4020('0x33')](_0x5ba550[_0x4020('0x2a')]['sort']);_0x3638b9[_0x4020('0x34')]=qs[_0x4020('0x35')](_[_0x4020('0x36')](_0x5ba550[_0x4020('0x2a')],_0x5dfab4['filters']),_0x5ce3e6);if(_0x5ba550[_0x4020('0x2a')][_0x4020('0x37')]){_0x3638b9['where']=_['merge'](_0x3638b9['where'],{'$or':_[_0x4020('0x26')](_0x5ce3e6,function(_0x1bc95a){if(_0x1bc95a[_0x4020('0x38')]!==_0x4020('0x39')){var _0x24da8c={};_0x24da8c[_0x1bc95a[_0x4020('0x24')]]={'$like':'%'+_0x5ba550[_0x4020('0x2a')][_0x4020('0x37')]+'%'};return _0x24da8c;}})});}_0x3638b9=_['merge']({},_0x3638b9,_0x5ba550[_0x4020('0x3a')]);var _0x2bb983={'where':_0x3638b9[_0x4020('0x34')]};return db[_0x4020('0x27')][_0x4020('0x1d')](_0x2bb983)[_0x4020('0x21')](function(_0x20e997){_0x3dc43b[_0x4020('0x1d')]=_0x20e997;if(_0x5ba550[_0x4020('0x2a')][_0x4020('0x3b')]){_0x3638b9[_0x4020('0x3c')]=[{'all':!![]}];}return db['FreshsalesField'][_0x4020('0x3d')](_0x3638b9);})['then'](function(_0x5b933b){_0x3dc43b[_0x4020('0x3e')]=_0x5b933b;return _0x3dc43b;})['then'](respondWithFilteredResult(_0x4fc917,_0x3638b9))[_0x4020('0x3f')](handleError(_0x4fc917,null));};exports[_0x4020('0x40')]=function(_0x4d96cb,_0x3b3eb0){var _0x26659f={'raw':!![],'where':{'id':_0x4d96cb[_0x4020('0x41')]['id']}},_0x53b90b={};_0x53b90b[_0x4020('0x2d')]=_[_0x4020('0x2b')](db[_0x4020('0x27')][_0x4020('0x28')]);_0x53b90b[_0x4020('0x2a')]=_[_0x4020('0x2b')](_0x4d96cb[_0x4020('0x2a')]);_0x53b90b[_0x4020('0x35')]=_[_0x4020('0x2c')](_0x53b90b[_0x4020('0x2d')],_0x53b90b[_0x4020('0x2a')]);_0x26659f[_0x4020('0x2f')]=_['intersection'](_0x53b90b[_0x4020('0x2d')],qs[_0x4020('0x2e')](_0x4d96cb['query'][_0x4020('0x2e')]));_0x26659f[_0x4020('0x2f')]=_0x26659f['attributes']['length']?_0x26659f[_0x4020('0x2f')]:_0x53b90b[_0x4020('0x2d')];if(_0x4d96cb['query'][_0x4020('0x3b')]){_0x26659f[_0x4020('0x3c')]=[{'all':!![]}];}_0x26659f=_['merge']({},_0x26659f,_0x4d96cb[_0x4020('0x3a')]);return db['FreshsalesField'][_0x4020('0x42')](_0x26659f)[_0x4020('0x21')](handleEntityNotFound(_0x3b3eb0,null))[_0x4020('0x21')](respondWithResult(_0x3b3eb0,null))['catch'](handleError(_0x3b3eb0,null));};exports[_0x4020('0x43')]=function(_0x4710d2,_0x3dbcd6){return db[_0x4020('0x27')][_0x4020('0x43')](_0x4710d2[_0x4020('0x44')],{})[_0x4020('0x21')](respondWithResult(_0x3dbcd6,0xc9))['catch'](handleError(_0x3dbcd6,null));};exports[_0x4020('0x20')]=function(_0xb96af2,_0xe494ab){if(_0xb96af2[_0x4020('0x44')]['id']){delete _0xb96af2[_0x4020('0x44')]['id'];}return db[_0x4020('0x27')][_0x4020('0x42')]({'where':{'id':_0xb96af2[_0x4020('0x41')]['id']}})['then'](handleEntityNotFound(_0xe494ab,null))[_0x4020('0x21')](saveUpdates(_0xb96af2[_0x4020('0x44')],null))[_0x4020('0x21')](respondWithResult(_0xe494ab,null))['catch'](handleError(_0xe494ab,null));};exports[_0x4020('0x45')]=function(_0x231d1f,_0x242889){return db[_0x4020('0x27')][_0x4020('0x42')]({'where':{'id':_0x231d1f['params']['id']}})[_0x4020('0x21')](handleEntityNotFound(_0x242889,null))[_0x4020('0x21')](removeEntity(_0x242889,null))[_0x4020('0x3f')](handleError(_0x242889,null));}; \ No newline at end of file +var _0x9d9c=['intersection','model','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','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','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters'];(function(_0x1e5b77,_0x339462){var _0x353508=function(_0x228a95){while(--_0x228a95){_0x1e5b77['push'](_0x1e5b77['shift']());}};_0x353508(++_0x339462);}(_0x9d9c,0xa6));var _0xc9d9=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x9d9c[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require(_0xc9d9('0x0'));var rimraf=require(_0xc9d9('0x1'));var zipdir=require(_0xc9d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9d9('0x3'));var moment=require(_0xc9d9('0x4'));var BPromise=require(_0xc9d9('0x5'));var Mustache=require('mustache');var util=require(_0xc9d9('0x6'));var path=require(_0xc9d9('0x7'));var sox=require(_0xc9d9('0x8'));var csv=require(_0xc9d9('0x9'));var ejs=require(_0xc9d9('0xa'));var fs=require('fs');var fs_extra=require(_0xc9d9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9d9('0xc'));var jsforce=require(_0xc9d9('0xd'));var deskjs=require(_0xc9d9('0xe'));var toCsv=require(_0xc9d9('0x9'));var querystring=require('querystring');var Papa=require(_0xc9d9('0xf'));var Redis=require(_0xc9d9('0x10'));var authService=require(_0xc9d9('0x11'));var qs=require(_0xc9d9('0x12'));var as=require(_0xc9d9('0x13'));var hardwareService=require(_0xc9d9('0x14'));var logger=require(_0xc9d9('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc9d9('0x16'));var licenseUtil=require(_0xc9d9('0x17'));var db=require(_0xc9d9('0x18'))['db'];function respondWithStatusCode(_0x31dd9a,_0x4da1e9){_0x4da1e9=_0x4da1e9||0xcc;return function(_0x41506a){if(_0x41506a){return _0x31dd9a[_0xc9d9('0x19')](_0x4da1e9);}return _0x31dd9a[_0xc9d9('0x1a')](_0x4da1e9)[_0xc9d9('0x1b')]();};}function respondWithResult(_0x442cc9,_0x12e892){_0x12e892=_0x12e892||0xc8;return function(_0x5559af){if(_0x5559af){return _0x442cc9[_0xc9d9('0x1a')](_0x12e892)[_0xc9d9('0x1c')](_0x5559af);}};}function respondWithFilteredResult(_0x113ff8,_0x1bd349){return function(_0x4b12ae){if(_0x4b12ae){var _0x1ad43d=typeof _0x1bd349[_0xc9d9('0x1d')]===_0xc9d9('0x1e')&&typeof _0x1bd349['limit']==='undefined';var _0x1eaa3d=_0x4b12ae[_0xc9d9('0x1f')];var _0x2eadb3=_0x1ad43d?0x0:_0x1bd349[_0xc9d9('0x1d')];var _0x1c870b=_0x1ad43d?_0x4b12ae[_0xc9d9('0x1f')]:_0x1bd349[_0xc9d9('0x1d')]+_0x1bd349[_0xc9d9('0x20')];var _0x523118;if(_0x1c870b>=_0x1eaa3d){_0x1c870b=_0x1eaa3d;_0x523118=0xc8;}else{_0x523118=0xce;}_0x113ff8['status'](_0x523118);return _0x113ff8[_0xc9d9('0x21')](_0xc9d9('0x22'),_0x2eadb3+'-'+_0x1c870b+'/'+_0x1eaa3d)[_0xc9d9('0x1c')](_0x4b12ae);}return null;};}function patchUpdates(_0xc71aad){return function(_0xf3bcaa){try{jsonpatch[_0xc9d9('0x23')](_0xf3bcaa,_0xc71aad,!![]);}catch(_0x4d5eef){return BPromise['reject'](_0x4d5eef);}return _0xf3bcaa[_0xc9d9('0x24')]();};}function saveUpdates(_0xb8d94a,_0x7e380c){return function(_0x1deb2e){if(_0x1deb2e){return _0x1deb2e[_0xc9d9('0x25')](_0xb8d94a)[_0xc9d9('0x26')](function(_0x5983ef){return _0x5983ef;});}return null;};}function removeEntity(_0x290be7,_0x354d6a){return function(_0x4c0f2e){if(_0x4c0f2e){return _0x4c0f2e[_0xc9d9('0x27')]()[_0xc9d9('0x26')](function(){_0x290be7[_0xc9d9('0x1a')](0xcc)[_0xc9d9('0x1b')]();});}};}function handleEntityNotFound(_0x1d338e,_0x1ea6db){return function(_0x43d32c){if(!_0x43d32c){_0x1d338e[_0xc9d9('0x19')](0x194);}return _0x43d32c;};}function handleError(_0x1354a9,_0x1daf6f){_0x1daf6f=_0x1daf6f||0x1f4;return function(_0x286884){logger['error'](_0x286884['stack']);if(_0x286884[_0xc9d9('0x28')]){delete _0x286884['name'];}_0x1354a9['status'](_0x1daf6f)[_0xc9d9('0x29')](_0x286884);};}exports[_0xc9d9('0x2a')]=function(_0x53c526,_0x43ed44){var _0x52bac2={},_0x5bb56f={},_0x352084={'count':0x0,'rows':[]};var _0x4824ed=_[_0xc9d9('0x2b')](db['FreshsalesField'][_0xc9d9('0x2c')],function(_0x4d4bb8){return{'name':_0x4d4bb8[_0xc9d9('0x2d')],'type':_0x4d4bb8['type'][_0xc9d9('0x2e')]};});_0x5bb56f['model']=_[_0xc9d9('0x2b')](_0x4824ed,'name');_0x5bb56f[_0xc9d9('0x2f')]=_[_0xc9d9('0x30')](_0x53c526['query']);_0x5bb56f[_0xc9d9('0x31')]=_[_0xc9d9('0x32')](_0x5bb56f[_0xc9d9('0x33')],_0x5bb56f[_0xc9d9('0x2f')]);_0x52bac2[_0xc9d9('0x34')]=_[_0xc9d9('0x32')](_0x5bb56f['model'],qs['fields'](_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x35')]));_0x52bac2[_0xc9d9('0x34')]=_0x52bac2['attributes'][_0xc9d9('0x36')]?_0x52bac2[_0xc9d9('0x34')]:_0x5bb56f[_0xc9d9('0x33')];if(!_0x53c526[_0xc9d9('0x2f')]['hasOwnProperty']('nolimit')){_0x52bac2[_0xc9d9('0x20')]=qs[_0xc9d9('0x20')](_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x20')]);_0x52bac2[_0xc9d9('0x1d')]=qs[_0xc9d9('0x1d')](_0x53c526['query']['offset']);}_0x52bac2[_0xc9d9('0x37')]=qs['sort'](_0x53c526[_0xc9d9('0x2f')]['sort']);_0x52bac2[_0xc9d9('0x38')]=qs[_0xc9d9('0x31')](_[_0xc9d9('0x39')](_0x53c526[_0xc9d9('0x2f')],_0x5bb56f[_0xc9d9('0x31')]),_0x4824ed);if(_0x53c526['query'][_0xc9d9('0x3a')]){_0x52bac2['where']=_[_0xc9d9('0x3b')](_0x52bac2['where'],{'$or':_[_0xc9d9('0x2b')](_0x4824ed,function(_0x4db9c1){if(_0x4db9c1['type']!==_0xc9d9('0x3c')){var _0xbcb05b={};_0xbcb05b[_0x4db9c1[_0xc9d9('0x28')]]={'$like':'%'+_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x3a')]+'%'};return _0xbcb05b;}})});}_0x52bac2=_[_0xc9d9('0x3b')]({},_0x52bac2,_0x53c526[_0xc9d9('0x3d')]);var _0x1e5201={'where':_0x52bac2[_0xc9d9('0x38')]};return db[_0xc9d9('0x3e')]['count'](_0x1e5201)[_0xc9d9('0x26')](function(_0xea607d){_0x352084[_0xc9d9('0x1f')]=_0xea607d;if(_0x53c526[_0xc9d9('0x2f')][_0xc9d9('0x3f')]){_0x52bac2[_0xc9d9('0x40')]=[{'all':!![]}];}return db[_0xc9d9('0x3e')][_0xc9d9('0x41')](_0x52bac2);})['then'](function(_0x35aa2d){_0x352084['rows']=_0x35aa2d;return _0x352084;})[_0xc9d9('0x26')](respondWithFilteredResult(_0x43ed44,_0x52bac2))[_0xc9d9('0x42')](handleError(_0x43ed44,null));};exports[_0xc9d9('0x43')]=function(_0x53a36c,_0x1a5b52){var _0x9d33c1={'raw':!![],'where':{'id':_0x53a36c[_0xc9d9('0x44')]['id']}},_0x5203aa={};_0x5203aa[_0xc9d9('0x33')]=_[_0xc9d9('0x30')](db[_0xc9d9('0x3e')]['rawAttributes']);_0x5203aa[_0xc9d9('0x2f')]=_[_0xc9d9('0x30')](_0x53a36c[_0xc9d9('0x2f')]);_0x5203aa['filters']=_[_0xc9d9('0x32')](_0x5203aa[_0xc9d9('0x33')],_0x5203aa[_0xc9d9('0x2f')]);_0x9d33c1[_0xc9d9('0x34')]=_[_0xc9d9('0x32')](_0x5203aa[_0xc9d9('0x33')],qs['fields'](_0x53a36c['query']['fields']));_0x9d33c1[_0xc9d9('0x34')]=_0x9d33c1[_0xc9d9('0x34')][_0xc9d9('0x36')]?_0x9d33c1[_0xc9d9('0x34')]:_0x5203aa[_0xc9d9('0x33')];if(_0x53a36c[_0xc9d9('0x2f')][_0xc9d9('0x3f')]){_0x9d33c1[_0xc9d9('0x40')]=[{'all':!![]}];}_0x9d33c1=_['merge']({},_0x9d33c1,_0x53a36c['options']);return db[_0xc9d9('0x3e')]['find'](_0x9d33c1)[_0xc9d9('0x26')](handleEntityNotFound(_0x1a5b52,null))['then'](respondWithResult(_0x1a5b52,null))[_0xc9d9('0x42')](handleError(_0x1a5b52,null));};exports[_0xc9d9('0x45')]=function(_0x5f5113,_0x39259b){return db[_0xc9d9('0x3e')][_0xc9d9('0x45')](_0x5f5113[_0xc9d9('0x46')],{})[_0xc9d9('0x26')](respondWithResult(_0x39259b,0xc9))[_0xc9d9('0x42')](handleError(_0x39259b,null));};exports[_0xc9d9('0x25')]=function(_0x3a37a8,_0x119837){if(_0x3a37a8['body']['id']){delete _0x3a37a8['body']['id'];}return db[_0xc9d9('0x3e')][_0xc9d9('0x47')]({'where':{'id':_0x3a37a8[_0xc9d9('0x44')]['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x119837,null))[_0xc9d9('0x26')](saveUpdates(_0x3a37a8[_0xc9d9('0x46')],null))['then'](respondWithResult(_0x119837,null))[_0xc9d9('0x42')](handleError(_0x119837,null));};exports[_0xc9d9('0x27')]=function(_0x5b11e1,_0x5a9ab6){return db[_0xc9d9('0x3e')][_0xc9d9('0x47')]({'where':{'id':_0x5b11e1['params']['id']}})[_0xc9d9('0x26')](handleEntityNotFound(_0x5a9ab6,null))[_0xc9d9('0x26')](removeEntity(_0x5a9ab6,null))[_0xc9d9('0x42')](handleError(_0x5a9ab6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6485955..1828309 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 _0x8286=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8286,0x66));var _0x6828=function(_0x53bcf2,_0x8ffd84){_0x53bcf2=_0x53bcf2-0x0;var _0x2841fc=_0x8286[_0x53bcf2];return _0x2841fc;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var logger=require(_0x6828('0x2'))(_0x6828('0x3'));var moment=require(_0x6828('0x4'));var BPromise=require(_0x6828('0x5'));var rp=require(_0x6828('0x6'));var fs=require('fs');var path=require(_0x6828('0x7'));var rimraf=require(_0x6828('0x8'));var config=require(_0x6828('0x9'));var attributes=require(_0x6828('0xa'));module['exports']=function(_0x31c3d0,_0xe4b9bb){return _0x31c3d0['define'](_0x6828('0xb'),attributes,{'tableName':_0x6828('0xc'),'paranoid':![],'indexes':[{'name':_0x6828('0xd'),'fields':['idField',_0x6828('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcaef=['FieldId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','freshsales_unique_index','idField'];(function(_0x5c903c,_0x28e697){var _0x270557=function(_0x72a425){while(--_0x72a425){_0x5c903c['push'](_0x5c903c['shift']());}};_0x270557(++_0x28e697);}(_0xcaef,0x1c9));var _0xfcae=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xcaef[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var logger=require(_0xfcae('0x1'))(_0xfcae('0x2'));var moment=require(_0xfcae('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcae('0x5'));var config=require(_0xfcae('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xfcae('0x7')]=function(_0x19dd62,_0x4e8311){return _0x19dd62[_0xfcae('0x8')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xfcae('0x9'),'fields':[_0xfcae('0xa'),_0xfcae('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 167ce96..c1be457 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x687b,0x14a));var _0xb687=function(_0x1658ad,_0x487c1f){_0x1658ad=_0x1658ad-0x0;var _0x3b1927=_0x687b[_0x1658ad];return _0x3b1927;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x6f47=['request\x20sent','debug','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x6f47,0xc7));var _0x76f4=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6f47[_0x16d10f];return _0x50c823;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){return client[_0x76f4('0x9')](_0xfc2405,_0x497f99)[_0x76f4('0xa')](function(_0x101f55){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2176a7,_0x76f4('0xb'));logger[_0x76f4('0xc')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2176a7,'request\x20sent',JSON[_0x76f4('0xd')](_0x101f55));if(_0x101f55[_0x76f4('0xe')]){if(_0x101f55[_0x76f4('0xe')][_0x76f4('0xf')]===0x1f4){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55[_0x76f4('0xe')][_0x76f4('0x11')]);return _0x25656d(_0x101f55[_0x76f4('0xe')]['message']);}logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55['error']['message']);return _0x1a3172(_0x101f55['error'][_0x76f4('0x11')]);}else{logger[_0x76f4('0x12')](_0x76f4('0x10'),_0x2176a7,_0x76f4('0xb'));_0x1a3172(_0x101f55[_0x76f4('0x13')][_0x76f4('0x11')]);}})[_0x76f4('0x14')](function(_0x981a87){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x981a87);_0x25656d(_0x981a87);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a88806a..c45450d 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(_0x2c4910,_0x17775f){var _0x47939d=function(_0x53574d){while(--_0x53574d){_0x2c4910['push'](_0x2c4910['shift']());}};_0x47939d(++_0x17775f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xf8886b,_0x504891){var _0x321bd5=function(_0x3c116b){while(--_0x3c116b){_0xf8886b['push'](_0xf8886b['shift']());}};_0x321bd5(++_0x504891);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 196e4b8..4990fa1 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 _0xbb8d=['newTab','sequelize','STRING','ENUM','integrationTab'];(function(_0x5a6eea,_0x21605e){var _0x54db97=function(_0x15e2c3){while(--_0x15e2c3){_0x5a6eea['push'](_0x5a6eea['shift']());}};_0x54db97(++_0x21605e);}(_0xbb8d,0x146));var _0xdbb8=function(_0x10fbf6,_0x16f543){_0x10fbf6=_0x10fbf6-0x0;var _0x276d11=_0xbb8d[_0x10fbf6];return _0x276d11;};'use strict';var Sequelize=require(_0xdbb8('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbb8('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xdbb8('0x1')]},'password':{'type':Sequelize[_0xdbb8('0x1')]},'clientId':{'type':Sequelize[_0xdbb8('0x1')]},'clientSecret':{'type':Sequelize[_0xdbb8('0x1')]},'securityToken':{'type':Sequelize[_0xdbb8('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdbb8('0x2')](_0xdbb8('0x3'),_0xdbb8('0x4')),'defaultValue':_0xdbb8('0x3')}}; \ No newline at end of file +var _0x38b2=['sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x3b34a5,_0x4ae1a2){var _0x46cc4a=function(_0x1f1e61){while(--_0x1f1e61){_0x3b34a5['push'](_0x3b34a5['shift']());}};_0x46cc4a(++_0x4ae1a2);}(_0x38b2,0xf6));var _0x238b=function(_0x474cd3,_0x2401f8){_0x474cd3=_0x474cd3-0x0;var _0xa4a9e3=_0x38b2[_0x474cd3];return _0xa4a9e3;};'use strict';var Sequelize=require(_0x238b('0x0'));module[_0x238b('0x1')]={'name':{'type':Sequelize[_0x238b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x238b('0x3')},'remoteUri':{'type':Sequelize[_0x238b('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x238b('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x238b('0x2')]},'serverUrl':{'type':Sequelize[_0x238b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x238b('0x4')](_0x238b('0x5'),'newTab'),'defaultValue':_0x238b('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 74d0df6..fe3608b 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 _0x196e=['Content-Range','apply','update','then','destroy','stack','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','SalesforceAccount','includeAll','include','rows','catch','show','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','length','hasOwnProperty','addConfiguration','Subjects','channel','Descriptions','getDescriptions','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','Connection','login','username','concat','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','picklist','boolean','email','phone','remove','includes','name','custom','picklistValues','label','value','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','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/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x196e,0xcc));var _0xe196=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x196e[_0x30b0d8];return _0x459c09;};'use strict';var emlformat=require(_0xe196('0x0'));var rimraf=require(_0xe196('0x1'));var zipdir=require(_0xe196('0x2'));var jsonpatch=require(_0xe196('0x3'));var rp=require(_0xe196('0x4'));var moment=require(_0xe196('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe196('0x6'));var util=require(_0xe196('0x7'));var path=require(_0xe196('0x8'));var sox=require(_0xe196('0x9'));var csv=require(_0xe196('0xa'));var ejs=require(_0xe196('0xb'));var fs=require('fs');var fs_extra=require(_0xe196('0xc'));var _=require(_0xe196('0xd'));var squel=require('squel');var crypto=require(_0xe196('0xe'));var jsforce=require(_0xe196('0xf'));var deskjs=require(_0xe196('0x10'));var toCsv=require(_0xe196('0xa'));var querystring=require(_0xe196('0x11'));var Papa=require(_0xe196('0x12'));var Redis=require(_0xe196('0x13'));var authService=require(_0xe196('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe196('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe196('0x16'));var licenseUtil=require(_0xe196('0x17'));var db=require(_0xe196('0x18'))['db'];var integrations=require(_0xe196('0x19'));function respondWithStatusCode(_0x2c4c6d,_0x1b4a79){_0x1b4a79=_0x1b4a79||0xcc;return function(_0x11d85f){if(_0x11d85f){return _0x2c4c6d[_0xe196('0x1a')](_0x1b4a79);}return _0x2c4c6d[_0xe196('0x1b')](_0x1b4a79)[_0xe196('0x1c')]();};}function respondWithResult(_0x42e9e3,_0x5e4d41){_0x5e4d41=_0x5e4d41||0xc8;return function(_0x47afeb){if(_0x47afeb){return _0x42e9e3['status'](_0x5e4d41)[_0xe196('0x1d')](_0x47afeb);}};}function respondWithFilteredResult(_0x284a51,_0x4c449d){return function(_0x48c507){if(_0x48c507){var _0x125dc8=typeof _0x4c449d[_0xe196('0x1e')]==='undefined'&&typeof _0x4c449d[_0xe196('0x1f')]==='undefined';var _0x3db84b=_0x48c507[_0xe196('0x20')];var _0x533bab=_0x125dc8?0x0:_0x4c449d['offset'];var _0x4d5a23=_0x125dc8?_0x48c507[_0xe196('0x20')]:_0x4c449d[_0xe196('0x1e')]+_0x4c449d[_0xe196('0x1f')];var _0x34b930;if(_0x4d5a23>=_0x3db84b){_0x4d5a23=_0x3db84b;_0x34b930=0xc8;}else{_0x34b930=0xce;}_0x284a51[_0xe196('0x1b')](_0x34b930);return _0x284a51[_0xe196('0x21')](_0xe196('0x22'),_0x533bab+'-'+_0x4d5a23+'/'+_0x3db84b)[_0xe196('0x1d')](_0x48c507);}return null;};}function patchUpdates(_0x26f9e3){return function(_0x31f533){try{jsonpatch[_0xe196('0x23')](_0x31f533,_0x26f9e3,!![]);}catch(_0x122290){return BPromise['reject'](_0x122290);}return _0x31f533['save']();};}function saveUpdates(_0x3d1f80,_0x304a43){return function(_0x46555f){if(_0x46555f){return _0x46555f[_0xe196('0x24')](_0x3d1f80)[_0xe196('0x25')](function(_0x4df32f){return _0x4df32f;});}return null;};}function removeEntity(_0x13dbc4,_0x14bfd1){return function(_0x32201f){if(_0x32201f){return _0x32201f[_0xe196('0x26')]()['then'](function(){_0x13dbc4['status'](0xcc)[_0xe196('0x1c')]();});}};}function handleEntityNotFound(_0x252911,_0xda4c0){return function(_0x49e420){if(!_0x49e420){_0x252911[_0xe196('0x1a')](0x194);}return _0x49e420;};}function handleError(_0x5a17fb,_0x5df99d){_0x5df99d=_0x5df99d||0x1f4;return function(_0xa1100f){logger['error'](_0xa1100f[_0xe196('0x27')]);if(_0xa1100f['name']){delete _0xa1100f['name'];}_0x5a17fb[_0xe196('0x1b')](_0x5df99d)[_0xe196('0x28')](_0xa1100f);};}exports[_0xe196('0x29')]=function(_0x91df38,_0x337b8f){var _0x4d02a0={},_0x499207={},_0x21e90f={'count':0x0,'rows':[]};var _0x573f74=_['map'](db['SalesforceAccount'][_0xe196('0x2a')],function(_0x352f11){return{'name':_0x352f11[_0xe196('0x2b')],'type':_0x352f11[_0xe196('0x2c')][_0xe196('0x2d')]};});_0x499207[_0xe196('0x2e')]=_[_0xe196('0x2f')](_0x573f74,'name');_0x499207[_0xe196('0x30')]=_[_0xe196('0x31')](_0x91df38[_0xe196('0x30')]);_0x499207[_0xe196('0x32')]=_[_0xe196('0x33')](_0x499207[_0xe196('0x2e')],_0x499207[_0xe196('0x30')]);_0x4d02a0[_0xe196('0x34')]=_[_0xe196('0x33')](_0x499207[_0xe196('0x2e')],qs['fields'](_0x91df38['query'][_0xe196('0x35')]));_0x4d02a0[_0xe196('0x34')]=_0x4d02a0[_0xe196('0x34')]['length']?_0x4d02a0[_0xe196('0x34')]:_0x499207[_0xe196('0x2e')];if(!_0x91df38['query']['hasOwnProperty'](_0xe196('0x36'))){_0x4d02a0['limit']=qs[_0xe196('0x1f')](_0x91df38['query'][_0xe196('0x1f')]);_0x4d02a0[_0xe196('0x1e')]=qs[_0xe196('0x1e')](_0x91df38['query'][_0xe196('0x1e')]);}_0x4d02a0[_0xe196('0x37')]=qs[_0xe196('0x38')](_0x91df38['query']['sort']);_0x4d02a0[_0xe196('0x39')]=qs[_0xe196('0x32')](_[_0xe196('0x3a')](_0x91df38['query'],_0x499207['filters']),_0x573f74);if(_0x91df38['query'][_0xe196('0x3b')]){_0x4d02a0['where']=_[_0xe196('0x3c')](_0x4d02a0['where'],{'$or':_[_0xe196('0x2f')](_0x573f74,function(_0x131e53){if(_0x131e53['type']!=='VIRTUAL'){var _0x3306c8={};_0x3306c8[_0x131e53['name']]={'$like':'%'+_0x91df38[_0xe196('0x30')]['filter']+'%'};return _0x3306c8;}})});}_0x4d02a0=_[_0xe196('0x3c')]({},_0x4d02a0,_0x91df38[_0xe196('0x3d')]);var _0xe5a502={'where':_0x4d02a0['where']};return db[_0xe196('0x3e')][_0xe196('0x20')](_0xe5a502)[_0xe196('0x25')](function(_0x581d83){_0x21e90f[_0xe196('0x20')]=_0x581d83;if(_0x91df38['query'][_0xe196('0x3f')]){_0x4d02a0[_0xe196('0x40')]=[{'all':!![]}];}return db[_0xe196('0x3e')]['findAll'](_0x4d02a0);})[_0xe196('0x25')](function(_0x437f86){_0x21e90f[_0xe196('0x41')]=_0x437f86;return _0x21e90f;})['then'](respondWithFilteredResult(_0x337b8f,_0x4d02a0))[_0xe196('0x42')](handleError(_0x337b8f,null));};exports[_0xe196('0x43')]=function(_0x5da8e2,_0x37d1cc){var _0x1bc411={'raw':![],'where':{'id':_0x5da8e2['params']['id']}},_0x568a2c={};_0x568a2c[_0xe196('0x2e')]=_[_0xe196('0x31')](db['SalesforceAccount'][_0xe196('0x2a')]);_0x568a2c[_0xe196('0x30')]=_[_0xe196('0x31')](_0x5da8e2[_0xe196('0x30')]);_0x568a2c[_0xe196('0x32')]=_[_0xe196('0x33')](_0x568a2c[_0xe196('0x2e')],_0x568a2c[_0xe196('0x30')]);_0x1bc411[_0xe196('0x34')]=_[_0xe196('0x33')](_0x568a2c[_0xe196('0x2e')],qs[_0xe196('0x35')](_0x5da8e2[_0xe196('0x30')][_0xe196('0x35')]));_0x1bc411[_0xe196('0x34')]=_0x1bc411[_0xe196('0x34')]['length']?_0x1bc411[_0xe196('0x34')]:_0x568a2c['model'];if(_0x5da8e2[_0xe196('0x30')]['includeAll']){_0x1bc411[_0xe196('0x40')]=[{'all':!![]}];}_0x1bc411=_['merge']({},_0x1bc411,_0x5da8e2['options']);return db[_0xe196('0x3e')][_0xe196('0x44')](_0x1bc411)['then'](handleEntityNotFound(_0x37d1cc,null))[_0xe196('0x25')](respondWithResult(_0x37d1cc,null))[_0xe196('0x42')](handleError(_0x37d1cc,null));};exports[_0xe196('0x45')]=function(_0x5a777b,_0xe766cf){return db[_0xe196('0x3e')]['create'](_0x5a777b[_0xe196('0x46')],{})['then'](respondWithResult(_0xe766cf,0xc9))[_0xe196('0x42')](handleError(_0xe766cf,null));};exports['update']=function(_0x4976c8,_0x5c91e5){if(_0x4976c8[_0xe196('0x46')]['id']){delete _0x4976c8[_0xe196('0x46')]['id'];}return db[_0xe196('0x3e')]['find']({'where':{'id':_0x4976c8['params']['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x5c91e5,null))[_0xe196('0x25')](saveUpdates(_0x4976c8[_0xe196('0x46')],null))[_0xe196('0x25')](respondWithResult(_0x5c91e5,null))[_0xe196('0x42')](handleError(_0x5c91e5,null));};exports[_0xe196('0x26')]=function(_0x462e5c,_0x114de9){return db[_0xe196('0x3e')][_0xe196('0x44')]({'where':{'id':_0x462e5c[_0xe196('0x47')]['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x114de9,null))[_0xe196('0x25')](removeEntity(_0x114de9,null))[_0xe196('0x42')](handleError(_0x114de9,null));};exports[_0xe196('0x48')]=function(_0x6fd809,_0x22090c,_0x54fc57){var _0x47a6c6={};var _0x1f942c={};var _0x496f1f;var _0x458b8b;return db[_0xe196('0x3e')][_0xe196('0x49')]({'where':{'id':_0x6fd809[_0xe196('0x47')]['id']}})[_0xe196('0x25')](handleEntityNotFound(_0x22090c,null))['then'](function(_0x115836){if(_0x115836){_0x496f1f=_0x115836;_0x1f942c[_0xe196('0x2e')]=_[_0xe196('0x31')](db[_0xe196('0x4a')][_0xe196('0x2a')]);_0x1f942c['query']=_[_0xe196('0x31')](_0x6fd809[_0xe196('0x30')]);_0x1f942c['filters']=_[_0xe196('0x33')](_0x1f942c[_0xe196('0x2e')],_0x1f942c[_0xe196('0x30')]);_0x47a6c6[_0xe196('0x34')]=_[_0xe196('0x33')](_0x1f942c[_0xe196('0x2e')],qs[_0xe196('0x35')](_0x6fd809[_0xe196('0x30')]['fields']));_0x47a6c6[_0xe196('0x34')]=_0x47a6c6['attributes'][_0xe196('0x4b')]?_0x47a6c6['attributes']:_0x1f942c['model'];_0x47a6c6['order']=qs[_0xe196('0x38')](_0x6fd809['query'][_0xe196('0x38')]);_0x47a6c6['where']=qs['filters'](_[_0xe196('0x3a')](_0x6fd809[_0xe196('0x30')],_0x1f942c[_0xe196('0x32')]));if(_0x6fd809[_0xe196('0x30')]['filter']){_0x47a6c6[_0xe196('0x39')]=_['merge'](_0x47a6c6[_0xe196('0x39')],{'$or':_[_0xe196('0x2f')](_0x47a6c6[_0xe196('0x34')],function(_0xb156c7){var _0x385438={};_0x385438[_0xb156c7]={'$like':'%'+_0x6fd809[_0xe196('0x30')][_0xe196('0x3b')]+'%'};return _0x385438;})});}_0x47a6c6=_['merge']({},_0x47a6c6,_0x6fd809['options']);return _0x496f1f['getConfigurations'](_0x47a6c6);}})['then'](function(_0x2df1c3){if(_0x2df1c3){_0x458b8b=_0x2df1c3[_0xe196('0x4b')];if(!_0x6fd809['query'][_0xe196('0x4c')]('nolimit')){_0x47a6c6[_0xe196('0x1f')]=qs[_0xe196('0x1f')](_0x6fd809[_0xe196('0x30')][_0xe196('0x1f')]);_0x47a6c6['offset']=qs[_0xe196('0x1e')](_0x6fd809[_0xe196('0x30')][_0xe196('0x1e')]);}return _0x496f1f[_0xe196('0x48')](_0x47a6c6);}})[_0xe196('0x25')](function(_0x4b6513){if(_0x4b6513){return _0x4b6513?{'count':_0x458b8b,'rows':_0x4b6513}:null;}})[_0xe196('0x25')](respondWithResult(_0x22090c,null))[_0xe196('0x42')](handleError(_0x22090c,null));};exports[_0xe196('0x4d')]=function(_0x1b5fc5,_0x13b11c,_0x19db7c){if(_0x1b5fc5[_0xe196('0x46')]['id']){delete _0x1b5fc5[_0xe196('0x46')]['id'];}return db[_0xe196('0x3e')][_0xe196('0x49')]({'where':{'id':_0x1b5fc5[_0xe196('0x47')]['id']}})['then'](handleEntityNotFound(_0x13b11c,null))[_0xe196('0x25')](function(_0x4b66d0){if(_0x4b66d0){_0x1b5fc5[_0xe196('0x46')]['AccountId']=_0x4b66d0['id'];_0x1b5fc5['body'][_0xe196('0x4e')]=integrations['getSubjects'](_0x1b5fc5['body'][_0xe196('0x4f')],_0x1b5fc5[_0xe196('0x46')][_0xe196('0x2c')]);_0x1b5fc5[_0xe196('0x46')][_0xe196('0x50')]=integrations[_0xe196('0x51')](_0x1b5fc5['body'][_0xe196('0x4f')],_0x1b5fc5['body'][_0xe196('0x2c')]);return db[_0xe196('0x4a')][_0xe196('0x45')](_0x1b5fc5[_0xe196('0x46')],{'include':[{'model':db['SalesforceField'],'as':_0xe196('0x4e')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xe196('0x25')](respondWithResult(_0x13b11c,null))['catch'](handleError(_0x13b11c,null));};exports[_0xe196('0x52')]=function(_0x7c723f,_0x230c8f,_0x54760e){var _0x5ecc03;var _0x469b3e='';var _0x13f4bc=_0xe196('0x53');return db['SalesforceAccount']['findOne']({'where':{'id':_0x7c723f[_0xe196('0x47')]['id']},'attributes':['id',_0xe196('0x54'),_0xe196('0x55'),_0xe196('0x56'),'username',_0xe196('0x57'),_0xe196('0x58')]})[_0xe196('0x25')](handleEntityNotFound(_0x230c8f,null))[_0xe196('0x25')](function(_0x388fe6){if(_0x388fe6){_0x469b3e=_0x388fe6['remoteUri'];var _0x29c11f=_0x469b3e['slice'](-0x1);if(_0x29c11f==='/'){_0x469b3e=_0x469b3e[_0xe196('0x59')](0x0,_0x469b3e['lastIndexOf'](_0x29c11f));}_0x5ecc03=new jsforce[(_0xe196('0x5a'))]({'oauth2':{'loginUrl':_0x469b3e,'clientId':_0x388fe6[_0xe196('0x55')],'clientSecret':_0x388fe6[_0xe196('0x56')]}});return _0x5ecc03[_0xe196('0x5b')](_0x388fe6[_0xe196('0x5c')],_0x388fe6[_0xe196('0x57')][_0xe196('0x5d')](_0x388fe6[_0xe196('0x58')]));}})[_0xe196('0x25')](function(_0x4a2afd){if(_0x4a2afd){if(!_['isNil'](_0x7c723f[_0xe196('0x30')]['ticketType'])){_0x13f4bc=_0x7c723f[_0xe196('0x30')]['ticketType'];}return _0x5ecc03[_0xe196('0x5e')](_0x13f4bc)['describe']();}})['then'](function(_0x1c3337){var _0x45fa28=[_0xe196('0x5f'),_0xe196('0x60'),_0xe196('0x61'),_0xe196('0x62'),'Subject','Description'];var _0x2bc82e=['string','int',_0xe196('0x63'),_0xe196('0x64'),_0xe196('0x65'),'textarea',_0xe196('0x66')];if(_0x1c3337){_[_0xe196('0x67')](_0x1c3337[_0xe196('0x35')],function(_0x2ccaf3){return _0x45fa28[_0xe196('0x68')](_0x2ccaf3[_0xe196('0x69')])||!_0x2bc82e['includes'](_0x2ccaf3[_0xe196('0x2c')]);});return{'count':_0x1c3337[_0xe196('0x35')]['length'],'rows':_['map'](_0x1c3337['fields'],function(_0x4d36eb){return{'id':_0x4d36eb[_0xe196('0x69')],'name':_0x4d36eb['label'],'custom':_0x4d36eb[_0xe196('0x6a')],'options':_0x4d36eb[_0xe196('0x6b')][_0xe196('0x4b')]>0x0?_[_0xe196('0x2f')](_0x4d36eb[_0xe196('0x6b')],function(_0x35fb9c){return{'name':_0x35fb9c[_0xe196('0x6c')],'value':_0x35fb9c[_0xe196('0x6d')]};}):_0x4d36eb[_0xe196('0x2c')]==_0xe196('0x64')?[{'name':'True','value':_0xe196('0x6e')},{'name':_0xe196('0x6f'),'value':_0xe196('0x70')}]:[]};})};}})['then'](respondWithResult(_0x230c8f,null))[_0xe196('0x42')](function(_0x2f6511){var _0x5d833f=_0x7c723f[_0xe196('0x30')][_0xe196('0x71')]?0x1f4:_0x2f6511[_0xe196('0x72')]||0x1f4;logger[_0xe196('0x73')](_0xe196('0x74'),_0xe196('0x52'),_0x5d833f,JSON[_0xe196('0x75')](_0x2f6511));delete _0x2f6511[_0xe196('0x69')];if(_0x5d833f===0x191){_0x5d833f=0x190;}_0x230c8f[_0xe196('0x1b')](_0x5d833f)[_0xe196('0x28')](_0x7c723f[_0xe196('0x30')][_0xe196('0x71')]?{'message':_0xe196('0x76'),'statusCode':_0x2f6511['statusCode']}:_0x2f6511);});}; \ No newline at end of file +var _0x8509=['fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','count','includeAll','include','rows','catch','params','length','options','find','body','destroy','findOne','keys','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','remoteUri','clientSecret','username','password','securityToken','slice','substring','clientId','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','value','True','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes'];(function(_0x4a3d88,_0x3b7912){var _0x56b4ed=function(_0x5c05d9){while(--_0x5c05d9){_0x4a3d88['push'](_0x4a3d88['shift']());}};_0x56b4ed(++_0x3b7912);}(_0x8509,0x1c1));var _0x9850=function(_0x50e7e0,_0x5affce){_0x50e7e0=_0x50e7e0-0x0;var _0x1a0307=_0x8509[_0x50e7e0];return _0x1a0307;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9850('0x0'));var zipdir=require(_0x9850('0x1'));var jsonpatch=require(_0x9850('0x2'));var rp=require(_0x9850('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9850('0x4'));var util=require(_0x9850('0x5'));var path=require(_0x9850('0x6'));var sox=require('sox');var csv=require(_0x9850('0x7'));var ejs=require(_0x9850('0x8'));var fs=require('fs');var fs_extra=require(_0x9850('0x9'));var _=require(_0x9850('0xa'));var squel=require(_0x9850('0xb'));var crypto=require(_0x9850('0xc'));var jsforce=require(_0x9850('0xd'));var deskjs=require(_0x9850('0xe'));var toCsv=require(_0x9850('0x7'));var querystring=require('querystring');var Papa=require(_0x9850('0xf'));var Redis=require(_0x9850('0x10'));var authService=require(_0x9850('0x11'));var qs=require(_0x9850('0x12'));var as=require(_0x9850('0x13'));var hardwareService=require(_0x9850('0x14'));var logger=require(_0x9850('0x15'))(_0x9850('0x16'));var utils=require('../../config/utils');var config=require(_0x9850('0x17'));var licenseUtil=require(_0x9850('0x18'));var db=require(_0x9850('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31ee79,_0x3864c1){_0x3864c1=_0x3864c1||0xcc;return function(_0xf4ff4e){if(_0xf4ff4e){return _0x31ee79[_0x9850('0x1a')](_0x3864c1);}return _0x31ee79[_0x9850('0x1b')](_0x3864c1)['end']();};}function respondWithResult(_0xb15ba8,_0x4e95e3){_0x4e95e3=_0x4e95e3||0xc8;return function(_0x3717e1){if(_0x3717e1){return _0xb15ba8[_0x9850('0x1b')](_0x4e95e3)[_0x9850('0x1c')](_0x3717e1);}};}function respondWithFilteredResult(_0x3f337b,_0x174c32){return function(_0x33d73d){if(_0x33d73d){var _0x1bba31=typeof _0x174c32[_0x9850('0x1d')]===_0x9850('0x1e')&&typeof _0x174c32[_0x9850('0x1f')]===_0x9850('0x1e');var _0x543c4d=_0x33d73d['count'];var _0x4291be=_0x1bba31?0x0:_0x174c32['offset'];var _0x25e505=_0x1bba31?_0x33d73d['count']:_0x174c32['offset']+_0x174c32[_0x9850('0x1f')];var _0x500903;if(_0x25e505>=_0x543c4d){_0x25e505=_0x543c4d;_0x500903=0xc8;}else{_0x500903=0xce;}_0x3f337b[_0x9850('0x1b')](_0x500903);return _0x3f337b[_0x9850('0x20')](_0x9850('0x21'),_0x4291be+'-'+_0x25e505+'/'+_0x543c4d)[_0x9850('0x1c')](_0x33d73d);}return null;};}function patchUpdates(_0x5beb12){return function(_0x58b511){try{jsonpatch[_0x9850('0x22')](_0x58b511,_0x5beb12,!![]);}catch(_0x5c7aa4){return BPromise[_0x9850('0x23')](_0x5c7aa4);}return _0x58b511[_0x9850('0x24')]();};}function saveUpdates(_0x278cda,_0x2f9c36){return function(_0x1cb8bd){if(_0x1cb8bd){return _0x1cb8bd[_0x9850('0x25')](_0x278cda)[_0x9850('0x26')](function(_0xfb10c9){return _0xfb10c9;});}return null;};}function removeEntity(_0xa0f27a,_0x359e0c){return function(_0xc87d29){if(_0xc87d29){return _0xc87d29['destroy']()[_0x9850('0x26')](function(){_0xa0f27a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b7de,_0x15fac5){return function(_0x589fa8){if(!_0x589fa8){_0x19b7de[_0x9850('0x1a')](0x194);}return _0x589fa8;};}function handleError(_0x25e30b,_0x49bf76){_0x49bf76=_0x49bf76||0x1f4;return function(_0x368273){logger[_0x9850('0x27')](_0x368273[_0x9850('0x28')]);if(_0x368273[_0x9850('0x29')]){delete _0x368273[_0x9850('0x29')];}_0x25e30b['status'](_0x49bf76)[_0x9850('0x2a')](_0x368273);};}exports[_0x9850('0x2b')]=function(_0x310eac,_0x3e596a){var _0x14dc6b={},_0x332581={},_0x439ad3={'count':0x0,'rows':[]};var _0x4e618c=_[_0x9850('0x2c')](db[_0x9850('0x2d')][_0x9850('0x2e')],function(_0x175ea7){return{'name':_0x175ea7[_0x9850('0x2f')],'type':_0x175ea7[_0x9850('0x30')][_0x9850('0x31')]};});_0x332581['model']=_[_0x9850('0x2c')](_0x4e618c,_0x9850('0x29'));_0x332581[_0x9850('0x32')]=_['keys'](_0x310eac[_0x9850('0x32')]);_0x332581[_0x9850('0x33')]=_[_0x9850('0x34')](_0x332581[_0x9850('0x35')],_0x332581[_0x9850('0x32')]);_0x14dc6b['attributes']=_[_0x9850('0x34')](_0x332581['model'],qs[_0x9850('0x36')](_0x310eac[_0x9850('0x32')][_0x9850('0x36')]));_0x14dc6b[_0x9850('0x37')]=_0x14dc6b[_0x9850('0x37')]['length']?_0x14dc6b[_0x9850('0x37')]:_0x332581[_0x9850('0x35')];if(!_0x310eac[_0x9850('0x32')][_0x9850('0x38')](_0x9850('0x39'))){_0x14dc6b[_0x9850('0x1f')]=qs[_0x9850('0x1f')](_0x310eac[_0x9850('0x32')][_0x9850('0x1f')]);_0x14dc6b[_0x9850('0x1d')]=qs[_0x9850('0x1d')](_0x310eac[_0x9850('0x32')]['offset']);}_0x14dc6b[_0x9850('0x3a')]=qs[_0x9850('0x3b')](_0x310eac[_0x9850('0x32')][_0x9850('0x3b')]);_0x14dc6b['where']=qs['filters'](_[_0x9850('0x3c')](_0x310eac['query'],_0x332581[_0x9850('0x33')]),_0x4e618c);if(_0x310eac[_0x9850('0x32')][_0x9850('0x3d')]){_0x14dc6b['where']=_[_0x9850('0x3e')](_0x14dc6b[_0x9850('0x3f')],{'$or':_[_0x9850('0x2c')](_0x4e618c,function(_0x21c2e1){if(_0x21c2e1[_0x9850('0x30')]!==_0x9850('0x40')){var _0x726323={};_0x726323[_0x21c2e1[_0x9850('0x29')]]={'$like':'%'+_0x310eac[_0x9850('0x32')][_0x9850('0x3d')]+'%'};return _0x726323;}})});}_0x14dc6b=_[_0x9850('0x3e')]({},_0x14dc6b,_0x310eac['options']);var _0x2db111={'where':_0x14dc6b[_0x9850('0x3f')]};return db['SalesforceAccount'][_0x9850('0x41')](_0x2db111)[_0x9850('0x26')](function(_0x3ac383){_0x439ad3['count']=_0x3ac383;if(_0x310eac['query'][_0x9850('0x42')]){_0x14dc6b[_0x9850('0x43')]=[{'all':!![]}];}return db[_0x9850('0x2d')]['findAll'](_0x14dc6b);})[_0x9850('0x26')](function(_0xbdc710){_0x439ad3[_0x9850('0x44')]=_0xbdc710;return _0x439ad3;})[_0x9850('0x26')](respondWithFilteredResult(_0x3e596a,_0x14dc6b))[_0x9850('0x45')](handleError(_0x3e596a,null));};exports['show']=function(_0x1532b5,_0x332b66){var _0x17e9f5={'raw':![],'where':{'id':_0x1532b5[_0x9850('0x46')]['id']}},_0x16c007={};_0x16c007[_0x9850('0x35')]=_['keys'](db[_0x9850('0x2d')]['rawAttributes']);_0x16c007['query']=_['keys'](_0x1532b5[_0x9850('0x32')]);_0x16c007[_0x9850('0x33')]=_[_0x9850('0x34')](_0x16c007[_0x9850('0x35')],_0x16c007['query']);_0x17e9f5[_0x9850('0x37')]=_[_0x9850('0x34')](_0x16c007[_0x9850('0x35')],qs[_0x9850('0x36')](_0x1532b5[_0x9850('0x32')][_0x9850('0x36')]));_0x17e9f5[_0x9850('0x37')]=_0x17e9f5[_0x9850('0x37')][_0x9850('0x47')]?_0x17e9f5[_0x9850('0x37')]:_0x16c007[_0x9850('0x35')];if(_0x1532b5[_0x9850('0x32')][_0x9850('0x42')]){_0x17e9f5[_0x9850('0x43')]=[{'all':!![]}];}_0x17e9f5=_[_0x9850('0x3e')]({},_0x17e9f5,_0x1532b5[_0x9850('0x48')]);return db[_0x9850('0x2d')][_0x9850('0x49')](_0x17e9f5)[_0x9850('0x26')](handleEntityNotFound(_0x332b66,null))[_0x9850('0x26')](respondWithResult(_0x332b66,null))[_0x9850('0x45')](handleError(_0x332b66,null));};exports['create']=function(_0x106d72,_0x7a7d0b){return db['SalesforceAccount']['create'](_0x106d72[_0x9850('0x4a')],{})[_0x9850('0x26')](respondWithResult(_0x7a7d0b,0xc9))[_0x9850('0x45')](handleError(_0x7a7d0b,null));};exports[_0x9850('0x25')]=function(_0x43790d,_0xb28e3b){if(_0x43790d[_0x9850('0x4a')]['id']){delete _0x43790d[_0x9850('0x4a')]['id'];}return db[_0x9850('0x2d')]['find']({'where':{'id':_0x43790d[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0xb28e3b,null))[_0x9850('0x26')](saveUpdates(_0x43790d[_0x9850('0x4a')],null))[_0x9850('0x26')](respondWithResult(_0xb28e3b,null))[_0x9850('0x45')](handleError(_0xb28e3b,null));};exports[_0x9850('0x4b')]=function(_0x638379,_0x4aff41){return db[_0x9850('0x2d')]['find']({'where':{'id':_0x638379[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0x4aff41,null))[_0x9850('0x26')](removeEntity(_0x4aff41,null))[_0x9850('0x45')](handleError(_0x4aff41,null));};exports['getConfigurations']=function(_0x31ce5c,_0x15ba9b,_0x5d88f){var _0x35087c={};var _0x496043={};var _0x282210;var _0x2e8538;return db[_0x9850('0x2d')][_0x9850('0x4c')]({'where':{'id':_0x31ce5c[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0x15ba9b,null))[_0x9850('0x26')](function(_0x459336){if(_0x459336){_0x282210=_0x459336;_0x496043[_0x9850('0x35')]=_[_0x9850('0x4d')](db[_0x9850('0x4e')][_0x9850('0x2e')]);_0x496043[_0x9850('0x32')]=_[_0x9850('0x4d')](_0x31ce5c['query']);_0x496043[_0x9850('0x33')]=_[_0x9850('0x34')](_0x496043[_0x9850('0x35')],_0x496043[_0x9850('0x32')]);_0x35087c[_0x9850('0x37')]=_[_0x9850('0x34')](_0x496043[_0x9850('0x35')],qs[_0x9850('0x36')](_0x31ce5c[_0x9850('0x32')][_0x9850('0x36')]));_0x35087c['attributes']=_0x35087c[_0x9850('0x37')][_0x9850('0x47')]?_0x35087c['attributes']:_0x496043['model'];_0x35087c['order']=qs[_0x9850('0x3b')](_0x31ce5c[_0x9850('0x32')][_0x9850('0x3b')]);_0x35087c['where']=qs[_0x9850('0x33')](_[_0x9850('0x3c')](_0x31ce5c['query'],_0x496043[_0x9850('0x33')]));if(_0x31ce5c[_0x9850('0x32')]['filter']){_0x35087c[_0x9850('0x3f')]=_[_0x9850('0x3e')](_0x35087c[_0x9850('0x3f')],{'$or':_[_0x9850('0x2c')](_0x35087c['attributes'],function(_0x38d92f){var _0x50ebc5={};_0x50ebc5[_0x38d92f]={'$like':'%'+_0x31ce5c[_0x9850('0x32')][_0x9850('0x3d')]+'%'};return _0x50ebc5;})});}_0x35087c=_[_0x9850('0x3e')]({},_0x35087c,_0x31ce5c[_0x9850('0x48')]);return _0x282210[_0x9850('0x4f')](_0x35087c);}})['then'](function(_0x115c82){if(_0x115c82){_0x2e8538=_0x115c82[_0x9850('0x47')];if(!_0x31ce5c[_0x9850('0x32')][_0x9850('0x38')](_0x9850('0x39'))){_0x35087c[_0x9850('0x1f')]=qs[_0x9850('0x1f')](_0x31ce5c[_0x9850('0x32')][_0x9850('0x1f')]);_0x35087c[_0x9850('0x1d')]=qs['offset'](_0x31ce5c[_0x9850('0x32')][_0x9850('0x1d')]);}return _0x282210[_0x9850('0x4f')](_0x35087c);}})['then'](function(_0x4b0310){if(_0x4b0310){return _0x4b0310?{'count':_0x2e8538,'rows':_0x4b0310}:null;}})[_0x9850('0x26')](respondWithResult(_0x15ba9b,null))[_0x9850('0x45')](handleError(_0x15ba9b,null));};exports[_0x9850('0x50')]=function(_0x24414a,_0x22dca1,_0x28efa2){if(_0x24414a['body']['id']){delete _0x24414a[_0x9850('0x4a')]['id'];}return db[_0x9850('0x2d')][_0x9850('0x4c')]({'where':{'id':_0x24414a[_0x9850('0x46')]['id']}})[_0x9850('0x26')](handleEntityNotFound(_0x22dca1,null))[_0x9850('0x26')](function(_0x93eb2d){if(_0x93eb2d){_0x24414a['body'][_0x9850('0x51')]=_0x93eb2d['id'];_0x24414a['body'][_0x9850('0x52')]=integrations[_0x9850('0x53')](_0x24414a[_0x9850('0x4a')][_0x9850('0x54')],_0x24414a[_0x9850('0x4a')][_0x9850('0x30')]);_0x24414a[_0x9850('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x24414a[_0x9850('0x4a')]['channel'],_0x24414a[_0x9850('0x4a')][_0x9850('0x30')]);return db['SalesforceConfiguration']['create'](_0x24414a[_0x9850('0x4a')],{'include':[{'model':db[_0x9850('0x55')],'as':_0x9850('0x52')},{'model':db[_0x9850('0x55')],'as':_0x9850('0x56')}]});}return null;})[_0x9850('0x26')](respondWithResult(_0x22dca1,null))[_0x9850('0x45')](handleError(_0x22dca1,null));};exports[_0x9850('0x57')]=function(_0x3c5879,_0x3a9e46,_0x266c34){var _0x32b4fd;var _0x23789e='';var _0x49ed94='Task';return db[_0x9850('0x2d')][_0x9850('0x4c')]({'where':{'id':_0x3c5879[_0x9850('0x46')]['id']},'attributes':['id',_0x9850('0x58'),'clientId',_0x9850('0x59'),_0x9850('0x5a'),_0x9850('0x5b'),_0x9850('0x5c')]})[_0x9850('0x26')](handleEntityNotFound(_0x3a9e46,null))[_0x9850('0x26')](function(_0x48da2f){if(_0x48da2f){_0x23789e=_0x48da2f[_0x9850('0x58')];var _0x5bd581=_0x23789e[_0x9850('0x5d')](-0x1);if(_0x5bd581==='/'){_0x23789e=_0x23789e[_0x9850('0x5e')](0x0,_0x23789e['lastIndexOf'](_0x5bd581));}_0x32b4fd=new jsforce['Connection']({'oauth2':{'loginUrl':_0x23789e,'clientId':_0x48da2f[_0x9850('0x5f')],'clientSecret':_0x48da2f['clientSecret']}});return _0x32b4fd[_0x9850('0x60')](_0x48da2f[_0x9850('0x5a')],_0x48da2f['password'][_0x9850('0x61')](_0x48da2f[_0x9850('0x5c')]));}})[_0x9850('0x26')](function(_0x17de0a){if(_0x17de0a){if(!_['isNil'](_0x3c5879[_0x9850('0x32')]['ticketType'])){_0x49ed94=_0x3c5879[_0x9850('0x32')][_0x9850('0x62')];}return _0x32b4fd[_0x9850('0x63')](_0x49ed94)[_0x9850('0x64')]();}})['then'](function(_0x4f4517){var _0x5f1e63=[_0x9850('0x65'),_0x9850('0x66'),_0x9850('0x67'),'IsRecurrence',_0x9850('0x68'),_0x9850('0x69')];var _0x54f973=[_0x9850('0x6a'),_0x9850('0x6b'),_0x9850('0x6c'),_0x9850('0x6d'),_0x9850('0x6e'),'textarea',_0x9850('0x6f')];if(_0x4f4517){_[_0x9850('0x70')](_0x4f4517[_0x9850('0x36')],function(_0x2491c4){return _0x5f1e63[_0x9850('0x71')](_0x2491c4[_0x9850('0x29')])||!_0x54f973[_0x9850('0x71')](_0x2491c4[_0x9850('0x30')]);});return{'count':_0x4f4517[_0x9850('0x36')]['length'],'rows':_[_0x9850('0x2c')](_0x4f4517[_0x9850('0x36')],function(_0x227049){return{'id':_0x227049[_0x9850('0x29')],'name':_0x227049[_0x9850('0x72')],'custom':_0x227049[_0x9850('0x73')],'options':_0x227049[_0x9850('0x74')]['length']>0x0?_[_0x9850('0x2c')](_0x227049[_0x9850('0x74')],function(_0x98eaea){return{'name':_0x98eaea[_0x9850('0x72')],'value':_0x98eaea[_0x9850('0x75')]};}):_0x227049[_0x9850('0x30')]==_0x9850('0x6d')?[{'name':_0x9850('0x76'),'value':_0x9850('0x77')},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x3a9e46,null))[_0x9850('0x45')](function(_0x239e13){var _0x33dcad=_0x3c5879[_0x9850('0x32')][_0x9850('0x78')]?0x1f4:_0x239e13[_0x9850('0x79')]||0x1f4;logger[_0x9850('0x27')](_0x9850('0x7a'),_0x9850('0x57'),_0x33dcad,JSON[_0x9850('0x7b')](_0x239e13));delete _0x239e13[_0x9850('0x29')];if(_0x33dcad===0x191){_0x33dcad=0x190;}_0x3a9e46[_0x9850('0x1b')](_0x33dcad)['send'](_0x3c5879[_0x9850('0x32')][_0x9850('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x239e13[_0x9850('0x79')]}:_0x239e13);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c08ce60..ec0ec8f 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 _0x2b87=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x147bcc,_0xa54aa8){var _0x29ab8e=function(_0x408c5b){while(--_0x408c5b){_0x147bcc['push'](_0x147bcc['shift']());}};_0x29ab8e(++_0xa54aa8);}(_0x2b87,0x186));var _0x72b8=function(_0xb29894,_0x240e96){_0xb29894=_0xb29894-0x0;var _0x13e3e9=_0x2b87[_0xb29894];return _0x13e3e9;};'use strict';var _=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var logger=require(_0x72b8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x72b8('0x3'));var fs=require('fs');var path=require(_0x72b8('0x4'));var rimraf=require(_0x72b8('0x5'));var config=require(_0x72b8('0x6'));var attributes=require(_0x72b8('0x7'));var integrations=require(_0x72b8('0x8'));module[_0x72b8('0x9')]=function(_0x42c78b,_0x5a8ce8){return _0x42c78b[_0x72b8('0xa')](_0x72b8('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1502=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x56acec,_0x1ce4e7){var _0x276a57=function(_0x5701dd){while(--_0x5701dd){_0x56acec['push'](_0x56acec['shift']());}};_0x276a57(++_0x1ce4e7);}(_0x1502,0x1c3));var _0x2150=function(_0x520f75,_0xf2b40b){_0x520f75=_0x520f75-0x0;var _0x21be4e=_0x1502[_0x520f75];return _0x21be4e;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var logger=require(_0x2150('0x2'))(_0x2150('0x3'));var moment=require(_0x2150('0x4'));var BPromise=require(_0x2150('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2150('0x6'));var rimraf=require(_0x2150('0x7'));var config=require(_0x2150('0x8'));var attributes=require(_0x2150('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x2150('0xa')]=function(_0x38dbdf,_0x4fd1ed){return _0x38dbdf[_0x2150('0xb')](_0x2150('0xc'),attributes,{'tableName':_0x2150('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 8f46fa4..dea3675 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 _0x5120=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','options','where','attributes','limit','include','map','model','stringify','catch','ShowSalesforceAccount','SalesforceAccount','find','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5d6444,_0x61898f){var _0x285429=function(_0x383b20){while(--_0x383b20){_0x5d6444['push'](_0x5d6444['shift']());}};_0x285429(++_0x61898f);}(_0x5120,0xdf));var _0x0512=function(_0xa911e,_0x1a9f9a){_0xa911e=_0xa911e-0x0;var _0x28bd6f=_0x5120[_0xa911e];return _0x28bd6f;};'use strict';var _=require(_0x0512('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0512('0x1'));var rs=require(_0x0512('0x2'));var fs=require('fs');var Redis=require(_0x0512('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0512('0x4'))('rpc');var config=require(_0x0512('0x5'));var jayson=require(_0x0512('0x6'));var client=jayson[_0x0512('0x7')][_0x0512('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xafc18e,_0x5d54e0,_0x5492a6){return new BPromise(function(_0x2a3e64,_0x189739){return client[_0x0512('0x9')](_0xafc18e,_0x5492a6)[_0x0512('0xa')](function(_0x4bcf40){logger[_0x0512('0xb')](_0x0512('0xc'),_0x5d54e0,_0x0512('0xd'));logger[_0x0512('0xe')](_0x0512('0xf'),_0x5d54e0,_0x0512('0xd'),JSON['stringify'](_0x4bcf40));if(_0x4bcf40[_0x0512('0x10')]){if(_0x4bcf40[_0x0512('0x10')][_0x0512('0x11')]===0x1f4){logger[_0x0512('0x10')](_0x0512('0xc'),_0x5d54e0,_0x4bcf40['error'][_0x0512('0x12')]);return _0x189739(_0x4bcf40[_0x0512('0x10')][_0x0512('0x12')]);}logger[_0x0512('0x10')](_0x0512('0xc'),_0x5d54e0,_0x4bcf40[_0x0512('0x10')][_0x0512('0x12')]);return _0x2a3e64(_0x4bcf40[_0x0512('0x10')]['message']);}else{logger[_0x0512('0xb')](_0x0512('0xc'),_0x5d54e0,_0x0512('0xd'));_0x2a3e64(_0x4bcf40[_0x0512('0x13')][_0x0512('0x12')]);}})['catch'](function(_0x1d28c9){logger[_0x0512('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x5d54e0,_0x1d28c9);_0x189739(_0x1d28c9);});});}exports[_0x0512('0x14')]=function(_0x478f85){var _0x2523ca=this;return new Promise(function(_0x236ea9,_0x37eac0){return db['SalesforceAccount']['findAll']({'raw':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x478f85['options']?_0x478f85[_0x0512('0x15')][_0x0512('0x16')]||null:null,'attributes':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')][_0x0512('0x17')]||null:null,'limit':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')][_0x0512('0x18')]||null:null,'include':_0x478f85[_0x0512('0x15')]?_0x478f85[_0x0512('0x15')][_0x0512('0x19')]?_[_0x0512('0x1a')](_0x478f85[_0x0512('0x15')][_0x0512('0x19')],function(_0x56a9be){return{'model':db[_0x56a9be[_0x0512('0x1b')]],'as':_0x56a9be['as'],'attributes':_0x56a9be[_0x0512('0x17')],'include':_0x56a9be[_0x0512('0x19')]?_['map'](_0x56a9be[_0x0512('0x19')],function(_0x3e229e){return{'model':db[_0x3e229e[_0x0512('0x1b')]],'as':_0x3e229e['as'],'attributes':_0x3e229e['attributes'],'include':_0x3e229e[_0x0512('0x19')]?_[_0x0512('0x1a')](_0x3e229e[_0x0512('0x19')],function(_0xb784f5){return{'model':db[_0xb784f5[_0x0512('0x1b')]],'as':_0xb784f5['as'],'attributes':_0xb784f5[_0x0512('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0512('0xa')](function(_0x45130a){logger[_0x0512('0xb')](_0x0512('0x14'),_0x478f85);logger[_0x0512('0xe')](_0x0512('0x14'),_0x478f85,JSON[_0x0512('0x1c')](_0x45130a));_0x236ea9(_0x45130a);})[_0x0512('0x1d')](function(_0x4578a2){logger[_0x0512('0x10')]('GetSalesforceAccount',_0x4578a2[_0x0512('0x12')],_0x478f85);_0x37eac0(_0x2523ca[_0x0512('0x10')](0x1f4,_0x4578a2[_0x0512('0x12')]));});});};exports[_0x0512('0x1e')]=function(_0x1c9ef7){var _0xbdb841=this;return new Promise(function(_0x536aaa,_0xe31514){return db[_0x0512('0x1f')][_0x0512('0x20')]({'raw':_0x1c9ef7[_0x0512('0x15')]?_0x1c9ef7[_0x0512('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1c9ef7['options']?_0x1c9ef7[_0x0512('0x15')]['where']||null:null,'attributes':_0x1c9ef7[_0x0512('0x15')]?_0x1c9ef7['options']['attributes']||null:null,'include':_0x1c9ef7[_0x0512('0x15')]?_0x1c9ef7[_0x0512('0x15')][_0x0512('0x19')]?_[_0x0512('0x1a')](_0x1c9ef7[_0x0512('0x15')]['include'],function(_0x4ad08a){return{'model':db[_0x4ad08a[_0x0512('0x1b')]],'as':_0x4ad08a['as'],'attributes':_0x4ad08a[_0x0512('0x17')],'include':_0x4ad08a[_0x0512('0x19')]?_['map'](_0x4ad08a[_0x0512('0x19')],function(_0x23647a){return{'model':db[_0x23647a[_0x0512('0x1b')]],'as':_0x23647a['as'],'attributes':_0x23647a[_0x0512('0x17')],'include':_0x23647a[_0x0512('0x19')]?_['map'](_0x23647a['include'],function(_0x5d7b6e){return{'model':db[_0x5d7b6e[_0x0512('0x1b')]],'as':_0x5d7b6e['as'],'attributes':_0x5d7b6e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x612848){logger[_0x0512('0xb')](_0x0512('0x1e'),_0x1c9ef7);logger[_0x0512('0xe')](_0x0512('0x1e'),_0x1c9ef7,JSON[_0x0512('0x1c')](_0x612848));_0x536aaa(_0x612848);})[_0x0512('0x1d')](function(_0x7052ab){logger[_0x0512('0x10')](_0x0512('0x1e'),_0x7052ab[_0x0512('0x12')],_0x1c9ef7);_0xe31514(_0xbdb841[_0x0512('0x10')](0x1f4,_0x7052ab['message']));});});}; \ No newline at end of file +var _0xa263=['stringify','ShowSalesforceAccount','find','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetSalesforceAccount'];(function(_0x3b6218,_0x4fe859){var _0x19a90e=function(_0x29c16d){while(--_0x29c16d){_0x3b6218['push'](_0x3b6218['shift']());}};_0x19a90e(++_0x4fe859);}(_0xa263,0x135));var _0x3a26=function(_0x1d2d8c,_0x444dc0){_0x1d2d8c=_0x1d2d8c-0x0;var _0x20d515=_0xa263[_0x1d2d8c];return _0x20d515;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a26('0x0'));var fs=require('fs');var Redis=require(_0x3a26('0x1'));var db=require(_0x3a26('0x2'))['db'];var utils=require(_0x3a26('0x3'));var logger=require(_0x3a26('0x4'))(_0x3a26('0x5'));var config=require(_0x3a26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a26('0x7')][_0x3a26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47940f,_0x1fbd4d,_0x1d2aa1){return new BPromise(function(_0x348f15,_0x5b4953){return client[_0x3a26('0x9')](_0x47940f,_0x1d2aa1)[_0x3a26('0xa')](function(_0xba3047){logger[_0x3a26('0xb')](_0x3a26('0xc'),_0x1fbd4d,_0x3a26('0xd'));logger[_0x3a26('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1fbd4d,_0x3a26('0xd'),JSON['stringify'](_0xba3047));if(_0xba3047[_0x3a26('0xf')]){if(_0xba3047['error'][_0x3a26('0x10')]===0x1f4){logger[_0x3a26('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1fbd4d,_0xba3047[_0x3a26('0xf')]['message']);return _0x5b4953(_0xba3047['error']['message']);}logger[_0x3a26('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1fbd4d,_0xba3047[_0x3a26('0xf')][_0x3a26('0x11')]);return _0x348f15(_0xba3047[_0x3a26('0xf')][_0x3a26('0x11')]);}else{logger[_0x3a26('0xb')](_0x3a26('0xc'),_0x1fbd4d,'request\x20sent');_0x348f15(_0xba3047[_0x3a26('0x12')][_0x3a26('0x11')]);}})[_0x3a26('0x13')](function(_0x10d2d6){logger[_0x3a26('0xf')](_0x3a26('0xc'),_0x1fbd4d,_0x10d2d6);_0x5b4953(_0x10d2d6);});});}exports['GetSalesforceAccount']=function(_0x2ba338){var _0x2091ac=this;return new Promise(function(_0x2d59c7,_0x5e3a19){return db[_0x3a26('0x14')][_0x3a26('0x15')]({'raw':_0x2ba338[_0x3a26('0x16')]?_0x2ba338[_0x3a26('0x16')][_0x3a26('0x17')]===undefined?!![]:![]:!![],'where':_0x2ba338['options']?_0x2ba338[_0x3a26('0x16')][_0x3a26('0x18')]||null:null,'attributes':_0x2ba338['options']?_0x2ba338[_0x3a26('0x16')][_0x3a26('0x19')]||null:null,'limit':_0x2ba338[_0x3a26('0x16')]?_0x2ba338['options'][_0x3a26('0x1a')]||null:null,'include':_0x2ba338[_0x3a26('0x16')]?_0x2ba338['options']['include']?_['map'](_0x2ba338[_0x3a26('0x16')][_0x3a26('0x1b')],function(_0x41c27e){return{'model':db[_0x41c27e[_0x3a26('0x1c')]],'as':_0x41c27e['as'],'attributes':_0x41c27e[_0x3a26('0x19')],'include':_0x41c27e[_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x41c27e[_0x3a26('0x1b')],function(_0x3f697c){return{'model':db[_0x3f697c[_0x3a26('0x1c')]],'as':_0x3f697c['as'],'attributes':_0x3f697c['attributes'],'include':_0x3f697c[_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x3f697c[_0x3a26('0x1b')],function(_0x240acb){return{'model':db[_0x240acb[_0x3a26('0x1c')]],'as':_0x240acb['as'],'attributes':_0x240acb[_0x3a26('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161045){logger['info'](_0x3a26('0x1e'),_0x2ba338);logger[_0x3a26('0xe')](_0x3a26('0x1e'),_0x2ba338,JSON[_0x3a26('0x1f')](_0x161045));_0x2d59c7(_0x161045);})['catch'](function(_0x15e41a){logger[_0x3a26('0xf')](_0x3a26('0x1e'),_0x15e41a[_0x3a26('0x11')],_0x2ba338);_0x5e3a19(_0x2091ac['error'](0x1f4,_0x15e41a['message']));});});};exports[_0x3a26('0x20')]=function(_0x2227ca){var _0x589e92=this;return new Promise(function(_0x3c1acb,_0x557957){return db['SalesforceAccount'][_0x3a26('0x21')]({'raw':_0x2227ca['options']?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x17')]===undefined?!![]:![]:!![],'where':_0x2227ca[_0x3a26('0x16')]?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x18')]||null:null,'attributes':_0x2227ca[_0x3a26('0x16')]?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x19')]||null:null,'include':_0x2227ca[_0x3a26('0x16')]?_0x2227ca[_0x3a26('0x16')][_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x2227ca['options'][_0x3a26('0x1b')],function(_0x60435){return{'model':db[_0x60435[_0x3a26('0x1c')]],'as':_0x60435['as'],'attributes':_0x60435[_0x3a26('0x19')],'include':_0x60435[_0x3a26('0x1b')]?_[_0x3a26('0x1d')](_0x60435[_0x3a26('0x1b')],function(_0x397617){return{'model':db[_0x397617[_0x3a26('0x1c')]],'as':_0x397617['as'],'attributes':_0x397617[_0x3a26('0x19')],'include':_0x397617[_0x3a26('0x1b')]?_['map'](_0x397617[_0x3a26('0x1b')],function(_0x3a3107){return{'model':db[_0x3a3107[_0x3a26('0x1c')]],'as':_0x3a3107['as'],'attributes':_0x3a3107[_0x3a26('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df3f1){logger[_0x3a26('0xb')](_0x3a26('0x20'),_0x2227ca);logger[_0x3a26('0xe')](_0x3a26('0x20'),_0x2227ca,JSON['stringify'](_0x4df3f1));_0x3c1acb(_0x4df3f1);})[_0x3a26('0x13')](function(_0x7ee01a){logger[_0x3a26('0xf')](_0x3a26('0x20'),_0x7ee01a[_0x3a26('0x11')],_0x2227ca);_0x557957(_0x589e92[_0x3a26('0xf')](0x1f4,_0x7ee01a[_0x3a26('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1c19526..6f0f87c 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xdb28,0x106));var _0x8db2=function(_0x3938ed,_0x166d8f){_0x3938ed=_0x3938ed-0x0;var _0x537308=_0xdb28[_0x3938ed];return _0x537308;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +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(_0x5653ac,_0x279def){var _0x59ccc2=function(_0x9cf453){while(--_0x9cf453){_0x5653ac['push'](_0x5653ac['shift']());}};_0x59ccc2(++_0x279def);}(_0xadb5,0xad));var _0x5adb=function(_0x235457,_0x35cff2){_0x235457=_0x235457-0x0;var _0x34eb5d=_0xadb5[_0x235457];return _0x34eb5d;};'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 fc3e057..b0da2e3 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 _0x53d6=['contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Task','contact_lead'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x53d6,0x113));var _0x653d=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x53d6[_0x3df871];return _0x570f7b;};'use strict';var Sequelize=require('sequelize');module[_0x653d('0x0')]={'name':{'type':Sequelize[_0x653d('0x1')]},'description':{'type':Sequelize[_0x653d('0x1')]},'ticketType':{'type':Sequelize[_0x653d('0x2')]('Task','Case'),'defaultValue':_0x653d('0x3')},'moduleSearch':{'type':Sequelize[_0x653d('0x2')](_0x653d('0x4'),_0x653d('0x5'),_0x653d('0x6'),_0x653d('0x7'),_0x653d('0x8')),'defaultValue':_0x653d('0x4')},'moduleCreate':{'type':Sequelize[_0x653d('0x2')](_0x653d('0x9'),_0x653d('0x5'),_0x653d('0x6'),_0x653d('0x8')),'defaultValue':_0x653d('0x6')},'leadId':{'type':Sequelize[_0x653d('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x653d('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x653d('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x653d('0x1')]}}; \ No newline at end of file +var _0x1044=['contact_lead','contact','lead','account_contact_lead','account','ENUM','nothing','sequelize','exports','STRING','Case','Task'];(function(_0x42b601,_0xba39fd){var _0xa11432=function(_0x662055){while(--_0x662055){_0x42b601['push'](_0x42b601['shift']());}};_0xa11432(++_0xba39fd);}(_0x1044,0x16f));var _0x4104=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1044[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x4104('0x0'));module[_0x4104('0x1')]={'name':{'type':Sequelize[_0x4104('0x2')]},'description':{'type':Sequelize[_0x4104('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x4104('0x3')),'defaultValue':_0x4104('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4104('0x5'),_0x4104('0x6'),_0x4104('0x7'),_0x4104('0x8'),_0x4104('0x9')),'defaultValue':_0x4104('0x5')},'moduleCreate':{'type':Sequelize[_0x4104('0xa')](_0x4104('0xb'),'contact','lead',_0x4104('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x4104('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4104('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x4104('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 3639442..17fcfcc 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 _0x7a0f=['include','rows','params','includeAll','find','create','body','catch','getFields','findOne','SalesforceField','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SalesforceConfiguration'];(function(_0x1c6179,_0x22db86){var _0x19a57b=function(_0x2fde3e){while(--_0x2fde3e){_0x1c6179['push'](_0x1c6179['shift']());}};_0x19a57b(++_0x22db86);}(_0x7a0f,0x199));var _0xf7a0=function(_0x1a8192,_0x5b5a38){_0x1a8192=_0x1a8192-0x0;var _0x3beeb8=_0x7a0f[_0x1a8192];return _0x3beeb8;};'use strict';var emlformat=require(_0xf7a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7a0('0x1'));var jsonpatch=require(_0xf7a0('0x2'));var rp=require(_0xf7a0('0x3'));var moment=require(_0xf7a0('0x4'));var BPromise=require(_0xf7a0('0x5'));var Mustache=require(_0xf7a0('0x6'));var util=require(_0xf7a0('0x7'));var path=require('path');var sox=require(_0xf7a0('0x8'));var csv=require(_0xf7a0('0x9'));var ejs=require(_0xf7a0('0xa'));var fs=require('fs');var fs_extra=require(_0xf7a0('0xb'));var _=require(_0xf7a0('0xc'));var squel=require('squel');var crypto=require(_0xf7a0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf7a0('0xe'));var toCsv=require(_0xf7a0('0x9'));var querystring=require(_0xf7a0('0xf'));var Papa=require(_0xf7a0('0x10'));var Redis=require('ioredis');var authService=require(_0xf7a0('0x11'));var qs=require(_0xf7a0('0x12'));var as=require(_0xf7a0('0x13'));var hardwareService=require(_0xf7a0('0x14'));var logger=require(_0xf7a0('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf7a0('0x16'));var licenseUtil=require(_0xf7a0('0x17'));var db=require(_0xf7a0('0x18'))['db'];function respondWithStatusCode(_0x11dddf,_0x39f9be){_0x39f9be=_0x39f9be||0xcc;return function(_0x385fe7){if(_0x385fe7){return _0x11dddf[_0xf7a0('0x19')](_0x39f9be);}return _0x11dddf[_0xf7a0('0x1a')](_0x39f9be)[_0xf7a0('0x1b')]();};}function respondWithResult(_0xf8c8b6,_0x1eec5d){_0x1eec5d=_0x1eec5d||0xc8;return function(_0x379e6a){if(_0x379e6a){return _0xf8c8b6[_0xf7a0('0x1a')](_0x1eec5d)[_0xf7a0('0x1c')](_0x379e6a);}};}function respondWithFilteredResult(_0x5027b5,_0x51062d){return function(_0x4a352b){if(_0x4a352b){var _0x1e91de=typeof _0x51062d[_0xf7a0('0x1d')]===_0xf7a0('0x1e')&&typeof _0x51062d[_0xf7a0('0x1f')]==='undefined';var _0x3d7288=_0x4a352b['count'];var _0x5bafd8=_0x1e91de?0x0:_0x51062d[_0xf7a0('0x1d')];var _0x291da9=_0x1e91de?_0x4a352b[_0xf7a0('0x20')]:_0x51062d[_0xf7a0('0x1d')]+_0x51062d[_0xf7a0('0x1f')];var _0x4f0228;if(_0x291da9>=_0x3d7288){_0x291da9=_0x3d7288;_0x4f0228=0xc8;}else{_0x4f0228=0xce;}_0x5027b5[_0xf7a0('0x1a')](_0x4f0228);return _0x5027b5[_0xf7a0('0x21')](_0xf7a0('0x22'),_0x5bafd8+'-'+_0x291da9+'/'+_0x3d7288)[_0xf7a0('0x1c')](_0x4a352b);}return null;};}function patchUpdates(_0x2dda3c){return function(_0x530ae5){try{jsonpatch[_0xf7a0('0x23')](_0x530ae5,_0x2dda3c,!![]);}catch(_0x315f0f){return BPromise[_0xf7a0('0x24')](_0x315f0f);}return _0x530ae5[_0xf7a0('0x25')]();};}function saveUpdates(_0x1b094b,_0x83ca17){return function(_0x41c6f8){if(_0x41c6f8){return _0x41c6f8[_0xf7a0('0x26')](_0x1b094b)[_0xf7a0('0x27')](function(_0x14bcc4){return _0x14bcc4;});}return null;};}function removeEntity(_0x1613e0,_0x3a3f35){return function(_0x1204d6){if(_0x1204d6){return _0x1204d6[_0xf7a0('0x28')]()[_0xf7a0('0x27')](function(){_0x1613e0[_0xf7a0('0x1a')](0xcc)[_0xf7a0('0x1b')]();});}};}function handleEntityNotFound(_0x33ac90,_0x3cf1c1){return function(_0x4231d5){if(!_0x4231d5){_0x33ac90['sendStatus'](0x194);}return _0x4231d5;};}function handleError(_0x10acb3,_0x813305){_0x813305=_0x813305||0x1f4;return function(_0x32dc68){logger['error'](_0x32dc68['stack']);if(_0x32dc68['name']){delete _0x32dc68[_0xf7a0('0x29')];}_0x10acb3[_0xf7a0('0x1a')](_0x813305)['send'](_0x32dc68);};}exports['index']=function(_0x3d418a,_0x2038b3){var _0x218983={},_0x53bfe0={},_0x365cbd={'count':0x0,'rows':[]};var _0x3c5e51=_[_0xf7a0('0x2a')](db['SalesforceConfiguration'][_0xf7a0('0x2b')],function(_0x34e7f4){return{'name':_0x34e7f4[_0xf7a0('0x2c')],'type':_0x34e7f4[_0xf7a0('0x2d')][_0xf7a0('0x2e')]};});_0x53bfe0['model']=_['map'](_0x3c5e51,_0xf7a0('0x29'));_0x53bfe0[_0xf7a0('0x2f')]=_[_0xf7a0('0x30')](_0x3d418a['query']);_0x53bfe0[_0xf7a0('0x31')]=_[_0xf7a0('0x32')](_0x53bfe0[_0xf7a0('0x33')],_0x53bfe0[_0xf7a0('0x2f')]);_0x218983[_0xf7a0('0x34')]=_['intersection'](_0x53bfe0['model'],qs['fields'](_0x3d418a[_0xf7a0('0x2f')][_0xf7a0('0x35')]));_0x218983[_0xf7a0('0x34')]=_0x218983['attributes'][_0xf7a0('0x36')]?_0x218983[_0xf7a0('0x34')]:_0x53bfe0[_0xf7a0('0x33')];if(!_0x3d418a[_0xf7a0('0x2f')][_0xf7a0('0x37')](_0xf7a0('0x38'))){_0x218983['limit']=qs['limit'](_0x3d418a[_0xf7a0('0x2f')]['limit']);_0x218983[_0xf7a0('0x1d')]=qs[_0xf7a0('0x1d')](_0x3d418a['query'][_0xf7a0('0x1d')]);}_0x218983['order']=qs[_0xf7a0('0x39')](_0x3d418a['query'][_0xf7a0('0x39')]);_0x218983['where']=qs[_0xf7a0('0x31')](_[_0xf7a0('0x3a')](_0x3d418a[_0xf7a0('0x2f')],_0x53bfe0[_0xf7a0('0x31')]),_0x3c5e51);if(_0x3d418a['query'][_0xf7a0('0x3b')]){_0x218983[_0xf7a0('0x3c')]=_[_0xf7a0('0x3d')](_0x218983[_0xf7a0('0x3c')],{'$or':_['map'](_0x3c5e51,function(_0x2b4f37){if(_0x2b4f37[_0xf7a0('0x2d')]!==_0xf7a0('0x3e')){var _0x5e5452={};_0x5e5452[_0x2b4f37[_0xf7a0('0x29')]]={'$like':'%'+_0x3d418a[_0xf7a0('0x2f')][_0xf7a0('0x3b')]+'%'};return _0x5e5452;}})});}_0x218983=_[_0xf7a0('0x3d')]({},_0x218983,_0x3d418a[_0xf7a0('0x3f')]);var _0x51c165={'where':_0x218983[_0xf7a0('0x3c')]};return db[_0xf7a0('0x40')][_0xf7a0('0x20')](_0x51c165)[_0xf7a0('0x27')](function(_0x513b6b){_0x365cbd['count']=_0x513b6b;if(_0x3d418a['query']['includeAll']){_0x218983[_0xf7a0('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x218983);})[_0xf7a0('0x27')](function(_0x1a0d4c){_0x365cbd[_0xf7a0('0x42')]=_0x1a0d4c;return _0x365cbd;})[_0xf7a0('0x27')](respondWithFilteredResult(_0x2038b3,_0x218983))['catch'](handleError(_0x2038b3,null));};exports['show']=function(_0x280b97,_0xce25c0){var _0xc9dbb4={'raw':![],'where':{'id':_0x280b97[_0xf7a0('0x43')]['id']}},_0x477913={};_0x477913[_0xf7a0('0x33')]=_[_0xf7a0('0x30')](db[_0xf7a0('0x40')][_0xf7a0('0x2b')]);_0x477913[_0xf7a0('0x2f')]=_[_0xf7a0('0x30')](_0x280b97[_0xf7a0('0x2f')]);_0x477913[_0xf7a0('0x31')]=_[_0xf7a0('0x32')](_0x477913[_0xf7a0('0x33')],_0x477913[_0xf7a0('0x2f')]);_0xc9dbb4[_0xf7a0('0x34')]=_['intersection'](_0x477913[_0xf7a0('0x33')],qs['fields'](_0x280b97[_0xf7a0('0x2f')][_0xf7a0('0x35')]));_0xc9dbb4[_0xf7a0('0x34')]=_0xc9dbb4[_0xf7a0('0x34')][_0xf7a0('0x36')]?_0xc9dbb4[_0xf7a0('0x34')]:_0x477913['model'];if(_0x280b97[_0xf7a0('0x2f')][_0xf7a0('0x44')]){_0xc9dbb4[_0xf7a0('0x41')]=[{'all':!![]}];}_0xc9dbb4=_[_0xf7a0('0x3d')]({},_0xc9dbb4,_0x280b97[_0xf7a0('0x3f')]);return db['SalesforceConfiguration'][_0xf7a0('0x45')](_0xc9dbb4)[_0xf7a0('0x27')](handleEntityNotFound(_0xce25c0,null))[_0xf7a0('0x27')](respondWithResult(_0xce25c0,null))['catch'](handleError(_0xce25c0,null));};exports[_0xf7a0('0x46')]=function(_0x501f87,_0x5ade39){return db[_0xf7a0('0x40')][_0xf7a0('0x46')](_0x501f87[_0xf7a0('0x47')],{})[_0xf7a0('0x27')](respondWithResult(_0x5ade39,0xc9))[_0xf7a0('0x48')](handleError(_0x5ade39,null));};exports[_0xf7a0('0x26')]=function(_0xeb2e48,_0x33f53a){if(_0xeb2e48[_0xf7a0('0x47')]['id']){delete _0xeb2e48[_0xf7a0('0x47')]['id'];}return db[_0xf7a0('0x40')][_0xf7a0('0x45')]({'where':{'id':_0xeb2e48[_0xf7a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x33f53a,null))[_0xf7a0('0x27')](saveUpdates(_0xeb2e48['body'],null))[_0xf7a0('0x27')](respondWithResult(_0x33f53a,null))['catch'](handleError(_0x33f53a,null));};exports['destroy']=function(_0x41978f,_0x4979d2){return db[_0xf7a0('0x40')]['find']({'where':{'id':_0x41978f[_0xf7a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x4979d2,null))['then'](removeEntity(_0x4979d2,null))['catch'](handleError(_0x4979d2,null));};exports[_0xf7a0('0x49')]=function(_0x2584b3,_0x471d4b,_0x3e19a3){var _0xab7371={};var _0xe3e945={};var _0x40a286;var _0x129871;return db[_0xf7a0('0x40')][_0xf7a0('0x4a')]({'where':{'id':_0x2584b3[_0xf7a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x471d4b,null))[_0xf7a0('0x27')](function(_0x23a6d0){if(_0x23a6d0){_0x40a286=_0x23a6d0;_0xe3e945['model']=_['keys'](db[_0xf7a0('0x4b')][_0xf7a0('0x2b')]);_0xe3e945[_0xf7a0('0x2f')]=_['keys'](_0x2584b3[_0xf7a0('0x2f')]);_0xe3e945[_0xf7a0('0x31')]=_['intersection'](_0xe3e945[_0xf7a0('0x33')],_0xe3e945[_0xf7a0('0x2f')]);_0xab7371[_0xf7a0('0x34')]=_[_0xf7a0('0x32')](_0xe3e945[_0xf7a0('0x33')],qs[_0xf7a0('0x35')](_0x2584b3[_0xf7a0('0x2f')][_0xf7a0('0x35')]));_0xab7371[_0xf7a0('0x34')]=_0xab7371[_0xf7a0('0x34')][_0xf7a0('0x36')]?_0xab7371['attributes']:_0xe3e945['model'];_0xab7371['order']=qs[_0xf7a0('0x39')](_0x2584b3[_0xf7a0('0x2f')][_0xf7a0('0x39')]);_0xab7371[_0xf7a0('0x3c')]=qs[_0xf7a0('0x31')](_[_0xf7a0('0x3a')](_0x2584b3['query'],_0xe3e945[_0xf7a0('0x31')]));if(_0x2584b3[_0xf7a0('0x2f')][_0xf7a0('0x3b')]){_0xab7371[_0xf7a0('0x3c')]=_['merge'](_0xab7371['where'],{'$or':_['map'](_0xab7371['attributes'],function(_0x321e91){var _0x25636e={};_0x25636e[_0x321e91]={'$like':'%'+_0x2584b3[_0xf7a0('0x2f')][_0xf7a0('0x3b')]+'%'};return _0x25636e;})});}_0xab7371=_['merge']({},_0xab7371,_0x2584b3['options']);return _0x40a286[_0xf7a0('0x49')](_0xab7371);}})[_0xf7a0('0x27')](function(_0x285187){if(_0x285187){_0x129871=_0x285187[_0xf7a0('0x36')];if(!_0x2584b3[_0xf7a0('0x2f')]['hasOwnProperty'](_0xf7a0('0x38'))){_0xab7371[_0xf7a0('0x1f')]=qs[_0xf7a0('0x1f')](_0x2584b3['query'][_0xf7a0('0x1f')]);_0xab7371[_0xf7a0('0x1d')]=qs[_0xf7a0('0x1d')](_0x2584b3[_0xf7a0('0x2f')]['offset']);}return _0x40a286[_0xf7a0('0x49')](_0xab7371);}})[_0xf7a0('0x27')](function(_0xdbede9){if(_0xdbede9){return _0xdbede9?{'count':_0x129871,'rows':_0xdbede9}:null;}})['then'](respondWithResult(_0x471d4b,null))[_0xf7a0('0x48')](handleError(_0x471d4b,null));};exports[_0xf7a0('0x4c')]=function(_0x5cb2e0,_0x4c7729,_0x5d55a6){var _0x2a9363={};var _0xce3d8c={};var _0x21c02f;var _0x49afe5;return db[_0xf7a0('0x40')]['findOne']({'where':{'id':_0x5cb2e0[_0xf7a0('0x43')]['id']}})[_0xf7a0('0x27')](handleEntityNotFound(_0x4c7729,null))['then'](function(_0x543aa3){if(_0x543aa3){_0x21c02f=_0x543aa3;_0xce3d8c[_0xf7a0('0x33')]=_[_0xf7a0('0x30')](db[_0xf7a0('0x4b')][_0xf7a0('0x2b')]);_0xce3d8c['query']=_[_0xf7a0('0x30')](_0x5cb2e0[_0xf7a0('0x2f')]);_0xce3d8c[_0xf7a0('0x31')]=_[_0xf7a0('0x32')](_0xce3d8c['model'],_0xce3d8c[_0xf7a0('0x2f')]);_0x2a9363['attributes']=_['intersection'](_0xce3d8c[_0xf7a0('0x33')],qs[_0xf7a0('0x35')](_0x5cb2e0['query']['fields']));_0x2a9363[_0xf7a0('0x34')]=_0x2a9363['attributes'][_0xf7a0('0x36')]?_0x2a9363[_0xf7a0('0x34')]:_0xce3d8c[_0xf7a0('0x33')];_0x2a9363['order']=qs['sort'](_0x5cb2e0[_0xf7a0('0x2f')][_0xf7a0('0x39')]);_0x2a9363['where']=qs[_0xf7a0('0x31')](_[_0xf7a0('0x3a')](_0x5cb2e0[_0xf7a0('0x2f')],_0xce3d8c[_0xf7a0('0x31')]));if(_0x5cb2e0[_0xf7a0('0x2f')][_0xf7a0('0x3b')]){_0x2a9363[_0xf7a0('0x3c')]=_[_0xf7a0('0x3d')](_0x2a9363[_0xf7a0('0x3c')],{'$or':_[_0xf7a0('0x2a')](_0x2a9363[_0xf7a0('0x34')],function(_0x3fabe6){var _0x166b77={};_0x166b77[_0x3fabe6]={'$like':'%'+_0x5cb2e0['query']['filter']+'%'};return _0x166b77;})});}_0x2a9363=_[_0xf7a0('0x3d')]({},_0x2a9363,_0x5cb2e0['options']);return _0x21c02f[_0xf7a0('0x4c')](_0x2a9363);}})['then'](function(_0x479b59){if(_0x479b59){_0x49afe5=_0x479b59['length'];if(!_0x5cb2e0[_0xf7a0('0x2f')]['hasOwnProperty'](_0xf7a0('0x38'))){_0x2a9363[_0xf7a0('0x1f')]=qs[_0xf7a0('0x1f')](_0x5cb2e0[_0xf7a0('0x2f')][_0xf7a0('0x1f')]);_0x2a9363['offset']=qs[_0xf7a0('0x1d')](_0x5cb2e0['query'][_0xf7a0('0x1d')]);}return _0x21c02f[_0xf7a0('0x4c')](_0x2a9363);}})[_0xf7a0('0x27')](function(_0x5ee8d8){if(_0x5ee8d8){return _0x5ee8d8?{'count':_0x49afe5,'rows':_0x5ee8d8}:null;}})[_0xf7a0('0x27')](respondWithResult(_0x4c7729,null))[_0xf7a0('0x48')](handleError(_0x4c7729,null));};exports['getDescriptions']=function(_0x2e75c4,_0x436d07,_0x3854c1){var _0x5719da={};var _0x240773={};var _0x3d46fd;var _0x13c61e;return db[_0xf7a0('0x40')]['findOne']({'where':{'id':_0x2e75c4[_0xf7a0('0x43')]['id']}})[_0xf7a0('0x27')](handleEntityNotFound(_0x436d07,null))[_0xf7a0('0x27')](function(_0x3d2c6d){if(_0x3d2c6d){_0x3d46fd=_0x3d2c6d;_0x240773['model']=_['keys'](db[_0xf7a0('0x4b')][_0xf7a0('0x2b')]);_0x240773[_0xf7a0('0x2f')]=_[_0xf7a0('0x30')](_0x2e75c4[_0xf7a0('0x2f')]);_0x240773[_0xf7a0('0x31')]=_[_0xf7a0('0x32')](_0x240773[_0xf7a0('0x33')],_0x240773[_0xf7a0('0x2f')]);_0x5719da[_0xf7a0('0x34')]=_[_0xf7a0('0x32')](_0x240773[_0xf7a0('0x33')],qs[_0xf7a0('0x35')](_0x2e75c4[_0xf7a0('0x2f')][_0xf7a0('0x35')]));_0x5719da[_0xf7a0('0x34')]=_0x5719da['attributes']['length']?_0x5719da[_0xf7a0('0x34')]:_0x240773[_0xf7a0('0x33')];_0x5719da[_0xf7a0('0x4d')]=qs[_0xf7a0('0x39')](_0x2e75c4[_0xf7a0('0x2f')][_0xf7a0('0x39')]);_0x5719da[_0xf7a0('0x3c')]=qs[_0xf7a0('0x31')](_[_0xf7a0('0x3a')](_0x2e75c4[_0xf7a0('0x2f')],_0x240773[_0xf7a0('0x31')]));if(_0x2e75c4['query'][_0xf7a0('0x3b')]){_0x5719da[_0xf7a0('0x3c')]=_[_0xf7a0('0x3d')](_0x5719da['where'],{'$or':_['map'](_0x5719da['attributes'],function(_0x8bfb1d){var _0x1f39e9={};_0x1f39e9[_0x8bfb1d]={'$like':'%'+_0x2e75c4[_0xf7a0('0x2f')][_0xf7a0('0x3b')]+'%'};return _0x1f39e9;})});}_0x5719da=_['merge']({},_0x5719da,_0x2e75c4[_0xf7a0('0x3f')]);return _0x3d46fd[_0xf7a0('0x4e')](_0x5719da);}})[_0xf7a0('0x27')](function(_0xe75d6c){if(_0xe75d6c){_0x13c61e=_0xe75d6c[_0xf7a0('0x36')];if(!_0x2e75c4[_0xf7a0('0x2f')][_0xf7a0('0x37')](_0xf7a0('0x38'))){_0x5719da[_0xf7a0('0x1f')]=qs[_0xf7a0('0x1f')](_0x2e75c4[_0xf7a0('0x2f')][_0xf7a0('0x1f')]);_0x5719da[_0xf7a0('0x1d')]=qs[_0xf7a0('0x1d')](_0x2e75c4[_0xf7a0('0x2f')][_0xf7a0('0x1d')]);}return _0x3d46fd[_0xf7a0('0x4e')](_0x5719da);}})[_0xf7a0('0x27')](function(_0x15189d){if(_0x15189d){return _0x15189d?{'count':_0x13c61e,'rows':_0x15189d}:null;}})[_0xf7a0('0x27')](respondWithResult(_0x436d07,null))[_0xf7a0('0x48')](handleError(_0x436d07,null));}; \ No newline at end of file +var _0xe36e=['stack','name','index','map','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','include','rows','params','rawAttributes','intersection','find','body','catch','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','destroy','then','error'];(function(_0x994f25,_0x586fe8){var _0x2e1cf6=function(_0x13deb3){while(--_0x13deb3){_0x994f25['push'](_0x994f25['shift']());}};_0x2e1cf6(++_0x586fe8);}(_0xe36e,0xbb));var _0xee36=function(_0x538ad7,_0x47a6be){_0x538ad7=_0x538ad7-0x0;var _0x214503=_0xe36e[_0x538ad7];return _0x214503;};'use strict';var emlformat=require(_0xee36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee36('0x1'));var jsonpatch=require(_0xee36('0x2'));var rp=require(_0xee36('0x3'));var moment=require(_0xee36('0x4'));var BPromise=require(_0xee36('0x5'));var Mustache=require(_0xee36('0x6'));var util=require(_0xee36('0x7'));var path=require(_0xee36('0x8'));var sox=require(_0xee36('0x9'));var csv=require('to-csv');var ejs=require(_0xee36('0xa'));var fs=require('fs');var fs_extra=require(_0xee36('0xb'));var _=require(_0xee36('0xc'));var squel=require(_0xee36('0xd'));var crypto=require(_0xee36('0xe'));var jsforce=require(_0xee36('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xee36('0x10'));var querystring=require('querystring');var Papa=require(_0xee36('0x11'));var Redis=require(_0xee36('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xee36('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee36('0x14'));var logger=require(_0xee36('0x15'))(_0xee36('0x16'));var utils=require(_0xee36('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xee36('0x18'));var db=require(_0xee36('0x19'))['db'];function respondWithStatusCode(_0x589404,_0x509009){_0x509009=_0x509009||0xcc;return function(_0x5edab8){if(_0x5edab8){return _0x589404[_0xee36('0x1a')](_0x509009);}return _0x589404[_0xee36('0x1b')](_0x509009)[_0xee36('0x1c')]();};}function respondWithResult(_0x58088f,_0x53eae1){_0x53eae1=_0x53eae1||0xc8;return function(_0x5619e8){if(_0x5619e8){return _0x58088f[_0xee36('0x1b')](_0x53eae1)[_0xee36('0x1d')](_0x5619e8);}};}function respondWithFilteredResult(_0x47c48e,_0x3231a4){return function(_0x526ad7){if(_0x526ad7){var _0x267320=typeof _0x3231a4['offset']===_0xee36('0x1e')&&typeof _0x3231a4[_0xee36('0x1f')]==='undefined';var _0x4fb3ec=_0x526ad7[_0xee36('0x20')];var _0x14c1ea=_0x267320?0x0:_0x3231a4[_0xee36('0x21')];var _0x5c3d7f=_0x267320?_0x526ad7[_0xee36('0x20')]:_0x3231a4['offset']+_0x3231a4[_0xee36('0x1f')];var _0x5ba085;if(_0x5c3d7f>=_0x4fb3ec){_0x5c3d7f=_0x4fb3ec;_0x5ba085=0xc8;}else{_0x5ba085=0xce;}_0x47c48e[_0xee36('0x1b')](_0x5ba085);return _0x47c48e['set'](_0xee36('0x22'),_0x14c1ea+'-'+_0x5c3d7f+'/'+_0x4fb3ec)[_0xee36('0x1d')](_0x526ad7);}return null;};}function patchUpdates(_0x526401){return function(_0x55e4e5){try{jsonpatch[_0xee36('0x23')](_0x55e4e5,_0x526401,!![]);}catch(_0x456fd1){return BPromise[_0xee36('0x24')](_0x456fd1);}return _0x55e4e5['save']();};}function saveUpdates(_0x22e7d0,_0x2d878f){return function(_0x4ad25f){if(_0x4ad25f){return _0x4ad25f[_0xee36('0x25')](_0x22e7d0)['then'](function(_0x448de9){return _0x448de9;});}return null;};}function removeEntity(_0x2a841f,_0x31cdcc){return function(_0x3d2721){if(_0x3d2721){return _0x3d2721[_0xee36('0x26')]()[_0xee36('0x27')](function(){_0x2a841f[_0xee36('0x1b')](0xcc)[_0xee36('0x1c')]();});}};}function handleEntityNotFound(_0x560bcc,_0x1182dc){return function(_0x5a88aa){if(!_0x5a88aa){_0x560bcc['sendStatus'](0x194);}return _0x5a88aa;};}function handleError(_0x17b54e,_0x548632){_0x548632=_0x548632||0x1f4;return function(_0x88f313){logger[_0xee36('0x28')](_0x88f313[_0xee36('0x29')]);if(_0x88f313[_0xee36('0x2a')]){delete _0x88f313['name'];}_0x17b54e['status'](_0x548632)['send'](_0x88f313);};}exports[_0xee36('0x2b')]=function(_0x3dfafb,_0x591c8c){var _0x460710={},_0x59f37c={},_0x2d9617={'count':0x0,'rows':[]};var _0x55fce2=_[_0xee36('0x2c')](db['SalesforceConfiguration']['rawAttributes'],function(_0x57807b){return{'name':_0x57807b['fieldName'],'type':_0x57807b['type']['key']};});_0x59f37c[_0xee36('0x2d')]=_[_0xee36('0x2c')](_0x55fce2,_0xee36('0x2a'));_0x59f37c[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0x3dfafb[_0xee36('0x2e')]);_0x59f37c[_0xee36('0x30')]=_['intersection'](_0x59f37c['model'],_0x59f37c['query']);_0x460710[_0xee36('0x31')]=_['intersection'](_0x59f37c[_0xee36('0x2d')],qs[_0xee36('0x32')](_0x3dfafb[_0xee36('0x2e')][_0xee36('0x32')]));_0x460710[_0xee36('0x31')]=_0x460710[_0xee36('0x31')][_0xee36('0x33')]?_0x460710[_0xee36('0x31')]:_0x59f37c[_0xee36('0x2d')];if(!_0x3dfafb[_0xee36('0x2e')]['hasOwnProperty'](_0xee36('0x34'))){_0x460710[_0xee36('0x1f')]=qs[_0xee36('0x1f')](_0x3dfafb['query'][_0xee36('0x1f')]);_0x460710[_0xee36('0x21')]=qs['offset'](_0x3dfafb['query']['offset']);}_0x460710['order']=qs['sort'](_0x3dfafb[_0xee36('0x2e')][_0xee36('0x35')]);_0x460710[_0xee36('0x36')]=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0x3dfafb['query'],_0x59f37c[_0xee36('0x30')]),_0x55fce2);if(_0x3dfafb[_0xee36('0x2e')][_0xee36('0x38')]){_0x460710['where']=_[_0xee36('0x39')](_0x460710[_0xee36('0x36')],{'$or':_[_0xee36('0x2c')](_0x55fce2,function(_0x3ea5cd){if(_0x3ea5cd['type']!==_0xee36('0x3a')){var _0x245a42={};_0x245a42[_0x3ea5cd[_0xee36('0x2a')]]={'$like':'%'+_0x3dfafb[_0xee36('0x2e')][_0xee36('0x38')]+'%'};return _0x245a42;}})});}_0x460710=_[_0xee36('0x39')]({},_0x460710,_0x3dfafb[_0xee36('0x3b')]);var _0x4cbd6e={'where':_0x460710[_0xee36('0x36')]};return db[_0xee36('0x3c')][_0xee36('0x20')](_0x4cbd6e)[_0xee36('0x27')](function(_0x4cc008){_0x2d9617[_0xee36('0x20')]=_0x4cc008;if(_0x3dfafb[_0xee36('0x2e')]['includeAll']){_0x460710[_0xee36('0x3d')]=[{'all':!![]}];}return db[_0xee36('0x3c')]['findAll'](_0x460710);})['then'](function(_0x2fa64c){_0x2d9617[_0xee36('0x3e')]=_0x2fa64c;return _0x2d9617;})[_0xee36('0x27')](respondWithFilteredResult(_0x591c8c,_0x460710))['catch'](handleError(_0x591c8c,null));};exports['show']=function(_0x3f2250,_0x5bd413){var _0x2831e9={'raw':![],'where':{'id':_0x3f2250[_0xee36('0x3f')]['id']}},_0x59f53c={};_0x59f53c['model']=_['keys'](db[_0xee36('0x3c')][_0xee36('0x40')]);_0x59f53c[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0x3f2250[_0xee36('0x2e')]);_0x59f53c['filters']=_['intersection'](_0x59f53c[_0xee36('0x2d')],_0x59f53c[_0xee36('0x2e')]);_0x2831e9[_0xee36('0x31')]=_[_0xee36('0x41')](_0x59f53c['model'],qs[_0xee36('0x32')](_0x3f2250[_0xee36('0x2e')]['fields']));_0x2831e9['attributes']=_0x2831e9[_0xee36('0x31')][_0xee36('0x33')]?_0x2831e9[_0xee36('0x31')]:_0x59f53c[_0xee36('0x2d')];if(_0x3f2250[_0xee36('0x2e')]['includeAll']){_0x2831e9[_0xee36('0x3d')]=[{'all':!![]}];}_0x2831e9=_['merge']({},_0x2831e9,_0x3f2250[_0xee36('0x3b')]);return db[_0xee36('0x3c')][_0xee36('0x42')](_0x2831e9)['then'](handleEntityNotFound(_0x5bd413,null))[_0xee36('0x27')](respondWithResult(_0x5bd413,null))['catch'](handleError(_0x5bd413,null));};exports['create']=function(_0x4eeb76,_0x45f95b){return db[_0xee36('0x3c')]['create'](_0x4eeb76[_0xee36('0x43')],{})[_0xee36('0x27')](respondWithResult(_0x45f95b,0xc9))['catch'](handleError(_0x45f95b,null));};exports[_0xee36('0x25')]=function(_0x45d1d9,_0x279b98){if(_0x45d1d9['body']['id']){delete _0x45d1d9['body']['id'];}return db['SalesforceConfiguration'][_0xee36('0x42')]({'where':{'id':_0x45d1d9[_0xee36('0x3f')]['id']}})[_0xee36('0x27')](handleEntityNotFound(_0x279b98,null))[_0xee36('0x27')](saveUpdates(_0x45d1d9['body'],null))[_0xee36('0x27')](respondWithResult(_0x279b98,null))[_0xee36('0x44')](handleError(_0x279b98,null));};exports['destroy']=function(_0x34c9bd,_0x4e76df){return db[_0xee36('0x3c')]['find']({'where':{'id':_0x34c9bd[_0xee36('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e76df,null))[_0xee36('0x27')](removeEntity(_0x4e76df,null))[_0xee36('0x44')](handleError(_0x4e76df,null));};exports[_0xee36('0x45')]=function(_0x39127b,_0x4c94f7,_0x5c64bb){var _0x2ca5d3={};var _0x3c719f={};var _0x38bad1;var _0x810efe;return db[_0xee36('0x3c')][_0xee36('0x46')]({'where':{'id':_0x39127b[_0xee36('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4c94f7,null))['then'](function(_0x1d2212){if(_0x1d2212){_0x38bad1=_0x1d2212;_0x3c719f[_0xee36('0x2d')]=_[_0xee36('0x2f')](db['SalesforceField'][_0xee36('0x40')]);_0x3c719f[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0x39127b['query']);_0x3c719f[_0xee36('0x30')]=_[_0xee36('0x41')](_0x3c719f['model'],_0x3c719f[_0xee36('0x2e')]);_0x2ca5d3['attributes']=_[_0xee36('0x41')](_0x3c719f[_0xee36('0x2d')],qs['fields'](_0x39127b[_0xee36('0x2e')][_0xee36('0x32')]));_0x2ca5d3['attributes']=_0x2ca5d3['attributes'][_0xee36('0x33')]?_0x2ca5d3[_0xee36('0x31')]:_0x3c719f[_0xee36('0x2d')];_0x2ca5d3['order']=qs[_0xee36('0x35')](_0x39127b['query']['sort']);_0x2ca5d3['where']=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0x39127b[_0xee36('0x2e')],_0x3c719f[_0xee36('0x30')]));if(_0x39127b[_0xee36('0x2e')][_0xee36('0x38')]){_0x2ca5d3['where']=_[_0xee36('0x39')](_0x2ca5d3[_0xee36('0x36')],{'$or':_[_0xee36('0x2c')](_0x2ca5d3[_0xee36('0x31')],function(_0x1d776a){var _0x3f4b27={};_0x3f4b27[_0x1d776a]={'$like':'%'+_0x39127b[_0xee36('0x2e')]['filter']+'%'};return _0x3f4b27;})});}_0x2ca5d3=_[_0xee36('0x39')]({},_0x2ca5d3,_0x39127b['options']);return _0x38bad1[_0xee36('0x45')](_0x2ca5d3);}})[_0xee36('0x27')](function(_0x4304c2){if(_0x4304c2){_0x810efe=_0x4304c2['length'];if(!_0x39127b['query'][_0xee36('0x47')](_0xee36('0x34'))){_0x2ca5d3['limit']=qs[_0xee36('0x1f')](_0x39127b['query'][_0xee36('0x1f')]);_0x2ca5d3[_0xee36('0x21')]=qs[_0xee36('0x21')](_0x39127b['query'][_0xee36('0x21')]);}return _0x38bad1[_0xee36('0x45')](_0x2ca5d3);}})[_0xee36('0x27')](function(_0x4a99e1){if(_0x4a99e1){return _0x4a99e1?{'count':_0x810efe,'rows':_0x4a99e1}:null;}})['then'](respondWithResult(_0x4c94f7,null))[_0xee36('0x44')](handleError(_0x4c94f7,null));};exports[_0xee36('0x48')]=function(_0xf3fd30,_0x19e8ef,_0x4fb353){var _0x6cb7e={};var _0x59bd7b={};var _0x4da745;var _0x5872dd;return db['SalesforceConfiguration'][_0xee36('0x46')]({'where':{'id':_0xf3fd30[_0xee36('0x3f')]['id']}})[_0xee36('0x27')](handleEntityNotFound(_0x19e8ef,null))[_0xee36('0x27')](function(_0x20efd1){if(_0x20efd1){_0x4da745=_0x20efd1;_0x59bd7b[_0xee36('0x2d')]=_[_0xee36('0x2f')](db[_0xee36('0x49')]['rawAttributes']);_0x59bd7b[_0xee36('0x2e')]=_[_0xee36('0x2f')](_0xf3fd30[_0xee36('0x2e')]);_0x59bd7b[_0xee36('0x30')]=_[_0xee36('0x41')](_0x59bd7b['model'],_0x59bd7b[_0xee36('0x2e')]);_0x6cb7e[_0xee36('0x31')]=_[_0xee36('0x41')](_0x59bd7b[_0xee36('0x2d')],qs['fields'](_0xf3fd30[_0xee36('0x2e')]['fields']));_0x6cb7e[_0xee36('0x31')]=_0x6cb7e[_0xee36('0x31')]['length']?_0x6cb7e[_0xee36('0x31')]:_0x59bd7b[_0xee36('0x2d')];_0x6cb7e[_0xee36('0x4a')]=qs[_0xee36('0x35')](_0xf3fd30['query'][_0xee36('0x35')]);_0x6cb7e[_0xee36('0x36')]=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0xf3fd30[_0xee36('0x2e')],_0x59bd7b[_0xee36('0x30')]));if(_0xf3fd30[_0xee36('0x2e')][_0xee36('0x38')]){_0x6cb7e['where']=_[_0xee36('0x39')](_0x6cb7e[_0xee36('0x36')],{'$or':_['map'](_0x6cb7e['attributes'],function(_0x2dd7ee){var _0x1904f8={};_0x1904f8[_0x2dd7ee]={'$like':'%'+_0xf3fd30[_0xee36('0x2e')][_0xee36('0x38')]+'%'};return _0x1904f8;})});}_0x6cb7e=_[_0xee36('0x39')]({},_0x6cb7e,_0xf3fd30[_0xee36('0x3b')]);return _0x4da745['getSubjects'](_0x6cb7e);}})[_0xee36('0x27')](function(_0x2d61b4){if(_0x2d61b4){_0x5872dd=_0x2d61b4[_0xee36('0x33')];if(!_0xf3fd30[_0xee36('0x2e')]['hasOwnProperty'](_0xee36('0x34'))){_0x6cb7e[_0xee36('0x1f')]=qs[_0xee36('0x1f')](_0xf3fd30[_0xee36('0x2e')][_0xee36('0x1f')]);_0x6cb7e[_0xee36('0x21')]=qs[_0xee36('0x21')](_0xf3fd30[_0xee36('0x2e')]['offset']);}return _0x4da745[_0xee36('0x48')](_0x6cb7e);}})[_0xee36('0x27')](function(_0x1e80f2){if(_0x1e80f2){return _0x1e80f2?{'count':_0x5872dd,'rows':_0x1e80f2}:null;}})['then'](respondWithResult(_0x19e8ef,null))[_0xee36('0x44')](handleError(_0x19e8ef,null));};exports[_0xee36('0x4b')]=function(_0x40deae,_0x235e27,_0x5981a7){var _0x202c63={};var _0x541223={};var _0x23df06;var _0x2c08b4;return db[_0xee36('0x3c')]['findOne']({'where':{'id':_0x40deae[_0xee36('0x3f')]['id']}})[_0xee36('0x27')](handleEntityNotFound(_0x235e27,null))[_0xee36('0x27')](function(_0x45bba0){if(_0x45bba0){_0x23df06=_0x45bba0;_0x541223[_0xee36('0x2d')]=_[_0xee36('0x2f')](db['SalesforceField']['rawAttributes']);_0x541223[_0xee36('0x2e')]=_['keys'](_0x40deae[_0xee36('0x2e')]);_0x541223[_0xee36('0x30')]=_[_0xee36('0x41')](_0x541223[_0xee36('0x2d')],_0x541223[_0xee36('0x2e')]);_0x202c63['attributes']=_[_0xee36('0x41')](_0x541223[_0xee36('0x2d')],qs[_0xee36('0x32')](_0x40deae[_0xee36('0x2e')][_0xee36('0x32')]));_0x202c63['attributes']=_0x202c63[_0xee36('0x31')][_0xee36('0x33')]?_0x202c63['attributes']:_0x541223[_0xee36('0x2d')];_0x202c63[_0xee36('0x4a')]=qs[_0xee36('0x35')](_0x40deae['query']['sort']);_0x202c63[_0xee36('0x36')]=qs[_0xee36('0x30')](_[_0xee36('0x37')](_0x40deae[_0xee36('0x2e')],_0x541223[_0xee36('0x30')]));if(_0x40deae[_0xee36('0x2e')][_0xee36('0x38')]){_0x202c63[_0xee36('0x36')]=_[_0xee36('0x39')](_0x202c63[_0xee36('0x36')],{'$or':_['map'](_0x202c63['attributes'],function(_0x3cec01){var _0x980a27={};_0x980a27[_0x3cec01]={'$like':'%'+_0x40deae['query'][_0xee36('0x38')]+'%'};return _0x980a27;})});}_0x202c63=_['merge']({},_0x202c63,_0x40deae[_0xee36('0x3b')]);return _0x23df06[_0xee36('0x4b')](_0x202c63);}})['then'](function(_0x478499){if(_0x478499){_0x2c08b4=_0x478499[_0xee36('0x33')];if(!_0x40deae[_0xee36('0x2e')][_0xee36('0x47')](_0xee36('0x34'))){_0x202c63['limit']=qs[_0xee36('0x1f')](_0x40deae['query'][_0xee36('0x1f')]);_0x202c63[_0xee36('0x21')]=qs[_0xee36('0x21')](_0x40deae[_0xee36('0x2e')][_0xee36('0x21')]);}return _0x23df06[_0xee36('0x4b')](_0x202c63);}})[_0xee36('0x27')](function(_0x111c34){if(_0x111c34){return _0x111c34?{'count':_0x2c08b4,'rows':_0x111c34}:null;}})['then'](respondWithResult(_0x235e27,null))['catch'](handleError(_0x235e27,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 380508d..0c76078 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 _0x5720=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','util','../../config/logger','api','moment','path'];(function(_0x3ee685,_0x1fa765){var _0x134805=function(_0x5131fe){while(--_0x5131fe){_0x3ee685['push'](_0x3ee685['shift']());}};_0x134805(++_0x1fa765);}(_0x5720,0x1e1));var _0x0572=function(_0x114a4c,_0x6fe14d){_0x114a4c=_0x114a4c-0x0;var _0x52b16a=_0x5720[_0x114a4c];return _0x52b16a;};'use strict';var _=require('lodash');var util=require(_0x0572('0x0'));var logger=require(_0x0572('0x1'))(_0x0572('0x2'));var moment=require(_0x0572('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0572('0x4'));var rimraf=require('rimraf');var config=require(_0x0572('0x5'));var attributes=require(_0x0572('0x6'));module[_0x0572('0x7')]=function(_0x2cba4e,_0x4879a5){return _0x2cba4e[_0x0572('0x8')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa804=['int_salesforce_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x3fed55,_0x370c16){var _0x1cc539=function(_0x4a39b6){while(--_0x4a39b6){_0x3fed55['push'](_0x3fed55['shift']());}};_0x1cc539(++_0x370c16);}(_0xa804,0xde));var _0x4a80=function(_0x92394c,_0x5096e1){_0x92394c=_0x92394c-0x0;var _0x1dac92=_0xa804[_0x92394c];return _0x1dac92;};'use strict';var _=require(_0x4a80('0x0'));var util=require(_0x4a80('0x1'));var logger=require('../../config/logger')(_0x4a80('0x2'));var moment=require('moment');var BPromise=require(_0x4a80('0x3'));var rp=require(_0x4a80('0x4'));var fs=require('fs');var path=require(_0x4a80('0x5'));var rimraf=require(_0x4a80('0x6'));var config=require(_0x4a80('0x7'));var attributes=require(_0x4a80('0x8'));module[_0x4a80('0x9')]=function(_0x3a9756,_0x2a8d85){return _0x3a9756[_0x4a80('0xa')](_0x4a80('0xb'),attributes,{'tableName':_0x4a80('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 e026521..54d36ed 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 _0x3c7c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x5e1d09,_0x4dc6d8){var _0x1f82e5=function(_0x5ed307){while(--_0x5ed307){_0x5e1d09['push'](_0x5e1d09['shift']());}};_0x1f82e5(++_0x4dc6d8);}(_0x3c7c,0xdd));var _0xc3c7=function(_0x47e92b,_0x29e3b5){_0x47e92b=_0x47e92b-0x0;var _0x2da694=_0x3c7c[_0x47e92b];return _0x2da694;};'use strict';var _=require(_0xc3c7('0x0'));var util=require(_0xc3c7('0x1'));var moment=require(_0xc3c7('0x2'));var BPromise=require(_0xc3c7('0x3'));var rs=require(_0xc3c7('0x4'));var fs=require('fs');var Redis=require(_0xc3c7('0x5'));var db=require(_0xc3c7('0x6'))['db'];var utils=require(_0xc3c7('0x7'));var logger=require(_0xc3c7('0x8'))(_0xc3c7('0x9'));var config=require(_0xc3c7('0xa'));var jayson=require(_0xc3c7('0xb'));var client=jayson[_0xc3c7('0xc')][_0xc3c7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x448a48,_0x581559,_0x525fdf){return new BPromise(function(_0x3a2968,_0x2fe00e){return client['request'](_0x448a48,_0x525fdf)[_0xc3c7('0xe')](function(_0x2fb2bf){logger[_0xc3c7('0xf')](_0xc3c7('0x10'),_0x581559,_0xc3c7('0x11'));logger[_0xc3c7('0x12')](_0xc3c7('0x13'),_0x581559,_0xc3c7('0x11'),JSON[_0xc3c7('0x14')](_0x2fb2bf));if(_0x2fb2bf[_0xc3c7('0x15')]){if(_0x2fb2bf[_0xc3c7('0x15')][_0xc3c7('0x16')]===0x1f4){logger['error'](_0xc3c7('0x10'),_0x581559,_0x2fb2bf[_0xc3c7('0x15')][_0xc3c7('0x17')]);return _0x2fe00e(_0x2fb2bf[_0xc3c7('0x15')][_0xc3c7('0x17')]);}logger['error'](_0xc3c7('0x10'),_0x581559,_0x2fb2bf[_0xc3c7('0x15')][_0xc3c7('0x17')]);return _0x3a2968(_0x2fb2bf['error'][_0xc3c7('0x17')]);}else{logger[_0xc3c7('0xf')](_0xc3c7('0x10'),_0x581559,_0xc3c7('0x11'));_0x3a2968(_0x2fb2bf['result'][_0xc3c7('0x17')]);}})[_0xc3c7('0x18')](function(_0x68d1fd){logger[_0xc3c7('0x15')](_0xc3c7('0x10'),_0x581559,_0x68d1fd);_0x2fe00e(_0x68d1fd);});});} \ No newline at end of file +var _0x8a89=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8a89,0xa5));var _0x98a8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x8a89[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x98a8('0x0'));var util=require(_0x98a8('0x1'));var moment=require(_0x98a8('0x2'));var BPromise=require(_0x98a8('0x3'));var rs=require(_0x98a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98a8('0x5'))['db'];var utils=require(_0x98a8('0x6'));var logger=require(_0x98a8('0x7'))(_0x98a8('0x8'));var config=require(_0x98a8('0x9'));var jayson=require(_0x98a8('0xa'));var client=jayson[_0x98a8('0xb')][_0x98a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x398d57,_0x4ab492,_0x47603d){return new BPromise(function(_0x179fb3,_0x2a70ec){return client[_0x98a8('0xd')](_0x398d57,_0x47603d)[_0x98a8('0xe')](function(_0x17a29b){logger[_0x98a8('0xf')](_0x98a8('0x10'),_0x4ab492,_0x98a8('0x11'));logger['debug'](_0x98a8('0x12'),_0x4ab492,_0x98a8('0x11'),JSON[_0x98a8('0x13')](_0x17a29b));if(_0x17a29b['error']){if(_0x17a29b[_0x98a8('0x14')]['code']===0x1f4){logger[_0x98a8('0x14')](_0x98a8('0x10'),_0x4ab492,_0x17a29b[_0x98a8('0x14')]['message']);return _0x2a70ec(_0x17a29b[_0x98a8('0x14')][_0x98a8('0x15')]);}logger[_0x98a8('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ab492,_0x17a29b[_0x98a8('0x14')][_0x98a8('0x15')]);return _0x179fb3(_0x17a29b[_0x98a8('0x14')][_0x98a8('0x15')]);}else{logger[_0x98a8('0xf')](_0x98a8('0x10'),_0x4ab492,_0x98a8('0x11'));_0x179fb3(_0x17a29b[_0x98a8('0x16')]['message']);}})[_0x98a8('0x17')](function(_0x18c7eb){logger['error'](_0x98a8('0x10'),_0x4ab492,_0x18c7eb);_0x2a70ec(_0x18c7eb);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 80517fc..d8e37c7 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 _0x35ad=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x55c702,_0x4da20b){var _0x532488=function(_0xf16cf0){while(--_0xf16cf0){_0x55c702['push'](_0x55c702['shift']());}};_0x532488(++_0x4da20b);}(_0x35ad,0x1df));var _0xd35a=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x35ad[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0xd35a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd35a('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd35a('0x2'));var interaction=require(_0xd35a('0x3'));var config=require(_0xd35a('0x4'));var controller=require(_0xd35a('0x5'));router[_0xd35a('0x6')]('/',auth[_0xd35a('0x7')](),controller[_0xd35a('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd35a('0x9')]);router[_0xd35a('0xa')]('/',auth[_0xd35a('0x7')](),controller[_0xd35a('0xb')]);router[_0xd35a('0xc')](_0xd35a('0xd'),auth[_0xd35a('0x7')](),controller[_0xd35a('0xe')]);router[_0xd35a('0xf')](_0xd35a('0xd'),auth[_0xd35a('0x7')](),controller[_0xd35a('0x10')]);module[_0xd35a('0x11')]=router; \ No newline at end of file +var _0xbcab=['connect-timeout','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','index','post','create','update','delete','/:id','destroy','exports','util','path'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xbcab,0xfe));var _0xbbca=function(_0x3f5b9a,_0x45f043){_0x3f5b9a=_0x3f5b9a-0x0;var _0x33fbf9=_0xbcab[_0x3f5b9a];return _0x33fbf9;};'use strict';var multer=require('multer');var util=require(_0xbbca('0x0'));var path=require(_0xbbca('0x1'));var timeout=require(_0xbbca('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbbca('0x3'));var auth=require(_0xbbca('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbbca('0x5'));router[_0xbbca('0x6')]('/',auth[_0xbbca('0x7')](),controller[_0xbbca('0x8')]);router[_0xbbca('0x6')]('/:id',auth[_0xbbca('0x7')](),controller['show']);router[_0xbbca('0x9')]('/',auth[_0xbbca('0x7')](),controller[_0xbbca('0xa')]);router['put']('/:id',auth[_0xbbca('0x7')](),controller[_0xbbca('0xb')]);router[_0xbbca('0xc')](_0xbbca('0xd'),auth['isAuthenticated'](),controller[_0xbbca('0xe')]);module[_0xbbca('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0628c50..0d08881 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 _0xcac0=['customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x1b6566,_0x1073ca){var _0x3d2fdd=function(_0x2e0028){while(--_0x2e0028){_0x1b6566['push'](_0x1b6566['shift']());}};_0x3d2fdd(++_0x1073ca);}(_0xcac0,0x137));var _0x0cac=function(_0x1cc7a7,_0xd98320){_0x1cc7a7=_0x1cc7a7-0x0;var _0x219b15=_0xcac0[_0x1cc7a7];return _0x219b15;};'use strict';var Sequelize=require(_0x0cac('0x0'));module[_0x0cac('0x1')]={'type':{'type':Sequelize[_0x0cac('0x2')]('string',_0x0cac('0x3'),_0x0cac('0x4'),_0x0cac('0x5'),_0x0cac('0x6')),'defaultValue':_0x0cac('0x7')},'content':{'type':Sequelize[_0x0cac('0x8')]},'key':{'type':Sequelize[_0x0cac('0x8')]},'keyType':{'type':Sequelize[_0x0cac('0x2')](_0x0cac('0x7'),_0x0cac('0x3'),_0x0cac('0x4'))},'keyContent':{'type':Sequelize[_0x0cac('0x8')]},'idField':{'type':Sequelize[_0x0cac('0x8')]},'variableName':{'type':Sequelize[_0x0cac('0x8')]}}; \ No newline at end of file +var _0x3a66=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x469407,_0xd3d477){var _0x2d391a=function(_0x1e3b07){while(--_0x1e3b07){_0x469407['push'](_0x469407['shift']());}};_0x2d391a(++_0xd3d477);}(_0x3a66,0x7e));var _0x63a6=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x3a66[_0x5d72da];return _0x43ebe7;};'use strict';var Sequelize=require(_0x63a6('0x0'));module[_0x63a6('0x1')]={'type':{'type':Sequelize[_0x63a6('0x2')](_0x63a6('0x3'),_0x63a6('0x4'),'customVariable',_0x63a6('0x5'),_0x63a6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x63a6('0x7')]},'key':{'type':Sequelize[_0x63a6('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x63a6('0x4'),_0x63a6('0x8'))},'keyContent':{'type':Sequelize[_0x63a6('0x7')]},'idField':{'type':Sequelize[_0x63a6('0x7')]},'variableName':{'type':Sequelize[_0x63a6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 10371dc..c849529 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 _0x5238=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SalesforceField','findAll','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5238,0x6e));var _0x8523=function(_0x46048a,_0x42962a){_0x46048a=_0x46048a-0x0;var _0x279ed8=_0x5238[_0x46048a];return _0x279ed8;};'use strict';var emlformat=require(_0x8523('0x0'));var rimraf=require(_0x8523('0x1'));var zipdir=require(_0x8523('0x2'));var jsonpatch=require(_0x8523('0x3'));var rp=require(_0x8523('0x4'));var moment=require(_0x8523('0x5'));var BPromise=require(_0x8523('0x6'));var Mustache=require('mustache');var util=require(_0x8523('0x7'));var path=require(_0x8523('0x8'));var sox=require('sox');var csv=require(_0x8523('0x9'));var ejs=require(_0x8523('0xa'));var fs=require('fs');var fs_extra=require(_0x8523('0xb'));var _=require(_0x8523('0xc'));var squel=require(_0x8523('0xd'));var crypto=require(_0x8523('0xe'));var jsforce=require(_0x8523('0xf'));var deskjs=require(_0x8523('0x10'));var toCsv=require(_0x8523('0x9'));var querystring=require(_0x8523('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8523('0x12'));var qs=require(_0x8523('0x13'));var as=require(_0x8523('0x14'));var hardwareService=require(_0x8523('0x15'));var logger=require(_0x8523('0x16'))(_0x8523('0x17'));var utils=require('../../config/utils');var config=require(_0x8523('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8523('0x19'))['db'];function respondWithStatusCode(_0x4ea529,_0x3885d0){_0x3885d0=_0x3885d0||0xcc;return function(_0x2adf70){if(_0x2adf70){return _0x4ea529[_0x8523('0x1a')](_0x3885d0);}return _0x4ea529['status'](_0x3885d0)[_0x8523('0x1b')]();};}function respondWithResult(_0x4e0219,_0x5d5291){_0x5d5291=_0x5d5291||0xc8;return function(_0x2179a8){if(_0x2179a8){return _0x4e0219[_0x8523('0x1c')](_0x5d5291)['json'](_0x2179a8);}};}function respondWithFilteredResult(_0x40eb82,_0x31b975){return function(_0x16aee1){if(_0x16aee1){var _0x24f54e=typeof _0x31b975[_0x8523('0x1d')]===_0x8523('0x1e')&&typeof _0x31b975['limit']===_0x8523('0x1e');var _0x2d7769=_0x16aee1['count'];var _0x1315cc=_0x24f54e?0x0:_0x31b975[_0x8523('0x1d')];var _0x8e5ed7=_0x24f54e?_0x16aee1[_0x8523('0x1f')]:_0x31b975[_0x8523('0x1d')]+_0x31b975[_0x8523('0x20')];var _0x1fec9a;if(_0x8e5ed7>=_0x2d7769){_0x8e5ed7=_0x2d7769;_0x1fec9a=0xc8;}else{_0x1fec9a=0xce;}_0x40eb82[_0x8523('0x1c')](_0x1fec9a);return _0x40eb82[_0x8523('0x21')](_0x8523('0x22'),_0x1315cc+'-'+_0x8e5ed7+'/'+_0x2d7769)[_0x8523('0x23')](_0x16aee1);}return null;};}function patchUpdates(_0x231e3e){return function(_0x3449a5){try{jsonpatch['apply'](_0x3449a5,_0x231e3e,!![]);}catch(_0x5a28ef){return BPromise[_0x8523('0x24')](_0x5a28ef);}return _0x3449a5[_0x8523('0x25')]();};}function saveUpdates(_0x2d0886,_0x4c0d40){return function(_0x438186){if(_0x438186){return _0x438186['update'](_0x2d0886)[_0x8523('0x26')](function(_0x3e1351){return _0x3e1351;});}return null;};}function removeEntity(_0x5f25b8,_0x32a4c6){return function(_0x21250e){if(_0x21250e){return _0x21250e[_0x8523('0x27')]()['then'](function(){_0x5f25b8[_0x8523('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c276,_0x17413c){return function(_0x4e4d82){if(!_0x4e4d82){_0x50c276[_0x8523('0x1a')](0x194);}return _0x4e4d82;};}function handleError(_0xf860a9,_0x4ab56d){_0x4ab56d=_0x4ab56d||0x1f4;return function(_0x378848){logger[_0x8523('0x28')](_0x378848[_0x8523('0x29')]);if(_0x378848[_0x8523('0x2a')]){delete _0x378848[_0x8523('0x2a')];}_0xf860a9[_0x8523('0x1c')](_0x4ab56d)[_0x8523('0x2b')](_0x378848);};}exports[_0x8523('0x2c')]=function(_0x5160d8,_0x2a9e8d){var _0x2781bd={},_0x1e3286={},_0x421b6a={'count':0x0,'rows':[]};var _0xf6c8bc=_[_0x8523('0x2d')](db['SalesforceField'][_0x8523('0x2e')],function(_0x49b261){return{'name':_0x49b261[_0x8523('0x2f')],'type':_0x49b261[_0x8523('0x30')][_0x8523('0x31')]};});_0x1e3286[_0x8523('0x32')]=_[_0x8523('0x2d')](_0xf6c8bc,_0x8523('0x2a'));_0x1e3286[_0x8523('0x33')]=_[_0x8523('0x34')](_0x5160d8[_0x8523('0x33')]);_0x1e3286[_0x8523('0x35')]=_['intersection'](_0x1e3286[_0x8523('0x32')],_0x1e3286[_0x8523('0x33')]);_0x2781bd['attributes']=_[_0x8523('0x36')](_0x1e3286[_0x8523('0x32')],qs[_0x8523('0x37')](_0x5160d8[_0x8523('0x33')]['fields']));_0x2781bd[_0x8523('0x38')]=_0x2781bd[_0x8523('0x38')][_0x8523('0x39')]?_0x2781bd['attributes']:_0x1e3286['model'];if(!_0x5160d8[_0x8523('0x33')]['hasOwnProperty'](_0x8523('0x3a'))){_0x2781bd['limit']=qs[_0x8523('0x20')](_0x5160d8[_0x8523('0x33')][_0x8523('0x20')]);_0x2781bd[_0x8523('0x1d')]=qs['offset'](_0x5160d8[_0x8523('0x33')][_0x8523('0x1d')]);}_0x2781bd[_0x8523('0x3b')]=qs[_0x8523('0x3c')](_0x5160d8['query'][_0x8523('0x3c')]);_0x2781bd[_0x8523('0x3d')]=qs[_0x8523('0x35')](_[_0x8523('0x3e')](_0x5160d8[_0x8523('0x33')],_0x1e3286[_0x8523('0x35')]),_0xf6c8bc);if(_0x5160d8[_0x8523('0x33')][_0x8523('0x3f')]){_0x2781bd['where']=_[_0x8523('0x40')](_0x2781bd[_0x8523('0x3d')],{'$or':_[_0x8523('0x2d')](_0xf6c8bc,function(_0x14fce8){if(_0x14fce8[_0x8523('0x30')]!==_0x8523('0x41')){var _0x2416e0={};_0x2416e0[_0x14fce8[_0x8523('0x2a')]]={'$like':'%'+_0x5160d8[_0x8523('0x33')][_0x8523('0x3f')]+'%'};return _0x2416e0;}})});}_0x2781bd=_[_0x8523('0x40')]({},_0x2781bd,_0x5160d8[_0x8523('0x42')]);var _0xcea44d={'where':_0x2781bd[_0x8523('0x3d')]};return db['SalesforceField']['count'](_0xcea44d)[_0x8523('0x26')](function(_0xd9befe){_0x421b6a[_0x8523('0x1f')]=_0xd9befe;if(_0x5160d8[_0x8523('0x33')][_0x8523('0x43')]){_0x2781bd[_0x8523('0x44')]=[{'all':!![]}];}return db[_0x8523('0x45')][_0x8523('0x46')](_0x2781bd);})['then'](function(_0x39820b){_0x421b6a['rows']=_0x39820b;return _0x421b6a;})[_0x8523('0x26')](respondWithFilteredResult(_0x2a9e8d,_0x2781bd))['catch'](handleError(_0x2a9e8d,null));};exports['show']=function(_0x4d7057,_0x5def51){var _0x34e0a8={'raw':!![],'where':{'id':_0x4d7057[_0x8523('0x47')]['id']}},_0x43b718={};_0x43b718[_0x8523('0x32')]=_[_0x8523('0x34')](db['SalesforceField'][_0x8523('0x2e')]);_0x43b718[_0x8523('0x33')]=_['keys'](_0x4d7057[_0x8523('0x33')]);_0x43b718[_0x8523('0x35')]=_[_0x8523('0x36')](_0x43b718[_0x8523('0x32')],_0x43b718[_0x8523('0x33')]);_0x34e0a8[_0x8523('0x38')]=_[_0x8523('0x36')](_0x43b718[_0x8523('0x32')],qs[_0x8523('0x37')](_0x4d7057[_0x8523('0x33')][_0x8523('0x37')]));_0x34e0a8[_0x8523('0x38')]=_0x34e0a8[_0x8523('0x38')]['length']?_0x34e0a8[_0x8523('0x38')]:_0x43b718[_0x8523('0x32')];if(_0x4d7057[_0x8523('0x33')][_0x8523('0x43')]){_0x34e0a8[_0x8523('0x44')]=[{'all':!![]}];}_0x34e0a8=_[_0x8523('0x40')]({},_0x34e0a8,_0x4d7057[_0x8523('0x42')]);return db[_0x8523('0x45')][_0x8523('0x48')](_0x34e0a8)[_0x8523('0x26')](handleEntityNotFound(_0x5def51,null))[_0x8523('0x26')](respondWithResult(_0x5def51,null))[_0x8523('0x49')](handleError(_0x5def51,null));};exports[_0x8523('0x4a')]=function(_0x4b535a,_0x32cbd1){return db['SalesforceField'][_0x8523('0x4a')](_0x4b535a[_0x8523('0x4b')],{})[_0x8523('0x26')](respondWithResult(_0x32cbd1,0xc9))[_0x8523('0x49')](handleError(_0x32cbd1,null));};exports[_0x8523('0x4c')]=function(_0x51ce83,_0xdc2b62){if(_0x51ce83[_0x8523('0x4b')]['id']){delete _0x51ce83[_0x8523('0x4b')]['id'];}return db['SalesforceField'][_0x8523('0x48')]({'where':{'id':_0x51ce83['params']['id']}})[_0x8523('0x26')](handleEntityNotFound(_0xdc2b62,null))[_0x8523('0x26')](saveUpdates(_0x51ce83[_0x8523('0x4b')],null))[_0x8523('0x26')](respondWithResult(_0xdc2b62,null))['catch'](handleError(_0xdc2b62,null));};exports[_0x8523('0x27')]=function(_0x2cb6cc,_0x1db42b){return db['SalesforceField']['find']({'where':{'id':_0x2cb6cc[_0x8523('0x47')]['id']}})[_0x8523('0x26')](handleEntityNotFound(_0x1db42b,null))[_0x8523('0x26')](removeEntity(_0x1db42b,null))[_0x8523('0x49')](handleError(_0x1db42b,null));}; \ No newline at end of file +var _0x1269=['VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','apply','save','update','then','error','stack','name','send','index','map','SalesforceField','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x1269,0xd0));var _0x9126=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0x1269[_0x33975c];return _0x1c15ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9126('0x0'));var zipdir=require(_0x9126('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9126('0x2'));var moment=require(_0x9126('0x3'));var BPromise=require(_0x9126('0x4'));var Mustache=require(_0x9126('0x5'));var util=require('util');var path=require(_0x9126('0x6'));var sox=require('sox');var csv=require(_0x9126('0x7'));var ejs=require(_0x9126('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9126('0x9'));var crypto=require(_0x9126('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9126('0xb'));var toCsv=require(_0x9126('0x7'));var querystring=require(_0x9126('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9126('0xd'));var config=require(_0x9126('0xe'));var licenseUtil=require(_0x9126('0xf'));var db=require(_0x9126('0x10'))['db'];function respondWithStatusCode(_0x6ed350,_0x3b72b0){_0x3b72b0=_0x3b72b0||0xcc;return function(_0x4ca233){if(_0x4ca233){return _0x6ed350['sendStatus'](_0x3b72b0);}return _0x6ed350['status'](_0x3b72b0)[_0x9126('0x11')]();};}function respondWithResult(_0x3b3a1f,_0x551bce){_0x551bce=_0x551bce||0xc8;return function(_0x6466d3){if(_0x6466d3){return _0x3b3a1f[_0x9126('0x12')](_0x551bce)[_0x9126('0x13')](_0x6466d3);}};}function respondWithFilteredResult(_0x111080,_0x2d4ff2){return function(_0x4a018d){if(_0x4a018d){var _0x294300=typeof _0x2d4ff2[_0x9126('0x14')]===_0x9126('0x15')&&typeof _0x2d4ff2['limit']===_0x9126('0x15');var _0x4945e7=_0x4a018d['count'];var _0x4c4eb1=_0x294300?0x0:_0x2d4ff2[_0x9126('0x14')];var _0x315cdf=_0x294300?_0x4a018d['count']:_0x2d4ff2[_0x9126('0x14')]+_0x2d4ff2[_0x9126('0x16')];var _0x2ebcc5;if(_0x315cdf>=_0x4945e7){_0x315cdf=_0x4945e7;_0x2ebcc5=0xc8;}else{_0x2ebcc5=0xce;}_0x111080[_0x9126('0x12')](_0x2ebcc5);return _0x111080[_0x9126('0x17')]('Content-Range',_0x4c4eb1+'-'+_0x315cdf+'/'+_0x4945e7)[_0x9126('0x13')](_0x4a018d);}return null;};}function patchUpdates(_0x34f787){return function(_0x3d6c47){try{jsonpatch[_0x9126('0x18')](_0x3d6c47,_0x34f787,!![]);}catch(_0x54645a){return BPromise['reject'](_0x54645a);}return _0x3d6c47[_0x9126('0x19')]();};}function saveUpdates(_0x5e5fbb,_0x10db21){return function(_0x304d00){if(_0x304d00){return _0x304d00[_0x9126('0x1a')](_0x5e5fbb)['then'](function(_0x4f24ef){return _0x4f24ef;});}return null;};}function removeEntity(_0xa7b35f,_0x36dc09){return function(_0x3d3484){if(_0x3d3484){return _0x3d3484['destroy']()[_0x9126('0x1b')](function(){_0xa7b35f[_0x9126('0x12')](0xcc)[_0x9126('0x11')]();});}};}function handleEntityNotFound(_0x3273ca,_0x14f27d){return function(_0x51015d){if(!_0x51015d){_0x3273ca['sendStatus'](0x194);}return _0x51015d;};}function handleError(_0xe06d5c,_0x58cb85){_0x58cb85=_0x58cb85||0x1f4;return function(_0x3a3a92){logger[_0x9126('0x1c')](_0x3a3a92[_0x9126('0x1d')]);if(_0x3a3a92[_0x9126('0x1e')]){delete _0x3a3a92[_0x9126('0x1e')];}_0xe06d5c[_0x9126('0x12')](_0x58cb85)[_0x9126('0x1f')](_0x3a3a92);};}exports[_0x9126('0x20')]=function(_0x3be67c,_0xf844b2){var _0x1d92c5={},_0x160a48={},_0x45441f={'count':0x0,'rows':[]};var _0x49ace9=_[_0x9126('0x21')](db[_0x9126('0x22')]['rawAttributes'],function(_0x56d0ec){return{'name':_0x56d0ec[_0x9126('0x23')],'type':_0x56d0ec[_0x9126('0x24')]['key']};});_0x160a48[_0x9126('0x25')]=_['map'](_0x49ace9,'name');_0x160a48['query']=_[_0x9126('0x26')](_0x3be67c[_0x9126('0x27')]);_0x160a48[_0x9126('0x28')]=_[_0x9126('0x29')](_0x160a48[_0x9126('0x25')],_0x160a48[_0x9126('0x27')]);_0x1d92c5[_0x9126('0x2a')]=_[_0x9126('0x29')](_0x160a48['model'],qs[_0x9126('0x2b')](_0x3be67c['query'][_0x9126('0x2b')]));_0x1d92c5[_0x9126('0x2a')]=_0x1d92c5['attributes']['length']?_0x1d92c5[_0x9126('0x2a')]:_0x160a48[_0x9126('0x25')];if(!_0x3be67c['query'][_0x9126('0x2c')](_0x9126('0x2d'))){_0x1d92c5[_0x9126('0x16')]=qs[_0x9126('0x16')](_0x3be67c[_0x9126('0x27')][_0x9126('0x16')]);_0x1d92c5[_0x9126('0x14')]=qs[_0x9126('0x14')](_0x3be67c[_0x9126('0x27')]['offset']);}_0x1d92c5[_0x9126('0x2e')]=qs['sort'](_0x3be67c[_0x9126('0x27')][_0x9126('0x2f')]);_0x1d92c5[_0x9126('0x30')]=qs[_0x9126('0x28')](_[_0x9126('0x31')](_0x3be67c['query'],_0x160a48[_0x9126('0x28')]),_0x49ace9);if(_0x3be67c['query'][_0x9126('0x32')]){_0x1d92c5[_0x9126('0x30')]=_[_0x9126('0x33')](_0x1d92c5['where'],{'$or':_[_0x9126('0x21')](_0x49ace9,function(_0x160807){if(_0x160807[_0x9126('0x24')]!==_0x9126('0x34')){var _0x58097f={};_0x58097f[_0x160807['name']]={'$like':'%'+_0x3be67c[_0x9126('0x27')][_0x9126('0x32')]+'%'};return _0x58097f;}})});}_0x1d92c5=_['merge']({},_0x1d92c5,_0x3be67c[_0x9126('0x35')]);var _0x2508b1={'where':_0x1d92c5[_0x9126('0x30')]};return db[_0x9126('0x22')]['count'](_0x2508b1)[_0x9126('0x1b')](function(_0x1e35d2){_0x45441f['count']=_0x1e35d2;if(_0x3be67c[_0x9126('0x27')][_0x9126('0x36')]){_0x1d92c5['include']=[{'all':!![]}];}return db[_0x9126('0x22')]['findAll'](_0x1d92c5);})[_0x9126('0x1b')](function(_0x5c43af){_0x45441f[_0x9126('0x37')]=_0x5c43af;return _0x45441f;})[_0x9126('0x1b')](respondWithFilteredResult(_0xf844b2,_0x1d92c5))[_0x9126('0x38')](handleError(_0xf844b2,null));};exports[_0x9126('0x39')]=function(_0x3a7a70,_0x195e3e){var _0x2a6d8e={'raw':!![],'where':{'id':_0x3a7a70['params']['id']}},_0x2bec24={};_0x2bec24[_0x9126('0x25')]=_['keys'](db['SalesforceField'][_0x9126('0x3a')]);_0x2bec24[_0x9126('0x27')]=_[_0x9126('0x26')](_0x3a7a70[_0x9126('0x27')]);_0x2bec24['filters']=_[_0x9126('0x29')](_0x2bec24['model'],_0x2bec24['query']);_0x2a6d8e[_0x9126('0x2a')]=_['intersection'](_0x2bec24[_0x9126('0x25')],qs[_0x9126('0x2b')](_0x3a7a70[_0x9126('0x27')]['fields']));_0x2a6d8e[_0x9126('0x2a')]=_0x2a6d8e[_0x9126('0x2a')]['length']?_0x2a6d8e[_0x9126('0x2a')]:_0x2bec24[_0x9126('0x25')];if(_0x3a7a70['query'][_0x9126('0x36')]){_0x2a6d8e[_0x9126('0x3b')]=[{'all':!![]}];}_0x2a6d8e=_['merge']({},_0x2a6d8e,_0x3a7a70[_0x9126('0x35')]);return db[_0x9126('0x22')][_0x9126('0x3c')](_0x2a6d8e)[_0x9126('0x1b')](handleEntityNotFound(_0x195e3e,null))[_0x9126('0x1b')](respondWithResult(_0x195e3e,null))[_0x9126('0x38')](handleError(_0x195e3e,null));};exports[_0x9126('0x3d')]=function(_0x125181,_0x46c60e){return db[_0x9126('0x22')][_0x9126('0x3d')](_0x125181[_0x9126('0x3e')],{})['then'](respondWithResult(_0x46c60e,0xc9))[_0x9126('0x38')](handleError(_0x46c60e,null));};exports[_0x9126('0x1a')]=function(_0x484b90,_0x4f3cf6){if(_0x484b90['body']['id']){delete _0x484b90['body']['id'];}return db['SalesforceField'][_0x9126('0x3c')]({'where':{'id':_0x484b90[_0x9126('0x3f')]['id']}})[_0x9126('0x1b')](handleEntityNotFound(_0x4f3cf6,null))[_0x9126('0x1b')](saveUpdates(_0x484b90[_0x9126('0x3e')],null))[_0x9126('0x1b')](respondWithResult(_0x4f3cf6,null))[_0x9126('0x38')](handleError(_0x4f3cf6,null));};exports[_0x9126('0x40')]=function(_0x2a68a4,_0xda9588){return db[_0x9126('0x22')][_0x9126('0x3c')]({'where':{'id':_0x2a68a4[_0x9126('0x3f')]['id']}})[_0x9126('0x1b')](handleEntityNotFound(_0xda9588,null))['then'](removeEntity(_0xda9588,null))[_0x9126('0x38')](handleError(_0xda9588,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index def562f..0c50469 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 _0x9ea1=['rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9ea1,0xb1));var _0x19ea=function(_0x397a92,_0x4c0449){_0x397a92=_0x397a92-0x0;var _0x4d8638=_0x9ea1[_0x397a92];return _0x4d8638;};'use strict';var _=require('lodash');var util=require(_0x19ea('0x0'));var logger=require(_0x19ea('0x1'))(_0x19ea('0x2'));var moment=require('moment');var BPromise=require(_0x19ea('0x3'));var rp=require(_0x19ea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19ea('0x5'));var config=require(_0x19ea('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x19ea('0x7')]=function(_0x3cf27a,_0x20073b){return _0x3cf27a[_0x19ea('0x8')](_0x19ea('0x9'),attributes,{'tableName':_0x19ea('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x19ea('0xb'),_0x19ea('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33be=['int_salesforce_fields','salesforce_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField'];(function(_0x59f6c9,_0x50271d){var _0x52ed6a=function(_0x2c008d){while(--_0x2c008d){_0x59f6c9['push'](_0x59f6c9['shift']());}};_0x52ed6a(++_0x50271d);}(_0x33be,0x16f));var _0xe33b=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x33be[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xe33b('0x0'));var util=require('util');var logger=require(_0xe33b('0x1'))('api');var moment=require(_0xe33b('0x2'));var BPromise=require(_0xe33b('0x3'));var rp=require(_0xe33b('0x4'));var fs=require('fs');var path=require(_0xe33b('0x5'));var rimraf=require(_0xe33b('0x6'));var config=require(_0xe33b('0x7'));var attributes=require(_0xe33b('0x8'));module['exports']=function(_0x479e79,_0xc6f5f3){return _0x479e79[_0xe33b('0x9')](_0xe33b('0xa'),attributes,{'tableName':_0xe33b('0xb'),'paranoid':![],'indexes':[{'name':_0xe33b('0xc'),'fields':['idField',_0xe33b('0xd')],'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 d774e48..fdddcb7 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 _0xfd24=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x59a5d0,_0x4b3308){var _0x6840ac=function(_0x2dadf5){while(--_0x2dadf5){_0x59a5d0['push'](_0x59a5d0['shift']());}};_0x6840ac(++_0x4b3308);}(_0xfd24,0x148));var _0x4fd2=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xfd24[_0xd22d95];return _0x15d7a3;};'use strict';var _=require('lodash');var util=require(_0x4fd2('0x0'));var moment=require(_0x4fd2('0x1'));var BPromise=require(_0x4fd2('0x2'));var rs=require(_0x4fd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fd2('0x4'))['db'];var utils=require(_0x4fd2('0x5'));var logger=require('../../config/logger')(_0x4fd2('0x6'));var config=require(_0x4fd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4fd2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x480612,_0x273e63,_0x29772f){return new BPromise(function(_0xf2bdfd,_0x568577){return client[_0x4fd2('0x9')](_0x480612,_0x29772f)[_0x4fd2('0xa')](function(_0x57dd61){logger[_0x4fd2('0xb')](_0x4fd2('0xc'),_0x273e63,_0x4fd2('0xd'));logger[_0x4fd2('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x273e63,'request\x20sent',JSON['stringify'](_0x57dd61));if(_0x57dd61['error']){if(_0x57dd61[_0x4fd2('0xf')][_0x4fd2('0x10')]===0x1f4){logger[_0x4fd2('0xf')](_0x4fd2('0xc'),_0x273e63,_0x57dd61[_0x4fd2('0xf')][_0x4fd2('0x11')]);return _0x568577(_0x57dd61[_0x4fd2('0xf')][_0x4fd2('0x11')]);}logger['error'](_0x4fd2('0xc'),_0x273e63,_0x57dd61[_0x4fd2('0xf')][_0x4fd2('0x11')]);return _0xf2bdfd(_0x57dd61[_0x4fd2('0xf')][_0x4fd2('0x11')]);}else{logger[_0x4fd2('0xb')]('SalesforceField,\x20%s,\x20%s',_0x273e63,_0x4fd2('0xd'));_0xf2bdfd(_0x57dd61[_0x4fd2('0x12')][_0x4fd2('0x11')]);}})[_0x4fd2('0x13')](function(_0x59ad73){logger[_0x4fd2('0xf')]('SalesforceField,\x20%s,\x20%s',_0x273e63,_0x59ad73);_0x568577(_0x59ad73);});});} \ No newline at end of file +var _0x088e=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5d5ad9,_0x9fe65c){var _0x461f64=function(_0x97c064){while(--_0x97c064){_0x5d5ad9['push'](_0x5d5ad9['shift']());}};_0x461f64(++_0x9fe65c);}(_0x088e,0x1d3));var _0xe088=function(_0x2d5805,_0x21954e){_0x2d5805=_0x2d5805-0x0;var _0x1cae4f=_0x088e[_0x2d5805];return _0x1cae4f;};'use strict';var _=require(_0xe088('0x0'));var util=require(_0xe088('0x1'));var moment=require(_0xe088('0x2'));var BPromise=require('bluebird');var rs=require(_0xe088('0x3'));var fs=require('fs');var Redis=require(_0xe088('0x4'));var db=require(_0xe088('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe088('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe088('0x7'));var client=jayson['client'][_0xe088('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x568e6f,_0x1f1661,_0x603d3d){return new BPromise(function(_0x258e5c,_0x255fef){return client[_0xe088('0x9')](_0x568e6f,_0x603d3d)[_0xe088('0xa')](function(_0x4e4af4){logger[_0xe088('0xb')](_0xe088('0xc'),_0x1f1661,_0xe088('0xd'));logger[_0xe088('0xe')](_0xe088('0xf'),_0x1f1661,_0xe088('0xd'),JSON[_0xe088('0x10')](_0x4e4af4));if(_0x4e4af4['error']){if(_0x4e4af4['error'][_0xe088('0x11')]===0x1f4){logger[_0xe088('0x12')]('SalesforceField,\x20%s,\x20%s',_0x1f1661,_0x4e4af4[_0xe088('0x12')][_0xe088('0x13')]);return _0x255fef(_0x4e4af4[_0xe088('0x12')][_0xe088('0x13')]);}logger[_0xe088('0x12')](_0xe088('0xc'),_0x1f1661,_0x4e4af4['error']['message']);return _0x258e5c(_0x4e4af4[_0xe088('0x12')][_0xe088('0x13')]);}else{logger[_0xe088('0xb')](_0xe088('0xc'),_0x1f1661,'request\x20sent');_0x258e5c(_0x4e4af4['result'][_0xe088('0x13')]);}})[_0xe088('0x14')](function(_0x218a7d){logger[_0xe088('0x12')](_0xe088('0xc'),_0x1f1661,_0x218a7d);_0x255fef(_0x218a7d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6ae908f..29a77e8 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 _0x8bc8=['Router','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x277cbd,_0x2cd973){var _0x2231ec=function(_0x2a19a8){while(--_0x2a19a8){_0x277cbd['push'](_0x277cbd['shift']());}};_0x2231ec(++_0x2cd973);}(_0x8bc8,0xc4));var _0x88bc=function(_0x5e9590,_0x390b30){_0x5e9590=_0x5e9590-0x0;var _0x3d0ecd=_0x8bc8[_0x5e9590];return _0x3d0ecd;};'use strict';var multer=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var path=require(_0x88bc('0x2'));var timeout=require(_0x88bc('0x3'));var express=require('express');var router=express[_0x88bc('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(_0x88bc('0x5'));router['get']('/',auth[_0x88bc('0x6')](),controller['index']);router[_0x88bc('0x7')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x9')]);router[_0x88bc('0x7')]('/:id/configurations',auth[_0x88bc('0x6')](),controller[_0x88bc('0xa')]);router['get'](_0x88bc('0xb'),auth[_0x88bc('0x6')](),controller[_0x88bc('0xc')]);router[_0x88bc('0xd')]('/',auth[_0x88bc('0x6')](),controller[_0x88bc('0xe')]);router[_0x88bc('0xd')](_0x88bc('0xf'),auth[_0x88bc('0x6')](),controller['addConfiguration']);router[_0x88bc('0x10')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x88bc('0x12')]);module[_0x88bc('0x13')]=router; \ No newline at end of file +var _0x831c=['index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x831c,0x112));var _0xc831=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x831c[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xc831('0x0'));var util=require(_0xc831('0x1'));var path=require(_0xc831('0x2'));var timeout=require(_0xc831('0x3'));var express=require(_0xc831('0x4'));var router=express[_0xc831('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc831('0x6'));var interaction=require(_0xc831('0x7'));var config=require(_0xc831('0x8'));var controller=require(_0xc831('0x9'));router[_0xc831('0xa')]('/',auth[_0xc831('0xb')](),controller[_0xc831('0xc')]);router['get'](_0xc831('0xd'),auth[_0xc831('0xb')](),controller[_0xc831('0xe')]);router['get'](_0xc831('0xf'),auth[_0xc831('0xb')](),controller['getConfigurations']);router['get'](_0xc831('0x10'),auth[_0xc831('0xb')](),controller[_0xc831('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc831('0x12')]);router[_0xc831('0x13')](_0xc831('0xf'),auth['isAuthenticated'](),controller[_0xc831('0x14')]);router[_0xc831('0x15')](_0xc831('0xd'),auth[_0xc831('0xb')](),controller[_0xc831('0x16')]);router[_0xc831('0x17')](_0xc831('0xd'),auth[_0xc831('0xb')](),controller[_0xc831('0x18')]);module[_0xc831('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 3b2c48f..c4dce30 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 _0x78da=['STRING','remoteUri','sequelize','exports'];(function(_0x579de7,_0x16df8d){var _0x5351ee=function(_0x3e55d3){while(--_0x3e55d3){_0x579de7['push'](_0x579de7['shift']());}};_0x5351ee(++_0x16df8d);}(_0x78da,0x11a));var _0xa78d=function(_0x426bb4,_0x263bc4){_0x426bb4=_0x426bb4-0x0;var _0x4eeed4=_0x78da[_0x426bb4];return _0x4eeed4;};'use strict';var Sequelize=require(_0xa78d('0x0'));module[_0xa78d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa78d('0x2')]},'username':{'type':Sequelize[_0xa78d('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa78d('0x2')]},'email':{'type':Sequelize[_0xa78d('0x2')]},'remoteUri':{'type':Sequelize[_0xa78d('0x2')],'unique':_0xa78d('0x3')},'serverUrl':{'type':Sequelize[_0xa78d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7d79=['exports','STRING','username','remoteUri','sequelize'];(function(_0x45f4bd,_0x1f69c4){var _0x352abe=function(_0x5a53a0){while(--_0x5a53a0){_0x45f4bd['push'](_0x45f4bd['shift']());}};_0x352abe(++_0x1f69c4);}(_0x7d79,0xb3));var _0x97d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7d79[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x97d7('0x0'));module[_0x97d7('0x1')]={'name':{'type':Sequelize[_0x97d7('0x2')]},'description':{'type':Sequelize[_0x97d7('0x2')]},'username':{'type':Sequelize[_0x97d7('0x2')],'unique':_0x97d7('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x97d7('0x2')]},'remoteUri':{'type':Sequelize[_0x97d7('0x2')],'unique':_0x97d7('0x4')},'serverUrl':{'type':Sequelize[_0x97d7('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 5354d39..2a2b388 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 _0x3631=['merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','keys','ServicenowConfiguration','nolimit','addConfiguration','findOne','Subjects','channel','getDescriptions','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','calendar_stc','closed_at','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','opened_at','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','sys_id','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','error','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter'];(function(_0x211b68,_0x3d6148){var _0x42ed49=function(_0x2ce171){while(--_0x2ce171){_0x211b68['push'](_0x211b68['shift']());}};_0x42ed49(++_0x3d6148);}(_0x3631,0x121));var _0x1363=function(_0x5530a9,_0x48e4c2){_0x5530a9=_0x5530a9-0x0;var _0x1c69f4=_0x3631[_0x5530a9];return _0x1c69f4;};'use strict';var emlformat=require(_0x1363('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1363('0x1'));var jsonpatch=require(_0x1363('0x2'));var rp=require(_0x1363('0x3'));var moment=require('moment');var BPromise=require(_0x1363('0x4'));var Mustache=require(_0x1363('0x5'));var util=require('util');var path=require(_0x1363('0x6'));var sox=require(_0x1363('0x7'));var csv=require(_0x1363('0x8'));var ejs=require(_0x1363('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1363('0xa'));var squel=require('squel');var crypto=require(_0x1363('0xb'));var jsforce=require(_0x1363('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1363('0x8'));var querystring=require(_0x1363('0xd'));var Papa=require(_0x1363('0xe'));var Redis=require(_0x1363('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1363('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1363('0x11'))('api');var utils=require(_0x1363('0x12'));var config=require(_0x1363('0x13'));var licenseUtil=require(_0x1363('0x14'));var db=require(_0x1363('0x15'))['db'];var integrations=require(_0x1363('0x16'));function respondWithStatusCode(_0x397abc,_0x415366){_0x415366=_0x415366||0xcc;return function(_0x229b86){if(_0x229b86){return _0x397abc['sendStatus'](_0x415366);}return _0x397abc[_0x1363('0x17')](_0x415366)[_0x1363('0x18')]();};}function respondWithResult(_0x56d267,_0x48e83a){_0x48e83a=_0x48e83a||0xc8;return function(_0x361d70){if(_0x361d70){return _0x56d267[_0x1363('0x17')](_0x48e83a)[_0x1363('0x19')](_0x361d70);}};}function respondWithFilteredResult(_0x3d60df,_0x4bcb96){return function(_0x1a6984){if(_0x1a6984){var _0x16f168=typeof _0x4bcb96[_0x1363('0x1a')]===_0x1363('0x1b')&&typeof _0x4bcb96['limit']===_0x1363('0x1b');var _0x5dc04d=_0x1a6984[_0x1363('0x1c')];var _0x41b99b=_0x16f168?0x0:_0x4bcb96[_0x1363('0x1a')];var _0x23840b=_0x16f168?_0x1a6984[_0x1363('0x1c')]:_0x4bcb96['offset']+_0x4bcb96[_0x1363('0x1d')];var _0x4ea154;if(_0x23840b>=_0x5dc04d){_0x23840b=_0x5dc04d;_0x4ea154=0xc8;}else{_0x4ea154=0xce;}_0x3d60df['status'](_0x4ea154);return _0x3d60df[_0x1363('0x1e')](_0x1363('0x1f'),_0x41b99b+'-'+_0x23840b+'/'+_0x5dc04d)[_0x1363('0x19')](_0x1a6984);}return null;};}function patchUpdates(_0x34dd5e){return function(_0x22fd6e){try{jsonpatch[_0x1363('0x20')](_0x22fd6e,_0x34dd5e,!![]);}catch(_0x208cd5){return BPromise[_0x1363('0x21')](_0x208cd5);}return _0x22fd6e[_0x1363('0x22')]();};}function saveUpdates(_0x5185eb,_0x2cbf54){return function(_0x45de70){if(_0x45de70){return _0x45de70[_0x1363('0x23')](_0x5185eb)[_0x1363('0x24')](function(_0x19af82){return _0x19af82;});}return null;};}function removeEntity(_0x679b53,_0x3d967c){return function(_0x28a9af){if(_0x28a9af){return _0x28a9af[_0x1363('0x25')]()[_0x1363('0x24')](function(){_0x679b53[_0x1363('0x17')](0xcc)[_0x1363('0x18')]();});}};}function handleEntityNotFound(_0x802abe,_0xeda736){return function(_0x11072a){if(!_0x11072a){_0x802abe[_0x1363('0x26')](0x194);}return _0x11072a;};}function handleError(_0x111120,_0x42d4d6){_0x42d4d6=_0x42d4d6||0x1f4;return function(_0x5173e8){logger['error'](_0x5173e8[_0x1363('0x27')]);if(_0x5173e8[_0x1363('0x28')]){delete _0x5173e8[_0x1363('0x28')];}_0x111120['status'](_0x42d4d6)[_0x1363('0x29')](_0x5173e8);};}exports['index']=function(_0x469a82,_0x56d3a8){var _0x588409={},_0x58b420={},_0x351905={'count':0x0,'rows':[]};var _0x1b6895=_[_0x1363('0x2a')](db[_0x1363('0x2b')][_0x1363('0x2c')],function(_0xeb45fa){return{'name':_0xeb45fa[_0x1363('0x2d')],'type':_0xeb45fa[_0x1363('0x2e')][_0x1363('0x2f')]};});_0x58b420[_0x1363('0x30')]=_[_0x1363('0x2a')](_0x1b6895,'name');_0x58b420[_0x1363('0x31')]=_['keys'](_0x469a82[_0x1363('0x31')]);_0x58b420['filters']=_[_0x1363('0x32')](_0x58b420[_0x1363('0x30')],_0x58b420[_0x1363('0x31')]);_0x588409[_0x1363('0x33')]=_[_0x1363('0x32')](_0x58b420[_0x1363('0x30')],qs[_0x1363('0x34')](_0x469a82[_0x1363('0x31')]['fields']));_0x588409[_0x1363('0x33')]=_0x588409[_0x1363('0x33')][_0x1363('0x35')]?_0x588409['attributes']:_0x58b420['model'];if(!_0x469a82[_0x1363('0x31')][_0x1363('0x36')]('nolimit')){_0x588409[_0x1363('0x1d')]=qs[_0x1363('0x1d')](_0x469a82[_0x1363('0x31')][_0x1363('0x1d')]);_0x588409['offset']=qs['offset'](_0x469a82[_0x1363('0x31')][_0x1363('0x1a')]);}_0x588409[_0x1363('0x37')]=qs['sort'](_0x469a82[_0x1363('0x31')][_0x1363('0x38')]);_0x588409[_0x1363('0x39')]=qs[_0x1363('0x3a')](_[_0x1363('0x3b')](_0x469a82[_0x1363('0x31')],_0x58b420[_0x1363('0x3a')]),_0x1b6895);if(_0x469a82[_0x1363('0x31')][_0x1363('0x3c')]){_0x588409[_0x1363('0x39')]=_['merge'](_0x588409[_0x1363('0x39')],{'$or':_[_0x1363('0x2a')](_0x1b6895,function(_0x3e3b46){if(_0x3e3b46[_0x1363('0x2e')]!=='VIRTUAL'){var _0x525d0f={};_0x525d0f[_0x3e3b46[_0x1363('0x28')]]={'$like':'%'+_0x469a82['query']['filter']+'%'};return _0x525d0f;}})});}_0x588409=_[_0x1363('0x3d')]({},_0x588409,_0x469a82[_0x1363('0x3e')]);var _0x421c51={'where':_0x588409[_0x1363('0x39')]};return db[_0x1363('0x2b')][_0x1363('0x1c')](_0x421c51)[_0x1363('0x24')](function(_0x40b1b1){_0x351905[_0x1363('0x1c')]=_0x40b1b1;if(_0x469a82[_0x1363('0x31')][_0x1363('0x3f')]){_0x588409[_0x1363('0x40')]=[{'all':!![]}];}return db[_0x1363('0x2b')][_0x1363('0x41')](_0x588409);})[_0x1363('0x24')](function(_0x6f0cc4){_0x351905[_0x1363('0x42')]=_0x6f0cc4;return _0x351905;})[_0x1363('0x24')](respondWithFilteredResult(_0x56d3a8,_0x588409))[_0x1363('0x43')](handleError(_0x56d3a8,null));};exports['show']=function(_0x41abdc,_0x31de07){var _0x419d45={'raw':![],'where':{'id':_0x41abdc[_0x1363('0x44')]['id']}},_0x2e857c={};_0x2e857c['model']=_['keys'](db['ServicenowAccount'][_0x1363('0x2c')]);_0x2e857c[_0x1363('0x31')]=_['keys'](_0x41abdc['query']);_0x2e857c['filters']=_[_0x1363('0x32')](_0x2e857c[_0x1363('0x30')],_0x2e857c[_0x1363('0x31')]);_0x419d45[_0x1363('0x33')]=_['intersection'](_0x2e857c[_0x1363('0x30')],qs[_0x1363('0x34')](_0x41abdc['query'][_0x1363('0x34')]));_0x419d45[_0x1363('0x33')]=_0x419d45['attributes'][_0x1363('0x35')]?_0x419d45[_0x1363('0x33')]:_0x2e857c[_0x1363('0x30')];if(_0x41abdc[_0x1363('0x31')]['includeAll']){_0x419d45['include']=[{'all':!![]}];}_0x419d45=_[_0x1363('0x3d')]({},_0x419d45,_0x41abdc[_0x1363('0x3e')]);return db['ServicenowAccount'][_0x1363('0x45')](_0x419d45)[_0x1363('0x24')](handleEntityNotFound(_0x31de07,null))['then'](respondWithResult(_0x31de07,null))['catch'](handleError(_0x31de07,null));};exports[_0x1363('0x46')]=function(_0x3ed733,_0x34a66a){return db[_0x1363('0x2b')]['create'](_0x3ed733[_0x1363('0x47')],{})[_0x1363('0x24')](respondWithResult(_0x34a66a,0xc9))[_0x1363('0x43')](handleError(_0x34a66a,null));};exports['update']=function(_0x2ba166,_0x5cad31){if(_0x2ba166[_0x1363('0x47')]['id']){delete _0x2ba166['body']['id'];}return db['ServicenowAccount'][_0x1363('0x45')]({'where':{'id':_0x2ba166[_0x1363('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cad31,null))[_0x1363('0x24')](saveUpdates(_0x2ba166['body'],null))[_0x1363('0x24')](respondWithResult(_0x5cad31,null))[_0x1363('0x43')](handleError(_0x5cad31,null));};exports['destroy']=function(_0x1e29bc,_0x17f03d){return db['ServicenowAccount']['find']({'where':{'id':_0x1e29bc[_0x1363('0x44')]['id']}})[_0x1363('0x24')](handleEntityNotFound(_0x17f03d,null))[_0x1363('0x24')](removeEntity(_0x17f03d,null))['catch'](handleError(_0x17f03d,null));};exports[_0x1363('0x48')]=function(_0x1bf65a,_0x1eb8f6,_0x4c3334){var _0x46dff2={};var _0x4169d6={};var _0x28ac3f;var _0x5429fe;return db[_0x1363('0x2b')]['findOne']({'where':{'id':_0x1bf65a[_0x1363('0x44')]['id']}})[_0x1363('0x24')](handleEntityNotFound(_0x1eb8f6,null))[_0x1363('0x24')](function(_0x54b5c6){if(_0x54b5c6){_0x28ac3f=_0x54b5c6;_0x4169d6[_0x1363('0x30')]=_[_0x1363('0x49')](db[_0x1363('0x4a')]['rawAttributes']);_0x4169d6[_0x1363('0x31')]=_[_0x1363('0x49')](_0x1bf65a[_0x1363('0x31')]);_0x4169d6[_0x1363('0x3a')]=_[_0x1363('0x32')](_0x4169d6['model'],_0x4169d6['query']);_0x46dff2[_0x1363('0x33')]=_[_0x1363('0x32')](_0x4169d6[_0x1363('0x30')],qs['fields'](_0x1bf65a[_0x1363('0x31')]['fields']));_0x46dff2[_0x1363('0x33')]=_0x46dff2['attributes'][_0x1363('0x35')]?_0x46dff2['attributes']:_0x4169d6[_0x1363('0x30')];_0x46dff2[_0x1363('0x37')]=qs[_0x1363('0x38')](_0x1bf65a[_0x1363('0x31')][_0x1363('0x38')]);_0x46dff2[_0x1363('0x39')]=qs[_0x1363('0x3a')](_['pick'](_0x1bf65a[_0x1363('0x31')],_0x4169d6[_0x1363('0x3a')]));if(_0x1bf65a[_0x1363('0x31')]['filter']){_0x46dff2[_0x1363('0x39')]=_[_0x1363('0x3d')](_0x46dff2[_0x1363('0x39')],{'$or':_['map'](_0x46dff2['attributes'],function(_0x3cc709){var _0x4a1230={};_0x4a1230[_0x3cc709]={'$like':'%'+_0x1bf65a[_0x1363('0x31')][_0x1363('0x3c')]+'%'};return _0x4a1230;})});}_0x46dff2=_['merge']({},_0x46dff2,_0x1bf65a['options']);return _0x28ac3f[_0x1363('0x48')](_0x46dff2);}})[_0x1363('0x24')](function(_0x3c7fe0){if(_0x3c7fe0){_0x5429fe=_0x3c7fe0[_0x1363('0x35')];if(!_0x1bf65a[_0x1363('0x31')][_0x1363('0x36')](_0x1363('0x4b'))){_0x46dff2['limit']=qs[_0x1363('0x1d')](_0x1bf65a[_0x1363('0x31')][_0x1363('0x1d')]);_0x46dff2[_0x1363('0x1a')]=qs[_0x1363('0x1a')](_0x1bf65a[_0x1363('0x31')]['offset']);}return _0x28ac3f['getConfigurations'](_0x46dff2);}})[_0x1363('0x24')](function(_0x5a632d){if(_0x5a632d){return _0x5a632d?{'count':_0x5429fe,'rows':_0x5a632d}:null;}})['then'](respondWithResult(_0x1eb8f6,null))['catch'](handleError(_0x1eb8f6,null));};exports[_0x1363('0x4c')]=function(_0x170dfb,_0x59924a,_0x5ed1eb){if(_0x170dfb[_0x1363('0x47')]['id']){delete _0x170dfb['body']['id'];}return db['ServicenowAccount'][_0x1363('0x4d')]({'where':{'id':_0x170dfb[_0x1363('0x44')]['id']}})['then'](handleEntityNotFound(_0x59924a,null))[_0x1363('0x24')](function(_0x2ba1cc){if(_0x2ba1cc){_0x170dfb['body']['AccountId']=_0x2ba1cc['id'];_0x170dfb['body'][_0x1363('0x4e')]=integrations['getSubjects'](_0x170dfb[_0x1363('0x47')][_0x1363('0x4f')],_0x170dfb[_0x1363('0x47')][_0x1363('0x2e')]);_0x170dfb['body']['Descriptions']=integrations[_0x1363('0x50')](_0x170dfb['body'][_0x1363('0x4f')],_0x170dfb[_0x1363('0x47')][_0x1363('0x2e')]);return db[_0x1363('0x4a')][_0x1363('0x46')](_0x170dfb[_0x1363('0x47')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x1363('0x24')](respondWithResult(_0x59924a,null))[_0x1363('0x43')](handleError(_0x59924a,null));};exports[_0x1363('0x51')]=function(_0x211cb4,_0x589b23,_0x58b4de){var _0x2ce2ac=[_0x1363('0x52'),_0x1363('0x53'),'knowledge',_0x1363('0x54'),_0x1363('0x55'),'notify',_0x1363('0x56'),_0x1363('0x57'),_0x1363('0x58')];var _0x14b170=[_0x1363('0x59'),_0x1363('0x52'),_0x1363('0x5a'),_0x1363('0x5b'),_0x1363('0x5c'),'sys_updated_on','child_incidents','hold_reason',_0x1363('0x5d'),_0x1363('0x5e'),_0x1363('0x5f'),_0x1363('0x60'),_0x1363('0x61'),_0x1363('0x62'),_0x1363('0x63'),'sys_domain','state','sys_created_by','knowledge',_0x1363('0x37'),_0x1363('0x64'),_0x1363('0x65'),'cmdb_ci','delivery_plan',_0x1363('0x66'),'active',_0x1363('0x67'),_0x1363('0x68'),_0x1363('0x69'),_0x1363('0x6a'),_0x1363('0x6b'),'time_worked','expected_start',_0x1363('0x6c'),'business_duration','group_list',_0x1363('0x6d'),_0x1363('0x6e'),_0x1363('0x6f'),_0x1363('0x70'),'approval_set',_0x1363('0x54'),_0x1363('0x71'),_0x1363('0x72'),_0x1363('0x55'),_0x1363('0x73'),_0x1363('0x74'),_0x1363('0x75'),'assignment_group',_0x1363('0x76'),_0x1363('0x77'),_0x1363('0x78'),_0x1363('0x79'),'notify','sys_class_name',_0x1363('0x7a'),_0x1363('0x7b'),'follow_up',_0x1363('0x7c'),_0x1363('0x7d'),'contact_type','reopened_by','incident_state',_0x1363('0x7e'),_0x1363('0x7f'),_0x1363('0x80'),_0x1363('0x81'),'activity_due',_0x1363('0x82'),_0x1363('0x57'),_0x1363('0x83'),_0x1363('0x84'),_0x1363('0x85'),_0x1363('0x86'),'due_date',_0x1363('0x87'),_0x1363('0x88'),'sys_tags',_0x1363('0x89'),_0x1363('0x8a'),_0x1363('0x8b'),'location',_0x1363('0x58')];var _0x3de90a='';var _0x571549='';var _0x5f5d00=[];var _0x26883d='';var _0x2c581e='';var _0x22482f=[];var _0x599fc0='';var _0x286e68='';var _0x48708d={};var _0x41633c='';return db[_0x1363('0x2b')]['findOne']({'where':{'id':_0x211cb4[_0x1363('0x44')]['id']},'attributes':['id',_0x1363('0x8c'),_0x1363('0x8d'),_0x1363('0x8e'),_0x1363('0x8f'),_0x1363('0x90')]})[_0x1363('0x24')](handleEntityNotFound(_0x589b23,null))['then'](function(_0x320a7e){if(_0x320a7e){_0x41633c=_0x320a7e['remoteUri'];var _0x12cb50=_0x41633c['slice'](-0x1);if(_0x12cb50==='/'){_0x41633c=_0x41633c[_0x1363('0x91')](0x0,_0x41633c[_0x1363('0x92')](_0x12cb50));}_0x286e68=util[_0x1363('0x93')]('%s/api/now/doc/table/schema/',_0x41633c);_0x599fc0=util['format'](_0x1363('0x94'),_0x41633c);_0x48708d={'user':_0x320a7e['username'],'pass':_0x320a7e[_0x1363('0x8d')]};var _0x1d1764={'method':_0x1363('0x95'),'uri':_0x286e68+_0x1363('0x96'),'auth':_0x48708d,'json':!![]};return rp(_0x1d1764);}})[_0x1363('0x24')](function(_0x2a252c){if(_0x2a252c[_0x1363('0x97')][_0x1363('0x35')]>0x0){_0x3de90a=_0x2a252c[_0x1363('0x97')];}console[_0x1363('0x98')](_0x1363('0x99'),_0x3de90a);_0x22482f=[];_0x571549=Object[_0x1363('0x9a')]([],_0x3de90a);_[_0x1363('0x9b')](_0x571549,function(_0x708528){return!_0x2ce2ac[_0x1363('0x9c')](_0x708528[_0x1363('0x28')]);});_0x571549[_0x1363('0x9d')](function(_0x5bcadd){var _0x3b7426=createFieldObject(_0x599fc0,_0x48708d,_0x5bcadd[_0x1363('0x9e')],_0x5bcadd[_0x1363('0x28')],_0x5bcadd['label'],![]);_0x22482f[_0x1363('0x9f')](_0x3b7426);});return Promise[_0x1363('0xa0')](_0x22482f);})[_0x1363('0x24')](function(_0x77cf6c){_0x5f5d00=_0x77cf6c;_0x26883d=Object[_0x1363('0x9a')]([],_0x3de90a);console[_0x1363('0x98')](_0x1363('0xa1'),_0x3de90a);_[_0x1363('0x9b')](_0x26883d,function(_0x528e91){return _0x14b170['includes'](_0x528e91[_0x1363('0x28')]);});console[_0x1363('0x98')](_0x1363('0xa2'),_0x26883d);_0x22482f=[];_0x26883d[_0x1363('0x9d')](function(_0x4756a6){var _0x6385a7=createFieldObject(_0x599fc0,_0x48708d,_0x4756a6[_0x1363('0x9e')],_0x4756a6['name'],_0x4756a6['label'],!![]);_0x22482f[_0x1363('0x9f')](_0x6385a7);});return Promise[_0x1363('0xa0')](_0x22482f);})[_0x1363('0x24')](function(_0x4a70f3){_0x2c581e=_0x4a70f3;var _0x4ee7fc=_0x5f5d00[_0x1363('0xa3')](_0x2c581e);return{'count':_0x4ee7fc['length'],'rows':_0x4ee7fc};})[_0x1363('0x24')](respondWithResult(_0x589b23,null))[_0x1363('0x43')](function(_0x58f78b){console['log'](_0x1363('0xa4')+_0x58f78b);var _0xfb1959=_0x211cb4[_0x1363('0x31')][_0x1363('0xa5')]?0x1f4:_0x58f78b['statusCode']||0x1f4;logger[_0x1363('0xa6')](_0x58f78b[_0x1363('0x27')]);delete _0x58f78b[_0x1363('0x28')];if(_0xfb1959===0x191){_0xfb1959=0x190;}_0x589b23[_0x1363('0x17')](_0xfb1959)[_0x1363('0x29')](_0x211cb4[_0x1363('0x31')][_0x1363('0xa5')]?{'message':_0x1363('0xa7'),'statusCode':_0x58f78b['statusCode']}:_0x58f78b);});};function createFieldObject(_0x384a04,_0xc163f6,_0x49e4d7,_0x1350dc,_0x423216,_0x9a58b7){return new Promise(function(_0x4f6dd1,_0x675ca9){var _0x9af933={'id':_0x1350dc,'name':_0x423216,'custom':_0x9a58b7};if(_0x49e4d7==='boolean'){_0x9af933[_0x1363('0x3e')]=[{'name':_0x1363('0xa8'),'value':_0x1363('0xa9')},{'name':_0x1363('0xaa'),'value':_0x1363('0xab')}];_0x4f6dd1(_0x9af933);}else{var _0x142a74={'method':'GET','uri':_0x384a04+_0x1363('0xac')+_0x1350dc,'auth':_0xc163f6,'json':!![]};return rp(_0x142a74)[_0x1363('0x24')](function(_0x5550e3){var _0x37c603=[];if(_0x5550e3[_0x1363('0x97')][_0x1363('0x35')]>0x0){_0x5550e3[_0x1363('0x97')][_0x1363('0x9d')](function(_0x37d4e6){if(_0x37d4e6[_0x1363('0xad')]==='false'){var _0x188cf9={'name':_0x37d4e6['label'],'value':_0x37d4e6[_0x1363('0xae')]};_0x37c603['push'](_0x188cf9);}});}_0x9af933[_0x1363('0x3e')]=_0x37c603;if(_0x9af933[_0x1363('0x3e')][_0x1363('0x35')]>0x0){_0x4f6dd1(_0x9af933);}else{if(_0x9a58b7==![]){_0x4f6dd1();}else{_0x4f6dd1(_0x9af933);}}});}});} \ No newline at end of file +var _0xb4b8=['work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','reopen_count','sys_tags','escalation','correlation_id','location','username','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','password','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','push','concat','ServiceNow\x20error:\x20','test','statusCode','send','options','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','ServicenowAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getConfigurations','findOne','ServicenowConfiguration','length','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','close_code','notify','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task'];(function(_0x4f433e,_0x16bac7){var _0x46c877=function(_0x3b8577){while(--_0x3b8577){_0x4f433e['push'](_0x4f433e['shift']());}};_0x46c877(++_0x16bac7);}(_0xb4b8,0xed));var _0x8b4b=function(_0x55ea34,_0x1afb20){_0x55ea34=_0x55ea34-0x0;var _0x4ff604=_0xb4b8[_0x55ea34];return _0x4ff604;};'use strict';var emlformat=require(_0x8b4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b4b('0x2'));var moment=require('moment');var BPromise=require(_0x8b4b('0x3'));var Mustache=require(_0x8b4b('0x4'));var util=require('util');var path=require(_0x8b4b('0x5'));var sox=require(_0x8b4b('0x6'));var csv=require(_0x8b4b('0x7'));var ejs=require(_0x8b4b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b4b('0x9'));var squel=require('squel');var crypto=require(_0x8b4b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8b4b('0xb'));var toCsv=require(_0x8b4b('0x7'));var querystring=require(_0x8b4b('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b4b('0xd'));var qs=require(_0x8b4b('0xe'));var as=require(_0x8b4b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8b4b('0x10'));var utils=require(_0x8b4b('0x11'));var config=require(_0x8b4b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b4b('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x50b61e,_0x10b5e0){_0x10b5e0=_0x10b5e0||0xcc;return function(_0x42fb93){if(_0x42fb93){return _0x50b61e[_0x8b4b('0x14')](_0x10b5e0);}return _0x50b61e[_0x8b4b('0x15')](_0x10b5e0)[_0x8b4b('0x16')]();};}function respondWithResult(_0x39b9c,_0x29073f){_0x29073f=_0x29073f||0xc8;return function(_0x10a96d){if(_0x10a96d){return _0x39b9c['status'](_0x29073f)[_0x8b4b('0x17')](_0x10a96d);}};}function respondWithFilteredResult(_0x361cf8,_0x36e949){return function(_0x5c3010){if(_0x5c3010){var _0x1dff78=typeof _0x36e949[_0x8b4b('0x18')]===_0x8b4b('0x19')&&typeof _0x36e949['limit']==='undefined';var _0x366e29=_0x5c3010[_0x8b4b('0x1a')];var _0x58e108=_0x1dff78?0x0:_0x36e949[_0x8b4b('0x18')];var _0x5686d0=_0x1dff78?_0x5c3010[_0x8b4b('0x1a')]:_0x36e949[_0x8b4b('0x18')]+_0x36e949[_0x8b4b('0x1b')];var _0x503748;if(_0x5686d0>=_0x366e29){_0x5686d0=_0x366e29;_0x503748=0xc8;}else{_0x503748=0xce;}_0x361cf8[_0x8b4b('0x15')](_0x503748);return _0x361cf8[_0x8b4b('0x1c')](_0x8b4b('0x1d'),_0x58e108+'-'+_0x5686d0+'/'+_0x366e29)[_0x8b4b('0x17')](_0x5c3010);}return null;};}function patchUpdates(_0x1eed89){return function(_0x2be9b1){try{jsonpatch[_0x8b4b('0x1e')](_0x2be9b1,_0x1eed89,!![]);}catch(_0x2454db){return BPromise[_0x8b4b('0x1f')](_0x2454db);}return _0x2be9b1[_0x8b4b('0x20')]();};}function saveUpdates(_0x5d3580,_0x4bd728){return function(_0x2dd301){if(_0x2dd301){return _0x2dd301['update'](_0x5d3580)['then'](function(_0x9e7764){return _0x9e7764;});}return null;};}function removeEntity(_0x427e79,_0x2be5f5){return function(_0xe36aee){if(_0xe36aee){return _0xe36aee[_0x8b4b('0x21')]()[_0x8b4b('0x22')](function(){_0x427e79['status'](0xcc)[_0x8b4b('0x16')]();});}};}function handleEntityNotFound(_0x572c05,_0x53c814){return function(_0x8df076){if(!_0x8df076){_0x572c05[_0x8b4b('0x14')](0x194);}return _0x8df076;};}function handleError(_0x7e17e,_0x3b424b){_0x3b424b=_0x3b424b||0x1f4;return function(_0x2417b1){logger[_0x8b4b('0x23')](_0x2417b1[_0x8b4b('0x24')]);if(_0x2417b1[_0x8b4b('0x25')]){delete _0x2417b1[_0x8b4b('0x25')];}_0x7e17e[_0x8b4b('0x15')](_0x3b424b)['send'](_0x2417b1);};}exports[_0x8b4b('0x26')]=function(_0x1c1495,_0x219974){var _0x5f213b={},_0x2a96de={},_0x3ce646={'count':0x0,'rows':[]};var _0x101516=_['map'](db[_0x8b4b('0x27')]['rawAttributes'],function(_0x376e2c){return{'name':_0x376e2c[_0x8b4b('0x28')],'type':_0x376e2c[_0x8b4b('0x29')][_0x8b4b('0x2a')]};});_0x2a96de[_0x8b4b('0x2b')]=_[_0x8b4b('0x2c')](_0x101516,_0x8b4b('0x25'));_0x2a96de[_0x8b4b('0x2d')]=_[_0x8b4b('0x2e')](_0x1c1495['query']);_0x2a96de[_0x8b4b('0x2f')]=_[_0x8b4b('0x30')](_0x2a96de[_0x8b4b('0x2b')],_0x2a96de[_0x8b4b('0x2d')]);_0x5f213b[_0x8b4b('0x31')]=_[_0x8b4b('0x30')](_0x2a96de[_0x8b4b('0x2b')],qs[_0x8b4b('0x32')](_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x32')]));_0x5f213b[_0x8b4b('0x31')]=_0x5f213b[_0x8b4b('0x31')]['length']?_0x5f213b[_0x8b4b('0x31')]:_0x2a96de[_0x8b4b('0x2b')];if(!_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x33')](_0x8b4b('0x34'))){_0x5f213b[_0x8b4b('0x1b')]=qs[_0x8b4b('0x1b')](_0x1c1495['query'][_0x8b4b('0x1b')]);_0x5f213b[_0x8b4b('0x18')]=qs[_0x8b4b('0x18')](_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x18')]);}_0x5f213b[_0x8b4b('0x35')]=qs[_0x8b4b('0x36')](_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x36')]);_0x5f213b[_0x8b4b('0x37')]=qs[_0x8b4b('0x2f')](_['pick'](_0x1c1495[_0x8b4b('0x2d')],_0x2a96de[_0x8b4b('0x2f')]),_0x101516);if(_0x1c1495['query'][_0x8b4b('0x38')]){_0x5f213b[_0x8b4b('0x37')]=_[_0x8b4b('0x39')](_0x5f213b[_0x8b4b('0x37')],{'$or':_[_0x8b4b('0x2c')](_0x101516,function(_0x19e0f8){if(_0x19e0f8['type']!==_0x8b4b('0x3a')){var _0x4d62d5={};_0x4d62d5[_0x19e0f8[_0x8b4b('0x25')]]={'$like':'%'+_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x38')]+'%'};return _0x4d62d5;}})});}_0x5f213b=_[_0x8b4b('0x39')]({},_0x5f213b,_0x1c1495['options']);var _0x28c61e={'where':_0x5f213b[_0x8b4b('0x37')]};return db[_0x8b4b('0x27')][_0x8b4b('0x1a')](_0x28c61e)[_0x8b4b('0x22')](function(_0x50d681){_0x3ce646[_0x8b4b('0x1a')]=_0x50d681;if(_0x1c1495[_0x8b4b('0x2d')][_0x8b4b('0x3b')]){_0x5f213b[_0x8b4b('0x3c')]=[{'all':!![]}];}return db[_0x8b4b('0x27')][_0x8b4b('0x3d')](_0x5f213b);})[_0x8b4b('0x22')](function(_0x1941bb){_0x3ce646[_0x8b4b('0x3e')]=_0x1941bb;return _0x3ce646;})[_0x8b4b('0x22')](respondWithFilteredResult(_0x219974,_0x5f213b))[_0x8b4b('0x3f')](handleError(_0x219974,null));};exports[_0x8b4b('0x40')]=function(_0x2fbce3,_0x5c3e06){var _0x36eeed={'raw':![],'where':{'id':_0x2fbce3[_0x8b4b('0x41')]['id']}},_0x1a4936={};_0x1a4936[_0x8b4b('0x2b')]=_[_0x8b4b('0x2e')](db[_0x8b4b('0x27')][_0x8b4b('0x42')]);_0x1a4936[_0x8b4b('0x2d')]=_[_0x8b4b('0x2e')](_0x2fbce3[_0x8b4b('0x2d')]);_0x1a4936['filters']=_[_0x8b4b('0x30')](_0x1a4936[_0x8b4b('0x2b')],_0x1a4936[_0x8b4b('0x2d')]);_0x36eeed[_0x8b4b('0x31')]=_['intersection'](_0x1a4936[_0x8b4b('0x2b')],qs['fields'](_0x2fbce3[_0x8b4b('0x2d')]['fields']));_0x36eeed[_0x8b4b('0x31')]=_0x36eeed[_0x8b4b('0x31')]['length']?_0x36eeed['attributes']:_0x1a4936[_0x8b4b('0x2b')];if(_0x2fbce3['query']['includeAll']){_0x36eeed['include']=[{'all':!![]}];}_0x36eeed=_[_0x8b4b('0x39')]({},_0x36eeed,_0x2fbce3['options']);return db[_0x8b4b('0x27')][_0x8b4b('0x43')](_0x36eeed)['then'](handleEntityNotFound(_0x5c3e06,null))['then'](respondWithResult(_0x5c3e06,null))[_0x8b4b('0x3f')](handleError(_0x5c3e06,null));};exports[_0x8b4b('0x44')]=function(_0x3302ec,_0x37b511){return db[_0x8b4b('0x27')]['create'](_0x3302ec['body'],{})[_0x8b4b('0x22')](respondWithResult(_0x37b511,0xc9))[_0x8b4b('0x3f')](handleError(_0x37b511,null));};exports[_0x8b4b('0x45')]=function(_0x36c413,_0x24e6a6){if(_0x36c413[_0x8b4b('0x46')]['id']){delete _0x36c413['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x36c413[_0x8b4b('0x41')]['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x24e6a6,null))[_0x8b4b('0x22')](saveUpdates(_0x36c413[_0x8b4b('0x46')],null))[_0x8b4b('0x22')](respondWithResult(_0x24e6a6,null))[_0x8b4b('0x3f')](handleError(_0x24e6a6,null));};exports['destroy']=function(_0x1aab90,_0x2cd0d8){return db['ServicenowAccount'][_0x8b4b('0x43')]({'where':{'id':_0x1aab90['params']['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x2cd0d8,null))[_0x8b4b('0x22')](removeEntity(_0x2cd0d8,null))[_0x8b4b('0x3f')](handleError(_0x2cd0d8,null));};exports[_0x8b4b('0x47')]=function(_0x2a4301,_0x3260bd,_0x366c16){var _0x4a4ae5={};var _0x34ca26={};var _0x53336b;var _0x10702f;return db[_0x8b4b('0x27')][_0x8b4b('0x48')]({'where':{'id':_0x2a4301[_0x8b4b('0x41')]['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x3260bd,null))['then'](function(_0x4bbfa9){if(_0x4bbfa9){_0x53336b=_0x4bbfa9;_0x34ca26['model']=_[_0x8b4b('0x2e')](db[_0x8b4b('0x49')][_0x8b4b('0x42')]);_0x34ca26[_0x8b4b('0x2d')]=_[_0x8b4b('0x2e')](_0x2a4301[_0x8b4b('0x2d')]);_0x34ca26[_0x8b4b('0x2f')]=_[_0x8b4b('0x30')](_0x34ca26[_0x8b4b('0x2b')],_0x34ca26[_0x8b4b('0x2d')]);_0x4a4ae5['attributes']=_[_0x8b4b('0x30')](_0x34ca26[_0x8b4b('0x2b')],qs[_0x8b4b('0x32')](_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x32')]));_0x4a4ae5['attributes']=_0x4a4ae5['attributes'][_0x8b4b('0x4a')]?_0x4a4ae5['attributes']:_0x34ca26[_0x8b4b('0x2b')];_0x4a4ae5[_0x8b4b('0x35')]=qs[_0x8b4b('0x36')](_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x36')]);_0x4a4ae5['where']=qs[_0x8b4b('0x2f')](_[_0x8b4b('0x4b')](_0x2a4301[_0x8b4b('0x2d')],_0x34ca26['filters']));if(_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x38')]){_0x4a4ae5[_0x8b4b('0x37')]=_[_0x8b4b('0x39')](_0x4a4ae5['where'],{'$or':_['map'](_0x4a4ae5['attributes'],function(_0x540801){var _0x3f25a3={};_0x3f25a3[_0x540801]={'$like':'%'+_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x38')]+'%'};return _0x3f25a3;})});}_0x4a4ae5=_[_0x8b4b('0x39')]({},_0x4a4ae5,_0x2a4301['options']);return _0x53336b[_0x8b4b('0x47')](_0x4a4ae5);}})[_0x8b4b('0x22')](function(_0x30eaf9){if(_0x30eaf9){_0x10702f=_0x30eaf9[_0x8b4b('0x4a')];if(!_0x2a4301['query']['hasOwnProperty'](_0x8b4b('0x34'))){_0x4a4ae5['limit']=qs['limit'](_0x2a4301[_0x8b4b('0x2d')][_0x8b4b('0x1b')]);_0x4a4ae5['offset']=qs[_0x8b4b('0x18')](_0x2a4301['query'][_0x8b4b('0x18')]);}return _0x53336b[_0x8b4b('0x47')](_0x4a4ae5);}})[_0x8b4b('0x22')](function(_0x3210af){if(_0x3210af){return _0x3210af?{'count':_0x10702f,'rows':_0x3210af}:null;}})[_0x8b4b('0x22')](respondWithResult(_0x3260bd,null))['catch'](handleError(_0x3260bd,null));};exports[_0x8b4b('0x4c')]=function(_0x36982a,_0x536619,_0x1f5dfd){if(_0x36982a['body']['id']){delete _0x36982a['body']['id'];}return db[_0x8b4b('0x27')][_0x8b4b('0x48')]({'where':{'id':_0x36982a['params']['id']}})[_0x8b4b('0x22')](handleEntityNotFound(_0x536619,null))['then'](function(_0x21088f){if(_0x21088f){_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x4d')]=_0x21088f['id'];_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x4e')]=integrations[_0x8b4b('0x4f')](_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x50')],_0x36982a['body'][_0x8b4b('0x29')]);_0x36982a['body']['Descriptions']=integrations['getDescriptions'](_0x36982a['body']['channel'],_0x36982a[_0x8b4b('0x46')][_0x8b4b('0x29')]);return db[_0x8b4b('0x49')][_0x8b4b('0x44')](_0x36982a['body'],{'include':[{'model':db['ServicenowField'],'as':_0x8b4b('0x4e')},{'model':db[_0x8b4b('0x51')],'as':_0x8b4b('0x52')}]});}return null;})[_0x8b4b('0x22')](respondWithResult(_0x536619,null))[_0x8b4b('0x3f')](handleError(_0x536619,null));};exports['getFields']=function(_0x12f285,_0x4bb3ee,_0x433d03){var _0x2a186c=[_0x8b4b('0x53'),_0x8b4b('0x54'),_0x8b4b('0x55'),'subcategory',_0x8b4b('0x56'),_0x8b4b('0x57'),'incident_state',_0x8b4b('0x58'),'category'];var _0x314d38=[_0x8b4b('0x59'),'made_sla',_0x8b4b('0x5a'),'watch_list',_0x8b4b('0x5b'),_0x8b4b('0x5c'),_0x8b4b('0x5d'),_0x8b4b('0x54'),_0x8b4b('0x5e'),'number',_0x8b4b('0x5f'),_0x8b4b('0x60'),_0x8b4b('0x61'),'user_input',_0x8b4b('0x62'),_0x8b4b('0x63'),'state',_0x8b4b('0x64'),_0x8b4b('0x55'),_0x8b4b('0x35'),_0x8b4b('0x65'),_0x8b4b('0x66'),_0x8b4b('0x67'),_0x8b4b('0x68'),_0x8b4b('0x69'),_0x8b4b('0x6a'),'work_notes_list',_0x8b4b('0x6b'),'priority',_0x8b4b('0x6c'),_0x8b4b('0x6d'),_0x8b4b('0x6e'),_0x8b4b('0x6f'),_0x8b4b('0x70'),_0x8b4b('0x71'),'group_list',_0x8b4b('0x72'),_0x8b4b('0x73'),'resolved_at',_0x8b4b('0x74'),_0x8b4b('0x75'),_0x8b4b('0x76'),_0x8b4b('0x77'),_0x8b4b('0x78'),_0x8b4b('0x56'),_0x8b4b('0x79'),_0x8b4b('0x7a'),_0x8b4b('0x7b'),_0x8b4b('0x7c'),_0x8b4b('0x7d'),_0x8b4b('0x7e'),_0x8b4b('0x7f'),'calendar_duration','notify',_0x8b4b('0x80'),'close_notes',_0x8b4b('0x81'),_0x8b4b('0x82'),_0x8b4b('0x83'),_0x8b4b('0x84'),_0x8b4b('0x85'),_0x8b4b('0x86'),_0x8b4b('0x87'),_0x8b4b('0x88'),_0x8b4b('0x89'),_0x8b4b('0x8a'),_0x8b4b('0x8b'),_0x8b4b('0x8c'),_0x8b4b('0x8d'),_0x8b4b('0x58'),_0x8b4b('0x8e'),_0x8b4b('0x8f'),'approval','comments_and_work_notes','due_date','sys_mod_count',_0x8b4b('0x90'),_0x8b4b('0x91'),_0x8b4b('0x92'),'upon_approval',_0x8b4b('0x93'),_0x8b4b('0x94'),'category'];var _0x45f41f='';var _0x5a0390='';var _0x24e465=[];var _0x5917f9='';var _0xb1fe2='';var _0x358cda=[];var _0x179260='';var _0xb5bcbf='';var _0x17039b={};var _0x52aa15='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x12f285[_0x8b4b('0x41')]['id']},'attributes':['id',_0x8b4b('0x95'),'password','email',_0x8b4b('0x96'),'serverUrl']})[_0x8b4b('0x22')](handleEntityNotFound(_0x4bb3ee,null))[_0x8b4b('0x22')](function(_0x3e79c8){if(_0x3e79c8){_0x52aa15=_0x3e79c8['remoteUri'];var _0x2a3ba2=_0x52aa15[_0x8b4b('0x97')](-0x1);if(_0x2a3ba2==='/'){_0x52aa15=_0x52aa15['substring'](0x0,_0x52aa15[_0x8b4b('0x98')](_0x2a3ba2));}_0xb5bcbf=util[_0x8b4b('0x99')](_0x8b4b('0x9a'),_0x52aa15);_0x179260=util[_0x8b4b('0x99')]('%s/api/now/table/',_0x52aa15);_0x17039b={'user':_0x3e79c8[_0x8b4b('0x95')],'pass':_0x3e79c8[_0x8b4b('0x9b')]};var _0x4cf137={'method':_0x8b4b('0x9c'),'uri':_0xb5bcbf+_0x8b4b('0x9d'),'auth':_0x17039b,'json':!![]};return rp(_0x4cf137);}})[_0x8b4b('0x22')](function(_0x1e6378){if(_0x1e6378[_0x8b4b('0x9e')][_0x8b4b('0x4a')]>0x0){_0x45f41f=_0x1e6378[_0x8b4b('0x9e')];}console['log'](_0x8b4b('0x9f'),_0x45f41f);_0x358cda=[];_0x5a0390=Object[_0x8b4b('0xa0')]([],_0x45f41f);_[_0x8b4b('0xa1')](_0x5a0390,function(_0x46eaa5){return!_0x2a186c[_0x8b4b('0xa2')](_0x46eaa5[_0x8b4b('0x25')]);});_0x5a0390[_0x8b4b('0xa3')](function(_0x58f97b){var _0xd2c2f5=createFieldObject(_0x179260,_0x17039b,_0x58f97b[_0x8b4b('0xa4')],_0x58f97b[_0x8b4b('0x25')],_0x58f97b[_0x8b4b('0xa5')],![]);_0x358cda['push'](_0xd2c2f5);});return Promise[_0x8b4b('0xa6')](_0x358cda);})['then'](function(_0x4f749d){_0x24e465=_0x4f749d;_0x5917f9=Object[_0x8b4b('0xa0')]([],_0x45f41f);console['log'](_0x8b4b('0xa7'),_0x45f41f);_[_0x8b4b('0xa1')](_0x5917f9,function(_0xc89ddd){return _0x314d38[_0x8b4b('0xa2')](_0xc89ddd['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5917f9);_0x358cda=[];_0x5917f9[_0x8b4b('0xa3')](function(_0x3ad5c8){var _0x165af6=createFieldObject(_0x179260,_0x17039b,_0x3ad5c8[_0x8b4b('0xa4')],_0x3ad5c8[_0x8b4b('0x25')],_0x3ad5c8[_0x8b4b('0xa5')],!![]);_0x358cda[_0x8b4b('0xa8')](_0x165af6);});return Promise[_0x8b4b('0xa6')](_0x358cda);})[_0x8b4b('0x22')](function(_0x239bb7){_0xb1fe2=_0x239bb7;var _0x54234d=_0x24e465[_0x8b4b('0xa9')](_0xb1fe2);return{'count':_0x54234d['length'],'rows':_0x54234d};})[_0x8b4b('0x22')](respondWithResult(_0x4bb3ee,null))[_0x8b4b('0x3f')](function(_0x1c0d95){console['log'](_0x8b4b('0xaa')+_0x1c0d95);var _0x10836a=_0x12f285[_0x8b4b('0x2d')][_0x8b4b('0xab')]?0x1f4:_0x1c0d95[_0x8b4b('0xac')]||0x1f4;logger[_0x8b4b('0x23')](_0x1c0d95[_0x8b4b('0x24')]);delete _0x1c0d95['name'];if(_0x10836a===0x191){_0x10836a=0x190;}_0x4bb3ee['status'](_0x10836a)[_0x8b4b('0xad')](_0x12f285[_0x8b4b('0x2d')][_0x8b4b('0xab')]?{'message':'Wrong\x20credentials','statusCode':_0x1c0d95[_0x8b4b('0xac')]}:_0x1c0d95);});};function createFieldObject(_0x24e288,_0x1650e4,_0x519330,_0x22d2e3,_0x4397f0,_0x5103f7){return new Promise(function(_0x4972b9,_0x40b5fc){var _0x31f2f0={'id':_0x22d2e3,'name':_0x4397f0,'custom':_0x5103f7};if(_0x519330==='boolean'){_0x31f2f0[_0x8b4b('0xae')]=[{'name':_0x8b4b('0xaf'),'value':'true'},{'name':_0x8b4b('0xb0'),'value':_0x8b4b('0xb1')}];_0x4972b9(_0x31f2f0);}else{var _0x3586ee={'method':_0x8b4b('0x9c'),'uri':_0x24e288+_0x8b4b('0xb2')+_0x22d2e3,'auth':_0x1650e4,'json':!![]};return rp(_0x3586ee)['then'](function(_0x4ab3ba){var _0x13adea=[];if(_0x4ab3ba['result']['length']>0x0){_0x4ab3ba[_0x8b4b('0x9e')][_0x8b4b('0xa3')](function(_0x35c27a){if(_0x35c27a[_0x8b4b('0xb3')]===_0x8b4b('0xb1')){var _0x3cb5ce={'name':_0x35c27a[_0x8b4b('0xa5')],'value':_0x35c27a['value']};_0x13adea[_0x8b4b('0xa8')](_0x3cb5ce);}});}_0x31f2f0['options']=_0x13adea;if(_0x31f2f0[_0x8b4b('0xae')][_0x8b4b('0x4a')]>0x0){_0x4972b9(_0x31f2f0);}else{if(_0x5103f7==![]){_0x4972b9();}else{_0x4972b9(_0x31f2f0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f6e2178..c71501a 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 _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0xb11278,_0x226f2b){var _0x3a7b4d=function(_0x2732eb){while(--_0x2732eb){_0xb11278['push'](_0xb11278['shift']());}};_0x3a7b4d(++_0x226f2b);}(_0xeda8,0x104));var _0x8eda=function(_0x1c1231,_0x53139e){_0x1c1231=_0x1c1231-0x0;var _0x1baa33=_0xeda8[_0x1c1231];return _0x1baa33;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x598934,_0x145b5d){var _0x14e442=function(_0x320c14){while(--_0x320c14){_0x598934['push'](_0x598934['shift']());}};_0x14e442(++_0x145b5d);}(_0x4819,0xcd));var _0x9481=function(_0x3f99a8,_0x160bf7){_0x3f99a8=_0x3f99a8-0x0;var _0x25c907=_0x4819[_0x3f99a8];return _0x25c907;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'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 b2d665b..94c6c7b 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 _0x970b=['model','attributes','ShowServicenowAccount','ServicenowAccount','find','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','findAll','options','raw','where','limit','include','map'];(function(_0x2046eb,_0x567d7d){var _0x1bced9=function(_0x4894ce){while(--_0x4894ce){_0x2046eb['push'](_0x2046eb['shift']());}};_0x1bced9(++_0x567d7d);}(_0x970b,0xcb));var _0xb970=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x970b[_0x3a0ebd];return _0x51a660;};'use strict';var _=require('lodash');var util=require(_0xb970('0x0'));var moment=require(_0xb970('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb970('0x2'));var db=require(_0xb970('0x3'))['db'];var utils=require(_0xb970('0x4'));var logger=require('../../config/logger')(_0xb970('0x5'));var config=require('../../config/environment');var jayson=require(_0xb970('0x6'));var client=jayson[_0xb970('0x7')][_0xb970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493e8a,_0x4f033b,_0x4abc8c){return new BPromise(function(_0x14d6cf,_0x1b5021){return client['request'](_0x493e8a,_0x4abc8c)[_0xb970('0x9')](function(_0x3920b8){logger[_0xb970('0xa')](_0xb970('0xb'),_0x4f033b,_0xb970('0xc'));logger[_0xb970('0xd')](_0xb970('0xe'),_0x4f033b,_0xb970('0xc'),JSON[_0xb970('0xf')](_0x3920b8));if(_0x3920b8[_0xb970('0x10')]){if(_0x3920b8[_0xb970('0x10')][_0xb970('0x11')]===0x1f4){logger[_0xb970('0x10')](_0xb970('0xb'),_0x4f033b,_0x3920b8[_0xb970('0x10')][_0xb970('0x12')]);return _0x1b5021(_0x3920b8[_0xb970('0x10')][_0xb970('0x12')]);}logger[_0xb970('0x10')](_0xb970('0xb'),_0x4f033b,_0x3920b8[_0xb970('0x10')][_0xb970('0x12')]);return _0x14d6cf(_0x3920b8[_0xb970('0x10')][_0xb970('0x12')]);}else{logger[_0xb970('0xa')](_0xb970('0xb'),_0x4f033b,_0xb970('0xc'));_0x14d6cf(_0x3920b8['result'][_0xb970('0x12')]);}})[_0xb970('0x13')](function(_0x47e568){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4f033b,_0x47e568);_0x1b5021(_0x47e568);});});}exports[_0xb970('0x14')]=function(_0x4cd4f7){var _0xcc2486=this;return new Promise(function(_0xedf495,_0x4720ac){return db['ServicenowAccount'][_0xb970('0x15')]({'raw':_0x4cd4f7[_0xb970('0x16')]?_0x4cd4f7['options'][_0xb970('0x17')]===undefined?!![]:![]:!![],'where':_0x4cd4f7[_0xb970('0x16')]?_0x4cd4f7['options'][_0xb970('0x18')]||null:null,'attributes':_0x4cd4f7[_0xb970('0x16')]?_0x4cd4f7[_0xb970('0x16')]['attributes']||null:null,'limit':_0x4cd4f7[_0xb970('0x16')]?_0x4cd4f7[_0xb970('0x16')][_0xb970('0x19')]||null:null,'include':_0x4cd4f7[_0xb970('0x16')]?_0x4cd4f7[_0xb970('0x16')][_0xb970('0x1a')]?_[_0xb970('0x1b')](_0x4cd4f7[_0xb970('0x16')][_0xb970('0x1a')],function(_0x23c9d2){return{'model':db[_0x23c9d2[_0xb970('0x1c')]],'as':_0x23c9d2['as'],'attributes':_0x23c9d2[_0xb970('0x1d')],'include':_0x23c9d2[_0xb970('0x1a')]?_[_0xb970('0x1b')](_0x23c9d2[_0xb970('0x1a')],function(_0x4efcc8){return{'model':db[_0x4efcc8['model']],'as':_0x4efcc8['as'],'attributes':_0x4efcc8[_0xb970('0x1d')],'include':_0x4efcc8[_0xb970('0x1a')]?_[_0xb970('0x1b')](_0x4efcc8[_0xb970('0x1a')],function(_0xa7a6fc){return{'model':db[_0xa7a6fc[_0xb970('0x1c')]],'as':_0xa7a6fc['as'],'attributes':_0xa7a6fc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x507cbe){logger[_0xb970('0xa')](_0xb970('0x14'),_0x4cd4f7);logger[_0xb970('0xd')](_0xb970('0x14'),_0x4cd4f7,JSON[_0xb970('0xf')](_0x507cbe));_0xedf495(_0x507cbe);})[_0xb970('0x13')](function(_0x29122b){logger[_0xb970('0x10')](_0xb970('0x14'),_0x29122b[_0xb970('0x12')],_0x4cd4f7);_0x4720ac(_0xcc2486[_0xb970('0x10')](0x1f4,_0x29122b['message']));});});};exports[_0xb970('0x1e')]=function(_0x11901d){var _0x163b6f=this;return new Promise(function(_0x21f370,_0x28cc4d){return db[_0xb970('0x1f')][_0xb970('0x20')]({'raw':_0x11901d[_0xb970('0x16')]?_0x11901d['options'][_0xb970('0x17')]===undefined?!![]:![]:!![],'where':_0x11901d[_0xb970('0x16')]?_0x11901d[_0xb970('0x16')][_0xb970('0x18')]||null:null,'attributes':_0x11901d[_0xb970('0x16')]?_0x11901d[_0xb970('0x16')][_0xb970('0x1d')]||null:null,'include':_0x11901d[_0xb970('0x16')]?_0x11901d['options'][_0xb970('0x1a')]?_[_0xb970('0x1b')](_0x11901d[_0xb970('0x16')][_0xb970('0x1a')],function(_0x52975f){return{'model':db[_0x52975f['model']],'as':_0x52975f['as'],'attributes':_0x52975f[_0xb970('0x1d')],'include':_0x52975f['include']?_[_0xb970('0x1b')](_0x52975f[_0xb970('0x1a')],function(_0x519c27){return{'model':db[_0x519c27[_0xb970('0x1c')]],'as':_0x519c27['as'],'attributes':_0x519c27[_0xb970('0x1d')],'include':_0x519c27[_0xb970('0x1a')]?_['map'](_0x519c27[_0xb970('0x1a')],function(_0x1ee71c){return{'model':db[_0x1ee71c[_0xb970('0x1c')]],'as':_0x1ee71c['as'],'attributes':_0x1ee71c[_0xb970('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb970('0x9')](function(_0x1a0a0c){logger[_0xb970('0xa')](_0xb970('0x1e'),_0x11901d);logger['debug']('ShowServicenowAccount',_0x11901d,JSON['stringify'](_0x1a0a0c));_0x21f370(_0x1a0a0c);})[_0xb970('0x13')](function(_0x27c048){logger[_0xb970('0x10')](_0xb970('0x1e'),_0x27c048[_0xb970('0x12')],_0x11901d);_0x28cc4d(_0x163b6f[_0xb970('0x10')](0x1f4,_0x27c048['message']));});});}; \ No newline at end of file +var _0xfa33=['include','model','info','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','map'];(function(_0x4351ef,_0x178920){var _0x41a551=function(_0x337381){while(--_0x337381){_0x4351ef['push'](_0x4351ef['shift']());}};_0x41a551(++_0x178920);}(_0xfa33,0x1d3));var _0x3fa3=function(_0x1da46b,_0x109ac4){_0x1da46b=_0x1da46b-0x0;var _0x3a94ef=_0xfa33[_0x1da46b];return _0x3a94ef;};'use strict';var _=require(_0x3fa3('0x0'));var util=require(_0x3fa3('0x1'));var moment=require(_0x3fa3('0x2'));var BPromise=require(_0x3fa3('0x3'));var rs=require(_0x3fa3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fa3('0x5'))['db'];var utils=require(_0x3fa3('0x6'));var logger=require(_0x3fa3('0x7'))('rpc');var config=require(_0x3fa3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fa3('0x9')][_0x3fa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b70d,_0x1babda,_0x1269b5){return new BPromise(function(_0x335aea,_0x3c431e){return client['request'](_0x50b70d,_0x1269b5)[_0x3fa3('0xb')](function(_0x198f6e){logger['info'](_0x3fa3('0xc'),_0x1babda,_0x3fa3('0xd'));logger[_0x3fa3('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1babda,_0x3fa3('0xd'),JSON[_0x3fa3('0xf')](_0x198f6e));if(_0x198f6e[_0x3fa3('0x10')]){if(_0x198f6e[_0x3fa3('0x10')]['code']===0x1f4){logger[_0x3fa3('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x1babda,_0x198f6e[_0x3fa3('0x10')][_0x3fa3('0x11')]);return _0x3c431e(_0x198f6e['error']['message']);}logger['error'](_0x3fa3('0xc'),_0x1babda,_0x198f6e['error']['message']);return _0x335aea(_0x198f6e[_0x3fa3('0x10')]['message']);}else{logger['info'](_0x3fa3('0xc'),_0x1babda,_0x3fa3('0xd'));_0x335aea(_0x198f6e[_0x3fa3('0x12')][_0x3fa3('0x11')]);}})[_0x3fa3('0x13')](function(_0xddb607){logger['error'](_0x3fa3('0xc'),_0x1babda,_0xddb607);_0x3c431e(_0xddb607);});});}exports[_0x3fa3('0x14')]=function(_0x59eb94){var _0x1a0772=this;return new Promise(function(_0x49408f,_0x3c5aef){return db[_0x3fa3('0x15')]['findAll']({'raw':_0x59eb94['options']?_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x17')]===undefined?!![]:![]:!![],'where':_0x59eb94[_0x3fa3('0x16')]?_0x59eb94['options'][_0x3fa3('0x18')]||null:null,'attributes':_0x59eb94[_0x3fa3('0x16')]?_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x19')]||null:null,'limit':_0x59eb94[_0x3fa3('0x16')]?_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x1a')]||null:null,'include':_0x59eb94['options']?_0x59eb94['options']['include']?_[_0x3fa3('0x1b')](_0x59eb94[_0x3fa3('0x16')][_0x3fa3('0x1c')],function(_0x3a17a3){return{'model':db[_0x3a17a3[_0x3fa3('0x1d')]],'as':_0x3a17a3['as'],'attributes':_0x3a17a3['attributes'],'include':_0x3a17a3[_0x3fa3('0x1c')]?_['map'](_0x3a17a3[_0x3fa3('0x1c')],function(_0x5c4826){return{'model':db[_0x5c4826[_0x3fa3('0x1d')]],'as':_0x5c4826['as'],'attributes':_0x5c4826['attributes'],'include':_0x5c4826[_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x5c4826[_0x3fa3('0x1c')],function(_0x5b208f){return{'model':db[_0x5b208f[_0x3fa3('0x1d')]],'as':_0x5b208f['as'],'attributes':_0x5b208f[_0x3fa3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fa3('0xb')](function(_0x46cad2){logger[_0x3fa3('0x1e')](_0x3fa3('0x14'),_0x59eb94);logger[_0x3fa3('0xe')](_0x3fa3('0x14'),_0x59eb94,JSON[_0x3fa3('0xf')](_0x46cad2));_0x49408f(_0x46cad2);})['catch'](function(_0x322ff1){logger['error']('GetServicenowAccount',_0x322ff1['message'],_0x59eb94);_0x3c5aef(_0x1a0772[_0x3fa3('0x10')](0x1f4,_0x322ff1['message']));});});};exports[_0x3fa3('0x1f')]=function(_0x51aef5){var _0xd4884f=this;return new Promise(function(_0x437081,_0xf74ca2){return db[_0x3fa3('0x15')][_0x3fa3('0x20')]({'raw':_0x51aef5[_0x3fa3('0x16')]?_0x51aef5[_0x3fa3('0x16')][_0x3fa3('0x17')]===undefined?!![]:![]:!![],'where':_0x51aef5['options']?_0x51aef5[_0x3fa3('0x16')][_0x3fa3('0x18')]||null:null,'attributes':_0x51aef5[_0x3fa3('0x16')]?_0x51aef5['options'][_0x3fa3('0x19')]||null:null,'include':_0x51aef5[_0x3fa3('0x16')]?_0x51aef5[_0x3fa3('0x16')][_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x51aef5['options']['include'],function(_0x3faf47){return{'model':db[_0x3faf47[_0x3fa3('0x1d')]],'as':_0x3faf47['as'],'attributes':_0x3faf47[_0x3fa3('0x19')],'include':_0x3faf47[_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x3faf47[_0x3fa3('0x1c')],function(_0x43a477){return{'model':db[_0x43a477['model']],'as':_0x43a477['as'],'attributes':_0x43a477[_0x3fa3('0x19')],'include':_0x43a477[_0x3fa3('0x1c')]?_[_0x3fa3('0x1b')](_0x43a477[_0x3fa3('0x1c')],function(_0x97d60c){return{'model':db[_0x97d60c[_0x3fa3('0x1d')]],'as':_0x97d60c['as'],'attributes':_0x97d60c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3fa3('0xb')](function(_0x25ed19){logger[_0x3fa3('0x1e')](_0x3fa3('0x1f'),_0x51aef5);logger[_0x3fa3('0xe')]('ShowServicenowAccount',_0x51aef5,JSON[_0x3fa3('0xf')](_0x25ed19));_0x437081(_0x25ed19);})[_0x3fa3('0x13')](function(_0x465113){logger['error'](_0x3fa3('0x1f'),_0x465113[_0x3fa3('0x11')],_0x51aef5);_0xf74ca2(_0xd4884f[_0x3fa3('0x10')](0x1f4,_0x465113['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 76af9b2..3143131 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 _0x053a=['../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x053a,0x9c));var _0xa053=function(_0x3fd2af,_0x1f4699){_0x3fd2af=_0x3fd2af-0x0;var _0x5b00f2=_0x053a[_0x3fd2af];return _0x5b00f2;};'use strict';var multer=require('multer');var util=require(_0xa053('0x0'));var path=require('path');var timeout=require(_0xa053('0x1'));var express=require(_0xa053('0x2'));var router=express[_0xa053('0x3')]();var fs_extra=require(_0xa053('0x4'));var auth=require(_0xa053('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa053('0x6'));var controller=require(_0xa053('0x7'));router[_0xa053('0x8')]('/',auth[_0xa053('0x9')](),controller[_0xa053('0xa')]);router[_0xa053('0x8')](_0xa053('0xb'),auth['isAuthenticated'](),controller[_0xa053('0xc')]);router['get'](_0xa053('0xd'),auth[_0xa053('0x9')](),controller['getFields']);router[_0xa053('0x8')](_0xa053('0xe'),auth[_0xa053('0x9')](),controller[_0xa053('0xf')]);router[_0xa053('0x8')](_0xa053('0x10'),auth[_0xa053('0x9')](),controller[_0xa053('0x11')]);router[_0xa053('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa053('0x13')](_0xa053('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa053('0x14')]('/:id',auth[_0xa053('0x9')](),controller[_0xa053('0x15')]);module[_0xa053('0x16')]=router; \ No newline at end of file +var _0x1b02=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x34ebd3,_0x613554){var _0x219c7e=function(_0x40a982){while(--_0x40a982){_0x34ebd3['push'](_0x34ebd3['shift']());}};_0x219c7e(++_0x613554);}(_0x1b02,0x151));var _0x21b0=function(_0x31cc6e,_0x4da430){_0x31cc6e=_0x31cc6e-0x0;var _0x39a234=_0x1b02[_0x31cc6e];return _0x39a234;};'use strict';var multer=require(_0x21b0('0x0'));var util=require(_0x21b0('0x1'));var path=require('path');var timeout=require(_0x21b0('0x2'));var express=require(_0x21b0('0x3'));var router=express['Router']();var fs_extra=require(_0x21b0('0x4'));var auth=require(_0x21b0('0x5'));var interaction=require(_0x21b0('0x6'));var config=require(_0x21b0('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x21b0('0x8')]('/',auth[_0x21b0('0x9')](),controller['index']);router[_0x21b0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x21b0('0xa')]);router[_0x21b0('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x21b0('0xb')]);router['get']('/:id/subjects',auth[_0x21b0('0x9')](),controller['getSubjects']);router[_0x21b0('0x8')](_0x21b0('0xc'),auth['isAuthenticated'](),controller[_0x21b0('0xd')]);router[_0x21b0('0xe')]('/',auth[_0x21b0('0x9')](),controller[_0x21b0('0xf')]);router[_0x21b0('0x10')](_0x21b0('0x11'),auth[_0x21b0('0x9')](),controller[_0x21b0('0x12')]);router[_0x21b0('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x21b0('0x14')]);module[_0x21b0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f6ee95d..7a7d651 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 _0x79f1=['STRING','exports'];(function(_0x41bac1,_0x4614d0){var _0x5112d8=function(_0x1d8d7e){while(--_0x1d8d7e){_0x41bac1['push'](_0x41bac1['shift']());}};_0x5112d8(++_0x4614d0);}(_0x79f1,0xf1));var _0x179f=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x79f1[_0xa4b8e1];return _0x507e42;};'use strict';var Sequelize=require('sequelize');module[_0x179f('0x0')]={'name':{'type':Sequelize[_0x179f('0x1')]},'description':{'type':Sequelize[_0x179f('0x1')]}}; \ No newline at end of file +var _0x5fce=['exports','STRING','sequelize'];(function(_0x53a8b3,_0x14570f){var _0x808b8c=function(_0x35922f){while(--_0x35922f){_0x53a8b3['push'](_0x53a8b3['shift']());}};_0x808b8c(++_0x14570f);}(_0x5fce,0x155));var _0xe5fc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5fce[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xe5fc('0x0'));module[_0xe5fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index dc2f9d7..1a35da7 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 _0xb979=['includeAll','find','create','body','update','getFields','findOne','ServicenowField','sort','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params'];(function(_0x47cc5b,_0x568584){var _0x2efe35=function(_0x454831){while(--_0x454831){_0x47cc5b['push'](_0x47cc5b['shift']());}};_0x2efe35(++_0x568584);}(_0xb979,0x19d));var _0x9b97=function(_0x453f0b,_0x347eba){_0x453f0b=_0x453f0b-0x0;var _0xacc07f=_0xb979[_0x453f0b];return _0xacc07f;};'use strict';var emlformat=require(_0x9b97('0x0'));var rimraf=require(_0x9b97('0x1'));var zipdir=require(_0x9b97('0x2'));var jsonpatch=require(_0x9b97('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9b97('0x4'));var Mustache=require(_0x9b97('0x5'));var util=require(_0x9b97('0x6'));var path=require('path');var sox=require(_0x9b97('0x7'));var csv=require(_0x9b97('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b97('0x9'));var _=require('lodash');var squel=require(_0x9b97('0xa'));var crypto=require(_0x9b97('0xb'));var jsforce=require(_0x9b97('0xc'));var deskjs=require(_0x9b97('0xd'));var toCsv=require(_0x9b97('0x8'));var querystring=require('querystring');var Papa=require(_0x9b97('0xe'));var Redis=require(_0x9b97('0xf'));var authService=require(_0x9b97('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b97('0x11'))(_0x9b97('0x12'));var utils=require(_0x9b97('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b97('0x14'))['db'];function respondWithStatusCode(_0x4c064b,_0x201f69){_0x201f69=_0x201f69||0xcc;return function(_0x20271d){if(_0x20271d){return _0x4c064b[_0x9b97('0x15')](_0x201f69);}return _0x4c064b[_0x9b97('0x16')](_0x201f69)[_0x9b97('0x17')]();};}function respondWithResult(_0x582a4c,_0x5c88ac){_0x5c88ac=_0x5c88ac||0xc8;return function(_0x591a49){if(_0x591a49){return _0x582a4c['status'](_0x5c88ac)['json'](_0x591a49);}};}function respondWithFilteredResult(_0x1a5541,_0x273789){return function(_0x6681f){if(_0x6681f){var _0x16ea71=typeof _0x273789['offset']===_0x9b97('0x18')&&typeof _0x273789[_0x9b97('0x19')]===_0x9b97('0x18');var _0x4188ad=_0x6681f[_0x9b97('0x1a')];var _0x240b5c=_0x16ea71?0x0:_0x273789[_0x9b97('0x1b')];var _0x1b84a4=_0x16ea71?_0x6681f[_0x9b97('0x1a')]:_0x273789[_0x9b97('0x1b')]+_0x273789[_0x9b97('0x19')];var _0x33994b;if(_0x1b84a4>=_0x4188ad){_0x1b84a4=_0x4188ad;_0x33994b=0xc8;}else{_0x33994b=0xce;}_0x1a5541[_0x9b97('0x16')](_0x33994b);return _0x1a5541[_0x9b97('0x1c')](_0x9b97('0x1d'),_0x240b5c+'-'+_0x1b84a4+'/'+_0x4188ad)[_0x9b97('0x1e')](_0x6681f);}return null;};}function patchUpdates(_0xeddea8){return function(_0x4fe289){try{jsonpatch[_0x9b97('0x1f')](_0x4fe289,_0xeddea8,!![]);}catch(_0x4a2a3c){return BPromise[_0x9b97('0x20')](_0x4a2a3c);}return _0x4fe289[_0x9b97('0x21')]();};}function saveUpdates(_0x225c50,_0x2c5d05){return function(_0xe201d9){if(_0xe201d9){return _0xe201d9['update'](_0x225c50)[_0x9b97('0x22')](function(_0x551b6a){return _0x551b6a;});}return null;};}function removeEntity(_0x11a35f,_0x545f55){return function(_0x47a8e7){if(_0x47a8e7){return _0x47a8e7[_0x9b97('0x23')]()[_0x9b97('0x22')](function(){_0x11a35f[_0x9b97('0x16')](0xcc)[_0x9b97('0x17')]();});}};}function handleEntityNotFound(_0x4aca0d,_0x6d115f){return function(_0x1e59ac){if(!_0x1e59ac){_0x4aca0d['sendStatus'](0x194);}return _0x1e59ac;};}function handleError(_0x123991,_0x4f46e8){_0x4f46e8=_0x4f46e8||0x1f4;return function(_0x44aa2a){logger[_0x9b97('0x24')](_0x44aa2a[_0x9b97('0x25')]);if(_0x44aa2a[_0x9b97('0x26')]){delete _0x44aa2a['name'];}_0x123991['status'](_0x4f46e8)[_0x9b97('0x27')](_0x44aa2a);};}exports[_0x9b97('0x28')]=function(_0x49b61b,_0x3964e7){var _0x54af91={},_0x196a0c={},_0xeccb01={'count':0x0,'rows':[]};var _0x5a34fd=_['map'](db[_0x9b97('0x29')][_0x9b97('0x2a')],function(_0x17f457){return{'name':_0x17f457[_0x9b97('0x2b')],'type':_0x17f457[_0x9b97('0x2c')][_0x9b97('0x2d')]};});_0x196a0c[_0x9b97('0x2e')]=_[_0x9b97('0x2f')](_0x5a34fd,_0x9b97('0x26'));_0x196a0c[_0x9b97('0x30')]=_[_0x9b97('0x31')](_0x49b61b[_0x9b97('0x30')]);_0x196a0c[_0x9b97('0x32')]=_[_0x9b97('0x33')](_0x196a0c['model'],_0x196a0c['query']);_0x54af91[_0x9b97('0x34')]=_[_0x9b97('0x33')](_0x196a0c['model'],qs[_0x9b97('0x35')](_0x49b61b['query'][_0x9b97('0x35')]));_0x54af91[_0x9b97('0x34')]=_0x54af91[_0x9b97('0x34')][_0x9b97('0x36')]?_0x54af91[_0x9b97('0x34')]:_0x196a0c[_0x9b97('0x2e')];if(!_0x49b61b[_0x9b97('0x30')]['hasOwnProperty']('nolimit')){_0x54af91['limit']=qs[_0x9b97('0x19')](_0x49b61b[_0x9b97('0x30')][_0x9b97('0x19')]);_0x54af91[_0x9b97('0x1b')]=qs[_0x9b97('0x1b')](_0x49b61b[_0x9b97('0x30')][_0x9b97('0x1b')]);}_0x54af91[_0x9b97('0x37')]=qs['sort'](_0x49b61b['query']['sort']);_0x54af91[_0x9b97('0x38')]=qs['filters'](_[_0x9b97('0x39')](_0x49b61b[_0x9b97('0x30')],_0x196a0c[_0x9b97('0x32')]),_0x5a34fd);if(_0x49b61b['query']['filter']){_0x54af91['where']=_[_0x9b97('0x3a')](_0x54af91[_0x9b97('0x38')],{'$or':_[_0x9b97('0x2f')](_0x5a34fd,function(_0x4b1bf1){if(_0x4b1bf1[_0x9b97('0x2c')]!==_0x9b97('0x3b')){var _0x492f32={};_0x492f32[_0x4b1bf1['name']]={'$like':'%'+_0x49b61b[_0x9b97('0x30')][_0x9b97('0x3c')]+'%'};return _0x492f32;}})});}_0x54af91=_[_0x9b97('0x3a')]({},_0x54af91,_0x49b61b[_0x9b97('0x3d')]);var _0x2a6f83={'where':_0x54af91['where']};return db[_0x9b97('0x29')][_0x9b97('0x1a')](_0x2a6f83)[_0x9b97('0x22')](function(_0x3aea6b){_0xeccb01[_0x9b97('0x1a')]=_0x3aea6b;if(_0x49b61b[_0x9b97('0x30')]['includeAll']){_0x54af91[_0x9b97('0x3e')]=[{'all':!![]}];}return db[_0x9b97('0x29')][_0x9b97('0x3f')](_0x54af91);})[_0x9b97('0x22')](function(_0x554c64){_0xeccb01['rows']=_0x554c64;return _0xeccb01;})[_0x9b97('0x22')](respondWithFilteredResult(_0x3964e7,_0x54af91))[_0x9b97('0x40')](handleError(_0x3964e7,null));};exports[_0x9b97('0x41')]=function(_0x925d12,_0x157c61){var _0xd0ab1f={'raw':![],'where':{'id':_0x925d12[_0x9b97('0x42')]['id']}},_0x9dc1c6={};_0x9dc1c6[_0x9b97('0x2e')]=_[_0x9b97('0x31')](db[_0x9b97('0x29')]['rawAttributes']);_0x9dc1c6[_0x9b97('0x30')]=_[_0x9b97('0x31')](_0x925d12[_0x9b97('0x30')]);_0x9dc1c6[_0x9b97('0x32')]=_['intersection'](_0x9dc1c6[_0x9b97('0x2e')],_0x9dc1c6[_0x9b97('0x30')]);_0xd0ab1f[_0x9b97('0x34')]=_[_0x9b97('0x33')](_0x9dc1c6['model'],qs[_0x9b97('0x35')](_0x925d12['query'][_0x9b97('0x35')]));_0xd0ab1f[_0x9b97('0x34')]=_0xd0ab1f['attributes'][_0x9b97('0x36')]?_0xd0ab1f[_0x9b97('0x34')]:_0x9dc1c6[_0x9b97('0x2e')];if(_0x925d12[_0x9b97('0x30')][_0x9b97('0x43')]){_0xd0ab1f[_0x9b97('0x3e')]=[{'all':!![]}];}_0xd0ab1f=_[_0x9b97('0x3a')]({},_0xd0ab1f,_0x925d12['options']);return db[_0x9b97('0x29')][_0x9b97('0x44')](_0xd0ab1f)[_0x9b97('0x22')](handleEntityNotFound(_0x157c61,null))['then'](respondWithResult(_0x157c61,null))[_0x9b97('0x40')](handleError(_0x157c61,null));};exports[_0x9b97('0x45')]=function(_0x499f08,_0x5bc4bc){return db[_0x9b97('0x29')]['create'](_0x499f08[_0x9b97('0x46')],{})['then'](respondWithResult(_0x5bc4bc,0xc9))[_0x9b97('0x40')](handleError(_0x5bc4bc,null));};exports[_0x9b97('0x47')]=function(_0x4ff0f7,_0x4cf365){if(_0x4ff0f7['body']['id']){delete _0x4ff0f7['body']['id'];}return db[_0x9b97('0x29')][_0x9b97('0x44')]({'where':{'id':_0x4ff0f7['params']['id']}})['then'](handleEntityNotFound(_0x4cf365,null))[_0x9b97('0x22')](saveUpdates(_0x4ff0f7[_0x9b97('0x46')],null))[_0x9b97('0x22')](respondWithResult(_0x4cf365,null))[_0x9b97('0x40')](handleError(_0x4cf365,null));};exports['destroy']=function(_0x26e517,_0x40fdc7){return db[_0x9b97('0x29')][_0x9b97('0x44')]({'where':{'id':_0x26e517[_0x9b97('0x42')]['id']}})[_0x9b97('0x22')](handleEntityNotFound(_0x40fdc7,null))[_0x9b97('0x22')](removeEntity(_0x40fdc7,null))['catch'](handleError(_0x40fdc7,null));};exports[_0x9b97('0x48')]=function(_0x87c380,_0x28feec,_0x5a1721){var _0x318a39={};var _0x48620b={};var _0x412473;var _0x4c95dd;return db[_0x9b97('0x29')][_0x9b97('0x49')]({'where':{'id':_0x87c380[_0x9b97('0x42')]['id']}})[_0x9b97('0x22')](handleEntityNotFound(_0x28feec,null))['then'](function(_0x10e8a9){if(_0x10e8a9){_0x412473=_0x10e8a9;_0x48620b[_0x9b97('0x2e')]=_['keys'](db[_0x9b97('0x4a')][_0x9b97('0x2a')]);_0x48620b[_0x9b97('0x30')]=_['keys'](_0x87c380[_0x9b97('0x30')]);_0x48620b['filters']=_[_0x9b97('0x33')](_0x48620b[_0x9b97('0x2e')],_0x48620b[_0x9b97('0x30')]);_0x318a39[_0x9b97('0x34')]=_[_0x9b97('0x33')](_0x48620b[_0x9b97('0x2e')],qs[_0x9b97('0x35')](_0x87c380[_0x9b97('0x30')][_0x9b97('0x35')]));_0x318a39['attributes']=_0x318a39['attributes']['length']?_0x318a39[_0x9b97('0x34')]:_0x48620b[_0x9b97('0x2e')];_0x318a39['order']=qs[_0x9b97('0x4b')](_0x87c380[_0x9b97('0x30')][_0x9b97('0x4b')]);_0x318a39[_0x9b97('0x38')]=qs[_0x9b97('0x32')](_['pick'](_0x87c380[_0x9b97('0x30')],_0x48620b[_0x9b97('0x32')]));if(_0x87c380[_0x9b97('0x30')][_0x9b97('0x3c')]){_0x318a39['where']=_[_0x9b97('0x3a')](_0x318a39[_0x9b97('0x38')],{'$or':_[_0x9b97('0x2f')](_0x318a39[_0x9b97('0x34')],function(_0x4c407a){var _0x1c64bd={};_0x1c64bd[_0x4c407a]={'$like':'%'+_0x87c380[_0x9b97('0x30')]['filter']+'%'};return _0x1c64bd;})});}_0x318a39=_[_0x9b97('0x3a')]({},_0x318a39,_0x87c380[_0x9b97('0x3d')]);return _0x412473[_0x9b97('0x48')](_0x318a39);}})[_0x9b97('0x22')](function(_0x47cca1){if(_0x47cca1){_0x4c95dd=_0x47cca1[_0x9b97('0x36')];if(!_0x87c380['query']['hasOwnProperty'](_0x9b97('0x4c'))){_0x318a39[_0x9b97('0x19')]=qs[_0x9b97('0x19')](_0x87c380[_0x9b97('0x30')][_0x9b97('0x19')]);_0x318a39[_0x9b97('0x1b')]=qs[_0x9b97('0x1b')](_0x87c380[_0x9b97('0x30')][_0x9b97('0x1b')]);}return _0x412473[_0x9b97('0x48')](_0x318a39);}})[_0x9b97('0x22')](function(_0x59f8b7){if(_0x59f8b7){return _0x59f8b7?{'count':_0x4c95dd,'rows':_0x59f8b7}:null;}})['then'](respondWithResult(_0x28feec,null))[_0x9b97('0x40')](handleError(_0x28feec,null));};exports[_0x9b97('0x4d')]=function(_0x31be87,_0x558622,_0xe7bda6){var _0x4d5ee4={};var _0x4e0394={};var _0x1ec985;var _0x3caae7;return db['ServicenowConfiguration'][_0x9b97('0x49')]({'where':{'id':_0x31be87[_0x9b97('0x42')]['id']}})[_0x9b97('0x22')](handleEntityNotFound(_0x558622,null))[_0x9b97('0x22')](function(_0x2cc641){if(_0x2cc641){_0x1ec985=_0x2cc641;_0x4e0394[_0x9b97('0x2e')]=_[_0x9b97('0x31')](db['ServicenowField'][_0x9b97('0x2a')]);_0x4e0394[_0x9b97('0x30')]=_[_0x9b97('0x31')](_0x31be87['query']);_0x4e0394['filters']=_[_0x9b97('0x33')](_0x4e0394[_0x9b97('0x2e')],_0x4e0394[_0x9b97('0x30')]);_0x4d5ee4[_0x9b97('0x34')]=_['intersection'](_0x4e0394[_0x9b97('0x2e')],qs['fields'](_0x31be87[_0x9b97('0x30')][_0x9b97('0x35')]));_0x4d5ee4[_0x9b97('0x34')]=_0x4d5ee4[_0x9b97('0x34')][_0x9b97('0x36')]?_0x4d5ee4['attributes']:_0x4e0394[_0x9b97('0x2e')];_0x4d5ee4[_0x9b97('0x37')]=qs[_0x9b97('0x4b')](_0x31be87[_0x9b97('0x30')][_0x9b97('0x4b')]);_0x4d5ee4[_0x9b97('0x38')]=qs[_0x9b97('0x32')](_[_0x9b97('0x39')](_0x31be87[_0x9b97('0x30')],_0x4e0394[_0x9b97('0x32')]));if(_0x31be87[_0x9b97('0x30')][_0x9b97('0x3c')]){_0x4d5ee4['where']=_['merge'](_0x4d5ee4[_0x9b97('0x38')],{'$or':_[_0x9b97('0x2f')](_0x4d5ee4['attributes'],function(_0x47ce98){var _0x1b9aac={};_0x1b9aac[_0x47ce98]={'$like':'%'+_0x31be87['query'][_0x9b97('0x3c')]+'%'};return _0x1b9aac;})});}_0x4d5ee4=_[_0x9b97('0x3a')]({},_0x4d5ee4,_0x31be87[_0x9b97('0x3d')]);return _0x1ec985[_0x9b97('0x4d')](_0x4d5ee4);}})[_0x9b97('0x22')](function(_0xfc36bd){if(_0xfc36bd){_0x3caae7=_0xfc36bd['length'];if(!_0x31be87['query'][_0x9b97('0x4e')](_0x9b97('0x4c'))){_0x4d5ee4[_0x9b97('0x19')]=qs[_0x9b97('0x19')](_0x31be87[_0x9b97('0x30')][_0x9b97('0x19')]);_0x4d5ee4[_0x9b97('0x1b')]=qs[_0x9b97('0x1b')](_0x31be87[_0x9b97('0x30')][_0x9b97('0x1b')]);}return _0x1ec985['getSubjects'](_0x4d5ee4);}})[_0x9b97('0x22')](function(_0x5d217c){if(_0x5d217c){return _0x5d217c?{'count':_0x3caae7,'rows':_0x5d217c}:null;}})[_0x9b97('0x22')](respondWithResult(_0x558622,null))['catch'](handleError(_0x558622,null));};exports[_0x9b97('0x4f')]=function(_0x1305c2,_0x242083,_0x3b6e85){var _0x2799d1={};var _0x5a643={};var _0x16b0c1;var _0x329ab6;return db['ServicenowConfiguration'][_0x9b97('0x49')]({'where':{'id':_0x1305c2[_0x9b97('0x42')]['id']}})['then'](handleEntityNotFound(_0x242083,null))['then'](function(_0x50fd03){if(_0x50fd03){_0x16b0c1=_0x50fd03;_0x5a643[_0x9b97('0x2e')]=_[_0x9b97('0x31')](db[_0x9b97('0x4a')][_0x9b97('0x2a')]);_0x5a643[_0x9b97('0x30')]=_['keys'](_0x1305c2[_0x9b97('0x30')]);_0x5a643[_0x9b97('0x32')]=_[_0x9b97('0x33')](_0x5a643[_0x9b97('0x2e')],_0x5a643[_0x9b97('0x30')]);_0x2799d1[_0x9b97('0x34')]=_[_0x9b97('0x33')](_0x5a643[_0x9b97('0x2e')],qs['fields'](_0x1305c2[_0x9b97('0x30')][_0x9b97('0x35')]));_0x2799d1[_0x9b97('0x34')]=_0x2799d1[_0x9b97('0x34')]['length']?_0x2799d1[_0x9b97('0x34')]:_0x5a643[_0x9b97('0x2e')];_0x2799d1['order']=qs[_0x9b97('0x4b')](_0x1305c2['query'][_0x9b97('0x4b')]);_0x2799d1[_0x9b97('0x38')]=qs[_0x9b97('0x32')](_[_0x9b97('0x39')](_0x1305c2[_0x9b97('0x30')],_0x5a643[_0x9b97('0x32')]));if(_0x1305c2[_0x9b97('0x30')][_0x9b97('0x3c')]){_0x2799d1['where']=_[_0x9b97('0x3a')](_0x2799d1[_0x9b97('0x38')],{'$or':_['map'](_0x2799d1[_0x9b97('0x34')],function(_0x1790b2){var _0x348696={};_0x348696[_0x1790b2]={'$like':'%'+_0x1305c2[_0x9b97('0x30')][_0x9b97('0x3c')]+'%'};return _0x348696;})});}_0x2799d1=_[_0x9b97('0x3a')]({},_0x2799d1,_0x1305c2[_0x9b97('0x3d')]);return _0x16b0c1['getDescriptions'](_0x2799d1);}})['then'](function(_0x5e0d04){if(_0x5e0d04){_0x329ab6=_0x5e0d04[_0x9b97('0x36')];if(!_0x1305c2[_0x9b97('0x30')][_0x9b97('0x4e')](_0x9b97('0x4c'))){_0x2799d1[_0x9b97('0x19')]=qs[_0x9b97('0x19')](_0x1305c2[_0x9b97('0x30')][_0x9b97('0x19')]);_0x2799d1['offset']=qs[_0x9b97('0x1b')](_0x1305c2[_0x9b97('0x30')][_0x9b97('0x1b')]);}return _0x16b0c1[_0x9b97('0x4f')](_0x2799d1);}})[_0x9b97('0x22')](function(_0x23dff2){if(_0x23dff2){return _0x23dff2?{'count':_0x329ab6,'rows':_0x23dff2}:null;}})[_0x9b97('0x22')](respondWithResult(_0x242083,null))['catch'](handleError(_0x242083,null));}; \ No newline at end of file +var _0xe75c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','offset','limit','set','reject','then','destroy','sendStatus','error','name','send','index','map','ServicenowConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','merge','count','include','rows','catch','show','params','rawAttributes','includeAll','options','create','update','body','find','getFields','hasOwnProperty','getSubjects','findOne','ServicenowField','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x2f79e6,_0x585c3f){var _0x1e1789=function(_0x361f3b){while(--_0x361f3b){_0x2f79e6['push'](_0x2f79e6['shift']());}};_0x1e1789(++_0x585c3f);}(_0xe75c,0xd3));var _0xce75=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe75c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xce75('0x0'));var rimraf=require(_0xce75('0x1'));var zipdir=require(_0xce75('0x2'));var jsonpatch=require(_0xce75('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce75('0x4'));var Mustache=require('mustache');var util=require(_0xce75('0x5'));var path=require(_0xce75('0x6'));var sox=require(_0xce75('0x7'));var csv=require('to-csv');var ejs=require(_0xce75('0x8'));var fs=require('fs');var fs_extra=require(_0xce75('0x9'));var _=require(_0xce75('0xa'));var squel=require(_0xce75('0xb'));var crypto=require(_0xce75('0xc'));var jsforce=require(_0xce75('0xd'));var deskjs=require(_0xce75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce75('0xf'));var Redis=require('ioredis');var authService=require(_0xce75('0x10'));var qs=require(_0xce75('0x11'));var as=require(_0xce75('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce75('0x13'))('api');var utils=require(_0xce75('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xce75('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588dda,_0xd86f4a){_0xd86f4a=_0xd86f4a||0xcc;return function(_0xdcac8){if(_0xdcac8){return _0x588dda['sendStatus'](_0xd86f4a);}return _0x588dda['status'](_0xd86f4a)[_0xce75('0x16')]();};}function respondWithResult(_0x45c5ff,_0x21e396){_0x21e396=_0x21e396||0xc8;return function(_0x1f8134){if(_0x1f8134){return _0x45c5ff[_0xce75('0x17')](_0x21e396)[_0xce75('0x18')](_0x1f8134);}};}function respondWithFilteredResult(_0x14f4d7,_0x139b2a){return function(_0x13bc7a){if(_0x13bc7a){var _0x33f5ab=typeof _0x139b2a['offset']===_0xce75('0x19')&&typeof _0x139b2a['limit']===_0xce75('0x19');var _0x5aaeaf=_0x13bc7a['count'];var _0x342fd8=_0x33f5ab?0x0:_0x139b2a['offset'];var _0xd72dfd=_0x33f5ab?_0x13bc7a['count']:_0x139b2a[_0xce75('0x1a')]+_0x139b2a[_0xce75('0x1b')];var _0x42ef7b;if(_0xd72dfd>=_0x5aaeaf){_0xd72dfd=_0x5aaeaf;_0x42ef7b=0xc8;}else{_0x42ef7b=0xce;}_0x14f4d7[_0xce75('0x17')](_0x42ef7b);return _0x14f4d7[_0xce75('0x1c')]('Content-Range',_0x342fd8+'-'+_0xd72dfd+'/'+_0x5aaeaf)['json'](_0x13bc7a);}return null;};}function patchUpdates(_0x5db794){return function(_0x17ebcf){try{jsonpatch['apply'](_0x17ebcf,_0x5db794,!![]);}catch(_0x16dbf1){return BPromise[_0xce75('0x1d')](_0x16dbf1);}return _0x17ebcf['save']();};}function saveUpdates(_0x506701,_0x5a0813){return function(_0x2b49f1){if(_0x2b49f1){return _0x2b49f1['update'](_0x506701)[_0xce75('0x1e')](function(_0x5400da){return _0x5400da;});}return null;};}function removeEntity(_0x131019,_0x19775c){return function(_0x424b1d){if(_0x424b1d){return _0x424b1d[_0xce75('0x1f')]()[_0xce75('0x1e')](function(){_0x131019[_0xce75('0x17')](0xcc)[_0xce75('0x16')]();});}};}function handleEntityNotFound(_0x578575,_0x50ca17){return function(_0x1dada1){if(!_0x1dada1){_0x578575[_0xce75('0x20')](0x194);}return _0x1dada1;};}function handleError(_0x50f1d6,_0x125961){_0x125961=_0x125961||0x1f4;return function(_0x5ee1ea){logger[_0xce75('0x21')](_0x5ee1ea['stack']);if(_0x5ee1ea['name']){delete _0x5ee1ea[_0xce75('0x22')];}_0x50f1d6['status'](_0x125961)[_0xce75('0x23')](_0x5ee1ea);};}exports[_0xce75('0x24')]=function(_0x52cc33,_0xe81b26){var _0x2b8223={},_0x268bc3={},_0x3d5467={'count':0x0,'rows':[]};var _0x415471=_[_0xce75('0x25')](db[_0xce75('0x26')]['rawAttributes'],function(_0x542188){return{'name':_0x542188[_0xce75('0x27')],'type':_0x542188['type'][_0xce75('0x28')]};});_0x268bc3[_0xce75('0x29')]=_['map'](_0x415471,'name');_0x268bc3[_0xce75('0x2a')]=_[_0xce75('0x2b')](_0x52cc33[_0xce75('0x2a')]);_0x268bc3[_0xce75('0x2c')]=_[_0xce75('0x2d')](_0x268bc3[_0xce75('0x29')],_0x268bc3['query']);_0x2b8223[_0xce75('0x2e')]=_['intersection'](_0x268bc3[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x52cc33['query'][_0xce75('0x2f')]));_0x2b8223['attributes']=_0x2b8223[_0xce75('0x2e')][_0xce75('0x30')]?_0x2b8223[_0xce75('0x2e')]:_0x268bc3[_0xce75('0x29')];if(!_0x52cc33[_0xce75('0x2a')]['hasOwnProperty'](_0xce75('0x31'))){_0x2b8223[_0xce75('0x1b')]=qs['limit'](_0x52cc33[_0xce75('0x2a')][_0xce75('0x1b')]);_0x2b8223[_0xce75('0x1a')]=qs[_0xce75('0x1a')](_0x52cc33['query'][_0xce75('0x1a')]);}_0x2b8223['order']=qs[_0xce75('0x32')](_0x52cc33[_0xce75('0x2a')][_0xce75('0x32')]);_0x2b8223[_0xce75('0x33')]=qs[_0xce75('0x2c')](_[_0xce75('0x34')](_0x52cc33['query'],_0x268bc3[_0xce75('0x2c')]),_0x415471);if(_0x52cc33[_0xce75('0x2a')][_0xce75('0x35')]){_0x2b8223['where']=_['merge'](_0x2b8223[_0xce75('0x33')],{'$or':_[_0xce75('0x25')](_0x415471,function(_0x58e914){if(_0x58e914[_0xce75('0x36')]!=='VIRTUAL'){var _0x7a181e={};_0x7a181e[_0x58e914[_0xce75('0x22')]]={'$like':'%'+_0x52cc33[_0xce75('0x2a')]['filter']+'%'};return _0x7a181e;}})});}_0x2b8223=_[_0xce75('0x37')]({},_0x2b8223,_0x52cc33['options']);var _0x5e51bb={'where':_0x2b8223[_0xce75('0x33')]};return db['ServicenowConfiguration'][_0xce75('0x38')](_0x5e51bb)['then'](function(_0x235067){_0x3d5467['count']=_0x235067;if(_0x52cc33[_0xce75('0x2a')]['includeAll']){_0x2b8223[_0xce75('0x39')]=[{'all':!![]}];}return db[_0xce75('0x26')]['findAll'](_0x2b8223);})[_0xce75('0x1e')](function(_0x556680){_0x3d5467[_0xce75('0x3a')]=_0x556680;return _0x3d5467;})[_0xce75('0x1e')](respondWithFilteredResult(_0xe81b26,_0x2b8223))[_0xce75('0x3b')](handleError(_0xe81b26,null));};exports[_0xce75('0x3c')]=function(_0x5e8d0d,_0x5177d7){var _0x10a24d={'raw':![],'where':{'id':_0x5e8d0d[_0xce75('0x3d')]['id']}},_0x29b3b3={};_0x29b3b3[_0xce75('0x29')]=_[_0xce75('0x2b')](db[_0xce75('0x26')][_0xce75('0x3e')]);_0x29b3b3[_0xce75('0x2a')]=_[_0xce75('0x2b')](_0x5e8d0d[_0xce75('0x2a')]);_0x29b3b3[_0xce75('0x2c')]=_['intersection'](_0x29b3b3[_0xce75('0x29')],_0x29b3b3[_0xce75('0x2a')]);_0x10a24d['attributes']=_[_0xce75('0x2d')](_0x29b3b3['model'],qs['fields'](_0x5e8d0d['query']['fields']));_0x10a24d['attributes']=_0x10a24d[_0xce75('0x2e')]['length']?_0x10a24d[_0xce75('0x2e')]:_0x29b3b3['model'];if(_0x5e8d0d[_0xce75('0x2a')][_0xce75('0x3f')]){_0x10a24d[_0xce75('0x39')]=[{'all':!![]}];}_0x10a24d=_['merge']({},_0x10a24d,_0x5e8d0d[_0xce75('0x40')]);return db[_0xce75('0x26')]['find'](_0x10a24d)[_0xce75('0x1e')](handleEntityNotFound(_0x5177d7,null))['then'](respondWithResult(_0x5177d7,null))[_0xce75('0x3b')](handleError(_0x5177d7,null));};exports[_0xce75('0x41')]=function(_0x47aea1,_0x15a49){return db[_0xce75('0x26')][_0xce75('0x41')](_0x47aea1['body'],{})[_0xce75('0x1e')](respondWithResult(_0x15a49,0xc9))['catch'](handleError(_0x15a49,null));};exports[_0xce75('0x42')]=function(_0xd71cd7,_0x3f94ee){if(_0xd71cd7['body']['id']){delete _0xd71cd7[_0xce75('0x43')]['id'];}return db[_0xce75('0x26')][_0xce75('0x44')]({'where':{'id':_0xd71cd7[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0x3f94ee,null))[_0xce75('0x1e')](saveUpdates(_0xd71cd7[_0xce75('0x43')],null))[_0xce75('0x1e')](respondWithResult(_0x3f94ee,null))[_0xce75('0x3b')](handleError(_0x3f94ee,null));};exports[_0xce75('0x1f')]=function(_0x4ebba3,_0x9f1d81){return db[_0xce75('0x26')][_0xce75('0x44')]({'where':{'id':_0x4ebba3[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0x9f1d81,null))[_0xce75('0x1e')](removeEntity(_0x9f1d81,null))['catch'](handleError(_0x9f1d81,null));};exports[_0xce75('0x45')]=function(_0x1c1757,_0xa86aac,_0x339415){var _0x3cc737={};var _0x18c528={};var _0x31d66a;var _0x5eb9cf;return db[_0xce75('0x26')]['findOne']({'where':{'id':_0x1c1757[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0xa86aac,null))[_0xce75('0x1e')](function(_0x204826){if(_0x204826){_0x31d66a=_0x204826;_0x18c528[_0xce75('0x29')]=_['keys'](db['ServicenowField'][_0xce75('0x3e')]);_0x18c528[_0xce75('0x2a')]=_['keys'](_0x1c1757['query']);_0x18c528['filters']=_[_0xce75('0x2d')](_0x18c528[_0xce75('0x29')],_0x18c528['query']);_0x3cc737[_0xce75('0x2e')]=_[_0xce75('0x2d')](_0x18c528[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x2f')]));_0x3cc737[_0xce75('0x2e')]=_0x3cc737[_0xce75('0x2e')][_0xce75('0x30')]?_0x3cc737[_0xce75('0x2e')]:_0x18c528[_0xce75('0x29')];_0x3cc737['order']=qs[_0xce75('0x32')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x32')]);_0x3cc737[_0xce75('0x33')]=qs['filters'](_[_0xce75('0x34')](_0x1c1757[_0xce75('0x2a')],_0x18c528[_0xce75('0x2c')]));if(_0x1c1757[_0xce75('0x2a')][_0xce75('0x35')]){_0x3cc737['where']=_[_0xce75('0x37')](_0x3cc737[_0xce75('0x33')],{'$or':_[_0xce75('0x25')](_0x3cc737[_0xce75('0x2e')],function(_0x17b39e){var _0x1e9f50={};_0x1e9f50[_0x17b39e]={'$like':'%'+_0x1c1757['query'][_0xce75('0x35')]+'%'};return _0x1e9f50;})});}_0x3cc737=_[_0xce75('0x37')]({},_0x3cc737,_0x1c1757[_0xce75('0x40')]);return _0x31d66a['getFields'](_0x3cc737);}})['then'](function(_0x4e83d4){if(_0x4e83d4){_0x5eb9cf=_0x4e83d4[_0xce75('0x30')];if(!_0x1c1757[_0xce75('0x2a')][_0xce75('0x46')](_0xce75('0x31'))){_0x3cc737[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x1b')]);_0x3cc737['offset']=qs[_0xce75('0x1a')](_0x1c1757[_0xce75('0x2a')][_0xce75('0x1a')]);}return _0x31d66a[_0xce75('0x45')](_0x3cc737);}})[_0xce75('0x1e')](function(_0x59c187){if(_0x59c187){return _0x59c187?{'count':_0x5eb9cf,'rows':_0x59c187}:null;}})[_0xce75('0x1e')](respondWithResult(_0xa86aac,null))[_0xce75('0x3b')](handleError(_0xa86aac,null));};exports[_0xce75('0x47')]=function(_0x1de46a,_0x809049,_0x3073cb){var _0x4c7125={};var _0x149013={};var _0x525da7;var _0x1c83f5;return db[_0xce75('0x26')][_0xce75('0x48')]({'where':{'id':_0x1de46a[_0xce75('0x3d')]['id']}})[_0xce75('0x1e')](handleEntityNotFound(_0x809049,null))[_0xce75('0x1e')](function(_0x5783c7){if(_0x5783c7){_0x525da7=_0x5783c7;_0x149013[_0xce75('0x29')]=_[_0xce75('0x2b')](db[_0xce75('0x49')][_0xce75('0x3e')]);_0x149013['query']=_[_0xce75('0x2b')](_0x1de46a[_0xce75('0x2a')]);_0x149013['filters']=_[_0xce75('0x2d')](_0x149013[_0xce75('0x29')],_0x149013['query']);_0x4c7125[_0xce75('0x2e')]=_[_0xce75('0x2d')](_0x149013[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x1de46a['query'][_0xce75('0x2f')]));_0x4c7125[_0xce75('0x2e')]=_0x4c7125[_0xce75('0x2e')][_0xce75('0x30')]?_0x4c7125['attributes']:_0x149013['model'];_0x4c7125[_0xce75('0x4a')]=qs[_0xce75('0x32')](_0x1de46a[_0xce75('0x2a')][_0xce75('0x32')]);_0x4c7125[_0xce75('0x33')]=qs[_0xce75('0x2c')](_[_0xce75('0x34')](_0x1de46a[_0xce75('0x2a')],_0x149013['filters']));if(_0x1de46a['query'][_0xce75('0x35')]){_0x4c7125[_0xce75('0x33')]=_[_0xce75('0x37')](_0x4c7125[_0xce75('0x33')],{'$or':_[_0xce75('0x25')](_0x4c7125[_0xce75('0x2e')],function(_0x1ceb21){var _0x2d2d36={};_0x2d2d36[_0x1ceb21]={'$like':'%'+_0x1de46a[_0xce75('0x2a')]['filter']+'%'};return _0x2d2d36;})});}_0x4c7125=_[_0xce75('0x37')]({},_0x4c7125,_0x1de46a[_0xce75('0x40')]);return _0x525da7[_0xce75('0x47')](_0x4c7125);}})[_0xce75('0x1e')](function(_0x422af9){if(_0x422af9){_0x1c83f5=_0x422af9[_0xce75('0x30')];if(!_0x1de46a[_0xce75('0x2a')][_0xce75('0x46')](_0xce75('0x31'))){_0x4c7125[_0xce75('0x1b')]=qs['limit'](_0x1de46a[_0xce75('0x2a')][_0xce75('0x1b')]);_0x4c7125[_0xce75('0x1a')]=qs[_0xce75('0x1a')](_0x1de46a[_0xce75('0x2a')][_0xce75('0x1a')]);}return _0x525da7['getSubjects'](_0x4c7125);}})[_0xce75('0x1e')](function(_0x25878c){if(_0x25878c){return _0x25878c?{'count':_0x1c83f5,'rows':_0x25878c}:null;}})[_0xce75('0x1e')](respondWithResult(_0x809049,null))[_0xce75('0x3b')](handleError(_0x809049,null));};exports['getDescriptions']=function(_0x54dc2e,_0x5c0d8a,_0x2a6a06){var _0x5a9690={};var _0x1958e3={};var _0x4111a5;var _0x1c9cae;return db[_0xce75('0x26')][_0xce75('0x48')]({'where':{'id':_0x54dc2e[_0xce75('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5c0d8a,null))[_0xce75('0x1e')](function(_0x597aed){if(_0x597aed){_0x4111a5=_0x597aed;_0x1958e3['model']=_['keys'](db[_0xce75('0x49')][_0xce75('0x3e')]);_0x1958e3[_0xce75('0x2a')]=_['keys'](_0x54dc2e[_0xce75('0x2a')]);_0x1958e3[_0xce75('0x2c')]=_[_0xce75('0x2d')](_0x1958e3['model'],_0x1958e3[_0xce75('0x2a')]);_0x5a9690['attributes']=_[_0xce75('0x2d')](_0x1958e3[_0xce75('0x29')],qs[_0xce75('0x2f')](_0x54dc2e[_0xce75('0x2a')]['fields']));_0x5a9690[_0xce75('0x2e')]=_0x5a9690[_0xce75('0x2e')][_0xce75('0x30')]?_0x5a9690[_0xce75('0x2e')]:_0x1958e3[_0xce75('0x29')];_0x5a9690[_0xce75('0x4a')]=qs['sort'](_0x54dc2e[_0xce75('0x2a')][_0xce75('0x32')]);_0x5a9690[_0xce75('0x33')]=qs[_0xce75('0x2c')](_[_0xce75('0x34')](_0x54dc2e[_0xce75('0x2a')],_0x1958e3[_0xce75('0x2c')]));if(_0x54dc2e['query']['filter']){_0x5a9690['where']=_[_0xce75('0x37')](_0x5a9690['where'],{'$or':_[_0xce75('0x25')](_0x5a9690[_0xce75('0x2e')],function(_0x484ca2){var _0x2062cf={};_0x2062cf[_0x484ca2]={'$like':'%'+_0x54dc2e['query'][_0xce75('0x35')]+'%'};return _0x2062cf;})});}_0x5a9690=_[_0xce75('0x37')]({},_0x5a9690,_0x54dc2e[_0xce75('0x40')]);return _0x4111a5[_0xce75('0x4b')](_0x5a9690);}})[_0xce75('0x1e')](function(_0x4cdb00){if(_0x4cdb00){_0x1c9cae=_0x4cdb00['length'];if(!_0x54dc2e[_0xce75('0x2a')]['hasOwnProperty'](_0xce75('0x31'))){_0x5a9690[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x54dc2e[_0xce75('0x2a')]['limit']);_0x5a9690[_0xce75('0x1a')]=qs[_0xce75('0x1a')](_0x54dc2e[_0xce75('0x2a')]['offset']);}return _0x4111a5[_0xce75('0x4b')](_0x5a9690);}})[_0xce75('0x1e')](function(_0x76408e){if(_0x76408e){return _0x76408e?{'count':_0x1c9cae,'rows':_0x76408e}:null;}})[_0xce75('0x1e')](respondWithResult(_0x5c0d8a,null))[_0xce75('0x3b')](handleError(_0x5c0d8a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0cdc792..1ce452a 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 _0xa9e1=['int_servicenow_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','exports','define','ServicenowConfiguration'];(function(_0x5ed5f2,_0x4d984c){var _0x34166a=function(_0x1d01c7){while(--_0x1d01c7){_0x5ed5f2['push'](_0x5ed5f2['shift']());}};_0x34166a(++_0x4d984c);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0xa9e1[_0x581249];return _0x284bae;};'use strict';var _=require(_0x1a9e('0x0'));var util=require(_0x1a9e('0x1'));var logger=require('../../config/logger')(_0x1a9e('0x2'));var moment=require(_0x1a9e('0x3'));var BPromise=require(_0x1a9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a9e('0x5'));var rimraf=require('rimraf');var config=require(_0x1a9e('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x1a9e('0x7')]=function(_0x40c9b0,_0x1bdcd9){return _0x40c9b0[_0x1a9e('0x8')](_0x1a9e('0x9'),attributes,{'tableName':_0x1a9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2da=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x11fef9,_0x47c98e){var _0x1012c7=function(_0x523c03){while(--_0x523c03){_0x11fef9['push'](_0x11fef9['shift']());}};_0x1012c7(++_0x47c98e);}(_0xc2da,0x124));var _0xac2d=function(_0x1785e8,_0x492aac){_0x1785e8=_0x1785e8-0x0;var _0x5e6021=_0xc2da[_0x1785e8];return _0x5e6021;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var logger=require(_0xac2d('0x1'))('api');var moment=require(_0xac2d('0x2'));var BPromise=require('bluebird');var rp=require(_0xac2d('0x3'));var fs=require('fs');var path=require(_0xac2d('0x4'));var rimraf=require(_0xac2d('0x5'));var config=require(_0xac2d('0x6'));var attributes=require(_0xac2d('0x7'));module[_0xac2d('0x8')]=function(_0x3db400,_0x133e22){return _0x3db400[_0xac2d('0x9')](_0xac2d('0xa'),attributes,{'tableName':_0xac2d('0xb'),'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 5286a3e..70026c4 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 _0xf40b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0xf0ab7c,_0x23bbc2){var _0x198144=function(_0x1c3a40){while(--_0x1c3a40){_0xf0ab7c['push'](_0xf0ab7c['shift']());}};_0x198144(++_0x23bbc2);}(_0xf40b,0xf7));var _0xbf40=function(_0x2d8db5,_0x3c9c8d){_0x2d8db5=_0x2d8db5-0x0;var _0xdc5579=_0xf40b[_0x2d8db5];return _0xdc5579;};'use strict';var _=require(_0xbf40('0x0'));var util=require('util');var moment=require(_0xbf40('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf40('0x2'));var fs=require('fs');var Redis=require(_0xbf40('0x3'));var db=require(_0xbf40('0x4'))['db'];var utils=require(_0xbf40('0x5'));var logger=require(_0xbf40('0x6'))(_0xbf40('0x7'));var config=require(_0xbf40('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbf40('0x9')][_0xbf40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cf99,_0xe904db,_0x195365){return new BPromise(function(_0x249cf0,_0x1901ba){return client[_0xbf40('0xb')](_0x2cf99,_0x195365)[_0xbf40('0xc')](function(_0x386422){logger[_0xbf40('0xd')](_0xbf40('0xe'),_0xe904db,_0xbf40('0xf'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xe904db,_0xbf40('0xf'),JSON[_0xbf40('0x10')](_0x386422));if(_0x386422[_0xbf40('0x11')]){if(_0x386422[_0xbf40('0x11')]['code']===0x1f4){logger[_0xbf40('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xe904db,_0x386422[_0xbf40('0x11')][_0xbf40('0x12')]);return _0x1901ba(_0x386422[_0xbf40('0x11')]['message']);}logger[_0xbf40('0x11')](_0xbf40('0xe'),_0xe904db,_0x386422[_0xbf40('0x11')][_0xbf40('0x12')]);return _0x249cf0(_0x386422[_0xbf40('0x11')][_0xbf40('0x12')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0xe904db,'request\x20sent');_0x249cf0(_0x386422[_0xbf40('0x13')][_0xbf40('0x12')]);}})[_0xbf40('0x14')](function(_0x1a76d3){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xe904db,_0x1a76d3);_0x1901ba(_0x1a76d3);});});} \ No newline at end of file +var _0x8124=['then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1fc2ce,_0x2eeaf9){var _0x4eae69=function(_0xb3de9c){while(--_0xb3de9c){_0x1fc2ce['push'](_0x1fc2ce['shift']());}};_0x4eae69(++_0x2eeaf9);}(_0x8124,0x79));var _0x4812=function(_0x213f3d,_0x31c31f){_0x213f3d=_0x213f3d-0x0;var _0x238251=_0x8124[_0x213f3d];return _0x238251;};'use strict';var _=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var moment=require('moment');var BPromise=require(_0x4812('0x2'));var rs=require(_0x4812('0x3'));var fs=require('fs');var Redis=require(_0x4812('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4812('0x5'));var logger=require('../../config/logger')(_0x4812('0x6'));var config=require(_0x4812('0x7'));var jayson=require(_0x4812('0x8'));var client=jayson[_0x4812('0x9')][_0x4812('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aa561,_0x2adac1,_0x15579a){return new BPromise(function(_0x1d545b,_0x5061ae){return client['request'](_0x3aa561,_0x15579a)[_0x4812('0xb')](function(_0x13a707){logger[_0x4812('0xc')](_0x4812('0xd'),_0x2adac1,'request\x20sent');logger[_0x4812('0xe')](_0x4812('0xf'),_0x2adac1,_0x4812('0x10'),JSON[_0x4812('0x11')](_0x13a707));if(_0x13a707[_0x4812('0x12')]){if(_0x13a707['error'][_0x4812('0x13')]===0x1f4){logger[_0x4812('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2adac1,_0x13a707[_0x4812('0x12')][_0x4812('0x14')]);return _0x5061ae(_0x13a707['error'][_0x4812('0x14')]);}logger[_0x4812('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2adac1,_0x13a707[_0x4812('0x12')][_0x4812('0x14')]);return _0x1d545b(_0x13a707[_0x4812('0x12')][_0x4812('0x14')]);}else{logger[_0x4812('0xc')](_0x4812('0xd'),_0x2adac1,_0x4812('0x10'));_0x1d545b(_0x13a707[_0x4812('0x15')][_0x4812('0x14')]);}})['catch'](function(_0x861e04){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2adac1,_0x861e04);_0x5061ae(_0x861e04);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3cee74d..2c0ec42 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 _0x931a=['Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','post','put','update','delete','multer','path','connect-timeout','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x931a,0x1ec));var _0xa931=function(_0x5dd6cf,_0x5aecf8){_0x5dd6cf=_0x5dd6cf-0x0;var _0x252ff7=_0x931a[_0x5dd6cf];return _0x252ff7;};'use strict';var multer=require(_0xa931('0x0'));var util=require('util');var path=require(_0xa931('0x1'));var timeout=require(_0xa931('0x2'));var express=require(_0xa931('0x3'));var router=express[_0xa931('0x4')]();var fs_extra=require(_0xa931('0x5'));var auth=require(_0xa931('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa931('0x7'));var controller=require(_0xa931('0x8'));router[_0xa931('0x9')]('/',auth[_0xa931('0xa')](),controller['index']);router[_0xa931('0x9')](_0xa931('0xb'),auth[_0xa931('0xa')](),controller['show']);router[_0xa931('0xc')]('/',auth[_0xa931('0xa')](),controller['create']);router[_0xa931('0xd')](_0xa931('0xb'),auth[_0xa931('0xa')](),controller[_0xa931('0xe')]);router[_0xa931('0xf')]('/:id',auth[_0xa931('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d77=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','/:id','show','put','update','delete','exports'];(function(_0xeb7786,_0x53a053){var _0x120bbc=function(_0x291f05){while(--_0x291f05){_0xeb7786['push'](_0xeb7786['shift']());}};_0x120bbc(++_0x53a053);}(_0x3d77,0xc6));var _0x73d7=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x3d77[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x73d7('0x0'));var util=require(_0x73d7('0x1'));var path=require(_0x73d7('0x2'));var timeout=require(_0x73d7('0x3'));var express=require(_0x73d7('0x4'));var router=express[_0x73d7('0x5')]();var fs_extra=require(_0x73d7('0x6'));var auth=require(_0x73d7('0x7'));var interaction=require(_0x73d7('0x8'));var config=require(_0x73d7('0x9'));var controller=require(_0x73d7('0xa'));router['get']('/',auth[_0x73d7('0xb')](),controller['index']);router['get'](_0x73d7('0xc'),auth[_0x73d7('0xb')](),controller[_0x73d7('0xd')]);router['post']('/',auth[_0x73d7('0xb')](),controller['create']);router[_0x73d7('0xe')](_0x73d7('0xc'),auth[_0x73d7('0xb')](),controller[_0x73d7('0xf')]);router[_0x73d7('0x10')](_0x73d7('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x73d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 13e5a4f..6d47ee6 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 _0x5f1d=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x5f1d,0x180));var _0xd5f1=function(_0x581bef,_0x55ca24){_0x581bef=_0x581bef-0x0;var _0x303bf4=_0x5f1d[_0x581bef];return _0x303bf4;};'use strict';var Sequelize=require(_0xd5f1('0x0'));module[_0xd5f1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd5f1('0x2'),_0xd5f1('0x3'),_0xd5f1('0x4'),_0xd5f1('0x5'),_0xd5f1('0x6')),'defaultValue':_0xd5f1('0x2')},'content':{'type':Sequelize[_0xd5f1('0x7')]},'key':{'type':Sequelize[_0xd5f1('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xd5f1('0x2'),_0xd5f1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd5f1('0x7')]},'nameField':{'type':Sequelize[_0xd5f1('0x7')]},'customField':{'type':Sequelize[_0xd5f1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd979=['ENUM','string','variable','picklist','STRING','customVariable','sequelize','exports'];(function(_0x15e0ce,_0xa61306){var _0x495ba4=function(_0x48ab8e){while(--_0x48ab8e){_0x15e0ce['push'](_0x15e0ce['shift']());}};_0x495ba4(++_0xa61306);}(_0xd979,0x1be));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d97('0x0'));module[_0x9d97('0x1')]={'type':{'type':Sequelize[_0x9d97('0x2')](_0x9d97('0x3'),_0x9d97('0x4'),'customVariable','keyValue',_0x9d97('0x5')),'defaultValue':_0x9d97('0x3')},'content':{'type':Sequelize[_0x9d97('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d97('0x2')]('string',_0x9d97('0x4'),_0x9d97('0x7'))},'keyContent':{'type':Sequelize[_0x9d97('0x6')]},'idField':{'type':Sequelize[_0x9d97('0x6')]},'nameField':{'type':Sequelize[_0x9d97('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d97('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 6cc5982..5671afa 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 _0xc90d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','error','stack','name','send','ServicenowField','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','params','rawAttributes','fields','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x29f5e8,_0x56d13d){var _0x3fc4db=function(_0x1bb796){while(--_0x1bb796){_0x29f5e8['push'](_0x29f5e8['shift']());}};_0x3fc4db(++_0x56d13d);}(_0xc90d,0x11e));var _0xdc90=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0xc90d[_0x5550b3];return _0x4b8fc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc90('0x0'));var zipdir=require(_0xdc90('0x1'));var jsonpatch=require(_0xdc90('0x2'));var rp=require(_0xdc90('0x3'));var moment=require(_0xdc90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc90('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdc90('0x6'));var csv=require('to-csv');var ejs=require(_0xdc90('0x7'));var fs=require('fs');var fs_extra=require(_0xdc90('0x8'));var _=require(_0xdc90('0x9'));var squel=require('squel');var crypto=require(_0xdc90('0xa'));var jsforce=require(_0xdc90('0xb'));var deskjs=require(_0xdc90('0xc'));var toCsv=require(_0xdc90('0xd'));var querystring=require(_0xdc90('0xe'));var Papa=require(_0xdc90('0xf'));var Redis=require(_0xdc90('0x10'));var authService=require(_0xdc90('0x11'));var qs=require(_0xdc90('0x12'));var as=require(_0xdc90('0x13'));var hardwareService=require(_0xdc90('0x14'));var logger=require(_0xdc90('0x15'))(_0xdc90('0x16'));var utils=require(_0xdc90('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdc90('0x18'));var db=require(_0xdc90('0x19'))['db'];function respondWithStatusCode(_0x5a51d8,_0x2f98c5){_0x2f98c5=_0x2f98c5||0xcc;return function(_0x45c035){if(_0x45c035){return _0x5a51d8[_0xdc90('0x1a')](_0x2f98c5);}return _0x5a51d8[_0xdc90('0x1b')](_0x2f98c5)[_0xdc90('0x1c')]();};}function respondWithResult(_0x4541a3,_0x1c97c8){_0x1c97c8=_0x1c97c8||0xc8;return function(_0x1c10f9){if(_0x1c10f9){return _0x4541a3[_0xdc90('0x1b')](_0x1c97c8)[_0xdc90('0x1d')](_0x1c10f9);}};}function respondWithFilteredResult(_0x5498d4,_0x106b7b){return function(_0x52fdf0){if(_0x52fdf0){var _0x228158=typeof _0x106b7b[_0xdc90('0x1e')]===_0xdc90('0x1f')&&typeof _0x106b7b[_0xdc90('0x20')]===_0xdc90('0x1f');var _0x2efca7=_0x52fdf0[_0xdc90('0x21')];var _0x375e23=_0x228158?0x0:_0x106b7b[_0xdc90('0x1e')];var _0x37c84e=_0x228158?_0x52fdf0[_0xdc90('0x21')]:_0x106b7b[_0xdc90('0x1e')]+_0x106b7b[_0xdc90('0x20')];var _0x3ff02a;if(_0x37c84e>=_0x2efca7){_0x37c84e=_0x2efca7;_0x3ff02a=0xc8;}else{_0x3ff02a=0xce;}_0x5498d4[_0xdc90('0x1b')](_0x3ff02a);return _0x5498d4[_0xdc90('0x22')]('Content-Range',_0x375e23+'-'+_0x37c84e+'/'+_0x2efca7)[_0xdc90('0x1d')](_0x52fdf0);}return null;};}function patchUpdates(_0x340771){return function(_0xbf0943){try{jsonpatch[_0xdc90('0x23')](_0xbf0943,_0x340771,!![]);}catch(_0x4cc942){return BPromise[_0xdc90('0x24')](_0x4cc942);}return _0xbf0943['save']();};}function saveUpdates(_0x7d446d,_0x8a62f7){return function(_0x2ebff4){if(_0x2ebff4){return _0x2ebff4['update'](_0x7d446d)['then'](function(_0x41b5dd){return _0x41b5dd;});}return null;};}function removeEntity(_0x26bd0f,_0x441115){return function(_0x978526){if(_0x978526){return _0x978526[_0xdc90('0x25')]()[_0xdc90('0x26')](function(){_0x26bd0f['status'](0xcc)[_0xdc90('0x1c')]();});}};}function handleEntityNotFound(_0x1c6607,_0x44261c){return function(_0x1a799f){if(!_0x1a799f){_0x1c6607['sendStatus'](0x194);}return _0x1a799f;};}function handleError(_0xce0f92,_0x48eb07){_0x48eb07=_0x48eb07||0x1f4;return function(_0x139f87){logger[_0xdc90('0x27')](_0x139f87[_0xdc90('0x28')]);if(_0x139f87['name']){delete _0x139f87[_0xdc90('0x29')];}_0xce0f92[_0xdc90('0x1b')](_0x48eb07)[_0xdc90('0x2a')](_0x139f87);};}exports['index']=function(_0x4752f4,_0x13dff5){var _0x1db0d2={},_0x2b16fc={},_0x120499={'count':0x0,'rows':[]};var _0x6803d8=_['map'](db[_0xdc90('0x2b')]['rawAttributes'],function(_0x3caec5){return{'name':_0x3caec5[_0xdc90('0x2c')],'type':_0x3caec5[_0xdc90('0x2d')][_0xdc90('0x2e')]};});_0x2b16fc['model']=_[_0xdc90('0x2f')](_0x6803d8,_0xdc90('0x29'));_0x2b16fc[_0xdc90('0x30')]=_[_0xdc90('0x31')](_0x4752f4['query']);_0x2b16fc[_0xdc90('0x32')]=_[_0xdc90('0x33')](_0x2b16fc[_0xdc90('0x34')],_0x2b16fc[_0xdc90('0x30')]);_0x1db0d2[_0xdc90('0x35')]=_[_0xdc90('0x33')](_0x2b16fc[_0xdc90('0x34')],qs['fields'](_0x4752f4[_0xdc90('0x30')]['fields']));_0x1db0d2[_0xdc90('0x35')]=_0x1db0d2['attributes'][_0xdc90('0x36')]?_0x1db0d2['attributes']:_0x2b16fc[_0xdc90('0x34')];if(!_0x4752f4[_0xdc90('0x30')][_0xdc90('0x37')](_0xdc90('0x38'))){_0x1db0d2[_0xdc90('0x20')]=qs[_0xdc90('0x20')](_0x4752f4[_0xdc90('0x30')][_0xdc90('0x20')]);_0x1db0d2[_0xdc90('0x1e')]=qs[_0xdc90('0x1e')](_0x4752f4[_0xdc90('0x30')][_0xdc90('0x1e')]);}_0x1db0d2[_0xdc90('0x39')]=qs[_0xdc90('0x3a')](_0x4752f4[_0xdc90('0x30')][_0xdc90('0x3a')]);_0x1db0d2[_0xdc90('0x3b')]=qs[_0xdc90('0x32')](_[_0xdc90('0x3c')](_0x4752f4[_0xdc90('0x30')],_0x2b16fc[_0xdc90('0x32')]),_0x6803d8);if(_0x4752f4['query']['filter']){_0x1db0d2[_0xdc90('0x3b')]=_['merge'](_0x1db0d2[_0xdc90('0x3b')],{'$or':_['map'](_0x6803d8,function(_0x5945be){if(_0x5945be[_0xdc90('0x2d')]!==_0xdc90('0x3d')){var _0x3822e4={};_0x3822e4[_0x5945be[_0xdc90('0x29')]]={'$like':'%'+_0x4752f4[_0xdc90('0x30')][_0xdc90('0x3e')]+'%'};return _0x3822e4;}})});}_0x1db0d2=_[_0xdc90('0x3f')]({},_0x1db0d2,_0x4752f4[_0xdc90('0x40')]);var _0x346e82={'where':_0x1db0d2[_0xdc90('0x3b')]};return db[_0xdc90('0x2b')][_0xdc90('0x21')](_0x346e82)[_0xdc90('0x26')](function(_0x3c2b78){_0x120499[_0xdc90('0x21')]=_0x3c2b78;if(_0x4752f4[_0xdc90('0x30')][_0xdc90('0x41')]){_0x1db0d2[_0xdc90('0x42')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x1db0d2);})[_0xdc90('0x26')](function(_0x569b53){_0x120499[_0xdc90('0x43')]=_0x569b53;return _0x120499;})[_0xdc90('0x26')](respondWithFilteredResult(_0x13dff5,_0x1db0d2))[_0xdc90('0x44')](handleError(_0x13dff5,null));};exports['show']=function(_0x58a39d,_0x327843){var _0x470c22={'raw':!![],'where':{'id':_0x58a39d[_0xdc90('0x45')]['id']}},_0x3a95a3={};_0x3a95a3[_0xdc90('0x34')]=_[_0xdc90('0x31')](db['ServicenowField'][_0xdc90('0x46')]);_0x3a95a3[_0xdc90('0x30')]=_[_0xdc90('0x31')](_0x58a39d[_0xdc90('0x30')]);_0x3a95a3[_0xdc90('0x32')]=_['intersection'](_0x3a95a3[_0xdc90('0x34')],_0x3a95a3[_0xdc90('0x30')]);_0x470c22[_0xdc90('0x35')]=_[_0xdc90('0x33')](_0x3a95a3[_0xdc90('0x34')],qs[_0xdc90('0x47')](_0x58a39d[_0xdc90('0x30')]['fields']));_0x470c22['attributes']=_0x470c22[_0xdc90('0x35')]['length']?_0x470c22[_0xdc90('0x35')]:_0x3a95a3['model'];if(_0x58a39d['query'][_0xdc90('0x41')]){_0x470c22[_0xdc90('0x42')]=[{'all':!![]}];}_0x470c22=_[_0xdc90('0x3f')]({},_0x470c22,_0x58a39d[_0xdc90('0x40')]);return db[_0xdc90('0x2b')][_0xdc90('0x48')](_0x470c22)['then'](handleEntityNotFound(_0x327843,null))['then'](respondWithResult(_0x327843,null))[_0xdc90('0x44')](handleError(_0x327843,null));};exports[_0xdc90('0x49')]=function(_0x4e32d9,_0x1866ab){return db[_0xdc90('0x2b')][_0xdc90('0x49')](_0x4e32d9[_0xdc90('0x4a')],{})[_0xdc90('0x26')](respondWithResult(_0x1866ab,0xc9))['catch'](handleError(_0x1866ab,null));};exports[_0xdc90('0x4b')]=function(_0x268656,_0x3c3346){if(_0x268656[_0xdc90('0x4a')]['id']){delete _0x268656[_0xdc90('0x4a')]['id'];}return db[_0xdc90('0x2b')][_0xdc90('0x48')]({'where':{'id':_0x268656['params']['id']}})[_0xdc90('0x26')](handleEntityNotFound(_0x3c3346,null))[_0xdc90('0x26')](saveUpdates(_0x268656['body'],null))[_0xdc90('0x26')](respondWithResult(_0x3c3346,null))[_0xdc90('0x44')](handleError(_0x3c3346,null));};exports[_0xdc90('0x25')]=function(_0xc6f454,_0x1baf55){return db['ServicenowField'][_0xdc90('0x48')]({'where':{'id':_0xc6f454[_0xdc90('0x45')]['id']}})[_0xdc90('0x26')](handleEntityNotFound(_0x1baf55,null))[_0xdc90('0x26')](removeEntity(_0x1baf55,null))['catch'](handleError(_0x1baf55,null));}; \ No newline at end of file +var _0x477a=['fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','ServicenowField','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x15b52d,_0x1ce25a){var _0x1fdd32=function(_0x2ab1da){while(--_0x2ab1da){_0x15b52d['push'](_0x15b52d['shift']());}};_0x1fdd32(++_0x1ce25a);}(_0x477a,0x16b));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require(_0xa477('0x1'));var zipdir=require(_0xa477('0x2'));var jsonpatch=require(_0xa477('0x3'));var rp=require(_0xa477('0x4'));var moment=require(_0xa477('0x5'));var BPromise=require(_0xa477('0x6'));var Mustache=require(_0xa477('0x7'));var util=require(_0xa477('0x8'));var path=require('path');var sox=require(_0xa477('0x9'));var csv=require(_0xa477('0xa'));var ejs=require(_0xa477('0xb'));var fs=require('fs');var fs_extra=require(_0xa477('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa477('0xd'));var jsforce=require(_0xa477('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa477('0xa'));var querystring=require(_0xa477('0xf'));var Papa=require(_0xa477('0x10'));var Redis=require(_0xa477('0x11'));var authService=require(_0xa477('0x12'));var qs=require(_0xa477('0x13'));var as=require(_0xa477('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa477('0x15'))(_0xa477('0x16'));var utils=require(_0xa477('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa477('0x18'))['db'];function respondWithStatusCode(_0x4cf6ec,_0xe6c4be){_0xe6c4be=_0xe6c4be||0xcc;return function(_0xf39cc4){if(_0xf39cc4){return _0x4cf6ec[_0xa477('0x19')](_0xe6c4be);}return _0x4cf6ec[_0xa477('0x1a')](_0xe6c4be)['end']();};}function respondWithResult(_0x5ba6ab,_0x504160){_0x504160=_0x504160||0xc8;return function(_0x2f56b7){if(_0x2f56b7){return _0x5ba6ab['status'](_0x504160)[_0xa477('0x1b')](_0x2f56b7);}};}function respondWithFilteredResult(_0x52d10e,_0x3cfd39){return function(_0x27084a){if(_0x27084a){var _0x476ac1=typeof _0x3cfd39[_0xa477('0x1c')]===_0xa477('0x1d')&&typeof _0x3cfd39[_0xa477('0x1e')]===_0xa477('0x1d');var _0x4371ff=_0x27084a[_0xa477('0x1f')];var _0x4df90f=_0x476ac1?0x0:_0x3cfd39['offset'];var _0x105b0b=_0x476ac1?_0x27084a[_0xa477('0x1f')]:_0x3cfd39['offset']+_0x3cfd39['limit'];var _0x442d81;if(_0x105b0b>=_0x4371ff){_0x105b0b=_0x4371ff;_0x442d81=0xc8;}else{_0x442d81=0xce;}_0x52d10e[_0xa477('0x1a')](_0x442d81);return _0x52d10e[_0xa477('0x20')](_0xa477('0x21'),_0x4df90f+'-'+_0x105b0b+'/'+_0x4371ff)[_0xa477('0x1b')](_0x27084a);}return null;};}function patchUpdates(_0x463fca){return function(_0x4d2bfd){try{jsonpatch['apply'](_0x4d2bfd,_0x463fca,!![]);}catch(_0x5e741c){return BPromise[_0xa477('0x22')](_0x5e741c);}return _0x4d2bfd[_0xa477('0x23')]();};}function saveUpdates(_0x12177f,_0xa96b36){return function(_0x388d51){if(_0x388d51){return _0x388d51[_0xa477('0x24')](_0x12177f)['then'](function(_0x2804d7){return _0x2804d7;});}return null;};}function removeEntity(_0x3ccf88,_0x2c5776){return function(_0x534775){if(_0x534775){return _0x534775[_0xa477('0x25')]()[_0xa477('0x26')](function(){_0x3ccf88[_0xa477('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2abd5c,_0x4655e4){return function(_0x1da44f){if(!_0x1da44f){_0x2abd5c['sendStatus'](0x194);}return _0x1da44f;};}function handleError(_0x17e736,_0x1fd706){_0x1fd706=_0x1fd706||0x1f4;return function(_0x22f721){logger[_0xa477('0x27')](_0x22f721['stack']);if(_0x22f721['name']){delete _0x22f721[_0xa477('0x28')];}_0x17e736[_0xa477('0x1a')](_0x1fd706)[_0xa477('0x29')](_0x22f721);};}exports[_0xa477('0x2a')]=function(_0x58920,_0x8bcaf){var _0x4037a0={},_0x496726={},_0x5c652a={'count':0x0,'rows':[]};var _0x4ef868=_[_0xa477('0x2b')](db[_0xa477('0x2c')]['rawAttributes'],function(_0x5102ae){return{'name':_0x5102ae[_0xa477('0x2d')],'type':_0x5102ae[_0xa477('0x2e')][_0xa477('0x2f')]};});_0x496726[_0xa477('0x30')]=_[_0xa477('0x2b')](_0x4ef868,_0xa477('0x28'));_0x496726['query']=_[_0xa477('0x31')](_0x58920[_0xa477('0x32')]);_0x496726[_0xa477('0x33')]=_['intersection'](_0x496726[_0xa477('0x30')],_0x496726[_0xa477('0x32')]);_0x4037a0['attributes']=_[_0xa477('0x34')](_0x496726[_0xa477('0x30')],qs[_0xa477('0x35')](_0x58920[_0xa477('0x32')]['fields']));_0x4037a0[_0xa477('0x36')]=_0x4037a0[_0xa477('0x36')][_0xa477('0x37')]?_0x4037a0[_0xa477('0x36')]:_0x496726['model'];if(!_0x58920[_0xa477('0x32')][_0xa477('0x38')](_0xa477('0x39'))){_0x4037a0['limit']=qs['limit'](_0x58920[_0xa477('0x32')]['limit']);_0x4037a0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x58920[_0xa477('0x32')]['offset']);}_0x4037a0['order']=qs[_0xa477('0x3a')](_0x58920[_0xa477('0x32')]['sort']);_0x4037a0[_0xa477('0x3b')]=qs[_0xa477('0x33')](_[_0xa477('0x3c')](_0x58920[_0xa477('0x32')],_0x496726[_0xa477('0x33')]),_0x4ef868);if(_0x58920['query'][_0xa477('0x3d')]){_0x4037a0[_0xa477('0x3b')]=_['merge'](_0x4037a0[_0xa477('0x3b')],{'$or':_[_0xa477('0x2b')](_0x4ef868,function(_0x505847){if(_0x505847[_0xa477('0x2e')]!==_0xa477('0x3e')){var _0x5e505b={};_0x5e505b[_0x505847[_0xa477('0x28')]]={'$like':'%'+_0x58920[_0xa477('0x32')][_0xa477('0x3d')]+'%'};return _0x5e505b;}})});}_0x4037a0=_[_0xa477('0x3f')]({},_0x4037a0,_0x58920['options']);var _0x4ea6e1={'where':_0x4037a0[_0xa477('0x3b')]};return db['ServicenowField'][_0xa477('0x1f')](_0x4ea6e1)[_0xa477('0x26')](function(_0x4371f0){_0x5c652a[_0xa477('0x1f')]=_0x4371f0;if(_0x58920[_0xa477('0x32')][_0xa477('0x40')]){_0x4037a0[_0xa477('0x41')]=[{'all':!![]}];}return db[_0xa477('0x2c')][_0xa477('0x42')](_0x4037a0);})['then'](function(_0x3f1ab6){_0x5c652a[_0xa477('0x43')]=_0x3f1ab6;return _0x5c652a;})['then'](respondWithFilteredResult(_0x8bcaf,_0x4037a0))[_0xa477('0x44')](handleError(_0x8bcaf,null));};exports[_0xa477('0x45')]=function(_0xe5de8b,_0xa9d2f3){var _0x1d685b={'raw':!![],'where':{'id':_0xe5de8b[_0xa477('0x46')]['id']}},_0x18f8b4={};_0x18f8b4[_0xa477('0x30')]=_[_0xa477('0x31')](db[_0xa477('0x2c')][_0xa477('0x47')]);_0x18f8b4[_0xa477('0x32')]=_[_0xa477('0x31')](_0xe5de8b[_0xa477('0x32')]);_0x18f8b4['filters']=_[_0xa477('0x34')](_0x18f8b4['model'],_0x18f8b4[_0xa477('0x32')]);_0x1d685b[_0xa477('0x36')]=_[_0xa477('0x34')](_0x18f8b4[_0xa477('0x30')],qs['fields'](_0xe5de8b[_0xa477('0x32')][_0xa477('0x35')]));_0x1d685b[_0xa477('0x36')]=_0x1d685b['attributes'][_0xa477('0x37')]?_0x1d685b[_0xa477('0x36')]:_0x18f8b4[_0xa477('0x30')];if(_0xe5de8b[_0xa477('0x32')][_0xa477('0x40')]){_0x1d685b[_0xa477('0x41')]=[{'all':!![]}];}_0x1d685b=_['merge']({},_0x1d685b,_0xe5de8b['options']);return db['ServicenowField'][_0xa477('0x48')](_0x1d685b)['then'](handleEntityNotFound(_0xa9d2f3,null))[_0xa477('0x26')](respondWithResult(_0xa9d2f3,null))['catch'](handleError(_0xa9d2f3,null));};exports[_0xa477('0x49')]=function(_0x24a089,_0x43feeb){return db[_0xa477('0x2c')]['create'](_0x24a089[_0xa477('0x4a')],{})[_0xa477('0x26')](respondWithResult(_0x43feeb,0xc9))['catch'](handleError(_0x43feeb,null));};exports[_0xa477('0x24')]=function(_0x4bb7fb,_0x1fb4d8){if(_0x4bb7fb[_0xa477('0x4a')]['id']){delete _0x4bb7fb['body']['id'];}return db[_0xa477('0x2c')]['find']({'where':{'id':_0x4bb7fb['params']['id']}})[_0xa477('0x26')](handleEntityNotFound(_0x1fb4d8,null))[_0xa477('0x26')](saveUpdates(_0x4bb7fb['body'],null))[_0xa477('0x26')](respondWithResult(_0x1fb4d8,null))[_0xa477('0x44')](handleError(_0x1fb4d8,null));};exports[_0xa477('0x25')]=function(_0x632c0b,_0x2089e6){return db['ServicenowField'][_0xa477('0x48')]({'where':{'id':_0x632c0b[_0xa477('0x46')]['id']}})[_0xa477('0x26')](handleEntityNotFound(_0x2089e6,null))[_0xa477('0x26')](removeEntity(_0x2089e6,null))[_0xa477('0x44')](handleError(_0x2089e6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 60b01b1..93128c0 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 _0x71af=['../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x71af,0x19d));var _0xf71a=function(_0x3f8b6c,_0x4483e2){_0x3f8b6c=_0x3f8b6c-0x0;var _0x1e041f=_0x71af[_0x3f8b6c];return _0x1e041f;};'use strict';var _=require('lodash');var util=require(_0xf71a('0x0'));var logger=require('../../config/logger')(_0xf71a('0x1'));var moment=require(_0xf71a('0x2'));var BPromise=require(_0xf71a('0x3'));var rp=require(_0xf71a('0x4'));var fs=require('fs');var path=require(_0xf71a('0x5'));var rimraf=require(_0xf71a('0x6'));var config=require(_0xf71a('0x7'));var attributes=require(_0xf71a('0x8'));module[_0xf71a('0x9')]=function(_0x4fb615,_0x3a5547){return _0x4fb615[_0xf71a('0xa')](_0xf71a('0xb'),attributes,{'tableName':_0xf71a('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xf71a('0xd'),_0xf71a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x484b=['api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','int_servicenow_fields','idField','lodash','util','../../config/logger'];(function(_0x56c852,_0x62d64f){var _0x3baa00=function(_0xf753b2){while(--_0xf753b2){_0x56c852['push'](_0x56c852['shift']());}};_0x3baa00(++_0x62d64f);}(_0x484b,0x75));var _0xb484=function(_0x2f8e9e,_0x47e70a){_0x2f8e9e=_0x2f8e9e-0x0;var _0x2d4e96=_0x484b[_0x2f8e9e];return _0x2d4e96;};'use strict';var _=require(_0xb484('0x0'));var util=require(_0xb484('0x1'));var logger=require(_0xb484('0x2'))(_0xb484('0x3'));var moment=require(_0xb484('0x4'));var BPromise=require(_0xb484('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb484('0x6'));var rimraf=require(_0xb484('0x7'));var config=require(_0xb484('0x8'));var attributes=require(_0xb484('0x9'));module['exports']=function(_0x385397,_0x5aeb32){return _0x385397['define']('ServicenowField',attributes,{'tableName':_0xb484('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xb484('0xb'),'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 1867326..17f58d0 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 _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45ae0d,_0x1ea3b9){var _0x371826=function(_0x20e757){while(--_0x20e757){_0x45ae0d['push'](_0x45ae0d['shift']());}};_0x371826(++_0x1ea3b9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2e8883,_0x204625){var _0x330d66=function(_0x181542){while(--_0x181542){_0x2e8883['push'](_0x2e8883['shift']());}};_0x330d66(++_0x204625);}(_0xe706,0xa3));var _0x6e70=function(_0x3a7650,_0x458946){_0x3a7650=_0x3a7650-0x0;var _0x136de7=_0xe706[_0x3a7650];return _0x136de7;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0d65949..4130cbb 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2a77a6,_0x3fc382){var _0x4e2ebc=function(_0x442f24){while(--_0x442f24){_0x2a77a6['push'](_0x2a77a6['shift']());}};_0x4e2ebc(++_0x3fc382);}(_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('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x36c997,_0x5d67e0){var _0x2be027=function(_0x2c3024){while(--_0x2c3024){_0x36c997['push'](_0x36c997['shift']());}};_0x2be027(++_0x5d67e0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 6bf0b72..11a9719 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(_0x81f105,_0x29ed27){var _0x1d07f6=function(_0xa8b226){while(--_0xa8b226){_0x81f105['push'](_0x81f105['shift']());}};_0x1d07f6(++_0x29ed27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3ac048,_0x14d666){var _0x325d08=function(_0x1014a7){while(--_0x1014a7){_0x3ac048['push'](_0x3ac048['shift']());}};_0x325d08(++_0x14d666);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 8570c38..355a3e1 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 _0x0fea=['value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','findAll','catch','params','include','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','direction','username','password','remoteUri','slice','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','includes','endsWith'];(function(_0x3eb754,_0x723dbf){var _0x19e338=function(_0x5ed376){while(--_0x5ed376){_0x3eb754['push'](_0x3eb754['shift']());}};_0x19e338(++_0x723dbf);}(_0x0fea,0x80));var _0xa0fe=function(_0x3a14ac,_0x55403f){_0x3a14ac=_0x3a14ac-0x0;var _0x5e3bc3=_0x0fea[_0x3a14ac];return _0x5e3bc3;};'use strict';var emlformat=require(_0xa0fe('0x0'));var rimraf=require(_0xa0fe('0x1'));var zipdir=require(_0xa0fe('0x2'));var jsonpatch=require(_0xa0fe('0x3'));var rp=require(_0xa0fe('0x4'));var moment=require(_0xa0fe('0x5'));var BPromise=require(_0xa0fe('0x6'));var Mustache=require(_0xa0fe('0x7'));var util=require(_0xa0fe('0x8'));var path=require(_0xa0fe('0x9'));var sox=require(_0xa0fe('0xa'));var csv=require('to-csv');var ejs=require(_0xa0fe('0xb'));var fs=require('fs');var fs_extra=require(_0xa0fe('0xc'));var _=require(_0xa0fe('0xd'));var squel=require(_0xa0fe('0xe'));var crypto=require('crypto');var jsforce=require(_0xa0fe('0xf'));var deskjs=require(_0xa0fe('0x10'));var toCsv=require(_0xa0fe('0x11'));var querystring=require('querystring');var Papa=require(_0xa0fe('0x12'));var Redis=require(_0xa0fe('0x13'));var authService=require(_0xa0fe('0x14'));var qs=require(_0xa0fe('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0fe('0x16'));var logger=require('../../config/logger')(_0xa0fe('0x17'));var utils=require(_0xa0fe('0x18'));var config=require(_0xa0fe('0x19'));var licenseUtil=require(_0xa0fe('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18be66,_0x149f2e){_0x149f2e=_0x149f2e||0xcc;return function(_0x35a9db){if(_0x35a9db){return _0x18be66['sendStatus'](_0x149f2e);}return _0x18be66[_0xa0fe('0x1b')](_0x149f2e)[_0xa0fe('0x1c')]();};}function respondWithResult(_0x572158,_0x5700c2){_0x5700c2=_0x5700c2||0xc8;return function(_0x438b4f){if(_0x438b4f){return _0x572158[_0xa0fe('0x1b')](_0x5700c2)[_0xa0fe('0x1d')](_0x438b4f);}};}function respondWithFilteredResult(_0x220b5a,_0x52ff2d){return function(_0x3eb700){if(_0x3eb700){var _0x5b7900=typeof _0x52ff2d['offset']==='undefined'&&typeof _0x52ff2d[_0xa0fe('0x1e')]===_0xa0fe('0x1f');var _0x23a29b=_0x3eb700['count'];var _0x172859=_0x5b7900?0x0:_0x52ff2d['offset'];var _0x447b9d=_0x5b7900?_0x3eb700['count']:_0x52ff2d[_0xa0fe('0x20')]+_0x52ff2d[_0xa0fe('0x1e')];var _0x27f5c7;if(_0x447b9d>=_0x23a29b){_0x447b9d=_0x23a29b;_0x27f5c7=0xc8;}else{_0x27f5c7=0xce;}_0x220b5a['status'](_0x27f5c7);return _0x220b5a['set'](_0xa0fe('0x21'),_0x172859+'-'+_0x447b9d+'/'+_0x23a29b)[_0xa0fe('0x1d')](_0x3eb700);}return null;};}function patchUpdates(_0xc53cad){return function(_0x427019){try{jsonpatch['apply'](_0x427019,_0xc53cad,!![]);}catch(_0x364518){return BPromise[_0xa0fe('0x22')](_0x364518);}return _0x427019[_0xa0fe('0x23')]();};}function saveUpdates(_0x2e2cff,_0x3c1d5c){return function(_0x33e199){if(_0x33e199){return _0x33e199[_0xa0fe('0x24')](_0x2e2cff)[_0xa0fe('0x25')](function(_0x57929a){return _0x57929a;});}return null;};}function removeEntity(_0x36c56d,_0x2bd6a8){return function(_0x26e8c2){if(_0x26e8c2){return _0x26e8c2[_0xa0fe('0x26')]()[_0xa0fe('0x25')](function(){_0x36c56d[_0xa0fe('0x1b')](0xcc)[_0xa0fe('0x1c')]();});}};}function handleEntityNotFound(_0x25be36,_0x66e04d){return function(_0x5317c7){if(!_0x5317c7){_0x25be36[_0xa0fe('0x27')](0x194);}return _0x5317c7;};}function handleError(_0x230edf,_0x6fda6d){_0x6fda6d=_0x6fda6d||0x1f4;return function(_0x4025c7){logger[_0xa0fe('0x28')](_0x4025c7['stack']);if(_0x4025c7[_0xa0fe('0x29')]){delete _0x4025c7[_0xa0fe('0x29')];}_0x230edf['status'](_0x6fda6d)[_0xa0fe('0x2a')](_0x4025c7);};}exports[_0xa0fe('0x2b')]=function(_0x397f75,_0x5b6363){var _0x24b1c0={},_0x34ad53={},_0x2f734c={'count':0x0,'rows':[]};var _0x58586a=_[_0xa0fe('0x2c')](db[_0xa0fe('0x2d')]['rawAttributes'],function(_0x234f48){return{'name':_0x234f48[_0xa0fe('0x2e')],'type':_0x234f48['type'][_0xa0fe('0x2f')]};});_0x34ad53[_0xa0fe('0x30')]=_['map'](_0x58586a,_0xa0fe('0x29'));_0x34ad53[_0xa0fe('0x31')]=_[_0xa0fe('0x32')](_0x397f75['query']);_0x34ad53[_0xa0fe('0x33')]=_[_0xa0fe('0x34')](_0x34ad53[_0xa0fe('0x30')],_0x34ad53['query']);_0x24b1c0[_0xa0fe('0x35')]=_[_0xa0fe('0x34')](_0x34ad53[_0xa0fe('0x30')],qs[_0xa0fe('0x36')](_0x397f75[_0xa0fe('0x31')][_0xa0fe('0x36')]));_0x24b1c0[_0xa0fe('0x35')]=_0x24b1c0[_0xa0fe('0x35')][_0xa0fe('0x37')]?_0x24b1c0['attributes']:_0x34ad53[_0xa0fe('0x30')];if(!_0x397f75[_0xa0fe('0x31')][_0xa0fe('0x38')](_0xa0fe('0x39'))){_0x24b1c0[_0xa0fe('0x1e')]=qs[_0xa0fe('0x1e')](_0x397f75[_0xa0fe('0x31')][_0xa0fe('0x1e')]);_0x24b1c0[_0xa0fe('0x20')]=qs[_0xa0fe('0x20')](_0x397f75[_0xa0fe('0x31')][_0xa0fe('0x20')]);}_0x24b1c0[_0xa0fe('0x3a')]=qs[_0xa0fe('0x3b')](_0x397f75['query'][_0xa0fe('0x3b')]);_0x24b1c0[_0xa0fe('0x3c')]=qs['filters'](_[_0xa0fe('0x3d')](_0x397f75['query'],_0x34ad53['filters']),_0x58586a);if(_0x397f75['query'][_0xa0fe('0x3e')]){_0x24b1c0['where']=_['merge'](_0x24b1c0[_0xa0fe('0x3c')],{'$or':_['map'](_0x58586a,function(_0x89396d){if(_0x89396d[_0xa0fe('0x3f')]!==_0xa0fe('0x40')){var _0x147252={};_0x147252[_0x89396d[_0xa0fe('0x29')]]={'$like':'%'+_0x397f75['query'][_0xa0fe('0x3e')]+'%'};return _0x147252;}})});}_0x24b1c0=_[_0xa0fe('0x41')]({},_0x24b1c0,_0x397f75[_0xa0fe('0x42')]);var _0xa38c48={'where':_0x24b1c0[_0xa0fe('0x3c')]};return db[_0xa0fe('0x2d')][_0xa0fe('0x43')](_0xa38c48)[_0xa0fe('0x25')](function(_0x4000cf){_0x2f734c[_0xa0fe('0x43')]=_0x4000cf;if(_0x397f75[_0xa0fe('0x31')][_0xa0fe('0x44')]){_0x24b1c0['include']=[{'all':!![]}];}return db[_0xa0fe('0x2d')][_0xa0fe('0x45')](_0x24b1c0);})['then'](function(_0x5ac4fb){_0x2f734c['rows']=_0x5ac4fb;return _0x2f734c;})[_0xa0fe('0x25')](respondWithFilteredResult(_0x5b6363,_0x24b1c0))[_0xa0fe('0x46')](handleError(_0x5b6363,null));};exports['show']=function(_0x28bae0,_0x225b27){var _0x10d110={'raw':![],'where':{'id':_0x28bae0[_0xa0fe('0x47')]['id']}},_0x56a8e8={};_0x56a8e8[_0xa0fe('0x30')]=_[_0xa0fe('0x32')](db[_0xa0fe('0x2d')]['rawAttributes']);_0x56a8e8['query']=_[_0xa0fe('0x32')](_0x28bae0[_0xa0fe('0x31')]);_0x56a8e8['filters']=_['intersection'](_0x56a8e8['model'],_0x56a8e8[_0xa0fe('0x31')]);_0x10d110['attributes']=_[_0xa0fe('0x34')](_0x56a8e8[_0xa0fe('0x30')],qs[_0xa0fe('0x36')](_0x28bae0[_0xa0fe('0x31')][_0xa0fe('0x36')]));_0x10d110[_0xa0fe('0x35')]=_0x10d110[_0xa0fe('0x35')][_0xa0fe('0x37')]?_0x10d110[_0xa0fe('0x35')]:_0x56a8e8[_0xa0fe('0x30')];if(_0x28bae0[_0xa0fe('0x31')][_0xa0fe('0x44')]){_0x10d110[_0xa0fe('0x48')]=[{'all':!![]}];}_0x10d110=_[_0xa0fe('0x41')]({},_0x10d110,_0x28bae0['options']);return db['SugarcrmAccount'][_0xa0fe('0x49')](_0x10d110)[_0xa0fe('0x25')](handleEntityNotFound(_0x225b27,null))['then'](respondWithResult(_0x225b27,null))[_0xa0fe('0x46')](handleError(_0x225b27,null));};exports[_0xa0fe('0x4a')]=function(_0x508075,_0x59eede){return db[_0xa0fe('0x2d')][_0xa0fe('0x4a')](_0x508075['body'],{})[_0xa0fe('0x25')](respondWithResult(_0x59eede,0xc9))['catch'](handleError(_0x59eede,null));};exports[_0xa0fe('0x24')]=function(_0x226840,_0x3194fd){if(_0x226840[_0xa0fe('0x4b')]['id']){delete _0x226840[_0xa0fe('0x4b')]['id'];}return db[_0xa0fe('0x2d')][_0xa0fe('0x49')]({'where':{'id':_0x226840[_0xa0fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x3194fd,null))[_0xa0fe('0x25')](saveUpdates(_0x226840[_0xa0fe('0x4b')],null))[_0xa0fe('0x25')](respondWithResult(_0x3194fd,null))[_0xa0fe('0x46')](handleError(_0x3194fd,null));};exports['destroy']=function(_0x4cf2ed,_0x45ffba){return db[_0xa0fe('0x2d')][_0xa0fe('0x49')]({'where':{'id':_0x4cf2ed[_0xa0fe('0x47')]['id']}})[_0xa0fe('0x25')](handleEntityNotFound(_0x45ffba,null))[_0xa0fe('0x25')](removeEntity(_0x45ffba,null))[_0xa0fe('0x46')](handleError(_0x45ffba,null));};exports['getConfigurations']=function(_0x3e46de,_0x31e0ec,_0xb45e34){var _0x2089be={};var _0x552bad={};var _0x35539c;var _0x4b4b84;return db[_0xa0fe('0x2d')][_0xa0fe('0x4c')]({'where':{'id':_0x3e46de['params']['id']}})['then'](handleEntityNotFound(_0x31e0ec,null))[_0xa0fe('0x25')](function(_0x52322e){if(_0x52322e){_0x35539c=_0x52322e;_0x552bad[_0xa0fe('0x30')]=_[_0xa0fe('0x32')](db['SugarcrmConfiguration']['rawAttributes']);_0x552bad['query']=_[_0xa0fe('0x32')](_0x3e46de[_0xa0fe('0x31')]);_0x552bad[_0xa0fe('0x33')]=_[_0xa0fe('0x34')](_0x552bad[_0xa0fe('0x30')],_0x552bad[_0xa0fe('0x31')]);_0x2089be['attributes']=_[_0xa0fe('0x34')](_0x552bad[_0xa0fe('0x30')],qs[_0xa0fe('0x36')](_0x3e46de[_0xa0fe('0x31')][_0xa0fe('0x36')]));_0x2089be['attributes']=_0x2089be[_0xa0fe('0x35')]['length']?_0x2089be[_0xa0fe('0x35')]:_0x552bad[_0xa0fe('0x30')];_0x2089be[_0xa0fe('0x3a')]=qs['sort'](_0x3e46de[_0xa0fe('0x31')]['sort']);_0x2089be[_0xa0fe('0x3c')]=qs['filters'](_[_0xa0fe('0x3d')](_0x3e46de[_0xa0fe('0x31')],_0x552bad['filters']));if(_0x3e46de[_0xa0fe('0x31')]['filter']){_0x2089be[_0xa0fe('0x3c')]=_[_0xa0fe('0x41')](_0x2089be['where'],{'$or':_['map'](_0x2089be['attributes'],function(_0x15e056){var _0x5658f0={};_0x5658f0[_0x15e056]={'$like':'%'+_0x3e46de['query']['filter']+'%'};return _0x5658f0;})});}_0x2089be=_[_0xa0fe('0x41')]({},_0x2089be,_0x3e46de[_0xa0fe('0x42')]);return _0x35539c[_0xa0fe('0x4d')](_0x2089be);}})[_0xa0fe('0x25')](function(_0x48e75f){if(_0x48e75f){_0x4b4b84=_0x48e75f[_0xa0fe('0x37')];if(!_0x3e46de[_0xa0fe('0x31')][_0xa0fe('0x38')](_0xa0fe('0x39'))){_0x2089be['limit']=qs[_0xa0fe('0x1e')](_0x3e46de[_0xa0fe('0x31')][_0xa0fe('0x1e')]);_0x2089be[_0xa0fe('0x20')]=qs[_0xa0fe('0x20')](_0x3e46de[_0xa0fe('0x31')][_0xa0fe('0x20')]);}return _0x35539c[_0xa0fe('0x4d')](_0x2089be);}})['then'](function(_0x54fbe1){if(_0x54fbe1){return _0x54fbe1?{'count':_0x4b4b84,'rows':_0x54fbe1}:null;}})['then'](respondWithResult(_0x31e0ec,null))['catch'](handleError(_0x31e0ec,null));};exports[_0xa0fe('0x4e')]=function(_0x50b772,_0x7890ab,_0x292ffa){if(_0x50b772[_0xa0fe('0x4b')]['id']){delete _0x50b772[_0xa0fe('0x4b')]['id'];}return db[_0xa0fe('0x2d')][_0xa0fe('0x4c')]({'where':{'id':_0x50b772['params']['id']}})[_0xa0fe('0x25')](handleEntityNotFound(_0x7890ab,null))[_0xa0fe('0x25')](function(_0x19f027){if(_0x19f027){_0x50b772['body'][_0xa0fe('0x4f')]=_0x19f027['id'];_0x50b772['body']['Subjects']=integrations[_0xa0fe('0x50')](_0x50b772[_0xa0fe('0x4b')]['channel'],_0x50b772[_0xa0fe('0x4b')][_0xa0fe('0x3f')]);_0x50b772[_0xa0fe('0x4b')][_0xa0fe('0x51')]=integrations[_0xa0fe('0x52')](_0x50b772['body'][_0xa0fe('0x53')],_0x50b772[_0xa0fe('0x4b')][_0xa0fe('0x3f')]);return db[_0xa0fe('0x54')]['create'](_0x50b772[_0xa0fe('0x4b')],{'include':[{'model':db[_0xa0fe('0x55')],'as':_0xa0fe('0x56')},{'model':db[_0xa0fe('0x55')],'as':_0xa0fe('0x51')}]});}return null;})[_0xa0fe('0x25')](respondWithResult(_0x7890ab,null))[_0xa0fe('0x46')](handleError(_0x7890ab,null));};exports['getFields']=function(_0x46d36b,_0x2eff4d,_0x77bfdb){var _0x4bcc44='';var _0x4cbb64=['id',_0xa0fe('0x29'),_0xa0fe('0x57'),_0xa0fe('0x58'),_0xa0fe('0x59'),_0xa0fe('0x5a'),_0xa0fe('0x5b'),_0xa0fe('0x5c'),_0xa0fe('0x5d'),'parent_type','parent_name',_0xa0fe('0x5e')];return db[_0xa0fe('0x2d')][_0xa0fe('0x4c')]({'where':{'id':_0x46d36b[_0xa0fe('0x47')]['id']},'attributes':['id',_0xa0fe('0x5f'),_0xa0fe('0x60'),_0xa0fe('0x61')]})[_0xa0fe('0x25')](handleEntityNotFound(_0x2eff4d,null))['then'](function(_0x16564a){if(_0x16564a){_0x4bcc44=_0x16564a[_0xa0fe('0x61')];var _0x10a644=_0x4bcc44[_0xa0fe('0x62')](-0x1);if(_0x10a644==='/'){_0x4bcc44=_0x4bcc44['substring'](0x0,_0x4bcc44[_0xa0fe('0x63')](_0x10a644));}return rp({'method':'POST','uri':util[_0xa0fe('0x64')](_0xa0fe('0x65'),_0x4bcc44,_0xa0fe('0x66')),'json':!![],'form':{'method':_0xa0fe('0x67'),'input_type':_0xa0fe('0x68'),'response_type':_0xa0fe('0x68'),'rest_data':JSON[_0xa0fe('0x69')]({'user_auth':{'user_name':_0x16564a[_0xa0fe('0x5f')],'password':_0x16564a[_0xa0fe('0x60')],'encryption':_0xa0fe('0x6a')},'application':_0xa0fe('0x6b')})}});}})[_0xa0fe('0x25')](function(_0x7d7f4f){if(_0x7d7f4f&&_0x7d7f4f['name']!==_0xa0fe('0x6c')&&_0x7d7f4f['name']!==_0xa0fe('0x6d')){return rp({'method':_0xa0fe('0x6e'),'uri':util['format']('%s%s',_0x4bcc44,_0xa0fe('0x66')),'json':!![],'form':{'method':_0xa0fe('0x6f'),'input_type':_0xa0fe('0x68'),'response_type':_0xa0fe('0x68'),'rest_data':JSON['stringify']({'session':_0x7d7f4f['id'],'module_name':_0xa0fe('0x70')})}})['then'](function(_0x288c61){if(_0x288c61){var _0x125e33=_[_0xa0fe('0x71')](_0x288c61[_0xa0fe('0x72')]);_[_0xa0fe('0x73')](_0x125e33,function(_0x187f1e){return _0x4cbb64[_0xa0fe('0x74')](_0x187f1e[_0xa0fe('0x29')]);});return{'count':_0x125e33[_0xa0fe('0x37')],'rows':_[_0xa0fe('0x2c')](_0x125e33,function(_0x51c087){return{'id':_0x51c087['name'],'name':_0x51c087['label'],'custom':_[_0xa0fe('0x75')](_0x51c087[_0xa0fe('0x29')],'_c')?!![]:![],'options':_0x51c087[_0xa0fe('0x42')]?_['map'](_[_0xa0fe('0x71')](_0x51c087[_0xa0fe('0x42')]),function(_0x597f74){return{'name':_0x597f74[_0xa0fe('0x76')],'value':_0x597f74[_0xa0fe('0x29')]};}):[]};})};}})[_0xa0fe('0x25')](respondWithResult(_0x2eff4d,null))[_0xa0fe('0x46')](function(_0x52286e){var _0x20ea40=_0x46d36b[_0xa0fe('0x31')][_0xa0fe('0x77')]?0x1f4:_0x52286e[_0xa0fe('0x78')]||0x1f4;logger[_0xa0fe('0x28')](_0xa0fe('0x79'),'getFields',_0x20ea40,JSON[_0xa0fe('0x69')](_0x52286e));delete _0x52286e['name'];if(_0x20ea40===0x191){_0x20ea40=0x190;}_0x2eff4d['status'](_0x20ea40)[_0xa0fe('0x2a')](_0x46d36b[_0xa0fe('0x31')][_0xa0fe('0x77')]?{'message':_0xa0fe('0x7a'),'statusCode':_0x52286e[_0xa0fe('0x78')]}:_0x52286e);});}else{var _0x505331=0x1f4;_0x2eff4d['status'](_0x505331)[_0xa0fe('0x2a')]({'message':_0xa0fe('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xfb2f=['eml-format','rimraf','zip-dir','fast-json-patch','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/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','nolimit','sort','pick','where','merge','options','SugarcrmAccount','then','includeAll','include','rows','catch','show','find','create','body','update','params','getConfigurations','findOne','order','filter','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','direction','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','username','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','stringify','Calls','values','module_fields','remove','label','endsWith','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x5cc885,_0x48635a){var _0x400d9a=function(_0xecb0cd){while(--_0xecb0cd){_0x5cc885['push'](_0x5cc885['shift']());}};_0x400d9a(++_0x48635a);}(_0xfb2f,0x1f0));var _0xffb2=function(_0x490f5b,_0x5aec79){_0x490f5b=_0x490f5b-0x0;var _0x31770a=_0xfb2f[_0x490f5b];return _0x31770a;};'use strict';var emlformat=require(_0xffb2('0x0'));var rimraf=require(_0xffb2('0x1'));var zipdir=require(_0xffb2('0x2'));var jsonpatch=require(_0xffb2('0x3'));var rp=require(_0xffb2('0x4'));var moment=require(_0xffb2('0x5'));var BPromise=require(_0xffb2('0x6'));var Mustache=require(_0xffb2('0x7'));var util=require('util');var path=require(_0xffb2('0x8'));var sox=require('sox');var csv=require(_0xffb2('0x9'));var ejs=require(_0xffb2('0xa'));var fs=require('fs');var fs_extra=require(_0xffb2('0xb'));var _=require(_0xffb2('0xc'));var squel=require(_0xffb2('0xd'));var crypto=require(_0xffb2('0xe'));var jsforce=require(_0xffb2('0xf'));var deskjs=require(_0xffb2('0x10'));var toCsv=require(_0xffb2('0x9'));var querystring=require(_0xffb2('0x11'));var Papa=require(_0xffb2('0x12'));var Redis=require(_0xffb2('0x13'));var authService=require(_0xffb2('0x14'));var qs=require(_0xffb2('0x15'));var as=require(_0xffb2('0x16'));var hardwareService=require(_0xffb2('0x17'));var logger=require(_0xffb2('0x18'))(_0xffb2('0x19'));var utils=require(_0xffb2('0x1a'));var config=require(_0xffb2('0x1b'));var licenseUtil=require(_0xffb2('0x1c'));var db=require(_0xffb2('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b46c5,_0x2e2825){_0x2e2825=_0x2e2825||0xcc;return function(_0x170534){if(_0x170534){return _0x5b46c5['sendStatus'](_0x2e2825);}return _0x5b46c5[_0xffb2('0x1e')](_0x2e2825)['end']();};}function respondWithResult(_0x557dfa,_0x5202f7){_0x5202f7=_0x5202f7||0xc8;return function(_0x21c1bd){if(_0x21c1bd){return _0x557dfa[_0xffb2('0x1e')](_0x5202f7)[_0xffb2('0x1f')](_0x21c1bd);}};}function respondWithFilteredResult(_0x5801eb,_0x471df2){return function(_0x4cc02d){if(_0x4cc02d){var _0x2125b3=typeof _0x471df2['offset']===_0xffb2('0x20')&&typeof _0x471df2['limit']===_0xffb2('0x20');var _0x4e1452=_0x4cc02d[_0xffb2('0x21')];var _0x195e3b=_0x2125b3?0x0:_0x471df2[_0xffb2('0x22')];var _0x3c05a7=_0x2125b3?_0x4cc02d[_0xffb2('0x21')]:_0x471df2['offset']+_0x471df2[_0xffb2('0x23')];var _0x334864;if(_0x3c05a7>=_0x4e1452){_0x3c05a7=_0x4e1452;_0x334864=0xc8;}else{_0x334864=0xce;}_0x5801eb['status'](_0x334864);return _0x5801eb[_0xffb2('0x24')](_0xffb2('0x25'),_0x195e3b+'-'+_0x3c05a7+'/'+_0x4e1452)[_0xffb2('0x1f')](_0x4cc02d);}return null;};}function patchUpdates(_0x1195d4){return function(_0x1499fd){try{jsonpatch[_0xffb2('0x26')](_0x1499fd,_0x1195d4,!![]);}catch(_0x55ecd3){return BPromise[_0xffb2('0x27')](_0x55ecd3);}return _0x1499fd[_0xffb2('0x28')]();};}function saveUpdates(_0x111e62,_0x3857a5){return function(_0x21963d){if(_0x21963d){return _0x21963d['update'](_0x111e62)['then'](function(_0x5474da){return _0x5474da;});}return null;};}function removeEntity(_0x3da25f,_0x266547){return function(_0x259e85){if(_0x259e85){return _0x259e85[_0xffb2('0x29')]()['then'](function(){_0x3da25f[_0xffb2('0x1e')](0xcc)[_0xffb2('0x2a')]();});}};}function handleEntityNotFound(_0xd431d0,_0x577510){return function(_0x75b4c4){if(!_0x75b4c4){_0xd431d0[_0xffb2('0x2b')](0x194);}return _0x75b4c4;};}function handleError(_0x336b23,_0x57f210){_0x57f210=_0x57f210||0x1f4;return function(_0x10d145){logger[_0xffb2('0x2c')](_0x10d145[_0xffb2('0x2d')]);if(_0x10d145[_0xffb2('0x2e')]){delete _0x10d145[_0xffb2('0x2e')];}_0x336b23['status'](_0x57f210)[_0xffb2('0x2f')](_0x10d145);};}exports[_0xffb2('0x30')]=function(_0x266d9d,_0x53561b){var _0x1051d4={},_0x25b5e8={},_0xcae620={'count':0x0,'rows':[]};var _0x16d370=_[_0xffb2('0x31')](db['SugarcrmAccount'][_0xffb2('0x32')],function(_0xed9134){return{'name':_0xed9134[_0xffb2('0x33')],'type':_0xed9134[_0xffb2('0x34')][_0xffb2('0x35')]};});_0x25b5e8['model']=_[_0xffb2('0x31')](_0x16d370,'name');_0x25b5e8[_0xffb2('0x36')]=_[_0xffb2('0x37')](_0x266d9d[_0xffb2('0x36')]);_0x25b5e8[_0xffb2('0x38')]=_[_0xffb2('0x39')](_0x25b5e8['model'],_0x25b5e8[_0xffb2('0x36')]);_0x1051d4['attributes']=_[_0xffb2('0x39')](_0x25b5e8['model'],qs[_0xffb2('0x3a')](_0x266d9d[_0xffb2('0x36')]['fields']));_0x1051d4['attributes']=_0x1051d4[_0xffb2('0x3b')][_0xffb2('0x3c')]?_0x1051d4[_0xffb2('0x3b')]:_0x25b5e8[_0xffb2('0x3d')];if(!_0x266d9d[_0xffb2('0x36')]['hasOwnProperty'](_0xffb2('0x3e'))){_0x1051d4['limit']=qs[_0xffb2('0x23')](_0x266d9d[_0xffb2('0x36')][_0xffb2('0x23')]);_0x1051d4['offset']=qs[_0xffb2('0x22')](_0x266d9d[_0xffb2('0x36')][_0xffb2('0x22')]);}_0x1051d4['order']=qs[_0xffb2('0x3f')](_0x266d9d[_0xffb2('0x36')][_0xffb2('0x3f')]);_0x1051d4['where']=qs[_0xffb2('0x38')](_[_0xffb2('0x40')](_0x266d9d[_0xffb2('0x36')],_0x25b5e8[_0xffb2('0x38')]),_0x16d370);if(_0x266d9d[_0xffb2('0x36')]['filter']){_0x1051d4[_0xffb2('0x41')]=_[_0xffb2('0x42')](_0x1051d4[_0xffb2('0x41')],{'$or':_[_0xffb2('0x31')](_0x16d370,function(_0xbafdd0){if(_0xbafdd0[_0xffb2('0x34')]!=='VIRTUAL'){var _0x20632c={};_0x20632c[_0xbafdd0[_0xffb2('0x2e')]]={'$like':'%'+_0x266d9d[_0xffb2('0x36')]['filter']+'%'};return _0x20632c;}})});}_0x1051d4=_[_0xffb2('0x42')]({},_0x1051d4,_0x266d9d[_0xffb2('0x43')]);var _0x226b20={'where':_0x1051d4[_0xffb2('0x41')]};return db[_0xffb2('0x44')][_0xffb2('0x21')](_0x226b20)[_0xffb2('0x45')](function(_0x556e6d){_0xcae620['count']=_0x556e6d;if(_0x266d9d['query'][_0xffb2('0x46')]){_0x1051d4[_0xffb2('0x47')]=[{'all':!![]}];}return db[_0xffb2('0x44')]['findAll'](_0x1051d4);})[_0xffb2('0x45')](function(_0x4a9a70){_0xcae620[_0xffb2('0x48')]=_0x4a9a70;return _0xcae620;})[_0xffb2('0x45')](respondWithFilteredResult(_0x53561b,_0x1051d4))[_0xffb2('0x49')](handleError(_0x53561b,null));};exports[_0xffb2('0x4a')]=function(_0x104e87,_0x536333){var _0x4b930e={'raw':![],'where':{'id':_0x104e87['params']['id']}},_0x13720d={};_0x13720d[_0xffb2('0x3d')]=_['keys'](db[_0xffb2('0x44')]['rawAttributes']);_0x13720d[_0xffb2('0x36')]=_[_0xffb2('0x37')](_0x104e87['query']);_0x13720d[_0xffb2('0x38')]=_[_0xffb2('0x39')](_0x13720d[_0xffb2('0x3d')],_0x13720d[_0xffb2('0x36')]);_0x4b930e[_0xffb2('0x3b')]=_[_0xffb2('0x39')](_0x13720d[_0xffb2('0x3d')],qs['fields'](_0x104e87[_0xffb2('0x36')]['fields']));_0x4b930e[_0xffb2('0x3b')]=_0x4b930e[_0xffb2('0x3b')][_0xffb2('0x3c')]?_0x4b930e['attributes']:_0x13720d[_0xffb2('0x3d')];if(_0x104e87[_0xffb2('0x36')][_0xffb2('0x46')]){_0x4b930e[_0xffb2('0x47')]=[{'all':!![]}];}_0x4b930e=_[_0xffb2('0x42')]({},_0x4b930e,_0x104e87[_0xffb2('0x43')]);return db[_0xffb2('0x44')][_0xffb2('0x4b')](_0x4b930e)[_0xffb2('0x45')](handleEntityNotFound(_0x536333,null))[_0xffb2('0x45')](respondWithResult(_0x536333,null))[_0xffb2('0x49')](handleError(_0x536333,null));};exports[_0xffb2('0x4c')]=function(_0x4e0c3a,_0x4ec913){return db[_0xffb2('0x44')]['create'](_0x4e0c3a[_0xffb2('0x4d')],{})[_0xffb2('0x45')](respondWithResult(_0x4ec913,0xc9))['catch'](handleError(_0x4ec913,null));};exports[_0xffb2('0x4e')]=function(_0x3fd925,_0xd544a6){if(_0x3fd925['body']['id']){delete _0x3fd925[_0xffb2('0x4d')]['id'];}return db[_0xffb2('0x44')]['find']({'where':{'id':_0x3fd925[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0xd544a6,null))[_0xffb2('0x45')](saveUpdates(_0x3fd925['body'],null))[_0xffb2('0x45')](respondWithResult(_0xd544a6,null))[_0xffb2('0x49')](handleError(_0xd544a6,null));};exports[_0xffb2('0x29')]=function(_0x122f8b,_0x1f6bbb){return db[_0xffb2('0x44')][_0xffb2('0x4b')]({'where':{'id':_0x122f8b[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0x1f6bbb,null))['then'](removeEntity(_0x1f6bbb,null))[_0xffb2('0x49')](handleError(_0x1f6bbb,null));};exports[_0xffb2('0x50')]=function(_0x259dae,_0x50e60b,_0x4b1a70){var _0x499a82={};var _0x5b506e={};var _0x119c10;var _0x55c9eb;return db['SugarcrmAccount'][_0xffb2('0x51')]({'where':{'id':_0x259dae[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0x50e60b,null))['then'](function(_0x5c71f7){if(_0x5c71f7){_0x119c10=_0x5c71f7;_0x5b506e['model']=_[_0xffb2('0x37')](db['SugarcrmConfiguration']['rawAttributes']);_0x5b506e['query']=_['keys'](_0x259dae[_0xffb2('0x36')]);_0x5b506e[_0xffb2('0x38')]=_['intersection'](_0x5b506e[_0xffb2('0x3d')],_0x5b506e['query']);_0x499a82['attributes']=_['intersection'](_0x5b506e['model'],qs[_0xffb2('0x3a')](_0x259dae['query'][_0xffb2('0x3a')]));_0x499a82[_0xffb2('0x3b')]=_0x499a82[_0xffb2('0x3b')][_0xffb2('0x3c')]?_0x499a82[_0xffb2('0x3b')]:_0x5b506e['model'];_0x499a82[_0xffb2('0x52')]=qs[_0xffb2('0x3f')](_0x259dae[_0xffb2('0x36')][_0xffb2('0x3f')]);_0x499a82['where']=qs[_0xffb2('0x38')](_[_0xffb2('0x40')](_0x259dae['query'],_0x5b506e[_0xffb2('0x38')]));if(_0x259dae['query']['filter']){_0x499a82[_0xffb2('0x41')]=_[_0xffb2('0x42')](_0x499a82[_0xffb2('0x41')],{'$or':_[_0xffb2('0x31')](_0x499a82[_0xffb2('0x3b')],function(_0x3b253f){var _0x12a6c0={};_0x12a6c0[_0x3b253f]={'$like':'%'+_0x259dae['query'][_0xffb2('0x53')]+'%'};return _0x12a6c0;})});}_0x499a82=_[_0xffb2('0x42')]({},_0x499a82,_0x259dae['options']);return _0x119c10[_0xffb2('0x50')](_0x499a82);}})[_0xffb2('0x45')](function(_0x34ecd4){if(_0x34ecd4){_0x55c9eb=_0x34ecd4[_0xffb2('0x3c')];if(!_0x259dae[_0xffb2('0x36')][_0xffb2('0x54')](_0xffb2('0x3e'))){_0x499a82[_0xffb2('0x23')]=qs[_0xffb2('0x23')](_0x259dae[_0xffb2('0x36')][_0xffb2('0x23')]);_0x499a82['offset']=qs[_0xffb2('0x22')](_0x259dae[_0xffb2('0x36')][_0xffb2('0x22')]);}return _0x119c10['getConfigurations'](_0x499a82);}})[_0xffb2('0x45')](function(_0x584b37){if(_0x584b37){return _0x584b37?{'count':_0x55c9eb,'rows':_0x584b37}:null;}})[_0xffb2('0x45')](respondWithResult(_0x50e60b,null))[_0xffb2('0x49')](handleError(_0x50e60b,null));};exports[_0xffb2('0x55')]=function(_0x22a110,_0x1c62d2,_0xe1ed7){if(_0x22a110['body']['id']){delete _0x22a110[_0xffb2('0x4d')]['id'];}return db[_0xffb2('0x44')][_0xffb2('0x51')]({'where':{'id':_0x22a110[_0xffb2('0x4f')]['id']}})[_0xffb2('0x45')](handleEntityNotFound(_0x1c62d2,null))[_0xffb2('0x45')](function(_0x469317){if(_0x469317){_0x22a110[_0xffb2('0x4d')][_0xffb2('0x56')]=_0x469317['id'];_0x22a110[_0xffb2('0x4d')]['Subjects']=integrations[_0xffb2('0x57')](_0x22a110[_0xffb2('0x4d')][_0xffb2('0x58')],_0x22a110['body'][_0xffb2('0x34')]);_0x22a110['body'][_0xffb2('0x59')]=integrations[_0xffb2('0x5a')](_0x22a110[_0xffb2('0x4d')]['channel'],_0x22a110[_0xffb2('0x4d')][_0xffb2('0x34')]);return db[_0xffb2('0x5b')][_0xffb2('0x4c')](_0x22a110[_0xffb2('0x4d')],{'include':[{'model':db[_0xffb2('0x5c')],'as':'Subjects'},{'model':db[_0xffb2('0x5c')],'as':_0xffb2('0x59')}]});}return null;})['then'](respondWithResult(_0x1c62d2,null))['catch'](handleError(_0x1c62d2,null));};exports[_0xffb2('0x5d')]=function(_0x145c49,_0x542a3d,_0x3ecef0){var _0x4c81e8='';var _0x1fc10e=['id','name',_0xffb2('0x5e'),_0xffb2('0x5f'),_0xffb2('0x60'),'date_start',_0xffb2('0x61'),_0xffb2('0x62'),'parent_id',_0xffb2('0x63'),'parent_name',_0xffb2('0x64')];return db[_0xffb2('0x44')]['findOne']({'where':{'id':_0x145c49[_0xffb2('0x4f')]['id']},'attributes':['id','username',_0xffb2('0x65'),_0xffb2('0x66')]})[_0xffb2('0x45')](handleEntityNotFound(_0x542a3d,null))[_0xffb2('0x45')](function(_0xfe14e0){if(_0xfe14e0){_0x4c81e8=_0xfe14e0[_0xffb2('0x66')];var _0x33122d=_0x4c81e8[_0xffb2('0x67')](-0x1);if(_0x33122d==='/'){_0x4c81e8=_0x4c81e8[_0xffb2('0x68')](0x0,_0x4c81e8[_0xffb2('0x69')](_0x33122d));}return rp({'method':_0xffb2('0x6a'),'uri':util['format'](_0xffb2('0x6b'),_0x4c81e8,_0xffb2('0x6c')),'json':!![],'form':{'method':'login','input_type':_0xffb2('0x6d'),'response_type':_0xffb2('0x6d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xfe14e0[_0xffb2('0x6e')],'password':_0xfe14e0[_0xffb2('0x65')],'encryption':'PLAIN'},'application':_0xffb2('0x6f')})}});}})[_0xffb2('0x45')](function(_0x23db6a){if(_0x23db6a&&_0x23db6a['name']!=='Invalid\x20Login'&&_0x23db6a[_0xffb2('0x2e')]!==_0xffb2('0x70')){return rp({'method':_0xffb2('0x6a'),'uri':util[_0xffb2('0x71')](_0xffb2('0x6b'),_0x4c81e8,_0xffb2('0x6c')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xffb2('0x6d'),'rest_data':JSON[_0xffb2('0x72')]({'session':_0x23db6a['id'],'module_name':_0xffb2('0x73')})}})[_0xffb2('0x45')](function(_0x20e280){if(_0x20e280){var _0x53e7e7=_[_0xffb2('0x74')](_0x20e280[_0xffb2('0x75')]);_[_0xffb2('0x76')](_0x53e7e7,function(_0x2e16f2){return _0x1fc10e['includes'](_0x2e16f2[_0xffb2('0x2e')]);});return{'count':_0x53e7e7[_0xffb2('0x3c')],'rows':_[_0xffb2('0x31')](_0x53e7e7,function(_0x26342a){return{'id':_0x26342a[_0xffb2('0x2e')],'name':_0x26342a[_0xffb2('0x77')],'custom':_[_0xffb2('0x78')](_0x26342a[_0xffb2('0x2e')],'_c')?!![]:![],'options':_0x26342a['options']?_[_0xffb2('0x31')](_[_0xffb2('0x74')](_0x26342a[_0xffb2('0x43')]),function(_0x1d6c67){return{'name':_0x1d6c67['value'],'value':_0x1d6c67[_0xffb2('0x2e')]};}):[]};})};}})[_0xffb2('0x45')](respondWithResult(_0x542a3d,null))[_0xffb2('0x49')](function(_0x23c403){var _0x272d6d=_0x145c49[_0xffb2('0x36')]['test']?0x1f4:_0x23c403['statusCode']||0x1f4;logger[_0xffb2('0x2c')](_0xffb2('0x79'),_0xffb2('0x5d'),_0x272d6d,JSON[_0xffb2('0x72')](_0x23c403));delete _0x23c403[_0xffb2('0x2e')];if(_0x272d6d===0x191){_0x272d6d=0x190;}_0x542a3d[_0xffb2('0x1e')](_0x272d6d)['send'](_0x145c49['query'][_0xffb2('0x7a')]?{'message':_0xffb2('0x7b'),'statusCode':_0x23c403['statusCode']}:_0x23c403);});}else{var _0x2aabe2=0x1f4;_0x542a3d[_0xffb2('0x1e')](_0x2aabe2)[_0xffb2('0x2f')]({'message':_0xffb2('0x7b'),'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 d8a1363..528f8c1 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 _0x7d7f=['lodash','util','../../config/logger','moment','request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x55b5a9,_0x52a732){var _0x4435e7=function(_0x5121ce){while(--_0x5121ce){_0x55b5a9['push'](_0x55b5a9['shift']());}};_0x4435e7(++_0x52a732);}(_0x7d7f,0x1c3));var _0xf7d7=function(_0x2c46bb,_0x5afa06){_0x2c46bb=_0x2c46bb-0x0;var _0x25b76e=_0x7d7f[_0x2c46bb];return _0x25b76e;};'use strict';var _=require(_0xf7d7('0x0'));var util=require(_0xf7d7('0x1'));var logger=require(_0xf7d7('0x2'))('api');var moment=require(_0xf7d7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7d7('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7d7('0x6'));var integrations=require(_0xf7d7('0x7'));module['exports']=function(_0x562184,_0x9a9f91){return _0x562184[_0xf7d7('0x8')](_0xf7d7('0x9'),attributes,{'tableName':_0xf7d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfda8=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','path','rimraf'];(function(_0x424a38,_0x4b82f0){var _0x928447=function(_0xdbafbf){while(--_0xdbafbf){_0x424a38['push'](_0x424a38['shift']());}};_0x928447(++_0x4b82f0);}(_0xfda8,0x118));var _0x8fda=function(_0x3ac578,_0x5cf8d8){_0x3ac578=_0x3ac578-0x0;var _0x149517=_0xfda8[_0x3ac578];return _0x149517;};'use strict';var _=require('lodash');var util=require(_0x8fda('0x0'));var logger=require(_0x8fda('0x1'))(_0x8fda('0x2'));var moment=require(_0x8fda('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fda('0x4'));var rimraf=require(_0x8fda('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fda('0x6'));var integrations=require(_0x8fda('0x7'));module[_0x8fda('0x8')]=function(_0x46b196,_0x181c37){return _0x46b196['define'](_0x8fda('0x9'),attributes,{'tableName':_0x8fda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index afb0531..d4b9fe2 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 _0x51f2=['limit','map','include','model','then','stringify','ShowSugarcrmAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x51f2,0xe7));var _0x251f=function(_0x13fa1f,_0x49695f){_0x13fa1f=_0x13fa1f-0x0;var _0x3ecc48=_0x51f2[_0x13fa1f];return _0x3ecc48;};'use strict';var _=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var moment=require(_0x251f('0x2'));var BPromise=require(_0x251f('0x3'));var rs=require(_0x251f('0x4'));var fs=require('fs');var Redis=require(_0x251f('0x5'));var db=require(_0x251f('0x6'))['db'];var utils=require(_0x251f('0x7'));var logger=require(_0x251f('0x8'))(_0x251f('0x9'));var config=require('../../config/environment');var jayson=require(_0x251f('0xa'));var client=jayson[_0x251f('0xb')][_0x251f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x118051,_0x2d0f8e,_0x2c66b4){return new BPromise(function(_0xe3fe95,_0x44be9e){return client[_0x251f('0xd')](_0x118051,_0x2c66b4)['then'](function(_0x47659b){logger[_0x251f('0xe')](_0x251f('0xf'),_0x2d0f8e,_0x251f('0x10'));logger[_0x251f('0x11')](_0x251f('0x12'),_0x2d0f8e,'request\x20sent',JSON['stringify'](_0x47659b));if(_0x47659b[_0x251f('0x13')]){if(_0x47659b[_0x251f('0x13')]['code']===0x1f4){logger[_0x251f('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2d0f8e,_0x47659b[_0x251f('0x13')][_0x251f('0x14')]);return _0x44be9e(_0x47659b[_0x251f('0x13')]['message']);}logger[_0x251f('0x13')](_0x251f('0xf'),_0x2d0f8e,_0x47659b[_0x251f('0x13')][_0x251f('0x14')]);return _0xe3fe95(_0x47659b[_0x251f('0x13')][_0x251f('0x14')]);}else{logger['info'](_0x251f('0xf'),_0x2d0f8e,'request\x20sent');_0xe3fe95(_0x47659b[_0x251f('0x15')][_0x251f('0x14')]);}})[_0x251f('0x16')](function(_0x395b3f){logger[_0x251f('0x13')](_0x251f('0xf'),_0x2d0f8e,_0x395b3f);_0x44be9e(_0x395b3f);});});}exports[_0x251f('0x17')]=function(_0x3f8593){var _0xe553d5=this;return new Promise(function(_0x14f69c,_0x5cd1ea){return db[_0x251f('0x18')]['findAll']({'raw':_0x3f8593[_0x251f('0x19')]?_0x3f8593[_0x251f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f8593[_0x251f('0x19')]?_0x3f8593['options'][_0x251f('0x1a')]||null:null,'attributes':_0x3f8593[_0x251f('0x19')]?_0x3f8593[_0x251f('0x19')][_0x251f('0x1b')]||null:null,'limit':_0x3f8593[_0x251f('0x19')]?_0x3f8593[_0x251f('0x19')][_0x251f('0x1c')]||null:null,'include':_0x3f8593[_0x251f('0x19')]?_0x3f8593[_0x251f('0x19')]['include']?_[_0x251f('0x1d')](_0x3f8593[_0x251f('0x19')][_0x251f('0x1e')],function(_0x1ebcf0){return{'model':db[_0x1ebcf0[_0x251f('0x1f')]],'as':_0x1ebcf0['as'],'attributes':_0x1ebcf0[_0x251f('0x1b')],'include':_0x1ebcf0[_0x251f('0x1e')]?_[_0x251f('0x1d')](_0x1ebcf0['include'],function(_0x5b06ce){return{'model':db[_0x5b06ce[_0x251f('0x1f')]],'as':_0x5b06ce['as'],'attributes':_0x5b06ce[_0x251f('0x1b')],'include':_0x5b06ce[_0x251f('0x1e')]?_[_0x251f('0x1d')](_0x5b06ce[_0x251f('0x1e')],function(_0x39bccf){return{'model':db[_0x39bccf[_0x251f('0x1f')]],'as':_0x39bccf['as'],'attributes':_0x39bccf[_0x251f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x251f('0x20')](function(_0x207661){logger[_0x251f('0xe')](_0x251f('0x17'),_0x3f8593);logger['debug']('GetSugarcrmAccount',_0x3f8593,JSON[_0x251f('0x21')](_0x207661));_0x14f69c(_0x207661);})[_0x251f('0x16')](function(_0x497ce7){logger[_0x251f('0x13')]('GetSugarcrmAccount',_0x497ce7['message'],_0x3f8593);_0x5cd1ea(_0xe553d5[_0x251f('0x13')](0x1f4,_0x497ce7[_0x251f('0x14')]));});});};exports[_0x251f('0x22')]=function(_0x5b0b68){var _0x586f5d=this;return new Promise(function(_0x4d0079,_0x442712){return db[_0x251f('0x18')][_0x251f('0x23')]({'raw':_0x5b0b68[_0x251f('0x19')]?_0x5b0b68['options'][_0x251f('0x24')]===undefined?!![]:![]:!![],'where':_0x5b0b68['options']?_0x5b0b68[_0x251f('0x19')][_0x251f('0x1a')]||null:null,'attributes':_0x5b0b68['options']?_0x5b0b68['options'][_0x251f('0x1b')]||null:null,'include':_0x5b0b68[_0x251f('0x19')]?_0x5b0b68[_0x251f('0x19')][_0x251f('0x1e')]?_[_0x251f('0x1d')](_0x5b0b68[_0x251f('0x19')]['include'],function(_0x35bf48){return{'model':db[_0x35bf48['model']],'as':_0x35bf48['as'],'attributes':_0x35bf48[_0x251f('0x1b')],'include':_0x35bf48[_0x251f('0x1e')]?_[_0x251f('0x1d')](_0x35bf48[_0x251f('0x1e')],function(_0x58bf3b){return{'model':db[_0x58bf3b[_0x251f('0x1f')]],'as':_0x58bf3b['as'],'attributes':_0x58bf3b[_0x251f('0x1b')],'include':_0x58bf3b[_0x251f('0x1e')]?_[_0x251f('0x1d')](_0x58bf3b['include'],function(_0x197f73){return{'model':db[_0x197f73[_0x251f('0x1f')]],'as':_0x197f73['as'],'attributes':_0x197f73[_0x251f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x251f('0x20')](function(_0x3e7675){logger[_0x251f('0xe')](_0x251f('0x22'),_0x5b0b68);logger[_0x251f('0x11')]('ShowSugarcrmAccount',_0x5b0b68,JSON[_0x251f('0x21')](_0x3e7675));_0x4d0079(_0x3e7675);})[_0x251f('0x16')](function(_0x4317d8){logger[_0x251f('0x13')]('ShowSugarcrmAccount',_0x4317d8['message'],_0x5b0b68);_0x442712(_0x586f5d[_0x251f('0x13')](0x1f4,_0x4317d8[_0x251f('0x14')]));});});}; \ No newline at end of file +var _0x65af=['model','attributes','then','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','options','where','limit','include','map'];(function(_0x5df8bb,_0x2d6841){var _0x369f4a=function(_0x717689){while(--_0x717689){_0x5df8bb['push'](_0x5df8bb['shift']());}};_0x369f4a(++_0x2d6841);}(_0x65af,0x104));var _0xf65a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x65af[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0xf65a('0x0'));var moment=require(_0xf65a('0x1'));var BPromise=require(_0xf65a('0x2'));var rs=require(_0xf65a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf65a('0x4'))['db'];var utils=require(_0xf65a('0x5'));var logger=require(_0xf65a('0x6'))('rpc');var config=require(_0xf65a('0x7'));var jayson=require(_0xf65a('0x8'));var client=jayson[_0xf65a('0x9')][_0xf65a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e7a0f,_0x15e448,_0x1e0867){return new BPromise(function(_0x1e77e8,_0x338c36){return client[_0xf65a('0xb')](_0x5e7a0f,_0x1e0867)['then'](function(_0x3d1118){logger[_0xf65a('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x15e448,_0xf65a('0xd'));logger[_0xf65a('0xe')](_0xf65a('0xf'),_0x15e448,_0xf65a('0xd'),JSON['stringify'](_0x3d1118));if(_0x3d1118[_0xf65a('0x10')]){if(_0x3d1118[_0xf65a('0x10')][_0xf65a('0x11')]===0x1f4){logger['error'](_0xf65a('0x12'),_0x15e448,_0x3d1118[_0xf65a('0x10')][_0xf65a('0x13')]);return _0x338c36(_0x3d1118['error']['message']);}logger['error'](_0xf65a('0x12'),_0x15e448,_0x3d1118['error'][_0xf65a('0x13')]);return _0x1e77e8(_0x3d1118[_0xf65a('0x10')][_0xf65a('0x13')]);}else{logger[_0xf65a('0xc')](_0xf65a('0x12'),_0x15e448,_0xf65a('0xd'));_0x1e77e8(_0x3d1118[_0xf65a('0x14')][_0xf65a('0x13')]);}})[_0xf65a('0x15')](function(_0x72c3cf){logger[_0xf65a('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x15e448,_0x72c3cf);_0x338c36(_0x72c3cf);});});}exports[_0xf65a('0x16')]=function(_0x45e044){var _0x222180=this;return new Promise(function(_0x2602c2,_0x3c9b1b){return db['SugarcrmAccount']['findAll']({'raw':_0x45e044[_0xf65a('0x17')]?_0x45e044['options']['raw']===undefined?!![]:![]:!![],'where':_0x45e044['options']?_0x45e044[_0xf65a('0x17')][_0xf65a('0x18')]||null:null,'attributes':_0x45e044['options']?_0x45e044[_0xf65a('0x17')]['attributes']||null:null,'limit':_0x45e044[_0xf65a('0x17')]?_0x45e044[_0xf65a('0x17')][_0xf65a('0x19')]||null:null,'include':_0x45e044['options']?_0x45e044[_0xf65a('0x17')][_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x45e044['options'][_0xf65a('0x1a')],function(_0x4ed955){return{'model':db[_0x4ed955[_0xf65a('0x1c')]],'as':_0x4ed955['as'],'attributes':_0x4ed955[_0xf65a('0x1d')],'include':_0x4ed955[_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x4ed955[_0xf65a('0x1a')],function(_0x510f18){return{'model':db[_0x510f18[_0xf65a('0x1c')]],'as':_0x510f18['as'],'attributes':_0x510f18['attributes'],'include':_0x510f18[_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x510f18[_0xf65a('0x1a')],function(_0x2384f3){return{'model':db[_0x2384f3[_0xf65a('0x1c')]],'as':_0x2384f3['as'],'attributes':_0x2384f3[_0xf65a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf65a('0x1e')](function(_0x4cc61a){logger[_0xf65a('0xc')](_0xf65a('0x16'),_0x45e044);logger['debug'](_0xf65a('0x16'),_0x45e044,JSON[_0xf65a('0x1f')](_0x4cc61a));_0x2602c2(_0x4cc61a);})[_0xf65a('0x15')](function(_0xa46af8){logger['error'](_0xf65a('0x16'),_0xa46af8['message'],_0x45e044);_0x3c9b1b(_0x222180['error'](0x1f4,_0xa46af8['message']));});});};exports[_0xf65a('0x20')]=function(_0x556680){var _0x2f7406=this;return new Promise(function(_0x3380b0,_0x1b271b){return db[_0xf65a('0x21')][_0xf65a('0x22')]({'raw':_0x556680[_0xf65a('0x17')]?_0x556680[_0xf65a('0x17')][_0xf65a('0x23')]===undefined?!![]:![]:!![],'where':_0x556680[_0xf65a('0x17')]?_0x556680[_0xf65a('0x17')]['where']||null:null,'attributes':_0x556680[_0xf65a('0x17')]?_0x556680['options'][_0xf65a('0x1d')]||null:null,'include':_0x556680[_0xf65a('0x17')]?_0x556680[_0xf65a('0x17')][_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x556680[_0xf65a('0x17')]['include'],function(_0x812a60){return{'model':db[_0x812a60[_0xf65a('0x1c')]],'as':_0x812a60['as'],'attributes':_0x812a60['attributes'],'include':_0x812a60[_0xf65a('0x1a')]?_['map'](_0x812a60[_0xf65a('0x1a')],function(_0x58a9da){return{'model':db[_0x58a9da[_0xf65a('0x1c')]],'as':_0x58a9da['as'],'attributes':_0x58a9da[_0xf65a('0x1d')],'include':_0x58a9da[_0xf65a('0x1a')]?_[_0xf65a('0x1b')](_0x58a9da[_0xf65a('0x1a')],function(_0xd6aef1){return{'model':db[_0xd6aef1['model']],'as':_0xd6aef1['as'],'attributes':_0xd6aef1[_0xf65a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf65a('0x1e')](function(_0xd8c8a){logger[_0xf65a('0xc')](_0xf65a('0x20'),_0x556680);logger['debug'](_0xf65a('0x20'),_0x556680,JSON[_0xf65a('0x1f')](_0xd8c8a));_0x3380b0(_0xd8c8a);})[_0xf65a('0x15')](function(_0x22b26b){logger[_0xf65a('0x10')]('ShowSugarcrmAccount',_0x22b26b['message'],_0x556680);_0x1b271b(_0x2f7406[_0xf65a('0x10')](0x1f4,_0x22b26b[_0xf65a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4f2b34d..8a9d658 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 _0x2139=['show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','post','put','exports','multer','util','path','connect-timeout','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id'];(function(_0x62371,_0x5abc21){var _0x1d6dcc=function(_0x5f2b36){while(--_0x5f2b36){_0x62371['push'](_0x62371['shift']());}};_0x1d6dcc(++_0x5abc21);}(_0x2139,0xd5));var _0x9213=function(_0x4f3561,_0x4ec3a8){_0x4f3561=_0x4f3561-0x0;var _0x51fe42=_0x2139[_0x4f3561];return _0x51fe42;};'use strict';var multer=require(_0x9213('0x0'));var util=require(_0x9213('0x1'));var path=require(_0x9213('0x2'));var timeout=require(_0x9213('0x3'));var express=require('express');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(_0x9213('0x4'));var controller=require(_0x9213('0x5'));router[_0x9213('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9213('0x6')](_0x9213('0x7'),auth['isAuthenticated'](),controller[_0x9213('0x8')]);router[_0x9213('0x6')](_0x9213('0x9'),auth[_0x9213('0xa')](),controller[_0x9213('0xb')]);router[_0x9213('0x6')]('/:id/subjects',auth[_0x9213('0xa')](),controller[_0x9213('0xc')]);router[_0x9213('0x6')](_0x9213('0xd'),auth[_0x9213('0xa')](),controller['getDescriptions']);router[_0x9213('0xe')]('/',auth[_0x9213('0xa')](),controller['create']);router[_0x9213('0xf')](_0x9213('0x7'),auth[_0x9213('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9213('0x10')]=router; \ No newline at end of file +var _0x30dd=['index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x5956e3,_0x337aad){var _0x5c68e2=function(_0x513690){while(--_0x513690){_0x5956e3['push'](_0x5956e3['shift']());}};_0x5c68e2(++_0x337aad);}(_0x30dd,0xee));var _0xd30d=function(_0x51ef40,_0x48a870){_0x51ef40=_0x51ef40-0x0;var _0x3ff060=_0x30dd[_0x51ef40];return _0x3ff060;};'use strict';var multer=require(_0xd30d('0x0'));var util=require('util');var path=require(_0xd30d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd30d('0x2')]();var fs_extra=require(_0xd30d('0x3'));var auth=require(_0xd30d('0x4'));var interaction=require(_0xd30d('0x5'));var config=require(_0xd30d('0x6'));var controller=require(_0xd30d('0x7'));router[_0xd30d('0x8')]('/',auth['isAuthenticated'](),controller[_0xd30d('0x9')]);router[_0xd30d('0x8')](_0xd30d('0xa'),auth[_0xd30d('0xb')](),controller[_0xd30d('0xc')]);router[_0xd30d('0x8')](_0xd30d('0xd'),auth[_0xd30d('0xb')](),controller[_0xd30d('0xe')]);router[_0xd30d('0x8')](_0xd30d('0xf'),auth[_0xd30d('0xb')](),controller['getSubjects']);router[_0xd30d('0x8')](_0xd30d('0x10'),auth[_0xd30d('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xd30d('0xb')](),controller[_0xd30d('0x11')]);router['put'](_0xd30d('0xa'),auth[_0xd30d('0xb')](),controller['update']);router['delete'](_0xd30d('0xa'),auth[_0xd30d('0xb')](),controller[_0xd30d('0x12')]);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 4aac5c8..eb4765d 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 _0x0bb5=['STRING','sequelize','exports'];(function(_0x1bbef4,_0x173c3e){var _0x2f2fd4=function(_0x5db998){while(--_0x5db998){_0x1bbef4['push'](_0x1bbef4['shift']());}};_0x2f2fd4(++_0x173c3e);}(_0x0bb5,0x7f));var _0x50bb=function(_0xff1be8,_0x44ab6e){_0xff1be8=_0xff1be8-0x0;var _0x3c0750=_0x0bb5[_0xff1be8];return _0x3c0750;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'name':{'type':Sequelize[_0x50bb('0x2')]},'description':{'type':Sequelize[_0x50bb('0x2')]}}; \ No newline at end of file +var _0x376b=['exports','STRING','sequelize'];(function(_0x1f9b94,_0x53302b){var _0xd6ef4d=function(_0x411776){while(--_0x411776){_0x1f9b94['push'](_0x1f9b94['shift']());}};_0xd6ef4d(++_0x53302b);}(_0x376b,0xe0));var _0xb376=function(_0x17d1ba,_0x4f2f33){_0x17d1ba=_0x17d1ba-0x0;var _0x57b2c1=_0x376b[_0x17d1ba];return _0x57b2c1;};'use strict';var Sequelize=require(_0xb376('0x0'));module[_0xb376('0x1')]={'name':{'type':Sequelize[_0xb376('0x2')]},'description':{'type':Sequelize[_0xb376('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 652357f..d1e3ee6 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 _0x1ca2=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SugarcrmConfiguration','findAll','rows','catch','params','includeAll','include','find','create','body','destroy','getFields','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection'];(function(_0x55dc17,_0x1eccc2){var _0x5c8fa9=function(_0x5a5b90){while(--_0x5a5b90){_0x55dc17['push'](_0x55dc17['shift']());}};_0x5c8fa9(++_0x1eccc2);}(_0x1ca2,0x1e9));var _0x21ca=function(_0x3d20d1,_0x5bdb8a){_0x3d20d1=_0x3d20d1-0x0;var _0x4d28a0=_0x1ca2[_0x3d20d1];return _0x4d28a0;};'use strict';var emlformat=require(_0x21ca('0x0'));var rimraf=require(_0x21ca('0x1'));var zipdir=require(_0x21ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x21ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x21ca('0x4'));var util=require(_0x21ca('0x5'));var path=require(_0x21ca('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x21ca('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21ca('0x8'));var squel=require(_0x21ca('0x9'));var crypto=require(_0x21ca('0xa'));var jsforce=require(_0x21ca('0xb'));var deskjs=require(_0x21ca('0xc'));var toCsv=require(_0x21ca('0xd'));var querystring=require(_0x21ca('0xe'));var Papa=require(_0x21ca('0xf'));var Redis=require(_0x21ca('0x10'));var authService=require(_0x21ca('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x21ca('0x12'));var hardwareService=require(_0x21ca('0x13'));var logger=require('../../config/logger')(_0x21ca('0x14'));var utils=require(_0x21ca('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x21ca('0x16'));var db=require(_0x21ca('0x17'))['db'];function respondWithStatusCode(_0x18389e,_0x10d519){_0x10d519=_0x10d519||0xcc;return function(_0x119028){if(_0x119028){return _0x18389e[_0x21ca('0x18')](_0x10d519);}return _0x18389e['status'](_0x10d519)[_0x21ca('0x19')]();};}function respondWithResult(_0x1d69d6,_0x109ef4){_0x109ef4=_0x109ef4||0xc8;return function(_0x50f0ef){if(_0x50f0ef){return _0x1d69d6[_0x21ca('0x1a')](_0x109ef4)[_0x21ca('0x1b')](_0x50f0ef);}};}function respondWithFilteredResult(_0x2d7e1c,_0x25490b){return function(_0x4a6ae2){if(_0x4a6ae2){var _0x21ad66=typeof _0x25490b[_0x21ca('0x1c')]===_0x21ca('0x1d')&&typeof _0x25490b[_0x21ca('0x1e')]===_0x21ca('0x1d');var _0x147dd4=_0x4a6ae2['count'];var _0x42b20b=_0x21ad66?0x0:_0x25490b[_0x21ca('0x1c')];var _0x3c4cc2=_0x21ad66?_0x4a6ae2[_0x21ca('0x1f')]:_0x25490b[_0x21ca('0x1c')]+_0x25490b[_0x21ca('0x1e')];var _0x19d6a1;if(_0x3c4cc2>=_0x147dd4){_0x3c4cc2=_0x147dd4;_0x19d6a1=0xc8;}else{_0x19d6a1=0xce;}_0x2d7e1c[_0x21ca('0x1a')](_0x19d6a1);return _0x2d7e1c[_0x21ca('0x20')](_0x21ca('0x21'),_0x42b20b+'-'+_0x3c4cc2+'/'+_0x147dd4)[_0x21ca('0x1b')](_0x4a6ae2);}return null;};}function patchUpdates(_0x54fc92){return function(_0x3771a8){try{jsonpatch[_0x21ca('0x22')](_0x3771a8,_0x54fc92,!![]);}catch(_0xff2ead){return BPromise[_0x21ca('0x23')](_0xff2ead);}return _0x3771a8[_0x21ca('0x24')]();};}function saveUpdates(_0x39c2cc,_0x23d92e){return function(_0x23375f){if(_0x23375f){return _0x23375f[_0x21ca('0x25')](_0x39c2cc)[_0x21ca('0x26')](function(_0x5136e6){return _0x5136e6;});}return null;};}function removeEntity(_0x3654a2,_0x54dc69){return function(_0x602be6){if(_0x602be6){return _0x602be6['destroy']()['then'](function(){_0x3654a2['status'](0xcc)[_0x21ca('0x19')]();});}};}function handleEntityNotFound(_0x1223c7,_0xd26aca){return function(_0x4378e0){if(!_0x4378e0){_0x1223c7[_0x21ca('0x18')](0x194);}return _0x4378e0;};}function handleError(_0x571c13,_0x31fae4){_0x31fae4=_0x31fae4||0x1f4;return function(_0x36cde6){logger['error'](_0x36cde6['stack']);if(_0x36cde6[_0x21ca('0x27')]){delete _0x36cde6[_0x21ca('0x27')];}_0x571c13['status'](_0x31fae4)[_0x21ca('0x28')](_0x36cde6);};}exports[_0x21ca('0x29')]=function(_0x2e747b,_0x36ba8b){var _0x3f3fd1={},_0x404ee2={},_0x585492={'count':0x0,'rows':[]};var _0x123251=_[_0x21ca('0x2a')](db['SugarcrmConfiguration'][_0x21ca('0x2b')],function(_0x40ec16){return{'name':_0x40ec16['fieldName'],'type':_0x40ec16[_0x21ca('0x2c')]['key']};});_0x404ee2[_0x21ca('0x2d')]=_[_0x21ca('0x2a')](_0x123251,'name');_0x404ee2[_0x21ca('0x2e')]=_[_0x21ca('0x2f')](_0x2e747b[_0x21ca('0x2e')]);_0x404ee2[_0x21ca('0x30')]=_[_0x21ca('0x31')](_0x404ee2[_0x21ca('0x2d')],_0x404ee2[_0x21ca('0x2e')]);_0x3f3fd1[_0x21ca('0x32')]=_['intersection'](_0x404ee2[_0x21ca('0x2d')],qs[_0x21ca('0x33')](_0x2e747b[_0x21ca('0x2e')]['fields']));_0x3f3fd1[_0x21ca('0x32')]=_0x3f3fd1['attributes'][_0x21ca('0x34')]?_0x3f3fd1[_0x21ca('0x32')]:_0x404ee2[_0x21ca('0x2d')];if(!_0x2e747b[_0x21ca('0x2e')][_0x21ca('0x35')](_0x21ca('0x36'))){_0x3f3fd1[_0x21ca('0x1e')]=qs['limit'](_0x2e747b[_0x21ca('0x2e')][_0x21ca('0x1e')]);_0x3f3fd1['offset']=qs[_0x21ca('0x1c')](_0x2e747b[_0x21ca('0x2e')][_0x21ca('0x1c')]);}_0x3f3fd1[_0x21ca('0x37')]=qs['sort'](_0x2e747b[_0x21ca('0x2e')][_0x21ca('0x38')]);_0x3f3fd1[_0x21ca('0x39')]=qs[_0x21ca('0x30')](_[_0x21ca('0x3a')](_0x2e747b[_0x21ca('0x2e')],_0x404ee2[_0x21ca('0x30')]),_0x123251);if(_0x2e747b[_0x21ca('0x2e')][_0x21ca('0x3b')]){_0x3f3fd1[_0x21ca('0x39')]=_[_0x21ca('0x3c')](_0x3f3fd1[_0x21ca('0x39')],{'$or':_[_0x21ca('0x2a')](_0x123251,function(_0x2ca681){if(_0x2ca681[_0x21ca('0x2c')]!=='VIRTUAL'){var _0xf8b5e2={};_0xf8b5e2[_0x2ca681[_0x21ca('0x27')]]={'$like':'%'+_0x2e747b[_0x21ca('0x2e')][_0x21ca('0x3b')]+'%'};return _0xf8b5e2;}})});}_0x3f3fd1=_['merge']({},_0x3f3fd1,_0x2e747b[_0x21ca('0x3d')]);var _0x4811f5={'where':_0x3f3fd1['where']};return db[_0x21ca('0x3e')][_0x21ca('0x1f')](_0x4811f5)['then'](function(_0x53148f){_0x585492['count']=_0x53148f;if(_0x2e747b['query']['includeAll']){_0x3f3fd1['include']=[{'all':!![]}];}return db[_0x21ca('0x3e')][_0x21ca('0x3f')](_0x3f3fd1);})[_0x21ca('0x26')](function(_0x33cb1f){_0x585492[_0x21ca('0x40')]=_0x33cb1f;return _0x585492;})[_0x21ca('0x26')](respondWithFilteredResult(_0x36ba8b,_0x3f3fd1))[_0x21ca('0x41')](handleError(_0x36ba8b,null));};exports['show']=function(_0x2663e6,_0x1839fc){var _0x339723={'raw':![],'where':{'id':_0x2663e6[_0x21ca('0x42')]['id']}},_0x55a2b3={};_0x55a2b3['model']=_[_0x21ca('0x2f')](db[_0x21ca('0x3e')][_0x21ca('0x2b')]);_0x55a2b3['query']=_[_0x21ca('0x2f')](_0x2663e6[_0x21ca('0x2e')]);_0x55a2b3['filters']=_[_0x21ca('0x31')](_0x55a2b3[_0x21ca('0x2d')],_0x55a2b3[_0x21ca('0x2e')]);_0x339723[_0x21ca('0x32')]=_[_0x21ca('0x31')](_0x55a2b3[_0x21ca('0x2d')],qs[_0x21ca('0x33')](_0x2663e6[_0x21ca('0x2e')][_0x21ca('0x33')]));_0x339723[_0x21ca('0x32')]=_0x339723[_0x21ca('0x32')][_0x21ca('0x34')]?_0x339723[_0x21ca('0x32')]:_0x55a2b3[_0x21ca('0x2d')];if(_0x2663e6[_0x21ca('0x2e')][_0x21ca('0x43')]){_0x339723[_0x21ca('0x44')]=[{'all':!![]}];}_0x339723=_[_0x21ca('0x3c')]({},_0x339723,_0x2663e6[_0x21ca('0x3d')]);return db[_0x21ca('0x3e')][_0x21ca('0x45')](_0x339723)[_0x21ca('0x26')](handleEntityNotFound(_0x1839fc,null))[_0x21ca('0x26')](respondWithResult(_0x1839fc,null))[_0x21ca('0x41')](handleError(_0x1839fc,null));};exports[_0x21ca('0x46')]=function(_0x55e637,_0x3e9272){return db['SugarcrmConfiguration']['create'](_0x55e637[_0x21ca('0x47')],{})[_0x21ca('0x26')](respondWithResult(_0x3e9272,0xc9))[_0x21ca('0x41')](handleError(_0x3e9272,null));};exports[_0x21ca('0x25')]=function(_0x1a48cb,_0x4d91b7){if(_0x1a48cb[_0x21ca('0x47')]['id']){delete _0x1a48cb[_0x21ca('0x47')]['id'];}return db['SugarcrmConfiguration'][_0x21ca('0x45')]({'where':{'id':_0x1a48cb[_0x21ca('0x42')]['id']}})[_0x21ca('0x26')](handleEntityNotFound(_0x4d91b7,null))[_0x21ca('0x26')](saveUpdates(_0x1a48cb[_0x21ca('0x47')],null))[_0x21ca('0x26')](respondWithResult(_0x4d91b7,null))['catch'](handleError(_0x4d91b7,null));};exports[_0x21ca('0x48')]=function(_0x2e3bb5,_0xe1d71f){return db[_0x21ca('0x3e')][_0x21ca('0x45')]({'where':{'id':_0x2e3bb5[_0x21ca('0x42')]['id']}})['then'](handleEntityNotFound(_0xe1d71f,null))[_0x21ca('0x26')](removeEntity(_0xe1d71f,null))['catch'](handleError(_0xe1d71f,null));};exports['getFields']=function(_0x347c8e,_0x9e47e2,_0x5debc3){var _0x466ac7={};var _0x36c925={};var _0x5a0d48;var _0xdd6ba1;return db[_0x21ca('0x3e')]['findOne']({'where':{'id':_0x347c8e[_0x21ca('0x42')]['id']}})[_0x21ca('0x26')](handleEntityNotFound(_0x9e47e2,null))[_0x21ca('0x26')](function(_0x23c83b){if(_0x23c83b){_0x5a0d48=_0x23c83b;_0x36c925[_0x21ca('0x2d')]=_[_0x21ca('0x2f')](db['SugarcrmField'][_0x21ca('0x2b')]);_0x36c925[_0x21ca('0x2e')]=_[_0x21ca('0x2f')](_0x347c8e[_0x21ca('0x2e')]);_0x36c925['filters']=_['intersection'](_0x36c925[_0x21ca('0x2d')],_0x36c925['query']);_0x466ac7['attributes']=_['intersection'](_0x36c925['model'],qs['fields'](_0x347c8e[_0x21ca('0x2e')]['fields']));_0x466ac7['attributes']=_0x466ac7[_0x21ca('0x32')][_0x21ca('0x34')]?_0x466ac7['attributes']:_0x36c925['model'];_0x466ac7[_0x21ca('0x37')]=qs['sort'](_0x347c8e[_0x21ca('0x2e')][_0x21ca('0x38')]);_0x466ac7[_0x21ca('0x39')]=qs[_0x21ca('0x30')](_[_0x21ca('0x3a')](_0x347c8e['query'],_0x36c925['filters']));if(_0x347c8e[_0x21ca('0x2e')]['filter']){_0x466ac7[_0x21ca('0x39')]=_[_0x21ca('0x3c')](_0x466ac7['where'],{'$or':_[_0x21ca('0x2a')](_0x466ac7[_0x21ca('0x32')],function(_0x54cebe){var _0x435e2e={};_0x435e2e[_0x54cebe]={'$like':'%'+_0x347c8e[_0x21ca('0x2e')]['filter']+'%'};return _0x435e2e;})});}_0x466ac7=_['merge']({},_0x466ac7,_0x347c8e[_0x21ca('0x3d')]);return _0x5a0d48[_0x21ca('0x49')](_0x466ac7);}})[_0x21ca('0x26')](function(_0x1cf33e){if(_0x1cf33e){_0xdd6ba1=_0x1cf33e['length'];if(!_0x347c8e[_0x21ca('0x2e')][_0x21ca('0x35')](_0x21ca('0x36'))){_0x466ac7[_0x21ca('0x1e')]=qs[_0x21ca('0x1e')](_0x347c8e['query'][_0x21ca('0x1e')]);_0x466ac7['offset']=qs[_0x21ca('0x1c')](_0x347c8e[_0x21ca('0x2e')][_0x21ca('0x1c')]);}return _0x5a0d48[_0x21ca('0x49')](_0x466ac7);}})[_0x21ca('0x26')](function(_0x552a44){if(_0x552a44){return _0x552a44?{'count':_0xdd6ba1,'rows':_0x552a44}:null;}})[_0x21ca('0x26')](respondWithResult(_0x9e47e2,null))[_0x21ca('0x41')](handleError(_0x9e47e2,null));};exports['getSubjects']=function(_0x3e6383,_0x582b0d,_0x5abd26){var _0x3419cb={};var _0x59d603={};var _0x27eeb0;var _0x3b037d;return db[_0x21ca('0x3e')]['findOne']({'where':{'id':_0x3e6383[_0x21ca('0x42')]['id']}})[_0x21ca('0x26')](handleEntityNotFound(_0x582b0d,null))[_0x21ca('0x26')](function(_0x452722){if(_0x452722){_0x27eeb0=_0x452722;_0x59d603[_0x21ca('0x2d')]=_[_0x21ca('0x2f')](db[_0x21ca('0x4a')][_0x21ca('0x2b')]);_0x59d603['query']=_['keys'](_0x3e6383[_0x21ca('0x2e')]);_0x59d603[_0x21ca('0x30')]=_[_0x21ca('0x31')](_0x59d603[_0x21ca('0x2d')],_0x59d603['query']);_0x3419cb[_0x21ca('0x32')]=_[_0x21ca('0x31')](_0x59d603[_0x21ca('0x2d')],qs[_0x21ca('0x33')](_0x3e6383[_0x21ca('0x2e')][_0x21ca('0x33')]));_0x3419cb['attributes']=_0x3419cb[_0x21ca('0x32')][_0x21ca('0x34')]?_0x3419cb[_0x21ca('0x32')]:_0x59d603['model'];_0x3419cb['order']=qs[_0x21ca('0x38')](_0x3e6383[_0x21ca('0x2e')]['sort']);_0x3419cb[_0x21ca('0x39')]=qs[_0x21ca('0x30')](_[_0x21ca('0x3a')](_0x3e6383['query'],_0x59d603['filters']));if(_0x3e6383[_0x21ca('0x2e')][_0x21ca('0x3b')]){_0x3419cb[_0x21ca('0x39')]=_[_0x21ca('0x3c')](_0x3419cb[_0x21ca('0x39')],{'$or':_[_0x21ca('0x2a')](_0x3419cb['attributes'],function(_0x46c164){var _0x40090b={};_0x40090b[_0x46c164]={'$like':'%'+_0x3e6383['query'][_0x21ca('0x3b')]+'%'};return _0x40090b;})});}_0x3419cb=_[_0x21ca('0x3c')]({},_0x3419cb,_0x3e6383[_0x21ca('0x3d')]);return _0x27eeb0['getSubjects'](_0x3419cb);}})[_0x21ca('0x26')](function(_0x5159a2){if(_0x5159a2){_0x3b037d=_0x5159a2['length'];if(!_0x3e6383[_0x21ca('0x2e')][_0x21ca('0x35')](_0x21ca('0x36'))){_0x3419cb['limit']=qs[_0x21ca('0x1e')](_0x3e6383['query'][_0x21ca('0x1e')]);_0x3419cb[_0x21ca('0x1c')]=qs[_0x21ca('0x1c')](_0x3e6383[_0x21ca('0x2e')][_0x21ca('0x1c')]);}return _0x27eeb0[_0x21ca('0x4b')](_0x3419cb);}})[_0x21ca('0x26')](function(_0x2e5490){if(_0x2e5490){return _0x2e5490?{'count':_0x3b037d,'rows':_0x2e5490}:null;}})['then'](respondWithResult(_0x582b0d,null))['catch'](handleError(_0x582b0d,null));};exports[_0x21ca('0x4c')]=function(_0x3bc754,_0x49be95,_0x58bd00){var _0x7ea04d={};var _0x5b2ba1={};var _0x22ad16;var _0x49143d;return db[_0x21ca('0x3e')]['findOne']({'where':{'id':_0x3bc754[_0x21ca('0x42')]['id']}})[_0x21ca('0x26')](handleEntityNotFound(_0x49be95,null))['then'](function(_0xfc93c7){if(_0xfc93c7){_0x22ad16=_0xfc93c7;_0x5b2ba1[_0x21ca('0x2d')]=_[_0x21ca('0x2f')](db[_0x21ca('0x4a')]['rawAttributes']);_0x5b2ba1['query']=_[_0x21ca('0x2f')](_0x3bc754[_0x21ca('0x2e')]);_0x5b2ba1['filters']=_[_0x21ca('0x31')](_0x5b2ba1[_0x21ca('0x2d')],_0x5b2ba1[_0x21ca('0x2e')]);_0x7ea04d[_0x21ca('0x32')]=_[_0x21ca('0x31')](_0x5b2ba1[_0x21ca('0x2d')],qs['fields'](_0x3bc754[_0x21ca('0x2e')][_0x21ca('0x33')]));_0x7ea04d[_0x21ca('0x32')]=_0x7ea04d[_0x21ca('0x32')][_0x21ca('0x34')]?_0x7ea04d[_0x21ca('0x32')]:_0x5b2ba1['model'];_0x7ea04d[_0x21ca('0x37')]=qs[_0x21ca('0x38')](_0x3bc754['query'][_0x21ca('0x38')]);_0x7ea04d[_0x21ca('0x39')]=qs[_0x21ca('0x30')](_[_0x21ca('0x3a')](_0x3bc754[_0x21ca('0x2e')],_0x5b2ba1[_0x21ca('0x30')]));if(_0x3bc754['query'][_0x21ca('0x3b')]){_0x7ea04d[_0x21ca('0x39')]=_[_0x21ca('0x3c')](_0x7ea04d[_0x21ca('0x39')],{'$or':_['map'](_0x7ea04d[_0x21ca('0x32')],function(_0x5076b0){var _0x5c582c={};_0x5c582c[_0x5076b0]={'$like':'%'+_0x3bc754[_0x21ca('0x2e')]['filter']+'%'};return _0x5c582c;})});}_0x7ea04d=_[_0x21ca('0x3c')]({},_0x7ea04d,_0x3bc754[_0x21ca('0x3d')]);return _0x22ad16['getDescriptions'](_0x7ea04d);}})[_0x21ca('0x26')](function(_0x11d44f){if(_0x11d44f){_0x49143d=_0x11d44f[_0x21ca('0x34')];if(!_0x3bc754[_0x21ca('0x2e')][_0x21ca('0x35')](_0x21ca('0x36'))){_0x7ea04d[_0x21ca('0x1e')]=qs['limit'](_0x3bc754[_0x21ca('0x2e')][_0x21ca('0x1e')]);_0x7ea04d[_0x21ca('0x1c')]=qs[_0x21ca('0x1c')](_0x3bc754[_0x21ca('0x2e')][_0x21ca('0x1c')]);}return _0x22ad16[_0x21ca('0x4c')](_0x7ea04d);}})[_0x21ca('0x26')](function(_0x4c2059){if(_0x4c2059){return _0x4c2059?{'count':_0x49143d,'rows':_0x4c2059}:null;}})[_0x21ca('0x26')](respondWithResult(_0x49be95,null))[_0x21ca('0x41')](handleError(_0x49be95,null));}; \ No newline at end of file +var _0x1ec0=['find','catch','create','params','body','getFields','SugarcrmField','options','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','name','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','keys','intersection'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x1ec0,0xf2));var _0x01ec=function(_0x589d2f,_0xc49372){_0x589d2f=_0x589d2f-0x0;var _0x1db27c=_0x1ec0[_0x589d2f];return _0x1db27c;};'use strict';var emlformat=require(_0x01ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x01ec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x01ec('0x2'));var moment=require(_0x01ec('0x3'));var BPromise=require(_0x01ec('0x4'));var Mustache=require('mustache');var util=require(_0x01ec('0x5'));var path=require(_0x01ec('0x6'));var sox=require('sox');var csv=require(_0x01ec('0x7'));var ejs=require(_0x01ec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01ec('0x9'));var squel=require(_0x01ec('0xa'));var crypto=require(_0x01ec('0xb'));var jsforce=require(_0x01ec('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x01ec('0x7'));var querystring=require(_0x01ec('0xd'));var Papa=require('papaparse');var Redis=require(_0x01ec('0xe'));var authService=require(_0x01ec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x01ec('0x10'));var hardwareService=require(_0x01ec('0x11'));var logger=require(_0x01ec('0x12'))('api');var utils=require(_0x01ec('0x13'));var config=require(_0x01ec('0x14'));var licenseUtil=require(_0x01ec('0x15'));var db=require(_0x01ec('0x16'))['db'];function respondWithStatusCode(_0x44dd11,_0x460463){_0x460463=_0x460463||0xcc;return function(_0x351f89){if(_0x351f89){return _0x44dd11[_0x01ec('0x17')](_0x460463);}return _0x44dd11['status'](_0x460463)[_0x01ec('0x18')]();};}function respondWithResult(_0x574cdd,_0x2350a4){_0x2350a4=_0x2350a4||0xc8;return function(_0x41b5ba){if(_0x41b5ba){return _0x574cdd['status'](_0x2350a4)[_0x01ec('0x19')](_0x41b5ba);}};}function respondWithFilteredResult(_0x2da33a,_0x493ed1){return function(_0x4a3eb3){if(_0x4a3eb3){var _0x54a41f=typeof _0x493ed1[_0x01ec('0x1a')]===_0x01ec('0x1b')&&typeof _0x493ed1[_0x01ec('0x1c')]===_0x01ec('0x1b');var _0x17c9c8=_0x4a3eb3[_0x01ec('0x1d')];var _0x5adc41=_0x54a41f?0x0:_0x493ed1['offset'];var _0x18e175=_0x54a41f?_0x4a3eb3[_0x01ec('0x1d')]:_0x493ed1[_0x01ec('0x1a')]+_0x493ed1[_0x01ec('0x1c')];var _0x5cc636;if(_0x18e175>=_0x17c9c8){_0x18e175=_0x17c9c8;_0x5cc636=0xc8;}else{_0x5cc636=0xce;}_0x2da33a[_0x01ec('0x1e')](_0x5cc636);return _0x2da33a[_0x01ec('0x1f')](_0x01ec('0x20'),_0x5adc41+'-'+_0x18e175+'/'+_0x17c9c8)[_0x01ec('0x19')](_0x4a3eb3);}return null;};}function patchUpdates(_0x31efb0){return function(_0x15e4e5){try{jsonpatch['apply'](_0x15e4e5,_0x31efb0,!![]);}catch(_0x4f1427){return BPromise[_0x01ec('0x21')](_0x4f1427);}return _0x15e4e5[_0x01ec('0x22')]();};}function saveUpdates(_0xa3927d,_0x38c200){return function(_0x4f690c){if(_0x4f690c){return _0x4f690c[_0x01ec('0x23')](_0xa3927d)['then'](function(_0x15539f){return _0x15539f;});}return null;};}function removeEntity(_0x391bae,_0x4424f7){return function(_0x94732a){if(_0x94732a){return _0x94732a[_0x01ec('0x24')]()[_0x01ec('0x25')](function(){_0x391bae['status'](0xcc)[_0x01ec('0x18')]();});}};}function handleEntityNotFound(_0x15364b,_0x2394b1){return function(_0x2276a2){if(!_0x2276a2){_0x15364b[_0x01ec('0x17')](0x194);}return _0x2276a2;};}function handleError(_0x3aa7d8,_0xe01589){_0xe01589=_0xe01589||0x1f4;return function(_0x1a30a1){logger['error'](_0x1a30a1['stack']);if(_0x1a30a1[_0x01ec('0x26')]){delete _0x1a30a1['name'];}_0x3aa7d8[_0x01ec('0x1e')](_0xe01589)['send'](_0x1a30a1);};}exports['index']=function(_0x236b2f,_0x71fcde){var _0x31cc86={},_0x3a7f26={},_0x5e808f={'count':0x0,'rows':[]};var _0x42c260=_[_0x01ec('0x27')](db[_0x01ec('0x28')][_0x01ec('0x29')],function(_0x45cf6e){return{'name':_0x45cf6e[_0x01ec('0x2a')],'type':_0x45cf6e[_0x01ec('0x2b')][_0x01ec('0x2c')]};});_0x3a7f26[_0x01ec('0x2d')]=_['map'](_0x42c260,_0x01ec('0x26'));_0x3a7f26[_0x01ec('0x2e')]=_['keys'](_0x236b2f[_0x01ec('0x2e')]);_0x3a7f26[_0x01ec('0x2f')]=_['intersection'](_0x3a7f26[_0x01ec('0x2d')],_0x3a7f26['query']);_0x31cc86[_0x01ec('0x30')]=_['intersection'](_0x3a7f26[_0x01ec('0x2d')],qs[_0x01ec('0x31')](_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x31')]));_0x31cc86[_0x01ec('0x30')]=_0x31cc86[_0x01ec('0x30')][_0x01ec('0x32')]?_0x31cc86[_0x01ec('0x30')]:_0x3a7f26[_0x01ec('0x2d')];if(!_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x33')](_0x01ec('0x34'))){_0x31cc86[_0x01ec('0x1c')]=qs[_0x01ec('0x1c')](_0x236b2f['query'][_0x01ec('0x1c')]);_0x31cc86['offset']=qs[_0x01ec('0x1a')](_0x236b2f[_0x01ec('0x2e')]['offset']);}_0x31cc86[_0x01ec('0x35')]=qs[_0x01ec('0x36')](_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x36')]);_0x31cc86[_0x01ec('0x37')]=qs[_0x01ec('0x2f')](_[_0x01ec('0x38')](_0x236b2f[_0x01ec('0x2e')],_0x3a7f26['filters']),_0x42c260);if(_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x39')]){_0x31cc86[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x31cc86['where'],{'$or':_[_0x01ec('0x27')](_0x42c260,function(_0x1fc30b){if(_0x1fc30b['type']!==_0x01ec('0x3b')){var _0x2bccbe={};_0x2bccbe[_0x1fc30b[_0x01ec('0x26')]]={'$like':'%'+_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x39')]+'%'};return _0x2bccbe;}})});}_0x31cc86=_[_0x01ec('0x3a')]({},_0x31cc86,_0x236b2f['options']);var _0x3022f6={'where':_0x31cc86[_0x01ec('0x37')]};return db[_0x01ec('0x28')][_0x01ec('0x1d')](_0x3022f6)[_0x01ec('0x25')](function(_0x303b70){_0x5e808f[_0x01ec('0x1d')]=_0x303b70;if(_0x236b2f[_0x01ec('0x2e')][_0x01ec('0x3c')]){_0x31cc86[_0x01ec('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x31cc86);})[_0x01ec('0x25')](function(_0x38f53d){_0x5e808f[_0x01ec('0x3e')]=_0x38f53d;return _0x5e808f;})[_0x01ec('0x25')](respondWithFilteredResult(_0x71fcde,_0x31cc86))['catch'](handleError(_0x71fcde,null));};exports[_0x01ec('0x3f')]=function(_0x523221,_0x52f7df){var _0x55abc2={'raw':![],'where':{'id':_0x523221['params']['id']}},_0x43b5d0={};_0x43b5d0[_0x01ec('0x2d')]=_[_0x01ec('0x40')](db[_0x01ec('0x28')][_0x01ec('0x29')]);_0x43b5d0[_0x01ec('0x2e')]=_[_0x01ec('0x40')](_0x523221[_0x01ec('0x2e')]);_0x43b5d0[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0x43b5d0['model'],_0x43b5d0[_0x01ec('0x2e')]);_0x55abc2[_0x01ec('0x30')]=_[_0x01ec('0x41')](_0x43b5d0[_0x01ec('0x2d')],qs['fields'](_0x523221[_0x01ec('0x2e')][_0x01ec('0x31')]));_0x55abc2['attributes']=_0x55abc2[_0x01ec('0x30')][_0x01ec('0x32')]?_0x55abc2[_0x01ec('0x30')]:_0x43b5d0[_0x01ec('0x2d')];if(_0x523221[_0x01ec('0x2e')][_0x01ec('0x3c')]){_0x55abc2[_0x01ec('0x3d')]=[{'all':!![]}];}_0x55abc2=_['merge']({},_0x55abc2,_0x523221['options']);return db[_0x01ec('0x28')][_0x01ec('0x42')](_0x55abc2)[_0x01ec('0x25')](handleEntityNotFound(_0x52f7df,null))[_0x01ec('0x25')](respondWithResult(_0x52f7df,null))[_0x01ec('0x43')](handleError(_0x52f7df,null));};exports['create']=function(_0x10fd49,_0x2bab8b){return db[_0x01ec('0x28')][_0x01ec('0x44')](_0x10fd49['body'],{})['then'](respondWithResult(_0x2bab8b,0xc9))['catch'](handleError(_0x2bab8b,null));};exports[_0x01ec('0x23')]=function(_0x19d67b,_0x36ae97){if(_0x19d67b['body']['id']){delete _0x19d67b['body']['id'];}return db[_0x01ec('0x28')][_0x01ec('0x42')]({'where':{'id':_0x19d67b[_0x01ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x36ae97,null))[_0x01ec('0x25')](saveUpdates(_0x19d67b[_0x01ec('0x46')],null))[_0x01ec('0x25')](respondWithResult(_0x36ae97,null))[_0x01ec('0x43')](handleError(_0x36ae97,null));};exports[_0x01ec('0x24')]=function(_0x174cb2,_0x34b88f){return db[_0x01ec('0x28')][_0x01ec('0x42')]({'where':{'id':_0x174cb2['params']['id']}})[_0x01ec('0x25')](handleEntityNotFound(_0x34b88f,null))[_0x01ec('0x25')](removeEntity(_0x34b88f,null))[_0x01ec('0x43')](handleError(_0x34b88f,null));};exports[_0x01ec('0x47')]=function(_0x2ebeaa,_0x41400b,_0x33ad3f){var _0x2a02dd={};var _0xea122c={};var _0x59ee64;var _0x4ae4cd;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x2ebeaa[_0x01ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x41400b,null))['then'](function(_0x19277b){if(_0x19277b){_0x59ee64=_0x19277b;_0xea122c[_0x01ec('0x2d')]=_[_0x01ec('0x40')](db[_0x01ec('0x48')][_0x01ec('0x29')]);_0xea122c[_0x01ec('0x2e')]=_[_0x01ec('0x40')](_0x2ebeaa[_0x01ec('0x2e')]);_0xea122c[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0xea122c[_0x01ec('0x2d')],_0xea122c[_0x01ec('0x2e')]);_0x2a02dd[_0x01ec('0x30')]=_[_0x01ec('0x41')](_0xea122c[_0x01ec('0x2d')],qs[_0x01ec('0x31')](_0x2ebeaa['query'][_0x01ec('0x31')]));_0x2a02dd[_0x01ec('0x30')]=_0x2a02dd[_0x01ec('0x30')][_0x01ec('0x32')]?_0x2a02dd[_0x01ec('0x30')]:_0xea122c[_0x01ec('0x2d')];_0x2a02dd['order']=qs['sort'](_0x2ebeaa['query']['sort']);_0x2a02dd[_0x01ec('0x37')]=qs[_0x01ec('0x2f')](_[_0x01ec('0x38')](_0x2ebeaa[_0x01ec('0x2e')],_0xea122c['filters']));if(_0x2ebeaa[_0x01ec('0x2e')]['filter']){_0x2a02dd[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x2a02dd[_0x01ec('0x37')],{'$or':_['map'](_0x2a02dd[_0x01ec('0x30')],function(_0x43689d){var _0x41f36a={};_0x41f36a[_0x43689d]={'$like':'%'+_0x2ebeaa['query'][_0x01ec('0x39')]+'%'};return _0x41f36a;})});}_0x2a02dd=_[_0x01ec('0x3a')]({},_0x2a02dd,_0x2ebeaa[_0x01ec('0x49')]);return _0x59ee64[_0x01ec('0x47')](_0x2a02dd);}})[_0x01ec('0x25')](function(_0xec50b2){if(_0xec50b2){_0x4ae4cd=_0xec50b2[_0x01ec('0x32')];if(!_0x2ebeaa[_0x01ec('0x2e')]['hasOwnProperty'](_0x01ec('0x34'))){_0x2a02dd[_0x01ec('0x1c')]=qs[_0x01ec('0x1c')](_0x2ebeaa['query'][_0x01ec('0x1c')]);_0x2a02dd[_0x01ec('0x1a')]=qs['offset'](_0x2ebeaa[_0x01ec('0x2e')][_0x01ec('0x1a')]);}return _0x59ee64[_0x01ec('0x47')](_0x2a02dd);}})[_0x01ec('0x25')](function(_0xa77bb5){if(_0xa77bb5){return _0xa77bb5?{'count':_0x4ae4cd,'rows':_0xa77bb5}:null;}})[_0x01ec('0x25')](respondWithResult(_0x41400b,null))[_0x01ec('0x43')](handleError(_0x41400b,null));};exports[_0x01ec('0x4a')]=function(_0x1bc51f,_0x3af7a6,_0x1d7250){var _0x1159fb={};var _0x40361d={};var _0x59b19b;var _0x2f690c;return db[_0x01ec('0x28')][_0x01ec('0x4b')]({'where':{'id':_0x1bc51f['params']['id']}})[_0x01ec('0x25')](handleEntityNotFound(_0x3af7a6,null))[_0x01ec('0x25')](function(_0x5ec0ff){if(_0x5ec0ff){_0x59b19b=_0x5ec0ff;_0x40361d[_0x01ec('0x2d')]=_['keys'](db[_0x01ec('0x48')][_0x01ec('0x29')]);_0x40361d[_0x01ec('0x2e')]=_[_0x01ec('0x40')](_0x1bc51f['query']);_0x40361d[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0x40361d[_0x01ec('0x2d')],_0x40361d['query']);_0x1159fb[_0x01ec('0x30')]=_[_0x01ec('0x41')](_0x40361d[_0x01ec('0x2d')],qs[_0x01ec('0x31')](_0x1bc51f['query'][_0x01ec('0x31')]));_0x1159fb[_0x01ec('0x30')]=_0x1159fb['attributes']['length']?_0x1159fb[_0x01ec('0x30')]:_0x40361d[_0x01ec('0x2d')];_0x1159fb[_0x01ec('0x35')]=qs[_0x01ec('0x36')](_0x1bc51f['query'][_0x01ec('0x36')]);_0x1159fb['where']=qs[_0x01ec('0x2f')](_[_0x01ec('0x38')](_0x1bc51f[_0x01ec('0x2e')],_0x40361d[_0x01ec('0x2f')]));if(_0x1bc51f['query']['filter']){_0x1159fb[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x1159fb['where'],{'$or':_[_0x01ec('0x27')](_0x1159fb[_0x01ec('0x30')],function(_0x3360e3){var _0x3fe5f2={};_0x3fe5f2[_0x3360e3]={'$like':'%'+_0x1bc51f['query']['filter']+'%'};return _0x3fe5f2;})});}_0x1159fb=_[_0x01ec('0x3a')]({},_0x1159fb,_0x1bc51f[_0x01ec('0x49')]);return _0x59b19b['getSubjects'](_0x1159fb);}})['then'](function(_0x5ce114){if(_0x5ce114){_0x2f690c=_0x5ce114[_0x01ec('0x32')];if(!_0x1bc51f[_0x01ec('0x2e')][_0x01ec('0x33')](_0x01ec('0x34'))){_0x1159fb[_0x01ec('0x1c')]=qs[_0x01ec('0x1c')](_0x1bc51f['query'][_0x01ec('0x1c')]);_0x1159fb[_0x01ec('0x1a')]=qs[_0x01ec('0x1a')](_0x1bc51f[_0x01ec('0x2e')][_0x01ec('0x1a')]);}return _0x59b19b[_0x01ec('0x4a')](_0x1159fb);}})['then'](function(_0x254f36){if(_0x254f36){return _0x254f36?{'count':_0x2f690c,'rows':_0x254f36}:null;}})[_0x01ec('0x25')](respondWithResult(_0x3af7a6,null))[_0x01ec('0x43')](handleError(_0x3af7a6,null));};exports[_0x01ec('0x4c')]=function(_0x1d30d0,_0x544585,_0x109aa1){var _0x2dc22e={};var _0x4dca0e={};var _0x53cfe5;var _0x1b5202;return db[_0x01ec('0x28')]['findOne']({'where':{'id':_0x1d30d0[_0x01ec('0x45')]['id']}})['then'](handleEntityNotFound(_0x544585,null))[_0x01ec('0x25')](function(_0x14a4fe){if(_0x14a4fe){_0x53cfe5=_0x14a4fe;_0x4dca0e[_0x01ec('0x2d')]=_[_0x01ec('0x40')](db[_0x01ec('0x48')][_0x01ec('0x29')]);_0x4dca0e[_0x01ec('0x2e')]=_['keys'](_0x1d30d0['query']);_0x4dca0e[_0x01ec('0x2f')]=_[_0x01ec('0x41')](_0x4dca0e[_0x01ec('0x2d')],_0x4dca0e['query']);_0x2dc22e[_0x01ec('0x30')]=_['intersection'](_0x4dca0e[_0x01ec('0x2d')],qs['fields'](_0x1d30d0['query'][_0x01ec('0x31')]));_0x2dc22e['attributes']=_0x2dc22e[_0x01ec('0x30')][_0x01ec('0x32')]?_0x2dc22e['attributes']:_0x4dca0e[_0x01ec('0x2d')];_0x2dc22e['order']=qs[_0x01ec('0x36')](_0x1d30d0['query'][_0x01ec('0x36')]);_0x2dc22e['where']=qs[_0x01ec('0x2f')](_['pick'](_0x1d30d0['query'],_0x4dca0e[_0x01ec('0x2f')]));if(_0x1d30d0['query'][_0x01ec('0x39')]){_0x2dc22e[_0x01ec('0x37')]=_[_0x01ec('0x3a')](_0x2dc22e['where'],{'$or':_[_0x01ec('0x27')](_0x2dc22e[_0x01ec('0x30')],function(_0x45ce82){var _0x59c91e={};_0x59c91e[_0x45ce82]={'$like':'%'+_0x1d30d0[_0x01ec('0x2e')][_0x01ec('0x39')]+'%'};return _0x59c91e;})});}_0x2dc22e=_['merge']({},_0x2dc22e,_0x1d30d0[_0x01ec('0x49')]);return _0x53cfe5[_0x01ec('0x4c')](_0x2dc22e);}})[_0x01ec('0x25')](function(_0xeaf9ab){if(_0xeaf9ab){_0x1b5202=_0xeaf9ab[_0x01ec('0x32')];if(!_0x1d30d0[_0x01ec('0x2e')][_0x01ec('0x33')](_0x01ec('0x34'))){_0x2dc22e[_0x01ec('0x1c')]=qs['limit'](_0x1d30d0[_0x01ec('0x2e')][_0x01ec('0x1c')]);_0x2dc22e[_0x01ec('0x1a')]=qs[_0x01ec('0x1a')](_0x1d30d0['query'][_0x01ec('0x1a')]);}return _0x53cfe5[_0x01ec('0x4c')](_0x2dc22e);}})[_0x01ec('0x25')](function(_0x47a359){if(_0x47a359){return _0x47a359?{'count':_0x1b5202,'rows':_0x47a359}:null;}})[_0x01ec('0x25')](respondWithResult(_0x544585,null))['catch'](handleError(_0x544585,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9fb91cd..a53d222 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 _0xab12=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x23c5b5,_0x37895d){var _0x1df501=function(_0x580814){while(--_0x580814){_0x23c5b5['push'](_0x23c5b5['shift']());}};_0x1df501(++_0x37895d);}(_0xab12,0x84));var _0x2ab1=function(_0x41f48b,_0x2d57ca){_0x41f48b=_0x41f48b-0x0;var _0x1b8941=_0xab12[_0x41f48b];return _0x1b8941;};'use strict';var _=require(_0x2ab1('0x0'));var util=require(_0x2ab1('0x1'));var logger=require(_0x2ab1('0x2'))(_0x2ab1('0x3'));var moment=require('moment');var BPromise=require(_0x2ab1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ab1('0x5'));var rimraf=require('rimraf');var config=require(_0x2ab1('0x6'));var attributes=require(_0x2ab1('0x7'));module['exports']=function(_0x2557d2,_0x5487a4){return _0x2557d2['define'](_0x2ab1('0x8'),attributes,{'tableName':_0x2ab1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8978=['moment','bluebird','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8978,0x180));var _0x8897=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8978[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8897('0x0'));var util=require(_0x8897('0x1'));var logger=require(_0x8897('0x2'))('api');var moment=require(_0x8897('0x3'));var BPromise=require(_0x8897('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8897('0x5'));var rimraf=require(_0x8897('0x6'));var config=require(_0x8897('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8897('0x8')]=function(_0xacd23c,_0x560e6b){return _0xacd23c['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 4b58a30..d1c7779 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 _0x2693=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3d43cb,_0x3d7050){var _0x3f7599=function(_0xd85ade){while(--_0xd85ade){_0x3d43cb['push'](_0x3d43cb['shift']());}};_0x3f7599(++_0x3d7050);}(_0x2693,0x1c9));var _0x3269=function(_0x39afd3,_0x4a7ed8){_0x39afd3=_0x39afd3-0x0;var _0x2a614a=_0x2693[_0x39afd3];return _0x2a614a;};'use strict';var _=require(_0x3269('0x0'));var util=require(_0x3269('0x1'));var moment=require(_0x3269('0x2'));var BPromise=require(_0x3269('0x3'));var rs=require(_0x3269('0x4'));var fs=require('fs');var Redis=require(_0x3269('0x5'));var db=require(_0x3269('0x6'))['db'];var utils=require(_0x3269('0x7'));var logger=require(_0x3269('0x8'))(_0x3269('0x9'));var config=require(_0x3269('0xa'));var jayson=require(_0x3269('0xb'));var client=jayson[_0x3269('0xc')][_0x3269('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x49115d,_0x458814,_0x262407){return new BPromise(function(_0x59aa3e,_0x35edff){return client['request'](_0x49115d,_0x262407)[_0x3269('0xe')](function(_0x48ee41){logger[_0x3269('0xf')](_0x3269('0x10'),_0x458814,_0x3269('0x11'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x458814,_0x3269('0x11'),JSON[_0x3269('0x12')](_0x48ee41));if(_0x48ee41[_0x3269('0x13')]){if(_0x48ee41['error'][_0x3269('0x14')]===0x1f4){logger['error'](_0x3269('0x10'),_0x458814,_0x48ee41[_0x3269('0x13')][_0x3269('0x15')]);return _0x35edff(_0x48ee41['error']['message']);}logger[_0x3269('0x13')](_0x3269('0x10'),_0x458814,_0x48ee41['error'][_0x3269('0x15')]);return _0x59aa3e(_0x48ee41[_0x3269('0x13')][_0x3269('0x15')]);}else{logger[_0x3269('0xf')](_0x3269('0x10'),_0x458814,_0x3269('0x11'));_0x59aa3e(_0x48ee41[_0x3269('0x16')]['message']);}})[_0x3269('0x17')](function(_0x5d78fb){logger[_0x3269('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x458814,_0x5d78fb);_0x35edff(_0x5d78fb);});});} \ No newline at end of file +var _0xc330=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5cd6ba,_0x5c2f92){var _0x2fd575=function(_0x207402){while(--_0x207402){_0x5cd6ba['push'](_0x5cd6ba['shift']());}};_0x2fd575(++_0x5c2f92);}(_0xc330,0x1d9));var _0x0c33=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc330[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0c33('0x0'));var util=require('util');var moment=require(_0x0c33('0x1'));var BPromise=require(_0x0c33('0x2'));var rs=require(_0x0c33('0x3'));var fs=require('fs');var Redis=require(_0x0c33('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c33('0x5'));var logger=require(_0x0c33('0x6'))(_0x0c33('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c33('0x8'));var client=jayson[_0x0c33('0x9')][_0x0c33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2732a2,_0x573d52,_0x2c8060){return new BPromise(function(_0x725631,_0x3c1f73){return client[_0x0c33('0xb')](_0x2732a2,_0x2c8060)[_0x0c33('0xc')](function(_0x4f0525){logger[_0x0c33('0xd')](_0x0c33('0xe'),_0x573d52,_0x0c33('0xf'));logger[_0x0c33('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x573d52,_0x0c33('0xf'),JSON['stringify'](_0x4f0525));if(_0x4f0525[_0x0c33('0x11')]){if(_0x4f0525[_0x0c33('0x11')]['code']===0x1f4){logger[_0x0c33('0x11')](_0x0c33('0xe'),_0x573d52,_0x4f0525[_0x0c33('0x11')]['message']);return _0x3c1f73(_0x4f0525[_0x0c33('0x11')][_0x0c33('0x12')]);}logger['error'](_0x0c33('0xe'),_0x573d52,_0x4f0525['error'][_0x0c33('0x12')]);return _0x725631(_0x4f0525[_0x0c33('0x11')]['message']);}else{logger['info'](_0x0c33('0xe'),_0x573d52,_0x0c33('0xf'));_0x725631(_0x4f0525[_0x0c33('0x13')][_0x0c33('0x12')]);}})[_0x0c33('0x14')](function(_0x56e8fb){logger[_0x0c33('0x11')](_0x0c33('0xe'),_0x573d52,_0x56e8fb);_0x3c1f73(_0x56e8fb);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 326c226..720b731 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 _0x3434=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated','show','post'];(function(_0x75726c,_0x1032fb){var _0x5083d6=function(_0x1a61a9){while(--_0x1a61a9){_0x75726c['push'](_0x75726c['shift']());}};_0x5083d6(++_0x1032fb);}(_0x3434,0xd5));var _0x4343=function(_0x4c966e,_0x1fa276){_0x4c966e=_0x4c966e-0x0;var _0x49bfad=_0x3434[_0x4c966e];return _0x49bfad;};'use strict';var multer=require(_0x4343('0x0'));var util=require(_0x4343('0x1'));var path=require('path');var timeout=require(_0x4343('0x2'));var express=require(_0x4343('0x3'));var router=express[_0x4343('0x4')]();var fs_extra=require(_0x4343('0x5'));var auth=require(_0x4343('0x6'));var interaction=require(_0x4343('0x7'));var config=require(_0x4343('0x8'));var controller=require(_0x4343('0x9'));router[_0x4343('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4343('0xa')](_0x4343('0xb'),auth[_0x4343('0xc')](),controller[_0x4343('0xd')]);router[_0x4343('0xe')]('/',auth[_0x4343('0xc')](),controller['create']);router[_0x4343('0xf')](_0x4343('0xb'),auth[_0x4343('0xc')](),controller[_0x4343('0x10')]);router[_0x4343('0x11')]('/:id',auth[_0x4343('0xc')](),controller['destroy']);module[_0x4343('0x12')]=router; \ No newline at end of file +var _0xbb34=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x4e2cdd,_0x2a6e7e){var _0x248ec7=function(_0x152847){while(--_0x152847){_0x4e2cdd['push'](_0x4e2cdd['shift']());}};_0x248ec7(++_0x2a6e7e);}(_0xbb34,0x99));var _0x4bb3=function(_0xbed58e,_0x3a1272){_0xbed58e=_0xbed58e-0x0;var _0x295e44=_0xbb34[_0xbed58e];return _0x295e44;};'use strict';var multer=require('multer');var util=require(_0x4bb3('0x0'));var path=require(_0x4bb3('0x1'));var timeout=require(_0x4bb3('0x2'));var express=require(_0x4bb3('0x3'));var router=express[_0x4bb3('0x4')]();var fs_extra=require(_0x4bb3('0x5'));var auth=require(_0x4bb3('0x6'));var interaction=require(_0x4bb3('0x7'));var config=require(_0x4bb3('0x8'));var controller=require(_0x4bb3('0x9'));router[_0x4bb3('0xa')]('/',auth[_0x4bb3('0xb')](),controller[_0x4bb3('0xc')]);router[_0x4bb3('0xa')](_0x4bb3('0xd'),auth[_0x4bb3('0xb')](),controller['show']);router[_0x4bb3('0xe')]('/',auth[_0x4bb3('0xb')](),controller[_0x4bb3('0xf')]);router[_0x4bb3('0x10')](_0x4bb3('0xd'),auth[_0x4bb3('0xb')](),controller[_0x4bb3('0x11')]);router[_0x4bb3('0x12')]('/:id',auth[_0x4bb3('0xb')](),controller[_0x4bb3('0x13')]);module[_0x4bb3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2ca38fe..56a5a8b 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 _0x98e2=['ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x98e2,0x8f));var _0x298e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x98e2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x298e('0x0'));module['exports']={'type':{'type':Sequelize[_0x298e('0x1')](_0x298e('0x2'),'variable','customVariable',_0x298e('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x298e('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x298e('0x2'),_0x298e('0x5'),_0x298e('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x298e('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x298e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x48e4=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48e4,0x19a));var _0x448e=function(_0x1356ee,_0x2cb831){_0x1356ee=_0x1356ee-0x0;var _0x551796=_0x48e4[_0x1356ee];return _0x551796;};'use strict';var Sequelize=require(_0x448e('0x0'));module[_0x448e('0x1')]={'type':{'type':Sequelize[_0x448e('0x2')](_0x448e('0x3'),_0x448e('0x4'),_0x448e('0x5'),_0x448e('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x448e('0x7')]},'keyType':{'type':Sequelize[_0x448e('0x2')]('string',_0x448e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x448e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x448e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index fa48d58..3e8456c 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 _0x00b4=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SugarcrmField','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x221731,_0x148761){var _0x4935a2=function(_0x47cc8c){while(--_0x47cc8c){_0x221731['push'](_0x221731['shift']());}};_0x4935a2(++_0x148761);}(_0x00b4,0x19a));var _0x400b=function(_0x1613ae,_0x29ba48){_0x1613ae=_0x1613ae-0x0;var _0x30ffd2=_0x00b4[_0x1613ae];return _0x30ffd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x400b('0x0'));var zipdir=require(_0x400b('0x1'));var jsonpatch=require(_0x400b('0x2'));var rp=require(_0x400b('0x3'));var moment=require(_0x400b('0x4'));var BPromise=require(_0x400b('0x5'));var Mustache=require(_0x400b('0x6'));var util=require(_0x400b('0x7'));var path=require(_0x400b('0x8'));var sox=require(_0x400b('0x9'));var csv=require(_0x400b('0xa'));var ejs=require(_0x400b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x400b('0xc'));var squel=require(_0x400b('0xd'));var crypto=require(_0x400b('0xe'));var jsforce=require(_0x400b('0xf'));var deskjs=require(_0x400b('0x10'));var toCsv=require(_0x400b('0xa'));var querystring=require('querystring');var Papa=require(_0x400b('0x11'));var Redis=require(_0x400b('0x12'));var authService=require(_0x400b('0x13'));var qs=require(_0x400b('0x14'));var as=require(_0x400b('0x15'));var hardwareService=require(_0x400b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x400b('0x17'));var config=require(_0x400b('0x18'));var licenseUtil=require(_0x400b('0x19'));var db=require(_0x400b('0x1a'))['db'];function respondWithStatusCode(_0x37703e,_0x4e5980){_0x4e5980=_0x4e5980||0xcc;return function(_0x200018){if(_0x200018){return _0x37703e[_0x400b('0x1b')](_0x4e5980);}return _0x37703e[_0x400b('0x1c')](_0x4e5980)['end']();};}function respondWithResult(_0x216056,_0x31f38f){_0x31f38f=_0x31f38f||0xc8;return function(_0x5a300f){if(_0x5a300f){return _0x216056[_0x400b('0x1c')](_0x31f38f)[_0x400b('0x1d')](_0x5a300f);}};}function respondWithFilteredResult(_0x170017,_0x4fa410){return function(_0x3219ff){if(_0x3219ff){var _0x29c504=typeof _0x4fa410[_0x400b('0x1e')]==='undefined'&&typeof _0x4fa410[_0x400b('0x1f')]===_0x400b('0x20');var _0x4c01d3=_0x3219ff[_0x400b('0x21')];var _0x478a52=_0x29c504?0x0:_0x4fa410[_0x400b('0x1e')];var _0xbbdaaf=_0x29c504?_0x3219ff[_0x400b('0x21')]:_0x4fa410[_0x400b('0x1e')]+_0x4fa410[_0x400b('0x1f')];var _0x84609d;if(_0xbbdaaf>=_0x4c01d3){_0xbbdaaf=_0x4c01d3;_0x84609d=0xc8;}else{_0x84609d=0xce;}_0x170017[_0x400b('0x1c')](_0x84609d);return _0x170017['set'](_0x400b('0x22'),_0x478a52+'-'+_0xbbdaaf+'/'+_0x4c01d3)['json'](_0x3219ff);}return null;};}function patchUpdates(_0x37c25e){return function(_0x1a6fe5){try{jsonpatch[_0x400b('0x23')](_0x1a6fe5,_0x37c25e,!![]);}catch(_0x35543c){return BPromise['reject'](_0x35543c);}return _0x1a6fe5[_0x400b('0x24')]();};}function saveUpdates(_0x4878ec,_0xa558b7){return function(_0x5841d3){if(_0x5841d3){return _0x5841d3[_0x400b('0x25')](_0x4878ec)[_0x400b('0x26')](function(_0x4bc5f6){return _0x4bc5f6;});}return null;};}function removeEntity(_0x51d6ba,_0x88c280){return function(_0x3c366a){if(_0x3c366a){return _0x3c366a[_0x400b('0x27')]()[_0x400b('0x26')](function(){_0x51d6ba[_0x400b('0x1c')](0xcc)[_0x400b('0x28')]();});}};}function handleEntityNotFound(_0x1aba61,_0x3d18d5){return function(_0x828252){if(!_0x828252){_0x1aba61[_0x400b('0x1b')](0x194);}return _0x828252;};}function handleError(_0x5868ad,_0x1790db){_0x1790db=_0x1790db||0x1f4;return function(_0x5c9f7a){logger['error'](_0x5c9f7a[_0x400b('0x29')]);if(_0x5c9f7a[_0x400b('0x2a')]){delete _0x5c9f7a[_0x400b('0x2a')];}_0x5868ad[_0x400b('0x1c')](_0x1790db)[_0x400b('0x2b')](_0x5c9f7a);};}exports[_0x400b('0x2c')]=function(_0x4789dd,_0x35444e){var _0x30e802={},_0x3719e0={},_0x22fe90={'count':0x0,'rows':[]};var _0x593f64=_[_0x400b('0x2d')](db[_0x400b('0x2e')]['rawAttributes'],function(_0x430606){return{'name':_0x430606['fieldName'],'type':_0x430606[_0x400b('0x2f')][_0x400b('0x30')]};});_0x3719e0[_0x400b('0x31')]=_[_0x400b('0x2d')](_0x593f64,'name');_0x3719e0['query']=_[_0x400b('0x32')](_0x4789dd[_0x400b('0x33')]);_0x3719e0[_0x400b('0x34')]=_[_0x400b('0x35')](_0x3719e0[_0x400b('0x31')],_0x3719e0[_0x400b('0x33')]);_0x30e802[_0x400b('0x36')]=_[_0x400b('0x35')](_0x3719e0[_0x400b('0x31')],qs['fields'](_0x4789dd[_0x400b('0x33')][_0x400b('0x37')]));_0x30e802[_0x400b('0x36')]=_0x30e802[_0x400b('0x36')][_0x400b('0x38')]?_0x30e802['attributes']:_0x3719e0[_0x400b('0x31')];if(!_0x4789dd['query'][_0x400b('0x39')](_0x400b('0x3a'))){_0x30e802['limit']=qs[_0x400b('0x1f')](_0x4789dd['query']['limit']);_0x30e802['offset']=qs[_0x400b('0x1e')](_0x4789dd[_0x400b('0x33')]['offset']);}_0x30e802[_0x400b('0x3b')]=qs[_0x400b('0x3c')](_0x4789dd[_0x400b('0x33')]['sort']);_0x30e802[_0x400b('0x3d')]=qs[_0x400b('0x34')](_[_0x400b('0x3e')](_0x4789dd['query'],_0x3719e0['filters']),_0x593f64);if(_0x4789dd[_0x400b('0x33')][_0x400b('0x3f')]){_0x30e802[_0x400b('0x3d')]=_[_0x400b('0x40')](_0x30e802['where'],{'$or':_[_0x400b('0x2d')](_0x593f64,function(_0x11a496){if(_0x11a496[_0x400b('0x2f')]!==_0x400b('0x41')){var _0x28cf75={};_0x28cf75[_0x11a496[_0x400b('0x2a')]]={'$like':'%'+_0x4789dd[_0x400b('0x33')]['filter']+'%'};return _0x28cf75;}})});}_0x30e802=_['merge']({},_0x30e802,_0x4789dd[_0x400b('0x42')]);var _0x2e9914={'where':_0x30e802[_0x400b('0x3d')]};return db[_0x400b('0x2e')][_0x400b('0x21')](_0x2e9914)[_0x400b('0x26')](function(_0x34175e){_0x22fe90[_0x400b('0x21')]=_0x34175e;if(_0x4789dd[_0x400b('0x33')][_0x400b('0x43')]){_0x30e802['include']=[{'all':!![]}];}return db[_0x400b('0x2e')][_0x400b('0x44')](_0x30e802);})[_0x400b('0x26')](function(_0x1733a5){_0x22fe90[_0x400b('0x45')]=_0x1733a5;return _0x22fe90;})['then'](respondWithFilteredResult(_0x35444e,_0x30e802))[_0x400b('0x46')](handleError(_0x35444e,null));};exports[_0x400b('0x47')]=function(_0x4de5ca,_0xece314){var _0x12a0bf={'raw':!![],'where':{'id':_0x4de5ca['params']['id']}},_0xca697c={};_0xca697c[_0x400b('0x31')]=_[_0x400b('0x32')](db[_0x400b('0x2e')][_0x400b('0x48')]);_0xca697c[_0x400b('0x33')]=_[_0x400b('0x32')](_0x4de5ca[_0x400b('0x33')]);_0xca697c['filters']=_[_0x400b('0x35')](_0xca697c[_0x400b('0x31')],_0xca697c[_0x400b('0x33')]);_0x12a0bf['attributes']=_[_0x400b('0x35')](_0xca697c[_0x400b('0x31')],qs[_0x400b('0x37')](_0x4de5ca[_0x400b('0x33')][_0x400b('0x37')]));_0x12a0bf[_0x400b('0x36')]=_0x12a0bf[_0x400b('0x36')][_0x400b('0x38')]?_0x12a0bf[_0x400b('0x36')]:_0xca697c[_0x400b('0x31')];if(_0x4de5ca[_0x400b('0x33')][_0x400b('0x43')]){_0x12a0bf[_0x400b('0x49')]=[{'all':!![]}];}_0x12a0bf=_[_0x400b('0x40')]({},_0x12a0bf,_0x4de5ca[_0x400b('0x42')]);return db['SugarcrmField'][_0x400b('0x4a')](_0x12a0bf)[_0x400b('0x26')](handleEntityNotFound(_0xece314,null))[_0x400b('0x26')](respondWithResult(_0xece314,null))[_0x400b('0x46')](handleError(_0xece314,null));};exports[_0x400b('0x4b')]=function(_0x214d6e,_0x58a2b0){return db[_0x400b('0x2e')][_0x400b('0x4b')](_0x214d6e[_0x400b('0x4c')],{})[_0x400b('0x26')](respondWithResult(_0x58a2b0,0xc9))[_0x400b('0x46')](handleError(_0x58a2b0,null));};exports['update']=function(_0x2a305a,_0x325bc9){if(_0x2a305a['body']['id']){delete _0x2a305a[_0x400b('0x4c')]['id'];}return db['SugarcrmField'][_0x400b('0x4a')]({'where':{'id':_0x2a305a[_0x400b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x325bc9,null))[_0x400b('0x26')](saveUpdates(_0x2a305a[_0x400b('0x4c')],null))[_0x400b('0x26')](respondWithResult(_0x325bc9,null))[_0x400b('0x46')](handleError(_0x325bc9,null));};exports[_0x400b('0x27')]=function(_0x1c091e,_0x16de42){return db[_0x400b('0x2e')][_0x400b('0x4a')]({'where':{'id':_0x1c091e[_0x400b('0x4d')]['id']}})[_0x400b('0x26')](handleEntityNotFound(_0x16de42,null))['then'](removeEntity(_0x16de42,null))['catch'](handleError(_0x16de42,null));}; \ No newline at end of file +var _0x78ce=['apply','reject','save','then','error','stack','send','index','SugarcrmField','rawAttributes','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','include','findAll','params','keys','includeAll','find','catch','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x78ce,0x17f));var _0xe78c=function(_0x90e575,_0x48c2ec){_0x90e575=_0x90e575-0x0;var _0x1aae60=_0x78ce[_0x90e575];return _0x1aae60;};'use strict';var emlformat=require(_0xe78c('0x0'));var rimraf=require(_0xe78c('0x1'));var zipdir=require(_0xe78c('0x2'));var jsonpatch=require(_0xe78c('0x3'));var rp=require(_0xe78c('0x4'));var moment=require(_0xe78c('0x5'));var BPromise=require(_0xe78c('0x6'));var Mustache=require(_0xe78c('0x7'));var util=require(_0xe78c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe78c('0x9'));var ejs=require(_0xe78c('0xa'));var fs=require('fs');var fs_extra=require(_0xe78c('0xb'));var _=require(_0xe78c('0xc'));var squel=require(_0xe78c('0xd'));var crypto=require('crypto');var jsforce=require(_0xe78c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe78c('0xf'));var Papa=require(_0xe78c('0x10'));var Redis=require(_0xe78c('0x11'));var authService=require(_0xe78c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe78c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe78c('0x14'));var config=require(_0xe78c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f987,_0x4b931c){_0x4b931c=_0x4b931c||0xcc;return function(_0x48e1be){if(_0x48e1be){return _0x37f987[_0xe78c('0x16')](_0x4b931c);}return _0x37f987[_0xe78c('0x17')](_0x4b931c)[_0xe78c('0x18')]();};}function respondWithResult(_0x4f1ff7,_0x1baac9){_0x1baac9=_0x1baac9||0xc8;return function(_0x29a7ab){if(_0x29a7ab){return _0x4f1ff7[_0xe78c('0x17')](_0x1baac9)[_0xe78c('0x19')](_0x29a7ab);}};}function respondWithFilteredResult(_0x590371,_0x4090fb){return function(_0x3747cd){if(_0x3747cd){var _0x4adda0=typeof _0x4090fb[_0xe78c('0x1a')]===_0xe78c('0x1b')&&typeof _0x4090fb[_0xe78c('0x1c')]===_0xe78c('0x1b');var _0x1c765a=_0x3747cd[_0xe78c('0x1d')];var _0x3f07a0=_0x4adda0?0x0:_0x4090fb[_0xe78c('0x1a')];var _0x44868a=_0x4adda0?_0x3747cd['count']:_0x4090fb['offset']+_0x4090fb['limit'];var _0x25d88e;if(_0x44868a>=_0x1c765a){_0x44868a=_0x1c765a;_0x25d88e=0xc8;}else{_0x25d88e=0xce;}_0x590371[_0xe78c('0x17')](_0x25d88e);return _0x590371['set'](_0xe78c('0x1e'),_0x3f07a0+'-'+_0x44868a+'/'+_0x1c765a)[_0xe78c('0x19')](_0x3747cd);}return null;};}function patchUpdates(_0x3818c4){return function(_0x409c22){try{jsonpatch[_0xe78c('0x1f')](_0x409c22,_0x3818c4,!![]);}catch(_0x562887){return BPromise[_0xe78c('0x20')](_0x562887);}return _0x409c22[_0xe78c('0x21')]();};}function saveUpdates(_0x4844d8,_0x3062ed){return function(_0x11def3){if(_0x11def3){return _0x11def3['update'](_0x4844d8)[_0xe78c('0x22')](function(_0x3359d6){return _0x3359d6;});}return null;};}function removeEntity(_0xac4b51,_0x4e2957){return function(_0x497aa1){if(_0x497aa1){return _0x497aa1['destroy']()[_0xe78c('0x22')](function(){_0xac4b51['status'](0xcc)[_0xe78c('0x18')]();});}};}function handleEntityNotFound(_0x39431e,_0x3f916b){return function(_0x252cd9){if(!_0x252cd9){_0x39431e[_0xe78c('0x16')](0x194);}return _0x252cd9;};}function handleError(_0x49fa47,_0x3e8c2e){_0x3e8c2e=_0x3e8c2e||0x1f4;return function(_0x171237){logger[_0xe78c('0x23')](_0x171237[_0xe78c('0x24')]);if(_0x171237['name']){delete _0x171237['name'];}_0x49fa47[_0xe78c('0x17')](_0x3e8c2e)[_0xe78c('0x25')](_0x171237);};}exports[_0xe78c('0x26')]=function(_0x12ce52,_0xd971ba){var _0x4edf1b={},_0x33acd2={},_0x2e2e74={'count':0x0,'rows':[]};var _0x18122b=_['map'](db[_0xe78c('0x27')][_0xe78c('0x28')],function(_0xdcc1a0){return{'name':_0xdcc1a0['fieldName'],'type':_0xdcc1a0[_0xe78c('0x29')][_0xe78c('0x2a')]};});_0x33acd2[_0xe78c('0x2b')]=_[_0xe78c('0x2c')](_0x18122b,_0xe78c('0x2d'));_0x33acd2[_0xe78c('0x2e')]=_['keys'](_0x12ce52[_0xe78c('0x2e')]);_0x33acd2[_0xe78c('0x2f')]=_['intersection'](_0x33acd2[_0xe78c('0x2b')],_0x33acd2[_0xe78c('0x2e')]);_0x4edf1b[_0xe78c('0x30')]=_[_0xe78c('0x31')](_0x33acd2[_0xe78c('0x2b')],qs[_0xe78c('0x32')](_0x12ce52[_0xe78c('0x2e')][_0xe78c('0x32')]));_0x4edf1b['attributes']=_0x4edf1b['attributes'][_0xe78c('0x33')]?_0x4edf1b['attributes']:_0x33acd2[_0xe78c('0x2b')];if(!_0x12ce52[_0xe78c('0x2e')][_0xe78c('0x34')](_0xe78c('0x35'))){_0x4edf1b['limit']=qs['limit'](_0x12ce52['query'][_0xe78c('0x1c')]);_0x4edf1b['offset']=qs[_0xe78c('0x1a')](_0x12ce52['query'][_0xe78c('0x1a')]);}_0x4edf1b[_0xe78c('0x36')]=qs['sort'](_0x12ce52[_0xe78c('0x2e')]['sort']);_0x4edf1b['where']=qs[_0xe78c('0x2f')](_[_0xe78c('0x37')](_0x12ce52[_0xe78c('0x2e')],_0x33acd2[_0xe78c('0x2f')]),_0x18122b);if(_0x12ce52['query'][_0xe78c('0x38')]){_0x4edf1b['where']=_['merge'](_0x4edf1b[_0xe78c('0x39')],{'$or':_[_0xe78c('0x2c')](_0x18122b,function(_0x109fb7){if(_0x109fb7[_0xe78c('0x29')]!==_0xe78c('0x3a')){var _0xa79628={};_0xa79628[_0x109fb7['name']]={'$like':'%'+_0x12ce52['query'][_0xe78c('0x38')]+'%'};return _0xa79628;}})});}_0x4edf1b=_[_0xe78c('0x3b')]({},_0x4edf1b,_0x12ce52['options']);var _0x37e1b7={'where':_0x4edf1b[_0xe78c('0x39')]};return db[_0xe78c('0x27')][_0xe78c('0x1d')](_0x37e1b7)['then'](function(_0x26f610){_0x2e2e74['count']=_0x26f610;if(_0x12ce52['query']['includeAll']){_0x4edf1b[_0xe78c('0x3c')]=[{'all':!![]}];}return db[_0xe78c('0x27')][_0xe78c('0x3d')](_0x4edf1b);})[_0xe78c('0x22')](function(_0x1f513c){_0x2e2e74['rows']=_0x1f513c;return _0x2e2e74;})[_0xe78c('0x22')](respondWithFilteredResult(_0xd971ba,_0x4edf1b))['catch'](handleError(_0xd971ba,null));};exports['show']=function(_0x55ab39,_0x54b213){var _0x3ef298={'raw':!![],'where':{'id':_0x55ab39[_0xe78c('0x3e')]['id']}},_0x212378={};_0x212378[_0xe78c('0x2b')]=_[_0xe78c('0x3f')](db[_0xe78c('0x27')][_0xe78c('0x28')]);_0x212378[_0xe78c('0x2e')]=_[_0xe78c('0x3f')](_0x55ab39[_0xe78c('0x2e')]);_0x212378[_0xe78c('0x2f')]=_[_0xe78c('0x31')](_0x212378[_0xe78c('0x2b')],_0x212378[_0xe78c('0x2e')]);_0x3ef298[_0xe78c('0x30')]=_[_0xe78c('0x31')](_0x212378[_0xe78c('0x2b')],qs['fields'](_0x55ab39['query'][_0xe78c('0x32')]));_0x3ef298[_0xe78c('0x30')]=_0x3ef298[_0xe78c('0x30')][_0xe78c('0x33')]?_0x3ef298['attributes']:_0x212378['model'];if(_0x55ab39[_0xe78c('0x2e')][_0xe78c('0x40')]){_0x3ef298[_0xe78c('0x3c')]=[{'all':!![]}];}_0x3ef298=_[_0xe78c('0x3b')]({},_0x3ef298,_0x55ab39['options']);return db['SugarcrmField'][_0xe78c('0x41')](_0x3ef298)[_0xe78c('0x22')](handleEntityNotFound(_0x54b213,null))[_0xe78c('0x22')](respondWithResult(_0x54b213,null))[_0xe78c('0x42')](handleError(_0x54b213,null));};exports['create']=function(_0xc863bc,_0x331c10){return db['SugarcrmField']['create'](_0xc863bc[_0xe78c('0x43')],{})[_0xe78c('0x22')](respondWithResult(_0x331c10,0xc9))[_0xe78c('0x42')](handleError(_0x331c10,null));};exports[_0xe78c('0x44')]=function(_0x3943e9,_0x157601){if(_0x3943e9[_0xe78c('0x43')]['id']){delete _0x3943e9['body']['id'];}return db[_0xe78c('0x27')]['find']({'where':{'id':_0x3943e9[_0xe78c('0x3e')]['id']}})[_0xe78c('0x22')](handleEntityNotFound(_0x157601,null))[_0xe78c('0x22')](saveUpdates(_0x3943e9['body'],null))[_0xe78c('0x22')](respondWithResult(_0x157601,null))[_0xe78c('0x42')](handleError(_0x157601,null));};exports['destroy']=function(_0x2e6c80,_0x352571){return db[_0xe78c('0x27')][_0xe78c('0x41')]({'where':{'id':_0x2e6c80[_0xe78c('0x3e')]['id']}})[_0xe78c('0x22')](handleEntityNotFound(_0x352571,null))[_0xe78c('0x22')](removeEntity(_0x352571,null))['catch'](handleError(_0x352571,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e6c08b0..a67679b 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 _0x5b31=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x77cb50,_0x5af067){var _0x1124fb=function(_0x46bbf5){while(--_0x46bbf5){_0x77cb50['push'](_0x77cb50['shift']());}};_0x1124fb(++_0x5af067);}(_0x5b31,0xb0));var _0x15b3=function(_0x5050d7,_0x5812bf){_0x5050d7=_0x5050d7-0x0;var _0x1626f5=_0x5b31[_0x5050d7];return _0x1626f5;};'use strict';var _=require(_0x15b3('0x0'));var util=require(_0x15b3('0x1'));var logger=require('../../config/logger')(_0x15b3('0x2'));var moment=require(_0x15b3('0x3'));var BPromise=require(_0x15b3('0x4'));var rp=require(_0x15b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15b3('0x6'));var config=require(_0x15b3('0x7'));var attributes=require(_0x15b3('0x8'));module[_0x15b3('0x9')]=function(_0x58bca0,_0x516fe7){return _0x58bca0['define']('SugarcrmField',attributes,{'tableName':_0x15b3('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x15b3('0xb'),_0x15b3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dab=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x9dab,0x1eb));var _0xb9da=function(_0x581c2b,_0xa6d0cb){_0x581c2b=_0x581c2b-0x0;var _0x403750=_0x9dab[_0x581c2b];return _0x403750;};'use strict';var _=require(_0xb9da('0x0'));var util=require(_0xb9da('0x1'));var logger=require(_0xb9da('0x2'))(_0xb9da('0x3'));var moment=require(_0xb9da('0x4'));var BPromise=require(_0xb9da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9da('0x6'));var rimraf=require(_0xb9da('0x7'));var config=require(_0xb9da('0x8'));var attributes=require(_0xb9da('0x9'));module[_0xb9da('0xa')]=function(_0x4695d3,_0x5ac475){return _0x4695d3[_0xb9da('0xb')](_0xb9da('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xb9da('0xd'),'fields':['idField',_0xb9da('0xe')],'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 b5d4fce..6e8d3b3 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 _0x3147=['rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x29570a,_0x124a5b){var _0x7be1a2=function(_0x44faaf){while(--_0x44faaf){_0x29570a['push'](_0x29570a['shift']());}};_0x7be1a2(++_0x124a5b);}(_0x3147,0x1f3));var _0x7314=function(_0x4932db,_0x3e7ba7){_0x4932db=_0x4932db-0x0;var _0x5abce8=_0x3147[_0x4932db];return _0x5abce8;};'use strict';var _=require(_0x7314('0x0'));var util=require('util');var moment=require(_0x7314('0x1'));var BPromise=require(_0x7314('0x2'));var rs=require(_0x7314('0x3'));var fs=require('fs');var Redis=require(_0x7314('0x4'));var db=require(_0x7314('0x5'))['db'];var utils=require(_0x7314('0x6'));var logger=require('../../config/logger')(_0x7314('0x7'));var config=require(_0x7314('0x8'));var jayson=require(_0x7314('0x9'));var client=jayson[_0x7314('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d37fd,_0x277118,_0x2ef3e1){return new BPromise(function(_0x8a096a,_0x5108c0){return client[_0x7314('0xb')](_0x3d37fd,_0x2ef3e1)[_0x7314('0xc')](function(_0xd0c107){logger[_0x7314('0xd')](_0x7314('0xe'),_0x277118,_0x7314('0xf'));logger[_0x7314('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x277118,'request\x20sent',JSON[_0x7314('0x11')](_0xd0c107));if(_0xd0c107[_0x7314('0x12')]){if(_0xd0c107[_0x7314('0x12')]['code']===0x1f4){logger[_0x7314('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x277118,_0xd0c107['error']['message']);return _0x5108c0(_0xd0c107[_0x7314('0x12')][_0x7314('0x13')]);}logger[_0x7314('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x277118,_0xd0c107['error'][_0x7314('0x13')]);return _0x8a096a(_0xd0c107[_0x7314('0x12')][_0x7314('0x13')]);}else{logger[_0x7314('0xd')](_0x7314('0xe'),_0x277118,_0x7314('0xf'));_0x8a096a(_0xd0c107[_0x7314('0x14')]['message']);}})[_0x7314('0x15')](function(_0x10b192){logger['error'](_0x7314('0xe'),_0x277118,_0x10b192);_0x5108c0(_0x10b192);});});} \ No newline at end of file +var _0xee1d=['debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x43029e,_0x2a0207){var _0xd8bab0=function(_0x3fd8eb){while(--_0x3fd8eb){_0x43029e['push'](_0x43029e['shift']());}};_0xd8bab0(++_0x2a0207);}(_0xee1d,0x134));var _0xdee1=function(_0x5b6a0f,_0x1f03ca){_0x5b6a0f=_0x5b6a0f-0x0;var _0xa38065=_0xee1d[_0x5b6a0f];return _0xa38065;};'use strict';var _=require('lodash');var util=require(_0xdee1('0x0'));var moment=require(_0xdee1('0x1'));var BPromise=require(_0xdee1('0x2'));var rs=require(_0xdee1('0x3'));var fs=require('fs');var Redis=require(_0xdee1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdee1('0x5'));var logger=require(_0xdee1('0x6'))(_0xdee1('0x7'));var config=require(_0xdee1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdee1('0x9')][_0xdee1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3544c8,_0x460563,_0x3b02ee){return new BPromise(function(_0x180303,_0x34a2c4){return client[_0xdee1('0xb')](_0x3544c8,_0x3b02ee)[_0xdee1('0xc')](function(_0x40725b){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x460563,_0xdee1('0xd'));logger[_0xdee1('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x460563,_0xdee1('0xd'),JSON[_0xdee1('0xf')](_0x40725b));if(_0x40725b[_0xdee1('0x10')]){if(_0x40725b[_0xdee1('0x10')][_0xdee1('0x11')]===0x1f4){logger[_0xdee1('0x10')](_0xdee1('0x12'),_0x460563,_0x40725b[_0xdee1('0x10')][_0xdee1('0x13')]);return _0x34a2c4(_0x40725b['error'][_0xdee1('0x13')]);}logger[_0xdee1('0x10')](_0xdee1('0x12'),_0x460563,_0x40725b['error'][_0xdee1('0x13')]);return _0x180303(_0x40725b['error']['message']);}else{logger[_0xdee1('0x14')](_0xdee1('0x12'),_0x460563,_0xdee1('0xd'));_0x180303(_0x40725b[_0xdee1('0x15')][_0xdee1('0x13')]);}})[_0xdee1('0x16')](function(_0x5bb872){logger[_0xdee1('0x10')](_0xdee1('0x12'),_0x460563,_0x5bb872);_0x34a2c4(_0x5bb872);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 742fc19..f3c4539 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 _0xb708=['show','get','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','/:id'];(function(_0x4cddf9,_0x2bc65e){var _0x5d4c5c=function(_0x4509c0){while(--_0x4509c0){_0x4cddf9['push'](_0x4cddf9['shift']());}};_0x5d4c5c(++_0x2bc65e);}(_0xb708,0xe7));var _0x8b70=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0xb708[_0x5c1345];return _0x1c070d;};'use strict';var multer=require(_0x8b70('0x0'));var util=require('util');var path=require(_0x8b70('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b70('0x2'));var router=express[_0x8b70('0x3')]();var fs_extra=require(_0x8b70('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8b70('0x5'));var config=require(_0x8b70('0x6'));var controller=require(_0x8b70('0x7'));router['get']('/',auth[_0x8b70('0x8')](),controller[_0x8b70('0x9')]);router['get'](_0x8b70('0xa'),auth[_0x8b70('0x8')](),controller[_0x8b70('0xb')]);router[_0x8b70('0xc')]('/:id/configurations',auth[_0x8b70('0x8')](),controller[_0x8b70('0xd')]);router['get'](_0x8b70('0xe'),auth[_0x8b70('0x8')](),controller['getFields']);router[_0x8b70('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b70('0x10')]);router[_0x8b70('0xf')](_0x8b70('0x11'),auth['isAuthenticated'](),controller[_0x8b70('0x12')]);router[_0x8b70('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8b70('0x14')]);router['delete'](_0x8b70('0xa'),auth[_0x8b70('0x8')](),controller['destroy']);module[_0x8b70('0x15')]=router; \ No newline at end of file +var _0x2bbb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x26d9bc,_0x596175){var _0x1305df=function(_0x53529d){while(--_0x53529d){_0x26d9bc['push'](_0x26d9bc['shift']());}};_0x1305df(++_0x596175);}(_0x2bbb,0x85));var _0xb2bb=function(_0x594a88,_0x61bc31){_0x594a88=_0x594a88-0x0;var _0xe2a24d=_0x2bbb[_0x594a88];return _0xe2a24d;};'use strict';var multer=require('multer');var util=require(_0xb2bb('0x0'));var path=require(_0xb2bb('0x1'));var timeout=require(_0xb2bb('0x2'));var express=require('express');var router=express[_0xb2bb('0x3')]();var fs_extra=require(_0xb2bb('0x4'));var auth=require(_0xb2bb('0x5'));var interaction=require(_0xb2bb('0x6'));var config=require(_0xb2bb('0x7'));var controller=require(_0xb2bb('0x8'));router['get']('/',auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xa')]);router['get'](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xc')]);router[_0xb2bb('0xd')]('/:id/configurations',auth[_0xb2bb('0x9')](),controller['getConfigurations']);router[_0xb2bb('0xd')](_0xb2bb('0xe'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0xf')]);router[_0xb2bb('0x10')]('/',auth['isAuthenticated'](),controller[_0xb2bb('0x11')]);router['post'](_0xb2bb('0x12'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x13')]);router[_0xb2bb('0x14')](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller['update']);router[_0xb2bb('0x15')](_0xb2bb('0xb'),auth[_0xb2bb('0x9')](),controller[_0xb2bb('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 695f941..e77a1ae 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 _0x65a8=['HelpDesk','sequelize','exports','STRING'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0x65a8,0x151));var _0x865a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x65a8[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x865a('0x0'));module[_0x865a('0x1')]={'name':{'type':Sequelize[_0x865a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x865a('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x865a('0x2')],'allowNull':![],'defaultValue':_0x865a('0x3')},'remoteUri':{'type':Sequelize[_0x865a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x865a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x865a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9eb7=['exports','STRING','HelpDesk'];(function(_0xf2dc4b,_0x1079ce){var _0x313f8c=function(_0x5110a2){while(--_0x5110a2){_0xf2dc4b['push'](_0xf2dc4b['shift']());}};_0x313f8c(++_0x1079ce);}(_0x9eb7,0x1c5));var _0x79eb=function(_0xcbca77,_0x2cd7ce){_0xcbca77=_0xcbca77-0x0;var _0x409f23=_0x9eb7[_0xcbca77];return _0x409f23;};'use strict';var Sequelize=require('sequelize');module[_0x79eb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x79eb('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x79eb('0x2')},'remoteUri':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f2ef651..33c9611 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 _0x3901=['nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','order','where','pick','VIRTUAL','filter','merge','VtigerAccount','findAll','rows','catch','show','params','fields','length','includeAll','include','find','create','body','getConfigurations','sort','options'];(function(_0x185cb0,_0x341d05){var _0x313f11=function(_0x3c5a60){while(--_0x3c5a60){_0x185cb0['push'](_0x185cb0['shift']());}};_0x313f11(++_0x341d05);}(_0x3901,0x12a));var _0x1390=function(_0x3e705b,_0x461287){_0x3e705b=_0x3e705b-0x0;var _0x111d59=_0x3901[_0x3e705b];return _0x111d59;};'use strict';var emlformat=require(_0x1390('0x0'));var rimraf=require(_0x1390('0x1'));var zipdir=require(_0x1390('0x2'));var jsonpatch=require(_0x1390('0x3'));var rp=require(_0x1390('0x4'));var moment=require(_0x1390('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1390('0x6'));var path=require(_0x1390('0x7'));var sox=require(_0x1390('0x8'));var csv=require(_0x1390('0x9'));var ejs=require(_0x1390('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1390('0xb'));var squel=require(_0x1390('0xc'));var crypto=require(_0x1390('0xd'));var jsforce=require(_0x1390('0xe'));var deskjs=require(_0x1390('0xf'));var toCsv=require(_0x1390('0x9'));var querystring=require('querystring');var Papa=require(_0x1390('0x10'));var Redis=require(_0x1390('0x11'));var authService=require(_0x1390('0x12'));var qs=require(_0x1390('0x13'));var as=require(_0x1390('0x14'));var hardwareService=require(_0x1390('0x15'));var logger=require(_0x1390('0x16'))(_0x1390('0x17'));var utils=require(_0x1390('0x18'));var config=require(_0x1390('0x19'));var licenseUtil=require(_0x1390('0x1a'));var db=require(_0x1390('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e1877,_0x436fe0){_0x436fe0=_0x436fe0||0xcc;return function(_0x2127ef){if(_0x2127ef){return _0x4e1877[_0x1390('0x1c')](_0x436fe0);}return _0x4e1877[_0x1390('0x1d')](_0x436fe0)[_0x1390('0x1e')]();};}function respondWithResult(_0x29ce2a,_0x497c41){_0x497c41=_0x497c41||0xc8;return function(_0x416fba){if(_0x416fba){return _0x29ce2a[_0x1390('0x1d')](_0x497c41)[_0x1390('0x1f')](_0x416fba);}};}function respondWithFilteredResult(_0x4c81e6,_0x32c98f){return function(_0x342447){if(_0x342447){var _0x19a663=typeof _0x32c98f[_0x1390('0x20')]===_0x1390('0x21')&&typeof _0x32c98f['limit']==='undefined';var _0x4f82ed=_0x342447[_0x1390('0x22')];var _0x2faaca=_0x19a663?0x0:_0x32c98f['offset'];var _0x33455d=_0x19a663?_0x342447[_0x1390('0x22')]:_0x32c98f[_0x1390('0x20')]+_0x32c98f[_0x1390('0x23')];var _0x3d51f0;if(_0x33455d>=_0x4f82ed){_0x33455d=_0x4f82ed;_0x3d51f0=0xc8;}else{_0x3d51f0=0xce;}_0x4c81e6['status'](_0x3d51f0);return _0x4c81e6[_0x1390('0x24')]('Content-Range',_0x2faaca+'-'+_0x33455d+'/'+_0x4f82ed)['json'](_0x342447);}return null;};}function patchUpdates(_0xdabe33){return function(_0x316708){try{jsonpatch['apply'](_0x316708,_0xdabe33,!![]);}catch(_0x585737){return BPromise[_0x1390('0x25')](_0x585737);}return _0x316708[_0x1390('0x26')]();};}function saveUpdates(_0x38702d,_0x563fd3){return function(_0x481d78){if(_0x481d78){return _0x481d78[_0x1390('0x27')](_0x38702d)[_0x1390('0x28')](function(_0x5646fb){return _0x5646fb;});}return null;};}function removeEntity(_0x58457a,_0x1bd0c7){return function(_0x1f7f8a){if(_0x1f7f8a){return _0x1f7f8a[_0x1390('0x29')]()['then'](function(){_0x58457a[_0x1390('0x1d')](0xcc)[_0x1390('0x1e')]();});}};}function handleEntityNotFound(_0x451f0b,_0x555691){return function(_0x3e2a9b){if(!_0x3e2a9b){_0x451f0b['sendStatus'](0x194);}return _0x3e2a9b;};}function handleError(_0x26e5a5,_0x4bebd5){_0x4bebd5=_0x4bebd5||0x1f4;return function(_0x58c0c7){logger[_0x1390('0x2a')](_0x58c0c7[_0x1390('0x2b')]);if(_0x58c0c7['name']){delete _0x58c0c7[_0x1390('0x2c')];}_0x26e5a5['status'](_0x4bebd5)['send'](_0x58c0c7);};}exports[_0x1390('0x2d')]=function(_0x4d03b0,_0x2d3e61){var _0x55ee29={},_0x253a4d={},_0x22e5fc={'count':0x0,'rows':[]};var _0x2aa491=_[_0x1390('0x2e')](db['VtigerAccount'][_0x1390('0x2f')],function(_0x470de0){return{'name':_0x470de0[_0x1390('0x30')],'type':_0x470de0[_0x1390('0x31')][_0x1390('0x32')]};});_0x253a4d[_0x1390('0x33')]=_['map'](_0x2aa491,'name');_0x253a4d[_0x1390('0x34')]=_[_0x1390('0x35')](_0x4d03b0[_0x1390('0x34')]);_0x253a4d[_0x1390('0x36')]=_['intersection'](_0x253a4d[_0x1390('0x33')],_0x253a4d['query']);_0x55ee29[_0x1390('0x37')]=_[_0x1390('0x38')](_0x253a4d['model'],qs['fields'](_0x4d03b0[_0x1390('0x34')]['fields']));_0x55ee29[_0x1390('0x37')]=_0x55ee29[_0x1390('0x37')]['length']?_0x55ee29[_0x1390('0x37')]:_0x253a4d[_0x1390('0x33')];if(!_0x4d03b0['query'][_0x1390('0x39')]('nolimit')){_0x55ee29[_0x1390('0x23')]=qs['limit'](_0x4d03b0[_0x1390('0x34')][_0x1390('0x23')]);_0x55ee29['offset']=qs['offset'](_0x4d03b0[_0x1390('0x34')][_0x1390('0x20')]);}_0x55ee29[_0x1390('0x3a')]=qs['sort'](_0x4d03b0[_0x1390('0x34')]['sort']);_0x55ee29[_0x1390('0x3b')]=qs['filters'](_[_0x1390('0x3c')](_0x4d03b0[_0x1390('0x34')],_0x253a4d[_0x1390('0x36')]),_0x2aa491);if(_0x4d03b0[_0x1390('0x34')]['filter']){_0x55ee29[_0x1390('0x3b')]=_['merge'](_0x55ee29[_0x1390('0x3b')],{'$or':_[_0x1390('0x2e')](_0x2aa491,function(_0x5a95ef){if(_0x5a95ef[_0x1390('0x31')]!==_0x1390('0x3d')){var _0x4adaf5={};_0x4adaf5[_0x5a95ef[_0x1390('0x2c')]]={'$like':'%'+_0x4d03b0[_0x1390('0x34')][_0x1390('0x3e')]+'%'};return _0x4adaf5;}})});}_0x55ee29=_[_0x1390('0x3f')]({},_0x55ee29,_0x4d03b0['options']);var _0x197dea={'where':_0x55ee29['where']};return db[_0x1390('0x40')][_0x1390('0x22')](_0x197dea)[_0x1390('0x28')](function(_0x427480){_0x22e5fc[_0x1390('0x22')]=_0x427480;if(_0x4d03b0['query']['includeAll']){_0x55ee29['include']=[{'all':!![]}];}return db[_0x1390('0x40')][_0x1390('0x41')](_0x55ee29);})[_0x1390('0x28')](function(_0x5d8f68){_0x22e5fc[_0x1390('0x42')]=_0x5d8f68;return _0x22e5fc;})['then'](respondWithFilteredResult(_0x2d3e61,_0x55ee29))[_0x1390('0x43')](handleError(_0x2d3e61,null));};exports[_0x1390('0x44')]=function(_0x402ff1,_0x2ea5d7){var _0x3f41a7={'raw':![],'where':{'id':_0x402ff1[_0x1390('0x45')]['id']}},_0x340862={};_0x340862[_0x1390('0x33')]=_[_0x1390('0x35')](db[_0x1390('0x40')][_0x1390('0x2f')]);_0x340862[_0x1390('0x34')]=_['keys'](_0x402ff1['query']);_0x340862[_0x1390('0x36')]=_[_0x1390('0x38')](_0x340862[_0x1390('0x33')],_0x340862[_0x1390('0x34')]);_0x3f41a7[_0x1390('0x37')]=_[_0x1390('0x38')](_0x340862[_0x1390('0x33')],qs[_0x1390('0x46')](_0x402ff1['query']['fields']));_0x3f41a7[_0x1390('0x37')]=_0x3f41a7['attributes'][_0x1390('0x47')]?_0x3f41a7[_0x1390('0x37')]:_0x340862[_0x1390('0x33')];if(_0x402ff1[_0x1390('0x34')][_0x1390('0x48')]){_0x3f41a7[_0x1390('0x49')]=[{'all':!![]}];}_0x3f41a7=_[_0x1390('0x3f')]({},_0x3f41a7,_0x402ff1['options']);return db[_0x1390('0x40')][_0x1390('0x4a')](_0x3f41a7)[_0x1390('0x28')](handleEntityNotFound(_0x2ea5d7,null))[_0x1390('0x28')](respondWithResult(_0x2ea5d7,null))['catch'](handleError(_0x2ea5d7,null));};exports[_0x1390('0x4b')]=function(_0x2b1d42,_0x9184dc){return db['VtigerAccount'][_0x1390('0x4b')](_0x2b1d42['body'],{})['then'](respondWithResult(_0x9184dc,0xc9))[_0x1390('0x43')](handleError(_0x9184dc,null));};exports['update']=function(_0x3cacfc,_0x276e7b){if(_0x3cacfc[_0x1390('0x4c')]['id']){delete _0x3cacfc[_0x1390('0x4c')]['id'];}return db['VtigerAccount'][_0x1390('0x4a')]({'where':{'id':_0x3cacfc[_0x1390('0x45')]['id']}})[_0x1390('0x28')](handleEntityNotFound(_0x276e7b,null))['then'](saveUpdates(_0x3cacfc[_0x1390('0x4c')],null))[_0x1390('0x28')](respondWithResult(_0x276e7b,null))[_0x1390('0x43')](handleError(_0x276e7b,null));};exports[_0x1390('0x29')]=function(_0x1915a9,_0x473dcc){return db[_0x1390('0x40')][_0x1390('0x4a')]({'where':{'id':_0x1915a9[_0x1390('0x45')]['id']}})[_0x1390('0x28')](handleEntityNotFound(_0x473dcc,null))[_0x1390('0x28')](removeEntity(_0x473dcc,null))[_0x1390('0x43')](handleError(_0x473dcc,null));};exports[_0x1390('0x4d')]=function(_0xaecfd3,_0x3cd3a3,_0x956704){var _0x23f4f5={};var _0x14e959={};var _0x19f20f;var _0x3d78e7;return db[_0x1390('0x40')]['findOne']({'where':{'id':_0xaecfd3[_0x1390('0x45')]['id']}})[_0x1390('0x28')](handleEntityNotFound(_0x3cd3a3,null))[_0x1390('0x28')](function(_0x430117){if(_0x430117){_0x19f20f=_0x430117;_0x14e959[_0x1390('0x33')]=_[_0x1390('0x35')](db['VtigerConfiguration'][_0x1390('0x2f')]);_0x14e959[_0x1390('0x34')]=_[_0x1390('0x35')](_0xaecfd3[_0x1390('0x34')]);_0x14e959[_0x1390('0x36')]=_[_0x1390('0x38')](_0x14e959[_0x1390('0x33')],_0x14e959['query']);_0x23f4f5[_0x1390('0x37')]=_['intersection'](_0x14e959[_0x1390('0x33')],qs['fields'](_0xaecfd3[_0x1390('0x34')][_0x1390('0x46')]));_0x23f4f5[_0x1390('0x37')]=_0x23f4f5[_0x1390('0x37')][_0x1390('0x47')]?_0x23f4f5[_0x1390('0x37')]:_0x14e959['model'];_0x23f4f5['order']=qs[_0x1390('0x4e')](_0xaecfd3[_0x1390('0x34')][_0x1390('0x4e')]);_0x23f4f5[_0x1390('0x3b')]=qs[_0x1390('0x36')](_[_0x1390('0x3c')](_0xaecfd3[_0x1390('0x34')],_0x14e959['filters']));if(_0xaecfd3[_0x1390('0x34')][_0x1390('0x3e')]){_0x23f4f5[_0x1390('0x3b')]=_[_0x1390('0x3f')](_0x23f4f5[_0x1390('0x3b')],{'$or':_[_0x1390('0x2e')](_0x23f4f5[_0x1390('0x37')],function(_0x1e1b0f){var _0x4f8572={};_0x4f8572[_0x1e1b0f]={'$like':'%'+_0xaecfd3['query']['filter']+'%'};return _0x4f8572;})});}_0x23f4f5=_[_0x1390('0x3f')]({},_0x23f4f5,_0xaecfd3[_0x1390('0x4f')]);return _0x19f20f['getConfigurations'](_0x23f4f5);}})['then'](function(_0x54a2bc){if(_0x54a2bc){_0x3d78e7=_0x54a2bc[_0x1390('0x47')];if(!_0xaecfd3[_0x1390('0x34')][_0x1390('0x39')](_0x1390('0x50'))){_0x23f4f5['limit']=qs[_0x1390('0x23')](_0xaecfd3['query'][_0x1390('0x23')]);_0x23f4f5[_0x1390('0x20')]=qs[_0x1390('0x20')](_0xaecfd3['query'][_0x1390('0x20')]);}return _0x19f20f[_0x1390('0x4d')](_0x23f4f5);}})[_0x1390('0x28')](function(_0x1e3086){if(_0x1e3086){return _0x1e3086?{'count':_0x3d78e7,'rows':_0x1e3086}:null;}})[_0x1390('0x28')](respondWithResult(_0x3cd3a3,null))[_0x1390('0x43')](handleError(_0x3cd3a3,null));};exports[_0x1390('0x51')]=function(_0x2eb0d2,_0x52b4e5,_0x8dbcde){if(_0x2eb0d2[_0x1390('0x4c')]['id']){delete _0x2eb0d2[_0x1390('0x4c')]['id'];}return db[_0x1390('0x40')][_0x1390('0x52')]({'where':{'id':_0x2eb0d2[_0x1390('0x45')]['id']}})[_0x1390('0x28')](handleEntityNotFound(_0x52b4e5,null))[_0x1390('0x28')](function(_0x40f575){if(_0x40f575){_0x2eb0d2[_0x1390('0x4c')][_0x1390('0x53')]=_0x40f575['id'];_0x2eb0d2[_0x1390('0x4c')][_0x1390('0x54')]=integrations[_0x1390('0x55')](_0x2eb0d2['body'][_0x1390('0x56')],_0x2eb0d2[_0x1390('0x4c')][_0x1390('0x31')]);_0x2eb0d2['body']['Descriptions']=integrations[_0x1390('0x57')](_0x2eb0d2[_0x1390('0x4c')][_0x1390('0x56')],_0x2eb0d2[_0x1390('0x4c')][_0x1390('0x31')]);return db[_0x1390('0x58')]['create'](_0x2eb0d2[_0x1390('0x4c')],{'include':[{'model':db['VtigerField'],'as':_0x1390('0x54')},{'model':db[_0x1390('0x59')],'as':_0x1390('0x5a')}]});}return null;})[_0x1390('0x28')](respondWithResult(_0x52b4e5,null))[_0x1390('0x43')](handleError(_0x52b4e5,null));};var md5=require(_0x1390('0x5b'));exports[_0x1390('0x5c')]=function(_0x32168c,_0x428083,_0x3ea6b7){var _0x2ad60b=null;var _0x3df232=null;var _0x40219d=null;var _0x521ff7=null;var _0x5cfedf='';return db[_0x1390('0x40')][_0x1390('0x52')]({'where':{'id':_0x32168c[_0x1390('0x45')]['id']},'attributes':['id',_0x1390('0x2c'),_0x1390('0x5d'),_0x1390('0x5e'),_0x1390('0x5f'),_0x1390('0x60'),_0x1390('0x61'),_0x1390('0x62')]})['then'](handleEntityNotFound(_0x428083,null))[_0x1390('0x28')](function(_0x756837){if(_0x756837){_0x2ad60b=_0x756837['username'];_0x3df232=_0x756837[_0x1390('0x62')];_0x40219d=_0x756837[_0x1390('0x5f')];_0x5cfedf=_0x756837[_0x1390('0x60')];var _0xfbef8c=_0x5cfedf[_0x1390('0x63')](-0x1);if(_0xfbef8c==='/'){_0x5cfedf=_0x5cfedf['substring'](0x0,_0x5cfedf['lastIndexOf'](_0xfbef8c));}_0x521ff7=util[_0x1390('0x64')](_0x1390('0x65'),_0x5cfedf);var _0x4aab6e={'method':_0x1390('0x66'),'uri':_0x521ff7,'qs':{'operation':'getchallenge','username':_0x756837[_0x1390('0x5d')]},'json':!![]};return rp(_0x4aab6e);}})[_0x1390('0x28')](function(_0x92673d){if(_0x92673d[_0x1390('0x67')]){var _0x5ed5df={'method':_0x1390('0x68'),'uri':_0x521ff7,'form':{'operation':_0x1390('0x69'),'username':_0x2ad60b,'accessKey':md5(_0x92673d[_0x1390('0x6a')][_0x1390('0x6b')]+_0x3df232)},'json':!![]};return rp(_0x5ed5df);}})[_0x1390('0x28')](function(_0x33cc31){if(_0x33cc31[_0x1390('0x67')]){var _0x4ec5cf={'method':_0x1390('0x66'),'uri':_0x521ff7,'qs':{'operation':_0x1390('0x6c'),'username':_0x2ad60b,'sessionName':_0x33cc31[_0x1390('0x6a')][_0x1390('0x6d')],'elementType':_0x40219d},'json':!![]};return rp(_0x4ec5cf);}})[_0x1390('0x28')](function(_0x1e8fc5){if(_0x1e8fc5[_0x1390('0x67')]){var _0x809ce7=[_0x1390('0x6e'),_0x1390('0x6f'),_0x1390('0x70')];_[_0x1390('0x71')](_0x1e8fc5[_0x1390('0x6a')][_0x1390('0x46')],function(_0x3971e9){return _0x809ce7[_0x1390('0x72')](_0x3971e9[_0x1390('0x31')][_0x1390('0x2c')]);});_['remove'](_0x1e8fc5['result'][_0x1390('0x46')],function(_0x945ab5){return _0x945ab5[_0x1390('0x73')]===_0x1390('0x74');});return{'count':_0x1e8fc5[_0x1390('0x6a')][_0x1390('0x46')]['length'],'rows':_['map'](_0x1e8fc5[_0x1390('0x6a')][_0x1390('0x46')],function(_0x36c5ab){return{'id':_0x36c5ab[_0x1390('0x2c')],'name':_0x36c5ab[_0x1390('0x75')],'custom':_[_0x1390('0x76')](_0x36c5ab[_0x1390('0x2c')],_0x1390('0x77'))?!![]:![],'options':_0x36c5ab[_0x1390('0x31')][_0x1390('0x2c')]===_0x1390('0x78')&&_0x36c5ab[_0x1390('0x31')][_0x1390('0x79')][_0x1390('0x47')]>0x0?_['map'](_0x36c5ab[_0x1390('0x31')][_0x1390('0x79')],function(_0x415d16){return{'name':_0x415d16['label'],'value':_0x415d16['value']};}):[]};})};}})['then'](respondWithResult(_0x428083,null))[_0x1390('0x43')](function(_0x588c98){console['log']('vTiger\x20error:\x20'+_0x588c98);var _0x3985f8=_0x32168c[_0x1390('0x34')][_0x1390('0x7a')]?0x1f4:_0x588c98['statusCode']||0x1f4;logger['error'](_0x1390('0x7b'),_0x1390('0x5c'),_0x3985f8,JSON[_0x1390('0x7c')](_0x588c98));delete _0x588c98[_0x1390('0x2c')];if(_0x3985f8===0x191){_0x3985f8=0x190;}_0x428083[_0x1390('0x1d')](_0x3985f8)['send'](_0x32168c[_0x1390('0x34')][_0x1390('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x588c98[_0x1390('0x7d')]}:_0x588c98);});}; \ No newline at end of file +var _0xd5f2=['rows','catch','params','keys','rawAttributes','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','findOne','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x3f6a82,_0x1f0bf8){var _0x225f97=function(_0x486a16){while(--_0x486a16){_0x3f6a82['push'](_0x3f6a82['shift']());}};_0x225f97(++_0x1f0bf8);}(_0xd5f2,0x1b0));var _0x2d5f=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd5f2[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0x2d5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d5f('0x1'));var jsonpatch=require(_0x2d5f('0x2'));var rp=require(_0x2d5f('0x3'));var moment=require('moment');var BPromise=require(_0x2d5f('0x4'));var Mustache=require(_0x2d5f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2d5f('0x6'));var csv=require(_0x2d5f('0x7'));var ejs=require(_0x2d5f('0x8'));var fs=require('fs');var fs_extra=require(_0x2d5f('0x9'));var _=require('lodash');var squel=require(_0x2d5f('0xa'));var crypto=require(_0x2d5f('0xb'));var jsforce=require(_0x2d5f('0xc'));var deskjs=require(_0x2d5f('0xd'));var toCsv=require(_0x2d5f('0x7'));var querystring=require(_0x2d5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d5f('0xf'));var authService=require(_0x2d5f('0x10'));var qs=require(_0x2d5f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d5f('0x12'));var logger=require(_0x2d5f('0x13'))(_0x2d5f('0x14'));var utils=require('../../config/utils');var config=require(_0x2d5f('0x15'));var licenseUtil=require(_0x2d5f('0x16'));var db=require(_0x2d5f('0x17'))['db'];var integrations=require(_0x2d5f('0x18'));function respondWithStatusCode(_0x6a1701,_0x5d2dbd){_0x5d2dbd=_0x5d2dbd||0xcc;return function(_0x389f40){if(_0x389f40){return _0x6a1701[_0x2d5f('0x19')](_0x5d2dbd);}return _0x6a1701['status'](_0x5d2dbd)[_0x2d5f('0x1a')]();};}function respondWithResult(_0x277312,_0x5f582e){_0x5f582e=_0x5f582e||0xc8;return function(_0x524514){if(_0x524514){return _0x277312[_0x2d5f('0x1b')](_0x5f582e)[_0x2d5f('0x1c')](_0x524514);}};}function respondWithFilteredResult(_0x2dac9b,_0x2fbd94){return function(_0x44eab3){if(_0x44eab3){var _0xc38d8f=typeof _0x2fbd94[_0x2d5f('0x1d')]===_0x2d5f('0x1e')&&typeof _0x2fbd94[_0x2d5f('0x1f')]===_0x2d5f('0x1e');var _0x145e47=_0x44eab3[_0x2d5f('0x20')];var _0x38d2e0=_0xc38d8f?0x0:_0x2fbd94[_0x2d5f('0x1d')];var _0x143b5c=_0xc38d8f?_0x44eab3['count']:_0x2fbd94[_0x2d5f('0x1d')]+_0x2fbd94['limit'];var _0x466e1a;if(_0x143b5c>=_0x145e47){_0x143b5c=_0x145e47;_0x466e1a=0xc8;}else{_0x466e1a=0xce;}_0x2dac9b[_0x2d5f('0x1b')](_0x466e1a);return _0x2dac9b[_0x2d5f('0x21')](_0x2d5f('0x22'),_0x38d2e0+'-'+_0x143b5c+'/'+_0x145e47)[_0x2d5f('0x1c')](_0x44eab3);}return null;};}function patchUpdates(_0x4912bb){return function(_0x2821c8){try{jsonpatch[_0x2d5f('0x23')](_0x2821c8,_0x4912bb,!![]);}catch(_0x443c03){return BPromise['reject'](_0x443c03);}return _0x2821c8['save']();};}function saveUpdates(_0x275ae4,_0x9bf9a3){return function(_0x2e2cd6){if(_0x2e2cd6){return _0x2e2cd6[_0x2d5f('0x24')](_0x275ae4)[_0x2d5f('0x25')](function(_0x142d21){return _0x142d21;});}return null;};}function removeEntity(_0x1b081d,_0x103664){return function(_0x1f00b2){if(_0x1f00b2){return _0x1f00b2[_0x2d5f('0x26')]()[_0x2d5f('0x25')](function(){_0x1b081d[_0x2d5f('0x1b')](0xcc)[_0x2d5f('0x1a')]();});}};}function handleEntityNotFound(_0xddc9e3,_0x386d94){return function(_0x39f282){if(!_0x39f282){_0xddc9e3['sendStatus'](0x194);}return _0x39f282;};}function handleError(_0x7558e9,_0x4bd158){_0x4bd158=_0x4bd158||0x1f4;return function(_0x3c39a3){logger[_0x2d5f('0x27')](_0x3c39a3[_0x2d5f('0x28')]);if(_0x3c39a3[_0x2d5f('0x29')]){delete _0x3c39a3[_0x2d5f('0x29')];}_0x7558e9[_0x2d5f('0x1b')](_0x4bd158)[_0x2d5f('0x2a')](_0x3c39a3);};}exports[_0x2d5f('0x2b')]=function(_0x4566f6,_0x48781d){var _0x2cc4c0={},_0x1503f8={},_0x5d9471={'count':0x0,'rows':[]};var _0x1d667f=_[_0x2d5f('0x2c')](db[_0x2d5f('0x2d')]['rawAttributes'],function(_0x305331){return{'name':_0x305331[_0x2d5f('0x2e')],'type':_0x305331[_0x2d5f('0x2f')]['key']};});_0x1503f8[_0x2d5f('0x30')]=_[_0x2d5f('0x2c')](_0x1d667f,_0x2d5f('0x29'));_0x1503f8[_0x2d5f('0x31')]=_['keys'](_0x4566f6[_0x2d5f('0x31')]);_0x1503f8[_0x2d5f('0x32')]=_[_0x2d5f('0x33')](_0x1503f8[_0x2d5f('0x30')],_0x1503f8[_0x2d5f('0x31')]);_0x2cc4c0['attributes']=_[_0x2d5f('0x33')](_0x1503f8[_0x2d5f('0x30')],qs[_0x2d5f('0x34')](_0x4566f6[_0x2d5f('0x31')]['fields']));_0x2cc4c0[_0x2d5f('0x35')]=_0x2cc4c0[_0x2d5f('0x35')][_0x2d5f('0x36')]?_0x2cc4c0[_0x2d5f('0x35')]:_0x1503f8[_0x2d5f('0x30')];if(!_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x37')](_0x2d5f('0x38'))){_0x2cc4c0[_0x2d5f('0x1f')]=qs[_0x2d5f('0x1f')](_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x1f')]);_0x2cc4c0[_0x2d5f('0x1d')]=qs[_0x2d5f('0x1d')](_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x1d')]);}_0x2cc4c0[_0x2d5f('0x39')]=qs['sort'](_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x3a')]);_0x2cc4c0[_0x2d5f('0x3b')]=qs[_0x2d5f('0x32')](_[_0x2d5f('0x3c')](_0x4566f6[_0x2d5f('0x31')],_0x1503f8['filters']),_0x1d667f);if(_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x3d')]){_0x2cc4c0['where']=_['merge'](_0x2cc4c0['where'],{'$or':_[_0x2d5f('0x2c')](_0x1d667f,function(_0x32c748){if(_0x32c748['type']!==_0x2d5f('0x3e')){var _0x278111={};_0x278111[_0x32c748['name']]={'$like':'%'+_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x3d')]+'%'};return _0x278111;}})});}_0x2cc4c0=_[_0x2d5f('0x3f')]({},_0x2cc4c0,_0x4566f6[_0x2d5f('0x40')]);var _0x203772={'where':_0x2cc4c0[_0x2d5f('0x3b')]};return db[_0x2d5f('0x2d')][_0x2d5f('0x20')](_0x203772)[_0x2d5f('0x25')](function(_0x1ea157){_0x5d9471[_0x2d5f('0x20')]=_0x1ea157;if(_0x4566f6[_0x2d5f('0x31')][_0x2d5f('0x41')]){_0x2cc4c0[_0x2d5f('0x42')]=[{'all':!![]}];}return db[_0x2d5f('0x2d')][_0x2d5f('0x43')](_0x2cc4c0);})[_0x2d5f('0x25')](function(_0x352a09){_0x5d9471[_0x2d5f('0x44')]=_0x352a09;return _0x5d9471;})['then'](respondWithFilteredResult(_0x48781d,_0x2cc4c0))[_0x2d5f('0x45')](handleError(_0x48781d,null));};exports['show']=function(_0x1a39ef,_0x1952f4){var _0x12756a={'raw':![],'where':{'id':_0x1a39ef[_0x2d5f('0x46')]['id']}},_0x11c0ca={};_0x11c0ca['model']=_[_0x2d5f('0x47')](db['VtigerAccount'][_0x2d5f('0x48')]);_0x11c0ca[_0x2d5f('0x31')]=_[_0x2d5f('0x47')](_0x1a39ef[_0x2d5f('0x31')]);_0x11c0ca['filters']=_['intersection'](_0x11c0ca[_0x2d5f('0x30')],_0x11c0ca['query']);_0x12756a[_0x2d5f('0x35')]=_[_0x2d5f('0x33')](_0x11c0ca[_0x2d5f('0x30')],qs['fields'](_0x1a39ef[_0x2d5f('0x31')][_0x2d5f('0x34')]));_0x12756a['attributes']=_0x12756a[_0x2d5f('0x35')][_0x2d5f('0x36')]?_0x12756a[_0x2d5f('0x35')]:_0x11c0ca[_0x2d5f('0x30')];if(_0x1a39ef[_0x2d5f('0x31')][_0x2d5f('0x41')]){_0x12756a[_0x2d5f('0x42')]=[{'all':!![]}];}_0x12756a=_[_0x2d5f('0x3f')]({},_0x12756a,_0x1a39ef[_0x2d5f('0x40')]);return db['VtigerAccount'][_0x2d5f('0x49')](_0x12756a)[_0x2d5f('0x25')](handleEntityNotFound(_0x1952f4,null))[_0x2d5f('0x25')](respondWithResult(_0x1952f4,null))[_0x2d5f('0x45')](handleError(_0x1952f4,null));};exports[_0x2d5f('0x4a')]=function(_0x4d2989,_0x1fc304){return db[_0x2d5f('0x2d')][_0x2d5f('0x4a')](_0x4d2989[_0x2d5f('0x4b')],{})[_0x2d5f('0x25')](respondWithResult(_0x1fc304,0xc9))['catch'](handleError(_0x1fc304,null));};exports[_0x2d5f('0x24')]=function(_0x3a567f,_0x2abb88){if(_0x3a567f[_0x2d5f('0x4b')]['id']){delete _0x3a567f['body']['id'];}return db['VtigerAccount'][_0x2d5f('0x49')]({'where':{'id':_0x3a567f[_0x2d5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x2abb88,null))[_0x2d5f('0x25')](saveUpdates(_0x3a567f[_0x2d5f('0x4b')],null))[_0x2d5f('0x25')](respondWithResult(_0x2abb88,null))[_0x2d5f('0x45')](handleError(_0x2abb88,null));};exports[_0x2d5f('0x26')]=function(_0x5344d5,_0x5816c){return db['VtigerAccount'][_0x2d5f('0x49')]({'where':{'id':_0x5344d5[_0x2d5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x5816c,null))[_0x2d5f('0x25')](removeEntity(_0x5816c,null))[_0x2d5f('0x45')](handleError(_0x5816c,null));};exports[_0x2d5f('0x4c')]=function(_0x4ca9b5,_0x3d6b5e,_0x5107f4){var _0x1f0d88={};var _0xb3c5b7={};var _0x50c95b;var _0x16bfe2;return db['VtigerAccount']['findOne']({'where':{'id':_0x4ca9b5[_0x2d5f('0x46')]['id']}})[_0x2d5f('0x25')](handleEntityNotFound(_0x3d6b5e,null))[_0x2d5f('0x25')](function(_0x6dcbaf){if(_0x6dcbaf){_0x50c95b=_0x6dcbaf;_0xb3c5b7[_0x2d5f('0x30')]=_[_0x2d5f('0x47')](db[_0x2d5f('0x4d')][_0x2d5f('0x48')]);_0xb3c5b7[_0x2d5f('0x31')]=_['keys'](_0x4ca9b5[_0x2d5f('0x31')]);_0xb3c5b7[_0x2d5f('0x32')]=_['intersection'](_0xb3c5b7[_0x2d5f('0x30')],_0xb3c5b7[_0x2d5f('0x31')]);_0x1f0d88['attributes']=_[_0x2d5f('0x33')](_0xb3c5b7[_0x2d5f('0x30')],qs[_0x2d5f('0x34')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x34')]));_0x1f0d88[_0x2d5f('0x35')]=_0x1f0d88['attributes'][_0x2d5f('0x36')]?_0x1f0d88['attributes']:_0xb3c5b7[_0x2d5f('0x30')];_0x1f0d88[_0x2d5f('0x39')]=qs[_0x2d5f('0x3a')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x3a')]);_0x1f0d88[_0x2d5f('0x3b')]=qs[_0x2d5f('0x32')](_[_0x2d5f('0x3c')](_0x4ca9b5['query'],_0xb3c5b7[_0x2d5f('0x32')]));if(_0x4ca9b5[_0x2d5f('0x31')]['filter']){_0x1f0d88[_0x2d5f('0x3b')]=_[_0x2d5f('0x3f')](_0x1f0d88[_0x2d5f('0x3b')],{'$or':_[_0x2d5f('0x2c')](_0x1f0d88['attributes'],function(_0x4e62a2){var _0x8929c3={};_0x8929c3[_0x4e62a2]={'$like':'%'+_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x3d')]+'%'};return _0x8929c3;})});}_0x1f0d88=_[_0x2d5f('0x3f')]({},_0x1f0d88,_0x4ca9b5[_0x2d5f('0x40')]);return _0x50c95b[_0x2d5f('0x4c')](_0x1f0d88);}})['then'](function(_0x9ef8d2){if(_0x9ef8d2){_0x16bfe2=_0x9ef8d2['length'];if(!_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x37')](_0x2d5f('0x38'))){_0x1f0d88[_0x2d5f('0x1f')]=qs[_0x2d5f('0x1f')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x1f')]);_0x1f0d88[_0x2d5f('0x1d')]=qs[_0x2d5f('0x1d')](_0x4ca9b5[_0x2d5f('0x31')][_0x2d5f('0x1d')]);}return _0x50c95b[_0x2d5f('0x4c')](_0x1f0d88);}})[_0x2d5f('0x25')](function(_0x3b385e){if(_0x3b385e){return _0x3b385e?{'count':_0x16bfe2,'rows':_0x3b385e}:null;}})[_0x2d5f('0x25')](respondWithResult(_0x3d6b5e,null))[_0x2d5f('0x45')](handleError(_0x3d6b5e,null));};exports[_0x2d5f('0x4e')]=function(_0x10674d,_0x8646dc,_0x29e870){if(_0x10674d[_0x2d5f('0x4b')]['id']){delete _0x10674d['body']['id'];}return db[_0x2d5f('0x2d')]['findOne']({'where':{'id':_0x10674d[_0x2d5f('0x46')]['id']}})[_0x2d5f('0x25')](handleEntityNotFound(_0x8646dc,null))[_0x2d5f('0x25')](function(_0x464eec){if(_0x464eec){_0x10674d['body'][_0x2d5f('0x4f')]=_0x464eec['id'];_0x10674d['body']['Subjects']=integrations[_0x2d5f('0x50')](_0x10674d['body'][_0x2d5f('0x51')],_0x10674d[_0x2d5f('0x4b')][_0x2d5f('0x2f')]);_0x10674d['body'][_0x2d5f('0x52')]=integrations[_0x2d5f('0x53')](_0x10674d['body'][_0x2d5f('0x51')],_0x10674d[_0x2d5f('0x4b')][_0x2d5f('0x2f')]);return db[_0x2d5f('0x4d')][_0x2d5f('0x4a')](_0x10674d[_0x2d5f('0x4b')],{'include':[{'model':db[_0x2d5f('0x54')],'as':_0x2d5f('0x55')},{'model':db[_0x2d5f('0x54')],'as':_0x2d5f('0x52')}]});}return null;})[_0x2d5f('0x25')](respondWithResult(_0x8646dc,null))['catch'](handleError(_0x8646dc,null));};var md5=require(_0x2d5f('0x56'));exports[_0x2d5f('0x57')]=function(_0x2d5580,_0x3908be,_0x578c03){var _0x1b76a2=null;var _0x3c8171=null;var _0x3114e9=null;var _0x513ffe=null;var _0x4ebca9='';return db['VtigerAccount'][_0x2d5f('0x58')]({'where':{'id':_0x2d5580['params']['id']},'attributes':['id',_0x2d5f('0x29'),'username',_0x2d5f('0x59'),_0x2d5f('0x5a'),_0x2d5f('0x5b'),_0x2d5f('0x5c'),_0x2d5f('0x5d')]})[_0x2d5f('0x25')](handleEntityNotFound(_0x3908be,null))['then'](function(_0x182a8f){if(_0x182a8f){_0x1b76a2=_0x182a8f['username'];_0x3c8171=_0x182a8f[_0x2d5f('0x5d')];_0x3114e9=_0x182a8f[_0x2d5f('0x5a')];_0x4ebca9=_0x182a8f[_0x2d5f('0x5b')];var _0x550570=_0x4ebca9[_0x2d5f('0x5e')](-0x1);if(_0x550570==='/'){_0x4ebca9=_0x4ebca9[_0x2d5f('0x5f')](0x0,_0x4ebca9[_0x2d5f('0x60')](_0x550570));}_0x513ffe=util[_0x2d5f('0x61')](_0x2d5f('0x62'),_0x4ebca9);var _0x5db3ed={'method':_0x2d5f('0x63'),'uri':_0x513ffe,'qs':{'operation':_0x2d5f('0x64'),'username':_0x182a8f['username']},'json':!![]};return rp(_0x5db3ed);}})['then'](function(_0x390ae3){if(_0x390ae3[_0x2d5f('0x65')]){var _0xefc085={'method':'POST','uri':_0x513ffe,'form':{'operation':_0x2d5f('0x66'),'username':_0x1b76a2,'accessKey':md5(_0x390ae3[_0x2d5f('0x67')][_0x2d5f('0x68')]+_0x3c8171)},'json':!![]};return rp(_0xefc085);}})[_0x2d5f('0x25')](function(_0x242145){if(_0x242145[_0x2d5f('0x65')]){var _0x5571ca={'method':_0x2d5f('0x63'),'uri':_0x513ffe,'qs':{'operation':_0x2d5f('0x69'),'username':_0x1b76a2,'sessionName':_0x242145['result'][_0x2d5f('0x6a')],'elementType':_0x3114e9},'json':!![]};return rp(_0x5571ca);}})[_0x2d5f('0x25')](function(_0x401a90){if(_0x401a90['success']){var _0x22a702=[_0x2d5f('0x6b'),_0x2d5f('0x6c'),_0x2d5f('0x6d')];_[_0x2d5f('0x6e')](_0x401a90[_0x2d5f('0x67')]['fields'],function(_0x49f704){return _0x22a702[_0x2d5f('0x6f')](_0x49f704[_0x2d5f('0x2f')]['name']);});_[_0x2d5f('0x6e')](_0x401a90[_0x2d5f('0x67')][_0x2d5f('0x34')],function(_0x319c79){return _0x319c79[_0x2d5f('0x70')]===_0x2d5f('0x71');});return{'count':_0x401a90['result'][_0x2d5f('0x34')]['length'],'rows':_['map'](_0x401a90[_0x2d5f('0x67')]['fields'],function(_0x502a94){return{'id':_0x502a94[_0x2d5f('0x29')],'name':_0x502a94[_0x2d5f('0x72')],'custom':_[_0x2d5f('0x73')](_0x502a94['name'],_0x2d5f('0x74'))?!![]:![],'options':_0x502a94['type'][_0x2d5f('0x29')]===_0x2d5f('0x75')&&_0x502a94[_0x2d5f('0x2f')][_0x2d5f('0x76')]['length']>0x0?_[_0x2d5f('0x2c')](_0x502a94[_0x2d5f('0x2f')][_0x2d5f('0x76')],function(_0x27d256){return{'name':_0x27d256[_0x2d5f('0x72')],'value':_0x27d256[_0x2d5f('0x77')]};}):[]};})};}})[_0x2d5f('0x25')](respondWithResult(_0x3908be,null))[_0x2d5f('0x45')](function(_0x393dfe){console[_0x2d5f('0x78')]('vTiger\x20error:\x20'+_0x393dfe);var _0x3a8145=_0x2d5580[_0x2d5f('0x31')]['test']?0x1f4:_0x393dfe['statusCode']||0x1f4;logger['error'](_0x2d5f('0x79'),'getFields',_0x3a8145,JSON[_0x2d5f('0x7a')](_0x393dfe));delete _0x393dfe[_0x2d5f('0x29')];if(_0x3a8145===0x191){_0x3a8145=0x190;}_0x3908be[_0x2d5f('0x1b')](_0x3a8145)[_0x2d5f('0x2a')](_0x2d5580['query'][_0x2d5f('0x7b')]?{'message':_0x2d5f('0x7c'),'statusCode':_0x393dfe['statusCode']}:_0x393dfe);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b32a6e9..0848969 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 _0xca83=['../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','exports','define','int_vtiger_accounts','lodash'];(function(_0x475181,_0x413858){var _0x496f65=function(_0x36f8c4){while(--_0x36f8c4){_0x475181['push'](_0x475181['shift']());}};_0x496f65(++_0x413858);}(_0xca83,0x99));var _0x3ca8=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xca83[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x3ca8('0x0'));var util=require('util');var logger=require(_0x3ca8('0x1'))(_0x3ca8('0x2'));var moment=require(_0x3ca8('0x3'));var BPromise=require(_0x3ca8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ca8('0x5'));var rimraf=require('rimraf');var config=require(_0x3ca8('0x6'));var attributes=require(_0x3ca8('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3ca8('0x8')]=function(_0x2a2c0b,_0x5272ae){return _0x2a2c0b[_0x3ca8('0x9')]('VtigerAccount',attributes,{'tableName':_0x3ca8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6912=['exports','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x3632d1,_0x5359e6){var _0x13a16a=function(_0x272d97){while(--_0x272d97){_0x3632d1['push'](_0x3632d1['shift']());}};_0x13a16a(++_0x5359e6);}(_0x6912,0x1c3));var _0x2691=function(_0x201a0f,_0x22991b){_0x201a0f=_0x201a0f-0x0;var _0x36bce3=_0x6912[_0x201a0f];return _0x36bce3;};'use strict';var _=require(_0x2691('0x0'));var util=require(_0x2691('0x1'));var logger=require(_0x2691('0x2'))(_0x2691('0x3'));var moment=require(_0x2691('0x4'));var BPromise=require(_0x2691('0x5'));var rp=require(_0x2691('0x6'));var fs=require('fs');var path=require(_0x2691('0x7'));var rimraf=require(_0x2691('0x8'));var config=require(_0x2691('0x9'));var attributes=require(_0x2691('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x2691('0xb')]=function(_0x422aad,_0x4755a9){return _0x422aad['define'](_0x2691('0xc'),attributes,{'tableName':_0x2691('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 4be6d55..5b8752a 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 _0x0bb5=['VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x284258,_0x41159b){var _0x1231fc=function(_0x13683d){while(--_0x13683d){_0x284258['push'](_0x284258['shift']());}};_0x1231fc(++_0x41159b);}(_0x0bb5,0x148));var _0x50bb=function(_0x2db808,_0x5d92fb){_0x2db808=_0x2db808-0x0;var _0xbe5637=_0x0bb5[_0x2db808];return _0xbe5637;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['GetVtigerAccount']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['VtigerAccount']['findAll']({'raw':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24ba19[_0x50bb('0x16')]?_0x24ba19['options'][_0x50bb('0x18')]||null:null,'attributes':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')]['attributes']||null:null,'limit':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x19')]||null:null,'include':_0x24ba19['options']?_0x24ba19[_0x50bb('0x16')]['include']?_[_0x50bb('0x1a')](_0x24ba19[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x2ee87a){return{'model':db[_0x2ee87a[_0x50bb('0x1c')]],'as':_0x2ee87a['as'],'attributes':_0x2ee87a[_0x50bb('0x1d')],'include':_0x2ee87a['include']?_[_0x50bb('0x1a')](_0x2ee87a[_0x50bb('0x1b')],function(_0x284a76){return{'model':db[_0x284a76[_0x50bb('0x1c')]],'as':_0x284a76['as'],'attributes':_0x284a76['attributes'],'include':_0x284a76[_0x50bb('0x1b')]?_['map'](_0x284a76['include'],function(_0x2befd9){return{'model':db[_0x2befd9['model']],'as':_0x2befd9['as'],'attributes':_0x2befd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x12ee2c){logger[_0x50bb('0xb')](_0x50bb('0x1e'),_0x24ba19);logger[_0x50bb('0xd')](_0x50bb('0x1e'),_0x24ba19,JSON[_0x50bb('0x10')](_0x12ee2c));_0x301f61(_0x12ee2c);})[_0x50bb('0x15')](function(_0x4f7514){logger[_0x50bb('0x11')](_0x50bb('0x1e'),_0x4f7514[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4f7514['message']));});});};exports[_0x50bb('0x1f')]=function(_0x1a62fb){var _0xc38da5=this;return new Promise(function(_0xb3c3ba,_0x3fd5f6){return db[_0x50bb('0x20')][_0x50bb('0x21')]({'raw':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')]['where']||null:null,'attributes':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1d')]||null:null,'include':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x1cc4e2){return{'model':db[_0x1cc4e2[_0x50bb('0x1c')]],'as':_0x1cc4e2['as'],'attributes':_0x1cc4e2['attributes'],'include':_0x1cc4e2[_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1cc4e2[_0x50bb('0x1b')],function(_0x2bfb54){return{'model':db[_0x2bfb54[_0x50bb('0x1c')]],'as':_0x2bfb54['as'],'attributes':_0x2bfb54[_0x50bb('0x1d')],'include':_0x2bfb54['include']?_['map'](_0x2bfb54[_0x50bb('0x1b')],function(_0x5ed0b4){return{'model':db[_0x5ed0b4[_0x50bb('0x1c')]],'as':_0x5ed0b4['as'],'attributes':_0x5ed0b4[_0x50bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x171c6b){logger[_0x50bb('0xb')]('ShowVtigerAccount',_0x1a62fb);logger[_0x50bb('0xd')]('ShowVtigerAccount',_0x1a62fb,JSON[_0x50bb('0x10')](_0x171c6b));_0xb3c3ba(_0x171c6b);})[_0x50bb('0x15')](function(_0x280e5a){logger['error']('ShowVtigerAccount',_0x280e5a[_0x50bb('0x13')],_0x1a62fb);_0x3fd5f6(_0xc38da5[_0x50bb('0x11')](0x1f4,_0x280e5a[_0x50bb('0x13')]));});});}; \ No newline at end of file +var _0x7d25=['raw','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','then','ShowVtigerAccount','find'];(function(_0x2c3201,_0x1f76ff){var _0x564fc4=function(_0x424493){while(--_0x424493){_0x2c3201['push'](_0x2c3201['shift']());}};_0x564fc4(++_0x1f76ff);}(_0x7d25,0x8a));var _0x57d2=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x7d25[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('VtigerAccount,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});}exports[_0x57d2('0x14')]=function(_0x7d4cf1){var _0x2ecfdf=this;return new Promise(function(_0x4a94e3,_0x525cfc){return db[_0x57d2('0x15')][_0x57d2('0x16')]({'raw':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')]['where']||null:null,'attributes':_0x7d4cf1['options']?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x18')]||null:null,'limit':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x19')]||null:null,'include':_0x7d4cf1[_0x57d2('0x17')]?_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x7d4cf1[_0x57d2('0x17')][_0x57d2('0x1a')],function(_0x456fe1){return{'model':db[_0x456fe1[_0x57d2('0x1c')]],'as':_0x456fe1['as'],'attributes':_0x456fe1[_0x57d2('0x18')],'include':_0x456fe1['include']?_[_0x57d2('0x1b')](_0x456fe1[_0x57d2('0x1a')],function(_0x3c7de8){return{'model':db[_0x3c7de8[_0x57d2('0x1c')]],'as':_0x3c7de8['as'],'attributes':_0x3c7de8[_0x57d2('0x18')],'include':_0x3c7de8['include']?_[_0x57d2('0x1b')](_0x3c7de8[_0x57d2('0x1a')],function(_0x995928){return{'model':db[_0x995928[_0x57d2('0x1c')]],'as':_0x995928['as'],'attributes':_0x995928[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x57d2('0x1d')](function(_0x9bdb11){logger['info'](_0x57d2('0x14'),_0x7d4cf1);logger[_0x57d2('0xb')](_0x57d2('0x14'),_0x7d4cf1,JSON[_0x57d2('0xe')](_0x9bdb11));_0x4a94e3(_0x9bdb11);})[_0x57d2('0x13')](function(_0x7c33f3){logger[_0x57d2('0xf')](_0x57d2('0x14'),_0x7c33f3[_0x57d2('0x11')],_0x7d4cf1);_0x525cfc(_0x2ecfdf[_0x57d2('0xf')](0x1f4,_0x7c33f3['message']));});});};exports[_0x57d2('0x1e')]=function(_0x3da926){var _0x26e052=this;return new Promise(function(_0x3e017c,_0x484597){return db[_0x57d2('0x15')][_0x57d2('0x1f')]({'raw':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x20')]===undefined?!![]:![]:!![],'where':_0x3da926[_0x57d2('0x17')]?_0x3da926[_0x57d2('0x17')][_0x57d2('0x21')]||null:null,'attributes':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x18')]||null:null,'include':_0x3da926[_0x57d2('0x17')]?_0x3da926['options'][_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x3da926['options'][_0x57d2('0x1a')],function(_0x1c4ea5){return{'model':db[_0x1c4ea5[_0x57d2('0x1c')]],'as':_0x1c4ea5['as'],'attributes':_0x1c4ea5[_0x57d2('0x18')],'include':_0x1c4ea5[_0x57d2('0x1a')]?_['map'](_0x1c4ea5['include'],function(_0x581ebc){return{'model':db[_0x581ebc['model']],'as':_0x581ebc['as'],'attributes':_0x581ebc[_0x57d2('0x18')],'include':_0x581ebc[_0x57d2('0x1a')]?_[_0x57d2('0x1b')](_0x581ebc[_0x57d2('0x1a')],function(_0x13beac){return{'model':db[_0x13beac['model']],'as':_0x13beac['as'],'attributes':_0x13beac[_0x57d2('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3378a6){logger[_0x57d2('0x9')](_0x57d2('0x1e'),_0x3da926);logger['debug'](_0x57d2('0x1e'),_0x3da926,JSON[_0x57d2('0xe')](_0x3378a6));_0x3e017c(_0x3378a6);})['catch'](function(_0xb33455){logger[_0x57d2('0xf')](_0x57d2('0x1e'),_0xb33455[_0x57d2('0x11')],_0x3da926);_0x484597(_0x26e052[_0x57d2('0xf')](0x1f4,_0xb33455[_0x57d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2447040..c702a71 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 _0xa358=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','getFields'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa358,0xac));var _0x8a35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa358[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8a35('0x0'));var util=require(_0x8a35('0x1'));var path=require(_0x8a35('0x2'));var timeout=require(_0x8a35('0x3'));var express=require('express');var router=express[_0x8a35('0x4')]();var fs_extra=require(_0x8a35('0x5'));var auth=require(_0x8a35('0x6'));var interaction=require(_0x8a35('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x8a35('0x8')]('/',auth[_0x8a35('0x9')](),controller['index']);router[_0x8a35('0x8')]('/:id',auth[_0x8a35('0x9')](),controller[_0x8a35('0xa')]);router[_0x8a35('0x8')]('/:id/fields',auth[_0x8a35('0x9')](),controller[_0x8a35('0xb')]);router[_0x8a35('0x8')](_0x8a35('0xc'),auth['isAuthenticated'](),controller[_0x8a35('0xd')]);router[_0x8a35('0x8')](_0x8a35('0xe'),auth[_0x8a35('0x9')](),controller[_0x8a35('0xf')]);router[_0x8a35('0x10')]('/',auth[_0x8a35('0x9')](),controller[_0x8a35('0x11')]);router[_0x8a35('0x12')](_0x8a35('0x13'),auth[_0x8a35('0x9')](),controller[_0x8a35('0x14')]);router[_0x8a35('0x15')](_0x8a35('0x13'),auth['isAuthenticated'](),controller[_0x8a35('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf729=['post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','show','get','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x107950,_0x57ae8a){var _0x281a29=function(_0x48b11e){while(--_0x48b11e){_0x107950['push'](_0x107950['shift']());}};_0x281a29(++_0x57ae8a);}(_0xf729,0x1bc));var _0x9f72=function(_0xd5c4d6,_0x38fd23){_0xd5c4d6=_0xd5c4d6-0x0;var _0x3dfed1=_0xf729[_0xd5c4d6];return _0x3dfed1;};'use strict';var multer=require('multer');var util=require(_0x9f72('0x0'));var path=require(_0x9f72('0x1'));var timeout=require(_0x9f72('0x2'));var express=require(_0x9f72('0x3'));var router=express[_0x9f72('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f72('0x5'));var interaction=require(_0x9f72('0x6'));var config=require(_0x9f72('0x7'));var controller=require(_0x9f72('0x8'));router['get']('/',auth[_0x9f72('0x9')](),controller[_0x9f72('0xa')]);router['get']('/:id',auth[_0x9f72('0x9')](),controller[_0x9f72('0xb')]);router[_0x9f72('0xc')]('/:id/fields',auth[_0x9f72('0x9')](),controller['getFields']);router[_0x9f72('0xc')](_0x9f72('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9f72('0xc')](_0x9f72('0xe'),auth[_0x9f72('0x9')](),controller[_0x9f72('0xf')]);router[_0x9f72('0x10')]('/',auth[_0x9f72('0x9')](),controller[_0x9f72('0x11')]);router[_0x9f72('0x12')](_0x9f72('0x13'),auth[_0x9f72('0x9')](),controller[_0x9f72('0x14')]);router[_0x9f72('0x15')](_0x9f72('0x13'),auth[_0x9f72('0x9')](),controller['destroy']);module[_0x9f72('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index a3faa6f..637f15d 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 _0x9db0=['sequelize','exports','STRING'];(function(_0x1c3a1a,_0xfa88ee){var _0x37eb4e=function(_0x48c7c0){while(--_0x48c7c0){_0x1c3a1a['push'](_0x1c3a1a['shift']());}};_0x37eb4e(++_0xfa88ee);}(_0x9db0,0xd8));var _0x09db=function(_0x31041b,_0x5885b6){_0x31041b=_0x31041b-0x0;var _0xd57c7c=_0x9db0[_0x31041b];return _0xd57c7c;};'use strict';var Sequelize=require(_0x09db('0x0'));module[_0x09db('0x1')]={'name':{'type':Sequelize[_0x09db('0x2')]},'description':{'type':Sequelize[_0x09db('0x2')]}}; \ No newline at end of file +var _0x26db=['sequelize','STRING'];(function(_0x1f22aa,_0xa4d394){var _0x2cb500=function(_0x2d6426){while(--_0x2d6426){_0x1f22aa['push'](_0x1f22aa['shift']());}};_0x2cb500(++_0xa4d394);}(_0x26db,0x15e));var _0xb26d=function(_0x4bcfac,_0x48f4bb){_0x4bcfac=_0x4bcfac-0x0;var _0x253e20=_0x26db[_0x4bcfac];return _0x253e20;};'use strict';var Sequelize=require(_0xb26d('0x0'));module['exports']={'name':{'type':Sequelize[_0xb26d('0x1')]},'description':{'type':Sequelize[_0xb26d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index f7bb5f2..fcc53d1 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 _0xeed7=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','destroy','then','end','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getFields','findOne','VtigerField','length','getSubjects','getDescriptions','hasOwnProperty','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis'];(function(_0x28c884,_0x2dfffd){var _0x30fbe1=function(_0x48f168){while(--_0x48f168){_0x28c884['push'](_0x28c884['shift']());}};_0x30fbe1(++_0x2dfffd);}(_0xeed7,0xdf));var _0x7eed=function(_0x1a32bd,_0x5f5c45){_0x1a32bd=_0x1a32bd-0x0;var _0x20811e=_0xeed7[_0x1a32bd];return _0x20811e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7eed('0x0'));var jsonpatch=require(_0x7eed('0x1'));var rp=require('request-promise');var moment=require(_0x7eed('0x2'));var BPromise=require(_0x7eed('0x3'));var Mustache=require(_0x7eed('0x4'));var util=require(_0x7eed('0x5'));var path=require('path');var sox=require(_0x7eed('0x6'));var csv=require(_0x7eed('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eed('0x8'));var _=require(_0x7eed('0x9'));var squel=require(_0x7eed('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7eed('0xb'));var toCsv=require(_0x7eed('0x7'));var querystring=require(_0x7eed('0xc'));var Papa=require('papaparse');var Redis=require(_0x7eed('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7eed('0xe'));var hardwareService=require(_0x7eed('0xf'));var logger=require(_0x7eed('0x10'))(_0x7eed('0x11'));var utils=require(_0x7eed('0x12'));var config=require(_0x7eed('0x13'));var licenseUtil=require(_0x7eed('0x14'));var db=require(_0x7eed('0x15'))['db'];function respondWithStatusCode(_0x9e5978,_0x4ddcb2){_0x4ddcb2=_0x4ddcb2||0xcc;return function(_0x7f5aa4){if(_0x7f5aa4){return _0x9e5978[_0x7eed('0x16')](_0x4ddcb2);}return _0x9e5978[_0x7eed('0x17')](_0x4ddcb2)['end']();};}function respondWithResult(_0x5a9490,_0x2d3f7d){_0x2d3f7d=_0x2d3f7d||0xc8;return function(_0x2255c8){if(_0x2255c8){return _0x5a9490[_0x7eed('0x17')](_0x2d3f7d)[_0x7eed('0x18')](_0x2255c8);}};}function respondWithFilteredResult(_0x431738,_0x55426b){return function(_0x55db88){if(_0x55db88){var _0x598165=typeof _0x55426b[_0x7eed('0x19')]==='undefined'&&typeof _0x55426b['limit']==='undefined';var _0x2a2783=_0x55db88[_0x7eed('0x1a')];var _0x5143db=_0x598165?0x0:_0x55426b[_0x7eed('0x19')];var _0x3ab3e2=_0x598165?_0x55db88[_0x7eed('0x1a')]:_0x55426b[_0x7eed('0x19')]+_0x55426b[_0x7eed('0x1b')];var _0x2c9dea;if(_0x3ab3e2>=_0x2a2783){_0x3ab3e2=_0x2a2783;_0x2c9dea=0xc8;}else{_0x2c9dea=0xce;}_0x431738[_0x7eed('0x17')](_0x2c9dea);return _0x431738[_0x7eed('0x1c')](_0x7eed('0x1d'),_0x5143db+'-'+_0x3ab3e2+'/'+_0x2a2783)[_0x7eed('0x18')](_0x55db88);}return null;};}function patchUpdates(_0x45357c){return function(_0x5c8d86){try{jsonpatch[_0x7eed('0x1e')](_0x5c8d86,_0x45357c,!![]);}catch(_0x5e9835){return BPromise[_0x7eed('0x1f')](_0x5e9835);}return _0x5c8d86['save']();};}function saveUpdates(_0x3252aa,_0x36a112){return function(_0x578cf2){if(_0x578cf2){return _0x578cf2['update'](_0x3252aa)['then'](function(_0x2bd3f6){return _0x2bd3f6;});}return null;};}function removeEntity(_0x451e71,_0x1a2736){return function(_0xf50d35){if(_0xf50d35){return _0xf50d35[_0x7eed('0x20')]()[_0x7eed('0x21')](function(){_0x451e71[_0x7eed('0x17')](0xcc)[_0x7eed('0x22')]();});}};}function handleEntityNotFound(_0x1f2f8c,_0x3e4824){return function(_0x2fc47f){if(!_0x2fc47f){_0x1f2f8c[_0x7eed('0x16')](0x194);}return _0x2fc47f;};}function handleError(_0x291b7c,_0x21f740){_0x21f740=_0x21f740||0x1f4;return function(_0x19c47d){logger[_0x7eed('0x23')](_0x19c47d[_0x7eed('0x24')]);if(_0x19c47d[_0x7eed('0x25')]){delete _0x19c47d[_0x7eed('0x25')];}_0x291b7c[_0x7eed('0x17')](_0x21f740)[_0x7eed('0x26')](_0x19c47d);};}exports[_0x7eed('0x27')]=function(_0x34e625,_0x764ea3){var _0x38faff={},_0x37ace1={},_0x4016ca={'count':0x0,'rows':[]};var _0x1a1a71=_[_0x7eed('0x28')](db[_0x7eed('0x29')][_0x7eed('0x2a')],function(_0x3d6e09){return{'name':_0x3d6e09[_0x7eed('0x2b')],'type':_0x3d6e09[_0x7eed('0x2c')][_0x7eed('0x2d')]};});_0x37ace1[_0x7eed('0x2e')]=_['map'](_0x1a1a71,_0x7eed('0x25'));_0x37ace1[_0x7eed('0x2f')]=_[_0x7eed('0x30')](_0x34e625[_0x7eed('0x2f')]);_0x37ace1[_0x7eed('0x31')]=_['intersection'](_0x37ace1['model'],_0x37ace1['query']);_0x38faff[_0x7eed('0x32')]=_[_0x7eed('0x33')](_0x37ace1[_0x7eed('0x2e')],qs[_0x7eed('0x34')](_0x34e625['query'][_0x7eed('0x34')]));_0x38faff[_0x7eed('0x32')]=_0x38faff['attributes']['length']?_0x38faff[_0x7eed('0x32')]:_0x37ace1[_0x7eed('0x2e')];if(!_0x34e625[_0x7eed('0x2f')]['hasOwnProperty'](_0x7eed('0x35'))){_0x38faff['limit']=qs[_0x7eed('0x1b')](_0x34e625[_0x7eed('0x2f')][_0x7eed('0x1b')]);_0x38faff[_0x7eed('0x19')]=qs[_0x7eed('0x19')](_0x34e625[_0x7eed('0x2f')][_0x7eed('0x19')]);}_0x38faff[_0x7eed('0x36')]=qs['sort'](_0x34e625[_0x7eed('0x2f')][_0x7eed('0x37')]);_0x38faff[_0x7eed('0x38')]=qs[_0x7eed('0x31')](_[_0x7eed('0x39')](_0x34e625[_0x7eed('0x2f')],_0x37ace1[_0x7eed('0x31')]),_0x1a1a71);if(_0x34e625[_0x7eed('0x2f')][_0x7eed('0x3a')]){_0x38faff[_0x7eed('0x38')]=_[_0x7eed('0x3b')](_0x38faff['where'],{'$or':_[_0x7eed('0x28')](_0x1a1a71,function(_0x213b38){if(_0x213b38[_0x7eed('0x2c')]!=='VIRTUAL'){var _0xf13c2f={};_0xf13c2f[_0x213b38['name']]={'$like':'%'+_0x34e625[_0x7eed('0x2f')][_0x7eed('0x3a')]+'%'};return _0xf13c2f;}})});}_0x38faff=_[_0x7eed('0x3b')]({},_0x38faff,_0x34e625[_0x7eed('0x3c')]);var _0x23d50b={'where':_0x38faff[_0x7eed('0x38')]};return db[_0x7eed('0x29')][_0x7eed('0x1a')](_0x23d50b)[_0x7eed('0x21')](function(_0x438dd3){_0x4016ca[_0x7eed('0x1a')]=_0x438dd3;if(_0x34e625['query'][_0x7eed('0x3d')]){_0x38faff[_0x7eed('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x7eed('0x3f')](_0x38faff);})[_0x7eed('0x21')](function(_0xada32c){_0x4016ca[_0x7eed('0x40')]=_0xada32c;return _0x4016ca;})[_0x7eed('0x21')](respondWithFilteredResult(_0x764ea3,_0x38faff))[_0x7eed('0x41')](handleError(_0x764ea3,null));};exports[_0x7eed('0x42')]=function(_0xda9e12,_0x342869){var _0x88f618={'raw':![],'where':{'id':_0xda9e12[_0x7eed('0x43')]['id']}},_0x497a8c={};_0x497a8c[_0x7eed('0x2e')]=_[_0x7eed('0x30')](db[_0x7eed('0x29')][_0x7eed('0x2a')]);_0x497a8c[_0x7eed('0x2f')]=_[_0x7eed('0x30')](_0xda9e12[_0x7eed('0x2f')]);_0x497a8c[_0x7eed('0x31')]=_[_0x7eed('0x33')](_0x497a8c[_0x7eed('0x2e')],_0x497a8c[_0x7eed('0x2f')]);_0x88f618[_0x7eed('0x32')]=_[_0x7eed('0x33')](_0x497a8c[_0x7eed('0x2e')],qs['fields'](_0xda9e12['query'][_0x7eed('0x34')]));_0x88f618[_0x7eed('0x32')]=_0x88f618[_0x7eed('0x32')]['length']?_0x88f618['attributes']:_0x497a8c[_0x7eed('0x2e')];if(_0xda9e12[_0x7eed('0x2f')][_0x7eed('0x3d')]){_0x88f618['include']=[{'all':!![]}];}_0x88f618=_[_0x7eed('0x3b')]({},_0x88f618,_0xda9e12[_0x7eed('0x3c')]);return db[_0x7eed('0x29')][_0x7eed('0x44')](_0x88f618)[_0x7eed('0x21')](handleEntityNotFound(_0x342869,null))['then'](respondWithResult(_0x342869,null))[_0x7eed('0x41')](handleError(_0x342869,null));};exports[_0x7eed('0x45')]=function(_0x49bd34,_0x5ad3b0){return db['VtigerConfiguration'][_0x7eed('0x45')](_0x49bd34['body'],{})[_0x7eed('0x21')](respondWithResult(_0x5ad3b0,0xc9))[_0x7eed('0x41')](handleError(_0x5ad3b0,null));};exports[_0x7eed('0x46')]=function(_0x2c508c,_0x208da4){if(_0x2c508c[_0x7eed('0x47')]['id']){delete _0x2c508c[_0x7eed('0x47')]['id'];}return db[_0x7eed('0x29')][_0x7eed('0x44')]({'where':{'id':_0x2c508c[_0x7eed('0x43')]['id']}})[_0x7eed('0x21')](handleEntityNotFound(_0x208da4,null))['then'](saveUpdates(_0x2c508c[_0x7eed('0x47')],null))[_0x7eed('0x21')](respondWithResult(_0x208da4,null))[_0x7eed('0x41')](handleError(_0x208da4,null));};exports['destroy']=function(_0x386744,_0x2be206){return db['VtigerConfiguration'][_0x7eed('0x44')]({'where':{'id':_0x386744[_0x7eed('0x43')]['id']}})[_0x7eed('0x21')](handleEntityNotFound(_0x2be206,null))[_0x7eed('0x21')](removeEntity(_0x2be206,null))['catch'](handleError(_0x2be206,null));};exports[_0x7eed('0x48')]=function(_0x3994aa,_0x4c7ea1,_0x2bf79f){var _0x3b9cd7={};var _0x384f74={};var _0x3953ee;var _0x15d46e;return db[_0x7eed('0x29')][_0x7eed('0x49')]({'where':{'id':_0x3994aa[_0x7eed('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c7ea1,null))[_0x7eed('0x21')](function(_0xf65a44){if(_0xf65a44){_0x3953ee=_0xf65a44;_0x384f74[_0x7eed('0x2e')]=_['keys'](db[_0x7eed('0x4a')][_0x7eed('0x2a')]);_0x384f74[_0x7eed('0x2f')]=_[_0x7eed('0x30')](_0x3994aa[_0x7eed('0x2f')]);_0x384f74['filters']=_['intersection'](_0x384f74[_0x7eed('0x2e')],_0x384f74[_0x7eed('0x2f')]);_0x3b9cd7['attributes']=_[_0x7eed('0x33')](_0x384f74[_0x7eed('0x2e')],qs['fields'](_0x3994aa[_0x7eed('0x2f')]['fields']));_0x3b9cd7[_0x7eed('0x32')]=_0x3b9cd7['attributes']['length']?_0x3b9cd7[_0x7eed('0x32')]:_0x384f74[_0x7eed('0x2e')];_0x3b9cd7[_0x7eed('0x36')]=qs[_0x7eed('0x37')](_0x3994aa['query'][_0x7eed('0x37')]);_0x3b9cd7['where']=qs[_0x7eed('0x31')](_['pick'](_0x3994aa[_0x7eed('0x2f')],_0x384f74[_0x7eed('0x31')]));if(_0x3994aa['query']['filter']){_0x3b9cd7[_0x7eed('0x38')]=_[_0x7eed('0x3b')](_0x3b9cd7[_0x7eed('0x38')],{'$or':_[_0x7eed('0x28')](_0x3b9cd7[_0x7eed('0x32')],function(_0x37612b){var _0x1ebff5={};_0x1ebff5[_0x37612b]={'$like':'%'+_0x3994aa['query'][_0x7eed('0x3a')]+'%'};return _0x1ebff5;})});}_0x3b9cd7=_['merge']({},_0x3b9cd7,_0x3994aa[_0x7eed('0x3c')]);return _0x3953ee[_0x7eed('0x48')](_0x3b9cd7);}})['then'](function(_0x4075ba){if(_0x4075ba){_0x15d46e=_0x4075ba['length'];if(!_0x3994aa[_0x7eed('0x2f')]['hasOwnProperty']('nolimit')){_0x3b9cd7[_0x7eed('0x1b')]=qs['limit'](_0x3994aa[_0x7eed('0x2f')][_0x7eed('0x1b')]);_0x3b9cd7[_0x7eed('0x19')]=qs[_0x7eed('0x19')](_0x3994aa[_0x7eed('0x2f')][_0x7eed('0x19')]);}return _0x3953ee[_0x7eed('0x48')](_0x3b9cd7);}})[_0x7eed('0x21')](function(_0x35ea4c){if(_0x35ea4c){return _0x35ea4c?{'count':_0x15d46e,'rows':_0x35ea4c}:null;}})[_0x7eed('0x21')](respondWithResult(_0x4c7ea1,null))[_0x7eed('0x41')](handleError(_0x4c7ea1,null));};exports['getSubjects']=function(_0x4c7379,_0x355ae4,_0x522aad){var _0x355221={};var _0x82928b={};var _0xb851c3;var _0x26ec14;return db[_0x7eed('0x29')][_0x7eed('0x49')]({'where':{'id':_0x4c7379[_0x7eed('0x43')]['id']}})[_0x7eed('0x21')](handleEntityNotFound(_0x355ae4,null))[_0x7eed('0x21')](function(_0xfe9caf){if(_0xfe9caf){_0xb851c3=_0xfe9caf;_0x82928b[_0x7eed('0x2e')]=_['keys'](db['VtigerField']['rawAttributes']);_0x82928b[_0x7eed('0x2f')]=_['keys'](_0x4c7379['query']);_0x82928b[_0x7eed('0x31')]=_[_0x7eed('0x33')](_0x82928b[_0x7eed('0x2e')],_0x82928b['query']);_0x355221[_0x7eed('0x32')]=_[_0x7eed('0x33')](_0x82928b[_0x7eed('0x2e')],qs[_0x7eed('0x34')](_0x4c7379[_0x7eed('0x2f')]['fields']));_0x355221[_0x7eed('0x32')]=_0x355221['attributes'][_0x7eed('0x4b')]?_0x355221[_0x7eed('0x32')]:_0x82928b[_0x7eed('0x2e')];_0x355221['order']=qs[_0x7eed('0x37')](_0x4c7379[_0x7eed('0x2f')][_0x7eed('0x37')]);_0x355221['where']=qs[_0x7eed('0x31')](_[_0x7eed('0x39')](_0x4c7379[_0x7eed('0x2f')],_0x82928b[_0x7eed('0x31')]));if(_0x4c7379[_0x7eed('0x2f')]['filter']){_0x355221[_0x7eed('0x38')]=_[_0x7eed('0x3b')](_0x355221[_0x7eed('0x38')],{'$or':_[_0x7eed('0x28')](_0x355221[_0x7eed('0x32')],function(_0x42cb5c){var _0x312450={};_0x312450[_0x42cb5c]={'$like':'%'+_0x4c7379[_0x7eed('0x2f')][_0x7eed('0x3a')]+'%'};return _0x312450;})});}_0x355221=_[_0x7eed('0x3b')]({},_0x355221,_0x4c7379[_0x7eed('0x3c')]);return _0xb851c3[_0x7eed('0x4c')](_0x355221);}})[_0x7eed('0x21')](function(_0x5777de){if(_0x5777de){_0x26ec14=_0x5777de[_0x7eed('0x4b')];if(!_0x4c7379[_0x7eed('0x2f')]['hasOwnProperty'](_0x7eed('0x35'))){_0x355221[_0x7eed('0x1b')]=qs[_0x7eed('0x1b')](_0x4c7379[_0x7eed('0x2f')][_0x7eed('0x1b')]);_0x355221[_0x7eed('0x19')]=qs[_0x7eed('0x19')](_0x4c7379[_0x7eed('0x2f')][_0x7eed('0x19')]);}return _0xb851c3[_0x7eed('0x4c')](_0x355221);}})[_0x7eed('0x21')](function(_0x7519e5){if(_0x7519e5){return _0x7519e5?{'count':_0x26ec14,'rows':_0x7519e5}:null;}})['then'](respondWithResult(_0x355ae4,null))[_0x7eed('0x41')](handleError(_0x355ae4,null));};exports['getDescriptions']=function(_0x181955,_0x57b685,_0x19e5dd){var _0x1df8f7={};var _0x397094={};var _0x1c2cc2;var _0x269355;return db['VtigerConfiguration'][_0x7eed('0x49')]({'where':{'id':_0x181955['params']['id']}})[_0x7eed('0x21')](handleEntityNotFound(_0x57b685,null))[_0x7eed('0x21')](function(_0x55e79a){if(_0x55e79a){_0x1c2cc2=_0x55e79a;_0x397094[_0x7eed('0x2e')]=_[_0x7eed('0x30')](db['VtigerField'][_0x7eed('0x2a')]);_0x397094['query']=_[_0x7eed('0x30')](_0x181955[_0x7eed('0x2f')]);_0x397094[_0x7eed('0x31')]=_[_0x7eed('0x33')](_0x397094[_0x7eed('0x2e')],_0x397094[_0x7eed('0x2f')]);_0x1df8f7['attributes']=_['intersection'](_0x397094[_0x7eed('0x2e')],qs['fields'](_0x181955['query'][_0x7eed('0x34')]));_0x1df8f7[_0x7eed('0x32')]=_0x1df8f7[_0x7eed('0x32')][_0x7eed('0x4b')]?_0x1df8f7['attributes']:_0x397094[_0x7eed('0x2e')];_0x1df8f7[_0x7eed('0x36')]=qs['sort'](_0x181955[_0x7eed('0x2f')]['sort']);_0x1df8f7[_0x7eed('0x38')]=qs[_0x7eed('0x31')](_['pick'](_0x181955[_0x7eed('0x2f')],_0x397094['filters']));if(_0x181955['query']['filter']){_0x1df8f7[_0x7eed('0x38')]=_[_0x7eed('0x3b')](_0x1df8f7['where'],{'$or':_['map'](_0x1df8f7[_0x7eed('0x32')],function(_0x83d3c1){var _0x15364b={};_0x15364b[_0x83d3c1]={'$like':'%'+_0x181955['query'][_0x7eed('0x3a')]+'%'};return _0x15364b;})});}_0x1df8f7=_[_0x7eed('0x3b')]({},_0x1df8f7,_0x181955[_0x7eed('0x3c')]);return _0x1c2cc2[_0x7eed('0x4d')](_0x1df8f7);}})[_0x7eed('0x21')](function(_0xfbdf0e){if(_0xfbdf0e){_0x269355=_0xfbdf0e[_0x7eed('0x4b')];if(!_0x181955[_0x7eed('0x2f')][_0x7eed('0x4e')](_0x7eed('0x35'))){_0x1df8f7[_0x7eed('0x1b')]=qs['limit'](_0x181955[_0x7eed('0x2f')][_0x7eed('0x1b')]);_0x1df8f7[_0x7eed('0x19')]=qs[_0x7eed('0x19')](_0x181955[_0x7eed('0x2f')][_0x7eed('0x19')]);}return _0x1c2cc2[_0x7eed('0x4d')](_0x1df8f7);}})['then'](function(_0x3710f9){if(_0x3710f9){return _0x3710f9?{'count':_0x269355,'rows':_0x3710f9}:null;}})[_0x7eed('0x21')](respondWithResult(_0x57b685,null))[_0x7eed('0x41')](handleError(_0x57b685,null));}; \ No newline at end of file +var _0xe008=['name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','update','find','findOne','VtigerField','length','getFields','getSubjects','getDescriptions','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../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','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','stack'];(function(_0x2d15aa,_0x16966c){var _0x3509aa=function(_0x4306a5){while(--_0x4306a5){_0x2d15aa['push'](_0x2d15aa['shift']());}};_0x3509aa(++_0x16966c);}(_0xe008,0xcc));var _0x8e00=function(_0x5a8b0f,_0x1804e0){_0x5a8b0f=_0x5a8b0f-0x0;var _0x20aec9=_0xe008[_0x5a8b0f];return _0x20aec9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8e00('0x0'));var jsonpatch=require(_0x8e00('0x1'));var rp=require(_0x8e00('0x2'));var moment=require(_0x8e00('0x3'));var BPromise=require(_0x8e00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e00('0x5'));var sox=require(_0x8e00('0x6'));var csv=require(_0x8e00('0x7'));var ejs=require(_0x8e00('0x8'));var fs=require('fs');var fs_extra=require(_0x8e00('0x9'));var _=require(_0x8e00('0xa'));var squel=require(_0x8e00('0xb'));var crypto=require(_0x8e00('0xc'));var jsforce=require(_0x8e00('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8e00('0x7'));var querystring=require(_0x8e00('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e00('0xf'));var qs=require(_0x8e00('0x10'));var as=require(_0x8e00('0x11'));var hardwareService=require(_0x8e00('0x12'));var logger=require('../../config/logger')(_0x8e00('0x13'));var utils=require(_0x8e00('0x14'));var config=require(_0x8e00('0x15'));var licenseUtil=require(_0x8e00('0x16'));var db=require(_0x8e00('0x17'))['db'];function respondWithStatusCode(_0x54a265,_0x484cf6){_0x484cf6=_0x484cf6||0xcc;return function(_0x4d038f){if(_0x4d038f){return _0x54a265[_0x8e00('0x18')](_0x484cf6);}return _0x54a265[_0x8e00('0x19')](_0x484cf6)['end']();};}function respondWithResult(_0x325f32,_0x1d0353){_0x1d0353=_0x1d0353||0xc8;return function(_0x10ec78){if(_0x10ec78){return _0x325f32[_0x8e00('0x19')](_0x1d0353)[_0x8e00('0x1a')](_0x10ec78);}};}function respondWithFilteredResult(_0x20f43f,_0x238bc6){return function(_0x580737){if(_0x580737){var _0x47942f=typeof _0x238bc6['offset']===_0x8e00('0x1b')&&typeof _0x238bc6['limit']===_0x8e00('0x1b');var _0x315152=_0x580737[_0x8e00('0x1c')];var _0x252fc9=_0x47942f?0x0:_0x238bc6[_0x8e00('0x1d')];var _0x3fdc92=_0x47942f?_0x580737['count']:_0x238bc6[_0x8e00('0x1d')]+_0x238bc6[_0x8e00('0x1e')];var _0x136d7b;if(_0x3fdc92>=_0x315152){_0x3fdc92=_0x315152;_0x136d7b=0xc8;}else{_0x136d7b=0xce;}_0x20f43f[_0x8e00('0x19')](_0x136d7b);return _0x20f43f[_0x8e00('0x1f')](_0x8e00('0x20'),_0x252fc9+'-'+_0x3fdc92+'/'+_0x315152)[_0x8e00('0x1a')](_0x580737);}return null;};}function patchUpdates(_0x5c354e){return function(_0x304a48){try{jsonpatch[_0x8e00('0x21')](_0x304a48,_0x5c354e,!![]);}catch(_0x1e551e){return BPromise['reject'](_0x1e551e);}return _0x304a48[_0x8e00('0x22')]();};}function saveUpdates(_0x306d9f,_0x2b3a0e){return function(_0xca0dba){if(_0xca0dba){return _0xca0dba['update'](_0x306d9f)[_0x8e00('0x23')](function(_0x246b53){return _0x246b53;});}return null;};}function removeEntity(_0xb1d1ec,_0x1cfe0a){return function(_0x1747c2){if(_0x1747c2){return _0x1747c2[_0x8e00('0x24')]()['then'](function(){_0xb1d1ec[_0x8e00('0x19')](0xcc)[_0x8e00('0x25')]();});}};}function handleEntityNotFound(_0x1c936d,_0x1ca291){return function(_0x324207){if(!_0x324207){_0x1c936d[_0x8e00('0x18')](0x194);}return _0x324207;};}function handleError(_0x15ced4,_0x3a5768){_0x3a5768=_0x3a5768||0x1f4;return function(_0x254cb6){logger['error'](_0x254cb6[_0x8e00('0x26')]);if(_0x254cb6['name']){delete _0x254cb6[_0x8e00('0x27')];}_0x15ced4[_0x8e00('0x19')](_0x3a5768)[_0x8e00('0x28')](_0x254cb6);};}exports[_0x8e00('0x29')]=function(_0x49ce91,_0xda78b4){var _0xed7bd2={},_0x3e1a8f={},_0x3d85d3={'count':0x0,'rows':[]};var _0x2a620e=_[_0x8e00('0x2a')](db[_0x8e00('0x2b')]['rawAttributes'],function(_0x18161a){return{'name':_0x18161a[_0x8e00('0x2c')],'type':_0x18161a[_0x8e00('0x2d')][_0x8e00('0x2e')]};});_0x3e1a8f[_0x8e00('0x2f')]=_[_0x8e00('0x2a')](_0x2a620e,_0x8e00('0x27'));_0x3e1a8f[_0x8e00('0x30')]=_['keys'](_0x49ce91[_0x8e00('0x30')]);_0x3e1a8f[_0x8e00('0x31')]=_[_0x8e00('0x32')](_0x3e1a8f['model'],_0x3e1a8f[_0x8e00('0x30')]);_0xed7bd2['attributes']=_[_0x8e00('0x32')](_0x3e1a8f[_0x8e00('0x2f')],qs[_0x8e00('0x33')](_0x49ce91[_0x8e00('0x30')][_0x8e00('0x33')]));_0xed7bd2['attributes']=_0xed7bd2[_0x8e00('0x34')]['length']?_0xed7bd2[_0x8e00('0x34')]:_0x3e1a8f[_0x8e00('0x2f')];if(!_0x49ce91['query'][_0x8e00('0x35')]('nolimit')){_0xed7bd2[_0x8e00('0x1e')]=qs['limit'](_0x49ce91[_0x8e00('0x30')][_0x8e00('0x1e')]);_0xed7bd2['offset']=qs[_0x8e00('0x1d')](_0x49ce91[_0x8e00('0x30')]['offset']);}_0xed7bd2[_0x8e00('0x36')]=qs[_0x8e00('0x37')](_0x49ce91['query']['sort']);_0xed7bd2['where']=qs[_0x8e00('0x31')](_[_0x8e00('0x38')](_0x49ce91['query'],_0x3e1a8f['filters']),_0x2a620e);if(_0x49ce91[_0x8e00('0x30')][_0x8e00('0x39')]){_0xed7bd2['where']=_[_0x8e00('0x3a')](_0xed7bd2[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x2a620e,function(_0x3b994e){if(_0x3b994e['type']!==_0x8e00('0x3c')){var _0x40c012={};_0x40c012[_0x3b994e[_0x8e00('0x27')]]={'$like':'%'+_0x49ce91[_0x8e00('0x30')]['filter']+'%'};return _0x40c012;}})});}_0xed7bd2=_[_0x8e00('0x3a')]({},_0xed7bd2,_0x49ce91[_0x8e00('0x3d')]);var _0x3abd2b={'where':_0xed7bd2[_0x8e00('0x3b')]};return db[_0x8e00('0x2b')][_0x8e00('0x1c')](_0x3abd2b)[_0x8e00('0x23')](function(_0x17232b){_0x3d85d3[_0x8e00('0x1c')]=_0x17232b;if(_0x49ce91['query'][_0x8e00('0x3e')]){_0xed7bd2[_0x8e00('0x3f')]=[{'all':!![]}];}return db[_0x8e00('0x2b')]['findAll'](_0xed7bd2);})['then'](function(_0x15f745){_0x3d85d3[_0x8e00('0x40')]=_0x15f745;return _0x3d85d3;})[_0x8e00('0x23')](respondWithFilteredResult(_0xda78b4,_0xed7bd2))[_0x8e00('0x41')](handleError(_0xda78b4,null));};exports[_0x8e00('0x42')]=function(_0x32af47,_0x2512ef){var _0x23d813={'raw':![],'where':{'id':_0x32af47[_0x8e00('0x43')]['id']}},_0x2decef={};_0x2decef[_0x8e00('0x2f')]=_[_0x8e00('0x44')](db[_0x8e00('0x2b')][_0x8e00('0x45')]);_0x2decef[_0x8e00('0x30')]=_['keys'](_0x32af47[_0x8e00('0x30')]);_0x2decef['filters']=_[_0x8e00('0x32')](_0x2decef[_0x8e00('0x2f')],_0x2decef['query']);_0x23d813[_0x8e00('0x34')]=_['intersection'](_0x2decef[_0x8e00('0x2f')],qs[_0x8e00('0x33')](_0x32af47[_0x8e00('0x30')][_0x8e00('0x33')]));_0x23d813[_0x8e00('0x34')]=_0x23d813[_0x8e00('0x34')]['length']?_0x23d813[_0x8e00('0x34')]:_0x2decef[_0x8e00('0x2f')];if(_0x32af47[_0x8e00('0x30')]['includeAll']){_0x23d813['include']=[{'all':!![]}];}_0x23d813=_[_0x8e00('0x3a')]({},_0x23d813,_0x32af47['options']);return db[_0x8e00('0x2b')]['find'](_0x23d813)['then'](handleEntityNotFound(_0x2512ef,null))['then'](respondWithResult(_0x2512ef,null))[_0x8e00('0x41')](handleError(_0x2512ef,null));};exports[_0x8e00('0x46')]=function(_0x4034c4,_0x15c57c){return db[_0x8e00('0x2b')]['create'](_0x4034c4[_0x8e00('0x47')],{})[_0x8e00('0x23')](respondWithResult(_0x15c57c,0xc9))[_0x8e00('0x41')](handleError(_0x15c57c,null));};exports[_0x8e00('0x48')]=function(_0x7745a9,_0x38c16a){if(_0x7745a9[_0x8e00('0x47')]['id']){delete _0x7745a9[_0x8e00('0x47')]['id'];}return db['VtigerConfiguration'][_0x8e00('0x49')]({'where':{'id':_0x7745a9[_0x8e00('0x43')]['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x38c16a,null))[_0x8e00('0x23')](saveUpdates(_0x7745a9['body'],null))[_0x8e00('0x23')](respondWithResult(_0x38c16a,null))['catch'](handleError(_0x38c16a,null));};exports[_0x8e00('0x24')]=function(_0x6319d9,_0x19b41a){return db[_0x8e00('0x2b')]['find']({'where':{'id':_0x6319d9[_0x8e00('0x43')]['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x19b41a,null))[_0x8e00('0x23')](removeEntity(_0x19b41a,null))[_0x8e00('0x41')](handleError(_0x19b41a,null));};exports['getFields']=function(_0x2bce8a,_0x506ac0,_0x4be94d){var _0x41bf91={};var _0x16b91d={};var _0x52cb33;var _0x27eb59;return db[_0x8e00('0x2b')][_0x8e00('0x4a')]({'where':{'id':_0x2bce8a[_0x8e00('0x43')]['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x506ac0,null))[_0x8e00('0x23')](function(_0x3e87de){if(_0x3e87de){_0x52cb33=_0x3e87de;_0x16b91d[_0x8e00('0x2f')]=_[_0x8e00('0x44')](db[_0x8e00('0x4b')][_0x8e00('0x45')]);_0x16b91d[_0x8e00('0x30')]=_[_0x8e00('0x44')](_0x2bce8a[_0x8e00('0x30')]);_0x16b91d[_0x8e00('0x31')]=_[_0x8e00('0x32')](_0x16b91d['model'],_0x16b91d[_0x8e00('0x30')]);_0x41bf91[_0x8e00('0x34')]=_['intersection'](_0x16b91d['model'],qs[_0x8e00('0x33')](_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x33')]));_0x41bf91[_0x8e00('0x34')]=_0x41bf91['attributes'][_0x8e00('0x4c')]?_0x41bf91[_0x8e00('0x34')]:_0x16b91d[_0x8e00('0x2f')];_0x41bf91[_0x8e00('0x36')]=qs['sort'](_0x2bce8a['query'][_0x8e00('0x37')]);_0x41bf91['where']=qs[_0x8e00('0x31')](_[_0x8e00('0x38')](_0x2bce8a['query'],_0x16b91d[_0x8e00('0x31')]));if(_0x2bce8a['query'][_0x8e00('0x39')]){_0x41bf91[_0x8e00('0x3b')]=_[_0x8e00('0x3a')](_0x41bf91[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x41bf91[_0x8e00('0x34')],function(_0x1f838b){var _0x103d10={};_0x103d10[_0x1f838b]={'$like':'%'+_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x39')]+'%'};return _0x103d10;})});}_0x41bf91=_[_0x8e00('0x3a')]({},_0x41bf91,_0x2bce8a[_0x8e00('0x3d')]);return _0x52cb33[_0x8e00('0x4d')](_0x41bf91);}})[_0x8e00('0x23')](function(_0x353228){if(_0x353228){_0x27eb59=_0x353228[_0x8e00('0x4c')];if(!_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x35')]('nolimit')){_0x41bf91[_0x8e00('0x1e')]=qs[_0x8e00('0x1e')](_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x1e')]);_0x41bf91[_0x8e00('0x1d')]=qs[_0x8e00('0x1d')](_0x2bce8a[_0x8e00('0x30')][_0x8e00('0x1d')]);}return _0x52cb33[_0x8e00('0x4d')](_0x41bf91);}})[_0x8e00('0x23')](function(_0x35ecab){if(_0x35ecab){return _0x35ecab?{'count':_0x27eb59,'rows':_0x35ecab}:null;}})['then'](respondWithResult(_0x506ac0,null))['catch'](handleError(_0x506ac0,null));};exports[_0x8e00('0x4e')]=function(_0xe4adc0,_0x256493,_0xf40817){var _0x171c9c={};var _0x1b107f={};var _0x36c914;var _0x580f02;return db[_0x8e00('0x2b')][_0x8e00('0x4a')]({'where':{'id':_0xe4adc0['params']['id']}})[_0x8e00('0x23')](handleEntityNotFound(_0x256493,null))[_0x8e00('0x23')](function(_0x1296e2){if(_0x1296e2){_0x36c914=_0x1296e2;_0x1b107f['model']=_['keys'](db[_0x8e00('0x4b')][_0x8e00('0x45')]);_0x1b107f[_0x8e00('0x30')]=_[_0x8e00('0x44')](_0xe4adc0[_0x8e00('0x30')]);_0x1b107f[_0x8e00('0x31')]=_[_0x8e00('0x32')](_0x1b107f[_0x8e00('0x2f')],_0x1b107f[_0x8e00('0x30')]);_0x171c9c['attributes']=_[_0x8e00('0x32')](_0x1b107f[_0x8e00('0x2f')],qs[_0x8e00('0x33')](_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x33')]));_0x171c9c['attributes']=_0x171c9c[_0x8e00('0x34')]['length']?_0x171c9c['attributes']:_0x1b107f[_0x8e00('0x2f')];_0x171c9c[_0x8e00('0x36')]=qs[_0x8e00('0x37')](_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x37')]);_0x171c9c[_0x8e00('0x3b')]=qs[_0x8e00('0x31')](_[_0x8e00('0x38')](_0xe4adc0[_0x8e00('0x30')],_0x1b107f[_0x8e00('0x31')]));if(_0xe4adc0['query'][_0x8e00('0x39')]){_0x171c9c[_0x8e00('0x3b')]=_['merge'](_0x171c9c[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x171c9c[_0x8e00('0x34')],function(_0x197abe){var _0x5c9306={};_0x5c9306[_0x197abe]={'$like':'%'+_0xe4adc0['query'][_0x8e00('0x39')]+'%'};return _0x5c9306;})});}_0x171c9c=_[_0x8e00('0x3a')]({},_0x171c9c,_0xe4adc0[_0x8e00('0x3d')]);return _0x36c914[_0x8e00('0x4e')](_0x171c9c);}})[_0x8e00('0x23')](function(_0x2c4e31){if(_0x2c4e31){_0x580f02=_0x2c4e31['length'];if(!_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x35')]('nolimit')){_0x171c9c[_0x8e00('0x1e')]=qs[_0x8e00('0x1e')](_0xe4adc0['query'][_0x8e00('0x1e')]);_0x171c9c[_0x8e00('0x1d')]=qs[_0x8e00('0x1d')](_0xe4adc0[_0x8e00('0x30')][_0x8e00('0x1d')]);}return _0x36c914[_0x8e00('0x4e')](_0x171c9c);}})[_0x8e00('0x23')](function(_0x233874){if(_0x233874){return _0x233874?{'count':_0x580f02,'rows':_0x233874}:null;}})['then'](respondWithResult(_0x256493,null))[_0x8e00('0x41')](handleError(_0x256493,null));};exports['getDescriptions']=function(_0x49920b,_0x2ffe5c,_0x10e3f9){var _0x18276a={};var _0x2a3258={};var _0x42e733;var _0xe2e5bc;return db[_0x8e00('0x2b')]['findOne']({'where':{'id':_0x49920b[_0x8e00('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ffe5c,null))[_0x8e00('0x23')](function(_0x2a9631){if(_0x2a9631){_0x42e733=_0x2a9631;_0x2a3258['model']=_['keys'](db[_0x8e00('0x4b')][_0x8e00('0x45')]);_0x2a3258[_0x8e00('0x30')]=_[_0x8e00('0x44')](_0x49920b[_0x8e00('0x30')]);_0x2a3258['filters']=_[_0x8e00('0x32')](_0x2a3258[_0x8e00('0x2f')],_0x2a3258[_0x8e00('0x30')]);_0x18276a[_0x8e00('0x34')]=_['intersection'](_0x2a3258[_0x8e00('0x2f')],qs['fields'](_0x49920b[_0x8e00('0x30')][_0x8e00('0x33')]));_0x18276a['attributes']=_0x18276a[_0x8e00('0x34')]['length']?_0x18276a[_0x8e00('0x34')]:_0x2a3258[_0x8e00('0x2f')];_0x18276a[_0x8e00('0x36')]=qs[_0x8e00('0x37')](_0x49920b[_0x8e00('0x30')][_0x8e00('0x37')]);_0x18276a[_0x8e00('0x3b')]=qs['filters'](_[_0x8e00('0x38')](_0x49920b['query'],_0x2a3258[_0x8e00('0x31')]));if(_0x49920b['query'][_0x8e00('0x39')]){_0x18276a[_0x8e00('0x3b')]=_[_0x8e00('0x3a')](_0x18276a[_0x8e00('0x3b')],{'$or':_[_0x8e00('0x2a')](_0x18276a[_0x8e00('0x34')],function(_0x35e6ec){var _0x54fc20={};_0x54fc20[_0x35e6ec]={'$like':'%'+_0x49920b[_0x8e00('0x30')][_0x8e00('0x39')]+'%'};return _0x54fc20;})});}_0x18276a=_['merge']({},_0x18276a,_0x49920b['options']);return _0x42e733[_0x8e00('0x4f')](_0x18276a);}})[_0x8e00('0x23')](function(_0x437d5e){if(_0x437d5e){_0xe2e5bc=_0x437d5e[_0x8e00('0x4c')];if(!_0x49920b[_0x8e00('0x30')]['hasOwnProperty'](_0x8e00('0x50'))){_0x18276a['limit']=qs[_0x8e00('0x1e')](_0x49920b[_0x8e00('0x30')]['limit']);_0x18276a[_0x8e00('0x1d')]=qs['offset'](_0x49920b[_0x8e00('0x30')][_0x8e00('0x1d')]);}return _0x42e733[_0x8e00('0x4f')](_0x18276a);}})[_0x8e00('0x23')](function(_0x3a2ba5){if(_0x3a2ba5){return _0x3a2ba5?{'count':_0xe2e5bc,'rows':_0x3a2ba5}:null;}})['then'](respondWithResult(_0x2ffe5c,null))[_0x8e00('0x41')](handleError(_0x2ffe5c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7515bdb..47842fc 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 _0x5d82=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','bluebird','request-promise','path'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0x5d82,0x13d));var _0x25d8=function(_0x230778,_0x20068a){_0x230778=_0x230778-0x0;var _0x120686=_0x5d82[_0x230778];return _0x120686;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x25d8('0x0'));var rp=require(_0x25d8('0x1'));var fs=require('fs');var path=require(_0x25d8('0x2'));var rimraf=require(_0x25d8('0x3'));var config=require(_0x25d8('0x4'));var attributes=require(_0x25d8('0x5'));module[_0x25d8('0x6')]=function(_0x5a0aef,_0x576556){return _0x5a0aef[_0x25d8('0x7')](_0x25d8('0x8'),attributes,{'tableName':_0x25d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1012=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x1012,0x1bb));var _0x2101=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x1012[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x2101('0x0'));var util=require(_0x2101('0x1'));var logger=require(_0x2101('0x2'))(_0x2101('0x3'));var moment=require(_0x2101('0x4'));var BPromise=require(_0x2101('0x5'));var rp=require(_0x2101('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2101('0x7'));var config=require('../../config/environment');var attributes=require(_0x2101('0x8'));module[_0x2101('0x9')]=function(_0xfcb47d,_0x35e5ff){return _0xfcb47d[_0x2101('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x2101('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 a05c642..3d0fd04 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 _0x3277=['rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x288371,_0x35f999){var _0x5a1ad1=function(_0xc35a07){while(--_0xc35a07){_0x288371['push'](_0x288371['shift']());}};_0x5a1ad1(++_0x35f999);}(_0x3277,0x169));var _0x7327=function(_0x6a01bd,_0xa69c9d){_0x6a01bd=_0x6a01bd-0x0;var _0x1b9bfe=_0x3277[_0x6a01bd];return _0x1b9bfe;};'use strict';var _=require(_0x7327('0x0'));var util=require(_0x7327('0x1'));var moment=require(_0x7327('0x2'));var BPromise=require(_0x7327('0x3'));var rs=require(_0x7327('0x4'));var fs=require('fs');var Redis=require(_0x7327('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7327('0x6'))(_0x7327('0x7'));var config=require(_0x7327('0x8'));var jayson=require(_0x7327('0x9'));var client=jayson['client'][_0x7327('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3825a9,_0x5b1f94,_0xd6324a){return new BPromise(function(_0x341280,_0x281c03){return client[_0x7327('0xb')](_0x3825a9,_0xd6324a)[_0x7327('0xc')](function(_0xecf3ba){logger[_0x7327('0xd')](_0x7327('0xe'),_0x5b1f94,_0x7327('0xf'));logger[_0x7327('0x10')](_0x7327('0x11'),_0x5b1f94,'request\x20sent',JSON[_0x7327('0x12')](_0xecf3ba));if(_0xecf3ba[_0x7327('0x13')]){if(_0xecf3ba[_0x7327('0x13')]['code']===0x1f4){logger['error'](_0x7327('0xe'),_0x5b1f94,_0xecf3ba[_0x7327('0x13')]['message']);return _0x281c03(_0xecf3ba['error'][_0x7327('0x14')]);}logger[_0x7327('0x13')](_0x7327('0xe'),_0x5b1f94,_0xecf3ba[_0x7327('0x13')]['message']);return _0x341280(_0xecf3ba[_0x7327('0x13')][_0x7327('0x14')]);}else{logger[_0x7327('0xd')](_0x7327('0xe'),_0x5b1f94,_0x7327('0xf'));_0x341280(_0xecf3ba[_0x7327('0x15')]['message']);}})[_0x7327('0x16')](function(_0x47fcf5){logger['error'](_0x7327('0xe'),_0x5b1f94,_0x47fcf5);_0x281c03(_0x47fcf5);});});} \ No newline at end of file +var _0xee04=['error','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xee04,0x165));var _0x4ee0=function(_0x4f9a24,_0xa0378c){_0x4f9a24=_0x4f9a24-0x0;var _0x3461c8=_0xee04[_0x4f9a24];return _0x3461c8;};'use strict';var _=require(_0x4ee0('0x0'));var util=require(_0x4ee0('0x1'));var moment=require('moment');var BPromise=require(_0x4ee0('0x2'));var rs=require(_0x4ee0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ee0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ee0('0x5'))(_0x4ee0('0x6'));var config=require('../../config/environment');var jayson=require(_0x4ee0('0x7'));var client=jayson[_0x4ee0('0x8')][_0x4ee0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526d6f,_0x1a7af4,_0x245af1){return new BPromise(function(_0x24c62e,_0xe027a3){return client[_0x4ee0('0xa')](_0x526d6f,_0x245af1)[_0x4ee0('0xb')](function(_0x5da739){logger[_0x4ee0('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x1a7af4,_0x4ee0('0xd'));logger[_0x4ee0('0xe')](_0x4ee0('0xf'),_0x1a7af4,_0x4ee0('0xd'),JSON[_0x4ee0('0x10')](_0x5da739));if(_0x5da739[_0x4ee0('0x11')]){if(_0x5da739[_0x4ee0('0x11')]['code']===0x1f4){logger[_0x4ee0('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x1a7af4,_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);return _0xe027a3(_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);}logger[_0x4ee0('0x11')](_0x4ee0('0x13'),_0x1a7af4,_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);return _0x24c62e(_0x5da739[_0x4ee0('0x11')][_0x4ee0('0x12')]);}else{logger['info'](_0x4ee0('0x13'),_0x1a7af4,_0x4ee0('0xd'));_0x24c62e(_0x5da739[_0x4ee0('0x14')][_0x4ee0('0x12')]);}})[_0x4ee0('0x15')](function(_0x25c248){logger['error'](_0x4ee0('0x13'),_0x1a7af4,_0x25c248);_0xe027a3(_0x25c248);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7a03130..a51272a 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 _0x73b7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x37dec8,_0x18d522){var _0x4d1d31=function(_0xceae09){while(--_0xceae09){_0x37dec8['push'](_0x37dec8['shift']());}};_0x4d1d31(++_0x18d522);}(_0x73b7,0x10b));var _0x773b=function(_0x3415a2,_0x1e901b){_0x3415a2=_0x3415a2-0x0;var _0x353036=_0x73b7[_0x3415a2];return _0x353036;};'use strict';var multer=require(_0x773b('0x0'));var util=require(_0x773b('0x1'));var path=require(_0x773b('0x2'));var timeout=require(_0x773b('0x3'));var express=require(_0x773b('0x4'));var router=express[_0x773b('0x5')]();var fs_extra=require(_0x773b('0x6'));var auth=require(_0x773b('0x7'));var interaction=require(_0x773b('0x8'));var config=require(_0x773b('0x9'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x773b('0xa')](),controller[_0x773b('0xb')]);router[_0x773b('0xc')](_0x773b('0xd'),auth[_0x773b('0xa')](),controller[_0x773b('0xe')]);router[_0x773b('0xf')]('/',auth['isAuthenticated'](),controller[_0x773b('0x10')]);router['put']('/:id',auth[_0x773b('0xa')](),controller[_0x773b('0x11')]);router[_0x773b('0x12')](_0x773b('0xd'),auth[_0x773b('0xa')](),controller[_0x773b('0x13')]);module[_0x773b('0x14')]=router; \ No newline at end of file +var _0x013e=['get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0x013e,0x1c2));var _0xe013=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x013e[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xe013('0x0'));var util=require(_0xe013('0x1'));var path=require(_0xe013('0x2'));var timeout=require(_0xe013('0x3'));var express=require('express');var router=express[_0xe013('0x4')]();var fs_extra=require(_0xe013('0x5'));var auth=require(_0xe013('0x6'));var interaction=require(_0xe013('0x7'));var config=require(_0xe013('0x8'));var controller=require(_0xe013('0x9'));router[_0xe013('0xa')]('/',auth[_0xe013('0xb')](),controller[_0xe013('0xc')]);router[_0xe013('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe013('0xd')]);router[_0xe013('0xe')]('/',auth[_0xe013('0xb')](),controller['create']);router[_0xe013('0xf')](_0xe013('0x10'),auth[_0xe013('0xb')](),controller[_0xe013('0x11')]);router[_0xe013('0x12')](_0xe013('0x10'),auth[_0xe013('0xb')](),controller['destroy']);module[_0xe013('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 7cf9ddc..3e337f4 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 _0xe0a3=['keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable'];(function(_0x29c342,_0x212b03){var _0x4416f7=function(_0x4df6c6){while(--_0x4df6c6){_0x29c342['push'](_0x29c342['shift']());}};_0x4416f7(++_0x212b03);}(_0xe0a3,0xb0));var _0x3e0a=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0xe0a3[_0x4a04de];return _0xbbe018;};'use strict';var Sequelize=require('sequelize');module[_0x3e0a('0x0')]={'type':{'type':Sequelize[_0x3e0a('0x1')](_0x3e0a('0x2'),'variable',_0x3e0a('0x3'),_0x3e0a('0x4'),_0x3e0a('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3e0a('0x6')]},'keyType':{'type':Sequelize[_0x3e0a('0x1')](_0x3e0a('0x2'),_0x3e0a('0x7'),_0x3e0a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3e0a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3e0a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e0a('0x6')]}}; \ No newline at end of file +var _0x75d3=['ENUM','customVariable','sequelize','exports','string','variable','picklist','STRING'];(function(_0x5b28b5,_0xbeb1eb){var _0x418cd9=function(_0x4afdbe){while(--_0x4afdbe){_0x5b28b5['push'](_0x5b28b5['shift']());}};_0x418cd9(++_0xbeb1eb);}(_0x75d3,0x1ea));var _0x375d=function(_0x481756,_0x5c4756){_0x481756=_0x481756-0x0;var _0x74c86f=_0x75d3[_0x481756];return _0x74c86f;};'use strict';var Sequelize=require(_0x375d('0x0'));module[_0x375d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x375d('0x2'),_0x375d('0x3'),'customVariable','keyValue',_0x375d('0x4')),'defaultValue':_0x375d('0x2')},'content':{'type':Sequelize[_0x375d('0x5')]},'key':{'type':Sequelize[_0x375d('0x5')]},'keyType':{'type':Sequelize[_0x375d('0x6')]('string','variable',_0x375d('0x7'))},'keyContent':{'type':Sequelize[_0x375d('0x5')]},'idField':{'type':Sequelize[_0x375d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x375d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 84b3174..b7cba4b 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 _0x07a4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','error','name','index','map','VtigerField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0x07a4,0x1ef));var _0x407a=function(_0x448be6,_0xb6213e){_0x448be6=_0x448be6-0x0;var _0x15d039=_0x07a4[_0x448be6];return _0x15d039;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x407a('0x0'));var zipdir=require(_0x407a('0x1'));var jsonpatch=require(_0x407a('0x2'));var rp=require('request-promise');var moment=require(_0x407a('0x3'));var BPromise=require(_0x407a('0x4'));var Mustache=require(_0x407a('0x5'));var util=require(_0x407a('0x6'));var path=require(_0x407a('0x7'));var sox=require(_0x407a('0x8'));var csv=require(_0x407a('0x9'));var ejs=require(_0x407a('0xa'));var fs=require('fs');var fs_extra=require(_0x407a('0xb'));var _=require(_0x407a('0xc'));var squel=require(_0x407a('0xd'));var crypto=require(_0x407a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x407a('0xf'));var toCsv=require(_0x407a('0x9'));var querystring=require('querystring');var Papa=require(_0x407a('0x10'));var Redis=require(_0x407a('0x11'));var authService=require(_0x407a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x407a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x407a('0x14'))(_0x407a('0x15'));var utils=require('../../config/utils');var config=require(_0x407a('0x16'));var licenseUtil=require(_0x407a('0x17'));var db=require(_0x407a('0x18'))['db'];function respondWithStatusCode(_0x4ae7ef,_0x53f6d6){_0x53f6d6=_0x53f6d6||0xcc;return function(_0x3f575a){if(_0x3f575a){return _0x4ae7ef[_0x407a('0x19')](_0x53f6d6);}return _0x4ae7ef['status'](_0x53f6d6)[_0x407a('0x1a')]();};}function respondWithResult(_0x324901,_0x629221){_0x629221=_0x629221||0xc8;return function(_0x5e912c){if(_0x5e912c){return _0x324901[_0x407a('0x1b')](_0x629221)[_0x407a('0x1c')](_0x5e912c);}};}function respondWithFilteredResult(_0x3081df,_0x22960d){return function(_0xd764e6){if(_0xd764e6){var _0x25cf1a=typeof _0x22960d[_0x407a('0x1d')]===_0x407a('0x1e')&&typeof _0x22960d[_0x407a('0x1f')]==='undefined';var _0x22ae07=_0xd764e6[_0x407a('0x20')];var _0x129737=_0x25cf1a?0x0:_0x22960d[_0x407a('0x1d')];var _0x175321=_0x25cf1a?_0xd764e6[_0x407a('0x20')]:_0x22960d['offset']+_0x22960d[_0x407a('0x1f')];var _0x105a66;if(_0x175321>=_0x22ae07){_0x175321=_0x22ae07;_0x105a66=0xc8;}else{_0x105a66=0xce;}_0x3081df['status'](_0x105a66);return _0x3081df['set'](_0x407a('0x21'),_0x129737+'-'+_0x175321+'/'+_0x22ae07)['json'](_0xd764e6);}return null;};}function patchUpdates(_0x14cb85){return function(_0x4c9df6){try{jsonpatch[_0x407a('0x22')](_0x4c9df6,_0x14cb85,!![]);}catch(_0x444430){return BPromise['reject'](_0x444430);}return _0x4c9df6[_0x407a('0x23')]();};}function saveUpdates(_0x231617,_0x5b3780){return function(_0x1e0c64){if(_0x1e0c64){return _0x1e0c64['update'](_0x231617)[_0x407a('0x24')](function(_0xd30ef6){return _0xd30ef6;});}return null;};}function removeEntity(_0x4bdbd0,_0x22c649){return function(_0x5cdcc9){if(_0x5cdcc9){return _0x5cdcc9['destroy']()[_0x407a('0x24')](function(){_0x4bdbd0[_0x407a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x957be2,_0x580647){return function(_0x5f2586){if(!_0x5f2586){_0x957be2[_0x407a('0x19')](0x194);}return _0x5f2586;};}function handleError(_0x1387b9,_0xde8c65){_0xde8c65=_0xde8c65||0x1f4;return function(_0x2ad01c){logger[_0x407a('0x25')](_0x2ad01c['stack']);if(_0x2ad01c[_0x407a('0x26')]){delete _0x2ad01c[_0x407a('0x26')];}_0x1387b9[_0x407a('0x1b')](_0xde8c65)['send'](_0x2ad01c);};}exports[_0x407a('0x27')]=function(_0x1062e0,_0x1baaf3){var _0x452a46={},_0x186b67={},_0x7b665a={'count':0x0,'rows':[]};var _0x167317=_[_0x407a('0x28')](db[_0x407a('0x29')]['rawAttributes'],function(_0x731bf2){return{'name':_0x731bf2[_0x407a('0x2a')],'type':_0x731bf2[_0x407a('0x2b')][_0x407a('0x2c')]};});_0x186b67['model']=_[_0x407a('0x28')](_0x167317,_0x407a('0x26'));_0x186b67[_0x407a('0x2d')]=_['keys'](_0x1062e0[_0x407a('0x2d')]);_0x186b67[_0x407a('0x2e')]=_[_0x407a('0x2f')](_0x186b67[_0x407a('0x30')],_0x186b67[_0x407a('0x2d')]);_0x452a46[_0x407a('0x31')]=_['intersection'](_0x186b67['model'],qs[_0x407a('0x32')](_0x1062e0[_0x407a('0x2d')][_0x407a('0x32')]));_0x452a46[_0x407a('0x31')]=_0x452a46[_0x407a('0x31')][_0x407a('0x33')]?_0x452a46[_0x407a('0x31')]:_0x186b67[_0x407a('0x30')];if(!_0x1062e0[_0x407a('0x2d')][_0x407a('0x34')]('nolimit')){_0x452a46[_0x407a('0x1f')]=qs[_0x407a('0x1f')](_0x1062e0[_0x407a('0x2d')][_0x407a('0x1f')]);_0x452a46[_0x407a('0x1d')]=qs['offset'](_0x1062e0['query'][_0x407a('0x1d')]);}_0x452a46[_0x407a('0x35')]=qs[_0x407a('0x36')](_0x1062e0[_0x407a('0x2d')]['sort']);_0x452a46[_0x407a('0x37')]=qs['filters'](_['pick'](_0x1062e0[_0x407a('0x2d')],_0x186b67[_0x407a('0x2e')]),_0x167317);if(_0x1062e0[_0x407a('0x2d')][_0x407a('0x38')]){_0x452a46[_0x407a('0x37')]=_[_0x407a('0x39')](_0x452a46[_0x407a('0x37')],{'$or':_['map'](_0x167317,function(_0x424be2){if(_0x424be2[_0x407a('0x2b')]!==_0x407a('0x3a')){var _0x493fc6={};_0x493fc6[_0x424be2[_0x407a('0x26')]]={'$like':'%'+_0x1062e0[_0x407a('0x2d')][_0x407a('0x38')]+'%'};return _0x493fc6;}})});}_0x452a46=_[_0x407a('0x39')]({},_0x452a46,_0x1062e0[_0x407a('0x3b')]);var _0x49a603={'where':_0x452a46[_0x407a('0x37')]};return db[_0x407a('0x29')][_0x407a('0x20')](_0x49a603)[_0x407a('0x24')](function(_0x260246){_0x7b665a['count']=_0x260246;if(_0x1062e0[_0x407a('0x2d')][_0x407a('0x3c')]){_0x452a46['include']=[{'all':!![]}];}return db[_0x407a('0x29')][_0x407a('0x3d')](_0x452a46);})[_0x407a('0x24')](function(_0x1597f4){_0x7b665a[_0x407a('0x3e')]=_0x1597f4;return _0x7b665a;})[_0x407a('0x24')](respondWithFilteredResult(_0x1baaf3,_0x452a46))[_0x407a('0x3f')](handleError(_0x1baaf3,null));};exports[_0x407a('0x40')]=function(_0x4c5bcd,_0x571aec){var _0xd67be8={'raw':!![],'where':{'id':_0x4c5bcd['params']['id']}},_0x220795={};_0x220795[_0x407a('0x30')]=_[_0x407a('0x41')](db['VtigerField'][_0x407a('0x42')]);_0x220795[_0x407a('0x2d')]=_[_0x407a('0x41')](_0x4c5bcd[_0x407a('0x2d')]);_0x220795[_0x407a('0x2e')]=_[_0x407a('0x2f')](_0x220795[_0x407a('0x30')],_0x220795[_0x407a('0x2d')]);_0xd67be8[_0x407a('0x31')]=_['intersection'](_0x220795['model'],qs[_0x407a('0x32')](_0x4c5bcd[_0x407a('0x2d')][_0x407a('0x32')]));_0xd67be8['attributes']=_0xd67be8['attributes'][_0x407a('0x33')]?_0xd67be8[_0x407a('0x31')]:_0x220795[_0x407a('0x30')];if(_0x4c5bcd['query'][_0x407a('0x3c')]){_0xd67be8[_0x407a('0x43')]=[{'all':!![]}];}_0xd67be8=_[_0x407a('0x39')]({},_0xd67be8,_0x4c5bcd[_0x407a('0x3b')]);return db['VtigerField'][_0x407a('0x44')](_0xd67be8)['then'](handleEntityNotFound(_0x571aec,null))[_0x407a('0x24')](respondWithResult(_0x571aec,null))[_0x407a('0x3f')](handleError(_0x571aec,null));};exports[_0x407a('0x45')]=function(_0x3ebd92,_0x530bfb){return db[_0x407a('0x29')][_0x407a('0x45')](_0x3ebd92[_0x407a('0x46')],{})[_0x407a('0x24')](respondWithResult(_0x530bfb,0xc9))['catch'](handleError(_0x530bfb,null));};exports['update']=function(_0x179253,_0x1c624c){if(_0x179253[_0x407a('0x46')]['id']){delete _0x179253[_0x407a('0x46')]['id'];}return db['VtigerField'][_0x407a('0x44')]({'where':{'id':_0x179253[_0x407a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c624c,null))[_0x407a('0x24')](saveUpdates(_0x179253[_0x407a('0x46')],null))['then'](respondWithResult(_0x1c624c,null))[_0x407a('0x3f')](handleError(_0x1c624c,null));};exports[_0x407a('0x48')]=function(_0x37d723,_0x3f5814){return db[_0x407a('0x29')][_0x407a('0x44')]({'where':{'id':_0x37d723['params']['id']}})[_0x407a('0x24')](handleEntityNotFound(_0x3f5814,null))[_0x407a('0x24')](removeEntity(_0x3f5814,null))['catch'](handleError(_0x3f5814,null));}; \ No newline at end of file +var _0xf23b=['reject','save','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x38cf2f,_0x4424da){var _0xdf2c17=function(_0x20c971){while(--_0x20c971){_0x38cf2f['push'](_0x38cf2f['shift']());}};_0xdf2c17(++_0x4424da);}(_0xf23b,0x1d9));var _0xbf23=function(_0x395931,_0x5ef24c){_0x395931=_0x395931-0x0;var _0x38d06d=_0xf23b[_0x395931];return _0x38d06d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf23('0x0'));var rp=require(_0xbf23('0x1'));var moment=require('moment');var BPromise=require(_0xbf23('0x2'));var Mustache=require(_0xbf23('0x3'));var util=require(_0xbf23('0x4'));var path=require('path');var sox=require(_0xbf23('0x5'));var csv=require(_0xbf23('0x6'));var ejs=require(_0xbf23('0x7'));var fs=require('fs');var fs_extra=require(_0xbf23('0x8'));var _=require(_0xbf23('0x9'));var squel=require('squel');var crypto=require(_0xbf23('0xa'));var jsforce=require(_0xbf23('0xb'));var deskjs=require(_0xbf23('0xc'));var toCsv=require(_0xbf23('0x6'));var querystring=require(_0xbf23('0xd'));var Papa=require(_0xbf23('0xe'));var Redis=require('ioredis');var authService=require(_0xbf23('0xf'));var qs=require(_0xbf23('0x10'));var as=require(_0xbf23('0x11'));var hardwareService=require(_0xbf23('0x12'));var logger=require(_0xbf23('0x13'))(_0xbf23('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbf23('0x15'))['db'];function respondWithStatusCode(_0x44ea6a,_0x3f9c06){_0x3f9c06=_0x3f9c06||0xcc;return function(_0x9e6eec){if(_0x9e6eec){return _0x44ea6a[_0xbf23('0x16')](_0x3f9c06);}return _0x44ea6a[_0xbf23('0x17')](_0x3f9c06)[_0xbf23('0x18')]();};}function respondWithResult(_0x28bc37,_0x4c0ebc){_0x4c0ebc=_0x4c0ebc||0xc8;return function(_0x26eaae){if(_0x26eaae){return _0x28bc37[_0xbf23('0x17')](_0x4c0ebc)[_0xbf23('0x19')](_0x26eaae);}};}function respondWithFilteredResult(_0x496884,_0x1c3692){return function(_0x362572){if(_0x362572){var _0x262f2b=typeof _0x1c3692[_0xbf23('0x1a')]==='undefined'&&typeof _0x1c3692['limit']===_0xbf23('0x1b');var _0xac4a50=_0x362572[_0xbf23('0x1c')];var _0x545c6b=_0x262f2b?0x0:_0x1c3692[_0xbf23('0x1a')];var _0x346bb7=_0x262f2b?_0x362572[_0xbf23('0x1c')]:_0x1c3692[_0xbf23('0x1a')]+_0x1c3692[_0xbf23('0x1d')];var _0x1fa642;if(_0x346bb7>=_0xac4a50){_0x346bb7=_0xac4a50;_0x1fa642=0xc8;}else{_0x1fa642=0xce;}_0x496884[_0xbf23('0x17')](_0x1fa642);return _0x496884[_0xbf23('0x1e')]('Content-Range',_0x545c6b+'-'+_0x346bb7+'/'+_0xac4a50)[_0xbf23('0x19')](_0x362572);}return null;};}function patchUpdates(_0x1ad61f){return function(_0x5685ae){try{jsonpatch['apply'](_0x5685ae,_0x1ad61f,!![]);}catch(_0x3d4f12){return BPromise[_0xbf23('0x1f')](_0x3d4f12);}return _0x5685ae[_0xbf23('0x20')]();};}function saveUpdates(_0x49f467,_0x545cee){return function(_0x5ee85c){if(_0x5ee85c){return _0x5ee85c[_0xbf23('0x21')](_0x49f467)['then'](function(_0x49c2a4){return _0x49c2a4;});}return null;};}function removeEntity(_0x14b445,_0x1bf888){return function(_0x184d59){if(_0x184d59){return _0x184d59[_0xbf23('0x22')]()[_0xbf23('0x23')](function(){_0x14b445[_0xbf23('0x17')](0xcc)[_0xbf23('0x18')]();});}};}function handleEntityNotFound(_0x13f6f2,_0x53990b){return function(_0x715739){if(!_0x715739){_0x13f6f2['sendStatus'](0x194);}return _0x715739;};}function handleError(_0x5b5c12,_0x5217de){_0x5217de=_0x5217de||0x1f4;return function(_0x33269){logger[_0xbf23('0x24')](_0x33269[_0xbf23('0x25')]);if(_0x33269['name']){delete _0x33269[_0xbf23('0x26')];}_0x5b5c12[_0xbf23('0x17')](_0x5217de)[_0xbf23('0x27')](_0x33269);};}exports[_0xbf23('0x28')]=function(_0xda1bcd,_0x4a2cbb){var _0x355d7f={},_0x46a2fa={},_0x31588d={'count':0x0,'rows':[]};var _0x224cc0=_[_0xbf23('0x29')](db[_0xbf23('0x2a')][_0xbf23('0x2b')],function(_0x1b3a8e){return{'name':_0x1b3a8e['fieldName'],'type':_0x1b3a8e['type'][_0xbf23('0x2c')]};});_0x46a2fa['model']=_[_0xbf23('0x29')](_0x224cc0,_0xbf23('0x26'));_0x46a2fa[_0xbf23('0x2d')]=_[_0xbf23('0x2e')](_0xda1bcd[_0xbf23('0x2d')]);_0x46a2fa[_0xbf23('0x2f')]=_[_0xbf23('0x30')](_0x46a2fa[_0xbf23('0x31')],_0x46a2fa[_0xbf23('0x2d')]);_0x355d7f[_0xbf23('0x32')]=_[_0xbf23('0x30')](_0x46a2fa[_0xbf23('0x31')],qs[_0xbf23('0x33')](_0xda1bcd[_0xbf23('0x2d')]['fields']));_0x355d7f['attributes']=_0x355d7f[_0xbf23('0x32')][_0xbf23('0x34')]?_0x355d7f['attributes']:_0x46a2fa[_0xbf23('0x31')];if(!_0xda1bcd[_0xbf23('0x2d')][_0xbf23('0x35')](_0xbf23('0x36'))){_0x355d7f[_0xbf23('0x1d')]=qs[_0xbf23('0x1d')](_0xda1bcd[_0xbf23('0x2d')][_0xbf23('0x1d')]);_0x355d7f[_0xbf23('0x1a')]=qs[_0xbf23('0x1a')](_0xda1bcd[_0xbf23('0x2d')]['offset']);}_0x355d7f['order']=qs[_0xbf23('0x37')](_0xda1bcd[_0xbf23('0x2d')]['sort']);_0x355d7f[_0xbf23('0x38')]=qs[_0xbf23('0x2f')](_[_0xbf23('0x39')](_0xda1bcd[_0xbf23('0x2d')],_0x46a2fa[_0xbf23('0x2f')]),_0x224cc0);if(_0xda1bcd['query'][_0xbf23('0x3a')]){_0x355d7f[_0xbf23('0x38')]=_['merge'](_0x355d7f[_0xbf23('0x38')],{'$or':_[_0xbf23('0x29')](_0x224cc0,function(_0x29cd22){if(_0x29cd22[_0xbf23('0x3b')]!=='VIRTUAL'){var _0x492075={};_0x492075[_0x29cd22['name']]={'$like':'%'+_0xda1bcd[_0xbf23('0x2d')][_0xbf23('0x3a')]+'%'};return _0x492075;}})});}_0x355d7f=_[_0xbf23('0x3c')]({},_0x355d7f,_0xda1bcd[_0xbf23('0x3d')]);var _0x53e83d={'where':_0x355d7f[_0xbf23('0x38')]};return db[_0xbf23('0x2a')][_0xbf23('0x1c')](_0x53e83d)['then'](function(_0x176d4e){_0x31588d[_0xbf23('0x1c')]=_0x176d4e;if(_0xda1bcd['query']['includeAll']){_0x355d7f[_0xbf23('0x3e')]=[{'all':!![]}];}return db[_0xbf23('0x2a')][_0xbf23('0x3f')](_0x355d7f);})['then'](function(_0xe26eec){_0x31588d[_0xbf23('0x40')]=_0xe26eec;return _0x31588d;})['then'](respondWithFilteredResult(_0x4a2cbb,_0x355d7f))[_0xbf23('0x41')](handleError(_0x4a2cbb,null));};exports[_0xbf23('0x42')]=function(_0x1728b9,_0x3edec8){var _0x37316c={'raw':!![],'where':{'id':_0x1728b9[_0xbf23('0x43')]['id']}},_0x152115={};_0x152115[_0xbf23('0x31')]=_[_0xbf23('0x2e')](db['VtigerField'][_0xbf23('0x2b')]);_0x152115['query']=_[_0xbf23('0x2e')](_0x1728b9['query']);_0x152115[_0xbf23('0x2f')]=_[_0xbf23('0x30')](_0x152115['model'],_0x152115[_0xbf23('0x2d')]);_0x37316c[_0xbf23('0x32')]=_['intersection'](_0x152115[_0xbf23('0x31')],qs[_0xbf23('0x33')](_0x1728b9[_0xbf23('0x2d')][_0xbf23('0x33')]));_0x37316c[_0xbf23('0x32')]=_0x37316c[_0xbf23('0x32')][_0xbf23('0x34')]?_0x37316c['attributes']:_0x152115['model'];if(_0x1728b9[_0xbf23('0x2d')][_0xbf23('0x44')]){_0x37316c[_0xbf23('0x3e')]=[{'all':!![]}];}_0x37316c=_[_0xbf23('0x3c')]({},_0x37316c,_0x1728b9['options']);return db[_0xbf23('0x2a')]['find'](_0x37316c)[_0xbf23('0x23')](handleEntityNotFound(_0x3edec8,null))[_0xbf23('0x23')](respondWithResult(_0x3edec8,null))[_0xbf23('0x41')](handleError(_0x3edec8,null));};exports[_0xbf23('0x45')]=function(_0x1c02c9,_0x49f8d2){return db['VtigerField'][_0xbf23('0x45')](_0x1c02c9[_0xbf23('0x46')],{})[_0xbf23('0x23')](respondWithResult(_0x49f8d2,0xc9))['catch'](handleError(_0x49f8d2,null));};exports[_0xbf23('0x21')]=function(_0x3990f4,_0xd6a43d){if(_0x3990f4[_0xbf23('0x46')]['id']){delete _0x3990f4['body']['id'];}return db[_0xbf23('0x2a')][_0xbf23('0x47')]({'where':{'id':_0x3990f4[_0xbf23('0x43')]['id']}})[_0xbf23('0x23')](handleEntityNotFound(_0xd6a43d,null))[_0xbf23('0x23')](saveUpdates(_0x3990f4[_0xbf23('0x46')],null))['then'](respondWithResult(_0xd6a43d,null))[_0xbf23('0x41')](handleError(_0xd6a43d,null));};exports['destroy']=function(_0x4c58b9,_0x468929){return db[_0xbf23('0x2a')][_0xbf23('0x47')]({'where':{'id':_0x4c58b9[_0xbf23('0x43')]['id']}})[_0xbf23('0x23')](handleEntityNotFound(_0x468929,null))[_0xbf23('0x23')](removeEntity(_0x468929,null))[_0xbf23('0x41')](handleError(_0x468929,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 52902ae..8f74bde 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 _0x04fc=['api','moment','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0xf5d391,_0x26e948){var _0x2cb522=function(_0x93d46f){while(--_0x93d46f){_0xf5d391['push'](_0xf5d391['shift']());}};_0x2cb522(++_0x26e948);}(_0x04fc,0xbe));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc04f('0x0'));var util=require(_0xc04f('0x1'));var logger=require('../../config/logger')(_0xc04f('0x2'));var moment=require(_0xc04f('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(_0xc04f('0x4'));var attributes=require(_0xc04f('0x5'));module[_0xc04f('0x6')]=function(_0x25ba06,_0xd84d7b){return _0x25ba06[_0xc04f('0x7')]('VtigerField',attributes,{'tableName':_0xc04f('0x8'),'paranoid':![],'indexes':[{'name':_0xc04f('0x9'),'fields':[_0xc04f('0xa'),_0xc04f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0037=['api','moment','bluebird','rimraf','../../config/environment','exports','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3ba2f6,_0x13cdb9){var _0x5bf772=function(_0x301a3f){while(--_0x301a3f){_0x3ba2f6['push'](_0x3ba2f6['shift']());}};_0x5bf772(++_0x13cdb9);}(_0x0037,0x15c));var _0x7003=function(_0x59ec8c,_0x5e0b53){_0x59ec8c=_0x59ec8c-0x0;var _0x3d0cf2=_0x0037[_0x59ec8c];return _0x3d0cf2;};'use strict';var _=require(_0x7003('0x0'));var util=require(_0x7003('0x1'));var logger=require(_0x7003('0x2'))(_0x7003('0x3'));var moment=require(_0x7003('0x4'));var BPromise=require(_0x7003('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7003('0x6'));var config=require(_0x7003('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x7003('0x8')]=function(_0x54ba2e,_0x5743d5){return _0x54ba2e['define'](_0x7003('0x9'),attributes,{'tableName':_0x7003('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x7003('0xb'),_0x7003('0xc')],'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 4cad4df..a63a929 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 _0xd420=['client','http','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x57d47a,_0xe25f3a){var _0x7a3652=function(_0x1c7c97){while(--_0x1c7c97){_0x57d47a['push'](_0x57d47a['shift']());}};_0x7a3652(++_0xe25f3a);}(_0xd420,0x1d9));var _0x0d42=function(_0x6851de,_0x1c6df7){_0x6851de=_0x6851de-0x0;var _0x228361=_0xd420[_0x6851de];return _0x228361;};'use strict';var _=require(_0x0d42('0x0'));var util=require(_0x0d42('0x1'));var moment=require('moment');var BPromise=require(_0x0d42('0x2'));var rs=require(_0x0d42('0x3'));var fs=require('fs');var Redis=require(_0x0d42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d42('0x5'));var logger=require(_0x0d42('0x6'))(_0x0d42('0x7'));var config=require(_0x0d42('0x8'));var jayson=require(_0x0d42('0x9'));var client=jayson[_0x0d42('0xa')][_0x0d42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46be19,_0x2649d5,_0x494507){return new BPromise(function(_0x3fa332,_0x55063e){return client['request'](_0x46be19,_0x494507)['then'](function(_0x54ea8b){logger['info'](_0x0d42('0xc'),_0x2649d5,_0x0d42('0xd'));logger[_0x0d42('0xe')](_0x0d42('0xf'),_0x2649d5,_0x0d42('0xd'),JSON[_0x0d42('0x10')](_0x54ea8b));if(_0x54ea8b['error']){if(_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x12')]===0x1f4){logger[_0x0d42('0x11')](_0x0d42('0xc'),_0x2649d5,_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);return _0x55063e(_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);}logger[_0x0d42('0x11')](_0x0d42('0xc'),_0x2649d5,_0x54ea8b[_0x0d42('0x11')][_0x0d42('0x13')]);return _0x3fa332(_0x54ea8b['error'][_0x0d42('0x13')]);}else{logger[_0x0d42('0x14')](_0x0d42('0xc'),_0x2649d5,_0x0d42('0xd'));_0x3fa332(_0x54ea8b['result'][_0x0d42('0x13')]);}})['catch'](function(_0x132c4e){logger[_0x0d42('0x11')]('VtigerField,\x20%s,\x20%s',_0x2649d5,_0x132c4e);_0x55063e(_0x132c4e);});});} \ No newline at end of file +var _0xfb4f=['jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x31b4b7,_0x4478c9){var _0x5e31e4=function(_0x21691c){while(--_0x21691c){_0x31b4b7['push'](_0x31b4b7['shift']());}};_0x5e31e4(++_0x4478c9);}(_0xfb4f,0x8c));var _0xffb4=function(_0x14a303,_0x2184aa){_0x14a303=_0x14a303-0x0;var _0x4e3074=_0xfb4f[_0x14a303];return _0x4e3074;};'use strict';var _=require(_0xffb4('0x0'));var util=require(_0xffb4('0x1'));var moment=require(_0xffb4('0x2'));var BPromise=require(_0xffb4('0x3'));var rs=require(_0xffb4('0x4'));var fs=require('fs');var Redis=require(_0xffb4('0x5'));var db=require(_0xffb4('0x6'))['db'];var utils=require(_0xffb4('0x7'));var logger=require('../../config/logger')(_0xffb4('0x8'));var config=require(_0xffb4('0x9'));var jayson=require(_0xffb4('0xa'));var client=jayson[_0xffb4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3204,_0x39d528,_0x49fb9a){return new BPromise(function(_0x36ac5d,_0x39ee6d){return client[_0xffb4('0xc')](_0x2a3204,_0x49fb9a)[_0xffb4('0xd')](function(_0xaee03d){logger[_0xffb4('0xe')](_0xffb4('0xf'),_0x39d528,'request\x20sent');logger[_0xffb4('0x10')](_0xffb4('0x11'),_0x39d528,_0xffb4('0x12'),JSON[_0xffb4('0x13')](_0xaee03d));if(_0xaee03d[_0xffb4('0x14')]){if(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x15')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x39d528,_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);return _0x39ee6d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0xaee03d[_0xffb4('0x14')]['message']);return _0x36ac5d(_0xaee03d[_0xffb4('0x14')][_0xffb4('0x16')]);}else{logger['info'](_0xffb4('0xf'),_0x39d528,_0xffb4('0x12'));_0x36ac5d(_0xaee03d[_0xffb4('0x17')][_0xffb4('0x16')]);}})[_0xffb4('0x18')](function(_0x862bd5){logger[_0xffb4('0x14')](_0xffb4('0xf'),_0x39d528,_0x862bd5);_0x39ee6d(_0x862bd5);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index de71fd2..92598ca 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 _0x5453=['isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','/:id','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','get','/:id/configurations'];(function(_0x303444,_0x48e416){var _0x3c73cf=function(_0x2853a0){while(--_0x2853a0){_0x303444['push'](_0x303444['shift']());}};_0x3c73cf(++_0x48e416);}(_0x5453,0x117));var _0x3545=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5453[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0x3545('0x0'));var path=require(_0x3545('0x1'));var timeout=require('connect-timeout');var express=require(_0x3545('0x2'));var router=express[_0x3545('0x3')]();var fs_extra=require(_0x3545('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3545('0x5'));var controller=require(_0x3545('0x6'));router[_0x3545('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3545('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3545('0x7')](_0x3545('0x8'),auth[_0x3545('0x9')](),controller[_0x3545('0xa')]);router[_0x3545('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3545('0xb')]);router[_0x3545('0xc')]('/',auth['isAuthenticated'](),controller[_0x3545('0xd')]);router[_0x3545('0xc')](_0x3545('0x8'),auth[_0x3545('0x9')](),controller[_0x3545('0xe')]);router['put'](_0x3545('0xf'),auth[_0x3545('0x9')](),controller['update']);router['delete'](_0x3545('0xf'),auth['isAuthenticated'](),controller[_0x3545('0x10')]);module[_0x3545('0x11')]=router; \ No newline at end of file +var _0x883f=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x2a12c1,_0x20dd3d){var _0xd296c4=function(_0x2e5e6e){while(--_0x2e5e6e){_0x2a12c1['push'](_0x2a12c1['shift']());}};_0xd296c4(++_0x20dd3d);}(_0x883f,0xb3));var _0xf883=function(_0x10a19a,_0x1a45ec){_0x10a19a=_0x10a19a-0x0;var _0x3f7183=_0x883f[_0x10a19a];return _0x3f7183;};'use strict';var multer=require('multer');var util=require(_0xf883('0x0'));var path=require(_0xf883('0x1'));var timeout=require(_0xf883('0x2'));var express=require(_0xf883('0x3'));var router=express[_0xf883('0x4')]();var fs_extra=require(_0xf883('0x5'));var auth=require(_0xf883('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf883('0x7'));var controller=require(_0xf883('0x8'));router[_0xf883('0x9')]('/',auth[_0xf883('0xa')](),controller[_0xf883('0xb')]);router['get'](_0xf883('0xc'),auth['isAuthenticated'](),controller[_0xf883('0xd')]);router[_0xf883('0x9')](_0xf883('0xe'),auth[_0xf883('0xa')](),controller[_0xf883('0xf')]);router[_0xf883('0x9')](_0xf883('0x10'),auth['isAuthenticated'](),controller[_0xf883('0x11')]);router[_0xf883('0x12')]('/',auth[_0xf883('0xa')](),controller['create']);router['post'](_0xf883('0xe'),auth[_0xf883('0xa')](),controller[_0xf883('0x13')]);router[_0xf883('0x14')]('/:id',auth[_0xf883('0xa')](),controller[_0xf883('0x15')]);router[_0xf883('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf883('0x17')]);module[_0xf883('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index eb3816a..baadb3b 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 _0x1d11=['STRING','username','remoteUri','ENUM','token','integrationTab','sequelize','exports'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x1d11,0xb6));var _0x11d1=function(_0x225a65,_0x106e43){_0x225a65=_0x225a65-0x0;var _0x240f37=_0x1d11[_0x225a65];return _0x240f37;};'use strict';var Sequelize=require(_0x11d1('0x0'));module[_0x11d1('0x1')]={'name':{'type':Sequelize[_0x11d1('0x2')]},'description':{'type':Sequelize[_0x11d1('0x2')]},'username':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x3')},'password':{'type':Sequelize[_0x11d1('0x2')]},'token':{'type':Sequelize[_0x11d1('0x2')]},'remoteUri':{'type':Sequelize[_0x11d1('0x2')],'unique':_0x11d1('0x4')},'authType':{'type':Sequelize[_0x11d1('0x5')]('password',_0x11d1('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x11d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x11d1('0x5')]('integrationTab','newTab'),'defaultValue':_0x11d1('0x7')}}; \ No newline at end of file +var _0x398a=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x476c3a,_0x4a43e9){var _0xcede4f=function(_0x23d27d){while(--_0x23d27d){_0x476c3a['push'](_0x476c3a['shift']());}};_0xcede4f(++_0x4a43e9);}(_0x398a,0x11a));var _0xa398=function(_0x2ee34a,_0x2f6182){_0x2ee34a=_0x2ee34a-0x0;var _0x2f411f=_0x398a[_0x2ee34a];return _0x2f411f;};'use strict';var Sequelize=require(_0xa398('0x0'));module[_0xa398('0x1')]={'name':{'type':Sequelize[_0xa398('0x2')]},'description':{'type':Sequelize[_0xa398('0x2')]},'username':{'type':Sequelize[_0xa398('0x2')],'unique':_0xa398('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa398('0x4')},'authType':{'type':Sequelize[_0xa398('0x5')](_0xa398('0x6'),_0xa398('0x7')),'defaultValue':_0xa398('0x6')},'serverUrl':{'type':Sequelize[_0xa398('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa398('0x5')](_0xa398('0x8'),_0xa398('0x9')),'defaultValue':_0xa398('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 183764e..7be6a15 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 _0x282b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','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/environment','../../components/integrations/configuration','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','update','then','stack','name','index','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','map','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials'];(function(_0x1f9968,_0x2fb30f){var _0x525de7=function(_0x3778a6){while(--_0x3778a6){_0x1f9968['push'](_0x1f9968['shift']());}};_0x525de7(++_0x2fb30f);}(_0x282b,0xec));var _0xb282=function(_0xd0dd59,_0x1594bd){_0xd0dd59=_0xd0dd59-0x0;var _0x4c0635=_0x282b[_0xd0dd59];return _0x4c0635;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xb282('0x17'));function respondWithStatusCode(_0xc08746,_0x40d7b8){_0x40d7b8=_0x40d7b8||0xcc;return function(_0x9e9072){if(_0x9e9072){return _0xc08746[_0xb282('0x18')](_0x40d7b8);}return _0xc08746['status'](_0x40d7b8)[_0xb282('0x19')]();};}function respondWithResult(_0x5adf7f,_0xe1d53){_0xe1d53=_0xe1d53||0xc8;return function(_0x211862){if(_0x211862){return _0x5adf7f['status'](_0xe1d53)['json'](_0x211862);}};}function respondWithFilteredResult(_0x5bc7c3,_0x13cea1){return function(_0x350676){if(_0x350676){var _0x7c20df=typeof _0x13cea1[_0xb282('0x1a')]===_0xb282('0x1b')&&typeof _0x13cea1['limit']===_0xb282('0x1b');var _0x5519bf=_0x350676[_0xb282('0x1c')];var _0x45b070=_0x7c20df?0x0:_0x13cea1[_0xb282('0x1a')];var _0x492d20=_0x7c20df?_0x350676['count']:_0x13cea1[_0xb282('0x1a')]+_0x13cea1[_0xb282('0x1d')];var _0x599f9e;if(_0x492d20>=_0x5519bf){_0x492d20=_0x5519bf;_0x599f9e=0xc8;}else{_0x599f9e=0xce;}_0x5bc7c3[_0xb282('0x1e')](_0x599f9e);return _0x5bc7c3[_0xb282('0x1f')](_0xb282('0x20'),_0x45b070+'-'+_0x492d20+'/'+_0x5519bf)[_0xb282('0x21')](_0x350676);}return null;};}function patchUpdates(_0x1c3084){return function(_0x533147){try{jsonpatch[_0xb282('0x22')](_0x533147,_0x1c3084,!![]);}catch(_0x16a656){return BPromise[_0xb282('0x23')](_0x16a656);}return _0x533147['save']();};}function saveUpdates(_0x437d66,_0x2a7ef8){return function(_0x3c55ad){if(_0x3c55ad){return _0x3c55ad[_0xb282('0x24')](_0x437d66)[_0xb282('0x25')](function(_0x56645f){return _0x56645f;});}return null;};}function removeEntity(_0x4d624f,_0x360f15){return function(_0x3c7f1f){if(_0x3c7f1f){return _0x3c7f1f['destroy']()['then'](function(){_0x4d624f[_0xb282('0x1e')](0xcc)[_0xb282('0x19')]();});}};}function handleEntityNotFound(_0x3451e5,_0x3c4018){return function(_0x211cc1){if(!_0x211cc1){_0x3451e5[_0xb282('0x18')](0x194);}return _0x211cc1;};}function handleError(_0x5b1d3d,_0xa0d7fb){_0xa0d7fb=_0xa0d7fb||0x1f4;return function(_0x42015c){logger['error'](_0x42015c[_0xb282('0x26')]);if(_0x42015c[_0xb282('0x27')]){delete _0x42015c[_0xb282('0x27')];}_0x5b1d3d[_0xb282('0x1e')](_0xa0d7fb)['send'](_0x42015c);};}exports[_0xb282('0x28')]=function(_0x1fb89f,_0xe337b8){var _0x433ad5={},_0x4cee93={},_0xfddd2e={'count':0x0,'rows':[]};var _0x22f657=_['map'](db[_0xb282('0x29')][_0xb282('0x2a')],function(_0x3eb294){return{'name':_0x3eb294[_0xb282('0x2b')],'type':_0x3eb294[_0xb282('0x2c')]['key']};});_0x4cee93[_0xb282('0x2d')]=_['map'](_0x22f657,_0xb282('0x27'));_0x4cee93[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1fb89f['query']);_0x4cee93[_0xb282('0x30')]=_['intersection'](_0x4cee93[_0xb282('0x2d')],_0x4cee93[_0xb282('0x2e')]);_0x433ad5[_0xb282('0x31')]=_[_0xb282('0x32')](_0x4cee93[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x1fb89f['query'][_0xb282('0x33')]));_0x433ad5[_0xb282('0x31')]=_0x433ad5['attributes']['length']?_0x433ad5[_0xb282('0x31')]:_0x4cee93[_0xb282('0x2d')];if(!_0x1fb89f[_0xb282('0x2e')]['hasOwnProperty']('nolimit')){_0x433ad5['limit']=qs[_0xb282('0x1d')](_0x1fb89f[_0xb282('0x2e')][_0xb282('0x1d')]);_0x433ad5[_0xb282('0x1a')]=qs[_0xb282('0x1a')](_0x1fb89f[_0xb282('0x2e')][_0xb282('0x1a')]);}_0x433ad5['order']=qs[_0xb282('0x34')](_0x1fb89f['query'][_0xb282('0x34')]);_0x433ad5[_0xb282('0x35')]=qs[_0xb282('0x30')](_['pick'](_0x1fb89f[_0xb282('0x2e')],_0x4cee93['filters']),_0x22f657);if(_0x1fb89f[_0xb282('0x2e')][_0xb282('0x36')]){_0x433ad5[_0xb282('0x35')]=_[_0xb282('0x37')](_0x433ad5['where'],{'$or':_['map'](_0x22f657,function(_0x397fa1){if(_0x397fa1[_0xb282('0x2c')]!==_0xb282('0x38')){var _0x20d56c={};_0x20d56c[_0x397fa1['name']]={'$like':'%'+_0x1fb89f[_0xb282('0x2e')]['filter']+'%'};return _0x20d56c;}})});}_0x433ad5=_[_0xb282('0x37')]({},_0x433ad5,_0x1fb89f[_0xb282('0x39')]);var _0x482ff9={'where':_0x433ad5[_0xb282('0x35')]};return db[_0xb282('0x29')][_0xb282('0x1c')](_0x482ff9)[_0xb282('0x25')](function(_0x3c1e6c){_0xfddd2e[_0xb282('0x1c')]=_0x3c1e6c;if(_0x1fb89f[_0xb282('0x2e')][_0xb282('0x3a')]){_0x433ad5[_0xb282('0x3b')]=[{'all':!![]}];}return db[_0xb282('0x29')][_0xb282('0x3c')](_0x433ad5);})[_0xb282('0x25')](function(_0x1caff0){_0xfddd2e[_0xb282('0x3d')]=_0x1caff0;return _0xfddd2e;})[_0xb282('0x25')](respondWithFilteredResult(_0xe337b8,_0x433ad5))[_0xb282('0x3e')](handleError(_0xe337b8,null));};exports[_0xb282('0x3f')]=function(_0x7332d2,_0x573da7){var _0x310ad1={'raw':![],'where':{'id':_0x7332d2[_0xb282('0x40')]['id']}},_0x58109a={};_0x58109a[_0xb282('0x2d')]=_[_0xb282('0x2f')](db[_0xb282('0x29')][_0xb282('0x2a')]);_0x58109a[_0xb282('0x2e')]=_['keys'](_0x7332d2['query']);_0x58109a[_0xb282('0x30')]=_['intersection'](_0x58109a[_0xb282('0x2d')],_0x58109a[_0xb282('0x2e')]);_0x310ad1['attributes']=_[_0xb282('0x32')](_0x58109a[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x7332d2['query']['fields']));_0x310ad1[_0xb282('0x31')]=_0x310ad1['attributes'][_0xb282('0x41')]?_0x310ad1[_0xb282('0x31')]:_0x58109a[_0xb282('0x2d')];if(_0x7332d2[_0xb282('0x2e')][_0xb282('0x3a')]){_0x310ad1[_0xb282('0x3b')]=[{'all':!![]}];}_0x310ad1=_['merge']({},_0x310ad1,_0x7332d2[_0xb282('0x39')]);return db[_0xb282('0x29')][_0xb282('0x42')](_0x310ad1)['then'](handleEntityNotFound(_0x573da7,null))[_0xb282('0x25')](respondWithResult(_0x573da7,null))['catch'](handleError(_0x573da7,null));};exports[_0xb282('0x43')]=function(_0x4b0822,_0x1bf51c){return db['ZendeskAccount']['create'](_0x4b0822['body'],{})[_0xb282('0x25')](respondWithResult(_0x1bf51c,0xc9))[_0xb282('0x3e')](handleError(_0x1bf51c,null));};exports[_0xb282('0x24')]=function(_0x7a5aa4,_0x4a2d0e){if(_0x7a5aa4['body']['id']){delete _0x7a5aa4['body']['id'];}return db[_0xb282('0x29')][_0xb282('0x42')]({'where':{'id':_0x7a5aa4[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x4a2d0e,null))['then'](saveUpdates(_0x7a5aa4[_0xb282('0x44')],null))[_0xb282('0x25')](respondWithResult(_0x4a2d0e,null))['catch'](handleError(_0x4a2d0e,null));};exports[_0xb282('0x45')]=function(_0x9f4d79,_0x16f66b){return db[_0xb282('0x29')][_0xb282('0x42')]({'where':{'id':_0x9f4d79['params']['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x16f66b,null))[_0xb282('0x25')](removeEntity(_0x16f66b,null))[_0xb282('0x3e')](handleError(_0x16f66b,null));};exports[_0xb282('0x46')]=function(_0x308aa8,_0x112d4d,_0x4cde65){var _0x87d777={};var _0x574653={};var _0x4554f1;var _0x1e6ade;return db['ZendeskAccount'][_0xb282('0x47')]({'where':{'id':_0x308aa8[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x112d4d,null))['then'](function(_0x51cbb0){if(_0x51cbb0){_0x4554f1=_0x51cbb0;_0x574653[_0xb282('0x2d')]=_[_0xb282('0x2f')](db[_0xb282('0x48')]['rawAttributes']);_0x574653[_0xb282('0x2e')]=_['keys'](_0x308aa8[_0xb282('0x2e')]);_0x574653[_0xb282('0x30')]=_['intersection'](_0x574653[_0xb282('0x2d')],_0x574653['query']);_0x87d777[_0xb282('0x31')]=_[_0xb282('0x32')](_0x574653[_0xb282('0x2d')],qs[_0xb282('0x33')](_0x308aa8[_0xb282('0x2e')][_0xb282('0x33')]));_0x87d777['attributes']=_0x87d777[_0xb282('0x31')]['length']?_0x87d777[_0xb282('0x31')]:_0x574653[_0xb282('0x2d')];_0x87d777['order']=qs['sort'](_0x308aa8[_0xb282('0x2e')][_0xb282('0x34')]);_0x87d777[_0xb282('0x35')]=qs['filters'](_['pick'](_0x308aa8[_0xb282('0x2e')],_0x574653[_0xb282('0x30')]));if(_0x308aa8[_0xb282('0x2e')]['filter']){_0x87d777[_0xb282('0x35')]=_['merge'](_0x87d777[_0xb282('0x35')],{'$or':_[_0xb282('0x49')](_0x87d777[_0xb282('0x31')],function(_0x27bac8){var _0x178b6a={};_0x178b6a[_0x27bac8]={'$like':'%'+_0x308aa8[_0xb282('0x2e')][_0xb282('0x36')]+'%'};return _0x178b6a;})});}_0x87d777=_['merge']({},_0x87d777,_0x308aa8[_0xb282('0x39')]);return _0x4554f1[_0xb282('0x46')](_0x87d777);}})[_0xb282('0x25')](function(_0x58116b){if(_0x58116b){_0x1e6ade=_0x58116b['length'];if(!_0x308aa8[_0xb282('0x2e')][_0xb282('0x4a')](_0xb282('0x4b'))){_0x87d777['limit']=qs['limit'](_0x308aa8[_0xb282('0x2e')][_0xb282('0x1d')]);_0x87d777['offset']=qs[_0xb282('0x1a')](_0x308aa8[_0xb282('0x2e')][_0xb282('0x1a')]);}return _0x4554f1['getConfigurations'](_0x87d777);}})[_0xb282('0x25')](function(_0x2fb4e4){if(_0x2fb4e4){return _0x2fb4e4?{'count':_0x1e6ade,'rows':_0x2fb4e4}:null;}})['then'](respondWithResult(_0x112d4d,null))[_0xb282('0x3e')](handleError(_0x112d4d,null));};exports[_0xb282('0x4c')]=function(_0x33b5ec,_0x26c9a6,_0x4ea7a6){if(_0x33b5ec['body']['id']){delete _0x33b5ec[_0xb282('0x44')]['id'];}return db[_0xb282('0x29')]['findOne']({'where':{'id':_0x33b5ec[_0xb282('0x40')]['id']}})[_0xb282('0x25')](handleEntityNotFound(_0x26c9a6,null))[_0xb282('0x25')](function(_0x364b77){if(_0x364b77){_0x33b5ec[_0xb282('0x44')][_0xb282('0x4d')]=_0x364b77['id'];_0x33b5ec[_0xb282('0x44')][_0xb282('0x4e')]=integrations['getSubjects'](_0x33b5ec[_0xb282('0x44')][_0xb282('0x4f')],_0x33b5ec[_0xb282('0x44')]['type']);_0x33b5ec[_0xb282('0x44')][_0xb282('0x50')]=integrations['getDescriptions'](_0x33b5ec['body'][_0xb282('0x4f')],_0x33b5ec[_0xb282('0x44')][_0xb282('0x2c')]);return db[_0xb282('0x48')][_0xb282('0x43')](_0x33b5ec[_0xb282('0x44')],{'include':[{'model':db[_0xb282('0x51')],'as':_0xb282('0x4e')},{'model':db[_0xb282('0x51')],'as':_0xb282('0x50')}]});}return null;})[_0xb282('0x25')](respondWithResult(_0x26c9a6,null))[_0xb282('0x3e')](handleError(_0x26c9a6,null));};exports[_0xb282('0x52')]=function(_0x2eae62,_0x3c1579,_0x3a87ce){var _0x4ccef5='';return db[_0xb282('0x29')][_0xb282('0x47')]({'where':{'id':_0x2eae62[_0xb282('0x40')]['id']},'attributes':['id',_0xb282('0x53'),_0xb282('0x54'),_0xb282('0x55'),_0xb282('0x56'),_0xb282('0x57')]})[_0xb282('0x25')](handleEntityNotFound(_0x3c1579,null))[_0xb282('0x25')](function(_0x21b3f6){if(_0x21b3f6){_0x4ccef5=_0x21b3f6['remoteUri'];var _0x10bed7=_0x4ccef5[_0xb282('0x58')](-0x1);if(_0x10bed7==='/'){_0x4ccef5=_0x4ccef5[_0xb282('0x59')](0x0,_0x4ccef5[_0xb282('0x5a')](_0x10bed7));}var _0x1e5c3a={'method':'GET','uri':util['format'](_0xb282('0x5b'),_0x4ccef5,_0xb282('0x5c')),'json':!![]};switch(_0x21b3f6[_0xb282('0x56')]){case _0xb282('0x54'):_0x1e5c3a[_0xb282('0x5d')]={'Authorization':util[_0xb282('0x5e')](_0xb282('0x5f'),new Buffer(util['format']('%s:%s',_0x21b3f6[_0xb282('0x53')],_0x21b3f6[_0xb282('0x54')]))['toString']('base64'))};break;case _0xb282('0x55'):_0x1e5c3a[_0xb282('0x5d')]={'Authorization':util[_0xb282('0x5e')](_0xb282('0x5f'),new Buffer(util[_0xb282('0x5e')](_0xb282('0x60'),_0x21b3f6[_0xb282('0x53')],_0x21b3f6['token']))[_0xb282('0x61')](_0xb282('0x62')))};break;default:throw new db[(_0xb282('0x63'))][(_0xb282('0x64'))](_0xb282('0x65'));}return rp(_0x1e5c3a);}})[_0xb282('0x25')](function(_0x11f255){if(_0x11f255){var _0x3c37e0=[_0xb282('0x66'),_0xb282('0x67'),'group',_0xb282('0x68')];_[_0xb282('0x69')](_0x11f255[_0xb282('0x5c')],function(_0x227e66){return _0x3c37e0[_0xb282('0x6a')](_0x227e66[_0xb282('0x2c')]);});return{'count':_0x11f255[_0xb282('0x5c')][_0xb282('0x41')],'rows':_['map'](_0x11f255[_0xb282('0x5c')],function(_0x400f2a){return{'id':_0x400f2a['id'],'name':_0x400f2a[_0xb282('0x6b')]>0x7?_0x400f2a[_0xb282('0x6c')]:_0x400f2a[_0xb282('0x2c')],'custom':_0x400f2a[_0xb282('0x6b')]>0x7?!![]:![],'options':_0x400f2a['system_field_options']?_0x400f2a[_0xb282('0x6d')]:_0x400f2a[_0xb282('0x6e')]?_0x400f2a[_0xb282('0x6e')]:[]};})};}})['then'](respondWithResult(_0x3c1579,null))[_0xb282('0x3e')](function(_0x28677e){var _0x4e894e=_0x2eae62[_0xb282('0x2e')][_0xb282('0x6f')]?0x1f4:_0x28677e[_0xb282('0x70')]||0x1f4;logger[_0xb282('0x71')](_0xb282('0x72'),_0xb282('0x52'),_0x4e894e,JSON[_0xb282('0x73')](_0x28677e));delete _0x28677e['name'];if(_0x4e894e===0x191){_0x4e894e=0x190;}_0x3c1579['status'](_0x4e894e)[_0xb282('0x74')](_0x2eae62['query'][_0xb282('0x6f')]?{'message':_0xb282('0x75'),'statusCode':_0x28677e[_0xb282('0x70')]}:_0x28677e);});}; \ No newline at end of file +var _0xae60=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','position','title','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x203e08,_0x15d5c5){var _0x3a0493=function(_0x272f51){while(--_0x272f51){_0x203e08['push'](_0x203e08['shift']());}};_0x3a0493(++_0x15d5c5);}(_0xae60,0x1c7));var _0x0ae6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xae60[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];var integrations=require(_0x0ae6('0x1c'));function respondWithStatusCode(_0x30f8f9,_0x1aefd5){_0x1aefd5=_0x1aefd5||0xcc;return function(_0xf86cad){if(_0xf86cad){return _0x30f8f9[_0x0ae6('0x1d')](_0x1aefd5);}return _0x30f8f9[_0x0ae6('0x1e')](_0x1aefd5)['end']();};}function respondWithResult(_0x3809c6,_0x10c3bc){_0x10c3bc=_0x10c3bc||0xc8;return function(_0x1c997a){if(_0x1c997a){return _0x3809c6[_0x0ae6('0x1e')](_0x10c3bc)[_0x0ae6('0x1f')](_0x1c997a);}};}function respondWithFilteredResult(_0x3a1e26,_0x151144){return function(_0x3b64ac){if(_0x3b64ac){var _0xa797bb=typeof _0x151144[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x151144[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xd0362c=_0x3b64ac[_0x0ae6('0x23')];var _0x3f5c41=_0xa797bb?0x0:_0x151144[_0x0ae6('0x20')];var _0x1735ba=_0xa797bb?_0x3b64ac[_0x0ae6('0x23')]:_0x151144[_0x0ae6('0x20')]+_0x151144[_0x0ae6('0x22')];var _0x191eaf;if(_0x1735ba>=_0xd0362c){_0x1735ba=_0xd0362c;_0x191eaf=0xc8;}else{_0x191eaf=0xce;}_0x3a1e26['status'](_0x191eaf);return _0x3a1e26[_0x0ae6('0x24')](_0x0ae6('0x25'),_0x3f5c41+'-'+_0x1735ba+'/'+_0xd0362c)[_0x0ae6('0x1f')](_0x3b64ac);}return null;};}function patchUpdates(_0x1027c2){return function(_0x9c4075){try{jsonpatch[_0x0ae6('0x26')](_0x9c4075,_0x1027c2,!![]);}catch(_0x210ca4){return BPromise[_0x0ae6('0x27')](_0x210ca4);}return _0x9c4075['save']();};}function saveUpdates(_0x39b22e,_0x2a6484){return function(_0x2e86e8){if(_0x2e86e8){return _0x2e86e8[_0x0ae6('0x28')](_0x39b22e)[_0x0ae6('0x29')](function(_0x4eba72){return _0x4eba72;});}return null;};}function removeEntity(_0x296a9d,_0x4e1242){return function(_0xccd1c5){if(_0xccd1c5){return _0xccd1c5[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x296a9d[_0x0ae6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3630e6,_0x2dcdb7){return function(_0x519f17){if(!_0x519f17){_0x3630e6['sendStatus'](0x194);}return _0x519f17;};}function handleError(_0x44eb95,_0x3255a7){_0x3255a7=_0x3255a7||0x1f4;return function(_0x17360e){logger['error'](_0x17360e[_0x0ae6('0x2b')]);if(_0x17360e[_0x0ae6('0x2c')]){delete _0x17360e[_0x0ae6('0x2c')];}_0x44eb95['status'](_0x3255a7)[_0x0ae6('0x2d')](_0x17360e);};}exports[_0x0ae6('0x2e')]=function(_0x449c33,_0x232fbd){var _0x14eed5={},_0x257af5={},_0x4fc7bd={'count':0x0,'rows':[]};var _0x5b2ad6=_[_0x0ae6('0x2f')](db[_0x0ae6('0x30')]['rawAttributes'],function(_0x4a06f1){return{'name':_0x4a06f1[_0x0ae6('0x31')],'type':_0x4a06f1[_0x0ae6('0x32')][_0x0ae6('0x33')]};});_0x257af5[_0x0ae6('0x34')]=_['map'](_0x5b2ad6,_0x0ae6('0x2c'));_0x257af5[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x449c33['query']);_0x257af5[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],_0x257af5[_0x0ae6('0x35')]);_0x14eed5[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x14eed5['attributes']=_0x14eed5[_0x0ae6('0x39')][_0x0ae6('0x3b')]?_0x14eed5['attributes']:_0x257af5[_0x0ae6('0x34')];if(!_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3c')]('nolimit')){_0x14eed5[_0x0ae6('0x22')]=qs['limit'](_0x449c33['query'][_0x0ae6('0x22')]);_0x14eed5[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x20')]);}_0x14eed5['order']=qs['sort'](_0x449c33[_0x0ae6('0x35')]['sort']);_0x14eed5[_0x0ae6('0x3d')]=qs['filters'](_[_0x0ae6('0x3e')](_0x449c33['query'],_0x257af5[_0x0ae6('0x37')]),_0x5b2ad6);if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x14eed5[_0x0ae6('0x3d')]=_['merge'](_0x14eed5['where'],{'$or':_[_0x0ae6('0x2f')](_0x5b2ad6,function(_0x34b547){if(_0x34b547[_0x0ae6('0x32')]!=='VIRTUAL'){var _0xaeb354={};_0xaeb354[_0x34b547['name']]={'$like':'%'+_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]+'%'};return _0xaeb354;}})});}_0x14eed5=_[_0x0ae6('0x40')]({},_0x14eed5,_0x449c33[_0x0ae6('0x41')]);var _0x450f00={'where':_0x14eed5[_0x0ae6('0x3d')]};return db['ZendeskAccount'][_0x0ae6('0x23')](_0x450f00)[_0x0ae6('0x29')](function(_0x24d9ec){_0x4fc7bd[_0x0ae6('0x23')]=_0x24d9ec;if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0x14eed5[_0x0ae6('0x43')]=[{'all':!![]}];}return db[_0x0ae6('0x30')]['findAll'](_0x14eed5);})[_0x0ae6('0x29')](function(_0xba3183){_0x4fc7bd[_0x0ae6('0x44')]=_0xba3183;return _0x4fc7bd;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x232fbd,_0x14eed5))[_0x0ae6('0x45')](handleError(_0x232fbd,null));};exports[_0x0ae6('0x46')]=function(_0x24c021,_0x21431e){var _0xb38cbb={'raw':![],'where':{'id':_0x24c021[_0x0ae6('0x47')]['id']}},_0x156841={};_0x156841[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x30')][_0x0ae6('0x48')]);_0x156841[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x24c021[_0x0ae6('0x35')]);_0x156841['filters']=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],_0x156841[_0x0ae6('0x35')]);_0xb38cbb[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],qs['fields'](_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0xb38cbb[_0x0ae6('0x39')]=_0xb38cbb[_0x0ae6('0x39')]['length']?_0xb38cbb['attributes']:_0x156841['model'];if(_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0xb38cbb[_0x0ae6('0x43')]=[{'all':!![]}];}_0xb38cbb=_['merge']({},_0xb38cbb,_0x24c021[_0x0ae6('0x41')]);return db[_0x0ae6('0x30')]['find'](_0xb38cbb)[_0x0ae6('0x29')](handleEntityNotFound(_0x21431e,null))[_0x0ae6('0x29')](respondWithResult(_0x21431e,null))['catch'](handleError(_0x21431e,null));};exports[_0x0ae6('0x49')]=function(_0x3d1e75,_0x587ab4){return db[_0x0ae6('0x30')][_0x0ae6('0x49')](_0x3d1e75[_0x0ae6('0x4a')],{})['then'](respondWithResult(_0x587ab4,0xc9))[_0x0ae6('0x45')](handleError(_0x587ab4,null));};exports[_0x0ae6('0x28')]=function(_0x46075a,_0x3b1af0){if(_0x46075a[_0x0ae6('0x4a')]['id']){delete _0x46075a[_0x0ae6('0x4a')]['id'];}return db[_0x0ae6('0x30')]['find']({'where':{'id':_0x46075a['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x3b1af0,null))[_0x0ae6('0x29')](saveUpdates(_0x46075a[_0x0ae6('0x4a')],null))['then'](respondWithResult(_0x3b1af0,null))[_0x0ae6('0x45')](handleError(_0x3b1af0,null));};exports['destroy']=function(_0x582a5e,_0x23454a){return db[_0x0ae6('0x30')][_0x0ae6('0x4b')]({'where':{'id':_0x582a5e['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x23454a,null))[_0x0ae6('0x29')](removeEntity(_0x23454a,null))[_0x0ae6('0x45')](handleError(_0x23454a,null));};exports[_0x0ae6('0x4c')]=function(_0x173acd,_0x2e5ea6,_0x9a64b8){var _0x36be39={};var _0x102573={};var _0x117d24;var _0x1cc515;return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x173acd[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2e5ea6,null))['then'](function(_0x4cbe19){if(_0x4cbe19){_0x117d24=_0x4cbe19;_0x102573[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x4e')][_0x0ae6('0x48')]);_0x102573[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x173acd[_0x0ae6('0x35')]);_0x102573[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],_0x102573[_0x0ae6('0x35')]);_0x36be39[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x36be39[_0x0ae6('0x39')]=_0x36be39['attributes'][_0x0ae6('0x3b')]?_0x36be39[_0x0ae6('0x39')]:_0x102573[_0x0ae6('0x34')];_0x36be39[_0x0ae6('0x4f')]=qs[_0x0ae6('0x50')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x50')]);_0x36be39[_0x0ae6('0x3d')]=qs[_0x0ae6('0x37')](_[_0x0ae6('0x3e')](_0x173acd['query'],_0x102573[_0x0ae6('0x37')]));if(_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x36be39[_0x0ae6('0x3d')]=_[_0x0ae6('0x40')](_0x36be39[_0x0ae6('0x3d')],{'$or':_[_0x0ae6('0x2f')](_0x36be39[_0x0ae6('0x39')],function(_0x1cbada){var _0x59acf0={};_0x59acf0[_0x1cbada]={'$like':'%'+_0x173acd['query'][_0x0ae6('0x3f')]+'%'};return _0x59acf0;})});}_0x36be39=_[_0x0ae6('0x40')]({},_0x36be39,_0x173acd['options']);return _0x117d24['getConfigurations'](_0x36be39);}})[_0x0ae6('0x29')](function(_0x160dcf){if(_0x160dcf){_0x1cc515=_0x160dcf[_0x0ae6('0x3b')];if(!_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3c')](_0x0ae6('0x51'))){_0x36be39[_0x0ae6('0x22')]=qs['limit'](_0x173acd[_0x0ae6('0x35')]['limit']);_0x36be39[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x173acd['query'][_0x0ae6('0x20')]);}return _0x117d24[_0x0ae6('0x4c')](_0x36be39);}})[_0x0ae6('0x29')](function(_0x593667){if(_0x593667){return _0x593667?{'count':_0x1cc515,'rows':_0x593667}:null;}})[_0x0ae6('0x29')](respondWithResult(_0x2e5ea6,null))['catch'](handleError(_0x2e5ea6,null));};exports[_0x0ae6('0x52')]=function(_0x2e0a75,_0x19f63f,_0x12c43d){if(_0x2e0a75['body']['id']){delete _0x2e0a75['body']['id'];}return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x2e0a75[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x19f63f,null))[_0x0ae6('0x29')](function(_0x2d9f33){if(_0x2d9f33){_0x2e0a75['body']['AccountId']=_0x2d9f33['id'];_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x53')]=integrations[_0x0ae6('0x54')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);_0x2e0a75[_0x0ae6('0x4a')]['Descriptions']=integrations[_0x0ae6('0x56')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);return db[_0x0ae6('0x4e')]['create'](_0x2e0a75['body'],{'include':[{'model':db[_0x0ae6('0x57')],'as':_0x0ae6('0x53')},{'model':db['ZendeskField'],'as':_0x0ae6('0x58')}]});}return null;})[_0x0ae6('0x29')](respondWithResult(_0x19f63f,null))[_0x0ae6('0x45')](handleError(_0x19f63f,null));};exports[_0x0ae6('0x59')]=function(_0x5cd03b,_0x2d9ec4,_0x243e86){var _0x42470='';return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x5cd03b[_0x0ae6('0x47')]['id']},'attributes':['id',_0x0ae6('0x5a'),_0x0ae6('0x5b'),'token',_0x0ae6('0x5c'),_0x0ae6('0x5d')]})[_0x0ae6('0x29')](handleEntityNotFound(_0x2d9ec4,null))[_0x0ae6('0x29')](function(_0x206021){if(_0x206021){_0x42470=_0x206021[_0x0ae6('0x5d')];var _0x20032f=_0x42470[_0x0ae6('0x5e')](-0x1);if(_0x20032f==='/'){_0x42470=_0x42470[_0x0ae6('0x5f')](0x0,_0x42470[_0x0ae6('0x60')](_0x20032f));}var _0x3db11f={'method':_0x0ae6('0x61'),'uri':util[_0x0ae6('0x62')](_0x0ae6('0x63'),_0x42470,_0x0ae6('0x64')),'json':!![]};switch(_0x206021[_0x0ae6('0x5c')]){case _0x0ae6('0x5b'):_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')]('%s:%s',_0x206021[_0x0ae6('0x5a')],_0x206021[_0x0ae6('0x5b')]))[_0x0ae6('0x67')](_0x0ae6('0x68')))};break;case'token':_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')](_0x0ae6('0x69'),_0x206021[_0x0ae6('0x5a')],_0x206021['token']))[_0x0ae6('0x67')]('base64'))};break;default:throw new db[(_0x0ae6('0x6a'))][(_0x0ae6('0x6b'))](_0x0ae6('0x6c'));}return rp(_0x3db11f);}})[_0x0ae6('0x29')](function(_0x1f0b9e){if(_0x1f0b9e){var _0x15003f=[_0x0ae6('0x6d'),'description','group',_0x0ae6('0x6e')];_[_0x0ae6('0x6f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x104625){return _0x15003f['includes'](_0x104625[_0x0ae6('0x32')]);});return{'count':_0x1f0b9e[_0x0ae6('0x64')]['length'],'rows':_[_0x0ae6('0x2f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x1af034){return{'id':_0x1af034['id'],'name':_0x1af034[_0x0ae6('0x70')]>0x7?_0x1af034[_0x0ae6('0x71')]:_0x1af034[_0x0ae6('0x32')],'custom':_0x1af034['position']>0x7?!![]:![],'options':_0x1af034['system_field_options']?_0x1af034['system_field_options']:_0x1af034[_0x0ae6('0x72')]?_0x1af034['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2d9ec4,null))['catch'](function(_0x58517f){var _0xc69e9d=_0x5cd03b['query'][_0x0ae6('0x73')]?0x1f4:_0x58517f['statusCode']||0x1f4;logger[_0x0ae6('0x74')](_0x0ae6('0x75'),_0x0ae6('0x59'),_0xc69e9d,JSON[_0x0ae6('0x76')](_0x58517f));delete _0x58517f[_0x0ae6('0x2c')];if(_0xc69e9d===0x191){_0xc69e9d=0x190;}_0x2d9ec4['status'](_0xc69e9d)[_0x0ae6('0x2d')](_0x5cd03b[_0x0ae6('0x35')][_0x0ae6('0x73')]?{'message':_0x0ae6('0x77'),'statusCode':_0x58517f[_0x0ae6('0x78')]}:_0x58517f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7583fcf..3b14413 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 _0x421d=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x421d,0x137));var _0xd421=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x421d[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0xd421('0x0'));var logger=require(_0xd421('0x1'))(_0xd421('0x2'));var moment=require(_0xd421('0x3'));var BPromise=require(_0xd421('0x4'));var rp=require(_0xd421('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd421('0x6'));var attributes=require(_0xd421('0x7'));var integrations=require(_0xd421('0x8'));module[_0xd421('0x9')]=function(_0x18b304,_0xd69e4a){return _0x18b304[_0xd421('0xa')](_0xd421('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2180=['moment','bluebird','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x2ed0e6,_0x3ebd8b){var _0x4c53ef=function(_0x21972a){while(--_0x21972a){_0x2ed0e6['push'](_0x2ed0e6['shift']());}};_0x4c53ef(++_0x3ebd8b);}(_0x2180,0x110));var _0x0218=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x2180[_0x483ab9];return _0x35043b;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var logger=require(_0x0218('0x2'))(_0x0218('0x3'));var moment=require(_0x0218('0x4'));var BPromise=require(_0x0218('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0218('0x6'));var attributes=require(_0x0218('0x7'));var integrations=require(_0x0218('0x8'));module[_0x0218('0x9')]=function(_0x15c317,_0x510a0e){return _0x15c317['define'](_0x0218('0xa'),attributes,{'tableName':_0x0218('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 6f2a26e..4822640 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 _0x360c=['catch','ShowZendeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','model','attributes','map','find'];(function(_0x65fd4c,_0x26cc9e){var _0x3d8074=function(_0x236598){while(--_0x236598){_0x65fd4c['push'](_0x65fd4c['shift']());}};_0x3d8074(++_0x26cc9e);}(_0x360c,0xac));var _0xc360=function(_0x30819c,_0xeb856e){_0x30819c=_0x30819c-0x0;var _0x436d6a=_0x360c[_0x30819c];return _0x436d6a;};'use strict';var _=require(_0xc360('0x0'));var util=require(_0xc360('0x1'));var moment=require('moment');var BPromise=require(_0xc360('0x2'));var rs=require(_0xc360('0x3'));var fs=require('fs');var Redis=require(_0xc360('0x4'));var db=require(_0xc360('0x5'))['db'];var utils=require(_0xc360('0x6'));var logger=require('../../config/logger')(_0xc360('0x7'));var config=require('../../config/environment');var jayson=require(_0xc360('0x8'));var client=jayson['client'][_0xc360('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8b66,_0x275353,_0x40dc85){return new BPromise(function(_0xa61c9e,_0x4de737){return client[_0xc360('0xa')](_0x4f8b66,_0x40dc85)[_0xc360('0xb')](function(_0x15e1e7){logger[_0xc360('0xc')](_0xc360('0xd'),_0x275353,'request\x20sent');logger[_0xc360('0xe')](_0xc360('0xf'),_0x275353,_0xc360('0x10'),JSON[_0xc360('0x11')](_0x15e1e7));if(_0x15e1e7['error']){if(_0x15e1e7[_0xc360('0x12')]['code']===0x1f4){logger['error'](_0xc360('0xd'),_0x275353,_0x15e1e7[_0xc360('0x12')][_0xc360('0x13')]);return _0x4de737(_0x15e1e7[_0xc360('0x12')][_0xc360('0x13')]);}logger[_0xc360('0x12')](_0xc360('0xd'),_0x275353,_0x15e1e7[_0xc360('0x12')][_0xc360('0x13')]);return _0xa61c9e(_0x15e1e7[_0xc360('0x12')][_0xc360('0x13')]);}else{logger['info'](_0xc360('0xd'),_0x275353,_0xc360('0x10'));_0xa61c9e(_0x15e1e7['result'][_0xc360('0x13')]);}})['catch'](function(_0x136ba1){logger[_0xc360('0x12')](_0xc360('0xd'),_0x275353,_0x136ba1);_0x4de737(_0x136ba1);});});}exports[_0xc360('0x14')]=function(_0x4c0021){var _0x321256=this;return new Promise(function(_0x4ddc6c,_0x226526){return db[_0xc360('0x15')][_0xc360('0x16')]({'raw':_0x4c0021[_0xc360('0x17')]?_0x4c0021[_0xc360('0x17')][_0xc360('0x18')]===undefined?!![]:![]:!![],'where':_0x4c0021[_0xc360('0x17')]?_0x4c0021['options'][_0xc360('0x19')]||null:null,'attributes':_0x4c0021[_0xc360('0x17')]?_0x4c0021[_0xc360('0x17')]['attributes']||null:null,'limit':_0x4c0021[_0xc360('0x17')]?_0x4c0021['options'][_0xc360('0x1a')]||null:null,'include':_0x4c0021['options']?_0x4c0021['options'][_0xc360('0x1b')]?_['map'](_0x4c0021[_0xc360('0x17')]['include'],function(_0x4c8b20){return{'model':db[_0x4c8b20[_0xc360('0x1c')]],'as':_0x4c8b20['as'],'attributes':_0x4c8b20[_0xc360('0x1d')],'include':_0x4c8b20[_0xc360('0x1b')]?_['map'](_0x4c8b20['include'],function(_0xea967f){return{'model':db[_0xea967f[_0xc360('0x1c')]],'as':_0xea967f['as'],'attributes':_0xea967f[_0xc360('0x1d')],'include':_0xea967f[_0xc360('0x1b')]?_[_0xc360('0x1e')](_0xea967f[_0xc360('0x1b')],function(_0x35946f){return{'model':db[_0x35946f[_0xc360('0x1c')]],'as':_0x35946f['as'],'attributes':_0x35946f[_0xc360('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc360('0xb')](function(_0xd61923){logger['info']('GetZendeskAccount',_0x4c0021);logger[_0xc360('0xe')]('GetZendeskAccount',_0x4c0021,JSON[_0xc360('0x11')](_0xd61923));_0x4ddc6c(_0xd61923);})['catch'](function(_0x5387c8){logger[_0xc360('0x12')](_0xc360('0x14'),_0x5387c8['message'],_0x4c0021);_0x226526(_0x321256[_0xc360('0x12')](0x1f4,_0x5387c8['message']));});});};exports['ShowZendeskAccount']=function(_0x41b1d4){var _0x5b0936=this;return new Promise(function(_0x25a3eb,_0x5f0673){return db['ZendeskAccount'][_0xc360('0x1f')]({'raw':_0x41b1d4[_0xc360('0x17')]?_0x41b1d4[_0xc360('0x17')][_0xc360('0x18')]===undefined?!![]:![]:!![],'where':_0x41b1d4[_0xc360('0x17')]?_0x41b1d4[_0xc360('0x17')][_0xc360('0x19')]||null:null,'attributes':_0x41b1d4[_0xc360('0x17')]?_0x41b1d4['options'][_0xc360('0x1d')]||null:null,'include':_0x41b1d4[_0xc360('0x17')]?_0x41b1d4[_0xc360('0x17')][_0xc360('0x1b')]?_[_0xc360('0x1e')](_0x41b1d4['options'][_0xc360('0x1b')],function(_0x392b12){return{'model':db[_0x392b12[_0xc360('0x1c')]],'as':_0x392b12['as'],'attributes':_0x392b12[_0xc360('0x1d')],'include':_0x392b12[_0xc360('0x1b')]?_[_0xc360('0x1e')](_0x392b12[_0xc360('0x1b')],function(_0x49275d){return{'model':db[_0x49275d[_0xc360('0x1c')]],'as':_0x49275d['as'],'attributes':_0x49275d[_0xc360('0x1d')],'include':_0x49275d[_0xc360('0x1b')]?_[_0xc360('0x1e')](_0x49275d[_0xc360('0x1b')],function(_0x300860){return{'model':db[_0x300860[_0xc360('0x1c')]],'as':_0x300860['as'],'attributes':_0x300860['attributes']};}):[]};}):[]};}):[]:[]})[_0xc360('0xb')](function(_0x1b9d52){logger[_0xc360('0xc')]('ShowZendeskAccount',_0x41b1d4);logger[_0xc360('0xe')]('ShowZendeskAccount',_0x41b1d4,JSON['stringify'](_0x1b9d52));_0x25a3eb(_0x1b9d52);})[_0xc360('0x20')](function(_0x2d247c){logger[_0xc360('0x12')](_0xc360('0x21'),_0x2d247c['message'],_0x41b1d4);_0x5f0673(_0x5b0936[_0xc360('0x12')](0x1f4,_0x2d247c['message']));});});}; \ No newline at end of file +var _0xda55=['where','attributes','limit','include','map','model','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw'];(function(_0x266e57,_0x41125b){var _0x4cdc1d=function(_0x3d3734){while(--_0x3d3734){_0x266e57['push'](_0x266e57['shift']());}};_0x4cdc1d(++_0x41125b);}(_0xda55,0x157));var _0x5da5=function(_0xa73aa,_0x4e1e22){_0xa73aa=_0xa73aa-0x0;var _0x2e8881=_0xda55[_0xa73aa];return _0x2e8881;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require(_0x5da5('0x2'));var rs=require(_0x5da5('0x3'));var fs=require('fs');var Redis=require(_0x5da5('0x4'));var db=require(_0x5da5('0x5'))['db'];var utils=require(_0x5da5('0x6'));var logger=require(_0x5da5('0x7'))(_0x5da5('0x8'));var config=require('../../config/environment');var jayson=require(_0x5da5('0x9'));var client=jayson['client'][_0x5da5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4ca0,_0x3c7898,_0x221d6d){return new BPromise(function(_0x5550b5,_0x1ddbed){return client[_0x5da5('0xb')](_0x3f4ca0,_0x221d6d)[_0x5da5('0xc')](function(_0x306ece){logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x3c7898,'request\x20sent');logger['debug'](_0x5da5('0xf'),_0x3c7898,_0x5da5('0x10'),JSON[_0x5da5('0x11')](_0x306ece));if(_0x306ece[_0x5da5('0x12')]){if(_0x306ece[_0x5da5('0x12')][_0x5da5('0x13')]===0x1f4){logger[_0x5da5('0x12')](_0x5da5('0xe'),_0x3c7898,_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);return _0x1ddbed(_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);}logger['error'](_0x5da5('0xe'),_0x3c7898,_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);return _0x5550b5(_0x306ece[_0x5da5('0x12')][_0x5da5('0x14')]);}else{logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x3c7898,'request\x20sent');_0x5550b5(_0x306ece[_0x5da5('0x15')][_0x5da5('0x14')]);}})[_0x5da5('0x16')](function(_0x4103c1){logger[_0x5da5('0x12')](_0x5da5('0xe'),_0x3c7898,_0x4103c1);_0x1ddbed(_0x4103c1);});});}exports[_0x5da5('0x17')]=function(_0xe6da6a){var _0x18a81d=this;return new Promise(function(_0xeb35f1,_0x4f8f4b){return db['ZendeskAccount'][_0x5da5('0x18')]({'raw':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1b')]||null:null,'attributes':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1c')]||null:null,'limit':_0xe6da6a['options']?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1d')]||null:null,'include':_0xe6da6a[_0x5da5('0x19')]?_0xe6da6a[_0x5da5('0x19')][_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0xe6da6a[_0x5da5('0x19')]['include'],function(_0x902ffc){return{'model':db[_0x902ffc[_0x5da5('0x20')]],'as':_0x902ffc['as'],'attributes':_0x902ffc[_0x5da5('0x1c')],'include':_0x902ffc[_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x902ffc[_0x5da5('0x1e')],function(_0x23734a){return{'model':db[_0x23734a[_0x5da5('0x20')]],'as':_0x23734a['as'],'attributes':_0x23734a[_0x5da5('0x1c')],'include':_0x23734a[_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x23734a['include'],function(_0x44749a){return{'model':db[_0x44749a['model']],'as':_0x44749a['as'],'attributes':_0x44749a[_0x5da5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5da5('0xc')](function(_0x15b3e3){logger[_0x5da5('0xd')]('GetZendeskAccount',_0xe6da6a);logger[_0x5da5('0x21')](_0x5da5('0x17'),_0xe6da6a,JSON[_0x5da5('0x11')](_0x15b3e3));_0xeb35f1(_0x15b3e3);})['catch'](function(_0x4e1fee){logger[_0x5da5('0x12')]('GetZendeskAccount',_0x4e1fee[_0x5da5('0x14')],_0xe6da6a);_0x4f8f4b(_0x18a81d[_0x5da5('0x12')](0x1f4,_0x4e1fee[_0x5da5('0x14')]));});});};exports[_0x5da5('0x22')]=function(_0x3b9447){var _0x382fa9=this;return new Promise(function(_0x288fbf,_0x420c63){return db[_0x5da5('0x23')][_0x5da5('0x24')]({'raw':_0x3b9447[_0x5da5('0x19')]?_0x3b9447[_0x5da5('0x19')][_0x5da5('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b9447[_0x5da5('0x19')]?_0x3b9447[_0x5da5('0x19')]['where']||null:null,'attributes':_0x3b9447['options']?_0x3b9447[_0x5da5('0x19')][_0x5da5('0x1c')]||null:null,'include':_0x3b9447[_0x5da5('0x19')]?_0x3b9447[_0x5da5('0x19')][_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x3b9447['options'][_0x5da5('0x1e')],function(_0x41d13e){return{'model':db[_0x41d13e['model']],'as':_0x41d13e['as'],'attributes':_0x41d13e[_0x5da5('0x1c')],'include':_0x41d13e[_0x5da5('0x1e')]?_[_0x5da5('0x1f')](_0x41d13e[_0x5da5('0x1e')],function(_0x1bceeb){return{'model':db[_0x1bceeb[_0x5da5('0x20')]],'as':_0x1bceeb['as'],'attributes':_0x1bceeb[_0x5da5('0x1c')],'include':_0x1bceeb['include']?_[_0x5da5('0x1f')](_0x1bceeb[_0x5da5('0x1e')],function(_0x5d5840){return{'model':db[_0x5d5840[_0x5da5('0x20')]],'as':_0x5d5840['as'],'attributes':_0x5d5840['attributes']};}):[]};}):[]};}):[]:[]})[_0x5da5('0xc')](function(_0xcac534){logger[_0x5da5('0xd')](_0x5da5('0x22'),_0x3b9447);logger[_0x5da5('0x21')](_0x5da5('0x22'),_0x3b9447,JSON[_0x5da5('0x11')](_0xcac534));_0x288fbf(_0xcac534);})[_0x5da5('0x16')](function(_0x32ea26){logger[_0x5da5('0x12')](_0x5da5('0x22'),_0x32ea26[_0x5da5('0x14')],_0x3b9447);_0x420c63(_0x382fa9[_0x5da5('0x12')](0x1f4,_0x32ea26['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1e87d4c..37ac7e3 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 _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0x878f,0x173));var _0xf878=function(_0x641685,_0x868183){_0x641685=_0x641685-0x0;var _0x53da36=_0x878f[_0x641685];return _0x53da36;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x50079e,_0x2fd209){var _0x449e0e=function(_0x3638a7){while(--_0x3638a7){_0x50079e['push'](_0x50079e['shift']());}};_0x449e0e(++_0x2fd209);}(_0xa571,0x107));var _0x1a57=function(_0xdb45f5,_0x145dc1){_0xdb45f5=_0xdb45f5-0x0;var _0x14e689=_0xa571[_0xdb45f5];return _0x14e689;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3536a44..f618c59 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 _0x6dc0=['STRING'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x6dc0,0xd8));var _0x06dc=function(_0xecafad,_0x67899f){_0xecafad=_0xecafad-0x0;var _0x1c578e=_0x6dc0[_0xecafad];return _0x1c578e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x06dc('0x0')]},'description':{'type':Sequelize[_0x06dc('0x0')]}}; \ No newline at end of file +var _0x32f3=['STRING'];(function(_0x17e315,_0x361db6){var _0x3e7afb=function(_0x830a5f){while(--_0x830a5f){_0x17e315['push'](_0x17e315['shift']());}};_0x3e7afb(++_0x361db6);}(_0x32f3,0xf1));var _0x332f=function(_0x460d75,_0x21fffa){_0x460d75=_0x460d75-0x0;var _0x131403=_0x32f3[_0x460d75];return _0x131403;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x332f('0x0')]},'description':{'type':Sequelize[_0x332f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 139daf6..5379daf 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 _0x7812=['getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZendeskField','getFields','getSubjects','getDescriptions'];(function(_0x15298e,_0x591c53){var _0x2d1d1a=function(_0x2c4cc0){while(--_0x2c4cc0){_0x15298e['push'](_0x15298e['shift']());}};_0x2d1d1a(++_0x591c53);}(_0x7812,0x194));var _0x2781=function(_0x35cba9,_0x3fa8c6){_0x35cba9=_0x35cba9-0x0;var _0x57820b=_0x7812[_0x35cba9];return _0x57820b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2781('0x0'));var zipdir=require(_0x2781('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2781('0x2'));var moment=require(_0x2781('0x3'));var BPromise=require(_0x2781('0x4'));var Mustache=require('mustache');var util=require(_0x2781('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2781('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2781('0x7'));var squel=require('squel');var crypto=require(_0x2781('0x8'));var jsforce=require(_0x2781('0x9'));var deskjs=require(_0x2781('0xa'));var toCsv=require(_0x2781('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2781('0xb'));var qs=require(_0x2781('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2781('0xd'));var logger=require('../../config/logger')(_0x2781('0xe'));var utils=require(_0x2781('0xf'));var config=require(_0x2781('0x10'));var licenseUtil=require(_0x2781('0x11'));var db=require(_0x2781('0x12'))['db'];function respondWithStatusCode(_0x3dccbf,_0x21c04b){_0x21c04b=_0x21c04b||0xcc;return function(_0x3f0ed9){if(_0x3f0ed9){return _0x3dccbf[_0x2781('0x13')](_0x21c04b);}return _0x3dccbf[_0x2781('0x14')](_0x21c04b)[_0x2781('0x15')]();};}function respondWithResult(_0x2ae133,_0x57b69a){_0x57b69a=_0x57b69a||0xc8;return function(_0x433c69){if(_0x433c69){return _0x2ae133['status'](_0x57b69a)['json'](_0x433c69);}};}function respondWithFilteredResult(_0x5467d2,_0x1644f0){return function(_0x4ce949){if(_0x4ce949){var _0x3330bf=typeof _0x1644f0['offset']===_0x2781('0x16')&&typeof _0x1644f0['limit']==='undefined';var _0x10b6f8=_0x4ce949[_0x2781('0x17')];var _0x4ed08b=_0x3330bf?0x0:_0x1644f0['offset'];var _0x5dded1=_0x3330bf?_0x4ce949['count']:_0x1644f0[_0x2781('0x18')]+_0x1644f0['limit'];var _0x8da19e;if(_0x5dded1>=_0x10b6f8){_0x5dded1=_0x10b6f8;_0x8da19e=0xc8;}else{_0x8da19e=0xce;}_0x5467d2[_0x2781('0x14')](_0x8da19e);return _0x5467d2[_0x2781('0x19')](_0x2781('0x1a'),_0x4ed08b+'-'+_0x5dded1+'/'+_0x10b6f8)['json'](_0x4ce949);}return null;};}function patchUpdates(_0x2d31d9){return function(_0x5d947d){try{jsonpatch[_0x2781('0x1b')](_0x5d947d,_0x2d31d9,!![]);}catch(_0x54eec4){return BPromise[_0x2781('0x1c')](_0x54eec4);}return _0x5d947d[_0x2781('0x1d')]();};}function saveUpdates(_0x5b8cdd,_0x4375a4){return function(_0x50f98c){if(_0x50f98c){return _0x50f98c['update'](_0x5b8cdd)[_0x2781('0x1e')](function(_0x1e92f3){return _0x1e92f3;});}return null;};}function removeEntity(_0x305a17,_0x9561aa){return function(_0x499d18){if(_0x499d18){return _0x499d18[_0x2781('0x1f')]()['then'](function(){_0x305a17[_0x2781('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f370f,_0x42b772){return function(_0x50e178){if(!_0x50e178){_0x5f370f[_0x2781('0x13')](0x194);}return _0x50e178;};}function handleError(_0x1973b1,_0x34519d){_0x34519d=_0x34519d||0x1f4;return function(_0x1eb8e6){logger[_0x2781('0x20')](_0x1eb8e6[_0x2781('0x21')]);if(_0x1eb8e6[_0x2781('0x22')]){delete _0x1eb8e6[_0x2781('0x22')];}_0x1973b1['status'](_0x34519d)[_0x2781('0x23')](_0x1eb8e6);};}exports[_0x2781('0x24')]=function(_0x18ce81,_0x49988c){var _0x34b4e6={},_0x1ecbaf={},_0x3b4296={'count':0x0,'rows':[]};var _0x4fdcd6=_[_0x2781('0x25')](db[_0x2781('0x26')][_0x2781('0x27')],function(_0x38a52c){return{'name':_0x38a52c[_0x2781('0x28')],'type':_0x38a52c[_0x2781('0x29')][_0x2781('0x2a')]};});_0x1ecbaf['model']=_[_0x2781('0x25')](_0x4fdcd6,_0x2781('0x22'));_0x1ecbaf['query']=_[_0x2781('0x2b')](_0x18ce81[_0x2781('0x2c')]);_0x1ecbaf[_0x2781('0x2d')]=_['intersection'](_0x1ecbaf['model'],_0x1ecbaf['query']);_0x34b4e6[_0x2781('0x2e')]=_[_0x2781('0x2f')](_0x1ecbaf[_0x2781('0x30')],qs[_0x2781('0x31')](_0x18ce81[_0x2781('0x2c')][_0x2781('0x31')]));_0x34b4e6['attributes']=_0x34b4e6['attributes'][_0x2781('0x32')]?_0x34b4e6[_0x2781('0x2e')]:_0x1ecbaf[_0x2781('0x30')];if(!_0x18ce81[_0x2781('0x2c')][_0x2781('0x33')](_0x2781('0x34'))){_0x34b4e6['limit']=qs['limit'](_0x18ce81['query'][_0x2781('0x35')]);_0x34b4e6[_0x2781('0x18')]=qs['offset'](_0x18ce81['query']['offset']);}_0x34b4e6[_0x2781('0x36')]=qs[_0x2781('0x37')](_0x18ce81[_0x2781('0x2c')]['sort']);_0x34b4e6[_0x2781('0x38')]=qs[_0x2781('0x2d')](_[_0x2781('0x39')](_0x18ce81[_0x2781('0x2c')],_0x1ecbaf[_0x2781('0x2d')]),_0x4fdcd6);if(_0x18ce81[_0x2781('0x2c')][_0x2781('0x3a')]){_0x34b4e6[_0x2781('0x38')]=_[_0x2781('0x3b')](_0x34b4e6[_0x2781('0x38')],{'$or':_[_0x2781('0x25')](_0x4fdcd6,function(_0x267df2){if(_0x267df2['type']!=='VIRTUAL'){var _0x53632c={};_0x53632c[_0x267df2[_0x2781('0x22')]]={'$like':'%'+_0x18ce81[_0x2781('0x2c')][_0x2781('0x3a')]+'%'};return _0x53632c;}})});}_0x34b4e6=_[_0x2781('0x3b')]({},_0x34b4e6,_0x18ce81[_0x2781('0x3c')]);var _0x4b5e41={'where':_0x34b4e6[_0x2781('0x38')]};return db[_0x2781('0x26')]['count'](_0x4b5e41)[_0x2781('0x1e')](function(_0x3f8fb4){_0x3b4296[_0x2781('0x17')]=_0x3f8fb4;if(_0x18ce81[_0x2781('0x2c')][_0x2781('0x3d')]){_0x34b4e6[_0x2781('0x3e')]=[{'all':!![]}];}return db[_0x2781('0x26')][_0x2781('0x3f')](_0x34b4e6);})['then'](function(_0x46e1c8){_0x3b4296[_0x2781('0x40')]=_0x46e1c8;return _0x3b4296;})[_0x2781('0x1e')](respondWithFilteredResult(_0x49988c,_0x34b4e6))[_0x2781('0x41')](handleError(_0x49988c,null));};exports[_0x2781('0x42')]=function(_0x2e39b0,_0x522bd9){var _0x1af5b9={'raw':![],'where':{'id':_0x2e39b0[_0x2781('0x43')]['id']}},_0x30f6a8={};_0x30f6a8[_0x2781('0x30')]=_['keys'](db[_0x2781('0x26')][_0x2781('0x27')]);_0x30f6a8[_0x2781('0x2c')]=_[_0x2781('0x2b')](_0x2e39b0[_0x2781('0x2c')]);_0x30f6a8[_0x2781('0x2d')]=_[_0x2781('0x2f')](_0x30f6a8[_0x2781('0x30')],_0x30f6a8[_0x2781('0x2c')]);_0x1af5b9[_0x2781('0x2e')]=_[_0x2781('0x2f')](_0x30f6a8[_0x2781('0x30')],qs[_0x2781('0x31')](_0x2e39b0[_0x2781('0x2c')][_0x2781('0x31')]));_0x1af5b9['attributes']=_0x1af5b9[_0x2781('0x2e')][_0x2781('0x32')]?_0x1af5b9[_0x2781('0x2e')]:_0x30f6a8[_0x2781('0x30')];if(_0x2e39b0[_0x2781('0x2c')][_0x2781('0x3d')]){_0x1af5b9[_0x2781('0x3e')]=[{'all':!![]}];}_0x1af5b9=_['merge']({},_0x1af5b9,_0x2e39b0[_0x2781('0x3c')]);return db[_0x2781('0x26')][_0x2781('0x44')](_0x1af5b9)[_0x2781('0x1e')](handleEntityNotFound(_0x522bd9,null))['then'](respondWithResult(_0x522bd9,null))[_0x2781('0x41')](handleError(_0x522bd9,null));};exports[_0x2781('0x45')]=function(_0x41dec8,_0x2df310){return db['ZendeskConfiguration'][_0x2781('0x45')](_0x41dec8[_0x2781('0x46')],{})[_0x2781('0x1e')](respondWithResult(_0x2df310,0xc9))[_0x2781('0x41')](handleError(_0x2df310,null));};exports['update']=function(_0xffd50f,_0x48bd5b){if(_0xffd50f[_0x2781('0x46')]['id']){delete _0xffd50f[_0x2781('0x46')]['id'];}return db[_0x2781('0x26')][_0x2781('0x44')]({'where':{'id':_0xffd50f[_0x2781('0x43')]['id']}})[_0x2781('0x1e')](handleEntityNotFound(_0x48bd5b,null))[_0x2781('0x1e')](saveUpdates(_0xffd50f[_0x2781('0x46')],null))[_0x2781('0x1e')](respondWithResult(_0x48bd5b,null))[_0x2781('0x41')](handleError(_0x48bd5b,null));};exports['destroy']=function(_0x786b7b,_0x35671e){return db['ZendeskConfiguration'][_0x2781('0x44')]({'where':{'id':_0x786b7b[_0x2781('0x43')]['id']}})[_0x2781('0x1e')](handleEntityNotFound(_0x35671e,null))[_0x2781('0x1e')](removeEntity(_0x35671e,null))['catch'](handleError(_0x35671e,null));};exports['getFields']=function(_0x321de9,_0x501dae,_0x3d2470){var _0x47aa2c={};var _0x4204ca={};var _0x2023f4;var _0x2e2664;return db[_0x2781('0x26')][_0x2781('0x47')]({'where':{'id':_0x321de9['params']['id']}})[_0x2781('0x1e')](handleEntityNotFound(_0x501dae,null))[_0x2781('0x1e')](function(_0x32693f){if(_0x32693f){_0x2023f4=_0x32693f;_0x4204ca[_0x2781('0x30')]=_[_0x2781('0x2b')](db[_0x2781('0x48')]['rawAttributes']);_0x4204ca[_0x2781('0x2c')]=_[_0x2781('0x2b')](_0x321de9[_0x2781('0x2c')]);_0x4204ca[_0x2781('0x2d')]=_[_0x2781('0x2f')](_0x4204ca[_0x2781('0x30')],_0x4204ca[_0x2781('0x2c')]);_0x47aa2c[_0x2781('0x2e')]=_[_0x2781('0x2f')](_0x4204ca[_0x2781('0x30')],qs[_0x2781('0x31')](_0x321de9['query'][_0x2781('0x31')]));_0x47aa2c[_0x2781('0x2e')]=_0x47aa2c['attributes'][_0x2781('0x32')]?_0x47aa2c[_0x2781('0x2e')]:_0x4204ca[_0x2781('0x30')];_0x47aa2c[_0x2781('0x36')]=qs[_0x2781('0x37')](_0x321de9['query'][_0x2781('0x37')]);_0x47aa2c['where']=qs[_0x2781('0x2d')](_[_0x2781('0x39')](_0x321de9[_0x2781('0x2c')],_0x4204ca[_0x2781('0x2d')]));if(_0x321de9[_0x2781('0x2c')][_0x2781('0x3a')]){_0x47aa2c[_0x2781('0x38')]=_[_0x2781('0x3b')](_0x47aa2c[_0x2781('0x38')],{'$or':_['map'](_0x47aa2c[_0x2781('0x2e')],function(_0x23b946){var _0x51565a={};_0x51565a[_0x23b946]={'$like':'%'+_0x321de9[_0x2781('0x2c')][_0x2781('0x3a')]+'%'};return _0x51565a;})});}_0x47aa2c=_[_0x2781('0x3b')]({},_0x47aa2c,_0x321de9[_0x2781('0x3c')]);return _0x2023f4[_0x2781('0x49')](_0x47aa2c);}})[_0x2781('0x1e')](function(_0x527485){if(_0x527485){_0x2e2664=_0x527485[_0x2781('0x32')];if(!_0x321de9[_0x2781('0x2c')][_0x2781('0x33')]('nolimit')){_0x47aa2c['limit']=qs[_0x2781('0x35')](_0x321de9[_0x2781('0x2c')][_0x2781('0x35')]);_0x47aa2c[_0x2781('0x18')]=qs[_0x2781('0x18')](_0x321de9['query'][_0x2781('0x18')]);}return _0x2023f4['getFields'](_0x47aa2c);}})[_0x2781('0x1e')](function(_0x50d1b0){if(_0x50d1b0){return _0x50d1b0?{'count':_0x2e2664,'rows':_0x50d1b0}:null;}})[_0x2781('0x1e')](respondWithResult(_0x501dae,null))['catch'](handleError(_0x501dae,null));};exports[_0x2781('0x4a')]=function(_0x35cafe,_0x205fe6,_0xbf10fe){var _0x2df49e={};var _0x47a2fe={};var _0x3817e7;var _0x1890e3;return db[_0x2781('0x26')][_0x2781('0x47')]({'where':{'id':_0x35cafe[_0x2781('0x43')]['id']}})[_0x2781('0x1e')](handleEntityNotFound(_0x205fe6,null))['then'](function(_0x5ad3fb){if(_0x5ad3fb){_0x3817e7=_0x5ad3fb;_0x47a2fe[_0x2781('0x30')]=_[_0x2781('0x2b')](db[_0x2781('0x48')][_0x2781('0x27')]);_0x47a2fe['query']=_[_0x2781('0x2b')](_0x35cafe[_0x2781('0x2c')]);_0x47a2fe[_0x2781('0x2d')]=_[_0x2781('0x2f')](_0x47a2fe[_0x2781('0x30')],_0x47a2fe['query']);_0x2df49e[_0x2781('0x2e')]=_[_0x2781('0x2f')](_0x47a2fe[_0x2781('0x30')],qs[_0x2781('0x31')](_0x35cafe[_0x2781('0x2c')][_0x2781('0x31')]));_0x2df49e['attributes']=_0x2df49e[_0x2781('0x2e')][_0x2781('0x32')]?_0x2df49e[_0x2781('0x2e')]:_0x47a2fe['model'];_0x2df49e[_0x2781('0x36')]=qs[_0x2781('0x37')](_0x35cafe['query'][_0x2781('0x37')]);_0x2df49e[_0x2781('0x38')]=qs[_0x2781('0x2d')](_[_0x2781('0x39')](_0x35cafe[_0x2781('0x2c')],_0x47a2fe[_0x2781('0x2d')]));if(_0x35cafe[_0x2781('0x2c')]['filter']){_0x2df49e[_0x2781('0x38')]=_[_0x2781('0x3b')](_0x2df49e[_0x2781('0x38')],{'$or':_[_0x2781('0x25')](_0x2df49e[_0x2781('0x2e')],function(_0x3904a2){var _0x29c22c={};_0x29c22c[_0x3904a2]={'$like':'%'+_0x35cafe['query'][_0x2781('0x3a')]+'%'};return _0x29c22c;})});}_0x2df49e=_[_0x2781('0x3b')]({},_0x2df49e,_0x35cafe[_0x2781('0x3c')]);return _0x3817e7[_0x2781('0x4a')](_0x2df49e);}})[_0x2781('0x1e')](function(_0x4add22){if(_0x4add22){_0x1890e3=_0x4add22[_0x2781('0x32')];if(!_0x35cafe['query']['hasOwnProperty'](_0x2781('0x34'))){_0x2df49e['limit']=qs[_0x2781('0x35')](_0x35cafe[_0x2781('0x2c')]['limit']);_0x2df49e['offset']=qs[_0x2781('0x18')](_0x35cafe[_0x2781('0x2c')][_0x2781('0x18')]);}return _0x3817e7['getSubjects'](_0x2df49e);}})[_0x2781('0x1e')](function(_0x40ce85){if(_0x40ce85){return _0x40ce85?{'count':_0x1890e3,'rows':_0x40ce85}:null;}})['then'](respondWithResult(_0x205fe6,null))[_0x2781('0x41')](handleError(_0x205fe6,null));};exports['getDescriptions']=function(_0x22764c,_0x53179f,_0x258a50){var _0x34ca21={};var _0x4332df={};var _0x32bb5c;var _0x1a4e22;return db[_0x2781('0x26')]['findOne']({'where':{'id':_0x22764c[_0x2781('0x43')]['id']}})['then'](handleEntityNotFound(_0x53179f,null))[_0x2781('0x1e')](function(_0xae4ab0){if(_0xae4ab0){_0x32bb5c=_0xae4ab0;_0x4332df[_0x2781('0x30')]=_[_0x2781('0x2b')](db['ZendeskField'][_0x2781('0x27')]);_0x4332df[_0x2781('0x2c')]=_[_0x2781('0x2b')](_0x22764c['query']);_0x4332df[_0x2781('0x2d')]=_[_0x2781('0x2f')](_0x4332df['model'],_0x4332df[_0x2781('0x2c')]);_0x34ca21[_0x2781('0x2e')]=_[_0x2781('0x2f')](_0x4332df[_0x2781('0x30')],qs[_0x2781('0x31')](_0x22764c[_0x2781('0x2c')][_0x2781('0x31')]));_0x34ca21['attributes']=_0x34ca21['attributes']['length']?_0x34ca21[_0x2781('0x2e')]:_0x4332df[_0x2781('0x30')];_0x34ca21[_0x2781('0x36')]=qs[_0x2781('0x37')](_0x22764c[_0x2781('0x2c')][_0x2781('0x37')]);_0x34ca21[_0x2781('0x38')]=qs[_0x2781('0x2d')](_[_0x2781('0x39')](_0x22764c[_0x2781('0x2c')],_0x4332df[_0x2781('0x2d')]));if(_0x22764c[_0x2781('0x2c')][_0x2781('0x3a')]){_0x34ca21[_0x2781('0x38')]=_[_0x2781('0x3b')](_0x34ca21['where'],{'$or':_[_0x2781('0x25')](_0x34ca21[_0x2781('0x2e')],function(_0x10cad8){var _0x6f2400={};_0x6f2400[_0x10cad8]={'$like':'%'+_0x22764c[_0x2781('0x2c')][_0x2781('0x3a')]+'%'};return _0x6f2400;})});}_0x34ca21=_['merge']({},_0x34ca21,_0x22764c[_0x2781('0x3c')]);return _0x32bb5c[_0x2781('0x4b')](_0x34ca21);}})[_0x2781('0x1e')](function(_0x3d761b){if(_0x3d761b){_0x1a4e22=_0x3d761b['length'];if(!_0x22764c[_0x2781('0x2c')][_0x2781('0x33')](_0x2781('0x34'))){_0x34ca21[_0x2781('0x35')]=qs[_0x2781('0x35')](_0x22764c[_0x2781('0x2c')][_0x2781('0x35')]);_0x34ca21[_0x2781('0x18')]=qs['offset'](_0x22764c['query'][_0x2781('0x18')]);}return _0x32bb5c[_0x2781('0x4b')](_0x34ca21);}})[_0x2781('0x1e')](function(_0x27de8e){if(_0x27de8e){return _0x27de8e?{'count':_0x1a4e22,'rows':_0x27de8e}:null;}})['then'](respondWithResult(_0x53179f,null))[_0x2781('0x41')](handleError(_0x53179f,null));};exports[_0x2781('0x4c')]=function(_0x201b12,_0x6db5cb,_0x22fa8e){var _0x4ad3a7={};var _0x1664cf={};var _0x593b3c;var _0x38d124;return db[_0x2781('0x26')][_0x2781('0x47')]({'where':{'id':_0x201b12[_0x2781('0x43')]['id']}})['then'](handleEntityNotFound(_0x6db5cb,null))['then'](function(_0x3efdb6){if(_0x3efdb6){_0x593b3c=_0x3efdb6;_0x1664cf[_0x2781('0x30')]=_[_0x2781('0x2b')](db[_0x2781('0x4d')][_0x2781('0x27')]);_0x1664cf[_0x2781('0x2c')]=_[_0x2781('0x2b')](_0x201b12[_0x2781('0x2c')]);_0x1664cf[_0x2781('0x2d')]=_[_0x2781('0x2f')](_0x1664cf[_0x2781('0x30')],_0x1664cf['query']);_0x4ad3a7[_0x2781('0x2e')]=_[_0x2781('0x2f')](_0x1664cf[_0x2781('0x30')],qs[_0x2781('0x31')](_0x201b12[_0x2781('0x2c')][_0x2781('0x31')]));_0x4ad3a7[_0x2781('0x2e')]=_0x4ad3a7[_0x2781('0x2e')][_0x2781('0x32')]?_0x4ad3a7[_0x2781('0x2e')]:_0x1664cf[_0x2781('0x30')];_0x4ad3a7['order']=qs['sort'](_0x201b12[_0x2781('0x2c')][_0x2781('0x37')]);_0x4ad3a7[_0x2781('0x38')]=qs[_0x2781('0x2d')](_[_0x2781('0x39')](_0x201b12[_0x2781('0x2c')],_0x1664cf[_0x2781('0x2d')]));if(_0x201b12[_0x2781('0x2c')][_0x2781('0x3a')]){_0x4ad3a7['where']=_['merge'](_0x4ad3a7[_0x2781('0x38')],{'$or':_['map'](_0x4ad3a7['attributes'],function(_0x1daacd){var _0x3dbedb={};_0x3dbedb[_0x1daacd]={'$like':'%'+_0x201b12[_0x2781('0x2c')][_0x2781('0x3a')]+'%'};return _0x3dbedb;})});}_0x4ad3a7=_[_0x2781('0x3b')]({},_0x4ad3a7,_0x201b12[_0x2781('0x3c')]);return _0x593b3c[_0x2781('0x4c')](_0x4ad3a7);}})['then'](function(_0x4897bf){if(_0x4897bf){_0x38d124=_0x4897bf['length'];if(!_0x201b12['query']['hasOwnProperty']('nolimit')){_0x4ad3a7[_0x2781('0x35')]=qs[_0x2781('0x35')](_0x201b12[_0x2781('0x2c')][_0x2781('0x35')]);_0x4ad3a7[_0x2781('0x18')]=qs['offset'](_0x201b12[_0x2781('0x2c')][_0x2781('0x18')]);}return _0x593b3c[_0x2781('0x4c')](_0x4ad3a7);}})[_0x2781('0x1e')](function(_0x5653e9){if(_0x5653e9){return _0x5653e9?{'count':_0x38d124,'rows':_0x5653e9}:null;}})[_0x2781('0x1e')](respondWithResult(_0x6db5cb,null))['catch'](handleError(_0x6db5cb,null));};exports['setTags']=function(_0x4df532,_0x444953,_0x57f148){if(_0x4df532[_0x2781('0x46')]['id']){delete _0x4df532[_0x2781('0x46')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4df532['params']['id']}})[_0x2781('0x1e')](handleEntityNotFound(_0x444953,null))['then'](function(_0x202382){if(_0x202382){return _0x202382[_0x2781('0x4e')](_0x4df532['body'][_0x2781('0x4f')]||[]);}return null;})[_0x2781('0x1e')](respondWithResult(_0x444953,null))[_0x2781('0x41')](handleError(_0x444953,null));}; \ No newline at end of file +var _0xa2ea=['body','params','getFields','findOne','hasOwnProperty','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','apply','save','update','then','destroy','end','error','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','length','includeAll','find'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa2ea,0x1a1));var _0xaa2e=function(_0xc0f3d0,_0x4cfe98){_0xc0f3d0=_0xc0f3d0-0x0;var _0x1798ba=_0xa2ea[_0xc0f3d0];return _0x1798ba;};'use strict';var emlformat=require(_0xaa2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa2e('0x1'));var jsonpatch=require(_0xaa2e('0x2'));var rp=require(_0xaa2e('0x3'));var moment=require('moment');var BPromise=require(_0xaa2e('0x4'));var Mustache=require(_0xaa2e('0x5'));var util=require(_0xaa2e('0x6'));var path=require(_0xaa2e('0x7'));var sox=require(_0xaa2e('0x8'));var csv=require(_0xaa2e('0x9'));var ejs=require(_0xaa2e('0xa'));var fs=require('fs');var fs_extra=require(_0xaa2e('0xb'));var _=require(_0xaa2e('0xc'));var squel=require(_0xaa2e('0xd'));var crypto=require(_0xaa2e('0xe'));var jsforce=require(_0xaa2e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaa2e('0x9'));var querystring=require(_0xaa2e('0x10'));var Papa=require(_0xaa2e('0x11'));var Redis=require(_0xaa2e('0x12'));var authService=require(_0xaa2e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa2e('0x14'));var hardwareService=require(_0xaa2e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xaa2e('0x16'));var config=require(_0xaa2e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa2e('0x18'))['db'];function respondWithStatusCode(_0x118d81,_0xc8957){_0xc8957=_0xc8957||0xcc;return function(_0x4dffb1){if(_0x4dffb1){return _0x118d81[_0xaa2e('0x19')](_0xc8957);}return _0x118d81[_0xaa2e('0x1a')](_0xc8957)['end']();};}function respondWithResult(_0xd1d164,_0x44d806){_0x44d806=_0x44d806||0xc8;return function(_0x4fff63){if(_0x4fff63){return _0xd1d164[_0xaa2e('0x1a')](_0x44d806)['json'](_0x4fff63);}};}function respondWithFilteredResult(_0x5b5016,_0x44b635){return function(_0x472677){if(_0x472677){var _0x428f28=typeof _0x44b635[_0xaa2e('0x1b')]===_0xaa2e('0x1c')&&typeof _0x44b635[_0xaa2e('0x1d')]===_0xaa2e('0x1c');var _0x1f88e1=_0x472677[_0xaa2e('0x1e')];var _0x2a849a=_0x428f28?0x0:_0x44b635[_0xaa2e('0x1b')];var _0x49cdde=_0x428f28?_0x472677[_0xaa2e('0x1e')]:_0x44b635[_0xaa2e('0x1b')]+_0x44b635[_0xaa2e('0x1d')];var _0xb344aa;if(_0x49cdde>=_0x1f88e1){_0x49cdde=_0x1f88e1;_0xb344aa=0xc8;}else{_0xb344aa=0xce;}_0x5b5016['status'](_0xb344aa);return _0x5b5016['set']('Content-Range',_0x2a849a+'-'+_0x49cdde+'/'+_0x1f88e1)['json'](_0x472677);}return null;};}function patchUpdates(_0x468d07){return function(_0x139845){try{jsonpatch[_0xaa2e('0x1f')](_0x139845,_0x468d07,!![]);}catch(_0x361e18){return BPromise['reject'](_0x361e18);}return _0x139845[_0xaa2e('0x20')]();};}function saveUpdates(_0x31f2c4,_0x4acd4b){return function(_0x304f33){if(_0x304f33){return _0x304f33[_0xaa2e('0x21')](_0x31f2c4)[_0xaa2e('0x22')](function(_0x2e9161){return _0x2e9161;});}return null;};}function removeEntity(_0x58ce44,_0x55056e){return function(_0x26fcc2){if(_0x26fcc2){return _0x26fcc2[_0xaa2e('0x23')]()[_0xaa2e('0x22')](function(){_0x58ce44[_0xaa2e('0x1a')](0xcc)[_0xaa2e('0x24')]();});}};}function handleEntityNotFound(_0x155ee1,_0x12f08a){return function(_0xa521f6){if(!_0xa521f6){_0x155ee1['sendStatus'](0x194);}return _0xa521f6;};}function handleError(_0x568f3a,_0x55b34a){_0x55b34a=_0x55b34a||0x1f4;return function(_0x2cf5b){logger[_0xaa2e('0x25')](_0x2cf5b['stack']);if(_0x2cf5b[_0xaa2e('0x26')]){delete _0x2cf5b['name'];}_0x568f3a[_0xaa2e('0x1a')](_0x55b34a)[_0xaa2e('0x27')](_0x2cf5b);};}exports['index']=function(_0x3dca87,_0x4f032f){var _0x173b97={},_0x47974d={},_0x3677f3={'count':0x0,'rows':[]};var _0x129ae0=_[_0xaa2e('0x28')](db[_0xaa2e('0x29')][_0xaa2e('0x2a')],function(_0x5f9796){return{'name':_0x5f9796[_0xaa2e('0x2b')],'type':_0x5f9796['type'][_0xaa2e('0x2c')]};});_0x47974d['model']=_[_0xaa2e('0x28')](_0x129ae0,_0xaa2e('0x26'));_0x47974d[_0xaa2e('0x2d')]=_[_0xaa2e('0x2e')](_0x3dca87[_0xaa2e('0x2d')]);_0x47974d[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x47974d[_0xaa2e('0x31')],_0x47974d[_0xaa2e('0x2d')]);_0x173b97[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x47974d[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x3dca87['query'][_0xaa2e('0x33')]));_0x173b97[_0xaa2e('0x32')]=_0x173b97[_0xaa2e('0x32')]['length']?_0x173b97[_0xaa2e('0x32')]:_0x47974d['model'];if(!_0x3dca87['query']['hasOwnProperty'](_0xaa2e('0x34'))){_0x173b97['limit']=qs[_0xaa2e('0x1d')](_0x3dca87[_0xaa2e('0x2d')][_0xaa2e('0x1d')]);_0x173b97[_0xaa2e('0x1b')]=qs['offset'](_0x3dca87['query']['offset']);}_0x173b97[_0xaa2e('0x35')]=qs[_0xaa2e('0x36')](_0x3dca87[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0x173b97[_0xaa2e('0x37')]=qs[_0xaa2e('0x2f')](_[_0xaa2e('0x38')](_0x3dca87[_0xaa2e('0x2d')],_0x47974d[_0xaa2e('0x2f')]),_0x129ae0);if(_0x3dca87['query']['filter']){_0x173b97[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0x173b97[_0xaa2e('0x37')],{'$or':_[_0xaa2e('0x28')](_0x129ae0,function(_0x3a940b){if(_0x3a940b[_0xaa2e('0x3a')]!==_0xaa2e('0x3b')){var _0x266f6b={};_0x266f6b[_0x3a940b['name']]={'$like':'%'+_0x3dca87[_0xaa2e('0x2d')][_0xaa2e('0x3c')]+'%'};return _0x266f6b;}})});}_0x173b97=_[_0xaa2e('0x39')]({},_0x173b97,_0x3dca87[_0xaa2e('0x3d')]);var _0x666e3b={'where':_0x173b97[_0xaa2e('0x37')]};return db['ZendeskConfiguration'][_0xaa2e('0x1e')](_0x666e3b)[_0xaa2e('0x22')](function(_0x15cd85){_0x3677f3[_0xaa2e('0x1e')]=_0x15cd85;if(_0x3dca87[_0xaa2e('0x2d')]['includeAll']){_0x173b97[_0xaa2e('0x3e')]=[{'all':!![]}];}return db[_0xaa2e('0x29')][_0xaa2e('0x3f')](_0x173b97);})['then'](function(_0x19d2fe){_0x3677f3[_0xaa2e('0x40')]=_0x19d2fe;return _0x3677f3;})[_0xaa2e('0x22')](respondWithFilteredResult(_0x4f032f,_0x173b97))[_0xaa2e('0x41')](handleError(_0x4f032f,null));};exports['show']=function(_0x54178f,_0x4d531a){var _0x110097={'raw':![],'where':{'id':_0x54178f['params']['id']}},_0x27f034={};_0x27f034['model']=_['keys'](db[_0xaa2e('0x29')][_0xaa2e('0x2a')]);_0x27f034['query']=_[_0xaa2e('0x2e')](_0x54178f[_0xaa2e('0x2d')]);_0x27f034[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x27f034[_0xaa2e('0x31')],_0x27f034['query']);_0x110097[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x27f034['model'],qs[_0xaa2e('0x33')](_0x54178f['query']['fields']));_0x110097[_0xaa2e('0x32')]=_0x110097[_0xaa2e('0x32')][_0xaa2e('0x42')]?_0x110097[_0xaa2e('0x32')]:_0x27f034[_0xaa2e('0x31')];if(_0x54178f[_0xaa2e('0x2d')][_0xaa2e('0x43')]){_0x110097['include']=[{'all':!![]}];}_0x110097=_[_0xaa2e('0x39')]({},_0x110097,_0x54178f['options']);return db[_0xaa2e('0x29')][_0xaa2e('0x44')](_0x110097)['then'](handleEntityNotFound(_0x4d531a,null))[_0xaa2e('0x22')](respondWithResult(_0x4d531a,null))['catch'](handleError(_0x4d531a,null));};exports['create']=function(_0x1abc54,_0x5c5eaa){return db[_0xaa2e('0x29')]['create'](_0x1abc54[_0xaa2e('0x45')],{})[_0xaa2e('0x22')](respondWithResult(_0x5c5eaa,0xc9))['catch'](handleError(_0x5c5eaa,null));};exports[_0xaa2e('0x21')]=function(_0x4dd560,_0x3ec765){if(_0x4dd560[_0xaa2e('0x45')]['id']){delete _0x4dd560[_0xaa2e('0x45')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x4dd560[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x3ec765,null))['then'](saveUpdates(_0x4dd560['body'],null))[_0xaa2e('0x22')](respondWithResult(_0x3ec765,null))[_0xaa2e('0x41')](handleError(_0x3ec765,null));};exports['destroy']=function(_0x566e61,_0x451e9b){return db[_0xaa2e('0x29')][_0xaa2e('0x44')]({'where':{'id':_0x566e61[_0xaa2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x451e9b,null))[_0xaa2e('0x22')](removeEntity(_0x451e9b,null))[_0xaa2e('0x41')](handleError(_0x451e9b,null));};exports[_0xaa2e('0x47')]=function(_0x482900,_0x1f1cba,_0x59a8f4){var _0x50014e={};var _0x34ddd5={};var _0x49a8c6;var _0x4784aa;return db['ZendeskConfiguration'][_0xaa2e('0x48')]({'where':{'id':_0x482900[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x1f1cba,null))[_0xaa2e('0x22')](function(_0x3508dc){if(_0x3508dc){_0x49a8c6=_0x3508dc;_0x34ddd5['model']=_['keys'](db['ZendeskField'][_0xaa2e('0x2a')]);_0x34ddd5['query']=_[_0xaa2e('0x2e')](_0x482900[_0xaa2e('0x2d')]);_0x34ddd5[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x34ddd5[_0xaa2e('0x31')],_0x34ddd5[_0xaa2e('0x2d')]);_0x50014e['attributes']=_['intersection'](_0x34ddd5[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x33')]));_0x50014e[_0xaa2e('0x32')]=_0x50014e[_0xaa2e('0x32')][_0xaa2e('0x42')]?_0x50014e['attributes']:_0x34ddd5['model'];_0x50014e[_0xaa2e('0x35')]=qs['sort'](_0x482900['query'][_0xaa2e('0x36')]);_0x50014e[_0xaa2e('0x37')]=qs['filters'](_[_0xaa2e('0x38')](_0x482900[_0xaa2e('0x2d')],_0x34ddd5[_0xaa2e('0x2f')]));if(_0x482900[_0xaa2e('0x2d')]['filter']){_0x50014e[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0x50014e[_0xaa2e('0x37')],{'$or':_[_0xaa2e('0x28')](_0x50014e[_0xaa2e('0x32')],function(_0x59f883){var _0x222a65={};_0x222a65[_0x59f883]={'$like':'%'+_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x3c')]+'%'};return _0x222a65;})});}_0x50014e=_['merge']({},_0x50014e,_0x482900[_0xaa2e('0x3d')]);return _0x49a8c6[_0xaa2e('0x47')](_0x50014e);}})['then'](function(_0x3f59a0){if(_0x3f59a0){_0x4784aa=_0x3f59a0[_0xaa2e('0x42')];if(!_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x49')](_0xaa2e('0x34'))){_0x50014e[_0xaa2e('0x1d')]=qs[_0xaa2e('0x1d')](_0x482900['query'][_0xaa2e('0x1d')]);_0x50014e['offset']=qs[_0xaa2e('0x1b')](_0x482900[_0xaa2e('0x2d')][_0xaa2e('0x1b')]);}return _0x49a8c6['getFields'](_0x50014e);}})[_0xaa2e('0x22')](function(_0x1d776f){if(_0x1d776f){return _0x1d776f?{'count':_0x4784aa,'rows':_0x1d776f}:null;}})[_0xaa2e('0x22')](respondWithResult(_0x1f1cba,null))['catch'](handleError(_0x1f1cba,null));};exports['getSubjects']=function(_0x23599b,_0x188e5d,_0x2f5c66){var _0xcb4468={};var _0x598ccd={};var _0x258528;var _0x20350e;return db[_0xaa2e('0x29')][_0xaa2e('0x48')]({'where':{'id':_0x23599b[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x188e5d,null))[_0xaa2e('0x22')](function(_0x5a9345){if(_0x5a9345){_0x258528=_0x5a9345;_0x598ccd[_0xaa2e('0x31')]=_[_0xaa2e('0x2e')](db[_0xaa2e('0x4a')][_0xaa2e('0x2a')]);_0x598ccd[_0xaa2e('0x2d')]=_['keys'](_0x23599b[_0xaa2e('0x2d')]);_0x598ccd[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x598ccd[_0xaa2e('0x31')],_0x598ccd[_0xaa2e('0x2d')]);_0xcb4468[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x598ccd['model'],qs[_0xaa2e('0x33')](_0x23599b['query'][_0xaa2e('0x33')]));_0xcb4468['attributes']=_0xcb4468[_0xaa2e('0x32')]['length']?_0xcb4468[_0xaa2e('0x32')]:_0x598ccd[_0xaa2e('0x31')];_0xcb4468['order']=qs[_0xaa2e('0x36')](_0x23599b[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0xcb4468[_0xaa2e('0x37')]=qs[_0xaa2e('0x2f')](_['pick'](_0x23599b['query'],_0x598ccd[_0xaa2e('0x2f')]));if(_0x23599b['query'][_0xaa2e('0x3c')]){_0xcb4468[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0xcb4468[_0xaa2e('0x37')],{'$or':_['map'](_0xcb4468[_0xaa2e('0x32')],function(_0x21195b){var _0x3a9bc1={};_0x3a9bc1[_0x21195b]={'$like':'%'+_0x23599b['query']['filter']+'%'};return _0x3a9bc1;})});}_0xcb4468=_['merge']({},_0xcb4468,_0x23599b[_0xaa2e('0x3d')]);return _0x258528[_0xaa2e('0x4b')](_0xcb4468);}})[_0xaa2e('0x22')](function(_0x4b7cf6){if(_0x4b7cf6){_0x20350e=_0x4b7cf6[_0xaa2e('0x42')];if(!_0x23599b[_0xaa2e('0x2d')][_0xaa2e('0x49')]('nolimit')){_0xcb4468['limit']=qs['limit'](_0x23599b['query']['limit']);_0xcb4468[_0xaa2e('0x1b')]=qs[_0xaa2e('0x1b')](_0x23599b[_0xaa2e('0x2d')]['offset']);}return _0x258528[_0xaa2e('0x4b')](_0xcb4468);}})['then'](function(_0x289f8c){if(_0x289f8c){return _0x289f8c?{'count':_0x20350e,'rows':_0x289f8c}:null;}})['then'](respondWithResult(_0x188e5d,null))[_0xaa2e('0x41')](handleError(_0x188e5d,null));};exports[_0xaa2e('0x4c')]=function(_0x29887b,_0x35bca0,_0x3d92e6){var _0x5eb382={};var _0x4c277b={};var _0x1c1dd7;var _0x5acca1;return db[_0xaa2e('0x29')]['findOne']({'where':{'id':_0x29887b[_0xaa2e('0x46')]['id']}})['then'](handleEntityNotFound(_0x35bca0,null))[_0xaa2e('0x22')](function(_0x456039){if(_0x456039){_0x1c1dd7=_0x456039;_0x4c277b[_0xaa2e('0x31')]=_[_0xaa2e('0x2e')](db['ZendeskField'][_0xaa2e('0x2a')]);_0x4c277b['query']=_[_0xaa2e('0x2e')](_0x29887b['query']);_0x4c277b[_0xaa2e('0x2f')]=_[_0xaa2e('0x30')](_0x4c277b[_0xaa2e('0x31')],_0x4c277b['query']);_0x5eb382['attributes']=_[_0xaa2e('0x30')](_0x4c277b[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x33')]));_0x5eb382['attributes']=_0x5eb382[_0xaa2e('0x32')]['length']?_0x5eb382[_0xaa2e('0x32')]:_0x4c277b[_0xaa2e('0x31')];_0x5eb382[_0xaa2e('0x35')]=qs['sort'](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0x5eb382['where']=qs['filters'](_[_0xaa2e('0x38')](_0x29887b[_0xaa2e('0x2d')],_0x4c277b[_0xaa2e('0x2f')]));if(_0x29887b['query'][_0xaa2e('0x3c')]){_0x5eb382[_0xaa2e('0x37')]=_[_0xaa2e('0x39')](_0x5eb382[_0xaa2e('0x37')],{'$or':_[_0xaa2e('0x28')](_0x5eb382[_0xaa2e('0x32')],function(_0x12151d){var _0x21286a={};_0x21286a[_0x12151d]={'$like':'%'+_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x3c')]+'%'};return _0x21286a;})});}_0x5eb382=_[_0xaa2e('0x39')]({},_0x5eb382,_0x29887b['options']);return _0x1c1dd7[_0xaa2e('0x4c')](_0x5eb382);}})[_0xaa2e('0x22')](function(_0x2b60b9){if(_0x2b60b9){_0x5acca1=_0x2b60b9['length'];if(!_0x29887b['query'][_0xaa2e('0x49')](_0xaa2e('0x34'))){_0x5eb382[_0xaa2e('0x1d')]=qs['limit'](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x1d')]);_0x5eb382[_0xaa2e('0x1b')]=qs[_0xaa2e('0x1b')](_0x29887b[_0xaa2e('0x2d')][_0xaa2e('0x1b')]);}return _0x1c1dd7[_0xaa2e('0x4c')](_0x5eb382);}})['then'](function(_0x16cf19){if(_0x16cf19){return _0x16cf19?{'count':_0x5acca1,'rows':_0x16cf19}:null;}})['then'](respondWithResult(_0x35bca0,null))[_0xaa2e('0x41')](handleError(_0x35bca0,null));};exports[_0xaa2e('0x4d')]=function(_0x2624f4,_0x21d00c,_0x1ab097){var _0x2f304d={};var _0x5911c2={};var _0x3db8a4;var _0x384c6a;return db[_0xaa2e('0x29')][_0xaa2e('0x48')]({'where':{'id':_0x2624f4[_0xaa2e('0x46')]['id']}})[_0xaa2e('0x22')](handleEntityNotFound(_0x21d00c,null))[_0xaa2e('0x22')](function(_0x5a16e3){if(_0x5a16e3){_0x3db8a4=_0x5a16e3;_0x5911c2[_0xaa2e('0x31')]=_[_0xaa2e('0x2e')](db[_0xaa2e('0x4e')][_0xaa2e('0x2a')]);_0x5911c2[_0xaa2e('0x2d')]=_[_0xaa2e('0x2e')](_0x2624f4['query']);_0x5911c2['filters']=_[_0xaa2e('0x30')](_0x5911c2[_0xaa2e('0x31')],_0x5911c2[_0xaa2e('0x2d')]);_0x2f304d[_0xaa2e('0x32')]=_[_0xaa2e('0x30')](_0x5911c2[_0xaa2e('0x31')],qs[_0xaa2e('0x33')](_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x33')]));_0x2f304d[_0xaa2e('0x32')]=_0x2f304d[_0xaa2e('0x32')][_0xaa2e('0x42')]?_0x2f304d[_0xaa2e('0x32')]:_0x5911c2['model'];_0x2f304d[_0xaa2e('0x35')]=qs[_0xaa2e('0x36')](_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x36')]);_0x2f304d['where']=qs[_0xaa2e('0x2f')](_['pick'](_0x2624f4[_0xaa2e('0x2d')],_0x5911c2[_0xaa2e('0x2f')]));if(_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x3c')]){_0x2f304d[_0xaa2e('0x37')]=_['merge'](_0x2f304d['where'],{'$or':_['map'](_0x2f304d['attributes'],function(_0x42b0c3){var _0x14ffce={};_0x14ffce[_0x42b0c3]={'$like':'%'+_0x2624f4[_0xaa2e('0x2d')]['filter']+'%'};return _0x14ffce;})});}_0x2f304d=_[_0xaa2e('0x39')]({},_0x2f304d,_0x2624f4[_0xaa2e('0x3d')]);return _0x3db8a4[_0xaa2e('0x4d')](_0x2f304d);}})[_0xaa2e('0x22')](function(_0x6d30de){if(_0x6d30de){_0x384c6a=_0x6d30de[_0xaa2e('0x42')];if(!_0x2624f4[_0xaa2e('0x2d')][_0xaa2e('0x49')](_0xaa2e('0x34'))){_0x2f304d[_0xaa2e('0x1d')]=qs[_0xaa2e('0x1d')](_0x2624f4[_0xaa2e('0x2d')]['limit']);_0x2f304d[_0xaa2e('0x1b')]=qs['offset'](_0x2624f4['query']['offset']);}return _0x3db8a4['getTags'](_0x2f304d);}})[_0xaa2e('0x22')](function(_0x3eaa8d){if(_0x3eaa8d){return _0x3eaa8d?{'count':_0x384c6a,'rows':_0x3eaa8d}:null;}})[_0xaa2e('0x22')](respondWithResult(_0x21d00c,null))[_0xaa2e('0x41')](handleError(_0x21d00c,null));};exports[_0xaa2e('0x4f')]=function(_0x1340b5,_0x45da77,_0x15c239){if(_0x1340b5[_0xaa2e('0x45')]['id']){delete _0x1340b5[_0xaa2e('0x45')]['id'];}return db[_0xaa2e('0x29')]['findOne']({'where':{'id':_0x1340b5['params']['id']}})['then'](handleEntityNotFound(_0x45da77,null))[_0xaa2e('0x22')](function(_0x2042ef){if(_0x2042ef){return _0x2042ef[_0xaa2e('0x4f')](_0x1340b5['body'][_0xaa2e('0x50')]||[]);}return null;})[_0xaa2e('0x22')](respondWithResult(_0x45da77,null))[_0xaa2e('0x41')](handleError(_0x45da77,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 57b5910..41dd71c 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 _0x4e81=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x4e81[_0x2cc569];return _0x1bfc2e;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14e8('0x3'));var fs=require('fs');var path=require(_0x14e8('0x4'));var rimraf=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var attributes=require(_0x14e8('0x7'));module[_0x14e8('0x8')]=function(_0x56a266,_0x57c79b){return _0x56a266[_0x14e8('0x9')](_0x14e8('0xa'),attributes,{'tableName':_0x14e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x1ba691,_0x59087e){var _0xa6091c=function(_0x17d848){while(--_0x17d848){_0x1ba691['push'](_0x1ba691['shift']());}};_0xa6091c(++_0x59087e);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x52a8bf,_0x56f389){_0x52a8bf=_0x52a8bf-0x0;var _0xa4dcd2=_0xe1e3[_0x52a8bf];return _0xa4dcd2;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 433c5b0..836cf2b 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 _0xcac1=['rpc','../../config/environment','client','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c67d1,_0x26c6d8){var _0x447875=function(_0x36f532){while(--_0x36f532){_0x5c67d1['push'](_0x5c67d1['shift']());}};_0x447875(++_0x26c6d8);}(_0xcac1,0x1ec));var _0x1cac=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xcac1[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x1cac('0x0'));var util=require(_0x1cac('0x1'));var moment=require(_0x1cac('0x2'));var BPromise=require(_0x1cac('0x3'));var rs=require(_0x1cac('0x4'));var fs=require('fs');var Redis=require(_0x1cac('0x5'));var db=require(_0x1cac('0x6'))['db'];var utils=require(_0x1cac('0x7'));var logger=require('../../config/logger')(_0x1cac('0x8'));var config=require(_0x1cac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1cac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x322825,_0x274ffd,_0x40ea3e){return new BPromise(function(_0x3a5839,_0x2c5b0c){return client['request'](_0x322825,_0x40ea3e)['then'](function(_0x53286d){logger[_0x1cac('0xb')](_0x1cac('0xc'),_0x274ffd,_0x1cac('0xd'));logger['debug'](_0x1cac('0xe'),_0x274ffd,_0x1cac('0xd'),JSON[_0x1cac('0xf')](_0x53286d));if(_0x53286d[_0x1cac('0x10')]){if(_0x53286d[_0x1cac('0x10')][_0x1cac('0x11')]===0x1f4){logger[_0x1cac('0x10')](_0x1cac('0xc'),_0x274ffd,_0x53286d['error'][_0x1cac('0x12')]);return _0x2c5b0c(_0x53286d[_0x1cac('0x10')][_0x1cac('0x12')]);}logger[_0x1cac('0x10')](_0x1cac('0xc'),_0x274ffd,_0x53286d['error'][_0x1cac('0x12')]);return _0x3a5839(_0x53286d[_0x1cac('0x10')]['message']);}else{logger[_0x1cac('0xb')](_0x1cac('0xc'),_0x274ffd,_0x1cac('0xd'));_0x3a5839(_0x53286d[_0x1cac('0x13')][_0x1cac('0x12')]);}})['catch'](function(_0x2642d4){logger[_0x1cac('0x10')](_0x1cac('0xc'),_0x274ffd,_0x2642d4);_0x2c5b0c(_0x2642d4);});});} \ No newline at end of file +var _0xcfa3=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1b6b5d,_0x5deaaf){var _0x16f4f7=function(_0xe9b61f){while(--_0xe9b61f){_0x1b6b5d['push'](_0x1b6b5d['shift']());}};_0x16f4f7(++_0x5deaaf);}(_0xcfa3,0x149));var _0x3cfa=function(_0x4ee91f,_0x20342d){_0x4ee91f=_0x4ee91f-0x0;var _0x32b073=_0xcfa3[_0x4ee91f];return _0x32b073;};'use strict';var _=require(_0x3cfa('0x0'));var util=require(_0x3cfa('0x1'));var moment=require('moment');var BPromise=require(_0x3cfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cfa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cfa('0x4'));var logger=require(_0x3cfa('0x5'))(_0x3cfa('0x6'));var config=require(_0x3cfa('0x7'));var jayson=require(_0x3cfa('0x8'));var client=jayson[_0x3cfa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a01e,_0x46086c,_0xa5439){return new BPromise(function(_0xe37123,_0x4af8a1){return client[_0x3cfa('0xa')](_0x47a01e,_0xa5439)[_0x3cfa('0xb')](function(_0x4e4a7a){logger[_0x3cfa('0xc')](_0x3cfa('0xd'),_0x46086c,_0x3cfa('0xe'));logger[_0x3cfa('0xf')](_0x3cfa('0x10'),_0x46086c,_0x3cfa('0xe'),JSON['stringify'](_0x4e4a7a));if(_0x4e4a7a['error']){if(_0x4e4a7a['error']['code']===0x1f4){logger[_0x3cfa('0x11')](_0x3cfa('0xd'),_0x46086c,_0x4e4a7a['error'][_0x3cfa('0x12')]);return _0x4af8a1(_0x4e4a7a[_0x3cfa('0x11')][_0x3cfa('0x12')]);}logger[_0x3cfa('0x11')](_0x3cfa('0xd'),_0x46086c,_0x4e4a7a[_0x3cfa('0x11')][_0x3cfa('0x12')]);return _0xe37123(_0x4e4a7a[_0x3cfa('0x11')][_0x3cfa('0x12')]);}else{logger[_0x3cfa('0xc')](_0x3cfa('0xd'),_0x46086c,_0x3cfa('0xe'));_0xe37123(_0x4e4a7a[_0x3cfa('0x13')][_0x3cfa('0x12')]);}})['catch'](function(_0x17f593){logger[_0x3cfa('0x11')](_0x3cfa('0xd'),_0x46086c,_0x17f593);_0x4af8a1(_0x17f593);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1f65e1f..cb4ebe8 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 _0xbf39=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','multer'];(function(_0x1e9947,_0x9ea565){var _0x1e2c2f=function(_0x25735e){while(--_0x25735e){_0x1e9947['push'](_0x1e9947['shift']());}};_0x1e2c2f(++_0x9ea565);}(_0xbf39,0x167));var _0x9bf3=function(_0x596a8b,_0xd275d7){_0x596a8b=_0x596a8b-0x0;var _0x52920b=_0xbf39[_0x596a8b];return _0x52920b;};'use strict';var multer=require(_0x9bf3('0x0'));var util=require('util');var path=require(_0x9bf3('0x1'));var timeout=require(_0x9bf3('0x2'));var express=require(_0x9bf3('0x3'));var router=express[_0x9bf3('0x4')]();var fs_extra=require(_0x9bf3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9bf3('0x6'));var config=require(_0x9bf3('0x7'));var controller=require(_0x9bf3('0x8'));router[_0x9bf3('0x9')]('/',auth[_0x9bf3('0xa')](),controller[_0x9bf3('0xb')]);router[_0x9bf3('0x9')]('/:id',auth[_0x9bf3('0xa')](),controller[_0x9bf3('0xc')]);router[_0x9bf3('0xd')]('/',auth[_0x9bf3('0xa')](),controller['create']);router[_0x9bf3('0xe')](_0x9bf3('0xf'),auth['isAuthenticated'](),controller[_0x9bf3('0x10')]);router[_0x9bf3('0x11')]('/:id',auth[_0x9bf3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b80=['post','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b80,0x14f));var _0x06b8=function(_0x1c3e42,_0x1a4fe9){_0x1c3e42=_0x1c3e42-0x0;var _0x348fdc=_0x6b80[_0x1c3e42];return _0x348fdc;};'use strict';var multer=require(_0x06b8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x06b8('0x1'));var express=require(_0x06b8('0x2'));var router=express['Router']();var fs_extra=require(_0x06b8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06b8('0x4'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x06b8('0x5')](),controller[_0x06b8('0x6')]);router[_0x06b8('0x7')](_0x06b8('0x8'),auth[_0x06b8('0x5')](),controller[_0x06b8('0x9')]);router[_0x06b8('0xa')]('/',auth[_0x06b8('0x5')](),controller['create']);router[_0x06b8('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x06b8('0xc')]);router[_0x06b8('0xd')](_0x06b8('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x06b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 035984d..dd202da 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 _0x2117=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x140ed5,_0x1c22f8){var _0x3120ac=function(_0x32e820){while(--_0x32e820){_0x140ed5['push'](_0x140ed5['shift']());}};_0x3120ac(++_0x1c22f8);}(_0x2117,0x1d0));var _0x7211=function(_0x1cf49b,_0x3ea7c3){_0x1cf49b=_0x1cf49b-0x0;var _0x2e30c9=_0x2117[_0x1cf49b];return _0x2e30c9;};'use strict';var Sequelize=require(_0x7211('0x0'));module[_0x7211('0x1')]={'type':{'type':Sequelize[_0x7211('0x2')](_0x7211('0x3'),_0x7211('0x4'),_0x7211('0x5'),'keyValue',_0x7211('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7211('0x7')]},'keyType':{'type':Sequelize[_0x7211('0x2')](_0x7211('0x3'),_0x7211('0x4'),_0x7211('0x5'))},'keyContent':{'type':Sequelize[_0x7211('0x7')]},'idField':{'type':Sequelize[_0x7211('0x7')]},'nameField':{'type':Sequelize[_0x7211('0x7')]},'customField':{'type':Sequelize[_0x7211('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x458b=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x355285,_0x572d13){var _0x45b20e=function(_0x203f1b){while(--_0x203f1b){_0x355285['push'](_0x355285['shift']());}};_0x45b20e(++_0x572d13);}(_0x458b,0x1b2));var _0xb458=function(_0x49cdd0,_0x2508f9){_0x49cdd0=_0x49cdd0-0x0;var _0x13daaa=_0x458b[_0x49cdd0];return _0x13daaa;};'use strict';var Sequelize=require(_0xb458('0x0'));module[_0xb458('0x1')]={'type':{'type':Sequelize[_0xb458('0x2')](_0xb458('0x3'),_0xb458('0x4'),_0xb458('0x5'),'keyValue',_0xb458('0x6')),'defaultValue':_0xb458('0x3')},'content':{'type':Sequelize[_0xb458('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb458('0x2')](_0xb458('0x3'),'variable',_0xb458('0x5'))},'keyContent':{'type':Sequelize[_0xb458('0x7')]},'idField':{'type':Sequelize[_0xb458('0x7')]},'nameField':{'type':Sequelize[_0xb458('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb458('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e62f282..8ba1e95 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 _0x88c9=['name','send','index','map','rawAttributes','filters','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','ZendeskField','includeAll','findAll','rows','catch','show','keys','intersection','length','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','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','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','destroy','sendStatus','error'];(function(_0xd6675b,_0x353dda){var _0x4e98aa=function(_0x391372){while(--_0x391372){_0xd6675b['push'](_0xd6675b['shift']());}};_0x4e98aa(++_0x353dda);}(_0x88c9,0x1f2));var _0x988c=function(_0x301add,_0x3c2d76){_0x301add=_0x301add-0x0;var _0x4458d9=_0x88c9[_0x301add];return _0x4458d9;};'use strict';var emlformat=require(_0x988c('0x0'));var rimraf=require(_0x988c('0x1'));var zipdir=require(_0x988c('0x2'));var jsonpatch=require(_0x988c('0x3'));var rp=require(_0x988c('0x4'));var moment=require('moment');var BPromise=require(_0x988c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x988c('0x6'));var sox=require(_0x988c('0x7'));var csv=require(_0x988c('0x8'));var ejs=require(_0x988c('0x9'));var fs=require('fs');var fs_extra=require(_0x988c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x988c('0xb'));var jsforce=require(_0x988c('0xc'));var deskjs=require(_0x988c('0xd'));var toCsv=require(_0x988c('0x8'));var querystring=require(_0x988c('0xe'));var Papa=require(_0x988c('0xf'));var Redis=require(_0x988c('0x10'));var authService=require(_0x988c('0x11'));var qs=require(_0x988c('0x12'));var as=require(_0x988c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x988c('0x14'))(_0x988c('0x15'));var utils=require(_0x988c('0x16'));var config=require(_0x988c('0x17'));var licenseUtil=require(_0x988c('0x18'));var db=require(_0x988c('0x19'))['db'];function respondWithStatusCode(_0x185782,_0x528dd4){_0x528dd4=_0x528dd4||0xcc;return function(_0x4ed9f2){if(_0x4ed9f2){return _0x185782['sendStatus'](_0x528dd4);}return _0x185782['status'](_0x528dd4)[_0x988c('0x1a')]();};}function respondWithResult(_0x4a5bb3,_0x4b4343){_0x4b4343=_0x4b4343||0xc8;return function(_0x4331cf){if(_0x4331cf){return _0x4a5bb3['status'](_0x4b4343)[_0x988c('0x1b')](_0x4331cf);}};}function respondWithFilteredResult(_0xe30832,_0x182d3c){return function(_0x5a6410){if(_0x5a6410){var _0x1c67b4=typeof _0x182d3c[_0x988c('0x1c')]===_0x988c('0x1d')&&typeof _0x182d3c[_0x988c('0x1e')]===_0x988c('0x1d');var _0x1edd02=_0x5a6410[_0x988c('0x1f')];var _0x1e73c1=_0x1c67b4?0x0:_0x182d3c[_0x988c('0x1c')];var _0x2d2281=_0x1c67b4?_0x5a6410['count']:_0x182d3c[_0x988c('0x1c')]+_0x182d3c[_0x988c('0x1e')];var _0x5cadf1;if(_0x2d2281>=_0x1edd02){_0x2d2281=_0x1edd02;_0x5cadf1=0xc8;}else{_0x5cadf1=0xce;}_0xe30832[_0x988c('0x20')](_0x5cadf1);return _0xe30832[_0x988c('0x21')](_0x988c('0x22'),_0x1e73c1+'-'+_0x2d2281+'/'+_0x1edd02)['json'](_0x5a6410);}return null;};}function patchUpdates(_0x506d21){return function(_0x6e5a70){try{jsonpatch[_0x988c('0x23')](_0x6e5a70,_0x506d21,!![]);}catch(_0x317f72){return BPromise[_0x988c('0x24')](_0x317f72);}return _0x6e5a70['save']();};}function saveUpdates(_0x2c539d,_0x216d3e){return function(_0x48c62f){if(_0x48c62f){return _0x48c62f['update'](_0x2c539d)[_0x988c('0x25')](function(_0xbb5203){return _0xbb5203;});}return null;};}function removeEntity(_0x57173b,_0x537e23){return function(_0x11656a){if(_0x11656a){return _0x11656a[_0x988c('0x26')]()[_0x988c('0x25')](function(){_0x57173b[_0x988c('0x20')](0xcc)[_0x988c('0x1a')]();});}};}function handleEntityNotFound(_0x2316c7,_0x3ea40d){return function(_0x304e83){if(!_0x304e83){_0x2316c7[_0x988c('0x27')](0x194);}return _0x304e83;};}function handleError(_0x111211,_0x239dc2){_0x239dc2=_0x239dc2||0x1f4;return function(_0x665c6){logger[_0x988c('0x28')](_0x665c6['stack']);if(_0x665c6[_0x988c('0x29')]){delete _0x665c6[_0x988c('0x29')];}_0x111211[_0x988c('0x20')](_0x239dc2)[_0x988c('0x2a')](_0x665c6);};}exports[_0x988c('0x2b')]=function(_0x5e320a,_0x3be720){var _0x156e9d={},_0x509f99={},_0x53c1a7={'count':0x0,'rows':[]};var _0x5d5992=_[_0x988c('0x2c')](db['ZendeskField'][_0x988c('0x2d')],function(_0x1bc081){return{'name':_0x1bc081['fieldName'],'type':_0x1bc081['type']['key']};});_0x509f99['model']=_[_0x988c('0x2c')](_0x5d5992,'name');_0x509f99['query']=_['keys'](_0x5e320a['query']);_0x509f99[_0x988c('0x2e')]=_['intersection'](_0x509f99[_0x988c('0x2f')],_0x509f99[_0x988c('0x30')]);_0x156e9d[_0x988c('0x31')]=_['intersection'](_0x509f99[_0x988c('0x2f')],qs[_0x988c('0x32')](_0x5e320a[_0x988c('0x30')][_0x988c('0x32')]));_0x156e9d[_0x988c('0x31')]=_0x156e9d[_0x988c('0x31')]['length']?_0x156e9d[_0x988c('0x31')]:_0x509f99['model'];if(!_0x5e320a[_0x988c('0x30')][_0x988c('0x33')](_0x988c('0x34'))){_0x156e9d[_0x988c('0x1e')]=qs[_0x988c('0x1e')](_0x5e320a['query'][_0x988c('0x1e')]);_0x156e9d[_0x988c('0x1c')]=qs['offset'](_0x5e320a[_0x988c('0x30')][_0x988c('0x1c')]);}_0x156e9d[_0x988c('0x35')]=qs[_0x988c('0x36')](_0x5e320a[_0x988c('0x30')]['sort']);_0x156e9d[_0x988c('0x37')]=qs[_0x988c('0x2e')](_[_0x988c('0x38')](_0x5e320a[_0x988c('0x30')],_0x509f99[_0x988c('0x2e')]),_0x5d5992);if(_0x5e320a[_0x988c('0x30')][_0x988c('0x39')]){_0x156e9d[_0x988c('0x37')]=_['merge'](_0x156e9d[_0x988c('0x37')],{'$or':_[_0x988c('0x2c')](_0x5d5992,function(_0x4c421b){if(_0x4c421b[_0x988c('0x3a')]!==_0x988c('0x3b')){var _0x217b18={};_0x217b18[_0x4c421b['name']]={'$like':'%'+_0x5e320a[_0x988c('0x30')][_0x988c('0x39')]+'%'};return _0x217b18;}})});}_0x156e9d=_[_0x988c('0x3c')]({},_0x156e9d,_0x5e320a[_0x988c('0x3d')]);var _0x3a21a2={'where':_0x156e9d['where']};return db[_0x988c('0x3e')][_0x988c('0x1f')](_0x3a21a2)[_0x988c('0x25')](function(_0x37856f){_0x53c1a7[_0x988c('0x1f')]=_0x37856f;if(_0x5e320a[_0x988c('0x30')][_0x988c('0x3f')]){_0x156e9d['include']=[{'all':!![]}];}return db['ZendeskField'][_0x988c('0x40')](_0x156e9d);})[_0x988c('0x25')](function(_0x54c075){_0x53c1a7[_0x988c('0x41')]=_0x54c075;return _0x53c1a7;})[_0x988c('0x25')](respondWithFilteredResult(_0x3be720,_0x156e9d))[_0x988c('0x42')](handleError(_0x3be720,null));};exports[_0x988c('0x43')]=function(_0x3266b0,_0x58c768){var _0x4a83d3={'raw':!![],'where':{'id':_0x3266b0['params']['id']}},_0x1adb68={};_0x1adb68['model']=_[_0x988c('0x44')](db[_0x988c('0x3e')]['rawAttributes']);_0x1adb68[_0x988c('0x30')]=_[_0x988c('0x44')](_0x3266b0[_0x988c('0x30')]);_0x1adb68[_0x988c('0x2e')]=_[_0x988c('0x45')](_0x1adb68[_0x988c('0x2f')],_0x1adb68[_0x988c('0x30')]);_0x4a83d3['attributes']=_['intersection'](_0x1adb68[_0x988c('0x2f')],qs['fields'](_0x3266b0[_0x988c('0x30')][_0x988c('0x32')]));_0x4a83d3[_0x988c('0x31')]=_0x4a83d3[_0x988c('0x31')][_0x988c('0x46')]?_0x4a83d3[_0x988c('0x31')]:_0x1adb68['model'];if(_0x3266b0[_0x988c('0x30')][_0x988c('0x3f')]){_0x4a83d3[_0x988c('0x47')]=[{'all':!![]}];}_0x4a83d3=_[_0x988c('0x3c')]({},_0x4a83d3,_0x3266b0[_0x988c('0x3d')]);return db[_0x988c('0x3e')][_0x988c('0x48')](_0x4a83d3)['then'](handleEntityNotFound(_0x58c768,null))['then'](respondWithResult(_0x58c768,null))[_0x988c('0x42')](handleError(_0x58c768,null));};exports[_0x988c('0x49')]=function(_0x4246bf,_0x382030){return db['ZendeskField']['create'](_0x4246bf[_0x988c('0x4a')],{})[_0x988c('0x25')](respondWithResult(_0x382030,0xc9))[_0x988c('0x42')](handleError(_0x382030,null));};exports[_0x988c('0x4b')]=function(_0x4b59dc,_0x32cdb6){if(_0x4b59dc[_0x988c('0x4a')]['id']){delete _0x4b59dc[_0x988c('0x4a')]['id'];}return db[_0x988c('0x3e')]['find']({'where':{'id':_0x4b59dc[_0x988c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x32cdb6,null))[_0x988c('0x25')](saveUpdates(_0x4b59dc[_0x988c('0x4a')],null))['then'](respondWithResult(_0x32cdb6,null))[_0x988c('0x42')](handleError(_0x32cdb6,null));};exports[_0x988c('0x26')]=function(_0x9993f4,_0x3dc5c5){return db[_0x988c('0x3e')][_0x988c('0x48')]({'where':{'id':_0x9993f4[_0x988c('0x4c')]['id']}})[_0x988c('0x25')](handleEntityNotFound(_0x3dc5c5,null))['then'](removeEntity(_0x3dc5c5,null))[_0x988c('0x42')](handleError(_0x3dc5c5,null));}; \ No newline at end of file +var _0xbb53=['include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','length'];(function(_0x373521,_0x1db3fc){var _0x5d2a29=function(_0x4b16b5){while(--_0x4b16b5){_0x373521['push'](_0x373521['shift']());}};_0x5d2a29(++_0x1db3fc);}(_0xbb53,0x121));var _0x3bb5=function(_0x31f227,_0x5bed48){_0x31f227=_0x31f227-0x0;var _0x30cad3=_0xbb53[_0x31f227];return _0x30cad3;};'use strict';var emlformat=require(_0x3bb5('0x0'));var rimraf=require(_0x3bb5('0x1'));var zipdir=require(_0x3bb5('0x2'));var jsonpatch=require(_0x3bb5('0x3'));var rp=require(_0x3bb5('0x4'));var moment=require(_0x3bb5('0x5'));var BPromise=require(_0x3bb5('0x6'));var Mustache=require(_0x3bb5('0x7'));var util=require(_0x3bb5('0x8'));var path=require(_0x3bb5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3bb5('0xb'));var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb5('0x16'))['db'];function respondWithStatusCode(_0x511bd8,_0x526bf0){_0x526bf0=_0x526bf0||0xcc;return function(_0x223356){if(_0x223356){return _0x511bd8[_0x3bb5('0x17')](_0x526bf0);}return _0x511bd8[_0x3bb5('0x18')](_0x526bf0)['end']();};}function respondWithResult(_0xd578fc,_0x12e409){_0x12e409=_0x12e409||0xc8;return function(_0x519123){if(_0x519123){return _0xd578fc[_0x3bb5('0x18')](_0x12e409)[_0x3bb5('0x19')](_0x519123);}};}function respondWithFilteredResult(_0x5cec77,_0x5ca99f){return function(_0x50617f){if(_0x50617f){var _0x42ef1b=typeof _0x5ca99f[_0x3bb5('0x1a')]==='undefined'&&typeof _0x5ca99f[_0x3bb5('0x1b')]===_0x3bb5('0x1c');var _0x4656c4=_0x50617f[_0x3bb5('0x1d')];var _0x48bc25=_0x42ef1b?0x0:_0x5ca99f[_0x3bb5('0x1a')];var _0x1109d0=_0x42ef1b?_0x50617f[_0x3bb5('0x1d')]:_0x5ca99f['offset']+_0x5ca99f['limit'];var _0x19b177;if(_0x1109d0>=_0x4656c4){_0x1109d0=_0x4656c4;_0x19b177=0xc8;}else{_0x19b177=0xce;}_0x5cec77[_0x3bb5('0x18')](_0x19b177);return _0x5cec77[_0x3bb5('0x1e')]('Content-Range',_0x48bc25+'-'+_0x1109d0+'/'+_0x4656c4)[_0x3bb5('0x19')](_0x50617f);}return null;};}function patchUpdates(_0x2afe6e){return function(_0x3f94ad){try{jsonpatch[_0x3bb5('0x1f')](_0x3f94ad,_0x2afe6e,!![]);}catch(_0x21a3ff){return BPromise[_0x3bb5('0x20')](_0x21a3ff);}return _0x3f94ad['save']();};}function saveUpdates(_0x37444e,_0x3eae85){return function(_0x438a8d){if(_0x438a8d){return _0x438a8d[_0x3bb5('0x21')](_0x37444e)[_0x3bb5('0x22')](function(_0xfb9e8){return _0xfb9e8;});}return null;};}function removeEntity(_0x341a3f,_0x58c10f){return function(_0x1d2a24){if(_0x1d2a24){return _0x1d2a24[_0x3bb5('0x23')]()['then'](function(){_0x341a3f['status'](0xcc)[_0x3bb5('0x24')]();});}};}function handleEntityNotFound(_0x36cfda,_0x58acdb){return function(_0x483689){if(!_0x483689){_0x36cfda[_0x3bb5('0x17')](0x194);}return _0x483689;};}function handleError(_0x77a60f,_0x2fc543){_0x2fc543=_0x2fc543||0x1f4;return function(_0xc1c149){logger['error'](_0xc1c149['stack']);if(_0xc1c149[_0x3bb5('0x25')]){delete _0xc1c149['name'];}_0x77a60f[_0x3bb5('0x18')](_0x2fc543)[_0x3bb5('0x26')](_0xc1c149);};}exports[_0x3bb5('0x27')]=function(_0x534b15,_0x5f40ac){var _0x19e61d={},_0x39f1ad={},_0x17ada7={'count':0x0,'rows':[]};var _0x18304c=_[_0x3bb5('0x28')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')],function(_0x5ce225){return{'name':_0x5ce225[_0x3bb5('0x2b')],'type':_0x5ce225[_0x3bb5('0x2c')][_0x3bb5('0x2d')]};});_0x39f1ad[_0x3bb5('0x2e')]=_[_0x3bb5('0x28')](_0x18304c,_0x3bb5('0x25'));_0x39f1ad[_0x3bb5('0x2f')]=_['keys'](_0x534b15[_0x3bb5('0x2f')]);_0x39f1ad[_0x3bb5('0x30')]=_['intersection'](_0x39f1ad[_0x3bb5('0x2e')],_0x39f1ad[_0x3bb5('0x2f')]);_0x19e61d[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0x39f1ad[_0x3bb5('0x2e')],qs['fields'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x19e61d[_0x3bb5('0x31')]=_0x19e61d[_0x3bb5('0x31')]['length']?_0x19e61d['attributes']:_0x39f1ad[_0x3bb5('0x2e')];if(!_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x34')](_0x3bb5('0x35'))){_0x19e61d[_0x3bb5('0x1b')]=qs[_0x3bb5('0x1b')](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1b')]);_0x19e61d[_0x3bb5('0x1a')]=qs['offset'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1a')]);}_0x19e61d['order']=qs['sort'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x36')]);_0x19e61d[_0x3bb5('0x37')]=qs[_0x3bb5('0x30')](_['pick'](_0x534b15['query'],_0x39f1ad[_0x3bb5('0x30')]),_0x18304c);if(_0x534b15['query'][_0x3bb5('0x38')]){_0x19e61d['where']=_['merge'](_0x19e61d[_0x3bb5('0x37')],{'$or':_['map'](_0x18304c,function(_0x5edb47){if(_0x5edb47[_0x3bb5('0x2c')]!==_0x3bb5('0x39')){var _0x1384cd={};_0x1384cd[_0x5edb47['name']]={'$like':'%'+_0x534b15[_0x3bb5('0x2f')]['filter']+'%'};return _0x1384cd;}})});}_0x19e61d=_[_0x3bb5('0x3a')]({},_0x19e61d,_0x534b15['options']);var _0x235e3={'where':_0x19e61d[_0x3bb5('0x37')]};return db[_0x3bb5('0x29')][_0x3bb5('0x1d')](_0x235e3)[_0x3bb5('0x22')](function(_0x261d7b){_0x17ada7['count']=_0x261d7b;if(_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x3b')]){_0x19e61d['include']=[{'all':!![]}];}return db[_0x3bb5('0x29')][_0x3bb5('0x3c')](_0x19e61d);})[_0x3bb5('0x22')](function(_0x5cfb72){_0x17ada7[_0x3bb5('0x3d')]=_0x5cfb72;return _0x17ada7;})[_0x3bb5('0x22')](respondWithFilteredResult(_0x5f40ac,_0x19e61d))['catch'](handleError(_0x5f40ac,null));};exports[_0x3bb5('0x3e')]=function(_0x40da23,_0x7a294e){var _0x2291e9={'raw':!![],'where':{'id':_0x40da23[_0x3bb5('0x3f')]['id']}},_0x663685={};_0x663685[_0x3bb5('0x2e')]=_[_0x3bb5('0x40')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')]);_0x663685[_0x3bb5('0x2f')]=_[_0x3bb5('0x40')](_0x40da23[_0x3bb5('0x2f')]);_0x663685[_0x3bb5('0x30')]=_['intersection'](_0x663685[_0x3bb5('0x2e')],_0x663685[_0x3bb5('0x2f')]);_0x2291e9['attributes']=_['intersection'](_0x663685[_0x3bb5('0x2e')],qs[_0x3bb5('0x33')](_0x40da23[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x2291e9[_0x3bb5('0x31')]=_0x2291e9[_0x3bb5('0x31')][_0x3bb5('0x41')]?_0x2291e9[_0x3bb5('0x31')]:_0x663685['model'];if(_0x40da23['query'][_0x3bb5('0x3b')]){_0x2291e9[_0x3bb5('0x42')]=[{'all':!![]}];}_0x2291e9=_[_0x3bb5('0x3a')]({},_0x2291e9,_0x40da23['options']);return db[_0x3bb5('0x29')]['find'](_0x2291e9)[_0x3bb5('0x22')](handleEntityNotFound(_0x7a294e,null))[_0x3bb5('0x22')](respondWithResult(_0x7a294e,null))[_0x3bb5('0x43')](handleError(_0x7a294e,null));};exports[_0x3bb5('0x44')]=function(_0x11352e,_0x2b7c68){return db['ZendeskField'][_0x3bb5('0x44')](_0x11352e[_0x3bb5('0x45')],{})['then'](respondWithResult(_0x2b7c68,0xc9))[_0x3bb5('0x43')](handleError(_0x2b7c68,null));};exports[_0x3bb5('0x21')]=function(_0x5075bd,_0x41edf7){if(_0x5075bd[_0x3bb5('0x45')]['id']){delete _0x5075bd[_0x3bb5('0x45')]['id'];}return db[_0x3bb5('0x29')][_0x3bb5('0x46')]({'where':{'id':_0x5075bd['params']['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x41edf7,null))[_0x3bb5('0x22')](saveUpdates(_0x5075bd['body'],null))['then'](respondWithResult(_0x41edf7,null))[_0x3bb5('0x43')](handleError(_0x41edf7,null));};exports[_0x3bb5('0x23')]=function(_0x1e5b64,_0x90d5b6){return db[_0x3bb5('0x29')]['find']({'where':{'id':_0x1e5b64[_0x3bb5('0x3f')]['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x90d5b6,null))[_0x3bb5('0x22')](removeEntity(_0x90d5b6,null))[_0x3bb5('0x43')](handleError(_0x90d5b6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3de7e5b..19db476 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 _0xfd3c=['rimraf','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x472648,_0x2dd92b){var _0x24088f=function(_0x1cc10f){while(--_0x1cc10f){_0x472648['push'](_0x472648['shift']());}};_0x24088f(++_0x2dd92b);}(_0xfd3c,0x103));var _0xcfd3=function(_0x1cbd7b,_0x4da717){_0x1cbd7b=_0x1cbd7b-0x0;var _0xa37553=_0xfd3c[_0x1cbd7b];return _0xa37553;};'use strict';var _=require(_0xcfd3('0x0'));var util=require(_0xcfd3('0x1'));var logger=require(_0xcfd3('0x2'))('api');var moment=require(_0xcfd3('0x3'));var BPromise=require(_0xcfd3('0x4'));var rp=require(_0xcfd3('0x5'));var fs=require('fs');var path=require(_0xcfd3('0x6'));var rimraf=require(_0xcfd3('0x7'));var config=require('../../config/environment');var attributes=require(_0xcfd3('0x8'));module[_0xcfd3('0x9')]=function(_0x336964,_0x4e49a9){return _0x336964[_0xcfd3('0xa')](_0xcfd3('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xcfd3('0xc'),'fields':[_0xcfd3('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3b6=['request-promise','rimraf','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4611db,_0x37b5e8){var _0x22bdae=function(_0x47d7f6){while(--_0x47d7f6){_0x4611db['push'](_0x4611db['shift']());}};_0x22bdae(++_0x37b5e8);}(_0xc3b6,0x183));var _0x6c3b=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xc3b6[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x6c3b('0x0'));var util=require(_0x6c3b('0x1'));var logger=require(_0x6c3b('0x2'))(_0x6c3b('0x3'));var moment=require(_0x6c3b('0x4'));var BPromise=require('bluebird');var rp=require(_0x6c3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c3b('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x6c3b('0x7')]=function(_0x55d2af,_0x4e6bff){return _0x55d2af[_0x6c3b('0x8')](_0x6c3b('0x9'),attributes,{'tableName':_0x6c3b('0xa'),'paranoid':![],'indexes':[{'name':_0x6c3b('0xb'),'fields':[_0x6c3b('0xc'),_0x6c3b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 58fbbe6..d4c4310 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 _0x0990=['info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x55e1f9,_0x2545e9){var _0x27909c=function(_0x2c7139){while(--_0x2c7139){_0x55e1f9['push'](_0x55e1f9['shift']());}};_0x27909c(++_0x2545e9);}(_0x0990,0xa3));var _0x0099=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x0990[_0x175a55];return _0x167adf;};'use strict';var _=require(_0x0099('0x0'));var util=require(_0x0099('0x1'));var moment=require(_0x0099('0x2'));var BPromise=require(_0x0099('0x3'));var rs=require(_0x0099('0x4'));var fs=require('fs');var Redis=require(_0x0099('0x5'));var db=require(_0x0099('0x6'))['db'];var utils=require(_0x0099('0x7'));var logger=require(_0x0099('0x8'))(_0x0099('0x9'));var config=require(_0x0099('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0099('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39e2c5,_0x54ca39,_0xe15498){return new BPromise(function(_0x23cc0e,_0x3aa541){return client['request'](_0x39e2c5,_0xe15498)[_0x0099('0xc')](function(_0x1e2c12){logger[_0x0099('0xd')](_0x0099('0xe'),_0x54ca39,'request\x20sent');logger['debug'](_0x0099('0xf'),_0x54ca39,_0x0099('0x10'),JSON['stringify'](_0x1e2c12));if(_0x1e2c12[_0x0099('0x11')]){if(_0x1e2c12['error'][_0x0099('0x12')]===0x1f4){logger[_0x0099('0x11')](_0x0099('0xe'),_0x54ca39,_0x1e2c12[_0x0099('0x11')]['message']);return _0x3aa541(_0x1e2c12[_0x0099('0x11')]['message']);}logger[_0x0099('0x11')](_0x0099('0xe'),_0x54ca39,_0x1e2c12[_0x0099('0x11')][_0x0099('0x13')]);return _0x23cc0e(_0x1e2c12['error'][_0x0099('0x13')]);}else{logger[_0x0099('0xd')](_0x0099('0xe'),_0x54ca39,'request\x20sent');_0x23cc0e(_0x1e2c12[_0x0099('0x14')][_0x0099('0x13')]);}})[_0x0099('0x15')](function(_0x53e71c){logger[_0x0099('0x11')]('ZendeskField,\x20%s,\x20%s',_0x54ca39,_0x53e71c);_0x3aa541(_0x53e71c);});});} \ No newline at end of file +var _0x7f71=['error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0x7f71,0x88));var _0x17f7=function(_0x312cd8,_0x426245){_0x312cd8=_0x312cd8-0x0;var _0x137254=_0x7f71[_0x312cd8];return _0x137254;};'use strict';var _=require(_0x17f7('0x0'));var util=require(_0x17f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17f7('0x2'));var fs=require('fs');var Redis=require(_0x17f7('0x3'));var db=require(_0x17f7('0x4'))['db'];var utils=require(_0x17f7('0x5'));var logger=require(_0x17f7('0x6'))(_0x17f7('0x7'));var config=require(_0x17f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x17f7('0x9')][_0x17f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1488b1,_0x5e71ce,_0x3c1cf8){return new BPromise(function(_0x5c2404,_0x4486d3){return client[_0x17f7('0xb')](_0x1488b1,_0x3c1cf8)['then'](function(_0x3594be){logger[_0x17f7('0xc')](_0x17f7('0xd'),_0x5e71ce,'request\x20sent');logger['debug'](_0x17f7('0xe'),_0x5e71ce,_0x17f7('0xf'),JSON['stringify'](_0x3594be));if(_0x3594be[_0x17f7('0x10')]){if(_0x3594be[_0x17f7('0x10')][_0x17f7('0x11')]===0x1f4){logger[_0x17f7('0x10')](_0x17f7('0xd'),_0x5e71ce,_0x3594be['error'][_0x17f7('0x12')]);return _0x4486d3(_0x3594be[_0x17f7('0x10')][_0x17f7('0x12')]);}logger[_0x17f7('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5e71ce,_0x3594be[_0x17f7('0x10')]['message']);return _0x5c2404(_0x3594be[_0x17f7('0x10')][_0x17f7('0x12')]);}else{logger[_0x17f7('0xc')](_0x17f7('0xd'),_0x5e71ce,_0x17f7('0xf'));_0x5c2404(_0x3594be['result'][_0x17f7('0x12')]);}})['catch'](function(_0x1f52e3){logger[_0x17f7('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5e71ce,_0x1f52e3);_0x4486d3(_0x1f52e3);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 07d6931..61f992d 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 _0xc229=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x2cf2af,_0x420b50){var _0x1b70ed=function(_0x2a885e){while(--_0x2a885e){_0x2cf2af['push'](_0x2cf2af['shift']());}};_0x1b70ed(++_0x420b50);}(_0xc229,0xa6));var _0x9c22=function(_0x590b09,_0x529595){_0x590b09=_0x590b09-0x0;var _0xd9ebb=_0xc229[_0x590b09];return _0xd9ebb;};'use strict';var multer=require(_0x9c22('0x0'));var util=require('util');var path=require(_0x9c22('0x1'));var timeout=require(_0x9c22('0x2'));var express=require(_0x9c22('0x3'));var router=express[_0x9c22('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c22('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c22('0x6'));router[_0x9c22('0x7')]('/',auth[_0x9c22('0x8')](),controller['index']);router[_0x9c22('0x7')](_0x9c22('0x9'),auth[_0x9c22('0x8')](),controller[_0x9c22('0xa')]);router[_0x9c22('0x7')](_0x9c22('0xb'),auth['isAuthenticated'](),controller[_0x9c22('0xc')]);router[_0x9c22('0x7')](_0x9c22('0xd'),auth[_0x9c22('0x8')](),controller[_0x9c22('0xe')]);router['post']('/',auth[_0x9c22('0x8')](),controller[_0x9c22('0xf')]);router[_0x9c22('0x10')]('/:id/configurations',auth[_0x9c22('0x8')](),controller[_0x9c22('0x11')]);router[_0x9c22('0x12')](_0x9c22('0x9'),auth['isAuthenticated'](),controller[_0x9c22('0x13')]);router[_0x9c22('0x14')](_0x9c22('0x9'),auth['isAuthenticated'](),controller[_0x9c22('0x15')]);module[_0x9c22('0x16')]=router; \ No newline at end of file +var _0x5020=['get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1bfd03,_0x4139f5){var _0x1bcbd5=function(_0x36ee08){while(--_0x36ee08){_0x1bfd03['push'](_0x1bfd03['shift']());}};_0x1bcbd5(++_0x4139f5);}(_0x5020,0x183));var _0x0502=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5020[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0502('0x0'));var util=require(_0x0502('0x1'));var path=require(_0x0502('0x2'));var timeout=require('connect-timeout');var express=require(_0x0502('0x3'));var router=express[_0x0502('0x4')]();var fs_extra=require(_0x0502('0x5'));var auth=require(_0x0502('0x6'));var interaction=require(_0x0502('0x7'));var config=require(_0x0502('0x8'));var controller=require('./intZohoAccount.controller');router[_0x0502('0x9')]('/',auth[_0x0502('0xa')](),controller[_0x0502('0xb')]);router[_0x0502('0x9')](_0x0502('0xc'),auth['isAuthenticated'](),controller[_0x0502('0xd')]);router[_0x0502('0x9')](_0x0502('0xe'),auth[_0x0502('0xa')](),controller['getConfigurations']);router['get'](_0x0502('0xf'),auth[_0x0502('0xa')](),controller[_0x0502('0x10')]);router['post']('/',auth[_0x0502('0xa')](),controller[_0x0502('0x11')]);router['post'](_0x0502('0xe'),auth[_0x0502('0xa')](),controller['addConfiguration']);router['put']('/:id',auth[_0x0502('0xa')](),controller[_0x0502('0x12')]);router[_0x0502('0x13')]('/:id',auth[_0x0502('0xa')](),controller[_0x0502('0x14')]);module[_0x0502('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b3edaf8..4c51e4a 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 _0xb4e6=['sequelize','STRING'];(function(_0x11e1cb,_0x537e1b){var _0x576b0f=function(_0x31a012){while(--_0x31a012){_0x11e1cb['push'](_0x11e1cb['shift']());}};_0x576b0f(++_0x537e1b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3902c1,_0x1c9eb2){_0x3902c1=_0x3902c1-0x0;var _0x1266cc=_0xb4e6[_0x3902c1];return _0x1266cc;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file +var _0xe5b3=['STRING','exports'];(function(_0x32ce61,_0x1baeb5){var _0x47dcff=function(_0x121966){while(--_0x121966){_0x32ce61['push'](_0x32ce61['shift']());}};_0x47dcff(++_0x1baeb5);}(_0xe5b3,0x133));var _0x3e5b=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0xe5b3[_0x617084];return _0x384ac0;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c1e1f72..a4e8479 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 _0xc2f1=['display_label','custom_field','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','fields','length','find','catch','body','params','getConfigurations','findOne','ZohoConfiguration','order','getSubjects','channel','type','Descriptions','create','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Start_Time','remove','includes','api_name','system_mandatory'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0xc2f1,0x88));var _0x1c2f=function(_0x288f54,_0x57d4e3){_0x288f54=_0x288f54-0x0;var _0xb740ff=_0xc2f1[_0x288f54];return _0xb740ff;};'use strict';var emlformat=require(_0x1c2f('0x0'));var rimraf=require(_0x1c2f('0x1'));var zipdir=require(_0x1c2f('0x2'));var jsonpatch=require(_0x1c2f('0x3'));var rp=require(_0x1c2f('0x4'));var moment=require(_0x1c2f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1c2f('0x6'));var sox=require(_0x1c2f('0x7'));var csv=require(_0x1c2f('0x8'));var ejs=require(_0x1c2f('0x9'));var fs=require('fs');var fs_extra=require(_0x1c2f('0xa'));var _=require(_0x1c2f('0xb'));var squel=require(_0x1c2f('0xc'));var crypto=require(_0x1c2f('0xd'));var jsforce=require(_0x1c2f('0xe'));var deskjs=require(_0x1c2f('0xf'));var toCsv=require(_0x1c2f('0x8'));var querystring=require(_0x1c2f('0x10'));var Papa=require(_0x1c2f('0x11'));var Redis=require('ioredis');var authService=require(_0x1c2f('0x12'));var qs=require(_0x1c2f('0x13'));var as=require(_0x1c2f('0x14'));var hardwareService=require(_0x1c2f('0x15'));var logger=require('../../config/logger')(_0x1c2f('0x16'));var utils=require(_0x1c2f('0x17'));var config=require(_0x1c2f('0x18'));var licenseUtil=require(_0x1c2f('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1c2f('0x1a'));function respondWithStatusCode(_0x52e0b6,_0x4d40ba){_0x4d40ba=_0x4d40ba||0xcc;return function(_0x2ab7e8){if(_0x2ab7e8){return _0x52e0b6['sendStatus'](_0x4d40ba);}return _0x52e0b6[_0x1c2f('0x1b')](_0x4d40ba)['end']();};}function respondWithResult(_0x362873,_0x25bd47){_0x25bd47=_0x25bd47||0xc8;return function(_0x1fb6a7){if(_0x1fb6a7){return _0x362873[_0x1c2f('0x1b')](_0x25bd47)[_0x1c2f('0x1c')](_0x1fb6a7);}};}function respondWithFilteredResult(_0x2475d7,_0x56c89d){return function(_0x3bae7a){if(_0x3bae7a){var _0xb749ab=typeof _0x56c89d[_0x1c2f('0x1d')]===_0x1c2f('0x1e')&&typeof _0x56c89d[_0x1c2f('0x1f')]===_0x1c2f('0x1e');var _0x3c8fe8=_0x3bae7a['count'];var _0x192c6a=_0xb749ab?0x0:_0x56c89d[_0x1c2f('0x1d')];var _0x53ed0e=_0xb749ab?_0x3bae7a[_0x1c2f('0x20')]:_0x56c89d['offset']+_0x56c89d[_0x1c2f('0x1f')];var _0x397286;if(_0x53ed0e>=_0x3c8fe8){_0x53ed0e=_0x3c8fe8;_0x397286=0xc8;}else{_0x397286=0xce;}_0x2475d7[_0x1c2f('0x1b')](_0x397286);return _0x2475d7[_0x1c2f('0x21')](_0x1c2f('0x22'),_0x192c6a+'-'+_0x53ed0e+'/'+_0x3c8fe8)[_0x1c2f('0x1c')](_0x3bae7a);}return null;};}function patchUpdates(_0x390cc0){return function(_0x277ced){try{jsonpatch[_0x1c2f('0x23')](_0x277ced,_0x390cc0,!![]);}catch(_0x2cf7ca){return BPromise[_0x1c2f('0x24')](_0x2cf7ca);}return _0x277ced[_0x1c2f('0x25')]();};}function saveUpdates(_0x2d7cc5,_0xfd7181){return function(_0x51de7e){if(_0x51de7e){return _0x51de7e[_0x1c2f('0x26')](_0x2d7cc5)[_0x1c2f('0x27')](function(_0x5b287b){return _0x5b287b;});}return null;};}function removeEntity(_0x70e6b3,_0x1c58a5){return function(_0x5a40e5){if(_0x5a40e5){return _0x5a40e5[_0x1c2f('0x28')]()[_0x1c2f('0x27')](function(){_0x70e6b3[_0x1c2f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d98c,_0x1d660c){return function(_0x484d32){if(!_0x484d32){_0x11d98c['sendStatus'](0x194);}return _0x484d32;};}function handleError(_0x323254,_0x4b04a0){_0x4b04a0=_0x4b04a0||0x1f4;return function(_0x1c052e){logger[_0x1c2f('0x29')](_0x1c052e['stack']);if(_0x1c052e['name']){delete _0x1c052e[_0x1c2f('0x2a')];}_0x323254['status'](_0x4b04a0)[_0x1c2f('0x2b')](_0x1c052e);};}exports[_0x1c2f('0x2c')]=function(_0x3f90b5,_0x1f372d){var _0x5291b1={},_0x2c9cde={},_0x4a46eb={'count':0x0,'rows':[]};var _0x179864=_[_0x1c2f('0x2d')](db[_0x1c2f('0x2e')][_0x1c2f('0x2f')],function(_0xb7c9ee){return{'name':_0xb7c9ee[_0x1c2f('0x30')],'type':_0xb7c9ee['type']['key']};});_0x2c9cde[_0x1c2f('0x31')]=_['map'](_0x179864,'name');_0x2c9cde[_0x1c2f('0x32')]=_[_0x1c2f('0x33')](_0x3f90b5[_0x1c2f('0x32')]);_0x2c9cde[_0x1c2f('0x34')]=_[_0x1c2f('0x35')](_0x2c9cde[_0x1c2f('0x31')],_0x2c9cde['query']);_0x5291b1[_0x1c2f('0x36')]=_['intersection'](_0x2c9cde[_0x1c2f('0x31')],qs['fields'](_0x3f90b5[_0x1c2f('0x32')]['fields']));_0x5291b1['attributes']=_0x5291b1[_0x1c2f('0x36')]['length']?_0x5291b1[_0x1c2f('0x36')]:_0x2c9cde[_0x1c2f('0x31')];if(!_0x3f90b5[_0x1c2f('0x32')][_0x1c2f('0x37')](_0x1c2f('0x38'))){_0x5291b1[_0x1c2f('0x1f')]=qs[_0x1c2f('0x1f')](_0x3f90b5[_0x1c2f('0x32')]['limit']);_0x5291b1[_0x1c2f('0x1d')]=qs[_0x1c2f('0x1d')](_0x3f90b5[_0x1c2f('0x32')]['offset']);}_0x5291b1['order']=qs['sort'](_0x3f90b5[_0x1c2f('0x32')][_0x1c2f('0x39')]);_0x5291b1[_0x1c2f('0x3a')]=qs[_0x1c2f('0x34')](_[_0x1c2f('0x3b')](_0x3f90b5[_0x1c2f('0x32')],_0x2c9cde['filters']),_0x179864);if(_0x3f90b5[_0x1c2f('0x32')][_0x1c2f('0x3c')]){_0x5291b1[_0x1c2f('0x3a')]=_[_0x1c2f('0x3d')](_0x5291b1[_0x1c2f('0x3a')],{'$or':_[_0x1c2f('0x2d')](_0x179864,function(_0x520f5d){if(_0x520f5d['type']!==_0x1c2f('0x3e')){var _0x268248={};_0x268248[_0x520f5d['name']]={'$like':'%'+_0x3f90b5[_0x1c2f('0x32')][_0x1c2f('0x3c')]+'%'};return _0x268248;}})});}_0x5291b1=_['merge']({},_0x5291b1,_0x3f90b5[_0x1c2f('0x3f')]);var _0x5a60e2={'where':_0x5291b1['where']};return db[_0x1c2f('0x2e')][_0x1c2f('0x20')](_0x5a60e2)['then'](function(_0x483338){_0x4a46eb['count']=_0x483338;if(_0x3f90b5['query'][_0x1c2f('0x40')]){_0x5291b1[_0x1c2f('0x41')]=[{'all':!![]}];}return db[_0x1c2f('0x2e')][_0x1c2f('0x42')](_0x5291b1);})['then'](function(_0x476f5b){_0x4a46eb[_0x1c2f('0x43')]=_0x476f5b;return _0x4a46eb;})['then'](respondWithFilteredResult(_0x1f372d,_0x5291b1))['catch'](handleError(_0x1f372d,null));};exports[_0x1c2f('0x44')]=function(_0x1d1445,_0x5ee5ef){var _0x163a5b={'raw':![],'where':{'id':_0x1d1445['params']['id']}},_0x39c223={};_0x39c223[_0x1c2f('0x31')]=_[_0x1c2f('0x33')](db[_0x1c2f('0x2e')]['rawAttributes']);_0x39c223[_0x1c2f('0x32')]=_[_0x1c2f('0x33')](_0x1d1445[_0x1c2f('0x32')]);_0x39c223[_0x1c2f('0x34')]=_[_0x1c2f('0x35')](_0x39c223[_0x1c2f('0x31')],_0x39c223['query']);_0x163a5b['attributes']=_[_0x1c2f('0x35')](_0x39c223[_0x1c2f('0x31')],qs[_0x1c2f('0x45')](_0x1d1445['query']['fields']));_0x163a5b[_0x1c2f('0x36')]=_0x163a5b['attributes'][_0x1c2f('0x46')]?_0x163a5b[_0x1c2f('0x36')]:_0x39c223[_0x1c2f('0x31')];if(_0x1d1445[_0x1c2f('0x32')][_0x1c2f('0x40')]){_0x163a5b['include']=[{'all':!![]}];}_0x163a5b=_[_0x1c2f('0x3d')]({},_0x163a5b,_0x1d1445[_0x1c2f('0x3f')]);return db['ZohoAccount'][_0x1c2f('0x47')](_0x163a5b)[_0x1c2f('0x27')](handleEntityNotFound(_0x5ee5ef,null))['then'](respondWithResult(_0x5ee5ef,null))[_0x1c2f('0x48')](handleError(_0x5ee5ef,null));};exports['create']=function(_0x269ee6,_0x1afc40){return db[_0x1c2f('0x2e')]['create'](_0x269ee6[_0x1c2f('0x49')],{})[_0x1c2f('0x27')](respondWithResult(_0x1afc40,0xc9))[_0x1c2f('0x48')](handleError(_0x1afc40,null));};exports[_0x1c2f('0x26')]=function(_0x4beeb9,_0x21995a){if(_0x4beeb9[_0x1c2f('0x49')]['id']){delete _0x4beeb9[_0x1c2f('0x49')]['id'];}return db[_0x1c2f('0x2e')][_0x1c2f('0x47')]({'where':{'id':_0x4beeb9[_0x1c2f('0x4a')]['id']}})[_0x1c2f('0x27')](handleEntityNotFound(_0x21995a,null))[_0x1c2f('0x27')](saveUpdates(_0x4beeb9[_0x1c2f('0x49')],null))[_0x1c2f('0x27')](respondWithResult(_0x21995a,null))[_0x1c2f('0x48')](handleError(_0x21995a,null));};exports[_0x1c2f('0x28')]=function(_0x98f298,_0x3e0e21){return db[_0x1c2f('0x2e')][_0x1c2f('0x47')]({'where':{'id':_0x98f298[_0x1c2f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e0e21,null))[_0x1c2f('0x27')](removeEntity(_0x3e0e21,null))[_0x1c2f('0x48')](handleError(_0x3e0e21,null));};exports[_0x1c2f('0x4b')]=function(_0x36231a,_0x5438e4,_0x2a1091){var _0x594263={};var _0x5d3d11={};var _0x55a633;var _0x2c53b9;return db['ZohoAccount'][_0x1c2f('0x4c')]({'where':{'id':_0x36231a[_0x1c2f('0x4a')]['id']}})[_0x1c2f('0x27')](handleEntityNotFound(_0x5438e4,null))[_0x1c2f('0x27')](function(_0x330f15){if(_0x330f15){_0x55a633=_0x330f15;_0x5d3d11[_0x1c2f('0x31')]=_[_0x1c2f('0x33')](db[_0x1c2f('0x4d')]['rawAttributes']);_0x5d3d11[_0x1c2f('0x32')]=_[_0x1c2f('0x33')](_0x36231a[_0x1c2f('0x32')]);_0x5d3d11['filters']=_['intersection'](_0x5d3d11['model'],_0x5d3d11[_0x1c2f('0x32')]);_0x594263[_0x1c2f('0x36')]=_[_0x1c2f('0x35')](_0x5d3d11[_0x1c2f('0x31')],qs[_0x1c2f('0x45')](_0x36231a[_0x1c2f('0x32')][_0x1c2f('0x45')]));_0x594263['attributes']=_0x594263['attributes'][_0x1c2f('0x46')]?_0x594263[_0x1c2f('0x36')]:_0x5d3d11[_0x1c2f('0x31')];_0x594263[_0x1c2f('0x4e')]=qs[_0x1c2f('0x39')](_0x36231a[_0x1c2f('0x32')][_0x1c2f('0x39')]);_0x594263[_0x1c2f('0x3a')]=qs[_0x1c2f('0x34')](_[_0x1c2f('0x3b')](_0x36231a[_0x1c2f('0x32')],_0x5d3d11['filters']));if(_0x36231a[_0x1c2f('0x32')][_0x1c2f('0x3c')]){_0x594263[_0x1c2f('0x3a')]=_[_0x1c2f('0x3d')](_0x594263[_0x1c2f('0x3a')],{'$or':_[_0x1c2f('0x2d')](_0x594263[_0x1c2f('0x36')],function(_0x2125ec){var _0x387b99={};_0x387b99[_0x2125ec]={'$like':'%'+_0x36231a[_0x1c2f('0x32')][_0x1c2f('0x3c')]+'%'};return _0x387b99;})});}_0x594263=_[_0x1c2f('0x3d')]({},_0x594263,_0x36231a[_0x1c2f('0x3f')]);return _0x55a633['getConfigurations'](_0x594263);}})[_0x1c2f('0x27')](function(_0x30f68b){if(_0x30f68b){_0x2c53b9=_0x30f68b[_0x1c2f('0x46')];if(!_0x36231a[_0x1c2f('0x32')]['hasOwnProperty'](_0x1c2f('0x38'))){_0x594263[_0x1c2f('0x1f')]=qs['limit'](_0x36231a[_0x1c2f('0x32')][_0x1c2f('0x1f')]);_0x594263['offset']=qs[_0x1c2f('0x1d')](_0x36231a[_0x1c2f('0x32')][_0x1c2f('0x1d')]);}return _0x55a633[_0x1c2f('0x4b')](_0x594263);}})['then'](function(_0x957b2a){if(_0x957b2a){return _0x957b2a?{'count':_0x2c53b9,'rows':_0x957b2a}:null;}})[_0x1c2f('0x27')](respondWithResult(_0x5438e4,null))[_0x1c2f('0x48')](handleError(_0x5438e4,null));};exports['addConfiguration']=function(_0xb8a643,_0x57e021,_0x1bd9c9){if(_0xb8a643[_0x1c2f('0x49')]['id']){delete _0xb8a643['body']['id'];}return db[_0x1c2f('0x2e')][_0x1c2f('0x4c')]({'where':{'id':_0xb8a643[_0x1c2f('0x4a')]['id']}})[_0x1c2f('0x27')](handleEntityNotFound(_0x57e021,null))['then'](function(_0x568455){if(_0x568455){_0xb8a643[_0x1c2f('0x49')]['AccountId']=_0x568455['id'];_0xb8a643[_0x1c2f('0x49')]['Subjects']=integrations[_0x1c2f('0x4f')](_0xb8a643[_0x1c2f('0x49')][_0x1c2f('0x50')],_0xb8a643['body'][_0x1c2f('0x51')]);_0xb8a643[_0x1c2f('0x49')][_0x1c2f('0x52')]=integrations['getDescriptions'](_0xb8a643[_0x1c2f('0x49')][_0x1c2f('0x50')],_0xb8a643[_0x1c2f('0x49')][_0x1c2f('0x51')]);return db[_0x1c2f('0x4d')][_0x1c2f('0x53')](_0xb8a643['body'],{'include':[{'model':db[_0x1c2f('0x54')],'as':_0x1c2f('0x55')},{'model':db[_0x1c2f('0x54')],'as':_0x1c2f('0x52')}]});}return null;})[_0x1c2f('0x27')](respondWithResult(_0x57e021,null))[_0x1c2f('0x48')](handleError(_0x57e021,null));};function getAccessToken(_0x3066ef){return new Promise(function(_0x299f52,_0x561aee){var _0x2f2e85;switch(_0x3066ef[_0x1c2f('0x56')]){case'US':_0x2f2e85=_0x1c2f('0x57');break;case'AU':_0x2f2e85=_0x1c2f('0x58');break;case'EU':_0x2f2e85=_0x1c2f('0x59');break;case'IN':_0x2f2e85=_0x1c2f('0x5a');break;case'CN':_0x2f2e85='https://accounts.zoho.com.cn';break;default:_0x2f2e85=_0x1c2f('0x59');break;}var _0x229180={'method':_0x1c2f('0x5b'),'uri':_0x2f2e85+_0x1c2f('0x5c'),'qs':{'refresh_token':_0x3066ef[_0x1c2f('0x5d')],'client_id':_0x3066ef[_0x1c2f('0x5e')],'client_secret':_0x3066ef['clientSecret'],'grant_type':_0x1c2f('0x5f')},'json':!![]};return rp(_0x229180)[_0x1c2f('0x27')](function(_0x4a820a){if(_0x4a820a[_0x1c2f('0x60')]){_0x299f52(_0x4a820a['access_token']);}else{_0x561aee(_0x1c2f('0x61'));}})[_0x1c2f('0x48')](function(_0x35e908){_0x561aee(_0x35e908);});});}exports[_0x1c2f('0x62')]=function(_0x483888,_0xb46706,_0x237b63){var _0x11fb03,_0x4611e7,_0x5de0cc,_0x18e92,_0x5c2769;return db[_0x1c2f('0x2e')]['findOne']({'where':{'id':_0x483888[_0x1c2f('0x4a')]['id']},'attributes':['id',_0x1c2f('0x63'),_0x1c2f('0x56'),'clientId',_0x1c2f('0x64'),_0x1c2f('0x65'),_0x1c2f('0x66'),_0x1c2f('0x5d')]})['then'](handleEntityNotFound(_0xb46706,null))[_0x1c2f('0x27')](function(_0x46f167){_0x5c2769=_0x46f167;_0x11fb03=_0x5c2769[_0x1c2f('0x63')];_0x4611e7=_0x11fb03===_0x1c2f('0x67')?'eu':'com';_0x5de0cc=_0x5c2769['serverUrl'];var _0x1491f4=_0x5de0cc[_0x1c2f('0x68')](-0x1);if(_0x1491f4==='/'||_0x1491f4==='\x5c'||_0x1491f4===':'){_0x5de0cc=_0x5de0cc[_0x1c2f('0x69')](0x0,_0x5de0cc[_0x1c2f('0x6a')](_0x1491f4));}if(!_0x5c2769[_0x1c2f('0x5d')]){throw new Error(_0x1c2f('0x6b'));}return getAccessToken(_0x5c2769);})[_0x1c2f('0x27')](function(_0x12e933){if(_0x12e933){return rp({'method':_0x1c2f('0x6c'),'uri':util['format'](_0x1c2f('0x6d'),_0x4611e7),'qs':{'module':'Calls'},'headers':{'Authorization':_0x1c2f('0x6e')+_0x12e933},'json':!![]});}})['then'](function(_0x49da68){if(_0x49da68){if(_0x49da68[_0x1c2f('0x6f')]&&_0x49da68[_0x1c2f('0x6f')][_0x1c2f('0x29')]){throw new Error(_0x49da68[_0x1c2f('0x6f')][_0x1c2f('0x29')]['message']);}var _0x13028a=[];var _0x168f71=[];var _0xa85033=[_0x1c2f('0x70'),_0x1c2f('0x71'),'Description',_0x1c2f('0x72'),'Call_Duration','Call_Result',_0x1c2f('0x73'),'Call_Type'];_0x168f71=_[_0x1c2f('0x74')](_0x49da68['fields'],function(_0x43ae73){return _0xa85033[_0x1c2f('0x75')](_0x43ae73[_0x1c2f('0x76')]);});for(var _0x268aa3=0x0;_0x268aa3<_0x168f71[_0x1c2f('0x46')];_0x268aa3++){if(_0x168f71[_0x268aa3][_0x1c2f('0x77')]===![]){_0x13028a['push']({'id':_0x168f71[_0x268aa3]['id'],'name':_0x168f71[_0x268aa3][_0x1c2f('0x78')],'custom':_0x168f71[_0x268aa3][_0x1c2f('0x79')],'options':_0x168f71[_0x268aa3][_0x1c2f('0x7a')]===_0x1c2f('0x7b')&&_0x168f71[_0x268aa3]['pick_list_values'][_0x1c2f('0x46')]>-0x1?_[_0x1c2f('0x2d')](_0x168f71[_0x268aa3]['pick_list_values'],function(_0xdb2643){return{'name':_0xdb2643,'value':_0xdb2643};}):[]});}}return{'count':_0x13028a[_0x1c2f('0x46')],'rows':_0x13028a};}else{return{'count':0x0,'rows':[]};}})[_0x1c2f('0x27')](respondWithResult(_0xb46706,null))[_0x1c2f('0x48')](function(_0x102b14){var _0x4da68c=_0x483888['query'][_0x1c2f('0x7c')]?0x1f4:_0x102b14[_0x1c2f('0x7d')]||0x1f4;logger['error'](_0x1c2f('0x7e'),'getFields',_0x4da68c,JSON[_0x1c2f('0x7f')](_0x102b14));delete _0x102b14[_0x1c2f('0x2a')];if(_0x4da68c===0x191){_0x4da68c=0x190;}_0xb46706[_0x1c2f('0x1b')](_0x4da68c)[_0x1c2f('0x2b')](_0x483888[_0x1c2f('0x32')][_0x1c2f('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x102b14[_0x1c2f('0x7d')]}:_0x102b14);});}; \ No newline at end of file +var _0x8f3e=['AccountId','Subjects','getSubjects','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','zone','serverUrl','code','refreshToken','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','response','error','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','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/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','send','map','ZohoAccount','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','getConfigurations','addConfiguration'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x8f3e,0xb9));var _0xe8f3=function(_0x549965,_0x2e7360){_0x549965=_0x549965-0x0;var _0x463a17=_0x8f3e[_0x549965];return _0x463a17;};'use strict';var emlformat=require(_0xe8f3('0x0'));var rimraf=require(_0xe8f3('0x1'));var zipdir=require(_0xe8f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe8f3('0x3'));var BPromise=require(_0xe8f3('0x4'));var Mustache=require('mustache');var util=require(_0xe8f3('0x5'));var path=require(_0xe8f3('0x6'));var sox=require(_0xe8f3('0x7'));var csv=require(_0xe8f3('0x8'));var ejs=require(_0xe8f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8f3('0xa'));var squel=require(_0xe8f3('0xb'));var crypto=require(_0xe8f3('0xc'));var jsforce=require(_0xe8f3('0xd'));var deskjs=require(_0xe8f3('0xe'));var toCsv=require(_0xe8f3('0x8'));var querystring=require(_0xe8f3('0xf'));var Papa=require(_0xe8f3('0x10'));var Redis=require(_0xe8f3('0x11'));var authService=require(_0xe8f3('0x12'));var qs=require(_0xe8f3('0x13'));var as=require(_0xe8f3('0x14'));var hardwareService=require(_0xe8f3('0x15'));var logger=require('../../config/logger')(_0xe8f3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe8f3('0x17'));var db=require(_0xe8f3('0x18'))['db'];var integrations=require(_0xe8f3('0x19'));function respondWithStatusCode(_0x310114,_0x55c277){_0x55c277=_0x55c277||0xcc;return function(_0x43fd53){if(_0x43fd53){return _0x310114[_0xe8f3('0x1a')](_0x55c277);}return _0x310114[_0xe8f3('0x1b')](_0x55c277)['end']();};}function respondWithResult(_0x515190,_0x834f62){_0x834f62=_0x834f62||0xc8;return function(_0x27fd5b){if(_0x27fd5b){return _0x515190['status'](_0x834f62)[_0xe8f3('0x1c')](_0x27fd5b);}};}function respondWithFilteredResult(_0x57a5ad,_0x279880){return function(_0x14e062){if(_0x14e062){var _0x5aa57f=typeof _0x279880[_0xe8f3('0x1d')]==='undefined'&&typeof _0x279880[_0xe8f3('0x1e')]===_0xe8f3('0x1f');var _0x5ca67a=_0x14e062[_0xe8f3('0x20')];var _0x3feab9=_0x5aa57f?0x0:_0x279880[_0xe8f3('0x1d')];var _0x94939e=_0x5aa57f?_0x14e062[_0xe8f3('0x20')]:_0x279880[_0xe8f3('0x1d')]+_0x279880[_0xe8f3('0x1e')];var _0x48e6f2;if(_0x94939e>=_0x5ca67a){_0x94939e=_0x5ca67a;_0x48e6f2=0xc8;}else{_0x48e6f2=0xce;}_0x57a5ad[_0xe8f3('0x1b')](_0x48e6f2);return _0x57a5ad[_0xe8f3('0x21')](_0xe8f3('0x22'),_0x3feab9+'-'+_0x94939e+'/'+_0x5ca67a)['json'](_0x14e062);}return null;};}function patchUpdates(_0x453b14){return function(_0x2f6f39){try{jsonpatch[_0xe8f3('0x23')](_0x2f6f39,_0x453b14,!![]);}catch(_0x28efd8){return BPromise[_0xe8f3('0x24')](_0x28efd8);}return _0x2f6f39[_0xe8f3('0x25')]();};}function saveUpdates(_0x24dd46,_0x1834e6){return function(_0x3b34e7){if(_0x3b34e7){return _0x3b34e7['update'](_0x24dd46)[_0xe8f3('0x26')](function(_0x3949c3){return _0x3949c3;});}return null;};}function removeEntity(_0x4cfd7e,_0x4caee1){return function(_0x322372){if(_0x322372){return _0x322372[_0xe8f3('0x27')]()[_0xe8f3('0x26')](function(){_0x4cfd7e[_0xe8f3('0x1b')](0xcc)[_0xe8f3('0x28')]();});}};}function handleEntityNotFound(_0x152148,_0x72a824){return function(_0x518db0){if(!_0x518db0){_0x152148['sendStatus'](0x194);}return _0x518db0;};}function handleError(_0x549c26,_0x21699e){_0x21699e=_0x21699e||0x1f4;return function(_0x215b46){logger['error'](_0x215b46[_0xe8f3('0x29')]);if(_0x215b46['name']){delete _0x215b46['name'];}_0x549c26[_0xe8f3('0x1b')](_0x21699e)[_0xe8f3('0x2a')](_0x215b46);};}exports['index']=function(_0x160d19,_0x1c928a){var _0x2cb782={},_0x1e0d12={},_0x1c1df2={'count':0x0,'rows':[]};var _0x5bffe5=_[_0xe8f3('0x2b')](db[_0xe8f3('0x2c')][_0xe8f3('0x2d')],function(_0x23e0c2){return{'name':_0x23e0c2[_0xe8f3('0x2e')],'type':_0x23e0c2[_0xe8f3('0x2f')][_0xe8f3('0x30')]};});_0x1e0d12['model']=_[_0xe8f3('0x2b')](_0x5bffe5,_0xe8f3('0x31'));_0x1e0d12[_0xe8f3('0x32')]=_[_0xe8f3('0x33')](_0x160d19[_0xe8f3('0x32')]);_0x1e0d12[_0xe8f3('0x34')]=_[_0xe8f3('0x35')](_0x1e0d12['model'],_0x1e0d12[_0xe8f3('0x32')]);_0x2cb782[_0xe8f3('0x36')]=_[_0xe8f3('0x35')](_0x1e0d12[_0xe8f3('0x37')],qs['fields'](_0x160d19['query'][_0xe8f3('0x38')]));_0x2cb782['attributes']=_0x2cb782[_0xe8f3('0x36')][_0xe8f3('0x39')]?_0x2cb782['attributes']:_0x1e0d12[_0xe8f3('0x37')];if(!_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x3a')](_0xe8f3('0x3b'))){_0x2cb782[_0xe8f3('0x1e')]=qs['limit'](_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x1e')]);_0x2cb782[_0xe8f3('0x1d')]=qs[_0xe8f3('0x1d')](_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x1d')]);}_0x2cb782[_0xe8f3('0x3c')]=qs[_0xe8f3('0x3d')](_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x3d')]);_0x2cb782['where']=qs[_0xe8f3('0x34')](_[_0xe8f3('0x3e')](_0x160d19['query'],_0x1e0d12[_0xe8f3('0x34')]),_0x5bffe5);if(_0x160d19['query']['filter']){_0x2cb782[_0xe8f3('0x3f')]=_[_0xe8f3('0x40')](_0x2cb782[_0xe8f3('0x3f')],{'$or':_['map'](_0x5bffe5,function(_0x1b2547){if(_0x1b2547[_0xe8f3('0x2f')]!==_0xe8f3('0x41')){var _0x292e5a={};_0x292e5a[_0x1b2547[_0xe8f3('0x31')]]={'$like':'%'+_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x42')]+'%'};return _0x292e5a;}})});}_0x2cb782=_['merge']({},_0x2cb782,_0x160d19[_0xe8f3('0x43')]);var _0xde8b1d={'where':_0x2cb782[_0xe8f3('0x3f')]};return db[_0xe8f3('0x2c')][_0xe8f3('0x20')](_0xde8b1d)[_0xe8f3('0x26')](function(_0x1d3994){_0x1c1df2['count']=_0x1d3994;if(_0x160d19[_0xe8f3('0x32')][_0xe8f3('0x44')]){_0x2cb782[_0xe8f3('0x45')]=[{'all':!![]}];}return db[_0xe8f3('0x2c')][_0xe8f3('0x46')](_0x2cb782);})[_0xe8f3('0x26')](function(_0x3acc4a){_0x1c1df2[_0xe8f3('0x47')]=_0x3acc4a;return _0x1c1df2;})[_0xe8f3('0x26')](respondWithFilteredResult(_0x1c928a,_0x2cb782))[_0xe8f3('0x48')](handleError(_0x1c928a,null));};exports[_0xe8f3('0x49')]=function(_0x15d2c0,_0x2a3760){var _0x58aa50={'raw':![],'where':{'id':_0x15d2c0[_0xe8f3('0x4a')]['id']}},_0x1c78ad={};_0x1c78ad[_0xe8f3('0x37')]=_[_0xe8f3('0x33')](db[_0xe8f3('0x2c')][_0xe8f3('0x2d')]);_0x1c78ad[_0xe8f3('0x32')]=_['keys'](_0x15d2c0[_0xe8f3('0x32')]);_0x1c78ad['filters']=_[_0xe8f3('0x35')](_0x1c78ad[_0xe8f3('0x37')],_0x1c78ad[_0xe8f3('0x32')]);_0x58aa50[_0xe8f3('0x36')]=_[_0xe8f3('0x35')](_0x1c78ad[_0xe8f3('0x37')],qs[_0xe8f3('0x38')](_0x15d2c0[_0xe8f3('0x32')][_0xe8f3('0x38')]));_0x58aa50['attributes']=_0x58aa50['attributes'][_0xe8f3('0x39')]?_0x58aa50[_0xe8f3('0x36')]:_0x1c78ad[_0xe8f3('0x37')];if(_0x15d2c0[_0xe8f3('0x32')]['includeAll']){_0x58aa50[_0xe8f3('0x45')]=[{'all':!![]}];}_0x58aa50=_[_0xe8f3('0x40')]({},_0x58aa50,_0x15d2c0[_0xe8f3('0x43')]);return db[_0xe8f3('0x2c')]['find'](_0x58aa50)[_0xe8f3('0x26')](handleEntityNotFound(_0x2a3760,null))[_0xe8f3('0x26')](respondWithResult(_0x2a3760,null))[_0xe8f3('0x48')](handleError(_0x2a3760,null));};exports[_0xe8f3('0x4b')]=function(_0x263b73,_0x1366e6){return db[_0xe8f3('0x2c')][_0xe8f3('0x4b')](_0x263b73[_0xe8f3('0x4c')],{})[_0xe8f3('0x26')](respondWithResult(_0x1366e6,0xc9))['catch'](handleError(_0x1366e6,null));};exports['update']=function(_0x89e066,_0x321a7d){if(_0x89e066['body']['id']){delete _0x89e066[_0xe8f3('0x4c')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x89e066[_0xe8f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x321a7d,null))['then'](saveUpdates(_0x89e066[_0xe8f3('0x4c')],null))[_0xe8f3('0x26')](respondWithResult(_0x321a7d,null))[_0xe8f3('0x48')](handleError(_0x321a7d,null));};exports[_0xe8f3('0x27')]=function(_0x2ff050,_0xd6f81b){return db['ZohoAccount'][_0xe8f3('0x4d')]({'where':{'id':_0x2ff050['params']['id']}})[_0xe8f3('0x26')](handleEntityNotFound(_0xd6f81b,null))[_0xe8f3('0x26')](removeEntity(_0xd6f81b,null))[_0xe8f3('0x48')](handleError(_0xd6f81b,null));};exports['getConfigurations']=function(_0x419aea,_0x1639fd,_0x4c8e00){var _0x16cec1={};var _0x18f3e9={};var _0x375347;var _0x7f7930;return db['ZohoAccount'][_0xe8f3('0x4e')]({'where':{'id':_0x419aea[_0xe8f3('0x4a')]['id']}})[_0xe8f3('0x26')](handleEntityNotFound(_0x1639fd,null))[_0xe8f3('0x26')](function(_0x81f1f6){if(_0x81f1f6){_0x375347=_0x81f1f6;_0x18f3e9['model']=_['keys'](db['ZohoConfiguration'][_0xe8f3('0x2d')]);_0x18f3e9[_0xe8f3('0x32')]=_[_0xe8f3('0x33')](_0x419aea[_0xe8f3('0x32')]);_0x18f3e9[_0xe8f3('0x34')]=_[_0xe8f3('0x35')](_0x18f3e9[_0xe8f3('0x37')],_0x18f3e9[_0xe8f3('0x32')]);_0x16cec1[_0xe8f3('0x36')]=_[_0xe8f3('0x35')](_0x18f3e9[_0xe8f3('0x37')],qs[_0xe8f3('0x38')](_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x38')]));_0x16cec1[_0xe8f3('0x36')]=_0x16cec1[_0xe8f3('0x36')][_0xe8f3('0x39')]?_0x16cec1[_0xe8f3('0x36')]:_0x18f3e9['model'];_0x16cec1[_0xe8f3('0x3c')]=qs[_0xe8f3('0x3d')](_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x3d')]);_0x16cec1['where']=qs['filters'](_['pick'](_0x419aea[_0xe8f3('0x32')],_0x18f3e9[_0xe8f3('0x34')]));if(_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x42')]){_0x16cec1[_0xe8f3('0x3f')]=_[_0xe8f3('0x40')](_0x16cec1['where'],{'$or':_['map'](_0x16cec1['attributes'],function(_0x8c7abd){var _0x5d64c9={};_0x5d64c9[_0x8c7abd]={'$like':'%'+_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x42')]+'%'};return _0x5d64c9;})});}_0x16cec1=_['merge']({},_0x16cec1,_0x419aea[_0xe8f3('0x43')]);return _0x375347[_0xe8f3('0x4f')](_0x16cec1);}})['then'](function(_0x2bfe25){if(_0x2bfe25){_0x7f7930=_0x2bfe25['length'];if(!_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x3a')](_0xe8f3('0x3b'))){_0x16cec1[_0xe8f3('0x1e')]=qs[_0xe8f3('0x1e')](_0x419aea['query'][_0xe8f3('0x1e')]);_0x16cec1[_0xe8f3('0x1d')]=qs[_0xe8f3('0x1d')](_0x419aea[_0xe8f3('0x32')][_0xe8f3('0x1d')]);}return _0x375347['getConfigurations'](_0x16cec1);}})[_0xe8f3('0x26')](function(_0x273f76){if(_0x273f76){return _0x273f76?{'count':_0x7f7930,'rows':_0x273f76}:null;}})[_0xe8f3('0x26')](respondWithResult(_0x1639fd,null))[_0xe8f3('0x48')](handleError(_0x1639fd,null));};exports[_0xe8f3('0x50')]=function(_0x3f2389,_0x4890ea,_0x2799aa){if(_0x3f2389[_0xe8f3('0x4c')]['id']){delete _0x3f2389['body']['id'];}return db[_0xe8f3('0x2c')]['findOne']({'where':{'id':_0x3f2389[_0xe8f3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4890ea,null))['then'](function(_0x40d551){if(_0x40d551){_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x51')]=_0x40d551['id'];_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x52')]=integrations[_0xe8f3('0x53')](_0x3f2389[_0xe8f3('0x4c')]['channel'],_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x2f')]);_0x3f2389[_0xe8f3('0x4c')]['Descriptions']=integrations[_0xe8f3('0x54')](_0x3f2389[_0xe8f3('0x4c')]['channel'],_0x3f2389[_0xe8f3('0x4c')][_0xe8f3('0x2f')]);return db[_0xe8f3('0x55')][_0xe8f3('0x4b')](_0x3f2389['body'],{'include':[{'model':db[_0xe8f3('0x56')],'as':_0xe8f3('0x52')},{'model':db[_0xe8f3('0x56')],'as':_0xe8f3('0x57')}]});}return null;})[_0xe8f3('0x26')](respondWithResult(_0x4890ea,null))['catch'](handleError(_0x4890ea,null));};function getAccessToken(_0x2a959d){return new Promise(function(_0x256794,_0x2f401a){var _0xc60b5d;switch(_0x2a959d['zone']){case'US':_0xc60b5d=_0xe8f3('0x58');break;case'AU':_0xc60b5d=_0xe8f3('0x59');break;case'EU':_0xc60b5d=_0xe8f3('0x5a');break;case'IN':_0xc60b5d='https://accounts.zoho.in';break;case'CN':_0xc60b5d=_0xe8f3('0x5b');break;default:_0xc60b5d=_0xe8f3('0x5a');break;}var _0x496c22={'method':_0xe8f3('0x5c'),'uri':_0xc60b5d+_0xe8f3('0x5d'),'qs':{'refresh_token':_0x2a959d['refreshToken'],'client_id':_0x2a959d[_0xe8f3('0x5e')],'client_secret':_0x2a959d[_0xe8f3('0x5f')],'grant_type':_0xe8f3('0x60')},'json':!![]};return rp(_0x496c22)[_0xe8f3('0x26')](function(_0x2e83f6){if(_0x2e83f6['access_token']){_0x256794(_0x2e83f6[_0xe8f3('0x61')]);}else{_0x2f401a(_0xe8f3('0x62'));}})['catch'](function(_0x3f3887){_0x2f401a(_0x3f3887);});});}exports['getFields']=function(_0xbd5ac4,_0x29e994,_0x2d609e){var _0x4a4de6,_0xa73213,_0x3f185d,_0x44b27d,_0x2a9001;return db[_0xe8f3('0x2c')][_0xe8f3('0x4e')]({'where':{'id':_0xbd5ac4[_0xe8f3('0x4a')]['id']},'attributes':['id','host',_0xe8f3('0x63'),_0xe8f3('0x5e'),'clientSecret',_0xe8f3('0x64'),_0xe8f3('0x65'),_0xe8f3('0x66')]})[_0xe8f3('0x26')](handleEntityNotFound(_0x29e994,null))[_0xe8f3('0x26')](function(_0x24ee67){_0x2a9001=_0x24ee67;_0x4a4de6=_0x2a9001[_0xe8f3('0x67')];_0xa73213=_0x4a4de6===_0xe8f3('0x68')?'eu':_0xe8f3('0x69');_0x3f185d=_0x2a9001[_0xe8f3('0x64')];var _0x39723f=_0x3f185d[_0xe8f3('0x6a')](-0x1);if(_0x39723f==='/'||_0x39723f==='\x5c'||_0x39723f===':'){_0x3f185d=_0x3f185d['substring'](0x0,_0x3f185d[_0xe8f3('0x6b')](_0x39723f));}if(!_0x2a9001[_0xe8f3('0x66')]){throw new Error(_0xe8f3('0x6c'));}return getAccessToken(_0x2a9001);})[_0xe8f3('0x26')](function(_0x3369a0){if(_0x3369a0){return rp({'method':'GET','uri':util[_0xe8f3('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xa73213),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3369a0},'json':!![]});}})[_0xe8f3('0x26')](function(_0x4dc850){if(_0x4dc850){if(_0x4dc850[_0xe8f3('0x6e')]&&_0x4dc850[_0xe8f3('0x6e')][_0xe8f3('0x6f')]){throw new Error(_0x4dc850[_0xe8f3('0x6e')][_0xe8f3('0x6f')][_0xe8f3('0x70')]);}var _0x6ee9a8=[];var _0x1f1575=[];var _0x5ab124=[_0xe8f3('0x71'),'Subject',_0xe8f3('0x72'),_0xe8f3('0x73'),_0xe8f3('0x74'),_0xe8f3('0x75'),_0xe8f3('0x76'),_0xe8f3('0x77')];_0x1f1575=_[_0xe8f3('0x78')](_0x4dc850['fields'],function(_0x14a299){return _0x5ab124[_0xe8f3('0x79')](_0x14a299[_0xe8f3('0x7a')]);});for(var _0x452177=0x0;_0x452177<_0x1f1575[_0xe8f3('0x39')];_0x452177++){if(_0x1f1575[_0x452177]['system_mandatory']===![]){_0x6ee9a8[_0xe8f3('0x7b')]({'id':_0x1f1575[_0x452177]['id'],'name':_0x1f1575[_0x452177][_0xe8f3('0x7c')],'custom':_0x1f1575[_0x452177][_0xe8f3('0x7d')],'options':_0x1f1575[_0x452177]['data_type']===_0xe8f3('0x7e')&&_0x1f1575[_0x452177][_0xe8f3('0x7f')]['length']>-0x1?_[_0xe8f3('0x2b')](_0x1f1575[_0x452177]['pick_list_values'],function(_0x479b65){return{'name':_0x479b65,'value':_0x479b65};}):[]});}}return{'count':_0x6ee9a8[_0xe8f3('0x39')],'rows':_0x6ee9a8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x29e994,null))[_0xe8f3('0x48')](function(_0x3b5aa2){var _0x36dd75=_0xbd5ac4[_0xe8f3('0x32')][_0xe8f3('0x80')]?0x1f4:_0x3b5aa2[_0xe8f3('0x81')]||0x1f4;logger[_0xe8f3('0x6f')]('getFields,\x20%s,\x20%s,\x20%s',_0xe8f3('0x82'),_0x36dd75,JSON[_0xe8f3('0x83')](_0x3b5aa2));delete _0x3b5aa2[_0xe8f3('0x31')];if(_0x36dd75===0x191){_0x36dd75=0x190;}_0x29e994[_0xe8f3('0x1b')](_0x36dd75)[_0xe8f3('0x2a')](_0xbd5ac4['query'][_0xe8f3('0x80')]?{'message':_0xe8f3('0x84'),'statusCode':_0x3b5aa2[_0xe8f3('0x81')]}:_0x3b5aa2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6212241..2a9c624 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 _0x5085=['bluebird','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','https://accounts.zoho.com.cn','util','../../config/logger','api','moment'];(function(_0x2f0811,_0x589ce){var _0x18ff83=function(_0x4c269a){while(--_0x4c269a){_0x2f0811['push'](_0x2f0811['shift']());}};_0x18ff83(++_0x589ce);}(_0x5085,0x164));var _0x5508=function(_0x8f541c,_0x5eae07){_0x8f541c=_0x8f541c-0x0;var _0xd37cf5=_0x5085[_0x8f541c];return _0xd37cf5;};'use strict';var _=require('lodash');var util=require(_0x5508('0x0'));var logger=require(_0x5508('0x1'))(_0x5508('0x2'));var moment=require(_0x5508('0x3'));var BPromise=require(_0x5508('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5508('0x5'));var rimraf=require(_0x5508('0x6'));var config=require('../../config/environment');var attributes=require(_0x5508('0x7'));var integrations=require(_0x5508('0x8'));module[_0x5508('0x9')]=function(_0x20fb9c,_0x18979d){return _0x20fb9c[_0x5508('0xa')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2117ef,_0x43b980,_0x41503f){if(_0x2117ef['changed']('zone')||_0x2117ef[_0x5508('0xb')](_0x5508('0xc'))||_0x2117ef[_0x5508('0xb')](_0x5508('0xd'))||_0x2117ef[_0x5508('0xb')](_0x5508('0xe'))||_0x2117ef[_0x5508('0xb')]('code')||_0x2117ef['changed'](_0x5508('0xf'))){var _0x498f84,_0x39a968;_0x498f84=_0x2117ef[_0x5508('0xc')];var _0x3846d2=_0x498f84[_0x5508('0x10')](-0x1);if(_0x3846d2==='/'||_0x3846d2==='\x5c'||_0x3846d2===':'){_0x498f84=_0x498f84[_0x5508('0x11')](0x0,_0x498f84[_0x5508('0x12')](_0x3846d2));}switch(_0x2117ef['zone']){case'US':_0x39a968=_0x5508('0x13');break;case'AU':_0x39a968=_0x5508('0x14');break;case'IN':_0x39a968=_0x5508('0x15');break;case'CN':_0x39a968='https://accounts.zoho.com.cn';break;default:_0x39a968=_0x5508('0x16');break;}var _0x37f91b={'method':_0x5508('0x17'),'uri':_0x39a968+_0x5508('0x18'),'form':{'grant_type':_0x5508('0x19'),'client_id':_0x2117ef[_0x5508('0xd')],'client_secret':_0x2117ef[_0x5508('0xe')],'redirect_uri':_0x2117ef[_0x5508('0xc')],'code':_0x2117ef[_0x5508('0x1a')]},'headers':{'Content-Type':_0x5508('0x1b')}};return rp(_0x37f91b)[_0x5508('0x1c')](function(_0x2cf6a3){var _0x380891=JSON[_0x5508('0x1d')](_0x2cf6a3);if(_0x380891[_0x5508('0x1e')]){_0x2117ef['refreshToken']=_0x380891[_0x5508('0x1e')];logger[_0x5508('0x1f')](util[_0x5508('0x20')](_0x5508('0x21'),_0x2117ef['name'],_0x2117ef['id']));}else{logger['error'](util[_0x5508('0x20')](_0x5508('0x22'),_0x2117ef[_0x5508('0x23')],_0x2117ef['id']),util[_0x5508('0x24')](_0x380891,{'showHidden':![],'depth':null}));}return _0x41503f(null,_0x43b980);})[_0x5508('0x25')](function(_0x280e6c){logger[_0x5508('0x26')](util[_0x5508('0x20')](_0x5508('0x22'),_0x2117ef[_0x5508('0x23')],_0x2117ef['id']),util[_0x5508('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x41503f(_0x280e6c);});}else{return _0x41503f(null,_0x43b980);}},'beforeUpdate':function(_0x54fb95,_0x1e720b,_0x532b28){if(_0x54fb95[_0x5508('0xb')]('zone')||_0x54fb95['changed']('serverUrl')||_0x54fb95[_0x5508('0xb')](_0x5508('0xd'))||_0x54fb95['changed'](_0x5508('0xe'))||_0x54fb95[_0x5508('0xb')](_0x5508('0x1a'))||_0x54fb95[_0x5508('0xb')](_0x5508('0xf'))){var _0x22e69a,_0x369c82;_0x22e69a=_0x54fb95[_0x5508('0xc')];var _0x3c521d=_0x22e69a['slice'](-0x1);if(_0x3c521d==='/'||_0x3c521d==='\x5c'||_0x3c521d===':'){_0x22e69a=_0x22e69a[_0x5508('0x11')](0x0,_0x22e69a[_0x5508('0x12')](_0x3c521d));}switch(_0x54fb95['zone']){case'US':_0x369c82='https://accounts.zoho.com';break;case'AU':_0x369c82=_0x5508('0x14');break;case'IN':_0x369c82=_0x5508('0x15');break;case'CN':_0x369c82=_0x5508('0x27');break;default:_0x369c82='https://accounts.zoho.eu';break;}var _0x4c3273={'method':_0x5508('0x17'),'uri':_0x369c82+_0x5508('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x54fb95[_0x5508('0xd')],'client_secret':_0x54fb95[_0x5508('0xe')],'redirect_uri':_0x54fb95[_0x5508('0xc')],'code':_0x54fb95[_0x5508('0x1a')]},'headers':{'Content-Type':_0x5508('0x1b')}};return rp(_0x4c3273)[_0x5508('0x1c')](function(_0x278058){var _0x2da95b=JSON['parse'](_0x278058);if(_0x2da95b[_0x5508('0x1e')]){_0x54fb95['refreshToken']=_0x2da95b[_0x5508('0x1e')];logger['info'](util[_0x5508('0x20')](_0x5508('0x21'),_0x54fb95[_0x5508('0x23')],_0x54fb95['id']));}else{logger[_0x5508('0x26')](util[_0x5508('0x20')](_0x5508('0x22'),_0x54fb95[_0x5508('0x23')],_0x54fb95['id']),util[_0x5508('0x24')](_0x2da95b,{'showHidden':![],'depth':null}));}return _0x532b28(null,_0x1e720b);})[_0x5508('0x25')](function(_0x20689a){logger['error'](util[_0x5508('0x20')](_0x5508('0x22'),_0x54fb95['name'],_0x54fb95['id']),util[_0x5508('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x532b28(_0x20689a);});}else{return _0x532b28(null,_0x1e720b);}}}});}; \ No newline at end of file +var _0x4c7e=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','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','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','clientSecret','host','/oauth/v2/token','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x234fc2,_0x485cee){var _0x1ddffd=function(_0x44f319){while(--_0x44f319){_0x234fc2['push'](_0x234fc2['shift']());}};_0x1ddffd(++_0x485cee);}(_0x4c7e,0x141));var _0xe4c7=function(_0x1bca2e,_0x2e5dbc){_0x1bca2e=_0x1bca2e-0x0;var _0x11ab8d=_0x4c7e[_0x1bca2e];return _0x11ab8d;};'use strict';var _=require(_0xe4c7('0x0'));var util=require('util');var logger=require(_0xe4c7('0x1'))(_0xe4c7('0x2'));var moment=require(_0xe4c7('0x3'));var BPromise=require(_0xe4c7('0x4'));var rp=require(_0xe4c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4c7('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe4c7('0x7')]=function(_0x1e918d,_0x8624fd){return _0x1e918d[_0xe4c7('0x8')](_0xe4c7('0x9'),attributes,{'tableName':_0xe4c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f1518,_0x4de83d,_0x33830d){if(_0x5f1518[_0xe4c7('0xb')](_0xe4c7('0xc'))||_0x5f1518[_0xe4c7('0xb')]('serverUrl')||_0x5f1518[_0xe4c7('0xb')](_0xe4c7('0xd'))||_0x5f1518[_0xe4c7('0xb')]('clientSecret')||_0x5f1518[_0xe4c7('0xb')](_0xe4c7('0xe'))||_0x5f1518[_0xe4c7('0xb')]('host')){var _0x323645,_0xd9581a;_0x323645=_0x5f1518[_0xe4c7('0xf')];var _0x508ed3=_0x323645[_0xe4c7('0x10')](-0x1);if(_0x508ed3==='/'||_0x508ed3==='\x5c'||_0x508ed3===':'){_0x323645=_0x323645[_0xe4c7('0x11')](0x0,_0x323645[_0xe4c7('0x12')](_0x508ed3));}switch(_0x5f1518[_0xe4c7('0xc')]){case'US':_0xd9581a=_0xe4c7('0x13');break;case'AU':_0xd9581a=_0xe4c7('0x14');break;case'IN':_0xd9581a=_0xe4c7('0x15');break;case'CN':_0xd9581a=_0xe4c7('0x16');break;default:_0xd9581a=_0xe4c7('0x17');break;}var _0x5e61cf={'method':_0xe4c7('0x18'),'uri':_0xd9581a+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5f1518['clientId'],'client_secret':_0x5f1518['clientSecret'],'redirect_uri':_0x5f1518[_0xe4c7('0xf')],'code':_0x5f1518[_0xe4c7('0xe')]},'headers':{'Content-Type':_0xe4c7('0x19')}};return rp(_0x5e61cf)[_0xe4c7('0x1a')](function(_0x13caf3){var _0x344533=JSON[_0xe4c7('0x1b')](_0x13caf3);if(_0x344533[_0xe4c7('0x1c')]){_0x5f1518[_0xe4c7('0x1d')]=_0x344533[_0xe4c7('0x1c')];logger[_0xe4c7('0x1e')](util[_0xe4c7('0x1f')](_0xe4c7('0x20'),_0x5f1518[_0xe4c7('0x21')],_0x5f1518['id']));}else{logger[_0xe4c7('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5f1518[_0xe4c7('0x21')],_0x5f1518['id']),util['inspect'](_0x344533,{'showHidden':![],'depth':null}));}return _0x33830d(null,_0x4de83d);})[_0xe4c7('0x23')](function(_0x4dd62f){logger[_0xe4c7('0x22')](util['format'](_0xe4c7('0x24'),_0x5f1518[_0xe4c7('0x21')],_0x5f1518['id']),util[_0xe4c7('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x33830d(_0x4dd62f);});}else{return _0x33830d(null,_0x4de83d);}},'beforeUpdate':function(_0x2d0346,_0x388447,_0xa2c12d){if(_0x2d0346[_0xe4c7('0xb')](_0xe4c7('0xc'))||_0x2d0346[_0xe4c7('0xb')]('serverUrl')||_0x2d0346[_0xe4c7('0xb')](_0xe4c7('0xd'))||_0x2d0346['changed'](_0xe4c7('0x26'))||_0x2d0346['changed'](_0xe4c7('0xe'))||_0x2d0346['changed'](_0xe4c7('0x27'))){var _0xf562a1,_0x483752;_0xf562a1=_0x2d0346[_0xe4c7('0xf')];var _0x52ce5c=_0xf562a1[_0xe4c7('0x10')](-0x1);if(_0x52ce5c==='/'||_0x52ce5c==='\x5c'||_0x52ce5c===':'){_0xf562a1=_0xf562a1[_0xe4c7('0x11')](0x0,_0xf562a1[_0xe4c7('0x12')](_0x52ce5c));}switch(_0x2d0346['zone']){case'US':_0x483752=_0xe4c7('0x13');break;case'AU':_0x483752=_0xe4c7('0x14');break;case'IN':_0x483752=_0xe4c7('0x15');break;case'CN':_0x483752='https://accounts.zoho.com.cn';break;default:_0x483752=_0xe4c7('0x17');break;}var _0x58d69c={'method':'POST','uri':_0x483752+_0xe4c7('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x2d0346[_0xe4c7('0xd')],'client_secret':_0x2d0346[_0xe4c7('0x26')],'redirect_uri':_0x2d0346[_0xe4c7('0xf')],'code':_0x2d0346[_0xe4c7('0xe')]},'headers':{'Content-Type':_0xe4c7('0x19')}};return rp(_0x58d69c)[_0xe4c7('0x1a')](function(_0x4cea6e){var _0x184cfd=JSON[_0xe4c7('0x1b')](_0x4cea6e);if(_0x184cfd[_0xe4c7('0x1c')]){_0x2d0346[_0xe4c7('0x1d')]=_0x184cfd['refresh_token'];logger[_0xe4c7('0x1e')](util[_0xe4c7('0x1f')](_0xe4c7('0x20'),_0x2d0346[_0xe4c7('0x21')],_0x2d0346['id']));}else{logger[_0xe4c7('0x22')](util[_0xe4c7('0x1f')](_0xe4c7('0x24'),_0x2d0346[_0xe4c7('0x21')],_0x2d0346['id']),util[_0xe4c7('0x25')](_0x184cfd,{'showHidden':![],'depth':null}));}return _0xa2c12d(null,_0x388447);})[_0xe4c7('0x23')](function(_0x54d982){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2d0346['name'],_0x2d0346['id']),util[_0xe4c7('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xa2c12d(_0x54d982);});}else{return _0xa2c12d(null,_0x388447);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8977409..0098ff4 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 _0x6da9=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','include','model','map','then','GetZohoAccount','debug','ShowZohoAccount','ZohoAccount'];(function(_0x280de6,_0x278a85){var _0x9debd5=function(_0x60b632){while(--_0x60b632){_0x280de6['push'](_0x280de6['shift']());}};_0x9debd5(++_0x278a85);}(_0x6da9,0x161));var _0x96da=function(_0x8dbb3d,_0x844338){_0x8dbb3d=_0x8dbb3d-0x0;var _0x117d4e=_0x6da9[_0x8dbb3d];return _0x117d4e;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var moment=require(_0x96da('0x2'));var BPromise=require(_0x96da('0x3'));var rs=require(_0x96da('0x4'));var fs=require('fs');var Redis=require(_0x96da('0x5'));var db=require(_0x96da('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x96da('0x7'));var jayson=require(_0x96da('0x8'));var client=jayson[_0x96da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc4b0,_0x5d7737,_0x161249){return new BPromise(function(_0x45ee2f,_0x3b0883){return client['request'](_0x1bc4b0,_0x161249)['then'](function(_0x4ed0c1){logger[_0x96da('0xa')](_0x96da('0xb'),_0x5d7737,_0x96da('0xc'));logger['debug'](_0x96da('0xd'),_0x5d7737,_0x96da('0xc'),JSON['stringify'](_0x4ed0c1));if(_0x4ed0c1[_0x96da('0xe')]){if(_0x4ed0c1[_0x96da('0xe')][_0x96da('0xf')]===0x1f4){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);return _0x3b0883(_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);}logger['error'](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')]['message']);return _0x45ee2f(_0x4ed0c1['error'][_0x96da('0x10')]);}else{logger[_0x96da('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x5d7737,_0x96da('0xc'));_0x45ee2f(_0x4ed0c1['result'][_0x96da('0x10')]);}})[_0x96da('0x11')](function(_0x2d6d15){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x2d6d15);_0x3b0883(_0x2d6d15);});});}exports['GetZohoAccount']=function(_0x2bfd0c){var _0xd1fef8=this;return new Promise(function(_0x7ac4a5,_0x30834c){return db['ZohoAccount'][_0x96da('0x12')]({'raw':_0x2bfd0c['options']?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x14')]===undefined?!![]:![]:!![],'where':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c['options'][_0x96da('0x15')]||null:null,'attributes':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x16')]||null:null,'limit':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')]['limit']||null:null,'include':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x17')]?_['map'](_0x2bfd0c[_0x96da('0x13')][_0x96da('0x17')],function(_0x4a9232){return{'model':db[_0x4a9232[_0x96da('0x18')]],'as':_0x4a9232['as'],'attributes':_0x4a9232['attributes'],'include':_0x4a9232[_0x96da('0x17')]?_[_0x96da('0x19')](_0x4a9232[_0x96da('0x17')],function(_0x1b29ae){return{'model':db[_0x1b29ae[_0x96da('0x18')]],'as':_0x1b29ae['as'],'attributes':_0x1b29ae[_0x96da('0x16')],'include':_0x1b29ae[_0x96da('0x17')]?_[_0x96da('0x19')](_0x1b29ae[_0x96da('0x17')],function(_0x2d197f){return{'model':db[_0x2d197f['model']],'as':_0x2d197f['as'],'attributes':_0x2d197f[_0x96da('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96da('0x1a')](function(_0x2e7a34){logger[_0x96da('0xa')](_0x96da('0x1b'),_0x2bfd0c);logger[_0x96da('0x1c')](_0x96da('0x1b'),_0x2bfd0c,JSON['stringify'](_0x2e7a34));_0x7ac4a5(_0x2e7a34);})[_0x96da('0x11')](function(_0x4241ba){logger[_0x96da('0xe')]('GetZohoAccount',_0x4241ba['message'],_0x2bfd0c);_0x30834c(_0xd1fef8['error'](0x1f4,_0x4241ba['message']));});});};exports[_0x96da('0x1d')]=function(_0x480169){var _0x31110d=this;return new Promise(function(_0x156469,_0x2ddc62){return db[_0x96da('0x1e')][_0x96da('0x1f')]({'raw':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')][_0x96da('0x14')]===undefined?!![]:![]:!![],'where':_0x480169[_0x96da('0x13')]?_0x480169['options']['where']||null:null,'attributes':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')]['attributes']||null:null,'include':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')][_0x96da('0x17')]?_[_0x96da('0x19')](_0x480169[_0x96da('0x13')][_0x96da('0x17')],function(_0x3a6f6a){return{'model':db[_0x3a6f6a[_0x96da('0x18')]],'as':_0x3a6f6a['as'],'attributes':_0x3a6f6a[_0x96da('0x16')],'include':_0x3a6f6a['include']?_[_0x96da('0x19')](_0x3a6f6a['include'],function(_0x4daf81){return{'model':db[_0x4daf81[_0x96da('0x18')]],'as':_0x4daf81['as'],'attributes':_0x4daf81[_0x96da('0x16')],'include':_0x4daf81[_0x96da('0x17')]?_[_0x96da('0x19')](_0x4daf81[_0x96da('0x17')],function(_0x1147e4){return{'model':db[_0x1147e4[_0x96da('0x18')]],'as':_0x1147e4['as'],'attributes':_0x1147e4[_0x96da('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96da('0x1a')](function(_0x35db80){logger[_0x96da('0xa')]('ShowZohoAccount',_0x480169);logger[_0x96da('0x1c')](_0x96da('0x1d'),_0x480169,JSON['stringify'](_0x35db80));_0x156469(_0x35db80);})['catch'](function(_0x41e123){logger[_0x96da('0xe')](_0x96da('0x1d'),_0x41e123[_0x96da('0x10')],_0x480169);_0x2ddc62(_0x31110d[_0x96da('0xe')](0x1f4,_0x41e123['message']));});});}; \ No newline at end of file +var _0x29b6=['include','map','model','then','GetZohoAccount','catch','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount','options','raw','attributes','limit'];(function(_0x190681,_0x590f58){var _0x4f2ada=function(_0x4556db){while(--_0x4556db){_0x190681['push'](_0x190681['shift']());}};_0x4f2ada(++_0x590f58);}(_0x29b6,0x17e));var _0x629b=function(_0x2fdc16,_0x46b810){_0x2fdc16=_0x2fdc16-0x0;var _0x210f85=_0x29b6[_0x2fdc16];return _0x210f85;};'use strict';var _=require(_0x629b('0x0'));var util=require(_0x629b('0x1'));var moment=require(_0x629b('0x2'));var BPromise=require(_0x629b('0x3'));var rs=require(_0x629b('0x4'));var fs=require('fs');var Redis=require(_0x629b('0x5'));var db=require(_0x629b('0x6'))['db'];var utils=require(_0x629b('0x7'));var logger=require(_0x629b('0x8'))(_0x629b('0x9'));var config=require('../../config/environment');var jayson=require(_0x629b('0xa'));var client=jayson['client'][_0x629b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4acc5a,_0x26e439,_0x398ecb){return new BPromise(function(_0x4e90cd,_0xc44b27){return client[_0x629b('0xc')](_0x4acc5a,_0x398ecb)['then'](function(_0x28c152){logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));logger[_0x629b('0x10')](_0x629b('0x11'),_0x26e439,_0x629b('0xf'),JSON[_0x629b('0x12')](_0x28c152));if(_0x28c152[_0x629b('0x13')]){if(_0x28c152[_0x629b('0x13')]['code']===0x1f4){logger['error'](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);return _0xc44b27(_0x28c152['error'][_0x629b('0x14')]);}logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x28c152[_0x629b('0x13')]['message']);return _0x4e90cd(_0x28c152[_0x629b('0x13')][_0x629b('0x14')]);}else{logger[_0x629b('0xd')](_0x629b('0xe'),_0x26e439,_0x629b('0xf'));_0x4e90cd(_0x28c152['result'][_0x629b('0x14')]);}})['catch'](function(_0x151b93){logger[_0x629b('0x13')](_0x629b('0xe'),_0x26e439,_0x151b93);_0xc44b27(_0x151b93);});});}exports['GetZohoAccount']=function(_0x7f24d3){var _0x58f5a8=this;return new Promise(function(_0x1c93a1,_0x4f28dd){return db[_0x629b('0x15')]['findAll']({'raw':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3[_0x629b('0x16')][_0x629b('0x17')]===undefined?!![]:![]:!![],'where':_0x7f24d3['options']?_0x7f24d3[_0x629b('0x16')]['where']||null:null,'attributes':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3[_0x629b('0x16')][_0x629b('0x18')]||null:null,'limit':_0x7f24d3[_0x629b('0x16')]?_0x7f24d3['options'][_0x629b('0x19')]||null:null,'include':_0x7f24d3['options']?_0x7f24d3[_0x629b('0x16')][_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x7f24d3['options'][_0x629b('0x1a')],function(_0x1e773e){return{'model':db[_0x1e773e[_0x629b('0x1c')]],'as':_0x1e773e['as'],'attributes':_0x1e773e[_0x629b('0x18')],'include':_0x1e773e[_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x1e773e[_0x629b('0x1a')],function(_0x547b3c){return{'model':db[_0x547b3c['model']],'as':_0x547b3c['as'],'attributes':_0x547b3c['attributes'],'include':_0x547b3c['include']?_[_0x629b('0x1b')](_0x547b3c[_0x629b('0x1a')],function(_0xf68af8){return{'model':db[_0xf68af8[_0x629b('0x1c')]],'as':_0xf68af8['as'],'attributes':_0xf68af8[_0x629b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x629b('0x1d')](function(_0x4c1f21){logger[_0x629b('0xd')](_0x629b('0x1e'),_0x7f24d3);logger[_0x629b('0x10')](_0x629b('0x1e'),_0x7f24d3,JSON[_0x629b('0x12')](_0x4c1f21));_0x1c93a1(_0x4c1f21);})[_0x629b('0x1f')](function(_0x3ef549){logger[_0x629b('0x13')]('GetZohoAccount',_0x3ef549['message'],_0x7f24d3);_0x4f28dd(_0x58f5a8[_0x629b('0x13')](0x1f4,_0x3ef549[_0x629b('0x14')]));});});};exports['ShowZohoAccount']=function(_0x1628cb){var _0x56c088=this;return new Promise(function(_0x86ee7c,_0x37b918){return db['ZohoAccount'][_0x629b('0x20')]({'raw':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x17')]===undefined?!![]:![]:!![],'where':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')]['where']||null:null,'attributes':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x18')]||null:null,'include':_0x1628cb[_0x629b('0x16')]?_0x1628cb[_0x629b('0x16')][_0x629b('0x1a')]?_[_0x629b('0x1b')](_0x1628cb[_0x629b('0x16')][_0x629b('0x1a')],function(_0x26a541){return{'model':db[_0x26a541[_0x629b('0x1c')]],'as':_0x26a541['as'],'attributes':_0x26a541[_0x629b('0x18')],'include':_0x26a541[_0x629b('0x1a')]?_['map'](_0x26a541['include'],function(_0x17aaef){return{'model':db[_0x17aaef[_0x629b('0x1c')]],'as':_0x17aaef['as'],'attributes':_0x17aaef[_0x629b('0x18')],'include':_0x17aaef[_0x629b('0x1a')]?_['map'](_0x17aaef[_0x629b('0x1a')],function(_0x202348){return{'model':db[_0x202348[_0x629b('0x1c')]],'as':_0x202348['as'],'attributes':_0x202348[_0x629b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13cac7){logger[_0x629b('0xd')](_0x629b('0x21'),_0x1628cb);logger[_0x629b('0x10')](_0x629b('0x21'),_0x1628cb,JSON['stringify'](_0x13cac7));_0x86ee7c(_0x13cac7);})[_0x629b('0x1f')](function(_0x4024c7){logger[_0x629b('0x13')](_0x629b('0x21'),_0x4024c7[_0x629b('0x14')],_0x1628cb);_0x37b918(_0x56c088[_0x629b('0x13')](0x1f4,_0x4024c7[_0x629b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 5f59eab..0fb008c 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 _0xc741=['exports','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy'];(function(_0x46aac,_0x2374ee){var _0x3cbc73=function(_0x2b9080){while(--_0x2b9080){_0x46aac['push'](_0x46aac['shift']());}};_0x3cbc73(++_0x2374ee);}(_0xc741,0x135));var _0x1c74=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc741[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require(_0x1c74('0x0'));var path=require(_0x1c74('0x1'));var timeout=require('connect-timeout');var express=require(_0x1c74('0x2'));var router=express[_0x1c74('0x3')]();var fs_extra=require(_0x1c74('0x4'));var auth=require(_0x1c74('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x1c74('0x6')]('/',auth[_0x1c74('0x7')](),controller[_0x1c74('0x8')]);router[_0x1c74('0x6')](_0x1c74('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1c74('0x6')](_0x1c74('0xa'),auth[_0x1c74('0x7')](),controller[_0x1c74('0xb')]);router[_0x1c74('0x6')](_0x1c74('0xc'),auth[_0x1c74('0x7')](),controller[_0x1c74('0xd')]);router[_0x1c74('0x6')](_0x1c74('0xe'),auth[_0x1c74('0x7')](),controller[_0x1c74('0xf')]);router[_0x1c74('0x10')]('/',auth['isAuthenticated'](),controller[_0x1c74('0x11')]);router[_0x1c74('0x12')]('/:id',auth[_0x1c74('0x7')](),controller[_0x1c74('0x13')]);router['delete'](_0x1c74('0x9'),auth['isAuthenticated'](),controller[_0x1c74('0x14')]);module[_0x1c74('0x15')]=router; \ No newline at end of file +var _0xa105=['getFields','getSubjects','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x4581c2,_0x34c9af){var _0x969e99=function(_0x355c33){while(--_0x355c33){_0x4581c2['push'](_0x4581c2['shift']());}};_0x969e99(++_0x34c9af);}(_0xa105,0x133));var _0x5a10=function(_0x5c60b1,_0x58603d){_0x5c60b1=_0x5c60b1-0x0;var _0x4f3e73=_0xa105[_0x5c60b1];return _0x4f3e73;};'use strict';var multer=require(_0x5a10('0x0'));var util=require(_0x5a10('0x1'));var path=require('path');var timeout=require(_0x5a10('0x2'));var express=require(_0x5a10('0x3'));var router=express[_0x5a10('0x4')]();var fs_extra=require(_0x5a10('0x5'));var auth=require(_0x5a10('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a10('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x5a10('0x8')]('/',auth[_0x5a10('0x9')](),controller['index']);router['get'](_0x5a10('0xa'),auth[_0x5a10('0x9')](),controller[_0x5a10('0xb')]);router[_0x5a10('0x8')](_0x5a10('0xc'),auth[_0x5a10('0x9')](),controller[_0x5a10('0xd')]);router[_0x5a10('0x8')]('/:id/subjects',auth[_0x5a10('0x9')](),controller[_0x5a10('0xe')]);router[_0x5a10('0x8')]('/:id/descriptions',auth[_0x5a10('0x9')](),controller['getDescriptions']);router[_0x5a10('0xf')]('/',auth[_0x5a10('0x9')](),controller[_0x5a10('0x10')]);router[_0x5a10('0x11')](_0x5a10('0xa'),auth['isAuthenticated'](),controller[_0x5a10('0x12')]);router['delete']('/:id',auth[_0x5a10('0x9')](),controller[_0x5a10('0x13')]);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 2afa957..a504bbf 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 _0x4685=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead','nothing'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4685,0x6a));var _0x5468=function(_0xa352f,_0x33c458){_0xa352f=_0xa352f-0x0;var _0x2945c8=_0x4685[_0xa352f];return _0x2945c8;};'use strict';var Sequelize=require(_0x5468('0x0'));module[_0x5468('0x1')]={'name':{'type':Sequelize[_0x5468('0x2')]},'moduleCreate':{'type':Sequelize[_0x5468('0x3')](_0x5468('0x4'),'contact',_0x5468('0x5')),'defaultValue':_0x5468('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5468('0x6'),_0x5468('0x7'),'lead'),'defaultValue':_0x5468('0x6')},'description':{'type':Sequelize[_0x5468('0x2')]}}; \ No newline at end of file +var _0x20e2=['exports','STRING','ENUM','lead','contact_lead','contact','sequelize'];(function(_0x557d56,_0x5427f4){var _0x1119d3=function(_0x30af21){while(--_0x30af21){_0x557d56['push'](_0x557d56['shift']());}};_0x1119d3(++_0x5427f4);}(_0x20e2,0x8b));var _0x220e=function(_0x3a7dca,_0xd638c7){_0x3a7dca=_0x3a7dca-0x0;var _0x5806f1=_0x20e2[_0x3a7dca];return _0x5806f1;};'use strict';var Sequelize=require(_0x220e('0x0'));module[_0x220e('0x1')]={'name':{'type':Sequelize[_0x220e('0x2')]},'moduleCreate':{'type':Sequelize[_0x220e('0x3')]('lead','contact','nothing'),'defaultValue':_0x220e('0x4')},'moduleSearch':{'type':Sequelize[_0x220e('0x3')](_0x220e('0x5'),_0x220e('0x6'),_0x220e('0x4')),'defaultValue':_0x220e('0x5')},'description':{'type':Sequelize[_0x220e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 66199db..938502d 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 _0xd411=['sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','index','map','ZohoConfiguration','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','pick','getSubjects','ZohoField','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5360a7,_0x5e86e8){var _0x4d5b24=function(_0x57706c){while(--_0x57706c){_0x5360a7['push'](_0x5360a7['shift']());}};_0x4d5b24(++_0x5e86e8);}(_0xd411,0x138));var _0x1d41=function(_0xffb37f,_0x2f1c46){_0xffb37f=_0xffb37f-0x0;var _0x211dc9=_0xd411[_0xffb37f];return _0x211dc9;};'use strict';var emlformat=require(_0x1d41('0x0'));var rimraf=require(_0x1d41('0x1'));var zipdir=require(_0x1d41('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d41('0x3'));var moment=require(_0x1d41('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d41('0x5'));var util=require(_0x1d41('0x6'));var path=require(_0x1d41('0x7'));var sox=require(_0x1d41('0x8'));var csv=require(_0x1d41('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1d41('0xa'));var crypto=require(_0x1d41('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1d41('0xc'));var toCsv=require(_0x1d41('0x9'));var querystring=require(_0x1d41('0xd'));var Papa=require(_0x1d41('0xe'));var Redis=require(_0x1d41('0xf'));var authService=require(_0x1d41('0x10'));var qs=require(_0x1d41('0x11'));var as=require(_0x1d41('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d41('0x13'))(_0x1d41('0x14'));var utils=require(_0x1d41('0x15'));var config=require(_0x1d41('0x16'));var licenseUtil=require(_0x1d41('0x17'));var db=require(_0x1d41('0x18'))['db'];function respondWithStatusCode(_0x1c9b7a,_0x240b5a){_0x240b5a=_0x240b5a||0xcc;return function(_0x1b17fd){if(_0x1b17fd){return _0x1c9b7a[_0x1d41('0x19')](_0x240b5a);}return _0x1c9b7a[_0x1d41('0x1a')](_0x240b5a)['end']();};}function respondWithResult(_0xaa34fe,_0x3f9f57){_0x3f9f57=_0x3f9f57||0xc8;return function(_0x22ced8){if(_0x22ced8){return _0xaa34fe['status'](_0x3f9f57)['json'](_0x22ced8);}};}function respondWithFilteredResult(_0x157139,_0xf7d66f){return function(_0x4a6bc0){if(_0x4a6bc0){var _0x2adfc8=typeof _0xf7d66f['offset']===_0x1d41('0x1b')&&typeof _0xf7d66f['limit']===_0x1d41('0x1b');var _0x134eca=_0x4a6bc0[_0x1d41('0x1c')];var _0x3a9c83=_0x2adfc8?0x0:_0xf7d66f['offset'];var _0x261dd0=_0x2adfc8?_0x4a6bc0[_0x1d41('0x1c')]:_0xf7d66f[_0x1d41('0x1d')]+_0xf7d66f[_0x1d41('0x1e')];var _0x1cc3bc;if(_0x261dd0>=_0x134eca){_0x261dd0=_0x134eca;_0x1cc3bc=0xc8;}else{_0x1cc3bc=0xce;}_0x157139[_0x1d41('0x1a')](_0x1cc3bc);return _0x157139[_0x1d41('0x1f')](_0x1d41('0x20'),_0x3a9c83+'-'+_0x261dd0+'/'+_0x134eca)[_0x1d41('0x21')](_0x4a6bc0);}return null;};}function patchUpdates(_0x5c7208){return function(_0x592d2b){try{jsonpatch['apply'](_0x592d2b,_0x5c7208,!![]);}catch(_0x2957a9){return BPromise[_0x1d41('0x22')](_0x2957a9);}return _0x592d2b[_0x1d41('0x23')]();};}function saveUpdates(_0x56a5f2,_0xcb0947){return function(_0x5a252b){if(_0x5a252b){return _0x5a252b[_0x1d41('0x24')](_0x56a5f2)[_0x1d41('0x25')](function(_0x152f19){return _0x152f19;});}return null;};}function removeEntity(_0xa69012,_0x51dabf){return function(_0x9e45cf){if(_0x9e45cf){return _0x9e45cf[_0x1d41('0x26')]()[_0x1d41('0x25')](function(){_0xa69012['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ece2,_0x412783){return function(_0x6bbe74){if(!_0x6bbe74){_0x55ece2['sendStatus'](0x194);}return _0x6bbe74;};}function handleError(_0x12bf87,_0x2d1ecd){_0x2d1ecd=_0x2d1ecd||0x1f4;return function(_0x54fd9c){logger['error'](_0x54fd9c[_0x1d41('0x27')]);if(_0x54fd9c['name']){delete _0x54fd9c[_0x1d41('0x28')];}_0x12bf87[_0x1d41('0x1a')](_0x2d1ecd)['send'](_0x54fd9c);};}exports[_0x1d41('0x29')]=function(_0x17dfab,_0x3e9652){var _0x365fc1={},_0x13f141={},_0x596ca4={'count':0x0,'rows':[]};var _0x25df27=_[_0x1d41('0x2a')](db[_0x1d41('0x2b')]['rawAttributes'],function(_0x16f918){return{'name':_0x16f918[_0x1d41('0x2c')],'type':_0x16f918[_0x1d41('0x2d')][_0x1d41('0x2e')]};});_0x13f141['model']=_[_0x1d41('0x2a')](_0x25df27,_0x1d41('0x28'));_0x13f141[_0x1d41('0x2f')]=_[_0x1d41('0x30')](_0x17dfab[_0x1d41('0x2f')]);_0x13f141['filters']=_[_0x1d41('0x31')](_0x13f141[_0x1d41('0x32')],_0x13f141['query']);_0x365fc1[_0x1d41('0x33')]=_['intersection'](_0x13f141[_0x1d41('0x32')],qs[_0x1d41('0x34')](_0x17dfab[_0x1d41('0x2f')][_0x1d41('0x34')]));_0x365fc1[_0x1d41('0x33')]=_0x365fc1[_0x1d41('0x33')][_0x1d41('0x35')]?_0x365fc1[_0x1d41('0x33')]:_0x13f141['model'];if(!_0x17dfab[_0x1d41('0x2f')][_0x1d41('0x36')](_0x1d41('0x37'))){_0x365fc1[_0x1d41('0x1e')]=qs[_0x1d41('0x1e')](_0x17dfab['query'][_0x1d41('0x1e')]);_0x365fc1[_0x1d41('0x1d')]=qs[_0x1d41('0x1d')](_0x17dfab[_0x1d41('0x2f')][_0x1d41('0x1d')]);}_0x365fc1[_0x1d41('0x38')]=qs[_0x1d41('0x39')](_0x17dfab[_0x1d41('0x2f')][_0x1d41('0x39')]);_0x365fc1[_0x1d41('0x3a')]=qs[_0x1d41('0x3b')](_['pick'](_0x17dfab['query'],_0x13f141[_0x1d41('0x3b')]),_0x25df27);if(_0x17dfab[_0x1d41('0x2f')][_0x1d41('0x3c')]){_0x365fc1[_0x1d41('0x3a')]=_[_0x1d41('0x3d')](_0x365fc1['where'],{'$or':_[_0x1d41('0x2a')](_0x25df27,function(_0x1ab758){if(_0x1ab758['type']!=='VIRTUAL'){var _0x557339={};_0x557339[_0x1ab758[_0x1d41('0x28')]]={'$like':'%'+_0x17dfab[_0x1d41('0x2f')][_0x1d41('0x3c')]+'%'};return _0x557339;}})});}_0x365fc1=_[_0x1d41('0x3d')]({},_0x365fc1,_0x17dfab[_0x1d41('0x3e')]);var _0x5d27f8={'where':_0x365fc1['where']};return db[_0x1d41('0x2b')][_0x1d41('0x1c')](_0x5d27f8)[_0x1d41('0x25')](function(_0x3c8fb6){_0x596ca4['count']=_0x3c8fb6;if(_0x17dfab[_0x1d41('0x2f')]['includeAll']){_0x365fc1[_0x1d41('0x3f')]=[{'all':!![]}];}return db[_0x1d41('0x2b')][_0x1d41('0x40')](_0x365fc1);})[_0x1d41('0x25')](function(_0x5b0f57){_0x596ca4[_0x1d41('0x41')]=_0x5b0f57;return _0x596ca4;})[_0x1d41('0x25')](respondWithFilteredResult(_0x3e9652,_0x365fc1))[_0x1d41('0x42')](handleError(_0x3e9652,null));};exports[_0x1d41('0x43')]=function(_0x483564,_0x3dad84){var _0x2aba45={'raw':![],'where':{'id':_0x483564[_0x1d41('0x44')]['id']}},_0x38b446={};_0x38b446['model']=_[_0x1d41('0x30')](db[_0x1d41('0x2b')]['rawAttributes']);_0x38b446[_0x1d41('0x2f')]=_[_0x1d41('0x30')](_0x483564[_0x1d41('0x2f')]);_0x38b446[_0x1d41('0x3b')]=_[_0x1d41('0x31')](_0x38b446['model'],_0x38b446[_0x1d41('0x2f')]);_0x2aba45['attributes']=_['intersection'](_0x38b446[_0x1d41('0x32')],qs[_0x1d41('0x34')](_0x483564[_0x1d41('0x2f')][_0x1d41('0x34')]));_0x2aba45[_0x1d41('0x33')]=_0x2aba45[_0x1d41('0x33')][_0x1d41('0x35')]?_0x2aba45[_0x1d41('0x33')]:_0x38b446['model'];if(_0x483564[_0x1d41('0x2f')][_0x1d41('0x45')]){_0x2aba45[_0x1d41('0x3f')]=[{'all':!![]}];}_0x2aba45=_[_0x1d41('0x3d')]({},_0x2aba45,_0x483564[_0x1d41('0x3e')]);return db['ZohoConfiguration'][_0x1d41('0x46')](_0x2aba45)[_0x1d41('0x25')](handleEntityNotFound(_0x3dad84,null))[_0x1d41('0x25')](respondWithResult(_0x3dad84,null))[_0x1d41('0x42')](handleError(_0x3dad84,null));};exports[_0x1d41('0x47')]=function(_0x5bb69b,_0x2c2a5d){return db[_0x1d41('0x2b')][_0x1d41('0x47')](_0x5bb69b[_0x1d41('0x48')],{})[_0x1d41('0x25')](respondWithResult(_0x2c2a5d,0xc9))[_0x1d41('0x42')](handleError(_0x2c2a5d,null));};exports[_0x1d41('0x24')]=function(_0xc0d063,_0x650a2a){if(_0xc0d063[_0x1d41('0x48')]['id']){delete _0xc0d063[_0x1d41('0x48')]['id'];}return db[_0x1d41('0x2b')][_0x1d41('0x46')]({'where':{'id':_0xc0d063[_0x1d41('0x44')]['id']}})[_0x1d41('0x25')](handleEntityNotFound(_0x650a2a,null))[_0x1d41('0x25')](saveUpdates(_0xc0d063['body'],null))['then'](respondWithResult(_0x650a2a,null))[_0x1d41('0x42')](handleError(_0x650a2a,null));};exports['destroy']=function(_0x482150,_0x1ce279){return db['ZohoConfiguration']['find']({'where':{'id':_0x482150['params']['id']}})[_0x1d41('0x25')](handleEntityNotFound(_0x1ce279,null))[_0x1d41('0x25')](removeEntity(_0x1ce279,null))['catch'](handleError(_0x1ce279,null));};exports[_0x1d41('0x49')]=function(_0x5b3462,_0x5d716a,_0x4db0a9){var _0x181d0e={};var _0x2fcf9e={};var _0x277f04;var _0x51c181;return db[_0x1d41('0x2b')][_0x1d41('0x4a')]({'where':{'id':_0x5b3462[_0x1d41('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d716a,null))['then'](function(_0x2c41a8){if(_0x2c41a8){_0x277f04=_0x2c41a8;_0x2fcf9e[_0x1d41('0x32')]=_['keys'](db['ZohoField']['rawAttributes']);_0x2fcf9e[_0x1d41('0x2f')]=_[_0x1d41('0x30')](_0x5b3462['query']);_0x2fcf9e[_0x1d41('0x3b')]=_[_0x1d41('0x31')](_0x2fcf9e[_0x1d41('0x32')],_0x2fcf9e[_0x1d41('0x2f')]);_0x181d0e[_0x1d41('0x33')]=_[_0x1d41('0x31')](_0x2fcf9e[_0x1d41('0x32')],qs[_0x1d41('0x34')](_0x5b3462[_0x1d41('0x2f')]['fields']));_0x181d0e[_0x1d41('0x33')]=_0x181d0e['attributes'][_0x1d41('0x35')]?_0x181d0e[_0x1d41('0x33')]:_0x2fcf9e[_0x1d41('0x32')];_0x181d0e[_0x1d41('0x38')]=qs[_0x1d41('0x39')](_0x5b3462[_0x1d41('0x2f')][_0x1d41('0x39')]);_0x181d0e[_0x1d41('0x3a')]=qs[_0x1d41('0x3b')](_[_0x1d41('0x4b')](_0x5b3462['query'],_0x2fcf9e['filters']));if(_0x5b3462['query'][_0x1d41('0x3c')]){_0x181d0e[_0x1d41('0x3a')]=_[_0x1d41('0x3d')](_0x181d0e[_0x1d41('0x3a')],{'$or':_[_0x1d41('0x2a')](_0x181d0e[_0x1d41('0x33')],function(_0x5192c5){var _0xf08d18={};_0xf08d18[_0x5192c5]={'$like':'%'+_0x5b3462['query'][_0x1d41('0x3c')]+'%'};return _0xf08d18;})});}_0x181d0e=_['merge']({},_0x181d0e,_0x5b3462['options']);return _0x277f04[_0x1d41('0x49')](_0x181d0e);}})[_0x1d41('0x25')](function(_0x589c8f){if(_0x589c8f){_0x51c181=_0x589c8f[_0x1d41('0x35')];if(!_0x5b3462[_0x1d41('0x2f')][_0x1d41('0x36')](_0x1d41('0x37'))){_0x181d0e[_0x1d41('0x1e')]=qs[_0x1d41('0x1e')](_0x5b3462[_0x1d41('0x2f')][_0x1d41('0x1e')]);_0x181d0e[_0x1d41('0x1d')]=qs[_0x1d41('0x1d')](_0x5b3462[_0x1d41('0x2f')][_0x1d41('0x1d')]);}return _0x277f04[_0x1d41('0x49')](_0x181d0e);}})[_0x1d41('0x25')](function(_0x1d1744){if(_0x1d1744){return _0x1d1744?{'count':_0x51c181,'rows':_0x1d1744}:null;}})[_0x1d41('0x25')](respondWithResult(_0x5d716a,null))[_0x1d41('0x42')](handleError(_0x5d716a,null));};exports[_0x1d41('0x4c')]=function(_0x2972d1,_0x459e1f,_0x43864b){var _0xd4682e={};var _0x1ff662={};var _0x119891;var _0x462d6b;return db['ZohoConfiguration'][_0x1d41('0x4a')]({'where':{'id':_0x2972d1['params']['id']}})['then'](handleEntityNotFound(_0x459e1f,null))[_0x1d41('0x25')](function(_0x449d14){if(_0x449d14){_0x119891=_0x449d14;_0x1ff662['model']=_[_0x1d41('0x30')](db[_0x1d41('0x4d')][_0x1d41('0x4e')]);_0x1ff662[_0x1d41('0x2f')]=_[_0x1d41('0x30')](_0x2972d1[_0x1d41('0x2f')]);_0x1ff662[_0x1d41('0x3b')]=_[_0x1d41('0x31')](_0x1ff662[_0x1d41('0x32')],_0x1ff662['query']);_0xd4682e[_0x1d41('0x33')]=_[_0x1d41('0x31')](_0x1ff662['model'],qs['fields'](_0x2972d1[_0x1d41('0x2f')]['fields']));_0xd4682e['attributes']=_0xd4682e['attributes'][_0x1d41('0x35')]?_0xd4682e['attributes']:_0x1ff662[_0x1d41('0x32')];_0xd4682e['order']=qs[_0x1d41('0x39')](_0x2972d1[_0x1d41('0x2f')]['sort']);_0xd4682e[_0x1d41('0x3a')]=qs['filters'](_['pick'](_0x2972d1[_0x1d41('0x2f')],_0x1ff662[_0x1d41('0x3b')]));if(_0x2972d1['query'][_0x1d41('0x3c')]){_0xd4682e[_0x1d41('0x3a')]=_[_0x1d41('0x3d')](_0xd4682e['where'],{'$or':_[_0x1d41('0x2a')](_0xd4682e[_0x1d41('0x33')],function(_0x354302){var _0x23791e={};_0x23791e[_0x354302]={'$like':'%'+_0x2972d1[_0x1d41('0x2f')]['filter']+'%'};return _0x23791e;})});}_0xd4682e=_['merge']({},_0xd4682e,_0x2972d1[_0x1d41('0x3e')]);return _0x119891[_0x1d41('0x4c')](_0xd4682e);}})[_0x1d41('0x25')](function(_0x15b877){if(_0x15b877){_0x462d6b=_0x15b877['length'];if(!_0x2972d1[_0x1d41('0x2f')][_0x1d41('0x36')]('nolimit')){_0xd4682e[_0x1d41('0x1e')]=qs[_0x1d41('0x1e')](_0x2972d1[_0x1d41('0x2f')][_0x1d41('0x1e')]);_0xd4682e[_0x1d41('0x1d')]=qs[_0x1d41('0x1d')](_0x2972d1[_0x1d41('0x2f')]['offset']);}return _0x119891[_0x1d41('0x4c')](_0xd4682e);}})[_0x1d41('0x25')](function(_0x2984cc){if(_0x2984cc){return _0x2984cc?{'count':_0x462d6b,'rows':_0x2984cc}:null;}})['then'](respondWithResult(_0x459e1f,null))[_0x1d41('0x42')](handleError(_0x459e1f,null));};exports[_0x1d41('0x4f')]=function(_0x235be1,_0x5daab9,_0x34f012){var _0x3e6b31={};var _0x51f5a8={};var _0x1a535b;var _0x4e4096;return db['ZohoConfiguration'][_0x1d41('0x4a')]({'where':{'id':_0x235be1[_0x1d41('0x44')]['id']}})[_0x1d41('0x25')](handleEntityNotFound(_0x5daab9,null))['then'](function(_0x5e1f29){if(_0x5e1f29){_0x1a535b=_0x5e1f29;_0x51f5a8[_0x1d41('0x32')]=_[_0x1d41('0x30')](db['ZohoField'][_0x1d41('0x4e')]);_0x51f5a8[_0x1d41('0x2f')]=_[_0x1d41('0x30')](_0x235be1[_0x1d41('0x2f')]);_0x51f5a8[_0x1d41('0x3b')]=_[_0x1d41('0x31')](_0x51f5a8['model'],_0x51f5a8[_0x1d41('0x2f')]);_0x3e6b31[_0x1d41('0x33')]=_[_0x1d41('0x31')](_0x51f5a8[_0x1d41('0x32')],qs[_0x1d41('0x34')](_0x235be1[_0x1d41('0x2f')][_0x1d41('0x34')]));_0x3e6b31[_0x1d41('0x33')]=_0x3e6b31[_0x1d41('0x33')][_0x1d41('0x35')]?_0x3e6b31['attributes']:_0x51f5a8['model'];_0x3e6b31[_0x1d41('0x38')]=qs[_0x1d41('0x39')](_0x235be1[_0x1d41('0x2f')][_0x1d41('0x39')]);_0x3e6b31[_0x1d41('0x3a')]=qs['filters'](_['pick'](_0x235be1[_0x1d41('0x2f')],_0x51f5a8[_0x1d41('0x3b')]));if(_0x235be1[_0x1d41('0x2f')][_0x1d41('0x3c')]){_0x3e6b31[_0x1d41('0x3a')]=_[_0x1d41('0x3d')](_0x3e6b31[_0x1d41('0x3a')],{'$or':_[_0x1d41('0x2a')](_0x3e6b31[_0x1d41('0x33')],function(_0x13983c){var _0x49d32f={};_0x49d32f[_0x13983c]={'$like':'%'+_0x235be1[_0x1d41('0x2f')][_0x1d41('0x3c')]+'%'};return _0x49d32f;})});}_0x3e6b31=_[_0x1d41('0x3d')]({},_0x3e6b31,_0x235be1[_0x1d41('0x3e')]);return _0x1a535b[_0x1d41('0x4f')](_0x3e6b31);}})[_0x1d41('0x25')](function(_0x563f79){if(_0x563f79){_0x4e4096=_0x563f79[_0x1d41('0x35')];if(!_0x235be1[_0x1d41('0x2f')]['hasOwnProperty'](_0x1d41('0x37'))){_0x3e6b31[_0x1d41('0x1e')]=qs[_0x1d41('0x1e')](_0x235be1[_0x1d41('0x2f')][_0x1d41('0x1e')]);_0x3e6b31['offset']=qs[_0x1d41('0x1d')](_0x235be1['query'][_0x1d41('0x1d')]);}return _0x1a535b[_0x1d41('0x4f')](_0x3e6b31);}})['then'](function(_0x41358a){if(_0x41358a){return _0x41358a?{'count':_0x4e4096,'rows':_0x41358a}:null;}})[_0x1d41('0x25')](respondWithResult(_0x5daab9,null))[_0x1d41('0x42')](handleError(_0x5daab9,null));}; \ No newline at end of file +var _0x57b0=['pick','filter','type','VIRTUAL','name','merge','includeAll','include','ZohoConfiguration','rows','catch','show','params','options','body','find','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','then','destroy','error','map','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters'];(function(_0x2087e8,_0x2ed4f7){var _0x2d8ec1=function(_0x298090){while(--_0x298090){_0x2087e8['push'](_0x2087e8['shift']());}};_0x2d8ec1(++_0x2ed4f7);}(_0x57b0,0x103));var _0x057b=function(_0x1b34c7,_0x48cfca){_0x1b34c7=_0x1b34c7-0x0;var _0x257afe=_0x57b0[_0x1b34c7];return _0x257afe;};'use strict';var emlformat=require(_0x057b('0x0'));var rimraf=require(_0x057b('0x1'));var zipdir=require(_0x057b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x057b('0x3'));var moment=require(_0x057b('0x4'));var BPromise=require(_0x057b('0x5'));var Mustache=require(_0x057b('0x6'));var util=require(_0x057b('0x7'));var path=require(_0x057b('0x8'));var sox=require(_0x057b('0x9'));var csv=require(_0x057b('0xa'));var ejs=require(_0x057b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x057b('0xc'));var squel=require(_0x057b('0xd'));var crypto=require(_0x057b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x057b('0xf'));var toCsv=require(_0x057b('0xa'));var querystring=require(_0x057b('0x10'));var Papa=require(_0x057b('0x11'));var Redis=require(_0x057b('0x12'));var authService=require(_0x057b('0x13'));var qs=require(_0x057b('0x14'));var as=require(_0x057b('0x15'));var hardwareService=require(_0x057b('0x16'));var logger=require(_0x057b('0x17'))('api');var utils=require(_0x057b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x057b('0x19'));var db=require(_0x057b('0x1a'))['db'];function respondWithStatusCode(_0x8c258c,_0x166176){_0x166176=_0x166176||0xcc;return function(_0x3f527a){if(_0x3f527a){return _0x8c258c[_0x057b('0x1b')](_0x166176);}return _0x8c258c[_0x057b('0x1c')](_0x166176)[_0x057b('0x1d')]();};}function respondWithResult(_0x3d95a7,_0x5c1a7e){_0x5c1a7e=_0x5c1a7e||0xc8;return function(_0x1f4a7){if(_0x1f4a7){return _0x3d95a7[_0x057b('0x1c')](_0x5c1a7e)[_0x057b('0x1e')](_0x1f4a7);}};}function respondWithFilteredResult(_0x3a2d78,_0x166bfd){return function(_0x2e65db){if(_0x2e65db){var _0x15e5a0=typeof _0x166bfd['offset']===_0x057b('0x1f')&&typeof _0x166bfd['limit']===_0x057b('0x1f');var _0x356465=_0x2e65db[_0x057b('0x20')];var _0x2dec4b=_0x15e5a0?0x0:_0x166bfd[_0x057b('0x21')];var _0x5ec4cb=_0x15e5a0?_0x2e65db[_0x057b('0x20')]:_0x166bfd['offset']+_0x166bfd['limit'];var _0x314a4d;if(_0x5ec4cb>=_0x356465){_0x5ec4cb=_0x356465;_0x314a4d=0xc8;}else{_0x314a4d=0xce;}_0x3a2d78['status'](_0x314a4d);return _0x3a2d78[_0x057b('0x22')](_0x057b('0x23'),_0x2dec4b+'-'+_0x5ec4cb+'/'+_0x356465)[_0x057b('0x1e')](_0x2e65db);}return null;};}function patchUpdates(_0x1a476d){return function(_0x3686a4){try{jsonpatch['apply'](_0x3686a4,_0x1a476d,!![]);}catch(_0x11e7e4){return BPromise[_0x057b('0x24')](_0x11e7e4);}return _0x3686a4['save']();};}function saveUpdates(_0x21b034,_0x475345){return function(_0x36c9c3){if(_0x36c9c3){return _0x36c9c3[_0x057b('0x25')](_0x21b034)[_0x057b('0x26')](function(_0x42f4fd){return _0x42f4fd;});}return null;};}function removeEntity(_0x58f128,_0x15fa71){return function(_0x3a318d){if(_0x3a318d){return _0x3a318d[_0x057b('0x27')]()[_0x057b('0x26')](function(){_0x58f128[_0x057b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5732a7,_0xc462ad){return function(_0x246f29){if(!_0x246f29){_0x5732a7[_0x057b('0x1b')](0x194);}return _0x246f29;};}function handleError(_0x4ba482,_0x933a76){_0x933a76=_0x933a76||0x1f4;return function(_0x29fa05){logger[_0x057b('0x28')](_0x29fa05['stack']);if(_0x29fa05['name']){delete _0x29fa05['name'];}_0x4ba482[_0x057b('0x1c')](_0x933a76)['send'](_0x29fa05);};}exports['index']=function(_0x77f8a1,_0x4083d2){var _0x702ae5={},_0x2b67ca={},_0x89e658={'count':0x0,'rows':[]};var _0x5abbb8=_[_0x057b('0x29')](db['ZohoConfiguration'][_0x057b('0x2a')],function(_0x314d64){return{'name':_0x314d64[_0x057b('0x2b')],'type':_0x314d64['type']['key']};});_0x2b67ca[_0x057b('0x2c')]=_[_0x057b('0x29')](_0x5abbb8,'name');_0x2b67ca['query']=_[_0x057b('0x2d')](_0x77f8a1[_0x057b('0x2e')]);_0x2b67ca['filters']=_[_0x057b('0x2f')](_0x2b67ca['model'],_0x2b67ca[_0x057b('0x2e')]);_0x702ae5[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x2b67ca['model'],qs[_0x057b('0x31')](_0x77f8a1[_0x057b('0x2e')][_0x057b('0x31')]));_0x702ae5[_0x057b('0x30')]=_0x702ae5['attributes'][_0x057b('0x32')]?_0x702ae5[_0x057b('0x30')]:_0x2b67ca['model'];if(!_0x77f8a1[_0x057b('0x2e')][_0x057b('0x33')]('nolimit')){_0x702ae5[_0x057b('0x34')]=qs[_0x057b('0x34')](_0x77f8a1[_0x057b('0x2e')][_0x057b('0x34')]);_0x702ae5[_0x057b('0x21')]=qs[_0x057b('0x21')](_0x77f8a1[_0x057b('0x2e')]['offset']);}_0x702ae5[_0x057b('0x35')]=qs[_0x057b('0x36')](_0x77f8a1[_0x057b('0x2e')]['sort']);_0x702ae5[_0x057b('0x37')]=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x77f8a1[_0x057b('0x2e')],_0x2b67ca[_0x057b('0x38')]),_0x5abbb8);if(_0x77f8a1[_0x057b('0x2e')][_0x057b('0x3a')]){_0x702ae5['where']=_['merge'](_0x702ae5[_0x057b('0x37')],{'$or':_[_0x057b('0x29')](_0x5abbb8,function(_0x5931cf){if(_0x5931cf[_0x057b('0x3b')]!==_0x057b('0x3c')){var _0x11483d={};_0x11483d[_0x5931cf[_0x057b('0x3d')]]={'$like':'%'+_0x77f8a1[_0x057b('0x2e')][_0x057b('0x3a')]+'%'};return _0x11483d;}})});}_0x702ae5=_[_0x057b('0x3e')]({},_0x702ae5,_0x77f8a1['options']);var _0x31adce={'where':_0x702ae5[_0x057b('0x37')]};return db['ZohoConfiguration']['count'](_0x31adce)[_0x057b('0x26')](function(_0x64d507){_0x89e658[_0x057b('0x20')]=_0x64d507;if(_0x77f8a1[_0x057b('0x2e')][_0x057b('0x3f')]){_0x702ae5[_0x057b('0x40')]=[{'all':!![]}];}return db[_0x057b('0x41')]['findAll'](_0x702ae5);})[_0x057b('0x26')](function(_0x4a0944){_0x89e658[_0x057b('0x42')]=_0x4a0944;return _0x89e658;})[_0x057b('0x26')](respondWithFilteredResult(_0x4083d2,_0x702ae5))[_0x057b('0x43')](handleError(_0x4083d2,null));};exports[_0x057b('0x44')]=function(_0xd65821,_0x20ce00){var _0x5c0497={'raw':![],'where':{'id':_0xd65821[_0x057b('0x45')]['id']}},_0xe90ed8={};_0xe90ed8[_0x057b('0x2c')]=_[_0x057b('0x2d')](db['ZohoConfiguration'][_0x057b('0x2a')]);_0xe90ed8[_0x057b('0x2e')]=_[_0x057b('0x2d')](_0xd65821[_0x057b('0x2e')]);_0xe90ed8[_0x057b('0x38')]=_['intersection'](_0xe90ed8[_0x057b('0x2c')],_0xe90ed8[_0x057b('0x2e')]);_0x5c0497['attributes']=_[_0x057b('0x2f')](_0xe90ed8[_0x057b('0x2c')],qs['fields'](_0xd65821['query']['fields']));_0x5c0497[_0x057b('0x30')]=_0x5c0497['attributes'][_0x057b('0x32')]?_0x5c0497[_0x057b('0x30')]:_0xe90ed8[_0x057b('0x2c')];if(_0xd65821[_0x057b('0x2e')][_0x057b('0x3f')]){_0x5c0497[_0x057b('0x40')]=[{'all':!![]}];}_0x5c0497=_['merge']({},_0x5c0497,_0xd65821[_0x057b('0x46')]);return db[_0x057b('0x41')]['find'](_0x5c0497)[_0x057b('0x26')](handleEntityNotFound(_0x20ce00,null))[_0x057b('0x26')](respondWithResult(_0x20ce00,null))[_0x057b('0x43')](handleError(_0x20ce00,null));};exports['create']=function(_0x1f6bda,_0x376dd3){return db[_0x057b('0x41')]['create'](_0x1f6bda[_0x057b('0x47')],{})[_0x057b('0x26')](respondWithResult(_0x376dd3,0xc9))[_0x057b('0x43')](handleError(_0x376dd3,null));};exports[_0x057b('0x25')]=function(_0x2fda90,_0x468656){if(_0x2fda90[_0x057b('0x47')]['id']){delete _0x2fda90['body']['id'];}return db[_0x057b('0x41')]['find']({'where':{'id':_0x2fda90['params']['id']}})['then'](handleEntityNotFound(_0x468656,null))[_0x057b('0x26')](saveUpdates(_0x2fda90[_0x057b('0x47')],null))[_0x057b('0x26')](respondWithResult(_0x468656,null))[_0x057b('0x43')](handleError(_0x468656,null));};exports[_0x057b('0x27')]=function(_0x3dd11d,_0x5dd1db){return db[_0x057b('0x41')][_0x057b('0x48')]({'where':{'id':_0x3dd11d[_0x057b('0x45')]['id']}})[_0x057b('0x26')](handleEntityNotFound(_0x5dd1db,null))[_0x057b('0x26')](removeEntity(_0x5dd1db,null))[_0x057b('0x43')](handleError(_0x5dd1db,null));};exports[_0x057b('0x49')]=function(_0x1900c9,_0xfa78ab,_0x788877){var _0x197320={};var _0x31c27c={};var _0x57fa8a;var _0x2e1b83;return db[_0x057b('0x41')][_0x057b('0x4a')]({'where':{'id':_0x1900c9[_0x057b('0x45')]['id']}})[_0x057b('0x26')](handleEntityNotFound(_0xfa78ab,null))[_0x057b('0x26')](function(_0x7ebe43){if(_0x7ebe43){_0x57fa8a=_0x7ebe43;_0x31c27c[_0x057b('0x2c')]=_[_0x057b('0x2d')](db[_0x057b('0x4b')]['rawAttributes']);_0x31c27c[_0x057b('0x2e')]=_[_0x057b('0x2d')](_0x1900c9[_0x057b('0x2e')]);_0x31c27c[_0x057b('0x38')]=_[_0x057b('0x2f')](_0x31c27c['model'],_0x31c27c[_0x057b('0x2e')]);_0x197320[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x31c27c[_0x057b('0x2c')],qs[_0x057b('0x31')](_0x1900c9[_0x057b('0x2e')][_0x057b('0x31')]));_0x197320[_0x057b('0x30')]=_0x197320[_0x057b('0x30')][_0x057b('0x32')]?_0x197320['attributes']:_0x31c27c[_0x057b('0x2c')];_0x197320['order']=qs['sort'](_0x1900c9['query']['sort']);_0x197320['where']=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x1900c9['query'],_0x31c27c['filters']));if(_0x1900c9[_0x057b('0x2e')]['filter']){_0x197320[_0x057b('0x37')]=_[_0x057b('0x3e')](_0x197320[_0x057b('0x37')],{'$or':_[_0x057b('0x29')](_0x197320['attributes'],function(_0x39111a){var _0x544010={};_0x544010[_0x39111a]={'$like':'%'+_0x1900c9[_0x057b('0x2e')][_0x057b('0x3a')]+'%'};return _0x544010;})});}_0x197320=_['merge']({},_0x197320,_0x1900c9[_0x057b('0x46')]);return _0x57fa8a[_0x057b('0x49')](_0x197320);}})[_0x057b('0x26')](function(_0x2df354){if(_0x2df354){_0x2e1b83=_0x2df354[_0x057b('0x32')];if(!_0x1900c9[_0x057b('0x2e')]['hasOwnProperty'](_0x057b('0x4c'))){_0x197320[_0x057b('0x34')]=qs[_0x057b('0x34')](_0x1900c9[_0x057b('0x2e')][_0x057b('0x34')]);_0x197320['offset']=qs[_0x057b('0x21')](_0x1900c9[_0x057b('0x2e')][_0x057b('0x21')]);}return _0x57fa8a[_0x057b('0x49')](_0x197320);}})[_0x057b('0x26')](function(_0xc7ec77){if(_0xc7ec77){return _0xc7ec77?{'count':_0x2e1b83,'rows':_0xc7ec77}:null;}})[_0x057b('0x26')](respondWithResult(_0xfa78ab,null))[_0x057b('0x43')](handleError(_0xfa78ab,null));};exports[_0x057b('0x4d')]=function(_0x374377,_0x3eb223,_0xccf527){var _0x4ed969={};var _0x550203={};var _0x52944b;var _0x17319c;return db[_0x057b('0x41')][_0x057b('0x4a')]({'where':{'id':_0x374377[_0x057b('0x45')]['id']}})[_0x057b('0x26')](handleEntityNotFound(_0x3eb223,null))[_0x057b('0x26')](function(_0x3458fb){if(_0x3458fb){_0x52944b=_0x3458fb;_0x550203[_0x057b('0x2c')]=_[_0x057b('0x2d')](db[_0x057b('0x4b')][_0x057b('0x2a')]);_0x550203[_0x057b('0x2e')]=_['keys'](_0x374377[_0x057b('0x2e')]);_0x550203['filters']=_['intersection'](_0x550203[_0x057b('0x2c')],_0x550203['query']);_0x4ed969[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x550203['model'],qs[_0x057b('0x31')](_0x374377[_0x057b('0x2e')][_0x057b('0x31')]));_0x4ed969[_0x057b('0x30')]=_0x4ed969[_0x057b('0x30')][_0x057b('0x32')]?_0x4ed969['attributes']:_0x550203['model'];_0x4ed969[_0x057b('0x35')]=qs[_0x057b('0x36')](_0x374377[_0x057b('0x2e')][_0x057b('0x36')]);_0x4ed969[_0x057b('0x37')]=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x374377[_0x057b('0x2e')],_0x550203[_0x057b('0x38')]));if(_0x374377[_0x057b('0x2e')][_0x057b('0x3a')]){_0x4ed969[_0x057b('0x37')]=_[_0x057b('0x3e')](_0x4ed969[_0x057b('0x37')],{'$or':_['map'](_0x4ed969[_0x057b('0x30')],function(_0x550e40){var _0x2e0658={};_0x2e0658[_0x550e40]={'$like':'%'+_0x374377['query'][_0x057b('0x3a')]+'%'};return _0x2e0658;})});}_0x4ed969=_[_0x057b('0x3e')]({},_0x4ed969,_0x374377['options']);return _0x52944b['getSubjects'](_0x4ed969);}})['then'](function(_0x4b8923){if(_0x4b8923){_0x17319c=_0x4b8923['length'];if(!_0x374377['query'][_0x057b('0x33')](_0x057b('0x4c'))){_0x4ed969[_0x057b('0x34')]=qs[_0x057b('0x34')](_0x374377['query']['limit']);_0x4ed969[_0x057b('0x21')]=qs['offset'](_0x374377['query'][_0x057b('0x21')]);}return _0x52944b['getSubjects'](_0x4ed969);}})[_0x057b('0x26')](function(_0x4e9111){if(_0x4e9111){return _0x4e9111?{'count':_0x17319c,'rows':_0x4e9111}:null;}})['then'](respondWithResult(_0x3eb223,null))['catch'](handleError(_0x3eb223,null));};exports[_0x057b('0x4e')]=function(_0x2ef831,_0x3430f3,_0xfb5f4d){var _0x4f3f26={};var _0x3d3e92={};var _0x50d2fa;var _0xb65ef7;return db[_0x057b('0x41')][_0x057b('0x4a')]({'where':{'id':_0x2ef831['params']['id']}})[_0x057b('0x26')](handleEntityNotFound(_0x3430f3,null))['then'](function(_0x534c67){if(_0x534c67){_0x50d2fa=_0x534c67;_0x3d3e92[_0x057b('0x2c')]=_['keys'](db['ZohoField'][_0x057b('0x2a')]);_0x3d3e92['query']=_[_0x057b('0x2d')](_0x2ef831[_0x057b('0x2e')]);_0x3d3e92[_0x057b('0x38')]=_[_0x057b('0x2f')](_0x3d3e92[_0x057b('0x2c')],_0x3d3e92[_0x057b('0x2e')]);_0x4f3f26[_0x057b('0x30')]=_[_0x057b('0x2f')](_0x3d3e92['model'],qs['fields'](_0x2ef831['query']['fields']));_0x4f3f26['attributes']=_0x4f3f26[_0x057b('0x30')][_0x057b('0x32')]?_0x4f3f26[_0x057b('0x30')]:_0x3d3e92[_0x057b('0x2c')];_0x4f3f26[_0x057b('0x35')]=qs[_0x057b('0x36')](_0x2ef831[_0x057b('0x2e')][_0x057b('0x36')]);_0x4f3f26[_0x057b('0x37')]=qs[_0x057b('0x38')](_[_0x057b('0x39')](_0x2ef831[_0x057b('0x2e')],_0x3d3e92[_0x057b('0x38')]));if(_0x2ef831[_0x057b('0x2e')][_0x057b('0x3a')]){_0x4f3f26[_0x057b('0x37')]=_['merge'](_0x4f3f26[_0x057b('0x37')],{'$or':_[_0x057b('0x29')](_0x4f3f26[_0x057b('0x30')],function(_0x2c474c){var _0x35516b={};_0x35516b[_0x2c474c]={'$like':'%'+_0x2ef831['query'][_0x057b('0x3a')]+'%'};return _0x35516b;})});}_0x4f3f26=_['merge']({},_0x4f3f26,_0x2ef831[_0x057b('0x46')]);return _0x50d2fa['getDescriptions'](_0x4f3f26);}})['then'](function(_0x134e24){if(_0x134e24){_0xb65ef7=_0x134e24[_0x057b('0x32')];if(!_0x2ef831[_0x057b('0x2e')]['hasOwnProperty'](_0x057b('0x4c'))){_0x4f3f26['limit']=qs[_0x057b('0x34')](_0x2ef831[_0x057b('0x2e')][_0x057b('0x34')]);_0x4f3f26[_0x057b('0x21')]=qs[_0x057b('0x21')](_0x2ef831[_0x057b('0x2e')][_0x057b('0x21')]);}return _0x50d2fa[_0x057b('0x4e')](_0x4f3f26);}})['then'](function(_0x3a199e){if(_0x3a199e){return _0x3a199e?{'count':_0xb65ef7,'rows':_0x3a199e}:null;}})['then'](respondWithResult(_0x3430f3,null))['catch'](handleError(_0x3430f3,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d332161..a7da38f 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 _0x3708=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x28c791,_0x32de4b){var _0x24eb17=function(_0x105e5b){while(--_0x105e5b){_0x28c791['push'](_0x28c791['shift']());}};_0x24eb17(++_0x32de4b);}(_0x3708,0xcf));var _0x8370=function(_0x5874ad,_0x3b22bb){_0x5874ad=_0x5874ad-0x0;var _0x5cdde9=_0x3708[_0x5874ad];return _0x5cdde9;};'use strict';var _=require(_0x8370('0x0'));var util=require(_0x8370('0x1'));var logger=require(_0x8370('0x2'))('api');var moment=require(_0x8370('0x3'));var BPromise=require(_0x8370('0x4'));var rp=require(_0x8370('0x5'));var fs=require('fs');var path=require(_0x8370('0x6'));var rimraf=require(_0x8370('0x7'));var config=require(_0x8370('0x8'));var attributes=require(_0x8370('0x9'));module[_0x8370('0xa')]=function(_0xf50e0f,_0x35e893){return _0xf50e0f[_0x8370('0xb')](_0x8370('0xc'),attributes,{'tableName':_0x8370('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1744=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','lodash','util'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0x1744,0x1a2));var _0x4174=function(_0x49157b,_0x5d8601){_0x49157b=_0x49157b-0x0;var _0x3ea5d4=_0x1744[_0x49157b];return _0x3ea5d4;};'use strict';var _=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));var logger=require(_0x4174('0x2'))(_0x4174('0x3'));var moment=require(_0x4174('0x4'));var BPromise=require(_0x4174('0x5'));var rp=require(_0x4174('0x6'));var fs=require('fs');var path=require(_0x4174('0x7'));var rimraf=require(_0x4174('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x2acbcc,_0x5247c1){return _0x2acbcc[_0x4174('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 8efac23..7c6cdb7 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 _0x9bae=['http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x354cac,_0x1f24ee){var _0x1dfca8=function(_0x4642f3){while(--_0x4642f3){_0x354cac['push'](_0x354cac['shift']());}};_0x1dfca8(++_0x1f24ee);}(_0x9bae,0xd1));var _0xe9ba=function(_0x324455,_0x470f56){_0x324455=_0x324455-0x0;var _0x1e21b3=_0x9bae[_0x324455];return _0x1e21b3;};'use strict';var _=require(_0xe9ba('0x0'));var util=require(_0xe9ba('0x1'));var moment=require('moment');var BPromise=require(_0xe9ba('0x2'));var rs=require(_0xe9ba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9ba('0x4'))['db'];var utils=require(_0xe9ba('0x5'));var logger=require(_0xe9ba('0x6'))(_0xe9ba('0x7'));var config=require(_0xe9ba('0x8'));var jayson=require(_0xe9ba('0x9'));var client=jayson[_0xe9ba('0xa')][_0xe9ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x67f2c7,_0x114f22,_0x4caf23){return new BPromise(function(_0x222bcf,_0x1d5add){return client[_0xe9ba('0xc')](_0x67f2c7,_0x4caf23)[_0xe9ba('0xd')](function(_0x37e5c){logger['info'](_0xe9ba('0xe'),_0x114f22,_0xe9ba('0xf'));logger['debug'](_0xe9ba('0x10'),_0x114f22,'request\x20sent',JSON[_0xe9ba('0x11')](_0x37e5c));if(_0x37e5c[_0xe9ba('0x12')]){if(_0x37e5c[_0xe9ba('0x12')][_0xe9ba('0x13')]===0x1f4){logger[_0xe9ba('0x12')](_0xe9ba('0xe'),_0x114f22,_0x37e5c[_0xe9ba('0x12')]['message']);return _0x1d5add(_0x37e5c['error'][_0xe9ba('0x14')]);}logger[_0xe9ba('0x12')](_0xe9ba('0xe'),_0x114f22,_0x37e5c[_0xe9ba('0x12')][_0xe9ba('0x14')]);return _0x222bcf(_0x37e5c[_0xe9ba('0x12')]['message']);}else{logger[_0xe9ba('0x15')](_0xe9ba('0xe'),_0x114f22,_0xe9ba('0xf'));_0x222bcf(_0x37e5c['result'][_0xe9ba('0x14')]);}})['catch'](function(_0x50b205){logger['error'](_0xe9ba('0xe'),_0x114f22,_0x50b205);_0x1d5add(_0x50b205);});});} \ No newline at end of file +var _0x0fe3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch'];(function(_0xbd9079,_0x635c14){var _0x1e7151=function(_0xc42453){while(--_0xc42453){_0xbd9079['push'](_0xbd9079['shift']());}};_0x1e7151(++_0x635c14);}(_0x0fe3,0x187));var _0x30fe=function(_0x25e149,_0x410dea){_0x25e149=_0x25e149-0x0;var _0x1507be=_0x0fe3[_0x25e149];return _0x1507be;};'use strict';var _=require(_0x30fe('0x0'));var util=require(_0x30fe('0x1'));var moment=require(_0x30fe('0x2'));var BPromise=require(_0x30fe('0x3'));var rs=require(_0x30fe('0x4'));var fs=require('fs');var Redis=require(_0x30fe('0x5'));var db=require(_0x30fe('0x6'))['db'];var utils=require(_0x30fe('0x7'));var logger=require(_0x30fe('0x8'))(_0x30fe('0x9'));var config=require(_0x30fe('0xa'));var jayson=require(_0x30fe('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20626e,_0x3d9613,_0x520a2d){return new BPromise(function(_0xb56447,_0x57b1a6){return client[_0x30fe('0xc')](_0x20626e,_0x520a2d)['then'](function(_0x579428){logger[_0x30fe('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d9613,_0x30fe('0xe'));logger[_0x30fe('0xf')](_0x30fe('0x10'),_0x3d9613,_0x30fe('0xe'),JSON[_0x30fe('0x11')](_0x579428));if(_0x579428[_0x30fe('0x12')]){if(_0x579428['error'][_0x30fe('0x13')]===0x1f4){logger[_0x30fe('0x12')](_0x30fe('0x14'),_0x3d9613,_0x579428[_0x30fe('0x12')][_0x30fe('0x15')]);return _0x57b1a6(_0x579428[_0x30fe('0x12')][_0x30fe('0x15')]);}logger[_0x30fe('0x12')](_0x30fe('0x14'),_0x3d9613,_0x579428['error'][_0x30fe('0x15')]);return _0xb56447(_0x579428[_0x30fe('0x12')]['message']);}else{logger[_0x30fe('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d9613,_0x30fe('0xe'));_0xb56447(_0x579428['result'][_0x30fe('0x15')]);}})[_0x30fe('0x16')](function(_0x38c91c){logger[_0x30fe('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d9613,_0x38c91c);_0x57b1a6(_0x38c91c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d2a5f8d..28eba1d 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 _0xcce6=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x438d04,_0x180a0b){var _0x597901=function(_0x3d4fd7){while(--_0x3d4fd7){_0x438d04['push'](_0x438d04['shift']());}};_0x597901(++_0x180a0b);}(_0xcce6,0x17a));var _0x6cce=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0xcce6[_0x1ac6ec];return _0x48a489;};'use strict';var multer=require(_0x6cce('0x0'));var util=require(_0x6cce('0x1'));var path=require(_0x6cce('0x2'));var timeout=require(_0x6cce('0x3'));var express=require('express');var router=express[_0x6cce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cce('0x5'));var interaction=require(_0x6cce('0x6'));var config=require('../../config/environment');var controller=require(_0x6cce('0x7'));router[_0x6cce('0x8')]('/',auth['isAuthenticated'](),controller[_0x6cce('0x9')]);router['get'](_0x6cce('0xa'),auth[_0x6cce('0xb')](),controller['show']);router['post']('/',auth[_0x6cce('0xb')](),controller[_0x6cce('0xc')]);router[_0x6cce('0xd')](_0x6cce('0xa'),auth[_0x6cce('0xb')](),controller[_0x6cce('0xe')]);router[_0x6cce('0xf')](_0x6cce('0xa'),auth[_0x6cce('0xb')](),controller[_0x6cce('0x10')]);module[_0x6cce('0x11')]=router; \ No newline at end of file +var _0x3a50=['isAuthenticated','get','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoField.controller'];(function(_0x54546f,_0xaad9b8){var _0x1784bc=function(_0x375a2b){while(--_0x375a2b){_0x54546f['push'](_0x54546f['shift']());}};_0x1784bc(++_0xaad9b8);}(_0x3a50,0x124));var _0x03a5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3a50[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x03a5('0x0'));var util=require(_0x03a5('0x1'));var path=require(_0x03a5('0x2'));var timeout=require(_0x03a5('0x3'));var express=require('express');var router=express[_0x03a5('0x4')]();var fs_extra=require(_0x03a5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x03a5('0x6'));var config=require('../../config/environment');var controller=require(_0x03a5('0x7'));router['get']('/',auth[_0x03a5('0x8')](),controller['index']);router[_0x03a5('0x9')](_0x03a5('0xa'),auth[_0x03a5('0x8')](),controller[_0x03a5('0xb')]);router['post']('/',auth[_0x03a5('0x8')](),controller[_0x03a5('0xc')]);router['put']('/:id',auth[_0x03a5('0x8')](),controller['update']);router[_0x03a5('0xd')](_0x03a5('0xa'),auth['isAuthenticated'](),controller[_0x03a5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 64cca9b..52b924b 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 _0xcc58=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x51bbeb,_0x54a938){var _0x120f02=function(_0x57d900){while(--_0x57d900){_0x51bbeb['push'](_0x51bbeb['shift']());}};_0x120f02(++_0x54a938);}(_0xcc58,0x119));var _0x8cc5=function(_0x49974e,_0x4facfc){_0x49974e=_0x49974e-0x0;var _0x33b143=_0xcc58[_0x49974e];return _0x33b143;};'use strict';var Sequelize=require(_0x8cc5('0x0'));module[_0x8cc5('0x1')]={'type':{'type':Sequelize[_0x8cc5('0x2')](_0x8cc5('0x3'),'variable','customVariable',_0x8cc5('0x4'),_0x8cc5('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8cc5('0x6')]},'key':{'type':Sequelize[_0x8cc5('0x6')]},'keyType':{'type':Sequelize[_0x8cc5('0x2')](_0x8cc5('0x3'),'variable',_0x8cc5('0x7'))},'keyContent':{'type':Sequelize[_0x8cc5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8cc5('0x6')]},'customField':{'type':Sequelize[_0x8cc5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8cc5('0x6')]}}; \ No newline at end of file +var _0x2c51=['string','variable','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x438415,_0x5ee367){var _0x5d254c=function(_0x29040c){while(--_0x29040c){_0x438415['push'](_0x438415['shift']());}};_0x5d254c(++_0x5ee367);}(_0x2c51,0x136));var _0x12c5=function(_0x2666b1,_0x375927){_0x2666b1=_0x2666b1-0x0;var _0x423d69=_0x2c51[_0x2666b1];return _0x423d69;};'use strict';var Sequelize=require('sequelize');module[_0x12c5('0x0')]={'type':{'type':Sequelize[_0x12c5('0x1')](_0x12c5('0x2'),_0x12c5('0x3'),'customVariable',_0x12c5('0x4'),'picklist'),'defaultValue':_0x12c5('0x2')},'content':{'type':Sequelize[_0x12c5('0x5')]},'key':{'type':Sequelize[_0x12c5('0x5')]},'keyType':{'type':Sequelize[_0x12c5('0x1')](_0x12c5('0x2'),_0x12c5('0x3'),_0x12c5('0x6'))},'keyContent':{'type':Sequelize[_0x12c5('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x12c5('0x5')]},'customField':{'type':Sequelize[_0x12c5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x12c5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fa77895..fb8dc9e 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 _0xad04=['eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','ZohoField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','body'];(function(_0x3f7716,_0x506fa5){var _0x5ea40f=function(_0x116ed6){while(--_0x116ed6){_0x3f7716['push'](_0x3f7716['shift']());}};_0x5ea40f(++_0x506fa5);}(_0xad04,0x96));var _0x4ad0=function(_0xd17fc2,_0xa9c5){_0xd17fc2=_0xd17fc2-0x0;var _0x4ddd6f=_0xad04[_0xd17fc2];return _0x4ddd6f;};'use strict';var emlformat=require(_0x4ad0('0x0'));var rimraf=require(_0x4ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ad0('0x2'));var Mustache=require(_0x4ad0('0x3'));var util=require(_0x4ad0('0x4'));var path=require('path');var sox=require(_0x4ad0('0x5'));var csv=require(_0x4ad0('0x6'));var ejs=require(_0x4ad0('0x7'));var fs=require('fs');var fs_extra=require(_0x4ad0('0x8'));var _=require(_0x4ad0('0x9'));var squel=require(_0x4ad0('0xa'));var crypto=require(_0x4ad0('0xb'));var jsforce=require(_0x4ad0('0xc'));var deskjs=require(_0x4ad0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ad0('0xe'));var Redis=require(_0x4ad0('0xf'));var authService=require(_0x4ad0('0x10'));var qs=require(_0x4ad0('0x11'));var as=require(_0x4ad0('0x12'));var hardwareService=require(_0x4ad0('0x13'));var logger=require(_0x4ad0('0x14'))(_0x4ad0('0x15'));var utils=require('../../config/utils');var config=require(_0x4ad0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ad0('0x17'))['db'];function respondWithStatusCode(_0x260652,_0x1449a8){_0x1449a8=_0x1449a8||0xcc;return function(_0x552e9f){if(_0x552e9f){return _0x260652[_0x4ad0('0x18')](_0x1449a8);}return _0x260652[_0x4ad0('0x19')](_0x1449a8)['end']();};}function respondWithResult(_0x12d818,_0x447d18){_0x447d18=_0x447d18||0xc8;return function(_0x1ee87f){if(_0x1ee87f){return _0x12d818[_0x4ad0('0x19')](_0x447d18)['json'](_0x1ee87f);}};}function respondWithFilteredResult(_0x130f6b,_0x10c4b4){return function(_0x28479c){if(_0x28479c){var _0x3b5001=typeof _0x10c4b4[_0x4ad0('0x1a')]===_0x4ad0('0x1b')&&typeof _0x10c4b4['limit']===_0x4ad0('0x1b');var _0x3a634c=_0x28479c['count'];var _0xcadde5=_0x3b5001?0x0:_0x10c4b4[_0x4ad0('0x1a')];var _0x3b45db=_0x3b5001?_0x28479c[_0x4ad0('0x1c')]:_0x10c4b4['offset']+_0x10c4b4[_0x4ad0('0x1d')];var _0x34317e;if(_0x3b45db>=_0x3a634c){_0x3b45db=_0x3a634c;_0x34317e=0xc8;}else{_0x34317e=0xce;}_0x130f6b['status'](_0x34317e);return _0x130f6b['set'](_0x4ad0('0x1e'),_0xcadde5+'-'+_0x3b45db+'/'+_0x3a634c)[_0x4ad0('0x1f')](_0x28479c);}return null;};}function patchUpdates(_0x16790d){return function(_0x28235a){try{jsonpatch[_0x4ad0('0x20')](_0x28235a,_0x16790d,!![]);}catch(_0x2a45f6){return BPromise[_0x4ad0('0x21')](_0x2a45f6);}return _0x28235a[_0x4ad0('0x22')]();};}function saveUpdates(_0x25e52c,_0x4a8b37){return function(_0x5af5cf){if(_0x5af5cf){return _0x5af5cf[_0x4ad0('0x23')](_0x25e52c)['then'](function(_0x1299ea){return _0x1299ea;});}return null;};}function removeEntity(_0x230e5b,_0x4151b7){return function(_0x1f2398){if(_0x1f2398){return _0x1f2398[_0x4ad0('0x24')]()[_0x4ad0('0x25')](function(){_0x230e5b[_0x4ad0('0x19')](0xcc)[_0x4ad0('0x26')]();});}};}function handleEntityNotFound(_0x3b880c,_0x56012d){return function(_0x305cbc){if(!_0x305cbc){_0x3b880c[_0x4ad0('0x18')](0x194);}return _0x305cbc;};}function handleError(_0x57c77f,_0x26ca18){_0x26ca18=_0x26ca18||0x1f4;return function(_0x550f35){logger[_0x4ad0('0x27')](_0x550f35[_0x4ad0('0x28')]);if(_0x550f35[_0x4ad0('0x29')]){delete _0x550f35[_0x4ad0('0x29')];}_0x57c77f[_0x4ad0('0x19')](_0x26ca18)[_0x4ad0('0x2a')](_0x550f35);};}exports[_0x4ad0('0x2b')]=function(_0xec40c,_0x3bada2){var _0x692799={},_0x4ec496={},_0x5df6c6={'count':0x0,'rows':[]};var _0x37b2d6=_['map'](db[_0x4ad0('0x2c')]['rawAttributes'],function(_0x13f6b3){return{'name':_0x13f6b3[_0x4ad0('0x2d')],'type':_0x13f6b3[_0x4ad0('0x2e')][_0x4ad0('0x2f')]};});_0x4ec496[_0x4ad0('0x30')]=_[_0x4ad0('0x31')](_0x37b2d6,_0x4ad0('0x29'));_0x4ec496[_0x4ad0('0x32')]=_[_0x4ad0('0x33')](_0xec40c[_0x4ad0('0x32')]);_0x4ec496[_0x4ad0('0x34')]=_[_0x4ad0('0x35')](_0x4ec496['model'],_0x4ec496[_0x4ad0('0x32')]);_0x692799[_0x4ad0('0x36')]=_[_0x4ad0('0x35')](_0x4ec496['model'],qs['fields'](_0xec40c[_0x4ad0('0x32')][_0x4ad0('0x37')]));_0x692799['attributes']=_0x692799[_0x4ad0('0x36')][_0x4ad0('0x38')]?_0x692799[_0x4ad0('0x36')]:_0x4ec496['model'];if(!_0xec40c[_0x4ad0('0x32')][_0x4ad0('0x39')]('nolimit')){_0x692799[_0x4ad0('0x1d')]=qs['limit'](_0xec40c['query'][_0x4ad0('0x1d')]);_0x692799[_0x4ad0('0x1a')]=qs[_0x4ad0('0x1a')](_0xec40c[_0x4ad0('0x32')][_0x4ad0('0x1a')]);}_0x692799[_0x4ad0('0x3a')]=qs[_0x4ad0('0x3b')](_0xec40c[_0x4ad0('0x32')][_0x4ad0('0x3b')]);_0x692799['where']=qs[_0x4ad0('0x34')](_[_0x4ad0('0x3c')](_0xec40c[_0x4ad0('0x32')],_0x4ec496['filters']),_0x37b2d6);if(_0xec40c[_0x4ad0('0x32')]['filter']){_0x692799[_0x4ad0('0x3d')]=_[_0x4ad0('0x3e')](_0x692799[_0x4ad0('0x3d')],{'$or':_[_0x4ad0('0x31')](_0x37b2d6,function(_0x1f09d4){if(_0x1f09d4['type']!==_0x4ad0('0x3f')){var _0x1dd546={};_0x1dd546[_0x1f09d4[_0x4ad0('0x29')]]={'$like':'%'+_0xec40c[_0x4ad0('0x32')][_0x4ad0('0x40')]+'%'};return _0x1dd546;}})});}_0x692799=_[_0x4ad0('0x3e')]({},_0x692799,_0xec40c[_0x4ad0('0x41')]);var _0x5462f4={'where':_0x692799[_0x4ad0('0x3d')]};return db[_0x4ad0('0x2c')][_0x4ad0('0x1c')](_0x5462f4)[_0x4ad0('0x25')](function(_0x2731a5){_0x5df6c6['count']=_0x2731a5;if(_0xec40c[_0x4ad0('0x32')][_0x4ad0('0x42')]){_0x692799['include']=[{'all':!![]}];}return db[_0x4ad0('0x2c')][_0x4ad0('0x43')](_0x692799);})['then'](function(_0x28b059){_0x5df6c6['rows']=_0x28b059;return _0x5df6c6;})[_0x4ad0('0x25')](respondWithFilteredResult(_0x3bada2,_0x692799))[_0x4ad0('0x44')](handleError(_0x3bada2,null));};exports[_0x4ad0('0x45')]=function(_0x413c42,_0x119405){var _0x40bb79={'raw':!![],'where':{'id':_0x413c42[_0x4ad0('0x46')]['id']}},_0x417ef8={};_0x417ef8[_0x4ad0('0x30')]=_[_0x4ad0('0x33')](db['ZohoField'][_0x4ad0('0x47')]);_0x417ef8[_0x4ad0('0x32')]=_['keys'](_0x413c42['query']);_0x417ef8[_0x4ad0('0x34')]=_[_0x4ad0('0x35')](_0x417ef8[_0x4ad0('0x30')],_0x417ef8[_0x4ad0('0x32')]);_0x40bb79['attributes']=_[_0x4ad0('0x35')](_0x417ef8[_0x4ad0('0x30')],qs[_0x4ad0('0x37')](_0x413c42['query'][_0x4ad0('0x37')]));_0x40bb79[_0x4ad0('0x36')]=_0x40bb79[_0x4ad0('0x36')]['length']?_0x40bb79[_0x4ad0('0x36')]:_0x417ef8['model'];if(_0x413c42[_0x4ad0('0x32')]['includeAll']){_0x40bb79[_0x4ad0('0x48')]=[{'all':!![]}];}_0x40bb79=_[_0x4ad0('0x3e')]({},_0x40bb79,_0x413c42[_0x4ad0('0x41')]);return db[_0x4ad0('0x2c')][_0x4ad0('0x49')](_0x40bb79)['then'](handleEntityNotFound(_0x119405,null))['then'](respondWithResult(_0x119405,null))[_0x4ad0('0x44')](handleError(_0x119405,null));};exports['create']=function(_0x225d09,_0xdf0a29){return db[_0x4ad0('0x2c')]['create'](_0x225d09[_0x4ad0('0x4a')],{})[_0x4ad0('0x25')](respondWithResult(_0xdf0a29,0xc9))['catch'](handleError(_0xdf0a29,null));};exports[_0x4ad0('0x23')]=function(_0x5249f1,_0x106c0d){if(_0x5249f1[_0x4ad0('0x4a')]['id']){delete _0x5249f1['body']['id'];}return db[_0x4ad0('0x2c')][_0x4ad0('0x49')]({'where':{'id':_0x5249f1[_0x4ad0('0x46')]['id']}})[_0x4ad0('0x25')](handleEntityNotFound(_0x106c0d,null))[_0x4ad0('0x25')](saveUpdates(_0x5249f1[_0x4ad0('0x4a')],null))[_0x4ad0('0x25')](respondWithResult(_0x106c0d,null))[_0x4ad0('0x44')](handleError(_0x106c0d,null));};exports[_0x4ad0('0x24')]=function(_0x47d3d8,_0x37d816){return db['ZohoField'][_0x4ad0('0x49')]({'where':{'id':_0x47d3d8['params']['id']}})[_0x4ad0('0x25')](handleEntityNotFound(_0x37d816,null))[_0x4ad0('0x25')](removeEntity(_0x37d816,null))[_0x4ad0('0x44')](handleError(_0x37d816,null));}; \ No newline at end of file +var _0xe11d=['end','limit','undefined','count','offset','Content-Range','apply','reject','update','then','error','name','send','index','ZohoField','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','include','options','create','body','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2bf636,_0x14ceb6){var _0x19c119=function(_0x59eea7){while(--_0x59eea7){_0x2bf636['push'](_0x2bf636['shift']());}};_0x19c119(++_0x14ceb6);}(_0xe11d,0x1eb));var _0xde11=function(_0x3a4441,_0x1c82ca){_0x3a4441=_0x3a4441-0x0;var _0x489188=_0xe11d[_0x3a4441];return _0x489188;};'use strict';var emlformat=require(_0xde11('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde11('0x1'));var jsonpatch=require(_0xde11('0x2'));var rp=require(_0xde11('0x3'));var moment=require('moment');var BPromise=require(_0xde11('0x4'));var Mustache=require(_0xde11('0x5'));var util=require(_0xde11('0x6'));var path=require(_0xde11('0x7'));var sox=require(_0xde11('0x8'));var csv=require(_0xde11('0x9'));var ejs=require(_0xde11('0xa'));var fs=require('fs');var fs_extra=require(_0xde11('0xb'));var _=require('lodash');var squel=require(_0xde11('0xc'));var crypto=require(_0xde11('0xd'));var jsforce=require(_0xde11('0xe'));var deskjs=require(_0xde11('0xf'));var toCsv=require(_0xde11('0x9'));var querystring=require('querystring');var Papa=require(_0xde11('0x10'));var Redis=require(_0xde11('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde11('0x12'));var hardwareService=require(_0xde11('0x13'));var logger=require(_0xde11('0x14'))(_0xde11('0x15'));var utils=require(_0xde11('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xde11('0x17'));var db=require(_0xde11('0x18'))['db'];function respondWithStatusCode(_0x27bdb2,_0x4c892a){_0x4c892a=_0x4c892a||0xcc;return function(_0x4971e7){if(_0x4971e7){return _0x27bdb2[_0xde11('0x19')](_0x4c892a);}return _0x27bdb2[_0xde11('0x1a')](_0x4c892a)[_0xde11('0x1b')]();};}function respondWithResult(_0x10f8c2,_0x7008ec){_0x7008ec=_0x7008ec||0xc8;return function(_0x49b68e){if(_0x49b68e){return _0x10f8c2[_0xde11('0x1a')](_0x7008ec)['json'](_0x49b68e);}};}function respondWithFilteredResult(_0x39c5f3,_0x4d5439){return function(_0x57dd88){if(_0x57dd88){var _0x17c1ea=typeof _0x4d5439['offset']==='undefined'&&typeof _0x4d5439[_0xde11('0x1c')]===_0xde11('0x1d');var _0x4fb962=_0x57dd88['count'];var _0x5717cd=_0x17c1ea?0x0:_0x4d5439['offset'];var _0x416c5e=_0x17c1ea?_0x57dd88[_0xde11('0x1e')]:_0x4d5439[_0xde11('0x1f')]+_0x4d5439[_0xde11('0x1c')];var _0x2763fb;if(_0x416c5e>=_0x4fb962){_0x416c5e=_0x4fb962;_0x2763fb=0xc8;}else{_0x2763fb=0xce;}_0x39c5f3['status'](_0x2763fb);return _0x39c5f3['set'](_0xde11('0x20'),_0x5717cd+'-'+_0x416c5e+'/'+_0x4fb962)['json'](_0x57dd88);}return null;};}function patchUpdates(_0x1f2656){return function(_0x2029c1){try{jsonpatch[_0xde11('0x21')](_0x2029c1,_0x1f2656,!![]);}catch(_0x36c7d5){return BPromise[_0xde11('0x22')](_0x36c7d5);}return _0x2029c1['save']();};}function saveUpdates(_0x2ba473,_0x289e2e){return function(_0x1fb8c7){if(_0x1fb8c7){return _0x1fb8c7[_0xde11('0x23')](_0x2ba473)[_0xde11('0x24')](function(_0x285187){return _0x285187;});}return null;};}function removeEntity(_0x425f2f,_0xd1b362){return function(_0x54e20e){if(_0x54e20e){return _0x54e20e['destroy']()[_0xde11('0x24')](function(){_0x425f2f[_0xde11('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3600,_0x1930f3){return function(_0x277c9a){if(!_0x277c9a){_0x1a3600[_0xde11('0x19')](0x194);}return _0x277c9a;};}function handleError(_0x502e48,_0x24da1c){_0x24da1c=_0x24da1c||0x1f4;return function(_0x30ccc4){logger[_0xde11('0x25')](_0x30ccc4['stack']);if(_0x30ccc4[_0xde11('0x26')]){delete _0x30ccc4[_0xde11('0x26')];}_0x502e48['status'](_0x24da1c)[_0xde11('0x27')](_0x30ccc4);};}exports[_0xde11('0x28')]=function(_0x1976a3,_0x213b9d){var _0x283ede={},_0x2dabd4={},_0x1e6ae1={'count':0x0,'rows':[]};var _0x409af5=_['map'](db[_0xde11('0x29')]['rawAttributes'],function(_0x3700cb){return{'name':_0x3700cb[_0xde11('0x2a')],'type':_0x3700cb[_0xde11('0x2b')][_0xde11('0x2c')]};});_0x2dabd4['model']=_[_0xde11('0x2d')](_0x409af5,_0xde11('0x26'));_0x2dabd4[_0xde11('0x2e')]=_[_0xde11('0x2f')](_0x1976a3[_0xde11('0x2e')]);_0x2dabd4[_0xde11('0x30')]=_[_0xde11('0x31')](_0x2dabd4[_0xde11('0x32')],_0x2dabd4['query']);_0x283ede[_0xde11('0x33')]=_[_0xde11('0x31')](_0x2dabd4[_0xde11('0x32')],qs['fields'](_0x1976a3[_0xde11('0x2e')][_0xde11('0x34')]));_0x283ede['attributes']=_0x283ede['attributes'][_0xde11('0x35')]?_0x283ede['attributes']:_0x2dabd4[_0xde11('0x32')];if(!_0x1976a3[_0xde11('0x2e')]['hasOwnProperty'](_0xde11('0x36'))){_0x283ede['limit']=qs['limit'](_0x1976a3[_0xde11('0x2e')]['limit']);_0x283ede[_0xde11('0x1f')]=qs['offset'](_0x1976a3['query'][_0xde11('0x1f')]);}_0x283ede[_0xde11('0x37')]=qs[_0xde11('0x38')](_0x1976a3[_0xde11('0x2e')][_0xde11('0x38')]);_0x283ede['where']=qs[_0xde11('0x30')](_['pick'](_0x1976a3[_0xde11('0x2e')],_0x2dabd4[_0xde11('0x30')]),_0x409af5);if(_0x1976a3[_0xde11('0x2e')][_0xde11('0x39')]){_0x283ede[_0xde11('0x3a')]=_[_0xde11('0x3b')](_0x283ede[_0xde11('0x3a')],{'$or':_['map'](_0x409af5,function(_0x22dd9b){if(_0x22dd9b['type']!==_0xde11('0x3c')){var _0x267202={};_0x267202[_0x22dd9b[_0xde11('0x26')]]={'$like':'%'+_0x1976a3[_0xde11('0x2e')][_0xde11('0x39')]+'%'};return _0x267202;}})});}_0x283ede=_['merge']({},_0x283ede,_0x1976a3['options']);var _0x56c4c7={'where':_0x283ede[_0xde11('0x3a')]};return db[_0xde11('0x29')][_0xde11('0x1e')](_0x56c4c7)[_0xde11('0x24')](function(_0x3b98e3){_0x1e6ae1[_0xde11('0x1e')]=_0x3b98e3;if(_0x1976a3[_0xde11('0x2e')][_0xde11('0x3d')]){_0x283ede['include']=[{'all':!![]}];}return db[_0xde11('0x29')][_0xde11('0x3e')](_0x283ede);})[_0xde11('0x24')](function(_0x1df1e1){_0x1e6ae1[_0xde11('0x3f')]=_0x1df1e1;return _0x1e6ae1;})['then'](respondWithFilteredResult(_0x213b9d,_0x283ede))[_0xde11('0x40')](handleError(_0x213b9d,null));};exports[_0xde11('0x41')]=function(_0x26673b,_0x448ab2){var _0x18c156={'raw':!![],'where':{'id':_0x26673b['params']['id']}},_0x1360df={};_0x1360df[_0xde11('0x32')]=_[_0xde11('0x2f')](db['ZohoField'][_0xde11('0x42')]);_0x1360df[_0xde11('0x2e')]=_[_0xde11('0x2f')](_0x26673b[_0xde11('0x2e')]);_0x1360df['filters']=_[_0xde11('0x31')](_0x1360df['model'],_0x1360df[_0xde11('0x2e')]);_0x18c156[_0xde11('0x33')]=_['intersection'](_0x1360df['model'],qs[_0xde11('0x34')](_0x26673b[_0xde11('0x2e')]['fields']));_0x18c156[_0xde11('0x33')]=_0x18c156[_0xde11('0x33')][_0xde11('0x35')]?_0x18c156['attributes']:_0x1360df[_0xde11('0x32')];if(_0x26673b[_0xde11('0x2e')][_0xde11('0x3d')]){_0x18c156[_0xde11('0x43')]=[{'all':!![]}];}_0x18c156=_[_0xde11('0x3b')]({},_0x18c156,_0x26673b[_0xde11('0x44')]);return db[_0xde11('0x29')]['find'](_0x18c156)[_0xde11('0x24')](handleEntityNotFound(_0x448ab2,null))['then'](respondWithResult(_0x448ab2,null))[_0xde11('0x40')](handleError(_0x448ab2,null));};exports['create']=function(_0x51b40a,_0x26c4ea){return db[_0xde11('0x29')][_0xde11('0x45')](_0x51b40a[_0xde11('0x46')],{})[_0xde11('0x24')](respondWithResult(_0x26c4ea,0xc9))[_0xde11('0x40')](handleError(_0x26c4ea,null));};exports[_0xde11('0x23')]=function(_0x570f25,_0x42f4f6){if(_0x570f25[_0xde11('0x46')]['id']){delete _0x570f25[_0xde11('0x46')]['id'];}return db[_0xde11('0x29')][_0xde11('0x47')]({'where':{'id':_0x570f25[_0xde11('0x48')]['id']}})['then'](handleEntityNotFound(_0x42f4f6,null))[_0xde11('0x24')](saveUpdates(_0x570f25[_0xde11('0x46')],null))[_0xde11('0x24')](respondWithResult(_0x42f4f6,null))[_0xde11('0x40')](handleError(_0x42f4f6,null));};exports[_0xde11('0x49')]=function(_0x41b134,_0xfb78b0){return db[_0xde11('0x29')]['find']({'where':{'id':_0x41b134[_0xde11('0x48')]['id']}})[_0xde11('0x24')](handleEntityNotFound(_0xfb78b0,null))[_0xde11('0x24')](removeEntity(_0xfb78b0,null))[_0xde11('0x40')](handleError(_0xfb78b0,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 6cbe193..cdd4082 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 _0x47c5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intZohoField.attributes','exports','define'];(function(_0x572743,_0x2cc13c){var _0x3abb61=function(_0x47d6fb){while(--_0x47d6fb){_0x572743['push'](_0x572743['shift']());}};_0x3abb61(++_0x2cc13c);}(_0x47c5,0x165));var _0x547c=function(_0x31ce33,_0x1a7f94){_0x31ce33=_0x31ce33-0x0;var _0x32d860=_0x47c5[_0x31ce33];return _0x32d860;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));module[_0x547c('0x9')]=function(_0x51ab7f,_0x2e5b57){return _0x51ab7f[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[{'name':_0x547c('0xd'),'fields':[_0x547c('0xe'),_0x547c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId'];(function(_0x11e006,_0x187aa4){var _0x3d52aa=function(_0x25de3e){while(--_0x25de3e){_0x11e006['push'](_0x11e006['shift']());}};_0x3d52aa(++_0x187aa4);}(_0x5fab,0x177));var _0xb5fa=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x5fab[_0x1ac77b];return _0x161584;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['idField',_0xb5fa('0xe')],'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 0782562..789c5ab 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 _0x644f=['stringify','error','code','message','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c2601,_0x34b84a){var _0x236d89=function(_0x5b837e){while(--_0x5b837e){_0x3c2601['push'](_0x3c2601['shift']());}};_0x236d89(++_0x34b84a);}(_0x644f,0x125));var _0xf644=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x644f[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xf644('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf644('0x1'));var db=require(_0xf644('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf644('0x3'))(_0xf644('0x4'));var config=require(_0xf644('0x5'));var jayson=require(_0xf644('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38247b,_0x49a8db,_0x3248fc){return new BPromise(function(_0x1f9ced,_0x3e94a6){return client[_0xf644('0x7')](_0x38247b,_0x3248fc)[_0xf644('0x8')](function(_0x4997c6){logger[_0xf644('0x9')](_0xf644('0xa'),_0x49a8db,_0xf644('0xb'));logger[_0xf644('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x49a8db,_0xf644('0xb'),JSON[_0xf644('0xd')](_0x4997c6));if(_0x4997c6[_0xf644('0xe')]){if(_0x4997c6[_0xf644('0xe')][_0xf644('0xf')]===0x1f4){logger[_0xf644('0xe')](_0xf644('0xa'),_0x49a8db,_0x4997c6[_0xf644('0xe')][_0xf644('0x10')]);return _0x3e94a6(_0x4997c6[_0xf644('0xe')][_0xf644('0x10')]);}logger[_0xf644('0xe')](_0xf644('0xa'),_0x49a8db,_0x4997c6[_0xf644('0xe')][_0xf644('0x10')]);return _0x1f9ced(_0x4997c6[_0xf644('0xe')][_0xf644('0x10')]);}else{logger[_0xf644('0x9')](_0xf644('0xa'),_0x49a8db,'request\x20sent');_0x1f9ced(_0x4997c6['result'][_0xf644('0x10')]);}})['catch'](function(_0x365249){logger[_0xf644('0xe')](_0xf644('0xa'),_0x49a8db,_0x365249);_0x3e94a6(_0x365249);});});} \ No newline at end of file +var _0x5d6b=['http','request','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d6b,0x1d9));var _0xb5d6=function(_0x34ab65,_0x356d84){_0x34ab65=_0x34ab65-0x0;var _0x31532c=_0x5d6b[_0x34ab65];return _0x31532c;};'use strict';var _=require('lodash');var util=require(_0xb5d6('0x0'));var moment=require(_0xb5d6('0x1'));var BPromise=require(_0xb5d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5d6('0x3'));var db=require(_0xb5d6('0x4'))['db'];var utils=require(_0xb5d6('0x5'));var logger=require(_0xb5d6('0x6'))(_0xb5d6('0x7'));var config=require(_0xb5d6('0x8'));var jayson=require(_0xb5d6('0x9'));var client=jayson['client'][_0xb5d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55847d,_0x58014d,_0x45db58){return new BPromise(function(_0x57a017,_0x3cc338){return client[_0xb5d6('0xb')](_0x55847d,_0x45db58)['then'](function(_0x9c98c2){logger['info'](_0xb5d6('0xc'),_0x58014d,_0xb5d6('0xd'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x58014d,'request\x20sent',JSON[_0xb5d6('0xe')](_0x9c98c2));if(_0x9c98c2[_0xb5d6('0xf')]){if(_0x9c98c2['error'][_0xb5d6('0x10')]===0x1f4){logger[_0xb5d6('0xf')](_0xb5d6('0xc'),_0x58014d,_0x9c98c2[_0xb5d6('0xf')]['message']);return _0x3cc338(_0x9c98c2[_0xb5d6('0xf')][_0xb5d6('0x11')]);}logger[_0xb5d6('0xf')]('ZohoField,\x20%s,\x20%s',_0x58014d,_0x9c98c2[_0xb5d6('0xf')]['message']);return _0x57a017(_0x9c98c2[_0xb5d6('0xf')][_0xb5d6('0x11')]);}else{logger[_0xb5d6('0x12')](_0xb5d6('0xc'),_0x58014d,'request\x20sent');_0x57a017(_0x9c98c2[_0xb5d6('0x13')][_0xb5d6('0x11')]);}})[_0xb5d6('0x14')](function(_0x4c8716){logger[_0xb5d6('0xf')]('ZohoField,\x20%s,\x20%s',_0x58014d,_0x4c8716);_0x3cc338(_0x4c8716);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5d1e6cb..1bb5d3a 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x23d288,_0x524d6d){var _0x3a67d4=function(_0x2702c0){while(--_0x2702c0){_0x23d288['push'](_0x23d288['shift']());}};_0x3a67d4(++_0x524d6d);}(_0xedd9,0xfc));var _0x9edd=function(_0x2399bc,_0x475e0d){_0x2399bc=_0x2399bc-0x0;var _0x3f230a=_0xedd9[_0x2399bc];return _0x3f230a;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c5948ba..c2cfdc0 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 _0x1535=['app.js','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1535,0x9d));var _0x5153=function(_0x514bb2,_0xc9f588){_0x514bb2=_0x514bb2-0x0;var _0x4e4679=_0x1535[_0x514bb2];return _0x4e4679;};'use strict';var Sequelize=require(_0x5153('0x0'));module[_0x5153('0x1')]={'name':{'type':Sequelize[_0x5153('0x2')],'allowNull':![],'unique':_0x5153('0x3')},'version':{'type':Sequelize[_0x5153('0x2')],'allowNull':![],'unique':_0x5153('0x3')},'main':{'type':Sequelize[_0x5153('0x2')],'defaultValue':_0x5153('0x4')},'filename':{'type':Sequelize[_0x5153('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5153('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x5153('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x5153('0x2')]},'logo':{'type':Sequelize[_0x5153('0x2')]},'state':{'type':Sequelize[_0x5153('0x2')],'unique':_0x5153('0x6')},'description':{'type':Sequelize[_0x5153('0x2')]},'title':{'type':Sequelize[_0x5153('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x5153('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe9e8=['unique_name_and_version','BOOLEAN','sequelize','exports','STRING'];(function(_0x43511e,_0x49c0fe){var _0x1e2803=function(_0x381ff9){while(--_0x381ff9){_0x43511e['push'](_0x43511e['shift']());}};_0x1e2803(++_0x49c0fe);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x221193,_0x3ab80b){_0x221193=_0x221193-0x0;var _0x43ace1=_0xe9e8[_0x221193];return _0x43ace1;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')],'allowNull':![],'unique':_0x8e9e('0x3')},'version':{'type':Sequelize[_0x8e9e('0x2')],'allowNull':![],'unique':_0x8e9e('0x3')},'main':{'type':Sequelize[_0x8e9e('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x8e9e('0x2')]},'path':{'type':Sequelize[_0x8e9e('0x2')]},'type':{'type':Sequelize[_0x8e9e('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8e9e('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x8e9e('0x2')]},'logo':{'type':Sequelize[_0x8e9e('0x2')]},'state':{'type':Sequelize[_0x8e9e('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x8e9e('0x2')]},'title':{'type':Sequelize[_0x8e9e('0x2')]},'remoteUri':{'type':Sequelize[_0x8e9e('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5f33ad2..e09c1f7 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 _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x1261,0x144));var _0x1126=function(_0xff6ae1,_0x5c13e2){_0xff6ae1=_0xff6ae1-0x0;var _0x389fa2=_0x1261[_0xff6ae1];return _0x389fa2;};'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);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file +var _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x9582,0x95));var _0x2958=function(_0xcc247a,_0x1aaf2a){_0xcc247a=_0xcc247a-0x0;var _0x2c4b83=_0x9582[_0xcc247a];return _0x2c4b83;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7a1e2ca..737d0bc 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 _0x0271=['bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','moment'];(function(_0x376724,_0x11ee70){var _0x223818=function(_0x17d905){while(--_0x17d905){_0x376724['push'](_0x376724['shift']());}};_0x223818(++_0x11ee70);}(_0x0271,0x1f4));var _0x1027=function(_0x38d334,_0x24be8b){_0x38d334=_0x38d334-0x0;var _0x296015=_0x0271[_0x38d334];return _0x296015;};'use strict';var _=require(_0x1027('0x0'));var util=require(_0x1027('0x1'));var logger=require(_0x1027('0x2'))('api');var moment=require(_0x1027('0x3'));var BPromise=require(_0x1027('0x4'));var rp=require(_0x1027('0x5'));var fs=require('fs');var path=require(_0x1027('0x6'));var rimraf=require('rimraf');var config=require(_0x1027('0x7'));var attributes=require(_0x1027('0x8'));module[_0x1027('0x9')]=function(_0x46d089,_0x1f4357){return _0x46d089['define'](_0x1027('0xa'),attributes,{'tableName':_0x1027('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd8c=['integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration'];(function(_0x2ee7dd,_0x6c9cfb){var _0xdd624a=function(_0x105803){while(--_0x105803){_0x2ee7dd['push'](_0x2ee7dd['shift']());}};_0xdd624a(++_0x6c9cfb);}(_0xdd8c,0x146));var _0xcdd8=function(_0x53d455,_0xd0d9ba){_0x53d455=_0x53d455-0x0;var _0x5f051d=_0xdd8c[_0x53d455];return _0x5f051d;};'use strict';var _=require(_0xcdd8('0x0'));var util=require(_0xcdd8('0x1'));var logger=require(_0xcdd8('0x2'))('api');var moment=require(_0xcdd8('0x3'));var BPromise=require(_0xcdd8('0x4'));var rp=require(_0xcdd8('0x5'));var fs=require('fs');var path=require(_0xcdd8('0x6'));var rimraf=require(_0xcdd8('0x7'));var config=require(_0xcdd8('0x8'));var attributes=require(_0xcdd8('0x9'));module['exports']=function(_0x4c631c,_0x4239aa){return _0x4c631c[_0xcdd8('0xa')](_0xcdd8('0xb'),attributes,{'tableName':_0xcdd8('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 7e66ab9..680b993 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1cc7fa,_0x59d298){var _0x7da606=function(_0x1da5d1){while(--_0x1da5d1){_0x1cc7fa['push'](_0x1cc7fa['shift']());}};_0x7da606(++_0x59d298);}(_0xdb28,0x106));var _0x8db2=function(_0x5e8e72,_0x41e45c){_0x5e8e72=_0x5e8e72-0x0;var _0x13799a=_0xdb28[_0x5e8e72];return _0x13799a;};'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')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _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(_0x4df354,_0x3d7d4b){var _0x1a7620=function(_0x12f4b5){while(--_0x12f4b5){_0x4df354['push'](_0x4df354['shift']());}};_0x1a7620(++_0x3d7d4b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index eb3bd62..2615e78 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 _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x17e735,_0x328f40){var _0x1824d6=function(_0x4460fe){while(--_0x4460fe){_0x17e735['push'](_0x17e735['shift']());}};_0x1824d6(++_0x328f40);}(_0x66fa,0x117));var _0xa66f=function(_0x357159,_0x5e3be9){_0x357159=_0x357159-0x0;var _0x35e3f6=_0x66fa[_0x357159];return _0x35e3f6;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file +var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x331aa7,_0x9127c){var _0x36c249=function(_0xb9d288){while(--_0xb9d288){_0x331aa7['push'](_0x331aa7['shift']());}};_0x36c249(++_0x9127c);}(_0x7880,0x1f4));var _0x0788=function(_0x502036,_0x502686){_0x502036=_0x502036-0x0;var _0x485247=_0x7880[_0x502036];return _0x485247;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 20360e6..5f7c403 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 _0xaf4e=['BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x22cc4e,_0xba93df){var _0x58269a=function(_0x8f95ad){while(--_0x8f95ad){_0x22cc4e['push'](_0x22cc4e['shift']());}};_0x58269a(++_0xba93df);}(_0xaf4e,0x74));var _0xeaf4=function(_0x119060,_0x148c65){_0x119060=_0x119060-0x0;var _0x3be718=_0xaf4e[_0x119060];return _0x3be718;};'use strict';var Sequelize=require(_0xeaf4('0x0'));module[_0xeaf4('0x1')]={'integration':{'type':Sequelize[_0xeaf4('0x2')]},'eventChannel':{'type':Sequelize[_0xeaf4('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xeaf4('0x2')]},'integrationId':{'type':Sequelize[_0xeaf4('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xeaf4('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xeaf4('0x2')]},'queue':{'type':Sequelize[_0xeaf4('0x2')]},'interface':{'type':Sequelize[_0xeaf4('0x2')]},'membername':{'type':Sequelize[_0xeaf4('0x2')]},'agentcalledAt':{'type':Sequelize[_0xeaf4('0x4')]},'agentconnectAt':{'type':Sequelize[_0xeaf4('0x4')]},'holdtime':{'type':Sequelize[_0xeaf4('0x3')]},'agentcomplete':{'type':Sequelize[_0xeaf4('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xeaf4('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeaf4('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xeaf4('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xeaf4('0x4')]},'agentdump':{'type':Sequelize[_0xeaf4('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xeaf4('0x4')]},'lastevent':{'type':Sequelize[_0xeaf4('0x2')]},'channel':{'type':Sequelize[_0xeaf4('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xeaf4('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeaf4('0x2')]},'connectedlinename':{'type':Sequelize[_0xeaf4('0x2')]},'language':{'type':Sequelize[_0xeaf4('0x2')]},'accountcode':{'type':Sequelize[_0xeaf4('0x2')]},'context':{'type':Sequelize[_0xeaf4('0x2')]},'exten':{'type':Sequelize[_0xeaf4('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xeaf4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xeaf4('0x2')]},'destcalleridnum':{'type':Sequelize[_0xeaf4('0x2')]},'destcalleridname':{'type':Sequelize[_0xeaf4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeaf4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeaf4('0x2')]},'destlanguage':{'type':Sequelize[_0xeaf4('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xeaf4('0x2')]},'destexten':{'type':Sequelize[_0xeaf4('0x2')]},'destpriority':{'type':Sequelize[_0xeaf4('0x2')]},'destuniqueid':{'type':Sequelize[_0xeaf4('0x2')]},'messageId':{'type':Sequelize[_0xeaf4('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xeaf4('0x2')]},'from':{'type':Sequelize[_0xeaf4('0x2')]},'to':{'type':Sequelize[_0xeaf4('0x2')]},'cc':{'type':Sequelize[_0xeaf4('0x2')]},'attachment':{'type':Sequelize[_0xeaf4('0x6')]},'html':{'type':Sequelize[_0xeaf4('0x6')]},'text':{'type':Sequelize[_0xeaf4('0x6')]},'status':{'type':Sequelize[_0xeaf4('0x7')](_0xeaf4('0x8'),_0xeaf4('0x9'),'RECEIVED',_0xeaf4('0xa'))},'url':{'type':Sequelize[_0xeaf4('0x2')]},'app':{'type':Sequelize[_0xeaf4('0x2')]},'appdata':{'type':Sequelize[_0xeaf4('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf702=['FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf702,0x1a5));var _0x2f70=function(_0x49a837,_0xbc87df){_0x49a837=_0x49a837-0x0;var _0x1596f0=_0xf702[_0x49a837];return _0x1596f0;};'use strict';var Sequelize=require('sequelize');module[_0x2f70('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2f70('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x2f70('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2f70('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2f70('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2f70('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2f70('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2f70('0x3')]},'holdtime':{'type':Sequelize[_0x2f70('0x2')]},'agentcomplete':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2f70('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2f70('0x2')]},'reason':{'type':Sequelize[_0x2f70('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x2f70('0x3')]},'agentdump':{'type':Sequelize[_0x2f70('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2f70('0x3')]},'lastevent':{'type':Sequelize[_0x2f70('0x1')]},'channel':{'type':Sequelize[_0x2f70('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x2f70('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2f70('0x1')]},'language':{'type':Sequelize[_0x2f70('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2f70('0x1')]},'exten':{'type':Sequelize[_0x2f70('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x2f70('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x2f70('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2f70('0x1')]},'destcalleridname':{'type':Sequelize[_0x2f70('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2f70('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2f70('0x1')]},'destaccountcode':{'type':Sequelize[_0x2f70('0x1')]},'destcontext':{'type':Sequelize[_0x2f70('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2f70('0x1')]},'destuniqueid':{'type':Sequelize[_0x2f70('0x1')]},'messageId':{'type':Sequelize[_0x2f70('0x1')]},'inReplyTo':{'type':Sequelize[_0x2f70('0x1')]},'subject':{'type':Sequelize[_0x2f70('0x1')]},'from':{'type':Sequelize[_0x2f70('0x1')]},'to':{'type':Sequelize[_0x2f70('0x1')]},'cc':{'type':Sequelize[_0x2f70('0x1')]},'attachment':{'type':Sequelize[_0x2f70('0x5')]},'html':{'type':Sequelize[_0x2f70('0x5')]},'text':{'type':Sequelize[_0x2f70('0x5')]},'status':{'type':Sequelize[_0x2f70('0x6')]('SENT',_0x2f70('0x7'),_0x2f70('0x8'),_0x2f70('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x2f70('0x1')]},'appdata':{'type':Sequelize[_0x2f70('0x1')]},'projectId':{'type':Sequelize[_0x2f70('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4a2cd08..74da075 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 _0x4198=['index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','merge','find','create','body','update','describe','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','then','destroy','error','name','send'];(function(_0x409a4e,_0x144bee){var _0x2e9d12=function(_0x5c1486){while(--_0x5c1486){_0x409a4e['push'](_0x409a4e['shift']());}};_0x2e9d12(++_0x144bee);}(_0x4198,0x10a));var _0x8419=function(_0x2ec992,_0x2ebbac){_0x2ec992=_0x2ec992-0x0;var _0x385b8c=_0x4198[_0x2ec992];return _0x385b8c;};'use strict';var emlformat=require(_0x8419('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8419('0x1'));var rp=require('request-promise');var moment=require(_0x8419('0x2'));var BPromise=require(_0x8419('0x3'));var Mustache=require(_0x8419('0x4'));var util=require('util');var path=require(_0x8419('0x5'));var sox=require(_0x8419('0x6'));var csv=require(_0x8419('0x7'));var ejs=require(_0x8419('0x8'));var fs=require('fs');var fs_extra=require(_0x8419('0x9'));var _=require(_0x8419('0xa'));var squel=require(_0x8419('0xb'));var crypto=require(_0x8419('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8419('0xd'));var toCsv=require(_0x8419('0x7'));var querystring=require(_0x8419('0xe'));var Papa=require(_0x8419('0xf'));var Redis=require('ioredis');var authService=require(_0x8419('0x10'));var qs=require(_0x8419('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8419('0x12'));var logger=require(_0x8419('0x13'))(_0x8419('0x14'));var utils=require(_0x8419('0x15'));var config=require(_0x8419('0x16'));var licenseUtil=require(_0x8419('0x17'));var db=require(_0x8419('0x18'))['db'];function respondWithStatusCode(_0x144e23,_0x3cb763){_0x3cb763=_0x3cb763||0xcc;return function(_0x55c690){if(_0x55c690){return _0x144e23[_0x8419('0x19')](_0x3cb763);}return _0x144e23['status'](_0x3cb763)[_0x8419('0x1a')]();};}function respondWithResult(_0x1ae301,_0x27974b){_0x27974b=_0x27974b||0xc8;return function(_0x3cd9d9){if(_0x3cd9d9){return _0x1ae301['status'](_0x27974b)[_0x8419('0x1b')](_0x3cd9d9);}};}function respondWithFilteredResult(_0xec5324,_0x30c989){return function(_0x39a6d0){if(_0x39a6d0){var _0x24bde6=typeof _0x30c989[_0x8419('0x1c')]==='undefined'&&typeof _0x30c989[_0x8419('0x1d')]===_0x8419('0x1e');var _0x2609d9=_0x39a6d0[_0x8419('0x1f')];var _0xffbe0d=_0x24bde6?0x0:_0x30c989[_0x8419('0x1c')];var _0x1d3283=_0x24bde6?_0x39a6d0['count']:_0x30c989[_0x8419('0x1c')]+_0x30c989[_0x8419('0x1d')];var _0xfd9807;if(_0x1d3283>=_0x2609d9){_0x1d3283=_0x2609d9;_0xfd9807=0xc8;}else{_0xfd9807=0xce;}_0xec5324[_0x8419('0x20')](_0xfd9807);return _0xec5324[_0x8419('0x21')]('Content-Range',_0xffbe0d+'-'+_0x1d3283+'/'+_0x2609d9)[_0x8419('0x1b')](_0x39a6d0);}return null;};}function patchUpdates(_0x4619a6){return function(_0x18f2c7){try{jsonpatch[_0x8419('0x22')](_0x18f2c7,_0x4619a6,!![]);}catch(_0x1a0946){return BPromise[_0x8419('0x23')](_0x1a0946);}return _0x18f2c7[_0x8419('0x24')]();};}function saveUpdates(_0x4b0d03,_0x254b70){return function(_0x52f328){if(_0x52f328){return _0x52f328['update'](_0x4b0d03)[_0x8419('0x25')](function(_0x2c9dc5){return _0x2c9dc5;});}return null;};}function removeEntity(_0x2ad3a7,_0x26bf0d){return function(_0x2a3777){if(_0x2a3777){return _0x2a3777[_0x8419('0x26')]()[_0x8419('0x25')](function(){_0x2ad3a7[_0x8419('0x20')](0xcc)[_0x8419('0x1a')]();});}};}function handleEntityNotFound(_0x5d9d58,_0x14947e){return function(_0x164b0d){if(!_0x164b0d){_0x5d9d58[_0x8419('0x19')](0x194);}return _0x164b0d;};}function handleError(_0xd1340c,_0x23def2){_0x23def2=_0x23def2||0x1f4;return function(_0xe9b541){logger[_0x8419('0x27')](_0xe9b541['stack']);if(_0xe9b541[_0x8419('0x28')]){delete _0xe9b541[_0x8419('0x28')];}_0xd1340c[_0x8419('0x20')](_0x23def2)[_0x8419('0x29')](_0xe9b541);};}exports[_0x8419('0x2a')]=function(_0x48777e,_0x495ad0){var _0x430e25={},_0xdfc6e9={},_0x4d9351={'count':0x0,'rows':[]};var _0x17f1e1=_[_0x8419('0x2b')](db[_0x8419('0x2c')][_0x8419('0x2d')],function(_0x16bd8b){return{'name':_0x16bd8b[_0x8419('0x2e')],'type':_0x16bd8b[_0x8419('0x2f')]['key']};});_0xdfc6e9[_0x8419('0x30')]=_['map'](_0x17f1e1,'name');_0xdfc6e9['query']=_['keys'](_0x48777e[_0x8419('0x31')]);_0xdfc6e9[_0x8419('0x32')]=_[_0x8419('0x33')](_0xdfc6e9[_0x8419('0x30')],_0xdfc6e9[_0x8419('0x31')]);_0x430e25['attributes']=_[_0x8419('0x33')](_0xdfc6e9['model'],qs['fields'](_0x48777e[_0x8419('0x31')][_0x8419('0x34')]));_0x430e25['attributes']=_0x430e25[_0x8419('0x35')][_0x8419('0x36')]?_0x430e25[_0x8419('0x35')]:_0xdfc6e9[_0x8419('0x30')];if(!_0x48777e[_0x8419('0x31')][_0x8419('0x37')](_0x8419('0x38'))){_0x430e25['limit']=qs[_0x8419('0x1d')](_0x48777e[_0x8419('0x31')]['limit']);_0x430e25['offset']=qs[_0x8419('0x1c')](_0x48777e[_0x8419('0x31')]['offset']);}_0x430e25[_0x8419('0x39')]=qs['sort'](_0x48777e['query'][_0x8419('0x3a')]);_0x430e25[_0x8419('0x3b')]=qs[_0x8419('0x32')](_[_0x8419('0x3c')](_0x48777e[_0x8419('0x31')],_0xdfc6e9[_0x8419('0x32')]),_0x17f1e1);if(_0x48777e[_0x8419('0x31')][_0x8419('0x3d')]){_0x430e25[_0x8419('0x3b')]=_['merge'](_0x430e25[_0x8419('0x3b')],{'$or':_['map'](_0x17f1e1,function(_0x501f74){if(_0x501f74[_0x8419('0x2f')]!==_0x8419('0x3e')){var _0x138d14={};_0x138d14[_0x501f74[_0x8419('0x28')]]={'$like':'%'+_0x48777e[_0x8419('0x31')][_0x8419('0x3d')]+'%'};return _0x138d14;}})});}_0x430e25=_['merge']({},_0x430e25,_0x48777e[_0x8419('0x3f')]);var _0x4a62fa={'where':_0x430e25[_0x8419('0x3b')]};return db[_0x8419('0x2c')][_0x8419('0x1f')](_0x4a62fa)[_0x8419('0x25')](function(_0xcf023){_0x4d9351[_0x8419('0x1f')]=_0xcf023;if(_0x48777e['query'][_0x8419('0x40')]){_0x430e25[_0x8419('0x41')]=[{'all':!![]}];}return db[_0x8419('0x2c')][_0x8419('0x42')](_0x430e25);})[_0x8419('0x25')](function(_0x25d959){_0x4d9351['rows']=_0x25d959;return _0x4d9351;})[_0x8419('0x25')](respondWithFilteredResult(_0x495ad0,_0x430e25))[_0x8419('0x43')](handleError(_0x495ad0,null));};exports[_0x8419('0x44')]=function(_0x24d221,_0x56419a){var _0x5d8650={'raw':![],'where':{'id':_0x24d221[_0x8419('0x45')]['id']}},_0x3fdb04={};_0x3fdb04[_0x8419('0x30')]=_[_0x8419('0x46')](db[_0x8419('0x2c')]['rawAttributes']);_0x3fdb04[_0x8419('0x31')]=_[_0x8419('0x46')](_0x24d221['query']);_0x3fdb04[_0x8419('0x32')]=_[_0x8419('0x33')](_0x3fdb04['model'],_0x3fdb04[_0x8419('0x31')]);_0x5d8650[_0x8419('0x35')]=_[_0x8419('0x33')](_0x3fdb04[_0x8419('0x30')],qs['fields'](_0x24d221[_0x8419('0x31')][_0x8419('0x34')]));_0x5d8650['attributes']=_0x5d8650[_0x8419('0x35')][_0x8419('0x36')]?_0x5d8650[_0x8419('0x35')]:_0x3fdb04[_0x8419('0x30')];if(_0x24d221['query'][_0x8419('0x40')]){_0x5d8650[_0x8419('0x41')]=[{'all':!![]}];}_0x5d8650=_[_0x8419('0x47')]({},_0x5d8650,_0x24d221[_0x8419('0x3f')]);return db[_0x8419('0x2c')][_0x8419('0x48')](_0x5d8650)[_0x8419('0x25')](handleEntityNotFound(_0x56419a,null))[_0x8419('0x25')](respondWithResult(_0x56419a,null))[_0x8419('0x43')](handleError(_0x56419a,null));};exports[_0x8419('0x49')]=function(_0x43dea6,_0x5e99e3){return db[_0x8419('0x2c')]['create'](_0x43dea6[_0x8419('0x4a')],{})[_0x8419('0x25')](respondWithResult(_0x5e99e3,0xc9))['catch'](handleError(_0x5e99e3,null));};exports[_0x8419('0x4b')]=function(_0x4d02a9,_0xac93f9){if(_0x4d02a9['body']['id']){delete _0x4d02a9[_0x8419('0x4a')]['id'];}return db['IntegrationReport'][_0x8419('0x48')]({'where':{'id':_0x4d02a9[_0x8419('0x45')]['id']}})[_0x8419('0x25')](handleEntityNotFound(_0xac93f9,null))['then'](saveUpdates(_0x4d02a9[_0x8419('0x4a')],null))[_0x8419('0x25')](respondWithResult(_0xac93f9,null))[_0x8419('0x43')](handleError(_0xac93f9,null));};exports[_0x8419('0x26')]=function(_0x18ae49,_0x54c842){return db['IntegrationReport']['find']({'where':{'id':_0x18ae49['params']['id']}})[_0x8419('0x25')](handleEntityNotFound(_0x54c842,null))[_0x8419('0x25')](removeEntity(_0x54c842,null))[_0x8419('0x43')](handleError(_0x54c842,null));};exports[_0x8419('0x4c')]=function(_0x3c3004,_0x24ac5a){return db[_0x8419('0x2c')][_0x8419('0x4c')]()[_0x8419('0x25')](respondWithResult(_0x24ac5a,null))[_0x8419('0x43')](handleError(_0x24ac5a,null));}; \ No newline at end of file +var _0x01e3=['limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','IntegrationReport','rawAttributes','fieldName','filters','intersection','model','query','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','catch','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x01e3,0x101));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x301e('0x0'));var rimraf=require(_0x301e('0x1'));var zipdir=require(_0x301e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x301e('0x3'));var BPromise=require(_0x301e('0x4'));var Mustache=require(_0x301e('0x5'));var util=require(_0x301e('0x6'));var path=require(_0x301e('0x7'));var sox=require(_0x301e('0x8'));var csv=require(_0x301e('0x9'));var ejs=require(_0x301e('0xa'));var fs=require('fs');var fs_extra=require(_0x301e('0xb'));var _=require(_0x301e('0xc'));var squel=require(_0x301e('0xd'));var crypto=require('crypto');var jsforce=require(_0x301e('0xe'));var deskjs=require(_0x301e('0xf'));var toCsv=require(_0x301e('0x9'));var querystring=require(_0x301e('0x10'));var Papa=require(_0x301e('0x11'));var Redis=require(_0x301e('0x12'));var authService=require(_0x301e('0x13'));var qs=require(_0x301e('0x14'));var as=require(_0x301e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x301e('0x16'));var utils=require(_0x301e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x301e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bae73,_0x278617){_0x278617=_0x278617||0xcc;return function(_0x2bf351){if(_0x2bf351){return _0x3bae73['sendStatus'](_0x278617);}return _0x3bae73['status'](_0x278617)[_0x301e('0x19')]();};}function respondWithResult(_0x1ed67a,_0x12d0a1){_0x12d0a1=_0x12d0a1||0xc8;return function(_0x5f2352){if(_0x5f2352){return _0x1ed67a[_0x301e('0x1a')](_0x12d0a1)[_0x301e('0x1b')](_0x5f2352);}};}function respondWithFilteredResult(_0x5c1abd,_0x35704c){return function(_0x20c2de){if(_0x20c2de){var _0x1e6541=typeof _0x35704c[_0x301e('0x1c')]==='undefined'&&typeof _0x35704c['limit']===_0x301e('0x1d');var _0x4aa89f=_0x20c2de[_0x301e('0x1e')];var _0x160f68=_0x1e6541?0x0:_0x35704c[_0x301e('0x1c')];var _0x290dcc=_0x1e6541?_0x20c2de[_0x301e('0x1e')]:_0x35704c[_0x301e('0x1c')]+_0x35704c[_0x301e('0x1f')];var _0x1a57a5;if(_0x290dcc>=_0x4aa89f){_0x290dcc=_0x4aa89f;_0x1a57a5=0xc8;}else{_0x1a57a5=0xce;}_0x5c1abd[_0x301e('0x1a')](_0x1a57a5);return _0x5c1abd[_0x301e('0x20')](_0x301e('0x21'),_0x160f68+'-'+_0x290dcc+'/'+_0x4aa89f)[_0x301e('0x1b')](_0x20c2de);}return null;};}function patchUpdates(_0x520346){return function(_0x198888){try{jsonpatch[_0x301e('0x22')](_0x198888,_0x520346,!![]);}catch(_0x250ccd){return BPromise[_0x301e('0x23')](_0x250ccd);}return _0x198888[_0x301e('0x24')]();};}function saveUpdates(_0x24c760,_0x4b4dae){return function(_0x27fba3){if(_0x27fba3){return _0x27fba3[_0x301e('0x25')](_0x24c760)[_0x301e('0x26')](function(_0x8602a6){return _0x8602a6;});}return null;};}function removeEntity(_0x102a54,_0x7191d6){return function(_0x3a4f78){if(_0x3a4f78){return _0x3a4f78[_0x301e('0x27')]()[_0x301e('0x26')](function(){_0x102a54[_0x301e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc2e9,_0x5424e7){return function(_0x218ea1){if(!_0x218ea1){_0x5dc2e9[_0x301e('0x28')](0x194);}return _0x218ea1;};}function handleError(_0x45f224,_0x80bc9f){_0x80bc9f=_0x80bc9f||0x1f4;return function(_0x2f691b){logger['error'](_0x2f691b['stack']);if(_0x2f691b[_0x301e('0x29')]){delete _0x2f691b[_0x301e('0x29')];}_0x45f224[_0x301e('0x1a')](_0x80bc9f)[_0x301e('0x2a')](_0x2f691b);};}exports[_0x301e('0x2b')]=function(_0x16ec41,_0x5c8db8){var _0x1619d1={},_0x132e37={},_0x59d63b={'count':0x0,'rows':[]};var _0x326571=_[_0x301e('0x2c')](db[_0x301e('0x2d')][_0x301e('0x2e')],function(_0x157123){return{'name':_0x157123[_0x301e('0x2f')],'type':_0x157123['type']['key']};});_0x132e37['model']=_[_0x301e('0x2c')](_0x326571,_0x301e('0x29'));_0x132e37['query']=_['keys'](_0x16ec41['query']);_0x132e37[_0x301e('0x30')]=_[_0x301e('0x31')](_0x132e37[_0x301e('0x32')],_0x132e37[_0x301e('0x33')]);_0x1619d1['attributes']=_[_0x301e('0x31')](_0x132e37[_0x301e('0x32')],qs[_0x301e('0x34')](_0x16ec41[_0x301e('0x33')][_0x301e('0x34')]));_0x1619d1[_0x301e('0x35')]=_0x1619d1[_0x301e('0x35')][_0x301e('0x36')]?_0x1619d1['attributes']:_0x132e37[_0x301e('0x32')];if(!_0x16ec41[_0x301e('0x33')]['hasOwnProperty'](_0x301e('0x37'))){_0x1619d1[_0x301e('0x1f')]=qs[_0x301e('0x1f')](_0x16ec41['query'][_0x301e('0x1f')]);_0x1619d1[_0x301e('0x1c')]=qs['offset'](_0x16ec41[_0x301e('0x33')]['offset']);}_0x1619d1['order']=qs[_0x301e('0x38')](_0x16ec41[_0x301e('0x33')][_0x301e('0x38')]);_0x1619d1[_0x301e('0x39')]=qs[_0x301e('0x30')](_[_0x301e('0x3a')](_0x16ec41[_0x301e('0x33')],_0x132e37[_0x301e('0x30')]),_0x326571);if(_0x16ec41[_0x301e('0x33')][_0x301e('0x3b')]){_0x1619d1[_0x301e('0x39')]=_[_0x301e('0x3c')](_0x1619d1['where'],{'$or':_[_0x301e('0x2c')](_0x326571,function(_0x58e95b){if(_0x58e95b[_0x301e('0x3d')]!=='VIRTUAL'){var _0x722608={};_0x722608[_0x58e95b[_0x301e('0x29')]]={'$like':'%'+_0x16ec41[_0x301e('0x33')][_0x301e('0x3b')]+'%'};return _0x722608;}})});}_0x1619d1=_['merge']({},_0x1619d1,_0x16ec41[_0x301e('0x3e')]);var _0x4597e0={'where':_0x1619d1[_0x301e('0x39')]};return db[_0x301e('0x2d')][_0x301e('0x1e')](_0x4597e0)['then'](function(_0x10fe54){_0x59d63b[_0x301e('0x1e')]=_0x10fe54;if(_0x16ec41['query'][_0x301e('0x3f')]){_0x1619d1['include']=[{'all':!![]}];}return db[_0x301e('0x2d')]['findAll'](_0x1619d1);})[_0x301e('0x26')](function(_0x17bf92){_0x59d63b['rows']=_0x17bf92;return _0x59d63b;})[_0x301e('0x26')](respondWithFilteredResult(_0x5c8db8,_0x1619d1))[_0x301e('0x40')](handleError(_0x5c8db8,null));};exports['show']=function(_0x27910b,_0x25b007){var _0x465d54={'raw':![],'where':{'id':_0x27910b[_0x301e('0x41')]['id']}},_0x45b2d2={};_0x45b2d2['model']=_[_0x301e('0x42')](db[_0x301e('0x2d')][_0x301e('0x2e')]);_0x45b2d2['query']=_['keys'](_0x27910b[_0x301e('0x33')]);_0x45b2d2[_0x301e('0x30')]=_[_0x301e('0x31')](_0x45b2d2['model'],_0x45b2d2[_0x301e('0x33')]);_0x465d54[_0x301e('0x35')]=_['intersection'](_0x45b2d2['model'],qs[_0x301e('0x34')](_0x27910b['query']['fields']));_0x465d54[_0x301e('0x35')]=_0x465d54[_0x301e('0x35')]['length']?_0x465d54['attributes']:_0x45b2d2[_0x301e('0x32')];if(_0x27910b[_0x301e('0x33')][_0x301e('0x3f')]){_0x465d54[_0x301e('0x43')]=[{'all':!![]}];}_0x465d54=_[_0x301e('0x3c')]({},_0x465d54,_0x27910b[_0x301e('0x3e')]);return db[_0x301e('0x2d')][_0x301e('0x44')](_0x465d54)[_0x301e('0x26')](handleEntityNotFound(_0x25b007,null))[_0x301e('0x26')](respondWithResult(_0x25b007,null))['catch'](handleError(_0x25b007,null));};exports[_0x301e('0x45')]=function(_0x3e3d53,_0x2c96b7){return db[_0x301e('0x2d')][_0x301e('0x45')](_0x3e3d53['body'],{})[_0x301e('0x26')](respondWithResult(_0x2c96b7,0xc9))[_0x301e('0x40')](handleError(_0x2c96b7,null));};exports[_0x301e('0x25')]=function(_0xdeb9ef,_0x236d32){if(_0xdeb9ef[_0x301e('0x46')]['id']){delete _0xdeb9ef[_0x301e('0x46')]['id'];}return db[_0x301e('0x2d')]['find']({'where':{'id':_0xdeb9ef['params']['id']}})['then'](handleEntityNotFound(_0x236d32,null))[_0x301e('0x26')](saveUpdates(_0xdeb9ef['body'],null))[_0x301e('0x26')](respondWithResult(_0x236d32,null))[_0x301e('0x40')](handleError(_0x236d32,null));};exports[_0x301e('0x27')]=function(_0x4bb576,_0x252c65){return db[_0x301e('0x2d')][_0x301e('0x44')]({'where':{'id':_0x4bb576['params']['id']}})['then'](handleEntityNotFound(_0x252c65,null))[_0x301e('0x26')](removeEntity(_0x252c65,null))[_0x301e('0x40')](handleError(_0x252c65,null));};exports[_0x301e('0x47')]=function(_0x1badab,_0x5a6a5f){return db[_0x301e('0x2d')][_0x301e('0x47')]()['then'](respondWithResult(_0x5a6a5f,null))[_0x301e('0x40')](handleError(_0x5a6a5f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5f01bc2..aa883fc 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 _0x2ab6=['path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c852a,_0x528403){var _0x20b14d=function(_0x3e41e7){while(--_0x3e41e7){_0x4c852a['push'](_0x4c852a['shift']());}};_0x20b14d(++_0x528403);}(_0x2ab6,0xae));var _0x62ab=function(_0x5e6523,_0x4771e7){_0x5e6523=_0x5e6523-0x0;var _0x360b00=_0x2ab6[_0x5e6523];return _0x360b00;};'use strict';var _=require(_0x62ab('0x0'));var util=require(_0x62ab('0x1'));var logger=require(_0x62ab('0x2'))(_0x62ab('0x3'));var moment=require('moment');var BPromise=require(_0x62ab('0x4'));var rp=require(_0x62ab('0x5'));var fs=require('fs');var path=require(_0x62ab('0x6'));var rimraf=require(_0x62ab('0x7'));var config=require(_0x62ab('0x8'));var attributes=require(_0x62ab('0x9'));module['exports']=function(_0x290fac,_0x549c10){return _0x290fac[_0x62ab('0xa')](_0x62ab('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa586=['exports','define','report_integration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xa586,0x153));var _0x6a58=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0xa586[_0x421e36];return _0x20b3e3;};'use strict';var _=require(_0x6a58('0x0'));var util=require('util');var logger=require(_0x6a58('0x1'))(_0x6a58('0x2'));var moment=require(_0x6a58('0x3'));var BPromise=require(_0x6a58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a58('0x5'));var rimraf=require(_0x6a58('0x6'));var config=require(_0x6a58('0x7'));var attributes=require(_0x6a58('0x8'));module[_0x6a58('0x9')]=function(_0x9962e3,_0x3c0698){return _0x9962e3[_0x6a58('0xa')]('IntegrationReport',attributes,{'tableName':_0x6a58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index d849344..4c5d39b 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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x1967,0x173));var _0x7196=function(_0x56428a,_0x5710b4){_0x56428a=_0x56428a-0x0;var _0x36e063=_0x1967[_0x56428a];return _0x36e063;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ 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(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc2c7,0x134));var _0x7c2c=function(_0x499bda,_0x4f87a3){_0x499bda=_0x499bda-0x0;var _0x15c066=_0xc2c7[_0x499bda];return _0x15c066;};'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 5c86048..29d52e4 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 _0xfa9f=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','/:id','show','get','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x2536cc,_0x301663){var _0xfb9bab=function(_0x1f1c20){while(--_0x1f1c20){_0x2536cc['push'](_0x2536cc['shift']());}};_0xfb9bab(++_0x301663);}(_0xfa9f,0x93));var _0xffa9=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0xfa9f[_0x553150];return _0x18193d;};'use strict';var multer=require('multer');var util=require(_0xffa9('0x0'));var path=require(_0xffa9('0x1'));var timeout=require(_0xffa9('0x2'));var express=require(_0xffa9('0x3'));var router=express[_0xffa9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffa9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffa9('0x6'));var controller=require(_0xffa9('0x7'));router['get']('/',auth[_0xffa9('0x8')](),controller['index']);router['get'](_0xffa9('0x9'),auth[_0xffa9('0x8')](),controller[_0xffa9('0xa')]);router[_0xffa9('0xb')]('/:id/sub_intervals',auth[_0xffa9('0x8')](),controller[_0xffa9('0xc')]);router[_0xffa9('0xd')]('/',auth[_0xffa9('0x8')](),controller[_0xffa9('0xe')]);router[_0xffa9('0xd')](_0xffa9('0xf'),auth[_0xffa9('0x8')](),controller[_0xffa9('0x10')]);router[_0xffa9('0xd')](_0xffa9('0x11'),auth['isAuthenticated'](),controller[_0xffa9('0x12')]);router[_0xffa9('0x13')](_0xffa9('0x9'),auth[_0xffa9('0x8')](),controller[_0xffa9('0x14')]);router[_0xffa9('0x15')](_0xffa9('0x9'),auth[_0xffa9('0x8')](),controller[_0xffa9('0x16')]);module[_0xffa9('0x17')]=router; \ No newline at end of file +var _0x1c90=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x1215bd,_0x35bbb5){var _0x5d80f5=function(_0x365366){while(--_0x365366){_0x1215bd['push'](_0x1215bd['shift']());}};_0x5d80f5(++_0x35bbb5);}(_0x1c90,0x104));var _0x01c9=function(_0x4e8af8,_0x16871a){_0x4e8af8=_0x4e8af8-0x0;var _0x5dad5d=_0x1c90[_0x4e8af8];return _0x5dad5d;};'use strict';var multer=require('multer');var util=require(_0x01c9('0x0'));var path=require(_0x01c9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01c9('0x2')]();var fs_extra=require(_0x01c9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x01c9('0x4'));var config=require(_0x01c9('0x5'));var controller=require(_0x01c9('0x6'));router['get']('/',auth[_0x01c9('0x7')](),controller[_0x01c9('0x8')]);router[_0x01c9('0x9')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0xb')]);router[_0x01c9('0x9')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0xd')]);router[_0x01c9('0xe')]('/',auth[_0x01c9('0x7')](),controller[_0x01c9('0xf')]);router[_0x01c9('0xe')](_0x01c9('0xc'),auth['isAuthenticated'](),controller[_0x01c9('0x10')]);router[_0x01c9('0xe')](_0x01c9('0x11'),auth['isAuthenticated'](),controller[_0x01c9('0x12')]);router[_0x01c9('0x13')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x14')]);router[_0x01c9('0x15')](_0x01c9('0xa'),auth[_0x01c9('0x7')](),controller[_0x01c9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4b1ff98..152813a 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 _0xfdf6=['STRING','sequelize'];(function(_0x1118f3,_0x553c42){var _0x184c3c=function(_0x414838){while(--_0x414838){_0x1118f3['push'](_0x1118f3['shift']());}};_0x184c3c(++_0x553c42);}(_0xfdf6,0x1df));var _0x6fdf=function(_0x40b918,_0x3ff794){_0x40b918=_0x40b918-0x0;var _0xa0e480=_0xfdf6[_0x40b918];return _0xa0e480;};'use strict';var Sequelize=require(_0x6fdf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6fdf('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x296b=['STRING','sequelize'];(function(_0x12923e,_0x389974){var _0x58c029=function(_0x1c3a95){while(--_0x1c3a95){_0x12923e['push'](_0x12923e['shift']());}};_0x58c029(++_0x389974);}(_0x296b,0x81));var _0xb296=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x296b[_0x15cbce];return _0x257f29;};'use strict';var Sequelize=require(_0xb296('0x0'));module['exports']={'name':{'type':Sequelize[_0xb296('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb296('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 9a7ef00..bad5d90 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 _0xde7a=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','nolimit','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','key','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','findAll','rows','catch','show','params','keys','rawAttributes','filters','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','autoAssociation'];(function(_0x2de778,_0x4cb6f1){var _0x3c6112=function(_0x32045d){while(--_0x32045d){_0x2de778['push'](_0x2de778['shift']());}};_0x3c6112(++_0x4cb6f1);}(_0xde7a,0x1ef));var _0xade7=function(_0x4ecd76,_0x79f1f3){_0x4ecd76=_0x4ecd76-0x0;var _0x240f34=_0xde7a[_0x4ecd76];return _0x240f34;};'use strict';var emlformat=require(_0xade7('0x0'));var rimraf=require(_0xade7('0x1'));var zipdir=require(_0xade7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xade7('0x3'));var moment=require(_0xade7('0x4'));var BPromise=require(_0xade7('0x5'));var Mustache=require(_0xade7('0x6'));var util=require(_0xade7('0x7'));var path=require(_0xade7('0x8'));var sox=require(_0xade7('0x9'));var csv=require(_0xade7('0xa'));var ejs=require(_0xade7('0xb'));var fs=require('fs');var fs_extra=require(_0xade7('0xc'));var _=require(_0xade7('0xd'));var squel=require(_0xade7('0xe'));var crypto=require(_0xade7('0xf'));var jsforce=require(_0xade7('0x10'));var deskjs=require(_0xade7('0x11'));var toCsv=require(_0xade7('0xa'));var querystring=require(_0xade7('0x12'));var Papa=require(_0xade7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xade7('0x14'));var as=require(_0xade7('0x15'));var hardwareService=require(_0xade7('0x16'));var logger=require(_0xade7('0x17'))(_0xade7('0x18'));var utils=require(_0xade7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xade7('0x1a'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x24abe4,_0x2c6369){_0x2c6369=_0x2c6369||0xcc;return function(_0x6cafd4){if(_0x6cafd4){return _0x24abe4[_0xade7('0x1b')](_0x2c6369);}return _0x24abe4[_0xade7('0x1c')](_0x2c6369)[_0xade7('0x1d')]();};}function respondWithResult(_0x44addc,_0x3d10eb){_0x3d10eb=_0x3d10eb||0xc8;return function(_0x56cfc4){if(_0x56cfc4){return _0x44addc[_0xade7('0x1c')](_0x3d10eb)[_0xade7('0x1e')](_0x56cfc4);}};}function respondWithFilteredResult(_0x391d07,_0x9fc73e){return function(_0x15a926){if(_0x15a926){var _0x2c9bc7=typeof _0x9fc73e[_0xade7('0x1f')]===_0xade7('0x20')&&typeof _0x9fc73e[_0xade7('0x21')]===_0xade7('0x20');var _0x427870=_0x15a926['count'];var _0x5e478c=_0x2c9bc7?0x0:_0x9fc73e[_0xade7('0x1f')];var _0x3f9163=_0x2c9bc7?_0x15a926['count']:_0x9fc73e[_0xade7('0x1f')]+_0x9fc73e[_0xade7('0x21')];var _0x28351b;if(_0x3f9163>=_0x427870){_0x3f9163=_0x427870;_0x28351b=0xc8;}else{_0x28351b=0xce;}_0x391d07['status'](_0x28351b);return _0x391d07[_0xade7('0x22')](_0xade7('0x23'),_0x5e478c+'-'+_0x3f9163+'/'+_0x427870)[_0xade7('0x1e')](_0x15a926);}return null;};}function patchUpdates(_0x5bdfa5){return function(_0x33ab45){try{jsonpatch['apply'](_0x33ab45,_0x5bdfa5,!![]);}catch(_0x3e7d03){return BPromise[_0xade7('0x24')](_0x3e7d03);}return _0x33ab45[_0xade7('0x25')]();};}function saveUpdates(_0x1920ca,_0x40a076){return function(_0xcf1047){if(_0xcf1047){return _0xcf1047[_0xade7('0x26')](_0x1920ca)[_0xade7('0x27')](function(_0x46140a){return _0x46140a;});}return null;};}function removeEntity(_0x3296e1,_0x2f0aec){return function(_0x1a5fa9){if(_0x1a5fa9){return _0x1a5fa9['destroy']()[_0xade7('0x27')](function(){var _0x16c1bb=_0x1a5fa9[_0xade7('0x28')]({'plain':!![]});var _0x39080c='Intervals';return db[_0xade7('0x29')][_0xade7('0x2a')]({'where':{'type':_0x39080c,'resourceId':_0x16c1bb['id']}})['then'](function(){return _0x1a5fa9;});})[_0xade7('0x27')](function(){_0x3296e1['status'](0xcc)[_0xade7('0x1d')]();});}};}function handleEntityNotFound(_0x1acd67,_0x19b2ae){return function(_0x377921){if(!_0x377921){_0x1acd67[_0xade7('0x1b')](0x194);}return _0x377921;};}function handleError(_0x216d37,_0x27930d){_0x27930d=_0x27930d||0x1f4;return function(_0x104a1c){logger[_0xade7('0x2b')](_0x104a1c[_0xade7('0x2c')]);if(_0x104a1c['name']){delete _0x104a1c[_0xade7('0x2d')];}_0x216d37['status'](_0x27930d)[_0xade7('0x2e')](_0x104a1c);};}exports[_0xade7('0x2f')]=function(_0x1dc51e,_0x4e56d4){var _0xbbc6ad={},_0x48c33b={},_0x562555={'count':0x0,'rows':[]};var _0x3ddfb5=_[_0xade7('0x30')](db[_0xade7('0x31')]['rawAttributes'],function(_0x389555){return{'name':_0x389555[_0xade7('0x32')],'type':_0x389555['type'][_0xade7('0x33')]};});_0x48c33b['model']=_[_0xade7('0x30')](_0x3ddfb5,'name');_0x48c33b[_0xade7('0x34')]=_['keys'](_0x1dc51e['query']);_0x48c33b['filters']=_[_0xade7('0x35')](_0x48c33b[_0xade7('0x36')],_0x48c33b['query']);_0xbbc6ad['attributes']=_[_0xade7('0x35')](_0x48c33b['model'],qs[_0xade7('0x37')](_0x1dc51e['query'][_0xade7('0x37')]));_0xbbc6ad[_0xade7('0x38')]=_0xbbc6ad[_0xade7('0x38')]['length']?_0xbbc6ad[_0xade7('0x38')]:_0x48c33b[_0xade7('0x36')];if(!_0x1dc51e[_0xade7('0x34')][_0xade7('0x39')]('nolimit')){_0xbbc6ad[_0xade7('0x21')]=qs['limit'](_0x1dc51e[_0xade7('0x34')][_0xade7('0x21')]);_0xbbc6ad[_0xade7('0x1f')]=qs['offset'](_0x1dc51e[_0xade7('0x34')]['offset']);}_0xbbc6ad[_0xade7('0x3a')]=qs[_0xade7('0x3b')](_0x1dc51e['query'][_0xade7('0x3b')]);_0xbbc6ad[_0xade7('0x3c')]=qs['filters'](_[_0xade7('0x3d')](_0x1dc51e[_0xade7('0x34')],_0x48c33b['filters']),_0x3ddfb5);if(_0x1dc51e['query']['filter']){_0xbbc6ad['where']=_[_0xade7('0x3e')](_0xbbc6ad[_0xade7('0x3c')],{'$or':_[_0xade7('0x30')](_0x3ddfb5,function(_0x2960f8){if(_0x2960f8[_0xade7('0x3f')]!==_0xade7('0x40')){var _0x468fac={};_0x468fac[_0x2960f8[_0xade7('0x2d')]]={'$like':'%'+_0x1dc51e[_0xade7('0x34')][_0xade7('0x41')]+'%'};return _0x468fac;}})});}_0xbbc6ad=_['merge']({},_0xbbc6ad,_0x1dc51e[_0xade7('0x42')]);var _0x107cf4={'where':_0xbbc6ad[_0xade7('0x3c')]};return db[_0xade7('0x31')][_0xade7('0x43')](_0x107cf4)[_0xade7('0x27')](function(_0x51a6ea){_0x562555[_0xade7('0x43')]=_0x51a6ea;if(_0x1dc51e[_0xade7('0x34')]['includeAll']){_0xbbc6ad['include']=[{'all':!![]}];}return db[_0xade7('0x31')][_0xade7('0x44')](_0xbbc6ad);})[_0xade7('0x27')](function(_0x498b97){_0x562555[_0xade7('0x45')]=_0x498b97;return _0x562555;})[_0xade7('0x27')](respondWithFilteredResult(_0x4e56d4,_0xbbc6ad))[_0xade7('0x46')](handleError(_0x4e56d4,null));};exports[_0xade7('0x47')]=function(_0x497af9,_0x7f727b){var _0x2fc375={'raw':!![],'where':{'id':_0x497af9[_0xade7('0x48')]['id']}},_0x3c1332={};_0x3c1332[_0xade7('0x36')]=_[_0xade7('0x49')](db[_0xade7('0x31')][_0xade7('0x4a')]);_0x3c1332[_0xade7('0x34')]=_['keys'](_0x497af9[_0xade7('0x34')]);_0x3c1332[_0xade7('0x4b')]=_[_0xade7('0x35')](_0x3c1332['model'],_0x3c1332[_0xade7('0x34')]);_0x2fc375[_0xade7('0x38')]=_[_0xade7('0x35')](_0x3c1332[_0xade7('0x36')],qs['fields'](_0x497af9['query'][_0xade7('0x37')]));_0x2fc375['attributes']=_0x2fc375[_0xade7('0x38')][_0xade7('0x4c')]?_0x2fc375[_0xade7('0x38')]:_0x3c1332[_0xade7('0x36')];if(_0x497af9[_0xade7('0x34')]['includeAll']){_0x2fc375[_0xade7('0x4d')]=[{'all':!![]}];}_0x2fc375=_[_0xade7('0x3e')]({},_0x2fc375,_0x497af9[_0xade7('0x42')]);return db[_0xade7('0x31')][_0xade7('0x4e')](_0x2fc375)['then'](handleEntityNotFound(_0x7f727b,null))[_0xade7('0x27')](respondWithResult(_0x7f727b,null))['catch'](handleError(_0x7f727b,null));};exports['create']=function(_0x2c2067,_0x5321a){return db['Interval'][_0xade7('0x4f')](_0x2c2067[_0xade7('0x50')],{})[_0xade7('0x27')](function(_0x5c56bf){var _0x41ceb3=_0x2c2067['user'][_0xade7('0x28')]({'plain':!![]});if(!_0x41ceb3)throw new Error(_0xade7('0x51'));if(_0x41ceb3[_0xade7('0x52')]===_0xade7('0x53')){var _0x3b0438=_0x5c56bf['get']({'plain':!![]});var _0x510ec9=_0xade7('0x54');return db[_0xade7('0x55')][_0xade7('0x4e')]({'where':{'name':_0x510ec9,'userProfileId':_0x41ceb3['userProfileId']},'raw':!![]})[_0xade7('0x27')](function(_0x7f8e30){if(_0x7f8e30&&_0x7f8e30[_0xade7('0x56')]===0x0){return db[_0xade7('0x29')]['create']({'name':_0x3b0438[_0xade7('0x2d')],'resourceId':_0x3b0438['id'],'type':_0x7f8e30['name'],'sectionId':_0x7f8e30['id']},{})[_0xade7('0x27')](function(){return _0x5c56bf;});}else{return _0x5c56bf;}})['catch'](function(_0x348032){logger[_0xade7('0x2b')](_0xade7('0x57'),_0x348032);throw _0x348032;});}return _0x5c56bf;})[_0xade7('0x27')](respondWithResult(_0x5321a,0xc9))[_0xade7('0x46')](handleError(_0x5321a,null));};exports['update']=function(_0x85ef47,_0x89c80e){if(_0x85ef47[_0xade7('0x50')]['id']){delete _0x85ef47[_0xade7('0x50')]['id'];}return db[_0xade7('0x31')][_0xade7('0x4e')]({'where':{'id':_0x85ef47[_0xade7('0x48')]['id']}})['then'](handleEntityNotFound(_0x89c80e,null))[_0xade7('0x27')](saveUpdates(_0x85ef47[_0xade7('0x50')],null))[_0xade7('0x27')](respondWithResult(_0x89c80e,null))[_0xade7('0x46')](handleError(_0x89c80e,null));};exports[_0xade7('0x2a')]=function(_0x2fea8b,_0x2039b8){return db[_0xade7('0x31')]['find']({'where':{'id':_0x2fea8b[_0xade7('0x48')]['id']}})[_0xade7('0x27')](handleEntityNotFound(_0x2039b8,null))['then'](removeEntity(_0x2039b8,null))[_0xade7('0x46')](handleError(_0x2039b8,null));};exports[_0xade7('0x58')]=function(_0x2b16e4,_0x2758e5,_0x3a5a51){if(_0x2b16e4[_0xade7('0x50')]['id']){delete _0x2b16e4[_0xade7('0x50')]['id'];}return db['Interval'][_0xade7('0x4e')]({'where':{'id':_0x2b16e4['params']['id']}})[_0xade7('0x27')](handleEntityNotFound(_0x2758e5,null))['then'](function(_0xfc4e22){if(_0xfc4e22){_0x2b16e4[_0xade7('0x50')][_0xade7('0x59')]=_0xfc4e22['id'];return db[_0xade7('0x31')][_0xade7('0x4f')](_0x2b16e4[_0xade7('0x50')]);}})['then'](respondWithResult(_0x2758e5,null))[_0xade7('0x46')](handleError(_0x2758e5,null));};exports[_0xade7('0x5a')]=function(_0x1848c9,_0x56eaa8,_0x2bb747){var _0x3ce24b={};var _0xe5c50f={};var _0x5f5a64;var _0x5d7f4e;return db[_0xade7('0x31')]['findOne']({'where':{'id':_0x1848c9[_0xade7('0x48')]['id']}})[_0xade7('0x27')](handleEntityNotFound(_0x56eaa8,null))[_0xade7('0x27')](function(_0x5cda7e){if(_0x5cda7e){_0x5f5a64=_0x5cda7e;_0xe5c50f[_0xade7('0x36')]=_[_0xade7('0x49')](db[_0xade7('0x31')][_0xade7('0x4a')]);_0xe5c50f[_0xade7('0x34')]=_[_0xade7('0x49')](_0x1848c9[_0xade7('0x34')]);_0xe5c50f[_0xade7('0x4b')]=_['intersection'](_0xe5c50f['model'],_0xe5c50f[_0xade7('0x34')]);_0x3ce24b[_0xade7('0x38')]=_[_0xade7('0x35')](_0xe5c50f[_0xade7('0x36')],qs[_0xade7('0x37')](_0x1848c9[_0xade7('0x34')][_0xade7('0x37')]));_0x3ce24b[_0xade7('0x38')]=_0x3ce24b[_0xade7('0x38')][_0xade7('0x4c')]?_0x3ce24b['attributes']:_0xe5c50f[_0xade7('0x36')];_0x3ce24b[_0xade7('0x3a')]=qs['sort'](_0x1848c9[_0xade7('0x34')][_0xade7('0x3b')]);_0x3ce24b[_0xade7('0x3c')]=qs[_0xade7('0x4b')](_['pick'](_0x1848c9[_0xade7('0x34')],_0xe5c50f['filters']));if(_0x1848c9[_0xade7('0x34')][_0xade7('0x41')]){_0x3ce24b['where']=_[_0xade7('0x3e')](_0x3ce24b[_0xade7('0x3c')],{'$or':_['map'](_0x3ce24b[_0xade7('0x38')],function(_0x3b4336){var _0xb46138={};_0xb46138[_0x3b4336]={'$like':'%'+_0x1848c9[_0xade7('0x34')][_0xade7('0x41')]+'%'};return _0xb46138;})});}_0x3ce24b=_[_0xade7('0x3e')]({},_0x3ce24b,_0x1848c9[_0xade7('0x42')]);return _0x5f5a64['getIntervals'](_0x3ce24b);}})[_0xade7('0x27')](function(_0x1340f3){if(_0x1340f3){_0x5d7f4e=_0x1340f3['length'];if(!_0x1848c9['query'][_0xade7('0x39')](_0xade7('0x5b'))){_0x3ce24b[_0xade7('0x21')]=qs[_0xade7('0x21')](_0x1848c9['query'][_0xade7('0x21')]);_0x3ce24b[_0xade7('0x1f')]=qs[_0xade7('0x1f')](_0x1848c9[_0xade7('0x34')]['offset']);}return _0x5f5a64[_0xade7('0x5a')](_0x3ce24b);}})[_0xade7('0x27')](function(_0xdb2413){if(_0xdb2413){return _0xdb2413?{'count':_0x5d7f4e,'rows':_0xdb2413}:null;}})[_0xade7('0x27')](respondWithResult(_0x56eaa8,null))['catch'](handleError(_0x56eaa8,null));};exports[_0xade7('0x5c')]=function(_0x32b069,_0x47a878,_0x2ce49c){return db[_0xade7('0x31')][_0xade7('0x5d')]({'where':{'id':_0x32b069[_0xade7('0x48')]['id']}})[_0xade7('0x27')](handleEntityNotFound(_0x47a878,null))['then'](function(_0x4403f8){if(_0x4403f8){return db[_0xade7('0x5e')][_0xade7('0x5f')](function(_0x2372ff){return db[_0xade7('0x31')][_0xade7('0x2a')]({'where':{'IntervalId':_0x32b069[_0xade7('0x48')]['id']},'transaction':_0x2372ff})['then'](function(_0x2e122b){var _0x122f68=_[_0xade7('0x30')](_0x32b069[_0xade7('0x50')],function(_0x1ccd13){delete _0x1ccd13['id'];_0x1ccd13[_0xade7('0x59')]=_0x32b069[_0xade7('0x48')]['id'];return _0x1ccd13;});return db[_0xade7('0x31')][_0xade7('0x60')](_0x122f68,{'transaction':_0x2372ff});});})[_0xade7('0x27')](function(){return db['Interval'][_0xade7('0x44')]({'where':{'IntervalId':_0x32b069[_0xade7('0x48')]['id']}});});}})[_0xade7('0x27')](respondWithResult(_0x47a878,null))['catch'](handleError(_0x47a878,null));}; \ No newline at end of file +var _0x0d49=['rows','catch','show','rawAttributes','include','merge','create','body','role','Intervals','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','length','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','get','UserProfileResource','stack','send','map','Interval','type','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll'];(function(_0x52c462,_0x52921c){var _0x4971c8=function(_0x851681){while(--_0x851681){_0x52c462['push'](_0x52c462['shift']());}};_0x4971c8(++_0x52921c);}(_0x0d49,0x12e));var _0x90d4=function(_0x581adb,_0x5ca091){_0x581adb=_0x581adb-0x0;var _0x20fa52=_0x0d49[_0x581adb];return _0x20fa52;};'use strict';var emlformat=require(_0x90d4('0x0'));var rimraf=require(_0x90d4('0x1'));var zipdir=require(_0x90d4('0x2'));var jsonpatch=require(_0x90d4('0x3'));var rp=require('request-promise');var moment=require(_0x90d4('0x4'));var BPromise=require(_0x90d4('0x5'));var Mustache=require('mustache');var util=require(_0x90d4('0x6'));var path=require(_0x90d4('0x7'));var sox=require(_0x90d4('0x8'));var csv=require(_0x90d4('0x9'));var ejs=require(_0x90d4('0xa'));var fs=require('fs');var fs_extra=require(_0x90d4('0xb'));var _=require(_0x90d4('0xc'));var squel=require(_0x90d4('0xd'));var crypto=require(_0x90d4('0xe'));var jsforce=require(_0x90d4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x90d4('0x9'));var querystring=require('querystring');var Papa=require(_0x90d4('0x10'));var Redis=require('ioredis');var authService=require(_0x90d4('0x11'));var qs=require(_0x90d4('0x12'));var as=require(_0x90d4('0x13'));var hardwareService=require(_0x90d4('0x14'));var logger=require('../../config/logger')(_0x90d4('0x15'));var utils=require(_0x90d4('0x16'));var config=require(_0x90d4('0x17'));var licenseUtil=require(_0x90d4('0x18'));var db=require(_0x90d4('0x19'))['db'];var extensions=require(_0x90d4('0x1a'));function respondWithStatusCode(_0x50cf90,_0x24b1a5){_0x24b1a5=_0x24b1a5||0xcc;return function(_0x5e069c){if(_0x5e069c){return _0x50cf90[_0x90d4('0x1b')](_0x24b1a5);}return _0x50cf90[_0x90d4('0x1c')](_0x24b1a5)[_0x90d4('0x1d')]();};}function respondWithResult(_0x4173ab,_0x2655fa){_0x2655fa=_0x2655fa||0xc8;return function(_0x3facae){if(_0x3facae){return _0x4173ab[_0x90d4('0x1c')](_0x2655fa)[_0x90d4('0x1e')](_0x3facae);}};}function respondWithFilteredResult(_0x27505a,_0x1c8d22){return function(_0x50f0c7){if(_0x50f0c7){var _0x3e6156=typeof _0x1c8d22[_0x90d4('0x1f')]===_0x90d4('0x20')&&typeof _0x1c8d22[_0x90d4('0x21')]==='undefined';var _0x39c4d9=_0x50f0c7[_0x90d4('0x22')];var _0x41fc0c=_0x3e6156?0x0:_0x1c8d22[_0x90d4('0x1f')];var _0x55c290=_0x3e6156?_0x50f0c7[_0x90d4('0x22')]:_0x1c8d22[_0x90d4('0x1f')]+_0x1c8d22[_0x90d4('0x21')];var _0x58066d;if(_0x55c290>=_0x39c4d9){_0x55c290=_0x39c4d9;_0x58066d=0xc8;}else{_0x58066d=0xce;}_0x27505a['status'](_0x58066d);return _0x27505a['set'](_0x90d4('0x23'),_0x41fc0c+'-'+_0x55c290+'/'+_0x39c4d9)['json'](_0x50f0c7);}return null;};}function patchUpdates(_0x478c66){return function(_0x2def4d){try{jsonpatch[_0x90d4('0x24')](_0x2def4d,_0x478c66,!![]);}catch(_0x44d2fb){return BPromise['reject'](_0x44d2fb);}return _0x2def4d['save']();};}function saveUpdates(_0x34ed9a,_0x408c6b){return function(_0x282eda){if(_0x282eda){return _0x282eda[_0x90d4('0x25')](_0x34ed9a)[_0x90d4('0x26')](function(_0x237f3c){return _0x237f3c;});}return null;};}function removeEntity(_0x15ebb1,_0x2249ff){return function(_0x4a9dcd){if(_0x4a9dcd){return _0x4a9dcd[_0x90d4('0x27')]()[_0x90d4('0x26')](function(){var _0x3504b0=_0x4a9dcd[_0x90d4('0x28')]({'plain':!![]});var _0x3e407d='Intervals';return db[_0x90d4('0x29')][_0x90d4('0x27')]({'where':{'type':_0x3e407d,'resourceId':_0x3504b0['id']}})[_0x90d4('0x26')](function(){return _0x4a9dcd;});})[_0x90d4('0x26')](function(){_0x15ebb1[_0x90d4('0x1c')](0xcc)[_0x90d4('0x1d')]();});}};}function handleEntityNotFound(_0x1e658c,_0x7869d8){return function(_0x530620){if(!_0x530620){_0x1e658c[_0x90d4('0x1b')](0x194);}return _0x530620;};}function handleError(_0x218341,_0x40c731){_0x40c731=_0x40c731||0x1f4;return function(_0x5b4d83){logger['error'](_0x5b4d83[_0x90d4('0x2a')]);if(_0x5b4d83['name']){delete _0x5b4d83['name'];}_0x218341[_0x90d4('0x1c')](_0x40c731)[_0x90d4('0x2b')](_0x5b4d83);};}exports['index']=function(_0x14c42d,_0x32064a){var _0x305099={},_0x8a54ee={},_0x33442c={'count':0x0,'rows':[]};var _0x24732d=_[_0x90d4('0x2c')](db[_0x90d4('0x2d')]['rawAttributes'],function(_0x168275){return{'name':_0x168275['fieldName'],'type':_0x168275[_0x90d4('0x2e')][_0x90d4('0x2f')]};});_0x8a54ee[_0x90d4('0x30')]=_['map'](_0x24732d,_0x90d4('0x31'));_0x8a54ee[_0x90d4('0x32')]=_[_0x90d4('0x33')](_0x14c42d[_0x90d4('0x32')]);_0x8a54ee[_0x90d4('0x34')]=_['intersection'](_0x8a54ee[_0x90d4('0x30')],_0x8a54ee[_0x90d4('0x32')]);_0x305099[_0x90d4('0x35')]=_[_0x90d4('0x36')](_0x8a54ee['model'],qs[_0x90d4('0x37')](_0x14c42d[_0x90d4('0x32')][_0x90d4('0x37')]));_0x305099['attributes']=_0x305099[_0x90d4('0x35')]['length']?_0x305099[_0x90d4('0x35')]:_0x8a54ee[_0x90d4('0x30')];if(!_0x14c42d[_0x90d4('0x32')]['hasOwnProperty'](_0x90d4('0x38'))){_0x305099[_0x90d4('0x21')]=qs[_0x90d4('0x21')](_0x14c42d['query']['limit']);_0x305099[_0x90d4('0x1f')]=qs[_0x90d4('0x1f')](_0x14c42d[_0x90d4('0x32')][_0x90d4('0x1f')]);}_0x305099[_0x90d4('0x39')]=qs[_0x90d4('0x3a')](_0x14c42d[_0x90d4('0x32')][_0x90d4('0x3a')]);_0x305099[_0x90d4('0x3b')]=qs[_0x90d4('0x34')](_[_0x90d4('0x3c')](_0x14c42d[_0x90d4('0x32')],_0x8a54ee[_0x90d4('0x34')]),_0x24732d);if(_0x14c42d[_0x90d4('0x32')]['filter']){_0x305099[_0x90d4('0x3b')]=_['merge'](_0x305099[_0x90d4('0x3b')],{'$or':_[_0x90d4('0x2c')](_0x24732d,function(_0x5417c5){if(_0x5417c5[_0x90d4('0x2e')]!==_0x90d4('0x3d')){var _0x537189={};_0x537189[_0x5417c5[_0x90d4('0x31')]]={'$like':'%'+_0x14c42d[_0x90d4('0x32')][_0x90d4('0x3e')]+'%'};return _0x537189;}})});}_0x305099=_['merge']({},_0x305099,_0x14c42d[_0x90d4('0x3f')]);var _0x1c0d6e={'where':_0x305099['where']};return db['Interval']['count'](_0x1c0d6e)[_0x90d4('0x26')](function(_0x5240c0){_0x33442c['count']=_0x5240c0;if(_0x14c42d[_0x90d4('0x32')][_0x90d4('0x40')]){_0x305099['include']=[{'all':!![]}];}return db[_0x90d4('0x2d')][_0x90d4('0x41')](_0x305099);})[_0x90d4('0x26')](function(_0x133f99){_0x33442c[_0x90d4('0x42')]=_0x133f99;return _0x33442c;})['then'](respondWithFilteredResult(_0x32064a,_0x305099))[_0x90d4('0x43')](handleError(_0x32064a,null));};exports[_0x90d4('0x44')]=function(_0x14721f,_0x5bf76d){var _0x17d677={'raw':!![],'where':{'id':_0x14721f['params']['id']}},_0x2c9820={};_0x2c9820['model']=_[_0x90d4('0x33')](db[_0x90d4('0x2d')][_0x90d4('0x45')]);_0x2c9820['query']=_['keys'](_0x14721f[_0x90d4('0x32')]);_0x2c9820[_0x90d4('0x34')]=_[_0x90d4('0x36')](_0x2c9820[_0x90d4('0x30')],_0x2c9820[_0x90d4('0x32')]);_0x17d677[_0x90d4('0x35')]=_[_0x90d4('0x36')](_0x2c9820['model'],qs['fields'](_0x14721f[_0x90d4('0x32')][_0x90d4('0x37')]));_0x17d677['attributes']=_0x17d677['attributes']['length']?_0x17d677[_0x90d4('0x35')]:_0x2c9820[_0x90d4('0x30')];if(_0x14721f[_0x90d4('0x32')][_0x90d4('0x40')]){_0x17d677[_0x90d4('0x46')]=[{'all':!![]}];}_0x17d677=_[_0x90d4('0x47')]({},_0x17d677,_0x14721f[_0x90d4('0x3f')]);return db[_0x90d4('0x2d')]['find'](_0x17d677)['then'](handleEntityNotFound(_0x5bf76d,null))[_0x90d4('0x26')](respondWithResult(_0x5bf76d,null))['catch'](handleError(_0x5bf76d,null));};exports['create']=function(_0x1b9a72,_0x2671bf){return db[_0x90d4('0x2d')][_0x90d4('0x48')](_0x1b9a72[_0x90d4('0x49')],{})[_0x90d4('0x26')](function(_0x4bfd59){var _0x29cf48=_0x1b9a72['user']['get']({'plain':!![]});if(!_0x29cf48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29cf48[_0x90d4('0x4a')]==='user'){var _0x4aac19=_0x4bfd59[_0x90d4('0x28')]({'plain':!![]});var _0x1565b2=_0x90d4('0x4b');return db['UserProfileSection'][_0x90d4('0x4c')]({'where':{'name':_0x1565b2,'userProfileId':_0x29cf48[_0x90d4('0x4d')]},'raw':!![]})['then'](function(_0x3135a2){if(_0x3135a2&&_0x3135a2[_0x90d4('0x4e')]===0x0){return db[_0x90d4('0x29')][_0x90d4('0x48')]({'name':_0x4aac19[_0x90d4('0x31')],'resourceId':_0x4aac19['id'],'type':_0x3135a2['name'],'sectionId':_0x3135a2['id']},{})['then'](function(){return _0x4bfd59;});}else{return _0x4bfd59;}})[_0x90d4('0x43')](function(_0x6938f1){logger[_0x90d4('0x4f')](_0x90d4('0x50'),_0x6938f1);throw _0x6938f1;});}return _0x4bfd59;})[_0x90d4('0x26')](respondWithResult(_0x2671bf,0xc9))[_0x90d4('0x43')](handleError(_0x2671bf,null));};exports[_0x90d4('0x25')]=function(_0x570f24,_0x4e963c){if(_0x570f24[_0x90d4('0x49')]['id']){delete _0x570f24[_0x90d4('0x49')]['id'];}return db['Interval'][_0x90d4('0x4c')]({'where':{'id':_0x570f24[_0x90d4('0x51')]['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x4e963c,null))[_0x90d4('0x26')](saveUpdates(_0x570f24[_0x90d4('0x49')],null))[_0x90d4('0x26')](respondWithResult(_0x4e963c,null))[_0x90d4('0x43')](handleError(_0x4e963c,null));};exports[_0x90d4('0x27')]=function(_0x46745a,_0x4b3287){return db['Interval'][_0x90d4('0x4c')]({'where':{'id':_0x46745a[_0x90d4('0x51')]['id']}})['then'](handleEntityNotFound(_0x4b3287,null))[_0x90d4('0x26')](removeEntity(_0x4b3287,null))[_0x90d4('0x43')](handleError(_0x4b3287,null));};exports[_0x90d4('0x52')]=function(_0x3bc1a4,_0x14d510,_0x1953c1){if(_0x3bc1a4['body']['id']){delete _0x3bc1a4[_0x90d4('0x49')]['id'];}return db[_0x90d4('0x2d')][_0x90d4('0x4c')]({'where':{'id':_0x3bc1a4['params']['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x14d510,null))[_0x90d4('0x26')](function(_0x242623){if(_0x242623){_0x3bc1a4[_0x90d4('0x49')][_0x90d4('0x53')]=_0x242623['id'];return db[_0x90d4('0x2d')][_0x90d4('0x48')](_0x3bc1a4[_0x90d4('0x49')]);}})[_0x90d4('0x26')](respondWithResult(_0x14d510,null))[_0x90d4('0x43')](handleError(_0x14d510,null));};exports[_0x90d4('0x54')]=function(_0x288eef,_0x1743d6,_0x4054b0){var _0x50cae6={};var _0x54c383={};var _0x8d4eac;var _0x85ad27;return db['Interval'][_0x90d4('0x55')]({'where':{'id':_0x288eef[_0x90d4('0x51')]['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x1743d6,null))['then'](function(_0x3b7f5c){if(_0x3b7f5c){_0x8d4eac=_0x3b7f5c;_0x54c383['model']=_[_0x90d4('0x33')](db[_0x90d4('0x2d')][_0x90d4('0x45')]);_0x54c383[_0x90d4('0x32')]=_[_0x90d4('0x33')](_0x288eef[_0x90d4('0x32')]);_0x54c383[_0x90d4('0x34')]=_[_0x90d4('0x36')](_0x54c383[_0x90d4('0x30')],_0x54c383[_0x90d4('0x32')]);_0x50cae6[_0x90d4('0x35')]=_[_0x90d4('0x36')](_0x54c383[_0x90d4('0x30')],qs[_0x90d4('0x37')](_0x288eef[_0x90d4('0x32')]['fields']));_0x50cae6[_0x90d4('0x35')]=_0x50cae6[_0x90d4('0x35')][_0x90d4('0x56')]?_0x50cae6[_0x90d4('0x35')]:_0x54c383[_0x90d4('0x30')];_0x50cae6[_0x90d4('0x39')]=qs[_0x90d4('0x3a')](_0x288eef[_0x90d4('0x32')][_0x90d4('0x3a')]);_0x50cae6['where']=qs[_0x90d4('0x34')](_[_0x90d4('0x3c')](_0x288eef[_0x90d4('0x32')],_0x54c383['filters']));if(_0x288eef[_0x90d4('0x32')][_0x90d4('0x3e')]){_0x50cae6['where']=_[_0x90d4('0x47')](_0x50cae6[_0x90d4('0x3b')],{'$or':_[_0x90d4('0x2c')](_0x50cae6[_0x90d4('0x35')],function(_0x31b0a8){var _0x6584d1={};_0x6584d1[_0x31b0a8]={'$like':'%'+_0x288eef[_0x90d4('0x32')][_0x90d4('0x3e')]+'%'};return _0x6584d1;})});}_0x50cae6=_[_0x90d4('0x47')]({},_0x50cae6,_0x288eef[_0x90d4('0x3f')]);return _0x8d4eac[_0x90d4('0x54')](_0x50cae6);}})['then'](function(_0xed940b){if(_0xed940b){_0x85ad27=_0xed940b[_0x90d4('0x56')];if(!_0x288eef[_0x90d4('0x32')][_0x90d4('0x57')]('nolimit')){_0x50cae6[_0x90d4('0x21')]=qs[_0x90d4('0x21')](_0x288eef[_0x90d4('0x32')][_0x90d4('0x21')]);_0x50cae6[_0x90d4('0x1f')]=qs['offset'](_0x288eef['query'][_0x90d4('0x1f')]);}return _0x8d4eac['getIntervals'](_0x50cae6);}})[_0x90d4('0x26')](function(_0x2729d5){if(_0x2729d5){return _0x2729d5?{'count':_0x85ad27,'rows':_0x2729d5}:null;}})['then'](respondWithResult(_0x1743d6,null))[_0x90d4('0x43')](handleError(_0x1743d6,null));};exports[_0x90d4('0x58')]=function(_0x3e12c2,_0x380319,_0x874e1d){return db[_0x90d4('0x2d')][_0x90d4('0x55')]({'where':{'id':_0x3e12c2['params']['id']}})[_0x90d4('0x26')](handleEntityNotFound(_0x380319,null))[_0x90d4('0x26')](function(_0x5da185){if(_0x5da185){return db[_0x90d4('0x59')][_0x90d4('0x5a')](function(_0x24c73){return db['Interval'][_0x90d4('0x27')]({'where':{'IntervalId':_0x3e12c2['params']['id']},'transaction':_0x24c73})[_0x90d4('0x26')](function(_0x117147){var _0x530451=_[_0x90d4('0x2c')](_0x3e12c2['body'],function(_0x38fc4f){delete _0x38fc4f['id'];_0x38fc4f[_0x90d4('0x53')]=_0x3e12c2[_0x90d4('0x51')]['id'];return _0x38fc4f;});return db[_0x90d4('0x2d')][_0x90d4('0x5b')](_0x530451,{'transaction':_0x24c73});});})[_0x90d4('0x26')](function(){return db['Interval'][_0x90d4('0x41')]({'where':{'IntervalId':_0x3e12c2['params']['id']}});});}})[_0x90d4('0x26')](respondWithResult(_0x380319,null))[_0x90d4('0x43')](handleError(_0x380319,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 007eaa9..34b7782 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 _0x10ea=['iftime','exports','define','rewrite','interval','getIntervals','then','map','ifTime','./interval.attributes','../../utils/iftime'];(function(_0x191413,_0x193c45){var _0x3fcfdb=function(_0x115398){while(--_0x115398){_0x191413['push'](_0x191413['shift']());}};_0x3fcfdb(++_0x193c45);}(_0x10ea,0x132));var _0xa10e=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x10ea[_0x4f8f3b];return _0x4c250c;};'use strict';var attributes=require(_0xa10e('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xa10e('0x1'))[_0xa10e('0x2')];module[_0xa10e('0x3')]=function(_0x23285b){return _0x23285b[_0xa10e('0x4')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xec512e){extensions[_0xa10e('0x5')](_0x23285b,_0xec512e);},'afterBulkCreate':function(_0x56348f,_0x19b436,_0x5617cf){_0x5617cf();extensions[_0xa10e('0x5')](_0x23285b,_0x56348f[0x0]);},'afterUpdate':function(_0x312bb2){extensions[_0xa10e('0x5')](_0x23285b,_0x312bb2);},'afterDestroy':function(_0x27c340){extensions[_0xa10e('0x5')](_0x23285b,_0x27c340);}},'instanceMethods':{'ifTime':function(_0x325412=undefined,_0x147a95=new Date()){if(typeof this[_0xa10e('0x6')]==='string'){return iftime(this['interval'],_0x325412,_0x147a95);}else{return this[_0xa10e('0x7')]()[_0xa10e('0x8')](function(_0x4caa91){return Promise['all'](_0x4caa91[_0xa10e('0x9')](function(_0x4279f2){return _0x4279f2[_0xa10e('0xa')](_0x325412,_0x147a95);}));})[_0xa10e('0x8')](function(_0x54579e){return _0x54579e['reduce'](function(_0x31f181,_0x5203db){return _0x31f181||_0x5203db;},![]);});}}}});}; \ No newline at end of file +var _0x7ed2=['./interval.attributes','../../components/extensions/rewrite','iftime','exports','define','Interval','rewrite','interval','getIntervals','all','ifTime','reduce'];(function(_0xaf5471,_0x2b651c){var _0x5c4f41=function(_0x174f7f){while(--_0x174f7f){_0xaf5471['push'](_0xaf5471['shift']());}};_0x5c4f41(++_0x2b651c);}(_0x7ed2,0xb4));var _0x27ed=function(_0x100f69,_0x45a456){_0x100f69=_0x100f69-0x0;var _0x39d8c6=_0x7ed2[_0x100f69];return _0x39d8c6;};'use strict';var attributes=require(_0x27ed('0x0'));var extensions=require(_0x27ed('0x1'));var iftime=require('../../utils/iftime')[_0x27ed('0x2')];module[_0x27ed('0x3')]=function(_0x19b0fe){return _0x19b0fe[_0x27ed('0x4')](_0x27ed('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45fe25){extensions[_0x27ed('0x6')](_0x19b0fe,_0x45fe25);},'afterBulkCreate':function(_0x250fef,_0x40c9f9,_0x3f749e){_0x3f749e();extensions[_0x27ed('0x6')](_0x19b0fe,_0x250fef[0x0]);},'afterUpdate':function(_0x1cc0c7){extensions[_0x27ed('0x6')](_0x19b0fe,_0x1cc0c7);},'afterDestroy':function(_0x1467ec){extensions[_0x27ed('0x6')](_0x19b0fe,_0x1467ec);}},'instanceMethods':{'ifTime':function(_0x1efbad=undefined,_0x11ca95=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x27ed('0x7')],_0x1efbad,_0x11ca95);}else{return this[_0x27ed('0x8')]()['then'](function(_0x4a781e){return Promise[_0x27ed('0x9')](_0x4a781e['map'](function(_0x562ba4){return _0x562ba4[_0x27ed('0xa')](_0x1efbad,_0x11ca95);}));})['then'](function(_0x440db9){return _0x440db9[_0x27ed('0xb')](function(_0x2aa339,_0x49175c){return _0x2aa339||_0x49175c;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e1e5697..de1c050 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 _0x808f=['resolve','reduce','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','limit','include','model','attributes','map','then','info','debug','stringify','error','message','ShowInterval','catch','ifTime','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly'];(function(_0x549fb0,_0x39f4f7){var _0x35a436=function(_0x4fecd2){while(--_0x4fecd2){_0x549fb0['push'](_0x549fb0['shift']());}};_0x35a436(++_0x39f4f7);}(_0x808f,0x161));var _0xf808=function(_0x2b7e60,_0x4ad15d){_0x2b7e60=_0x2b7e60-0x0;var _0x5d6165=_0x808f[_0x2b7e60];return _0x5d6165;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0xf808('0x0'))['db'];var iftime=require(_0xf808('0x1'))['iftime'];var logger=require(_0xf808('0x2'))(_0xf808('0x3'));exports[_0xf808('0x4')]=function(_0x55e524){var _0x2c4895=this;return new Promise(function(_0x4a28e4,_0x5d7002){return db[_0xf808('0x5')][_0xf808('0x6')]({'raw':_0x55e524[_0xf808('0x7')]?_0x55e524[_0xf808('0x7')][_0xf808('0x8')]===undefined?!![]:![]:!![],'where':_0x55e524[_0xf808('0x7')]?_0x55e524[_0xf808('0x7')][_0xf808('0x9')]||null:null,'attributes':_0x55e524[_0xf808('0x7')]?_0x55e524['options']['attributes']||null:null,'limit':_0x55e524[_0xf808('0x7')]?_0x55e524['options'][_0xf808('0xa')]||null:null,'include':_0x55e524['options']?_0x55e524['options'][_0xf808('0xb')]?_['map'](_0x55e524[_0xf808('0x7')]['include'],function(_0x18e8d0){return{'model':db[_0x18e8d0[_0xf808('0xc')]],'as':_0x18e8d0['as'],'attributes':_0x18e8d0[_0xf808('0xd')],'include':_0x18e8d0['include']?_[_0xf808('0xe')](_0x18e8d0[_0xf808('0xb')],function(_0x3546f5){return{'model':db[_0x3546f5[_0xf808('0xc')]],'as':_0x3546f5['as'],'attributes':_0x3546f5[_0xf808('0xd')],'include':_0x3546f5[_0xf808('0xb')]?_[_0xf808('0xe')](_0x3546f5[_0xf808('0xb')],function(_0x1e3d77){return{'model':db[_0x1e3d77['model']],'as':_0x1e3d77['as'],'attributes':_0x1e3d77[_0xf808('0xd')]};}):[]};}):[]};}):[]:[]})[_0xf808('0xf')](function(_0x584877){logger[_0xf808('0x10')](_0xf808('0x4'),_0x55e524);logger[_0xf808('0x11')](_0xf808('0x4'),_0x55e524,JSON[_0xf808('0x12')](_0x584877));_0x4a28e4(_0x584877);})['catch'](function(_0x10b33e){logger[_0xf808('0x13')](_0xf808('0x4'),_0x10b33e[_0xf808('0x14')],_0x55e524);_0x5d7002(_0x2c4895[_0xf808('0x13')](0x1f4,_0x10b33e[_0xf808('0x14')]));});});};exports[_0xf808('0x15')]=function(_0x409698){var _0x42a2aa=this;return new Promise(function(_0x380f0d,_0x489a0e){return db[_0xf808('0x5')]['find']({'raw':_0x409698['options']?_0x409698[_0xf808('0x7')][_0xf808('0x8')]===undefined?!![]:![]:!![],'where':_0x409698[_0xf808('0x7')]?_0x409698[_0xf808('0x7')][_0xf808('0x9')]||null:null,'attributes':_0x409698['options']?_0x409698['options'][_0xf808('0xd')]||null:null,'include':_0x409698[_0xf808('0x7')]?_0x409698[_0xf808('0x7')]['include']?_[_0xf808('0xe')](_0x409698[_0xf808('0x7')][_0xf808('0xb')],function(_0x4426a5){return{'model':db[_0x4426a5[_0xf808('0xc')]],'as':_0x4426a5['as'],'attributes':_0x4426a5[_0xf808('0xd')],'include':_0x4426a5[_0xf808('0xb')]?_[_0xf808('0xe')](_0x4426a5['include'],function(_0x2be5e8){return{'model':db[_0x2be5e8['model']],'as':_0x2be5e8['as'],'attributes':_0x2be5e8[_0xf808('0xd')],'include':_0x2be5e8['include']?_[_0xf808('0xe')](_0x2be5e8[_0xf808('0xb')],function(_0x360c10){return{'model':db[_0x360c10['model']],'as':_0x360c10['as'],'attributes':_0x360c10['attributes']};}):[]};}):[]};}):[]:[]})[_0xf808('0xf')](function(_0x2f8431){logger['info'](_0xf808('0x15'),_0x409698);logger[_0xf808('0x11')]('ShowInterval',_0x409698,JSON[_0xf808('0x12')](_0x2f8431));_0x380f0d(_0x2f8431);})[_0xf808('0x16')](function(_0x15d387){logger['error'](_0xf808('0x15'),_0x15d387[_0xf808('0x14')],_0x409698);_0x489a0e(_0x42a2aa[_0xf808('0x13')](0x1f4,_0x15d387[_0xf808('0x14')]));});});};function checkArrayOfIntervals(_0x59b324,_0x5d0cc8){var _0x58c7ac=[];return db[_0xf808('0x5')][_0xf808('0x6')]({'where':{'id':_0x59b324}})[_0xf808('0xf')](function(_0x4eba85){_0x58c7ac=_0x4eba85;return Promise['all'](_0x58c7ac['map'](function(_0x36d5f5){return _0x36d5f5[_0xf808('0x17')](_0x5d0cc8);}));})[_0xf808('0xf')](function(_0x592247){var _0x17cef2=_0x592247['reduce'](function(_0x2801b0,_0x5e547a){return _0x2801b0||_0x5e547a;},![]);logger['info'](util[_0xf808('0x18')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x58c7ac[_0xf808('0xe')](function(_0x344b2e){return _0x344b2e[_0xf808('0x19')];})[_0xf808('0x1a')](',\x20'),_0x58c7ac[_0xf808('0xe')](function(_0xd9255f){return _0xd9255f['id'];})[_0xf808('0x1a')](',\x20')));return _0x17cef2;});}function checkSingleInterval(_0x48d3dd,_0x38e28a){return db[_0xf808('0x5')][_0xf808('0x1b')](_0x48d3dd)[_0xf808('0xf')](function(_0x386612){if(_0x386612){logger[_0xf808('0x10')](util[_0xf808('0x18')](_0xf808('0x1c'),_0x386612[_0xf808('0x19')],_0x386612['id']));return _0x386612[_0xf808('0x17')](_0x38e28a);}});}exports[_0xf808('0x1d')]=function(_0x526680){var _0x444fb9=_0x526680[_0xf808('0x1e')];var _0x1ed19d=Array['isArray'](_0x526680['intervals'])?_0x526680[_0xf808('0x1f')]:typeof _0x526680[_0xf808('0x1f')]===_0xf808('0x20')?[_0x526680[_0xf808('0x1f')]]:[];var _0xb58be0=_0x526680['timezone']||undefined;var _0xd55c6b=![];if(_0x1ed19d[_0xf808('0x21')]){logger[_0xf808('0x10')](util['format'](_0xf808('0x22'),_0x1ed19d[_0xf808('0x1a')](';\x20')));}if(_0xb58be0){logger[_0xf808('0x10')](util[_0xf808('0x18')]('IntervalIftime:\x20timezone\x20=\x20%s',_0xb58be0));}logger[_0xf808('0x11')](_0xf808('0x23'),_0xd55c6b);logger[_0xf808('0x24')](_0xf808('0x1d'),_0x526680);return Promise[_0xf808('0x25')]()[_0xf808('0xf')](function(){if(Array['isArray'](_0x444fb9)){return checkArrayOfIntervals(_0x444fb9,_0xb58be0);}else if(_0x444fb9){return checkSingleInterval(_0x444fb9,_0xb58be0);}})[_0xf808('0xf')](function(_0x48cffd){var _0xcb1089=_0x1ed19d[_0xf808('0x26')](function(_0x5bb73b,_0x227ca2){return _0x5bb73b||iftime(_0x227ca2,_0xb58be0);},![]);_0xd55c6b=_0x48cffd||_0xcb1089;return _0xd55c6b;})[_0xf808('0x16')](function(_0x3e58a0){logger[_0xf808('0x13')](_0xf808('0x1d'),_0x526680,_0x3e58a0);throw this['error'](0x1f4,_0x3e58a0['message']);});}; \ No newline at end of file +var _0x825d=['message','ShowInterval','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','raw','options','where','attributes','limit','include','map','model','then','info','debug','catch','error'];(function(_0x500271,_0x304e32){var _0x4e3f69=function(_0x271391){while(--_0x271391){_0x500271['push'](_0x500271['shift']());}};_0x4e3f69(++_0x304e32);}(_0x825d,0x6e));var _0xd825=function(_0x5cd89b,_0x81d7ee){_0x5cd89b=_0x5cd89b-0x0;var _0x4d7e28=_0x825d[_0x5cd89b];return _0x4d7e28;};'use strict';var _=require(_0xd825('0x0'));var util=require(_0xd825('0x1'));var db=require(_0xd825('0x2'))['db'];var iftime=require(_0xd825('0x3'))[_0xd825('0x4')];var logger=require('../../config/logger')(_0xd825('0x5'));exports[_0xd825('0x6')]=function(_0x248c10){var _0x395b70=this;return new Promise(function(_0xce217,_0x1a28c2){return db[_0xd825('0x7')][_0xd825('0x8')]({'raw':_0x248c10['options']?_0x248c10['options'][_0xd825('0x9')]===undefined?!![]:![]:!![],'where':_0x248c10[_0xd825('0xa')]?_0x248c10['options'][_0xd825('0xb')]||null:null,'attributes':_0x248c10['options']?_0x248c10[_0xd825('0xa')][_0xd825('0xc')]||null:null,'limit':_0x248c10[_0xd825('0xa')]?_0x248c10['options'][_0xd825('0xd')]||null:null,'include':_0x248c10[_0xd825('0xa')]?_0x248c10[_0xd825('0xa')][_0xd825('0xe')]?_[_0xd825('0xf')](_0x248c10[_0xd825('0xa')]['include'],function(_0x33099e){return{'model':db[_0x33099e['model']],'as':_0x33099e['as'],'attributes':_0x33099e['attributes'],'include':_0x33099e[_0xd825('0xe')]?_[_0xd825('0xf')](_0x33099e[_0xd825('0xe')],function(_0x5dbb9c){return{'model':db[_0x5dbb9c[_0xd825('0x10')]],'as':_0x5dbb9c['as'],'attributes':_0x5dbb9c[_0xd825('0xc')],'include':_0x5dbb9c[_0xd825('0xe')]?_[_0xd825('0xf')](_0x5dbb9c[_0xd825('0xe')],function(_0x101f79){return{'model':db[_0x101f79[_0xd825('0x10')]],'as':_0x101f79['as'],'attributes':_0x101f79[_0xd825('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd825('0x11')](function(_0x46220b){logger[_0xd825('0x12')](_0xd825('0x6'),_0x248c10);logger[_0xd825('0x13')](_0xd825('0x6'),_0x248c10,JSON['stringify'](_0x46220b));_0xce217(_0x46220b);})[_0xd825('0x14')](function(_0x3f487f){logger[_0xd825('0x15')]('GetInterval',_0x3f487f['message'],_0x248c10);_0x1a28c2(_0x395b70['error'](0x1f4,_0x3f487f[_0xd825('0x16')]));});});};exports[_0xd825('0x17')]=function(_0x20c1a5){var _0x2721e6=this;return new Promise(function(_0x405e1e,_0x497286){return db[_0xd825('0x7')]['find']({'raw':_0x20c1a5['options']?_0x20c1a5[_0xd825('0xa')][_0xd825('0x9')]===undefined?!![]:![]:!![],'where':_0x20c1a5[_0xd825('0xa')]?_0x20c1a5[_0xd825('0xa')][_0xd825('0xb')]||null:null,'attributes':_0x20c1a5[_0xd825('0xa')]?_0x20c1a5[_0xd825('0xa')][_0xd825('0xc')]||null:null,'include':_0x20c1a5[_0xd825('0xa')]?_0x20c1a5[_0xd825('0xa')][_0xd825('0xe')]?_[_0xd825('0xf')](_0x20c1a5[_0xd825('0xa')]['include'],function(_0xa5f823){return{'model':db[_0xa5f823[_0xd825('0x10')]],'as':_0xa5f823['as'],'attributes':_0xa5f823[_0xd825('0xc')],'include':_0xa5f823['include']?_[_0xd825('0xf')](_0xa5f823[_0xd825('0xe')],function(_0x27505a){return{'model':db[_0x27505a[_0xd825('0x10')]],'as':_0x27505a['as'],'attributes':_0x27505a[_0xd825('0xc')],'include':_0x27505a[_0xd825('0xe')]?_['map'](_0x27505a[_0xd825('0xe')],function(_0xe39061){return{'model':db[_0xe39061[_0xd825('0x10')]],'as':_0xe39061['as'],'attributes':_0xe39061[_0xd825('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd825('0x11')](function(_0x594af6){logger[_0xd825('0x12')](_0xd825('0x17'),_0x20c1a5);logger['debug']('ShowInterval',_0x20c1a5,JSON['stringify'](_0x594af6));_0x405e1e(_0x594af6);})[_0xd825('0x14')](function(_0x4b55f2){logger[_0xd825('0x15')](_0xd825('0x17'),_0x4b55f2[_0xd825('0x16')],_0x20c1a5);_0x497286(_0x2721e6[_0xd825('0x15')](0x1f4,_0x4b55f2[_0xd825('0x16')]));});});};function checkArrayOfIntervals(_0x3ab324,_0x5a5d20){var _0xca98a=[];return db[_0xd825('0x7')][_0xd825('0x8')]({'where':{'id':_0x3ab324}})[_0xd825('0x11')](function(_0x483e7e){_0xca98a=_0x483e7e;return Promise['all'](_0xca98a[_0xd825('0xf')](function(_0x598972){return _0x598972['ifTime'](_0x5a5d20);}));})['then'](function(_0x23941a){var _0x3652f3=_0x23941a[_0xd825('0x18')](function(_0x126a3d,_0xd59395){return _0x126a3d||_0xd59395;},![]);logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x1a'),_0xca98a['map'](function(_0x3b75b9){return _0x3b75b9[_0xd825('0x1b')];})[_0xd825('0x1c')](',\x20'),_0xca98a['map'](function(_0x508a55){return _0x508a55['id'];})[_0xd825('0x1c')](',\x20')));return _0x3652f3;});}function checkSingleInterval(_0x373afe,_0x4c5a5f){return db[_0xd825('0x7')][_0xd825('0x1d')](_0x373afe)[_0xd825('0x11')](function(_0x1524b9){if(_0x1524b9){logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x1e'),_0x1524b9[_0xd825('0x1b')],_0x1524b9['id']));return _0x1524b9[_0xd825('0x1f')](_0x4c5a5f);}});}exports[_0xd825('0x20')]=function(_0x565733){var _0x1cc380=_0x565733[_0xd825('0x21')];var _0x2b9a1f=Array[_0xd825('0x22')](_0x565733[_0xd825('0x23')])?_0x565733[_0xd825('0x23')]:typeof _0x565733[_0xd825('0x23')]===_0xd825('0x24')?[_0x565733[_0xd825('0x23')]]:[];var _0x31ae7d=_0x565733[_0xd825('0x25')]||undefined;var _0x168973=![];if(_0x2b9a1f[_0xd825('0x26')]){logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x27'),_0x2b9a1f[_0xd825('0x1c')](';\x20')));}if(_0x31ae7d){logger[_0xd825('0x12')](util[_0xd825('0x19')](_0xd825('0x28'),_0x31ae7d));}logger[_0xd825('0x13')](_0xd825('0x29'),_0x168973);logger[_0xd825('0x2a')](_0xd825('0x20'),_0x565733);return Promise[_0xd825('0x2b')]()[_0xd825('0x11')](function(){if(Array['isArray'](_0x1cc380)){return checkArrayOfIntervals(_0x1cc380,_0x31ae7d);}else if(_0x1cc380){return checkSingleInterval(_0x1cc380,_0x31ae7d);}})[_0xd825('0x11')](function(_0x20a91b){var _0x5c55d7=_0x2b9a1f[_0xd825('0x18')](function(_0x182d24,_0x445c6b){return _0x182d24||iftime(_0x445c6b,_0x31ae7d);},![]);_0x168973=_0x20a91b||_0x5c55d7;return _0x168973;})[_0xd825('0x14')](function(_0x517ac6){logger[_0xd825('0x15')](_0xd825('0x20'),_0x565733,_0x517ac6);throw this[_0xd825('0x15')](0x1f4,_0x517ac6[_0xd825('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d8c9f04..4633597 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x2a23dd,_0x49f0fa){var _0x5f241b=function(_0x21b6bf){while(--_0x21b6bf){_0x2a23dd['push'](_0x2a23dd['shift']());}};_0x5f241b(++_0x49f0fa);}(_0x2ef3,0xba));var _0x32ef=function(_0x25b250,_0x3fea32){_0x25b250=_0x25b250-0x0;var _0x1c2adb=_0x2ef3[_0x25b250];return _0x1c2adb;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x56211e,_0x44c624){var _0x2bf60b=function(_0x430523){while(--_0x430523){_0x56211e['push'](_0x56211e['shift']());}};_0x2bf60b(++_0x44c624);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e0eb5,_0x482f77){_0x2e0eb5=_0x2e0eb5-0x0;var _0x20571c=_0x2ef3[_0x2e0eb5];return _0x20571c;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a7da81b..ff4968c 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 _0x0e74=['description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','utf8','data','end','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0e74,0xeb));var _0x40e7=function(_0x386fd2,_0x4c929e){_0x386fd2=_0x386fd2-0x0;var _0x3ce545=_0x0e74[_0x386fd2];return _0x3ce545;};'use strict';var BPromise=require(_0x40e7('0x0'));var https=require(_0x40e7('0x1'));var logger=require(_0x40e7('0x2'))(_0x40e7('0x3'));var USERNAME=_0x40e7('0x4');var PASSWORD=_0x40e7('0x5');function openIssue(_0x4dc967,_0x32f18f){var _0x128488={'fields':{'project':{'key':_0x4dc967[_0x40e7('0x6')]||_0x40e7('0x7')},'summary':(_0x4dc967[_0x40e7('0x8')]||'Report')+_0x40e7('0x9')+_0x4dc967['ip'],'description':_0x4dc967[_0x40e7('0xa')]||JSON[_0x40e7('0xb')](_0x4dc967),'issuetype':{'name':_0x4dc967['issuetype']||_0x40e7('0xc')}}};_0x128488[_0x40e7('0xd')][_0x40e7('0xe')]=_0x4dc967[_0x40e7('0xf')];_0x128488[_0x40e7('0xd')][_0x40e7('0x10')]=_0x4dc967[_0x40e7('0x11')];_0x128488[_0x40e7('0xd')][_0x40e7('0x12')]=_0x4dc967[_0x40e7('0x13')];_0x128488[_0x40e7('0xd')][_0x40e7('0x14')]=_0x4dc967[_0x40e7('0x15')];_0x128488[_0x40e7('0xd')][_0x40e7('0x16')]=_0x4dc967[_0x40e7('0x17')];_0x128488['fields'][_0x40e7('0x18')]=_0x4dc967['ip'];var _0x186823={'host':_0x40e7('0x19'),'port':0x1bb,'path':_0x40e7('0x1a'),'method':_0x40e7('0x1b'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x40e7('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0x40e7('0x1d')](_0x40e7('0x1e'))}};var _0x18f8c3=JSON[_0x40e7('0xb')](_0x128488);var _0x564aec=https[_0x40e7('0x1f')](_0x186823,function(_0xce3c01){_0xce3c01['setEncoding'](_0x40e7('0x20'));var _0x271e73='';_0xce3c01['on'](_0x40e7('0x21'),function(_0x33058b){_0x271e73+=_0x33058b;});_0xce3c01['on'](_0x40e7('0x22'),function(){if(_0x32f18f){return _0x32f18f['status'](_0xce3c01[_0x40e7('0x23')])[_0x40e7('0x24')](JSON[_0x40e7('0x25')](_0x271e73));}});});_0x564aec['on'](_0x40e7('0x26'),function(_0x1af0e9){if(_0x32f18f){return _0x32f18f[_0x40e7('0x27')](0x1f4)[_0x40e7('0x24')]({'errors':[{'message':_0x40e7('0x28'),'type':_0x40e7('0x29')}]});}});_0x564aec[_0x40e7('0x2a')](_0x18f8c3);_0x564aec[_0x40e7('0x22')]();}exports[_0x40e7('0x2b')]=openIssue;exports['send']=function(_0x5f5069,_0x331b47){_0x5f5069[_0x40e7('0x2c')]['ip']=_0x5f5069['headers'][_0x40e7('0x2d')]||_0x5f5069[_0x40e7('0x2e')]['remoteAddress']||_0x5f5069['socket'][_0x40e7('0x2f')]||_0x5f5069[_0x40e7('0x2e')][_0x40e7('0x30')][_0x40e7('0x2f')];return openIssue(_0x5f5069[_0x40e7('0x2c')],_0x331b47);}; \ No newline at end of file +var _0xb45c=['\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','newToken','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','stringify','request','utf8','data','end','json','error','status','api.jira','write','send','body','headers','connection','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb45c,0x10f));var _0xcb45=function(_0x5d271,_0x11a533){_0x5d271=_0x5d271-0x0;var _0x4ceab8=_0xb45c[_0x5d271];return _0x4ceab8;};'use strict';var BPromise=require(_0xcb45('0x0'));var https=require(_0xcb45('0x1'));var logger=require(_0xcb45('0x2'))(_0xcb45('0x3'));var USERNAME=_0xcb45('0x4');var PASSWORD=_0xcb45('0x5');function openIssue(_0x46e3f5,_0x12c149){var _0x21f355={'fields':{'project':{'key':_0x46e3f5[_0xcb45('0x6')]||_0xcb45('0x7')},'summary':(_0x46e3f5['summary']||_0xcb45('0x8'))+_0xcb45('0x9')+_0x46e3f5['ip'],'description':_0x46e3f5[_0xcb45('0xa')]||JSON['stringify'](_0x46e3f5),'issuetype':{'name':_0x46e3f5[_0xcb45('0xb')]||_0xcb45('0xc')}}};_0x21f355[_0xcb45('0xd')][_0xcb45('0xe')]=_0x46e3f5[_0xcb45('0xf')];_0x21f355[_0xcb45('0xd')]['customfield_11501']=_0x46e3f5['oldToken'];_0x21f355[_0xcb45('0xd')]['customfield_11502']=_0x46e3f5[_0xcb45('0x10')];_0x21f355[_0xcb45('0xd')]['customfield_11503']=_0x46e3f5[_0xcb45('0x11')];_0x21f355[_0xcb45('0xd')]['customfield_11504']=_0x46e3f5[_0xcb45('0x12')];_0x21f355[_0xcb45('0xd')]['customfield_10102']=_0x46e3f5['ip'];var _0x21d1cd={'host':_0xcb45('0x13'),'port':0x1bb,'path':_0xcb45('0x14'),'method':_0xcb45('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xcb45('0x16'),'Authorization':_0xcb45('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xcb45('0x18')]('base64')}};var _0x2f5a0f=JSON[_0xcb45('0x19')](_0x21f355);var _0x158b9e=https[_0xcb45('0x1a')](_0x21d1cd,function(_0x3bbd29){_0x3bbd29['setEncoding'](_0xcb45('0x1b'));var _0x44e9b1='';_0x3bbd29['on'](_0xcb45('0x1c'),function(_0x2cc57b){_0x44e9b1+=_0x2cc57b;});_0x3bbd29['on'](_0xcb45('0x1d'),function(){if(_0x12c149){return _0x12c149['status'](_0x3bbd29['statusCode'])[_0xcb45('0x1e')](JSON['parse'](_0x44e9b1));}});});_0x158b9e['on'](_0xcb45('0x1f'),function(_0x3e7fa1){if(_0x12c149){return _0x12c149[_0xcb45('0x20')](0x1f4)[_0xcb45('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xcb45('0x21')}]});}});_0x158b9e[_0xcb45('0x22')](_0x2f5a0f);_0x158b9e[_0xcb45('0x1d')]();}exports['openIssue']=openIssue;exports[_0xcb45('0x23')]=function(_0x4c6e1e,_0x37f245){_0x4c6e1e[_0xcb45('0x24')]['ip']=_0x4c6e1e[_0xcb45('0x25')]['x-forwarded-for']||_0x4c6e1e[_0xcb45('0x26')][_0xcb45('0x27')]||_0x4c6e1e['socket'][_0xcb45('0x27')]||_0x4c6e1e[_0xcb45('0x26')]['socket'][_0xcb45('0x27')];return openIssue(_0x4c6e1e[_0xcb45('0x24')],_0x37f245);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0cd8b72..4199245 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x49ffb4,_0x5150b6){var _0x16259e=function(_0xbcc7b3){while(--_0xbcc7b3){_0x49ffb4['push'](_0x49ffb4['shift']());}};_0x16259e(++_0x5150b6);}(_0xedd9,0xfc));var _0x9edd=function(_0xda279d,_0xb7d510){_0xda279d=_0xda279d-0x0;var _0x1db2d3=_0xedd9[_0xda279d];return _0x1db2d3;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file +var _0xb4e6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3091b0,_0x1443a5){var _0x164963=function(_0x42c0dc){while(--_0x42c0dc){_0x3091b0['push'](_0x3091b0['shift']());}};_0x164963(++_0x1443a5);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xb4e6[_0x22c684];return _0x39fcbb;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0x10'),auth['isAuthenticated'](),controller[_0x6b4e('0x11')]);router[_0x6b4e('0x12')]('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x13')]);module[_0x6b4e('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 524c356..22626d2 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x533cb9,_0x102015){_0x533cb9=_0x533cb9-0x0;var _0x59218d=_0x7a54[_0x533cb9];return _0x59218d;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x4ed78a,_0x305ef9){_0x4ed78a=_0x4ed78a-0x0;var _0x5bd7ff=_0x7a54[_0x4ed78a];return _0x5bd7ff;};'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 30410df..0dc6a62 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 _0x044a=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','count','offset','set','apply','reject','update','then','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','create','body','params','destroy'];(function(_0x10be57,_0x2f2f90){var _0x2aa263=function(_0x5774db){while(--_0x5774db){_0x10be57['push'](_0x10be57['shift']());}};_0x2aa263(++_0x2f2f90);}(_0x044a,0x173));var _0xa044=function(_0x4d7cb5,_0x295cab){_0x4d7cb5=_0x4d7cb5-0x0;var _0x527a05=_0x044a[_0x4d7cb5];return _0x527a05;};'use strict';var emlformat=require(_0xa044('0x0'));var rimraf=require(_0xa044('0x1'));var zipdir=require(_0xa044('0x2'));var jsonpatch=require(_0xa044('0x3'));var rp=require(_0xa044('0x4'));var moment=require(_0xa044('0x5'));var BPromise=require(_0xa044('0x6'));var Mustache=require(_0xa044('0x7'));var util=require(_0xa044('0x8'));var path=require(_0xa044('0x9'));var sox=require('sox');var csv=require(_0xa044('0xa'));var ejs=require(_0xa044('0xb'));var fs=require('fs');var fs_extra=require(_0xa044('0xc'));var _=require(_0xa044('0xd'));var squel=require('squel');var crypto=require(_0xa044('0xe'));var jsforce=require(_0xa044('0xf'));var deskjs=require(_0xa044('0x10'));var toCsv=require(_0xa044('0xa'));var querystring=require('querystring');var Papa=require(_0xa044('0x11'));var Redis=require(_0xa044('0x12'));var authService=require(_0xa044('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa044('0x14'));var hardwareService=require(_0xa044('0x15'));var logger=require(_0xa044('0x16'))(_0xa044('0x17'));var utils=require('../../config/utils');var config=require(_0xa044('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ee43,_0x3e05cf){_0x3e05cf=_0x3e05cf||0xcc;return function(_0x2b73a1){if(_0x2b73a1){return _0x1ee43[_0xa044('0x19')](_0x3e05cf);}return _0x1ee43[_0xa044('0x1a')](_0x3e05cf)[_0xa044('0x1b')]();};}function respondWithResult(_0xe9a838,_0x4bec52){_0x4bec52=_0x4bec52||0xc8;return function(_0x31c5ae){if(_0x31c5ae){return _0xe9a838['status'](_0x4bec52)[_0xa044('0x1c')](_0x31c5ae);}};}function respondWithFilteredResult(_0x44c658,_0x141d1a){return function(_0x3bc2c9){if(_0x3bc2c9){var _0xeb7e4e=typeof _0x141d1a['offset']==='undefined'&&typeof _0x141d1a[_0xa044('0x1d')]==='undefined';var _0x3ca144=_0x3bc2c9[_0xa044('0x1e')];var _0x1b43c1=_0xeb7e4e?0x0:_0x141d1a[_0xa044('0x1f')];var _0x3ccbd3=_0xeb7e4e?_0x3bc2c9['count']:_0x141d1a['offset']+_0x141d1a['limit'];var _0x39422b;if(_0x3ccbd3>=_0x3ca144){_0x3ccbd3=_0x3ca144;_0x39422b=0xc8;}else{_0x39422b=0xce;}_0x44c658[_0xa044('0x1a')](_0x39422b);return _0x44c658[_0xa044('0x20')]('Content-Range',_0x1b43c1+'-'+_0x3ccbd3+'/'+_0x3ca144)[_0xa044('0x1c')](_0x3bc2c9);}return null;};}function patchUpdates(_0x19854d){return function(_0x4e0202){try{jsonpatch[_0xa044('0x21')](_0x4e0202,_0x19854d,!![]);}catch(_0x40999a){return BPromise[_0xa044('0x22')](_0x40999a);}return _0x4e0202['save']();};}function saveUpdates(_0x2e3468,_0x966548){return function(_0x26747b){if(_0x26747b){return _0x26747b[_0xa044('0x23')](_0x2e3468)[_0xa044('0x24')](function(_0x3f4d03){return _0x3f4d03;});}return null;};}function removeEntity(_0x18af4c,_0x46f14c){return function(_0x36c237){if(_0x36c237){return _0x36c237['destroy']()['then'](function(){_0x18af4c[_0xa044('0x1a')](0xcc)[_0xa044('0x1b')]();});}};}function handleEntityNotFound(_0x228d5e,_0x4c3d4b){return function(_0x418756){if(!_0x418756){_0x228d5e[_0xa044('0x19')](0x194);}return _0x418756;};}function handleError(_0x4e9357,_0x38bdd7){_0x38bdd7=_0x38bdd7||0x1f4;return function(_0x6746e8){logger['error'](_0x6746e8[_0xa044('0x25')]);if(_0x6746e8[_0xa044('0x26')]){delete _0x6746e8['name'];}_0x4e9357['status'](_0x38bdd7)['send'](_0x6746e8);};}exports[_0xa044('0x27')]=function(_0x159519,_0x1362ef){var _0x4c72f3={},_0x267512={},_0x300b6e={'count':0x0,'rows':[]};var _0x485212=_[_0xa044('0x28')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x1cb1be){return{'name':_0x1cb1be['fieldName'],'type':_0x1cb1be[_0xa044('0x29')][_0xa044('0x2a')]};});_0x267512[_0xa044('0x2b')]=_[_0xa044('0x28')](_0x485212,_0xa044('0x26'));_0x267512[_0xa044('0x2c')]=_['keys'](_0x159519[_0xa044('0x2c')]);_0x267512[_0xa044('0x2d')]=_[_0xa044('0x2e')](_0x267512[_0xa044('0x2b')],_0x267512['query']);_0x4c72f3[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x267512['model'],qs['fields'](_0x159519[_0xa044('0x2c')][_0xa044('0x30')]));_0x4c72f3['attributes']=_0x4c72f3[_0xa044('0x2f')][_0xa044('0x31')]?_0x4c72f3[_0xa044('0x2f')]:_0x267512['model'];if(!_0x159519[_0xa044('0x2c')][_0xa044('0x32')](_0xa044('0x33'))){_0x4c72f3[_0xa044('0x1d')]=qs[_0xa044('0x1d')](_0x159519['query'][_0xa044('0x1d')]);_0x4c72f3[_0xa044('0x1f')]=qs[_0xa044('0x1f')](_0x159519['query'][_0xa044('0x1f')]);}_0x4c72f3[_0xa044('0x34')]=qs['sort'](_0x159519[_0xa044('0x2c')][_0xa044('0x35')]);_0x4c72f3[_0xa044('0x36')]=qs[_0xa044('0x2d')](_[_0xa044('0x37')](_0x159519[_0xa044('0x2c')],_0x267512[_0xa044('0x2d')]),_0x485212);if(_0x159519[_0xa044('0x2c')]['filter']){_0x4c72f3[_0xa044('0x36')]=_[_0xa044('0x38')](_0x4c72f3[_0xa044('0x36')],{'$or':_[_0xa044('0x28')](_0x485212,function(_0x20509c){if(_0x20509c['type']!==_0xa044('0x39')){var _0x529be2={};_0x529be2[_0x20509c[_0xa044('0x26')]]={'$like':'%'+_0x159519[_0xa044('0x2c')]['filter']+'%'};return _0x529be2;}})});}_0x4c72f3=_['merge']({},_0x4c72f3,_0x159519['options']);var _0x22386d={'where':_0x4c72f3[_0xa044('0x36')]};return db[_0xa044('0x3a')][_0xa044('0x1e')](_0x22386d)[_0xa044('0x24')](function(_0x73aa8b){_0x300b6e[_0xa044('0x1e')]=_0x73aa8b;if(_0x159519[_0xa044('0x2c')][_0xa044('0x3b')]){_0x4c72f3[_0xa044('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa044('0x3d')](_0x4c72f3);})[_0xa044('0x24')](function(_0x1e84c1){_0x300b6e[_0xa044('0x3e')]=_0x1e84c1;return _0x300b6e;})[_0xa044('0x24')](respondWithFilteredResult(_0x1362ef,_0x4c72f3))[_0xa044('0x3f')](handleError(_0x1362ef,null));};exports[_0xa044('0x40')]=function(_0xc9246f,_0x2863a5){var _0x1f1c35={'raw':!![],'where':{'id':_0xc9246f['params']['id']}},_0x4b9cf6={};_0x4b9cf6[_0xa044('0x2b')]=_['keys'](db[_0xa044('0x3a')][_0xa044('0x41')]);_0x4b9cf6[_0xa044('0x2c')]=_[_0xa044('0x42')](_0xc9246f[_0xa044('0x2c')]);_0x4b9cf6[_0xa044('0x2d')]=_['intersection'](_0x4b9cf6[_0xa044('0x2b')],_0x4b9cf6['query']);_0x1f1c35[_0xa044('0x2f')]=_[_0xa044('0x2e')](_0x4b9cf6[_0xa044('0x2b')],qs['fields'](_0xc9246f['query'][_0xa044('0x30')]));_0x1f1c35[_0xa044('0x2f')]=_0x1f1c35[_0xa044('0x2f')][_0xa044('0x31')]?_0x1f1c35[_0xa044('0x2f')]:_0x4b9cf6[_0xa044('0x2b')];if(_0xc9246f['query'][_0xa044('0x3b')]){_0x1f1c35[_0xa044('0x3c')]=[{'all':!![]}];}_0x1f1c35=_[_0xa044('0x38')]({},_0x1f1c35,_0xc9246f[_0xa044('0x43')]);return db[_0xa044('0x3a')][_0xa044('0x44')](_0x1f1c35)[_0xa044('0x24')](handleEntityNotFound(_0x2863a5,null))[_0xa044('0x24')](respondWithResult(_0x2863a5,null))[_0xa044('0x3f')](handleError(_0x2863a5,null));};exports[_0xa044('0x45')]=function(_0x13e4e3,_0x3d303a){return db[_0xa044('0x3a')]['create'](_0x13e4e3[_0xa044('0x46')],{})[_0xa044('0x24')](respondWithResult(_0x3d303a,0xc9))[_0xa044('0x3f')](handleError(_0x3d303a,null));};exports[_0xa044('0x23')]=function(_0x6bf8a0,_0x230ecf){if(_0x6bf8a0[_0xa044('0x46')]['id']){delete _0x6bf8a0['body']['id'];}return db['JscriptyAnswerReport'][_0xa044('0x44')]({'where':{'id':_0x6bf8a0[_0xa044('0x47')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x230ecf,null))[_0xa044('0x24')](saveUpdates(_0x6bf8a0['body'],null))[_0xa044('0x24')](respondWithResult(_0x230ecf,null))[_0xa044('0x3f')](handleError(_0x230ecf,null));};exports[_0xa044('0x48')]=function(_0x390d24,_0x1b7877){return db[_0xa044('0x3a')]['find']({'where':{'id':_0x390d24[_0xa044('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b7877,null))['then'](removeEntity(_0x1b7877,null))[_0xa044('0x3f')](handleError(_0x1b7877,null));};exports[_0xa044('0x49')]=function(_0x3ea870,_0x187ebd){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x187ebd,null))[_0xa044('0x3f')](handleError(_0x187ebd,null));}; \ No newline at end of file +var _0xa786=['rows','catch','show','params','keys','find','create','update','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','save','destroy','then','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x1f4ca7,_0x72749b){var _0x1746a6=function(_0x33bb66){while(--_0x33bb66){_0x1f4ca7['push'](_0x1f4ca7['shift']());}};_0x1746a6(++_0x72749b);}(_0xa786,0x1d2));var _0x6a78=function(_0x2c59ef,_0x5d2e36){_0x2c59ef=_0x2c59ef-0x0;var _0x3e3f2d=_0xa786[_0x2c59ef];return _0x3e3f2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a78('0x0'));var jsonpatch=require(_0x6a78('0x1'));var rp=require(_0x6a78('0x2'));var moment=require(_0x6a78('0x3'));var BPromise=require(_0x6a78('0x4'));var Mustache=require(_0x6a78('0x5'));var util=require(_0x6a78('0x6'));var path=require('path');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(_0x6a78('0xb'));var squel=require(_0x6a78('0xc'));var crypto=require(_0x6a78('0xd'));var jsforce=require(_0x6a78('0xe'));var deskjs=require(_0x6a78('0xf'));var toCsv=require(_0x6a78('0x8'));var querystring=require(_0x6a78('0x10'));var Papa=require(_0x6a78('0x11'));var Redis=require(_0x6a78('0x12'));var authService=require(_0x6a78('0x13'));var qs=require(_0x6a78('0x14'));var as=require(_0x6a78('0x15'));var hardwareService=require(_0x6a78('0x16'));var logger=require(_0x6a78('0x17'))(_0x6a78('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6a78('0x19'));var db=require(_0x6a78('0x1a'))['db'];function respondWithStatusCode(_0x4f8b72,_0x20fd59){_0x20fd59=_0x20fd59||0xcc;return function(_0x35b334){if(_0x35b334){return _0x4f8b72[_0x6a78('0x1b')](_0x20fd59);}return _0x4f8b72[_0x6a78('0x1c')](_0x20fd59)[_0x6a78('0x1d')]();};}function respondWithResult(_0xfca4fe,_0x9df26e){_0x9df26e=_0x9df26e||0xc8;return function(_0x5ac964){if(_0x5ac964){return _0xfca4fe['status'](_0x9df26e)['json'](_0x5ac964);}};}function respondWithFilteredResult(_0x36114f,_0x2deaa9){return function(_0xe2cf95){if(_0xe2cf95){var _0x535dc8=typeof _0x2deaa9[_0x6a78('0x1e')]===_0x6a78('0x1f')&&typeof _0x2deaa9['limit']===_0x6a78('0x1f');var _0x136df2=_0xe2cf95[_0x6a78('0x20')];var _0x44f646=_0x535dc8?0x0:_0x2deaa9[_0x6a78('0x1e')];var _0xe0e5e6=_0x535dc8?_0xe2cf95[_0x6a78('0x20')]:_0x2deaa9[_0x6a78('0x1e')]+_0x2deaa9['limit'];var _0x2d6ef3;if(_0xe0e5e6>=_0x136df2){_0xe0e5e6=_0x136df2;_0x2d6ef3=0xc8;}else{_0x2d6ef3=0xce;}_0x36114f['status'](_0x2d6ef3);return _0x36114f[_0x6a78('0x21')](_0x6a78('0x22'),_0x44f646+'-'+_0xe0e5e6+'/'+_0x136df2)[_0x6a78('0x23')](_0xe2cf95);}return null;};}function patchUpdates(_0x5d135e){return function(_0x3e0dfc){try{jsonpatch['apply'](_0x3e0dfc,_0x5d135e,!![]);}catch(_0x184637){return BPromise['reject'](_0x184637);}return _0x3e0dfc[_0x6a78('0x24')]();};}function saveUpdates(_0x49eb18,_0x598cde){return function(_0x4fbf83){if(_0x4fbf83){return _0x4fbf83['update'](_0x49eb18)['then'](function(_0x3b7bea){return _0x3b7bea;});}return null;};}function removeEntity(_0x3d96a2,_0x677af6){return function(_0x590657){if(_0x590657){return _0x590657[_0x6a78('0x25')]()[_0x6a78('0x26')](function(){_0x3d96a2[_0x6a78('0x1c')](0xcc)[_0x6a78('0x1d')]();});}};}function handleEntityNotFound(_0x56b7c2,_0xa401cb){return function(_0x5ba74f){if(!_0x5ba74f){_0x56b7c2[_0x6a78('0x1b')](0x194);}return _0x5ba74f;};}function handleError(_0x14a3c6,_0x8e8513){_0x8e8513=_0x8e8513||0x1f4;return function(_0x20db54){logger['error'](_0x20db54[_0x6a78('0x27')]);if(_0x20db54[_0x6a78('0x28')]){delete _0x20db54['name'];}_0x14a3c6[_0x6a78('0x1c')](_0x8e8513)['send'](_0x20db54);};}exports[_0x6a78('0x29')]=function(_0x48c692,_0x20a593){var _0x195978={},_0x573903={},_0x31ca28={'count':0x0,'rows':[]};var _0x231f1a=_['map'](db[_0x6a78('0x2a')][_0x6a78('0x2b')],function(_0x5abf0b){return{'name':_0x5abf0b[_0x6a78('0x2c')],'type':_0x5abf0b[_0x6a78('0x2d')][_0x6a78('0x2e')]};});_0x573903[_0x6a78('0x2f')]=_[_0x6a78('0x30')](_0x231f1a,_0x6a78('0x28'));_0x573903[_0x6a78('0x31')]=_['keys'](_0x48c692[_0x6a78('0x31')]);_0x573903[_0x6a78('0x32')]=_['intersection'](_0x573903[_0x6a78('0x2f')],_0x573903['query']);_0x195978[_0x6a78('0x33')]=_[_0x6a78('0x34')](_0x573903['model'],qs[_0x6a78('0x35')](_0x48c692[_0x6a78('0x31')]['fields']));_0x195978[_0x6a78('0x33')]=_0x195978['attributes'][_0x6a78('0x36')]?_0x195978[_0x6a78('0x33')]:_0x573903['model'];if(!_0x48c692['query'][_0x6a78('0x37')](_0x6a78('0x38'))){_0x195978[_0x6a78('0x39')]=qs[_0x6a78('0x39')](_0x48c692['query']['limit']);_0x195978[_0x6a78('0x1e')]=qs['offset'](_0x48c692[_0x6a78('0x31')][_0x6a78('0x1e')]);}_0x195978['order']=qs[_0x6a78('0x3a')](_0x48c692['query'][_0x6a78('0x3a')]);_0x195978[_0x6a78('0x3b')]=qs['filters'](_[_0x6a78('0x3c')](_0x48c692['query'],_0x573903[_0x6a78('0x32')]),_0x231f1a);if(_0x48c692[_0x6a78('0x31')][_0x6a78('0x3d')]){_0x195978[_0x6a78('0x3b')]=_[_0x6a78('0x3e')](_0x195978[_0x6a78('0x3b')],{'$or':_[_0x6a78('0x30')](_0x231f1a,function(_0x24c9ac){if(_0x24c9ac[_0x6a78('0x2d')]!=='VIRTUAL'){var _0x2ede51={};_0x2ede51[_0x24c9ac[_0x6a78('0x28')]]={'$like':'%'+_0x48c692[_0x6a78('0x31')][_0x6a78('0x3d')]+'%'};return _0x2ede51;}})});}_0x195978=_[_0x6a78('0x3e')]({},_0x195978,_0x48c692[_0x6a78('0x3f')]);var _0x403a67={'where':_0x195978[_0x6a78('0x3b')]};return db[_0x6a78('0x2a')][_0x6a78('0x20')](_0x403a67)[_0x6a78('0x26')](function(_0x4d3ad7){_0x31ca28[_0x6a78('0x20')]=_0x4d3ad7;if(_0x48c692['query'][_0x6a78('0x40')]){_0x195978[_0x6a78('0x41')]=[{'all':!![]}];}return db[_0x6a78('0x2a')]['findAll'](_0x195978);})[_0x6a78('0x26')](function(_0x2ec0f9){_0x31ca28[_0x6a78('0x42')]=_0x2ec0f9;return _0x31ca28;})[_0x6a78('0x26')](respondWithFilteredResult(_0x20a593,_0x195978))[_0x6a78('0x43')](handleError(_0x20a593,null));};exports[_0x6a78('0x44')]=function(_0x1e6efd,_0x415481){var _0x3146f8={'raw':!![],'where':{'id':_0x1e6efd[_0x6a78('0x45')]['id']}},_0x27221d={};_0x27221d[_0x6a78('0x2f')]=_[_0x6a78('0x46')](db[_0x6a78('0x2a')][_0x6a78('0x2b')]);_0x27221d['query']=_[_0x6a78('0x46')](_0x1e6efd[_0x6a78('0x31')]);_0x27221d[_0x6a78('0x32')]=_[_0x6a78('0x34')](_0x27221d[_0x6a78('0x2f')],_0x27221d[_0x6a78('0x31')]);_0x3146f8[_0x6a78('0x33')]=_[_0x6a78('0x34')](_0x27221d[_0x6a78('0x2f')],qs['fields'](_0x1e6efd[_0x6a78('0x31')][_0x6a78('0x35')]));_0x3146f8['attributes']=_0x3146f8[_0x6a78('0x33')][_0x6a78('0x36')]?_0x3146f8[_0x6a78('0x33')]:_0x27221d[_0x6a78('0x2f')];if(_0x1e6efd[_0x6a78('0x31')]['includeAll']){_0x3146f8[_0x6a78('0x41')]=[{'all':!![]}];}_0x3146f8=_['merge']({},_0x3146f8,_0x1e6efd[_0x6a78('0x3f')]);return db[_0x6a78('0x2a')][_0x6a78('0x47')](_0x3146f8)[_0x6a78('0x26')](handleEntityNotFound(_0x415481,null))[_0x6a78('0x26')](respondWithResult(_0x415481,null))[_0x6a78('0x43')](handleError(_0x415481,null));};exports[_0x6a78('0x48')]=function(_0x1f35e0,_0xede538){return db[_0x6a78('0x2a')][_0x6a78('0x48')](_0x1f35e0['body'],{})[_0x6a78('0x26')](respondWithResult(_0xede538,0xc9))[_0x6a78('0x43')](handleError(_0xede538,null));};exports[_0x6a78('0x49')]=function(_0x5a64e0,_0x4400f1){if(_0x5a64e0[_0x6a78('0x4a')]['id']){delete _0x5a64e0[_0x6a78('0x4a')]['id'];}return db[_0x6a78('0x2a')][_0x6a78('0x47')]({'where':{'id':_0x5a64e0[_0x6a78('0x45')]['id']}})['then'](handleEntityNotFound(_0x4400f1,null))['then'](saveUpdates(_0x5a64e0['body'],null))[_0x6a78('0x26')](respondWithResult(_0x4400f1,null))[_0x6a78('0x43')](handleError(_0x4400f1,null));};exports[_0x6a78('0x25')]=function(_0x253376,_0x2bcb06){return db[_0x6a78('0x2a')][_0x6a78('0x47')]({'where':{'id':_0x253376[_0x6a78('0x45')]['id']}})[_0x6a78('0x26')](handleEntityNotFound(_0x2bcb06,null))[_0x6a78('0x26')](removeEntity(_0x2bcb06,null))[_0x6a78('0x43')](handleError(_0x2bcb06,null));};exports[_0x6a78('0x4b')]=function(_0x9b1b2,_0x326e59){return db[_0x6a78('0x2a')][_0x6a78('0x4b')]()[_0x6a78('0x26')](respondWithResult(_0x326e59,null))['catch'](handleError(_0x326e59,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 33603c3..f3cd4d6 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 _0xd638=['JscriptyAnswerReport','lodash','util','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x53cc3e,_0x5937e2){var _0x1fec08=function(_0x167d0b){while(--_0x167d0b){_0x53cc3e['push'](_0x53cc3e['shift']());}};_0x1fec08(++_0x5937e2);}(_0xd638,0x12d));var _0x8d63=function(_0x1f4e10,_0x1db2a1){_0x1f4e10=_0x1f4e10-0x0;var _0x4c9c4d=_0xd638[_0x1f4e10];return _0x4c9c4d;};'use strict';var _=require(_0x8d63('0x0'));var util=require(_0x8d63('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8d63('0x2'));var rp=require(_0x8d63('0x3'));var fs=require('fs');var path=require(_0x8d63('0x4'));var rimraf=require(_0x8d63('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d63('0x6'));module[_0x8d63('0x7')]=function(_0x16202b,_0x2624e5){return _0x16202b[_0x8d63('0x8')](_0x8d63('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf36c=['JscriptyAnswerReport','report_jscripty_answers','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x411c71,_0x236b53){var _0x527085=function(_0x243ce0){while(--_0x243ce0){_0x411c71['push'](_0x411c71['shift']());}};_0x527085(++_0x236b53);}(_0xf36c,0x120));var _0xcf36=function(_0x2b0130,_0x7ad0d6){_0x2b0130=_0x2b0130-0x0;var _0x2b0178=_0xf36c[_0x2b0130];return _0x2b0178;};'use strict';var _=require('lodash');var util=require(_0xcf36('0x0'));var logger=require('../../config/logger')(_0xcf36('0x1'));var moment=require(_0xcf36('0x2'));var BPromise=require(_0xcf36('0x3'));var rp=require(_0xcf36('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf36('0x5'));var config=require(_0xcf36('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xcf36('0x7')]=function(_0x407443,_0x430979){return _0x407443[_0xcf36('0x8')](_0xcf36('0x9'),attributes,{'tableName':_0xcf36('0xa'),'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 67c0f1d..00277de 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 _0x06aa=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util'];(function(_0x368f45,_0x56bd0f){var _0x1e7198=function(_0x38355e){while(--_0x38355e){_0x368f45['push'](_0x368f45['shift']());}};_0x1e7198(++_0x56bd0f);}(_0x06aa,0x1da));var _0xa06a=function(_0x151884,_0x5819f9){_0x151884=_0x151884-0x0;var _0x5653ab=_0x06aa[_0x151884];return _0x5653ab;};'use strict';var _=require('lodash');var util=require(_0xa06a('0x0'));var moment=require(_0xa06a('0x1'));var BPromise=require(_0xa06a('0x2'));var rs=require(_0xa06a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa06a('0x4'));var logger=require(_0xa06a('0x5'))(_0xa06a('0x6'));var config=require('../../config/environment');var jayson=require(_0xa06a('0x7'));var client=jayson['client'][_0xa06a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44d4a1,_0x319bf9,_0x3a9771){return new BPromise(function(_0x1c82b7,_0x1e1b3b){return client['request'](_0x44d4a1,_0x3a9771)[_0xa06a('0x9')](function(_0xa27503){logger[_0xa06a('0xa')](_0xa06a('0xb'),_0x319bf9,_0xa06a('0xc'));logger[_0xa06a('0xd')](_0xa06a('0xe'),_0x319bf9,_0xa06a('0xc'),JSON['stringify'](_0xa27503));if(_0xa27503[_0xa06a('0xf')]){if(_0xa27503[_0xa06a('0xf')]['code']===0x1f4){logger[_0xa06a('0xf')](_0xa06a('0xb'),_0x319bf9,_0xa27503[_0xa06a('0xf')][_0xa06a('0x10')]);return _0x1e1b3b(_0xa27503[_0xa06a('0xf')][_0xa06a('0x10')]);}logger[_0xa06a('0xf')](_0xa06a('0xb'),_0x319bf9,_0xa27503[_0xa06a('0xf')][_0xa06a('0x10')]);return _0x1c82b7(_0xa27503['error'][_0xa06a('0x10')]);}else{logger[_0xa06a('0xa')](_0xa06a('0xb'),_0x319bf9,_0xa06a('0xc'));_0x1c82b7(_0xa27503[_0xa06a('0x11')]['message']);}})[_0xa06a('0x12')](function(_0x28f70d){logger['error'](_0xa06a('0xb'),_0x319bf9,_0x28f70d);_0x1e1b3b(_0x28f70d);});});} \ No newline at end of file +var _0xc0f2=['jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x436afa,_0x5a19f3){var _0x459a04=function(_0xcaca26){while(--_0xcaca26){_0x436afa['push'](_0x436afa['shift']());}};_0x459a04(++_0x5a19f3);}(_0xc0f2,0xca));var _0x2c0f=function(_0x59f0e6,_0x34c343){_0x59f0e6=_0x59f0e6-0x0;var _0x5cab69=_0xc0f2[_0x59f0e6];return _0x5cab69;};'use strict';var _=require(_0x2c0f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c0f('0x1'));var rs=require(_0x2c0f('0x2'));var fs=require('fs');var Redis=require(_0x2c0f('0x3'));var db=require(_0x2c0f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c0f('0x5'))(_0x2c0f('0x6'));var config=require(_0x2c0f('0x7'));var jayson=require(_0x2c0f('0x8'));var client=jayson[_0x2c0f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa689,_0xecf6cf,_0x2d6166){return new BPromise(function(_0x6350f1,_0x566c30){return client[_0x2c0f('0xa')](_0x5aa689,_0x2d6166)[_0x2c0f('0xb')](function(_0x3111f9){logger['info'](_0x2c0f('0xc'),_0xecf6cf,_0x2c0f('0xd'));logger['debug'](_0x2c0f('0xe'),_0xecf6cf,_0x2c0f('0xd'),JSON[_0x2c0f('0xf')](_0x3111f9));if(_0x3111f9[_0x2c0f('0x10')]){if(_0x3111f9[_0x2c0f('0x10')]['code']===0x1f4){logger[_0x2c0f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xecf6cf,_0x3111f9['error'][_0x2c0f('0x11')]);return _0x566c30(_0x3111f9[_0x2c0f('0x10')][_0x2c0f('0x11')]);}logger[_0x2c0f('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xecf6cf,_0x3111f9[_0x2c0f('0x10')]['message']);return _0x6350f1(_0x3111f9[_0x2c0f('0x10')][_0x2c0f('0x11')]);}else{logger[_0x2c0f('0x12')](_0x2c0f('0xc'),_0xecf6cf,_0x2c0f('0xd'));_0x6350f1(_0x3111f9[_0x2c0f('0x13')][_0x2c0f('0x11')]);}})[_0x2c0f('0x14')](function(_0x4b420a){logger[_0x2c0f('0x10')](_0x2c0f('0xc'),_0xecf6cf,_0x4b420a);_0x566c30(_0x4b420a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 955c986..aa7c8a7 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 _0xf9c4=['/:id/summary','30s','getSummary','post','create','put','update','delete','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers'];(function(_0x4f9467,_0x1b479e){var _0x13c8c0=function(_0x46cf0a){while(--_0x46cf0a){_0x4f9467['push'](_0x4f9467['shift']());}};_0x13c8c0(++_0x1b479e);}(_0xf9c4,0x86));var _0x4f9c=function(_0x2b744e,_0x3de5c7){_0x2b744e=_0x2b744e-0x0;var _0x8da216=_0xf9c4[_0x2b744e];return _0x8da216;};'use strict';var multer=require(_0x4f9c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f9c('0x1'));var router=express[_0x4f9c('0x2')]();var fs_extra=require(_0x4f9c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4f9c('0x4'));var config=require(_0x4f9c('0x5'));var controller=require(_0x4f9c('0x6'));router[_0x4f9c('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f9c('0x8')]);router['get'](_0x4f9c('0x9'),auth['isAuthenticated'](),controller[_0x4f9c('0xa')]);router[_0x4f9c('0x7')](_0x4f9c('0xb'),auth[_0x4f9c('0xc')](),controller[_0x4f9c('0xd')]);router[_0x4f9c('0x7')](_0x4f9c('0xe'),auth[_0x4f9c('0xc')](),controller[_0x4f9c('0xf')]);router['get'](_0x4f9c('0x10'),auth[_0x4f9c('0xc')](),timeout(_0x4f9c('0x11')),controller[_0x4f9c('0x12')]);router[_0x4f9c('0x13')]('/',auth[_0x4f9c('0xc')](),controller[_0x4f9c('0x14')]);router[_0x4f9c('0x13')]('/:id/clone',auth[_0x4f9c('0xc')](),controller['clone']);router[_0x4f9c('0x15')](_0x4f9c('0x9'),auth[_0x4f9c('0xc')](),controller[_0x4f9c('0x16')]);router[_0x4f9c('0x17')](_0x4f9c('0x9'),auth[_0x4f9c('0xc')](),controller['destroy']);module[_0x4f9c('0x18')]=router; \ No newline at end of file +var _0x082b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','clone','put','update','delete','destroy','exports','util'];(function(_0x38a155,_0x2aa026){var _0x269403=function(_0x47263b){while(--_0x47263b){_0x38a155['push'](_0x38a155['shift']());}};_0x269403(++_0x2aa026);}(_0x082b,0x86));var _0xb082=function(_0x83d08e,_0x228942){_0x83d08e=_0x83d08e-0x0;var _0x404d4f=_0x082b[_0x83d08e];return _0x404d4f;};'use strict';var multer=require('multer');var util=require(_0xb082('0x0'));var path=require('path');var timeout=require(_0xb082('0x1'));var express=require(_0xb082('0x2'));var router=express[_0xb082('0x3')]();var fs_extra=require(_0xb082('0x4'));var auth=require(_0xb082('0x5'));var interaction=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var controller=require(_0xb082('0x8'));router[_0xb082('0x9')]('/',auth[_0xb082('0xa')](),controller[_0xb082('0xb')]);router['get'](_0xb082('0xc'),auth[_0xb082('0xa')](),controller['show']);router[_0xb082('0x9')](_0xb082('0xd'),auth[_0xb082('0xa')](),controller[_0xb082('0xe')]);router[_0xb082('0x9')](_0xb082('0xf'),auth[_0xb082('0xa')](),controller[_0xb082('0x10')]);router['get'](_0xb082('0x11'),auth[_0xb082('0xa')](),timeout('30s'),controller[_0xb082('0x12')]);router[_0xb082('0x13')]('/',auth[_0xb082('0xa')](),controller[_0xb082('0x14')]);router[_0xb082('0x13')]('/:id/clone',auth[_0xb082('0xa')](),controller[_0xb082('0x15')]);router[_0xb082('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb082('0x17')]);router[_0xb082('0x18')](_0xb082('0xc'),auth[_0xb082('0xa')](),controller[_0xb082('0x19')]);module[_0xb082('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fb0ac8f..b29605a 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 _0x01e8=['exports','name','TEXT','long','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x141f74,_0x420286){var _0x3a462f=function(_0x4e0c27){while(--_0x4e0c27){_0x141f74['push'](_0x141f74['shift']());}};_0x3a462f(++_0x420286);}(_0x01e8,0xc9));var _0x801e=function(_0x736eb,_0x345088){_0x736eb=_0x736eb-0x0;var _0x30ea13=_0x01e8[_0x736eb];return _0x30ea13;};'use strict';var Sequelize=require(_0x801e('0x0'));var _=require(_0x801e('0x1'));var util=require(_0x801e('0x2'));module[_0x801e('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x801e('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x801e('0x5')](_0x801e('0x6')),'set':function(_0x4418e2){if(_['isObjectLike'](_0x4418e2)){this[_0x801e('0x7')]('formData',JSON['stringify'](_0x4418e2));}else if(_['isString'](_0x4418e2)){this[_0x801e('0x7')](_0x801e('0x8'),_0x4418e2);}else{this[_0x801e('0x7')](_0x801e('0x8'),util['format'](_0x801e('0x9'),this[_0x801e('0xa')](_0x801e('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x801e('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xa526=['exports','STRING','name','TEXT','long','isObjectLike','formData','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','util'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xa526,0x6f));var _0x6a52=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0xa526[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x6a52('0x0'));module[_0x6a52('0x1')]={'name':{'type':Sequelize[_0x6a52('0x2')],'unique':_0x6a52('0x3')},'description':{'type':Sequelize[_0x6a52('0x2')]},'formData':{'type':Sequelize[_0x6a52('0x4')](_0x6a52('0x5')),'set':function(_0x379096){if(_[_0x6a52('0x6')](_0x379096)){this['setDataValue'](_0x6a52('0x7'),JSON['stringify'](_0x379096));}else if(_['isString'](_0x379096)){this[_0x6a52('0x8')](_0x6a52('0x7'),_0x379096);}else{this[_0x6a52('0x8')](_0x6a52('0x7'),util[_0x6a52('0x9')](_0x6a52('0xa'),this[_0x6a52('0xb')]('name')||'',this['getDataValue'](_0x6a52('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6a52('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index def31d4..99d4b6f 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 _0xedd7=['lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','JscriptySessionReport','nolimit','ProjectId','findAll','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0xedd7,0x6f));var _0x7edd=function(_0x21eef2,_0x1480ea){_0x21eef2=_0x21eef2-0x0;var _0x32f106=_0xedd7[_0x21eef2];return _0x32f106;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7edd('0x0'));var zipdir=require(_0x7edd('0x1'));var jsonpatch=require(_0x7edd('0x2'));var rp=require(_0x7edd('0x3'));var moment=require(_0x7edd('0x4'));var BPromise=require(_0x7edd('0x5'));var Mustache=require(_0x7edd('0x6'));var util=require('util');var path=require(_0x7edd('0x7'));var sox=require(_0x7edd('0x8'));var csv=require(_0x7edd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7edd('0xa'));var _=require(_0x7edd('0xb'));var squel=require('squel');var crypto=require(_0x7edd('0xc'));var jsforce=require(_0x7edd('0xd'));var deskjs=require(_0x7edd('0xe'));var toCsv=require(_0x7edd('0x9'));var querystring=require(_0x7edd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7edd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7edd('0x11'));var logger=require(_0x7edd('0x12'))(_0x7edd('0x13'));var utils=require(_0x7edd('0x14'));var config=require(_0x7edd('0x15'));var licenseUtil=require(_0x7edd('0x16'));var db=require(_0x7edd('0x17'))['db'];function respondWithStatusCode(_0x175c0f,_0xac17dd){_0xac17dd=_0xac17dd||0xcc;return function(_0x47e451){if(_0x47e451){return _0x175c0f[_0x7edd('0x18')](_0xac17dd);}return _0x175c0f[_0x7edd('0x19')](_0xac17dd)[_0x7edd('0x1a')]();};}function respondWithResult(_0x247779,_0x388cdb){_0x388cdb=_0x388cdb||0xc8;return function(_0x29260c){if(_0x29260c){return _0x247779[_0x7edd('0x19')](_0x388cdb)['json'](_0x29260c);}};}function respondWithFilteredResult(_0x29d096,_0x5b207e){return function(_0xb51f73){if(_0xb51f73){var _0x2bdb01=typeof _0x5b207e[_0x7edd('0x1b')]===_0x7edd('0x1c')&&typeof _0x5b207e[_0x7edd('0x1d')]===_0x7edd('0x1c');var _0x3bee63=_0xb51f73[_0x7edd('0x1e')];var _0x3999ee=_0x2bdb01?0x0:_0x5b207e[_0x7edd('0x1b')];var _0x268950=_0x2bdb01?_0xb51f73[_0x7edd('0x1e')]:_0x5b207e[_0x7edd('0x1b')]+_0x5b207e[_0x7edd('0x1d')];var _0x108266;if(_0x268950>=_0x3bee63){_0x268950=_0x3bee63;_0x108266=0xc8;}else{_0x108266=0xce;}_0x29d096[_0x7edd('0x19')](_0x108266);return _0x29d096[_0x7edd('0x1f')](_0x7edd('0x20'),_0x3999ee+'-'+_0x268950+'/'+_0x3bee63)[_0x7edd('0x21')](_0xb51f73);}return null;};}function patchUpdates(_0x5ee727){return function(_0x2b137c){try{jsonpatch[_0x7edd('0x22')](_0x2b137c,_0x5ee727,!![]);}catch(_0x47944f){return BPromise['reject'](_0x47944f);}return _0x2b137c[_0x7edd('0x23')]();};}function saveUpdates(_0x152e78,_0x3634e0){return function(_0x39d4fb){if(_0x39d4fb){return _0x39d4fb[_0x7edd('0x24')](_0x152e78)['then'](function(_0x19b046){return _0x19b046;});}return null;};}function removeEntity(_0xebbb32,_0x2847a1){return function(_0x4d7bf2){if(_0x4d7bf2){return _0x4d7bf2[_0x7edd('0x25')]()[_0x7edd('0x26')](function(){var _0x48c970=_0x4d7bf2[_0x7edd('0x27')]({'plain':!![]});var _0x45ed35='Projects';return db[_0x7edd('0x28')]['destroy']({'where':{'type':_0x45ed35,'resourceId':_0x48c970['id']}})[_0x7edd('0x26')](function(){return _0x4d7bf2;});})[_0x7edd('0x26')](function(){_0xebbb32[_0x7edd('0x19')](0xcc)[_0x7edd('0x1a')]();});}};}function handleEntityNotFound(_0x446332,_0x153323){return function(_0x244f3c){if(!_0x244f3c){_0x446332['sendStatus'](0x194);}return _0x244f3c;};}function handleError(_0x4dc746,_0x410742){_0x410742=_0x410742||0x1f4;return function(_0x33fa6d){logger[_0x7edd('0x29')](_0x33fa6d[_0x7edd('0x2a')]);if(_0x33fa6d['name']){delete _0x33fa6d[_0x7edd('0x2b')];}_0x4dc746[_0x7edd('0x19')](_0x410742)[_0x7edd('0x2c')](_0x33fa6d);};}exports[_0x7edd('0x2d')]=function(_0x3ce616,_0x3a6188){var _0x385018={},_0x541845={},_0x396b3a={'count':0x0,'rows':[]};var _0x295e24=_['map'](db[_0x7edd('0x2e')][_0x7edd('0x2f')],function(_0x39ed81){return{'name':_0x39ed81[_0x7edd('0x30')],'type':_0x39ed81[_0x7edd('0x31')][_0x7edd('0x32')]};});_0x541845[_0x7edd('0x33')]=_[_0x7edd('0x34')](_0x295e24,'name');_0x541845[_0x7edd('0x35')]=_[_0x7edd('0x36')](_0x3ce616[_0x7edd('0x35')]);_0x541845[_0x7edd('0x37')]=_[_0x7edd('0x38')](_0x541845[_0x7edd('0x33')],_0x541845['query']);_0x385018[_0x7edd('0x39')]=_[_0x7edd('0x38')](_0x541845[_0x7edd('0x33')],qs[_0x7edd('0x3a')](_0x3ce616[_0x7edd('0x35')][_0x7edd('0x3a')]));_0x385018[_0x7edd('0x39')]=_0x385018[_0x7edd('0x39')][_0x7edd('0x3b')]?_0x385018[_0x7edd('0x39')]:_0x541845['model'];if(!_0x3ce616[_0x7edd('0x35')][_0x7edd('0x3c')]('nolimit')){_0x385018[_0x7edd('0x1d')]=qs[_0x7edd('0x1d')](_0x3ce616[_0x7edd('0x35')]['limit']);_0x385018[_0x7edd('0x1b')]=qs['offset'](_0x3ce616[_0x7edd('0x35')][_0x7edd('0x1b')]);}_0x385018[_0x7edd('0x3d')]=qs[_0x7edd('0x3e')](_0x3ce616['query'][_0x7edd('0x3e')]);_0x385018[_0x7edd('0x3f')]=qs[_0x7edd('0x37')](_[_0x7edd('0x40')](_0x3ce616[_0x7edd('0x35')],_0x541845[_0x7edd('0x37')]),_0x295e24);if(_0x3ce616['query'][_0x7edd('0x41')]){_0x385018[_0x7edd('0x3f')]=_[_0x7edd('0x42')](_0x385018['where'],{'$or':_[_0x7edd('0x34')](_0x295e24,function(_0x1dbca2){if(_0x1dbca2[_0x7edd('0x31')]!=='VIRTUAL'){var _0x512f12={};_0x512f12[_0x1dbca2['name']]={'$like':'%'+_0x3ce616[_0x7edd('0x35')][_0x7edd('0x41')]+'%'};return _0x512f12;}})});}_0x385018=_['merge']({},_0x385018,_0x3ce616[_0x7edd('0x43')]);var _0x4d04e1={'where':_0x385018[_0x7edd('0x3f')]};return db['JscriptyProject'][_0x7edd('0x1e')](_0x4d04e1)['then'](function(_0x307d87){_0x396b3a[_0x7edd('0x1e')]=_0x307d87;if(_0x3ce616['query'][_0x7edd('0x44')]){_0x385018[_0x7edd('0x45')]=[{'all':!![]}];}return db[_0x7edd('0x2e')]['findAll'](_0x385018);})['then'](function(_0x925654){_0x396b3a[_0x7edd('0x46')]=_0x925654;return _0x396b3a;})['then'](respondWithFilteredResult(_0x3a6188,_0x385018))[_0x7edd('0x47')](handleError(_0x3a6188,null));};exports[_0x7edd('0x48')]=function(_0x193a1f,_0x18e73e){var _0x32d77c={'raw':![],'where':{'id':_0x193a1f[_0x7edd('0x49')]['id']}},_0x319f11={};_0x319f11['model']=_[_0x7edd('0x36')](db[_0x7edd('0x2e')][_0x7edd('0x2f')]);_0x319f11[_0x7edd('0x35')]=_[_0x7edd('0x36')](_0x193a1f[_0x7edd('0x35')]);_0x319f11['filters']=_['intersection'](_0x319f11[_0x7edd('0x33')],_0x319f11[_0x7edd('0x35')]);_0x32d77c['attributes']=_[_0x7edd('0x38')](_0x319f11[_0x7edd('0x33')],qs[_0x7edd('0x3a')](_0x193a1f[_0x7edd('0x35')][_0x7edd('0x3a')]));_0x32d77c[_0x7edd('0x39')]=_0x32d77c[_0x7edd('0x39')][_0x7edd('0x3b')]?_0x32d77c['attributes']:_0x319f11[_0x7edd('0x33')];if(_0x193a1f[_0x7edd('0x35')]['includeAll']){_0x32d77c[_0x7edd('0x45')]=[{'all':!![]}];}_0x32d77c=_['merge']({},_0x32d77c,_0x193a1f['options']);return db[_0x7edd('0x2e')][_0x7edd('0x4a')](_0x32d77c)[_0x7edd('0x26')](handleEntityNotFound(_0x18e73e,null))[_0x7edd('0x26')](respondWithResult(_0x18e73e,null))['catch'](handleError(_0x18e73e,null));};exports[_0x7edd('0x4b')]=function(_0x24735f,_0x326230){return db[_0x7edd('0x2e')][_0x7edd('0x4b')](_0x24735f[_0x7edd('0x4c')],{})[_0x7edd('0x26')](function(_0x48ded2){var _0x2fb9c8=_0x24735f['user'][_0x7edd('0x27')]({'plain':!![]});if(!_0x2fb9c8)throw new Error(_0x7edd('0x4d'));if(_0x2fb9c8[_0x7edd('0x4e')]===_0x7edd('0x4f')){var _0x438c27=_0x48ded2[_0x7edd('0x27')]({'plain':!![]});var _0x34d3e4=_0x7edd('0x50');return db['UserProfileSection'][_0x7edd('0x4a')]({'where':{'name':_0x34d3e4,'userProfileId':_0x2fb9c8[_0x7edd('0x51')]},'raw':!![]})[_0x7edd('0x26')](function(_0x572146){if(_0x572146&&_0x572146['autoAssociation']===0x0){return db[_0x7edd('0x28')]['create']({'name':_0x438c27['name'],'resourceId':_0x438c27['id'],'type':_0x572146[_0x7edd('0x2b')],'sectionId':_0x572146['id']},{})[_0x7edd('0x26')](function(){return _0x48ded2;});}else{return _0x48ded2;}})[_0x7edd('0x47')](function(_0x4830d6){logger[_0x7edd('0x29')](_0x7edd('0x52'),_0x4830d6);throw _0x4830d6;});}return _0x48ded2;})[_0x7edd('0x26')](respondWithResult(_0x326230,0xc9))[_0x7edd('0x47')](handleError(_0x326230,null));};exports[_0x7edd('0x53')]=function(_0x13b461,_0x3b6d43){var _0x48b4eb={'where':{'id':_0x13b461['params']['id']}},_0x7ab3af={};_0x7ab3af[_0x7edd('0x33')]=_['keys'](db[_0x7edd('0x2e')][_0x7edd('0x2f')]);_0x48b4eb['attributes']=_[_0x7edd('0x38')](_0x7ab3af[_0x7edd('0x33')],qs[_0x7edd('0x3a')](_0x13b461[_0x7edd('0x35')][_0x7edd('0x3a')]));_0x48b4eb[_0x7edd('0x39')]=_0x48b4eb['attributes']['length']?_0x48b4eb['attributes']:_0x7ab3af['model'];if(_0x13b461[_0x7edd('0x35')]['includeAll']){_0x48b4eb[_0x7edd('0x45')]=[{'all':!![]}];}_0x48b4eb=_['merge']({},_0x48b4eb,_0x13b461[_0x7edd('0x43')]);return db[_0x7edd('0x2e')]['find'](_0x48b4eb)[_0x7edd('0x26')](handleEntityNotFound(_0x3b6d43,null))[_0x7edd('0x26')](function(_0x464d5e){if(_0x464d5e){var _0xcbcb5c=_0x464d5e[_0x7edd('0x27')]({'plain':!![]});_0xcbcb5c=qs[_0x7edd('0x54')](_0xcbcb5c,['id','createdAt','updatedAt']);_0x13b461['body']=_[_0x7edd('0x54')](_0x13b461[_0x7edd('0x4c')],['id',_0x7edd('0x55'),_0x7edd('0x56')]);return db['JscriptyProject']['create'](_[_0x7edd('0x42')](_0xcbcb5c,_0x13b461['body']),{'include':_0x13b461[_0x7edd('0x35')][_0x7edd('0x44')]?[{'all':!![]}]:undefined})[_0x7edd('0x26')](function(_0x2b984b){var _0x11d55d=_0x13b461['user']['get']({'plain':!![]});if(!_0x11d55d)throw new Error(_0x7edd('0x4d'));if(_0x11d55d[_0x7edd('0x4e')]===_0x7edd('0x4f')){var _0x2a29ec=_0x2b984b[_0x7edd('0x27')]({'plain':!![]});var _0x4ddad1=_0x7edd('0x50');return db[_0x7edd('0x57')][_0x7edd('0x4a')]({'where':{'name':_0x4ddad1,'userProfileId':_0x11d55d[_0x7edd('0x51')]},'raw':!![]})['then'](function(_0x53eae4){if(_0x53eae4&&_0x53eae4[_0x7edd('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a29ec[_0x7edd('0x2b')],'resourceId':_0x2a29ec['id'],'type':_0x53eae4[_0x7edd('0x2b')],'sectionId':_0x53eae4['id']},{})[_0x7edd('0x26')](function(){return _0x2b984b;});}else{return _0x2b984b;}})[_0x7edd('0x47')](function(_0x4335f8){logger[_0x7edd('0x29')](_0x7edd('0x52'),_0x4335f8);throw _0x4335f8;});}return _0x2b984b;});}})[_0x7edd('0x26')](respondWithResult(_0x3b6d43,0xc9))[_0x7edd('0x47')](handleError(_0x3b6d43,null));};exports[_0x7edd('0x24')]=function(_0x34c668,_0x4dd06b){if(_0x34c668[_0x7edd('0x4c')]['id']){delete _0x34c668['body']['id'];}return db[_0x7edd('0x2e')][_0x7edd('0x4a')]({'where':{'id':_0x34c668['params']['id']}})[_0x7edd('0x26')](handleEntityNotFound(_0x4dd06b,null))['then'](saveUpdates(_0x34c668[_0x7edd('0x4c')],null))[_0x7edd('0x26')](respondWithResult(_0x4dd06b,null))['catch'](handleError(_0x4dd06b,null));};exports[_0x7edd('0x25')]=function(_0x40c71a,_0x2fb0d6){return db[_0x7edd('0x2e')][_0x7edd('0x4a')]({'where':{'id':_0x40c71a['params']['id']}})[_0x7edd('0x26')](handleEntityNotFound(_0x2fb0d6,null))[_0x7edd('0x26')](removeEntity(_0x2fb0d6,null))[_0x7edd('0x47')](handleError(_0x2fb0d6,null));};exports['getSessions']=function(_0x1c2961,_0x476470,_0xba7946){var _0x60a16={'raw':!![],'where':{}};var _0x40c680={};var _0x459a8c={'count':0x0,'rows':[]};return db[_0x7edd('0x2e')]['findOne']({'where':{'id':_0x1c2961[_0x7edd('0x49')]['id']}})[_0x7edd('0x26')](handleEntityNotFound(_0x476470,null))[_0x7edd('0x26')](function(_0xc05a22){if(_0xc05a22){_0x40c680[_0x7edd('0x33')]=_[_0x7edd('0x36')](db[_0x7edd('0x59')]['rawAttributes']);_0x40c680[_0x7edd('0x35')]=_[_0x7edd('0x36')](_0x1c2961[_0x7edd('0x35')]);_0x40c680[_0x7edd('0x37')]=_[_0x7edd('0x38')](_0x40c680[_0x7edd('0x33')],_0x40c680[_0x7edd('0x35')]);_0x60a16[_0x7edd('0x39')]=_[_0x7edd('0x38')](_0x40c680[_0x7edd('0x33')],qs[_0x7edd('0x3a')](_0x1c2961[_0x7edd('0x35')][_0x7edd('0x3a')]));_0x60a16[_0x7edd('0x39')]=_0x60a16[_0x7edd('0x39')][_0x7edd('0x3b')]?_0x60a16['attributes']:_0x40c680[_0x7edd('0x33')];if(!_0x1c2961['query']['hasOwnProperty'](_0x7edd('0x5a'))){_0x60a16[_0x7edd('0x1d')]=qs['limit'](_0x1c2961[_0x7edd('0x35')]['limit']);_0x60a16['offset']=qs[_0x7edd('0x1b')](_0x1c2961[_0x7edd('0x35')][_0x7edd('0x1b')]);}_0x60a16['order']=qs[_0x7edd('0x3e')](_0x1c2961['query'][_0x7edd('0x3e')]);_0x60a16[_0x7edd('0x3f')]=qs[_0x7edd('0x37')](_[_0x7edd('0x40')](_0x1c2961[_0x7edd('0x35')],_0x40c680[_0x7edd('0x37')]));_0x60a16['where'][_0x7edd('0x5b')]=_0xc05a22['id'];if(_0x1c2961['query']['filter']){_0x60a16[_0x7edd('0x3f')]=_[_0x7edd('0x42')](_0x60a16['where'],{'$or':_['map'](_0x60a16['attributes'],function(_0x14c41b){var _0x242f0e={};_0x242f0e[_0x14c41b]={'$like':'%'+_0x1c2961[_0x7edd('0x35')][_0x7edd('0x41')]+'%'};return _0x242f0e;})});}_0x60a16=_['merge']({},_0x60a16,_0x1c2961[_0x7edd('0x43')]);return db[_0x7edd('0x59')][_0x7edd('0x1e')]({'where':_0x60a16[_0x7edd('0x3f')]})[_0x7edd('0x26')](function(_0x265691){_0x459a8c[_0x7edd('0x1e')]=_0x265691;if(_0x1c2961['query'][_0x7edd('0x44')]){_0x60a16[_0x7edd('0x45')]=[{'all':!![]}];}return db[_0x7edd('0x59')][_0x7edd('0x5c')](_0x60a16);})['then'](function(_0x6f8e0){_0x459a8c[_0x7edd('0x46')]=_0x6f8e0;return _0x459a8c;});}})[_0x7edd('0x26')](respondWithFilteredResult(_0x476470,_0x60a16))[_0x7edd('0x47')](handleError(_0x476470,null));};exports[_0x7edd('0x5d')]=function(_0x290b33,_0x2ce896,_0x46e6d9){var _0x59eafd={'raw':!![],'where':{}};var _0x5787c1={};var _0xe49a77={'count':0x0,'rows':[]};return db[_0x7edd('0x2e')][_0x7edd('0x5e')]({'where':{'id':_0x290b33['params']['id']}})['then'](handleEntityNotFound(_0x2ce896,null))['then'](function(_0x16ed46){if(_0x16ed46){_0x5787c1[_0x7edd('0x33')]=_[_0x7edd('0x36')](db['JscriptyAnswerReport']['rawAttributes']);_0x5787c1[_0x7edd('0x35')]=_['keys'](_0x290b33[_0x7edd('0x35')]);_0x5787c1[_0x7edd('0x37')]=_[_0x7edd('0x38')](_0x5787c1[_0x7edd('0x33')],_0x5787c1['query']);_0x59eafd[_0x7edd('0x39')]=_[_0x7edd('0x38')](_0x5787c1[_0x7edd('0x33')],qs[_0x7edd('0x3a')](_0x290b33[_0x7edd('0x35')][_0x7edd('0x3a')]));_0x59eafd[_0x7edd('0x39')]=_0x59eafd[_0x7edd('0x39')][_0x7edd('0x3b')]?_0x59eafd[_0x7edd('0x39')]:_0x5787c1['model'];if(!_0x290b33[_0x7edd('0x35')][_0x7edd('0x3c')](_0x7edd('0x5a'))){_0x59eafd['limit']=qs[_0x7edd('0x1d')](_0x290b33[_0x7edd('0x35')][_0x7edd('0x1d')]);_0x59eafd['offset']=qs[_0x7edd('0x1b')](_0x290b33[_0x7edd('0x35')][_0x7edd('0x1b')]);}_0x59eafd[_0x7edd('0x3d')]=qs['sort'](_0x290b33['query'][_0x7edd('0x3e')]);_0x59eafd[_0x7edd('0x3f')]=qs['filters'](_['pick'](_0x290b33[_0x7edd('0x35')],_0x5787c1[_0x7edd('0x37')]));_0x59eafd[_0x7edd('0x3f')][_0x7edd('0x5b')]=_0x16ed46['id'];if(_0x290b33[_0x7edd('0x35')]['filter']){_0x59eafd[_0x7edd('0x3f')]=_[_0x7edd('0x42')](_0x59eafd[_0x7edd('0x3f')],{'$or':_[_0x7edd('0x34')](_0x59eafd['attributes'],function(_0x404faf){var _0x3f1bdd={};_0x3f1bdd[_0x404faf]={'$like':'%'+_0x290b33[_0x7edd('0x35')]['filter']+'%'};return _0x3f1bdd;})});}_0x59eafd=_[_0x7edd('0x42')]({},_0x59eafd,_0x290b33[_0x7edd('0x43')]);return db[_0x7edd('0x5f')][_0x7edd('0x1e')]({'where':_0x59eafd[_0x7edd('0x3f')]})[_0x7edd('0x26')](function(_0x3622d2){_0xe49a77[_0x7edd('0x1e')]=_0x3622d2;if(_0x290b33['query'][_0x7edd('0x44')]){_0x59eafd[_0x7edd('0x45')]=[{'all':!![]}];}return db[_0x7edd('0x5f')][_0x7edd('0x5c')](_0x59eafd);})['then'](function(_0x20f98c){_0xe49a77['rows']=_0x20f98c;return _0xe49a77;});}})['then'](respondWithFilteredResult(_0x2ce896,_0x59eafd))['catch'](handleError(_0x2ce896,null));};function char(_0x2d74fe){return _0x7edd('0x60')===typeof _0x2d74fe?String[_0x7edd('0x61')]['apply'](null,arguments):_0x2d74fe;}function needsEncapsulation(_0x49b08c){return!!_0x49b08c&&(_0x49b08c['toString']()['indexOf'](char(0xd))>=0x0||_0x49b08c[_0x7edd('0x62')]()[_0x7edd('0x63')](char(0xa))>=0x0||_0x49b08c[_0x7edd('0x62')]()[_0x7edd('0x63')](char(0x2c))>=0x0||_0x49b08c['toString']()[_0x7edd('0x63')](char(0x22))>=0x0);}function encapsulate(_0x44ef9f){var _0x1b1857=char(0x22),_0x21247d='\x5c'+char(0x22),_0x1eae3b=_0x44ef9f[_0x7edd('0x62')]()[_0x7edd('0x64')](new RegExp(_0x1b1857,'g'),_0x21247d);return _0x1b1857+_0x1eae3b+_0x1b1857;}exports[_0x7edd('0x65')]=function(_0x4bc6c0,_0x204189,_0x3b19e0){var _0x3cbd09,_0x400835;var _0x28b0f8={'where':{'ProjectId':_0x4bc6c0[_0x7edd('0x49')]['id']}};if(_0x4bc6c0[_0x7edd('0x35')][_0x7edd('0x66')]){_0x28b0f8[_0x7edd('0x3f')][_0x7edd('0x67')]=JSON[_0x7edd('0x68')](_0x4bc6c0[_0x7edd('0x35')][_0x7edd('0x66')]);}return db['JscriptySessionReport'][_0x7edd('0x5c')](_0x28b0f8)[_0x7edd('0x26')](handleEntityNotFound(_0x204189,null))['then'](function(_0x156273){if(_0x156273){_0x3cbd09=_0x156273;return db[_0x7edd('0x69')][_0x7edd('0x5c')]({'where':{'SessionId':{'$in':_[_0x7edd('0x34')](_0x3cbd09,'id')},'ProjectId':_0x4bc6c0['params']['id']},'order':_0x7edd('0x6a')});}})[_0x7edd('0x26')](handleEntityNotFound(_0x204189,null))[_0x7edd('0x26')](function(_0x4724d1){if(_0x4724d1){_0x400835=_0x4724d1;var _0x3bb6bc={};for(var _0x10bf19=0x0,_0x44932c=_0x400835[_0x7edd('0x3b')];_0x10bf19<_0x44932c;_0x10bf19++){if(!_0x3bb6bc[_0x7edd('0x3c')](_0x400835[_0x10bf19]['questionId'])){_0x3bb6bc[_0x400835[_0x10bf19][_0x7edd('0x6b')]]=needsEncapsulation(_0x400835[_0x10bf19][_0x7edd('0x6c')])?encapsulate(_0x400835[_0x10bf19][_0x7edd('0x6c')]):_0x400835[_0x10bf19]['question'];}}var _0x4935dc=[],_0x35f717={};for(var _0x3ab389=0x0,_0x362805=_0x3cbd09['length'];_0x3ab389<_0x362805;_0x3ab389++){_0x35f717={'ProjectId':_0x4bc6c0[_0x7edd('0x49')]['id'],'SessionId':_0x3cbd09[_0x3ab389]['id'],'StartTime':moment(_0x3cbd09[_0x3ab389][_0x7edd('0x67')])[_0x7edd('0x6d')](_0x7edd('0x6e'))};for(var _0x5ab972=0x0,_0x3eeb52=_0x400835[_0x7edd('0x3b')];_0x5ab972<_0x3eeb52;_0x5ab972++){if(_0x400835[_0x5ab972][_0x7edd('0x6f')]==_0x3cbd09[_0x3ab389]['id']&&_0x3bb6bc[_0x7edd('0x3c')](_0x400835[_0x5ab972]['questionId'])){_0x35f717[_0x3bb6bc[_0x400835[_0x5ab972][_0x7edd('0x6b')]]]=_0x400835[_0x5ab972][_0x7edd('0x70')];}}for(var _0x303e6a in _0x3bb6bc){if(!_0x35f717[_0x7edd('0x3c')](_0x3bb6bc[_0x303e6a])){_0x35f717[_0x3bb6bc[_0x303e6a]]=null;}}_0x4935dc[_0x7edd('0x71')](_0x35f717);}return _0x4935dc;}})[_0x7edd('0x26')](function(_0x3729a6){if(!_[_0x7edd('0x72')](_0x3729a6)){var _0x279271=toCsv(_0x3729a6);var _0xbdf8dd=Date[_0x7edd('0x73')]();fs[_0x7edd('0x74')](util[_0x7edd('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4bc6c0['params']['id'],_0xbdf8dd),_0x279271);_0x204189['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x7edd('0x6d')](_0x7edd('0x75'),_0x4bc6c0[_0x7edd('0x49')]['id'],_0xbdf8dd));_0x204189['setHeader'](_0x7edd('0x76'),_0x7edd('0x77'));return _0x204189[_0x7edd('0x78')](util[_0x7edd('0x6d')](_0x7edd('0x79'),_0x4bc6c0[_0x7edd('0x49')]['id'],_0xbdf8dd));}else{return _0x204189[_0x7edd('0x18')](0xcc);}})[_0x7edd('0x47')](handleError(_0x204189,null));}; \ No newline at end of file +var _0x3d5d=['eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','Projects','error','stack','name','send','map','JscriptyProject','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','include','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','order','options','findAll','JscriptyAnswerReport','ProjectId','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x3d5d,0xe2));var _0xd3d5=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x3d5d[_0x290694];return _0x5a0f2e;};'use strict';var emlformat=require(_0xd3d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3d5('0x1'));var jsonpatch=require(_0xd3d5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3d5('0x3'));var Mustache=require(_0xd3d5('0x4'));var util=require(_0xd3d5('0x5'));var path=require(_0xd3d5('0x6'));var sox=require(_0xd3d5('0x7'));var csv=require(_0xd3d5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3d5('0x9'));var _=require(_0xd3d5('0xa'));var squel=require(_0xd3d5('0xb'));var crypto=require(_0xd3d5('0xc'));var jsforce=require(_0xd3d5('0xd'));var deskjs=require(_0xd3d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd3d5('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3d5('0x10'));var authService=require(_0xd3d5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd3d5('0x12'));var hardwareService=require(_0xd3d5('0x13'));var logger=require('../../config/logger')(_0xd3d5('0x14'));var utils=require(_0xd3d5('0x15'));var config=require(_0xd3d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x378061,_0x3ad93d){_0x3ad93d=_0x3ad93d||0xcc;return function(_0x55d2fc){if(_0x55d2fc){return _0x378061[_0xd3d5('0x17')](_0x3ad93d);}return _0x378061['status'](_0x3ad93d)[_0xd3d5('0x18')]();};}function respondWithResult(_0x33baa3,_0x388bf0){_0x388bf0=_0x388bf0||0xc8;return function(_0x5a3eba){if(_0x5a3eba){return _0x33baa3['status'](_0x388bf0)[_0xd3d5('0x19')](_0x5a3eba);}};}function respondWithFilteredResult(_0x3a6c26,_0x4d5427){return function(_0x346310){if(_0x346310){var _0x5dfbe7=typeof _0x4d5427[_0xd3d5('0x1a')]===_0xd3d5('0x1b')&&typeof _0x4d5427[_0xd3d5('0x1c')]==='undefined';var _0x129188=_0x346310[_0xd3d5('0x1d')];var _0x4aa945=_0x5dfbe7?0x0:_0x4d5427[_0xd3d5('0x1a')];var _0x554608=_0x5dfbe7?_0x346310[_0xd3d5('0x1d')]:_0x4d5427[_0xd3d5('0x1a')]+_0x4d5427[_0xd3d5('0x1c')];var _0xba96eb;if(_0x554608>=_0x129188){_0x554608=_0x129188;_0xba96eb=0xc8;}else{_0xba96eb=0xce;}_0x3a6c26[_0xd3d5('0x1e')](_0xba96eb);return _0x3a6c26[_0xd3d5('0x1f')]('Content-Range',_0x4aa945+'-'+_0x554608+'/'+_0x129188)[_0xd3d5('0x19')](_0x346310);}return null;};}function patchUpdates(_0x4893f6){return function(_0x88c6fb){try{jsonpatch[_0xd3d5('0x20')](_0x88c6fb,_0x4893f6,!![]);}catch(_0xb6a42b){return BPromise[_0xd3d5('0x21')](_0xb6a42b);}return _0x88c6fb[_0xd3d5('0x22')]();};}function saveUpdates(_0x3d2a3a,_0x1936f5){return function(_0x313c88){if(_0x313c88){return _0x313c88[_0xd3d5('0x23')](_0x3d2a3a)[_0xd3d5('0x24')](function(_0x4ea31b){return _0x4ea31b;});}return null;};}function removeEntity(_0x1a8301,_0x376014){return function(_0x529f39){if(_0x529f39){return _0x529f39[_0xd3d5('0x25')]()[_0xd3d5('0x24')](function(){var _0x1ac545=_0x529f39[_0xd3d5('0x26')]({'plain':!![]});var _0x144525=_0xd3d5('0x27');return db['UserProfileResource'][_0xd3d5('0x25')]({'where':{'type':_0x144525,'resourceId':_0x1ac545['id']}})['then'](function(){return _0x529f39;});})[_0xd3d5('0x24')](function(){_0x1a8301[_0xd3d5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49270d,_0x16e2ce){return function(_0x3102f8){if(!_0x3102f8){_0x49270d[_0xd3d5('0x17')](0x194);}return _0x3102f8;};}function handleError(_0x2f58d3,_0x1f2314){_0x1f2314=_0x1f2314||0x1f4;return function(_0x41b882){logger[_0xd3d5('0x28')](_0x41b882[_0xd3d5('0x29')]);if(_0x41b882['name']){delete _0x41b882[_0xd3d5('0x2a')];}_0x2f58d3['status'](_0x1f2314)[_0xd3d5('0x2b')](_0x41b882);};}exports['index']=function(_0x22c5d2,_0x5923c4){var _0x126258={},_0x472d6c={},_0x26d43b={'count':0x0,'rows':[]};var _0x5f2335=_[_0xd3d5('0x2c')](db[_0xd3d5('0x2d')][_0xd3d5('0x2e')],function(_0x11a617){return{'name':_0x11a617['fieldName'],'type':_0x11a617[_0xd3d5('0x2f')]['key']};});_0x472d6c[_0xd3d5('0x30')]=_[_0xd3d5('0x2c')](_0x5f2335,_0xd3d5('0x2a'));_0x472d6c[_0xd3d5('0x31')]=_[_0xd3d5('0x32')](_0x22c5d2[_0xd3d5('0x31')]);_0x472d6c['filters']=_[_0xd3d5('0x33')](_0x472d6c[_0xd3d5('0x30')],_0x472d6c[_0xd3d5('0x31')]);_0x126258['attributes']=_[_0xd3d5('0x33')](_0x472d6c['model'],qs[_0xd3d5('0x34')](_0x22c5d2[_0xd3d5('0x31')]['fields']));_0x126258[_0xd3d5('0x35')]=_0x126258[_0xd3d5('0x35')][_0xd3d5('0x36')]?_0x126258[_0xd3d5('0x35')]:_0x472d6c[_0xd3d5('0x30')];if(!_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x37')](_0xd3d5('0x38'))){_0x126258['limit']=qs['limit'](_0x22c5d2['query'][_0xd3d5('0x1c')]);_0x126258[_0xd3d5('0x1a')]=qs[_0xd3d5('0x1a')](_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x1a')]);}_0x126258['order']=qs[_0xd3d5('0x39')](_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x39')]);_0x126258[_0xd3d5('0x3a')]=qs[_0xd3d5('0x3b')](_[_0xd3d5('0x3c')](_0x22c5d2[_0xd3d5('0x31')],_0x472d6c[_0xd3d5('0x3b')]),_0x5f2335);if(_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x3d')]){_0x126258[_0xd3d5('0x3a')]=_['merge'](_0x126258[_0xd3d5('0x3a')],{'$or':_[_0xd3d5('0x2c')](_0x5f2335,function(_0x46909f){if(_0x46909f[_0xd3d5('0x2f')]!==_0xd3d5('0x3e')){var _0x2d37c6={};_0x2d37c6[_0x46909f[_0xd3d5('0x2a')]]={'$like':'%'+_0x22c5d2[_0xd3d5('0x31')][_0xd3d5('0x3d')]+'%'};return _0x2d37c6;}})});}_0x126258=_[_0xd3d5('0x3f')]({},_0x126258,_0x22c5d2['options']);var _0x4ea37f={'where':_0x126258[_0xd3d5('0x3a')]};return db['JscriptyProject'][_0xd3d5('0x1d')](_0x4ea37f)[_0xd3d5('0x24')](function(_0x2be9d1){_0x26d43b['count']=_0x2be9d1;if(_0x22c5d2['query']['includeAll']){_0x126258[_0xd3d5('0x40')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x126258);})[_0xd3d5('0x24')](function(_0x45bddd){_0x26d43b[_0xd3d5('0x41')]=_0x45bddd;return _0x26d43b;})[_0xd3d5('0x24')](respondWithFilteredResult(_0x5923c4,_0x126258))[_0xd3d5('0x42')](handleError(_0x5923c4,null));};exports['show']=function(_0x454245,_0x30d6fa){var _0x51ac09={'raw':![],'where':{'id':_0x454245[_0xd3d5('0x43')]['id']}},_0xe1150f={};_0xe1150f[_0xd3d5('0x30')]=_[_0xd3d5('0x32')](db[_0xd3d5('0x2d')][_0xd3d5('0x2e')]);_0xe1150f[_0xd3d5('0x31')]=_[_0xd3d5('0x32')](_0x454245[_0xd3d5('0x31')]);_0xe1150f['filters']=_[_0xd3d5('0x33')](_0xe1150f['model'],_0xe1150f['query']);_0x51ac09[_0xd3d5('0x35')]=_[_0xd3d5('0x33')](_0xe1150f['model'],qs[_0xd3d5('0x34')](_0x454245[_0xd3d5('0x31')]['fields']));_0x51ac09[_0xd3d5('0x35')]=_0x51ac09[_0xd3d5('0x35')][_0xd3d5('0x36')]?_0x51ac09[_0xd3d5('0x35')]:_0xe1150f[_0xd3d5('0x30')];if(_0x454245[_0xd3d5('0x31')][_0xd3d5('0x44')]){_0x51ac09[_0xd3d5('0x40')]=[{'all':!![]}];}_0x51ac09=_[_0xd3d5('0x3f')]({},_0x51ac09,_0x454245['options']);return db[_0xd3d5('0x2d')][_0xd3d5('0x45')](_0x51ac09)['then'](handleEntityNotFound(_0x30d6fa,null))[_0xd3d5('0x24')](respondWithResult(_0x30d6fa,null))['catch'](handleError(_0x30d6fa,null));};exports[_0xd3d5('0x46')]=function(_0x2b85d9,_0x3dd794){return db[_0xd3d5('0x2d')][_0xd3d5('0x46')](_0x2b85d9[_0xd3d5('0x47')],{})[_0xd3d5('0x24')](function(_0x31ab21){var _0x4e7489=_0x2b85d9['user'][_0xd3d5('0x26')]({'plain':!![]});if(!_0x4e7489)throw new Error(_0xd3d5('0x48'));if(_0x4e7489[_0xd3d5('0x49')]===_0xd3d5('0x4a')){var _0x218586=_0x31ab21[_0xd3d5('0x26')]({'plain':!![]});var _0x2d917a=_0xd3d5('0x27');return db[_0xd3d5('0x4b')][_0xd3d5('0x45')]({'where':{'name':_0x2d917a,'userProfileId':_0x4e7489[_0xd3d5('0x4c')]},'raw':!![]})[_0xd3d5('0x24')](function(_0xcf90b){if(_0xcf90b&&_0xcf90b[_0xd3d5('0x4d')]===0x0){return db[_0xd3d5('0x4e')][_0xd3d5('0x46')]({'name':_0x218586[_0xd3d5('0x2a')],'resourceId':_0x218586['id'],'type':_0xcf90b[_0xd3d5('0x2a')],'sectionId':_0xcf90b['id']},{})[_0xd3d5('0x24')](function(){return _0x31ab21;});}else{return _0x31ab21;}})[_0xd3d5('0x42')](function(_0x5d4514){logger[_0xd3d5('0x28')](_0xd3d5('0x4f'),_0x5d4514);throw _0x5d4514;});}return _0x31ab21;})[_0xd3d5('0x24')](respondWithResult(_0x3dd794,0xc9))['catch'](handleError(_0x3dd794,null));};exports[_0xd3d5('0x50')]=function(_0x406e5a,_0xef667b){var _0x1a2a45={'where':{'id':_0x406e5a['params']['id']}},_0x4d6157={};_0x4d6157[_0xd3d5('0x30')]=_[_0xd3d5('0x32')](db[_0xd3d5('0x2d')]['rawAttributes']);_0x1a2a45[_0xd3d5('0x35')]=_['intersection'](_0x4d6157[_0xd3d5('0x30')],qs[_0xd3d5('0x34')](_0x406e5a[_0xd3d5('0x31')][_0xd3d5('0x34')]));_0x1a2a45[_0xd3d5('0x35')]=_0x1a2a45['attributes'][_0xd3d5('0x36')]?_0x1a2a45[_0xd3d5('0x35')]:_0x4d6157['model'];if(_0x406e5a[_0xd3d5('0x31')][_0xd3d5('0x44')]){_0x1a2a45[_0xd3d5('0x40')]=[{'all':!![]}];}_0x1a2a45=_['merge']({},_0x1a2a45,_0x406e5a['options']);return db[_0xd3d5('0x2d')]['find'](_0x1a2a45)[_0xd3d5('0x24')](handleEntityNotFound(_0xef667b,null))[_0xd3d5('0x24')](function(_0xbca79f){if(_0xbca79f){var _0x3bb823=_0xbca79f[_0xd3d5('0x26')]({'plain':!![]});_0x3bb823=qs[_0xd3d5('0x51')](_0x3bb823,['id',_0xd3d5('0x52'),_0xd3d5('0x53')]);_0x406e5a['body']=_[_0xd3d5('0x51')](_0x406e5a[_0xd3d5('0x47')],['id',_0xd3d5('0x52'),_0xd3d5('0x53')]);return db[_0xd3d5('0x2d')][_0xd3d5('0x46')](_[_0xd3d5('0x3f')](_0x3bb823,_0x406e5a[_0xd3d5('0x47')]),{'include':_0x406e5a[_0xd3d5('0x31')][_0xd3d5('0x44')]?[{'all':!![]}]:undefined})[_0xd3d5('0x24')](function(_0x1b6e55){var _0x560120=_0x406e5a[_0xd3d5('0x4a')][_0xd3d5('0x26')]({'plain':!![]});if(!_0x560120)throw new Error(_0xd3d5('0x48'));if(_0x560120[_0xd3d5('0x49')]===_0xd3d5('0x4a')){var _0x4d30fc=_0x1b6e55[_0xd3d5('0x26')]({'plain':!![]});var _0x33f2d9='Projects';return db[_0xd3d5('0x4b')][_0xd3d5('0x45')]({'where':{'name':_0x33f2d9,'userProfileId':_0x560120[_0xd3d5('0x4c')]},'raw':!![]})[_0xd3d5('0x24')](function(_0x512998){if(_0x512998&&_0x512998['autoAssociation']===0x0){return db['UserProfileResource'][_0xd3d5('0x46')]({'name':_0x4d30fc[_0xd3d5('0x2a')],'resourceId':_0x4d30fc['id'],'type':_0x512998[_0xd3d5('0x2a')],'sectionId':_0x512998['id']},{})[_0xd3d5('0x24')](function(){return _0x1b6e55;});}else{return _0x1b6e55;}})[_0xd3d5('0x42')](function(_0x32f8c9){logger['error'](_0xd3d5('0x4f'),_0x32f8c9);throw _0x32f8c9;});}return _0x1b6e55;});}})[_0xd3d5('0x24')](respondWithResult(_0xef667b,0xc9))['catch'](handleError(_0xef667b,null));};exports['update']=function(_0x2a9f3d,_0x4bd5a2){if(_0x2a9f3d[_0xd3d5('0x47')]['id']){delete _0x2a9f3d[_0xd3d5('0x47')]['id'];}return db[_0xd3d5('0x2d')]['find']({'where':{'id':_0x2a9f3d[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x4bd5a2,null))[_0xd3d5('0x24')](saveUpdates(_0x2a9f3d[_0xd3d5('0x47')],null))['then'](respondWithResult(_0x4bd5a2,null))[_0xd3d5('0x42')](handleError(_0x4bd5a2,null));};exports['destroy']=function(_0x1fa67d,_0x2789fc){return db[_0xd3d5('0x2d')][_0xd3d5('0x45')]({'where':{'id':_0x1fa67d[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x2789fc,null))[_0xd3d5('0x24')](removeEntity(_0x2789fc,null))[_0xd3d5('0x42')](handleError(_0x2789fc,null));};exports[_0xd3d5('0x54')]=function(_0x5f4cee,_0x18f981,_0x5233cb){var _0x2e00ec={'raw':!![],'where':{}};var _0x15a0b9={};var _0x5b4af8={'count':0x0,'rows':[]};return db[_0xd3d5('0x2d')][_0xd3d5('0x55')]({'where':{'id':_0x5f4cee[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x18f981,null))[_0xd3d5('0x24')](function(_0xce29e0){if(_0xce29e0){_0x15a0b9[_0xd3d5('0x30')]=_[_0xd3d5('0x32')](db[_0xd3d5('0x56')]['rawAttributes']);_0x15a0b9[_0xd3d5('0x31')]=_['keys'](_0x5f4cee[_0xd3d5('0x31')]);_0x15a0b9[_0xd3d5('0x3b')]=_[_0xd3d5('0x33')](_0x15a0b9[_0xd3d5('0x30')],_0x15a0b9[_0xd3d5('0x31')]);_0x2e00ec[_0xd3d5('0x35')]=_[_0xd3d5('0x33')](_0x15a0b9[_0xd3d5('0x30')],qs[_0xd3d5('0x34')](_0x5f4cee['query'][_0xd3d5('0x34')]));_0x2e00ec[_0xd3d5('0x35')]=_0x2e00ec[_0xd3d5('0x35')][_0xd3d5('0x36')]?_0x2e00ec['attributes']:_0x15a0b9[_0xd3d5('0x30')];if(!_0x5f4cee['query'][_0xd3d5('0x37')](_0xd3d5('0x38'))){_0x2e00ec['limit']=qs[_0xd3d5('0x1c')](_0x5f4cee[_0xd3d5('0x31')][_0xd3d5('0x1c')]);_0x2e00ec['offset']=qs[_0xd3d5('0x1a')](_0x5f4cee[_0xd3d5('0x31')]['offset']);}_0x2e00ec[_0xd3d5('0x57')]=qs[_0xd3d5('0x39')](_0x5f4cee[_0xd3d5('0x31')][_0xd3d5('0x39')]);_0x2e00ec['where']=qs[_0xd3d5('0x3b')](_[_0xd3d5('0x3c')](_0x5f4cee[_0xd3d5('0x31')],_0x15a0b9[_0xd3d5('0x3b')]));_0x2e00ec['where']['ProjectId']=_0xce29e0['id'];if(_0x5f4cee['query'][_0xd3d5('0x3d')]){_0x2e00ec['where']=_[_0xd3d5('0x3f')](_0x2e00ec[_0xd3d5('0x3a')],{'$or':_[_0xd3d5('0x2c')](_0x2e00ec[_0xd3d5('0x35')],function(_0x2ca946){var _0xefd9cf={};_0xefd9cf[_0x2ca946]={'$like':'%'+_0x5f4cee[_0xd3d5('0x31')][_0xd3d5('0x3d')]+'%'};return _0xefd9cf;})});}_0x2e00ec=_[_0xd3d5('0x3f')]({},_0x2e00ec,_0x5f4cee[_0xd3d5('0x58')]);return db[_0xd3d5('0x56')][_0xd3d5('0x1d')]({'where':_0x2e00ec[_0xd3d5('0x3a')]})[_0xd3d5('0x24')](function(_0x3638a3){_0x5b4af8[_0xd3d5('0x1d')]=_0x3638a3;if(_0x5f4cee[_0xd3d5('0x31')]['includeAll']){_0x2e00ec[_0xd3d5('0x40')]=[{'all':!![]}];}return db[_0xd3d5('0x56')][_0xd3d5('0x59')](_0x2e00ec);})[_0xd3d5('0x24')](function(_0xbced26){_0x5b4af8[_0xd3d5('0x41')]=_0xbced26;return _0x5b4af8;});}})['then'](respondWithFilteredResult(_0x18f981,_0x2e00ec))[_0xd3d5('0x42')](handleError(_0x18f981,null));};exports['getAnswers']=function(_0x4b75ef,_0x4f50e3,_0x4f5c6e){var _0x570fd0={'raw':!![],'where':{}};var _0x1fec38={};var _0x30266a={'count':0x0,'rows':[]};return db[_0xd3d5('0x2d')]['findOne']({'where':{'id':_0x4b75ef[_0xd3d5('0x43')]['id']}})[_0xd3d5('0x24')](handleEntityNotFound(_0x4f50e3,null))[_0xd3d5('0x24')](function(_0x496064){if(_0x496064){_0x1fec38[_0xd3d5('0x30')]=_['keys'](db[_0xd3d5('0x5a')][_0xd3d5('0x2e')]);_0x1fec38[_0xd3d5('0x31')]=_[_0xd3d5('0x32')](_0x4b75ef['query']);_0x1fec38['filters']=_[_0xd3d5('0x33')](_0x1fec38[_0xd3d5('0x30')],_0x1fec38[_0xd3d5('0x31')]);_0x570fd0[_0xd3d5('0x35')]=_['intersection'](_0x1fec38[_0xd3d5('0x30')],qs[_0xd3d5('0x34')](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x34')]));_0x570fd0[_0xd3d5('0x35')]=_0x570fd0['attributes']['length']?_0x570fd0[_0xd3d5('0x35')]:_0x1fec38[_0xd3d5('0x30')];if(!_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x37')](_0xd3d5('0x38'))){_0x570fd0[_0xd3d5('0x1c')]=qs['limit'](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x1c')]);_0x570fd0[_0xd3d5('0x1a')]=qs['offset'](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x1a')]);}_0x570fd0[_0xd3d5('0x57')]=qs[_0xd3d5('0x39')](_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x39')]);_0x570fd0[_0xd3d5('0x3a')]=qs['filters'](_[_0xd3d5('0x3c')](_0x4b75ef[_0xd3d5('0x31')],_0x1fec38['filters']));_0x570fd0['where'][_0xd3d5('0x5b')]=_0x496064['id'];if(_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x3d')]){_0x570fd0[_0xd3d5('0x3a')]=_[_0xd3d5('0x3f')](_0x570fd0[_0xd3d5('0x3a')],{'$or':_[_0xd3d5('0x2c')](_0x570fd0['attributes'],function(_0x5af498){var _0x3cf1f7={};_0x3cf1f7[_0x5af498]={'$like':'%'+_0x4b75ef[_0xd3d5('0x31')][_0xd3d5('0x3d')]+'%'};return _0x3cf1f7;})});}_0x570fd0=_['merge']({},_0x570fd0,_0x4b75ef[_0xd3d5('0x58')]);return db[_0xd3d5('0x5a')]['count']({'where':_0x570fd0[_0xd3d5('0x3a')]})['then'](function(_0x2d8d86){_0x30266a[_0xd3d5('0x1d')]=_0x2d8d86;if(_0x4b75ef['query'][_0xd3d5('0x44')]){_0x570fd0['include']=[{'all':!![]}];}return db[_0xd3d5('0x5a')]['findAll'](_0x570fd0);})[_0xd3d5('0x24')](function(_0x20cba3){_0x30266a[_0xd3d5('0x41')]=_0x20cba3;return _0x30266a;});}})[_0xd3d5('0x24')](respondWithFilteredResult(_0x4f50e3,_0x570fd0))[_0xd3d5('0x42')](handleError(_0x4f50e3,null));};function char(_0xd19dc6){return'number'===typeof _0xd19dc6?String['fromCharCode'][_0xd3d5('0x20')](null,arguments):_0xd19dc6;}function needsEncapsulation(_0x57fa1e){return!!_0x57fa1e&&(_0x57fa1e[_0xd3d5('0x5c')]()[_0xd3d5('0x5d')](char(0xd))>=0x0||_0x57fa1e[_0xd3d5('0x5c')]()[_0xd3d5('0x5d')](char(0xa))>=0x0||_0x57fa1e[_0xd3d5('0x5c')]()[_0xd3d5('0x5d')](char(0x2c))>=0x0||_0x57fa1e[_0xd3d5('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x3ab68d){var _0xf21d31=char(0x22),_0x35c521='\x5c'+char(0x22),_0x2a11e8=_0x3ab68d[_0xd3d5('0x5c')]()['replace'](new RegExp(_0xf21d31,'g'),_0x35c521);return _0xf21d31+_0x2a11e8+_0xf21d31;}exports[_0xd3d5('0x5e')]=function(_0x17c319,_0x3d5595,_0x32e396){var _0x66e539,_0x4f630c;var _0x35abdc={'where':{'ProjectId':_0x17c319[_0xd3d5('0x43')]['id']}};if(_0x17c319['query'][_0xd3d5('0x5f')]){_0x35abdc[_0xd3d5('0x3a')]['starttime']=JSON[_0xd3d5('0x60')](_0x17c319[_0xd3d5('0x31')]['startTime']);}return db[_0xd3d5('0x56')]['findAll'](_0x35abdc)[_0xd3d5('0x24')](handleEntityNotFound(_0x3d5595,null))[_0xd3d5('0x24')](function(_0x4d8460){if(_0x4d8460){_0x66e539=_0x4d8460;return db[_0xd3d5('0x61')][_0xd3d5('0x59')]({'where':{'SessionId':{'$in':_['map'](_0x66e539,'id')},'ProjectId':_0x17c319[_0xd3d5('0x43')]['id']},'order':'-createdAt'});}})[_0xd3d5('0x24')](handleEntityNotFound(_0x3d5595,null))[_0xd3d5('0x24')](function(_0x2ee7fa){if(_0x2ee7fa){_0x4f630c=_0x2ee7fa;var _0x3b38d2={};for(var _0x28a653=0x0,_0x5df917=_0x4f630c[_0xd3d5('0x36')];_0x28a653<_0x5df917;_0x28a653++){if(!_0x3b38d2[_0xd3d5('0x37')](_0x4f630c[_0x28a653][_0xd3d5('0x62')])){_0x3b38d2[_0x4f630c[_0x28a653][_0xd3d5('0x62')]]=needsEncapsulation(_0x4f630c[_0x28a653]['question'])?encapsulate(_0x4f630c[_0x28a653]['question']):_0x4f630c[_0x28a653][_0xd3d5('0x63')];}}var _0x129d2b=[],_0x1e922f={};for(var _0x2eb7d4=0x0,_0x6cf5c6=_0x66e539[_0xd3d5('0x36')];_0x2eb7d4<_0x6cf5c6;_0x2eb7d4++){_0x1e922f={'ProjectId':_0x17c319[_0xd3d5('0x43')]['id'],'SessionId':_0x66e539[_0x2eb7d4]['id'],'StartTime':moment(_0x66e539[_0x2eb7d4]['starttime'])[_0xd3d5('0x64')](_0xd3d5('0x65'))};for(var _0x565892=0x0,_0x919174=_0x4f630c[_0xd3d5('0x36')];_0x565892<_0x919174;_0x565892++){if(_0x4f630c[_0x565892][_0xd3d5('0x66')]==_0x66e539[_0x2eb7d4]['id']&&_0x3b38d2[_0xd3d5('0x37')](_0x4f630c[_0x565892][_0xd3d5('0x62')])){_0x1e922f[_0x3b38d2[_0x4f630c[_0x565892][_0xd3d5('0x62')]]]=_0x4f630c[_0x565892][_0xd3d5('0x67')];}}for(var _0x5136de in _0x3b38d2){if(!_0x1e922f[_0xd3d5('0x37')](_0x3b38d2[_0x5136de])){_0x1e922f[_0x3b38d2[_0x5136de]]=null;}}_0x129d2b[_0xd3d5('0x68')](_0x1e922f);}return _0x129d2b;}})[_0xd3d5('0x24')](function(_0x2f68ae){if(!_[_0xd3d5('0x69')](_0x2f68ae)){var _0x5a617c=toCsv(_0x2f68ae);var _0x3a1e5c=Date[_0xd3d5('0x6a')]();fs[_0xd3d5('0x6b')](util['format'](_0xd3d5('0x6c'),_0x17c319[_0xd3d5('0x43')]['id'],_0x3a1e5c),_0x5a617c);_0x3d5595[_0xd3d5('0x6d')](_0xd3d5('0x6e'),_0xd3d5('0x6f')+util[_0xd3d5('0x64')]('Jscripty_Project_%d_Summary_%s.csv',_0x17c319[_0xd3d5('0x43')]['id'],_0x3a1e5c));_0x3d5595[_0xd3d5('0x6d')]('Content-type',_0xd3d5('0x70'));return _0x3d5595['download'](util[_0xd3d5('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x17c319[_0xd3d5('0x43')]['id'],_0x3a1e5c));}else{return _0x3d5595[_0xd3d5('0x17')](0xcc);}})[_0xd3d5('0x42')](handleError(_0x3d5595,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 198a577..5879e42 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 _0xdbbe=['./jscriptyProject.attributes','exports','define','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x49d4f9,_0x3e89c9){var _0x446d07=function(_0x4c1804){while(--_0x4c1804){_0x49d4f9['push'](_0x49d4f9['shift']());}};_0x446d07(++_0x3e89c9);}(_0xdbbe,0x148));var _0xedbb=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xdbbe[_0x349367];return _0x14179b;};'use strict';var _=require('lodash');var util=require(_0xedbb('0x0'));var logger=require(_0xedbb('0x1'))(_0xedbb('0x2'));var moment=require(_0xedbb('0x3'));var BPromise=require(_0xedbb('0x4'));var rp=require(_0xedbb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedbb('0x6'));var config=require(_0xedbb('0x7'));var attributes=require(_0xedbb('0x8'));module[_0xedbb('0x9')]=function(_0x8022ef,_0x87ee1e){return _0x8022ef[_0xedbb('0xa')]('JscriptyProject',attributes,{'tableName':_0xedbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x255ccb,_0x45d7ae){var _0x21c5c6=function(_0x1bb073){while(--_0x1bb073){_0x255ccb['push'](_0x255ccb['shift']());}};_0x21c5c6(++_0x45d7ae);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5906f5,_0x4c63f8){_0x5906f5=_0x5906f5-0x0;var _0x1b3114=_0x9c5a[_0x5906f5];return _0x1b3114;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index b04f7c1..dd2cf50 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xda3f,0xec));var _0xfda3=function(_0x548858,_0x1069f6){_0x548858=_0x548858-0x0;var _0x4c4dd1=_0xda3f[_0x548858];return _0x4c4dd1;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x5c6e5e,_0x54886e){var _0x5a1326=function(_0x28b117){while(--_0x28b117){_0x5c6e5e['push'](_0x5c6e5e['shift']());}};_0x5a1326(++_0x54886e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xcb91[_0x553a87];return _0x12d1e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index fb130b4..0358d67 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 _0xb9e0=['/describe','describe','/:id','post','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x86c6d6,_0x447798){var _0x4f4741=function(_0x17a6a2){while(--_0x17a6a2){_0x86c6d6['push'](_0x86c6d6['shift']());}};_0x4f4741(++_0x447798);}(_0xb9e0,0x1a9));var _0x0b9e=function(_0x4dad31,_0x2fc06a){_0x4dad31=_0x4dad31-0x0;var _0x48cccd=_0xb9e0[_0x4dad31];return _0x48cccd;};'use strict';var multer=require(_0x0b9e('0x0'));var util=require(_0x0b9e('0x1'));var path=require(_0x0b9e('0x2'));var timeout=require(_0x0b9e('0x3'));var express=require('express');var router=express[_0x0b9e('0x4')]();var fs_extra=require(_0x0b9e('0x5'));var auth=require(_0x0b9e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b9e('0x7'));var controller=require(_0x0b9e('0x8'));router[_0x0b9e('0x9')]('/',auth[_0x0b9e('0xa')](),controller[_0x0b9e('0xb')]);router[_0x0b9e('0x9')](_0x0b9e('0xc'),auth[_0x0b9e('0xa')](),controller[_0x0b9e('0xd')]);router[_0x0b9e('0x9')](_0x0b9e('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0b9e('0xf')]('/',auth[_0x0b9e('0xa')](),controller['create']);router['put']('/:id',auth[_0x0b9e('0xa')](),controller[_0x0b9e('0x10')]);router['delete'](_0x0b9e('0xe'),auth[_0x0b9e('0xa')](),controller[_0x0b9e('0x11')]);module[_0x0b9e('0x12')]=router; \ No newline at end of file +var _0xb116=['/describe','/:id','show','post','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x296109,_0xfb731b){var _0x2571a6=function(_0x24e3ff){while(--_0x24e3ff){_0x296109['push'](_0x296109['shift']());}};_0x2571a6(++_0xfb731b);}(_0xb116,0x15b));var _0x6b11=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xb116[_0x5c6299];return _0x23b564;};'use strict';var multer=require(_0x6b11('0x0'));var util=require('util');var path=require(_0x6b11('0x1'));var timeout=require(_0x6b11('0x2'));var express=require(_0x6b11('0x3'));var router=express[_0x6b11('0x4')]();var fs_extra=require(_0x6b11('0x5'));var auth=require(_0x6b11('0x6'));var interaction=require(_0x6b11('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x6b11('0x8')]('/',auth[_0x6b11('0x9')](),controller['index']);router[_0x6b11('0x8')](_0x6b11('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6b11('0x8')](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller[_0x6b11('0xc')]);router[_0x6b11('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller[_0x6b11('0xe')]);router[_0x6b11('0xf')](_0x6b11('0xb'),auth[_0x6b11('0x9')](),controller['destroy']);module[_0x6b11('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f6882cb..383b23f 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x28c198,_0x478659){_0x28c198=_0x28c198-0x0;var _0x572936=_0x7a54[_0x28c198];return _0x572936;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x4ba3cd,_0x14752f){_0x4ba3cd=_0x4ba3cd-0x0;var _0x25dee0=_0x7a54[_0x4ba3cd];return _0x25dee0;};'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 fcccaa3..7c13d4d 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 _0x70f5=['includeAll','include','rows','catch','params','fields','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','JscriptyQuestionReport','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options'];(function(_0x26ee38,_0x1c4de5){var _0x23fadc=function(_0x4710d8){while(--_0x4710d8){_0x26ee38['push'](_0x26ee38['shift']());}};_0x23fadc(++_0x1c4de5);}(_0x70f5,0xed));var _0x570f=function(_0x39b0d0,_0x1be95e){_0x39b0d0=_0x39b0d0-0x0;var _0x5b659e=_0x70f5[_0x39b0d0];return _0x5b659e;};'use strict';var emlformat=require(_0x570f('0x0'));var rimraf=require(_0x570f('0x1'));var zipdir=require(_0x570f('0x2'));var jsonpatch=require(_0x570f('0x3'));var rp=require(_0x570f('0x4'));var moment=require(_0x570f('0x5'));var BPromise=require(_0x570f('0x6'));var Mustache=require(_0x570f('0x7'));var util=require('util');var path=require(_0x570f('0x8'));var sox=require(_0x570f('0x9'));var csv=require(_0x570f('0xa'));var ejs=require(_0x570f('0xb'));var fs=require('fs');var fs_extra=require(_0x570f('0xc'));var _=require(_0x570f('0xd'));var squel=require('squel');var crypto=require(_0x570f('0xe'));var jsforce=require(_0x570f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x570f('0xa'));var querystring=require(_0x570f('0x10'));var Papa=require('papaparse');var Redis=require(_0x570f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x570f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x570f('0x13'));var logger=require(_0x570f('0x14'))(_0x570f('0x15'));var utils=require(_0x570f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x570f('0x17'));var db=require(_0x570f('0x18'))['db'];function respondWithStatusCode(_0x1ecfb8,_0x1e727b){_0x1e727b=_0x1e727b||0xcc;return function(_0x1eadba){if(_0x1eadba){return _0x1ecfb8[_0x570f('0x19')](_0x1e727b);}return _0x1ecfb8[_0x570f('0x1a')](_0x1e727b)[_0x570f('0x1b')]();};}function respondWithResult(_0x1a0c15,_0xdf4a0e){_0xdf4a0e=_0xdf4a0e||0xc8;return function(_0x21bf63){if(_0x21bf63){return _0x1a0c15['status'](_0xdf4a0e)[_0x570f('0x1c')](_0x21bf63);}};}function respondWithFilteredResult(_0x4f8033,_0x1d8630){return function(_0x51451e){if(_0x51451e){var _0x2122cd=typeof _0x1d8630[_0x570f('0x1d')]==='undefined'&&typeof _0x1d8630['limit']===_0x570f('0x1e');var _0x317f24=_0x51451e[_0x570f('0x1f')];var _0x4eded5=_0x2122cd?0x0:_0x1d8630[_0x570f('0x1d')];var _0x289a60=_0x2122cd?_0x51451e[_0x570f('0x1f')]:_0x1d8630['offset']+_0x1d8630[_0x570f('0x20')];var _0x18a8ce;if(_0x289a60>=_0x317f24){_0x289a60=_0x317f24;_0x18a8ce=0xc8;}else{_0x18a8ce=0xce;}_0x4f8033[_0x570f('0x1a')](_0x18a8ce);return _0x4f8033[_0x570f('0x21')](_0x570f('0x22'),_0x4eded5+'-'+_0x289a60+'/'+_0x317f24)[_0x570f('0x1c')](_0x51451e);}return null;};}function patchUpdates(_0x2c12dc){return function(_0x124566){try{jsonpatch[_0x570f('0x23')](_0x124566,_0x2c12dc,!![]);}catch(_0x206bcd){return BPromise['reject'](_0x206bcd);}return _0x124566[_0x570f('0x24')]();};}function saveUpdates(_0x56c2a3,_0x1b156f){return function(_0x4f29f9){if(_0x4f29f9){return _0x4f29f9[_0x570f('0x25')](_0x56c2a3)[_0x570f('0x26')](function(_0x50ac87){return _0x50ac87;});}return null;};}function removeEntity(_0x2dfc8c,_0x295b3f){return function(_0x17ab28){if(_0x17ab28){return _0x17ab28['destroy']()[_0x570f('0x26')](function(){_0x2dfc8c[_0x570f('0x1a')](0xcc)[_0x570f('0x1b')]();});}};}function handleEntityNotFound(_0x49f4bb,_0x5a9d5b){return function(_0x275357){if(!_0x275357){_0x49f4bb[_0x570f('0x19')](0x194);}return _0x275357;};}function handleError(_0x377032,_0x5eea75){_0x5eea75=_0x5eea75||0x1f4;return function(_0x49d02e){logger[_0x570f('0x27')](_0x49d02e['stack']);if(_0x49d02e['name']){delete _0x49d02e[_0x570f('0x28')];}_0x377032[_0x570f('0x1a')](_0x5eea75)[_0x570f('0x29')](_0x49d02e);};}exports[_0x570f('0x2a')]=function(_0x3a988b,_0x59d936){var _0x5e3ac6={},_0x2b39d2={},_0xbf1aa7={'count':0x0,'rows':[]};var _0x34b765=_[_0x570f('0x2b')](db[_0x570f('0x2c')]['rawAttributes'],function(_0x44f823){return{'name':_0x44f823[_0x570f('0x2d')],'type':_0x44f823[_0x570f('0x2e')]['key']};});_0x2b39d2[_0x570f('0x2f')]=_['map'](_0x34b765,_0x570f('0x28'));_0x2b39d2[_0x570f('0x30')]=_[_0x570f('0x31')](_0x3a988b[_0x570f('0x30')]);_0x2b39d2[_0x570f('0x32')]=_[_0x570f('0x33')](_0x2b39d2[_0x570f('0x2f')],_0x2b39d2[_0x570f('0x30')]);_0x5e3ac6[_0x570f('0x34')]=_[_0x570f('0x33')](_0x2b39d2['model'],qs['fields'](_0x3a988b['query']['fields']));_0x5e3ac6['attributes']=_0x5e3ac6[_0x570f('0x34')]['length']?_0x5e3ac6[_0x570f('0x34')]:_0x2b39d2[_0x570f('0x2f')];if(!_0x3a988b[_0x570f('0x30')][_0x570f('0x35')](_0x570f('0x36'))){_0x5e3ac6['limit']=qs[_0x570f('0x20')](_0x3a988b[_0x570f('0x30')]['limit']);_0x5e3ac6[_0x570f('0x1d')]=qs[_0x570f('0x1d')](_0x3a988b[_0x570f('0x30')]['offset']);}_0x5e3ac6[_0x570f('0x37')]=qs[_0x570f('0x38')](_0x3a988b[_0x570f('0x30')][_0x570f('0x38')]);_0x5e3ac6['where']=qs[_0x570f('0x32')](_[_0x570f('0x39')](_0x3a988b[_0x570f('0x30')],_0x2b39d2['filters']),_0x34b765);if(_0x3a988b[_0x570f('0x30')]['filter']){_0x5e3ac6[_0x570f('0x3a')]=_[_0x570f('0x3b')](_0x5e3ac6[_0x570f('0x3a')],{'$or':_[_0x570f('0x2b')](_0x34b765,function(_0x35ef03){if(_0x35ef03[_0x570f('0x2e')]!==_0x570f('0x3c')){var _0x2fe217={};_0x2fe217[_0x35ef03['name']]={'$like':'%'+_0x3a988b['query'][_0x570f('0x3d')]+'%'};return _0x2fe217;}})});}_0x5e3ac6=_['merge']({},_0x5e3ac6,_0x3a988b[_0x570f('0x3e')]);var _0x13e9a9={'where':_0x5e3ac6['where']};return db[_0x570f('0x2c')][_0x570f('0x1f')](_0x13e9a9)[_0x570f('0x26')](function(_0x5bbc80){_0xbf1aa7[_0x570f('0x1f')]=_0x5bbc80;if(_0x3a988b[_0x570f('0x30')][_0x570f('0x3f')]){_0x5e3ac6[_0x570f('0x40')]=[{'all':!![]}];}return db[_0x570f('0x2c')]['findAll'](_0x5e3ac6);})['then'](function(_0x46c988){_0xbf1aa7[_0x570f('0x41')]=_0x46c988;return _0xbf1aa7;})[_0x570f('0x26')](respondWithFilteredResult(_0x59d936,_0x5e3ac6))[_0x570f('0x42')](handleError(_0x59d936,null));};exports['show']=function(_0x3aa818,_0x1ac050){var _0x28b216={'raw':!![],'where':{'id':_0x3aa818[_0x570f('0x43')]['id']}},_0x3288d7={};_0x3288d7[_0x570f('0x2f')]=_['keys'](db[_0x570f('0x2c')]['rawAttributes']);_0x3288d7[_0x570f('0x30')]=_[_0x570f('0x31')](_0x3aa818[_0x570f('0x30')]);_0x3288d7[_0x570f('0x32')]=_['intersection'](_0x3288d7[_0x570f('0x2f')],_0x3288d7['query']);_0x28b216[_0x570f('0x34')]=_[_0x570f('0x33')](_0x3288d7[_0x570f('0x2f')],qs[_0x570f('0x44')](_0x3aa818[_0x570f('0x30')][_0x570f('0x44')]));_0x28b216[_0x570f('0x34')]=_0x28b216[_0x570f('0x34')][_0x570f('0x45')]?_0x28b216[_0x570f('0x34')]:_0x3288d7['model'];if(_0x3aa818[_0x570f('0x30')][_0x570f('0x3f')]){_0x28b216[_0x570f('0x40')]=[{'all':!![]}];}_0x28b216=_['merge']({},_0x28b216,_0x3aa818[_0x570f('0x3e')]);return db['JscriptyQuestionReport'][_0x570f('0x46')](_0x28b216)[_0x570f('0x26')](handleEntityNotFound(_0x1ac050,null))[_0x570f('0x26')](respondWithResult(_0x1ac050,null))[_0x570f('0x42')](handleError(_0x1ac050,null));};exports[_0x570f('0x47')]=function(_0xa5209f,_0x1dfba3){return db[_0x570f('0x2c')]['create'](_0xa5209f[_0x570f('0x48')],{})[_0x570f('0x26')](respondWithResult(_0x1dfba3,0xc9))[_0x570f('0x42')](handleError(_0x1dfba3,null));};exports[_0x570f('0x25')]=function(_0x318cec,_0x39a0d1){if(_0x318cec[_0x570f('0x48')]['id']){delete _0x318cec[_0x570f('0x48')]['id'];}return db[_0x570f('0x2c')][_0x570f('0x46')]({'where':{'id':_0x318cec[_0x570f('0x43')]['id']}})['then'](handleEntityNotFound(_0x39a0d1,null))[_0x570f('0x26')](saveUpdates(_0x318cec[_0x570f('0x48')],null))[_0x570f('0x26')](respondWithResult(_0x39a0d1,null))[_0x570f('0x42')](handleError(_0x39a0d1,null));};exports[_0x570f('0x49')]=function(_0x4ec29c,_0x2ea7c7){return db[_0x570f('0x2c')][_0x570f('0x46')]({'where':{'id':_0x4ec29c[_0x570f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ea7c7,null))[_0x570f('0x26')](removeEntity(_0x2ea7c7,null))[_0x570f('0x42')](handleError(_0x2ea7c7,null));};exports[_0x570f('0x4a')]=function(_0xf0de43,_0x5299b3){return db[_0x570f('0x2c')]['describe']()[_0x570f('0x26')](respondWithResult(_0x5299b3,null))['catch'](handleError(_0x5299b3,null));}; \ No newline at end of file +var _0xe3c7=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','reject','save','update','then','destroy','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model'];(function(_0x591483,_0x2a82fb){var _0x31d6ea=function(_0x427f35){while(--_0x427f35){_0x591483['push'](_0x591483['shift']());}};_0x31d6ea(++_0x2a82fb);}(_0xe3c7,0x189));var _0x7e3c=function(_0x207db1,_0x19c38c){_0x207db1=_0x207db1-0x0;var _0x3744e1=_0xe3c7[_0x207db1];return _0x3744e1;};'use strict';var emlformat=require(_0x7e3c('0x0'));var rimraf=require(_0x7e3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e3c('0x2'));var moment=require(_0x7e3c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7e3c('0x4'));var util=require(_0x7e3c('0x5'));var path=require(_0x7e3c('0x6'));var sox=require(_0x7e3c('0x7'));var csv=require(_0x7e3c('0x8'));var ejs=require(_0x7e3c('0x9'));var fs=require('fs');var fs_extra=require(_0x7e3c('0xa'));var _=require(_0x7e3c('0xb'));var squel=require(_0x7e3c('0xc'));var crypto=require(_0x7e3c('0xd'));var jsforce=require(_0x7e3c('0xe'));var deskjs=require(_0x7e3c('0xf'));var toCsv=require(_0x7e3c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e3c('0x10'));var authService=require(_0x7e3c('0x11'));var qs=require(_0x7e3c('0x12'));var as=require(_0x7e3c('0x13'));var hardwareService=require(_0x7e3c('0x14'));var logger=require(_0x7e3c('0x15'))('api');var utils=require(_0x7e3c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7e3c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511296,_0xb9a247){_0xb9a247=_0xb9a247||0xcc;return function(_0x1382b8){if(_0x1382b8){return _0x511296[_0x7e3c('0x18')](_0xb9a247);}return _0x511296[_0x7e3c('0x19')](_0xb9a247)[_0x7e3c('0x1a')]();};}function respondWithResult(_0x58928e,_0x278212){_0x278212=_0x278212||0xc8;return function(_0x16b4ef){if(_0x16b4ef){return _0x58928e['status'](_0x278212)[_0x7e3c('0x1b')](_0x16b4ef);}};}function respondWithFilteredResult(_0x1aab93,_0x4e60ca){return function(_0x66677f){if(_0x66677f){var _0x21df76=typeof _0x4e60ca['offset']===_0x7e3c('0x1c')&&typeof _0x4e60ca['limit']==='undefined';var _0x56ed84=_0x66677f[_0x7e3c('0x1d')];var _0x3ea581=_0x21df76?0x0:_0x4e60ca['offset'];var _0x149f8e=_0x21df76?_0x66677f['count']:_0x4e60ca[_0x7e3c('0x1e')]+_0x4e60ca['limit'];var _0x467727;if(_0x149f8e>=_0x56ed84){_0x149f8e=_0x56ed84;_0x467727=0xc8;}else{_0x467727=0xce;}_0x1aab93[_0x7e3c('0x19')](_0x467727);return _0x1aab93[_0x7e3c('0x1f')]('Content-Range',_0x3ea581+'-'+_0x149f8e+'/'+_0x56ed84)['json'](_0x66677f);}return null;};}function patchUpdates(_0x2d0e28){return function(_0x421ede){try{jsonpatch['apply'](_0x421ede,_0x2d0e28,!![]);}catch(_0x3bfb0f){return BPromise[_0x7e3c('0x20')](_0x3bfb0f);}return _0x421ede[_0x7e3c('0x21')]();};}function saveUpdates(_0x2d7040,_0x46c388){return function(_0x5eb84f){if(_0x5eb84f){return _0x5eb84f[_0x7e3c('0x22')](_0x2d7040)[_0x7e3c('0x23')](function(_0x5c6a17){return _0x5c6a17;});}return null;};}function removeEntity(_0x3c08dd,_0x43ec5e){return function(_0x57de91){if(_0x57de91){return _0x57de91[_0x7e3c('0x24')]()[_0x7e3c('0x23')](function(){_0x3c08dd[_0x7e3c('0x19')](0xcc)[_0x7e3c('0x1a')]();});}};}function handleEntityNotFound(_0x29179e,_0x1c4edc){return function(_0x1f7efe){if(!_0x1f7efe){_0x29179e[_0x7e3c('0x18')](0x194);}return _0x1f7efe;};}function handleError(_0x5c95ef,_0x1efa21){_0x1efa21=_0x1efa21||0x1f4;return function(_0x1a6dfe){logger['error'](_0x1a6dfe['stack']);if(_0x1a6dfe[_0x7e3c('0x25')]){delete _0x1a6dfe[_0x7e3c('0x25')];}_0x5c95ef[_0x7e3c('0x19')](_0x1efa21)[_0x7e3c('0x26')](_0x1a6dfe);};}exports['index']=function(_0x566c0b,_0x191a2d){var _0x4ed52f={},_0xbbfc5d={},_0x498695={'count':0x0,'rows':[]};var _0x325876=_[_0x7e3c('0x27')](db[_0x7e3c('0x28')][_0x7e3c('0x29')],function(_0x39478d){return{'name':_0x39478d[_0x7e3c('0x2a')],'type':_0x39478d['type'][_0x7e3c('0x2b')]};});_0xbbfc5d[_0x7e3c('0x2c')]=_[_0x7e3c('0x27')](_0x325876,'name');_0xbbfc5d[_0x7e3c('0x2d')]=_[_0x7e3c('0x2e')](_0x566c0b[_0x7e3c('0x2d')]);_0xbbfc5d[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0xbbfc5d['model'],_0xbbfc5d['query']);_0x4ed52f[_0x7e3c('0x31')]=_[_0x7e3c('0x30')](_0xbbfc5d[_0x7e3c('0x2c')],qs[_0x7e3c('0x32')](_0x566c0b['query']['fields']));_0x4ed52f['attributes']=_0x4ed52f[_0x7e3c('0x31')][_0x7e3c('0x33')]?_0x4ed52f[_0x7e3c('0x31')]:_0xbbfc5d['model'];if(!_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x34')](_0x7e3c('0x35'))){_0x4ed52f[_0x7e3c('0x36')]=qs[_0x7e3c('0x36')](_0x566c0b[_0x7e3c('0x2d')]['limit']);_0x4ed52f[_0x7e3c('0x1e')]=qs[_0x7e3c('0x1e')](_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x1e')]);}_0x4ed52f[_0x7e3c('0x37')]=qs[_0x7e3c('0x38')](_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x38')]);_0x4ed52f['where']=qs[_0x7e3c('0x2f')](_[_0x7e3c('0x39')](_0x566c0b['query'],_0xbbfc5d[_0x7e3c('0x2f')]),_0x325876);if(_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x3a')]){_0x4ed52f[_0x7e3c('0x3b')]=_[_0x7e3c('0x3c')](_0x4ed52f[_0x7e3c('0x3b')],{'$or':_[_0x7e3c('0x27')](_0x325876,function(_0x324862){if(_0x324862[_0x7e3c('0x3d')]!==_0x7e3c('0x3e')){var _0x1f95b7={};_0x1f95b7[_0x324862['name']]={'$like':'%'+_0x566c0b[_0x7e3c('0x2d')]['filter']+'%'};return _0x1f95b7;}})});}_0x4ed52f=_[_0x7e3c('0x3c')]({},_0x4ed52f,_0x566c0b[_0x7e3c('0x3f')]);var _0x200782={'where':_0x4ed52f[_0x7e3c('0x3b')]};return db['JscriptyQuestionReport']['count'](_0x200782)[_0x7e3c('0x23')](function(_0x19934d){_0x498695['count']=_0x19934d;if(_0x566c0b[_0x7e3c('0x2d')][_0x7e3c('0x40')]){_0x4ed52f[_0x7e3c('0x41')]=[{'all':!![]}];}return db[_0x7e3c('0x28')][_0x7e3c('0x42')](_0x4ed52f);})['then'](function(_0x212736){_0x498695['rows']=_0x212736;return _0x498695;})[_0x7e3c('0x23')](respondWithFilteredResult(_0x191a2d,_0x4ed52f))[_0x7e3c('0x43')](handleError(_0x191a2d,null));};exports['show']=function(_0x3e71fa,_0x30c920){var _0x2fd4aa={'raw':!![],'where':{'id':_0x3e71fa[_0x7e3c('0x44')]['id']}},_0x3b1b40={};_0x3b1b40[_0x7e3c('0x2c')]=_[_0x7e3c('0x2e')](db['JscriptyQuestionReport'][_0x7e3c('0x29')]);_0x3b1b40[_0x7e3c('0x2d')]=_[_0x7e3c('0x2e')](_0x3e71fa[_0x7e3c('0x2d')]);_0x3b1b40[_0x7e3c('0x2f')]=_[_0x7e3c('0x30')](_0x3b1b40['model'],_0x3b1b40[_0x7e3c('0x2d')]);_0x2fd4aa[_0x7e3c('0x31')]=_['intersection'](_0x3b1b40[_0x7e3c('0x2c')],qs[_0x7e3c('0x32')](_0x3e71fa[_0x7e3c('0x2d')][_0x7e3c('0x32')]));_0x2fd4aa[_0x7e3c('0x31')]=_0x2fd4aa[_0x7e3c('0x31')][_0x7e3c('0x33')]?_0x2fd4aa['attributes']:_0x3b1b40[_0x7e3c('0x2c')];if(_0x3e71fa[_0x7e3c('0x2d')][_0x7e3c('0x40')]){_0x2fd4aa[_0x7e3c('0x41')]=[{'all':!![]}];}_0x2fd4aa=_['merge']({},_0x2fd4aa,_0x3e71fa[_0x7e3c('0x3f')]);return db[_0x7e3c('0x28')][_0x7e3c('0x45')](_0x2fd4aa)['then'](handleEntityNotFound(_0x30c920,null))[_0x7e3c('0x23')](respondWithResult(_0x30c920,null))[_0x7e3c('0x43')](handleError(_0x30c920,null));};exports[_0x7e3c('0x46')]=function(_0x338c81,_0x19267b){return db['JscriptyQuestionReport'][_0x7e3c('0x46')](_0x338c81[_0x7e3c('0x47')],{})[_0x7e3c('0x23')](respondWithResult(_0x19267b,0xc9))[_0x7e3c('0x43')](handleError(_0x19267b,null));};exports[_0x7e3c('0x22')]=function(_0x57cdba,_0x3040e1){if(_0x57cdba['body']['id']){delete _0x57cdba[_0x7e3c('0x47')]['id'];}return db['JscriptyQuestionReport'][_0x7e3c('0x45')]({'where':{'id':_0x57cdba[_0x7e3c('0x44')]['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x3040e1,null))['then'](saveUpdates(_0x57cdba[_0x7e3c('0x47')],null))[_0x7e3c('0x23')](respondWithResult(_0x3040e1,null))['catch'](handleError(_0x3040e1,null));};exports[_0x7e3c('0x24')]=function(_0x453ce9,_0x2ddc5e){return db['JscriptyQuestionReport'][_0x7e3c('0x45')]({'where':{'id':_0x453ce9['params']['id']}})[_0x7e3c('0x23')](handleEntityNotFound(_0x2ddc5e,null))[_0x7e3c('0x23')](removeEntity(_0x2ddc5e,null))[_0x7e3c('0x43')](handleError(_0x2ddc5e,null));};exports['describe']=function(_0x4a97cc,_0x31ad30){return db[_0x7e3c('0x28')][_0x7e3c('0x48')]()['then'](respondWithResult(_0x31ad30,null))[_0x7e3c('0x43')](handleError(_0x31ad30,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b35a384..d9c7fe2 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 _0x70ba=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment'];(function(_0x2028b9,_0x31ce50){var _0x560506=function(_0x2039c3){while(--_0x2039c3){_0x2028b9['push'](_0x2028b9['shift']());}};_0x560506(++_0x31ce50);}(_0x70ba,0xcd));var _0xa70b=function(_0x155d71,_0x1ec033){_0x155d71=_0x155d71-0x0;var _0x5e8704=_0x70ba[_0x155d71];return _0x5e8704;};'use strict';var _=require(_0xa70b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa70b('0x1'));var moment=require(_0xa70b('0x2'));var BPromise=require(_0xa70b('0x3'));var rp=require(_0xa70b('0x4'));var fs=require('fs');var path=require(_0xa70b('0x5'));var rimraf=require(_0xa70b('0x6'));var config=require(_0xa70b('0x7'));var attributes=require(_0xa70b('0x8'));module[_0xa70b('0x9')]=function(_0x3e7681,_0x4b7010){return _0x3e7681[_0xa70b('0xa')](_0xa70b('0xb'),attributes,{'tableName':_0xa70b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06b9=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','request-promise','path','rimraf'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x06b9,0x132));var _0x906b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x906b('0x0'));var util=require(_0x906b('0x1'));var logger=require('../../config/logger')(_0x906b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x906b('0x3'));var fs=require('fs');var path=require(_0x906b('0x4'));var rimraf=require(_0x906b('0x5'));var config=require(_0x906b('0x6'));var attributes=require(_0x906b('0x7'));module[_0x906b('0x8')]=function(_0x5bf8ce,_0x360a8c){return _0x5bf8ce[_0x906b('0x9')](_0x906b('0xa'),attributes,{'tableName':_0x906b('0xb'),'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 64cdb99..0d1fc82 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 _0xc105=['error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0xc105,0x1ce));var _0x5c10=function(_0x5a6d11,_0x3f443b){_0x5a6d11=_0x5a6d11-0x0;var _0x2512ff=_0xc105[_0x5a6d11];return _0x2512ff;};'use strict';var _=require(_0x5c10('0x0'));var util=require(_0x5c10('0x1'));var moment=require(_0x5c10('0x2'));var BPromise=require(_0x5c10('0x3'));var rs=require(_0x5c10('0x4'));var fs=require('fs');var Redis=require(_0x5c10('0x5'));var db=require(_0x5c10('0x6'))['db'];var utils=require(_0x5c10('0x7'));var logger=require(_0x5c10('0x8'))(_0x5c10('0x9'));var config=require(_0x5c10('0xa'));var jayson=require(_0x5c10('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf89e2b,_0x36bb61,_0x126d8f){return new BPromise(function(_0x288dc7,_0x33b16f){return client[_0x5c10('0xc')](_0xf89e2b,_0x126d8f)[_0x5c10('0xd')](function(_0x473087){logger[_0x5c10('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x36bb61,_0x5c10('0xf'));logger[_0x5c10('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x36bb61,_0x5c10('0xf'),JSON[_0x5c10('0x11')](_0x473087));if(_0x473087[_0x5c10('0x12')]){if(_0x473087['error'][_0x5c10('0x13')]===0x1f4){logger[_0x5c10('0x12')](_0x5c10('0x14'),_0x36bb61,_0x473087['error'][_0x5c10('0x15')]);return _0x33b16f(_0x473087[_0x5c10('0x12')][_0x5c10('0x15')]);}logger['error'](_0x5c10('0x14'),_0x36bb61,_0x473087['error'][_0x5c10('0x15')]);return _0x288dc7(_0x473087[_0x5c10('0x12')][_0x5c10('0x15')]);}else{logger['info'](_0x5c10('0x14'),_0x36bb61,_0x5c10('0xf'));_0x288dc7(_0x473087[_0x5c10('0x16')][_0x5c10('0x15')]);}})[_0x5c10('0x17')](function(_0x2083ee){logger['error'](_0x5c10('0x14'),_0x36bb61,_0x2083ee);_0x33b16f(_0x2083ee);});});} \ No newline at end of file +var _0xd63e=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x4bbf42,_0x4f02dd){var _0x1ce85e=function(_0x463e0e){while(--_0x463e0e){_0x4bbf42['push'](_0x4bbf42['shift']());}};_0x1ce85e(++_0x4f02dd);}(_0xd63e,0xe4));var _0xed63=function(_0x47e780,_0x52a8be){_0x47e780=_0x47e780-0x0;var _0x218c69=_0xd63e[_0x47e780];return _0x218c69;};'use strict';var _=require(_0xed63('0x0'));var util=require('util');var moment=require(_0xed63('0x1'));var BPromise=require(_0xed63('0x2'));var rs=require(_0xed63('0x3'));var fs=require('fs');var Redis=require(_0xed63('0x4'));var db=require(_0xed63('0x5'))['db'];var utils=require(_0xed63('0x6'));var logger=require(_0xed63('0x7'))(_0xed63('0x8'));var config=require(_0xed63('0x9'));var jayson=require(_0xed63('0xa'));var client=jayson[_0xed63('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2e93,_0x3983a4,_0xb1a862){return new BPromise(function(_0x23a935,_0x39fa94){return client[_0xed63('0xc')](_0x4e2e93,_0xb1a862)['then'](function(_0x480286){logger[_0xed63('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3983a4,_0xed63('0xe'));logger[_0xed63('0xf')](_0xed63('0x10'),_0x3983a4,'request\x20sent',JSON[_0xed63('0x11')](_0x480286));if(_0x480286[_0xed63('0x12')]){if(_0x480286[_0xed63('0x12')][_0xed63('0x13')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3983a4,_0x480286[_0xed63('0x12')][_0xed63('0x14')]);return _0x39fa94(_0x480286['error']['message']);}logger[_0xed63('0x12')](_0xed63('0x15'),_0x3983a4,_0x480286['error']['message']);return _0x23a935(_0x480286[_0xed63('0x12')]['message']);}else{logger[_0xed63('0xd')](_0xed63('0x15'),_0x3983a4,'request\x20sent');_0x23a935(_0x480286['result'][_0xed63('0x14')]);}})['catch'](function(_0x32796a){logger[_0xed63('0x12')](_0xed63('0x15'),_0x3983a4,_0x32796a);_0x39fa94(_0x32796a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 35dfbde..8f5947a 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 _0x5806=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id/questions','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5806,0xfb));var _0x6580=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x5806[_0x45fc6a];return _0x14bcfd;};'use strict';var multer=require(_0x6580('0x0'));var util=require(_0x6580('0x1'));var path=require(_0x6580('0x2'));var timeout=require('connect-timeout');var express=require(_0x6580('0x3'));var router=express[_0x6580('0x4')]();var fs_extra=require(_0x6580('0x5'));var auth=require(_0x6580('0x6'));var interaction=require(_0x6580('0x7'));var config=require(_0x6580('0x8'));var controller=require(_0x6580('0x9'));router[_0x6580('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6580('0xa')](_0x6580('0xb'),auth[_0x6580('0xc')](),controller[_0x6580('0xd')]);router[_0x6580('0xa')]('/:id',auth[_0x6580('0xc')](),controller['show']);router['get'](_0x6580('0xe'),auth[_0x6580('0xc')](),controller['getQuestions']);router[_0x6580('0xf')]('/',auth[_0x6580('0xc')](),controller[_0x6580('0x10')]);router[_0x6580('0x11')](_0x6580('0x12'),auth[_0x6580('0xc')](),controller[_0x6580('0x13')]);router[_0x6580('0x14')](_0x6580('0x12'),auth['isAuthenticated'](),controller[_0x6580('0x15')]);module[_0x6580('0x16')]=router; \ No newline at end of file +var _0x6285=['isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','put','update','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x46075c,_0x1befde){var _0x46147d=function(_0xdd64fc){while(--_0xdd64fc){_0x46075c['push'](_0x46075c['shift']());}};_0x46147d(++_0x1befde);}(_0x6285,0x14d));var _0x5628=function(_0x5ea320,_0x10d82e){_0x5ea320=_0x5ea320-0x0;var _0x52ff1f=_0x6285[_0x5ea320];return _0x52ff1f;};'use strict';var multer=require('multer');var util=require(_0x5628('0x0'));var path=require(_0x5628('0x1'));var timeout=require(_0x5628('0x2'));var express=require(_0x5628('0x3'));var router=express['Router']();var fs_extra=require(_0x5628('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5628('0x5'));var config=require(_0x5628('0x6'));var controller=require(_0x5628('0x7'));router[_0x5628('0x8')]('/',auth[_0x5628('0x9')](),controller[_0x5628('0xa')]);router[_0x5628('0x8')](_0x5628('0xb'),auth['isAuthenticated'](),controller[_0x5628('0xc')]);router[_0x5628('0x8')](_0x5628('0xd'),auth[_0x5628('0x9')](),controller[_0x5628('0xe')]);router[_0x5628('0x8')](_0x5628('0xf'),auth[_0x5628('0x9')](),controller['getQuestions']);router[_0x5628('0x10')]('/',auth[_0x5628('0x9')](),controller['create']);router[_0x5628('0x11')](_0x5628('0xd'),auth[_0x5628('0x9')](),controller[_0x5628('0x12')]);router['delete'](_0x5628('0xd'),auth[_0x5628('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 851dd09..38e106d 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 _0x8b6b=['setDataValue','starttime','endtime','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0x55ddb1,_0x3b6ca2){var _0x56337d=function(_0xf2b4c4){while(--_0xf2b4c4){_0x55ddb1['push'](_0x55ddb1['shift']());}};_0x56337d(++_0x3b6ca2);}(_0x8b6b,0x13d));var _0xb8b6=function(_0x4a7bac,_0x1a8719){_0x4a7bac=_0x4a7bac-0x0;var _0x284a73=_0x8b6b[_0x4a7bac];return _0x284a73;};'use strict';var moment=require('moment');var Sequelize=require(_0xb8b6('0x0'));module[_0xb8b6('0x1')]={'starttime':{'type':Sequelize[_0xb8b6('0x2')],'set':function(_0x8aff99){this[_0xb8b6('0x3')](_0xb8b6('0x4'),_0x8aff99);this[_0xb8b6('0x3')](_0xb8b6('0x5'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xb8b6('0x2')]},'membername':{'type':Sequelize[_0xb8b6('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb8b6('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb8b6('0x6')]},'completed':{'type':Sequelize[_0xb8b6('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9096=['STRING','BOOLEAN','setDataValue','starttime','format','DATE'];(function(_0x30ea90,_0x12f157){var _0x3b0a93=function(_0x3ba21a){while(--_0x3ba21a){_0x30ea90['push'](_0x30ea90['shift']());}};_0x3b0a93(++_0x12f157);}(_0x9096,0x176));var _0x6909=function(_0x56f92c,_0x1275f1){_0x56f92c=_0x56f92c-0x0;var _0x151e03=_0x9096[_0x56f92c];return _0x151e03;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5232c3){this[_0x6909('0x0')](_0x6909('0x1'),_0x5232c3);this['setDataValue']('endtime',moment()[_0x6909('0x2')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x6909('0x3')]},'membername':{'type':Sequelize[_0x6909('0x4')]},'projectname':{'type':Sequelize[_0x6909('0x4')]},'queue':{'type':Sequelize[_0x6909('0x4')]},'uniqueid':{'type':Sequelize[_0x6909('0x4')]},'calleridname':{'type':Sequelize[_0x6909('0x4')]},'calleridnum':{'type':Sequelize[_0x6909('0x4')]},'completed':{'type':Sequelize[_0x6909('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bb9c903..94a1aa1 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 _0x8df8=['getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe'];(function(_0x26ddbf,_0x38a762){var _0x119938=function(_0x2bd128){while(--_0x2bd128){_0x26ddbf['push'](_0x26ddbf['shift']());}};_0x119938(++_0x38a762);}(_0x8df8,0x1f0));var _0x88df=function(_0x4fffcf,_0x49b324){_0x4fffcf=_0x4fffcf-0x0;var _0x544752=_0x8df8[_0x4fffcf];return _0x544752;};'use strict';var emlformat=require(_0x88df('0x0'));var rimraf=require(_0x88df('0x1'));var zipdir=require(_0x88df('0x2'));var jsonpatch=require(_0x88df('0x3'));var rp=require(_0x88df('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x88df('0x5'));var util=require(_0x88df('0x6'));var path=require('path');var sox=require(_0x88df('0x7'));var csv=require(_0x88df('0x8'));var ejs=require(_0x88df('0x9'));var fs=require('fs');var fs_extra=require(_0x88df('0xa'));var _=require(_0x88df('0xb'));var squel=require(_0x88df('0xc'));var crypto=require(_0x88df('0xd'));var jsforce=require(_0x88df('0xe'));var deskjs=require(_0x88df('0xf'));var toCsv=require(_0x88df('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x88df('0x10'));var authService=require(_0x88df('0x11'));var qs=require(_0x88df('0x12'));var as=require(_0x88df('0x13'));var hardwareService=require(_0x88df('0x14'));var logger=require(_0x88df('0x15'))(_0x88df('0x16'));var utils=require(_0x88df('0x17'));var config=require(_0x88df('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3028c9,_0x45ae3e){_0x45ae3e=_0x45ae3e||0xcc;return function(_0x388206){if(_0x388206){return _0x3028c9[_0x88df('0x19')](_0x45ae3e);}return _0x3028c9[_0x88df('0x1a')](_0x45ae3e)[_0x88df('0x1b')]();};}function respondWithResult(_0x4af69a,_0x3b33bc){_0x3b33bc=_0x3b33bc||0xc8;return function(_0x425368){if(_0x425368){return _0x4af69a[_0x88df('0x1a')](_0x3b33bc)['json'](_0x425368);}};}function respondWithFilteredResult(_0x5d6746,_0x2f08e4){return function(_0x35ddf1){if(_0x35ddf1){var _0x4d81ab=typeof _0x2f08e4[_0x88df('0x1c')]==='undefined'&&typeof _0x2f08e4[_0x88df('0x1d')]===_0x88df('0x1e');var _0x2d17ef=_0x35ddf1[_0x88df('0x1f')];var _0x3a43e7=_0x4d81ab?0x0:_0x2f08e4['offset'];var _0x517321=_0x4d81ab?_0x35ddf1[_0x88df('0x1f')]:_0x2f08e4[_0x88df('0x1c')]+_0x2f08e4[_0x88df('0x1d')];var _0x17fc1a;if(_0x517321>=_0x2d17ef){_0x517321=_0x2d17ef;_0x17fc1a=0xc8;}else{_0x17fc1a=0xce;}_0x5d6746[_0x88df('0x1a')](_0x17fc1a);return _0x5d6746[_0x88df('0x20')](_0x88df('0x21'),_0x3a43e7+'-'+_0x517321+'/'+_0x2d17ef)[_0x88df('0x22')](_0x35ddf1);}return null;};}function patchUpdates(_0x31e440){return function(_0x40b04c){try{jsonpatch[_0x88df('0x23')](_0x40b04c,_0x31e440,!![]);}catch(_0x1c7da8){return BPromise['reject'](_0x1c7da8);}return _0x40b04c[_0x88df('0x24')]();};}function saveUpdates(_0x1eca4a,_0x42bb58){return function(_0x569e90){if(_0x569e90){return _0x569e90['update'](_0x1eca4a)[_0x88df('0x25')](function(_0x2ec563){return _0x2ec563;});}return null;};}function removeEntity(_0x1cb53c,_0x675998){return function(_0x109fff){if(_0x109fff){return _0x109fff[_0x88df('0x26')]()['then'](function(){_0x1cb53c['status'](0xcc)[_0x88df('0x1b')]();});}};}function handleEntityNotFound(_0x1b9b86,_0xdd8082){return function(_0x5af774){if(!_0x5af774){_0x1b9b86[_0x88df('0x19')](0x194);}return _0x5af774;};}function handleError(_0x351c7e,_0x45647e){_0x45647e=_0x45647e||0x1f4;return function(_0x318ad4){logger[_0x88df('0x27')](_0x318ad4[_0x88df('0x28')]);if(_0x318ad4[_0x88df('0x29')]){delete _0x318ad4['name'];}_0x351c7e[_0x88df('0x1a')](_0x45647e)[_0x88df('0x2a')](_0x318ad4);};}exports['index']=function(_0x5a2565,_0x24f4f3){var _0x4e9e66={},_0x37f4ec={},_0x3391c2={'count':0x0,'rows':[]};var _0x2a1090=_['map'](db['JscriptySessionReport'][_0x88df('0x2b')],function(_0x176335){return{'name':_0x176335[_0x88df('0x2c')],'type':_0x176335[_0x88df('0x2d')][_0x88df('0x2e')]};});_0x37f4ec[_0x88df('0x2f')]=_[_0x88df('0x30')](_0x2a1090,_0x88df('0x29'));_0x37f4ec[_0x88df('0x31')]=_[_0x88df('0x32')](_0x5a2565['query']);_0x37f4ec[_0x88df('0x33')]=_[_0x88df('0x34')](_0x37f4ec['model'],_0x37f4ec[_0x88df('0x31')]);_0x4e9e66['attributes']=_[_0x88df('0x34')](_0x37f4ec[_0x88df('0x2f')],qs[_0x88df('0x35')](_0x5a2565[_0x88df('0x31')][_0x88df('0x35')]));_0x4e9e66['attributes']=_0x4e9e66[_0x88df('0x36')]['length']?_0x4e9e66['attributes']:_0x37f4ec['model'];if(!_0x5a2565[_0x88df('0x31')][_0x88df('0x37')](_0x88df('0x38'))){_0x4e9e66[_0x88df('0x1d')]=qs['limit'](_0x5a2565[_0x88df('0x31')][_0x88df('0x1d')]);_0x4e9e66[_0x88df('0x1c')]=qs[_0x88df('0x1c')](_0x5a2565['query'][_0x88df('0x1c')]);}_0x4e9e66[_0x88df('0x39')]=qs[_0x88df('0x3a')](_0x5a2565[_0x88df('0x31')][_0x88df('0x3a')]);_0x4e9e66['where']=qs['filters'](_[_0x88df('0x3b')](_0x5a2565['query'],_0x37f4ec[_0x88df('0x33')]),_0x2a1090);if(_0x5a2565[_0x88df('0x31')]['filter']){_0x4e9e66[_0x88df('0x3c')]=_['merge'](_0x4e9e66[_0x88df('0x3c')],{'$or':_[_0x88df('0x30')](_0x2a1090,function(_0x47f669){if(_0x47f669[_0x88df('0x2d')]!==_0x88df('0x3d')){var _0x13b6f1={};_0x13b6f1[_0x47f669[_0x88df('0x29')]]={'$like':'%'+_0x5a2565[_0x88df('0x31')][_0x88df('0x3e')]+'%'};return _0x13b6f1;}})});}_0x4e9e66=_[_0x88df('0x3f')]({},_0x4e9e66,_0x5a2565[_0x88df('0x40')]);var _0x25e498={'where':_0x4e9e66[_0x88df('0x3c')]};return db[_0x88df('0x41')][_0x88df('0x1f')](_0x25e498)['then'](function(_0x357202){_0x3391c2['count']=_0x357202;if(_0x5a2565[_0x88df('0x31')][_0x88df('0x42')]){_0x4e9e66[_0x88df('0x43')]=[{'all':!![]}];}return db[_0x88df('0x41')][_0x88df('0x44')](_0x4e9e66);})[_0x88df('0x25')](function(_0x202c1a){_0x3391c2[_0x88df('0x45')]=_0x202c1a;return _0x3391c2;})['then'](respondWithFilteredResult(_0x24f4f3,_0x4e9e66))['catch'](handleError(_0x24f4f3,null));};exports[_0x88df('0x46')]=function(_0x5cac6c,_0x163642){var _0x23e0fc={'raw':!![],'where':{'id':_0x5cac6c[_0x88df('0x47')]['id']}},_0x454ac4={};_0x454ac4[_0x88df('0x2f')]=_['keys'](db[_0x88df('0x41')][_0x88df('0x2b')]);_0x454ac4[_0x88df('0x31')]=_['keys'](_0x5cac6c[_0x88df('0x31')]);_0x454ac4[_0x88df('0x33')]=_[_0x88df('0x34')](_0x454ac4['model'],_0x454ac4[_0x88df('0x31')]);_0x23e0fc['attributes']=_[_0x88df('0x34')](_0x454ac4[_0x88df('0x2f')],qs[_0x88df('0x35')](_0x5cac6c[_0x88df('0x31')][_0x88df('0x35')]));_0x23e0fc[_0x88df('0x36')]=_0x23e0fc[_0x88df('0x36')]['length']?_0x23e0fc[_0x88df('0x36')]:_0x454ac4[_0x88df('0x2f')];if(_0x5cac6c[_0x88df('0x31')][_0x88df('0x42')]){_0x23e0fc[_0x88df('0x43')]=[{'all':!![]}];}_0x23e0fc=_['merge']({},_0x23e0fc,_0x5cac6c[_0x88df('0x40')]);return db[_0x88df('0x41')][_0x88df('0x48')](_0x23e0fc)[_0x88df('0x25')](handleEntityNotFound(_0x163642,null))[_0x88df('0x25')](respondWithResult(_0x163642,null))[_0x88df('0x49')](handleError(_0x163642,null));};exports[_0x88df('0x4a')]=function(_0x20391f,_0x5639e1){return db[_0x88df('0x41')][_0x88df('0x4a')](_0x20391f[_0x88df('0x4b')],{})[_0x88df('0x25')](respondWithResult(_0x5639e1,0xc9))[_0x88df('0x49')](handleError(_0x5639e1,null));};exports[_0x88df('0x4c')]=function(_0xae27ae,_0x3f7aa9){if(_0xae27ae[_0x88df('0x4b')]['id']){delete _0xae27ae[_0x88df('0x4b')]['id'];}return db[_0x88df('0x41')][_0x88df('0x48')]({'where':{'id':_0xae27ae[_0x88df('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f7aa9,null))['then'](saveUpdates(_0xae27ae[_0x88df('0x4b')],null))[_0x88df('0x25')](respondWithResult(_0x3f7aa9,null))[_0x88df('0x49')](handleError(_0x3f7aa9,null));};exports[_0x88df('0x26')]=function(_0x2a9c7f,_0xefc0cf){return db['JscriptySessionReport'][_0x88df('0x48')]({'where':{'id':_0x2a9c7f[_0x88df('0x47')]['id']}})['then'](handleEntityNotFound(_0xefc0cf,null))[_0x88df('0x25')](removeEntity(_0xefc0cf,null))[_0x88df('0x49')](handleError(_0xefc0cf,null));};exports[_0x88df('0x4d')]=function(_0x1379f6,_0x53f191){return db[_0x88df('0x41')]['describe']()[_0x88df('0x25')](respondWithResult(_0x53f191,null))['catch'](handleError(_0x53f191,null));};exports[_0x88df('0x4e')]=function(_0x4839c0,_0x1bf86c,_0x17a9d8){var _0x59b648={'raw':!![],'where':{}};var _0x274bd1={};var _0x43f03c={'count':0x0,'rows':[]};return db[_0x88df('0x41')][_0x88df('0x4f')]({'where':{'id':_0x4839c0['params']['id']}})[_0x88df('0x25')](handleEntityNotFound(_0x1bf86c,null))[_0x88df('0x25')](function(_0x26ee67){if(_0x26ee67){_0x274bd1[_0x88df('0x2f')]=_[_0x88df('0x32')](db[_0x88df('0x50')][_0x88df('0x2b')]);_0x274bd1['query']=_[_0x88df('0x32')](_0x4839c0['query']);_0x274bd1[_0x88df('0x33')]=_[_0x88df('0x34')](_0x274bd1['model'],_0x274bd1['query']);_0x59b648[_0x88df('0x36')]=_[_0x88df('0x34')](_0x274bd1[_0x88df('0x2f')],qs[_0x88df('0x35')](_0x4839c0[_0x88df('0x31')][_0x88df('0x35')]));_0x59b648[_0x88df('0x36')]=_0x59b648[_0x88df('0x36')]['length']?_0x59b648[_0x88df('0x36')]:_0x274bd1[_0x88df('0x2f')];if(!_0x4839c0[_0x88df('0x31')]['hasOwnProperty'](_0x88df('0x38'))){_0x59b648[_0x88df('0x1d')]=qs[_0x88df('0x1d')](_0x4839c0[_0x88df('0x31')][_0x88df('0x1d')]);_0x59b648[_0x88df('0x1c')]=qs[_0x88df('0x1c')](_0x4839c0[_0x88df('0x31')][_0x88df('0x1c')]);}_0x59b648[_0x88df('0x39')]=qs[_0x88df('0x3a')](_0x4839c0[_0x88df('0x31')][_0x88df('0x3a')]);_0x59b648[_0x88df('0x3c')]=qs[_0x88df('0x33')](_[_0x88df('0x3b')](_0x4839c0[_0x88df('0x31')],_0x274bd1[_0x88df('0x33')]));_0x59b648[_0x88df('0x3c')][_0x88df('0x51')]=_0x26ee67['id'];if(_0x4839c0['query'][_0x88df('0x3e')]){_0x59b648[_0x88df('0x3c')]=_['merge'](_0x59b648[_0x88df('0x3c')],{'$or':_[_0x88df('0x30')](_0x59b648['attributes'],function(_0x53d4fe){var _0x393a55={};_0x393a55[_0x53d4fe]={'$like':'%'+_0x4839c0[_0x88df('0x31')][_0x88df('0x3e')]+'%'};return _0x393a55;})});}_0x59b648=_['merge']({},_0x59b648,_0x4839c0[_0x88df('0x40')]);return db[_0x88df('0x50')]['count']({'where':_0x59b648[_0x88df('0x3c')]})[_0x88df('0x25')](function(_0xeea123){_0x43f03c[_0x88df('0x1f')]=_0xeea123;if(_0x4839c0['query'][_0x88df('0x42')]){_0x59b648[_0x88df('0x43')]=[{'all':!![]}];}return db[_0x88df('0x50')][_0x88df('0x44')](_0x59b648);})[_0x88df('0x25')](function(_0x46c033){_0x43f03c[_0x88df('0x45')]=_0x46c033;return _0x43f03c;});}})['then'](respondWithFilteredResult(_0x1bf86c,_0x59b648))[_0x88df('0x49')](handleError(_0x1bf86c,null));}; \ No newline at end of file +var _0xc535=['create','body','describe','getQuestions','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','name','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x3ab77c,_0x57f557){var _0x35e4f3=function(_0xb9a8d0){while(--_0xb9a8d0){_0x3ab77c['push'](_0x3ab77c['shift']());}};_0x35e4f3(++_0x57f557);}(_0xc535,0x9b));var _0x5c53=function(_0x816052,_0x13cd7b){_0x816052=_0x816052-0x0;var _0x582c1e=_0xc535[_0x816052];return _0x582c1e;};'use strict';var emlformat=require(_0x5c53('0x0'));var rimraf=require(_0x5c53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5c53('0x2'));var moment=require('moment');var BPromise=require(_0x5c53('0x3'));var Mustache=require('mustache');var util=require(_0x5c53('0x4'));var path=require(_0x5c53('0x5'));var sox=require(_0x5c53('0x6'));var csv=require(_0x5c53('0x7'));var ejs=require(_0x5c53('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c53('0x9'));var squel=require('squel');var crypto=require(_0x5c53('0xa'));var jsforce=require(_0x5c53('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5c53('0x7'));var querystring=require(_0x5c53('0xc'));var Papa=require(_0x5c53('0xd'));var Redis=require(_0x5c53('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5c53('0xf'));var as=require(_0x5c53('0x10'));var hardwareService=require(_0x5c53('0x11'));var logger=require('../../config/logger')(_0x5c53('0x12'));var utils=require(_0x5c53('0x13'));var config=require(_0x5c53('0x14'));var licenseUtil=require(_0x5c53('0x15'));var db=require(_0x5c53('0x16'))['db'];function respondWithStatusCode(_0x22303e,_0x3b418e){_0x3b418e=_0x3b418e||0xcc;return function(_0x306183){if(_0x306183){return _0x22303e[_0x5c53('0x17')](_0x3b418e);}return _0x22303e[_0x5c53('0x18')](_0x3b418e)[_0x5c53('0x19')]();};}function respondWithResult(_0x31435d,_0x19de84){_0x19de84=_0x19de84||0xc8;return function(_0x215ba5){if(_0x215ba5){return _0x31435d['status'](_0x19de84)['json'](_0x215ba5);}};}function respondWithFilteredResult(_0x43a995,_0x281003){return function(_0x5addeb){if(_0x5addeb){var _0x4f1ce1=typeof _0x281003[_0x5c53('0x1a')]===_0x5c53('0x1b')&&typeof _0x281003[_0x5c53('0x1c')]===_0x5c53('0x1b');var _0x1ef806=_0x5addeb[_0x5c53('0x1d')];var _0x817247=_0x4f1ce1?0x0:_0x281003[_0x5c53('0x1a')];var _0x4d6ffc=_0x4f1ce1?_0x5addeb[_0x5c53('0x1d')]:_0x281003['offset']+_0x281003[_0x5c53('0x1c')];var _0x2df8ab;if(_0x4d6ffc>=_0x1ef806){_0x4d6ffc=_0x1ef806;_0x2df8ab=0xc8;}else{_0x2df8ab=0xce;}_0x43a995[_0x5c53('0x18')](_0x2df8ab);return _0x43a995[_0x5c53('0x1e')](_0x5c53('0x1f'),_0x817247+'-'+_0x4d6ffc+'/'+_0x1ef806)[_0x5c53('0x20')](_0x5addeb);}return null;};}function patchUpdates(_0x24c6fe){return function(_0x1c623a){try{jsonpatch['apply'](_0x1c623a,_0x24c6fe,!![]);}catch(_0x2c5ccc){return BPromise['reject'](_0x2c5ccc);}return _0x1c623a[_0x5c53('0x21')]();};}function saveUpdates(_0x43941d,_0x193f40){return function(_0x205d32){if(_0x205d32){return _0x205d32[_0x5c53('0x22')](_0x43941d)[_0x5c53('0x23')](function(_0x3a7589){return _0x3a7589;});}return null;};}function removeEntity(_0x1e49fe,_0x3bc39d){return function(_0x2b1959){if(_0x2b1959){return _0x2b1959[_0x5c53('0x24')]()[_0x5c53('0x23')](function(){_0x1e49fe[_0x5c53('0x18')](0xcc)[_0x5c53('0x19')]();});}};}function handleEntityNotFound(_0x14a7cc,_0x16d62c){return function(_0x524494){if(!_0x524494){_0x14a7cc[_0x5c53('0x17')](0x194);}return _0x524494;};}function handleError(_0x513b1a,_0x589e99){_0x589e99=_0x589e99||0x1f4;return function(_0x15e147){logger['error'](_0x15e147['stack']);if(_0x15e147[_0x5c53('0x25')]){delete _0x15e147['name'];}_0x513b1a['status'](_0x589e99)['send'](_0x15e147);};}exports['index']=function(_0x4db171,_0x2862e5){var _0x27c5f5={},_0x254029={},_0x1cccc6={'count':0x0,'rows':[]};var _0x537812=_[_0x5c53('0x26')](db[_0x5c53('0x27')][_0x5c53('0x28')],function(_0x5b476e){return{'name':_0x5b476e[_0x5c53('0x29')],'type':_0x5b476e[_0x5c53('0x2a')]['key']};});_0x254029[_0x5c53('0x2b')]=_[_0x5c53('0x26')](_0x537812,_0x5c53('0x25'));_0x254029[_0x5c53('0x2c')]=_[_0x5c53('0x2d')](_0x4db171['query']);_0x254029[_0x5c53('0x2e')]=_[_0x5c53('0x2f')](_0x254029[_0x5c53('0x2b')],_0x254029[_0x5c53('0x2c')]);_0x27c5f5[_0x5c53('0x30')]=_[_0x5c53('0x2f')](_0x254029[_0x5c53('0x2b')],qs[_0x5c53('0x31')](_0x4db171['query'][_0x5c53('0x31')]));_0x27c5f5[_0x5c53('0x30')]=_0x27c5f5[_0x5c53('0x30')]['length']?_0x27c5f5[_0x5c53('0x30')]:_0x254029[_0x5c53('0x2b')];if(!_0x4db171[_0x5c53('0x2c')][_0x5c53('0x32')](_0x5c53('0x33'))){_0x27c5f5['limit']=qs[_0x5c53('0x1c')](_0x4db171[_0x5c53('0x2c')][_0x5c53('0x1c')]);_0x27c5f5[_0x5c53('0x1a')]=qs[_0x5c53('0x1a')](_0x4db171[_0x5c53('0x2c')][_0x5c53('0x1a')]);}_0x27c5f5[_0x5c53('0x34')]=qs['sort'](_0x4db171[_0x5c53('0x2c')][_0x5c53('0x35')]);_0x27c5f5['where']=qs[_0x5c53('0x2e')](_['pick'](_0x4db171['query'],_0x254029[_0x5c53('0x2e')]),_0x537812);if(_0x4db171['query'][_0x5c53('0x36')]){_0x27c5f5[_0x5c53('0x37')]=_[_0x5c53('0x38')](_0x27c5f5[_0x5c53('0x37')],{'$or':_[_0x5c53('0x26')](_0x537812,function(_0x145a18){if(_0x145a18[_0x5c53('0x2a')]!==_0x5c53('0x39')){var _0x7e6bf4={};_0x7e6bf4[_0x145a18[_0x5c53('0x25')]]={'$like':'%'+_0x4db171['query'][_0x5c53('0x36')]+'%'};return _0x7e6bf4;}})});}_0x27c5f5=_[_0x5c53('0x38')]({},_0x27c5f5,_0x4db171[_0x5c53('0x3a')]);var _0x2dce6d={'where':_0x27c5f5[_0x5c53('0x37')]};return db[_0x5c53('0x27')][_0x5c53('0x1d')](_0x2dce6d)[_0x5c53('0x23')](function(_0x3bf18c){_0x1cccc6[_0x5c53('0x1d')]=_0x3bf18c;if(_0x4db171[_0x5c53('0x2c')][_0x5c53('0x3b')]){_0x27c5f5['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x5c53('0x3c')](_0x27c5f5);})[_0x5c53('0x23')](function(_0x6b30b4){_0x1cccc6[_0x5c53('0x3d')]=_0x6b30b4;return _0x1cccc6;})[_0x5c53('0x23')](respondWithFilteredResult(_0x2862e5,_0x27c5f5))[_0x5c53('0x3e')](handleError(_0x2862e5,null));};exports[_0x5c53('0x3f')]=function(_0x532933,_0x4c893f){var _0x6adfb2={'raw':!![],'where':{'id':_0x532933[_0x5c53('0x40')]['id']}},_0x197099={};_0x197099[_0x5c53('0x2b')]=_[_0x5c53('0x2d')](db[_0x5c53('0x27')][_0x5c53('0x28')]);_0x197099[_0x5c53('0x2c')]=_[_0x5c53('0x2d')](_0x532933['query']);_0x197099[_0x5c53('0x2e')]=_[_0x5c53('0x2f')](_0x197099[_0x5c53('0x2b')],_0x197099[_0x5c53('0x2c')]);_0x6adfb2[_0x5c53('0x30')]=_[_0x5c53('0x2f')](_0x197099[_0x5c53('0x2b')],qs[_0x5c53('0x31')](_0x532933[_0x5c53('0x2c')][_0x5c53('0x31')]));_0x6adfb2[_0x5c53('0x30')]=_0x6adfb2[_0x5c53('0x30')]['length']?_0x6adfb2['attributes']:_0x197099['model'];if(_0x532933['query']['includeAll']){_0x6adfb2[_0x5c53('0x41')]=[{'all':!![]}];}_0x6adfb2=_[_0x5c53('0x38')]({},_0x6adfb2,_0x532933[_0x5c53('0x3a')]);return db[_0x5c53('0x27')][_0x5c53('0x42')](_0x6adfb2)[_0x5c53('0x23')](handleEntityNotFound(_0x4c893f,null))[_0x5c53('0x23')](respondWithResult(_0x4c893f,null))['catch'](handleError(_0x4c893f,null));};exports[_0x5c53('0x43')]=function(_0x2246da,_0x27ef84){return db[_0x5c53('0x27')][_0x5c53('0x43')](_0x2246da['body'],{})[_0x5c53('0x23')](respondWithResult(_0x27ef84,0xc9))[_0x5c53('0x3e')](handleError(_0x27ef84,null));};exports[_0x5c53('0x22')]=function(_0x154c6a,_0x51c8a0){if(_0x154c6a[_0x5c53('0x44')]['id']){delete _0x154c6a[_0x5c53('0x44')]['id'];}return db[_0x5c53('0x27')][_0x5c53('0x42')]({'where':{'id':_0x154c6a['params']['id']}})[_0x5c53('0x23')](handleEntityNotFound(_0x51c8a0,null))[_0x5c53('0x23')](saveUpdates(_0x154c6a[_0x5c53('0x44')],null))[_0x5c53('0x23')](respondWithResult(_0x51c8a0,null))[_0x5c53('0x3e')](handleError(_0x51c8a0,null));};exports['destroy']=function(_0x7ccd08,_0xb181f7){return db[_0x5c53('0x27')][_0x5c53('0x42')]({'where':{'id':_0x7ccd08[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0xb181f7,null))[_0x5c53('0x23')](removeEntity(_0xb181f7,null))[_0x5c53('0x3e')](handleError(_0xb181f7,null));};exports['describe']=function(_0x22f995,_0xc76858){return db[_0x5c53('0x27')][_0x5c53('0x45')]()['then'](respondWithResult(_0xc76858,null))[_0x5c53('0x3e')](handleError(_0xc76858,null));};exports[_0x5c53('0x46')]=function(_0x4aeb61,_0x4662c8,_0x233d4d){var _0x1cb455={'raw':!![],'where':{}};var _0x479b8d={};var _0x5d5a8a={'count':0x0,'rows':[]};return db[_0x5c53('0x27')]['findOne']({'where':{'id':_0x4aeb61[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0x4662c8,null))['then'](function(_0x33b3e6){if(_0x33b3e6){_0x479b8d[_0x5c53('0x2b')]=_[_0x5c53('0x2d')](db[_0x5c53('0x47')][_0x5c53('0x28')]);_0x479b8d[_0x5c53('0x2c')]=_['keys'](_0x4aeb61[_0x5c53('0x2c')]);_0x479b8d[_0x5c53('0x2e')]=_[_0x5c53('0x2f')](_0x479b8d[_0x5c53('0x2b')],_0x479b8d['query']);_0x1cb455['attributes']=_[_0x5c53('0x2f')](_0x479b8d['model'],qs[_0x5c53('0x31')](_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x31')]));_0x1cb455['attributes']=_0x1cb455['attributes']['length']?_0x1cb455[_0x5c53('0x30')]:_0x479b8d['model'];if(!_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x32')](_0x5c53('0x33'))){_0x1cb455[_0x5c53('0x1c')]=qs['limit'](_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x1c')]);_0x1cb455[_0x5c53('0x1a')]=qs[_0x5c53('0x1a')](_0x4aeb61[_0x5c53('0x2c')]['offset']);}_0x1cb455['order']=qs[_0x5c53('0x35')](_0x4aeb61['query'][_0x5c53('0x35')]);_0x1cb455['where']=qs['filters'](_[_0x5c53('0x48')](_0x4aeb61['query'],_0x479b8d[_0x5c53('0x2e')]));_0x1cb455['where'][_0x5c53('0x49')]=_0x33b3e6['id'];if(_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x36')]){_0x1cb455[_0x5c53('0x37')]=_[_0x5c53('0x38')](_0x1cb455[_0x5c53('0x37')],{'$or':_[_0x5c53('0x26')](_0x1cb455[_0x5c53('0x30')],function(_0x53513f){var _0x31ea43={};_0x31ea43[_0x53513f]={'$like':'%'+_0x4aeb61['query'][_0x5c53('0x36')]+'%'};return _0x31ea43;})});}_0x1cb455=_['merge']({},_0x1cb455,_0x4aeb61[_0x5c53('0x3a')]);return db[_0x5c53('0x47')][_0x5c53('0x1d')]({'where':_0x1cb455[_0x5c53('0x37')]})['then'](function(_0xa2e162){_0x5d5a8a[_0x5c53('0x1d')]=_0xa2e162;if(_0x4aeb61[_0x5c53('0x2c')][_0x5c53('0x3b')]){_0x1cb455[_0x5c53('0x41')]=[{'all':!![]}];}return db[_0x5c53('0x47')][_0x5c53('0x3c')](_0x1cb455);})['then'](function(_0x3e021f){_0x5d5a8a[_0x5c53('0x3d')]=_0x3e021f;return _0x5d5a8a;});}})['then'](respondWithFilteredResult(_0x4662c8,_0x1cb455))[_0x5c53('0x3e')](handleError(_0x4662c8,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0dc71d7..463e205 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash'];(function(_0x1a219d,_0x4b232c){var _0x56cf0d=function(_0x5edc25){while(--_0x5edc25){_0x1a219d['push'](_0x1a219d['shift']());}};_0x56cf0d(++_0x4b232c);}(_0x5496,0x175));var _0x6549=function(_0x2d1f16,_0x263565){_0x2d1f16=_0x2d1f16-0x0;var _0x2992c8=_0x5496[_0x2d1f16];return _0x2992c8;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions'];(function(_0x2c1629,_0x2b0606){var _0x3a1406=function(_0x293a44){while(--_0x293a44){_0x2c1629['push'](_0x2c1629['shift']());}};_0x3a1406(++_0x2b0606);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x5fc3[_0x5416db];return _0x243e35;};'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')]('JscriptySessionReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6da27a9..35fff1a 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 _0x4c60=['client','http','request','then','debug','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise'];(function(_0x4b1173,_0x3bd17e){var _0x535050=function(_0x28a7b5){while(--_0x28a7b5){_0x4b1173['push'](_0x4b1173['shift']());}};_0x535050(++_0x3bd17e);}(_0x4c60,0xc1));var _0x04c6=function(_0x5c832a,_0x1495d9){_0x5c832a=_0x5c832a-0x0;var _0x1ffacc=_0x4c60[_0x5c832a];return _0x1ffacc;};'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']('JscriptySessionReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('JscriptySessionReport,\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 +var _0xbff5=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbff5,0x1bc));var _0x5bff=function(_0x455ffc,_0xefa00){_0x455ffc=_0x455ffc-0x0;var _0x21f440=_0xbff5[_0x455ffc];return _0x21f440;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3233bdd..4554e69 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 _0x3a22=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','update','/download_log_file','isAuthenticated','exports','multer'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x3a22,0x11c));var _0x23a2=function(_0xdb61b6,_0x500152){_0xdb61b6=_0xdb61b6-0x0;var _0x4a9c61=_0x3a22[_0xdb61b6];return _0x4a9c61;};'use strict';var multer=require(_0x23a2('0x0'));var util=require(_0x23a2('0x1'));var path=require(_0x23a2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x23a2('0x3')]();var fs_extra=require(_0x23a2('0x4'));var auth=require(_0x23a2('0x5'));var interaction=require(_0x23a2('0x6'));var config=require(_0x23a2('0x7'));var controller=require('./license.controller');router[_0x23a2('0x8')]('/',controller[_0x23a2('0x9')]);router['put'](_0x23a2('0xa'),auth['isAuthenticated'](),controller[_0x23a2('0xb')]);router[_0x23a2('0x8')](_0x23a2('0xc'),auth[_0x23a2('0xd')](),controller['downloadLogFile']);module[_0x23a2('0xe')]=router; \ No newline at end of file +var _0x24c2=['isAuthenticated','update','/download_log_file','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','index','put','/:id'];(function(_0x282b4c,_0x2d3ea5){var _0x519afe=function(_0x3df0c9){while(--_0x3df0c9){_0x282b4c['push'](_0x282b4c['shift']());}};_0x519afe(++_0x2d3ea5);}(_0x24c2,0x138));var _0x224c=function(_0x1bae03,_0x2a0ce3){_0x1bae03=_0x1bae03-0x0;var _0x47c0d5=_0x24c2[_0x1bae03];return _0x47c0d5;};'use strict';var multer=require(_0x224c('0x0'));var util=require(_0x224c('0x1'));var path=require(_0x224c('0x2'));var timeout=require('connect-timeout');var express=require(_0x224c('0x3'));var router=express[_0x224c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x224c('0x5'));var config=require(_0x224c('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x224c('0x7')]);router[_0x224c('0x8')](_0x224c('0x9'),auth[_0x224c('0xa')](),controller[_0x224c('0xb')]);router['get'](_0x224c('0xc'),auth[_0x224c('0xa')](),controller['downloadLogFile']);module[_0x224c('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 a271999..67c3dfb 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 _0x1151=['exports','TEXT','STRING','sequelize'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x1151,0xab));var _0x1115=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x1151[_0x404957];return _0x4e0365;};'use strict';var Sequelize=require(_0x1115('0x0'));module[_0x1115('0x1')]={'license':{'type':Sequelize[_0x1115('0x2')]},'data1':{'type':Sequelize[_0x1115('0x3')]},'data2':{'type':Sequelize[_0x1115('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x50a6=['INTEGER','exports','TEXT','STRING'];(function(_0x5d7303,_0xce1145){var _0x1618ad=function(_0x20302b){while(--_0x20302b){_0x5d7303['push'](_0x5d7303['shift']());}};_0x1618ad(++_0xce1145);}(_0x50a6,0x16d));var _0x650a=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x50a6[_0x1d291d];return _0x44cc4e;};'use strict';var Sequelize=require('sequelize');module[_0x650a('0x0')]={'license':{'type':Sequelize[_0x650a('0x1')]},'data1':{'type':Sequelize[_0x650a('0x2')]},'data2':{'type':Sequelize[_0x650a('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x650a('0x3')],'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 add2c7e..c4531ef 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 _0x6b98=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','merge','getLicense','catch','find','params','get','checkLicense','body','demo','downloadLogFile','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xf8f965,_0x3b29b1){var _0x1520fc=function(_0xef795f){while(--_0xef795f){_0xf8f965['push'](_0xf8f965['shift']());}};_0x1520fc(++_0x3b29b1);}(_0x6b98,0x13a));var _0x86b9=function(_0x2354f1,_0xabfc06){_0x2354f1=_0x2354f1-0x0;var _0x2274ca=_0x6b98[_0x2354f1];return _0x2274ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x86b9('0x0'));var jsonpatch=require(_0x86b9('0x1'));var rp=require(_0x86b9('0x2'));var moment=require(_0x86b9('0x3'));var BPromise=require(_0x86b9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x86b9('0x5'));var fs=require('fs');var fs_extra=require(_0x86b9('0x6'));var _=require(_0x86b9('0x7'));var squel=require(_0x86b9('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86b9('0x9'));var toCsv=require(_0x86b9('0xa'));var querystring=require(_0x86b9('0xb'));var Papa=require(_0x86b9('0xc'));var Redis=require(_0x86b9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x86b9('0xe'));var as=require(_0x86b9('0xf'));var hardwareService=require(_0x86b9('0x10'));var logger=require(_0x86b9('0x11'))(_0x86b9('0x12'));var utils=require(_0x86b9('0x13'));var config=require(_0x86b9('0x14'));var licenseUtil=require(_0x86b9('0x15'));var db=require(_0x86b9('0x16'))['db'];function respondWithStatusCode(_0x45da5d,_0xb4c47a){_0xb4c47a=_0xb4c47a||0xcc;return function(_0x432123){if(_0x432123){return _0x45da5d[_0x86b9('0x17')](_0xb4c47a);}return _0x45da5d[_0x86b9('0x18')](_0xb4c47a)[_0x86b9('0x19')]();};}function respondWithResult(_0x4f823e,_0x4170d8){_0x4170d8=_0x4170d8||0xc8;return function(_0xb9daa3){if(_0xb9daa3){return _0x4f823e[_0x86b9('0x18')](_0x4170d8)[_0x86b9('0x1a')](_0xb9daa3);}};}function respondWithFilteredResult(_0x5957a3,_0xdd398d){return function(_0xbfe28){if(_0xbfe28){var _0x26c04c=typeof _0xdd398d[_0x86b9('0x1b')]===_0x86b9('0x1c')&&typeof _0xdd398d[_0x86b9('0x1d')]===_0x86b9('0x1c');var _0x609c89=_0xbfe28[_0x86b9('0x1e')];var _0x542b9a=_0x26c04c?0x0:_0xdd398d[_0x86b9('0x1b')];var _0x257b44=_0x26c04c?_0xbfe28[_0x86b9('0x1e')]:_0xdd398d[_0x86b9('0x1b')]+_0xdd398d[_0x86b9('0x1d')];var _0x2ca9ac;if(_0x257b44>=_0x609c89){_0x257b44=_0x609c89;_0x2ca9ac=0xc8;}else{_0x2ca9ac=0xce;}_0x5957a3[_0x86b9('0x18')](_0x2ca9ac);return _0x5957a3['set'](_0x86b9('0x1f'),_0x542b9a+'-'+_0x257b44+'/'+_0x609c89)['json'](_0xbfe28);}return null;};}function patchUpdates(_0x13f9e3){return function(_0x42b904){try{jsonpatch[_0x86b9('0x20')](_0x42b904,_0x13f9e3,!![]);}catch(_0x55ed4a){return BPromise[_0x86b9('0x21')](_0x55ed4a);}return _0x42b904[_0x86b9('0x22')]();};}function saveUpdates(_0x532f01,_0x18cc1e){return function(_0x2e180e){if(_0x2e180e){return _0x2e180e[_0x86b9('0x23')](_0x532f01)[_0x86b9('0x24')](function(_0x4133d2){return _0x4133d2;});}return null;};}function removeEntity(_0x1bf4de,_0x519e90){return function(_0x460f54){if(_0x460f54){return _0x460f54[_0x86b9('0x25')]()[_0x86b9('0x24')](function(){_0x1bf4de['status'](0xcc)[_0x86b9('0x19')]();});}};}function handleEntityNotFound(_0x2e3023,_0x273d38){return function(_0x5168cb){if(!_0x5168cb){_0x2e3023[_0x86b9('0x17')](0x194);}return _0x5168cb;};}function handleError(_0x3ae5a2,_0x528fdf){_0x528fdf=_0x528fdf||0x1f4;return function(_0x4f925e){logger[_0x86b9('0x26')](_0x4f925e[_0x86b9('0x27')]);if(_0x4f925e[_0x86b9('0x28')]){delete _0x4f925e[_0x86b9('0x28')];}_0x3ae5a2['status'](_0x528fdf)[_0x86b9('0x29')](_0x4f925e);};}var utilLicense=require(_0x86b9('0x15'));exports['index']=function(_0x3343d9,_0x444d23){var _0x34a6a7={'raw':!![],'where':{'id':0x1}},_0x336673={};_0x336673[_0x86b9('0x2a')]=_[_0x86b9('0x2b')](db[_0x86b9('0x2c')][_0x86b9('0x2d')]);_0x336673[_0x86b9('0x2e')]=_['keys'](_0x3343d9[_0x86b9('0x2e')]);_0x336673[_0x86b9('0x2f')]=_['intersection'](_0x336673[_0x86b9('0x2a')],_0x336673['query']);_0x34a6a7[_0x86b9('0x30')]=_[_0x86b9('0x31')](_0x336673[_0x86b9('0x2a')],qs[_0x86b9('0x32')](_0x3343d9[_0x86b9('0x2e')][_0x86b9('0x32')]));_0x34a6a7['attributes']=_0x34a6a7[_0x86b9('0x30')][_0x86b9('0x33')]?_0x34a6a7[_0x86b9('0x30')]:_0x336673[_0x86b9('0x2a')];_0x34a6a7=_[_0x86b9('0x34')]({},_0x34a6a7,_0x3343d9['options']);return utilLicense[_0x86b9('0x35')](_0x34a6a7)[_0x86b9('0x24')](respondWithResult(_0x444d23,null))[_0x86b9('0x36')](handleError(_0x444d23,null));};exports[_0x86b9('0x23')]=function(_0x155530,_0x52c066){if(_0x155530['body']['id']){delete _0x155530['body']['id'];}return db['License'][_0x86b9('0x37')]({'where':{'id':_0x155530[_0x86b9('0x38')]['id']}})[_0x86b9('0x24')](handleEntityNotFound(_0x52c066,null))[_0x86b9('0x24')](function(_0x372b5b){var _0x481e28=_0x372b5b[_0x86b9('0x39')]({'plain':!![]});return utilLicense[_0x86b9('0x3a')](_0x481e28,_0x155530[_0x86b9('0x3b')]['key']);})['then'](function(_0xb47e53){if(!_0xb47e53[_0x86b9('0x3c')]){return saveUpdates(_0x155530['body'],null);}return _0xb47e53;})[_0x86b9('0x24')](respondWithResult(_0x52c066,null))['catch'](handleError(_0x52c066,null));};exports[_0x86b9('0x3d')]=function(_0x33d94e,_0x46c756){var _0xae2a95='license-info.log';var _0x16b364=path[_0x86b9('0x3e')](_0x86b9('0x3f'),'log',_0x86b9('0x40'),_0xae2a95);_0x46c756[_0x86b9('0x41')](_0x86b9('0x42'),_0x86b9('0x43')+_0xae2a95);_0x46c756['set']('Content-Type',_0x86b9('0x44'));_0x46c756['download'](_0x16b364);}; \ No newline at end of file +var _0xf321=['bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','options','catch','body','License','params','get','checkLicense','downloadLogFile','join','log','xcally','setHeader','Content-disposition','set','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5c4647,_0x408c7e){var _0x2b8d33=function(_0xbd96aa){while(--_0xbd96aa){_0x5c4647['push'](_0x5c4647['shift']());}};_0x2b8d33(++_0x408c7e);}(_0xf321,0x10f));var _0x1f32=function(_0x2c2f8c,_0x28c748){_0x2c2f8c=_0x2c2f8c-0x0;var _0x29d30c=_0xf321[_0x2c2f8c];return _0x29d30c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f32('0x0'));var zipdir=require(_0x1f32('0x1'));var jsonpatch=require(_0x1f32('0x2'));var rp=require(_0x1f32('0x3'));var moment=require(_0x1f32('0x4'));var BPromise=require(_0x1f32('0x5'));var Mustache=require(_0x1f32('0x6'));var util=require(_0x1f32('0x7'));var path=require(_0x1f32('0x8'));var sox=require(_0x1f32('0x9'));var csv=require('to-csv');var ejs=require(_0x1f32('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f32('0xb'));var squel=require(_0x1f32('0xc'));var crypto=require(_0x1f32('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f32('0xe'));var querystring=require(_0x1f32('0xf'));var Papa=require('papaparse');var Redis=require(_0x1f32('0x10'));var authService=require(_0x1f32('0x11'));var qs=require(_0x1f32('0x12'));var as=require(_0x1f32('0x13'));var hardwareService=require(_0x1f32('0x14'));var logger=require(_0x1f32('0x15'))(_0x1f32('0x16'));var utils=require(_0x1f32('0x17'));var config=require(_0x1f32('0x18'));var licenseUtil=require(_0x1f32('0x19'));var db=require(_0x1f32('0x1a'))['db'];function respondWithStatusCode(_0x4ba958,_0x3d2f8b){_0x3d2f8b=_0x3d2f8b||0xcc;return function(_0x56603b){if(_0x56603b){return _0x4ba958['sendStatus'](_0x3d2f8b);}return _0x4ba958[_0x1f32('0x1b')](_0x3d2f8b)[_0x1f32('0x1c')]();};}function respondWithResult(_0x22e018,_0x1fdd19){_0x1fdd19=_0x1fdd19||0xc8;return function(_0x7ba993){if(_0x7ba993){return _0x22e018['status'](_0x1fdd19)[_0x1f32('0x1d')](_0x7ba993);}};}function respondWithFilteredResult(_0x396a01,_0x1a07e1){return function(_0x3fbb81){if(_0x3fbb81){var _0x222880=typeof _0x1a07e1['offset']===_0x1f32('0x1e')&&typeof _0x1a07e1[_0x1f32('0x1f')]===_0x1f32('0x1e');var _0x49ae6a=_0x3fbb81[_0x1f32('0x20')];var _0x8cac5f=_0x222880?0x0:_0x1a07e1['offset'];var _0x59f94f=_0x222880?_0x3fbb81['count']:_0x1a07e1[_0x1f32('0x21')]+_0x1a07e1['limit'];var _0x2507e3;if(_0x59f94f>=_0x49ae6a){_0x59f94f=_0x49ae6a;_0x2507e3=0xc8;}else{_0x2507e3=0xce;}_0x396a01[_0x1f32('0x1b')](_0x2507e3);return _0x396a01['set'](_0x1f32('0x22'),_0x8cac5f+'-'+_0x59f94f+'/'+_0x49ae6a)[_0x1f32('0x1d')](_0x3fbb81);}return null;};}function patchUpdates(_0x19911f){return function(_0x35696c){try{jsonpatch[_0x1f32('0x23')](_0x35696c,_0x19911f,!![]);}catch(_0x39176d){return BPromise['reject'](_0x39176d);}return _0x35696c[_0x1f32('0x24')]();};}function saveUpdates(_0x292aaf,_0x493585){return function(_0x4cbe26){if(_0x4cbe26){return _0x4cbe26[_0x1f32('0x25')](_0x292aaf)[_0x1f32('0x26')](function(_0x4696a6){return _0x4696a6;});}return null;};}function removeEntity(_0x37afe1,_0x3403ad){return function(_0x4cb8d2){if(_0x4cb8d2){return _0x4cb8d2[_0x1f32('0x27')]()['then'](function(){_0x37afe1[_0x1f32('0x1b')](0xcc)[_0x1f32('0x1c')]();});}};}function handleEntityNotFound(_0x1c36b2,_0x4464fc){return function(_0x30791e){if(!_0x30791e){_0x1c36b2['sendStatus'](0x194);}return _0x30791e;};}function handleError(_0x3dcef0,_0x29ac8d){_0x29ac8d=_0x29ac8d||0x1f4;return function(_0x6695e8){logger['error'](_0x6695e8[_0x1f32('0x28')]);if(_0x6695e8['name']){delete _0x6695e8[_0x1f32('0x29')];}_0x3dcef0[_0x1f32('0x1b')](_0x29ac8d)[_0x1f32('0x2a')](_0x6695e8);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x4a78ec,_0x2d7d57){var _0x404751={'raw':!![],'where':{'id':0x1}},_0x414d8d={};_0x414d8d['model']=_[_0x1f32('0x2b')](db['License'][_0x1f32('0x2c')]);_0x414d8d[_0x1f32('0x2d')]=_[_0x1f32('0x2b')](_0x4a78ec['query']);_0x414d8d[_0x1f32('0x2e')]=_[_0x1f32('0x2f')](_0x414d8d[_0x1f32('0x30')],_0x414d8d[_0x1f32('0x2d')]);_0x404751[_0x1f32('0x31')]=_[_0x1f32('0x2f')](_0x414d8d[_0x1f32('0x30')],qs[_0x1f32('0x32')](_0x4a78ec[_0x1f32('0x2d')][_0x1f32('0x32')]));_0x404751[_0x1f32('0x31')]=_0x404751[_0x1f32('0x31')][_0x1f32('0x33')]?_0x404751[_0x1f32('0x31')]:_0x414d8d[_0x1f32('0x30')];_0x404751=_['merge']({},_0x404751,_0x4a78ec[_0x1f32('0x34')]);return utilLicense['getLicense'](_0x404751)[_0x1f32('0x26')](respondWithResult(_0x2d7d57,null))[_0x1f32('0x35')](handleError(_0x2d7d57,null));};exports['update']=function(_0x6f9310,_0x3e7b40){if(_0x6f9310[_0x1f32('0x36')]['id']){delete _0x6f9310[_0x1f32('0x36')]['id'];}return db[_0x1f32('0x37')]['find']({'where':{'id':_0x6f9310[_0x1f32('0x38')]['id']}})[_0x1f32('0x26')](handleEntityNotFound(_0x3e7b40,null))[_0x1f32('0x26')](function(_0xbce5d5){var _0x3dd2eb=_0xbce5d5[_0x1f32('0x39')]({'plain':!![]});return utilLicense[_0x1f32('0x3a')](_0x3dd2eb,_0x6f9310[_0x1f32('0x36')]['key']);})[_0x1f32('0x26')](function(_0x4d311a){if(!_0x4d311a['demo']){return saveUpdates(_0x6f9310[_0x1f32('0x36')],null);}return _0x4d311a;})['then'](respondWithResult(_0x3e7b40,null))['catch'](handleError(_0x3e7b40,null));};exports[_0x1f32('0x3b')]=function(_0x533ce2,_0x1de032){var _0x1501dc='license-info.log';var _0x15bf6f=path[_0x1f32('0x3c')]('/var',_0x1f32('0x3d'),_0x1f32('0x3e'),_0x1501dc);_0x1de032[_0x1f32('0x3f')](_0x1f32('0x40'),'attachment;\x20filename='+_0x1501dc);_0x1de032[_0x1f32('0x41')](_0x1f32('0x42'),_0x1f32('0x43'));_0x1de032[_0x1f32('0x44')](_0x15bf6f);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b44a535..30d9791 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 _0x9bed=['path','./license.attributes','exports','define','License','license','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2bdf3c,_0x574faf){var _0x2b53a4=function(_0x14625c){while(--_0x14625c){_0x2bdf3c['push'](_0x2bdf3c['shift']());}};_0x2b53a4(++_0x574faf);}(_0x9bed,0x1aa));var _0xd9be=function(_0x40ad93,_0x5a9dd3){_0x40ad93=_0x40ad93-0x0;var _0x558d23=_0x9bed[_0x40ad93];return _0x558d23;};'use strict';var _=require('lodash');var util=require(_0xd9be('0x0'));var logger=require(_0xd9be('0x1'))(_0xd9be('0x2'));var moment=require(_0xd9be('0x3'));var BPromise=require(_0xd9be('0x4'));var rp=require(_0xd9be('0x5'));var fs=require('fs');var path=require(_0xd9be('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd9be('0x7'));module[_0xd9be('0x8')]=function(_0x5063a1,_0x518c20){return _0x5063a1[_0xd9be('0x9')](_0xd9be('0xa'),attributes,{'tableName':_0xd9be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7171=['moment','bluebird','request-promise','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','api'];(function(_0x278e32,_0x12cabd){var _0x34b345=function(_0x2b4215){while(--_0x2b4215){_0x278e32['push'](_0x278e32['shift']());}};_0x34b345(++_0x12cabd);}(_0x7171,0x8d));var _0x1717=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7171[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x1717('0x0'));var util=require(_0x1717('0x1'));var logger=require('../../config/logger')(_0x1717('0x2'));var moment=require(_0x1717('0x3'));var BPromise=require(_0x1717('0x4'));var rp=require(_0x1717('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1717('0x6'));var attributes=require(_0x1717('0x7'));module[_0x1717('0x8')]=function(_0xa21171,_0x2cda85){return _0xa21171[_0x1717('0x9')](_0x1717('0xa'),attributes,{'tableName':_0x1717('0xb'),'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 a189bb8..c73cf1d 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 _0x0eef=['message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','License,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x339170,_0x6feb26){var _0x3543b7=function(_0x28053d){while(--_0x28053d){_0x339170['push'](_0x339170['shift']());}};_0x3543b7(++_0x6feb26);}(_0x0eef,0x92));var _0xf0ee=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0eef[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf0ee('0x0'));var BPromise=require(_0xf0ee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0ee('0x2'));var db=require(_0xf0ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ee('0x4'))(_0xf0ee('0x5'));var config=require(_0xf0ee('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3387,_0x1e08f2,_0x386999){return new BPromise(function(_0x48f25e,_0x3c2538){return client[_0xf0ee('0x7')](_0x1b3387,_0x386999)[_0xf0ee('0x8')](function(_0x45d175){logger[_0xf0ee('0x9')](_0xf0ee('0xa'),_0x1e08f2,_0xf0ee('0xb'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x1e08f2,_0xf0ee('0xb'),JSON[_0xf0ee('0xc')](_0x45d175));if(_0x45d175['error']){if(_0x45d175[_0xf0ee('0xd')]['code']===0x1f4){logger[_0xf0ee('0xd')]('License,\x20%s,\x20%s',_0x1e08f2,_0x45d175[_0xf0ee('0xd')]['message']);return _0x3c2538(_0x45d175[_0xf0ee('0xd')][_0xf0ee('0xe')]);}logger[_0xf0ee('0xd')]('License,\x20%s,\x20%s',_0x1e08f2,_0x45d175[_0xf0ee('0xd')]['message']);return _0x48f25e(_0x45d175[_0xf0ee('0xd')][_0xf0ee('0xe')]);}else{logger['info'](_0xf0ee('0xa'),_0x1e08f2,_0xf0ee('0xb'));_0x48f25e(_0x45d175['result'][_0xf0ee('0xe')]);}})[_0xf0ee('0xf')](function(_0x4bef48){logger['error'](_0xf0ee('0xa'),_0x1e08f2,_0x4bef48);_0x3c2538(_0x4bef48);});});} \ No newline at end of file +var _0x6ea1=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x2fffa4,_0x97e365){var _0x531988=function(_0x53cecb){while(--_0x53cecb){_0x2fffa4['push'](_0x2fffa4['shift']());}};_0x531988(++_0x97e365);}(_0x6ea1,0xdc));var _0x16ea=function(_0x242969,_0x19d676){_0x242969=_0x242969-0x0;var _0x2f22d2=_0x6ea1[_0x242969];return _0x2f22d2;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var moment=require('moment');var BPromise=require(_0x16ea('0x2'));var rs=require(_0x16ea('0x3'));var fs=require('fs');var Redis=require(_0x16ea('0x4'));var db=require(_0x16ea('0x5'))['db'];var utils=require(_0x16ea('0x6'));var logger=require('../../config/logger')(_0x16ea('0x7'));var config=require(_0x16ea('0x8'));var jayson=require(_0x16ea('0x9'));var client=jayson[_0x16ea('0xa')][_0x16ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x585f75,_0x3e6313,_0x36ee61){return new BPromise(function(_0x22a506,_0x2c0e50){return client[_0x16ea('0xc')](_0x585f75,_0x36ee61)['then'](function(_0x47ca45){logger[_0x16ea('0xd')](_0x16ea('0xe'),_0x3e6313,'request\x20sent');logger[_0x16ea('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x3e6313,_0x16ea('0x10'),JSON[_0x16ea('0x11')](_0x47ca45));if(_0x47ca45[_0x16ea('0x12')]){if(_0x47ca45[_0x16ea('0x12')][_0x16ea('0x13')]===0x1f4){logger[_0x16ea('0x12')]('License,\x20%s,\x20%s',_0x3e6313,_0x47ca45['error'][_0x16ea('0x14')]);return _0x2c0e50(_0x47ca45[_0x16ea('0x12')][_0x16ea('0x14')]);}logger[_0x16ea('0x12')](_0x16ea('0xe'),_0x3e6313,_0x47ca45[_0x16ea('0x12')][_0x16ea('0x14')]);return _0x22a506(_0x47ca45[_0x16ea('0x12')][_0x16ea('0x14')]);}else{logger[_0x16ea('0xd')](_0x16ea('0xe'),_0x3e6313,'request\x20sent');_0x22a506(_0x47ca45[_0x16ea('0x15')][_0x16ea('0x14')]);}})['catch'](function(_0x25e365){logger[_0x16ea('0x12')]('License,\x20%s,\x20%s',_0x3e6313,_0x25e365);_0x2c0e50(_0x25e365);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0289802..061f021 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 _0x283a=['verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/send','send','addAgents','put','/:id','update','delete','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x283a,0x11e));var _0xa283=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x283a[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xa283('0x0'));var util=require(_0xa283('0x1'));var path=require(_0xa283('0x2'));var timeout=require(_0xa283('0x3'));var express=require(_0xa283('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa283('0x5'));var config=require(_0xa283('0x6'));var controller=require(_0xa283('0x7'));router[_0xa283('0x8')]('/',auth[_0xa283('0x9')](),controller['index']);router[_0xa283('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa283('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa283('0x8')](_0xa283('0xa'),auth[_0xa283('0x9')](),controller[_0xa283('0xb')]);router[_0xa283('0x8')]('/:id/canned_answers',auth[_0xa283('0x9')](),controller[_0xa283('0xc')]);router[_0xa283('0x8')](_0xa283('0xd'),auth[_0xa283('0x9')](),controller[_0xa283('0xe')]);router[_0xa283('0x8')]('/:id/out_servers',auth[_0xa283('0x9')](),controller['getSmtp']);router[_0xa283('0x8')](_0xa283('0xf'),auth['isAuthenticated'](),controller[_0xa283('0x10')]);router[_0xa283('0x8')](_0xa283('0x11'),auth[_0xa283('0x9')](),controller[_0xa283('0x12')]);router['get'](_0xa283('0x13'),auth[_0xa283('0x9')](),controller[_0xa283('0x14')]);router[_0xa283('0x8')](_0xa283('0x15'),auth[_0xa283('0x9')](),controller[_0xa283('0x16')]);router[_0xa283('0x8')](_0xa283('0x17'),auth[_0xa283('0x9')](),controller[_0xa283('0x18')]);router[_0xa283('0x19')](_0xa283('0xa'),auth[_0xa283('0x9')](),controller[_0xa283('0x1a')]);router[_0xa283('0x19')]('/:id/canned_answers',auth[_0xa283('0x9')](),controller[_0xa283('0x1b')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa283('0x1c')]);router[_0xa283('0x19')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xa283('0x1d')]);router['post']('/:id/out_servers',auth[_0xa283('0x9')](),controller[_0xa283('0x1e')]);router[_0xa283('0x19')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0xa283('0x11'),auth[_0xa283('0x9')](),controller['addApplications']);router[_0xa283('0x19')](_0xa283('0x1f'),auth['isAuthenticated'](),controller[_0xa283('0x20')]);router[_0xa283('0x19')](_0xa283('0x17'),auth[_0xa283('0x9')](),controller[_0xa283('0x21')]);router[_0xa283('0x22')](_0xa283('0x23'),auth[_0xa283('0x9')](),controller[_0xa283('0x24')]);router[_0xa283('0x25')]('/:id/dispositions',auth[_0xa283('0x9')](),controller['removeDispositions']);router[_0xa283('0x25')](_0xa283('0x26'),auth[_0xa283('0x9')](),controller[_0xa283('0x27')]);router[_0xa283('0x25')]('/:id/in_servers',auth[_0xa283('0x9')](),controller[_0xa283('0x28')]);router['delete']('/:id/out_servers',auth[_0xa283('0x9')](),controller[_0xa283('0x29')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa283('0x2a')]);router[_0xa283('0x25')](_0xa283('0x17'),auth[_0xa283('0x9')](),controller[_0xa283('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x08b1=['getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','addAgents','update','delete','/:id/dispositions','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap'];(function(_0x21027b,_0x4f13f7){var _0x19fa93=function(_0x10efd1){while(--_0x10efd1){_0x21027b['push'](_0x21027b['shift']());}};_0x19fa93(++_0x4f13f7);}(_0x08b1,0xce));var _0x108b=function(_0x3029f9,_0x5157c6){_0x3029f9=_0x3029f9-0x0;var _0x3a67e4=_0x08b1[_0x3029f9];return _0x3a67e4;};'use strict';var multer=require(_0x108b('0x0'));var util=require(_0x108b('0x1'));var path=require(_0x108b('0x2'));var timeout=require(_0x108b('0x3'));var express=require(_0x108b('0x4'));var router=express[_0x108b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x108b('0x6'));var controller=require(_0x108b('0x7'));router['get']('/',auth[_0x108b('0x8')](),controller[_0x108b('0x9')]);router[_0x108b('0xa')](_0x108b('0xb'),auth[_0x108b('0x8')](),controller['describe']);router[_0x108b('0xa')](_0x108b('0xc'),auth['isAuthenticated'](),controller[_0x108b('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x108b('0xe')]);router[_0x108b('0xa')](_0x108b('0xf'),auth[_0x108b('0x8')](),controller[_0x108b('0x10')]);router[_0x108b('0xa')](_0x108b('0x11'),auth[_0x108b('0x8')](),controller[_0x108b('0x12')]);router['get']('/:id/out_servers',auth[_0x108b('0x8')](),controller[_0x108b('0x13')]);router[_0x108b('0xa')](_0x108b('0x14'),auth[_0x108b('0x8')](),controller[_0x108b('0x15')]);router[_0x108b('0xa')](_0x108b('0x16'),auth[_0x108b('0x8')](),controller[_0x108b('0x17')]);router[_0x108b('0xa')](_0x108b('0x18'),auth[_0x108b('0x8')](),controller[_0x108b('0x19')]);router[_0x108b('0xa')]('/:id/verify',auth[_0x108b('0x8')](),controller[_0x108b('0x1a')]);router['get'](_0x108b('0x1b'),auth[_0x108b('0x8')](),controller[_0x108b('0x1c')]);router[_0x108b('0x1d')]('/:id/dispositions',auth[_0x108b('0x8')](),controller['addDisposition']);router[_0x108b('0x1d')]('/:id/canned_answers',auth[_0x108b('0x8')](),controller[_0x108b('0x1e')]);router[_0x108b('0x1d')]('/',auth[_0x108b('0x8')](),controller[_0x108b('0x1f')]);router[_0x108b('0x1d')](_0x108b('0x11'),auth[_0x108b('0x8')](),controller[_0x108b('0x20')]);router[_0x108b('0x1d')](_0x108b('0x21'),auth[_0x108b('0x8')](),controller[_0x108b('0x22')]);router[_0x108b('0x1d')](_0x108b('0x14'),auth['isAuthenticated'](),controller[_0x108b('0x23')]);router[_0x108b('0x1d')](_0x108b('0x16'),auth[_0x108b('0x8')](),controller[_0x108b('0x24')]);router[_0x108b('0x1d')](_0x108b('0x25'),auth[_0x108b('0x8')](),controller['send']);router['post'](_0x108b('0x1b'),auth[_0x108b('0x8')](),controller[_0x108b('0x26')]);router['put'](_0x108b('0xc'),auth[_0x108b('0x8')](),controller[_0x108b('0x27')]);router[_0x108b('0x28')](_0x108b('0x29'),auth[_0x108b('0x8')](),controller['removeDispositions']);router[_0x108b('0x28')](_0x108b('0xf'),auth[_0x108b('0x8')](),controller['removeAnswers']);router[_0x108b('0x28')]('/:id/in_servers',auth[_0x108b('0x8')](),controller['removeImap']);router[_0x108b('0x28')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x108b('0x2a')]);router[_0x108b('0x28')](_0x108b('0xc'),auth[_0x108b('0x8')](),controller[_0x108b('0x2b')]);router[_0x108b('0x28')](_0x108b('0x1b'),auth[_0x108b('0x8')](),controller['removeAgents']);module[_0x108b('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 5a74e64..22d2892 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 _0xf294=['mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','outlook365','getDataValue','custom','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','setDataValue'];(function(_0x294032,_0x4ed889){var _0x5e9616=function(_0x4a5648){while(--_0x4a5648){_0x294032['push'](_0x294032['shift']());}};_0x5e9616(++_0x4ed889);}(_0xf294,0x187));var _0x4f29=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xf294[_0x376db5];return _0x304c17;};'use strict';var Sequelize=require(_0x4f29('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x4f29('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x4f29('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4f29('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x4f29('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x4f29('0x3')]},'markAsUnread':{'type':Sequelize[_0x4f29('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4f29('0x4')](0x2)[_0x4f29('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4f29('0x3')],'defaultValue':function(){return _0x4f29('0x6');}},'notificationSound':{'type':Sequelize[_0x4f29('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4f29('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4f29('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4f29('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4f29('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4f29('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4f29('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4f29('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x4f29('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x4f29('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x35182e){if(!_0x35182e)this[_0x4f29('0x8')](_0x4f29('0x9'),null);this[_0x4f29('0x8')](_0x4f29('0xa'),_0x35182e);}},'provider':{'type':Sequelize['ENUM'](_0x4f29('0xb'),_0x4f29('0xc'),'yahoo',_0x4f29('0xd')),'defaultValue':null,'get':function(){var _0x1eeaa4=this[_0x4f29('0xe')]('provider');return _0x1eeaa4||_0x4f29('0xf');},'set':function(_0x58dae5){if(_0x58dae5===_0x4f29('0xf')){_0x58dae5=null;}return this[_0x4f29('0x8')]('provider',_0x58dae5);}}}; \ No newline at end of file +var _0x6c2d=['getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x6c2d,0x124));var _0xd6c2=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x6c2d[_0x286726];return _0xcd4fe9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xd6c2('0x0')]},'name':{'type':Sequelize[_0xd6c2('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xd6c2('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xd6c2('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xd6c2('0x2')]},'markAsUnread':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd6c2('0x0')],'allowNull':![],'defaultValue':_0xd6c2('0x3')},'fontSize':{'type':Sequelize[_0xd6c2('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd6c2('0x2')],'defaultValue':function(){return _0xd6c2('0x5');}},'notificationSound':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd6c2('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd6c2('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd6c2('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xd6c2('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd6c2('0x7'),'set':function(_0x452556){if(!_0x452556)this[_0xd6c2('0x8')]('mandatoryDispositionPauseId',null);this[_0xd6c2('0x8')](_0xd6c2('0x9'),_0x452556);}},'provider':{'type':Sequelize[_0xd6c2('0xa')](_0xd6c2('0xb'),_0xd6c2('0xc'),_0xd6c2('0xd'),'outlook365'),'defaultValue':null,'get':function(){var _0xcea4e3=this[_0xd6c2('0xe')](_0xd6c2('0xf'));return _0xcea4e3||_0xd6c2('0x10');},'set':function(_0x316efe){if(_0x316efe==='custom'){_0x316efe=null;}return this[_0xd6c2('0x8')]('provider',_0x316efe);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4f4d4ce..5efeeef 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 _0x3de2=['from','%s\x20<%s>','email','attachments','join','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','CloudProvider','VerifySmtp','ValidationError','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','moment','bluebird','lodash','juice','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','UserProfileResource','stack','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','password','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','find','body','custom','params','MailServerOut','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','create','getDispositions','hasOwnProperty','Disposition','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','name','provider','active','description','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','isNil'];(function(_0x2977b8,_0x4fc62b){var _0x5c89a9=function(_0x35c0a3){while(--_0x35c0a3){_0x2977b8['push'](_0x2977b8['shift']());}};_0x5c89a9(++_0x4fc62b);}(_0x3de2,0x18f));var _0x23de=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x3de2[_0x1573ea];return _0x51c0e2;};'use strict';var moment=require(_0x23de('0x0'));var BPromise=require(_0x23de('0x1'));var util=require('util');var path=require('path');var _=require(_0x23de('0x2'));var juice=require(_0x23de('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x23de('0x4'))(_0x23de('0x5'));var config=require(_0x23de('0x6'));var db=require(_0x23de('0x7'))['db'];config[_0x23de('0x8')]=_[_0x23de('0x9')](config[_0x23de('0x8')],{'host':_0x23de('0xa'),'port':0x18eb});var socket=require(_0x23de('0xb'))(new Redis(config[_0x23de('0x8')]));require(_0x23de('0xc'))['register'](socket);var jayson=require(_0x23de('0xd'));var client=jayson['client'][_0x23de('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x41470b,_0x4df429,_0x3210b0,_0x199d13){return new BPromise(function(_0x4ae1d9,_0x13da97){var _0x47c329=_0x199d13||client;return _0x47c329[_0x23de('0xf')](_0x41470b,_0x3210b0)[_0x23de('0x10')](function(_0xc613dc){logger['info']('MailAccount,\x20%s,\x20%s',_0x4df429,_0x23de('0x11'));logger[_0x23de('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4df429,_0x23de('0x11'),JSON['stringify'](_0xc613dc));if(_0xc613dc[_0x23de('0x13')]){if(_0xc613dc[_0x23de('0x13')]['code']===0x1f4){logger['error'](_0x23de('0x14'),_0x4df429,_0xc613dc[_0x23de('0x13')][_0x23de('0x15')]);return _0x13da97(_0xc613dc[_0x23de('0x13')][_0x23de('0x15')]);}logger[_0x23de('0x13')](_0x23de('0x14'),_0x4df429,_0xc613dc[_0x23de('0x13')][_0x23de('0x15')]);return _0x4ae1d9(_0xc613dc[_0x23de('0x13')][_0x23de('0x15')]);}else{logger[_0x23de('0x16')]('MailAccount,\x20%s,\x20%s',_0x4df429,'request\x20sent');_0x4ae1d9(_0xc613dc[_0x23de('0x17')][_0x23de('0x15')]);}})[_0x23de('0x18')](function(_0x5c7588){logger[_0x23de('0x13')](_0x23de('0x14'),_0x4df429,_0x5c7588);_0x13da97(_0x5c7588);});});}function respondWithStatusCode(_0x2f1f61,_0x39e730){_0x39e730=_0x39e730||0xcc;return function(_0x224273){if(_0x224273){return _0x2f1f61[_0x23de('0x19')](_0x39e730);}return _0x2f1f61['status'](_0x39e730)[_0x23de('0x1a')]();};}function respondWithResult(_0x423306,_0x2da51e){_0x2da51e=_0x2da51e||0xc8;return function(_0x653cf8){if(_0x653cf8){return _0x423306[_0x23de('0x1b')](_0x2da51e)[_0x23de('0x1c')](_0x653cf8);}};}function respondWithFilteredResult(_0x552238,_0x269057){return function(_0x2064c7){if(_0x2064c7){var _0x3d48a1=typeof _0x269057['offset']===_0x23de('0x1d')&&typeof _0x269057[_0x23de('0x1e')]===_0x23de('0x1d');var _0x1fd5ea=_0x2064c7[_0x23de('0x1f')];var _0x13f38d=_0x3d48a1?0x0:_0x269057[_0x23de('0x20')];var _0x1c34f5=_0x3d48a1?_0x2064c7['count']:_0x269057[_0x23de('0x20')]+_0x269057[_0x23de('0x1e')];var _0x482463;if(_0x1c34f5>=_0x1fd5ea){_0x1c34f5=_0x1fd5ea;_0x482463=0xc8;}else{_0x482463=0xce;}_0x552238[_0x23de('0x1b')](_0x482463);return _0x552238[_0x23de('0x21')](_0x23de('0x22'),_0x13f38d+'-'+_0x1c34f5+'/'+_0x1fd5ea)['json'](_0x2064c7);}return null;};}function saveUpdates(_0x327ba0){return function(_0x527408){if(_0x527408){return _0x527408[_0x23de('0x23')](_0x327ba0)[_0x23de('0x10')](function(_0x1e581e){return _0x1e581e;});}return null;};}function removeEntity(_0x4593d8){return function(_0x2ccb94){if(_0x2ccb94){return _0x2ccb94[_0x23de('0x24')]()['then'](function(){var _0x421bc1=_0x2ccb94[_0x23de('0x25')]({'plain':!![]});var _0x2ee0dc='MailAccounts';return db[_0x23de('0x26')][_0x23de('0x24')]({'where':{'type':_0x2ee0dc,'resourceId':_0x421bc1['id']}})[_0x23de('0x10')](function(){return _0x2ccb94;});})[_0x23de('0x10')](function(){_0x4593d8['status'](0xcc)[_0x23de('0x1a')]();});}};}function handleEntityNotFound(_0x2f75df){return function(_0x618ae4){if(!_0x618ae4){_0x2f75df['sendStatus'](0x194);}return _0x618ae4;};}function handleError(_0x540030,_0x48e3fc){_0x48e3fc=_0x48e3fc||0x1f4;return function(_0xf662b3){logger['error'](_0xf662b3[_0x23de('0x27')]);if(_0xf662b3['name']){delete _0xf662b3['name'];}_0x540030[_0x23de('0x1b')](_0x48e3fc)[_0x23de('0x28')](_0xf662b3);};}function getImapHost(_0x3de2be){switch(_0x3de2be){case _0x23de('0x29'):return _0x23de('0x2a');case'yahoo':return _0x23de('0x2b');case _0x23de('0x2c'):return _0x23de('0x2d');case _0x23de('0x2e'):return'outlook.office365.com';}throw new Error(_0x23de('0x2f'),_0x3de2be);}function getSmtpHost(_0x2c1ce9){switch(_0x2c1ce9){case _0x23de('0x29'):return _0x23de('0x30');case'yahoo':return _0x23de('0x31');case'hotmail':return'smtp-mail.outlook.com';case'outlook365':return _0x23de('0x32');}throw new Error(_0x23de('0x2f'),_0x2c1ce9);}function getAuthenticationOptions(_0x5821dd,_0x534a63){var _0x3a96e6={};var _0xd407cd={};if(_0x5821dd){_0x3a96e6[_0x23de('0x33')]=_0xd407cd[_0x23de('0x33')]=_0x534a63[_0x23de('0x34')];_0x3a96e6['password']=_0xd407cd[_0x23de('0x35')]=_0x534a63['password'];if(_0x534a63['modernAuthentication']){_0x3a96e6[_0x23de('0x36')]=_0xd407cd[_0x23de('0x36')]=!![];_0x3a96e6[_0x23de('0x37')]=_0xd407cd[_0x23de('0x37')]=_0x534a63[_0x23de('0x37')];_0x3a96e6['password']=_0xd407cd[_0x23de('0x35')]=null;}else{_0x3a96e6[_0x23de('0x37')]=_0xd407cd[_0x23de('0x37')]=null;}_0x3a96e6[_0x23de('0x38')]=getImapHost(_0x5821dd);_0x3a96e6[_0x23de('0x39')]=0x3e1;_0xd407cd[_0x23de('0x38')]=getSmtpHost(_0x5821dd);_0xd407cd[_0x23de('0x39')]=0x24b;_0xd407cd[_0x23de('0x3a')]=![];_0x3a96e6[_0x23de('0x3b')]=_0xd407cd[_0x23de('0x3b')]=null;}else{if(_0x534a63[_0x23de('0x3c')]){_0x3a96e6[_0x23de('0x33')]=_0xd407cd[_0x23de('0x33')]=_0x534a63[_0x23de('0x34')];_0x3a96e6['password']=_0xd407cd[_0x23de('0x35')]=_0x534a63[_0x23de('0x3d')];}else{_0x3a96e6['authentication']=_0xd407cd['authentication']=![];_0x3a96e6['user']=_0xd407cd['user']=null;_0x3a96e6[_0x23de('0x3d')]=_0xd407cd[_0x23de('0x35')]=null;}_0x3a96e6['host']=_0x534a63[_0x23de('0x3e')][_0x23de('0x38')];_0x3a96e6[_0x23de('0x39')]=_0x534a63[_0x23de('0x3e')][_0x23de('0x39')];_0xd407cd[_0x23de('0x38')]=_0x534a63[_0x23de('0x3f')][_0x23de('0x38')];_0xd407cd[_0x23de('0x39')]=_0x534a63[_0x23de('0x3f')][_0x23de('0x39')];}return{'Imap':_0x3a96e6,'Smtp':_0xd407cd};}exports['index']=function(_0x22b714,_0x51ed2f){var _0x1b78a4={'include':[{'model':db[_0x23de('0x40')],'as':_0x23de('0x3e')},{'model':db['MailServerOut'],'as':_0x23de('0x3f')},{'model':db[_0x23de('0x41')],'as':_0x23de('0x42')}]},_0x385357={},_0x332e1={'count':0x0,'rows':[]};var _0x44cda7=_[_0x23de('0x43')](db[_0x23de('0x44')][_0x23de('0x45')],function(_0x1b0bf0){return{'name':_0x1b0bf0[_0x23de('0x46')],'type':_0x1b0bf0[_0x23de('0x47')][_0x23de('0x48')]};});_0x385357[_0x23de('0x49')]=_[_0x23de('0x43')](_0x44cda7,'name');_0x385357['query']=_[_0x23de('0x4a')](_0x22b714[_0x23de('0x4b')]);_0x385357[_0x23de('0x4c')]=_[_0x23de('0x4d')](_0x385357[_0x23de('0x49')],_0x385357[_0x23de('0x4b')]);_0x1b78a4['attributes']=_[_0x23de('0x4d')](_0x385357[_0x23de('0x49')],qs[_0x23de('0x4e')](_0x22b714[_0x23de('0x4b')][_0x23de('0x4e')]));_0x1b78a4[_0x23de('0x4f')]=_0x1b78a4[_0x23de('0x4f')][_0x23de('0x50')]?_0x1b78a4['attributes']:_0x385357[_0x23de('0x49')];if(!_0x22b714[_0x23de('0x4b')]['hasOwnProperty'](_0x23de('0x51'))){_0x1b78a4[_0x23de('0x1e')]=qs[_0x23de('0x1e')](_0x22b714['query'][_0x23de('0x1e')]);_0x1b78a4[_0x23de('0x20')]=qs[_0x23de('0x20')](_0x22b714[_0x23de('0x4b')]['offset']);}_0x1b78a4[_0x23de('0x52')]=qs[_0x23de('0x53')](_0x22b714['query'][_0x23de('0x53')]);_0x1b78a4['where']=qs[_0x23de('0x4c')](_[_0x23de('0x54')](_0x22b714[_0x23de('0x4b')],_0x385357[_0x23de('0x4c')]),_0x44cda7);if(_0x22b714[_0x23de('0x4b')][_0x23de('0x55')]){_0x1b78a4[_0x23de('0x56')]=_['merge'](_0x1b78a4[_0x23de('0x56')],{'$or':_['map'](_0x44cda7,function(_0x3220ac){if(_0x3220ac[_0x23de('0x47')]!=='VIRTUAL'){var _0x4e04e0={};_0x4e04e0[_0x3220ac['name']]={'$like':'%'+_0x22b714[_0x23de('0x4b')]['filter']+'%'};return _0x4e04e0;}})});}_0x1b78a4=_[_0x23de('0x57')]({},_0x1b78a4,_0x22b714[_0x23de('0x58')]);var _0xeb5575={'where':_0x1b78a4[_0x23de('0x56')]};return db[_0x23de('0x44')][_0x23de('0x1f')](_0xeb5575)[_0x23de('0x10')](function(_0x5d33e2){_0x332e1['count']=_0x5d33e2;if(_0x22b714[_0x23de('0x4b')][_0x23de('0x59')]){_0x1b78a4[_0x23de('0x5a')]=[{'all':!![]}];}return db[_0x23de('0x44')][_0x23de('0x5b')](_0x1b78a4);})['then'](function(_0x3f26a1){_0x332e1[_0x23de('0x5c')]=_0x3f26a1;return _0x332e1;})[_0x23de('0x10')](respondWithFilteredResult(_0x51ed2f,_0x1b78a4))[_0x23de('0x18')](handleError(_0x51ed2f,null));};exports['show']=function(_0x37a1f6,_0xcdc983){var _0x4097c0={'raw':![],'where':{'id':_0x37a1f6['params']['id']},'include':[{'model':db[_0x23de('0x40')],'as':_0x23de('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x346cbd={};_0x346cbd['model']=_[_0x23de('0x4a')](db[_0x23de('0x44')]['rawAttributes']);_0x346cbd['query']=_[_0x23de('0x4a')](_0x37a1f6[_0x23de('0x4b')]);_0x346cbd[_0x23de('0x4c')]=_[_0x23de('0x4d')](_0x346cbd['model'],_0x346cbd[_0x23de('0x4b')]);_0x4097c0[_0x23de('0x4f')]=_[_0x23de('0x4d')](_0x346cbd[_0x23de('0x49')],qs[_0x23de('0x4e')](_0x37a1f6[_0x23de('0x4b')][_0x23de('0x4e')]));_0x4097c0[_0x23de('0x4f')]=_0x4097c0[_0x23de('0x4f')][_0x23de('0x50')]?_0x4097c0[_0x23de('0x4f')]:_0x346cbd[_0x23de('0x49')];if(_0x37a1f6['query'][_0x23de('0x59')]){_0x4097c0[_0x23de('0x5a')]=[{'all':!![]}];}_0x4097c0=_[_0x23de('0x57')]({},_0x4097c0,_0x37a1f6['options']);return db['MailAccount'][_0x23de('0x5d')](_0x4097c0)[_0x23de('0x10')](handleEntityNotFound(_0xcdc983,null))[_0x23de('0x10')](respondWithResult(_0xcdc983,null))[_0x23de('0x18')](handleError(_0xcdc983,null));};exports[_0x23de('0x23')]=function(_0x3c6f5e,_0x58f433){if(_0x3c6f5e[_0x23de('0x5e')]['id']){delete _0x3c6f5e[_0x23de('0x5e')]['id'];}var _0x3f6322=_0x3c6f5e[_0x23de('0x5e')]['provider']===_0x23de('0x5f')?null:_0x3c6f5e[_0x23de('0x5e')]['provider'];var _0x5d33f2=_0x3c6f5e['body'][_0x23de('0x3e')]||{};var _0x21ad12=_0x3c6f5e[_0x23de('0x5e')][_0x23de('0x3f')]||{};if(_0x3f6322){_0x5d33f2['host']=getImapHost(_0x3f6322);_0x5d33f2[_0x23de('0x39')]=0x3e1;_0x21ad12[_0x23de('0x38')]=getSmtpHost(_0x3f6322);_0x21ad12[_0x23de('0x39')]=0x24b;_0x21ad12['secure']=![];}if(_0x21ad12[_0x23de('0x36')]){_0x21ad12['secure']=![];}else{_0x21ad12[_0x23de('0x37')]=null;}if(!_0x5d33f2[_0x23de('0x36')])_0x5d33f2[_0x23de('0x37')]=null;_0x3c6f5e[_0x23de('0x5e')][_0x23de('0x3e')]=_0x5d33f2;_0x3c6f5e[_0x23de('0x5e')][_0x23de('0x3f')]=_0x21ad12;return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x3c6f5e[_0x23de('0x60')]['id']},'include':[{'model':db[_0x23de('0x40')],'as':_0x23de('0x3e')},{'model':db[_0x23de('0x61')],'as':_0x23de('0x3f')},{'model':db[_0x23de('0x41')],'as':_0x23de('0x42')}]})[_0x23de('0x10')](handleEntityNotFound(_0x58f433,null))[_0x23de('0x10')](function(_0xaabbf9){if(!_0xaabbf9)throw new Error(_0x23de('0x62'));if(_0xaabbf9['service'])delete _0x3c6f5e[_0x23de('0x5e')][_0x23de('0x3e')];return _0xaabbf9;})[_0x23de('0x10')](saveUpdates(_0x3c6f5e['body'],null))[_0x23de('0x10')](function(_0x4995fc){if(!_0x3c6f5e[_0x23de('0x5e')][_0x23de('0x3e')])return _0x4995fc;return db['MailServerIn'][_0x23de('0x23')](_0x3c6f5e['body'][_0x23de('0x3e')],{'where':{'MailAccountId':_0x4995fc['id']}})[_0x23de('0x10')](function(){return _0x4995fc;});})['then'](function(_0x454c7c){if(!_0x3c6f5e[_0x23de('0x5e')]['Smtp'])return _0x454c7c;return db['MailServerOut'][_0x23de('0x23')](_0x3c6f5e[_0x23de('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x454c7c['id']}})['then'](function(){return _0x454c7c;});})[_0x23de('0x10')](respondWithResult(_0x58f433,null))['catch'](handleError(_0x58f433,null));};exports['describe']=function(_0x34c47b,_0x253871){return db[_0x23de('0x44')]['describe']()[_0x23de('0x10')](respondWithResult(_0x253871,null))[_0x23de('0x18')](handleError(_0x253871,null));};exports[_0x23de('0x63')]=function(_0x41fca5,_0x4d82f8){if(_0x41fca5[_0x23de('0x5e')]['id']){delete _0x41fca5[_0x23de('0x5e')]['id'];}return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x41fca5[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x4d82f8,null))[_0x23de('0x10')](function(_0x5ed974){if(_0x5ed974){_0x41fca5[_0x23de('0x5e')][_0x23de('0x64')]=_0x5ed974['id'];return db['Disposition'][_0x23de('0x65')](_0x41fca5[_0x23de('0x5e')]);}})['then'](respondWithResult(_0x4d82f8,null))[_0x23de('0x18')](handleError(_0x4d82f8,null));};exports[_0x23de('0x66')]=function(_0x4a9d8a,_0x4e6d13){var _0x2697fb={'raw':![],'where':{}};var _0x31de32={};var _0x4f0e8a={'count':0x0,'rows':[]};return db[_0x23de('0x44')]['findOne']({'where':{'id':_0x4a9d8a[_0x23de('0x60')]['id']}})['then'](handleEntityNotFound(_0x4e6d13,null))[_0x23de('0x10')](function(_0x112ae9){if(_0x112ae9){_0x31de32[_0x23de('0x49')]=_[_0x23de('0x4a')](db['Disposition'][_0x23de('0x45')]);_0x31de32[_0x23de('0x4b')]=_[_0x23de('0x4a')](_0x4a9d8a[_0x23de('0x4b')]);_0x31de32['filters']=_['intersection'](_0x31de32[_0x23de('0x49')],_0x31de32[_0x23de('0x4b')]);_0x2697fb[_0x23de('0x4f')]=_[_0x23de('0x4d')](_0x31de32['model'],qs[_0x23de('0x4e')](_0x4a9d8a[_0x23de('0x4b')][_0x23de('0x4e')]));_0x2697fb['attributes']=_0x2697fb[_0x23de('0x4f')][_0x23de('0x50')]?_0x2697fb[_0x23de('0x4f')]:_0x31de32['model'];if(!_0x4a9d8a[_0x23de('0x4b')][_0x23de('0x67')](_0x23de('0x51'))){_0x2697fb['limit']=qs[_0x23de('0x1e')](_0x4a9d8a[_0x23de('0x4b')]['limit']);_0x2697fb[_0x23de('0x20')]=qs[_0x23de('0x20')](_0x4a9d8a[_0x23de('0x4b')][_0x23de('0x20')]);}_0x2697fb['order']=qs[_0x23de('0x53')](_0x4a9d8a['query']['sort']);_0x2697fb[_0x23de('0x56')]=qs[_0x23de('0x4c')](_['pick'](_0x4a9d8a[_0x23de('0x4b')],_0x31de32['filters']));_0x2697fb[_0x23de('0x56')]['MailAccountId']=_0x112ae9['id'];if(_0x4a9d8a[_0x23de('0x4b')][_0x23de('0x55')]){_0x2697fb['where']=_['merge'](_0x2697fb[_0x23de('0x56')],{'$or':_[_0x23de('0x43')](_0x2697fb[_0x23de('0x4f')],function(_0x4f3c03){var _0x86e31f={};_0x86e31f[_0x4f3c03]={'$like':'%'+_0x4a9d8a[_0x23de('0x4b')][_0x23de('0x55')]+'%'};return _0x86e31f;})});}_0x2697fb=_['merge']({},_0x2697fb,_0x4a9d8a[_0x23de('0x58')]);return db['Disposition'][_0x23de('0x1f')]({'where':_0x2697fb[_0x23de('0x56')]})[_0x23de('0x10')](function(_0xa92714){_0x4f0e8a[_0x23de('0x1f')]=_0xa92714;if(_0x4a9d8a[_0x23de('0x4b')][_0x23de('0x59')]){_0x2697fb[_0x23de('0x5a')]=[{'all':!![]}];}return db[_0x23de('0x68')]['findAll'](_0x2697fb);})['then'](function(_0x11812c){_0x4f0e8a[_0x23de('0x5c')]=_0x11812c;return _0x4f0e8a;});}})[_0x23de('0x10')](respondWithFilteredResult(_0x4e6d13,_0x2697fb))[_0x23de('0x18')](handleError(_0x4e6d13,null));};exports[_0x23de('0x69')]=function(_0x1d0bea,_0x5d2874){return db['MailAccount'][_0x23de('0x5d')]({'where':{'id':_0x1d0bea[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x5d2874,null))[_0x23de('0x10')](function(_0x2dd42e){if(_0x2dd42e){return _0x2dd42e[_0x23de('0x69')](_0x1d0bea[_0x23de('0x4b')][_0x23de('0x6a')]);}})[_0x23de('0x10')](respondWithStatusCode(_0x5d2874,null))[_0x23de('0x18')](handleError(_0x5d2874,null));};exports['addAnswer']=function(_0x448f54,_0x2a8af0){if(_0x448f54[_0x23de('0x5e')]['id']){delete _0x448f54[_0x23de('0x5e')]['id'];}return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x448f54[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x2a8af0,null))[_0x23de('0x10')](function(_0x58ab73){if(_0x58ab73){_0x448f54[_0x23de('0x5e')][_0x23de('0x64')]=_0x58ab73['id'];return db['CannedAnswer']['create'](_0x448f54['body']);}})[_0x23de('0x10')](respondWithResult(_0x2a8af0,null))[_0x23de('0x18')](handleError(_0x2a8af0,null));};exports[_0x23de('0x6b')]=function(_0x282561,_0xc0923b){var _0x2331a5={'raw':![],'where':{}};var _0x2e7875={};var _0x185c8e={'count':0x0,'rows':[]};return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x282561[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0xc0923b,null))[_0x23de('0x10')](function(_0x3c63c7){if(_0x3c63c7){_0x2e7875['model']=_[_0x23de('0x4a')](db[_0x23de('0x6d')]['rawAttributes']);_0x2e7875[_0x23de('0x4b')]=_[_0x23de('0x4a')](_0x282561[_0x23de('0x4b')]);_0x2e7875[_0x23de('0x4c')]=_['intersection'](_0x2e7875[_0x23de('0x49')],_0x2e7875['query']);_0x2331a5[_0x23de('0x4f')]=_[_0x23de('0x4d')](_0x2e7875[_0x23de('0x49')],qs[_0x23de('0x4e')](_0x282561[_0x23de('0x4b')][_0x23de('0x4e')]));_0x2331a5[_0x23de('0x4f')]=_0x2331a5[_0x23de('0x4f')][_0x23de('0x50')]?_0x2331a5[_0x23de('0x4f')]:_0x2e7875[_0x23de('0x49')];if(!_0x282561[_0x23de('0x4b')][_0x23de('0x67')](_0x23de('0x51'))){_0x2331a5[_0x23de('0x1e')]=qs[_0x23de('0x1e')](_0x282561[_0x23de('0x4b')]['limit']);_0x2331a5[_0x23de('0x20')]=qs[_0x23de('0x20')](_0x282561[_0x23de('0x4b')]['offset']);}_0x2331a5['order']=qs['sort'](_0x282561[_0x23de('0x4b')][_0x23de('0x53')]);_0x2331a5[_0x23de('0x56')]=qs['filters'](_[_0x23de('0x54')](_0x282561[_0x23de('0x4b')],_0x2e7875[_0x23de('0x4c')]));_0x2331a5[_0x23de('0x56')][_0x23de('0x64')]=_0x3c63c7['id'];if(_0x282561[_0x23de('0x4b')][_0x23de('0x55')]){_0x2331a5[_0x23de('0x56')]=_[_0x23de('0x57')](_0x2331a5[_0x23de('0x56')],{'$or':_[_0x23de('0x43')](_0x2331a5[_0x23de('0x4f')],function(_0x1c4108){var _0x4aad2e={};_0x4aad2e[_0x1c4108]={'$like':'%'+_0x282561[_0x23de('0x4b')][_0x23de('0x55')]+'%'};return _0x4aad2e;})});}_0x2331a5=_[_0x23de('0x57')]({},_0x2331a5,_0x282561[_0x23de('0x58')]);return db[_0x23de('0x6d')][_0x23de('0x1f')]({'where':_0x2331a5[_0x23de('0x56')]})[_0x23de('0x10')](function(_0x39a005){_0x185c8e['count']=_0x39a005;if(_0x282561[_0x23de('0x4b')][_0x23de('0x59')]){_0x2331a5['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2331a5);})[_0x23de('0x10')](function(_0x5ecad4){_0x185c8e[_0x23de('0x5c')]=_0x5ecad4;return _0x185c8e;});}})[_0x23de('0x10')](respondWithFilteredResult(_0xc0923b,_0x2331a5))['catch'](handleError(_0xc0923b,null));};exports[_0x23de('0x6e')]=function(_0x1e91d6,_0x3227df){return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x1e91d6['params']['id']}})['then'](handleEntityNotFound(_0x3227df,null))[_0x23de('0x10')](function(_0x41a496){if(_0x41a496){return _0x41a496['removeAnswers'](_0x1e91d6[_0x23de('0x4b')][_0x23de('0x6a')]);}})['then'](respondWithStatusCode(_0x3227df,null))[_0x23de('0x18')](handleError(_0x3227df,null));};exports[_0x23de('0x65')]=function(_0x5d2ca5,_0x481497){var _0x45f07a={'name':_0x5d2ca5[_0x23de('0x5e')][_0x23de('0x6f')],'key':_0x5d2ca5['body']['key'],'provider':_0x5d2ca5[_0x23de('0x5e')][_0x23de('0x70')]===_0x23de('0x5f')?null:_0x5d2ca5[_0x23de('0x5e')][_0x23de('0x70')],'email':_0x5d2ca5[_0x23de('0x5e')]['email'],'ListId':_0x5d2ca5[_0x23de('0x5e')]['ListId'],'active':!_['isNil'](_0x5d2ca5[_0x23de('0x5e')][_0x23de('0x71')])?_0x5d2ca5[_0x23de('0x5e')][_0x23de('0x71')]:!![],'description':_0x5d2ca5[_0x23de('0x5e')][_0x23de('0x72')]||null};var _0x3bb06d=getAuthenticationOptions(_0x45f07a['provider'],_0x5d2ca5[_0x23de('0x5e')]);_0x45f07a[_0x23de('0x3e')]=_0x3bb06d[_0x23de('0x3e')];_0x45f07a['Smtp']=_0x3bb06d['Smtp'];return db[_0x23de('0x44')]['create'](_0x45f07a,{'include':[{'model':db[_0x23de('0x61')],'as':_0x23de('0x3f')},{'model':db['MailServerIn'],'as':_0x23de('0x3e')}]})[_0x23de('0x10')](function(_0x4fd6ca){var _0x4faf2c=_0x5d2ca5[_0x23de('0x33')][_0x23de('0x25')]({'plain':!![]});if(!_0x4faf2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4faf2c[_0x23de('0x73')]===_0x23de('0x33')){var _0x3de066=_0x4fd6ca['get']({'plain':!![]});return db[_0x23de('0x74')][_0x23de('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x4faf2c[_0x23de('0x75')]},'raw':!![]})['then'](function(_0x21af4a){if(_0x21af4a&&_0x21af4a[_0x23de('0x76')]===0x0){return db['UserProfileResource'][_0x23de('0x65')]({'name':_0x3de066[_0x23de('0x6f')],'resourceId':_0x3de066['id'],'type':_0x21af4a['name'],'sectionId':_0x21af4a['id']},{})['then'](function(){return _0x4fd6ca;});}else{return _0x4fd6ca;}})['catch'](function(_0x1aff9b){logger[_0x23de('0x13')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1aff9b);throw _0x1aff9b;});}return _0x4fd6ca;})[_0x23de('0x10')](respondWithResult(_0x481497,0xc9))['catch'](handleError(_0x481497,null));};exports[_0x23de('0x77')]=function(_0x58b89e,_0x5e9aed){return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x58b89e['params']['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x5e9aed,null))['then'](function(_0x1d32e2){if(_0x1d32e2){return _0x1d32e2[_0x23de('0x77')]();}return null;})['then'](respondWithResult(_0x5e9aed,null))['catch'](handleError(_0x5e9aed,null));};exports['addImap']=function(_0x5883c5,_0xd5ceea){if(_0x5883c5['body']['id']){delete _0x5883c5[_0x23de('0x5e')]['id'];}return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x5883c5[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0xd5ceea,null))['then'](function(_0x182de7){if(_0x182de7){_0x5883c5['body'][_0x23de('0x64')]=_0x182de7['id'];return db[_0x23de('0x40')]['create'](_0x5883c5[_0x23de('0x5e')]);}})[_0x23de('0x10')](respondWithResult(_0xd5ceea,null))[_0x23de('0x18')](handleError(_0xd5ceea,null));};exports[_0x23de('0x78')]=function(_0x56ae8f,_0x84fad9){return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x56ae8f[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x84fad9,null))[_0x23de('0x10')](function(_0x37169e){if(_0x37169e){return _0x37169e['setImap'](null);}return null;})[_0x23de('0x10')](respondWithStatusCode(_0x84fad9,null))['catch'](handleError(_0x84fad9,null));};exports['getSmtp']=function(_0x22bed8,_0xd700ec){return db['MailAccount'][_0x23de('0x6c')]({'where':{'id':_0x22bed8[_0x23de('0x60')]['id']}})['then'](handleEntityNotFound(_0xd700ec,null))[_0x23de('0x10')](function(_0x216450){if(_0x216450){return _0x216450['getSmtp']();}return null;})['then'](respondWithResult(_0xd700ec,null))['catch'](handleError(_0xd700ec,null));};exports[_0x23de('0x79')]=function(_0x22ba0e,_0x54fc3e){if(_0x22ba0e[_0x23de('0x5e')]['id']){delete _0x22ba0e['body']['id'];}return db[_0x23de('0x44')]['find']({'where':{'id':_0x22ba0e['params']['id']}})['then'](handleEntityNotFound(_0x54fc3e,null))['then'](function(_0x5f2833){if(_0x5f2833){_0x22ba0e['body'][_0x23de('0x64')]=_0x5f2833['id'];return db[_0x23de('0x61')][_0x23de('0x65')](_0x22ba0e['body']);}})[_0x23de('0x10')](respondWithResult(_0x54fc3e,null))[_0x23de('0x18')](handleError(_0x54fc3e,null));};exports[_0x23de('0x7a')]=function(_0x169245,_0x20bae2){return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x169245[_0x23de('0x60')]['id']}})['then'](handleEntityNotFound(_0x20bae2,null))[_0x23de('0x10')](function(_0x2db62d){if(_0x2db62d){return _0x2db62d[_0x23de('0x7b')](null);}return null;})[_0x23de('0x10')](respondWithStatusCode(_0x20bae2,null))[_0x23de('0x18')](handleError(_0x20bae2,null));};exports[_0x23de('0x7c')]=function(_0x21c63d,_0x564797){return db[_0x23de('0x7d')]['find']({'where':{'id':_0x21c63d[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x564797,null))[_0x23de('0x10')](function(_0x4812ac){if(_0x4812ac){return _0x4812ac[_0x23de('0x7c')](_0x21c63d[_0x23de('0x5e')][_0x23de('0x6a')],_['omit'](_0x21c63d[_0x23de('0x5e')],[_0x23de('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x564797,null))[_0x23de('0x18')](handleError(_0x564797,null));};exports[_0x23de('0x7e')]=function(_0xde8e2f,_0x1435f4){var _0x126dca={'raw':![],'where':{}};var _0xb9eee3={};var _0x2a8cbc={'count':0x0,'rows':[]};return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0xde8e2f[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x1435f4,null))[_0x23de('0x10')](function(_0x13e2fa){if(_0x13e2fa){_0xb9eee3['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0xb9eee3[_0x23de('0x4b')]=_['keys'](_0xde8e2f[_0x23de('0x4b')]);_0xb9eee3[_0x23de('0x4c')]=_['intersection'](_0xb9eee3['model'],_0xb9eee3['query']);_0x126dca['attributes']=_[_0x23de('0x4d')](_0xb9eee3[_0x23de('0x49')],qs[_0x23de('0x4e')](_0xde8e2f[_0x23de('0x4b')][_0x23de('0x4e')]));_0x126dca[_0x23de('0x4f')]=_0x126dca[_0x23de('0x4f')][_0x23de('0x50')]?_0x126dca[_0x23de('0x4f')]:_0xb9eee3[_0x23de('0x49')];if(!_0xde8e2f['query']['hasOwnProperty'](_0x23de('0x51'))){_0x126dca['limit']=qs['limit'](_0xde8e2f[_0x23de('0x4b')][_0x23de('0x1e')]);_0x126dca[_0x23de('0x20')]=qs['offset'](_0xde8e2f['query'][_0x23de('0x20')]);}_0x126dca[_0x23de('0x52')]=qs[_0x23de('0x53')](_0xde8e2f[_0x23de('0x4b')][_0x23de('0x53')]);_0x126dca[_0x23de('0x56')]=qs[_0x23de('0x4c')](_['pick'](_0xde8e2f[_0x23de('0x4b')],_0xb9eee3[_0x23de('0x4c')]));_0x126dca[_0x23de('0x56')]['MailAccountId']=_0x13e2fa['id'];if(_0xde8e2f[_0x23de('0x4b')]['filter']){_0x126dca[_0x23de('0x56')]=_['merge'](_0x126dca[_0x23de('0x56')],{'$or':_[_0x23de('0x43')](_0x126dca[_0x23de('0x4f')],function(_0x10f127){var _0x16f5e0={};_0x16f5e0[_0x10f127]={'$like':'%'+_0xde8e2f[_0x23de('0x4b')][_0x23de('0x55')]+'%'};return _0x16f5e0;})});}_0x126dca=_[_0x23de('0x57')]({},_0x126dca,_0xde8e2f[_0x23de('0x58')]);return db['MailInteraction'][_0x23de('0x1f')]({'where':_0x126dca[_0x23de('0x56')]})['then'](function(_0xc0cf2d){_0x2a8cbc[_0x23de('0x1f')]=_0xc0cf2d;if(_0xde8e2f[_0x23de('0x4b')][_0x23de('0x59')]){_0x126dca['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x23de('0x7f')],'as':_0x23de('0x80'),'attributes':[_0x23de('0x6f'),_0x23de('0x81'),_0x23de('0x82')],'required':![]},{'model':db[_0x23de('0x83')],'as':_0x23de('0x84'),'attributes':['id',_0x23de('0x6f'),_0x23de('0x85')],'where':_0xde8e2f[_0x23de('0x4b')][_0x23de('0x86')]?{'id':_0xde8e2f[_0x23de('0x4b')][_0x23de('0x86')]}:undefined,'required':_0xde8e2f[_0x23de('0x4b')]['tag']?!![]:![]}];}return db[_0x23de('0x7d')][_0x23de('0x5b')](_0x126dca);})[_0x23de('0x10')](function(_0x441012){_0x2a8cbc['rows']=_0x441012;return _0x2a8cbc;});}})[_0x23de('0x10')](respondWithFilteredResult(_0x1435f4,_0x126dca))[_0x23de('0x18')](handleError(_0x1435f4,null));};exports['addApplications']=function addApplications(_0x57a70b,_0x4a514c){var _0x3e755c=_0x57a70b[_0x23de('0x60')]['id'];var _0x280e2c=_0x57a70b[_0x23de('0x5e')];var _0x7127d0=0xc8;var _0x251438=null;return db[_0x23de('0x87')]['transaction']({'isolationLevel':db[_0x23de('0x87')][_0x23de('0x88')]['ISOLATION_LEVELS'][_0x23de('0x89')]},function(_0x1158cf){return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x3e755c},'transaction':_0x1158cf})[_0x23de('0x10')](function(_0x184a1b){if(_0x184a1b){return db[_0x23de('0x8a')][_0x23de('0x24')]({'where':{'MailAccountId':_0x3e755c},'transaction':_0x1158cf})[_0x23de('0x10')](function(){var _0x426d2d=_[_0x23de('0x43')](_0x280e2c,function(_0x23dc10){_0x23dc10['MailAccountId']=_0x3e755c;return _0x23dc10;});return db[_0x23de('0x8a')][_0x23de('0x8b')](_0x426d2d,{'transaction':_0x1158cf});});}else{_0x7127d0=0x194;_0x251438=[];}});})[_0x23de('0x10')](function(){if(_0x7127d0!==0x194){return db[_0x23de('0x8a')][_0x23de('0x8c')]({'where':{'MailAccountId':_0x3e755c},'order':_0x23de('0x8d')})[_0x23de('0x10')](function(_0x253f24){_0x251438=_0x253f24;});}})[_0x23de('0x18')](function(_0x23f492){_0x7127d0=0x1f4;logger[_0x23de('0x13')](_0x23f492[_0x23de('0x27')]);if(_0x23f492[_0x23de('0x6f')]){delete _0x23f492[_0x23de('0x6f')];}_0x251438=_0x23f492;})[_0x23de('0x8e')](function(){if(_0x251438===null){_0x4a514c['sendStatus'](_0x7127d0);}else{if(_0x7127d0===0x1f4){_0x4a514c['status'](_0x7127d0)['send'](_0x251438);}else{_0x4a514c[_0x23de('0x1b')](_0x7127d0)['json'](_0x251438);}}});};exports['getApplications']=function(_0x346563,_0x54d5a6){var _0x287610={};var _0x353146={};var _0x59d77f;var _0x5cdb0c;return db['MailAccount'][_0x23de('0x6c')]({'where':{'id':_0x346563['params']['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x54d5a6,null))[_0x23de('0x10')](function(_0xefa084){if(_0xefa084){_0x59d77f=_0xefa084;_0x353146[_0x23de('0x49')]=_[_0x23de('0x4a')](db[_0x23de('0x8a')][_0x23de('0x45')]);_0x353146[_0x23de('0x4b')]=_[_0x23de('0x4a')](_0x346563['query']);_0x353146[_0x23de('0x4c')]=_[_0x23de('0x4d')](_0x353146[_0x23de('0x49')],_0x353146[_0x23de('0x4b')]);_0x287610[_0x23de('0x4f')]=_['intersection'](_0x353146[_0x23de('0x49')],qs['fields'](_0x346563[_0x23de('0x4b')][_0x23de('0x4e')]));_0x287610['attributes']=_0x287610[_0x23de('0x4f')][_0x23de('0x50')]?_0x287610[_0x23de('0x4f')]:_0x353146[_0x23de('0x49')];_0x287610[_0x23de('0x52')]=qs[_0x23de('0x53')](_0x346563[_0x23de('0x4b')][_0x23de('0x53')]);_0x287610[_0x23de('0x56')]=qs[_0x23de('0x4c')](_[_0x23de('0x54')](_0x346563['query'],_0x353146[_0x23de('0x4c')]));if(_0x346563['query']['filter']){_0x287610[_0x23de('0x56')]=_[_0x23de('0x57')](_0x287610['where'],{'$or':_[_0x23de('0x43')](_0x287610[_0x23de('0x4f')],function(_0x220686){var _0x4fe0a2={};_0x4fe0a2[_0x220686]={'$like':'%'+_0x346563[_0x23de('0x4b')]['filter']+'%'};return _0x4fe0a2;})});}_0x287610=_[_0x23de('0x57')]({},_0x287610,_0x346563[_0x23de('0x58')]);return _0x59d77f[_0x23de('0x8f')](_0x287610);}})[_0x23de('0x10')](function(_0x4344fa){if(_0x4344fa){_0x5cdb0c=_0x4344fa[_0x23de('0x50')];if(!_0x346563['query']['hasOwnProperty'](_0x23de('0x51'))){_0x287610[_0x23de('0x1e')]=qs[_0x23de('0x1e')](_0x346563[_0x23de('0x4b')][_0x23de('0x1e')]);_0x287610[_0x23de('0x20')]=qs[_0x23de('0x20')](_0x346563['query'][_0x23de('0x20')]);}return _0x59d77f[_0x23de('0x8f')](_0x287610);}})[_0x23de('0x10')](function(_0x432812){if(_0x432812){return _0x432812?{'count':_0x5cdb0c,'rows':_0x432812}:null;}})[_0x23de('0x10')](respondWithResult(_0x54d5a6,null))[_0x23de('0x18')](handleError(_0x54d5a6,null));};exports['getMessages']=function(_0x15d619,_0x27140a){var _0x40aa1a={'raw':!![],'where':{}};var _0x5115e8={};var _0x53aab4={'count':0x0,'rows':[]};return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x15d619[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x27140a,null))[_0x23de('0x10')](function(_0x48127b){if(_0x48127b){_0x5115e8[_0x23de('0x49')]=_[_0x23de('0x4a')](db[_0x23de('0x90')][_0x23de('0x45')]);_0x5115e8[_0x23de('0x4b')]=_[_0x23de('0x4a')](_0x15d619[_0x23de('0x4b')]);_0x5115e8['filters']=_[_0x23de('0x4d')](_0x5115e8['model'],_0x5115e8[_0x23de('0x4b')]);_0x40aa1a[_0x23de('0x4f')]=_[_0x23de('0x4d')](_0x5115e8['model'],qs[_0x23de('0x4e')](_0x15d619[_0x23de('0x4b')]['fields']));_0x40aa1a[_0x23de('0x4f')]=_0x40aa1a[_0x23de('0x4f')]['length']?_0x40aa1a[_0x23de('0x4f')]:_0x5115e8['model'];if(!_0x15d619[_0x23de('0x4b')]['hasOwnProperty'](_0x23de('0x51'))){_0x40aa1a['limit']=qs[_0x23de('0x1e')](_0x15d619[_0x23de('0x4b')][_0x23de('0x1e')]);_0x40aa1a[_0x23de('0x20')]=qs['offset'](_0x15d619['query'][_0x23de('0x20')]);}_0x40aa1a[_0x23de('0x52')]=qs[_0x23de('0x53')](_0x15d619[_0x23de('0x4b')][_0x23de('0x53')]);_0x40aa1a[_0x23de('0x56')]=qs[_0x23de('0x4c')](_[_0x23de('0x54')](_0x15d619[_0x23de('0x4b')],_0x5115e8['filters']));_0x40aa1a[_0x23de('0x56')][_0x23de('0x64')]=_0x48127b['id'];if(_0x15d619[_0x23de('0x4b')][_0x23de('0x55')]){_0x40aa1a[_0x23de('0x56')]=_[_0x23de('0x57')](_0x40aa1a[_0x23de('0x56')],{'$or':_['map'](_0x40aa1a[_0x23de('0x4f')],function(_0x3ebe11){var _0x1b2c87={};_0x1b2c87[_0x3ebe11]={'$like':'%'+_0x15d619[_0x23de('0x4b')]['filter']+'%'};return _0x1b2c87;})});}if(_0x15d619[_0x23de('0x4b')][_0x23de('0x91')]){var _0x46361a=_0x15d619[_0x23de('0x4b')][_0x23de('0x91')][_0x23de('0x92')](',');var _0x4c5cfd={};_0x4c5cfd[_0x46361a[0x0]]={'$gte':moment(_0x46361a[0x1])[_0x23de('0x93')](_0x23de('0x94'))};_0x40aa1a['where']=_['merge'](_0x40aa1a[_0x23de('0x56')],_0x4c5cfd);}_0x40aa1a=_[_0x23de('0x57')]({},_0x40aa1a,_0x15d619[_0x23de('0x58')]);return db[_0x23de('0x90')]['count']({'where':_0x40aa1a[_0x23de('0x56')]})[_0x23de('0x10')](function(_0x23b19c){_0x53aab4['count']=_0x23b19c;if(_0x15d619[_0x23de('0x4b')][_0x23de('0x59')]){_0x40aa1a['include']=[{'all':!![]}];}return db[_0x23de('0x90')]['findAll'](_0x40aa1a);})['then'](function(_0xb13f6){if(_0x15d619[_0x23de('0x4b')][_0x23de('0x95')]===_0x23de('0x96')){for(var _0x25cc2d=0x0;_0x25cc2d<_0xb13f6['length'];_0x25cc2d++){_0xb13f6[_0x25cc2d]['body']=juice(_0xb13f6[_0x25cc2d]['body']);}}_0x53aab4[_0x23de('0x5c')]=_0xb13f6;return _0x53aab4;});}})[_0x23de('0x10')](respondWithFilteredResult(_0x27140a,_0x40aa1a))['catch'](handleError(_0x27140a,null));};exports[_0x23de('0x28')]=function(_0x29852d,_0x5e5267){var _0x5ee70a,_0xc7cd5c={},_0x4fa3c8;if(_0x29852d[_0x23de('0x5e')]['to']){_0x4fa3c8=_0x29852d['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x23de('0x5d')]({'where':{'id':_0x29852d[_0x23de('0x60')]['id']},'include':[{'model':db[_0x23de('0x97')],'as':_0x23de('0x98'),'include':[{'model':db[_0x23de('0x99')],'as':_0x23de('0x9a'),'where':{'email':_0x4fa3c8},'limit':0x1,'order':[[_0x23de('0x9b'),_0x23de('0x9c')]]}]},{'model':db[_0x23de('0x61')],'as':_0x23de('0x3f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x23de('0x10')](handleEntityNotFound(_0x5e5267,null))[_0x23de('0x10')](function(_0x512b8a){if(!_0x512b8a)return;_0x5ee70a=_0x512b8a;if(!_0x512b8a[_0x23de('0x3f')])throw new Error(_0x23de('0x9d'));if(_[_0x23de('0x9e')](_0x29852d[_0x23de('0x5e')][_0x23de('0x9f')])){_0x29852d[_0x23de('0x5e')]['from']=util[_0x23de('0x93')](_0x23de('0xa0'),_0x512b8a['name'],_0x512b8a[_0x23de('0xa1')]||_0x512b8a[_0x23de('0x3f')][_0x23de('0x33')]);}if(_0x29852d[_0x23de('0x5e')][_0x23de('0xa2')]&&_0x29852d[_0x23de('0x5e')][_0x23de('0xa2')][_0x23de('0x50')]){for(var _0x466cc1=0x0;_0x466cc1<_0x29852d['body'][_0x23de('0xa2')]['length'];_0x466cc1+=0x1){_0x29852d[_0x23de('0x5e')]['attachments'][_0x466cc1]={'filename':_0x29852d[_0x23de('0x5e')]['attachments'][_0x466cc1][_0x23de('0x6f')],'path':path[_0x23de('0xa3')](config['root'],'server/files/attachments',_0x29852d[_0x23de('0x5e')][_0x23de('0xa2')][_0x466cc1][_0x23de('0xa4')])};}}var _0x31ba27=_0x512b8a[_0x23de('0xa5')]();return respondWithRpcPromise(_0x23de('0xa6'),_0x23de('0xa7'),{'account':_0x31ba27,'message':_0x29852d[_0x23de('0x5e')]});})['then'](function(_0x153661){if(!_0x153661)return;_0xc7cd5c=_0x153661;if(!_0x5ee70a[_0x23de('0x98')])throw new Error(_0x23de('0xa8'));if(_0x5ee70a[_0x23de('0x98')][_0x23de('0x9a')][_0x23de('0x50')])return _0x5ee70a['List'][_0x23de('0x9a')][0x0];return db[_0x23de('0x99')][_0x23de('0x65')](_[_0x23de('0x9')](_0x29852d['body'],{'firstName':_0x29852d['body']['to'],'email':_0x29852d[_0x23de('0x5e')]['to'],'phone':_0x29852d[_0x23de('0x5e')]['to'],'ListId':_0x5ee70a[_0x23de('0xa9')]}));})[_0x23de('0x10')](function(_0x4d021c){if(!_0x4d021c)return;var _0x42f0e5={'UserId':_0x29852d[_0x23de('0x33')]['id'],'ContactId':_0x4d021c['id'],'MailAccountId':_0x5ee70a['id'],'inReplyTo':_0xc7cd5c[_0x23de('0xaa')],'to':_0x29852d[_0x23de('0x5e')]['from'],'cc':_0x29852d[_0x23de('0x5e')]['cc'],'subject':_0x29852d[_0x23de('0x5e')][_0x23de('0xab')],'attach':_0x29852d[_0x23de('0x5e')][_0x23de('0xac')],'firstMsgDirection':_0x23de('0xad'),'lastMsgAt':moment()[_0x23de('0x93')](_0x23de('0x94')),'lastMsgDirection':_0x23de('0xad'),'Messages':[_['merge'](_0x29852d[_0x23de('0x5e')],{'messageId':_0xc7cd5c[_0x23de('0xaa')],'sentAt':moment()[_0x23de('0x93')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5ee70a['id'],'UserId':_0x29852d[_0x23de('0x33')]['id'],'ContactId':_0x4d021c['id']})]};if(_0x29852d[_0x23de('0x5e')][_0x23de('0xae')]){_0x42f0e5=_[_0x23de('0x57')](_0x42f0e5,_0x29852d['body'][_0x23de('0xae')]);}return db['MailInteraction'][_0x23de('0x65')](_0x42f0e5,{'include':[{'model':db[_0x23de('0x90')],'as':_0x23de('0xaf')}]});})[_0x23de('0x10')](respondWithResult(_0x5e5267,null))['catch'](handleError(_0x5e5267,null));};exports['verifySmtp']=function(_0x4ea738,_0x3cbb7c){return db[_0x23de('0x44')]['find']({'where':{'id':_0x4ea738[_0x23de('0x60')]['id']},'include':[{'model':db[_0x23de('0x61')],'as':_0x23de('0x3f'),'raw':!![],'include':[{'model':db[_0x23de('0xb0')],'as':_0x23de('0xb0'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3cbb7c,null))[_0x23de('0x10')](function(_0x16243c){if(!_0x16243c['Smtp'])return;var _0x1c59db=_0x16243c[_0x23de('0xa5')]();return respondWithRpcPromise(_0x23de('0xb1'),'verifySmtp',{'account':_0x1c59db});})[_0x23de('0x10')](respondWithResult(_0x3cbb7c,null))[_0x23de('0x18')](handleError(_0x3cbb7c,null));};exports['destroy']=function(_0x544777,_0x338f25){return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x544777[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x338f25,null))[_0x23de('0x10')](function(_0x70c3ad){if(_0x70c3ad&&_0x70c3ad[_0x23de('0x3b')]){throw new db['Sequelize'][(_0x23de('0xb2'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x70c3ad;})[_0x23de('0x10')](removeEntity(_0x338f25,null))[_0x23de('0x18')](handleError(_0x338f25,null));};exports[_0x23de('0xb3')]=function(_0x43191e,_0x187d5f){return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x43191e[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x187d5f,null))['then'](function(_0x265995){if(_0x265995){return _0x265995[_0x23de('0xb3')](_0x43191e[_0x23de('0x5e')][_0x23de('0x6a')],_[_0x23de('0xb4')](_0x43191e['body'],[_0x23de('0x6a'),'id'])||{})[_0x23de('0xb5')](function(_0x1cb95b){for(var _0x24b199=0x0;_0x24b199<_0x43191e[_0x23de('0x5e')][_0x23de('0x6a')][_0x23de('0x50')];_0x24b199+=0x1){socket['emit'](_0x23de('0xb6'),{'UserId':Number(_0x43191e['body']['ids'][_0x24b199]),'MailAccountId':Number(_0x43191e[_0x23de('0x60')]['id'])});}return _0x1cb95b;});}})[_0x23de('0x10')](respondWithResult(_0x187d5f,null))[_0x23de('0x18')](handleError(_0x187d5f,null));};exports[_0x23de('0xb7')]=function(_0x1d8d3b,_0x3f3820){return db[_0x23de('0x44')][_0x23de('0x5d')]({'where':{'id':_0x1d8d3b['params']['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x3f3820,null))[_0x23de('0x10')](function(_0x599445){if(_0x599445){return _0x599445['removeAgents'](_0x1d8d3b[_0x23de('0x4b')]['ids'])['then'](function(){if(_[_0x23de('0xb8')](_0x1d8d3b['query'][_0x23de('0x6a')])){for(var _0x414712=0x0;_0x414712<_0x1d8d3b['query'][_0x23de('0x6a')]['length'];_0x414712+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x1d8d3b[_0x23de('0x4b')][_0x23de('0x6a')][_0x414712]),'MailAccountId':Number(_0x1d8d3b[_0x23de('0x60')]['id'])});}}else{socket['emit'](_0x23de('0xb9'),{'UserId':Number(_0x1d8d3b['query']['ids']),'MailAccountId':Number(_0x1d8d3b[_0x23de('0x60')]['id'])});}});}})[_0x23de('0x10')](respondWithStatusCode(_0x3f3820,null))[_0x23de('0x18')](handleError(_0x3f3820,null));};exports['getAgents']=function(_0x3a7e0b,_0x1afd3a){var _0x55b558={};var _0x48e59d={};var _0x26a4cc;var _0x300c96;return db[_0x23de('0x44')][_0x23de('0x6c')]({'where':{'id':_0x3a7e0b[_0x23de('0x60')]['id']}})[_0x23de('0x10')](handleEntityNotFound(_0x1afd3a,null))['then'](function(_0x39f245){if(_0x39f245){_0x26a4cc=_0x39f245;_0x48e59d['model']=_[_0x23de('0x4a')](db[_0x23de('0x7f')]['rawAttributes']);_0x48e59d[_0x23de('0x4b')]=_[_0x23de('0x4a')](_0x3a7e0b[_0x23de('0x4b')]);_0x48e59d[_0x23de('0x4c')]=_[_0x23de('0x4d')](_0x48e59d['model'],_0x48e59d[_0x23de('0x4b')]);_0x55b558[_0x23de('0x4f')]=_['intersection'](_0x48e59d[_0x23de('0x49')],qs[_0x23de('0x4e')](_0x3a7e0b[_0x23de('0x4b')][_0x23de('0x4e')]));_0x55b558[_0x23de('0x4f')]=_0x55b558[_0x23de('0x4f')][_0x23de('0x50')]?_0x55b558['attributes']:_0x48e59d[_0x23de('0x49')];_0x55b558['order']=qs[_0x23de('0x53')](_0x3a7e0b[_0x23de('0x4b')][_0x23de('0x53')]);_0x55b558['where']=qs['filters'](_[_0x23de('0x54')](_0x3a7e0b['query'],_0x48e59d[_0x23de('0x4c')]));if(_0x3a7e0b['query'][_0x23de('0x55')]){_0x55b558[_0x23de('0x56')]=_[_0x23de('0x57')](_0x55b558['where'],{'$or':_['map'](_0x55b558[_0x23de('0x4f')],function(_0x4b9e72){var _0x463076={};_0x463076[_0x4b9e72]={'$like':'%'+_0x3a7e0b['query'][_0x23de('0x55')]+'%'};return _0x463076;})});}_0x55b558=_[_0x23de('0x57')]({},_0x55b558,_0x3a7e0b['options']);return _0x26a4cc['getAgents'](_0x55b558);}})[_0x23de('0x10')](function(_0x57715c){if(_0x57715c){_0x300c96=_0x57715c[_0x23de('0x50')];if(!_0x3a7e0b[_0x23de('0x4b')][_0x23de('0x67')](_0x23de('0x51'))){_0x55b558[_0x23de('0x1e')]=qs['limit'](_0x3a7e0b[_0x23de('0x4b')][_0x23de('0x1e')]);_0x55b558[_0x23de('0x20')]=qs[_0x23de('0x20')](_0x3a7e0b[_0x23de('0x4b')][_0x23de('0x20')]);}return _0x26a4cc['getAgents'](_0x55b558);}})[_0x23de('0x10')](function(_0x3bf331){if(_0x3bf331){return _0x3bf331?{'count':_0x300c96,'rows':_0x3bf331}:null;}})['then'](respondWithResult(_0x1afd3a,null))[_0x23de('0x18')](handleError(_0x1afd3a,null));}; \ No newline at end of file +var _0x2ec3=['smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','host','port','service','authentication','username','pass','Imap','Smtp','index','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerIn','mandatoryDispositionPause','intersection','find','update','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','create','findOne','nolimit','MailAccountId','filter','map','Disposition','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','key','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','true','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','List','List\x20not\x20found','defaults','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','undefined','limit','count','offset','status','Content-Range','json','destroy','get','MailAccounts','end','name','send','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail'];(function(_0x34f33d,_0x21b03a){var _0x47a32a=function(_0x58bd9f){while(--_0x58bd9f){_0x34f33d['push'](_0x34f33d['shift']());}};_0x47a32a(++_0x21b03a);}(_0x2ec3,0x156));var _0x32ec=function(_0x3aa4ce,_0x3268cd){_0x3aa4ce=_0x3aa4ce-0x0;var _0x37244a=_0x2ec3[_0x3aa4ce];return _0x37244a;};'use strict';var moment=require(_0x32ec('0x0'));var BPromise=require(_0x32ec('0x1'));var util=require(_0x32ec('0x2'));var path=require(_0x32ec('0x3'));var _=require(_0x32ec('0x4'));var juice=require('juice');var Redis=require(_0x32ec('0x5'));var qs=require(_0x32ec('0x6'));var logger=require('../../config/logger')(_0x32ec('0x7'));var config=require(_0x32ec('0x8'));var db=require(_0x32ec('0x9'))['db'];config[_0x32ec('0xa')]=_['defaults'](config[_0x32ec('0xa')],{'host':_0x32ec('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32ec('0xa')]));require(_0x32ec('0xc'))[_0x32ec('0xd')](socket);var jayson=require(_0x32ec('0xe'));var client=jayson[_0x32ec('0xf')][_0x32ec('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x1682da,_0xb24222,_0x5f2a4a,_0x29ced0){return new BPromise(function(_0x1d24c8,_0x530f08){var _0x1c73d4=_0x29ced0||client;return _0x1c73d4[_0x32ec('0x11')](_0x1682da,_0x5f2a4a)[_0x32ec('0x12')](function(_0x13a32a){logger[_0x32ec('0x13')](_0x32ec('0x14'),_0xb24222,'request\x20sent');logger[_0x32ec('0x15')](_0x32ec('0x16'),_0xb24222,_0x32ec('0x17'),JSON[_0x32ec('0x18')](_0x13a32a));if(_0x13a32a[_0x32ec('0x19')]){if(_0x13a32a[_0x32ec('0x19')][_0x32ec('0x1a')]===0x1f4){logger[_0x32ec('0x19')](_0x32ec('0x14'),_0xb24222,_0x13a32a[_0x32ec('0x19')][_0x32ec('0x1b')]);return _0x530f08(_0x13a32a['error']['message']);}logger[_0x32ec('0x19')](_0x32ec('0x14'),_0xb24222,_0x13a32a[_0x32ec('0x19')]['message']);return _0x1d24c8(_0x13a32a[_0x32ec('0x19')][_0x32ec('0x1b')]);}else{logger[_0x32ec('0x13')]('MailAccount,\x20%s,\x20%s',_0xb24222,_0x32ec('0x17'));_0x1d24c8(_0x13a32a[_0x32ec('0x1c')]['message']);}})[_0x32ec('0x1d')](function(_0x582307){logger[_0x32ec('0x19')](_0x32ec('0x14'),_0xb24222,_0x582307);_0x530f08(_0x582307);});});}function respondWithStatusCode(_0x590d83,_0xd52d61){_0xd52d61=_0xd52d61||0xcc;return function(_0x2d2233){if(_0x2d2233){return _0x590d83[_0x32ec('0x1e')](_0xd52d61);}return _0x590d83['status'](_0xd52d61)['end']();};}function respondWithResult(_0x520d0c,_0x197091){_0x197091=_0x197091||0xc8;return function(_0x398847){if(_0x398847){return _0x520d0c['status'](_0x197091)['json'](_0x398847);}};}function respondWithFilteredResult(_0x1b234d,_0x41e6a5){return function(_0x1416bc){if(_0x1416bc){var _0x4b200c=typeof _0x41e6a5['offset']===_0x32ec('0x1f')&&typeof _0x41e6a5[_0x32ec('0x20')]===_0x32ec('0x1f');var _0xa764e4=_0x1416bc[_0x32ec('0x21')];var _0x474ed5=_0x4b200c?0x0:_0x41e6a5[_0x32ec('0x22')];var _0x118306=_0x4b200c?_0x1416bc[_0x32ec('0x21')]:_0x41e6a5[_0x32ec('0x22')]+_0x41e6a5[_0x32ec('0x20')];var _0x2e2690;if(_0x118306>=_0xa764e4){_0x118306=_0xa764e4;_0x2e2690=0xc8;}else{_0x2e2690=0xce;}_0x1b234d[_0x32ec('0x23')](_0x2e2690);return _0x1b234d['set'](_0x32ec('0x24'),_0x474ed5+'-'+_0x118306+'/'+_0xa764e4)[_0x32ec('0x25')](_0x1416bc);}return null;};}function saveUpdates(_0x498448){return function(_0x1a3756){if(_0x1a3756){return _0x1a3756['update'](_0x498448)[_0x32ec('0x12')](function(_0x20316a){return _0x20316a;});}return null;};}function removeEntity(_0x2406de){return function(_0x9bc8c0){if(_0x9bc8c0){return _0x9bc8c0[_0x32ec('0x26')]()[_0x32ec('0x12')](function(){var _0x397592=_0x9bc8c0[_0x32ec('0x27')]({'plain':!![]});var _0x446e59=_0x32ec('0x28');return db['UserProfileResource'][_0x32ec('0x26')]({'where':{'type':_0x446e59,'resourceId':_0x397592['id']}})[_0x32ec('0x12')](function(){return _0x9bc8c0;});})[_0x32ec('0x12')](function(){_0x2406de[_0x32ec('0x23')](0xcc)[_0x32ec('0x29')]();});}};}function handleEntityNotFound(_0x11ef97){return function(_0x3426eb){if(!_0x3426eb){_0x11ef97[_0x32ec('0x1e')](0x194);}return _0x3426eb;};}function handleError(_0x2dd1e6,_0x4bf46e){_0x4bf46e=_0x4bf46e||0x1f4;return function(_0x402b83){logger['error'](_0x402b83['stack']);if(_0x402b83[_0x32ec('0x2a')]){delete _0x402b83[_0x32ec('0x2a')];}_0x2dd1e6[_0x32ec('0x23')](_0x4bf46e)[_0x32ec('0x2b')](_0x402b83);};}function getImapHost(_0x48a05a){switch(_0x48a05a){case _0x32ec('0x2c'):return'imap.gmail.com';case _0x32ec('0x2d'):return _0x32ec('0x2e');case'hotmail':return _0x32ec('0x2f');case _0x32ec('0x30'):return _0x32ec('0x31');}throw new Error(_0x32ec('0x32'),_0x48a05a);}function getSmtpHost(_0xdff956){switch(_0xdff956){case _0x32ec('0x2c'):return _0x32ec('0x33');case _0x32ec('0x2d'):return _0x32ec('0x34');case _0x32ec('0x35'):return _0x32ec('0x36');case _0x32ec('0x30'):return _0x32ec('0x37');}throw new Error(_0x32ec('0x32'),_0xdff956);}function getAuthenticationOptions(_0x1d3e8a,_0x40c4b0){var _0x18ce64={};var _0x3238f5={};if(_0x1d3e8a){_0x18ce64[_0x32ec('0x38')]=_0x3238f5[_0x32ec('0x38')]=_0x40c4b0['username'];_0x18ce64[_0x32ec('0x39')]=_0x3238f5['pass']=_0x40c4b0['password'];if(_0x40c4b0[_0x32ec('0x3a')]){_0x18ce64['modernAuthentication']=_0x3238f5[_0x32ec('0x3a')]=!![];_0x18ce64['CloudProviderId']=_0x3238f5[_0x32ec('0x3b')]=_0x40c4b0['CloudProviderId'];_0x18ce64[_0x32ec('0x39')]=_0x3238f5['pass']=null;}else{_0x18ce64['CloudProviderId']=_0x3238f5[_0x32ec('0x3b')]=null;}_0x18ce64[_0x32ec('0x3c')]=getImapHost(_0x1d3e8a);_0x18ce64[_0x32ec('0x3d')]=0x3e1;_0x3238f5[_0x32ec('0x3c')]=getSmtpHost(_0x1d3e8a);_0x3238f5[_0x32ec('0x3d')]=0x24b;_0x3238f5['secure']=![];_0x18ce64[_0x32ec('0x3e')]=_0x3238f5['service']=null;}else{if(_0x40c4b0[_0x32ec('0x3f')]){_0x18ce64[_0x32ec('0x38')]=_0x3238f5['user']=_0x40c4b0[_0x32ec('0x40')];_0x18ce64[_0x32ec('0x39')]=_0x3238f5[_0x32ec('0x41')]=_0x40c4b0[_0x32ec('0x39')];}else{_0x18ce64['authentication']=_0x3238f5[_0x32ec('0x3f')]=![];_0x18ce64[_0x32ec('0x38')]=_0x3238f5[_0x32ec('0x38')]=null;_0x18ce64['password']=_0x3238f5[_0x32ec('0x41')]=null;}_0x18ce64[_0x32ec('0x3c')]=_0x40c4b0[_0x32ec('0x42')][_0x32ec('0x3c')];_0x18ce64[_0x32ec('0x3d')]=_0x40c4b0[_0x32ec('0x42')]['port'];_0x3238f5[_0x32ec('0x3c')]=_0x40c4b0[_0x32ec('0x43')][_0x32ec('0x3c')];_0x3238f5['port']=_0x40c4b0['Smtp'][_0x32ec('0x3d')];}return{'Imap':_0x18ce64,'Smtp':_0x3238f5};}exports[_0x32ec('0x44')]=function(_0x57ed68,_0x2abb13){var _0x34966e={'include':[{'model':db['MailServerIn'],'as':_0x32ec('0x42')},{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43')},{'model':db[_0x32ec('0x46')],'as':'mandatoryDispositionPause'}]},_0x5cc7db={},_0x54ae6b={'count':0x0,'rows':[]};var _0x468d69=_['map'](db[_0x32ec('0x47')][_0x32ec('0x48')],function(_0x2f6528){return{'name':_0x2f6528[_0x32ec('0x49')],'type':_0x2f6528[_0x32ec('0x4a')]['key']};});_0x5cc7db[_0x32ec('0x4b')]=_['map'](_0x468d69,_0x32ec('0x2a'));_0x5cc7db[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x57ed68['query']);_0x5cc7db[_0x32ec('0x4e')]=_['intersection'](_0x5cc7db[_0x32ec('0x4b')],_0x5cc7db[_0x32ec('0x4c')]);_0x34966e[_0x32ec('0x4f')]=_['intersection'](_0x5cc7db[_0x32ec('0x4b')],qs[_0x32ec('0x50')](_0x57ed68[_0x32ec('0x4c')][_0x32ec('0x50')]));_0x34966e['attributes']=_0x34966e[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x34966e[_0x32ec('0x4f')]:_0x5cc7db['model'];if(!_0x57ed68[_0x32ec('0x4c')][_0x32ec('0x52')]('nolimit')){_0x34966e['limit']=qs['limit'](_0x57ed68['query'][_0x32ec('0x20')]);_0x34966e[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x57ed68['query'][_0x32ec('0x22')]);}_0x34966e[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x57ed68['query'][_0x32ec('0x54')]);_0x34966e[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x57ed68['query'],_0x5cc7db[_0x32ec('0x4e')]),_0x468d69);if(_0x57ed68[_0x32ec('0x4c')]['filter']){_0x34966e['where']=_[_0x32ec('0x57')](_0x34966e[_0x32ec('0x55')],{'$or':_['map'](_0x468d69,function(_0x5e48d6){if(_0x5e48d6[_0x32ec('0x4a')]!==_0x32ec('0x58')){var _0x1be59e={};_0x1be59e[_0x5e48d6[_0x32ec('0x2a')]]={'$like':'%'+_0x57ed68[_0x32ec('0x4c')]['filter']+'%'};return _0x1be59e;}})});}_0x34966e=_['merge']({},_0x34966e,_0x57ed68[_0x32ec('0x59')]);var _0x2afb8d={'where':_0x34966e['where']};return db['MailAccount']['count'](_0x2afb8d)[_0x32ec('0x12')](function(_0x1536f3){_0x54ae6b[_0x32ec('0x21')]=_0x1536f3;if(_0x57ed68['query'][_0x32ec('0x5a')]){_0x34966e[_0x32ec('0x5b')]=[{'all':!![]}];}return db[_0x32ec('0x47')][_0x32ec('0x5c')](_0x34966e);})[_0x32ec('0x12')](function(_0x2ea814){_0x54ae6b[_0x32ec('0x5d')]=_0x2ea814;return _0x54ae6b;})['then'](respondWithFilteredResult(_0x2abb13,_0x34966e))['catch'](handleError(_0x2abb13,null));};exports['show']=function(_0x7ba153,_0x21998f){var _0xc5f4b2={'raw':![],'where':{'id':_0x7ba153[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0x5f')],'as':_0x32ec('0x42')},{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43')},{'model':db['Pause'],'as':_0x32ec('0x60')}]},_0x651760={};_0x651760[_0x32ec('0x4b')]=_['keys'](db['MailAccount'][_0x32ec('0x48')]);_0x651760[_0x32ec('0x4c')]=_['keys'](_0x7ba153[_0x32ec('0x4c')]);_0x651760[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x651760['model'],_0x651760[_0x32ec('0x4c')]);_0xc5f4b2[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x651760[_0x32ec('0x4b')],qs[_0x32ec('0x50')](_0x7ba153[_0x32ec('0x4c')]['fields']));_0xc5f4b2[_0x32ec('0x4f')]=_0xc5f4b2[_0x32ec('0x4f')][_0x32ec('0x51')]?_0xc5f4b2[_0x32ec('0x4f')]:_0x651760['model'];if(_0x7ba153[_0x32ec('0x4c')][_0x32ec('0x5a')]){_0xc5f4b2[_0x32ec('0x5b')]=[{'all':!![]}];}_0xc5f4b2=_[_0x32ec('0x57')]({},_0xc5f4b2,_0x7ba153['options']);return db[_0x32ec('0x47')][_0x32ec('0x62')](_0xc5f4b2)['then'](handleEntityNotFound(_0x21998f,null))[_0x32ec('0x12')](respondWithResult(_0x21998f,null))[_0x32ec('0x1d')](handleError(_0x21998f,null));};exports[_0x32ec('0x63')]=function(_0x519e30,_0x1d3f7b){if(_0x519e30[_0x32ec('0x64')]['id']){delete _0x519e30[_0x32ec('0x64')]['id'];}var _0x57c1b2=_0x519e30[_0x32ec('0x64')][_0x32ec('0x65')]===_0x32ec('0x66')?null:_0x519e30[_0x32ec('0x64')][_0x32ec('0x65')];var _0x4f2043=_0x519e30[_0x32ec('0x64')]['Imap']||{};var _0x5b16af=_0x519e30[_0x32ec('0x64')][_0x32ec('0x43')]||{};if(_0x57c1b2){_0x4f2043[_0x32ec('0x3c')]=getImapHost(_0x57c1b2);_0x4f2043[_0x32ec('0x3d')]=0x3e1;_0x5b16af[_0x32ec('0x3c')]=getSmtpHost(_0x57c1b2);_0x5b16af[_0x32ec('0x3d')]=0x24b;_0x5b16af[_0x32ec('0x67')]=![];}if(_0x5b16af[_0x32ec('0x3a')]){_0x5b16af[_0x32ec('0x67')]=![];}else{_0x5b16af[_0x32ec('0x3b')]=null;}if(!_0x4f2043[_0x32ec('0x3a')])_0x4f2043[_0x32ec('0x3b')]=null;_0x519e30[_0x32ec('0x64')][_0x32ec('0x42')]=_0x4f2043;_0x519e30[_0x32ec('0x64')][_0x32ec('0x43')]=_0x5b16af;return db['MailAccount'][_0x32ec('0x62')]({'where':{'id':_0x519e30[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0x5f')],'as':_0x32ec('0x42')},{'model':db[_0x32ec('0x45')],'as':'Smtp'},{'model':db[_0x32ec('0x46')],'as':_0x32ec('0x60')}]})['then'](handleEntityNotFound(_0x1d3f7b,null))['then'](function(_0x125d9a){if(!_0x125d9a)throw new Error(_0x32ec('0x68'));if(_0x125d9a[_0x32ec('0x3e')])delete _0x519e30[_0x32ec('0x64')][_0x32ec('0x42')];return _0x125d9a;})[_0x32ec('0x12')](saveUpdates(_0x519e30[_0x32ec('0x64')],null))['then'](function(_0x4b4845){if(!_0x519e30['body'][_0x32ec('0x42')])return _0x4b4845;return db[_0x32ec('0x5f')]['update'](_0x519e30[_0x32ec('0x64')][_0x32ec('0x42')],{'where':{'MailAccountId':_0x4b4845['id']}})[_0x32ec('0x12')](function(){return _0x4b4845;});})['then'](function(_0x3e86a5){if(!_0x519e30[_0x32ec('0x64')]['Smtp'])return _0x3e86a5;return db['MailServerOut'][_0x32ec('0x63')](_0x519e30['body'][_0x32ec('0x43')],{'where':{'MailAccountId':_0x3e86a5['id']}})['then'](function(){return _0x3e86a5;});})[_0x32ec('0x12')](respondWithResult(_0x1d3f7b,null))[_0x32ec('0x1d')](handleError(_0x1d3f7b,null));};exports['describe']=function(_0x245615,_0x3047c1){return db[_0x32ec('0x47')][_0x32ec('0x69')]()['then'](respondWithResult(_0x3047c1,null))[_0x32ec('0x1d')](handleError(_0x3047c1,null));};exports[_0x32ec('0x6a')]=function(_0x5d0e8e,_0xe0e12f){if(_0x5d0e8e['body']['id']){delete _0x5d0e8e['body']['id'];}return db[_0x32ec('0x47')]['find']({'where':{'id':_0x5d0e8e[_0x32ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0xe0e12f,null))[_0x32ec('0x12')](function(_0x317278){if(_0x317278){_0x5d0e8e[_0x32ec('0x64')]['MailAccountId']=_0x317278['id'];return db['Disposition'][_0x32ec('0x6b')](_0x5d0e8e[_0x32ec('0x64')]);}})['then'](respondWithResult(_0xe0e12f,null))[_0x32ec('0x1d')](handleError(_0xe0e12f,null));};exports['getDispositions']=function(_0x5b32bd,_0x5154c5){var _0x488059={'raw':![],'where':{}};var _0x2ec62e={};var _0x4abb4f={'count':0x0,'rows':[]};return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x5b32bd[_0x32ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5154c5,null))[_0x32ec('0x12')](function(_0x3aab71){if(_0x3aab71){_0x2ec62e[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db['Disposition'][_0x32ec('0x48')]);_0x2ec62e[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x5b32bd['query']);_0x2ec62e[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x2ec62e[_0x32ec('0x4b')],_0x2ec62e[_0x32ec('0x4c')]);_0x488059[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x2ec62e['model'],qs[_0x32ec('0x50')](_0x5b32bd[_0x32ec('0x4c')][_0x32ec('0x50')]));_0x488059[_0x32ec('0x4f')]=_0x488059[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x488059['attributes']:_0x2ec62e[_0x32ec('0x4b')];if(!_0x5b32bd['query'][_0x32ec('0x52')](_0x32ec('0x6d'))){_0x488059[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x5b32bd[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x488059[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x5b32bd['query']['offset']);}_0x488059[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x5b32bd['query'][_0x32ec('0x54')]);_0x488059[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x5b32bd[_0x32ec('0x4c')],_0x2ec62e['filters']));_0x488059[_0x32ec('0x55')][_0x32ec('0x6e')]=_0x3aab71['id'];if(_0x5b32bd[_0x32ec('0x4c')][_0x32ec('0x6f')]){_0x488059['where']=_[_0x32ec('0x57')](_0x488059['where'],{'$or':_[_0x32ec('0x70')](_0x488059[_0x32ec('0x4f')],function(_0x26fb3b){var _0x55f587={};_0x55f587[_0x26fb3b]={'$like':'%'+_0x5b32bd[_0x32ec('0x4c')]['filter']+'%'};return _0x55f587;})});}_0x488059=_['merge']({},_0x488059,_0x5b32bd[_0x32ec('0x59')]);return db[_0x32ec('0x71')][_0x32ec('0x21')]({'where':_0x488059[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0x3bcedc){_0x4abb4f[_0x32ec('0x21')]=_0x3bcedc;if(_0x5b32bd[_0x32ec('0x4c')]['includeAll']){_0x488059[_0x32ec('0x5b')]=[{'all':!![]}];}return db[_0x32ec('0x71')][_0x32ec('0x5c')](_0x488059);})['then'](function(_0x22a3b0){_0x4abb4f['rows']=_0x22a3b0;return _0x4abb4f;});}})[_0x32ec('0x12')](respondWithFilteredResult(_0x5154c5,_0x488059))[_0x32ec('0x1d')](handleError(_0x5154c5,null));};exports[_0x32ec('0x72')]=function(_0xd479a2,_0x3c1413){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0xd479a2[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x3c1413,null))['then'](function(_0x10fc8b){if(_0x10fc8b){return _0x10fc8b['removeDispositions'](_0xd479a2[_0x32ec('0x4c')]['ids']);}})['then'](respondWithStatusCode(_0x3c1413,null))['catch'](handleError(_0x3c1413,null));};exports['addAnswer']=function(_0x40fb1d,_0xc15320){if(_0x40fb1d['body']['id']){delete _0x40fb1d[_0x32ec('0x64')]['id'];}return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x40fb1d['params']['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0xc15320,null))[_0x32ec('0x12')](function(_0x2d5dfd){if(_0x2d5dfd){_0x40fb1d['body'][_0x32ec('0x6e')]=_0x2d5dfd['id'];return db['CannedAnswer'][_0x32ec('0x6b')](_0x40fb1d[_0x32ec('0x64')]);}})[_0x32ec('0x12')](respondWithResult(_0xc15320,null))[_0x32ec('0x1d')](handleError(_0xc15320,null));};exports[_0x32ec('0x73')]=function(_0x3cb846,_0x584c39){var _0x3f6312={'raw':![],'where':{}};var _0x5000cc={};var _0x22530a={'count':0x0,'rows':[]};return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x3cb846[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x584c39,null))['then'](function(_0x47fac6){if(_0x47fac6){_0x5000cc[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0x74')][_0x32ec('0x48')]);_0x5000cc[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x3cb846[_0x32ec('0x4c')]);_0x5000cc[_0x32ec('0x4e')]=_['intersection'](_0x5000cc[_0x32ec('0x4b')],_0x5000cc['query']);_0x3f6312[_0x32ec('0x4f')]=_['intersection'](_0x5000cc['model'],qs[_0x32ec('0x50')](_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x50')]));_0x3f6312[_0x32ec('0x4f')]=_0x3f6312[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x3f6312[_0x32ec('0x4f')]:_0x5000cc[_0x32ec('0x4b')];if(!_0x3cb846['query']['hasOwnProperty'](_0x32ec('0x6d'))){_0x3f6312[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x3f6312[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x22')]);}_0x3f6312[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x3cb846['query'][_0x32ec('0x54')]);_0x3f6312[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x3cb846[_0x32ec('0x4c')],_0x5000cc[_0x32ec('0x4e')]));_0x3f6312[_0x32ec('0x55')][_0x32ec('0x6e')]=_0x47fac6['id'];if(_0x3cb846['query'][_0x32ec('0x6f')]){_0x3f6312[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x3f6312['where'],{'$or':_['map'](_0x3f6312[_0x32ec('0x4f')],function(_0x1c587f){var _0x117677={};_0x117677[_0x1c587f]={'$like':'%'+_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x6f')]+'%'};return _0x117677;})});}_0x3f6312=_['merge']({},_0x3f6312,_0x3cb846[_0x32ec('0x59')]);return db[_0x32ec('0x74')][_0x32ec('0x21')]({'where':_0x3f6312[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0xb59ba1){_0x22530a[_0x32ec('0x21')]=_0xb59ba1;if(_0x3cb846[_0x32ec('0x4c')][_0x32ec('0x5a')]){_0x3f6312['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3f6312);})[_0x32ec('0x12')](function(_0x1833db){_0x22530a[_0x32ec('0x5d')]=_0x1833db;return _0x22530a;});}})['then'](respondWithFilteredResult(_0x584c39,_0x3f6312))[_0x32ec('0x1d')](handleError(_0x584c39,null));};exports[_0x32ec('0x75')]=function(_0x44cb0f,_0x3f09a3){return db[_0x32ec('0x47')]['find']({'where':{'id':_0x44cb0f[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x3f09a3,null))[_0x32ec('0x12')](function(_0x2c541f){if(_0x2c541f){return _0x2c541f['removeAnswers'](_0x44cb0f[_0x32ec('0x4c')][_0x32ec('0x76')]);}})[_0x32ec('0x12')](respondWithStatusCode(_0x3f09a3,null))[_0x32ec('0x1d')](handleError(_0x3f09a3,null));};exports[_0x32ec('0x6b')]=function(_0x2263db,_0x370718){var _0xce1f30={'name':_0x2263db[_0x32ec('0x64')]['name'],'key':_0x2263db['body'][_0x32ec('0x77')],'provider':_0x2263db[_0x32ec('0x64')]['provider']==='custom'?null:_0x2263db[_0x32ec('0x64')][_0x32ec('0x65')],'email':_0x2263db[_0x32ec('0x64')][_0x32ec('0x78')],'ListId':_0x2263db['body'][_0x32ec('0x79')],'active':!_[_0x32ec('0x7a')](_0x2263db[_0x32ec('0x64')][_0x32ec('0x7b')])?_0x2263db['body'][_0x32ec('0x7b')]:!![],'description':_0x2263db['body'][_0x32ec('0x7c')]||null};var _0x17726a=getAuthenticationOptions(_0xce1f30[_0x32ec('0x65')],_0x2263db[_0x32ec('0x64')]);_0xce1f30['Imap']=_0x17726a[_0x32ec('0x42')];_0xce1f30[_0x32ec('0x43')]=_0x17726a['Smtp'];return db['MailAccount']['create'](_0xce1f30,{'include':[{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43')},{'model':db[_0x32ec('0x5f')],'as':_0x32ec('0x42')}]})[_0x32ec('0x12')](function(_0x42ca12){var _0x2f2359=_0x2263db['user']['get']({'plain':!![]});if(!_0x2f2359)throw new Error(_0x32ec('0x7d'));if(_0x2f2359[_0x32ec('0x7e')]===_0x32ec('0x38')){var _0x45b098=_0x42ca12[_0x32ec('0x27')]({'plain':!![]});return db[_0x32ec('0x7f')][_0x32ec('0x62')]({'where':{'name':_0x32ec('0x28'),'userProfileId':_0x2f2359[_0x32ec('0x80')]},'raw':!![]})[_0x32ec('0x12')](function(_0x5d4d8b){if(_0x5d4d8b&&_0x5d4d8b[_0x32ec('0x81')]===0x0){return db[_0x32ec('0x82')][_0x32ec('0x6b')]({'name':_0x45b098['name'],'resourceId':_0x45b098['id'],'type':_0x5d4d8b[_0x32ec('0x2a')],'sectionId':_0x5d4d8b['id']},{})['then'](function(){return _0x42ca12;});}else{return _0x42ca12;}})[_0x32ec('0x1d')](function(_0x20d773){logger[_0x32ec('0x19')](_0x32ec('0x83'),_0x20d773);throw _0x20d773;});}return _0x42ca12;})[_0x32ec('0x12')](respondWithResult(_0x370718,0xc9))[_0x32ec('0x1d')](handleError(_0x370718,null));};exports[_0x32ec('0x84')]=function(_0x3a6255,_0x38aa89){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x3a6255[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x38aa89,null))['then'](function(_0x208526){if(_0x208526){return _0x208526[_0x32ec('0x84')]();}return null;})[_0x32ec('0x12')](respondWithResult(_0x38aa89,null))[_0x32ec('0x1d')](handleError(_0x38aa89,null));};exports[_0x32ec('0x85')]=function(_0x5b045a,_0x48afe8){if(_0x5b045a[_0x32ec('0x64')]['id']){delete _0x5b045a['body']['id'];}return db['MailAccount'][_0x32ec('0x62')]({'where':{'id':_0x5b045a[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x48afe8,null))[_0x32ec('0x12')](function(_0x5dd39c){if(_0x5dd39c){_0x5b045a['body'][_0x32ec('0x6e')]=_0x5dd39c['id'];return db[_0x32ec('0x5f')][_0x32ec('0x6b')](_0x5b045a[_0x32ec('0x64')]);}})[_0x32ec('0x12')](respondWithResult(_0x48afe8,null))[_0x32ec('0x1d')](handleError(_0x48afe8,null));};exports[_0x32ec('0x86')]=function(_0x52a89e,_0x5b597b){return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x52a89e['params']['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x5b597b,null))[_0x32ec('0x12')](function(_0x5e89ca){if(_0x5e89ca){return _0x5e89ca[_0x32ec('0x87')](null);}return null;})[_0x32ec('0x12')](respondWithStatusCode(_0x5b597b,null))[_0x32ec('0x1d')](handleError(_0x5b597b,null));};exports['getSmtp']=function(_0x544096,_0x1c2e7d){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x544096[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x1c2e7d,null))[_0x32ec('0x12')](function(_0x150b04){if(_0x150b04){return _0x150b04[_0x32ec('0x88')]();}return null;})['then'](respondWithResult(_0x1c2e7d,null))['catch'](handleError(_0x1c2e7d,null));};exports['addSmtp']=function(_0x5ba12c,_0x100319){if(_0x5ba12c[_0x32ec('0x64')]['id']){delete _0x5ba12c['body']['id'];}return db[_0x32ec('0x47')]['find']({'where':{'id':_0x5ba12c[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x100319,null))[_0x32ec('0x12')](function(_0x4a8c2f){if(_0x4a8c2f){_0x5ba12c['body'][_0x32ec('0x6e')]=_0x4a8c2f['id'];return db[_0x32ec('0x45')][_0x32ec('0x6b')](_0x5ba12c[_0x32ec('0x64')]);}})['then'](respondWithResult(_0x100319,null))['catch'](handleError(_0x100319,null));};exports['removeSmtp']=function(_0x513496,_0x5b1684){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x513496[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x5b1684,null))['then'](function(_0x475d27){if(_0x475d27){return _0x475d27['setSmtp'](null);}return null;})[_0x32ec('0x12')](respondWithStatusCode(_0x5b1684,null))[_0x32ec('0x1d')](handleError(_0x5b1684,null));};exports[_0x32ec('0x89')]=function(_0x3d910b,_0x558d56){return db[_0x32ec('0x8a')][_0x32ec('0x62')]({'where':{'id':_0x3d910b['params']['id']}})['then'](handleEntityNotFound(_0x558d56,null))[_0x32ec('0x12')](function(_0x3771da){if(_0x3771da){return _0x3771da[_0x32ec('0x89')](_0x3d910b[_0x32ec('0x64')][_0x32ec('0x76')],_[_0x32ec('0x8b')](_0x3d910b[_0x32ec('0x64')],[_0x32ec('0x76'),'id'])||{});}})['then'](respondWithResult(_0x558d56,null))[_0x32ec('0x1d')](handleError(_0x558d56,null));};exports['getInteractions']=function(_0x38687c,_0x3008ee){var _0x221249={'raw':![],'where':{}};var _0x1cd494={};var _0x33e14e={'count':0x0,'rows':[]};return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x38687c[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x3008ee,null))[_0x32ec('0x12')](function(_0x47f79b){if(_0x47f79b){_0x1cd494[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0x8a')][_0x32ec('0x48')]);_0x1cd494[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x38687c[_0x32ec('0x4c')]);_0x1cd494[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x1cd494[_0x32ec('0x4b')],_0x1cd494[_0x32ec('0x4c')]);_0x221249['attributes']=_[_0x32ec('0x61')](_0x1cd494['model'],qs['fields'](_0x38687c[_0x32ec('0x4c')]['fields']));_0x221249[_0x32ec('0x4f')]=_0x221249[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x221249[_0x32ec('0x4f')]:_0x1cd494['model'];if(!_0x38687c[_0x32ec('0x4c')][_0x32ec('0x52')]('nolimit')){_0x221249['limit']=qs['limit'](_0x38687c[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x221249[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x38687c[_0x32ec('0x4c')]['offset']);}_0x221249['order']=qs[_0x32ec('0x54')](_0x38687c['query']['sort']);_0x221249[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_[_0x32ec('0x56')](_0x38687c[_0x32ec('0x4c')],_0x1cd494[_0x32ec('0x4e')]));_0x221249[_0x32ec('0x55')]['MailAccountId']=_0x47f79b['id'];if(_0x38687c[_0x32ec('0x4c')][_0x32ec('0x6f')]){_0x221249[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x221249['where'],{'$or':_[_0x32ec('0x70')](_0x221249[_0x32ec('0x4f')],function(_0x2cc740){var _0x321ebe={};_0x321ebe[_0x2cc740]={'$like':'%'+_0x38687c[_0x32ec('0x4c')][_0x32ec('0x6f')]+'%'};return _0x321ebe;})});}_0x221249=_[_0x32ec('0x57')]({},_0x221249,_0x38687c[_0x32ec('0x59')]);return db['MailInteraction']['count']({'where':_0x221249[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0x5e2246){_0x33e14e[_0x32ec('0x21')]=_0x5e2246;if(_0x38687c[_0x32ec('0x4c')]['includeAll']){_0x221249[_0x32ec('0x5b')]=[{'model':db[_0x32ec('0x8c')],'as':_0x32ec('0x8d'),'required':![]},{'model':db['User'],'as':_0x32ec('0x8e'),'attributes':[_0x32ec('0x2a'),'fullname',_0x32ec('0x8f')],'required':![]},{'model':db[_0x32ec('0x90')],'as':_0x32ec('0x91'),'attributes':['id',_0x32ec('0x2a'),_0x32ec('0x92')],'where':_0x38687c[_0x32ec('0x4c')][_0x32ec('0x93')]?{'id':_0x38687c[_0x32ec('0x4c')][_0x32ec('0x93')]}:undefined,'required':_0x38687c[_0x32ec('0x4c')][_0x32ec('0x93')]?!![]:![]}];}return db[_0x32ec('0x8a')][_0x32ec('0x5c')](_0x221249);})['then'](function(_0x1ca201){_0x33e14e[_0x32ec('0x5d')]=_0x1ca201;return _0x33e14e;});}})[_0x32ec('0x12')](respondWithFilteredResult(_0x3008ee,_0x221249))[_0x32ec('0x1d')](handleError(_0x3008ee,null));};exports[_0x32ec('0x94')]=function addApplications(_0x144c15,_0x5e7c15){var _0x362c12=_0x144c15['params']['id'];var _0x3f9ac5=_0x144c15[_0x32ec('0x64')];var _0x41d83b=0xc8;var _0x5c6999=null;return db[_0x32ec('0x95')][_0x32ec('0x96')]({'isolationLevel':db[_0x32ec('0x95')]['Transaction'][_0x32ec('0x97')][_0x32ec('0x98')]},function(_0x4b7cde){return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x362c12},'transaction':_0x4b7cde})[_0x32ec('0x12')](function(_0x5965a2){if(_0x5965a2){return db['MailApplication'][_0x32ec('0x26')]({'where':{'MailAccountId':_0x362c12},'transaction':_0x4b7cde})[_0x32ec('0x12')](function(){var _0x5c38e1=_[_0x32ec('0x70')](_0x3f9ac5,function(_0x6b443f){_0x6b443f['MailAccountId']=_0x362c12;return _0x6b443f;});return db[_0x32ec('0x99')][_0x32ec('0x9a')](_0x5c38e1,{'transaction':_0x4b7cde});});}else{_0x41d83b=0x194;_0x5c6999=[];}});})[_0x32ec('0x12')](function(){if(_0x41d83b!==0x194){return db[_0x32ec('0x99')][_0x32ec('0x9b')]({'where':{'MailAccountId':_0x362c12},'order':'priority'})[_0x32ec('0x12')](function(_0x1b7233){_0x5c6999=_0x1b7233;});}})[_0x32ec('0x1d')](function(_0x568976){_0x41d83b=0x1f4;logger['error'](_0x568976['stack']);if(_0x568976['name']){delete _0x568976['name'];}_0x5c6999=_0x568976;})[_0x32ec('0x9c')](function(){if(_0x5c6999===null){_0x5e7c15['sendStatus'](_0x41d83b);}else{if(_0x41d83b===0x1f4){_0x5e7c15[_0x32ec('0x23')](_0x41d83b)['send'](_0x5c6999);}else{_0x5e7c15[_0x32ec('0x23')](_0x41d83b)[_0x32ec('0x25')](_0x5c6999);}}});};exports['getApplications']=function(_0x1ec77d,_0x54bd2d){var _0x2008dd={};var _0x377c24={};var _0x129cdb;var _0x47be36;return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x1ec77d[_0x32ec('0x5e')]['id']}})['then'](handleEntityNotFound(_0x54bd2d,null))['then'](function(_0x47c344){if(_0x47c344){_0x129cdb=_0x47c344;_0x377c24['model']=_[_0x32ec('0x4d')](db['MailApplication']['rawAttributes']);_0x377c24[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x1ec77d['query']);_0x377c24[_0x32ec('0x4e')]=_['intersection'](_0x377c24[_0x32ec('0x4b')],_0x377c24['query']);_0x2008dd[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x377c24[_0x32ec('0x4b')],qs[_0x32ec('0x50')](_0x1ec77d['query'][_0x32ec('0x50')]));_0x2008dd[_0x32ec('0x4f')]=_0x2008dd[_0x32ec('0x4f')][_0x32ec('0x51')]?_0x2008dd[_0x32ec('0x4f')]:_0x377c24[_0x32ec('0x4b')];_0x2008dd[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x1ec77d[_0x32ec('0x4c')]['sort']);_0x2008dd[_0x32ec('0x55')]=qs[_0x32ec('0x4e')](_['pick'](_0x1ec77d[_0x32ec('0x4c')],_0x377c24[_0x32ec('0x4e')]));if(_0x1ec77d['query']['filter']){_0x2008dd[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x2008dd[_0x32ec('0x55')],{'$or':_[_0x32ec('0x70')](_0x2008dd[_0x32ec('0x4f')],function(_0x175610){var _0xac4caa={};_0xac4caa[_0x175610]={'$like':'%'+_0x1ec77d['query'][_0x32ec('0x6f')]+'%'};return _0xac4caa;})});}_0x2008dd=_[_0x32ec('0x57')]({},_0x2008dd,_0x1ec77d[_0x32ec('0x59')]);return _0x129cdb[_0x32ec('0x9d')](_0x2008dd);}})[_0x32ec('0x12')](function(_0x285c7b){if(_0x285c7b){_0x47be36=_0x285c7b['length'];if(!_0x1ec77d[_0x32ec('0x4c')][_0x32ec('0x52')](_0x32ec('0x6d'))){_0x2008dd[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x1ec77d[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x2008dd[_0x32ec('0x22')]=qs['offset'](_0x1ec77d[_0x32ec('0x4c')][_0x32ec('0x22')]);}return _0x129cdb[_0x32ec('0x9d')](_0x2008dd);}})[_0x32ec('0x12')](function(_0x28c0e6){if(_0x28c0e6){return _0x28c0e6?{'count':_0x47be36,'rows':_0x28c0e6}:null;}})[_0x32ec('0x12')](respondWithResult(_0x54bd2d,null))[_0x32ec('0x1d')](handleError(_0x54bd2d,null));};exports[_0x32ec('0x9e')]=function(_0x2b7cb1,_0x278960){var _0x4e0ba8={'raw':!![],'where':{}};var _0x947505={};var _0x1e9723={'count':0x0,'rows':[]};return db['MailAccount'][_0x32ec('0x6c')]({'where':{'id':_0x2b7cb1['params']['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x278960,null))['then'](function(_0x37d653){if(_0x37d653){_0x947505[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0x9f')][_0x32ec('0x48')]);_0x947505[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x2b7cb1[_0x32ec('0x4c')]);_0x947505[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x947505[_0x32ec('0x4b')],_0x947505[_0x32ec('0x4c')]);_0x4e0ba8[_0x32ec('0x4f')]=_[_0x32ec('0x61')](_0x947505['model'],qs[_0x32ec('0x50')](_0x2b7cb1[_0x32ec('0x4c')]['fields']));_0x4e0ba8[_0x32ec('0x4f')]=_0x4e0ba8['attributes'][_0x32ec('0x51')]?_0x4e0ba8[_0x32ec('0x4f')]:_0x947505[_0x32ec('0x4b')];if(!_0x2b7cb1['query'][_0x32ec('0x52')](_0x32ec('0x6d'))){_0x4e0ba8[_0x32ec('0x20')]=qs['limit'](_0x2b7cb1['query']['limit']);_0x4e0ba8[_0x32ec('0x22')]=qs['offset'](_0x2b7cb1['query'][_0x32ec('0x22')]);}_0x4e0ba8[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x2b7cb1[_0x32ec('0x4c')]['sort']);_0x4e0ba8[_0x32ec('0x55')]=qs['filters'](_['pick'](_0x2b7cb1[_0x32ec('0x4c')],_0x947505['filters']));_0x4e0ba8[_0x32ec('0x55')][_0x32ec('0x6e')]=_0x37d653['id'];if(_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0x6f')]){_0x4e0ba8[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x4e0ba8['where'],{'$or':_[_0x32ec('0x70')](_0x4e0ba8[_0x32ec('0x4f')],function(_0x54082a){var _0x485b46={};_0x485b46[_0x54082a]={'$like':'%'+_0x2b7cb1[_0x32ec('0x4c')]['filter']+'%'};return _0x485b46;})});}if(_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0xa0')]){var _0xde57a3=_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0xa0')][_0x32ec('0xa1')](',');var _0x401df4={};_0x401df4[_0xde57a3[0x0]]={'$gte':moment(_0xde57a3[0x1])[_0x32ec('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4e0ba8[_0x32ec('0x55')]=_[_0x32ec('0x57')](_0x4e0ba8[_0x32ec('0x55')],_0x401df4);}_0x4e0ba8=_[_0x32ec('0x57')]({},_0x4e0ba8,_0x2b7cb1[_0x32ec('0x59')]);return db[_0x32ec('0x9f')][_0x32ec('0x21')]({'where':_0x4e0ba8[_0x32ec('0x55')]})[_0x32ec('0x12')](function(_0x1d7db3){_0x1e9723[_0x32ec('0x21')]=_0x1d7db3;if(_0x2b7cb1[_0x32ec('0x4c')][_0x32ec('0x5a')]){_0x4e0ba8['include']=[{'all':!![]}];}return db[_0x32ec('0x9f')][_0x32ec('0x5c')](_0x4e0ba8);})[_0x32ec('0x12')](function(_0x2ffe68){if(_0x2b7cb1[_0x32ec('0x4c')]['inlineCss']===_0x32ec('0xa3')){for(var _0x40cf12=0x0;_0x40cf12<_0x2ffe68[_0x32ec('0x51')];_0x40cf12++){_0x2ffe68[_0x40cf12][_0x32ec('0x64')]=juice(_0x2ffe68[_0x40cf12][_0x32ec('0x64')]);}}_0x1e9723[_0x32ec('0x5d')]=_0x2ffe68;return _0x1e9723;});}})[_0x32ec('0x12')](respondWithFilteredResult(_0x278960,_0x4e0ba8))[_0x32ec('0x1d')](handleError(_0x278960,null));};exports[_0x32ec('0x2b')]=function(_0x52b05e,_0x501315){var _0xdacd45,_0x209eba={},_0x5ed298;if(_0x52b05e[_0x32ec('0x64')]['to']){_0x5ed298=_0x52b05e[_0x32ec('0x64')]['to']['split'](',')[0x0];}return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x52b05e[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0xa4')],'as':'List','include':[{'model':db[_0x32ec('0x8c')],'as':_0x32ec('0xa5'),'where':{'email':_0x5ed298},'limit':0x1,'order':[['updatedAt',_0x32ec('0xa6')]]}]},{'model':db[_0x32ec('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x32ec('0xa7')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x501315,null))[_0x32ec('0x12')](function(_0x1bad56){if(!_0x1bad56)return;_0xdacd45=_0x1bad56;if(!_0x1bad56[_0x32ec('0x43')])throw new Error(_0x32ec('0xa8'));if(_[_0x32ec('0x7a')](_0x52b05e[_0x32ec('0x64')][_0x32ec('0xa9')])){_0x52b05e[_0x32ec('0x64')][_0x32ec('0xa9')]=util['format'](_0x32ec('0xaa'),_0x1bad56[_0x32ec('0x2a')],_0x1bad56[_0x32ec('0x78')]||_0x1bad56[_0x32ec('0x43')][_0x32ec('0x38')]);}if(_0x52b05e[_0x32ec('0x64')][_0x32ec('0xab')]&&_0x52b05e[_0x32ec('0x64')][_0x32ec('0xab')][_0x32ec('0x51')]){for(var _0x48add3=0x0;_0x48add3<_0x52b05e['body'][_0x32ec('0xab')]['length'];_0x48add3+=0x1){_0x52b05e[_0x32ec('0x64')]['attachments'][_0x48add3]={'filename':_0x52b05e[_0x32ec('0x64')]['attachments'][_0x48add3][_0x32ec('0x2a')],'path':path[_0x32ec('0xac')](config[_0x32ec('0xad')],'server/files/attachments',_0x52b05e[_0x32ec('0x64')][_0x32ec('0xab')][_0x48add3][_0x32ec('0xae')])};}}var _0x4390de=_0x1bad56[_0x32ec('0xaf')]();return respondWithRpcPromise(_0x32ec('0xb0'),'sendMail',{'account':_0x4390de,'message':_0x52b05e[_0x32ec('0x64')]});})['then'](function(_0x3046f7){if(!_0x3046f7)return;_0x209eba=_0x3046f7;if(!_0xdacd45[_0x32ec('0xb1')])throw new Error(_0x32ec('0xb2'));if(_0xdacd45[_0x32ec('0xb1')][_0x32ec('0xa5')][_0x32ec('0x51')])return _0xdacd45[_0x32ec('0xb1')]['Contacts'][0x0];return db[_0x32ec('0x8c')][_0x32ec('0x6b')](_[_0x32ec('0xb3')](_0x52b05e[_0x32ec('0x64')],{'firstName':_0x52b05e['body']['to'],'email':_0x52b05e[_0x32ec('0x64')]['to'],'phone':_0x52b05e[_0x32ec('0x64')]['to'],'ListId':_0xdacd45[_0x32ec('0x79')]}));})[_0x32ec('0x12')](function(_0x308cac){if(!_0x308cac)return;var _0x5a8b3e={'UserId':_0x52b05e[_0x32ec('0x38')]['id'],'ContactId':_0x308cac['id'],'MailAccountId':_0xdacd45['id'],'inReplyTo':_0x209eba['messageId'],'to':_0x52b05e[_0x32ec('0x64')][_0x32ec('0xa9')],'cc':_0x52b05e[_0x32ec('0x64')]['cc'],'subject':_0x52b05e[_0x32ec('0x64')][_0x32ec('0xb4')],'attach':_0x52b05e[_0x32ec('0x64')]['attach'],'firstMsgDirection':_0x32ec('0xb5'),'lastMsgAt':moment()[_0x32ec('0xa2')](_0x32ec('0xb6')),'lastMsgDirection':_0x32ec('0xb5'),'Messages':[_[_0x32ec('0x57')](_0x52b05e[_0x32ec('0x64')],{'messageId':_0x209eba[_0x32ec('0xb7')],'sentAt':moment()[_0x32ec('0xa2')](_0x32ec('0xb6')),'read':!![],'MailAccountId':_0xdacd45['id'],'UserId':_0x52b05e[_0x32ec('0x38')]['id'],'ContactId':_0x308cac['id']})]};if(_0x52b05e[_0x32ec('0x64')][_0x32ec('0xb8')]){_0x5a8b3e=_[_0x32ec('0x57')](_0x5a8b3e,_0x52b05e[_0x32ec('0x64')][_0x32ec('0xb8')]);}return db['MailInteraction'][_0x32ec('0x6b')](_0x5a8b3e,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})['then'](respondWithResult(_0x501315,null))['catch'](handleError(_0x501315,null));};exports[_0x32ec('0xb9')]=function(_0x265d86,_0x40f9bd){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x265d86[_0x32ec('0x5e')]['id']},'include':[{'model':db[_0x32ec('0x45')],'as':_0x32ec('0x43'),'raw':!![],'include':[{'model':db[_0x32ec('0xa7')],'as':_0x32ec('0xa7'),'raw':!![]}]}]})[_0x32ec('0x12')](handleEntityNotFound(_0x40f9bd,null))['then'](function(_0x58faee){if(!_0x58faee[_0x32ec('0x43')])return;var _0x917f12=_0x58faee[_0x32ec('0xaf')]();return respondWithRpcPromise(_0x32ec('0xba'),_0x32ec('0xb9'),{'account':_0x917f12});})[_0x32ec('0x12')](respondWithResult(_0x40f9bd,null))[_0x32ec('0x1d')](handleError(_0x40f9bd,null));};exports[_0x32ec('0x26')]=function(_0x3ab705,_0x1c6c9c){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x3ab705[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x1c6c9c,null))[_0x32ec('0x12')](function(_0x319960){if(_0x319960&&_0x319960[_0x32ec('0x3e')]){throw new db[(_0x32ec('0xbb'))][(_0x32ec('0xbc'))](_0x32ec('0xbd'));}return _0x319960;})['then'](removeEntity(_0x1c6c9c,null))[_0x32ec('0x1d')](handleError(_0x1c6c9c,null));};exports[_0x32ec('0xbe')]=function(_0x27114f,_0x473368){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x27114f[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x473368,null))[_0x32ec('0x12')](function(_0x437108){if(_0x437108){return _0x437108['addAgents'](_0x27114f['body'][_0x32ec('0x76')],_[_0x32ec('0x8b')](_0x27114f[_0x32ec('0x64')],[_0x32ec('0x76'),'id'])||{})[_0x32ec('0xbf')](function(_0x3ef6b0){for(var _0x119b89=0x0;_0x119b89<_0x27114f[_0x32ec('0x64')][_0x32ec('0x76')][_0x32ec('0x51')];_0x119b89+=0x1){socket[_0x32ec('0xc0')](_0x32ec('0xc1'),{'UserId':Number(_0x27114f['body'][_0x32ec('0x76')][_0x119b89]),'MailAccountId':Number(_0x27114f[_0x32ec('0x5e')]['id'])});}return _0x3ef6b0;});}})[_0x32ec('0x12')](respondWithResult(_0x473368,null))[_0x32ec('0x1d')](handleError(_0x473368,null));};exports['removeAgents']=function(_0x43e02b,_0x45dc21){return db[_0x32ec('0x47')][_0x32ec('0x62')]({'where':{'id':_0x43e02b['params']['id']}})['then'](handleEntityNotFound(_0x45dc21,null))[_0x32ec('0x12')](function(_0x4e4466){if(_0x4e4466){return _0x4e4466[_0x32ec('0xc2')](_0x43e02b[_0x32ec('0x4c')][_0x32ec('0x76')])['then'](function(){if(_['isArray'](_0x43e02b['query'][_0x32ec('0x76')])){for(var _0x4a14e7=0x0;_0x4a14e7<_0x43e02b[_0x32ec('0x4c')][_0x32ec('0x76')][_0x32ec('0x51')];_0x4a14e7+=0x1){socket[_0x32ec('0xc0')](_0x32ec('0xc3'),{'UserId':Number(_0x43e02b['query'][_0x32ec('0x76')][_0x4a14e7]),'MailAccountId':Number(_0x43e02b[_0x32ec('0x5e')]['id'])});}}else{socket['emit'](_0x32ec('0xc3'),{'UserId':Number(_0x43e02b[_0x32ec('0x4c')][_0x32ec('0x76')]),'MailAccountId':Number(_0x43e02b[_0x32ec('0x5e')]['id'])});}});}})[_0x32ec('0x12')](respondWithStatusCode(_0x45dc21,null))['catch'](handleError(_0x45dc21,null));};exports[_0x32ec('0xc4')]=function(_0x32fa0d,_0x7a830e){var _0x193e04={};var _0x843f78={};var _0x41803c;var _0x5e6c4f;return db[_0x32ec('0x47')][_0x32ec('0x6c')]({'where':{'id':_0x32fa0d[_0x32ec('0x5e')]['id']}})[_0x32ec('0x12')](handleEntityNotFound(_0x7a830e,null))[_0x32ec('0x12')](function(_0x549cdc){if(_0x549cdc){_0x41803c=_0x549cdc;_0x843f78[_0x32ec('0x4b')]=_[_0x32ec('0x4d')](db[_0x32ec('0xc5')][_0x32ec('0x48')]);_0x843f78[_0x32ec('0x4c')]=_[_0x32ec('0x4d')](_0x32fa0d[_0x32ec('0x4c')]);_0x843f78[_0x32ec('0x4e')]=_[_0x32ec('0x61')](_0x843f78[_0x32ec('0x4b')],_0x843f78[_0x32ec('0x4c')]);_0x193e04['attributes']=_[_0x32ec('0x61')](_0x843f78[_0x32ec('0x4b')],qs['fields'](_0x32fa0d[_0x32ec('0x4c')]['fields']));_0x193e04[_0x32ec('0x4f')]=_0x193e04['attributes']['length']?_0x193e04['attributes']:_0x843f78[_0x32ec('0x4b')];_0x193e04[_0x32ec('0x53')]=qs[_0x32ec('0x54')](_0x32fa0d['query'][_0x32ec('0x54')]);_0x193e04['where']=qs[_0x32ec('0x4e')](_['pick'](_0x32fa0d['query'],_0x843f78['filters']));if(_0x32fa0d['query'][_0x32ec('0x6f')]){_0x193e04['where']=_[_0x32ec('0x57')](_0x193e04[_0x32ec('0x55')],{'$or':_[_0x32ec('0x70')](_0x193e04[_0x32ec('0x4f')],function(_0x308909){var _0x285b1d={};_0x285b1d[_0x308909]={'$like':'%'+_0x32fa0d[_0x32ec('0x4c')]['filter']+'%'};return _0x285b1d;})});}_0x193e04=_[_0x32ec('0x57')]({},_0x193e04,_0x32fa0d[_0x32ec('0x59')]);return _0x41803c['getAgents'](_0x193e04);}})['then'](function(_0x552027){if(_0x552027){_0x5e6c4f=_0x552027[_0x32ec('0x51')];if(!_0x32fa0d[_0x32ec('0x4c')]['hasOwnProperty'](_0x32ec('0x6d'))){_0x193e04[_0x32ec('0x20')]=qs[_0x32ec('0x20')](_0x32fa0d[_0x32ec('0x4c')][_0x32ec('0x20')]);_0x193e04[_0x32ec('0x22')]=qs[_0x32ec('0x22')](_0x32fa0d[_0x32ec('0x4c')][_0x32ec('0x22')]);}return _0x41803c[_0x32ec('0xc4')](_0x193e04);}})[_0x32ec('0x12')](function(_0x375233){if(_0x375233){return _0x375233?{'count':_0x5e6c4f,'rows':_0x375233}:null;}})['then'](respondWithResult(_0x7a830e,null))[_0x32ec('0x1d')](handleError(_0x7a830e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index fecb357..173bbe8 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 _0x9b25=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','save'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x9b25,0x1be));var _0x59b2=function(_0x5c815c,_0x3885a0){_0x5c815c=_0x5c815c-0x0;var _0x444633=_0x9b25[_0x5c815c];return _0x444633;};'use strict';var EventEmitter=require(_0x59b2('0x0'));var MailAccount=require(_0x59b2('0x1'))['db'][_0x59b2('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x59b2('0x3'),'afterUpdate':_0x59b2('0x4'),'afterDestroy':_0x59b2('0x5')};function emitEvent(_0x459769){return function(_0x72ea4a,_0x48e4ca,_0x4dd11d){MailAccountEvents[_0x59b2('0x6')](_0x459769+':'+_0x72ea4a['id'],_0x72ea4a);MailAccountEvents[_0x59b2('0x6')](_0x459769,_0x72ea4a);_0x4dd11d(null);};}for(var e in events){if(events[_0x59b2('0x7')](e)){var event=events[e];MailAccount[_0x59b2('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xaa37=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x25c92b,_0x41b368){var _0xc59d85=function(_0x10b32d){while(--_0x10b32d){_0x25c92b['push'](_0x25c92b['shift']());}};_0xc59d85(++_0x41b368);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xaa37[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0x7aa3('0x0'));var MailAccount=require(_0x7aa3('0x1'))['db'][_0x7aa3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7aa3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aa3('0x4'),'afterDestroy':_0x7aa3('0x5')};function emitEvent(_0x27333d){return function(_0x11e64c,_0x334919,_0x2801a2){MailAccountEvents[_0x7aa3('0x6')](_0x27333d+':'+_0x11e64c['id'],_0x11e64c);MailAccountEvents['emit'](_0x27333d,_0x11e64c);_0x2801a2(null);};}for(var e in events){if(events[_0x7aa3('0x7')](e)){var event=events[e];MailAccount[_0x7aa3('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index fc20f46..b3355eb 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 _0xf510=['Smtp','port','secure','authentication','modernAuthentication','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','define','mail_accounts','custom','provider','host'];(function(_0x1625d5,_0x2cb18b){var _0x5f0d99=function(_0x23cbb8){while(--_0x23cbb8){_0x1625d5['push'](_0x1625d5['shift']());}};_0x5f0d99(++_0x2cb18b);}(_0xf510,0x1e7));var _0x0f51=function(_0xa69f1,_0x475984){_0xa69f1=_0xa69f1-0x0;var _0x8fa455=_0xf510[_0xa69f1];return _0x8fa455;};'use strict';var attributes=require(_0x0f51('0x0'));module['exports']=function(_0x48356d){return _0x48356d[_0x0f51('0x1')]('MailAccount',attributes,{'tableName':_0x0f51('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xa979d3=this;var _0x5a3d20={'id':_0xa979d3['id'],'tls':{'rejectUnauthorized':![]}};if(_0xa979d3['provider']!==_0x0f51('0x3')){_0x5a3d20['service']=_0xa979d3[_0x0f51('0x4')];}else{_0x5a3d20[_0x0f51('0x5')]=_0xa979d3[_0x0f51('0x6')][_0x0f51('0x5')];_0x5a3d20[_0x0f51('0x7')]=_0xa979d3[_0x0f51('0x6')][_0x0f51('0x7')];_0x5a3d20[_0x0f51('0x8')]=_0xa979d3[_0x0f51('0x6')][_0x0f51('0x8')];}if(_0xa979d3[_0x0f51('0x6')][_0x0f51('0x9')]){if(_0xa979d3['Smtp'][_0x0f51('0xa')]){if(!_0xa979d3[_0x0f51('0x6')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x5a3d20[_0x0f51('0xb')]={'type':_0x0f51('0xc'),'user':_0xa979d3['Smtp'][_0x0f51('0xd')],'accessToken':_0xa979d3['Smtp'][_0x0f51('0xe')][_0x0f51('0xf')]};}else{_0x5a3d20[_0x0f51('0xb')]={'user':_0xa979d3[_0x0f51('0x6')][_0x0f51('0xd')],'pass':_0xa979d3['Smtp'][_0x0f51('0x10')]};}}return _0x5a3d20;}}});}; \ No newline at end of file +var _0x27bf=['exports','define','mail_accounts','provider','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','data5','user','pass'];(function(_0xf88c0d,_0x41e018){var _0xd69855=function(_0x363538){while(--_0x363538){_0xf88c0d['push'](_0xf88c0d['shift']());}};_0xd69855(++_0x41e018);}(_0x27bf,0x80));var _0xf27b=function(_0x40f34d,_0x3c254a){_0x40f34d=_0x40f34d-0x0;var _0x5d506e=_0x27bf[_0x40f34d];return _0x5d506e;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xf27b('0x0')]=function(_0x41c40f){return _0x41c40f[_0xf27b('0x1')]('MailAccount',attributes,{'tableName':_0xf27b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x27de72=this;var _0x56cfb7={'id':_0x27de72['id'],'tls':{'rejectUnauthorized':![]}};if(_0x27de72[_0xf27b('0x3')]!=='custom'){_0x56cfb7['service']=_0x27de72[_0xf27b('0x3')];}else{_0x56cfb7['host']=_0x27de72[_0xf27b('0x4')][_0xf27b('0x5')];_0x56cfb7[_0xf27b('0x6')]=_0x27de72['Smtp'][_0xf27b('0x6')];_0x56cfb7[_0xf27b('0x7')]=_0x27de72[_0xf27b('0x4')][_0xf27b('0x7')];}if(_0x27de72[_0xf27b('0x4')][_0xf27b('0x8')]){if(_0x27de72[_0xf27b('0x4')][_0xf27b('0x9')]){if(!_0x27de72[_0xf27b('0x4')][_0xf27b('0xa')])throw new Error(_0xf27b('0xb'));_0x56cfb7[_0xf27b('0xc')]={'type':'OAuth2','user':_0x27de72['Smtp']['user'],'accessToken':_0x27de72[_0xf27b('0x4')][_0xf27b('0xa')][_0xf27b('0xd')]};}else{_0x56cfb7[_0xf27b('0xc')]={'user':_0x27de72[_0xf27b('0x4')][_0xf27b('0xe')],'pass':_0x27de72['Smtp'][_0xf27b('0xf')]};}}return _0x56cfb7;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index ed71905..831f884 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 _0xf69d=['redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','MailAccount','findAll','raw','options','attributes','limit','map','include','GetMailAccount','debug','catch','ShowMailAccount','find','where','model','setDataValue','smtpOptions','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','updatedAt','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','Contacts','Applications','MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','list','orderBy','asc','length','close','autoclose','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','update','format','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','*,*,*,*','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x44671c,_0x2a7436){var _0x5a61bc=function(_0x160765){while(--_0x160765){_0x44671c['push'](_0x44671c['shift']());}};_0x5a61bc(++_0x2a7436);}(_0xf69d,0xd3));var _0xdf69=function(_0x4dddcb,_0x52a7a6){_0x4dddcb=_0x4dddcb-0x0;var _0xde5319=_0xf69d[_0x4dddcb];return _0xde5319;};'use strict';var _=require(_0xdf69('0x0'));var moment=require(_0xdf69('0x1'));var BPromise=require(_0xdf69('0x2'));var rs=require(_0xdf69('0x3'));var Redis=require(_0xdf69('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xdf69('0x5'))(_0xdf69('0x6'));var config=require(_0xdf69('0x7'));var jayson=require(_0xdf69('0x8'));var client=jayson[_0xdf69('0x9')][_0xdf69('0xa')]({'port':0x232c});config[_0xdf69('0xb')]=_[_0xdf69('0xc')](config[_0xdf69('0xb')],{'host':_0xdf69('0xd'),'port':0x18eb});var socket=require(_0xdf69('0xe'))(new Redis(config[_0xdf69('0xb')]));require(_0xdf69('0xf'))[_0xdf69('0x10')](socket);function respondWithRpcPromise(_0x40217f,_0x211ea9,_0x1e0e8d){return new BPromise(function(_0x4fcc93,_0x305726){return client[_0xdf69('0x11')](_0x40217f,_0x1e0e8d)[_0xdf69('0x12')](function(_0x21d8e0){logger[_0xdf69('0x13')](_0xdf69('0x14'),_0x211ea9,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x211ea9,'request\x20sent',JSON[_0xdf69('0x15')](_0x21d8e0));if(_0x21d8e0[_0xdf69('0x16')]){if(_0x21d8e0[_0xdf69('0x16')][_0xdf69('0x17')]===0x1f4){logger[_0xdf69('0x16')](_0xdf69('0x14'),_0x211ea9,_0x21d8e0['error'][_0xdf69('0x18')]);return _0x305726(_0x21d8e0[_0xdf69('0x16')][_0xdf69('0x18')]);}logger[_0xdf69('0x16')]('MailAccount,\x20%s,\x20%s',_0x211ea9,_0x21d8e0[_0xdf69('0x16')]['message']);return _0x4fcc93(_0x21d8e0[_0xdf69('0x16')][_0xdf69('0x18')]);}else{logger['info'](_0xdf69('0x14'),_0x211ea9,_0xdf69('0x19'));_0x4fcc93(_0x21d8e0[_0xdf69('0x1a')][_0xdf69('0x18')]);}})['catch'](function(_0x5ae237){logger[_0xdf69('0x16')](_0xdf69('0x14'),_0x211ea9,_0x5ae237);_0x305726(_0x5ae237);});});}exports['GetMailAccount']=function(_0x32cf65){var _0x259e90=this;return new Promise(function(_0x68fa80,_0x526cbc){return db[_0xdf69('0x1b')][_0xdf69('0x1c')]({'raw':_0x32cf65['options']?_0x32cf65['options'][_0xdf69('0x1d')]===undefined?!![]:![]:!![],'where':_0x32cf65[_0xdf69('0x1e')]?_0x32cf65[_0xdf69('0x1e')]['where']||null:null,'attributes':_0x32cf65['options']?_0x32cf65['options'][_0xdf69('0x1f')]||null:null,'limit':_0x32cf65['options']?_0x32cf65[_0xdf69('0x1e')][_0xdf69('0x20')]||null:null,'include':_0x32cf65[_0xdf69('0x1e')]?_0x32cf65['options']['include']?_[_0xdf69('0x21')](_0x32cf65[_0xdf69('0x1e')][_0xdf69('0x22')],function(_0x3fd933){return{'model':db[_0x3fd933['model']],'as':_0x3fd933['as'],'attributes':_0x3fd933[_0xdf69('0x1f')],'include':_0x3fd933[_0xdf69('0x22')]?_[_0xdf69('0x21')](_0x3fd933['include'],function(_0x2da3df){return{'model':db[_0x2da3df['model']],'as':_0x2da3df['as'],'attributes':_0x2da3df['attributes'],'include':_0x2da3df['include']?_['map'](_0x2da3df[_0xdf69('0x22')],function(_0xe339ac){return{'model':db[_0xe339ac['model']],'as':_0xe339ac['as'],'attributes':_0xe339ac[_0xdf69('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdf69('0x12')](function(_0x19cf2d){logger[_0xdf69('0x13')](_0xdf69('0x23'),_0x32cf65);logger[_0xdf69('0x24')](_0xdf69('0x23'),_0x32cf65,JSON[_0xdf69('0x15')](_0x19cf2d));_0x68fa80(_0x19cf2d);})[_0xdf69('0x25')](function(_0x3b97df){logger[_0xdf69('0x16')](_0xdf69('0x23'),_0x3b97df[_0xdf69('0x18')],_0x32cf65);_0x526cbc(_0x259e90[_0xdf69('0x16')](0x1f4,_0x3b97df[_0xdf69('0x18')]));});});};exports[_0xdf69('0x26')]=function(_0x1f4602){var _0x5ade53=this;return new Promise(function(_0xf910a0,_0x2aab76){return db[_0xdf69('0x1b')][_0xdf69('0x27')]({'raw':_0x1f4602[_0xdf69('0x1e')]?_0x1f4602['options'][_0xdf69('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f4602['options']?_0x1f4602[_0xdf69('0x1e')][_0xdf69('0x28')]||null:null,'attributes':_0x1f4602['options']?_0x1f4602[_0xdf69('0x1e')]['attributes']||null:null,'include':_0x1f4602[_0xdf69('0x1e')]?_0x1f4602[_0xdf69('0x1e')][_0xdf69('0x22')]?_[_0xdf69('0x21')](_0x1f4602[_0xdf69('0x1e')]['include'],function(_0x175d5a){return{'model':db[_0x175d5a['model']],'as':_0x175d5a['as'],'attributes':_0x175d5a[_0xdf69('0x1f')],'include':_0x175d5a[_0xdf69('0x22')]?_[_0xdf69('0x21')](_0x175d5a[_0xdf69('0x22')],function(_0x5c38db){return{'model':db[_0x5c38db[_0xdf69('0x29')]],'as':_0x5c38db['as'],'attributes':_0x5c38db['attributes'],'include':_0x5c38db[_0xdf69('0x22')]?_['map'](_0x5c38db[_0xdf69('0x22')],function(_0x5d8e26){return{'model':db[_0x5d8e26[_0xdf69('0x29')]],'as':_0x5d8e26['as'],'attributes':_0x5d8e26[_0xdf69('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdf69('0x12')](function(_0x2b7628){if(_0x1f4602[_0xdf69('0x1e')]['smtp']===!![])_0x2b7628[_0xdf69('0x2a')](_0xdf69('0x2b'),_0x2b7628['getSmtpOptions']());logger['info']('ShowMailAccount',_0x1f4602);logger['debug'](_0xdf69('0x26'),_0x1f4602,JSON['stringify'](_0x2b7628));_0xf910a0(_0x2b7628);})[_0xdf69('0x25')](function(_0x1c45b1){logger[_0xdf69('0x16')](_0xdf69('0x26'),_0x1c45b1['message'],_0x1f4602);_0x2aab76(_0x5ade53[_0xdf69('0x16')](0x1f4,_0x1c45b1[_0xdf69('0x18')]));});});};exports[_0xdf69('0x2c')]=function(_0x4f3370){var _0x216f62=this;return new Promise(function(_0xdd919d,_0x34ab67){var _0x1101ad={'body':_0x4f3370[_0xdf69('0x2d')],'channel':_0xdf69('0x2e')};var _0x4094d7=_['difference'](_['keys'](db[_0xdf69('0x2f')][_0xdf69('0x30')]),[_0xdf69('0x31'),_0xdf69('0x32'),'CompanyId','ListId']);var _0x5980b1=![];if(_0x4f3370['body']['id']){delete _0x4f3370[_0xdf69('0x2d')]['id'];}if(_['isNil'](_0x4f3370[_0xdf69('0x2d')]['from'])){return _0x34ab67(_0x216f62[_0xdf69('0x16')](0x1f4,_0xdf69('0x33')));}if(_[_0xdf69('0x34')](_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x2d')])||_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x2d')]===''){return _0x34ab67(_0x216f62[_0xdf69('0x16')](0x1f4,_0xdf69('0x35')));}if(_['isNil'](_0x4f3370['body'][_0xdf69('0x36')])){return _0x34ab67(_0x216f62['error'](0x1f4,_0xdf69('0x37')+_0x4094d7));}if(!_[_0xdf69('0x38')](_0x4094d7,_0x4f3370[_0xdf69('0x2d')]['mapKey'])){return _0x34ab67(_0x216f62[_0xdf69('0x16')](0x1f4,_0xdf69('0x39')+_0x4094d7));}var _0x4093e9={};_0x4093e9[_0x4f3370[_0xdf69('0x2d')]['mapKey']]=_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x3a')];return db['MailAccount']['find']({'where':{'id':_0x4f3370[_0xdf69('0x3b')]['id']},'include':[{'model':db[_0xdf69('0x3c')],'as':_0xdf69('0x3d'),'include':[{'model':db[_0xdf69('0x2f')],'as':_0xdf69('0x3e'),'where':_0x4093e9,'limit':0x1,'order':[[_0xdf69('0x32'),'DESC']]}]},{'model':db['MailApplication'],'as':_0xdf69('0x3f')},{'model':db[_0xdf69('0x40')],'as':_0xdf69('0x41'),'include':[{'model':db[_0xdf69('0x42')],'as':'CloudProvider'}]}]})['then'](function(_0xb34f76){if(_0xb34f76&&_0xb34f76[_0xdf69('0x3d')]){var _0x3ee7a5=_0xb34f76[_0xdf69('0x43')]({'plain':!![]});_0x1101ad[_0xdf69('0x3b')]=_[_0xdf69('0x44')](_0x3ee7a5,[_0xdf69('0x3f'),_0xdf69('0x3d')]);_0x1101ad[_0xdf69('0x3b')][_0xdf69('0x2b')]=_0xb34f76[_0xdf69('0x45')]();_0x1101ad[_0xdf69('0x46')]=_0x3ee7a5[_0xdf69('0x3f')];_0x1101ad[_0xdf69('0x47')]=_0x3ee7a5['List'];_0x1101ad[_0xdf69('0x46')]=_[_0xdf69('0x48')](_0x1101ad[_0xdf69('0x46')],['priority'],[_0xdf69('0x49')]);if(_0x1101ad[_0xdf69('0x3b')]&&_0x1101ad[_0xdf69('0x3b')]['autoclose']){_0x1101ad[_0xdf69('0x46')]['push']({'id':0x0,'priority':_0x1101ad[_0xdf69('0x46')][_0xdf69('0x4a')]+0x1,'app':_0xdf69('0x4b'),'appdata':_0xdf69('0x4c'),'interval':'*,*,*,*'});}if(_0x1101ad[_0xdf69('0x3b')][_0xdf69('0x3f')]){delete _0x1101ad[_0xdf69('0x3b')][_0xdf69('0x3f')];}if(_0x1101ad[_0xdf69('0x3b')][_0xdf69('0x3d')]){delete _0x1101ad[_0xdf69('0x3b')][_0xdf69('0x3d')];}if(_0x3ee7a5[_0xdf69('0x3d')]['Contacts'][_0xdf69('0x4a')]){return _0x3ee7a5[_0xdf69('0x3d')]['Contacts'][0x0];}var _0x44b011=_[_0xdf69('0xc')](_0x4f3370['body'],{'firstName':_0x4f3370['body'][_0xdf69('0x3a')],'ListId':_0x3ee7a5['ListId']});_0x44b011[_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x36')]]=_0x4f3370[_0xdf69('0x2d')]['from'];return db['CmContact'][_0xdf69('0x4d')](_0x44b011);}else{throw new Error(_0xdf69('0x4e'));}})[_0xdf69('0x12')](function(_0x45ed01){_0x1101ad[_0xdf69('0x4f')]=_0x45ed01;if(_0x45ed01){if(!_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x50')]){_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')]['messageId']=rs[_0xdf69('0x51')]()+'\x20'+_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x3a')];}var _0x11ee6c={'ContactId':_0x45ed01['id'],'MailAccountId':_0x4f3370[_0xdf69('0x3b')]['id'],'inReplyTo':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x50')],'to':_0x4f3370['body']['message'][_0xdf69('0x3a')],'cc':_0x4f3370[_0xdf69('0x2d')]['message']['cc'],'subject':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x52')],'attach':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x53')],'lastMsgAt':moment()['format'](_0xdf69('0x54')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xdf69('0x27')]({'where':{'closed':![],'MailAccountId':_0x4f3370['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xdf69('0x55'),'attributes':[_0xdf69('0x50')],'where':{'messageId':_0x4f3370['body'][_0xdf69('0x18')][_0xdf69('0x56')]}}]})[_0xdf69('0x12')](function(_0x29e6a3){if(_0x29e6a3){return[_0x29e6a3,![]];}return db[_0xdf69('0x57')][_0xdf69('0x4d')](_0x11ee6c)[_0xdf69('0x12')](function(_0x232a69){return[_0x232a69,!![]];});});}else{throw new Error(_0xdf69('0x58'));}})['spread'](function(_0x5cd512,_0x5a2c39){if(_0x5cd512){_0x5980b1=_0x5a2c39;if(!_0x5a2c39){return _0x5cd512[_0xdf69('0x59')]({'inReplyTo':_0x4f3370['body'][_0xdf69('0x18')][_0xdf69('0x50')],'to':_0x4f3370['body']['message'][_0xdf69('0x3a')],'cc':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')]['cc'],'subject':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x52')],'attach':_0x5cd512[_0xdf69('0x53')]?_0x5cd512[_0xdf69('0x53')]:_0x4f3370['body'][_0xdf69('0x18')][_0xdf69('0x53')],'substatus':null,'substatusAt':moment()[_0xdf69('0x5a')](_0xdf69('0x54')),'lastMsgAt':moment()['format'](_0xdf69('0x54')),'lastMsgDirection':'in'});}else{return _0x5cd512;}}})[_0xdf69('0x12')](function(_0x3914bf){_0x1101ad[_0xdf69('0x5b')]=_0x3914bf[_0xdf69('0x43')]({'plain':!![]});_0x1101ad['interaction']['created']=_0x5980b1;return db['MailMessage']['create']({'body':_0x4f3370['body'][_0xdf69('0x2d')],'MailAccountId':_0x4f3370['account']['id'],'MailInteractionId':_0x3914bf['id'],'direction':'in','ContactId':_0x1101ad['contact']['id'],'messageId':_0x4f3370['body']['message'][_0xdf69('0x50')],'from':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x3a')],'to':_0x4f3370['body'][_0xdf69('0x18')]['to'],'cc':_0x4f3370[_0xdf69('0x2d')]['message']['cc'],'subject':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x52')],'attach':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x53')],'Attachments':_0x4f3370[_0xdf69('0x2d')]['message'][_0xdf69('0x5c')],'originTo':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x5d')],'originCc':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x5e')],'bcc':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x5f')],'ChatWebsiteId':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x60')]||null,'originChannel':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')][_0xdf69('0x61')]||'Email','ChatOfflineMessageId':_0x4f3370[_0xdf69('0x2d')][_0xdf69('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xdf69('0x62')],'as':_0xdf69('0x63')}]});})[_0xdf69('0x12')](function(_0x3aa055){_0x1101ad[_0xdf69('0x18')]=_0x3aa055;if(!_0x1101ad[_0xdf69('0x5b')][_0xdf69('0x64')]){return;}return db[_0xdf69('0x65')]['find']({'attributes':['id','name'],'where':{'id':_0x1101ad['interaction'][_0xdf69('0x64')]}});})[_0xdf69('0x12')](function(_0x4659b5){if(_0x4659b5){_0x1101ad['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4659b5[_0xdf69('0x66')]+','+(_0x1101ad[_0xdf69('0x3b')][_0xdf69('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x1101ad['interaction'][_0xdf69('0x68')]){return;}return db[_0xdf69('0x69')][_0xdf69('0x27')]({'attributes':['id',_0xdf69('0x66')],'where':{'id':_0x1101ad['interaction'][_0xdf69('0x68')]}});})[_0xdf69('0x12')](function(_0x5b6a69){if(_0x5b6a69){_0x1101ad['applications'][_0xdf69('0x6a')]({'id':0x0,'priority':0x1,'app':_0xdf69('0x6b'),'appdata':_0x5b6a69['name']+','+(_0x1101ad[_0xdf69('0x3b')][_0xdf69('0x6c')]||0x12c),'interval':_0xdf69('0x6d')});}return respondWithRpcPromise('Start',_0xdf69('0x6e'),_0x1101ad);})['then'](function(_0x4ba3a0){_0xdd919d(_0x4ba3a0);})['catch'](function(_0x33f057){_0x34ab67(_0x216f62[_0xdf69('0x16')](0x1f4,_0x33f057[_0xdf69('0x18')]));});});}; \ No newline at end of file +var _0xf767=['MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailAccount','MailAccount','options','where','limit','map','model','attributes','include','debug','ShowMailAccount','find','raw','smtp','setDataValue','getSmtpOptions','catch','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','smtpOptions','applications','list','orderBy','priority','autoclose','push','close','*,*,*,*','length','create','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','spread','update','subject','attach','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','name','queueId'];(function(_0x2d1dcd,_0x20ae0f){var _0x2a5a40=function(_0x51bbe7){while(--_0x51bbe7){_0x2d1dcd['push'](_0x2d1dcd['shift']());}};_0x2a5a40(++_0x20ae0f);}(_0xf767,0x76));var _0x7f76=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xf767[_0x39bc44];return _0x2916d8;};'use strict';var _=require('lodash');var moment=require(_0x7f76('0x0'));var BPromise=require(_0x7f76('0x1'));var rs=require(_0x7f76('0x2'));var Redis=require(_0x7f76('0x3'));var db=require(_0x7f76('0x4'))['db'];var logger=require('../../config/logger')(_0x7f76('0x5'));var config=require(_0x7f76('0x6'));var jayson=require(_0x7f76('0x7'));var client=jayson[_0x7f76('0x8')]['http']({'port':0x232c});config[_0x7f76('0x9')]=_[_0x7f76('0xa')](config[_0x7f76('0x9')],{'host':_0x7f76('0xb'),'port':0x18eb});var socket=require(_0x7f76('0xc'))(new Redis(config['redis']));require(_0x7f76('0xd'))[_0x7f76('0xe')](socket);function respondWithRpcPromise(_0x35d28d,_0x15dcd9,_0x4c5f88){return new BPromise(function(_0x247403,_0x5dc8aa){return client[_0x7f76('0xf')](_0x35d28d,_0x4c5f88)[_0x7f76('0x10')](function(_0x4dbc83){logger[_0x7f76('0x11')](_0x7f76('0x12'),_0x15dcd9,_0x7f76('0x13'));logger['debug'](_0x7f76('0x14'),_0x15dcd9,_0x7f76('0x13'),JSON[_0x7f76('0x15')](_0x4dbc83));if(_0x4dbc83[_0x7f76('0x16')]){if(_0x4dbc83[_0x7f76('0x16')]['code']===0x1f4){logger[_0x7f76('0x16')]('MailAccount,\x20%s,\x20%s',_0x15dcd9,_0x4dbc83[_0x7f76('0x16')][_0x7f76('0x17')]);return _0x5dc8aa(_0x4dbc83['error']['message']);}logger['error'](_0x7f76('0x12'),_0x15dcd9,_0x4dbc83[_0x7f76('0x16')][_0x7f76('0x17')]);return _0x247403(_0x4dbc83['error'][_0x7f76('0x17')]);}else{logger['info'](_0x7f76('0x12'),_0x15dcd9,_0x7f76('0x13'));_0x247403(_0x4dbc83[_0x7f76('0x18')]['message']);}})['catch'](function(_0x494537){logger['error']('MailAccount,\x20%s,\x20%s',_0x15dcd9,_0x494537);_0x5dc8aa(_0x494537);});});}exports[_0x7f76('0x19')]=function(_0xdb1407){var _0x2b2e32=this;return new Promise(function(_0x21c2ca,_0x54610a){return db[_0x7f76('0x1a')]['findAll']({'raw':_0xdb1407[_0x7f76('0x1b')]?_0xdb1407[_0x7f76('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xdb1407['options']?_0xdb1407[_0x7f76('0x1b')][_0x7f76('0x1c')]||null:null,'attributes':_0xdb1407['options']?_0xdb1407[_0x7f76('0x1b')]['attributes']||null:null,'limit':_0xdb1407[_0x7f76('0x1b')]?_0xdb1407[_0x7f76('0x1b')][_0x7f76('0x1d')]||null:null,'include':_0xdb1407[_0x7f76('0x1b')]?_0xdb1407[_0x7f76('0x1b')]['include']?_[_0x7f76('0x1e')](_0xdb1407['options']['include'],function(_0x197519){return{'model':db[_0x197519[_0x7f76('0x1f')]],'as':_0x197519['as'],'attributes':_0x197519[_0x7f76('0x20')],'include':_0x197519['include']?_[_0x7f76('0x1e')](_0x197519[_0x7f76('0x21')],function(_0x3e624d){return{'model':db[_0x3e624d[_0x7f76('0x1f')]],'as':_0x3e624d['as'],'attributes':_0x3e624d[_0x7f76('0x20')],'include':_0x3e624d['include']?_[_0x7f76('0x1e')](_0x3e624d[_0x7f76('0x21')],function(_0x523d7a){return{'model':db[_0x523d7a['model']],'as':_0x523d7a['as'],'attributes':_0x523d7a[_0x7f76('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1dd664){logger[_0x7f76('0x11')](_0x7f76('0x19'),_0xdb1407);logger[_0x7f76('0x22')](_0x7f76('0x19'),_0xdb1407,JSON[_0x7f76('0x15')](_0x1dd664));_0x21c2ca(_0x1dd664);})['catch'](function(_0x3570ec){logger[_0x7f76('0x16')](_0x7f76('0x19'),_0x3570ec[_0x7f76('0x17')],_0xdb1407);_0x54610a(_0x2b2e32['error'](0x1f4,_0x3570ec[_0x7f76('0x17')]));});});};exports[_0x7f76('0x23')]=function(_0x3aacba){var _0x4d7a2f=this;return new Promise(function(_0x208ced,_0x419dad){return db[_0x7f76('0x1a')][_0x7f76('0x24')]({'raw':_0x3aacba[_0x7f76('0x1b')]?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x25')]===undefined?!![]:![]:!![],'where':_0x3aacba[_0x7f76('0x1b')]?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x1c')]||null:null,'attributes':_0x3aacba[_0x7f76('0x1b')]?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x20')]||null:null,'include':_0x3aacba['options']?_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x21')]?_[_0x7f76('0x1e')](_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x21')],function(_0x20c260){return{'model':db[_0x20c260[_0x7f76('0x1f')]],'as':_0x20c260['as'],'attributes':_0x20c260[_0x7f76('0x20')],'include':_0x20c260['include']?_[_0x7f76('0x1e')](_0x20c260['include'],function(_0x5e9a68){return{'model':db[_0x5e9a68[_0x7f76('0x1f')]],'as':_0x5e9a68['as'],'attributes':_0x5e9a68['attributes'],'include':_0x5e9a68[_0x7f76('0x21')]?_[_0x7f76('0x1e')](_0x5e9a68['include'],function(_0x3dbcc3){return{'model':db[_0x3dbcc3['model']],'as':_0x3dbcc3['as'],'attributes':_0x3dbcc3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f76('0x10')](function(_0x205223){if(_0x3aacba[_0x7f76('0x1b')][_0x7f76('0x26')]===!![])_0x205223[_0x7f76('0x27')]('smtpOptions',_0x205223[_0x7f76('0x28')]());logger[_0x7f76('0x11')]('ShowMailAccount',_0x3aacba);logger['debug'](_0x7f76('0x23'),_0x3aacba,JSON['stringify'](_0x205223));_0x208ced(_0x205223);})[_0x7f76('0x29')](function(_0x17dfb3){logger[_0x7f76('0x16')]('ShowMailAccount',_0x17dfb3[_0x7f76('0x17')],_0x3aacba);_0x419dad(_0x4d7a2f[_0x7f76('0x16')](0x1f4,_0x17dfb3[_0x7f76('0x17')]));});});};exports[_0x7f76('0x2a')]=function(_0x1ed18a){var _0x438de8=this;return new Promise(function(_0x58649f,_0x518ced){var _0x218370={'body':_0x1ed18a[_0x7f76('0x2b')],'channel':_0x7f76('0x2c')};var _0x331f75=_[_0x7f76('0x2d')](_[_0x7f76('0x2e')](db[_0x7f76('0x2f')][_0x7f76('0x30')]),[_0x7f76('0x31'),_0x7f76('0x32'),_0x7f76('0x33'),_0x7f76('0x34')]);var _0x3229b9=![];if(_0x1ed18a[_0x7f76('0x2b')]['id']){delete _0x1ed18a[_0x7f76('0x2b')]['id'];}if(_[_0x7f76('0x35')](_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x36')])){return _0x518ced(_0x438de8['error'](0x1f4,_0x7f76('0x37')));}if(_[_0x7f76('0x35')](_0x1ed18a[_0x7f76('0x2b')]['body'])||_0x1ed18a['body'][_0x7f76('0x2b')]===''){return _0x518ced(_0x438de8['error'](0x1f4,_0x7f76('0x38')));}if(_['isNil'](_0x1ed18a['body'][_0x7f76('0x39')])){return _0x518ced(_0x438de8[_0x7f76('0x16')](0x1f4,_0x7f76('0x3a')+_0x331f75));}if(!_[_0x7f76('0x3b')](_0x331f75,_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x39')])){return _0x518ced(_0x438de8[_0x7f76('0x16')](0x1f4,_0x7f76('0x3c')+_0x331f75));}var _0x71f722={};_0x71f722[_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x39')]]=_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x36')];return db[_0x7f76('0x1a')]['find']({'where':{'id':_0x1ed18a[_0x7f76('0x3d')]['id']},'include':[{'model':db['CmList'],'as':_0x7f76('0x3e'),'include':[{'model':db[_0x7f76('0x2f')],'as':_0x7f76('0x3f'),'where':_0x71f722,'limit':0x1,'order':[[_0x7f76('0x32'),'DESC']]}]},{'model':db[_0x7f76('0x40')],'as':_0x7f76('0x41')},{'model':db[_0x7f76('0x42')],'as':_0x7f76('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7f76('0x44')}]}]})[_0x7f76('0x10')](function(_0x53f77a){if(_0x53f77a&&_0x53f77a[_0x7f76('0x3e')]){var _0x364fea=_0x53f77a[_0x7f76('0x45')]({'plain':!![]});_0x218370['account']=_[_0x7f76('0x46')](_0x364fea,[_0x7f76('0x41'),_0x7f76('0x3e')]);_0x218370[_0x7f76('0x3d')][_0x7f76('0x47')]=_0x53f77a[_0x7f76('0x28')]();_0x218370[_0x7f76('0x48')]=_0x364fea[_0x7f76('0x41')];_0x218370[_0x7f76('0x49')]=_0x364fea[_0x7f76('0x3e')];_0x218370[_0x7f76('0x48')]=_[_0x7f76('0x4a')](_0x218370['applications'],[_0x7f76('0x4b')],['asc']);if(_0x218370[_0x7f76('0x3d')]&&_0x218370[_0x7f76('0x3d')][_0x7f76('0x4c')]){_0x218370['applications'][_0x7f76('0x4d')]({'id':0x0,'priority':_0x218370[_0x7f76('0x48')]['length']+0x1,'app':_0x7f76('0x4e'),'appdata':_0x7f76('0x4c'),'interval':_0x7f76('0x4f')});}if(_0x218370[_0x7f76('0x3d')][_0x7f76('0x41')]){delete _0x218370[_0x7f76('0x3d')][_0x7f76('0x41')];}if(_0x218370[_0x7f76('0x3d')][_0x7f76('0x3e')]){delete _0x218370['account']['List'];}if(_0x364fea[_0x7f76('0x3e')][_0x7f76('0x3f')][_0x7f76('0x50')]){return _0x364fea[_0x7f76('0x3e')][_0x7f76('0x3f')][0x0];}var _0x33b0ae=_[_0x7f76('0xa')](_0x1ed18a[_0x7f76('0x2b')],{'firstName':_0x1ed18a[_0x7f76('0x2b')]['from'],'ListId':_0x364fea[_0x7f76('0x34')]});_0x33b0ae[_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x39')]]=_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x36')];return db[_0x7f76('0x2f')][_0x7f76('0x51')](_0x33b0ae);}else{throw new Error('List\x20not\x20found');}})[_0x7f76('0x10')](function(_0x52b523){_0x218370[_0x7f76('0x52')]=_0x52b523;if(_0x52b523){if(!_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')]){_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')]=rs[_0x7f76('0x54')]()+'\x20'+_0x1ed18a['body']['message'][_0x7f76('0x36')];}var _0x4529b0={'ContactId':_0x52b523['id'],'MailAccountId':_0x1ed18a[_0x7f76('0x3d')]['id'],'inReplyTo':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')],'to':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['from'],'cc':_0x1ed18a['body'][_0x7f76('0x17')]['cc'],'subject':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['subject'],'attach':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['attach'],'lastMsgAt':moment()[_0x7f76('0x55')](_0x7f76('0x56')),'lastMsgDirection':'in'};return db[_0x7f76('0x57')][_0x7f76('0x24')]({'where':{'closed':![],'MailAccountId':_0x1ed18a[_0x7f76('0x3d')]['id']},'include':[{'model':db[_0x7f76('0x58')],'as':'Messages','attributes':[_0x7f76('0x53')],'where':{'messageId':_0x1ed18a['body'][_0x7f76('0x17')]['inReplyTo']}}]})[_0x7f76('0x10')](function(_0x5f3db2){if(_0x5f3db2){return[_0x5f3db2,![]];}return db[_0x7f76('0x57')][_0x7f76('0x51')](_0x4529b0)[_0x7f76('0x10')](function(_0x3e83d2){return[_0x3e83d2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7f76('0x59')](function(_0x20264e,_0x46b15b){if(_0x20264e){_0x3229b9=_0x46b15b;if(!_0x46b15b){return _0x20264e[_0x7f76('0x5a')]({'inReplyTo':_0x1ed18a[_0x7f76('0x2b')]['message'][_0x7f76('0x53')],'to':_0x1ed18a['body'][_0x7f76('0x17')]['from'],'cc':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['cc'],'subject':_0x1ed18a['body'][_0x7f76('0x17')][_0x7f76('0x5b')],'attach':_0x20264e[_0x7f76('0x5c')]?_0x20264e[_0x7f76('0x5c')]:_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x5c')],'substatus':null,'substatusAt':moment()[_0x7f76('0x55')](_0x7f76('0x56')),'lastMsgAt':moment()[_0x7f76('0x55')](_0x7f76('0x56')),'lastMsgDirection':'in'});}else{return _0x20264e;}}})[_0x7f76('0x10')](function(_0xb0be79){_0x218370[_0x7f76('0x5d')]=_0xb0be79['get']({'plain':!![]});_0x218370[_0x7f76('0x5d')][_0x7f76('0x5e')]=_0x3229b9;return db['MailMessage'][_0x7f76('0x51')]({'body':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x2b')],'MailAccountId':_0x1ed18a[_0x7f76('0x3d')]['id'],'MailInteractionId':_0xb0be79['id'],'direction':'in','ContactId':_0x218370[_0x7f76('0x52')]['id'],'messageId':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x53')],'from':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x36')],'to':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['to'],'cc':_0x1ed18a[_0x7f76('0x2b')]['message']['cc'],'subject':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['subject'],'attach':_0x1ed18a['body']['message'][_0x7f76('0x5c')],'Attachments':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')]['attachments'],'originTo':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x5f')],'originCc':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x60')],'bcc':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x61')],'ChatWebsiteId':_0x1ed18a['body'][_0x7f76('0x17')][_0x7f76('0x62')]||null,'originChannel':_0x1ed18a[_0x7f76('0x2b')][_0x7f76('0x17')][_0x7f76('0x63')]||_0x7f76('0x64'),'ChatOfflineMessageId':_0x1ed18a[_0x7f76('0x2b')]['message'][_0x7f76('0x65')]||null},{'include':[{'model':db[_0x7f76('0x66')],'as':_0x7f76('0x67')}]});})[_0x7f76('0x10')](function(_0x43d856){_0x218370['message']=_0x43d856;if(!_0x218370[_0x7f76('0x5d')][_0x7f76('0x68')]){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x218370[_0x7f76('0x5d')][_0x7f76('0x68')]}});})[_0x7f76('0x10')](function(_0x8d6dec){if(_0x8d6dec){_0x218370[_0x7f76('0x48')][_0x7f76('0x69')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8d6dec[_0x7f76('0x6a')]+','+(_0x218370[_0x7f76('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0x7f76('0x4f')});}if(!_0x218370[_0x7f76('0x5d')][_0x7f76('0x6b')]){return;}return db[_0x7f76('0x6c')][_0x7f76('0x24')]({'attributes':['id',_0x7f76('0x6a')],'where':{'id':_0x218370[_0x7f76('0x5d')]['queueId']}});})[_0x7f76('0x10')](function(_0x428865){if(_0x428865){_0x218370['applications'][_0x7f76('0x69')]({'id':0x0,'priority':0x1,'app':_0x7f76('0x6d'),'appdata':_0x428865['name']+','+(_0x218370[_0x7f76('0x3d')][_0x7f76('0x6e')]||0x12c),'interval':_0x7f76('0x4f')});}return respondWithRpcPromise(_0x7f76('0x6f'),_0x7f76('0x70'),_0x218370);})[_0x7f76('0x10')](function(_0x37afb1){_0x58649f(_0x37afb1);})[_0x7f76('0x29')](function(_0x95d3a8){_0x518ced(_0x438de8[_0x7f76('0x16')](0x1f4,_0x95d3a8[_0x7f76('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9d7dfba..f784b9f 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 _0x8b09=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x1ea4e3,_0x57ad7e){var _0x51030d=function(_0x423390){while(--_0x423390){_0x1ea4e3['push'](_0x1ea4e3['shift']());}};_0x51030d(++_0x57ad7e);}(_0x8b09,0x153));var _0x98b0=function(_0x3753b5,_0x65933d){_0x3753b5=_0x3753b5-0x0;var _0x12a74f=_0x8b09[_0x3753b5];return _0x12a74f;};'use strict';var MailAccountEvents=require(_0x98b0('0x0'));var events=[_0x98b0('0x1'),_0x98b0('0x2'),_0x98b0('0x3')];function createListener(_0x5e301b,_0x2e757a){return function(_0x4f0140){_0x2e757a[_0x98b0('0x4')](_0x5e301b,_0x4f0140);};}function removeListener(_0x54c6e7,_0x26e39d){return function(){MailAccountEvents[_0x98b0('0x5')](_0x54c6e7,_0x26e39d);};}exports[_0x98b0('0x6')]=function(_0x2c83d7){for(var _0x3ca831=0x0,_0x277011=events[_0x98b0('0x7')];_0x3ca831<_0x277011;_0x3ca831++){var _0xec2038=events[_0x3ca831];var _0x4ca573=createListener(_0x98b0('0x8')+_0xec2038,_0x2c83d7);MailAccountEvents['on'](_0xec2038,_0x4ca573);}}; \ No newline at end of file +var _0x9626=['remove','emit','register','length','./mailAccount.events','save'];(function(_0x1e0ee8,_0x5412b7){var _0x574fe2=function(_0x11c346){while(--_0x11c346){_0x1e0ee8['push'](_0x1e0ee8['shift']());}};_0x574fe2(++_0x5412b7);}(_0x9626,0x196));var _0x6962=function(_0x6dfd85,_0x29861c){_0x6dfd85=_0x6dfd85-0x0;var _0xe8783d=_0x9626[_0x6dfd85];return _0xe8783d;};'use strict';var MailAccountEvents=require(_0x6962('0x0'));var events=[_0x6962('0x1'),_0x6962('0x2'),'update'];function createListener(_0x476dfe,_0x5a3613){return function(_0x2f9f7e){_0x5a3613[_0x6962('0x3')](_0x476dfe,_0x2f9f7e);};}function removeListener(_0x129f2f,_0xf8b96d){return function(){MailAccountEvents['removeListener'](_0x129f2f,_0xf8b96d);};}exports[_0x6962('0x4')]=function(_0x4da270){for(var _0x188f79=0x0,_0x38b226=events[_0x6962('0x5')];_0x188f79<_0x38b226;_0x188f79++){var _0x183e64=events[_0x188f79];var _0x4e4266=createListener('mailAccount:'+_0x183e64,_0x4da270);MailAccountEvents['on'](_0x183e64,_0x4e4266);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8d7d8d4..c2b6529 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 _0x1ec1=['show','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','get','/:id','isAuthenticated'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x1ec1,0x86));var _0x11ec=function(_0x14cec4,_0x3c65f7){_0x14cec4=_0x14cec4-0x0;var _0x21f076=_0x1ec1[_0x14cec4];return _0x21f076;};'use strict';var multer=require(_0x11ec('0x0'));var util=require(_0x11ec('0x1'));var path=require(_0x11ec('0x2'));var timeout=require(_0x11ec('0x3'));var express=require(_0x11ec('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x11ec('0x5'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x11ec('0x6')](_0x11ec('0x7'),auth[_0x11ec('0x8')](),controller[_0x11ec('0x9')]);router[_0x11ec('0xa')](_0x11ec('0x7'),auth[_0x11ec('0x8')](),controller['update']);router[_0x11ec('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x11ec('0xc')]=router; \ No newline at end of file +var _0xfb8b=['get','/:id','isAuthenticated','show','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x47eb64,_0x176207){var _0x42695a=function(_0x53497e){while(--_0x53497e){_0x47eb64['push'](_0x47eb64['shift']());}};_0x42695a(++_0x176207);}(_0xfb8b,0x1d2));var _0xbfb8=function(_0x28511b,_0x1d9280){_0x28511b=_0x28511b-0x0;var _0x2b2f13=_0xfb8b[_0x28511b];return _0x2b2f13;};'use strict';var multer=require(_0xbfb8('0x0'));var util=require(_0xbfb8('0x1'));var path=require(_0xbfb8('0x2'));var timeout=require('connect-timeout');var express=require(_0xbfb8('0x3'));var router=express[_0xbfb8('0x4')]();var fs_extra=require(_0xbfb8('0x5'));var auth=require(_0xbfb8('0x6'));var interaction=require(_0xbfb8('0x7'));var config=require(_0xbfb8('0x8'));var controller=require(_0xbfb8('0x9'));router[_0xbfb8('0xa')](_0xbfb8('0xb'),auth[_0xbfb8('0xc')](),controller[_0xbfb8('0xd')]);router[_0xbfb8('0xe')]('/:id',auth[_0xbfb8('0xc')](),controller[_0xbfb8('0xf')]);router['delete'](_0xbfb8('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbfb8('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 0beb2b3..108be2e 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 _0xfac5=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0xfac5,0x111));var _0x5fac=function(_0x4439b0,_0x2df914){_0x4439b0=_0x4439b0-0x0;var _0x2ff05f=_0xfac5[_0x4439b0];return _0x2ff05f;};'use strict';var Sequelize=require('sequelize');module[_0x5fac('0x0')]={'priority':{'type':Sequelize[_0x5fac('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5fac('0x2')],'allowNull':![],'defaultValue':_0x5fac('0x3')},'appdata':{'type':Sequelize[_0x5fac('0x4')]()},'description':{'type':Sequelize[_0x5fac('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xdcd1=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdcd1,0x84));var _0x1dcd=function(_0x454a3f,_0x261f5c){_0x454a3f=_0x454a3f-0x0;var _0xe56702=_0xdcd1[_0x454a3f];return _0xe56702;};'use strict';var Sequelize=require('sequelize');module[_0x1dcd('0x0')]={'priority':{'type':Sequelize[_0x1dcd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1dcd('0x2')],'allowNull':![],'defaultValue':_0x1dcd('0x3')},'appdata':{'type':Sequelize[_0x1dcd('0x4')]()},'description':{'type':Sequelize[_0x1dcd('0x2')]},'interval':{'type':Sequelize[_0x1dcd('0x2')],'defaultValue':_0x1dcd('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 720ad7b..28b6111 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(_0x24fb14,_0x3dcf39){var _0x55a51f=function(_0x239bae){while(--_0x239bae){_0x24fb14['push'](_0x24fb14['shift']());}};_0x55a51f(++_0x3dcf39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x2a2fdb,_0x5b5d57){var _0x34fbbf=function(_0x414ba3){while(--_0x414ba3){_0x2a2fdb['push'](_0x2a2fdb['shift']());}};_0x34fbbf(++_0x5b5d57);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b15ad70..36da3b7 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 _0xa4ef=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xa4ef,0x6a));var _0xfa4e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa4ef[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xfa4e('0x0'));var util=require(_0xfa4e('0x1'));var logger=require(_0xfa4e('0x2'))(_0xfa4e('0x3'));var moment=require(_0xfa4e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa4e('0x5'));var fs=require('fs');var path=require(_0xfa4e('0x6'));var rimraf=require('rimraf');var config=require(_0xfa4e('0x7'));var attributes=require(_0xfa4e('0x8'));module[_0xfa4e('0x9')]=function(_0x39a7c4,_0x229803){return _0x39a7c4[_0xfa4e('0xa')](_0xfa4e('0xb'),attributes,{'tableName':_0xfa4e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa4e('0xd'),'collate':_0xfa4e('0xe')});}; \ No newline at end of file +var _0x717c=['lodash','util','bluebird','path','./mailApplication.attributes','exports','define','mail_applications','utf8mb4'];(function(_0x294039,_0x21795b){var _0x1b48e5=function(_0x29ff6a){while(--_0x29ff6a){_0x294039['push'](_0x294039['shift']());}};_0x1b48e5(++_0x21795b);}(_0x717c,0x1cb));var _0xc717=function(_0x473ef2,_0x1c4151){_0x473ef2=_0x473ef2-0x0;var _0x3ab7f2=_0x717c[_0x473ef2];return _0x3ab7f2;};'use strict';var _=require(_0xc717('0x0'));var util=require(_0xc717('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc717('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc717('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc717('0x4'));module[_0xc717('0x5')]=function(_0x551fed,_0x248f92){return _0x551fed[_0xc717('0x6')]('MailApplication',attributes,{'tableName':_0xc717('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc717('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 3152844..db3f12f 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 _0x0a29=['code','error','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','then','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f2377,_0x11cc21){var _0x441e6b=function(_0x1d0e90){while(--_0x1d0e90){_0x2f2377['push'](_0x2f2377['shift']());}};_0x441e6b(++_0x11cc21);}(_0x0a29,0x186));var _0x90a2=function(_0x5dc922,_0x26a255){_0x5dc922=_0x5dc922-0x0;var _0x22b97e=_0x0a29[_0x5dc922];return _0x22b97e;};'use strict';var _=require(_0x90a2('0x0'));var util=require(_0x90a2('0x1'));var moment=require('moment');var BPromise=require(_0x90a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90a2('0x3'));var db=require(_0x90a2('0x4'))['db'];var utils=require(_0x90a2('0x5'));var logger=require('../../config/logger')(_0x90a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x90a2('0x7'));var client=jayson['client'][_0x90a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57f9e7,_0x48a4eb,_0x2e8367){return new BPromise(function(_0x490abb,_0x22d860){return client[_0x90a2('0x9')](_0x57f9e7,_0x2e8367)['then'](function(_0x439e4a){logger[_0x90a2('0xa')](_0x90a2('0xb'),_0x48a4eb,_0x90a2('0xc'));logger[_0x90a2('0xd')](_0x90a2('0xe'),_0x48a4eb,'request\x20sent',JSON[_0x90a2('0xf')](_0x439e4a));if(_0x439e4a['error']){if(_0x439e4a['error'][_0x90a2('0x10')]===0x1f4){logger[_0x90a2('0x11')](_0x90a2('0xb'),_0x48a4eb,_0x439e4a[_0x90a2('0x11')][_0x90a2('0x12')]);return _0x22d860(_0x439e4a[_0x90a2('0x11')][_0x90a2('0x12')]);}logger[_0x90a2('0x11')](_0x90a2('0xb'),_0x48a4eb,_0x439e4a[_0x90a2('0x11')][_0x90a2('0x12')]);return _0x490abb(_0x439e4a[_0x90a2('0x11')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x48a4eb,_0x90a2('0xc'));_0x490abb(_0x439e4a[_0x90a2('0x13')]['message']);}})['catch'](function(_0x53d65d){logger['error'](_0x90a2('0xb'),_0x48a4eb,_0x53d65d);_0x22d860(_0x53d65d);});});}exports[_0x90a2('0x14')]=function(_0x558952){var _0x5eed3e=this;return new Promise(function(_0x31dda8,_0x8eeb06){return db['MailApplication'][_0x90a2('0x15')](_0x558952[_0x90a2('0x16')],{'raw':_0x558952[_0x90a2('0x17')]?_0x558952[_0x90a2('0x17')][_0x90a2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x558952[_0x90a2('0x17')]?_0x558952['options'][_0x90a2('0x19')]||null:null,'attributes':_0x558952[_0x90a2('0x17')]?_0x558952[_0x90a2('0x17')][_0x90a2('0x1a')]||null:null,'limit':_0x558952[_0x90a2('0x17')]?_0x558952['options']['limit']||null:null})[_0x90a2('0x1b')](function(_0x28f583){logger[_0x90a2('0xa')](_0x90a2('0x14'),_0x558952);logger[_0x90a2('0xd')](_0x90a2('0x14'),_0x558952,JSON[_0x90a2('0xf')](_0x28f583));_0x31dda8(_0x28f583);})[_0x90a2('0x1c')](function(_0x369d88){logger[_0x90a2('0x11')](_0x90a2('0x14'),_0x369d88[_0x90a2('0x12')],_0x558952);_0x8eeb06(_0x5eed3e[_0x90a2('0x11')](0x1f4,_0x369d88[_0x90a2('0x12')]));});});}; \ No newline at end of file +var _0xefe2=['http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x223350,_0x2eefa8){var _0x3cd907=function(_0x52f80a){while(--_0x52f80a){_0x223350['push'](_0x223350['shift']());}};_0x3cd907(++_0x2eefa8);}(_0xefe2,0xe6));var _0x2efe=function(_0xdc19d4,_0x4afa8e){_0xdc19d4=_0xdc19d4-0x0;var _0x1e9ff9=_0xefe2[_0xdc19d4];return _0x1e9ff9;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require(_0x2efe('0x2'));var BPromise=require('bluebird');var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2efe('0x5'));var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require('../../config/environment');var jayson=require(_0x2efe('0x8'));var client=jayson[_0x2efe('0x9')][_0x2efe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372a0f,_0x3a57a4,_0x3fee21){return new BPromise(function(_0x4c535,_0x2c6425){return client['request'](_0x372a0f,_0x3fee21)[_0x2efe('0xb')](function(_0x14db58){logger['info'](_0x2efe('0xc'),_0x3a57a4,_0x2efe('0xd'));logger[_0x2efe('0xe')](_0x2efe('0xf'),_0x3a57a4,_0x2efe('0xd'),JSON[_0x2efe('0x10')](_0x14db58));if(_0x14db58[_0x2efe('0x11')]){if(_0x14db58[_0x2efe('0x11')][_0x2efe('0x12')]===0x1f4){logger[_0x2efe('0x11')]('MailApplication,\x20%s,\x20%s',_0x3a57a4,_0x14db58[_0x2efe('0x11')][_0x2efe('0x13')]);return _0x2c6425(_0x14db58[_0x2efe('0x11')]['message']);}logger[_0x2efe('0x11')](_0x2efe('0xc'),_0x3a57a4,_0x14db58['error'][_0x2efe('0x13')]);return _0x4c535(_0x14db58['error'][_0x2efe('0x13')]);}else{logger['info'](_0x2efe('0xc'),_0x3a57a4,_0x2efe('0xd'));_0x4c535(_0x14db58[_0x2efe('0x14')][_0x2efe('0x13')]);}})[_0x2efe('0x15')](function(_0x1eeae6){logger[_0x2efe('0x11')](_0x2efe('0xc'),_0x3a57a4,_0x1eeae6);_0x2c6425(_0x1eeae6);});});}exports[_0x2efe('0x16')]=function(_0x5aeb82){var _0x349013=this;return new Promise(function(_0xbafe5d,_0x412092){return db['MailApplication'][_0x2efe('0x17')](_0x5aeb82[_0x2efe('0x18')],{'raw':_0x5aeb82['options']?_0x5aeb82[_0x2efe('0x19')][_0x2efe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aeb82['options']?_0x5aeb82['options'][_0x2efe('0x1b')]||null:null,'attributes':_0x5aeb82['options']?_0x5aeb82[_0x2efe('0x19')][_0x2efe('0x1c')]||null:null,'limit':_0x5aeb82[_0x2efe('0x19')]?_0x5aeb82[_0x2efe('0x19')]['limit']||null:null})['then'](function(_0x461b27){logger[_0x2efe('0x1d')]('UpdateMailApplication',_0x5aeb82);logger['debug']('UpdateMailApplication',_0x5aeb82,JSON[_0x2efe('0x10')](_0x461b27));_0xbafe5d(_0x461b27);})[_0x2efe('0x15')](function(_0x3012fe){logger['error'](_0x2efe('0x16'),_0x3012fe['message'],_0x5aeb82);_0x412092(_0x349013[_0x2efe('0x11')](0x1f4,_0x3012fe['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index edb625b..ca466c5 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 _0x29fb=['describe','/:id','show','/:id/messages','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0xb6fea8,_0x168b47){var _0xfba656=function(_0x1b5094){while(--_0x1b5094){_0xb6fea8['push'](_0xb6fea8['shift']());}};_0xfba656(++_0x168b47);}(_0x29fb,0xf3));var _0xb29f=function(_0x37d55d,_0x418158){_0x37d55d=_0x37d55d-0x0;var _0x54ca76=_0x29fb[_0x37d55d];return _0x54ca76;};'use strict';var express=require(_0xb29f('0x0'));var router=express[_0xb29f('0x1')]();var auth=require(_0xb29f('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xb29f('0x3'));router[_0xb29f('0x4')]('/',auth[_0xb29f('0x5')](),controller[_0xb29f('0x6')]);router[_0xb29f('0x4')]('/describe',auth[_0xb29f('0x5')](),controller[_0xb29f('0x7')]);router[_0xb29f('0x4')](_0xb29f('0x8'),auth[_0xb29f('0x5')](),controller[_0xb29f('0x9')]);router[_0xb29f('0x4')](_0xb29f('0xa'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb29f('0x4')]('/:id/download',auth[_0xb29f('0x5')](),controller['download']);router[_0xb29f('0xb')]('/',auth[_0xb29f('0x5')](),controller[_0xb29f('0xc')]);router[_0xb29f('0xb')]('/:id/messages',auth[_0xb29f('0x5')](),controller[_0xb29f('0xd')]);router[_0xb29f('0xb')](_0xb29f('0xe'),auth[_0xb29f('0x5')](),interaction[_0xb29f('0xf')]('mail',_0xb29f('0x10')),controller[_0xb29f('0x11')]);router[_0xb29f('0x12')]('/:id',auth[_0xb29f('0x5')](),interaction['tracked'](_0xb29f('0x13'),'mailinteraction:update'),controller[_0xb29f('0x14')]);router[_0xb29f('0x15')](_0xb29f('0x8'),auth[_0xb29f('0x5')](),interaction['tracked'](_0xb29f('0x13'),'mailinteraction:destroy'),controller[_0xb29f('0x16')]);router[_0xb29f('0x15')](_0xb29f('0xe'),auth[_0xb29f('0x5')](),controller[_0xb29f('0x17')]);module[_0xb29f('0x18')]=router; \ No newline at end of file +var _0x5ce4=['show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x3d732e,_0x461f7a){var _0x2c0b04=function(_0x23d24a){while(--_0x23d24a){_0x3d732e['push'](_0x3d732e['shift']());}};_0x2c0b04(++_0x461f7a);}(_0x5ce4,0xbc));var _0x45ce=function(_0x3ba69c,_0x3e370c){_0x3ba69c=_0x3ba69c-0x0;var _0x1c722b=_0x5ce4[_0x3ba69c];return _0x1c722b;};'use strict';var express=require(_0x45ce('0x0'));var router=express['Router']();var auth=require(_0x45ce('0x1'));var interaction=require(_0x45ce('0x2'));var controller=require('./mailInteraction.controller');router[_0x45ce('0x3')]('/',auth[_0x45ce('0x4')](),controller[_0x45ce('0x5')]);router[_0x45ce('0x3')](_0x45ce('0x6'),auth['isAuthenticated'](),controller[_0x45ce('0x7')]);router[_0x45ce('0x3')]('/:id',auth[_0x45ce('0x4')](),controller[_0x45ce('0x8')]);router[_0x45ce('0x3')](_0x45ce('0x9'),auth[_0x45ce('0x4')](),controller[_0x45ce('0xa')]);router['get']('/:id/download',auth[_0x45ce('0x4')](),controller[_0x45ce('0xb')]);router[_0x45ce('0xc')]('/',auth['isAuthenticated'](),controller[_0x45ce('0xd')]);router['post'](_0x45ce('0x9'),auth[_0x45ce('0x4')](),controller['addMessage']);router[_0x45ce('0xc')](_0x45ce('0xe'),auth['isAuthenticated'](),interaction[_0x45ce('0xf')](_0x45ce('0x10'),_0x45ce('0x11')),controller[_0x45ce('0x12')]);router[_0x45ce('0x13')]('/:id',auth[_0x45ce('0x4')](),interaction[_0x45ce('0xf')](_0x45ce('0x10'),_0x45ce('0x14')),controller[_0x45ce('0x15')]);router[_0x45ce('0x16')](_0x45ce('0x17'),auth[_0x45ce('0x4')](),interaction[_0x45ce('0xf')](_0x45ce('0x10'),_0x45ce('0x18')),controller[_0x45ce('0x19')]);router[_0x45ce('0x16')](_0x45ce('0xe'),auth[_0x45ce('0x4')](),controller[_0x45ce('0x1a')]);module[_0x45ce('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ec675dc..1396907 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 _0xae95=['TEXT','long','DATE','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xae95,0x17c));var _0x5ae9=function(_0x97feb1,_0x524c){_0x97feb1=_0x97feb1-0x0;var _0x5b0221=_0xae95[_0x97feb1];return _0x5b0221;};'use strict';var Sequelize=require(_0x5ae9('0x0'));var iconv=require(_0x5ae9('0x1'));module[_0x5ae9('0x2')]={'closed':{'type':Sequelize[_0x5ae9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5ae9('0x4')]},'secondDisposition':{'type':Sequelize[_0x5ae9('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5ae9('0x4')]},'note':{'type':Sequelize[_0x5ae9('0x4')]},'inReplyTo':{'type':Sequelize[_0x5ae9('0x4')](0x1fe)},'to':{'type':Sequelize[_0x5ae9('0x4')]},'cc':{'type':Sequelize[_0x5ae9('0x5')](_0x5ae9('0x6'))},'subject':{'type':Sequelize[_0x5ae9('0x5')]()},'attach':{'type':Sequelize[_0x5ae9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x5ae9('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x5ae9('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x5ae9('0x8')]('in',_0x5ae9('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5ae9('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5ae9('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5ae9('0xa')]}}; \ No newline at end of file +var _0x52f9=['sequelize','iconv','exports','DATE','STRING','TEXT','BOOLEAN','ENUM','out'];(function(_0x282186,_0x433534){var _0x445ef5=function(_0x410099){while(--_0x410099){_0x282186['push'](_0x282186['shift']());}};_0x445ef5(++_0x433534);}(_0x52f9,0x6c));var _0x952f=function(_0x3dcfd2,_0x3bf173){_0x3dcfd2=_0x3dcfd2-0x0;var _0x254a7b=_0x52f9[_0x3dcfd2];return _0x254a7b;};'use strict';var Sequelize=require(_0x952f('0x0'));var iconv=require(_0x952f('0x1'));module[_0x952f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x952f('0x3')]},'disposition':{'type':Sequelize[_0x952f('0x4')]},'secondDisposition':{'type':Sequelize[_0x952f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x952f('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x952f('0x5')]('long')},'subject':{'type':Sequelize[_0x952f('0x5')]()},'attach':{'type':Sequelize[_0x952f('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x952f('0x3')]},'substatus':{'type':Sequelize[_0x952f('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x952f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x952f('0x7')]('in',_0x952f('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x952f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x952f('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x952f('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ea63227..601c9b3 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 _0xc827=['nolimit','order','sort','where','MailInteractionId','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','inlineCss','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','root','tmp','server','attachments','join','push','Attachments','from','bcc','subject','Messages','get','each','missing.recipient@your.company.com','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','util','path','lodash','juice','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','undefined','count','offset','status','Content-Range','update','then','destroy','stack','name','send','rawAttributes','type','key','mail','query','user','catch','show','params','model','MailInteraction','keys','filters','intersection','attributes','fields','length','includeAll','merge','create','body','find','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xc827,0x1e5));var _0x7c82=function(_0x23674c,_0x4df3db){_0x23674c=_0x23674c-0x0;var _0x2d1881=_0xc827[_0x23674c];return _0x2d1881;};'use strict';var emlformat=require(_0x7c82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x7c82('0x2'));var path=require(_0x7c82('0x3'));var fs=require('fs');var _=require(_0x7c82('0x4'));var juice=require(_0x7c82('0x5'));var Redis=require('ioredis');var interaction=require(_0x7c82('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x7c82('0x7'))(_0x7c82('0x8'));var config=require(_0x7c82('0x9'));var db=require(_0x7c82('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x7c82('0xb')]=_[_0x7c82('0xc')](config[_0x7c82('0xb')],{'host':_0x7c82('0xd'),'port':0x18eb});var socket=require(_0x7c82('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x7c82('0xf')](socket);function respondWithStatusCode(_0x14c157,_0x7227cb){_0x7227cb=_0x7227cb||0xcc;return function(_0x285ddd){if(_0x285ddd){return _0x14c157[_0x7c82('0x10')](_0x7227cb);}return _0x14c157['status'](_0x7227cb)[_0x7c82('0x11')]();};}function respondWithResult(_0x29d09a,_0x30c894){_0x30c894=_0x30c894||0xc8;return function(_0x35e935){if(_0x35e935){return _0x29d09a['status'](_0x30c894)[_0x7c82('0x12')](_0x35e935);}};}function respondWithFilteredResult(_0xa1032f,_0x3108e6){return function(_0x5a3ee8){if(_0x5a3ee8){var _0x1381dd=typeof _0x3108e6['offset']===_0x7c82('0x13')&&typeof _0x3108e6['limit']===_0x7c82('0x13');var _0x55be06=_0x5a3ee8[_0x7c82('0x14')];var _0x641803=_0x1381dd?0x0:_0x3108e6['offset'];var _0x3eedce=_0x1381dd?_0x5a3ee8[_0x7c82('0x14')]:_0x3108e6[_0x7c82('0x15')]+_0x3108e6['limit'];var _0x4d08c3;if(_0x3eedce>=_0x55be06){_0x3eedce=_0x55be06;_0x4d08c3=0xc8;}else{_0x4d08c3=0xce;}_0xa1032f[_0x7c82('0x16')](_0x4d08c3);return _0xa1032f['set'](_0x7c82('0x17'),_0x641803+'-'+_0x3eedce+'/'+_0x55be06)[_0x7c82('0x12')](_0x5a3ee8);}return null;};}function saveUpdates(_0x3dfe0c){return function(_0x20718f){if(_0x20718f){return _0x20718f[_0x7c82('0x18')](_0x3dfe0c)[_0x7c82('0x19')](function(_0x1877c6){return _0x1877c6;});}return null;};}function removeEntity(_0x9efe20){return function(_0x3d3c17){if(_0x3d3c17){return _0x3d3c17[_0x7c82('0x1a')]()[_0x7c82('0x19')](function(){_0x9efe20['status'](0xcc)[_0x7c82('0x11')]();});}};}function handleEntityNotFound(_0x303305){return function(_0x3f8d8e){if(!_0x3f8d8e){_0x303305[_0x7c82('0x10')](0x194);}return _0x3f8d8e;};}function handleError(_0x4ac1f7,_0x55366d){_0x55366d=_0x55366d||0x1f4;return function(_0x1c5a6b){logger['error'](_0x1c5a6b[_0x7c82('0x1b')]);if(_0x1c5a6b['name']){delete _0x1c5a6b[_0x7c82('0x1c')];}_0x4ac1f7['status'](_0x55366d)[_0x7c82('0x1d')](_0x1c5a6b);};}exports['index']=function(_0x43069a,_0x584630){var _0x26e34a={};var _0x24039f=_['map'](db['MailInteraction'][_0x7c82('0x1e')],function(_0x214216){return{'name':_0x214216['fieldName'],'type':_0x214216[_0x7c82('0x1f')][_0x7c82('0x20')]};});_0x26e34a=qs['getOptions'](_0x24039f,_0x43069a);return interaction['findAll'](_0x7c82('0x21'),_0x43069a[_0x7c82('0x22')],_0x43069a[_0x7c82('0x23')],_0x26e34a,_0x24039f)[_0x7c82('0x19')](respondWithFilteredResult(_0x584630,_0x26e34a))[_0x7c82('0x24')](handleError(_0x584630,null));};exports[_0x7c82('0x25')]=function(_0x3cd83c,_0x3d80c3){var _0x2e1b7d={'raw':![],'where':{'id':_0x3cd83c[_0x7c82('0x26')]['id']}},_0x352574={};_0x352574[_0x7c82('0x27')]=_['keys'](db[_0x7c82('0x28')][_0x7c82('0x1e')]);_0x352574[_0x7c82('0x22')]=_[_0x7c82('0x29')](_0x3cd83c['query']);_0x352574[_0x7c82('0x2a')]=_[_0x7c82('0x2b')](_0x352574[_0x7c82('0x27')],_0x352574['query']);_0x2e1b7d[_0x7c82('0x2c')]=_[_0x7c82('0x2b')](_0x352574[_0x7c82('0x27')],qs['fields'](_0x3cd83c[_0x7c82('0x22')][_0x7c82('0x2d')]));_0x2e1b7d[_0x7c82('0x2c')]=_0x2e1b7d[_0x7c82('0x2c')][_0x7c82('0x2e')]?_0x2e1b7d[_0x7c82('0x2c')]:_0x352574[_0x7c82('0x27')];if(_0x3cd83c['query'][_0x7c82('0x2f')]){_0x2e1b7d['include']=[{'all':!![]}];}_0x2e1b7d=_[_0x7c82('0x30')]({},_0x2e1b7d,_0x3cd83c['options']);return db[_0x7c82('0x28')]['find'](_0x2e1b7d)[_0x7c82('0x19')](handleEntityNotFound(_0x3d80c3,null))['then'](respondWithResult(_0x3d80c3,null))['catch'](handleError(_0x3d80c3,null));};exports[_0x7c82('0x31')]=function(_0x893eae,_0x3f68a4){return db['MailInteraction'][_0x7c82('0x31')](_0x893eae[_0x7c82('0x32')],{})[_0x7c82('0x19')](respondWithResult(_0x3f68a4,0xc9))[_0x7c82('0x24')](handleError(_0x3f68a4,null));};exports['update']=function(_0x3c9115,_0x2d5def){if(_0x3c9115[_0x7c82('0x32')]['id']){delete _0x3c9115[_0x7c82('0x32')]['id'];}return db[_0x7c82('0x28')]['find']({'where':{'id':_0x3c9115[_0x7c82('0x26')]['id']}})[_0x7c82('0x19')](handleEntityNotFound(_0x2d5def,null))['then'](saveUpdates(_0x3c9115[_0x7c82('0x32')],null))[_0x7c82('0x19')](respondWithResult(_0x2d5def,null))['catch'](handleError(_0x2d5def,null));};exports[_0x7c82('0x1a')]=function(_0xc9366e,_0x475e3a){return db[_0x7c82('0x28')][_0x7c82('0x33')]({'where':{'id':_0xc9366e[_0x7c82('0x26')]['id']}})[_0x7c82('0x19')](handleEntityNotFound(_0x475e3a,null))[_0x7c82('0x19')](removeEntity(_0x475e3a,null))[_0x7c82('0x24')](handleError(_0x475e3a,null));};exports[_0x7c82('0x34')]=function(_0x2c8721,_0x41b0d7){return db[_0x7c82('0x28')]['describe']()[_0x7c82('0x19')](respondWithResult(_0x41b0d7,null))[_0x7c82('0x24')](handleError(_0x41b0d7,null));};exports[_0x7c82('0x35')]=function(_0x4b1a3c,_0x3771a4){return db[_0x7c82('0x36')][_0x7c82('0x33')]({'where':{'id':_0x4b1a3c['params']['id']}})[_0x7c82('0x19')](handleEntityNotFound(_0x3771a4,null))[_0x7c82('0x19')](function(_0x540bfa){if(_0x540bfa){return _0x540bfa['addMessage'](_0x4b1a3c[_0x7c82('0x32')][_0x7c82('0x37')],_[_0x7c82('0x38')](_0x4b1a3c[_0x7c82('0x32')],[_0x7c82('0x37'),'id'])||{});}})[_0x7c82('0x19')](respondWithResult(_0x3771a4,null))[_0x7c82('0x24')](handleError(_0x3771a4,null));};exports[_0x7c82('0x39')]=function(_0x2bce13,_0x29d53d){var _0x445fab={'raw':![],'where':{}};var _0x4c0f6a={};var _0x4108a5={'count':0x0,'rows':[]};return db['MailInteraction'][_0x7c82('0x3a')]({'where':{'id':_0x2bce13[_0x7c82('0x26')]['id']}})[_0x7c82('0x19')](handleEntityNotFound(_0x29d53d,null))[_0x7c82('0x19')](function(_0x2cc5c2){if(_0x2cc5c2){_0x4c0f6a['model']=_[_0x7c82('0x29')](db['MailMessage'][_0x7c82('0x1e')]);_0x4c0f6a['query']=_['keys'](_0x2bce13[_0x7c82('0x22')]);_0x4c0f6a['filters']=_['intersection'](_0x4c0f6a[_0x7c82('0x27')],_0x4c0f6a[_0x7c82('0x22')]);_0x445fab[_0x7c82('0x2c')]=_['intersection'](_0x4c0f6a[_0x7c82('0x27')],qs[_0x7c82('0x2d')](_0x2bce13['query'][_0x7c82('0x2d')]));_0x445fab[_0x7c82('0x2c')]=_0x445fab['attributes']['length']?_0x445fab[_0x7c82('0x2c')]:_0x4c0f6a[_0x7c82('0x27')];if(!_0x2bce13[_0x7c82('0x22')][_0x7c82('0x3b')](_0x7c82('0x3c'))){_0x445fab['limit']=qs['limit'](_0x2bce13['query']['limit']);_0x445fab['offset']=qs[_0x7c82('0x15')](_0x2bce13['query'][_0x7c82('0x15')]);}_0x445fab[_0x7c82('0x3d')]=qs[_0x7c82('0x3e')](_0x2bce13[_0x7c82('0x22')][_0x7c82('0x3e')]);_0x445fab[_0x7c82('0x3f')]=qs[_0x7c82('0x2a')](_['pick'](_0x2bce13[_0x7c82('0x22')],_0x4c0f6a[_0x7c82('0x2a')]));_0x445fab[_0x7c82('0x3f')][_0x7c82('0x40')]=_0x2cc5c2['id'];if(_0x2bce13[_0x7c82('0x22')][_0x7c82('0x41')]){_0x445fab['where']=_[_0x7c82('0x30')](_0x445fab[_0x7c82('0x3f')],{'$or':_[_0x7c82('0x42')](_0x445fab[_0x7c82('0x2c')],function(_0x40eb7d){var _0x24fa9c={};_0x24fa9c[_0x40eb7d]={'$like':'%'+_0x2bce13[_0x7c82('0x22')]['filter']+'%'};return _0x24fa9c;})});}if(_0x2bce13[_0x7c82('0x22')][_0x7c82('0x43')]){var _0x2c5894=_0x2bce13[_0x7c82('0x22')][_0x7c82('0x43')]['split'](',');var _0x51d6bd={};_0x51d6bd[_0x2c5894[0x0]]={'$gte':moment(_0x2c5894[0x1])[_0x7c82('0x44')](_0x7c82('0x45'))};_0x445fab[_0x7c82('0x3f')]=_[_0x7c82('0x30')](_0x445fab[_0x7c82('0x3f')],_0x51d6bd);}_0x445fab=_[_0x7c82('0x30')]({},_0x445fab,_0x2bce13[_0x7c82('0x46')]);return db['MailMessage'][_0x7c82('0x14')]({'where':_0x445fab['where']})['then'](function(_0x51da9f){_0x4108a5[_0x7c82('0x14')]=_0x51da9f;if(_0x2bce13[_0x7c82('0x22')][_0x7c82('0x2f')]){_0x445fab[_0x7c82('0x47')]=[{'all':!![]}];}return db[_0x7c82('0x36')][_0x7c82('0x48')](_0x445fab);})[_0x7c82('0x19')](function(_0x292212){if(_0x2bce13[_0x7c82('0x22')][_0x7c82('0x49')]==='true'){for(var _0x41d31b=0x0;_0x41d31b<_0x292212[_0x7c82('0x2e')];_0x41d31b++){_0x292212[_0x41d31b][_0x7c82('0x32')]=juice(_0x292212[_0x41d31b][_0x7c82('0x32')]);}}_0x4108a5[_0x7c82('0x4a')]=_0x292212;return _0x4108a5;});}})['then'](respondWithFilteredResult(_0x29d53d,_0x445fab))['catch'](handleError(_0x29d53d,null));};exports[_0x7c82('0x4b')]=function(_0x51ae36,_0x2ca52f){return db[_0x7c82('0x28')][_0x7c82('0x33')]({'where':{'id':_0x51ae36[_0x7c82('0x26')]['id']}})[_0x7c82('0x19')](handleEntityNotFound(_0x2ca52f,null))[_0x7c82('0x19')](function(_0x58b127){if(_0x58b127){return _0x58b127[_0x7c82('0x4c')](_0x51ae36[_0x7c82('0x32')][_0x7c82('0x37')],_[_0x7c82('0x38')](_0x51ae36[_0x7c82('0x32')],[_0x7c82('0x37'),'id'])||{})[_0x7c82('0x4d')](function(){return db[_0x7c82('0x4e')][_0x7c82('0x48')]({'attributes':['id','name',_0x7c82('0x4f')],'where':{'id':_0x51ae36[_0x7c82('0x32')][_0x7c82('0x37')]}});})['then'](function(_0x4e238f){socket[_0x7c82('0x50')](_0x7c82('0x51'),{'id':Number(_0x51ae36[_0x7c82('0x26')]['id']),'tags':_0x4e238f||[]});return{'id':Number(_0x51ae36['params']['id']),'tags':_0x4e238f||[]};});}})[_0x7c82('0x19')](respondWithResult(_0x2ca52f,null))[_0x7c82('0x24')](handleError(_0x2ca52f,null));};exports[_0x7c82('0x52')]=function(_0x2fb2f1,_0x4a00e4){return db[_0x7c82('0x28')]['find']({'where':{'id':_0x2fb2f1[_0x7c82('0x26')]['id']}})[_0x7c82('0x19')](handleEntityNotFound(_0x4a00e4,null))[_0x7c82('0x19')](function(_0x2bf3c4){if(_0x2bf3c4){return _0x2bf3c4['removeTags'](_0x2fb2f1['query'][_0x7c82('0x37')]);}})[_0x7c82('0x19')](respondWithStatusCode(_0x4a00e4,null))[_0x7c82('0x24')](handleError(_0x4a00e4,null));};exports[_0x7c82('0x53')]=function(_0x596e36,_0x1cd61e){var _0x38937e=moment()['unix']()[_0x7c82('0x54')]();var _0x3b2e74=path['join'](config[_0x7c82('0x55')],'server','files',_0x7c82('0x56'));var _0x1798bf=path['join'](config['root'],_0x7c82('0x57'),'files',_0x7c82('0x58'));var _0x9a0011=path[_0x7c82('0x59')](_0x3b2e74,_0x38937e);var _0x44a7c5=util[_0x7c82('0x44')]('transcript-%d-%s.zip',_0x596e36[_0x7c82('0x26')]['id'],_0x38937e);var _0x215c03=path['join'](_0x3b2e74,_0x44a7c5);var _0x30d74b=[];if(_0x596e36[_0x7c82('0x22')]['attachments']){_0x30d74b[_0x7c82('0x5a')]({'model':db['Attachment'],'as':_0x7c82('0x5b'),'raw':!![]});}var _0x41db81=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x7c82('0x32'),_0x7c82('0x5c'),'to','cc',_0x7c82('0x5d'),_0x7c82('0x5e'),'createdAt'],'where':{'secret':![]},'order':qs[_0x7c82('0x3e')]('id'),'include':_0x30d74b}];return db[_0x7c82('0x28')][_0x7c82('0x33')]({'where':{'id':_0x596e36[_0x7c82('0x26')]['id']},'include':_0x41db81})[_0x7c82('0x19')](handleEntityNotFound(_0x1cd61e,null))[_0x7c82('0x19')](function(_0x3c864b){if(_0x3c864b&&_0x3c864b[_0x7c82('0x5f')]){var _0x270deb=_0x3c864b[_0x7c82('0x60')]({'plain':!![]});fs['mkdirSync'](_0x9a0011);return BPromise[_0x7c82('0x61')](_0x270deb[_0x7c82('0x5f')],function(_0x1eb44e,_0x4d29cc){var _0x6b4f37={'from':_0x1eb44e['from'],'to':_0x1eb44e['to']||_0x7c82('0x62'),'subject':_0x1eb44e[_0x7c82('0x5e')],'html':htmlEntities['decode'](_0x1eb44e[_0x7c82('0x32')]),'headers':{'Date':moment(_0x1eb44e[_0x7c82('0x63')])['format'](_0x7c82('0x64'))},'attachments':[]};if(_0x1eb44e['cc']){_0x6b4f37['headers']['Cc']=_0x1eb44e['cc'];}if(_0x1eb44e['bcc']){_0x6b4f37[_0x7c82('0x65')][_0x7c82('0x66')]=_0x1eb44e['bcc'];}return new BPromise(function(_0xadaa85,_0x145d4b){if(_0x1eb44e[_0x7c82('0x5b')]){for(var _0x72bccd=0x0;_0x72bccd<_0x1eb44e[_0x7c82('0x5b')][_0x7c82('0x2e')];_0x72bccd++){var _0x371e37=_0x1eb44e[_0x7c82('0x5b')][_0x72bccd];var _0x1f0dae=path['join'](_0x1798bf,_0x371e37[_0x7c82('0x67')]);if(fs[_0x7c82('0x68')](_0x1f0dae)){_0x6b4f37[_0x7c82('0x58')][_0x7c82('0x5a')]({'name':_0x371e37[_0x7c82('0x1c')],'contentType':_0x371e37[_0x7c82('0x1f')],'data':fs[_0x7c82('0x69')](_0x1f0dae)});}}}emlformat['build'](_0x6b4f37,function(_0x3d6977,_0x529548){if(_0x3d6977)return _0x145d4b(_0x3d6977);fs[_0x7c82('0x6a')](path[_0x7c82('0x59')](_0x9a0011,util[_0x7c82('0x44')](_0x7c82('0x6b'),_0x4d29cc)),_0x529548);return _0xadaa85(_0x529548);});});})[_0x7c82('0x19')](function(){return new BPromise(function(_0x547f24,_0xaefc83){zipdir(_0x9a0011,{'saveTo':_0x215c03},function(_0x37869b,_0x30e04a){if(_0x37869b)return _0xaefc83(_0x37869b);return _0x547f24(_0x30e04a);});})[_0x7c82('0x19')](function(){return new BPromise(function(_0x4f2bc8,_0x51febd){rimraf(_0x9a0011,function(_0x40543e){if(_0x40543e)_0x51febd(_0x40543e);return _0x4f2bc8();});});})[_0x7c82('0x19')](function(){return _0x1cd61e[_0x7c82('0x53')](_0x215c03,_0x44a7c5,function(_0x4a0ee5){if(!_0x4a0ee5)fs[_0x7c82('0x6c')](_0x215c03);});});});}else{return _0x1cd61e[_0x7c82('0x10')](0xc8);}})[_0x7c82('0x24')](handleError(_0x1cd61e,null));}; \ No newline at end of file +var _0xb29a=['key','getOptions','findAll','mail','query','user','catch','params','keys','filters','intersection','model','attributes','fields','length','include','merge','options','find','create','body','describe','MailMessage','addMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','setTags','omit','spread','color','emit','mailInteractionTags:save','removeTags','download','toString','join','server','root','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type'];(function(_0x4caeab,_0x5177c9){var _0x1ed98d=function(_0x5d404d){while(--_0x5d404d){_0x4caeab['push'](_0x4caeab['shift']());}};_0x1ed98d(++_0x5177c9);}(_0xb29a,0x13a));var _0xab29=function(_0x265b25,_0x437f9c){_0x265b25=_0x265b25-0x0;var _0x4c9807=_0xb29a[_0x265b25];return _0x4c9807;};'use strict';var emlformat=require(_0xab29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab29('0x1'));var moment=require(_0xab29('0x2'));var BPromise=require(_0xab29('0x3'));var util=require(_0xab29('0x4'));var path=require(_0xab29('0x5'));var fs=require('fs');var _=require(_0xab29('0x6'));var juice=require(_0xab29('0x7'));var Redis=require(_0xab29('0x8'));var interaction=require(_0xab29('0x9'));var qs=require(_0xab29('0xa'));var logger=require(_0xab29('0xb'))(_0xab29('0xc'));var config=require(_0xab29('0xd'));var db=require(_0xab29('0xe'))['db'];var htmlEntities=require('html-entities');config[_0xab29('0xf')]=_[_0xab29('0x10')](config[_0xab29('0xf')],{'host':_0xab29('0x11'),'port':0x18eb});var socket=require(_0xab29('0x12'))(new Redis(config[_0xab29('0xf')]));require(_0xab29('0x13'))[_0xab29('0x14')](socket);function respondWithStatusCode(_0x48a93b,_0x54f4ba){_0x54f4ba=_0x54f4ba||0xcc;return function(_0x2ed06a){if(_0x2ed06a){return _0x48a93b[_0xab29('0x15')](_0x54f4ba);}return _0x48a93b[_0xab29('0x16')](_0x54f4ba)['end']();};}function respondWithResult(_0x287e0d,_0xfb570b){_0xfb570b=_0xfb570b||0xc8;return function(_0x37581b){if(_0x37581b){return _0x287e0d['status'](_0xfb570b)['json'](_0x37581b);}};}function respondWithFilteredResult(_0x4d7819,_0x5afe9e){return function(_0x433f5b){if(_0x433f5b){var _0x4094d9=typeof _0x5afe9e[_0xab29('0x17')]==='undefined'&&typeof _0x5afe9e[_0xab29('0x18')]===_0xab29('0x19');var _0x260110=_0x433f5b[_0xab29('0x1a')];var _0x1f6239=_0x4094d9?0x0:_0x5afe9e[_0xab29('0x17')];var _0x30eaa9=_0x4094d9?_0x433f5b['count']:_0x5afe9e[_0xab29('0x17')]+_0x5afe9e['limit'];var _0x83e14c;if(_0x30eaa9>=_0x260110){_0x30eaa9=_0x260110;_0x83e14c=0xc8;}else{_0x83e14c=0xce;}_0x4d7819['status'](_0x83e14c);return _0x4d7819[_0xab29('0x1b')](_0xab29('0x1c'),_0x1f6239+'-'+_0x30eaa9+'/'+_0x260110)['json'](_0x433f5b);}return null;};}function saveUpdates(_0x8d4e1c){return function(_0x5be690){if(_0x5be690){return _0x5be690[_0xab29('0x1d')](_0x8d4e1c)[_0xab29('0x1e')](function(_0x39a397){return _0x39a397;});}return null;};}function removeEntity(_0x1ba0ff){return function(_0x1e703c){if(_0x1e703c){return _0x1e703c[_0xab29('0x1f')]()[_0xab29('0x1e')](function(){_0x1ba0ff[_0xab29('0x16')](0xcc)[_0xab29('0x20')]();});}};}function handleEntityNotFound(_0x38dcaf){return function(_0x109dce){if(!_0x109dce){_0x38dcaf[_0xab29('0x15')](0x194);}return _0x109dce;};}function handleError(_0x20317a,_0x298c0b){_0x298c0b=_0x298c0b||0x1f4;return function(_0x62c0d9){logger[_0xab29('0x21')](_0x62c0d9[_0xab29('0x22')]);if(_0x62c0d9[_0xab29('0x23')]){delete _0x62c0d9[_0xab29('0x23')];}_0x20317a['status'](_0x298c0b)[_0xab29('0x24')](_0x62c0d9);};}exports[_0xab29('0x25')]=function(_0x218a7f,_0x2f5e43){var _0x38d89e={};var _0x424b6c=_[_0xab29('0x26')](db[_0xab29('0x27')][_0xab29('0x28')],function(_0x472ba9){return{'name':_0x472ba9[_0xab29('0x29')],'type':_0x472ba9[_0xab29('0x2a')][_0xab29('0x2b')]};});_0x38d89e=qs[_0xab29('0x2c')](_0x424b6c,_0x218a7f);return interaction[_0xab29('0x2d')](_0xab29('0x2e'),_0x218a7f[_0xab29('0x2f')],_0x218a7f[_0xab29('0x30')],_0x38d89e,_0x424b6c)[_0xab29('0x1e')](respondWithFilteredResult(_0x2f5e43,_0x38d89e))[_0xab29('0x31')](handleError(_0x2f5e43,null));};exports['show']=function(_0x43a930,_0x3b32f4){var _0x20da80={'raw':![],'where':{'id':_0x43a930[_0xab29('0x32')]['id']}},_0x486a54={};_0x486a54['model']=_[_0xab29('0x33')](db[_0xab29('0x27')][_0xab29('0x28')]);_0x486a54[_0xab29('0x2f')]=_[_0xab29('0x33')](_0x43a930[_0xab29('0x2f')]);_0x486a54[_0xab29('0x34')]=_[_0xab29('0x35')](_0x486a54[_0xab29('0x36')],_0x486a54[_0xab29('0x2f')]);_0x20da80[_0xab29('0x37')]=_['intersection'](_0x486a54[_0xab29('0x36')],qs['fields'](_0x43a930[_0xab29('0x2f')][_0xab29('0x38')]));_0x20da80[_0xab29('0x37')]=_0x20da80[_0xab29('0x37')][_0xab29('0x39')]?_0x20da80[_0xab29('0x37')]:_0x486a54[_0xab29('0x36')];if(_0x43a930['query']['includeAll']){_0x20da80[_0xab29('0x3a')]=[{'all':!![]}];}_0x20da80=_[_0xab29('0x3b')]({},_0x20da80,_0x43a930[_0xab29('0x3c')]);return db['MailInteraction'][_0xab29('0x3d')](_0x20da80)[_0xab29('0x1e')](handleEntityNotFound(_0x3b32f4,null))[_0xab29('0x1e')](respondWithResult(_0x3b32f4,null))[_0xab29('0x31')](handleError(_0x3b32f4,null));};exports[_0xab29('0x3e')]=function(_0x5ab7a3,_0xdd6e65){return db['MailInteraction'][_0xab29('0x3e')](_0x5ab7a3[_0xab29('0x3f')],{})['then'](respondWithResult(_0xdd6e65,0xc9))[_0xab29('0x31')](handleError(_0xdd6e65,null));};exports[_0xab29('0x1d')]=function(_0x46ef33,_0x1dd137){if(_0x46ef33[_0xab29('0x3f')]['id']){delete _0x46ef33[_0xab29('0x3f')]['id'];}return db[_0xab29('0x27')][_0xab29('0x3d')]({'where':{'id':_0x46ef33[_0xab29('0x32')]['id']}})[_0xab29('0x1e')](handleEntityNotFound(_0x1dd137,null))[_0xab29('0x1e')](saveUpdates(_0x46ef33['body'],null))[_0xab29('0x1e')](respondWithResult(_0x1dd137,null))['catch'](handleError(_0x1dd137,null));};exports[_0xab29('0x1f')]=function(_0x15c7ca,_0x595ee6){return db['MailInteraction'][_0xab29('0x3d')]({'where':{'id':_0x15c7ca[_0xab29('0x32')]['id']}})['then'](handleEntityNotFound(_0x595ee6,null))[_0xab29('0x1e')](removeEntity(_0x595ee6,null))[_0xab29('0x31')](handleError(_0x595ee6,null));};exports[_0xab29('0x40')]=function(_0x133651,_0x38d747){return db[_0xab29('0x27')]['describe']()['then'](respondWithResult(_0x38d747,null))['catch'](handleError(_0x38d747,null));};exports['addMessage']=function(_0x49ad2d,_0x3f7a1e){return db[_0xab29('0x41')]['find']({'where':{'id':_0x49ad2d['params']['id']}})['then'](handleEntityNotFound(_0x3f7a1e,null))[_0xab29('0x1e')](function(_0x591321){if(_0x591321){return _0x591321[_0xab29('0x42')](_0x49ad2d[_0xab29('0x3f')][_0xab29('0x43')],_['omit'](_0x49ad2d[_0xab29('0x3f')],['ids','id'])||{});}})[_0xab29('0x1e')](respondWithResult(_0x3f7a1e,null))[_0xab29('0x31')](handleError(_0x3f7a1e,null));};exports[_0xab29('0x44')]=function(_0x4bc13a,_0x10ad35){var _0x48e003={'raw':![],'where':{}};var _0x450a2b={};var _0xa898cb={'count':0x0,'rows':[]};return db[_0xab29('0x27')][_0xab29('0x45')]({'where':{'id':_0x4bc13a[_0xab29('0x32')]['id']}})['then'](handleEntityNotFound(_0x10ad35,null))['then'](function(_0x31a0f1){if(_0x31a0f1){_0x450a2b[_0xab29('0x36')]=_[_0xab29('0x33')](db[_0xab29('0x41')][_0xab29('0x28')]);_0x450a2b[_0xab29('0x2f')]=_[_0xab29('0x33')](_0x4bc13a[_0xab29('0x2f')]);_0x450a2b['filters']=_[_0xab29('0x35')](_0x450a2b[_0xab29('0x36')],_0x450a2b['query']);_0x48e003['attributes']=_[_0xab29('0x35')](_0x450a2b[_0xab29('0x36')],qs[_0xab29('0x38')](_0x4bc13a[_0xab29('0x2f')][_0xab29('0x38')]));_0x48e003[_0xab29('0x37')]=_0x48e003['attributes'][_0xab29('0x39')]?_0x48e003[_0xab29('0x37')]:_0x450a2b[_0xab29('0x36')];if(!_0x4bc13a[_0xab29('0x2f')]['hasOwnProperty'](_0xab29('0x46'))){_0x48e003['limit']=qs['limit'](_0x4bc13a[_0xab29('0x2f')][_0xab29('0x18')]);_0x48e003[_0xab29('0x17')]=qs[_0xab29('0x17')](_0x4bc13a[_0xab29('0x2f')]['offset']);}_0x48e003[_0xab29('0x47')]=qs['sort'](_0x4bc13a[_0xab29('0x2f')][_0xab29('0x48')]);_0x48e003[_0xab29('0x49')]=qs[_0xab29('0x34')](_[_0xab29('0x4a')](_0x4bc13a[_0xab29('0x2f')],_0x450a2b['filters']));_0x48e003[_0xab29('0x49')][_0xab29('0x4b')]=_0x31a0f1['id'];if(_0x4bc13a[_0xab29('0x2f')][_0xab29('0x4c')]){_0x48e003[_0xab29('0x49')]=_[_0xab29('0x3b')](_0x48e003[_0xab29('0x49')],{'$or':_['map'](_0x48e003[_0xab29('0x37')],function(_0x457f0e){var _0x14e1c8={};_0x14e1c8[_0x457f0e]={'$like':'%'+_0x4bc13a[_0xab29('0x2f')][_0xab29('0x4c')]+'%'};return _0x14e1c8;})});}if(_0x4bc13a['query'][_0xab29('0x4d')]){var _0x1b97ff=_0x4bc13a[_0xab29('0x2f')][_0xab29('0x4d')][_0xab29('0x4e')](',');var _0x7553a7={};_0x7553a7[_0x1b97ff[0x0]]={'$gte':moment(_0x1b97ff[0x1])[_0xab29('0x4f')](_0xab29('0x50'))};_0x48e003[_0xab29('0x49')]=_[_0xab29('0x3b')](_0x48e003[_0xab29('0x49')],_0x7553a7);}_0x48e003=_[_0xab29('0x3b')]({},_0x48e003,_0x4bc13a[_0xab29('0x3c')]);return db[_0xab29('0x41')][_0xab29('0x1a')]({'where':_0x48e003[_0xab29('0x49')]})[_0xab29('0x1e')](function(_0x46fe4b){_0xa898cb[_0xab29('0x1a')]=_0x46fe4b;if(_0x4bc13a[_0xab29('0x2f')][_0xab29('0x51')]){_0x48e003['include']=[{'all':!![]}];}return db['MailMessage'][_0xab29('0x2d')](_0x48e003);})['then'](function(_0x59e702){if(_0x4bc13a[_0xab29('0x2f')][_0xab29('0x52')]===_0xab29('0x53')){for(var _0x18e3e3=0x0;_0x18e3e3<_0x59e702[_0xab29('0x39')];_0x18e3e3++){_0x59e702[_0x18e3e3][_0xab29('0x3f')]=juice(_0x59e702[_0x18e3e3][_0xab29('0x3f')]);}}_0xa898cb['rows']=_0x59e702;return _0xa898cb;});}})[_0xab29('0x1e')](respondWithFilteredResult(_0x10ad35,_0x48e003))[_0xab29('0x31')](handleError(_0x10ad35,null));};exports['addTags']=function(_0x364d90,_0x3ddf1c){return db[_0xab29('0x27')][_0xab29('0x3d')]({'where':{'id':_0x364d90[_0xab29('0x32')]['id']}})[_0xab29('0x1e')](handleEntityNotFound(_0x3ddf1c,null))[_0xab29('0x1e')](function(_0x52eca6){if(_0x52eca6){return _0x52eca6[_0xab29('0x54')](_0x364d90[_0xab29('0x3f')][_0xab29('0x43')],_[_0xab29('0x55')](_0x364d90[_0xab29('0x3f')],[_0xab29('0x43'),'id'])||{})[_0xab29('0x56')](function(){return db['Tag'][_0xab29('0x2d')]({'attributes':['id',_0xab29('0x23'),_0xab29('0x57')],'where':{'id':_0x364d90[_0xab29('0x3f')][_0xab29('0x43')]}});})['then'](function(_0xa1e85e){socket[_0xab29('0x58')](_0xab29('0x59'),{'id':Number(_0x364d90[_0xab29('0x32')]['id']),'tags':_0xa1e85e||[]});return{'id':Number(_0x364d90[_0xab29('0x32')]['id']),'tags':_0xa1e85e||[]};});}})[_0xab29('0x1e')](respondWithResult(_0x3ddf1c,null))[_0xab29('0x31')](handleError(_0x3ddf1c,null));};exports[_0xab29('0x5a')]=function(_0x59206d,_0x1634b1){return db[_0xab29('0x27')][_0xab29('0x3d')]({'where':{'id':_0x59206d[_0xab29('0x32')]['id']}})[_0xab29('0x1e')](handleEntityNotFound(_0x1634b1,null))[_0xab29('0x1e')](function(_0x2af15a){if(_0x2af15a){return _0x2af15a[_0xab29('0x5a')](_0x59206d[_0xab29('0x2f')][_0xab29('0x43')]);}})[_0xab29('0x1e')](respondWithStatusCode(_0x1634b1,null))[_0xab29('0x31')](handleError(_0x1634b1,null));};exports[_0xab29('0x5b')]=function(_0x5d0b85,_0x983029){var _0x342004=moment()['unix']()[_0xab29('0x5c')]();var _0x4670a2=path[_0xab29('0x5d')](config['root'],_0xab29('0x5e'),'files','tmp');var _0x146c88=path[_0xab29('0x5d')](config[_0xab29('0x5f')],_0xab29('0x5e'),_0xab29('0x60'),_0xab29('0x61'));var _0x992dcc=path[_0xab29('0x5d')](_0x4670a2,_0x342004);var _0x11fed4=util[_0xab29('0x4f')](_0xab29('0x62'),_0x5d0b85[_0xab29('0x32')]['id'],_0x342004);var _0x49a34c=path['join'](_0x4670a2,_0x11fed4);var _0x57b118=[];if(_0x5d0b85[_0xab29('0x2f')][_0xab29('0x61')]){_0x57b118[_0xab29('0x63')]({'model':db[_0xab29('0x64')],'as':'Attachments','raw':!![]});}var _0x395ee3=[{'model':db['MailMessage'],'as':_0xab29('0x65'),'attributes':['id','body',_0xab29('0x66'),'to','cc','bcc',_0xab29('0x67'),_0xab29('0x68')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b118}];return db['MailInteraction'][_0xab29('0x3d')]({'where':{'id':_0x5d0b85['params']['id']},'include':_0x395ee3})[_0xab29('0x1e')](handleEntityNotFound(_0x983029,null))['then'](function(_0x594d6d){if(_0x594d6d&&_0x594d6d[_0xab29('0x65')]){var _0x3b32ae=_0x594d6d[_0xab29('0x69')]({'plain':!![]});fs[_0xab29('0x6a')](_0x992dcc);return BPromise['each'](_0x3b32ae[_0xab29('0x65')],function(_0x272cb1,_0x243c7f){var _0x2c0940={'from':_0x272cb1['from'],'to':_0x272cb1['to']||_0xab29('0x6b'),'subject':_0x272cb1[_0xab29('0x67')],'html':htmlEntities[_0xab29('0x6c')](_0x272cb1[_0xab29('0x3f')]),'headers':{'Date':moment(_0x272cb1[_0xab29('0x68')])[_0xab29('0x4f')](_0xab29('0x6d'))},'attachments':[]};if(_0x272cb1['cc']){_0x2c0940['headers']['Cc']=_0x272cb1['cc'];}if(_0x272cb1[_0xab29('0x6e')]){_0x2c0940['headers'][_0xab29('0x6f')]=_0x272cb1[_0xab29('0x6e')];}return new BPromise(function(_0x31c026,_0x10acf1){if(_0x272cb1[_0xab29('0x70')]){for(var _0x3815a3=0x0;_0x3815a3<_0x272cb1[_0xab29('0x70')][_0xab29('0x39')];_0x3815a3++){var _0x8a6a5c=_0x272cb1[_0xab29('0x70')][_0x3815a3];var _0x4512e8=path['join'](_0x146c88,_0x8a6a5c[_0xab29('0x71')]);if(fs[_0xab29('0x72')](_0x4512e8)){_0x2c0940[_0xab29('0x61')]['push']({'name':_0x8a6a5c['name'],'contentType':_0x8a6a5c[_0xab29('0x2a')],'data':fs[_0xab29('0x73')](_0x4512e8)});}}}emlformat[_0xab29('0x74')](_0x2c0940,function(_0x255183,_0x3b1e1b){if(_0x255183)return _0x10acf1(_0x255183);fs['writeFileSync'](path[_0xab29('0x5d')](_0x992dcc,util[_0xab29('0x4f')](_0xab29('0x75'),_0x243c7f)),_0x3b1e1b);return _0x31c026(_0x3b1e1b);});});})[_0xab29('0x1e')](function(){return new BPromise(function(_0x256e94,_0x4e4aaa){zipdir(_0x992dcc,{'saveTo':_0x49a34c},function(_0x36e8a8,_0x2365b7){if(_0x36e8a8)return _0x4e4aaa(_0x36e8a8);return _0x256e94(_0x2365b7);});})[_0xab29('0x1e')](function(){return new BPromise(function(_0x5a5fe1,_0x222e88){rimraf(_0x992dcc,function(_0x280afa){if(_0x280afa)_0x222e88(_0x280afa);return _0x5a5fe1();});});})[_0xab29('0x1e')](function(){return _0x983029['download'](_0x49a34c,_0x11fed4,function(_0x1599ac){if(!_0x1599ac)fs[_0xab29('0x76')](_0x49a34c);});});});}else{return _0x983029[_0xab29('0x15')](0xc8);}})['catch'](handleError(_0x983029,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2462847..9d144f6 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 _0xb892=['Users','map','findAll','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xb892,0x15f));var _0x2b89=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xb892[_0x4a747d];return _0x3a5b5c;};'use strict';var EventEmitter=require(_0x2b89('0x0'));var MailInteraction=require(_0x2b89('0x1'))['db'][_0x2b89('0x2')];var MailMessage=require(_0x2b89('0x1'))['db'][_0x2b89('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2b89('0x4')](0x0);var events={'afterCreate':_0x2b89('0x5'),'afterUpdate':_0x2b89('0x6'),'afterDestroy':_0x2b89('0x7')};function emitEvent(_0x2cb5e2){return function(_0x4c0215,_0x28dddf,_0x1d7970){_0x4c0215[_0x2b89('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2483b6){_0x4c0215[_0x2b89('0x9')](_0x2b89('0xa'),_0x2483b6[_0x2b89('0xb')](function(_0x56fbcd){return{'id':_0x56fbcd['id']};}));return MailMessage[_0x2b89('0xc')]({'where':{'MailInteractionId':_0x4c0215['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2b89('0xd')](function(_0x1a6111){_0x4c0215['setDataValue']('unreadMessages',_0x1a6111[_0x2b89('0xe')]);MailInteractionEvents[_0x2b89('0xf')](_0x2cb5e2+':'+_0x4c0215['id'],_0x4c0215);MailInteractionEvents[_0x2b89('0xf')](_0x2cb5e2,_0x4c0215);_0x1d7970(null);})['catch'](_0x1d7970(null));};}for(var e in events){if(events[_0x2b89('0x10')](e)){var event=events[e];MailInteraction[_0x2b89('0x11')](e,emitEvent(event));}}module[_0x2b89('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x587c=['remove','getUsers','then','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x587c,0xc0));var _0xc587=function(_0x217dee,_0xbde5bf){_0x217dee=_0x217dee-0x0;var _0x23ddb0=_0x587c[_0x217dee];return _0x23ddb0;};'use strict';var EventEmitter=require(_0xc587('0x0'));var MailInteraction=require(_0xc587('0x1'))['db'][_0xc587('0x2')];var MailMessage=require(_0xc587('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc587('0x3')](0x0);var events={'afterCreate':_0xc587('0x4'),'afterUpdate':_0xc587('0x5'),'afterDestroy':_0xc587('0x6')};function emitEvent(_0x32cdce){return function(_0x1855a,_0x472404,_0x52afe3){_0x1855a[_0xc587('0x7')]({'attributes':['id'],'raw':!![]})[_0xc587('0x8')](function(_0x263719){_0x1855a['setDataValue'](_0xc587('0x9'),_0x263719[_0xc587('0xa')](function(_0x16eeaf){return{'id':_0x16eeaf['id']};}));return MailMessage[_0xc587('0xb')]({'where':{'MailInteractionId':_0x1855a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc587('0x8')](function(_0xb9a948){_0x1855a['setDataValue'](_0xc587('0xc'),_0xb9a948[_0xc587('0xd')]);MailInteractionEvents[_0xc587('0xe')](_0x32cdce+':'+_0x1855a['id'],_0x1855a);MailInteractionEvents[_0xc587('0xe')](_0x32cdce,_0x1855a);_0x52afe3(null);})['catch'](_0x52afe3(null));};}for(var e in events){if(events[_0xc587('0xf')](e)){var event=events[e];MailInteraction[_0xc587('0x10')](e,emitEvent(event));}}module[_0xc587('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1d48a0b..990fc97 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 _0x041d=['bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatusAt','models','get','MailMessage','update','then','util','../../config/logger','api'];(function(_0x409817,_0x39116e){var _0x388048=function(_0x200331){while(--_0x200331){_0x409817['push'](_0x409817['shift']());}};_0x388048(++_0x39116e);}(_0x041d,0x1bf));var _0xd041=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x041d[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0xd041('0x0'));var logger=require(_0xd041('0x1'))(_0xd041('0x2'));var moment=require('moment');var BPromise=require(_0xd041('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd041('0x4'));var rimraf=require(_0xd041('0x5'));var config=require(_0xd041('0x6'));var attributes=require(_0xd041('0x7'));module[_0xd041('0x8')]=function(_0x5783a9,_0x9bf78c){return _0x5783a9[_0xd041('0x9')]('MailInteraction',attributes,{'tableName':_0xd041('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xd041('0xb'),'to'],'type':_0xd041('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a22c0,_0x8614e5,_0x1cb229){if(_0x2a22c0[_0xd041('0xd')]){_0x2a22c0['substatusAt']=moment()['format'](_0xd041('0xe'));}if(_0x2a22c0[_0xd041('0xf')]){_0x2a22c0[_0xd041('0x10')]=moment()[_0xd041('0x11')](_0xd041('0xe'));}_0x1cb229(null,_0x8614e5);},'beforeUpdate':function(_0xf1e654,_0x57359b,_0x1a3afe){if(_0xf1e654[_0xd041('0x12')](_0xd041('0xd'))){_0xf1e654[_0xd041('0x13')]=_0xf1e654[_0xd041('0xd')]?moment()[_0xd041('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xf1e654['changed']('closed')){_0xf1e654[_0xd041('0x10')]=moment()[_0xd041('0x11')](_0xd041('0xe'));_0xf1e654[_0xd041('0xd')]=null;_0xf1e654[_0xd041('0x13')]=null;}_0x1a3afe(null,_0xf1e654);},'afterUpdate':function(_0x354c0e,_0x56a2f2,_0xc5674c){var _0x4beddb=_0x5783a9[_0xd041('0x14')];var _0x267628=_0x354c0e[_0xd041('0x15')]({'plain':!![]});if(_0x267628[_0xd041('0xf')]){return _0x4beddb[_0xd041('0x16')][_0xd041('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x267628['id']}})[_0xd041('0x18')](function(){_0xc5674c();})['catch'](function(_0x40f026){_0xc5674c(_0x40f026);});}else{_0xc5674c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcfba=['changed','format','substatus','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x29373e,_0x1c02e3){var _0x123599=function(_0x54afca){while(--_0x54afca){_0x29373e['push'](_0x29373e['shift']());}};_0x123599(++_0x1c02e3);}(_0xcfba,0xb8));var _0xacfb=function(_0x30ce07,_0x1d28b7){_0x30ce07=_0x30ce07-0x0;var _0x2ac4b1=_0xcfba[_0x30ce07];return _0x2ac4b1;};'use strict';var _=require('lodash');var util=require(_0xacfb('0x0'));var logger=require(_0xacfb('0x1'))(_0xacfb('0x2'));var moment=require(_0xacfb('0x3'));var BPromise=require(_0xacfb('0x4'));var rp=require(_0xacfb('0x5'));var fs=require('fs');var path=require(_0xacfb('0x6'));var rimraf=require(_0xacfb('0x7'));var config=require(_0xacfb('0x8'));var attributes=require(_0xacfb('0x9'));module['exports']=function(_0x5386f0,_0x2b7e13){return _0x5386f0[_0xacfb('0xa')](_0xacfb('0xb'),attributes,{'tableName':_0xacfb('0xc'),'paranoid':![],'indexes':[{'name':_0xacfb('0xd'),'fields':[_0xacfb('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x201aad,_0x174f65,_0x488bf9){if(_0x201aad['substatus']){_0x201aad[_0xacfb('0xf')]=moment()['format'](_0xacfb('0x10'));}if(_0x201aad[_0xacfb('0x11')]){_0x201aad[_0xacfb('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x488bf9(null,_0x174f65);},'beforeUpdate':function(_0x1d4649,_0x2cc188,_0x2e1273){if(_0x1d4649[_0xacfb('0x13')]('substatus')){_0x1d4649[_0xacfb('0xf')]=_0x1d4649['substatus']?moment()[_0xacfb('0x14')](_0xacfb('0x10')):null;}if(_0x1d4649[_0xacfb('0x13')](_0xacfb('0x11'))){_0x1d4649[_0xacfb('0x12')]=moment()[_0xacfb('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d4649[_0xacfb('0x15')]=null;_0x1d4649[_0xacfb('0xf')]=null;}_0x2e1273(null,_0x1d4649);},'afterUpdate':function(_0x414204,_0x222304,_0x5ca046){var _0x352078=_0x5386f0[_0xacfb('0x16')];var _0x5ed01b=_0x414204[_0xacfb('0x17')]({'plain':!![]});if(_0x5ed01b[_0xacfb('0x11')]){return _0x352078[_0xacfb('0x18')][_0xacfb('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5ed01b['id']}})[_0xacfb('0x1a')](function(){_0x5ca046();})['catch'](function(_0x17604d){_0x5ca046(_0x17604d);});}else{_0x5ca046();}}},'charset':_0xacfb('0x1b'),'collate':_0xacfb('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 40933dd..8285fbd 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 _0x6ec2=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailInteraction','update','body','options','raw','where','attributes','UpdateMailInteraction','debug','catch','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x417dd8,_0x93f4f7){var _0x184956=function(_0x54bdcd){while(--_0x54bdcd){_0x417dd8['push'](_0x417dd8['shift']());}};_0x184956(++_0x93f4f7);}(_0x6ec2,0x78));var _0x26ec=function(_0x464121,_0x39c954){_0x464121=_0x464121-0x0;var _0x1d0cb8=_0x6ec2[_0x464121];return _0x1d0cb8;};'use strict';var _=require(_0x26ec('0x0'));var util=require(_0x26ec('0x1'));var moment=require(_0x26ec('0x2'));var BPromise=require(_0x26ec('0x3'));var rs=require(_0x26ec('0x4'));var fs=require('fs');var Redis=require(_0x26ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x26ec('0x6'));var logger=require(_0x26ec('0x7'))(_0x26ec('0x8'));var config=require(_0x26ec('0x9'));var jayson=require(_0x26ec('0xa'));var client=jayson['client'][_0x26ec('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x26ec('0xc')],{'host':_0x26ec('0xd'),'port':0x18eb});var socket=require(_0x26ec('0xe'))(new Redis(config['redis']));require(_0x26ec('0xf'))['register'](socket);function respondWithRpcPromise(_0x143d9f,_0x23b140,_0x26f0a6){return new BPromise(function(_0xef0a42,_0x3b2efe){return client[_0x26ec('0x10')](_0x143d9f,_0x26f0a6)[_0x26ec('0x11')](function(_0x1a8f40){logger[_0x26ec('0x12')](_0x26ec('0x13'),_0x23b140,'request\x20sent');logger['debug'](_0x26ec('0x14'),_0x23b140,_0x26ec('0x15'),JSON[_0x26ec('0x16')](_0x1a8f40));if(_0x1a8f40[_0x26ec('0x17')]){if(_0x1a8f40[_0x26ec('0x17')][_0x26ec('0x18')]===0x1f4){logger[_0x26ec('0x17')]('MailInteraction,\x20%s,\x20%s',_0x23b140,_0x1a8f40[_0x26ec('0x17')][_0x26ec('0x19')]);return _0x3b2efe(_0x1a8f40[_0x26ec('0x17')][_0x26ec('0x19')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x23b140,_0x1a8f40[_0x26ec('0x17')][_0x26ec('0x19')]);return _0xef0a42(_0x1a8f40[_0x26ec('0x17')][_0x26ec('0x19')]);}else{logger['info'](_0x26ec('0x13'),_0x23b140,_0x26ec('0x15'));_0xef0a42(_0x1a8f40['result']['message']);}})['catch'](function(_0x21c3ff){logger[_0x26ec('0x17')](_0x26ec('0x13'),_0x23b140,_0x21c3ff);_0x3b2efe(_0x21c3ff);});});}exports['UpdateMailInteraction']=function(_0x4ad50c){var _0x289978=this;return new Promise(function(_0x125fca,_0x33a28b){return db[_0x26ec('0x1a')][_0x26ec('0x1b')](_0x4ad50c[_0x26ec('0x1c')],{'raw':_0x4ad50c['options']?_0x4ad50c[_0x26ec('0x1d')][_0x26ec('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ad50c[_0x26ec('0x1d')]?_0x4ad50c[_0x26ec('0x1d')][_0x26ec('0x1f')]||null:null,'attributes':_0x4ad50c['options']?_0x4ad50c['options'][_0x26ec('0x20')]||null:null,'limit':_0x4ad50c[_0x26ec('0x1d')]?_0x4ad50c[_0x26ec('0x1d')]['limit']||null:null})['then'](function(_0x19cadf){logger[_0x26ec('0x12')](_0x26ec('0x21'),_0x4ad50c);logger[_0x26ec('0x22')](_0x26ec('0x21'),_0x4ad50c,JSON[_0x26ec('0x16')](_0x19cadf));_0x125fca(_0x19cadf);})[_0x26ec('0x23')](function(_0x4e9cf8){logger['error']('UpdateMailInteraction',_0x4e9cf8[_0x26ec('0x19')],_0x4ad50c);_0x33a28b(_0x289978[_0x26ec('0x17')](0x1f4,_0x4e9cf8[_0x26ec('0x19')]));});});};exports[_0x26ec('0x24')]=function(_0x19e0fc){return new Promise(function(_0x2fb176,_0x3268e9){return db['MailInteraction'][_0x26ec('0x25')]({'where':_0x19e0fc['options']?_0x19e0fc[_0x26ec('0x1d')][_0x26ec('0x1f')]||null:null})['then'](function(_0x60c16d){if(_0x60c16d){return _0x60c16d[_0x26ec('0x26')](_0x19e0fc[_0x26ec('0x1c')][_0x26ec('0x27')],_[_0x26ec('0x28')](_0x19e0fc[_0x26ec('0x1c')],['ids','id'])||{});}})[_0x26ec('0x29')](function(_0x583c51){logger[_0x26ec('0x12')]('AddTags',_0x19e0fc);logger[_0x26ec('0x22')](_0x26ec('0x2a'),_0x19e0fc,JSON['stringify'](_0x583c51));_0x2fb176(_0x583c51);})[_0x26ec('0x23')](function(_0x13c4c3){logger[_0x26ec('0x17')](_0x26ec('0x2a'),_0x13c4c3[_0x26ec('0x19')],_0x19e0fc);_0x3268e9(_this[_0x26ec('0x17')](0x1f4,_0x13c4c3['message']));});});}; \ No newline at end of file +var _0x2afe=['then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','addTags','omit','ids','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request'];(function(_0x65eb6a,_0x413dca){var _0x2a333e=function(_0x319de2){while(--_0x319de2){_0x65eb6a['push'](_0x65eb6a['shift']());}};_0x2a333e(++_0x413dca);}(_0x2afe,0xbb));var _0xe2af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2afe[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe2af('0x0'));var util=require('util');var moment=require(_0xe2af('0x1'));var BPromise=require(_0xe2af('0x2'));var rs=require(_0xe2af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2af('0x4'))['db'];var utils=require(_0xe2af('0x5'));var logger=require(_0xe2af('0x6'))(_0xe2af('0x7'));var config=require(_0xe2af('0x8'));var jayson=require(_0xe2af('0x9'));var client=jayson[_0xe2af('0xa')][_0xe2af('0xb')]({'port':0x232a});config[_0xe2af('0xc')]=_[_0xe2af('0xd')](config[_0xe2af('0xc')],{'host':_0xe2af('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2af('0xc')]));require(_0xe2af('0xf'))[_0xe2af('0x10')](socket);function respondWithRpcPromise(_0x3eb026,_0x164cdb,_0x45f8bb){return new BPromise(function(_0x2a7ec5,_0x673fcb){return client[_0xe2af('0x11')](_0x3eb026,_0x45f8bb)[_0xe2af('0x12')](function(_0x30e839){logger['info'](_0xe2af('0x13'),_0x164cdb,'request\x20sent');logger[_0xe2af('0x14')](_0xe2af('0x15'),_0x164cdb,'request\x20sent',JSON['stringify'](_0x30e839));if(_0x30e839['error']){if(_0x30e839['error']['code']===0x1f4){logger[_0xe2af('0x16')](_0xe2af('0x13'),_0x164cdb,_0x30e839['error'][_0xe2af('0x17')]);return _0x673fcb(_0x30e839[_0xe2af('0x16')][_0xe2af('0x17')]);}logger[_0xe2af('0x16')](_0xe2af('0x13'),_0x164cdb,_0x30e839['error']['message']);return _0x2a7ec5(_0x30e839[_0xe2af('0x16')][_0xe2af('0x17')]);}else{logger[_0xe2af('0x18')](_0xe2af('0x13'),_0x164cdb,_0xe2af('0x19'));_0x2a7ec5(_0x30e839['result'][_0xe2af('0x17')]);}})[_0xe2af('0x1a')](function(_0x4076fc){logger[_0xe2af('0x16')]('MailInteraction,\x20%s,\x20%s',_0x164cdb,_0x4076fc);_0x673fcb(_0x4076fc);});});}exports[_0xe2af('0x1b')]=function(_0x135df4){var _0x30c0a4=this;return new Promise(function(_0x3980f9,_0x4bd2e5){return db[_0xe2af('0x1c')]['update'](_0x135df4[_0xe2af('0x1d')],{'raw':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x20')]||null:null,'attributes':_0x135df4[_0xe2af('0x1e')]?_0x135df4['options'][_0xe2af('0x21')]||null:null,'limit':_0x135df4[_0xe2af('0x1e')]?_0x135df4[_0xe2af('0x1e')][_0xe2af('0x22')]||null:null})[_0xe2af('0x12')](function(_0x732f88){logger[_0xe2af('0x18')]('UpdateMailInteraction',_0x135df4);logger[_0xe2af('0x14')](_0xe2af('0x1b'),_0x135df4,JSON[_0xe2af('0x23')](_0x732f88));_0x3980f9(_0x732f88);})[_0xe2af('0x1a')](function(_0x4b0000){logger['error'](_0xe2af('0x1b'),_0x4b0000[_0xe2af('0x17')],_0x135df4);_0x4bd2e5(_0x30c0a4[_0xe2af('0x16')](0x1f4,_0x4b0000[_0xe2af('0x17')]));});});};exports[_0xe2af('0x24')]=function(_0x4a744a){return new Promise(function(_0x5857e9,_0x541e42){return db[_0xe2af('0x1c')]['find']({'where':_0x4a744a['options']?_0x4a744a[_0xe2af('0x1e')][_0xe2af('0x20')]||null:null})[_0xe2af('0x12')](function(_0x3921ff){if(_0x3921ff){return _0x3921ff[_0xe2af('0x25')](_0x4a744a['body']['ids'],_[_0xe2af('0x26')](_0x4a744a['body'],[_0xe2af('0x27'),'id'])||{});}})['spread'](function(_0x18455e){logger[_0xe2af('0x18')]('AddTags',_0x4a744a);logger[_0xe2af('0x14')](_0xe2af('0x28'),_0x4a744a,JSON[_0xe2af('0x23')](_0x18455e));_0x5857e9(_0x18455e);})[_0xe2af('0x1a')](function(_0x28fcfd){logger[_0xe2af('0x16')](_0xe2af('0x28'),_0x28fcfd[_0xe2af('0x17')],_0x4a744a);_0x541e42(_this[_0xe2af('0x16')](0x1f4,_0x28fcfd[_0xe2af('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0818f22..0bf640d 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 _0xcb8f=['remove','removeListener','mailInteraction:','./mailInteraction.events','save'];(function(_0x560dfe,_0x3a6c65){var _0x5ccd77=function(_0x8defc5){while(--_0x8defc5){_0x560dfe['push'](_0x560dfe['shift']());}};_0x5ccd77(++_0x3a6c65);}(_0xcb8f,0x189));var _0xfcb8=function(_0x130e1a,_0x447340){_0x130e1a=_0x130e1a-0x0;var _0x3617fb=_0xcb8f[_0x130e1a];return _0x3617fb;};'use strict';var MailInteractionEvents=require(_0xfcb8('0x0'));var events=[_0xfcb8('0x1'),_0xfcb8('0x2'),'update'];function createListener(_0x134251,_0x28b164){return function(_0x582e01){_0x28b164['emit'](_0x134251,_0x582e01);};}function removeListener(_0x260dcd,_0x338dec){return function(){MailInteractionEvents[_0xfcb8('0x3')](_0x260dcd,_0x338dec);};}exports['register']=function(_0x2b6671){for(var _0x1bb3fa=0x0,_0x49e233=events['length'];_0x1bb3fa<_0x49e233;_0x1bb3fa++){var _0x232e42=events[_0x1bb3fa];var _0x32e791=createListener(_0xfcb8('0x4')+_0x232e42,_0x2b6671);MailInteractionEvents['on'](_0x232e42,_0x32e791);}}; \ No newline at end of file +var _0x2051=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x2ea70e,_0x5bdf2c){var _0x995523=function(_0x3b0d0f){while(--_0x3b0d0f){_0x2ea70e['push'](_0x2ea70e['shift']());}};_0x995523(++_0x5bdf2c);}(_0x2051,0x1ec));var _0x1205=function(_0x530bb2,_0x40e366){_0x530bb2=_0x530bb2-0x0;var _0x1f0e31=_0x2051[_0x530bb2];return _0x1f0e31;};'use strict';var MailInteractionEvents=require(_0x1205('0x0'));var events=[_0x1205('0x1'),_0x1205('0x2'),_0x1205('0x3')];function createListener(_0x406e2d,_0x54725e){return function(_0x583640){_0x54725e[_0x1205('0x4')](_0x406e2d,_0x583640);};}function removeListener(_0x3b382e,_0x14ea1d){return function(){MailInteractionEvents[_0x1205('0x5')](_0x3b382e,_0x14ea1d);};}exports[_0x1205('0x6')]=function(_0x31e87f){for(var _0x5cdbbf=0x0,_0x605298=events[_0x1205('0x7')];_0x5cdbbf<_0x605298;_0x5cdbbf++){var _0x4115aa=events[_0x5cdbbf];var _0x28e170=createListener(_0x1205('0x8')+_0x4115aa,_0x31e87f);MailInteractionEvents['on'](_0x4115aa,_0x28e170);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index c77a222..2a9b2b5 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8200=['express','Router','../../components/auth/service','get','/describe','isAuthenticated','exports'];(function(_0x4597a7,_0x5da925){var _0x52cd16=function(_0x58a526){while(--_0x58a526){_0x4597a7['push'](_0x4597a7['shift']());}};_0x52cd16(++_0x5da925);}(_0x8200,0x11f));var _0x0820=function(_0x4984e3,_0x5a7079){_0x4984e3=_0x4984e3-0x0;var _0x339196=_0x8200[_0x4984e3];return _0x339196;};'use strict';var express=require(_0x0820('0x0'));var router=express[_0x0820('0x1')]();var auth=require(_0x0820('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x0820('0x3')](_0x0820('0x4'),auth[_0x0820('0x5')](),controller['describe']);module[_0x0820('0x6')]=router; \ No newline at end of file +var _0x8a25=['describe','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe'];(function(_0x3899af,_0x4fdacb){var _0x28a4f7=function(_0x255d4f){while(--_0x255d4f){_0x3899af['push'](_0x3899af['shift']());}};_0x28a4f7(++_0x4fdacb);}(_0x8a25,0xb7));var _0x58a2=function(_0x5bc9ff,_0x168be3){_0x5bc9ff=_0x5bc9ff-0x0;var _0x10c9ea=_0x8a25[_0x5bc9ff];return _0x10c9ea;};'use strict';var express=require(_0x58a2('0x0'));var router=express[_0x58a2('0x1')]();var auth=require(_0x58a2('0x2'));var controller=require(_0x58a2('0x3'));router[_0x58a2('0x4')](_0x58a2('0x5'),auth['isAuthenticated'](),controller[_0x58a2('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 71967ac..4dd608a 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4797bc,_0x1b5c8b){var _0x4327dc=function(_0x4e2052){while(--_0x4e2052){_0x4797bc['push'](_0x4797bc['shift']());}};_0x4327dc(++_0x1b5c8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x4fbcdc,_0x17ff99){var _0x5e5ab0=function(_0x3713e4){while(--_0x3713e4){_0x4fbcdc['push'](_0x4fbcdc['shift']());}};_0x5e5ab0(++_0x17ff99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index bc6a09d..a78585f 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd271=['exports','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd271,0xc5));var _0x1d27=function(_0x2f63c0,_0x497f7f){_0x2f63c0=_0x2f63c0-0x0;var _0x156c7e=_0xd271[_0x2f63c0];return _0x156c7e;};'use strict';var Sequelize=require(_0x1d27('0x0'));module[_0x1d27('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x0ba6=['exports','INTEGER','sequelize'];(function(_0x45e7d2,_0x150368){var _0x4b48ce=function(_0x1ad188){while(--_0x1ad188){_0x45e7d2['push'](_0x45e7d2['shift']());}};_0x4b48ce(++_0x150368);}(_0x0ba6,0xd1));var _0x60ba=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x0ba6[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x60ba('0x0'));module[_0x60ba('0x1')]={'MailInteractionId':{'type':Sequelize[_0x60ba('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x60ba('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 4ea6e9f..e4636cc 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65df=['./mailInteractionHasTag','define','MailInteractionHasTag'];(function(_0x10244a,_0x3e96f4){var _0x4daacd=function(_0x3ef358){while(--_0x3ef358){_0x10244a['push'](_0x10244a['shift']());}};_0x4daacd(++_0x3e96f4);}(_0x65df,0x9c));var _0xf65d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x65df[_0x56482c];return _0x5aae7a;};'use strict';var attributes=require(_0xf65d('0x0'));module['exports']=function(_0xa023b4){return _0xa023b4[_0xf65d('0x1')](_0xf65d('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3650=['mail_interaction_has_tags','./mailInteractionHasTag','exports','MailInteractionHasTag'];(function(_0x6d1c65,_0x22df6e){var _0x1e96b4=function(_0xc1aac4){while(--_0xc1aac4){_0x6d1c65['push'](_0x6d1c65['shift']());}};_0x1e96b4(++_0x22df6e);}(_0x3650,0x1d1));var _0x0365=function(_0x2a4af6,_0x242a55){_0x2a4af6=_0x2a4af6-0x0;var _0x3f8898=_0x3650[_0x2a4af6];return _0x3f8898;};'use strict';var attributes=require(_0x0365('0x0'));module[_0x0365('0x1')]=function(_0x11f6fe){return _0x11f6fe['define'](_0x0365('0x2'),attributes,{'tableName':_0x0365('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c04f94f..e5799d3 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 _0x5d99=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','show','/:id/download','download','post','tracked','mailmessage:create','create','update','accept','/:id/reject','reject','delete','/:id','exports'];(function(_0xd72e13,_0x2253c4){var _0x13d5a1=function(_0x371bcf){while(--_0x371bcf){_0xd72e13['push'](_0xd72e13['shift']());}};_0x13d5a1(++_0x2253c4);}(_0x5d99,0x150));var _0x95d9=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0x5d99[_0x2c3a88];return _0x4a7925;};'use strict';var multer=require('multer');var util=require(_0x95d9('0x0'));var path=require(_0x95d9('0x1'));var timeout=require(_0x95d9('0x2'));var express=require(_0x95d9('0x3'));var router=express[_0x95d9('0x4')]();var fs_extra=require(_0x95d9('0x5'));var auth=require(_0x95d9('0x6'));var interaction=require(_0x95d9('0x7'));var config=require(_0x95d9('0x8'));var controller=require(_0x95d9('0x9'));router[_0x95d9('0xa')]('/',auth[_0x95d9('0xb')](),controller[_0x95d9('0xc')]);router[_0x95d9('0xa')]('/describe',auth[_0x95d9('0xb')](),controller[_0x95d9('0xd')]);router[_0x95d9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x95d9('0xe')]);router[_0x95d9('0xa')](_0x95d9('0xf'),auth[_0x95d9('0xb')](),controller[_0x95d9('0x10')]);router[_0x95d9('0x11')]('/',auth['isAuthenticated'](),interaction[_0x95d9('0x12')]('mail',_0x95d9('0x13')),controller[_0x95d9('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x95d9('0x15')]);router['put']('/:id/accept',auth[_0x95d9('0xb')](),controller[_0x95d9('0x16')]);router['put'](_0x95d9('0x17'),auth[_0x95d9('0xb')](),controller[_0x95d9('0x18')]);router[_0x95d9('0x19')](_0x95d9('0x1a'),auth[_0x95d9('0xb')](),controller['destroy']);module[_0x95d9('0x1b')]=router; \ No newline at end of file +var _0x81d5=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','/describe','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0x81d5,0x1ab));var _0x581d=function(_0x3f99b8,_0x1b15bc){_0x3f99b8=_0x3f99b8-0x0;var _0x168ab0=_0x81d5[_0x3f99b8];return _0x168ab0;};'use strict';var multer=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var path=require('path');var timeout=require(_0x581d('0x2'));var express=require(_0x581d('0x3'));var router=express[_0x581d('0x4')]();var fs_extra=require(_0x581d('0x5'));var auth=require(_0x581d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x581d('0x7'));router[_0x581d('0x8')]('/',auth[_0x581d('0x9')](),controller['index']);router[_0x581d('0x8')](_0x581d('0xa'),auth[_0x581d('0x9')](),controller['describe']);router[_0x581d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x581d('0x8')](_0x581d('0xb'),auth[_0x581d('0x9')](),controller[_0x581d('0xc')]);router[_0x581d('0xd')]('/',auth['isAuthenticated'](),interaction[_0x581d('0xe')](_0x581d('0xf'),_0x581d('0x10')),controller[_0x581d('0x11')]);router[_0x581d('0x12')](_0x581d('0x13'),auth[_0x581d('0x9')](),controller[_0x581d('0x14')]);router[_0x581d('0x12')](_0x581d('0x15'),auth['isAuthenticated'](),controller[_0x581d('0x16')]);router[_0x581d('0x12')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x581d('0x13'),auth['isAuthenticated'](),controller[_0x581d('0x17')]);module[_0x581d('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 784ec73..3e41d7e 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 _0xa617=['TEXT','medium','out','STRING','DATE','INTEGER','BOOLEAN','ENUM','Email','Chat','sequelize','exports','long'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0xa617,0x128));var _0x7a61=function(_0x3f8a1e,_0x144763){_0x3f8a1e=_0x3f8a1e-0x0;var _0x21f91f=_0xa617[_0x3f8a1e];return _0x21f91f;};'use strict';var Sequelize=require(_0x7a61('0x0'));var _=require('lodash');module[_0x7a61('0x1')]={'body':{'type':Sequelize['TEXT'](_0x7a61('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7a61('0x3')](_0x7a61('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7a61('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7a61('0x6')](0x1fe)},'from':{'type':Sequelize[_0x7a61('0x6')]},'to':{'type':Sequelize[_0x7a61('0x3')]('long')},'cc':{'type':Sequelize[_0x7a61('0x3')](_0x7a61('0x2'))},'bcc':{'type':Sequelize[_0x7a61('0x3')](_0x7a61('0x2'))},'subject':{'type':Sequelize[_0x7a61('0x3')]},'sentAt':{'type':Sequelize[_0x7a61('0x7')]},'attach':{'type':Sequelize[_0x7a61('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7a61('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7a61('0x7')]},'originTo':{'type':Sequelize[_0x7a61('0x3')]('long')},'originCc':{'type':Sequelize[_0x7a61('0x3')](_0x7a61('0x2'))},'originChannel':{'type':Sequelize[_0x7a61('0xa')](_0x7a61('0xb'),_0x7a61('0xc')),'defaultValue':_0x7a61('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x2ca5=['lodash','exports','TEXT','ENUM','out','long','DATE','INTEGER','BOOLEAN','Email','Chat'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2ca5,0x108));var _0x52ca=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0x2ca5[_0x39d711];return _0xee1d0c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x52ca('0x0'));module[_0x52ca('0x1')]={'body':{'type':Sequelize[_0x52ca('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x52ca('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x52ca('0x3')]('in',_0x52ca('0x4')),'defaultValue':_0x52ca('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x52ca('0x5'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x52ca('0x2')](_0x52ca('0x5'))},'subject':{'type':Sequelize[_0x52ca('0x2')]},'sentAt':{'type':Sequelize[_0x52ca('0x6')]},'attach':{'type':Sequelize[_0x52ca('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x52ca('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x52ca('0x6')]},'originTo':{'type':Sequelize['TEXT'](_0x52ca('0x5'))},'originCc':{'type':Sequelize[_0x52ca('0x2')](_0x52ca('0x5'))},'originChannel':{'type':Sequelize[_0x52ca('0x3')](_0x52ca('0x9'),_0x52ca('0xa')),'defaultValue':_0x52ca('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index c515033..79fac81 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 _0xebca=['bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../mysqldb','defaults','localhost','redis','./mailMessage.socket','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','find','body','describe','create','direction','out','secret','MailAccount','MailAccountId','List','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','MailInteraction','role','null','RejectMessage','rejectMessage','User','interface','reject','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachments','decode','headers','Bcc','bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xebca,0x9e));var _0xaebc=function(_0x5c0232,_0x1c449f){_0x5c0232=_0x5c0232-0x0;var _0x589366=_0xebca[_0x5c0232];return _0x589366;};'use strict';var emlformat=require(_0xaebc('0x0'));var moment=require(_0xaebc('0x1'));var BPromise=require(_0xaebc('0x2'));var util=require(_0xaebc('0x3'));var path=require(_0xaebc('0x4'));var fs=require('fs');var _=require(_0xaebc('0x5'));var Redis=require(_0xaebc('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xaebc('0x7'));var logger=require('../../config/logger')(_0xaebc('0x8'));var interaction_log=require(_0xaebc('0x9'))(_0xaebc('0xa'));var config=require('../../config/environment');var db=require(_0xaebc('0xb'))['db'];config['redis']=_[_0xaebc('0xc')](config['redis'],{'host':_0xaebc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaebc('0xe')]));var htmlEntities=require('html-entities');require(_0xaebc('0xf'))['register'](socket);var jayson=require(_0xaebc('0x10'));var client=jayson['client'][_0xaebc('0x11')]({'port':0x232c});var client9003=jayson[_0xaebc('0x12')][_0xaebc('0x11')]({'port':0x232b});var client9002=jayson['client'][_0xaebc('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x1b3939,_0x365c55,_0x2c12ef,_0x5743b7){return new BPromise(function(_0x34c462,_0x36a8a9){var _0x3461ac=_0x5743b7||client;return _0x3461ac[_0xaebc('0x13')](_0x1b3939,_0x2c12ef)[_0xaebc('0x14')](function(_0x4820d2){logger[_0xaebc('0x15')](_0xaebc('0x16'),_0x365c55,_0xaebc('0x17'));logger[_0xaebc('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x365c55,_0xaebc('0x17'),JSON[_0xaebc('0x19')](_0x4820d2));if(_0x4820d2[_0xaebc('0x1a')]){if(_0x4820d2[_0xaebc('0x1a')]['code']===0x1f4){logger[_0xaebc('0x1a')]('MailMessage,\x20%s,\x20%s',_0x365c55,_0x4820d2[_0xaebc('0x1a')][_0xaebc('0x1b')]);return _0x36a8a9(_0x4820d2['error'][_0xaebc('0x1b')]);}logger[_0xaebc('0x1a')](_0xaebc('0x16'),_0x365c55,_0x4820d2[_0xaebc('0x1a')][_0xaebc('0x1b')]);return _0x34c462(_0x4820d2[_0xaebc('0x1a')][_0xaebc('0x1b')]);}else{logger['info'](_0xaebc('0x16'),_0x365c55,'request\x20sent');_0x34c462(_0x4820d2[_0xaebc('0x1c')][_0xaebc('0x1b')]);}})[_0xaebc('0x1d')](function(_0x2adec2){logger[_0xaebc('0x1a')](_0xaebc('0x16'),_0x365c55,_0x2adec2);_0x36a8a9(_0x2adec2);});});}function respondWithResult(_0x45e355,_0x5a1fc7){_0x5a1fc7=_0x5a1fc7||0xc8;return function(_0xbb5bf2){if(_0xbb5bf2){return _0x45e355[_0xaebc('0x1e')](_0x5a1fc7)['json'](_0xbb5bf2);}};}function respondWithFilteredResult(_0x4e917e,_0x5a7b91){return function(_0x582b01){if(_0x582b01){var _0x203f58=typeof _0x5a7b91[_0xaebc('0x1f')]===_0xaebc('0x20')&&typeof _0x5a7b91[_0xaebc('0x21')]===_0xaebc('0x20');var _0x1af7e3=_0x582b01[_0xaebc('0x22')];var _0xfb6b9c=_0x203f58?0x0:_0x5a7b91[_0xaebc('0x1f')];var _0x530398=_0x203f58?_0x582b01['count']:_0x5a7b91[_0xaebc('0x1f')]+_0x5a7b91[_0xaebc('0x21')];var _0x4cfd48;if(_0x530398>=_0x1af7e3){_0x530398=_0x1af7e3;_0x4cfd48=0xc8;}else{_0x4cfd48=0xce;}_0x4e917e[_0xaebc('0x1e')](_0x4cfd48);return _0x4e917e[_0xaebc('0x23')](_0xaebc('0x24'),_0xfb6b9c+'-'+_0x530398+'/'+_0x1af7e3)['json'](_0x582b01);}return null;};}function saveUpdates(_0x184c14){return function(_0x5372ca){if(_0x5372ca){return _0x5372ca[_0xaebc('0x25')](_0x184c14)[_0xaebc('0x14')](function(_0x437d0e){return _0x437d0e;});}return null;};}function removeEntity(_0x1de5ab){return function(_0x30aaf1){if(_0x30aaf1){return _0x30aaf1[_0xaebc('0x26')]()[_0xaebc('0x14')](function(){_0x1de5ab[_0xaebc('0x1e')](0xcc)[_0xaebc('0x27')]();});}};}function handleEntityNotFound(_0x25c48c){return function(_0x125851){if(!_0x125851){_0x25c48c[_0xaebc('0x28')](0x194);}return _0x125851;};}function handleError(_0x1d35d7,_0xbde866){_0xbde866=_0xbde866||0x1f4;return function(_0xdd3ab3){logger['error'](_0xdd3ab3[_0xaebc('0x29')]);if(_0xdd3ab3[_0xaebc('0x2a')]){delete _0xdd3ab3[_0xaebc('0x2a')];}_0x1d35d7[_0xaebc('0x1e')](_0xbde866)[_0xaebc('0x2b')](_0xdd3ab3);};}exports[_0xaebc('0x2c')]=function(_0x462597,_0xb745b4){var _0x1ee7ff={},_0x183b2b={},_0x49393a={'count':0x0,'rows':[]};var _0x42ee1f=_['map'](db[_0xaebc('0x2d')][_0xaebc('0x2e')],function(_0x5cf2fc){return{'name':_0x5cf2fc['fieldName'],'type':_0x5cf2fc['type'][_0xaebc('0x2f')]};});_0x183b2b[_0xaebc('0x30')]=_[_0xaebc('0x31')](_0x42ee1f,_0xaebc('0x2a'));_0x183b2b['query']=_[_0xaebc('0x32')](_0x462597[_0xaebc('0x33')]);_0x183b2b[_0xaebc('0x34')]=_[_0xaebc('0x35')](_0x183b2b[_0xaebc('0x30')],_0x183b2b[_0xaebc('0x33')]);_0x1ee7ff['attributes']=_[_0xaebc('0x35')](_0x183b2b['model'],qs[_0xaebc('0x36')](_0x462597['query']['fields']));_0x1ee7ff[_0xaebc('0x37')]=_0x1ee7ff[_0xaebc('0x37')][_0xaebc('0x38')]?_0x1ee7ff['attributes']:_0x183b2b['model'];if(!_0x462597[_0xaebc('0x33')][_0xaebc('0x39')]('nolimit')){_0x1ee7ff[_0xaebc('0x21')]=qs['limit'](_0x462597[_0xaebc('0x33')][_0xaebc('0x21')]);_0x1ee7ff['offset']=qs['offset'](_0x462597[_0xaebc('0x33')][_0xaebc('0x1f')]);}_0x1ee7ff[_0xaebc('0x3a')]=qs[_0xaebc('0x3b')](_0x462597['query'][_0xaebc('0x3b')]);_0x1ee7ff['where']=qs[_0xaebc('0x34')](_['pick'](_0x462597[_0xaebc('0x33')],_0x183b2b['filters']),_0x42ee1f);if(_0x462597[_0xaebc('0x33')][_0xaebc('0x3c')]){_0x1ee7ff[_0xaebc('0x3d')]=_[_0xaebc('0x3e')](_0x1ee7ff[_0xaebc('0x3d')],{'$or':_[_0xaebc('0x31')](_0x42ee1f,function(_0x185ddd){if(_0x185ddd[_0xaebc('0x3f')]!==_0xaebc('0x40')){var _0x50c3b8={};_0x50c3b8[_0x185ddd[_0xaebc('0x2a')]]={'$like':'%'+_0x462597[_0xaebc('0x33')][_0xaebc('0x3c')]+'%'};return _0x50c3b8;}})});}_0x1ee7ff=_[_0xaebc('0x3e')]({},_0x1ee7ff,_0x462597[_0xaebc('0x41')]);var _0x258bb9={'where':_0x1ee7ff[_0xaebc('0x3d')]};return db[_0xaebc('0x2d')]['count'](_0x258bb9)[_0xaebc('0x14')](function(_0x193fdd){_0x49393a['count']=_0x193fdd;if(_0x462597['query'][_0xaebc('0x42')]){_0x1ee7ff['include']=[{'all':!![]}];}return db[_0xaebc('0x2d')][_0xaebc('0x43')](_0x1ee7ff);})[_0xaebc('0x14')](function(_0x2e79ee){_0x49393a[_0xaebc('0x44')]=_0x2e79ee;return _0x49393a;})[_0xaebc('0x14')](respondWithFilteredResult(_0xb745b4,_0x1ee7ff))[_0xaebc('0x1d')](handleError(_0xb745b4,null));};exports['show']=function(_0x4f846f,_0x36f6fa){var _0x501247={'raw':!![],'where':{'id':_0x4f846f[_0xaebc('0x45')]['id']}},_0x154195={};_0x154195[_0xaebc('0x30')]=_['keys'](db['MailMessage'][_0xaebc('0x2e')]);_0x154195[_0xaebc('0x33')]=_[_0xaebc('0x32')](_0x4f846f['query']);_0x154195['filters']=_[_0xaebc('0x35')](_0x154195['model'],_0x154195[_0xaebc('0x33')]);_0x501247[_0xaebc('0x37')]=_['intersection'](_0x154195[_0xaebc('0x30')],qs['fields'](_0x4f846f[_0xaebc('0x33')][_0xaebc('0x36')]));_0x501247['attributes']=_0x501247['attributes'][_0xaebc('0x38')]?_0x501247[_0xaebc('0x37')]:_0x154195[_0xaebc('0x30')];if(_0x4f846f[_0xaebc('0x33')][_0xaebc('0x42')]){_0x501247['include']=[{'all':!![]}];}_0x501247=_[_0xaebc('0x3e')]({},_0x501247,_0x4f846f[_0xaebc('0x41')]);return db[_0xaebc('0x2d')][_0xaebc('0x46')](_0x501247)[_0xaebc('0x14')](handleEntityNotFound(_0x36f6fa,null))['then'](respondWithResult(_0x36f6fa,null))[_0xaebc('0x1d')](handleError(_0x36f6fa,null));};exports['update']=function(_0x493af4,_0x119bff){if(_0x493af4['body']['id']){delete _0x493af4[_0xaebc('0x47')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x493af4[_0xaebc('0x45')]['id']}})['then'](handleEntityNotFound(_0x119bff,null))[_0xaebc('0x14')](saveUpdates(_0x493af4[_0xaebc('0x47')],null))[_0xaebc('0x14')](respondWithResult(_0x119bff,null))[_0xaebc('0x1d')](handleError(_0x119bff,null));};exports['destroy']=function(_0x38bd2e,_0x420c7a){return db['MailMessage'][_0xaebc('0x46')]({'where':{'id':_0x38bd2e[_0xaebc('0x45')]['id']}})[_0xaebc('0x14')](handleEntityNotFound(_0x420c7a,null))['then'](removeEntity(_0x420c7a,null))[_0xaebc('0x1d')](handleError(_0x420c7a,null));};exports[_0xaebc('0x48')]=function(_0x579fb2,_0x5ad0c6){return db[_0xaebc('0x2d')][_0xaebc('0x48')]()[_0xaebc('0x14')](respondWithResult(_0x5ad0c6,null))[_0xaebc('0x1d')](handleError(_0x5ad0c6,null));};exports[_0xaebc('0x49')]=function(_0x413d83,_0x176cf9){return db[_0xaebc('0x2d')][_0xaebc('0x49')](_0x413d83[_0xaebc('0x47')])[_0xaebc('0x14')](function(_0x5a8812){if(_0x5a8812){if(_0x5a8812[_0xaebc('0x4a')]===_0xaebc('0x4b')&&!_0x5a8812[_0xaebc('0x4c')]){var _0x240880,_0xbef2b8,_0x4dbc58;if(_0x413d83[_0xaebc('0x47')]['to']){_0xbef2b8=_0x413d83[_0xaebc('0x47')]['to']['split'](',')[0x0];}return db[_0xaebc('0x4d')]['findOne']({'where':{'id':_0x5a8812[_0xaebc('0x4e')]},'include':[{'model':db['CmList'],'as':_0xaebc('0x4f'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0xbef2b8},'limit':0x1,'order':[[_0xaebc('0x50'),'DESC']]}]},{'model':db[_0xaebc('0x51')],'as':_0xaebc('0x52'),'raw':!![],'include':[{'model':db[_0xaebc('0x53')],'as':_0xaebc('0x53'),'raw':!![]}]}]})[_0xaebc('0x14')](function(_0x5d5e4a){_0x240880=_0x5d5e4a;if(!_0x240880||!_0x240880[_0xaebc('0x52')])return;var _0x46badf=_0x240880[_0xaebc('0x54')]();if(_0x413d83[_0xaebc('0x47')][_0xaebc('0x55')]&&_0x413d83[_0xaebc('0x47')][_0xaebc('0x55')]['length']){for(var _0x4ac4a3=0x0;_0x4ac4a3<_0x413d83['body'][_0xaebc('0x55')][_0xaebc('0x38')];_0x4ac4a3+=0x1){_0x413d83[_0xaebc('0x47')][_0xaebc('0x55')][_0x4ac4a3]={'filename':_0x413d83[_0xaebc('0x47')][_0xaebc('0x55')][_0x4ac4a3][_0xaebc('0x2a')],'path':path[_0xaebc('0x56')](config[_0xaebc('0x57')],_0xaebc('0x58'),_0x413d83[_0xaebc('0x47')]['attachments'][_0x4ac4a3][_0xaebc('0x59')])};}}_0x4dbc58={'account':_0x46badf,'message':_0x413d83[_0xaebc('0x47')]};return;})[_0xaebc('0x14')](function(){if(_0x240880[_0xaebc('0x4f')]){if(_0x240880[_0xaebc('0x4f')]['Contacts']['length']){return _0x240880[_0xaebc('0x4f')][_0xaebc('0x5a')][0x0];}else{return db['CmContact'][_0xaebc('0x49')](_[_0xaebc('0xc')](_0x413d83['body'],{'firstName':_0x413d83[_0xaebc('0x47')]['to'],'email':_0x413d83['body']['to'],'phone':_0x413d83['body']['to'],'ListId':_0x240880[_0xaebc('0x5b')]}));}}else{throw new Error(_0xaebc('0x5c'));}})[_0xaebc('0x14')](function(){if(_0x4dbc58){return respondWithRpcPromise(_0xaebc('0x5d'),_0xaebc('0x5e'),_0x4dbc58,client9003)[_0xaebc('0x14')](function(_0x45bffc){return _0x5a8812[_0xaebc('0x25')]({'read':!![],'messageId':_0x45bffc[_0xaebc('0x5f')],'sentAt':moment()[_0xaebc('0x60')](_0xaebc('0x61'))});})['catch'](function(_0x4ce55b){logger[_0xaebc('0x1a')]('%s',JSON[_0xaebc('0x19')](_0x4ce55b));return _0x5a8812;});}return _0x5a8812;});}return _0x5a8812;}})['then'](respondWithResult(_0x176cf9,0xc9))[_0xaebc('0x1d')](handleError(_0x176cf9,null));};exports[_0xaebc('0x62')]=function(_0x589b21,_0x92093b){var _0x392978={'agent':{},'channel':_0xaebc('0x63')};if(_0x589b21['body']['id']){delete _0x589b21[_0xaebc('0x47')]['id'];}_0x589b21[_0xaebc('0x47')][_0xaebc('0x64')]=!![];_0x589b21[_0xaebc('0x47')][_0xaebc('0x65')]=moment()['format'](_0xaebc('0x61'));_0x589b21[_0xaebc('0x47')]['UserId']=_0x589b21[_0xaebc('0x47')][_0xaebc('0x66')]||_0x589b21['user']['id'];_0x392978[_0xaebc('0x67')]['id']=_0x589b21[_0xaebc('0x47')][_0xaebc('0x66')];return db[_0xaebc('0x2d')][_0xaebc('0x46')]({'where':{'id':_0x589b21[_0xaebc('0x45')]['id'],'UserId':null}})[_0xaebc('0x14')](handleEntityNotFound(_0x92093b,null))[_0xaebc('0x14')](saveUpdates(_0x589b21[_0xaebc('0x47')],null))[_0xaebc('0x14')](function(_0x117bdf){if(_0x117bdf){_0x392978[_0xaebc('0x1b')]=_0x117bdf[_0xaebc('0x68')]({'plain':!![]});return db['MailInteraction'][_0xaebc('0x46')]({'where':{'id':_0x117bdf[_0xaebc('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x92093b,null))[_0xaebc('0x14')](function(_0x5c0465){if(_0x5c0465){return _0x5c0465['update']({'UserId':_0x589b21[_0xaebc('0x47')][_0xaebc('0x66')],'read1stAt':_[_0xaebc('0x6a')](_0x5c0465[_0xaebc('0x6b')])?moment()[_0xaebc('0x60')](_0xaebc('0x61')):undefined});}return null;})['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x392978[_0xaebc('0x6c')]=_0x2e6bcf[_0xaebc('0x68')]({'plain':!![]});interaction_log['info'](_0xaebc('0x6d'),_0x589b21[_0xaebc('0x6e')]['id'],_0x589b21[_0xaebc('0x6e')][_0xaebc('0x2a')],_0x589b21['user']['role'],_0x392978['interaction']['id'],_0x589b21[_0xaebc('0x47')]?JSON[_0xaebc('0x19')](_0x589b21[_0xaebc('0x47')]):'null');return respondWithRpcPromise(_0xaebc('0x6f'),_0xaebc('0x70'),_0x392978);}return null;})[_0xaebc('0x14')](function(_0xd626a5){var _0x469a66=_0xaebc('0x71')+_0xd626a5['message'][_0xaebc('0x72')];return db[_0xaebc('0x73')][_0xaebc('0x33')](_0x469a66,{'type':db[_0xaebc('0x74')][_0xaebc('0x75')][_0xaebc('0x76')],'raw':!![]})['then'](function(_0x5007e9){return _0x5007e9;});})['then'](function(_0x241363){if(_0x241363){_0x392978[_0xaebc('0x1b')][_0xaebc('0x77')]=_0x241363[0x0];if(!_0x589b21['body'][_0xaebc('0x66')])return;return db['User'][_0xaebc('0x46')]({'where':{'id':_0x589b21[_0xaebc('0x47')][_0xaebc('0x66')],'role':'agent'},'attributes':['id',_0xaebc('0x2a'),_0xaebc('0x78'),_0xaebc('0x79'),_0xaebc('0x7a')],'raw':!![]});}return null;})['then'](function(_0x227681){if(!_0x227681)return null;_0x392978[_0xaebc('0x1b')][_0xaebc('0x67')]=_0x227681;return _0x392978;})[_0xaebc('0x14')](function(_0x4810e8){if(_0x4810e8){if(_0x589b21[_0xaebc('0x47')][_0xaebc('0x7b')]){_0x392978[_0xaebc('0x1b')]['interface']=util[_0xaebc('0x60')](_0xaebc('0x7c'),_0x589b21['user'][_0xaebc('0x2a')]);_0x392978[_0xaebc('0x1b')][_0xaebc('0x7d')]=_0x392978[_0xaebc('0x7d')];_0x392978[_0xaebc('0x1b')][_0xaebc('0x7e')]=_0x392978['channel'];_0x392978[_0xaebc('0x1b')][_0xaebc('0x7f')]=_0xaebc('0x62');_0x392978[_0xaebc('0x1b')][_0xaebc('0x47')]=htmlToText[_0xaebc('0x80')](_0x392978['message'][_0xaebc('0x47')]);return respondWithRpcPromise(_0xaebc('0x81'),'EventManager',{'event':'acceptmessage','message':_0x392978[_0xaebc('0x1b')]},client9002)['then'](function(){return _0x392978;});}return _0x392978;}return null;})[_0xaebc('0x14')](respondWithResult(_0x92093b,null))[_0xaebc('0x1d')](handleError(_0x92093b,null));};exports['reject']=function(_0x41871a,_0x4fb985){var _0x178910={'agent':{},'channel':_0xaebc('0x63')};if(_0x41871a[_0xaebc('0x47')]['id']){delete _0x41871a[_0xaebc('0x47')]['id'];}_0x41871a[_0xaebc('0x47')][_0xaebc('0x66')]=_0x41871a['body'][_0xaebc('0x66')]||_0x41871a[_0xaebc('0x6e')]['id'];_0x178910['agent']['id']=_0x41871a[_0xaebc('0x47')][_0xaebc('0x66')];return db['MailMessage'][_0xaebc('0x46')]({'where':{'id':_0x41871a[_0xaebc('0x45')]['id'],'UserId':null}})[_0xaebc('0x14')](handleEntityNotFound(_0x4fb985,null))[_0xaebc('0x14')](function(_0x46e205){if(_0x46e205){_0x178910[_0xaebc('0x1b')]=_0x46e205[_0xaebc('0x68')]({'plain':!![]});return db[_0xaebc('0x82')][_0xaebc('0x46')]({'where':{'id':_0x46e205[_0xaebc('0x69')]}});}return null;})[_0xaebc('0x14')](handleEntityNotFound(_0x4fb985,null))[_0xaebc('0x14')](function(_0x57fea9){if(_0x57fea9){_0x178910[_0xaebc('0x6c')]=_0x57fea9[_0xaebc('0x68')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41871a[_0xaebc('0x6e')]['id'],_0x41871a[_0xaebc('0x6e')]['name'],_0x41871a[_0xaebc('0x6e')][_0xaebc('0x83')],_0x178910[_0xaebc('0x6c')]['id'],_0x41871a[_0xaebc('0x47')]?JSON['stringify'](_0x41871a[_0xaebc('0x47')]):_0xaebc('0x84'));return respondWithRpcPromise(_0xaebc('0x85'),_0xaebc('0x86'),_0x178910);}return null;})[_0xaebc('0x14')](function(_0x2a101e){var _0x4e5c76=_0xaebc('0x71')+_0x2a101e[_0xaebc('0x1b')]['ContactId'];return db[_0xaebc('0x73')]['query'](_0x4e5c76,{'type':db[_0xaebc('0x74')][_0xaebc('0x75')][_0xaebc('0x76')],'raw':!![]})[_0xaebc('0x14')](function(_0x3c84e){return _0x3c84e;});})[_0xaebc('0x14')](function(_0x41f072){if(_0x41f072){_0x178910['message'][_0xaebc('0x77')]=_0x41f072[0x0];if(!_0x41871a[_0xaebc('0x47')][_0xaebc('0x66')])return;return db[_0xaebc('0x87')][_0xaebc('0x46')]({'where':{'id':_0x41871a['body'][_0xaebc('0x66')],'role':_0xaebc('0x67')},'attributes':['id',_0xaebc('0x2a'),'fullname','email',_0xaebc('0x7a')],'raw':!![]});}return null;})[_0xaebc('0x14')](function(_0x50935d){if(!_0x50935d)return null;_0x178910[_0xaebc('0x1b')][_0xaebc('0x67')]=_0x50935d;return _0x178910;})[_0xaebc('0x14')](function(_0x5c632b){if(_0x5c632b){_0x5c632b[_0xaebc('0x1b')][_0xaebc('0x88')]=util[_0xaebc('0x60')](_0xaebc('0x7c'),_0x41871a[_0xaebc('0x6e')][_0xaebc('0x2a')]);_0x5c632b[_0xaebc('0x1b')][_0xaebc('0x7d')]=_0x178910[_0xaebc('0x7d')];_0x5c632b['message'][_0xaebc('0x7e')]=_0x178910['channel'];_0x5c632b[_0xaebc('0x1b')][_0xaebc('0x7f')]=_0xaebc('0x89');_0x5c632b[_0xaebc('0x1b')]['body']=htmlToText[_0xaebc('0x80')](_0x178910['message'][_0xaebc('0x47')]);respondWithRpcPromise('EventManager',_0xaebc('0x81'),{'event':_0xaebc('0x8a'),'message':_0x5c632b['message']},client9002);return _0x178910;}return null;})[_0xaebc('0x14')](respondWithResult(_0x4fb985,null))['catch'](handleError(_0x4fb985,null));};exports['download']=function(_0xd3488b,_0x583cf0){var _0x5923b8=moment()[_0xaebc('0x8b')]()[_0xaebc('0x8c')]();var _0x42c582=path[_0xaebc('0x56')](config[_0xaebc('0x57')],_0xaebc('0x8d'),_0xaebc('0x8e'),_0xaebc('0x8f'));var _0x26204a=path[_0xaebc('0x56')](config['root'],'server',_0xaebc('0x8e'),_0xaebc('0x55'));var _0x407271=util[_0xaebc('0x60')](_0xaebc('0x90'),_0x5923b8);return db['MailMessage'][_0xaebc('0x46')]({'where':{'id':_0xd3488b[_0xaebc('0x45')]['id']},'attributes':['id',_0xaebc('0x47'),_0xaebc('0x91'),'to','cc','bcc',_0xaebc('0x92'),_0xaebc('0x93')],'include':_0xd3488b[_0xaebc('0x33')]['attachments']?[{'model':db['Attachment'],'as':_0xaebc('0x94')}]:undefined})['then'](handleEntityNotFound(_0x583cf0,null))[_0xaebc('0x14')](function(_0x203621){if(_0x203621){var _0x49ba35=_0x203621;var _0x44578d={'from':_0x49ba35[_0xaebc('0x91')],'to':_0x49ba35['to'],'subject':_0x49ba35[_0xaebc('0x92')],'html':htmlEntities[_0xaebc('0x95')](_0x49ba35[_0xaebc('0x47')]),'headers':{'Date':moment(_0x49ba35['createdAt'])[_0xaebc('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x203621['cc']){_0x44578d[_0xaebc('0x96')]['Cc']=_0x203621['cc'];}if(_0x203621['bcc']){_0x44578d['headers'][_0xaebc('0x97')]=_0x203621[_0xaebc('0x98')];}return new BPromise(function(_0xdc1b69,_0x23c9ab){if(_0x203621[_0xaebc('0x94')]){for(var _0x2ecbb5=0x0;_0x2ecbb5<_0x203621[_0xaebc('0x94')][_0xaebc('0x38')];_0x2ecbb5++){var _0x40185e=_0x203621[_0xaebc('0x94')][_0x2ecbb5];var _0x283fcc=path[_0xaebc('0x56')](_0x26204a,_0x40185e[_0xaebc('0x59')]);if(fs[_0xaebc('0x99')](_0x283fcc)){_0x44578d['attachments'][_0xaebc('0x9a')]({'name':_0x40185e[_0xaebc('0x2a')],'contentType':_0x40185e['type'],'data':fs[_0xaebc('0x9b')](_0x283fcc)});}}}emlformat[_0xaebc('0x9c')](_0x44578d,function(_0x44188c,_0x32bcb9){if(_0x44188c)return _0x23c9ab(_0x44188c);fs[_0xaebc('0x9d')](path[_0xaebc('0x56')](_0x42c582,_0x407271),_0x32bcb9);return _0xdc1b69(_0x32bcb9);});});}})[_0xaebc('0x14')](function(_0x1a94be){if(_0x1a94be){return _0x583cf0[_0xaebc('0x9e')](path[_0xaebc('0x56')](_0x42c582,_0x407271),_0x407271,function(_0x4ad741){if(!_0x4ad741)fs[_0xaebc('0x9f')](path[_0xaebc('0x56')](_0x42c582,_0x407271));});}})[_0xaebc('0x1d')](handleError(_0x583cf0,null));}; \ No newline at end of file +var _0x2f51=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','body','find','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','updatedAt','DESC','CloudProvider','Smtp','attachments','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SIP/%s','event','reject','fromString','unix','toString','join','tmp','files','bcc','subject','createdAt','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','unlinkSync','eml-format','moment','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','update','then','destroy','end','sendStatus','send','index','MailMessage','rawAttributes','fieldName','key','model','map','name','keys','query','intersection','attributes'];(function(_0x193ea6,_0x27890e){var _0x4fe21a=function(_0x34a3bf){while(--_0x34a3bf){_0x193ea6['push'](_0x193ea6['shift']());}};_0x4fe21a(++_0x27890e);}(_0x2f51,0x182));var _0x12f5=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0x2f51[_0x16eb19];return _0x312a25;};'use strict';var emlformat=require(_0x12f5('0x0'));var moment=require(_0x12f5('0x1'));var BPromise=require('bluebird');var util=require(_0x12f5('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x12f5('0x3'));var htmlToText=require(_0x12f5('0x4'));var qs=require(_0x12f5('0x5'));var logger=require(_0x12f5('0x6'))(_0x12f5('0x7'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x12f5('0x8'));var db=require(_0x12f5('0x9'))['db'];config[_0x12f5('0xa')]=_[_0x12f5('0xb')](config[_0x12f5('0xa')],{'host':_0x12f5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x12f5('0xa')]));var htmlEntities=require(_0x12f5('0xd'));require('./mailMessage.socket')[_0x12f5('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x12f5('0xf')][_0x12f5('0x10')]({'port':0x232c});var client9003=jayson[_0x12f5('0xf')][_0x12f5('0x10')]({'port':0x232b});var client9002=jayson[_0x12f5('0xf')][_0x12f5('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5c6cfc,_0x26618f,_0x154eb3,_0xf4f3d0){return new BPromise(function(_0x598196,_0x2bb66a){var _0x4a93bb=_0xf4f3d0||client;return _0x4a93bb[_0x12f5('0x11')](_0x5c6cfc,_0x154eb3)['then'](function(_0x3250af){logger[_0x12f5('0x12')]('MailMessage,\x20%s,\x20%s',_0x26618f,_0x12f5('0x13'));logger[_0x12f5('0x14')](_0x12f5('0x15'),_0x26618f,_0x12f5('0x13'),JSON['stringify'](_0x3250af));if(_0x3250af['error']){if(_0x3250af[_0x12f5('0x16')]['code']===0x1f4){logger[_0x12f5('0x16')](_0x12f5('0x17'),_0x26618f,_0x3250af['error'][_0x12f5('0x18')]);return _0x2bb66a(_0x3250af[_0x12f5('0x16')][_0x12f5('0x18')]);}logger[_0x12f5('0x16')](_0x12f5('0x17'),_0x26618f,_0x3250af[_0x12f5('0x16')]['message']);return _0x598196(_0x3250af[_0x12f5('0x16')][_0x12f5('0x18')]);}else{logger[_0x12f5('0x12')](_0x12f5('0x17'),_0x26618f,_0x12f5('0x13'));_0x598196(_0x3250af[_0x12f5('0x19')]['message']);}})[_0x12f5('0x1a')](function(_0x570ba6){logger['error'](_0x12f5('0x17'),_0x26618f,_0x570ba6);_0x2bb66a(_0x570ba6);});});}function respondWithResult(_0x3c076a,_0x51558a){_0x51558a=_0x51558a||0xc8;return function(_0x2ae42a){if(_0x2ae42a){return _0x3c076a[_0x12f5('0x1b')](_0x51558a)['json'](_0x2ae42a);}};}function respondWithFilteredResult(_0x2d0609,_0x320063){return function(_0x380650){if(_0x380650){var _0x14c452=typeof _0x320063[_0x12f5('0x1c')]===_0x12f5('0x1d')&&typeof _0x320063['limit']===_0x12f5('0x1d');var _0x283417=_0x380650[_0x12f5('0x1e')];var _0x5cd328=_0x14c452?0x0:_0x320063[_0x12f5('0x1c')];var _0x650505=_0x14c452?_0x380650[_0x12f5('0x1e')]:_0x320063[_0x12f5('0x1c')]+_0x320063[_0x12f5('0x1f')];var _0x5ebb7a;if(_0x650505>=_0x283417){_0x650505=_0x283417;_0x5ebb7a=0xc8;}else{_0x5ebb7a=0xce;}_0x2d0609[_0x12f5('0x1b')](_0x5ebb7a);return _0x2d0609['set'](_0x12f5('0x20'),_0x5cd328+'-'+_0x650505+'/'+_0x283417)[_0x12f5('0x21')](_0x380650);}return null;};}function saveUpdates(_0x521996){return function(_0x4cc084){if(_0x4cc084){return _0x4cc084[_0x12f5('0x22')](_0x521996)[_0x12f5('0x23')](function(_0x15a644){return _0x15a644;});}return null;};}function removeEntity(_0x3113cf){return function(_0xd5effb){if(_0xd5effb){return _0xd5effb[_0x12f5('0x24')]()[_0x12f5('0x23')](function(){_0x3113cf[_0x12f5('0x1b')](0xcc)[_0x12f5('0x25')]();});}};}function handleEntityNotFound(_0x3a6b38){return function(_0x5b9728){if(!_0x5b9728){_0x3a6b38[_0x12f5('0x26')](0x194);}return _0x5b9728;};}function handleError(_0x1f190d,_0x10d0fa){_0x10d0fa=_0x10d0fa||0x1f4;return function(_0x3b1568){logger[_0x12f5('0x16')](_0x3b1568['stack']);if(_0x3b1568['name']){delete _0x3b1568['name'];}_0x1f190d[_0x12f5('0x1b')](_0x10d0fa)[_0x12f5('0x27')](_0x3b1568);};}exports[_0x12f5('0x28')]=function(_0x4d752f,_0x5d6d76){var _0x55e9e1={},_0x438f7b={},_0x1f516c={'count':0x0,'rows':[]};var _0x5b15db=_['map'](db[_0x12f5('0x29')][_0x12f5('0x2a')],function(_0x800e44){return{'name':_0x800e44[_0x12f5('0x2b')],'type':_0x800e44['type'][_0x12f5('0x2c')]};});_0x438f7b[_0x12f5('0x2d')]=_[_0x12f5('0x2e')](_0x5b15db,_0x12f5('0x2f'));_0x438f7b['query']=_[_0x12f5('0x30')](_0x4d752f[_0x12f5('0x31')]);_0x438f7b['filters']=_[_0x12f5('0x32')](_0x438f7b[_0x12f5('0x2d')],_0x438f7b[_0x12f5('0x31')]);_0x55e9e1[_0x12f5('0x33')]=_[_0x12f5('0x32')](_0x438f7b[_0x12f5('0x2d')],qs[_0x12f5('0x34')](_0x4d752f['query'][_0x12f5('0x34')]));_0x55e9e1['attributes']=_0x55e9e1[_0x12f5('0x33')][_0x12f5('0x35')]?_0x55e9e1[_0x12f5('0x33')]:_0x438f7b[_0x12f5('0x2d')];if(!_0x4d752f[_0x12f5('0x31')][_0x12f5('0x36')](_0x12f5('0x37'))){_0x55e9e1[_0x12f5('0x1f')]=qs[_0x12f5('0x1f')](_0x4d752f[_0x12f5('0x31')][_0x12f5('0x1f')]);_0x55e9e1[_0x12f5('0x1c')]=qs['offset'](_0x4d752f[_0x12f5('0x31')][_0x12f5('0x1c')]);}_0x55e9e1[_0x12f5('0x38')]=qs[_0x12f5('0x39')](_0x4d752f[_0x12f5('0x31')]['sort']);_0x55e9e1[_0x12f5('0x3a')]=qs[_0x12f5('0x3b')](_[_0x12f5('0x3c')](_0x4d752f[_0x12f5('0x31')],_0x438f7b[_0x12f5('0x3b')]),_0x5b15db);if(_0x4d752f[_0x12f5('0x31')][_0x12f5('0x3d')]){_0x55e9e1[_0x12f5('0x3a')]=_[_0x12f5('0x3e')](_0x55e9e1[_0x12f5('0x3a')],{'$or':_['map'](_0x5b15db,function(_0x18cb34){if(_0x18cb34[_0x12f5('0x3f')]!==_0x12f5('0x40')){var _0x54be3a={};_0x54be3a[_0x18cb34[_0x12f5('0x2f')]]={'$like':'%'+_0x4d752f[_0x12f5('0x31')][_0x12f5('0x3d')]+'%'};return _0x54be3a;}})});}_0x55e9e1=_['merge']({},_0x55e9e1,_0x4d752f[_0x12f5('0x41')]);var _0x413d31={'where':_0x55e9e1[_0x12f5('0x3a')]};return db['MailMessage'][_0x12f5('0x1e')](_0x413d31)[_0x12f5('0x23')](function(_0x51796a){_0x1f516c[_0x12f5('0x1e')]=_0x51796a;if(_0x4d752f[_0x12f5('0x31')][_0x12f5('0x42')]){_0x55e9e1[_0x12f5('0x43')]=[{'all':!![]}];}return db[_0x12f5('0x29')]['findAll'](_0x55e9e1);})[_0x12f5('0x23')](function(_0x11a007){_0x1f516c[_0x12f5('0x44')]=_0x11a007;return _0x1f516c;})[_0x12f5('0x23')](respondWithFilteredResult(_0x5d6d76,_0x55e9e1))['catch'](handleError(_0x5d6d76,null));};exports['show']=function(_0x1dfe1d,_0x3e015f){var _0x3d6c43={'raw':!![],'where':{'id':_0x1dfe1d['params']['id']}},_0x26a2f5={};_0x26a2f5[_0x12f5('0x2d')]=_['keys'](db[_0x12f5('0x29')][_0x12f5('0x2a')]);_0x26a2f5['query']=_[_0x12f5('0x30')](_0x1dfe1d[_0x12f5('0x31')]);_0x26a2f5['filters']=_[_0x12f5('0x32')](_0x26a2f5['model'],_0x26a2f5[_0x12f5('0x31')]);_0x3d6c43[_0x12f5('0x33')]=_[_0x12f5('0x32')](_0x26a2f5[_0x12f5('0x2d')],qs['fields'](_0x1dfe1d[_0x12f5('0x31')][_0x12f5('0x34')]));_0x3d6c43[_0x12f5('0x33')]=_0x3d6c43['attributes'][_0x12f5('0x35')]?_0x3d6c43[_0x12f5('0x33')]:_0x26a2f5[_0x12f5('0x2d')];if(_0x1dfe1d['query'][_0x12f5('0x42')]){_0x3d6c43[_0x12f5('0x43')]=[{'all':!![]}];}_0x3d6c43=_[_0x12f5('0x3e')]({},_0x3d6c43,_0x1dfe1d['options']);return db[_0x12f5('0x29')]['find'](_0x3d6c43)[_0x12f5('0x23')](handleEntityNotFound(_0x3e015f,null))[_0x12f5('0x23')](respondWithResult(_0x3e015f,null))[_0x12f5('0x1a')](handleError(_0x3e015f,null));};exports['update']=function(_0x3025c4,_0x7577dd){if(_0x3025c4[_0x12f5('0x45')]['id']){delete _0x3025c4[_0x12f5('0x45')]['id'];}return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x3025c4['params']['id']}})[_0x12f5('0x23')](handleEntityNotFound(_0x7577dd,null))['then'](saveUpdates(_0x3025c4[_0x12f5('0x45')],null))[_0x12f5('0x23')](respondWithResult(_0x7577dd,null))[_0x12f5('0x1a')](handleError(_0x7577dd,null));};exports[_0x12f5('0x24')]=function(_0x5745f9,_0x545b71){return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x5745f9[_0x12f5('0x47')]['id']}})[_0x12f5('0x23')](handleEntityNotFound(_0x545b71,null))['then'](removeEntity(_0x545b71,null))[_0x12f5('0x1a')](handleError(_0x545b71,null));};exports[_0x12f5('0x48')]=function(_0x8c9aa2,_0x115dee){return db[_0x12f5('0x29')][_0x12f5('0x48')]()[_0x12f5('0x23')](respondWithResult(_0x115dee,null))[_0x12f5('0x1a')](handleError(_0x115dee,null));};exports['create']=function(_0x433f86,_0x325f38){return db['MailMessage'][_0x12f5('0x49')](_0x433f86['body'])[_0x12f5('0x23')](function(_0x5a77db){if(_0x5a77db){if(_0x5a77db[_0x12f5('0x4a')]===_0x12f5('0x4b')&&!_0x5a77db[_0x12f5('0x4c')]){var _0x58ff35,_0x58a4fe,_0x17b74b;if(_0x433f86[_0x12f5('0x45')]['to']){_0x58a4fe=_0x433f86[_0x12f5('0x45')]['to'][_0x12f5('0x4d')](',')[0x0];}return db[_0x12f5('0x4e')][_0x12f5('0x4f')]({'where':{'id':_0x5a77db[_0x12f5('0x50')]},'include':[{'model':db['CmList'],'as':_0x12f5('0x51'),'include':[{'model':db[_0x12f5('0x52')],'as':'Contacts','where':{'email':_0x58a4fe},'limit':0x1,'order':[[_0x12f5('0x53'),_0x12f5('0x54')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x12f5('0x55')],'as':_0x12f5('0x55'),'raw':!![]}]}]})[_0x12f5('0x23')](function(_0x47267a){_0x58ff35=_0x47267a;if(!_0x58ff35||!_0x58ff35[_0x12f5('0x56')])return;var _0x26fcdc=_0x58ff35['getSmtpOptions']();if(_0x433f86[_0x12f5('0x45')][_0x12f5('0x57')]&&_0x433f86['body'][_0x12f5('0x57')]['length']){for(var _0x5dc547=0x0;_0x5dc547<_0x433f86[_0x12f5('0x45')][_0x12f5('0x57')][_0x12f5('0x35')];_0x5dc547+=0x1){_0x433f86['body'][_0x12f5('0x57')][_0x5dc547]={'filename':_0x433f86['body'][_0x12f5('0x57')][_0x5dc547][_0x12f5('0x2f')],'path':path['join'](config['root'],_0x12f5('0x58'),_0x433f86['body'][_0x12f5('0x57')][_0x5dc547][_0x12f5('0x59')])};}}_0x17b74b={'account':_0x26fcdc,'message':_0x433f86[_0x12f5('0x45')]};return;})[_0x12f5('0x23')](function(){if(_0x58ff35['List']){if(_0x58ff35[_0x12f5('0x51')][_0x12f5('0x5a')][_0x12f5('0x35')]){return _0x58ff35[_0x12f5('0x51')][_0x12f5('0x5a')][0x0];}else{return db[_0x12f5('0x52')]['create'](_[_0x12f5('0xb')](_0x433f86[_0x12f5('0x45')],{'firstName':_0x433f86['body']['to'],'email':_0x433f86[_0x12f5('0x45')]['to'],'phone':_0x433f86[_0x12f5('0x45')]['to'],'ListId':_0x58ff35[_0x12f5('0x5b')]}));}}else{throw new Error(_0x12f5('0x5c'));}})[_0x12f5('0x23')](function(){if(_0x17b74b){return respondWithRpcPromise(_0x12f5('0x5d'),'sendMail',_0x17b74b,client9003)[_0x12f5('0x23')](function(_0x148bf3){return _0x5a77db[_0x12f5('0x22')]({'read':!![],'messageId':_0x148bf3['messageId'],'sentAt':moment()[_0x12f5('0x5e')](_0x12f5('0x5f'))});})[_0x12f5('0x1a')](function(_0x3710db){logger['error']('%s',JSON[_0x12f5('0x60')](_0x3710db));return _0x5a77db;});}return _0x5a77db;});}return _0x5a77db;}})[_0x12f5('0x23')](respondWithResult(_0x325f38,0xc9))['catch'](handleError(_0x325f38,null));};exports[_0x12f5('0x61')]=function(_0x33e67b,_0x4b370b){var _0x2021b1={'agent':{},'channel':_0x12f5('0x62')};if(_0x33e67b['body']['id']){delete _0x33e67b['body']['id'];}_0x33e67b['body'][_0x12f5('0x63')]=!![];_0x33e67b[_0x12f5('0x45')]['readAt']=moment()[_0x12f5('0x5e')](_0x12f5('0x5f'));_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')]=_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')]||_0x33e67b[_0x12f5('0x65')]['id'];_0x2021b1[_0x12f5('0x66')]['id']=_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')];return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x33e67b[_0x12f5('0x47')]['id'],'UserId':null}})[_0x12f5('0x23')](handleEntityNotFound(_0x4b370b,null))[_0x12f5('0x23')](saveUpdates(_0x33e67b['body'],null))[_0x12f5('0x23')](function(_0x402fb6){if(_0x402fb6){_0x2021b1[_0x12f5('0x18')]=_0x402fb6['get']({'plain':!![]});return db[_0x12f5('0x67')]['find']({'where':{'id':_0x402fb6[_0x12f5('0x68')]}});}return null;})[_0x12f5('0x23')](handleEntityNotFound(_0x4b370b,null))[_0x12f5('0x23')](function(_0xd0c9e4){if(_0xd0c9e4){return _0xd0c9e4[_0x12f5('0x22')]({'UserId':_0x33e67b['body']['UserId'],'read1stAt':_[_0x12f5('0x69')](_0xd0c9e4[_0x12f5('0x6a')])?moment()[_0x12f5('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x12f5('0x23')](function(_0x262673){if(_0x262673){_0x2021b1[_0x12f5('0x6b')]=_0x262673[_0x12f5('0x6c')]({'plain':!![]});interaction_log[_0x12f5('0x12')](_0x12f5('0x6d'),_0x33e67b[_0x12f5('0x65')]['id'],_0x33e67b[_0x12f5('0x65')]['name'],_0x33e67b[_0x12f5('0x65')][_0x12f5('0x6e')],_0x2021b1[_0x12f5('0x6b')]['id'],_0x33e67b['body']?JSON['stringify'](_0x33e67b['body']):_0x12f5('0x6f'));return respondWithRpcPromise(_0x12f5('0x70'),'acceptMessage',_0x2021b1);}return null;})['then'](function(_0x21611e){var _0x2f947f=_0x12f5('0x71')+_0x21611e[_0x12f5('0x18')]['ContactId'];return db[_0x12f5('0x72')][_0x12f5('0x31')](_0x2f947f,{'type':db[_0x12f5('0x73')][_0x12f5('0x74')][_0x12f5('0x75')],'raw':!![]})[_0x12f5('0x23')](function(_0x4df5f7){return _0x4df5f7;});})[_0x12f5('0x23')](function(_0x3ee88a){if(_0x3ee88a){_0x2021b1['message'][_0x12f5('0x76')]=_0x3ee88a[0x0];if(!_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')])return;return db['User'][_0x12f5('0x46')]({'where':{'id':_0x33e67b[_0x12f5('0x45')][_0x12f5('0x64')],'role':_0x12f5('0x66')},'attributes':['id',_0x12f5('0x2f'),_0x12f5('0x77'),_0x12f5('0x78'),_0x12f5('0x79')],'raw':!![]});}return null;})[_0x12f5('0x23')](function(_0x22b566){if(!_0x22b566)return null;_0x2021b1['message'][_0x12f5('0x66')]=_0x22b566;return _0x2021b1;})[_0x12f5('0x23')](function(_0x2ad48c){if(_0x2ad48c){if(_0x33e67b[_0x12f5('0x45')][_0x12f5('0x7a')]){_0x2021b1[_0x12f5('0x18')][_0x12f5('0x7b')]=util[_0x12f5('0x5e')]('SIP/%s',_0x33e67b[_0x12f5('0x65')][_0x12f5('0x2f')]);_0x2021b1[_0x12f5('0x18')][_0x12f5('0x7c')]=_0x2021b1[_0x12f5('0x7c')];_0x2021b1[_0x12f5('0x18')]['motionChannel']=_0x2021b1['channel'];_0x2021b1[_0x12f5('0x18')]['event']=_0x12f5('0x61');_0x2021b1[_0x12f5('0x18')]['body']=htmlToText['fromString'](_0x2021b1[_0x12f5('0x18')][_0x12f5('0x45')]);return respondWithRpcPromise(_0x12f5('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x2021b1['message']},client9002)[_0x12f5('0x23')](function(){return _0x2021b1;});}return _0x2021b1;}return null;})[_0x12f5('0x23')](respondWithResult(_0x4b370b,null))[_0x12f5('0x1a')](handleError(_0x4b370b,null));};exports['reject']=function(_0xba35a9,_0x21e97a){var _0x1862b7={'agent':{},'channel':_0x12f5('0x62')};if(_0xba35a9['body']['id']){delete _0xba35a9[_0x12f5('0x45')]['id'];}_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')]=_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')]||_0xba35a9[_0x12f5('0x65')]['id'];_0x1862b7[_0x12f5('0x66')]['id']=_0xba35a9['body'][_0x12f5('0x64')];return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0xba35a9[_0x12f5('0x47')]['id'],'UserId':null}})[_0x12f5('0x23')](handleEntityNotFound(_0x21e97a,null))[_0x12f5('0x23')](function(_0x419dbe){if(_0x419dbe){_0x1862b7[_0x12f5('0x18')]=_0x419dbe[_0x12f5('0x6c')]({'plain':!![]});return db['MailInteraction'][_0x12f5('0x46')]({'where':{'id':_0x419dbe[_0x12f5('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x21e97a,null))[_0x12f5('0x23')](function(_0x52355f){if(_0x52355f){_0x1862b7[_0x12f5('0x6b')]=_0x52355f[_0x12f5('0x6c')]({'plain':!![]});interaction_log[_0x12f5('0x12')](_0x12f5('0x7e'),_0xba35a9['user']['id'],_0xba35a9[_0x12f5('0x65')]['name'],_0xba35a9[_0x12f5('0x65')][_0x12f5('0x6e')],_0x1862b7['interaction']['id'],_0xba35a9['body']?JSON[_0x12f5('0x60')](_0xba35a9[_0x12f5('0x45')]):_0x12f5('0x6f'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1862b7);}return null;})['then'](function(_0x467a7a){var _0x5ccac8=_0x12f5('0x71')+_0x467a7a[_0x12f5('0x18')]['ContactId'];return db[_0x12f5('0x72')][_0x12f5('0x31')](_0x5ccac8,{'type':db[_0x12f5('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0x12f5('0x23')](function(_0x18907a){return _0x18907a;});})[_0x12f5('0x23')](function(_0x558c6a){if(_0x558c6a){_0x1862b7[_0x12f5('0x18')][_0x12f5('0x76')]=_0x558c6a[0x0];if(!_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')])return;return db['User']['find']({'where':{'id':_0xba35a9[_0x12f5('0x45')][_0x12f5('0x64')],'role':'agent'},'attributes':['id',_0x12f5('0x2f'),_0x12f5('0x77'),_0x12f5('0x78'),'internal'],'raw':!![]});}return null;})[_0x12f5('0x23')](function(_0x4fed6c){if(!_0x4fed6c)return null;_0x1862b7[_0x12f5('0x18')][_0x12f5('0x66')]=_0x4fed6c;return _0x1862b7;})[_0x12f5('0x23')](function(_0x18e1a6){if(_0x18e1a6){_0x18e1a6[_0x12f5('0x18')][_0x12f5('0x7b')]=util[_0x12f5('0x5e')](_0x12f5('0x7f'),_0xba35a9[_0x12f5('0x65')][_0x12f5('0x2f')]);_0x18e1a6[_0x12f5('0x18')][_0x12f5('0x7c')]=_0x1862b7[_0x12f5('0x7c')];_0x18e1a6[_0x12f5('0x18')]['motionChannel']=_0x1862b7[_0x12f5('0x7c')];_0x18e1a6['message'][_0x12f5('0x80')]=_0x12f5('0x81');_0x18e1a6[_0x12f5('0x18')]['body']=htmlToText[_0x12f5('0x82')](_0x1862b7[_0x12f5('0x18')]['body']);respondWithRpcPromise(_0x12f5('0x7d'),_0x12f5('0x7d'),{'event':'rejectmessage','message':_0x18e1a6[_0x12f5('0x18')]},client9002);return _0x1862b7;}return null;})['then'](respondWithResult(_0x21e97a,null))[_0x12f5('0x1a')](handleError(_0x21e97a,null));};exports['download']=function(_0x207a6b,_0x147c8b){var _0x5290f6=moment()[_0x12f5('0x83')]()[_0x12f5('0x84')]();var _0x1c07f5=path[_0x12f5('0x85')](config['root'],'server','files',_0x12f5('0x86'));var _0x120893=path[_0x12f5('0x85')](config['root'],'server',_0x12f5('0x87'),_0x12f5('0x57'));var _0x2ab3a3=util['format']('message-%s.eml',_0x5290f6);return db[_0x12f5('0x29')][_0x12f5('0x46')]({'where':{'id':_0x207a6b[_0x12f5('0x47')]['id']},'attributes':['id',_0x12f5('0x45'),'from','to','cc',_0x12f5('0x88'),_0x12f5('0x89'),_0x12f5('0x8a')],'include':_0x207a6b['query']['attachments']?[{'model':db['Attachment'],'as':_0x12f5('0x8b')}]:undefined})[_0x12f5('0x23')](handleEntityNotFound(_0x147c8b,null))['then'](function(_0x2d5ad9){if(_0x2d5ad9){var _0x5065c4=_0x2d5ad9;var _0x381814={'from':_0x5065c4[_0x12f5('0x8c')],'to':_0x5065c4['to'],'subject':_0x5065c4['subject'],'html':htmlEntities[_0x12f5('0x8d')](_0x5065c4['body']),'headers':{'Date':moment(_0x5065c4[_0x12f5('0x8a')])[_0x12f5('0x5e')](_0x12f5('0x8e'))},'attachments':[]};if(_0x2d5ad9['cc']){_0x381814[_0x12f5('0x8f')]['Cc']=_0x2d5ad9['cc'];}if(_0x2d5ad9[_0x12f5('0x88')]){_0x381814[_0x12f5('0x8f')]['Bcc']=_0x2d5ad9['bcc'];}return new BPromise(function(_0x5bc45c,_0xe4b5d9){if(_0x2d5ad9[_0x12f5('0x8b')]){for(var _0x403c8f=0x0;_0x403c8f<_0x2d5ad9[_0x12f5('0x8b')][_0x12f5('0x35')];_0x403c8f++){var _0x804c2e=_0x2d5ad9[_0x12f5('0x8b')][_0x403c8f];var _0x7015b1=path[_0x12f5('0x85')](_0x120893,_0x804c2e[_0x12f5('0x59')]);if(fs['existsSync'](_0x7015b1)){_0x381814[_0x12f5('0x57')][_0x12f5('0x90')]({'name':_0x804c2e['name'],'contentType':_0x804c2e[_0x12f5('0x3f')],'data':fs['readFileSync'](_0x7015b1)});}}}emlformat['build'](_0x381814,function(_0x576ba9,_0x4895ff){if(_0x576ba9)return _0xe4b5d9(_0x576ba9);fs['writeFileSync'](path[_0x12f5('0x85')](_0x1c07f5,_0x2ab3a3),_0x4895ff);return _0x5bc45c(_0x4895ff);});});}})[_0x12f5('0x23')](function(_0x4a0ba9){if(_0x4a0ba9){return _0x147c8b['download'](path['join'](_0x1c07f5,_0x2ab3a3),_0x2ab3a3,function(_0x155e13){if(!_0x155e13)fs[_0x12f5('0x91')](path[_0x12f5('0x85')](_0x1c07f5,_0x2ab3a3));});}})[_0x12f5('0x1a')](handleError(_0x147c8b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5dcac58..eb7a9b0 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 _0x22f2=['save','update','remove','emit','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x22f2,0xf9));var _0x222f=function(_0x5c820a,_0x4d3ae4){_0x5c820a=_0x5c820a-0x0;var _0x41ca61=_0x22f2[_0x5c820a];return _0x41ca61;};'use strict';var EventEmitter=require(_0x222f('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x222f('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x222f('0x2')](0x0);var events={'afterCreate':_0x222f('0x3'),'afterUpdate':_0x222f('0x4'),'afterDestroy':_0x222f('0x5')};function emitEvent(_0x8e8959){return function(_0x217c1e,_0x3c8bc4,_0x1b43f1){MailMessageEvents[_0x222f('0x6')](_0x8e8959+':'+_0x217c1e['id'],_0x217c1e);MailMessageEvents[_0x222f('0x6')](_0x8e8959,_0x217c1e);_0x1b43f1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x222f('0x7')](e,emitEvent(event));}}module[_0x222f('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xad08=['save','update','emit','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x22c729,_0x4845ca){var _0x17cd3d=function(_0x4c0b00){while(--_0x4c0b00){_0x22c729['push'](_0x22c729['shift']());}};_0x17cd3d(++_0x4845ca);}(_0xad08,0x1ed));var _0x8ad0=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xad08[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require(_0x8ad0('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x8ad0('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8ad0('0x2')](0x0);var events={'afterCreate':_0x8ad0('0x3'),'afterUpdate':_0x8ad0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ceb6d){return function(_0x351dad,_0x4642d1,_0x524fb8){MailMessageEvents[_0x8ad0('0x5')](_0x4ceb6d+':'+_0x351dad['id'],_0x351dad);MailMessageEvents[_0x8ad0('0x5')](_0x4ceb6d,_0x351dad);_0x524fb8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8ad0('0x6')](e,emitEvent(event));}}module[_0x8ad0('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 43092f7..9d3aca6 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 _0x1f92=['UserId','findOne','MailInteractionId','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret'];(function(_0x94e2d,_0x176269){var _0x21b4a9=function(_0x2daa5d){while(--_0x2daa5d){_0x94e2d['push'](_0x94e2d['shift']());}};_0x21b4a9(++_0x176269);}(_0x1f92,0xce));var _0x21f9=function(_0x60b31,_0x1a8790){_0x60b31=_0x60b31-0x0;var _0x2ab0ed=_0x1f92[_0x60b31];return _0x2ab0ed;};'use strict';var _=require(_0x21f9('0x0'));var util=require(_0x21f9('0x1'));var logger=require('../../config/logger')(_0x21f9('0x2'));var moment=require(_0x21f9('0x3'));var BPromise=require(_0x21f9('0x4'));var rp=require(_0x21f9('0x5'));var htmlToText=require(_0x21f9('0x6'));var fs=require('fs');var path=require(_0x21f9('0x7'));var rimraf=require(_0x21f9('0x8'));var config=require(_0x21f9('0x9'));var attributes=require(_0x21f9('0xa'));module[_0x21f9('0xb')]=function(_0x2bda3c,_0x15f8bc){return _0x2bda3c['define'](_0x21f9('0xc'),attributes,{'tableName':_0x21f9('0xd'),'paranoid':![],'indexes':[{'name':_0x21f9('0xe'),'fields':[_0x21f9('0xe')]},{'name':'fti_mail_messages','fields':[_0x21f9('0xf'),'subject'],'type':_0x21f9('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f403b,_0x213d59,_0x1c0236){if(_0x3f403b[_0x21f9('0x11')]){_0x3f403b[_0x21f9('0xf')]=htmlToText[_0x21f9('0x12')](_0x3f403b[_0x21f9('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1c0236(null,_0x213d59);},'afterCreate':function(_0x3d0ba7,_0x1085e6,_0x3837e7){var _0x4bfea5=_0x2bda3c[_0x21f9('0x13')];var _0x445f77=_0x3d0ba7[_0x21f9('0x14')]({'plain':!![]});if(_0x445f77[_0x21f9('0x15')][_0x21f9('0x16')]()==='in'||_0x445f77[_0x21f9('0x15')][_0x21f9('0x16')]()===_0x21f9('0x17')&&!_0x445f77[_0x21f9('0x18')]&&!_['isNil'](_0x445f77[_0x21f9('0x19')])){_0x4bfea5['MailInteraction'][_0x21f9('0x1a')]({'where':{'id':_0x445f77[_0x21f9('0x1b')]}})['then'](function(_0x39a7a2){if(_0x39a7a2){_0x39a7a2[_0x21f9('0x1c')]({'lastMsgAt':_0x445f77[_0x21f9('0x1d')],'lastMsgDirection':_0x445f77[_0x21f9('0x15')][_0x21f9('0x16')]()});}})['catch'](function(_0xcb265d){console[_0x21f9('0x1e')](_0xcb265d);});}_0x3837e7();}},'charset':_0x21f9('0x1f'),'collate':_0x21f9('0x20')});}; \ No newline at end of file +var _0xc3f5=['./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0xebf28c,_0x27601c){var _0x2b8745=function(_0x4e9bc3){while(--_0x4e9bc3){_0xebf28c['push'](_0xebf28c['shift']());}};_0x2b8745(++_0x27601c);}(_0xc3f5,0x130));var _0x5c3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc3f5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5c3f('0x0'));var util=require('util');var logger=require(_0x5c3f('0x1'))(_0x5c3f('0x2'));var moment=require(_0x5c3f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c3f('0x4'));var config=require(_0x5c3f('0x5'));var attributes=require(_0x5c3f('0x6'));module['exports']=function(_0x3de647,_0xb1982b){return _0x3de647[_0x5c3f('0x7')](_0x5c3f('0x8'),attributes,{'tableName':_0x5c3f('0x9'),'paranoid':![],'indexes':[{'name':_0x5c3f('0xa'),'fields':[_0x5c3f('0xa')]},{'name':'fti_mail_messages','fields':[_0x5c3f('0xb'),_0x5c3f('0xc')],'type':_0x5c3f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1fbe59,_0x5ef01b,_0x349a75){if(_0x1fbe59[_0x5c3f('0xe')]){_0x1fbe59['plainBody']=htmlToText[_0x5c3f('0xf')](_0x1fbe59[_0x5c3f('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x349a75(null,_0x5ef01b);},'afterCreate':function(_0x32611e,_0x3a93ef,_0xae55bf){var _0x4233f9=_0x3de647[_0x5c3f('0x10')];var _0x4e2a97=_0x32611e[_0x5c3f('0x11')]({'plain':!![]});if(_0x4e2a97[_0x5c3f('0x12')][_0x5c3f('0x13')]()==='in'||_0x4e2a97[_0x5c3f('0x12')][_0x5c3f('0x13')]()===_0x5c3f('0x14')&&!_0x4e2a97['secret']&&!_['isNil'](_0x4e2a97[_0x5c3f('0x15')])){_0x4233f9[_0x5c3f('0x16')]['findOne']({'where':{'id':_0x4e2a97[_0x5c3f('0x17')]}})[_0x5c3f('0x18')](function(_0x168af1){if(_0x168af1){_0x168af1[_0x5c3f('0x19')]({'lastMsgAt':_0x4e2a97[_0x5c3f('0x1a')],'lastMsgDirection':_0x4e2a97[_0x5c3f('0x12')][_0x5c3f('0x13')]()});}})[_0x5c3f('0x1b')](function(_0x1d1deb){console[_0x5c3f('0x1c')](_0x1d1deb);});}_0xae55bf();}},'charset':_0x5c3f('0x1d'),'collate':_0x5c3f('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7ed8f76..22b8b9e 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 _0xea28=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xea28,0x13a));var _0x8ea2=function(_0x5285b8,_0x2b09dd){_0x5285b8=_0x5285b8-0x0;var _0x4c68af=_0xea28[_0x5285b8];return _0x4c68af;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});config[_0x8ea2('0xc')]=_[_0x8ea2('0xd')](config[_0x8ea2('0xc')],{'host':_0x8ea2('0xe'),'port':0x18eb});var socket=require(_0x8ea2('0xf'))(new Redis(config[_0x8ea2('0xc')]));require(_0x8ea2('0x10'))[_0x8ea2('0x11')](socket);function respondWithRpcPromise(_0x3000f9,_0x3d0b35,_0x21ae3d){return new BPromise(function(_0x500b82,_0x4da3b1){return client[_0x8ea2('0x12')](_0x3000f9,_0x21ae3d)[_0x8ea2('0x13')](function(_0x374973){logger['info'](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));logger[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x3d0b35,_0x8ea2('0x15'),JSON['stringify'](_0x374973));if(_0x374973[_0x8ea2('0x18')]){if(_0x374973['error']['code']===0x1f4){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x4da3b1(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x500b82(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}else{logger[_0x8ea2('0x1a')](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));_0x500b82(_0x374973[_0x8ea2('0x1b')][_0x8ea2('0x19')]);}})[_0x8ea2('0x1c')](function(_0x1068b6){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x1068b6);_0x4da3b1(_0x1068b6);});});}exports[_0x8ea2('0x1d')]=function(_0x52b58c){var _0x4be7c9=this;return new Promise(function(_0x3790e9,_0x248c18){return db[_0x8ea2('0x1e')]['create'](_0x52b58c[_0x8ea2('0x1f')],{'raw':_0x52b58c[_0x8ea2('0x20')]?_0x52b58c['options'][_0x8ea2('0x21')]===undefined?!![]:![]:!![]})[_0x8ea2('0x13')](function(_0x37229a){logger[_0x8ea2('0x1a')](_0x8ea2('0x1d'),_0x52b58c);logger[_0x8ea2('0x16')](_0x8ea2('0x1d'),_0x52b58c,JSON[_0x8ea2('0x22')](_0x37229a));_0x3790e9(_0x37229a);})[_0x8ea2('0x1c')](function(_0x4d5030){logger[_0x8ea2('0x18')]('CreateMailMessage',_0x4d5030[_0x8ea2('0x19')],_0x52b58c);_0x248c18(_0x4be7c9[_0x8ea2('0x18')](0x1f4,_0x4d5030[_0x8ea2('0x19')]));});});}; \ No newline at end of file +var _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x5c8937,_0x11df5a){var _0x4e73a3=function(_0x4874b6){while(--_0x4874b6){_0x5c8937['push'](_0x5c8937['shift']());}};_0x4e73a3(++_0x11df5a);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xf2e3[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ee71b69..b4ec7ed 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 _0xe54d=['mailMessage:','./mailMessage.events','save','update','removeListener','register','length'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0xe54d,0xbe));var _0xde54=function(_0x1bd313,_0x18b3ef){_0x1bd313=_0x1bd313-0x0;var _0x4c19b3=_0xe54d[_0x1bd313];return _0x4c19b3;};'use strict';var MailMessageEvents=require(_0xde54('0x0'));var events=[_0xde54('0x1'),'remove',_0xde54('0x2')];function createListener(_0x5e4048,_0x6d7fac){return function(_0x266df6){_0x6d7fac['emit'](_0x5e4048,_0x266df6);};}function removeListener(_0x141a3f,_0x26ef76){return function(){MailMessageEvents[_0xde54('0x3')](_0x141a3f,_0x26ef76);};}exports[_0xde54('0x4')]=function(_0x1bad1d){for(var _0xc080cd=0x0,_0x2e37f8=events[_0xde54('0x5')];_0xc080cd<_0x2e37f8;_0xc080cd++){var _0x353c26=events[_0xc080cd];var _0x2c0414=createListener(_0xde54('0x6')+_0x353c26,_0x1bad1d);MailMessageEvents['on'](_0x353c26,_0x2c0414);}}; \ No newline at end of file +var _0x3979=['length','save','remove','update','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3979,0x114));var _0x9397=function(_0x4ef624,_0x1ee495){_0x4ef624=_0x4ef624-0x0;var _0x387c1d=_0x3979[_0x4ef624];return _0x387c1d;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x9397('0x0'),_0x9397('0x1'),_0x9397('0x2')];function createListener(_0x372f8d,_0x223095){return function(_0x356149){_0x223095['emit'](_0x372f8d,_0x356149);};}function removeListener(_0x3bfe18,_0x329ec1){return function(){MailMessageEvents[_0x9397('0x3')](_0x3bfe18,_0x329ec1);};}exports['register']=function(_0x206ab2){for(var _0x380477=0x0,_0x42eb12=events[_0x9397('0x4')];_0x380477<_0x42eb12;_0x380477++){var _0x20278b=events[_0x380477];var _0x2aa6d9=createListener('mailMessage:'+_0x20278b,_0x206ab2);MailMessageEvents['on'](_0x20278b,_0x2aa6d9);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3888387..142881a 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 _0x2cb7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x5173ff,_0x1909ed){var _0x20468b=function(_0x1b6693){while(--_0x1b6693){_0x5173ff['push'](_0x5173ff['shift']());}};_0x20468b(++_0x1909ed);}(_0x2cb7,0x1a8));var _0x72cb=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0x2cb7[_0x5c9f56];return _0x2a726b;};'use strict';var multer=require(_0x72cb('0x0'));var util=require(_0x72cb('0x1'));var path=require(_0x72cb('0x2'));var timeout=require(_0x72cb('0x3'));var express=require(_0x72cb('0x4'));var router=express[_0x72cb('0x5')]();var fs_extra=require(_0x72cb('0x6'));var auth=require(_0x72cb('0x7'));var interaction=require(_0x72cb('0x8'));var config=require(_0x72cb('0x9'));var controller=require(_0x72cb('0xa'));router[_0x72cb('0xb')]('/',auth['isAuthenticated'](),controller[_0x72cb('0xc')]);router['get'](_0x72cb('0xd'),auth[_0x72cb('0xe')](),controller[_0x72cb('0xf')]);router[_0x72cb('0xb')](_0x72cb('0x10'),auth[_0x72cb('0xe')](),controller[_0x72cb('0x11')]);router[_0x72cb('0xb')]('/:id/members',auth[_0x72cb('0xe')](),controller[_0x72cb('0x12')]);router[_0x72cb('0xb')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x72cb('0xb')](_0x72cb('0x13'),auth[_0x72cb('0xe')](),controller[_0x72cb('0x14')]);router[_0x72cb('0x15')]('/',auth[_0x72cb('0xe')](),controller[_0x72cb('0x16')]);router[_0x72cb('0x15')](_0x72cb('0x17'),auth[_0x72cb('0xe')](),controller[_0x72cb('0x18')]);router[_0x72cb('0x15')]('/:id/users',auth[_0x72cb('0xe')](),controller[_0x72cb('0x19')]);router[_0x72cb('0x1a')](_0x72cb('0x10'),auth['isAuthenticated'](),controller[_0x72cb('0x1b')]);router[_0x72cb('0x1c')](_0x72cb('0x10'),auth['isAuthenticated'](),controller[_0x72cb('0x1d')]);router['delete'](_0x72cb('0x17'),auth['isAuthenticated'](),controller[_0x72cb('0x1e')]);router[_0x72cb('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0x72cb('0x1f')]);module[_0x72cb('0x20')]=router; \ No newline at end of file +var _0x13fc=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents'];(function(_0x184886,_0xe1ef64){var _0x1191f1=function(_0x51166a){while(--_0x51166a){_0x184886['push'](_0x184886['shift']());}};_0x1191f1(++_0xe1ef64);}(_0x13fc,0x101));var _0xc13f=function(_0xaee808,_0x16777){_0xaee808=_0xaee808-0x0;var _0xd01918=_0x13fc[_0xaee808];return _0xd01918;};'use strict';var multer=require(_0xc13f('0x0'));var util=require(_0xc13f('0x1'));var path=require(_0xc13f('0x2'));var timeout=require(_0xc13f('0x3'));var express=require(_0xc13f('0x4'));var router=express[_0xc13f('0x5')]();var fs_extra=require(_0xc13f('0x6'));var auth=require(_0xc13f('0x7'));var interaction=require(_0xc13f('0x8'));var config=require(_0xc13f('0x9'));var controller=require(_0xc13f('0xa'));router['get']('/',auth[_0xc13f('0xb')](),controller[_0xc13f('0xc')]);router[_0xc13f('0xd')](_0xc13f('0xe'),auth[_0xc13f('0xb')](),controller['describe']);router['get'](_0xc13f('0xf'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x10')]);router['get'](_0xc13f('0x11'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x12')]);router['get'](_0xc13f('0x13'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x14')]);router[_0xc13f('0xd')](_0xc13f('0x15'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x16')]);router[_0xc13f('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc13f('0x13'),auth['isAuthenticated'](),controller[_0xc13f('0x18')]);router[_0xc13f('0x17')](_0xc13f('0x15'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x19')]);router[_0xc13f('0x1a')]('/:id',auth[_0xc13f('0xb')](),controller['update']);router['delete'](_0xc13f('0xf'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x1b')]);router[_0xc13f('0x1c')](_0xc13f('0x13'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x1d')]);router[_0xc13f('0x1c')](_0xc13f('0x15'),auth[_0xc13f('0xb')](),controller[_0xc13f('0x1e')]);module[_0xc13f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5d282a3..b99bed8 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 _0xe6ab=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x177b61,_0x33441d){var _0x274097=function(_0x29b4e6){while(--_0x29b4e6){_0x177b61['push'](_0x177b61['shift']());}};_0x274097(++_0x33441d);}(_0xe6ab,0x1b6));var _0xbe6a=function(_0x511163,_0x19f74d){_0x511163=_0x511163-0x0;var _0x421a0e=_0xe6ab[_0x511163];return _0x421a0e;};'use strict';var Sequelize=require(_0xbe6a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe6a('0x1')],'unique':_0xbe6a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbe6a('0x1')]},'timeout':{'type':Sequelize[_0xbe6a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe6a('0x4')](_0xbe6a('0x5'),_0xbe6a('0x6'),_0xbe6a('0x7'))}}; \ No newline at end of file +var _0xfbcb=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','name'];(function(_0x871397,_0x404bdb){var _0x3a76e1=function(_0x43a9a4){while(--_0x43a9a4){_0x871397['push'](_0x871397['shift']());}};_0x3a76e1(++_0x404bdb);}(_0xfbcb,0x9e));var _0xbfbc=function(_0x116541,_0x32e650){_0x116541=_0x116541-0x0;var _0x3df863=_0xfbcb[_0x116541];return _0x3df863;};'use strict';var Sequelize=require(_0xbfbc('0x0'));module[_0xbfbc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbfbc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbfbc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbfbc('0x4')](_0xbfbc('0x5'),_0xbfbc('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 2322ce5..e7bf92b 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 _0x0044=['api','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','key','where','findAll','rows','show','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','catch','update','describe','findOne','UserMailQueue','hasOwnProperty','sort','pick','MailQueueId','filter','User','findAndCountAll','UserId','createdAt','%s/%s','mailPause','updatedAt','getTeams','Team','order','nolimit','ids','Agents','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs'];(function(_0x10bba8,_0x1b5f3e){var _0x2d4615=function(_0x3a1607){while(--_0x3a1607){_0x10bba8['push'](_0x10bba8['shift']());}};_0x2d4615(++_0x1b5f3e);}(_0x0044,0xdd));var _0x4004=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x0044[_0x5b5cde];return _0x364ad2;};'use strict';var BPromise=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var _=require(_0x4004('0x2'));var squel=require('squel');var Redis=require(_0x4004('0x3'));var qs=require(_0x4004('0x4'));var logger=require('../../config/logger')(_0x4004('0x5'));var config=require(_0x4004('0x6'));var db=require('../../mysqldb')['db'];config[_0x4004('0x7')]=_[_0x4004('0x8')](config[_0x4004('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4004('0x9'))(new Redis(config['redis']));require(_0x4004('0xa'))['register'](socket);function respondWithStatusCode(_0x354349,_0x4468a0){_0x4468a0=_0x4468a0||0xcc;return function(_0x5aacfe){if(_0x5aacfe){return _0x354349[_0x4004('0xb')](_0x4468a0);}return _0x354349['status'](_0x4468a0)[_0x4004('0xc')]();};}function respondWithResult(_0x56721b,_0x2eb3c7){_0x2eb3c7=_0x2eb3c7||0xc8;return function(_0x37f18b){if(_0x37f18b){return _0x56721b[_0x4004('0xd')](_0x2eb3c7)[_0x4004('0xe')](_0x37f18b);}};}function respondWithFilteredResult(_0x1b84e2,_0x224b47){return function(_0x4b1173){if(_0x4b1173){var _0x55f392=typeof _0x224b47[_0x4004('0xf')]===_0x4004('0x10')&&typeof _0x224b47[_0x4004('0x11')]===_0x4004('0x10');var _0x2c7225=_0x4b1173[_0x4004('0x12')];var _0x16fefd=_0x55f392?0x0:_0x224b47[_0x4004('0xf')];var _0xa9b8eb=_0x55f392?_0x4b1173[_0x4004('0x12')]:_0x224b47[_0x4004('0xf')]+_0x224b47['limit'];var _0x249b69;if(_0xa9b8eb>=_0x2c7225){_0xa9b8eb=_0x2c7225;_0x249b69=0xc8;}else{_0x249b69=0xce;}_0x1b84e2[_0x4004('0xd')](_0x249b69);return _0x1b84e2['set'](_0x4004('0x13'),_0x16fefd+'-'+_0xa9b8eb+'/'+_0x2c7225)[_0x4004('0xe')](_0x4b1173);}return null;};}function saveUpdates(_0x42d536){return function(_0x355c34){if(_0x355c34){return _0x355c34['update'](_0x42d536)[_0x4004('0x14')](function(_0x1c0836){return _0x1c0836;});}return null;};}function removeEntity(_0xdfadc1){return function(_0x403019){if(_0x403019){return _0x403019[_0x4004('0x15')]()[_0x4004('0x14')](function(){var _0x1765b8=_0x403019[_0x4004('0x16')]({'plain':!![]});var _0x54a220='MailQueues';return db[_0x4004('0x17')][_0x4004('0x15')]({'where':{'type':_0x54a220,'resourceId':_0x1765b8['id']}})[_0x4004('0x14')](function(){return _0x403019;});})[_0x4004('0x14')](function(){_0xdfadc1[_0x4004('0xd')](0xcc)[_0x4004('0xc')]();});}};}function handleEntityNotFound(_0x5be77d){return function(_0x2960bc){if(!_0x2960bc){_0x5be77d[_0x4004('0xb')](0x194);}return _0x2960bc;};}function handleError(_0x393ea8,_0x2cdae6){_0x2cdae6=_0x2cdae6||0x1f4;return function(_0x46709a){logger[_0x4004('0x18')](_0x46709a[_0x4004('0x19')]);if(_0x46709a[_0x4004('0x1a')]){delete _0x46709a['name'];}_0x393ea8[_0x4004('0xd')](_0x2cdae6)[_0x4004('0x1b')](_0x46709a);};}exports[_0x4004('0x1c')]=function(_0x44dad3,_0x364e2e){var _0x3a19d2={};var _0xab330a={'count':0x0,'rows':[]};var _0x3f1374=_[_0x4004('0x1d')](db[_0x4004('0x1e')][_0x4004('0x1f')],function(_0x409093){return{'name':_0x409093['fieldName'],'type':_0x409093['type'][_0x4004('0x20')]};});_0x3a19d2=qs['getOptions'](_0x3f1374,_0x44dad3);var _0x1fc410={'where':_0x3a19d2[_0x4004('0x21')]};return db[_0x4004('0x1e')]['count'](_0x1fc410)[_0x4004('0x14')](function(_0x3c5582){_0xab330a[_0x4004('0x12')]=_0x3c5582;_0x3a19d2['include']=qs['include'](_0x44dad3['query']);return db['MailQueue'][_0x4004('0x22')](_0x3a19d2);})['then'](function(_0x4b6556){_0xab330a[_0x4004('0x23')]=_0x4b6556;return _0xab330a;})[_0x4004('0x14')](respondWithFilteredResult(_0x364e2e,_0x3a19d2))['catch'](handleError(_0x364e2e,null));};exports[_0x4004('0x24')]=function(_0x4b588f,_0xd75071){var _0x2eae73={'raw':!![],'where':{'id':_0x4b588f[_0x4004('0x25')]['id']}},_0x1c5da8={};_0x1c5da8[_0x4004('0x26')]=_[_0x4004('0x27')](db[_0x4004('0x1e')][_0x4004('0x1f')]);_0x1c5da8[_0x4004('0x28')]=_['keys'](_0x4b588f[_0x4004('0x28')]);_0x1c5da8[_0x4004('0x29')]=_[_0x4004('0x2a')](_0x1c5da8['model'],_0x1c5da8[_0x4004('0x28')]);_0x2eae73['attributes']=_['intersection'](_0x1c5da8[_0x4004('0x26')],qs[_0x4004('0x2b')](_0x4b588f[_0x4004('0x28')][_0x4004('0x2b')]));_0x2eae73['attributes']=_0x2eae73[_0x4004('0x2c')][_0x4004('0x2d')]?_0x2eae73['attributes']:_0x1c5da8[_0x4004('0x26')];if(_0x4b588f[_0x4004('0x28')][_0x4004('0x2e')]){_0x2eae73[_0x4004('0x2f')]=[{'all':!![]}];}_0x2eae73=_[_0x4004('0x30')]({},_0x2eae73,_0x4b588f[_0x4004('0x31')]);return db['MailQueue'][_0x4004('0x32')](_0x2eae73)[_0x4004('0x14')](handleEntityNotFound(_0xd75071,null))[_0x4004('0x14')](respondWithResult(_0xd75071,null))['catch'](handleError(_0xd75071,null));};exports[_0x4004('0x33')]=function(_0x4ecef5,_0x1c7a8a){return db['MailQueue']['create'](_0x4ecef5[_0x4004('0x34')],{})[_0x4004('0x14')](function(_0x4a5426){var _0xccc4c9=_0x4ecef5[_0x4004('0x35')]['get']({'plain':!![]});if(!_0xccc4c9)throw new Error(_0x4004('0x36'));if(_0xccc4c9['role']===_0x4004('0x35')){var _0x327158=_0x4a5426['get']({'plain':!![]});var _0x1682ca='MailQueues';return db[_0x4004('0x37')]['find']({'where':{'name':_0x1682ca,'userProfileId':_0xccc4c9['userProfileId']},'raw':!![]})['then'](function(_0x4c0ea7){if(_0x4c0ea7&&_0x4c0ea7['autoAssociation']===0x0){return db[_0x4004('0x17')]['create']({'name':_0x327158[_0x4004('0x1a')],'resourceId':_0x327158['id'],'type':_0x4c0ea7[_0x4004('0x1a')],'sectionId':_0x4c0ea7['id']},{})[_0x4004('0x14')](function(){return _0x4a5426;});}else{return _0x4a5426;}})[_0x4004('0x38')](function(_0x285947){logger[_0x4004('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x285947);throw _0x285947;});}return _0x4a5426;})[_0x4004('0x14')](respondWithResult(_0x1c7a8a,0xc9))[_0x4004('0x38')](handleError(_0x1c7a8a,null));};exports[_0x4004('0x39')]=function(_0x3bb940,_0x58fe14){if(_0x3bb940[_0x4004('0x34')]['id']){delete _0x3bb940[_0x4004('0x34')]['id'];}return db[_0x4004('0x1e')][_0x4004('0x32')]({'where':{'id':_0x3bb940['params']['id']}})[_0x4004('0x14')](handleEntityNotFound(_0x58fe14,null))[_0x4004('0x14')](saveUpdates(_0x3bb940['body'],null))[_0x4004('0x14')](respondWithResult(_0x58fe14,null))['catch'](handleError(_0x58fe14,null));};exports['destroy']=function(_0x269c0e,_0x367852){return db['MailQueue'][_0x4004('0x32')]({'where':{'id':_0x269c0e[_0x4004('0x25')]['id']}})['then'](handleEntityNotFound(_0x367852,null))[_0x4004('0x14')](removeEntity(_0x367852,null))['catch'](handleError(_0x367852,null));};exports['describe']=function(_0x3ffd4e,_0x3361df){return db[_0x4004('0x1e')][_0x4004('0x3a')]()[_0x4004('0x14')](respondWithResult(_0x3361df,null))[_0x4004('0x38')](handleError(_0x3361df,null));};exports['getMembers']=function(_0x2fb19b,_0x298519){var _0x5f53b9={'raw':!![],'where':{}},_0xa7bc64={},_0x15951d;return db[_0x4004('0x1e')][_0x4004('0x3b')]({'where':{'id':_0x2fb19b['params']['id']}})['then'](handleEntityNotFound(_0x298519,null))[_0x4004('0x14')](function(_0x1a651f){if(_0x1a651f){_0x15951d=_0x1a651f[_0x4004('0x16')]({'plain':!![]});_0xa7bc64['model']=_['keys'](db[_0x4004('0x3c')][_0x4004('0x1f')]);_0xa7bc64[_0x4004('0x28')]=_[_0x4004('0x27')](_0x2fb19b['query']);_0xa7bc64[_0x4004('0x29')]=_[_0x4004('0x2a')](_0xa7bc64[_0x4004('0x26')],_0xa7bc64['query']);_0x5f53b9[_0x4004('0x2c')]=_['intersection'](_0xa7bc64[_0x4004('0x26')],qs[_0x4004('0x2b')](_0x2fb19b['query'][_0x4004('0x2b')]));_0x5f53b9[_0x4004('0x2c')]=_0x5f53b9[_0x4004('0x2c')][_0x4004('0x2d')]?_0x5f53b9['attributes']:_0xa7bc64[_0x4004('0x26')];if(!_0x2fb19b['query'][_0x4004('0x3d')]('nolimit')){_0x5f53b9[_0x4004('0x11')]=qs[_0x4004('0x11')](_0x2fb19b['query'][_0x4004('0x11')]);_0x5f53b9['offset']=qs[_0x4004('0xf')](_0x2fb19b['query'][_0x4004('0xf')]);}_0x5f53b9['order']=qs[_0x4004('0x3e')](_0x2fb19b[_0x4004('0x28')]['sort']);_0x5f53b9['where']=qs['filters'](_[_0x4004('0x3f')](_0x2fb19b[_0x4004('0x28')],_0xa7bc64[_0x4004('0x29')]));_0x5f53b9[_0x4004('0x21')][_0x4004('0x40')]=_0x1a651f['id'];if(_0x2fb19b['query']['filter']){_0x5f53b9['where']=_['merge'](_0x5f53b9[_0x4004('0x21')],{'$or':_[_0x4004('0x1d')](_0x5f53b9[_0x4004('0x2c')],function(_0x1c0f29){var _0x15f8c9={};_0x15f8c9[_0x1c0f29]={'$like':'%'+_0x2fb19b['query'][_0x4004('0x41')]+'%'};return _0x15f8c9;})});}_0x5f53b9=_[_0x4004('0x30')]({},_0x5f53b9,_0x2fb19b[_0x4004('0x31')]);return db['UserMailQueue'][_0x4004('0x22')](_0x5f53b9);}})[_0x4004('0x14')](function(_0x2b4b6f){if(_0x2b4b6f){return db[_0x4004('0x42')][_0x4004('0x43')]({'where':{'id':_[_0x4004('0x1d')](_0x2b4b6f,_0x4004('0x44')),'role':'agent'},'attributes':['id',_0x4004('0x1a'),'mailPause','updatedAt',_0x4004('0x45')]});}})[_0x4004('0x14')](function(_0x1cb516){if(_0x1cb516){return{'count':_0x1cb516[_0x4004('0x12')],'rows':_[_0x4004('0x1d')](_0x1cb516[_0x4004('0x23')],function(_0xaaccf9){return{'membername':_0xaaccf9[_0x4004('0x1a')],'UserId':_0xaaccf9['id'],'queue_name':_0x15951d['name'],'MailQueueId':_0x15951d['id'],'interface':util['format'](_0x4004('0x46'),'SIP',_0xaaccf9[_0x4004('0x1a')]),'penalty':0x0,'paused':_0xaaccf9[_0x4004('0x47')],'createdAt':_0xaaccf9[_0x4004('0x45')],'updatedAt':_0xaaccf9[_0x4004('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4004('0x14')](respondWithFilteredResult(_0x298519,_0x5f53b9))[_0x4004('0x38')](handleError(_0x298519,null));};exports[_0x4004('0x49')]=function(_0xe7d3ee,_0x31df24){var _0x56b2cd={};var _0x189080={};var _0x28f4f0;var _0x2303d9;return db[_0x4004('0x1e')][_0x4004('0x3b')]({'where':{'id':_0xe7d3ee[_0x4004('0x25')]['id']}})[_0x4004('0x14')](handleEntityNotFound(_0x31df24,null))['then'](function(_0x56d68){if(_0x56d68){_0x28f4f0=_0x56d68;_0x189080[_0x4004('0x26')]=_['keys'](db[_0x4004('0x4a')]['rawAttributes']);_0x189080['query']=_['keys'](_0xe7d3ee[_0x4004('0x28')]);_0x189080[_0x4004('0x29')]=_[_0x4004('0x2a')](_0x189080['model'],_0x189080[_0x4004('0x28')]);_0x56b2cd[_0x4004('0x2c')]=_[_0x4004('0x2a')](_0x189080[_0x4004('0x26')],qs['fields'](_0xe7d3ee[_0x4004('0x28')][_0x4004('0x2b')]));_0x56b2cd[_0x4004('0x2c')]=_0x56b2cd[_0x4004('0x2c')][_0x4004('0x2d')]?_0x56b2cd[_0x4004('0x2c')]:_0x189080[_0x4004('0x26')];_0x56b2cd[_0x4004('0x4b')]=qs[_0x4004('0x3e')](_0xe7d3ee[_0x4004('0x28')]['sort']);_0x56b2cd[_0x4004('0x21')]=qs[_0x4004('0x29')](_[_0x4004('0x3f')](_0xe7d3ee[_0x4004('0x28')],_0x189080['filters']));if(_0xe7d3ee['query'][_0x4004('0x41')]){_0x56b2cd[_0x4004('0x21')]=_[_0x4004('0x30')](_0x56b2cd[_0x4004('0x21')],{'$or':_[_0x4004('0x1d')](_0x56b2cd[_0x4004('0x2c')],function(_0x47026e){var _0x519fd6={};_0x519fd6[_0x47026e]={'$like':'%'+_0xe7d3ee[_0x4004('0x28')]['filter']+'%'};return _0x519fd6;})});}_0x56b2cd=_[_0x4004('0x30')]({},_0x56b2cd,_0xe7d3ee[_0x4004('0x31')]);return _0x28f4f0[_0x4004('0x49')](_0x56b2cd);}})[_0x4004('0x14')](function(_0x120385){if(_0x120385){_0x2303d9=_0x120385[_0x4004('0x2d')];if(!_0xe7d3ee[_0x4004('0x28')]['hasOwnProperty'](_0x4004('0x4c'))){_0x56b2cd[_0x4004('0x11')]=qs[_0x4004('0x11')](_0xe7d3ee[_0x4004('0x28')]['limit']);_0x56b2cd[_0x4004('0xf')]=qs[_0x4004('0xf')](_0xe7d3ee['query'][_0x4004('0xf')]);}return _0x28f4f0[_0x4004('0x49')](_0x56b2cd);}})[_0x4004('0x14')](function(_0x1c5a49){if(_0x1c5a49){return _0x1c5a49?{'count':_0x2303d9,'rows':_0x1c5a49}:null;}})[_0x4004('0x14')](respondWithResult(_0x31df24,null))[_0x4004('0x38')](handleError(_0x31df24,null));};exports['addTeams']=function(_0x64c6dd,_0x2935f0){var _0x22067e=_0x64c6dd[_0x4004('0x34')][_0x4004('0x4d')];return db[_0x4004('0x4a')][_0x4004('0x22')]({'where':{'id':_0x22067e},'attributes':['id'],'include':[{'model':db[_0x4004('0x42')],'as':_0x4004('0x4e'),'attributes':['id',_0x4004('0x1a'),'online','voicePause',_0x4004('0x4f')],'raw':!![]}]})[_0x4004('0x14')](function(_0x2c7d74){if(_0x2c7d74){var _0xb9fad4=_['flatMap'](_0x2c7d74,function(_0x28d2e7){var _0xf79c8a=_0x28d2e7[_0x4004('0x16')]({'plain':!![]});return _0xf79c8a[_0x4004('0x4e')];});return db[_0x4004('0x1e')][_0x4004('0x32')]({'where':{'id':_0x64c6dd[_0x4004('0x25')]['id']}})[_0x4004('0x14')](function(_0x9dc320){return db[_0x4004('0x50')][_0x4004('0x51')](function(_0x40ad1a){return _0x9dc320[_0x4004('0x52')](_0x22067e,{'transaction':_0x40ad1a})['then'](function(){return BPromise[_0x4004('0x53')](_0xb9fad4,function(_0x48470e){return db[_0x4004('0x3c')][_0x4004('0x54')]({'where':{'UserId':_0x48470e['id'],'MailQueueId':_0x64c6dd['params']['id']},'transaction':_0x40ad1a});});})[_0x4004('0x14')](function(){_0xb9fad4[_0x4004('0x55')](function(_0x72e19){socket['emit']('userMailQueue:save',{'UserId':_0x72e19['id'],'MailQueueId':_0x9dc320['id']});});});});});}})[_0x4004('0x14')](respondWithStatusCode(_0x2935f0,null))[_0x4004('0x38')](handleError(_0x2935f0,null));};exports['removeTeams']=function(_0xa37fed,_0x15c7f2){return db['Team'][_0x4004('0x22')]({'where':{'id':_0xa37fed[_0x4004('0x28')][_0x4004('0x4d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4004('0x4e'),'attributes':['id'],'raw':!![]}]})[_0x4004('0x14')](handleEntityNotFound(_0x15c7f2,null))['then'](function(_0x4dfce3){var _0x32e9e1=_['map'](_0x4dfce3,'id');var _0x32d59e=[];var _0x208769=[];var _0x55cd8e=squel[_0x4004('0x56')]();_0x55cd8e['field'](_0x4004('0x57'))['from'](_0x4004('0x58'),'tq')[_0x4004('0x59')](_0x4004('0x5a'),'ut',_0x4004('0x5b'))[_0x4004('0x21')]('MailQueueId\x20=\x20?',_0xa37fed[_0x4004('0x25')]['id']);for(var _0x1993ed=0x0;_0x1993ed<_0x4dfce3[_0x4004('0x2d')];_0x1993ed+=0x1){let _0x4a8b2c=_0x4dfce3[_0x1993ed];for(var _0x4f92bd=0x0;_0x4f92bd<_0x4a8b2c[_0x4004('0x4e')][_0x4004('0x2d')];_0x4f92bd+=0x1){let _0x13b0f3=_0x4a8b2c[_0x4004('0x4e')][_0x4f92bd];var _0x4310d3=_0x55cd8e[_0x4004('0x5c')]();_0x4310d3[_0x4004('0x21')](_0x4004('0x5d'),_0x13b0f3['id']);_0x208769['push'](db[_0x4004('0x50')][_0x4004('0x28')](_0x4310d3[_0x4004('0x5e')](),{'type':db[_0x4004('0x50')][_0x4004('0x5f')][_0x4004('0x60')]})[_0x4004('0x14')](function(_0x51bea0){if(_0x51bea0[_0x4004('0x2d')]===0x1){return _0x13b0f3['id'];}else{var _0x12fe3b=_[_0x4004('0x61')](_['map'](_0x51bea0,'TeamId'),function(_0x1bcee1){return _[_0x4004('0x62')](_0x32e9e1,_0x1bcee1);});if(_0x12fe3b){return _0x13b0f3['id'];}}}));}}return BPromise[_0x4004('0x63')](_0x208769)[_0x4004('0x14')](function(_0x41a74f){_0x32d59e=_(_0x32d59e)[_0x4004('0x64')](_0x41a74f)[_0x4004('0x65')]()[_0x4004('0x66')]();return db[_0x4004('0x1e')]['find']({'where':{'id':_0xa37fed[_0x4004('0x25')]['id']}})[_0x4004('0x14')](function(_0x32caad){return db[_0x4004('0x50')]['transaction'](function(_0x58e79f){return _0x32caad[_0x4004('0x67')](_0xa37fed[_0x4004('0x28')][_0x4004('0x4d')],{'transaction':_0x58e79f})[_0x4004('0x14')](function(){if(!_[_0x4004('0x68')](_0x32d59e)){return _0x32caad[_0x4004('0x69')](_0x32d59e,{'transaction':_0x58e79f});}})[_0x4004('0x14')](function(){_0x32d59e[_0x4004('0x55')](function(_0x176734){socket[_0x4004('0x6a')](_0x4004('0x6b'),{'UserId':_0x176734,'MailQueueId':_0x32caad['id']});});});});});});})[_0x4004('0x14')](respondWithStatusCode(_0x15c7f2,null))[_0x4004('0x38')](handleError(_0x15c7f2,null));};exports[_0x4004('0x6c')]=function(_0x4710e2,_0x32926f){return db[_0x4004('0x1e')][_0x4004('0x32')]({'where':{'id':_0x4710e2[_0x4004('0x25')]['id']}})[_0x4004('0x14')](handleEntityNotFound(_0x32926f,null))['then'](function(_0x4e3651){if(_0x4e3651){return _0x4e3651[_0x4004('0x6c')](_0x4710e2['body']['ids'],_[_0x4004('0x6d')](_0x4710e2[_0x4004('0x34')],[_0x4004('0x4d'),'id'])||{})['spread'](function(_0x34bdf5){for(var _0x1d5d37=0x0;_0x1d5d37<_0x4710e2[_0x4004('0x34')][_0x4004('0x4d')][_0x4004('0x2d')];_0x1d5d37+=0x1){socket[_0x4004('0x6a')](_0x4004('0x6e'),{'UserId':Number(_0x4710e2[_0x4004('0x34')][_0x4004('0x4d')][_0x1d5d37]),'MailQueueId':Number(_0x4710e2[_0x4004('0x25')]['id'])});}return _0x34bdf5;});}})[_0x4004('0x14')](respondWithResult(_0x32926f,null))[_0x4004('0x38')](handleError(_0x32926f,null));};exports[_0x4004('0x69')]=function(_0x240a29,_0x2e8cc5){return db[_0x4004('0x1e')][_0x4004('0x32')]({'where':{'id':_0x240a29[_0x4004('0x25')]['id']}})[_0x4004('0x14')](handleEntityNotFound(_0x2e8cc5,null))[_0x4004('0x14')](function(_0x5bf8bc){if(_0x5bf8bc){return _0x5bf8bc['removeAgents'](_0x240a29[_0x4004('0x28')][_0x4004('0x4d')])[_0x4004('0x14')](function(){if(_[_0x4004('0x6f')](_0x240a29[_0x4004('0x28')][_0x4004('0x4d')])){for(var _0x496dbe=0x0;_0x496dbe<_0x240a29[_0x4004('0x28')][_0x4004('0x4d')][_0x4004('0x2d')];_0x496dbe+=0x1){socket[_0x4004('0x6a')]('userMailQueue:remove',{'UserId':Number(_0x240a29['query'][_0x4004('0x4d')][_0x496dbe]),'MailQueueId':Number(_0x240a29[_0x4004('0x25')]['id'])});}}else{socket[_0x4004('0x6a')](_0x4004('0x6b'),{'UserId':Number(_0x240a29['query'][_0x4004('0x4d')]),'MailQueueId':Number(_0x240a29['params']['id'])});}});}})[_0x4004('0x14')](respondWithStatusCode(_0x2e8cc5,null))[_0x4004('0x38')](handleError(_0x2e8cc5,null));};exports['getAgents']=function(_0x457e78,_0x586121){var _0x5e2842={};var _0x35beba={};var _0x16d251;var _0x1e6864;return db['MailQueue'][_0x4004('0x3b')]({'where':{'id':_0x457e78[_0x4004('0x25')]['id']}})[_0x4004('0x14')](handleEntityNotFound(_0x586121,null))['then'](function(_0x4d8893){if(_0x4d8893){_0x16d251=_0x4d8893;_0x35beba[_0x4004('0x26')]=_[_0x4004('0x27')](db[_0x4004('0x42')][_0x4004('0x1f')]);_0x35beba[_0x4004('0x28')]=_[_0x4004('0x27')](_0x457e78[_0x4004('0x28')]);_0x35beba[_0x4004('0x29')]=_[_0x4004('0x2a')](_0x35beba['model'],_0x35beba['query']);_0x5e2842['attributes']=_['intersection'](_0x35beba[_0x4004('0x26')],qs['fields'](_0x457e78[_0x4004('0x28')][_0x4004('0x2b')]));_0x5e2842[_0x4004('0x2c')]=_0x5e2842[_0x4004('0x2c')]['length']?_0x5e2842[_0x4004('0x2c')]:_0x35beba[_0x4004('0x26')];_0x5e2842[_0x4004('0x4b')]=qs[_0x4004('0x3e')](_0x457e78[_0x4004('0x28')][_0x4004('0x3e')]);_0x5e2842[_0x4004('0x21')]=qs[_0x4004('0x29')](_[_0x4004('0x3f')](_0x457e78[_0x4004('0x28')],_0x35beba['filters']));if(_0x457e78['query'][_0x4004('0x41')]){_0x5e2842[_0x4004('0x21')]=_[_0x4004('0x30')](_0x5e2842[_0x4004('0x21')],{'$or':_['map'](_0x5e2842[_0x4004('0x2c')],function(_0x350d9a){var _0x3c486f={};_0x3c486f[_0x350d9a]={'$like':'%'+_0x457e78[_0x4004('0x28')]['filter']+'%'};return _0x3c486f;})});}_0x5e2842=_[_0x4004('0x30')]({},_0x5e2842,_0x457e78[_0x4004('0x31')]);return _0x16d251[_0x4004('0x70')](_0x5e2842);}})[_0x4004('0x14')](function(_0x551de7){if(_0x551de7){_0x1e6864=_0x551de7[_0x4004('0x2d')];if(!_0x457e78[_0x4004('0x28')][_0x4004('0x3d')]('nolimit')){_0x5e2842['limit']=qs[_0x4004('0x11')](_0x457e78[_0x4004('0x28')][_0x4004('0x11')]);_0x5e2842[_0x4004('0xf')]=qs[_0x4004('0xf')](_0x457e78[_0x4004('0x28')][_0x4004('0xf')]);}return _0x16d251['getAgents'](_0x5e2842);}})['then'](function(_0x4d4363){if(_0x4d4363){return _0x4d4363?{'count':_0x1e6864,'rows':_0x4d4363}:null;}})['then'](respondWithResult(_0x586121,null))['catch'](handleError(_0x586121,null));}; \ No newline at end of file +var _0x4bb9=['getTeams','Team','sort','pick','nolimit','addTeams','ids','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','MailQueues','UserProfileResource','destroy','stack','name','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','show','params','keys','intersection','attributes','model','fields','includeAll','options','find','body','user','get','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','filters','length','hasOwnProperty','order','MailQueueId','filter','merge','User','map','UserId','agent','mailPause','updatedAt','rows','format','createdAt'];(function(_0x25f0d5,_0xc2dbf1){var _0x3dac6b=function(_0x6906e9){while(--_0x6906e9){_0x25f0d5['push'](_0x25f0d5['shift']());}};_0x3dac6b(++_0xc2dbf1);}(_0x4bb9,0x12c));var _0x94bb=function(_0x250f7c,_0xadc77b){_0x250f7c=_0x250f7c-0x0;var _0x395f32=_0x4bb9[_0x250f7c];return _0x395f32;};'use strict';var BPromise=require(_0x94bb('0x0'));var util=require(_0x94bb('0x1'));var _=require(_0x94bb('0x2'));var squel=require(_0x94bb('0x3'));var Redis=require(_0x94bb('0x4'));var qs=require(_0x94bb('0x5'));var logger=require(_0x94bb('0x6'))(_0x94bb('0x7'));var config=require(_0x94bb('0x8'));var db=require(_0x94bb('0x9'))['db'];config['redis']=_['defaults'](config[_0x94bb('0xa')],{'host':_0x94bb('0xb'),'port':0x18eb});var socket=require(_0x94bb('0xc'))(new Redis(config['redis']));require(_0x94bb('0xd'))[_0x94bb('0xe')](socket);function respondWithStatusCode(_0x110042,_0x3e6bef){_0x3e6bef=_0x3e6bef||0xcc;return function(_0x199c53){if(_0x199c53){return _0x110042[_0x94bb('0xf')](_0x3e6bef);}return _0x110042[_0x94bb('0x10')](_0x3e6bef)[_0x94bb('0x11')]();};}function respondWithResult(_0x18963b,_0x1a62c7){_0x1a62c7=_0x1a62c7||0xc8;return function(_0x476729){if(_0x476729){return _0x18963b[_0x94bb('0x10')](_0x1a62c7)[_0x94bb('0x12')](_0x476729);}};}function respondWithFilteredResult(_0x560094,_0x30251a){return function(_0x4625e0){if(_0x4625e0){var _0x1c98c7=typeof _0x30251a[_0x94bb('0x13')]==='undefined'&&typeof _0x30251a['limit']===_0x94bb('0x14');var _0x38fea1=_0x4625e0[_0x94bb('0x15')];var _0x48c2c3=_0x1c98c7?0x0:_0x30251a[_0x94bb('0x13')];var _0x2751ff=_0x1c98c7?_0x4625e0['count']:_0x30251a[_0x94bb('0x13')]+_0x30251a[_0x94bb('0x16')];var _0x1375f3;if(_0x2751ff>=_0x38fea1){_0x2751ff=_0x38fea1;_0x1375f3=0xc8;}else{_0x1375f3=0xce;}_0x560094[_0x94bb('0x10')](_0x1375f3);return _0x560094[_0x94bb('0x17')](_0x94bb('0x18'),_0x48c2c3+'-'+_0x2751ff+'/'+_0x38fea1)[_0x94bb('0x12')](_0x4625e0);}return null;};}function saveUpdates(_0x709b4f){return function(_0x20ccd7){if(_0x20ccd7){return _0x20ccd7['update'](_0x709b4f)[_0x94bb('0x19')](function(_0x2fb250){return _0x2fb250;});}return null;};}function removeEntity(_0x5ed1d6){return function(_0x2f33ea){if(_0x2f33ea){return _0x2f33ea['destroy']()[_0x94bb('0x19')](function(){var _0x269176=_0x2f33ea['get']({'plain':!![]});var _0x2fd3a1=_0x94bb('0x1a');return db[_0x94bb('0x1b')][_0x94bb('0x1c')]({'where':{'type':_0x2fd3a1,'resourceId':_0x269176['id']}})[_0x94bb('0x19')](function(){return _0x2f33ea;});})[_0x94bb('0x19')](function(){_0x5ed1d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b0e4){return function(_0x5189c7){if(!_0x5189c7){_0x11b0e4[_0x94bb('0xf')](0x194);}return _0x5189c7;};}function handleError(_0x182599,_0x16bc15){_0x16bc15=_0x16bc15||0x1f4;return function(_0x294047){logger['error'](_0x294047[_0x94bb('0x1d')]);if(_0x294047[_0x94bb('0x1e')]){delete _0x294047[_0x94bb('0x1e')];}_0x182599['status'](_0x16bc15)['send'](_0x294047);};}exports['index']=function(_0xe56e57,_0x3ea73a){var _0x405ca9={};var _0x5d3be4={'count':0x0,'rows':[]};var _0x7ebd4=_['map'](db[_0x94bb('0x1f')][_0x94bb('0x20')],function(_0x190a18){return{'name':_0x190a18[_0x94bb('0x21')],'type':_0x190a18[_0x94bb('0x22')][_0x94bb('0x23')]};});_0x405ca9=qs[_0x94bb('0x24')](_0x7ebd4,_0xe56e57);var _0x45f6da={'where':_0x405ca9[_0x94bb('0x25')]};return db['MailQueue'][_0x94bb('0x15')](_0x45f6da)[_0x94bb('0x19')](function(_0x4ea5ff){_0x5d3be4[_0x94bb('0x15')]=_0x4ea5ff;_0x405ca9['include']=qs[_0x94bb('0x26')](_0xe56e57[_0x94bb('0x27')]);return db['MailQueue'][_0x94bb('0x28')](_0x405ca9);})[_0x94bb('0x19')](function(_0x28971e){_0x5d3be4['rows']=_0x28971e;return _0x5d3be4;})[_0x94bb('0x19')](respondWithFilteredResult(_0x3ea73a,_0x405ca9))['catch'](handleError(_0x3ea73a,null));};exports[_0x94bb('0x29')]=function(_0x2b0e87,_0x48a233){var _0x5864be={'raw':!![],'where':{'id':_0x2b0e87[_0x94bb('0x2a')]['id']}},_0x231e89={};_0x231e89['model']=_[_0x94bb('0x2b')](db[_0x94bb('0x1f')][_0x94bb('0x20')]);_0x231e89[_0x94bb('0x27')]=_[_0x94bb('0x2b')](_0x2b0e87[_0x94bb('0x27')]);_0x231e89['filters']=_[_0x94bb('0x2c')](_0x231e89['model'],_0x231e89[_0x94bb('0x27')]);_0x5864be[_0x94bb('0x2d')]=_[_0x94bb('0x2c')](_0x231e89[_0x94bb('0x2e')],qs[_0x94bb('0x2f')](_0x2b0e87[_0x94bb('0x27')][_0x94bb('0x2f')]));_0x5864be['attributes']=_0x5864be['attributes']['length']?_0x5864be['attributes']:_0x231e89[_0x94bb('0x2e')];if(_0x2b0e87[_0x94bb('0x27')][_0x94bb('0x30')]){_0x5864be[_0x94bb('0x26')]=[{'all':!![]}];}_0x5864be=_['merge']({},_0x5864be,_0x2b0e87[_0x94bb('0x31')]);return db[_0x94bb('0x1f')][_0x94bb('0x32')](_0x5864be)[_0x94bb('0x19')](handleEntityNotFound(_0x48a233,null))[_0x94bb('0x19')](respondWithResult(_0x48a233,null))['catch'](handleError(_0x48a233,null));};exports['create']=function(_0x5745c9,_0x426c72){return db[_0x94bb('0x1f')]['create'](_0x5745c9[_0x94bb('0x33')],{})[_0x94bb('0x19')](function(_0x34d7e6){var _0x4dedbc=_0x5745c9[_0x94bb('0x34')][_0x94bb('0x35')]({'plain':!![]});if(!_0x4dedbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dedbc['role']===_0x94bb('0x34')){var _0x95d145=_0x34d7e6[_0x94bb('0x35')]({'plain':!![]});var _0xd306fd=_0x94bb('0x1a');return db['UserProfileSection'][_0x94bb('0x32')]({'where':{'name':_0xd306fd,'userProfileId':_0x4dedbc[_0x94bb('0x36')]},'raw':!![]})[_0x94bb('0x19')](function(_0x364759){if(_0x364759&&_0x364759[_0x94bb('0x37')]===0x0){return db['UserProfileResource'][_0x94bb('0x38')]({'name':_0x95d145[_0x94bb('0x1e')],'resourceId':_0x95d145['id'],'type':_0x364759[_0x94bb('0x1e')],'sectionId':_0x364759['id']},{})['then'](function(){return _0x34d7e6;});}else{return _0x34d7e6;}})[_0x94bb('0x39')](function(_0x8a408){logger[_0x94bb('0x3a')](_0x94bb('0x3b'),_0x8a408);throw _0x8a408;});}return _0x34d7e6;})[_0x94bb('0x19')](respondWithResult(_0x426c72,0xc9))[_0x94bb('0x39')](handleError(_0x426c72,null));};exports[_0x94bb('0x3c')]=function(_0x3e419a,_0x152ab1){if(_0x3e419a[_0x94bb('0x33')]['id']){delete _0x3e419a[_0x94bb('0x33')]['id'];}return db[_0x94bb('0x1f')]['find']({'where':{'id':_0x3e419a[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x152ab1,null))[_0x94bb('0x19')](saveUpdates(_0x3e419a[_0x94bb('0x33')],null))[_0x94bb('0x19')](respondWithResult(_0x152ab1,null))[_0x94bb('0x39')](handleError(_0x152ab1,null));};exports[_0x94bb('0x1c')]=function(_0x396eee,_0x243bcb){return db['MailQueue'][_0x94bb('0x32')]({'where':{'id':_0x396eee[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x243bcb,null))[_0x94bb('0x19')](removeEntity(_0x243bcb,null))['catch'](handleError(_0x243bcb,null));};exports[_0x94bb('0x3d')]=function(_0x3e5265,_0x44b9a8){return db[_0x94bb('0x1f')][_0x94bb('0x3d')]()[_0x94bb('0x19')](respondWithResult(_0x44b9a8,null))[_0x94bb('0x39')](handleError(_0x44b9a8,null));};exports[_0x94bb('0x3e')]=function(_0x2d48c4,_0x6d4e10){var _0x9755c7={'raw':!![],'where':{}},_0x422373={},_0x4a2712;return db['MailQueue'][_0x94bb('0x3f')]({'where':{'id':_0x2d48c4[_0x94bb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x6d4e10,null))[_0x94bb('0x19')](function(_0xd4cb9d){if(_0xd4cb9d){_0x4a2712=_0xd4cb9d[_0x94bb('0x35')]({'plain':!![]});_0x422373[_0x94bb('0x2e')]=_[_0x94bb('0x2b')](db[_0x94bb('0x40')][_0x94bb('0x20')]);_0x422373[_0x94bb('0x27')]=_['keys'](_0x2d48c4['query']);_0x422373[_0x94bb('0x41')]=_[_0x94bb('0x2c')](_0x422373[_0x94bb('0x2e')],_0x422373['query']);_0x9755c7[_0x94bb('0x2d')]=_['intersection'](_0x422373['model'],qs[_0x94bb('0x2f')](_0x2d48c4[_0x94bb('0x27')]['fields']));_0x9755c7[_0x94bb('0x2d')]=_0x9755c7['attributes'][_0x94bb('0x42')]?_0x9755c7[_0x94bb('0x2d')]:_0x422373[_0x94bb('0x2e')];if(!_0x2d48c4[_0x94bb('0x27')][_0x94bb('0x43')]('nolimit')){_0x9755c7[_0x94bb('0x16')]=qs['limit'](_0x2d48c4[_0x94bb('0x27')][_0x94bb('0x16')]);_0x9755c7[_0x94bb('0x13')]=qs[_0x94bb('0x13')](_0x2d48c4[_0x94bb('0x27')]['offset']);}_0x9755c7[_0x94bb('0x44')]=qs['sort'](_0x2d48c4['query']['sort']);_0x9755c7[_0x94bb('0x25')]=qs['filters'](_['pick'](_0x2d48c4[_0x94bb('0x27')],_0x422373[_0x94bb('0x41')]));_0x9755c7[_0x94bb('0x25')][_0x94bb('0x45')]=_0xd4cb9d['id'];if(_0x2d48c4[_0x94bb('0x27')][_0x94bb('0x46')]){_0x9755c7[_0x94bb('0x25')]=_[_0x94bb('0x47')](_0x9755c7[_0x94bb('0x25')],{'$or':_['map'](_0x9755c7[_0x94bb('0x2d')],function(_0x140fb0){var _0x57f50b={};_0x57f50b[_0x140fb0]={'$like':'%'+_0x2d48c4[_0x94bb('0x27')]['filter']+'%'};return _0x57f50b;})});}_0x9755c7=_[_0x94bb('0x47')]({},_0x9755c7,_0x2d48c4[_0x94bb('0x31')]);return db[_0x94bb('0x40')][_0x94bb('0x28')](_0x9755c7);}})['then'](function(_0x4a441f){if(_0x4a441f){return db[_0x94bb('0x48')]['findAndCountAll']({'where':{'id':_[_0x94bb('0x49')](_0x4a441f,_0x94bb('0x4a')),'role':_0x94bb('0x4b')},'attributes':['id',_0x94bb('0x1e'),_0x94bb('0x4c'),_0x94bb('0x4d'),'createdAt']});}})[_0x94bb('0x19')](function(_0x4510d7){if(_0x4510d7){return{'count':_0x4510d7[_0x94bb('0x15')],'rows':_['map'](_0x4510d7[_0x94bb('0x4e')],function(_0x4fd3c9){return{'membername':_0x4fd3c9[_0x94bb('0x1e')],'UserId':_0x4fd3c9['id'],'queue_name':_0x4a2712[_0x94bb('0x1e')],'MailQueueId':_0x4a2712['id'],'interface':util[_0x94bb('0x4f')]('%s/%s','SIP',_0x4fd3c9[_0x94bb('0x1e')]),'penalty':0x0,'paused':_0x4fd3c9['mailPause'],'createdAt':_0x4fd3c9[_0x94bb('0x50')],'updatedAt':_0x4fd3c9[_0x94bb('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x94bb('0x19')](respondWithFilteredResult(_0x6d4e10,_0x9755c7))[_0x94bb('0x39')](handleError(_0x6d4e10,null));};exports[_0x94bb('0x51')]=function(_0x369442,_0x5f0bca){var _0x4d084f={};var _0x390d72={};var _0x21dcd8;var _0x2f188e;return db[_0x94bb('0x1f')][_0x94bb('0x3f')]({'where':{'id':_0x369442[_0x94bb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5f0bca,null))[_0x94bb('0x19')](function(_0x2b4113){if(_0x2b4113){_0x21dcd8=_0x2b4113;_0x390d72[_0x94bb('0x2e')]=_[_0x94bb('0x2b')](db[_0x94bb('0x52')][_0x94bb('0x20')]);_0x390d72[_0x94bb('0x27')]=_[_0x94bb('0x2b')](_0x369442[_0x94bb('0x27')]);_0x390d72['filters']=_[_0x94bb('0x2c')](_0x390d72[_0x94bb('0x2e')],_0x390d72[_0x94bb('0x27')]);_0x4d084f[_0x94bb('0x2d')]=_['intersection'](_0x390d72[_0x94bb('0x2e')],qs[_0x94bb('0x2f')](_0x369442['query'][_0x94bb('0x2f')]));_0x4d084f[_0x94bb('0x2d')]=_0x4d084f[_0x94bb('0x2d')]['length']?_0x4d084f[_0x94bb('0x2d')]:_0x390d72[_0x94bb('0x2e')];_0x4d084f[_0x94bb('0x44')]=qs[_0x94bb('0x53')](_0x369442[_0x94bb('0x27')]['sort']);_0x4d084f[_0x94bb('0x25')]=qs['filters'](_[_0x94bb('0x54')](_0x369442[_0x94bb('0x27')],_0x390d72[_0x94bb('0x41')]));if(_0x369442[_0x94bb('0x27')]['filter']){_0x4d084f[_0x94bb('0x25')]=_[_0x94bb('0x47')](_0x4d084f['where'],{'$or':_['map'](_0x4d084f[_0x94bb('0x2d')],function(_0x156b67){var _0x2027d1={};_0x2027d1[_0x156b67]={'$like':'%'+_0x369442[_0x94bb('0x27')]['filter']+'%'};return _0x2027d1;})});}_0x4d084f=_[_0x94bb('0x47')]({},_0x4d084f,_0x369442['options']);return _0x21dcd8[_0x94bb('0x51')](_0x4d084f);}})['then'](function(_0x3b2e18){if(_0x3b2e18){_0x2f188e=_0x3b2e18['length'];if(!_0x369442[_0x94bb('0x27')][_0x94bb('0x43')](_0x94bb('0x55'))){_0x4d084f['limit']=qs['limit'](_0x369442[_0x94bb('0x27')]['limit']);_0x4d084f['offset']=qs[_0x94bb('0x13')](_0x369442[_0x94bb('0x27')][_0x94bb('0x13')]);}return _0x21dcd8[_0x94bb('0x51')](_0x4d084f);}})[_0x94bb('0x19')](function(_0x580682){if(_0x580682){return _0x580682?{'count':_0x2f188e,'rows':_0x580682}:null;}})['then'](respondWithResult(_0x5f0bca,null))[_0x94bb('0x39')](handleError(_0x5f0bca,null));};exports[_0x94bb('0x56')]=function(_0x57fe68,_0x2d2710){var _0x16aa47=_0x57fe68['body'][_0x94bb('0x57')];return db[_0x94bb('0x52')][_0x94bb('0x28')]({'where':{'id':_0x16aa47},'attributes':['id'],'include':[{'model':db[_0x94bb('0x48')],'as':'Agents','attributes':['id','name',_0x94bb('0x58'),_0x94bb('0x59'),_0x94bb('0x5a')],'raw':!![]}]})[_0x94bb('0x19')](function(_0x572189){if(_0x572189){var _0xb55a8=_['flatMap'](_0x572189,function(_0x2beca1){var _0x13095b=_0x2beca1[_0x94bb('0x35')]({'plain':!![]});return _0x13095b[_0x94bb('0x5b')];});return db[_0x94bb('0x1f')][_0x94bb('0x32')]({'where':{'id':_0x57fe68[_0x94bb('0x2a')]['id']}})['then'](function(_0x76a38e){return db[_0x94bb('0x5c')][_0x94bb('0x5d')](function(_0x5246ea){return _0x76a38e[_0x94bb('0x56')](_0x16aa47,{'transaction':_0x5246ea})[_0x94bb('0x19')](function(){return BPromise[_0x94bb('0x5e')](_0xb55a8,function(_0xabda5d){return db['UserMailQueue'][_0x94bb('0x5f')]({'where':{'UserId':_0xabda5d['id'],'MailQueueId':_0x57fe68[_0x94bb('0x2a')]['id']},'transaction':_0x5246ea});});})['then'](function(){_0xb55a8[_0x94bb('0x60')](function(_0x2c7b8e){socket['emit'](_0x94bb('0x61'),{'UserId':_0x2c7b8e['id'],'MailQueueId':_0x76a38e['id']});});});});});}})['then'](respondWithStatusCode(_0x2d2710,null))[_0x94bb('0x39')](handleError(_0x2d2710,null));};exports[_0x94bb('0x62')]=function(_0x43db6d,_0x391c5f){return db[_0x94bb('0x52')]['findAll']({'where':{'id':_0x43db6d['query'][_0x94bb('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x94bb('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x94bb('0x19')](handleEntityNotFound(_0x391c5f,null))[_0x94bb('0x19')](function(_0x3cd93c){var _0x57c904=_[_0x94bb('0x49')](_0x3cd93c,'id');var _0x3d7270=[];var _0x2e0602=[];var _0x28e0f6=squel[_0x94bb('0x63')]();_0x28e0f6[_0x94bb('0x64')](_0x94bb('0x65'))['from'](_0x94bb('0x66'),'tq')[_0x94bb('0x67')](_0x94bb('0x68'),'ut',_0x94bb('0x69'))['where'](_0x94bb('0x6a'),_0x43db6d['params']['id']);for(var _0x8d7a13=0x0;_0x8d7a13<_0x3cd93c[_0x94bb('0x42')];_0x8d7a13+=0x1){let _0x5c3a1c=_0x3cd93c[_0x8d7a13];for(var _0x3c111c=0x0;_0x3c111c<_0x5c3a1c[_0x94bb('0x5b')][_0x94bb('0x42')];_0x3c111c+=0x1){let _0x1c1602=_0x5c3a1c['Agents'][_0x3c111c];var _0x31900a=_0x28e0f6[_0x94bb('0x6b')]();_0x31900a[_0x94bb('0x25')](_0x94bb('0x6c'),_0x1c1602['id']);_0x2e0602[_0x94bb('0x6d')](db['sequelize'][_0x94bb('0x27')](_0x31900a[_0x94bb('0x6e')](),{'type':db[_0x94bb('0x5c')][_0x94bb('0x6f')][_0x94bb('0x70')]})[_0x94bb('0x19')](function(_0x53faac){if(_0x53faac[_0x94bb('0x42')]===0x1){return _0x1c1602['id'];}else{var _0x3ef217=_[_0x94bb('0x71')](_['map'](_0x53faac,_0x94bb('0x72')),function(_0x899edd){return _[_0x94bb('0x73')](_0x57c904,_0x899edd);});if(_0x3ef217){return _0x1c1602['id'];}}}));}}return BPromise[_0x94bb('0x74')](_0x2e0602)[_0x94bb('0x19')](function(_0x267720){_0x3d7270=_(_0x3d7270)['union'](_0x267720)[_0x94bb('0x75')]()[_0x94bb('0x76')]();return db[_0x94bb('0x1f')][_0x94bb('0x32')]({'where':{'id':_0x43db6d[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](function(_0x25c783){return db[_0x94bb('0x5c')][_0x94bb('0x5d')](function(_0x42acaa){return _0x25c783['removeTeams'](_0x43db6d[_0x94bb('0x27')][_0x94bb('0x57')],{'transaction':_0x42acaa})[_0x94bb('0x19')](function(){if(!_['isEmpty'](_0x3d7270)){return _0x25c783[_0x94bb('0x77')](_0x3d7270,{'transaction':_0x42acaa});}})['then'](function(){_0x3d7270[_0x94bb('0x60')](function(_0x1e5080){socket[_0x94bb('0x78')](_0x94bb('0x79'),{'UserId':_0x1e5080,'MailQueueId':_0x25c783['id']});});});});});});})['then'](respondWithStatusCode(_0x391c5f,null))[_0x94bb('0x39')](handleError(_0x391c5f,null));};exports['addAgents']=function(_0x2660f6,_0x5bb08e){return db[_0x94bb('0x1f')]['find']({'where':{'id':_0x2660f6[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x5bb08e,null))[_0x94bb('0x19')](function(_0x24cd58){if(_0x24cd58){return _0x24cd58[_0x94bb('0x7a')](_0x2660f6[_0x94bb('0x33')][_0x94bb('0x57')],_[_0x94bb('0x7b')](_0x2660f6[_0x94bb('0x33')],['ids','id'])||{})[_0x94bb('0x7c')](function(_0x250031){for(var _0xaff4fd=0x0;_0xaff4fd<_0x2660f6[_0x94bb('0x33')]['ids'][_0x94bb('0x42')];_0xaff4fd+=0x1){socket['emit'](_0x94bb('0x61'),{'UserId':Number(_0x2660f6[_0x94bb('0x33')][_0x94bb('0x57')][_0xaff4fd]),'MailQueueId':Number(_0x2660f6['params']['id'])});}return _0x250031;});}})['then'](respondWithResult(_0x5bb08e,null))[_0x94bb('0x39')](handleError(_0x5bb08e,null));};exports[_0x94bb('0x77')]=function(_0x3cc504,_0x372560){return db[_0x94bb('0x1f')][_0x94bb('0x32')]({'where':{'id':_0x3cc504[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x372560,null))['then'](function(_0x3fcae9){if(_0x3fcae9){return _0x3fcae9[_0x94bb('0x77')](_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')])['then'](function(){if(_[_0x94bb('0x7d')](_0x3cc504['query']['ids'])){for(var _0x4cf002=0x0;_0x4cf002<_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')][_0x94bb('0x42')];_0x4cf002+=0x1){socket['emit'](_0x94bb('0x79'),{'UserId':Number(_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')][_0x4cf002]),'MailQueueId':Number(_0x3cc504[_0x94bb('0x2a')]['id'])});}}else{socket['emit'](_0x94bb('0x79'),{'UserId':Number(_0x3cc504[_0x94bb('0x27')][_0x94bb('0x57')]),'MailQueueId':Number(_0x3cc504[_0x94bb('0x2a')]['id'])});}});}})[_0x94bb('0x19')](respondWithStatusCode(_0x372560,null))[_0x94bb('0x39')](handleError(_0x372560,null));};exports[_0x94bb('0x7e')]=function(_0x525e51,_0x1b4114){var _0x3fd4f7={};var _0x3947a2={};var _0x41fc8b;var _0x224aea;return db[_0x94bb('0x1f')]['findOne']({'where':{'id':_0x525e51[_0x94bb('0x2a')]['id']}})[_0x94bb('0x19')](handleEntityNotFound(_0x1b4114,null))['then'](function(_0x3933a8){if(_0x3933a8){_0x41fc8b=_0x3933a8;_0x3947a2[_0x94bb('0x2e')]=_['keys'](db[_0x94bb('0x48')]['rawAttributes']);_0x3947a2['query']=_['keys'](_0x525e51[_0x94bb('0x27')]);_0x3947a2[_0x94bb('0x41')]=_[_0x94bb('0x2c')](_0x3947a2[_0x94bb('0x2e')],_0x3947a2[_0x94bb('0x27')]);_0x3fd4f7[_0x94bb('0x2d')]=_[_0x94bb('0x2c')](_0x3947a2[_0x94bb('0x2e')],qs[_0x94bb('0x2f')](_0x525e51[_0x94bb('0x27')]['fields']));_0x3fd4f7[_0x94bb('0x2d')]=_0x3fd4f7['attributes']['length']?_0x3fd4f7['attributes']:_0x3947a2[_0x94bb('0x2e')];_0x3fd4f7[_0x94bb('0x44')]=qs[_0x94bb('0x53')](_0x525e51[_0x94bb('0x27')][_0x94bb('0x53')]);_0x3fd4f7['where']=qs[_0x94bb('0x41')](_[_0x94bb('0x54')](_0x525e51[_0x94bb('0x27')],_0x3947a2['filters']));if(_0x525e51[_0x94bb('0x27')][_0x94bb('0x46')]){_0x3fd4f7[_0x94bb('0x25')]=_[_0x94bb('0x47')](_0x3fd4f7[_0x94bb('0x25')],{'$or':_[_0x94bb('0x49')](_0x3fd4f7[_0x94bb('0x2d')],function(_0xea8bc3){var _0x3461d8={};_0x3461d8[_0xea8bc3]={'$like':'%'+_0x525e51[_0x94bb('0x27')][_0x94bb('0x46')]+'%'};return _0x3461d8;})});}_0x3fd4f7=_[_0x94bb('0x47')]({},_0x3fd4f7,_0x525e51['options']);return _0x41fc8b[_0x94bb('0x7e')](_0x3fd4f7);}})['then'](function(_0x169e0a){if(_0x169e0a){_0x224aea=_0x169e0a['length'];if(!_0x525e51['query'][_0x94bb('0x43')]('nolimit')){_0x3fd4f7[_0x94bb('0x16')]=qs[_0x94bb('0x16')](_0x525e51[_0x94bb('0x27')]['limit']);_0x3fd4f7['offset']=qs[_0x94bb('0x13')](_0x525e51['query']['offset']);}return _0x41fc8b[_0x94bb('0x7e')](_0x3fd4f7);}})[_0x94bb('0x19')](function(_0x1fabbd){if(_0x1fabbd){return _0x1fabbd?{'count':_0x224aea,'rows':_0x1fabbd}:null;}})[_0x94bb('0x19')](respondWithResult(_0x1b4114,null))[_0x94bb('0x39')](handleError(_0x1b4114,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3d0f392..77ec930 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 _0x8f66=['hook','exports','MailQueue','setMaxListeners','update','remove','emit'];(function(_0xfb3184,_0x4628ae){var _0x4a1e24=function(_0x386291){while(--_0x386291){_0xfb3184['push'](_0xfb3184['shift']());}};_0x4a1e24(++_0x4628ae);}(_0x8f66,0xe2));var _0x68f6=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x8f66[_0x4a6156];return _0x12c1f6;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x68f6('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x68f6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x68f6('0x2'),'afterDestroy':_0x68f6('0x3')};function emitEvent(_0x87bd11){return function(_0x56fab7,_0x8fae23,_0xb51991){MailQueueEvents['emit'](_0x87bd11+':'+_0x56fab7['id'],_0x56fab7);MailQueueEvents[_0x68f6('0x4')](_0x87bd11,_0x56fab7);_0xb51991(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x68f6('0x5')](e,emitEvent(event));}}module[_0x68f6('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x4ad5=['emit','hasOwnProperty','hook','exports','events','MailQueue','save','remove'];(function(_0x4f6d44,_0xa5ff6d){var _0x2f47e8=function(_0x290345){while(--_0x290345){_0x4f6d44['push'](_0x4f6d44['shift']());}};_0x2f47e8(++_0xa5ff6d);}(_0x4ad5,0x74));var _0x54ad=function(_0x34e7cc,_0x2a3126){_0x34e7cc=_0x34e7cc-0x0;var _0x68015e=_0x4ad5[_0x34e7cc];return _0x68015e;};'use strict';var EventEmitter=require(_0x54ad('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x54ad('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x54ad('0x2'),'afterUpdate':'update','afterDestroy':_0x54ad('0x3')};function emitEvent(_0x11f113){return function(_0x276ff5,_0x2bee06,_0x56eb8d){MailQueueEvents[_0x54ad('0x4')](_0x11f113+':'+_0x276ff5['id'],_0x276ff5);MailQueueEvents['emit'](_0x11f113,_0x276ff5);_0x56eb8d(null);};}for(var e in events){if(events[_0x54ad('0x5')](e)){var event=events[e];MailQueue[_0x54ad('0x6')](e,emitEvent(event));}}module[_0x54ad('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5727f1e..01fd6d6 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 _0x07d1=['rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x07d1,0x16e));var _0x107d=function(_0x1b5080,_0x3e7cc9){_0x1b5080=_0x1b5080-0x0;var _0x195c87=_0x07d1[_0x1b5080];return _0x195c87;};'use strict';var _=require(_0x107d('0x0'));var util=require(_0x107d('0x1'));var logger=require(_0x107d('0x2'))('api');var moment=require(_0x107d('0x3'));var BPromise=require(_0x107d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x107d('0x5'));var rimraf=require(_0x107d('0x6'));var config=require('../../config/environment');var attributes=require(_0x107d('0x7'));module[_0x107d('0x8')]=function(_0x2ddf6f,_0x17317b){return _0x2ddf6f[_0x107d('0x9')](_0x107d('0xa'),attributes,{'tableName':_0x107d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3868=['bluebird','request-promise','path','./mailQueue.attributes','exports','mail_queues','util','../../config/logger','api'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x3868,0x12f));var _0x8386=function(_0x37226f,_0x3687ac){_0x37226f=_0x37226f-0x0;var _0x2683a7=_0x3868[_0x37226f];return _0x2683a7;};'use strict';var _=require('lodash');var util=require(_0x8386('0x0'));var logger=require(_0x8386('0x1'))(_0x8386('0x2'));var moment=require('moment');var BPromise=require(_0x8386('0x3'));var rp=require(_0x8386('0x4'));var fs=require('fs');var path=require(_0x8386('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8386('0x6'));module[_0x8386('0x7')]=function(_0x12002e,_0x1b237b){return _0x12002e['define']('MailQueue',attributes,{'tableName':_0x8386('0x8'),'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 3a09375..07ce7b8 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 _0x0d77=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','options','raw','where','limit','map','model','attributes','include','ShowMailQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then'];(function(_0x48ce9e,_0x54b134){var _0x1363a6=function(_0x43a787){while(--_0x43a787){_0x48ce9e['push'](_0x48ce9e['shift']());}};_0x1363a6(++_0x54b134);}(_0x0d77,0x8b));var _0x70d7=function(_0x462c9c,_0x4c3ee7){_0x462c9c=_0x462c9c-0x0;var _0x507aca=_0x0d77[_0x462c9c];return _0x507aca;};'use strict';var _=require(_0x70d7('0x0'));var util=require(_0x70d7('0x1'));var moment=require(_0x70d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x70d7('0x3'));var fs=require('fs');var Redis=require(_0x70d7('0x4'));var db=require(_0x70d7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x70d7('0x6'))(_0x70d7('0x7'));var config=require('../../config/environment');var jayson=require(_0x70d7('0x8'));var client=jayson[_0x70d7('0x9')][_0x70d7('0xa')]({'port':0x232a});config[_0x70d7('0xb')]=_[_0x70d7('0xc')](config['redis'],{'host':_0x70d7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70d7('0xb')]));require('./mailQueue.socket')[_0x70d7('0xe')](socket);function respondWithRpcPromise(_0x48ef72,_0x17deb1,_0x41b16b){return new BPromise(function(_0x9415bf,_0x498f75){return client[_0x70d7('0xf')](_0x48ef72,_0x41b16b)[_0x70d7('0x10')](function(_0x578ef4){logger['info'](_0x70d7('0x11'),_0x17deb1,_0x70d7('0x12'));logger[_0x70d7('0x13')](_0x70d7('0x14'),_0x17deb1,_0x70d7('0x12'),JSON[_0x70d7('0x15')](_0x578ef4));if(_0x578ef4[_0x70d7('0x16')]){if(_0x578ef4[_0x70d7('0x16')][_0x70d7('0x17')]===0x1f4){logger[_0x70d7('0x16')]('MailQueue,\x20%s,\x20%s',_0x17deb1,_0x578ef4[_0x70d7('0x16')][_0x70d7('0x18')]);return _0x498f75(_0x578ef4['error'][_0x70d7('0x18')]);}logger[_0x70d7('0x16')]('MailQueue,\x20%s,\x20%s',_0x17deb1,_0x578ef4['error']['message']);return _0x9415bf(_0x578ef4[_0x70d7('0x16')][_0x70d7('0x18')]);}else{logger[_0x70d7('0x19')](_0x70d7('0x11'),_0x17deb1,_0x70d7('0x12'));_0x9415bf(_0x578ef4[_0x70d7('0x1a')][_0x70d7('0x18')]);}})[_0x70d7('0x1b')](function(_0x5761ba){logger[_0x70d7('0x16')]('MailQueue,\x20%s,\x20%s',_0x17deb1,_0x5761ba);_0x498f75(_0x5761ba);});});}exports[_0x70d7('0x1c')]=function(_0x1c5d8c){var _0x5595aa=this;return new Promise(function(_0x34361d,_0x5f338d){return db[_0x70d7('0x1d')]['findAll']({'raw':_0x1c5d8c[_0x70d7('0x1e')]?_0x1c5d8c[_0x70d7('0x1e')][_0x70d7('0x1f')]===undefined?!![]:![]:!![],'where':_0x1c5d8c[_0x70d7('0x1e')]?_0x1c5d8c[_0x70d7('0x1e')][_0x70d7('0x20')]||null:null,'attributes':_0x1c5d8c[_0x70d7('0x1e')]?_0x1c5d8c[_0x70d7('0x1e')]['attributes']||null:null,'limit':_0x1c5d8c['options']?_0x1c5d8c[_0x70d7('0x1e')][_0x70d7('0x21')]||null:null,'include':_0x1c5d8c[_0x70d7('0x1e')]?_0x1c5d8c[_0x70d7('0x1e')]['include']?_[_0x70d7('0x22')](_0x1c5d8c[_0x70d7('0x1e')]['include'],function(_0x57e98c){return{'model':db[_0x57e98c[_0x70d7('0x23')]],'as':_0x57e98c['as'],'attributes':_0x57e98c[_0x70d7('0x24')],'include':_0x57e98c[_0x70d7('0x25')]?_[_0x70d7('0x22')](_0x57e98c[_0x70d7('0x25')],function(_0x1c3a9d){return{'model':db[_0x1c3a9d[_0x70d7('0x23')]],'as':_0x1c3a9d['as'],'attributes':_0x1c3a9d[_0x70d7('0x24')],'include':_0x1c3a9d[_0x70d7('0x25')]?_['map'](_0x1c3a9d[_0x70d7('0x25')],function(_0x5e9b43){return{'model':db[_0x5e9b43['model']],'as':_0x5e9b43['as'],'attributes':_0x5e9b43[_0x70d7('0x24')]};}):[]};}):[]};}):[]:[]})[_0x70d7('0x10')](function(_0x1ce4a0){logger[_0x70d7('0x19')](_0x70d7('0x1c'),_0x1c5d8c);logger[_0x70d7('0x13')](_0x70d7('0x1c'),_0x1c5d8c,JSON[_0x70d7('0x15')](_0x1ce4a0));_0x34361d(_0x1ce4a0);})[_0x70d7('0x1b')](function(_0xa4a84c){logger[_0x70d7('0x16')](_0x70d7('0x1c'),_0xa4a84c[_0x70d7('0x18')],_0x1c5d8c);_0x5f338d(_0x5595aa[_0x70d7('0x16')](0x1f4,_0xa4a84c['message']));});});};exports[_0x70d7('0x26')]=function(_0x2d29bd){var _0x1a84a9=this;return new Promise(function(_0x1b824f,_0x3d0814){return db[_0x70d7('0x1d')]['find']({'raw':_0x2d29bd[_0x70d7('0x1e')]?_0x2d29bd[_0x70d7('0x1e')][_0x70d7('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d29bd[_0x70d7('0x1e')]?_0x2d29bd[_0x70d7('0x1e')][_0x70d7('0x20')]||null:null,'attributes':_0x2d29bd[_0x70d7('0x1e')]?_0x2d29bd[_0x70d7('0x1e')][_0x70d7('0x24')]||null:null,'include':_0x2d29bd[_0x70d7('0x1e')]?_0x2d29bd['options'][_0x70d7('0x25')]?_[_0x70d7('0x22')](_0x2d29bd[_0x70d7('0x1e')][_0x70d7('0x25')],function(_0xe88999){return{'model':db[_0xe88999[_0x70d7('0x23')]],'as':_0xe88999['as'],'attributes':_0xe88999[_0x70d7('0x24')],'include':_0xe88999[_0x70d7('0x25')]?_[_0x70d7('0x22')](_0xe88999[_0x70d7('0x25')],function(_0x4188cc){return{'model':db[_0x4188cc[_0x70d7('0x23')]],'as':_0x4188cc['as'],'attributes':_0x4188cc[_0x70d7('0x24')],'include':_0x4188cc[_0x70d7('0x25')]?_[_0x70d7('0x22')](_0x4188cc[_0x70d7('0x25')],function(_0x39442d){return{'model':db[_0x39442d[_0x70d7('0x23')]],'as':_0x39442d['as'],'attributes':_0x39442d[_0x70d7('0x24')]};}):[]};}):[]};}):[]:[]})[_0x70d7('0x10')](function(_0x2c5d9c){logger[_0x70d7('0x19')](_0x70d7('0x26'),_0x2d29bd);logger[_0x70d7('0x13')](_0x70d7('0x26'),_0x2d29bd,JSON[_0x70d7('0x15')](_0x2c5d9c));_0x1b824f(_0x2c5d9c);})['catch'](function(_0x3db864){logger[_0x70d7('0x16')](_0x70d7('0x26'),_0x3db864[_0x70d7('0x18')],_0x2d29bd);_0x3d0814(_0x1a84a9['error'](0x1f4,_0x3db864[_0x70d7('0x18')]));});});}; \ No newline at end of file +var _0x195a=['options','raw','where','include','model','attributes','map','stringify','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetMailQueue','MailQueue'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x195a,0x1cd));var _0xa195=function(_0x17aab4,_0x34d9a1){_0x17aab4=_0x17aab4-0x0;var _0x509379=_0x195a[_0x17aab4];return _0x509379;};'use strict';var _=require(_0xa195('0x0'));var util=require(_0xa195('0x1'));var moment=require(_0xa195('0x2'));var BPromise=require(_0xa195('0x3'));var rs=require(_0xa195('0x4'));var fs=require('fs');var Redis=require(_0xa195('0x5'));var db=require(_0xa195('0x6'))['db'];var utils=require(_0xa195('0x7'));var logger=require(_0xa195('0x8'))(_0xa195('0x9'));var config=require(_0xa195('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa195('0xb')][_0xa195('0xc')]({'port':0x232a});config[_0xa195('0xd')]=_[_0xa195('0xe')](config['redis'],{'host':_0xa195('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa195('0xd')]));require(_0xa195('0x10'))[_0xa195('0x11')](socket);function respondWithRpcPromise(_0x151120,_0x2c33c5,_0x4b06c6){return new BPromise(function(_0x59f36d,_0xe52b29){return client[_0xa195('0x12')](_0x151120,_0x4b06c6)[_0xa195('0x13')](function(_0x58a985){logger[_0xa195('0x14')](_0xa195('0x15'),_0x2c33c5,_0xa195('0x16'));logger[_0xa195('0x17')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2c33c5,_0xa195('0x16'),JSON['stringify'](_0x58a985));if(_0x58a985[_0xa195('0x18')]){if(_0x58a985[_0xa195('0x18')][_0xa195('0x19')]===0x1f4){logger[_0xa195('0x18')](_0xa195('0x15'),_0x2c33c5,_0x58a985[_0xa195('0x18')][_0xa195('0x1a')]);return _0xe52b29(_0x58a985[_0xa195('0x18')][_0xa195('0x1a')]);}logger[_0xa195('0x18')]('MailQueue,\x20%s,\x20%s',_0x2c33c5,_0x58a985[_0xa195('0x18')][_0xa195('0x1a')]);return _0x59f36d(_0x58a985[_0xa195('0x18')]['message']);}else{logger[_0xa195('0x14')]('MailQueue,\x20%s,\x20%s',_0x2c33c5,'request\x20sent');_0x59f36d(_0x58a985[_0xa195('0x1b')]['message']);}})[_0xa195('0x1c')](function(_0x4e8db6){logger['error'](_0xa195('0x15'),_0x2c33c5,_0x4e8db6);_0xe52b29(_0x4e8db6);});});}exports[_0xa195('0x1d')]=function(_0x13e2f1){var _0x3fab5b=this;return new Promise(function(_0x3e9c71,_0x1d3531){return db[_0xa195('0x1e')]['findAll']({'raw':_0x13e2f1[_0xa195('0x1f')]?_0x13e2f1['options'][_0xa195('0x20')]===undefined?!![]:![]:!![],'where':_0x13e2f1['options']?_0x13e2f1[_0xa195('0x1f')][_0xa195('0x21')]||null:null,'attributes':_0x13e2f1[_0xa195('0x1f')]?_0x13e2f1[_0xa195('0x1f')]['attributes']||null:null,'limit':_0x13e2f1[_0xa195('0x1f')]?_0x13e2f1[_0xa195('0x1f')]['limit']||null:null,'include':_0x13e2f1['options']?_0x13e2f1['options'][_0xa195('0x22')]?_['map'](_0x13e2f1[_0xa195('0x1f')][_0xa195('0x22')],function(_0x5c9894){return{'model':db[_0x5c9894[_0xa195('0x23')]],'as':_0x5c9894['as'],'attributes':_0x5c9894[_0xa195('0x24')],'include':_0x5c9894[_0xa195('0x22')]?_[_0xa195('0x25')](_0x5c9894[_0xa195('0x22')],function(_0x490fc0){return{'model':db[_0x490fc0[_0xa195('0x23')]],'as':_0x490fc0['as'],'attributes':_0x490fc0[_0xa195('0x24')],'include':_0x490fc0[_0xa195('0x22')]?_[_0xa195('0x25')](_0x490fc0['include'],function(_0x4ae7a3){return{'model':db[_0x4ae7a3['model']],'as':_0x4ae7a3['as'],'attributes':_0x4ae7a3[_0xa195('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d5208){logger[_0xa195('0x14')](_0xa195('0x1d'),_0x13e2f1);logger[_0xa195('0x17')](_0xa195('0x1d'),_0x13e2f1,JSON[_0xa195('0x26')](_0x4d5208));_0x3e9c71(_0x4d5208);})[_0xa195('0x1c')](function(_0x260e97){logger[_0xa195('0x18')]('GetMailQueue',_0x260e97['message'],_0x13e2f1);_0x1d3531(_0x3fab5b[_0xa195('0x18')](0x1f4,_0x260e97[_0xa195('0x1a')]));});});};exports['ShowMailQueue']=function(_0x4e7d24){var _0x298809=this;return new Promise(function(_0x52bfe0,_0x121183){return db[_0xa195('0x1e')][_0xa195('0x27')]({'raw':_0x4e7d24['options']?_0x4e7d24[_0xa195('0x1f')][_0xa195('0x20')]===undefined?!![]:![]:!![],'where':_0x4e7d24[_0xa195('0x1f')]?_0x4e7d24[_0xa195('0x1f')][_0xa195('0x21')]||null:null,'attributes':_0x4e7d24[_0xa195('0x1f')]?_0x4e7d24[_0xa195('0x1f')][_0xa195('0x24')]||null:null,'include':_0x4e7d24['options']?_0x4e7d24[_0xa195('0x1f')]['include']?_[_0xa195('0x25')](_0x4e7d24[_0xa195('0x1f')][_0xa195('0x22')],function(_0x4bc5aa){return{'model':db[_0x4bc5aa[_0xa195('0x23')]],'as':_0x4bc5aa['as'],'attributes':_0x4bc5aa[_0xa195('0x24')],'include':_0x4bc5aa[_0xa195('0x22')]?_[_0xa195('0x25')](_0x4bc5aa[_0xa195('0x22')],function(_0x54c924){return{'model':db[_0x54c924['model']],'as':_0x54c924['as'],'attributes':_0x54c924[_0xa195('0x24')],'include':_0x54c924['include']?_[_0xa195('0x25')](_0x54c924[_0xa195('0x22')],function(_0x4af207){return{'model':db[_0x4af207[_0xa195('0x23')]],'as':_0x4af207['as'],'attributes':_0x4af207['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48a75e){logger[_0xa195('0x14')]('ShowMailQueue',_0x4e7d24);logger[_0xa195('0x17')](_0xa195('0x28'),_0x4e7d24,JSON['stringify'](_0x48a75e));_0x52bfe0(_0x48a75e);})[_0xa195('0x1c')](function(_0x4c4956){logger['error'](_0xa195('0x28'),_0x4c4956[_0xa195('0x1a')],_0x4e7d24);_0x121183(_0x298809[_0xa195('0x18')](0x1f4,_0x4c4956['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4864c0c..23e2297 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 _0x5227=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x1ced9e,_0x2fb740){var _0x370311=function(_0x4cac55){while(--_0x4cac55){_0x1ced9e['push'](_0x1ced9e['shift']());}};_0x370311(++_0x2fb740);}(_0x5227,0x1d1));var _0x7522=function(_0x88fab1,_0x1accff){_0x88fab1=_0x88fab1-0x0;var _0x20c571=_0x5227[_0x88fab1];return _0x20c571;};'use strict';var MailQueueEvents=require(_0x7522('0x0'));var events=[_0x7522('0x1'),_0x7522('0x2'),_0x7522('0x3')];function createListener(_0x3a6c52,_0x186c99){return function(_0x5eb1d1){_0x186c99[_0x7522('0x4')](_0x3a6c52,_0x5eb1d1);};}function removeListener(_0x1826a1,_0x2ff860){return function(){MailQueueEvents[_0x7522('0x5')](_0x1826a1,_0x2ff860);};}exports['register']=function(_0xa19d9a){for(var _0x15e038=0x0,_0x26767c=events[_0x7522('0x6')];_0x15e038<_0x26767c;_0x15e038++){var _0x110f4a=events[_0x15e038];var _0x3ebd0a=createListener(_0x7522('0x7')+_0x110f4a,_0xa19d9a);MailQueueEvents['on'](_0x110f4a,_0x3ebd0a);}}; \ No newline at end of file +var _0xe4e7=['./mailQueue.events','save','remove','update','removeListener','register','length','mailQueue:'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0xe4e7,0x78));var _0x7e4e=function(_0x24d80c,_0x3ac537){_0x24d80c=_0x24d80c-0x0;var _0x7ca8d5=_0xe4e7[_0x24d80c];return _0x7ca8d5;};'use strict';var MailQueueEvents=require(_0x7e4e('0x0'));var events=[_0x7e4e('0x1'),_0x7e4e('0x2'),_0x7e4e('0x3')];function createListener(_0x1e69da,_0x30e2d4){return function(_0x4ef71e){_0x30e2d4['emit'](_0x1e69da,_0x4ef71e);};}function removeListener(_0x5eec43,_0x358713){return function(){MailQueueEvents[_0x7e4e('0x4')](_0x5eec43,_0x358713);};}exports[_0x7e4e('0x5')]=function(_0x377f01){for(var _0x4290ea=0x0,_0x1bb676=events[_0x7e4e('0x6')];_0x4290ea<_0x1bb676;_0x4290ea++){var _0x354bc0=events[_0x4290ea];var _0x3bd511=createListener(_0x7e4e('0x7')+_0x354bc0,_0x377f01);MailQueueEvents['on'](_0x354bc0,_0x3bd511);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 94c38fd..ed3960a 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 _0x3815=['./mailQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0x3815,0x175));var _0x5381=function(_0x594843,_0x720f32){_0x594843=_0x594843-0x0;var _0x45f6ba=_0x3815[_0x594843];return _0x45f6ba;};'use strict';var multer=require(_0x5381('0x0'));var util=require(_0x5381('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5381('0x2'));var router=express[_0x5381('0x3')]();var fs_extra=require(_0x5381('0x4'));var auth=require(_0x5381('0x5'));var interaction=require(_0x5381('0x6'));var config=require('../../config/environment');var controller=require(_0x5381('0x7'));router[_0x5381('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5381('0x8')]('/describe',auth[_0x5381('0x9')](),controller['describe']);router[_0x5381('0x8')](_0x5381('0xa'),auth[_0x5381('0x9')](),controller[_0x5381('0xb')]);router[_0x5381('0xc')]('/',auth[_0x5381('0x9')](),controller[_0x5381('0xd')]);router[_0x5381('0xe')](_0x5381('0xa'),auth[_0x5381('0x9')](),controller[_0x5381('0xf')]);router[_0x5381('0x10')](_0x5381('0xa'),auth[_0x5381('0x9')](),controller[_0x5381('0x11')]);module[_0x5381('0x12')]=router; \ No newline at end of file +var _0x3eb8=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x10a4fe,_0x1b6647){var _0x52b093=function(_0x1eb8c6){while(--_0x1eb8c6){_0x10a4fe['push'](_0x10a4fe['shift']());}};_0x52b093(++_0x1b6647);}(_0x3eb8,0x1e9));var _0x83eb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3eb8[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x83eb('0x0'));var util=require('util');var path=require(_0x83eb('0x1'));var timeout=require(_0x83eb('0x2'));var express=require(_0x83eb('0x3'));var router=express[_0x83eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x83eb('0x5'));var interaction=require(_0x83eb('0x6'));var config=require(_0x83eb('0x7'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x83eb('0x8')](),controller['index']);router[_0x83eb('0x9')](_0x83eb('0xa'),auth['isAuthenticated'](),controller[_0x83eb('0xb')]);router[_0x83eb('0x9')](_0x83eb('0xc'),auth[_0x83eb('0x8')](),controller[_0x83eb('0xd')]);router[_0x83eb('0xe')]('/',auth[_0x83eb('0x8')](),controller[_0x83eb('0xf')]);router[_0x83eb('0x10')](_0x83eb('0xc'),auth[_0x83eb('0x8')](),controller[_0x83eb('0x11')]);router[_0x83eb('0x12')](_0x83eb('0xc'),auth[_0x83eb('0x8')](),controller[_0x83eb('0x13')]);module[_0x83eb('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 63c2d18..53b3a5c 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 _0x8c2f=['STRING','DATE'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x8c2f,0xdc));var _0xf8c2=function(_0x26641c,_0x1ba2a5){_0x26641c=_0x26641c-0x0;var _0x42c01a=_0x8c2f[_0x26641c];return _0x42c01a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf8c2('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf8c2('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf8c2('0x1')]},'reason':{'type':Sequelize[_0xf8c2('0x0')]}}; \ No newline at end of file +var _0x2660=['DATE','sequelize','exports','STRING'];(function(_0x1e1bc5,_0x3b9817){var _0x283d71=function(_0x38ac70){while(--_0x38ac70){_0x1e1bc5['push'](_0x1e1bc5['shift']());}};_0x283d71(++_0x3b9817);}(_0x2660,0x131));var _0x0266=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x2660[_0x1f1a97];return _0x29fc6a;};'use strict';var moment=require('moment');var Sequelize=require(_0x0266('0x0'));module[_0x0266('0x1')]={'uniqueid':{'type':Sequelize[_0x0266('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0266('0x2')]},'joinAt':{'type':Sequelize[_0x0266('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0266('0x3')]},'exitAt':{'type':Sequelize[_0x0266('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 909df9d..d726814 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 _0xbff5=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','MailQueueReport','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash'];(function(_0x193d08,_0x5df3c7){var _0x241318=function(_0x49fa9c){while(--_0x49fa9c){_0x193d08['push'](_0x193d08['shift']());}};_0x241318(++_0x5df3c7);}(_0xbff5,0x1bc));var _0x5bff=function(_0x3670cb,_0x1c82b0){_0x3670cb=_0x3670cb-0x0;var _0x5a6812=_0xbff5[_0x3670cb];return _0x5a6812;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require(_0x5bff('0x2'));var jsonpatch=require(_0x5bff('0x3'));var rp=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var BPromise=require(_0x5bff('0x6'));var Mustache=require('mustache');var util=require(_0x5bff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5bff('0x8'));var ejs=require(_0x5bff('0x9'));var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x8'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132dc9,_0x50e1e9){_0x50e1e9=_0x50e1e9||0xcc;return function(_0x335e78){if(_0x335e78){return _0x132dc9[_0x5bff('0x17')](_0x50e1e9);}return _0x132dc9['status'](_0x50e1e9)[_0x5bff('0x18')]();};}function respondWithResult(_0xa16a3f,_0x5b0d2d){_0x5b0d2d=_0x5b0d2d||0xc8;return function(_0x5f2a55){if(_0x5f2a55){return _0xa16a3f[_0x5bff('0x19')](_0x5b0d2d)[_0x5bff('0x1a')](_0x5f2a55);}};}function respondWithFilteredResult(_0x3a507c,_0x4d883e){return function(_0x2d22ab){if(_0x2d22ab){var _0x4612ec=typeof _0x4d883e[_0x5bff('0x1b')]==='undefined'&&typeof _0x4d883e[_0x5bff('0x1c')]===_0x5bff('0x1d');var _0x38daa0=_0x2d22ab['count'];var _0xc9fbc3=_0x4612ec?0x0:_0x4d883e[_0x5bff('0x1b')];var _0x36653b=_0x4612ec?_0x2d22ab[_0x5bff('0x1e')]:_0x4d883e['offset']+_0x4d883e[_0x5bff('0x1c')];var _0x5357d4;if(_0x36653b>=_0x38daa0){_0x36653b=_0x38daa0;_0x5357d4=0xc8;}else{_0x5357d4=0xce;}_0x3a507c[_0x5bff('0x19')](_0x5357d4);return _0x3a507c['set'](_0x5bff('0x1f'),_0xc9fbc3+'-'+_0x36653b+'/'+_0x38daa0)[_0x5bff('0x1a')](_0x2d22ab);}return null;};}function patchUpdates(_0x2a83ce){return function(_0x6cbfa){try{jsonpatch[_0x5bff('0x20')](_0x6cbfa,_0x2a83ce,!![]);}catch(_0x2012e4){return BPromise[_0x5bff('0x21')](_0x2012e4);}return _0x6cbfa[_0x5bff('0x22')]();};}function saveUpdates(_0x155e16,_0x490bc1){return function(_0x5f2593){if(_0x5f2593){return _0x5f2593[_0x5bff('0x23')](_0x155e16)[_0x5bff('0x24')](function(_0x1e7f8a){return _0x1e7f8a;});}return null;};}function removeEntity(_0x352b1f,_0x31d26b){return function(_0x3913fd){if(_0x3913fd){return _0x3913fd[_0x5bff('0x25')]()['then'](function(){_0x352b1f['status'](0xcc)[_0x5bff('0x18')]();});}};}function handleEntityNotFound(_0x53bd97,_0x220c8f){return function(_0xcc091d){if(!_0xcc091d){_0x53bd97[_0x5bff('0x17')](0x194);}return _0xcc091d;};}function handleError(_0x6f18f1,_0xfa361d){_0xfa361d=_0xfa361d||0x1f4;return function(_0x1140eb){logger[_0x5bff('0x26')](_0x1140eb[_0x5bff('0x27')]);if(_0x1140eb['name']){delete _0x1140eb['name'];}_0x6f18f1[_0x5bff('0x19')](_0xfa361d)[_0x5bff('0x28')](_0x1140eb);};}exports['index']=function(_0x36a7d2,_0x588078){var _0x5470cb={},_0x3eda3a={},_0x5cf207={'count':0x0,'rows':[]};var _0x3ed23b=_[_0x5bff('0x29')](db[_0x5bff('0x2a')][_0x5bff('0x2b')],function(_0x48aee1){return{'name':_0x48aee1[_0x5bff('0x2c')],'type':_0x48aee1['type'][_0x5bff('0x2d')]};});_0x3eda3a['model']=_[_0x5bff('0x29')](_0x3ed23b,_0x5bff('0x2e'));_0x3eda3a[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x36a7d2[_0x5bff('0x2f')]);_0x3eda3a[_0x5bff('0x31')]=_['intersection'](_0x3eda3a[_0x5bff('0x32')],_0x3eda3a[_0x5bff('0x2f')]);_0x5470cb[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x3eda3a[_0x5bff('0x32')],qs[_0x5bff('0x35')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x35')]));_0x5470cb['attributes']=_0x5470cb[_0x5bff('0x33')][_0x5bff('0x36')]?_0x5470cb[_0x5bff('0x33')]:_0x3eda3a[_0x5bff('0x32')];if(!_0x36a7d2['query'][_0x5bff('0x37')](_0x5bff('0x38'))){_0x5470cb['limit']=qs[_0x5bff('0x1c')](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1c')]);_0x5470cb[_0x5bff('0x1b')]=qs['offset'](_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x1b')]);}_0x5470cb[_0x5bff('0x39')]=qs['sort'](_0x36a7d2[_0x5bff('0x2f')]['sort']);_0x5470cb[_0x5bff('0x3a')]=qs[_0x5bff('0x31')](_[_0x5bff('0x3b')](_0x36a7d2['query'],_0x3eda3a[_0x5bff('0x31')]),_0x3ed23b);if(_0x36a7d2[_0x5bff('0x2f')][_0x5bff('0x3c')]){_0x5470cb['where']=_[_0x5bff('0x3d')](_0x5470cb[_0x5bff('0x3a')],{'$or':_['map'](_0x3ed23b,function(_0x265cdb){if(_0x265cdb[_0x5bff('0x3e')]!==_0x5bff('0x3f')){var _0x77a071={};_0x77a071[_0x265cdb[_0x5bff('0x2e')]]={'$like':'%'+_0x36a7d2['query'][_0x5bff('0x3c')]+'%'};return _0x77a071;}})});}_0x5470cb=_['merge']({},_0x5470cb,_0x36a7d2[_0x5bff('0x40')]);var _0x2fecb9={'where':_0x5470cb[_0x5bff('0x3a')]};return db[_0x5bff('0x2a')][_0x5bff('0x1e')](_0x2fecb9)[_0x5bff('0x24')](function(_0x1d0346){_0x5cf207['count']=_0x1d0346;if(_0x36a7d2['query'][_0x5bff('0x41')]){_0x5470cb[_0x5bff('0x42')]=[{'all':!![]}];}return db[_0x5bff('0x2a')][_0x5bff('0x43')](_0x5470cb);})[_0x5bff('0x24')](function(_0xb7b82a){_0x5cf207[_0x5bff('0x44')]=_0xb7b82a;return _0x5cf207;})[_0x5bff('0x24')](respondWithFilteredResult(_0x588078,_0x5470cb))['catch'](handleError(_0x588078,null));};exports[_0x5bff('0x45')]=function(_0x49676f,_0x3dc13f){var _0x1b8c7f={'raw':!![],'where':{'id':_0x49676f[_0x5bff('0x46')]['id']}},_0x543517={};_0x543517[_0x5bff('0x32')]=_['keys'](db[_0x5bff('0x2a')][_0x5bff('0x2b')]);_0x543517[_0x5bff('0x2f')]=_['keys'](_0x49676f[_0x5bff('0x2f')]);_0x543517[_0x5bff('0x31')]=_[_0x5bff('0x34')](_0x543517['model'],_0x543517[_0x5bff('0x2f')]);_0x1b8c7f[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x543517[_0x5bff('0x32')],qs['fields'](_0x49676f[_0x5bff('0x2f')]['fields']));_0x1b8c7f['attributes']=_0x1b8c7f[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b8c7f['attributes']:_0x543517[_0x5bff('0x32')];if(_0x49676f[_0x5bff('0x2f')]['includeAll']){_0x1b8c7f[_0x5bff('0x42')]=[{'all':!![]}];}_0x1b8c7f=_[_0x5bff('0x3d')]({},_0x1b8c7f,_0x49676f[_0x5bff('0x40')]);return db[_0x5bff('0x2a')]['find'](_0x1b8c7f)[_0x5bff('0x24')](handleEntityNotFound(_0x3dc13f,null))[_0x5bff('0x24')](respondWithResult(_0x3dc13f,null))[_0x5bff('0x47')](handleError(_0x3dc13f,null));};exports[_0x5bff('0x48')]=function(_0x1e94c5,_0x2588b8){return db['MailQueueReport'][_0x5bff('0x48')](_0x1e94c5[_0x5bff('0x49')],{})['then'](respondWithResult(_0x2588b8,0xc9))[_0x5bff('0x47')](handleError(_0x2588b8,null));};exports['update']=function(_0x47fc14,_0x4ff13a){if(_0x47fc14[_0x5bff('0x49')]['id']){delete _0x47fc14[_0x5bff('0x49')]['id'];}return db['MailQueueReport'][_0x5bff('0x4a')]({'where':{'id':_0x47fc14[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x4ff13a,null))[_0x5bff('0x24')](saveUpdates(_0x47fc14[_0x5bff('0x49')],null))['then'](respondWithResult(_0x4ff13a,null))[_0x5bff('0x47')](handleError(_0x4ff13a,null));};exports[_0x5bff('0x25')]=function(_0x5e99f5,_0x16c61e){return db['MailQueueReport'][_0x5bff('0x4a')]({'where':{'id':_0x5e99f5[_0x5bff('0x46')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x16c61e,null))[_0x5bff('0x24')](removeEntity(_0x16c61e,null))[_0x5bff('0x47')](handleError(_0x16c61e,null));};exports['describe']=function(_0x36089e,_0x18018e){return db['MailQueueReport'][_0x5bff('0x4b')]()[_0x5bff('0x24')](respondWithResult(_0x18018e,null))['catch'](handleError(_0x18018e,null));}; \ No newline at end of file +var _0x68b3=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x8a80a3,_0x5f4c6a){var _0x3c06fc=function(_0x5d2f60){while(--_0x5d2f60){_0x8a80a3['push'](_0x8a80a3['shift']());}};_0x3c06fc(++_0x5f4c6a);}(_0x68b3,0x1d8));var _0x368b=function(_0x2858bd,_0x2456a4){_0x2858bd=_0x2858bd-0x0;var _0x209a5e=_0x68b3[_0x2858bd];return _0x209a5e;};'use strict';var emlformat=require(_0x368b('0x0'));var rimraf=require(_0x368b('0x1'));var zipdir=require(_0x368b('0x2'));var jsonpatch=require(_0x368b('0x3'));var rp=require(_0x368b('0x4'));var moment=require('moment');var BPromise=require(_0x368b('0x5'));var Mustache=require(_0x368b('0x6'));var util=require(_0x368b('0x7'));var path=require(_0x368b('0x8'));var sox=require('sox');var csv=require(_0x368b('0x9'));var ejs=require(_0x368b('0xa'));var fs=require('fs');var fs_extra=require(_0x368b('0xb'));var _=require(_0x368b('0xc'));var squel=require(_0x368b('0xd'));var crypto=require(_0x368b('0xe'));var jsforce=require(_0x368b('0xf'));var deskjs=require(_0x368b('0x10'));var toCsv=require(_0x368b('0x9'));var querystring=require(_0x368b('0x11'));var Papa=require(_0x368b('0x12'));var Redis=require('ioredis');var authService=require(_0x368b('0x13'));var qs=require(_0x368b('0x14'));var as=require(_0x368b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x368b('0x16'))(_0x368b('0x17'));var utils=require(_0x368b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x368b('0x19'));var db=require(_0x368b('0x1a'))['db'];function respondWithStatusCode(_0x514dc7,_0x109a90){_0x109a90=_0x109a90||0xcc;return function(_0x250697){if(_0x250697){return _0x514dc7[_0x368b('0x1b')](_0x109a90);}return _0x514dc7[_0x368b('0x1c')](_0x109a90)[_0x368b('0x1d')]();};}function respondWithResult(_0x4fffe5,_0x2b326c){_0x2b326c=_0x2b326c||0xc8;return function(_0x40faa0){if(_0x40faa0){return _0x4fffe5['status'](_0x2b326c)[_0x368b('0x1e')](_0x40faa0);}};}function respondWithFilteredResult(_0x2aabb9,_0x30c245){return function(_0x515350){if(_0x515350){var _0x220cd5=typeof _0x30c245[_0x368b('0x1f')]===_0x368b('0x20')&&typeof _0x30c245['limit']===_0x368b('0x20');var _0x1b9e65=_0x515350[_0x368b('0x21')];var _0x540f57=_0x220cd5?0x0:_0x30c245['offset'];var _0x3e2e9f=_0x220cd5?_0x515350[_0x368b('0x21')]:_0x30c245[_0x368b('0x1f')]+_0x30c245[_0x368b('0x22')];var _0x1a4f20;if(_0x3e2e9f>=_0x1b9e65){_0x3e2e9f=_0x1b9e65;_0x1a4f20=0xc8;}else{_0x1a4f20=0xce;}_0x2aabb9['status'](_0x1a4f20);return _0x2aabb9[_0x368b('0x23')](_0x368b('0x24'),_0x540f57+'-'+_0x3e2e9f+'/'+_0x1b9e65)[_0x368b('0x1e')](_0x515350);}return null;};}function patchUpdates(_0x1c927f){return function(_0x23da8f){try{jsonpatch[_0x368b('0x25')](_0x23da8f,_0x1c927f,!![]);}catch(_0x397185){return BPromise[_0x368b('0x26')](_0x397185);}return _0x23da8f['save']();};}function saveUpdates(_0x13e750,_0x2f08d9){return function(_0x18869a){if(_0x18869a){return _0x18869a[_0x368b('0x27')](_0x13e750)[_0x368b('0x28')](function(_0x4c2fca){return _0x4c2fca;});}return null;};}function removeEntity(_0x286641,_0x1ca429){return function(_0x3a22bd){if(_0x3a22bd){return _0x3a22bd[_0x368b('0x29')]()[_0x368b('0x28')](function(){_0x286641[_0x368b('0x1c')](0xcc)[_0x368b('0x1d')]();});}};}function handleEntityNotFound(_0x11ea2d,_0x3123c1){return function(_0x3f7f89){if(!_0x3f7f89){_0x11ea2d[_0x368b('0x1b')](0x194);}return _0x3f7f89;};}function handleError(_0x344d8a,_0xceec4b){_0xceec4b=_0xceec4b||0x1f4;return function(_0x376e61){logger[_0x368b('0x2a')](_0x376e61[_0x368b('0x2b')]);if(_0x376e61[_0x368b('0x2c')]){delete _0x376e61[_0x368b('0x2c')];}_0x344d8a[_0x368b('0x1c')](_0xceec4b)[_0x368b('0x2d')](_0x376e61);};}exports[_0x368b('0x2e')]=function(_0xc12627,_0x107d2f){var _0x3c80b5={},_0x5db0b4={},_0x4af77a={'count':0x0,'rows':[]};var _0x381324=_[_0x368b('0x2f')](db[_0x368b('0x30')][_0x368b('0x31')],function(_0x5d6ebf){return{'name':_0x5d6ebf[_0x368b('0x32')],'type':_0x5d6ebf[_0x368b('0x33')][_0x368b('0x34')]};});_0x5db0b4[_0x368b('0x35')]=_[_0x368b('0x2f')](_0x381324,'name');_0x5db0b4[_0x368b('0x36')]=_[_0x368b('0x37')](_0xc12627[_0x368b('0x36')]);_0x5db0b4[_0x368b('0x38')]=_['intersection'](_0x5db0b4['model'],_0x5db0b4['query']);_0x3c80b5[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x5db0b4[_0x368b('0x35')],qs[_0x368b('0x3b')](_0xc12627[_0x368b('0x36')]['fields']));_0x3c80b5[_0x368b('0x39')]=_0x3c80b5[_0x368b('0x39')]['length']?_0x3c80b5[_0x368b('0x39')]:_0x5db0b4[_0x368b('0x35')];if(!_0xc12627['query'][_0x368b('0x3c')](_0x368b('0x3d'))){_0x3c80b5['limit']=qs[_0x368b('0x22')](_0xc12627['query']['limit']);_0x3c80b5['offset']=qs[_0x368b('0x1f')](_0xc12627[_0x368b('0x36')][_0x368b('0x1f')]);}_0x3c80b5[_0x368b('0x3e')]=qs[_0x368b('0x3f')](_0xc12627[_0x368b('0x36')][_0x368b('0x3f')]);_0x3c80b5[_0x368b('0x40')]=qs[_0x368b('0x38')](_[_0x368b('0x41')](_0xc12627['query'],_0x5db0b4[_0x368b('0x38')]),_0x381324);if(_0xc12627[_0x368b('0x36')]['filter']){_0x3c80b5[_0x368b('0x40')]=_[_0x368b('0x42')](_0x3c80b5[_0x368b('0x40')],{'$or':_[_0x368b('0x2f')](_0x381324,function(_0x248b2b){if(_0x248b2b['type']!==_0x368b('0x43')){var _0x4287c6={};_0x4287c6[_0x248b2b[_0x368b('0x2c')]]={'$like':'%'+_0xc12627[_0x368b('0x36')]['filter']+'%'};return _0x4287c6;}})});}_0x3c80b5=_['merge']({},_0x3c80b5,_0xc12627[_0x368b('0x44')]);var _0x3d00f9={'where':_0x3c80b5[_0x368b('0x40')]};return db[_0x368b('0x30')][_0x368b('0x21')](_0x3d00f9)[_0x368b('0x28')](function(_0x1d990c){_0x4af77a[_0x368b('0x21')]=_0x1d990c;if(_0xc12627[_0x368b('0x36')][_0x368b('0x45')]){_0x3c80b5['include']=[{'all':!![]}];}return db[_0x368b('0x30')][_0x368b('0x46')](_0x3c80b5);})['then'](function(_0x25e713){_0x4af77a[_0x368b('0x47')]=_0x25e713;return _0x4af77a;})[_0x368b('0x28')](respondWithFilteredResult(_0x107d2f,_0x3c80b5))[_0x368b('0x48')](handleError(_0x107d2f,null));};exports['show']=function(_0x490eb6,_0x151711){var _0x4a0275={'raw':!![],'where':{'id':_0x490eb6[_0x368b('0x49')]['id']}},_0x91bb0b={};_0x91bb0b[_0x368b('0x35')]=_['keys'](db[_0x368b('0x30')][_0x368b('0x31')]);_0x91bb0b[_0x368b('0x36')]=_['keys'](_0x490eb6['query']);_0x91bb0b[_0x368b('0x38')]=_[_0x368b('0x3a')](_0x91bb0b['model'],_0x91bb0b[_0x368b('0x36')]);_0x4a0275[_0x368b('0x39')]=_[_0x368b('0x3a')](_0x91bb0b[_0x368b('0x35')],qs[_0x368b('0x3b')](_0x490eb6[_0x368b('0x36')][_0x368b('0x3b')]));_0x4a0275[_0x368b('0x39')]=_0x4a0275[_0x368b('0x39')][_0x368b('0x4a')]?_0x4a0275[_0x368b('0x39')]:_0x91bb0b[_0x368b('0x35')];if(_0x490eb6[_0x368b('0x36')]['includeAll']){_0x4a0275[_0x368b('0x4b')]=[{'all':!![]}];}_0x4a0275=_[_0x368b('0x42')]({},_0x4a0275,_0x490eb6[_0x368b('0x44')]);return db[_0x368b('0x30')][_0x368b('0x4c')](_0x4a0275)['then'](handleEntityNotFound(_0x151711,null))['then'](respondWithResult(_0x151711,null))[_0x368b('0x48')](handleError(_0x151711,null));};exports[_0x368b('0x4d')]=function(_0x1c8755,_0x5a9d70){return db[_0x368b('0x30')][_0x368b('0x4d')](_0x1c8755[_0x368b('0x4e')],{})[_0x368b('0x28')](respondWithResult(_0x5a9d70,0xc9))[_0x368b('0x48')](handleError(_0x5a9d70,null));};exports[_0x368b('0x27')]=function(_0x8f35b,_0x1174fa){if(_0x8f35b[_0x368b('0x4e')]['id']){delete _0x8f35b[_0x368b('0x4e')]['id'];}return db['MailQueueReport'][_0x368b('0x4c')]({'where':{'id':_0x8f35b['params']['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x1174fa,null))['then'](saveUpdates(_0x8f35b[_0x368b('0x4e')],null))['then'](respondWithResult(_0x1174fa,null))[_0x368b('0x48')](handleError(_0x1174fa,null));};exports[_0x368b('0x29')]=function(_0x3b8a12,_0x458d9a){return db['MailQueueReport'][_0x368b('0x4c')]({'where':{'id':_0x3b8a12[_0x368b('0x49')]['id']}})[_0x368b('0x28')](handleEntityNotFound(_0x458d9a,null))[_0x368b('0x28')](removeEntity(_0x458d9a,null))[_0x368b('0x48')](handleError(_0x458d9a,null));};exports[_0x368b('0x4f')]=function(_0x3898a8,_0x15078b){return db[_0x368b('0x30')]['describe']()[_0x368b('0x28')](respondWithResult(_0x15078b,null))[_0x368b('0x48')](handleError(_0x15078b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1ee6936..c4b2694 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 _0x2ea2=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','moment','bluebird','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x2dc218,_0x42ed5f){var _0x2b7d36=function(_0x149c11){while(--_0x149c11){_0x2dc218['push'](_0x2dc218['shift']());}};_0x2b7d36(++_0x42ed5f);}(_0x2ea2,0x7e));var _0x22ea=function(_0x205659,_0x33a2f5){_0x205659=_0x205659-0x0;var _0x170029=_0x2ea2[_0x205659];return _0x170029;};'use strict';var _=require(_0x22ea('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x22ea('0x1'));var BPromise=require(_0x22ea('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x22ea('0x3'));var config=require(_0x22ea('0x4'));var attributes=require(_0x22ea('0x5'));module[_0x22ea('0x6')]=function(_0x891fd1,_0x336792){return _0x891fd1[_0x22ea('0x7')](_0x22ea('0x8'),attributes,{'tableName':_0x22ea('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x22ea('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50b2=['./mailQueueReport.attributes','define','report_mail_queue','uniqueid','util','moment','bluebird','request-promise','../../config/environment'];(function(_0x5be0d8,_0x594a72){var _0x1119c7=function(_0x3946b9){while(--_0x3946b9){_0x5be0d8['push'](_0x5be0d8['shift']());}};_0x1119c7(++_0x594a72);}(_0x50b2,0x9d));var _0x250b=function(_0x1a3488,_0x3874b0){_0x1a3488=_0x1a3488-0x0;var _0x8398da=_0x50b2[_0x1a3488];return _0x8398da;};'use strict';var _=require('lodash');var util=require(_0x250b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x250b('0x1'));var BPromise=require(_0x250b('0x2'));var rp=require(_0x250b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x250b('0x4'));var attributes=require(_0x250b('0x5'));module['exports']=function(_0x366242,_0x80961f){return _0x366242[_0x250b('0x6')]('MailQueueReport',attributes,{'tableName':_0x250b('0x7'),'paranoid':![],'indexes':[{'name':_0x250b('0x8'),'fields':[_0x250b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d218773..117a2bc 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3c3021,_0x189015){var _0x347432=function(_0x324dfc){while(--_0x324dfc){_0x3c3021['push'](_0x3c3021['shift']());}};_0x347432(++_0x189015);}(_0x2ef3,0xba));var _0x32ef=function(_0x611ceb,_0x414862){_0x611ceb=_0x611ceb-0x0;var _0x41ac6e=_0x2ef3[_0x611ceb];return _0x41ac6e;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3303fb,_0x1266dd){var _0x71a686=function(_0x2c7537){while(--_0x2c7537){_0x3303fb['push'](_0x3303fb['shift']());}};_0x71a686(++_0x1266dd);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f5049,_0x598cff){_0x3f5049=_0x3f5049-0x0;var _0x14e6bf=_0x2ef3[_0x3f5049];return _0x14e6bf;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 30ebe00..6d13976 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x590db7,_0x3fd713){var _0x53125d=function(_0x149b26){while(--_0x149b26){_0x590db7['push'](_0x590db7['shift']());}};_0x53125d(++_0x3fd713);}(_0x70e0,0x17b));var _0x070e=function(_0x25af09,_0x9dc48e){_0x25af09=_0x25af09-0x0;var _0x5ed47b=_0x70e0[_0x25af09];return _0x5ed47b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3fde99,_0x2bdddf){var _0x450279=function(_0x2a0cd9){while(--_0x2a0cd9){_0x3fde99['push'](_0x3fde99['shift']());}};_0x450279(++_0x2bdddf);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6866c18..abc3e5e 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 _0xfd23=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfd23,0x17b));var _0x3fd2=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xfd23[_0x44a64f];return _0x52024b;};'use strict';var Sequelize=require(_0x3fd2('0x0'));module[_0x3fd2('0x1')]={'description':{'type':Sequelize[_0x3fd2('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x3fd2('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3fd2('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3fd2('0x4')]},'tls':{'type':Sequelize[_0x3fd2('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3fd2('0x2')],'defaultValue':_0x3fd2('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3fd2('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x288a=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x506cbf,_0xb7e1d8){var _0x5513f1=function(_0x25a9c4){while(--_0x25a9c4){_0x506cbf['push'](_0x506cbf['shift']());}};_0x5513f1(++_0xb7e1d8);}(_0x288a,0x1d5));var _0xa288=function(_0x401796,_0x422977){_0x401796=_0x401796-0x0;var _0x3e14b9=_0x288a[_0x401796];return _0x3e14b9;};'use strict';var Sequelize=require(_0xa288('0x0'));module[_0xa288('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa288('0x2')]},'authentication':{'type':Sequelize[_0xa288('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xa288('0x2')]},'password':{'type':Sequelize[_0xa288('0x2')]},'port':{'type':Sequelize[_0xa288('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xa288('0x2')],'defaultValue':_0xa288('0x5')},'connTimeout':{'type':Sequelize[_0xa288('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xa288('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa288('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6661b18..6ae3da3 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 _0x115a=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','util'];(function(_0x2a4fb8,_0x4c4c46){var _0x3af340=function(_0x18f951){while(--_0x18f951){_0x2a4fb8['push'](_0x2a4fb8['shift']());}};_0x3af340(++_0x4c4c46);}(_0x115a,0xf1));var _0xa115=function(_0x492cf7,_0x56e333){_0x492cf7=_0x492cf7-0x0;var _0x26b9a4=_0x115a[_0x492cf7];return _0x26b9a4;};'use strict';var _=require('lodash');var util=require(_0xa115('0x0'));var logger=require(_0xa115('0x1'))(_0xa115('0x2'));var moment=require(_0xa115('0x3'));var BPromise=require(_0xa115('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa115('0x5'));var config=require(_0xa115('0x6'));var attributes=require(_0xa115('0x7'));module['exports']=function(_0x5f2c01,_0x1952ec){return _0x5f2c01[_0xa115('0x8')](_0xa115('0x9'),attributes,{'tableName':_0xa115('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8df=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c0538,_0xca5082){var _0x227cfc=function(_0x28f3e2){while(--_0x28f3e2){_0x3c0538['push'](_0x3c0538['shift']());}};_0x227cfc(++_0xca5082);}(_0xc8df,0x73));var _0xfc8d=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc8df[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require(_0xfc8d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xfc8d('0x1'));var BPromise=require(_0xfc8d('0x2'));var rp=require(_0xfc8d('0x3'));var fs=require('fs');var path=require(_0xfc8d('0x4'));var rimraf=require(_0xfc8d('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc8d('0x6'));module[_0xfc8d('0x7')]=function(_0x5b084d,_0xc98e4b){return _0x5b084d[_0xfc8d('0x8')](_0xfc8d('0x9'),attributes,{'tableName':_0xfc8d('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 0ceed42..2ae90e7 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 _0xabca=['http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f7e56,_0x1e2c1){var _0x446186=function(_0x2e1c32){while(--_0x2e1c32){_0x2f7e56['push'](_0x2f7e56['shift']());}};_0x446186(++_0x1e2c1);}(_0xabca,0x1af));var _0xaabc=function(_0x29c48e,_0x2c69bd){_0x29c48e=_0x29c48e-0x0;var _0x4f23b8=_0xabca[_0x29c48e];return _0x4f23b8;};'use strict';var _=require(_0xaabc('0x0'));var util=require(_0xaabc('0x1'));var moment=require('moment');var BPromise=require(_0xaabc('0x2'));var rs=require(_0xaabc('0x3'));var fs=require('fs');var Redis=require(_0xaabc('0x4'));var db=require(_0xaabc('0x5'))['db'];var utils=require(_0xaabc('0x6'));var logger=require(_0xaabc('0x7'))(_0xaabc('0x8'));var config=require(_0xaabc('0x9'));var jayson=require(_0xaabc('0xa'));var client=jayson['client'][_0xaabc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cac60,_0x242da8,_0x4ff283){return new BPromise(function(_0x55f81d,_0x564a39){return client[_0xaabc('0xc')](_0x4cac60,_0x4ff283)[_0xaabc('0xd')](function(_0xd751aa){logger[_0xaabc('0xe')](_0xaabc('0xf'),_0x242da8,_0xaabc('0x10'));logger[_0xaabc('0x11')](_0xaabc('0x12'),_0x242da8,_0xaabc('0x10'),JSON[_0xaabc('0x13')](_0xd751aa));if(_0xd751aa['error']){if(_0xd751aa[_0xaabc('0x14')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x242da8,_0xd751aa['error']['message']);return _0x564a39(_0xd751aa[_0xaabc('0x14')][_0xaabc('0x15')]);}logger[_0xaabc('0x14')](_0xaabc('0xf'),_0x242da8,_0xd751aa['error'][_0xaabc('0x15')]);return _0x55f81d(_0xd751aa[_0xaabc('0x14')]['message']);}else{logger['info'](_0xaabc('0xf'),_0x242da8,_0xaabc('0x10'));_0x55f81d(_0xd751aa['result']['message']);}})[_0xaabc('0x16')](function(_0x2e40b0){logger['error'](_0xaabc('0xf'),_0x242da8,_0x2e40b0);_0x564a39(_0x2e40b0);});});}exports[_0xaabc('0x17')]=function(_0xc1280e){var _0x4c48d1=this;return new Promise(function(_0x35e2d7,_0x42e4fc){return db[_0xaabc('0x18')][_0xaabc('0x19')]({'raw':_0xc1280e[_0xaabc('0x1a')]?_0xc1280e[_0xaabc('0x1a')][_0xaabc('0x1b')]===undefined?!![]:![]:!![],'where':_0xc1280e[_0xaabc('0x1a')]?_0xc1280e[_0xaabc('0x1a')][_0xaabc('0x1c')]||null:null,'attributes':_0xc1280e[_0xaabc('0x1a')]?_0xc1280e['options'][_0xaabc('0x1d')]||null:null,'limit':_0xc1280e['options']?_0xc1280e['options'][_0xaabc('0x1e')]||null:null,'include':_0xc1280e[_0xaabc('0x1a')]?_0xc1280e[_0xaabc('0x1a')][_0xaabc('0x1f')]?_['map'](_0xc1280e['options']['include'],function(_0xe88a58){return{'model':db[_0xe88a58[_0xaabc('0x20')]],'as':_0xe88a58['as'],'attributes':_0xe88a58[_0xaabc('0x1d')],'include':_0xe88a58[_0xaabc('0x1f')]?_['map'](_0xe88a58[_0xaabc('0x1f')],function(_0x76460a){return{'model':db[_0x76460a[_0xaabc('0x20')]],'as':_0x76460a['as'],'attributes':_0x76460a[_0xaabc('0x1d')],'include':_0x76460a['include']?_[_0xaabc('0x21')](_0x76460a[_0xaabc('0x1f')],function(_0xa73fc7){return{'model':db[_0xa73fc7[_0xaabc('0x20')]],'as':_0xa73fc7['as'],'attributes':_0xa73fc7[_0xaabc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaabc('0xd')](function(_0x30d5e7){logger[_0xaabc('0xe')](_0xaabc('0x17'),_0xc1280e);logger['debug'](_0xaabc('0x17'),_0xc1280e,JSON[_0xaabc('0x13')](_0x30d5e7));_0x35e2d7(_0x30d5e7);})[_0xaabc('0x16')](function(_0x18c1c5){logger['error'](_0xaabc('0x17'),_0x18c1c5[_0xaabc('0x15')],_0xc1280e);_0x42e4fc(_0x4c48d1[_0xaabc('0x14')](0x1f4,_0x18c1c5['message']));});});}; \ No newline at end of file +var _0x793a=['MailServerIn','findAll','options','raw','where','attributes','include','map','model','debug','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn'];(function(_0x332764,_0x1bfe34){var _0xed0097=function(_0x239e4){while(--_0x239e4){_0x332764['push'](_0x332764['shift']());}};_0xed0097(++_0x1bfe34);}(_0x793a,0x86));var _0xa793=function(_0x192865,_0x34dde2){_0x192865=_0x192865-0x0;var _0x4c3d84=_0x793a[_0x192865];return _0x4c3d84;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa793('0x0'));var fs=require('fs');var Redis=require(_0xa793('0x1'));var db=require(_0xa793('0x2'))['db'];var utils=require(_0xa793('0x3'));var logger=require(_0xa793('0x4'))(_0xa793('0x5'));var config=require('../../config/environment');var jayson=require(_0xa793('0x6'));var client=jayson[_0xa793('0x7')][_0xa793('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x490c43,_0x437555,_0x3fd3d1){return new BPromise(function(_0x1fc234,_0x59b523){return client[_0xa793('0x9')](_0x490c43,_0x3fd3d1)[_0xa793('0xa')](function(_0x18c5b1){logger[_0xa793('0xb')]('MailServerIn,\x20%s,\x20%s',_0x437555,_0xa793('0xc'));logger['debug'](_0xa793('0xd'),_0x437555,_0xa793('0xc'),JSON[_0xa793('0xe')](_0x18c5b1));if(_0x18c5b1['error']){if(_0x18c5b1[_0xa793('0xf')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x437555,_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);return _0x59b523(_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);}logger['error'](_0xa793('0x11'),_0x437555,_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);return _0x1fc234(_0x18c5b1[_0xa793('0xf')][_0xa793('0x10')]);}else{logger[_0xa793('0xb')]('MailServerIn,\x20%s,\x20%s',_0x437555,_0xa793('0xc'));_0x1fc234(_0x18c5b1[_0xa793('0x12')][_0xa793('0x10')]);}})[_0xa793('0x13')](function(_0x1f24f1){logger[_0xa793('0xf')](_0xa793('0x11'),_0x437555,_0x1f24f1);_0x59b523(_0x1f24f1);});});}exports[_0xa793('0x14')]=function(_0x5aefc7){var _0x196bac=this;return new Promise(function(_0x3b6cea,_0x5ac034){return db[_0xa793('0x15')][_0xa793('0x16')]({'raw':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')][_0xa793('0x18')]===undefined?!![]:![]:!![],'where':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7['options'][_0xa793('0x19')]||null:null,'attributes':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')][_0xa793('0x1a')]||null:null,'limit':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')]['limit']||null:null,'include':_0x5aefc7[_0xa793('0x17')]?_0x5aefc7[_0xa793('0x17')][_0xa793('0x1b')]?_[_0xa793('0x1c')](_0x5aefc7[_0xa793('0x17')][_0xa793('0x1b')],function(_0x46e490){return{'model':db[_0x46e490['model']],'as':_0x46e490['as'],'attributes':_0x46e490[_0xa793('0x1a')],'include':_0x46e490[_0xa793('0x1b')]?_['map'](_0x46e490[_0xa793('0x1b')],function(_0x450634){return{'model':db[_0x450634[_0xa793('0x1d')]],'as':_0x450634['as'],'attributes':_0x450634[_0xa793('0x1a')],'include':_0x450634[_0xa793('0x1b')]?_[_0xa793('0x1c')](_0x450634[_0xa793('0x1b')],function(_0x55036e){return{'model':db[_0x55036e[_0xa793('0x1d')]],'as':_0x55036e['as'],'attributes':_0x55036e[_0xa793('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa793('0xa')](function(_0x5dec1a){logger['info'](_0xa793('0x14'),_0x5aefc7);logger[_0xa793('0x1e')](_0xa793('0x14'),_0x5aefc7,JSON[_0xa793('0xe')](_0x5dec1a));_0x3b6cea(_0x5dec1a);})[_0xa793('0x13')](function(_0x26725d){logger[_0xa793('0xf')](_0xa793('0x14'),_0x26725d[_0xa793('0x10')],_0x5aefc7);_0x5ac034(_0x196bac[_0xa793('0xf')](0x1f4,_0x26725d[_0xa793('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 43398bb..6fe1f19 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(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x7c8754,_0x382821){_0x7c8754=_0x7c8754-0x0;var _0x350144=_0x7a54[_0x7c8754];return _0x350144;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0e32041..f85af21 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 _0xf7b4=['STRING','BOOLEAN','sequelize'];(function(_0x3009e6,_0x4eda8d){var _0x37a649=function(_0x12b8e8){while(--_0x12b8e8){_0x3009e6['push'](_0x3009e6['shift']());}};_0x37a649(++_0x4eda8d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xf7b4[_0x380307];return _0x9ea14b;};'use strict';var Sequelize=require(_0x4f7b('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4f7b('0x1')]},'user':{'type':Sequelize[_0x4f7b('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x4f7b('0x1')]},'authentication':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4f7b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc900=['INTEGER','BOOLEAN','STRING'];(function(_0x41c311,_0x258e81){var _0x4fff65=function(_0x572712){while(--_0x572712){_0x41c311['push'](_0x41c311['shift']());}};_0x4fff65(++_0x258e81);}(_0xc900,0xb3));var _0x0c90=function(_0xef45c,_0x853645){_0xef45c=_0xef45c-0x0;var _0x3c24cf=_0xc900[_0xef45c];return _0x3c24cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0c90('0x0')]},'host':{'type':Sequelize[_0x0c90('0x0')]},'user':{'type':Sequelize[_0x0c90('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0c90('0x1')]},'secure':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ac2c1bd..ff34e69 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 _0x1d25=['count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','include','rows','catch','show','params','fields','length','includeAll','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','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','limit','undefined'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x1d25,0x147));var _0x51d2=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x1d25[_0x13137e];return _0x346261;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51d2('0x0'));var jsonpatch=require(_0x51d2('0x1'));var rp=require(_0x51d2('0x2'));var moment=require(_0x51d2('0x3'));var BPromise=require(_0x51d2('0x4'));var Mustache=require('mustache');var util=require(_0x51d2('0x5'));var path=require(_0x51d2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x51d2('0x7'));var fs=require('fs');var fs_extra=require(_0x51d2('0x8'));var _=require('lodash');var squel=require(_0x51d2('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x51d2('0xa'));var toCsv=require(_0x51d2('0xb'));var querystring=require(_0x51d2('0xc'));var Papa=require(_0x51d2('0xd'));var Redis=require('ioredis');var authService=require(_0x51d2('0xe'));var qs=require(_0x51d2('0xf'));var as=require(_0x51d2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51d2('0x11'))(_0x51d2('0x12'));var utils=require('../../config/utils');var config=require(_0x51d2('0x13'));var licenseUtil=require(_0x51d2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8f0fe2,_0x58fba6){_0x58fba6=_0x58fba6||0xcc;return function(_0x52e608){if(_0x52e608){return _0x8f0fe2[_0x51d2('0x15')](_0x58fba6);}return _0x8f0fe2[_0x51d2('0x16')](_0x58fba6)[_0x51d2('0x17')]();};}function respondWithResult(_0x36e4f0,_0x106b85){_0x106b85=_0x106b85||0xc8;return function(_0x5b8423){if(_0x5b8423){return _0x36e4f0[_0x51d2('0x16')](_0x106b85)[_0x51d2('0x18')](_0x5b8423);}};}function respondWithFilteredResult(_0x1e1ab2,_0x3eacf0){return function(_0x12f2e8){if(_0x12f2e8){var _0x8db2e9=typeof _0x3eacf0[_0x51d2('0x19')]==='undefined'&&typeof _0x3eacf0[_0x51d2('0x1a')]===_0x51d2('0x1b');var _0x358794=_0x12f2e8[_0x51d2('0x1c')];var _0xdd1f29=_0x8db2e9?0x0:_0x3eacf0[_0x51d2('0x19')];var _0x5852da=_0x8db2e9?_0x12f2e8[_0x51d2('0x1c')]:_0x3eacf0[_0x51d2('0x19')]+_0x3eacf0['limit'];var _0x3cabd7;if(_0x5852da>=_0x358794){_0x5852da=_0x358794;_0x3cabd7=0xc8;}else{_0x3cabd7=0xce;}_0x1e1ab2['status'](_0x3cabd7);return _0x1e1ab2[_0x51d2('0x1d')]('Content-Range',_0xdd1f29+'-'+_0x5852da+'/'+_0x358794)[_0x51d2('0x18')](_0x12f2e8);}return null;};}function patchUpdates(_0x44cf23){return function(_0x51f5bd){try{jsonpatch['apply'](_0x51f5bd,_0x44cf23,!![]);}catch(_0x20a4d6){return BPromise[_0x51d2('0x1e')](_0x20a4d6);}return _0x51f5bd[_0x51d2('0x1f')]();};}function saveUpdates(_0x2fb5c6,_0x2f7328){return function(_0x27b911){if(_0x27b911){return _0x27b911[_0x51d2('0x20')](_0x2fb5c6)['then'](function(_0xc53279){return _0xc53279;});}return null;};}function removeEntity(_0x406c09,_0x47fca4){return function(_0x59d28e){if(_0x59d28e){return _0x59d28e[_0x51d2('0x21')]()[_0x51d2('0x22')](function(){_0x406c09['status'](0xcc)[_0x51d2('0x17')]();});}};}function handleEntityNotFound(_0x27b41c,_0x1593c9){return function(_0xb6bd50){if(!_0xb6bd50){_0x27b41c[_0x51d2('0x15')](0x194);}return _0xb6bd50;};}function handleError(_0x5a4768,_0x5c68a6){_0x5c68a6=_0x5c68a6||0x1f4;return function(_0x59b381){logger[_0x51d2('0x23')](_0x59b381[_0x51d2('0x24')]);if(_0x59b381[_0x51d2('0x25')]){delete _0x59b381['name'];}_0x5a4768[_0x51d2('0x16')](_0x5c68a6)[_0x51d2('0x26')](_0x59b381);};}exports[_0x51d2('0x27')]=function(_0x225a1c,_0x3e3b38){var _0x1ab077={},_0x3c65bf={},_0x518a4d={'count':0x0,'rows':[]};var _0x5c7f51=_[_0x51d2('0x28')](db[_0x51d2('0x29')][_0x51d2('0x2a')],function(_0x1e1774){return{'name':_0x1e1774['fieldName'],'type':_0x1e1774[_0x51d2('0x2b')][_0x51d2('0x2c')]};});_0x3c65bf[_0x51d2('0x2d')]=_[_0x51d2('0x28')](_0x5c7f51,_0x51d2('0x25'));_0x3c65bf['query']=_[_0x51d2('0x2e')](_0x225a1c[_0x51d2('0x2f')]);_0x3c65bf[_0x51d2('0x30')]=_[_0x51d2('0x31')](_0x3c65bf[_0x51d2('0x2d')],_0x3c65bf[_0x51d2('0x2f')]);_0x1ab077[_0x51d2('0x32')]=_[_0x51d2('0x31')](_0x3c65bf[_0x51d2('0x2d')],qs['fields'](_0x225a1c['query']['fields']));_0x1ab077[_0x51d2('0x32')]=_0x1ab077['attributes']['length']?_0x1ab077[_0x51d2('0x32')]:_0x3c65bf['model'];if(!_0x225a1c['query'][_0x51d2('0x33')](_0x51d2('0x34'))){_0x1ab077[_0x51d2('0x1a')]=qs[_0x51d2('0x1a')](_0x225a1c[_0x51d2('0x2f')][_0x51d2('0x1a')]);_0x1ab077[_0x51d2('0x19')]=qs[_0x51d2('0x19')](_0x225a1c[_0x51d2('0x2f')]['offset']);}_0x1ab077[_0x51d2('0x35')]=qs[_0x51d2('0x36')](_0x225a1c[_0x51d2('0x2f')][_0x51d2('0x36')]);_0x1ab077['where']=qs[_0x51d2('0x30')](_[_0x51d2('0x37')](_0x225a1c[_0x51d2('0x2f')],_0x3c65bf[_0x51d2('0x30')]),_0x5c7f51);if(_0x225a1c[_0x51d2('0x2f')]['filter']){_0x1ab077[_0x51d2('0x38')]=_[_0x51d2('0x39')](_0x1ab077[_0x51d2('0x38')],{'$or':_['map'](_0x5c7f51,function(_0x18e95d){if(_0x18e95d[_0x51d2('0x2b')]!=='VIRTUAL'){var _0x4a7414={};_0x4a7414[_0x18e95d[_0x51d2('0x25')]]={'$like':'%'+_0x225a1c['query'][_0x51d2('0x3a')]+'%'};return _0x4a7414;}})});}_0x1ab077=_[_0x51d2('0x39')]({},_0x1ab077,_0x225a1c['options']);var _0x4418db={'where':_0x1ab077[_0x51d2('0x38')]};return db[_0x51d2('0x29')][_0x51d2('0x1c')](_0x4418db)[_0x51d2('0x22')](function(_0x4c602a){_0x518a4d[_0x51d2('0x1c')]=_0x4c602a;if(_0x225a1c[_0x51d2('0x2f')]['includeAll']){_0x1ab077[_0x51d2('0x3b')]=[{'all':!![]}];}return db[_0x51d2('0x29')]['findAll'](_0x1ab077);})[_0x51d2('0x22')](function(_0x53f634){_0x518a4d[_0x51d2('0x3c')]=_0x53f634;return _0x518a4d;})[_0x51d2('0x22')](respondWithFilteredResult(_0x3e3b38,_0x1ab077))[_0x51d2('0x3d')](handleError(_0x3e3b38,null));};exports[_0x51d2('0x3e')]=function(_0x715641,_0x3e052e){var _0x5d7b7f={'raw':!![],'where':{'id':_0x715641[_0x51d2('0x3f')]['id']}},_0x51d445={};_0x51d445[_0x51d2('0x2d')]=_[_0x51d2('0x2e')](db[_0x51d2('0x29')][_0x51d2('0x2a')]);_0x51d445[_0x51d2('0x2f')]=_[_0x51d2('0x2e')](_0x715641[_0x51d2('0x2f')]);_0x51d445[_0x51d2('0x30')]=_[_0x51d2('0x31')](_0x51d445['model'],_0x51d445['query']);_0x5d7b7f['attributes']=_[_0x51d2('0x31')](_0x51d445[_0x51d2('0x2d')],qs[_0x51d2('0x40')](_0x715641[_0x51d2('0x2f')][_0x51d2('0x40')]));_0x5d7b7f['attributes']=_0x5d7b7f[_0x51d2('0x32')][_0x51d2('0x41')]?_0x5d7b7f[_0x51d2('0x32')]:_0x51d445['model'];if(_0x715641['query'][_0x51d2('0x42')]){_0x5d7b7f[_0x51d2('0x3b')]=[{'all':!![]}];}_0x5d7b7f=_['merge']({},_0x5d7b7f,_0x715641[_0x51d2('0x43')]);return db[_0x51d2('0x29')]['find'](_0x5d7b7f)[_0x51d2('0x22')](handleEntityNotFound(_0x3e052e,null))['then'](respondWithResult(_0x3e052e,null))['catch'](handleError(_0x3e052e,null));};exports[_0x51d2('0x44')]=function(_0x395e66,_0x21fd73){return db[_0x51d2('0x29')][_0x51d2('0x44')](_0x395e66[_0x51d2('0x45')],{})[_0x51d2('0x22')](respondWithResult(_0x21fd73,0xc9))[_0x51d2('0x3d')](handleError(_0x21fd73,null));};exports[_0x51d2('0x20')]=function(_0x7be4fc,_0x1a11d9){if(_0x7be4fc[_0x51d2('0x45')]['id']){delete _0x7be4fc['body']['id'];}return db[_0x51d2('0x29')]['find']({'where':{'id':_0x7be4fc['params']['id']}})['then'](handleEntityNotFound(_0x1a11d9,null))[_0x51d2('0x22')](saveUpdates(_0x7be4fc[_0x51d2('0x45')],null))[_0x51d2('0x22')](respondWithResult(_0x1a11d9,null))[_0x51d2('0x3d')](handleError(_0x1a11d9,null));};exports[_0x51d2('0x21')]=function(_0x5810da,_0x35f4ae){return db[_0x51d2('0x29')][_0x51d2('0x46')]({'where':{'id':_0x5810da[_0x51d2('0x3f')]['id']}})[_0x51d2('0x22')](handleEntityNotFound(_0x35f4ae,null))[_0x51d2('0x22')](removeEntity(_0x35f4ae,null))[_0x51d2('0x3d')](handleError(_0x35f4ae,null));}; \ No newline at end of file +var _0x4c01=['error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','update','rimraf','zip-dir','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4c01,0x70));var _0x14c0=function(_0x556411,_0x4cb83a){_0x556411=_0x556411-0x0;var _0x264026=_0x4c01[_0x556411];return _0x264026;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14c0('0x0'));var zipdir=require(_0x14c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14c0('0x2'));var moment=require(_0x14c0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x14c0('0x4'));var path=require(_0x14c0('0x5'));var sox=require(_0x14c0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x14c0('0x7'));var _=require(_0x14c0('0x8'));var squel=require(_0x14c0('0x9'));var crypto=require(_0x14c0('0xa'));var jsforce=require(_0x14c0('0xb'));var deskjs=require(_0x14c0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x14c0('0xd'));var Papa=require(_0x14c0('0xe'));var Redis=require(_0x14c0('0xf'));var authService=require(_0x14c0('0x10'));var qs=require(_0x14c0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14c0('0x12'));var logger=require(_0x14c0('0x13'))(_0x14c0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14c0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51d03e,_0x33fa17){_0x33fa17=_0x33fa17||0xcc;return function(_0x2e04e2){if(_0x2e04e2){return _0x51d03e[_0x14c0('0x16')](_0x33fa17);}return _0x51d03e['status'](_0x33fa17)[_0x14c0('0x17')]();};}function respondWithResult(_0x3b031d,_0x46ed0e){_0x46ed0e=_0x46ed0e||0xc8;return function(_0x519cc7){if(_0x519cc7){return _0x3b031d[_0x14c0('0x18')](_0x46ed0e)[_0x14c0('0x19')](_0x519cc7);}};}function respondWithFilteredResult(_0x2c9fc4,_0x4ef49f){return function(_0x33f08d){if(_0x33f08d){var _0x219d84=typeof _0x4ef49f[_0x14c0('0x1a')]===_0x14c0('0x1b')&&typeof _0x4ef49f['limit']===_0x14c0('0x1b');var _0x5213c6=_0x33f08d['count'];var _0x170333=_0x219d84?0x0:_0x4ef49f[_0x14c0('0x1a')];var _0x20b383=_0x219d84?_0x33f08d[_0x14c0('0x1c')]:_0x4ef49f[_0x14c0('0x1a')]+_0x4ef49f[_0x14c0('0x1d')];var _0x470ab7;if(_0x20b383>=_0x5213c6){_0x20b383=_0x5213c6;_0x470ab7=0xc8;}else{_0x470ab7=0xce;}_0x2c9fc4[_0x14c0('0x18')](_0x470ab7);return _0x2c9fc4[_0x14c0('0x1e')](_0x14c0('0x1f'),_0x170333+'-'+_0x20b383+'/'+_0x5213c6)['json'](_0x33f08d);}return null;};}function patchUpdates(_0x1a3a45){return function(_0xd2e0d5){try{jsonpatch['apply'](_0xd2e0d5,_0x1a3a45,!![]);}catch(_0xf8967a){return BPromise['reject'](_0xf8967a);}return _0xd2e0d5[_0x14c0('0x20')]();};}function saveUpdates(_0x11a337,_0x10a099){return function(_0x117684){if(_0x117684){return _0x117684['update'](_0x11a337)[_0x14c0('0x21')](function(_0x4ab545){return _0x4ab545;});}return null;};}function removeEntity(_0x50409f,_0x388bbf){return function(_0xb8f83b){if(_0xb8f83b){return _0xb8f83b['destroy']()['then'](function(){_0x50409f[_0x14c0('0x18')](0xcc)[_0x14c0('0x17')]();});}};}function handleEntityNotFound(_0x2d044e,_0x4f805a){return function(_0x44de76){if(!_0x44de76){_0x2d044e[_0x14c0('0x16')](0x194);}return _0x44de76;};}function handleError(_0x529ff6,_0x421b4e){_0x421b4e=_0x421b4e||0x1f4;return function(_0x4621fe){logger[_0x14c0('0x22')](_0x4621fe[_0x14c0('0x23')]);if(_0x4621fe[_0x14c0('0x24')]){delete _0x4621fe['name'];}_0x529ff6['status'](_0x421b4e)[_0x14c0('0x25')](_0x4621fe);};}exports[_0x14c0('0x26')]=function(_0x17993a,_0x37c5a5){var _0x391530={},_0xada5fd={},_0x263709={'count':0x0,'rows':[]};var _0x4e906b=_[_0x14c0('0x27')](db[_0x14c0('0x28')][_0x14c0('0x29')],function(_0x202e2f){return{'name':_0x202e2f[_0x14c0('0x2a')],'type':_0x202e2f[_0x14c0('0x2b')][_0x14c0('0x2c')]};});_0xada5fd[_0x14c0('0x2d')]=_['map'](_0x4e906b,_0x14c0('0x24'));_0xada5fd[_0x14c0('0x2e')]=_[_0x14c0('0x2f')](_0x17993a[_0x14c0('0x2e')]);_0xada5fd['filters']=_[_0x14c0('0x30')](_0xada5fd['model'],_0xada5fd['query']);_0x391530['attributes']=_[_0x14c0('0x30')](_0xada5fd['model'],qs['fields'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x31')]));_0x391530['attributes']=_0x391530[_0x14c0('0x32')][_0x14c0('0x33')]?_0x391530[_0x14c0('0x32')]:_0xada5fd[_0x14c0('0x2d')];if(!_0x17993a[_0x14c0('0x2e')][_0x14c0('0x34')](_0x14c0('0x35'))){_0x391530['limit']=qs['limit'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x1d')]);_0x391530['offset']=qs['offset'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x1a')]);}_0x391530[_0x14c0('0x36')]=qs['sort'](_0x17993a[_0x14c0('0x2e')][_0x14c0('0x37')]);_0x391530[_0x14c0('0x38')]=qs[_0x14c0('0x39')](_['pick'](_0x17993a[_0x14c0('0x2e')],_0xada5fd[_0x14c0('0x39')]),_0x4e906b);if(_0x17993a[_0x14c0('0x2e')][_0x14c0('0x3a')]){_0x391530[_0x14c0('0x38')]=_['merge'](_0x391530[_0x14c0('0x38')],{'$or':_[_0x14c0('0x27')](_0x4e906b,function(_0x2b8b6b){if(_0x2b8b6b[_0x14c0('0x2b')]!==_0x14c0('0x3b')){var _0x58e46d={};_0x58e46d[_0x2b8b6b[_0x14c0('0x24')]]={'$like':'%'+_0x17993a[_0x14c0('0x2e')][_0x14c0('0x3a')]+'%'};return _0x58e46d;}})});}_0x391530=_['merge']({},_0x391530,_0x17993a['options']);var _0x33c1ff={'where':_0x391530[_0x14c0('0x38')]};return db['MailServerOut'][_0x14c0('0x1c')](_0x33c1ff)['then'](function(_0x1eb0a5){_0x263709[_0x14c0('0x1c')]=_0x1eb0a5;if(_0x17993a[_0x14c0('0x2e')][_0x14c0('0x3c')]){_0x391530[_0x14c0('0x3d')]=[{'all':!![]}];}return db[_0x14c0('0x28')][_0x14c0('0x3e')](_0x391530);})[_0x14c0('0x21')](function(_0x203c7c){_0x263709[_0x14c0('0x3f')]=_0x203c7c;return _0x263709;})[_0x14c0('0x21')](respondWithFilteredResult(_0x37c5a5,_0x391530))[_0x14c0('0x40')](handleError(_0x37c5a5,null));};exports[_0x14c0('0x41')]=function(_0x5bf730,_0x5415c2){var _0x293018={'raw':!![],'where':{'id':_0x5bf730[_0x14c0('0x42')]['id']}},_0xb9439={};_0xb9439['model']=_[_0x14c0('0x2f')](db['MailServerOut'][_0x14c0('0x29')]);_0xb9439['query']=_[_0x14c0('0x2f')](_0x5bf730[_0x14c0('0x2e')]);_0xb9439[_0x14c0('0x39')]=_[_0x14c0('0x30')](_0xb9439[_0x14c0('0x2d')],_0xb9439['query']);_0x293018[_0x14c0('0x32')]=_[_0x14c0('0x30')](_0xb9439[_0x14c0('0x2d')],qs[_0x14c0('0x31')](_0x5bf730['query']['fields']));_0x293018[_0x14c0('0x32')]=_0x293018[_0x14c0('0x32')]['length']?_0x293018[_0x14c0('0x32')]:_0xb9439['model'];if(_0x5bf730['query'][_0x14c0('0x3c')]){_0x293018[_0x14c0('0x3d')]=[{'all':!![]}];}_0x293018=_[_0x14c0('0x43')]({},_0x293018,_0x5bf730[_0x14c0('0x44')]);return db[_0x14c0('0x28')][_0x14c0('0x45')](_0x293018)[_0x14c0('0x21')](handleEntityNotFound(_0x5415c2,null))[_0x14c0('0x21')](respondWithResult(_0x5415c2,null))[_0x14c0('0x40')](handleError(_0x5415c2,null));};exports[_0x14c0('0x46')]=function(_0x6b0d2c,_0x2e42da){return db[_0x14c0('0x28')][_0x14c0('0x46')](_0x6b0d2c[_0x14c0('0x47')],{})[_0x14c0('0x21')](respondWithResult(_0x2e42da,0xc9))[_0x14c0('0x40')](handleError(_0x2e42da,null));};exports[_0x14c0('0x48')]=function(_0x35598e,_0x50efcb){if(_0x35598e[_0x14c0('0x47')]['id']){delete _0x35598e[_0x14c0('0x47')]['id'];}return db[_0x14c0('0x28')]['find']({'where':{'id':_0x35598e[_0x14c0('0x42')]['id']}})[_0x14c0('0x21')](handleEntityNotFound(_0x50efcb,null))[_0x14c0('0x21')](saveUpdates(_0x35598e[_0x14c0('0x47')],null))[_0x14c0('0x21')](respondWithResult(_0x50efcb,null))[_0x14c0('0x40')](handleError(_0x50efcb,null));};exports['destroy']=function(_0x2abf11,_0x25340c){return db['MailServerOut'][_0x14c0('0x45')]({'where':{'id':_0x2abf11[_0x14c0('0x42')]['id']}})[_0x14c0('0x21')](handleEntityNotFound(_0x25340c,null))['then'](removeEntity(_0x25340c,null))[_0x14c0('0x40')](handleError(_0x25340c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5014195..a7c8e60 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 _0xb867=['path','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe0756e,_0x1932f5){var _0x265f67=function(_0x7c5815){while(--_0x7c5815){_0xe0756e['push'](_0xe0756e['shift']());}};_0x265f67(++_0x1932f5);}(_0xb867,0x191));var _0x7b86=function(_0x5619ce,_0x54b84a){_0x5619ce=_0x5619ce-0x0;var _0x1ce769=_0xb867[_0x5619ce];return _0x1ce769;};'use strict';var _=require(_0x7b86('0x0'));var util=require(_0x7b86('0x1'));var logger=require(_0x7b86('0x2'))(_0x7b86('0x3'));var moment=require(_0x7b86('0x4'));var BPromise=require(_0x7b86('0x5'));var rp=require(_0x7b86('0x6'));var fs=require('fs');var path=require(_0x7b86('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b86('0x8'));module[_0x7b86('0x9')]=function(_0xaf96ab,_0x38b773){return _0xaf96ab['define'](_0x7b86('0xa'),attributes,{'tableName':_0x7b86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6475=['util','api','moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash'];(function(_0x3ff78f,_0x4bfafd){var _0x5abe3c=function(_0x5d83d0){while(--_0x5d83d0){_0x3ff78f['push'](_0x3ff78f['shift']());}};_0x5abe3c(++_0x4bfafd);}(_0x6475,0x11d));var _0x5647=function(_0x4486ee,_0x85b039){_0x4486ee=_0x4486ee-0x0;var _0x2713cb=_0x6475[_0x4486ee];return _0x2713cb;};'use strict';var _=require(_0x5647('0x0'));var util=require(_0x5647('0x1'));var logger=require('../../config/logger')(_0x5647('0x2'));var moment=require(_0x5647('0x3'));var BPromise=require(_0x5647('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5647('0x5'));var config=require(_0x5647('0x6'));var attributes=require(_0x5647('0x7'));module['exports']=function(_0x53d27a,_0x5481ce){return _0x53d27a[_0x5647('0x8')](_0x5647('0x9'),attributes,{'tableName':_0x5647('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index e2d8110..e07ce61 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x258ceb,_0x50a40b){var _0x3257fe=function(_0x43c328){while(--_0x43c328){_0x258ceb['push'](_0x258ceb['shift']());}};_0x3257fe(++_0x50a40b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b6c76,_0x1d2317){_0x1b6c76=_0x1b6c76-0x0;var _0x385778=_0x5f2f[_0x1b6c76];return _0x385778;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x27cd9c,_0x2ca2d8){var _0xb2a38e=function(_0x45c976){while(--_0x45c976){_0x27cd9c['push'](_0x27cd9c['shift']());}};_0xb2a38e(++_0x2ca2d8);}(_0x1261,0x144));var _0x1126=function(_0x185334,_0x4630ac){_0x185334=_0x185334-0x0;var _0xf2e59a=_0x1261[_0x185334];return _0xf2e59a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f1f6a89..6f45f09 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 _0x718e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','exports','multer','util','path','express','Router'];(function(_0x38bac8,_0x296b3b){var _0x242e4e=function(_0x26b185){while(--_0x26b185){_0x38bac8['push'](_0x38bac8['shift']());}};_0x242e4e(++_0x296b3b);}(_0x718e,0x121));var _0xe718=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x718e[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xe718('0x0'));var util=require(_0xe718('0x1'));var path=require(_0xe718('0x2'));var timeout=require('connect-timeout');var express=require(_0xe718('0x3'));var router=express[_0xe718('0x4')]();var fs_extra=require(_0xe718('0x5'));var auth=require(_0xe718('0x6'));var interaction=require(_0xe718('0x7'));var config=require(_0xe718('0x8'));var controller=require(_0xe718('0x9'));router[_0xe718('0xa')]('/',auth[_0xe718('0xb')](),controller[_0xe718('0xc')]);router[_0xe718('0xa')](_0xe718('0xd'),auth[_0xe718('0xb')](),controller[_0xe718('0xe')]);router[_0xe718('0xa')](_0xe718('0xf'),auth[_0xe718('0xb')](),controller[_0xe718('0x10')]);router[_0xe718('0x11')]('/',auth[_0xe718('0xb')](),controller['create']);router['put']('/:id',auth[_0xe718('0xb')](),controller[_0xe718('0x12')]);router[_0xe718('0x13')]('/:id',auth[_0xe718('0xb')](),controller['destroy']);module[_0xe718('0x14')]=router; \ No newline at end of file +var _0xa847=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa847,0x74));var _0x7a84=function(_0x537722,_0x587f1c){_0x537722=_0x537722-0x0;var _0xab7d11=_0xa847[_0x537722];return _0xab7d11;};'use strict';var multer=require(_0x7a84('0x0'));var util=require(_0x7a84('0x1'));var path=require(_0x7a84('0x2'));var timeout=require(_0x7a84('0x3'));var express=require(_0x7a84('0x4'));var router=express[_0x7a84('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7a84('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a84('0x7'));var controller=require('./mailSubstatus.controller');router[_0x7a84('0x8')]('/',auth[_0x7a84('0x9')](),controller['index']);router[_0x7a84('0x8')]('/describe',auth[_0x7a84('0x9')](),controller[_0x7a84('0xa')]);router[_0x7a84('0x8')](_0x7a84('0xb'),auth[_0x7a84('0x9')](),controller['show']);router['post']('/',auth[_0x7a84('0x9')](),controller[_0x7a84('0xc')]);router[_0x7a84('0xd')](_0x7a84('0xb'),auth[_0x7a84('0x9')](),controller['update']);router[_0x7a84('0xe')]('/:id',auth[_0x7a84('0x9')](),controller[_0x7a84('0xf')]);module[_0x7a84('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3a3548b..06df1af 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 _0x13f5=['exports','STRING','name','sequelize'];(function(_0x46f025,_0x4d0e03){var _0x437770=function(_0x12baff){while(--_0x12baff){_0x46f025['push'](_0x46f025['shift']());}};_0x437770(++_0x4d0e03);}(_0x13f5,0xc3));var _0x513f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x13f5[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'name':{'type':Sequelize[_0x513f('0x2')],'unique':_0x513f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0x7d9f[_0x1f9f5f];return _0x51d649;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index cc276ef..08de5b3 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 _0x3de4=['body','find','destroy','describe','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','VIRTUAL','MailSubstatus','includeAll','include','findAll','rows','show','params','keys','length','options','catch','create'];(function(_0x194918,_0xd6333d){var _0x71360d=function(_0x4c2be1){while(--_0x4c2be1){_0x194918['push'](_0x194918['shift']());}};_0x71360d(++_0xd6333d);}(_0x3de4,0x17b));var _0x43de=function(_0xc56fd0,_0x4b2aeb){_0xc56fd0=_0xc56fd0-0x0;var _0x6f19d1=_0x3de4[_0xc56fd0];return _0x6f19d1;};'use strict';var emlformat=require(_0x43de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43de('0x1'));var rp=require('request-promise');var moment=require(_0x43de('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x43de('0x3'));var util=require(_0x43de('0x4'));var path=require(_0x43de('0x5'));var sox=require(_0x43de('0x6'));var csv=require(_0x43de('0x7'));var ejs=require(_0x43de('0x8'));var fs=require('fs');var fs_extra=require(_0x43de('0x9'));var _=require(_0x43de('0xa'));var squel=require(_0x43de('0xb'));var crypto=require(_0x43de('0xc'));var jsforce=require(_0x43de('0xd'));var deskjs=require(_0x43de('0xe'));var toCsv=require('to-csv');var querystring=require(_0x43de('0xf'));var Papa=require(_0x43de('0x10'));var Redis=require(_0x43de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x43de('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43de('0x13'))(_0x43de('0x14'));var utils=require(_0x43de('0x15'));var config=require(_0x43de('0x16'));var licenseUtil=require(_0x43de('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x327b36,_0x37a8ca){_0x37a8ca=_0x37a8ca||0xcc;return function(_0x4dd176){if(_0x4dd176){return _0x327b36[_0x43de('0x18')](_0x37a8ca);}return _0x327b36[_0x43de('0x19')](_0x37a8ca)[_0x43de('0x1a')]();};}function respondWithResult(_0x91f8a1,_0x26cc6d){_0x26cc6d=_0x26cc6d||0xc8;return function(_0x332247){if(_0x332247){return _0x91f8a1[_0x43de('0x19')](_0x26cc6d)[_0x43de('0x1b')](_0x332247);}};}function respondWithFilteredResult(_0x14b932,_0x12d143){return function(_0x49d1e0){if(_0x49d1e0){var _0x2b2ba1=typeof _0x12d143[_0x43de('0x1c')]==='undefined'&&typeof _0x12d143[_0x43de('0x1d')]===_0x43de('0x1e');var _0x142d72=_0x49d1e0[_0x43de('0x1f')];var _0x3c3e35=_0x2b2ba1?0x0:_0x12d143[_0x43de('0x1c')];var _0x331ea2=_0x2b2ba1?_0x49d1e0[_0x43de('0x1f')]:_0x12d143['offset']+_0x12d143[_0x43de('0x1d')];var _0x385db0;if(_0x331ea2>=_0x142d72){_0x331ea2=_0x142d72;_0x385db0=0xc8;}else{_0x385db0=0xce;}_0x14b932[_0x43de('0x19')](_0x385db0);return _0x14b932[_0x43de('0x20')](_0x43de('0x21'),_0x3c3e35+'-'+_0x331ea2+'/'+_0x142d72)[_0x43de('0x1b')](_0x49d1e0);}return null;};}function patchUpdates(_0x228148){return function(_0x3945c5){try{jsonpatch[_0x43de('0x22')](_0x3945c5,_0x228148,!![]);}catch(_0x3c3d81){return BPromise[_0x43de('0x23')](_0x3c3d81);}return _0x3945c5['save']();};}function saveUpdates(_0x3ea85c,_0x55e276){return function(_0x40e9f7){if(_0x40e9f7){return _0x40e9f7[_0x43de('0x24')](_0x3ea85c)[_0x43de('0x25')](function(_0x5f4017){return _0x5f4017;});}return null;};}function removeEntity(_0x51260c,_0x144633){return function(_0x569a74){if(_0x569a74){return _0x569a74['destroy']()[_0x43de('0x25')](function(){_0x51260c[_0x43de('0x19')](0xcc)[_0x43de('0x1a')]();});}};}function handleEntityNotFound(_0x908a41,_0x20e4e2){return function(_0x49b86a){if(!_0x49b86a){_0x908a41['sendStatus'](0x194);}return _0x49b86a;};}function handleError(_0x355fc6,_0x5583d7){_0x5583d7=_0x5583d7||0x1f4;return function(_0x2aa3bb){logger[_0x43de('0x26')](_0x2aa3bb[_0x43de('0x27')]);if(_0x2aa3bb[_0x43de('0x28')]){delete _0x2aa3bb[_0x43de('0x28')];}_0x355fc6[_0x43de('0x19')](_0x5583d7)['send'](_0x2aa3bb);};}exports[_0x43de('0x29')]=function(_0x380ad9,_0x23b4d9){var _0x5bee7f={},_0x5eb052={},_0x4f34df={'count':0x0,'rows':[]};var _0x17ca15=_[_0x43de('0x2a')](db['MailSubstatus'][_0x43de('0x2b')],function(_0x3c7ecc){return{'name':_0x3c7ecc[_0x43de('0x2c')],'type':_0x3c7ecc['type'][_0x43de('0x2d')]};});_0x5eb052[_0x43de('0x2e')]=_['map'](_0x17ca15,_0x43de('0x28'));_0x5eb052[_0x43de('0x2f')]=_['keys'](_0x380ad9[_0x43de('0x2f')]);_0x5eb052[_0x43de('0x30')]=_[_0x43de('0x31')](_0x5eb052[_0x43de('0x2e')],_0x5eb052[_0x43de('0x2f')]);_0x5bee7f['attributes']=_[_0x43de('0x31')](_0x5eb052['model'],qs[_0x43de('0x32')](_0x380ad9[_0x43de('0x2f')][_0x43de('0x32')]));_0x5bee7f[_0x43de('0x33')]=_0x5bee7f[_0x43de('0x33')]['length']?_0x5bee7f['attributes']:_0x5eb052[_0x43de('0x2e')];if(!_0x380ad9['query']['hasOwnProperty'](_0x43de('0x34'))){_0x5bee7f[_0x43de('0x1d')]=qs['limit'](_0x380ad9[_0x43de('0x2f')][_0x43de('0x1d')]);_0x5bee7f['offset']=qs[_0x43de('0x1c')](_0x380ad9[_0x43de('0x2f')][_0x43de('0x1c')]);}_0x5bee7f[_0x43de('0x35')]=qs[_0x43de('0x36')](_0x380ad9[_0x43de('0x2f')][_0x43de('0x36')]);_0x5bee7f['where']=qs['filters'](_[_0x43de('0x37')](_0x380ad9[_0x43de('0x2f')],_0x5eb052['filters']),_0x17ca15);if(_0x380ad9[_0x43de('0x2f')][_0x43de('0x38')]){_0x5bee7f['where']=_[_0x43de('0x39')](_0x5bee7f['where'],{'$or':_[_0x43de('0x2a')](_0x17ca15,function(_0x4bb260){if(_0x4bb260['type']!==_0x43de('0x3a')){var _0x211aeb={};_0x211aeb[_0x4bb260[_0x43de('0x28')]]={'$like':'%'+_0x380ad9[_0x43de('0x2f')][_0x43de('0x38')]+'%'};return _0x211aeb;}})});}_0x5bee7f=_[_0x43de('0x39')]({},_0x5bee7f,_0x380ad9['options']);var _0x5f3517={'where':_0x5bee7f['where']};return db[_0x43de('0x3b')]['count'](_0x5f3517)['then'](function(_0x439246){_0x4f34df[_0x43de('0x1f')]=_0x439246;if(_0x380ad9[_0x43de('0x2f')][_0x43de('0x3c')]){_0x5bee7f[_0x43de('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0x43de('0x3e')](_0x5bee7f);})[_0x43de('0x25')](function(_0x1c8815){_0x4f34df[_0x43de('0x3f')]=_0x1c8815;return _0x4f34df;})[_0x43de('0x25')](respondWithFilteredResult(_0x23b4d9,_0x5bee7f))['catch'](handleError(_0x23b4d9,null));};exports[_0x43de('0x40')]=function(_0x3f522a,_0x4c0b29){var _0x18ac64={'raw':!![],'where':{'id':_0x3f522a[_0x43de('0x41')]['id']}},_0x4a7d1c={};_0x4a7d1c[_0x43de('0x2e')]=_['keys'](db[_0x43de('0x3b')]['rawAttributes']);_0x4a7d1c[_0x43de('0x2f')]=_[_0x43de('0x42')](_0x3f522a[_0x43de('0x2f')]);_0x4a7d1c[_0x43de('0x30')]=_['intersection'](_0x4a7d1c[_0x43de('0x2e')],_0x4a7d1c[_0x43de('0x2f')]);_0x18ac64[_0x43de('0x33')]=_['intersection'](_0x4a7d1c[_0x43de('0x2e')],qs['fields'](_0x3f522a[_0x43de('0x2f')]['fields']));_0x18ac64[_0x43de('0x33')]=_0x18ac64[_0x43de('0x33')][_0x43de('0x43')]?_0x18ac64[_0x43de('0x33')]:_0x4a7d1c[_0x43de('0x2e')];if(_0x3f522a[_0x43de('0x2f')][_0x43de('0x3c')]){_0x18ac64[_0x43de('0x3d')]=[{'all':!![]}];}_0x18ac64=_[_0x43de('0x39')]({},_0x18ac64,_0x3f522a[_0x43de('0x44')]);return db[_0x43de('0x3b')]['find'](_0x18ac64)[_0x43de('0x25')](handleEntityNotFound(_0x4c0b29,null))[_0x43de('0x25')](respondWithResult(_0x4c0b29,null))[_0x43de('0x45')](handleError(_0x4c0b29,null));};exports['create']=function(_0x1779b2,_0x5db359){return db['MailSubstatus'][_0x43de('0x46')](_0x1779b2[_0x43de('0x47')],{})['then'](respondWithResult(_0x5db359,0xc9))['catch'](handleError(_0x5db359,null));};exports[_0x43de('0x24')]=function(_0x27ee26,_0x2a43c7){if(_0x27ee26[_0x43de('0x47')]['id']){delete _0x27ee26[_0x43de('0x47')]['id'];}return db[_0x43de('0x3b')][_0x43de('0x48')]({'where':{'id':_0x27ee26[_0x43de('0x41')]['id']}})[_0x43de('0x25')](handleEntityNotFound(_0x2a43c7,null))[_0x43de('0x25')](saveUpdates(_0x27ee26['body'],null))[_0x43de('0x25')](respondWithResult(_0x2a43c7,null))[_0x43de('0x45')](handleError(_0x2a43c7,null));};exports[_0x43de('0x49')]=function(_0xf3c14c,_0x5830b8){return db[_0x43de('0x3b')]['find']({'where':{'id':_0xf3c14c[_0x43de('0x41')]['id']}})[_0x43de('0x25')](handleEntityNotFound(_0x5830b8,null))[_0x43de('0x25')](removeEntity(_0x5830b8,null))[_0x43de('0x45')](handleError(_0x5830b8,null));};exports[_0x43de('0x4a')]=function(_0x3c6d91,_0x2804c1){return db[_0x43de('0x3b')]['describe']()[_0x43de('0x25')](respondWithResult(_0x2804c1,null))[_0x43de('0x45')](handleError(_0x2804c1,null));}; \ No newline at end of file +var _0xeb6e=['rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','index','MailSubstatus'];(function(_0x28021b,_0x43619d){var _0x273cf3=function(_0x2d3eac){while(--_0x2d3eac){_0x28021b['push'](_0x28021b['shift']());}};_0x273cf3(++_0x43619d);}(_0xeb6e,0x6a));var _0xeeb6=function(_0x1a15a3,_0x4f1fc6){_0x1a15a3=_0x1a15a3-0x0;var _0x153241=_0xeb6e[_0x1a15a3];return _0x153241;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeb6('0x0'));var zipdir=require(_0xeeb6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeeb6('0x2'));var moment=require(_0xeeb6('0x3'));var BPromise=require(_0xeeb6('0x4'));var Mustache=require(_0xeeb6('0x5'));var util=require(_0xeeb6('0x6'));var path=require(_0xeeb6('0x7'));var sox=require(_0xeeb6('0x8'));var csv=require(_0xeeb6('0x9'));var ejs=require(_0xeeb6('0xa'));var fs=require('fs');var fs_extra=require(_0xeeb6('0xb'));var _=require(_0xeeb6('0xc'));var squel=require('squel');var crypto=require(_0xeeb6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeeb6('0xe'));var toCsv=require(_0xeeb6('0x9'));var querystring=require(_0xeeb6('0xf'));var Papa=require(_0xeeb6('0x10'));var Redis=require(_0xeeb6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xeeb6('0x12'));var as=require(_0xeeb6('0x13'));var hardwareService=require(_0xeeb6('0x14'));var logger=require(_0xeeb6('0x15'))(_0xeeb6('0x16'));var utils=require(_0xeeb6('0x17'));var config=require(_0xeeb6('0x18'));var licenseUtil=require(_0xeeb6('0x19'));var db=require(_0xeeb6('0x1a'))['db'];function respondWithStatusCode(_0xe689d9,_0x178ea2){_0x178ea2=_0x178ea2||0xcc;return function(_0x296efc){if(_0x296efc){return _0xe689d9[_0xeeb6('0x1b')](_0x178ea2);}return _0xe689d9[_0xeeb6('0x1c')](_0x178ea2)[_0xeeb6('0x1d')]();};}function respondWithResult(_0x2e868d,_0x1b3969){_0x1b3969=_0x1b3969||0xc8;return function(_0x300134){if(_0x300134){return _0x2e868d[_0xeeb6('0x1c')](_0x1b3969)[_0xeeb6('0x1e')](_0x300134);}};}function respondWithFilteredResult(_0x1edd70,_0x362ea7){return function(_0x4b4efe){if(_0x4b4efe){var _0x322bd1=typeof _0x362ea7['offset']===_0xeeb6('0x1f')&&typeof _0x362ea7[_0xeeb6('0x20')]==='undefined';var _0x569930=_0x4b4efe[_0xeeb6('0x21')];var _0xfee73c=_0x322bd1?0x0:_0x362ea7[_0xeeb6('0x22')];var _0x5bb9f5=_0x322bd1?_0x4b4efe[_0xeeb6('0x21')]:_0x362ea7['offset']+_0x362ea7[_0xeeb6('0x20')];var _0x370135;if(_0x5bb9f5>=_0x569930){_0x5bb9f5=_0x569930;_0x370135=0xc8;}else{_0x370135=0xce;}_0x1edd70[_0xeeb6('0x1c')](_0x370135);return _0x1edd70[_0xeeb6('0x23')](_0xeeb6('0x24'),_0xfee73c+'-'+_0x5bb9f5+'/'+_0x569930)[_0xeeb6('0x1e')](_0x4b4efe);}return null;};}function patchUpdates(_0x46a020){return function(_0x2db711){try{jsonpatch[_0xeeb6('0x25')](_0x2db711,_0x46a020,!![]);}catch(_0xe6d0b0){return BPromise[_0xeeb6('0x26')](_0xe6d0b0);}return _0x2db711['save']();};}function saveUpdates(_0x29efe5,_0x173038){return function(_0xe8081d){if(_0xe8081d){return _0xe8081d[_0xeeb6('0x27')](_0x29efe5)[_0xeeb6('0x28')](function(_0x4afd01){return _0x4afd01;});}return null;};}function removeEntity(_0x59f897,_0x50731a){return function(_0x4df200){if(_0x4df200){return _0x4df200['destroy']()[_0xeeb6('0x28')](function(){_0x59f897[_0xeeb6('0x1c')](0xcc)[_0xeeb6('0x1d')]();});}};}function handleEntityNotFound(_0xf42de9,_0x1473e5){return function(_0x4f5c70){if(!_0x4f5c70){_0xf42de9['sendStatus'](0x194);}return _0x4f5c70;};}function handleError(_0x1cd48f,_0x3b9775){_0x3b9775=_0x3b9775||0x1f4;return function(_0x1147d7){logger[_0xeeb6('0x29')](_0x1147d7['stack']);if(_0x1147d7[_0xeeb6('0x2a')]){delete _0x1147d7[_0xeeb6('0x2a')];}_0x1cd48f[_0xeeb6('0x1c')](_0x3b9775)[_0xeeb6('0x2b')](_0x1147d7);};}exports[_0xeeb6('0x2c')]=function(_0x540b56,_0x2cd0cc){var _0x5b1aeb={},_0x552421={},_0x4ab2ab={'count':0x0,'rows':[]};var _0x17f621=_['map'](db[_0xeeb6('0x2d')][_0xeeb6('0x2e')],function(_0x5ddf22){return{'name':_0x5ddf22[_0xeeb6('0x2f')],'type':_0x5ddf22['type'][_0xeeb6('0x30')]};});_0x552421[_0xeeb6('0x31')]=_[_0xeeb6('0x32')](_0x17f621,_0xeeb6('0x2a'));_0x552421['query']=_[_0xeeb6('0x33')](_0x540b56[_0xeeb6('0x34')]);_0x552421['filters']=_[_0xeeb6('0x35')](_0x552421[_0xeeb6('0x31')],_0x552421[_0xeeb6('0x34')]);_0x5b1aeb[_0xeeb6('0x36')]=_[_0xeeb6('0x35')](_0x552421[_0xeeb6('0x31')],qs[_0xeeb6('0x37')](_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x37')]));_0x5b1aeb[_0xeeb6('0x36')]=_0x5b1aeb[_0xeeb6('0x36')][_0xeeb6('0x38')]?_0x5b1aeb[_0xeeb6('0x36')]:_0x552421['model'];if(!_0x540b56['query']['hasOwnProperty'](_0xeeb6('0x39'))){_0x5b1aeb[_0xeeb6('0x20')]=qs[_0xeeb6('0x20')](_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x20')]);_0x5b1aeb[_0xeeb6('0x22')]=qs['offset'](_0x540b56[_0xeeb6('0x34')]['offset']);}_0x5b1aeb[_0xeeb6('0x3a')]=qs['sort'](_0x540b56[_0xeeb6('0x34')]['sort']);_0x5b1aeb[_0xeeb6('0x3b')]=qs[_0xeeb6('0x3c')](_[_0xeeb6('0x3d')](_0x540b56[_0xeeb6('0x34')],_0x552421[_0xeeb6('0x3c')]),_0x17f621);if(_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x3e')]){_0x5b1aeb[_0xeeb6('0x3b')]=_[_0xeeb6('0x3f')](_0x5b1aeb[_0xeeb6('0x3b')],{'$or':_['map'](_0x17f621,function(_0x961c4c){if(_0x961c4c[_0xeeb6('0x40')]!==_0xeeb6('0x41')){var _0x387dde={};_0x387dde[_0x961c4c[_0xeeb6('0x2a')]]={'$like':'%'+_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x3e')]+'%'};return _0x387dde;}})});}_0x5b1aeb=_[_0xeeb6('0x3f')]({},_0x5b1aeb,_0x540b56[_0xeeb6('0x42')]);var _0x1a7bfa={'where':_0x5b1aeb['where']};return db[_0xeeb6('0x2d')][_0xeeb6('0x21')](_0x1a7bfa)['then'](function(_0x1c67b4){_0x4ab2ab[_0xeeb6('0x21')]=_0x1c67b4;if(_0x540b56[_0xeeb6('0x34')][_0xeeb6('0x43')]){_0x5b1aeb['include']=[{'all':!![]}];}return db[_0xeeb6('0x2d')]['findAll'](_0x5b1aeb);})[_0xeeb6('0x28')](function(_0x5d911a){_0x4ab2ab['rows']=_0x5d911a;return _0x4ab2ab;})[_0xeeb6('0x28')](respondWithFilteredResult(_0x2cd0cc,_0x5b1aeb))[_0xeeb6('0x44')](handleError(_0x2cd0cc,null));};exports[_0xeeb6('0x45')]=function(_0x375b03,_0x380364){var _0x348f65={'raw':!![],'where':{'id':_0x375b03[_0xeeb6('0x46')]['id']}},_0x23b037={};_0x23b037[_0xeeb6('0x31')]=_['keys'](db[_0xeeb6('0x2d')]['rawAttributes']);_0x23b037[_0xeeb6('0x34')]=_[_0xeeb6('0x33')](_0x375b03[_0xeeb6('0x34')]);_0x23b037['filters']=_[_0xeeb6('0x35')](_0x23b037[_0xeeb6('0x31')],_0x23b037[_0xeeb6('0x34')]);_0x348f65[_0xeeb6('0x36')]=_['intersection'](_0x23b037[_0xeeb6('0x31')],qs[_0xeeb6('0x37')](_0x375b03['query'][_0xeeb6('0x37')]));_0x348f65['attributes']=_0x348f65[_0xeeb6('0x36')]['length']?_0x348f65[_0xeeb6('0x36')]:_0x23b037[_0xeeb6('0x31')];if(_0x375b03[_0xeeb6('0x34')][_0xeeb6('0x43')]){_0x348f65[_0xeeb6('0x47')]=[{'all':!![]}];}_0x348f65=_[_0xeeb6('0x3f')]({},_0x348f65,_0x375b03[_0xeeb6('0x42')]);return db[_0xeeb6('0x2d')][_0xeeb6('0x48')](_0x348f65)[_0xeeb6('0x28')](handleEntityNotFound(_0x380364,null))[_0xeeb6('0x28')](respondWithResult(_0x380364,null))[_0xeeb6('0x44')](handleError(_0x380364,null));};exports[_0xeeb6('0x49')]=function(_0x4137e0,_0x310d13){return db[_0xeeb6('0x2d')][_0xeeb6('0x49')](_0x4137e0[_0xeeb6('0x4a')],{})['then'](respondWithResult(_0x310d13,0xc9))[_0xeeb6('0x44')](handleError(_0x310d13,null));};exports[_0xeeb6('0x27')]=function(_0x762044,_0x1cdf93){if(_0x762044[_0xeeb6('0x4a')]['id']){delete _0x762044[_0xeeb6('0x4a')]['id'];}return db[_0xeeb6('0x2d')][_0xeeb6('0x48')]({'where':{'id':_0x762044[_0xeeb6('0x46')]['id']}})[_0xeeb6('0x28')](handleEntityNotFound(_0x1cdf93,null))['then'](saveUpdates(_0x762044[_0xeeb6('0x4a')],null))[_0xeeb6('0x28')](respondWithResult(_0x1cdf93,null))['catch'](handleError(_0x1cdf93,null));};exports['destroy']=function(_0x409136,_0x367f40){return db[_0xeeb6('0x2d')]['find']({'where':{'id':_0x409136[_0xeeb6('0x46')]['id']}})[_0xeeb6('0x28')](handleEntityNotFound(_0x367f40,null))['then'](removeEntity(_0x367f40,null))[_0xeeb6('0x44')](handleError(_0x367f40,null));};exports[_0xeeb6('0x4b')]=function(_0x575b03,_0x42e057){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x42e057,null))['catch'](handleError(_0x42e057,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index c8f1ebe..0b3af53 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 _0xed5f=['events','MailSubstatus','update','emit'];(function(_0x1f9f91,_0xe5a45){var _0x409d8f=function(_0xe151d1){while(--_0xe151d1){_0x1f9f91['push'](_0x1f9f91['shift']());}};_0x409d8f(++_0xe5a45);}(_0xed5f,0x1c8));var _0xfed5=function(_0x2f2572,_0x26b8f0){_0x2f2572=_0x2f2572-0x0;var _0x1ef2ac=_0xed5f[_0x2f2572];return _0x1ef2ac;};'use strict';var EventEmitter=require(_0xfed5('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xfed5('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xfed5('0x2')};function emitEvent(_0x491307){return function(_0x678592,_0x390746,_0x3358c3){MailSubstatusEvents['emit'](_0x491307+':'+_0x678592['id'],_0x678592);MailSubstatusEvents[_0xfed5('0x3')](_0x491307,_0x678592);_0x3358c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x1fb6=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1a7d85,_0x40acbc){var _0x3a82fb=function(_0x4e5584){while(--_0x4e5584){_0x1a7d85['push'](_0x1a7d85['shift']());}};_0x3a82fb(++_0x40acbc);}(_0x1fb6,0xe8));var _0x61fb=function(_0x5c823b,_0x31bfee){_0x5c823b=_0x5c823b-0x0;var _0x662a12=_0x1fb6[_0x5c823b];return _0x662a12;};'use strict';var EventEmitter=require(_0x61fb('0x0'));var MailSubstatus=require(_0x61fb('0x1'))['db'][_0x61fb('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x61fb('0x3')](0x0);var events={'afterUpdate':_0x61fb('0x4')};function emitEvent(_0x5aba33){return function(_0xc082bc,_0x233dcd,_0x3b551a){MailSubstatusEvents[_0x61fb('0x5')](_0x5aba33+':'+_0xc082bc['id'],_0xc082bc);MailSubstatusEvents['emit'](_0x5aba33,_0xc082bc);_0x3b551a(null);};}for(var e in events){if(events[_0x61fb('0x6')](e)){var event=events[e];MailSubstatus[_0x61fb('0x7')](e,emitEvent(event));}}module[_0x61fb('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index db065b9..b10a6d1 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 _0x0bbe=['name','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','_previousDataValues'];(function(_0x3dacec,_0x52822a){var _0x53abd4=function(_0x1ef55c){while(--_0x1ef55c){_0x3dacec['push'](_0x3dacec['shift']());}};_0x53abd4(++_0x52822a);}(_0x0bbe,0xc9));var _0xe0bb=function(_0xa11cd3,_0x3a3af1){_0xa11cd3=_0xa11cd3-0x0;var _0xa085b6=_0x0bbe[_0xa11cd3];return _0xa085b6;};'use strict';var attributes=require(_0xe0bb('0x0'));module[_0xe0bb('0x1')]=function(_0x27f54e){var _0x2920a7=_0x27f54e[_0xe0bb('0x2')];return _0x27f54e[_0xe0bb('0x3')](_0xe0bb('0x4'),attributes,{'tableName':_0xe0bb('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x36768c,_0x5ab2f3,_0x4a9ef3){return _0x2920a7['Condition']['update']({'value':_0x36768c['name']},{'where':{'field':'mailSubstatus','value':_0x36768c[_0xe0bb('0x6')][_0xe0bb('0x7')]}})['then'](function(){_0x4a9ef3();})['catch'](function(_0x53d62a){_0x4a9ef3(_0x53d62a);});}}});}; \ No newline at end of file +var _0xcaae=['name','mailSubstatus','catch','./mailSubstatus.attributes','exports','define','mail_substatuses','Condition','update'];(function(_0x5bb0c0,_0x5dc885){var _0xd22ddf=function(_0x24dd49){while(--_0x24dd49){_0x5bb0c0['push'](_0x5bb0c0['shift']());}};_0xd22ddf(++_0x5dc885);}(_0xcaae,0xc0));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xecaa('0x0'));module[_0xecaa('0x1')]=function(_0x4b5e31){var _0x3cad28=_0x4b5e31['models'];return _0x4b5e31[_0xecaa('0x2')]('MailSubstatus',attributes,{'tableName':_0xecaa('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1d6d45,_0x258543,_0x40f74d){return _0x3cad28[_0xecaa('0x4')][_0xecaa('0x5')]({'value':_0x1d6d45[_0xecaa('0x6')]},{'where':{'field':_0xecaa('0x7'),'value':_0x1d6d45['_previousDataValues']['name']}})['then'](function(){_0x40f74d();})[_0xecaa('0x8')](function(_0x3b77ce){_0x40f74d(_0x3b77ce);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ec2a54a..50ead9c 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 _0x8885=['client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x287528,_0x2fbba7){var _0xc05e28=function(_0x264866){while(--_0x264866){_0x287528['push'](_0x287528['shift']());}};_0xc05e28(++_0x2fbba7);}(_0x8885,0x8b));var _0x5888=function(_0x2f5cdb,_0x2606ba){_0x2f5cdb=_0x2f5cdb-0x0;var _0x14587f=_0x8885[_0x2f5cdb];return _0x14587f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5888('0x0'));var BPromise=require('bluebird');var rs=require(_0x5888('0x1'));var fs=require('fs');var Redis=require(_0x5888('0x2'));var db=require(_0x5888('0x3'))['db'];var utils=require(_0x5888('0x4'));var logger=require(_0x5888('0x5'))(_0x5888('0x6'));var config=require(_0x5888('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5888('0x8')][_0x5888('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e5e0d,_0x2b2d23,_0x1d5ee3){return new BPromise(function(_0x18fb1a,_0x4b0073){return client[_0x5888('0xa')](_0x2e5e0d,_0x1d5ee3)[_0x5888('0xb')](function(_0x8723df){logger[_0x5888('0xc')](_0x5888('0xd'),_0x2b2d23,_0x5888('0xe'));logger[_0x5888('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2b2d23,_0x5888('0xe'),JSON['stringify'](_0x8723df));if(_0x8723df[_0x5888('0x10')]){if(_0x8723df['error'][_0x5888('0x11')]===0x1f4){logger[_0x5888('0x10')](_0x5888('0xd'),_0x2b2d23,_0x8723df[_0x5888('0x10')][_0x5888('0x12')]);return _0x4b0073(_0x8723df[_0x5888('0x10')][_0x5888('0x12')]);}logger['error'](_0x5888('0xd'),_0x2b2d23,_0x8723df['error'][_0x5888('0x12')]);return _0x18fb1a(_0x8723df['error'][_0x5888('0x12')]);}else{logger[_0x5888('0xc')](_0x5888('0xd'),_0x2b2d23,'request\x20sent');_0x18fb1a(_0x8723df[_0x5888('0x13')][_0x5888('0x12')]);}})[_0x5888('0x14')](function(_0x5317ab){logger[_0x5888('0x10')](_0x5888('0xd'),_0x2b2d23,_0x5317ab);_0x4b0073(_0x5317ab);});});} \ No newline at end of file +var _0xfffc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util'];(function(_0x4188b5,_0x2a6aff){var _0x547a41=function(_0x6b0a8e){while(--_0x6b0a8e){_0x4188b5['push'](_0x4188b5['shift']());}};_0x547a41(++_0x2a6aff);}(_0xfffc,0x1c6));var _0xcfff=function(_0x3294dd,_0x5217cb){_0x3294dd=_0x3294dd-0x0;var _0x4377f5=_0xfffc[_0x3294dd];return _0x4377f5;};'use strict';var _=require(_0xcfff('0x0'));var util=require(_0xcfff('0x1'));var moment=require(_0xcfff('0x2'));var BPromise=require(_0xcfff('0x3'));var rs=require(_0xcfff('0x4'));var fs=require('fs');var Redis=require(_0xcfff('0x5'));var db=require(_0xcfff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfff('0x7'))(_0xcfff('0x8'));var config=require(_0xcfff('0x9'));var jayson=require(_0xcfff('0xa'));var client=jayson[_0xcfff('0xb')][_0xcfff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3729ee,_0x2603dc,_0x19118d){return new BPromise(function(_0x24cbe0,_0x3f7d1d){return client[_0xcfff('0xd')](_0x3729ee,_0x19118d)[_0xcfff('0xe')](function(_0x33cd0b){logger[_0xcfff('0xf')](_0xcfff('0x10'),_0x2603dc,'request\x20sent');logger[_0xcfff('0x11')](_0xcfff('0x12'),_0x2603dc,'request\x20sent',JSON['stringify'](_0x33cd0b));if(_0x33cd0b[_0xcfff('0x13')]){if(_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x14')]===0x1f4){logger[_0xcfff('0x13')](_0xcfff('0x10'),_0x2603dc,_0x33cd0b['error'][_0xcfff('0x15')]);return _0x3f7d1d(_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x15')]);}logger[_0xcfff('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2603dc,_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x15')]);return _0x24cbe0(_0x33cd0b[_0xcfff('0x13')][_0xcfff('0x15')]);}else{logger['info'](_0xcfff('0x10'),_0x2603dc,_0xcfff('0x16'));_0x24cbe0(_0x33cd0b[_0xcfff('0x17')][_0xcfff('0x15')]);}})['catch'](function(_0x348610){logger[_0xcfff('0x13')](_0xcfff('0x10'),_0x2603dc,_0x348610);_0x3f7d1d(_0x348610);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e132315..72388cf 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 _0xbf1b=['index','isAuthenticated','describe','/:id','post','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xbf1b,0x190));var _0xbbf1=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xbf1b[_0x5f0089];return _0x193892;};'use strict';var multer=require('multer');var util=require(_0xbbf1('0x0'));var path=require(_0xbbf1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbbf1('0x2'));var auth=require(_0xbbf1('0x3'));var interaction=require(_0xbbf1('0x4'));var config=require(_0xbbf1('0x5'));var controller=require(_0xbbf1('0x6'));router[_0xbbf1('0x7')]('/',auth['isAuthenticated'](),controller[_0xbbf1('0x8')]);router['get']('/describe',auth[_0xbbf1('0x9')](),controller[_0xbbf1('0xa')]);router[_0xbbf1('0x7')](_0xbbf1('0xb'),auth[_0xbbf1('0x9')](),controller['show']);router[_0xbbf1('0xc')]('/',auth[_0xbbf1('0x9')](),controller['create']);router['put'](_0xbbf1('0xb'),auth[_0xbbf1('0x9')](),controller[_0xbbf1('0xd')]);router[_0xbbf1('0xe')](_0xbbf1('0xb'),auth['isAuthenticated'](),controller[_0xbbf1('0xf')]);module[_0xbbf1('0x10')]=router; \ No newline at end of file +var _0xc1ae=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','isAuthenticated','describe'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0xc1ae,0x189));var _0xec1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec1a('0x0'));var util=require(_0xec1a('0x1'));var path=require(_0xec1a('0x2'));var timeout=require(_0xec1a('0x3'));var express=require(_0xec1a('0x4'));var router=express[_0xec1a('0x5')]();var fs_extra=require(_0xec1a('0x6'));var auth=require(_0xec1a('0x7'));var interaction=require(_0xec1a('0x8'));var config=require(_0xec1a('0x9'));var controller=require(_0xec1a('0xa'));router[_0xec1a('0xb')]('/',auth['isAuthenticated'](),controller[_0xec1a('0xc')]);router[_0xec1a('0xb')]('/describe',auth[_0xec1a('0xd')](),controller[_0xec1a('0xe')]);router['get'](_0xec1a('0xf'),auth['isAuthenticated'](),controller[_0xec1a('0x10')]);router[_0xec1a('0x11')]('/',auth['isAuthenticated'](),controller[_0xec1a('0x12')]);router[_0xec1a('0x13')](_0xec1a('0xf'),auth[_0xec1a('0xd')](),controller[_0xec1a('0x14')]);router[_0xec1a('0x15')]('/:id',auth[_0xec1a('0xd')](),controller[_0xec1a('0x16')]);module[_0xec1a('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index dddbc01..6ba0912 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x53a11c,_0x393441){var _0x2680d5=function(_0xd3d1e2){while(--_0xd3d1e2){_0x53a11c['push'](_0x53a11c['shift']());}};_0x2680d5(++_0x393441);}(_0x54ef,0x112));var _0xf54e=function(_0xdd115a,_0xe45d3c){_0xdd115a=_0xdd115a-0x0;var _0x13a9b9=_0x54ef[_0xdd115a];return _0x13a9b9;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x39ce7c,_0x141640){var _0x2dd7cf=function(_0x17ac09){while(--_0x17ac09){_0x39ce7c['push'](_0x39ce7c['shift']());}};_0x2dd7cf(++_0x141640);}(_0x008c,0x188));var _0xc008=function(_0x2fff52,_0x1580ac){_0x2fff52=_0x2fff52-0x0;var _0x4fef52=_0x008c[_0x2fff52];return _0x4fef52;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ff40a34..1fa6f18 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 _0xb9f2=['undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','MailTransferReport','includeAll','include','findAll','rows','params','length','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset'];(function(_0x1c82a4,_0x49811a){var _0x41fcea=function(_0x19074e){while(--_0x19074e){_0x1c82a4['push'](_0x1c82a4['shift']());}};_0x41fcea(++_0x49811a);}(_0xb9f2,0x1b0));var _0x2b9f=function(_0x3b5713,_0x302e72){_0x3b5713=_0x3b5713-0x0;var _0x3cc459=_0xb9f2[_0x3b5713];return _0x3cc459;};'use strict';var emlformat=require(_0x2b9f('0x0'));var rimraf=require(_0x2b9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b9f('0x2'));var rp=require(_0x2b9f('0x3'));var moment=require(_0x2b9f('0x4'));var BPromise=require(_0x2b9f('0x5'));var Mustache=require('mustache');var util=require(_0x2b9f('0x6'));var path=require(_0x2b9f('0x7'));var sox=require(_0x2b9f('0x8'));var csv=require(_0x2b9f('0x9'));var ejs=require(_0x2b9f('0xa'));var fs=require('fs');var fs_extra=require(_0x2b9f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b9f('0xc'));var jsforce=require(_0x2b9f('0xd'));var deskjs=require(_0x2b9f('0xe'));var toCsv=require(_0x2b9f('0x9'));var querystring=require(_0x2b9f('0xf'));var Papa=require(_0x2b9f('0x10'));var Redis=require(_0x2b9f('0x11'));var authService=require(_0x2b9f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2b9f('0x13'));var hardwareService=require(_0x2b9f('0x14'));var logger=require(_0x2b9f('0x15'))(_0x2b9f('0x16'));var utils=require(_0x2b9f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b9f('0x18'));var db=require(_0x2b9f('0x19'))['db'];function respondWithStatusCode(_0x5d6433,_0x2d997f){_0x2d997f=_0x2d997f||0xcc;return function(_0x393bab){if(_0x393bab){return _0x5d6433[_0x2b9f('0x1a')](_0x2d997f);}return _0x5d6433['status'](_0x2d997f)[_0x2b9f('0x1b')]();};}function respondWithResult(_0x5e6bdd,_0x442191){_0x442191=_0x442191||0xc8;return function(_0x2ea992){if(_0x2ea992){return _0x5e6bdd[_0x2b9f('0x1c')](_0x442191)['json'](_0x2ea992);}};}function respondWithFilteredResult(_0x465c5e,_0x4e7674){return function(_0x377838){if(_0x377838){var _0x3b49f0=typeof _0x4e7674[_0x2b9f('0x1d')]===_0x2b9f('0x1e')&&typeof _0x4e7674[_0x2b9f('0x1f')]===_0x2b9f('0x1e');var _0x226d50=_0x377838['count'];var _0x10c902=_0x3b49f0?0x0:_0x4e7674[_0x2b9f('0x1d')];var _0x12a5f9=_0x3b49f0?_0x377838[_0x2b9f('0x20')]:_0x4e7674[_0x2b9f('0x1d')]+_0x4e7674[_0x2b9f('0x1f')];var _0x536c83;if(_0x12a5f9>=_0x226d50){_0x12a5f9=_0x226d50;_0x536c83=0xc8;}else{_0x536c83=0xce;}_0x465c5e[_0x2b9f('0x1c')](_0x536c83);return _0x465c5e[_0x2b9f('0x21')](_0x2b9f('0x22'),_0x10c902+'-'+_0x12a5f9+'/'+_0x226d50)[_0x2b9f('0x23')](_0x377838);}return null;};}function patchUpdates(_0x5c036e){return function(_0xd47995){try{jsonpatch['apply'](_0xd47995,_0x5c036e,!![]);}catch(_0xed6f3b){return BPromise[_0x2b9f('0x24')](_0xed6f3b);}return _0xd47995[_0x2b9f('0x25')]();};}function saveUpdates(_0x223f65,_0x3acf32){return function(_0x39c359){if(_0x39c359){return _0x39c359['update'](_0x223f65)['then'](function(_0x574d2b){return _0x574d2b;});}return null;};}function removeEntity(_0x2ed3f3,_0x5bfd32){return function(_0x1ec957){if(_0x1ec957){return _0x1ec957[_0x2b9f('0x26')]()[_0x2b9f('0x27')](function(){_0x2ed3f3[_0x2b9f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148c74,_0x584310){return function(_0x31d11b){if(!_0x31d11b){_0x148c74['sendStatus'](0x194);}return _0x31d11b;};}function handleError(_0x51984e,_0x10ee8f){_0x10ee8f=_0x10ee8f||0x1f4;return function(_0x328d59){logger[_0x2b9f('0x28')](_0x328d59[_0x2b9f('0x29')]);if(_0x328d59[_0x2b9f('0x2a')]){delete _0x328d59['name'];}_0x51984e['status'](_0x10ee8f)[_0x2b9f('0x2b')](_0x328d59);};}exports[_0x2b9f('0x2c')]=function(_0x1a8b93,_0x450f87){var _0x11419c={},_0x5d37a4={},_0x104ec3={'count':0x0,'rows':[]};var _0x3b5e19=_[_0x2b9f('0x2d')](db['MailTransferReport'][_0x2b9f('0x2e')],function(_0x23f93d){return{'name':_0x23f93d[_0x2b9f('0x2f')],'type':_0x23f93d[_0x2b9f('0x30')]['key']};});_0x5d37a4[_0x2b9f('0x31')]=_[_0x2b9f('0x2d')](_0x3b5e19,_0x2b9f('0x2a'));_0x5d37a4[_0x2b9f('0x32')]=_[_0x2b9f('0x33')](_0x1a8b93[_0x2b9f('0x32')]);_0x5d37a4[_0x2b9f('0x34')]=_[_0x2b9f('0x35')](_0x5d37a4[_0x2b9f('0x31')],_0x5d37a4['query']);_0x11419c[_0x2b9f('0x36')]=_['intersection'](_0x5d37a4[_0x2b9f('0x31')],qs['fields'](_0x1a8b93[_0x2b9f('0x32')][_0x2b9f('0x37')]));_0x11419c[_0x2b9f('0x36')]=_0x11419c[_0x2b9f('0x36')]['length']?_0x11419c['attributes']:_0x5d37a4['model'];if(!_0x1a8b93[_0x2b9f('0x32')]['hasOwnProperty'](_0x2b9f('0x38'))){_0x11419c[_0x2b9f('0x1f')]=qs['limit'](_0x1a8b93[_0x2b9f('0x32')][_0x2b9f('0x1f')]);_0x11419c[_0x2b9f('0x1d')]=qs[_0x2b9f('0x1d')](_0x1a8b93[_0x2b9f('0x32')]['offset']);}_0x11419c[_0x2b9f('0x39')]=qs[_0x2b9f('0x3a')](_0x1a8b93['query'][_0x2b9f('0x3a')]);_0x11419c[_0x2b9f('0x3b')]=qs['filters'](_['pick'](_0x1a8b93[_0x2b9f('0x32')],_0x5d37a4['filters']),_0x3b5e19);if(_0x1a8b93[_0x2b9f('0x32')]['filter']){_0x11419c[_0x2b9f('0x3b')]=_[_0x2b9f('0x3c')](_0x11419c[_0x2b9f('0x3b')],{'$or':_['map'](_0x3b5e19,function(_0xc17162){if(_0xc17162['type']!==_0x2b9f('0x3d')){var _0x460fe3={};_0x460fe3[_0xc17162[_0x2b9f('0x2a')]]={'$like':'%'+_0x1a8b93[_0x2b9f('0x32')][_0x2b9f('0x3e')]+'%'};return _0x460fe3;}})});}_0x11419c=_[_0x2b9f('0x3c')]({},_0x11419c,_0x1a8b93[_0x2b9f('0x3f')]);var _0x2bc145={'where':_0x11419c[_0x2b9f('0x3b')]};return db[_0x2b9f('0x40')][_0x2b9f('0x20')](_0x2bc145)[_0x2b9f('0x27')](function(_0x55c115){_0x104ec3[_0x2b9f('0x20')]=_0x55c115;if(_0x1a8b93['query'][_0x2b9f('0x41')]){_0x11419c[_0x2b9f('0x42')]=[{'all':!![]}];}return db[_0x2b9f('0x40')][_0x2b9f('0x43')](_0x11419c);})[_0x2b9f('0x27')](function(_0x1b16ff){_0x104ec3[_0x2b9f('0x44')]=_0x1b16ff;return _0x104ec3;})[_0x2b9f('0x27')](respondWithFilteredResult(_0x450f87,_0x11419c))['catch'](handleError(_0x450f87,null));};exports['show']=function(_0x3c8c67,_0x3341ca){var _0x1c6345={'raw':!![],'where':{'id':_0x3c8c67[_0x2b9f('0x45')]['id']}},_0x54ec26={};_0x54ec26[_0x2b9f('0x31')]=_[_0x2b9f('0x33')](db[_0x2b9f('0x40')][_0x2b9f('0x2e')]);_0x54ec26[_0x2b9f('0x32')]=_[_0x2b9f('0x33')](_0x3c8c67[_0x2b9f('0x32')]);_0x54ec26['filters']=_[_0x2b9f('0x35')](_0x54ec26[_0x2b9f('0x31')],_0x54ec26[_0x2b9f('0x32')]);_0x1c6345[_0x2b9f('0x36')]=_[_0x2b9f('0x35')](_0x54ec26[_0x2b9f('0x31')],qs[_0x2b9f('0x37')](_0x3c8c67[_0x2b9f('0x32')][_0x2b9f('0x37')]));_0x1c6345[_0x2b9f('0x36')]=_0x1c6345[_0x2b9f('0x36')][_0x2b9f('0x46')]?_0x1c6345['attributes']:_0x54ec26['model'];if(_0x3c8c67[_0x2b9f('0x32')][_0x2b9f('0x41')]){_0x1c6345['include']=[{'all':!![]}];}_0x1c6345=_['merge']({},_0x1c6345,_0x3c8c67[_0x2b9f('0x3f')]);return db['MailTransferReport'][_0x2b9f('0x47')](_0x1c6345)[_0x2b9f('0x27')](handleEntityNotFound(_0x3341ca,null))[_0x2b9f('0x27')](respondWithResult(_0x3341ca,null))[_0x2b9f('0x48')](handleError(_0x3341ca,null));};exports[_0x2b9f('0x49')]=function(_0x81379f,_0x1abb57){return db[_0x2b9f('0x40')][_0x2b9f('0x49')](_0x81379f[_0x2b9f('0x4a')],{})[_0x2b9f('0x27')](respondWithResult(_0x1abb57,0xc9))['catch'](handleError(_0x1abb57,null));};exports[_0x2b9f('0x4b')]=function(_0x121017,_0x15f841){if(_0x121017[_0x2b9f('0x4a')]['id']){delete _0x121017['body']['id'];}return db[_0x2b9f('0x40')]['find']({'where':{'id':_0x121017[_0x2b9f('0x45')]['id']}})[_0x2b9f('0x27')](handleEntityNotFound(_0x15f841,null))[_0x2b9f('0x27')](saveUpdates(_0x121017[_0x2b9f('0x4a')],null))[_0x2b9f('0x27')](respondWithResult(_0x15f841,null))[_0x2b9f('0x48')](handleError(_0x15f841,null));};exports[_0x2b9f('0x26')]=function(_0x28b510,_0x347fc4){return db[_0x2b9f('0x40')]['find']({'where':{'id':_0x28b510['params']['id']}})[_0x2b9f('0x27')](handleEntityNotFound(_0x347fc4,null))['then'](removeEntity(_0x347fc4,null))[_0x2b9f('0x48')](handleError(_0x347fc4,null));};exports[_0x2b9f('0x4c')]=function(_0x2d8520,_0x513424){return db[_0x2b9f('0x40')][_0x2b9f('0x4c')]()[_0x2b9f('0x27')](respondWithResult(_0x513424,null))[_0x2b9f('0x48')](handleError(_0x513424,null));}; \ No newline at end of file +var _0xb73b=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','show','find','catch','create','body','params','destroy','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x34eabc,_0x51d411){var _0x43e72f=function(_0x5619e8){while(--_0x5619e8){_0x34eabc['push'](_0x34eabc['shift']());}};_0x43e72f(++_0x51d411);}(_0xb73b,0x16f));var _0xbb73=function(_0x2f58a2,_0x1121bf){_0x2f58a2=_0x2f58a2-0x0;var _0x35b49a=_0xb73b[_0x2f58a2];return _0x35b49a;};'use strict';var emlformat=require(_0xbb73('0x0'));var rimraf=require(_0xbb73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb73('0x2'));var moment=require(_0xbb73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbb73('0x4'));var util=require(_0xbb73('0x5'));var path=require(_0xbb73('0x6'));var sox=require(_0xbb73('0x7'));var csv=require(_0xbb73('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb73('0x9'));var _=require('lodash');var squel=require(_0xbb73('0xa'));var crypto=require(_0xbb73('0xb'));var jsforce=require(_0xbb73('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb73('0xd'));var Redis=require('ioredis');var authService=require(_0xbb73('0xe'));var qs=require(_0xbb73('0xf'));var as=require(_0xbb73('0x10'));var hardwareService=require(_0xbb73('0x11'));var logger=require(_0xbb73('0x12'))(_0xbb73('0x13'));var utils=require(_0xbb73('0x14'));var config=require(_0xbb73('0x15'));var licenseUtil=require(_0xbb73('0x16'));var db=require(_0xbb73('0x17'))['db'];function respondWithStatusCode(_0x162f94,_0x3622bc){_0x3622bc=_0x3622bc||0xcc;return function(_0x24ff3f){if(_0x24ff3f){return _0x162f94[_0xbb73('0x18')](_0x3622bc);}return _0x162f94[_0xbb73('0x19')](_0x3622bc)[_0xbb73('0x1a')]();};}function respondWithResult(_0x111111,_0x4d0ee4){_0x4d0ee4=_0x4d0ee4||0xc8;return function(_0x56b077){if(_0x56b077){return _0x111111[_0xbb73('0x19')](_0x4d0ee4)[_0xbb73('0x1b')](_0x56b077);}};}function respondWithFilteredResult(_0x109f0b,_0x4c2d2f){return function(_0x4a5e9c){if(_0x4a5e9c){var _0x129906=typeof _0x4c2d2f['offset']===_0xbb73('0x1c')&&typeof _0x4c2d2f[_0xbb73('0x1d')]===_0xbb73('0x1c');var _0x1b43bc=_0x4a5e9c[_0xbb73('0x1e')];var _0x25e5f8=_0x129906?0x0:_0x4c2d2f[_0xbb73('0x1f')];var _0x4c3415=_0x129906?_0x4a5e9c[_0xbb73('0x1e')]:_0x4c2d2f[_0xbb73('0x1f')]+_0x4c2d2f['limit'];var _0x4cb66d;if(_0x4c3415>=_0x1b43bc){_0x4c3415=_0x1b43bc;_0x4cb66d=0xc8;}else{_0x4cb66d=0xce;}_0x109f0b[_0xbb73('0x19')](_0x4cb66d);return _0x109f0b['set'](_0xbb73('0x20'),_0x25e5f8+'-'+_0x4c3415+'/'+_0x1b43bc)[_0xbb73('0x1b')](_0x4a5e9c);}return null;};}function patchUpdates(_0x37569b){return function(_0x40264f){try{jsonpatch['apply'](_0x40264f,_0x37569b,!![]);}catch(_0x271496){return BPromise[_0xbb73('0x21')](_0x271496);}return _0x40264f[_0xbb73('0x22')]();};}function saveUpdates(_0x3b0383,_0x4960af){return function(_0x323a8e){if(_0x323a8e){return _0x323a8e[_0xbb73('0x23')](_0x3b0383)[_0xbb73('0x24')](function(_0x563458){return _0x563458;});}return null;};}function removeEntity(_0x49bf12,_0x39e271){return function(_0x4506f8){if(_0x4506f8){return _0x4506f8['destroy']()[_0xbb73('0x24')](function(){_0x49bf12[_0xbb73('0x19')](0xcc)[_0xbb73('0x1a')]();});}};}function handleEntityNotFound(_0x181deb,_0x5cf49a){return function(_0xe5713a){if(!_0xe5713a){_0x181deb[_0xbb73('0x18')](0x194);}return _0xe5713a;};}function handleError(_0x160cb5,_0x340047){_0x340047=_0x340047||0x1f4;return function(_0x225112){logger[_0xbb73('0x25')](_0x225112[_0xbb73('0x26')]);if(_0x225112[_0xbb73('0x27')]){delete _0x225112[_0xbb73('0x27')];}_0x160cb5[_0xbb73('0x19')](_0x340047)[_0xbb73('0x28')](_0x225112);};}exports['index']=function(_0x3f822d,_0x537563){var _0x346ca4={},_0x4270d3={},_0x540211={'count':0x0,'rows':[]};var _0x549708=_[_0xbb73('0x29')](db['MailTransferReport'][_0xbb73('0x2a')],function(_0x1f0033){return{'name':_0x1f0033[_0xbb73('0x2b')],'type':_0x1f0033[_0xbb73('0x2c')][_0xbb73('0x2d')]};});_0x4270d3['model']=_[_0xbb73('0x29')](_0x549708,_0xbb73('0x27'));_0x4270d3[_0xbb73('0x2e')]=_[_0xbb73('0x2f')](_0x3f822d[_0xbb73('0x2e')]);_0x4270d3[_0xbb73('0x30')]=_[_0xbb73('0x31')](_0x4270d3['model'],_0x4270d3['query']);_0x346ca4['attributes']=_[_0xbb73('0x31')](_0x4270d3[_0xbb73('0x32')],qs['fields'](_0x3f822d[_0xbb73('0x2e')][_0xbb73('0x33')]));_0x346ca4['attributes']=_0x346ca4[_0xbb73('0x34')][_0xbb73('0x35')]?_0x346ca4['attributes']:_0x4270d3[_0xbb73('0x32')];if(!_0x3f822d[_0xbb73('0x2e')]['hasOwnProperty'](_0xbb73('0x36'))){_0x346ca4[_0xbb73('0x1d')]=qs[_0xbb73('0x1d')](_0x3f822d['query']['limit']);_0x346ca4['offset']=qs[_0xbb73('0x1f')](_0x3f822d[_0xbb73('0x2e')][_0xbb73('0x1f')]);}_0x346ca4[_0xbb73('0x37')]=qs['sort'](_0x3f822d['query'][_0xbb73('0x38')]);_0x346ca4[_0xbb73('0x39')]=qs['filters'](_[_0xbb73('0x3a')](_0x3f822d[_0xbb73('0x2e')],_0x4270d3[_0xbb73('0x30')]),_0x549708);if(_0x3f822d['query'][_0xbb73('0x3b')]){_0x346ca4[_0xbb73('0x39')]=_[_0xbb73('0x3c')](_0x346ca4[_0xbb73('0x39')],{'$or':_[_0xbb73('0x29')](_0x549708,function(_0x287dcf){if(_0x287dcf['type']!==_0xbb73('0x3d')){var _0xf29ed0={};_0xf29ed0[_0x287dcf['name']]={'$like':'%'+_0x3f822d[_0xbb73('0x2e')][_0xbb73('0x3b')]+'%'};return _0xf29ed0;}})});}_0x346ca4=_['merge']({},_0x346ca4,_0x3f822d[_0xbb73('0x3e')]);var _0x11a2c2={'where':_0x346ca4[_0xbb73('0x39')]};return db['MailTransferReport']['count'](_0x11a2c2)[_0xbb73('0x24')](function(_0x457572){_0x540211[_0xbb73('0x1e')]=_0x457572;if(_0x3f822d['query'][_0xbb73('0x3f')]){_0x346ca4[_0xbb73('0x40')]=[{'all':!![]}];}return db[_0xbb73('0x41')][_0xbb73('0x42')](_0x346ca4);})[_0xbb73('0x24')](function(_0x49872e){_0x540211[_0xbb73('0x43')]=_0x49872e;return _0x540211;})[_0xbb73('0x24')](respondWithFilteredResult(_0x537563,_0x346ca4))['catch'](handleError(_0x537563,null));};exports[_0xbb73('0x44')]=function(_0x36c92e,_0x872f6c){var _0x419681={'raw':!![],'where':{'id':_0x36c92e['params']['id']}},_0x563208={};_0x563208[_0xbb73('0x32')]=_[_0xbb73('0x2f')](db[_0xbb73('0x41')][_0xbb73('0x2a')]);_0x563208[_0xbb73('0x2e')]=_[_0xbb73('0x2f')](_0x36c92e[_0xbb73('0x2e')]);_0x563208[_0xbb73('0x30')]=_[_0xbb73('0x31')](_0x563208[_0xbb73('0x32')],_0x563208[_0xbb73('0x2e')]);_0x419681[_0xbb73('0x34')]=_[_0xbb73('0x31')](_0x563208['model'],qs[_0xbb73('0x33')](_0x36c92e[_0xbb73('0x2e')][_0xbb73('0x33')]));_0x419681[_0xbb73('0x34')]=_0x419681[_0xbb73('0x34')][_0xbb73('0x35')]?_0x419681[_0xbb73('0x34')]:_0x563208[_0xbb73('0x32')];if(_0x36c92e[_0xbb73('0x2e')]['includeAll']){_0x419681[_0xbb73('0x40')]=[{'all':!![]}];}_0x419681=_[_0xbb73('0x3c')]({},_0x419681,_0x36c92e[_0xbb73('0x3e')]);return db[_0xbb73('0x41')][_0xbb73('0x45')](_0x419681)[_0xbb73('0x24')](handleEntityNotFound(_0x872f6c,null))[_0xbb73('0x24')](respondWithResult(_0x872f6c,null))[_0xbb73('0x46')](handleError(_0x872f6c,null));};exports[_0xbb73('0x47')]=function(_0x58ffb1,_0x2afad7){return db['MailTransferReport'][_0xbb73('0x47')](_0x58ffb1['body'],{})[_0xbb73('0x24')](respondWithResult(_0x2afad7,0xc9))[_0xbb73('0x46')](handleError(_0x2afad7,null));};exports[_0xbb73('0x23')]=function(_0x2b10fc,_0x5f008a){if(_0x2b10fc[_0xbb73('0x48')]['id']){delete _0x2b10fc[_0xbb73('0x48')]['id'];}return db['MailTransferReport'][_0xbb73('0x45')]({'where':{'id':_0x2b10fc[_0xbb73('0x49')]['id']}})[_0xbb73('0x24')](handleEntityNotFound(_0x5f008a,null))['then'](saveUpdates(_0x2b10fc[_0xbb73('0x48')],null))[_0xbb73('0x24')](respondWithResult(_0x5f008a,null))['catch'](handleError(_0x5f008a,null));};exports[_0xbb73('0x4a')]=function(_0x31d9ff,_0x485d9f){return db[_0xbb73('0x41')][_0xbb73('0x45')]({'where':{'id':_0x31d9ff[_0xbb73('0x49')]['id']}})[_0xbb73('0x24')](handleEntityNotFound(_0x485d9f,null))['then'](removeEntity(_0x485d9f,null))[_0xbb73('0x46')](handleError(_0x485d9f,null));};exports[_0xbb73('0x4b')]=function(_0x2f2c76,_0x22fb52){return db[_0xbb73('0x41')][_0xbb73('0x4b')]()[_0xbb73('0x24')](respondWithResult(_0x22fb52,null))[_0xbb73('0x46')](handleError(_0x22fb52,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index f78ca81..1485c9d 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 _0x37c5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','report_mail_transfer','uniqueid','util','../../config/logger'];(function(_0xca8ca6,_0x5ca011){var _0x5b193a=function(_0x4e7407){while(--_0x4e7407){_0xca8ca6['push'](_0xca8ca6['shift']());}};_0x5b193a(++_0x5ca011);}(_0x37c5,0xa7));var _0x537c=function(_0x284b0c,_0x31c32b){_0x284b0c=_0x284b0c-0x0;var _0x25aee4=_0x37c5[_0x284b0c];return _0x25aee4;};'use strict';var _=require('lodash');var util=require(_0x537c('0x0'));var logger=require(_0x537c('0x1'))(_0x537c('0x2'));var moment=require(_0x537c('0x3'));var BPromise=require(_0x537c('0x4'));var rp=require(_0x537c('0x5'));var fs=require('fs');var path=require(_0x537c('0x6'));var rimraf=require(_0x537c('0x7'));var config=require(_0x537c('0x8'));var attributes=require(_0x537c('0x9'));module['exports']=function(_0x42c86a,_0x1156f4){return _0x42c86a[_0x537c('0xa')]('MailTransferReport',attributes,{'tableName':_0x537c('0xb'),'paranoid':![],'indexes':[{'name':_0x537c('0xc'),'fields':[_0x537c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9e=['MailTransferReport','uniqueid','lodash','util','api','moment','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x5f09a9,_0xead85){var _0x53bd09=function(_0x325bb9){while(--_0x325bb9){_0x5f09a9['push'](_0x5f09a9['shift']());}};_0x53bd09(++_0xead85);}(_0x8f9e,0x160));var _0xe8f9=function(_0x3ca717,_0x3e0d02){_0x3ca717=_0x3ca717-0x0;var _0x37c1bf=_0x8f9e[_0x3ca717];return _0x37c1bf;};'use strict';var _=require(_0xe8f9('0x0'));var util=require(_0xe8f9('0x1'));var logger=require('../../config/logger')(_0xe8f9('0x2'));var moment=require(_0xe8f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe8f9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe8f9('0x5'));module[_0xe8f9('0x6')]=function(_0x132a4f,_0xf77bb6){return _0x132a4f[_0xe8f9('0x7')](_0xe8f9('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xe8f9('0x9'),'fields':[_0xe8f9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 38bea31..e05b2c3 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 _0xfd3f=['request','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','MailTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b0b47,_0x299098){var _0x33988c=function(_0x8d220a){while(--_0x8d220a){_0x5b0b47['push'](_0x5b0b47['shift']());}};_0x33988c(++_0x299098);}(_0xfd3f,0xdd));var _0xffd3=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0xfd3f[_0x879e31];return _0x3467e8;};'use strict';var _=require('lodash');var util=require(_0xffd3('0x0'));var moment=require(_0xffd3('0x1'));var BPromise=require(_0xffd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffd3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xffd3('0x4'));var logger=require('../../config/logger')(_0xffd3('0x5'));var config=require(_0xffd3('0x6'));var jayson=require(_0xffd3('0x7'));var client=jayson[_0xffd3('0x8')][_0xffd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb5b4eb,_0x732838,_0x1f796b){return new BPromise(function(_0x223b08,_0x47535c){return client[_0xffd3('0xa')](_0xb5b4eb,_0x1f796b)['then'](function(_0x31825b){logger[_0xffd3('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x732838,_0xffd3('0xc'));logger[_0xffd3('0xd')](_0xffd3('0xe'),_0x732838,_0xffd3('0xc'),JSON['stringify'](_0x31825b));if(_0x31825b[_0xffd3('0xf')]){if(_0x31825b[_0xffd3('0xf')][_0xffd3('0x10')]===0x1f4){logger[_0xffd3('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x732838,_0x31825b[_0xffd3('0xf')][_0xffd3('0x11')]);return _0x47535c(_0x31825b[_0xffd3('0xf')]['message']);}logger[_0xffd3('0xf')](_0xffd3('0x12'),_0x732838,_0x31825b[_0xffd3('0xf')]['message']);return _0x223b08(_0x31825b['error'][_0xffd3('0x11')]);}else{logger[_0xffd3('0xb')](_0xffd3('0x12'),_0x732838,_0xffd3('0xc'));_0x223b08(_0x31825b[_0xffd3('0x13')][_0xffd3('0x11')]);}})[_0xffd3('0x14')](function(_0x42f975){logger[_0xffd3('0xf')](_0xffd3('0x12'),_0x732838,_0x42f975);_0x47535c(_0x42f975);});});} \ No newline at end of file +var _0xa442=['then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2f21c6,_0x51de35){var _0x32cbd5=function(_0x651591){while(--_0x651591){_0x2f21c6['push'](_0x2f21c6['shift']());}};_0x32cbd5(++_0x51de35);}(_0xa442,0x153));var _0x2a44=function(_0x5b92ea,_0x4ed032){_0x5b92ea=_0x5b92ea-0x0;var _0x75d3c6=_0xa442[_0x5b92ea];return _0x75d3c6;};'use strict';var _=require(_0x2a44('0x0'));var util=require(_0x2a44('0x1'));var moment=require(_0x2a44('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a44('0x3'));var fs=require('fs');var Redis=require(_0x2a44('0x4'));var db=require(_0x2a44('0x5'))['db'];var utils=require(_0x2a44('0x6'));var logger=require(_0x2a44('0x7'))(_0x2a44('0x8'));var config=require(_0x2a44('0x9'));var jayson=require(_0x2a44('0xa'));var client=jayson[_0x2a44('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b93ba,_0xd2ca41,_0x29fa34){return new BPromise(function(_0x366895,_0x1d281b){return client[_0x2a44('0xc')](_0x3b93ba,_0x29fa34)[_0x2a44('0xd')](function(_0x395cae){logger['info'](_0x2a44('0xe'),_0xd2ca41,_0x2a44('0xf'));logger[_0x2a44('0x10')](_0x2a44('0x11'),_0xd2ca41,'request\x20sent',JSON[_0x2a44('0x12')](_0x395cae));if(_0x395cae[_0x2a44('0x13')]){if(_0x395cae[_0x2a44('0x13')]['code']===0x1f4){logger['error'](_0x2a44('0xe'),_0xd2ca41,_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);return _0x1d281b(_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);}logger[_0x2a44('0x13')](_0x2a44('0xe'),_0xd2ca41,_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);return _0x366895(_0x395cae[_0x2a44('0x13')][_0x2a44('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0xd2ca41,_0x2a44('0xf'));_0x366895(_0x395cae[_0x2a44('0x15')][_0x2a44('0x14')]);}})['catch'](function(_0x57b828){logger['error'](_0x2a44('0xe'),_0xd2ca41,_0x57b828);_0x1d281b(_0x57b828);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f4bb7f0..99dcc11 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 _0xdde7=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','show','post','create','/:id','update','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2f9651,_0x1c88c4){var _0x3210bc=function(_0x1f0e05){while(--_0x1f0e05){_0x2f9651['push'](_0x2f9651['shift']());}};_0x3210bc(++_0x1c88c4);}(_0xdde7,0x12c));var _0x7dde=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xdde7[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x7dde('0x0'));var util=require(_0x7dde('0x1'));var path=require(_0x7dde('0x2'));var timeout=require(_0x7dde('0x3'));var express=require('express');var router=express[_0x7dde('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7dde('0x5'));var interaction=require(_0x7dde('0x6'));var config=require(_0x7dde('0x7'));var controller=require(_0x7dde('0x8'));router[_0x7dde('0x9')]('/',auth['isAuthenticated'](),controller[_0x7dde('0xa')]);router['get'](_0x7dde('0xb'),auth[_0x7dde('0xc')](),controller['describe']);router[_0x7dde('0x9')]('/:id',auth[_0x7dde('0xc')](),controller[_0x7dde('0xd')]);router[_0x7dde('0xe')]('/',auth['isAuthenticated'](),controller[_0x7dde('0xf')]);router['put'](_0x7dde('0x10'),auth[_0x7dde('0xc')](),controller[_0x7dde('0x11')]);router['delete'](_0x7dde('0x10'),auth[_0x7dde('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa85a=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','exports','multer','path'];(function(_0x99e1be,_0x5d9a25){var _0x1bb602=function(_0x5a72d5){while(--_0x5a72d5){_0x99e1be['push'](_0x99e1be['shift']());}};_0x1bb602(++_0x5d9a25);}(_0xa85a,0x108));var _0xaa85=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa85a[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xaa85('0x0'));var util=require('util');var path=require(_0xaa85('0x1'));var timeout=require(_0xaa85('0x2'));var express=require(_0xaa85('0x3'));var router=express['Router']();var fs_extra=require(_0xaa85('0x4'));var auth=require(_0xaa85('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa85('0x6'));var controller=require(_0xaa85('0x7'));router[_0xaa85('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa85('0x9')]);router[_0xaa85('0x8')](_0xaa85('0xa'),auth[_0xaa85('0xb')](),controller[_0xaa85('0xc')]);router[_0xaa85('0x8')](_0xaa85('0xd'),auth[_0xaa85('0xb')](),controller['show']);router[_0xaa85('0xe')]('/',auth['isAuthenticated'](),controller[_0xaa85('0xf')]);router[_0xaa85('0x10')]('/:id',auth[_0xaa85('0xb')](),controller[_0xaa85('0x11')]);router['delete'](_0xaa85('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa85('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6f7640f..856c52a 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 _0xc974=['talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x3292d7,_0xa8f289){var _0x1b9dd2=function(_0x3e5524){while(--_0x3e5524){_0x3292d7['push'](_0x3292d7['shift']());}};_0x1b9dd2(++_0xa8f289);}(_0xc974,0x133));var _0x4c97=function(_0x21ec43,_0x2639e8){_0x21ec43=_0x21ec43-0x0;var _0x3635d9=_0xc974[_0x21ec43];return _0x3635d9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4c97('0x0'));module[_0x4c97('0x1')]={'channel':{'type':Sequelize[_0x4c97('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4c97('0x2')]},'type':{'type':Sequelize[_0x4c97('0x2')],'defaultValue':_0x4c97('0x3'),'comment':_0x4c97('0x4')},'duration':{'type':Sequelize[_0x4c97('0x5')]},'enterAt':{'type':Sequelize[_0x4c97('0x6')]},'exitAt':{'type':Sequelize[_0x4c97('0x6')],'set':function(_0x5de70c){var _0x180bac=moment(_0x5de70c);var _0x55f2b2=moment(this[_0x4c97('0x7')](_0x4c97('0x8')));var _0x532027=_0x180bac[_0x4c97('0x9')](_0x55f2b2,_0x4c97('0xa'));this[_0x4c97('0xb')](_0x4c97('0xc'),_0x5de70c);this['setDataValue'](_0x4c97('0xd'),_0x532027>=0x0?_0x532027:null);}},'data1':{'type':Sequelize[_0x4c97('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x4c97('0x2')],'comment':_0x4c97('0xe')},'data3':{'type':Sequelize[_0x4c97('0x2')],'comment':_0x4c97('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x4c97('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x4c97('0x11')},'role':{'type':Sequelize[_0x4c97('0x2')]},'internal':{'type':Sequelize[_0x4c97('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa58e=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x4dd33b,_0xf54410){var _0x1217a6=function(_0x39d7cd){while(--_0x39d7cd){_0x4dd33b['push'](_0x4dd33b['shift']());}};_0x1217a6(++_0xf54410);}(_0xa58e,0x1d3));var _0xea58=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa58e[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xea58('0x0'));var moment=require(_0xea58('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xea58('0x2')],'defaultValue':_0xea58('0x3'),'comment':_0xea58('0x4')},'duration':{'type':Sequelize[_0xea58('0x5')]},'enterAt':{'type':Sequelize[_0xea58('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x34d83f){var _0x56968f=moment(_0x34d83f);var _0x10977e=moment(this['getDataValue'](_0xea58('0x7')));var _0x2b3345=_0x56968f[_0xea58('0x8')](_0x10977e,_0xea58('0x9'));this[_0xea58('0xa')](_0xea58('0xb'),_0x34d83f);this[_0xea58('0xa')](_0xea58('0xc'),_0x2b3345>=0x0?_0x2b3345:null);}},'data1':{'type':Sequelize[_0xea58('0x2')],'comment':_0xea58('0xd')},'data2':{'type':Sequelize[_0xea58('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xea58('0x2')],'comment':_0xea58('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xea58('0x2')],'comment':_0xea58('0xf')},'role':{'type':Sequelize[_0xea58('0x2')]},'internal':{'type':Sequelize[_0xea58('0x5')]},'uniqueid':{'type':Sequelize[_0xea58('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4622728..f5ced3c 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xedd9,0xfc));var _0x9edd=function(_0x325072,_0x23d642){_0x325072=_0x325072-0x0;var _0xfded08=_0xedd9[_0x325072];return _0xfded08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0xaf8267,_0x33968b){var _0x20798b=function(_0xaa6732){while(--_0xaa6732){_0xaf8267['push'](_0xaf8267['shift']());}};_0x20798b(++_0x33968b);}(_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['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 0291d4c..e1bb972 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 _0xf2f1=['./memberReport.attributes','exports','define','MemberReport','membername_interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x281d36,_0x4ed458){var _0x396a03=function(_0x439c55){while(--_0x439c55){_0x281d36['push'](_0x281d36['shift']());}};_0x396a03(++_0x4ed458);}(_0xf2f1,0x1e1));var _0x1f2f=function(_0x44aa7b,_0x4bfc07){_0x44aa7b=_0x44aa7b-0x0;var _0x202405=_0xf2f1[_0x44aa7b];return _0x202405;};'use strict';var _=require(_0x1f2f('0x0'));var util=require(_0x1f2f('0x1'));var logger=require(_0x1f2f('0x2'))(_0x1f2f('0x3'));var moment=require(_0x1f2f('0x4'));var BPromise=require(_0x1f2f('0x5'));var rp=require(_0x1f2f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f2f('0x7'));var config=require(_0x1f2f('0x8'));var attributes=require(_0x1f2f('0x9'));module[_0x1f2f('0xa')]=function(_0x427f3f,_0xe0b7fb){return _0x427f3f[_0x1f2f('0xb')](_0x1f2f('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x1f2f('0xd'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d6f=['api','bluebird','path','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x0d6f,0xb1));var _0xf0d6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0d6f[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf0d6('0x0'));var util=require(_0xf0d6('0x1'));var logger=require(_0xf0d6('0x2'))(_0xf0d6('0x3'));var moment=require('moment');var BPromise=require(_0xf0d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xf0d6('0x6')]=function(_0x5ef764,_0x1060d2){return _0x5ef764[_0xf0d6('0x7')]('MemberReport',attributes,{'tableName':_0xf0d6('0x8'),'paranoid':![],'indexes':[{'name':_0xf0d6('0x9'),'fields':[_0xf0d6('0xa'),_0xf0d6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 79b4b44..abdb8d3 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 _0x4e83=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','map','include','model','create','body','raw','CreateMemberReport','UpdateMemberReport','update','limit','lodash','moment'];(function(_0xf8911f,_0x2d0f60){var _0x379f2c=function(_0x11ef3a){while(--_0x11ef3a){_0xf8911f['push'](_0xf8911f['shift']());}};_0x379f2c(++_0x2d0f60);}(_0x4e83,0x1ae));var _0x34e8=function(_0x10b967,_0xb32c4d){_0x10b967=_0x10b967-0x0;var _0x264da2=_0x4e83[_0x10b967];return _0x264da2;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a3c4,_0x4567bd,_0x28677c){return new BPromise(function(_0x5b5ddc,_0x44d3bf){return client[_0x34e8('0x8')](_0x30a3c4,_0x28677c)[_0x34e8('0x9')](function(_0x5cb792){logger[_0x34e8('0xa')](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));logger[_0x34e8('0xd')](_0x34e8('0xe'),_0x4567bd,_0x34e8('0xc'),JSON[_0x34e8('0xf')](_0x5cb792));if(_0x5cb792[_0x34e8('0x10')]){if(_0x5cb792[_0x34e8('0x10')]['code']===0x1f4){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792['error'][_0x34e8('0x11')]);return _0x44d3bf(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);return _0x5b5ddc(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}else{logger['info'](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));_0x5b5ddc(_0x5cb792[_0x34e8('0x12')][_0x34e8('0x11')]);}})[_0x34e8('0x13')](function(_0x4a4d17){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x4a4d17);_0x44d3bf(_0x4a4d17);});});}exports[_0x34e8('0x14')]=function(_0x708dd4){var _0x381484=this;return new Promise(function(_0x11543c,_0x1f3d4d){return db[_0x34e8('0x15')][_0x34e8('0x16')]({'raw':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')][_0x34e8('0x18')]||null:null,'attributes':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')][_0x34e8('0x19')]||null:null,'limit':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')]['limit']||null:null,'include':_0x708dd4[_0x34e8('0x17')]?_0x708dd4[_0x34e8('0x17')]['include']?_[_0x34e8('0x1a')](_0x708dd4['options'][_0x34e8('0x1b')],function(_0x381d0e){return{'model':db[_0x381d0e[_0x34e8('0x1c')]],'as':_0x381d0e['as'],'attributes':_0x381d0e['attributes'],'include':_0x381d0e['include']?_[_0x34e8('0x1a')](_0x381d0e[_0x34e8('0x1b')],function(_0xb8c9f){return{'model':db[_0xb8c9f[_0x34e8('0x1c')]],'as':_0xb8c9f['as'],'attributes':_0xb8c9f[_0x34e8('0x19')],'include':_0xb8c9f[_0x34e8('0x1b')]?_[_0x34e8('0x1a')](_0xb8c9f['include'],function(_0x29be75){return{'model':db[_0x29be75[_0x34e8('0x1c')]],'as':_0x29be75['as'],'attributes':_0x29be75[_0x34e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34e8('0x9')](function(_0xe77c9e){logger[_0x34e8('0xa')](_0x34e8('0x14'),_0x708dd4);logger[_0x34e8('0xd')](_0x34e8('0x14'),_0x708dd4,JSON[_0x34e8('0xf')](_0xe77c9e));_0x11543c(_0xe77c9e);})[_0x34e8('0x13')](function(_0x6f4428){logger[_0x34e8('0x10')](_0x34e8('0x14'),_0x6f4428[_0x34e8('0x11')],_0x708dd4);_0x1f3d4d(_0x381484[_0x34e8('0x10')](0x1f4,_0x6f4428[_0x34e8('0x11')]));});});};exports['CreateMemberReport']=function(_0x3e7e42){var _0x1a3146=this;return new Promise(function(_0x5b951f,_0x461c32){return db[_0x34e8('0x15')][_0x34e8('0x1d')](_0x3e7e42[_0x34e8('0x1e')],{'raw':_0x3e7e42[_0x34e8('0x17')]?_0x3e7e42[_0x34e8('0x17')][_0x34e8('0x1f')]===undefined?!![]:![]:!![]})[_0x34e8('0x9')](function(_0x5e2fef){logger[_0x34e8('0xa')](_0x34e8('0x20'),_0x3e7e42);logger[_0x34e8('0xd')](_0x34e8('0x20'),_0x3e7e42,JSON[_0x34e8('0xf')](_0x5e2fef));_0x5b951f(_0x5e2fef);})[_0x34e8('0x13')](function(_0x5594d0){logger[_0x34e8('0x10')]('CreateMemberReport',_0x5594d0[_0x34e8('0x11')],_0x3e7e42);_0x461c32(_0x1a3146[_0x34e8('0x10')](0x1f4,_0x5594d0['message']));});});};exports[_0x34e8('0x21')]=function(_0x38a525){var _0x1fb985=this;return new Promise(function(_0xde0d37,_0x13ca19){return db[_0x34e8('0x15')][_0x34e8('0x22')](_0x38a525['body'],{'raw':_0x38a525['options']?_0x38a525[_0x34e8('0x17')][_0x34e8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38a525[_0x34e8('0x17')]?_0x38a525['options'][_0x34e8('0x18')]||null:null,'attributes':_0x38a525[_0x34e8('0x17')]?_0x38a525[_0x34e8('0x17')][_0x34e8('0x19')]||null:null,'limit':_0x38a525[_0x34e8('0x17')]?_0x38a525[_0x34e8('0x17')][_0x34e8('0x23')]||null:null})[_0x34e8('0x9')](function(_0x50a32c){logger[_0x34e8('0xa')](_0x34e8('0x21'),_0x38a525);logger[_0x34e8('0xd')]('UpdateMemberReport',_0x38a525,JSON[_0x34e8('0xf')](_0x50a32c));_0xde0d37(_0x50a32c);})[_0x34e8('0x13')](function(_0x5349e2){logger['error'](_0x34e8('0x21'),_0x5349e2[_0x34e8('0x11')],_0x38a525);_0x13ca19(_0x1fb985['error'](0x1f4,_0x5349e2[_0x34e8('0x11')]));});});}; \ No newline at end of file +var _0x29af=['code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','where','limit','include','map','model','attributes','CreateMemberReport','create','body','UpdateMemberReport','update','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4f8bc4,_0x4bf1c3){var _0x4bc429=function(_0x24b69c){while(--_0x24b69c){_0x4f8bc4['push'](_0x4f8bc4['shift']());}};_0x4bc429(++_0x4bf1c3);}(_0x29af,0x134));var _0xf29a=function(_0x51e2a0,_0x458be2){_0x51e2a0=_0x51e2a0-0x0;var _0x9297e7=_0x29af[_0x51e2a0];return _0x9297e7;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var Redis=require(_0xf29a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29a('0x5'));var logger=require('../../config/logger')(_0xf29a('0x6'));var config=require(_0xf29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c111b,_0x47749d,_0x33a308){return new BPromise(function(_0x347d76,_0x4393dc){return client['request'](_0x2c111b,_0x33a308)[_0xf29a('0x9')](function(_0x145dbb){logger[_0xf29a('0xa')]('MemberReport,\x20%s,\x20%s',_0x47749d,'request\x20sent');logger[_0xf29a('0xb')](_0xf29a('0xc'),_0x47749d,_0xf29a('0xd'),JSON[_0xf29a('0xe')](_0x145dbb));if(_0x145dbb[_0xf29a('0xf')]){if(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x10')]===0x1f4){logger['error'](_0xf29a('0x11'),_0x47749d,_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);return _0x4393dc(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);}logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x145dbb['error']['message']);return _0x347d76(_0x145dbb['error'][_0xf29a('0x12')]);}else{logger[_0xf29a('0xa')](_0xf29a('0x11'),_0x47749d,_0xf29a('0xd'));_0x347d76(_0x145dbb[_0xf29a('0x13')]['message']);}})[_0xf29a('0x14')](function(_0x42567e){logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x42567e);_0x4393dc(_0x42567e);});});}exports[_0xf29a('0x15')]=function(_0xd4ca39){var _0x19e886=this;return new Promise(function(_0x296829,_0x3f9da8){return db[_0xf29a('0x16')]['findAll']({'raw':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x18')]||null:null,'attributes':_0xd4ca39['options']?_0xd4ca39[_0xf29a('0x17')]['attributes']||null:null,'limit':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x19')]||null:null,'include':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39['options'][_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1a')],function(_0x35af39){return{'model':db[_0x35af39[_0xf29a('0x1c')]],'as':_0x35af39['as'],'attributes':_0x35af39[_0xf29a('0x1d')],'include':_0x35af39['include']?_['map'](_0x35af39['include'],function(_0x262a5f){return{'model':db[_0x262a5f['model']],'as':_0x262a5f['as'],'attributes':_0x262a5f[_0xf29a('0x1d')],'include':_0x262a5f[_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0x262a5f['include'],function(_0x181c3a){return{'model':db[_0x181c3a[_0xf29a('0x1c')]],'as':_0x181c3a['as'],'attributes':_0x181c3a[_0xf29a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf29a('0x9')](function(_0x11d1a6){logger[_0xf29a('0xa')]('GetMemberReport',_0xd4ca39);logger[_0xf29a('0xb')](_0xf29a('0x15'),_0xd4ca39,JSON['stringify'](_0x11d1a6));_0x296829(_0x11d1a6);})['catch'](function(_0x4fdd1b){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x4fdd1b[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x4fdd1b[_0xf29a('0x12')]));});});};exports[_0xf29a('0x1e')]=function(_0x694c05){var _0x50b221=this;return new Promise(function(_0x2b10d1,_0x3e31c3){return db[_0xf29a('0x16')][_0xf29a('0x1f')](_0x694c05[_0xf29a('0x20')],{'raw':_0x694c05[_0xf29a('0x17')]?_0x694c05[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf29a('0x9')](function(_0x566b1d){logger[_0xf29a('0xa')](_0xf29a('0x1e'),_0x694c05);logger[_0xf29a('0xb')](_0xf29a('0x1e'),_0x694c05,JSON[_0xf29a('0xe')](_0x566b1d));_0x2b10d1(_0x566b1d);})['catch'](function(_0x12110d){logger['error'](_0xf29a('0x1e'),_0x12110d[_0xf29a('0x12')],_0x694c05);_0x3e31c3(_0x50b221['error'](0x1f4,_0x12110d[_0xf29a('0x12')]));});});};exports[_0xf29a('0x21')]=function(_0x5b1834){var _0x13b011=this;return new Promise(function(_0x399698,_0x422cd8){return db[_0xf29a('0x16')][_0xf29a('0x22')](_0x5b1834[_0xf29a('0x20')],{'raw':_0x5b1834['options']?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b1834[_0xf29a('0x17')]?_0x5b1834['options'][_0xf29a('0x18')]||null:null,'attributes':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x1d')]||null:null,'limit':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x19')]||null:null})[_0xf29a('0x9')](function(_0x1fde1e){logger[_0xf29a('0xa')](_0xf29a('0x21'),_0x5b1834);logger[_0xf29a('0xb')]('UpdateMemberReport',_0x5b1834,JSON['stringify'](_0x1fde1e));_0x399698(_0x1fde1e);})[_0xf29a('0x14')](function(_0x1650a7){logger[_0xf29a('0xf')]('UpdateMemberReport',_0x1650a7[_0xf29a('0x12')],_0x5b1834);_0x422cd8(_0x13b011[_0xf29a('0xf')](0x1f4,_0x1650a7[_0xf29a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 6605678..d68c10a 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 _0x04f1=['util','path','Router','fs-extra','../../components/auth/service','exports','multer'];(function(_0x5a37bb,_0x2c91a4){var _0x36f6b2=function(_0x2e652e){while(--_0x2e652e){_0x5a37bb['push'](_0x5a37bb['shift']());}};_0x36f6b2(++_0x2c91a4);}(_0x04f1,0x92));var _0x104f=function(_0x394f8b,_0x1c2873){_0x394f8b=_0x394f8b-0x0;var _0x37cd82=_0x04f1[_0x394f8b];return _0x37cd82;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0x104f('0x6')]=router; \ No newline at end of file +var _0x993f=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x457b64,_0x49a219){var _0x437111=function(_0x3dad3d){while(--_0x3dad3d){_0x457b64['push'](_0x457b64['shift']());}};_0x437111(++_0x49a219);}(_0x993f,0x129));var _0xf993=function(_0x3b7e8e,_0x3d9831){_0x3b7e8e=_0x3b7e8e-0x0;var _0x177b0e=_0x993f[_0x3b7e8e];return _0x177b0e;};'use strict';var multer=require(_0xf993('0x0'));var util=require(_0xf993('0x1'));var path=require(_0xf993('0x2'));var timeout=require(_0xf993('0x3'));var express=require('express');var router=express[_0xf993('0x4')]();var fs_extra=require(_0xf993('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf993('0x6'));var config=require(_0xf993('0x7'));var controller=require(_0xf993('0x8'));router[_0xf993('0x9')]('/',controller[_0xf993('0xa')]);module[_0xf993('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 598393b..dec4b44 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 _0x52e0=['sequelize'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x52e0,0x1dc));var _0x052e=function(_0x57b913,_0x48b176){_0x57b913=_0x57b913-0x0;var _0x466aaa=_0x52e0[_0x57b913];return _0x466aaa;};'use strict';var Sequelize=require(_0x052e('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xb0f8=['exports','version','sequelize'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0xb0f8,0xe3));var _0x8b0f=function(_0x482424,_0x43cf36){_0x482424=_0x482424-0x0;var _0x3285=_0xb0f8[_0x482424];return _0x3285;};'use strict';var Sequelize=require(_0x8b0f('0x0'));module[_0x8b0f('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x8b0f('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8aec03c..8400a31 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 _0xd0d1=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','end','error','name','send','index','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','then','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x25b0ed,_0x2aea92){var _0x41e9a9=function(_0x585184){while(--_0x585184){_0x25b0ed['push'](_0x25b0ed['shift']());}};_0x41e9a9(++_0x2aea92);}(_0xd0d1,0x79));var _0x1d0d=function(_0x19c7a9,_0x419029){_0x19c7a9=_0x19c7a9-0x0;var _0x20ce62=_0xd0d1[_0x19c7a9];return _0x20ce62;};'use strict';var emlformat=require(_0x1d0d('0x0'));var rimraf=require(_0x1d0d('0x1'));var zipdir=require(_0x1d0d('0x2'));var jsonpatch=require(_0x1d0d('0x3'));var rp=require('request-promise');var moment=require(_0x1d0d('0x4'));var BPromise=require(_0x1d0d('0x5'));var Mustache=require(_0x1d0d('0x6'));var util=require(_0x1d0d('0x7'));var path=require(_0x1d0d('0x8'));var sox=require('sox');var csv=require(_0x1d0d('0x9'));var ejs=require(_0x1d0d('0xa'));var fs=require('fs');var fs_extra=require(_0x1d0d('0xb'));var _=require(_0x1d0d('0xc'));var squel=require('squel');var crypto=require(_0x1d0d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d0d('0xe'));var toCsv=require(_0x1d0d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1d0d('0xf'));var qs=require(_0x1d0d('0x10'));var as=require(_0x1d0d('0x11'));var hardwareService=require(_0x1d0d('0x12'));var logger=require(_0x1d0d('0x13'))(_0x1d0d('0x14'));var utils=require(_0x1d0d('0x15'));var config=require(_0x1d0d('0x16'));var licenseUtil=require(_0x1d0d('0x17'));var db=require(_0x1d0d('0x18'))['db'];function respondWithStatusCode(_0x71b44a,_0x27e176){_0x27e176=_0x27e176||0xcc;return function(_0x34a533){if(_0x34a533){return _0x71b44a[_0x1d0d('0x19')](_0x27e176);}return _0x71b44a['status'](_0x27e176)['end']();};}function respondWithResult(_0x1f83fd,_0xe90b02){_0xe90b02=_0xe90b02||0xc8;return function(_0x53a1dc){if(_0x53a1dc){return _0x1f83fd[_0x1d0d('0x1a')](_0xe90b02)[_0x1d0d('0x1b')](_0x53a1dc);}};}function respondWithFilteredResult(_0x2af5df,_0xb49efd){return function(_0x1fb0d9){if(_0x1fb0d9){var _0x53cb10=typeof _0xb49efd[_0x1d0d('0x1c')]===_0x1d0d('0x1d')&&typeof _0xb49efd[_0x1d0d('0x1e')]===_0x1d0d('0x1d');var _0x71dadc=_0x1fb0d9[_0x1d0d('0x1f')];var _0x50852b=_0x53cb10?0x0:_0xb49efd[_0x1d0d('0x1c')];var _0x57c415=_0x53cb10?_0x1fb0d9['count']:_0xb49efd[_0x1d0d('0x1c')]+_0xb49efd[_0x1d0d('0x1e')];var _0x236000;if(_0x57c415>=_0x71dadc){_0x57c415=_0x71dadc;_0x236000=0xc8;}else{_0x236000=0xce;}_0x2af5df['status'](_0x236000);return _0x2af5df[_0x1d0d('0x20')](_0x1d0d('0x21'),_0x50852b+'-'+_0x57c415+'/'+_0x71dadc)[_0x1d0d('0x1b')](_0x1fb0d9);}return null;};}function patchUpdates(_0x3def8b){return function(_0x5d9432){try{jsonpatch['apply'](_0x5d9432,_0x3def8b,!![]);}catch(_0x252f87){return BPromise[_0x1d0d('0x22')](_0x252f87);}return _0x5d9432['save']();};}function saveUpdates(_0x54be4a,_0x295f84){return function(_0x5fa88f){if(_0x5fa88f){return _0x5fa88f['update'](_0x54be4a)['then'](function(_0x4556a1){return _0x4556a1;});}return null;};}function removeEntity(_0x37883a,_0xae4882){return function(_0x17da3f){if(_0x17da3f){return _0x17da3f[_0x1d0d('0x23')]()['then'](function(){_0x37883a[_0x1d0d('0x1a')](0xcc)[_0x1d0d('0x24')]();});}};}function handleEntityNotFound(_0x4ca187,_0x322330){return function(_0xaae6f3){if(!_0xaae6f3){_0x4ca187['sendStatus'](0x194);}return _0xaae6f3;};}function handleError(_0x5a1a1f,_0x49471d){_0x49471d=_0x49471d||0x1f4;return function(_0x476ab4){logger[_0x1d0d('0x25')](_0x476ab4['stack']);if(_0x476ab4[_0x1d0d('0x26')]){delete _0x476ab4[_0x1d0d('0x26')];}_0x5a1a1f[_0x1d0d('0x1a')](_0x49471d)[_0x1d0d('0x27')](_0x476ab4);};}exports[_0x1d0d('0x28')]=function(_0xd5d758,_0x270247){var _0x47a471={},_0x5af4f7={},_0x5a5cfb={'count':0x0,'rows':[]};var _0x1ac436=_['map'](db[_0x1d0d('0x29')][_0x1d0d('0x2a')],function(_0x252981){return{'name':_0x252981[_0x1d0d('0x2b')],'type':_0x252981[_0x1d0d('0x2c')][_0x1d0d('0x2d')]};});_0x5af4f7[_0x1d0d('0x2e')]=_['map'](_0x1ac436,_0x1d0d('0x26'));_0x5af4f7[_0x1d0d('0x2f')]=_[_0x1d0d('0x30')](_0xd5d758[_0x1d0d('0x2f')]);_0x5af4f7[_0x1d0d('0x31')]=_[_0x1d0d('0x32')](_0x5af4f7[_0x1d0d('0x2e')],_0x5af4f7[_0x1d0d('0x2f')]);_0x47a471[_0x1d0d('0x33')]=_[_0x1d0d('0x32')](_0x5af4f7[_0x1d0d('0x2e')],qs['fields'](_0xd5d758[_0x1d0d('0x2f')][_0x1d0d('0x34')]));_0x47a471[_0x1d0d('0x33')]=_0x47a471[_0x1d0d('0x33')][_0x1d0d('0x35')]?_0x47a471[_0x1d0d('0x33')]:_0x5af4f7[_0x1d0d('0x2e')];if(!_0xd5d758[_0x1d0d('0x2f')][_0x1d0d('0x36')](_0x1d0d('0x37'))){_0x47a471['limit']=qs['limit'](_0xd5d758['query'][_0x1d0d('0x1e')]);_0x47a471['offset']=qs[_0x1d0d('0x1c')](_0xd5d758[_0x1d0d('0x2f')][_0x1d0d('0x1c')]);}_0x47a471[_0x1d0d('0x38')]=qs['sort'](_0xd5d758['query'][_0x1d0d('0x39')]);_0x47a471['where']=qs[_0x1d0d('0x31')](_['pick'](_0xd5d758['query'],_0x5af4f7[_0x1d0d('0x31')]),_0x1ac436);if(_0xd5d758[_0x1d0d('0x2f')][_0x1d0d('0x3a')]){_0x47a471[_0x1d0d('0x3b')]=_[_0x1d0d('0x3c')](_0x47a471['where'],{'$or':_[_0x1d0d('0x3d')](_0x1ac436,function(_0x51d9e8){if(_0x51d9e8['type']!==_0x1d0d('0x3e')){var _0x4db086={};_0x4db086[_0x51d9e8['name']]={'$like':'%'+_0xd5d758[_0x1d0d('0x2f')][_0x1d0d('0x3a')]+'%'};return _0x4db086;}})});}_0x47a471=_['merge']({},_0x47a471,_0xd5d758['options']);var _0x34dbcd={'where':_0x47a471[_0x1d0d('0x3b')]};return db[_0x1d0d('0x29')][_0x1d0d('0x1f')](_0x34dbcd)[_0x1d0d('0x3f')](function(_0x18d1d5){_0x5a5cfb[_0x1d0d('0x1f')]=_0x18d1d5;if(_0xd5d758['query'][_0x1d0d('0x40')]){_0x47a471[_0x1d0d('0x41')]=[{'all':!![]}];}return db[_0x1d0d('0x29')][_0x1d0d('0x42')](_0x47a471);})[_0x1d0d('0x3f')](function(_0x26cec9){_0x5a5cfb[_0x1d0d('0x43')]=_0x26cec9;return _0x5a5cfb;})['then'](respondWithFilteredResult(_0x270247,_0x47a471))['catch'](handleError(_0x270247,null));}; \ No newline at end of file +var _0x7fcc=['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','limit','count','set','Content-Range','reject','save','then','end','error','stack','name','index','map','Migration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x7fcc,0xc0));var _0xc7fc=function(_0x18212f,_0x255f6f){_0x18212f=_0x18212f-0x0;var _0x467fef=_0x7fcc[_0x18212f];return _0x467fef;};'use strict';var emlformat=require(_0xc7fc('0x0'));var rimraf=require(_0xc7fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc7fc('0x2'));var moment=require('moment');var BPromise=require(_0xc7fc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc7fc('0x4'));var sox=require(_0xc7fc('0x5'));var csv=require(_0xc7fc('0x6'));var ejs=require(_0xc7fc('0x7'));var fs=require('fs');var fs_extra=require(_0xc7fc('0x8'));var _=require(_0xc7fc('0x9'));var squel=require(_0xc7fc('0xa'));var crypto=require(_0xc7fc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc7fc('0xc'));var toCsv=require(_0xc7fc('0x6'));var querystring=require(_0xc7fc('0xd'));var Papa=require(_0xc7fc('0xe'));var Redis=require(_0xc7fc('0xf'));var authService=require(_0xc7fc('0x10'));var qs=require(_0xc7fc('0x11'));var as=require(_0xc7fc('0x12'));var hardwareService=require(_0xc7fc('0x13'));var logger=require(_0xc7fc('0x14'))(_0xc7fc('0x15'));var utils=require(_0xc7fc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc7fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551b12,_0x46ad11){_0x46ad11=_0x46ad11||0xcc;return function(_0x26fd2d){if(_0x26fd2d){return _0x551b12[_0xc7fc('0x18')](_0x46ad11);}return _0x551b12[_0xc7fc('0x19')](_0x46ad11)['end']();};}function respondWithResult(_0x1e0afa,_0x30276b){_0x30276b=_0x30276b||0xc8;return function(_0x21ef96){if(_0x21ef96){return _0x1e0afa['status'](_0x30276b)[_0xc7fc('0x1a')](_0x21ef96);}};}function respondWithFilteredResult(_0x3cd775,_0x51d20e){return function(_0x20dfb9){if(_0x20dfb9){var _0x3de6e6=typeof _0x51d20e[_0xc7fc('0x1b')]===_0xc7fc('0x1c')&&typeof _0x51d20e[_0xc7fc('0x1d')]==='undefined';var _0x3f5d03=_0x20dfb9[_0xc7fc('0x1e')];var _0x5d6543=_0x3de6e6?0x0:_0x51d20e[_0xc7fc('0x1b')];var _0x1daaf6=_0x3de6e6?_0x20dfb9[_0xc7fc('0x1e')]:_0x51d20e[_0xc7fc('0x1b')]+_0x51d20e[_0xc7fc('0x1d')];var _0x3e36b2;if(_0x1daaf6>=_0x3f5d03){_0x1daaf6=_0x3f5d03;_0x3e36b2=0xc8;}else{_0x3e36b2=0xce;}_0x3cd775[_0xc7fc('0x19')](_0x3e36b2);return _0x3cd775[_0xc7fc('0x1f')](_0xc7fc('0x20'),_0x5d6543+'-'+_0x1daaf6+'/'+_0x3f5d03)[_0xc7fc('0x1a')](_0x20dfb9);}return null;};}function patchUpdates(_0x295d49){return function(_0x533679){try{jsonpatch['apply'](_0x533679,_0x295d49,!![]);}catch(_0x50b3c1){return BPromise[_0xc7fc('0x21')](_0x50b3c1);}return _0x533679[_0xc7fc('0x22')]();};}function saveUpdates(_0x1d42e1,_0x51a0e2){return function(_0x45f67f){if(_0x45f67f){return _0x45f67f['update'](_0x1d42e1)[_0xc7fc('0x23')](function(_0x577d6a){return _0x577d6a;});}return null;};}function removeEntity(_0x5b6230,_0x5ae066){return function(_0x1e18fe){if(_0x1e18fe){return _0x1e18fe['destroy']()[_0xc7fc('0x23')](function(){_0x5b6230[_0xc7fc('0x19')](0xcc)[_0xc7fc('0x24')]();});}};}function handleEntityNotFound(_0xdaeb2b,_0x29b8e6){return function(_0x1c6c74){if(!_0x1c6c74){_0xdaeb2b[_0xc7fc('0x18')](0x194);}return _0x1c6c74;};}function handleError(_0xca7022,_0x4c0b53){_0x4c0b53=_0x4c0b53||0x1f4;return function(_0x26c6b8){logger[_0xc7fc('0x25')](_0x26c6b8[_0xc7fc('0x26')]);if(_0x26c6b8[_0xc7fc('0x27')]){delete _0x26c6b8[_0xc7fc('0x27')];}_0xca7022[_0xc7fc('0x19')](_0x4c0b53)['send'](_0x26c6b8);};}exports[_0xc7fc('0x28')]=function(_0x189666,_0x11b0d9){var _0xab1024={},_0x1cb741={},_0xc1e23f={'count':0x0,'rows':[]};var _0x3092d0=_[_0xc7fc('0x29')](db[_0xc7fc('0x2a')][_0xc7fc('0x2b')],function(_0xac55a0){return{'name':_0xac55a0['fieldName'],'type':_0xac55a0['type'][_0xc7fc('0x2c')]};});_0x1cb741['model']=_[_0xc7fc('0x29')](_0x3092d0,_0xc7fc('0x27'));_0x1cb741[_0xc7fc('0x2d')]=_[_0xc7fc('0x2e')](_0x189666['query']);_0x1cb741[_0xc7fc('0x2f')]=_[_0xc7fc('0x30')](_0x1cb741[_0xc7fc('0x31')],_0x1cb741['query']);_0xab1024[_0xc7fc('0x32')]=_['intersection'](_0x1cb741['model'],qs[_0xc7fc('0x33')](_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x33')]));_0xab1024[_0xc7fc('0x32')]=_0xab1024[_0xc7fc('0x32')][_0xc7fc('0x34')]?_0xab1024['attributes']:_0x1cb741['model'];if(!_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x35')](_0xc7fc('0x36'))){_0xab1024['limit']=qs[_0xc7fc('0x1d')](_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x1d')]);_0xab1024['offset']=qs[_0xc7fc('0x1b')](_0x189666['query'][_0xc7fc('0x1b')]);}_0xab1024[_0xc7fc('0x37')]=qs[_0xc7fc('0x38')](_0x189666[_0xc7fc('0x2d')][_0xc7fc('0x38')]);_0xab1024[_0xc7fc('0x39')]=qs[_0xc7fc('0x2f')](_[_0xc7fc('0x3a')](_0x189666[_0xc7fc('0x2d')],_0x1cb741[_0xc7fc('0x2f')]),_0x3092d0);if(_0x189666['query']['filter']){_0xab1024['where']=_['merge'](_0xab1024[_0xc7fc('0x39')],{'$or':_['map'](_0x3092d0,function(_0x4ed879){if(_0x4ed879['type']!==_0xc7fc('0x3b')){var _0x5340bc={};_0x5340bc[_0x4ed879[_0xc7fc('0x27')]]={'$like':'%'+_0x189666['query'][_0xc7fc('0x3c')]+'%'};return _0x5340bc;}})});}_0xab1024=_[_0xc7fc('0x3d')]({},_0xab1024,_0x189666[_0xc7fc('0x3e')]);var _0x5d9fcc={'where':_0xab1024[_0xc7fc('0x39')]};return db[_0xc7fc('0x2a')]['count'](_0x5d9fcc)[_0xc7fc('0x23')](function(_0x2e028c){_0xc1e23f[_0xc7fc('0x1e')]=_0x2e028c;if(_0x189666['query'][_0xc7fc('0x3f')]){_0xab1024[_0xc7fc('0x40')]=[{'all':!![]}];}return db['Migration'][_0xc7fc('0x41')](_0xab1024);})[_0xc7fc('0x23')](function(_0x386d93){_0xc1e23f[_0xc7fc('0x42')]=_0x386d93;return _0xc1e23f;})[_0xc7fc('0x23')](respondWithFilteredResult(_0x11b0d9,_0xab1024))[_0xc7fc('0x43')](handleError(_0x11b0d9,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f494a74..d95e774 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 _0x8aa9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations'];(function(_0x708cfa,_0x413d56){var _0x2418ca=function(_0x215ea2){while(--_0x215ea2){_0x708cfa['push'](_0x708cfa['shift']());}};_0x2418ca(++_0x413d56);}(_0x8aa9,0x15e));var _0x98aa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8aa9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x98aa('0x0'));var util=require(_0x98aa('0x1'));var logger=require(_0x98aa('0x2'))(_0x98aa('0x3'));var moment=require(_0x98aa('0x4'));var BPromise=require(_0x98aa('0x5'));var rp=require(_0x98aa('0x6'));var fs=require('fs');var path=require(_0x98aa('0x7'));var rimraf=require(_0x98aa('0x8'));var config=require(_0x98aa('0x9'));var attributes=require(_0x98aa('0xa'));module[_0x98aa('0xb')]=function(_0x2ba040,_0x16a27c){return _0x2ba040['define'](_0x98aa('0xc'),attributes,{'tableName':_0x98aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4621=['bluebird','path','rimraf','exports','define','Migration','migrations','lodash','../../config/logger','api','moment'];(function(_0x3dcaca,_0x4d8c05){var _0x321c44=function(_0x5f41ee){while(--_0x5f41ee){_0x3dcaca['push'](_0x3dcaca['shift']());}};_0x321c44(++_0x4d8c05);}(_0x4621,0x19e));var _0x1462=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4621[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x1462('0x0'));var util=require('util');var logger=require(_0x1462('0x1'))(_0x1462('0x2'));var moment=require(_0x1462('0x3'));var BPromise=require(_0x1462('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1462('0x5'));var rimraf=require(_0x1462('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x1462('0x7')]=function(_0x2b070c,_0xea7ef3){return _0x2b070c[_0x1462('0x8')](_0x1462('0x9'),attributes,{'tableName':_0x1462('0xa'),'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 b33b8c1..9f73ab2 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 _0xefe3=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring'];(function(_0x528db,_0x31f893){var _0x5365aa=function(_0x485e5a){while(--_0x485e5a){_0x528db['push'](_0x528db['shift']());}};_0x5365aa(++_0x31f893);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3efe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3efe('0x1'));var fs=require('fs');var Redis=require(_0x3efe('0x2'));var db=require(_0x3efe('0x3'))['db'];var utils=require(_0x3efe('0x4'));var logger=require('../../config/logger')(_0x3efe('0x5'));var config=require('../../config/environment');var jayson=require(_0x3efe('0x6'));var client=jayson['client'][_0x3efe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60487e,_0x1f697b,_0x195d5d){return new BPromise(function(_0x30d2e8,_0x474c9a){return client['request'](_0x60487e,_0x195d5d)[_0x3efe('0x8')](function(_0x54fec1){logger[_0x3efe('0x9')](_0x3efe('0xa'),_0x1f697b,_0x3efe('0xb'));logger[_0x3efe('0xc')](_0x3efe('0xd'),_0x1f697b,_0x3efe('0xb'),JSON['stringify'](_0x54fec1));if(_0x54fec1['error']){if(_0x54fec1[_0x3efe('0xe')][_0x3efe('0xf')]===0x1f4){logger[_0x3efe('0xe')](_0x3efe('0xa'),_0x1f697b,_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);return _0x474c9a(_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);}logger[_0x3efe('0xe')](_0x3efe('0xa'),_0x1f697b,_0x54fec1[_0x3efe('0xe')]['message']);return _0x30d2e8(_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);}else{logger[_0x3efe('0x9')](_0x3efe('0xa'),_0x1f697b,'request\x20sent');_0x30d2e8(_0x54fec1[_0x3efe('0x11')][_0x3efe('0x10')]);}})[_0x3efe('0x12')](function(_0x515e1b){logger['error'](_0x3efe('0xa'),_0x1f697b,_0x515e1b);_0x474c9a(_0x515e1b);});});} \ No newline at end of file +var _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x89cd77,_0x5bb9f8){var _0x480e51=function(_0x3d9bed){while(--_0x3d9bed){_0x89cd77['push'](_0x89cd77['shift']());}};_0x480e51(++_0x5bb9f8);}(_0x96cc,0x16c));var _0xc96c=function(_0xe5c531,_0x192403){_0xe5c531=_0xe5c531-0x0;var _0x16c383=_0x96cc[_0xe5c531];return _0x16c383;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('Migration,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('Migration,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fa23e97..280a787 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 _0xc42c=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports','util','path'];(function(_0x69b8c3,_0x4f6c1b){var _0x15b301=function(_0x1073d4){while(--_0x1073d4){_0x69b8c3['push'](_0x69b8c3['shift']());}};_0x15b301(++_0x4f6c1b);}(_0xc42c,0x13e));var _0xcc42=function(_0x4ea21b,_0x589da2){_0x4ea21b=_0x4ea21b-0x0;var _0x5a6d93=_0xc42c[_0x4ea21b];return _0x5a6d93;};'use strict';var multer=require('multer');var util=require(_0xcc42('0x0'));var path=require(_0xcc42('0x1'));var timeout=require(_0xcc42('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcc42('0x3'));var interaction=require(_0xcc42('0x4'));var config=require(_0xcc42('0x5'));var controller=require(_0xcc42('0x6'));router[_0xcc42('0x7')]('/',auth[_0xcc42('0x8')](),controller[_0xcc42('0x9')]);router[_0xcc42('0x7')](_0xcc42('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcc42('0xb')]('/',auth[_0xcc42('0x8')](),controller['create']);router[_0xcc42('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xcc42('0xd')]);router[_0xcc42('0xe')](_0xcc42('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xcc42('0xf')]=router; \ No newline at end of file +var _0x9e54=['../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','/:id','show','post','update','delete','destroy','multer','util','Router','fs-extra'];(function(_0x53361f,_0x3b2cb6){var _0x279237=function(_0x317757){while(--_0x317757){_0x53361f['push'](_0x53361f['shift']());}};_0x279237(++_0x3b2cb6);}(_0x9e54,0x88));var _0x49e5=function(_0x3c7ec9,_0x5ae336){_0x3c7ec9=_0x3c7ec9-0x0;var _0x505422=_0x9e54[_0x3c7ec9];return _0x505422;};'use strict';var multer=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49e5('0x2')]();var fs_extra=require(_0x49e5('0x3'));var auth=require(_0x49e5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x49e5('0x5'));var controller=require(_0x49e5('0x6'));router['get']('/',auth[_0x49e5('0x7')](),controller['index']);router['get'](_0x49e5('0x8'),auth['isAuthenticated'](),controller[_0x49e5('0x9')]);router[_0x49e5('0xa')]('/',auth[_0x49e5('0x7')](),controller['create']);router['put'](_0x49e5('0x8'),auth['isAuthenticated'](),controller[_0x49e5('0xb')]);router[_0x49e5('0xc')](_0x49e5('0x8'),auth[_0x49e5('0x7')](),controller[_0x49e5('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c6f90ea..ebd06c3 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 _0x7442=['turn','STRING','sequelize','exports','ENUM','localnet','stun'];(function(_0x1b863f,_0x37a989){var _0x494918=function(_0x5f154b){while(--_0x5f154b){_0x1b863f['push'](_0x1b863f['shift']());}};_0x494918(++_0x37a989);}(_0x7442,0x191));var _0x2744=function(_0x598bc1,_0x543990){_0x598bc1=_0x598bc1-0x0;var _0x14625d=_0x7442[_0x598bc1];return _0x14625d;};'use strict';var Sequelize=require(_0x2744('0x0'));module[_0x2744('0x1')]={'type':{'type':Sequelize[_0x2744('0x2')](_0x2744('0x3'),'externip',_0x2744('0x4'),_0x2744('0x5'))},'value':{'type':Sequelize[_0x2744('0x6')]},'username':{'type':Sequelize[_0x2744('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a0a=['sequelize','exports','ENUM','externip','stun','turn','STRING'];(function(_0x25e761,_0xe5c435){var _0x2740af=function(_0x30a342){while(--_0x30a342){_0x25e761['push'](_0x25e761['shift']());}};_0x2740af(++_0xe5c435);}(_0x6a0a,0x1dc));var _0xa6a0=function(_0xd29892,_0x2b67b9){_0xd29892=_0xd29892-0x0;var _0x293dfd=_0x6a0a[_0xd29892];return _0x293dfd;};'use strict';var Sequelize=require(_0xa6a0('0x0'));module[_0xa6a0('0x1')]={'type':{'type':Sequelize[_0xa6a0('0x2')]('localnet',_0xa6a0('0x3'),_0xa6a0('0x4'),_0xa6a0('0x5'))},'value':{'type':Sequelize[_0xa6a0('0x6')]},'username':{'type':Sequelize[_0xa6a0('0x6')]},'password':{'type':Sequelize[_0xa6a0('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7f4d639..5d4ad9a 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 _0x186d=['toLowerCase','chan_sip.so','util','ejs','../../components/parsers/qs','api','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','info','status','json','offset','undefined','limit','set','Content-Range','then','destroy','sendStatus','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','count','includeAll','include','rows','show','params','Network','options','catch','create','body','findAll','type','STUN','root','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','update','find','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format'];(function(_0x3439b9,_0x11cd7c){var _0xe920ec=function(_0x3fecc8){while(--_0x3fecc8){_0x3439b9['push'](_0x3439b9['shift']());}};_0xe920ec(++_0x11cd7c);}(_0x186d,0x142));var _0xd186=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0x186d[_0x2649e2];return _0x4797d4;};'use strict';var util=require(_0xd186('0x0'));var path=require('path');var ejs=require(_0xd186('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0xd186('0x2'));var logger=require('../../config/logger')(_0xd186('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xd186('0x4'));var client=jayson[_0xd186('0x5')][_0xd186('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58e2c1,_0x187e2b,_0x171b68,_0x2da5e2){return new Promise(function(_0x175567,_0x22cb0f){var _0x14f343=_0x2da5e2||client;return _0x14f343[_0xd186('0x7')](_0x58e2c1,_0x171b68)['then'](function(_0x11d426){logger['info'](_0xd186('0x8'),_0x187e2b,_0xd186('0x9'));logger[_0xd186('0xa')](_0xd186('0xb'),_0x187e2b,_0xd186('0x9'),JSON['stringify'](_0x11d426));if(_0x11d426[_0xd186('0xc')]){if(_0x11d426[_0xd186('0xc')]['code']===0x1f4){logger['error'](_0xd186('0x8'),_0x187e2b,_0x11d426[_0xd186('0xc')][_0xd186('0xd')]);return _0x22cb0f(_0x11d426[_0xd186('0xc')][_0xd186('0xd')]);}logger['error'](_0xd186('0x8'),_0x187e2b,_0x11d426[_0xd186('0xc')]['message']);return _0x175567(_0x11d426[_0xd186('0xc')][_0xd186('0xd')]);}else{logger[_0xd186('0xe')](_0xd186('0x8'),_0x187e2b,'request\x20sent');_0x175567(_0x11d426['result'][_0xd186('0xd')]);}})['catch'](function(_0x4883d8){logger[_0xd186('0xc')](_0xd186('0x8'),_0x187e2b,_0x4883d8);_0x22cb0f(_0x4883d8);});});}function respondWithResult(_0x38479f,_0x7f0f49){_0x7f0f49=_0x7f0f49||0xc8;return function(_0x4786d5){if(_0x4786d5){return _0x38479f[_0xd186('0xf')](_0x7f0f49)[_0xd186('0x10')](_0x4786d5);}};}function respondWithFilteredResult(_0x4adc1e,_0x578ca9){return function(_0x224743){if(_0x224743){var _0x175bdb=typeof _0x578ca9[_0xd186('0x11')]===_0xd186('0x12')&&typeof _0x578ca9[_0xd186('0x13')]===_0xd186('0x12');var _0x32aab2=_0x224743['count'];var _0x4b7fa0=_0x175bdb?0x0:_0x578ca9[_0xd186('0x11')];var _0x2fbb1d=_0x175bdb?_0x224743['count']:_0x578ca9['offset']+_0x578ca9[_0xd186('0x13')];var _0x4d19c1;if(_0x2fbb1d>=_0x32aab2){_0x2fbb1d=_0x32aab2;_0x4d19c1=0xc8;}else{_0x4d19c1=0xce;}_0x4adc1e[_0xd186('0xf')](_0x4d19c1);return _0x4adc1e[_0xd186('0x14')](_0xd186('0x15'),_0x4b7fa0+'-'+_0x2fbb1d+'/'+_0x32aab2)[_0xd186('0x10')](_0x224743);}return null;};}function saveUpdates(_0x305c3b){return function(_0x50b5c3){if(_0x50b5c3){return _0x50b5c3['update'](_0x305c3b)[_0xd186('0x16')](function(_0x1c8fe1){return _0x1c8fe1;});}return null;};}function removeEntity(_0x2ee13b){return function(_0x194895){if(_0x194895){return _0x194895[_0xd186('0x17')]()['then'](function(){_0x2ee13b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7ff2){return function(_0x1b316d){if(!_0x1b316d){_0x1d7ff2[_0xd186('0x18')](0x194);}return _0x1b316d;};}function handleError(_0x33a0d6,_0x502f8e){_0x502f8e=_0x502f8e||0x1f4;return function(_0x25f38c){logger[_0xd186('0xc')](_0x25f38c['stack']);if(_0x25f38c[_0xd186('0x19')]){delete _0x25f38c[_0xd186('0x19')];}_0x33a0d6['status'](_0x502f8e)[_0xd186('0x1a')](_0x25f38c);};}exports['index']=function(_0x1906ca,_0x47e4e5){var _0x1922e7={},_0x204a02={},_0x40aeb3={'count':0x0,'rows':[]};var _0x31d55c=_['map'](db['Network'][_0xd186('0x1b')],function(_0x4edd6b){return{'name':_0x4edd6b[_0xd186('0x1c')],'type':_0x4edd6b['type'][_0xd186('0x1d')]};});_0x204a02[_0xd186('0x1e')]=_[_0xd186('0x1f')](_0x31d55c,_0xd186('0x19'));_0x204a02[_0xd186('0x20')]=_[_0xd186('0x21')](_0x1906ca[_0xd186('0x20')]);_0x204a02[_0xd186('0x22')]=_[_0xd186('0x23')](_0x204a02[_0xd186('0x1e')],_0x204a02['query']);_0x1922e7[_0xd186('0x24')]=_[_0xd186('0x23')](_0x204a02[_0xd186('0x1e')],qs[_0xd186('0x25')](_0x1906ca['query'][_0xd186('0x25')]));_0x1922e7[_0xd186('0x24')]=_0x1922e7[_0xd186('0x24')][_0xd186('0x26')]?_0x1922e7['attributes']:_0x204a02[_0xd186('0x1e')];if(!_0x1906ca['query'][_0xd186('0x27')]('nolimit')){_0x1922e7[_0xd186('0x13')]=qs['limit'](_0x1906ca[_0xd186('0x20')][_0xd186('0x13')]);_0x1922e7['offset']=qs['offset'](_0x1906ca[_0xd186('0x20')][_0xd186('0x11')]);}_0x1922e7[_0xd186('0x28')]=qs[_0xd186('0x29')](_0x1906ca[_0xd186('0x20')][_0xd186('0x29')]);_0x1922e7[_0xd186('0x2a')]=qs[_0xd186('0x22')](_['pick'](_0x1906ca[_0xd186('0x20')],_0x204a02[_0xd186('0x22')]),_0x31d55c);if(_0x1906ca[_0xd186('0x20')][_0xd186('0x2b')]){_0x1922e7[_0xd186('0x2a')]=_[_0xd186('0x2c')](_0x1922e7[_0xd186('0x2a')],{'$or':_[_0xd186('0x1f')](_0x31d55c,function(_0x5e7c46){if(_0x5e7c46['type']!=='VIRTUAL'){var _0x222be0={};_0x222be0[_0x5e7c46[_0xd186('0x19')]]={'$like':'%'+_0x1906ca[_0xd186('0x20')][_0xd186('0x2b')]+'%'};return _0x222be0;}})});}_0x1922e7=_[_0xd186('0x2c')]({},_0x1922e7,_0x1906ca['options']);var _0x3e8469={'where':_0x1922e7[_0xd186('0x2a')]};return db['Network'][_0xd186('0x2d')](_0x3e8469)['then'](function(_0x5d45f2){_0x40aeb3[_0xd186('0x2d')]=_0x5d45f2;if(_0x1906ca[_0xd186('0x20')][_0xd186('0x2e')]){_0x1922e7[_0xd186('0x2f')]=[{'all':!![]}];}return db['Network']['findAll'](_0x1922e7);})[_0xd186('0x16')](function(_0x2d6e2d){_0x40aeb3[_0xd186('0x30')]=_0x2d6e2d;return _0x40aeb3;})[_0xd186('0x16')](respondWithFilteredResult(_0x47e4e5,_0x1922e7))['catch'](handleError(_0x47e4e5,null));};exports[_0xd186('0x31')]=function(_0x2bd5ec,_0x356c1){var _0x4d4653={'raw':!![],'where':{'id':_0x2bd5ec[_0xd186('0x32')]['id']}},_0x34f421={};_0x34f421[_0xd186('0x1e')]=_[_0xd186('0x21')](db[_0xd186('0x33')]['rawAttributes']);_0x34f421[_0xd186('0x20')]=_[_0xd186('0x21')](_0x2bd5ec[_0xd186('0x20')]);_0x34f421[_0xd186('0x22')]=_[_0xd186('0x23')](_0x34f421[_0xd186('0x1e')],_0x34f421[_0xd186('0x20')]);_0x4d4653['attributes']=_[_0xd186('0x23')](_0x34f421[_0xd186('0x1e')],qs[_0xd186('0x25')](_0x2bd5ec[_0xd186('0x20')][_0xd186('0x25')]));_0x4d4653['attributes']=_0x4d4653[_0xd186('0x24')][_0xd186('0x26')]?_0x4d4653['attributes']:_0x34f421[_0xd186('0x1e')];if(_0x2bd5ec['query'][_0xd186('0x2e')]){_0x4d4653[_0xd186('0x2f')]=[{'all':!![]}];}_0x4d4653=_[_0xd186('0x2c')]({},_0x4d4653,_0x2bd5ec[_0xd186('0x34')]);return db[_0xd186('0x33')]['find'](_0x4d4653)[_0xd186('0x16')](handleEntityNotFound(_0x356c1,null))[_0xd186('0x16')](respondWithResult(_0x356c1,null))[_0xd186('0x35')](handleError(_0x356c1,null));};exports[_0xd186('0x36')]=function(_0x574a8a,_0x32382b){var _0x359e16;return db['Network'][_0xd186('0x36')](_0x574a8a[_0xd186('0x37')],{'raw':!![]})['then'](function(_0x1e1e6f){_0x359e16=_0x1e1e6f;return db['Network'][_0xd186('0x38')]({'where':{'type':_0x574a8a['body']['type']},'raw':!![]});})[_0xd186('0x16')](function(_0x14ae33){if(_0x359e16[_0xd186('0x39')]['toUpperCase']()==_0xd186('0x3a')){var _0x709bdb=fs['readFileSync'](path['join'](config[_0xd186('0x3b')],_0xd186('0x3c')),'utf8');var _0x456266=ejs['render'](_0x709bdb,{'networks':_0x14ae33||[]});fs['writeFileSync'](_0xd186('0x3d'),_0x456266);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x36'),{'module':_0xd186('0x3f')});}else if(_0x359e16[_0xd186('0x39')][_0xd186('0x40')]()=='TURN'){var _0x5b1128=fs[_0xd186('0x41')](path[_0xd186('0x42')](config[_0xd186('0x3b')],'server/files/templates/turn_multiple.ejs'),_0xd186('0x43'));var _0x373641=ejs[_0xd186('0x44')](_0x5b1128,{'networks':_0x14ae33||[]});fs[_0xd186('0x45')](_0xd186('0x46'),_0x373641);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x36'),{'module':_0xd186('0x3f')});}else{var _0x1b0532=fs[_0xd186('0x41')](path[_0xd186('0x42')](config['root'],'server/files/templates/network.ejs'),_0xd186('0x43'));var _0x48aa75=ejs[_0xd186('0x44')](_0x1b0532,{'networks':_0x14ae33||[]});fs['writeFileSync'](util['format'](_0xd186('0x47'),_0x574a8a[_0xd186('0x37')][_0xd186('0x39')]['toLowerCase']()),_0x48aa75);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x36'),{'module':'chan_sip.so'});}})[_0xd186('0x16')](function(){return _0x359e16;})['then'](respondWithResult(_0x32382b,0xc9))[_0xd186('0x35')](handleError(_0x32382b,null));};exports[_0xd186('0x48')]=function(_0x484b20,_0x434d2e){var _0x30da44;return db[_0xd186('0x33')][_0xd186('0x49')]({'where':{'id':_0x484b20[_0xd186('0x32')]['id']}})[_0xd186('0x16')](handleEntityNotFound(_0x434d2e,null))['then'](saveUpdates(_0x484b20[_0xd186('0x37')],null))[_0xd186('0x16')](function(_0x39776e){if(_0x39776e){_0x30da44=_0x39776e;return db[_0xd186('0x33')]['findAll']({'where':{'type':_0x30da44['type']},'raw':!![]});}return null;})[_0xd186('0x16')](function(_0x3329ad){if(_0x30da44[_0xd186('0x39')][_0xd186('0x40')]()==_0xd186('0x3a')){var _0x153d79=fs['readFileSync'](path[_0xd186('0x42')](config[_0xd186('0x3b')],'server/files/templates/stun_multiple.ejs'),_0xd186('0x43'));var _0x45656a=ejs[_0xd186('0x44')](_0x153d79,{'networks':_0x3329ad||[]});fs[_0xd186('0x45')](_0xd186('0x3d'),_0x45656a);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x48'),{'module':'res_stun_monitor.so'});}else if(_0x30da44[_0xd186('0x39')]['toUpperCase']()==_0xd186('0x4a')){var _0x278cb7=fs[_0xd186('0x41')](path[_0xd186('0x42')](config[_0xd186('0x3b')],_0xd186('0x4b')),_0xd186('0x43'));var _0x4dd2aa=ejs['render'](_0x278cb7,{'networks':_0x3329ad||[]});fs[_0xd186('0x45')](_0xd186('0x46'),_0x4dd2aa);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x48'),{'module':_0xd186('0x3f')});}else{var _0x67eebe=fs[_0xd186('0x41')](path[_0xd186('0x42')](config['root'],_0xd186('0x4c')),_0xd186('0x43'));var _0x550b44=ejs[_0xd186('0x44')](_0x67eebe,{'networks':_0x3329ad||[]});fs['writeFileSync'](util[_0xd186('0x4d')](_0xd186('0x47'),_0x484b20[_0xd186('0x37')][_0xd186('0x39')]['toLowerCase']()),_0x550b44);return respondWithRpcPromise(_0xd186('0x3e'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x1cfeb2){if(_0x1cfeb2){return _0x30da44;}return null;})['then'](respondWithResult(_0x434d2e,null))[_0xd186('0x35')](handleError(_0x434d2e,null));};exports['destroy']=function(_0x2ba45b,_0x22ba3c){var _0x3fb004;return db[_0xd186('0x33')]['find']({'where':{'id':_0x2ba45b[_0xd186('0x32')]['id']}})[_0xd186('0x16')](function(_0x47538e){_0x3fb004=_0x47538e;return _0x47538e;})[_0xd186('0x16')](handleEntityNotFound(_0x22ba3c,null))[_0xd186('0x16')](removeEntity(_0x22ba3c,null))[_0xd186('0x16')](function(){if(_0x3fb004){return db[_0xd186('0x33')][_0xd186('0x38')]({'where':{'type':_0x3fb004['type']},'raw':!![]});}})[_0xd186('0x16')](function(_0x3b2310){if(_0x3fb004[_0xd186('0x39')][_0xd186('0x40')]()=='STUN'){var _0x3e1afa=fs[_0xd186('0x41')](path['join'](config[_0xd186('0x3b')],'server/files/templates/stun_multiple.ejs'),_0xd186('0x43'));var _0x1ac912=ejs[_0xd186('0x44')](_0x3e1afa,{'networks':_0x3b2310||[]});fs['writeFileSync'](_0xd186('0x3d'),_0x1ac912);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x17'),{'module':'res_stun_monitor.so'});}else if(_0x3fb004[_0xd186('0x39')][_0xd186('0x40')]()==_0xd186('0x4a')){var _0x35fa14=fs[_0xd186('0x41')](path[_0xd186('0x42')](config[_0xd186('0x3b')],_0xd186('0x4b')),_0xd186('0x43'));var _0x235023=ejs[_0xd186('0x44')](_0x35fa14,{'networks':_0x3b2310||[]});fs['writeFileSync'](_0xd186('0x46'),_0x235023);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x17'),{'module':_0xd186('0x3f')});}else{var _0x557eb7=fs[_0xd186('0x41')](path[_0xd186('0x42')](config[_0xd186('0x3b')],_0xd186('0x4c')),_0xd186('0x43'));var _0x427de4=ejs[_0xd186('0x44')](_0x557eb7,{'networks':_0x3b2310||[]});fs['writeFileSync'](util[_0xd186('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x3fb004[_0xd186('0x39')][_0xd186('0x4e')]()),_0x427de4);return respondWithRpcPromise(_0xd186('0x3e'),_0xd186('0x17'),{'module':_0xd186('0x4f')});}})[_0xd186('0x35')](handleError(_0x22ba3c,null));}; \ No newline at end of file +var _0xa797=['intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','type','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','toLowerCase','TURN','ejs','../../components/parsers/qs','api','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','Network,\x20%s,\x20%s','message','error','status','json','offset','undefined','limit','count','set','destroy','sendStatus','name','send','index','map','Network','rawAttributes','fieldName','key','model','keys','query','filters'];(function(_0x31ca37,_0x2b814f){var _0x4300cd=function(_0x5a8d09){while(--_0x5a8d09){_0x31ca37['push'](_0x31ca37['shift']());}};_0x4300cd(++_0x2b814f);}(_0xa797,0xcf));var _0x7a79=function(_0x3f56af,_0x2fb687){_0x3f56af=_0x3f56af-0x0;var _0x21ef73=_0xa797[_0x3f56af];return _0x21ef73;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x7a79('0x0'));var fs=require('fs');var _=require('lodash');var qs=require(_0x7a79('0x1'));var logger=require('../../config/logger')(_0x7a79('0x2'));var config=require(_0x7a79('0x3'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7a79('0x4'));var client=jayson[_0x7a79('0x5')][_0x7a79('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x429777,_0x295aff,_0x909390,_0x1c502a){return new Promise(function(_0x590ab3,_0x3575d5){var _0x36786e=_0x1c502a||client;return _0x36786e[_0x7a79('0x7')](_0x429777,_0x909390)[_0x7a79('0x8')](function(_0x4e0939){logger[_0x7a79('0x9')]('Network,\x20%s,\x20%s',_0x295aff,_0x7a79('0xa'));logger[_0x7a79('0xb')](_0x7a79('0xc'),_0x295aff,_0x7a79('0xa'),JSON[_0x7a79('0xd')](_0x4e0939));if(_0x4e0939['error']){if(_0x4e0939['error'][_0x7a79('0xe')]===0x1f4){logger['error'](_0x7a79('0xf'),_0x295aff,_0x4e0939['error'][_0x7a79('0x10')]);return _0x3575d5(_0x4e0939[_0x7a79('0x11')][_0x7a79('0x10')]);}logger[_0x7a79('0x11')](_0x7a79('0xf'),_0x295aff,_0x4e0939[_0x7a79('0x11')][_0x7a79('0x10')]);return _0x590ab3(_0x4e0939[_0x7a79('0x11')][_0x7a79('0x10')]);}else{logger[_0x7a79('0x9')](_0x7a79('0xf'),_0x295aff,_0x7a79('0xa'));_0x590ab3(_0x4e0939['result'][_0x7a79('0x10')]);}})['catch'](function(_0x4ce247){logger[_0x7a79('0x11')]('Network,\x20%s,\x20%s',_0x295aff,_0x4ce247);_0x3575d5(_0x4ce247);});});}function respondWithResult(_0x3b8c89,_0x5c3b11){_0x5c3b11=_0x5c3b11||0xc8;return function(_0x58d80a){if(_0x58d80a){return _0x3b8c89[_0x7a79('0x12')](_0x5c3b11)[_0x7a79('0x13')](_0x58d80a);}};}function respondWithFilteredResult(_0x44dcd7,_0x351112){return function(_0x35cf6d){if(_0x35cf6d){var _0x4c8eb2=typeof _0x351112[_0x7a79('0x14')]===_0x7a79('0x15')&&typeof _0x351112[_0x7a79('0x16')]===_0x7a79('0x15');var _0x206453=_0x35cf6d[_0x7a79('0x17')];var _0x43b38c=_0x4c8eb2?0x0:_0x351112[_0x7a79('0x14')];var _0x45793a=_0x4c8eb2?_0x35cf6d['count']:_0x351112[_0x7a79('0x14')]+_0x351112['limit'];var _0x351df5;if(_0x45793a>=_0x206453){_0x45793a=_0x206453;_0x351df5=0xc8;}else{_0x351df5=0xce;}_0x44dcd7[_0x7a79('0x12')](_0x351df5);return _0x44dcd7[_0x7a79('0x18')]('Content-Range',_0x43b38c+'-'+_0x45793a+'/'+_0x206453)['json'](_0x35cf6d);}return null;};}function saveUpdates(_0x3e4f93){return function(_0x420196){if(_0x420196){return _0x420196['update'](_0x3e4f93)[_0x7a79('0x8')](function(_0x118329){return _0x118329;});}return null;};}function removeEntity(_0x1a5f49){return function(_0x45c456){if(_0x45c456){return _0x45c456[_0x7a79('0x19')]()['then'](function(){_0x1a5f49[_0x7a79('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207556){return function(_0x2a8182){if(!_0x2a8182){_0x207556[_0x7a79('0x1a')](0x194);}return _0x2a8182;};}function handleError(_0x3814f8,_0x33045c){_0x33045c=_0x33045c||0x1f4;return function(_0x2d9b3b){logger['error'](_0x2d9b3b['stack']);if(_0x2d9b3b[_0x7a79('0x1b')]){delete _0x2d9b3b[_0x7a79('0x1b')];}_0x3814f8['status'](_0x33045c)[_0x7a79('0x1c')](_0x2d9b3b);};}exports[_0x7a79('0x1d')]=function(_0x4f92d7,_0x45080b){var _0x1447bf={},_0x5401f2={},_0x1c2451={'count':0x0,'rows':[]};var _0x55f02f=_[_0x7a79('0x1e')](db[_0x7a79('0x1f')][_0x7a79('0x20')],function(_0x6c02de){return{'name':_0x6c02de[_0x7a79('0x21')],'type':_0x6c02de['type'][_0x7a79('0x22')]};});_0x5401f2[_0x7a79('0x23')]=_[_0x7a79('0x1e')](_0x55f02f,_0x7a79('0x1b'));_0x5401f2['query']=_[_0x7a79('0x24')](_0x4f92d7[_0x7a79('0x25')]);_0x5401f2[_0x7a79('0x26')]=_[_0x7a79('0x27')](_0x5401f2[_0x7a79('0x23')],_0x5401f2[_0x7a79('0x25')]);_0x1447bf[_0x7a79('0x28')]=_[_0x7a79('0x27')](_0x5401f2[_0x7a79('0x23')],qs[_0x7a79('0x29')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x29')]));_0x1447bf[_0x7a79('0x28')]=_0x1447bf[_0x7a79('0x28')][_0x7a79('0x2a')]?_0x1447bf[_0x7a79('0x28')]:_0x5401f2[_0x7a79('0x23')];if(!_0x4f92d7['query'][_0x7a79('0x2b')]('nolimit')){_0x1447bf[_0x7a79('0x16')]=qs[_0x7a79('0x16')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x16')]);_0x1447bf[_0x7a79('0x14')]=qs[_0x7a79('0x14')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x14')]);}_0x1447bf['order']=qs[_0x7a79('0x2c')](_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x2c')]);_0x1447bf['where']=qs[_0x7a79('0x26')](_[_0x7a79('0x2d')](_0x4f92d7[_0x7a79('0x25')],_0x5401f2['filters']),_0x55f02f);if(_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x2e')]){_0x1447bf[_0x7a79('0x2f')]=_[_0x7a79('0x30')](_0x1447bf['where'],{'$or':_['map'](_0x55f02f,function(_0x64b469){if(_0x64b469['type']!==_0x7a79('0x31')){var _0xf2115f={};_0xf2115f[_0x64b469['name']]={'$like':'%'+_0x4f92d7['query']['filter']+'%'};return _0xf2115f;}})});}_0x1447bf=_['merge']({},_0x1447bf,_0x4f92d7[_0x7a79('0x32')]);var _0xbcb8a3={'where':_0x1447bf[_0x7a79('0x2f')]};return db[_0x7a79('0x1f')]['count'](_0xbcb8a3)[_0x7a79('0x8')](function(_0x4c6e56){_0x1c2451[_0x7a79('0x17')]=_0x4c6e56;if(_0x4f92d7[_0x7a79('0x25')][_0x7a79('0x33')]){_0x1447bf[_0x7a79('0x34')]=[{'all':!![]}];}return db[_0x7a79('0x1f')][_0x7a79('0x35')](_0x1447bf);})[_0x7a79('0x8')](function(_0x4b4389){_0x1c2451[_0x7a79('0x36')]=_0x4b4389;return _0x1c2451;})[_0x7a79('0x8')](respondWithFilteredResult(_0x45080b,_0x1447bf))[_0x7a79('0x37')](handleError(_0x45080b,null));};exports['show']=function(_0xbf80c7,_0x3c208e){var _0x256b6e={'raw':!![],'where':{'id':_0xbf80c7[_0x7a79('0x38')]['id']}},_0x3ef9e5={};_0x3ef9e5[_0x7a79('0x23')]=_[_0x7a79('0x24')](db[_0x7a79('0x1f')][_0x7a79('0x20')]);_0x3ef9e5[_0x7a79('0x25')]=_[_0x7a79('0x24')](_0xbf80c7['query']);_0x3ef9e5[_0x7a79('0x26')]=_['intersection'](_0x3ef9e5['model'],_0x3ef9e5[_0x7a79('0x25')]);_0x256b6e[_0x7a79('0x28')]=_[_0x7a79('0x27')](_0x3ef9e5[_0x7a79('0x23')],qs[_0x7a79('0x29')](_0xbf80c7[_0x7a79('0x25')][_0x7a79('0x29')]));_0x256b6e[_0x7a79('0x28')]=_0x256b6e[_0x7a79('0x28')]['length']?_0x256b6e['attributes']:_0x3ef9e5['model'];if(_0xbf80c7['query']['includeAll']){_0x256b6e[_0x7a79('0x34')]=[{'all':!![]}];}_0x256b6e=_[_0x7a79('0x30')]({},_0x256b6e,_0xbf80c7[_0x7a79('0x32')]);return db[_0x7a79('0x1f')][_0x7a79('0x39')](_0x256b6e)[_0x7a79('0x8')](handleEntityNotFound(_0x3c208e,null))[_0x7a79('0x8')](respondWithResult(_0x3c208e,null))[_0x7a79('0x37')](handleError(_0x3c208e,null));};exports[_0x7a79('0x3a')]=function(_0x106387,_0x57be9){var _0x16b462;return db['Network'][_0x7a79('0x3a')](_0x106387[_0x7a79('0x3b')],{'raw':!![]})[_0x7a79('0x8')](function(_0x2a5513){_0x16b462=_0x2a5513;return db[_0x7a79('0x1f')][_0x7a79('0x35')]({'where':{'type':_0x106387[_0x7a79('0x3b')][_0x7a79('0x3c')]},'raw':!![]});})[_0x7a79('0x8')](function(_0x359631){if(_0x16b462[_0x7a79('0x3c')][_0x7a79('0x3d')]()==_0x7a79('0x3e')){var _0x2d1bcc=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config[_0x7a79('0x41')],_0x7a79('0x42')),_0x7a79('0x43'));var _0x5004f4=ejs[_0x7a79('0x44')](_0x2d1bcc,{'networks':_0x359631||[]});fs[_0x7a79('0x45')](_0x7a79('0x46'),_0x5004f4);return respondWithRpcPromise('Reload',_0x7a79('0x3a'),{'module':_0x7a79('0x47')});}else if(_0x16b462[_0x7a79('0x3c')]['toUpperCase']()=='TURN'){var _0x1bc2ad=fs['readFileSync'](path[_0x7a79('0x40')](config[_0x7a79('0x41')],_0x7a79('0x48')),_0x7a79('0x43'));var _0x477ace=ejs['render'](_0x1bc2ad,{'networks':_0x359631||[]});fs[_0x7a79('0x45')](_0x7a79('0x49'),_0x477ace);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x3a'),{'module':_0x7a79('0x47')});}else{var _0x5c6730=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config['root'],_0x7a79('0x4b')),_0x7a79('0x43'));var _0x5e3137=ejs[_0x7a79('0x44')](_0x5c6730,{'networks':_0x359631||[]});fs['writeFileSync'](util[_0x7a79('0x4c')](_0x7a79('0x4d'),_0x106387['body'][_0x7a79('0x3c')]['toLowerCase']()),_0x5e3137);return respondWithRpcPromise(_0x7a79('0x4a'),'create',{'module':_0x7a79('0x4e')});}})[_0x7a79('0x8')](function(){return _0x16b462;})[_0x7a79('0x8')](respondWithResult(_0x57be9,0xc9))[_0x7a79('0x37')](handleError(_0x57be9,null));};exports[_0x7a79('0x4f')]=function(_0x4aa38c,_0x212e78){var _0xd48a4b;return db[_0x7a79('0x1f')]['find']({'where':{'id':_0x4aa38c[_0x7a79('0x38')]['id']}})['then'](handleEntityNotFound(_0x212e78,null))['then'](saveUpdates(_0x4aa38c[_0x7a79('0x3b')],null))[_0x7a79('0x8')](function(_0x35a059){if(_0x35a059){_0xd48a4b=_0x35a059;return db[_0x7a79('0x1f')]['findAll']({'where':{'type':_0xd48a4b[_0x7a79('0x3c')]},'raw':!![]});}return null;})[_0x7a79('0x8')](function(_0x333d91){if(_0xd48a4b[_0x7a79('0x3c')][_0x7a79('0x3d')]()==_0x7a79('0x3e')){var _0x46da4d=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config['root'],_0x7a79('0x42')),_0x7a79('0x43'));var _0x4f66d2=ejs['render'](_0x46da4d,{'networks':_0x333d91||[]});fs[_0x7a79('0x45')](_0x7a79('0x46'),_0x4f66d2);return respondWithRpcPromise(_0x7a79('0x4a'),'update',{'module':_0x7a79('0x47')});}else if(_0xd48a4b[_0x7a79('0x3c')][_0x7a79('0x3d')]()=='TURN'){var _0x32ea66=fs[_0x7a79('0x3f')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x7a79('0x43'));var _0x2fc142=ejs['render'](_0x32ea66,{'networks':_0x333d91||[]});fs[_0x7a79('0x45')](_0x7a79('0x49'),_0x2fc142);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x4f'),{'module':_0x7a79('0x47')});}else{var _0x35d9bd=fs[_0x7a79('0x3f')](path['join'](config['root'],_0x7a79('0x4b')),_0x7a79('0x43'));var _0xba5379=ejs[_0x7a79('0x44')](_0x35d9bd,{'networks':_0x333d91||[]});fs[_0x7a79('0x45')](util[_0x7a79('0x4c')](_0x7a79('0x4d'),_0x4aa38c[_0x7a79('0x3b')]['type'][_0x7a79('0x50')]()),_0xba5379);return respondWithRpcPromise(_0x7a79('0x4a'),'update',{'module':_0x7a79('0x4e')});}})[_0x7a79('0x8')](function(_0x517296){if(_0x517296){return _0xd48a4b;}return null;})[_0x7a79('0x8')](respondWithResult(_0x212e78,null))[_0x7a79('0x37')](handleError(_0x212e78,null));};exports['destroy']=function(_0x39751f,_0x14d480){var _0x414997;return db[_0x7a79('0x1f')][_0x7a79('0x39')]({'where':{'id':_0x39751f[_0x7a79('0x38')]['id']}})[_0x7a79('0x8')](function(_0x384501){_0x414997=_0x384501;return _0x384501;})[_0x7a79('0x8')](handleEntityNotFound(_0x14d480,null))[_0x7a79('0x8')](removeEntity(_0x14d480,null))['then'](function(){if(_0x414997){return db[_0x7a79('0x1f')][_0x7a79('0x35')]({'where':{'type':_0x414997['type']},'raw':!![]});}})['then'](function(_0x30fc1a){if(_0x414997['type'][_0x7a79('0x3d')]()==_0x7a79('0x3e')){var _0x5a5426=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config['root'],_0x7a79('0x42')),_0x7a79('0x43'));var _0x58c6ed=ejs['render'](_0x5a5426,{'networks':_0x30fc1a||[]});fs['writeFileSync'](_0x7a79('0x46'),_0x58c6ed);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x19'),{'module':_0x7a79('0x47')});}else if(_0x414997['type'][_0x7a79('0x3d')]()==_0x7a79('0x51')){var _0xc22031=fs['readFileSync'](path[_0x7a79('0x40')](config[_0x7a79('0x41')],_0x7a79('0x48')),_0x7a79('0x43'));var _0x23c9d8=ejs['render'](_0xc22031,{'networks':_0x30fc1a||[]});fs[_0x7a79('0x45')](_0x7a79('0x49'),_0x23c9d8);return respondWithRpcPromise('Reload',_0x7a79('0x19'),{'module':_0x7a79('0x47')});}else{var _0x2e986b=fs[_0x7a79('0x3f')](path[_0x7a79('0x40')](config[_0x7a79('0x41')],'server/files/templates/network.ejs'),_0x7a79('0x43'));var _0xb88ffb=ejs[_0x7a79('0x44')](_0x2e986b,{'networks':_0x30fc1a||[]});fs[_0x7a79('0x45')](util[_0x7a79('0x4c')](_0x7a79('0x4d'),_0x414997[_0x7a79('0x3c')][_0x7a79('0x50')]()),_0xb88ffb);return respondWithRpcPromise(_0x7a79('0x4a'),_0x7a79('0x19'),{'module':_0x7a79('0x4e')});}})[_0x7a79('0x37')](handleError(_0x14d480,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9289cd6..f24cb45 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 _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger'];(function(_0x57f100,_0xa53aca){var _0x4cac01=function(_0x447061){while(--_0x447061){_0x57f100['push'](_0x57f100['shift']());}};_0x4cac01(++_0xa53aca);}(_0x0427,0x137));var _0x7042=function(_0x56ef34,_0x5ecd72){_0x56ef34=_0x56ef34-0x0;var _0x4c1d92=_0x0427[_0x56ef34];return _0x4c1d92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4876=['../../config/environment','./network.attributes','Network','network','../../config/logger','bluebird','path','rimraf'];(function(_0x2d5a91,_0x28c170){var _0x5a1918=function(_0x537090){while(--_0x537090){_0x2d5a91['push'](_0x2d5a91['shift']());}};_0x5a1918(++_0x28c170);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'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 8e5de83..29f9e5d 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x403490,_0x41d621){_0x403490=_0x403490-0x0;var _0x3ab7c9=_0x7a54[_0x403490];return _0x3ab7c9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0xe2f253,_0x53651c){_0xe2f253=_0xe2f253-0x0;var _0x4a9aaa=_0x7a54[_0xe2f253];return _0x4a9aaa;};'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 6b78fa3..d85a149 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 _0x5fdc=['../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xf5fa0d,_0x17485e){var _0x2633e3=function(_0x593a2f){while(--_0x593a2f){_0xf5fa0d['push'](_0xf5fa0d['shift']());}};_0x2633e3(++_0x17485e);}(_0x5fdc,0x127));var _0xc5fd=function(_0xbb4b4c,_0x1468be){_0xbb4b4c=_0xbb4b4c-0x0;var _0x434ae6=_0x5fdc[_0xbb4b4c];return _0x434ae6;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc5fd('0xb')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router['get']('/:id/dispositions',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0xb')](_0xc5fd('0x11'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x12')]);router['get'](_0xc5fd('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0xc5fd('0xb')](_0xc5fd('0x14'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x15')]);router[_0xc5fd('0xb')](_0xc5fd('0x16'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x17')]);router['post']('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x18')]);router[_0xc5fd('0x19')](_0xc5fd('0x1a'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc5fd('0x1b')]);router[_0xc5fd('0x19')](_0xc5fd('0x1c'),controller[_0xc5fd('0x1d')]);router[_0xc5fd('0x19')](_0xc5fd('0x13'),auth[_0xc5fd('0xc')](),controller['addApplications']);router[_0xc5fd('0x19')](_0xc5fd('0x16'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x1e')]);router[_0xc5fd('0x19')]('/:id/send',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x1f')]);router[_0xc5fd('0x20')](_0xc5fd('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc5fd('0x21')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x22')]);router[_0xc5fd('0x21')](_0xc5fd('0x1a'),auth['isAuthenticated'](),controller[_0xc5fd('0x23')]);router[_0xc5fd('0x21')](_0xc5fd('0x11'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x24')]);router[_0xc5fd('0x21')](_0xc5fd('0x16'),auth['isAuthenticated'](),controller[_0xc5fd('0x25')]);module['exports']=router; \ No newline at end of file +var _0xd824=['addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','/:id','get','/:id/dispositions','getAnswers','getApplications','/:id/interactions','/:id/users','post','create','addDisposition','/:id/canned_answers'];(function(_0x32a22d,_0x17b134){var _0x302d10=function(_0x2d6e33){while(--_0x2d6e33){_0x32a22d['push'](_0x32a22d['shift']());}};_0x302d10(++_0x17b134);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d82('0x2'));var router=express[_0x4d82('0x3')]();var fs_extra=require(_0x4d82('0x4'));var auth=require(_0x4d82('0x5'));var interaction=require(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x4d82('0x8')](),controller['index']);router['get'](_0x4d82('0x9'),auth[_0x4d82('0x8')](),controller[_0x4d82('0xa')]);router['get'](_0x4d82('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4d82('0xc')](_0x4d82('0xd'),auth[_0x4d82('0x8')](),controller['getDispositions']);router[_0x4d82('0xc')]('/:id/canned_answers',auth[_0x4d82('0x8')](),controller[_0x4d82('0xe')]);router[_0x4d82('0xc')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4d82('0xf')]);router[_0x4d82('0xc')](_0x4d82('0x10'),auth[_0x4d82('0x8')](),controller['getInteractions']);router[_0x4d82('0xc')](_0x4d82('0x11'),auth[_0x4d82('0x8')](),controller['getAgents']);router[_0x4d82('0x12')]('/',auth['isAuthenticated'](),controller[_0x4d82('0x13')]);router['post'](_0x4d82('0xd'),auth['isAuthenticated'](),controller[_0x4d82('0x14')]);router[_0x4d82('0x12')](_0x4d82('0x15'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x16')]);router[_0x4d82('0x12')](_0x4d82('0x17'),controller[_0x4d82('0x18')]);router[_0x4d82('0x12')]('/:id/applications',auth[_0x4d82('0x8')](),controller[_0x4d82('0x19')]);router[_0x4d82('0x12')](_0x4d82('0x11'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x1a')]);router[_0x4d82('0x12')](_0x4d82('0x1b'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x1c')]);router[_0x4d82('0x1d')]('/:id',auth[_0x4d82('0x8')](),controller[_0x4d82('0x1e')]);router['delete'](_0x4d82('0xb'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x1f')]);router[_0x4d82('0x20')](_0x4d82('0xd'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x21')]);router[_0x4d82('0x20')](_0x4d82('0x15'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x22')]);router[_0x4d82('0x20')](_0x4d82('0x11'),auth[_0x4d82('0x8')](),controller[_0x4d82('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index dc0a26b..ee78d13 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 _0xb839=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x189eab,_0x2d1178){var _0x4513dc=function(_0x3371c0){while(--_0x3371c0){_0x189eab['push'](_0x189eab['shift']());}};_0x4513dc(++_0x2d1178);}(_0xb839,0xbc));var _0x9b83=function(_0x500f3f,_0xfc91f){_0x500f3f=_0x500f3f-0x0;var _0x29d063=_0xb839[_0x500f3f];return _0x29d063;};'use strict';var Sequelize=require(_0x9b83('0x0'));var rs=require('randomstring');module[_0x9b83('0x1')]={'name':{'type':Sequelize[_0x9b83('0x2')],'unique':_0x9b83('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9b83('0x2')]},'token':{'type':Sequelize[_0x9b83('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x9b83('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9b83('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9b83('0x4')],'defaultValue':function(){return _0x9b83('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9b83('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9b83('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9b83('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9b83('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9b83('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9b83('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9b83('0x8'),'set':function(_0xb1a438){if(!_0xb1a438)this[_0x9b83('0x9')](_0x9b83('0xa'),null);this[_0x9b83('0x9')](_0x9b83('0xb'),_0xb1a438);}}}; \ No newline at end of file +var _0x7d3e=['STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports'];(function(_0x457bc6,_0x431adc){var _0x337f06=function(_0x158788){while(--_0x158788){_0x457bc6['push'](_0x457bc6['shift']());}};_0x337f06(++_0x431adc);}(_0x7d3e,0x1b5));var _0xe7d3=function(_0x3cc7e2,_0x525b5f){_0x3cc7e2=_0x3cc7e2-0x0;var _0x1b0f21=_0x7d3e[_0x3cc7e2];return _0x1b0f21;};'use strict';var Sequelize=require(_0xe7d3('0x0'));var rs=require(_0xe7d3('0x1'));module[_0xe7d3('0x2')]={'name':{'type':Sequelize[_0xe7d3('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xe7d3('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe7d3('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe7d3('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe7d3('0x4')],'defaultValue':function(){return _0xe7d3('0x5');}},'notificationSound':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe7d3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe7d3('0x3')]},'queueTransfer':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe7d3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe7d3('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe7d3('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xa942aa){if(!_0xa942aa)this['setDataValue'](_0xe7d3('0x8'),null);this[_0xe7d3('0x9')]('mandatoryDisposition',_0xa942aa);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b245ee8..a6d0208 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 _0xe864=['OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','rows','show','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','CannedAnswer','getAnswers','pick','removeAnswers','notify','openchannel','CmContact','createdAt','updatedAt','difference','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','priority','asc','defaults','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','queue','Start','sequelize','Transaction','READ_COMMITTED','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x4cfe2a,_0x5b0a93){var _0x4f346b=function(_0x1aa38e){while(--_0x1aa38e){_0x4cfe2a['push'](_0x4cfe2a['shift']());}};_0x4f346b(++_0x5b0a93);}(_0xe864,0x14b));var _0x4e86=function(_0x38f012,_0x1df6e8){_0x38f012=_0x38f012-0x0;var _0x38add2=_0xe864[_0x38f012];return _0x38add2;};'use strict';var emlformat=require(_0x4e86('0x0'));var rimraf=require(_0x4e86('0x1'));var zipdir=require(_0x4e86('0x2'));var jsonpatch=require(_0x4e86('0x3'));var rp=require(_0x4e86('0x4'));var moment=require(_0x4e86('0x5'));var BPromise=require(_0x4e86('0x6'));var Mustache=require(_0x4e86('0x7'));var util=require(_0x4e86('0x8'));var path=require(_0x4e86('0x9'));var sox=require(_0x4e86('0xa'));var csv=require(_0x4e86('0xb'));var ejs=require(_0x4e86('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e86('0xd'));var squel=require(_0x4e86('0xe'));var crypto=require('crypto');var jsforce=require(_0x4e86('0xf'));var deskjs=require(_0x4e86('0x10'));var toCsv=require(_0x4e86('0xb'));var querystring=require(_0x4e86('0x11'));var Papa=require(_0x4e86('0x12'));var Redis=require(_0x4e86('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e86('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e86('0x15'))(_0x4e86('0x16'));var utils=require(_0x4e86('0x17'));var config=require(_0x4e86('0x18'));var licenseUtil=require(_0x4e86('0x19'));var db=require(_0x4e86('0x1a'))['db'];config[_0x4e86('0x1b')]=_['defaults'](config[_0x4e86('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4e86('0x1c'))[_0x4e86('0x1d')](socket);var jayson=require(_0x4e86('0x1e'));var client=jayson[_0x4e86('0x1f')][_0x4e86('0x20')]({'port':0x232c});var client9002=jayson[_0x4e86('0x1f')][_0x4e86('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x292ef8,_0x1f6875,_0x3f19d0,_0x20cd27){return new BPromise(function(_0x5185b5,_0x5788b7){var _0x55a7b0=_0x20cd27||client;return _0x55a7b0[_0x4e86('0x21')](_0x292ef8,_0x3f19d0)['then'](function(_0x1e917c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1f6875,_0x4e86('0x22'));logger['debug'](_0x4e86('0x23'),_0x1f6875,_0x4e86('0x22'),JSON['stringify'](_0x1e917c));if(_0x1e917c['error']){if(_0x1e917c[_0x4e86('0x24')][_0x4e86('0x25')]===0x1f4){logger[_0x4e86('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x1f6875,_0x1e917c[_0x4e86('0x24')]['message']);return _0x5788b7(_0x1e917c['error'][_0x4e86('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1f6875,_0x1e917c[_0x4e86('0x24')][_0x4e86('0x26')]);return _0x5185b5(_0x1e917c['error'][_0x4e86('0x26')]);}else{logger[_0x4e86('0x27')](_0x4e86('0x28'),_0x1f6875,'request\x20sent');_0x5185b5(_0x1e917c[_0x4e86('0x29')][_0x4e86('0x26')]);}})[_0x4e86('0x2a')](function(_0x388887){logger[_0x4e86('0x24')](_0x4e86('0x28'),_0x1f6875,_0x388887);_0x5788b7(_0x388887);});});}function respondWithStatusCode(_0x860ef,_0x2a4ff1){_0x2a4ff1=_0x2a4ff1||0xcc;return function(_0x5c2d72){if(_0x5c2d72){return _0x860ef[_0x4e86('0x2b')](_0x2a4ff1);}return _0x860ef['status'](_0x2a4ff1)['end']();};}function respondWithResult(_0x1f9f25,_0x532bed){_0x532bed=_0x532bed||0xc8;return function(_0x1e9c1b){if(_0x1e9c1b){return _0x1f9f25[_0x4e86('0x2c')](_0x532bed)[_0x4e86('0x2d')](_0x1e9c1b);}};}function respondWithFilteredResult(_0x2ff569,_0x4a5c7d){return function(_0x2bbd61){if(_0x2bbd61){var _0x325f46=typeof _0x4a5c7d[_0x4e86('0x2e')]===_0x4e86('0x2f')&&typeof _0x4a5c7d[_0x4e86('0x30')]===_0x4e86('0x2f');var _0x8f2658=_0x2bbd61[_0x4e86('0x31')];var _0xdda456=_0x325f46?0x0:_0x4a5c7d[_0x4e86('0x2e')];var _0x5d6fa8=_0x325f46?_0x2bbd61[_0x4e86('0x31')]:_0x4a5c7d[_0x4e86('0x2e')]+_0x4a5c7d[_0x4e86('0x30')];var _0x5002ee;if(_0x5d6fa8>=_0x8f2658){_0x5d6fa8=_0x8f2658;_0x5002ee=0xc8;}else{_0x5002ee=0xce;}_0x2ff569[_0x4e86('0x2c')](_0x5002ee);return _0x2ff569[_0x4e86('0x32')](_0x4e86('0x33'),_0xdda456+'-'+_0x5d6fa8+'/'+_0x8f2658)['json'](_0x2bbd61);}return null;};}function patchUpdates(_0x223021){return function(_0x207e57){try{jsonpatch[_0x4e86('0x34')](_0x207e57,_0x223021,!![]);}catch(_0x557bd5){return BPromise[_0x4e86('0x35')](_0x557bd5);}return _0x207e57[_0x4e86('0x36')]();};}function saveUpdates(_0x18e855,_0x47fcc8){return function(_0x381b10){if(_0x381b10){return _0x381b10[_0x4e86('0x37')](_0x18e855)['then'](function(_0x26e41a){return _0x26e41a;});}return null;};}function removeEntity(_0x1a8b8d,_0x52697a){return function(_0x3246e3){if(_0x3246e3){return _0x3246e3[_0x4e86('0x38')]()[_0x4e86('0x39')](function(){var _0xf4b0ee=_0x3246e3[_0x4e86('0x3a')]({'plain':!![]});var _0x2a089b=_0x4e86('0x3b');return db[_0x4e86('0x3c')][_0x4e86('0x38')]({'where':{'type':_0x2a089b,'resourceId':_0xf4b0ee['id']}})[_0x4e86('0x39')](function(){return _0x3246e3;});})[_0x4e86('0x39')](function(){_0x1a8b8d[_0x4e86('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20fe2e,_0x13c54a){return function(_0x3c3c9d){if(!_0x3c3c9d){_0x20fe2e[_0x4e86('0x2b')](0x194);}return _0x3c3c9d;};}function handleError(_0x34ae08,_0x2dd790){_0x2dd790=_0x2dd790||0x1f4;return function(_0x429ac4){logger[_0x4e86('0x24')](_0x429ac4[_0x4e86('0x3d')]);if(_0x429ac4[_0x4e86('0x3e')]){delete _0x429ac4[_0x4e86('0x3e')];}_0x34ae08[_0x4e86('0x2c')](_0x2dd790)['send'](_0x429ac4);};}exports[_0x4e86('0x3f')]=function(_0x20ad14,_0x5c3c88){var _0x164854={'include':[{'model':db['Pause'],'as':_0x4e86('0x40')}]},_0x518fb6={},_0x2688ee={'count':0x0,'rows':[]};var _0x17fca6=_[_0x4e86('0x41')](db[_0x4e86('0x42')][_0x4e86('0x43')],function(_0x190ae1){return{'name':_0x190ae1[_0x4e86('0x44')],'type':_0x190ae1[_0x4e86('0x45')][_0x4e86('0x46')]};});_0x518fb6[_0x4e86('0x47')]=_[_0x4e86('0x41')](_0x17fca6,_0x4e86('0x3e'));_0x518fb6['query']=_[_0x4e86('0x48')](_0x20ad14[_0x4e86('0x49')]);_0x518fb6['filters']=_[_0x4e86('0x4a')](_0x518fb6[_0x4e86('0x47')],_0x518fb6[_0x4e86('0x49')]);_0x164854[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x518fb6['model'],qs[_0x4e86('0x4c')](_0x20ad14['query'][_0x4e86('0x4c')]));_0x164854[_0x4e86('0x4b')]=_0x164854[_0x4e86('0x4b')]['length']?_0x164854['attributes']:_0x518fb6[_0x4e86('0x47')];if(!_0x20ad14[_0x4e86('0x49')][_0x4e86('0x4d')](_0x4e86('0x4e'))){_0x164854['limit']=qs[_0x4e86('0x30')](_0x20ad14[_0x4e86('0x49')][_0x4e86('0x30')]);_0x164854[_0x4e86('0x2e')]=qs[_0x4e86('0x2e')](_0x20ad14['query'][_0x4e86('0x2e')]);}_0x164854[_0x4e86('0x4f')]=qs[_0x4e86('0x50')](_0x20ad14[_0x4e86('0x49')]['sort']);_0x164854[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_['pick'](_0x20ad14[_0x4e86('0x49')],_0x518fb6[_0x4e86('0x52')]),_0x17fca6);if(_0x20ad14[_0x4e86('0x49')]['filter']){_0x164854[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x164854[_0x4e86('0x51')],{'$or':_[_0x4e86('0x41')](_0x17fca6,function(_0x4436bf){if(_0x4436bf['type']!=='VIRTUAL'){var _0x1ce9f1={};_0x1ce9f1[_0x4436bf['name']]={'$like':'%'+_0x20ad14[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0x1ce9f1;}})});}_0x164854=_[_0x4e86('0x53')]({},_0x164854,_0x20ad14[_0x4e86('0x55')]);var _0x392bf2={'where':_0x164854[_0x4e86('0x51')]};return db[_0x4e86('0x42')][_0x4e86('0x31')](_0x392bf2)[_0x4e86('0x39')](function(_0x3a6d0c){_0x2688ee['count']=_0x3a6d0c;if(_0x20ad14[_0x4e86('0x49')][_0x4e86('0x56')]){_0x164854[_0x4e86('0x57')]=[{'all':!![]}];}return db[_0x4e86('0x42')]['findAll'](_0x164854);})[_0x4e86('0x39')](function(_0x37e853){_0x2688ee[_0x4e86('0x58')]=_0x37e853;return _0x2688ee;})['then'](respondWithFilteredResult(_0x5c3c88,_0x164854))[_0x4e86('0x2a')](handleError(_0x5c3c88,null));};exports[_0x4e86('0x59')]=function(_0x111aa3,_0x26d3ae){var _0x45a4df={'raw':![],'where':{'id':_0x111aa3['params']['id']},'include':[{'model':db[_0x4e86('0x5a')],'as':_0x4e86('0x40')}]},_0x2e6763={};_0x2e6763[_0x4e86('0x47')]=_[_0x4e86('0x48')](db['OpenchannelAccount']['rawAttributes']);_0x2e6763[_0x4e86('0x49')]=_[_0x4e86('0x48')](_0x111aa3[_0x4e86('0x49')]);_0x2e6763[_0x4e86('0x52')]=_['intersection'](_0x2e6763[_0x4e86('0x47')],_0x2e6763[_0x4e86('0x49')]);_0x45a4df[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x2e6763[_0x4e86('0x47')],qs['fields'](_0x111aa3[_0x4e86('0x49')][_0x4e86('0x4c')]));_0x45a4df[_0x4e86('0x4b')]=_0x45a4df['attributes'][_0x4e86('0x5b')]?_0x45a4df['attributes']:_0x2e6763['model'];if(_0x111aa3[_0x4e86('0x49')][_0x4e86('0x56')]){_0x45a4df[_0x4e86('0x57')]=[{'all':!![]}];}_0x45a4df=_['merge']({},_0x45a4df,_0x111aa3['options']);return db[_0x4e86('0x42')][_0x4e86('0x5c')](_0x45a4df)[_0x4e86('0x39')](handleEntityNotFound(_0x26d3ae,null))[_0x4e86('0x39')](respondWithResult(_0x26d3ae,null))[_0x4e86('0x2a')](handleError(_0x26d3ae,null));};exports[_0x4e86('0x5d')]=function(_0x3b4d33,_0x4684eb){return db[_0x4e86('0x42')]['create'](_0x3b4d33[_0x4e86('0x5e')],{})[_0x4e86('0x39')](function(_0x50ecb8){var _0xc29b96=_0x3b4d33[_0x4e86('0x5f')]['get']({'plain':!![]});if(!_0xc29b96)throw new Error(_0x4e86('0x60'));if(_0xc29b96[_0x4e86('0x61')]===_0x4e86('0x5f')){var _0x235bdb=_0x50ecb8['get']({'plain':!![]});var _0x23d216=_0x4e86('0x3b');return db['UserProfileSection'][_0x4e86('0x5c')]({'where':{'name':_0x23d216,'userProfileId':_0xc29b96[_0x4e86('0x62')]},'raw':!![]})['then'](function(_0x229431){if(_0x229431&&_0x229431[_0x4e86('0x63')]===0x0){return db[_0x4e86('0x3c')][_0x4e86('0x5d')]({'name':_0x235bdb['name'],'resourceId':_0x235bdb['id'],'type':_0x229431[_0x4e86('0x3e')],'sectionId':_0x229431['id']},{})['then'](function(){return _0x50ecb8;});}else{return _0x50ecb8;}})[_0x4e86('0x2a')](function(_0x318768){logger[_0x4e86('0x24')](_0x4e86('0x64'),_0x318768);throw _0x318768;});}return _0x50ecb8;})[_0x4e86('0x39')](respondWithResult(_0x4684eb,0xc9))['catch'](handleError(_0x4684eb,null));};exports[_0x4e86('0x37')]=function(_0x5e527c,_0x51e16f){if(_0x5e527c['body']['id']){delete _0x5e527c[_0x4e86('0x5e')]['id'];}return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x5e527c[_0x4e86('0x65')]['id']},'include':[{'model':db[_0x4e86('0x5a')],'as':_0x4e86('0x40')}]})[_0x4e86('0x39')](handleEntityNotFound(_0x51e16f,null))[_0x4e86('0x39')](saveUpdates(_0x5e527c[_0x4e86('0x5e')],null))['then'](respondWithResult(_0x51e16f,null))[_0x4e86('0x2a')](handleError(_0x51e16f,null));};exports[_0x4e86('0x38')]=function(_0xf7979c,_0x321a1b){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0xf7979c[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x321a1b,null))[_0x4e86('0x39')](removeEntity(_0x321a1b,null))[_0x4e86('0x2a')](handleError(_0x321a1b,null));};exports['describe']=function(_0xa66c2e,_0x1b345a){return db[_0x4e86('0x42')][_0x4e86('0x66')]()[_0x4e86('0x39')](respondWithResult(_0x1b345a,null))[_0x4e86('0x2a')](handleError(_0x1b345a,null));};exports['addDisposition']=function(_0x724ce1,_0x5d65b7,_0x510139){if(_0x724ce1['body']['id']){delete _0x724ce1[_0x4e86('0x5e')]['id'];}return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x724ce1[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x5d65b7,null))[_0x4e86('0x39')](function(_0x421f16){if(_0x421f16){_0x724ce1[_0x4e86('0x5e')][_0x4e86('0x67')]=_0x421f16['id'];return db[_0x4e86('0x68')][_0x4e86('0x5d')](_0x724ce1[_0x4e86('0x5e')]);}})[_0x4e86('0x39')](respondWithResult(_0x5d65b7,null))[_0x4e86('0x2a')](handleError(_0x5d65b7,null));};exports[_0x4e86('0x69')]=function(_0x2d44f8,_0x3a6cac,_0x45e706){var _0x575e23={'raw':![],'where':{}};var _0x7164f4={};var _0x4e38a2={'count':0x0,'rows':[]};return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x2d44f8[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x3a6cac,null))[_0x4e86('0x39')](function(_0x4d26fe){if(_0x4d26fe){_0x7164f4[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x68')]['rawAttributes']);_0x7164f4[_0x4e86('0x49')]=_[_0x4e86('0x48')](_0x2d44f8[_0x4e86('0x49')]);_0x7164f4[_0x4e86('0x52')]=_[_0x4e86('0x4a')](_0x7164f4[_0x4e86('0x47')],_0x7164f4[_0x4e86('0x49')]);_0x575e23[_0x4e86('0x4b')]=_['intersection'](_0x7164f4['model'],qs['fields'](_0x2d44f8[_0x4e86('0x49')]['fields']));_0x575e23['attributes']=_0x575e23[_0x4e86('0x4b')]['length']?_0x575e23[_0x4e86('0x4b')]:_0x7164f4['model'];if(!_0x2d44f8['query'][_0x4e86('0x4d')](_0x4e86('0x4e'))){_0x575e23[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x30')]);_0x575e23[_0x4e86('0x2e')]=qs[_0x4e86('0x2e')](_0x2d44f8['query'][_0x4e86('0x2e')]);}_0x575e23[_0x4e86('0x4f')]=qs['sort'](_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x50')]);_0x575e23[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_['pick'](_0x2d44f8[_0x4e86('0x49')],_0x7164f4['filters']));_0x575e23[_0x4e86('0x51')]['OpenchannelAccountId']=_0x4d26fe['id'];if(_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x54')]){_0x575e23['where']=_[_0x4e86('0x53')](_0x575e23['where'],{'$or':_[_0x4e86('0x41')](_0x575e23[_0x4e86('0x4b')],function(_0xa38c14){var _0xef9464={};_0xef9464[_0xa38c14]={'$like':'%'+_0x2d44f8[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0xef9464;})});}_0x575e23=_[_0x4e86('0x53')]({},_0x575e23,_0x2d44f8[_0x4e86('0x55')]);return db[_0x4e86('0x68')][_0x4e86('0x31')]({'where':_0x575e23[_0x4e86('0x51')]})['then'](function(_0x34b287){_0x4e38a2[_0x4e86('0x31')]=_0x34b287;if(_0x2d44f8['query']['includeAll']){_0x575e23[_0x4e86('0x57')]=[{'all':!![]}];}return db[_0x4e86('0x68')][_0x4e86('0x6b')](_0x575e23);})['then'](function(_0x17c7e8){_0x4e38a2['rows']=_0x17c7e8;return _0x4e38a2;});}})[_0x4e86('0x39')](respondWithFilteredResult(_0x3a6cac,_0x575e23))[_0x4e86('0x2a')](handleError(_0x3a6cac,null));};exports[_0x4e86('0x6c')]=function(_0x472c7c,_0x49747b,_0x1bf551){return db['OpenchannelAccount']['find']({'where':{'id':_0x472c7c[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x49747b,null))['then'](function(_0x167c8b){if(_0x167c8b){return _0x167c8b['removeDispositions'](_0x472c7c['query'][_0x4e86('0x6d')]);}})['then'](respondWithStatusCode(_0x49747b,null))[_0x4e86('0x2a')](handleError(_0x49747b,null));};exports['addAnswer']=function(_0xdfc441,_0xbbf2c9,_0x2c2fff){if(_0xdfc441[_0x4e86('0x5e')]['id']){delete _0xdfc441[_0x4e86('0x5e')]['id'];}return db[_0x4e86('0x42')]['find']({'where':{'id':_0xdfc441['params']['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0xbbf2c9,null))['then'](function(_0xce773f){if(_0xce773f){_0xdfc441[_0x4e86('0x5e')][_0x4e86('0x67')]=_0xce773f['id'];return db[_0x4e86('0x6e')]['create'](_0xdfc441[_0x4e86('0x5e')]);}})[_0x4e86('0x39')](respondWithResult(_0xbbf2c9,null))[_0x4e86('0x2a')](handleError(_0xbbf2c9,null));};exports[_0x4e86('0x6f')]=function(_0x136640,_0x2dda74,_0x3c1a97){var _0x536add={'raw':![],'where':{}};var _0x48fcb8={};var _0x598fd5={'count':0x0,'rows':[]};return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x136640[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x2dda74,null))[_0x4e86('0x39')](function(_0xbc621b){if(_0xbc621b){_0x48fcb8[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x6e')][_0x4e86('0x43')]);_0x48fcb8[_0x4e86('0x49')]=_['keys'](_0x136640[_0x4e86('0x49')]);_0x48fcb8[_0x4e86('0x52')]=_['intersection'](_0x48fcb8['model'],_0x48fcb8['query']);_0x536add[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x48fcb8[_0x4e86('0x47')],qs[_0x4e86('0x4c')](_0x136640['query']['fields']));_0x536add[_0x4e86('0x4b')]=_0x536add[_0x4e86('0x4b')]['length']?_0x536add[_0x4e86('0x4b')]:_0x48fcb8['model'];if(!_0x136640[_0x4e86('0x49')][_0x4e86('0x4d')]('nolimit')){_0x536add[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x136640[_0x4e86('0x49')][_0x4e86('0x30')]);_0x536add['offset']=qs[_0x4e86('0x2e')](_0x136640[_0x4e86('0x49')][_0x4e86('0x2e')]);}_0x536add[_0x4e86('0x4f')]=qs['sort'](_0x136640[_0x4e86('0x49')][_0x4e86('0x50')]);_0x536add[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_[_0x4e86('0x70')](_0x136640[_0x4e86('0x49')],_0x48fcb8['filters']));_0x536add[_0x4e86('0x51')][_0x4e86('0x67')]=_0xbc621b['id'];if(_0x136640[_0x4e86('0x49')][_0x4e86('0x54')]){_0x536add[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x536add[_0x4e86('0x51')],{'$or':_['map'](_0x536add[_0x4e86('0x4b')],function(_0x19503a){var _0xbf8e48={};_0xbf8e48[_0x19503a]={'$like':'%'+_0x136640[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0xbf8e48;})});}_0x536add=_['merge']({},_0x536add,_0x136640[_0x4e86('0x55')]);return db[_0x4e86('0x6e')]['count']({'where':_0x536add[_0x4e86('0x51')]})[_0x4e86('0x39')](function(_0xd1ee6e){_0x598fd5[_0x4e86('0x31')]=_0xd1ee6e;if(_0x136640['query'][_0x4e86('0x56')]){_0x536add[_0x4e86('0x57')]=[{'all':!![]}];}return db[_0x4e86('0x6e')][_0x4e86('0x6b')](_0x536add);})[_0x4e86('0x39')](function(_0x10f964){_0x598fd5['rows']=_0x10f964;return _0x598fd5;});}})[_0x4e86('0x39')](respondWithFilteredResult(_0x2dda74,_0x536add))[_0x4e86('0x2a')](handleError(_0x2dda74,null));};exports[_0x4e86('0x71')]=function(_0x4f110d,_0x52138d,_0x4fb90c){return db[_0x4e86('0x42')]['find']({'where':{'id':_0x4f110d[_0x4e86('0x65')]['id']}})['then'](handleEntityNotFound(_0x52138d,null))[_0x4e86('0x39')](function(_0x3fe738){if(_0x3fe738){return _0x3fe738[_0x4e86('0x71')](_0x4f110d['query'][_0x4e86('0x6d')]);}})[_0x4e86('0x39')](respondWithStatusCode(_0x52138d,null))[_0x4e86('0x2a')](handleError(_0x52138d,null));};exports[_0x4e86('0x72')]=function(_0x4e7fa0,_0x44fc44,_0x216959){var _0x143dad={'body':_0x4e7fa0[_0x4e86('0x5e')],'channel':_0x4e86('0x73')};var _0x440e8f=[];var _0x5edb6f=[];var _0xba1990={};var _0x5f57ea=![];return db[_0x4e86('0x74')][_0x4e86('0x66')]()[_0x4e86('0x39')](function(_0xb6b692){if(!_0xb6b692){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x440e8f=_['difference'](_[_0x4e86('0x48')](_0xb6b692),[_0x4e86('0x75'),_0x4e86('0x76')]);_0x5edb6f=_[_0x4e86('0x77')](_['keys'](_0xb6b692),[_0x4e86('0x75'),'updatedAt',_0x4e86('0x78'),'ListId']);if(_0x4e7fa0[_0x4e86('0x5e')]['id']){delete _0x4e7fa0[_0x4e86('0x5e')]['id'];}if(_[_0x4e86('0x79')](_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7a')])){throw new db[(_0x4e86('0x7b'))][(_0x4e86('0x7c'))](_0x4e86('0x7d'));}if(_['isNil'](_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x5e')])||_0x4e7fa0['body']['body']===''){throw new db[(_0x4e86('0x7b'))][(_0x4e86('0x7c'))](_0x4e86('0x7e'));}if(_[_0x4e86('0x79')](_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7f')])){throw new db['Sequelize']['ValidationError'](_0x4e86('0x80')+_0x5edb6f);}if(!_[_0x4e86('0x81')](_0x5edb6f,_0x4e7fa0[_0x4e86('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5edb6f);}_0xba1990[_0x4e7fa0[_0x4e86('0x5e')]['mapKey']]=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7a')];})[_0x4e86('0x39')](function(){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x4e7fa0['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4e86('0x74')],'as':_0x4e86('0x82'),'where':_0xba1990,'limit':0x1,'order':[[_0x4e86('0x76'),_0x4e86('0x83')]]}]},{'model':db[_0x4e86('0x84')],'as':_0x4e86('0x85')}]});})[_0x4e86('0x39')](handleEntityNotFound(_0x44fc44,null))[_0x4e86('0x39')](function(_0xb412e4){if(_0xb412e4&&_0xb412e4[_0x4e86('0x86')]){_0x143dad[_0x4e86('0x87')]=_0xb412e4;_0x143dad[_0x4e86('0x88')]=_0xb412e4['Applications'];_0x143dad[_0x4e86('0x89')]=_0xb412e4[_0x4e86('0x86')];_0x143dad[_0x4e86('0x88')]=_['orderBy'](_0x143dad['applications'],[_0x4e86('0x8a')],[_0x4e86('0x8b')]);if(_0x143dad[_0x4e86('0x87')][_0x4e86('0x85')]){delete _0x143dad[_0x4e86('0x87')][_0x4e86('0x85')];}if(_0x143dad['account']['List']&&_0x143dad['account'][_0x4e86('0x86')][_0x4e86('0x82')][_0x4e86('0x5b')]){return _0x143dad[_0x4e86('0x87')][_0x4e86('0x86')][_0x4e86('0x82')][0x0];}var _0x2812d2=_[_0x4e86('0x8c')](_0x4e7fa0[_0x4e86('0x5e')],{'firstName':_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x7a')],'ListId':_0xb412e4[_0x4e86('0x8d')]});_0x2812d2[_0x4e7fa0['body'][_0x4e86('0x7f')]]=_0x4e7fa0[_0x4e86('0x5e')]['from'];return db[_0x4e86('0x74')][_0x4e86('0x5d')](_0x2812d2,{'fields':_0x440e8f,'raw':!![]});}})[_0x4e86('0x39')](handleEntityNotFound(_0x44fc44,null))[_0x4e86('0x39')](function(_0x5d06f3){_0x143dad[_0x4e86('0x8e')]=_0x5d06f3;if(_0x5d06f3){var _0x5396ab={'ContactId':_0x5d06f3['id'],'OpenchannelAccountId':_0x4e7fa0[_0x4e86('0x65')]['id'],'from':(_0x5d06f3[_0x4e86('0x8f')]||'')+'\x20'+(_0x5d06f3[_0x4e86('0x90')]||'')};var _0x106a90={'OpenchannelAccountId':_0x4e7fa0[_0x4e86('0x65')]['id'],'closed':![]};if(_0x4e7fa0['body'][_0x4e86('0x91')]){_0x106a90[_0x4e86('0x91')]=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x91')];return db['OpenchannelInteraction']['find']({'where':_0x106a90})[_0x4e86('0x39')](function(_0x3593bf){if(_0x3593bf){return[_0x3593bf,![]];}_0x5396ab['threadId']=_0x4e7fa0['body'][_0x4e86('0x91')];_0x5396ab[_0x4e86('0x92')]=_0x4e7fa0[_0x4e86('0x5e')]['externalUrl'];return db[_0x4e86('0x93')][_0x4e86('0x5d')](_0x5396ab)[_0x4e86('0x39')](function(_0x16a25e){return[_0x16a25e,!![]];});});}else{_0x106a90['threadId']=null;}_0x106a90[_0x4e86('0x94')]=_0x5d06f3['id'];return db[_0x4e86('0x93')]['find']({'where':_0x106a90})['then'](function(_0x23b37b){if(_0x23b37b){return[_0x23b37b,![]];}return db[_0x4e86('0x93')][_0x4e86('0x5d')](_0x5396ab)[_0x4e86('0x39')](function(_0x188408){return[_0x188408,!![]];});});}})[_0x4e86('0x95')](function(_0x5ea112,_0x6645aa){if(_0x5ea112){_0x5f57ea=_0x6645aa;if(!_0x6645aa){var _0x10dc89={'from':(_0x143dad[_0x4e86('0x8e')][_0x4e86('0x8f')]||'')+'\x20'+(_0x143dad[_0x4e86('0x8e')][_0x4e86('0x90')]||'')};if(_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x91')]&&_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x96')]&&_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x91')]!=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x96')]){_0x10dc89[_0x4e86('0x91')]=_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x96')];}return _0x5ea112[_0x4e86('0x37')](_0x10dc89);}else{return _0x5ea112;}}})[_0x4e86('0x39')](function(_0x1dc21c){_0x143dad[_0x4e86('0x97')]=_0x1dc21c['get']({'plain':!![]});_0x143dad[_0x4e86('0x97')][_0x4e86('0x98')]=_0x5f57ea;if(_0x143dad['interaction'][_0x4e86('0x98')]){if(_0x143dad[_0x4e86('0x87')][_0x4e86('0x99')]){_0x143dad[_0x4e86('0x88')][_0x4e86('0x9a')]({'id':0x0,'priority':_0x143dad['applications'][_0x4e86('0x5b')]+0x1,'app':_0x4e86('0x9b'),'appdata':_0x4e86('0x9c'),'interval':_0x4e86('0x9d')});}}return db[_0x4e86('0x9e')][_0x4e86('0x5d')]({'body':_0x4e7fa0['body'][_0x4e86('0x5e')],'OpenchannelAccountId':_0x4e7fa0[_0x4e86('0x65')]['id'],'OpenchannelInteractionId':_0x1dc21c['id'],'direction':'in','ContactId':_0x143dad[_0x4e86('0x8e')]['id'],'AttachmentId':_0x4e7fa0[_0x4e86('0x5e')][_0x4e86('0x9f')]});})[_0x4e86('0x39')](function(_0x5bc912){_0x143dad[_0x4e86('0x26')]=_0x5bc912;if(!_0x143dad['interaction'][_0x4e86('0xa0')])return;return db[_0x4e86('0xa1')][_0x4e86('0x5c')]({'attributes':['id',_0x4e86('0x3e')],'where':{'id':_0x143dad[_0x4e86('0x97')][_0x4e86('0xa0')]}});})[_0x4e86('0x39')](function(_0x4535b9){if(_0x4535b9){_0x143dad[_0x4e86('0x88')][_0x4e86('0xa2')]({'id':0x0,'priority':0x0,'app':_0x4e86('0xa3'),'appdata':_0x4535b9[_0x4e86('0x3e')]+','+(_0x143dad['account'][_0x4e86('0xa4')]||0xa),'interval':_0x4e86('0x9d')});}if(!_0x143dad['interaction']['queueId'])return;return db[_0x4e86('0xa5')][_0x4e86('0x5c')]({'attributes':['id','name'],'where':{'id':_0x143dad[_0x4e86('0x97')][_0x4e86('0xa6')]}});})[_0x4e86('0x39')](function(_0x31791e){if(_0x31791e){_0x143dad[_0x4e86('0x88')][_0x4e86('0xa2')]({'id':0x0,'priority':0x1,'app':_0x4e86('0xa7'),'appdata':_0x31791e['name']+','+(_0x143dad[_0x4e86('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':_0x4e86('0x9d')});}return respondWithRpcPromise(_0x4e86('0xa8'),'startRouting',_0x143dad);})[_0x4e86('0x39')](function(_0x30073f){respondWithRpcPromise('EventManager','EventManager',{'event':_0x4e86('0x72'),'message':_0x30073f},client9002);return _0x30073f;})[_0x4e86('0x39')](respondWithResult(_0x44fc44,null))[_0x4e86('0x2a')](handleError(_0x44fc44,null));};exports['addApplications']=function(_0x264549,_0x4d6206){var _0x247b51=_0x264549['params']['id'];var _0x51d7b7=_0x264549[_0x4e86('0x5e')];var _0x37d50d=0xc8;var _0x5eed48=null;return db[_0x4e86('0xa9')]['transaction']({'isolationLevel':db[_0x4e86('0xa9')][_0x4e86('0xaa')]['ISOLATION_LEVELS'][_0x4e86('0xab')]},function(_0x4183c1){return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x247b51},'transaction':_0x4183c1})[_0x4e86('0x39')](function(_0x1ec902){if(_0x1ec902){return db[_0x4e86('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0x247b51},'transaction':_0x4183c1})[_0x4e86('0x39')](function(){var _0x1871b9=_[_0x4e86('0x41')](_0x51d7b7,function(_0x1e5fe6){_0x1e5fe6[_0x4e86('0x67')]=_0x247b51;return _0x1e5fe6;});return db[_0x4e86('0x84')]['bulkCreate'](_0x1871b9,{'transaction':_0x4183c1});});}else{_0x37d50d=0x194;_0x5eed48=[];}});})[_0x4e86('0x39')](function(){if(_0x37d50d!==0x194){return db[_0x4e86('0x84')][_0x4e86('0xac')]({'where':{'OpenchannelAccountId':_0x247b51},'order':'priority'})[_0x4e86('0x39')](function(_0x5291e7){_0x5eed48=_0x5291e7;});}})['catch'](function(_0x578028){_0x37d50d=0x1f4;logger[_0x4e86('0x24')](_0x578028[_0x4e86('0x3d')]);if(_0x578028[_0x4e86('0x3e')]){delete _0x578028[_0x4e86('0x3e')];}_0x5eed48=_0x578028;})[_0x4e86('0xad')](function(){if(_0x5eed48===null){_0x4d6206[_0x4e86('0x2b')](_0x37d50d);}else{if(_0x37d50d===0x1f4){_0x4d6206['status'](_0x37d50d)[_0x4e86('0xae')](_0x5eed48);}else{_0x4d6206[_0x4e86('0x2c')](_0x37d50d)['json'](_0x5eed48);}}});};exports[_0x4e86('0xaf')]=function(_0x466e23,_0x3edc6c,_0x331168){var _0x1e4da8={};var _0x334fcf={};var _0x5d2d23;var _0x1f44c3;return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x466e23['params']['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x3edc6c,null))['then'](function(_0x490713){if(_0x490713){_0x5d2d23=_0x490713;_0x334fcf[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x84')][_0x4e86('0x43')]);_0x334fcf[_0x4e86('0x49')]=_[_0x4e86('0x48')](_0x466e23[_0x4e86('0x49')]);_0x334fcf[_0x4e86('0x52')]=_['intersection'](_0x334fcf['model'],_0x334fcf[_0x4e86('0x49')]);_0x1e4da8['attributes']=_[_0x4e86('0x4a')](_0x334fcf[_0x4e86('0x47')],qs[_0x4e86('0x4c')](_0x466e23[_0x4e86('0x49')]['fields']));_0x1e4da8[_0x4e86('0x4b')]=_0x1e4da8[_0x4e86('0x4b')][_0x4e86('0x5b')]?_0x1e4da8['attributes']:_0x334fcf[_0x4e86('0x47')];_0x1e4da8[_0x4e86('0x4f')]=qs[_0x4e86('0x50')](_0x466e23[_0x4e86('0x49')][_0x4e86('0x50')]);_0x1e4da8['where']=qs[_0x4e86('0x52')](_[_0x4e86('0x70')](_0x466e23['query'],_0x334fcf[_0x4e86('0x52')]));if(_0x466e23['query'][_0x4e86('0x54')]){_0x1e4da8[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x1e4da8[_0x4e86('0x51')],{'$or':_['map'](_0x1e4da8[_0x4e86('0x4b')],function(_0x4c9540){var _0x452ad3={};_0x452ad3[_0x4c9540]={'$like':'%'+_0x466e23['query'][_0x4e86('0x54')]+'%'};return _0x452ad3;})});}_0x1e4da8=_['merge']({},_0x1e4da8,_0x466e23[_0x4e86('0x55')]);return _0x5d2d23[_0x4e86('0xaf')](_0x1e4da8);}})[_0x4e86('0x39')](function(_0x52228f){if(_0x52228f){_0x1f44c3=_0x52228f[_0x4e86('0x5b')];if(!_0x466e23[_0x4e86('0x49')][_0x4e86('0x4d')](_0x4e86('0x4e'))){_0x1e4da8[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x466e23[_0x4e86('0x49')][_0x4e86('0x30')]);_0x1e4da8[_0x4e86('0x2e')]=qs['offset'](_0x466e23['query'][_0x4e86('0x2e')]);}return _0x5d2d23[_0x4e86('0xaf')](_0x1e4da8);}})[_0x4e86('0x39')](function(_0x4d2bfe){if(_0x4d2bfe){return _0x4d2bfe?{'count':_0x1f44c3,'rows':_0x4d2bfe}:null;}})[_0x4e86('0x39')](respondWithResult(_0x3edc6c,null))[_0x4e86('0x2a')](handleError(_0x3edc6c,null));};exports[_0x4e86('0xb0')]=function(_0xb83cb5,_0x272bd2,_0x2438c8){var _0x1f9a42={'raw':![],'where':{}};var _0x4a42b0={};var _0x42f453={'count':0x0,'rows':[]};return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0xb83cb5[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x272bd2,null))[_0x4e86('0x39')](function(_0x50d2fa){if(_0x50d2fa){_0x4a42b0[_0x4e86('0x47')]=_[_0x4e86('0x48')](db[_0x4e86('0x93')][_0x4e86('0x43')]);_0x4a42b0['query']=_[_0x4e86('0x48')](_0xb83cb5[_0x4e86('0x49')]);_0x4a42b0['filters']=_[_0x4e86('0x4a')](_0x4a42b0['model'],_0x4a42b0[_0x4e86('0x49')]);_0x1f9a42[_0x4e86('0x4b')]=_[_0x4e86('0x4a')](_0x4a42b0['model'],qs['fields'](_0xb83cb5['query'][_0x4e86('0x4c')]));_0x1f9a42[_0x4e86('0x4b')]=_0x1f9a42['attributes'][_0x4e86('0x5b')]?_0x1f9a42[_0x4e86('0x4b')]:_0x4a42b0[_0x4e86('0x47')];if(!_0xb83cb5[_0x4e86('0x49')]['hasOwnProperty'](_0x4e86('0x4e'))){_0x1f9a42[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0xb83cb5[_0x4e86('0x49')]['limit']);_0x1f9a42['offset']=qs[_0x4e86('0x2e')](_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x2e')]);}_0x1f9a42[_0x4e86('0x4f')]=qs['sort'](_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x50')]);_0x1f9a42['where']=qs['filters'](_[_0x4e86('0x70')](_0xb83cb5[_0x4e86('0x49')],_0x4a42b0[_0x4e86('0x52')]));_0x1f9a42['where'][_0x4e86('0x67')]=_0x50d2fa['id'];if(_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x54')]){_0x1f9a42[_0x4e86('0x51')]=_['merge'](_0x1f9a42[_0x4e86('0x51')],{'$or':_['map'](_0x1f9a42[_0x4e86('0x4b')],function(_0x5d3d01){var _0x4e94cc={};_0x4e94cc[_0x5d3d01]={'$like':'%'+_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0x4e94cc;})});}_0x1f9a42=_[_0x4e86('0x53')]({},_0x1f9a42,_0xb83cb5[_0x4e86('0x55')]);return db[_0x4e86('0x93')][_0x4e86('0x31')]({'where':_0x1f9a42[_0x4e86('0x51')]})[_0x4e86('0x39')](function(_0x80e38a){_0x42f453['count']=_0x80e38a;if(_0xb83cb5[_0x4e86('0x49')][_0x4e86('0x56')]){_0x1f9a42[_0x4e86('0x57')]=[{'model':db[_0x4e86('0x74')],'as':_0x4e86('0xb1'),'required':![]},{'model':db['User'],'as':_0x4e86('0xb2'),'attributes':[_0x4e86('0x3e'),_0x4e86('0xb3'),_0x4e86('0xb4')],'required':![]},{'model':db[_0x4e86('0xb5')],'as':'Tags','attributes':['id',_0x4e86('0x3e'),_0x4e86('0xb6')],'where':_0xb83cb5[_0x4e86('0x49')][_0x4e86('0xb7')]?{'id':_0xb83cb5[_0x4e86('0x49')][_0x4e86('0xb7')]}:undefined,'required':_0xb83cb5[_0x4e86('0x49')][_0x4e86('0xb7')]?!![]:![]}];}return db[_0x4e86('0x93')][_0x4e86('0x6b')](_0x1f9a42);})[_0x4e86('0x39')](function(_0x3f13fc){_0x42f453[_0x4e86('0x58')]=_0x3f13fc;return _0x42f453;});}})['then'](respondWithFilteredResult(_0x272bd2,_0x1f9a42))['catch'](handleError(_0x272bd2,null));};exports[_0x4e86('0xb8')]=function(_0x1343bd,_0x305e2e,_0x3e3745){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x1343bd[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x305e2e,null))['then'](function(_0x3f4390){if(_0x3f4390){return _0x3f4390['addAgents'](_0x1343bd[_0x4e86('0x5e')]['ids'],_[_0x4e86('0xb9')](_0x1343bd['body'],['ids','id'])||{})['spread'](function(_0x5192a8){for(var _0x26889e=0x0;_0x26889e<_0x1343bd[_0x4e86('0x5e')][_0x4e86('0x6d')][_0x4e86('0x5b')];_0x26889e+=0x1){socket['emit'](_0x4e86('0xba'),{'UserId':Number(_0x1343bd[_0x4e86('0x5e')][_0x4e86('0x6d')][_0x26889e]),'OpenchannelAccountId':Number(_0x1343bd['params']['id'])});}return _0x5192a8;});}})['then'](respondWithResult(_0x305e2e,null))[_0x4e86('0x2a')](handleError(_0x305e2e,null));};exports[_0x4e86('0xbb')]=function(_0x59b742,_0x38d7b7,_0x37f0e2){return db['OpenchannelAccount'][_0x4e86('0x5c')]({'where':{'id':_0x59b742[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x38d7b7,null))[_0x4e86('0x39')](function(_0x2b7acd){if(_0x2b7acd){return _0x2b7acd[_0x4e86('0xbb')](_0x59b742[_0x4e86('0x49')][_0x4e86('0x6d')])[_0x4e86('0x39')](function(){if(_[_0x4e86('0xbc')](_0x59b742[_0x4e86('0x49')]['ids'])){for(var _0xabdfd8=0x0;_0xabdfd8<_0x59b742[_0x4e86('0x49')][_0x4e86('0x6d')][_0x4e86('0x5b')];_0xabdfd8+=0x1){socket[_0x4e86('0xbd')](_0x4e86('0xbe'),{'UserId':Number(_0x59b742[_0x4e86('0x49')][_0x4e86('0x6d')][_0xabdfd8]),'OpenchannelAccountId':Number(_0x59b742[_0x4e86('0x65')]['id'])});}}else{socket[_0x4e86('0xbd')]('userOpenchannelAccount:remove',{'UserId':Number(_0x59b742['query'][_0x4e86('0x6d')]),'OpenchannelAccountId':Number(_0x59b742[_0x4e86('0x65')]['id'])});}});}})[_0x4e86('0x39')](respondWithStatusCode(_0x38d7b7,null))[_0x4e86('0x2a')](handleError(_0x38d7b7,null));};exports[_0x4e86('0xbf')]=function(_0x59a6c7,_0x58ae84,_0x34f538){var _0x11db36={};var _0x52b8cf={};var _0x53a300;var _0xf119ed;return db[_0x4e86('0x42')][_0x4e86('0x6a')]({'where':{'id':_0x59a6c7[_0x4e86('0x65')]['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x58ae84,null))['then'](function(_0x2d463b){if(_0x2d463b){_0x53a300=_0x2d463b;_0x52b8cf['model']=_[_0x4e86('0x48')](db['User']['rawAttributes']);_0x52b8cf['query']=_[_0x4e86('0x48')](_0x59a6c7['query']);_0x52b8cf[_0x4e86('0x52')]=_['intersection'](_0x52b8cf[_0x4e86('0x47')],_0x52b8cf[_0x4e86('0x49')]);_0x11db36['attributes']=_[_0x4e86('0x4a')](_0x52b8cf['model'],qs[_0x4e86('0x4c')](_0x59a6c7['query'][_0x4e86('0x4c')]));_0x11db36['attributes']=_0x11db36[_0x4e86('0x4b')][_0x4e86('0x5b')]?_0x11db36[_0x4e86('0x4b')]:_0x52b8cf[_0x4e86('0x47')];_0x11db36[_0x4e86('0x4f')]=qs[_0x4e86('0x50')](_0x59a6c7[_0x4e86('0x49')][_0x4e86('0x50')]);_0x11db36[_0x4e86('0x51')]=qs[_0x4e86('0x52')](_[_0x4e86('0x70')](_0x59a6c7[_0x4e86('0x49')],_0x52b8cf[_0x4e86('0x52')]));if(_0x59a6c7[_0x4e86('0x49')][_0x4e86('0x54')]){_0x11db36[_0x4e86('0x51')]=_[_0x4e86('0x53')](_0x11db36[_0x4e86('0x51')],{'$or':_[_0x4e86('0x41')](_0x11db36[_0x4e86('0x4b')],function(_0x28146e){var _0x24dab3={};_0x24dab3[_0x28146e]={'$like':'%'+_0x59a6c7[_0x4e86('0x49')][_0x4e86('0x54')]+'%'};return _0x24dab3;})});}_0x11db36=_['merge']({},_0x11db36,_0x59a6c7[_0x4e86('0x55')]);return _0x53a300[_0x4e86('0xbf')](_0x11db36);}})[_0x4e86('0x39')](function(_0x132d5e){if(_0x132d5e){_0xf119ed=_0x132d5e[_0x4e86('0x5b')];if(!_0x59a6c7[_0x4e86('0x49')]['hasOwnProperty']('nolimit')){_0x11db36[_0x4e86('0x30')]=qs[_0x4e86('0x30')](_0x59a6c7[_0x4e86('0x49')]['limit']);_0x11db36['offset']=qs[_0x4e86('0x2e')](_0x59a6c7[_0x4e86('0x49')]['offset']);}return _0x53a300[_0x4e86('0xbf')](_0x11db36);}})['then'](function(_0x591eb2){if(_0x591eb2){return _0x591eb2?{'count':_0xf119ed,'rows':_0x591eb2}:null;}})[_0x4e86('0x39')](respondWithResult(_0x58ae84,null))[_0x4e86('0x2a')](handleError(_0x58ae84,null));};exports[_0x4e86('0xae')]=function(_0x1eeb0e,_0x2592f6,_0x267405){var _0x442f02,_0x54a282,_0x57fdae;if(_[_0x4e86('0x79')](_0x1eeb0e['body'][_0x4e86('0x5e')])||_0x1eeb0e[_0x4e86('0x5e')][_0x4e86('0x5e')]===''){throw new db['Sequelize'][(_0x4e86('0x7c'))](_0x4e86('0x7e'));}if(_[_0x4e86('0x79')](_0x1eeb0e['body']['to'])){}_0x442f02=_0x1eeb0e[_0x4e86('0x5e')]['to'];return db['OpenchannelAccount'][_0x4e86('0x6a')]({'where':{'id':_0x1eeb0e['params']['id']}})[_0x4e86('0x39')](handleEntityNotFound(_0x2592f6,null))[_0x4e86('0x39')](function(_0x408ee5){if(_0x408ee5){return db[_0x4e86('0x42')][_0x4e86('0x5c')]({'where':{'id':_0x408ee5['id']},'include':[{'model':db['CmList'],'as':_0x4e86('0x86'),'include':[{'model':db[_0x4e86('0x74')],'as':_0x4e86('0x82'),'where':{[_0x408ee5[_0x4e86('0x7f')]]:_0x442f02},'limit':0x1,'order':[['updatedAt',_0x4e86('0x83')]]}]}]})[_0x4e86('0x39')](handleEntityNotFound(_0x2592f6,null))[_0x4e86('0x39')](function(_0x190153){if(_0x190153&&_0x190153[_0x4e86('0x86')]){_0x54a282=_0x190153[_0x4e86('0x3a')]({'plain':!![]});if(_0x54a282['List']&&_0x54a282[_0x4e86('0x86')]['Contacts'][_0x4e86('0x5b')]){return _0x54a282['List']['Contacts'][0x0];}return db['CmContact'][_0x4e86('0x5d')](_['defaults'](_0x1eeb0e[_0x4e86('0x5e')],{'firstName':_0x442f02,[_0x190153[_0x4e86('0x7f')]]:_0x442f02,'phone':_0x442f02,'ListId':_0x54a282[_0x4e86('0x8d')]}));}})[_0x4e86('0x39')](handleEntityNotFound(_0x2592f6,null))[_0x4e86('0x39')](function(_0x3750e){if(_0x3750e){_0x57fdae=_0x3750e;return db['OpenchannelInteraction'][_0x4e86('0x5c')]({'where':{'ContactId':_0x57fdae['id'],'closed':![],'OpenchannelAccountId':_0x54a282['id']}})[_0x4e86('0x39')](function(_0x296bc0){if(_0x296bc0){return[_0x296bc0,![]];}return db['OpenchannelInteraction'][_0x4e86('0x5d')]({'UserId':_0x1eeb0e['user']['id'],'ContactId':_0x57fdae['id'],'OpenchannelAccountId':_0x54a282['id'],'lastMsgDirection':_0x4e86('0xc0'),'firstMsgDirection':_0x4e86('0xc0'),'Messages':[_[_0x4e86('0x53')](_0x1eeb0e[_0x4e86('0x5e')],{'read':![],'body':_0x1eeb0e[_0x4e86('0x5e')][_0x4e86('0x5e')],'OpenchannelAccountId':_0x54a282['id'],'UserId':_0x1eeb0e[_0x4e86('0x5f')]['id'],'ContactId':_0x57fdae['id']})]},{'include':[{'model':db[_0x4e86('0x9e')],'as':_0x4e86('0xc1')}]})['then'](function(_0x1fe947){return[_0x1fe947,!![]];});});}})[_0x4e86('0x95')](function(_0xcb9fcf,_0x29bae9){if(_0x29bae9){return _0xcb9fcf;}return db[_0x4e86('0x9e')][_0x4e86('0x5d')](_[_0x4e86('0x53')](_0x1eeb0e[_0x4e86('0x5e')],{'read':![],'body':_0x1eeb0e[_0x4e86('0x5e')]['body'],'OpenchannelAccountId':_0x54a282['id'],'OpenchannelInteractionId':_0xcb9fcf['id'],'UserId':_0x1eeb0e[_0x4e86('0x5f')]['id'],'ContactId':_0x57fdae['id']}))[_0x4e86('0x39')](function(_0xe8215a){_0xcb9fcf[_0x4e86('0xc2')][_0x4e86('0xc1')]=[];_0xcb9fcf[_0x4e86('0xc2')][_0x4e86('0xc1')][_0x4e86('0x9a')](_0xe8215a['dataValues']);return _0xcb9fcf;});});}})['then'](respondWithResult(_0x2592f6,null))[_0x4e86('0x2a')](handleError(_0x2592f6,null));}; \ No newline at end of file +var _0xad78=['Content-Range','json','apply','reject','save','update','get','UserProfileResource','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','autoAssociation','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','updatedAt','OpenchannelApplication','Applications','account','applications','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','OpenchannelMessage','contact','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','getApplications','getInteractions','Contact','fullname','Tags','color','tag','addAgents','omit','removeAgents','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','user','out','Messages','dataValues','push','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','request','then','debug','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','offset','count','limit'];(function(_0x2e7b74,_0x5e2967){var _0x27375b=function(_0x3c63d0){while(--_0x3c63d0){_0x2e7b74['push'](_0x2e7b74['shift']());}};_0x27375b(++_0x5e2967);}(_0xad78,0x149));var _0x8ad7=function(_0x251dcb,_0x557ba1){_0x251dcb=_0x251dcb-0x0;var _0xb15320=_0xad78[_0x251dcb];return _0xb15320;};'use strict';var emlformat=require(_0x8ad7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ad7('0x1'));var rp=require(_0x8ad7('0x2'));var moment=require('moment');var BPromise=require(_0x8ad7('0x3'));var Mustache=require(_0x8ad7('0x4'));var util=require(_0x8ad7('0x5'));var path=require(_0x8ad7('0x6'));var sox=require(_0x8ad7('0x7'));var csv=require(_0x8ad7('0x8'));var ejs=require(_0x8ad7('0x9'));var fs=require('fs');var fs_extra=require(_0x8ad7('0xa'));var _=require(_0x8ad7('0xb'));var squel=require(_0x8ad7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ad7('0xd'));var toCsv=require(_0x8ad7('0x8'));var querystring=require(_0x8ad7('0xe'));var Papa=require(_0x8ad7('0xf'));var Redis=require(_0x8ad7('0x10'));var authService=require(_0x8ad7('0x11'));var qs=require(_0x8ad7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ad7('0x13'));var logger=require(_0x8ad7('0x14'))(_0x8ad7('0x15'));var utils=require('../../config/utils');var config=require(_0x8ad7('0x16'));var licenseUtil=require(_0x8ad7('0x17'));var db=require(_0x8ad7('0x18'))['db'];config[_0x8ad7('0x19')]=_[_0x8ad7('0x1a')](config[_0x8ad7('0x19')],{'host':_0x8ad7('0x1b'),'port':0x18eb});var socket=require(_0x8ad7('0x1c'))(new Redis(config[_0x8ad7('0x19')]));require(_0x8ad7('0x1d'))[_0x8ad7('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8ad7('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x8ad7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e18f4,_0x5da84e,_0x51ead4,_0x2d17a0){return new BPromise(function(_0x1607c9,_0x43914a){var _0x429dd1=_0x2d17a0||client;return _0x429dd1[_0x8ad7('0x20')](_0x3e18f4,_0x51ead4)[_0x8ad7('0x21')](function(_0x937333){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5da84e,'request\x20sent');logger[_0x8ad7('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5da84e,_0x8ad7('0x23'),JSON[_0x8ad7('0x24')](_0x937333));if(_0x937333[_0x8ad7('0x25')]){if(_0x937333['error']['code']===0x1f4){logger['error'](_0x8ad7('0x26'),_0x5da84e,_0x937333['error']['message']);return _0x43914a(_0x937333[_0x8ad7('0x25')][_0x8ad7('0x27')]);}logger[_0x8ad7('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x5da84e,_0x937333[_0x8ad7('0x25')][_0x8ad7('0x27')]);return _0x1607c9(_0x937333[_0x8ad7('0x25')][_0x8ad7('0x27')]);}else{logger[_0x8ad7('0x28')](_0x8ad7('0x26'),_0x5da84e,'request\x20sent');_0x1607c9(_0x937333[_0x8ad7('0x29')][_0x8ad7('0x27')]);}})['catch'](function(_0xa79077){logger[_0x8ad7('0x25')](_0x8ad7('0x26'),_0x5da84e,_0xa79077);_0x43914a(_0xa79077);});});}function respondWithStatusCode(_0x42c112,_0x1b7e0a){_0x1b7e0a=_0x1b7e0a||0xcc;return function(_0x1abf2c){if(_0x1abf2c){return _0x42c112[_0x8ad7('0x2a')](_0x1b7e0a);}return _0x42c112['status'](_0x1b7e0a)['end']();};}function respondWithResult(_0x2c10a7,_0x5253c0){_0x5253c0=_0x5253c0||0xc8;return function(_0x3febc1){if(_0x3febc1){return _0x2c10a7[_0x8ad7('0x2b')](_0x5253c0)['json'](_0x3febc1);}};}function respondWithFilteredResult(_0x27bbcb,_0x353578){return function(_0x2d8d7){if(_0x2d8d7){var _0x4f419f=typeof _0x353578[_0x8ad7('0x2c')]==='undefined'&&typeof _0x353578['limit']==='undefined';var _0x46dc32=_0x2d8d7[_0x8ad7('0x2d')];var _0x123b6c=_0x4f419f?0x0:_0x353578[_0x8ad7('0x2c')];var _0x3fd891=_0x4f419f?_0x2d8d7[_0x8ad7('0x2d')]:_0x353578[_0x8ad7('0x2c')]+_0x353578[_0x8ad7('0x2e')];var _0x363a15;if(_0x3fd891>=_0x46dc32){_0x3fd891=_0x46dc32;_0x363a15=0xc8;}else{_0x363a15=0xce;}_0x27bbcb[_0x8ad7('0x2b')](_0x363a15);return _0x27bbcb['set'](_0x8ad7('0x2f'),_0x123b6c+'-'+_0x3fd891+'/'+_0x46dc32)[_0x8ad7('0x30')](_0x2d8d7);}return null;};}function patchUpdates(_0x10ff0e){return function(_0x5d1ab9){try{jsonpatch[_0x8ad7('0x31')](_0x5d1ab9,_0x10ff0e,!![]);}catch(_0x172663){return BPromise[_0x8ad7('0x32')](_0x172663);}return _0x5d1ab9[_0x8ad7('0x33')]();};}function saveUpdates(_0x240ac3,_0x1531a2){return function(_0x561e43){if(_0x561e43){return _0x561e43[_0x8ad7('0x34')](_0x240ac3)['then'](function(_0x2ee0d6){return _0x2ee0d6;});}return null;};}function removeEntity(_0x38b99d,_0x155ac1){return function(_0x651189){if(_0x651189){return _0x651189['destroy']()['then'](function(){var _0x389115=_0x651189[_0x8ad7('0x35')]({'plain':!![]});var _0x2ccfa0='OpenchannelAccounts';return db[_0x8ad7('0x36')][_0x8ad7('0x37')]({'where':{'type':_0x2ccfa0,'resourceId':_0x389115['id']}})[_0x8ad7('0x21')](function(){return _0x651189;});})[_0x8ad7('0x21')](function(){_0x38b99d[_0x8ad7('0x2b')](0xcc)[_0x8ad7('0x38')]();});}};}function handleEntityNotFound(_0x4bef50,_0x21ae38){return function(_0x4a3368){if(!_0x4a3368){_0x4bef50['sendStatus'](0x194);}return _0x4a3368;};}function handleError(_0x3ece0f,_0x57925f){_0x57925f=_0x57925f||0x1f4;return function(_0xc378c){logger[_0x8ad7('0x25')](_0xc378c[_0x8ad7('0x39')]);if(_0xc378c['name']){delete _0xc378c[_0x8ad7('0x3a')];}_0x3ece0f[_0x8ad7('0x2b')](_0x57925f)[_0x8ad7('0x3b')](_0xc378c);};}exports[_0x8ad7('0x3c')]=function(_0x3115eb,_0x384dc7){var _0x272c5b={'include':[{'model':db[_0x8ad7('0x3d')],'as':_0x8ad7('0x3e')}]},_0x5efc7f={},_0x299d35={'count':0x0,'rows':[]};var _0x16f91b=_[_0x8ad7('0x3f')](db[_0x8ad7('0x40')][_0x8ad7('0x41')],function(_0x467949){return{'name':_0x467949[_0x8ad7('0x42')],'type':_0x467949['type'][_0x8ad7('0x43')]};});_0x5efc7f['model']=_[_0x8ad7('0x3f')](_0x16f91b,_0x8ad7('0x3a'));_0x5efc7f['query']=_['keys'](_0x3115eb[_0x8ad7('0x44')]);_0x5efc7f[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x5efc7f[_0x8ad7('0x47')],_0x5efc7f[_0x8ad7('0x44')]);_0x272c5b[_0x8ad7('0x48')]=_[_0x8ad7('0x46')](_0x5efc7f[_0x8ad7('0x47')],qs['fields'](_0x3115eb[_0x8ad7('0x44')]['fields']));_0x272c5b[_0x8ad7('0x48')]=_0x272c5b['attributes'][_0x8ad7('0x49')]?_0x272c5b[_0x8ad7('0x48')]:_0x5efc7f[_0x8ad7('0x47')];if(!_0x3115eb[_0x8ad7('0x44')]['hasOwnProperty'](_0x8ad7('0x4a'))){_0x272c5b[_0x8ad7('0x2e')]=qs[_0x8ad7('0x2e')](_0x3115eb[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x272c5b[_0x8ad7('0x2c')]=qs['offset'](_0x3115eb['query'][_0x8ad7('0x2c')]);}_0x272c5b[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x3115eb['query'][_0x8ad7('0x4c')]);_0x272c5b[_0x8ad7('0x4d')]=qs[_0x8ad7('0x45')](_[_0x8ad7('0x4e')](_0x3115eb[_0x8ad7('0x44')],_0x5efc7f[_0x8ad7('0x45')]),_0x16f91b);if(_0x3115eb[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x272c5b[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x272c5b[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x16f91b,function(_0x9cd4e9){if(_0x9cd4e9[_0x8ad7('0x51')]!=='VIRTUAL'){var _0x572d73={};_0x572d73[_0x9cd4e9[_0x8ad7('0x3a')]]={'$like':'%'+_0x3115eb[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0x572d73;}})});}_0x272c5b=_['merge']({},_0x272c5b,_0x3115eb[_0x8ad7('0x52')]);var _0x5c2ce5={'where':_0x272c5b[_0x8ad7('0x4d')]};return db[_0x8ad7('0x40')][_0x8ad7('0x2d')](_0x5c2ce5)[_0x8ad7('0x21')](function(_0x9a7d51){_0x299d35['count']=_0x9a7d51;if(_0x3115eb['query'][_0x8ad7('0x53')]){_0x272c5b[_0x8ad7('0x54')]=[{'all':!![]}];}return db[_0x8ad7('0x40')][_0x8ad7('0x55')](_0x272c5b);})['then'](function(_0x26144f){_0x299d35[_0x8ad7('0x56')]=_0x26144f;return _0x299d35;})[_0x8ad7('0x21')](respondWithFilteredResult(_0x384dc7,_0x272c5b))['catch'](handleError(_0x384dc7,null));};exports[_0x8ad7('0x57')]=function(_0x3a66af,_0x3aa0da){var _0xc7d194={'raw':![],'where':{'id':_0x3a66af[_0x8ad7('0x58')]['id']},'include':[{'model':db[_0x8ad7('0x3d')],'as':_0x8ad7('0x3e')}]},_0x11cdfa={};_0x11cdfa[_0x8ad7('0x47')]=_[_0x8ad7('0x59')](db[_0x8ad7('0x40')][_0x8ad7('0x41')]);_0x11cdfa[_0x8ad7('0x44')]=_['keys'](_0x3a66af[_0x8ad7('0x44')]);_0x11cdfa[_0x8ad7('0x45')]=_['intersection'](_0x11cdfa[_0x8ad7('0x47')],_0x11cdfa[_0x8ad7('0x44')]);_0xc7d194[_0x8ad7('0x48')]=_['intersection'](_0x11cdfa[_0x8ad7('0x47')],qs[_0x8ad7('0x5a')](_0x3a66af[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0xc7d194[_0x8ad7('0x48')]=_0xc7d194['attributes'][_0x8ad7('0x49')]?_0xc7d194[_0x8ad7('0x48')]:_0x11cdfa[_0x8ad7('0x47')];if(_0x3a66af[_0x8ad7('0x44')][_0x8ad7('0x53')]){_0xc7d194['include']=[{'all':!![]}];}_0xc7d194=_[_0x8ad7('0x50')]({},_0xc7d194,_0x3a66af['options']);return db[_0x8ad7('0x40')][_0x8ad7('0x5b')](_0xc7d194)['then'](handleEntityNotFound(_0x3aa0da,null))[_0x8ad7('0x21')](respondWithResult(_0x3aa0da,null))[_0x8ad7('0x5c')](handleError(_0x3aa0da,null));};exports[_0x8ad7('0x5d')]=function(_0x54c000,_0x1893c4){return db['OpenchannelAccount']['create'](_0x54c000[_0x8ad7('0x5e')],{})[_0x8ad7('0x21')](function(_0x98e996){var _0x4a51e1=_0x54c000['user']['get']({'plain':!![]});if(!_0x4a51e1)throw new Error(_0x8ad7('0x5f'));if(_0x4a51e1['role']==='user'){var _0x49660d=_0x98e996[_0x8ad7('0x35')]({'plain':!![]});var _0x45dc30=_0x8ad7('0x60');return db[_0x8ad7('0x61')][_0x8ad7('0x5b')]({'where':{'name':_0x45dc30,'userProfileId':_0x4a51e1['userProfileId']},'raw':!![]})[_0x8ad7('0x21')](function(_0x1528d0){if(_0x1528d0&&_0x1528d0[_0x8ad7('0x62')]===0x0){return db['UserProfileResource'][_0x8ad7('0x5d')]({'name':_0x49660d[_0x8ad7('0x3a')],'resourceId':_0x49660d['id'],'type':_0x1528d0['name'],'sectionId':_0x1528d0['id']},{})[_0x8ad7('0x21')](function(){return _0x98e996;});}else{return _0x98e996;}})[_0x8ad7('0x5c')](function(_0x3a7a02){logger[_0x8ad7('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a7a02);throw _0x3a7a02;});}return _0x98e996;})['then'](respondWithResult(_0x1893c4,0xc9))[_0x8ad7('0x5c')](handleError(_0x1893c4,null));};exports['update']=function(_0x20f7af,_0x47d8d3){if(_0x20f7af[_0x8ad7('0x5e')]['id']){delete _0x20f7af[_0x8ad7('0x5e')]['id'];}return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x20f7af[_0x8ad7('0x58')]['id']},'include':[{'model':db[_0x8ad7('0x3d')],'as':_0x8ad7('0x3e')}]})[_0x8ad7('0x21')](handleEntityNotFound(_0x47d8d3,null))[_0x8ad7('0x21')](saveUpdates(_0x20f7af[_0x8ad7('0x5e')],null))[_0x8ad7('0x21')](respondWithResult(_0x47d8d3,null))[_0x8ad7('0x5c')](handleError(_0x47d8d3,null));};exports['destroy']=function(_0x2adbcd,_0x4f489f){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x2adbcd['params']['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x4f489f,null))[_0x8ad7('0x21')](removeEntity(_0x4f489f,null))[_0x8ad7('0x5c')](handleError(_0x4f489f,null));};exports['describe']=function(_0x570923,_0x4b4052){return db[_0x8ad7('0x40')]['describe']()['then'](respondWithResult(_0x4b4052,null))[_0x8ad7('0x5c')](handleError(_0x4b4052,null));};exports[_0x8ad7('0x63')]=function(_0x4214b5,_0x386798,_0x456747){if(_0x4214b5[_0x8ad7('0x5e')]['id']){delete _0x4214b5[_0x8ad7('0x5e')]['id'];}return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x4214b5[_0x8ad7('0x58')]['id']}})['then'](handleEntityNotFound(_0x386798,null))[_0x8ad7('0x21')](function(_0x50d0bc){if(_0x50d0bc){_0x4214b5['body'][_0x8ad7('0x64')]=_0x50d0bc['id'];return db[_0x8ad7('0x65')]['create'](_0x4214b5[_0x8ad7('0x5e')]);}})[_0x8ad7('0x21')](respondWithResult(_0x386798,null))[_0x8ad7('0x5c')](handleError(_0x386798,null));};exports[_0x8ad7('0x66')]=function(_0x3b7884,_0xe6fde3,_0x213513){var _0x181c4e={'raw':![],'where':{}};var _0x5d7b45={};var _0x4f1aef={'count':0x0,'rows':[]};return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x3b7884[_0x8ad7('0x58')]['id']}})['then'](handleEntityNotFound(_0xe6fde3,null))[_0x8ad7('0x21')](function(_0x3e66fc){if(_0x3e66fc){_0x5d7b45[_0x8ad7('0x47')]=_[_0x8ad7('0x59')](db[_0x8ad7('0x65')][_0x8ad7('0x41')]);_0x5d7b45['query']=_[_0x8ad7('0x59')](_0x3b7884['query']);_0x5d7b45[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x5d7b45['model'],_0x5d7b45[_0x8ad7('0x44')]);_0x181c4e[_0x8ad7('0x48')]=_['intersection'](_0x5d7b45['model'],qs[_0x8ad7('0x5a')](_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x181c4e['attributes']=_0x181c4e[_0x8ad7('0x48')][_0x8ad7('0x49')]?_0x181c4e['attributes']:_0x5d7b45[_0x8ad7('0x47')];if(!_0x3b7884['query'][_0x8ad7('0x68')]('nolimit')){_0x181c4e[_0x8ad7('0x2e')]=qs[_0x8ad7('0x2e')](_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x181c4e[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x2c')]);}_0x181c4e[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x3b7884['query'][_0x8ad7('0x4c')]);_0x181c4e['where']=qs[_0x8ad7('0x45')](_['pick'](_0x3b7884[_0x8ad7('0x44')],_0x5d7b45['filters']));_0x181c4e[_0x8ad7('0x4d')]['OpenchannelAccountId']=_0x3e66fc['id'];if(_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x181c4e[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x181c4e[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x181c4e[_0x8ad7('0x48')],function(_0x3e7d84){var _0xade492={};_0xade492[_0x3e7d84]={'$like':'%'+_0x3b7884[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0xade492;})});}_0x181c4e=_['merge']({},_0x181c4e,_0x3b7884[_0x8ad7('0x52')]);return db[_0x8ad7('0x65')][_0x8ad7('0x2d')]({'where':_0x181c4e[_0x8ad7('0x4d')]})[_0x8ad7('0x21')](function(_0x50eadc){_0x4f1aef[_0x8ad7('0x2d')]=_0x50eadc;if(_0x3b7884[_0x8ad7('0x44')]['includeAll']){_0x181c4e[_0x8ad7('0x54')]=[{'all':!![]}];}return db[_0x8ad7('0x65')][_0x8ad7('0x55')](_0x181c4e);})['then'](function(_0x54638a){_0x4f1aef['rows']=_0x54638a;return _0x4f1aef;});}})[_0x8ad7('0x21')](respondWithFilteredResult(_0xe6fde3,_0x181c4e))[_0x8ad7('0x5c')](handleError(_0xe6fde3,null));};exports[_0x8ad7('0x69')]=function(_0x228a55,_0x32935e,_0x330a8b){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x228a55['params']['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x32935e,null))[_0x8ad7('0x21')](function(_0x53c7af){if(_0x53c7af){return _0x53c7af[_0x8ad7('0x69')](_0x228a55[_0x8ad7('0x44')][_0x8ad7('0x6a')]);}})['then'](respondWithStatusCode(_0x32935e,null))[_0x8ad7('0x5c')](handleError(_0x32935e,null));};exports[_0x8ad7('0x6b')]=function(_0x5e3599,_0x245a57,_0x5257ec){if(_0x5e3599['body']['id']){delete _0x5e3599[_0x8ad7('0x5e')]['id'];}return db[_0x8ad7('0x40')]['find']({'where':{'id':_0x5e3599[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x245a57,null))[_0x8ad7('0x21')](function(_0x87f027){if(_0x87f027){_0x5e3599[_0x8ad7('0x5e')][_0x8ad7('0x64')]=_0x87f027['id'];return db[_0x8ad7('0x6c')][_0x8ad7('0x5d')](_0x5e3599['body']);}})[_0x8ad7('0x21')](respondWithResult(_0x245a57,null))[_0x8ad7('0x5c')](handleError(_0x245a57,null));};exports['getAnswers']=function(_0x34ef34,_0x2294b6,_0xd016a0){var _0x1a487d={'raw':![],'where':{}};var _0x1d7a41={};var _0x37fd80={'count':0x0,'rows':[]};return db[_0x8ad7('0x40')]['findOne']({'where':{'id':_0x34ef34[_0x8ad7('0x58')]['id']}})['then'](handleEntityNotFound(_0x2294b6,null))[_0x8ad7('0x21')](function(_0x4c1339){if(_0x4c1339){_0x1d7a41['model']=_[_0x8ad7('0x59')](db[_0x8ad7('0x6c')][_0x8ad7('0x41')]);_0x1d7a41[_0x8ad7('0x44')]=_[_0x8ad7('0x59')](_0x34ef34['query']);_0x1d7a41[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x1d7a41[_0x8ad7('0x47')],_0x1d7a41[_0x8ad7('0x44')]);_0x1a487d[_0x8ad7('0x48')]=_['intersection'](_0x1d7a41[_0x8ad7('0x47')],qs['fields'](_0x34ef34[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x1a487d[_0x8ad7('0x48')]=_0x1a487d['attributes'][_0x8ad7('0x49')]?_0x1a487d[_0x8ad7('0x48')]:_0x1d7a41[_0x8ad7('0x47')];if(!_0x34ef34['query'][_0x8ad7('0x68')]('nolimit')){_0x1a487d[_0x8ad7('0x2e')]=qs[_0x8ad7('0x2e')](_0x34ef34[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x1a487d[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x34ef34[_0x8ad7('0x44')]['offset']);}_0x1a487d[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x34ef34[_0x8ad7('0x44')]['sort']);_0x1a487d[_0x8ad7('0x4d')]=qs[_0x8ad7('0x45')](_[_0x8ad7('0x4e')](_0x34ef34[_0x8ad7('0x44')],_0x1d7a41['filters']));_0x1a487d[_0x8ad7('0x4d')][_0x8ad7('0x64')]=_0x4c1339['id'];if(_0x34ef34['query'][_0x8ad7('0x4f')]){_0x1a487d[_0x8ad7('0x4d')]=_['merge'](_0x1a487d[_0x8ad7('0x4d')],{'$or':_['map'](_0x1a487d[_0x8ad7('0x48')],function(_0x2a8bac){var _0x4da6e5={};_0x4da6e5[_0x2a8bac]={'$like':'%'+_0x34ef34[_0x8ad7('0x44')]['filter']+'%'};return _0x4da6e5;})});}_0x1a487d=_[_0x8ad7('0x50')]({},_0x1a487d,_0x34ef34[_0x8ad7('0x52')]);return db['CannedAnswer'][_0x8ad7('0x2d')]({'where':_0x1a487d[_0x8ad7('0x4d')]})[_0x8ad7('0x21')](function(_0x19f436){_0x37fd80[_0x8ad7('0x2d')]=_0x19f436;if(_0x34ef34[_0x8ad7('0x44')][_0x8ad7('0x53')]){_0x1a487d[_0x8ad7('0x54')]=[{'all':!![]}];}return db[_0x8ad7('0x6c')][_0x8ad7('0x55')](_0x1a487d);})[_0x8ad7('0x21')](function(_0x647e0a){_0x37fd80[_0x8ad7('0x56')]=_0x647e0a;return _0x37fd80;});}})[_0x8ad7('0x21')](respondWithFilteredResult(_0x2294b6,_0x1a487d))[_0x8ad7('0x5c')](handleError(_0x2294b6,null));};exports[_0x8ad7('0x6d')]=function(_0xcfa1c7,_0x1e5268,_0x342114){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0xcfa1c7['params']['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x1e5268,null))['then'](function(_0x5b4b42){if(_0x5b4b42){return _0x5b4b42[_0x8ad7('0x6d')](_0xcfa1c7[_0x8ad7('0x44')]['ids']);}})[_0x8ad7('0x21')](respondWithStatusCode(_0x1e5268,null))[_0x8ad7('0x5c')](handleError(_0x1e5268,null));};exports[_0x8ad7('0x6e')]=function(_0x530b29,_0x51e021,_0x30ac56){var _0x15464b={'body':_0x530b29[_0x8ad7('0x5e')],'channel':_0x8ad7('0x6f')};var _0x493f6e=[];var _0x6efd23=[];var _0x223259={};var _0x444b40=![];return db[_0x8ad7('0x70')]['describe']()[_0x8ad7('0x21')](function(_0x1815ef){if(!_0x1815ef){throw new db[(_0x8ad7('0x71'))]['ValidationError']('no\x20available\x20attributes');}_0x493f6e=_[_0x8ad7('0x72')](_['keys'](_0x1815ef),['createdAt','updatedAt']);_0x6efd23=_[_0x8ad7('0x72')](_[_0x8ad7('0x59')](_0x1815ef),['createdAt','updatedAt',_0x8ad7('0x73'),_0x8ad7('0x74')]);if(_0x530b29[_0x8ad7('0x5e')]['id']){delete _0x530b29[_0x8ad7('0x5e')]['id'];}if(_[_0x8ad7('0x75')](_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x76')])){throw new db[(_0x8ad7('0x71'))][(_0x8ad7('0x77'))](_0x8ad7('0x78'));}if(_[_0x8ad7('0x75')](_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x5e')])||_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x5e')]===''){throw new db[(_0x8ad7('0x71'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8ad7('0x75')](_0x530b29['body'][_0x8ad7('0x79')])){throw new db[(_0x8ad7('0x71'))][(_0x8ad7('0x77'))](_0x8ad7('0x7a')+_0x6efd23);}if(!_[_0x8ad7('0x7b')](_0x6efd23,_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x79')])){throw new db['Sequelize'][(_0x8ad7('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6efd23);}_0x223259[_0x530b29['body'][_0x8ad7('0x79')]]=_0x530b29['body']['from'];})['then'](function(){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x530b29[_0x8ad7('0x58')]['id']},'include':[{'model':db[_0x8ad7('0x7c')],'as':_0x8ad7('0x7d'),'include':[{'model':db[_0x8ad7('0x70')],'as':_0x8ad7('0x7e'),'where':_0x223259,'limit':0x1,'order':[[_0x8ad7('0x7f'),'DESC']]}]},{'model':db[_0x8ad7('0x80')],'as':_0x8ad7('0x81')}]});})[_0x8ad7('0x21')](handleEntityNotFound(_0x51e021,null))[_0x8ad7('0x21')](function(_0x188ee0){if(_0x188ee0&&_0x188ee0[_0x8ad7('0x7d')]){_0x15464b[_0x8ad7('0x82')]=_0x188ee0;_0x15464b['applications']=_0x188ee0[_0x8ad7('0x81')];_0x15464b['list']=_0x188ee0['List'];_0x15464b[_0x8ad7('0x83')]=_['orderBy'](_0x15464b[_0x8ad7('0x83')],[_0x8ad7('0x84')],[_0x8ad7('0x85')]);if(_0x15464b[_0x8ad7('0x82')][_0x8ad7('0x81')]){delete _0x15464b[_0x8ad7('0x82')][_0x8ad7('0x81')];}if(_0x15464b[_0x8ad7('0x82')][_0x8ad7('0x7d')]&&_0x15464b[_0x8ad7('0x82')]['List'][_0x8ad7('0x7e')][_0x8ad7('0x49')]){return _0x15464b[_0x8ad7('0x82')][_0x8ad7('0x7d')][_0x8ad7('0x7e')][0x0];}var _0x29ebe6=_['defaults'](_0x530b29['body'],{'firstName':_0x530b29[_0x8ad7('0x5e')]['from'],'ListId':_0x188ee0[_0x8ad7('0x74')]});_0x29ebe6[_0x530b29['body'][_0x8ad7('0x79')]]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x76')];return db[_0x8ad7('0x70')][_0x8ad7('0x5d')](_0x29ebe6,{'fields':_0x493f6e,'raw':!![]});}})[_0x8ad7('0x21')](handleEntityNotFound(_0x51e021,null))['then'](function(_0x408dd3){_0x15464b['contact']=_0x408dd3;if(_0x408dd3){var _0x306b6b={'ContactId':_0x408dd3['id'],'OpenchannelAccountId':_0x530b29[_0x8ad7('0x58')]['id'],'from':(_0x408dd3[_0x8ad7('0x86')]||'')+'\x20'+(_0x408dd3[_0x8ad7('0x87')]||'')};var _0x109b1c={'OpenchannelAccountId':_0x530b29['params']['id'],'closed':![]};if(_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x88')]){_0x109b1c['threadId']=_0x530b29[_0x8ad7('0x5e')]['threadId'];return db[_0x8ad7('0x89')][_0x8ad7('0x5b')]({'where':_0x109b1c})[_0x8ad7('0x21')](function(_0xf52b92){if(_0xf52b92){return[_0xf52b92,![]];}_0x306b6b[_0x8ad7('0x88')]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x88')];_0x306b6b[_0x8ad7('0x8a')]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x8a')];return db[_0x8ad7('0x89')][_0x8ad7('0x5d')](_0x306b6b)[_0x8ad7('0x21')](function(_0x58bddf){return[_0x58bddf,!![]];});});}else{_0x109b1c[_0x8ad7('0x88')]=null;}_0x109b1c[_0x8ad7('0x8b')]=_0x408dd3['id'];return db['OpenchannelInteraction']['find']({'where':_0x109b1c})[_0x8ad7('0x21')](function(_0x5d5eab){if(_0x5d5eab){return[_0x5d5eab,![]];}return db['OpenchannelInteraction'][_0x8ad7('0x5d')](_0x306b6b)['then'](function(_0x45b48c){return[_0x45b48c,!![]];});});}})[_0x8ad7('0x8c')](function(_0x24b3bd,_0x5c8f02){if(_0x24b3bd){_0x444b40=_0x5c8f02;if(!_0x5c8f02){var _0x11ef18={'from':(_0x15464b['contact'][_0x8ad7('0x86')]||'')+'\x20'+(_0x15464b['contact']['lastName']||'')};if(_0x530b29['body']['threadId']&&_0x530b29[_0x8ad7('0x5e')]['messageId']&&_0x530b29['body'][_0x8ad7('0x88')]!=_0x530b29['body'][_0x8ad7('0x8d')]){_0x11ef18[_0x8ad7('0x88')]=_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x8d')];}return _0x24b3bd[_0x8ad7('0x34')](_0x11ef18);}else{return _0x24b3bd;}}})[_0x8ad7('0x21')](function(_0xa0048){_0x15464b[_0x8ad7('0x8e')]=_0xa0048['get']({'plain':!![]});_0x15464b['interaction'][_0x8ad7('0x8f')]=_0x444b40;if(_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x8f')]){if(_0x15464b['account'][_0x8ad7('0x90')]){_0x15464b[_0x8ad7('0x83')]['push']({'id':0x0,'priority':_0x15464b[_0x8ad7('0x83')][_0x8ad7('0x49')]+0x1,'app':_0x8ad7('0x91'),'appdata':_0x8ad7('0x92'),'interval':'*,*,*,*'});}}return db[_0x8ad7('0x93')][_0x8ad7('0x5d')]({'body':_0x530b29[_0x8ad7('0x5e')][_0x8ad7('0x5e')],'OpenchannelAccountId':_0x530b29[_0x8ad7('0x58')]['id'],'OpenchannelInteractionId':_0xa0048['id'],'direction':'in','ContactId':_0x15464b[_0x8ad7('0x94')]['id'],'AttachmentId':_0x530b29[_0x8ad7('0x5e')]['AttachmentId']});})[_0x8ad7('0x21')](function(_0x548874){_0x15464b[_0x8ad7('0x27')]=_0x548874;if(!_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x95')])return;return db[_0x8ad7('0x96')][_0x8ad7('0x5b')]({'attributes':['id',_0x8ad7('0x3a')],'where':{'id':_0x15464b[_0x8ad7('0x8e')]['UserId']}});})[_0x8ad7('0x21')](function(_0x1b6e54){if(_0x1b6e54){_0x15464b[_0x8ad7('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8ad7('0x97'),'appdata':_0x1b6e54['name']+','+(_0x15464b[_0x8ad7('0x82')][_0x8ad7('0x98')]||0xa),'interval':_0x8ad7('0x99')});}if(!_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x9a')])return;return db[_0x8ad7('0x9b')]['find']({'attributes':['id',_0x8ad7('0x3a')],'where':{'id':_0x15464b[_0x8ad7('0x8e')][_0x8ad7('0x9a')]}});})[_0x8ad7('0x21')](function(_0x4f521b){if(_0x4f521b){_0x15464b['applications'][_0x8ad7('0x9c')]({'id':0x0,'priority':0x1,'app':_0x8ad7('0x9d'),'appdata':_0x4f521b[_0x8ad7('0x3a')]+','+(_0x15464b['account'][_0x8ad7('0x9e')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8ad7('0x9f'),_0x8ad7('0xa0'),_0x15464b);})[_0x8ad7('0x21')](function(_0x2ef044){respondWithRpcPromise('EventManager',_0x8ad7('0xa1'),{'event':'notify','message':_0x2ef044},client9002);return _0x2ef044;})[_0x8ad7('0x21')](respondWithResult(_0x51e021,null))[_0x8ad7('0x5c')](handleError(_0x51e021,null));};exports[_0x8ad7('0xa2')]=function(_0x27dd97,_0x3b2206){var _0x2005a0=_0x27dd97[_0x8ad7('0x58')]['id'];var _0x5b575c=_0x27dd97['body'];var _0x74529f=0xc8;var _0x1db604=null;return db[_0x8ad7('0xa3')][_0x8ad7('0xa4')]({'isolationLevel':db['sequelize'][_0x8ad7('0xa5')][_0x8ad7('0xa6')][_0x8ad7('0xa7')]},function(_0x5dce95){return db[_0x8ad7('0x40')]['findOne']({'where':{'id':_0x2005a0},'transaction':_0x5dce95})[_0x8ad7('0x21')](function(_0x2a26df){if(_0x2a26df){return db[_0x8ad7('0x80')][_0x8ad7('0x37')]({'where':{'OpenchannelAccountId':_0x2005a0},'transaction':_0x5dce95})['then'](function(){var _0x4e3dd8=_['map'](_0x5b575c,function(_0x558177){_0x558177[_0x8ad7('0x64')]=_0x2005a0;return _0x558177;});return db['OpenchannelApplication']['bulkCreate'](_0x4e3dd8,{'transaction':_0x5dce95});});}else{_0x74529f=0x194;_0x1db604=[];}});})[_0x8ad7('0x21')](function(){if(_0x74529f!==0x194){return db[_0x8ad7('0x80')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2005a0},'order':_0x8ad7('0x84')})[_0x8ad7('0x21')](function(_0x168ec8){_0x1db604=_0x168ec8;});}})[_0x8ad7('0x5c')](function(_0x3e71c2){_0x74529f=0x1f4;logger['error'](_0x3e71c2[_0x8ad7('0x39')]);if(_0x3e71c2[_0x8ad7('0x3a')]){delete _0x3e71c2[_0x8ad7('0x3a')];}_0x1db604=_0x3e71c2;})['finally'](function(){if(_0x1db604===null){_0x3b2206[_0x8ad7('0x2a')](_0x74529f);}else{if(_0x74529f===0x1f4){_0x3b2206[_0x8ad7('0x2b')](_0x74529f)['send'](_0x1db604);}else{_0x3b2206['status'](_0x74529f)['json'](_0x1db604);}}});};exports[_0x8ad7('0xa8')]=function(_0x2909d7,_0x6f4b8e,_0xfe5af7){var _0x11e37a={};var _0x4cf332={};var _0x1f9e07;var _0x1f7a1e;return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x2909d7[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x6f4b8e,null))[_0x8ad7('0x21')](function(_0x53a019){if(_0x53a019){_0x1f9e07=_0x53a019;_0x4cf332[_0x8ad7('0x47')]=_[_0x8ad7('0x59')](db[_0x8ad7('0x80')][_0x8ad7('0x41')]);_0x4cf332[_0x8ad7('0x44')]=_[_0x8ad7('0x59')](_0x2909d7['query']);_0x4cf332['filters']=_[_0x8ad7('0x46')](_0x4cf332['model'],_0x4cf332['query']);_0x11e37a['attributes']=_[_0x8ad7('0x46')](_0x4cf332[_0x8ad7('0x47')],qs[_0x8ad7('0x5a')](_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x11e37a['attributes']=_0x11e37a['attributes'][_0x8ad7('0x49')]?_0x11e37a['attributes']:_0x4cf332[_0x8ad7('0x47')];_0x11e37a['order']=qs[_0x8ad7('0x4c')](_0x2909d7['query'][_0x8ad7('0x4c')]);_0x11e37a[_0x8ad7('0x4d')]=qs['filters'](_[_0x8ad7('0x4e')](_0x2909d7['query'],_0x4cf332[_0x8ad7('0x45')]));if(_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x11e37a[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x11e37a[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x11e37a[_0x8ad7('0x48')],function(_0x5ac595){var _0x64e99d={};_0x64e99d[_0x5ac595]={'$like':'%'+_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0x64e99d;})});}_0x11e37a=_['merge']({},_0x11e37a,_0x2909d7[_0x8ad7('0x52')]);return _0x1f9e07['getApplications'](_0x11e37a);}})['then'](function(_0x4c1937){if(_0x4c1937){_0x1f7a1e=_0x4c1937[_0x8ad7('0x49')];if(!_0x2909d7['query'][_0x8ad7('0x68')](_0x8ad7('0x4a'))){_0x11e37a['limit']=qs['limit'](_0x2909d7[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x11e37a[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x2909d7[_0x8ad7('0x44')]['offset']);}return _0x1f9e07[_0x8ad7('0xa8')](_0x11e37a);}})['then'](function(_0x1e35e6){if(_0x1e35e6){return _0x1e35e6?{'count':_0x1f7a1e,'rows':_0x1e35e6}:null;}})[_0x8ad7('0x21')](respondWithResult(_0x6f4b8e,null))[_0x8ad7('0x5c')](handleError(_0x6f4b8e,null));};exports[_0x8ad7('0xa9')]=function(_0x5186a8,_0xa0ca6c,_0xdfa94d){var _0x1400e0={'raw':![],'where':{}};var _0x2b5e26={};var _0x1f224c={'count':0x0,'rows':[]};return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x5186a8[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0xa0ca6c,null))[_0x8ad7('0x21')](function(_0x39862b){if(_0x39862b){_0x2b5e26[_0x8ad7('0x47')]=_['keys'](db[_0x8ad7('0x89')][_0x8ad7('0x41')]);_0x2b5e26[_0x8ad7('0x44')]=_[_0x8ad7('0x59')](_0x5186a8[_0x8ad7('0x44')]);_0x2b5e26[_0x8ad7('0x45')]=_['intersection'](_0x2b5e26[_0x8ad7('0x47')],_0x2b5e26[_0x8ad7('0x44')]);_0x1400e0['attributes']=_[_0x8ad7('0x46')](_0x2b5e26[_0x8ad7('0x47')],qs[_0x8ad7('0x5a')](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x5a')]));_0x1400e0[_0x8ad7('0x48')]=_0x1400e0[_0x8ad7('0x48')][_0x8ad7('0x49')]?_0x1400e0['attributes']:_0x2b5e26['model'];if(!_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x68')](_0x8ad7('0x4a'))){_0x1400e0['limit']=qs[_0x8ad7('0x2e')](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x1400e0[_0x8ad7('0x2c')]=qs[_0x8ad7('0x2c')](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x2c')]);}_0x1400e0['order']=qs['sort'](_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x4c')]);_0x1400e0[_0x8ad7('0x4d')]=qs[_0x8ad7('0x45')](_[_0x8ad7('0x4e')](_0x5186a8[_0x8ad7('0x44')],_0x2b5e26[_0x8ad7('0x45')]));_0x1400e0[_0x8ad7('0x4d')][_0x8ad7('0x64')]=_0x39862b['id'];if(_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x1400e0[_0x8ad7('0x4d')]=_[_0x8ad7('0x50')](_0x1400e0[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x1400e0[_0x8ad7('0x48')],function(_0x7993ab){var _0x5db77c={};_0x5db77c[_0x7993ab]={'$like':'%'+_0x5186a8['query'][_0x8ad7('0x4f')]+'%'};return _0x5db77c;})});}_0x1400e0=_['merge']({},_0x1400e0,_0x5186a8[_0x8ad7('0x52')]);return db['OpenchannelInteraction'][_0x8ad7('0x2d')]({'where':_0x1400e0[_0x8ad7('0x4d')]})['then'](function(_0x3b380b){_0x1f224c[_0x8ad7('0x2d')]=_0x3b380b;if(_0x5186a8['query'][_0x8ad7('0x53')]){_0x1400e0[_0x8ad7('0x54')]=[{'model':db[_0x8ad7('0x70')],'as':_0x8ad7('0xaa'),'required':![]},{'model':db[_0x8ad7('0x96')],'as':'Owner','attributes':[_0x8ad7('0x3a'),_0x8ad7('0xab'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8ad7('0xac'),'attributes':['id',_0x8ad7('0x3a'),_0x8ad7('0xad')],'where':_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0xae')]?{'id':_0x5186a8[_0x8ad7('0x44')][_0x8ad7('0xae')]}:undefined,'required':_0x5186a8[_0x8ad7('0x44')]['tag']?!![]:![]}];}return db[_0x8ad7('0x89')][_0x8ad7('0x55')](_0x1400e0);})['then'](function(_0x1eda00){_0x1f224c[_0x8ad7('0x56')]=_0x1eda00;return _0x1f224c;});}})[_0x8ad7('0x21')](respondWithFilteredResult(_0xa0ca6c,_0x1400e0))['catch'](handleError(_0xa0ca6c,null));};exports[_0x8ad7('0xaf')]=function(_0x52dbf8,_0x5e7cc2,_0x25525d){return db[_0x8ad7('0x40')]['find']({'where':{'id':_0x52dbf8[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x5e7cc2,null))['then'](function(_0x34af6f){if(_0x34af6f){return _0x34af6f[_0x8ad7('0xaf')](_0x52dbf8[_0x8ad7('0x5e')]['ids'],_[_0x8ad7('0xb0')](_0x52dbf8[_0x8ad7('0x5e')],[_0x8ad7('0x6a'),'id'])||{})[_0x8ad7('0x8c')](function(_0x37872f){for(var _0x232520=0x0;_0x232520<_0x52dbf8[_0x8ad7('0x5e')]['ids'][_0x8ad7('0x49')];_0x232520+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x52dbf8[_0x8ad7('0x5e')][_0x8ad7('0x6a')][_0x232520]),'OpenchannelAccountId':Number(_0x52dbf8[_0x8ad7('0x58')]['id'])});}return _0x37872f;});}})[_0x8ad7('0x21')](respondWithResult(_0x5e7cc2,null))['catch'](handleError(_0x5e7cc2,null));};exports[_0x8ad7('0xb1')]=function(_0x5a8b08,_0x5e3344,_0x392e33){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x5a8b08[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x5e3344,null))[_0x8ad7('0x21')](function(_0xdf56bb){if(_0xdf56bb){return _0xdf56bb[_0x8ad7('0xb1')](_0x5a8b08[_0x8ad7('0x44')][_0x8ad7('0x6a')])[_0x8ad7('0x21')](function(){if(_['isArray'](_0x5a8b08['query'][_0x8ad7('0x6a')])){for(var _0xcbdce4=0x0;_0xcbdce4<_0x5a8b08[_0x8ad7('0x44')][_0x8ad7('0x6a')][_0x8ad7('0x49')];_0xcbdce4+=0x1){socket[_0x8ad7('0xb2')](_0x8ad7('0xb3'),{'UserId':Number(_0x5a8b08['query']['ids'][_0xcbdce4]),'OpenchannelAccountId':Number(_0x5a8b08[_0x8ad7('0x58')]['id'])});}}else{socket[_0x8ad7('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5a8b08['query']['ids']),'OpenchannelAccountId':Number(_0x5a8b08['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5e3344,null))['catch'](handleError(_0x5e3344,null));};exports['getAgents']=function(_0x383984,_0x5640da,_0x3e7801){var _0x58de6a={};var _0x4246c5={};var _0x4d11d8;var _0x2cb6b6;return db[_0x8ad7('0x40')][_0x8ad7('0x67')]({'where':{'id':_0x383984[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x5640da,null))['then'](function(_0x2a8d5a){if(_0x2a8d5a){_0x4d11d8=_0x2a8d5a;_0x4246c5[_0x8ad7('0x47')]=_['keys'](db['User'][_0x8ad7('0x41')]);_0x4246c5['query']=_[_0x8ad7('0x59')](_0x383984['query']);_0x4246c5[_0x8ad7('0x45')]=_[_0x8ad7('0x46')](_0x4246c5['model'],_0x4246c5[_0x8ad7('0x44')]);_0x58de6a[_0x8ad7('0x48')]=_['intersection'](_0x4246c5['model'],qs['fields'](_0x383984[_0x8ad7('0x44')]['fields']));_0x58de6a[_0x8ad7('0x48')]=_0x58de6a[_0x8ad7('0x48')][_0x8ad7('0x49')]?_0x58de6a[_0x8ad7('0x48')]:_0x4246c5['model'];_0x58de6a[_0x8ad7('0x4b')]=qs[_0x8ad7('0x4c')](_0x383984[_0x8ad7('0x44')][_0x8ad7('0x4c')]);_0x58de6a[_0x8ad7('0x4d')]=qs['filters'](_['pick'](_0x383984[_0x8ad7('0x44')],_0x4246c5['filters']));if(_0x383984[_0x8ad7('0x44')][_0x8ad7('0x4f')]){_0x58de6a['where']=_[_0x8ad7('0x50')](_0x58de6a[_0x8ad7('0x4d')],{'$or':_[_0x8ad7('0x3f')](_0x58de6a['attributes'],function(_0x30c864){var _0x5432b9={};_0x5432b9[_0x30c864]={'$like':'%'+_0x383984[_0x8ad7('0x44')][_0x8ad7('0x4f')]+'%'};return _0x5432b9;})});}_0x58de6a=_[_0x8ad7('0x50')]({},_0x58de6a,_0x383984['options']);return _0x4d11d8['getAgents'](_0x58de6a);}})['then'](function(_0xe94d8){if(_0xe94d8){_0x2cb6b6=_0xe94d8[_0x8ad7('0x49')];if(!_0x383984[_0x8ad7('0x44')][_0x8ad7('0x68')](_0x8ad7('0x4a'))){_0x58de6a['limit']=qs[_0x8ad7('0x2e')](_0x383984[_0x8ad7('0x44')][_0x8ad7('0x2e')]);_0x58de6a['offset']=qs['offset'](_0x383984[_0x8ad7('0x44')][_0x8ad7('0x2c')]);}return _0x4d11d8[_0x8ad7('0xb4')](_0x58de6a);}})[_0x8ad7('0x21')](function(_0x2fe713){if(_0x2fe713){return _0x2fe713?{'count':_0x2cb6b6,'rows':_0x2fe713}:null;}})['then'](respondWithResult(_0x5640da,null))[_0x8ad7('0x5c')](handleError(_0x5640da,null));};exports[_0x8ad7('0x3b')]=function(_0x156860,_0x66c45,_0x513f82){var _0x4a2f0b,_0x52379b,_0x52dd22;if(_[_0x8ad7('0x75')](_0x156860[_0x8ad7('0x5e')][_0x8ad7('0x5e')])||_0x156860['body'][_0x8ad7('0x5e')]===''){throw new db[(_0x8ad7('0x71'))]['ValidationError'](_0x8ad7('0xb5'));}if(_[_0x8ad7('0x75')](_0x156860[_0x8ad7('0x5e')]['to'])){}_0x4a2f0b=_0x156860[_0x8ad7('0x5e')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x156860[_0x8ad7('0x58')]['id']}})[_0x8ad7('0x21')](handleEntityNotFound(_0x66c45,null))[_0x8ad7('0x21')](function(_0x5ae18a){if(_0x5ae18a){return db[_0x8ad7('0x40')][_0x8ad7('0x5b')]({'where':{'id':_0x5ae18a['id']},'include':[{'model':db['CmList'],'as':_0x8ad7('0x7d'),'include':[{'model':db[_0x8ad7('0x70')],'as':_0x8ad7('0x7e'),'where':{[_0x5ae18a[_0x8ad7('0x79')]]:_0x4a2f0b},'limit':0x1,'order':[[_0x8ad7('0x7f'),_0x8ad7('0xb6')]]}]}]})['then'](handleEntityNotFound(_0x66c45,null))[_0x8ad7('0x21')](function(_0x4a01c6){if(_0x4a01c6&&_0x4a01c6[_0x8ad7('0x7d')]){_0x52379b=_0x4a01c6[_0x8ad7('0x35')]({'plain':!![]});if(_0x52379b[_0x8ad7('0x7d')]&&_0x52379b[_0x8ad7('0x7d')][_0x8ad7('0x7e')][_0x8ad7('0x49')]){return _0x52379b[_0x8ad7('0x7d')][_0x8ad7('0x7e')][0x0];}return db[_0x8ad7('0x70')][_0x8ad7('0x5d')](_[_0x8ad7('0x1a')](_0x156860['body'],{'firstName':_0x4a2f0b,[_0x4a01c6[_0x8ad7('0x79')]]:_0x4a2f0b,'phone':_0x4a2f0b,'ListId':_0x52379b[_0x8ad7('0x74')]}));}})[_0x8ad7('0x21')](handleEntityNotFound(_0x66c45,null))[_0x8ad7('0x21')](function(_0xcc3fbe){if(_0xcc3fbe){_0x52dd22=_0xcc3fbe;return db['OpenchannelInteraction'][_0x8ad7('0x5b')]({'where':{'ContactId':_0x52dd22['id'],'closed':![],'OpenchannelAccountId':_0x52379b['id']}})[_0x8ad7('0x21')](function(_0x35486c){if(_0x35486c){return[_0x35486c,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x156860[_0x8ad7('0xb7')]['id'],'ContactId':_0x52dd22['id'],'OpenchannelAccountId':_0x52379b['id'],'lastMsgDirection':'out','firstMsgDirection':_0x8ad7('0xb8'),'Messages':[_['merge'](_0x156860[_0x8ad7('0x5e')],{'read':![],'body':_0x156860['body'][_0x8ad7('0x5e')],'OpenchannelAccountId':_0x52379b['id'],'UserId':_0x156860[_0x8ad7('0xb7')]['id'],'ContactId':_0x52dd22['id']})]},{'include':[{'model':db[_0x8ad7('0x93')],'as':_0x8ad7('0xb9')}]})[_0x8ad7('0x21')](function(_0x34831c){return[_0x34831c,!![]];});});}})[_0x8ad7('0x8c')](function(_0x497899,_0x4f8880){if(_0x4f8880){return _0x497899;}return db['OpenchannelMessage'][_0x8ad7('0x5d')](_['merge'](_0x156860[_0x8ad7('0x5e')],{'read':![],'body':_0x156860[_0x8ad7('0x5e')][_0x8ad7('0x5e')],'OpenchannelAccountId':_0x52379b['id'],'OpenchannelInteractionId':_0x497899['id'],'UserId':_0x156860[_0x8ad7('0xb7')]['id'],'ContactId':_0x52dd22['id']}))['then'](function(_0x22ea0d){_0x497899[_0x8ad7('0xba')]['Messages']=[];_0x497899[_0x8ad7('0xba')][_0x8ad7('0xb9')][_0x8ad7('0xbb')](_0x22ea0d['dataValues']);return _0x497899;});});}})['then'](respondWithResult(_0x66c45,null))[_0x8ad7('0x5c')](handleError(_0x66c45,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8b790b5..624c1cb 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['save','remove','emit','hasOwnProperty','exports','events','OpenchannelAccount','setMaxListeners'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0xdace,0xc5));var _0xedac=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xdace[_0x2a6809];return _0x11c371;};'use strict';var EventEmitter=require(_0xedac('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xedac('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xedac('0x2')](0x0);var events={'afterCreate':_0xedac('0x3'),'afterUpdate':'update','afterDestroy':_0xedac('0x4')};function emitEvent(_0x36bcd2){return function(_0x15d3bd,_0xefb142,_0x5a97c0){OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2+':'+_0x15d3bd['id'],_0x15d3bd);OpenchannelAccountEvents[_0xedac('0x5')](_0x36bcd2,_0x15d3bd);_0x5a97c0(null);};}for(var e in events){if(events[_0xedac('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xedac('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x668b,0x140));var _0xb668=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x668b[_0x4a6cf8];return _0x22205e;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 0dca85f..5d59a51 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(_0x30b9d3,_0xbd1e14){var _0x465479=function(_0x4342bf){while(--_0x4342bf){_0x30b9d3['push'](_0x30b9d3['shift']());}};_0x465479(++_0xbd1e14);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x11c21a,_0x24c0d5){var _0xf64c5f=function(_0x357b35){while(--_0x357b35){_0x11c21a['push'](_0x11c21a['shift']());}};_0xf64c5f(++_0x24c0d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 828f56e..cb00799 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x26018a,_0x25471a){var _0x12679c=function(_0x1ecfe2){while(--_0x1ecfe2){_0x26018a['push'](_0x26018a['shift']());}};_0x12679c(++_0x25471a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xcb91[_0x5712f8];return _0x14a364;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});config[_0x1cb9('0x9')]=_['defaults'](config[_0x1cb9('0x9')],{'host':_0x1cb9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x45a12f,_0x2fa15c,_0x74ce19){return new BPromise(function(_0x1f0eca,_0x2fc627){return client['request'](_0x45a12f,_0x74ce19)[_0x1cb9('0xb')](function(_0x44a6b4){logger[_0x1cb9('0xc')](_0x1cb9('0xd'),_0x2fa15c,_0x1cb9('0xe'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2fa15c,'request\x20sent',JSON[_0x1cb9('0xf')](_0x44a6b4));if(_0x44a6b4[_0x1cb9('0x10')]){if(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger['error'](_0x1cb9('0xd'),_0x2fa15c,_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);return _0x2fc627(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2fa15c,_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);return _0x1f0eca(_0x44a6b4[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xc')](_0x1cb9('0xd'),_0x2fa15c,_0x1cb9('0xe'));_0x1f0eca(_0x44a6b4['result']['message']);}})[_0x1cb9('0x13')](function(_0x41ac41){logger[_0x1cb9('0x10')](_0x1cb9('0xd'),_0x2fa15c,_0x41ac41);_0x2fc627(_0x41ac41);});});} \ No newline at end of file +var _0x3264=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3264,0x7f));var _0x4326=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x3264[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});config['redis']=_[_0x4326('0x9')](config[_0x4326('0xa')],{'host':_0x4326('0xb'),'port':0x18eb});var socket=require(_0x4326('0xc'))(new Redis(config[_0x4326('0xa')]));require(_0x4326('0xd'))[_0x4326('0xe')](socket);function respondWithRpcPromise(_0x5cde0b,_0x58bade,_0x51323a){return new BPromise(function(_0x97d63e,_0x9daa3f){return client[_0x4326('0xf')](_0x5cde0b,_0x51323a)['then'](function(_0x5ac227){logger[_0x4326('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));logger[_0x4326('0x12')](_0x4326('0x13'),_0x58bade,'request\x20sent',JSON['stringify'](_0x5ac227));if(_0x5ac227[_0x4326('0x14')]){if(_0x5ac227['error']['code']===0x1f4){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);return _0x9daa3f(_0x5ac227['error'][_0x4326('0x16')]);}logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227['error'][_0x4326('0x16')]);return _0x97d63e(_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);}else{logger[_0x4326('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));_0x97d63e(_0x5ac227['result'][_0x4326('0x16')]);}})[_0x4326('0x17')](function(_0x35f24b){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x35f24b);_0x9daa3f(_0x35f24b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9182c09..87039a0 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 _0x3fec=['length','openchannelAccount:','./openchannelAccount.events','update','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fec[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelAccountEvents=require(_0xc3fe('0x0'));var events=['save','remove',_0xc3fe('0x1')];function createListener(_0x1cd663,_0x5adb4c){return function(_0x3e2547){_0x5adb4c['emit'](_0x1cd663,_0x3e2547);};}function removeListener(_0x53a208,_0x1cdef8){return function(){OpenchannelAccountEvents['removeListener'](_0x53a208,_0x1cdef8);};}exports[_0xc3fe('0x2')]=function(_0x327d2f){for(var _0x22dd19=0x0,_0x1ae20f=events[_0xc3fe('0x3')];_0x22dd19<_0x1ae20f;_0x22dd19++){var _0x43a9a9=events[_0x22dd19];var _0x1e532e=createListener(_0xc3fe('0x4')+_0x43a9a9,_0x327d2f);OpenchannelAccountEvents['on'](_0x43a9a9,_0x1e532e);}}; \ No newline at end of file +var _0x3164=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','register'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3164,0x182));var _0x4316=function(_0xd701c6,_0x20625a){_0xd701c6=_0xd701c6-0x0;var _0x44092b=_0x3164[_0xd701c6];return _0x44092b;};'use strict';var OpenchannelAccountEvents=require(_0x4316('0x0'));var events=[_0x4316('0x1'),_0x4316('0x2'),_0x4316('0x3')];function createListener(_0x169d29,_0x588480){return function(_0x2534d3){_0x588480[_0x4316('0x4')](_0x169d29,_0x2534d3);};}function removeListener(_0x1235d9,_0x56124c){return function(){OpenchannelAccountEvents['removeListener'](_0x1235d9,_0x56124c);};}exports[_0x4316('0x5')]=function(_0x25827b){for(var _0xf88ba4=0x0,_0x29c3c1=events[_0x4316('0x6')];_0xf88ba4<_0x29c3c1;_0xf88ba4++){var _0x473cd2=events[_0xf88ba4];var _0x1bcd38=createListener(_0x4316('0x7')+_0x473cd2,_0x25827b);OpenchannelAccountEvents['on'](_0x473cd2,_0x1bcd38);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8fd7155..752cdcf 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 _0xe3c0=['connect-timeout','Router','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3c0,0xa8));var _0x0e3c=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe3c0[_0x2b7764];return _0x848dcb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0e3c('0x0'));var timeout=require(_0x0e3c('0x1'));var express=require('express');var router=express[_0x0e3c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0e3c('0x3'));var config=require('../../config/environment');var controller=require(_0x0e3c('0x4'));router[_0x0e3c('0x5')]('/',auth[_0x0e3c('0x6')](),controller[_0x0e3c('0x7')]);router[_0x0e3c('0x5')](_0x0e3c('0x8'),auth['isAuthenticated'](),controller[_0x0e3c('0x9')]);router['post']('/',auth[_0x0e3c('0x6')](),controller[_0x0e3c('0xa')]);router['put'](_0x0e3c('0x8'),auth[_0x0e3c('0x6')](),controller[_0x0e3c('0xb')]);router['delete'](_0x0e3c('0x8'),auth[_0x0e3c('0x6')](),controller[_0x0e3c('0xc')]);module['exports']=router; \ No newline at end of file +var _0x4b39=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5a3b01,_0xe61a44){var _0x18f052=function(_0x2928e7){while(--_0x2928e7){_0x5a3b01['push'](_0x5a3b01['shift']());}};_0x18f052(++_0xe61a44);}(_0x4b39,0x187));var _0x94b3=function(_0x5cb71a,_0x263bdf){_0x5cb71a=_0x5cb71a-0x0;var _0x3f380f=_0x4b39[_0x5cb71a];return _0x3f380f;};'use strict';var multer=require(_0x94b3('0x0'));var util=require(_0x94b3('0x1'));var path=require('path');var timeout=require(_0x94b3('0x2'));var express=require(_0x94b3('0x3'));var router=express[_0x94b3('0x4')]();var fs_extra=require(_0x94b3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x94b3('0x6'));var config=require(_0x94b3('0x7'));var controller=require(_0x94b3('0x8'));router[_0x94b3('0x9')]('/',auth[_0x94b3('0xa')](),controller[_0x94b3('0xb')]);router[_0x94b3('0x9')](_0x94b3('0xc'),auth['isAuthenticated'](),controller[_0x94b3('0xd')]);router['post']('/',auth[_0x94b3('0xa')](),controller[_0x94b3('0xe')]);router[_0x94b3('0xf')](_0x94b3('0xc'),auth[_0x94b3('0xa')](),controller[_0x94b3('0x10')]);router[_0x94b3('0x11')]('/:id',auth[_0x94b3('0xa')](),controller['destroy']);module[_0x94b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ed37ce2..a1fe825 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 _0xa967=['sequelize','exports','STRING','*,*,*,*'];(function(_0x393436,_0x2100f4){var _0x1a54a4=function(_0x2318f3){while(--_0x2318f3){_0x393436['push'](_0x393436['shift']());}};_0x1a54a4(++_0x2100f4);}(_0xa967,0x1f4));var _0x7a96=function(_0x4520ac,_0x33a5dc){_0x4520ac=_0x4520ac-0x0;var _0xe6ae67=_0xa967[_0x4520ac];return _0xe6ae67;};'use strict';var Sequelize=require(_0x7a96('0x0'));module[_0x7a96('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7a96('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7a96('0x2')]},'interval':{'type':Sequelize[_0x7a96('0x2')],'defaultValue':_0x7a96('0x3')}}; \ No newline at end of file +var _0x06fe=['noop','TEXT','sequelize','STRING'];(function(_0x51e6c4,_0xf836c8){var _0xb40ee8=function(_0x46d12f){while(--_0x46d12f){_0x51e6c4['push'](_0x51e6c4['shift']());}};_0xb40ee8(++_0xf836c8);}(_0x06fe,0x146));var _0xe06f=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x06fe[_0x51b661];return _0x5d1971;};'use strict';var Sequelize=require(_0xe06f('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe06f('0x1')],'allowNull':![],'defaultValue':_0xe06f('0x2')},'appdata':{'type':Sequelize[_0xe06f('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe06f('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b371d49..780a4fd 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 _0xe1db=['name','index','OpenchannelApplication','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1db,0x1de));var _0xbe1d=function(_0x311ab5,_0x356e70){_0x311ab5=_0x311ab5-0x0;var _0x451f35=_0xe1db[_0x311ab5];return _0x451f35;};'use strict';var emlformat=require(_0xbe1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe1d('0x1'));var jsonpatch=require(_0xbe1d('0x2'));var rp=require(_0xbe1d('0x3'));var moment=require(_0xbe1d('0x4'));var BPromise=require(_0xbe1d('0x5'));var Mustache=require(_0xbe1d('0x6'));var util=require(_0xbe1d('0x7'));var path=require(_0xbe1d('0x8'));var sox=require(_0xbe1d('0x9'));var csv=require(_0xbe1d('0xa'));var ejs=require(_0xbe1d('0xb'));var fs=require('fs');var fs_extra=require(_0xbe1d('0xc'));var _=require(_0xbe1d('0xd'));var squel=require('squel');var crypto=require(_0xbe1d('0xe'));var jsforce=require(_0xbe1d('0xf'));var deskjs=require(_0xbe1d('0x10'));var toCsv=require(_0xbe1d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbe1d('0x11'));var qs=require(_0xbe1d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe1d('0x13'));var logger=require('../../config/logger')(_0xbe1d('0x14'));var utils=require(_0xbe1d('0x15'));var config=require(_0xbe1d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe1d('0x17'))['db'];function respondWithStatusCode(_0x233ddc,_0x50a974){_0x50a974=_0x50a974||0xcc;return function(_0x4408d1){if(_0x4408d1){return _0x233ddc[_0xbe1d('0x18')](_0x50a974);}return _0x233ddc[_0xbe1d('0x19')](_0x50a974)[_0xbe1d('0x1a')]();};}function respondWithResult(_0x1e29df,_0x342c31){_0x342c31=_0x342c31||0xc8;return function(_0x2157dc){if(_0x2157dc){return _0x1e29df[_0xbe1d('0x19')](_0x342c31)[_0xbe1d('0x1b')](_0x2157dc);}};}function respondWithFilteredResult(_0x130ec0,_0x3e77df){return function(_0x37a08e){if(_0x37a08e){var _0x4b7ea3=typeof _0x3e77df[_0xbe1d('0x1c')]===_0xbe1d('0x1d')&&typeof _0x3e77df['limit']===_0xbe1d('0x1d');var _0x15a36e=_0x37a08e[_0xbe1d('0x1e')];var _0x21b8a7=_0x4b7ea3?0x0:_0x3e77df['offset'];var _0x35fe00=_0x4b7ea3?_0x37a08e[_0xbe1d('0x1e')]:_0x3e77df[_0xbe1d('0x1c')]+_0x3e77df['limit'];var _0x41f0d9;if(_0x35fe00>=_0x15a36e){_0x35fe00=_0x15a36e;_0x41f0d9=0xc8;}else{_0x41f0d9=0xce;}_0x130ec0[_0xbe1d('0x19')](_0x41f0d9);return _0x130ec0['set'](_0xbe1d('0x1f'),_0x21b8a7+'-'+_0x35fe00+'/'+_0x15a36e)[_0xbe1d('0x1b')](_0x37a08e);}return null;};}function patchUpdates(_0x4a7641){return function(_0x46fab2){try{jsonpatch[_0xbe1d('0x20')](_0x46fab2,_0x4a7641,!![]);}catch(_0x3bea7b){return BPromise[_0xbe1d('0x21')](_0x3bea7b);}return _0x46fab2[_0xbe1d('0x22')]();};}function saveUpdates(_0x203041,_0x2a1fc4){return function(_0x24ab49){if(_0x24ab49){return _0x24ab49[_0xbe1d('0x23')](_0x203041)[_0xbe1d('0x24')](function(_0x5b338d){return _0x5b338d;});}return null;};}function removeEntity(_0x1866c5,_0x5b16df){return function(_0x22c1a1){if(_0x22c1a1){return _0x22c1a1[_0xbe1d('0x25')]()[_0xbe1d('0x24')](function(){_0x1866c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a86b7,_0x38e029){return function(_0x480da8){if(!_0x480da8){_0x1a86b7['sendStatus'](0x194);}return _0x480da8;};}function handleError(_0x33b4ba,_0x30325d){_0x30325d=_0x30325d||0x1f4;return function(_0x1a90cf){logger[_0xbe1d('0x26')](_0x1a90cf[_0xbe1d('0x27')]);if(_0x1a90cf[_0xbe1d('0x28')]){delete _0x1a90cf['name'];}_0x33b4ba[_0xbe1d('0x19')](_0x30325d)['send'](_0x1a90cf);};}exports[_0xbe1d('0x29')]=function(_0x4d08e0,_0xa54c86){var _0x270f7b={},_0xb2c850={},_0x22a230={'count':0x0,'rows':[]};var _0x501360=_['map'](db[_0xbe1d('0x2a')]['rawAttributes'],function(_0xd8e8b){return{'name':_0xd8e8b[_0xbe1d('0x2b')],'type':_0xd8e8b[_0xbe1d('0x2c')][_0xbe1d('0x2d')]};});_0xb2c850[_0xbe1d('0x2e')]=_[_0xbe1d('0x2f')](_0x501360,_0xbe1d('0x28'));_0xb2c850[_0xbe1d('0x30')]=_[_0xbe1d('0x31')](_0x4d08e0[_0xbe1d('0x30')]);_0xb2c850['filters']=_[_0xbe1d('0x32')](_0xb2c850[_0xbe1d('0x2e')],_0xb2c850[_0xbe1d('0x30')]);_0x270f7b[_0xbe1d('0x33')]=_[_0xbe1d('0x32')](_0xb2c850[_0xbe1d('0x2e')],qs['fields'](_0x4d08e0[_0xbe1d('0x30')][_0xbe1d('0x34')]));_0x270f7b['attributes']=_0x270f7b[_0xbe1d('0x33')][_0xbe1d('0x35')]?_0x270f7b[_0xbe1d('0x33')]:_0xb2c850['model'];if(!_0x4d08e0[_0xbe1d('0x30')]['hasOwnProperty'](_0xbe1d('0x36'))){_0x270f7b[_0xbe1d('0x37')]=qs[_0xbe1d('0x37')](_0x4d08e0[_0xbe1d('0x30')]['limit']);_0x270f7b[_0xbe1d('0x1c')]=qs[_0xbe1d('0x1c')](_0x4d08e0['query'][_0xbe1d('0x1c')]);}_0x270f7b[_0xbe1d('0x38')]=qs['sort'](_0x4d08e0[_0xbe1d('0x30')]['sort']);_0x270f7b[_0xbe1d('0x39')]=qs['filters'](_[_0xbe1d('0x3a')](_0x4d08e0[_0xbe1d('0x30')],_0xb2c850[_0xbe1d('0x3b')]),_0x501360);if(_0x4d08e0[_0xbe1d('0x30')][_0xbe1d('0x3c')]){_0x270f7b['where']=_[_0xbe1d('0x3d')](_0x270f7b['where'],{'$or':_['map'](_0x501360,function(_0x28b811){if(_0x28b811[_0xbe1d('0x2c')]!==_0xbe1d('0x3e')){var _0x2bc2bf={};_0x2bc2bf[_0x28b811['name']]={'$like':'%'+_0x4d08e0[_0xbe1d('0x30')][_0xbe1d('0x3c')]+'%'};return _0x2bc2bf;}})});}_0x270f7b=_[_0xbe1d('0x3d')]({},_0x270f7b,_0x4d08e0[_0xbe1d('0x3f')]);var _0x22d68d={'where':_0x270f7b[_0xbe1d('0x39')]};return db[_0xbe1d('0x2a')][_0xbe1d('0x1e')](_0x22d68d)[_0xbe1d('0x24')](function(_0x29b319){_0x22a230[_0xbe1d('0x1e')]=_0x29b319;if(_0x4d08e0[_0xbe1d('0x30')][_0xbe1d('0x40')]){_0x270f7b['include']=[{'all':!![]}];}return db[_0xbe1d('0x2a')][_0xbe1d('0x41')](_0x270f7b);})['then'](function(_0x7910e0){_0x22a230['rows']=_0x7910e0;return _0x22a230;})[_0xbe1d('0x24')](respondWithFilteredResult(_0xa54c86,_0x270f7b))[_0xbe1d('0x42')](handleError(_0xa54c86,null));};exports[_0xbe1d('0x43')]=function(_0x4161ff,_0x342627){var _0x23519e={'raw':!![],'where':{'id':_0x4161ff[_0xbe1d('0x44')]['id']}},_0x1d54b4={};_0x1d54b4[_0xbe1d('0x2e')]=_[_0xbe1d('0x31')](db[_0xbe1d('0x2a')][_0xbe1d('0x45')]);_0x1d54b4['query']=_[_0xbe1d('0x31')](_0x4161ff['query']);_0x1d54b4[_0xbe1d('0x3b')]=_[_0xbe1d('0x32')](_0x1d54b4['model'],_0x1d54b4['query']);_0x23519e[_0xbe1d('0x33')]=_[_0xbe1d('0x32')](_0x1d54b4[_0xbe1d('0x2e')],qs[_0xbe1d('0x34')](_0x4161ff[_0xbe1d('0x30')][_0xbe1d('0x34')]));_0x23519e[_0xbe1d('0x33')]=_0x23519e[_0xbe1d('0x33')]['length']?_0x23519e[_0xbe1d('0x33')]:_0x1d54b4[_0xbe1d('0x2e')];if(_0x4161ff[_0xbe1d('0x30')][_0xbe1d('0x40')]){_0x23519e[_0xbe1d('0x46')]=[{'all':!![]}];}_0x23519e=_['merge']({},_0x23519e,_0x4161ff['options']);return db[_0xbe1d('0x2a')][_0xbe1d('0x47')](_0x23519e)[_0xbe1d('0x24')](handleEntityNotFound(_0x342627,null))[_0xbe1d('0x24')](respondWithResult(_0x342627,null))[_0xbe1d('0x42')](handleError(_0x342627,null));};exports[_0xbe1d('0x48')]=function(_0x5e8278,_0x35d72c){return db[_0xbe1d('0x2a')][_0xbe1d('0x48')](_0x5e8278[_0xbe1d('0x49')],{})[_0xbe1d('0x24')](respondWithResult(_0x35d72c,0xc9))[_0xbe1d('0x42')](handleError(_0x35d72c,null));};exports[_0xbe1d('0x23')]=function(_0x135cbd,_0x1bfe05){if(_0x135cbd[_0xbe1d('0x49')]['id']){delete _0x135cbd['body']['id'];}return db[_0xbe1d('0x2a')]['find']({'where':{'id':_0x135cbd[_0xbe1d('0x44')]['id']}})[_0xbe1d('0x24')](handleEntityNotFound(_0x1bfe05,null))[_0xbe1d('0x24')](saveUpdates(_0x135cbd[_0xbe1d('0x49')],null))[_0xbe1d('0x24')](respondWithResult(_0x1bfe05,null))[_0xbe1d('0x42')](handleError(_0x1bfe05,null));};exports[_0xbe1d('0x25')]=function(_0x1ad39d,_0x8c37ea){return db['OpenchannelApplication'][_0xbe1d('0x47')]({'where':{'id':_0x1ad39d[_0xbe1d('0x44')]['id']}})[_0xbe1d('0x24')](handleEntityNotFound(_0x8c37ea,null))[_0xbe1d('0x24')](removeEntity(_0x8c37ea,null))[_0xbe1d('0x42')](handleError(_0x8c37ea,null));}; \ No newline at end of file +var _0x424a=['json','apply','save','update','destroy','then','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x3b33cd,_0x4ca853){var _0x25ddfd=function(_0x1ab147){while(--_0x1ab147){_0x3b33cd['push'](_0x3b33cd['shift']());}};_0x25ddfd(++_0x4ca853);}(_0x424a,0x199));var _0xa424=function(_0x4dfc30,_0x2f8ea3){_0x4dfc30=_0x4dfc30-0x0;var _0x4cabbe=_0x424a[_0x4dfc30];return _0x4cabbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa424('0x0'));var zipdir=require(_0xa424('0x1'));var jsonpatch=require(_0xa424('0x2'));var rp=require(_0xa424('0x3'));var moment=require('moment');var BPromise=require(_0xa424('0x4'));var Mustache=require(_0xa424('0x5'));var util=require('util');var path=require(_0xa424('0x6'));var sox=require(_0xa424('0x7'));var csv=require(_0xa424('0x8'));var ejs=require(_0xa424('0x9'));var fs=require('fs');var fs_extra=require(_0xa424('0xa'));var _=require('lodash');var squel=require(_0xa424('0xb'));var crypto=require(_0xa424('0xc'));var jsforce=require(_0xa424('0xd'));var deskjs=require(_0xa424('0xe'));var toCsv=require(_0xa424('0x8'));var querystring=require(_0xa424('0xf'));var Papa=require('papaparse');var Redis=require(_0xa424('0x10'));var authService=require(_0xa424('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa424('0x12'));var hardwareService=require(_0xa424('0x13'));var logger=require(_0xa424('0x14'))(_0xa424('0x15'));var utils=require(_0xa424('0x16'));var config=require(_0xa424('0x17'));var licenseUtil=require(_0xa424('0x18'));var db=require(_0xa424('0x19'))['db'];function respondWithStatusCode(_0x30fd71,_0x3b7019){_0x3b7019=_0x3b7019||0xcc;return function(_0x2681fb){if(_0x2681fb){return _0x30fd71[_0xa424('0x1a')](_0x3b7019);}return _0x30fd71[_0xa424('0x1b')](_0x3b7019)[_0xa424('0x1c')]();};}function respondWithResult(_0x45673c,_0x29f859){_0x29f859=_0x29f859||0xc8;return function(_0x21f7e1){if(_0x21f7e1){return _0x45673c[_0xa424('0x1b')](_0x29f859)['json'](_0x21f7e1);}};}function respondWithFilteredResult(_0x1fe2ba,_0x255141){return function(_0x228b7a){if(_0x228b7a){var _0x162e68=typeof _0x255141[_0xa424('0x1d')]===_0xa424('0x1e')&&typeof _0x255141[_0xa424('0x1f')]===_0xa424('0x1e');var _0x1b3b7c=_0x228b7a['count'];var _0x18bfd0=_0x162e68?0x0:_0x255141['offset'];var _0x25d5c3=_0x162e68?_0x228b7a[_0xa424('0x20')]:_0x255141[_0xa424('0x1d')]+_0x255141[_0xa424('0x1f')];var _0x142d45;if(_0x25d5c3>=_0x1b3b7c){_0x25d5c3=_0x1b3b7c;_0x142d45=0xc8;}else{_0x142d45=0xce;}_0x1fe2ba[_0xa424('0x1b')](_0x142d45);return _0x1fe2ba[_0xa424('0x21')](_0xa424('0x22'),_0x18bfd0+'-'+_0x25d5c3+'/'+_0x1b3b7c)[_0xa424('0x23')](_0x228b7a);}return null;};}function patchUpdates(_0x15de1f){return function(_0x2612e5){try{jsonpatch[_0xa424('0x24')](_0x2612e5,_0x15de1f,!![]);}catch(_0x123146){return BPromise['reject'](_0x123146);}return _0x2612e5[_0xa424('0x25')]();};}function saveUpdates(_0x1ef3d6,_0x28fab7){return function(_0x40eec3){if(_0x40eec3){return _0x40eec3[_0xa424('0x26')](_0x1ef3d6)['then'](function(_0x5e5139){return _0x5e5139;});}return null;};}function removeEntity(_0x4a5336,_0x408ce7){return function(_0x154570){if(_0x154570){return _0x154570[_0xa424('0x27')]()[_0xa424('0x28')](function(){_0x4a5336[_0xa424('0x1b')](0xcc)[_0xa424('0x1c')]();});}};}function handleEntityNotFound(_0x36f140,_0x4014fb){return function(_0x3b9aaa){if(!_0x3b9aaa){_0x36f140['sendStatus'](0x194);}return _0x3b9aaa;};}function handleError(_0x4ce6ac,_0x3bbb9d){_0x3bbb9d=_0x3bbb9d||0x1f4;return function(_0x153e5e){logger['error'](_0x153e5e[_0xa424('0x29')]);if(_0x153e5e[_0xa424('0x2a')]){delete _0x153e5e[_0xa424('0x2a')];}_0x4ce6ac[_0xa424('0x1b')](_0x3bbb9d)['send'](_0x153e5e);};}exports[_0xa424('0x2b')]=function(_0x350b96,_0x3eac72){var _0xd0c8b2={},_0xad7900={},_0xae8922={'count':0x0,'rows':[]};var _0x4fa512=_[_0xa424('0x2c')](db[_0xa424('0x2d')][_0xa424('0x2e')],function(_0x130984){return{'name':_0x130984[_0xa424('0x2f')],'type':_0x130984[_0xa424('0x30')]['key']};});_0xad7900[_0xa424('0x31')]=_[_0xa424('0x2c')](_0x4fa512,_0xa424('0x2a'));_0xad7900[_0xa424('0x32')]=_[_0xa424('0x33')](_0x350b96['query']);_0xad7900[_0xa424('0x34')]=_[_0xa424('0x35')](_0xad7900[_0xa424('0x31')],_0xad7900[_0xa424('0x32')]);_0xd0c8b2['attributes']=_[_0xa424('0x35')](_0xad7900[_0xa424('0x31')],qs[_0xa424('0x36')](_0x350b96[_0xa424('0x32')]['fields']));_0xd0c8b2[_0xa424('0x37')]=_0xd0c8b2[_0xa424('0x37')][_0xa424('0x38')]?_0xd0c8b2[_0xa424('0x37')]:_0xad7900[_0xa424('0x31')];if(!_0x350b96[_0xa424('0x32')][_0xa424('0x39')](_0xa424('0x3a'))){_0xd0c8b2['limit']=qs['limit'](_0x350b96[_0xa424('0x32')]['limit']);_0xd0c8b2[_0xa424('0x1d')]=qs[_0xa424('0x1d')](_0x350b96[_0xa424('0x32')][_0xa424('0x1d')]);}_0xd0c8b2['order']=qs[_0xa424('0x3b')](_0x350b96[_0xa424('0x32')][_0xa424('0x3b')]);_0xd0c8b2[_0xa424('0x3c')]=qs[_0xa424('0x34')](_[_0xa424('0x3d')](_0x350b96[_0xa424('0x32')],_0xad7900[_0xa424('0x34')]),_0x4fa512);if(_0x350b96[_0xa424('0x32')][_0xa424('0x3e')]){_0xd0c8b2[_0xa424('0x3c')]=_[_0xa424('0x3f')](_0xd0c8b2[_0xa424('0x3c')],{'$or':_[_0xa424('0x2c')](_0x4fa512,function(_0x3b0bf6){if(_0x3b0bf6[_0xa424('0x30')]!==_0xa424('0x40')){var _0x5539ea={};_0x5539ea[_0x3b0bf6[_0xa424('0x2a')]]={'$like':'%'+_0x350b96[_0xa424('0x32')]['filter']+'%'};return _0x5539ea;}})});}_0xd0c8b2=_[_0xa424('0x3f')]({},_0xd0c8b2,_0x350b96[_0xa424('0x41')]);var _0x3dda63={'where':_0xd0c8b2[_0xa424('0x3c')]};return db[_0xa424('0x2d')][_0xa424('0x20')](_0x3dda63)[_0xa424('0x28')](function(_0x30e756){_0xae8922[_0xa424('0x20')]=_0x30e756;if(_0x350b96[_0xa424('0x32')][_0xa424('0x42')]){_0xd0c8b2['include']=[{'all':!![]}];}return db[_0xa424('0x2d')][_0xa424('0x43')](_0xd0c8b2);})[_0xa424('0x28')](function(_0x2c05ed){_0xae8922[_0xa424('0x44')]=_0x2c05ed;return _0xae8922;})['then'](respondWithFilteredResult(_0x3eac72,_0xd0c8b2))['catch'](handleError(_0x3eac72,null));};exports[_0xa424('0x45')]=function(_0x3aefd9,_0x4251f4){var _0x200372={'raw':!![],'where':{'id':_0x3aefd9[_0xa424('0x46')]['id']}},_0x553a0c={};_0x553a0c[_0xa424('0x31')]=_[_0xa424('0x33')](db[_0xa424('0x2d')][_0xa424('0x2e')]);_0x553a0c[_0xa424('0x32')]=_[_0xa424('0x33')](_0x3aefd9[_0xa424('0x32')]);_0x553a0c[_0xa424('0x34')]=_[_0xa424('0x35')](_0x553a0c['model'],_0x553a0c[_0xa424('0x32')]);_0x200372[_0xa424('0x37')]=_[_0xa424('0x35')](_0x553a0c[_0xa424('0x31')],qs[_0xa424('0x36')](_0x3aefd9[_0xa424('0x32')]['fields']));_0x200372[_0xa424('0x37')]=_0x200372['attributes'][_0xa424('0x38')]?_0x200372[_0xa424('0x37')]:_0x553a0c[_0xa424('0x31')];if(_0x3aefd9['query'][_0xa424('0x42')]){_0x200372['include']=[{'all':!![]}];}_0x200372=_['merge']({},_0x200372,_0x3aefd9[_0xa424('0x41')]);return db['OpenchannelApplication'][_0xa424('0x47')](_0x200372)[_0xa424('0x28')](handleEntityNotFound(_0x4251f4,null))[_0xa424('0x28')](respondWithResult(_0x4251f4,null))[_0xa424('0x48')](handleError(_0x4251f4,null));};exports['create']=function(_0x427074,_0xe14e54){return db[_0xa424('0x2d')]['create'](_0x427074[_0xa424('0x49')],{})[_0xa424('0x28')](respondWithResult(_0xe14e54,0xc9))[_0xa424('0x48')](handleError(_0xe14e54,null));};exports[_0xa424('0x26')]=function(_0x323008,_0x147267){if(_0x323008[_0xa424('0x49')]['id']){delete _0x323008[_0xa424('0x49')]['id'];}return db['OpenchannelApplication'][_0xa424('0x47')]({'where':{'id':_0x323008[_0xa424('0x46')]['id']}})[_0xa424('0x28')](handleEntityNotFound(_0x147267,null))[_0xa424('0x28')](saveUpdates(_0x323008[_0xa424('0x49')],null))['then'](respondWithResult(_0x147267,null))[_0xa424('0x48')](handleError(_0x147267,null));};exports[_0xa424('0x27')]=function(_0x8ccea7,_0x3ce8ca){return db[_0xa424('0x2d')]['find']({'where':{'id':_0x8ccea7[_0xa424('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ce8ca,null))[_0xa424('0x28')](removeEntity(_0x3ce8ca,null))[_0xa424('0x48')](handleError(_0x3ce8ca,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6f85e67..3e13a80 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 _0x466d=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','OpenchannelApplication','openchannel_applications'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x466d,0x120));var _0xd466=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x466d[_0x3cea78];return _0x33b66b;};'use strict';var _=require(_0xd466('0x0'));var util=require('util');var logger=require(_0xd466('0x1'))(_0xd466('0x2'));var moment=require(_0xd466('0x3'));var BPromise=require(_0xd466('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd466('0x5'));var rimraf=require(_0xd466('0x6'));var config=require(_0xd466('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x4c1427,_0x3f1f1a){return _0x4c1427[_0xd466('0x8')](_0xd466('0x9'),attributes,{'tableName':_0xd466('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd466('0xb'),'collate':_0xd466('0xc')});}; \ No newline at end of file +var _0xabf4=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0x3a8d64,_0x264bb2){var _0x1d6bc2=function(_0x1d77de){while(--_0x1d77de){_0x3a8d64['push'](_0x3a8d64['shift']());}};_0x1d6bc2(++_0x264bb2);}(_0xabf4,0xeb));var _0x4abf=function(_0xcb7bc6,_0x2bed38){_0xcb7bc6=_0xcb7bc6-0x0;var _0x1c678e=_0xabf4[_0xcb7bc6];return _0x1c678e;};'use strict';var _=require('lodash');var util=require(_0x4abf('0x0'));var logger=require('../../config/logger')(_0x4abf('0x1'));var moment=require(_0x4abf('0x2'));var BPromise=require(_0x4abf('0x3'));var rp=require(_0x4abf('0x4'));var fs=require('fs');var path=require(_0x4abf('0x5'));var rimraf=require(_0x4abf('0x6'));var config=require(_0x4abf('0x7'));var attributes=require(_0x4abf('0x8'));module[_0x4abf('0x9')]=function(_0x84983,_0x34f2a8){return _0x84983['define']('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4abf('0xa'),'collate':_0x4abf('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 21167e0..88964a2 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 _0x2b67=['limit','debug','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','OpenchannelApplication','update','body','options','raw','attributes'];(function(_0x2322bc,_0x704522){var _0x451470=function(_0x11d45b){while(--_0x11d45b){_0x2322bc['push'](_0x2322bc['shift']());}};_0x451470(++_0x704522);}(_0x2b67,0x1a3));var _0x72b6=function(_0x41ceb5,_0x30a19a){_0x41ceb5=_0x41ceb5-0x0;var _0xc3e44f=_0x2b67[_0x41ceb5];return _0xc3e44f;};'use strict';var _=require(_0x72b6('0x0'));var util=require(_0x72b6('0x1'));var moment=require(_0x72b6('0x2'));var BPromise=require(_0x72b6('0x3'));var rs=require(_0x72b6('0x4'));var fs=require('fs');var Redis=require(_0x72b6('0x5'));var db=require(_0x72b6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x72b6('0x7'))(_0x72b6('0x8'));var config=require(_0x72b6('0x9'));var jayson=require(_0x72b6('0xa'));var client=jayson[_0x72b6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f3132,_0x4686af,_0x2bb51c){return new BPromise(function(_0x9725ef,_0x163b6b){return client[_0x72b6('0xc')](_0x5f3132,_0x2bb51c)[_0x72b6('0xd')](function(_0x50916b){logger[_0x72b6('0xe')](_0x72b6('0xf'),_0x4686af,'request\x20sent');logger['debug'](_0x72b6('0x10'),_0x4686af,'request\x20sent',JSON[_0x72b6('0x11')](_0x50916b));if(_0x50916b[_0x72b6('0x12')]){if(_0x50916b[_0x72b6('0x12')][_0x72b6('0x13')]===0x1f4){logger['error'](_0x72b6('0xf'),_0x4686af,_0x50916b[_0x72b6('0x12')][_0x72b6('0x14')]);return _0x163b6b(_0x50916b[_0x72b6('0x12')][_0x72b6('0x14')]);}logger[_0x72b6('0x12')](_0x72b6('0xf'),_0x4686af,_0x50916b['error'][_0x72b6('0x14')]);return _0x9725ef(_0x50916b['error'][_0x72b6('0x14')]);}else{logger['info'](_0x72b6('0xf'),_0x4686af,_0x72b6('0x15'));_0x9725ef(_0x50916b['result']['message']);}})[_0x72b6('0x16')](function(_0x9c8049){logger[_0x72b6('0x12')](_0x72b6('0xf'),_0x4686af,_0x9c8049);_0x163b6b(_0x9c8049);});});}exports['UpdateOpenchannelApplication']=function(_0x44a90c){var _0x12b222=this;return new Promise(function(_0x1de1e7,_0x1ae5ac){return db[_0x72b6('0x17')][_0x72b6('0x18')](_0x44a90c[_0x72b6('0x19')],{'raw':_0x44a90c[_0x72b6('0x1a')]?_0x44a90c[_0x72b6('0x1a')][_0x72b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a90c['options']?_0x44a90c[_0x72b6('0x1a')]['where']||null:null,'attributes':_0x44a90c[_0x72b6('0x1a')]?_0x44a90c[_0x72b6('0x1a')][_0x72b6('0x1c')]||null:null,'limit':_0x44a90c[_0x72b6('0x1a')]?_0x44a90c[_0x72b6('0x1a')][_0x72b6('0x1d')]||null:null})['then'](function(_0x19e06e){logger[_0x72b6('0xe')]('UpdateOpenchannelApplication',_0x44a90c);logger[_0x72b6('0x1e')](_0x72b6('0x1f'),_0x44a90c,JSON[_0x72b6('0x11')](_0x19e06e));_0x1de1e7(_0x19e06e);})[_0x72b6('0x16')](function(_0x2549cf){logger['error'](_0x72b6('0x1f'),_0x2549cf[_0x72b6('0x14')],_0x44a90c);_0x1ae5ac(_0x12b222[_0x72b6('0x12')](0x1f4,_0x2549cf[_0x72b6('0x14')]));});});}; \ No newline at end of file +var _0xf435=['raw','where','attributes','limit','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options'];(function(_0xef259b,_0x4f6d0f){var _0x2da8e9=function(_0x4cb82d){while(--_0x4cb82d){_0xef259b['push'](_0xef259b['shift']());}};_0x2da8e9(++_0x4f6d0f);}(_0xf435,0xfd));var _0x5f43=function(_0x939576,_0xf3c6bb){_0x939576=_0x939576-0x0;var _0x14f5b5=_0xf435[_0x939576];return _0x14f5b5;};'use strict';var _=require(_0x5f43('0x0'));var util=require(_0x5f43('0x1'));var moment=require(_0x5f43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f43('0x3'));var db=require(_0x5f43('0x4'))['db'];var utils=require(_0x5f43('0x5'));var logger=require(_0x5f43('0x6'))('rpc');var config=require(_0x5f43('0x7'));var jayson=require(_0x5f43('0x8'));var client=jayson['client'][_0x5f43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53571d,_0x48cc89,_0x251824){return new BPromise(function(_0x350bab,_0x108ba1){return client[_0x5f43('0xa')](_0x53571d,_0x251824)[_0x5f43('0xb')](function(_0x4ded05){logger[_0x5f43('0xc')](_0x5f43('0xd'),_0x48cc89,_0x5f43('0xe'));logger[_0x5f43('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x48cc89,_0x5f43('0xe'),JSON[_0x5f43('0x10')](_0x4ded05));if(_0x4ded05['error']){if(_0x4ded05[_0x5f43('0x11')][_0x5f43('0x12')]===0x1f4){logger[_0x5f43('0x11')](_0x5f43('0xd'),_0x48cc89,_0x4ded05['error'][_0x5f43('0x13')]);return _0x108ba1(_0x4ded05['error'][_0x5f43('0x13')]);}logger['error'](_0x5f43('0xd'),_0x48cc89,_0x4ded05['error']['message']);return _0x350bab(_0x4ded05['error'][_0x5f43('0x13')]);}else{logger[_0x5f43('0xc')](_0x5f43('0xd'),_0x48cc89,'request\x20sent');_0x350bab(_0x4ded05[_0x5f43('0x14')]['message']);}})['catch'](function(_0x14b660){logger[_0x5f43('0x11')](_0x5f43('0xd'),_0x48cc89,_0x14b660);_0x108ba1(_0x14b660);});});}exports[_0x5f43('0x15')]=function(_0x1fd848){var _0x51d7bc=this;return new Promise(function(_0x3da1d9,_0x1b86ef){return db[_0x5f43('0x16')][_0x5f43('0x17')](_0x1fd848[_0x5f43('0x18')],{'raw':_0x1fd848[_0x5f43('0x19')]?_0x1fd848[_0x5f43('0x19')][_0x5f43('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd848['options']?_0x1fd848[_0x5f43('0x19')][_0x5f43('0x1b')]||null:null,'attributes':_0x1fd848['options']?_0x1fd848[_0x5f43('0x19')][_0x5f43('0x1c')]||null:null,'limit':_0x1fd848[_0x5f43('0x19')]?_0x1fd848['options'][_0x5f43('0x1d')]||null:null})['then'](function(_0x33e850){logger[_0x5f43('0xc')](_0x5f43('0x15'),_0x1fd848);logger[_0x5f43('0xf')](_0x5f43('0x15'),_0x1fd848,JSON[_0x5f43('0x10')](_0x33e850));_0x3da1d9(_0x33e850);})[_0x5f43('0x1e')](function(_0x385917){logger[_0x5f43('0x11')](_0x5f43('0x15'),_0x385917['message'],_0x1fd848);_0x1b86ef(_0x51d7bc[_0x5f43('0x11')](0x1f4,_0x385917[_0x5f43('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index eb7f3e1..ad4743e 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 _0x44b1=['destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','openchannelinteraction:destroy'];(function(_0x4b7c13,_0x2c5239){var _0x37e4ec=function(_0x3e451b){while(--_0x3e451b){_0x4b7c13['push'](_0x4b7c13['shift']());}};_0x37e4ec(++_0x2c5239);}(_0x44b1,0x9f));var _0x144b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x44b1[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x144b('0x0'));var util=require(_0x144b('0x1'));var path=require('path');var timeout=require(_0x144b('0x2'));var express=require(_0x144b('0x3'));var router=express[_0x144b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x144b('0x5'));var interaction=require(_0x144b('0x6'));var config=require(_0x144b('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x144b('0x8')]('/',auth[_0x144b('0x9')](),controller['index']);router['get'](_0x144b('0xa'),auth[_0x144b('0x9')](),controller[_0x144b('0xb')]);router[_0x144b('0x8')](_0x144b('0xc'),auth[_0x144b('0x9')](),controller[_0x144b('0xd')]);router['get']('/:id/messages',auth[_0x144b('0x9')](),controller[_0x144b('0xe')]);router[_0x144b('0x8')](_0x144b('0xf'),auth[_0x144b('0x9')](),controller[_0x144b('0x10')]);router[_0x144b('0x11')]('/',auth['isAuthenticated'](),controller[_0x144b('0x12')]);router[_0x144b('0x11')](_0x144b('0x13'),auth[_0x144b('0x9')](),controller[_0x144b('0x14')]);router['post'](_0x144b('0x15'),auth['isAuthenticated'](),interaction[_0x144b('0x16')](_0x144b('0x17'),_0x144b('0x18')),controller['addTags']);router['put'](_0x144b('0xc'),auth[_0x144b('0x9')](),interaction[_0x144b('0x16')](_0x144b('0x17'),_0x144b('0x19')),controller['update']);router['delete'](_0x144b('0xc'),auth[_0x144b('0x9')](),interaction[_0x144b('0x16')]('openchannel',_0x144b('0x1a')),controller[_0x144b('0x1b')]);router[_0x144b('0x1c')](_0x144b('0x15'),auth[_0x144b('0x9')](),controller[_0x144b('0x1d')]);module[_0x144b('0x1e')]=router; \ No newline at end of file +var _0xd47b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','removeTags','exports','util','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd47b,0x13e));var _0xbd47=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0xd47b[_0x563af1];return _0x58fccb;};'use strict';var multer=require('multer');var util=require(_0xbd47('0x0'));var path=require(_0xbd47('0x1'));var timeout=require(_0xbd47('0x2'));var express=require('express');var router=express[_0xbd47('0x3')]();var fs_extra=require(_0xbd47('0x4'));var auth=require(_0xbd47('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd47('0x6'));var controller=require(_0xbd47('0x7'));router['get']('/',auth[_0xbd47('0x8')](),controller['index']);router['get'](_0xbd47('0x9'),auth[_0xbd47('0x8')](),controller[_0xbd47('0xa')]);router[_0xbd47('0xb')](_0xbd47('0xc'),auth[_0xbd47('0x8')](),controller[_0xbd47('0xd')]);router['get'](_0xbd47('0xe'),auth[_0xbd47('0x8')](),controller[_0xbd47('0xf')]);router[_0xbd47('0xb')]('/:id/download',auth[_0xbd47('0x8')](),controller[_0xbd47('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd47('0x11')]);router[_0xbd47('0x12')](_0xbd47('0xe'),auth['isAuthenticated'](),controller[_0xbd47('0x13')]);router[_0xbd47('0x12')](_0xbd47('0x14'),auth[_0xbd47('0x8')](),interaction['tracked']('openchannel',_0xbd47('0x15')),controller[_0xbd47('0x16')]);router[_0xbd47('0x17')](_0xbd47('0xc'),auth[_0xbd47('0x8')](),interaction[_0xbd47('0x18')]('openchannel',_0xbd47('0x19')),controller[_0xbd47('0x1a')]);router[_0xbd47('0x1b')]('/:id',auth[_0xbd47('0x8')](),interaction['tracked'](_0xbd47('0x1c'),_0xbd47('0x1d')),controller['destroy']);router[_0xbd47('0x1b')](_0xbd47('0x14'),auth[_0xbd47('0x8')](),controller[_0xbd47('0x1e')]);module[_0xbd47('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d1d1c8a..333519e 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 _0x061a=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x3cfaa3,_0x34f6c9){var _0x55a02c=function(_0x2606fd){while(--_0x2606fd){_0x3cfaa3['push'](_0x3cfaa3['shift']());}};_0x55a02c(++_0x34f6c9);}(_0x061a,0x13e));var _0xa061=function(_0xd5d43b,_0x361a08){_0xd5d43b=_0xd5d43b-0x0;var _0x1395cf=_0x061a[_0xd5d43b];return _0x1395cf;};'use strict';var Sequelize=require(_0xa061('0x0'));module[_0xa061('0x1')]={'closed':{'type':Sequelize[_0xa061('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa061('0x3')]},'disposition':{'type':Sequelize[_0xa061('0x4')]},'secondDisposition':{'type':Sequelize[_0xa061('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa061('0x4')]},'note':{'type':Sequelize[_0xa061('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xa061('0x4')]},'externalUrl':{'type':Sequelize[_0xa061('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa061('0x5')]('in',_0xa061('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa061('0x5')]('in',_0xa061('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa061('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa061('0x7')]}}; \ No newline at end of file +var _0xe87e=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xe87e,0x17d));var _0xee87=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xe87e[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0xee87('0x0'));module[_0xee87('0x1')]={'closed':{'type':Sequelize[_0xee87('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee87('0x3')]},'disposition':{'type':Sequelize[_0xee87('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee87('0x4')]},'note':{'type':Sequelize[_0xee87('0x4')]},'read1stAt':{'type':Sequelize[_0xee87('0x3')]},'threadId':{'type':Sequelize[_0xee87('0x4')]},'externalUrl':{'type':Sequelize[_0xee87('0x4')]},'lastMsgAt':{'type':Sequelize[_0xee87('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xee87('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee87('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xee87('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xee87('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xee87('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d2271e2..263127c 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 _0x1da7=['../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','getOptions','openchannel','query','catch','from','params','model','rawAttributes','filters','intersection','fields','attributes','length','includeAll','include','options','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','OpenchannelMessage','findAll','rows','addTags','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','direction','secret','read','Account','mkdirSync','Openchannel','Owner','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis'];(function(_0x481906,_0x28c7e4){var _0x3048e3=function(_0x2ebe05){while(--_0x2ebe05){_0x481906['push'](_0x481906['shift']());}};_0x3048e3(++_0x28c7e4);}(_0x1da7,0x1f4));var _0x71da=function(_0x3b6a84,_0x318b9b){_0x3b6a84=_0x3b6a84-0x0;var _0xbae34a=_0x1da7[_0x3b6a84];return _0xbae34a;};'use strict';var rimraf=require(_0x71da('0x0'));var zipdir=require(_0x71da('0x1'));var moment=require(_0x71da('0x2'));var util=require(_0x71da('0x3'));var path=require(_0x71da('0x4'));var ejs=require(_0x71da('0x5'));var fs=require('fs');var _=require(_0x71da('0x6'));var Redis=require(_0x71da('0x7'));var interaction=require(_0x71da('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x71da('0x9'))('api');var config=require(_0x71da('0xa'));var db=require(_0x71da('0xb'))['db'];config[_0x71da('0xc')]=_[_0x71da('0xd')](config['redis'],{'host':_0x71da('0xe'),'port':0x18eb});var socket=require(_0x71da('0xf'))(new Redis(config[_0x71da('0xc')]));require(_0x71da('0x10'))[_0x71da('0x11')](socket);function respondWithStatusCode(_0x5d5a89,_0x514395){_0x514395=_0x514395||0xcc;return function(_0x2cf963){if(_0x2cf963){return _0x5d5a89['sendStatus'](_0x514395);}return _0x5d5a89[_0x71da('0x12')](_0x514395)['end']();};}function respondWithResult(_0x32aaef,_0x3272c6){_0x3272c6=_0x3272c6||0xc8;return function(_0x5a0472){if(_0x5a0472){return _0x32aaef[_0x71da('0x12')](_0x3272c6)[_0x71da('0x13')](_0x5a0472);}};}function respondWithFilteredResult(_0x105c8c,_0x11d5ef){return function(_0x1d19e2){if(_0x1d19e2){var _0x17c117=typeof _0x11d5ef[_0x71da('0x14')]==='undefined'&&typeof _0x11d5ef[_0x71da('0x15')]===_0x71da('0x16');var _0x2346ab=_0x1d19e2[_0x71da('0x17')];var _0x411bfb=_0x17c117?0x0:_0x11d5ef[_0x71da('0x14')];var _0x5ae70c=_0x17c117?_0x1d19e2[_0x71da('0x17')]:_0x11d5ef[_0x71da('0x14')]+_0x11d5ef[_0x71da('0x15')];var _0x9f70da;if(_0x5ae70c>=_0x2346ab){_0x5ae70c=_0x2346ab;_0x9f70da=0xc8;}else{_0x9f70da=0xce;}_0x105c8c[_0x71da('0x12')](_0x9f70da);return _0x105c8c[_0x71da('0x18')](_0x71da('0x19'),_0x411bfb+'-'+_0x5ae70c+'/'+_0x2346ab)[_0x71da('0x13')](_0x1d19e2);}return null;};}function saveUpdates(_0x1e8fd1){return function(_0x40648b){if(_0x40648b){return _0x40648b[_0x71da('0x1a')](_0x1e8fd1)[_0x71da('0x1b')](function(_0x533806){return _0x533806;});}return null;};}function removeEntity(_0xeb626){return function(_0x5b3fae){if(_0x5b3fae){return _0x5b3fae[_0x71da('0x1c')]()['then'](function(){_0xeb626[_0x71da('0x12')](0xcc)[_0x71da('0x1d')]();});}};}function handleEntityNotFound(_0x428a40){return function(_0x50fb54){if(!_0x50fb54){_0x428a40[_0x71da('0x1e')](0x194);}return _0x50fb54;};}function handleError(_0x13b162,_0x108687){_0x108687=_0x108687||0x1f4;return function(_0xc307ce){logger['error'](_0xc307ce[_0x71da('0x1f')]);if(_0xc307ce[_0x71da('0x20')]){delete _0xc307ce[_0x71da('0x20')];}_0x13b162[_0x71da('0x12')](_0x108687)[_0x71da('0x21')](_0xc307ce);};}exports[_0x71da('0x22')]=function(_0x2cf1b1,_0x439d94){var _0x35a189={};var _0x36eda7=_[_0x71da('0x23')](db[_0x71da('0x24')]['rawAttributes'],function(_0x46191e){return{'name':_0x46191e[_0x71da('0x25')],'type':_0x46191e[_0x71da('0x26')]['key']};});_0x35a189=qs[_0x71da('0x27')](_0x36eda7,_0x2cf1b1);return interaction['findAll'](_0x71da('0x28'),_0x2cf1b1[_0x71da('0x29')],_0x2cf1b1['user'],_0x35a189,_0x36eda7)[_0x71da('0x1b')](respondWithFilteredResult(_0x439d94,_0x35a189))[_0x71da('0x2a')](handleError(_0x439d94,null));};exports['show']=function(_0xf228cb,_0x49d7c0){var _0x276130={};if(_0xf228cb[_0x71da('0x29')][_0x71da('0x26')]&&_0xf228cb[_0x71da('0x29')]['type']===_0x71da('0x2b')){_0x276130[_0x71da('0x2b')]=_0xf228cb['params']['id'];}else{_0x276130['id']=_0xf228cb[_0x71da('0x2c')]['id'];}var _0x2b9e48={'raw':![],'where':_0x276130},_0x3deef7={};_0x3deef7[_0x71da('0x2d')]=_['keys'](db[_0x71da('0x24')][_0x71da('0x2e')]);_0x3deef7[_0x71da('0x29')]=_['keys'](_0xf228cb[_0x71da('0x29')]);_0x3deef7[_0x71da('0x2f')]=_[_0x71da('0x30')](_0x3deef7['model'],_0x3deef7[_0x71da('0x29')]);_0x2b9e48['attributes']=_[_0x71da('0x30')](_0x3deef7[_0x71da('0x2d')],qs[_0x71da('0x31')](_0xf228cb[_0x71da('0x29')][_0x71da('0x31')]));_0x2b9e48[_0x71da('0x32')]=_0x2b9e48[_0x71da('0x32')][_0x71da('0x33')]?_0x2b9e48[_0x71da('0x32')]:_0x3deef7[_0x71da('0x2d')];if(_0xf228cb['query'][_0x71da('0x34')]){_0x2b9e48[_0x71da('0x35')]=[{'all':!![]}];}_0x2b9e48=_['merge']({},_0x2b9e48,_0xf228cb[_0x71da('0x36')]);return db[_0x71da('0x24')]['find'](_0x2b9e48)['then'](handleEntityNotFound(_0x49d7c0,null))[_0x71da('0x1b')](respondWithResult(_0x49d7c0,null))['catch'](handleError(_0x49d7c0,null));};exports[_0x71da('0x37')]=function(_0x3fbee4,_0x49f16c){return db[_0x71da('0x24')][_0x71da('0x37')](_0x3fbee4[_0x71da('0x38')],{})[_0x71da('0x1b')](respondWithResult(_0x49f16c,0xc9))['catch'](handleError(_0x49f16c,null));};exports['update']=function(_0x5d724b,_0x4fea2b){if(_0x5d724b[_0x71da('0x38')]['id']){delete _0x5d724b[_0x71da('0x38')]['id'];}return db[_0x71da('0x24')][_0x71da('0x39')]({'where':{'id':_0x5d724b[_0x71da('0x2c')]['id']}})[_0x71da('0x1b')](handleEntityNotFound(_0x4fea2b,null))[_0x71da('0x1b')](saveUpdates(_0x5d724b['body'],null))[_0x71da('0x1b')](respondWithResult(_0x4fea2b,null))['catch'](handleError(_0x4fea2b,null));};exports['destroy']=function(_0x1d0efb,_0x4e589c){return db['OpenchannelInteraction'][_0x71da('0x39')]({'where':{'id':_0x1d0efb['params']['id']}})[_0x71da('0x1b')](handleEntityNotFound(_0x4e589c,null))[_0x71da('0x1b')](removeEntity(_0x4e589c,null))['catch'](handleError(_0x4e589c,null));};exports[_0x71da('0x3a')]=function(_0x2ae06b,_0x21a6d3){return db[_0x71da('0x24')]['describe']()[_0x71da('0x1b')](respondWithResult(_0x21a6d3,null))[_0x71da('0x2a')](handleError(_0x21a6d3,null));};exports[_0x71da('0x3b')]=function(_0x32fb00,_0x53138b){return db['OpenchannelMessage'][_0x71da('0x39')]({'where':{'id':_0x32fb00[_0x71da('0x2c')]['id']}})[_0x71da('0x1b')](handleEntityNotFound(_0x53138b,null))[_0x71da('0x1b')](function(_0x1be219){if(_0x1be219){return _0x1be219[_0x71da('0x3b')](_0x32fb00[_0x71da('0x38')][_0x71da('0x3c')],_[_0x71da('0x3d')](_0x32fb00[_0x71da('0x38')],[_0x71da('0x3c'),'id'])||{});}})[_0x71da('0x1b')](respondWithResult(_0x53138b,null))[_0x71da('0x2a')](handleError(_0x53138b,null));};exports[_0x71da('0x3e')]=function(_0x48dbff,_0x234710){var _0x1bab5c={'raw':![],'where':{}};var _0x46a97e={};var _0x22c708={'count':0x0,'rows':[]};return db[_0x71da('0x24')][_0x71da('0x3f')]({'where':{'id':_0x48dbff[_0x71da('0x2c')]['id']}})[_0x71da('0x1b')](handleEntityNotFound(_0x234710,null))['then'](function(_0x2112e1){if(_0x2112e1){_0x46a97e[_0x71da('0x2d')]=_[_0x71da('0x40')](db['OpenchannelMessage'][_0x71da('0x2e')]);_0x46a97e[_0x71da('0x29')]=_[_0x71da('0x40')](_0x48dbff['query']);_0x46a97e[_0x71da('0x2f')]=_['intersection'](_0x46a97e[_0x71da('0x2d')],_0x46a97e[_0x71da('0x29')]);_0x1bab5c[_0x71da('0x32')]=_[_0x71da('0x30')](_0x46a97e['model'],qs[_0x71da('0x31')](_0x48dbff[_0x71da('0x29')][_0x71da('0x31')]));_0x1bab5c['attributes']=_0x1bab5c[_0x71da('0x32')][_0x71da('0x33')]?_0x1bab5c[_0x71da('0x32')]:_0x46a97e[_0x71da('0x2d')];if(!_0x48dbff[_0x71da('0x29')][_0x71da('0x41')](_0x71da('0x42'))){_0x1bab5c[_0x71da('0x15')]=qs[_0x71da('0x15')](_0x48dbff['query'][_0x71da('0x15')]);_0x1bab5c['offset']=qs[_0x71da('0x14')](_0x48dbff[_0x71da('0x29')]['offset']);}_0x1bab5c[_0x71da('0x43')]=qs['sort'](_0x48dbff[_0x71da('0x29')][_0x71da('0x44')]);_0x1bab5c[_0x71da('0x45')]=qs[_0x71da('0x2f')](_[_0x71da('0x46')](_0x48dbff['query'],_0x46a97e[_0x71da('0x2f')]));_0x1bab5c[_0x71da('0x45')]['OpenchannelInteractionId']=_0x2112e1['id'];if(_0x48dbff[_0x71da('0x29')][_0x71da('0x47')]){_0x1bab5c[_0x71da('0x45')]=_[_0x71da('0x48')](_0x1bab5c[_0x71da('0x45')],{'$or':_['map'](_0x1bab5c[_0x71da('0x32')],function(_0x75d23a){var _0x4e1502={};_0x4e1502[_0x75d23a]={'$like':'%'+_0x48dbff[_0x71da('0x29')]['filter']+'%'};return _0x4e1502;})});}if(_0x48dbff[_0x71da('0x29')][_0x71da('0x49')]){var _0x2c47ed=_0x48dbff[_0x71da('0x29')]['$gte'][_0x71da('0x4a')](',');var _0x433c78={};_0x433c78[_0x2c47ed[0x0]]={'$gte':moment(_0x2c47ed[0x1])[_0x71da('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1bab5c['where']=_['merge'](_0x1bab5c[_0x71da('0x45')],_0x433c78);}_0x1bab5c=_[_0x71da('0x48')]({},_0x1bab5c,_0x48dbff[_0x71da('0x36')]);return db[_0x71da('0x4c')]['count']({'where':_0x1bab5c[_0x71da('0x45')]})[_0x71da('0x1b')](function(_0x574119){_0x22c708[_0x71da('0x17')]=_0x574119;if(_0x48dbff[_0x71da('0x29')]['includeAll']){_0x1bab5c[_0x71da('0x35')]=[{'all':!![]}];}return db[_0x71da('0x4c')][_0x71da('0x4d')](_0x1bab5c);})[_0x71da('0x1b')](function(_0x4a88ad){_0x22c708[_0x71da('0x4e')]=_0x4a88ad;return _0x22c708;});}})['then'](respondWithFilteredResult(_0x234710,_0x1bab5c))[_0x71da('0x2a')](handleError(_0x234710,null));};exports[_0x71da('0x4f')]=function(_0x81a90b,_0x153b46){return db[_0x71da('0x24')]['find']({'where':{'id':_0x81a90b[_0x71da('0x2c')]['id']}})[_0x71da('0x1b')](handleEntityNotFound(_0x153b46,null))[_0x71da('0x1b')](function(_0x333493){if(_0x333493){return _0x333493['setTags'](_0x81a90b['body'][_0x71da('0x3c')],_['omit'](_0x81a90b['body'],[_0x71da('0x3c'),'id'])||{})['spread'](function(){return db[_0x71da('0x50')][_0x71da('0x4d')]({'attributes':['id',_0x71da('0x20'),'color'],'where':{'id':_0x81a90b[_0x71da('0x38')][_0x71da('0x3c')]}});})[_0x71da('0x1b')](function(_0xc887ec){socket[_0x71da('0x51')](_0x71da('0x52'),{'id':Number(_0x81a90b[_0x71da('0x2c')]['id']),'tags':_0xc887ec||[]});return{'id':Number(_0x81a90b['params']['id']),'tags':_0xc887ec||[]};});}})[_0x71da('0x1b')](respondWithResult(_0x153b46,null))[_0x71da('0x2a')](handleError(_0x153b46,null));};exports[_0x71da('0x53')]=function(_0x1b0e59,_0x2fa7a3){return db['OpenchannelInteraction'][_0x71da('0x39')]({'where':{'id':_0x1b0e59[_0x71da('0x2c')]['id']}})[_0x71da('0x1b')](handleEntityNotFound(_0x2fa7a3,null))[_0x71da('0x1b')](function(_0x5cdc2e){if(_0x5cdc2e){return _0x5cdc2e[_0x71da('0x53')](_0x1b0e59[_0x71da('0x29')][_0x71da('0x3c')]);}})[_0x71da('0x1b')](respondWithStatusCode(_0x2fa7a3,null))[_0x71da('0x2a')](handleError(_0x2fa7a3,null));};exports[_0x71da('0x54')]=function(_0x1ef705,_0x175f9e){var _0x40f821=moment()[_0x71da('0x55')]()[_0x71da('0x56')]();var _0x323455=path[_0x71da('0x57')](config['root'],_0x71da('0x58'),'files',_0x71da('0x59'));var _0xe189cd=path['join'](config['root'],_0x71da('0x58'),_0x71da('0x5a'),_0x71da('0x5b'));var _0x4e8126=path[_0x71da('0x57')](_0x323455,_0x40f821);var _0x342ecd=util[_0x71da('0x4b')](_0x71da('0x5c'),_0x1ef705['params']['id'],_0x40f821);var _0x44a557=path['join'](_0x323455,_0x342ecd);var _0x45ba64=[];_0x45ba64[_0x71da('0x5d')]({'model':db[_0x71da('0x5e')],'as':_0x71da('0x5e'),'attributes':['id',_0x71da('0x5f')],'raw':!![]});_0x45ba64['push']({'model':db[_0x71da('0x60')],'as':_0x71da('0x61'),'attributes':['id',_0x71da('0x62'),_0x71da('0x63')],'raw':!![]});if(_0x1ef705[_0x71da('0x29')][_0x71da('0x5b')]){_0x45ba64['push']({'model':db[_0x71da('0x64')],'as':'Attachment','raw':!![]});}var _0x34b7bf=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x71da('0x38'),'createdAt',_0x71da('0x65'),_0x71da('0x66'),_0x71da('0x67')],'include':_0x45ba64}];_0x34b7bf[_0x71da('0x5d')]({'model':db['OpenchannelAccount'],'as':_0x71da('0x68'),'attributes':['id',_0x71da('0x20')]});_0x34b7bf[_0x71da('0x5d')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x71da('0x24')]['find']({'where':{'id':_0x1ef705['params']['id']},'include':_0x34b7bf})[_0x71da('0x1b')](handleEntityNotFound(_0x175f9e,null))['then'](function(_0x51c0c0){if(_0x51c0c0){var _0x59270a=_0x51c0c0['get']({'plain':!![]});fs[_0x71da('0x69')](_0x4e8126);var _0x223334={'channel':_0x71da('0x6a'),'account':_0x59270a['Account'][_0x71da('0x20')],'agent':_0x59270a[_0x71da('0x6b')]?_0x59270a[_0x71da('0x6b')][_0x71da('0x5f')]:'N.A.','createdAt':moment(_0x59270a['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x71da('0x56')](),'closedAt':_0x59270a[_0x71da('0x6c')]?moment(_0x59270a[_0x71da('0x6d')])[_0x71da('0x4b')](_0x71da('0x6e'))[_0x71da('0x56')]():'','disposition':_0x59270a['disposition'],'visibility':_0x59270a['threadId']?_0x71da('0x6f'):_0x71da('0x70'),'messages':_(_0x59270a[_0x71da('0x71')])['filter']({'secret':![]})[_0x71da('0x23')](function(_0x4a9066){if(_0x4a9066[_0x71da('0x64')]){var _0xb26835=path[_0x71da('0x57')](_0xe189cd,_0x4a9066[_0x71da('0x64')][_0x71da('0x72')]);if(fs[_0x71da('0x73')](_0xb26835)){fs[_0x71da('0x74')](_0xb26835)[_0x71da('0x75')](fs[_0x71da('0x76')](path['join'](_0x4e8126,_0x4a9066[_0x71da('0x64')][_0x71da('0x72')])));}}return{'date':moment(_0x4a9066['createdAt'])[_0x71da('0x4b')](_0x71da('0x6e'))[_0x71da('0x56')](),'sender':_0x4a9066['direction']===_0x71da('0x77')?_0x4a9066[_0x71da('0x5e')]?_0x4a9066[_0x71da('0x5e')]['fullname']:'System':_0x4a9066['Contact'][_0x71da('0x62')]+(_0x4a9066[_0x71da('0x61')][_0x71da('0x63')]?'\x20'+_0x4a9066[_0x71da('0x61')][_0x71da('0x63')]:''),'body':_0x4a9066[_0x71da('0x64')]?_0x4a9066[_0x71da('0x64')][_0x71da('0x72')]:_0x4a9066[_0x71da('0x38')],'direction':_0x4a9066[_0x71da('0x65')]===_0x71da('0x77')?'A':'C','secret':_0x4a9066[_0x71da('0x66')],'read':_0x4a9066[_0x71da('0x67')],'attachment':_0x4a9066[_0x71da('0x64')]};})['value']()};return ejs[_0x71da('0x78')](path[_0x71da('0x57')](config['root'],_0x71da('0x58'),'views',_0x71da('0x79')),{'interaction':_0x223334})[_0x71da('0x1b')](function(_0xb57b16){var _0x5080d6=path[_0x71da('0x57')](_0x4e8126,_0x71da('0x7a')+_0x59270a['id']+'-'+_0x40f821+_0x71da('0x7b'));var _0x3ca1ff={'path':_0x5080d6,'channel':_0x71da('0x6a'),'interactionId':_0x59270a['id']};return pdf['createPdfFromHTML'](_0xb57b16,_0x3ca1ff);})[_0x71da('0x1b')](function(){return new Promise(function(_0xa8a4a4,_0x49608b){zipdir(_0x4e8126,{'saveTo':_0x44a557},function(_0x1b5334,_0x479427){if(_0x1b5334)return _0x49608b(_0x1b5334);return _0xa8a4a4(_0x479427);});})[_0x71da('0x1b')](function(){return new Promise(function(_0x4b0739,_0x3d2816){rimraf(_0x4e8126,function(_0x5bb5b4){if(_0x5bb5b4)_0x3d2816(_0x5bb5b4);return _0x4b0739();});});})[_0x71da('0x1b')](function(){return _0x175f9e[_0x71da('0x54')](_0x44a557,_0x342ecd,function(_0x4466d4){if(_0x4466d4){logger[_0x71da('0x7c')](_0x71da('0x7d'),_0x4466d4);}else{fs[_0x71da('0x7e')](_0x44a557);}});});});}else{return _0x175f9e[_0x71da('0x1e')](0xc8);}})[_0x71da('0x2a')](handleError(_0x175f9e,null));}; \ No newline at end of file +var _0x472f=['rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','createdAt','closed','disposition','threadId','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','read','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','from','params','model','keys','OpenchannelInteraction','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','ids','omit','findOne','OpenchannelMessage','hasOwnProperty','limit','sort','pick','filters','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a908f,_0x388b9c){var _0x566f2c=function(_0x5821be){while(--_0x5821be){_0x4a908f['push'](_0x4a908f['shift']());}};_0x566f2c(++_0x388b9c);}(_0x472f,0xb2));var _0xf472=function(_0x5929ab,_0x1a488c){_0x5929ab=_0x5929ab-0x0;var _0x8e793e=_0x472f[_0x5929ab];return _0x8e793e;};'use strict';var rimraf=require(_0xf472('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf472('0x1'));var util=require(_0xf472('0x2'));var path=require(_0xf472('0x3'));var ejs=require(_0xf472('0x4'));var fs=require('fs');var _=require(_0xf472('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf472('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf472('0x7'));var config=require(_0xf472('0x8'));var db=require(_0xf472('0x9'))['db'];config[_0xf472('0xa')]=_[_0xf472('0xb')](config['redis'],{'host':_0xf472('0xc'),'port':0x18eb});var socket=require(_0xf472('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0xa772b6,_0x17aee8){_0x17aee8=_0x17aee8||0xcc;return function(_0x4f3589){if(_0x4f3589){return _0xa772b6[_0xf472('0xe')](_0x17aee8);}return _0xa772b6[_0xf472('0xf')](_0x17aee8)[_0xf472('0x10')]();};}function respondWithResult(_0x2fe5a6,_0x5e8fc8){_0x5e8fc8=_0x5e8fc8||0xc8;return function(_0x175333){if(_0x175333){return _0x2fe5a6['status'](_0x5e8fc8)[_0xf472('0x11')](_0x175333);}};}function respondWithFilteredResult(_0x3db5ca,_0x222af2){return function(_0x36e758){if(_0x36e758){var _0x554f79=typeof _0x222af2[_0xf472('0x12')]===_0xf472('0x13')&&typeof _0x222af2['limit']===_0xf472('0x13');var _0xd857ce=_0x36e758[_0xf472('0x14')];var _0x5decbf=_0x554f79?0x0:_0x222af2[_0xf472('0x12')];var _0x21e531=_0x554f79?_0x36e758[_0xf472('0x14')]:_0x222af2[_0xf472('0x12')]+_0x222af2['limit'];var _0x422a35;if(_0x21e531>=_0xd857ce){_0x21e531=_0xd857ce;_0x422a35=0xc8;}else{_0x422a35=0xce;}_0x3db5ca[_0xf472('0xf')](_0x422a35);return _0x3db5ca[_0xf472('0x15')](_0xf472('0x16'),_0x5decbf+'-'+_0x21e531+'/'+_0xd857ce)[_0xf472('0x11')](_0x36e758);}return null;};}function saveUpdates(_0x20af35){return function(_0x3acfaf){if(_0x3acfaf){return _0x3acfaf[_0xf472('0x17')](_0x20af35)[_0xf472('0x18')](function(_0x26d2c9){return _0x26d2c9;});}return null;};}function removeEntity(_0x42d4f4){return function(_0x5bb035){if(_0x5bb035){return _0x5bb035['destroy']()[_0xf472('0x18')](function(){_0x42d4f4['status'](0xcc)[_0xf472('0x10')]();});}};}function handleEntityNotFound(_0x1c8495){return function(_0x545d08){if(!_0x545d08){_0x1c8495[_0xf472('0xe')](0x194);}return _0x545d08;};}function handleError(_0x55af5b,_0x328225){_0x328225=_0x328225||0x1f4;return function(_0x1ffbfa){logger[_0xf472('0x19')](_0x1ffbfa['stack']);if(_0x1ffbfa[_0xf472('0x1a')]){delete _0x1ffbfa[_0xf472('0x1a')];}_0x55af5b['status'](_0x328225)[_0xf472('0x1b')](_0x1ffbfa);};}exports[_0xf472('0x1c')]=function(_0x2547ee,_0x35c05c){var _0xe83699={};var _0x306267=_[_0xf472('0x1d')](db['OpenchannelInteraction'][_0xf472('0x1e')],function(_0x1324d4){return{'name':_0x1324d4[_0xf472('0x1f')],'type':_0x1324d4[_0xf472('0x20')][_0xf472('0x21')]};});_0xe83699=qs[_0xf472('0x22')](_0x306267,_0x2547ee);return interaction[_0xf472('0x23')]('openchannel',_0x2547ee[_0xf472('0x24')],_0x2547ee['user'],_0xe83699,_0x306267)[_0xf472('0x18')](respondWithFilteredResult(_0x35c05c,_0xe83699))['catch'](handleError(_0x35c05c,null));};exports['show']=function(_0x235c06,_0x39bfb7){var _0x827d8a={};if(_0x235c06[_0xf472('0x24')]['type']&&_0x235c06['query'][_0xf472('0x20')]===_0xf472('0x25')){_0x827d8a[_0xf472('0x25')]=_0x235c06[_0xf472('0x26')]['id'];}else{_0x827d8a['id']=_0x235c06['params']['id'];}var _0x23c2b9={'raw':![],'where':_0x827d8a},_0x2246fa={};_0x2246fa[_0xf472('0x27')]=_[_0xf472('0x28')](db[_0xf472('0x29')][_0xf472('0x1e')]);_0x2246fa[_0xf472('0x24')]=_['keys'](_0x235c06[_0xf472('0x24')]);_0x2246fa['filters']=_[_0xf472('0x2a')](_0x2246fa[_0xf472('0x27')],_0x2246fa[_0xf472('0x24')]);_0x23c2b9[_0xf472('0x2b')]=_['intersection'](_0x2246fa[_0xf472('0x27')],qs[_0xf472('0x2c')](_0x235c06['query'][_0xf472('0x2c')]));_0x23c2b9['attributes']=_0x23c2b9[_0xf472('0x2b')][_0xf472('0x2d')]?_0x23c2b9[_0xf472('0x2b')]:_0x2246fa['model'];if(_0x235c06['query'][_0xf472('0x2e')]){_0x23c2b9[_0xf472('0x2f')]=[{'all':!![]}];}_0x23c2b9=_[_0xf472('0x30')]({},_0x23c2b9,_0x235c06[_0xf472('0x31')]);return db[_0xf472('0x29')][_0xf472('0x32')](_0x23c2b9)['then'](handleEntityNotFound(_0x39bfb7,null))[_0xf472('0x18')](respondWithResult(_0x39bfb7,null))[_0xf472('0x33')](handleError(_0x39bfb7,null));};exports[_0xf472('0x34')]=function(_0x214481,_0x4648fd){return db[_0xf472('0x29')][_0xf472('0x34')](_0x214481['body'],{})['then'](respondWithResult(_0x4648fd,0xc9))[_0xf472('0x33')](handleError(_0x4648fd,null));};exports['update']=function(_0x5c14b2,_0x42ff93){if(_0x5c14b2[_0xf472('0x35')]['id']){delete _0x5c14b2[_0xf472('0x35')]['id'];}return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0x5c14b2[_0xf472('0x26')]['id']}})['then'](handleEntityNotFound(_0x42ff93,null))['then'](saveUpdates(_0x5c14b2[_0xf472('0x35')],null))[_0xf472('0x18')](respondWithResult(_0x42ff93,null))['catch'](handleError(_0x42ff93,null));};exports[_0xf472('0x36')]=function(_0x47c36e,_0x2a55b7){return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0x47c36e[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x2a55b7,null))['then'](removeEntity(_0x2a55b7,null))['catch'](handleError(_0x2a55b7,null));};exports[_0xf472('0x37')]=function(_0x492717,_0x41da0d){return db[_0xf472('0x29')][_0xf472('0x37')]()[_0xf472('0x18')](respondWithResult(_0x41da0d,null))[_0xf472('0x33')](handleError(_0x41da0d,null));};exports['addMessage']=function(_0x274519,_0x197486){return db['OpenchannelMessage'][_0xf472('0x32')]({'where':{'id':_0x274519[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x197486,null))['then'](function(_0x1bc293){if(_0x1bc293){return _0x1bc293['addMessage'](_0x274519[_0xf472('0x35')][_0xf472('0x38')],_[_0xf472('0x39')](_0x274519[_0xf472('0x35')],[_0xf472('0x38'),'id'])||{});}})[_0xf472('0x18')](respondWithResult(_0x197486,null))['catch'](handleError(_0x197486,null));};exports['getMessages']=function(_0x465bf1,_0x5a2864){var _0x4f82d9={'raw':![],'where':{}};var _0x4171dc={};var _0x1f8059={'count':0x0,'rows':[]};return db[_0xf472('0x29')][_0xf472('0x3a')]({'where':{'id':_0x465bf1[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x5a2864,null))['then'](function(_0x15a263){if(_0x15a263){_0x4171dc[_0xf472('0x27')]=_[_0xf472('0x28')](db[_0xf472('0x3b')][_0xf472('0x1e')]);_0x4171dc[_0xf472('0x24')]=_[_0xf472('0x28')](_0x465bf1[_0xf472('0x24')]);_0x4171dc['filters']=_[_0xf472('0x2a')](_0x4171dc[_0xf472('0x27')],_0x4171dc[_0xf472('0x24')]);_0x4f82d9[_0xf472('0x2b')]=_[_0xf472('0x2a')](_0x4171dc['model'],qs[_0xf472('0x2c')](_0x465bf1['query'][_0xf472('0x2c')]));_0x4f82d9['attributes']=_0x4f82d9[_0xf472('0x2b')][_0xf472('0x2d')]?_0x4f82d9['attributes']:_0x4171dc[_0xf472('0x27')];if(!_0x465bf1[_0xf472('0x24')][_0xf472('0x3c')]('nolimit')){_0x4f82d9[_0xf472('0x3d')]=qs[_0xf472('0x3d')](_0x465bf1[_0xf472('0x24')][_0xf472('0x3d')]);_0x4f82d9['offset']=qs[_0xf472('0x12')](_0x465bf1[_0xf472('0x24')]['offset']);}_0x4f82d9['order']=qs[_0xf472('0x3e')](_0x465bf1[_0xf472('0x24')][_0xf472('0x3e')]);_0x4f82d9['where']=qs['filters'](_[_0xf472('0x3f')](_0x465bf1[_0xf472('0x24')],_0x4171dc[_0xf472('0x40')]));_0x4f82d9[_0xf472('0x41')][_0xf472('0x42')]=_0x15a263['id'];if(_0x465bf1[_0xf472('0x24')][_0xf472('0x43')]){_0x4f82d9[_0xf472('0x41')]=_[_0xf472('0x30')](_0x4f82d9[_0xf472('0x41')],{'$or':_['map'](_0x4f82d9[_0xf472('0x2b')],function(_0x15234e){var _0x26316a={};_0x26316a[_0x15234e]={'$like':'%'+_0x465bf1[_0xf472('0x24')][_0xf472('0x43')]+'%'};return _0x26316a;})});}if(_0x465bf1[_0xf472('0x24')][_0xf472('0x44')]){var _0x5cc6bf=_0x465bf1[_0xf472('0x24')]['$gte'][_0xf472('0x45')](',');var _0x342501={};_0x342501[_0x5cc6bf[0x0]]={'$gte':moment(_0x5cc6bf[0x1])[_0xf472('0x46')](_0xf472('0x47'))};_0x4f82d9[_0xf472('0x41')]=_[_0xf472('0x30')](_0x4f82d9['where'],_0x342501);}_0x4f82d9=_[_0xf472('0x30')]({},_0x4f82d9,_0x465bf1[_0xf472('0x31')]);return db[_0xf472('0x3b')][_0xf472('0x14')]({'where':_0x4f82d9[_0xf472('0x41')]})[_0xf472('0x18')](function(_0x13e4af){_0x1f8059[_0xf472('0x14')]=_0x13e4af;if(_0x465bf1[_0xf472('0x24')][_0xf472('0x2e')]){_0x4f82d9['include']=[{'all':!![]}];}return db[_0xf472('0x3b')]['findAll'](_0x4f82d9);})[_0xf472('0x18')](function(_0x8ba79a){_0x1f8059[_0xf472('0x48')]=_0x8ba79a;return _0x1f8059;});}})['then'](respondWithFilteredResult(_0x5a2864,_0x4f82d9))[_0xf472('0x33')](handleError(_0x5a2864,null));};exports[_0xf472('0x49')]=function(_0x19f70c,_0x58a3ab){return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0x19f70c[_0xf472('0x26')]['id']}})['then'](handleEntityNotFound(_0x58a3ab,null))[_0xf472('0x18')](function(_0x394c71){if(_0x394c71){return _0x394c71[_0xf472('0x4a')](_0x19f70c[_0xf472('0x35')][_0xf472('0x38')],_['omit'](_0x19f70c[_0xf472('0x35')],['ids','id'])||{})[_0xf472('0x4b')](function(){return db[_0xf472('0x4c')][_0xf472('0x23')]({'attributes':['id','name',_0xf472('0x4d')],'where':{'id':_0x19f70c[_0xf472('0x35')][_0xf472('0x38')]}});})[_0xf472('0x18')](function(_0x3c012f){socket[_0xf472('0x4e')](_0xf472('0x4f'),{'id':Number(_0x19f70c[_0xf472('0x26')]['id']),'tags':_0x3c012f||[]});return{'id':Number(_0x19f70c['params']['id']),'tags':_0x3c012f||[]};});}})['then'](respondWithResult(_0x58a3ab,null))['catch'](handleError(_0x58a3ab,null));};exports[_0xf472('0x50')]=function(_0xf5b59,_0x5ce603){return db[_0xf472('0x29')][_0xf472('0x32')]({'where':{'id':_0xf5b59[_0xf472('0x26')]['id']}})[_0xf472('0x18')](handleEntityNotFound(_0x5ce603,null))[_0xf472('0x18')](function(_0x43c03c){if(_0x43c03c){return _0x43c03c[_0xf472('0x50')](_0xf5b59[_0xf472('0x24')][_0xf472('0x38')]);}})[_0xf472('0x18')](respondWithStatusCode(_0x5ce603,null))[_0xf472('0x33')](handleError(_0x5ce603,null));};exports[_0xf472('0x51')]=function(_0x54c5b0,_0x4d94f7){var _0x5d33c1=moment()['unix']()[_0xf472('0x52')]();var _0x1575ac=path[_0xf472('0x53')](config[_0xf472('0x54')],_0xf472('0x55'),_0xf472('0x56'),'tmp');var _0x49a2c4=path[_0xf472('0x53')](config['root'],_0xf472('0x55'),_0xf472('0x56'),_0xf472('0x57'));var _0x372fc5=path[_0xf472('0x53')](_0x1575ac,_0x5d33c1);var _0x461192=util['format'](_0xf472('0x58'),_0x54c5b0[_0xf472('0x26')]['id'],_0x5d33c1);var _0x28fa31=path[_0xf472('0x53')](_0x1575ac,_0x461192);var _0x292317=[];_0x292317[_0xf472('0x59')]({'model':db[_0xf472('0x5a')],'as':_0xf472('0x5a'),'attributes':['id',_0xf472('0x5b')],'raw':!![]});_0x292317[_0xf472('0x59')]({'model':db[_0xf472('0x5c')],'as':'Contact','attributes':['id',_0xf472('0x5d'),_0xf472('0x5e')],'raw':!![]});if(_0x54c5b0[_0xf472('0x24')]['attachments']){_0x292317[_0xf472('0x59')]({'model':db[_0xf472('0x5f')],'as':_0xf472('0x5f'),'raw':!![]});}var _0x367ab8=[{'model':db[_0xf472('0x3b')],'as':_0xf472('0x60'),'attributes':['id',_0xf472('0x35'),'createdAt',_0xf472('0x61'),_0xf472('0x62'),'read'],'include':_0x292317}];_0x367ab8[_0xf472('0x59')]({'model':db[_0xf472('0x63')],'as':_0xf472('0x64'),'attributes':['id',_0xf472('0x1a')]});_0x367ab8[_0xf472('0x59')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0xf472('0x29')]['find']({'where':{'id':_0x54c5b0[_0xf472('0x26')]['id']},'include':_0x367ab8})['then'](handleEntityNotFound(_0x4d94f7,null))['then'](function(_0x4191ce){if(_0x4191ce){var _0x5eb1f4=_0x4191ce['get']({'plain':!![]});fs[_0xf472('0x65')](_0x372fc5);var _0x27f447={'channel':_0xf472('0x66'),'account':_0x5eb1f4[_0xf472('0x64')]['name'],'agent':_0x5eb1f4[_0xf472('0x67')]?_0x5eb1f4[_0xf472('0x67')][_0xf472('0x5b')]:_0xf472('0x68'),'createdAt':moment(_0x5eb1f4[_0xf472('0x69')])['format'](_0xf472('0x47'))[_0xf472('0x52')](),'closedAt':_0x5eb1f4[_0xf472('0x6a')]?moment(_0x5eb1f4['closedAt'])[_0xf472('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf472('0x52')]():'','disposition':_0x5eb1f4[_0xf472('0x6b')],'visibility':_0x5eb1f4[_0xf472('0x6c')]?'Public':'Private','messages':_(_0x5eb1f4[_0xf472('0x60')])[_0xf472('0x43')]({'secret':![]})['map'](function(_0x2bc0c7){if(_0x2bc0c7['Attachment']){var _0x13ca11=path[_0xf472('0x53')](_0x49a2c4,_0x2bc0c7[_0xf472('0x5f')][_0xf472('0x6d')]);if(fs[_0xf472('0x6e')](_0x13ca11)){fs[_0xf472('0x6f')](_0x13ca11)[_0xf472('0x70')](fs[_0xf472('0x71')](path[_0xf472('0x53')](_0x372fc5,_0x2bc0c7[_0xf472('0x5f')][_0xf472('0x6d')])));}}return{'date':moment(_0x2bc0c7['createdAt'])[_0xf472('0x46')](_0xf472('0x47'))['toString'](),'sender':_0x2bc0c7[_0xf472('0x61')]===_0xf472('0x72')?_0x2bc0c7['User']?_0x2bc0c7[_0xf472('0x5a')]['fullname']:_0xf472('0x73'):_0x2bc0c7[_0xf472('0x74')][_0xf472('0x5d')]+(_0x2bc0c7[_0xf472('0x74')][_0xf472('0x5e')]?'\x20'+_0x2bc0c7['Contact'][_0xf472('0x5e')]:''),'body':_0x2bc0c7['Attachment']?_0x2bc0c7['Attachment'][_0xf472('0x6d')]:_0x2bc0c7[_0xf472('0x35')],'direction':_0x2bc0c7[_0xf472('0x61')]===_0xf472('0x72')?'A':'C','secret':_0x2bc0c7[_0xf472('0x62')],'read':_0x2bc0c7[_0xf472('0x75')],'attachment':_0x2bc0c7['Attachment']};})['value']()};return ejs[_0xf472('0x76')](path['join'](config[_0xf472('0x54')],_0xf472('0x55'),_0xf472('0x77'),_0xf472('0x78')),{'interaction':_0x27f447})['then'](function(_0x59fcde){var _0x13407f=path[_0xf472('0x53')](_0x372fc5,_0xf472('0x79')+_0x5eb1f4['id']+'-'+_0x5d33c1+'.pdf');var _0x3d5b62={'path':_0x13407f,'channel':_0xf472('0x66'),'interactionId':_0x5eb1f4['id']};return pdf[_0xf472('0x7a')](_0x59fcde,_0x3d5b62);})[_0xf472('0x18')](function(){return new Promise(function(_0x3a81ae,_0x4e3c28){zipdir(_0x372fc5,{'saveTo':_0x28fa31},function(_0x139934,_0x53fa66){if(_0x139934)return _0x4e3c28(_0x139934);return _0x3a81ae(_0x53fa66);});})['then'](function(){return new Promise(function(_0x1d4e91,_0x3cd6da){rimraf(_0x372fc5,function(_0x246aea){if(_0x246aea)_0x3cd6da(_0x246aea);return _0x1d4e91();});});})[_0xf472('0x18')](function(){return _0x4d94f7[_0xf472('0x51')](_0x28fa31,_0x461192,function(_0x47aa55){if(_0x47aa55){logger[_0xf472('0x19')](_0xf472('0x7b'),_0x47aa55);}else{fs[_0xf472('0x7c')](_0x28fa31);}});});});}else{return _0x4d94f7[_0xf472('0xe')](0xc8);}})[_0xf472('0x33')](handleError(_0x4d94f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7e91dda..932e28d 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 _0xbb0b=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbb0b,0x14d));var _0xbbb0=function(_0x10bcca,_0xa013bc){_0x10bcca=_0x10bcca-0x0;var _0x110095=_0xbb0b[_0x10bcca];return _0x110095;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xbbb0('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xbbb0('0x0'))['db'][_0xbbb0('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbbb0('0x2')};function emitEvent(_0x2a0ef0){return function(_0x2bbd41,_0x822db1,_0x39678a){_0x2bbd41[_0xbbb0('0x3')]({'attributes':['id'],'raw':!![]})[_0xbbb0('0x4')](function(_0x1ebe42){_0x2bbd41['setDataValue'](_0xbbb0('0x5'),_0x1ebe42[_0xbbb0('0x6')](function(_0x2fd61a){return{'id':_0x2fd61a['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2bbd41['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbb0('0x4')](function(_0x9521e2){_0x2bbd41[_0xbbb0('0x7')](_0xbbb0('0x8'),_0x9521e2[_0xbbb0('0x9')]);OpenchannelInteractionEvents['emit'](_0x2a0ef0+':'+_0x2bbd41['id'],_0x2bbd41);OpenchannelInteractionEvents[_0xbbb0('0xa')](_0x2a0ef0,_0x2bbd41);_0x39678a(null);})[_0xbbb0('0xb')](_0x39678a(null));};}for(var e in events){if(events[_0xbbb0('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xbbb0('0xd')](e,emitEvent(event));}}module[_0xbbb0('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7c51=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7c51,0x17a));var _0x17c5=function(_0x3c3b60,_0x1e3525){_0x3c3b60=_0x3c3b60-0x0;var _0x904f21=_0x7c51[_0x3c3b60];return _0x904f21;};'use strict';var EventEmitter=require(_0x17c5('0x0'));var OpenchannelInteraction=require(_0x17c5('0x1'))['db'][_0x17c5('0x2')];var OpenchannelMessage=require(_0x17c5('0x1'))['db'][_0x17c5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x17c5('0x4')](0x0);var events={'afterCreate':_0x17c5('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ae36f){return function(_0x21ecb9,_0xd0a0be,_0x538c3b){_0x21ecb9[_0x17c5('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xcad660){_0x21ecb9['setDataValue'](_0x17c5('0x7'),_0xcad660[_0x17c5('0x8')](function(_0x5cb4d1){return{'id':_0x5cb4d1['id']};}));return OpenchannelMessage[_0x17c5('0x9')]({'where':{'OpenchannelInteractionId':_0x21ecb9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x17c5('0xa')](function(_0x4c14d7){_0x21ecb9[_0x17c5('0xb')](_0x17c5('0xc'),_0x4c14d7[_0x17c5('0xd')]);OpenchannelInteractionEvents['emit'](_0x1ae36f+':'+_0x21ecb9['id'],_0x21ecb9);OpenchannelInteractionEvents[_0x17c5('0xe')](_0x1ae36f,_0x21ecb9);_0x538c3b(null);})[_0x17c5('0xf')](_0x538c3b(null));};}for(var e in events){if(events[_0x17c5('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x17c5('0x11')](e,emitEvent(event));}}module[_0x17c5('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6f05dc9..8a7a39b 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 _0x05f5=['bluebird','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x3c0bea,_0x496d85){var _0x37068e=function(_0x24026a){while(--_0x24026a){_0x3c0bea['push'](_0x3c0bea['shift']());}};_0x37068e(++_0x496d85);}(_0x05f5,0x12e));var _0x505f=function(_0x85d56d,_0x37f5c1){_0x85d56d=_0x85d56d-0x0;var _0x51f613=_0x05f5[_0x85d56d];return _0x51f613;};'use strict';var _=require(_0x505f('0x0'));var util=require(_0x505f('0x1'));var logger=require('../../config/logger')(_0x505f('0x2'));var moment=require(_0x505f('0x3'));var BPromise=require(_0x505f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x505f('0x5'));var rimraf=require(_0x505f('0x6'));var config=require('../../config/environment');var attributes=require(_0x505f('0x7'));module[_0x505f('0x8')]=function(_0x5c5e11,_0x1fc0ec){return _0x5c5e11[_0x505f('0x9')](_0x505f('0xa'),attributes,{'tableName':_0x505f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x505f('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x4a9679,_0x456d71,_0x544885){if(_0x4a9679['changed'](_0x505f('0xd'))){_0x4a9679[_0x505f('0xe')]=moment()[_0x505f('0xf')](_0x505f('0x10'));}_0x544885(null,_0x4a9679);}}});}; \ No newline at end of file +var _0x4233=['exports','OpenchannelInteraction','changed','closed','closedAt','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x355ca3,_0xd3e1e7){var _0x55edba=function(_0x29ec8e){while(--_0x29ec8e){_0x355ca3['push'](_0x355ca3['shift']());}};_0x55edba(++_0xd3e1e7);}(_0x4233,0x199));var _0x3423=function(_0x576ac9,_0x31dc3b){_0x576ac9=_0x576ac9-0x0;var _0x5ad2a8=_0x4233[_0x576ac9];return _0x5ad2a8;};'use strict';var _=require('lodash');var util=require(_0x3423('0x0'));var logger=require(_0x3423('0x1'))(_0x3423('0x2'));var moment=require('moment');var BPromise=require(_0x3423('0x3'));var rp=require(_0x3423('0x4'));var fs=require('fs');var path=require(_0x3423('0x5'));var rimraf=require(_0x3423('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x3423('0x7')]=function(_0x26c566,_0x560616){return _0x26c566['define'](_0x3423('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x8c477a,_0xec82e0,_0x3f6bde){if(_0x8c477a[_0x3423('0x9')](_0x3423('0xa'))){_0x8c477a[_0x3423('0xb')]=moment()[_0x3423('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f6bde(null,_0x8c477a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 405bb84..eadbf34 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 _0xee54=['then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelInteraction,\x20%s,\x20%s','info','result','UpdateOpenchannelInteraction','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x2685c4,_0x113da3){var _0x5f414c=function(_0x172a17){while(--_0x172a17){_0x2685c4['push'](_0x2685c4['shift']());}};_0x5f414c(++_0x113da3);}(_0xee54,0x106));var _0x4ee5=function(_0x295f91,_0x391dbf){_0x295f91=_0x295f91-0x0;var _0xa99243=_0xee54[_0x295f91];return _0xa99243;};'use strict';var _=require(_0x4ee5('0x0'));var util=require(_0x4ee5('0x1'));var moment=require(_0x4ee5('0x2'));var BPromise=require(_0x4ee5('0x3'));var rs=require(_0x4ee5('0x4'));var fs=require('fs');var Redis=require(_0x4ee5('0x5'));var db=require(_0x4ee5('0x6'))['db'];var utils=require(_0x4ee5('0x7'));var logger=require(_0x4ee5('0x8'))(_0x4ee5('0x9'));var config=require(_0x4ee5('0xa'));var jayson=require(_0x4ee5('0xb'));var client=jayson['client'][_0x4ee5('0xc')]({'port':0x232a});config[_0x4ee5('0xd')]=_[_0x4ee5('0xe')](config[_0x4ee5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ee5('0xf'))(new Redis(config[_0x4ee5('0xd')]));require('./openchannelInteraction.socket')[_0x4ee5('0x10')](socket);function respondWithRpcPromise(_0x417737,_0x243f5b,_0x24d538){return new BPromise(function(_0x6c4402,_0x55fc36){return client[_0x4ee5('0x11')](_0x417737,_0x24d538)[_0x4ee5('0x12')](function(_0xcaa716){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x243f5b,_0x4ee5('0x13'));logger[_0x4ee5('0x14')](_0x4ee5('0x15'),_0x243f5b,_0x4ee5('0x13'),JSON[_0x4ee5('0x16')](_0xcaa716));if(_0xcaa716['error']){if(_0xcaa716[_0x4ee5('0x17')]['code']===0x1f4){logger[_0x4ee5('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x243f5b,_0xcaa716[_0x4ee5('0x17')][_0x4ee5('0x18')]);return _0x55fc36(_0xcaa716[_0x4ee5('0x17')][_0x4ee5('0x18')]);}logger[_0x4ee5('0x17')](_0x4ee5('0x19'),_0x243f5b,_0xcaa716[_0x4ee5('0x17')][_0x4ee5('0x18')]);return _0x6c4402(_0xcaa716[_0x4ee5('0x17')][_0x4ee5('0x18')]);}else{logger[_0x4ee5('0x1a')](_0x4ee5('0x19'),_0x243f5b,_0x4ee5('0x13'));_0x6c4402(_0xcaa716[_0x4ee5('0x1b')][_0x4ee5('0x18')]);}})['catch'](function(_0x28e40b){logger[_0x4ee5('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x243f5b,_0x28e40b);_0x55fc36(_0x28e40b);});});}exports[_0x4ee5('0x1c')]=function(_0x21121e){var _0x129ed5=this;return new Promise(function(_0x19cd3d,_0x21aaff){return db['OpenchannelInteraction']['update'](_0x21121e[_0x4ee5('0x1d')],{'raw':_0x21121e[_0x4ee5('0x1e')]?_0x21121e[_0x4ee5('0x1e')][_0x4ee5('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21121e[_0x4ee5('0x1e')]?_0x21121e[_0x4ee5('0x1e')][_0x4ee5('0x20')]||null:null,'attributes':_0x21121e[_0x4ee5('0x1e')]?_0x21121e[_0x4ee5('0x1e')]['attributes']||null:null,'limit':_0x21121e[_0x4ee5('0x1e')]?_0x21121e[_0x4ee5('0x1e')][_0x4ee5('0x21')]||null:null})[_0x4ee5('0x12')](function(_0x8e8425){logger[_0x4ee5('0x1a')](_0x4ee5('0x1c'),_0x21121e);logger[_0x4ee5('0x14')](_0x4ee5('0x1c'),_0x21121e,JSON[_0x4ee5('0x16')](_0x8e8425));_0x19cd3d(_0x8e8425);})['catch'](function(_0x4cc48f){logger[_0x4ee5('0x17')](_0x4ee5('0x1c'),_0x4cc48f[_0x4ee5('0x18')],_0x21121e);_0x21aaff(_0x129ed5[_0x4ee5('0x17')](0x1f4,_0x4cc48f[_0x4ee5('0x18')]));});});};exports[_0x4ee5('0x22')]=function(_0x2c3066){return new Promise(function(_0x1d6ba4,_0x500004){return db['OpenchannelInteraction'][_0x4ee5('0x23')]({'where':_0x2c3066['options']?_0x2c3066[_0x4ee5('0x1e')]['where']||null:null})['then'](function(_0x581394){if(_0x581394){return _0x581394[_0x4ee5('0x24')](_0x2c3066[_0x4ee5('0x1d')][_0x4ee5('0x25')],_[_0x4ee5('0x26')](_0x2c3066['body'],[_0x4ee5('0x25'),'id'])||{});}})['spread'](function(_0x2ab782){logger[_0x4ee5('0x1a')](_0x4ee5('0x27'),_0x2c3066);logger[_0x4ee5('0x14')](_0x4ee5('0x27'),_0x2c3066,JSON[_0x4ee5('0x16')](_0x2ab782));_0x1d6ba4(_0x2ab782);})['catch'](function(_0x3df41d){logger[_0x4ee5('0x17')](_0x4ee5('0x27'),_0x3df41d[_0x4ee5('0x18')],_0x2c3066);_0x500004(_this[_0x4ee5('0x17')](0x1f4,_0x3df41d[_0x4ee5('0x18')]));});});}; \ No newline at end of file +var _0x70d9=['code','OpenchannelInteraction,\x20%s,\x20%s','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1cd811,_0x4abcda){var _0x4f1e02=function(_0x50944d){while(--_0x50944d){_0x1cd811['push'](_0x1cd811['shift']());}};_0x4f1e02(++_0x4abcda);}(_0x70d9,0x153));var _0x970d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x70d9[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x970d('0x0'));var util=require(_0x970d('0x1'));var moment=require(_0x970d('0x2'));var BPromise=require(_0x970d('0x3'));var rs=require(_0x970d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x970d('0x5'));var logger=require('../../config/logger')(_0x970d('0x6'));var config=require('../../config/environment');var jayson=require(_0x970d('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x970d('0x8')]=_[_0x970d('0x9')](config[_0x970d('0x8')],{'host':_0x970d('0xa'),'port':0x18eb});var socket=require(_0x970d('0xb'))(new Redis(config['redis']));require(_0x970d('0xc'))['register'](socket);function respondWithRpcPromise(_0x2c429c,_0xbc9cdb,_0x1a2a2f){return new BPromise(function(_0x4460f2,_0x544259){return client[_0x970d('0xd')](_0x2c429c,_0x1a2a2f)[_0x970d('0xe')](function(_0x1f6a85){logger[_0x970d('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0xbc9cdb,'request\x20sent');logger[_0x970d('0x10')](_0x970d('0x11'),_0xbc9cdb,_0x970d('0x12'),JSON[_0x970d('0x13')](_0x1f6a85));if(_0x1f6a85[_0x970d('0x14')]){if(_0x1f6a85[_0x970d('0x14')][_0x970d('0x15')]===0x1f4){logger['error'](_0x970d('0x16'),_0xbc9cdb,_0x1f6a85[_0x970d('0x14')][_0x970d('0x17')]);return _0x544259(_0x1f6a85['error'][_0x970d('0x17')]);}logger[_0x970d('0x14')](_0x970d('0x16'),_0xbc9cdb,_0x1f6a85['error']['message']);return _0x4460f2(_0x1f6a85[_0x970d('0x14')][_0x970d('0x17')]);}else{logger[_0x970d('0xf')](_0x970d('0x16'),_0xbc9cdb,_0x970d('0x12'));_0x4460f2(_0x1f6a85['result'][_0x970d('0x17')]);}})['catch'](function(_0x59ccc4){logger['error'](_0x970d('0x16'),_0xbc9cdb,_0x59ccc4);_0x544259(_0x59ccc4);});});}exports[_0x970d('0x18')]=function(_0x24081e){var _0x3088f2=this;return new Promise(function(_0x31d109,_0x1d6c10){return db[_0x970d('0x19')][_0x970d('0x1a')](_0x24081e['body'],{'raw':_0x24081e[_0x970d('0x1b')]?_0x24081e['options'][_0x970d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24081e[_0x970d('0x1b')]?_0x24081e['options'][_0x970d('0x1d')]||null:null,'attributes':_0x24081e['options']?_0x24081e[_0x970d('0x1b')][_0x970d('0x1e')]||null:null,'limit':_0x24081e[_0x970d('0x1b')]?_0x24081e[_0x970d('0x1b')][_0x970d('0x1f')]||null:null})['then'](function(_0x113ac8){logger['info'](_0x970d('0x18'),_0x24081e);logger[_0x970d('0x10')](_0x970d('0x18'),_0x24081e,JSON['stringify'](_0x113ac8));_0x31d109(_0x113ac8);})[_0x970d('0x20')](function(_0x5c4f72){logger[_0x970d('0x14')](_0x970d('0x18'),_0x5c4f72[_0x970d('0x17')],_0x24081e);_0x1d6c10(_0x3088f2[_0x970d('0x14')](0x1f4,_0x5c4f72[_0x970d('0x17')]));});});};exports[_0x970d('0x21')]=function(_0x201432){return new Promise(function(_0x51d339,_0x18c7fd){return db[_0x970d('0x19')][_0x970d('0x22')]({'where':_0x201432[_0x970d('0x1b')]?_0x201432['options'][_0x970d('0x1d')]||null:null})['then'](function(_0x5d83db){if(_0x5d83db){return _0x5d83db[_0x970d('0x23')](_0x201432['body']['ids'],_['omit'](_0x201432[_0x970d('0x24')],[_0x970d('0x25'),'id'])||{});}})[_0x970d('0x26')](function(_0x1f02d0){logger[_0x970d('0xf')](_0x970d('0x27'),_0x201432);logger[_0x970d('0x10')]('AddTags',_0x201432,JSON[_0x970d('0x13')](_0x1f02d0));_0x51d339(_0x1f02d0);})[_0x970d('0x20')](function(_0x12060e){logger[_0x970d('0x14')]('AddTags',_0x12060e[_0x970d('0x17')],_0x201432);_0x18c7fd(_this[_0x970d('0x14')](0x1f4,_0x12060e[_0x970d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 470a624..da60927 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 _0x33db=['removeListener','openchannelInteraction:','save','remove','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x33db,0x70));var _0xb33d=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x33db[_0x179e11];return _0x549f04;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xb33d('0x0'),_0xb33d('0x1'),'update'];function createListener(_0x71f922,_0x53ebac){return function(_0x16fa94){_0x53ebac[_0xb33d('0x2')](_0x71f922,_0x16fa94);};}function removeListener(_0x555457,_0x25d3a9){return function(){OpenchannelInteractionEvents[_0xb33d('0x3')](_0x555457,_0x25d3a9);};}exports['register']=function(_0x1855c5){for(var _0x5ed3f8=0x0,_0x4a203d=events['length'];_0x5ed3f8<_0x4a203d;_0x5ed3f8++){var _0x4cae84=events[_0x5ed3f8];var _0x3dfb09=createListener(_0xb33d('0x4')+_0x4cae84,_0x1855c5);OpenchannelInteractionEvents['on'](_0x4cae84,_0x3dfb09);}}; \ No newline at end of file +var _0xb7c8=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb7c8,0x1e2));var _0x8b7c=function(_0x5c4426,_0x26a104){_0x5c4426=_0x5c4426-0x0;var _0x50a962=_0xb7c8[_0x5c4426];return _0x50a962;};'use strict';var OpenchannelInteractionEvents=require(_0x8b7c('0x0'));var events=[_0x8b7c('0x1'),_0x8b7c('0x2'),_0x8b7c('0x3')];function createListener(_0x5734b9,_0x4ea196){return function(_0x21df4d){_0x4ea196[_0x8b7c('0x4')](_0x5734b9,_0x21df4d);};}function removeListener(_0x4f8149,_0x55f912){return function(){OpenchannelInteractionEvents[_0x8b7c('0x5')](_0x4f8149,_0x55f912);};}exports[_0x8b7c('0x6')]=function(_0x39a69f){for(var _0x477d5b=0x0,_0x574629=events[_0x8b7c('0x7')];_0x477d5b<_0x574629;_0x477d5b++){var _0x2f7a9a=events[_0x477d5b];var _0x273e1b=createListener(_0x8b7c('0x8')+_0x2f7a9a,_0x39a69f);OpenchannelInteractionEvents['on'](_0x2f7a9a,_0x273e1b);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d3fb293..9a783a1 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x2696b2,_0x4dd5c4){var _0x22418a=function(_0x3ec486){while(--_0x3ec486){_0x2696b2['push'](_0x2696b2['shift']());}};_0x22418a(++_0x4dd5c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 376cf8a..ddb8e0a 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 _0xb8a0=['STRING','TEXT','medium','BOOLEAN'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x1cbac8,_0x575ccf){_0x1cbac8=_0x1cbac8-0x0;var _0x42e9c0=_0xb8a0[_0x1cbac8];return _0x42e9c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x0b8a('0x0')](_0x0b8a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0b8a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0b8a('0x3')]},'providerResponse':{'type':Sequelize[_0x0b8a('0x0')]}}; \ No newline at end of file +var _0x8580=['medium','ENUM','out','DATE','STRING','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8580,0x1c7));var _0x0858=function(_0x25ff97,_0x375688){_0x25ff97=_0x25ff97-0x0;var _0x19b811=_0x8580[_0x25ff97];return _0x19b811;};'use strict';var Sequelize=require('sequelize');module[_0x0858('0x0')]={'body':{'type':Sequelize['TEXT'](_0x0858('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0858('0x2')]('in',_0x0858('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0858('0x4')]},'providerName':{'type':Sequelize[_0x0858('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9c5c101..77495d9 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 _0x0dd7=['merge','type','VIRTUAL','options','OpenchannelMessage','count','include','rows','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','User','fullname','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','Sequelize','QueryTypes','SELECT','interface','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','undefined','offset','limit','Content-Range','json','reject','then','destroy','name','send','index','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x22dcef,_0xeeec07){var _0x1abcba=function(_0x4c440e){while(--_0x4c440e){_0x22dcef['push'](_0x22dcef['shift']());}};_0x1abcba(++_0xeeec07);}(_0x0dd7,0x140));var _0x70dd=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x0dd7[_0x3e0763];return _0x351ca2;};'use strict';var emlformat=require(_0x70dd('0x0'));var rimraf=require(_0x70dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70dd('0x2'));var rp=require(_0x70dd('0x3'));var moment=require(_0x70dd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x70dd('0x5'));var util=require(_0x70dd('0x6'));var path=require(_0x70dd('0x7'));var sox=require(_0x70dd('0x8'));var csv=require(_0x70dd('0x9'));var ejs=require(_0x70dd('0xa'));var fs=require('fs');var fs_extra=require(_0x70dd('0xb'));var _=require(_0x70dd('0xc'));var squel=require('squel');var crypto=require(_0x70dd('0xd'));var jsforce=require(_0x70dd('0xe'));var deskjs=require(_0x70dd('0xf'));var toCsv=require(_0x70dd('0x9'));var querystring=require(_0x70dd('0x10'));var Papa=require(_0x70dd('0x11'));var Redis=require(_0x70dd('0x12'));var authService=require(_0x70dd('0x13'));var qs=require(_0x70dd('0x14'));var as=require(_0x70dd('0x15'));var hardwareService=require(_0x70dd('0x16'));var logger=require(_0x70dd('0x17'))('api');var utils=require(_0x70dd('0x18'));var config=require(_0x70dd('0x19'));var licenseUtil=require(_0x70dd('0x1a'));var db=require(_0x70dd('0x1b'))['db'];config[_0x70dd('0x1c')]=_[_0x70dd('0x1d')](config[_0x70dd('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x70dd('0x1e'))(new Redis(config[_0x70dd('0x1c')]));require(_0x70dd('0x1f'))[_0x70dd('0x20')](socket);var jayson=require(_0x70dd('0x21'));var client=jayson[_0x70dd('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x70dd('0x22')][_0x70dd('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4c32e6,_0x224b8f,_0x42519c,_0x26cf25){return new BPromise(function(_0x5c33f7,_0xc43f6f){var _0x3bd4ef=_0x26cf25||client;return _0x3bd4ef['request'](_0x4c32e6,_0x42519c)['then'](function(_0x4963fe){logger['info'](_0x70dd('0x24'),_0x224b8f,_0x70dd('0x25'));logger[_0x70dd('0x26')](_0x70dd('0x27'),_0x224b8f,'request\x20sent',JSON[_0x70dd('0x28')](_0x4963fe));if(_0x4963fe['error']){if(_0x4963fe[_0x70dd('0x29')][_0x70dd('0x2a')]===0x1f4){logger['error'](_0x70dd('0x24'),_0x224b8f,_0x4963fe[_0x70dd('0x29')][_0x70dd('0x2b')]);return _0xc43f6f(_0x4963fe[_0x70dd('0x29')][_0x70dd('0x2b')]);}logger[_0x70dd('0x29')](_0x70dd('0x24'),_0x224b8f,_0x4963fe[_0x70dd('0x29')][_0x70dd('0x2b')]);return _0x5c33f7(_0x4963fe[_0x70dd('0x29')][_0x70dd('0x2b')]);}else{logger[_0x70dd('0x2c')](_0x70dd('0x24'),_0x224b8f,_0x70dd('0x25'));_0x5c33f7(_0x4963fe['result'][_0x70dd('0x2b')]);}})[_0x70dd('0x2d')](function(_0x4604af){logger[_0x70dd('0x29')](_0x70dd('0x24'),_0x224b8f,_0x4604af);_0xc43f6f(_0x4604af);});});}function respondWithStatusCode(_0x48a765,_0x532717){_0x532717=_0x532717||0xcc;return function(_0x543367){if(_0x543367){return _0x48a765[_0x70dd('0x2e')](_0x532717);}return _0x48a765[_0x70dd('0x2f')](_0x532717)[_0x70dd('0x30')]();};}function respondWithResult(_0x3ed838,_0x204757){_0x204757=_0x204757||0xc8;return function(_0x3ad674){if(_0x3ad674){return _0x3ed838[_0x70dd('0x2f')](_0x204757)['json'](_0x3ad674);}};}function respondWithFilteredResult(_0x4740fb,_0x210545){return function(_0x1125de){if(_0x1125de){var _0x4d3c92=typeof _0x210545['offset']===_0x70dd('0x31')&&typeof _0x210545['limit']==='undefined';var _0x59e4b4=_0x1125de['count'];var _0x18b7b5=_0x4d3c92?0x0:_0x210545[_0x70dd('0x32')];var _0x2e6aec=_0x4d3c92?_0x1125de['count']:_0x210545['offset']+_0x210545[_0x70dd('0x33')];var _0x3b0e8a;if(_0x2e6aec>=_0x59e4b4){_0x2e6aec=_0x59e4b4;_0x3b0e8a=0xc8;}else{_0x3b0e8a=0xce;}_0x4740fb['status'](_0x3b0e8a);return _0x4740fb['set'](_0x70dd('0x34'),_0x18b7b5+'-'+_0x2e6aec+'/'+_0x59e4b4)[_0x70dd('0x35')](_0x1125de);}return null;};}function patchUpdates(_0x30490d){return function(_0x1e4392){try{jsonpatch['apply'](_0x1e4392,_0x30490d,!![]);}catch(_0x26c60f){return BPromise[_0x70dd('0x36')](_0x26c60f);}return _0x1e4392['save']();};}function saveUpdates(_0x60dd2f,_0x5f28a9){return function(_0x46f5e4){if(_0x46f5e4){return _0x46f5e4['update'](_0x60dd2f)[_0x70dd('0x37')](function(_0x4b27f6){return _0x4b27f6;});}return null;};}function removeEntity(_0x29d9ca,_0x3cbdcb){return function(_0x1a9700){if(_0x1a9700){return _0x1a9700[_0x70dd('0x38')]()[_0x70dd('0x37')](function(){_0x29d9ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3535,_0x1d2f9c){return function(_0x1a44e9){if(!_0x1a44e9){_0x2a3535[_0x70dd('0x2e')](0x194);}return _0x1a44e9;};}function handleError(_0x480dcb,_0x3f6054){_0x3f6054=_0x3f6054||0x1f4;return function(_0x34914e){logger['error'](_0x34914e['stack']);if(_0x34914e[_0x70dd('0x39')]){delete _0x34914e[_0x70dd('0x39')];}_0x480dcb[_0x70dd('0x2f')](_0x3f6054)[_0x70dd('0x3a')](_0x34914e);};}exports[_0x70dd('0x3b')]=function(_0x2321b4,_0x185d51){var _0x484d84={},_0x708b9f={},_0x15565d={'count':0x0,'rows':[]};var _0x21b4e5=_['map'](db['OpenchannelMessage'][_0x70dd('0x3c')],function(_0x3827a5){return{'name':_0x3827a5[_0x70dd('0x3d')],'type':_0x3827a5['type'][_0x70dd('0x3e')]};});_0x708b9f['model']=_[_0x70dd('0x3f')](_0x21b4e5,_0x70dd('0x39'));_0x708b9f['query']=_[_0x70dd('0x40')](_0x2321b4[_0x70dd('0x41')]);_0x708b9f[_0x70dd('0x42')]=_[_0x70dd('0x43')](_0x708b9f[_0x70dd('0x44')],_0x708b9f[_0x70dd('0x41')]);_0x484d84[_0x70dd('0x45')]=_[_0x70dd('0x43')](_0x708b9f[_0x70dd('0x44')],qs[_0x70dd('0x46')](_0x2321b4[_0x70dd('0x41')][_0x70dd('0x46')]));_0x484d84[_0x70dd('0x45')]=_0x484d84[_0x70dd('0x45')][_0x70dd('0x47')]?_0x484d84[_0x70dd('0x45')]:_0x708b9f[_0x70dd('0x44')];if(!_0x2321b4['query'][_0x70dd('0x48')](_0x70dd('0x49'))){_0x484d84[_0x70dd('0x33')]=qs[_0x70dd('0x33')](_0x2321b4[_0x70dd('0x41')][_0x70dd('0x33')]);_0x484d84[_0x70dd('0x32')]=qs[_0x70dd('0x32')](_0x2321b4[_0x70dd('0x41')][_0x70dd('0x32')]);}_0x484d84[_0x70dd('0x4a')]=qs[_0x70dd('0x4b')](_0x2321b4[_0x70dd('0x41')][_0x70dd('0x4b')]);_0x484d84['where']=qs[_0x70dd('0x42')](_[_0x70dd('0x4c')](_0x2321b4['query'],_0x708b9f[_0x70dd('0x42')]),_0x21b4e5);if(_0x2321b4['query'][_0x70dd('0x4d')]){_0x484d84[_0x70dd('0x4e')]=_[_0x70dd('0x4f')](_0x484d84['where'],{'$or':_[_0x70dd('0x3f')](_0x21b4e5,function(_0xc59e37){if(_0xc59e37[_0x70dd('0x50')]!==_0x70dd('0x51')){var _0x2353e4={};_0x2353e4[_0xc59e37[_0x70dd('0x39')]]={'$like':'%'+_0x2321b4['query'][_0x70dd('0x4d')]+'%'};return _0x2353e4;}})});}_0x484d84=_[_0x70dd('0x4f')]({},_0x484d84,_0x2321b4[_0x70dd('0x52')]);var _0x462f54={'where':_0x484d84['where']};return db[_0x70dd('0x53')][_0x70dd('0x54')](_0x462f54)[_0x70dd('0x37')](function(_0x5548bf){_0x15565d[_0x70dd('0x54')]=_0x5548bf;if(_0x2321b4[_0x70dd('0x41')]['includeAll']){_0x484d84[_0x70dd('0x55')]=[{'all':!![]}];}return db[_0x70dd('0x53')]['findAll'](_0x484d84);})[_0x70dd('0x37')](function(_0x54e6bf){_0x15565d[_0x70dd('0x56')]=_0x54e6bf;return _0x15565d;})['then'](respondWithFilteredResult(_0x185d51,_0x484d84))[_0x70dd('0x2d')](handleError(_0x185d51,null));};exports['show']=function(_0x241082,_0x5a4e72){var _0x464d0a={'raw':!![],'where':{'id':_0x241082[_0x70dd('0x57')]['id']}},_0x13d99d={};_0x13d99d[_0x70dd('0x44')]=_[_0x70dd('0x40')](db['OpenchannelMessage'][_0x70dd('0x3c')]);_0x13d99d[_0x70dd('0x41')]=_[_0x70dd('0x40')](_0x241082[_0x70dd('0x41')]);_0x13d99d[_0x70dd('0x42')]=_[_0x70dd('0x43')](_0x13d99d['model'],_0x13d99d[_0x70dd('0x41')]);_0x464d0a[_0x70dd('0x45')]=_[_0x70dd('0x43')](_0x13d99d[_0x70dd('0x44')],qs[_0x70dd('0x46')](_0x241082['query']['fields']));_0x464d0a[_0x70dd('0x45')]=_0x464d0a[_0x70dd('0x45')][_0x70dd('0x47')]?_0x464d0a['attributes']:_0x13d99d[_0x70dd('0x44')];if(_0x241082[_0x70dd('0x41')][_0x70dd('0x58')]){_0x464d0a[_0x70dd('0x55')]=[{'all':!![]}];}_0x464d0a=_[_0x70dd('0x4f')]({},_0x464d0a,_0x241082[_0x70dd('0x52')]);return db[_0x70dd('0x53')][_0x70dd('0x59')](_0x464d0a)[_0x70dd('0x37')](handleEntityNotFound(_0x5a4e72,null))[_0x70dd('0x37')](respondWithResult(_0x5a4e72,null))[_0x70dd('0x2d')](handleError(_0x5a4e72,null));};exports[_0x70dd('0x5a')]=function(_0x1c5a13,_0xe731a6){return db[_0x70dd('0x53')][_0x70dd('0x5a')](_0x1c5a13[_0x70dd('0x5b')],{})[_0x70dd('0x37')](respondWithResult(_0xe731a6,0xc9))[_0x70dd('0x2d')](handleError(_0xe731a6,null));};exports['update']=function(_0x386dcc,_0x3192dd){if(_0x386dcc['body']['id']){delete _0x386dcc[_0x70dd('0x5b')]['id'];}return db[_0x70dd('0x53')][_0x70dd('0x59')]({'where':{'id':_0x386dcc[_0x70dd('0x57')]['id']}})[_0x70dd('0x37')](handleEntityNotFound(_0x3192dd,null))[_0x70dd('0x37')](saveUpdates(_0x386dcc[_0x70dd('0x5b')],null))[_0x70dd('0x37')](respondWithResult(_0x3192dd,null))[_0x70dd('0x2d')](handleError(_0x3192dd,null));};exports[_0x70dd('0x38')]=function(_0x58bce9,_0x29abf7){return db[_0x70dd('0x53')][_0x70dd('0x59')]({'where':{'id':_0x58bce9['params']['id']}})[_0x70dd('0x37')](handleEntityNotFound(_0x29abf7,null))['then'](removeEntity(_0x29abf7,null))[_0x70dd('0x2d')](handleError(_0x29abf7,null));};exports[_0x70dd('0x5c')]=function(_0x4b8c3d,_0x161a87){return db['OpenchannelMessage'][_0x70dd('0x5c')]()[_0x70dd('0x37')](respondWithResult(_0x161a87,null))[_0x70dd('0x2d')](handleError(_0x161a87,null));};var interaction_log=require(_0x70dd('0x17'))(_0x70dd('0x5d'));exports[_0x70dd('0x5e')]=function(_0x292c31,_0x7e8169,_0x543c4d){var _0x53c855={'agent':{},'channel':_0x70dd('0x5f')};if(_0x292c31[_0x70dd('0x5b')]['id']){delete _0x292c31[_0x70dd('0x5b')]['id'];}_0x292c31[_0x70dd('0x5b')][_0x70dd('0x60')]=!![];_0x292c31['body'][_0x70dd('0x61')]=moment()[_0x70dd('0x62')](_0x70dd('0x63'));_0x292c31['body'][_0x70dd('0x64')]=_0x292c31[_0x70dd('0x5b')][_0x70dd('0x64')]||_0x292c31[_0x70dd('0x65')]['id'];_0x53c855[_0x70dd('0x66')]['id']=_0x292c31['body'][_0x70dd('0x64')];return db[_0x70dd('0x53')][_0x70dd('0x59')]({'where':{'id':_0x292c31['params']['id'],'UserId':null}})[_0x70dd('0x37')](handleEntityNotFound(_0x7e8169,null))[_0x70dd('0x37')](saveUpdates(_0x292c31['body'],null))['then'](function(_0x53c2eb){if(_0x53c2eb){_0x53c855[_0x70dd('0x2b')]=_0x53c2eb[_0x70dd('0x67')]({'plain':!![]});return db[_0x70dd('0x68')][_0x70dd('0x59')]({'where':{'id':_0x53c2eb['OpenchannelInteractionId']}});}return null;})[_0x70dd('0x37')](handleEntityNotFound(_0x7e8169,null))['then'](function(_0x54bb82){if(_0x54bb82){return _0x54bb82['update']({'UserId':_0x292c31[_0x70dd('0x5b')][_0x70dd('0x64')],'read1stAt':_[_0x70dd('0x69')](_0x54bb82[_0x70dd('0x6a')])?moment()['format'](_0x70dd('0x63')):undefined});}return null;})[_0x70dd('0x37')](function(_0x5732b7){if(_0x5732b7){_0x53c855[_0x70dd('0x6b')]=_0x5732b7['get']({'plain':!![]});interaction_log[_0x70dd('0x2c')](_0x70dd('0x6c'),_0x292c31[_0x70dd('0x65')]['id'],_0x292c31[_0x70dd('0x65')][_0x70dd('0x39')],_0x292c31[_0x70dd('0x65')]['role'],_0x53c855[_0x70dd('0x6b')]['id'],_0x292c31['body']?JSON[_0x70dd('0x28')](_0x292c31[_0x70dd('0x5b')]):'null');return respondWithRpcPromise(_0x70dd('0x6d'),'acceptMessage',_0x53c855);}return null;})[_0x70dd('0x37')](function(_0x3bac0d){var _0x3c9ec9=_0x70dd('0x6e')+_0x3bac0d[_0x70dd('0x2b')][_0x70dd('0x6f')];return db[_0x70dd('0x70')][_0x70dd('0x41')](_0x3c9ec9,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x70dd('0x37')](function(_0x122f65){return _0x122f65;});})[_0x70dd('0x37')](function(_0x49483d){if(_0x49483d){_0x53c855['message']['contact']=_0x49483d[0x0];if(!_0x292c31['body'][_0x70dd('0x64')])return;return db[_0x70dd('0x71')][_0x70dd('0x59')]({'where':{'id':_0x292c31[_0x70dd('0x5b')][_0x70dd('0x64')],'role':_0x70dd('0x66')},'attributes':['id',_0x70dd('0x39'),_0x70dd('0x72'),_0x70dd('0x73'),_0x70dd('0x74')],'raw':!![]});}return null;})[_0x70dd('0x37')](function(_0x457d90){if(!_0x457d90)return null;_0x53c855[_0x70dd('0x2b')]['agent']=_0x457d90;return _0x53c855;})[_0x70dd('0x37')](function(_0x134276){if(_0x134276){if(_0x292c31[_0x70dd('0x5b')][_0x70dd('0x75')]){_0x53c855[_0x70dd('0x2b')]['interface']=util[_0x70dd('0x62')]('SIP/%s',_0x292c31[_0x70dd('0x65')][_0x70dd('0x39')]);_0x53c855[_0x70dd('0x2b')][_0x70dd('0x76')]=_0x53c855[_0x70dd('0x76')];_0x53c855[_0x70dd('0x2b')][_0x70dd('0x77')]=_0x53c855['channel'];_0x53c855[_0x70dd('0x2b')][_0x70dd('0x78')]=_0x70dd('0x5e');return respondWithRpcPromise(_0x70dd('0x79'),'EventManager',{'event':_0x70dd('0x7a'),'message':_0x53c855[_0x70dd('0x2b')]},client9002)['then'](function(){return _0x53c855;});}return _0x53c855;}return null;})['then'](respondWithResult(_0x7e8169,null))[_0x70dd('0x2d')](handleError(_0x7e8169,null));};var interaction_log=require(_0x70dd('0x17'))(_0x70dd('0x5d'));exports['reject']=function(_0x38560f,_0x27ba94,_0x42107a){var _0x5111d5={'agent':{},'channel':_0x70dd('0x5f')};if(_0x38560f[_0x70dd('0x5b')]['id']){delete _0x38560f[_0x70dd('0x5b')]['id'];}_0x38560f[_0x70dd('0x5b')]['UserId']=_0x38560f[_0x70dd('0x5b')][_0x70dd('0x64')]||_0x38560f[_0x70dd('0x65')]['id'];_0x5111d5['agent']['id']=_0x38560f[_0x70dd('0x5b')]['UserId'];return db[_0x70dd('0x53')][_0x70dd('0x59')]({'where':{'id':_0x38560f[_0x70dd('0x57')]['id'],'UserId':null}})[_0x70dd('0x37')](handleEntityNotFound(_0x27ba94,null))[_0x70dd('0x37')](function(_0x5cf8a4){if(_0x5cf8a4){_0x5111d5[_0x70dd('0x2b')]=_0x5cf8a4[_0x70dd('0x67')]({'plain':!![]});return db['OpenchannelInteraction'][_0x70dd('0x59')]({'where':{'id':_0x5cf8a4[_0x70dd('0x7b')]}});}return null;})[_0x70dd('0x37')](handleEntityNotFound(_0x27ba94,null))[_0x70dd('0x37')](function(_0x16d50a){if(_0x16d50a){_0x5111d5[_0x70dd('0x6b')]=_0x16d50a[_0x70dd('0x67')]({'plain':!![]});interaction_log[_0x70dd('0x2c')](_0x70dd('0x7c'),_0x38560f[_0x70dd('0x65')]['id'],_0x38560f[_0x70dd('0x65')][_0x70dd('0x39')],_0x38560f['user'][_0x70dd('0x7d')],_0x5111d5[_0x70dd('0x6b')]['id'],_0x38560f[_0x70dd('0x5b')]?JSON[_0x70dd('0x28')](_0x38560f['body']):_0x70dd('0x7e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5111d5);}return null;})[_0x70dd('0x37')](function(_0x16143d){var _0x370476=_0x70dd('0x6e')+_0x16143d[_0x70dd('0x2b')]['ContactId'];return db[_0x70dd('0x70')][_0x70dd('0x41')](_0x370476,{'type':db[_0x70dd('0x7f')][_0x70dd('0x80')][_0x70dd('0x81')],'raw':!![]})['then'](function(_0x4eb22a){return _0x4eb22a;});})['then'](function(_0x3b9e52){if(_0x3b9e52){_0x5111d5[_0x70dd('0x2b')]['contact']=_0x3b9e52[0x0];if(!_0x38560f[_0x70dd('0x5b')][_0x70dd('0x64')])return;return db[_0x70dd('0x71')]['find']({'where':{'id':_0x38560f[_0x70dd('0x5b')][_0x70dd('0x64')],'role':_0x70dd('0x66')},'attributes':['id','name',_0x70dd('0x72'),_0x70dd('0x73'),_0x70dd('0x74')],'raw':!![]});}return null;})[_0x70dd('0x37')](function(_0x305b6b){if(!_0x305b6b)return null;_0x5111d5[_0x70dd('0x2b')]['agent']=_0x305b6b;return _0x5111d5;})['then'](function(_0x1c250a){if(_0x1c250a){_0x1c250a['message'][_0x70dd('0x82')]=util[_0x70dd('0x62')](_0x70dd('0x83'),_0x38560f['user']['name']);_0x1c250a[_0x70dd('0x2b')][_0x70dd('0x76')]=_0x5111d5[_0x70dd('0x76')];_0x1c250a[_0x70dd('0x2b')][_0x70dd('0x77')]=_0x5111d5[_0x70dd('0x76')];_0x1c250a[_0x70dd('0x2b')]['event']=_0x70dd('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x70dd('0x84'),'message':_0x1c250a[_0x70dd('0x2b')]},client9002);return _0x5111d5;}return null;})[_0x70dd('0x37')](respondWithResult(_0x27ba94,null))['catch'](handleError(_0x27ba94,null));}; \ No newline at end of file +var _0x18c3=['rows','show','find','create','body','params','describe','accept','openchannel','read','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes','User','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./openchannelMessage.socket','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x45a261,_0x4cd98a){var _0x341ab3=function(_0x2044ea){while(--_0x2044ea){_0x45a261['push'](_0x45a261['shift']());}};_0x341ab3(++_0x4cd98a);}(_0x18c3,0x136));var _0x318c=function(_0x142b99,_0x1d85e2){_0x142b99=_0x142b99-0x0;var _0x539ecd=_0x18c3[_0x142b99];return _0x539ecd;};'use strict';var emlformat=require(_0x318c('0x0'));var rimraf=require(_0x318c('0x1'));var zipdir=require(_0x318c('0x2'));var jsonpatch=require(_0x318c('0x3'));var rp=require('request-promise');var moment=require(_0x318c('0x4'));var BPromise=require(_0x318c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x318c('0x6'));var sox=require(_0x318c('0x7'));var csv=require(_0x318c('0x8'));var ejs=require(_0x318c('0x9'));var fs=require('fs');var fs_extra=require(_0x318c('0xa'));var _=require('lodash');var squel=require(_0x318c('0xb'));var crypto=require(_0x318c('0xc'));var jsforce=require(_0x318c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x318c('0x8'));var querystring=require(_0x318c('0xe'));var Papa=require('papaparse');var Redis=require(_0x318c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x318c('0x10'));var as=require(_0x318c('0x11'));var hardwareService=require(_0x318c('0x12'));var logger=require(_0x318c('0x13'))(_0x318c('0x14'));var utils=require(_0x318c('0x15'));var config=require(_0x318c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x318c('0x17')]=_['defaults'](config[_0x318c('0x17')],{'host':_0x318c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x318c('0x17')]));require(_0x318c('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x318c('0x1a')][_0x318c('0x1b')]({'port':0x232c});var client9002=jayson[_0x318c('0x1a')][_0x318c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5aca1f,_0x4fe18d,_0x532fb2,_0x4af510){return new BPromise(function(_0x58f0be,_0x2a0f62){var _0x53688b=_0x4af510||client;return _0x53688b[_0x318c('0x1c')](_0x5aca1f,_0x532fb2)[_0x318c('0x1d')](function(_0x2fc427){logger[_0x318c('0x1e')](_0x318c('0x1f'),_0x4fe18d,_0x318c('0x20'));logger['debug'](_0x318c('0x21'),_0x4fe18d,_0x318c('0x20'),JSON[_0x318c('0x22')](_0x2fc427));if(_0x2fc427[_0x318c('0x23')]){if(_0x2fc427[_0x318c('0x23')][_0x318c('0x24')]===0x1f4){logger[_0x318c('0x23')](_0x318c('0x1f'),_0x4fe18d,_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);return _0x2a0f62(_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);}logger[_0x318c('0x23')](_0x318c('0x1f'),_0x4fe18d,_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);return _0x58f0be(_0x2fc427[_0x318c('0x23')][_0x318c('0x25')]);}else{logger['info'](_0x318c('0x1f'),_0x4fe18d,_0x318c('0x20'));_0x58f0be(_0x2fc427[_0x318c('0x26')][_0x318c('0x25')]);}})[_0x318c('0x27')](function(_0x48410e){logger['error'](_0x318c('0x1f'),_0x4fe18d,_0x48410e);_0x2a0f62(_0x48410e);});});}function respondWithStatusCode(_0x813b08,_0x42a28b){_0x42a28b=_0x42a28b||0xcc;return function(_0x3ec184){if(_0x3ec184){return _0x813b08[_0x318c('0x28')](_0x42a28b);}return _0x813b08[_0x318c('0x29')](_0x42a28b)[_0x318c('0x2a')]();};}function respondWithResult(_0x39d43c,_0x4e26b5){_0x4e26b5=_0x4e26b5||0xc8;return function(_0x301362){if(_0x301362){return _0x39d43c[_0x318c('0x29')](_0x4e26b5)[_0x318c('0x2b')](_0x301362);}};}function respondWithFilteredResult(_0x261e6f,_0x49d3ec){return function(_0x535215){if(_0x535215){var _0x235cf6=typeof _0x49d3ec[_0x318c('0x2c')]===_0x318c('0x2d')&&typeof _0x49d3ec[_0x318c('0x2e')]===_0x318c('0x2d');var _0x55103c=_0x535215[_0x318c('0x2f')];var _0xe14dfd=_0x235cf6?0x0:_0x49d3ec['offset'];var _0x415806=_0x235cf6?_0x535215['count']:_0x49d3ec[_0x318c('0x2c')]+_0x49d3ec['limit'];var _0x18f58b;if(_0x415806>=_0x55103c){_0x415806=_0x55103c;_0x18f58b=0xc8;}else{_0x18f58b=0xce;}_0x261e6f[_0x318c('0x29')](_0x18f58b);return _0x261e6f['set'](_0x318c('0x30'),_0xe14dfd+'-'+_0x415806+'/'+_0x55103c)[_0x318c('0x2b')](_0x535215);}return null;};}function patchUpdates(_0x1d00d5){return function(_0x298d56){try{jsonpatch[_0x318c('0x31')](_0x298d56,_0x1d00d5,!![]);}catch(_0x28adeb){return BPromise[_0x318c('0x32')](_0x28adeb);}return _0x298d56[_0x318c('0x33')]();};}function saveUpdates(_0x35175b,_0x427be7){return function(_0x39c9ae){if(_0x39c9ae){return _0x39c9ae[_0x318c('0x34')](_0x35175b)[_0x318c('0x1d')](function(_0x6a5052){return _0x6a5052;});}return null;};}function removeEntity(_0x19656f,_0xd43df9){return function(_0x488218){if(_0x488218){return _0x488218[_0x318c('0x35')]()['then'](function(){_0x19656f[_0x318c('0x29')](0xcc)[_0x318c('0x2a')]();});}};}function handleEntityNotFound(_0x33f750,_0x29a8f5){return function(_0x53faa2){if(!_0x53faa2){_0x33f750['sendStatus'](0x194);}return _0x53faa2;};}function handleError(_0x565a83,_0x125c0d){_0x125c0d=_0x125c0d||0x1f4;return function(_0x334013){logger[_0x318c('0x23')](_0x334013[_0x318c('0x36')]);if(_0x334013[_0x318c('0x37')]){delete _0x334013[_0x318c('0x37')];}_0x565a83[_0x318c('0x29')](_0x125c0d)[_0x318c('0x38')](_0x334013);};}exports[_0x318c('0x39')]=function(_0x523bc4,_0x246cfc){var _0x14cb03={},_0x1f6c3b={},_0x4d8cdb={'count':0x0,'rows':[]};var _0x4be505=_[_0x318c('0x3a')](db[_0x318c('0x3b')][_0x318c('0x3c')],function(_0x625db9){return{'name':_0x625db9[_0x318c('0x3d')],'type':_0x625db9['type'][_0x318c('0x3e')]};});_0x1f6c3b[_0x318c('0x3f')]=_[_0x318c('0x3a')](_0x4be505,'name');_0x1f6c3b[_0x318c('0x40')]=_[_0x318c('0x41')](_0x523bc4['query']);_0x1f6c3b[_0x318c('0x42')]=_[_0x318c('0x43')](_0x1f6c3b[_0x318c('0x3f')],_0x1f6c3b[_0x318c('0x40')]);_0x14cb03[_0x318c('0x44')]=_['intersection'](_0x1f6c3b['model'],qs[_0x318c('0x45')](_0x523bc4[_0x318c('0x40')][_0x318c('0x45')]));_0x14cb03[_0x318c('0x44')]=_0x14cb03[_0x318c('0x44')][_0x318c('0x46')]?_0x14cb03[_0x318c('0x44')]:_0x1f6c3b[_0x318c('0x3f')];if(!_0x523bc4['query']['hasOwnProperty'](_0x318c('0x47'))){_0x14cb03['limit']=qs['limit'](_0x523bc4[_0x318c('0x40')][_0x318c('0x2e')]);_0x14cb03[_0x318c('0x2c')]=qs['offset'](_0x523bc4[_0x318c('0x40')][_0x318c('0x2c')]);}_0x14cb03['order']=qs[_0x318c('0x48')](_0x523bc4[_0x318c('0x40')][_0x318c('0x48')]);_0x14cb03[_0x318c('0x49')]=qs['filters'](_[_0x318c('0x4a')](_0x523bc4[_0x318c('0x40')],_0x1f6c3b[_0x318c('0x42')]),_0x4be505);if(_0x523bc4[_0x318c('0x40')][_0x318c('0x4b')]){_0x14cb03[_0x318c('0x49')]=_[_0x318c('0x4c')](_0x14cb03['where'],{'$or':_[_0x318c('0x3a')](_0x4be505,function(_0x54d722){if(_0x54d722[_0x318c('0x4d')]!==_0x318c('0x4e')){var _0x433fd4={};_0x433fd4[_0x54d722['name']]={'$like':'%'+_0x523bc4[_0x318c('0x40')][_0x318c('0x4b')]+'%'};return _0x433fd4;}})});}_0x14cb03=_[_0x318c('0x4c')]({},_0x14cb03,_0x523bc4[_0x318c('0x4f')]);var _0x34b55e={'where':_0x14cb03['where']};return db[_0x318c('0x3b')][_0x318c('0x2f')](_0x34b55e)[_0x318c('0x1d')](function(_0x4db86a){_0x4d8cdb[_0x318c('0x2f')]=_0x4db86a;if(_0x523bc4['query'][_0x318c('0x50')]){_0x14cb03[_0x318c('0x51')]=[{'all':!![]}];}return db[_0x318c('0x3b')][_0x318c('0x52')](_0x14cb03);})[_0x318c('0x1d')](function(_0x1c6779){_0x4d8cdb[_0x318c('0x53')]=_0x1c6779;return _0x4d8cdb;})[_0x318c('0x1d')](respondWithFilteredResult(_0x246cfc,_0x14cb03))[_0x318c('0x27')](handleError(_0x246cfc,null));};exports[_0x318c('0x54')]=function(_0x4e9913,_0x561e15){var _0x351fdb={'raw':!![],'where':{'id':_0x4e9913['params']['id']}},_0x11b8a6={};_0x11b8a6[_0x318c('0x3f')]=_[_0x318c('0x41')](db[_0x318c('0x3b')][_0x318c('0x3c')]);_0x11b8a6['query']=_[_0x318c('0x41')](_0x4e9913['query']);_0x11b8a6['filters']=_[_0x318c('0x43')](_0x11b8a6[_0x318c('0x3f')],_0x11b8a6[_0x318c('0x40')]);_0x351fdb[_0x318c('0x44')]=_['intersection'](_0x11b8a6['model'],qs['fields'](_0x4e9913[_0x318c('0x40')][_0x318c('0x45')]));_0x351fdb[_0x318c('0x44')]=_0x351fdb[_0x318c('0x44')]['length']?_0x351fdb[_0x318c('0x44')]:_0x11b8a6[_0x318c('0x3f')];if(_0x4e9913[_0x318c('0x40')][_0x318c('0x50')]){_0x351fdb[_0x318c('0x51')]=[{'all':!![]}];}_0x351fdb=_['merge']({},_0x351fdb,_0x4e9913[_0x318c('0x4f')]);return db[_0x318c('0x3b')][_0x318c('0x55')](_0x351fdb)[_0x318c('0x1d')](handleEntityNotFound(_0x561e15,null))[_0x318c('0x1d')](respondWithResult(_0x561e15,null))['catch'](handleError(_0x561e15,null));};exports[_0x318c('0x56')]=function(_0x811755,_0xf4afbf){return db[_0x318c('0x3b')][_0x318c('0x56')](_0x811755[_0x318c('0x57')],{})[_0x318c('0x1d')](respondWithResult(_0xf4afbf,0xc9))[_0x318c('0x27')](handleError(_0xf4afbf,null));};exports['update']=function(_0x495e6a,_0x4bad46){if(_0x495e6a[_0x318c('0x57')]['id']){delete _0x495e6a[_0x318c('0x57')]['id'];}return db[_0x318c('0x3b')]['find']({'where':{'id':_0x495e6a[_0x318c('0x58')]['id']}})[_0x318c('0x1d')](handleEntityNotFound(_0x4bad46,null))['then'](saveUpdates(_0x495e6a[_0x318c('0x57')],null))['then'](respondWithResult(_0x4bad46,null))['catch'](handleError(_0x4bad46,null));};exports[_0x318c('0x35')]=function(_0x3e6363,_0x42c711){return db['OpenchannelMessage'][_0x318c('0x55')]({'where':{'id':_0x3e6363['params']['id']}})['then'](handleEntityNotFound(_0x42c711,null))[_0x318c('0x1d')](removeEntity(_0x42c711,null))[_0x318c('0x27')](handleError(_0x42c711,null));};exports[_0x318c('0x59')]=function(_0x39d6fb,_0x4682c1){return db[_0x318c('0x3b')][_0x318c('0x59')]()[_0x318c('0x1d')](respondWithResult(_0x4682c1,null))['catch'](handleError(_0x4682c1,null));};var interaction_log=require(_0x318c('0x13'))('openchannel-interactions');exports[_0x318c('0x5a')]=function(_0xc27de0,_0xbcb79,_0x101ae6){var _0x33d4e9={'agent':{},'channel':_0x318c('0x5b')};if(_0xc27de0[_0x318c('0x57')]['id']){delete _0xc27de0[_0x318c('0x57')]['id'];}_0xc27de0[_0x318c('0x57')][_0x318c('0x5c')]=!![];_0xc27de0['body']['readAt']=moment()[_0x318c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')]=_0xc27de0[_0x318c('0x57')]['UserId']||_0xc27de0[_0x318c('0x5f')]['id'];_0x33d4e9[_0x318c('0x60')]['id']=_0xc27de0[_0x318c('0x57')]['UserId'];return db[_0x318c('0x3b')][_0x318c('0x55')]({'where':{'id':_0xc27de0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbcb79,null))[_0x318c('0x1d')](saveUpdates(_0xc27de0['body'],null))[_0x318c('0x1d')](function(_0xeb01d6){if(_0xeb01d6){_0x33d4e9[_0x318c('0x25')]=_0xeb01d6[_0x318c('0x61')]({'plain':!![]});return db[_0x318c('0x62')][_0x318c('0x55')]({'where':{'id':_0xeb01d6[_0x318c('0x63')]}});}return null;})[_0x318c('0x1d')](handleEntityNotFound(_0xbcb79,null))[_0x318c('0x1d')](function(_0x40fd87){if(_0x40fd87){return _0x40fd87[_0x318c('0x34')]({'UserId':_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')],'read1stAt':_['isNil'](_0x40fd87[_0x318c('0x64')])?moment()[_0x318c('0x5d')](_0x318c('0x65')):undefined});}return null;})[_0x318c('0x1d')](function(_0x599b9a){if(_0x599b9a){_0x33d4e9['interaction']=_0x599b9a[_0x318c('0x61')]({'plain':!![]});interaction_log[_0x318c('0x1e')](_0x318c('0x66'),_0xc27de0['user']['id'],_0xc27de0[_0x318c('0x5f')][_0x318c('0x37')],_0xc27de0['user']['role'],_0x33d4e9['interaction']['id'],_0xc27de0[_0x318c('0x57')]?JSON[_0x318c('0x22')](_0xc27de0[_0x318c('0x57')]):_0x318c('0x67'));return respondWithRpcPromise(_0x318c('0x68'),_0x318c('0x69'),_0x33d4e9);}return null;})[_0x318c('0x1d')](function(_0x44a40e){var _0xa46f32=_0x318c('0x6a')+_0x44a40e[_0x318c('0x25')][_0x318c('0x6b')];return db[_0x318c('0x6c')]['query'](_0xa46f32,{'type':db[_0x318c('0x6d')]['QueryTypes'][_0x318c('0x6e')],'raw':!![]})[_0x318c('0x1d')](function(_0x8abfe0){return _0x8abfe0;});})[_0x318c('0x1d')](function(_0x313479){if(_0x313479){_0x33d4e9[_0x318c('0x25')][_0x318c('0x6f')]=_0x313479[0x0];if(!_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')])return;return db['User'][_0x318c('0x55')]({'where':{'id':_0xc27de0[_0x318c('0x57')][_0x318c('0x5e')],'role':'agent'},'attributes':['id',_0x318c('0x37'),_0x318c('0x70'),_0x318c('0x71'),_0x318c('0x72')],'raw':!![]});}return null;})[_0x318c('0x1d')](function(_0x5bc581){if(!_0x5bc581)return null;_0x33d4e9[_0x318c('0x25')][_0x318c('0x60')]=_0x5bc581;return _0x33d4e9;})['then'](function(_0x23caef){if(_0x23caef){if(_0xc27de0['body'][_0x318c('0x73')]){_0x33d4e9['message'][_0x318c('0x74')]=util[_0x318c('0x5d')](_0x318c('0x75'),_0xc27de0[_0x318c('0x5f')][_0x318c('0x37')]);_0x33d4e9[_0x318c('0x25')][_0x318c('0x76')]=_0x33d4e9[_0x318c('0x76')];_0x33d4e9[_0x318c('0x25')]['motionChannel']=_0x33d4e9['channel'];_0x33d4e9[_0x318c('0x25')][_0x318c('0x77')]=_0x318c('0x5a');return respondWithRpcPromise(_0x318c('0x78'),'EventManager',{'event':_0x318c('0x79'),'message':_0x33d4e9[_0x318c('0x25')]},client9002)[_0x318c('0x1d')](function(){return _0x33d4e9;});}return _0x33d4e9;}return null;})[_0x318c('0x1d')](respondWithResult(_0xbcb79,null))['catch'](handleError(_0xbcb79,null));};var interaction_log=require(_0x318c('0x13'))(_0x318c('0x7a'));exports[_0x318c('0x32')]=function(_0x53e3dc,_0x384ae1,_0x10d5ce){var _0x2f58b0={'agent':{},'channel':_0x318c('0x5b')};if(_0x53e3dc[_0x318c('0x57')]['id']){delete _0x53e3dc[_0x318c('0x57')]['id'];}_0x53e3dc[_0x318c('0x57')][_0x318c('0x5e')]=_0x53e3dc['body'][_0x318c('0x5e')]||_0x53e3dc[_0x318c('0x5f')]['id'];_0x2f58b0[_0x318c('0x60')]['id']=_0x53e3dc[_0x318c('0x57')][_0x318c('0x5e')];return db['OpenchannelMessage'][_0x318c('0x55')]({'where':{'id':_0x53e3dc[_0x318c('0x58')]['id'],'UserId':null}})[_0x318c('0x1d')](handleEntityNotFound(_0x384ae1,null))['then'](function(_0x19a94d){if(_0x19a94d){_0x2f58b0['message']=_0x19a94d[_0x318c('0x61')]({'plain':!![]});return db[_0x318c('0x62')][_0x318c('0x55')]({'where':{'id':_0x19a94d[_0x318c('0x63')]}});}return null;})[_0x318c('0x1d')](handleEntityNotFound(_0x384ae1,null))[_0x318c('0x1d')](function(_0x11cac1){if(_0x11cac1){_0x2f58b0[_0x318c('0x7b')]=_0x11cac1['get']({'plain':!![]});interaction_log['info'](_0x318c('0x7c'),_0x53e3dc[_0x318c('0x5f')]['id'],_0x53e3dc[_0x318c('0x5f')][_0x318c('0x37')],_0x53e3dc[_0x318c('0x5f')][_0x318c('0x7d')],_0x2f58b0[_0x318c('0x7b')]['id'],_0x53e3dc[_0x318c('0x57')]?JSON[_0x318c('0x22')](_0x53e3dc[_0x318c('0x57')]):_0x318c('0x67'));return respondWithRpcPromise('RejectMessage',_0x318c('0x7e'),_0x2f58b0);}return null;})[_0x318c('0x1d')](function(_0x45a8c1){var _0x6b76d2=_0x318c('0x6a')+_0x45a8c1[_0x318c('0x25')]['ContactId'];return db[_0x318c('0x6c')][_0x318c('0x40')](_0x6b76d2,{'type':db[_0x318c('0x6d')][_0x318c('0x7f')][_0x318c('0x6e')],'raw':!![]})[_0x318c('0x1d')](function(_0x270a47){return _0x270a47;});})[_0x318c('0x1d')](function(_0x583ff1){if(_0x583ff1){_0x2f58b0[_0x318c('0x25')][_0x318c('0x6f')]=_0x583ff1[0x0];if(!_0x53e3dc['body']['UserId'])return;return db[_0x318c('0x80')][_0x318c('0x55')]({'where':{'id':_0x53e3dc[_0x318c('0x57')]['UserId'],'role':_0x318c('0x60')},'attributes':['id','name','fullname',_0x318c('0x71'),_0x318c('0x72')],'raw':!![]});}return null;})[_0x318c('0x1d')](function(_0x5687b5){if(!_0x5687b5)return null;_0x2f58b0['message']['agent']=_0x5687b5;return _0x2f58b0;})['then'](function(_0x2e99e1){if(_0x2e99e1){_0x2e99e1[_0x318c('0x25')][_0x318c('0x74')]=util[_0x318c('0x5d')](_0x318c('0x75'),_0x53e3dc[_0x318c('0x5f')]['name']);_0x2e99e1['message'][_0x318c('0x76')]=_0x2f58b0[_0x318c('0x76')];_0x2e99e1[_0x318c('0x25')][_0x318c('0x81')]=_0x2f58b0[_0x318c('0x76')];_0x2e99e1[_0x318c('0x25')][_0x318c('0x77')]=_0x318c('0x32');respondWithRpcPromise(_0x318c('0x78'),_0x318c('0x78'),{'event':_0x318c('0x82'),'message':_0x2e99e1['message']},client9002);return _0x2f58b0;}return null;})['then'](respondWithResult(_0x384ae1,null))[_0x318c('0x27')](handleError(_0x384ae1,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 45f83ce..d63d7ef 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 _0x1fda=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1fda,0x19b));var _0xa1fd=function(_0x50f697,_0x11e9cf){_0x50f697=_0x50f697-0x0;var _0x46e0cb=_0x1fda[_0x50f697];return _0x46e0cb;};'use strict';var EventEmitter=require(_0xa1fd('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa1fd('0x1')](0x0);var events={'afterCreate':_0xa1fd('0x2'),'afterUpdate':_0xa1fd('0x3'),'afterDestroy':_0xa1fd('0x4')};function emitEvent(_0x314b78){return function(_0x26fe0e,_0x8175a0,_0x1056c8){OpenchannelMessageEvents['emit'](_0x314b78+':'+_0x26fe0e['id'],_0x26fe0e);OpenchannelMessageEvents[_0xa1fd('0x5')](_0x314b78,_0x26fe0e);_0x1056c8(null);};}for(var e in events){if(events[_0xa1fd('0x6')](e)){var event=events[e];OpenchannelMessage[_0xa1fd('0x7')](e,emitEvent(event));}}module[_0xa1fd('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xe636=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0xbb6fb5,_0x4db9fb){var _0x2f9501=function(_0x4a9b92){while(--_0x4a9b92){_0xbb6fb5['push'](_0xbb6fb5['shift']());}};_0x2f9501(++_0x4db9fb);}(_0xe636,0x69));var _0x6e63=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0xe636[_0x3d78d7];return _0x4b6784;};'use strict';var EventEmitter=require(_0x6e63('0x0'));var OpenchannelMessage=require(_0x6e63('0x1'))['db'][_0x6e63('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6e63('0x3')](0x0);var events={'afterCreate':_0x6e63('0x4'),'afterUpdate':_0x6e63('0x5'),'afterDestroy':_0x6e63('0x6')};function emitEvent(_0x5b5e49){return function(_0x51dcae,_0x47e0d8,_0x268f91){OpenchannelMessageEvents['emit'](_0x5b5e49+':'+_0x51dcae['id'],_0x51dcae);OpenchannelMessageEvents[_0x6e63('0x7')](_0x5b5e49,_0x51dcae);_0x268f91(null);};}for(var e in events){if(events[_0x6e63('0x8')](e)){var event=events[e];OpenchannelMessage[_0x6e63('0x9')](e,emitEvent(event));}}module[_0x6e63('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 07f981c..66abc0b 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 _0x32d2=['catch','error','out','describe','find','Interactions','CmContact','Contact','keys','then','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','body','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update'];(function(_0xe501ff,_0x955b7e){var _0x17135d=function(_0x8e3458){while(--_0x8e3458){_0xe501ff['push'](_0xe501ff['shift']());}};_0x17135d(++_0x955b7e);}(_0x32d2,0x1b5));var _0x232d=function(_0x46fa93,_0x4c1659){_0x46fa93=_0x46fa93-0x0;var _0x13f9fd=_0x32d2[_0x46fa93];return _0x13f9fd;};'use strict';var _=require('lodash');var util=require(_0x232d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x232d('0x1'));var BPromise=require(_0x232d('0x2'));var rp=require(_0x232d('0x3'));var fs=require('fs');var path=require(_0x232d('0x4'));var rimraf=require(_0x232d('0x5'));var config=require(_0x232d('0x6'));var attributes=require(_0x232d('0x7'));module['exports']=function(_0x4a57d5,_0x50ac23){return _0x4a57d5[_0x232d('0x8')](_0x232d('0x9'),attributes,{'tableName':_0x232d('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x232d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b2d57,_0x54a997,_0xc74640){var _0x196789=_0x4a57d5[_0x232d('0xc')];var _0x972b2d=_0x4b2d57['get']({'plain':!![]});if(_0x972b2d[_0x232d('0xd')][_0x232d('0xe')]()==='in'||_0x972b2d['direction'][_0x232d('0xe')]()==='out'&&!_0x972b2d[_0x232d('0xf')]&&!_[_0x232d('0x10')](_0x972b2d[_0x232d('0x11')])){_0x196789[_0x232d('0x12')][_0x232d('0x13')]({'where':{'id':_0x972b2d[_0x232d('0x14')]}})['then'](function(_0x43eb47){if(_0x43eb47){_0x43eb47[_0x232d('0x15')]({'lastMsgAt':_0x972b2d['createdAt'],'lastMsgDirection':_0x972b2d[_0x232d('0xd')][_0x232d('0xe')]()});}})[_0x232d('0x16')](function(_0x144e72){console[_0x232d('0x17')](_0x144e72);});}if(_0x972b2d[_0x232d('0xd')]===_0x232d('0x18')&&!_0x972b2d[_0x232d('0xf')]){var _0xcee8d0;_0x196789['CmContact'][_0x232d('0x19')]()['then'](function(_0x5db108){return _0x196789['OpenchannelAccount'][_0x232d('0x1a')]({'where':{'id':_0x972b2d['OpenchannelAccountId']},'include':[{'model':_0x196789[_0x232d('0x12')],'as':_0x232d('0x1b'),'where':{'id':_0x972b2d[_0x232d('0x14')]},'limit':0x1,'include':[{'model':_0x196789[_0x232d('0x1c')],'as':_0x232d('0x1d'),'attributes':_[_0x232d('0x1e')](_0x5db108)}]}]});})[_0x232d('0x1f')](function(_0xff6a85){_0xcee8d0=_0xff6a85[_0x232d('0x20')]({'plain':!![]});if(_0xcee8d0&&_0xcee8d0[_0x232d('0x21')]){logger['info'](_0x232d('0x22'),_0x232d('0x23'),util['format'](_0x232d('0x24'),_0x972b2d['id'],_0xcee8d0[_0x232d('0x21')]));if(_0xcee8d0[_0x232d('0x1b')]&&_0xcee8d0[_0x232d('0x1b')][_0x232d('0x25')]){_0x972b2d[_0x232d('0x26')]=_[_0x232d('0x27')](_0xcee8d0[_0x232d('0x1b')][0x0],_0x232d('0x1d'));_0x972b2d[_0x232d('0x1d')]=_0xcee8d0[_0x232d('0x1b')][0x0][_0x232d('0x1d')];}var _0x54a997={'method':_0x232d('0x28'),'uri':encodeURI(_0xcee8d0[_0x232d('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x54a997[_0x232d('0x29')]){case _0x232d('0x2a'):_0x54a997['qs']=_0x972b2d;break;case _0x232d('0x28'):_0x54a997[_0x232d('0x2b')]=_0x972b2d;break;}return rp(_0x54a997)[_0x232d('0x1f')](function(_0x19adc1){logger[_0x232d('0x2c')](_0x232d('0x22'),_0x232d('0x23'),util[_0x232d('0x2d')](_0x232d('0x2e'),_0x972b2d['id'],_0xcee8d0['replyUri']));if(_0x19adc1['body'][_0x232d('0x2f')]&&_0x19adc1[_0x232d('0x2b')][_0x232d('0x2f')]!=_0x972b2d['Interaction'][_0x232d('0x2f')]){return _0x196789[_0x232d('0x12')]['update']({'threadId':_0x19adc1[_0x232d('0x2b')][_0x232d('0x2f')]},{'where':{'id':_0x972b2d[_0x232d('0x26')]['id']}});}else{return;}})[_0x232d('0x1f')](function(){return _0x4b2d57['update']({'read':!![]});})[_0x232d('0x16')](function(_0x4f425d){logger['error'](_0x232d('0x22'),_0x232d('0x23'),util[_0x232d('0x30')](_0x4f425d,{'showHidden':![],'depth':null}));_0xc74640();});}else{_0xc74640();}})[_0x232d('0x31')](function(){_0xc74640();});}else{_0xc74640();}}},'charset':_0x232d('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x11a8=['describe','OpenchannelAccount','OpenchannelAccountId','Contact','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Interactions','length','method','POST','info','threadId','Interaction','OpenchannelInteraction','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact'];(function(_0x32e6b9,_0x1ba001){var _0xd18132=function(_0x10af6a){while(--_0x10af6a){_0x32e6b9['push'](_0x32e6b9['shift']());}};_0xd18132(++_0x1ba001);}(_0x11a8,0x13a));var _0x811a=function(_0x310965,_0x576316){_0x310965=_0x310965-0x0;var _0x66caaf=_0x11a8[_0x310965];return _0x66caaf;};'use strict';var _=require(_0x811a('0x0'));var util=require('util');var logger=require(_0x811a('0x1'))(_0x811a('0x2'));var moment=require('moment');var BPromise=require(_0x811a('0x3'));var rp=require(_0x811a('0x4'));var fs=require('fs');var path=require(_0x811a('0x5'));var rimraf=require(_0x811a('0x6'));var config=require(_0x811a('0x7'));var attributes=require(_0x811a('0x8'));module[_0x811a('0x9')]=function(_0x239723,_0xf2604e){return _0x239723[_0x811a('0xa')](_0x811a('0xb'),attributes,{'tableName':_0x811a('0xc'),'paranoid':![],'indexes':[{'name':_0x811a('0xd'),'fields':[_0x811a('0xe')],'type':_0x811a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31cd36,_0x4695b7,_0x50e9c5){var _0x511483=_0x239723[_0x811a('0x10')];var _0x34cde3=_0x31cd36[_0x811a('0x11')]({'plain':!![]});if(_0x34cde3[_0x811a('0x12')][_0x811a('0x13')]()==='in'||_0x34cde3[_0x811a('0x12')][_0x811a('0x13')]()===_0x811a('0x14')&&!_0x34cde3[_0x811a('0x15')]&&!_['isNil'](_0x34cde3['UserId'])){_0x511483['OpenchannelInteraction'][_0x811a('0x16')]({'where':{'id':_0x34cde3[_0x811a('0x17')]}})[_0x811a('0x18')](function(_0x1ea29f){if(_0x1ea29f){_0x1ea29f[_0x811a('0x19')]({'lastMsgAt':_0x34cde3['createdAt'],'lastMsgDirection':_0x34cde3[_0x811a('0x12')][_0x811a('0x13')]()});}})[_0x811a('0x1a')](function(_0x17d393){console[_0x811a('0x1b')](_0x17d393);});}if(_0x34cde3['direction']==='out'&&!_0x34cde3[_0x811a('0x15')]){var _0x397d49;_0x511483[_0x811a('0x1c')][_0x811a('0x1d')]()[_0x811a('0x18')](function(_0xe49ee2){return _0x511483[_0x811a('0x1e')]['find']({'where':{'id':_0x34cde3[_0x811a('0x1f')]},'include':[{'model':_0x511483['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x34cde3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x511483[_0x811a('0x1c')],'as':_0x811a('0x20'),'attributes':_['keys'](_0xe49ee2)}]}]});})[_0x811a('0x18')](function(_0xea3a80){_0x397d49=_0xea3a80[_0x811a('0x11')]({'plain':!![]});if(_0x397d49&&_0x397d49[_0x811a('0x21')]){logger['info'](_0x811a('0x22'),'afterCreate',util[_0x811a('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x34cde3['id'],_0x397d49[_0x811a('0x21')]));if(_0x397d49['Interactions']&&_0x397d49[_0x811a('0x24')][_0x811a('0x25')]){_0x34cde3['Interaction']=_['omit'](_0x397d49[_0x811a('0x24')][0x0],_0x811a('0x20'));_0x34cde3[_0x811a('0x20')]=_0x397d49[_0x811a('0x24')][0x0][_0x811a('0x20')];}var _0x4695b7={'method':'POST','uri':encodeURI(_0x397d49[_0x811a('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4695b7[_0x811a('0x26')]){case'GET':_0x4695b7['qs']=_0x34cde3;break;case _0x811a('0x27'):_0x4695b7[_0x811a('0xe')]=_0x34cde3;break;}return rp(_0x4695b7)[_0x811a('0x18')](function(_0x4a88e7){logger[_0x811a('0x28')](_0x811a('0x22'),'afterCreate',util[_0x811a('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x34cde3['id'],_0x397d49[_0x811a('0x21')]));if(_0x4a88e7[_0x811a('0xe')][_0x811a('0x29')]&&_0x4a88e7[_0x811a('0xe')][_0x811a('0x29')]!=_0x34cde3[_0x811a('0x2a')][_0x811a('0x29')]){return _0x511483[_0x811a('0x2b')]['update']({'threadId':_0x4a88e7[_0x811a('0xe')][_0x811a('0x29')]},{'where':{'id':_0x34cde3[_0x811a('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x31cd36[_0x811a('0x19')]({'read':!![]});})['catch'](function(_0x1093c9){logger[_0x811a('0x1b')](_0x811a('0x22'),_0x811a('0x2c'),util[_0x811a('0x2d')](_0x1093c9,{'showHidden':![],'depth':null}));_0x50e9c5();});}else{_0x50e9c5();}})[_0x811a('0x2e')](function(){_0x50e9c5();});}else{_0x50e9c5();}}},'charset':_0x811a('0x2f'),'collate':_0x811a('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4f9af53..0867489 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0xc55d64,_0x133f2d){var _0x4194f6=function(_0x4a38c9){while(--_0x4a38c9){_0xc55d64['push'](_0xc55d64['shift']());}};_0x4194f6(++_0x133f2d);}(_0xdb28,0x106));var _0x8db2=function(_0x1ab0ff,_0x5d82a3){_0x1ab0ff=_0x1ab0ff-0x0;var _0x4406f6=_0xdb28[_0x1ab0ff];return _0x4406f6;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ 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(_0x14dc90,_0x2b8096){var _0x57fd45=function(_0x40eacc){while(--_0x40eacc){_0x14dc90['push'](_0x14dc90['shift']());}};_0x57fd45(++_0x2b8096);}(_0x5f2f,0x73));var _0xf5f2=function(_0x54d256,_0x3d8cd4){_0x54d256=_0x54d256-0x0;var _0x2ab4f2=_0x5f2f[_0x54d256];return _0x2ab4f2;};'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 319612c..29908a2 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 _0x1b94=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x2c3048,_0x58b4fb){var _0x5c844d=function(_0x1886fa){while(--_0x1886fa){_0x2c3048['push'](_0x2c3048['shift']());}};_0x5c844d(++_0x58b4fb);}(_0x1b94,0x1f2));var _0x41b9=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x1b94[_0x4ff09b];return _0x3f5c2e;};'use strict';var OpenchannelMessageEvents=require(_0x41b9('0x0'));var events=[_0x41b9('0x1'),_0x41b9('0x2'),_0x41b9('0x3')];function createListener(_0x29b996,_0x4b456b){return function(_0x132025){_0x4b456b[_0x41b9('0x4')](_0x29b996,_0x132025);};}function removeListener(_0x864f17,_0x57f10c){return function(){OpenchannelMessageEvents[_0x41b9('0x5')](_0x864f17,_0x57f10c);};}exports[_0x41b9('0x6')]=function(_0x368c00){for(var _0x5e58d8=0x0,_0x310fd8=events[_0x41b9('0x7')];_0x5e58d8<_0x310fd8;_0x5e58d8++){var _0x2a0eed=events[_0x5e58d8];var _0x37b187=createListener(_0x41b9('0x8')+_0x2a0eed,_0x368c00);OpenchannelMessageEvents['on'](_0x2a0eed,_0x37b187);}}; \ No newline at end of file +var _0xd69e=['openchannelMessage:','./openchannelMessage.events','save','update','emit','register','length'];(function(_0x4b4534,_0x43d101){var _0xebcd22=function(_0x1005e2){while(--_0x1005e2){_0x4b4534['push'](_0x4b4534['shift']());}};_0xebcd22(++_0x43d101);}(_0xd69e,0x1e4));var _0xed69=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd69e[_0x2be8c2];return _0x97f531;};'use strict';var OpenchannelMessageEvents=require(_0xed69('0x0'));var events=[_0xed69('0x1'),'remove',_0xed69('0x2')];function createListener(_0x3af36d,_0x22a4f5){return function(_0x537a41){_0x22a4f5[_0xed69('0x3')](_0x3af36d,_0x537a41);};}function removeListener(_0x2b1016,_0x18fd90){return function(){OpenchannelMessageEvents['removeListener'](_0x2b1016,_0x18fd90);};}exports[_0xed69('0x4')]=function(_0x35522c){for(var _0x19d370=0x0,_0x3867f8=events[_0xed69('0x5')];_0x19d370<_0x3867f8;_0x19d370++){var _0x335074=events[_0x19d370];var _0x136b41=createListener(_0xed69('0x6')+_0x335074,_0x35522c);OpenchannelMessageEvents['on'](_0x335074,_0x136b41);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f087f75..84362dd 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 _0xf965=['../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xf965,0x124));var _0x5f96=function(_0x1aa3ce,_0x453b5a){_0x1aa3ce=_0x1aa3ce-0x0;var _0x3fb000=_0xf965[_0x1aa3ce];return _0x3fb000;};'use strict';var multer=require('multer');var util=require(_0x5f96('0x0'));var path=require('path');var timeout=require(_0x5f96('0x1'));var express=require(_0x5f96('0x2'));var router=express['Router']();var fs_extra=require(_0x5f96('0x3'));var auth=require(_0x5f96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5f96('0x5'));var controller=require(_0x5f96('0x6'));router[_0x5f96('0x7')]('/',auth[_0x5f96('0x8')](),controller[_0x5f96('0x9')]);router[_0x5f96('0x7')]('/describe',auth[_0x5f96('0x8')](),controller[_0x5f96('0xa')]);router[_0x5f96('0x7')](_0x5f96('0xb'),auth['isAuthenticated'](),controller[_0x5f96('0xc')]);router[_0x5f96('0x7')](_0x5f96('0xd'),auth[_0x5f96('0x8')](),controller['getMembers']);router[_0x5f96('0x7')](_0x5f96('0xe'),auth[_0x5f96('0x8')](),controller[_0x5f96('0xf')]);router[_0x5f96('0x7')](_0x5f96('0x10'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x11')]);router[_0x5f96('0x12')]('/',auth[_0x5f96('0x8')](),controller['create']);router[_0x5f96('0x12')](_0x5f96('0xe'),auth['isAuthenticated'](),controller[_0x5f96('0x13')]);router[_0x5f96('0x12')]('/:id/users',auth[_0x5f96('0x8')](),controller[_0x5f96('0x14')]);router[_0x5f96('0x15')]('/:id',auth[_0x5f96('0x8')](),controller['update']);router['delete'](_0x5f96('0xb'),auth['isAuthenticated'](),controller[_0x5f96('0x16')]);router[_0x5f96('0x17')](_0x5f96('0xe'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x18')]);router['delete'](_0x5f96('0x10'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x19')]);module[_0x5f96('0x1a')]=router; \ No newline at end of file +var _0x9c8f=['/describe','isAuthenticated','describe','/:id','show','/:id/members','getTeams','post','create','/:id/teams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9c8f,0x1e1));var _0xf9c8=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x9c8f[_0x416cdc];return _0x1931ce;};'use strict';var multer=require(_0xf9c8('0x0'));var util=require(_0xf9c8('0x1'));var path=require(_0xf9c8('0x2'));var timeout=require(_0xf9c8('0x3'));var express=require(_0xf9c8('0x4'));var router=express[_0xf9c8('0x5')]();var fs_extra=require(_0xf9c8('0x6'));var auth=require(_0xf9c8('0x7'));var interaction=require(_0xf9c8('0x8'));var config=require(_0xf9c8('0x9'));var controller=require(_0xf9c8('0xa'));router[_0xf9c8('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf9c8('0xc'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0xe')]);router['get'](_0xf9c8('0xf'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x10')]);router[_0xf9c8('0xb')](_0xf9c8('0x11'),auth[_0xf9c8('0xd')](),controller['getMembers']);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xf9c8('0x12')]);router[_0xf9c8('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xf9c8('0x13')]('/',auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x14')]);router[_0xf9c8('0x13')](_0xf9c8('0x15'),auth[_0xf9c8('0xd')](),controller['addTeams']);router['post'](_0xf9c8('0x16'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x17')]);router['put'](_0xf9c8('0xf'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x18')]);router[_0xf9c8('0x19')](_0xf9c8('0xf'),auth[_0xf9c8('0xd')](),controller['destroy']);router['delete'](_0xf9c8('0x15'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x1a')]);router[_0xf9c8('0x19')](_0xf9c8('0x16'),auth[_0xf9c8('0xd')](),controller[_0xf9c8('0x1b')]);module[_0xf9c8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 2b95952..56b72c8 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 _0x56bb=['roundrobin','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x56da68,_0x597118){var _0x4003d5=function(_0x4d3042){while(--_0x4d3042){_0x56da68['push'](_0x56da68['shift']());}};_0x4003d5(++_0x597118);}(_0x56bb,0x175));var _0xb56b=function(_0x1bb174,_0x4db38c){_0x1bb174=_0x1bb174-0x0;var _0x2caaba=_0x56bb[_0x1bb174];return _0x2caaba;};'use strict';var Sequelize=require('sequelize');module[_0xb56b('0x0')]={'name':{'type':Sequelize[_0xb56b('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb56b('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb56b('0x2')](_0xb56b('0x3'),_0xb56b('0x4'),_0xb56b('0x5'))}}; \ No newline at end of file +var _0x37a8=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x37a8,0x183));var _0x837a=function(_0x113876,_0x2d243d){_0x113876=_0x113876-0x0;var _0x3da554=_0x37a8[_0x113876];return _0x3da554;};'use strict';var Sequelize=require(_0x837a('0x0'));module[_0x837a('0x1')]={'name':{'type':Sequelize[_0x837a('0x2')],'unique':_0x837a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x837a('0x2')]},'timeout':{'type':Sequelize[_0x837a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x837a('0x5')](_0x837a('0x6'),_0x837a('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 90d140c..a356310 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 _0xa419=['order','nolimit','ids','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','UserOpenchannelQueue','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','set','Content-Range','then','get','OpenchannelQueues','destroy','sendStatus','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','intersection','fields','attributes','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','find','params','describe','getMembers','findOne','sort','pick','OpenchannelQueueId','filter','findAll','User','UserId','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team'];(function(_0x72052f,_0x503f17){var _0x3c1e6b=function(_0x3401){while(--_0x3401){_0x72052f['push'](_0x72052f['shift']());}};_0x3c1e6b(++_0x503f17);}(_0xa419,0xa4));var _0x9a41=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa419[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0x9a41('0x0'));var util=require(_0x9a41('0x1'));var _=require(_0x9a41('0x2'));var squel=require(_0x9a41('0x3'));var Redis=require(_0x9a41('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x9a41('0x5'))(_0x9a41('0x6'));var config=require(_0x9a41('0x7'));var db=require(_0x9a41('0x8'))['db'];config[_0x9a41('0x9')]=_[_0x9a41('0xa')](config[_0x9a41('0x9')],{'host':_0x9a41('0xb'),'port':0x18eb});var socket=require(_0x9a41('0xc'))(new Redis(config[_0x9a41('0x9')]));require(_0x9a41('0xd'))[_0x9a41('0xe')](socket);function respondWithStatusCode(_0x5c159e,_0x45585c){_0x45585c=_0x45585c||0xcc;return function(_0xc581d5){if(_0xc581d5){return _0x5c159e['sendStatus'](_0x45585c);}return _0x5c159e[_0x9a41('0xf')](_0x45585c)[_0x9a41('0x10')]();};}function respondWithResult(_0x1664d7,_0x24a624){_0x24a624=_0x24a624||0xc8;return function(_0x4cc1ab){if(_0x4cc1ab){return _0x1664d7[_0x9a41('0xf')](_0x24a624)[_0x9a41('0x11')](_0x4cc1ab);}};}function respondWithFilteredResult(_0x2eaadc,_0x568308){return function(_0x59cde7){if(_0x59cde7){var _0x5801fc=typeof _0x568308[_0x9a41('0x12')]===_0x9a41('0x13')&&typeof _0x568308[_0x9a41('0x14')]===_0x9a41('0x13');var _0x243b39=_0x59cde7['count'];var _0x2ac4a4=_0x5801fc?0x0:_0x568308['offset'];var _0x3d6242=_0x5801fc?_0x59cde7['count']:_0x568308[_0x9a41('0x12')]+_0x568308[_0x9a41('0x14')];var _0x4fb59e;if(_0x3d6242>=_0x243b39){_0x3d6242=_0x243b39;_0x4fb59e=0xc8;}else{_0x4fb59e=0xce;}_0x2eaadc[_0x9a41('0xf')](_0x4fb59e);return _0x2eaadc[_0x9a41('0x15')](_0x9a41('0x16'),_0x2ac4a4+'-'+_0x3d6242+'/'+_0x243b39)[_0x9a41('0x11')](_0x59cde7);}return null;};}function saveUpdates(_0x572907){return function(_0x4d56e0){if(_0x4d56e0){return _0x4d56e0['update'](_0x572907)['then'](function(_0x50f778){return _0x50f778;});}return null;};}function removeEntity(_0x5139fc){return function(_0xba0a3a){if(_0xba0a3a){return _0xba0a3a['destroy']()[_0x9a41('0x17')](function(){var _0x48b574=_0xba0a3a[_0x9a41('0x18')]({'plain':!![]});var _0x35034d=_0x9a41('0x19');return db['UserProfileResource'][_0x9a41('0x1a')]({'where':{'type':_0x35034d,'resourceId':_0x48b574['id']}})['then'](function(){return _0xba0a3a;});})[_0x9a41('0x17')](function(){_0x5139fc[_0x9a41('0xf')](0xcc)[_0x9a41('0x10')]();});}};}function handleEntityNotFound(_0x34b653){return function(_0x49be53){if(!_0x49be53){_0x34b653[_0x9a41('0x1b')](0x194);}return _0x49be53;};}function handleError(_0x194464,_0x214136){_0x214136=_0x214136||0x1f4;return function(_0x277ac9){logger['error'](_0x277ac9[_0x9a41('0x1c')]);if(_0x277ac9[_0x9a41('0x1d')]){delete _0x277ac9['name'];}_0x194464[_0x9a41('0xf')](_0x214136)[_0x9a41('0x1e')](_0x277ac9);};}exports[_0x9a41('0x1f')]=function(_0x4bb4ef,_0xd85519){var _0x24ac05={};var _0x262491={'count':0x0,'rows':[]};var _0x47009e=_[_0x9a41('0x20')](db[_0x9a41('0x21')][_0x9a41('0x22')],function(_0x4a8ead){return{'name':_0x4a8ead[_0x9a41('0x23')],'type':_0x4a8ead[_0x9a41('0x24')][_0x9a41('0x25')]};});_0x24ac05=qs[_0x9a41('0x26')](_0x47009e,_0x4bb4ef);var _0x142187={'where':_0x24ac05[_0x9a41('0x27')]};return db['OpenchannelQueue'][_0x9a41('0x28')](_0x142187)[_0x9a41('0x17')](function(_0x3ac72c){_0x262491[_0x9a41('0x28')]=_0x3ac72c;_0x24ac05[_0x9a41('0x29')]=qs[_0x9a41('0x29')](_0x4bb4ef[_0x9a41('0x2a')]);return db[_0x9a41('0x21')]['findAll'](_0x24ac05);})[_0x9a41('0x17')](function(_0x1e88e0){_0x262491[_0x9a41('0x2b')]=_0x1e88e0;return _0x262491;})[_0x9a41('0x17')](respondWithFilteredResult(_0xd85519,_0x24ac05))[_0x9a41('0x2c')](handleError(_0xd85519,null));};exports[_0x9a41('0x2d')]=function(_0x3ecb1b,_0x5e1ee6){var _0x1931af={'raw':!![],'where':{'id':_0x3ecb1b['params']['id']}},_0x2f8f57={};_0x2f8f57[_0x9a41('0x2e')]=_['keys'](db['OpenchannelQueue'][_0x9a41('0x22')]);_0x2f8f57['query']=_[_0x9a41('0x2f')](_0x3ecb1b[_0x9a41('0x2a')]);_0x2f8f57[_0x9a41('0x30')]=_[_0x9a41('0x31')](_0x2f8f57[_0x9a41('0x2e')],_0x2f8f57[_0x9a41('0x2a')]);_0x1931af['attributes']=_[_0x9a41('0x31')](_0x2f8f57['model'],qs['fields'](_0x3ecb1b[_0x9a41('0x2a')][_0x9a41('0x32')]));_0x1931af['attributes']=_0x1931af[_0x9a41('0x33')][_0x9a41('0x34')]?_0x1931af['attributes']:_0x2f8f57[_0x9a41('0x2e')];if(_0x3ecb1b[_0x9a41('0x2a')]['includeAll']){_0x1931af[_0x9a41('0x29')]=[{'all':!![]}];}_0x1931af=_[_0x9a41('0x35')]({},_0x1931af,_0x3ecb1b[_0x9a41('0x36')]);return db['OpenchannelQueue']['find'](_0x1931af)[_0x9a41('0x17')](handleEntityNotFound(_0x5e1ee6,null))['then'](respondWithResult(_0x5e1ee6,null))[_0x9a41('0x2c')](handleError(_0x5e1ee6,null));};exports[_0x9a41('0x37')]=function(_0x8974b1,_0x326509){return db[_0x9a41('0x21')][_0x9a41('0x37')](_0x8974b1[_0x9a41('0x38')],{})['then'](function(_0x26bf57){var _0x12e9ee=_0x8974b1[_0x9a41('0x39')][_0x9a41('0x18')]({'plain':!![]});if(!_0x12e9ee)throw new Error(_0x9a41('0x3a'));if(_0x12e9ee[_0x9a41('0x3b')]==='user'){var _0x5a723e=_0x26bf57[_0x9a41('0x18')]({'plain':!![]});var _0x1c8138=_0x9a41('0x19');return db[_0x9a41('0x3c')]['find']({'where':{'name':_0x1c8138,'userProfileId':_0x12e9ee[_0x9a41('0x3d')]},'raw':!![]})['then'](function(_0x331bd7){if(_0x331bd7&&_0x331bd7['autoAssociation']===0x0){return db['UserProfileResource'][_0x9a41('0x37')]({'name':_0x5a723e[_0x9a41('0x1d')],'resourceId':_0x5a723e['id'],'type':_0x331bd7[_0x9a41('0x1d')],'sectionId':_0x331bd7['id']},{})['then'](function(){return _0x26bf57;});}else{return _0x26bf57;}})['catch'](function(_0xc4ee85){logger[_0x9a41('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc4ee85);throw _0xc4ee85;});}return _0x26bf57;})['then'](respondWithResult(_0x326509,0xc9))[_0x9a41('0x2c')](handleError(_0x326509,null));};exports['update']=function(_0x48bd0f,_0x3f2909){if(_0x48bd0f['body']['id']){delete _0x48bd0f[_0x9a41('0x38')]['id'];}return db['OpenchannelQueue'][_0x9a41('0x3f')]({'where':{'id':_0x48bd0f[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](handleEntityNotFound(_0x3f2909,null))[_0x9a41('0x17')](saveUpdates(_0x48bd0f[_0x9a41('0x38')],null))[_0x9a41('0x17')](respondWithResult(_0x3f2909,null))[_0x9a41('0x2c')](handleError(_0x3f2909,null));};exports[_0x9a41('0x1a')]=function(_0x2024e4,_0x36a3d9){return db[_0x9a41('0x21')][_0x9a41('0x3f')]({'where':{'id':_0x2024e4[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](handleEntityNotFound(_0x36a3d9,null))[_0x9a41('0x17')](removeEntity(_0x36a3d9,null))[_0x9a41('0x2c')](handleError(_0x36a3d9,null));};exports['describe']=function(_0x1102c0,_0xac05d0){return db[_0x9a41('0x21')][_0x9a41('0x41')]()[_0x9a41('0x17')](respondWithResult(_0xac05d0,null))[_0x9a41('0x2c')](handleError(_0xac05d0,null));};exports[_0x9a41('0x42')]=function(_0x1ffced,_0x4a9f62){var _0x18f987={'raw':!![],'where':{}},_0xfa3fe8={},_0x521c69;return db[_0x9a41('0x21')][_0x9a41('0x43')]({'where':{'id':_0x1ffced[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](handleEntityNotFound(_0x4a9f62,null))[_0x9a41('0x17')](function(_0x1bbfe3){if(_0x1bbfe3){_0x521c69=_0x1bbfe3['get']({'plain':!![]});_0xfa3fe8['model']=_['keys'](db['UserOpenchannelQueue'][_0x9a41('0x22')]);_0xfa3fe8['query']=_[_0x9a41('0x2f')](_0x1ffced[_0x9a41('0x2a')]);_0xfa3fe8[_0x9a41('0x30')]=_[_0x9a41('0x31')](_0xfa3fe8[_0x9a41('0x2e')],_0xfa3fe8['query']);_0x18f987['attributes']=_[_0x9a41('0x31')](_0xfa3fe8[_0x9a41('0x2e')],qs[_0x9a41('0x32')](_0x1ffced[_0x9a41('0x2a')][_0x9a41('0x32')]));_0x18f987[_0x9a41('0x33')]=_0x18f987[_0x9a41('0x33')]['length']?_0x18f987[_0x9a41('0x33')]:_0xfa3fe8[_0x9a41('0x2e')];if(!_0x1ffced[_0x9a41('0x2a')]['hasOwnProperty']('nolimit')){_0x18f987[_0x9a41('0x14')]=qs[_0x9a41('0x14')](_0x1ffced[_0x9a41('0x2a')]['limit']);_0x18f987[_0x9a41('0x12')]=qs[_0x9a41('0x12')](_0x1ffced[_0x9a41('0x2a')]['offset']);}_0x18f987['order']=qs[_0x9a41('0x44')](_0x1ffced[_0x9a41('0x2a')][_0x9a41('0x44')]);_0x18f987['where']=qs['filters'](_[_0x9a41('0x45')](_0x1ffced['query'],_0xfa3fe8[_0x9a41('0x30')]));_0x18f987['where'][_0x9a41('0x46')]=_0x1bbfe3['id'];if(_0x1ffced[_0x9a41('0x2a')][_0x9a41('0x47')]){_0x18f987['where']=_[_0x9a41('0x35')](_0x18f987[_0x9a41('0x27')],{'$or':_[_0x9a41('0x20')](_0x18f987[_0x9a41('0x33')],function(_0x3d182b){var _0x1e3249={};_0x1e3249[_0x3d182b]={'$like':'%'+_0x1ffced['query']['filter']+'%'};return _0x1e3249;})});}_0x18f987=_['merge']({},_0x18f987,_0x1ffced[_0x9a41('0x36')]);return db['UserOpenchannelQueue'][_0x9a41('0x48')](_0x18f987);}})[_0x9a41('0x17')](function(_0x3f4ea8){if(_0x3f4ea8){return db[_0x9a41('0x49')]['findAndCountAll']({'where':{'id':_[_0x9a41('0x20')](_0x3f4ea8,_0x9a41('0x4a')),'role':'agent'},'attributes':['id','name',_0x9a41('0x4b'),_0x9a41('0x4c'),_0x9a41('0x4d')]});}})[_0x9a41('0x17')](function(_0x296208){if(_0x296208){return{'count':_0x296208['count'],'rows':_[_0x9a41('0x20')](_0x296208['rows'],function(_0x19e672){return{'membername':_0x19e672[_0x9a41('0x1d')],'UserId':_0x19e672['id'],'queue_name':_0x521c69[_0x9a41('0x1d')],'OpenchannelQueueId':_0x521c69['id'],'interface':util['format'](_0x9a41('0x4e'),_0x9a41('0x4f'),_0x19e672[_0x9a41('0x1d')]),'penalty':0x0,'paused':_0x19e672[_0x9a41('0x4b')],'createdAt':_0x19e672[_0x9a41('0x4d')],'updatedAt':_0x19e672[_0x9a41('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a9f62,_0x18f987))[_0x9a41('0x2c')](handleError(_0x4a9f62,null));};exports[_0x9a41('0x50')]=function(_0x2fbe25,_0x3e2aa8){var _0x441b3b={};var _0x4cf129={};var _0x217968;var _0x5dfb23;return db[_0x9a41('0x21')][_0x9a41('0x43')]({'where':{'id':_0x2fbe25[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](handleEntityNotFound(_0x3e2aa8,null))[_0x9a41('0x17')](function(_0x27846b){if(_0x27846b){_0x217968=_0x27846b;_0x4cf129[_0x9a41('0x2e')]=_[_0x9a41('0x2f')](db[_0x9a41('0x51')][_0x9a41('0x22')]);_0x4cf129['query']=_[_0x9a41('0x2f')](_0x2fbe25['query']);_0x4cf129[_0x9a41('0x30')]=_['intersection'](_0x4cf129['model'],_0x4cf129[_0x9a41('0x2a')]);_0x441b3b[_0x9a41('0x33')]=_['intersection'](_0x4cf129[_0x9a41('0x2e')],qs['fields'](_0x2fbe25[_0x9a41('0x2a')][_0x9a41('0x32')]));_0x441b3b['attributes']=_0x441b3b[_0x9a41('0x33')][_0x9a41('0x34')]?_0x441b3b['attributes']:_0x4cf129[_0x9a41('0x2e')];_0x441b3b[_0x9a41('0x52')]=qs[_0x9a41('0x44')](_0x2fbe25['query'][_0x9a41('0x44')]);_0x441b3b[_0x9a41('0x27')]=qs['filters'](_[_0x9a41('0x45')](_0x2fbe25[_0x9a41('0x2a')],_0x4cf129['filters']));if(_0x2fbe25[_0x9a41('0x2a')]['filter']){_0x441b3b[_0x9a41('0x27')]=_[_0x9a41('0x35')](_0x441b3b['where'],{'$or':_[_0x9a41('0x20')](_0x441b3b[_0x9a41('0x33')],function(_0x304315){var _0x3a582a={};_0x3a582a[_0x304315]={'$like':'%'+_0x2fbe25[_0x9a41('0x2a')]['filter']+'%'};return _0x3a582a;})});}_0x441b3b=_[_0x9a41('0x35')]({},_0x441b3b,_0x2fbe25['options']);return _0x217968[_0x9a41('0x50')](_0x441b3b);}})[_0x9a41('0x17')](function(_0x45f460){if(_0x45f460){_0x5dfb23=_0x45f460[_0x9a41('0x34')];if(!_0x2fbe25['query']['hasOwnProperty'](_0x9a41('0x53'))){_0x441b3b[_0x9a41('0x14')]=qs[_0x9a41('0x14')](_0x2fbe25['query'][_0x9a41('0x14')]);_0x441b3b['offset']=qs[_0x9a41('0x12')](_0x2fbe25['query'][_0x9a41('0x12')]);}return _0x217968[_0x9a41('0x50')](_0x441b3b);}})['then'](function(_0x5fe9fe){if(_0x5fe9fe){return _0x5fe9fe?{'count':_0x5dfb23,'rows':_0x5fe9fe}:null;}})[_0x9a41('0x17')](respondWithResult(_0x3e2aa8,null))[_0x9a41('0x2c')](handleError(_0x3e2aa8,null));};exports['addTeams']=function(_0x5ab152,_0x5b7364){var _0x3aed07=_0x5ab152[_0x9a41('0x38')][_0x9a41('0x54')];return db[_0x9a41('0x51')][_0x9a41('0x48')]({'where':{'id':_0x3aed07},'attributes':['id'],'include':[{'model':db[_0x9a41('0x49')],'as':_0x9a41('0x55'),'attributes':['id','name','online',_0x9a41('0x56'),'interface'],'raw':!![]}]})[_0x9a41('0x17')](function(_0x45905d){if(_0x45905d){var _0x1ec964=_[_0x9a41('0x57')](_0x45905d,function(_0x45cbb7){var _0x28cafa=_0x45cbb7[_0x9a41('0x18')]({'plain':!![]});return _0x28cafa[_0x9a41('0x55')];});return db[_0x9a41('0x21')][_0x9a41('0x3f')]({'where':{'id':_0x5ab152[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](function(_0x295d07){return db[_0x9a41('0x58')][_0x9a41('0x59')](function(_0x20fe77){return _0x295d07[_0x9a41('0x5a')](_0x3aed07,{'transaction':_0x20fe77})[_0x9a41('0x17')](function(){return BPromise[_0x9a41('0x5b')](_0x1ec964,function(_0x4dca58){return db[_0x9a41('0x5c')]['findOrCreate']({'where':{'UserId':_0x4dca58['id'],'OpenchannelQueueId':_0x5ab152[_0x9a41('0x40')]['id']},'transaction':_0x20fe77});});})[_0x9a41('0x17')](function(){_0x1ec964[_0x9a41('0x5d')](function(_0xbebbb){socket[_0x9a41('0x5e')](_0x9a41('0x5f'),{'UserId':_0xbebbb['id'],'OpenchannelQueueId':_0x295d07['id']});});});});});}})[_0x9a41('0x17')](respondWithStatusCode(_0x5b7364,null))[_0x9a41('0x2c')](handleError(_0x5b7364,null));};exports[_0x9a41('0x60')]=function(_0x472ba4,_0x34b118){return db[_0x9a41('0x51')][_0x9a41('0x48')]({'where':{'id':_0x472ba4[_0x9a41('0x2a')][_0x9a41('0x54')]},'attributes':['id'],'include':[{'model':db[_0x9a41('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34b118,null))[_0x9a41('0x17')](function(_0x5acdc8){var _0x2bcadf=_[_0x9a41('0x20')](_0x5acdc8,'id');var _0x21a3dc=[];var _0x24ab6d=[];var _0x117ea7=squel[_0x9a41('0x61')]();_0x117ea7[_0x9a41('0x62')](_0x9a41('0x63'))[_0x9a41('0x64')](_0x9a41('0x65'),'tq')[_0x9a41('0x66')]('user_has_teams','ut',_0x9a41('0x67'))['where'](_0x9a41('0x68'),_0x472ba4['params']['id']);for(var _0x25d266=0x0;_0x25d266<_0x5acdc8[_0x9a41('0x34')];_0x25d266+=0x1){let _0xdcf703=_0x5acdc8[_0x25d266];for(var _0x32b560=0x0;_0x32b560<_0xdcf703[_0x9a41('0x55')][_0x9a41('0x34')];_0x32b560+=0x1){let _0x1f8175=_0xdcf703[_0x9a41('0x55')][_0x32b560];var _0x3288f7=_0x117ea7[_0x9a41('0x69')]();_0x3288f7[_0x9a41('0x27')]('ut.UserId\x20=\x20?',_0x1f8175['id']);_0x24ab6d[_0x9a41('0x6a')](db['sequelize'][_0x9a41('0x2a')](_0x3288f7[_0x9a41('0x6b')](),{'type':db['sequelize']['QueryTypes'][_0x9a41('0x6c')]})[_0x9a41('0x17')](function(_0x374c36){if(_0x374c36[_0x9a41('0x34')]===0x1){return _0x1f8175['id'];}else{var _0xfb5594=_[_0x9a41('0x6d')](_[_0x9a41('0x20')](_0x374c36,_0x9a41('0x6e')),function(_0x1ecfc8){return _[_0x9a41('0x6f')](_0x2bcadf,_0x1ecfc8);});if(_0xfb5594){return _0x1f8175['id'];}}}));}}return BPromise[_0x9a41('0x70')](_0x24ab6d)[_0x9a41('0x17')](function(_0x252adf){_0x21a3dc=_(_0x21a3dc)['union'](_0x252adf)[_0x9a41('0x71')]()[_0x9a41('0x72')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x472ba4[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](function(_0x433851){return db[_0x9a41('0x58')][_0x9a41('0x59')](function(_0x7a4668){return _0x433851[_0x9a41('0x60')](_0x472ba4[_0x9a41('0x2a')][_0x9a41('0x54')],{'transaction':_0x7a4668})['then'](function(){if(!_[_0x9a41('0x73')](_0x21a3dc)){return _0x433851['removeAgents'](_0x21a3dc,{'transaction':_0x7a4668});}})['then'](function(){_0x21a3dc[_0x9a41('0x5d')](function(_0x492b7a){socket[_0x9a41('0x5e')](_0x9a41('0x74'),{'UserId':_0x492b7a,'OpenchannelQueueId':_0x433851['id']});});});});});});})[_0x9a41('0x17')](respondWithStatusCode(_0x34b118,null))[_0x9a41('0x2c')](handleError(_0x34b118,null));};exports['addAgents']=function(_0x12bba8,_0x4f1cf5){return db[_0x9a41('0x21')][_0x9a41('0x3f')]({'where':{'id':_0x12bba8['params']['id']}})[_0x9a41('0x17')](handleEntityNotFound(_0x4f1cf5,null))[_0x9a41('0x17')](function(_0x25b666){if(_0x25b666){return _0x25b666[_0x9a41('0x75')](_0x12bba8[_0x9a41('0x38')]['ids'],_[_0x9a41('0x76')](_0x12bba8[_0x9a41('0x38')],[_0x9a41('0x54'),'id'])||{})[_0x9a41('0x77')](function(_0x387607){for(var _0xb79666=0x0;_0xb79666<_0x12bba8['body'][_0x9a41('0x54')]['length'];_0xb79666+=0x1){socket[_0x9a41('0x5e')](_0x9a41('0x5f'),{'UserId':Number(_0x12bba8[_0x9a41('0x38')][_0x9a41('0x54')][_0xb79666]),'OpenchannelQueueId':Number(_0x12bba8[_0x9a41('0x40')]['id'])});}return _0x387607;});}})[_0x9a41('0x17')](respondWithResult(_0x4f1cf5,null))['catch'](handleError(_0x4f1cf5,null));};exports[_0x9a41('0x78')]=function(_0xd4cba4,_0x3f1f04){return db[_0x9a41('0x21')]['find']({'where':{'id':_0xd4cba4[_0x9a41('0x40')]['id']}})[_0x9a41('0x17')](handleEntityNotFound(_0x3f1f04,null))[_0x9a41('0x17')](function(_0x2d65aa){if(_0x2d65aa){return _0x2d65aa[_0x9a41('0x78')](_0xd4cba4[_0x9a41('0x2a')][_0x9a41('0x54')])['then'](function(){if(_['isArray'](_0xd4cba4[_0x9a41('0x2a')][_0x9a41('0x54')])){for(var _0x5e8d19=0x0;_0x5e8d19<_0xd4cba4['query'][_0x9a41('0x54')][_0x9a41('0x34')];_0x5e8d19+=0x1){socket['emit'](_0x9a41('0x74'),{'UserId':Number(_0xd4cba4[_0x9a41('0x2a')][_0x9a41('0x54')][_0x5e8d19]),'OpenchannelQueueId':Number(_0xd4cba4[_0x9a41('0x40')]['id'])});}}else{socket[_0x9a41('0x5e')](_0x9a41('0x74'),{'UserId':Number(_0xd4cba4[_0x9a41('0x2a')][_0x9a41('0x54')]),'OpenchannelQueueId':Number(_0xd4cba4[_0x9a41('0x40')]['id'])});}});}})[_0x9a41('0x17')](respondWithStatusCode(_0x3f1f04,null))[_0x9a41('0x2c')](handleError(_0x3f1f04,null));};exports[_0x9a41('0x79')]=function(_0x487166,_0x3db4ac){var _0xb0d839={};var _0x2c2721={};var _0x3e6ac3;var _0x1e416c;return db[_0x9a41('0x21')]['findOne']({'where':{'id':_0x487166[_0x9a41('0x40')]['id']}})['then'](handleEntityNotFound(_0x3db4ac,null))[_0x9a41('0x17')](function(_0x343de0){if(_0x343de0){_0x3e6ac3=_0x343de0;_0x2c2721[_0x9a41('0x2e')]=_[_0x9a41('0x2f')](db[_0x9a41('0x49')][_0x9a41('0x22')]);_0x2c2721['query']=_['keys'](_0x487166['query']);_0x2c2721['filters']=_[_0x9a41('0x31')](_0x2c2721['model'],_0x2c2721[_0x9a41('0x2a')]);_0xb0d839[_0x9a41('0x33')]=_[_0x9a41('0x31')](_0x2c2721['model'],qs['fields'](_0x487166[_0x9a41('0x2a')][_0x9a41('0x32')]));_0xb0d839[_0x9a41('0x33')]=_0xb0d839[_0x9a41('0x33')][_0x9a41('0x34')]?_0xb0d839[_0x9a41('0x33')]:_0x2c2721[_0x9a41('0x2e')];_0xb0d839[_0x9a41('0x52')]=qs[_0x9a41('0x44')](_0x487166['query'][_0x9a41('0x44')]);_0xb0d839[_0x9a41('0x27')]=qs[_0x9a41('0x30')](_[_0x9a41('0x45')](_0x487166[_0x9a41('0x2a')],_0x2c2721[_0x9a41('0x30')]));if(_0x487166[_0x9a41('0x2a')][_0x9a41('0x47')]){_0xb0d839[_0x9a41('0x27')]=_[_0x9a41('0x35')](_0xb0d839[_0x9a41('0x27')],{'$or':_[_0x9a41('0x20')](_0xb0d839[_0x9a41('0x33')],function(_0x4cbb50){var _0x548ba4={};_0x548ba4[_0x4cbb50]={'$like':'%'+_0x487166['query'][_0x9a41('0x47')]+'%'};return _0x548ba4;})});}_0xb0d839=_['merge']({},_0xb0d839,_0x487166[_0x9a41('0x36')]);return _0x3e6ac3[_0x9a41('0x79')](_0xb0d839);}})['then'](function(_0x264797){if(_0x264797){_0x1e416c=_0x264797[_0x9a41('0x34')];if(!_0x487166[_0x9a41('0x2a')][_0x9a41('0x7a')](_0x9a41('0x53'))){_0xb0d839[_0x9a41('0x14')]=qs['limit'](_0x487166[_0x9a41('0x2a')]['limit']);_0xb0d839[_0x9a41('0x12')]=qs[_0x9a41('0x12')](_0x487166[_0x9a41('0x2a')][_0x9a41('0x12')]);}return _0x3e6ac3[_0x9a41('0x79')](_0xb0d839);}})[_0x9a41('0x17')](function(_0x45e709){if(_0x45e709){return _0x45e709?{'count':_0x1e416c,'rows':_0x45e709}:null;}})[_0x9a41('0x17')](respondWithResult(_0x3db4ac,null))[_0x9a41('0x2c')](handleError(_0x3db4ac,null));}; \ No newline at end of file +var _0xffe5=['select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','status','end','offset','undefined','limit','count','set','json','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','UserId','agent','createdAt','format','openchannelPause','getTeams','ids','online','voicePause','interface','Agents','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team'];(function(_0x32d56e,_0x256b2e){var _0x400b04=function(_0xacaca6){while(--_0xacaca6){_0x32d56e['push'](_0x32d56e['shift']());}};_0x400b04(++_0x256b2e);}(_0xffe5,0x183));var _0x5ffe=function(_0x52f6c6,_0x4cf7b3){_0x52f6c6=_0x52f6c6-0x0;var _0x9a7f82=_0xffe5[_0x52f6c6];return _0x9a7f82;};'use strict';var BPromise=require(_0x5ffe('0x0'));var util=require(_0x5ffe('0x1'));var _=require(_0x5ffe('0x2'));var squel=require(_0x5ffe('0x3'));var Redis=require(_0x5ffe('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5ffe('0x5'));var config=require('../../config/environment');var db=require(_0x5ffe('0x6'))['db'];config[_0x5ffe('0x7')]=_[_0x5ffe('0x8')](config[_0x5ffe('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ffe('0x9'))(new Redis(config[_0x5ffe('0x7')]));require(_0x5ffe('0xa'))[_0x5ffe('0xb')](socket);function respondWithStatusCode(_0x43a9fe,_0x71acdc){_0x71acdc=_0x71acdc||0xcc;return function(_0x28597a){if(_0x28597a){return _0x43a9fe['sendStatus'](_0x71acdc);}return _0x43a9fe[_0x5ffe('0xc')](_0x71acdc)[_0x5ffe('0xd')]();};}function respondWithResult(_0xe2c7cd,_0x1b9d9b){_0x1b9d9b=_0x1b9d9b||0xc8;return function(_0x1d5362){if(_0x1d5362){return _0xe2c7cd[_0x5ffe('0xc')](_0x1b9d9b)['json'](_0x1d5362);}};}function respondWithFilteredResult(_0x2eb064,_0x4dde7e){return function(_0x552999){if(_0x552999){var _0x11b50f=typeof _0x4dde7e[_0x5ffe('0xe')]===_0x5ffe('0xf')&&typeof _0x4dde7e[_0x5ffe('0x10')]===_0x5ffe('0xf');var _0x3cd0a1=_0x552999[_0x5ffe('0x11')];var _0x3d38e1=_0x11b50f?0x0:_0x4dde7e[_0x5ffe('0xe')];var _0xd4dd43=_0x11b50f?_0x552999[_0x5ffe('0x11')]:_0x4dde7e[_0x5ffe('0xe')]+_0x4dde7e[_0x5ffe('0x10')];var _0x7e1241;if(_0xd4dd43>=_0x3cd0a1){_0xd4dd43=_0x3cd0a1;_0x7e1241=0xc8;}else{_0x7e1241=0xce;}_0x2eb064[_0x5ffe('0xc')](_0x7e1241);return _0x2eb064[_0x5ffe('0x12')]('Content-Range',_0x3d38e1+'-'+_0xd4dd43+'/'+_0x3cd0a1)[_0x5ffe('0x13')](_0x552999);}return null;};}function saveUpdates(_0x472622){return function(_0x3d8516){if(_0x3d8516){return _0x3d8516[_0x5ffe('0x14')](_0x472622)['then'](function(_0x21edce){return _0x21edce;});}return null;};}function removeEntity(_0x31025d){return function(_0x143dd1){if(_0x143dd1){return _0x143dd1[_0x5ffe('0x15')]()[_0x5ffe('0x16')](function(){var _0x483e08=_0x143dd1[_0x5ffe('0x17')]({'plain':!![]});var _0x59098b=_0x5ffe('0x18');return db[_0x5ffe('0x19')][_0x5ffe('0x15')]({'where':{'type':_0x59098b,'resourceId':_0x483e08['id']}})[_0x5ffe('0x16')](function(){return _0x143dd1;});})['then'](function(){_0x31025d[_0x5ffe('0xc')](0xcc)[_0x5ffe('0xd')]();});}};}function handleEntityNotFound(_0x3cc064){return function(_0x101150){if(!_0x101150){_0x3cc064['sendStatus'](0x194);}return _0x101150;};}function handleError(_0x594c98,_0x2a9bc4){_0x2a9bc4=_0x2a9bc4||0x1f4;return function(_0x10989c){logger[_0x5ffe('0x1a')](_0x10989c[_0x5ffe('0x1b')]);if(_0x10989c['name']){delete _0x10989c[_0x5ffe('0x1c')];}_0x594c98[_0x5ffe('0xc')](_0x2a9bc4)[_0x5ffe('0x1d')](_0x10989c);};}exports[_0x5ffe('0x1e')]=function(_0x5d9787,_0x284ca9){var _0x5ce193={};var _0xa7f981={'count':0x0,'rows':[]};var _0x6ddcf1=_[_0x5ffe('0x1f')](db[_0x5ffe('0x20')][_0x5ffe('0x21')],function(_0x288736){return{'name':_0x288736[_0x5ffe('0x22')],'type':_0x288736[_0x5ffe('0x23')]['key']};});_0x5ce193=qs['getOptions'](_0x6ddcf1,_0x5d9787);var _0x2610a9={'where':_0x5ce193[_0x5ffe('0x24')]};return db[_0x5ffe('0x20')][_0x5ffe('0x11')](_0x2610a9)[_0x5ffe('0x16')](function(_0x3208c5){_0xa7f981[_0x5ffe('0x11')]=_0x3208c5;_0x5ce193[_0x5ffe('0x25')]=qs[_0x5ffe('0x25')](_0x5d9787[_0x5ffe('0x26')]);return db[_0x5ffe('0x20')][_0x5ffe('0x27')](_0x5ce193);})['then'](function(_0x373d51){_0xa7f981[_0x5ffe('0x28')]=_0x373d51;return _0xa7f981;})[_0x5ffe('0x16')](respondWithFilteredResult(_0x284ca9,_0x5ce193))[_0x5ffe('0x29')](handleError(_0x284ca9,null));};exports[_0x5ffe('0x2a')]=function(_0x39785f,_0x1c3df6){var _0x32de7a={'raw':!![],'where':{'id':_0x39785f['params']['id']}},_0x31dea1={};_0x31dea1[_0x5ffe('0x2b')]=_[_0x5ffe('0x2c')](db[_0x5ffe('0x20')][_0x5ffe('0x21')]);_0x31dea1[_0x5ffe('0x26')]=_[_0x5ffe('0x2c')](_0x39785f[_0x5ffe('0x26')]);_0x31dea1[_0x5ffe('0x2d')]=_[_0x5ffe('0x2e')](_0x31dea1['model'],_0x31dea1[_0x5ffe('0x26')]);_0x32de7a[_0x5ffe('0x2f')]=_['intersection'](_0x31dea1[_0x5ffe('0x2b')],qs[_0x5ffe('0x30')](_0x39785f[_0x5ffe('0x26')][_0x5ffe('0x30')]));_0x32de7a[_0x5ffe('0x2f')]=_0x32de7a[_0x5ffe('0x2f')][_0x5ffe('0x31')]?_0x32de7a[_0x5ffe('0x2f')]:_0x31dea1[_0x5ffe('0x2b')];if(_0x39785f['query'][_0x5ffe('0x32')]){_0x32de7a[_0x5ffe('0x25')]=[{'all':!![]}];}_0x32de7a=_[_0x5ffe('0x33')]({},_0x32de7a,_0x39785f[_0x5ffe('0x34')]);return db[_0x5ffe('0x20')][_0x5ffe('0x35')](_0x32de7a)[_0x5ffe('0x16')](handleEntityNotFound(_0x1c3df6,null))[_0x5ffe('0x16')](respondWithResult(_0x1c3df6,null))[_0x5ffe('0x29')](handleError(_0x1c3df6,null));};exports['create']=function(_0xfe6efc,_0x4d6f7b){return db[_0x5ffe('0x20')][_0x5ffe('0x36')](_0xfe6efc[_0x5ffe('0x37')],{})['then'](function(_0xecf340){var _0x253f03=_0xfe6efc[_0x5ffe('0x38')][_0x5ffe('0x17')]({'plain':!![]});if(!_0x253f03)throw new Error(_0x5ffe('0x39'));if(_0x253f03[_0x5ffe('0x3a')]===_0x5ffe('0x38')){var _0x19710e=_0xecf340[_0x5ffe('0x17')]({'plain':!![]});var _0x184a04='OpenchannelQueues';return db[_0x5ffe('0x3b')][_0x5ffe('0x35')]({'where':{'name':_0x184a04,'userProfileId':_0x253f03[_0x5ffe('0x3c')]},'raw':!![]})[_0x5ffe('0x16')](function(_0x5e823d){if(_0x5e823d&&_0x5e823d['autoAssociation']===0x0){return db[_0x5ffe('0x19')]['create']({'name':_0x19710e[_0x5ffe('0x1c')],'resourceId':_0x19710e['id'],'type':_0x5e823d[_0x5ffe('0x1c')],'sectionId':_0x5e823d['id']},{})[_0x5ffe('0x16')](function(){return _0xecf340;});}else{return _0xecf340;}})['catch'](function(_0x5a498e){logger[_0x5ffe('0x1a')](_0x5ffe('0x3d'),_0x5a498e);throw _0x5a498e;});}return _0xecf340;})['then'](respondWithResult(_0x4d6f7b,0xc9))[_0x5ffe('0x29')](handleError(_0x4d6f7b,null));};exports[_0x5ffe('0x14')]=function(_0x494712,_0x5d107f){if(_0x494712[_0x5ffe('0x37')]['id']){delete _0x494712[_0x5ffe('0x37')]['id'];}return db[_0x5ffe('0x20')][_0x5ffe('0x35')]({'where':{'id':_0x494712[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x5d107f,null))['then'](saveUpdates(_0x494712['body'],null))[_0x5ffe('0x16')](respondWithResult(_0x5d107f,null))['catch'](handleError(_0x5d107f,null));};exports[_0x5ffe('0x15')]=function(_0x175b74,_0x3faba1){return db[_0x5ffe('0x20')]['find']({'where':{'id':_0x175b74[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x3faba1,null))['then'](removeEntity(_0x3faba1,null))[_0x5ffe('0x29')](handleError(_0x3faba1,null));};exports[_0x5ffe('0x3f')]=function(_0xe985c9,_0x4ee791){return db['OpenchannelQueue'][_0x5ffe('0x3f')]()[_0x5ffe('0x16')](respondWithResult(_0x4ee791,null))[_0x5ffe('0x29')](handleError(_0x4ee791,null));};exports['getMembers']=function(_0x2be31c,_0x21c855){var _0x23d82f={'raw':!![],'where':{}},_0xedbd99={},_0x2710ed;return db['OpenchannelQueue'][_0x5ffe('0x40')]({'where':{'id':_0x2be31c['params']['id']}})['then'](handleEntityNotFound(_0x21c855,null))['then'](function(_0x446781){if(_0x446781){_0x2710ed=_0x446781[_0x5ffe('0x17')]({'plain':!![]});_0xedbd99[_0x5ffe('0x2b')]=_['keys'](db[_0x5ffe('0x41')][_0x5ffe('0x21')]);_0xedbd99[_0x5ffe('0x26')]=_['keys'](_0x2be31c[_0x5ffe('0x26')]);_0xedbd99[_0x5ffe('0x2d')]=_['intersection'](_0xedbd99[_0x5ffe('0x2b')],_0xedbd99[_0x5ffe('0x26')]);_0x23d82f[_0x5ffe('0x2f')]=_['intersection'](_0xedbd99[_0x5ffe('0x2b')],qs[_0x5ffe('0x30')](_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x30')]));_0x23d82f[_0x5ffe('0x2f')]=_0x23d82f['attributes'][_0x5ffe('0x31')]?_0x23d82f['attributes']:_0xedbd99[_0x5ffe('0x2b')];if(!_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x42')](_0x5ffe('0x43'))){_0x23d82f[_0x5ffe('0x10')]=qs[_0x5ffe('0x10')](_0x2be31c['query'][_0x5ffe('0x10')]);_0x23d82f[_0x5ffe('0xe')]=qs[_0x5ffe('0xe')](_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0xe')]);}_0x23d82f[_0x5ffe('0x44')]=qs['sort'](_0x2be31c['query'][_0x5ffe('0x45')]);_0x23d82f[_0x5ffe('0x24')]=qs[_0x5ffe('0x2d')](_[_0x5ffe('0x46')](_0x2be31c[_0x5ffe('0x26')],_0xedbd99['filters']));_0x23d82f['where'][_0x5ffe('0x47')]=_0x446781['id'];if(_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x48')]){_0x23d82f[_0x5ffe('0x24')]=_[_0x5ffe('0x33')](_0x23d82f[_0x5ffe('0x24')],{'$or':_['map'](_0x23d82f[_0x5ffe('0x2f')],function(_0x25c4c7){var _0x1b24b3={};_0x1b24b3[_0x25c4c7]={'$like':'%'+_0x2be31c[_0x5ffe('0x26')][_0x5ffe('0x48')]+'%'};return _0x1b24b3;})});}_0x23d82f=_[_0x5ffe('0x33')]({},_0x23d82f,_0x2be31c[_0x5ffe('0x34')]);return db[_0x5ffe('0x41')][_0x5ffe('0x27')](_0x23d82f);}})[_0x5ffe('0x16')](function(_0x11209e){if(_0x11209e){return db[_0x5ffe('0x49')]['findAndCountAll']({'where':{'id':_[_0x5ffe('0x1f')](_0x11209e,_0x5ffe('0x4a')),'role':_0x5ffe('0x4b')},'attributes':['id',_0x5ffe('0x1c'),'openchannelPause','updatedAt',_0x5ffe('0x4c')]});}})[_0x5ffe('0x16')](function(_0x119771){if(_0x119771){return{'count':_0x119771[_0x5ffe('0x11')],'rows':_[_0x5ffe('0x1f')](_0x119771[_0x5ffe('0x28')],function(_0x8e97ae){return{'membername':_0x8e97ae[_0x5ffe('0x1c')],'UserId':_0x8e97ae['id'],'queue_name':_0x2710ed['name'],'OpenchannelQueueId':_0x2710ed['id'],'interface':util[_0x5ffe('0x4d')]('%s/%s','SIP',_0x8e97ae[_0x5ffe('0x1c')]),'penalty':0x0,'paused':_0x8e97ae[_0x5ffe('0x4e')],'createdAt':_0x8e97ae['createdAt'],'updatedAt':_0x8e97ae['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ffe('0x16')](respondWithFilteredResult(_0x21c855,_0x23d82f))['catch'](handleError(_0x21c855,null));};exports['getTeams']=function(_0x49817b,_0x77ac9f){var _0x314881={};var _0x41c1fe={};var _0xcc730e;var _0x2e9e09;return db[_0x5ffe('0x20')][_0x5ffe('0x40')]({'where':{'id':_0x49817b[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x77ac9f,null))[_0x5ffe('0x16')](function(_0x5aeefa){if(_0x5aeefa){_0xcc730e=_0x5aeefa;_0x41c1fe[_0x5ffe('0x2b')]=_['keys'](db['Team']['rawAttributes']);_0x41c1fe['query']=_[_0x5ffe('0x2c')](_0x49817b[_0x5ffe('0x26')]);_0x41c1fe['filters']=_[_0x5ffe('0x2e')](_0x41c1fe[_0x5ffe('0x2b')],_0x41c1fe['query']);_0x314881[_0x5ffe('0x2f')]=_[_0x5ffe('0x2e')](_0x41c1fe['model'],qs[_0x5ffe('0x30')](_0x49817b['query']['fields']));_0x314881[_0x5ffe('0x2f')]=_0x314881[_0x5ffe('0x2f')][_0x5ffe('0x31')]?_0x314881[_0x5ffe('0x2f')]:_0x41c1fe[_0x5ffe('0x2b')];_0x314881[_0x5ffe('0x44')]=qs[_0x5ffe('0x45')](_0x49817b[_0x5ffe('0x26')]['sort']);_0x314881[_0x5ffe('0x24')]=qs['filters'](_[_0x5ffe('0x46')](_0x49817b['query'],_0x41c1fe['filters']));if(_0x49817b['query'][_0x5ffe('0x48')]){_0x314881[_0x5ffe('0x24')]=_[_0x5ffe('0x33')](_0x314881['where'],{'$or':_['map'](_0x314881[_0x5ffe('0x2f')],function(_0x10404c){var _0x2c1b53={};_0x2c1b53[_0x10404c]={'$like':'%'+_0x49817b[_0x5ffe('0x26')][_0x5ffe('0x48')]+'%'};return _0x2c1b53;})});}_0x314881=_[_0x5ffe('0x33')]({},_0x314881,_0x49817b[_0x5ffe('0x34')]);return _0xcc730e[_0x5ffe('0x4f')](_0x314881);}})[_0x5ffe('0x16')](function(_0x3c9a7f){if(_0x3c9a7f){_0x2e9e09=_0x3c9a7f[_0x5ffe('0x31')];if(!_0x49817b['query'][_0x5ffe('0x42')](_0x5ffe('0x43'))){_0x314881[_0x5ffe('0x10')]=qs['limit'](_0x49817b['query'][_0x5ffe('0x10')]);_0x314881[_0x5ffe('0xe')]=qs['offset'](_0x49817b[_0x5ffe('0x26')][_0x5ffe('0xe')]);}return _0xcc730e[_0x5ffe('0x4f')](_0x314881);}})[_0x5ffe('0x16')](function(_0xc23729){if(_0xc23729){return _0xc23729?{'count':_0x2e9e09,'rows':_0xc23729}:null;}})['then'](respondWithResult(_0x77ac9f,null))[_0x5ffe('0x29')](handleError(_0x77ac9f,null));};exports['addTeams']=function(_0x37e3a3,_0x4e37a7){var _0x36cacf=_0x37e3a3[_0x5ffe('0x37')][_0x5ffe('0x50')];return db['Team'][_0x5ffe('0x27')]({'where':{'id':_0x36cacf},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5ffe('0x1c'),_0x5ffe('0x51'),_0x5ffe('0x52'),_0x5ffe('0x53')],'raw':!![]}]})[_0x5ffe('0x16')](function(_0x243087){if(_0x243087){var _0x69924b=_['flatMap'](_0x243087,function(_0x13f0c9){var _0x531d5b=_0x13f0c9[_0x5ffe('0x17')]({'plain':!![]});return _0x531d5b[_0x5ffe('0x54')];});return db['OpenchannelQueue'][_0x5ffe('0x35')]({'where':{'id':_0x37e3a3['params']['id']}})[_0x5ffe('0x16')](function(_0xdcc151){return db[_0x5ffe('0x55')]['transaction'](function(_0x3e8b24){return _0xdcc151[_0x5ffe('0x56')](_0x36cacf,{'transaction':_0x3e8b24})['then'](function(){return BPromise['each'](_0x69924b,function(_0x579c88){return db['UserOpenchannelQueue'][_0x5ffe('0x57')]({'where':{'UserId':_0x579c88['id'],'OpenchannelQueueId':_0x37e3a3[_0x5ffe('0x3e')]['id']},'transaction':_0x3e8b24});});})[_0x5ffe('0x16')](function(){_0x69924b[_0x5ffe('0x58')](function(_0x341a52){socket[_0x5ffe('0x59')](_0x5ffe('0x5a'),{'UserId':_0x341a52['id'],'OpenchannelQueueId':_0xdcc151['id']});});});});});}})[_0x5ffe('0x16')](respondWithStatusCode(_0x4e37a7,null))['catch'](handleError(_0x4e37a7,null));};exports[_0x5ffe('0x5b')]=function(_0x3453c1,_0x39f0ef){return db[_0x5ffe('0x5c')][_0x5ffe('0x27')]({'where':{'id':_0x3453c1[_0x5ffe('0x26')][_0x5ffe('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5ffe('0x16')](handleEntityNotFound(_0x39f0ef,null))['then'](function(_0x1a6751){var _0x8e2460=_[_0x5ffe('0x1f')](_0x1a6751,'id');var _0x1be555=[];var _0x298b8d=[];var _0x1e89e5=squel[_0x5ffe('0x5d')]();_0x1e89e5[_0x5ffe('0x5e')](_0x5ffe('0x5f'))[_0x5ffe('0x60')](_0x5ffe('0x61'),'tq')['join'](_0x5ffe('0x62'),'ut',_0x5ffe('0x63'))['where'](_0x5ffe('0x64'),_0x3453c1[_0x5ffe('0x3e')]['id']);for(var _0x43228e=0x0;_0x43228e<_0x1a6751['length'];_0x43228e+=0x1){let _0x1c106c=_0x1a6751[_0x43228e];for(var _0x236717=0x0;_0x236717<_0x1c106c[_0x5ffe('0x54')]['length'];_0x236717+=0x1){let _0x479070=_0x1c106c[_0x5ffe('0x54')][_0x236717];var _0x4c30c4=_0x1e89e5[_0x5ffe('0x65')]();_0x4c30c4[_0x5ffe('0x24')](_0x5ffe('0x66'),_0x479070['id']);_0x298b8d[_0x5ffe('0x67')](db[_0x5ffe('0x55')]['query'](_0x4c30c4[_0x5ffe('0x68')](),{'type':db[_0x5ffe('0x55')][_0x5ffe('0x69')]['SELECT']})[_0x5ffe('0x16')](function(_0x54f256){if(_0x54f256[_0x5ffe('0x31')]===0x1){return _0x479070['id'];}else{var _0x1fd931=_[_0x5ffe('0x6a')](_[_0x5ffe('0x1f')](_0x54f256,_0x5ffe('0x6b')),function(_0x183206){return _[_0x5ffe('0x6c')](_0x8e2460,_0x183206);});if(_0x1fd931){return _0x479070['id'];}}}));}}return BPromise['all'](_0x298b8d)[_0x5ffe('0x16')](function(_0x47e6e9){_0x1be555=_(_0x1be555)[_0x5ffe('0x6d')](_0x47e6e9)[_0x5ffe('0x6e')]()[_0x5ffe('0x6f')]();return db[_0x5ffe('0x20')][_0x5ffe('0x35')]({'where':{'id':_0x3453c1['params']['id']}})[_0x5ffe('0x16')](function(_0x84b136){return db[_0x5ffe('0x55')][_0x5ffe('0x70')](function(_0x2008a3){return _0x84b136[_0x5ffe('0x5b')](_0x3453c1[_0x5ffe('0x26')][_0x5ffe('0x50')],{'transaction':_0x2008a3})[_0x5ffe('0x16')](function(){if(!_[_0x5ffe('0x71')](_0x1be555)){return _0x84b136[_0x5ffe('0x72')](_0x1be555,{'transaction':_0x2008a3});}})[_0x5ffe('0x16')](function(){_0x1be555[_0x5ffe('0x58')](function(_0x4a06eb){socket[_0x5ffe('0x59')](_0x5ffe('0x73'),{'UserId':_0x4a06eb,'OpenchannelQueueId':_0x84b136['id']});});});});});});})['then'](respondWithStatusCode(_0x39f0ef,null))['catch'](handleError(_0x39f0ef,null));};exports[_0x5ffe('0x74')]=function(_0x2c0bad,_0x8d26b2){return db['OpenchannelQueue'][_0x5ffe('0x35')]({'where':{'id':_0x2c0bad['params']['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0x8d26b2,null))[_0x5ffe('0x16')](function(_0x479b38){if(_0x479b38){return _0x479b38[_0x5ffe('0x74')](_0x2c0bad[_0x5ffe('0x37')][_0x5ffe('0x50')],_[_0x5ffe('0x75')](_0x2c0bad[_0x5ffe('0x37')],[_0x5ffe('0x50'),'id'])||{})['spread'](function(_0x51b663){for(var _0x13dd1c=0x0;_0x13dd1c<_0x2c0bad[_0x5ffe('0x37')][_0x5ffe('0x50')]['length'];_0x13dd1c+=0x1){socket['emit'](_0x5ffe('0x5a'),{'UserId':Number(_0x2c0bad[_0x5ffe('0x37')][_0x5ffe('0x50')][_0x13dd1c]),'OpenchannelQueueId':Number(_0x2c0bad['params']['id'])});}return _0x51b663;});}})[_0x5ffe('0x16')](respondWithResult(_0x8d26b2,null))['catch'](handleError(_0x8d26b2,null));};exports[_0x5ffe('0x72')]=function(_0x51e3a3,_0xaba453){return db[_0x5ffe('0x20')][_0x5ffe('0x35')]({'where':{'id':_0x51e3a3[_0x5ffe('0x3e')]['id']}})[_0x5ffe('0x16')](handleEntityNotFound(_0xaba453,null))[_0x5ffe('0x16')](function(_0x14be6e){if(_0x14be6e){return _0x14be6e[_0x5ffe('0x72')](_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')])['then'](function(){if(_[_0x5ffe('0x76')](_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')])){for(var _0x10ca4f=0x0;_0x10ca4f<_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')][_0x5ffe('0x31')];_0x10ca4f+=0x1){socket[_0x5ffe('0x59')](_0x5ffe('0x73'),{'UserId':Number(_0x51e3a3[_0x5ffe('0x26')][_0x5ffe('0x50')][_0x10ca4f]),'OpenchannelQueueId':Number(_0x51e3a3[_0x5ffe('0x3e')]['id'])});}}else{socket[_0x5ffe('0x59')](_0x5ffe('0x73'),{'UserId':Number(_0x51e3a3['query']['ids']),'OpenchannelQueueId':Number(_0x51e3a3[_0x5ffe('0x3e')]['id'])});}});}})[_0x5ffe('0x16')](respondWithStatusCode(_0xaba453,null))[_0x5ffe('0x29')](handleError(_0xaba453,null));};exports[_0x5ffe('0x77')]=function(_0x2d095b,_0x3d75ec){var _0x310b6f={};var _0x15cd82={};var _0x474565;var _0x2fd9d4;return db[_0x5ffe('0x20')][_0x5ffe('0x40')]({'where':{'id':_0x2d095b[_0x5ffe('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3d75ec,null))[_0x5ffe('0x16')](function(_0x3aa2a9){if(_0x3aa2a9){_0x474565=_0x3aa2a9;_0x15cd82[_0x5ffe('0x2b')]=_[_0x5ffe('0x2c')](db[_0x5ffe('0x49')]['rawAttributes']);_0x15cd82[_0x5ffe('0x26')]=_[_0x5ffe('0x2c')](_0x2d095b[_0x5ffe('0x26')]);_0x15cd82[_0x5ffe('0x2d')]=_[_0x5ffe('0x2e')](_0x15cd82[_0x5ffe('0x2b')],_0x15cd82['query']);_0x310b6f[_0x5ffe('0x2f')]=_[_0x5ffe('0x2e')](_0x15cd82[_0x5ffe('0x2b')],qs['fields'](_0x2d095b[_0x5ffe('0x26')]['fields']));_0x310b6f[_0x5ffe('0x2f')]=_0x310b6f['attributes'][_0x5ffe('0x31')]?_0x310b6f[_0x5ffe('0x2f')]:_0x15cd82['model'];_0x310b6f['order']=qs[_0x5ffe('0x45')](_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0x45')]);_0x310b6f['where']=qs[_0x5ffe('0x2d')](_['pick'](_0x2d095b[_0x5ffe('0x26')],_0x15cd82['filters']));if(_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0x48')]){_0x310b6f['where']=_[_0x5ffe('0x33')](_0x310b6f[_0x5ffe('0x24')],{'$or':_[_0x5ffe('0x1f')](_0x310b6f[_0x5ffe('0x2f')],function(_0x4139f7){var _0x37fd14={};_0x37fd14[_0x4139f7]={'$like':'%'+_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0x48')]+'%'};return _0x37fd14;})});}_0x310b6f=_['merge']({},_0x310b6f,_0x2d095b[_0x5ffe('0x34')]);return _0x474565[_0x5ffe('0x77')](_0x310b6f);}})[_0x5ffe('0x16')](function(_0x27d430){if(_0x27d430){_0x2fd9d4=_0x27d430[_0x5ffe('0x31')];if(!_0x2d095b[_0x5ffe('0x26')]['hasOwnProperty'](_0x5ffe('0x43'))){_0x310b6f[_0x5ffe('0x10')]=qs['limit'](_0x2d095b[_0x5ffe('0x26')]['limit']);_0x310b6f['offset']=qs[_0x5ffe('0xe')](_0x2d095b[_0x5ffe('0x26')][_0x5ffe('0xe')]);}return _0x474565[_0x5ffe('0x77')](_0x310b6f);}})[_0x5ffe('0x16')](function(_0x9f8682){if(_0x9f8682){return _0x9f8682?{'count':_0x2fd9d4,'rows':_0x9f8682}:null;}})['then'](respondWithResult(_0x3d75ec,null))[_0x5ffe('0x29')](handleError(_0x3d75ec,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index dc865c5..bae0b81 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 _0x1fcd=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x3c5667,_0x57a8ff){var _0x4eb4e3=function(_0x2b945f){while(--_0x2b945f){_0x3c5667['push'](_0x3c5667['shift']());}};_0x4eb4e3(++_0x57a8ff);}(_0x1fcd,0x19b));var _0xd1fc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x1fcd[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0xd1fc('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd1fc('0x1')](0x0);var events={'afterCreate':_0xd1fc('0x2'),'afterUpdate':_0xd1fc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x559d5b){return function(_0x1d878b,_0x1ee592,_0x3af02f){OpenchannelQueueEvents['emit'](_0x559d5b+':'+_0x1d878b['id'],_0x1d878b);OpenchannelQueueEvents[_0xd1fc('0x4')](_0x559d5b,_0x1d878b);_0x3af02f(null);};}for(var e in events){if(events[_0xd1fc('0x5')](e)){var event=events[e];OpenchannelQueue[_0xd1fc('0x6')](e,emitEvent(event));}}module[_0xd1fc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xf224=['update','emit','hook','events','OpenchannelQueue','setMaxListeners'];(function(_0xabc049,_0x553c25){var _0x32bc5f=function(_0x6dc2fa){while(--_0x6dc2fa){_0xabc049['push'](_0xabc049['shift']());}};_0x32bc5f(++_0x553c25);}(_0xf224,0x189));var _0x4f22=function(_0x2f22d0,_0x24902d){_0x2f22d0=_0x2f22d0-0x0;var _0x9df3da=_0xf224[_0x2f22d0];return _0x9df3da;};'use strict';var EventEmitter=require(_0x4f22('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4f22('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4f22('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f22('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1b117f){return function(_0x438927,_0x1c2a71,_0x222666){OpenchannelQueueEvents[_0x4f22('0x4')](_0x1b117f+':'+_0x438927['id'],_0x438927);OpenchannelQueueEvents['emit'](_0x1b117f,_0x438927);_0x222666(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4f22('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 3d79bf0..72c739d 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 _0x2d67=['./openchannelQueue.attributes','exports','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e11ff,_0x247853){var _0x38498e=function(_0x410d6e){while(--_0x410d6e){_0x5e11ff['push'](_0x5e11ff['shift']());}};_0x38498e(++_0x247853);}(_0x2d67,0x1a0));var _0x72d6=function(_0x3f477c,_0x52b7ff){_0x3f477c=_0x3f477c-0x0;var _0x4c36b3=_0x2d67[_0x3f477c];return _0x4c36b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x72d6('0x0'));var moment=require(_0x72d6('0x1'));var BPromise=require(_0x72d6('0x2'));var rp=require(_0x72d6('0x3'));var fs=require('fs');var path=require(_0x72d6('0x4'));var rimraf=require(_0x72d6('0x5'));var config=require(_0x72d6('0x6'));var attributes=require(_0x72d6('0x7'));module[_0x72d6('0x8')]=function(_0x56c165,_0x5b0a1a){return _0x56c165['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd09a=['util','../../config/logger','request-promise','path','rimraf','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash'];(function(_0x58e613,_0x58f943){var _0x56d2cd=function(_0x35813a){while(--_0x35813a){_0x58e613['push'](_0x58e613['shift']());}};_0x56d2cd(++_0x58f943);}(_0xd09a,0x74));var _0xad09=function(_0x5f14d3,_0x1a1afa){_0x5f14d3=_0x5f14d3-0x0;var _0x2d0dbf=_0xd09a[_0x5f14d3];return _0x2d0dbf;};'use strict';var _=require(_0xad09('0x0'));var util=require(_0xad09('0x1'));var logger=require(_0xad09('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad09('0x3'));var fs=require('fs');var path=require(_0xad09('0x4'));var rimraf=require(_0xad09('0x5'));var config=require('../../config/environment');var attributes=require(_0xad09('0x6'));module[_0xad09('0x7')]=function(_0x3f0b60,_0x55d735){return _0x3f0b60['define'](_0xad09('0x8'),attributes,{'tableName':'openchannel_queues','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 7d57242..36ce49c 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 _0x399c=['register','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost'];(function(_0x155758,_0x73fd3d){var _0x573c15=function(_0x52f316){while(--_0x52f316){_0x155758['push'](_0x155758['shift']());}};_0x573c15(++_0x73fd3d);}(_0x399c,0xf7));var _0xc399=function(_0x3d2b02,_0x4af5aa){_0x3d2b02=_0x3d2b02-0x0;var _0x45ee5a=_0x399c[_0x3d2b02];return _0x45ee5a;};'use strict';var _=require(_0xc399('0x0'));var util=require(_0xc399('0x1'));var moment=require(_0xc399('0x2'));var BPromise=require('bluebird');var rs=require(_0xc399('0x3'));var fs=require('fs');var Redis=require(_0xc399('0x4'));var db=require(_0xc399('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc399('0x6'))('rpc');var config=require(_0xc399('0x7'));var jayson=require(_0xc399('0x8'));var client=jayson['client'][_0xc399('0x9')]({'port':0x232a});config['redis']=_[_0xc399('0xa')](config['redis'],{'host':_0xc399('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xc399('0xc')](socket);function respondWithRpcPromise(_0x59f571,_0x598930,_0x1cf123){return new BPromise(function(_0x2358d8,_0x17dbb3){return client['request'](_0x59f571,_0x1cf123)[_0xc399('0xd')](function(_0xf017f3){logger[_0xc399('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x598930,_0xc399('0xf'));logger[_0xc399('0x10')](_0xc399('0x11'),_0x598930,'request\x20sent',JSON[_0xc399('0x12')](_0xf017f3));if(_0xf017f3[_0xc399('0x13')]){if(_0xf017f3[_0xc399('0x13')][_0xc399('0x14')]===0x1f4){logger[_0xc399('0x13')](_0xc399('0x15'),_0x598930,_0xf017f3[_0xc399('0x13')][_0xc399('0x16')]);return _0x17dbb3(_0xf017f3[_0xc399('0x13')][_0xc399('0x16')]);}logger[_0xc399('0x13')](_0xc399('0x15'),_0x598930,_0xf017f3[_0xc399('0x13')][_0xc399('0x16')]);return _0x2358d8(_0xf017f3[_0xc399('0x13')][_0xc399('0x16')]);}else{logger[_0xc399('0xe')](_0xc399('0x15'),_0x598930,'request\x20sent');_0x2358d8(_0xf017f3[_0xc399('0x17')][_0xc399('0x16')]);}})[_0xc399('0x18')](function(_0x82cfdc){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x598930,_0x82cfdc);_0x17dbb3(_0x82cfdc);});});}exports[_0xc399('0x19')]=function(_0x5bdcc4){var _0x12e170=this;return new Promise(function(_0x597ac6,_0x10be75){return db[_0xc399('0x1a')]['findAll']({'raw':_0x5bdcc4[_0xc399('0x1b')]?_0x5bdcc4[_0xc399('0x1b')][_0xc399('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bdcc4['options']?_0x5bdcc4[_0xc399('0x1b')][_0xc399('0x1d')]||null:null,'attributes':_0x5bdcc4[_0xc399('0x1b')]?_0x5bdcc4[_0xc399('0x1b')][_0xc399('0x1e')]||null:null,'limit':_0x5bdcc4[_0xc399('0x1b')]?_0x5bdcc4[_0xc399('0x1b')][_0xc399('0x1f')]||null:null,'include':_0x5bdcc4[_0xc399('0x1b')]?_0x5bdcc4[_0xc399('0x1b')][_0xc399('0x20')]?_[_0xc399('0x21')](_0x5bdcc4[_0xc399('0x1b')][_0xc399('0x20')],function(_0xa7b9b9){return{'model':db[_0xa7b9b9[_0xc399('0x22')]],'as':_0xa7b9b9['as'],'attributes':_0xa7b9b9[_0xc399('0x1e')],'include':_0xa7b9b9[_0xc399('0x20')]?_['map'](_0xa7b9b9[_0xc399('0x20')],function(_0x125fa3){return{'model':db[_0x125fa3[_0xc399('0x22')]],'as':_0x125fa3['as'],'attributes':_0x125fa3[_0xc399('0x1e')],'include':_0x125fa3[_0xc399('0x20')]?_['map'](_0x125fa3[_0xc399('0x20')],function(_0x491646){return{'model':db[_0x491646[_0xc399('0x22')]],'as':_0x491646['as'],'attributes':_0x491646[_0xc399('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc399('0xd')](function(_0x38a6cb){logger[_0xc399('0xe')]('GetOpenchannelQueue',_0x5bdcc4);logger[_0xc399('0x10')](_0xc399('0x19'),_0x5bdcc4,JSON[_0xc399('0x12')](_0x38a6cb));_0x597ac6(_0x38a6cb);})[_0xc399('0x18')](function(_0x28e735){logger[_0xc399('0x13')](_0xc399('0x19'),_0x28e735['message'],_0x5bdcc4);_0x10be75(_0x12e170[_0xc399('0x13')](0x1f4,_0x28e735[_0xc399('0x16')]));});});};exports[_0xc399('0x23')]=function(_0x14aa09){var _0x4da251=this;return new Promise(function(_0x1603f3,_0x248d7c){return db[_0xc399('0x1a')][_0xc399('0x24')]({'raw':_0x14aa09['options']?_0x14aa09[_0xc399('0x1b')][_0xc399('0x1c')]===undefined?!![]:![]:!![],'where':_0x14aa09[_0xc399('0x1b')]?_0x14aa09[_0xc399('0x1b')]['where']||null:null,'attributes':_0x14aa09[_0xc399('0x1b')]?_0x14aa09[_0xc399('0x1b')][_0xc399('0x1e')]||null:null,'include':_0x14aa09[_0xc399('0x1b')]?_0x14aa09['options'][_0xc399('0x20')]?_[_0xc399('0x21')](_0x14aa09[_0xc399('0x1b')]['include'],function(_0x12ee88){return{'model':db[_0x12ee88[_0xc399('0x22')]],'as':_0x12ee88['as'],'attributes':_0x12ee88[_0xc399('0x1e')],'include':_0x12ee88['include']?_[_0xc399('0x21')](_0x12ee88[_0xc399('0x20')],function(_0x595442){return{'model':db[_0x595442['model']],'as':_0x595442['as'],'attributes':_0x595442[_0xc399('0x1e')],'include':_0x595442[_0xc399('0x20')]?_[_0xc399('0x21')](_0x595442[_0xc399('0x20')],function(_0x5e8a5f){return{'model':db[_0x5e8a5f[_0xc399('0x22')]],'as':_0x5e8a5f['as'],'attributes':_0x5e8a5f[_0xc399('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc399('0xd')](function(_0x45d33c){logger[_0xc399('0xe')](_0xc399('0x23'),_0x14aa09);logger['debug']('ShowOpenchannelQueue',_0x14aa09,JSON[_0xc399('0x12')](_0x45d33c));_0x1603f3(_0x45d33c);})['catch'](function(_0xe5b27c){logger['error'](_0xc399('0x23'),_0xe5b27c['message'],_0x14aa09);_0x248d7c(_0x4da251[_0xc399('0x13')](0x1f4,_0xe5b27c[_0xc399('0x16')]));});});}; \ No newline at end of file +var _0xa560=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','then','stringify','catch','ShowOpenchannelQueue','find','raw','lodash','util','randomstring'];(function(_0x3b415e,_0x98e90){var _0x1a4f88=function(_0x4fc177){while(--_0x4fc177){_0x3b415e['push'](_0x3b415e['shift']());}};_0x1a4f88(++_0x98e90);}(_0xa560,0x1a1));var _0x0a56=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa560[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0a56('0x0'));var util=require(_0x0a56('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a56('0x3'))['db'];var utils=require(_0x0a56('0x4'));var logger=require(_0x0a56('0x5'))(_0x0a56('0x6'));var config=require(_0x0a56('0x7'));var jayson=require(_0x0a56('0x8'));var client=jayson[_0x0a56('0x9')][_0x0a56('0xa')]({'port':0x232a});config['redis']=_[_0x0a56('0xb')](config[_0x0a56('0xc')],{'host':_0x0a56('0xd'),'port':0x18eb});var socket=require(_0x0a56('0xe'))(new Redis(config['redis']));require(_0x0a56('0xf'))[_0x0a56('0x10')](socket);function respondWithRpcPromise(_0x12fac3,_0x1e1e35,_0x538fed){return new BPromise(function(_0x300031,_0x4bf21d){return client[_0x0a56('0x11')](_0x12fac3,_0x538fed)['then'](function(_0x4fdeb4){logger['info'](_0x0a56('0x12'),_0x1e1e35,_0x0a56('0x13'));logger[_0x0a56('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e1e35,_0x0a56('0x13'),JSON['stringify'](_0x4fdeb4));if(_0x4fdeb4['error']){if(_0x4fdeb4[_0x0a56('0x15')][_0x0a56('0x16')]===0x1f4){logger[_0x0a56('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e1e35,_0x4fdeb4['error'][_0x0a56('0x17')]);return _0x4bf21d(_0x4fdeb4[_0x0a56('0x15')][_0x0a56('0x17')]);}logger[_0x0a56('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e1e35,_0x4fdeb4['error'][_0x0a56('0x17')]);return _0x300031(_0x4fdeb4['error'][_0x0a56('0x17')]);}else{logger[_0x0a56('0x18')](_0x0a56('0x12'),_0x1e1e35,_0x0a56('0x13'));_0x300031(_0x4fdeb4[_0x0a56('0x19')]['message']);}})['catch'](function(_0x390c9d){logger[_0x0a56('0x15')](_0x0a56('0x12'),_0x1e1e35,_0x390c9d);_0x4bf21d(_0x390c9d);});});}exports[_0x0a56('0x1a')]=function(_0xd14b9f){var _0x124065=this;return new Promise(function(_0x33c166,_0x5f522f){return db[_0x0a56('0x1b')][_0x0a56('0x1c')]({'raw':_0xd14b9f[_0x0a56('0x1d')]?_0xd14b9f[_0x0a56('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xd14b9f['options']?_0xd14b9f[_0x0a56('0x1d')][_0x0a56('0x1e')]||null:null,'attributes':_0xd14b9f['options']?_0xd14b9f[_0x0a56('0x1d')]['attributes']||null:null,'limit':_0xd14b9f[_0x0a56('0x1d')]?_0xd14b9f[_0x0a56('0x1d')][_0x0a56('0x1f')]||null:null,'include':_0xd14b9f[_0x0a56('0x1d')]?_0xd14b9f[_0x0a56('0x1d')][_0x0a56('0x20')]?_[_0x0a56('0x21')](_0xd14b9f['options'][_0x0a56('0x20')],function(_0xebc6e3){return{'model':db[_0xebc6e3[_0x0a56('0x22')]],'as':_0xebc6e3['as'],'attributes':_0xebc6e3[_0x0a56('0x23')],'include':_0xebc6e3[_0x0a56('0x20')]?_[_0x0a56('0x21')](_0xebc6e3['include'],function(_0x570f30){return{'model':db[_0x570f30[_0x0a56('0x22')]],'as':_0x570f30['as'],'attributes':_0x570f30[_0x0a56('0x23')],'include':_0x570f30[_0x0a56('0x20')]?_['map'](_0x570f30[_0x0a56('0x20')],function(_0x370c83){return{'model':db[_0x370c83['model']],'as':_0x370c83['as'],'attributes':_0x370c83[_0x0a56('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0a56('0x24')](function(_0xed8934){logger['info'](_0x0a56('0x1a'),_0xd14b9f);logger[_0x0a56('0x14')](_0x0a56('0x1a'),_0xd14b9f,JSON[_0x0a56('0x25')](_0xed8934));_0x33c166(_0xed8934);})[_0x0a56('0x26')](function(_0x5df3cc){logger[_0x0a56('0x15')](_0x0a56('0x1a'),_0x5df3cc['message'],_0xd14b9f);_0x5f522f(_0x124065['error'](0x1f4,_0x5df3cc[_0x0a56('0x17')]));});});};exports[_0x0a56('0x27')]=function(_0x1bac66){var _0x1c97d7=this;return new Promise(function(_0x49da9a,_0x3c8c0b){return db[_0x0a56('0x1b')][_0x0a56('0x28')]({'raw':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x29')]===undefined?!![]:![]:!![],'where':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x1e')]||null:null,'attributes':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66['options'][_0x0a56('0x23')]||null:null,'include':_0x1bac66[_0x0a56('0x1d')]?_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x20')]?_['map'](_0x1bac66[_0x0a56('0x1d')][_0x0a56('0x20')],function(_0x3ab1b1){return{'model':db[_0x3ab1b1[_0x0a56('0x22')]],'as':_0x3ab1b1['as'],'attributes':_0x3ab1b1['attributes'],'include':_0x3ab1b1['include']?_[_0x0a56('0x21')](_0x3ab1b1['include'],function(_0x453807){return{'model':db[_0x453807['model']],'as':_0x453807['as'],'attributes':_0x453807[_0x0a56('0x23')],'include':_0x453807[_0x0a56('0x20')]?_['map'](_0x453807[_0x0a56('0x20')],function(_0xdbfe90){return{'model':db[_0xdbfe90[_0x0a56('0x22')]],'as':_0xdbfe90['as'],'attributes':_0xdbfe90[_0x0a56('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0a56('0x24')](function(_0x11aa49){logger['info'](_0x0a56('0x27'),_0x1bac66);logger[_0x0a56('0x14')](_0x0a56('0x27'),_0x1bac66,JSON['stringify'](_0x11aa49));_0x49da9a(_0x11aa49);})['catch'](function(_0x547e95){logger[_0x0a56('0x15')](_0x0a56('0x27'),_0x547e95[_0x0a56('0x17')],_0x1bac66);_0x3c8c0b(_0x1c97d7[_0x0a56('0x15')](0x1f4,_0x547e95[_0x0a56('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5fb8508..4bd2a9d 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 _0x2d22=['save','emit','removeListener','register','length','openchannelQueue:'];(function(_0x24ef05,_0x4132bb){var _0x35792a=function(_0x29b1bf){while(--_0x29b1bf){_0x24ef05['push'](_0x24ef05['shift']());}};_0x35792a(++_0x4132bb);}(_0x2d22,0x1da));var _0x22d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d22[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x22d2('0x0'),'remove','update'];function createListener(_0x1d848e,_0x4feaa4){return function(_0x20d43e){_0x4feaa4[_0x22d2('0x1')](_0x1d848e,_0x20d43e);};}function removeListener(_0xdcd2d4,_0x25808b){return function(){OpenchannelQueueEvents[_0x22d2('0x2')](_0xdcd2d4,_0x25808b);};}exports[_0x22d2('0x3')]=function(_0x15d34a){for(var _0x53c356=0x0,_0x11f056=events[_0x22d2('0x4')];_0x53c356<_0x11f056;_0x53c356++){var _0x2add6b=events[_0x53c356];var _0x5cc376=createListener(_0x22d2('0x5')+_0x2add6b,_0x15d34a);OpenchannelQueueEvents['on'](_0x2add6b,_0x5cc376);}}; \ No newline at end of file +var _0x7aa8=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0x7aa8,0x10c));var _0x87aa=function(_0x379a00,_0x59e6e4){_0x379a00=_0x379a00-0x0;var _0x5329a9=_0x7aa8[_0x379a00];return _0x5329a9;};'use strict';var OpenchannelQueueEvents=require(_0x87aa('0x0'));var events=[_0x87aa('0x1'),_0x87aa('0x2'),_0x87aa('0x3')];function createListener(_0x28c1bc,_0x4c5ffb){return function(_0x437113){_0x4c5ffb[_0x87aa('0x4')](_0x28c1bc,_0x437113);};}function removeListener(_0x57a4f4,_0x13ab17){return function(){OpenchannelQueueEvents['removeListener'](_0x57a4f4,_0x13ab17);};}exports[_0x87aa('0x5')]=function(_0x9a1655){for(var _0x5e380f=0x0,_0x52b55e=events[_0x87aa('0x6')];_0x5e380f<_0x52b55e;_0x5e380f++){var _0x3b1203=events[_0x5e380f];var _0x501f3f=createListener(_0x87aa('0x7')+_0x3b1203,_0x9a1655);OpenchannelQueueEvents['on'](_0x3b1203,_0x501f3f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d849c07..4e5ac72 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 _0x9075=['post','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x48af21,_0xbb5da7){var _0x278645=function(_0x30d4e2){while(--_0x30d4e2){_0x48af21['push'](_0x48af21['shift']());}};_0x278645(++_0xbb5da7);}(_0x9075,0x109));var _0x5907=function(_0x242566,_0x4ec88d){_0x242566=_0x242566-0x0;var _0x1bc410=_0x9075[_0x242566];return _0x1bc410;};'use strict';var multer=require('multer');var util=require(_0x5907('0x0'));var path=require(_0x5907('0x1'));var timeout=require('connect-timeout');var express=require(_0x5907('0x2'));var router=express[_0x5907('0x3')]();var fs_extra=require(_0x5907('0x4'));var auth=require(_0x5907('0x5'));var interaction=require(_0x5907('0x6'));var config=require(_0x5907('0x7'));var controller=require(_0x5907('0x8'));router[_0x5907('0x9')]('/',auth[_0x5907('0xa')](),controller[_0x5907('0xb')]);router['get'](_0x5907('0xc'),auth[_0x5907('0xa')](),controller[_0x5907('0xd')]);router[_0x5907('0x9')](_0x5907('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5907('0xf')]('/',auth[_0x5907('0xa')](),controller['create']);router['put'](_0x5907('0xe'),auth['isAuthenticated'](),controller[_0x5907('0x10')]);router[_0x5907('0x11')](_0x5907('0xe'),auth[_0x5907('0xa')](),controller[_0x5907('0x12')]);module[_0x5907('0x13')]=router; \ No newline at end of file +var _0x6425=['destroy','path','Router','fs-extra','./openchannelQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','create','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6425,0xe2));var _0x5642=function(_0x13a67b,_0x1d72d7){_0x13a67b=_0x13a67b-0x0;var _0x5667dc=_0x6425[_0x13a67b];return _0x5667dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5642('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5642('0x1')]();var fs_extra=require(_0x5642('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5642('0x3'));router['get']('/',auth[_0x5642('0x4')](),controller['index']);router['get'](_0x5642('0x5'),auth[_0x5642('0x4')](),controller[_0x5642('0x6')]);router[_0x5642('0x7')](_0x5642('0x8'),auth[_0x5642('0x4')](),controller[_0x5642('0x9')]);router[_0x5642('0xa')]('/',auth[_0x5642('0x4')](),controller[_0x5642('0xb')]);router['put'](_0x5642('0x8'),auth['isAuthenticated'](),controller[_0x5642('0xc')]);router[_0x5642('0xd')](_0x5642('0x8'),auth[_0x5642('0x4')](),controller[_0x5642('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6672e3c..cbd6f5c 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 _0x793b=['moment','sequelize','exports','STRING','DATE'];(function(_0x1346a0,_0x3d11e3){var _0x5cf0b5=function(_0x30e8a0){while(--_0x30e8a0){_0x1346a0['push'](_0x1346a0['shift']());}};_0x5cf0b5(++_0x3d11e3);}(_0x793b,0x1ae));var _0xb793=function(_0x2ed86d,_0x2e804e){_0x2ed86d=_0x2ed86d-0x0;var _0xe13c85=_0x793b[_0x2ed86d];return _0xe13c85;};'use strict';var moment=require(_0xb793('0x0'));var Sequelize=require(_0xb793('0x1'));module[_0xb793('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb793('0x3')]},'joinAt':{'type':Sequelize[_0xb793('0x4')]},'leaveAt':{'type':Sequelize[_0xb793('0x4')]},'acceptAt':{'type':Sequelize[_0xb793('0x4')]},'exitAt':{'type':Sequelize[_0xb793('0x4')]},'reason':{'type':Sequelize[_0xb793('0x3')]}}; \ No newline at end of file +var _0x266d=['DATE','STRING','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x266d,0x152));var _0xd266=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x266d[_0x19950b];return _0x3c6b41;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd266('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd266('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd266('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5a3922b..4e2151d 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 _0x5205=['sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','index','OpenchannelQueueReport','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x5205,0xc7));var _0x5520=function(_0xbf5344,_0x56c8ce){_0xbf5344=_0xbf5344-0x0;var _0x2547c5=_0x5205[_0xbf5344];return _0x2547c5;};'use strict';var emlformat=require(_0x5520('0x0'));var rimraf=require(_0x5520('0x1'));var zipdir=require(_0x5520('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5520('0x3'));var BPromise=require(_0x5520('0x4'));var Mustache=require(_0x5520('0x5'));var util=require(_0x5520('0x6'));var path=require(_0x5520('0x7'));var sox=require(_0x5520('0x8'));var csv=require(_0x5520('0x9'));var ejs=require(_0x5520('0xa'));var fs=require('fs');var fs_extra=require(_0x5520('0xb'));var _=require('lodash');var squel=require(_0x5520('0xc'));var crypto=require(_0x5520('0xd'));var jsforce=require(_0x5520('0xe'));var deskjs=require(_0x5520('0xf'));var toCsv=require(_0x5520('0x9'));var querystring=require(_0x5520('0x10'));var Papa=require('papaparse');var Redis=require(_0x5520('0x11'));var authService=require(_0x5520('0x12'));var qs=require(_0x5520('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5520('0x14'));var logger=require('../../config/logger')(_0x5520('0x15'));var utils=require(_0x5520('0x16'));var config=require(_0x5520('0x17'));var licenseUtil=require(_0x5520('0x18'));var db=require(_0x5520('0x19'))['db'];function respondWithStatusCode(_0x15f362,_0x46b9aa){_0x46b9aa=_0x46b9aa||0xcc;return function(_0xddc161){if(_0xddc161){return _0x15f362[_0x5520('0x1a')](_0x46b9aa);}return _0x15f362[_0x5520('0x1b')](_0x46b9aa)[_0x5520('0x1c')]();};}function respondWithResult(_0x1fe1c4,_0x39551d){_0x39551d=_0x39551d||0xc8;return function(_0x248e98){if(_0x248e98){return _0x1fe1c4['status'](_0x39551d)[_0x5520('0x1d')](_0x248e98);}};}function respondWithFilteredResult(_0x1f5170,_0x32d937){return function(_0x1f28bb){if(_0x1f28bb){var _0x3d1b43=typeof _0x32d937['offset']===_0x5520('0x1e')&&typeof _0x32d937[_0x5520('0x1f')]==='undefined';var _0xd999cf=_0x1f28bb[_0x5520('0x20')];var _0xe84f83=_0x3d1b43?0x0:_0x32d937[_0x5520('0x21')];var _0x2350f3=_0x3d1b43?_0x1f28bb[_0x5520('0x20')]:_0x32d937[_0x5520('0x21')]+_0x32d937[_0x5520('0x1f')];var _0x3aca35;if(_0x2350f3>=_0xd999cf){_0x2350f3=_0xd999cf;_0x3aca35=0xc8;}else{_0x3aca35=0xce;}_0x1f5170[_0x5520('0x1b')](_0x3aca35);return _0x1f5170[_0x5520('0x22')]('Content-Range',_0xe84f83+'-'+_0x2350f3+'/'+_0xd999cf)[_0x5520('0x1d')](_0x1f28bb);}return null;};}function patchUpdates(_0x29eaa7){return function(_0x5085d0){try{jsonpatch[_0x5520('0x23')](_0x5085d0,_0x29eaa7,!![]);}catch(_0x495561){return BPromise[_0x5520('0x24')](_0x495561);}return _0x5085d0[_0x5520('0x25')]();};}function saveUpdates(_0x59f145,_0x4b011b){return function(_0x519fa1){if(_0x519fa1){return _0x519fa1['update'](_0x59f145)[_0x5520('0x26')](function(_0x45f6f4){return _0x45f6f4;});}return null;};}function removeEntity(_0x39b65c,_0x5cb322){return function(_0xe88884){if(_0xe88884){return _0xe88884[_0x5520('0x27')]()[_0x5520('0x26')](function(){_0x39b65c[_0x5520('0x1b')](0xcc)[_0x5520('0x1c')]();});}};}function handleEntityNotFound(_0x345bfa,_0x57c650){return function(_0xee2221){if(!_0xee2221){_0x345bfa[_0x5520('0x1a')](0x194);}return _0xee2221;};}function handleError(_0x5755c4,_0x13176d){_0x13176d=_0x13176d||0x1f4;return function(_0x5eb92e){logger[_0x5520('0x28')](_0x5eb92e[_0x5520('0x29')]);if(_0x5eb92e[_0x5520('0x2a')]){delete _0x5eb92e[_0x5520('0x2a')];}_0x5755c4[_0x5520('0x1b')](_0x13176d)['send'](_0x5eb92e);};}exports[_0x5520('0x2b')]=function(_0x48d66a,_0x6c8167){var _0x5a281e={},_0x5afa68={},_0xa54d8d={'count':0x0,'rows':[]};var _0x36e88e=_['map'](db[_0x5520('0x2c')]['rawAttributes'],function(_0x1aee8a){return{'name':_0x1aee8a[_0x5520('0x2d')],'type':_0x1aee8a[_0x5520('0x2e')]['key']};});_0x5afa68[_0x5520('0x2f')]=_[_0x5520('0x30')](_0x36e88e,_0x5520('0x2a'));_0x5afa68[_0x5520('0x31')]=_['keys'](_0x48d66a[_0x5520('0x31')]);_0x5afa68[_0x5520('0x32')]=_[_0x5520('0x33')](_0x5afa68[_0x5520('0x2f')],_0x5afa68[_0x5520('0x31')]);_0x5a281e['attributes']=_[_0x5520('0x33')](_0x5afa68[_0x5520('0x2f')],qs[_0x5520('0x34')](_0x48d66a[_0x5520('0x31')][_0x5520('0x34')]));_0x5a281e['attributes']=_0x5a281e[_0x5520('0x35')][_0x5520('0x36')]?_0x5a281e[_0x5520('0x35')]:_0x5afa68[_0x5520('0x2f')];if(!_0x48d66a[_0x5520('0x31')]['hasOwnProperty'](_0x5520('0x37'))){_0x5a281e['limit']=qs[_0x5520('0x1f')](_0x48d66a['query'][_0x5520('0x1f')]);_0x5a281e[_0x5520('0x21')]=qs[_0x5520('0x21')](_0x48d66a[_0x5520('0x31')][_0x5520('0x21')]);}_0x5a281e[_0x5520('0x38')]=qs[_0x5520('0x39')](_0x48d66a['query'][_0x5520('0x39')]);_0x5a281e[_0x5520('0x3a')]=qs[_0x5520('0x32')](_['pick'](_0x48d66a[_0x5520('0x31')],_0x5afa68[_0x5520('0x32')]),_0x36e88e);if(_0x48d66a['query'][_0x5520('0x3b')]){_0x5a281e[_0x5520('0x3a')]=_[_0x5520('0x3c')](_0x5a281e['where'],{'$or':_[_0x5520('0x30')](_0x36e88e,function(_0x237e38){if(_0x237e38[_0x5520('0x2e')]!==_0x5520('0x3d')){var _0x32cea3={};_0x32cea3[_0x237e38[_0x5520('0x2a')]]={'$like':'%'+_0x48d66a[_0x5520('0x31')][_0x5520('0x3b')]+'%'};return _0x32cea3;}})});}_0x5a281e=_[_0x5520('0x3c')]({},_0x5a281e,_0x48d66a[_0x5520('0x3e')]);var _0x34ebc4={'where':_0x5a281e[_0x5520('0x3a')]};return db[_0x5520('0x2c')]['count'](_0x34ebc4)['then'](function(_0x307da9){_0xa54d8d[_0x5520('0x20')]=_0x307da9;if(_0x48d66a['query'][_0x5520('0x3f')]){_0x5a281e[_0x5520('0x40')]=[{'all':!![]}];}return db[_0x5520('0x2c')]['findAll'](_0x5a281e);})[_0x5520('0x26')](function(_0x1b749b){_0xa54d8d[_0x5520('0x41')]=_0x1b749b;return _0xa54d8d;})['then'](respondWithFilteredResult(_0x6c8167,_0x5a281e))['catch'](handleError(_0x6c8167,null));};exports[_0x5520('0x42')]=function(_0xf05c9,_0x1fda66){var _0x56fbd4={'raw':!![],'where':{'id':_0xf05c9[_0x5520('0x43')]['id']}},_0xa94636={};_0xa94636[_0x5520('0x2f')]=_[_0x5520('0x44')](db[_0x5520('0x2c')]['rawAttributes']);_0xa94636[_0x5520('0x31')]=_['keys'](_0xf05c9[_0x5520('0x31')]);_0xa94636[_0x5520('0x32')]=_[_0x5520('0x33')](_0xa94636[_0x5520('0x2f')],_0xa94636[_0x5520('0x31')]);_0x56fbd4['attributes']=_['intersection'](_0xa94636[_0x5520('0x2f')],qs[_0x5520('0x34')](_0xf05c9['query'][_0x5520('0x34')]));_0x56fbd4[_0x5520('0x35')]=_0x56fbd4[_0x5520('0x35')][_0x5520('0x36')]?_0x56fbd4[_0x5520('0x35')]:_0xa94636['model'];if(_0xf05c9[_0x5520('0x31')]['includeAll']){_0x56fbd4['include']=[{'all':!![]}];}_0x56fbd4=_[_0x5520('0x3c')]({},_0x56fbd4,_0xf05c9['options']);return db[_0x5520('0x2c')][_0x5520('0x45')](_0x56fbd4)['then'](handleEntityNotFound(_0x1fda66,null))['then'](respondWithResult(_0x1fda66,null))[_0x5520('0x46')](handleError(_0x1fda66,null));};exports[_0x5520('0x47')]=function(_0xb600a2,_0x58a10c){return db[_0x5520('0x2c')][_0x5520('0x47')](_0xb600a2[_0x5520('0x48')],{})['then'](respondWithResult(_0x58a10c,0xc9))[_0x5520('0x46')](handleError(_0x58a10c,null));};exports[_0x5520('0x49')]=function(_0x3a68c5,_0x52c160){if(_0x3a68c5[_0x5520('0x48')]['id']){delete _0x3a68c5['body']['id'];}return db[_0x5520('0x2c')][_0x5520('0x45')]({'where':{'id':_0x3a68c5['params']['id']}})[_0x5520('0x26')](handleEntityNotFound(_0x52c160,null))[_0x5520('0x26')](saveUpdates(_0x3a68c5[_0x5520('0x48')],null))[_0x5520('0x26')](respondWithResult(_0x52c160,null))[_0x5520('0x46')](handleError(_0x52c160,null));};exports['destroy']=function(_0x577203,_0x9704d3){return db[_0x5520('0x2c')][_0x5520('0x45')]({'where':{'id':_0x577203[_0x5520('0x43')]['id']}})[_0x5520('0x26')](handleEntityNotFound(_0x9704d3,null))[_0x5520('0x26')](removeEntity(_0x9704d3,null))[_0x5520('0x46')](handleError(_0x9704d3,null));};exports['describe']=function(_0x3ea3c3,_0x5a9bf5){return db[_0x5520('0x2c')][_0x5520('0x4a')]()[_0x5520('0x26')](respondWithResult(_0x5a9bf5,null))['catch'](handleError(_0x5a9bf5,null));}; \ No newline at end of file +var _0x2033=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','keys','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3ad527,_0x55b741){var _0x2d7bcc=function(_0x1492a6){while(--_0x1492a6){_0x3ad527['push'](_0x3ad527['shift']());}};_0x2d7bcc(++_0x55b741);}(_0x2033,0x183));var _0x3203=function(_0x3fe0fe,_0x3bdc49){_0x3fe0fe=_0x3fe0fe-0x0;var _0x5c11f4=_0x2033[_0x3fe0fe];return _0x5c11f4;};'use strict';var emlformat=require(_0x3203('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3203('0x1'));var rp=require(_0x3203('0x2'));var moment=require(_0x3203('0x3'));var BPromise=require(_0x3203('0x4'));var Mustache=require(_0x3203('0x5'));var util=require(_0x3203('0x6'));var path=require(_0x3203('0x7'));var sox=require('sox');var csv=require(_0x3203('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3203('0x9'));var squel=require(_0x3203('0xa'));var crypto=require(_0x3203('0xb'));var jsforce=require(_0x3203('0xc'));var deskjs=require(_0x3203('0xd'));var toCsv=require(_0x3203('0x8'));var querystring=require(_0x3203('0xe'));var Papa=require(_0x3203('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3203('0x10'));var as=require(_0x3203('0x11'));var hardwareService=require(_0x3203('0x12'));var logger=require(_0x3203('0x13'))('api');var utils=require(_0x3203('0x14'));var config=require(_0x3203('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3203('0x16'))['db'];function respondWithStatusCode(_0x2e7cdc,_0x4b2d91){_0x4b2d91=_0x4b2d91||0xcc;return function(_0x5a9d59){if(_0x5a9d59){return _0x2e7cdc[_0x3203('0x17')](_0x4b2d91);}return _0x2e7cdc[_0x3203('0x18')](_0x4b2d91)[_0x3203('0x19')]();};}function respondWithResult(_0x3f88f2,_0x24b3b3){_0x24b3b3=_0x24b3b3||0xc8;return function(_0x53d5fd){if(_0x53d5fd){return _0x3f88f2[_0x3203('0x18')](_0x24b3b3)[_0x3203('0x1a')](_0x53d5fd);}};}function respondWithFilteredResult(_0x46cbd5,_0x30f7ce){return function(_0x15ef0e){if(_0x15ef0e){var _0x429902=typeof _0x30f7ce[_0x3203('0x1b')]===_0x3203('0x1c')&&typeof _0x30f7ce[_0x3203('0x1d')]===_0x3203('0x1c');var _0x143698=_0x15ef0e[_0x3203('0x1e')];var _0x187e63=_0x429902?0x0:_0x30f7ce[_0x3203('0x1b')];var _0x45f231=_0x429902?_0x15ef0e[_0x3203('0x1e')]:_0x30f7ce['offset']+_0x30f7ce[_0x3203('0x1d')];var _0x355ca3;if(_0x45f231>=_0x143698){_0x45f231=_0x143698;_0x355ca3=0xc8;}else{_0x355ca3=0xce;}_0x46cbd5[_0x3203('0x18')](_0x355ca3);return _0x46cbd5[_0x3203('0x1f')](_0x3203('0x20'),_0x187e63+'-'+_0x45f231+'/'+_0x143698)[_0x3203('0x1a')](_0x15ef0e);}return null;};}function patchUpdates(_0x51aca0){return function(_0x1e142a){try{jsonpatch[_0x3203('0x21')](_0x1e142a,_0x51aca0,!![]);}catch(_0x3c8eaa){return BPromise['reject'](_0x3c8eaa);}return _0x1e142a[_0x3203('0x22')]();};}function saveUpdates(_0x89ec95,_0x39ac9c){return function(_0x5a2a32){if(_0x5a2a32){return _0x5a2a32[_0x3203('0x23')](_0x89ec95)[_0x3203('0x24')](function(_0x161adc){return _0x161adc;});}return null;};}function removeEntity(_0x38ecc4,_0x1bba18){return function(_0x47b917){if(_0x47b917){return _0x47b917['destroy']()['then'](function(){_0x38ecc4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc96b41,_0x47d23b){return function(_0xc362a7){if(!_0xc362a7){_0xc96b41[_0x3203('0x17')](0x194);}return _0xc362a7;};}function handleError(_0xd8503f,_0x1b563a){_0x1b563a=_0x1b563a||0x1f4;return function(_0x5cae57){logger['error'](_0x5cae57[_0x3203('0x25')]);if(_0x5cae57[_0x3203('0x26')]){delete _0x5cae57[_0x3203('0x26')];}_0xd8503f[_0x3203('0x18')](_0x1b563a)[_0x3203('0x27')](_0x5cae57);};}exports['index']=function(_0x52326c,_0x5a28cd){var _0x36c87c={},_0x579fd5={},_0x1c7429={'count':0x0,'rows':[]};var _0x295152=_[_0x3203('0x28')](db[_0x3203('0x29')][_0x3203('0x2a')],function(_0x4e9ff2){return{'name':_0x4e9ff2['fieldName'],'type':_0x4e9ff2[_0x3203('0x2b')][_0x3203('0x2c')]};});_0x579fd5[_0x3203('0x2d')]=_['map'](_0x295152,'name');_0x579fd5[_0x3203('0x2e')]=_['keys'](_0x52326c['query']);_0x579fd5[_0x3203('0x2f')]=_[_0x3203('0x30')](_0x579fd5[_0x3203('0x2d')],_0x579fd5['query']);_0x36c87c[_0x3203('0x31')]=_[_0x3203('0x30')](_0x579fd5['model'],qs[_0x3203('0x32')](_0x52326c[_0x3203('0x2e')][_0x3203('0x32')]));_0x36c87c[_0x3203('0x31')]=_0x36c87c[_0x3203('0x31')][_0x3203('0x33')]?_0x36c87c[_0x3203('0x31')]:_0x579fd5['model'];if(!_0x52326c[_0x3203('0x2e')]['hasOwnProperty']('nolimit')){_0x36c87c['limit']=qs[_0x3203('0x1d')](_0x52326c['query'][_0x3203('0x1d')]);_0x36c87c[_0x3203('0x1b')]=qs[_0x3203('0x1b')](_0x52326c['query'][_0x3203('0x1b')]);}_0x36c87c[_0x3203('0x34')]=qs[_0x3203('0x35')](_0x52326c[_0x3203('0x2e')][_0x3203('0x35')]);_0x36c87c[_0x3203('0x36')]=qs[_0x3203('0x2f')](_[_0x3203('0x37')](_0x52326c['query'],_0x579fd5[_0x3203('0x2f')]),_0x295152);if(_0x52326c['query'][_0x3203('0x38')]){_0x36c87c[_0x3203('0x36')]=_[_0x3203('0x39')](_0x36c87c[_0x3203('0x36')],{'$or':_[_0x3203('0x28')](_0x295152,function(_0x29e843){if(_0x29e843[_0x3203('0x2b')]!=='VIRTUAL'){var _0x3e6337={};_0x3e6337[_0x29e843[_0x3203('0x26')]]={'$like':'%'+_0x52326c[_0x3203('0x2e')][_0x3203('0x38')]+'%'};return _0x3e6337;}})});}_0x36c87c=_[_0x3203('0x39')]({},_0x36c87c,_0x52326c['options']);var _0x55b69b={'where':_0x36c87c[_0x3203('0x36')]};return db[_0x3203('0x29')][_0x3203('0x1e')](_0x55b69b)[_0x3203('0x24')](function(_0x118b37){_0x1c7429[_0x3203('0x1e')]=_0x118b37;if(_0x52326c[_0x3203('0x2e')][_0x3203('0x3a')]){_0x36c87c[_0x3203('0x3b')]=[{'all':!![]}];}return db[_0x3203('0x29')][_0x3203('0x3c')](_0x36c87c);})[_0x3203('0x24')](function(_0x52aa5c){_0x1c7429['rows']=_0x52aa5c;return _0x1c7429;})[_0x3203('0x24')](respondWithFilteredResult(_0x5a28cd,_0x36c87c))[_0x3203('0x3d')](handleError(_0x5a28cd,null));};exports['show']=function(_0x44b19f,_0x5e1a10){var _0x2a5a9d={'raw':!![],'where':{'id':_0x44b19f[_0x3203('0x3e')]['id']}},_0x38dd95={};_0x38dd95[_0x3203('0x2d')]=_['keys'](db[_0x3203('0x29')][_0x3203('0x2a')]);_0x38dd95['query']=_[_0x3203('0x3f')](_0x44b19f['query']);_0x38dd95[_0x3203('0x2f')]=_[_0x3203('0x30')](_0x38dd95[_0x3203('0x2d')],_0x38dd95[_0x3203('0x2e')]);_0x2a5a9d[_0x3203('0x31')]=_['intersection'](_0x38dd95[_0x3203('0x2d')],qs[_0x3203('0x32')](_0x44b19f[_0x3203('0x2e')]['fields']));_0x2a5a9d[_0x3203('0x31')]=_0x2a5a9d[_0x3203('0x31')][_0x3203('0x33')]?_0x2a5a9d[_0x3203('0x31')]:_0x38dd95[_0x3203('0x2d')];if(_0x44b19f[_0x3203('0x2e')][_0x3203('0x3a')]){_0x2a5a9d[_0x3203('0x3b')]=[{'all':!![]}];}_0x2a5a9d=_[_0x3203('0x39')]({},_0x2a5a9d,_0x44b19f[_0x3203('0x40')]);return db[_0x3203('0x29')][_0x3203('0x41')](_0x2a5a9d)[_0x3203('0x24')](handleEntityNotFound(_0x5e1a10,null))[_0x3203('0x24')](respondWithResult(_0x5e1a10,null))[_0x3203('0x3d')](handleError(_0x5e1a10,null));};exports['create']=function(_0x499e5c,_0x29af03){return db[_0x3203('0x29')][_0x3203('0x42')](_0x499e5c['body'],{})[_0x3203('0x24')](respondWithResult(_0x29af03,0xc9))[_0x3203('0x3d')](handleError(_0x29af03,null));};exports[_0x3203('0x23')]=function(_0x24260a,_0x4b5d5e){if(_0x24260a['body']['id']){delete _0x24260a['body']['id'];}return db[_0x3203('0x29')][_0x3203('0x41')]({'where':{'id':_0x24260a[_0x3203('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4b5d5e,null))[_0x3203('0x24')](saveUpdates(_0x24260a[_0x3203('0x43')],null))[_0x3203('0x24')](respondWithResult(_0x4b5d5e,null))[_0x3203('0x3d')](handleError(_0x4b5d5e,null));};exports['destroy']=function(_0x317809,_0x3ea040){return db[_0x3203('0x29')][_0x3203('0x41')]({'where':{'id':_0x317809[_0x3203('0x3e')]['id']}})[_0x3203('0x24')](handleEntityNotFound(_0x3ea040,null))[_0x3203('0x24')](removeEntity(_0x3ea040,null))['catch'](handleError(_0x3ea040,null));};exports['describe']=function(_0x145f46,_0x3e1769){return db['OpenchannelQueueReport']['describe']()[_0x3203('0x24')](respondWithResult(_0x3e1769,null))[_0x3203('0x3d')](handleError(_0x3e1769,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6ef6959..7967d51 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x264373,_0xcf0e17){var _0xece0b4=function(_0xba6f2a){while(--_0xba6f2a){_0x264373['push'](_0x264373['shift']());}};_0xece0b4(++_0xcf0e17);}(_0x2ef3,0xba));var _0x32ef=function(_0x43cbdf,_0x3ab339){_0x43cbdf=_0x43cbdf-0x0;var _0x3d1638=_0x2ef3[_0x43cbdf];return _0x3d1638;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0x2ef3,0xba));var _0x32ef=function(_0x47f695,_0x5b40b4){_0x47f695=_0x47f695-0x0;var _0x42cf38=_0x2ef3[_0x47f695];return _0x42cf38;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d2f02dd..12524df 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 _0xd237=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','stringify','update','options','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xd237,0x14f));var _0x7d23=function(_0x411d5a,_0x21411b){_0x411d5a=_0x411d5a-0x0;var _0x4c97b1=_0xd237[_0x411d5a];return _0x4c97b1;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});}exports[_0x7d23('0x17')]=function(_0x506a3b){var _0x313471=this;return new Promise(function(_0x3d6a7b,_0x49ce32){return db[_0x7d23('0x18')][_0x7d23('0x19')](_0x506a3b[_0x7d23('0x1a')],{'raw':_0x506a3b['options']?_0x506a3b['options'][_0x7d23('0x1b')]===undefined?!![]:![]:!![]})[_0x7d23('0xc')](function(_0x56b0ba){logger[_0x7d23('0xd')]('CreateOpenchannelQueueReport',_0x506a3b);logger[_0x7d23('0xf')]('CreateOpenchannelQueueReport',_0x506a3b,JSON[_0x7d23('0x1c')](_0x56b0ba));_0x3d6a7b(_0x56b0ba);})[_0x7d23('0x16')](function(_0x59522b){logger[_0x7d23('0x12')](_0x7d23('0x17'),_0x59522b[_0x7d23('0x14')],_0x506a3b);_0x49ce32(_0x313471['error'](0x1f4,_0x59522b[_0x7d23('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2e6d9f){var _0x354b2a=this;return new Promise(function(_0x1c007a,_0x3a5d87){return db[_0x7d23('0x18')][_0x7d23('0x1d')](_0x2e6d9f[_0x7d23('0x1a')],{'raw':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f[_0x7d23('0x1e')][_0x7d23('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f['options'][_0x7d23('0x1f')]||null:null,'attributes':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f[_0x7d23('0x1e')][_0x7d23('0x20')]||null:null,'limit':_0x2e6d9f[_0x7d23('0x1e')]?_0x2e6d9f[_0x7d23('0x1e')][_0x7d23('0x21')]||null:null})[_0x7d23('0xc')](function(_0x4808f2){logger[_0x7d23('0xd')](_0x7d23('0x22'),_0x2e6d9f);logger['debug'](_0x7d23('0x22'),_0x2e6d9f,JSON[_0x7d23('0x1c')](_0x4808f2));_0x1c007a(_0x4808f2);})[_0x7d23('0x16')](function(_0x4b1c92){logger[_0x7d23('0x12')](_0x7d23('0x22'),_0x4b1c92[_0x7d23('0x14')],_0x2e6d9f);_0x3a5d87(_0x354b2a[_0x7d23('0x12')](0x1f4,_0x4b1c92[_0x7d23('0x14')]));});});}; \ No newline at end of file +var _0x056b=['CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','then','debug','update','body','where','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5784f8,_0xe8e660){var _0x26c731=function(_0x54ddfa){while(--_0x54ddfa){_0x5784f8['push'](_0x5784f8['shift']());}};_0x26c731(++_0xe8e660);}(_0x056b,0xb6));var _0xb056=function(_0x8d2a71,_0x13618e){_0x8d2a71=_0x8d2a71-0x0;var _0x36ba8c=_0x056b[_0x8d2a71];return _0x36ba8c;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});}exports[_0xb056('0x16')]=function(_0x311eb9){var _0x48e140=this;return new Promise(function(_0x29c77e,_0x4c57e6){return db[_0xb056('0x17')][_0xb056('0x18')](_0x311eb9['body'],{'raw':_0x311eb9[_0xb056('0x19')]?_0x311eb9['options'][_0xb056('0x1a')]===undefined?!![]:![]:!![]})[_0xb056('0x1b')](function(_0x457b54){logger[_0xb056('0xc')]('CreateOpenchannelQueueReport',_0x311eb9);logger[_0xb056('0x1c')]('CreateOpenchannelQueueReport',_0x311eb9,JSON[_0xb056('0x10')](_0x457b54));_0x29c77e(_0x457b54);})['catch'](function(_0x324ce6){logger[_0xb056('0x11')](_0xb056('0x16'),_0x324ce6[_0xb056('0x13')],_0x311eb9);_0x4c57e6(_0x48e140[_0xb056('0x11')](0x1f4,_0x324ce6[_0xb056('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1016da){var _0x18a3f2=this;return new Promise(function(_0x341544,_0x1bd6ac){return db['OpenchannelQueueReport'][_0xb056('0x1d')](_0x1016da[_0xb056('0x1e')],{'raw':_0x1016da['options']?_0x1016da[_0xb056('0x19')][_0xb056('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1016da[_0xb056('0x19')]?_0x1016da[_0xb056('0x19')][_0xb056('0x1f')]||null:null,'attributes':_0x1016da[_0xb056('0x19')]?_0x1016da[_0xb056('0x19')][_0xb056('0x20')]||null:null,'limit':_0x1016da['options']?_0x1016da[_0xb056('0x19')]['limit']||null:null})[_0xb056('0x1b')](function(_0x9c6f4a){logger[_0xb056('0xc')]('UpdateOpenchannelQueueReport',_0x1016da);logger[_0xb056('0x1c')](_0xb056('0x21'),_0x1016da,JSON['stringify'](_0x9c6f4a));_0x341544(_0x9c6f4a);})[_0xb056('0x15')](function(_0x43aa63){logger[_0xb056('0x11')](_0xb056('0x21'),_0x43aa63[_0xb056('0x13')],_0x1016da);_0x1bd6ac(_0x18a3f2['error'](0x1f4,_0x43aa63[_0xb056('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 83acc48..a041d51 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 _0x9d81=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0xff16ab,_0x1cf0f9){var _0x437648=function(_0x4567d6){while(--_0x4567d6){_0xff16ab['push'](_0xff16ab['shift']());}};_0x437648(++_0x1cf0f9);}(_0x9d81,0xc0));var _0x19d8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9d81[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x19d8('0x0'));var util=require(_0x19d8('0x1'));var path=require(_0x19d8('0x2'));var timeout=require(_0x19d8('0x3'));var express=require(_0x19d8('0x4'));var router=express[_0x19d8('0x5')]();var fs_extra=require(_0x19d8('0x6'));var auth=require(_0x19d8('0x7'));var interaction=require(_0x19d8('0x8'));var config=require(_0x19d8('0x9'));var controller=require(_0x19d8('0xa'));router[_0x19d8('0xb')]('/',auth[_0x19d8('0xc')](),controller[_0x19d8('0xd')]);router[_0x19d8('0xb')](_0x19d8('0xe'),auth[_0x19d8('0xc')](),controller[_0x19d8('0xf')]);router['get'](_0x19d8('0x10'),auth[_0x19d8('0xc')](),controller['show']);router[_0x19d8('0x11')]('/',auth[_0x19d8('0xc')](),controller[_0x19d8('0x12')]);router[_0x19d8('0x13')](_0x19d8('0x10'),auth[_0x19d8('0xc')](),controller[_0x19d8('0x14')]);router[_0x19d8('0x15')](_0x19d8('0x10'),auth[_0x19d8('0xc')](),controller[_0x19d8('0x16')]);module[_0x19d8('0x17')]=router; \ No newline at end of file +var _0x48cb=['show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x48cb,0x92));var _0xb48c=function(_0x407ebf,_0x2b47f5){_0x407ebf=_0x407ebf-0x0;var _0x29d7db=_0x48cb[_0x407ebf];return _0x29d7db;};'use strict';var multer=require('multer');var util=require(_0xb48c('0x0'));var path=require('path');var timeout=require(_0xb48c('0x1'));var express=require(_0xb48c('0x2'));var router=express[_0xb48c('0x3')]();var fs_extra=require(_0xb48c('0x4'));var auth=require(_0xb48c('0x5'));var interaction=require(_0xb48c('0x6'));var config=require(_0xb48c('0x7'));var controller=require(_0xb48c('0x8'));router[_0xb48c('0x9')]('/',auth[_0xb48c('0xa')](),controller[_0xb48c('0xb')]);router['get'](_0xb48c('0xc'),auth[_0xb48c('0xa')](),controller[_0xb48c('0xd')]);router['get'](_0xb48c('0xe'),auth[_0xb48c('0xa')](),controller[_0xb48c('0xf')]);router[_0xb48c('0x10')]('/',auth[_0xb48c('0xa')](),controller[_0xb48c('0x11')]);router[_0xb48c('0x12')]('/:id',auth[_0xb48c('0xa')](),controller[_0xb48c('0x13')]);router[_0xb48c('0x14')](_0xb48c('0xe'),auth[_0xb48c('0xa')](),controller[_0xb48c('0x15')]);module[_0xb48c('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a3acd63..dfea2ac 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xc72da6,_0x30e853){var _0x1275b8=function(_0x13b29a){while(--_0x13b29a){_0xc72da6['push'](_0xc72da6['shift']());}};_0x1275b8(++_0x30e853);}(_0xedd9,0xfc));var _0x9edd=function(_0x203a8e,_0x307806){_0x203a8e=_0x203a8e-0x0;var _0x35c998=_0xedd9[_0x203a8e];return _0x35c998;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1fc0d9,_0x1f2b63){var _0x5ef087=function(_0x3706b6){while(--_0x3706b6){_0x1fc0d9['push'](_0x1fc0d9['shift']());}};_0x5ef087(++_0x1f2b63);}(_0x70e0,0x17b));var _0x070e=function(_0x21e42a,_0x5ab66d){_0x21e42a=_0x21e42a-0x0;var _0x46a34f=_0x70e0[_0x21e42a];return _0x46a34f;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4fa3b16..787a4dd 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 _0x2036=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','then','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x2036,0x8c));var _0x6203=function(_0x4821d4,_0x40758d){_0x4821d4=_0x4821d4-0x0;var _0x5e2abc=_0x2036[_0x4821d4];return _0x5e2abc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6203('0x0'));var zipdir=require(_0x6203('0x1'));var jsonpatch=require(_0x6203('0x2'));var rp=require(_0x6203('0x3'));var moment=require('moment');var BPromise=require(_0x6203('0x4'));var Mustache=require(_0x6203('0x5'));var util=require(_0x6203('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6203('0x7'));var fs=require('fs');var fs_extra=require(_0x6203('0x8'));var _=require('lodash');var squel=require(_0x6203('0x9'));var crypto=require(_0x6203('0xa'));var jsforce=require(_0x6203('0xb'));var deskjs=require(_0x6203('0xc'));var toCsv=require(_0x6203('0xd'));var querystring=require(_0x6203('0xe'));var Papa=require(_0x6203('0xf'));var Redis=require(_0x6203('0x10'));var authService=require(_0x6203('0x11'));var qs=require(_0x6203('0x12'));var as=require(_0x6203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6203('0x14'))(_0x6203('0x15'));var utils=require(_0x6203('0x16'));var config=require(_0x6203('0x17'));var licenseUtil=require(_0x6203('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bdc7f,_0x58fa9f){_0x58fa9f=_0x58fa9f||0xcc;return function(_0x52ae78){if(_0x52ae78){return _0x4bdc7f[_0x6203('0x19')](_0x58fa9f);}return _0x4bdc7f[_0x6203('0x1a')](_0x58fa9f)['end']();};}function respondWithResult(_0x2b3dc9,_0x2b3074){_0x2b3074=_0x2b3074||0xc8;return function(_0x43a4ff){if(_0x43a4ff){return _0x2b3dc9[_0x6203('0x1a')](_0x2b3074)[_0x6203('0x1b')](_0x43a4ff);}};}function respondWithFilteredResult(_0x301d27,_0x105c2a){return function(_0x16c6df){if(_0x16c6df){var _0x52255c=typeof _0x105c2a['offset']==='undefined'&&typeof _0x105c2a[_0x6203('0x1c')]===_0x6203('0x1d');var _0x1a4977=_0x16c6df[_0x6203('0x1e')];var _0x2abf45=_0x52255c?0x0:_0x105c2a[_0x6203('0x1f')];var _0x358765=_0x52255c?_0x16c6df[_0x6203('0x1e')]:_0x105c2a[_0x6203('0x1f')]+_0x105c2a['limit'];var _0x263392;if(_0x358765>=_0x1a4977){_0x358765=_0x1a4977;_0x263392=0xc8;}else{_0x263392=0xce;}_0x301d27['status'](_0x263392);return _0x301d27[_0x6203('0x20')](_0x6203('0x21'),_0x2abf45+'-'+_0x358765+'/'+_0x1a4977)[_0x6203('0x1b')](_0x16c6df);}return null;};}function patchUpdates(_0x110fa1){return function(_0x3d6286){try{jsonpatch[_0x6203('0x22')](_0x3d6286,_0x110fa1,!![]);}catch(_0xc15a65){return BPromise[_0x6203('0x23')](_0xc15a65);}return _0x3d6286[_0x6203('0x24')]();};}function saveUpdates(_0x25cb39,_0x1a54e9){return function(_0x3b0cef){if(_0x3b0cef){return _0x3b0cef['update'](_0x25cb39)['then'](function(_0x4fc463){return _0x4fc463;});}return null;};}function removeEntity(_0x577bf9,_0x32ba79){return function(_0x301fec){if(_0x301fec){return _0x301fec[_0x6203('0x25')]()['then'](function(){_0x577bf9[_0x6203('0x1a')](0xcc)[_0x6203('0x26')]();});}};}function handleEntityNotFound(_0x67fb5f,_0x3e8e99){return function(_0x3790ea){if(!_0x3790ea){_0x67fb5f[_0x6203('0x19')](0x194);}return _0x3790ea;};}function handleError(_0x2d814a,_0xf090d8){_0xf090d8=_0xf090d8||0x1f4;return function(_0x19cb5a){logger[_0x6203('0x27')](_0x19cb5a[_0x6203('0x28')]);if(_0x19cb5a['name']){delete _0x19cb5a[_0x6203('0x29')];}_0x2d814a['status'](_0xf090d8)[_0x6203('0x2a')](_0x19cb5a);};}exports[_0x6203('0x2b')]=function(_0x6f67b4,_0x121c33){var _0x24c679={},_0x55c384={},_0x41a168={'count':0x0,'rows':[]};var _0x44d07a=_[_0x6203('0x2c')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x11d232){return{'name':_0x11d232[_0x6203('0x2d')],'type':_0x11d232[_0x6203('0x2e')][_0x6203('0x2f')]};});_0x55c384[_0x6203('0x30')]=_[_0x6203('0x2c')](_0x44d07a,_0x6203('0x29'));_0x55c384['query']=_[_0x6203('0x31')](_0x6f67b4[_0x6203('0x32')]);_0x55c384[_0x6203('0x33')]=_[_0x6203('0x34')](_0x55c384['model'],_0x55c384[_0x6203('0x32')]);_0x24c679[_0x6203('0x35')]=_['intersection'](_0x55c384[_0x6203('0x30')],qs['fields'](_0x6f67b4[_0x6203('0x32')]['fields']));_0x24c679[_0x6203('0x35')]=_0x24c679[_0x6203('0x35')][_0x6203('0x36')]?_0x24c679[_0x6203('0x35')]:_0x55c384[_0x6203('0x30')];if(!_0x6f67b4['query'][_0x6203('0x37')](_0x6203('0x38'))){_0x24c679[_0x6203('0x1c')]=qs['limit'](_0x6f67b4[_0x6203('0x32')][_0x6203('0x1c')]);_0x24c679[_0x6203('0x1f')]=qs[_0x6203('0x1f')](_0x6f67b4[_0x6203('0x32')][_0x6203('0x1f')]);}_0x24c679[_0x6203('0x39')]=qs[_0x6203('0x3a')](_0x6f67b4['query'][_0x6203('0x3a')]);_0x24c679[_0x6203('0x3b')]=qs[_0x6203('0x33')](_[_0x6203('0x3c')](_0x6f67b4[_0x6203('0x32')],_0x55c384[_0x6203('0x33')]),_0x44d07a);if(_0x6f67b4[_0x6203('0x32')][_0x6203('0x3d')]){_0x24c679[_0x6203('0x3b')]=_[_0x6203('0x3e')](_0x24c679[_0x6203('0x3b')],{'$or':_[_0x6203('0x2c')](_0x44d07a,function(_0x257503){if(_0x257503[_0x6203('0x2e')]!==_0x6203('0x3f')){var _0x1b7964={};_0x1b7964[_0x257503[_0x6203('0x29')]]={'$like':'%'+_0x6f67b4[_0x6203('0x32')][_0x6203('0x3d')]+'%'};return _0x1b7964;}})});}_0x24c679=_[_0x6203('0x3e')]({},_0x24c679,_0x6f67b4[_0x6203('0x40')]);var _0x23ca74={'where':_0x24c679[_0x6203('0x3b')]};return db[_0x6203('0x41')][_0x6203('0x1e')](_0x23ca74)[_0x6203('0x42')](function(_0x1a6907){_0x41a168[_0x6203('0x1e')]=_0x1a6907;if(_0x6f67b4[_0x6203('0x32')]['includeAll']){_0x24c679['include']=[{'all':!![]}];}return db[_0x6203('0x41')][_0x6203('0x43')](_0x24c679);})[_0x6203('0x42')](function(_0x18ecbf){_0x41a168[_0x6203('0x44')]=_0x18ecbf;return _0x41a168;})[_0x6203('0x42')](respondWithFilteredResult(_0x121c33,_0x24c679))[_0x6203('0x45')](handleError(_0x121c33,null));};exports[_0x6203('0x46')]=function(_0x1a0cb3,_0x3414a5){var _0x1748ef={'raw':!![],'where':{'id':_0x1a0cb3[_0x6203('0x47')]['id']}},_0x54f48c={};_0x54f48c[_0x6203('0x30')]=_[_0x6203('0x31')](db[_0x6203('0x41')][_0x6203('0x48')]);_0x54f48c['query']=_[_0x6203('0x31')](_0x1a0cb3[_0x6203('0x32')]);_0x54f48c[_0x6203('0x33')]=_[_0x6203('0x34')](_0x54f48c[_0x6203('0x30')],_0x54f48c[_0x6203('0x32')]);_0x1748ef['attributes']=_[_0x6203('0x34')](_0x54f48c[_0x6203('0x30')],qs['fields'](_0x1a0cb3['query'][_0x6203('0x49')]));_0x1748ef['attributes']=_0x1748ef[_0x6203('0x35')][_0x6203('0x36')]?_0x1748ef[_0x6203('0x35')]:_0x54f48c['model'];if(_0x1a0cb3['query'][_0x6203('0x4a')]){_0x1748ef[_0x6203('0x4b')]=[{'all':!![]}];}_0x1748ef=_[_0x6203('0x3e')]({},_0x1748ef,_0x1a0cb3[_0x6203('0x40')]);return db[_0x6203('0x41')][_0x6203('0x4c')](_0x1748ef)[_0x6203('0x42')](handleEntityNotFound(_0x3414a5,null))['then'](respondWithResult(_0x3414a5,null))[_0x6203('0x45')](handleError(_0x3414a5,null));};exports[_0x6203('0x4d')]=function(_0x155a99,_0x5ed814){return db[_0x6203('0x41')][_0x6203('0x4d')](_0x155a99[_0x6203('0x4e')],{})[_0x6203('0x42')](respondWithResult(_0x5ed814,0xc9))['catch'](handleError(_0x5ed814,null));};exports[_0x6203('0x4f')]=function(_0x5e17b3,_0x5e4b83){if(_0x5e17b3[_0x6203('0x4e')]['id']){delete _0x5e17b3[_0x6203('0x4e')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5e17b3[_0x6203('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e4b83,null))[_0x6203('0x42')](saveUpdates(_0x5e17b3[_0x6203('0x4e')],null))[_0x6203('0x42')](respondWithResult(_0x5e4b83,null))[_0x6203('0x45')](handleError(_0x5e4b83,null));};exports[_0x6203('0x25')]=function(_0x5e6035,_0x5f03d5){return db[_0x6203('0x41')][_0x6203('0x4c')]({'where':{'id':_0x5e6035['params']['id']}})['then'](handleEntityNotFound(_0x5f03d5,null))[_0x6203('0x42')](removeEntity(_0x5f03d5,null))['catch'](handleError(_0x5f03d5,null));};exports['describe']=function(_0xe42e2e,_0x193594){return db[_0x6203('0x41')][_0x6203('0x50')]()[_0x6203('0x42')](respondWithResult(_0x193594,null))['catch'](handleError(_0x193594,null));}; \ No newline at end of file +var _0x9695=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','find','describe','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','reject','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','type','key'];(function(_0x174caf,_0xae1c98){var _0x19ed15=function(_0x46b844){while(--_0x46b844){_0x174caf['push'](_0x174caf['shift']());}};_0x19ed15(++_0xae1c98);}(_0x9695,0x139));var _0x5969=function(_0x425756,_0x46ac8b){_0x425756=_0x425756-0x0;var _0x53e534=_0x9695[_0x425756];return _0x53e534;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5969('0x0'));var moment=require(_0x5969('0x1'));var BPromise=require(_0x5969('0x2'));var Mustache=require(_0x5969('0x3'));var util=require(_0x5969('0x4'));var path=require(_0x5969('0x5'));var sox=require(_0x5969('0x6'));var csv=require(_0x5969('0x7'));var ejs=require(_0x5969('0x8'));var fs=require('fs');var fs_extra=require(_0x5969('0x9'));var _=require('lodash');var squel=require(_0x5969('0xa'));var crypto=require(_0x5969('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5969('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5969('0xd'));var Papa=require(_0x5969('0xe'));var Redis=require(_0x5969('0xf'));var authService=require(_0x5969('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5969('0x11'));var hardwareService=require(_0x5969('0x12'));var logger=require(_0x5969('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5969('0x14'));var db=require(_0x5969('0x15'))['db'];function respondWithStatusCode(_0x299734,_0xba16f8){_0xba16f8=_0xba16f8||0xcc;return function(_0x7afe58){if(_0x7afe58){return _0x299734[_0x5969('0x16')](_0xba16f8);}return _0x299734[_0x5969('0x17')](_0xba16f8)[_0x5969('0x18')]();};}function respondWithResult(_0x53132f,_0x311e7f){_0x311e7f=_0x311e7f||0xc8;return function(_0x2de56d){if(_0x2de56d){return _0x53132f[_0x5969('0x17')](_0x311e7f)[_0x5969('0x19')](_0x2de56d);}};}function respondWithFilteredResult(_0x682259,_0x52424b){return function(_0x21a1fa){if(_0x21a1fa){var _0x1dca07=typeof _0x52424b[_0x5969('0x1a')]===_0x5969('0x1b')&&typeof _0x52424b['limit']===_0x5969('0x1b');var _0x2f5d85=_0x21a1fa[_0x5969('0x1c')];var _0x1fdd77=_0x1dca07?0x0:_0x52424b[_0x5969('0x1a')];var _0x2b6db3=_0x1dca07?_0x21a1fa['count']:_0x52424b[_0x5969('0x1a')]+_0x52424b['limit'];var _0x167ff7;if(_0x2b6db3>=_0x2f5d85){_0x2b6db3=_0x2f5d85;_0x167ff7=0xc8;}else{_0x167ff7=0xce;}_0x682259[_0x5969('0x17')](_0x167ff7);return _0x682259[_0x5969('0x1d')]('Content-Range',_0x1fdd77+'-'+_0x2b6db3+'/'+_0x2f5d85)[_0x5969('0x19')](_0x21a1fa);}return null;};}function patchUpdates(_0x4639d5){return function(_0x504c74){try{jsonpatch['apply'](_0x504c74,_0x4639d5,!![]);}catch(_0x170c2d){return BPromise[_0x5969('0x1e')](_0x170c2d);}return _0x504c74['save']();};}function saveUpdates(_0x162035,_0x5ccc00){return function(_0x2a400b){if(_0x2a400b){return _0x2a400b[_0x5969('0x1f')](_0x162035)[_0x5969('0x20')](function(_0x557d6d){return _0x557d6d;});}return null;};}function removeEntity(_0x4d0513,_0x2f7c9c){return function(_0x2c94f7){if(_0x2c94f7){return _0x2c94f7[_0x5969('0x21')]()[_0x5969('0x20')](function(){_0x4d0513[_0x5969('0x17')](0xcc)[_0x5969('0x18')]();});}};}function handleEntityNotFound(_0x31dabe,_0xf95d1){return function(_0x5037cb){if(!_0x5037cb){_0x31dabe[_0x5969('0x16')](0x194);}return _0x5037cb;};}function handleError(_0x2a9c18,_0x423075){_0x423075=_0x423075||0x1f4;return function(_0x6ae2c6){logger[_0x5969('0x22')](_0x6ae2c6[_0x5969('0x23')]);if(_0x6ae2c6[_0x5969('0x24')]){delete _0x6ae2c6[_0x5969('0x24')];}_0x2a9c18['status'](_0x423075)[_0x5969('0x25')](_0x6ae2c6);};}exports[_0x5969('0x26')]=function(_0xc3020f,_0x561e10){var _0x3e9645={},_0x58ace2={},_0x13ed8e={'count':0x0,'rows':[]};var _0x153c69=_['map'](db[_0x5969('0x27')]['rawAttributes'],function(_0x4bf89e){return{'name':_0x4bf89e['fieldName'],'type':_0x4bf89e[_0x5969('0x28')][_0x5969('0x29')]};});_0x58ace2[_0x5969('0x2a')]=_[_0x5969('0x2b')](_0x153c69,_0x5969('0x24'));_0x58ace2[_0x5969('0x2c')]=_[_0x5969('0x2d')](_0xc3020f[_0x5969('0x2c')]);_0x58ace2[_0x5969('0x2e')]=_[_0x5969('0x2f')](_0x58ace2[_0x5969('0x2a')],_0x58ace2['query']);_0x3e9645[_0x5969('0x30')]=_[_0x5969('0x2f')](_0x58ace2[_0x5969('0x2a')],qs[_0x5969('0x31')](_0xc3020f[_0x5969('0x2c')][_0x5969('0x31')]));_0x3e9645[_0x5969('0x30')]=_0x3e9645[_0x5969('0x30')][_0x5969('0x32')]?_0x3e9645[_0x5969('0x30')]:_0x58ace2[_0x5969('0x2a')];if(!_0xc3020f[_0x5969('0x2c')][_0x5969('0x33')](_0x5969('0x34'))){_0x3e9645[_0x5969('0x35')]=qs[_0x5969('0x35')](_0xc3020f[_0x5969('0x2c')][_0x5969('0x35')]);_0x3e9645[_0x5969('0x1a')]=qs['offset'](_0xc3020f[_0x5969('0x2c')][_0x5969('0x1a')]);}_0x3e9645['order']=qs[_0x5969('0x36')](_0xc3020f[_0x5969('0x2c')][_0x5969('0x36')]);_0x3e9645[_0x5969('0x37')]=qs['filters'](_[_0x5969('0x38')](_0xc3020f[_0x5969('0x2c')],_0x58ace2[_0x5969('0x2e')]),_0x153c69);if(_0xc3020f[_0x5969('0x2c')][_0x5969('0x39')]){_0x3e9645['where']=_[_0x5969('0x3a')](_0x3e9645[_0x5969('0x37')],{'$or':_['map'](_0x153c69,function(_0x4d1e27){if(_0x4d1e27['type']!==_0x5969('0x3b')){var _0xcc1400={};_0xcc1400[_0x4d1e27[_0x5969('0x24')]]={'$like':'%'+_0xc3020f['query'][_0x5969('0x39')]+'%'};return _0xcc1400;}})});}_0x3e9645=_[_0x5969('0x3a')]({},_0x3e9645,_0xc3020f[_0x5969('0x3c')]);var _0x500e3c={'where':_0x3e9645['where']};return db['OpenchannelTransferReport'][_0x5969('0x1c')](_0x500e3c)[_0x5969('0x20')](function(_0x2c18eb){_0x13ed8e[_0x5969('0x1c')]=_0x2c18eb;if(_0xc3020f['query'][_0x5969('0x3d')]){_0x3e9645[_0x5969('0x3e')]=[{'all':!![]}];}return db[_0x5969('0x27')][_0x5969('0x3f')](_0x3e9645);})[_0x5969('0x20')](function(_0x58c8c7){_0x13ed8e['rows']=_0x58c8c7;return _0x13ed8e;})[_0x5969('0x20')](respondWithFilteredResult(_0x561e10,_0x3e9645))[_0x5969('0x40')](handleError(_0x561e10,null));};exports['show']=function(_0x5c13c0,_0x526f83){var _0x3031f7={'raw':!![],'where':{'id':_0x5c13c0[_0x5969('0x41')]['id']}},_0x326dc7={};_0x326dc7[_0x5969('0x2a')]=_[_0x5969('0x2d')](db[_0x5969('0x27')][_0x5969('0x42')]);_0x326dc7['query']=_['keys'](_0x5c13c0['query']);_0x326dc7[_0x5969('0x2e')]=_[_0x5969('0x2f')](_0x326dc7[_0x5969('0x2a')],_0x326dc7['query']);_0x3031f7[_0x5969('0x30')]=_[_0x5969('0x2f')](_0x326dc7[_0x5969('0x2a')],qs['fields'](_0x5c13c0[_0x5969('0x2c')]['fields']));_0x3031f7['attributes']=_0x3031f7[_0x5969('0x30')][_0x5969('0x32')]?_0x3031f7[_0x5969('0x30')]:_0x326dc7[_0x5969('0x2a')];if(_0x5c13c0[_0x5969('0x2c')][_0x5969('0x3d')]){_0x3031f7[_0x5969('0x3e')]=[{'all':!![]}];}_0x3031f7=_[_0x5969('0x3a')]({},_0x3031f7,_0x5c13c0['options']);return db[_0x5969('0x27')]['find'](_0x3031f7)[_0x5969('0x20')](handleEntityNotFound(_0x526f83,null))[_0x5969('0x20')](respondWithResult(_0x526f83,null))[_0x5969('0x40')](handleError(_0x526f83,null));};exports[_0x5969('0x43')]=function(_0x209086,_0x12526b){return db[_0x5969('0x27')]['create'](_0x209086[_0x5969('0x44')],{})[_0x5969('0x20')](respondWithResult(_0x12526b,0xc9))[_0x5969('0x40')](handleError(_0x12526b,null));};exports[_0x5969('0x1f')]=function(_0x3c3a3e,_0x1d51fa){if(_0x3c3a3e[_0x5969('0x44')]['id']){delete _0x3c3a3e[_0x5969('0x44')]['id'];}return db[_0x5969('0x27')][_0x5969('0x45')]({'where':{'id':_0x3c3a3e[_0x5969('0x41')]['id']}})[_0x5969('0x20')](handleEntityNotFound(_0x1d51fa,null))[_0x5969('0x20')](saveUpdates(_0x3c3a3e[_0x5969('0x44')],null))[_0x5969('0x20')](respondWithResult(_0x1d51fa,null))[_0x5969('0x40')](handleError(_0x1d51fa,null));};exports[_0x5969('0x21')]=function(_0x32db8e,_0xf85552){return db[_0x5969('0x27')][_0x5969('0x45')]({'where':{'id':_0x32db8e[_0x5969('0x41')]['id']}})['then'](handleEntityNotFound(_0xf85552,null))[_0x5969('0x20')](removeEntity(_0xf85552,null))['catch'](handleError(_0xf85552,null));};exports[_0x5969('0x46')]=function(_0x4b20d4,_0x5c0380){return db[_0x5969('0x27')][_0x5969('0x46')]()[_0x5969('0x20')](respondWithResult(_0x5c0380,null))[_0x5969('0x40')](handleError(_0x5c0380,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d8d1a31..4f712ff 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 _0x3e2d=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x15af2f,_0x3c0a01){var _0x359239=function(_0x20da30){while(--_0x20da30){_0x15af2f['push'](_0x15af2f['shift']());}};_0x359239(++_0x3c0a01);}(_0x3e2d,0xf6));var _0xd3e2=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3e2d[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xd3e2('0x0'));var util=require(_0xd3e2('0x1'));var logger=require(_0xd3e2('0x2'))(_0xd3e2('0x3'));var moment=require(_0xd3e2('0x4'));var BPromise=require(_0xd3e2('0x5'));var rp=require(_0xd3e2('0x6'));var fs=require('fs');var path=require(_0xd3e2('0x7'));var rimraf=require('rimraf');var config=require(_0xd3e2('0x8'));var attributes=require(_0xd3e2('0x9'));module[_0xd3e2('0xa')]=function(_0x1d60b0,_0x2346fc){return _0x1d60b0[_0xd3e2('0xb')](_0xd3e2('0xc'),attributes,{'tableName':_0xd3e2('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd3e2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce21=['api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x1e4fed,_0x1d918a){var _0x3e3438=function(_0x233684){while(--_0x233684){_0x1e4fed['push'](_0x1e4fed['shift']());}};_0x3e3438(++_0x1d918a);}(_0xce21,0x1e7));var _0x1ce2=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0xce21[_0x4404ff];return _0x5e7b19;};'use strict';var _=require(_0x1ce2('0x0'));var util=require(_0x1ce2('0x1'));var logger=require(_0x1ce2('0x2'))(_0x1ce2('0x3'));var moment=require(_0x1ce2('0x4'));var BPromise=require(_0x1ce2('0x5'));var rp=require(_0x1ce2('0x6'));var fs=require('fs');var path=require(_0x1ce2('0x7'));var rimraf=require(_0x1ce2('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ce2('0x9'));module[_0x1ce2('0xa')]=function(_0x4f3a74,_0x5ee49f){return _0x4f3a74[_0x1ce2('0xb')](_0x1ce2('0xc'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x1ce2('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2cda2ce..c872167 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 _0xdc59=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f41ca,_0x3346b3){var _0xeaeb6=function(_0x2f3f5f){while(--_0x2f3f5f){_0x5f41ca['push'](_0x5f41ca['shift']());}};_0xeaeb6(++_0x3346b3);}(_0xdc59,0x12c));var _0x9dc5=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xdc59[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var moment=require(_0x9dc5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc5('0x3'));var db=require(_0x9dc5('0x4'))['db'];var utils=require(_0x9dc5('0x5'));var logger=require(_0x9dc5('0x6'))(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var jayson=require(_0x9dc5('0x9'));var client=jayson[_0x9dc5('0xa')][_0x9dc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48beee,_0x42941b,_0x10b268){return new BPromise(function(_0x202a8a,_0x3729b6){return client[_0x9dc5('0xc')](_0x48beee,_0x10b268)[_0x9dc5('0xd')](function(_0x174835){logger[_0x9dc5('0xe')](_0x9dc5('0xf'),_0x42941b,_0x9dc5('0x10'));logger['debug'](_0x9dc5('0x11'),_0x42941b,_0x9dc5('0x10'),JSON[_0x9dc5('0x12')](_0x174835));if(_0x174835[_0x9dc5('0x13')]){if(_0x174835['error'][_0x9dc5('0x14')]===0x1f4){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835['error'][_0x9dc5('0x15')]);return _0x3729b6(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);return _0x202a8a(_0x174835[_0x9dc5('0x13')][_0x9dc5('0x15')]);}else{logger[_0x9dc5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x42941b,_0x9dc5('0x10'));_0x202a8a(_0x174835['result'][_0x9dc5('0x15')]);}})[_0x9dc5('0x16')](function(_0x5a9ffb){logger[_0x9dc5('0x13')](_0x9dc5('0xf'),_0x42941b,_0x5a9ffb);_0x3729b6(_0x5a9ffb);});});} \ No newline at end of file +var _0x5a2a=['catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4573dd,_0x22088d){var _0x42ee7a=function(_0x6ee6f8){while(--_0x6ee6f8){_0x4573dd['push'](_0x4573dd['shift']());}};_0x42ee7a(++_0x22088d);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0xb62965,_0x553af1){_0xb62965=_0xb62965-0x0;var _0x5397fc=_0x5a2a[_0xb62965];return _0x5397fc;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var moment=require(_0xa5a2('0x2'));var BPromise=require(_0xa5a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa5a2('0x4'));var logger=require(_0xa5a2('0x5'))('rpc');var config=require(_0xa5a2('0x6'));var jayson=require(_0xa5a2('0x7'));var client=jayson[_0xa5a2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179722,_0x563461,_0x38a5fe){return new BPromise(function(_0x97f75c,_0x43e0d8){return client['request'](_0x179722,_0x38a5fe)['then'](function(_0x1227d7){logger[_0xa5a2('0x9')](_0xa5a2('0xa'),_0x563461,_0xa5a2('0xb'));logger[_0xa5a2('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x563461,_0xa5a2('0xb'),JSON[_0xa5a2('0xd')](_0x1227d7));if(_0x1227d7[_0xa5a2('0xe')]){if(_0x1227d7[_0xa5a2('0xe')][_0xa5a2('0xf')]===0x1f4){logger[_0xa5a2('0xe')](_0xa5a2('0xa'),_0x563461,_0x1227d7['error']['message']);return _0x43e0d8(_0x1227d7[_0xa5a2('0xe')][_0xa5a2('0x10')]);}logger[_0xa5a2('0xe')](_0xa5a2('0xa'),_0x563461,_0x1227d7[_0xa5a2('0xe')]['message']);return _0x97f75c(_0x1227d7[_0xa5a2('0xe')][_0xa5a2('0x10')]);}else{logger['info'](_0xa5a2('0xa'),_0x563461,_0xa5a2('0xb'));_0x97f75c(_0x1227d7['result'][_0xa5a2('0x10')]);}})[_0xa5a2('0x11')](function(_0x599599){logger[_0xa5a2('0xe')](_0xa5a2('0xa'),_0x563461,_0x599599);_0x43e0d8(_0x599599);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 88f5543..027d6c8 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 _0x4e65=['get','isAuthenticated','show','post','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x2dcdad,_0x1d2613){var _0x3f436a=function(_0x11e1c9){while(--_0x11e1c9){_0x2dcdad['push'](_0x2dcdad['shift']());}};_0x3f436a(++_0x1d2613);}(_0x4e65,0xc4));var _0x54e6=function(_0xb498f6,_0x31c8b8){_0xb498f6=_0xb498f6-0x0;var _0x378558=_0x4e65[_0xb498f6];return _0x378558;};'use strict';var multer=require('multer');var util=require(_0x54e6('0x0'));var path=require(_0x54e6('0x1'));var timeout=require(_0x54e6('0x2'));var express=require(_0x54e6('0x3'));var router=express[_0x54e6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x54e6('0x5'));var config=require(_0x54e6('0x6'));var controller=require(_0x54e6('0x7'));router[_0x54e6('0x8')]('/',auth[_0x54e6('0x9')](),controller['index']);router[_0x54e6('0x8')]('/:id',auth[_0x54e6('0x9')](),controller[_0x54e6('0xa')]);router[_0x54e6('0xb')]('/',auth[_0x54e6('0x9')](),controller['create']);router[_0x54e6('0xc')](_0x54e6('0xd'),auth[_0x54e6('0x9')](),controller[_0x54e6('0xe')]);router[_0x54e6('0xf')](_0x54e6('0xd'),auth['isAuthenticated'](),controller[_0x54e6('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8885=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x8885,0xe0));var _0x5888=function(_0x396dde,_0x393a65){_0x396dde=_0x396dde-0x0;var _0x3b5797=_0x8885[_0x396dde];return _0x3b5797;};'use strict';var multer=require(_0x5888('0x0'));var util=require(_0x5888('0x1'));var path=require(_0x5888('0x2'));var timeout=require('connect-timeout');var express=require(_0x5888('0x3'));var router=express['Router']();var fs_extra=require(_0x5888('0x4'));var auth=require(_0x5888('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5888('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0x5888('0x7')](),controller[_0x5888('0x8')]);router['get'](_0x5888('0x9'),auth[_0x5888('0x7')](),controller['show']);router[_0x5888('0xa')]('/',auth['isAuthenticated'](),controller[_0x5888('0xb')]);router[_0x5888('0xc')](_0x5888('0x9'),auth[_0x5888('0x7')](),controller[_0x5888('0xd')]);router[_0x5888('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5888('0xf')]);module[_0x5888('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 370c371..7e67c77 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 _0x7b98=['exports','STRING','sequelize'];(function(_0x22979c,_0x71b35e){var _0x4186d3=function(_0x103e63){while(--_0x103e63){_0x22979c['push'](_0x22979c['shift']());}};_0x4186d3(++_0x71b35e);}(_0x7b98,0xbf));var _0x87b9=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x7b98[_0x1daaa9];return _0x1dd221;};'use strict';var Sequelize=require(_0x87b9('0x0'));module[_0x87b9('0x1')]={'name':{'type':Sequelize[_0x87b9('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x87b9('0x2')]}}; \ No newline at end of file +var _0x2c3c=['exports','STRING','name','sequelize'];(function(_0x1ef2e3,_0x380ec2){var _0x173e11=function(_0x574cb9){while(--_0x574cb9){_0x1ef2e3['push'](_0x1ef2e3['shift']());}};_0x173e11(++_0x380ec2);}(_0x2c3c,0x1ab));var _0xc2c3=function(_0x98d59,_0x5596){_0x98d59=_0x98d59-0x0;var _0x271414=_0x2c3c[_0x98d59];return _0x271414;};'use strict';var Sequelize=require(_0xc2c3('0x0'));module[_0xc2c3('0x1')]={'name':{'type':Sequelize[_0xc2c3('0x2')],'unique':_0xc2c3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc2c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5e75ace..d2c169a 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 _0x0d80=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','update','then','destroy','get','Pauses','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x777909,_0x5f9b7b){var _0x3aac0b=function(_0x1daf10){while(--_0x1daf10){_0x777909['push'](_0x777909['shift']());}};_0x3aac0b(++_0x5f9b7b);}(_0x0d80,0x72));var _0x00d8=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x0d80[_0x3b7a0c];return _0x3bb70f;};'use strict';var emlformat=require(_0x00d8('0x0'));var rimraf=require(_0x00d8('0x1'));var zipdir=require(_0x00d8('0x2'));var jsonpatch=require(_0x00d8('0x3'));var rp=require('request-promise');var moment=require(_0x00d8('0x4'));var BPromise=require(_0x00d8('0x5'));var Mustache=require(_0x00d8('0x6'));var util=require(_0x00d8('0x7'));var path=require(_0x00d8('0x8'));var sox=require(_0x00d8('0x9'));var csv=require(_0x00d8('0xa'));var ejs=require(_0x00d8('0xb'));var fs=require('fs');var fs_extra=require(_0x00d8('0xc'));var _=require(_0x00d8('0xd'));var squel=require(_0x00d8('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x00d8('0xf'));var toCsv=require(_0x00d8('0xa'));var querystring=require(_0x00d8('0x10'));var Papa=require(_0x00d8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00d8('0x13'));var logger=require(_0x00d8('0x14'))(_0x00d8('0x15'));var utils=require(_0x00d8('0x16'));var config=require(_0x00d8('0x17'));var licenseUtil=require(_0x00d8('0x18'));var db=require(_0x00d8('0x19'))['db'];function respondWithStatusCode(_0x35355c,_0x2b8e3b){_0x2b8e3b=_0x2b8e3b||0xcc;return function(_0x3a2734){if(_0x3a2734){return _0x35355c[_0x00d8('0x1a')](_0x2b8e3b);}return _0x35355c[_0x00d8('0x1b')](_0x2b8e3b)[_0x00d8('0x1c')]();};}function respondWithResult(_0x3a797a,_0x51c1b9){_0x51c1b9=_0x51c1b9||0xc8;return function(_0x19f9d1){if(_0x19f9d1){return _0x3a797a[_0x00d8('0x1b')](_0x51c1b9)[_0x00d8('0x1d')](_0x19f9d1);}};}function respondWithFilteredResult(_0x3545e8,_0x96dcfc){return function(_0x239545){if(_0x239545){var _0x3c6f13=typeof _0x96dcfc[_0x00d8('0x1e')]==='undefined'&&typeof _0x96dcfc[_0x00d8('0x1f')]===_0x00d8('0x20');var _0x548fa7=_0x239545[_0x00d8('0x21')];var _0x53c47c=_0x3c6f13?0x0:_0x96dcfc[_0x00d8('0x1e')];var _0x18b896=_0x3c6f13?_0x239545[_0x00d8('0x21')]:_0x96dcfc[_0x00d8('0x1e')]+_0x96dcfc[_0x00d8('0x1f')];var _0x4a3e83;if(_0x18b896>=_0x548fa7){_0x18b896=_0x548fa7;_0x4a3e83=0xc8;}else{_0x4a3e83=0xce;}_0x3545e8['status'](_0x4a3e83);return _0x3545e8[_0x00d8('0x22')](_0x00d8('0x23'),_0x53c47c+'-'+_0x18b896+'/'+_0x548fa7)['json'](_0x239545);}return null;};}function patchUpdates(_0x56a83f){return function(_0x64552e){try{jsonpatch[_0x00d8('0x24')](_0x64552e,_0x56a83f,!![]);}catch(_0x523b43){return BPromise[_0x00d8('0x25')](_0x523b43);}return _0x64552e['save']();};}function saveUpdates(_0x1dcc0f,_0x56c93){return function(_0xf37435){if(_0xf37435){return _0xf37435[_0x00d8('0x26')](_0x1dcc0f)[_0x00d8('0x27')](function(_0x3bbe7b){return _0x3bbe7b;});}return null;};}function removeEntity(_0x242b1a,_0x1746f9){return function(_0xfd1f1e){if(_0xfd1f1e){return _0xfd1f1e[_0x00d8('0x28')]()[_0x00d8('0x27')](function(){var _0x307e59=_0xfd1f1e[_0x00d8('0x29')]({'plain':!![]});var _0xbe8c08=_0x00d8('0x2a');return db['UserProfileResource'][_0x00d8('0x28')]({'where':{'type':_0xbe8c08,'resourceId':_0x307e59['id']}})['then'](function(){return _0xfd1f1e;});})['then'](function(){_0x242b1a[_0x00d8('0x1b')](0xcc)[_0x00d8('0x1c')]();});}};}function handleEntityNotFound(_0x250f6f,_0x2ec2c3){return function(_0x2b72e2){if(!_0x2b72e2){_0x250f6f[_0x00d8('0x1a')](0x194);}return _0x2b72e2;};}function handleError(_0x31ad01,_0x172130){_0x172130=_0x172130||0x1f4;return function(_0xa89525){logger['error'](_0xa89525[_0x00d8('0x2b')]);if(_0xa89525[_0x00d8('0x2c')]){delete _0xa89525[_0x00d8('0x2c')];}_0x31ad01[_0x00d8('0x1b')](_0x172130)[_0x00d8('0x2d')](_0xa89525);};}exports[_0x00d8('0x2e')]=function(_0x390180,_0x189ef0){var _0x1c5742={},_0x447642={},_0x3dc4ed={'count':0x0,'rows':[]};var _0x21820f=_[_0x00d8('0x2f')](db['Pause'][_0x00d8('0x30')],function(_0x10f834){return{'name':_0x10f834[_0x00d8('0x31')],'type':_0x10f834[_0x00d8('0x32')][_0x00d8('0x33')]};});_0x447642[_0x00d8('0x34')]=_[_0x00d8('0x2f')](_0x21820f,'name');_0x447642[_0x00d8('0x35')]=_[_0x00d8('0x36')](_0x390180['query']);_0x447642[_0x00d8('0x37')]=_[_0x00d8('0x38')](_0x447642[_0x00d8('0x34')],_0x447642[_0x00d8('0x35')]);_0x1c5742[_0x00d8('0x39')]=_['intersection'](_0x447642[_0x00d8('0x34')],qs[_0x00d8('0x3a')](_0x390180['query']['fields']));_0x1c5742[_0x00d8('0x39')]=_0x1c5742['attributes'][_0x00d8('0x3b')]?_0x1c5742[_0x00d8('0x39')]:_0x447642[_0x00d8('0x34')];if(!_0x390180[_0x00d8('0x35')][_0x00d8('0x3c')]('nolimit')){_0x1c5742[_0x00d8('0x1f')]=qs['limit'](_0x390180['query'][_0x00d8('0x1f')]);_0x1c5742[_0x00d8('0x1e')]=qs[_0x00d8('0x1e')](_0x390180[_0x00d8('0x35')][_0x00d8('0x1e')]);}_0x1c5742[_0x00d8('0x3d')]=qs[_0x00d8('0x3e')](_0x390180[_0x00d8('0x35')][_0x00d8('0x3e')]);_0x1c5742[_0x00d8('0x3f')]=qs[_0x00d8('0x37')](_[_0x00d8('0x40')](_0x390180[_0x00d8('0x35')],_0x447642[_0x00d8('0x37')]),_0x21820f);if(_0x390180[_0x00d8('0x35')][_0x00d8('0x41')]){_0x1c5742[_0x00d8('0x3f')]=_[_0x00d8('0x42')](_0x1c5742[_0x00d8('0x3f')],{'$or':_['map'](_0x21820f,function(_0x41ff64){if(_0x41ff64[_0x00d8('0x32')]!==_0x00d8('0x43')){var _0x2a9a9b={};_0x2a9a9b[_0x41ff64[_0x00d8('0x2c')]]={'$like':'%'+_0x390180[_0x00d8('0x35')][_0x00d8('0x41')]+'%'};return _0x2a9a9b;}})});}_0x1c5742=_[_0x00d8('0x42')]({},_0x1c5742,_0x390180[_0x00d8('0x44')]);var _0x2c19d6={'where':_0x1c5742[_0x00d8('0x3f')]};return db[_0x00d8('0x45')][_0x00d8('0x21')](_0x2c19d6)['then'](function(_0x3f23ab){_0x3dc4ed[_0x00d8('0x21')]=_0x3f23ab;if(_0x390180['query'][_0x00d8('0x46')]){_0x1c5742[_0x00d8('0x47')]=[{'all':!![]}];}return db[_0x00d8('0x45')]['findAll'](_0x1c5742);})[_0x00d8('0x27')](function(_0x2671cc){_0x3dc4ed['rows']=_0x2671cc;return _0x3dc4ed;})[_0x00d8('0x27')](respondWithFilteredResult(_0x189ef0,_0x1c5742))[_0x00d8('0x48')](handleError(_0x189ef0,null));};exports[_0x00d8('0x49')]=function(_0x5c0b06,_0x4a0fa8){var _0x575b91={'raw':!![],'where':{'id':_0x5c0b06[_0x00d8('0x4a')]['id']}},_0x2636ef={};_0x2636ef[_0x00d8('0x34')]=_[_0x00d8('0x36')](db[_0x00d8('0x45')][_0x00d8('0x30')]);_0x2636ef['query']=_['keys'](_0x5c0b06[_0x00d8('0x35')]);_0x2636ef['filters']=_[_0x00d8('0x38')](_0x2636ef[_0x00d8('0x34')],_0x2636ef['query']);_0x575b91[_0x00d8('0x39')]=_['intersection'](_0x2636ef[_0x00d8('0x34')],qs[_0x00d8('0x3a')](_0x5c0b06['query'][_0x00d8('0x3a')]));_0x575b91[_0x00d8('0x39')]=_0x575b91[_0x00d8('0x39')]['length']?_0x575b91['attributes']:_0x2636ef[_0x00d8('0x34')];if(_0x5c0b06[_0x00d8('0x35')][_0x00d8('0x46')]){_0x575b91[_0x00d8('0x47')]=[{'all':!![]}];}_0x575b91=_[_0x00d8('0x42')]({},_0x575b91,_0x5c0b06[_0x00d8('0x44')]);return db[_0x00d8('0x45')][_0x00d8('0x4b')](_0x575b91)[_0x00d8('0x27')](handleEntityNotFound(_0x4a0fa8,null))[_0x00d8('0x27')](respondWithResult(_0x4a0fa8,null))[_0x00d8('0x48')](handleError(_0x4a0fa8,null));};exports[_0x00d8('0x4c')]=function(_0x87c2af,_0x3bd365){return db[_0x00d8('0x45')]['create'](_0x87c2af[_0x00d8('0x4d')],{})[_0x00d8('0x27')](function(_0x449740){var _0x23a2b5=_0x87c2af[_0x00d8('0x4e')][_0x00d8('0x29')]({'plain':!![]});if(!_0x23a2b5)throw new Error(_0x00d8('0x4f'));if(_0x23a2b5[_0x00d8('0x50')]===_0x00d8('0x4e')){var _0x1d8e1a=_0x449740[_0x00d8('0x29')]({'plain':!![]});var _0x45009e=_0x00d8('0x2a');return db[_0x00d8('0x51')][_0x00d8('0x4b')]({'where':{'name':_0x45009e,'userProfileId':_0x23a2b5[_0x00d8('0x52')]},'raw':!![]})[_0x00d8('0x27')](function(_0x2cd2eb){if(_0x2cd2eb&&_0x2cd2eb[_0x00d8('0x53')]===0x0){return db[_0x00d8('0x54')]['create']({'name':_0x1d8e1a[_0x00d8('0x2c')],'resourceId':_0x1d8e1a['id'],'type':_0x2cd2eb[_0x00d8('0x2c')],'sectionId':_0x2cd2eb['id']},{})['then'](function(){return _0x449740;});}else{return _0x449740;}})[_0x00d8('0x48')](function(_0x4fc47d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fc47d);throw _0x4fc47d;});}return _0x449740;})[_0x00d8('0x27')](respondWithResult(_0x3bd365,0xc9))[_0x00d8('0x48')](handleError(_0x3bd365,null));};exports[_0x00d8('0x26')]=function(_0x496b90,_0xd9efd5){if(_0x496b90[_0x00d8('0x4d')]['id']){delete _0x496b90[_0x00d8('0x4d')]['id'];}return db[_0x00d8('0x45')]['find']({'where':{'id':_0x496b90['params']['id']}})[_0x00d8('0x27')](handleEntityNotFound(_0xd9efd5,null))[_0x00d8('0x27')](saveUpdates(_0x496b90[_0x00d8('0x4d')],null))['then'](respondWithResult(_0xd9efd5,null))[_0x00d8('0x48')](handleError(_0xd9efd5,null));};exports[_0x00d8('0x28')]=function(_0x5739ac,_0x1a66b9){return db[_0x00d8('0x45')][_0x00d8('0x4b')]({'where':{'id':_0x5739ac[_0x00d8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a66b9,null))[_0x00d8('0x27')](removeEntity(_0x1a66b9,null))['catch'](handleError(_0x1a66b9,null));}; \ No newline at end of file +var _0x3df1=['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','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','Pauses','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x360c9b,_0x23a9e8){var _0x25d218=function(_0xc3c111){while(--_0xc3c111){_0x360c9b['push'](_0x360c9b['shift']());}};_0x25d218(++_0x23a9e8);}(_0x3df1,0xa5));var _0x13df=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3df1[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x13df('0x0'));var rimraf=require(_0x13df('0x1'));var zipdir=require(_0x13df('0x2'));var jsonpatch=require(_0x13df('0x3'));var rp=require(_0x13df('0x4'));var moment=require(_0x13df('0x5'));var BPromise=require(_0x13df('0x6'));var Mustache=require(_0x13df('0x7'));var util=require(_0x13df('0x8'));var path=require(_0x13df('0x9'));var sox=require(_0x13df('0xa'));var csv=require(_0x13df('0xb'));var ejs=require(_0x13df('0xc'));var fs=require('fs');var fs_extra=require(_0x13df('0xd'));var _=require('lodash');var squel=require(_0x13df('0xe'));var crypto=require(_0x13df('0xf'));var jsforce=require(_0x13df('0x10'));var deskjs=require(_0x13df('0x11'));var toCsv=require(_0x13df('0xb'));var querystring=require(_0x13df('0x12'));var Papa=require(_0x13df('0x13'));var Redis=require(_0x13df('0x14'));var authService=require(_0x13df('0x15'));var qs=require(_0x13df('0x16'));var as=require(_0x13df('0x17'));var hardwareService=require(_0x13df('0x18'));var logger=require(_0x13df('0x19'))(_0x13df('0x1a'));var utils=require(_0x13df('0x1b'));var config=require(_0x13df('0x1c'));var licenseUtil=require(_0x13df('0x1d'));var db=require(_0x13df('0x1e'))['db'];function respondWithStatusCode(_0x1ba513,_0x2f3afe){_0x2f3afe=_0x2f3afe||0xcc;return function(_0x3705ef){if(_0x3705ef){return _0x1ba513[_0x13df('0x1f')](_0x2f3afe);}return _0x1ba513[_0x13df('0x20')](_0x2f3afe)['end']();};}function respondWithResult(_0x2e4491,_0xd8e731){_0xd8e731=_0xd8e731||0xc8;return function(_0x115bf4){if(_0x115bf4){return _0x2e4491[_0x13df('0x20')](_0xd8e731)[_0x13df('0x21')](_0x115bf4);}};}function respondWithFilteredResult(_0x42f791,_0xf53677){return function(_0x24a6dc){if(_0x24a6dc){var _0x230a67=typeof _0xf53677[_0x13df('0x22')]==='undefined'&&typeof _0xf53677[_0x13df('0x23')]===_0x13df('0x24');var _0x4d1de9=_0x24a6dc[_0x13df('0x25')];var _0x475c2c=_0x230a67?0x0:_0xf53677[_0x13df('0x22')];var _0x1cca66=_0x230a67?_0x24a6dc['count']:_0xf53677[_0x13df('0x22')]+_0xf53677[_0x13df('0x23')];var _0x1662a3;if(_0x1cca66>=_0x4d1de9){_0x1cca66=_0x4d1de9;_0x1662a3=0xc8;}else{_0x1662a3=0xce;}_0x42f791[_0x13df('0x20')](_0x1662a3);return _0x42f791[_0x13df('0x26')](_0x13df('0x27'),_0x475c2c+'-'+_0x1cca66+'/'+_0x4d1de9)[_0x13df('0x21')](_0x24a6dc);}return null;};}function patchUpdates(_0x422ebb){return function(_0x2fc649){try{jsonpatch['apply'](_0x2fc649,_0x422ebb,!![]);}catch(_0x5c378f){return BPromise[_0x13df('0x28')](_0x5c378f);}return _0x2fc649[_0x13df('0x29')]();};}function saveUpdates(_0x3ed6d1,_0x5790b8){return function(_0x2a7cac){if(_0x2a7cac){return _0x2a7cac[_0x13df('0x2a')](_0x3ed6d1)['then'](function(_0x5bfb94){return _0x5bfb94;});}return null;};}function removeEntity(_0x36b29e,_0x287028){return function(_0x5a8b8c){if(_0x5a8b8c){return _0x5a8b8c[_0x13df('0x2b')]()[_0x13df('0x2c')](function(){var _0x68a728=_0x5a8b8c[_0x13df('0x2d')]({'plain':!![]});var _0x3459a3=_0x13df('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x3459a3,'resourceId':_0x68a728['id']}})[_0x13df('0x2c')](function(){return _0x5a8b8c;});})[_0x13df('0x2c')](function(){_0x36b29e[_0x13df('0x20')](0xcc)[_0x13df('0x2f')]();});}};}function handleEntityNotFound(_0x583439,_0x492739){return function(_0x518d63){if(!_0x518d63){_0x583439[_0x13df('0x1f')](0x194);}return _0x518d63;};}function handleError(_0x4da893,_0x2ce05b){_0x2ce05b=_0x2ce05b||0x1f4;return function(_0x38de8f){logger[_0x13df('0x30')](_0x38de8f[_0x13df('0x31')]);if(_0x38de8f[_0x13df('0x32')]){delete _0x38de8f['name'];}_0x4da893['status'](_0x2ce05b)[_0x13df('0x33')](_0x38de8f);};}exports[_0x13df('0x34')]=function(_0x23c8e3,_0x30f3b7){var _0x5e2a00={},_0x193238={},_0x2fdff5={'count':0x0,'rows':[]};var _0x63e559=_[_0x13df('0x35')](db[_0x13df('0x36')][_0x13df('0x37')],function(_0xc24a63){return{'name':_0xc24a63[_0x13df('0x38')],'type':_0xc24a63[_0x13df('0x39')][_0x13df('0x3a')]};});_0x193238[_0x13df('0x3b')]=_[_0x13df('0x35')](_0x63e559,_0x13df('0x32'));_0x193238[_0x13df('0x3c')]=_[_0x13df('0x3d')](_0x23c8e3[_0x13df('0x3c')]);_0x193238[_0x13df('0x3e')]=_[_0x13df('0x3f')](_0x193238[_0x13df('0x3b')],_0x193238[_0x13df('0x3c')]);_0x5e2a00['attributes']=_[_0x13df('0x3f')](_0x193238[_0x13df('0x3b')],qs[_0x13df('0x40')](_0x23c8e3['query'][_0x13df('0x40')]));_0x5e2a00[_0x13df('0x41')]=_0x5e2a00[_0x13df('0x41')][_0x13df('0x42')]?_0x5e2a00['attributes']:_0x193238[_0x13df('0x3b')];if(!_0x23c8e3['query'][_0x13df('0x43')]('nolimit')){_0x5e2a00[_0x13df('0x23')]=qs[_0x13df('0x23')](_0x23c8e3[_0x13df('0x3c')][_0x13df('0x23')]);_0x5e2a00[_0x13df('0x22')]=qs[_0x13df('0x22')](_0x23c8e3[_0x13df('0x3c')][_0x13df('0x22')]);}_0x5e2a00[_0x13df('0x44')]=qs[_0x13df('0x45')](_0x23c8e3[_0x13df('0x3c')][_0x13df('0x45')]);_0x5e2a00[_0x13df('0x46')]=qs['filters'](_['pick'](_0x23c8e3[_0x13df('0x3c')],_0x193238[_0x13df('0x3e')]),_0x63e559);if(_0x23c8e3[_0x13df('0x3c')][_0x13df('0x47')]){_0x5e2a00[_0x13df('0x46')]=_[_0x13df('0x48')](_0x5e2a00[_0x13df('0x46')],{'$or':_[_0x13df('0x35')](_0x63e559,function(_0x381ed5){if(_0x381ed5[_0x13df('0x39')]!==_0x13df('0x49')){var _0x85a26e={};_0x85a26e[_0x381ed5[_0x13df('0x32')]]={'$like':'%'+_0x23c8e3[_0x13df('0x3c')]['filter']+'%'};return _0x85a26e;}})});}_0x5e2a00=_['merge']({},_0x5e2a00,_0x23c8e3[_0x13df('0x4a')]);var _0x5f4274={'where':_0x5e2a00[_0x13df('0x46')]};return db['Pause'][_0x13df('0x25')](_0x5f4274)[_0x13df('0x2c')](function(_0x368f55){_0x2fdff5[_0x13df('0x25')]=_0x368f55;if(_0x23c8e3['query'][_0x13df('0x4b')]){_0x5e2a00[_0x13df('0x4c')]=[{'all':!![]}];}return db[_0x13df('0x36')][_0x13df('0x4d')](_0x5e2a00);})[_0x13df('0x2c')](function(_0x5732b4){_0x2fdff5[_0x13df('0x4e')]=_0x5732b4;return _0x2fdff5;})[_0x13df('0x2c')](respondWithFilteredResult(_0x30f3b7,_0x5e2a00))[_0x13df('0x4f')](handleError(_0x30f3b7,null));};exports[_0x13df('0x50')]=function(_0x3acd54,_0x346e1c){var _0xc99763={'raw':!![],'where':{'id':_0x3acd54[_0x13df('0x51')]['id']}},_0x23538b={};_0x23538b[_0x13df('0x3b')]=_['keys'](db[_0x13df('0x36')][_0x13df('0x37')]);_0x23538b['query']=_['keys'](_0x3acd54[_0x13df('0x3c')]);_0x23538b['filters']=_['intersection'](_0x23538b['model'],_0x23538b[_0x13df('0x3c')]);_0xc99763[_0x13df('0x41')]=_['intersection'](_0x23538b[_0x13df('0x3b')],qs[_0x13df('0x40')](_0x3acd54[_0x13df('0x3c')][_0x13df('0x40')]));_0xc99763[_0x13df('0x41')]=_0xc99763['attributes'][_0x13df('0x42')]?_0xc99763[_0x13df('0x41')]:_0x23538b[_0x13df('0x3b')];if(_0x3acd54[_0x13df('0x3c')][_0x13df('0x4b')]){_0xc99763[_0x13df('0x4c')]=[{'all':!![]}];}_0xc99763=_['merge']({},_0xc99763,_0x3acd54[_0x13df('0x4a')]);return db[_0x13df('0x36')][_0x13df('0x52')](_0xc99763)[_0x13df('0x2c')](handleEntityNotFound(_0x346e1c,null))[_0x13df('0x2c')](respondWithResult(_0x346e1c,null))['catch'](handleError(_0x346e1c,null));};exports[_0x13df('0x53')]=function(_0x3dd4c6,_0xa38fa3){return db[_0x13df('0x36')]['create'](_0x3dd4c6['body'],{})[_0x13df('0x2c')](function(_0x1b662f){var _0x1a8077=_0x3dd4c6[_0x13df('0x54')][_0x13df('0x2d')]({'plain':!![]});if(!_0x1a8077)throw new Error(_0x13df('0x55'));if(_0x1a8077[_0x13df('0x56')]===_0x13df('0x54')){var _0x1310d2=_0x1b662f[_0x13df('0x2d')]({'plain':!![]});var _0x45dfc5=_0x13df('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x45dfc5,'userProfileId':_0x1a8077[_0x13df('0x57')]},'raw':!![]})[_0x13df('0x2c')](function(_0x47dfeb){if(_0x47dfeb&&_0x47dfeb[_0x13df('0x58')]===0x0){return db[_0x13df('0x59')][_0x13df('0x53')]({'name':_0x1310d2[_0x13df('0x32')],'resourceId':_0x1310d2['id'],'type':_0x47dfeb[_0x13df('0x32')],'sectionId':_0x47dfeb['id']},{})[_0x13df('0x2c')](function(){return _0x1b662f;});}else{return _0x1b662f;}})['catch'](function(_0x43f4eb){logger[_0x13df('0x30')](_0x13df('0x5a'),_0x43f4eb);throw _0x43f4eb;});}return _0x1b662f;})[_0x13df('0x2c')](respondWithResult(_0xa38fa3,0xc9))['catch'](handleError(_0xa38fa3,null));};exports[_0x13df('0x2a')]=function(_0x104112,_0x4638e6){if(_0x104112[_0x13df('0x5b')]['id']){delete _0x104112[_0x13df('0x5b')]['id'];}return db[_0x13df('0x36')][_0x13df('0x52')]({'where':{'id':_0x104112[_0x13df('0x51')]['id']}})[_0x13df('0x2c')](handleEntityNotFound(_0x4638e6,null))[_0x13df('0x2c')](saveUpdates(_0x104112[_0x13df('0x5b')],null))[_0x13df('0x2c')](respondWithResult(_0x4638e6,null))['catch'](handleError(_0x4638e6,null));};exports['destroy']=function(_0x40bed7,_0x26a190){return db[_0x13df('0x36')][_0x13df('0x52')]({'where':{'id':_0x40bed7[_0x13df('0x51')]['id']}})[_0x13df('0x2c')](handleEntityNotFound(_0x26a190,null))['then'](removeEntity(_0x26a190,null))[_0x13df('0x4f')](handleError(_0x26a190,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dfdac30..7b6c016 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x609c59,_0x404ef9){var _0x1d1c91=function(_0x165481){while(--_0x165481){_0x609c59['push'](_0x609c59['shift']());}};_0x1d1c91(++_0x404ef9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x5fc3[_0x5466ab];return _0x40751a;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x59a482,_0x1ab755){var _0x3882be=function(_0x4fb4bd){while(--_0x4fb4bd){_0x59a482['push'](_0x59a482['shift']());}};_0x3882be(++_0x1ab755);}(_0x5fc3,0xa8));var _0x35fc=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x5fc3[_0x53bcc3];return _0x47c959;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'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 0808d51..11bb2d2 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(_0x124e17,_0x5ad997){var _0x310bb4=function(_0x3d99b1){while(--_0x3d99b1){_0x124e17['push'](_0x124e17['shift']());}};_0x310bb4(++_0x5ad997);}(_0x7a54,0x106));var _0x47a5=function(_0x523484,_0x17ca56){_0x523484=_0x523484-0x0;var _0x17f761=_0x7a54[_0x523484];return _0x17f761;};'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(_0x5b1759,_0x4e92b8){var _0x1e8695=function(_0xa10b28){while(--_0xa10b28){_0x5b1759['push'](_0x5b1759['shift']());}};_0x1e8695(++_0x4e92b8);}(_0x7a54,0x106));var _0x47a5=function(_0x3e7b61,_0x181144){_0x3e7b61=_0x3e7b61-0x0;var _0x125e35=_0x7a54[_0x3e7b61];return _0x125e35;};'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 dfd1485..5174f83 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 _0x0b78=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','index','/webhook','webhookGet','get','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','single','file','upload','webhookPost','isAuthenticated','update','delete','exports'];(function(_0x3efaad,_0x3f3cb1){var _0x729f1c=function(_0x594fda){while(--_0x594fda){_0x3efaad['push'](_0x3efaad['shift']());}};_0x729f1c(++_0x3f3cb1);}(_0x0b78,0x1ad));var _0x80b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b78[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),controller[_0x80b7('0xa')]);router[_0x80b7('0xb')](_0x80b7('0xc'),auth['isAuthenticated'](),controller[_0x80b7('0xd')]);router[_0x80b7('0xb')](_0x80b7('0xe'),auth['isAuthenticated'](),controller[_0x80b7('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b1a00,_0x4599c1,_0x3b19da){_0x3b19da(null,path[_0x80b7('0x10')](config[_0x80b7('0x11')],_0x80b7('0x12')));},'filename':function(_0x3f8c16,_0x145241,_0x323d06){_0x145241[_0x80b7('0x13')]=_0x145241[_0x80b7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d06(null,util[_0x80b7('0x14')](_0x80b7('0x15'),path['basename'](_0x145241[_0x80b7('0x13')],path[_0x80b7('0x16')](_0x145241['originalname'])),Date[_0x80b7('0x17')](),path[_0x80b7('0x16')](_0x145241[_0x80b7('0x13')])));}})});router[_0x80b7('0x18')]('/',upload[_0x80b7('0x19')](_0x80b7('0x1a')),controller[_0x80b7('0x1b')]);router[_0x80b7('0x18')](_0x80b7('0x9'),controller[_0x80b7('0x1c')]);router['put'](_0x80b7('0xc'),auth[_0x80b7('0x1d')](),controller[_0x80b7('0x1e')]);router[_0x80b7('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x80b7('0x1f')]);module[_0x80b7('0x20')]=router; \ No newline at end of file +var _0x3667=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x4e5a6a,_0x3b4fdc){var _0x5d6858=function(_0x33e290){while(--_0x33e290){_0x4e5a6a['push'](_0x4e5a6a['shift']());}};_0x5d6858(++_0x3b4fdc);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);var upload=multer({'storage':multer[_0x7366('0x12')]({'destination':function(_0x2d7e38,_0x57ea7f,_0x425ee4){_0x425ee4(null,path[_0x7366('0x13')](config[_0x7366('0x14')],_0x7366('0x15')));},'filename':function(_0x25a565,_0xd5bac8,_0x3e3a73){_0xd5bac8[_0x7366('0x16')]=_0xd5bac8[_0x7366('0x16')][_0x7366('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e3a73(null,util[_0x7366('0x18')](_0x7366('0x19'),path[_0x7366('0x1a')](_0xd5bac8[_0x7366('0x16')],path[_0x7366('0x1b')](_0xd5bac8['originalname'])),Date[_0x7366('0x1c')](),path[_0x7366('0x1b')](_0xd5bac8[_0x7366('0x16')])));}})});router[_0x7366('0x1d')]('/',upload[_0x7366('0x1e')](_0x7366('0x1f')),controller[_0x7366('0x20')]);router[_0x7366('0x1d')](_0x7366('0xc'),controller[_0x7366('0x21')]);router[_0x7366('0x22')]('/:id',auth[_0x7366('0xa')](),controller['update']);router[_0x7366('0x23')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller['delete']);module[_0x7366('0x24')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 84e7f73..16888eb 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 _0xa322=['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','ENUM'];(function(_0x58687c,_0x771936){var _0x246284=function(_0x5ce1ad){while(--_0x5ce1ad){_0x58687c['push'](_0x58687c['shift']());}};_0x246284(++_0x771936);}(_0xa322,0x6d));var _0x2a32=function(_0x3e08e5,_0x580b50){_0x3e08e5=_0x3e08e5-0x0;var _0x116ebb=_0xa322[_0x3e08e5];return _0x116ebb;};'use strict';var Sequelize=require(_0x2a32('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a32('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2a32('0x2'),_0x2a32('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x2a32('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x2a32('0x5')},'active':{'type':Sequelize[_0x2a32('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x2a32('0x7')](_0x2a32('0x8'),_0x2a32('0x9'),_0x2a32('0xa'),_0x2a32('0xb')),'defaultValue':_0x2a32('0xa'),'comment':_0x2a32('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x2a32('0x1')]},'scriptName':{'type':Sequelize[_0x2a32('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x16a7=['ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x5eb4bb,_0xbd4598){var _0x12d25b=function(_0x4f0ccd){while(--_0x4f0ccd){_0x5eb4bb['push'](_0x5eb4bb['shift']());}};_0x12d25b(++_0xbd4598);}(_0x16a7,0x135));var _0x716a=function(_0x1fc0c0,_0x4585fc){_0x1fc0c0=_0x1fc0c0-0x0;var _0x1c7800=_0x16a7[_0x1fc0c0];return _0x1c7800;};'use strict';var Sequelize=require(_0x716a('0x0'));module[_0x716a('0x1')]={'name':{'type':Sequelize[_0x716a('0x2')]},'type':{'type':Sequelize[_0x716a('0x3')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x716a('0x4')]},'path':{'type':Sequelize[_0x716a('0x2')],'comment':_0x716a('0x5')},'active':{'type':Sequelize[_0x716a('0x6')],'defaultValue':0x0,'comment':_0x716a('0x7')},'sidebar':{'type':Sequelize[_0x716a('0x3')](_0x716a('0x8'),'agentOnly',_0x716a('0x9'),_0x716a('0xa')),'defaultValue':'always','comment':_0x716a('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x716a('0x2')]},'scriptName':{'type':Sequelize[_0x716a('0x2')]},'scriptPath':{'type':Sequelize[_0x716a('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e9015b6..f94fa9b 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 _0xe207=['VIRTUAL','options','includeAll','include','findAll','show','params','catch','find','root','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','join','node_modules/**/*','finalize','close','Plugin\x20not\x20found','download','basename','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','%s%s','headers','content-length','set','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','method','content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','rimraf','archiver','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','stack','name','send','index','map','Plugin','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0xe207,0x1b2));var _0x7e20=function(_0x13b491,_0x29e62f){_0x13b491=_0x13b491-0x0;var _0x330eaf=_0xe207[_0x13b491];return _0x330eaf;};'use strict';var emlformat=require(_0x7e20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e20('0x1'));var jsonpatch=require(_0x7e20('0x2'));var rp=require(_0x7e20('0x3'));var moment=require(_0x7e20('0x4'));var BPromise=require(_0x7e20('0x5'));var Mustache=require(_0x7e20('0x6'));var util=require('util');var path=require(_0x7e20('0x7'));var sox=require(_0x7e20('0x8'));var csv=require(_0x7e20('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e20('0xa'));var squel=require('squel');var crypto=require(_0x7e20('0xb'));var jsforce=require(_0x7e20('0xc'));var deskjs=require(_0x7e20('0xd'));var toCsv=require(_0x7e20('0x9'));var querystring=require(_0x7e20('0xe'));var Papa=require(_0x7e20('0xf'));var extract=require('extract-zip');var rimraf=require(_0x7e20('0x10'));var archiver=require(_0x7e20('0x11'));var Redis=require('ioredis');var authService=require(_0x7e20('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e20('0x13'))(_0x7e20('0x14'));var utils=require(_0x7e20('0x15'));var config=require(_0x7e20('0x16'));var licenseUtil=require(_0x7e20('0x17'));var db=require('../../mysqldb')['db'];config[_0x7e20('0x18')]=_[_0x7e20('0x19')](config['redis'],{'host':_0x7e20('0x1a'),'port':0x18eb});var socket=require(_0x7e20('0x1b'))(new Redis(config[_0x7e20('0x18')]));require(_0x7e20('0x1c'))['register'](socket);function respondWithStatusCode(_0x3d68d7,_0xc4fc76){_0xc4fc76=_0xc4fc76||0xcc;return function(_0x5cb008){if(_0x5cb008){return _0x3d68d7[_0x7e20('0x1d')](_0xc4fc76);}return _0x3d68d7[_0x7e20('0x1e')](_0xc4fc76)[_0x7e20('0x1f')]();};}function respondWithResult(_0x5602ac,_0x13c957){_0x13c957=_0x13c957||0xc8;return function(_0x1675ae){if(_0x1675ae){return _0x5602ac[_0x7e20('0x1e')](_0x13c957)[_0x7e20('0x20')](_0x1675ae);}};}function respondWithFilteredResult(_0x5f39af,_0x353944){return function(_0x54fd55){if(_0x54fd55){var _0x1e8e20=typeof _0x353944[_0x7e20('0x21')]==='undefined'&&typeof _0x353944[_0x7e20('0x22')]==='undefined';var _0x4a8980=_0x54fd55[_0x7e20('0x23')];var _0x2fcdcf=_0x1e8e20?0x0:_0x353944[_0x7e20('0x21')];var _0x5973df=_0x1e8e20?_0x54fd55[_0x7e20('0x23')]:_0x353944['offset']+_0x353944[_0x7e20('0x22')];var _0x1e3a77;if(_0x5973df>=_0x4a8980){_0x5973df=_0x4a8980;_0x1e3a77=0xc8;}else{_0x1e3a77=0xce;}_0x5f39af[_0x7e20('0x1e')](_0x1e3a77);return _0x5f39af['set'](_0x7e20('0x24'),_0x2fcdcf+'-'+_0x5973df+'/'+_0x4a8980)[_0x7e20('0x20')](_0x54fd55);}return null;};}function patchUpdates(_0x247485){return function(_0x4e5be4){try{jsonpatch[_0x7e20('0x25')](_0x4e5be4,_0x247485,!![]);}catch(_0xdcbc8c){return BPromise[_0x7e20('0x26')](_0xdcbc8c);}return _0x4e5be4['save']();};}function saveUpdates(_0xd20b01,_0x2aaf91){return function(_0xf3862){if(_0xf3862){return _0xf3862[_0x7e20('0x27')](_0xd20b01)[_0x7e20('0x28')](function(_0x312a09){return _0x312a09;});}return null;};}function removeEntity(_0x11babc,_0x247a06){return function(_0x347b57){if(_0x347b57){return _0x347b57[_0x7e20('0x29')]()['then'](function(){var _0x2563ea=_0x347b57[_0x7e20('0x2a')]({'plain':!![]});var _0x5f5644=_0x7e20('0x2b');return db[_0x7e20('0x2c')][_0x7e20('0x29')]({'where':{'type':_0x5f5644,'resourceId':_0x2563ea['id']}})[_0x7e20('0x28')](function(){return _0x347b57;});})[_0x7e20('0x28')](function(){_0x11babc['status'](0xcc)[_0x7e20('0x1f')]();});}};}function handleEntityNotFound(_0x5e0833,_0x46455d){return function(_0x32e1e8){if(!_0x32e1e8){_0x5e0833['sendStatus'](0x194);}return _0x32e1e8;};}function handleError(_0x51fcb3,_0x1c5226){_0x1c5226=_0x1c5226||0x1f4;return function(_0x35051a){logger['error'](_0x35051a[_0x7e20('0x2d')]);if(_0x35051a[_0x7e20('0x2e')]){delete _0x35051a[_0x7e20('0x2e')];}_0x51fcb3[_0x7e20('0x1e')](_0x1c5226)[_0x7e20('0x2f')](_0x35051a);};}exports[_0x7e20('0x30')]=function(_0x4bf6ca,_0xa55ee1){var _0x154bc4={},_0x25fde1={},_0x937fec={'count':0x0,'rows':[]};var _0x352c38=_[_0x7e20('0x31')](db[_0x7e20('0x32')][_0x7e20('0x33')],function(_0x54fb04){return{'name':_0x54fb04['fieldName'],'type':_0x54fb04[_0x7e20('0x34')][_0x7e20('0x35')]};});_0x25fde1['model']=_[_0x7e20('0x31')](_0x352c38,_0x7e20('0x2e'));_0x25fde1[_0x7e20('0x36')]=_[_0x7e20('0x37')](_0x4bf6ca[_0x7e20('0x36')]);_0x25fde1[_0x7e20('0x38')]=_[_0x7e20('0x39')](_0x25fde1[_0x7e20('0x3a')],_0x25fde1['query']);_0x154bc4[_0x7e20('0x3b')]=_[_0x7e20('0x39')](_0x25fde1[_0x7e20('0x3a')],qs[_0x7e20('0x3c')](_0x4bf6ca[_0x7e20('0x36')]['fields']));_0x154bc4['attributes']=_0x154bc4[_0x7e20('0x3b')][_0x7e20('0x3d')]?_0x154bc4[_0x7e20('0x3b')]:_0x25fde1[_0x7e20('0x3a')];if(!_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x3e')](_0x7e20('0x3f'))){_0x154bc4[_0x7e20('0x22')]=qs[_0x7e20('0x22')](_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x22')]);_0x154bc4[_0x7e20('0x21')]=qs[_0x7e20('0x21')](_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x21')]);}_0x154bc4[_0x7e20('0x40')]=qs['sort'](_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x41')]);_0x154bc4[_0x7e20('0x42')]=qs[_0x7e20('0x38')](_[_0x7e20('0x43')](_0x4bf6ca['query'],_0x25fde1[_0x7e20('0x38')]),_0x352c38);if(_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x44')]){_0x154bc4[_0x7e20('0x42')]=_[_0x7e20('0x45')](_0x154bc4[_0x7e20('0x42')],{'$or':_[_0x7e20('0x31')](_0x352c38,function(_0x17c351){if(_0x17c351['type']!==_0x7e20('0x46')){var _0x2e813c={};_0x2e813c[_0x17c351[_0x7e20('0x2e')]]={'$like':'%'+_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x44')]+'%'};return _0x2e813c;}})});}_0x154bc4=_['merge']({},_0x154bc4,_0x4bf6ca[_0x7e20('0x47')]);var _0x34ec51={'where':_0x154bc4[_0x7e20('0x42')]};return db[_0x7e20('0x32')][_0x7e20('0x23')](_0x34ec51)[_0x7e20('0x28')](function(_0x4047f6){_0x937fec[_0x7e20('0x23')]=_0x4047f6;if(_0x4bf6ca[_0x7e20('0x36')][_0x7e20('0x48')]){_0x154bc4[_0x7e20('0x49')]=[{'all':!![]}];}return db[_0x7e20('0x32')][_0x7e20('0x4a')](_0x154bc4);})[_0x7e20('0x28')](function(_0x597e14){_0x937fec['rows']=_0x597e14;return _0x937fec;})[_0x7e20('0x28')](respondWithFilteredResult(_0xa55ee1,_0x154bc4))['catch'](handleError(_0xa55ee1,null));};exports[_0x7e20('0x4b')]=function(_0x208b44,_0x35ec2c){var _0x494af4={'raw':!![],'where':{'id':_0x208b44[_0x7e20('0x4c')]['id']}},_0x52c772={};_0x52c772['model']=_[_0x7e20('0x37')](db[_0x7e20('0x32')][_0x7e20('0x33')]);_0x52c772[_0x7e20('0x36')]=_[_0x7e20('0x37')](_0x208b44[_0x7e20('0x36')]);_0x52c772[_0x7e20('0x38')]=_[_0x7e20('0x39')](_0x52c772['model'],_0x52c772[_0x7e20('0x36')]);_0x494af4[_0x7e20('0x3b')]=_[_0x7e20('0x39')](_0x52c772['model'],qs['fields'](_0x208b44[_0x7e20('0x36')][_0x7e20('0x3c')]));_0x494af4[_0x7e20('0x3b')]=_0x494af4['attributes']['length']?_0x494af4[_0x7e20('0x3b')]:_0x52c772['model'];if(_0x208b44[_0x7e20('0x36')]['includeAll']){_0x494af4['include']=[{'all':!![]}];}_0x494af4=_[_0x7e20('0x45')]({},_0x494af4,_0x208b44[_0x7e20('0x47')]);return db[_0x7e20('0x32')]['find'](_0x494af4)[_0x7e20('0x28')](handleEntityNotFound(_0x35ec2c,null))[_0x7e20('0x28')](respondWithResult(_0x35ec2c,null))[_0x7e20('0x4d')](handleError(_0x35ec2c,null));};exports['download']=function(_0x294443,_0x3ed9a2,_0x20c58e){return db[_0x7e20('0x32')][_0x7e20('0x4e')]({'where':{'id':_0x294443[_0x7e20('0x4c')]['id']},'attributes':['name',_0x7e20('0x7')],'raw':!![]})[_0x7e20('0x28')](handleEntityNotFound(_0x3ed9a2,null))[_0x7e20('0x28')](function(_0x3073bf){if(_0x3073bf){var _0x128c4e=path['join'](config[_0x7e20('0x4f')],'server/files/plugins',util[_0x7e20('0x50')](_0x7e20('0x51'),path['basename'](_0x3073bf[_0x7e20('0x7')])));var _0x295491=fs[_0x7e20('0x52')](_0x128c4e);var _0x45b575=archiver(_0x7e20('0x53'),{'zlib':{'level':0x9}});_0x45b575['on'](_0x7e20('0x54'),function(_0x59dbc1){if(_0x59dbc1[_0x7e20('0x55')]===_0x7e20('0x56')){logger[_0x7e20('0x57')](_0x59dbc1);}else{throw new db[(_0x7e20('0x58'))]['Error'](_0x7e20('0x59'));}});_0x45b575['on'](_0x7e20('0x57'),function(_0x1a7a94){throw new db[(_0x7e20('0x58'))][(_0x7e20('0x5a'))](_0x7e20('0x59'));});_0x45b575['pipe'](_0x295491);_0x45b575[_0x7e20('0x5b')](_0x7e20('0x5c'),{'cwd':path['join'](config['root'],'server/files/plugins',path[_0x7e20('0x5d')](_0x3073bf[_0x7e20('0x7')])),'ignore':[path[_0x7e20('0x5e')](path['basename'](_0x3073bf[_0x7e20('0x7')]),_0x7e20('0x5f')),path[_0x7e20('0x5e')](path['basename'](_0x3073bf[_0x7e20('0x7')]),'attachments/**/*')],'nodir':!![]})[_0x7e20('0x60')]();_0x295491['on'](_0x7e20('0x61'),function(){if(!fs['existsSync'](_0x128c4e)){throw new db[(_0x7e20('0x58'))][(_0x7e20('0x5a'))](_0x7e20('0x62'));}return _0x3ed9a2[_0x7e20('0x63')](_0x128c4e,util[_0x7e20('0x50')](_0x7e20('0x51'),path[_0x7e20('0x64')](_0x3073bf['path'])),function(_0x589e7d){if(_0x589e7d){throw new db[(_0x7e20('0x58'))][(_0x7e20('0x5a'))](_0x7e20('0x65'));}fs['unlinkSync'](_0x128c4e);logger[_0x7e20('0x66')](_0x7e20('0x67'));logger['info'](_0x7e20('0x68'));});});}return null;})[_0x7e20('0x4d')](handleError(_0x3ed9a2,null));};exports[_0x7e20('0x69')]=function(_0x3fe504,_0x4ebb3c,_0x304173){var _0x11049d=path[_0x7e20('0x64')](_0x3fe504[_0x7e20('0x6a')][_0x7e20('0x6b')],path[_0x7e20('0x6c')](_0x3fe504[_0x7e20('0x6a')]['filename']));var _0xcf4a1=path[_0x7e20('0x5e')](config['root'],'server/files/plugins',_0x3fe504[_0x7e20('0x6a')][_0x7e20('0x6b')]);var _0x3a268e=path[_0x7e20('0x5e')](config[_0x7e20('0x4f')],_0x7e20('0x6d'),_0x11049d);logger[_0x7e20('0x66')](_0x7e20('0x6e'),_0xcf4a1);logger[_0x7e20('0x66')](_0x7e20('0x6f'),_0x3a268e);try{fs[_0x7e20('0x70')](_0xcf4a1,parseInt(_0x7e20('0x71'),0x8));extract(_0xcf4a1,{'dir':_0x3a268e},function(_0x4dc7fc){if(_0x4dc7fc){logger[_0x7e20('0x57')](_0x4dc7fc);handleError(_0x4dc7fc,!![]);};var _0x38d2c0=fs[_0x7e20('0x72')](_0x3a268e);if(_0x38d2c0['length']>0x1){removeReferences(_0xcf4a1,_0x3a268e);logger[_0x7e20('0x57')](_0x7e20('0x73'));return _0x304173(new Error('Invalid\x20plugin\x20structure'));}var _0x3f4fd5=fs[_0x7e20('0x74')](path[_0x7e20('0x5e')](_0x3a268e,_0x38d2c0[0x0]));if(_0x3f4fd5[_0x7e20('0x75')]()){removeReferences(_0xcf4a1,_0x3a268e);logger['error'](_0x7e20('0x73'));return _0x304173(new Error('Invalid\x20plugin\x20structure'));}if(_0x3f4fd5[_0x7e20('0x76')]()){var _0x2d2309=fs[_0x7e20('0x72')](path[_0x7e20('0x5e')](_0x3a268e,_0x38d2c0[0x0]));if(_0x2d2309[_0x7e20('0x3d')]===0x0){removeReferences(_0xcf4a1,_0x3a268e);logger[_0x7e20('0x57')](_0x7e20('0x73'));return _0x304173(new Error(_0x7e20('0x73')));}var _0x3f7b4a=_0x2d2309[_0x7e20('0x77')](function(_0xde9c4d){return _0xde9c4d===_0x7e20('0x78');});if(!_0x3f7b4a){return _0x304173(new Error('Plugin\x20manifest\x20missing'));}var _0x39b2a6=fs['readFileSync'](path[_0x7e20('0x5e')](_0x3a268e,_0x38d2c0[0x0],_0x7e20('0x78')));var _0x11b297=JSON[_0x7e20('0x79')](_0x39b2a6);if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x2e')]){return _0x304173(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x34')]){return _0x304173(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x7b')]){return _0x304173(new Error(_0x7e20('0x7c')));}if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x7d')]){return _0x304173(new Error(_0x7e20('0x7e')));}if(_0x11b297[_0x7e20('0x34')]===_0x7e20('0x7f')){if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x7d')][_0x7e20('0x80')]){return _0x304173(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x7d')]['views'][_0x7e20('0x81')]&&_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x7d')][_0x7e20('0x80')][_0x7e20('0x82')]){return _0x304173(new Error(_0x7e20('0x83')));}}else if(_0x11b297[_0x7e20('0x34')]===_0x7e20('0x84')){if(_0x7e20('0x7a')==typeof _0x11b297[_0x7e20('0x7d')][_0x7e20('0x85')]){return _0x304173(new Error(_0x7e20('0x86')));}if(_0x7e20('0x7a')==typeof _0x11b297['parameters'][_0x7e20('0x87')]){return _0x304173(new Error(_0x7e20('0x88')));}}else{return _0x304173(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x28f82e=_0x11b297[_0x7e20('0x2e')];var _0x409ebe=_0x11b297[_0x7e20('0x89')];var _0x3354e2=_0x11b297[_0x7e20('0x34')];var _0x4fb94f=_0x11b297[_0x7e20('0x8a')]?_0x11b297[_0x7e20('0x8a')]:_0x7e20('0x8b');var _0x374891=_0x11b297['icon']?_0x11b297[_0x7e20('0x8c')]:_0x7e20('0x8d');var _0x1ed5bd='';var _0x2a0713='';var _0x4a59e0='';var _0x143a97='';var _0x55260b=_0x11b297[_0x7e20('0x7b')];if(_0x3354e2===_0x7e20('0x7f')){if(_0x7e20('0x7a')!=typeof _0x11b297[_0x7e20('0x7d')]['views']['admin']){var _0x5573e7=_0x11b297['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7e20('0x8e')](_0x5573e7)){_0x1ed5bd=path[_0x7e20('0x5e')](_0x7e20('0x8f'),_0x11049d,_0x38d2c0[0x0],_0x5573e7);}else{_0x1ed5bd=_0x5573e7;}}else{logger[_0x7e20('0x66')](_0x7e20('0x90'));}if(_0x7e20('0x7a')!=typeof _0x11b297['parameters'][_0x7e20('0x80')][_0x7e20('0x82')]){var _0xa8732c=_0x11b297[_0x7e20('0x7d')][_0x7e20('0x80')][_0x7e20('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0xa8732c)){_0x2a0713=path[_0x7e20('0x5e')](_0x7e20('0x8f'),_0x11049d,_0x38d2c0[0x0],_0xa8732c);}else{_0x2a0713=_0xa8732c;}}else{logger['info'](_0x7e20('0x91'));}}else if(_0x3354e2===_0x7e20('0x84')){_0x4a59e0=_0x11b297[_0x7e20('0x7d')][_0x7e20('0x85')];_0x143a97=_0x11b297[_0x7e20('0x7d')][_0x7e20('0x87')];if(_0x7e20('0x7a')!=typeof _0x11b297['parameters'][_0x7e20('0x80')]){if('undefined'!=typeof _0x11b297[_0x7e20('0x7d')][_0x7e20('0x80')][_0x7e20('0x81')]){var _0x5573e7=_0x11b297[_0x7e20('0x7d')][_0x7e20('0x80')][_0x7e20('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5573e7)){_0x1ed5bd=path[_0x7e20('0x5e')]('plugins',_0x11049d,_0x38d2c0[0x0],_0x5573e7);}else{_0x1ed5bd=_0x5573e7;}}if('undefined'!=typeof _0x11b297[_0x7e20('0x7d')]['views']['agent']){var _0xa8732c=_0x11b297[_0x7e20('0x7d')][_0x7e20('0x80')][_0x7e20('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x7e20('0x8e')](_0xa8732c)){_0x2a0713=path[_0x7e20('0x5e')]('plugins',_0x11049d,_0x38d2c0[0x0],_0xa8732c);}else{_0x2a0713=_0xa8732c;}}}}var _0x18894e={'name':_0x28f82e,'description':_0x409ebe,'path':path[_0x7e20('0x5e')](_0x11049d,_0x38d2c0[0x0]),'type':_0x3354e2,'sidebar':_0x4fb94f,'icon':_0x374891,'adminUrl':_0x1ed5bd,'agentUrl':_0x2a0713,'scriptName':_0x4a59e0,'scriptPath':_0x143a97,'version':_0x55260b};removeReferences(_0xcf4a1,null);return db[_0x7e20('0x32')][_0x7e20('0x92')](_0x18894e)[_0x7e20('0x28')](function(_0x20b695){var _0x39e83c={'role':_0x3fe504[_0x7e20('0x93')][_0x7e20('0x94')],'userProfileId':_0x3fe504[_0x7e20('0x93')][_0x7e20('0x95')]};if(!_0x39e83c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39e83c[_0x7e20('0x94')]===_0x7e20('0x96')){var _0x246764=_0x20b695[_0x7e20('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x7e20('0x4e')]({'where':{'name':_0x7e20('0x2b'),'userProfileId':_0x39e83c[_0x7e20('0x95')]},'raw':!![]})[_0x7e20('0x28')](function(_0x5df51a){if(_0x5df51a&&_0x5df51a['autoAssociation']===0x0){return db[_0x7e20('0x2c')]['create']({'name':_0x246764[_0x7e20('0x2e')],'resourceId':_0x246764['id'],'type':_0x5df51a[_0x7e20('0x2e')],'sectionId':_0x5df51a['id']},{})['then'](function(){return _0x20b695;});}else{return _0x20b695;}})['catch'](function(_0x77c3a5){logger['error'](_0x7e20('0x97'),_0x77c3a5);throw _0x77c3a5;});}return _0x20b695;})[_0x7e20('0x28')](respondWithResult(_0x4ebb3c,null))['catch'](handleError(_0x4ebb3c,null));}});}catch(_0x438d05){_0x4ebb3c[_0x7e20('0x1e')](0x1f4)[_0x7e20('0x2f')](_0x438d05);}};function removeReferences(_0x593534,_0xfa46b2){try{if(_0x593534){fs['unlinkSync'](_0x593534);logger[_0x7e20('0x66')](_0x7e20('0x98'));}if(_0xfa46b2){rimraf(_0xfa46b2,function(){});logger[_0x7e20('0x66')]('Extracted\x20folder\x20removed');}}catch(_0x4fb8a6){logger[_0x7e20('0x57')](_0x4fb8a6);}}exports['update']=function(_0x335580,_0x3f5ee6,_0x44e745){return db[_0x7e20('0x32')][_0x7e20('0x4e')]({'where':{'id':_0x335580[_0x7e20('0x4c')]['id']}})[_0x7e20('0x28')](handleEntityNotFound(_0x3f5ee6,null))[_0x7e20('0x28')](saveUpdates(_0x335580['body'],null))[_0x7e20('0x28')](respondWithResult(_0x3f5ee6,null))[_0x7e20('0x4d')](handleError(_0x3f5ee6,null));};exports['delete']=function(_0x40b934,_0x298079,_0x520912){return db[_0x7e20('0x32')][_0x7e20('0x4e')]({'where':{'id':_0x40b934[_0x7e20('0x4c')]['id']}})['then'](function(_0x462d60){if(_0x462d60){return _0x462d60[_0x7e20('0x29')]();}})[_0x7e20('0x28')](function(_0x2026ed){rimraf(path[_0x7e20('0x5e')](config['root'],_0x7e20('0x6d'),path['dirname'](_0x2026ed['path'])),function(){});return _0x2026ed;})[_0x7e20('0x28')](handleEntityNotFound(_0x298079,null))[_0x7e20('0x28')](respondWithStatusCode(_0x298079,null))[_0x7e20('0x4d')](handleError(_0x298079,null));};exports['webhookGet']=function(_0x58f18e,_0x5bdfe5,_0x1d7f69){return BPromise[_0x7e20('0x99')]()['then'](function(){if(!_0x58f18e['query'][_0x7e20('0x7')]){throw new Error(_0x7e20('0x9a'));}if(!_0x58f18e[_0x7e20('0x36')][_0x7e20('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x23141b=_0x58f18e[_0x7e20('0x36')][_0x7e20('0x9c')]?_0x58f18e['query'][_0x7e20('0x9c')]+':'+_0x58f18e[_0x7e20('0x36')][_0x7e20('0x9b')]:'http://localhost:'+_0x58f18e[_0x7e20('0x36')][_0x7e20('0x9b')];var _0xdedfac=_0x58f18e[_0x7e20('0x36')][_0x7e20('0x20')]?_0x58f18e[_0x7e20('0x36')][_0x7e20('0x20')]:!![];var _0x1f8e9b=_0x58f18e['query']['encoding']?_0x58f18e[_0x7e20('0x36')][_0x7e20('0x9d')]:null;var _0x129bc2={'method':_0x58f18e['method'],'uri':util[_0x7e20('0x50')](_0x7e20('0x9e'),_0x23141b,_0x58f18e['query']['path']),'json':_0xdedfac,'resolveWithFullResponse':!![],'encoding':_0x1f8e9b,'qs':_0x58f18e[_0x7e20('0x36')]};if(_0x58f18e[_0x7e20('0x9f')]){_0x129bc2[_0x7e20('0x9f')]=_0x58f18e['headers'];if(_0x129bc2[_0x7e20('0x9f')][_0x7e20('0xa0')]){delete _0x129bc2[_0x7e20('0x9f')][_0x7e20('0xa0')];}}if(_0x129bc2[_0x7e20('0x9f')]['content-type']){delete _0x129bc2[_0x7e20('0x9f')]['content-type'];}return rp(_0x129bc2);})[_0x7e20('0x28')](function(_0x924056){if(_0x924056){_0x5bdfe5[_0x7e20('0xa1')](_0x924056[_0x7e20('0x9f')]);logger[_0x7e20('0x66')](_0x924056[_0x7e20('0x93')]);if(_[_0x7e20('0xa2')](_0x58f18e[_0x7e20('0x36')][_0x7e20('0x7')],_0x7e20('0x63'))&&_0x924056[_0x7e20('0xa3')]==0x1f4){return _0x5bdfe5[_0x7e20('0x1d')](_0x924056['statusCode']);}else{return _0x5bdfe5['status'](_0x924056[_0x7e20('0xa3')])['send'](_0x924056['body']);}}else{return _0x5bdfe5[_0x7e20('0x1d')](0xc8);}})['catch'](handleError(_0x5bdfe5,null));};exports['webhookPost']=function(_0x2a716c,_0x56dec0,_0x516ee6){return BPromise['resolve']()[_0x7e20('0x28')](function(){if(!_0x2a716c['query']['path']){throw new Error(_0x7e20('0x9a'));}if(!_0x2a716c[_0x7e20('0x36')][_0x7e20('0x9b')]){throw new Error(_0x7e20('0xa4'));}var _0x4e3d39=_0x2a716c[_0x7e20('0x36')][_0x7e20('0x9c')]?_0x2a716c[_0x7e20('0x36')]['hostname']+':'+_0x2a716c[_0x7e20('0x36')][_0x7e20('0x9b')]:_0x7e20('0xa5')+_0x2a716c['query'][_0x7e20('0x9b')];var _0x33ac49=_0x2a716c[_0x7e20('0x36')][_0x7e20('0x20')]?_0x2a716c[_0x7e20('0x36')][_0x7e20('0x20')]:!![];var _0x10d282=_0x2a716c[_0x7e20('0x36')][_0x7e20('0x9d')]?_0x2a716c[_0x7e20('0x36')][_0x7e20('0x9d')]:null;var _0x572341={'method':_0x2a716c[_0x7e20('0xa6')],'uri':util[_0x7e20('0x50')](_0x7e20('0x9e'),_0x4e3d39,_0x2a716c[_0x7e20('0x36')][_0x7e20('0x7')]),'json':_0x33ac49,'resolveWithFullResponse':!![],'encoding':_0x10d282,'body':_0x2a716c[_0x7e20('0x93')]};if(_0x2a716c[_0x7e20('0x9f')]){_0x572341[_0x7e20('0x9f')]=_0x2a716c[_0x7e20('0x9f')];if(_0x572341[_0x7e20('0x9f')][_0x7e20('0xa0')]){delete _0x572341[_0x7e20('0x9f')][_0x7e20('0xa0')];}}if(_0x572341[_0x7e20('0x9f')][_0x7e20('0xa7')]){delete _0x572341[_0x7e20('0x9f')][_0x7e20('0xa7')];}return rp(_0x572341);})[_0x7e20('0x28')](function(_0x1cbf87){if(_0x1cbf87){_0x56dec0[_0x7e20('0xa1')](_0x1cbf87['headers']);logger[_0x7e20('0x66')](_0x1cbf87[_0x7e20('0x93')]);return _0x56dec0[_0x7e20('0x1e')](_0x1cbf87['statusCode'])[_0x7e20('0x2f')](_0x1cbf87[_0x7e20('0x93')]);}else{return _0x56dec0['sendStatus'](0xc8);}})[_0x7e20('0x4d')](handleError(_0x56dec0,null));}; \ No newline at end of file +var _0x4ab2=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','UserProfileResource','destroy','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','download','params','join','root','server/files/plugins','%s.zip','basename','zip','warning','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','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','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','eml-format'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x4ab2,0x14f));var _0x24ab=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4ab2[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x24ab('0x0'));var rimraf=require(_0x24ab('0x1'));var zipdir=require(_0x24ab('0x2'));var jsonpatch=require(_0x24ab('0x3'));var rp=require(_0x24ab('0x4'));var moment=require('moment');var BPromise=require(_0x24ab('0x5'));var Mustache=require(_0x24ab('0x6'));var util=require('util');var path=require(_0x24ab('0x7'));var sox=require('sox');var csv=require(_0x24ab('0x8'));var ejs=require(_0x24ab('0x9'));var fs=require('fs');var fs_extra=require(_0x24ab('0xa'));var _=require(_0x24ab('0xb'));var squel=require(_0x24ab('0xc'));var crypto=require(_0x24ab('0xd'));var jsforce=require(_0x24ab('0xe'));var deskjs=require(_0x24ab('0xf'));var toCsv=require(_0x24ab('0x8'));var querystring=require(_0x24ab('0x10'));var Papa=require('papaparse');var extract=require(_0x24ab('0x11'));var rimraf=require(_0x24ab('0x1'));var archiver=require(_0x24ab('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x24ab('0x13'));var hardwareService=require(_0x24ab('0x14'));var logger=require(_0x24ab('0x15'))(_0x24ab('0x16'));var utils=require(_0x24ab('0x17'));var config=require(_0x24ab('0x18'));var licenseUtil=require(_0x24ab('0x19'));var db=require(_0x24ab('0x1a'))['db'];config['redis']=_['defaults'](config[_0x24ab('0x1b')],{'host':_0x24ab('0x1c'),'port':0x18eb});var socket=require(_0x24ab('0x1d'))(new Redis(config['redis']));require(_0x24ab('0x1e'))['register'](socket);function respondWithStatusCode(_0x4a88d4,_0x255e35){_0x255e35=_0x255e35||0xcc;return function(_0x59cde5){if(_0x59cde5){return _0x4a88d4[_0x24ab('0x1f')](_0x255e35);}return _0x4a88d4[_0x24ab('0x20')](_0x255e35)[_0x24ab('0x21')]();};}function respondWithResult(_0x5dd4d0,_0x18b7f8){_0x18b7f8=_0x18b7f8||0xc8;return function(_0x3c8ac7){if(_0x3c8ac7){return _0x5dd4d0[_0x24ab('0x20')](_0x18b7f8)[_0x24ab('0x22')](_0x3c8ac7);}};}function respondWithFilteredResult(_0x2bde3e,_0x5c6c51){return function(_0x2cc916){if(_0x2cc916){var _0x44a7dc=typeof _0x5c6c51[_0x24ab('0x23')]===_0x24ab('0x24')&&typeof _0x5c6c51['limit']==='undefined';var _0x315b13=_0x2cc916['count'];var _0x4338f0=_0x44a7dc?0x0:_0x5c6c51['offset'];var _0x3b9e90=_0x44a7dc?_0x2cc916[_0x24ab('0x25')]:_0x5c6c51[_0x24ab('0x23')]+_0x5c6c51[_0x24ab('0x26')];var _0x2a5384;if(_0x3b9e90>=_0x315b13){_0x3b9e90=_0x315b13;_0x2a5384=0xc8;}else{_0x2a5384=0xce;}_0x2bde3e[_0x24ab('0x20')](_0x2a5384);return _0x2bde3e[_0x24ab('0x27')](_0x24ab('0x28'),_0x4338f0+'-'+_0x3b9e90+'/'+_0x315b13)[_0x24ab('0x22')](_0x2cc916);}return null;};}function patchUpdates(_0x4a4dab){return function(_0x5a9199){try{jsonpatch['apply'](_0x5a9199,_0x4a4dab,!![]);}catch(_0x430325){return BPromise[_0x24ab('0x29')](_0x430325);}return _0x5a9199['save']();};}function saveUpdates(_0x4ace40,_0x3c4006){return function(_0x3c9a77){if(_0x3c9a77){return _0x3c9a77[_0x24ab('0x2a')](_0x4ace40)[_0x24ab('0x2b')](function(_0xf761fb){return _0xf761fb;});}return null;};}function removeEntity(_0x206fc6,_0x1b486b){return function(_0x49e7a3){if(_0x49e7a3){return _0x49e7a3['destroy']()[_0x24ab('0x2b')](function(){var _0x34dc84=_0x49e7a3['get']({'plain':!![]});var _0x355b63='Plugins';return db[_0x24ab('0x2c')][_0x24ab('0x2d')]({'where':{'type':_0x355b63,'resourceId':_0x34dc84['id']}})[_0x24ab('0x2b')](function(){return _0x49e7a3;});})[_0x24ab('0x2b')](function(){_0x206fc6[_0x24ab('0x20')](0xcc)[_0x24ab('0x21')]();});}};}function handleEntityNotFound(_0x5ab076,_0x3de933){return function(_0x5bb6be){if(!_0x5bb6be){_0x5ab076[_0x24ab('0x1f')](0x194);}return _0x5bb6be;};}function handleError(_0x28369c,_0xcd0a65){_0xcd0a65=_0xcd0a65||0x1f4;return function(_0x5058e0){logger['error'](_0x5058e0[_0x24ab('0x2e')]);if(_0x5058e0[_0x24ab('0x2f')]){delete _0x5058e0[_0x24ab('0x2f')];}_0x28369c['status'](_0xcd0a65)[_0x24ab('0x30')](_0x5058e0);};}exports['index']=function(_0xa675d5,_0x3ab8c8){var _0x3747d1={},_0x5333b8={},_0x83945b={'count':0x0,'rows':[]};var _0x5d7ac1=_[_0x24ab('0x31')](db[_0x24ab('0x32')][_0x24ab('0x33')],function(_0x217512){return{'name':_0x217512[_0x24ab('0x34')],'type':_0x217512[_0x24ab('0x35')][_0x24ab('0x36')]};});_0x5333b8[_0x24ab('0x37')]=_[_0x24ab('0x31')](_0x5d7ac1,_0x24ab('0x2f'));_0x5333b8[_0x24ab('0x38')]=_[_0x24ab('0x39')](_0xa675d5[_0x24ab('0x38')]);_0x5333b8[_0x24ab('0x3a')]=_[_0x24ab('0x3b')](_0x5333b8[_0x24ab('0x37')],_0x5333b8[_0x24ab('0x38')]);_0x3747d1[_0x24ab('0x3c')]=_['intersection'](_0x5333b8['model'],qs[_0x24ab('0x3d')](_0xa675d5['query'][_0x24ab('0x3d')]));_0x3747d1['attributes']=_0x3747d1['attributes'][_0x24ab('0x3e')]?_0x3747d1[_0x24ab('0x3c')]:_0x5333b8[_0x24ab('0x37')];if(!_0xa675d5['query'][_0x24ab('0x3f')](_0x24ab('0x40'))){_0x3747d1['limit']=qs[_0x24ab('0x26')](_0xa675d5[_0x24ab('0x38')][_0x24ab('0x26')]);_0x3747d1['offset']=qs[_0x24ab('0x23')](_0xa675d5[_0x24ab('0x38')][_0x24ab('0x23')]);}_0x3747d1[_0x24ab('0x41')]=qs[_0x24ab('0x42')](_0xa675d5['query'][_0x24ab('0x42')]);_0x3747d1['where']=qs[_0x24ab('0x3a')](_[_0x24ab('0x43')](_0xa675d5[_0x24ab('0x38')],_0x5333b8['filters']),_0x5d7ac1);if(_0xa675d5[_0x24ab('0x38')][_0x24ab('0x44')]){_0x3747d1[_0x24ab('0x45')]=_[_0x24ab('0x46')](_0x3747d1[_0x24ab('0x45')],{'$or':_[_0x24ab('0x31')](_0x5d7ac1,function(_0x100f04){if(_0x100f04[_0x24ab('0x35')]!==_0x24ab('0x47')){var _0x2d231c={};_0x2d231c[_0x100f04[_0x24ab('0x2f')]]={'$like':'%'+_0xa675d5[_0x24ab('0x38')]['filter']+'%'};return _0x2d231c;}})});}_0x3747d1=_[_0x24ab('0x46')]({},_0x3747d1,_0xa675d5[_0x24ab('0x48')]);var _0x5f13a5={'where':_0x3747d1[_0x24ab('0x45')]};return db[_0x24ab('0x32')][_0x24ab('0x25')](_0x5f13a5)[_0x24ab('0x2b')](function(_0x51207c){_0x83945b[_0x24ab('0x25')]=_0x51207c;if(_0xa675d5['query']['includeAll']){_0x3747d1[_0x24ab('0x49')]=[{'all':!![]}];}return db[_0x24ab('0x32')]['findAll'](_0x3747d1);})[_0x24ab('0x2b')](function(_0x24868c){_0x83945b[_0x24ab('0x4a')]=_0x24868c;return _0x83945b;})[_0x24ab('0x2b')](respondWithFilteredResult(_0x3ab8c8,_0x3747d1))[_0x24ab('0x4b')](handleError(_0x3ab8c8,null));};exports[_0x24ab('0x4c')]=function(_0x3fea37,_0x1c1b5e){var _0x4afdc0={'raw':!![],'where':{'id':_0x3fea37['params']['id']}},_0x18fa7e={};_0x18fa7e[_0x24ab('0x37')]=_[_0x24ab('0x39')](db[_0x24ab('0x32')][_0x24ab('0x33')]);_0x18fa7e[_0x24ab('0x38')]=_[_0x24ab('0x39')](_0x3fea37[_0x24ab('0x38')]);_0x18fa7e[_0x24ab('0x3a')]=_['intersection'](_0x18fa7e[_0x24ab('0x37')],_0x18fa7e['query']);_0x4afdc0[_0x24ab('0x3c')]=_[_0x24ab('0x3b')](_0x18fa7e[_0x24ab('0x37')],qs[_0x24ab('0x3d')](_0x3fea37[_0x24ab('0x38')][_0x24ab('0x3d')]));_0x4afdc0[_0x24ab('0x3c')]=_0x4afdc0[_0x24ab('0x3c')][_0x24ab('0x3e')]?_0x4afdc0[_0x24ab('0x3c')]:_0x18fa7e[_0x24ab('0x37')];if(_0x3fea37[_0x24ab('0x38')][_0x24ab('0x4d')]){_0x4afdc0['include']=[{'all':!![]}];}_0x4afdc0=_['merge']({},_0x4afdc0,_0x3fea37[_0x24ab('0x48')]);return db['Plugin'][_0x24ab('0x4e')](_0x4afdc0)[_0x24ab('0x2b')](handleEntityNotFound(_0x1c1b5e,null))[_0x24ab('0x2b')](respondWithResult(_0x1c1b5e,null))[_0x24ab('0x4b')](handleError(_0x1c1b5e,null));};exports[_0x24ab('0x4f')]=function(_0x50bab7,_0x211f69,_0x299c03){return db[_0x24ab('0x32')][_0x24ab('0x4e')]({'where':{'id':_0x50bab7[_0x24ab('0x50')]['id']},'attributes':[_0x24ab('0x2f'),'path'],'raw':!![]})[_0x24ab('0x2b')](handleEntityNotFound(_0x211f69,null))[_0x24ab('0x2b')](function(_0x3c41cb){if(_0x3c41cb){var _0x5109c8=path[_0x24ab('0x51')](config[_0x24ab('0x52')],_0x24ab('0x53'),util['format'](_0x24ab('0x54'),path[_0x24ab('0x55')](_0x3c41cb['path'])));var _0x5ab778=fs['createWriteStream'](_0x5109c8);var _0x54f96d=archiver(_0x24ab('0x56'),{'zlib':{'level':0x9}});_0x54f96d['on'](_0x24ab('0x57'),function(_0x353642){if(_0x353642['code']==='ENOENT'){logger[_0x24ab('0x58')](_0x353642);}else{throw new db[(_0x24ab('0x59'))][(_0x24ab('0x5a'))](_0x24ab('0x5b'));}});_0x54f96d['on'](_0x24ab('0x58'),function(_0x5231bb){throw new db[(_0x24ab('0x59'))][(_0x24ab('0x5a'))](_0x24ab('0x5b'));});_0x54f96d[_0x24ab('0x5c')](_0x5ab778);_0x54f96d[_0x24ab('0x5d')](_0x24ab('0x5e'),{'cwd':path[_0x24ab('0x51')](config['root'],_0x24ab('0x53'),path['dirname'](_0x3c41cb['path'])),'ignore':[path['join'](path['basename'](_0x3c41cb[_0x24ab('0x7')]),_0x24ab('0x5f')),path[_0x24ab('0x51')](path['basename'](_0x3c41cb['path']),_0x24ab('0x60'))],'nodir':!![]})[_0x24ab('0x61')]();_0x5ab778['on'](_0x24ab('0x62'),function(){if(!fs[_0x24ab('0x63')](_0x5109c8)){throw new db['Sequelize'][(_0x24ab('0x5a'))](_0x24ab('0x64'));}return _0x211f69[_0x24ab('0x4f')](_0x5109c8,util[_0x24ab('0x65')]('%s.zip',path[_0x24ab('0x55')](_0x3c41cb[_0x24ab('0x7')])),function(_0x5148fc){if(_0x5148fc){throw new db[(_0x24ab('0x59'))][(_0x24ab('0x5a'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x24ab('0x66')](_0x5109c8);logger[_0x24ab('0x67')](_0x24ab('0x68'));logger[_0x24ab('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0x24ab('0x4b')](handleError(_0x211f69,null));};exports[_0x24ab('0x69')]=function(_0x123cbf,_0x36de99,_0x24e2a6){var _0x2fa455=path[_0x24ab('0x55')](_0x123cbf[_0x24ab('0x6a')][_0x24ab('0x6b')],path[_0x24ab('0x6c')](_0x123cbf[_0x24ab('0x6a')]['filename']));var _0x3afacb=path[_0x24ab('0x51')](config['root'],_0x24ab('0x53'),_0x123cbf[_0x24ab('0x6a')][_0x24ab('0x6b')]);var _0x96fdd5=path[_0x24ab('0x51')](config[_0x24ab('0x52')],_0x24ab('0x53'),_0x2fa455);logger['info'](_0x24ab('0x6d'),_0x3afacb);logger[_0x24ab('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x96fdd5);try{fs[_0x24ab('0x6e')](_0x3afacb,parseInt('0777',0x8));extract(_0x3afacb,{'dir':_0x96fdd5},function(_0x4dfdd2){if(_0x4dfdd2){logger[_0x24ab('0x58')](_0x4dfdd2);handleError(_0x4dfdd2,!![]);};var _0x4d6f6c=fs[_0x24ab('0x6f')](_0x96fdd5);if(_0x4d6f6c[_0x24ab('0x3e')]>0x1){removeReferences(_0x3afacb,_0x96fdd5);logger['error'](_0x24ab('0x70'));return _0x24e2a6(new Error(_0x24ab('0x70')));}var _0x2eba1d=fs[_0x24ab('0x71')](path['join'](_0x96fdd5,_0x4d6f6c[0x0]));if(_0x2eba1d[_0x24ab('0x72')]()){removeReferences(_0x3afacb,_0x96fdd5);logger[_0x24ab('0x58')](_0x24ab('0x70'));return _0x24e2a6(new Error(_0x24ab('0x70')));}if(_0x2eba1d[_0x24ab('0x73')]()){var _0x38e27f=fs['readdirSync'](path[_0x24ab('0x51')](_0x96fdd5,_0x4d6f6c[0x0]));if(_0x38e27f['length']===0x0){removeReferences(_0x3afacb,_0x96fdd5);logger[_0x24ab('0x58')](_0x24ab('0x70'));return _0x24e2a6(new Error(_0x24ab('0x70')));}var _0x180f9c=_0x38e27f[_0x24ab('0x74')](function(_0x23facb){return _0x23facb===_0x24ab('0x75');});if(!_0x180f9c){return _0x24e2a6(new Error(_0x24ab('0x76')));}var _0x57221e=fs[_0x24ab('0x77')](path['join'](_0x96fdd5,_0x4d6f6c[0x0],'manifest.json'));var _0x55087d=JSON[_0x24ab('0x78')](_0x57221e);if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x2f')]){return _0x24e2a6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x35')]){return _0x24e2a6(new Error(_0x24ab('0x79')));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7a')]){return _0x24e2a6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x55087d[_0x24ab('0x7b')]){return _0x24e2a6(new Error(_0x24ab('0x7c')));}if(_0x55087d[_0x24ab('0x35')]==='html'){if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')]){return _0x24e2a6(new Error(_0x24ab('0x7e')));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x7f')]&&_0x24ab('0x24')==typeof _0x55087d['parameters'][_0x24ab('0x7d')][_0x24ab('0x80')]){return _0x24e2a6(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x55087d[_0x24ab('0x35')]===_0x24ab('0x81')){if('undefined'==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x82')]){return _0x24e2a6(new Error(_0x24ab('0x83')));}if(_0x24ab('0x24')==typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x84')]){return _0x24e2a6(new Error(_0x24ab('0x85')));}}else{return _0x24e2a6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x190ebd=_0x55087d[_0x24ab('0x2f')];var _0x2409cf=_0x55087d[_0x24ab('0x86')];var _0x446328=_0x55087d['type'];var _0x2416e2=_0x55087d[_0x24ab('0x87')]?_0x55087d[_0x24ab('0x87')]:_0x24ab('0x88');var _0x70d504=_0x55087d[_0x24ab('0x89')]?_0x55087d['icon']:_0x24ab('0x8a');var _0xede5e0='';var _0x457581='';var _0x4d812b='';var _0xbed395='';var _0x17db13=_0x55087d['version'];if(_0x446328===_0x24ab('0x8b')){if(_0x24ab('0x24')!=typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x7f')]){var _0x2f064e=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x24ab('0x8c')](_0x2f064e)){_0xede5e0=path[_0x24ab('0x51')](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x2f064e);}else{_0xede5e0=_0x2f064e;}}else{logger[_0x24ab('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x24ab('0x24')!=typeof _0x55087d['parameters'][_0x24ab('0x7d')][_0x24ab('0x80')]){var _0x505996=_0x55087d['parameters']['views'][_0x24ab('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x505996)){_0x457581=path['join'](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x505996);}else{_0x457581=_0x505996;}}else{logger[_0x24ab('0x67')](_0x24ab('0x8e'));}}else if(_0x446328===_0x24ab('0x81')){_0x4d812b=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x82')];_0xbed395=_0x55087d['parameters'][_0x24ab('0x84')];if(_0x24ab('0x24')!=typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')]){if(_0x24ab('0x24')!=typeof _0x55087d[_0x24ab('0x7b')]['views'][_0x24ab('0x7f')]){var _0x2f064e=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2f064e)){_0xede5e0=path[_0x24ab('0x51')](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x2f064e);}else{_0xede5e0=_0x2f064e;}}if('undefined'!=typeof _0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x80')]){var _0x505996=_0x55087d[_0x24ab('0x7b')][_0x24ab('0x7d')][_0x24ab('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x24ab('0x8c')](_0x505996)){_0x457581=path[_0x24ab('0x51')](_0x24ab('0x8d'),_0x2fa455,_0x4d6f6c[0x0],_0x505996);}else{_0x457581=_0x505996;}}}}var _0x2c98a2={'name':_0x190ebd,'description':_0x2409cf,'path':path[_0x24ab('0x51')](_0x2fa455,_0x4d6f6c[0x0]),'type':_0x446328,'sidebar':_0x2416e2,'icon':_0x70d504,'adminUrl':_0xede5e0,'agentUrl':_0x457581,'scriptName':_0x4d812b,'scriptPath':_0xbed395,'version':_0x17db13};removeReferences(_0x3afacb,null);return db[_0x24ab('0x32')][_0x24ab('0x8f')](_0x2c98a2)[_0x24ab('0x2b')](function(_0xaf5a6f){var _0x194320={'role':_0x123cbf['body'][_0x24ab('0x90')],'userProfileId':_0x123cbf[_0x24ab('0x91')][_0x24ab('0x92')]};if(!_0x194320)throw new Error(_0x24ab('0x93'));if(_0x194320[_0x24ab('0x90')]==='user'){var _0x109a51=_0xaf5a6f[_0x24ab('0x94')]({'plain':!![]});return db['UserProfileSection'][_0x24ab('0x4e')]({'where':{'name':_0x24ab('0x95'),'userProfileId':_0x194320[_0x24ab('0x92')]},'raw':!![]})[_0x24ab('0x2b')](function(_0x11c525){if(_0x11c525&&_0x11c525[_0x24ab('0x96')]===0x0){return db[_0x24ab('0x2c')][_0x24ab('0x8f')]({'name':_0x109a51[_0x24ab('0x2f')],'resourceId':_0x109a51['id'],'type':_0x11c525[_0x24ab('0x2f')],'sectionId':_0x11c525['id']},{})[_0x24ab('0x2b')](function(){return _0xaf5a6f;});}else{return _0xaf5a6f;}})[_0x24ab('0x4b')](function(_0x414a32){logger[_0x24ab('0x58')](_0x24ab('0x97'),_0x414a32);throw _0x414a32;});}return _0xaf5a6f;})[_0x24ab('0x2b')](respondWithResult(_0x36de99,null))[_0x24ab('0x4b')](handleError(_0x36de99,null));}});}catch(_0x4fb4b6){_0x36de99[_0x24ab('0x20')](0x1f4)[_0x24ab('0x30')](_0x4fb4b6);}};function removeReferences(_0x4eb26b,_0x5940b8){try{if(_0x4eb26b){fs[_0x24ab('0x66')](_0x4eb26b);logger[_0x24ab('0x67')]('Zip\x20archive\x20removed');}if(_0x5940b8){rimraf(_0x5940b8,function(){});logger[_0x24ab('0x67')](_0x24ab('0x98'));}}catch(_0x14e606){logger['error'](_0x14e606);}}exports[_0x24ab('0x2a')]=function(_0x2b227b,_0x5ac2da,_0x545483){return db[_0x24ab('0x32')][_0x24ab('0x4e')]({'where':{'id':_0x2b227b['params']['id']}})[_0x24ab('0x2b')](handleEntityNotFound(_0x5ac2da,null))[_0x24ab('0x2b')](saveUpdates(_0x2b227b[_0x24ab('0x91')],null))[_0x24ab('0x2b')](respondWithResult(_0x5ac2da,null))[_0x24ab('0x4b')](handleError(_0x5ac2da,null));};exports['delete']=function(_0x1d7df9,_0x37ea69,_0x2ba2ad){return db[_0x24ab('0x32')]['find']({'where':{'id':_0x1d7df9[_0x24ab('0x50')]['id']}})[_0x24ab('0x2b')](function(_0x415c53){if(_0x415c53){return _0x415c53['destroy']();}})[_0x24ab('0x2b')](function(_0x98327a){rimraf(path[_0x24ab('0x51')](config[_0x24ab('0x52')],'server/files/plugins',path['dirname'](_0x98327a[_0x24ab('0x7')])),function(){});return _0x98327a;})[_0x24ab('0x2b')](handleEntityNotFound(_0x37ea69,null))[_0x24ab('0x2b')](respondWithStatusCode(_0x37ea69,null))['catch'](handleError(_0x37ea69,null));};exports[_0x24ab('0x99')]=function(_0x2edc67,_0x432266,_0x1b5bfd){return BPromise[_0x24ab('0x9a')]()[_0x24ab('0x2b')](function(){if(!_0x2edc67['query'][_0x24ab('0x7')]){throw new Error(_0x24ab('0x9b'));}if(!_0x2edc67['query'][_0x24ab('0x9c')]){throw new Error(_0x24ab('0x9d'));}var _0x5f2947=_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9e')]?_0x2edc67[_0x24ab('0x38')]['hostname']+':'+_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9c')]:'http://localhost:'+_0x2edc67['query'][_0x24ab('0x9c')];var _0x2cf9f7=_0x2edc67[_0x24ab('0x38')][_0x24ab('0x22')]?_0x2edc67[_0x24ab('0x38')][_0x24ab('0x22')]:!![];var _0x372c8c=_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9f')]?_0x2edc67[_0x24ab('0x38')][_0x24ab('0x9f')]:null;var _0x1465cb={'method':_0x2edc67['method'],'uri':util[_0x24ab('0x65')](_0x24ab('0xa0'),_0x5f2947,_0x2edc67['query'][_0x24ab('0x7')]),'json':_0x2cf9f7,'resolveWithFullResponse':!![],'encoding':_0x372c8c,'qs':_0x2edc67[_0x24ab('0x38')]};if(_0x2edc67[_0x24ab('0xa1')]){_0x1465cb[_0x24ab('0xa1')]=_0x2edc67[_0x24ab('0xa1')];if(_0x1465cb[_0x24ab('0xa1')][_0x24ab('0xa2')]){delete _0x1465cb['headers'][_0x24ab('0xa2')];}}if(_0x1465cb[_0x24ab('0xa1')][_0x24ab('0xa3')]){delete _0x1465cb['headers'][_0x24ab('0xa3')];}return rp(_0x1465cb);})[_0x24ab('0x2b')](function(_0x5b4385){if(_0x5b4385){_0x432266[_0x24ab('0x27')](_0x5b4385[_0x24ab('0xa1')]);logger[_0x24ab('0x67')](_0x5b4385[_0x24ab('0x91')]);if(_[_0x24ab('0xa4')](_0x2edc67[_0x24ab('0x38')][_0x24ab('0x7')],_0x24ab('0x4f'))&&_0x5b4385[_0x24ab('0xa5')]==0x1f4){return _0x432266['sendStatus'](_0x5b4385[_0x24ab('0xa5')]);}else{return _0x432266[_0x24ab('0x20')](_0x5b4385[_0x24ab('0xa5')])[_0x24ab('0x30')](_0x5b4385[_0x24ab('0x91')]);}}else{return _0x432266[_0x24ab('0x1f')](0xc8);}})[_0x24ab('0x4b')](handleError(_0x432266,null));};exports[_0x24ab('0xa6')]=function(_0x3bc019,_0x1521e4,_0x465b15){return BPromise['resolve']()['then'](function(){if(!_0x3bc019[_0x24ab('0x38')][_0x24ab('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3bc019['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x30228f=_0x3bc019[_0x24ab('0x38')][_0x24ab('0x9e')]?_0x3bc019[_0x24ab('0x38')][_0x24ab('0x9e')]+':'+_0x3bc019['query']['port']:'http://localhost:'+_0x3bc019['query'][_0x24ab('0x9c')];var _0x307bbb=_0x3bc019['query'][_0x24ab('0x22')]?_0x3bc019[_0x24ab('0x38')][_0x24ab('0x22')]:!![];var _0x3f6fec=_0x3bc019['query'][_0x24ab('0x9f')]?_0x3bc019[_0x24ab('0x38')][_0x24ab('0x9f')]:null;var _0x2a951a={'method':_0x3bc019[_0x24ab('0xa7')],'uri':util[_0x24ab('0x65')](_0x24ab('0xa0'),_0x30228f,_0x3bc019['query'][_0x24ab('0x7')]),'json':_0x307bbb,'resolveWithFullResponse':!![],'encoding':_0x3f6fec,'body':_0x3bc019[_0x24ab('0x91')]};if(_0x3bc019[_0x24ab('0xa1')]){_0x2a951a[_0x24ab('0xa1')]=_0x3bc019[_0x24ab('0xa1')];if(_0x2a951a['headers'][_0x24ab('0xa2')]){delete _0x2a951a[_0x24ab('0xa1')][_0x24ab('0xa2')];}}if(_0x2a951a[_0x24ab('0xa1')]['content-type']){delete _0x2a951a[_0x24ab('0xa1')][_0x24ab('0xa3')];}return rp(_0x2a951a);})[_0x24ab('0x2b')](function(_0x171a31){if(_0x171a31){_0x1521e4[_0x24ab('0x27')](_0x171a31[_0x24ab('0xa1')]);logger[_0x24ab('0x67')](_0x171a31[_0x24ab('0x91')]);return _0x1521e4['status'](_0x171a31['statusCode'])[_0x24ab('0x30')](_0x171a31['body']);}else{return _0x1521e4['sendStatus'](0xc8);}})[_0x24ab('0x4b')](handleError(_0x1521e4,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d08ddb6..d21e67e 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 _0x8375=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3a91d5,_0xba171c){var _0x376a8a=function(_0x2ce1a4){while(--_0x2ce1a4){_0x3a91d5['push'](_0x3a91d5['shift']());}};_0x376a8a(++_0xba171c);}(_0x8375,0x132));var _0x5837=function(_0x590528,_0x416fe3){_0x590528=_0x590528-0x0;var _0xffef52=_0x8375[_0x590528];return _0xffef52;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5837('0x0'))['db'][_0x5837('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5837('0x2')](0x0);var events={'afterCreate':_0x5837('0x3'),'afterUpdate':_0x5837('0x4'),'afterDestroy':_0x5837('0x5')};function emitEvent(_0x5b8647){return function(_0x2ddfc1,_0x110a7d,_0x5a4701){PluginEvents[_0x5837('0x6')](_0x5b8647+':'+_0x2ddfc1['id'],_0x2ddfc1);PluginEvents[_0x5837('0x6')](_0x5b8647,_0x2ddfc1);_0x5a4701(null);};}for(var e in events){if(events[_0x5837('0x7')](e)){var event=events[e];Plugin[_0x5837('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x7dee=['remove','emit','hasOwnProperty','hook','exports','events','Plugin','save','update'];(function(_0x29dc54,_0x2cc32e){var _0xaabea6=function(_0x172357){while(--_0x172357){_0x29dc54['push'](_0x29dc54['shift']());}};_0xaabea6(++_0x2cc32e);}(_0x7dee,0xb0));var _0xe7de=function(_0x85ad7b,_0x4b2f88){_0x85ad7b=_0x85ad7b-0x0;var _0x1bf56d=_0x7dee[_0x85ad7b];return _0x1bf56d;};'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 9c92613..fea3172 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 _0x0374=['plugins','lodash','util','../../config/logger','api','moment','bluebird','path','./plugin.attributes','exports','define','Plugin'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x0374,0x169));var _0x4037=function(_0x50835a,_0x2f74d4){_0x50835a=_0x50835a-0x0;var _0x4a09c7=_0x0374[_0x50835a];return _0x4a09c7;};'use strict';var _=require(_0x4037('0x0'));var util=require(_0x4037('0x1'));var logger=require(_0x4037('0x2'))(_0x4037('0x3'));var moment=require(_0x4037('0x4'));var BPromise=require(_0x4037('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4037('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4037('0x7'));module[_0x4037('0x8')]=function(_0x53874a,_0x7a72a){return _0x53874a[_0x4037('0x9')](_0x4037('0xa'),attributes,{'tableName':_0x4037('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee4=['plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','Plugin'];(function(_0x1fd043,_0x242e0f){var _0x2782a1=function(_0x1388f9){while(--_0x1388f9){_0x1fd043['push'](_0x1fd043['shift']());}};_0x2782a1(++_0x242e0f);}(_0x7ee4,0xbc));var _0x47ee=function(_0x5891aa,_0x2baf88){_0x5891aa=_0x5891aa-0x0;var _0xabe03d=_0x7ee4[_0x5891aa];return _0xabe03d;};'use strict';var _=require(_0x47ee('0x0'));var util=require(_0x47ee('0x1'));var logger=require('../../config/logger')(_0x47ee('0x2'));var moment=require(_0x47ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x47ee('0x4'));var fs=require('fs');var path=require(_0x47ee('0x5'));var rimraf=require('rimraf');var config=require(_0x47ee('0x6'));var attributes=require('./plugin.attributes');module[_0x47ee('0x7')]=function(_0x9054da,_0x25d96e){return _0x9054da[_0x47ee('0x8')](_0x47ee('0x9'),attributes,{'tableName':_0x47ee('0xa'),'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 714a039..5ffaef3 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 _0xb7cb=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./plugin.socket','request','info','request\x20sent','debug'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb7cb,0x157));var _0xbb7c=function(_0x57a97a,_0x3672e9){_0x57a97a=_0x57a97a-0x0;var _0x12a961=_0xb7cb[_0x57a97a];return _0x12a961;};'use strict';var _=require(_0xbb7c('0x0'));var util=require(_0xbb7c('0x1'));var moment=require(_0xbb7c('0x2'));var BPromise=require(_0xbb7c('0x3'));var rs=require(_0xbb7c('0x4'));var fs=require('fs');var Redis=require(_0xbb7c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb7c('0x6'));var logger=require(_0xbb7c('0x7'))(_0xbb7c('0x8'));var config=require('../../config/environment');var jayson=require(_0xbb7c('0x9'));var client=jayson[_0xbb7c('0xa')][_0xbb7c('0xb')]({'port':0x232a});config['redis']=_[_0xbb7c('0xc')](config[_0xbb7c('0xd')],{'host':_0xbb7c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbb7c('0xf'))['register'](socket);function respondWithRpcPromise(_0x4f7518,_0x4ecf61,_0x5df55d){return new BPromise(function(_0x253065,_0x712e7e){return client[_0xbb7c('0x10')](_0x4f7518,_0x5df55d)['then'](function(_0xee8575){logger[_0xbb7c('0x11')]('Plugin,\x20%s,\x20%s',_0x4ecf61,_0xbb7c('0x12'));logger[_0xbb7c('0x13')](_0xbb7c('0x14'),_0x4ecf61,_0xbb7c('0x12'),JSON[_0xbb7c('0x15')](_0xee8575));if(_0xee8575[_0xbb7c('0x16')]){if(_0xee8575[_0xbb7c('0x16')][_0xbb7c('0x17')]===0x1f4){logger[_0xbb7c('0x16')](_0xbb7c('0x18'),_0x4ecf61,_0xee8575['error'][_0xbb7c('0x19')]);return _0x712e7e(_0xee8575['error'][_0xbb7c('0x19')]);}logger[_0xbb7c('0x16')](_0xbb7c('0x18'),_0x4ecf61,_0xee8575['error'][_0xbb7c('0x19')]);return _0x253065(_0xee8575[_0xbb7c('0x16')]['message']);}else{logger[_0xbb7c('0x11')](_0xbb7c('0x18'),_0x4ecf61,'request\x20sent');_0x253065(_0xee8575[_0xbb7c('0x1a')][_0xbb7c('0x19')]);}})[_0xbb7c('0x1b')](function(_0x5b1cec){logger[_0xbb7c('0x16')](_0xbb7c('0x18'),_0x4ecf61,_0x5b1cec);_0x712e7e(_0x5b1cec);});});}exports[_0xbb7c('0x1c')]=function(_0x2dbb83){var _0x2005f1=this;return new Promise(function(_0x277ce5,_0x47fea9){return db[_0xbb7c('0x1d')][_0xbb7c('0x1e')](_0x2dbb83[_0xbb7c('0x1f')],{'raw':_0x2dbb83['options']?_0x2dbb83[_0xbb7c('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x14d786){logger[_0xbb7c('0x11')](_0xbb7c('0x1c'),_0x2dbb83);logger[_0xbb7c('0x13')](_0xbb7c('0x1c'),_0x2dbb83,JSON[_0xbb7c('0x15')](_0x14d786));_0x277ce5(_0x14d786);})[_0xbb7c('0x1b')](function(_0x1161ba){logger['error'](_0xbb7c('0x1c'),_0x1161ba['message'],_0x2dbb83);_0x47fea9(_0x2005f1[_0xbb7c('0x16')](0x1f4,_0x1161ba[_0xbb7c('0x19')]));});});}; \ No newline at end of file +var _0xff8a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CreatePlugin','Plugin','create','options','raw','debug','catch','util'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xff8a,0x17f));var _0xaff8=function(_0x44f670,_0x782e5c){_0x44f670=_0x44f670-0x0;var _0x5b6128=_0xff8a[_0x44f670];return _0x5b6128;};'use strict';var _=require('lodash');var util=require(_0xaff8('0x0'));var moment=require(_0xaff8('0x1'));var BPromise=require(_0xaff8('0x2'));var rs=require(_0xaff8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaff8('0x4'))['db'];var utils=require(_0xaff8('0x5'));var logger=require(_0xaff8('0x6'))(_0xaff8('0x7'));var config=require(_0xaff8('0x8'));var jayson=require(_0xaff8('0x9'));var client=jayson[_0xaff8('0xa')][_0xaff8('0xb')]({'port':0x232a});config[_0xaff8('0xc')]=_[_0xaff8('0xd')](config[_0xaff8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaff8('0xe'))(new Redis(config[_0xaff8('0xc')]));require(_0xaff8('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fcc82,_0x4f87c9,_0x42cc83){return new BPromise(function(_0x355aa9,_0x4ce3fe){return client[_0xaff8('0x10')](_0x3fcc82,_0x42cc83)[_0xaff8('0x11')](function(_0x2cd1fa){logger['info'](_0xaff8('0x12'),_0x4f87c9,_0xaff8('0x13'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x4f87c9,_0xaff8('0x13'),JSON[_0xaff8('0x14')](_0x2cd1fa));if(_0x2cd1fa['error']){if(_0x2cd1fa['error']['code']===0x1f4){logger['error'](_0xaff8('0x12'),_0x4f87c9,_0x2cd1fa[_0xaff8('0x15')][_0xaff8('0x16')]);return _0x4ce3fe(_0x2cd1fa[_0xaff8('0x15')][_0xaff8('0x16')]);}logger[_0xaff8('0x15')](_0xaff8('0x12'),_0x4f87c9,_0x2cd1fa[_0xaff8('0x15')][_0xaff8('0x16')]);return _0x355aa9(_0x2cd1fa['error'][_0xaff8('0x16')]);}else{logger[_0xaff8('0x17')]('Plugin,\x20%s,\x20%s',_0x4f87c9,'request\x20sent');_0x355aa9(_0x2cd1fa[_0xaff8('0x18')][_0xaff8('0x16')]);}})['catch'](function(_0x3adcc0){logger[_0xaff8('0x15')](_0xaff8('0x12'),_0x4f87c9,_0x3adcc0);_0x4ce3fe(_0x3adcc0);});});}exports[_0xaff8('0x19')]=function(_0x5f5d58){var _0x172685=this;return new Promise(function(_0x1c35ab,_0x195dec){return db[_0xaff8('0x1a')][_0xaff8('0x1b')](_0x5f5d58['body'],{'raw':_0x5f5d58['options']?_0x5f5d58[_0xaff8('0x1c')][_0xaff8('0x1d')]===undefined?!![]:![]:!![]})[_0xaff8('0x11')](function(_0x20fa72){logger[_0xaff8('0x17')](_0xaff8('0x19'),_0x5f5d58);logger[_0xaff8('0x1e')](_0xaff8('0x19'),_0x5f5d58,JSON['stringify'](_0x20fa72));_0x1c35ab(_0x20fa72);})[_0xaff8('0x1f')](function(_0x3fd4a1){logger[_0xaff8('0x15')](_0xaff8('0x19'),_0x3fd4a1[_0xaff8('0x16')],_0x5f5d58);_0x195dec(_0x172685[_0xaff8('0x15')](0x1f4,_0x3fd4a1['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f0e1126..86a4b8f 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 _0xff0f=['register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xff0f,0x6b));var _0xfff0=function(_0x31ae9d,_0x206e7b){_0x31ae9d=_0x31ae9d-0x0;var _0x2996cf=_0xff0f[_0x31ae9d];return _0x2996cf;};'use strict';var PluginEvents=require(_0xfff0('0x0'));var events=[_0xfff0('0x1'),_0xfff0('0x2'),_0xfff0('0x3')];function createListener(_0x124a6f,_0x231519){return function(_0x6d2589){_0x231519[_0xfff0('0x4')](_0x124a6f,_0x6d2589);};}function removeListener(_0x24d279,_0x4858b8){return function(){PluginEvents['removeListener'](_0x24d279,_0x4858b8);};}exports[_0xfff0('0x5')]=function(_0x59942b){for(var _0x2b8abb=0x0,_0x15ccfb=events['length'];_0x2b8abb<_0x15ccfb;_0x2b8abb++){var _0x44173a=events[_0x2b8abb];var _0x108c5e=createListener(_0xfff0('0x6')+_0x44173a,_0x59942b);PluginEvents['on'](_0x44173a,_0x108c5e);}}; \ No newline at end of file +var _0xec4a=['./plugin.events','update','emit','removeListener','register','plugin:'];(function(_0x24aff5,_0x5b15a1){var _0x45a8e2=function(_0x5e2694){while(--_0x5e2694){_0x24aff5['push'](_0x24aff5['shift']());}};_0x45a8e2(++_0x5b15a1);}(_0xec4a,0xc0));var _0xaec4=function(_0x49739e,_0x78b282){_0x49739e=_0x49739e-0x0;var _0x20be57=_0xec4a[_0x49739e];return _0x20be57;};'use strict';var PluginEvents=require(_0xaec4('0x0'));var events=['save','remove',_0xaec4('0x1')];function createListener(_0x53f827,_0xa746a8){return function(_0x2355c3){_0xa746a8[_0xaec4('0x2')](_0x53f827,_0x2355c3);};}function removeListener(_0x37091b,_0x1d0181){return function(){PluginEvents[_0xaec4('0x3')](_0x37091b,_0x1d0181);};}exports[_0xaec4('0x4')]=function(_0x43cd2c){for(var _0x241bac=0x0,_0x16d418=events['length'];_0x241bac<_0x16d418;_0x241bac++){var _0x73894a=events[_0x241bac];var _0x16a928=createListener(_0xaec4('0x5')+_0x73894a,_0x43cd2c);PluginEvents['on'](_0x73894a,_0x16a928);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9bf25f4..3728702 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(_0x5d86c8,_0x5525e8){var _0x4719eb=function(_0x2904dc){while(--_0x2904dc){_0x5d86c8['push'](_0x5d86c8['shift']());}};_0x4719eb(++_0x5525e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x357972,_0x11b862){var _0x34dd02=function(_0x7be935){while(--_0x7be935){_0x357972['push'](_0x357972['shift']());}};_0x34dd02(++_0x11b862);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 bb40592..79586dd 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 _0xb332=['dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20id','lodash','../../config/logger','api','child_process','bluebird','sendStatus','error','stack','name','status','send','npm\x20install','info','list','reject','motion2','length','then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb332,0xd9));var _0x2b33=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0xb332[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x2b33('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x2b33('0x1'))(_0x2b33('0x2'));var path=require('path');var exec=require(_0x2b33('0x3'))['exec'];var BPromise=require(_0x2b33('0x4'));function handleEntityNotFound(_0x4c6634,_0x34b111){return function(_0x5e5e86){if(!_0x5e5e86){_0x4c6634[_0x2b33('0x5')](0x194);;}return _0x5e5e86;};}function respondWithResult(_0x22d66,_0x478214){_0x478214=_0x478214||0xc8;return function(_0x461d44){if(_0x461d44){return _0x22d66['status'](_0x478214)['json'](_0x461d44);}return null;};}function handleError(_0x4302b7,_0x5f29ab){_0x5f29ab=_0x5f29ab||0x1f4;return function(_0xb3aeab){logger[_0x2b33('0x6')](_0xb3aeab[_0x2b33('0x7')]);if(_0xb3aeab[_0x2b33('0x8')]){delete _0xb3aeab['name'];}_0x4302b7[_0x2b33('0x9')](_0x5f29ab)[_0x2b33('0xa')](_0xb3aeab);};}function execChildProcess(){return new BPromise(function(_0x1be19d,_0x1d83a6){exec(_0x2b33('0xb'),function(_0xf1e5e5,_0x5251b,_0x2b106e){logger[_0x2b33('0xc')](_0x5251b);logger[_0x2b33('0xc')](_0x2b106e);if(_0xf1e5e5){logger[_0x2b33('0x6')](_0xf1e5e5);return _0x1d83a6(_0xf1e5e5);}return _0x1be19d(_0x5251b);});});}exports['index']=function(_0x183773,_0xa44d45){return pm2[_0x2b33('0xd')]()['then'](function(_0x173c75){if(_0x173c75){var _0x4d39db=_[_0x2b33('0xe')](_0x173c75,function(_0x17292f){return _0x17292f[_0x2b33('0x8')]==='express'||_0x17292f['name']===_0x2b33('0xf');});return{'rows':_0x4d39db,'count':_0x4d39db[_0x2b33('0x10')]};}return null;})[_0x2b33('0x11')](respondWithResult(_0xa44d45,null))[_0x2b33('0x12')](handleError(_0xa44d45,null));};exports[_0x2b33('0x13')]=function(_0x4d69d0,_0x554ab3){return pm2['describe'](_0x4d69d0[_0x2b33('0x14')]['id'])['then'](respondWithResult(_0x554ab3,null))['then'](handleEntityNotFound(_0x554ab3,null))[_0x2b33('0x12')](handleError(_0x554ab3,null));};exports[_0x2b33('0x15')]=function(_0x205d8f,_0x539c5f){if(_0x205d8f[_0x2b33('0x16')]['name']&&_0x205d8f[_0x2b33('0x16')][_0x2b33('0x17')]){var _0x8c8dc2=path[_0x2b33('0x18')](__dirname,_0x2b33('0x19'),_0x205d8f[_0x2b33('0x16')][_0x2b33('0x17')]);var _0x4fb725=process[_0x2b33('0x1a')]();process[_0x2b33('0x1b')](path[_0x2b33('0x1c')](_0x8c8dc2));return execChildProcess()[_0x2b33('0x11')](function(_0x58998e){process[_0x2b33('0x1b')](_0x4fb725);return pm2[_0x2b33('0x1d')]({'name':_0x205d8f[_0x2b33('0x16')]['name'],'script':_0x8c8dc2});})[_0x2b33('0x11')](function(_0x1b9a48){pm2[_0x2b33('0x1e')]();return _0x1b9a48[0x0];})[_0x2b33('0x11')](respondWithResult(_0x539c5f,0xc9))['catch'](handleError(_0x539c5f,null));}else{return _0x539c5f[_0x2b33('0x9')](0x1f4)['send']({'message':_0x2b33('0x1f')});}};exports['update']=function(_0x2e74d0,_0x341e0e){if(_0x2e74d0['body']['id']){delete _0x2e74d0[_0x2b33('0x16')]['id'];}var _0x53c2ad={'online':_0x2b33('0x20'),'stopped':'stop'};if(_0x53c2ad[_0x2b33('0x21')](_0x2e74d0[_0x2b33('0x16')][_0x2b33('0x9')])){return pm2[_0x53c2ad[_0x2e74d0[_0x2b33('0x16')][_0x2b33('0x9')]]](_0x2e74d0[_0x2b33('0x14')]['id'])[_0x2b33('0x11')](respondWithResult(_0x341e0e,0xc8))[_0x2b33('0x12')](handleError(_0x341e0e,null));}else{return _0x341e0e[_0x2b33('0x9')](0x1f4)[_0x2b33('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x106ea0,_0x2a081c){if(_0x106ea0[_0x2b33('0x16')]['id']){delete _0x106ea0[_0x2b33('0x16')]['id'];}if(_0x106ea0[_0x2b33('0x14')]['id']){return pm2['delete'](_0x106ea0['params']['id'])[_0x2b33('0x11')](function(_0x3d2aaa){pm2[_0x2b33('0x1e')]();return _0x3d2aaa[0x0];})[_0x2b33('0x11')](respondWithResult(_0x2a081c,null))[_0x2b33('0x12')](handleError(_0x2a081c,null));}else{return _0x2a081c[_0x2b33('0x9')](0x1f4)['send']({'message':_0x2b33('0x22')});}}; \ No newline at end of file +var _0x9c44=['exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','motion2','length','catch','body','script','join','../../files/plugins','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','../../config/logger','api','path','child_process'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var exec=require(_0x49c4('0x3'))[_0x49c4('0x4')];var BPromise=require(_0x49c4('0x5'));function handleEntityNotFound(_0x4e0313,_0x4941f1){return function(_0x41a183){if(!_0x41a183){_0x4e0313['sendStatus'](0x194);;}return _0x41a183;};}function respondWithResult(_0xc1278f,_0x6030ae){_0x6030ae=_0x6030ae||0xc8;return function(_0x69bc41){if(_0x69bc41){return _0xc1278f[_0x49c4('0x6')](_0x6030ae)[_0x49c4('0x7')](_0x69bc41);}return null;};}function handleError(_0x511d53,_0x11c586){_0x11c586=_0x11c586||0x1f4;return function(_0x42e4f8){logger[_0x49c4('0x8')](_0x42e4f8[_0x49c4('0x9')]);if(_0x42e4f8['name']){delete _0x42e4f8['name'];}_0x511d53[_0x49c4('0x6')](_0x11c586)[_0x49c4('0xa')](_0x42e4f8);};}function execChildProcess(){return new BPromise(function(_0x58cad7,_0xb611a1){exec(_0x49c4('0xb'),function(_0x4adb3c,_0x536d42,_0x1d19bf){logger[_0x49c4('0xc')](_0x536d42);logger['info'](_0x1d19bf);if(_0x4adb3c){logger[_0x49c4('0x8')](_0x4adb3c);return _0xb611a1(_0x4adb3c);}return _0x58cad7(_0x536d42);});});}exports[_0x49c4('0xd')]=function(_0x5f2fd9,_0x1909fe){return pm2[_0x49c4('0xe')]()[_0x49c4('0xf')](function(_0x2decee){if(_0x2decee){var _0x12777c=_[_0x49c4('0x10')](_0x2decee,function(_0x75ea8){return _0x75ea8[_0x49c4('0x11')]==='express'||_0x75ea8[_0x49c4('0x11')]===_0x49c4('0x12');});return{'rows':_0x12777c,'count':_0x12777c[_0x49c4('0x13')]};}return null;})[_0x49c4('0xf')](respondWithResult(_0x1909fe,null))[_0x49c4('0x14')](handleError(_0x1909fe,null));};exports['show']=function(_0x44e607,_0x2891f4){return pm2['describe'](_0x44e607['params']['id'])[_0x49c4('0xf')](respondWithResult(_0x2891f4,null))[_0x49c4('0xf')](handleEntityNotFound(_0x2891f4,null))[_0x49c4('0x14')](handleError(_0x2891f4,null));};exports['create']=function(_0x24856d,_0x50b151){if(_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')]&&_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]){var _0x382040=path[_0x49c4('0x17')](__dirname,_0x49c4('0x18'),_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]);var _0x578447=process['cwd']();process['chdir'](path[_0x49c4('0x19')](_0x382040));return execChildProcess()['then'](function(_0x592bb8){process[_0x49c4('0x1a')](_0x578447);return pm2[_0x49c4('0x1b')]({'name':_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')],'script':_0x382040});})['then'](function(_0x5850f2){pm2[_0x49c4('0x1c')]();return _0x5850f2[0x0];})[_0x49c4('0xf')](respondWithResult(_0x50b151,0xc9))['catch'](handleError(_0x50b151,null));}else{return _0x50b151[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x1d')});}};exports[_0x49c4('0x1e')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x15')]['id']){delete _0x531d92['body']['id'];}var _0x3800b7={'online':_0x49c4('0x1f'),'stopped':_0x49c4('0x20')};if(_0x3800b7[_0x49c4('0x21')](_0x531d92['body'][_0x49c4('0x6')])){return pm2[_0x3800b7[_0x531d92[_0x49c4('0x15')][_0x49c4('0x6')]]](_0x531d92[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](respondWithResult(_0x543ea2,0xc8))[_0x49c4('0x14')](handleError(_0x543ea2,null));}else{return _0x543ea2[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x23')});}};exports[_0x49c4('0x24')]=function(_0x46f7ea,_0x4ea6ea){if(_0x46f7ea['body']['id']){delete _0x46f7ea['body']['id'];}if(_0x46f7ea[_0x49c4('0x22')]['id']){return pm2[_0x49c4('0x25')](_0x46f7ea[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](function(_0x28eb47){pm2['dump']();return _0x28eb47[0x0];})[_0x49c4('0xf')](respondWithResult(_0x4ea6ea,null))[_0x49c4('0x14')](handleError(_0x4ea6ea,null));}else{return _0x4ea6ea[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 7f98374..6d2c220 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 _0x6db9=['Router','/agents','isAuthenticated','getAgents','/queues','exports'];(function(_0x1eda65,_0x13d2d7){var _0x57d5ad=function(_0xc731b2){while(--_0xc731b2){_0x1eda65['push'](_0x1eda65['shift']());}};_0x57d5ad(++_0x13d2d7);}(_0x6db9,0x114));var _0x96db=function(_0x7c02f7,_0x8ff23b){_0x7c02f7=_0x7c02f7-0x0;var _0x515003=_0x6db9[_0x7c02f7];return _0x515003;};'use strict';var express=require('express');var router=express[_0x96db('0x0')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get'](_0x96db('0x1'),auth[_0x96db('0x2')](),controller[_0x96db('0x3')]);router['get'](_0x96db('0x4'),auth[_0x96db('0x2')](),controller['getQueues']);module[_0x96db('0x5')]=router; \ No newline at end of file +var _0x0525=['getQueues','exports','express','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues'];(function(_0x1f57e7,_0x31455f){var _0xc38613=function(_0x3a13dc){while(--_0x3a13dc){_0x1f57e7['push'](_0x1f57e7['shift']());}};_0xc38613(++_0x31455f);}(_0x0525,0x160));var _0x5052=function(_0x28d65f,_0x5e115b){_0x28d65f=_0x28d65f-0x0;var _0x131ced=_0x0525[_0x28d65f];return _0x131ced;};'use strict';var express=require(_0x5052('0x0'));var router=express[_0x5052('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5052('0x2'));router['get'](_0x5052('0x3'),auth[_0x5052('0x4')](),controller[_0x5052('0x5')]);router[_0x5052('0x6')](_0x5052('0x7'),auth[_0x5052('0x4')](),controller[_0x5052('0x8')]);module[_0x5052('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 64c0f21..9379f35 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 _0x675b=['talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','startCase','Queue','dialActive','dialMethod','join','QueueCampaigns','Queues','name','filter','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api','undefined','limit','count','offset','status','set','Content-Range','getChannels','query','globalStatusFilter','*pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','fields','order','getRealtimeAgents','rows','getAgentIdsByStatus','length','User','rawAttributes','fieldName','type','key','role','getOptions','push','literal','FIELD(id,','Pause','forEach','merge','where','user','userProfileId','online','UserProfile','getResources','map','find','filterAgentAttributes','getAgentStatus','includes','pause','voice','voiceStatus'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x675b,0x192));var _0xb675=function(_0x1e64d0,_0x37b191){_0x1e64d0=_0x1e64d0-0x0;var _0x445f60=_0x675b[_0x1e64d0];return _0x445f60;};'use strict';var _=require(_0xb675('0x0'));var util=require(_0xb675('0x1'));var rta=require(_0xb675('0x2'));var rtq=require(_0xb675('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0xb675('0x4'));var db=require(_0xb675('0x5'))['db'];var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APIHandleError=require(_0xb675('0x6'))['handleError'];function respondWithFilteredResult(_0x271046,_0x18b125){return function(_0x39647d){if(_0x39647d){var _0x34a2b4=typeof _0x18b125['offset']===_0xb675('0x7')&&typeof _0x18b125[_0xb675('0x8')]===_0xb675('0x7');var _0x161718=_0x39647d[_0xb675('0x9')];var _0x3ef7ff=_0x34a2b4?0x0:_0x18b125[_0xb675('0xa')];var _0x14dd31=_0x34a2b4?_0x39647d[_0xb675('0x9')]:_0x18b125[_0xb675('0xa')]+_0x18b125['limit'];var _0x337f5c;if(_0x14dd31>=_0x161718){_0x14dd31=_0x161718;_0x337f5c=0xc8;}else{_0x337f5c=0xce;}_0x271046[_0xb675('0xb')](_0x337f5c);return _0x271046[_0xb675('0xc')](_0xb675('0xd'),_0x3ef7ff+'-'+_0x14dd31+'/'+_0x161718)['json'](_0x39647d);}return null;};}exports['getAgents']=function(_0x148f36,_0x509b55){var _0x8bdd98={'count':0x0,'rows':[]};var _0x3a816e={};var _0x18ee76;var _0x3780b0=utils[_0xb675('0xe')]();var _0x2b7f4f;var _0x3ce072;var _0xaf43da=_0x148f36[_0xb675('0xf')]['globalQueueFilter'];var _0x927b52=_0x148f36[_0xb675('0xf')][_0xb675('0x10')];var _0x41e5d3=_0x148f36[_0xb675('0xf')]['pauseTypeFilter'];var _0x30def2=_0x927b52==='pause'||_0x927b52===_0xb675('0x11')?!![]:![];var _0x2f3911=[];var _0x2cd2f5;var _0x6815;Promise[_0xb675('0x12')]()[_0xb675('0x13')](function(){if(_0x148f36[_0xb675('0xf')]['channel']){if(!utils['isValidChannel'](_0x148f36['query'][_0xb675('0x14')])){throw new APIBadRequestError(util[_0xb675('0x15')](_0xb675('0x16'),_0x148f36[_0xb675('0xf')]['channel']));}_0x18ee76=_0x148f36[_0xb675('0xf')]['channel'][_0xb675('0x17')]();}if(!_0x148f36[_0xb675('0xf')][_0xb675('0x18')]||!_0x148f36['query'][_0xb675('0x18')]['includes'](_0xb675('0x19'))){_0x148f36[_0xb675('0xf')]['sort']=rta[_0xb675('0x1a')](_0x148f36[_0xb675('0xf')][_0xb675('0x18')]);return;}var _0x1e9cef=rta['getUpdatedSortOptions'](_0x148f36['query'][_0xb675('0x18')]);_0x148f36[_0xb675('0xf')][_0xb675('0x18')]=_0x1e9cef[_0xb675('0x1b')]['join'](',');_0x2cd2f5=_0x1e9cef[_0xb675('0x1c')];})['then'](function(){if(!_0xaf43da){return[];}return rta['getAgentIdsByQueues'](_0xaf43da,_0x18ee76);})['then'](function(_0x3afec0){_0x2f3911=_0x3afec0;return rta[_0xb675('0x1d')]();})[_0xb675('0x13')](function(_0x1a9641){_0x3ce072=_0x1a9641[_0xb675('0x1e')];if((!_0x927b52||_0x30def2)&&!_0x2cd2f5){return _0x2f3911;}if(_0x2cd2f5&&!_0x927b52){return rta['getSortedAgentsIdsByStatus'](_0x3ce072,_0x2f3911,_0x2cd2f5);}else{return rta[_0xb675('0x1f')](_0x3ce072,_0x2f3911,_0x927b52);}})[_0xb675('0x13')](function(_0x20b09f){_0x2f3911=_0x20b09f;var _0x35df0a=![];if(_0x2f3911[_0xb675('0x20')]===0x0){if(_0xaf43da||_0x927b52){_0x35df0a=!![];}if(_0x30def2){_0x35df0a=![];}}if(_0x35df0a){return _0x8bdd98;}var _0xbd075a=_['map'](db[_0xb675('0x21')][_0xb675('0x22')],function(_0x20f7a8){return{'name':_0x20f7a8[_0xb675('0x23')],'type':_0x20f7a8[_0xb675('0x24')][_0xb675('0x25')]};});_0x148f36[_0xb675('0xf')][_0xb675('0x26')]='agent';_0x3a816e=qs[_0xb675('0x27')](_0xbd075a,_0x148f36);_0x3a816e['raw']=!![];var _0x5ae98e=[];if(_0x2f3911[_0xb675('0x20')]>0x0){_0x5ae98e[_0xb675('0x28')]({'id':{'$in':_0x2f3911}});if(_0x2cd2f5&&!_0x927b52){_0x6815=[db['sequelize'][_0xb675('0x29')](_0xb675('0x2a')+_0x2f3911+')')];_0x3a816e[_0xb675('0x1c')]=_0x6815;}}if(_0x30def2){_0x3780b0['forEach'](function(_0x12476c){var _0x28aea8=!![];if(_0x927b52===_0xb675('0x11')&&_0x18ee76!==_0x12476c){_0x28aea8=![];}_0x5ae98e[_0xb675('0x28')]({[_0x12476c+_0xb675('0x2b')]:_0x28aea8});});if(_0x41e5d3){_0x5ae98e[_0xb675('0x28')]({'pauseType':_0x41e5d3});}}else if(_0x927b52){_0x3780b0[_0xb675('0x2c')](function(_0x113521){_0x5ae98e[_0xb675('0x28')]({[_0x113521+'Pause']:![]});});}_0x3a816e['where']=_[_0xb675('0x2d')](_0x3a816e[_0xb675('0x2e')],{'$and':_0x5ae98e});if(_0x148f36[_0xb675('0x2f')][_0xb675('0x26')]===_0xb675('0x2f')){var _0x2a49d3={'params':{'id':_0x148f36[_0xb675('0x2f')][_0xb675('0x30')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x2f3911,'customSorting':_0x6815}};if(_0x148f36[_0xb675('0xf')][_0xb675('0x31')]){_0x2a49d3[_0xb675('0xf')][_0xb675('0x31')]=!![];}if(_0x30def2){_0x2a49d3[_0xb675('0xf')]['extraQueryConditions']=_0x5ae98e;}_0x2a49d3[_0xb675('0xf')]=Object['assign'](_0x2a49d3[_0xb675('0xf')],_['omit'](_0x148f36[_0xb675('0xf')],'id'));return db[_0xb675('0x32')][_0xb675('0x33')](_0x2a49d3);}return db[_0xb675('0x21')]['findAndCountAll'](_0x3a816e);})[_0xb675('0x13')](function(_0x2ca6e8){_0x8bdd98['count']=_0x2ca6e8[_0xb675('0x9')];_0x2b7f4f=_0x2ca6e8['rows'];return _0x2b7f4f[_0xb675('0x34')](function(_0x2fc35b){var _0x1724b4=_[_0xb675('0x35')](_0x3ce072,['id',_0x2fc35b['id']]);if(_0x1724b4){var _0x5c7c6d=rta[_0xb675('0x36')](_0x1724b4);_[_0xb675('0x2d')](_0x2fc35b,_0x5c7c6d);}_0x2fc35b[_0xb675('0x19')]=rta[_0xb675('0x37')](_0x2fc35b);if(_0x2fc35b[_0xb675('0x19')][_0xb675('0x38')](_0xb675('0x39'))){_0x3780b0['forEach'](function(_0x3718cb){if(_0x2fc35b[_0x3718cb+_0xb675('0x2b')]){if(_0x3718cb===_0xb675('0x3a')){if(_0x2fc35b[_0xb675('0x3b')]!==_0xb675('0x3c')){_0x2fc35b[_0xb675('0x3b')]=_0xb675('0x39');}}else{_0x2fc35b[_0x3718cb+_0xb675('0x3d')]='pause';}}});}return _0x2fc35b;});})[_0xb675('0x13')](function(_0x31d191){if(!_0x2cd2f5||_0x6815){return _0x31d191;}return rta[_0xb675('0x3e')](_0x31d191,_0x2cd2f5);})[_0xb675('0x13')](function(_0x3602fb){var _0x448887=rta[_0xb675('0x3f')]();_0x8bdd98[_0xb675('0x1e')]=_0x3602fb[_0xb675('0x34')](function(_0x13a079){return _[_0xb675('0x40')](_0x13a079,_0x448887);});return _0x8bdd98;})[_0xb675('0x13')](respondWithFilteredResult(_0x509b55,_0x3a816e))['catch'](APIHandleError(_0x509b55));};exports[_0xb675('0x41')]=function(_0x13ced2,_0x15eecc){var _0x445254={'count':0x0,'rows':[]};var _0x1025c2={};var _0x125e10;var _0x5a65b9;var _0x3f3a9b;Promise[_0xb675('0x12')]()[_0xb675('0x13')](function(){if(_0x13ced2[_0xb675('0xf')][_0xb675('0x14')]){if(!utils['isValidChannel'](_0x13ced2['query'][_0xb675('0x14')])){throw new APIBadRequestError(util[_0xb675('0x15')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x13ced2['query']['channel']));}_0x125e10=_0x13ced2[_0xb675('0xf')]['channel'][_0xb675('0x17')]();}var _0x37c75b=_[_0xb675('0x42')](_0x125e10)+_0xb675('0x43');var _0x5b1e26=_[_0xb675('0x34')](db[_0x37c75b][_0xb675('0x22')],function(_0x5e42cd){return{'name':_0x5e42cd[_0xb675('0x23')],'type':_0x5e42cd[_0xb675('0x24')]['key']};});if(!_0x13ced2[_0xb675('0xf')][_0xb675('0x1b')]){var _0x3b8761=['id','name'];if(_0x125e10===_0xb675('0x3a')){_0x3b8761['push'](_0xb675('0x24'));if(_0x13ced2[_0xb675('0xf')]['type']==='outbound'){_0x3b8761[_0xb675('0x28')]([_0xb675('0x44'),_0xb675('0x45')]);}}_0x13ced2['query'][_0xb675('0x1b')]=_0x3b8761[_0xb675('0x46')](',');}_0x1025c2=qs['getOptions'](_0x5b1e26,_0x13ced2);if(_0x13ced2[_0xb675('0x2f')][_0xb675('0x26')]===_0xb675('0x2f')){var _0xe55bd1={'params':{'id':_0x13ced2[_0xb675('0x2f')][_0xb675('0x30')]},'query':{'section':_0x125e10==='voice'&&_0x13ced2[_0xb675('0xf')][_0xb675('0x24')]==='outbound'?_0xb675('0x47'):_['startCase'](_0x125e10)+_0xb675('0x48'),'type':_0x13ced2['query'][_0xb675('0x24')],'nolimit':!![],'sort':_0xb675('0x49'),'filter':_0x13ced2[_0xb675('0xf')][_0xb675('0x4a')]}};_0xe55bd1[_0xb675('0xf')]=Object['assign'](_0xe55bd1[_0xb675('0xf')],_0x13ced2[_0xb675('0xf')]);delete _0xe55bd1[_0xb675('0xf')]['id'];return db['UserProfile'][_0xb675('0x33')](_0xe55bd1);}return db[_0x37c75b]['findAndCountAll'](_0x1025c2);})[_0xb675('0x13')](function(_0x55c135){_0x445254[_0xb675('0x9')]=_0x55c135['count'];_0x5a65b9=_0x55c135[_0xb675('0x1e')];return rtq['getRealtimeQueues'](_0x13ced2,_0x125e10);})[_0xb675('0x13')](function(_0x1f2012){_0x3f3a9b=_0x1f2012[_0xb675('0x1e')];return rtq[_0xb675('0x4b')](_0x5a65b9,_0x3f3a9b,_0x125e10,_0x13ced2[_0xb675('0xf')][_0xb675('0x24')]);})[_0xb675('0x13')](function(_0x124ee2){_0x445254[_0xb675('0x1e')]=_0x124ee2;return _0x445254;})['then'](respondWithFilteredResult(_0x15eecc,_0x1025c2))[_0xb675('0x4c')](APIHandleError(_0x15eecc));}; \ No newline at end of file +var _0xffc9=['length','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','globalStatus','getAgentStatus','voice','voiceStatus','talking','pause','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','dialActive','dialMethod','QueueCampaigns','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','count','limit','set','Content-Range','json','getAgents','globalQueueFilter','globalStatusFilter','query','pauseTypeFilter','*pause','resolve','then','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','sort','includes','validateSortParameter','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','type','key','role','agent','getOptions','raw'];(function(_0x2e082d,_0x3b43c4){var _0x3b7ce7=function(_0x3fc44e){while(--_0x3fc44e){_0x2e082d['push'](_0x2e082d['shift']());}};_0x3b7ce7(++_0x3b43c4);}(_0xffc9,0xc9));var _0x9ffc=function(_0x9ea38c,_0x9d044c){_0x9ea38c=_0x9ea38c-0x0;var _0x2db088=_0xffc9[_0x9ea38c];return _0x2db088;};'use strict';var _=require(_0x9ffc('0x0'));var util=require(_0x9ffc('0x1'));var rta=require(_0x9ffc('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x9ffc('0x3'));var utils=require(_0x9ffc('0x4'));var db=require(_0x9ffc('0x5'))['db'];var APIBadRequestError=require(_0x9ffc('0x6'))[_0x9ffc('0x7')];var APIHandleError=require(_0x9ffc('0x6'))['handleError'];function respondWithFilteredResult(_0x49cc51,_0x124440){return function(_0x4e9cdd){if(_0x4e9cdd){var _0x4b5d17=typeof _0x124440[_0x9ffc('0x8')]===_0x9ffc('0x9')&&typeof _0x124440['limit']===_0x9ffc('0x9');var _0x4d6985=_0x4e9cdd[_0x9ffc('0xa')];var _0x9cc203=_0x4b5d17?0x0:_0x124440[_0x9ffc('0x8')];var _0x58a6fe=_0x4b5d17?_0x4e9cdd[_0x9ffc('0xa')]:_0x124440[_0x9ffc('0x8')]+_0x124440[_0x9ffc('0xb')];var _0x3621de;if(_0x58a6fe>=_0x4d6985){_0x58a6fe=_0x4d6985;_0x3621de=0xc8;}else{_0x3621de=0xce;}_0x49cc51['status'](_0x3621de);return _0x49cc51[_0x9ffc('0xc')](_0x9ffc('0xd'),_0x9cc203+'-'+_0x58a6fe+'/'+_0x4d6985)[_0x9ffc('0xe')](_0x4e9cdd);}return null;};}exports[_0x9ffc('0xf')]=function(_0x287701,_0x282e1e){var _0x2b86f8={'count':0x0,'rows':[]};var _0x33fb3d={};var _0x3e1085;var _0x40c643=utils['getChannels']();var _0x5b9699;var _0x578f79;var _0xdbc4b=_0x287701['query'][_0x9ffc('0x10')];var _0x10c580=_0x287701['query'][_0x9ffc('0x11')];var _0x29b789=_0x287701[_0x9ffc('0x12')][_0x9ffc('0x13')];var _0x48e7e3=_0x10c580==='pause'||_0x10c580===_0x9ffc('0x14')?!![]:![];var _0x4e75ff=[];var _0x5f2176;var _0x596df9;Promise[_0x9ffc('0x15')]()[_0x9ffc('0x16')](function(){if(_0x287701[_0x9ffc('0x12')]['channel']){if(!utils[_0x9ffc('0x17')](_0x287701[_0x9ffc('0x12')]['channel'])){throw new APIBadRequestError(util['format'](_0x9ffc('0x18'),_0x287701[_0x9ffc('0x12')][_0x9ffc('0x19')]));}_0x3e1085=_0x287701[_0x9ffc('0x12')][_0x9ffc('0x19')]['toLowerCase']();}if(!_0x287701['query'][_0x9ffc('0x1a')]||!_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')][_0x9ffc('0x1b')]('globalStatus')){_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')]=rta[_0x9ffc('0x1c')](_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')]);return;}var _0x19410a=rta['getUpdatedSortOptions'](_0x287701[_0x9ffc('0x12')][_0x9ffc('0x1a')]);_0x287701['query'][_0x9ffc('0x1a')]=_0x19410a[_0x9ffc('0x1d')][_0x9ffc('0x1e')](',');_0x5f2176=_0x19410a[_0x9ffc('0x1f')];})[_0x9ffc('0x16')](function(){if(!_0xdbc4b){return[];}return rta['getAgentIdsByQueues'](_0xdbc4b,_0x3e1085);})[_0x9ffc('0x16')](function(_0x164d91){_0x4e75ff=_0x164d91;return rta[_0x9ffc('0x20')]();})[_0x9ffc('0x16')](function(_0x386ab2){_0x578f79=_0x386ab2[_0x9ffc('0x21')];if((!_0x10c580||_0x48e7e3)&&!_0x5f2176){return _0x4e75ff;}if(_0x5f2176&&!_0x10c580){return rta[_0x9ffc('0x22')](_0x578f79,_0x4e75ff,_0x5f2176);}else{return rta[_0x9ffc('0x23')](_0x578f79,_0x4e75ff,_0x10c580);}})[_0x9ffc('0x16')](function(_0x3908eb){_0x4e75ff=_0x3908eb;var _0x5124ff=![];if(_0x4e75ff['length']===0x0){if(_0xdbc4b||_0x10c580){_0x5124ff=!![];}if(_0x48e7e3){_0x5124ff=![];}}if(_0x5124ff){return _0x2b86f8;}var _0x26029b=_[_0x9ffc('0x24')](db[_0x9ffc('0x25')][_0x9ffc('0x26')],function(_0x9c81c1){return{'name':_0x9c81c1['fieldName'],'type':_0x9c81c1[_0x9ffc('0x27')][_0x9ffc('0x28')]};});_0x287701[_0x9ffc('0x12')][_0x9ffc('0x29')]=_0x9ffc('0x2a');_0x33fb3d=qs[_0x9ffc('0x2b')](_0x26029b,_0x287701);_0x33fb3d[_0x9ffc('0x2c')]=!![];var _0x189f9a=[];if(_0x4e75ff[_0x9ffc('0x2d')]>0x0){_0x189f9a[_0x9ffc('0x2e')]({'id':{'$in':_0x4e75ff}});if(_0x5f2176&&!_0x10c580){_0x596df9=[db[_0x9ffc('0x2f')][_0x9ffc('0x30')](_0x9ffc('0x31')+_0x4e75ff+')')];_0x33fb3d[_0x9ffc('0x1f')]=_0x596df9;}}if(_0x48e7e3){_0x40c643[_0x9ffc('0x32')](function(_0x432eab){var _0x32fc9d=!![];if(_0x10c580==='*pause'&&_0x3e1085!==_0x432eab){_0x32fc9d=![];}_0x189f9a[_0x9ffc('0x2e')]({[_0x432eab+_0x9ffc('0x33')]:_0x32fc9d});});if(_0x29b789){_0x189f9a[_0x9ffc('0x2e')]({'pauseType':_0x29b789});}}else if(_0x10c580){_0x40c643[_0x9ffc('0x32')](function(_0x82f0b7){_0x189f9a[_0x9ffc('0x2e')]({[_0x82f0b7+_0x9ffc('0x33')]:![]});});}_0x33fb3d[_0x9ffc('0x34')]=_[_0x9ffc('0x35')](_0x33fb3d[_0x9ffc('0x34')],{'$and':_0x189f9a});if(_0x287701[_0x9ffc('0x36')]['role']===_0x9ffc('0x36')){var _0x2cabe4={'params':{'id':_0x287701['user'][_0x9ffc('0x37')]},'query':{'section':_0x9ffc('0x38'),'role':_0x9ffc('0x2a'),'raw':!![],'ids':_0x4e75ff,'customSorting':_0x596df9}};if(_0x287701[_0x9ffc('0x12')][_0x9ffc('0x39')]){_0x2cabe4[_0x9ffc('0x12')][_0x9ffc('0x39')]=!![];}if(_0x48e7e3){_0x2cabe4[_0x9ffc('0x12')]['extraQueryConditions']=_0x189f9a;}_0x2cabe4[_0x9ffc('0x12')]=Object[_0x9ffc('0x3a')](_0x2cabe4[_0x9ffc('0x12')],_['omit'](_0x287701[_0x9ffc('0x12')],'id'));return db[_0x9ffc('0x3b')][_0x9ffc('0x3c')](_0x2cabe4);}return db[_0x9ffc('0x25')][_0x9ffc('0x3d')](_0x33fb3d);})[_0x9ffc('0x16')](function(_0x12572e){_0x2b86f8['count']=_0x12572e[_0x9ffc('0xa')];_0x5b9699=_0x12572e[_0x9ffc('0x21')];return _0x5b9699['map'](function(_0x572252){var _0x486dff=_['find'](_0x578f79,['id',_0x572252['id']]);if(_0x486dff){var _0x37c202=rta[_0x9ffc('0x3e')](_0x486dff);_['merge'](_0x572252,_0x37c202);}_0x572252[_0x9ffc('0x3f')]=rta[_0x9ffc('0x40')](_0x572252);if(_0x572252[_0x9ffc('0x3f')]['includes']('pause')){_0x40c643['forEach'](function(_0x44397c){if(_0x572252[_0x44397c+_0x9ffc('0x33')]){if(_0x44397c===_0x9ffc('0x41')){if(_0x572252[_0x9ffc('0x42')]!==_0x9ffc('0x43')){_0x572252['voiceStatus']=_0x9ffc('0x44');}}else{_0x572252[_0x44397c+_0x9ffc('0x45')]='pause';}}});}return _0x572252;});})[_0x9ffc('0x16')](function(_0x42a1cf){if(!_0x5f2176||_0x596df9){return _0x42a1cf;}return rta[_0x9ffc('0x46')](_0x42a1cf,_0x5f2176);})['then'](function(_0x149008){var _0x208252=rta[_0x9ffc('0x47')]();_0x2b86f8[_0x9ffc('0x21')]=_0x149008['map'](function(_0x473600){return _[_0x9ffc('0x48')](_0x473600,_0x208252);});return _0x2b86f8;})[_0x9ffc('0x16')](respondWithFilteredResult(_0x282e1e,_0x33fb3d))[_0x9ffc('0x49')](APIHandleError(_0x282e1e));};exports[_0x9ffc('0x4a')]=function(_0x98ff9c,_0x1d8280){var _0x232c04={'count':0x0,'rows':[]};var _0x502d82={};var _0x46b206;var _0x2437e8;var _0x53b100;Promise[_0x9ffc('0x15')]()[_0x9ffc('0x16')](function(){if(_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')]){if(!utils[_0x9ffc('0x17')](_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')]));}_0x46b206=_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x19')]['toLowerCase']();}var _0xad7183=_[_0x9ffc('0x4b')](_0x46b206)+_0x9ffc('0x4c');var _0x48acae=_[_0x9ffc('0x24')](db[_0xad7183][_0x9ffc('0x26')],function(_0x89903b){return{'name':_0x89903b['fieldName'],'type':_0x89903b[_0x9ffc('0x27')][_0x9ffc('0x28')]};});if(!_0x98ff9c['query']['fields']){var _0x232f39=['id','name'];if(_0x46b206===_0x9ffc('0x41')){_0x232f39[_0x9ffc('0x2e')](_0x9ffc('0x27'));if(_0x98ff9c[_0x9ffc('0x12')]['type']==='outbound'){_0x232f39[_0x9ffc('0x2e')]([_0x9ffc('0x4d'),_0x9ffc('0x4e')]);}}_0x98ff9c[_0x9ffc('0x12')][_0x9ffc('0x1d')]=_0x232f39['join'](',');}_0x502d82=qs[_0x9ffc('0x2b')](_0x48acae,_0x98ff9c);if(_0x98ff9c[_0x9ffc('0x36')][_0x9ffc('0x29')]===_0x9ffc('0x36')){var _0x516167={'params':{'id':_0x98ff9c['user'][_0x9ffc('0x37')]},'query':{'section':_0x46b206===_0x9ffc('0x41')&&_0x98ff9c['query'][_0x9ffc('0x27')]==='outbound'?_0x9ffc('0x4f'):_[_0x9ffc('0x4b')](_0x46b206)+'Queues','type':_0x98ff9c[_0x9ffc('0x12')]['type'],'nolimit':!![],'sort':'name','filter':_0x98ff9c[_0x9ffc('0x12')]['filter']}};_0x516167[_0x9ffc('0x12')]=Object[_0x9ffc('0x3a')](_0x516167[_0x9ffc('0x12')],_0x98ff9c[_0x9ffc('0x12')]);delete _0x516167[_0x9ffc('0x12')]['id'];return db['UserProfile'][_0x9ffc('0x3c')](_0x516167);}return db[_0xad7183][_0x9ffc('0x3d')](_0x502d82);})[_0x9ffc('0x16')](function(_0x319206){_0x232c04[_0x9ffc('0xa')]=_0x319206[_0x9ffc('0xa')];_0x2437e8=_0x319206['rows'];return rtq[_0x9ffc('0x50')](_0x98ff9c,_0x46b206);})[_0x9ffc('0x16')](function(_0x10e7ea){_0x53b100=_0x10e7ea[_0x9ffc('0x21')];return rtq[_0x9ffc('0x51')](_0x2437e8,_0x53b100,_0x46b206,_0x98ff9c[_0x9ffc('0x12')]['type']);})['then'](function(_0x582e6a){_0x232c04[_0x9ffc('0x21')]=_0x582e6a;return _0x232c04;})['then'](respondWithFilteredResult(_0x1d8280,_0x502d82))[_0x9ffc('0x49')](APIHandleError(_0x1d8280));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7498967..2340db7 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2ad574,_0x18f1c9){var _0x42d228=function(_0x1df798){while(--_0x1df798){_0x2ad574['push'](_0x2ad574['shift']());}};_0x42d228(++_0x18f1c9);}(_0x70e0,0x17b));var _0x070e=function(_0x219ba8,_0x3d5115){_0x219ba8=_0x219ba8-0x0;var _0x4ef313=_0x70e0[_0x219ba8];return _0x4ef313;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5de83e,_0x58dc33){var _0x20559a=function(_0x15af49){while(--_0x15af49){_0x5de83e['push'](_0x5de83e['shift']());}};_0x20559a(++_0x58dc33);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a6591de..53f82d6 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 _0xf483=['DATE','INTEGER','exports','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf483,0xf2));var _0x3f48=function(_0x28e33b,_0x47eb28){_0x28e33b=_0x28e33b-0x0;var _0x50032b=_0xf483[_0x28e33b];return _0x50032b;};'use strict';var Sequelize=require('sequelize');module[_0x3f48('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3f48('0x1')]},'scheduledat':{'type':Sequelize[_0x3f48('0x2')]},'uniqueid':{'type':Sequelize[_0x3f48('0x1')]},'starttime':{'type':Sequelize[_0x3f48('0x2')]},'responsetime':{'type':Sequelize[_0x3f48('0x2')]},'ringtime':{'type':Sequelize[_0x3f48('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x29b1=['INTEGER','STRING','DATE'];(function(_0x5986b0,_0x2fe04a){var _0x48139d=function(_0x24abe0){while(--_0x24abe0){_0x5986b0['push'](_0x5986b0['shift']());}};_0x48139d(++_0x2fe04a);}(_0x29b1,0x13b));var _0x129b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x29b1[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x129b('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x129b('0x1')]},'scheduledat':{'type':Sequelize[_0x129b('0x2')]},'uniqueid':{'type':Sequelize[_0x129b('0x1')]},'starttime':{'type':Sequelize[_0x129b('0x2')]},'responsetime':{'type':Sequelize[_0x129b('0x2')]},'ringtime':{'type':Sequelize[_0x129b('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x129b('0x1')]},'campaigntype':{'type':Sequelize[_0x129b('0x1')]},'membername':{'type':Sequelize[_0x129b('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index de2f51f..0f8dbe5 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 _0x489e=['../../config/environment','exports','define','ReportAgentPreview','lodash','util','bluebird','request-promise','path'];(function(_0x5b6fc2,_0x5d9df3){var _0x742e48=function(_0x439b3d){while(--_0x439b3d){_0x5b6fc2['push'](_0x5b6fc2['shift']());}};_0x742e48(++_0x5d9df3);}(_0x489e,0x1d8));var _0xe489=function(_0x48965e,_0x1ceceb){_0x48965e=_0x48965e-0x0;var _0x10423a=_0x489e[_0x48965e];return _0x10423a;};'use strict';var _=require(_0xe489('0x0'));var util=require(_0xe489('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe489('0x2'));var rp=require(_0xe489('0x3'));var fs=require('fs');var path=require(_0xe489('0x4'));var rimraf=require('rimraf');var config=require(_0xe489('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0xe489('0x6')]=function(_0x338d70,_0x170259){return _0x338d70[_0xe489('0x7')](_0xe489('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ebb=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3e2e82,_0x369bbe){var _0xba15aa=function(_0x4ac6d4){while(--_0x4ac6d4){_0x3e2e82['push'](_0x3e2e82['shift']());}};_0xba15aa(++_0x369bbe);}(_0x6ebb,0x1e5));var _0xb6eb=function(_0x1fee9a,_0x3fd784){_0x1fee9a=_0x1fee9a-0x0;var _0x11455a=_0x6ebb[_0x1fee9a];return _0x11455a;};'use strict';var _=require('lodash');var util=require(_0xb6eb('0x0'));var logger=require(_0xb6eb('0x1'))(_0xb6eb('0x2'));var moment=require(_0xb6eb('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6eb('0x4'));var fs=require('fs');var path=require(_0xb6eb('0x5'));var rimraf=require(_0xb6eb('0x6'));var config=require(_0xb6eb('0x7'));var attributes=require(_0xb6eb('0x8'));module[_0xb6eb('0x9')]=function(_0x244dfc,_0x1026af){return _0x244dfc[_0xb6eb('0xa')](_0xb6eb('0xb'),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 232238b..3df91a6 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 _0x1ef1=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch'];(function(_0xd19f1f,_0x4e9015){var _0x409c77=function(_0x2496c2){while(--_0x2496c2){_0xd19f1f['push'](_0xd19f1f['shift']());}};_0x409c77(++_0x4e9015);}(_0x1ef1,0x1a6));var _0x11ef=function(_0x33fbcb,_0x365e2e){_0x33fbcb=_0x33fbcb-0x0;var _0x2b00e9=_0x1ef1[_0x33fbcb];return _0x2b00e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x11ef('0x0'));var rs=require(_0x11ef('0x1'));var fs=require('fs');var Redis=require(_0x11ef('0x2'));var db=require(_0x11ef('0x3'))['db'];var utils=require(_0x11ef('0x4'));var logger=require(_0x11ef('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x11ef('0x6'));var client=jayson[_0x11ef('0x7')][_0x11ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21d2fb,_0x150bb6,_0x57adf6){return new BPromise(function(_0xbb9825,_0x56950c){return client['request'](_0x21d2fb,_0x57adf6)[_0x11ef('0x9')](function(_0x448d3d){logger[_0x11ef('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x150bb6,_0x11ef('0xb'));logger[_0x11ef('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x150bb6,'request\x20sent',JSON[_0x11ef('0xd')](_0x448d3d));if(_0x448d3d[_0x11ef('0xe')]){if(_0x448d3d[_0x11ef('0xe')][_0x11ef('0xf')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x150bb6,_0x448d3d[_0x11ef('0xe')][_0x11ef('0x10')]);return _0x56950c(_0x448d3d[_0x11ef('0xe')][_0x11ef('0x10')]);}logger[_0x11ef('0xe')](_0x11ef('0x11'),_0x150bb6,_0x448d3d[_0x11ef('0xe')][_0x11ef('0x10')]);return _0xbb9825(_0x448d3d['error'][_0x11ef('0x10')]);}else{logger[_0x11ef('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x150bb6,'request\x20sent');_0xbb9825(_0x448d3d[_0x11ef('0x12')]['message']);}})[_0x11ef('0x13')](function(_0x5ad41a){logger['error'](_0x11ef('0x11'),_0x150bb6,_0x5ad41a);_0x56950c(_0x5ad41a);});});}exports[_0x11ef('0x14')]=function(_0x595106){var _0x569278=this;return new Promise(function(_0x582b54,_0x233433){return db[_0x11ef('0x15')][_0x11ef('0x16')](_0x595106[_0x11ef('0x17')],{'raw':_0x595106['options']?_0x595106[_0x11ef('0x18')][_0x11ef('0x19')]===undefined?!![]:![]:!![]})[_0x11ef('0x9')](function(_0x3c5366){logger[_0x11ef('0xa')](_0x11ef('0x14'),_0x595106);logger[_0x11ef('0xc')](_0x11ef('0x14'),_0x595106,JSON[_0x11ef('0xd')](_0x3c5366));_0x582b54(_0x3c5366);})[_0x11ef('0x13')](function(_0x41f80b){logger[_0x11ef('0xe')](_0x11ef('0x14'),_0x41f80b['message'],_0x595106);_0x233433(_0x569278[_0x11ef('0xe')](0x1f4,_0x41f80b[_0x11ef('0x10')]));});});}; \ No newline at end of file +var _0xe5db=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2eca9a,_0x385534){var _0x472305=function(_0xc362ac){while(--_0xc362ac){_0x2eca9a['push'](_0x2eca9a['shift']());}};_0x472305(++_0x385534);}(_0xe5db,0x11c));var _0xbe5d=function(_0xd4d6a,_0x49853a){_0xd4d6a=_0xd4d6a-0x0;var _0x123a9b=_0xe5db[_0xd4d6a];return _0x123a9b;};'use strict';var _=require(_0xbe5d('0x0'));var util=require(_0xbe5d('0x1'));var moment=require(_0xbe5d('0x2'));var BPromise=require(_0xbe5d('0x3'));var rs=require(_0xbe5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe5d('0x5'))['db'];var utils=require(_0xbe5d('0x6'));var logger=require('../../config/logger')(_0xbe5d('0x7'));var config=require(_0xbe5d('0x8'));var jayson=require(_0xbe5d('0x9'));var client=jayson[_0xbe5d('0xa')][_0xbe5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5565ca,_0xc4d965,_0x5a87f1){return new BPromise(function(_0x19ca31,_0x26c846){return client[_0xbe5d('0xc')](_0x5565ca,_0x5a87f1)[_0xbe5d('0xd')](function(_0x4eddab){logger[_0xbe5d('0xe')](_0xbe5d('0xf'),_0xc4d965,_0xbe5d('0x10'));logger[_0xbe5d('0x11')](_0xbe5d('0x12'),_0xc4d965,_0xbe5d('0x10'),JSON[_0xbe5d('0x13')](_0x4eddab));if(_0x4eddab['error']){if(_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x15')]===0x1f4){logger['error'](_0xbe5d('0xf'),_0xc4d965,_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x16')]);return _0x26c846(_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x16')]);}logger[_0xbe5d('0x14')](_0xbe5d('0xf'),_0xc4d965,_0x4eddab[_0xbe5d('0x14')][_0xbe5d('0x16')]);return _0x19ca31(_0x4eddab['error'][_0xbe5d('0x16')]);}else{logger[_0xbe5d('0xe')](_0xbe5d('0xf'),_0xc4d965,_0xbe5d('0x10'));_0x19ca31(_0x4eddab['result']['message']);}})['catch'](function(_0x598798){logger[_0xbe5d('0x14')](_0xbe5d('0xf'),_0xc4d965,_0x598798);_0x26c846(_0x598798);});});}exports[_0xbe5d('0x17')]=function(_0x5bf8b4){var _0x2a6fbb=this;return new Promise(function(_0x53a3b4,_0x563c95){return db[_0xbe5d('0x18')][_0xbe5d('0x19')](_0x5bf8b4[_0xbe5d('0x1a')],{'raw':_0x5bf8b4[_0xbe5d('0x1b')]?_0x5bf8b4[_0xbe5d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xbe5d('0xd')](function(_0x416f19){logger['info'](_0xbe5d('0x17'),_0x5bf8b4);logger[_0xbe5d('0x11')]('CreateReportAgentPreview',_0x5bf8b4,JSON[_0xbe5d('0x13')](_0x416f19));_0x53a3b4(_0x416f19);})[_0xbe5d('0x1c')](function(_0x6a2ef0){logger['error'](_0xbe5d('0x17'),_0x6a2ef0[_0xbe5d('0x16')],_0x5bf8b4);_0x563c95(_0x2a6fbb[_0xbe5d('0x14')](0x1f4,_0x6a2ef0[_0xbe5d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 91cffbf..40a271d 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 _0xfe29=['faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts'];(function(_0x1f7dd8,_0x251a7d){var _0x35b87d=function(_0x1db4b1){while(--_0x1db4b1){_0x1f7dd8['push'](_0x1f7dd8['shift']());}};_0x35b87d(++_0x251a7d);}(_0xfe29,0x1ed));var _0x9fe2=function(_0x1751d8,_0x12ab4d){_0x1751d8=_0x1751d8-0x0;var _0x510945=_0xfe29[_0x1751d8];return _0x510945;};'use strict';var multer=require(_0x9fe2('0x0'));var util=require(_0x9fe2('0x1'));var path=require(_0x9fe2('0x2'));var express=require(_0x9fe2('0x3'));var router=express[_0x9fe2('0x4')]();var auth=require(_0x9fe2('0x5'));var controller=require('./rpc.controller');router[_0x9fe2('0x6')](_0x9fe2('0x7'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x9')]);router[_0x9fe2('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0xa')]);router[_0x9fe2('0x6')](_0x9fe2('0xb'),auth[_0x9fe2('0x8')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x9fe2('0xc'),auth['isAuthenticated'](),controller[_0x9fe2('0xd')]);router[_0x9fe2('0x6')]('/chat/queues',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0xe')]);router['get'](_0x9fe2('0xf'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x10')]);router[_0x9fe2('0x6')](_0x9fe2('0x11'),auth['isAuthenticated'](),controller[_0x9fe2('0x12')]);router['get'](_0x9fe2('0x13'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x14')]);router[_0x9fe2('0x6')]('/sms/queues',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x15')]);router[_0x9fe2('0x6')]('/whatsapp/queues',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x16')]);router[_0x9fe2('0x6')](_0x9fe2('0x17'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x18')]);router[_0x9fe2('0x6')]('/voice/queues/preview/:id',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x19')]);router[_0x9fe2('0x6')](_0x9fe2('0x1a'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x1b')]);router[_0x9fe2('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x9fe2('0x1c')]);router['get'](_0x9fe2('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x9fe2('0x6')](_0x9fe2('0x1e'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x1f')]);router['get'](_0x9fe2('0x20'),auth[_0x9fe2('0x8')](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x21')]);router[_0x9fe2('0x6')](_0x9fe2('0x22'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x23')]);router[_0x9fe2('0x6')](_0x9fe2('0x24'),auth[_0x9fe2('0x8')](),controller['outboundChannels']);router[_0x9fe2('0x6')](_0x9fe2('0x25'),auth['isAuthenticated'](),controller[_0x9fe2('0x26')]);router[_0x9fe2('0x27')]('/agents/:id/capacity',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x28')]);router[_0x9fe2('0x6')](_0x9fe2('0x29'),auth[_0x9fe2('0x8')](),controller['telephones']);router[_0x9fe2('0x6')](_0x9fe2('0x2a'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x2b')]);router[_0x9fe2('0x6')]('/campaigns',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x2c')]);router[_0x9fe2('0x6')](_0x9fe2('0x2d'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x2e')]);router[_0x9fe2('0x6')]('/chat/queues/waitinginteractions',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x2f')]);router[_0x9fe2('0x6')](_0x9fe2('0x30'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x31')]);router[_0x9fe2('0x6')](_0x9fe2('0x32'),auth[_0x9fe2('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x9fe2('0x6')](_0x9fe2('0x33'),auth['isAuthenticated'](),controller[_0x9fe2('0x34')]);router[_0x9fe2('0x6')](_0x9fe2('0x35'),auth['isAuthenticated'](),controller[_0x9fe2('0x36')]);router[_0x9fe2('0x6')](_0x9fe2('0x37'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x38')]);router[_0x9fe2('0x6')]('/fax/queues/waitinginteractions',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x39')]);router[_0x9fe2('0x3a')](_0x9fe2('0x3b'),auth['isAuthenticated'](),controller[_0x9fe2('0x3c')](_0x9fe2('0x3d')));router[_0x9fe2('0x6')](_0x9fe2('0x3e'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x3f')]);router[_0x9fe2('0x3a')](_0x9fe2('0x40'),auth[_0x9fe2('0x8')](),controller['queueNotify'](_0x9fe2('0x41')));router[_0x9fe2('0x6')](_0x9fe2('0x42'),auth[_0x9fe2('0x8')](),controller['showChatQueues']);router[_0x9fe2('0x3a')]('/fax/queues/:id/notify',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x3c')]('fax'));router[_0x9fe2('0x6')]('/fax/queues/:id',auth[_0x9fe2('0x8')](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x3c')]('openchannel'));router[_0x9fe2('0x6')](_0x9fe2('0x43'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x44')]);router[_0x9fe2('0x3a')]('/sms/queues/:id/notify',auth[_0x9fe2('0x8')](),controller['queueNotify'](_0x9fe2('0x45')));router['post'](_0x9fe2('0x46'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x3c')](_0x9fe2('0x47')));router[_0x9fe2('0x6')](_0x9fe2('0x48'),auth[_0x9fe2('0x8')](),controller['showSmsQueues']);router[_0x9fe2('0x6')](_0x9fe2('0x49'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x4a')]);router[_0x9fe2('0x3a')](_0x9fe2('0x4b'),auth[_0x9fe2('0x8')](),controller[_0x9fe2('0x4c')]);module['exports']=router; \ No newline at end of file +var _0xf88a=['showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','express','Router','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xf88a,0x1e8));var _0xaf88=function(_0x3daac9,_0x5ca67d){_0x3daac9=_0x3daac9-0x0;var _0x1c5e70=_0xf88a[_0x3daac9];return _0x1c5e70;};'use strict';var multer=require(_0xaf88('0x0'));var util=require('util');var path=require('path');var express=require(_0xaf88('0x1'));var router=express[_0xaf88('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xaf88('0x3'));router['get'](_0xaf88('0x4'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x6')]);router[_0xaf88('0x7')](_0xaf88('0x8'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x9')]);router[_0xaf88('0x7')](_0xaf88('0xa'),auth['isAuthenticated'](),controller[_0xaf88('0xb')]);router[_0xaf88('0x7')](_0xaf88('0xc'),auth[_0xaf88('0x5')](),controller['voiceQueues']);router[_0xaf88('0x7')](_0xaf88('0xd'),auth[_0xaf88('0x5')](),controller[_0xaf88('0xe')]);router['get'](_0xaf88('0xf'),auth[_0xaf88('0x5')](),controller['mailQueues']);router[_0xaf88('0x7')](_0xaf88('0x10'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x11')]);router['get'](_0xaf88('0x12'),auth[_0xaf88('0x5')](),controller['openchannelQueues']);router[_0xaf88('0x7')](_0xaf88('0x13'),auth[_0xaf88('0x5')](),controller['smsQueues']);router[_0xaf88('0x7')](_0xaf88('0x14'),auth[_0xaf88('0x5')](),controller['whatsappQueues']);router[_0xaf88('0x7')](_0xaf88('0x15'),auth[_0xaf88('0x5')](),controller['faxQueues']);router[_0xaf88('0x7')](_0xaf88('0x16'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x17')]);router[_0xaf88('0x7')](_0xaf88('0x18'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x19')]);router[_0xaf88('0x7')](_0xaf88('0x1a'),auth['isAuthenticated'](),controller[_0xaf88('0x1b')]);router[_0xaf88('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xaf88('0x5')](),controller[_0xaf88('0x1c')]);router[_0xaf88('0x7')](_0xaf88('0x1d'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x1e')]);router[_0xaf88('0x7')]('/voice/queues/:id',auth[_0xaf88('0x5')](),controller['showVoiceQueues']);router[_0xaf88('0x1f')]('/voice/queues/:id',auth[_0xaf88('0x5')](),controller[_0xaf88('0x20')]);router[_0xaf88('0x7')](_0xaf88('0x21'),auth['isAuthenticated'](),controller[_0xaf88('0x22')]);router[_0xaf88('0x7')]('/outbound/channels',auth[_0xaf88('0x5')](),controller[_0xaf88('0x23')]);router[_0xaf88('0x7')](_0xaf88('0x24'),auth[_0xaf88('0x5')](),controller['agents']);router['put'](_0xaf88('0x25'),auth['isAuthenticated'](),controller[_0xaf88('0x26')]);router[_0xaf88('0x7')](_0xaf88('0x27'),auth['isAuthenticated'](),controller['telephones']);router[_0xaf88('0x7')](_0xaf88('0x28'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x29')]);router[_0xaf88('0x7')](_0xaf88('0x2a'),auth[_0xaf88('0x5')](),controller['campaigns']);router[_0xaf88('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller[_0xaf88('0x2b')]);router[_0xaf88('0x7')](_0xaf88('0x2c'),auth['isAuthenticated'](),controller[_0xaf88('0x2d')]);router[_0xaf88('0x7')](_0xaf88('0x2e'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x2f')]);router[_0xaf88('0x7')](_0xaf88('0x30'),auth[_0xaf88('0x5')](),controller['openchannelQueuesWaitingInteractions']);router[_0xaf88('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xaf88('0x31')]);router[_0xaf88('0x7')](_0xaf88('0x32'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x33')]);router[_0xaf88('0x7')](_0xaf88('0x34'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x35')]);router[_0xaf88('0x7')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xaf88('0x36')](_0xaf88('0x37'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')](_0xaf88('0x39')));router['get'](_0xaf88('0x3a'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x3b')]);router['post'](_0xaf88('0x3c'),auth['isAuthenticated'](),controller[_0xaf88('0x38')](_0xaf88('0x3d')));router[_0xaf88('0x7')](_0xaf88('0x3e'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0xaf88('0x36')](_0xaf88('0x3f'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')](_0xaf88('0x40')));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xaf88('0x41')]);router[_0xaf88('0x36')](_0xaf88('0x42'),auth[_0xaf88('0x5')](),controller['queueNotify'](_0xaf88('0x43')));router['get'](_0xaf88('0x44'),auth['isAuthenticated'](),controller[_0xaf88('0x45')]);router[_0xaf88('0x36')](_0xaf88('0x46'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')](_0xaf88('0x47')));router[_0xaf88('0x36')](_0xaf88('0x48'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x38')]('whatsapp'));router[_0xaf88('0x7')](_0xaf88('0x49'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x4a')]);router[_0xaf88('0x7')]('/whatsapp/queues/:id',auth[_0xaf88('0x5')](),controller[_0xaf88('0x4b')]);router[_0xaf88('0x36')](_0xaf88('0x4c'),auth[_0xaf88('0x5')](),controller[_0xaf88('0x4d')]);module[_0xaf88('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e18fa41..58c9c00 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x5d2e46,_0x5324e2){var _0x8b23c1=function(_0xc6b14c){while(--_0xc6b14c){_0x5d2e46['push'](_0x5d2e46['shift']());}};_0x8b23c1(++_0x5324e2);}(_0xe706,0xa3));var _0x6e70=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xe706[_0x582d0b];return _0x2e93e1;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x56cd80,_0x4e786b){var _0x2e3182=function(_0x385542){while(--_0x385542){_0x56cd80['push'](_0x56cd80['shift']());}};_0x2e3182(++_0x4e786b);}(_0xe706,0xa3));var _0x6e70=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0xe706[_0x2db025];return _0x47afbe;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 619810e..4f4b0ce 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 _0x2a50=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a50,0xa3));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x02a5('0x0'));var path=require(_0x02a5('0x1'));var timeout=require(_0x02a5('0x2'));var express=require(_0x02a5('0x3'));var router=express[_0x02a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x02a5('0x5'));var interaction=require(_0x02a5('0x6'));var config=require(_0x02a5('0x7'));var controller=require('./schedule.controller');router[_0x02a5('0x8')]('/',auth[_0x02a5('0x9')](),controller['index']);router[_0x02a5('0x8')](_0x02a5('0xa'),auth[_0x02a5('0x9')](),controller[_0x02a5('0xb')]);router[_0x02a5('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x02a5('0xc')]);router['post']('/',auth[_0x02a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x02a5('0x9')](),controller['update']);router[_0x02a5('0xd')]('/:id',auth[_0x02a5('0x9')](),controller[_0x02a5('0xe')]);module[_0x02a5('0xf')]=router; \ No newline at end of file +var _0x241c=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run','post','create','put','update'];(function(_0x2a299e,_0x5327be){var _0xaa1cde=function(_0x4889e9){while(--_0x4889e9){_0x2a299e['push'](_0x2a299e['shift']());}};_0xaa1cde(++_0x5327be);}(_0x241c,0x145));var _0xc241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xc241('0x0'));var path=require(_0xc241('0x1'));var timeout=require(_0xc241('0x2'));var express=require('express');var router=express[_0xc241('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc241('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc241('0x5'));router[_0xc241('0x6')]('/',auth['isAuthenticated'](),controller[_0xc241('0x7')]);router[_0xc241('0x6')](_0xc241('0x8'),auth[_0xc241('0x9')](),controller[_0xc241('0xa')]);router[_0xc241('0x6')](_0xc241('0xb'),auth[_0xc241('0x9')](),controller[_0xc241('0xc')]);router[_0xc241('0xd')]('/',auth[_0xc241('0x9')](),controller[_0xc241('0xe')]);router[_0xc241('0xf')](_0xc241('0x8'),auth[_0xc241('0x9')](),controller[_0xc241('0x10')]);router['delete']('/:id',auth[_0xc241('0x9')](),controller[_0xc241('0x11')]);module[_0xc241('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 5db28cf..38839fa 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 _0x04d0=['minutes','csv','xlsx','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x04d0,0x15b));var _0x004d=function(_0x57b223,_0x55e648){_0x57b223=_0x57b223-0x0;var _0x3697cb=_0x04d0[_0x57b223];return _0x3697cb;};'use strict';var Sequelize=require('sequelize');module[_0x004d('0x0')]={'name':{'type':Sequelize[_0x004d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x004d('0x1')]},'active':{'type':Sequelize[_0x004d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x004d('0x1')],'allowNull':![],'defaultValue':_0x004d('0x3')},'startAt':{'type':Sequelize[_0x004d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x004d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x004d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x004d('0x6')](_0x004d('0x7'),_0x004d('0x8'),_0x004d('0x9'),_0x004d('0xa'),_0x004d('0xb'),_0x004d('0xc'),_0x004d('0xd')),'allowNull':![],'defaultValue':_0x004d('0xb')},'output':{'type':Sequelize['ENUM'](_0x004d('0xe'),'pdf',_0x004d('0xf')),'allowNull':![],'defaultValue':_0x004d('0xe')},'type':{'type':Sequelize[_0x004d('0x6')](_0x004d('0x10'),'default'),'allowNull':![],'defaultValue':_0x004d('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x004d('0x1')]},'cc':{'type':Sequelize[_0x004d('0x11')]},'bcc':{'type':Sequelize[_0x004d('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x004d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x48e2=['months','weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0x48e2,0x11c));var _0x248e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x48e2[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x248e('0x0'));module[_0x248e('0x1')]={'name':{'type':Sequelize[_0x248e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x248e('0x2')]},'active':{'type':Sequelize[_0x248e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x248e('0x4')},'startAt':{'type':Sequelize[_0x248e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x248e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x248e('0x7')](_0x248e('0x8'),_0x248e('0x9'),_0x248e('0xa'),_0x248e('0xb'),'days',_0x248e('0xc'),_0x248e('0xd')),'allowNull':![],'defaultValue':_0x248e('0xe')},'output':{'type':Sequelize[_0x248e('0x7')](_0x248e('0xf'),_0x248e('0x10'),_0x248e('0x11')),'allowNull':![],'defaultValue':_0x248e('0xf')},'type':{'type':Sequelize[_0x248e('0x7')](_0x248e('0x12'),_0x248e('0x13')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x248e('0x14')]},'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 32cb239..a783560 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 _0x0b5f=['rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','run','../../config/schedule','eml-format','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','Scheduler','UserProfileResource','end','sendStatus','error','name','send','index','map','Schedule','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show'];(function(_0x1b0f15,_0x271b0f){var _0x30f9dd=function(_0x47eba7){while(--_0x47eba7){_0x1b0f15['push'](_0x1b0f15['shift']());}};_0x30f9dd(++_0x271b0f);}(_0x0b5f,0x152));var _0xf0b5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0b5f[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xf0b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0b5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0b5('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf0b5('0x3'));var sox=require(_0xf0b5('0x4'));var csv=require(_0xf0b5('0x5'));var ejs=require(_0xf0b5('0x6'));var fs=require('fs');var fs_extra=require(_0xf0b5('0x7'));var _=require(_0xf0b5('0x8'));var squel=require(_0xf0b5('0x9'));var crypto=require(_0xf0b5('0xa'));var jsforce=require(_0xf0b5('0xb'));var deskjs=require(_0xf0b5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf0b5('0xd'));var Papa=require('papaparse');var Redis=require(_0xf0b5('0xe'));var authService=require(_0xf0b5('0xf'));var qs=require(_0xf0b5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0b5('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf0b5('0x12'));var licenseUtil=require(_0xf0b5('0x13'));var db=require(_0xf0b5('0x14'))['db'];function respondWithStatusCode(_0x1ea6cd,_0x62ddc6){_0x62ddc6=_0x62ddc6||0xcc;return function(_0x4bf9f3){if(_0x4bf9f3){return _0x1ea6cd['sendStatus'](_0x62ddc6);}return _0x1ea6cd[_0xf0b5('0x15')](_0x62ddc6)['end']();};}function respondWithResult(_0xf6f298,_0x56266a){_0x56266a=_0x56266a||0xc8;return function(_0x36a646){if(_0x36a646){return _0xf6f298['status'](_0x56266a)[_0xf0b5('0x16')](_0x36a646);}};}function respondWithFilteredResult(_0x4e0ab4,_0x5b160e){return function(_0x3d7801){if(_0x3d7801){var _0x10f82b=typeof _0x5b160e['offset']===_0xf0b5('0x17')&&typeof _0x5b160e[_0xf0b5('0x18')]===_0xf0b5('0x17');var _0x2b0b02=_0x3d7801[_0xf0b5('0x19')];var _0x629de1=_0x10f82b?0x0:_0x5b160e[_0xf0b5('0x1a')];var _0x5e681b=_0x10f82b?_0x3d7801[_0xf0b5('0x19')]:_0x5b160e[_0xf0b5('0x1a')]+_0x5b160e[_0xf0b5('0x18')];var _0x4ab47e;if(_0x5e681b>=_0x2b0b02){_0x5e681b=_0x2b0b02;_0x4ab47e=0xc8;}else{_0x4ab47e=0xce;}_0x4e0ab4[_0xf0b5('0x15')](_0x4ab47e);return _0x4e0ab4[_0xf0b5('0x1b')](_0xf0b5('0x1c'),_0x629de1+'-'+_0x5e681b+'/'+_0x2b0b02)[_0xf0b5('0x16')](_0x3d7801);}return null;};}function patchUpdates(_0x3a32ba){return function(_0xc2ee59){try{jsonpatch['apply'](_0xc2ee59,_0x3a32ba,!![]);}catch(_0x54187c){return BPromise[_0xf0b5('0x1d')](_0x54187c);}return _0xc2ee59[_0xf0b5('0x1e')]();};}function saveUpdates(_0xe56d8e,_0x735ee5){return function(_0x202091){if(_0x202091){return _0x202091[_0xf0b5('0x1f')](_0xe56d8e)['then'](function(_0x4fc803){return _0x4fc803;});}return null;};}function removeEntity(_0x262efc,_0x45169f){return function(_0x2d2420){if(_0x2d2420){return _0x2d2420[_0xf0b5('0x20')]()[_0xf0b5('0x21')](function(){var _0x52cc00=_0x2d2420['get']({'plain':!![]});var _0x5622de=_0xf0b5('0x22');return db[_0xf0b5('0x23')][_0xf0b5('0x20')]({'where':{'type':_0x5622de,'resourceId':_0x52cc00['id']}})[_0xf0b5('0x21')](function(){return _0x2d2420;});})['then'](function(){_0x262efc[_0xf0b5('0x15')](0xcc)[_0xf0b5('0x24')]();});}};}function handleEntityNotFound(_0x2e7a24,_0x42f504){return function(_0x32ec53){if(!_0x32ec53){_0x2e7a24[_0xf0b5('0x25')](0x194);}return _0x32ec53;};}function handleError(_0x51c827,_0xe0a30f){_0xe0a30f=_0xe0a30f||0x1f4;return function(_0x2e0c0c){logger[_0xf0b5('0x26')](_0x2e0c0c['stack']);if(_0x2e0c0c[_0xf0b5('0x27')]){delete _0x2e0c0c['name'];}_0x51c827[_0xf0b5('0x15')](_0xe0a30f)[_0xf0b5('0x28')](_0x2e0c0c);};}exports[_0xf0b5('0x29')]=function(_0x1afc52,_0xdcb3ae){var _0xb5fe54={},_0x5c7b11={},_0x53ed7e={'count':0x0,'rows':[]};var _0x3018d0=_[_0xf0b5('0x2a')](db[_0xf0b5('0x2b')]['rawAttributes'],function(_0xd4efc5){return{'name':_0xd4efc5[_0xf0b5('0x2c')],'type':_0xd4efc5[_0xf0b5('0x2d')]['key']};});_0x5c7b11['model']=_[_0xf0b5('0x2a')](_0x3018d0,_0xf0b5('0x27'));_0x5c7b11[_0xf0b5('0x2e')]=_[_0xf0b5('0x2f')](_0x1afc52[_0xf0b5('0x2e')]);_0x5c7b11['filters']=_[_0xf0b5('0x30')](_0x5c7b11['model'],_0x5c7b11[_0xf0b5('0x2e')]);_0xb5fe54['attributes']=_[_0xf0b5('0x30')](_0x5c7b11[_0xf0b5('0x31')],qs[_0xf0b5('0x32')](_0x1afc52[_0xf0b5('0x2e')][_0xf0b5('0x32')]));_0xb5fe54[_0xf0b5('0x33')]=_0xb5fe54['attributes']['length']?_0xb5fe54[_0xf0b5('0x33')]:_0x5c7b11[_0xf0b5('0x31')];if(!_0x1afc52[_0xf0b5('0x2e')][_0xf0b5('0x34')](_0xf0b5('0x35'))){_0xb5fe54['limit']=qs[_0xf0b5('0x18')](_0x1afc52['query']['limit']);_0xb5fe54[_0xf0b5('0x1a')]=qs[_0xf0b5('0x1a')](_0x1afc52[_0xf0b5('0x2e')][_0xf0b5('0x1a')]);}_0xb5fe54[_0xf0b5('0x36')]=qs[_0xf0b5('0x37')](_0x1afc52[_0xf0b5('0x2e')][_0xf0b5('0x37')]);_0xb5fe54['where']=qs[_0xf0b5('0x38')](_[_0xf0b5('0x39')](_0x1afc52['query'],_0x5c7b11[_0xf0b5('0x38')]),_0x3018d0);if(_0x1afc52[_0xf0b5('0x2e')]['filter']){_0xb5fe54[_0xf0b5('0x3a')]=_[_0xf0b5('0x3b')](_0xb5fe54[_0xf0b5('0x3a')],{'$or':_[_0xf0b5('0x2a')](_0x3018d0,function(_0x5502f2){if(_0x5502f2[_0xf0b5('0x2d')]!==_0xf0b5('0x3c')){var _0x122392={};_0x122392[_0x5502f2['name']]={'$like':'%'+_0x1afc52[_0xf0b5('0x2e')]['filter']+'%'};return _0x122392;}})});}_0xb5fe54=_[_0xf0b5('0x3b')]({},_0xb5fe54,_0x1afc52[_0xf0b5('0x3d')]);var _0x2b63ff={'where':_0xb5fe54[_0xf0b5('0x3a')]};return db['Schedule']['count'](_0x2b63ff)[_0xf0b5('0x21')](function(_0x4ae35d){_0x53ed7e[_0xf0b5('0x19')]=_0x4ae35d;if(_0x1afc52['query'][_0xf0b5('0x3e')]){_0xb5fe54[_0xf0b5('0x3f')]=[{'all':!![]}];}return db[_0xf0b5('0x2b')]['findAll'](_0xb5fe54);})[_0xf0b5('0x21')](function(_0x212765){_0x53ed7e[_0xf0b5('0x40')]=_0x212765;return _0x53ed7e;})[_0xf0b5('0x21')](respondWithFilteredResult(_0xdcb3ae,_0xb5fe54))[_0xf0b5('0x41')](handleError(_0xdcb3ae,null));};exports[_0xf0b5('0x42')]=function(_0xe4215a,_0x46b3a2){var _0x12bf21={'raw':![],'where':{'id':_0xe4215a['params']['id']}},_0x325158={};_0x325158[_0xf0b5('0x31')]=_[_0xf0b5('0x2f')](db[_0xf0b5('0x2b')][_0xf0b5('0x43')]);_0x325158[_0xf0b5('0x2e')]=_[_0xf0b5('0x2f')](_0xe4215a[_0xf0b5('0x2e')]);_0x325158[_0xf0b5('0x38')]=_[_0xf0b5('0x30')](_0x325158['model'],_0x325158['query']);_0x12bf21[_0xf0b5('0x33')]=_[_0xf0b5('0x30')](_0x325158['model'],qs[_0xf0b5('0x32')](_0xe4215a[_0xf0b5('0x2e')][_0xf0b5('0x32')]));_0x12bf21[_0xf0b5('0x33')]=_0x12bf21[_0xf0b5('0x33')][_0xf0b5('0x44')]?_0x12bf21[_0xf0b5('0x33')]:_0x325158[_0xf0b5('0x31')];if(_0xe4215a[_0xf0b5('0x2e')][_0xf0b5('0x3e')]){_0x12bf21[_0xf0b5('0x3f')]=[{'all':!![]}];}_0x12bf21=_[_0xf0b5('0x3b')]({},_0x12bf21,_0xe4215a['options']);return db[_0xf0b5('0x2b')][_0xf0b5('0x45')](_0x12bf21)[_0xf0b5('0x21')](handleEntityNotFound(_0x46b3a2,null))[_0xf0b5('0x21')](respondWithResult(_0x46b3a2,null))[_0xf0b5('0x41')](handleError(_0x46b3a2,null));};exports[_0xf0b5('0x46')]=function(_0x535f8b,_0x1183a0){return db[_0xf0b5('0x2b')][_0xf0b5('0x46')](_0x535f8b[_0xf0b5('0x47')],{})[_0xf0b5('0x21')](function(_0x964a4c){var _0x1d2970=_0x535f8b['user'][_0xf0b5('0x48')]({'plain':!![]});if(!_0x1d2970)throw new Error(_0xf0b5('0x49'));if(_0x1d2970[_0xf0b5('0x4a')]===_0xf0b5('0x4b')){var _0x5122e1=_0x964a4c['get']({'plain':!![]});var _0xfae707=_0xf0b5('0x22');return db['UserProfileSection'][_0xf0b5('0x45')]({'where':{'name':_0xfae707,'userProfileId':_0x1d2970[_0xf0b5('0x4c')]},'raw':!![]})['then'](function(_0x5079e3){if(_0x5079e3&&_0x5079e3[_0xf0b5('0x4d')]===0x0){return db[_0xf0b5('0x23')][_0xf0b5('0x46')]({'name':_0x5122e1[_0xf0b5('0x27')],'resourceId':_0x5122e1['id'],'type':_0x5079e3[_0xf0b5('0x27')],'sectionId':_0x5079e3['id']},{})[_0xf0b5('0x21')](function(){return _0x964a4c;});}else{return _0x964a4c;}})[_0xf0b5('0x41')](function(_0x16d7fd){logger[_0xf0b5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16d7fd);throw _0x16d7fd;});}return _0x964a4c;})[_0xf0b5('0x21')](respondWithResult(_0x1183a0,0xc9))[_0xf0b5('0x41')](handleError(_0x1183a0,null));};exports['update']=function(_0x562be3,_0x301e07){if(_0x562be3[_0xf0b5('0x47')]['id']){delete _0x562be3[_0xf0b5('0x47')]['id'];}return db[_0xf0b5('0x2b')]['find']({'where':{'id':_0x562be3[_0xf0b5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x301e07,null))[_0xf0b5('0x21')](saveUpdates(_0x562be3[_0xf0b5('0x47')],null))[_0xf0b5('0x21')](respondWithResult(_0x301e07,null))['catch'](handleError(_0x301e07,null));};exports[_0xf0b5('0x20')]=function(_0x5531e6,_0xd0f7b4){return db[_0xf0b5('0x2b')][_0xf0b5('0x45')]({'where':{'id':_0x5531e6[_0xf0b5('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd0f7b4,null))[_0xf0b5('0x21')](removeEntity(_0xd0f7b4,null))[_0xf0b5('0x41')](handleError(_0xd0f7b4,null));};exports[_0xf0b5('0x4f')]=function(_0x21dffb,_0x18770d,_0x4ac2c8){var _0x260918=require(_0xf0b5('0x50'));return db[_0xf0b5('0x2b')]['find']({'where':{'id':_0x21dffb['params']['id']},'raw':!![]})[_0xf0b5('0x21')](handleEntityNotFound(_0x18770d,null))['then'](function(){_0x260918[_0xf0b5('0x4f')](_0x21dffb['params']['id']);})[_0xf0b5('0x21')](respondWithStatusCode(_0x18770d,null))['catch'](handleError(_0x18770d,null));}; \ No newline at end of file +var _0xaba4=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','intersection','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','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','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','fieldName','query','keys','filters'];(function(_0x496b42,_0x53fe74){var _0x57347a=function(_0xec988f){while(--_0xec988f){_0x496b42['push'](_0x496b42['shift']());}};_0x57347a(++_0x53fe74);}(_0xaba4,0x179));var _0x4aba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaba4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4aba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4aba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4aba('0x2'));var moment=require(_0x4aba('0x3'));var BPromise=require(_0x4aba('0x4'));var Mustache=require(_0x4aba('0x5'));var util=require('util');var path=require(_0x4aba('0x6'));var sox=require(_0x4aba('0x7'));var csv=require('to-csv');var ejs=require(_0x4aba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4aba('0x9'));var jsforce=require(_0x4aba('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4aba('0xb'));var querystring=require(_0x4aba('0xc'));var Papa=require(_0x4aba('0xd'));var Redis=require(_0x4aba('0xe'));var authService=require(_0x4aba('0xf'));var qs=require(_0x4aba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4aba('0x11'));var logger=require(_0x4aba('0x12'))(_0x4aba('0x13'));var utils=require(_0x4aba('0x14'));var config=require(_0x4aba('0x15'));var licenseUtil=require(_0x4aba('0x16'));var db=require(_0x4aba('0x17'))['db'];function respondWithStatusCode(_0x3fad72,_0x48a07e){_0x48a07e=_0x48a07e||0xcc;return function(_0x3ccdc8){if(_0x3ccdc8){return _0x3fad72[_0x4aba('0x18')](_0x48a07e);}return _0x3fad72['status'](_0x48a07e)[_0x4aba('0x19')]();};}function respondWithResult(_0x148e3b,_0x54086f){_0x54086f=_0x54086f||0xc8;return function(_0x2f40eb){if(_0x2f40eb){return _0x148e3b[_0x4aba('0x1a')](_0x54086f)['json'](_0x2f40eb);}};}function respondWithFilteredResult(_0x3a1351,_0xe9ee88){return function(_0x587972){if(_0x587972){var _0x1bb473=typeof _0xe9ee88[_0x4aba('0x1b')]===_0x4aba('0x1c')&&typeof _0xe9ee88['limit']==='undefined';var _0x179f27=_0x587972[_0x4aba('0x1d')];var _0x1aefe5=_0x1bb473?0x0:_0xe9ee88[_0x4aba('0x1b')];var _0x3ee8da=_0x1bb473?_0x587972['count']:_0xe9ee88[_0x4aba('0x1b')]+_0xe9ee88[_0x4aba('0x1e')];var _0x75f3d6;if(_0x3ee8da>=_0x179f27){_0x3ee8da=_0x179f27;_0x75f3d6=0xc8;}else{_0x75f3d6=0xce;}_0x3a1351[_0x4aba('0x1a')](_0x75f3d6);return _0x3a1351[_0x4aba('0x1f')](_0x4aba('0x20'),_0x1aefe5+'-'+_0x3ee8da+'/'+_0x179f27)[_0x4aba('0x21')](_0x587972);}return null;};}function patchUpdates(_0x947d00){return function(_0x3f0777){try{jsonpatch[_0x4aba('0x22')](_0x3f0777,_0x947d00,!![]);}catch(_0x32ae34){return BPromise[_0x4aba('0x23')](_0x32ae34);}return _0x3f0777[_0x4aba('0x24')]();};}function saveUpdates(_0x274011,_0x9f637b){return function(_0x308ecf){if(_0x308ecf){return _0x308ecf['update'](_0x274011)[_0x4aba('0x25')](function(_0x2b4719){return _0x2b4719;});}return null;};}function removeEntity(_0x20586e,_0x4377a7){return function(_0x406cd6){if(_0x406cd6){return _0x406cd6[_0x4aba('0x26')]()['then'](function(){var _0x248b16=_0x406cd6[_0x4aba('0x27')]({'plain':!![]});var _0x1b46b4=_0x4aba('0x28');return db[_0x4aba('0x29')][_0x4aba('0x26')]({'where':{'type':_0x1b46b4,'resourceId':_0x248b16['id']}})[_0x4aba('0x25')](function(){return _0x406cd6;});})[_0x4aba('0x25')](function(){_0x20586e[_0x4aba('0x1a')](0xcc)[_0x4aba('0x19')]();});}};}function handleEntityNotFound(_0x6da009,_0x565fb1){return function(_0x221a5d){if(!_0x221a5d){_0x6da009['sendStatus'](0x194);}return _0x221a5d;};}function handleError(_0x2920ff,_0x29b7e5){_0x29b7e5=_0x29b7e5||0x1f4;return function(_0x4c6431){logger[_0x4aba('0x2a')](_0x4c6431[_0x4aba('0x2b')]);if(_0x4c6431[_0x4aba('0x2c')]){delete _0x4c6431[_0x4aba('0x2c')];}_0x2920ff[_0x4aba('0x1a')](_0x29b7e5)[_0x4aba('0x2d')](_0x4c6431);};}exports['index']=function(_0x241939,_0x333926){var _0x330689={},_0x53cce2={},_0x143b17={'count':0x0,'rows':[]};var _0x599177=_[_0x4aba('0x2e')](db[_0x4aba('0x2f')][_0x4aba('0x30')],function(_0x5644ea){return{'name':_0x5644ea[_0x4aba('0x31')],'type':_0x5644ea['type']['key']};});_0x53cce2['model']=_['map'](_0x599177,'name');_0x53cce2[_0x4aba('0x32')]=_[_0x4aba('0x33')](_0x241939['query']);_0x53cce2[_0x4aba('0x34')]=_['intersection'](_0x53cce2[_0x4aba('0x35')],_0x53cce2[_0x4aba('0x32')]);_0x330689[_0x4aba('0x36')]=_['intersection'](_0x53cce2['model'],qs[_0x4aba('0x37')](_0x241939[_0x4aba('0x32')]['fields']));_0x330689['attributes']=_0x330689[_0x4aba('0x36')][_0x4aba('0x38')]?_0x330689[_0x4aba('0x36')]:_0x53cce2[_0x4aba('0x35')];if(!_0x241939[_0x4aba('0x32')][_0x4aba('0x39')](_0x4aba('0x3a'))){_0x330689[_0x4aba('0x1e')]=qs[_0x4aba('0x1e')](_0x241939[_0x4aba('0x32')][_0x4aba('0x1e')]);_0x330689[_0x4aba('0x1b')]=qs[_0x4aba('0x1b')](_0x241939[_0x4aba('0x32')][_0x4aba('0x1b')]);}_0x330689['order']=qs[_0x4aba('0x3b')](_0x241939[_0x4aba('0x32')][_0x4aba('0x3b')]);_0x330689[_0x4aba('0x3c')]=qs[_0x4aba('0x34')](_[_0x4aba('0x3d')](_0x241939[_0x4aba('0x32')],_0x53cce2[_0x4aba('0x34')]),_0x599177);if(_0x241939['query'][_0x4aba('0x3e')]){_0x330689[_0x4aba('0x3c')]=_[_0x4aba('0x3f')](_0x330689[_0x4aba('0x3c')],{'$or':_[_0x4aba('0x2e')](_0x599177,function(_0xd0f9d1){if(_0xd0f9d1[_0x4aba('0x40')]!==_0x4aba('0x41')){var _0x12a165={};_0x12a165[_0xd0f9d1[_0x4aba('0x2c')]]={'$like':'%'+_0x241939[_0x4aba('0x32')][_0x4aba('0x3e')]+'%'};return _0x12a165;}})});}_0x330689=_[_0x4aba('0x3f')]({},_0x330689,_0x241939['options']);var _0x585aa7={'where':_0x330689[_0x4aba('0x3c')]};return db[_0x4aba('0x2f')]['count'](_0x585aa7)[_0x4aba('0x25')](function(_0x234f2e){_0x143b17[_0x4aba('0x1d')]=_0x234f2e;if(_0x241939[_0x4aba('0x32')][_0x4aba('0x42')]){_0x330689[_0x4aba('0x43')]=[{'all':!![]}];}return db[_0x4aba('0x2f')][_0x4aba('0x44')](_0x330689);})['then'](function(_0x564c69){_0x143b17[_0x4aba('0x45')]=_0x564c69;return _0x143b17;})[_0x4aba('0x25')](respondWithFilteredResult(_0x333926,_0x330689))[_0x4aba('0x46')](handleError(_0x333926,null));};exports['show']=function(_0x4d7548,_0x45ccb2){var _0x528318={'raw':![],'where':{'id':_0x4d7548[_0x4aba('0x47')]['id']}},_0x19b2c0={};_0x19b2c0['model']=_[_0x4aba('0x33')](db[_0x4aba('0x2f')]['rawAttributes']);_0x19b2c0[_0x4aba('0x32')]=_[_0x4aba('0x33')](_0x4d7548['query']);_0x19b2c0[_0x4aba('0x34')]=_[_0x4aba('0x48')](_0x19b2c0[_0x4aba('0x35')],_0x19b2c0[_0x4aba('0x32')]);_0x528318['attributes']=_['intersection'](_0x19b2c0[_0x4aba('0x35')],qs[_0x4aba('0x37')](_0x4d7548[_0x4aba('0x32')]['fields']));_0x528318[_0x4aba('0x36')]=_0x528318[_0x4aba('0x36')][_0x4aba('0x38')]?_0x528318[_0x4aba('0x36')]:_0x19b2c0['model'];if(_0x4d7548[_0x4aba('0x32')][_0x4aba('0x42')]){_0x528318[_0x4aba('0x43')]=[{'all':!![]}];}_0x528318=_[_0x4aba('0x3f')]({},_0x528318,_0x4d7548[_0x4aba('0x49')]);return db[_0x4aba('0x2f')][_0x4aba('0x4a')](_0x528318)[_0x4aba('0x25')](handleEntityNotFound(_0x45ccb2,null))[_0x4aba('0x25')](respondWithResult(_0x45ccb2,null))['catch'](handleError(_0x45ccb2,null));};exports[_0x4aba('0x4b')]=function(_0x28c1f5,_0x343b67){return db[_0x4aba('0x2f')][_0x4aba('0x4b')](_0x28c1f5['body'],{})[_0x4aba('0x25')](function(_0x1cda62){var _0x27d3fc=_0x28c1f5[_0x4aba('0x4c')]['get']({'plain':!![]});if(!_0x27d3fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27d3fc[_0x4aba('0x4d')]===_0x4aba('0x4c')){var _0x3e0bbe=_0x1cda62['get']({'plain':!![]});var _0x1fd8c5=_0x4aba('0x28');return db[_0x4aba('0x4e')][_0x4aba('0x4a')]({'where':{'name':_0x1fd8c5,'userProfileId':_0x27d3fc[_0x4aba('0x4f')]},'raw':!![]})['then'](function(_0x700f7a){if(_0x700f7a&&_0x700f7a[_0x4aba('0x50')]===0x0){return db[_0x4aba('0x29')][_0x4aba('0x4b')]({'name':_0x3e0bbe['name'],'resourceId':_0x3e0bbe['id'],'type':_0x700f7a[_0x4aba('0x2c')],'sectionId':_0x700f7a['id']},{})[_0x4aba('0x25')](function(){return _0x1cda62;});}else{return _0x1cda62;}})[_0x4aba('0x46')](function(_0x3d9bd8){logger['error'](_0x4aba('0x51'),_0x3d9bd8);throw _0x3d9bd8;});}return _0x1cda62;})[_0x4aba('0x25')](respondWithResult(_0x343b67,0xc9))[_0x4aba('0x46')](handleError(_0x343b67,null));};exports[_0x4aba('0x52')]=function(_0x20587f,_0x2c5969){if(_0x20587f[_0x4aba('0x53')]['id']){delete _0x20587f['body']['id'];}return db[_0x4aba('0x2f')][_0x4aba('0x4a')]({'where':{'id':_0x20587f[_0x4aba('0x47')]['id']}})[_0x4aba('0x25')](handleEntityNotFound(_0x2c5969,null))[_0x4aba('0x25')](saveUpdates(_0x20587f[_0x4aba('0x53')],null))[_0x4aba('0x25')](respondWithResult(_0x2c5969,null))[_0x4aba('0x46')](handleError(_0x2c5969,null));};exports['destroy']=function(_0x156897,_0x4ce4d3){return db['Schedule'][_0x4aba('0x4a')]({'where':{'id':_0x156897['params']['id']}})[_0x4aba('0x25')](handleEntityNotFound(_0x4ce4d3,null))['then'](removeEntity(_0x4ce4d3,null))['catch'](handleError(_0x4ce4d3,null));};exports[_0x4aba('0x54')]=function(_0x1b1432,_0x22ec57,_0x2005dd){var _0x411619=require(_0x4aba('0x55'));return db[_0x4aba('0x2f')]['find']({'where':{'id':_0x1b1432[_0x4aba('0x47')]['id']},'raw':!![]})[_0x4aba('0x25')](handleEntityNotFound(_0x22ec57,null))[_0x4aba('0x25')](function(){_0x411619[_0x4aba('0x54')](_0x1b1432[_0x4aba('0x47')]['id']);})[_0x4aba('0x25')](respondWithStatusCode(_0x22ec57,null))[_0x4aba('0x46')](handleError(_0x22ec57,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ecc97ca..42c1afa 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 _0x3903=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','../../config/logger','api','moment','bluebird'];(function(_0x7de33e,_0x46a873){var _0x9b0f8=function(_0x264f7f){while(--_0x264f7f){_0x7de33e['push'](_0x7de33e['shift']());}};_0x9b0f8(++_0x46a873);}(_0x3903,0x1a8));var _0x3390=function(_0x4f3d89,_0x174445){_0x4f3d89=_0x4f3d89-0x0;var _0x59f05b=_0x3903[_0x4f3d89];return _0x59f05b;};'use strict';var _=require(_0x3390('0x0'));var util=require('util');var logger=require(_0x3390('0x1'))(_0x3390('0x2'));var moment=require(_0x3390('0x3'));var BPromise=require(_0x3390('0x4'));var rp=require(_0x3390('0x5'));var fs=require('fs');var path=require(_0x3390('0x6'));var rimraf=require(_0x3390('0x7'));var config=require(_0x3390('0x8'));var attributes=require(_0x3390('0x9'));module[_0x3390('0xa')]=function(_0x33c95e,_0x3b3319){return _0x33c95e[_0x3390('0xb')]('Schedule',attributes,{'tableName':_0x3390('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe19=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1c729d,_0xa41d84){var _0x14f4ec=function(_0x48c82d){while(--_0x48c82d){_0x1c729d['push'](_0x1c729d['shift']());}};_0x14f4ec(++_0xa41d84);}(_0xbe19,0x93));var _0x9be1=function(_0x1c24e3,_0x2bf2dc){_0x1c24e3=_0x1c24e3-0x0;var _0x16eb3e=_0xbe19[_0x1c24e3];return _0x16eb3e;};'use strict';var _=require(_0x9be1('0x0'));var util=require(_0x9be1('0x1'));var logger=require(_0x9be1('0x2'))(_0x9be1('0x3'));var moment=require(_0x9be1('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be1('0x5'));var fs=require('fs');var path=require(_0x9be1('0x6'));var rimraf=require(_0x9be1('0x7'));var config=require(_0x9be1('0x8'));var attributes=require('./schedule.attributes');module[_0x9be1('0x9')]=function(_0x14c9e9,_0x5c3d6b){return _0x14c9e9[_0x9be1('0xa')]('Schedule',attributes,{'tableName':'tools_schedules','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 658fc4d..1cee6fb 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 _0x0aa6=['catch','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0aa6,0x190));var _0x60aa=function(_0x54a2d4,_0x18815d){_0x54a2d4=_0x54a2d4-0x0;var _0x59d881=_0x0aa6[_0x54a2d4];return _0x59d881;};'use strict';var _=require(_0x60aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60aa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60aa('0x2'));var db=require(_0x60aa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x60aa('0x4'));var config=require(_0x60aa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x60aa('0x6')][_0x60aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x588de1,_0x32c23b,_0x4f46a7){return new BPromise(function(_0x35dddf,_0x5289d0){return client[_0x60aa('0x8')](_0x588de1,_0x4f46a7)[_0x60aa('0x9')](function(_0x168f21){logger[_0x60aa('0xa')]('Schedule,\x20%s,\x20%s',_0x32c23b,_0x60aa('0xb'));logger['debug'](_0x60aa('0xc'),_0x32c23b,_0x60aa('0xb'),JSON[_0x60aa('0xd')](_0x168f21));if(_0x168f21[_0x60aa('0xe')]){if(_0x168f21[_0x60aa('0xe')][_0x60aa('0xf')]===0x1f4){logger[_0x60aa('0xe')](_0x60aa('0x10'),_0x32c23b,_0x168f21[_0x60aa('0xe')][_0x60aa('0x11')]);return _0x5289d0(_0x168f21[_0x60aa('0xe')][_0x60aa('0x11')]);}logger['error'](_0x60aa('0x10'),_0x32c23b,_0x168f21[_0x60aa('0xe')][_0x60aa('0x11')]);return _0x35dddf(_0x168f21[_0x60aa('0xe')][_0x60aa('0x11')]);}else{logger[_0x60aa('0xa')]('Schedule,\x20%s,\x20%s',_0x32c23b,_0x60aa('0xb'));_0x35dddf(_0x168f21['result'][_0x60aa('0x11')]);}})[_0x60aa('0x12')](function(_0x1e2cb8){logger[_0x60aa('0xe')](_0x60aa('0x10'),_0x32c23b,_0x1e2cb8);_0x5289d0(_0x1e2cb8);});});} \ No newline at end of file +var _0x9e89=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0x9e89,0x141));var _0x99e8=function(_0xadc1cb,_0x2f2009){_0xadc1cb=_0xadc1cb-0x0;var _0x555c41=_0x9e89[_0xadc1cb];return _0x555c41;};'use strict';var _=require(_0x99e8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99e8('0x1'));var rs=require(_0x99e8('0x2'));var fs=require('fs');var Redis=require(_0x99e8('0x3'));var db=require(_0x99e8('0x4'))['db'];var utils=require(_0x99e8('0x5'));var logger=require(_0x99e8('0x6'))(_0x99e8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x99e8('0x8')][_0x99e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3f8f,_0x272c81,_0x18b412){return new BPromise(function(_0x5af5bb,_0x708443){return client['request'](_0x5b3f8f,_0x18b412)['then'](function(_0x4416e5){logger[_0x99e8('0xa')](_0x99e8('0xb'),_0x272c81,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x272c81,_0x99e8('0xc'),JSON['stringify'](_0x4416e5));if(_0x4416e5[_0x99e8('0xd')]){if(_0x4416e5['error'][_0x99e8('0xe')]===0x1f4){logger[_0x99e8('0xd')](_0x99e8('0xb'),_0x272c81,_0x4416e5[_0x99e8('0xd')]['message']);return _0x708443(_0x4416e5[_0x99e8('0xd')][_0x99e8('0xf')]);}logger['error'](_0x99e8('0xb'),_0x272c81,_0x4416e5[_0x99e8('0xd')][_0x99e8('0xf')]);return _0x5af5bb(_0x4416e5[_0x99e8('0xd')][_0x99e8('0xf')]);}else{logger[_0x99e8('0xa')]('Schedule,\x20%s,\x20%s',_0x272c81,'request\x20sent');_0x5af5bb(_0x4416e5['result'][_0x99e8('0xf')]);}})[_0x99e8('0x10')](function(_0x489fa5){logger[_0x99e8('0xd')](_0x99e8('0xb'),_0x272c81,_0x489fa5);_0x708443(_0x489fa5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c8e9298..538380b 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 _0x8fe5=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download'];(function(_0x3295d0,_0x120dbe){var _0x4b5400=function(_0x540861){while(--_0x540861){_0x3295d0['push'](_0x3295d0['shift']());}};_0x4b5400(++_0x120dbe);}(_0x8fe5,0xae));var _0x58fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fe5[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x58fe('0x0'));var path=require(_0x58fe('0x1'));var timeout=require(_0x58fe('0x2'));var express=require(_0x58fe('0x3'));var router=express[_0x58fe('0x4')]();var fs_extra=require(_0x58fe('0x5'));var auth=require(_0x58fe('0x6'));var interaction=require(_0x58fe('0x7'));var config=require(_0x58fe('0x8'));var controller=require(_0x58fe('0x9'));router['get']('/',auth[_0x58fe('0xa')](),controller[_0x58fe('0xb')]);router[_0x58fe('0xc')](_0x58fe('0xd'),auth[_0x58fe('0xa')](),controller[_0x58fe('0xe')]);router[_0x58fe('0xc')](_0x58fe('0xf'),auth[_0x58fe('0xa')](),controller[_0x58fe('0x10')]);router[_0x58fe('0xc')](_0x58fe('0x11'),auth[_0x58fe('0xa')](),controller['download']);router[_0x58fe('0x12')]('/',auth[_0x58fe('0xa')](),controller['create']);router[_0x58fe('0x13')](_0x58fe('0xf'),auth[_0x58fe('0xa')](),controller[_0x58fe('0x14')]);router[_0x58fe('0x15')](_0x58fe('0xf'),auth['isAuthenticated'](),controller[_0x58fe('0x16')]);module[_0x58fe('0x17')]=router; \ No newline at end of file +var _0xefe3=['/describe','isAuthenticated','/:id','/:id/download','download','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index'];(function(_0x408cac,_0x1fdd8d){var _0x4d775a=function(_0x3a4f1e){while(--_0x3a4f1e){_0x408cac['push'](_0x408cac['shift']());}};_0x4d775a(++_0x1fdd8d);}(_0xefe3,0xd1));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x3efe('0x0'));var util=require(_0x3efe('0x1'));var path=require(_0x3efe('0x2'));var timeout=require(_0x3efe('0x3'));var express=require(_0x3efe('0x4'));var router=express[_0x3efe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3efe('0x6'));var interaction=require(_0x3efe('0x7'));var config=require('../../config/environment');var controller=require(_0x3efe('0x8'));router[_0x3efe('0x9')]('/',auth['isAuthenticated'](),controller[_0x3efe('0xa')]);router['get'](_0x3efe('0xb'),auth[_0x3efe('0xc')](),controller['describe']);router['get'](_0x3efe('0xd'),auth[_0x3efe('0xc')](),controller['show']);router[_0x3efe('0x9')](_0x3efe('0xe'),auth[_0x3efe('0xc')](),controller[_0x3efe('0xf')]);router[_0x3efe('0x10')]('/',auth[_0x3efe('0xc')](),controller[_0x3efe('0x11')]);router[_0x3efe('0x12')](_0x3efe('0xd'),auth[_0x3efe('0xc')](),controller['update']);router['delete'](_0x3efe('0xd'),auth[_0x3efe('0xc')](),controller[_0x3efe('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1fa2aad..3fbd6cd 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 _0x659c=['setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','../../config/environment','exports','getDataValue','value','STRING'];(function(_0xe0d64b,_0x5f0fef){var _0x480aed=function(_0x31a3ce){while(--_0x31a3ce){_0xe0d64b['push'](_0xe0d64b['shift']());}};_0x480aed(++_0x5f0fef);}(_0x659c,0x1aa));var _0xc659=function(_0x45c10a,_0x4b9090){_0x45c10a=_0x45c10a-0x0;var _0x3f680=_0x659c[_0x45c10a];return _0x3f680;};'use strict';var Sequelize=require(_0xc659('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xc659('0x1'));module[_0xc659('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc659('0x3')](_0xc659('0x4'))?path['extname'](this['getDataValue'](_0xc659('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xc659('0x5')]},'channel':{'type':Sequelize[_0xc659('0x5')]},'value':{'type':Sequelize[_0xc659('0x5')],'set':function(_0x15e20b){var _0x33e9d9=_0x15e20b['replace'](/\\/g,'/');this['setDataValue'](_0xc659('0x4'),_0x33e9d9);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4fadc2){this[_0xc659('0x6')](_0xc659('0x7'),moment()[_0xc659('0x8')](_0x4fadc2,'ms'));this[_0xc659('0x6')](_0xc659('0x9'),moment());this[_0xc659('0x6')](_0xc659('0xa'),_0x4fadc2);}},'startedAt':{'type':Sequelize[_0xc659('0xb')],'get':function(){return moment(this['getDataValue'](_0xc659('0x7')))[_0xc659('0xc')](_0xc659('0xd'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc659('0x3')](_0xc659('0x9')))['format'](_0xc659('0xd'))[_0xc659('0xe')]();}},'createdAt':{'type':Sequelize[_0xc659('0xb')],'get':function(){return moment(this[_0xc659('0x3')](_0xc659('0xf')))[_0xc659('0xc')](_0xc659('0xd'))[_0xc659('0xe')]();}},'updatedAt':{'type':Sequelize[_0xc659('0xb')],'get':function(){return moment(this[_0xc659('0x3')]('updatedAt'))[_0xc659('0xc')](_0xc659('0xd'))[_0xc659('0xe')]();}}}; \ No newline at end of file +var _0xc3ed=['subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','createdAt','toString','format','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x31ac6f,_0xac69ee){var _0x26653f=function(_0x202b19){while(--_0x202b19){_0x31ac6f['push'](_0x31ac6f['shift']());}};_0x26653f(++_0xac69ee);}(_0xc3ed,0x111));var _0xdc3e=function(_0x436b13,_0x49e83b){_0x436b13=_0x436b13-0x0;var _0x7ea6f0=_0xc3ed[_0x436b13];return _0x7ea6f0;};'use strict';var Sequelize=require(_0xdc3e('0x0'));var moment=require(_0xdc3e('0x1'));var path=require('path');var config=require(_0xdc3e('0x2'));module[_0xdc3e('0x3')]={'format':{'type':Sequelize[_0xdc3e('0x4')],'get':function(){return this[_0xdc3e('0x5')](_0xdc3e('0x6'))?path['extname'](this[_0xdc3e('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xdc3e('0x7')]},'channel':{'type':Sequelize[_0xdc3e('0x7')]},'value':{'type':Sequelize[_0xdc3e('0x7')],'set':function(_0x49e3f3){var _0xd0916c=_0x49e3f3[_0xdc3e('0x8')](/\\/g,'/');this[_0xdc3e('0x9')](_0xdc3e('0x6'),_0xd0916c);}},'rating':{'type':Sequelize[_0xdc3e('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xdc3e('0xa')],'set':function(_0x3becac){this[_0xdc3e('0x9')](_0xdc3e('0xb'),moment()[_0xdc3e('0xc')](_0x3becac,'ms'));this[_0xdc3e('0x9')](_0xdc3e('0xd'),moment());this[_0xdc3e('0x9')]('duration',_0x3becac);}},'startedAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')](_0xdc3e('0xb')))['format'](_0xdc3e('0xf'))['toString']();}},'closedAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')]('closedAt'))['format'](_0xdc3e('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')](_0xdc3e('0x10')))['format'](_0xdc3e('0xf'))[_0xdc3e('0x11')]();}},'updatedAt':{'type':Sequelize[_0xdc3e('0xe')],'get':function(){return moment(this[_0xdc3e('0x5')]('updatedAt'))[_0xdc3e('0x12')](_0xdc3e('0xf'))[_0xdc3e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 4d71129..13e3b96 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 _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x53dbf6,_0x3a0fec){var _0x37715c=function(_0x45c28d){while(--_0x45c28d){_0x53dbf6['push'](_0x53dbf6['shift']());}};_0x37715c(++_0x3a0fec);}(_0x5c12,0x188));var _0x25c1=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x5c12[_0x5d1044];return _0x3cd90e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file +var _0xeec6=['options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','model','format','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x5553b3,_0x36a21c){var _0xb1decf=function(_0x4399ae){while(--_0x4399ae){_0x5553b3['push'](_0x5553b3['shift']());}};_0xb1decf(++_0x36a21c);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4c3afd,_0x3e7a45){_0x4c3afd=_0x4c3afd-0x0;var _0x4e2ef3=_0xeec6[_0x4c3afd];return _0x4e2ef3;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['differenceBy'](_[_0x6eec('0x29')](_0x34bdea,_0x6eec('0x28')),[_0x6eec('0x2f')]);_0xede270['query']=_['keys'](_0x3240c3['query']);_0xede270[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x32')]);_0x20a130[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x34')]));_0x20a130[_0x6eec('0x33')]=_0x20a130[_0x6eec('0x33')]['length']?_0x20a130[_0x6eec('0x33')]:_0xede270[_0x6eec('0x2e')];if(!_0x3240c3[_0x6eec('0x32')]['hasOwnProperty'](_0x6eec('0x35'))){_0x20a130[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs['offset'](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1c')]);}_0x20a130[_0x6eec('0x36')]=qs['sort'](_0x3240c3['query'][_0x6eec('0x37')]);_0x20a130[_0x6eec('0x38')]=qs[_0x6eec('0x30')](_[_0x6eec('0x39')](_0x3240c3[_0x6eec('0x32')],_0xede270['filters']),_0x34bdea);if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3a')]){_0x20a130[_0x6eec('0x38')]=_[_0x6eec('0x3b')](_0x20a130[_0x6eec('0x38')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x3240c3['query']['filter']+'%'};return _0x2f7a75;}})});}_0x20a130=_[_0x6eec('0x3b')]({},_0x20a130,_0x3240c3[_0x6eec('0x3c')]);var _0xf056e0={'where':_0x20a130[_0x6eec('0x38')]};return db['ScreenRecording']['count'](_0xf056e0)[_0x6eec('0x24')](function(_0x48fbf6){_0x3bbdf8['count']=_0x48fbf6;if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3d')]){_0x20a130[_0x6eec('0x3e')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x20a130);})['then'](function(_0x931bcf){_0x3bbdf8[_0x6eec('0x40')]=_0x931bcf;return _0x3bbdf8;})['then'](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x41')](handleError(_0x47ed95,null));};exports[_0x6eec('0x42')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x43')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x44')](db[_0x6eec('0x2a')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x32')]=_[_0x6eec('0x44')](_0x5028a2[_0x6eec('0x32')]);_0x4e3b1e[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x5028a2[_0x6eec('0x32')]['fields']));_0x44d75d[_0x6eec('0x33')]=_0x44d75d['attributes'][_0x6eec('0x45')]?_0x44d75d[_0x6eec('0x33')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3d')]){_0x44d75d[_0x6eec('0x3e')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3b')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3c')]);return db[_0x6eec('0x2a')]['find'](_0x44d75d)[_0x6eec('0x24')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x46')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x535d96['body'],{})['then'](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x41')](handleError(_0x245a1b,null));};exports[_0x6eec('0x23')]=function(_0x1d6626,_0x2d0fc0){if(_0x1d6626[_0x6eec('0x47')]['id']){delete _0x1d6626[_0x6eec('0x47')]['id'];}delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x48')];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x49')];delete _0x1d6626['body']['closedAt'];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x4a')];return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x1d6626[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x2d0fc0,null))[_0x6eec('0x24')](saveUpdates(_0x1d6626[_0x6eec('0x47')],null))[_0x6eec('0x24')](respondWithResult(_0x2d0fc0,null))[_0x6eec('0x41')](handleError(_0x2d0fc0,null));};exports[_0x6eec('0x4b')]=function(_0x413de9,_0x5a6e05){return db[_0x6eec('0x2a')][_0x6eec('0x4b')]()[_0x6eec('0x24')](respondWithResult(_0x5a6e05,null))[_0x6eec('0x41')](handleError(_0x5a6e05,null));};exports['download']=function(_0x51fd37,_0x50436d,_0x36c49b){var _0x32b289=require(_0x6eec('0x4c'));var _0x1de626=![];var _0x5178f5={};if(_0x51fd37['query'][_0x6eec('0x2d')]&&_0x51fd37[_0x6eec('0x32')][_0x6eec('0x2d')]==='uniqueid'){_0x5178f5[_0x6eec('0x4d')]=_0x51fd37[_0x6eec('0x43')]['id'];}else{_0x5178f5['id']=_0x51fd37[_0x6eec('0x43')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x4e')]({'where':_0x5178f5,'attributes':['id',_0x6eec('0x4a')],'raw':!![]})[_0x6eec('0x24')](handleEntityNotFound(_0x50436d,null))[_0x6eec('0x24')](function(_0x45fed3){if(_0x45fed3){var _0x4e921a=path[_0x6eec('0x4f')](config['root'],_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4a')]);var _0x424962=util[_0x6eec('0x2f')](_0x6eec('0x51'),_0x4e921a);if(fs[_0x6eec('0x52')](_0x424962)){_0x1de626=!![];return _0x32b289[_0x6eec('0x53')](_0x424962,_0x4e921a,config['secrets'][_0x6eec('0x54')])['then'](function(){return _0x45fed3;});}return _0x45fed3;}})[_0x6eec('0x24')](function(_0x5c905f){if(_0x5c905f){var _0x237324=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x5c905f[_0x6eec('0x4a')]);if(!fs[_0x6eec('0x52')](_0x237324)){throw new db[(_0x6eec('0x56'))][(_0x6eec('0x57'))](_0x6eec('0x58'));}if(_0x5c905f[_0x6eec('0x59')]){return _0x50436d['download'](_0x237324,_0x5c905f['filename']+path[_0x6eec('0x5a')](_0x237324),function(){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}else{return _0x50436d[_0x6eec('0x5c')](_0x237324,function(_0x2c0644){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}}})['catch'](function(_0x1d8fb1){if(_0x1d8fb1[_0x6eec('0x5d')]==='ScreenRecording\x20not\x20found'){_0x50436d['status'](0x194)['send'](_0x6eec('0x5e'));}else{return handleError(_0x50436d,null);}});};exports[_0x6eec('0x25')]=function(_0x4cf859,_0x1d2baf){return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x4cf859[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](function(_0xc852b3){if(_[_0x6eec('0x5f')](_0xc852b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xc852b3;})['then'](function(_0x54fcd0){var _0x1230fc=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x54fcd0[_0x6eec('0x4a')]);logger[_0x6eec('0x60')](_0x6eec('0x61'),_0x1230fc);if(!_[_0x6eec('0x5f')](_0x54fcd0[_0x6eec('0x4a')])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')](_0x6eec('0x62')+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}_0x1230fc=_0x1230fc+_0x6eec('0x65');if(!_[_0x6eec('0x5f')](_0x54fcd0['value'])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')]('File:\x20\x22'+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}return _0x54fcd0;})['then'](function(_0x7dd727){if(!_0x7dd727)throw new InternalError();return _0x7dd727[_0x6eec('0x25')]();})[_0x6eec('0x24')](function(){_0x1d2baf[_0x6eec('0x19')](0xcc)['end']();})[_0x6eec('0x41')](handleError(_0x1d2baf,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5b1cf8a..2f57d2b 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 _0x0373=['./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x0373,0xba));var _0x3037=function(_0x5b8a92,_0x1e6117){_0x5b8a92=_0x5b8a92-0x0;var _0x97ad43=_0x0373[_0x5b8a92];return _0x97ad43;};'use strict';var _=require(_0x3037('0x0'));var util=require(_0x3037('0x1'));var logger=require(_0x3037('0x2'))(_0x3037('0x3'));var moment=require(_0x3037('0x4'));var BPromise=require(_0x3037('0x5'));var rp=require(_0x3037('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3037('0x7'));var config=require(_0x3037('0x8'));var attributes=require(_0x3037('0x9'));module[_0x3037('0xa')]=function(_0xa83d,_0x32b766){return _0xa83d[_0x3037('0xb')](_0x3037('0xc'),attributes,{'tableName':_0x3037('0xd'),'paranoid':![],'indexes':[{'name':_0x3037('0xe'),'fields':[_0x3037('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e4c=['request-promise','path','../../config/environment','./screenRecording.attributes','define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x9391c0,_0x445f35){var _0x51f943=function(_0x1ebc8a){while(--_0x1ebc8a){_0x9391c0['push'](_0x9391c0['shift']());}};_0x51f943(++_0x445f35);}(_0x8e4c,0x13f));var _0xc8e4=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x8e4c[_0x22e9fe];return _0x47cd19;};'use strict';var _=require(_0xc8e4('0x0'));var util=require(_0xc8e4('0x1'));var logger=require(_0xc8e4('0x2'))(_0xc8e4('0x3'));var moment=require(_0xc8e4('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8e4('0x5'));var fs=require('fs');var path=require(_0xc8e4('0x6'));var rimraf=require('rimraf');var config=require(_0xc8e4('0x7'));var attributes=require(_0xc8e4('0x8'));module['exports']=function(_0x3865a1,_0x11a861){return _0x3865a1[_0xc8e4('0x9')]('ScreenRecording',attributes,{'tableName':_0xc8e4('0xa'),'paranoid':![],'indexes':[{'name':_0xc8e4('0xb'),'fields':[_0xc8e4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 61dde22..5d15c9e 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 _0x8ebd=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x26aa07,_0x55175f){var _0x3683e9=function(_0x484a30){while(--_0x484a30){_0x26aa07['push'](_0x26aa07['shift']());}};_0x3683e9(++_0x55175f);}(_0x8ebd,0xca));var _0xd8eb=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x8ebd[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xd8eb('0x0'));var util=require(_0xd8eb('0x1'));var moment=require('moment');var BPromise=require(_0xd8eb('0x2'));var rs=require(_0xd8eb('0x3'));var fs=require('fs');var Redis=require(_0xd8eb('0x4'));var db=require(_0xd8eb('0x5'))['db'];var utils=require(_0xd8eb('0x6'));var logger=require('../../config/logger')(_0xd8eb('0x7'));var config=require('../../config/environment');var jayson=require(_0xd8eb('0x8'));var client=jayson['client'][_0xd8eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bb818,_0x56127b,_0x5f1531){return new BPromise(function(_0x36c6d2,_0x27bb7d){return client[_0xd8eb('0xa')](_0x5bb818,_0x5f1531)[_0xd8eb('0xb')](function(_0x5072f3){logger['info'](_0xd8eb('0xc'),_0x56127b,'request\x20sent');logger[_0xd8eb('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x56127b,_0xd8eb('0xe'),JSON['stringify'](_0x5072f3));if(_0x5072f3['error']){if(_0x5072f3[_0xd8eb('0xf')][_0xd8eb('0x10')]===0x1f4){logger['error'](_0xd8eb('0xc'),_0x56127b,_0x5072f3[_0xd8eb('0xf')][_0xd8eb('0x11')]);return _0x27bb7d(_0x5072f3['error'][_0xd8eb('0x11')]);}logger['error'](_0xd8eb('0xc'),_0x56127b,_0x5072f3['error'][_0xd8eb('0x11')]);return _0x36c6d2(_0x5072f3[_0xd8eb('0xf')]['message']);}else{logger['info'](_0xd8eb('0xc'),_0x56127b,'request\x20sent');_0x36c6d2(_0x5072f3[_0xd8eb('0x12')][_0xd8eb('0x11')]);}})[_0xd8eb('0x13')](function(_0xcc7057){logger[_0xd8eb('0xf')](_0xd8eb('0xc'),_0x56127b,_0xcc7057);_0x27bb7d(_0xcc7057);});});} \ No newline at end of file +var _0x0a69=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s'];(function(_0x207a74,_0x280ded){var _0x21118d=function(_0x432aba){while(--_0x432aba){_0x207a74['push'](_0x207a74['shift']());}};_0x21118d(++_0x280ded);}(_0x0a69,0x167));var _0x90a6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a69[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x90a6('0x0'));var util=require(_0x90a6('0x1'));var moment=require(_0x90a6('0x2'));var BPromise=require(_0x90a6('0x3'));var rs=require(_0x90a6('0x4'));var fs=require('fs');var Redis=require(_0x90a6('0x5'));var db=require(_0x90a6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x90a6('0x7'))('rpc');var config=require(_0x90a6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x90a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e9c86,_0x20b6aa,_0x2b43ea){return new BPromise(function(_0x4ea019,_0x3c4bc3){return client[_0x90a6('0xa')](_0x4e9c86,_0x2b43ea)[_0x90a6('0xb')](function(_0x2241f5){logger[_0x90a6('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x20b6aa,_0x90a6('0xd'));logger[_0x90a6('0xe')](_0x90a6('0xf'),_0x20b6aa,_0x90a6('0xd'),JSON[_0x90a6('0x10')](_0x2241f5));if(_0x2241f5[_0x90a6('0x11')]){if(_0x2241f5['error']['code']===0x1f4){logger[_0x90a6('0x11')](_0x90a6('0x12'),_0x20b6aa,_0x2241f5[_0x90a6('0x11')]['message']);return _0x3c4bc3(_0x2241f5['error'][_0x90a6('0x13')]);}logger[_0x90a6('0x11')](_0x90a6('0x12'),_0x20b6aa,_0x2241f5[_0x90a6('0x11')][_0x90a6('0x13')]);return _0x4ea019(_0x2241f5[_0x90a6('0x11')][_0x90a6('0x13')]);}else{logger['info'](_0x90a6('0x12'),_0x20b6aa,_0x90a6('0xd'));_0x4ea019(_0x2241f5['result'][_0x90a6('0x13')]);}})[_0x90a6('0x14')](function(_0x56470a){logger[_0x90a6('0x11')](_0x90a6('0x12'),_0x20b6aa,_0x56470a);_0x3c4bc3(_0x56470a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2da43c9..fbad4eb 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 _0xeb4f=['logologin','single','server/files/images/logos/','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','/now','getDate','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','/:id/logo','file','addLogo'];(function(_0x3bc9d3,_0x105bba){var _0x536b66=function(_0x9f8106){while(--_0x9f8106){_0x3bc9d3['push'](_0x3bc9d3['shift']());}};_0x536b66(++_0x105bba);}(_0xeb4f,0xb7));var _0xfeb4=function(_0x202d90,_0x148358){_0x202d90=_0x202d90-0x0;var _0x44b94b=_0xeb4f[_0x202d90];return _0x44b94b;};'use strict';var multer=require(_0xfeb4('0x0'));var util=require(_0xfeb4('0x1'));var path=require(_0xfeb4('0x2'));var timeout=require(_0xfeb4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfeb4('0x4'));var auth=require(_0xfeb4('0x5'));var interaction=require(_0xfeb4('0x6'));var config=require(_0xfeb4('0x7'));var controller=require(_0xfeb4('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfeb4('0x9')](_0xfeb4('0xa'),controller[_0xfeb4('0xb')]);router[_0xfeb4('0x9')](_0xfeb4('0xc'),controller[_0xfeb4('0xd')]);router[_0xfeb4('0x9')]('/:id/logo',controller['getLogo']);router[_0xfeb4('0x9')](_0xfeb4('0xe'),controller[_0xfeb4('0xf')]);router[_0xfeb4('0x9')](_0xfeb4('0x10'),controller['gdpr']);router['get'](_0xfeb4('0x11'),controller['getPreferred']);router['get'](_0xfeb4('0x12'),controller[_0xfeb4('0x13')]);var upload=multer({'storage':multer[_0xfeb4('0x14')]({'destination':function(_0x85d719,_0x2bcc26,_0x2136ab){_0x2136ab(null,path[_0xfeb4('0x15')](config[_0xfeb4('0x16')],'server/files/images/logos/'));},'filename':function(_0x2739f3,_0x279f6a,_0x511136){_0x511136(null,util[_0xfeb4('0x17')](_0xfeb4('0x18'),_0xfeb4('0x19'),path[_0xfeb4('0x1a')](_0x279f6a[_0xfeb4('0x1b')])));}})});router[_0xfeb4('0x1c')](_0xfeb4('0x1d'),upload['single'](_0xfeb4('0x1e')),controller[_0xfeb4('0x1f')]);var upload=multer({'storage':multer[_0xfeb4('0x14')]({'destination':function(_0x31c8ff,_0x55250b,_0x1ff3e3){_0x1ff3e3(null,path[_0xfeb4('0x15')](config[_0xfeb4('0x16')],'server/files/images/logos/'));},'filename':function(_0x26b8e8,_0x469d7f,_0x5aa925){_0x5aa925(null,util[_0xfeb4('0x17')]('%s%s',_0xfeb4('0x20'),path['extname'](_0x469d7f[_0xfeb4('0x1b')])));}})});router['post']('/:id/logo_login',upload[_0xfeb4('0x21')](_0xfeb4('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xfeb4('0x14')]({'destination':function(_0x292cb5,_0x225a7e,_0x447fed){_0x447fed(null,path[_0xfeb4('0x15')](config[_0xfeb4('0x16')],_0xfeb4('0x22')));},'filename':function(_0x301e7e,_0x16f1fc,_0x432ada){_0x432ada(null,util[_0xfeb4('0x17')]('%s%s',_0xfeb4('0x23'),path[_0xfeb4('0x1a')](_0x16f1fc[_0xfeb4('0x1b')])));}})});router[_0xfeb4('0x1c')]('/:id/preferred',upload[_0xfeb4('0x21')](_0xfeb4('0x1e')),controller[_0xfeb4('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4771be,_0x35336c,_0xd5df86){_0xd5df86(null,path['join'](config[_0xfeb4('0x16')],_0xfeb4('0x22')));},'filename':function(_0x363b53,_0x469e2a,_0x29beef){_0x29beef(null,util[_0xfeb4('0x17')](_0xfeb4('0x18'),_0xfeb4('0x25'),path[_0xfeb4('0x1a')](_0x469e2a['originalname'])));}})});router[_0xfeb4('0x1c')](_0xfeb4('0x12'),upload[_0xfeb4('0x21')](_0xfeb4('0x1e')),controller[_0xfeb4('0x26')]);router[_0xfeb4('0x27')](_0xfeb4('0xc'),auth[_0xfeb4('0x28')](),controller[_0xfeb4('0x29')]);module[_0xfeb4('0x2a')]=router; \ No newline at end of file +var _0x8e20=['logo','originalname','post','file','addLogo','logologin','extname','/:id/logo_login','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s'];(function(_0x1de423,_0xceb67f){var _0x5485ca=function(_0x2fe61c){while(--_0x2fe61c){_0x1de423['push'](_0x1de423['shift']());}};_0x5485ca(++_0xceb67f);}(_0x8e20,0x131));var _0x08e2=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x8e20[_0x3dea7d];return _0x53919a;};'use strict';var multer=require(_0x08e2('0x0'));var util=require('util');var path=require(_0x08e2('0x1'));var timeout=require(_0x08e2('0x2'));var express=require(_0x08e2('0x3'));var router=express[_0x08e2('0x4')]();var fs_extra=require(_0x08e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x08e2('0x6'));var config=require(_0x08e2('0x7'));var controller=require(_0x08e2('0x8'));router[_0x08e2('0x9')]('/',auth[_0x08e2('0xa')](),controller[_0x08e2('0xb')]);router[_0x08e2('0x9')](_0x08e2('0xc'),controller[_0x08e2('0xd')]);router[_0x08e2('0x9')](_0x08e2('0xe'),controller[_0x08e2('0xf')]);router['get'](_0x08e2('0x10'),controller[_0x08e2('0x11')]);router[_0x08e2('0x9')]('/:id/logo_login',controller[_0x08e2('0x12')]);router[_0x08e2('0x9')](_0x08e2('0x13'),controller[_0x08e2('0x14')]);router[_0x08e2('0x9')](_0x08e2('0x15'),controller[_0x08e2('0x16')]);router[_0x08e2('0x9')](_0x08e2('0x17'),controller[_0x08e2('0x18')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x5b8411,_0x7c06ec,_0x3da0af){_0x3da0af(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],_0x08e2('0x1c')));},'filename':function(_0x49bf41,_0x11627d,_0x3cb1f9){_0x3cb1f9(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x1f'),path['extname'](_0x11627d[_0x08e2('0x20')])));}})});router[_0x08e2('0x21')](_0x08e2('0x10'),upload['single'](_0x08e2('0x22')),controller[_0x08e2('0x23')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x920d6e,_0x1f65f6,_0x10e2d5){_0x10e2d5(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],_0x08e2('0x1c')));},'filename':function(_0x35f2eb,_0x4d73f8,_0x5dd2fe){_0x5dd2fe(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x24'),path[_0x08e2('0x25')](_0x4d73f8['originalname'])));}})});router[_0x08e2('0x21')](_0x08e2('0x26'),upload[_0x08e2('0x27')](_0x08e2('0x22')),controller[_0x08e2('0x28')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x2fb83b,_0x22dc06,_0x1d87f6){_0x1d87f6(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],_0x08e2('0x1c')));},'filename':function(_0x4fcb27,_0xe86f65,_0x3f3add){_0x3f3add(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x29'),path[_0x08e2('0x25')](_0xe86f65[_0x08e2('0x20')])));}})});router['post'](_0x08e2('0x15'),upload[_0x08e2('0x27')]('file'),controller[_0x08e2('0x2a')]);var upload=multer({'storage':multer[_0x08e2('0x19')]({'destination':function(_0x4d9c25,_0x4043e1,_0x1f0717){_0x1f0717(null,path[_0x08e2('0x1a')](config[_0x08e2('0x1b')],'server/files/images/logos/'));},'filename':function(_0x28d6ed,_0x423e90,_0x2ad681){_0x2ad681(null,util[_0x08e2('0x1d')](_0x08e2('0x1e'),_0x08e2('0x2b'),path[_0x08e2('0x25')](_0x423e90[_0x08e2('0x20')])));}})});router[_0x08e2('0x21')]('/:id/favicon',upload[_0x08e2('0x27')](_0x08e2('0x22')),controller[_0x08e2('0x2c')]);router[_0x08e2('0x2d')](_0x08e2('0xe'),auth[_0x08e2('0xa')](),controller[_0x08e2('0x2e')]);module[_0x08e2('0x2f')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a52ae74..ba1d2ad 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 _0x1e56=['INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','alternate','UNSIGNED','exports'];(function(_0x57ee85,_0x32bf8b){var _0x1f943c=function(_0x4e0847){while(--_0x4e0847){_0x57ee85['push'](_0x57ee85['shift']());}};_0x1f943c(++_0x32bf8b);}(_0x1e56,0x86));var _0x61e5=function(_0x4ac10b,_0x4bf408){_0x4ac10b=_0x4ac10b-0x0;var _0x87a0f8=_0x1e56[_0x4ac10b];return _0x87a0f8;};'use strict';var Sequelize=require('sequelize');module[_0x61e5('0x0')]={'min_internal':{'type':Sequelize[_0x61e5('0x1')](0xb),'unique':_0x61e5('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x61e5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x61e5('0x4')},'logo':{'type':Sequelize[_0x61e5('0x5')]},'defaultLogo':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x61e5('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x61e5('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x61e5('0x5')]},'turnaddr':{'type':Sequelize[_0x61e5('0x5')]},'turnusername':{'type':Sequelize[_0x61e5('0x5')]},'turnpassword':{'type':Sequelize[_0x61e5('0x5')]},'pageTitle':{'type':Sequelize[_0x61e5('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x61e5('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x61e5('0x5')],'defaultValue':_0x61e5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x61e5('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x61e5('0x5')]},'defaultFavicon':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x61e5('0x1')]},'transcribeRegion':{'type':Sequelize[_0x61e5('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x61e5('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x61e5('0x5')]},'bucket':{'type':Sequelize[_0x61e5('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x61e5('0x1')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x61e5('0x1')](0x2)[_0x61e5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x61e5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x61e5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x61e5('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x61e5('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6ed7=['sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED'];(function(_0x1783a0,_0x5efcd7){var _0x307ffe=function(_0x56b64c){while(--_0x56b64c){_0x1783a0['push'](_0x1783a0['shift']());}};_0x307ffe(++_0x5efcd7);}(_0x6ed7,0x108));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x76ed('0x0'));module[_0x76ed('0x1')]={'min_internal':{'type':Sequelize[_0x76ed('0x2')](0xb),'unique':_0x76ed('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x76ed('0x2')](0xb),'unique':_0x76ed('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x76ed('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x76ed('0x5')],'defaultValue':_0x76ed('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x76ed('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x76ed('0x5')]},'turnaddr':{'type':Sequelize[_0x76ed('0x5')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x76ed('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x76ed('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x76ed('0x5')],'defaultValue':_0x76ed('0x8')},'enableEmailPreview':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x76ed('0x5')],'defaultValue':_0x76ed('0x9')},'chatTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x76ed('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x76ed('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x76ed('0x5')]},'sentiment':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x76ed('0x2')]},'sentimentRegion':{'type':Sequelize[_0x76ed('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x76ed('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x76ed('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x76ed('0x2')](0x2)[_0x76ed('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x76ed('0x2')](0x2)[_0x76ed('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x76ed('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x76ed('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x76ed('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4210d48..286a5f2 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 _0xc47e=['ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','sendStatus','stack','name','send','index','map','Setting','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','default_logo.svg','default','upperFirst','custom','toLower','Sequelize','download','defaultLoginLogo','defaultPreferred','default_loginLogo.svg'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xc47e,0x17b));var _0xec47=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0xc47e[_0x296809];return _0x18c0d3;};'use strict';var emlformat=require(_0xec47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec47('0x1'));var jsonpatch=require(_0xec47('0x2'));var rp=require(_0xec47('0x3'));var moment=require(_0xec47('0x4'));var BPromise=require(_0xec47('0x5'));var Mustache=require(_0xec47('0x6'));var util=require('util');var path=require(_0xec47('0x7'));var sox=require('sox');var csv=require(_0xec47('0x8'));var ejs=require(_0xec47('0x9'));var fs=require('fs');var fs_extra=require(_0xec47('0xa'));var _=require('lodash');var squel=require(_0xec47('0xb'));var crypto=require(_0xec47('0xc'));var jsforce=require(_0xec47('0xd'));var deskjs=require(_0xec47('0xe'));var toCsv=require(_0xec47('0x8'));var querystring=require('querystring');var Papa=require(_0xec47('0xf'));var Redis=require(_0xec47('0x10'));var authService=require(_0xec47('0x11'));var qs=require(_0xec47('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec47('0x13'));var logger=require(_0xec47('0x14'))('api');var utils=require(_0xec47('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec47('0x16'));var db=require(_0xec47('0x17'))['db'];var jayson=require(_0xec47('0x18'));var client=jayson[_0xec47('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9385,_0x30b96f,_0x3fbe56,_0x4b696e){return new BPromise(function(_0x2631ef,_0xe89f29){var _0x24fd9d=_0x4b696e||client;return _0x24fd9d[_0xec47('0x1a')](_0x1d9385,_0x3fbe56)[_0xec47('0x1b')](function(_0x378c51){logger[_0xec47('0x1c')](_0xec47('0x1d'),_0x30b96f,_0xec47('0x1e'));logger[_0xec47('0x1f')](_0xec47('0x20'),_0x30b96f,'request\x20sent',JSON[_0xec47('0x21')](_0x378c51));if(_0x378c51['error']){if(_0x378c51[_0xec47('0x22')][_0xec47('0x23')]===0x1f4){logger[_0xec47('0x22')](_0xec47('0x1d'),_0x30b96f,_0x378c51[_0xec47('0x22')][_0xec47('0x24')]);return _0xe89f29(_0x378c51[_0xec47('0x22')]['message']);}logger[_0xec47('0x22')](_0xec47('0x1d'),_0x30b96f,_0x378c51[_0xec47('0x22')][_0xec47('0x24')]);return _0x2631ef(_0x378c51[_0xec47('0x22')][_0xec47('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x30b96f,_0xec47('0x1e'));_0x2631ef(_0x378c51[_0xec47('0x25')][_0xec47('0x24')]);}})[_0xec47('0x26')](function(_0x715dd){logger['error'](_0xec47('0x1d'),_0x30b96f,_0x715dd);_0xe89f29(_0x715dd);});});}function respondWithStatusCode(_0x53ec77,_0x4ed56c){_0x4ed56c=_0x4ed56c||0xcc;return function(_0x2c8d72){if(_0x2c8d72){return _0x53ec77['sendStatus'](_0x4ed56c);}return _0x53ec77[_0xec47('0x27')](_0x4ed56c)[_0xec47('0x28')]();};}function respondWithResult(_0x405c0c,_0x28fe64){_0x28fe64=_0x28fe64||0xc8;return function(_0x46cdaa){if(_0x46cdaa){return _0x405c0c[_0xec47('0x27')](_0x28fe64)[_0xec47('0x29')](_0x46cdaa);}};}function respondWithFilteredResult(_0x9ccf20,_0xded5af){return function(_0x3cb887){if(_0x3cb887){var _0x2b9aba=typeof _0xded5af[_0xec47('0x2a')]===_0xec47('0x2b')&&typeof _0xded5af[_0xec47('0x2c')]===_0xec47('0x2b');var _0x3de86e=_0x3cb887['count'];var _0xd692fd=_0x2b9aba?0x0:_0xded5af[_0xec47('0x2a')];var _0x3370ee=_0x2b9aba?_0x3cb887[_0xec47('0x2d')]:_0xded5af[_0xec47('0x2a')]+_0xded5af['limit'];var _0x1fd433;if(_0x3370ee>=_0x3de86e){_0x3370ee=_0x3de86e;_0x1fd433=0xc8;}else{_0x1fd433=0xce;}_0x9ccf20[_0xec47('0x27')](_0x1fd433);return _0x9ccf20[_0xec47('0x2e')](_0xec47('0x2f'),_0xd692fd+'-'+_0x3370ee+'/'+_0x3de86e)[_0xec47('0x29')](_0x3cb887);}return null;};}function patchUpdates(_0x43ef1e){return function(_0x1e1609){try{jsonpatch[_0xec47('0x30')](_0x1e1609,_0x43ef1e,!![]);}catch(_0x228813){return BPromise['reject'](_0x228813);}return _0x1e1609['save']();};}function saveUpdates(_0x53a705,_0xabf455){return function(_0xeccfd5){if(_0xeccfd5){return _0xeccfd5[_0xec47('0x31')](_0x53a705)[_0xec47('0x1b')](function(_0x5ccc0a){return _0x5ccc0a;});}return null;};}function removeEntity(_0x1f5d1a,_0x329909){return function(_0x3a98ce){if(_0x3a98ce){return _0x3a98ce[_0xec47('0x32')]()['then'](function(){_0x1f5d1a['status'](0xcc)[_0xec47('0x28')]();});}};}function handleEntityNotFound(_0x198059,_0x36918a){return function(_0x89f10b){if(!_0x89f10b){_0x198059[_0xec47('0x33')](0x194);}return _0x89f10b;};}function handleError(_0xdc100a,_0x28098b){_0x28098b=_0x28098b||0x1f4;return function(_0x36f6d){logger[_0xec47('0x22')](_0x36f6d[_0xec47('0x34')]);if(_0x36f6d[_0xec47('0x35')]){delete _0x36f6d[_0xec47('0x35')];}_0xdc100a[_0xec47('0x27')](_0x28098b)[_0xec47('0x36')](_0x36f6d);};}exports[_0xec47('0x37')]=function(_0x3dfe54,_0x11b9f5){var _0x3a765b={},_0x5b8b7c={},_0x255ce9={'count':0x0,'rows':[]};var _0x548503=_[_0xec47('0x38')](db[_0xec47('0x39')]['rawAttributes'],function(_0x29baab){return{'name':_0x29baab[_0xec47('0x3a')],'type':_0x29baab[_0xec47('0x3b')]['key']};});_0x5b8b7c[_0xec47('0x3c')]=_[_0xec47('0x38')](_0x548503,'name');_0x5b8b7c[_0xec47('0x3d')]=_[_0xec47('0x3e')](_0x3dfe54[_0xec47('0x3d')]);_0x5b8b7c[_0xec47('0x3f')]=_['intersection'](_0x5b8b7c[_0xec47('0x3c')],_0x5b8b7c[_0xec47('0x3d')]);_0x3a765b[_0xec47('0x40')]=_[_0xec47('0x41')](_0x5b8b7c['model'],qs[_0xec47('0x42')](_0x3dfe54[_0xec47('0x3d')]['fields']));_0x3a765b[_0xec47('0x40')]=_0x3a765b['attributes']['length']?_0x3a765b[_0xec47('0x40')]:_0x5b8b7c['model'];if(!_0x3dfe54[_0xec47('0x3d')]['hasOwnProperty'](_0xec47('0x43'))){_0x3a765b[_0xec47('0x2c')]=qs['limit'](_0x3dfe54['query'][_0xec47('0x2c')]);_0x3a765b[_0xec47('0x2a')]=qs[_0xec47('0x2a')](_0x3dfe54['query'][_0xec47('0x2a')]);}_0x3a765b[_0xec47('0x44')]=qs[_0xec47('0x45')](_0x3dfe54[_0xec47('0x3d')][_0xec47('0x45')]);_0x3a765b[_0xec47('0x46')]=qs[_0xec47('0x3f')](_['pick'](_0x3dfe54[_0xec47('0x3d')],_0x5b8b7c[_0xec47('0x3f')]),_0x548503);if(_0x3dfe54['query'][_0xec47('0x47')]){_0x3a765b[_0xec47('0x46')]=_[_0xec47('0x48')](_0x3a765b[_0xec47('0x46')],{'$or':_[_0xec47('0x38')](_0x548503,function(_0x164ad2){if(_0x164ad2['type']!=='VIRTUAL'){var _0x55e8ee={};_0x55e8ee[_0x164ad2[_0xec47('0x35')]]={'$like':'%'+_0x3dfe54['query'][_0xec47('0x47')]+'%'};return _0x55e8ee;}})});}_0x3a765b=_['merge']({},_0x3a765b,_0x3dfe54[_0xec47('0x49')]);var _0x555097={'where':_0x3a765b[_0xec47('0x46')]};return db[_0xec47('0x39')][_0xec47('0x2d')](_0x555097)[_0xec47('0x1b')](function(_0x496f8d){_0x255ce9['count']=_0x496f8d;if(_0x3dfe54[_0xec47('0x3d')][_0xec47('0x4a')]){_0x3a765b[_0xec47('0x4b')]=[{'all':!![]}];}return db[_0xec47('0x39')][_0xec47('0x4c')](_0x3a765b);})['then'](function(_0x4d07ed){_0x255ce9[_0xec47('0x4d')]=_0x4d07ed;return _0x255ce9;})[_0xec47('0x1b')](respondWithFilteredResult(_0x11b9f5,_0x3a765b))[_0xec47('0x26')](handleError(_0x11b9f5,null));};exports[_0xec47('0x4e')]=function(_0x1d02b2,_0x5aea4d){var _0x5196af={'raw':![],'where':{'id':_0x1d02b2[_0xec47('0x4f')]['id']}},_0x3f0241={};_0x3f0241['model']=_[_0xec47('0x3e')](db['Setting'][_0xec47('0x50')]);_0x3f0241[_0xec47('0x3d')]=_['keys'](_0x1d02b2[_0xec47('0x3d')]);_0x3f0241[_0xec47('0x3f')]=_[_0xec47('0x41')](_0x3f0241[_0xec47('0x3c')],_0x3f0241['query']);_0x5196af['attributes']=_[_0xec47('0x41')](_0x3f0241[_0xec47('0x3c')],qs[_0xec47('0x42')](_0x1d02b2[_0xec47('0x3d')][_0xec47('0x42')]));_0x5196af[_0xec47('0x40')]=_0x5196af[_0xec47('0x40')]['length']?_0x5196af[_0xec47('0x40')]:_0x3f0241['model'];if(_0x1d02b2['query'][_0xec47('0x4a')]){_0x5196af[_0xec47('0x4b')]=[{'all':!![]}];}_0x5196af=_[_0xec47('0x48')]({},_0x5196af,_0x1d02b2['options']);return db[_0xec47('0x39')][_0xec47('0x51')](_0x5196af)[_0xec47('0x1b')](handleEntityNotFound(_0x5aea4d,null))[_0xec47('0x1b')](respondWithResult(_0x5aea4d,null))[_0xec47('0x26')](handleError(_0x5aea4d,null));};exports[_0xec47('0x31')]=function(_0x3c53ef,_0x1e1cfc){if(_0x3c53ef[_0xec47('0x52')]['id']){delete _0x3c53ef[_0xec47('0x52')]['id'];}return db[_0xec47('0x39')][_0xec47('0x51')]({'where':{'id':_0x3c53ef[_0xec47('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1e1cfc,null))[_0xec47('0x1b')](saveUpdates(_0x3c53ef['body'],null))[_0xec47('0x1b')](respondWithResult(_0x1e1cfc,null))['catch'](handleError(_0x1e1cfc,null));};exports[_0xec47('0x53')]=function(_0x50854a,_0x41ec14,_0x27218c){if(_0x50854a['file']&&_0x50854a[_0xec47('0x54')][_0xec47('0x55')]){_0x50854a[_0xec47('0x52')][_0xec47('0x56')]=_0x50854a[_0xec47('0x54')][_0xec47('0x55')];}return db['Setting']['find']({'where':{'id':_0x50854a[_0xec47('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41ec14,null))['then'](saveUpdates(_0x50854a[_0xec47('0x52')],null))[_0xec47('0x1b')](respondWithResult(_0x41ec14,null))[_0xec47('0x26')](handleError(_0x41ec14,null));};exports[_0xec47('0x57')]=function(_0x34bc3a,_0x39b034,_0x337cd1){if(_0x34bc3a[_0xec47('0x54')]&&_0x34bc3a['file']['filename']){_0x34bc3a['body'][_0xec47('0x58')]=_0x34bc3a['file'][_0xec47('0x55')];}return db[_0xec47('0x39')][_0xec47('0x51')]({'where':{'id':_0x34bc3a['params']['id']}})[_0xec47('0x1b')](handleEntityNotFound(_0x39b034,null))[_0xec47('0x1b')](saveUpdates(_0x34bc3a[_0xec47('0x52')],null))[_0xec47('0x1b')](respondWithResult(_0x39b034,null))[_0xec47('0x26')](handleError(_0x39b034,null));};var utilLicense=require('../../config/license/util');exports[_0xec47('0x59')]=function(_0x7165cc,_0x1dae25,_0x18cbbb){var _0x2045cb=_0xec47('0x5a');var _0x1f31a3={'custom':![]};return utilLicense[_0xec47('0x5b')]()['then'](function(_0x33f577){if(_0x33f577){_0x1f31a3=_0x33f577;}return db[_0xec47('0x39')][_0xec47('0x51')]({'where':{'id':_0x7165cc[_0xec47('0x4f')]['id']},'attributes':['logo','loginLogo',_0xec47('0x5c'),_0xec47('0x5d'),_0xec47('0x5e'),'defaultLoginLogo','defaultPreferred',_0xec47('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x1dae25,null))[_0xec47('0x1b')](function(_0xd6f10a){if(_0xd6f10a){var _0x144853=_0xd6f10a[_0xec47('0x56')]&&fs[_0xec47('0x60')](path[_0xec47('0x61')](config[_0xec47('0x62')],_0x2045cb,_['toLower'](_0xd6f10a[_0xec47('0x56')])))?path[_0xec47('0x61')](config[_0xec47('0x62')],_0x2045cb,_['toLower'](_0xd6f10a[_0xec47('0x56')])):path[_0xec47('0x61')](config[_0xec47('0x62')],_0x2045cb,_['toLower'](_0xec47('0x63')));var _0x35e65a=_0xec47('0x64')+_[_0xec47('0x65')](_0xec47('0x56'));if(_0xd6f10a[_0x35e65a]||!_0x1f31a3[_0xec47('0x66')]){_0x144853=path['join'](config['root'],_0x2045cb,_[_0xec47('0x67')](_0xec47('0x63')));}if(!fs[_0xec47('0x60')](_0x144853)){throw new db[(_0xec47('0x68'))]['ValidationError'](_[_0xec47('0x65')](_0xec47('0x56'))+'\x20not\x20found');}return _0x1dae25[_0xec47('0x69')](_0x144853);}})['catch'](handleError(_0x1dae25,null));};var utilLicense=require(_0xec47('0x16'));exports['getLogoLogin']=function(_0x354b62,_0x4f3051,_0x2b2083){var _0x43ddd4='server/files/images/logos';var _0x21f5b6={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x34f058){if(_0x34f058){_0x21f5b6=_0x34f058;}return db[_0xec47('0x39')]['find']({'where':{'id':_0x354b62[_0xec47('0x4f')]['id']},'attributes':[_0xec47('0x56'),_0xec47('0x58'),_0xec47('0x5c'),'favicon','defaultLogo',_0xec47('0x6a'),_0xec47('0x6b'),_0xec47('0x5f')],'raw':!![]});})[_0xec47('0x1b')](handleEntityNotFound(_0x4f3051,null))[_0xec47('0x1b')](function(_0x534916){if(_0x534916){var _0xf398ed=_0x534916[_0xec47('0x58')]&&fs[_0xec47('0x60')](path[_0xec47('0x61')](config[_0xec47('0x62')],_0x43ddd4,_[_0xec47('0x67')](_0x534916[_0xec47('0x58')])))?path[_0xec47('0x61')](config['root'],_0x43ddd4,_[_0xec47('0x67')](_0x534916[_0xec47('0x58')])):path[_0xec47('0x61')](config[_0xec47('0x62')],_0x43ddd4,_['toLower'](_0xec47('0x6c')));var _0x5e28df=_0xec47('0x64')+_[_0xec47('0x65')]('loginLogo');if(_0x534916[_0x5e28df]||!_0x21f5b6[_0xec47('0x66')]){_0xf398ed=path[_0xec47('0x61')](config[_0xec47('0x62')],_0x43ddd4,_[_0xec47('0x67')](_0xec47('0x6c')));}if(!fs['existsSync'](_0xf398ed)){throw new db[(_0xec47('0x68'))][(_0xec47('0x6d'))](_[_0xec47('0x65')](_0xec47('0x58'))+_0xec47('0x6e'));}return _0x4f3051['download'](_0xf398ed);}})[_0xec47('0x26')](handleError(_0x4f3051,null));};exports[_0xec47('0x6f')]=function(_0x512b89,_0x1db9c2){return db[_0xec47('0x39')]['find']({'where':{'id':_0x512b89['params']['id']},'attributes':[_0xec47('0x70')]})[_0xec47('0x1b')](respondWithResult(_0x1db9c2,null))[_0xec47('0x26')](handleError(_0x1db9c2,null));};exports[_0xec47('0x71')]=function(_0x4144a7,_0x1983d0,_0x2fcdac){if(_0x4144a7[_0xec47('0x54')]&&_0x4144a7[_0xec47('0x54')]['filename']){_0x4144a7[_0xec47('0x52')][_0xec47('0x5c')]=_0x4144a7['file'][_0xec47('0x55')];}return db[_0xec47('0x39')]['find']({'where':{'id':_0x4144a7['params']['id']}})['then'](handleEntityNotFound(_0x1983d0,null))[_0xec47('0x1b')](saveUpdates(_0x4144a7['body'],null))[_0xec47('0x1b')](respondWithResult(_0x1983d0,null))[_0xec47('0x26')](handleError(_0x1983d0,null));};var utilLicense=require('../../config/license/util');exports[_0xec47('0x72')]=function(_0x2b8b54,_0x9933c7,_0x40a14e){var _0x10bc9a=_0xec47('0x5a');var _0x30f73d={'custom':![]};return utilLicense['getLicense']()[_0xec47('0x1b')](function(_0x376d2b){if(_0x376d2b){_0x30f73d=_0x376d2b;}return db['Setting'][_0xec47('0x51')]({'where':{'id':_0x2b8b54[_0xec47('0x4f')]['id']},'attributes':['logo',_0xec47('0x58'),_0xec47('0x5c'),_0xec47('0x5d'),_0xec47('0x5e'),_0xec47('0x6a'),'defaultPreferred',_0xec47('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x9933c7,null))['then'](function(_0x120fec){if(_0x120fec){var _0x5f0545=_0x120fec[_0xec47('0x5c')]&&fs[_0xec47('0x60')](path[_0xec47('0x61')](config[_0xec47('0x62')],_0x10bc9a,_[_0xec47('0x67')](_0x120fec[_0xec47('0x5c')])))?path[_0xec47('0x61')](config[_0xec47('0x62')],_0x10bc9a,_[_0xec47('0x67')](_0x120fec[_0xec47('0x5c')])):path['join'](config['root'],_0x10bc9a,_[_0xec47('0x67')](_0xec47('0x73')));var _0x480aa5=_0xec47('0x64')+_[_0xec47('0x65')](_0xec47('0x5c'));if(_0x120fec[_0x480aa5]||!_0x30f73d['custom']||!_0x30f73d['preferred']){_0x5f0545=path[_0xec47('0x61')](config['root'],_0x10bc9a,_[_0xec47('0x67')]('default_preferred.png'));}if(!fs[_0xec47('0x60')](_0x5f0545)){throw new db['Sequelize']['ValidationError'](_[_0xec47('0x65')](_0xec47('0x5c'))+_0xec47('0x6e'));}return _0x9933c7[_0xec47('0x69')](_0x5f0545);}})['catch'](handleError(_0x9933c7,null));};exports['addFavicon']=function(_0x27b5f3,_0x31df7a,_0x45a831){if(_0x27b5f3[_0xec47('0x54')]&&_0x27b5f3[_0xec47('0x54')][_0xec47('0x55')]){_0x27b5f3[_0xec47('0x52')][_0xec47('0x5d')]=_0x27b5f3['file']['filename'];}return db[_0xec47('0x39')][_0xec47('0x51')]({'where':{'id':_0x27b5f3[_0xec47('0x4f')]['id']}})['then'](handleEntityNotFound(_0x31df7a,null))[_0xec47('0x1b')](saveUpdates(_0x27b5f3[_0xec47('0x52')],null))[_0xec47('0x1b')](respondWithResult(_0x31df7a,null))['catch'](handleError(_0x31df7a,null));};var utilLicense=require(_0xec47('0x16'));exports['getFavicon']=function(_0x8273fb,_0x4e1e61,_0x292336){var _0x16bd65='server/files/images/logos';var _0x281821={'custom':![]};return utilLicense[_0xec47('0x5b')]()[_0xec47('0x1b')](function(_0x9d7a16){if(_0x9d7a16){_0x281821=_0x9d7a16;}return db[_0xec47('0x39')]['find']({'where':{'id':_0x8273fb[_0xec47('0x4f')]['id']},'attributes':[_0xec47('0x56'),_0xec47('0x58'),_0xec47('0x5c'),'favicon',_0xec47('0x5e'),'defaultLoginLogo',_0xec47('0x6b'),'defaultFavicon'],'raw':!![]});})[_0xec47('0x1b')](handleEntityNotFound(_0x4e1e61,null))[_0xec47('0x1b')](function(_0x28f227){if(_0x28f227){var _0x160172=_0x28f227[_0xec47('0x5d')]&&fs['existsSync'](path[_0xec47('0x61')](config[_0xec47('0x62')],_0x16bd65,_['toLower'](_0x28f227[_0xec47('0x5d')])))?path[_0xec47('0x61')](config[_0xec47('0x62')],_0x16bd65,_['toLower'](_0x28f227[_0xec47('0x5d')])):path['join'](config[_0xec47('0x62')],_0x16bd65,_[_0xec47('0x67')](_0xec47('0x74')));var _0x1553b6=_0xec47('0x64')+_['upperFirst'](_0xec47('0x5d'));if(_0x28f227[_0x1553b6]||!_0x281821[_0xec47('0x66')]){_0x160172=path[_0xec47('0x61')](config['root'],_0x16bd65,_[_0xec47('0x67')]('default_favicon.ico'));}if(!fs['existsSync'](_0x160172)){throw new db[(_0xec47('0x68'))][(_0xec47('0x6d'))](_[_0xec47('0x65')](_0xec47('0x5d'))+'\x20not\x20found');}return _0x4e1e61['download'](_0x160172);}})[_0xec47('0x26')](handleError(_0x4e1e61,null));};exports[_0xec47('0x75')]=function(_0x582933,_0x32d544){var _0x4bd741={'offset':moment()[_0xec47('0x76')]()};_0x4bd741[_0xec47('0x77')]=moment()[_0xec47('0x76')](_0x4bd741[_0xec47('0x2a')])[_0xec47('0x78')](_0xec47('0x79'));return _0x32d544['status'](0xc8)['send'](_0x4bd741);}; \ No newline at end of file +var _0x21ca=['reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','find','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','server/files/images/logos','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','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','api','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x21ca,0x14e));var _0xa21c=function(_0x2a472f,_0x31f3af){_0x2a472f=_0x2a472f-0x0;var _0x434833=_0x21ca[_0x2a472f];return _0x434833;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa21c('0x0'));var zipdir=require(_0xa21c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa21c('0x2'));var moment=require(_0xa21c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa21c('0x4'));var util=require(_0xa21c('0x5'));var path=require(_0xa21c('0x6'));var sox=require(_0xa21c('0x7'));var csv=require('to-csv');var ejs=require(_0xa21c('0x8'));var fs=require('fs');var fs_extra=require(_0xa21c('0x9'));var _=require('lodash');var squel=require(_0xa21c('0xa'));var crypto=require('crypto');var jsforce=require(_0xa21c('0xb'));var deskjs=require(_0xa21c('0xc'));var toCsv=require(_0xa21c('0xd'));var querystring=require(_0xa21c('0xe'));var Papa=require(_0xa21c('0xf'));var Redis=require(_0xa21c('0x10'));var authService=require(_0xa21c('0x11'));var qs=require(_0xa21c('0x12'));var as=require(_0xa21c('0x13'));var hardwareService=require(_0xa21c('0x14'));var logger=require(_0xa21c('0x15'))(_0xa21c('0x16'));var utils=require('../../config/utils');var config=require(_0xa21c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xa21c('0x18'));var client=jayson['client'][_0xa21c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x45b233,_0x3180d7,_0x1e127d,_0x2c130b){return new BPromise(function(_0xb2e0a7,_0x21135c){var _0x30941=_0x2c130b||client;return _0x30941[_0xa21c('0x1a')](_0x45b233,_0x1e127d)[_0xa21c('0x1b')](function(_0x1de585){logger[_0xa21c('0x1c')](_0xa21c('0x1d'),_0x3180d7,_0xa21c('0x1e'));logger[_0xa21c('0x1f')](_0xa21c('0x20'),_0x3180d7,'request\x20sent',JSON['stringify'](_0x1de585));if(_0x1de585[_0xa21c('0x21')]){if(_0x1de585[_0xa21c('0x21')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3180d7,_0x1de585[_0xa21c('0x21')][_0xa21c('0x22')]);return _0x21135c(_0x1de585['error'][_0xa21c('0x22')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3180d7,_0x1de585['error'][_0xa21c('0x22')]);return _0xb2e0a7(_0x1de585['error']['message']);}else{logger[_0xa21c('0x1c')](_0xa21c('0x1d'),_0x3180d7,_0xa21c('0x1e'));_0xb2e0a7(_0x1de585[_0xa21c('0x23')][_0xa21c('0x22')]);}})[_0xa21c('0x24')](function(_0x1fa6bb){logger['error'](_0xa21c('0x1d'),_0x3180d7,_0x1fa6bb);_0x21135c(_0x1fa6bb);});});}function respondWithStatusCode(_0x184671,_0x40c735){_0x40c735=_0x40c735||0xcc;return function(_0x56e9c2){if(_0x56e9c2){return _0x184671[_0xa21c('0x25')](_0x40c735);}return _0x184671[_0xa21c('0x26')](_0x40c735)[_0xa21c('0x27')]();};}function respondWithResult(_0x484638,_0x369b63){_0x369b63=_0x369b63||0xc8;return function(_0x1fde2d){if(_0x1fde2d){return _0x484638[_0xa21c('0x26')](_0x369b63)[_0xa21c('0x28')](_0x1fde2d);}};}function respondWithFilteredResult(_0x702c13,_0x3dec82){return function(_0x46a56f){if(_0x46a56f){var _0x49178e=typeof _0x3dec82[_0xa21c('0x29')]===_0xa21c('0x2a')&&typeof _0x3dec82[_0xa21c('0x2b')]===_0xa21c('0x2a');var _0x59e2ca=_0x46a56f[_0xa21c('0x2c')];var _0x4c173a=_0x49178e?0x0:_0x3dec82[_0xa21c('0x29')];var _0x37b3bd=_0x49178e?_0x46a56f[_0xa21c('0x2c')]:_0x3dec82[_0xa21c('0x29')]+_0x3dec82['limit'];var _0xa1c700;if(_0x37b3bd>=_0x59e2ca){_0x37b3bd=_0x59e2ca;_0xa1c700=0xc8;}else{_0xa1c700=0xce;}_0x702c13['status'](_0xa1c700);return _0x702c13[_0xa21c('0x2d')]('Content-Range',_0x4c173a+'-'+_0x37b3bd+'/'+_0x59e2ca)[_0xa21c('0x28')](_0x46a56f);}return null;};}function patchUpdates(_0x31b5d0){return function(_0x2171a3){try{jsonpatch[_0xa21c('0x2e')](_0x2171a3,_0x31b5d0,!![]);}catch(_0x367ff0){return BPromise[_0xa21c('0x2f')](_0x367ff0);}return _0x2171a3[_0xa21c('0x30')]();};}function saveUpdates(_0x867cd,_0x545866){return function(_0x2a25e4){if(_0x2a25e4){return _0x2a25e4[_0xa21c('0x31')](_0x867cd)[_0xa21c('0x1b')](function(_0x21a39e){return _0x21a39e;});}return null;};}function removeEntity(_0xf27830,_0x1818a1){return function(_0x2a7e53){if(_0x2a7e53){return _0x2a7e53[_0xa21c('0x32')]()[_0xa21c('0x1b')](function(){_0xf27830['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x119bb6,_0x1a795d){return function(_0x33a6ff){if(!_0x33a6ff){_0x119bb6[_0xa21c('0x25')](0x194);}return _0x33a6ff;};}function handleError(_0x215913,_0x3dca34){_0x3dca34=_0x3dca34||0x1f4;return function(_0x163fa0){logger[_0xa21c('0x21')](_0x163fa0[_0xa21c('0x33')]);if(_0x163fa0[_0xa21c('0x34')]){delete _0x163fa0[_0xa21c('0x34')];}_0x215913[_0xa21c('0x26')](_0x3dca34)[_0xa21c('0x35')](_0x163fa0);};}exports['index']=function(_0x23d4c9,_0x3887f6){var _0x16a904={},_0xbeec96={},_0xb53577={'count':0x0,'rows':[]};var _0x28eb08=_[_0xa21c('0x36')](db[_0xa21c('0x37')][_0xa21c('0x38')],function(_0x3794a7){return{'name':_0x3794a7['fieldName'],'type':_0x3794a7[_0xa21c('0x39')][_0xa21c('0x3a')]};});_0xbeec96[_0xa21c('0x3b')]=_[_0xa21c('0x36')](_0x28eb08,_0xa21c('0x34'));_0xbeec96[_0xa21c('0x3c')]=_[_0xa21c('0x3d')](_0x23d4c9[_0xa21c('0x3c')]);_0xbeec96['filters']=_[_0xa21c('0x3e')](_0xbeec96['model'],_0xbeec96[_0xa21c('0x3c')]);_0x16a904['attributes']=_[_0xa21c('0x3e')](_0xbeec96[_0xa21c('0x3b')],qs['fields'](_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x3f')]));_0x16a904[_0xa21c('0x40')]=_0x16a904[_0xa21c('0x40')][_0xa21c('0x41')]?_0x16a904[_0xa21c('0x40')]:_0xbeec96['model'];if(!_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x42')](_0xa21c('0x43'))){_0x16a904[_0xa21c('0x2b')]=qs['limit'](_0x23d4c9['query'][_0xa21c('0x2b')]);_0x16a904[_0xa21c('0x29')]=qs['offset'](_0x23d4c9[_0xa21c('0x3c')]['offset']);}_0x16a904[_0xa21c('0x44')]=qs[_0xa21c('0x45')](_0x23d4c9[_0xa21c('0x3c')]['sort']);_0x16a904[_0xa21c('0x46')]=qs[_0xa21c('0x47')](_[_0xa21c('0x48')](_0x23d4c9[_0xa21c('0x3c')],_0xbeec96['filters']),_0x28eb08);if(_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x49')]){_0x16a904[_0xa21c('0x46')]=_[_0xa21c('0x4a')](_0x16a904[_0xa21c('0x46')],{'$or':_[_0xa21c('0x36')](_0x28eb08,function(_0x2ea3c4){if(_0x2ea3c4['type']!==_0xa21c('0x4b')){var _0x1c41a6={};_0x1c41a6[_0x2ea3c4['name']]={'$like':'%'+_0x23d4c9[_0xa21c('0x3c')]['filter']+'%'};return _0x1c41a6;}})});}_0x16a904=_[_0xa21c('0x4a')]({},_0x16a904,_0x23d4c9[_0xa21c('0x4c')]);var _0x439754={'where':_0x16a904[_0xa21c('0x46')]};return db[_0xa21c('0x37')][_0xa21c('0x2c')](_0x439754)[_0xa21c('0x1b')](function(_0x372dce){_0xb53577['count']=_0x372dce;if(_0x23d4c9[_0xa21c('0x3c')][_0xa21c('0x4d')]){_0x16a904[_0xa21c('0x4e')]=[{'all':!![]}];}return db[_0xa21c('0x37')][_0xa21c('0x4f')](_0x16a904);})[_0xa21c('0x1b')](function(_0x1a9610){_0xb53577[_0xa21c('0x50')]=_0x1a9610;return _0xb53577;})['then'](respondWithFilteredResult(_0x3887f6,_0x16a904))[_0xa21c('0x24')](handleError(_0x3887f6,null));};exports[_0xa21c('0x51')]=function(_0x2f4325,_0x2e5c54){var _0x5ea0b2={'raw':![],'where':{'id':_0x2f4325[_0xa21c('0x52')]['id']}},_0x383917={};_0x383917[_0xa21c('0x3b')]=_[_0xa21c('0x3d')](db['Setting'][_0xa21c('0x38')]);_0x383917[_0xa21c('0x3c')]=_[_0xa21c('0x3d')](_0x2f4325[_0xa21c('0x3c')]);_0x383917[_0xa21c('0x47')]=_['intersection'](_0x383917[_0xa21c('0x3b')],_0x383917[_0xa21c('0x3c')]);_0x5ea0b2['attributes']=_[_0xa21c('0x3e')](_0x383917[_0xa21c('0x3b')],qs['fields'](_0x2f4325[_0xa21c('0x3c')][_0xa21c('0x3f')]));_0x5ea0b2[_0xa21c('0x40')]=_0x5ea0b2[_0xa21c('0x40')][_0xa21c('0x41')]?_0x5ea0b2[_0xa21c('0x40')]:_0x383917[_0xa21c('0x3b')];if(_0x2f4325['query']['includeAll']){_0x5ea0b2[_0xa21c('0x4e')]=[{'all':!![]}];}_0x5ea0b2=_[_0xa21c('0x4a')]({},_0x5ea0b2,_0x2f4325[_0xa21c('0x4c')]);return db['Setting']['find'](_0x5ea0b2)[_0xa21c('0x1b')](handleEntityNotFound(_0x2e5c54,null))['then'](respondWithResult(_0x2e5c54,null))[_0xa21c('0x24')](handleError(_0x2e5c54,null));};exports[_0xa21c('0x31')]=function(_0x592ebb,_0x43fc71){if(_0x592ebb[_0xa21c('0x53')]['id']){delete _0x592ebb[_0xa21c('0x53')]['id'];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x592ebb['params']['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x43fc71,null))[_0xa21c('0x1b')](saveUpdates(_0x592ebb[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0x43fc71,null))['catch'](handleError(_0x43fc71,null));};exports[_0xa21c('0x55')]=function(_0x269341,_0x260b11,_0x14485f){if(_0x269341[_0xa21c('0x56')]&&_0x269341[_0xa21c('0x56')][_0xa21c('0x57')]){_0x269341[_0xa21c('0x53')]['logo']=_0x269341[_0xa21c('0x56')][_0xa21c('0x57')];}return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x269341[_0xa21c('0x52')]['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x260b11,null))['then'](saveUpdates(_0x269341[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0x260b11,null))[_0xa21c('0x24')](handleError(_0x260b11,null));};exports[_0xa21c('0x58')]=function(_0x4b12e6,_0x1305aa,_0x4f3b6d){if(_0x4b12e6['file']&&_0x4b12e6['file'][_0xa21c('0x57')]){_0x4b12e6[_0xa21c('0x53')][_0xa21c('0x59')]=_0x4b12e6[_0xa21c('0x56')][_0xa21c('0x57')];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x4b12e6[_0xa21c('0x52')]['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x1305aa,null))[_0xa21c('0x1b')](saveUpdates(_0x4b12e6[_0xa21c('0x53')],null))['then'](respondWithResult(_0x1305aa,null))[_0xa21c('0x24')](handleError(_0x1305aa,null));};var utilLicense=require(_0xa21c('0x5a'));exports[_0xa21c('0x5b')]=function(_0x2494e3,_0x2a8a5b,_0x240de6){var _0x730d07='server/files/images/logos';var _0x1bb853={'custom':![]};return utilLicense[_0xa21c('0x5c')]()['then'](function(_0x50d0f4){if(_0x50d0f4){_0x1bb853=_0x50d0f4;}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x2494e3[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x5d'),_0xa21c('0x59'),_0xa21c('0x5e'),_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),_0xa21c('0x62'),_0xa21c('0x63')],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x2a8a5b,null))[_0xa21c('0x1b')](function(_0x12b30d){if(_0x12b30d){var _0xbbef2e=_0x12b30d['logo']&&fs[_0xa21c('0x64')](path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x730d07,_[_0xa21c('0x67')](_0x12b30d[_0xa21c('0x5d')])))?path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x730d07,_['toLower'](_0x12b30d[_0xa21c('0x5d')])):path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x730d07,_[_0xa21c('0x67')](_0xa21c('0x68')));var _0x5c0e0d=_0xa21c('0x69')+_[_0xa21c('0x6a')](_0xa21c('0x5d'));if(_0x12b30d[_0x5c0e0d]||!_0x1bb853[_0xa21c('0x6b')]){_0xbbef2e=path[_0xa21c('0x65')](config['root'],_0x730d07,_[_0xa21c('0x67')](_0xa21c('0x68')));}if(!fs[_0xa21c('0x64')](_0xbbef2e)){throw new db['Sequelize'][(_0xa21c('0x6c'))](_[_0xa21c('0x6a')](_0xa21c('0x5d'))+'\x20not\x20found');}return _0x2a8a5b['download'](_0xbbef2e);}})[_0xa21c('0x24')](handleError(_0x2a8a5b,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x464ba8,_0x24ec8d,_0x1fca80){var _0x11c4b8=_0xa21c('0x6d');var _0x27e9a0={'custom':![]};return utilLicense[_0xa21c('0x5c')]()[_0xa21c('0x1b')](function(_0x2e89fb){if(_0x2e89fb){_0x27e9a0=_0x2e89fb;}return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x464ba8[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x5d'),'loginLogo',_0xa21c('0x5e'),_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x24ec8d,null))[_0xa21c('0x1b')](function(_0x35910c){if(_0x35910c){var _0x6d58c6=_0x35910c[_0xa21c('0x59')]&&fs[_0xa21c('0x64')](path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x11c4b8,_['toLower'](_0x35910c[_0xa21c('0x59')])))?path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x11c4b8,_['toLower'](_0x35910c[_0xa21c('0x59')])):path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x11c4b8,_['toLower'](_0xa21c('0x6e')));var _0x3ea2af='default'+_['upperFirst']('loginLogo');if(_0x35910c[_0x3ea2af]||!_0x27e9a0[_0xa21c('0x6b')]){_0x6d58c6=path[_0xa21c('0x65')](config['root'],_0x11c4b8,_[_0xa21c('0x67')](_0xa21c('0x6e')));}if(!fs[_0xa21c('0x64')](_0x6d58c6)){throw new db[(_0xa21c('0x6f'))][(_0xa21c('0x6c'))](_[_0xa21c('0x6a')](_0xa21c('0x59'))+'\x20not\x20found');}return _0x24ec8d[_0xa21c('0x70')](_0x6d58c6);}})['catch'](handleError(_0x24ec8d,null));};exports[_0xa21c('0x71')]=function(_0x2c0751,_0x1b8d17){return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x2c0751[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x72')]})[_0xa21c('0x1b')](respondWithResult(_0x1b8d17,null))[_0xa21c('0x24')](handleError(_0x1b8d17,null));};exports[_0xa21c('0x73')]=function(_0x31591d,_0xadb03,_0x39d59f){if(_0x31591d[_0xa21c('0x56')]&&_0x31591d[_0xa21c('0x56')][_0xa21c('0x57')]){_0x31591d[_0xa21c('0x53')][_0xa21c('0x5e')]=_0x31591d['file'][_0xa21c('0x57')];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x31591d[_0xa21c('0x52')]['id']}})['then'](handleEntityNotFound(_0xadb03,null))[_0xa21c('0x1b')](saveUpdates(_0x31591d[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0xadb03,null))[_0xa21c('0x24')](handleError(_0xadb03,null));};var utilLicense=require('../../config/license/util');exports[_0xa21c('0x74')]=function(_0x293e52,_0x478772,_0x30f2c6){var _0x4eb838=_0xa21c('0x6d');var _0x44a480={'custom':![]};return utilLicense[_0xa21c('0x5c')]()['then'](function(_0x416979){if(_0x416979){_0x44a480=_0x416979;}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x293e52[_0xa21c('0x52')]['id']},'attributes':[_0xa21c('0x5d'),_0xa21c('0x59'),_0xa21c('0x5e'),_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),_0xa21c('0x62'),_0xa21c('0x63')],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x478772,null))[_0xa21c('0x1b')](function(_0x9ec7bd){if(_0x9ec7bd){var _0x19ed96=_0x9ec7bd[_0xa21c('0x5e')]&&fs[_0xa21c('0x64')](path['join'](config[_0xa21c('0x66')],_0x4eb838,_[_0xa21c('0x67')](_0x9ec7bd[_0xa21c('0x5e')])))?path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x4eb838,_[_0xa21c('0x67')](_0x9ec7bd[_0xa21c('0x5e')])):path[_0xa21c('0x65')](config['root'],_0x4eb838,_[_0xa21c('0x67')]('default_preferred.png'));var _0x474d32=_0xa21c('0x69')+_[_0xa21c('0x6a')](_0xa21c('0x5e'));if(_0x9ec7bd[_0x474d32]||!_0x44a480[_0xa21c('0x6b')]||!_0x44a480[_0xa21c('0x5e')]){_0x19ed96=path[_0xa21c('0x65')](config['root'],_0x4eb838,_[_0xa21c('0x67')](_0xa21c('0x75')));}if(!fs[_0xa21c('0x64')](_0x19ed96)){throw new db[(_0xa21c('0x6f'))][(_0xa21c('0x6c'))](_[_0xa21c('0x6a')](_0xa21c('0x5e'))+_0xa21c('0x76'));}return _0x478772[_0xa21c('0x70')](_0x19ed96);}})['catch'](handleError(_0x478772,null));};exports[_0xa21c('0x77')]=function(_0x2cf702,_0x160d57,_0x578098){if(_0x2cf702[_0xa21c('0x56')]&&_0x2cf702['file'][_0xa21c('0x57')]){_0x2cf702['body'][_0xa21c('0x5f')]=_0x2cf702['file'][_0xa21c('0x57')];}return db[_0xa21c('0x37')][_0xa21c('0x54')]({'where':{'id':_0x2cf702['params']['id']}})[_0xa21c('0x1b')](handleEntityNotFound(_0x160d57,null))[_0xa21c('0x1b')](saveUpdates(_0x2cf702[_0xa21c('0x53')],null))[_0xa21c('0x1b')](respondWithResult(_0x160d57,null))[_0xa21c('0x24')](handleError(_0x160d57,null));};var utilLicense=require(_0xa21c('0x5a'));exports[_0xa21c('0x78')]=function(_0x4f476b,_0x5b196d,_0x3915d4){var _0x55ca42=_0xa21c('0x6d');var _0x2a0290={'custom':![]};return utilLicense['getLicense']()[_0xa21c('0x1b')](function(_0x341a1f){if(_0x341a1f){_0x2a0290=_0x341a1f;}return db['Setting'][_0xa21c('0x54')]({'where':{'id':_0x4f476b[_0xa21c('0x52')]['id']},'attributes':['logo','loginLogo','preferred',_0xa21c('0x5f'),_0xa21c('0x60'),_0xa21c('0x61'),_0xa21c('0x62'),'defaultFavicon'],'raw':!![]});})[_0xa21c('0x1b')](handleEntityNotFound(_0x5b196d,null))[_0xa21c('0x1b')](function(_0x7b3837){if(_0x7b3837){var _0x4a141c=_0x7b3837[_0xa21c('0x5f')]&&fs[_0xa21c('0x64')](path['join'](config[_0xa21c('0x66')],_0x55ca42,_[_0xa21c('0x67')](_0x7b3837[_0xa21c('0x5f')])))?path[_0xa21c('0x65')](config['root'],_0x55ca42,_['toLower'](_0x7b3837['favicon'])):path[_0xa21c('0x65')](config[_0xa21c('0x66')],_0x55ca42,_[_0xa21c('0x67')](_0xa21c('0x79')));var _0x35da23=_0xa21c('0x69')+_[_0xa21c('0x6a')]('favicon');if(_0x7b3837[_0x35da23]||!_0x2a0290[_0xa21c('0x6b')]){_0x4a141c=path['join'](config[_0xa21c('0x66')],_0x55ca42,_[_0xa21c('0x67')](_0xa21c('0x79')));}if(!fs[_0xa21c('0x64')](_0x4a141c)){throw new db[(_0xa21c('0x6f'))]['ValidationError'](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x5b196d[_0xa21c('0x70')](_0x4a141c);}})[_0xa21c('0x24')](handleError(_0x5b196d,null));};exports[_0xa21c('0x7a')]=function(_0xabc7ea,_0x1e393b){var _0x5303aa={'offset':moment()[_0xa21c('0x7b')]()};_0x5303aa[_0xa21c('0x7c')]=moment()['utcOffset'](_0x5303aa['offset'])[_0xa21c('0x7d')](_0xa21c('0x7e'));return _0x1e393b[_0xa21c('0x26')](0xc8)[_0xa21c('0x35')](_0x5303aa);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1f898e0..12c25db 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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f4b6711..932b4be 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 _0x8b6c=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','info','ShowSetting','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s'];(function(_0x1d1839,_0x2e8d3d){var _0x321756=function(_0x12dfb4){while(--_0x12dfb4){_0x1d1839['push'](_0x1d1839['shift']());}};_0x321756(++_0x2e8d3d);}(_0x8b6c,0x13b));var _0xc8b6=function(_0x4d8777,_0x251dfe){_0x4d8777=_0x4d8777-0x0;var _0x283862=_0x8b6c[_0x4d8777];return _0x283862;};'use strict';var _=require(_0xc8b6('0x0'));var util=require('util');var moment=require(_0xc8b6('0x1'));var BPromise=require(_0xc8b6('0x2'));var rs=require(_0xc8b6('0x3'));var fs=require('fs');var Redis=require(_0xc8b6('0x4'));var db=require(_0xc8b6('0x5'))['db'];var utils=require(_0xc8b6('0x6'));var logger=require(_0xc8b6('0x7'))(_0xc8b6('0x8'));var config=require(_0xc8b6('0x9'));var jayson=require(_0xc8b6('0xa'));var client=jayson[_0xc8b6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad272,_0x471ac7,_0x250cd6){return new BPromise(function(_0x18a4f3,_0x494441){return client[_0xc8b6('0xc')](_0x1ad272,_0x250cd6)[_0xc8b6('0xd')](function(_0x1804c5){logger['info'](_0xc8b6('0xe'),_0x471ac7,_0xc8b6('0xf'));logger[_0xc8b6('0x10')](_0xc8b6('0x11'),_0x471ac7,_0xc8b6('0xf'),JSON['stringify'](_0x1804c5));if(_0x1804c5[_0xc8b6('0x12')]){if(_0x1804c5['error']['code']===0x1f4){logger[_0xc8b6('0x12')](_0xc8b6('0xe'),_0x471ac7,_0x1804c5[_0xc8b6('0x12')][_0xc8b6('0x13')]);return _0x494441(_0x1804c5['error'][_0xc8b6('0x13')]);}logger['error']('Setting,\x20%s,\x20%s',_0x471ac7,_0x1804c5['error']['message']);return _0x18a4f3(_0x1804c5[_0xc8b6('0x12')][_0xc8b6('0x13')]);}else{logger[_0xc8b6('0x14')]('Setting,\x20%s,\x20%s',_0x471ac7,_0xc8b6('0xf'));_0x18a4f3(_0x1804c5['result'][_0xc8b6('0x13')]);}})['catch'](function(_0x51a76f){logger[_0xc8b6('0x12')](_0xc8b6('0xe'),_0x471ac7,_0x51a76f);_0x494441(_0x51a76f);});});}exports[_0xc8b6('0x15')]=function(_0x3feab8){var _0x2b17ef=this;return new Promise(function(_0x379077,_0x270e6d){return db['Setting'][_0xc8b6('0x16')]({'raw':_0x3feab8[_0xc8b6('0x17')]?_0x3feab8['options'][_0xc8b6('0x18')]===undefined?!![]:![]:!![],'where':_0x3feab8[_0xc8b6('0x17')]?_0x3feab8[_0xc8b6('0x17')][_0xc8b6('0x19')]||null:null,'attributes':_0x3feab8[_0xc8b6('0x17')]?_0x3feab8[_0xc8b6('0x17')][_0xc8b6('0x1a')]||null:null,'include':_0x3feab8[_0xc8b6('0x17')]?_0x3feab8['options'][_0xc8b6('0x1b')]?_[_0xc8b6('0x1c')](_0x3feab8[_0xc8b6('0x17')][_0xc8b6('0x1b')],function(_0x2ae7f6){return{'model':db[_0x2ae7f6[_0xc8b6('0x1d')]],'as':_0x2ae7f6['as'],'attributes':_0x2ae7f6[_0xc8b6('0x1a')],'include':_0x2ae7f6[_0xc8b6('0x1b')]?_['map'](_0x2ae7f6[_0xc8b6('0x1b')],function(_0x47e8cd){return{'model':db[_0x47e8cd[_0xc8b6('0x1d')]],'as':_0x47e8cd['as'],'attributes':_0x47e8cd[_0xc8b6('0x1a')],'include':_0x47e8cd[_0xc8b6('0x1b')]?_['map'](_0x47e8cd[_0xc8b6('0x1b')],function(_0x26d1e3){return{'model':db[_0x26d1e3[_0xc8b6('0x1d')]],'as':_0x26d1e3['as'],'attributes':_0x26d1e3[_0xc8b6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5baef8){logger[_0xc8b6('0x14')](_0xc8b6('0x15'),_0x3feab8);logger[_0xc8b6('0x10')](_0xc8b6('0x15'),_0x3feab8,JSON['stringify'](_0x5baef8));_0x379077(_0x5baef8);})['catch'](function(_0x1b0f55){logger['error'](_0xc8b6('0x15'),_0x1b0f55[_0xc8b6('0x13')],_0x3feab8);_0x270e6d(_0x2b17ef[_0xc8b6('0x12')](0x1f4,_0x1b0f55[_0xc8b6('0x13')]));});});}; \ No newline at end of file +var _0x8b24=['rpc','../../config/environment','client','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x8b24,0x9d));var _0x48b2=function(_0x143699,_0x2dfea7){_0x143699=_0x143699-0x0;var _0x3b638a=_0x8b24[_0x143699];return _0x3b638a;};'use strict';var _=require('lodash');var util=require(_0x48b2('0x0'));var moment=require(_0x48b2('0x1'));var BPromise=require(_0x48b2('0x2'));var rs=require(_0x48b2('0x3'));var fs=require('fs');var Redis=require(_0x48b2('0x4'));var db=require(_0x48b2('0x5'))['db'];var utils=require(_0x48b2('0x6'));var logger=require(_0x48b2('0x7'))(_0x48b2('0x8'));var config=require(_0x48b2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x48b2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17bf90,_0x7f506c,_0x495ea2){return new BPromise(function(_0x46ad1f,_0x40cf18){return client[_0x48b2('0xb')](_0x17bf90,_0x495ea2)[_0x48b2('0xc')](function(_0x3bd2ba){logger[_0x48b2('0xd')]('Setting,\x20%s,\x20%s',_0x7f506c,'request\x20sent');logger[_0x48b2('0xe')](_0x48b2('0xf'),_0x7f506c,_0x48b2('0x10'),JSON[_0x48b2('0x11')](_0x3bd2ba));if(_0x3bd2ba[_0x48b2('0x12')]){if(_0x3bd2ba[_0x48b2('0x12')][_0x48b2('0x13')]===0x1f4){logger['error'](_0x48b2('0x14'),_0x7f506c,_0x3bd2ba['error'][_0x48b2('0x15')]);return _0x40cf18(_0x3bd2ba[_0x48b2('0x12')]['message']);}logger[_0x48b2('0x12')](_0x48b2('0x14'),_0x7f506c,_0x3bd2ba['error'][_0x48b2('0x15')]);return _0x46ad1f(_0x3bd2ba[_0x48b2('0x12')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x7f506c,_0x48b2('0x10'));_0x46ad1f(_0x3bd2ba[_0x48b2('0x16')][_0x48b2('0x15')]);}})[_0x48b2('0x17')](function(_0x445dbe){logger[_0x48b2('0x12')](_0x48b2('0x14'),_0x7f506c,_0x445dbe);_0x40cf18(_0x445dbe);});});}exports[_0x48b2('0x18')]=function(_0x2b67c9){var _0x16ec21=this;return new Promise(function(_0x31978a,_0x2b5a77){return db[_0x48b2('0x19')][_0x48b2('0x1a')]({'raw':_0x2b67c9['options']?_0x2b67c9[_0x48b2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2b67c9[_0x48b2('0x1b')]?_0x2b67c9['options'][_0x48b2('0x1c')]||null:null,'attributes':_0x2b67c9[_0x48b2('0x1b')]?_0x2b67c9[_0x48b2('0x1b')][_0x48b2('0x1d')]||null:null,'include':_0x2b67c9[_0x48b2('0x1b')]?_0x2b67c9[_0x48b2('0x1b')][_0x48b2('0x1e')]?_[_0x48b2('0x1f')](_0x2b67c9[_0x48b2('0x1b')][_0x48b2('0x1e')],function(_0x37812c){return{'model':db[_0x37812c['model']],'as':_0x37812c['as'],'attributes':_0x37812c[_0x48b2('0x1d')],'include':_0x37812c[_0x48b2('0x1e')]?_[_0x48b2('0x1f')](_0x37812c[_0x48b2('0x1e')],function(_0x440e11){return{'model':db[_0x440e11[_0x48b2('0x20')]],'as':_0x440e11['as'],'attributes':_0x440e11[_0x48b2('0x1d')],'include':_0x440e11[_0x48b2('0x1e')]?_['map'](_0x440e11[_0x48b2('0x1e')],function(_0x524343){return{'model':db[_0x524343['model']],'as':_0x524343['as'],'attributes':_0x524343[_0x48b2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x48b2('0xc')](function(_0xdc92c3){logger['info'](_0x48b2('0x18'),_0x2b67c9);logger['debug'](_0x48b2('0x18'),_0x2b67c9,JSON[_0x48b2('0x11')](_0xdc92c3));_0x31978a(_0xdc92c3);})['catch'](function(_0x4648e2){logger[_0x48b2('0x12')](_0x48b2('0x18'),_0x4648e2['message'],_0x2b67c9);_0x2b5a77(_0x16ec21[_0x48b2('0x12')](0x1f4,_0x4648e2[_0x48b2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 46d216a..db4cdf1 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x45dc60,_0x5b6ac7){var _0x3765ba=function(_0x2e9586){while(--_0x2e9586){_0x45dc60['push'](_0x45dc60['shift']());}};_0x3765ba(++_0x5b6ac7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x110ea8,_0xacb6fa){var _0x4073cf=function(_0x444fcb){while(--_0x444fcb){_0x110ea8['push'](_0x110ea8['shift']());}};_0x4073cf(++_0xacb6fa);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 188dadb..4969bc7 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 _0x36f5=['clicksend','plivo','clickatell','infobip','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','twilio','skebby'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x36f5,0x1e8));var _0x536f=function(_0x2b45c8,_0x4adc0c){_0x2b45c8=_0x2b45c8-0x0;var _0x295268=_0x36f5[_0x2b45c8];return _0x295268;};'use strict';var Sequelize=require(_0x536f('0x0'));var rs=require(_0x536f('0x1'));module['exports']={'name':{'type':Sequelize[_0x536f('0x2')],'unique':_0x536f('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x536f('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x536f('0x4'),_0x536f('0x5'),'connectel',_0x536f('0x6'),_0x536f('0x7'),_0x536f('0x8'),'bandwidth','csc',_0x536f('0x9'),_0x536f('0xa'))},'accountSid':{'type':Sequelize[_0x536f('0x2')]},'authId':{'type':Sequelize[_0x536f('0x2')]},'authToken':{'type':Sequelize[_0x536f('0x2')]},'smsMethod':{'type':Sequelize[_0x536f('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x536f('0x2')]},'password':{'type':Sequelize[_0x536f('0x2')]},'apiKey':{'type':Sequelize[_0x536f('0x2')]},'applicationId':{'type':Sequelize[_0x536f('0x2')]},'accountId':{'type':Sequelize[_0x536f('0x2')]},'senderString':{'type':Sequelize[_0x536f('0x2')]},'deliveryReport':{'type':Sequelize[_0x536f('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x536f('0x2')]},'notificationTemplate':{'type':Sequelize[_0x536f('0xd')],'defaultValue':function(){return _0x536f('0xe');}},'notificationSound':{'type':Sequelize[_0x536f('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x536f('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x536f('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x536f('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x536f('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x536f('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x536f('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x536f('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x536f('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x536f('0x10'),'set':function(_0x426d09){if(!_0x426d09)this[_0x536f('0x11')](_0x536f('0x12'),null);this[_0x536f('0x11')]('mandatoryDisposition',_0x426d09);}}}; \ No newline at end of file +var _0xdff0=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0xdff0,0x1ce));var _0x0dff=function(_0x4a22a6,_0x52b68e){_0x4a22a6=_0x4a22a6-0x0;var _0x308910=_0xdff0[_0x4a22a6];return _0x308910;};'use strict';var Sequelize=require(_0x0dff('0x0'));var rs=require(_0x0dff('0x1'));module[_0x0dff('0x2')]={'name':{'type':Sequelize[_0x0dff('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0dff('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0dff('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x0dff('0x3')],'defaultValue':function(){return rs[_0x0dff('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0dff('0x5')]('twilio',_0x0dff('0x6'),_0x0dff('0x7'),_0x0dff('0x8'),_0x0dff('0x9'),'clickatell',_0x0dff('0xa'),'csc',_0x0dff('0xb'),_0x0dff('0xc'))},'accountSid':{'type':Sequelize[_0x0dff('0x3')]},'authId':{'type':Sequelize[_0x0dff('0x3')]},'authToken':{'type':Sequelize[_0x0dff('0x3')]},'smsMethod':{'type':Sequelize[_0x0dff('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0dff('0x3')]},'password':{'type':Sequelize[_0x0dff('0x3')]},'apiKey':{'type':Sequelize[_0x0dff('0x3')]},'applicationId':{'type':Sequelize[_0x0dff('0x3')]},'accountId':{'type':Sequelize[_0x0dff('0x3')]},'senderString':{'type':Sequelize[_0x0dff('0x3')]},'deliveryReport':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x0dff('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0dff('0xe');}},'notificationSound':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0dff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0dff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0dff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0dff('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0dff('0xf')],'comment':_0x0dff('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x0dff('0xd')],'defaultValue':![],'comment':_0x0dff('0x11'),'set':function(_0x2398ec){if(!_0x2398ec)this[_0x0dff('0x12')]('mandatoryDispositionPauseId',null);this[_0x0dff('0x12')](_0x0dff('0x13'),_0x2398ec);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7d86c43..e1c0cd8 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 _0x9ef7=['SmsAccountId','findOne','Disposition','nolimit','includeAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','sms','Applications','account','applications','orderBy','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','Body','messageId','sender','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','intelepeer','refid','isNil','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','bandwidth','redif','DELIVERED','error_code','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','SmsAccount,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x9ef7,0x168));var _0x79ef=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x9ef7[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0x79ef('0x0'));var rimraf=require(_0x79ef('0x1'));var zipdir=require(_0x79ef('0x2'));var jsonpatch=require(_0x79ef('0x3'));var rp=require(_0x79ef('0x4'));var moment=require('moment');var BPromise=require(_0x79ef('0x5'));var Mustache=require(_0x79ef('0x6'));var util=require(_0x79ef('0x7'));var path=require(_0x79ef('0x8'));var sox=require(_0x79ef('0x9'));var csv=require(_0x79ef('0xa'));var ejs=require(_0x79ef('0xb'));var fs=require('fs');var fs_extra=require(_0x79ef('0xc'));var _=require(_0x79ef('0xd'));var squel=require(_0x79ef('0xe'));var crypto=require(_0x79ef('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x79ef('0xa'));var querystring=require(_0x79ef('0x10'));var Papa=require(_0x79ef('0x11'));var Redis=require('ioredis');var authService=require(_0x79ef('0x12'));var qs=require(_0x79ef('0x13'));var as=require(_0x79ef('0x14'));var hardwareService=require(_0x79ef('0x15'));var logger=require(_0x79ef('0x16'))(_0x79ef('0x17'));var utils=require(_0x79ef('0x18'));var config=require(_0x79ef('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x79ef('0x1a'))['db'];config['redis']=_[_0x79ef('0x1b')](config[_0x79ef('0x1c')],{'host':_0x79ef('0x1d'),'port':0x18eb});var socket=require(_0x79ef('0x1e'))(new Redis(config[_0x79ef('0x1c')]));require(_0x79ef('0x1f'))[_0x79ef('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x79ef('0x21')][_0x79ef('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x2e3232,_0x1f6c4e,_0x1877ce,_0x336e2f){return new BPromise(function(_0x1df85a,_0x5c1d4a){var _0x4380e3=_0x336e2f||client;return _0x4380e3[_0x79ef('0x23')](_0x2e3232,_0x1877ce)['then'](function(_0x3055c9){logger[_0x79ef('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1f6c4e,'request\x20sent');logger[_0x79ef('0x25')](_0x79ef('0x26'),_0x1f6c4e,_0x79ef('0x27'),JSON[_0x79ef('0x28')](_0x3055c9));if(_0x3055c9['error']){if(_0x3055c9['error'][_0x79ef('0x29')]===0x1f4){logger['error'](_0x79ef('0x2a'),_0x1f6c4e,_0x3055c9[_0x79ef('0x2b')]['message']);return _0x5c1d4a(_0x3055c9[_0x79ef('0x2b')][_0x79ef('0x2c')]);}logger[_0x79ef('0x2b')](_0x79ef('0x2a'),_0x1f6c4e,_0x3055c9[_0x79ef('0x2b')]['message']);return _0x1df85a(_0x3055c9[_0x79ef('0x2b')]['message']);}else{logger[_0x79ef('0x24')](_0x79ef('0x2a'),_0x1f6c4e,_0x79ef('0x27'));_0x1df85a(_0x3055c9[_0x79ef('0x2d')][_0x79ef('0x2c')]);}})[_0x79ef('0x2e')](function(_0x47feca){logger[_0x79ef('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x1f6c4e,_0x47feca);_0x5c1d4a(_0x47feca);});});}function respondWithStatusCode(_0x1272e8,_0x18ded7){_0x18ded7=_0x18ded7||0xcc;return function(_0xd52cd4){if(_0xd52cd4){return _0x1272e8[_0x79ef('0x2f')](_0x18ded7);}return _0x1272e8[_0x79ef('0x30')](_0x18ded7)[_0x79ef('0x31')]();};}function respondWithResult(_0x1bcb80,_0x3873f0){_0x3873f0=_0x3873f0||0xc8;return function(_0x55146e){if(_0x55146e){return _0x1bcb80['status'](_0x3873f0)[_0x79ef('0x32')](_0x55146e);}};}function respondWithFilteredResult(_0x238662,_0x5f6387){return function(_0x2e8482){if(_0x2e8482){var _0x12152a=typeof _0x5f6387[_0x79ef('0x33')]==='undefined'&&typeof _0x5f6387[_0x79ef('0x34')]==='undefined';var _0x907cc=_0x2e8482[_0x79ef('0x35')];var _0x2b4705=_0x12152a?0x0:_0x5f6387[_0x79ef('0x33')];var _0x32ab1f=_0x12152a?_0x2e8482['count']:_0x5f6387[_0x79ef('0x33')]+_0x5f6387[_0x79ef('0x34')];var _0x1122a8;if(_0x32ab1f>=_0x907cc){_0x32ab1f=_0x907cc;_0x1122a8=0xc8;}else{_0x1122a8=0xce;}_0x238662[_0x79ef('0x30')](_0x1122a8);return _0x238662[_0x79ef('0x36')](_0x79ef('0x37'),_0x2b4705+'-'+_0x32ab1f+'/'+_0x907cc)[_0x79ef('0x32')](_0x2e8482);}return null;};}function patchUpdates(_0x9b1e0c){return function(_0xec3c37){try{jsonpatch['apply'](_0xec3c37,_0x9b1e0c,!![]);}catch(_0x3baf04){return BPromise[_0x79ef('0x38')](_0x3baf04);}return _0xec3c37[_0x79ef('0x39')]();};}function saveUpdates(_0x32aec6,_0x580dd5){return function(_0x3f3a56){if(_0x3f3a56){return _0x3f3a56[_0x79ef('0x3a')](_0x32aec6)[_0x79ef('0x3b')](function(_0x3e9839){return _0x3e9839;});}return null;};}function removeEntity(_0x1b1cc3,_0x3cd039){return function(_0x42ccaf){if(_0x42ccaf){return _0x42ccaf[_0x79ef('0x3c')]()['then'](function(){var _0x4ecb87=_0x42ccaf[_0x79ef('0x3d')]({'plain':!![]});var _0x2f345e=_0x79ef('0x3e');return db[_0x79ef('0x3f')][_0x79ef('0x3c')]({'where':{'type':_0x2f345e,'resourceId':_0x4ecb87['id']}})[_0x79ef('0x3b')](function(){return _0x42ccaf;});})[_0x79ef('0x3b')](function(){_0x1b1cc3[_0x79ef('0x30')](0xcc)[_0x79ef('0x31')]();});}};}function handleEntityNotFound(_0x3f6fc4,_0x4ab0f8){return function(_0xc8b41c){if(!_0xc8b41c){_0x3f6fc4['sendStatus'](0x194);}return _0xc8b41c;};}function handleError(_0x3c8aff,_0x4d1031){_0x4d1031=_0x4d1031||0x1f4;return function(_0x467a7d){logger['error'](_0x467a7d[_0x79ef('0x40')]);if(_0x467a7d[_0x79ef('0x41')]){delete _0x467a7d[_0x79ef('0x41')];}_0x3c8aff[_0x79ef('0x30')](_0x4d1031)[_0x79ef('0x42')](_0x467a7d);};}exports[_0x79ef('0x43')]=function(_0x385a2a,_0x2ded65){var _0x1b7f0d={'include':[{'model':db[_0x79ef('0x44')],'as':_0x79ef('0x45')}]},_0x3bedbf={},_0x32dbe6={'count':0x0,'rows':[]};var _0x2459c8=_[_0x79ef('0x46')](db[_0x79ef('0x47')][_0x79ef('0x48')],function(_0x32eeb6){return{'name':_0x32eeb6[_0x79ef('0x49')],'type':_0x32eeb6[_0x79ef('0x4a')][_0x79ef('0x4b')]};});_0x3bedbf[_0x79ef('0x4c')]=_['map'](_0x2459c8,'name');_0x3bedbf[_0x79ef('0x4d')]=_[_0x79ef('0x4e')](_0x385a2a['query']);_0x3bedbf[_0x79ef('0x4f')]=_[_0x79ef('0x50')](_0x3bedbf[_0x79ef('0x4c')],_0x3bedbf[_0x79ef('0x4d')]);_0x1b7f0d[_0x79ef('0x51')]=_[_0x79ef('0x50')](_0x3bedbf[_0x79ef('0x4c')],qs[_0x79ef('0x52')](_0x385a2a[_0x79ef('0x4d')]['fields']));_0x1b7f0d[_0x79ef('0x51')]=_0x1b7f0d['attributes'][_0x79ef('0x53')]?_0x1b7f0d[_0x79ef('0x51')]:_0x3bedbf['model'];if(!_0x385a2a[_0x79ef('0x4d')][_0x79ef('0x54')]('nolimit')){_0x1b7f0d[_0x79ef('0x34')]=qs['limit'](_0x385a2a[_0x79ef('0x4d')][_0x79ef('0x34')]);_0x1b7f0d[_0x79ef('0x33')]=qs[_0x79ef('0x33')](_0x385a2a[_0x79ef('0x4d')][_0x79ef('0x33')]);}_0x1b7f0d[_0x79ef('0x55')]=qs[_0x79ef('0x56')](_0x385a2a[_0x79ef('0x4d')][_0x79ef('0x56')]);_0x1b7f0d[_0x79ef('0x57')]=qs['filters'](_[_0x79ef('0x58')](_0x385a2a['query'],_0x3bedbf[_0x79ef('0x4f')]),_0x2459c8);if(_0x385a2a[_0x79ef('0x4d')]['filter']){_0x1b7f0d[_0x79ef('0x57')]=_['merge'](_0x1b7f0d[_0x79ef('0x57')],{'$or':_[_0x79ef('0x46')](_0x2459c8,function(_0x4654c0){if(_0x4654c0[_0x79ef('0x4a')]!=='VIRTUAL'){var _0x2ac818={};_0x2ac818[_0x4654c0[_0x79ef('0x41')]]={'$like':'%'+_0x385a2a[_0x79ef('0x4d')][_0x79ef('0x59')]+'%'};return _0x2ac818;}})});}_0x1b7f0d=_[_0x79ef('0x5a')]({},_0x1b7f0d,_0x385a2a[_0x79ef('0x5b')]);var _0x57b573={'where':_0x1b7f0d[_0x79ef('0x57')]};return db[_0x79ef('0x47')][_0x79ef('0x35')](_0x57b573)[_0x79ef('0x3b')](function(_0x4584a5){_0x32dbe6['count']=_0x4584a5;if(_0x385a2a[_0x79ef('0x4d')]['includeAll']){_0x1b7f0d[_0x79ef('0x5c')]=[{'all':!![]}];}return db[_0x79ef('0x47')][_0x79ef('0x5d')](_0x1b7f0d);})['then'](function(_0x58f731){_0x32dbe6[_0x79ef('0x5e')]=_0x58f731;return _0x32dbe6;})[_0x79ef('0x3b')](respondWithFilteredResult(_0x2ded65,_0x1b7f0d))[_0x79ef('0x2e')](handleError(_0x2ded65,null));};exports[_0x79ef('0x5f')]=function(_0x4d1e95,_0x53d6ee){var _0x2b324d={'raw':![],'where':{'id':_0x4d1e95[_0x79ef('0x60')]['id']},'include':[{'model':db[_0x79ef('0x44')],'as':_0x79ef('0x45')}]},_0x45f80d={};_0x45f80d['model']=_[_0x79ef('0x4e')](db[_0x79ef('0x47')][_0x79ef('0x48')]);_0x45f80d[_0x79ef('0x4d')]=_[_0x79ef('0x4e')](_0x4d1e95[_0x79ef('0x4d')]);_0x45f80d[_0x79ef('0x4f')]=_['intersection'](_0x45f80d['model'],_0x45f80d[_0x79ef('0x4d')]);_0x2b324d['attributes']=_[_0x79ef('0x50')](_0x45f80d[_0x79ef('0x4c')],qs[_0x79ef('0x52')](_0x4d1e95['query']['fields']));_0x2b324d[_0x79ef('0x51')]=_0x2b324d['attributes'][_0x79ef('0x53')]?_0x2b324d[_0x79ef('0x51')]:_0x45f80d[_0x79ef('0x4c')];if(_0x4d1e95['query']['includeAll']){_0x2b324d[_0x79ef('0x5c')]=[{'all':!![]}];}_0x2b324d=_['merge']({},_0x2b324d,_0x4d1e95[_0x79ef('0x5b')]);return db['SmsAccount'][_0x79ef('0x61')](_0x2b324d)[_0x79ef('0x3b')](handleEntityNotFound(_0x53d6ee,null))['then'](respondWithResult(_0x53d6ee,null))[_0x79ef('0x2e')](handleError(_0x53d6ee,null));};exports[_0x79ef('0x62')]=function(_0x468340,_0x32dadf){return db[_0x79ef('0x47')][_0x79ef('0x62')](_0x468340[_0x79ef('0x63')],{})[_0x79ef('0x3b')](function(_0x1c0eb0){var _0x32bf07=_0x468340[_0x79ef('0x64')]['get']({'plain':!![]});if(!_0x32bf07)throw new Error(_0x79ef('0x65'));if(_0x32bf07[_0x79ef('0x66')]==='user'){var _0xff6068=_0x1c0eb0[_0x79ef('0x3d')]({'plain':!![]});var _0x45ca76=_0x79ef('0x3e');return db['UserProfileSection'][_0x79ef('0x61')]({'where':{'name':_0x45ca76,'userProfileId':_0x32bf07[_0x79ef('0x67')]},'raw':!![]})[_0x79ef('0x3b')](function(_0x3473a2){if(_0x3473a2&&_0x3473a2[_0x79ef('0x68')]===0x0){return db[_0x79ef('0x3f')][_0x79ef('0x62')]({'name':_0xff6068['name'],'resourceId':_0xff6068['id'],'type':_0x3473a2[_0x79ef('0x41')],'sectionId':_0x3473a2['id']},{})['then'](function(){return _0x1c0eb0;});}else{return _0x1c0eb0;}})[_0x79ef('0x2e')](function(_0x4c04bb){logger['error'](_0x79ef('0x69'),_0x4c04bb);throw _0x4c04bb;});}return _0x1c0eb0;})['then'](respondWithResult(_0x32dadf,0xc9))[_0x79ef('0x2e')](handleError(_0x32dadf,null));};exports['update']=function(_0x2a3666,_0x11b793){if(_0x2a3666[_0x79ef('0x63')]['id']){delete _0x2a3666[_0x79ef('0x63')]['id'];}return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x2a3666[_0x79ef('0x60')]['id']},'include':[{'model':db[_0x79ef('0x44')],'as':_0x79ef('0x45')}]})[_0x79ef('0x3b')](handleEntityNotFound(_0x11b793,null))['then'](saveUpdates(_0x2a3666[_0x79ef('0x63')],null))[_0x79ef('0x3b')](respondWithResult(_0x11b793,null))['catch'](handleError(_0x11b793,null));};exports[_0x79ef('0x3c')]=function(_0x5cd1ea,_0x2d8547){return db['SmsAccount'][_0x79ef('0x61')]({'where':{'id':_0x5cd1ea[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x2d8547,null))[_0x79ef('0x3b')](removeEntity(_0x2d8547,null))[_0x79ef('0x2e')](handleError(_0x2d8547,null));};exports[_0x79ef('0x6a')]=function(_0x4c39c7,_0x4fdbf9){return db['SmsAccount'][_0x79ef('0x6a')]()[_0x79ef('0x3b')](respondWithResult(_0x4fdbf9,null))[_0x79ef('0x2e')](handleError(_0x4fdbf9,null));};exports[_0x79ef('0x6b')]=function(_0x8904aa,_0x3df545,_0x38bce0){if(_0x8904aa[_0x79ef('0x63')]['id']){delete _0x8904aa[_0x79ef('0x63')]['id'];}return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x8904aa[_0x79ef('0x60')]['id']}})['then'](handleEntityNotFound(_0x3df545,null))['then'](function(_0x5ca3e4){if(_0x5ca3e4){_0x8904aa[_0x79ef('0x63')][_0x79ef('0x6c')]=_0x5ca3e4['id'];return db['Disposition'][_0x79ef('0x62')](_0x8904aa[_0x79ef('0x63')]);}})[_0x79ef('0x3b')](respondWithResult(_0x3df545,null))['catch'](handleError(_0x3df545,null));};exports['getDispositions']=function(_0x54e79c,_0x4cbd8e,_0x2305de){var _0x8312f8={'raw':![],'where':{}};var _0x5a6b9b={};var _0x371876={'count':0x0,'rows':[]};return db[_0x79ef('0x47')][_0x79ef('0x6d')]({'where':{'id':_0x54e79c['params']['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x4cbd8e,null))[_0x79ef('0x3b')](function(_0x50d58f){if(_0x50d58f){_0x5a6b9b[_0x79ef('0x4c')]=_['keys'](db[_0x79ef('0x6e')][_0x79ef('0x48')]);_0x5a6b9b[_0x79ef('0x4d')]=_[_0x79ef('0x4e')](_0x54e79c[_0x79ef('0x4d')]);_0x5a6b9b[_0x79ef('0x4f')]=_[_0x79ef('0x50')](_0x5a6b9b['model'],_0x5a6b9b[_0x79ef('0x4d')]);_0x8312f8[_0x79ef('0x51')]=_[_0x79ef('0x50')](_0x5a6b9b['model'],qs[_0x79ef('0x52')](_0x54e79c['query']['fields']));_0x8312f8[_0x79ef('0x51')]=_0x8312f8[_0x79ef('0x51')][_0x79ef('0x53')]?_0x8312f8[_0x79ef('0x51')]:_0x5a6b9b['model'];if(!_0x54e79c[_0x79ef('0x4d')]['hasOwnProperty'](_0x79ef('0x6f'))){_0x8312f8['limit']=qs[_0x79ef('0x34')](_0x54e79c[_0x79ef('0x4d')][_0x79ef('0x34')]);_0x8312f8[_0x79ef('0x33')]=qs['offset'](_0x54e79c[_0x79ef('0x4d')][_0x79ef('0x33')]);}_0x8312f8[_0x79ef('0x55')]=qs[_0x79ef('0x56')](_0x54e79c[_0x79ef('0x4d')][_0x79ef('0x56')]);_0x8312f8[_0x79ef('0x57')]=qs[_0x79ef('0x4f')](_[_0x79ef('0x58')](_0x54e79c['query'],_0x5a6b9b['filters']));_0x8312f8[_0x79ef('0x57')]['SmsAccountId']=_0x50d58f['id'];if(_0x54e79c[_0x79ef('0x4d')]['filter']){_0x8312f8[_0x79ef('0x57')]=_['merge'](_0x8312f8['where'],{'$or':_[_0x79ef('0x46')](_0x8312f8['attributes'],function(_0x5d6e20){var _0xb959be={};_0xb959be[_0x5d6e20]={'$like':'%'+_0x54e79c[_0x79ef('0x4d')][_0x79ef('0x59')]+'%'};return _0xb959be;})});}_0x8312f8=_[_0x79ef('0x5a')]({},_0x8312f8,_0x54e79c[_0x79ef('0x5b')]);return db['Disposition'][_0x79ef('0x35')]({'where':_0x8312f8[_0x79ef('0x57')]})[_0x79ef('0x3b')](function(_0x3ae494){_0x371876[_0x79ef('0x35')]=_0x3ae494;if(_0x54e79c[_0x79ef('0x4d')][_0x79ef('0x70')]){_0x8312f8[_0x79ef('0x5c')]=[{'all':!![]}];}return db[_0x79ef('0x6e')][_0x79ef('0x5d')](_0x8312f8);})[_0x79ef('0x3b')](function(_0x155aa8){_0x371876[_0x79ef('0x5e')]=_0x155aa8;return _0x371876;});}})[_0x79ef('0x3b')](respondWithFilteredResult(_0x4cbd8e,_0x8312f8))[_0x79ef('0x2e')](handleError(_0x4cbd8e,null));};exports[_0x79ef('0x71')]=function(_0x1007e6,_0x264fdb,_0x133d87){return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x1007e6[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x264fdb,null))[_0x79ef('0x3b')](function(_0x572428){if(_0x572428){return _0x572428[_0x79ef('0x71')](_0x1007e6[_0x79ef('0x4d')][_0x79ef('0x72')]);}})[_0x79ef('0x3b')](respondWithStatusCode(_0x264fdb,null))[_0x79ef('0x2e')](handleError(_0x264fdb,null));};exports['addAnswer']=function(_0x58b2c4,_0x128d33,_0x2688f3){if(_0x58b2c4[_0x79ef('0x63')]['id']){delete _0x58b2c4[_0x79ef('0x63')]['id'];}return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x58b2c4[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x128d33,null))[_0x79ef('0x3b')](function(_0x73b52f){if(_0x73b52f){_0x58b2c4[_0x79ef('0x63')]['SmsAccountId']=_0x73b52f['id'];return db['CannedAnswer']['create'](_0x58b2c4[_0x79ef('0x63')]);}})[_0x79ef('0x3b')](respondWithResult(_0x128d33,null))[_0x79ef('0x2e')](handleError(_0x128d33,null));};exports[_0x79ef('0x73')]=function(_0x4b6b11,_0x3c321f,_0x303b5d){var _0x59f569={'raw':![],'where':{}};var _0x4dfd84={};var _0x586e17={'count':0x0,'rows':[]};return db[_0x79ef('0x47')][_0x79ef('0x6d')]({'where':{'id':_0x4b6b11[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x3c321f,null))[_0x79ef('0x3b')](function(_0x4e5619){if(_0x4e5619){_0x4dfd84[_0x79ef('0x4c')]=_[_0x79ef('0x4e')](db['CannedAnswer'][_0x79ef('0x48')]);_0x4dfd84['query']=_[_0x79ef('0x4e')](_0x4b6b11[_0x79ef('0x4d')]);_0x4dfd84[_0x79ef('0x4f')]=_[_0x79ef('0x50')](_0x4dfd84['model'],_0x4dfd84['query']);_0x59f569[_0x79ef('0x51')]=_[_0x79ef('0x50')](_0x4dfd84[_0x79ef('0x4c')],qs[_0x79ef('0x52')](_0x4b6b11[_0x79ef('0x4d')][_0x79ef('0x52')]));_0x59f569[_0x79ef('0x51')]=_0x59f569[_0x79ef('0x51')]['length']?_0x59f569['attributes']:_0x4dfd84['model'];if(!_0x4b6b11[_0x79ef('0x4d')][_0x79ef('0x54')](_0x79ef('0x6f'))){_0x59f569[_0x79ef('0x34')]=qs[_0x79ef('0x34')](_0x4b6b11[_0x79ef('0x4d')]['limit']);_0x59f569[_0x79ef('0x33')]=qs['offset'](_0x4b6b11[_0x79ef('0x4d')][_0x79ef('0x33')]);}_0x59f569[_0x79ef('0x55')]=qs[_0x79ef('0x56')](_0x4b6b11[_0x79ef('0x4d')][_0x79ef('0x56')]);_0x59f569[_0x79ef('0x57')]=qs[_0x79ef('0x4f')](_[_0x79ef('0x58')](_0x4b6b11['query'],_0x4dfd84[_0x79ef('0x4f')]));_0x59f569['where'][_0x79ef('0x6c')]=_0x4e5619['id'];if(_0x4b6b11[_0x79ef('0x4d')][_0x79ef('0x59')]){_0x59f569[_0x79ef('0x57')]=_[_0x79ef('0x5a')](_0x59f569['where'],{'$or':_[_0x79ef('0x46')](_0x59f569[_0x79ef('0x51')],function(_0xbecc39){var _0xcc06d6={};_0xcc06d6[_0xbecc39]={'$like':'%'+_0x4b6b11[_0x79ef('0x4d')]['filter']+'%'};return _0xcc06d6;})});}_0x59f569=_['merge']({},_0x59f569,_0x4b6b11[_0x79ef('0x5b')]);return db[_0x79ef('0x74')][_0x79ef('0x35')]({'where':_0x59f569[_0x79ef('0x57')]})[_0x79ef('0x3b')](function(_0x4c0643){_0x586e17[_0x79ef('0x35')]=_0x4c0643;if(_0x4b6b11[_0x79ef('0x4d')][_0x79ef('0x70')]){_0x59f569[_0x79ef('0x5c')]=[{'all':!![]}];}return db[_0x79ef('0x74')][_0x79ef('0x5d')](_0x59f569);})['then'](function(_0xacdd0){_0x586e17['rows']=_0xacdd0;return _0x586e17;});}})['then'](respondWithFilteredResult(_0x3c321f,_0x59f569))[_0x79ef('0x2e')](handleError(_0x3c321f,null));};exports[_0x79ef('0x75')]=function(_0x499575,_0xe62dd7,_0x48b34a){return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x499575[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0xe62dd7,null))[_0x79ef('0x3b')](function(_0x53d1dd){if(_0x53d1dd){return _0x53d1dd[_0x79ef('0x75')](_0x499575['query'][_0x79ef('0x72')]);}})[_0x79ef('0x3b')](respondWithStatusCode(_0xe62dd7,null))[_0x79ef('0x2e')](handleError(_0xe62dd7,null));};exports[_0x79ef('0x76')]=function(_0x2c12e4,_0xe4984e,_0x44ffce){var _0x157bb4={'channel':_0x79ef('0x77')};var _0x5b11cb=[];var _0x571af0=[];var _0x1b8931={};return db['SmsAccount']['find']({'where':{'id':_0x2c12e4[_0x79ef('0x60')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x79ef('0x78')}]})[_0x79ef('0x3b')](handleEntityNotFound(_0xe4984e,null))[_0x79ef('0x3b')](function(_0x45f77a){_0x157bb4[_0x79ef('0x79')]=_0x45f77a;_0x157bb4[_0x79ef('0x7a')]=_[_0x79ef('0x7b')](_0x45f77a['Applications'],['priority'],[_0x79ef('0x7c')]);if(_0x157bb4[_0x79ef('0x79')][_0x79ef('0x78')]){delete _0x157bb4[_0x79ef('0x79')][_0x79ef('0x78')];}return db['CmContact'][_0x79ef('0x6a')]();})[_0x79ef('0x3b')](function(_0x3a6bcc){if(!_0x3a6bcc){throw new db['Sequelize'][(_0x79ef('0x7d'))](_0x79ef('0x7e'));}_0x5b11cb=_[_0x79ef('0x7f')](_['keys'](_0x3a6bcc),[_0x79ef('0x80'),'updatedAt']);_0x571af0=_['difference'](_[_0x79ef('0x4e')](_0x3a6bcc),[_0x79ef('0x80'),_0x79ef('0x81'),_0x79ef('0x82'),_0x79ef('0x83')]);_0x157bb4['body']={'mapKey':'mobile'};if(_0x157bb4[_0x79ef('0x79')][_0x79ef('0x4a')]){switch(_0x157bb4[_0x79ef('0x79')][_0x79ef('0x4a')]){case _0x79ef('0x84'):_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')]=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x86')];_0x157bb4[_0x79ef('0x63')]['body']=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x87')];_0x157bb4['body'][_0x79ef('0x88')]=_0x2c12e4[_0x79ef('0x63')]['MessageSid'];break;case'skebby':_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')]='+'+_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x89')];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4[_0x79ef('0x63')]['text'];break;case _0x79ef('0x8a'):_0x157bb4['body']['from']=_0x2c12e4['body'][_0x79ef('0x85')];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x2c')];break;case _0x79ef('0x8b'):_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')]=_0x2c12e4[_0x79ef('0x63')]['from'];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4['body'][_0x79ef('0x63')];_0x157bb4[_0x79ef('0x63')]['messageId']=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x8c')];break;case _0x79ef('0x8d'):_0x157bb4['body'][_0x79ef('0x85')]=_0x2c12e4['body'][_0x79ef('0x86')];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4[_0x79ef('0x63')]['Text'];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x88')]=_0x2c12e4['body'][_0x79ef('0x8e')];break;case _0x79ef('0x8f'):_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')]='+'+_0x2c12e4['body'][_0x79ef('0x90')][0x0]['from'];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4['body'][_0x79ef('0x90')][0x0][_0x79ef('0x91')];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x88')]=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x90')][0x0][_0x79ef('0x88')];break;case _0x79ef('0x92'):_0x157bb4[_0x79ef('0x63')]['from']=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x93')];_0x157bb4['body'][_0x79ef('0x63')]=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x94')][_0x79ef('0x2c')];break;case _0x79ef('0x95'):_0x157bb4['body'][_0x79ef('0x85')]=_0x2c12e4[_0x79ef('0x63')]['fromNumber'];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x91')];_0x157bb4['body'][_0x79ef('0x88')]=_0x2c12e4['body']['replyMessageId'];break;case'bandwidth':_0x157bb4[_0x79ef('0x63')][_0x79ef('0x88')]=_0x2c12e4[_0x79ef('0x63')][0x0][_0x79ef('0x2c')]['id'];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')]=_0x2c12e4[_0x79ef('0x63')][0x0][_0x79ef('0x2c')]['from'];_0x157bb4[_0x79ef('0x63')]['body']=_0x2c12e4[_0x79ef('0x63')][0x0][_0x79ef('0x2c')][_0x79ef('0x91')];break;case _0x79ef('0x96'):_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')]=_0x2c12e4['body'][_0x79ef('0x85')];_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]=_0x2c12e4[_0x79ef('0x63')]['message'];_0x157bb4[_0x79ef('0x63')]['messageId']=_0x2c12e4[_0x79ef('0x63')][_0x79ef('0x97')];break;}}if(_0x157bb4['body']['id']){delete _0x157bb4['body']['id'];}if(_[_0x79ef('0x98')](_0x157bb4['body']['from'])){throw new db[(_0x79ef('0x99'))][(_0x79ef('0x7d'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x157bb4['body']['body'])||_0x157bb4[_0x79ef('0x63')][_0x79ef('0x63')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x79ef('0x98')](_0x157bb4[_0x79ef('0x63')][_0x79ef('0x9a')])){throw new db['Sequelize'][(_0x79ef('0x7d'))](_0x79ef('0x9b')+_0x571af0);}if(!_['includes'](_0x571af0,_0x157bb4[_0x79ef('0x63')]['mapKey'])){throw new db['Sequelize'][(_0x79ef('0x7d'))](_0x79ef('0x9c')+_0x571af0);}_0x1b8931[_0x157bb4[_0x79ef('0x63')][_0x79ef('0x9a')]]=_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')];return db[_0x79ef('0x9d')]['find']({'where':{'id':_0x157bb4['account'][_0x79ef('0x83')]},'include':[{'model':db[_0x79ef('0x9e')],'as':'Contacts','where':_0x1b8931,'limit':0x1,'order':[[_0x79ef('0x81'),_0x79ef('0x9f')]]}]});})['then'](handleEntityNotFound(_0xe4984e,null))[_0x79ef('0x3b')](function(_0x54b392){if(_0x54b392){_0x157bb4[_0x79ef('0xa0')]=_[_0x79ef('0xa1')](_0x54b392,[_0x79ef('0xa2')]);if(_0x54b392['Contacts'][_0x79ef('0x53')]){return _0x54b392[_0x79ef('0xa2')][0x0];}var _0x6ab53f=_[_0x79ef('0x1b')](_0x157bb4[_0x79ef('0x63')],{'firstName':_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')],'ListId':_0x54b392['id']});_0x6ab53f[_0x157bb4['body'][_0x79ef('0x9a')]]=_0x157bb4[_0x79ef('0x63')]['from'];return db[_0x79ef('0x9e')][_0x79ef('0x62')](_0x6ab53f,{'fields':_0x5b11cb,'raw':!![]});}})[_0x79ef('0x3b')](handleEntityNotFound(_0xe4984e,null))['then'](function(_0xe50c58){if(_0xe50c58){_0x157bb4[_0x79ef('0xa3')]=_0xe50c58;var _0x291cf2={'ContactId':_0xe50c58['id'],'phone':_0x157bb4[_0x79ef('0x63')][_0x79ef('0x85')],'SmsAccountId':_0x2c12e4['params']['id']};var _0x3b8beb={'ContactId':_0xe50c58['id'],'SmsAccountId':_0x2c12e4[_0x79ef('0x60')]['id'],'closed':![]};return db['SmsInteraction'][_0x79ef('0x61')]({'where':_0x3b8beb})[_0x79ef('0x3b')](function(_0x3034fd){if(_0x3034fd){return[_0x3034fd,![]];}return db[_0x79ef('0xa4')]['create'](_0x291cf2)[_0x79ef('0x3b')](function(_0x59c4ba){return[_0x59c4ba,!![]];});});}})[_0x79ef('0xa5')](function(_0x26f51f,_0x3a51df){_0x157bb4[_0x79ef('0xa6')]=_0x26f51f[_0x79ef('0x3d')]({'plain':!![]});_0x157bb4[_0x79ef('0xa6')][_0x79ef('0xa7')]=![];if(_0x3a51df){if(_0x157bb4[_0x79ef('0x79')][_0x79ef('0xa8')]){_0x157bb4['applications'][_0x79ef('0xa9')]({'id':0x0,'priority':_0x157bb4[_0x79ef('0x7a')][_0x79ef('0x53')]+0x1,'app':'close','appdata':_0x79ef('0xaa'),'interval':_0x79ef('0xab')});}_0x157bb4[_0x79ef('0xa6')][_0x79ef('0xa7')]=!![];}return db['SmsMessage']['create']({'phone':_0x157bb4[_0x79ef('0x63')]['from'],'messageId':_0x157bb4[_0x79ef('0x63')]['messageId'],'body':_0x157bb4['body']['body'],'SmsAccountId':_0x2c12e4[_0x79ef('0x60')]['id'],'SmsInteractionId':_0x26f51f['id'],'direction':'in','ContactId':_0x26f51f[_0x79ef('0xac')],'AttachmentId':_0x157bb4[_0x79ef('0x63')]['AttachmentId']});})['then'](function(_0x112531){_0x157bb4[_0x79ef('0x2c')]=_0x112531;if(!_0x157bb4[_0x79ef('0xa6')][_0x79ef('0xad')])return;return db['User']['find']({'attributes':['id',_0x79ef('0x41')],'where':{'id':_0x157bb4[_0x79ef('0xa6')][_0x79ef('0xad')]}});})[_0x79ef('0x3b')](function(_0x49bf5b){if(_0x49bf5b){_0x157bb4['applications'][_0x79ef('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x49bf5b[_0x79ef('0x41')]+','+(_0x157bb4[_0x79ef('0x79')][_0x79ef('0xaf')]||0xa),'interval':_0x79ef('0xab')});}if(!_0x157bb4[_0x79ef('0xa6')][_0x79ef('0xb0')])return;return db['SmsQueue'][_0x79ef('0x61')]({'attributes':['id',_0x79ef('0x41')],'where':{'id':_0x157bb4[_0x79ef('0xa6')]['queueId']}});})[_0x79ef('0x3b')](function(_0x5c43dc){if(_0x5c43dc){_0x157bb4[_0x79ef('0x7a')]['unshift']({'id':0x0,'priority':0x1,'app':_0x79ef('0xb1'),'appdata':_0x5c43dc[_0x79ef('0x41')]+','+(_0x157bb4['account'][_0x79ef('0xb2')]||0x12c),'interval':_0x79ef('0xab')});}return respondWithRpcPromise(_0x79ef('0xb3'),_0x79ef('0xb4'),_0x157bb4);})[_0x79ef('0x3b')](function(_0x1771c8){if(_0x1771c8){var _0x5c5337=0xc8;var _0x2f36fc=_0x79ef('0xb5');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2f36fc,_0x5c5337,_0x79ef('0xb6'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f36fc,_0x5c5337,'entity\x20found',JSON['stringify'](_0x1771c8));if(_0x157bb4[_0x79ef('0x79')][_0x79ef('0x4a')]==='twilio'){return _0xe4984e[_0x79ef('0x30')](_0x5c5337)['set'](_0x79ef('0xb7'),_0x79ef('0xb8'))[_0x79ef('0x42')](_0x79ef('0xb9'));}else{return _0xe4984e[_0x79ef('0x30')](_0x5c5337)['json'](_0x1771c8);}}})[_0x79ef('0x2e')](handleError(_0xe4984e,null));};exports[_0x79ef('0xba')]=function(_0x3cf95f,_0x24c084){var _0x58cd1a=_0x3cf95f[_0x79ef('0x60')]['id'];var _0x4f8ad7=_0x3cf95f['body'];var _0x4da035=0xc8;var _0x36d094=null;return db['sequelize'][_0x79ef('0xbb')]({'isolationLevel':db[_0x79ef('0xbc')][_0x79ef('0xbd')][_0x79ef('0xbe')][_0x79ef('0xbf')]},function(_0x131ddf){return db[_0x79ef('0x47')][_0x79ef('0x6d')]({'where':{'id':_0x58cd1a},'transaction':_0x131ddf})[_0x79ef('0x3b')](function(_0x7ff022){if(_0x7ff022){return db[_0x79ef('0xc0')][_0x79ef('0x3c')]({'where':{'SmsAccountId':_0x58cd1a},'transaction':_0x131ddf})[_0x79ef('0x3b')](function(){var _0x314ad7=_[_0x79ef('0x46')](_0x4f8ad7,function(_0x420435){_0x420435['SmsAccountId']=_0x58cd1a;return _0x420435;});return db[_0x79ef('0xc0')]['bulkCreate'](_0x314ad7,{'transaction':_0x131ddf});});}else{_0x4da035=0x194;_0x36d094=[];}});})[_0x79ef('0x3b')](function(){if(_0x4da035!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x58cd1a},'order':'priority'})[_0x79ef('0x3b')](function(_0x3e2e32){_0x36d094=_0x3e2e32;});}})[_0x79ef('0x2e')](function(_0x18c17e){_0x4da035=0x1f4;logger[_0x79ef('0x2b')](_0x18c17e[_0x79ef('0x40')]);if(_0x18c17e[_0x79ef('0x41')]){delete _0x18c17e[_0x79ef('0x41')];}_0x36d094=_0x18c17e;})[_0x79ef('0xc1')](function(){if(_0x36d094===null){_0x24c084['sendStatus'](_0x4da035);}else{if(_0x4da035===0x1f4){_0x24c084[_0x79ef('0x30')](_0x4da035)[_0x79ef('0x42')](_0x36d094);}else{_0x24c084[_0x79ef('0x30')](_0x4da035)['json'](_0x36d094);}}});};exports[_0x79ef('0xc2')]=function(_0x219192,_0x40c406,_0x33100f){var _0x187eeb={};var _0x3ac3c6={};var _0x5a33d6;var _0x3371c8;return db[_0x79ef('0x47')][_0x79ef('0x6d')]({'where':{'id':_0x219192[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x40c406,null))['then'](function(_0xac269e){if(_0xac269e){_0x5a33d6=_0xac269e;_0x3ac3c6[_0x79ef('0x4c')]=_['keys'](db[_0x79ef('0xc0')][_0x79ef('0x48')]);_0x3ac3c6[_0x79ef('0x4d')]=_[_0x79ef('0x4e')](_0x219192['query']);_0x3ac3c6[_0x79ef('0x4f')]=_[_0x79ef('0x50')](_0x3ac3c6[_0x79ef('0x4c')],_0x3ac3c6['query']);_0x187eeb['attributes']=_['intersection'](_0x3ac3c6[_0x79ef('0x4c')],qs['fields'](_0x219192['query'][_0x79ef('0x52')]));_0x187eeb['attributes']=_0x187eeb[_0x79ef('0x51')][_0x79ef('0x53')]?_0x187eeb[_0x79ef('0x51')]:_0x3ac3c6[_0x79ef('0x4c')];_0x187eeb['order']=qs[_0x79ef('0x56')](_0x219192[_0x79ef('0x4d')][_0x79ef('0x56')]);_0x187eeb[_0x79ef('0x57')]=qs['filters'](_[_0x79ef('0x58')](_0x219192['query'],_0x3ac3c6['filters']));if(_0x219192[_0x79ef('0x4d')][_0x79ef('0x59')]){_0x187eeb['where']=_[_0x79ef('0x5a')](_0x187eeb[_0x79ef('0x57')],{'$or':_['map'](_0x187eeb['attributes'],function(_0x424b2c){var _0x45f420={};_0x45f420[_0x424b2c]={'$like':'%'+_0x219192[_0x79ef('0x4d')][_0x79ef('0x59')]+'%'};return _0x45f420;})});}_0x187eeb=_[_0x79ef('0x5a')]({},_0x187eeb,_0x219192[_0x79ef('0x5b')]);return _0x5a33d6['getApplications'](_0x187eeb);}})[_0x79ef('0x3b')](function(_0x155fd2){if(_0x155fd2){_0x3371c8=_0x155fd2[_0x79ef('0x53')];if(!_0x219192[_0x79ef('0x4d')][_0x79ef('0x54')](_0x79ef('0x6f'))){_0x187eeb[_0x79ef('0x34')]=qs['limit'](_0x219192[_0x79ef('0x4d')]['limit']);_0x187eeb[_0x79ef('0x33')]=qs[_0x79ef('0x33')](_0x219192[_0x79ef('0x4d')][_0x79ef('0x33')]);}return _0x5a33d6[_0x79ef('0xc2')](_0x187eeb);}})['then'](function(_0x47a8e7){if(_0x47a8e7){return _0x47a8e7?{'count':_0x3371c8,'rows':_0x47a8e7}:null;}})['then'](respondWithResult(_0x40c406,null))[_0x79ef('0x2e')](handleError(_0x40c406,null));};exports[_0x79ef('0xc3')]=function(_0x1917c6,_0x3fa345,_0x5137e9){var _0x4abe4e={'raw':![],'where':{}};var _0x528d35={};var _0xfc4300={'count':0x0,'rows':[]};return db[_0x79ef('0x47')][_0x79ef('0x6d')]({'where':{'id':_0x1917c6[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x3fa345,null))[_0x79ef('0x3b')](function(_0x23b9d2){if(_0x23b9d2){_0x528d35[_0x79ef('0x4c')]=_[_0x79ef('0x4e')](db[_0x79ef('0xa4')][_0x79ef('0x48')]);_0x528d35[_0x79ef('0x4d')]=_[_0x79ef('0x4e')](_0x1917c6[_0x79ef('0x4d')]);_0x528d35[_0x79ef('0x4f')]=_[_0x79ef('0x50')](_0x528d35['model'],_0x528d35[_0x79ef('0x4d')]);_0x4abe4e[_0x79ef('0x51')]=_[_0x79ef('0x50')](_0x528d35[_0x79ef('0x4c')],qs['fields'](_0x1917c6[_0x79ef('0x4d')][_0x79ef('0x52')]));_0x4abe4e[_0x79ef('0x51')]=_0x4abe4e[_0x79ef('0x51')]['length']?_0x4abe4e['attributes']:_0x528d35[_0x79ef('0x4c')];if(!_0x1917c6[_0x79ef('0x4d')][_0x79ef('0x54')]('nolimit')){_0x4abe4e[_0x79ef('0x34')]=qs[_0x79ef('0x34')](_0x1917c6[_0x79ef('0x4d')][_0x79ef('0x34')]);_0x4abe4e['offset']=qs[_0x79ef('0x33')](_0x1917c6['query'][_0x79ef('0x33')]);}_0x4abe4e[_0x79ef('0x55')]=qs[_0x79ef('0x56')](_0x1917c6[_0x79ef('0x4d')][_0x79ef('0x56')]);_0x4abe4e[_0x79ef('0x57')]=qs['filters'](_['pick'](_0x1917c6[_0x79ef('0x4d')],_0x528d35[_0x79ef('0x4f')]));_0x4abe4e[_0x79ef('0x57')]['SmsAccountId']=_0x23b9d2['id'];if(_0x1917c6[_0x79ef('0x4d')][_0x79ef('0x59')]){_0x4abe4e['where']=_[_0x79ef('0x5a')](_0x4abe4e[_0x79ef('0x57')],{'$or':_['map'](_0x4abe4e[_0x79ef('0x51')],function(_0x25986d){var _0x5349dd={};_0x5349dd[_0x25986d]={'$like':'%'+_0x1917c6['query']['filter']+'%'};return _0x5349dd;})});}_0x4abe4e=_[_0x79ef('0x5a')]({},_0x4abe4e,_0x1917c6[_0x79ef('0x5b')]);return db[_0x79ef('0xa4')]['count']({'where':_0x4abe4e[_0x79ef('0x57')]})[_0x79ef('0x3b')](function(_0x3760ab){_0xfc4300[_0x79ef('0x35')]=_0x3760ab;if(_0x1917c6['query'][_0x79ef('0x70')]){_0x4abe4e[_0x79ef('0x5c')]=[{'model':db[_0x79ef('0x9e')],'as':_0x79ef('0xc4'),'required':![]},{'model':db[_0x79ef('0xc5')],'as':_0x79ef('0xc6'),'attributes':[_0x79ef('0x41'),'fullname',_0x79ef('0xc7')],'required':![]},{'model':db[_0x79ef('0xc8')],'as':_0x79ef('0xc9'),'attributes':['id',_0x79ef('0x41'),_0x79ef('0xca')],'where':_0x1917c6['query'][_0x79ef('0xcb')]?{'id':_0x1917c6['query'][_0x79ef('0xcb')]}:undefined,'required':_0x1917c6[_0x79ef('0x4d')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x4abe4e);})['then'](function(_0x2d2608){_0xfc4300[_0x79ef('0x5e')]=_0x2d2608;return _0xfc4300;});}})[_0x79ef('0x3b')](respondWithFilteredResult(_0x3fa345,_0x4abe4e))['catch'](handleError(_0x3fa345,null));};exports[_0x79ef('0x42')]=function(_0x57bf73,_0x14903b,_0xd668b0){var _0x277af6,_0x17e91,_0x234f06;if(_[_0x79ef('0x98')](_0x57bf73[_0x79ef('0x63')][_0x79ef('0x63')])||_0x57bf73[_0x79ef('0x63')][_0x79ef('0x63')]===''){throw new db[(_0x79ef('0x99'))][(_0x79ef('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x57bf73[_0x79ef('0x63')]['to'])){throw new db['Sequelize'][(_0x79ef('0x7d'))](_0x79ef('0xcc'));}_0x277af6=_0x57bf73['body']['to'];return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x57bf73[_0x79ef('0x60')]['id']},'include':[{'model':db[_0x79ef('0x9d')],'as':'List','include':[{'model':db['CmContact'],'as':_0x79ef('0xa2'),'where':{'mobile':_0x277af6},'limit':0x1,'order':[[_0x79ef('0x81'),'DESC']]}]}]})[_0x79ef('0x3b')](handleEntityNotFound(_0x14903b,null))[_0x79ef('0x3b')](function(_0xa96944){if(_0xa96944&&_0xa96944[_0x79ef('0xcd')]){_0x17e91=_0xa96944[_0x79ef('0x3d')]({'plain':!![]});if(_0x17e91[_0x79ef('0xcd')]&&_0x17e91['List']['Contacts'][_0x79ef('0x53')]){return _0x17e91[_0x79ef('0xcd')][_0x79ef('0xa2')][0x0];}return db[_0x79ef('0x9e')][_0x79ef('0x62')](_[_0x79ef('0x1b')](_0x57bf73[_0x79ef('0x63')],{'firstName':_0x277af6,'mobile':_0x277af6,'phone':_0x277af6,'ListId':_0x17e91[_0x79ef('0x83')]}));}})[_0x79ef('0x3b')](handleEntityNotFound(_0x14903b,null))[_0x79ef('0x3b')](function(_0x5e7f07){if(_0x5e7f07){_0x234f06=_0x5e7f07;return db[_0x79ef('0xa4')][_0x79ef('0x61')]({'where':{'ContactId':_0x234f06['id'],'closed':![],'SmsAccountId':_0x17e91['id']}})[_0x79ef('0x3b')](function(_0x4d49b0){if(_0x4d49b0){return[_0x4d49b0,![]];}return db[_0x79ef('0xa4')]['create']({'UserId':_0x57bf73['user']['id'],'ContactId':_0x234f06['id'],'SmsAccountId':_0x17e91['id'],'phone':_0x277af6,'firstMsgDirection':'out','Messages':[_[_0x79ef('0x5a')](_0x57bf73[_0x79ef('0x63')],{'read':![],'body':_0x57bf73[_0x79ef('0x63')][_0x79ef('0x63')],'phone':_0x277af6,'SmsAccountId':_0x17e91['id'],'UserId':_0x57bf73[_0x79ef('0x64')]['id'],'ContactId':_0x234f06['id']})]},{'include':[{'model':db[_0x79ef('0xce')],'as':_0x79ef('0xcf')}]})[_0x79ef('0x3b')](function(_0xf2b3bc){return[_0xf2b3bc,!![]];});});}})[_0x79ef('0xa5')](function(_0x5b40bb,_0x249b10){if(_0x249b10){return _0x5b40bb;}return db[_0x79ef('0xce')][_0x79ef('0x62')](_['merge'](_0x57bf73[_0x79ef('0x63')],{'read':![],'body':_0x57bf73[_0x79ef('0x63')]['body'],'phone':_0x277af6,'SmsAccountId':_0x17e91['id'],'SmsInteractionId':_0x5b40bb['id'],'UserId':_0x57bf73[_0x79ef('0x64')]['id'],'ContactId':_0x234f06['id']}))[_0x79ef('0x3b')](function(_0x189bb3){_0x5b40bb[_0x79ef('0xd0')]['Messages']=[];_0x5b40bb[_0x79ef('0xd0')][_0x79ef('0xcf')][_0x79ef('0xa9')](_0x189bb3[_0x79ef('0xd0')]);return _0x5b40bb;});})['then'](respondWithResult(_0x14903b,null))[_0x79ef('0x2e')](handleError(_0x14903b,null));};exports[_0x79ef('0x30')]=function(_0x528249,_0x5d18f2,_0x35cc96){if(_0x528249['body']['id']){delete _0x528249[_0x79ef('0x63')]['id'];}var _0x20bfb6,_0x179176,_0x2aba12;return db['SmsAccount'][_0x79ef('0x61')]({'where':{'id':_0x528249[_0x79ef('0x60')]['id']}})['then'](handleEntityNotFound(_0x5d18f2,null))['then'](function(_0x572029){if(_0x572029){_0x2aba12=_0x572029;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x79ef('0x30'),'received\x20delivery\x20report\x20from',_0x572029[_0x79ef('0x4a')],util['inspect'](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));switch(_0x572029[_0x79ef('0x4a')]){case _0x79ef('0xd1'):if(_0x528249[_0x79ef('0x63')]['skebby_dispatch_id']&&_0x528249[_0x79ef('0x63')][_0x79ef('0x30')]){_0x179176=_0x528249[_0x79ef('0x63')][_0x79ef('0x30')];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x528249[_0x79ef('0x63')][_0x79ef('0xd2')]}});}break;case'connectel':if(_0x528249[_0x79ef('0x63')][_0x79ef('0xd3')]&&_0x528249[_0x79ef('0x63')][_0x79ef('0xd4')]){_0x179176=_0x528249['body'][_0x79ef('0xd4')];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x528249[_0x79ef('0x63')]['requestid']}});}break;case _0x79ef('0x8b'):if(_0x528249[_0x79ef('0x63')][_0x79ef('0x8c')]&&_0x528249[_0x79ef('0x63')][_0x79ef('0xd5')]){_0x179176=_0x528249[_0x79ef('0x63')][_0x79ef('0xd5')];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x528249[_0x79ef('0x63')]['message_id']}});}break;case _0x79ef('0x8f'):var _0x15a2f5=_0x528249['body'][_0x79ef('0x90')][0x0];if(_0x15a2f5[_0x79ef('0x88')]&&_0x15a2f5['status'][_0x79ef('0xd6')]==='DELIVERED'){_0x179176=_0x15a2f5[_0x79ef('0x30')][_0x79ef('0xd6')];return db[_0x79ef('0xce')]['find']({'where':{'messageId':_0x15a2f5[_0x79ef('0x88')]}});}break;case _0x79ef('0x95'):if(_0x528249[_0x79ef('0x63')][_0x79ef('0x88')]&&_0x528249['body']['status']){_0x179176=_0x528249[_0x79ef('0x63')]['status'];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x528249['body'][_0x79ef('0x88')]}});}break;case _0x79ef('0xd7'):if(_0x528249[_0x79ef('0x63')][0x0][_0x79ef('0x2c')]['id']){_0x179176=_0x528249[_0x79ef('0x63')][0x0][_0x79ef('0x4a')];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x528249[_0x79ef('0x63')][0x0][_0x79ef('0x2c')]['id']}});}break;case _0x79ef('0x96'):if(_0x528249['body']['redif']&&_0x528249[_0x79ef('0x63')][_0x79ef('0x30')]){_0x179176=_0x528249[_0x79ef('0x63')][_0x79ef('0x30')];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x528249['body'][_0x79ef('0xd8')]}});}break;}}})[_0x79ef('0x3b')](handleEntityNotFound(_0x5d18f2,null))['then'](function(_0x2b789d){if(_0x2b789d){_0x20bfb6=_0x2b789d;switch(_0x2aba12[_0x79ef('0x4a')]){case _0x79ef('0xd1'):if(_0x179176===_0x79ef('0xd9')){return _0x20bfb6[_0x79ef('0x3a')]({'read':!![]});}else{logger[_0x79ef('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x79ef('0xd1'),util['inspect'](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x179176==='1'){return _0x20bfb6['update']({'read':!![]});}else{logger[_0x79ef('0x2b')](_0x79ef('0x26'),'status',_0x79ef('0xd1'),util['inspect'](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;case _0x79ef('0x8b'):if(!_0x528249[_0x79ef('0x63')][_0x79ef('0xda')]&&_0x179176>=0xc8&&_0x179176<=0xce){return _0x20bfb6['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0x79ef('0xdb')](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;case _0x79ef('0x8f'):var _0x44ad9a=_0x528249['body'][_0x79ef('0x90')][0x0];if(_0x44ad9a['status'][_0x79ef('0xd6')]===_0x79ef('0xd9')){return _0x20bfb6[_0x79ef('0x3a')]({'read':!![]});}else{logger['error'](_0x79ef('0x26'),_0x79ef('0x30'),_0x79ef('0x8f'),util[_0x79ef('0xdb')](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x179176==_0x79ef('0xdc')||_0x179176==_0x79ef('0xdd')){return _0x20bfb6['update']({'read':!![]});}else{logger[_0x79ef('0x2b')](_0x79ef('0x26'),_0x79ef('0x30'),_0x79ef('0x95'),util[_0x79ef('0xdb')](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;case _0x79ef('0xd7'):if(_0x179176=='message-delivered'){return _0x20bfb6[_0x79ef('0x3a')]({'read':!![]});}else{logger[_0x79ef('0x2b')](_0x79ef('0x26'),'status',_0x79ef('0xd7'),util[_0x79ef('0xdb')](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x179176===_0x79ef('0xde')||_0x179176===_0x79ef('0xdf')){return _0x20bfb6[_0x79ef('0x3a')]({'read':!![]});}else{logger[_0x79ef('0x2b')](_0x79ef('0x26'),_0x79ef('0x30'),_0x79ef('0x96'),util['inspect'](_0x528249[_0x79ef('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x20bfb6;}})[_0x79ef('0x3b')](respondWithResult(_0x5d18f2,null))[_0x79ef('0x2e')](handleError(_0x5d18f2,null));};exports[_0x79ef('0xe0')]=function(_0x49f2e7,_0x3e0794,_0x3406fa){var _0x28f646,_0x4d6865,_0x4949a4;return db['SmsAccount'][_0x79ef('0x61')]({'where':{'id':_0x49f2e7[_0x79ef('0x60')]['id']}})['then'](handleEntityNotFound(_0x3e0794,null))[_0x79ef('0x3b')](function(_0x8f11c8){if(_0x8f11c8){_0x4949a4=_0x8f11c8;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x79ef('0x30'),'received\x20delivery\x20report\x20from',_0x8f11c8[_0x79ef('0x4a')],util[_0x79ef('0xdb')](_0x49f2e7[_0x79ef('0x4d')],{'showHidden':![],'depth':null}));switch(_0x8f11c8[_0x79ef('0x4a')]){case _0x79ef('0x92'):if(_0x49f2e7[_0x79ef('0x4d')][_0x79ef('0xe1')]&&_0x49f2e7[_0x79ef('0x4d')][_0x79ef('0xe2')]){_0x4d6865=_0x49f2e7[_0x79ef('0x4d')]['state'];return db[_0x79ef('0xce')][_0x79ef('0x61')]({'where':{'messageId':_0x49f2e7['query'][_0x79ef('0xe1')]}});}break;}}})['then'](handleEntityNotFound(_0x3e0794,null))[_0x79ef('0x3b')](function(_0x3c508d){if(_0x3c508d){_0x28f646=_0x3c508d;switch(_0x4949a4[_0x79ef('0x4a')]){case'csc':if(_0x4d6865==='2'||_0x4d6865==='6'){return _0x28f646['update']({'read':!![]});}else{logger[_0x79ef('0x2b')](_0x79ef('0x26'),_0x79ef('0x30'),_0x79ef('0x92'),util[_0x79ef('0xdb')](_0x49f2e7[_0x79ef('0x4d')],{'showHidden':![],'depth':null}));};break;}return _0x28f646;}})[_0x79ef('0x3b')](respondWithResult(_0x3e0794,null))[_0x79ef('0x2e')](handleError(_0x3e0794,null));};exports[_0x79ef('0xe3')]=function(_0x5c6d2f,_0x8ec40f,_0x2d54a5){return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x5c6d2f[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x8ec40f,null))[_0x79ef('0x3b')](function(_0x362970){if(_0x362970){return _0x362970['addAgents'](_0x5c6d2f[_0x79ef('0x63')][_0x79ef('0x72')],_[_0x79ef('0xa1')](_0x5c6d2f[_0x79ef('0x63')],['ids','id'])||{})[_0x79ef('0xa5')](function(_0x1ce785){for(var _0x3101ac=0x0;_0x3101ac<_0x5c6d2f[_0x79ef('0x63')][_0x79ef('0x72')][_0x79ef('0x53')];_0x3101ac+=0x1){socket['emit'](_0x79ef('0xe4'),{'UserId':Number(_0x5c6d2f[_0x79ef('0x63')][_0x79ef('0x72')][_0x3101ac]),'SmsAccountId':Number(_0x5c6d2f[_0x79ef('0x60')]['id'])});}return _0x1ce785;});}})['then'](respondWithResult(_0x8ec40f,null))['catch'](handleError(_0x8ec40f,null));};exports[_0x79ef('0xe5')]=function(_0x21f3ee,_0x361b76,_0x581335){return db[_0x79ef('0x47')][_0x79ef('0x61')]({'where':{'id':_0x21f3ee[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x361b76,null))[_0x79ef('0x3b')](function(_0x1bed54){if(_0x1bed54){return _0x1bed54['removeAgents'](_0x21f3ee[_0x79ef('0x4d')][_0x79ef('0x72')])[_0x79ef('0x3b')](function(){if(_[_0x79ef('0xe6')](_0x21f3ee[_0x79ef('0x4d')]['ids'])){for(var _0x32c14f=0x0;_0x32c14f<_0x21f3ee[_0x79ef('0x4d')][_0x79ef('0x72')][_0x79ef('0x53')];_0x32c14f+=0x1){socket[_0x79ef('0xe7')](_0x79ef('0xe8'),{'UserId':Number(_0x21f3ee[_0x79ef('0x4d')]['ids'][_0x32c14f]),'SmsAccountId':Number(_0x21f3ee[_0x79ef('0x60')]['id'])});}}else{socket[_0x79ef('0xe7')](_0x79ef('0xe8'),{'UserId':Number(_0x21f3ee['query'][_0x79ef('0x72')]),'SmsAccountId':Number(_0x21f3ee['params']['id'])});}});}})[_0x79ef('0x3b')](respondWithStatusCode(_0x361b76,null))[_0x79ef('0x2e')](handleError(_0x361b76,null));};exports[_0x79ef('0xe9')]=function(_0x17fefd,_0x402039,_0x2dc3c7){var _0x226ac2={};var _0x450604={};var _0x172107;var _0x5ad092;return db[_0x79ef('0x47')][_0x79ef('0x6d')]({'where':{'id':_0x17fefd[_0x79ef('0x60')]['id']}})[_0x79ef('0x3b')](handleEntityNotFound(_0x402039,null))[_0x79ef('0x3b')](function(_0x5dfa5c){if(_0x5dfa5c){_0x172107=_0x5dfa5c;_0x450604[_0x79ef('0x4c')]=_['keys'](db[_0x79ef('0xc5')]['rawAttributes']);_0x450604[_0x79ef('0x4d')]=_['keys'](_0x17fefd[_0x79ef('0x4d')]);_0x450604[_0x79ef('0x4f')]=_['intersection'](_0x450604[_0x79ef('0x4c')],_0x450604[_0x79ef('0x4d')]);_0x226ac2[_0x79ef('0x51')]=_[_0x79ef('0x50')](_0x450604[_0x79ef('0x4c')],qs[_0x79ef('0x52')](_0x17fefd[_0x79ef('0x4d')][_0x79ef('0x52')]));_0x226ac2[_0x79ef('0x51')]=_0x226ac2[_0x79ef('0x51')]['length']?_0x226ac2[_0x79ef('0x51')]:_0x450604['model'];_0x226ac2[_0x79ef('0x55')]=qs[_0x79ef('0x56')](_0x17fefd[_0x79ef('0x4d')]['sort']);_0x226ac2[_0x79ef('0x57')]=qs[_0x79ef('0x4f')](_['pick'](_0x17fefd['query'],_0x450604['filters']));if(_0x17fefd[_0x79ef('0x4d')][_0x79ef('0x59')]){_0x226ac2['where']=_[_0x79ef('0x5a')](_0x226ac2['where'],{'$or':_[_0x79ef('0x46')](_0x226ac2[_0x79ef('0x51')],function(_0x12f767){var _0x44b1d8={};_0x44b1d8[_0x12f767]={'$like':'%'+_0x17fefd[_0x79ef('0x4d')][_0x79ef('0x59')]+'%'};return _0x44b1d8;})});}_0x226ac2=_[_0x79ef('0x5a')]({},_0x226ac2,_0x17fefd[_0x79ef('0x5b')]);return _0x172107[_0x79ef('0xe9')](_0x226ac2);}})['then'](function(_0x2ab492){if(_0x2ab492){_0x5ad092=_0x2ab492[_0x79ef('0x53')];if(!_0x17fefd['query'][_0x79ef('0x54')](_0x79ef('0x6f'))){_0x226ac2[_0x79ef('0x34')]=qs[_0x79ef('0x34')](_0x17fefd['query'][_0x79ef('0x34')]);_0x226ac2[_0x79ef('0x33')]=qs[_0x79ef('0x33')](_0x17fefd[_0x79ef('0x4d')]['offset']);}return _0x172107['getAgents'](_0x226ac2);}})[_0x79ef('0x3b')](function(_0x48d391){if(_0x48d391){return _0x48d391?{'count':_0x5ad092,'rows':_0x48d391}:null;}})[_0x79ef('0x3b')](respondWithResult(_0x402039,null))[_0x79ef('0x2e')](handleError(_0x402039,null));}; \ No newline at end of file +var _0xcb80=['message-id','state','addAgents','spread','emit','removeAgents','isArray','getAgents','eml-format','zip-dir','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','UserProfileResource','describe','addDisposition','getDispositions','Disposition','findAll','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','findOne','length','order','rows','removeAnswers','notify','sms','SmsApplication','account','orderBy','priority','asc','Applications','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','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','Contacts','DESC','omit','defaults','SmsInteraction','interaction','created','autoclose','applications','push','close','unmanaged','User','UserId','unshift','agent','*,*,*,*','queueId','queue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','sendStatus','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','user','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','SmsMessage','connectel','requestid','statusInt','status_code','groupName','redif','DELIVERED','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet'];(function(_0x5a93f0,_0x172b1b){var _0x53844d=function(_0x19ba69){while(--_0x19ba69){_0x5a93f0['push'](_0x5a93f0['shift']());}};_0x53844d(++_0x172b1b);}(_0xcb80,0xeb));var _0x0cb8=function(_0x4bbe3d,_0x48c512){_0x4bbe3d=_0x4bbe3d-0x0;var _0x3d3a23=_0xcb80[_0x4bbe3d];return _0x3d3a23;};'use strict';var emlformat=require(_0x0cb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0cb8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0cb8('0x2'));var BPromise=require(_0x0cb8('0x3'));var Mustache=require('mustache');var util=require(_0x0cb8('0x4'));var path=require(_0x0cb8('0x5'));var sox=require('sox');var csv=require(_0x0cb8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cb8('0x7'));var _=require('lodash');var squel=require(_0x0cb8('0x8'));var crypto=require(_0x0cb8('0x9'));var jsforce=require(_0x0cb8('0xa'));var deskjs=require(_0x0cb8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0cb8('0xc'));var Papa=require(_0x0cb8('0xd'));var Redis=require('ioredis');var authService=require(_0x0cb8('0xe'));var qs=require(_0x0cb8('0xf'));var as=require(_0x0cb8('0x10'));var hardwareService=require(_0x0cb8('0x11'));var logger=require('../../config/logger')(_0x0cb8('0x12'));var utils=require(_0x0cb8('0x13'));var config=require(_0x0cb8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0cb8('0x15')]=_['defaults'](config['redis'],{'host':_0x0cb8('0x16'),'port':0x18eb});var socket=require(_0x0cb8('0x17'))(new Redis(config['redis']));require(_0x0cb8('0x18'))[_0x0cb8('0x19')](socket);var jayson=require(_0x0cb8('0x1a'));var client=jayson['client'][_0x0cb8('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x4572df,_0x5413d2,_0x3150bb,_0x2c834d){return new BPromise(function(_0x25606c,_0x20feca){var _0x738cde=_0x2c834d||client;return _0x738cde[_0x0cb8('0x1c')](_0x4572df,_0x3150bb)[_0x0cb8('0x1d')](function(_0x2f3d7d){logger['info'](_0x0cb8('0x1e'),_0x5413d2,'request\x20sent');logger[_0x0cb8('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5413d2,_0x0cb8('0x20'),JSON[_0x0cb8('0x21')](_0x2f3d7d));if(_0x2f3d7d[_0x0cb8('0x22')]){if(_0x2f3d7d[_0x0cb8('0x22')][_0x0cb8('0x23')]===0x1f4){logger['error'](_0x0cb8('0x1e'),_0x5413d2,_0x2f3d7d[_0x0cb8('0x22')][_0x0cb8('0x24')]);return _0x20feca(_0x2f3d7d[_0x0cb8('0x22')]['message']);}logger[_0x0cb8('0x22')](_0x0cb8('0x1e'),_0x5413d2,_0x2f3d7d[_0x0cb8('0x22')][_0x0cb8('0x24')]);return _0x25606c(_0x2f3d7d['error'][_0x0cb8('0x24')]);}else{logger[_0x0cb8('0x25')](_0x0cb8('0x1e'),_0x5413d2,'request\x20sent');_0x25606c(_0x2f3d7d[_0x0cb8('0x26')][_0x0cb8('0x24')]);}})[_0x0cb8('0x27')](function(_0x237f95){logger[_0x0cb8('0x22')](_0x0cb8('0x1e'),_0x5413d2,_0x237f95);_0x20feca(_0x237f95);});});}function respondWithStatusCode(_0x17866f,_0x2558dd){_0x2558dd=_0x2558dd||0xcc;return function(_0x1aaa46){if(_0x1aaa46){return _0x17866f['sendStatus'](_0x2558dd);}return _0x17866f[_0x0cb8('0x28')](_0x2558dd)[_0x0cb8('0x29')]();};}function respondWithResult(_0x5ca59d,_0x41d309){_0x41d309=_0x41d309||0xc8;return function(_0x14b654){if(_0x14b654){return _0x5ca59d['status'](_0x41d309)[_0x0cb8('0x2a')](_0x14b654);}};}function respondWithFilteredResult(_0x5df817,_0x597cb8){return function(_0x280476){if(_0x280476){var _0x53db9d=typeof _0x597cb8[_0x0cb8('0x2b')]===_0x0cb8('0x2c')&&typeof _0x597cb8[_0x0cb8('0x2d')]===_0x0cb8('0x2c');var _0x4c895b=_0x280476[_0x0cb8('0x2e')];var _0x4393d9=_0x53db9d?0x0:_0x597cb8[_0x0cb8('0x2b')];var _0xea82f6=_0x53db9d?_0x280476[_0x0cb8('0x2e')]:_0x597cb8[_0x0cb8('0x2b')]+_0x597cb8[_0x0cb8('0x2d')];var _0x352004;if(_0xea82f6>=_0x4c895b){_0xea82f6=_0x4c895b;_0x352004=0xc8;}else{_0x352004=0xce;}_0x5df817[_0x0cb8('0x28')](_0x352004);return _0x5df817[_0x0cb8('0x2f')](_0x0cb8('0x30'),_0x4393d9+'-'+_0xea82f6+'/'+_0x4c895b)[_0x0cb8('0x2a')](_0x280476);}return null;};}function patchUpdates(_0x51e321){return function(_0x4a1607){try{jsonpatch[_0x0cb8('0x31')](_0x4a1607,_0x51e321,!![]);}catch(_0x1ea4af){return BPromise['reject'](_0x1ea4af);}return _0x4a1607[_0x0cb8('0x32')]();};}function saveUpdates(_0x3fb165,_0x5e91ae){return function(_0x544d01){if(_0x544d01){return _0x544d01[_0x0cb8('0x33')](_0x3fb165)['then'](function(_0x95a18a){return _0x95a18a;});}return null;};}function removeEntity(_0x5d7c70,_0x5e4d29){return function(_0x3a5081){if(_0x3a5081){return _0x3a5081[_0x0cb8('0x34')]()[_0x0cb8('0x1d')](function(){var _0x476a4b=_0x3a5081[_0x0cb8('0x35')]({'plain':!![]});var _0x4a423a=_0x0cb8('0x36');return db['UserProfileResource'][_0x0cb8('0x34')]({'where':{'type':_0x4a423a,'resourceId':_0x476a4b['id']}})['then'](function(){return _0x3a5081;});})[_0x0cb8('0x1d')](function(){_0x5d7c70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c8751,_0x5b464c){return function(_0x4c91b9){if(!_0x4c91b9){_0x5c8751['sendStatus'](0x194);}return _0x4c91b9;};}function handleError(_0xdd805b,_0xa23711){_0xa23711=_0xa23711||0x1f4;return function(_0x2b9539){logger[_0x0cb8('0x22')](_0x2b9539[_0x0cb8('0x37')]);if(_0x2b9539[_0x0cb8('0x38')]){delete _0x2b9539[_0x0cb8('0x38')];}_0xdd805b[_0x0cb8('0x28')](_0xa23711)[_0x0cb8('0x39')](_0x2b9539);};}exports[_0x0cb8('0x3a')]=function(_0x2e18af,_0x953e4d){var _0x59313d={'include':[{'model':db[_0x0cb8('0x3b')],'as':_0x0cb8('0x3c')}]},_0x4e4c6f={},_0x45897c={'count':0x0,'rows':[]};var _0x472a8a=_[_0x0cb8('0x3d')](db[_0x0cb8('0x3e')][_0x0cb8('0x3f')],function(_0x17106e){return{'name':_0x17106e[_0x0cb8('0x40')],'type':_0x17106e['type']['key']};});_0x4e4c6f['model']=_[_0x0cb8('0x3d')](_0x472a8a,_0x0cb8('0x38'));_0x4e4c6f[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x2e18af['query']);_0x4e4c6f[_0x0cb8('0x43')]=_['intersection'](_0x4e4c6f[_0x0cb8('0x44')],_0x4e4c6f[_0x0cb8('0x41')]);_0x59313d[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0x4e4c6f[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x2e18af['query']['fields']));_0x59313d[_0x0cb8('0x45')]=_0x59313d[_0x0cb8('0x45')]['length']?_0x59313d[_0x0cb8('0x45')]:_0x4e4c6f[_0x0cb8('0x44')];if(!_0x2e18af[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x59313d[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x2e18af['query'][_0x0cb8('0x2d')]);_0x59313d[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x2e18af[_0x0cb8('0x41')]['offset']);}_0x59313d['order']=qs[_0x0cb8('0x4a')](_0x2e18af[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x59313d[_0x0cb8('0x4b')]=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x2e18af[_0x0cb8('0x41')],_0x4e4c6f['filters']),_0x472a8a);if(_0x2e18af['query']['filter']){_0x59313d['where']=_[_0x0cb8('0x4d')](_0x59313d['where'],{'$or':_[_0x0cb8('0x3d')](_0x472a8a,function(_0x5246c5){if(_0x5246c5[_0x0cb8('0x4e')]!=='VIRTUAL'){var _0x19be79={};_0x19be79[_0x5246c5[_0x0cb8('0x38')]]={'$like':'%'+_0x2e18af['query'][_0x0cb8('0x4f')]+'%'};return _0x19be79;}})});}_0x59313d=_[_0x0cb8('0x4d')]({},_0x59313d,_0x2e18af[_0x0cb8('0x50')]);var _0x137d67={'where':_0x59313d['where']};return db[_0x0cb8('0x3e')][_0x0cb8('0x2e')](_0x137d67)[_0x0cb8('0x1d')](function(_0x916e75){_0x45897c[_0x0cb8('0x2e')]=_0x916e75;if(_0x2e18af[_0x0cb8('0x41')][_0x0cb8('0x51')]){_0x59313d['include']=[{'all':!![]}];}return db[_0x0cb8('0x3e')]['findAll'](_0x59313d);})['then'](function(_0x4783c9){_0x45897c['rows']=_0x4783c9;return _0x45897c;})[_0x0cb8('0x1d')](respondWithFilteredResult(_0x953e4d,_0x59313d))['catch'](handleError(_0x953e4d,null));};exports[_0x0cb8('0x52')]=function(_0x5bcdcf,_0x13452d){var _0x1a7353={'raw':![],'where':{'id':_0x5bcdcf[_0x0cb8('0x53')]['id']},'include':[{'model':db[_0x0cb8('0x3b')],'as':_0x0cb8('0x3c')}]},_0x3b5b5f={};_0x3b5b5f[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x3e')]['rawAttributes']);_0x3b5b5f[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x5bcdcf['query']);_0x3b5b5f[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0x3b5b5f[_0x0cb8('0x44')],_0x3b5b5f[_0x0cb8('0x41')]);_0x1a7353['attributes']=_['intersection'](_0x3b5b5f[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x5bcdcf[_0x0cb8('0x41')][_0x0cb8('0x47')]));_0x1a7353['attributes']=_0x1a7353[_0x0cb8('0x45')]['length']?_0x1a7353[_0x0cb8('0x45')]:_0x3b5b5f[_0x0cb8('0x44')];if(_0x5bcdcf['query'][_0x0cb8('0x51')]){_0x1a7353[_0x0cb8('0x54')]=[{'all':!![]}];}_0x1a7353=_[_0x0cb8('0x4d')]({},_0x1a7353,_0x5bcdcf[_0x0cb8('0x50')]);return db[_0x0cb8('0x3e')]['find'](_0x1a7353)[_0x0cb8('0x1d')](handleEntityNotFound(_0x13452d,null))[_0x0cb8('0x1d')](respondWithResult(_0x13452d,null))[_0x0cb8('0x27')](handleError(_0x13452d,null));};exports[_0x0cb8('0x55')]=function(_0x20e2af,_0x2a4182){return db[_0x0cb8('0x3e')][_0x0cb8('0x55')](_0x20e2af[_0x0cb8('0x56')],{})['then'](function(_0x32bc55){var _0xe919a2=_0x20e2af['user'][_0x0cb8('0x35')]({'plain':!![]});if(!_0xe919a2)throw new Error(_0x0cb8('0x57'));if(_0xe919a2['role']==='user'){var _0x4246e0=_0x32bc55[_0x0cb8('0x35')]({'plain':!![]});var _0x4c7250='SmsAccounts';return db['UserProfileSection'][_0x0cb8('0x58')]({'where':{'name':_0x4c7250,'userProfileId':_0xe919a2['userProfileId']},'raw':!![]})['then'](function(_0x432857){if(_0x432857&&_0x432857['autoAssociation']===0x0){return db[_0x0cb8('0x59')][_0x0cb8('0x55')]({'name':_0x4246e0['name'],'resourceId':_0x4246e0['id'],'type':_0x432857['name'],'sectionId':_0x432857['id']},{})[_0x0cb8('0x1d')](function(){return _0x32bc55;});}else{return _0x32bc55;}})[_0x0cb8('0x27')](function(_0x3d9cae){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d9cae);throw _0x3d9cae;});}return _0x32bc55;})[_0x0cb8('0x1d')](respondWithResult(_0x2a4182,0xc9))[_0x0cb8('0x27')](handleError(_0x2a4182,null));};exports[_0x0cb8('0x33')]=function(_0x35d0fb,_0x454322){if(_0x35d0fb[_0x0cb8('0x56')]['id']){delete _0x35d0fb[_0x0cb8('0x56')]['id'];}return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x35d0fb[_0x0cb8('0x53')]['id']},'include':[{'model':db[_0x0cb8('0x3b')],'as':_0x0cb8('0x3c')}]})[_0x0cb8('0x1d')](handleEntityNotFound(_0x454322,null))[_0x0cb8('0x1d')](saveUpdates(_0x35d0fb[_0x0cb8('0x56')],null))[_0x0cb8('0x1d')](respondWithResult(_0x454322,null))[_0x0cb8('0x27')](handleError(_0x454322,null));};exports[_0x0cb8('0x34')]=function(_0x4da7e4,_0x4389e9){return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x4da7e4[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x4389e9,null))['then'](removeEntity(_0x4389e9,null))[_0x0cb8('0x27')](handleError(_0x4389e9,null));};exports[_0x0cb8('0x5a')]=function(_0x3c4684,_0x41fa7d){return db[_0x0cb8('0x3e')][_0x0cb8('0x5a')]()[_0x0cb8('0x1d')](respondWithResult(_0x41fa7d,null))[_0x0cb8('0x27')](handleError(_0x41fa7d,null));};exports[_0x0cb8('0x5b')]=function(_0x7e935d,_0x5e7c44,_0x4a4025){if(_0x7e935d[_0x0cb8('0x56')]['id']){delete _0x7e935d['body']['id'];}return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x7e935d['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5e7c44,null))[_0x0cb8('0x1d')](function(_0x427592){if(_0x427592){_0x7e935d['body']['SmsAccountId']=_0x427592['id'];return db['Disposition'][_0x0cb8('0x55')](_0x7e935d[_0x0cb8('0x56')]);}})[_0x0cb8('0x1d')](respondWithResult(_0x5e7c44,null))[_0x0cb8('0x27')](handleError(_0x5e7c44,null));};exports[_0x0cb8('0x5c')]=function(_0x4bdf4f,_0x49fe25,_0x1d6eb0){var _0x1c6265={'raw':![],'where':{}};var _0x2883b0={};var _0x2b5cde={'count':0x0,'rows':[]};return db[_0x0cb8('0x3e')]['findOne']({'where':{'id':_0x4bdf4f[_0x0cb8('0x53')]['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x49fe25,null))['then'](function(_0x34c5de){if(_0x34c5de){_0x2883b0[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x5d')]['rawAttributes']);_0x2883b0[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x4bdf4f[_0x0cb8('0x41')]);_0x2883b0[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0x2883b0[_0x0cb8('0x44')],_0x2883b0[_0x0cb8('0x41')]);_0x1c6265[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0x2883b0['model'],qs['fields'](_0x4bdf4f[_0x0cb8('0x41')]['fields']));_0x1c6265[_0x0cb8('0x45')]=_0x1c6265['attributes']['length']?_0x1c6265['attributes']:_0x2883b0[_0x0cb8('0x44')];if(!_0x4bdf4f['query'][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x1c6265[_0x0cb8('0x2d')]=qs['limit'](_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0x1c6265['offset']=qs['offset'](_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x2b')]);}_0x1c6265['order']=qs[_0x0cb8('0x4a')](_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x1c6265['where']=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x4bdf4f['query'],_0x2883b0['filters']));_0x1c6265['where']['SmsAccountId']=_0x34c5de['id'];if(_0x4bdf4f[_0x0cb8('0x41')][_0x0cb8('0x4f')]){_0x1c6265[_0x0cb8('0x4b')]=_[_0x0cb8('0x4d')](_0x1c6265[_0x0cb8('0x4b')],{'$or':_[_0x0cb8('0x3d')](_0x1c6265[_0x0cb8('0x45')],function(_0x2d5e0d){var _0x3fa42e={};_0x3fa42e[_0x2d5e0d]={'$like':'%'+_0x4bdf4f['query'][_0x0cb8('0x4f')]+'%'};return _0x3fa42e;})});}_0x1c6265=_['merge']({},_0x1c6265,_0x4bdf4f[_0x0cb8('0x50')]);return db[_0x0cb8('0x5d')]['count']({'where':_0x1c6265[_0x0cb8('0x4b')]})[_0x0cb8('0x1d')](function(_0x16aa53){_0x2b5cde[_0x0cb8('0x2e')]=_0x16aa53;if(_0x4bdf4f['query'][_0x0cb8('0x51')]){_0x1c6265['include']=[{'all':!![]}];}return db[_0x0cb8('0x5d')][_0x0cb8('0x5e')](_0x1c6265);})[_0x0cb8('0x1d')](function(_0x282cf2){_0x2b5cde['rows']=_0x282cf2;return _0x2b5cde;});}})['then'](respondWithFilteredResult(_0x49fe25,_0x1c6265))[_0x0cb8('0x27')](handleError(_0x49fe25,null));};exports[_0x0cb8('0x5f')]=function(_0x1420a6,_0x202a89,_0x5450b9){return db[_0x0cb8('0x3e')]['find']({'where':{'id':_0x1420a6['params']['id']}})['then'](handleEntityNotFound(_0x202a89,null))[_0x0cb8('0x1d')](function(_0xd9a731){if(_0xd9a731){return _0xd9a731[_0x0cb8('0x5f')](_0x1420a6['query'][_0x0cb8('0x60')]);}})[_0x0cb8('0x1d')](respondWithStatusCode(_0x202a89,null))[_0x0cb8('0x27')](handleError(_0x202a89,null));};exports[_0x0cb8('0x61')]=function(_0x2bc34e,_0x41f05a,_0x42a177){if(_0x2bc34e['body']['id']){delete _0x2bc34e[_0x0cb8('0x56')]['id'];}return db[_0x0cb8('0x3e')]['find']({'where':{'id':_0x2bc34e[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x41f05a,null))['then'](function(_0x35f44a){if(_0x35f44a){_0x2bc34e[_0x0cb8('0x56')][_0x0cb8('0x62')]=_0x35f44a['id'];return db[_0x0cb8('0x63')][_0x0cb8('0x55')](_0x2bc34e['body']);}})[_0x0cb8('0x1d')](respondWithResult(_0x41f05a,null))[_0x0cb8('0x27')](handleError(_0x41f05a,null));};exports[_0x0cb8('0x64')]=function(_0x28b807,_0x5618e9,_0x358684){var _0x42bf71={'raw':![],'where':{}};var _0x4bb509={};var _0xecff88={'count':0x0,'rows':[]};return db[_0x0cb8('0x3e')][_0x0cb8('0x65')]({'where':{'id':_0x28b807[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x5618e9,null))[_0x0cb8('0x1d')](function(_0x178849){if(_0x178849){_0x4bb509[_0x0cb8('0x44')]=_['keys'](db['CannedAnswer'][_0x0cb8('0x3f')]);_0x4bb509[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x28b807['query']);_0x4bb509[_0x0cb8('0x43')]=_['intersection'](_0x4bb509[_0x0cb8('0x44')],_0x4bb509['query']);_0x42bf71['attributes']=_[_0x0cb8('0x46')](_0x4bb509[_0x0cb8('0x44')],qs['fields'](_0x28b807[_0x0cb8('0x41')]['fields']));_0x42bf71['attributes']=_0x42bf71[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0x42bf71[_0x0cb8('0x45')]:_0x4bb509[_0x0cb8('0x44')];if(!_0x28b807['query'][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x42bf71['limit']=qs[_0x0cb8('0x2d')](_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0x42bf71[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x2b')]);}_0x42bf71[_0x0cb8('0x67')]=qs[_0x0cb8('0x4a')](_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x42bf71[_0x0cb8('0x4b')]=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x28b807[_0x0cb8('0x41')],_0x4bb509['filters']));_0x42bf71[_0x0cb8('0x4b')][_0x0cb8('0x62')]=_0x178849['id'];if(_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x4f')]){_0x42bf71['where']=_[_0x0cb8('0x4d')](_0x42bf71['where'],{'$or':_[_0x0cb8('0x3d')](_0x42bf71[_0x0cb8('0x45')],function(_0x5dfdfd){var _0xb8d42f={};_0xb8d42f[_0x5dfdfd]={'$like':'%'+_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x4f')]+'%'};return _0xb8d42f;})});}_0x42bf71=_[_0x0cb8('0x4d')]({},_0x42bf71,_0x28b807[_0x0cb8('0x50')]);return db['CannedAnswer'][_0x0cb8('0x2e')]({'where':_0x42bf71['where']})[_0x0cb8('0x1d')](function(_0x43d6fb){_0xecff88[_0x0cb8('0x2e')]=_0x43d6fb;if(_0x28b807[_0x0cb8('0x41')][_0x0cb8('0x51')]){_0x42bf71['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0cb8('0x5e')](_0x42bf71);})[_0x0cb8('0x1d')](function(_0xaa6088){_0xecff88[_0x0cb8('0x68')]=_0xaa6088;return _0xecff88;});}})[_0x0cb8('0x1d')](respondWithFilteredResult(_0x5618e9,_0x42bf71))[_0x0cb8('0x27')](handleError(_0x5618e9,null));};exports[_0x0cb8('0x69')]=function(_0x1ec611,_0x288332,_0x4fcc66){return db['SmsAccount'][_0x0cb8('0x58')]({'where':{'id':_0x1ec611['params']['id']}})['then'](handleEntityNotFound(_0x288332,null))[_0x0cb8('0x1d')](function(_0x21e6ce){if(_0x21e6ce){return _0x21e6ce[_0x0cb8('0x69')](_0x1ec611[_0x0cb8('0x41')]['ids']);}})[_0x0cb8('0x1d')](respondWithStatusCode(_0x288332,null))[_0x0cb8('0x27')](handleError(_0x288332,null));};exports[_0x0cb8('0x6a')]=function(_0x421a0f,_0x5910f4,_0x7e008){var _0x3ad6d7={'channel':_0x0cb8('0x6b')};var _0x501385=[];var _0x45d2d0=[];var _0x324fa9={};return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x421a0f['params']['id']},'include':[{'model':db[_0x0cb8('0x6c')],'as':'Applications'}]})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5910f4,null))[_0x0cb8('0x1d')](function(_0x316c39){_0x3ad6d7[_0x0cb8('0x6d')]=_0x316c39;_0x3ad6d7['applications']=_[_0x0cb8('0x6e')](_0x316c39['Applications'],[_0x0cb8('0x6f')],[_0x0cb8('0x70')]);if(_0x3ad6d7['account']['Applications']){delete _0x3ad6d7['account'][_0x0cb8('0x71')];}return db[_0x0cb8('0x72')][_0x0cb8('0x5a')]();})['then'](function(_0x452eec){if(!_0x452eec){throw new db['Sequelize'][(_0x0cb8('0x73'))]('no\x20available\x20attributes');}_0x501385=_[_0x0cb8('0x74')](_['keys'](_0x452eec),[_0x0cb8('0x75'),'updatedAt']);_0x45d2d0=_[_0x0cb8('0x74')](_['keys'](_0x452eec),[_0x0cb8('0x75'),_0x0cb8('0x76'),_0x0cb8('0x77'),_0x0cb8('0x78')]);_0x3ad6d7[_0x0cb8('0x56')]={'mapKey':_0x0cb8('0x79')};if(_0x3ad6d7['account']['type']){switch(_0x3ad6d7['account'][_0x0cb8('0x4e')]){case _0x0cb8('0x7a'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7c')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7d')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7f')];break;case'skebby':_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]='+'+_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x80')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x81')];break;case'connectel':_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7b')];_0x3ad6d7['body'][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x24')];break;case _0x0cb8('0x82'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7b')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x56')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f['body'][_0x0cb8('0x83')];break;case _0x0cb8('0x84'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x7c')];_0x3ad6d7['body'][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x85')];_0x3ad6d7[_0x0cb8('0x56')]['messageId']=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x86')];break;case _0x0cb8('0x87'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]='+'+_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0][_0x0cb8('0x7b')];_0x3ad6d7['body'][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0][_0x0cb8('0x81')];_0x3ad6d7['body'][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0][_0x0cb8('0x7e')];break;case _0x0cb8('0x89'):_0x3ad6d7['body'][_0x0cb8('0x7b')]=_0x421a0f['body'][_0x0cb8('0x8a')];_0x3ad6d7[_0x0cb8('0x56')]['body']=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x8b')]['message'];break;case _0x0cb8('0x8c'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f['body'][_0x0cb8('0x8d')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f['body'][_0x0cb8('0x81')];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x8e')];break;case _0x0cb8('0x8f'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7e')]=_0x421a0f['body'][0x0][_0x0cb8('0x24')]['id'];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f[_0x0cb8('0x56')][0x0][_0x0cb8('0x24')][_0x0cb8('0x7b')];_0x3ad6d7[_0x0cb8('0x56')]['body']=_0x421a0f['body'][0x0][_0x0cb8('0x24')][_0x0cb8('0x81')];break;case _0x0cb8('0x90'):_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')]=_0x421a0f['body']['from'];_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x24')];_0x3ad6d7['body'][_0x0cb8('0x7e')]=_0x421a0f[_0x0cb8('0x56')][_0x0cb8('0x91')];break;}}if(_0x3ad6d7[_0x0cb8('0x56')]['id']){delete _0x3ad6d7['body']['id'];}if(_[_0x0cb8('0x92')](_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')])){throw new db[(_0x0cb8('0x93'))][(_0x0cb8('0x73'))](_0x0cb8('0x94'));}if(_[_0x0cb8('0x92')](_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')])||_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x56')]===''){throw new db['Sequelize']['ValidationError'](_0x0cb8('0x95'));}if(_[_0x0cb8('0x92')](_0x3ad6d7['body'][_0x0cb8('0x96')])){throw new db[(_0x0cb8('0x93'))][(_0x0cb8('0x73'))](_0x0cb8('0x97')+_0x45d2d0);}if(!_[_0x0cb8('0x98')](_0x45d2d0,_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x96')])){throw new db[(_0x0cb8('0x93'))]['ValidationError'](_0x0cb8('0x99')+_0x45d2d0);}_0x324fa9[_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x96')]]=_0x3ad6d7['body']['from'];return db[_0x0cb8('0x9a')]['find']({'where':{'id':_0x3ad6d7[_0x0cb8('0x6d')][_0x0cb8('0x78')]},'include':[{'model':db[_0x0cb8('0x72')],'as':_0x0cb8('0x9b'),'where':_0x324fa9,'limit':0x1,'order':[[_0x0cb8('0x76'),_0x0cb8('0x9c')]]}]});})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5910f4,null))[_0x0cb8('0x1d')](function(_0x38e993){if(_0x38e993){_0x3ad6d7['list']=_[_0x0cb8('0x9d')](_0x38e993,['Contacts']);if(_0x38e993[_0x0cb8('0x9b')]['length']){return _0x38e993[_0x0cb8('0x9b')][0x0];}var _0x1ae571=_[_0x0cb8('0x9e')](_0x3ad6d7[_0x0cb8('0x56')],{'firstName':_0x3ad6d7[_0x0cb8('0x56')]['from'],'ListId':_0x38e993['id']});_0x1ae571[_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x96')]]=_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')];return db['CmContact']['create'](_0x1ae571,{'fields':_0x501385,'raw':!![]});}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x5910f4,null))[_0x0cb8('0x1d')](function(_0x324cfc){if(_0x324cfc){_0x3ad6d7['contact']=_0x324cfc;var _0x515cae={'ContactId':_0x324cfc['id'],'phone':_0x3ad6d7[_0x0cb8('0x56')]['from'],'SmsAccountId':_0x421a0f[_0x0cb8('0x53')]['id']};var _0x415c90={'ContactId':_0x324cfc['id'],'SmsAccountId':_0x421a0f[_0x0cb8('0x53')]['id'],'closed':![]};return db[_0x0cb8('0x9f')][_0x0cb8('0x58')]({'where':_0x415c90})[_0x0cb8('0x1d')](function(_0xcbe6aa){if(_0xcbe6aa){return[_0xcbe6aa,![]];}return db[_0x0cb8('0x9f')]['create'](_0x515cae)[_0x0cb8('0x1d')](function(_0x30bb10){return[_0x30bb10,!![]];});});}})['spread'](function(_0x1040e8,_0x464abc){_0x3ad6d7[_0x0cb8('0xa0')]=_0x1040e8['get']({'plain':!![]});_0x3ad6d7['interaction'][_0x0cb8('0xa1')]=![];if(_0x464abc){if(_0x3ad6d7[_0x0cb8('0x6d')][_0x0cb8('0xa2')]){_0x3ad6d7[_0x0cb8('0xa3')][_0x0cb8('0xa4')]({'id':0x0,'priority':_0x3ad6d7['applications'][_0x0cb8('0x66')]+0x1,'app':_0x0cb8('0xa5'),'appdata':_0x0cb8('0xa6'),'interval':'*,*,*,*'});}_0x3ad6d7[_0x0cb8('0xa0')][_0x0cb8('0xa1')]=!![];}return db['SmsMessage'][_0x0cb8('0x55')]({'phone':_0x3ad6d7[_0x0cb8('0x56')][_0x0cb8('0x7b')],'messageId':_0x3ad6d7['body'][_0x0cb8('0x7e')],'body':_0x3ad6d7['body']['body'],'SmsAccountId':_0x421a0f['params']['id'],'SmsInteractionId':_0x1040e8['id'],'direction':'in','ContactId':_0x1040e8['ContactId'],'AttachmentId':_0x3ad6d7[_0x0cb8('0x56')]['AttachmentId']});})[_0x0cb8('0x1d')](function(_0x2e2dbc){_0x3ad6d7['message']=_0x2e2dbc;if(!_0x3ad6d7[_0x0cb8('0xa0')]['UserId'])return;return db[_0x0cb8('0xa7')][_0x0cb8('0x58')]({'attributes':['id',_0x0cb8('0x38')],'where':{'id':_0x3ad6d7[_0x0cb8('0xa0')][_0x0cb8('0xa8')]}});})['then'](function(_0x23b1df){if(_0x23b1df){_0x3ad6d7[_0x0cb8('0xa3')][_0x0cb8('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0cb8('0xaa'),'appdata':_0x23b1df['name']+','+(_0x3ad6d7[_0x0cb8('0x6d')]['waitForTheAssignedAgent']||0xa),'interval':_0x0cb8('0xab')});}if(!_0x3ad6d7['interaction'][_0x0cb8('0xac')])return;return db['SmsQueue']['find']({'attributes':['id',_0x0cb8('0x38')],'where':{'id':_0x3ad6d7[_0x0cb8('0xa0')][_0x0cb8('0xac')]}});})[_0x0cb8('0x1d')](function(_0x5315bd){if(_0x5315bd){_0x3ad6d7['applications'][_0x0cb8('0xa9')]({'id':0x0,'priority':0x1,'app':_0x0cb8('0xad'),'appdata':_0x5315bd[_0x0cb8('0x38')]+','+(_0x3ad6d7[_0x0cb8('0x6d')]['waitForTheAssignedQueue']||0x12c),'interval':_0x0cb8('0xab')});}return respondWithRpcPromise(_0x0cb8('0xae'),'startRouting',_0x3ad6d7);})[_0x0cb8('0x1d')](function(_0x4ae144){if(_0x4ae144){var _0x51c508=0xc8;var _0x381e42=_0x0cb8('0xaf');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x381e42,_0x51c508,_0x0cb8('0xb0'));logger[_0x0cb8('0x1f')](_0x0cb8('0xb1'),_0x381e42,_0x51c508,'entity\x20found',JSON['stringify'](_0x4ae144));if(_0x3ad6d7['account'][_0x0cb8('0x4e')]===_0x0cb8('0x7a')){return _0x5910f4[_0x0cb8('0x28')](_0x51c508)[_0x0cb8('0x2f')](_0x0cb8('0xb2'),'text/xml')[_0x0cb8('0x39')]('\x0a');}else{return _0x5910f4[_0x0cb8('0x28')](_0x51c508)[_0x0cb8('0x2a')](_0x4ae144);}}})[_0x0cb8('0x27')](handleError(_0x5910f4,null));};exports[_0x0cb8('0xb3')]=function(_0x1ea0f2,_0x492275){var _0x10a9ad=_0x1ea0f2[_0x0cb8('0x53')]['id'];var _0x4a3e0f=_0x1ea0f2[_0x0cb8('0x56')];var _0x2ce73f=0xc8;var _0x1f3573=null;return db[_0x0cb8('0xb4')]['transaction']({'isolationLevel':db[_0x0cb8('0xb4')][_0x0cb8('0xb5')][_0x0cb8('0xb6')]['READ_COMMITTED']},function(_0x2de160){return db[_0x0cb8('0x3e')][_0x0cb8('0x65')]({'where':{'id':_0x10a9ad},'transaction':_0x2de160})[_0x0cb8('0x1d')](function(_0xb90537){if(_0xb90537){return db[_0x0cb8('0x6c')]['destroy']({'where':{'SmsAccountId':_0x10a9ad},'transaction':_0x2de160})[_0x0cb8('0x1d')](function(){var _0x1a00a4=_[_0x0cb8('0x3d')](_0x4a3e0f,function(_0x2cc4bf){_0x2cc4bf[_0x0cb8('0x62')]=_0x10a9ad;return _0x2cc4bf;});return db['SmsApplication'][_0x0cb8('0xb7')](_0x1a00a4,{'transaction':_0x2de160});});}else{_0x2ce73f=0x194;_0x1f3573=[];}});})[_0x0cb8('0x1d')](function(){if(_0x2ce73f!==0x194){return db['SmsApplication'][_0x0cb8('0xb8')]({'where':{'SmsAccountId':_0x10a9ad},'order':'priority'})[_0x0cb8('0x1d')](function(_0x5ced7a){_0x1f3573=_0x5ced7a;});}})[_0x0cb8('0x27')](function(_0x186b2f){_0x2ce73f=0x1f4;logger[_0x0cb8('0x22')](_0x186b2f[_0x0cb8('0x37')]);if(_0x186b2f[_0x0cb8('0x38')]){delete _0x186b2f[_0x0cb8('0x38')];}_0x1f3573=_0x186b2f;})['finally'](function(){if(_0x1f3573===null){_0x492275[_0x0cb8('0xb9')](_0x2ce73f);}else{if(_0x2ce73f===0x1f4){_0x492275[_0x0cb8('0x28')](_0x2ce73f)[_0x0cb8('0x39')](_0x1f3573);}else{_0x492275[_0x0cb8('0x28')](_0x2ce73f)[_0x0cb8('0x2a')](_0x1f3573);}}});};exports[_0x0cb8('0xba')]=function(_0x248af4,_0x429b1f,_0x1c6fcd){var _0x2dfa0f={};var _0xe01fa2={};var _0x3b66ab;var _0x281a29;return db['SmsAccount'][_0x0cb8('0x65')]({'where':{'id':_0x248af4['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x429b1f,null))['then'](function(_0x4be363){if(_0x4be363){_0x3b66ab=_0x4be363;_0xe01fa2[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x6c')][_0x0cb8('0x3f')]);_0xe01fa2[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x248af4[_0x0cb8('0x41')]);_0xe01fa2[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0xe01fa2[_0x0cb8('0x44')],_0xe01fa2[_0x0cb8('0x41')]);_0x2dfa0f[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0xe01fa2[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x248af4[_0x0cb8('0x41')]['fields']));_0x2dfa0f['attributes']=_0x2dfa0f[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0x2dfa0f['attributes']:_0xe01fa2['model'];_0x2dfa0f[_0x0cb8('0x67')]=qs['sort'](_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x2dfa0f['where']=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x248af4[_0x0cb8('0x41')],_0xe01fa2[_0x0cb8('0x43')]));if(_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x4f')]){_0x2dfa0f[_0x0cb8('0x4b')]=_[_0x0cb8('0x4d')](_0x2dfa0f[_0x0cb8('0x4b')],{'$or':_[_0x0cb8('0x3d')](_0x2dfa0f[_0x0cb8('0x45')],function(_0x1e1e3b){var _0x14cb59={};_0x14cb59[_0x1e1e3b]={'$like':'%'+_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x4f')]+'%'};return _0x14cb59;})});}_0x2dfa0f=_[_0x0cb8('0x4d')]({},_0x2dfa0f,_0x248af4[_0x0cb8('0x50')]);return _0x3b66ab['getApplications'](_0x2dfa0f);}})[_0x0cb8('0x1d')](function(_0x15dc9c){if(_0x15dc9c){_0x281a29=_0x15dc9c[_0x0cb8('0x66')];if(!_0x248af4[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x2dfa0f[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x248af4[_0x0cb8('0x41')]['limit']);_0x2dfa0f[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x248af4['query'][_0x0cb8('0x2b')]);}return _0x3b66ab[_0x0cb8('0xba')](_0x2dfa0f);}})[_0x0cb8('0x1d')](function(_0x57c357){if(_0x57c357){return _0x57c357?{'count':_0x281a29,'rows':_0x57c357}:null;}})[_0x0cb8('0x1d')](respondWithResult(_0x429b1f,null))[_0x0cb8('0x27')](handleError(_0x429b1f,null));};exports[_0x0cb8('0xbb')]=function(_0x545bff,_0x23fef4,_0x1093ef){var _0xcaf9aa={'raw':![],'where':{}};var _0x58767d={};var _0x27dc40={'count':0x0,'rows':[]};return db[_0x0cb8('0x3e')][_0x0cb8('0x65')]({'where':{'id':_0x545bff[_0x0cb8('0x53')]['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x23fef4,null))[_0x0cb8('0x1d')](function(_0x54dbe9){if(_0x54dbe9){_0x58767d[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0x9f')][_0x0cb8('0x3f')]);_0x58767d[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x545bff[_0x0cb8('0x41')]);_0x58767d[_0x0cb8('0x43')]=_[_0x0cb8('0x46')](_0x58767d[_0x0cb8('0x44')],_0x58767d[_0x0cb8('0x41')]);_0xcaf9aa[_0x0cb8('0x45')]=_[_0x0cb8('0x46')](_0x58767d['model'],qs[_0x0cb8('0x47')](_0x545bff['query'][_0x0cb8('0x47')]));_0xcaf9aa[_0x0cb8('0x45')]=_0xcaf9aa[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0xcaf9aa[_0x0cb8('0x45')]:_0x58767d[_0x0cb8('0x44')];if(!_0x545bff[_0x0cb8('0x41')]['hasOwnProperty'](_0x0cb8('0x49'))){_0xcaf9aa[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x545bff[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0xcaf9aa[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x545bff['query'][_0x0cb8('0x2b')]);}_0xcaf9aa['order']=qs['sort'](_0x545bff['query']['sort']);_0xcaf9aa[_0x0cb8('0x4b')]=qs['filters'](_['pick'](_0x545bff[_0x0cb8('0x41')],_0x58767d[_0x0cb8('0x43')]));_0xcaf9aa[_0x0cb8('0x4b')][_0x0cb8('0x62')]=_0x54dbe9['id'];if(_0x545bff['query'][_0x0cb8('0x4f')]){_0xcaf9aa[_0x0cb8('0x4b')]=_[_0x0cb8('0x4d')](_0xcaf9aa[_0x0cb8('0x4b')],{'$or':_['map'](_0xcaf9aa[_0x0cb8('0x45')],function(_0x5e62ae){var _0x3fae9a={};_0x3fae9a[_0x5e62ae]={'$like':'%'+_0x545bff[_0x0cb8('0x41')]['filter']+'%'};return _0x3fae9a;})});}_0xcaf9aa=_[_0x0cb8('0x4d')]({},_0xcaf9aa,_0x545bff['options']);return db[_0x0cb8('0x9f')][_0x0cb8('0x2e')]({'where':_0xcaf9aa[_0x0cb8('0x4b')]})[_0x0cb8('0x1d')](function(_0x2ab2bb){_0x27dc40[_0x0cb8('0x2e')]=_0x2ab2bb;if(_0x545bff[_0x0cb8('0x41')]['includeAll']){_0xcaf9aa[_0x0cb8('0x54')]=[{'model':db[_0x0cb8('0x72')],'as':_0x0cb8('0xbc'),'required':![]},{'model':db[_0x0cb8('0xa7')],'as':'Owner','attributes':['name',_0x0cb8('0xbd'),_0x0cb8('0xbe')],'required':![]},{'model':db[_0x0cb8('0xbf')],'as':_0x0cb8('0xc0'),'attributes':['id',_0x0cb8('0x38'),'color'],'where':_0x545bff['query'][_0x0cb8('0xc1')]?{'id':_0x545bff['query'][_0x0cb8('0xc1')]}:undefined,'required':_0x545bff[_0x0cb8('0x41')][_0x0cb8('0xc1')]?!![]:![]}];}return db[_0x0cb8('0x9f')]['findAll'](_0xcaf9aa);})[_0x0cb8('0x1d')](function(_0x4e2cf9){_0x27dc40[_0x0cb8('0x68')]=_0x4e2cf9;return _0x27dc40;});}})[_0x0cb8('0x1d')](respondWithFilteredResult(_0x23fef4,_0xcaf9aa))['catch'](handleError(_0x23fef4,null));};exports['send']=function(_0x1f033c,_0xf67877,_0x5855ef){var _0x225227,_0x1273be,_0x37a788;if(_[_0x0cb8('0x92')](_0x1f033c[_0x0cb8('0x56')]['body'])||_0x1f033c[_0x0cb8('0x56')][_0x0cb8('0x56')]===''){throw new db['Sequelize']['ValidationError'](_0x0cb8('0x95'));}if(_[_0x0cb8('0x92')](_0x1f033c['body']['to'])){throw new db[(_0x0cb8('0x93'))][(_0x0cb8('0x73'))](_0x0cb8('0xc2'));}_0x225227=_0x1f033c[_0x0cb8('0x56')]['to'];return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x1f033c[_0x0cb8('0x53')]['id']},'include':[{'model':db[_0x0cb8('0x9a')],'as':_0x0cb8('0xc3'),'include':[{'model':db[_0x0cb8('0x72')],'as':_0x0cb8('0x9b'),'where':{'mobile':_0x225227},'limit':0x1,'order':[[_0x0cb8('0x76'),_0x0cb8('0x9c')]]}]}]})[_0x0cb8('0x1d')](handleEntityNotFound(_0xf67877,null))['then'](function(_0x5381a4){if(_0x5381a4&&_0x5381a4[_0x0cb8('0xc3')]){_0x1273be=_0x5381a4[_0x0cb8('0x35')]({'plain':!![]});if(_0x1273be[_0x0cb8('0xc3')]&&_0x1273be[_0x0cb8('0xc3')]['Contacts'][_0x0cb8('0x66')]){return _0x1273be[_0x0cb8('0xc3')][_0x0cb8('0x9b')][0x0];}return db['CmContact'][_0x0cb8('0x55')](_['defaults'](_0x1f033c[_0x0cb8('0x56')],{'firstName':_0x225227,'mobile':_0x225227,'phone':_0x225227,'ListId':_0x1273be[_0x0cb8('0x78')]}));}})['then'](handleEntityNotFound(_0xf67877,null))[_0x0cb8('0x1d')](function(_0x23e660){if(_0x23e660){_0x37a788=_0x23e660;return db['SmsInteraction'][_0x0cb8('0x58')]({'where':{'ContactId':_0x37a788['id'],'closed':![],'SmsAccountId':_0x1273be['id']}})[_0x0cb8('0x1d')](function(_0x526125){if(_0x526125){return[_0x526125,![]];}return db[_0x0cb8('0x9f')][_0x0cb8('0x55')]({'UserId':_0x1f033c['user']['id'],'ContactId':_0x37a788['id'],'SmsAccountId':_0x1273be['id'],'phone':_0x225227,'firstMsgDirection':_0x0cb8('0xc4'),'Messages':[_[_0x0cb8('0x4d')](_0x1f033c[_0x0cb8('0x56')],{'read':![],'body':_0x1f033c[_0x0cb8('0x56')][_0x0cb8('0x56')],'phone':_0x225227,'SmsAccountId':_0x1273be['id'],'UserId':_0x1f033c['user']['id'],'ContactId':_0x37a788['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x0cb8('0xc5')}]})['then'](function(_0x5e3f7b){return[_0x5e3f7b,!![]];});});}})['spread'](function(_0x22c85a,_0x16db42){if(_0x16db42){return _0x22c85a;}return db['SmsMessage'][_0x0cb8('0x55')](_['merge'](_0x1f033c[_0x0cb8('0x56')],{'read':![],'body':_0x1f033c[_0x0cb8('0x56')][_0x0cb8('0x56')],'phone':_0x225227,'SmsAccountId':_0x1273be['id'],'SmsInteractionId':_0x22c85a['id'],'UserId':_0x1f033c[_0x0cb8('0xc6')]['id'],'ContactId':_0x37a788['id']}))[_0x0cb8('0x1d')](function(_0x1b122a){_0x22c85a[_0x0cb8('0xc7')][_0x0cb8('0xc5')]=[];_0x22c85a[_0x0cb8('0xc7')][_0x0cb8('0xc5')]['push'](_0x1b122a[_0x0cb8('0xc7')]);return _0x22c85a;});})['then'](respondWithResult(_0xf67877,null))[_0x0cb8('0x27')](handleError(_0xf67877,null));};exports[_0x0cb8('0x28')]=function(_0x39c036,_0x784fea,_0x1c9be0){if(_0x39c036[_0x0cb8('0x56')]['id']){delete _0x39c036[_0x0cb8('0x56')]['id'];}var _0x290854,_0x13ffb8,_0x4df723;return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x39c036['params']['id']}})['then'](handleEntityNotFound(_0x784fea,null))[_0x0cb8('0x1d')](function(_0x1d3c71){if(_0x1d3c71){_0x4df723=_0x1d3c71;logger[_0x0cb8('0x1f')](_0x0cb8('0xc8'),'status',_0x0cb8('0xc9'),_0x1d3c71[_0x0cb8('0x4e')],util[_0x0cb8('0xca')](_0x39c036['body'],{'showHidden':![],'depth':null}));switch(_0x1d3c71[_0x0cb8('0x4e')]){case'skebby':if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcb')]&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcb')]}});}break;case _0x0cb8('0xcd'):if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xce')]&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcf')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xcf')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036[_0x0cb8('0x56')]['requestid']}});}break;case _0x0cb8('0x82'):if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x83')]&&_0x39c036['body'][_0x0cb8('0xd0')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xd0')];return db[_0x0cb8('0xcc')]['find']({'where':{'messageId':_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x83')]}});}break;case _0x0cb8('0x87'):var _0x3c409d=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0];if(_0x3c409d[_0x0cb8('0x7e')]&&_0x3c409d[_0x0cb8('0x28')][_0x0cb8('0xd1')]==='DELIVERED'){_0x13ffb8=_0x3c409d[_0x0cb8('0x28')]['groupName'];return db[_0x0cb8('0xcc')]['find']({'where':{'messageId':_0x3c409d[_0x0cb8('0x7e')]}});}break;case'clickatell':if(_0x39c036[_0x0cb8('0x56')]['messageId']&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')]['status'];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036['body'][_0x0cb8('0x7e')]}});}break;case'bandwidth':if(_0x39c036[_0x0cb8('0x56')][0x0][_0x0cb8('0x24')]['id']){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][0x0][_0x0cb8('0x4e')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036[_0x0cb8('0x56')][0x0]['message']['id']}});}break;case _0x0cb8('0x90'):if(_0x39c036[_0x0cb8('0x56')][_0x0cb8('0xd2')]&&_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')]){_0x13ffb8=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x28')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x39c036['body'][_0x0cb8('0xd2')]}});}break;}}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x784fea,null))[_0x0cb8('0x1d')](function(_0x2a15da){if(_0x2a15da){_0x290854=_0x2a15da;switch(_0x4df723[_0x0cb8('0x4e')]){case'skebby':if(_0x13ffb8===_0x0cb8('0xd3')){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),'status',_0x0cb8('0xd4'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0xcd'):if(_0x13ffb8==='1'){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),'status',_0x0cb8('0xd4'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x82'):if(!_0x39c036['body'][_0x0cb8('0xd5')]&&_0x13ffb8>=0xc8&&_0x13ffb8<=0xce){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),_0x0cb8('0x82'),util[_0x0cb8('0xca')](_0x39c036['body'],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x87'):var _0x552395=_0x39c036[_0x0cb8('0x56')][_0x0cb8('0x88')][0x0];if(_0x552395['status']['groupName']===_0x0cb8('0xd3')){return _0x290854['update']({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),'infobip',util[_0x0cb8('0xca')](_0x39c036['body'],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x8c'):if(_0x13ffb8==_0x0cb8('0xd6')||_0x13ffb8==_0x0cb8('0xd7')){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),_0x0cb8('0x8c'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x8f'):if(_0x13ffb8==_0x0cb8('0xd8')){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),_0x0cb8('0x28'),_0x0cb8('0x8f'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;case _0x0cb8('0x90'):if(_0x13ffb8===_0x0cb8('0xd9')||_0x13ffb8==='ACCEPTD'){return _0x290854[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')](_0x0cb8('0xc8'),'status',_0x0cb8('0x90'),util[_0x0cb8('0xca')](_0x39c036[_0x0cb8('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x290854;}})[_0x0cb8('0x1d')](respondWithResult(_0x784fea,null))[_0x0cb8('0x27')](handleError(_0x784fea,null));};exports[_0x0cb8('0xda')]=function(_0x75e3a,_0x42f27d,_0x300563){var _0x5a0445,_0x30bff4,_0x2723e3;return db[_0x0cb8('0x3e')]['find']({'where':{'id':_0x75e3a[_0x0cb8('0x53')]['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x42f27d,null))['then'](function(_0x28d730){if(_0x28d730){_0x2723e3=_0x28d730;logger[_0x0cb8('0x1f')](_0x0cb8('0xc8'),'status',_0x0cb8('0xc9'),_0x28d730[_0x0cb8('0x4e')],util[_0x0cb8('0xca')](_0x75e3a[_0x0cb8('0x41')],{'showHidden':![],'depth':null}));switch(_0x28d730[_0x0cb8('0x4e')]){case'csc':if(_0x75e3a[_0x0cb8('0x41')][_0x0cb8('0xdb')]&&_0x75e3a[_0x0cb8('0x41')]['state']){_0x30bff4=_0x75e3a[_0x0cb8('0x41')][_0x0cb8('0xdc')];return db[_0x0cb8('0xcc')][_0x0cb8('0x58')]({'where':{'messageId':_0x75e3a['query'][_0x0cb8('0xdb')]}});}break;}}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x42f27d,null))[_0x0cb8('0x1d')](function(_0x5a88f5){if(_0x5a88f5){_0x5a0445=_0x5a88f5;switch(_0x2723e3[_0x0cb8('0x4e')]){case _0x0cb8('0x89'):if(_0x30bff4==='2'||_0x30bff4==='6'){return _0x5a0445[_0x0cb8('0x33')]({'read':!![]});}else{logger[_0x0cb8('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0cb8('0x28'),_0x0cb8('0x89'),util[_0x0cb8('0xca')](_0x75e3a[_0x0cb8('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x5a0445;}})[_0x0cb8('0x1d')](respondWithResult(_0x42f27d,null))[_0x0cb8('0x27')](handleError(_0x42f27d,null));};exports[_0x0cb8('0xdd')]=function(_0x52a945,_0x4fce58,_0x3a45a3){return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x52a945['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x4fce58,null))[_0x0cb8('0x1d')](function(_0x25a184){if(_0x25a184){return _0x25a184[_0x0cb8('0xdd')](_0x52a945[_0x0cb8('0x56')][_0x0cb8('0x60')],_[_0x0cb8('0x9d')](_0x52a945[_0x0cb8('0x56')],[_0x0cb8('0x60'),'id'])||{})[_0x0cb8('0xde')](function(_0x4890f7){for(var _0x46e7c9=0x0;_0x46e7c9<_0x52a945[_0x0cb8('0x56')][_0x0cb8('0x60')][_0x0cb8('0x66')];_0x46e7c9+=0x1){socket[_0x0cb8('0xdf')]('userSmsAccount:save',{'UserId':Number(_0x52a945[_0x0cb8('0x56')][_0x0cb8('0x60')][_0x46e7c9]),'SmsAccountId':Number(_0x52a945[_0x0cb8('0x53')]['id'])});}return _0x4890f7;});}})[_0x0cb8('0x1d')](respondWithResult(_0x4fce58,null))[_0x0cb8('0x27')](handleError(_0x4fce58,null));};exports[_0x0cb8('0xe0')]=function(_0x460242,_0x534efb,_0x4dbbc5){return db[_0x0cb8('0x3e')][_0x0cb8('0x58')]({'where':{'id':_0x460242['params']['id']}})[_0x0cb8('0x1d')](handleEntityNotFound(_0x534efb,null))[_0x0cb8('0x1d')](function(_0x9b77af){if(_0x9b77af){return _0x9b77af['removeAgents'](_0x460242['query'][_0x0cb8('0x60')])[_0x0cb8('0x1d')](function(){if(_[_0x0cb8('0xe1')](_0x460242[_0x0cb8('0x41')][_0x0cb8('0x60')])){for(var _0x5f4b69=0x0;_0x5f4b69<_0x460242[_0x0cb8('0x41')][_0x0cb8('0x60')][_0x0cb8('0x66')];_0x5f4b69+=0x1){socket[_0x0cb8('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x460242[_0x0cb8('0x41')][_0x0cb8('0x60')][_0x5f4b69]),'SmsAccountId':Number(_0x460242[_0x0cb8('0x53')]['id'])});}}else{socket[_0x0cb8('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x460242['query'][_0x0cb8('0x60')]),'SmsAccountId':Number(_0x460242[_0x0cb8('0x53')]['id'])});}});}})[_0x0cb8('0x1d')](respondWithStatusCode(_0x534efb,null))[_0x0cb8('0x27')](handleError(_0x534efb,null));};exports[_0x0cb8('0xe2')]=function(_0x25294f,_0x2f71c2,_0xee10ad){var _0x18e46e={};var _0x1d8cf5={};var _0x5e0adf;var _0x503979;return db['SmsAccount'][_0x0cb8('0x65')]({'where':{'id':_0x25294f[_0x0cb8('0x53')]['id']}})['then'](handleEntityNotFound(_0x2f71c2,null))['then'](function(_0x3d65f1){if(_0x3d65f1){_0x5e0adf=_0x3d65f1;_0x1d8cf5[_0x0cb8('0x44')]=_[_0x0cb8('0x42')](db[_0x0cb8('0xa7')][_0x0cb8('0x3f')]);_0x1d8cf5[_0x0cb8('0x41')]=_[_0x0cb8('0x42')](_0x25294f[_0x0cb8('0x41')]);_0x1d8cf5[_0x0cb8('0x43')]=_['intersection'](_0x1d8cf5[_0x0cb8('0x44')],_0x1d8cf5[_0x0cb8('0x41')]);_0x18e46e['attributes']=_['intersection'](_0x1d8cf5[_0x0cb8('0x44')],qs[_0x0cb8('0x47')](_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x47')]));_0x18e46e[_0x0cb8('0x45')]=_0x18e46e[_0x0cb8('0x45')][_0x0cb8('0x66')]?_0x18e46e[_0x0cb8('0x45')]:_0x1d8cf5[_0x0cb8('0x44')];_0x18e46e['order']=qs[_0x0cb8('0x4a')](_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x4a')]);_0x18e46e[_0x0cb8('0x4b')]=qs[_0x0cb8('0x43')](_[_0x0cb8('0x4c')](_0x25294f[_0x0cb8('0x41')],_0x1d8cf5[_0x0cb8('0x43')]));if(_0x25294f[_0x0cb8('0x41')]['filter']){_0x18e46e[_0x0cb8('0x4b')]=_['merge'](_0x18e46e[_0x0cb8('0x4b')],{'$or':_[_0x0cb8('0x3d')](_0x18e46e[_0x0cb8('0x45')],function(_0x2d3e6b){var _0x4e1f66={};_0x4e1f66[_0x2d3e6b]={'$like':'%'+_0x25294f[_0x0cb8('0x41')]['filter']+'%'};return _0x4e1f66;})});}_0x18e46e=_[_0x0cb8('0x4d')]({},_0x18e46e,_0x25294f[_0x0cb8('0x50')]);return _0x5e0adf[_0x0cb8('0xe2')](_0x18e46e);}})[_0x0cb8('0x1d')](function(_0x3ac1e0){if(_0x3ac1e0){_0x503979=_0x3ac1e0[_0x0cb8('0x66')];if(!_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x48')](_0x0cb8('0x49'))){_0x18e46e[_0x0cb8('0x2d')]=qs[_0x0cb8('0x2d')](_0x25294f[_0x0cb8('0x41')][_0x0cb8('0x2d')]);_0x18e46e[_0x0cb8('0x2b')]=qs[_0x0cb8('0x2b')](_0x25294f['query'][_0x0cb8('0x2b')]);}return _0x5e0adf[_0x0cb8('0xe2')](_0x18e46e);}})['then'](function(_0x1e5083){if(_0x1e5083){return _0x1e5083?{'count':_0x503979,'rows':_0x1e5083}:null;}})[_0x0cb8('0x1d')](respondWithResult(_0x2f71c2,null))['catch'](handleError(_0x2f71c2,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 86c831c..e47c624 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 _0xa00f=['save','update','remove','emit','hasOwnProperty','events','SmsAccount'];(function(_0x284239,_0x232a4e){var _0x2d06cb=function(_0x508508){while(--_0x508508){_0x284239['push'](_0x284239['shift']());}};_0x2d06cb(++_0x232a4e);}(_0xa00f,0x8a));var _0xfa00=function(_0xeb34fa,_0x45020e){_0xeb34fa=_0xeb34fa-0x0;var _0xde69e5=_0xa00f[_0xeb34fa];return _0xde69e5;};'use strict';var EventEmitter=require(_0xfa00('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xfa00('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa00('0x2'),'afterUpdate':_0xfa00('0x3'),'afterDestroy':_0xfa00('0x4')};function emitEvent(_0x180608){return function(_0x41cd73,_0x5330d1,_0x4f597c){SmsAccountEvents[_0xfa00('0x5')](_0x180608+':'+_0x41cd73['id'],_0x41cd73);SmsAccountEvents[_0xfa00('0x5')](_0x180608,_0x41cd73);_0x4f597c(null);};}for(var e in events){if(events[_0xfa00('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xd3b2=['hook','exports','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0xd3b2,0xb0));var _0x2d3b=function(_0x555e71,_0xea94c5){_0x555e71=_0x555e71-0x0;var _0x173069=_0xd3b2[_0x555e71];return _0x173069;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x2d3b('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d3b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4c93eb){return function(_0x3b70e7,_0x312db4,_0x351bc6){SmsAccountEvents[_0x2d3b('0x2')](_0x4c93eb+':'+_0x3b70e7['id'],_0x3b70e7);SmsAccountEvents[_0x2d3b('0x2')](_0x4c93eb,_0x3b70e7);_0x351bc6(null);};}for(var e in events){if(events[_0x2d3b('0x3')](e)){var event=events[e];SmsAccount[_0x2d3b('0x4')](e,emitEvent(event));}}module[_0x2d3b('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f07e464..f4838ab 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 _0x3c26=['exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x3841a7,_0x3c91fb){var _0x56fda8=function(_0x30ea35){while(--_0x30ea35){_0x3841a7['push'](_0x3841a7['shift']());}};_0x56fda8(++_0x3c91fb);}(_0x3c26,0x122));var _0x63c2=function(_0x5b5a01,_0xb8e4){_0x5b5a01=_0x5b5a01-0x0;var _0x2c2951=_0x3c26[_0x5b5a01];return _0x2c2951;};'use strict';var _=require('lodash');var util=require(_0x63c2('0x0'));var logger=require(_0x63c2('0x1'))(_0x63c2('0x2'));var moment=require('moment');var BPromise=require(_0x63c2('0x3'));var rp=require(_0x63c2('0x4'));var fs=require('fs');var path=require(_0x63c2('0x5'));var rimraf=require(_0x63c2('0x6'));var config=require(_0x63c2('0x7'));var attributes=require(_0x63c2('0x8'));module[_0x63c2('0x9')]=function(_0x161ca5,_0x2e6fdb){return _0x161ca5[_0x63c2('0xa')](_0x63c2('0xb'),attributes,{'tableName':_0x63c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf82=['./smsAccount.attributes','exports','define','SmsAccount','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4ea24d,_0x2d0f66){var _0x4fec11=function(_0x149cf7){while(--_0x149cf7){_0x4ea24d['push'](_0x4ea24d['shift']());}};_0x4fec11(++_0x2d0f66);}(_0xdf82,0x88));var _0x2df8=function(_0x20b041,_0x41d6af){_0x20b041=_0x20b041-0x0;var _0x120e63=_0xdf82[_0x20b041];return _0x120e63;};'use strict';var _=require(_0x2df8('0x0'));var util=require('util');var logger=require(_0x2df8('0x1'))('api');var moment=require(_0x2df8('0x2'));var BPromise=require(_0x2df8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df8('0x4'));var rimraf=require(_0x2df8('0x5'));var config=require(_0x2df8('0x6'));var attributes=require(_0x2df8('0x7'));module[_0x2df8('0x8')]=function(_0x41a9c7,_0x40471f){return _0x41a9c7[_0x2df8('0x9')](_0x2df8('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 83fbd7d..69def3c 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 _0x5197=['stringify','error','code','message','result','SmsAccount','find','options','raw','include','map','model','attributes','ShowSmsAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','defaults','redis','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c68e3,_0x429630){var _0x4094b1=function(_0xba0771){while(--_0xba0771){_0x4c68e3['push'](_0x4c68e3['shift']());}};_0x4094b1(++_0x429630);}(_0x5197,0x1c9));var _0x7519=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x5197[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x7519('0x0'));var util=require(_0x7519('0x1'));var moment=require('moment');var BPromise=require(_0x7519('0x2'));var rs=require(_0x7519('0x3'));var fs=require('fs');var Redis=require(_0x7519('0x4'));var db=require(_0x7519('0x5'))['db'];var utils=require(_0x7519('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7519('0x7'));var client=jayson['client'][_0x7519('0x8')]({'port':0x232a});config['redis']=_[_0x7519('0x9')](config[_0x7519('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7519('0xb'))(new Redis(config[_0x7519('0xa')]));require(_0x7519('0xc'))['register'](socket);function respondWithRpcPromise(_0x493632,_0x1cb715,_0x3ae402){return new BPromise(function(_0x331a4a,_0x30137f){return client[_0x7519('0xd')](_0x493632,_0x3ae402)[_0x7519('0xe')](function(_0x558928){logger[_0x7519('0xf')](_0x7519('0x10'),_0x1cb715,_0x7519('0x11'));logger[_0x7519('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1cb715,_0x7519('0x11'),JSON[_0x7519('0x13')](_0x558928));if(_0x558928['error']){if(_0x558928[_0x7519('0x14')][_0x7519('0x15')]===0x1f4){logger['error'](_0x7519('0x10'),_0x1cb715,_0x558928[_0x7519('0x14')][_0x7519('0x16')]);return _0x30137f(_0x558928[_0x7519('0x14')][_0x7519('0x16')]);}logger[_0x7519('0x14')]('SmsAccount,\x20%s,\x20%s',_0x1cb715,_0x558928['error'][_0x7519('0x16')]);return _0x331a4a(_0x558928['error'][_0x7519('0x16')]);}else{logger[_0x7519('0xf')](_0x7519('0x10'),_0x1cb715,_0x7519('0x11'));_0x331a4a(_0x558928[_0x7519('0x17')][_0x7519('0x16')]);}})['catch'](function(_0x392aea){logger[_0x7519('0x14')]('SmsAccount,\x20%s,\x20%s',_0x1cb715,_0x392aea);_0x30137f(_0x392aea);});});}exports['ShowSmsAccount']=function(_0x47472e){var _0x5d9448=this;return new Promise(function(_0x3fd2e9,_0x197d4e){return db[_0x7519('0x18')][_0x7519('0x19')]({'raw':_0x47472e[_0x7519('0x1a')]?_0x47472e[_0x7519('0x1a')][_0x7519('0x1b')]===undefined?!![]:![]:!![],'where':_0x47472e[_0x7519('0x1a')]?_0x47472e[_0x7519('0x1a')]['where']||null:null,'attributes':_0x47472e[_0x7519('0x1a')]?_0x47472e[_0x7519('0x1a')]['attributes']||null:null,'include':_0x47472e[_0x7519('0x1a')]?_0x47472e[_0x7519('0x1a')][_0x7519('0x1c')]?_[_0x7519('0x1d')](_0x47472e[_0x7519('0x1a')][_0x7519('0x1c')],function(_0x4bf278){return{'model':db[_0x4bf278[_0x7519('0x1e')]],'as':_0x4bf278['as'],'attributes':_0x4bf278[_0x7519('0x1f')],'include':_0x4bf278[_0x7519('0x1c')]?_[_0x7519('0x1d')](_0x4bf278[_0x7519('0x1c')],function(_0x37bc23){return{'model':db[_0x37bc23[_0x7519('0x1e')]],'as':_0x37bc23['as'],'attributes':_0x37bc23[_0x7519('0x1f')],'include':_0x37bc23[_0x7519('0x1c')]?_[_0x7519('0x1d')](_0x37bc23[_0x7519('0x1c')],function(_0x469b7a){return{'model':db[_0x469b7a[_0x7519('0x1e')]],'as':_0x469b7a['as'],'attributes':_0x469b7a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7519('0xe')](function(_0x2dbdd8){logger['info'](_0x7519('0x20'),_0x47472e);logger['debug']('ShowSmsAccount',_0x47472e,JSON[_0x7519('0x13')](_0x2dbdd8));_0x3fd2e9(_0x2dbdd8);})[_0x7519('0x21')](function(_0x124fee){logger[_0x7519('0x14')]('ShowSmsAccount',_0x124fee[_0x7519('0x16')],_0x47472e);_0x197d4e(_0x5d9448[_0x7519('0x14')](0x1f4,_0x124fee[_0x7519('0x16')]));});});}; \ No newline at end of file +var _0x03e9=['result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','request','then','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message'];(function(_0x1ecd12,_0x5826dd){var _0x348b09=function(_0x45243b){while(--_0x45243b){_0x1ecd12['push'](_0x1ecd12['shift']());}};_0x348b09(++_0x5826dd);}(_0x03e9,0xde));var _0x903e=function(_0x28049e,_0x302e6b){_0x28049e=_0x28049e-0x0;var _0xf8a2ae=_0x03e9[_0x28049e];return _0xf8a2ae;};'use strict';var _=require('lodash');var util=require(_0x903e('0x0'));var moment=require('moment');var BPromise=require(_0x903e('0x1'));var rs=require(_0x903e('0x2'));var fs=require('fs');var Redis=require(_0x903e('0x3'));var db=require(_0x903e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x903e('0x5'))(_0x903e('0x6'));var config=require(_0x903e('0x7'));var jayson=require(_0x903e('0x8'));var client=jayson['client'][_0x903e('0x9')]({'port':0x232a});config[_0x903e('0xa')]=_[_0x903e('0xb')](config[_0x903e('0xa')],{'host':_0x903e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x903e('0xd'))['register'](socket);function respondWithRpcPromise(_0x191860,_0x1062fa,_0x4e5a2c){return new BPromise(function(_0x517d57,_0xc2af0a){return client[_0x903e('0xe')](_0x191860,_0x4e5a2c)[_0x903e('0xf')](function(_0x1b34ca){logger[_0x903e('0x10')]('SmsAccount,\x20%s,\x20%s',_0x1062fa,_0x903e('0x11'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1062fa,_0x903e('0x11'),JSON[_0x903e('0x12')](_0x1b34ca));if(_0x1b34ca[_0x903e('0x13')]){if(_0x1b34ca[_0x903e('0x13')][_0x903e('0x14')]===0x1f4){logger['error'](_0x903e('0x15'),_0x1062fa,_0x1b34ca[_0x903e('0x13')]['message']);return _0xc2af0a(_0x1b34ca[_0x903e('0x13')][_0x903e('0x16')]);}logger['error'](_0x903e('0x15'),_0x1062fa,_0x1b34ca[_0x903e('0x13')][_0x903e('0x16')]);return _0x517d57(_0x1b34ca[_0x903e('0x13')][_0x903e('0x16')]);}else{logger[_0x903e('0x10')](_0x903e('0x15'),_0x1062fa,'request\x20sent');_0x517d57(_0x1b34ca[_0x903e('0x17')][_0x903e('0x16')]);}})[_0x903e('0x18')](function(_0x58f214){logger[_0x903e('0x13')](_0x903e('0x15'),_0x1062fa,_0x58f214);_0xc2af0a(_0x58f214);});});}exports[_0x903e('0x19')]=function(_0x1903a3){var _0xf623df=this;return new Promise(function(_0x117b16,_0x4109af){return db[_0x903e('0x1a')][_0x903e('0x1b')]({'raw':_0x1903a3[_0x903e('0x1c')]?_0x1903a3[_0x903e('0x1c')][_0x903e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1903a3[_0x903e('0x1c')]?_0x1903a3[_0x903e('0x1c')][_0x903e('0x1e')]||null:null,'attributes':_0x1903a3[_0x903e('0x1c')]?_0x1903a3[_0x903e('0x1c')]['attributes']||null:null,'include':_0x1903a3[_0x903e('0x1c')]?_0x1903a3['options'][_0x903e('0x1f')]?_[_0x903e('0x20')](_0x1903a3[_0x903e('0x1c')][_0x903e('0x1f')],function(_0x153cd8){return{'model':db[_0x153cd8[_0x903e('0x21')]],'as':_0x153cd8['as'],'attributes':_0x153cd8[_0x903e('0x22')],'include':_0x153cd8['include']?_[_0x903e('0x20')](_0x153cd8['include'],function(_0x4ef098){return{'model':db[_0x4ef098[_0x903e('0x21')]],'as':_0x4ef098['as'],'attributes':_0x4ef098[_0x903e('0x22')],'include':_0x4ef098[_0x903e('0x1f')]?_[_0x903e('0x20')](_0x4ef098[_0x903e('0x1f')],function(_0x16633c){return{'model':db[_0x16633c[_0x903e('0x21')]],'as':_0x16633c['as'],'attributes':_0x16633c[_0x903e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22d114){logger[_0x903e('0x10')](_0x903e('0x19'),_0x1903a3);logger['debug']('ShowSmsAccount',_0x1903a3,JSON[_0x903e('0x12')](_0x22d114));_0x117b16(_0x22d114);})[_0x903e('0x18')](function(_0x4676fd){logger[_0x903e('0x13')](_0x903e('0x19'),_0x4676fd[_0x903e('0x16')],_0x1903a3);_0x4109af(_0xf623df['error'](0x1f4,_0x4676fd['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8ec21a4..0f8e6c3 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 2621012..fefb6b5 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(_0x37df89,_0x2e44a1){var _0x324202=function(_0x160816){while(--_0x160816){_0x37df89['push'](_0x37df89['shift']());}};_0x324202(++_0x2e44a1);}(_0x55ca,0x126));var _0xa55c=function(_0x242152,_0x2f7b09){_0x242152=_0x242152-0x0;var _0x167a0d=_0x55ca[_0x242152];return _0x167a0d;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x213710,_0xb39fc6){var _0x5cd2c2=function(_0x979ffd){while(--_0x979ffd){_0x213710['push'](_0x213710['shift']());}};_0x5cd2c2(++_0xb39fc6);}(_0x55ca,0x126));var _0xa55c=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0x55ca[_0x3ca829];return _0x3b416b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6a77833..c026b88 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 _0xddb2=['exports','STRING','noop','TEXT','sequelize'];(function(_0x3703eb,_0x1c7cde){var _0x190bdc=function(_0x5246c8){while(--_0x5246c8){_0x3703eb['push'](_0x3703eb['shift']());}};_0x190bdc(++_0x1c7cde);}(_0xddb2,0x1d0));var _0x2ddb=function(_0x3a5a49,_0x55f984){_0x3a5a49=_0x3a5a49-0x0;var _0x4b9a0d=_0xddb2[_0x3a5a49];return _0x4b9a0d;};'use strict';var Sequelize=require(_0x2ddb('0x0'));module[_0x2ddb('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2ddb('0x2')],'allowNull':![],'defaultValue':_0x2ddb('0x3')},'appdata':{'type':Sequelize[_0x2ddb('0x4')]()},'description':{'type':Sequelize[_0x2ddb('0x2')]},'interval':{'type':Sequelize[_0x2ddb('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x86b8=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0xd6a8ee,_0x368f12){var _0x496ce3=function(_0x225da2){while(--_0x225da2){_0xd6a8ee['push'](_0xd6a8ee['shift']());}};_0x496ce3(++_0x368f12);}(_0x86b8,0x17e));var _0x886b=function(_0x42e885,_0x587b98){_0x42e885=_0x42e885-0x0;var _0x5ea739=_0x86b8[_0x42e885];return _0x5ea739;};'use strict';var Sequelize=require('sequelize');module[_0x886b('0x0')]={'priority':{'type':Sequelize[_0x886b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x886b('0x2')],'allowNull':![],'defaultValue':_0x886b('0x3')},'appdata':{'type':Sequelize[_0x886b('0x4')]()},'description':{'type':Sequelize[_0x886b('0x2')]},'interval':{'type':Sequelize[_0x886b('0x2')],'defaultValue':_0x886b('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 34a931e..0195701 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 _0xda45=['to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','map','SmsApplication','rawAttributes','type','query','intersection','model','fields','attributes','length','hasOwnProperty','sort','filters','pick','where','merge','filter','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox'];(function(_0xc1263e,_0x56d738){var _0x471f07=function(_0x2e6c55){while(--_0x2e6c55){_0xc1263e['push'](_0xc1263e['shift']());}};_0x471f07(++_0x56d738);}(_0xda45,0x1db));var _0x5da4=function(_0xff6876,_0x8c061d){_0xff6876=_0xff6876-0x0;var _0x5ca4fb=_0xda45[_0xff6876];return _0x5ca4fb;};'use strict';var emlformat=require(_0x5da4('0x0'));var rimraf=require(_0x5da4('0x1'));var zipdir=require(_0x5da4('0x2'));var jsonpatch=require(_0x5da4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5da4('0x4'));var Mustache=require(_0x5da4('0x5'));var util=require(_0x5da4('0x6'));var path=require('path');var sox=require(_0x5da4('0x7'));var csv=require(_0x5da4('0x8'));var ejs=require(_0x5da4('0x9'));var fs=require('fs');var fs_extra=require(_0x5da4('0xa'));var _=require(_0x5da4('0xb'));var squel=require(_0x5da4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5da4('0xd'));var toCsv=require(_0x5da4('0x8'));var querystring=require('querystring');var Papa=require(_0x5da4('0xe'));var Redis=require(_0x5da4('0xf'));var authService=require(_0x5da4('0x10'));var qs=require(_0x5da4('0x11'));var as=require(_0x5da4('0x12'));var hardwareService=require(_0x5da4('0x13'));var logger=require(_0x5da4('0x14'))('api');var utils=require(_0x5da4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5da4('0x16'));var db=require(_0x5da4('0x17'))['db'];function respondWithStatusCode(_0x327e90,_0x4e8285){_0x4e8285=_0x4e8285||0xcc;return function(_0x57ff6c){if(_0x57ff6c){return _0x327e90[_0x5da4('0x18')](_0x4e8285);}return _0x327e90[_0x5da4('0x19')](_0x4e8285)[_0x5da4('0x1a')]();};}function respondWithResult(_0x3f32b1,_0x4f2e9d){_0x4f2e9d=_0x4f2e9d||0xc8;return function(_0x13bcd3){if(_0x13bcd3){return _0x3f32b1[_0x5da4('0x19')](_0x4f2e9d)[_0x5da4('0x1b')](_0x13bcd3);}};}function respondWithFilteredResult(_0x4314a8,_0x27f1ca){return function(_0x5c475e){if(_0x5c475e){var _0x5b548f=typeof _0x27f1ca[_0x5da4('0x1c')]===_0x5da4('0x1d')&&typeof _0x27f1ca[_0x5da4('0x1e')]==='undefined';var _0x358077=_0x5c475e[_0x5da4('0x1f')];var _0x13e673=_0x5b548f?0x0:_0x27f1ca['offset'];var _0x36c2d1=_0x5b548f?_0x5c475e['count']:_0x27f1ca[_0x5da4('0x1c')]+_0x27f1ca[_0x5da4('0x1e')];var _0x47a254;if(_0x36c2d1>=_0x358077){_0x36c2d1=_0x358077;_0x47a254=0xc8;}else{_0x47a254=0xce;}_0x4314a8[_0x5da4('0x19')](_0x47a254);return _0x4314a8['set'](_0x5da4('0x20'),_0x13e673+'-'+_0x36c2d1+'/'+_0x358077)[_0x5da4('0x1b')](_0x5c475e);}return null;};}function patchUpdates(_0x2461db){return function(_0x3f27f6){try{jsonpatch[_0x5da4('0x21')](_0x3f27f6,_0x2461db,!![]);}catch(_0x1a1d06){return BPromise[_0x5da4('0x22')](_0x1a1d06);}return _0x3f27f6[_0x5da4('0x23')]();};}function saveUpdates(_0x15439a,_0x411913){return function(_0x5a0083){if(_0x5a0083){return _0x5a0083[_0x5da4('0x24')](_0x15439a)[_0x5da4('0x25')](function(_0x2389d0){return _0x2389d0;});}return null;};}function removeEntity(_0x2dc105,_0x2a701d){return function(_0x3a9d85){if(_0x3a9d85){return _0x3a9d85['destroy']()['then'](function(){_0x2dc105[_0x5da4('0x19')](0xcc)[_0x5da4('0x1a')]();});}};}function handleEntityNotFound(_0x319619,_0x2cd6d3){return function(_0x1644d0){if(!_0x1644d0){_0x319619[_0x5da4('0x18')](0x194);}return _0x1644d0;};}function handleError(_0x2bc008,_0x53a521){_0x53a521=_0x53a521||0x1f4;return function(_0x328bdf){logger[_0x5da4('0x26')](_0x328bdf[_0x5da4('0x27')]);if(_0x328bdf[_0x5da4('0x28')]){delete _0x328bdf['name'];}_0x2bc008[_0x5da4('0x19')](_0x53a521)['send'](_0x328bdf);};}exports['index']=function(_0xfee09a,_0x1e50db){var _0x185ecd={},_0x1cfb01={},_0x8b836c={'count':0x0,'rows':[]};var _0x8a9f3a=_[_0x5da4('0x29')](db[_0x5da4('0x2a')][_0x5da4('0x2b')],function(_0x22f969){return{'name':_0x22f969['fieldName'],'type':_0x22f969[_0x5da4('0x2c')]['key']};});_0x1cfb01['model']=_[_0x5da4('0x29')](_0x8a9f3a,'name');_0x1cfb01[_0x5da4('0x2d')]=_['keys'](_0xfee09a[_0x5da4('0x2d')]);_0x1cfb01['filters']=_[_0x5da4('0x2e')](_0x1cfb01['model'],_0x1cfb01['query']);_0x185ecd['attributes']=_[_0x5da4('0x2e')](_0x1cfb01[_0x5da4('0x2f')],qs['fields'](_0xfee09a[_0x5da4('0x2d')][_0x5da4('0x30')]));_0x185ecd[_0x5da4('0x31')]=_0x185ecd['attributes'][_0x5da4('0x32')]?_0x185ecd[_0x5da4('0x31')]:_0x1cfb01[_0x5da4('0x2f')];if(!_0xfee09a['query'][_0x5da4('0x33')]('nolimit')){_0x185ecd[_0x5da4('0x1e')]=qs[_0x5da4('0x1e')](_0xfee09a[_0x5da4('0x2d')][_0x5da4('0x1e')]);_0x185ecd['offset']=qs[_0x5da4('0x1c')](_0xfee09a['query']['offset']);}_0x185ecd['order']=qs['sort'](_0xfee09a[_0x5da4('0x2d')][_0x5da4('0x34')]);_0x185ecd['where']=qs[_0x5da4('0x35')](_[_0x5da4('0x36')](_0xfee09a[_0x5da4('0x2d')],_0x1cfb01[_0x5da4('0x35')]),_0x8a9f3a);if(_0xfee09a['query']['filter']){_0x185ecd[_0x5da4('0x37')]=_[_0x5da4('0x38')](_0x185ecd[_0x5da4('0x37')],{'$or':_['map'](_0x8a9f3a,function(_0xbff25d){if(_0xbff25d[_0x5da4('0x2c')]!=='VIRTUAL'){var _0x2efc11={};_0x2efc11[_0xbff25d[_0x5da4('0x28')]]={'$like':'%'+_0xfee09a[_0x5da4('0x2d')][_0x5da4('0x39')]+'%'};return _0x2efc11;}})});}_0x185ecd=_['merge']({},_0x185ecd,_0xfee09a['options']);var _0x2eda93={'where':_0x185ecd['where']};return db[_0x5da4('0x2a')][_0x5da4('0x1f')](_0x2eda93)[_0x5da4('0x25')](function(_0x11ca3a){_0x8b836c[_0x5da4('0x1f')]=_0x11ca3a;if(_0xfee09a[_0x5da4('0x2d')]['includeAll']){_0x185ecd[_0x5da4('0x3a')]=[{'all':!![]}];}return db[_0x5da4('0x2a')][_0x5da4('0x3b')](_0x185ecd);})[_0x5da4('0x25')](function(_0x4be38a){_0x8b836c['rows']=_0x4be38a;return _0x8b836c;})[_0x5da4('0x25')](respondWithFilteredResult(_0x1e50db,_0x185ecd))[_0x5da4('0x3c')](handleError(_0x1e50db,null));};exports[_0x5da4('0x3d')]=function(_0x4464e3,_0x18e7d6){var _0x4e2f37={'raw':!![],'where':{'id':_0x4464e3[_0x5da4('0x3e')]['id']}},_0x501b72={};_0x501b72[_0x5da4('0x2f')]=_[_0x5da4('0x3f')](db[_0x5da4('0x2a')][_0x5da4('0x2b')]);_0x501b72[_0x5da4('0x2d')]=_[_0x5da4('0x3f')](_0x4464e3[_0x5da4('0x2d')]);_0x501b72[_0x5da4('0x35')]=_[_0x5da4('0x2e')](_0x501b72[_0x5da4('0x2f')],_0x501b72['query']);_0x4e2f37[_0x5da4('0x31')]=_[_0x5da4('0x2e')](_0x501b72['model'],qs[_0x5da4('0x30')](_0x4464e3[_0x5da4('0x2d')][_0x5da4('0x30')]));_0x4e2f37[_0x5da4('0x31')]=_0x4e2f37['attributes'][_0x5da4('0x32')]?_0x4e2f37[_0x5da4('0x31')]:_0x501b72[_0x5da4('0x2f')];if(_0x4464e3[_0x5da4('0x2d')][_0x5da4('0x40')]){_0x4e2f37['include']=[{'all':!![]}];}_0x4e2f37=_[_0x5da4('0x38')]({},_0x4e2f37,_0x4464e3[_0x5da4('0x41')]);return db[_0x5da4('0x2a')][_0x5da4('0x42')](_0x4e2f37)['then'](handleEntityNotFound(_0x18e7d6,null))[_0x5da4('0x25')](respondWithResult(_0x18e7d6,null))[_0x5da4('0x3c')](handleError(_0x18e7d6,null));};exports[_0x5da4('0x43')]=function(_0x5ec64a,_0xc3f2ea){return db[_0x5da4('0x2a')][_0x5da4('0x43')](_0x5ec64a['body'],{})['then'](respondWithResult(_0xc3f2ea,0xc9))[_0x5da4('0x3c')](handleError(_0xc3f2ea,null));};exports['update']=function(_0x23414a,_0x464bd2){if(_0x23414a[_0x5da4('0x44')]['id']){delete _0x23414a['body']['id'];}return db[_0x5da4('0x2a')][_0x5da4('0x42')]({'where':{'id':_0x23414a[_0x5da4('0x3e')]['id']}})[_0x5da4('0x25')](handleEntityNotFound(_0x464bd2,null))[_0x5da4('0x25')](saveUpdates(_0x23414a[_0x5da4('0x44')],null))[_0x5da4('0x25')](respondWithResult(_0x464bd2,null))[_0x5da4('0x3c')](handleError(_0x464bd2,null));};exports['destroy']=function(_0x3e8742,_0x1ccf4b){return db[_0x5da4('0x2a')]['find']({'where':{'id':_0x3e8742[_0x5da4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1ccf4b,null))[_0x5da4('0x25')](removeEntity(_0x1ccf4b,null))[_0x5da4('0x3c')](handleError(_0x1ccf4b,null));}; \ No newline at end of file +var _0xe88a=['catch','show','keys','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe88a,0x1c4));var _0xae88=function(_0x105c4e,_0x29f9e5){_0x105c4e=_0x105c4e-0x0;var _0x41b33f=_0xe88a[_0x105c4e];return _0x41b33f;};'use strict';var emlformat=require(_0xae88('0x0'));var rimraf=require(_0xae88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae88('0x2'));var rp=require(_0xae88('0x3'));var moment=require(_0xae88('0x4'));var BPromise=require(_0xae88('0x5'));var Mustache=require(_0xae88('0x6'));var util=require(_0xae88('0x7'));var path=require(_0xae88('0x8'));var sox=require(_0xae88('0x9'));var csv=require(_0xae88('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae88('0xb'));var squel=require(_0xae88('0xc'));var crypto=require(_0xae88('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xae88('0xe'));var toCsv=require('to-csv');var querystring=require(_0xae88('0xf'));var Papa=require(_0xae88('0x10'));var Redis=require(_0xae88('0x11'));var authService=require(_0xae88('0x12'));var qs=require(_0xae88('0x13'));var as=require(_0xae88('0x14'));var hardwareService=require(_0xae88('0x15'));var logger=require('../../config/logger')(_0xae88('0x16'));var utils=require(_0xae88('0x17'));var config=require(_0xae88('0x18'));var licenseUtil=require(_0xae88('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26dddb,_0x317b2d){_0x317b2d=_0x317b2d||0xcc;return function(_0x51d1d6){if(_0x51d1d6){return _0x26dddb[_0xae88('0x1a')](_0x317b2d);}return _0x26dddb[_0xae88('0x1b')](_0x317b2d)['end']();};}function respondWithResult(_0x58122e,_0x5bb432){_0x5bb432=_0x5bb432||0xc8;return function(_0x436342){if(_0x436342){return _0x58122e[_0xae88('0x1b')](_0x5bb432)['json'](_0x436342);}};}function respondWithFilteredResult(_0x31179b,_0x18cf09){return function(_0x3fa1c7){if(_0x3fa1c7){var _0xfab4f2=typeof _0x18cf09['offset']===_0xae88('0x1c')&&typeof _0x18cf09[_0xae88('0x1d')]===_0xae88('0x1c');var _0x228243=_0x3fa1c7['count'];var _0xa82284=_0xfab4f2?0x0:_0x18cf09[_0xae88('0x1e')];var _0x57e7d3=_0xfab4f2?_0x3fa1c7[_0xae88('0x1f')]:_0x18cf09[_0xae88('0x1e')]+_0x18cf09[_0xae88('0x1d')];var _0x12fec8;if(_0x57e7d3>=_0x228243){_0x57e7d3=_0x228243;_0x12fec8=0xc8;}else{_0x12fec8=0xce;}_0x31179b[_0xae88('0x1b')](_0x12fec8);return _0x31179b['set'](_0xae88('0x20'),_0xa82284+'-'+_0x57e7d3+'/'+_0x228243)[_0xae88('0x21')](_0x3fa1c7);}return null;};}function patchUpdates(_0x6c81b){return function(_0x45d150){try{jsonpatch[_0xae88('0x22')](_0x45d150,_0x6c81b,!![]);}catch(_0x436cea){return BPromise[_0xae88('0x23')](_0x436cea);}return _0x45d150[_0xae88('0x24')]();};}function saveUpdates(_0x49cce2,_0x55c179){return function(_0x4c2760){if(_0x4c2760){return _0x4c2760[_0xae88('0x25')](_0x49cce2)[_0xae88('0x26')](function(_0x3ab0d5){return _0x3ab0d5;});}return null;};}function removeEntity(_0x58343b,_0x324d3c){return function(_0x1d2876){if(_0x1d2876){return _0x1d2876['destroy']()[_0xae88('0x26')](function(){_0x58343b[_0xae88('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20dc67,_0x59c38a){return function(_0x4f21e0){if(!_0x4f21e0){_0x20dc67[_0xae88('0x1a')](0x194);}return _0x4f21e0;};}function handleError(_0xc98324,_0x21705f){_0x21705f=_0x21705f||0x1f4;return function(_0x57316b){logger[_0xae88('0x27')](_0x57316b[_0xae88('0x28')]);if(_0x57316b[_0xae88('0x29')]){delete _0x57316b[_0xae88('0x29')];}_0xc98324[_0xae88('0x1b')](_0x21705f)[_0xae88('0x2a')](_0x57316b);};}exports[_0xae88('0x2b')]=function(_0x1e1e90,_0x2d73ec){var _0x1b2cd6={},_0x9b8b4a={},_0x56dc7c={'count':0x0,'rows':[]};var _0x5e3c71=_[_0xae88('0x2c')](db[_0xae88('0x2d')][_0xae88('0x2e')],function(_0x129373){return{'name':_0x129373['fieldName'],'type':_0x129373['type'][_0xae88('0x2f')]};});_0x9b8b4a[_0xae88('0x30')]=_['map'](_0x5e3c71,_0xae88('0x29'));_0x9b8b4a[_0xae88('0x31')]=_['keys'](_0x1e1e90[_0xae88('0x31')]);_0x9b8b4a[_0xae88('0x32')]=_['intersection'](_0x9b8b4a[_0xae88('0x30')],_0x9b8b4a[_0xae88('0x31')]);_0x1b2cd6[_0xae88('0x33')]=_[_0xae88('0x34')](_0x9b8b4a[_0xae88('0x30')],qs['fields'](_0x1e1e90[_0xae88('0x31')][_0xae88('0x35')]));_0x1b2cd6[_0xae88('0x33')]=_0x1b2cd6[_0xae88('0x33')]['length']?_0x1b2cd6[_0xae88('0x33')]:_0x9b8b4a[_0xae88('0x30')];if(!_0x1e1e90[_0xae88('0x31')][_0xae88('0x36')](_0xae88('0x37'))){_0x1b2cd6[_0xae88('0x1d')]=qs['limit'](_0x1e1e90[_0xae88('0x31')][_0xae88('0x1d')]);_0x1b2cd6[_0xae88('0x1e')]=qs[_0xae88('0x1e')](_0x1e1e90['query'][_0xae88('0x1e')]);}_0x1b2cd6[_0xae88('0x38')]=qs['sort'](_0x1e1e90[_0xae88('0x31')]['sort']);_0x1b2cd6[_0xae88('0x39')]=qs[_0xae88('0x32')](_['pick'](_0x1e1e90[_0xae88('0x31')],_0x9b8b4a[_0xae88('0x32')]),_0x5e3c71);if(_0x1e1e90[_0xae88('0x31')][_0xae88('0x3a')]){_0x1b2cd6[_0xae88('0x39')]=_[_0xae88('0x3b')](_0x1b2cd6[_0xae88('0x39')],{'$or':_['map'](_0x5e3c71,function(_0x447c7c){if(_0x447c7c[_0xae88('0x3c')]!==_0xae88('0x3d')){var _0x5babcb={};_0x5babcb[_0x447c7c[_0xae88('0x29')]]={'$like':'%'+_0x1e1e90[_0xae88('0x31')][_0xae88('0x3a')]+'%'};return _0x5babcb;}})});}_0x1b2cd6=_[_0xae88('0x3b')]({},_0x1b2cd6,_0x1e1e90['options']);var _0x413d8a={'where':_0x1b2cd6[_0xae88('0x39')]};return db[_0xae88('0x2d')][_0xae88('0x1f')](_0x413d8a)[_0xae88('0x26')](function(_0x5b3ad0){_0x56dc7c[_0xae88('0x1f')]=_0x5b3ad0;if(_0x1e1e90['query'][_0xae88('0x3e')]){_0x1b2cd6[_0xae88('0x3f')]=[{'all':!![]}];}return db[_0xae88('0x2d')][_0xae88('0x40')](_0x1b2cd6);})['then'](function(_0x763ee5){_0x56dc7c[_0xae88('0x41')]=_0x763ee5;return _0x56dc7c;})['then'](respondWithFilteredResult(_0x2d73ec,_0x1b2cd6))[_0xae88('0x42')](handleError(_0x2d73ec,null));};exports[_0xae88('0x43')]=function(_0x57f69d,_0x411e42){var _0x17361e={'raw':!![],'where':{'id':_0x57f69d['params']['id']}},_0x24c738={};_0x24c738[_0xae88('0x30')]=_[_0xae88('0x44')](db[_0xae88('0x2d')][_0xae88('0x2e')]);_0x24c738[_0xae88('0x31')]=_[_0xae88('0x44')](_0x57f69d[_0xae88('0x31')]);_0x24c738[_0xae88('0x32')]=_[_0xae88('0x34')](_0x24c738[_0xae88('0x30')],_0x24c738[_0xae88('0x31')]);_0x17361e[_0xae88('0x33')]=_[_0xae88('0x34')](_0x24c738['model'],qs['fields'](_0x57f69d[_0xae88('0x31')][_0xae88('0x35')]));_0x17361e[_0xae88('0x33')]=_0x17361e[_0xae88('0x33')]['length']?_0x17361e['attributes']:_0x24c738[_0xae88('0x30')];if(_0x57f69d[_0xae88('0x31')]['includeAll']){_0x17361e[_0xae88('0x3f')]=[{'all':!![]}];}_0x17361e=_[_0xae88('0x3b')]({},_0x17361e,_0x57f69d['options']);return db['SmsApplication'][_0xae88('0x45')](_0x17361e)[_0xae88('0x26')](handleEntityNotFound(_0x411e42,null))['then'](respondWithResult(_0x411e42,null))[_0xae88('0x42')](handleError(_0x411e42,null));};exports['create']=function(_0x5365c5,_0x48834a){return db['SmsApplication'][_0xae88('0x46')](_0x5365c5[_0xae88('0x47')],{})[_0xae88('0x26')](respondWithResult(_0x48834a,0xc9))['catch'](handleError(_0x48834a,null));};exports['update']=function(_0x5d1461,_0x3d74e2){if(_0x5d1461[_0xae88('0x47')]['id']){delete _0x5d1461['body']['id'];}return db['SmsApplication'][_0xae88('0x45')]({'where':{'id':_0x5d1461[_0xae88('0x48')]['id']}})[_0xae88('0x26')](handleEntityNotFound(_0x3d74e2,null))[_0xae88('0x26')](saveUpdates(_0x5d1461[_0xae88('0x47')],null))[_0xae88('0x26')](respondWithResult(_0x3d74e2,null))[_0xae88('0x42')](handleError(_0x3d74e2,null));};exports[_0xae88('0x49')]=function(_0x33d3ee,_0x28b788){return db['SmsApplication'][_0xae88('0x45')]({'where':{'id':_0x33d3ee[_0xae88('0x48')]['id']}})[_0xae88('0x26')](handleEntityNotFound(_0x28b788,null))[_0xae88('0x26')](removeEntity(_0x28b788,null))[_0xae88('0x42')](handleError(_0x28b788,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5f160a5..71b726c 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 _0x6b76=['bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x448565,_0x40c97c){var _0x40ac06=function(_0x1a2adc){while(--_0x1a2adc){_0x448565['push'](_0x448565['shift']());}};_0x40ac06(++_0x40c97c);}(_0x6b76,0xa5));var _0x66b7=function(_0x451069,_0x2ef01e){_0x451069=_0x451069-0x0;var _0x269aed=_0x6b76[_0x451069];return _0x269aed;};'use strict';var _=require(_0x66b7('0x0'));var util=require('util');var logger=require(_0x66b7('0x1'))(_0x66b7('0x2'));var moment=require(_0x66b7('0x3'));var BPromise=require(_0x66b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66b7('0x5'));var rimraf=require(_0x66b7('0x6'));var config=require(_0x66b7('0x7'));var attributes=require(_0x66b7('0x8'));module['exports']=function(_0x25d3d,_0x4acbf0){return _0x25d3d[_0x66b7('0x9')](_0x66b7('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66b7('0xb'),'collate':_0x66b7('0xc')});}; \ No newline at end of file +var _0x5577=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications'];(function(_0x5a15b1,_0x202388){var _0x4c2df7=function(_0x32f03d){while(--_0x32f03d){_0x5a15b1['push'](_0x5a15b1['shift']());}};_0x4c2df7(++_0x202388);}(_0x5577,0x1b4));var _0x7557=function(_0x45aac5,_0x5e79a7){_0x45aac5=_0x45aac5-0x0;var _0x5d5f25=_0x5577[_0x45aac5];return _0x5d5f25;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var logger=require(_0x7557('0x1'))(_0x7557('0x2'));var moment=require('moment');var BPromise=require(_0x7557('0x3'));var rp=require(_0x7557('0x4'));var fs=require('fs');var path=require(_0x7557('0x5'));var rimraf=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var attributes=require(_0x7557('0x8'));module['exports']=function(_0x7bb8c,_0x41a4a5){return _0x7bb8c[_0x7557('0x9')](_0x7557('0xa'),attributes,{'tableName':_0x7557('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7557('0xc'),'collate':_0x7557('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 87eb7b1..8022e2b 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 _0x60a5=['then','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x4e6913,_0xba423b){var _0x9ef2ad=function(_0x259f53){while(--_0x259f53){_0x4e6913['push'](_0x4e6913['shift']());}};_0x9ef2ad(++_0xba423b);}(_0x60a5,0x83));var _0x560a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x60a5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x560a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x560a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x560a('0x2'))['db'];var utils=require(_0x560a('0x3'));var logger=require(_0x560a('0x4'))('rpc');var config=require(_0x560a('0x5'));var jayson=require(_0x560a('0x6'));var client=jayson[_0x560a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fa23,_0x55eb57,_0x53a664){return new BPromise(function(_0x3ac39e,_0x1891ea){return client[_0x560a('0x8')](_0x52fa23,_0x53a664)[_0x560a('0x9')](function(_0x52c52e){logger['info'](_0x560a('0xa'),_0x55eb57,'request\x20sent');logger[_0x560a('0xb')](_0x560a('0xc'),_0x55eb57,'request\x20sent',JSON[_0x560a('0xd')](_0x52c52e));if(_0x52c52e[_0x560a('0xe')]){if(_0x52c52e[_0x560a('0xe')][_0x560a('0xf')]===0x1f4){logger[_0x560a('0xe')](_0x560a('0xa'),_0x55eb57,_0x52c52e[_0x560a('0xe')][_0x560a('0x10')]);return _0x1891ea(_0x52c52e[_0x560a('0xe')]['message']);}logger[_0x560a('0xe')](_0x560a('0xa'),_0x55eb57,_0x52c52e[_0x560a('0xe')]['message']);return _0x3ac39e(_0x52c52e[_0x560a('0xe')][_0x560a('0x10')]);}else{logger[_0x560a('0x11')](_0x560a('0xa'),_0x55eb57,'request\x20sent');_0x3ac39e(_0x52c52e[_0x560a('0x12')][_0x560a('0x10')]);}})[_0x560a('0x13')](function(_0x3f9f15){logger['error']('SmsApplication,\x20%s,\x20%s',_0x55eb57,_0x3f9f15);_0x1891ea(_0x3f9f15);});});} \ No newline at end of file +var _0x2581=['request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','SmsApplication,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x22ecf2,_0x286aee){var _0x4ed169=function(_0x583fc5){while(--_0x583fc5){_0x22ecf2['push'](_0x22ecf2['shift']());}};_0x4ed169(++_0x286aee);}(_0x2581,0xcb));var _0x1258=function(_0x3e8412,_0x36f9d2){_0x3e8412=_0x3e8412-0x0;var _0x2e222b=_0x2581[_0x3e8412];return _0x2e222b;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('SmsApplication,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 226aaac..16d04b5 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 _0x9ffd=['sms','smsinteraction:addtags','put','smsinteraction:update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x54a8d3,_0x12b8b7){var _0x5eec0e=function(_0xbc1ade){while(--_0xbc1ade){_0x54a8d3['push'](_0x54a8d3['shift']());}};_0x5eec0e(++_0x12b8b7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x74e30c,_0x5b61f6){_0x74e30c=_0x74e30c-0x0;var _0x19022d=_0x9ffd[_0x74e30c];return _0x19022d;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x12')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router['post']('/:id/messages',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x14')]);router[_0xd9ff('0x12')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),interaction['tracked'](_0xd9ff('0x16'),_0xd9ff('0x17')),controller['addTags']);router[_0xd9ff('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked']('sms',_0xd9ff('0x19')),controller['update']);router[_0xd9ff('0x1a')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),interaction[_0xd9ff('0x1b')](_0xd9ff('0x16'),_0xd9ff('0x1c')),controller[_0xd9ff('0x1d')]);router[_0xd9ff('0x1a')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x1e')]);module[_0xd9ff('0x1f')]=router; \ No newline at end of file +var _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0xaed8d4,_0x551b46){var _0xabb0d0=function(_0x4c0e48){while(--_0x4c0e48){_0xaed8d4['push'](_0xaed8d4['shift']());}};_0xabb0d0(++_0x551b46);}(_0xea28,0x13a));var _0x8ea2=function(_0x1013d8,_0x23cab2){_0x1013d8=_0x1013d8-0x0;var _0x3a2944=_0xea28[_0x1013d8];return _0x3a2944;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 7877dad..4039566 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 _0x3746=['INTEGER','sequelize','moment','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3746,0xa9));var _0x6374=function(_0x612521,_0x2e9771){_0x612521=_0x612521-0x0;var _0x24fe8d=_0x3746[_0x612521];return _0x24fe8d;};'use strict';var Sequelize=require(_0x6374('0x0'));var moment=require(_0x6374('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6374('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6374('0x3')]},'secondDisposition':{'type':Sequelize[_0x6374('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6374('0x3')]},'read1stAt':{'type':Sequelize[_0x6374('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6374('0x5')]('in',_0x6374('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6374('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x6374('0x5')]('in',_0x6374('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6374('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6374('0x7')]}}; \ No newline at end of file +var _0xc7da=['out','INTEGER','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0xc7da,0xf2));var _0xac7d=function(_0x3ed296,_0x2d0770){_0x3ed296=_0x3ed296-0x0;var _0x2abb65=_0xc7da[_0x3ed296];return _0x2abb65;};'use strict';var Sequelize=require(_0xac7d('0x0'));var moment=require(_0xac7d('0x1'));module[_0xac7d('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xac7d('0x3')]},'disposition':{'type':Sequelize[_0xac7d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xac7d('0x4')]},'note':{'type':Sequelize[_0xac7d('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xac7d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xac7d('0x5')]('in',_0xac7d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xac7d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xac7d('0x5')]('in',_0xac7d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xac7d('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index dab08d0..8e98cbb 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 _0x9cdb=['index','SmsInteraction','rawAttributes','type','key','getOptions','sms','query','user','show','params','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','find','catch','create','body','describe','addMessage','omit','ids','getMessages','SmsMessage','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','split','format','options','findAll','addTags','spread','Tag','color','emit','smsInteractionTags:save','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','SmsAccount','Account','Owner','get','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','map','direction','out','System','value','renderFile','views','transcript-','.pdf','download','log','rimraf','zip-dir','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','then','destroy','error','stack','name','send'];(function(_0x4e1584,_0x4e1b3f){var _0x1a37b8=function(_0x16cf1d){while(--_0x16cf1d){_0x4e1584['push'](_0x4e1584['shift']());}};_0x1a37b8(++_0x4e1b3f);}(_0x9cdb,0x142));var _0xb9cd=function(_0x490119,_0x491838){_0x490119=_0x490119-0x0;var _0xc46b8=_0x9cdb[_0x490119];return _0xc46b8;};'use strict';var rimraf=require(_0xb9cd('0x0'));var zipdir=require(_0xb9cd('0x1'));var moment=require('moment');var BPromise=require(_0xb9cd('0x2'));var util=require(_0xb9cd('0x3'));var path=require(_0xb9cd('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xb9cd('0x5'));var qs=require(_0xb9cd('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0xb9cd('0x7'))(_0xb9cd('0x8'));var config=require('../../config/environment');var db=require(_0xb9cd('0x9'))['db'];config['redis']=_['defaults'](config[_0xb9cd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9cd('0xb'))(new Redis(config[_0xb9cd('0xa')]));require(_0xb9cd('0xc'))[_0xb9cd('0xd')](socket);function respondWithStatusCode(_0xbddbf3,_0x54bd45){_0x54bd45=_0x54bd45||0xcc;return function(_0x3ca3c8){if(_0x3ca3c8){return _0xbddbf3[_0xb9cd('0xe')](_0x54bd45);}return _0xbddbf3[_0xb9cd('0xf')](_0x54bd45)[_0xb9cd('0x10')]();};}function respondWithResult(_0x1fa91c,_0x55e652){_0x55e652=_0x55e652||0xc8;return function(_0x3f6609){if(_0x3f6609){return _0x1fa91c[_0xb9cd('0xf')](_0x55e652)[_0xb9cd('0x11')](_0x3f6609);}};}function respondWithFilteredResult(_0x30259c,_0x4fab2d){return function(_0x247d1c){if(_0x247d1c){var _0x924e61=typeof _0x4fab2d[_0xb9cd('0x12')]===_0xb9cd('0x13')&&typeof _0x4fab2d['limit']===_0xb9cd('0x13');var _0x265c18=_0x247d1c[_0xb9cd('0x14')];var _0x4f1509=_0x924e61?0x0:_0x4fab2d['offset'];var _0x5d3250=_0x924e61?_0x247d1c[_0xb9cd('0x14')]:_0x4fab2d[_0xb9cd('0x12')]+_0x4fab2d['limit'];var _0x48d99b;if(_0x5d3250>=_0x265c18){_0x5d3250=_0x265c18;_0x48d99b=0xc8;}else{_0x48d99b=0xce;}_0x30259c[_0xb9cd('0xf')](_0x48d99b);return _0x30259c[_0xb9cd('0x15')](_0xb9cd('0x16'),_0x4f1509+'-'+_0x5d3250+'/'+_0x265c18)[_0xb9cd('0x11')](_0x247d1c);}return null;};}function saveUpdates(_0x3564f6){return function(_0x507104){if(_0x507104){return _0x507104['update'](_0x3564f6)[_0xb9cd('0x17')](function(_0x4511b7){return _0x4511b7;});}return null;};}function removeEntity(_0x27794c){return function(_0x527dd4){if(_0x527dd4){return _0x527dd4[_0xb9cd('0x18')]()[_0xb9cd('0x17')](function(){_0x27794c[_0xb9cd('0xf')](0xcc)[_0xb9cd('0x10')]();});}};}function handleEntityNotFound(_0x50055b){return function(_0xc2dc40){if(!_0xc2dc40){_0x50055b[_0xb9cd('0xe')](0x194);}return _0xc2dc40;};}function handleError(_0x58909,_0x10c3fb){_0x10c3fb=_0x10c3fb||0x1f4;return function(_0x37cbfc){logger[_0xb9cd('0x19')](_0x37cbfc[_0xb9cd('0x1a')]);if(_0x37cbfc[_0xb9cd('0x1b')]){delete _0x37cbfc['name'];}_0x58909['status'](_0x10c3fb)[_0xb9cd('0x1c')](_0x37cbfc);};}exports[_0xb9cd('0x1d')]=function(_0x45c4f2,_0x5f102c){var _0x15da18={};var _0x33c1a9=_['map'](db[_0xb9cd('0x1e')][_0xb9cd('0x1f')],function(_0x35e11a){return{'name':_0x35e11a['fieldName'],'type':_0x35e11a[_0xb9cd('0x20')][_0xb9cd('0x21')]};});_0x15da18=qs[_0xb9cd('0x22')](_0x33c1a9,_0x45c4f2);return interaction['findAll'](_0xb9cd('0x23'),_0x45c4f2[_0xb9cd('0x24')],_0x45c4f2[_0xb9cd('0x25')],_0x15da18,_0x33c1a9)[_0xb9cd('0x17')](respondWithFilteredResult(_0x5f102c,_0x15da18))['catch'](handleError(_0x5f102c,null));};exports[_0xb9cd('0x26')]=function(_0x354a20,_0x332a92){var _0x270eec={'raw':![],'where':{'id':_0x354a20[_0xb9cd('0x27')]['id']}},_0x4adb50={};_0x4adb50['model']=_['keys'](db['SmsInteraction'][_0xb9cd('0x1f')]);_0x4adb50['query']=_[_0xb9cd('0x28')](_0x354a20['query']);_0x4adb50[_0xb9cd('0x29')]=_[_0xb9cd('0x2a')](_0x4adb50[_0xb9cd('0x2b')],_0x4adb50['query']);_0x270eec[_0xb9cd('0x2c')]=_[_0xb9cd('0x2a')](_0x4adb50[_0xb9cd('0x2b')],qs[_0xb9cd('0x2d')](_0x354a20[_0xb9cd('0x24')][_0xb9cd('0x2d')]));_0x270eec[_0xb9cd('0x2c')]=_0x270eec[_0xb9cd('0x2c')]['length']?_0x270eec['attributes']:_0x4adb50[_0xb9cd('0x2b')];if(_0x354a20[_0xb9cd('0x24')][_0xb9cd('0x2e')]){_0x270eec[_0xb9cd('0x2f')]=[{'all':!![]}];}_0x270eec=_[_0xb9cd('0x30')]({},_0x270eec,_0x354a20['options']);return db['SmsInteraction'][_0xb9cd('0x31')](_0x270eec)['then'](handleEntityNotFound(_0x332a92,null))[_0xb9cd('0x17')](respondWithResult(_0x332a92,null))[_0xb9cd('0x32')](handleError(_0x332a92,null));};exports[_0xb9cd('0x33')]=function(_0x1bf2be,_0x3e21ae){return db['SmsInteraction'][_0xb9cd('0x33')](_0x1bf2be['body'],{})[_0xb9cd('0x17')](respondWithResult(_0x3e21ae,0xc9))['catch'](handleError(_0x3e21ae,null));};exports['update']=function(_0x4cbda5,_0x59f3e1){if(_0x4cbda5['body']['id']){delete _0x4cbda5['body']['id'];}return db[_0xb9cd('0x1e')]['find']({'where':{'id':_0x4cbda5[_0xb9cd('0x27')]['id']}})[_0xb9cd('0x17')](handleEntityNotFound(_0x59f3e1,null))[_0xb9cd('0x17')](saveUpdates(_0x4cbda5[_0xb9cd('0x34')],null))['then'](respondWithResult(_0x59f3e1,null))[_0xb9cd('0x32')](handleError(_0x59f3e1,null));};exports['destroy']=function(_0x3c64d9,_0x9129d7){return db[_0xb9cd('0x1e')]['find']({'where':{'id':_0x3c64d9['params']['id']}})[_0xb9cd('0x17')](handleEntityNotFound(_0x9129d7,null))[_0xb9cd('0x17')](removeEntity(_0x9129d7,null))[_0xb9cd('0x32')](handleError(_0x9129d7,null));};exports[_0xb9cd('0x35')]=function(_0x1d769c,_0x51c272){return db[_0xb9cd('0x1e')][_0xb9cd('0x35')]()['then'](respondWithResult(_0x51c272,null))['catch'](handleError(_0x51c272,null));};exports[_0xb9cd('0x36')]=function(_0x8a85fa,_0x261792){return db['SmsMessage'][_0xb9cd('0x31')]({'where':{'id':_0x8a85fa['params']['id']}})[_0xb9cd('0x17')](handleEntityNotFound(_0x261792,null))[_0xb9cd('0x17')](function(_0x50e3cc){if(_0x50e3cc){return _0x50e3cc[_0xb9cd('0x36')](_0x8a85fa[_0xb9cd('0x34')]['ids'],_[_0xb9cd('0x37')](_0x8a85fa[_0xb9cd('0x34')],[_0xb9cd('0x38'),'id'])||{});}})[_0xb9cd('0x17')](respondWithResult(_0x261792,null))[_0xb9cd('0x32')](handleError(_0x261792,null));};exports[_0xb9cd('0x39')]=function(_0x4226a4,_0x1e54c7){var _0x25f1f8={'raw':![],'where':{}};var _0x31cf66={};var _0x9004={'count':0x0,'rows':[]};return db[_0xb9cd('0x1e')]['findOne']({'where':{'id':_0x4226a4[_0xb9cd('0x27')]['id']}})[_0xb9cd('0x17')](handleEntityNotFound(_0x1e54c7,null))[_0xb9cd('0x17')](function(_0xd246c5){if(_0xd246c5){_0x31cf66[_0xb9cd('0x2b')]=_['keys'](db[_0xb9cd('0x3a')]['rawAttributes']);_0x31cf66['query']=_[_0xb9cd('0x28')](_0x4226a4['query']);_0x31cf66['filters']=_[_0xb9cd('0x2a')](_0x31cf66['model'],_0x31cf66[_0xb9cd('0x24')]);_0x25f1f8[_0xb9cd('0x2c')]=_[_0xb9cd('0x2a')](_0x31cf66[_0xb9cd('0x2b')],qs['fields'](_0x4226a4[_0xb9cd('0x24')][_0xb9cd('0x2d')]));_0x25f1f8['attributes']=_0x25f1f8[_0xb9cd('0x2c')][_0xb9cd('0x3b')]?_0x25f1f8[_0xb9cd('0x2c')]:_0x31cf66['model'];if(!_0x4226a4['query'][_0xb9cd('0x3c')](_0xb9cd('0x3d'))){_0x25f1f8[_0xb9cd('0x3e')]=qs[_0xb9cd('0x3e')](_0x4226a4[_0xb9cd('0x24')][_0xb9cd('0x3e')]);_0x25f1f8[_0xb9cd('0x12')]=qs[_0xb9cd('0x12')](_0x4226a4[_0xb9cd('0x24')][_0xb9cd('0x12')]);}_0x25f1f8['order']=qs[_0xb9cd('0x3f')](_0x4226a4[_0xb9cd('0x24')][_0xb9cd('0x3f')]);_0x25f1f8['where']=qs[_0xb9cd('0x29')](_[_0xb9cd('0x40')](_0x4226a4['query'],_0x31cf66[_0xb9cd('0x29')]));_0x25f1f8['where']['SmsInteractionId']=_0xd246c5['id'];if(_0x4226a4[_0xb9cd('0x24')][_0xb9cd('0x41')]){_0x25f1f8[_0xb9cd('0x42')]=_[_0xb9cd('0x30')](_0x25f1f8['where'],{'$or':_['map'](_0x25f1f8['attributes'],function(_0x2bf0bd){var _0x4c4561={};_0x4c4561[_0x2bf0bd]={'$like':'%'+_0x4226a4[_0xb9cd('0x24')][_0xb9cd('0x41')]+'%'};return _0x4c4561;})});}if(_0x4226a4[_0xb9cd('0x24')]['$gte']){var _0xb91a16=_0x4226a4['query']['$gte'][_0xb9cd('0x43')](',');var _0xa65cb1={};_0xa65cb1[_0xb91a16[0x0]]={'$gte':moment(_0xb91a16[0x1])[_0xb9cd('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x25f1f8[_0xb9cd('0x42')]=_['merge'](_0x25f1f8['where'],_0xa65cb1);}_0x25f1f8=_[_0xb9cd('0x30')]({},_0x25f1f8,_0x4226a4[_0xb9cd('0x45')]);return db[_0xb9cd('0x3a')][_0xb9cd('0x14')]({'where':_0x25f1f8['where']})[_0xb9cd('0x17')](function(_0x4783ef){_0x9004['count']=_0x4783ef;if(_0x4226a4[_0xb9cd('0x24')]['includeAll']){_0x25f1f8[_0xb9cd('0x2f')]=[{'all':!![]}];}return db[_0xb9cd('0x3a')][_0xb9cd('0x46')](_0x25f1f8);})[_0xb9cd('0x17')](function(_0x5096b7){_0x9004['rows']=_0x5096b7;return _0x9004;});}})['then'](respondWithFilteredResult(_0x1e54c7,_0x25f1f8))[_0xb9cd('0x32')](handleError(_0x1e54c7,null));};exports[_0xb9cd('0x47')]=function(_0x1c130d,_0x3e0f01){return db[_0xb9cd('0x1e')]['find']({'where':{'id':_0x1c130d[_0xb9cd('0x27')]['id']}})[_0xb9cd('0x17')](handleEntityNotFound(_0x3e0f01,null))['then'](function(_0x32434a){if(_0x32434a){return _0x32434a['setTags'](_0x1c130d[_0xb9cd('0x34')]['ids'],_[_0xb9cd('0x37')](_0x1c130d['body'],[_0xb9cd('0x38'),'id'])||{})[_0xb9cd('0x48')](function(){return db[_0xb9cd('0x49')][_0xb9cd('0x46')]({'attributes':['id',_0xb9cd('0x1b'),_0xb9cd('0x4a')],'where':{'id':_0x1c130d[_0xb9cd('0x34')][_0xb9cd('0x38')]}});})[_0xb9cd('0x17')](function(_0xcb25ec){socket[_0xb9cd('0x4b')](_0xb9cd('0x4c'),{'id':Number(_0x1c130d[_0xb9cd('0x27')]['id']),'tags':_0xcb25ec||[]});return{'id':Number(_0x1c130d['params']['id']),'tags':_0xcb25ec||[]};});}})['then'](respondWithResult(_0x3e0f01,null))[_0xb9cd('0x32')](handleError(_0x3e0f01,null));};exports['removeTags']=function(_0x5940b9,_0x44f4b4){return db[_0xb9cd('0x1e')][_0xb9cd('0x31')]({'where':{'id':_0x5940b9[_0xb9cd('0x27')]['id']}})[_0xb9cd('0x17')](handleEntityNotFound(_0x44f4b4,null))[_0xb9cd('0x17')](function(_0x55a975){if(_0x55a975){return _0x55a975['removeTags'](_0x5940b9[_0xb9cd('0x24')][_0xb9cd('0x38')]);}})[_0xb9cd('0x17')](respondWithStatusCode(_0x44f4b4,null))['catch'](handleError(_0x44f4b4,null));};exports['download']=function(_0x569926,_0x4e356c){var _0x1fb679=moment()[_0xb9cd('0x4d')]()['toString']();var _0x30b448=path[_0xb9cd('0x4e')](config[_0xb9cd('0x4f')],_0xb9cd('0x50'),_0xb9cd('0x51'),_0xb9cd('0x52'));var _0x2f3973=path[_0xb9cd('0x4e')](_0x30b448,_0x1fb679);var _0x36662e=util['format'](_0xb9cd('0x53'),_0x569926['params']['id'],_0x1fb679);var _0xe78d3f=path[_0xb9cd('0x4e')](_0x30b448,_0x36662e);var _0x23fba1=[];_0x23fba1[_0xb9cd('0x54')]({'model':db[_0xb9cd('0x55')],'as':'User','attributes':['id',_0xb9cd('0x56')],'raw':!![]});_0x23fba1[_0xb9cd('0x54')]({'model':db[_0xb9cd('0x57')],'as':_0xb9cd('0x58'),'attributes':['id',_0xb9cd('0x59'),_0xb9cd('0x5a')],'raw':!![]});var _0x326bff=[{'model':db['SmsMessage'],'as':_0xb9cd('0x5b'),'attributes':['id',_0xb9cd('0x34'),_0xb9cd('0x5c'),'direction',_0xb9cd('0x5d'),_0xb9cd('0x5e')],'include':_0x23fba1}];_0x326bff[_0xb9cd('0x54')]({'model':db[_0xb9cd('0x5f')],'as':_0xb9cd('0x60'),'attributes':['id',_0xb9cd('0x1b')]});_0x326bff[_0xb9cd('0x54')]({'model':db['User'],'as':_0xb9cd('0x61'),'attributes':['id',_0xb9cd('0x56')]});return db[_0xb9cd('0x1e')][_0xb9cd('0x31')]({'where':{'id':_0x569926[_0xb9cd('0x27')]['id']},'include':_0x326bff})[_0xb9cd('0x17')](handleEntityNotFound(_0x4e356c,null))[_0xb9cd('0x17')](function(_0x25c403){if(_0x25c403){var _0x465d43=_0x25c403[_0xb9cd('0x62')]({'plain':!![]});fs['mkdirSync'](_0x2f3973);var _0x296ec5={'channel':_0xb9cd('0x63'),'account':_0x465d43[_0xb9cd('0x60')][_0xb9cd('0x1b')],'agent':_0x465d43['Owner']?_0x465d43['Owner'][_0xb9cd('0x56')]:_0xb9cd('0x64'),'createdAt':moment(_0x465d43[_0xb9cd('0x5c')])[_0xb9cd('0x44')](_0xb9cd('0x65'))[_0xb9cd('0x66')](),'closedAt':_0x465d43[_0xb9cd('0x67')]?moment(_0x465d43[_0xb9cd('0x68')])[_0xb9cd('0x44')](_0xb9cd('0x65'))[_0xb9cd('0x66')]():'','disposition':_0x465d43[_0xb9cd('0x69')],'messages':_(_0x465d43['Messages'])['filter']({'secret':![]})[_0xb9cd('0x6a')](function(_0x3e3056){return{'date':moment(_0x3e3056[_0xb9cd('0x5c')])[_0xb9cd('0x44')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb9cd('0x66')](),'sender':_0x3e3056[_0xb9cd('0x6b')]===_0xb9cd('0x6c')?_0x3e3056['User']?_0x3e3056['User'][_0xb9cd('0x56')]:_0xb9cd('0x6d'):_0x3e3056[_0xb9cd('0x58')][_0xb9cd('0x59')]+(_0x3e3056[_0xb9cd('0x58')][_0xb9cd('0x5a')]?'\x20'+_0x3e3056[_0xb9cd('0x58')]['lastName']:''),'body':_0x3e3056[_0xb9cd('0x34')],'direction':_0x3e3056[_0xb9cd('0x6b')]===_0xb9cd('0x6c')?'A':'C','secret':_0x3e3056[_0xb9cd('0x5d')],'read':_0x3e3056[_0xb9cd('0x5e')]};})[_0xb9cd('0x6e')]()};return ejs[_0xb9cd('0x6f')](path[_0xb9cd('0x4e')](config['root'],_0xb9cd('0x50'),_0xb9cd('0x70'),'downloadInteraction.ejs'),{'interaction':_0x296ec5})[_0xb9cd('0x17')](function(_0x489e91){var _0x480a0a=path['join'](_0x2f3973,_0xb9cd('0x71')+_0x465d43['id']+'-'+_0x1fb679+_0xb9cd('0x72'));var _0x26bdc4={'path':_0x480a0a,'channel':_0xb9cd('0x63'),'interactionId':_0x465d43['id']};return pdf['createPdfFromHTML'](_0x489e91,_0x26bdc4);})[_0xb9cd('0x17')](function(){return new BPromise(function(_0x47d89c,_0x1db0e1){zipdir(_0x2f3973,{'saveTo':_0xe78d3f},function(_0x5ed5b3,_0x3190c8){if(_0x5ed5b3)return _0x1db0e1(_0x5ed5b3);return _0x47d89c(_0x3190c8);});})[_0xb9cd('0x17')](function(){return new BPromise(function(_0x48f508,_0x5152a7){rimraf(_0x2f3973,function(_0x47b672){if(_0x47b672)_0x5152a7(_0x47b672);return _0x48f508();});});})[_0xb9cd('0x17')](function(){return _0x4e356c[_0xb9cd('0x73')](_0xe78d3f,_0x36662e,function(_0x3047f3){if(_0x3047f3){console[_0xb9cd('0x74')]('err',_0x3047f3);}else{fs['unlinkSync'](_0xe78d3f);}});});});}else{return _0x4e356c[_0xb9cd('0xe')](0xc8);}})[_0xb9cd('0x32')](handleError(_0x4e356c,null));}; \ No newline at end of file +var _0x8d1f=['Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','createdAt','out','firstName','value','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','key','getOptions','findAll','sms','query','user','catch','params','model','keys','filters','attributes','length','merge','find','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','intersection','fields','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','split','format','includeAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Messages','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync'];(function(_0x53fb63,_0x2497b0){var _0x3fd488=function(_0x41848a){while(--_0x41848a){_0x53fb63['push'](_0x53fb63['shift']());}};_0x3fd488(++_0x2497b0);}(_0x8d1f,0x1d0));var _0xf8d1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8d1f[_0x178e48];return _0x440d7e;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xf8d1('0x0'));var util=require(_0xf8d1('0x1'));var path=require(_0xf8d1('0x2'));var ejs=require(_0xf8d1('0x3'));var fs=require('fs');var _=require(_0xf8d1('0x4'));var Redis=require(_0xf8d1('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xf8d1('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf8d1('0x7'));var config=require(_0xf8d1('0x8'));var db=require(_0xf8d1('0x9'))['db'];config[_0xf8d1('0xa')]=_['defaults'](config[_0xf8d1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8d1('0xb'))(new Redis(config['redis']));require(_0xf8d1('0xc'))[_0xf8d1('0xd')](socket);function respondWithStatusCode(_0xccbab8,_0x39c765){_0x39c765=_0x39c765||0xcc;return function(_0x4ee830){if(_0x4ee830){return _0xccbab8[_0xf8d1('0xe')](_0x39c765);}return _0xccbab8[_0xf8d1('0xf')](_0x39c765)[_0xf8d1('0x10')]();};}function respondWithResult(_0x445d20,_0x195fab){_0x195fab=_0x195fab||0xc8;return function(_0x20d890){if(_0x20d890){return _0x445d20[_0xf8d1('0xf')](_0x195fab)['json'](_0x20d890);}};}function respondWithFilteredResult(_0x181f53,_0x5a0580){return function(_0x160340){if(_0x160340){var _0x502bb4=typeof _0x5a0580['offset']==='undefined'&&typeof _0x5a0580['limit']==='undefined';var _0x5b36bf=_0x160340[_0xf8d1('0x11')];var _0x469204=_0x502bb4?0x0:_0x5a0580[_0xf8d1('0x12')];var _0x10ab19=_0x502bb4?_0x160340[_0xf8d1('0x11')]:_0x5a0580[_0xf8d1('0x12')]+_0x5a0580[_0xf8d1('0x13')];var _0x51922b;if(_0x10ab19>=_0x5b36bf){_0x10ab19=_0x5b36bf;_0x51922b=0xc8;}else{_0x51922b=0xce;}_0x181f53[_0xf8d1('0xf')](_0x51922b);return _0x181f53['set'](_0xf8d1('0x14'),_0x469204+'-'+_0x10ab19+'/'+_0x5b36bf)['json'](_0x160340);}return null;};}function saveUpdates(_0x4c5b6e){return function(_0x451521){if(_0x451521){return _0x451521[_0xf8d1('0x15')](_0x4c5b6e)[_0xf8d1('0x16')](function(_0x4de1bc){return _0x4de1bc;});}return null;};}function removeEntity(_0x29359e){return function(_0x15f772){if(_0x15f772){return _0x15f772['destroy']()[_0xf8d1('0x16')](function(){_0x29359e[_0xf8d1('0xf')](0xcc)[_0xf8d1('0x10')]();});}};}function handleEntityNotFound(_0x183a40){return function(_0x642f08){if(!_0x642f08){_0x183a40[_0xf8d1('0xe')](0x194);}return _0x642f08;};}function handleError(_0x450087,_0x504278){_0x504278=_0x504278||0x1f4;return function(_0x17596a){logger['error'](_0x17596a[_0xf8d1('0x17')]);if(_0x17596a[_0xf8d1('0x18')]){delete _0x17596a[_0xf8d1('0x18')];}_0x450087['status'](_0x504278)[_0xf8d1('0x19')](_0x17596a);};}exports[_0xf8d1('0x1a')]=function(_0x2659b2,_0x5827f9){var _0x27950a={};var _0x48f185=_[_0xf8d1('0x1b')](db[_0xf8d1('0x1c')][_0xf8d1('0x1d')],function(_0x56f1ad){return{'name':_0x56f1ad['fieldName'],'type':_0x56f1ad['type'][_0xf8d1('0x1e')]};});_0x27950a=qs[_0xf8d1('0x1f')](_0x48f185,_0x2659b2);return interaction[_0xf8d1('0x20')](_0xf8d1('0x21'),_0x2659b2[_0xf8d1('0x22')],_0x2659b2[_0xf8d1('0x23')],_0x27950a,_0x48f185)[_0xf8d1('0x16')](respondWithFilteredResult(_0x5827f9,_0x27950a))[_0xf8d1('0x24')](handleError(_0x5827f9,null));};exports['show']=function(_0x3de57d,_0x3dce64){var _0x5cf4eb={'raw':![],'where':{'id':_0x3de57d[_0xf8d1('0x25')]['id']}},_0x7a1058={};_0x7a1058[_0xf8d1('0x26')]=_[_0xf8d1('0x27')](db[_0xf8d1('0x1c')][_0xf8d1('0x1d')]);_0x7a1058['query']=_[_0xf8d1('0x27')](_0x3de57d[_0xf8d1('0x22')]);_0x7a1058[_0xf8d1('0x28')]=_['intersection'](_0x7a1058[_0xf8d1('0x26')],_0x7a1058[_0xf8d1('0x22')]);_0x5cf4eb[_0xf8d1('0x29')]=_['intersection'](_0x7a1058[_0xf8d1('0x26')],qs['fields'](_0x3de57d[_0xf8d1('0x22')]['fields']));_0x5cf4eb[_0xf8d1('0x29')]=_0x5cf4eb[_0xf8d1('0x29')][_0xf8d1('0x2a')]?_0x5cf4eb['attributes']:_0x7a1058[_0xf8d1('0x26')];if(_0x3de57d[_0xf8d1('0x22')]['includeAll']){_0x5cf4eb['include']=[{'all':!![]}];}_0x5cf4eb=_[_0xf8d1('0x2b')]({},_0x5cf4eb,_0x3de57d['options']);return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')](_0x5cf4eb)[_0xf8d1('0x16')](handleEntityNotFound(_0x3dce64,null))[_0xf8d1('0x16')](respondWithResult(_0x3dce64,null))[_0xf8d1('0x24')](handleError(_0x3dce64,null));};exports[_0xf8d1('0x2d')]=function(_0x2dda99,_0x2a1617){return db[_0xf8d1('0x1c')][_0xf8d1('0x2d')](_0x2dda99[_0xf8d1('0x2e')],{})[_0xf8d1('0x16')](respondWithResult(_0x2a1617,0xc9))[_0xf8d1('0x24')](handleError(_0x2a1617,null));};exports[_0xf8d1('0x15')]=function(_0x5f330b,_0x4941e9){if(_0x5f330b[_0xf8d1('0x2e')]['id']){delete _0x5f330b['body']['id'];}return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x5f330b[_0xf8d1('0x25')]['id']}})['then'](handleEntityNotFound(_0x4941e9,null))[_0xf8d1('0x16')](saveUpdates(_0x5f330b[_0xf8d1('0x2e')],null))[_0xf8d1('0x16')](respondWithResult(_0x4941e9,null))[_0xf8d1('0x24')](handleError(_0x4941e9,null));};exports['destroy']=function(_0x575ab7,_0x5728c7){return db['SmsInteraction'][_0xf8d1('0x2c')]({'where':{'id':_0x575ab7[_0xf8d1('0x25')]['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x5728c7,null))[_0xf8d1('0x16')](removeEntity(_0x5728c7,null))['catch'](handleError(_0x5728c7,null));};exports[_0xf8d1('0x2f')]=function(_0x5ee993,_0x219b7c){return db[_0xf8d1('0x1c')][_0xf8d1('0x2f')]()[_0xf8d1('0x16')](respondWithResult(_0x219b7c,null))[_0xf8d1('0x24')](handleError(_0x219b7c,null));};exports[_0xf8d1('0x30')]=function(_0x34ad30,_0x270ca4){return db[_0xf8d1('0x31')][_0xf8d1('0x2c')]({'where':{'id':_0x34ad30[_0xf8d1('0x25')]['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x270ca4,null))[_0xf8d1('0x16')](function(_0x143fd5){if(_0x143fd5){return _0x143fd5[_0xf8d1('0x30')](_0x34ad30['body']['ids'],_[_0xf8d1('0x32')](_0x34ad30[_0xf8d1('0x2e')],[_0xf8d1('0x33'),'id'])||{});}})[_0xf8d1('0x16')](respondWithResult(_0x270ca4,null))['catch'](handleError(_0x270ca4,null));};exports[_0xf8d1('0x34')]=function(_0x1c6388,_0x563485){var _0x1a1a41={'raw':![],'where':{}};var _0xf0592c={};var _0x1fc74c={'count':0x0,'rows':[]};return db[_0xf8d1('0x1c')][_0xf8d1('0x35')]({'where':{'id':_0x1c6388[_0xf8d1('0x25')]['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x563485,null))['then'](function(_0x3c668f){if(_0x3c668f){_0xf0592c[_0xf8d1('0x26')]=_['keys'](db[_0xf8d1('0x31')]['rawAttributes']);_0xf0592c[_0xf8d1('0x22')]=_[_0xf8d1('0x27')](_0x1c6388['query']);_0xf0592c[_0xf8d1('0x28')]=_['intersection'](_0xf0592c[_0xf8d1('0x26')],_0xf0592c[_0xf8d1('0x22')]);_0x1a1a41[_0xf8d1('0x29')]=_[_0xf8d1('0x36')](_0xf0592c[_0xf8d1('0x26')],qs['fields'](_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x37')]));_0x1a1a41['attributes']=_0x1a1a41['attributes'][_0xf8d1('0x2a')]?_0x1a1a41[_0xf8d1('0x29')]:_0xf0592c[_0xf8d1('0x26')];if(!_0x1c6388['query'][_0xf8d1('0x38')](_0xf8d1('0x39'))){_0x1a1a41[_0xf8d1('0x13')]=qs[_0xf8d1('0x13')](_0x1c6388['query'][_0xf8d1('0x13')]);_0x1a1a41[_0xf8d1('0x12')]=qs[_0xf8d1('0x12')](_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x12')]);}_0x1a1a41['order']=qs[_0xf8d1('0x3a')](_0x1c6388['query'][_0xf8d1('0x3a')]);_0x1a1a41['where']=qs['filters'](_['pick'](_0x1c6388['query'],_0xf0592c[_0xf8d1('0x28')]));_0x1a1a41[_0xf8d1('0x3b')][_0xf8d1('0x3c')]=_0x3c668f['id'];if(_0x1c6388[_0xf8d1('0x22')]['filter']){_0x1a1a41['where']=_['merge'](_0x1a1a41[_0xf8d1('0x3b')],{'$or':_['map'](_0x1a1a41[_0xf8d1('0x29')],function(_0x5906e2){var _0x2ce356={};_0x2ce356[_0x5906e2]={'$like':'%'+_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x3d')]+'%'};return _0x2ce356;})});}if(_0x1c6388['query']['$gte']){var _0x4a066a=_0x1c6388[_0xf8d1('0x22')]['$gte'][_0xf8d1('0x3e')](',');var _0x4cf194={};_0x4cf194[_0x4a066a[0x0]]={'$gte':moment(_0x4a066a[0x1])[_0xf8d1('0x3f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a1a41[_0xf8d1('0x3b')]=_[_0xf8d1('0x2b')](_0x1a1a41[_0xf8d1('0x3b')],_0x4cf194);}_0x1a1a41=_[_0xf8d1('0x2b')]({},_0x1a1a41,_0x1c6388['options']);return db[_0xf8d1('0x31')]['count']({'where':_0x1a1a41['where']})[_0xf8d1('0x16')](function(_0xe058ee){_0x1fc74c[_0xf8d1('0x11')]=_0xe058ee;if(_0x1c6388[_0xf8d1('0x22')][_0xf8d1('0x40')]){_0x1a1a41['include']=[{'all':!![]}];}return db['SmsMessage'][_0xf8d1('0x20')](_0x1a1a41);})['then'](function(_0x4c2932){_0x1fc74c[_0xf8d1('0x41')]=_0x4c2932;return _0x1fc74c;});}})['then'](respondWithFilteredResult(_0x563485,_0x1a1a41))['catch'](handleError(_0x563485,null));};exports[_0xf8d1('0x42')]=function(_0x53aacd,_0x50b7da){return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x53aacd['params']['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x50b7da,null))[_0xf8d1('0x16')](function(_0x3ae8f8){if(_0x3ae8f8){return _0x3ae8f8[_0xf8d1('0x43')](_0x53aacd[_0xf8d1('0x2e')][_0xf8d1('0x33')],_['omit'](_0x53aacd['body'],['ids','id'])||{})[_0xf8d1('0x44')](function(){return db[_0xf8d1('0x45')][_0xf8d1('0x20')]({'attributes':['id',_0xf8d1('0x18'),_0xf8d1('0x46')],'where':{'id':_0x53aacd[_0xf8d1('0x2e')]['ids']}});})[_0xf8d1('0x16')](function(_0x2b4f4b){socket[_0xf8d1('0x47')](_0xf8d1('0x48'),{'id':Number(_0x53aacd[_0xf8d1('0x25')]['id']),'tags':_0x2b4f4b||[]});return{'id':Number(_0x53aacd['params']['id']),'tags':_0x2b4f4b||[]};});}})['then'](respondWithResult(_0x50b7da,null))[_0xf8d1('0x24')](handleError(_0x50b7da,null));};exports['removeTags']=function(_0x44c109,_0x1e131f){return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x44c109['params']['id']}})[_0xf8d1('0x16')](handleEntityNotFound(_0x1e131f,null))[_0xf8d1('0x16')](function(_0x5dcb03){if(_0x5dcb03){return _0x5dcb03[_0xf8d1('0x49')](_0x44c109[_0xf8d1('0x22')][_0xf8d1('0x33')]);}})[_0xf8d1('0x16')](respondWithStatusCode(_0x1e131f,null))[_0xf8d1('0x24')](handleError(_0x1e131f,null));};exports[_0xf8d1('0x4a')]=function(_0x392d88,_0x5e5726){var _0x35a28f=moment()[_0xf8d1('0x4b')]()[_0xf8d1('0x4c')]();var _0x3e6f95=path[_0xf8d1('0x4d')](config['root'],_0xf8d1('0x4e'),_0xf8d1('0x4f'),'tmp');var _0x33f69b=path[_0xf8d1('0x4d')](_0x3e6f95,_0x35a28f);var _0x1d0e37=util[_0xf8d1('0x3f')](_0xf8d1('0x50'),_0x392d88['params']['id'],_0x35a28f);var _0x307415=path[_0xf8d1('0x4d')](_0x3e6f95,_0x1d0e37);var _0x46f7fd=[];_0x46f7fd[_0xf8d1('0x51')]({'model':db['User'],'as':_0xf8d1('0x52'),'attributes':['id',_0xf8d1('0x53')],'raw':!![]});_0x46f7fd[_0xf8d1('0x51')]({'model':db[_0xf8d1('0x54')],'as':_0xf8d1('0x55'),'attributes':['id','firstName',_0xf8d1('0x56')],'raw':!![]});var _0x50bf52=[{'model':db['SmsMessage'],'as':_0xf8d1('0x57'),'attributes':['id',_0xf8d1('0x2e'),'createdAt',_0xf8d1('0x58'),_0xf8d1('0x59'),_0xf8d1('0x5a')],'include':_0x46f7fd}];_0x50bf52['push']({'model':db[_0xf8d1('0x5b')],'as':_0xf8d1('0x5c'),'attributes':['id','name']});_0x50bf52[_0xf8d1('0x51')]({'model':db[_0xf8d1('0x52')],'as':_0xf8d1('0x5d'),'attributes':['id',_0xf8d1('0x53')]});return db[_0xf8d1('0x1c')][_0xf8d1('0x2c')]({'where':{'id':_0x392d88['params']['id']},'include':_0x50bf52})[_0xf8d1('0x16')](handleEntityNotFound(_0x5e5726,null))[_0xf8d1('0x16')](function(_0x2891e3){if(_0x2891e3){var _0x2ceca9=_0x2891e3[_0xf8d1('0x5e')]({'plain':!![]});fs[_0xf8d1('0x5f')](_0x33f69b);var _0x10ef19={'channel':_0xf8d1('0x60'),'account':_0x2ceca9[_0xf8d1('0x5c')][_0xf8d1('0x18')],'agent':_0x2ceca9[_0xf8d1('0x5d')]?_0x2ceca9[_0xf8d1('0x5d')][_0xf8d1('0x53')]:_0xf8d1('0x61'),'createdAt':moment(_0x2ceca9['createdAt'])[_0xf8d1('0x3f')](_0xf8d1('0x62'))[_0xf8d1('0x4c')](),'closedAt':_0x2ceca9[_0xf8d1('0x63')]?moment(_0x2ceca9['closedAt'])['format'](_0xf8d1('0x62'))[_0xf8d1('0x4c')]():'','disposition':_0x2ceca9['disposition'],'messages':_(_0x2ceca9[_0xf8d1('0x57')])[_0xf8d1('0x3d')]({'secret':![]})[_0xf8d1('0x1b')](function(_0x3b3fb6){return{'date':moment(_0x3b3fb6[_0xf8d1('0x64')])['format'](_0xf8d1('0x62'))['toString'](),'sender':_0x3b3fb6[_0xf8d1('0x58')]===_0xf8d1('0x65')?_0x3b3fb6['User']?_0x3b3fb6[_0xf8d1('0x52')][_0xf8d1('0x53')]:'System':_0x3b3fb6[_0xf8d1('0x55')][_0xf8d1('0x66')]+(_0x3b3fb6[_0xf8d1('0x55')][_0xf8d1('0x56')]?'\x20'+_0x3b3fb6[_0xf8d1('0x55')][_0xf8d1('0x56')]:''),'body':_0x3b3fb6['body'],'direction':_0x3b3fb6[_0xf8d1('0x58')]===_0xf8d1('0x65')?'A':'C','secret':_0x3b3fb6['secret'],'read':_0x3b3fb6[_0xf8d1('0x5a')]};})[_0xf8d1('0x67')]()};return ejs['renderFile'](path[_0xf8d1('0x4d')](config[_0xf8d1('0x68')],_0xf8d1('0x4e'),_0xf8d1('0x69'),_0xf8d1('0x6a')),{'interaction':_0x10ef19})[_0xf8d1('0x16')](function(_0x2e0418){var _0x5f41ac=path[_0xf8d1('0x4d')](_0x33f69b,_0xf8d1('0x6b')+_0x2ceca9['id']+'-'+_0x35a28f+_0xf8d1('0x6c'));var _0x166cd2={'path':_0x5f41ac,'channel':_0xf8d1('0x60'),'interactionId':_0x2ceca9['id']};return pdf[_0xf8d1('0x6d')](_0x2e0418,_0x166cd2);})[_0xf8d1('0x16')](function(){return new BPromise(function(_0xb711c7,_0x14632b){zipdir(_0x33f69b,{'saveTo':_0x307415},function(_0x2f0ab3,_0x4c1146){if(_0x2f0ab3)return _0x14632b(_0x2f0ab3);return _0xb711c7(_0x4c1146);});})[_0xf8d1('0x16')](function(){return new BPromise(function(_0x450c86,_0x556263){rimraf(_0x33f69b,function(_0x3aed48){if(_0x3aed48)_0x556263(_0x3aed48);return _0x450c86();});});})[_0xf8d1('0x16')](function(){return _0x5e5726[_0xf8d1('0x4a')](_0x307415,_0x1d0e37,function(_0x27084b){if(_0x27084b){console[_0xf8d1('0x6e')](_0xf8d1('0x6f'),_0x27084b);}else{fs['unlinkSync'](_0x307415);}});});});}else{return _0x5e5726[_0xf8d1('0xe')](0xc8);}})[_0xf8d1('0x24')](handleError(_0x5e5726,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d0bfd48..e42fc8d 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 _0x8603=['update','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','hasOwnProperty','hook','../../mysqldb','SmsInteraction','save'];(function(_0x559a7b,_0x467226){var _0x478601=function(_0x24e81){while(--_0x24e81){_0x559a7b['push'](_0x559a7b['shift']());}};_0x478601(++_0x467226);}(_0x8603,0x190));var _0x3860=function(_0x311e39,_0x21f955){_0x311e39=_0x311e39-0x0;var _0x40687b=_0x8603[_0x311e39];return _0x40687b;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x3860('0x0'))['db'][_0x3860('0x1')];var SmsMessage=require(_0x3860('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3860('0x2'),'afterUpdate':_0x3860('0x3'),'afterDestroy':_0x3860('0x4')};function emitEvent(_0x490262){return function(_0x2fc97a,_0x56f8c5,_0xb0fc24){_0x2fc97a[_0x3860('0x5')]({'attributes':['id'],'raw':!![]})[_0x3860('0x6')](function(_0xd3ce26){_0x2fc97a[_0x3860('0x7')]('Users',_0xd3ce26['map'](function(_0x5b1ac8){return{'id':_0x5b1ac8['id']};}));return SmsMessage[_0x3860('0x8')]({'where':{'SmsInteractionId':_0x2fc97a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3860('0x6')](function(_0x52c277){_0x2fc97a[_0x3860('0x7')](_0x3860('0x9'),_0x52c277['length']);SmsInteractionEvents[_0x3860('0xa')](_0x490262+':'+_0x2fc97a['id'],_0x2fc97a);SmsInteractionEvents[_0x3860('0xa')](_0x490262,_0x2fc97a);_0xb0fc24(null);})['catch'](_0xb0fc24(null));};}for(var e in events){if(events[_0x3860('0xb')](e)){var event=events[e];SmsInteraction[_0x3860('0xc')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x63a5=['hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x279e9c,_0x45dfe4){var _0x2c6e72=function(_0xe05702){while(--_0xe05702){_0x279e9c['push'](_0x279e9c['shift']());}};_0x2c6e72(++_0x45dfe4);}(_0x63a5,0x18e));var _0x563a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x63a5[_0x82129b];return _0x2ae5dc;};'use strict';var EventEmitter=require(_0x563a('0x0'));var SmsInteraction=require(_0x563a('0x1'))['db'][_0x563a('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x563a('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563a('0x4'),'afterUpdate':_0x563a('0x5'),'afterDestroy':_0x563a('0x6')};function emitEvent(_0x37e617){return function(_0x5c2a8d,_0x4cc9e5,_0x1fdcb0){_0x5c2a8d['getUsers']({'attributes':['id'],'raw':!![]})[_0x563a('0x7')](function(_0x4f89b4){_0x5c2a8d['setDataValue']('Users',_0x4f89b4[_0x563a('0x8')](function(_0x32bf51){return{'id':_0x32bf51['id']};}));return SmsMessage[_0x563a('0x9')]({'where':{'SmsInteractionId':_0x5c2a8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x563a('0x7')](function(_0x255922){_0x5c2a8d[_0x563a('0xa')](_0x563a('0xb'),_0x255922[_0x563a('0xc')]);SmsInteractionEvents[_0x563a('0xd')](_0x37e617+':'+_0x5c2a8d['id'],_0x5c2a8d);SmsInteractionEvents[_0x563a('0xd')](_0x37e617,_0x5c2a8d);_0x1fdcb0(null);})[_0x563a('0xe')](_0x1fdcb0(null));};}for(var e in events){if(events[_0x563a('0xf')](e)){var event=events[e];SmsInteraction[_0x563a('0x10')](e,emitEvent(event));}}module[_0x563a('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 851794d..f0af40b 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 _0x2af8=['request-promise','define','SmsInteraction','sms_interactions','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird'];(function(_0x1f7a11,_0x46c2bf){var _0x2d5f62=function(_0x125899){while(--_0x125899){_0x1f7a11['push'](_0x1f7a11['shift']());}};_0x2d5f62(++_0x46c2bf);}(_0x2af8,0x192));var _0x82af=function(_0x6a4474,_0x5b68e1){_0x6a4474=_0x6a4474-0x0;var _0x2606f7=_0x2af8[_0x6a4474];return _0x2606f7;};'use strict';var _=require('lodash');var util=require(_0x82af('0x0'));var logger=require(_0x82af('0x1'))(_0x82af('0x2'));var moment=require(_0x82af('0x3'));var BPromise=require(_0x82af('0x4'));var rp=require(_0x82af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3f4f10,_0x4692b3){return _0x3f4f10[_0x82af('0x6')](_0x82af('0x7'),attributes,{'tableName':_0x82af('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd1166a,_0x256465,_0x80e784){if(_0xd1166a['changed']('closed')){_0xd1166a['closedAt']=moment()[_0x82af('0x9')](_0x82af('0xa'));}_0x80e784(null,_0xd1166a);}}});}; \ No newline at end of file +var _0xe7d0=['changed','YYYY-MM-DD\x20HH:mm:ss','api','moment','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions'];(function(_0x1283d7,_0x29f1f8){var _0x5b40d1=function(_0x2486ed){while(--_0x2486ed){_0x1283d7['push'](_0x1283d7['shift']());}};_0x5b40d1(++_0x29f1f8);}(_0xe7d0,0x119));var _0x0e7d=function(_0x5e0dde,_0x3c138c){_0x5e0dde=_0x5e0dde-0x0;var _0x5e1503=_0xe7d0[_0x5e0dde];return _0x5e1503;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0e7d('0x0'));var moment=require(_0x0e7d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e7d('0x2'));var attributes=require(_0x0e7d('0x3'));module['exports']=function(_0x10c5ec,_0x1404e2){return _0x10c5ec[_0x0e7d('0x4')](_0x0e7d('0x5'),attributes,{'tableName':_0x0e7d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31abde,_0x151fd2,_0x2709ba){if(_0x31abde[_0x0e7d('0x7')]('closed')){_0x31abde['closedAt']=moment()['format'](_0x0e7d('0x8'));}_0x2709ba(null,_0x31abde);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d7cb09d..b31c281 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 _0x3e5d=['options','raw','attributes','limit','UpdateSmsInteraction','where','addTags','body','omit','AddTags','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','update'];(function(_0x19d829,_0xdff57){var _0x5c5394=function(_0x24d9ef){while(--_0x24d9ef){_0x19d829['push'](_0x19d829['shift']());}};_0x5c5394(++_0xdff57);}(_0x3e5d,0x1df));var _0xd3e5=function(_0x5db875,_0x10573e){_0x5db875=_0x5db875-0x0;var _0xde9c65=_0x3e5d[_0x5db875];return _0xde9c65;};'use strict';var _=require(_0xd3e5('0x0'));var util=require(_0xd3e5('0x1'));var moment=require(_0xd3e5('0x2'));var BPromise=require(_0xd3e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3e5('0x4'));var db=require(_0xd3e5('0x5'))['db'];var utils=require(_0xd3e5('0x6'));var logger=require(_0xd3e5('0x7'))(_0xd3e5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3e5('0x9')]['http']({'port':0x232a});config[_0xd3e5('0xa')]=_[_0xd3e5('0xb')](config[_0xd3e5('0xa')],{'host':_0xd3e5('0xc'),'port':0x18eb});var socket=require(_0xd3e5('0xd'))(new Redis(config[_0xd3e5('0xa')]));require(_0xd3e5('0xe'))['register'](socket);function respondWithRpcPromise(_0x3ef882,_0x355dba,_0x2bb585){return new BPromise(function(_0x377a1,_0x30b5da){return client[_0xd3e5('0xf')](_0x3ef882,_0x2bb585)[_0xd3e5('0x10')](function(_0x15a18f){logger[_0xd3e5('0x11')](_0xd3e5('0x12'),_0x355dba,_0xd3e5('0x13'));logger[_0xd3e5('0x14')](_0xd3e5('0x15'),_0x355dba,_0xd3e5('0x13'),JSON['stringify'](_0x15a18f));if(_0x15a18f[_0xd3e5('0x16')]){if(_0x15a18f[_0xd3e5('0x16')][_0xd3e5('0x17')]===0x1f4){logger[_0xd3e5('0x16')](_0xd3e5('0x12'),_0x355dba,_0x15a18f[_0xd3e5('0x16')][_0xd3e5('0x18')]);return _0x30b5da(_0x15a18f['error'][_0xd3e5('0x18')]);}logger['error'](_0xd3e5('0x12'),_0x355dba,_0x15a18f[_0xd3e5('0x16')][_0xd3e5('0x18')]);return _0x377a1(_0x15a18f[_0xd3e5('0x16')][_0xd3e5('0x18')]);}else{logger[_0xd3e5('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x355dba,'request\x20sent');_0x377a1(_0x15a18f[_0xd3e5('0x19')][_0xd3e5('0x18')]);}})[_0xd3e5('0x1a')](function(_0x5c9f3b){logger[_0xd3e5('0x16')](_0xd3e5('0x12'),_0x355dba,_0x5c9f3b);_0x30b5da(_0x5c9f3b);});});}exports['UpdateSmsInteraction']=function(_0x23c052){var _0x8e8cfa=this;return new Promise(function(_0x4c23a1,_0x1fefe1){return db['SmsInteraction'][_0xd3e5('0x1b')](_0x23c052['body'],{'raw':_0x23c052[_0xd3e5('0x1c')]?_0x23c052[_0xd3e5('0x1c')][_0xd3e5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c052['options']?_0x23c052[_0xd3e5('0x1c')]['where']||null:null,'attributes':_0x23c052[_0xd3e5('0x1c')]?_0x23c052[_0xd3e5('0x1c')][_0xd3e5('0x1e')]||null:null,'limit':_0x23c052['options']?_0x23c052['options'][_0xd3e5('0x1f')]||null:null})[_0xd3e5('0x10')](function(_0x7c3b58){logger[_0xd3e5('0x11')]('UpdateSmsInteraction',_0x23c052);logger[_0xd3e5('0x14')]('UpdateSmsInteraction',_0x23c052,JSON['stringify'](_0x7c3b58));_0x4c23a1(_0x7c3b58);})[_0xd3e5('0x1a')](function(_0x3f5a6c){logger[_0xd3e5('0x16')](_0xd3e5('0x20'),_0x3f5a6c[_0xd3e5('0x18')],_0x23c052);_0x1fefe1(_0x8e8cfa[_0xd3e5('0x16')](0x1f4,_0x3f5a6c[_0xd3e5('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x36a3e9){return new Promise(function(_0x457d1e,_0x2d1a46){return db['SmsInteraction']['find']({'where':_0x36a3e9[_0xd3e5('0x1c')]?_0x36a3e9[_0xd3e5('0x1c')][_0xd3e5('0x21')]||null:null})[_0xd3e5('0x10')](function(_0x547a97){if(_0x547a97){return _0x547a97[_0xd3e5('0x22')](_0x36a3e9[_0xd3e5('0x23')]['ids'],_[_0xd3e5('0x24')](_0x36a3e9[_0xd3e5('0x23')],['ids','id'])||{});}})['spread'](function(_0x2753bb){logger[_0xd3e5('0x11')](_0xd3e5('0x25'),_0x36a3e9);logger[_0xd3e5('0x14')](_0xd3e5('0x25'),_0x36a3e9,JSON[_0xd3e5('0x26')](_0x2753bb));_0x457d1e(_0x2753bb);})[_0xd3e5('0x1a')](function(_0x2ab27e){logger[_0xd3e5('0x16')](_0xd3e5('0x25'),_0x2ab27e[_0xd3e5('0x18')],_0x36a3e9);_0x2d1a46(_this[_0xd3e5('0x16')](0x1f4,_0x2ab27e['message']));});});}; \ No newline at end of file +var _0x5b63=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit','find','addTags','ids','AddTags','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','then','info'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x5b63,0x1d1));var _0x35b6=function(_0x2013e6,_0x4de02c){_0x2013e6=_0x2013e6-0x0;var _0xefe44d=_0x5b63[_0x2013e6];return _0xefe44d;};'use strict';var _=require('lodash');var util=require(_0x35b6('0x0'));var moment=require('moment');var BPromise=require(_0x35b6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x35b6('0x3'));var logger=require(_0x35b6('0x4'))(_0x35b6('0x5'));var config=require(_0x35b6('0x6'));var jayson=require(_0x35b6('0x7'));var client=jayson['client'][_0x35b6('0x8')]({'port':0x232a});config['redis']=_[_0x35b6('0x9')](config[_0x35b6('0xa')],{'host':_0x35b6('0xb'),'port':0x18eb});var socket=require(_0x35b6('0xc'))(new Redis(config[_0x35b6('0xa')]));require(_0x35b6('0xd'))['register'](socket);function respondWithRpcPromise(_0x1df699,_0x1808fe,_0x1f760f){return new BPromise(function(_0x3abd09,_0x3e9453){return client['request'](_0x1df699,_0x1f760f)[_0x35b6('0xe')](function(_0x408c34){logger[_0x35b6('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x1808fe,_0x35b6('0x10'));logger[_0x35b6('0x11')](_0x35b6('0x12'),_0x1808fe,_0x35b6('0x10'),JSON[_0x35b6('0x13')](_0x408c34));if(_0x408c34[_0x35b6('0x14')]){if(_0x408c34[_0x35b6('0x14')][_0x35b6('0x15')]===0x1f4){logger[_0x35b6('0x14')](_0x35b6('0x16'),_0x1808fe,_0x408c34[_0x35b6('0x14')]['message']);return _0x3e9453(_0x408c34['error'][_0x35b6('0x17')]);}logger['error'](_0x35b6('0x16'),_0x1808fe,_0x408c34['error'][_0x35b6('0x17')]);return _0x3abd09(_0x408c34['error'][_0x35b6('0x17')]);}else{logger[_0x35b6('0xf')](_0x35b6('0x16'),_0x1808fe,_0x35b6('0x10'));_0x3abd09(_0x408c34[_0x35b6('0x18')][_0x35b6('0x17')]);}})[_0x35b6('0x19')](function(_0x28dca8){logger['error'](_0x35b6('0x16'),_0x1808fe,_0x28dca8);_0x3e9453(_0x28dca8);});});}exports[_0x35b6('0x1a')]=function(_0x4cc618){var _0x5d8d35=this;return new Promise(function(_0x103492,_0x5e7971){return db[_0x35b6('0x1b')]['update'](_0x4cc618[_0x35b6('0x1c')],{'raw':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618[_0x35b6('0x1d')][_0x35b6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618[_0x35b6('0x1d')][_0x35b6('0x1f')]||null:null,'attributes':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618[_0x35b6('0x1d')]['attributes']||null:null,'limit':_0x4cc618[_0x35b6('0x1d')]?_0x4cc618['options'][_0x35b6('0x20')]||null:null})[_0x35b6('0xe')](function(_0x5e7b3e){logger[_0x35b6('0xf')](_0x35b6('0x1a'),_0x4cc618);logger[_0x35b6('0x11')](_0x35b6('0x1a'),_0x4cc618,JSON[_0x35b6('0x13')](_0x5e7b3e));_0x103492(_0x5e7b3e);})[_0x35b6('0x19')](function(_0x538765){logger[_0x35b6('0x14')](_0x35b6('0x1a'),_0x538765[_0x35b6('0x17')],_0x4cc618);_0x5e7971(_0x5d8d35[_0x35b6('0x14')](0x1f4,_0x538765['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3f6389){return new Promise(function(_0x53ad6c,_0x14c95c){return db[_0x35b6('0x1b')][_0x35b6('0x21')]({'where':_0x3f6389[_0x35b6('0x1d')]?_0x3f6389[_0x35b6('0x1d')][_0x35b6('0x1f')]||null:null})[_0x35b6('0xe')](function(_0x2a28a1){if(_0x2a28a1){return _0x2a28a1[_0x35b6('0x22')](_0x3f6389[_0x35b6('0x1c')][_0x35b6('0x23')],_['omit'](_0x3f6389['body'],[_0x35b6('0x23'),'id'])||{});}})['spread'](function(_0x5bb239){logger[_0x35b6('0xf')](_0x35b6('0x24'),_0x3f6389);logger[_0x35b6('0x11')]('AddTags',_0x3f6389,JSON[_0x35b6('0x13')](_0x5bb239));_0x53ad6c(_0x5bb239);})[_0x35b6('0x19')](function(_0x1fe816){logger[_0x35b6('0x14')](_0x35b6('0x24'),_0x1fe816[_0x35b6('0x17')],_0x3f6389);_0x14c95c(_this['error'](0x1f4,_0x1fe816[_0x35b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f8b7462..66a6764 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 _0x4f9f=['register','smsInteraction:','./smsInteraction.events','save','update','removeListener'];(function(_0x519a04,_0x38408e){var _0x210a84=function(_0x2158f3){while(--_0x2158f3){_0x519a04['push'](_0x519a04['shift']());}};_0x210a84(++_0x38408e);}(_0x4f9f,0x1dc));var _0xf4f9=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x4f9f[_0xc82d1a];return _0x32fad2;};'use strict';var SmsInteractionEvents=require(_0xf4f9('0x0'));var events=[_0xf4f9('0x1'),'remove',_0xf4f9('0x2')];function createListener(_0x5ea325,_0x1047de){return function(_0x4ef819){_0x1047de['emit'](_0x5ea325,_0x4ef819);};}function removeListener(_0x5f42ca,_0x10b93e){return function(){SmsInteractionEvents[_0xf4f9('0x3')](_0x5f42ca,_0x10b93e);};}exports[_0xf4f9('0x4')]=function(_0x33359a){for(var _0x1de6b0=0x0,_0x2cdce5=events['length'];_0x1de6b0<_0x2cdce5;_0x1de6b0++){var _0x408a3f=events[_0x1de6b0];var _0x4675f7=createListener(_0xf4f9('0x5')+_0x408a3f,_0x33359a);SmsInteractionEvents['on'](_0x408a3f,_0x4675f7);}}; \ No newline at end of file +var _0x39ca=['remove','removeListener','register','length','smsInteraction:','save'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x39ca,0x1a3));var _0xa39c=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0x39ca[_0x31abee];return _0x3c1761;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa39c('0x0'),_0xa39c('0x1'),'update'];function createListener(_0xdc9439,_0x56fdcd){return function(_0x13a5bc){_0x56fdcd['emit'](_0xdc9439,_0x13a5bc);};}function removeListener(_0x481a42,_0x26a871){return function(){SmsInteractionEvents[_0xa39c('0x2')](_0x481a42,_0x26a871);};}exports[_0xa39c('0x3')]=function(_0x2abea2){for(var _0x2d6780=0x0,_0x252d5c=events[_0xa39c('0x4')];_0x2d6780<_0x252d5c;_0x2d6780++){var _0x3d33f0=events[_0x2d6780];var _0x3a4432=createListener(_0xa39c('0x5')+_0x3d33f0,_0x2abea2);SmsInteractionEvents['on'](_0x3d33f0,_0x3a4432);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4fa6758..ea8e14f 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 _0x58c4=['delete','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','create','post','/:id/status','status','put','/:id/accept','accept','reject'];(function(_0x3e87ba,_0x46c587){var _0x40efc2=function(_0xfbaf35){while(--_0xfbaf35){_0x3e87ba['push'](_0x3e87ba['shift']());}};_0x40efc2(++_0x46c587);}(_0x58c4,0x135));var _0x458c=function(_0x2bd146,_0xf00cc1){_0x2bd146=_0x2bd146-0x0;var _0x3f835a=_0x58c4[_0x2bd146];return _0x3f835a;};'use strict';var multer=require(_0x458c('0x0'));var util=require('util');var path=require(_0x458c('0x1'));var timeout=require(_0x458c('0x2'));var express=require(_0x458c('0x3'));var router=express[_0x458c('0x4')]();var fs_extra=require(_0x458c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x458c('0x6'));var controller=require(_0x458c('0x7'));router[_0x458c('0x8')]('/',auth[_0x458c('0x9')](),controller[_0x458c('0xa')]);router[_0x458c('0x8')](_0x458c('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x458c('0x8')](_0x458c('0xc'),auth[_0x458c('0x9')](),controller['show']);router['post']('/',auth[_0x458c('0x9')](),interaction['tracked']('sms','smsmessage:create'),controller[_0x458c('0xd')]);router[_0x458c('0xe')](_0x458c('0xf'),controller[_0x458c('0x10')]);router[_0x458c('0x11')](_0x458c('0xc'),auth[_0x458c('0x9')](),controller['update']);router[_0x458c('0x11')](_0x458c('0x12'),auth['isAuthenticated'](),controller[_0x458c('0x13')]);router[_0x458c('0x11')]('/:id/reject',auth[_0x458c('0x9')](),controller[_0x458c('0x14')]);router[_0x458c('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdc83=['/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','describe'];(function(_0x264341,_0x30f134){var _0x5c6408=function(_0x29626e){while(--_0x29626e){_0x264341['push'](_0x264341['shift']());}};_0x5c6408(++_0x30f134);}(_0xdc83,0x104));var _0x3dc8=function(_0x71f943,_0x4ececc){_0x71f943=_0x71f943-0x0;var _0x1b99df=_0xdc83[_0x71f943];return _0x1b99df;};'use strict';var multer=require(_0x3dc8('0x0'));var util=require(_0x3dc8('0x1'));var path=require(_0x3dc8('0x2'));var timeout=require('connect-timeout');var express=require(_0x3dc8('0x3'));var router=express[_0x3dc8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3dc8('0x5'));var config=require('../../config/environment');var controller=require(_0x3dc8('0x6'));router['get']('/',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x8')]);router['get']('/describe',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x9')]);router['get'](_0x3dc8('0xa'),auth[_0x3dc8('0x7')](),controller[_0x3dc8('0xb')]);router[_0x3dc8('0xc')]('/',auth[_0x3dc8('0x7')](),interaction[_0x3dc8('0xd')]('sms',_0x3dc8('0xe')),controller[_0x3dc8('0xf')]);router[_0x3dc8('0xc')](_0x3dc8('0x10'),controller[_0x3dc8('0x11')]);router[_0x3dc8('0x12')]('/:id',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x13')]);router[_0x3dc8('0x12')](_0x3dc8('0x14'),auth['isAuthenticated'](),controller[_0x3dc8('0x15')]);router[_0x3dc8('0x12')](_0x3dc8('0x16'),auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x17')]);router[_0x3dc8('0x18')]('/:id',auth[_0x3dc8('0x7')](),controller[_0x3dc8('0x19')]);module[_0x3dc8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2d68c7d..1cb4cd8 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 _0x450f=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x172dca,_0xda5041){var _0x2a887f=function(_0x1a6aa5){while(--_0x1a6aa5){_0x172dca['push'](_0x172dca['shift']());}};_0x2a887f(++_0xda5041);}(_0x450f,0x15d));var _0xf450=function(_0x1711f8,_0x208f40){_0x1711f8=_0x1711f8-0x0;var _0x38ca74=_0x450f[_0x1711f8];return _0x38ca74;};'use strict';var Sequelize=require(_0xf450('0x0'));module[_0xf450('0x1')]={'body':{'type':Sequelize[_0xf450('0x2')](_0xf450('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf450('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf450('0x5')]('in',_0xf450('0x6')),'defaultValue':_0xf450('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf450('0x7')](0xbe)},'phone':{'type':Sequelize[_0xf450('0x7')]},'readAt':{'type':Sequelize[_0xf450('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf450('0x7')]},'providerResponse':{'type':Sequelize[_0xf450('0x2')]}}; \ No newline at end of file +var _0xc8f5=['out','STRING','BOOLEAN','TEXT','sequelize','exports','medium'];(function(_0x380fa9,_0x5123eb){var _0x4f2532=function(_0x4bde43){while(--_0x4bde43){_0x380fa9['push'](_0x380fa9['shift']());}};_0x4f2532(++_0x5123eb);}(_0xc8f5,0xeb));var _0x5c8f=function(_0x29bb0a,_0x4a49e6){_0x29bb0a=_0x29bb0a-0x0;var _0x1725e4=_0xc8f5[_0x29bb0a];return _0x1725e4;};'use strict';var Sequelize=require(_0x5c8f('0x0'));module[_0x5c8f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5c8f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x5c8f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c8f('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5c8f('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5c8f('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5c8f('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9911d92..7c90c52 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 _0xd7d5=['create','body','describe','sms-interactions','accept','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','SmsAccount','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','inspect','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','stack','map','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','SmsMessage','catch','params','find'];(function(_0x3748d3,_0x30753d){var _0x99dd2f=function(_0x5c9f0d){while(--_0x5c9f0d){_0x3748d3['push'](_0x3748d3['shift']());}};_0x99dd2f(++_0x30753d);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x2804cb,_0x4d9c62){_0x2804cb=_0x2804cb-0x0;var _0x36a83d=_0xd7d5[_0x2804cb];return _0x36a83d;};'use strict';var emlformat=require(_0x5d7d('0x0'));var rimraf=require(_0x5d7d('0x1'));var zipdir=require(_0x5d7d('0x2'));var jsonpatch=require(_0x5d7d('0x3'));var rp=require(_0x5d7d('0x4'));var moment=require(_0x5d7d('0x5'));var BPromise=require(_0x5d7d('0x6'));var Mustache=require('mustache');var util=require(_0x5d7d('0x7'));var path=require('path');var sox=require(_0x5d7d('0x8'));var csv=require(_0x5d7d('0x9'));var ejs=require(_0x5d7d('0xa'));var fs=require('fs');var fs_extra=require(_0x5d7d('0xb'));var _=require(_0x5d7d('0xc'));var squel=require(_0x5d7d('0xd'));var crypto=require(_0x5d7d('0xe'));var jsforce=require(_0x5d7d('0xf'));var deskjs=require(_0x5d7d('0x10'));var toCsv=require(_0x5d7d('0x9'));var querystring=require('querystring');var Papa=require(_0x5d7d('0x11'));var Redis=require(_0x5d7d('0x12'));var authService=require(_0x5d7d('0x13'));var qs=require(_0x5d7d('0x14'));var as=require(_0x5d7d('0x15'));var hardwareService=require(_0x5d7d('0x16'));var logger=require(_0x5d7d('0x17'))(_0x5d7d('0x18'));var utils=require(_0x5d7d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5d7d('0x1a'));var db=require(_0x5d7d('0x1b'))['db'];config[_0x5d7d('0x1c')]=_['defaults'](config[_0x5d7d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5d7d('0x1d'))[_0x5d7d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5d7d('0x1f')]({'port':0x232c});var client9002=jayson[_0x5d7d('0x20')][_0x5d7d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x159c5a,_0x3d687b,_0x5d8d8c,_0x4a07d2){return new BPromise(function(_0x4dc832,_0x14b449){var _0x1f2154=_0x4a07d2||client;return _0x1f2154[_0x5d7d('0x21')](_0x159c5a,_0x5d8d8c)[_0x5d7d('0x22')](function(_0x1aa4f5){logger[_0x5d7d('0x23')](_0x5d7d('0x24'),_0x3d687b,_0x5d7d('0x25'));logger[_0x5d7d('0x26')](_0x5d7d('0x27'),_0x3d687b,_0x5d7d('0x25'),JSON['stringify'](_0x1aa4f5));if(_0x1aa4f5[_0x5d7d('0x28')]){if(_0x1aa4f5['error']['code']===0x1f4){logger[_0x5d7d('0x28')](_0x5d7d('0x24'),_0x3d687b,_0x1aa4f5[_0x5d7d('0x28')][_0x5d7d('0x29')]);return _0x14b449(_0x1aa4f5[_0x5d7d('0x28')][_0x5d7d('0x29')]);}logger[_0x5d7d('0x28')](_0x5d7d('0x24'),_0x3d687b,_0x1aa4f5[_0x5d7d('0x28')][_0x5d7d('0x29')]);return _0x4dc832(_0x1aa4f5[_0x5d7d('0x28')]['message']);}else{logger[_0x5d7d('0x23')](_0x5d7d('0x24'),_0x3d687b,_0x5d7d('0x25'));_0x4dc832(_0x1aa4f5[_0x5d7d('0x2a')]['message']);}})['catch'](function(_0x14002a){logger[_0x5d7d('0x28')](_0x5d7d('0x24'),_0x3d687b,_0x14002a);_0x14b449(_0x14002a);});});}function respondWithStatusCode(_0x5b855e,_0x4132a9){_0x4132a9=_0x4132a9||0xcc;return function(_0x509e77){if(_0x509e77){return _0x5b855e[_0x5d7d('0x2b')](_0x4132a9);}return _0x5b855e[_0x5d7d('0x2c')](_0x4132a9)[_0x5d7d('0x2d')]();};}function respondWithResult(_0x5a224a,_0x371a78){_0x371a78=_0x371a78||0xc8;return function(_0xfa9b42){if(_0xfa9b42){return _0x5a224a[_0x5d7d('0x2c')](_0x371a78)['json'](_0xfa9b42);}};}function respondWithFilteredResult(_0x187030,_0x4ed00c){return function(_0x126873){if(_0x126873){var _0x18545f=typeof _0x4ed00c[_0x5d7d('0x2e')]===_0x5d7d('0x2f')&&typeof _0x4ed00c[_0x5d7d('0x30')]==='undefined';var _0x211166=_0x126873[_0x5d7d('0x31')];var _0x1ff099=_0x18545f?0x0:_0x4ed00c[_0x5d7d('0x2e')];var _0x4c588c=_0x18545f?_0x126873[_0x5d7d('0x31')]:_0x4ed00c[_0x5d7d('0x2e')]+_0x4ed00c[_0x5d7d('0x30')];var _0x35d550;if(_0x4c588c>=_0x211166){_0x4c588c=_0x211166;_0x35d550=0xc8;}else{_0x35d550=0xce;}_0x187030['status'](_0x35d550);return _0x187030[_0x5d7d('0x32')](_0x5d7d('0x33'),_0x1ff099+'-'+_0x4c588c+'/'+_0x211166)[_0x5d7d('0x34')](_0x126873);}return null;};}function patchUpdates(_0x563244){return function(_0x48afcb){try{jsonpatch[_0x5d7d('0x35')](_0x48afcb,_0x563244,!![]);}catch(_0x2ad100){return BPromise['reject'](_0x2ad100);}return _0x48afcb[_0x5d7d('0x36')]();};}function saveUpdates(_0xee91b6,_0x2da4ac){return function(_0x393619){if(_0x393619){return _0x393619[_0x5d7d('0x37')](_0xee91b6)[_0x5d7d('0x22')](function(_0x290c79){return _0x290c79;});}return null;};}function removeEntity(_0x5ced5b,_0xfc005c){return function(_0xffd878){if(_0xffd878){return _0xffd878[_0x5d7d('0x38')]()[_0x5d7d('0x22')](function(){_0x5ced5b['status'](0xcc)[_0x5d7d('0x2d')]();});}};}function handleEntityNotFound(_0x306cd1,_0x42c076){return function(_0x4b0b10){if(!_0x4b0b10){_0x306cd1[_0x5d7d('0x2b')](0x194);}return _0x4b0b10;};}function handleError(_0x141680,_0x5cbdbd){_0x5cbdbd=_0x5cbdbd||0x1f4;return function(_0x28c437){logger[_0x5d7d('0x28')](_0x28c437[_0x5d7d('0x39')]);if(_0x28c437['name']){delete _0x28c437['name'];}_0x141680[_0x5d7d('0x2c')](_0x5cbdbd)['send'](_0x28c437);};}exports['index']=function(_0xcce177,_0x3177b4){var _0x525957={},_0x132cef={},_0x55a6c8={'count':0x0,'rows':[]};var _0x13ccb2=_[_0x5d7d('0x3a')](db['SmsMessage'][_0x5d7d('0x3b')],function(_0x548aa3){return{'name':_0x548aa3['fieldName'],'type':_0x548aa3[_0x5d7d('0x3c')][_0x5d7d('0x3d')]};});_0x132cef['model']=_[_0x5d7d('0x3a')](_0x13ccb2,_0x5d7d('0x3e'));_0x132cef[_0x5d7d('0x3f')]=_[_0x5d7d('0x40')](_0xcce177[_0x5d7d('0x3f')]);_0x132cef[_0x5d7d('0x41')]=_[_0x5d7d('0x42')](_0x132cef[_0x5d7d('0x43')],_0x132cef[_0x5d7d('0x3f')]);_0x525957[_0x5d7d('0x44')]=_[_0x5d7d('0x42')](_0x132cef[_0x5d7d('0x43')],qs[_0x5d7d('0x45')](_0xcce177[_0x5d7d('0x3f')]['fields']));_0x525957[_0x5d7d('0x44')]=_0x525957['attributes'][_0x5d7d('0x46')]?_0x525957[_0x5d7d('0x44')]:_0x132cef[_0x5d7d('0x43')];if(!_0xcce177['query'][_0x5d7d('0x47')](_0x5d7d('0x48'))){_0x525957[_0x5d7d('0x30')]=qs[_0x5d7d('0x30')](_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x30')]);_0x525957['offset']=qs[_0x5d7d('0x2e')](_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x2e')]);}_0x525957[_0x5d7d('0x49')]=qs[_0x5d7d('0x4a')](_0xcce177['query'][_0x5d7d('0x4a')]);_0x525957[_0x5d7d('0x4b')]=qs[_0x5d7d('0x41')](_[_0x5d7d('0x4c')](_0xcce177[_0x5d7d('0x3f')],_0x132cef[_0x5d7d('0x41')]),_0x13ccb2);if(_0xcce177['query'][_0x5d7d('0x4d')]){_0x525957[_0x5d7d('0x4b')]=_['merge'](_0x525957[_0x5d7d('0x4b')],{'$or':_[_0x5d7d('0x3a')](_0x13ccb2,function(_0x5e0e66){if(_0x5e0e66[_0x5d7d('0x3c')]!=='VIRTUAL'){var _0x42ec26={};_0x42ec26[_0x5e0e66[_0x5d7d('0x3e')]]={'$like':'%'+_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x4d')]+'%'};return _0x42ec26;}})});}_0x525957=_[_0x5d7d('0x4e')]({},_0x525957,_0xcce177[_0x5d7d('0x4f')]);var _0x1a817c={'where':_0x525957[_0x5d7d('0x4b')]};return db['SmsMessage']['count'](_0x1a817c)[_0x5d7d('0x22')](function(_0x19fc1f){_0x55a6c8['count']=_0x19fc1f;if(_0xcce177[_0x5d7d('0x3f')][_0x5d7d('0x50')]){_0x525957[_0x5d7d('0x51')]=[{'all':!![]}];}return db[_0x5d7d('0x52')]['findAll'](_0x525957);})[_0x5d7d('0x22')](function(_0x29512f){_0x55a6c8['rows']=_0x29512f;return _0x55a6c8;})[_0x5d7d('0x22')](respondWithFilteredResult(_0x3177b4,_0x525957))[_0x5d7d('0x53')](handleError(_0x3177b4,null));};exports['show']=function(_0x5100d7,_0x3faf11){var _0x56832a={'raw':!![],'where':{'id':_0x5100d7[_0x5d7d('0x54')]['id']}},_0x4f4c96={};_0x4f4c96[_0x5d7d('0x43')]=_[_0x5d7d('0x40')](db[_0x5d7d('0x52')][_0x5d7d('0x3b')]);_0x4f4c96['query']=_[_0x5d7d('0x40')](_0x5100d7['query']);_0x4f4c96['filters']=_['intersection'](_0x4f4c96[_0x5d7d('0x43')],_0x4f4c96['query']);_0x56832a[_0x5d7d('0x44')]=_[_0x5d7d('0x42')](_0x4f4c96['model'],qs[_0x5d7d('0x45')](_0x5100d7['query'][_0x5d7d('0x45')]));_0x56832a[_0x5d7d('0x44')]=_0x56832a[_0x5d7d('0x44')][_0x5d7d('0x46')]?_0x56832a[_0x5d7d('0x44')]:_0x4f4c96[_0x5d7d('0x43')];if(_0x5100d7[_0x5d7d('0x3f')]['includeAll']){_0x56832a['include']=[{'all':!![]}];}_0x56832a=_[_0x5d7d('0x4e')]({},_0x56832a,_0x5100d7[_0x5d7d('0x4f')]);return db[_0x5d7d('0x52')][_0x5d7d('0x55')](_0x56832a)['then'](handleEntityNotFound(_0x3faf11,null))['then'](respondWithResult(_0x3faf11,null))['catch'](handleError(_0x3faf11,null));};exports[_0x5d7d('0x56')]=function(_0x347ed8,_0x43effb){return db[_0x5d7d('0x52')][_0x5d7d('0x56')](_0x347ed8[_0x5d7d('0x57')],{})[_0x5d7d('0x22')](respondWithResult(_0x43effb,0xc9))['catch'](handleError(_0x43effb,null));};exports['update']=function(_0x4aa73d,_0x3675de){if(_0x4aa73d[_0x5d7d('0x57')]['id']){delete _0x4aa73d[_0x5d7d('0x57')]['id'];}return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x4aa73d['params']['id']}})['then'](handleEntityNotFound(_0x3675de,null))[_0x5d7d('0x22')](saveUpdates(_0x4aa73d['body'],null))[_0x5d7d('0x22')](respondWithResult(_0x3675de,null))[_0x5d7d('0x53')](handleError(_0x3675de,null));};exports[_0x5d7d('0x38')]=function(_0x3844e4,_0x556db3){return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x3844e4['params']['id']}})[_0x5d7d('0x22')](handleEntityNotFound(_0x556db3,null))['then'](removeEntity(_0x556db3,null))[_0x5d7d('0x53')](handleError(_0x556db3,null));};exports[_0x5d7d('0x58')]=function(_0x3d70cf,_0x569214){return db['SmsMessage'][_0x5d7d('0x58')]()[_0x5d7d('0x22')](respondWithResult(_0x569214,null))[_0x5d7d('0x53')](handleError(_0x569214,null));};var interaction_log=require(_0x5d7d('0x17'))(_0x5d7d('0x59'));exports[_0x5d7d('0x5a')]=function(_0x1981de,_0x5df345,_0x301159){var _0x1ba205={'agent':{},'channel':_0x5d7d('0x5b')};if(_0x1981de[_0x5d7d('0x57')]['id']){delete _0x1981de[_0x5d7d('0x57')]['id'];}_0x1981de[_0x5d7d('0x57')]['read']=!![];_0x1981de[_0x5d7d('0x57')]['readAt']=moment()[_0x5d7d('0x5c')](_0x5d7d('0x5d'));_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')]=_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')]||_0x1981de['user']['id'];_0x1ba205[_0x5d7d('0x5f')]['id']=_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')];return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x1981de[_0x5d7d('0x54')]['id'],'UserId':null}})[_0x5d7d('0x22')](handleEntityNotFound(_0x5df345,null))[_0x5d7d('0x22')](saveUpdates(_0x1981de[_0x5d7d('0x57')],null))[_0x5d7d('0x22')](function(_0x5b0f8a){if(_0x5b0f8a){_0x1ba205['message']=_0x5b0f8a[_0x5d7d('0x60')]({'plain':!![]});return db[_0x5d7d('0x61')][_0x5d7d('0x55')]({'where':{'id':_0x5b0f8a['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5df345,null))['then'](function(_0x5af086){if(_0x5af086){return _0x5af086[_0x5d7d('0x37')]({'UserId':_0x1981de['body'][_0x5d7d('0x5e')],'read1stAt':_[_0x5d7d('0x62')](_0x5af086[_0x5d7d('0x63')])?moment()['format'](_0x5d7d('0x5d')):undefined});}return null;})[_0x5d7d('0x22')](function(_0x2dd81c){if(_0x2dd81c){_0x1ba205['interaction']=_0x2dd81c[_0x5d7d('0x60')]({'plain':!![]});interaction_log[_0x5d7d('0x23')](_0x5d7d('0x64'),_0x1981de[_0x5d7d('0x65')]['id'],_0x1981de['user'][_0x5d7d('0x3e')],_0x1981de[_0x5d7d('0x65')]['role'],_0x1ba205['interaction']['id'],_0x1981de['body']?JSON[_0x5d7d('0x66')](_0x1981de['body']):'null');return respondWithRpcPromise(_0x5d7d('0x67'),_0x5d7d('0x68'),_0x1ba205);}return null;})[_0x5d7d('0x22')](function(_0x5154ca){var _0x19864a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5154ca[_0x5d7d('0x29')][_0x5d7d('0x69')];return db[_0x5d7d('0x6a')][_0x5d7d('0x3f')](_0x19864a,{'type':db[_0x5d7d('0x6b')][_0x5d7d('0x6c')][_0x5d7d('0x6d')],'raw':!![]})[_0x5d7d('0x22')](function(_0x4c30e5){return _0x4c30e5;});})[_0x5d7d('0x22')](function(_0x5d9e2d){if(_0x5d9e2d){_0x1ba205[_0x5d7d('0x29')][_0x5d7d('0x6e')]=_0x5d9e2d[0x0];if(!_0x1981de[_0x5d7d('0x57')]['UserId'])return;return db[_0x5d7d('0x6f')][_0x5d7d('0x55')]({'where':{'id':_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x5e')],'role':_0x5d7d('0x5f')},'attributes':['id',_0x5d7d('0x3e'),_0x5d7d('0x70'),_0x5d7d('0x71'),_0x5d7d('0x72')],'raw':!![]});}return null;})[_0x5d7d('0x22')](function(_0x19a858){if(!_0x19a858)return null;_0x1ba205[_0x5d7d('0x29')]['agent']=_0x19a858;return _0x1ba205;})[_0x5d7d('0x22')](function(_0x2dfcb2){if(_0x2dfcb2){if(_0x1981de[_0x5d7d('0x57')][_0x5d7d('0x73')]){_0x1ba205[_0x5d7d('0x29')][_0x5d7d('0x74')]=util[_0x5d7d('0x5c')]('SIP/%s',_0x1981de['user']['name']);_0x1ba205[_0x5d7d('0x29')]['channel']=_0x1ba205[_0x5d7d('0x75')];_0x1ba205[_0x5d7d('0x29')][_0x5d7d('0x76')]=_0x1ba205['channel'];_0x1ba205['message'][_0x5d7d('0x77')]=_0x5d7d('0x5a');return respondWithRpcPromise(_0x5d7d('0x78'),_0x5d7d('0x78'),{'event':_0x5d7d('0x79'),'message':_0x1ba205['message']},client9002)['then'](function(){return _0x1ba205;});}return _0x1ba205;}return null;})[_0x5d7d('0x22')](respondWithResult(_0x5df345,null))[_0x5d7d('0x53')](handleError(_0x5df345,null));};var interaction_log=require(_0x5d7d('0x17'))(_0x5d7d('0x59'));exports[_0x5d7d('0x7a')]=function(_0x7adacc,_0x1459e1,_0x393f7f){var _0x358225={'agent':{},'channel':_0x5d7d('0x5b')};if(_0x7adacc[_0x5d7d('0x57')]['id']){delete _0x7adacc[_0x5d7d('0x57')]['id'];}_0x7adacc['body'][_0x5d7d('0x5e')]=_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')]||_0x7adacc[_0x5d7d('0x65')]['id'];_0x358225[_0x5d7d('0x5f')]['id']=_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')];return db['SmsMessage']['find']({'where':{'id':_0x7adacc[_0x5d7d('0x54')]['id'],'UserId':null}})[_0x5d7d('0x22')](handleEntityNotFound(_0x1459e1,null))[_0x5d7d('0x22')](function(_0x41440f){if(_0x41440f){_0x358225['message']=_0x41440f[_0x5d7d('0x60')]({'plain':!![]});return db[_0x5d7d('0x61')][_0x5d7d('0x55')]({'where':{'id':_0x41440f['SmsInteractionId']}});}return null;})[_0x5d7d('0x22')](handleEntityNotFound(_0x1459e1,null))[_0x5d7d('0x22')](function(_0x1a2ea1){if(_0x1a2ea1){_0x358225[_0x5d7d('0x7b')]=_0x1a2ea1[_0x5d7d('0x60')]({'plain':!![]});interaction_log['info'](_0x5d7d('0x7c'),_0x7adacc['user']['id'],_0x7adacc[_0x5d7d('0x65')]['name'],_0x7adacc[_0x5d7d('0x65')]['role'],_0x358225['interaction']['id'],_0x7adacc[_0x5d7d('0x57')]?JSON['stringify'](_0x7adacc[_0x5d7d('0x57')]):'null');return respondWithRpcPromise(_0x5d7d('0x7d'),_0x5d7d('0x7e'),_0x358225);}return null;})['then'](function(_0x4b9eb5){var _0x4b1fde=_0x5d7d('0x7f')+_0x4b9eb5[_0x5d7d('0x29')][_0x5d7d('0x69')];return db['sequelize'][_0x5d7d('0x3f')](_0x4b1fde,{'type':db['Sequelize'][_0x5d7d('0x6c')][_0x5d7d('0x6d')],'raw':!![]})['then'](function(_0x4866ea){return _0x4866ea;});})[_0x5d7d('0x22')](function(_0x3861b0){if(_0x3861b0){_0x358225[_0x5d7d('0x29')][_0x5d7d('0x6e')]=_0x3861b0[0x0];if(!_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')])return;return db[_0x5d7d('0x6f')]['find']({'where':{'id':_0x7adacc[_0x5d7d('0x57')][_0x5d7d('0x5e')],'role':_0x5d7d('0x5f')},'attributes':['id',_0x5d7d('0x3e'),_0x5d7d('0x70'),_0x5d7d('0x71'),_0x5d7d('0x72')],'raw':!![]});}return null;})[_0x5d7d('0x22')](function(_0x481a3c){if(!_0x481a3c)return null;_0x358225[_0x5d7d('0x29')][_0x5d7d('0x5f')]=_0x481a3c;return _0x358225;})[_0x5d7d('0x22')](function(_0x488b9e){if(_0x488b9e){_0x488b9e[_0x5d7d('0x29')][_0x5d7d('0x74')]=util[_0x5d7d('0x5c')]('SIP/%s',_0x7adacc[_0x5d7d('0x65')][_0x5d7d('0x3e')]);_0x488b9e[_0x5d7d('0x29')][_0x5d7d('0x75')]=_0x358225[_0x5d7d('0x75')];_0x488b9e[_0x5d7d('0x29')]['motionChannel']=_0x358225[_0x5d7d('0x75')];_0x488b9e[_0x5d7d('0x29')]['event']=_0x5d7d('0x7a');respondWithRpcPromise(_0x5d7d('0x78'),_0x5d7d('0x78'),{'event':_0x5d7d('0x80'),'message':_0x488b9e['message']},client9002);return _0x358225;}return null;})[_0x5d7d('0x22')](respondWithResult(_0x1459e1,null))['catch'](handleError(_0x1459e1,null));};exports[_0x5d7d('0x2c')]=function(_0x2ec919,_0x272ea7,_0x36fa7c){if(_0x2ec919[_0x5d7d('0x57')]['id']){delete _0x2ec919[_0x5d7d('0x57')]['id'];}var _0x1688d6;return db[_0x5d7d('0x52')][_0x5d7d('0x55')]({'where':{'id':_0x2ec919[_0x5d7d('0x54')]['id']}})[_0x5d7d('0x22')](handleEntityNotFound(_0x272ea7,null))[_0x5d7d('0x22')](function(_0x5a6779){if(_0x5a6779){_0x1688d6=_0x5a6779;return db[_0x5d7d('0x81')][_0x5d7d('0x55')]({'where':{'id':_0x5a6779['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x272ea7,null))[_0x5d7d('0x22')](function(_0x346c67){if(_0x346c67){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x346c67[_0x5d7d('0x3c')],util['inspect'](_0x2ec919[_0x5d7d('0x57')],{'showHidden':![],'depth':null}));switch(_0x346c67[_0x5d7d('0x3c')]){case _0x5d7d('0x82'):if(_0x2ec919['body'][_0x5d7d('0x83')]&&_0x2ec919['body'][_0x5d7d('0x83')]===_0x1688d6[_0x5d7d('0x84')]){return _0x1688d6['update']({'read':!![]});}else{logger[_0x5d7d('0x28')](_0x5d7d('0x85'),_0x5d7d('0x2c'),_0x5d7d('0x82'),util['inspect'](_0x2ec919['body'],{'showHidden':![],'depth':null}));}break;case _0x5d7d('0x86'):if(_0x2ec919[_0x5d7d('0x57')][_0x5d7d('0x87')]&&_0x2ec919['body'][_0x5d7d('0x87')]===_0x1688d6[_0x5d7d('0x84')]&&_[_0x5d7d('0x88')]([_0x5d7d('0x89'),_0x5d7d('0x8a')],_0x2ec919['body'][_0x5d7d('0x8b')])>=0x0){return _0x1688d6[_0x5d7d('0x37')]({'read':!![]});}else{logger['error'](_0x5d7d('0x85'),_0x5d7d('0x2c'),'plivio',util[_0x5d7d('0x8c')](_0x2ec919[_0x5d7d('0x57')],{'showHidden':![],'depth':null}));}break;case _0x5d7d('0x8d'):var _0x5cec58=_0x2ec919[_0x5d7d('0x57')][_0x5d7d('0x8e')][0x0];if(_0x5cec58['status'][_0x5d7d('0x8f')]==='DELIVERED'){return _0x1688d6['update']({'read':!![]});}else{logger[_0x5d7d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5d7d('0x2c'),_0x5d7d('0x8d'),util[_0x5d7d('0x8c')](_0x2ec919[_0x5d7d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x1688d6;}})['then'](respondWithResult(_0x272ea7,null))[_0x5d7d('0x53')](handleError(_0x272ea7,null));}; \ No newline at end of file +var _0xe98f=['fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','findAll','catch','show','params','intersection','find','create','body','describe','sms-interactions','accept','sms','read','format','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','User','event','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','SmsAccount,\x20%s,\x20%s,\x20%s','groupName','DELIVERED','infobip','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes'];(function(_0x57275e,_0x351690){var _0x197774=function(_0x692e03){while(--_0x692e03){_0x57275e['push'](_0x57275e['shift']());}};_0x197774(++_0x351690);}(_0xe98f,0xde));var _0xfe98=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe98f[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xfe98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe98('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe98('0x2'));var moment=require(_0xfe98('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfe98('0x4'));var path=require('path');var sox=require(_0xfe98('0x5'));var csv=require(_0xfe98('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe98('0x7'));var _=require('lodash');var squel=require(_0xfe98('0x8'));var crypto=require(_0xfe98('0x9'));var jsforce=require(_0xfe98('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfe98('0x6'));var querystring=require(_0xfe98('0xb'));var Papa=require('papaparse');var Redis=require(_0xfe98('0xc'));var authService=require(_0xfe98('0xd'));var qs=require(_0xfe98('0xe'));var as=require(_0xfe98('0xf'));var hardwareService=require(_0xfe98('0x10'));var logger=require(_0xfe98('0x11'))('api');var utils=require(_0xfe98('0x12'));var config=require(_0xfe98('0x13'));var licenseUtil=require(_0xfe98('0x14'));var db=require(_0xfe98('0x15'))['db'];config[_0xfe98('0x16')]=_['defaults'](config[_0xfe98('0x16')],{'host':_0xfe98('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe98('0x16')]));require('./smsMessage.socket')[_0xfe98('0x18')](socket);var jayson=require(_0xfe98('0x19'));var client=jayson[_0xfe98('0x1a')][_0xfe98('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xfe98('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d92fc,_0x416c4c,_0x8c527c,_0x20d565){return new BPromise(function(_0x476932,_0x4deba7){var _0x56c0f4=_0x20d565||client;return _0x56c0f4[_0xfe98('0x1c')](_0x4d92fc,_0x8c527c)[_0xfe98('0x1d')](function(_0x31bb37){logger['info'](_0xfe98('0x1e'),_0x416c4c,_0xfe98('0x1f'));logger[_0xfe98('0x20')](_0xfe98('0x21'),_0x416c4c,_0xfe98('0x1f'),JSON[_0xfe98('0x22')](_0x31bb37));if(_0x31bb37[_0xfe98('0x23')]){if(_0x31bb37['error'][_0xfe98('0x24')]===0x1f4){logger['error'](_0xfe98('0x1e'),_0x416c4c,_0x31bb37['error']['message']);return _0x4deba7(_0x31bb37[_0xfe98('0x23')][_0xfe98('0x25')]);}logger[_0xfe98('0x23')](_0xfe98('0x1e'),_0x416c4c,_0x31bb37['error'][_0xfe98('0x25')]);return _0x476932(_0x31bb37['error'][_0xfe98('0x25')]);}else{logger[_0xfe98('0x26')](_0xfe98('0x1e'),_0x416c4c,'request\x20sent');_0x476932(_0x31bb37['result'][_0xfe98('0x25')]);}})['catch'](function(_0x7b629e){logger[_0xfe98('0x23')]('SmsMessage,\x20%s,\x20%s',_0x416c4c,_0x7b629e);_0x4deba7(_0x7b629e);});});}function respondWithStatusCode(_0x3dc31d,_0x25f675){_0x25f675=_0x25f675||0xcc;return function(_0x21325b){if(_0x21325b){return _0x3dc31d[_0xfe98('0x27')](_0x25f675);}return _0x3dc31d['status'](_0x25f675)['end']();};}function respondWithResult(_0x5921f0,_0x51da63){_0x51da63=_0x51da63||0xc8;return function(_0xc68e94){if(_0xc68e94){return _0x5921f0[_0xfe98('0x28')](_0x51da63)[_0xfe98('0x29')](_0xc68e94);}};}function respondWithFilteredResult(_0x21c730,_0x1f3fb5){return function(_0x1017b5){if(_0x1017b5){var _0x3029=typeof _0x1f3fb5[_0xfe98('0x2a')]===_0xfe98('0x2b')&&typeof _0x1f3fb5[_0xfe98('0x2c')]==='undefined';var _0x1bed97=_0x1017b5[_0xfe98('0x2d')];var _0x9eb9c9=_0x3029?0x0:_0x1f3fb5[_0xfe98('0x2a')];var _0x3094df=_0x3029?_0x1017b5[_0xfe98('0x2d')]:_0x1f3fb5[_0xfe98('0x2a')]+_0x1f3fb5[_0xfe98('0x2c')];var _0xdbb15e;if(_0x3094df>=_0x1bed97){_0x3094df=_0x1bed97;_0xdbb15e=0xc8;}else{_0xdbb15e=0xce;}_0x21c730[_0xfe98('0x28')](_0xdbb15e);return _0x21c730[_0xfe98('0x2e')](_0xfe98('0x2f'),_0x9eb9c9+'-'+_0x3094df+'/'+_0x1bed97)[_0xfe98('0x29')](_0x1017b5);}return null;};}function patchUpdates(_0x269899){return function(_0x9b0a91){try{jsonpatch['apply'](_0x9b0a91,_0x269899,!![]);}catch(_0x504b58){return BPromise[_0xfe98('0x30')](_0x504b58);}return _0x9b0a91[_0xfe98('0x31')]();};}function saveUpdates(_0x582efe,_0x1a1288){return function(_0x405ebf){if(_0x405ebf){return _0x405ebf[_0xfe98('0x32')](_0x582efe)[_0xfe98('0x1d')](function(_0x22a132){return _0x22a132;});}return null;};}function removeEntity(_0x5ceb1c,_0x2712b9){return function(_0x3a8ad9){if(_0x3a8ad9){return _0x3a8ad9[_0xfe98('0x33')]()[_0xfe98('0x1d')](function(){_0x5ceb1c[_0xfe98('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17dd03,_0x596609){return function(_0x19f0f1){if(!_0x19f0f1){_0x17dd03[_0xfe98('0x27')](0x194);}return _0x19f0f1;};}function handleError(_0x20738c,_0x15a19b){_0x15a19b=_0x15a19b||0x1f4;return function(_0x4131a4){logger[_0xfe98('0x23')](_0x4131a4[_0xfe98('0x34')]);if(_0x4131a4[_0xfe98('0x35')]){delete _0x4131a4['name'];}_0x20738c['status'](_0x15a19b)[_0xfe98('0x36')](_0x4131a4);};}exports[_0xfe98('0x37')]=function(_0x4002c1,_0x35502e){var _0x207a6c={},_0x535a61={},_0x3e996c={'count':0x0,'rows':[]};var _0xb371b=_[_0xfe98('0x38')](db['SmsMessage'][_0xfe98('0x39')],function(_0x30723b){return{'name':_0x30723b[_0xfe98('0x3a')],'type':_0x30723b[_0xfe98('0x3b')]['key']};});_0x535a61[_0xfe98('0x3c')]=_[_0xfe98('0x38')](_0xb371b,'name');_0x535a61[_0xfe98('0x3d')]=_[_0xfe98('0x3e')](_0x4002c1[_0xfe98('0x3d')]);_0x535a61['filters']=_['intersection'](_0x535a61['model'],_0x535a61['query']);_0x207a6c[_0xfe98('0x3f')]=_['intersection'](_0x535a61[_0xfe98('0x3c')],qs[_0xfe98('0x40')](_0x4002c1['query'][_0xfe98('0x40')]));_0x207a6c[_0xfe98('0x3f')]=_0x207a6c[_0xfe98('0x3f')][_0xfe98('0x41')]?_0x207a6c[_0xfe98('0x3f')]:_0x535a61[_0xfe98('0x3c')];if(!_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x42')]('nolimit')){_0x207a6c[_0xfe98('0x2c')]=qs[_0xfe98('0x2c')](_0x4002c1['query'][_0xfe98('0x2c')]);_0x207a6c[_0xfe98('0x2a')]=qs[_0xfe98('0x2a')](_0x4002c1[_0xfe98('0x3d')]['offset']);}_0x207a6c[_0xfe98('0x43')]=qs['sort'](_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x44')]);_0x207a6c[_0xfe98('0x45')]=qs[_0xfe98('0x46')](_['pick'](_0x4002c1[_0xfe98('0x3d')],_0x535a61[_0xfe98('0x46')]),_0xb371b);if(_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x47')]){_0x207a6c[_0xfe98('0x45')]=_[_0xfe98('0x48')](_0x207a6c['where'],{'$or':_[_0xfe98('0x38')](_0xb371b,function(_0x1d430a){if(_0x1d430a[_0xfe98('0x3b')]!==_0xfe98('0x49')){var _0x46d5bb={};_0x46d5bb[_0x1d430a[_0xfe98('0x35')]]={'$like':'%'+_0x4002c1[_0xfe98('0x3d')]['filter']+'%'};return _0x46d5bb;}})});}_0x207a6c=_[_0xfe98('0x48')]({},_0x207a6c,_0x4002c1[_0xfe98('0x4a')]);var _0x183385={'where':_0x207a6c[_0xfe98('0x45')]};return db[_0xfe98('0x4b')]['count'](_0x183385)[_0xfe98('0x1d')](function(_0x5d9cb9){_0x3e996c[_0xfe98('0x2d')]=_0x5d9cb9;if(_0x4002c1[_0xfe98('0x3d')][_0xfe98('0x4c')]){_0x207a6c[_0xfe98('0x4d')]=[{'all':!![]}];}return db[_0xfe98('0x4b')][_0xfe98('0x4e')](_0x207a6c);})[_0xfe98('0x1d')](function(_0x754f39){_0x3e996c['rows']=_0x754f39;return _0x3e996c;})[_0xfe98('0x1d')](respondWithFilteredResult(_0x35502e,_0x207a6c))[_0xfe98('0x4f')](handleError(_0x35502e,null));};exports[_0xfe98('0x50')]=function(_0x1720d3,_0x5ad61e){var _0x26cb3d={'raw':!![],'where':{'id':_0x1720d3[_0xfe98('0x51')]['id']}},_0xc0573c={};_0xc0573c[_0xfe98('0x3c')]=_[_0xfe98('0x3e')](db[_0xfe98('0x4b')]['rawAttributes']);_0xc0573c[_0xfe98('0x3d')]=_[_0xfe98('0x3e')](_0x1720d3[_0xfe98('0x3d')]);_0xc0573c[_0xfe98('0x46')]=_[_0xfe98('0x52')](_0xc0573c['model'],_0xc0573c['query']);_0x26cb3d[_0xfe98('0x3f')]=_[_0xfe98('0x52')](_0xc0573c[_0xfe98('0x3c')],qs[_0xfe98('0x40')](_0x1720d3[_0xfe98('0x3d')][_0xfe98('0x40')]));_0x26cb3d[_0xfe98('0x3f')]=_0x26cb3d[_0xfe98('0x3f')][_0xfe98('0x41')]?_0x26cb3d[_0xfe98('0x3f')]:_0xc0573c['model'];if(_0x1720d3[_0xfe98('0x3d')]['includeAll']){_0x26cb3d[_0xfe98('0x4d')]=[{'all':!![]}];}_0x26cb3d=_[_0xfe98('0x48')]({},_0x26cb3d,_0x1720d3[_0xfe98('0x4a')]);return db['SmsMessage'][_0xfe98('0x53')](_0x26cb3d)['then'](handleEntityNotFound(_0x5ad61e,null))['then'](respondWithResult(_0x5ad61e,null))[_0xfe98('0x4f')](handleError(_0x5ad61e,null));};exports[_0xfe98('0x54')]=function(_0x2d7246,_0x3dfb51){return db[_0xfe98('0x4b')][_0xfe98('0x54')](_0x2d7246['body'],{})[_0xfe98('0x1d')](respondWithResult(_0x3dfb51,0xc9))['catch'](handleError(_0x3dfb51,null));};exports[_0xfe98('0x32')]=function(_0x4a5690,_0x54823a){if(_0x4a5690['body']['id']){delete _0x4a5690[_0xfe98('0x55')]['id'];}return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x4a5690[_0xfe98('0x51')]['id']}})['then'](handleEntityNotFound(_0x54823a,null))[_0xfe98('0x1d')](saveUpdates(_0x4a5690['body'],null))[_0xfe98('0x1d')](respondWithResult(_0x54823a,null))[_0xfe98('0x4f')](handleError(_0x54823a,null));};exports['destroy']=function(_0x7096d5,_0x6299e9){return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x7096d5['params']['id']}})[_0xfe98('0x1d')](handleEntityNotFound(_0x6299e9,null))[_0xfe98('0x1d')](removeEntity(_0x6299e9,null))[_0xfe98('0x4f')](handleError(_0x6299e9,null));};exports[_0xfe98('0x56')]=function(_0x4ab9c4,_0x4192e0){return db['SmsMessage'][_0xfe98('0x56')]()[_0xfe98('0x1d')](respondWithResult(_0x4192e0,null))[_0xfe98('0x4f')](handleError(_0x4192e0,null));};var interaction_log=require(_0xfe98('0x11'))(_0xfe98('0x57'));exports[_0xfe98('0x58')]=function(_0x4435d1,_0x247044,_0x36a92f){var _0x3b8626={'agent':{},'channel':_0xfe98('0x59')};if(_0x4435d1[_0xfe98('0x55')]['id']){delete _0x4435d1[_0xfe98('0x55')]['id'];}_0x4435d1['body'][_0xfe98('0x5a')]=!![];_0x4435d1['body']['readAt']=moment()[_0xfe98('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')]=_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')]||_0x4435d1[_0xfe98('0x5d')]['id'];_0x3b8626[_0xfe98('0x5e')]['id']=_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')];return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x4435d1[_0xfe98('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x247044,null))[_0xfe98('0x1d')](saveUpdates(_0x4435d1[_0xfe98('0x55')],null))[_0xfe98('0x1d')](function(_0x3d86ea){if(_0x3d86ea){_0x3b8626[_0xfe98('0x25')]=_0x3d86ea['get']({'plain':!![]});return db[_0xfe98('0x5f')][_0xfe98('0x53')]({'where':{'id':_0x3d86ea[_0xfe98('0x60')]}});}return null;})[_0xfe98('0x1d')](handleEntityNotFound(_0x247044,null))[_0xfe98('0x1d')](function(_0x15f053){if(_0x15f053){return _0x15f053['update']({'UserId':_0x4435d1[_0xfe98('0x55')][_0xfe98('0x5c')],'read1stAt':_[_0xfe98('0x61')](_0x15f053[_0xfe98('0x62')])?moment()[_0xfe98('0x5b')](_0xfe98('0x63')):undefined});}return null;})[_0xfe98('0x1d')](function(_0x534f43){if(_0x534f43){_0x3b8626[_0xfe98('0x64')]=_0x534f43[_0xfe98('0x65')]({'plain':!![]});interaction_log[_0xfe98('0x26')](_0xfe98('0x66'),_0x4435d1[_0xfe98('0x5d')]['id'],_0x4435d1[_0xfe98('0x5d')][_0xfe98('0x35')],_0x4435d1[_0xfe98('0x5d')][_0xfe98('0x67')],_0x3b8626[_0xfe98('0x64')]['id'],_0x4435d1[_0xfe98('0x55')]?JSON[_0xfe98('0x22')](_0x4435d1[_0xfe98('0x55')]):_0xfe98('0x68'));return respondWithRpcPromise(_0xfe98('0x69'),_0xfe98('0x6a'),_0x3b8626);}return null;})[_0xfe98('0x1d')](function(_0x172754){var _0x259e75=_0xfe98('0x6b')+_0x172754[_0xfe98('0x25')][_0xfe98('0x6c')];return db[_0xfe98('0x6d')][_0xfe98('0x3d')](_0x259e75,{'type':db[_0xfe98('0x6e')][_0xfe98('0x6f')][_0xfe98('0x70')],'raw':!![]})['then'](function(_0x5b0125){return _0x5b0125;});})[_0xfe98('0x1d')](function(_0x1ab844){if(_0x1ab844){_0x3b8626[_0xfe98('0x25')]['contact']=_0x1ab844[0x0];if(!_0x4435d1['body'][_0xfe98('0x5c')])return;return db['User'][_0xfe98('0x53')]({'where':{'id':_0x4435d1[_0xfe98('0x55')]['UserId'],'role':_0xfe98('0x5e')},'attributes':['id',_0xfe98('0x35'),_0xfe98('0x71'),_0xfe98('0x72'),_0xfe98('0x73')],'raw':!![]});}return null;})[_0xfe98('0x1d')](function(_0x271c09){if(!_0x271c09)return null;_0x3b8626[_0xfe98('0x25')][_0xfe98('0x5e')]=_0x271c09;return _0x3b8626;})['then'](function(_0x2c9d80){if(_0x2c9d80){if(_0x4435d1['body'][_0xfe98('0x74')]){_0x3b8626[_0xfe98('0x25')][_0xfe98('0x75')]=util[_0xfe98('0x5b')](_0xfe98('0x76'),_0x4435d1[_0xfe98('0x5d')][_0xfe98('0x35')]);_0x3b8626[_0xfe98('0x25')][_0xfe98('0x77')]=_0x3b8626[_0xfe98('0x77')];_0x3b8626[_0xfe98('0x25')][_0xfe98('0x78')]=_0x3b8626[_0xfe98('0x77')];_0x3b8626['message']['event']=_0xfe98('0x58');return respondWithRpcPromise(_0xfe98('0x79'),_0xfe98('0x79'),{'event':_0xfe98('0x7a'),'message':_0x3b8626[_0xfe98('0x25')]},client9002)[_0xfe98('0x1d')](function(){return _0x3b8626;});}return _0x3b8626;}return null;})[_0xfe98('0x1d')](respondWithResult(_0x247044,null))[_0xfe98('0x4f')](handleError(_0x247044,null));};var interaction_log=require(_0xfe98('0x11'))(_0xfe98('0x57'));exports[_0xfe98('0x30')]=function(_0x25dea1,_0x162294,_0x27f70e){var _0x3ddb98={'agent':{},'channel':_0xfe98('0x59')};if(_0x25dea1['body']['id']){delete _0x25dea1[_0xfe98('0x55')]['id'];}_0x25dea1[_0xfe98('0x55')][_0xfe98('0x5c')]=_0x25dea1['body'][_0xfe98('0x5c')]||_0x25dea1[_0xfe98('0x5d')]['id'];_0x3ddb98[_0xfe98('0x5e')]['id']=_0x25dea1[_0xfe98('0x55')][_0xfe98('0x5c')];return db['SmsMessage']['find']({'where':{'id':_0x25dea1[_0xfe98('0x51')]['id'],'UserId':null}})[_0xfe98('0x1d')](handleEntityNotFound(_0x162294,null))['then'](function(_0x56d390){if(_0x56d390){_0x3ddb98['message']=_0x56d390['get']({'plain':!![]});return db[_0xfe98('0x5f')][_0xfe98('0x53')]({'where':{'id':_0x56d390[_0xfe98('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x162294,null))[_0xfe98('0x1d')](function(_0x450c06){if(_0x450c06){_0x3ddb98[_0xfe98('0x64')]=_0x450c06[_0xfe98('0x65')]({'plain':!![]});interaction_log[_0xfe98('0x26')](_0xfe98('0x7b'),_0x25dea1[_0xfe98('0x5d')]['id'],_0x25dea1['user']['name'],_0x25dea1['user'][_0xfe98('0x67')],_0x3ddb98[_0xfe98('0x64')]['id'],_0x25dea1[_0xfe98('0x55')]?JSON[_0xfe98('0x22')](_0x25dea1[_0xfe98('0x55')]):_0xfe98('0x68'));return respondWithRpcPromise(_0xfe98('0x7c'),_0xfe98('0x7d'),_0x3ddb98);}return null;})['then'](function(_0x5df11e){var _0x55322a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5df11e[_0xfe98('0x25')][_0xfe98('0x6c')];return db[_0xfe98('0x6d')][_0xfe98('0x3d')](_0x55322a,{'type':db[_0xfe98('0x6e')][_0xfe98('0x6f')]['SELECT'],'raw':!![]})[_0xfe98('0x1d')](function(_0x2798d9){return _0x2798d9;});})['then'](function(_0x4a9028){if(_0x4a9028){_0x3ddb98[_0xfe98('0x25')][_0xfe98('0x7e')]=_0x4a9028[0x0];if(!_0x25dea1['body'][_0xfe98('0x5c')])return;return db[_0xfe98('0x7f')]['find']({'where':{'id':_0x25dea1[_0xfe98('0x55')]['UserId'],'role':_0xfe98('0x5e')},'attributes':['id',_0xfe98('0x35'),_0xfe98('0x71'),_0xfe98('0x72'),'internal'],'raw':!![]});}return null;})[_0xfe98('0x1d')](function(_0x42921a){if(!_0x42921a)return null;_0x3ddb98[_0xfe98('0x25')]['agent']=_0x42921a;return _0x3ddb98;})[_0xfe98('0x1d')](function(_0x406758){if(_0x406758){_0x406758['message'][_0xfe98('0x75')]=util[_0xfe98('0x5b')](_0xfe98('0x76'),_0x25dea1[_0xfe98('0x5d')]['name']);_0x406758[_0xfe98('0x25')][_0xfe98('0x77')]=_0x3ddb98[_0xfe98('0x77')];_0x406758[_0xfe98('0x25')]['motionChannel']=_0x3ddb98['channel'];_0x406758['message'][_0xfe98('0x80')]=_0xfe98('0x30');respondWithRpcPromise(_0xfe98('0x79'),_0xfe98('0x79'),{'event':_0xfe98('0x81'),'message':_0x406758[_0xfe98('0x25')]},client9002);return _0x3ddb98;}return null;})[_0xfe98('0x1d')](respondWithResult(_0x162294,null))[_0xfe98('0x4f')](handleError(_0x162294,null));};exports[_0xfe98('0x28')]=function(_0x1f21f7,_0xd367d9,_0x5cf971){if(_0x1f21f7[_0xfe98('0x55')]['id']){delete _0x1f21f7['body']['id'];}var _0xf1118;return db[_0xfe98('0x4b')][_0xfe98('0x53')]({'where':{'id':_0x1f21f7[_0xfe98('0x51')]['id']}})['then'](handleEntityNotFound(_0xd367d9,null))['then'](function(_0x1598db){if(_0x1598db){_0xf1118=_0x1598db;return db['SmsAccount'][_0xfe98('0x53')]({'where':{'id':_0x1598db[_0xfe98('0x82')]}});}})[_0xfe98('0x1d')](handleEntityNotFound(_0xd367d9,null))[_0xfe98('0x1d')](function(_0x362854){if(_0x362854){logger[_0xfe98('0x20')](_0xfe98('0x21'),_0xfe98('0x28'),_0xfe98('0x83'),_0x362854[_0xfe98('0x3b')],util[_0xfe98('0x84')](_0x1f21f7['body'],{'showHidden':![],'depth':null}));switch(_0x362854[_0xfe98('0x3b')]){case'twilio':if(_0x1f21f7[_0xfe98('0x55')]['MessageSid']&&_0x1f21f7[_0xfe98('0x55')][_0xfe98('0x85')]===_0xf1118[_0xfe98('0x86')]){return _0xf1118[_0xfe98('0x32')]({'read':!![]});}else{logger[_0xfe98('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe98('0x28'),_0xfe98('0x87'),util['inspect'](_0x1f21f7[_0xfe98('0x55')],{'showHidden':![],'depth':null}));}break;case _0xfe98('0x88'):if(_0x1f21f7[_0xfe98('0x55')][_0xfe98('0x89')]&&_0x1f21f7[_0xfe98('0x55')][_0xfe98('0x89')]===_0xf1118[_0xfe98('0x86')]&&_[_0xfe98('0x8a')](['sent','delivered'],_0x1f21f7[_0xfe98('0x55')]['Status'])>=0x0){return _0xf1118[_0xfe98('0x32')]({'read':!![]});}else{logger[_0xfe98('0x23')](_0xfe98('0x8b'),_0xfe98('0x28'),'plivio',util['inspect'](_0x1f21f7[_0xfe98('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4b0c1e=_0x1f21f7[_0xfe98('0x55')]['results'][0x0];if(_0x4b0c1e[_0xfe98('0x28')][_0xfe98('0x8c')]===_0xfe98('0x8d')){return _0xf1118[_0xfe98('0x32')]({'read':!![]});}else{logger[_0xfe98('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe98('0x28'),_0xfe98('0x8e'),util[_0xfe98('0x84')](_0x1f21f7[_0xfe98('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xf1118;}})[_0xfe98('0x1d')](respondWithResult(_0xd367d9,null))[_0xfe98('0x4f')](handleError(_0xd367d9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 93a5229..7204fea 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 _0x9a60=['hook','../../mysqldb','SmsMessage','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x408d58,_0x4ffeae){var _0x4a4ccf=function(_0x194f67){while(--_0x194f67){_0x408d58['push'](_0x408d58['shift']());}};_0x4a4ccf(++_0x4ffeae);}(_0x9a60,0xbe));var _0x09a6=function(_0x10ba4f,_0xa870a4){_0x10ba4f=_0x10ba4f-0x0;var _0x4fdcec=_0x9a60[_0x10ba4f];return _0x4fdcec;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x09a6('0x0'))['db'][_0x09a6('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x09a6('0x2')](0x0);var events={'afterCreate':_0x09a6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x212247){return function(_0xfdc6b9,_0x40c406,_0x2dcef1){SmsMessageEvents[_0x09a6('0x4')](_0x212247+':'+_0xfdc6b9['id'],_0xfdc6b9);SmsMessageEvents[_0x09a6('0x4')](_0x212247,_0xfdc6b9);_0x2dcef1(null);};}for(var e in events){if(events[_0x09a6('0x5')](e)){var event=events[e];SmsMessage[_0x09a6('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x0416=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0x0416,0x12a));var _0x6041=function(_0x1d6c57,_0xae8f05){_0x1d6c57=_0x1d6c57-0x0;var _0x531f65=_0x0416[_0x1d6c57];return _0x531f65;};'use strict';var EventEmitter=require(_0x6041('0x0'));var SmsMessage=require(_0x6041('0x1'))['db'][_0x6041('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6041('0x3')](0x0);var events={'afterCreate':_0x6041('0x4'),'afterUpdate':_0x6041('0x5'),'afterDestroy':'remove'};function emitEvent(_0x31216e){return function(_0x3e9620,_0x860a75,_0x2884ed){SmsMessageEvents[_0x6041('0x6')](_0x31216e+':'+_0x3e9620['id'],_0x3e9620);SmsMessageEvents[_0x6041('0x6')](_0x31216e,_0x3e9620);_0x2884ed(null);};}for(var e in events){if(events[_0x6041('0x7')](e)){var event=events[e];SmsMessage[_0x6041('0x8')](e,emitEvent(event));}}module[_0x6041('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ecf49d3..683297a 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 _0x4e64=['csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','accountId','applicationId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','xCALLY\x20Motion','format','Basic\x20%s','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','application/json','deliveryReport','infobip','Missing\x20parameters:\x20base_url','apiKey','text','length','createHash','md5','/external/get/send.php?','keys','id_sms'];(function(_0x4bc0f7,_0x329c69){var _0x1fa851=function(_0x53173d){while(--_0x53173d){_0x4bc0f7['push'](_0x4bc0f7['shift']());}};_0x1fa851(++_0x329c69);}(_0x4e64,0xf3));var _0x44e6=function(_0x3b0295,_0x218b0b){_0x3b0295=_0x3b0295-0x0;var _0x2cdd32=_0x4e64[_0x3b0295];return _0x2cdd32;};'use strict';var _=require('lodash');var util=require(_0x44e6('0x0'));var logger=require(_0x44e6('0x1'))('api');var moment=require(_0x44e6('0x2'));var BPromise=require(_0x44e6('0x3'));var rp=require(_0x44e6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44e6('0x5'));var attributes=require('./smsMessage.attributes');module[_0x44e6('0x6')]=function(_0x4b7aec,_0x25148b){return _0x4b7aec[_0x44e6('0x7')](_0x44e6('0x8'),attributes,{'tableName':_0x44e6('0x9'),'paranoid':![],'indexes':[{'name':_0x44e6('0xa'),'fields':[_0x44e6('0xa')]},{'name':'fti_sms_messages','fields':[_0x44e6('0xb')],'type':_0x44e6('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x178907,_0x396c4c,_0x5dfcc9){var _0x3abfd2=_0x4b7aec['models'];var _0x3a23e8=_0x178907[_0x44e6('0xd')]({'plain':!![]});if(_0x3a23e8['direction'][_0x44e6('0xe')]()==='in'||_0x3a23e8[_0x44e6('0xf')]['toLowerCase']()===_0x44e6('0x10')&&!_0x3a23e8['secret']&&!_[_0x44e6('0x11')](_0x3a23e8[_0x44e6('0x12')])&&!_[_0x44e6('0x11')](_0x3a23e8[_0x44e6('0x13')])){_0x3abfd2['SmsInteraction'][_0x44e6('0x14')]({'where':{'id':_0x3a23e8['SmsInteractionId']}})[_0x44e6('0x15')](function(_0x3b0360){if(_0x3b0360){_0x3b0360[_0x44e6('0x16')]({'lastMsgAt':_0x3a23e8[_0x44e6('0x17')],'lastMsgDirection':_0x3a23e8[_0x44e6('0xf')][_0x44e6('0xe')]()});}})[_0x44e6('0x18')](function(_0x1ab98f){console[_0x44e6('0x19')](_0x1ab98f);});}if(_0x3a23e8['direction']===_0x44e6('0x10')&&!_0x3a23e8[_0x44e6('0x1a')]){var _0x3cc5b8;_0x3abfd2[_0x44e6('0x1b')][_0x44e6('0x1c')]({'where':{'id':_0x3a23e8[_0x44e6('0x1d')]},'raw':!![]})['then'](function(_0x564d18){_0x3cc5b8=_0x564d18;if(_0x3cc5b8&&_0x3cc5b8[_0x44e6('0x1e')]){switch(_0x3cc5b8[_0x44e6('0x1e')]){case'twilio':var _0x4b989e=require(_0x44e6('0x1f'));if(_0x3cc5b8[_0x44e6('0x20')]&&_0x3cc5b8[_0x44e6('0x21')]&&_0x3cc5b8[_0x44e6('0x22')]){var _0x33ec0d=new _0x4b989e(_0x3cc5b8[_0x44e6('0x20')],_0x3cc5b8[_0x44e6('0x21')]);_0x33ec0d['messages'][_0x44e6('0x23')]({'body':_0x3a23e8[_0x44e6('0xb')],'to':_0x3a23e8[_0x44e6('0x22')],'from':_0x3cc5b8[_0x44e6('0x22')],'statusCallback':_0x3cc5b8[_0x44e6('0x24')]+_0x44e6('0x25')+_0x3a23e8['id']+_0x44e6('0x26')+_0x3cc5b8[_0x44e6('0x27')]})[_0x44e6('0x15')](function(_0x2c8e98){if(_0x2c8e98[_0x44e6('0x28')]){return _0x178907[_0x44e6('0x16')]({'messageId':_0x2c8e98['sid']});}})[_0x44e6('0x18')](function(_0x1dd549){logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),'twilio',util[_0x44e6('0x2b')](_0x1dd549,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x1f'),_0x44e6('0x2c'));}break;case _0x44e6('0x2d'):var _0x48a55a=_0x44e6('0x2e');if(_0x3cc5b8[_0x44e6('0x2f')]&&_0x3cc5b8[_0x44e6('0x30')]){var _0x217e06={'recipient':[_0x3a23e8[_0x44e6('0x22')]],'message':_0x3a23e8[_0x44e6('0xb')],'message_type':_0x3cc5b8['smsMethod']};if(_0x3cc5b8[_0x44e6('0x31')]&&_0x3cc5b8['smsMethod']!=='SI'){_0x217e06[_0x44e6('0x32')]=_0x3cc5b8[_0x44e6('0x22')];}var _0xb7394d={'url':_0x48a55a+_0x44e6('0x33')+_0x3cc5b8[_0x44e6('0x2f')]+_0x44e6('0x34')+_0x3cc5b8[_0x44e6('0x30')],'method':_0x44e6('0x35')};rp(_0xb7394d)['then'](function(_0x3dbf52){var _0x3f80f9=_0x3dbf52[_0x44e6('0x36')](';');var _0x4b494b={'user_key':_0x3f80f9[0x0],'session_key':_0x3f80f9[0x1]};_0xb7394d={'url':_0x48a55a+_0x44e6('0x37'),'method':_0x44e6('0x38'),'headers':{'user_key':_0x4b494b['user_key'],'Session_key':_0x4b494b['session_key']},'json':!![],'body':_0x217e06};return rp(_0xb7394d);})[_0x44e6('0x15')](function(_0x1584a8){if(_0x1584a8[_0x44e6('0x39')]>=0x1){var _0x203ad1={'messageId':_0x1584a8[_0x44e6('0x3a')]};if(_0x3cc5b8['smsMethod']!=='GP'||!_0x3cc5b8['deliveryReport']){_0x203ad1[_0x44e6('0x3b')]=!![];}return _0x178907['update'](_0x203ad1);}else{return logger[_0x44e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44e6('0x2a'),'skebby',util[_0x44e6('0x2b')](_0x1584a8,{'showHidden':![],'depth':null}));}})[_0x44e6('0x18')](function(_0x120a1f){return logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x2d'),util[_0x44e6('0x2b')](_0x120a1f,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44e6('0x2a'),'skebby',_0x44e6('0x3c'));}break;case _0x44e6('0x3d'):if(_0x3cc5b8['authToken']){var _0x1ded4c={'recipient':_0x3a23e8[_0x44e6('0x22')],'message':_0x3a23e8[_0x44e6('0xb')],'sender':_0x3cc5b8[_0x44e6('0x3e')]||_0x3cc5b8['phone'],'authorization':_0x3cc5b8[_0x44e6('0x21')]};var _0x396c4c={'method':_0x44e6('0x38'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x1ded4c,'json':!![]};rp(_0x396c4c)['then'](function(_0x53c247){var _0x38f4e6={'messageId':_0x53c247[_0x44e6('0x3f')]};if(!_0x3cc5b8['deliveryReport']){_0x38f4e6[_0x44e6('0x3b')]=!![];}return _0x178907[_0x44e6('0x16')](_0x38f4e6);})['catch'](function(_0xd57feb){logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate',_0x44e6('0x3d'),util['inspect'](_0xd57feb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x3d'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x3cc5b8[_0x44e6('0x2f')]&&_0x3cc5b8['password']){var _0x1ded4c={'messages':[{'source':_0x44e6('0x40'),'to':_0x3a23e8['phone'],'body':_0x3a23e8['body'],'from':_0x3cc5b8[_0x44e6('0x3e')]||_0x3cc5b8['phone']}]};var _0x4c9c9a=util['format']('%s:%s',_0x3cc5b8['username'],_0x3cc5b8[_0x44e6('0x30')]);var _0x396c4c={'method':_0x44e6('0x38'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1ded4c,'headers':{'Authorization':util[_0x44e6('0x41')](_0x44e6('0x42'),new Buffer(_0x4c9c9a)['toString']('base64'))},'json':!![]};rp(_0x396c4c)[_0x44e6('0x15')](function(_0x57da1e){if(_0x57da1e['http_code']>=0xc8&&_0x57da1e[_0x44e6('0x43')]<=0xce){if(_0x57da1e[_0x44e6('0x44')]&&_0x57da1e[_0x44e6('0x44')][_0x44e6('0x45')]>0x0){var _0x170802=_[_0x44e6('0x46')](_0x57da1e['data'][_0x44e6('0x47')]);var _0x289fd6={'messageId':_0x170802[_0x44e6('0x48')]};if(!_0x3cc5b8['deliveryReport']){_0x289fd6[_0x44e6('0x3b')]=!![];}return _0x178907[_0x44e6('0x16')](_0x289fd6);}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x49'),util['inspect'](_0x57da1e,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0x57da1e,{'showHidden':![],'depth':null}));}})[_0x44e6('0x18')](function(_0x22006f){logger['error'](_0x44e6('0x29'),'afterCreate',_0x44e6('0x49'),util[_0x44e6('0x2b')](_0x22006f,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x49'),_0x44e6('0x3c'));}break;case _0x44e6('0x4a'):if(_0x3cc5b8[_0x44e6('0x4b')]&&_0x3cc5b8[_0x44e6('0x21')]){var _0x1ded4c={'dst':_0x3a23e8[_0x44e6('0x22')],'text':_0x3a23e8[_0x44e6('0xb')],'src':_0x3cc5b8[_0x44e6('0x3e')]||_0x3cc5b8['phone'],'url':_0x3cc5b8[_0x44e6('0x24')]+'/api/sms/messages/'+_0x3a23e8['id']+_0x44e6('0x26')+_0x3cc5b8['token']};var _0x4c9c9a=util[_0x44e6('0x41')]('%s:%s',_0x3cc5b8[_0x44e6('0x4b')],_0x3cc5b8[_0x44e6('0x21')]);var _0x396c4c={'method':_0x44e6('0x38'),'uri':util[_0x44e6('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3cc5b8[_0x44e6('0x4b')]),'body':_0x1ded4c,'headers':{'Authorization':util[_0x44e6('0x41')](_0x44e6('0x42'),new Buffer(_0x4c9c9a)[_0x44e6('0x4c')]('base64'))},'json':!![]};rp(_0x396c4c)['then'](function(_0x586607){var _0x271065={'messageId':_0x586607[_0x44e6('0x4d')][0x0]};return _0x178907[_0x44e6('0x16')](_0x271065);})['catch'](function(_0x23af99){logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate',_0x44e6('0x4a'),util[_0x44e6('0x2b')](_0x23af99,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x4a'),_0x44e6('0x4e'));}break;case'infobip':if(_0x3cc5b8['username']&&_0x3cc5b8[_0x44e6('0x30')]){if(_0x3cc5b8[_0x44e6('0x4f')]){var _0x2e64c6={'method':_0x44e6('0x38'),'uri':_0x3cc5b8['baseUrl']+_0x44e6('0x50'),'body':{'username':_0x3cc5b8['username'],'password':_0x3cc5b8[_0x44e6('0x30')]},'json':!![]};return rp(_0x2e64c6)['then'](function(_0x16bf0e){var _0x6151d5={'method':_0x44e6('0x38'),'uri':_0x3cc5b8['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3cc5b8[_0x44e6('0x22')],'destinations':[{'to':_0x3a23e8[_0x44e6('0x22')]}],'text':_0x3a23e8[_0x44e6('0xb')],'notifyUrl':_0x3cc5b8[_0x44e6('0x24')]+'/api/sms/messages/'+_0x3a23e8['id']+_0x44e6('0x26')+_0x3cc5b8[_0x44e6('0x27')],'notifyContentType':_0x44e6('0x51'),'callbackData':_0x3cc5b8[_0x44e6('0x22')]+';'+_0x3a23e8[_0x44e6('0xb')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x16bf0e[_0x44e6('0x27')]},'json':!![]};return rp(_0x6151d5)[_0x44e6('0x15')](function(_0x24d01c){if(_0x24d01c[_0x44e6('0x47')]){var _0x3b3997={'messageId':_0x24d01c[_0x44e6('0x47')][0x0][_0x44e6('0xa')]};if(!_0x3cc5b8[_0x44e6('0x52')]){_0x3b3997[_0x44e6('0x3b')]=!![];}return _0x178907[_0x44e6('0x16')](_0x3b3997);}else{return logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),'infobip',util[_0x44e6('0x2b')](_0x24d01c,{'showHidden':![],'depth':null}));}});})[_0x44e6('0x18')](function(_0x5428ac){return logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate',_0x44e6('0x53'),util[_0x44e6('0x2b')](_0x5428ac,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x53'),_0x44e6('0x54'));}}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate',_0x44e6('0x53'),_0x44e6('0x3c'));}break;case'csc':var _0x3ac3c4=require('crypto');if(_0x3cc5b8[_0x44e6('0x55')]){var _0x2c3d2c={};_0x2c3d2c['login']=_0x3cc5b8['username'];_0x2c3d2c[_0x44e6('0x22')]=_0x3a23e8[_0x44e6('0x22')];_0x2c3d2c[_0x44e6('0x32')]=_0x3cc5b8[_0x44e6('0x22')];_0x2c3d2c[_0x44e6('0x56')]=_0x3a23e8['body'];_0x2c3d2c['timestamp']=+new Date();var _0x50f39b='';var _0xcf0083='';var _0x2d9d20=Object['keys'](_0x2c3d2c);_0x2d9d20['sort']();for(var _0x2dbdde=0x0;_0x2dbdde<_0x2d9d20[_0x44e6('0x57')];_0x2dbdde++){if(_0x50f39b!=''){_0x50f39b+='&';}_0x50f39b+=_0x2d9d20[_0x2dbdde]+'='+encodeURIComponent(_0x2c3d2c[_0x2d9d20[_0x2dbdde]]);_0xcf0083+=_0x2c3d2c[_0x2d9d20[_0x2dbdde]];}_0xcf0083+=_0x3cc5b8[_0x44e6('0x55')];_0xcf0083=_0x3ac3c4[_0x44e6('0x58')](_0x44e6('0x59'))[_0x44e6('0x16')](_0xcf0083)['digest']('hex');if(_0x50f39b!==''){_0x50f39b+='&';}_0x50f39b+='signature='+_0xcf0083;var _0xb7394d={'method':_0x44e6('0x35'),'uri':_0x3cc5b8[_0x44e6('0x4f')]+_0x44e6('0x5a')+_0x50f39b,'json':!![]};return rp(_0xb7394d)[_0x44e6('0x15')](function(_0x4c2e23){var _0x47552d=Object[_0x44e6('0x5b')](_0x4c2e23);if(_0x4c2e23[_0x47552d[0x0]][_0x44e6('0x19')]&&parseInt(_0x4c2e23[_0x47552d[0x0]][_0x44e6('0x19')])===0x0){var _0x2f2491={'messageId':_0x4c2e23[_0x47552d[0x0]][_0x44e6('0x5c')]};if(!_0x3cc5b8[_0x44e6('0x52')]){_0x2f2491[_0x44e6('0x3b')]=!![];}return _0x178907[_0x44e6('0x16')](_0x2f2491);}else{return logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x5d'),util[_0x44e6('0x2b')](_0x4c2e23[_0x44e6('0x19')],{'showHidden':![],'depth':null}));}})[_0x44e6('0x18')](function(_0x23ff6c){return logger['error'](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x5d'),util[_0x44e6('0x2b')](_0x23ff6c,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate','csc',_0x44e6('0x5e'));}break;case _0x44e6('0x5f'):if(_0x3cc5b8[_0x44e6('0x55')]){var _0x12922e={'method':_0x44e6('0x38'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3cc5b8[_0x44e6('0x55')]},'body':{'content':_0x3a23e8[_0x44e6('0xb')],'to':[_0x3a23e8[_0x44e6('0x22')]],'from':_0x3cc5b8[_0x44e6('0x22')],'binary':![],'clientMessageId':_0x44e6('0x60'),'charset':'UTF-8'},'json':!![]};rp(_0x12922e)['then'](function(_0x36f40b){if(!_0x36f40b[_0x44e6('0x19')]){var _0x48f50c={'messageId':_0x36f40b['messages'][0x0]['apiMessageId']};if(!_0x3cc5b8[_0x44e6('0x52')]){_0x48f50c['read']=!![];}return _0x178907[_0x44e6('0x16')](_0x48f50c);}else{return logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate','clickatell',util[_0x44e6('0x2b')](_0x36f40b[_0x44e6('0x19')],{'showHidden':![],'depth':null}));}})[_0x44e6('0x18')](function(_0x39e51b){return logger[_0x44e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44e6('0x2a'),_0x44e6('0x5f'),util[_0x44e6('0x2b')](_0x39e51b,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x5f'),_0x44e6('0x5e'));}break;case _0x44e6('0x61'):if(_0x3cc5b8[_0x44e6('0x2f')]&&_0x3cc5b8[_0x44e6('0x30')]){var _0x4c9c9a=util[_0x44e6('0x41')]('%s:%s',_0x3cc5b8['username'],_0x3cc5b8[_0x44e6('0x30')]);var _0x396c4c={'method':_0x44e6('0x38'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3cc5b8[_0x44e6('0x62')]+'/messages','body':{'to':[_0x3a23e8[_0x44e6('0x22')]],'text':_0x3a23e8['body'],'from':_0x3cc5b8['phone'],'applicationId':_0x3cc5b8[_0x44e6('0x63')]},'headers':{'Authorization':util['format'](_0x44e6('0x42'),new Buffer(_0x4c9c9a)[_0x44e6('0x4c')](_0x44e6('0x64')))},'json':!![]};rp(_0x396c4c)[_0x44e6('0x15')](function(_0x1489aa){if(_0x1489aa['id']){var _0x420cc5={'messageId':_0x1489aa['id']};return _0x178907[_0x44e6('0x16')](_0x420cc5);}else{logger[_0x44e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44e6('0x2a'),'bandwidth',util[_0x44e6('0x2b')](_0x1489aa,{'showHidden':![],'depth':null}));}})[_0x44e6('0x18')](function(_0x337145){logger[_0x44e6('0x19')](_0x44e6('0x29'),_0x44e6('0x2a'),_0x44e6('0x61'),util[_0x44e6('0x2b')](_0x337145,{'showHidden':![],'depth':null}));});}else{logger[_0x44e6('0x19')](_0x44e6('0x29'),'afterCreate',_0x44e6('0x61'),_0x44e6('0x3c'));}break;case _0x44e6('0x65'):if(_0x3cc5b8[_0x44e6('0x55')]){var _0x35491d={};var _0xb7394d={'method':'POST','uri':_0x44e6('0x66'),'headers':{'Authorization':_0x44e6('0x67')+_0x3cc5b8['apiKey'],'Content-Type':_0x44e6('0x51')},'body':{'from':_0x3cc5b8[_0x44e6('0x22')],'to':_0x3a23e8[_0x44e6('0x22')],'text':_0x3a23e8['body']},'json':!![]};return rp(_0xb7394d)[_0x44e6('0x15')](function(_0x2cfb35){if(_0x2cfb35[_0x44e6('0x68')]==0xca){_0x35491d['message']=_0x2cfb35;var _0x11d7d1={'method':_0x44e6('0x38'),'uri':_0x44e6('0x69'),'headers':{'Authorization':_0x44e6('0x67')+_0x3cc5b8[_0x44e6('0x55')],'Content-Type':_0x44e6('0x51')},'body':{'refid':_0x35491d['message']['refid']},'json':!![]};return rp(_0x11d7d1)[_0x44e6('0x15')](function(_0x368100){_0x35491d[_0x44e6('0x6a')]=_0x368100;var _0x3782ff={'messageId':_0x35491d['message'][_0x44e6('0x6b')],'read':!![]};return _0x178907[_0x44e6('0x16')](_0x3782ff);});}else{return logger[_0x44e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x2cfb35,{'showHidden':![],'depth':null}));}})['catch'](function(_0x50e771){return logger['error'](_0x44e6('0x29'),'afterCreate',_0x44e6('0x65'),util[_0x44e6('0x2b')](_0x50e771,{'showHidden':![],'depth':null}));});}else{return logger[_0x44e6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44e6('0x2a'),'intelepeer',_0x44e6('0x6c'));}break;}}})[_0x44e6('0x6d')](function(){_0x5dfcc9();});}else{_0x5dfcc9();}}},'charset':_0x44e6('0x6e'),'collate':_0x44e6('0x6f')});}; \ No newline at end of file +var _0x0573=['../../config/environment','exports','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','direction','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','password','smsMethod','sender','login?username=','username','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','data','queued_count','clickSend','plivo','authId','senderString','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','createHash','md5','hex','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','apiMessageId','accountId','applicationId','base64','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xa2ad4,_0x129bff){var _0x456b01=function(_0x590439){while(--_0x590439){_0xa2ad4['push'](_0xa2ad4['shift']());}};_0x456b01(++_0x129bff);}(_0x0573,0xe4));var _0x3057=function(_0x3a7f86,_0xab4a2e){_0x3a7f86=_0x3a7f86-0x0;var _0x1242b9=_0x0573[_0x3a7f86];return _0x1242b9;};'use strict';var _=require(_0x3057('0x0'));var util=require(_0x3057('0x1'));var logger=require(_0x3057('0x2'))(_0x3057('0x3'));var moment=require(_0x3057('0x4'));var BPromise=require('bluebird');var rp=require(_0x3057('0x5'));var fs=require('fs');var path=require(_0x3057('0x6'));var rimraf=require(_0x3057('0x7'));var config=require(_0x3057('0x8'));var attributes=require('./smsMessage.attributes');module[_0x3057('0x9')]=function(_0x56f2ac,_0x5ad43c){return _0x56f2ac['define']('SmsMessage',attributes,{'tableName':_0x3057('0xa'),'paranoid':![],'indexes':[{'name':_0x3057('0xb'),'fields':[_0x3057('0xb')]},{'name':_0x3057('0xc'),'fields':[_0x3057('0xd')],'type':_0x3057('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24524b,_0x109814,_0x44cfaa){var _0x5db48e=_0x56f2ac['models'];var _0x5384f4=_0x24524b[_0x3057('0xf')]({'plain':!![]});if(_0x5384f4['direction'][_0x3057('0x10')]()==='in'||_0x5384f4['direction'][_0x3057('0x10')]()===_0x3057('0x11')&&!_0x5384f4['secret']&&!_[_0x3057('0x12')](_0x5384f4[_0x3057('0x13')])&&!_[_0x3057('0x12')](_0x5384f4[_0x3057('0x14')])){_0x5db48e[_0x3057('0x15')][_0x3057('0x16')]({'where':{'id':_0x5384f4[_0x3057('0x14')]}})[_0x3057('0x17')](function(_0x54ee64){if(_0x54ee64){_0x54ee64['update']({'lastMsgAt':_0x5384f4[_0x3057('0x18')],'lastMsgDirection':_0x5384f4[_0x3057('0x19')][_0x3057('0x10')]()});}})[_0x3057('0x1a')](function(_0x3344d8){console[_0x3057('0x1b')](_0x3344d8);});}if(_0x5384f4[_0x3057('0x19')]==='out'&&!_0x5384f4['secret']){var _0x246c0a;_0x5db48e['SmsAccount'][_0x3057('0x1c')]({'where':{'id':_0x5384f4[_0x3057('0x1d')]},'raw':!![]})[_0x3057('0x17')](function(_0x3149fa){_0x246c0a=_0x3149fa;if(_0x246c0a&&_0x246c0a[_0x3057('0x1e')]){switch(_0x246c0a[_0x3057('0x1e')]){case _0x3057('0x1f'):var _0x491b4b=require(_0x3057('0x1f'));if(_0x246c0a[_0x3057('0x20')]&&_0x246c0a[_0x3057('0x21')]&&_0x246c0a['phone']){var _0x54f66d=new _0x491b4b(_0x246c0a[_0x3057('0x20')],_0x246c0a['authToken']);_0x54f66d[_0x3057('0x22')][_0x3057('0x23')]({'body':_0x5384f4[_0x3057('0xd')],'to':_0x5384f4[_0x3057('0x24')],'from':_0x246c0a[_0x3057('0x24')],'statusCallback':_0x246c0a[_0x3057('0x25')]+'/api/sms/messages/'+_0x5384f4['id']+_0x3057('0x26')+_0x246c0a[_0x3057('0x27')]})[_0x3057('0x17')](function(_0x511a86){if(_0x511a86[_0x3057('0x28')]){return _0x24524b[_0x3057('0x29')]({'messageId':_0x511a86[_0x3057('0x28')]});}})[_0x3057('0x1a')](function(_0x31b203){logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),'twilio',util[_0x3057('0x2c')](_0x31b203,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),'twilio',_0x3057('0x2d'));}break;case'skebby':var _0x4a543d='https://api.skebby.it/API/v1.0/REST/';if(_0x246c0a['username']&&_0x246c0a[_0x3057('0x2e')]){var _0x4e75a0={'recipient':[_0x5384f4[_0x3057('0x24')]],'message':_0x5384f4['body'],'message_type':_0x246c0a['smsMethod']};if(_0x246c0a[_0x3057('0x2f')]&&_0x246c0a[_0x3057('0x2f')]!=='SI'){_0x4e75a0[_0x3057('0x30')]=_0x246c0a[_0x3057('0x24')];}var _0x19ac7b={'url':_0x4a543d+_0x3057('0x31')+_0x246c0a[_0x3057('0x32')]+_0x3057('0x33')+_0x246c0a[_0x3057('0x2e')],'method':'GET'};rp(_0x19ac7b)['then'](function(_0x28932e){var _0x211095=_0x28932e['split'](';');var _0x319a4a={'user_key':_0x211095[0x0],'session_key':_0x211095[0x1]};_0x19ac7b={'url':_0x4a543d+_0x3057('0x34'),'method':_0x3057('0x35'),'headers':{'user_key':_0x319a4a[_0x3057('0x36')],'Session_key':_0x319a4a[_0x3057('0x37')]},'json':!![],'body':_0x4e75a0};return rp(_0x19ac7b);})[_0x3057('0x17')](function(_0x16a7cd){if(_0x16a7cd[_0x3057('0x38')]>=0x1){var _0x5c982b={'messageId':_0x16a7cd[_0x3057('0x39')]};if(_0x246c0a[_0x3057('0x2f')]!=='GP'||!_0x246c0a[_0x3057('0x3a')]){_0x5c982b[_0x3057('0x3b')]=!![];}return _0x24524b['update'](_0x5c982b);}else{return logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3c'),util[_0x3057('0x2c')](_0x16a7cd,{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x3b8426){return logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x3c'),util[_0x3057('0x2c')](_0x3b8426,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3c'),_0x3057('0x3d'));}break;case _0x3057('0x3e'):if(_0x246c0a['authToken']){var _0x4f1c3d={'recipient':_0x5384f4[_0x3057('0x24')],'message':_0x5384f4[_0x3057('0xd')],'sender':_0x246c0a['senderString']||_0x246c0a[_0x3057('0x24')],'authorization':_0x246c0a[_0x3057('0x21')]};var _0x109814={'method':_0x3057('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4f1c3d,'json':!![]};rp(_0x109814)['then'](function(_0x4046ff){var _0x36db9e={'messageId':_0x4046ff[_0x3057('0x3f')]};if(!_0x246c0a[_0x3057('0x3a')]){_0x36db9e[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x36db9e);})['catch'](function(_0x5437cd){logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3e'),util[_0x3057('0x2c')](_0x5437cd,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x3e'),_0x3057('0x40'));}break;case _0x3057('0x41'):if(_0x246c0a[_0x3057('0x32')]&&_0x246c0a[_0x3057('0x2e')]){var _0x4f1c3d={'messages':[{'source':_0x3057('0x42'),'to':_0x5384f4['phone'],'body':_0x5384f4[_0x3057('0xd')],'from':_0x246c0a['senderString']||_0x246c0a[_0x3057('0x24')]}]};var _0xe80e3a=util[_0x3057('0x43')](_0x3057('0x44'),_0x246c0a[_0x3057('0x32')],_0x246c0a[_0x3057('0x2e')]);var _0x109814={'method':_0x3057('0x35'),'uri':_0x3057('0x45'),'body':_0x4f1c3d,'headers':{'Authorization':util[_0x3057('0x43')](_0x3057('0x46'),new Buffer(_0xe80e3a)['toString']('base64'))},'json':!![]};rp(_0x109814)[_0x3057('0x17')](function(_0x52aec9){if(_0x52aec9['http_code']>=0xc8&&_0x52aec9['http_code']<=0xce){if(_0x52aec9[_0x3057('0x47')]&&_0x52aec9[_0x3057('0x47')][_0x3057('0x48')]>0x0){var _0x5e46ba=_['head'](_0x52aec9[_0x3057('0x47')][_0x3057('0x22')]);var _0x199828={'messageId':_0x5e46ba['message_id']};if(!_0x246c0a[_0x3057('0x3a')]){_0x199828[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x199828);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x49'),util[_0x3057('0x2c')](_0x52aec9,{'showHidden':![],'depth':null}));}}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),'afterCreate',_0x3057('0x49'),util[_0x3057('0x2c')](_0x52aec9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x494504){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x49'),util['inspect'](_0x494504,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x49'),_0x3057('0x3d'));}break;case _0x3057('0x4a'):if(_0x246c0a[_0x3057('0x4b')]&&_0x246c0a[_0x3057('0x21')]){var _0x4f1c3d={'dst':_0x5384f4['phone'],'text':_0x5384f4[_0x3057('0xd')],'src':_0x246c0a[_0x3057('0x4c')]||_0x246c0a['phone'],'url':_0x246c0a[_0x3057('0x25')]+_0x3057('0x4d')+_0x5384f4['id']+'/status?token='+_0x246c0a[_0x3057('0x27')]};var _0xe80e3a=util[_0x3057('0x43')](_0x3057('0x44'),_0x246c0a[_0x3057('0x4b')],_0x246c0a[_0x3057('0x21')]);var _0x109814={'method':'POST','uri':util['format'](_0x3057('0x4e'),_0x246c0a[_0x3057('0x4b')]),'body':_0x4f1c3d,'headers':{'Authorization':util[_0x3057('0x43')](_0x3057('0x46'),new Buffer(_0xe80e3a)[_0x3057('0x4f')]('base64'))},'json':!![]};rp(_0x109814)[_0x3057('0x17')](function(_0x4f925b){var _0x113781={'messageId':_0x4f925b['message_uuid'][0x0]};return _0x24524b[_0x3057('0x29')](_0x113781);})[_0x3057('0x1a')](function(_0xc51968){logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x4a'),util[_0x3057('0x2c')](_0xc51968,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),'afterCreate','plivo',_0x3057('0x50'));}break;case _0x3057('0x51'):if(_0x246c0a[_0x3057('0x32')]&&_0x246c0a[_0x3057('0x2e')]){if(_0x246c0a[_0x3057('0x52')]){var _0x3bf8ab={'method':'POST','uri':_0x246c0a[_0x3057('0x52')]+_0x3057('0x53'),'body':{'username':_0x246c0a[_0x3057('0x32')],'password':_0x246c0a['password']},'json':!![]};return rp(_0x3bf8ab)[_0x3057('0x17')](function(_0x289228){var _0xab32a0={'method':_0x3057('0x35'),'uri':_0x246c0a[_0x3057('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x246c0a[_0x3057('0x24')],'destinations':[{'to':_0x5384f4[_0x3057('0x24')]}],'text':_0x5384f4[_0x3057('0xd')],'notifyUrl':_0x246c0a[_0x3057('0x25')]+'/api/sms/messages/'+_0x5384f4['id']+_0x3057('0x26')+_0x246c0a['token'],'notifyContentType':_0x3057('0x54'),'callbackData':_0x246c0a['phone']+';'+_0x5384f4[_0x3057('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x289228[_0x3057('0x27')]},'json':!![]};return rp(_0xab32a0)['then'](function(_0x11ecf1){if(_0x11ecf1[_0x3057('0x22')]){var _0x2bb1b7={'messageId':_0x11ecf1[_0x3057('0x22')][0x0][_0x3057('0xb')]};if(!_0x246c0a[_0x3057('0x3a')]){_0x2bb1b7[_0x3057('0x3b')]=!![];}return _0x24524b['update'](_0x2bb1b7);}else{return logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x51'),util[_0x3057('0x2c')](_0x11ecf1,{'showHidden':![],'depth':null}));}});})[_0x3057('0x1a')](function(_0x100169){return logger['error'](_0x3057('0x2a'),'afterCreate',_0x3057('0x51'),util[_0x3057('0x2c')](_0x100169,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x51'),_0x3057('0x55'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x51'),_0x3057('0x3d'));}break;case _0x3057('0x56'):var _0x3c5822=require(_0x3057('0x57'));if(_0x246c0a['apiKey']){var _0x19df68={};_0x19df68[_0x3057('0x58')]=_0x246c0a['username'];_0x19df68[_0x3057('0x24')]=_0x5384f4['phone'];_0x19df68[_0x3057('0x30')]=_0x246c0a[_0x3057('0x24')];_0x19df68[_0x3057('0x59')]=_0x5384f4[_0x3057('0xd')];_0x19df68[_0x3057('0x5a')]=+new Date();var _0x40e8db='';var _0x4dad76='';var _0x5856b6=Object[_0x3057('0x5b')](_0x19df68);_0x5856b6[_0x3057('0x5c')]();for(var _0x2d1216=0x0;_0x2d1216<_0x5856b6['length'];_0x2d1216++){if(_0x40e8db!=''){_0x40e8db+='&';}_0x40e8db+=_0x5856b6[_0x2d1216]+'='+encodeURIComponent(_0x19df68[_0x5856b6[_0x2d1216]]);_0x4dad76+=_0x19df68[_0x5856b6[_0x2d1216]];}_0x4dad76+=_0x246c0a['apiKey'];_0x4dad76=_0x3c5822[_0x3057('0x5d')](_0x3057('0x5e'))[_0x3057('0x29')](_0x4dad76)['digest'](_0x3057('0x5f'));if(_0x40e8db!==''){_0x40e8db+='&';}_0x40e8db+='signature='+_0x4dad76;var _0x19ac7b={'method':_0x3057('0x60'),'uri':_0x246c0a[_0x3057('0x52')]+'/external/get/send.php?'+_0x40e8db,'json':!![]};return rp(_0x19ac7b)['then'](function(_0x256e92){var _0x5cd1fa=Object[_0x3057('0x5b')](_0x256e92);if(_0x256e92[_0x5cd1fa[0x0]][_0x3057('0x1b')]&&parseInt(_0x256e92[_0x5cd1fa[0x0]][_0x3057('0x1b')])===0x0){var _0x5ab5e9={'messageId':_0x256e92[_0x5cd1fa[0x0]][_0x3057('0x61')]};if(!_0x246c0a['deliveryReport']){_0x5ab5e9[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x5ab5e9);}else{return logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x56'),util[_0x3057('0x2c')](_0x256e92[_0x3057('0x1b')],{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x365643){return logger['error'](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x56'),util['inspect'](_0x365643,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x56'),_0x3057('0x62'));}break;case _0x3057('0x63'):if(_0x246c0a[_0x3057('0x64')]){var _0x3c031d={'method':_0x3057('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x246c0a[_0x3057('0x64')]},'body':{'content':_0x5384f4[_0x3057('0xd')],'to':[_0x5384f4[_0x3057('0x24')]],'from':_0x246c0a[_0x3057('0x24')],'binary':![],'clientMessageId':_0x3057('0x65'),'charset':_0x3057('0x66')},'json':!![]};rp(_0x3c031d)['then'](function(_0x2f9b6c){if(!_0x2f9b6c[_0x3057('0x1b')]){var _0x20f5c7={'messageId':_0x2f9b6c['messages'][0x0][_0x3057('0x67')]};if(!_0x246c0a[_0x3057('0x3a')]){_0x20f5c7[_0x3057('0x3b')]=!![];}return _0x24524b[_0x3057('0x29')](_0x20f5c7);}else{return logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x63'),util[_0x3057('0x2c')](_0x2f9b6c[_0x3057('0x1b')],{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x57cf90){return logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),'clickatell',util[_0x3057('0x2c')](_0x57cf90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3057('0x2a'),'afterCreate',_0x3057('0x63'),_0x3057('0x62'));}break;case'bandwidth':if(_0x246c0a[_0x3057('0x32')]&&_0x246c0a['password']){var _0xe80e3a=util[_0x3057('0x43')](_0x3057('0x44'),_0x246c0a[_0x3057('0x32')],_0x246c0a[_0x3057('0x2e')]);var _0x109814={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x246c0a[_0x3057('0x68')]+'/messages','body':{'to':[_0x5384f4['phone']],'text':_0x5384f4[_0x3057('0xd')],'from':_0x246c0a[_0x3057('0x24')],'applicationId':_0x246c0a[_0x3057('0x69')]},'headers':{'Authorization':util[_0x3057('0x43')]('Basic\x20%s',new Buffer(_0xe80e3a)[_0x3057('0x4f')](_0x3057('0x6a')))},'json':!![]};rp(_0x109814)[_0x3057('0x17')](function(_0x4e222c){if(_0x4e222c['id']){var _0x56d2f9={'messageId':_0x4e222c['id']};return _0x24524b[_0x3057('0x29')](_0x56d2f9);}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x6b'),util['inspect'](_0x4e222c,{'showHidden':![],'depth':null}));}})[_0x3057('0x1a')](function(_0x5bc1af){logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x6b'),util['inspect'](_0x5bc1af,{'showHidden':![],'depth':null}));});}else{logger[_0x3057('0x1b')](_0x3057('0x2a'),'afterCreate',_0x3057('0x6b'),_0x3057('0x3d'));}break;case'intelepeer':if(_0x246c0a['apiKey']){var _0x2b3e40={};var _0x19ac7b={'method':_0x3057('0x35'),'uri':_0x3057('0x6c'),'headers':{'Authorization':_0x3057('0x6d')+_0x246c0a[_0x3057('0x64')],'Content-Type':_0x3057('0x54')},'body':{'from':_0x246c0a[_0x3057('0x24')],'to':_0x5384f4[_0x3057('0x24')],'text':_0x5384f4[_0x3057('0xd')]},'json':!![]};return rp(_0x19ac7b)[_0x3057('0x17')](function(_0x30d194){if(_0x30d194[_0x3057('0x6e')]==0xca){_0x2b3e40[_0x3057('0x6f')]=_0x30d194;var _0x35dd52={'method':_0x3057('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3057('0x6d')+_0x246c0a['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x2b3e40[_0x3057('0x6f')][_0x3057('0x70')]},'json':!![]};return rp(_0x35dd52)[_0x3057('0x17')](function(_0x1b41d4){_0x2b3e40[_0x3057('0x71')]=_0x1b41d4;var _0x469198={'messageId':_0x2b3e40['message'][_0x3057('0x70')],'read':!![]};return _0x24524b[_0x3057('0x29')](_0x469198);});}else{return logger[_0x3057('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3057('0x2b'),_0x3057('0x72'),util[_0x3057('0x2c')](_0x30d194,{'showHidden':![],'depth':null}));}})['catch'](function(_0x495c68){return logger[_0x3057('0x1b')](_0x3057('0x2a'),'afterCreate','intelepeer',util[_0x3057('0x2c')](_0x495c68,{'showHidden':![],'depth':null}));});}else{return logger[_0x3057('0x1b')](_0x3057('0x2a'),_0x3057('0x2b'),_0x3057('0x72'),_0x3057('0x73'));}break;}}})[_0x3057('0x74')](function(){_0x44cfaa();});}else{_0x44cfaa();}}},'charset':_0x3057('0x75'),'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 e52ae25..c87b452 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 _0xb306=['./smsMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','SmsMessage','create','body','options','raw','info','CreateSmsMessage','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xb306,0xb4));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x6b30('0x0'));var moment=require(_0x6b30('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b30('0x2'));var db=require(_0x6b30('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b30('0x4'))(_0x6b30('0x5'));var config=require('../../config/environment');var jayson=require(_0x6b30('0x6'));var client=jayson[_0x6b30('0x7')]['http']({'port':0x232a});config[_0x6b30('0x8')]=_[_0x6b30('0x9')](config[_0x6b30('0x8')],{'host':_0x6b30('0xa'),'port':0x18eb});var socket=require(_0x6b30('0xb'))(new Redis(config[_0x6b30('0x8')]));require(_0x6b30('0xc'))[_0x6b30('0xd')](socket);function respondWithRpcPromise(_0xb9b7c5,_0x15405d,_0x136b89){return new BPromise(function(_0x579769,_0xc7ddb){return client[_0x6b30('0xe')](_0xb9b7c5,_0x136b89)[_0x6b30('0xf')](function(_0x1bd10d){logger['info']('SmsMessage,\x20%s,\x20%s',_0x15405d,_0x6b30('0x10'));logger[_0x6b30('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x15405d,_0x6b30('0x10'),JSON[_0x6b30('0x12')](_0x1bd10d));if(_0x1bd10d[_0x6b30('0x13')]){if(_0x1bd10d['error'][_0x6b30('0x14')]===0x1f4){logger[_0x6b30('0x13')](_0x6b30('0x15'),_0x15405d,_0x1bd10d['error'][_0x6b30('0x16')]);return _0xc7ddb(_0x1bd10d['error']['message']);}logger['error'](_0x6b30('0x15'),_0x15405d,_0x1bd10d['error'][_0x6b30('0x16')]);return _0x579769(_0x1bd10d[_0x6b30('0x13')][_0x6b30('0x16')]);}else{logger['info'](_0x6b30('0x15'),_0x15405d,_0x6b30('0x10'));_0x579769(_0x1bd10d[_0x6b30('0x17')]['message']);}})['catch'](function(_0x3d5600){logger[_0x6b30('0x13')](_0x6b30('0x15'),_0x15405d,_0x3d5600);_0xc7ddb(_0x3d5600);});});}exports['CreateSmsMessage']=function(_0x4e646c){var _0x34f970=this;return new Promise(function(_0x1c9f02,_0x433b67){return db[_0x6b30('0x18')][_0x6b30('0x19')](_0x4e646c[_0x6b30('0x1a')],{'raw':_0x4e646c[_0x6b30('0x1b')]?_0x4e646c[_0x6b30('0x1b')][_0x6b30('0x1c')]===undefined?!![]:![]:!![]})[_0x6b30('0xf')](function(_0x8f9cc1){logger[_0x6b30('0x1d')](_0x6b30('0x1e'),_0x4e646c);logger[_0x6b30('0x11')](_0x6b30('0x1e'),_0x4e646c,JSON[_0x6b30('0x12')](_0x8f9cc1));_0x1c9f02(_0x8f9cc1);})[_0x6b30('0x1f')](function(_0x54b636){logger[_0x6b30('0x13')](_0x6b30('0x1e'),_0x54b636[_0x6b30('0x16')],_0x4e646c);_0x433b67(_0x34f970[_0x6b30('0x13')](0x1f4,_0x54b636[_0x6b30('0x16')]));});});}; \ No newline at end of file +var _0x53b3=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsMessage.socket','register','request','then'];(function(_0x33d81c,_0x583697){var _0x52dd65=function(_0x2e6d1c){while(--_0x2e6d1c){_0x33d81c['push'](_0x33d81c['shift']());}};_0x52dd65(++_0x583697);}(_0x53b3,0x145));var _0x353b=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x53b3[_0x2a276d];return _0x2914cd;};'use strict';var _=require(_0x353b('0x0'));var util=require(_0x353b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x353b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x353b('0x3'))['db'];var utils=require(_0x353b('0x4'));var logger=require('../../config/logger')(_0x353b('0x5'));var config=require(_0x353b('0x6'));var jayson=require(_0x353b('0x7'));var client=jayson[_0x353b('0x8')]['http']({'port':0x232a});config[_0x353b('0x9')]=_[_0x353b('0xa')](config[_0x353b('0x9')],{'host':_0x353b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x353b('0xc'))[_0x353b('0xd')](socket);function respondWithRpcPromise(_0x2b2c41,_0x55461c,_0x796071){return new BPromise(function(_0x5a238b,_0x46959c){return client[_0x353b('0xe')](_0x2b2c41,_0x796071)[_0x353b('0xf')](function(_0x59da08){logger[_0x353b('0x10')](_0x353b('0x11'),_0x55461c,_0x353b('0x12'));logger[_0x353b('0x13')](_0x353b('0x14'),_0x55461c,_0x353b('0x12'),JSON[_0x353b('0x15')](_0x59da08));if(_0x59da08[_0x353b('0x16')]){if(_0x59da08['error']['code']===0x1f4){logger['error'](_0x353b('0x11'),_0x55461c,_0x59da08[_0x353b('0x16')]['message']);return _0x46959c(_0x59da08[_0x353b('0x16')]['message']);}logger[_0x353b('0x16')]('SmsMessage,\x20%s,\x20%s',_0x55461c,_0x59da08[_0x353b('0x16')]['message']);return _0x5a238b(_0x59da08[_0x353b('0x16')][_0x353b('0x17')]);}else{logger[_0x353b('0x10')](_0x353b('0x11'),_0x55461c,_0x353b('0x12'));_0x5a238b(_0x59da08[_0x353b('0x18')][_0x353b('0x17')]);}})[_0x353b('0x19')](function(_0xb88cef){logger['error']('SmsMessage,\x20%s,\x20%s',_0x55461c,_0xb88cef);_0x46959c(_0xb88cef);});});}exports[_0x353b('0x1a')]=function(_0x4e0396){var _0x7cdf5f=this;return new Promise(function(_0x41a3cb,_0x51f9d0){return db[_0x353b('0x1b')]['create'](_0x4e0396[_0x353b('0x1c')],{'raw':_0x4e0396[_0x353b('0x1d')]?_0x4e0396[_0x353b('0x1d')][_0x353b('0x1e')]===undefined?!![]:![]:!![]})[_0x353b('0xf')](function(_0x48cfbf){logger['info'](_0x353b('0x1a'),_0x4e0396);logger[_0x353b('0x13')]('CreateSmsMessage',_0x4e0396,JSON[_0x353b('0x15')](_0x48cfbf));_0x41a3cb(_0x48cfbf);})[_0x353b('0x19')](function(_0x176f9a){logger[_0x353b('0x16')](_0x353b('0x1a'),_0x176f9a[_0x353b('0x17')],_0x4e0396);_0x51f9d0(_0x7cdf5f[_0x353b('0x16')](0x1f4,_0x176f9a[_0x353b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c07cb19..0f5f968 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 _0xa7d4=['register','smsMessage:','./smsMessage.events','remove','update','emit','removeListener'];(function(_0x402b34,_0x27815d){var _0x2a1ba9=function(_0x1398bf){while(--_0x1398bf){_0x402b34['push'](_0x402b34['shift']());}};_0x2a1ba9(++_0x27815d);}(_0xa7d4,0x113));var _0x4a7d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa7d4[_0xa1e3e3];return _0xc980e9;};'use strict';var SmsMessageEvents=require(_0x4a7d('0x0'));var events=['save',_0x4a7d('0x1'),_0x4a7d('0x2')];function createListener(_0x1be166,_0x4360d5){return function(_0xf66c8f){_0x4360d5[_0x4a7d('0x3')](_0x1be166,_0xf66c8f);};}function removeListener(_0x4ad7a3,_0x56fc3f){return function(){SmsMessageEvents[_0x4a7d('0x4')](_0x4ad7a3,_0x56fc3f);};}exports[_0x4a7d('0x5')]=function(_0x2bc384){for(var _0x52b27b=0x0,_0x2d382f=events['length'];_0x52b27b<_0x2d382f;_0x52b27b++){var _0x34d913=events[_0x52b27b];var _0x2e534a=createListener(_0x4a7d('0x6')+_0x34d913,_0x2bc384);SmsMessageEvents['on'](_0x34d913,_0x2e534a);}}; \ No newline at end of file +var _0xeef6=['remove','emit','removeListener','register','./smsMessage.events','save'];(function(_0x1716ca,_0x4b9ffa){var _0x348b42=function(_0x28361d){while(--_0x28361d){_0x1716ca['push'](_0x1716ca['shift']());}};_0x348b42(++_0x4b9ffa);}(_0xeef6,0x1de));var _0x6eef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xeef6[_0x1cc8fe];return _0x230054;};'use strict';var SmsMessageEvents=require(_0x6eef('0x0'));var events=[_0x6eef('0x1'),_0x6eef('0x2'),'update'];function createListener(_0x3592,_0x16afa1){return function(_0x42d27c){_0x16afa1[_0x6eef('0x3')](_0x3592,_0x42d27c);};}function removeListener(_0x1bcb6b,_0xd8b405){return function(){SmsMessageEvents[_0x6eef('0x4')](_0x1bcb6b,_0xd8b405);};}exports[_0x6eef('0x5')]=function(_0x36c489){for(var _0x972208=0x0,_0x4292d2=events['length'];_0x972208<_0x4292d2;_0x972208++){var _0x1affea=events[_0x972208];var _0x9e888a=createListener('smsMessage:'+_0x1affea,_0x36c489);SmsMessageEvents['on'](_0x1affea,_0x9e888a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e67c3d6..88b6fd9 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 _0xeeb5=['/:id/members','getMembers','/:id/teams','getAgents','post','create','put','update','destroy','delete','/:id/users','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xeeb5,0x1a1));var _0x5eeb=function(_0x4eaf7e,_0x2afb74){_0x4eaf7e=_0x4eaf7e-0x0;var _0x31cb6a=_0xeeb5[_0x4eaf7e];return _0x31cb6a;};'use strict';var multer=require(_0x5eeb('0x0'));var util=require(_0x5eeb('0x1'));var path=require(_0x5eeb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5eeb('0x3')]();var fs_extra=require(_0x5eeb('0x4'));var auth=require(_0x5eeb('0x5'));var interaction=require(_0x5eeb('0x6'));var config=require(_0x5eeb('0x7'));var controller=require('./smsQueue.controller');router[_0x5eeb('0x8')]('/',auth[_0x5eeb('0x9')](),controller[_0x5eeb('0xa')]);router[_0x5eeb('0x8')](_0x5eeb('0xb'),auth['isAuthenticated'](),controller[_0x5eeb('0xc')]);router[_0x5eeb('0x8')](_0x5eeb('0xd'),auth[_0x5eeb('0x9')](),controller[_0x5eeb('0xe')]);router[_0x5eeb('0x8')](_0x5eeb('0xf'),auth[_0x5eeb('0x9')](),controller[_0x5eeb('0x10')]);router['get'](_0x5eeb('0x11'),auth[_0x5eeb('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x5eeb('0x9')](),controller[_0x5eeb('0x12')]);router[_0x5eeb('0x13')]('/',auth[_0x5eeb('0x9')](),controller[_0x5eeb('0x14')]);router[_0x5eeb('0x13')](_0x5eeb('0x11'),auth[_0x5eeb('0x9')](),controller['addTeams']);router[_0x5eeb('0x13')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x5eeb('0x15')](_0x5eeb('0xd'),auth[_0x5eeb('0x9')](),controller[_0x5eeb('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5eeb('0x17')]);router[_0x5eeb('0x18')]('/:id/teams',auth[_0x5eeb('0x9')](),controller['removeTeams']);router[_0x5eeb('0x18')](_0x5eeb('0x19'),auth[_0x5eeb('0x9')](),controller['removeAgents']);module[_0x5eeb('0x1a')]=router; \ No newline at end of file +var _0x1a75=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express'];(function(_0x5a92e6,_0x5bb03e){var _0x917e0f=function(_0x3f2883){while(--_0x3f2883){_0x5a92e6['push'](_0x5a92e6['shift']());}};_0x917e0f(++_0x5bb03e);}(_0x1a75,0xa4));var _0x51a7=function(_0x5a6d16,_0x1cd57e){_0x5a6d16=_0x5a6d16-0x0;var _0x40ea12=_0x1a75[_0x5a6d16];return _0x40ea12;};'use strict';var multer=require(_0x51a7('0x0'));var util=require('util');var path=require(_0x51a7('0x1'));var timeout=require(_0x51a7('0x2'));var express=require(_0x51a7('0x3'));var router=express[_0x51a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x51a7('0x5'));var interaction=require(_0x51a7('0x6'));var config=require(_0x51a7('0x7'));var controller=require(_0x51a7('0x8'));router[_0x51a7('0x9')]('/',auth[_0x51a7('0xa')](),controller[_0x51a7('0xb')]);router[_0x51a7('0x9')](_0x51a7('0xc'),auth['isAuthenticated'](),controller[_0x51a7('0xd')]);router[_0x51a7('0x9')](_0x51a7('0xe'),auth[_0x51a7('0xa')](),controller['show']);router[_0x51a7('0x9')]('/:id/members',auth[_0x51a7('0xa')](),controller[_0x51a7('0xf')]);router[_0x51a7('0x9')](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x11')]);router[_0x51a7('0x9')](_0x51a7('0x12'),auth[_0x51a7('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x51a7('0x13')]);router[_0x51a7('0x14')]('/:id/teams',auth[_0x51a7('0xa')](),controller[_0x51a7('0x15')]);router[_0x51a7('0x14')](_0x51a7('0x12'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x16')]);router['put']('/:id',auth[_0x51a7('0xa')](),controller[_0x51a7('0x17')]);router[_0x51a7('0x18')](_0x51a7('0xe'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x19')]);router[_0x51a7('0x18')](_0x51a7('0x10'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x1a')]);router[_0x51a7('0x18')](_0x51a7('0x12'),auth[_0x51a7('0xa')](),controller[_0x51a7('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6aacf45..fddee84 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 _0xaaed=['name','STRING','ENUM','roundrobin','sequelize'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0xaaed,0x1c6));var _0xdaae=function(_0x3bd873,_0x4a8f76){_0x3bd873=_0x3bd873-0x0;var _0xd0794f=_0xaaed[_0x3bd873];return _0xd0794f;};'use strict';var Sequelize=require(_0xdaae('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdaae('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdaae('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdaae('0x3')]('rrmemory','beepall',_0xdaae('0x4'))}}; \ No newline at end of file +var _0x0865=['roundrobin','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x20c159,_0x5e151a){var _0x3b48f7=function(_0x135700){while(--_0x135700){_0x20c159['push'](_0x20c159['shift']());}};_0x3b48f7(++_0x5e151a);}(_0x0865,0xeb));var _0x5086=function(_0x4b544a,_0x2890b4){_0x4b544a=_0x4b544a-0x0;var _0x5eb948=_0x0865[_0x4b544a];return _0x5eb948;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5086('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5086('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5086('0x2')](_0x5086('0x3'),_0x5086('0x4'),_0x5086('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3473490..23ade02 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x560485,_0x244601){_0x560485=_0x560485-0x0;var _0x3e7f69=_0x0b0e[_0x560485];return _0x3e7f69;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x589049,_0x356005){var _0x2055a2=function(_0x68fc2d){while(--_0x68fc2d){_0x589049['push'](_0x589049['shift']());}};_0x2055a2(++_0x356005);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f16c1,_0x176d9e){_0x1f16c1=_0x1f16c1-0x0;var _0x185fbb=_0x2ef3[_0x1f16c1];return _0x185fbb;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c9f8b7e..7ca0b42 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 _0x4489=['../../mysqldb','SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5de9ea,_0x55a869){var _0x467891=function(_0x4efcf5){while(--_0x4efcf5){_0x5de9ea['push'](_0x5de9ea['shift']());}};_0x467891(++_0x55a869);}(_0x4489,0xe5));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9448('0x0'));var SmsQueue=require(_0x9448('0x1'))['db'][_0x9448('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9448('0x3')](0x0);var events={'afterCreate':_0x9448('0x4'),'afterUpdate':_0x9448('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4811a8){return function(_0x3ea1f6,_0x5ce5a7,_0x24e9a0){SmsQueueEvents['emit'](_0x4811a8+':'+_0x3ea1f6['id'],_0x3ea1f6);SmsQueueEvents[_0x9448('0x6')](_0x4811a8,_0x3ea1f6);_0x24e9a0(null);};}for(var e in events){if(events[_0x9448('0x7')](e)){var event=events[e];SmsQueue[_0x9448('0x8')](e,emitEvent(event));}}module[_0x9448('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xf08c=['save','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf08c,0x64));var _0xcf08=function(_0x5c4139,_0x1d2ac5){_0x5c4139=_0x5c4139-0x0;var _0x21cd64=_0xf08c[_0x5c4139];return _0x21cd64;};'use strict';var EventEmitter=require(_0xcf08('0x0'));var SmsQueue=require(_0xcf08('0x1'))['db'][_0xcf08('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xcf08('0x3')](0x0);var events={'afterCreate':_0xcf08('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e3138){return function(_0x4678b8,_0x453414,_0x29924e){SmsQueueEvents[_0xcf08('0x5')](_0x4e3138+':'+_0x4678b8['id'],_0x4678b8);SmsQueueEvents[_0xcf08('0x5')](_0x4e3138,_0x4678b8);_0x29924e(null);};}for(var e in events){if(events[_0xcf08('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xcf08('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 365de11..77ed4e3 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 _0x1b00=['sms_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0x1b00,0xc4));var _0x01b0=function(_0xb6e50b,_0x4b20ee){_0xb6e50b=_0xb6e50b-0x0;var _0x5df670=_0x1b00[_0xb6e50b];return _0x5df670;};'use strict';var _=require(_0x01b0('0x0'));var util=require(_0x01b0('0x1'));var logger=require('../../config/logger')(_0x01b0('0x2'));var moment=require(_0x01b0('0x3'));var BPromise=require(_0x01b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01b0('0x5'));var rimraf=require(_0x01b0('0x6'));var config=require(_0x01b0('0x7'));var attributes=require(_0x01b0('0x8'));module[_0x01b0('0x9')]=function(_0xc1540b,_0x382107){return _0xc1540b[_0x01b0('0xa')](_0x01b0('0xb'),attributes,{'tableName':_0x01b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb93=['./smsQueue.attributes','exports','sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x51053b,_0xd27d3b){var _0x23adad=function(_0x8536f2){while(--_0x8536f2){_0x51053b['push'](_0x51053b['shift']());}};_0x23adad(++_0xd27d3b);}(_0xfb93,0x111));var _0x3fb9=function(_0x4135e7,_0x14f68b){_0x4135e7=_0x4135e7-0x0;var _0x3032f9=_0xfb93[_0x4135e7];return _0x3032f9;};'use strict';var _=require(_0x3fb9('0x0'));var util=require(_0x3fb9('0x1'));var logger=require(_0x3fb9('0x2'))(_0x3fb9('0x3'));var moment=require('moment');var BPromise=require(_0x3fb9('0x4'));var rp=require(_0x3fb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fb9('0x6'));module[_0x3fb9('0x7')]=function(_0x498b6b,_0x118c1f){return _0x498b6b['define']('SmsQueue',attributes,{'tableName':_0x3fb9('0x8'),'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 3d04caa..2448d04 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 _0xa56a=['register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','map','include','model','ShowSmsQueue','find','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','./smsQueue.socket'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0xa56a,0x1d5));var _0xaa56=function(_0x237a3e,_0x22a5cd){_0x237a3e=_0x237a3e-0x0;var _0x38101f=_0xa56a[_0x237a3e];return _0x38101f;};'use strict';var _=require(_0xaa56('0x0'));var util=require(_0xaa56('0x1'));var moment=require(_0xaa56('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa56('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa56('0x4'));var logger=require('../../config/logger')(_0xaa56('0x5'));var config=require(_0xaa56('0x6'));var jayson=require(_0xaa56('0x7'));var client=jayson[_0xaa56('0x8')]['http']({'port':0x232a});config['redis']=_[_0xaa56('0x9')](config[_0xaa56('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaa56('0xb'))[_0xaa56('0xc')](socket);function respondWithRpcPromise(_0x13de92,_0xfd63e6,_0x4ba1c7){return new BPromise(function(_0x3c98a0,_0x25c770){return client[_0xaa56('0xd')](_0x13de92,_0x4ba1c7)[_0xaa56('0xe')](function(_0x596a35){logger[_0xaa56('0xf')](_0xaa56('0x10'),_0xfd63e6,_0xaa56('0x11'));logger[_0xaa56('0x12')](_0xaa56('0x13'),_0xfd63e6,_0xaa56('0x11'),JSON[_0xaa56('0x14')](_0x596a35));if(_0x596a35[_0xaa56('0x15')]){if(_0x596a35[_0xaa56('0x15')][_0xaa56('0x16')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0xfd63e6,_0x596a35['error'][_0xaa56('0x17')]);return _0x25c770(_0x596a35[_0xaa56('0x15')]['message']);}logger[_0xaa56('0x15')](_0xaa56('0x10'),_0xfd63e6,_0x596a35['error'][_0xaa56('0x17')]);return _0x3c98a0(_0x596a35[_0xaa56('0x15')][_0xaa56('0x17')]);}else{logger[_0xaa56('0xf')]('SmsQueue,\x20%s,\x20%s',_0xfd63e6,_0xaa56('0x11'));_0x3c98a0(_0x596a35[_0xaa56('0x18')]['message']);}})[_0xaa56('0x19')](function(_0x3ec69e){logger[_0xaa56('0x15')](_0xaa56('0x10'),_0xfd63e6,_0x3ec69e);_0x25c770(_0x3ec69e);});});}exports[_0xaa56('0x1a')]=function(_0x803484){var _0x5aa8f8=this;return new Promise(function(_0x3cdd39,_0xbffc58){return db[_0xaa56('0x1b')]['findAll']({'raw':_0x803484['options']?_0x803484[_0xaa56('0x1c')][_0xaa56('0x1d')]===undefined?!![]:![]:!![],'where':_0x803484[_0xaa56('0x1c')]?_0x803484['options'][_0xaa56('0x1e')]||null:null,'attributes':_0x803484[_0xaa56('0x1c')]?_0x803484[_0xaa56('0x1c')][_0xaa56('0x1f')]||null:null,'limit':_0x803484[_0xaa56('0x1c')]?_0x803484[_0xaa56('0x1c')]['limit']||null:null,'include':_0x803484[_0xaa56('0x1c')]?_0x803484[_0xaa56('0x1c')]['include']?_[_0xaa56('0x20')](_0x803484[_0xaa56('0x1c')][_0xaa56('0x21')],function(_0x151763){return{'model':db[_0x151763[_0xaa56('0x22')]],'as':_0x151763['as'],'attributes':_0x151763['attributes'],'include':_0x151763[_0xaa56('0x21')]?_['map'](_0x151763[_0xaa56('0x21')],function(_0x2be31f){return{'model':db[_0x2be31f[_0xaa56('0x22')]],'as':_0x2be31f['as'],'attributes':_0x2be31f['attributes'],'include':_0x2be31f['include']?_['map'](_0x2be31f[_0xaa56('0x21')],function(_0x468c35){return{'model':db[_0x468c35['model']],'as':_0x468c35['as'],'attributes':_0x468c35['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f4320){logger['info'](_0xaa56('0x1a'),_0x803484);logger[_0xaa56('0x12')](_0xaa56('0x1a'),_0x803484,JSON[_0xaa56('0x14')](_0x4f4320));_0x3cdd39(_0x4f4320);})[_0xaa56('0x19')](function(_0x24fe8f){logger[_0xaa56('0x15')](_0xaa56('0x1a'),_0x24fe8f[_0xaa56('0x17')],_0x803484);_0xbffc58(_0x5aa8f8['error'](0x1f4,_0x24fe8f[_0xaa56('0x17')]));});});};exports[_0xaa56('0x23')]=function(_0x301c33){var _0x1a376e=this;return new Promise(function(_0x556343,_0x537b16){return db[_0xaa56('0x1b')][_0xaa56('0x24')]({'raw':_0x301c33[_0xaa56('0x1c')]?_0x301c33[_0xaa56('0x1c')][_0xaa56('0x1d')]===undefined?!![]:![]:!![],'where':_0x301c33['options']?_0x301c33[_0xaa56('0x1c')][_0xaa56('0x1e')]||null:null,'attributes':_0x301c33[_0xaa56('0x1c')]?_0x301c33['options'][_0xaa56('0x1f')]||null:null,'include':_0x301c33[_0xaa56('0x1c')]?_0x301c33['options'][_0xaa56('0x21')]?_['map'](_0x301c33[_0xaa56('0x1c')]['include'],function(_0x4b0fbf){return{'model':db[_0x4b0fbf['model']],'as':_0x4b0fbf['as'],'attributes':_0x4b0fbf[_0xaa56('0x1f')],'include':_0x4b0fbf[_0xaa56('0x21')]?_[_0xaa56('0x20')](_0x4b0fbf[_0xaa56('0x21')],function(_0x17c1f5){return{'model':db[_0x17c1f5[_0xaa56('0x22')]],'as':_0x17c1f5['as'],'attributes':_0x17c1f5[_0xaa56('0x1f')],'include':_0x17c1f5[_0xaa56('0x21')]?_['map'](_0x17c1f5[_0xaa56('0x21')],function(_0x476266){return{'model':db[_0x476266[_0xaa56('0x22')]],'as':_0x476266['as'],'attributes':_0x476266[_0xaa56('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaa56('0xe')](function(_0x32e48a){logger['info']('ShowSmsQueue',_0x301c33);logger[_0xaa56('0x12')]('ShowSmsQueue',_0x301c33,JSON[_0xaa56('0x14')](_0x32e48a));_0x556343(_0x32e48a);})['catch'](function(_0x584cf0){logger[_0xaa56('0x15')]('ShowSmsQueue',_0x584cf0['message'],_0x301c33);_0x537b16(_0x1a376e['error'](0x1f4,_0x584cf0[_0xaa56('0x17')]));});});}; \ No newline at end of file +var _0x39e4=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45f842,_0x4a5890){var _0x364064=function(_0xc1eba6){while(--_0xc1eba6){_0x45f842['push'](_0x45f842['shift']());}};_0x364064(++_0x4a5890);}(_0x39e4,0x78));var _0x439e=function(_0x3eb27c,_0x40929a){_0x3eb27c=_0x3eb27c-0x0;var _0x422a89=_0x39e4[_0x3eb27c];return _0x422a89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x439e('0x0'));var BPromise=require(_0x439e('0x1'));var rs=require(_0x439e('0x2'));var fs=require('fs');var Redis=require(_0x439e('0x3'));var db=require(_0x439e('0x4'))['db'];var utils=require(_0x439e('0x5'));var logger=require(_0x439e('0x6'))(_0x439e('0x7'));var config=require(_0x439e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x439e('0x9')][_0x439e('0xa')]({'port':0x232a});config[_0x439e('0xb')]=_[_0x439e('0xc')](config['redis'],{'host':_0x439e('0xd'),'port':0x18eb});var socket=require(_0x439e('0xe'))(new Redis(config['redis']));require(_0x439e('0xf'))[_0x439e('0x10')](socket);function respondWithRpcPromise(_0x3a7dc1,_0x392d1f,_0x1b1a7d){return new BPromise(function(_0x28e79d,_0x2d046f){return client['request'](_0x3a7dc1,_0x1b1a7d)[_0x439e('0x11')](function(_0x3a49c3){logger[_0x439e('0x12')](_0x439e('0x13'),_0x392d1f,_0x439e('0x14'));logger[_0x439e('0x15')](_0x439e('0x16'),_0x392d1f,_0x439e('0x14'),JSON[_0x439e('0x17')](_0x3a49c3));if(_0x3a49c3[_0x439e('0x18')]){if(_0x3a49c3[_0x439e('0x18')][_0x439e('0x19')]===0x1f4){logger[_0x439e('0x18')]('SmsQueue,\x20%s,\x20%s',_0x392d1f,_0x3a49c3['error'][_0x439e('0x1a')]);return _0x2d046f(_0x3a49c3[_0x439e('0x18')][_0x439e('0x1a')]);}logger[_0x439e('0x18')](_0x439e('0x13'),_0x392d1f,_0x3a49c3['error'][_0x439e('0x1a')]);return _0x28e79d(_0x3a49c3[_0x439e('0x18')][_0x439e('0x1a')]);}else{logger[_0x439e('0x12')](_0x439e('0x13'),_0x392d1f,'request\x20sent');_0x28e79d(_0x3a49c3[_0x439e('0x1b')][_0x439e('0x1a')]);}})['catch'](function(_0x246c7a){logger['error'](_0x439e('0x13'),_0x392d1f,_0x246c7a);_0x2d046f(_0x246c7a);});});}exports[_0x439e('0x1c')]=function(_0x224c62){var _0xa88d82=this;return new Promise(function(_0x1f03e4,_0x1c310d){return db[_0x439e('0x1d')][_0x439e('0x1e')]({'raw':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x20')]===undefined?!![]:![]:!![],'where':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x21')]||null:null,'attributes':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x22')]||null:null,'limit':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x23')]||null:null,'include':_0x224c62[_0x439e('0x1f')]?_0x224c62[_0x439e('0x1f')][_0x439e('0x24')]?_[_0x439e('0x25')](_0x224c62[_0x439e('0x1f')][_0x439e('0x24')],function(_0x449576){return{'model':db[_0x449576[_0x439e('0x26')]],'as':_0x449576['as'],'attributes':_0x449576[_0x439e('0x22')],'include':_0x449576[_0x439e('0x24')]?_['map'](_0x449576['include'],function(_0x133298){return{'model':db[_0x133298[_0x439e('0x26')]],'as':_0x133298['as'],'attributes':_0x133298[_0x439e('0x22')],'include':_0x133298[_0x439e('0x24')]?_[_0x439e('0x25')](_0x133298['include'],function(_0x2c0108){return{'model':db[_0x2c0108['model']],'as':_0x2c0108['as'],'attributes':_0x2c0108['attributes']};}):[]};}):[]};}):[]:[]})[_0x439e('0x11')](function(_0x132dfd){logger[_0x439e('0x12')](_0x439e('0x1c'),_0x224c62);logger['debug'](_0x439e('0x1c'),_0x224c62,JSON['stringify'](_0x132dfd));_0x1f03e4(_0x132dfd);})[_0x439e('0x27')](function(_0x4018d8){logger[_0x439e('0x18')]('GetSmsQueue',_0x4018d8[_0x439e('0x1a')],_0x224c62);_0x1c310d(_0xa88d82[_0x439e('0x18')](0x1f4,_0x4018d8[_0x439e('0x1a')]));});});};exports[_0x439e('0x28')]=function(_0x3efb57){var _0x329658=this;return new Promise(function(_0x15810a,_0x2df9f9){return db['SmsQueue'][_0x439e('0x29')]({'raw':_0x3efb57[_0x439e('0x1f')]?_0x3efb57[_0x439e('0x1f')][_0x439e('0x20')]===undefined?!![]:![]:!![],'where':_0x3efb57[_0x439e('0x1f')]?_0x3efb57[_0x439e('0x1f')][_0x439e('0x21')]||null:null,'attributes':_0x3efb57['options']?_0x3efb57['options']['attributes']||null:null,'include':_0x3efb57[_0x439e('0x1f')]?_0x3efb57[_0x439e('0x1f')][_0x439e('0x24')]?_['map'](_0x3efb57[_0x439e('0x1f')][_0x439e('0x24')],function(_0x4f0e2f){return{'model':db[_0x4f0e2f[_0x439e('0x26')]],'as':_0x4f0e2f['as'],'attributes':_0x4f0e2f[_0x439e('0x22')],'include':_0x4f0e2f[_0x439e('0x24')]?_[_0x439e('0x25')](_0x4f0e2f[_0x439e('0x24')],function(_0x4e3df0){return{'model':db[_0x4e3df0[_0x439e('0x26')]],'as':_0x4e3df0['as'],'attributes':_0x4e3df0['attributes'],'include':_0x4e3df0[_0x439e('0x24')]?_[_0x439e('0x25')](_0x4e3df0['include'],function(_0x1d2117){return{'model':db[_0x1d2117[_0x439e('0x26')]],'as':_0x1d2117['as'],'attributes':_0x1d2117[_0x439e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x575b58){logger[_0x439e('0x12')](_0x439e('0x28'),_0x3efb57);logger[_0x439e('0x15')]('ShowSmsQueue',_0x3efb57,JSON[_0x439e('0x17')](_0x575b58));_0x15810a(_0x575b58);})[_0x439e('0x27')](function(_0x26c6dc){logger[_0x439e('0x18')](_0x439e('0x28'),_0x26c6dc[_0x439e('0x1a')],_0x3efb57);_0x2df9f9(_0x329658['error'](0x1f4,_0x26c6dc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9fa7209..4d4332c 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 _0x1a21=['update','emit','removeListener','length','./smsQueue.events','save','remove'];(function(_0x10113d,_0x13a861){var _0xf52f5d=function(_0x5b6479){while(--_0x5b6479){_0x10113d['push'](_0x10113d['shift']());}};_0xf52f5d(++_0x13a861);}(_0x1a21,0x1d9));var _0x11a2=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x1a21[_0x2a238a];return _0xeef802;};'use strict';var SmsQueueEvents=require(_0x11a2('0x0'));var events=[_0x11a2('0x1'),_0x11a2('0x2'),_0x11a2('0x3')];function createListener(_0x21960d,_0x25b6e9){return function(_0x2fcdd6){_0x25b6e9[_0x11a2('0x4')](_0x21960d,_0x2fcdd6);};}function removeListener(_0x784c38,_0x7f975a){return function(){SmsQueueEvents[_0x11a2('0x5')](_0x784c38,_0x7f975a);};}exports['register']=function(_0x25ba2c){for(var _0x374aa3=0x0,_0x238950=events[_0x11a2('0x6')];_0x374aa3<_0x238950;_0x374aa3++){var _0x227e9b=events[_0x374aa3];var _0x42438b=createListener('smsQueue:'+_0x227e9b,_0x25ba2c);SmsQueueEvents['on'](_0x227e9b,_0x42438b);}}; \ No newline at end of file +var _0x8f35=['emit','removeListener','register','length','smsQueue:','save','remove','update'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x8f35,0x16d));var _0x58f3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f35[_0x57b54c];return _0x59cc19;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x58f3('0x0'),_0x58f3('0x1'),_0x58f3('0x2')];function createListener(_0x4fc7f0,_0x345cae){return function(_0x35eb0a){_0x345cae[_0x58f3('0x3')](_0x4fc7f0,_0x35eb0a);};}function removeListener(_0x41f893,_0x492e3b){return function(){SmsQueueEvents[_0x58f3('0x4')](_0x41f893,_0x492e3b);};}exports[_0x58f3('0x5')]=function(_0x360a12){for(var _0x281fa0=0x0,_0x6b3de9=events[_0x58f3('0x6')];_0x281fa0<_0x6b3de9;_0x281fa0++){var _0x149e45=events[_0x281fa0];var _0x7b7335=createListener(_0x58f3('0x7')+_0x149e45,_0x360a12);SmsQueueEvents['on'](_0x149e45,_0x7b7335);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 59afdf0..48aeabe 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 _0x3e1f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','create','/:id','update','delete','destroy','util','path'];(function(_0x4081b9,_0x42025e){var _0x468cbf=function(_0x5f1211){while(--_0x5f1211){_0x4081b9['push'](_0x4081b9['shift']());}};_0x468cbf(++_0x42025e);}(_0x3e1f,0x18a));var _0xf3e1=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x3e1f[_0x274dd7];return _0x148829;};'use strict';var multer=require('multer');var util=require(_0xf3e1('0x0'));var path=require(_0xf3e1('0x1'));var timeout=require(_0xf3e1('0x2'));var express=require('express');var router=express[_0xf3e1('0x3')]();var fs_extra=require(_0xf3e1('0x4'));var auth=require(_0xf3e1('0x5'));var interaction=require(_0xf3e1('0x6'));var config=require(_0xf3e1('0x7'));var controller=require('./smsQueueReport.controller');router[_0xf3e1('0x8')]('/',auth[_0xf3e1('0x9')](),controller[_0xf3e1('0xa')]);router[_0xf3e1('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf3e1('0xb')]);router[_0xf3e1('0x8')]('/:id',auth[_0xf3e1('0x9')](),controller[_0xf3e1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf3e1('0xd')]);router['put'](_0xf3e1('0xe'),auth[_0xf3e1('0x9')](),controller[_0xf3e1('0xf')]);router[_0xf3e1('0x10')](_0xf3e1('0xe'),auth['isAuthenticated'](),controller[_0xf3e1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x62dd=['delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','create','put','update'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x62dd,0x6c));var _0xd62d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x62dd[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var path=require(_0xd62d('0x2'));var timeout=require(_0xd62d('0x3'));var express=require(_0xd62d('0x4'));var router=express['Router']();var fs_extra=require(_0xd62d('0x5'));var auth=require(_0xd62d('0x6'));var interaction=require(_0xd62d('0x7'));var config=require(_0xd62d('0x8'));var controller=require('./smsQueueReport.controller');router[_0xd62d('0x9')]('/',auth['isAuthenticated'](),controller[_0xd62d('0xa')]);router[_0xd62d('0x9')](_0xd62d('0xb'),auth[_0xd62d('0xc')](),controller[_0xd62d('0xd')]);router['get']('/:id',auth[_0xd62d('0xc')](),controller[_0xd62d('0xe')]);router['post']('/',auth[_0xd62d('0xc')](),controller[_0xd62d('0xf')]);router[_0xd62d('0x10')]('/:id',auth[_0xd62d('0xc')](),controller[_0xd62d('0x11')]);router[_0xd62d('0x12')](_0xd62d('0x13'),auth[_0xd62d('0xc')](),controller['destroy']);module[_0xd62d('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index edc5364..5bbbdd1 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 _0x2894=['STRING','DATE','moment','sequelize'];(function(_0x27c28c,_0x49ba23){var _0x1f5669=function(_0x257683){while(--_0x257683){_0x27c28c['push'](_0x27c28c['shift']());}};_0x1f5669(++_0x49ba23);}(_0x2894,0xb2));var _0x4289=function(_0x18e0bf,_0x2b3088){_0x18e0bf=_0x18e0bf-0x0;var _0x13c438=_0x2894[_0x18e0bf];return _0x13c438;};'use strict';var moment=require(_0x4289('0x0'));var Sequelize=require(_0x4289('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4289('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4289('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4289('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4289('0x3')]},'reason':{'type':Sequelize[_0x4289('0x2')]}}; \ No newline at end of file +var _0x7ccb=['STRING','DATE','moment','sequelize','exports'];(function(_0x283a81,_0x42f033){var _0x57533f=function(_0x1bfe9e){while(--_0x1bfe9e){_0x283a81['push'](_0x283a81['shift']());}};_0x57533f(++_0x42f033);}(_0x7ccb,0x17e));var _0xb7cc=function(_0x2c7341,_0x293a18){_0x2c7341=_0x2c7341-0x0;var _0x23f3fc=_0x7ccb[_0x2c7341];return _0x23f3fc;};'use strict';var moment=require(_0xb7cc('0x0'));var Sequelize=require(_0xb7cc('0x1'));module[_0xb7cc('0x2')]={'uniqueid':{'type':Sequelize[_0xb7cc('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb7cc('0x4')]},'acceptAt':{'type':Sequelize[_0xb7cc('0x4')]},'exitAt':{'type':Sequelize[_0xb7cc('0x4')]},'reason':{'type':Sequelize[_0xb7cc('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bb94819..08797d0 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 _0xbb6b=['filter','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','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','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where'];(function(_0x310fbc,_0x4b70de){var _0x4a8be0=function(_0x4fd5cb){while(--_0x4fd5cb){_0x310fbc['push'](_0x310fbc['shift']());}};_0x4a8be0(++_0x4b70de);}(_0xbb6b,0x135));var _0xbbb6=function(_0x5b7218,_0x51cb1f){_0x5b7218=_0x5b7218-0x0;var _0x424010=_0xbb6b[_0x5b7218];return _0x424010;};'use strict';var emlformat=require(_0xbbb6('0x0'));var rimraf=require(_0xbbb6('0x1'));var zipdir=require(_0xbbb6('0x2'));var jsonpatch=require(_0xbbb6('0x3'));var rp=require(_0xbbb6('0x4'));var moment=require(_0xbbb6('0x5'));var BPromise=require(_0xbbb6('0x6'));var Mustache=require('mustache');var util=require(_0xbbb6('0x7'));var path=require('path');var sox=require(_0xbbb6('0x8'));var csv=require(_0xbbb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbb6('0xa'));var squel=require(_0xbbb6('0xb'));var crypto=require(_0xbbb6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbb6('0xd'));var toCsv=require(_0xbbb6('0x9'));var querystring=require('querystring');var Papa=require(_0xbbb6('0xe'));var Redis=require('ioredis');var authService=require(_0xbbb6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbbb6('0x10'));var hardwareService=require(_0xbbb6('0x11'));var logger=require(_0xbbb6('0x12'))(_0xbbb6('0x13'));var utils=require(_0xbbb6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbbb6('0x15'));var db=require(_0xbbb6('0x16'))['db'];function respondWithStatusCode(_0x29c82e,_0xcd5e96){_0xcd5e96=_0xcd5e96||0xcc;return function(_0x398621){if(_0x398621){return _0x29c82e[_0xbbb6('0x17')](_0xcd5e96);}return _0x29c82e['status'](_0xcd5e96)[_0xbbb6('0x18')]();};}function respondWithResult(_0x564f59,_0x286c93){_0x286c93=_0x286c93||0xc8;return function(_0x3ae147){if(_0x3ae147){return _0x564f59[_0xbbb6('0x19')](_0x286c93)[_0xbbb6('0x1a')](_0x3ae147);}};}function respondWithFilteredResult(_0x442467,_0x3328e0){return function(_0x3a4597){if(_0x3a4597){var _0x1d5ef4=typeof _0x3328e0[_0xbbb6('0x1b')]===_0xbbb6('0x1c')&&typeof _0x3328e0[_0xbbb6('0x1d')]===_0xbbb6('0x1c');var _0x378878=_0x3a4597[_0xbbb6('0x1e')];var _0x5e250d=_0x1d5ef4?0x0:_0x3328e0['offset'];var _0x883155=_0x1d5ef4?_0x3a4597[_0xbbb6('0x1e')]:_0x3328e0[_0xbbb6('0x1b')]+_0x3328e0[_0xbbb6('0x1d')];var _0x3cb1a5;if(_0x883155>=_0x378878){_0x883155=_0x378878;_0x3cb1a5=0xc8;}else{_0x3cb1a5=0xce;}_0x442467[_0xbbb6('0x19')](_0x3cb1a5);return _0x442467[_0xbbb6('0x1f')](_0xbbb6('0x20'),_0x5e250d+'-'+_0x883155+'/'+_0x378878)[_0xbbb6('0x1a')](_0x3a4597);}return null;};}function patchUpdates(_0x54ede4){return function(_0x8127a3){try{jsonpatch[_0xbbb6('0x21')](_0x8127a3,_0x54ede4,!![]);}catch(_0x4aabea){return BPromise[_0xbbb6('0x22')](_0x4aabea);}return _0x8127a3[_0xbbb6('0x23')]();};}function saveUpdates(_0x3fb492,_0x401139){return function(_0x2549fe){if(_0x2549fe){return _0x2549fe[_0xbbb6('0x24')](_0x3fb492)[_0xbbb6('0x25')](function(_0x57c006){return _0x57c006;});}return null;};}function removeEntity(_0x40bb3f,_0x1fbbe7){return function(_0x434647){if(_0x434647){return _0x434647[_0xbbb6('0x26')]()[_0xbbb6('0x25')](function(){_0x40bb3f[_0xbbb6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdc50da,_0x11a34f){return function(_0x574196){if(!_0x574196){_0xdc50da[_0xbbb6('0x17')](0x194);}return _0x574196;};}function handleError(_0x1ccc9d,_0x5d17ab){_0x5d17ab=_0x5d17ab||0x1f4;return function(_0x265fe3){logger[_0xbbb6('0x27')](_0x265fe3[_0xbbb6('0x28')]);if(_0x265fe3[_0xbbb6('0x29')]){delete _0x265fe3['name'];}_0x1ccc9d['status'](_0x5d17ab)[_0xbbb6('0x2a')](_0x265fe3);};}exports[_0xbbb6('0x2b')]=function(_0x210ced,_0x25443b){var _0x2b3020={},_0x1b65c0={},_0x446391={'count':0x0,'rows':[]};var _0x32af2b=_['map'](db[_0xbbb6('0x2c')][_0xbbb6('0x2d')],function(_0x3d0955){return{'name':_0x3d0955[_0xbbb6('0x2e')],'type':_0x3d0955[_0xbbb6('0x2f')][_0xbbb6('0x30')]};});_0x1b65c0['model']=_[_0xbbb6('0x31')](_0x32af2b,_0xbbb6('0x29'));_0x1b65c0[_0xbbb6('0x32')]=_[_0xbbb6('0x33')](_0x210ced[_0xbbb6('0x32')]);_0x1b65c0[_0xbbb6('0x34')]=_[_0xbbb6('0x35')](_0x1b65c0[_0xbbb6('0x36')],_0x1b65c0[_0xbbb6('0x32')]);_0x2b3020[_0xbbb6('0x37')]=_[_0xbbb6('0x35')](_0x1b65c0['model'],qs[_0xbbb6('0x38')](_0x210ced['query'][_0xbbb6('0x38')]));_0x2b3020[_0xbbb6('0x37')]=_0x2b3020[_0xbbb6('0x37')][_0xbbb6('0x39')]?_0x2b3020[_0xbbb6('0x37')]:_0x1b65c0['model'];if(!_0x210ced[_0xbbb6('0x32')][_0xbbb6('0x3a')]('nolimit')){_0x2b3020['limit']=qs[_0xbbb6('0x1d')](_0x210ced[_0xbbb6('0x32')]['limit']);_0x2b3020['offset']=qs[_0xbbb6('0x1b')](_0x210ced[_0xbbb6('0x32')][_0xbbb6('0x1b')]);}_0x2b3020['order']=qs[_0xbbb6('0x3b')](_0x210ced[_0xbbb6('0x32')][_0xbbb6('0x3b')]);_0x2b3020[_0xbbb6('0x3c')]=qs[_0xbbb6('0x34')](_['pick'](_0x210ced['query'],_0x1b65c0[_0xbbb6('0x34')]),_0x32af2b);if(_0x210ced[_0xbbb6('0x32')][_0xbbb6('0x3d')]){_0x2b3020['where']=_[_0xbbb6('0x3e')](_0x2b3020[_0xbbb6('0x3c')],{'$or':_[_0xbbb6('0x31')](_0x32af2b,function(_0x5e33e3){if(_0x5e33e3[_0xbbb6('0x2f')]!=='VIRTUAL'){var _0x5d91db={};_0x5d91db[_0x5e33e3[_0xbbb6('0x29')]]={'$like':'%'+_0x210ced[_0xbbb6('0x32')][_0xbbb6('0x3d')]+'%'};return _0x5d91db;}})});}_0x2b3020=_[_0xbbb6('0x3e')]({},_0x2b3020,_0x210ced[_0xbbb6('0x3f')]);var _0x4e5018={'where':_0x2b3020[_0xbbb6('0x3c')]};return db[_0xbbb6('0x2c')][_0xbbb6('0x1e')](_0x4e5018)[_0xbbb6('0x25')](function(_0x59ad44){_0x446391['count']=_0x59ad44;if(_0x210ced[_0xbbb6('0x32')][_0xbbb6('0x40')]){_0x2b3020[_0xbbb6('0x41')]=[{'all':!![]}];}return db[_0xbbb6('0x2c')][_0xbbb6('0x42')](_0x2b3020);})[_0xbbb6('0x25')](function(_0x1712af){_0x446391['rows']=_0x1712af;return _0x446391;})[_0xbbb6('0x25')](respondWithFilteredResult(_0x25443b,_0x2b3020))[_0xbbb6('0x43')](handleError(_0x25443b,null));};exports[_0xbbb6('0x44')]=function(_0x47a98d,_0x44aa16){var _0x42975f={'raw':!![],'where':{'id':_0x47a98d[_0xbbb6('0x45')]['id']}},_0x22247b={};_0x22247b[_0xbbb6('0x36')]=_[_0xbbb6('0x33')](db[_0xbbb6('0x2c')][_0xbbb6('0x2d')]);_0x22247b['query']=_[_0xbbb6('0x33')](_0x47a98d['query']);_0x22247b['filters']=_['intersection'](_0x22247b[_0xbbb6('0x36')],_0x22247b['query']);_0x42975f[_0xbbb6('0x37')]=_['intersection'](_0x22247b[_0xbbb6('0x36')],qs['fields'](_0x47a98d['query']['fields']));_0x42975f['attributes']=_0x42975f[_0xbbb6('0x37')][_0xbbb6('0x39')]?_0x42975f[_0xbbb6('0x37')]:_0x22247b[_0xbbb6('0x36')];if(_0x47a98d[_0xbbb6('0x32')]['includeAll']){_0x42975f[_0xbbb6('0x41')]=[{'all':!![]}];}_0x42975f=_[_0xbbb6('0x3e')]({},_0x42975f,_0x47a98d[_0xbbb6('0x3f')]);return db[_0xbbb6('0x2c')]['find'](_0x42975f)[_0xbbb6('0x25')](handleEntityNotFound(_0x44aa16,null))[_0xbbb6('0x25')](respondWithResult(_0x44aa16,null))[_0xbbb6('0x43')](handleError(_0x44aa16,null));};exports['create']=function(_0x5b7092,_0x15de28){return db[_0xbbb6('0x2c')][_0xbbb6('0x46')](_0x5b7092[_0xbbb6('0x47')],{})[_0xbbb6('0x25')](respondWithResult(_0x15de28,0xc9))[_0xbbb6('0x43')](handleError(_0x15de28,null));};exports[_0xbbb6('0x24')]=function(_0x1eda2d,_0x1b16c7){if(_0x1eda2d[_0xbbb6('0x47')]['id']){delete _0x1eda2d[_0xbbb6('0x47')]['id'];}return db[_0xbbb6('0x2c')][_0xbbb6('0x48')]({'where':{'id':_0x1eda2d['params']['id']}})[_0xbbb6('0x25')](handleEntityNotFound(_0x1b16c7,null))[_0xbbb6('0x25')](saveUpdates(_0x1eda2d[_0xbbb6('0x47')],null))[_0xbbb6('0x25')](respondWithResult(_0x1b16c7,null))[_0xbbb6('0x43')](handleError(_0x1b16c7,null));};exports[_0xbbb6('0x26')]=function(_0x1b56ea,_0x3a6824){return db['SmsQueueReport'][_0xbbb6('0x48')]({'where':{'id':_0x1b56ea['params']['id']}})[_0xbbb6('0x25')](handleEntityNotFound(_0x3a6824,null))[_0xbbb6('0x25')](removeEntity(_0x3a6824,null))[_0xbbb6('0x43')](handleError(_0x3a6824,null));};exports[_0xbbb6('0x49')]=function(_0x2f22fb,_0x825802){return db[_0xbbb6('0x2c')][_0xbbb6('0x49')]()['then'](respondWithResult(_0x825802,null))['catch'](handleError(_0x825802,null));}; \ No newline at end of file +var _0x3305=['attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','length','create','update','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SmsQueueReport','model','query','keys','filters','intersection'];(function(_0xf4356f,_0x478f6d){var _0x3c304c=function(_0x1a08dc){while(--_0x1a08dc){_0xf4356f['push'](_0xf4356f['shift']());}};_0x3c304c(++_0x478f6d);}(_0x3305,0xac));var _0x5330=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3305[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x5330('0x0'));var rimraf=require(_0x5330('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5330('0x2'));var rp=require('request-promise');var moment=require(_0x5330('0x3'));var BPromise=require(_0x5330('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5330('0x5'));var csv=require(_0x5330('0x6'));var ejs=require(_0x5330('0x7'));var fs=require('fs');var fs_extra=require(_0x5330('0x8'));var _=require(_0x5330('0x9'));var squel=require(_0x5330('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5330('0xb'));var toCsv=require(_0x5330('0x6'));var querystring=require(_0x5330('0xc'));var Papa=require(_0x5330('0xd'));var Redis=require(_0x5330('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5330('0xf'));var as=require(_0x5330('0x10'));var hardwareService=require(_0x5330('0x11'));var logger=require(_0x5330('0x12'))(_0x5330('0x13'));var utils=require(_0x5330('0x14'));var config=require(_0x5330('0x15'));var licenseUtil=require(_0x5330('0x16'));var db=require(_0x5330('0x17'))['db'];function respondWithStatusCode(_0x48c974,_0x245f8f){_0x245f8f=_0x245f8f||0xcc;return function(_0x21e48d){if(_0x21e48d){return _0x48c974[_0x5330('0x18')](_0x245f8f);}return _0x48c974[_0x5330('0x19')](_0x245f8f)[_0x5330('0x1a')]();};}function respondWithResult(_0x5efb5f,_0x35e25f){_0x35e25f=_0x35e25f||0xc8;return function(_0x36c534){if(_0x36c534){return _0x5efb5f['status'](_0x35e25f)[_0x5330('0x1b')](_0x36c534);}};}function respondWithFilteredResult(_0x406a2a,_0x2555ba){return function(_0x26cfb6){if(_0x26cfb6){var _0x2daaeb=typeof _0x2555ba[_0x5330('0x1c')]===_0x5330('0x1d')&&typeof _0x2555ba[_0x5330('0x1e')]===_0x5330('0x1d');var _0x5a9e92=_0x26cfb6['count'];var _0x229cd4=_0x2daaeb?0x0:_0x2555ba[_0x5330('0x1c')];var _0x544e4b=_0x2daaeb?_0x26cfb6[_0x5330('0x1f')]:_0x2555ba['offset']+_0x2555ba['limit'];var _0x1b1a3c;if(_0x544e4b>=_0x5a9e92){_0x544e4b=_0x5a9e92;_0x1b1a3c=0xc8;}else{_0x1b1a3c=0xce;}_0x406a2a[_0x5330('0x19')](_0x1b1a3c);return _0x406a2a[_0x5330('0x20')](_0x5330('0x21'),_0x229cd4+'-'+_0x544e4b+'/'+_0x5a9e92)['json'](_0x26cfb6);}return null;};}function patchUpdates(_0x50fb88){return function(_0x2c0d37){try{jsonpatch[_0x5330('0x22')](_0x2c0d37,_0x50fb88,!![]);}catch(_0x297132){return BPromise[_0x5330('0x23')](_0x297132);}return _0x2c0d37[_0x5330('0x24')]();};}function saveUpdates(_0x1a1119,_0x1a0efe){return function(_0x4b3cc9){if(_0x4b3cc9){return _0x4b3cc9['update'](_0x1a1119)['then'](function(_0x37761b){return _0x37761b;});}return null;};}function removeEntity(_0x2c64f7,_0x94a6e9){return function(_0xf26f8f){if(_0xf26f8f){return _0xf26f8f[_0x5330('0x25')]()[_0x5330('0x26')](function(){_0x2c64f7[_0x5330('0x19')](0xcc)[_0x5330('0x1a')]();});}};}function handleEntityNotFound(_0x2f13c2,_0x1b6382){return function(_0x569237){if(!_0x569237){_0x2f13c2[_0x5330('0x18')](0x194);}return _0x569237;};}function handleError(_0x3e3d6c,_0x4b7f32){_0x4b7f32=_0x4b7f32||0x1f4;return function(_0x2019fc){logger[_0x5330('0x27')](_0x2019fc[_0x5330('0x28')]);if(_0x2019fc[_0x5330('0x29')]){delete _0x2019fc[_0x5330('0x29')];}_0x3e3d6c[_0x5330('0x19')](_0x4b7f32)['send'](_0x2019fc);};}exports[_0x5330('0x2a')]=function(_0x2d6236,_0x2625fd){var _0x2d66e9={},_0x2bb0b6={},_0xe8131b={'count':0x0,'rows':[]};var _0x572523=_[_0x5330('0x2b')](db[_0x5330('0x2c')]['rawAttributes'],function(_0xf3cd6d){return{'name':_0xf3cd6d['fieldName'],'type':_0xf3cd6d['type']['key']};});_0x2bb0b6[_0x5330('0x2d')]=_[_0x5330('0x2b')](_0x572523,_0x5330('0x29'));_0x2bb0b6[_0x5330('0x2e')]=_[_0x5330('0x2f')](_0x2d6236[_0x5330('0x2e')]);_0x2bb0b6[_0x5330('0x30')]=_[_0x5330('0x31')](_0x2bb0b6['model'],_0x2bb0b6['query']);_0x2d66e9[_0x5330('0x32')]=_[_0x5330('0x31')](_0x2bb0b6[_0x5330('0x2d')],qs[_0x5330('0x33')](_0x2d6236[_0x5330('0x2e')]['fields']));_0x2d66e9[_0x5330('0x32')]=_0x2d66e9['attributes']['length']?_0x2d66e9[_0x5330('0x32')]:_0x2bb0b6[_0x5330('0x2d')];if(!_0x2d6236[_0x5330('0x2e')][_0x5330('0x34')](_0x5330('0x35'))){_0x2d66e9['limit']=qs[_0x5330('0x1e')](_0x2d6236[_0x5330('0x2e')]['limit']);_0x2d66e9['offset']=qs[_0x5330('0x1c')](_0x2d6236['query'][_0x5330('0x1c')]);}_0x2d66e9['order']=qs['sort'](_0x2d6236['query'][_0x5330('0x36')]);_0x2d66e9[_0x5330('0x37')]=qs[_0x5330('0x30')](_[_0x5330('0x38')](_0x2d6236[_0x5330('0x2e')],_0x2bb0b6[_0x5330('0x30')]),_0x572523);if(_0x2d6236[_0x5330('0x2e')][_0x5330('0x39')]){_0x2d66e9[_0x5330('0x37')]=_['merge'](_0x2d66e9[_0x5330('0x37')],{'$or':_[_0x5330('0x2b')](_0x572523,function(_0xa83f47){if(_0xa83f47[_0x5330('0x3a')]!==_0x5330('0x3b')){var _0x72b8e4={};_0x72b8e4[_0xa83f47['name']]={'$like':'%'+_0x2d6236[_0x5330('0x2e')][_0x5330('0x39')]+'%'};return _0x72b8e4;}})});}_0x2d66e9=_[_0x5330('0x3c')]({},_0x2d66e9,_0x2d6236[_0x5330('0x3d')]);var _0x1e7eff={'where':_0x2d66e9['where']};return db[_0x5330('0x2c')][_0x5330('0x1f')](_0x1e7eff)[_0x5330('0x26')](function(_0x4747e9){_0xe8131b[_0x5330('0x1f')]=_0x4747e9;if(_0x2d6236['query'][_0x5330('0x3e')]){_0x2d66e9[_0x5330('0x3f')]=[{'all':!![]}];}return db[_0x5330('0x2c')]['findAll'](_0x2d66e9);})[_0x5330('0x26')](function(_0xf97225){_0xe8131b[_0x5330('0x40')]=_0xf97225;return _0xe8131b;})[_0x5330('0x26')](respondWithFilteredResult(_0x2625fd,_0x2d66e9))[_0x5330('0x41')](handleError(_0x2625fd,null));};exports[_0x5330('0x42')]=function(_0x75ea97,_0x34cb6e){var _0x285ccb={'raw':!![],'where':{'id':_0x75ea97[_0x5330('0x43')]['id']}},_0x3ede87={};_0x3ede87[_0x5330('0x2d')]=_[_0x5330('0x2f')](db[_0x5330('0x2c')][_0x5330('0x44')]);_0x3ede87[_0x5330('0x2e')]=_['keys'](_0x75ea97[_0x5330('0x2e')]);_0x3ede87[_0x5330('0x30')]=_['intersection'](_0x3ede87[_0x5330('0x2d')],_0x3ede87[_0x5330('0x2e')]);_0x285ccb['attributes']=_[_0x5330('0x31')](_0x3ede87[_0x5330('0x2d')],qs[_0x5330('0x33')](_0x75ea97[_0x5330('0x2e')][_0x5330('0x33')]));_0x285ccb[_0x5330('0x32')]=_0x285ccb[_0x5330('0x32')][_0x5330('0x45')]?_0x285ccb['attributes']:_0x3ede87[_0x5330('0x2d')];if(_0x75ea97['query'][_0x5330('0x3e')]){_0x285ccb[_0x5330('0x3f')]=[{'all':!![]}];}_0x285ccb=_[_0x5330('0x3c')]({},_0x285ccb,_0x75ea97[_0x5330('0x3d')]);return db[_0x5330('0x2c')]['find'](_0x285ccb)[_0x5330('0x26')](handleEntityNotFound(_0x34cb6e,null))[_0x5330('0x26')](respondWithResult(_0x34cb6e,null))[_0x5330('0x41')](handleError(_0x34cb6e,null));};exports[_0x5330('0x46')]=function(_0x4869d2,_0x605ec2){return db[_0x5330('0x2c')][_0x5330('0x46')](_0x4869d2['body'],{})[_0x5330('0x26')](respondWithResult(_0x605ec2,0xc9))[_0x5330('0x41')](handleError(_0x605ec2,null));};exports[_0x5330('0x47')]=function(_0x281e4b,_0x4705e6){if(_0x281e4b[_0x5330('0x48')]['id']){delete _0x281e4b['body']['id'];}return db[_0x5330('0x2c')][_0x5330('0x49')]({'where':{'id':_0x281e4b[_0x5330('0x43')]['id']}})[_0x5330('0x26')](handleEntityNotFound(_0x4705e6,null))[_0x5330('0x26')](saveUpdates(_0x281e4b[_0x5330('0x48')],null))[_0x5330('0x26')](respondWithResult(_0x4705e6,null))[_0x5330('0x41')](handleError(_0x4705e6,null));};exports['destroy']=function(_0x4ea891,_0x47f264){return db[_0x5330('0x2c')]['find']({'where':{'id':_0x4ea891[_0x5330('0x43')]['id']}})[_0x5330('0x26')](handleEntityNotFound(_0x47f264,null))['then'](removeEntity(_0x47f264,null))[_0x5330('0x41')](handleError(_0x47f264,null));};exports['describe']=function(_0x5baed7,_0x23a563){return db[_0x5330('0x2c')]['describe']()[_0x5330('0x26')](respondWithResult(_0x23a563,null))[_0x5330('0x41')](handleError(_0x23a563,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2c5c36e..ea52fbb 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0xc7d92f,_0x2f2193){var _0x3a17ea=function(_0x4315de){while(--_0x4315de){_0xc7d92f['push'](_0xc7d92f['shift']());}};_0x3a17ea(++_0x2f2193);}(_0xe706,0xa3));var _0x6e70=function(_0x213969,_0x303344){_0x213969=_0x213969-0x0;var _0x5f4fca=_0xe706[_0x213969];return _0x5f4fca;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4cc198,_0x500ba){var _0x2a0fb1=function(_0x57a58){while(--_0x57a58){_0x4cc198['push'](_0x4cc198['shift']());}};_0x2a0fb1(++_0x500ba);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xcb91[_0x43e4b3];return _0x10c655;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8745539..4d90fca 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 _0x822e=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','body','where','attributes','lodash'];(function(_0x4753d7,_0x3d4f6d){var _0x3b8f0c=function(_0xb0c445){while(--_0xb0c445){_0x4753d7['push'](_0x4753d7['shift']());}};_0x3b8f0c(++_0x3d4f6d);}(_0x822e,0xbf));var _0xe822=function(_0x1aa1a2,_0x5118bc){_0x1aa1a2=_0x1aa1a2-0x0;var _0x185e8d=_0x822e[_0x1aa1a2];return _0x185e8d;};'use strict';var _=require(_0xe822('0x0'));var util=require(_0xe822('0x1'));var moment=require(_0xe822('0x2'));var BPromise=require('bluebird');var rs=require(_0xe822('0x3'));var fs=require('fs');var Redis=require(_0xe822('0x4'));var db=require(_0xe822('0x5'))['db'];var utils=require(_0xe822('0x6'));var logger=require('../../config/logger')(_0xe822('0x7'));var config=require('../../config/environment');var jayson=require(_0xe822('0x8'));var client=jayson[_0xe822('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x351f3b,_0xfe7a28,_0x4e5f19){return new BPromise(function(_0x43c759,_0x226c1c){return client[_0xe822('0xa')](_0x351f3b,_0x4e5f19)[_0xe822('0xb')](function(_0xe701d2){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xfe7a28,_0xe822('0xc'));logger[_0xe822('0xd')](_0xe822('0xe'),_0xfe7a28,_0xe822('0xc'),JSON[_0xe822('0xf')](_0xe701d2));if(_0xe701d2['error']){if(_0xe701d2['error'][_0xe822('0x10')]===0x1f4){logger[_0xe822('0x11')](_0xe822('0x12'),_0xfe7a28,_0xe701d2[_0xe822('0x11')][_0xe822('0x13')]);return _0x226c1c(_0xe701d2[_0xe822('0x11')][_0xe822('0x13')]);}logger['error'](_0xe822('0x12'),_0xfe7a28,_0xe701d2[_0xe822('0x11')][_0xe822('0x13')]);return _0x43c759(_0xe701d2[_0xe822('0x11')]['message']);}else{logger[_0xe822('0x14')](_0xe822('0x12'),_0xfe7a28,'request\x20sent');_0x43c759(_0xe701d2[_0xe822('0x15')][_0xe822('0x13')]);}})[_0xe822('0x16')](function(_0x1a9292){logger[_0xe822('0x11')](_0xe822('0x12'),_0xfe7a28,_0x1a9292);_0x226c1c(_0x1a9292);});});}exports[_0xe822('0x17')]=function(_0x47d595){var _0xcee313=this;return new Promise(function(_0x5d45e2,_0x288b38){return db[_0xe822('0x18')][_0xe822('0x19')](_0x47d595['body'],{'raw':_0x47d595['options']?_0x47d595[_0xe822('0x1a')][_0xe822('0x1b')]===undefined?!![]:![]:!![]})[_0xe822('0xb')](function(_0x19fa32){logger[_0xe822('0x14')](_0xe822('0x17'),_0x47d595);logger['debug'](_0xe822('0x17'),_0x47d595,JSON['stringify'](_0x19fa32));_0x5d45e2(_0x19fa32);})[_0xe822('0x16')](function(_0x4337fa){logger['error'](_0xe822('0x17'),_0x4337fa['message'],_0x47d595);_0x288b38(_0xcee313[_0xe822('0x11')](0x1f4,_0x4337fa['message']));});});};exports[_0xe822('0x1c')]=function(_0xfdb42f){var _0x57846b=this;return new Promise(function(_0x2ba542,_0x3a5437){return db[_0xe822('0x18')]['update'](_0xfdb42f[_0xe822('0x1d')],{'raw':_0xfdb42f[_0xe822('0x1a')]?_0xfdb42f[_0xe822('0x1a')][_0xe822('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdb42f[_0xe822('0x1a')]?_0xfdb42f['options'][_0xe822('0x1e')]||null:null,'attributes':_0xfdb42f[_0xe822('0x1a')]?_0xfdb42f[_0xe822('0x1a')][_0xe822('0x1f')]||null:null,'limit':_0xfdb42f['options']?_0xfdb42f[_0xe822('0x1a')]['limit']||null:null})[_0xe822('0xb')](function(_0x346d53){logger[_0xe822('0x14')](_0xe822('0x1c'),_0xfdb42f);logger[_0xe822('0xd')]('UpdateSmsQueueReport',_0xfdb42f,JSON[_0xe822('0xf')](_0x346d53));_0x2ba542(_0x346d53);})[_0xe822('0x16')](function(_0x3941c9){logger[_0xe822('0x11')](_0xe822('0x1c'),_0x3941c9[_0xe822('0x13')],_0xfdb42f);_0x3a5437(_0x57846b['error'](0x1f4,_0x3941c9[_0xe822('0x13')]));});});}; \ No newline at end of file +var _0xce95=['../../config/environment','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','then','UpdateSmsQueueReport','body','raw','where','attributes','limit','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x48f851,_0x1efdc0){var _0x22c062=function(_0x3c6331){while(--_0x3c6331){_0x48f851['push'](_0x48f851['shift']());}};_0x22c062(++_0x1efdc0);}(_0xce95,0x178));var _0x5ce9=function(_0x5e5088,_0x28cd71){_0x5e5088=_0x5e5088-0x0;var _0x3de657=_0xce95[_0x5e5088];return _0x3de657;};'use strict';var _=require('lodash');var util=require(_0x5ce9('0x0'));var moment=require(_0x5ce9('0x1'));var BPromise=require(_0x5ce9('0x2'));var rs=require(_0x5ce9('0x3'));var fs=require('fs');var Redis=require(_0x5ce9('0x4'));var db=require(_0x5ce9('0x5'))['db'];var utils=require(_0x5ce9('0x6'));var logger=require(_0x5ce9('0x7'))(_0x5ce9('0x8'));var config=require(_0x5ce9('0x9'));var jayson=require(_0x5ce9('0xa'));var client=jayson['client'][_0x5ce9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c8021,_0x309d6e,_0x1df269){return new BPromise(function(_0x4d6c77,_0xd69eec){return client[_0x5ce9('0xc')](_0x3c8021,_0x1df269)['then'](function(_0x51bca7){logger[_0x5ce9('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x309d6e,'request\x20sent');logger['debug'](_0x5ce9('0xe'),_0x309d6e,_0x5ce9('0xf'),JSON['stringify'](_0x51bca7));if(_0x51bca7[_0x5ce9('0x10')]){if(_0x51bca7[_0x5ce9('0x10')][_0x5ce9('0x11')]===0x1f4){logger[_0x5ce9('0x10')](_0x5ce9('0x12'),_0x309d6e,_0x51bca7[_0x5ce9('0x10')][_0x5ce9('0x13')]);return _0xd69eec(_0x51bca7[_0x5ce9('0x10')]['message']);}logger[_0x5ce9('0x10')](_0x5ce9('0x12'),_0x309d6e,_0x51bca7[_0x5ce9('0x10')]['message']);return _0x4d6c77(_0x51bca7[_0x5ce9('0x10')][_0x5ce9('0x13')]);}else{logger[_0x5ce9('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x309d6e,_0x5ce9('0xf'));_0x4d6c77(_0x51bca7[_0x5ce9('0x14')]['message']);}})[_0x5ce9('0x15')](function(_0x10da10){logger[_0x5ce9('0x10')](_0x5ce9('0x12'),_0x309d6e,_0x10da10);_0xd69eec(_0x10da10);});});}exports[_0x5ce9('0x16')]=function(_0x2967b5){var _0x27774c=this;return new Promise(function(_0x4d2be3,_0x536d26){return db[_0x5ce9('0x17')][_0x5ce9('0x18')](_0x2967b5['body'],{'raw':_0x2967b5[_0x5ce9('0x19')]?_0x2967b5[_0x5ce9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5ce9('0x1a')](function(_0x10fa37){logger[_0x5ce9('0xd')](_0x5ce9('0x16'),_0x2967b5);logger['debug'](_0x5ce9('0x16'),_0x2967b5,JSON['stringify'](_0x10fa37));_0x4d2be3(_0x10fa37);})[_0x5ce9('0x15')](function(_0x1ddc6b){logger[_0x5ce9('0x10')](_0x5ce9('0x16'),_0x1ddc6b[_0x5ce9('0x13')],_0x2967b5);_0x536d26(_0x27774c['error'](0x1f4,_0x1ddc6b['message']));});});};exports[_0x5ce9('0x1b')]=function(_0x6c61a2){var _0x3d8cec=this;return new Promise(function(_0x483b39,_0x369905){return db[_0x5ce9('0x17')]['update'](_0x6c61a2[_0x5ce9('0x1c')],{'raw':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2[_0x5ce9('0x19')][_0x5ce9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2[_0x5ce9('0x19')][_0x5ce9('0x1e')]||null:null,'attributes':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2['options'][_0x5ce9('0x1f')]||null:null,'limit':_0x6c61a2[_0x5ce9('0x19')]?_0x6c61a2[_0x5ce9('0x19')][_0x5ce9('0x20')]||null:null})['then'](function(_0x2e2e6e){logger[_0x5ce9('0xd')]('UpdateSmsQueueReport',_0x6c61a2);logger[_0x5ce9('0x21')]('UpdateSmsQueueReport',_0x6c61a2,JSON[_0x5ce9('0x22')](_0x2e2e6e));_0x483b39(_0x2e2e6e);})[_0x5ce9('0x15')](function(_0xee40d0){logger['error'](_0x5ce9('0x1b'),_0xee40d0['message'],_0x6c61a2);_0x369905(_0x3d8cec[_0x5ce9('0x10')](0x1f4,_0xee40d0[_0x5ce9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f65d744..7ae6cf3 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 _0xf0ba=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','destroy','exports','multer'];(function(_0x464fd5,_0x3ac1a9){var _0x2a75e1=function(_0xf41ad9){while(--_0xf41ad9){_0x464fd5['push'](_0x464fd5['shift']());}};_0x2a75e1(++_0x3ac1a9);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require(_0xaf0b('0x2'));var timeout=require(_0xaf0b('0x3'));var express=require(_0xaf0b('0x4'));var router=express['Router']();var fs_extra=require(_0xaf0b('0x5'));var auth=require(_0xaf0b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf0b('0x7'));var controller=require('./smsTransferReport.controller');router[_0xaf0b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaf0b('0x8')](_0xaf0b('0x9'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xb')]);router[_0xaf0b('0x8')]('/:id',auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xc')]);router[_0xaf0b('0xd')]('/',auth['isAuthenticated'](),controller[_0xaf0b('0xe')]);router['put'](_0xaf0b('0xf'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0x10')]);router['delete'](_0xaf0b('0xf'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0x11')]);module[_0xaf0b('0x12')]=router; \ No newline at end of file +var _0xdc97=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x3cba80,_0x3024e7){var _0x11cb67=function(_0x56f8c8){while(--_0x56f8c8){_0x3cba80['push'](_0x3cba80['shift']());}};_0x11cb67(++_0x3024e7);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1e11f5,_0x25e4d2){_0x1e11f5=_0x1e11f5-0x0;var _0x97366c=_0xdc97[_0x1e11f5];return _0x97366c;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var fs_extra=require(_0x7dc9('0x4'));var auth=require(_0x7dc9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller['index']);router[_0x7dc9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7dc9('0xa')]);router[_0x7dc9('0x8')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router['post']('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0xe')](_0x7dc9('0xb'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xf')]);router[_0x7dc9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5224455..c5d868c 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0x34e8,0x12c));var _0x834e=function(_0x28be56,_0x254350){_0x28be56=_0x28be56-0x0;var _0x67c369=_0x34e8[_0x28be56];return _0x67c369;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1eba49,_0x15468c){var _0x5097e5=function(_0x259283){while(--_0x259283){_0x1eba49['push'](_0x1eba49['shift']());}};_0x5097e5(++_0x15468c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0xcb91[_0x163742];return _0x1152ac;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 59c39e3..40dbeaf 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 _0xc173=['catch','show','params','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','SmsTransferReport','includeAll','include','findAll'];(function(_0x14eb14,_0x46d205){var _0xef813a=function(_0x57459a){while(--_0x57459a){_0x14eb14['push'](_0x14eb14['shift']());}};_0xef813a(++_0x46d205);}(_0xc173,0x1be));var _0x3c17=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc173[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3c17('0x0'));var rimraf=require(_0x3c17('0x1'));var zipdir=require(_0x3c17('0x2'));var jsonpatch=require(_0x3c17('0x3'));var rp=require('request-promise');var moment=require(_0x3c17('0x4'));var BPromise=require(_0x3c17('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3c17('0x6'));var csv=require(_0x3c17('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c17('0x8'));var _=require(_0x3c17('0x9'));var squel=require(_0x3c17('0xa'));var crypto=require(_0x3c17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3c17('0xc'));var toCsv=require(_0x3c17('0x7'));var querystring=require(_0x3c17('0xd'));var Papa=require(_0x3c17('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c17('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c17('0x10'));var logger=require(_0x3c17('0x11'))(_0x3c17('0x12'));var utils=require(_0x3c17('0x13'));var config=require(_0x3c17('0x14'));var licenseUtil=require(_0x3c17('0x15'));var db=require(_0x3c17('0x16'))['db'];function respondWithStatusCode(_0x11e30b,_0x2681e3){_0x2681e3=_0x2681e3||0xcc;return function(_0x1fa742){if(_0x1fa742){return _0x11e30b[_0x3c17('0x17')](_0x2681e3);}return _0x11e30b[_0x3c17('0x18')](_0x2681e3)[_0x3c17('0x19')]();};}function respondWithResult(_0x51dbbd,_0x4d3155){_0x4d3155=_0x4d3155||0xc8;return function(_0x90006){if(_0x90006){return _0x51dbbd['status'](_0x4d3155)[_0x3c17('0x1a')](_0x90006);}};}function respondWithFilteredResult(_0x3267c3,_0x44f2e4){return function(_0x4d3909){if(_0x4d3909){var _0x5b3711=typeof _0x44f2e4[_0x3c17('0x1b')]===_0x3c17('0x1c')&&typeof _0x44f2e4[_0x3c17('0x1d')]===_0x3c17('0x1c');var _0x502b04=_0x4d3909[_0x3c17('0x1e')];var _0x2cacae=_0x5b3711?0x0:_0x44f2e4['offset'];var _0x985124=_0x5b3711?_0x4d3909[_0x3c17('0x1e')]:_0x44f2e4[_0x3c17('0x1b')]+_0x44f2e4[_0x3c17('0x1d')];var _0x135275;if(_0x985124>=_0x502b04){_0x985124=_0x502b04;_0x135275=0xc8;}else{_0x135275=0xce;}_0x3267c3[_0x3c17('0x18')](_0x135275);return _0x3267c3[_0x3c17('0x1f')]('Content-Range',_0x2cacae+'-'+_0x985124+'/'+_0x502b04)[_0x3c17('0x1a')](_0x4d3909);}return null;};}function patchUpdates(_0x240478){return function(_0x401caf){try{jsonpatch[_0x3c17('0x20')](_0x401caf,_0x240478,!![]);}catch(_0x4d6858){return BPromise[_0x3c17('0x21')](_0x4d6858);}return _0x401caf[_0x3c17('0x22')]();};}function saveUpdates(_0x51994f,_0x5d2284){return function(_0x5056c3){if(_0x5056c3){return _0x5056c3[_0x3c17('0x23')](_0x51994f)[_0x3c17('0x24')](function(_0x264422){return _0x264422;});}return null;};}function removeEntity(_0x47a315,_0x22a641){return function(_0xb177f2){if(_0xb177f2){return _0xb177f2[_0x3c17('0x25')]()['then'](function(){_0x47a315[_0x3c17('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23afdb,_0x9fd59c){return function(_0x16eb8f){if(!_0x16eb8f){_0x23afdb[_0x3c17('0x17')](0x194);}return _0x16eb8f;};}function handleError(_0xb36428,_0x7a2a91){_0x7a2a91=_0x7a2a91||0x1f4;return function(_0x38d639){logger['error'](_0x38d639['stack']);if(_0x38d639[_0x3c17('0x26')]){delete _0x38d639['name'];}_0xb36428[_0x3c17('0x18')](_0x7a2a91)[_0x3c17('0x27')](_0x38d639);};}exports[_0x3c17('0x28')]=function(_0x500c3e,_0x327db4){var _0x497ac5={},_0x52a31c={},_0x1e7cd2={'count':0x0,'rows':[]};var _0x5dbeb6=_[_0x3c17('0x29')](db['SmsTransferReport'][_0x3c17('0x2a')],function(_0x308ebb){return{'name':_0x308ebb[_0x3c17('0x2b')],'type':_0x308ebb[_0x3c17('0x2c')][_0x3c17('0x2d')]};});_0x52a31c[_0x3c17('0x2e')]=_['map'](_0x5dbeb6,_0x3c17('0x26'));_0x52a31c[_0x3c17('0x2f')]=_[_0x3c17('0x30')](_0x500c3e[_0x3c17('0x2f')]);_0x52a31c[_0x3c17('0x31')]=_['intersection'](_0x52a31c[_0x3c17('0x2e')],_0x52a31c[_0x3c17('0x2f')]);_0x497ac5[_0x3c17('0x32')]=_['intersection'](_0x52a31c['model'],qs[_0x3c17('0x33')](_0x500c3e[_0x3c17('0x2f')][_0x3c17('0x33')]));_0x497ac5[_0x3c17('0x32')]=_0x497ac5[_0x3c17('0x32')][_0x3c17('0x34')]?_0x497ac5[_0x3c17('0x32')]:_0x52a31c[_0x3c17('0x2e')];if(!_0x500c3e[_0x3c17('0x2f')][_0x3c17('0x35')](_0x3c17('0x36'))){_0x497ac5[_0x3c17('0x1d')]=qs[_0x3c17('0x1d')](_0x500c3e[_0x3c17('0x2f')][_0x3c17('0x1d')]);_0x497ac5[_0x3c17('0x1b')]=qs['offset'](_0x500c3e[_0x3c17('0x2f')][_0x3c17('0x1b')]);}_0x497ac5['order']=qs[_0x3c17('0x37')](_0x500c3e[_0x3c17('0x2f')][_0x3c17('0x37')]);_0x497ac5[_0x3c17('0x38')]=qs[_0x3c17('0x31')](_[_0x3c17('0x39')](_0x500c3e['query'],_0x52a31c[_0x3c17('0x31')]),_0x5dbeb6);if(_0x500c3e[_0x3c17('0x2f')]['filter']){_0x497ac5['where']=_[_0x3c17('0x3a')](_0x497ac5['where'],{'$or':_['map'](_0x5dbeb6,function(_0x41e04d){if(_0x41e04d[_0x3c17('0x2c')]!==_0x3c17('0x3b')){var _0x3b23c5={};_0x3b23c5[_0x41e04d[_0x3c17('0x26')]]={'$like':'%'+_0x500c3e['query'][_0x3c17('0x3c')]+'%'};return _0x3b23c5;}})});}_0x497ac5=_[_0x3c17('0x3a')]({},_0x497ac5,_0x500c3e['options']);var _0x409311={'where':_0x497ac5['where']};return db[_0x3c17('0x3d')][_0x3c17('0x1e')](_0x409311)['then'](function(_0x4f0506){_0x1e7cd2[_0x3c17('0x1e')]=_0x4f0506;if(_0x500c3e[_0x3c17('0x2f')][_0x3c17('0x3e')]){_0x497ac5[_0x3c17('0x3f')]=[{'all':!![]}];}return db[_0x3c17('0x3d')][_0x3c17('0x40')](_0x497ac5);})['then'](function(_0x2c4100){_0x1e7cd2['rows']=_0x2c4100;return _0x1e7cd2;})[_0x3c17('0x24')](respondWithFilteredResult(_0x327db4,_0x497ac5))[_0x3c17('0x41')](handleError(_0x327db4,null));};exports[_0x3c17('0x42')]=function(_0x321a4f,_0x523ada){var _0x52fc84={'raw':!![],'where':{'id':_0x321a4f[_0x3c17('0x43')]['id']}},_0x4d09e1={};_0x4d09e1[_0x3c17('0x2e')]=_[_0x3c17('0x30')](db[_0x3c17('0x3d')][_0x3c17('0x2a')]);_0x4d09e1['query']=_[_0x3c17('0x30')](_0x321a4f[_0x3c17('0x2f')]);_0x4d09e1[_0x3c17('0x31')]=_['intersection'](_0x4d09e1['model'],_0x4d09e1['query']);_0x52fc84['attributes']=_[_0x3c17('0x44')](_0x4d09e1[_0x3c17('0x2e')],qs[_0x3c17('0x33')](_0x321a4f['query']['fields']));_0x52fc84[_0x3c17('0x32')]=_0x52fc84[_0x3c17('0x32')][_0x3c17('0x34')]?_0x52fc84[_0x3c17('0x32')]:_0x4d09e1[_0x3c17('0x2e')];if(_0x321a4f['query'][_0x3c17('0x3e')]){_0x52fc84[_0x3c17('0x3f')]=[{'all':!![]}];}_0x52fc84=_[_0x3c17('0x3a')]({},_0x52fc84,_0x321a4f['options']);return db['SmsTransferReport'][_0x3c17('0x45')](_0x52fc84)[_0x3c17('0x24')](handleEntityNotFound(_0x523ada,null))[_0x3c17('0x24')](respondWithResult(_0x523ada,null))['catch'](handleError(_0x523ada,null));};exports['create']=function(_0x515fac,_0x5b9aad){return db[_0x3c17('0x3d')][_0x3c17('0x46')](_0x515fac[_0x3c17('0x47')],{})['then'](respondWithResult(_0x5b9aad,0xc9))[_0x3c17('0x41')](handleError(_0x5b9aad,null));};exports['update']=function(_0x454b89,_0x3e557e){if(_0x454b89[_0x3c17('0x47')]['id']){delete _0x454b89[_0x3c17('0x47')]['id'];}return db[_0x3c17('0x3d')]['find']({'where':{'id':_0x454b89['params']['id']}})[_0x3c17('0x24')](handleEntityNotFound(_0x3e557e,null))[_0x3c17('0x24')](saveUpdates(_0x454b89[_0x3c17('0x47')],null))[_0x3c17('0x24')](respondWithResult(_0x3e557e,null))[_0x3c17('0x41')](handleError(_0x3e557e,null));};exports[_0x3c17('0x25')]=function(_0x1bebf1,_0x312676){return db[_0x3c17('0x3d')][_0x3c17('0x45')]({'where':{'id':_0x1bebf1['params']['id']}})[_0x3c17('0x24')](handleEntityNotFound(_0x312676,null))[_0x3c17('0x24')](removeEntity(_0x312676,null))[_0x3c17('0x41')](handleError(_0x312676,null));};exports[_0x3c17('0x48')]=function(_0x22b444,_0x3db97c){return db[_0x3c17('0x3d')][_0x3c17('0x48')]()[_0x3c17('0x24')](respondWithResult(_0x3db97c,null))['catch'](handleError(_0x3db97c,null));}; \ No newline at end of file +var _0xc9d9=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x18fba1,_0x190cd4){var _0x2409d6=function(_0x14cb49){while(--_0x14cb49){_0x18fba1['push'](_0x18fba1['shift']());}};_0x2409d6(++_0x190cd4);}(_0xc9d9,0x1e1));var _0x9c9d=function(_0x2b114f,_0x3cec30){_0x2b114f=_0x2b114f-0x0;var _0x2d401e=_0xc9d9[_0x2b114f];return _0x2d401e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c9d('0x0'));var zipdir=require(_0x9c9d('0x1'));var jsonpatch=require(_0x9c9d('0x2'));var rp=require(_0x9c9d('0x3'));var moment=require(_0x9c9d('0x4'));var BPromise=require(_0x9c9d('0x5'));var Mustache=require(_0x9c9d('0x6'));var util=require(_0x9c9d('0x7'));var path=require(_0x9c9d('0x8'));var sox=require(_0x9c9d('0x9'));var csv=require(_0x9c9d('0xa'));var ejs=require(_0x9c9d('0xb'));var fs=require('fs');var fs_extra=require(_0x9c9d('0xc'));var _=require(_0x9c9d('0xd'));var squel=require(_0x9c9d('0xe'));var crypto=require('crypto');var jsforce=require(_0x9c9d('0xf'));var deskjs=require(_0x9c9d('0x10'));var toCsv=require(_0x9c9d('0xa'));var querystring=require(_0x9c9d('0x11'));var Papa=require(_0x9c9d('0x12'));var Redis=require(_0x9c9d('0x13'));var authService=require(_0x9c9d('0x14'));var qs=require(_0x9c9d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c9d('0x16'));var logger=require(_0x9c9d('0x17'))('api');var utils=require(_0x9c9d('0x18'));var config=require(_0x9c9d('0x19'));var licenseUtil=require(_0x9c9d('0x1a'));var db=require(_0x9c9d('0x1b'))['db'];function respondWithStatusCode(_0x178c51,_0x432fdf){_0x432fdf=_0x432fdf||0xcc;return function(_0x496fde){if(_0x496fde){return _0x178c51[_0x9c9d('0x1c')](_0x432fdf);}return _0x178c51[_0x9c9d('0x1d')](_0x432fdf)[_0x9c9d('0x1e')]();};}function respondWithResult(_0x4c7ca1,_0x30c3c5){_0x30c3c5=_0x30c3c5||0xc8;return function(_0x50ab26){if(_0x50ab26){return _0x4c7ca1[_0x9c9d('0x1d')](_0x30c3c5)[_0x9c9d('0x1f')](_0x50ab26);}};}function respondWithFilteredResult(_0x8ee331,_0x538826){return function(_0x46b815){if(_0x46b815){var _0x6b7304=typeof _0x538826[_0x9c9d('0x20')]===_0x9c9d('0x21')&&typeof _0x538826[_0x9c9d('0x22')]==='undefined';var _0x4b270f=_0x46b815[_0x9c9d('0x23')];var _0x16376f=_0x6b7304?0x0:_0x538826[_0x9c9d('0x20')];var _0xd93d07=_0x6b7304?_0x46b815['count']:_0x538826[_0x9c9d('0x20')]+_0x538826[_0x9c9d('0x22')];var _0x353082;if(_0xd93d07>=_0x4b270f){_0xd93d07=_0x4b270f;_0x353082=0xc8;}else{_0x353082=0xce;}_0x8ee331['status'](_0x353082);return _0x8ee331[_0x9c9d('0x24')](_0x9c9d('0x25'),_0x16376f+'-'+_0xd93d07+'/'+_0x4b270f)[_0x9c9d('0x1f')](_0x46b815);}return null;};}function patchUpdates(_0x426744){return function(_0x5889b7){try{jsonpatch[_0x9c9d('0x26')](_0x5889b7,_0x426744,!![]);}catch(_0x321107){return BPromise[_0x9c9d('0x27')](_0x321107);}return _0x5889b7[_0x9c9d('0x28')]();};}function saveUpdates(_0xcc1820,_0x34cd18){return function(_0xf822a){if(_0xf822a){return _0xf822a[_0x9c9d('0x29')](_0xcc1820)[_0x9c9d('0x2a')](function(_0x224a8c){return _0x224a8c;});}return null;};}function removeEntity(_0x5ea7a7,_0x5ecc79){return function(_0x380332){if(_0x380332){return _0x380332[_0x9c9d('0x2b')]()['then'](function(){_0x5ea7a7[_0x9c9d('0x1d')](0xcc)[_0x9c9d('0x1e')]();});}};}function handleEntityNotFound(_0x37b6a6,_0x22b1cc){return function(_0xfec396){if(!_0xfec396){_0x37b6a6['sendStatus'](0x194);}return _0xfec396;};}function handleError(_0x455741,_0x5d2174){_0x5d2174=_0x5d2174||0x1f4;return function(_0x4dff2f){logger[_0x9c9d('0x2c')](_0x4dff2f[_0x9c9d('0x2d')]);if(_0x4dff2f[_0x9c9d('0x2e')]){delete _0x4dff2f[_0x9c9d('0x2e')];}_0x455741[_0x9c9d('0x1d')](_0x5d2174)[_0x9c9d('0x2f')](_0x4dff2f);};}exports['index']=function(_0x29340e,_0x47128d){var _0x1b3f75={},_0x5a6f93={},_0x6b42f2={'count':0x0,'rows':[]};var _0x29d7a3=_['map'](db[_0x9c9d('0x30')][_0x9c9d('0x31')],function(_0xdc369e){return{'name':_0xdc369e[_0x9c9d('0x32')],'type':_0xdc369e['type'][_0x9c9d('0x33')]};});_0x5a6f93[_0x9c9d('0x34')]=_[_0x9c9d('0x35')](_0x29d7a3,_0x9c9d('0x2e'));_0x5a6f93[_0x9c9d('0x36')]=_['keys'](_0x29340e['query']);_0x5a6f93[_0x9c9d('0x37')]=_[_0x9c9d('0x38')](_0x5a6f93[_0x9c9d('0x34')],_0x5a6f93['query']);_0x1b3f75[_0x9c9d('0x39')]=_[_0x9c9d('0x38')](_0x5a6f93[_0x9c9d('0x34')],qs['fields'](_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x3a')]));_0x1b3f75[_0x9c9d('0x39')]=_0x1b3f75[_0x9c9d('0x39')][_0x9c9d('0x3b')]?_0x1b3f75[_0x9c9d('0x39')]:_0x5a6f93[_0x9c9d('0x34')];if(!_0x29340e['query'][_0x9c9d('0x3c')](_0x9c9d('0x3d'))){_0x1b3f75[_0x9c9d('0x22')]=qs[_0x9c9d('0x22')](_0x29340e[_0x9c9d('0x36')]['limit']);_0x1b3f75[_0x9c9d('0x20')]=qs[_0x9c9d('0x20')](_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x20')]);}_0x1b3f75[_0x9c9d('0x3e')]=qs['sort'](_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x3f')]);_0x1b3f75['where']=qs['filters'](_['pick'](_0x29340e['query'],_0x5a6f93[_0x9c9d('0x37')]),_0x29d7a3);if(_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x40')]){_0x1b3f75[_0x9c9d('0x41')]=_['merge'](_0x1b3f75[_0x9c9d('0x41')],{'$or':_[_0x9c9d('0x35')](_0x29d7a3,function(_0xd1039c){if(_0xd1039c[_0x9c9d('0x42')]!==_0x9c9d('0x43')){var _0x384a0e={};_0x384a0e[_0xd1039c[_0x9c9d('0x2e')]]={'$like':'%'+_0x29340e[_0x9c9d('0x36')]['filter']+'%'};return _0x384a0e;}})});}_0x1b3f75=_[_0x9c9d('0x44')]({},_0x1b3f75,_0x29340e[_0x9c9d('0x45')]);var _0x28b11d={'where':_0x1b3f75[_0x9c9d('0x41')]};return db[_0x9c9d('0x30')][_0x9c9d('0x23')](_0x28b11d)[_0x9c9d('0x2a')](function(_0x11dcd2){_0x6b42f2[_0x9c9d('0x23')]=_0x11dcd2;if(_0x29340e[_0x9c9d('0x36')][_0x9c9d('0x46')]){_0x1b3f75['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x9c9d('0x47')](_0x1b3f75);})[_0x9c9d('0x2a')](function(_0x5458e4){_0x6b42f2[_0x9c9d('0x48')]=_0x5458e4;return _0x6b42f2;})['then'](respondWithFilteredResult(_0x47128d,_0x1b3f75))['catch'](handleError(_0x47128d,null));};exports[_0x9c9d('0x49')]=function(_0x1a63c7,_0x523d3c){var _0x13308a={'raw':!![],'where':{'id':_0x1a63c7[_0x9c9d('0x4a')]['id']}},_0x68a678={};_0x68a678['model']=_['keys'](db[_0x9c9d('0x30')][_0x9c9d('0x31')]);_0x68a678[_0x9c9d('0x36')]=_['keys'](_0x1a63c7[_0x9c9d('0x36')]);_0x68a678['filters']=_['intersection'](_0x68a678[_0x9c9d('0x34')],_0x68a678['query']);_0x13308a[_0x9c9d('0x39')]=_[_0x9c9d('0x38')](_0x68a678[_0x9c9d('0x34')],qs[_0x9c9d('0x3a')](_0x1a63c7['query'][_0x9c9d('0x3a')]));_0x13308a[_0x9c9d('0x39')]=_0x13308a['attributes'][_0x9c9d('0x3b')]?_0x13308a['attributes']:_0x68a678['model'];if(_0x1a63c7['query'][_0x9c9d('0x46')]){_0x13308a[_0x9c9d('0x4b')]=[{'all':!![]}];}_0x13308a=_[_0x9c9d('0x44')]({},_0x13308a,_0x1a63c7[_0x9c9d('0x45')]);return db[_0x9c9d('0x30')][_0x9c9d('0x4c')](_0x13308a)['then'](handleEntityNotFound(_0x523d3c,null))[_0x9c9d('0x2a')](respondWithResult(_0x523d3c,null))[_0x9c9d('0x4d')](handleError(_0x523d3c,null));};exports[_0x9c9d('0x4e')]=function(_0x45389b,_0xd7aa87){return db[_0x9c9d('0x30')][_0x9c9d('0x4e')](_0x45389b['body'],{})[_0x9c9d('0x2a')](respondWithResult(_0xd7aa87,0xc9))[_0x9c9d('0x4d')](handleError(_0xd7aa87,null));};exports[_0x9c9d('0x29')]=function(_0x1c3de9,_0x5f11fc){if(_0x1c3de9[_0x9c9d('0x4f')]['id']){delete _0x1c3de9[_0x9c9d('0x4f')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x1c3de9[_0x9c9d('0x4a')]['id']}})[_0x9c9d('0x2a')](handleEntityNotFound(_0x5f11fc,null))[_0x9c9d('0x2a')](saveUpdates(_0x1c3de9[_0x9c9d('0x4f')],null))[_0x9c9d('0x2a')](respondWithResult(_0x5f11fc,null))['catch'](handleError(_0x5f11fc,null));};exports[_0x9c9d('0x2b')]=function(_0x272ac5,_0x4c4aa7){return db[_0x9c9d('0x30')][_0x9c9d('0x4c')]({'where':{'id':_0x272ac5['params']['id']}})['then'](handleEntityNotFound(_0x4c4aa7,null))['then'](removeEntity(_0x4c4aa7,null))[_0x9c9d('0x4d')](handleError(_0x4c4aa7,null));};exports[_0x9c9d('0x50')]=function(_0xce2478,_0x3ef9c3){return db[_0x9c9d('0x30')][_0x9c9d('0x50')]()['then'](respondWithResult(_0x3ef9c3,null))[_0x9c9d('0x4d')](handleError(_0x3ef9c3,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 2236af2..86ade97 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 _0xfd48=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x4a2c3a,_0x318fc8){var _0x267e6d=function(_0x3b4688){while(--_0x3b4688){_0x4a2c3a['push'](_0x4a2c3a['shift']());}};_0x267e6d(++_0x318fc8);}(_0xfd48,0x168));var _0x8fd4=function(_0xaf1782,_0x2a26fd){_0xaf1782=_0xaf1782-0x0;var _0x3a3ca8=_0xfd48[_0xaf1782];return _0x3a3ca8;};'use strict';var _=require('lodash');var util=require(_0x8fd4('0x0'));var logger=require(_0x8fd4('0x1'))(_0x8fd4('0x2'));var moment=require(_0x8fd4('0x3'));var BPromise=require(_0x8fd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fd4('0x5'));var rimraf=require('rimraf');var config=require(_0x8fd4('0x6'));var attributes=require(_0x8fd4('0x7'));module[_0x8fd4('0x8')]=function(_0x2c480c,_0x282b61){return _0x2c480c['define'](_0x8fd4('0x9'),attributes,{'tableName':_0x8fd4('0xa'),'paranoid':![],'indexes':[{'name':_0x8fd4('0xb'),'fields':[_0x8fd4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x807b=['lodash','util','../../config/logger','api','bluebird','path','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid'];(function(_0x35cb30,_0x12ac50){var _0x2742b9=function(_0x54e888){while(--_0x54e888){_0x35cb30['push'](_0x35cb30['shift']());}};_0x2742b9(++_0x12ac50);}(_0x807b,0x13f));var _0xb807=function(_0x4f0cad,_0x1d72d9){_0x4f0cad=_0x4f0cad-0x0;var _0x3081a0=_0x807b[_0x4f0cad];return _0x3081a0;};'use strict';var _=require(_0xb807('0x0'));var util=require(_0xb807('0x1'));var logger=require(_0xb807('0x2'))(_0xb807('0x3'));var moment=require('moment');var BPromise=require(_0xb807('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb807('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb807('0x6'));module[_0xb807('0x7')]=function(_0xa845ff,_0x309df0){return _0xa845ff[_0xb807('0x8')]('SmsTransferReport',attributes,{'tableName':_0xb807('0x9'),'paranoid':![],'indexes':[{'name':_0xb807('0xa'),'fields':[_0xb807('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index bec8535..f6043bb 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 _0xf8b2=['code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4444e4,_0x5f1462){var _0x43a887=function(_0x266fdb){while(--_0x266fdb){_0x4444e4['push'](_0x4444e4['shift']());}};_0x43a887(++_0x5f1462);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x40f3ed,_0x30a518){_0x40f3ed=_0x40f3ed-0x0;var _0x30fd3b=_0xf8b2[_0x40f3ed];return _0x30fd3b;};'use strict';var _=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var moment=require(_0x2f8b('0x2'));var BPromise=require(_0x2f8b('0x3'));var rs=require(_0x2f8b('0x4'));var fs=require('fs');var Redis=require(_0x2f8b('0x5'));var db=require(_0x2f8b('0x6'))['db'];var utils=require(_0x2f8b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f8b('0x8'));var jayson=require(_0x2f8b('0x9'));var client=jayson[_0x2f8b('0xa')][_0x2f8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b0511,_0x2cc1e9,_0x449c86){return new BPromise(function(_0x24bd39,_0x366bac){return client['request'](_0x3b0511,_0x449c86)[_0x2f8b('0xc')](function(_0xb352e8){logger[_0x2f8b('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2cc1e9,_0x2f8b('0xe'));logger[_0x2f8b('0xf')](_0x2f8b('0x10'),_0x2cc1e9,'request\x20sent',JSON['stringify'](_0xb352e8));if(_0xb352e8[_0x2f8b('0x11')]){if(_0xb352e8[_0x2f8b('0x11')][_0x2f8b('0x12')]===0x1f4){logger[_0x2f8b('0x11')](_0x2f8b('0x13'),_0x2cc1e9,_0xb352e8['error'][_0x2f8b('0x14')]);return _0x366bac(_0xb352e8['error'][_0x2f8b('0x14')]);}logger[_0x2f8b('0x11')](_0x2f8b('0x13'),_0x2cc1e9,_0xb352e8[_0x2f8b('0x11')][_0x2f8b('0x14')]);return _0x24bd39(_0xb352e8[_0x2f8b('0x11')][_0x2f8b('0x14')]);}else{logger[_0x2f8b('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2cc1e9,_0x2f8b('0xe'));_0x24bd39(_0xb352e8[_0x2f8b('0x15')][_0x2f8b('0x14')]);}})[_0x2f8b('0x16')](function(_0xa79a7){logger[_0x2f8b('0x11')](_0x2f8b('0x13'),_0x2cc1e9,_0xa79a7);_0x366bac(_0xa79a7);});});} \ No newline at end of file +var _0x72a2=['info','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5e64ac,_0x4e1cdb){var _0x2696fc=function(_0x329b2f){while(--_0x329b2f){_0x5e64ac['push'](_0x5e64ac['shift']());}};_0x2696fc(++_0x4e1cdb);}(_0x72a2,0x161));var _0x272a=function(_0x15a9c4,_0x1c7203){_0x15a9c4=_0x15a9c4-0x0;var _0x478803=_0x72a2[_0x15a9c4];return _0x478803;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var moment=require(_0x272a('0x1'));var BPromise=require(_0x272a('0x2'));var rs=require(_0x272a('0x3'));var fs=require('fs');var Redis=require(_0x272a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x272a('0x5'));var logger=require('../../config/logger')(_0x272a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x272a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43d188,_0x220b90,_0x283070){return new BPromise(function(_0x54dbfb,_0x484f88){return client[_0x272a('0x8')](_0x43d188,_0x283070)['then'](function(_0x830fb6){logger['info'](_0x272a('0x9'),_0x220b90,_0x272a('0xa'));logger[_0x272a('0xb')](_0x272a('0xc'),_0x220b90,'request\x20sent',JSON['stringify'](_0x830fb6));if(_0x830fb6[_0x272a('0xd')]){if(_0x830fb6[_0x272a('0xd')]['code']===0x1f4){logger[_0x272a('0xd')](_0x272a('0x9'),_0x220b90,_0x830fb6[_0x272a('0xd')][_0x272a('0xe')]);return _0x484f88(_0x830fb6[_0x272a('0xd')]['message']);}logger[_0x272a('0xd')](_0x272a('0x9'),_0x220b90,_0x830fb6[_0x272a('0xd')][_0x272a('0xe')]);return _0x54dbfb(_0x830fb6['error'][_0x272a('0xe')]);}else{logger[_0x272a('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x220b90,'request\x20sent');_0x54dbfb(_0x830fb6['result']['message']);}})['catch'](function(_0x567955){logger[_0x272a('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x220b90,_0x567955);_0x484f88(_0x567955);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 720896c..2d7548e 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 _0x16c5=['root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','single','file','/:id','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','show','/:id/download','download','diskStorage','join'];(function(_0x23a908,_0x55db8f){var _0x1f2961=function(_0x5c3549){while(--_0x5c3549){_0x23a908['push'](_0x23a908['shift']());}};_0x1f2961(++_0x55db8f);}(_0x16c5,0xec));var _0x516c=function(_0x9b9f97,_0x56e997){_0x9b9f97=_0x9b9f97-0x0;var _0x4a7d8c=_0x16c5[_0x9b9f97];return _0x4a7d8c;};'use strict';var multer=require(_0x516c('0x0'));var util=require('util');var path=require(_0x516c('0x1'));var timeout=require(_0x516c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x516c('0x3'));var auth=require(_0x516c('0x4'));var interaction=require(_0x516c('0x5'));var config=require(_0x516c('0x6'));var controller=require(_0x516c('0x7'));router['get']('/',auth[_0x516c('0x8')](),controller[_0x516c('0x9')]);router[_0x516c('0xa')]('/:id',auth[_0x516c('0x8')](),controller[_0x516c('0xb')]);router[_0x516c('0xa')](_0x516c('0xc'),auth[_0x516c('0x8')](),controller[_0x516c('0xd')]);var upload=multer({'storage':multer[_0x516c('0xe')]({'destination':function(_0x2523bf,_0x5436ee,_0x21a947){_0x21a947(null,path[_0x516c('0xf')](config[_0x516c('0x10')],_0x516c('0x11')));},'filename':function(_0x4df3b9,_0x7b8beb,_0x1e5f09){_0x7b8beb[_0x516c('0x12')]=_0x7b8beb[_0x516c('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1e5f09(null,util[_0x516c('0x13')](_0x516c('0x14'),path[_0x516c('0x15')](_0x7b8beb[_0x516c('0x12')],path['extname'](_0x7b8beb[_0x516c('0x12')])),Date['now'](),path[_0x516c('0x16')](_0x7b8beb[_0x516c('0x12')])));}})});router['post']('/',upload[_0x516c('0x17')](_0x516c('0x18')),controller['create']);router['put'](_0x516c('0x19'),auth[_0x516c('0x8')](),controller[_0x516c('0x1a')]);router[_0x516c('0x1b')](_0x516c('0x19'),auth[_0x516c('0x8')](),controller[_0x516c('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x4c8a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','post','single','file','create','put','update','delete','exports','multer','util'];(function(_0x512d62,_0xdff5e4){var _0x16011c=function(_0x483aa5){while(--_0x483aa5){_0x512d62['push'](_0x512d62['shift']());}};_0x16011c(++_0xdff5e4);}(_0x4c8a,0xf6));var _0xa4c8=function(_0x12fb0e,_0x6080ee){_0x12fb0e=_0x12fb0e-0x0;var _0x2f81a5=_0x4c8a[_0x12fb0e];return _0x2f81a5;};'use strict';var multer=require(_0xa4c8('0x0'));var util=require(_0xa4c8('0x1'));var path=require('path');var timeout=require(_0xa4c8('0x2'));var express=require('express');var router=express[_0xa4c8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa4c8('0x4'));var interaction=require(_0xa4c8('0x5'));var config=require(_0xa4c8('0x6'));var controller=require(_0xa4c8('0x7'));router[_0xa4c8('0x8')]('/',auth[_0xa4c8('0x9')](),controller[_0xa4c8('0xa')]);router['get'](_0xa4c8('0xb'),auth[_0xa4c8('0x9')](),controller[_0xa4c8('0xc')]);router['get'](_0xa4c8('0xd'),auth[_0xa4c8('0x9')](),controller[_0xa4c8('0xe')]);var upload=multer({'storage':multer[_0xa4c8('0xf')]({'destination':function(_0x217a64,_0x29485c,_0x2ada32){_0x2ada32(null,path[_0xa4c8('0x10')](config[_0xa4c8('0x11')],_0xa4c8('0x12')));},'filename':function(_0x220198,_0x174d23,_0x3281ee){_0x174d23[_0xa4c8('0x13')]=_0x174d23[_0xa4c8('0x13')][_0xa4c8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3281ee(null,util[_0xa4c8('0x15')](_0xa4c8('0x16'),path['basename'](_0x174d23['originalname'],path['extname'](_0x174d23[_0xa4c8('0x13')])),Date['now'](),path['extname'](_0x174d23[_0xa4c8('0x13')])));}})});router[_0xa4c8('0x17')]('/',upload[_0xa4c8('0x18')](_0xa4c8('0x19')),controller[_0xa4c8('0x1a')]);router[_0xa4c8('0x1b')](_0xa4c8('0xb'),auth['isAuthenticated'](),controller[_0xa4c8('0x1c')]);router[_0xa4c8('0x1d')](_0xa4c8('0xb'),auth[_0xa4c8('0x9')](),controller[_0xa4c8('0x1d')]);module[_0xa4c8('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index ab83566..c53b6c8 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 _0xbc49=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x38efe1,_0x34a883){var _0x44c9fb=function(_0x3cbfea){while(--_0x3cbfea){_0x38efe1['push'](_0x38efe1['shift']());}};_0x44c9fb(++_0x34a883);}(_0xbc49,0x186));var _0x9bc4=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0xbc49[_0x565fed];return _0x3e018f;};'use strict';var Sequelize=require(_0x9bc4('0x0'));module[_0x9bc4('0x1')]={'name':{'type':Sequelize[_0x9bc4('0x2')],'unique':_0x9bc4('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x9bc4('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x9bc4('0x4')]},'original_sampleCount':{'type':Sequelize[_0x9bc4('0x5')]},'original_channelCount':{'type':Sequelize[_0x9bc4('0x6')]},'original_bitRate':{'type':Sequelize[_0x9bc4('0x5')]},'original_sampleRate':{'type':Sequelize[_0x9bc4('0x6')]},'converted_format':{'type':Sequelize[_0x9bc4('0x2')]},'converted_duration':{'type':Sequelize[_0x9bc4('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x9bc4('0x5')]},'converted_channelCount':{'type':Sequelize[_0x9bc4('0x6')]},'converted_bitRate':{'type':Sequelize[_0x9bc4('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x9bc4('0x6')]}}; \ No newline at end of file +var _0xbd50=['STRING','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0x1a1ae8,_0x5e3a80){var _0x238356=function(_0x48b455){while(--_0x48b455){_0x1a1ae8['push'](_0x1a1ae8['shift']());}};_0x238356(++_0x5e3a80);}(_0xbd50,0x196));var _0x0bd5=function(_0x8e32e3,_0x44e6fc){_0x8e32e3=_0x8e32e3-0x0;var _0x3360b4=_0xbd50[_0x8e32e3];return _0x3360b4;};'use strict';var Sequelize=require(_0x0bd5('0x0'));module[_0x0bd5('0x1')]={'name':{'type':Sequelize[_0x0bd5('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x0bd5('0x2')]},'display_name':{'type':Sequelize[_0x0bd5('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x0bd5('0x2')]},'original_format':{'type':Sequelize[_0x0bd5('0x2')]},'original_duration':{'type':Sequelize[_0x0bd5('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x0bd5('0x4')]},'converted_format':{'type':Sequelize[_0x0bd5('0x2')]},'converted_duration':{'type':Sequelize[_0x0bd5('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x0bd5('0x5')]},'converted_channelCount':{'type':Sequelize[_0x0bd5('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 9459da2..41c14dc 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 _0x69de=['attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','VIRTUAL','merge','options','where','includeAll','findAll','rows','params','rawAttributes','length','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','basename','originalname','file','filename','extname','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','type','key','model','query','keys'];(function(_0x1dcd9d,_0x3a10aa){var _0x46d822=function(_0x4f19cb){while(--_0x4f19cb){_0x1dcd9d['push'](_0x1dcd9d['shift']());}};_0x46d822(++_0x3a10aa);}(_0x69de,0xca));var _0xe69d=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x69de[_0x16de68];return _0x1c277e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe69d('0x0'));var zipdir=require(_0xe69d('0x1'));var jsonpatch=require(_0xe69d('0x2'));var rp=require(_0xe69d('0x3'));var moment=require(_0xe69d('0x4'));var BPromise=require(_0xe69d('0x5'));var Mustache=require(_0xe69d('0x6'));var util=require(_0xe69d('0x7'));var path=require(_0xe69d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe69d('0x9'));var fs=require('fs');var fs_extra=require(_0xe69d('0xa'));var _=require(_0xe69d('0xb'));var squel=require('squel');var crypto=require(_0xe69d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe69d('0xd'));var toCsv=require(_0xe69d('0xe'));var querystring=require(_0xe69d('0xf'));var Papa=require('papaparse');var Redis=require(_0xe69d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe69d('0x11'));var hardwareService=require(_0xe69d('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe69d('0x13'));var licenseUtil=require(_0xe69d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da99c,_0x3c8108){_0x3c8108=_0x3c8108||0xcc;return function(_0x67bf88){if(_0x67bf88){return _0x1da99c[_0xe69d('0x15')](_0x3c8108);}return _0x1da99c['status'](_0x3c8108)[_0xe69d('0x16')]();};}function respondWithResult(_0x4fa763,_0x3419e4){_0x3419e4=_0x3419e4||0xc8;return function(_0xcad41a){if(_0xcad41a){return _0x4fa763[_0xe69d('0x17')](_0x3419e4)[_0xe69d('0x18')](_0xcad41a);}};}function respondWithFilteredResult(_0x5aa6bd,_0x77c74){return function(_0x5bb491){if(_0x5bb491){var _0x3cf12a=typeof _0x77c74[_0xe69d('0x19')]===_0xe69d('0x1a')&&typeof _0x77c74['limit']==='undefined';var _0x3b41d4=_0x5bb491[_0xe69d('0x1b')];var _0x271c5f=_0x3cf12a?0x0:_0x77c74[_0xe69d('0x19')];var _0x13f17d=_0x3cf12a?_0x5bb491['count']:_0x77c74[_0xe69d('0x19')]+_0x77c74[_0xe69d('0x1c')];var _0x3308b1;if(_0x13f17d>=_0x3b41d4){_0x13f17d=_0x3b41d4;_0x3308b1=0xc8;}else{_0x3308b1=0xce;}_0x5aa6bd['status'](_0x3308b1);return _0x5aa6bd[_0xe69d('0x1d')](_0xe69d('0x1e'),_0x271c5f+'-'+_0x13f17d+'/'+_0x3b41d4)['json'](_0x5bb491);}return null;};}function patchUpdates(_0x24b528){return function(_0x1f186c){try{jsonpatch[_0xe69d('0x1f')](_0x1f186c,_0x24b528,!![]);}catch(_0x285f5a){return BPromise[_0xe69d('0x20')](_0x285f5a);}return _0x1f186c[_0xe69d('0x21')]();};}function saveUpdates(_0x41c717,_0x2f2be7){return function(_0x57f549){if(_0x57f549){return _0x57f549['update'](_0x41c717)[_0xe69d('0x22')](function(_0x2c1a0f){return _0x2c1a0f;});}return null;};}function removeEntity(_0x3540ea,_0x12e993){return function(_0x280090){if(_0x280090){return _0x280090[_0xe69d('0x23')]()[_0xe69d('0x22')](function(){var _0x2b5866=_0x280090['get']({'plain':!![]});var _0x5258ca=_0xe69d('0x24');return db[_0xe69d('0x25')][_0xe69d('0x23')]({'where':{'type':_0x5258ca,'resourceId':_0x2b5866['id']}})['then'](function(){return _0x280090;});})[_0xe69d('0x22')](function(){_0x3540ea[_0xe69d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x494d3c,_0x34feb6){return function(_0x2f4c8d){if(!_0x2f4c8d){_0x494d3c['sendStatus'](0x194);}return _0x2f4c8d;};}function handleError(_0x3af299,_0x5dc9e2){_0x5dc9e2=_0x5dc9e2||0x1f4;return function(_0xfd1c1c){logger[_0xe69d('0x26')](_0xfd1c1c[_0xe69d('0x27')]);if(_0xfd1c1c[_0xe69d('0x28')]){delete _0xfd1c1c[_0xe69d('0x28')];}_0x3af299['status'](_0x5dc9e2)[_0xe69d('0x29')](_0xfd1c1c);};}exports[_0xe69d('0x2a')]=function(_0x3e435b,_0x5b59da){var _0x35ed33={},_0x2c434f={},_0x220aa5={'count':0x0,'rows':[]};var _0x40e154=_[_0xe69d('0x2b')](db[_0xe69d('0x2c')]['rawAttributes'],function(_0x5891e3){return{'name':_0x5891e3['fieldName'],'type':_0x5891e3[_0xe69d('0x2d')][_0xe69d('0x2e')]};});_0x2c434f[_0xe69d('0x2f')]=_[_0xe69d('0x2b')](_0x40e154,_0xe69d('0x28'));_0x2c434f[_0xe69d('0x30')]=_[_0xe69d('0x31')](_0x3e435b['query']);_0x2c434f['filters']=_['intersection'](_0x2c434f[_0xe69d('0x2f')],_0x2c434f[_0xe69d('0x30')]);_0x35ed33[_0xe69d('0x32')]=_[_0xe69d('0x33')](_0x2c434f[_0xe69d('0x2f')],qs[_0xe69d('0x34')](_0x3e435b[_0xe69d('0x30')]['fields']));_0x35ed33['attributes']=_0x35ed33[_0xe69d('0x32')]['length']?_0x35ed33[_0xe69d('0x32')]:_0x2c434f[_0xe69d('0x2f')];if(!_0x3e435b[_0xe69d('0x30')][_0xe69d('0x35')](_0xe69d('0x36'))){_0x35ed33[_0xe69d('0x1c')]=qs[_0xe69d('0x1c')](_0x3e435b[_0xe69d('0x30')]['limit']);_0x35ed33[_0xe69d('0x19')]=qs['offset'](_0x3e435b['query'][_0xe69d('0x19')]);}_0x35ed33[_0xe69d('0x37')]=qs[_0xe69d('0x38')](_0x3e435b[_0xe69d('0x30')]['sort']);_0x35ed33['where']=qs['filters'](_['pick'](_0x3e435b[_0xe69d('0x30')],_0x2c434f[_0xe69d('0x39')]),_0x40e154);if(_0x3e435b[_0xe69d('0x30')][_0xe69d('0x3a')]){_0x35ed33['where']=_['merge'](_0x35ed33['where'],{'$or':_[_0xe69d('0x2b')](_0x40e154,function(_0x4ebbce){if(_0x4ebbce[_0xe69d('0x2d')]!==_0xe69d('0x3b')){var _0x4803a0={};_0x4803a0[_0x4ebbce['name']]={'$like':'%'+_0x3e435b[_0xe69d('0x30')][_0xe69d('0x3a')]+'%'};return _0x4803a0;}})});}_0x35ed33=_[_0xe69d('0x3c')]({},_0x35ed33,_0x3e435b[_0xe69d('0x3d')]);var _0x27c706={'where':_0x35ed33[_0xe69d('0x3e')]};return db[_0xe69d('0x2c')][_0xe69d('0x1b')](_0x27c706)[_0xe69d('0x22')](function(_0x3168f4){_0x220aa5['count']=_0x3168f4;if(_0x3e435b[_0xe69d('0x30')][_0xe69d('0x3f')]){_0x35ed33['include']=[{'all':!![]}];}return db[_0xe69d('0x2c')][_0xe69d('0x40')](_0x35ed33);})['then'](function(_0x418256){_0x220aa5[_0xe69d('0x41')]=_0x418256;return _0x220aa5;})[_0xe69d('0x22')](respondWithFilteredResult(_0x5b59da,_0x35ed33))['catch'](handleError(_0x5b59da,null));};exports['show']=function(_0x2ee1f3,_0x3de3a6){var _0x53d954={'raw':!![],'where':{'id':_0x2ee1f3[_0xe69d('0x42')]['id']}},_0x3e0207={};_0x3e0207[_0xe69d('0x2f')]=_[_0xe69d('0x31')](db[_0xe69d('0x2c')][_0xe69d('0x43')]);_0x3e0207['query']=_[_0xe69d('0x31')](_0x2ee1f3['query']);_0x3e0207[_0xe69d('0x39')]=_[_0xe69d('0x33')](_0x3e0207[_0xe69d('0x2f')],_0x3e0207['query']);_0x53d954[_0xe69d('0x32')]=_['intersection'](_0x3e0207['model'],qs[_0xe69d('0x34')](_0x2ee1f3[_0xe69d('0x30')][_0xe69d('0x34')]));_0x53d954[_0xe69d('0x32')]=_0x53d954[_0xe69d('0x32')][_0xe69d('0x44')]?_0x53d954[_0xe69d('0x32')]:_0x3e0207[_0xe69d('0x2f')];if(_0x2ee1f3[_0xe69d('0x30')][_0xe69d('0x3f')]){_0x53d954['include']=[{'all':!![]}];}_0x53d954=_[_0xe69d('0x3c')]({},_0x53d954,_0x2ee1f3['options']);return db[_0xe69d('0x2c')][_0xe69d('0x45')](_0x53d954)[_0xe69d('0x22')](handleEntityNotFound(_0x3de3a6,null))[_0xe69d('0x22')](respondWithResult(_0x3de3a6,null))['catch'](handleError(_0x3de3a6,null));};exports[_0xe69d('0x46')]=function(_0x497521,_0x6a6590,_0x1b0b95){return db[_0xe69d('0x2c')][_0xe69d('0x45')]({'where':{'id':_0x497521['params']['id']},'attributes':[_0xe69d('0x28'),_0xe69d('0x47'),'converted_format'],'raw':!![]})[_0xe69d('0x22')](handleEntityNotFound(_0x6a6590,null))[_0xe69d('0x22')](function(_0x15c068){if(_0x15c068){if(!fs[_0xe69d('0x48')](path[_0xe69d('0x49')](config[_0xe69d('0x4a')],_0xe69d('0x4b'),_0x15c068[_0xe69d('0x47')]+'.'+_0x15c068[_0xe69d('0x4c')]))){throw new db[(_0xe69d('0x4d'))][(_0xe69d('0x4e'))](_0xe69d('0x4f'));}return _0x6a6590[_0xe69d('0x46')](path[_0xe69d('0x49')](config['root'],'server/files/sounds/converted',util['format'](_0xe69d('0x50'),_0x15c068[_0xe69d('0x47')],_0x15c068['converted_format'])),util[_0xe69d('0x51')](_0xe69d('0x50'),_0x15c068[_0xe69d('0x28')],_0x15c068[_0xe69d('0x4c')]));}return null;})[_0xe69d('0x52')](handleError(_0x6a6590,null));};exports[_0xe69d('0x53')]=function(_0x229422,_0x5a8551,_0x278c89){var _0x37e4b0={'name':path[_0xe69d('0x54')](_0x229422['file'][_0xe69d('0x55')],path['extname'](_0x229422[_0xe69d('0x56')][_0xe69d('0x55')])),'save_name':path[_0xe69d('0x54')](_0x229422[_0xe69d('0x56')][_0xe69d('0x57')],path[_0xe69d('0x58')](_0x229422[_0xe69d('0x56')][_0xe69d('0x57')])),'original_format':path[_0xe69d('0x58')](_0x229422[_0xe69d('0x56')][_0xe69d('0x55')])['substring'](0x1),'converted_format':'wav'};var _0x831362=path['join'](config['root'],_0xe69d('0x59'),_0x229422[_0xe69d('0x56')][_0xe69d('0x57')]);var _0x58bfe6=path[_0xe69d('0x49')](config[_0xe69d('0x4a')],'server/files/sounds/converted',util[_0xe69d('0x51')]('%s.%s',path[_0xe69d('0x54')](_0x229422[_0xe69d('0x56')][_0xe69d('0x57')],path['extname'](_0x229422[_0xe69d('0x56')][_0xe69d('0x57')])),_0x37e4b0[_0xe69d('0x4c')]));logger['info'](_0xe69d('0x5a'),_0x831362);logger['info'](_0xe69d('0x5b'),_0x58bfe6);try{fs[_0xe69d('0x5c')](_0x831362,parseInt(_0xe69d('0x5d'),0x8));var _0x31fcd3=sox[_0xe69d('0x5e')](_0x831362,_0x58bfe6,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x31fcd3['on']('error',function(_0x2d0b42){fs[_0xe69d('0x5f')](_0x831362);_0x5a8551['status'](0x1f4)[_0xe69d('0x29')](_0x2d0b42);});_0x31fcd3['on'](_0xe69d('0x60'),function(_0x55726c){_0x37e4b0[_0xe69d('0x61')]=isNaN(_0x55726c[_0xe69d('0x62')])?null:_0x55726c['duration']*0x3e8;_0x37e4b0[_0xe69d('0x63')]=isNaN(_0x55726c[_0xe69d('0x64')])?null:_0x55726c[_0xe69d('0x64')];_0x37e4b0[_0xe69d('0x65')]=isNaN(_0x55726c[_0xe69d('0x66')])?null:_0x55726c['channelCount'];_0x37e4b0[_0xe69d('0x67')]=isNaN(_0x55726c[_0xe69d('0x68')])?null:_0x55726c[_0xe69d('0x68')];_0x37e4b0[_0xe69d('0x69')]=isNaN(_0x55726c[_0xe69d('0x6a')])?null:_0x55726c['sampleRate'];});_0x31fcd3['on'](_0xe69d('0x6b'),function(_0x149fac){_0x37e4b0[_0xe69d('0x6c')]=isNaN(_0x149fac['duration'])?null:_0x149fac[_0xe69d('0x62')]*0x3e8;_0x37e4b0[_0xe69d('0x6d')]=isNaN(_0x149fac['sampleCount'])?null:_0x149fac[_0xe69d('0x64')];_0x37e4b0[_0xe69d('0x6e')]=isNaN(_0x149fac[_0xe69d('0x66')])?null:_0x149fac[_0xe69d('0x66')];_0x37e4b0[_0xe69d('0x6f')]=isNaN(_0x149fac[_0xe69d('0x68')])?null:_0x149fac[_0xe69d('0x68')];_0x37e4b0[_0xe69d('0x70')]=isNaN(_0x149fac[_0xe69d('0x6a')])?null:_0x149fac[_0xe69d('0x6a')];});_0x31fcd3['on'](_0xe69d('0x16'),function(){fs[_0xe69d('0x5c')](_0x58bfe6,parseInt(_0xe69d('0x5d'),0x8));return db[_0xe69d('0x2c')]['create'](_0x37e4b0)[_0xe69d('0x22')](function(_0x53fc5c){var _0x13b354={'role':_0x229422[_0xe69d('0x71')][_0xe69d('0x72')],'userProfileId':_0x229422[_0xe69d('0x71')]['userProfileId']};if(!_0x13b354)throw new Error(_0xe69d('0x73'));if(_0x13b354[_0xe69d('0x72')]===_0xe69d('0x74')){var _0x46e0a7=_0x53fc5c[_0xe69d('0x75')]({'plain':!![]});return db[_0xe69d('0x76')][_0xe69d('0x45')]({'where':{'name':_0xe69d('0x24'),'userProfileId':_0x13b354[_0xe69d('0x77')]},'raw':!![]})['then'](function(_0x37562c){if(_0x37562c&&_0x37562c[_0xe69d('0x78')]===0x0){return db['UserProfileResource'][_0xe69d('0x53')]({'name':_0x46e0a7[_0xe69d('0x28')],'resourceId':_0x46e0a7['id'],'type':_0x37562c[_0xe69d('0x28')],'sectionId':_0x37562c['id']},{})[_0xe69d('0x22')](function(){return _0x53fc5c;});}else{return _0x53fc5c;}})[_0xe69d('0x52')](function(_0x57ef34){logger[_0xe69d('0x26')](_0xe69d('0x79'),_0x57ef34);throw _0x57ef34;});}return _0x53fc5c;})[_0xe69d('0x22')](respondWithResult(_0x5a8551,null))['catch'](handleError(_0x5a8551,null));});_0x31fcd3['start']();}catch(_0x516ed2){_0x5a8551['status'](0x1f4)[_0xe69d('0x29')](_0x516ed2);}};exports['update']=function(_0x50c557,_0x1ab914,_0x3f2340){return db[_0xe69d('0x2c')][_0xe69d('0x45')]({'where':{'id':_0x50c557[_0xe69d('0x42')]['id']}})[_0xe69d('0x22')](handleEntityNotFound(_0x1ab914,null))[_0xe69d('0x22')](saveUpdates(_[_0xe69d('0x7a')](_0x50c557[_0xe69d('0x71')],[_0xe69d('0x28'),_0xe69d('0x7b')]),null))[_0xe69d('0x22')](respondWithResult(_0x1ab914,null))[_0xe69d('0x52')](handleError(_0x1ab914,null));};exports[_0xe69d('0x7c')]=function(_0x471459,_0x3a5c5f,_0x32b911){return db[_0xe69d('0x2c')][_0xe69d('0x45')]({'where':{'id':_0x471459[_0xe69d('0x42')]['id']}})['then'](function(_0x34fd5f){if(_0x34fd5f){return _0x34fd5f[_0xe69d('0x23')]();}})[_0xe69d('0x22')](function(_0x1737d3){var _0x33733d=path[_0xe69d('0x49')](config[_0xe69d('0x4a')],_0xe69d('0x59'),util[_0xe69d('0x51')](_0xe69d('0x50'),_0x1737d3[_0xe69d('0x47')],_0x1737d3[_0xe69d('0x7d')]));var _0x47e310=path[_0xe69d('0x49')](config[_0xe69d('0x4a')],_0xe69d('0x4b'),util[_0xe69d('0x51')](_0xe69d('0x50'),_0x1737d3[_0xe69d('0x47')],_0x1737d3[_0xe69d('0x4c')]));fs[_0xe69d('0x5f')](_0x33733d);fs['unlinkSync'](_0x47e310);return _0x1737d3;})['then'](function(_0x1e7d02){if(_0x1e7d02){return _0x3a5c5f[_0xe69d('0x17')](0xcc)[_0xe69d('0x16')]();}})[_0xe69d('0x22')](handleEntityNotFound(_0x3a5c5f,null))[_0xe69d('0x52')](handleError(_0x3a5c5f,null));}; \ No newline at end of file +var _0xfca3=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','map','Sound','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','download','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','join','format','%s.%s','basename','file','extname','originalname','filename','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','create','body','role','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','start','delete','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2e0661,_0x22ad87){var _0x2185d5=function(_0x58f56f){while(--_0x58f56f){_0x2e0661['push'](_0x2e0661['shift']());}};_0x2185d5(++_0x22ad87);}(_0xfca3,0x1d9));var _0x3fca=function(_0x24d7f4,_0x45020){_0x24d7f4=_0x24d7f4-0x0;var _0x162719=_0xfca3[_0x24d7f4];return _0x162719;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fca('0x0'));var zipdir=require(_0x3fca('0x1'));var jsonpatch=require(_0x3fca('0x2'));var rp=require(_0x3fca('0x3'));var moment=require(_0x3fca('0x4'));var BPromise=require(_0x3fca('0x5'));var Mustache=require(_0x3fca('0x6'));var util=require(_0x3fca('0x7'));var path=require(_0x3fca('0x8'));var sox=require('sox');var csv=require(_0x3fca('0x9'));var ejs=require(_0x3fca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fca('0xb'));var squel=require(_0x3fca('0xc'));var crypto=require(_0x3fca('0xd'));var jsforce=require(_0x3fca('0xe'));var deskjs=require(_0x3fca('0xf'));var toCsv=require(_0x3fca('0x9'));var querystring=require(_0x3fca('0x10'));var Papa=require(_0x3fca('0x11'));var Redis=require(_0x3fca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3fca('0x13'));var as=require(_0x3fca('0x14'));var hardwareService=require(_0x3fca('0x15'));var logger=require(_0x3fca('0x16'))(_0x3fca('0x17'));var utils=require(_0x3fca('0x18'));var config=require(_0x3fca('0x19'));var licenseUtil=require(_0x3fca('0x1a'));var db=require(_0x3fca('0x1b'))['db'];function respondWithStatusCode(_0x3f462b,_0x1a4ba7){_0x1a4ba7=_0x1a4ba7||0xcc;return function(_0x54572e){if(_0x54572e){return _0x3f462b[_0x3fca('0x1c')](_0x1a4ba7);}return _0x3f462b['status'](_0x1a4ba7)[_0x3fca('0x1d')]();};}function respondWithResult(_0x466ad5,_0x4c98dd){_0x4c98dd=_0x4c98dd||0xc8;return function(_0x11c8f9){if(_0x11c8f9){return _0x466ad5[_0x3fca('0x1e')](_0x4c98dd)[_0x3fca('0x1f')](_0x11c8f9);}};}function respondWithFilteredResult(_0x5a5ea7,_0x18a76d){return function(_0x33537c){if(_0x33537c){var _0x4c566b=typeof _0x18a76d['offset']===_0x3fca('0x20')&&typeof _0x18a76d[_0x3fca('0x21')]===_0x3fca('0x20');var _0x5954d5=_0x33537c[_0x3fca('0x22')];var _0x32b144=_0x4c566b?0x0:_0x18a76d[_0x3fca('0x23')];var _0x2a2422=_0x4c566b?_0x33537c[_0x3fca('0x22')]:_0x18a76d[_0x3fca('0x23')]+_0x18a76d['limit'];var _0x53e84f;if(_0x2a2422>=_0x5954d5){_0x2a2422=_0x5954d5;_0x53e84f=0xc8;}else{_0x53e84f=0xce;}_0x5a5ea7[_0x3fca('0x1e')](_0x53e84f);return _0x5a5ea7[_0x3fca('0x24')](_0x3fca('0x25'),_0x32b144+'-'+_0x2a2422+'/'+_0x5954d5)[_0x3fca('0x1f')](_0x33537c);}return null;};}function patchUpdates(_0x523620){return function(_0x313399){try{jsonpatch[_0x3fca('0x26')](_0x313399,_0x523620,!![]);}catch(_0x2e9b7a){return BPromise[_0x3fca('0x27')](_0x2e9b7a);}return _0x313399[_0x3fca('0x28')]();};}function saveUpdates(_0xb14152,_0xe277b1){return function(_0x30c50f){if(_0x30c50f){return _0x30c50f[_0x3fca('0x29')](_0xb14152)['then'](function(_0x7751cb){return _0x7751cb;});}return null;};}function removeEntity(_0x5e96b6,_0x21c433){return function(_0x2aa7fc){if(_0x2aa7fc){return _0x2aa7fc[_0x3fca('0x2a')]()[_0x3fca('0x2b')](function(){var _0x2d106d=_0x2aa7fc[_0x3fca('0x2c')]({'plain':!![]});var _0x516d1c='Sounds';return db['UserProfileResource'][_0x3fca('0x2a')]({'where':{'type':_0x516d1c,'resourceId':_0x2d106d['id']}})['then'](function(){return _0x2aa7fc;});})[_0x3fca('0x2b')](function(){_0x5e96b6[_0x3fca('0x1e')](0xcc)[_0x3fca('0x1d')]();});}};}function handleEntityNotFound(_0x494fa4,_0x5e3106){return function(_0x59ea47){if(!_0x59ea47){_0x494fa4[_0x3fca('0x1c')](0x194);}return _0x59ea47;};}function handleError(_0xb4c9cd,_0x5bdf3a){_0x5bdf3a=_0x5bdf3a||0x1f4;return function(_0x40c3a1){logger[_0x3fca('0x2d')](_0x40c3a1[_0x3fca('0x2e')]);if(_0x40c3a1[_0x3fca('0x2f')]){delete _0x40c3a1['name'];}_0xb4c9cd[_0x3fca('0x1e')](_0x5bdf3a)[_0x3fca('0x30')](_0x40c3a1);};}exports[_0x3fca('0x31')]=function(_0x1532c6,_0x5d1ce8){var _0x20220a={},_0x480d10={},_0x5e1878={'count':0x0,'rows':[]};var _0x4e3a02=_[_0x3fca('0x32')](db[_0x3fca('0x33')]['rawAttributes'],function(_0x2790c4){return{'name':_0x2790c4[_0x3fca('0x34')],'type':_0x2790c4[_0x3fca('0x35')][_0x3fca('0x36')]};});_0x480d10['model']=_[_0x3fca('0x32')](_0x4e3a02,_0x3fca('0x2f'));_0x480d10[_0x3fca('0x37')]=_[_0x3fca('0x38')](_0x1532c6[_0x3fca('0x37')]);_0x480d10[_0x3fca('0x39')]=_['intersection'](_0x480d10[_0x3fca('0x3a')],_0x480d10[_0x3fca('0x37')]);_0x20220a[_0x3fca('0x3b')]=_['intersection'](_0x480d10['model'],qs[_0x3fca('0x3c')](_0x1532c6['query'][_0x3fca('0x3c')]));_0x20220a[_0x3fca('0x3b')]=_0x20220a[_0x3fca('0x3b')]['length']?_0x20220a[_0x3fca('0x3b')]:_0x480d10['model'];if(!_0x1532c6[_0x3fca('0x37')][_0x3fca('0x3d')](_0x3fca('0x3e'))){_0x20220a[_0x3fca('0x21')]=qs[_0x3fca('0x21')](_0x1532c6[_0x3fca('0x37')]['limit']);_0x20220a[_0x3fca('0x23')]=qs[_0x3fca('0x23')](_0x1532c6['query'][_0x3fca('0x23')]);}_0x20220a[_0x3fca('0x3f')]=qs[_0x3fca('0x40')](_0x1532c6[_0x3fca('0x37')][_0x3fca('0x40')]);_0x20220a[_0x3fca('0x41')]=qs[_0x3fca('0x39')](_['pick'](_0x1532c6[_0x3fca('0x37')],_0x480d10[_0x3fca('0x39')]),_0x4e3a02);if(_0x1532c6[_0x3fca('0x37')][_0x3fca('0x42')]){_0x20220a['where']=_[_0x3fca('0x43')](_0x20220a[_0x3fca('0x41')],{'$or':_[_0x3fca('0x32')](_0x4e3a02,function(_0x227a39){if(_0x227a39[_0x3fca('0x35')]!==_0x3fca('0x44')){var _0x548d53={};_0x548d53[_0x227a39[_0x3fca('0x2f')]]={'$like':'%'+_0x1532c6[_0x3fca('0x37')][_0x3fca('0x42')]+'%'};return _0x548d53;}})});}_0x20220a=_[_0x3fca('0x43')]({},_0x20220a,_0x1532c6['options']);var _0x24208c={'where':_0x20220a['where']};return db[_0x3fca('0x33')][_0x3fca('0x22')](_0x24208c)[_0x3fca('0x2b')](function(_0x432d7){_0x5e1878[_0x3fca('0x22')]=_0x432d7;if(_0x1532c6[_0x3fca('0x37')][_0x3fca('0x45')]){_0x20220a[_0x3fca('0x46')]=[{'all':!![]}];}return db['Sound'][_0x3fca('0x47')](_0x20220a);})[_0x3fca('0x2b')](function(_0x1949cf){_0x5e1878[_0x3fca('0x48')]=_0x1949cf;return _0x5e1878;})['then'](respondWithFilteredResult(_0x5d1ce8,_0x20220a))[_0x3fca('0x49')](handleError(_0x5d1ce8,null));};exports[_0x3fca('0x4a')]=function(_0x3707ba,_0x8704fb){var _0x1a87b8={'raw':!![],'where':{'id':_0x3707ba[_0x3fca('0x4b')]['id']}},_0x3ad975={};_0x3ad975[_0x3fca('0x3a')]=_[_0x3fca('0x38')](db[_0x3fca('0x33')][_0x3fca('0x4c')]);_0x3ad975[_0x3fca('0x37')]=_[_0x3fca('0x38')](_0x3707ba[_0x3fca('0x37')]);_0x3ad975[_0x3fca('0x39')]=_[_0x3fca('0x4d')](_0x3ad975[_0x3fca('0x3a')],_0x3ad975[_0x3fca('0x37')]);_0x1a87b8[_0x3fca('0x3b')]=_[_0x3fca('0x4d')](_0x3ad975['model'],qs[_0x3fca('0x3c')](_0x3707ba[_0x3fca('0x37')][_0x3fca('0x3c')]));_0x1a87b8[_0x3fca('0x3b')]=_0x1a87b8[_0x3fca('0x3b')]['length']?_0x1a87b8['attributes']:_0x3ad975[_0x3fca('0x3a')];if(_0x3707ba[_0x3fca('0x37')][_0x3fca('0x45')]){_0x1a87b8[_0x3fca('0x46')]=[{'all':!![]}];}_0x1a87b8=_[_0x3fca('0x43')]({},_0x1a87b8,_0x3707ba[_0x3fca('0x4e')]);return db[_0x3fca('0x33')]['find'](_0x1a87b8)[_0x3fca('0x2b')](handleEntityNotFound(_0x8704fb,null))['then'](respondWithResult(_0x8704fb,null))['catch'](handleError(_0x8704fb,null));};exports[_0x3fca('0x4f')]=function(_0x10cff0,_0x1ae859,_0x1266d3){return db[_0x3fca('0x33')][_0x3fca('0x50')]({'where':{'id':_0x10cff0[_0x3fca('0x4b')]['id']},'attributes':[_0x3fca('0x2f'),_0x3fca('0x51'),_0x3fca('0x52')],'raw':!![]})[_0x3fca('0x2b')](handleEntityNotFound(_0x1ae859,null))[_0x3fca('0x2b')](function(_0x1c7b60){if(_0x1c7b60){if(!fs[_0x3fca('0x53')](path['join'](config[_0x3fca('0x54')],_0x3fca('0x55'),_0x1c7b60['save_name']+'.'+_0x1c7b60[_0x3fca('0x52')]))){throw new db['Sequelize'][(_0x3fca('0x56'))](_0x3fca('0x57'));}return _0x1ae859['download'](path[_0x3fca('0x58')](config['root'],'server/files/sounds/converted',util[_0x3fca('0x59')](_0x3fca('0x5a'),_0x1c7b60[_0x3fca('0x51')],_0x1c7b60['converted_format'])),util[_0x3fca('0x59')]('%s.%s',_0x1c7b60['name'],_0x1c7b60[_0x3fca('0x52')]));}return null;})[_0x3fca('0x49')](handleError(_0x1ae859,null));};exports['create']=function(_0x74493f,_0x173bff,_0x39defc){var _0x35c374={'name':path[_0x3fca('0x5b')](_0x74493f[_0x3fca('0x5c')]['originalname'],path[_0x3fca('0x5d')](_0x74493f[_0x3fca('0x5c')][_0x3fca('0x5e')])),'save_name':path[_0x3fca('0x5b')](_0x74493f['file'][_0x3fca('0x5f')],path[_0x3fca('0x5d')](_0x74493f[_0x3fca('0x5c')][_0x3fca('0x5f')])),'original_format':path[_0x3fca('0x5d')](_0x74493f[_0x3fca('0x5c')]['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x7e5b25=path[_0x3fca('0x58')](config[_0x3fca('0x54')],_0x3fca('0x60'),_0x74493f['file'][_0x3fca('0x5f')]);var _0x13a526=path['join'](config[_0x3fca('0x54')],_0x3fca('0x55'),util['format']('%s.%s',path[_0x3fca('0x5b')](_0x74493f['file']['filename'],path['extname'](_0x74493f[_0x3fca('0x5c')][_0x3fca('0x5f')])),_0x35c374[_0x3fca('0x52')]));logger[_0x3fca('0x61')]('Sound\x20upload\x20filepath:\x20%s',_0x7e5b25);logger[_0x3fca('0x61')](_0x3fca('0x62'),_0x13a526);try{fs[_0x3fca('0x63')](_0x7e5b25,parseInt(_0x3fca('0x64'),0x8));var _0x3df0d5=sox['transcode'](_0x7e5b25,_0x13a526,{'sampleRate':0x1f40,'format':_0x3fca('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3df0d5['on']('error',function(_0x6e7400){fs['unlinkSync'](_0x7e5b25);_0x173bff['status'](0x1f4)['send'](_0x6e7400);});_0x3df0d5['on'](_0x3fca('0x66'),function(_0x39449c){_0x35c374[_0x3fca('0x67')]=isNaN(_0x39449c[_0x3fca('0x68')])?null:_0x39449c[_0x3fca('0x68')]*0x3e8;_0x35c374[_0x3fca('0x69')]=isNaN(_0x39449c[_0x3fca('0x6a')])?null:_0x39449c[_0x3fca('0x6a')];_0x35c374[_0x3fca('0x6b')]=isNaN(_0x39449c['channelCount'])?null:_0x39449c['channelCount'];_0x35c374[_0x3fca('0x6c')]=isNaN(_0x39449c[_0x3fca('0x6d')])?null:_0x39449c[_0x3fca('0x6d')];_0x35c374['original_sampleRate']=isNaN(_0x39449c[_0x3fca('0x6e')])?null:_0x39449c[_0x3fca('0x6e')];});_0x3df0d5['on'](_0x3fca('0x6f'),function(_0x3ecb0f){_0x35c374[_0x3fca('0x70')]=isNaN(_0x3ecb0f[_0x3fca('0x68')])?null:_0x3ecb0f[_0x3fca('0x68')]*0x3e8;_0x35c374[_0x3fca('0x71')]=isNaN(_0x3ecb0f[_0x3fca('0x6a')])?null:_0x3ecb0f[_0x3fca('0x6a')];_0x35c374['converted_channelCount']=isNaN(_0x3ecb0f['channelCount'])?null:_0x3ecb0f['channelCount'];_0x35c374[_0x3fca('0x72')]=isNaN(_0x3ecb0f[_0x3fca('0x6d')])?null:_0x3ecb0f[_0x3fca('0x6d')];_0x35c374['converted_sampleRate']=isNaN(_0x3ecb0f['sampleRate'])?null:_0x3ecb0f[_0x3fca('0x6e')];});_0x3df0d5['on']('end',function(){fs[_0x3fca('0x63')](_0x13a526,parseInt(_0x3fca('0x64'),0x8));return db[_0x3fca('0x33')][_0x3fca('0x73')](_0x35c374)[_0x3fca('0x2b')](function(_0x453d73){var _0x1e3ecb={'role':_0x74493f[_0x3fca('0x74')][_0x3fca('0x75')],'userProfileId':_0x74493f[_0x3fca('0x74')][_0x3fca('0x76')]};if(!_0x1e3ecb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e3ecb[_0x3fca('0x75')]==='user'){var _0x338078=_0x453d73[_0x3fca('0x2c')]({'plain':!![]});return db[_0x3fca('0x77')]['find']({'where':{'name':'Sounds','userProfileId':_0x1e3ecb['userProfileId']},'raw':!![]})[_0x3fca('0x2b')](function(_0xd63812){if(_0xd63812&&_0xd63812[_0x3fca('0x78')]===0x0){return db[_0x3fca('0x79')][_0x3fca('0x73')]({'name':_0x338078[_0x3fca('0x2f')],'resourceId':_0x338078['id'],'type':_0xd63812[_0x3fca('0x2f')],'sectionId':_0xd63812['id']},{})['then'](function(){return _0x453d73;});}else{return _0x453d73;}})[_0x3fca('0x49')](function(_0x23dc0c){logger[_0x3fca('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23dc0c);throw _0x23dc0c;});}return _0x453d73;})[_0x3fca('0x2b')](respondWithResult(_0x173bff,null))[_0x3fca('0x49')](handleError(_0x173bff,null));});_0x3df0d5[_0x3fca('0x7a')]();}catch(_0x3a37cb){_0x173bff[_0x3fca('0x1e')](0x1f4)[_0x3fca('0x30')](_0x3a37cb);}};exports[_0x3fca('0x29')]=function(_0x3e3cb6,_0x243081,_0x89504c){return db[_0x3fca('0x33')][_0x3fca('0x50')]({'where':{'id':_0x3e3cb6[_0x3fca('0x4b')]['id']}})[_0x3fca('0x2b')](handleEntityNotFound(_0x243081,null))[_0x3fca('0x2b')](saveUpdates(_['pick'](_0x3e3cb6[_0x3fca('0x74')],[_0x3fca('0x2f'),'description']),null))[_0x3fca('0x2b')](respondWithResult(_0x243081,null))[_0x3fca('0x49')](handleError(_0x243081,null));};exports[_0x3fca('0x7b')]=function(_0x5affde,_0x349c19,_0x1e09fc){return db[_0x3fca('0x33')][_0x3fca('0x50')]({'where':{'id':_0x5affde[_0x3fca('0x4b')]['id']}})['then'](function(_0x22fe32){if(_0x22fe32){return _0x22fe32[_0x3fca('0x2a')]();}})[_0x3fca('0x2b')](function(_0x2a78f9){var _0x2101ff=path[_0x3fca('0x58')](config[_0x3fca('0x54')],'server/files/sounds/original',util[_0x3fca('0x59')]('%s.%s',_0x2a78f9[_0x3fca('0x51')],_0x2a78f9['original_format']));var _0x4312fc=path[_0x3fca('0x58')](config[_0x3fca('0x54')],_0x3fca('0x55'),util[_0x3fca('0x59')](_0x3fca('0x5a'),_0x2a78f9[_0x3fca('0x51')],_0x2a78f9['converted_format']));fs['unlinkSync'](_0x2101ff);fs['unlinkSync'](_0x4312fc);return _0x2a78f9;})['then'](function(_0x22f598){if(_0x22f598){return _0x349c19[_0x3fca('0x1e')](0xcc)['end']();}})[_0x3fca('0x2b')](handleEntityNotFound(_0x349c19,null))[_0x3fca('0x49')](handleError(_0x349c19,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 27a2f80..161769f 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 _0x92b9=['request-promise','path','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x92b9,0x14b));var _0x992b=function(_0x5575bb,_0x272266){_0x5575bb=_0x5575bb-0x0;var _0x347c89=_0x92b9[_0x5575bb];return _0x347c89;};'use strict';var _=require(_0x992b('0x0'));var util=require(_0x992b('0x1'));var logger=require(_0x992b('0x2'))(_0x992b('0x3'));var moment=require(_0x992b('0x4'));var BPromise=require('bluebird');var rp=require(_0x992b('0x5'));var fs=require('fs');var path=require(_0x992b('0x6'));var rimraf=require('rimraf');var config=require(_0x992b('0x7'));var attributes=require(_0x992b('0x8'));module[_0x992b('0x9')]=function(_0x40aafe,_0x4e9008){return _0x40aafe['define'](_0x992b('0xa'),attributes,{'tableName':_0x992b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac12=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds'];(function(_0x1754db,_0x3e32f7){var _0x273e77=function(_0x2c71c3){while(--_0x2c71c3){_0x1754db['push'](_0x1754db['shift']());}};_0x273e77(++_0x3e32f7);}(_0xac12,0x1e4));var _0x2ac1=function(_0x4b6c5b,_0xb10bc6){_0x4b6c5b=_0x4b6c5b-0x0;var _0x5465ac=_0xac12[_0x4b6c5b];return _0x5465ac;};'use strict';var _=require(_0x2ac1('0x0'));var util=require(_0x2ac1('0x1'));var logger=require(_0x2ac1('0x2'))(_0x2ac1('0x3'));var moment=require(_0x2ac1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2ac1('0x5'));var config=require(_0x2ac1('0x6'));var attributes=require(_0x2ac1('0x7'));module['exports']=function(_0x21eaa5,_0x5434f1){return _0x21eaa5[_0x2ac1('0x8')](_0x2ac1('0x9'),attributes,{'tableName':_0x2ac1('0xa'),'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 05fc082..aa61d18 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 _0x5283=['code','error','message','result','catch','ShowSound','Sound','options','raw','where','attributes','map','model','include','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e79a7,_0x5c6fa7){var _0x11d050=function(_0x3910dc){while(--_0x3910dc){_0x3e79a7['push'](_0x3e79a7['shift']());}};_0x11d050(++_0x5c6fa7);}(_0x5283,0x1e0));var _0x3528=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x5283[_0x5c38cd];return _0xc985ef;};'use strict';var _=require(_0x3528('0x0'));var util=require(_0x3528('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3528('0x2'));var fs=require('fs');var Redis=require(_0x3528('0x3'));var db=require(_0x3528('0x4'))['db'];var utils=require(_0x3528('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3528('0x6'));var jayson=require(_0x3528('0x7'));var client=jayson['client'][_0x3528('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c59b7,_0x56d1df,_0x1b1d84){return new BPromise(function(_0xd0225b,_0x255f0e){return client[_0x3528('0x9')](_0x3c59b7,_0x1b1d84)[_0x3528('0xa')](function(_0x21e93b){logger[_0x3528('0xb')](_0x3528('0xc'),_0x56d1df,_0x3528('0xd'));logger['debug'](_0x3528('0xe'),_0x56d1df,'request\x20sent',JSON[_0x3528('0xf')](_0x21e93b));if(_0x21e93b['error']){if(_0x21e93b['error'][_0x3528('0x10')]===0x1f4){logger[_0x3528('0x11')](_0x3528('0xc'),_0x56d1df,_0x21e93b[_0x3528('0x11')][_0x3528('0x12')]);return _0x255f0e(_0x21e93b[_0x3528('0x11')][_0x3528('0x12')]);}logger[_0x3528('0x11')](_0x3528('0xc'),_0x56d1df,_0x21e93b[_0x3528('0x11')][_0x3528('0x12')]);return _0xd0225b(_0x21e93b[_0x3528('0x11')]['message']);}else{logger[_0x3528('0xb')](_0x3528('0xc'),_0x56d1df,_0x3528('0xd'));_0xd0225b(_0x21e93b[_0x3528('0x13')]['message']);}})[_0x3528('0x14')](function(_0x371d1c){logger[_0x3528('0x11')](_0x3528('0xc'),_0x56d1df,_0x371d1c);_0x255f0e(_0x371d1c);});});}exports[_0x3528('0x15')]=function(_0x32ac65){var _0x469ec9=this;return new Promise(function(_0x3e189f,_0x4e48e2){return db[_0x3528('0x16')]['find']({'raw':_0x32ac65['options']?_0x32ac65[_0x3528('0x17')][_0x3528('0x18')]===undefined?!![]:![]:!![],'where':_0x32ac65['options']?_0x32ac65['options'][_0x3528('0x19')]||null:null,'attributes':_0x32ac65[_0x3528('0x17')]?_0x32ac65[_0x3528('0x17')][_0x3528('0x1a')]||null:null,'include':_0x32ac65[_0x3528('0x17')]?_0x32ac65[_0x3528('0x17')]['include']?_[_0x3528('0x1b')](_0x32ac65[_0x3528('0x17')]['include'],function(_0x2af7d4){return{'model':db[_0x2af7d4[_0x3528('0x1c')]],'as':_0x2af7d4['as'],'attributes':_0x2af7d4[_0x3528('0x1a')],'include':_0x2af7d4['include']?_['map'](_0x2af7d4[_0x3528('0x1d')],function(_0x32181f){return{'model':db[_0x32181f[_0x3528('0x1c')]],'as':_0x32181f['as'],'attributes':_0x32181f['attributes'],'include':_0x32181f[_0x3528('0x1d')]?_[_0x3528('0x1b')](_0x32181f[_0x3528('0x1d')],function(_0x209fe4){return{'model':db[_0x209fe4['model']],'as':_0x209fe4['as'],'attributes':_0x209fe4[_0x3528('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3528('0xa')](function(_0x4255e7){logger['info']('ShowSound',_0x32ac65);logger[_0x3528('0x1e')](_0x3528('0x15'),_0x32ac65,JSON[_0x3528('0xf')](_0x4255e7));_0x3e189f(_0x4255e7);})[_0x3528('0x14')](function(_0x324541){logger[_0x3528('0x11')]('ShowSound',_0x324541[_0x3528('0x12')],_0x32ac65);_0x4e48e2(_0x469ec9[_0x3528('0x11')](0x1f4,_0x324541[_0x3528('0x12')]));});});}; \ No newline at end of file +var _0xdfd3=['ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Sound,\x20%s,\x20%s','info','result','catch','Sound','find','options','where','attributes','include','map','model'];(function(_0x30879a,_0xba2c5b){var _0x50ca1c=function(_0x1bf77a){while(--_0x1bf77a){_0x30879a['push'](_0x30879a['shift']());}};_0x50ca1c(++_0xba2c5b);}(_0xdfd3,0xa1));var _0x3dfd=function(_0x187193,_0x24e49d){_0x187193=_0x187193-0x0;var _0x5002aa=_0xdfd3[_0x187193];return _0x5002aa;};'use strict';var _=require(_0x3dfd('0x0'));var util=require('util');var moment=require(_0x3dfd('0x1'));var BPromise=require(_0x3dfd('0x2'));var rs=require(_0x3dfd('0x3'));var fs=require('fs');var Redis=require(_0x3dfd('0x4'));var db=require(_0x3dfd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dfd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dfd('0x7'));var client=jayson[_0x3dfd('0x8')][_0x3dfd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ea38f,_0x183acd,_0x24ba67){return new BPromise(function(_0x4f8944,_0x412c23){return client[_0x3dfd('0xa')](_0x3ea38f,_0x24ba67)[_0x3dfd('0xb')](function(_0x182bfe){logger['info']('Sound,\x20%s,\x20%s',_0x183acd,_0x3dfd('0xc'));logger[_0x3dfd('0xd')](_0x3dfd('0xe'),_0x183acd,_0x3dfd('0xc'),JSON[_0x3dfd('0xf')](_0x182bfe));if(_0x182bfe[_0x3dfd('0x10')]){if(_0x182bfe[_0x3dfd('0x10')][_0x3dfd('0x11')]===0x1f4){logger[_0x3dfd('0x10')]('Sound,\x20%s,\x20%s',_0x183acd,_0x182bfe[_0x3dfd('0x10')][_0x3dfd('0x12')]);return _0x412c23(_0x182bfe[_0x3dfd('0x10')][_0x3dfd('0x12')]);}logger[_0x3dfd('0x10')](_0x3dfd('0x13'),_0x183acd,_0x182bfe['error']['message']);return _0x4f8944(_0x182bfe[_0x3dfd('0x10')]['message']);}else{logger[_0x3dfd('0x14')]('Sound,\x20%s,\x20%s',_0x183acd,'request\x20sent');_0x4f8944(_0x182bfe[_0x3dfd('0x15')][_0x3dfd('0x12')]);}})[_0x3dfd('0x16')](function(_0xf91b44){logger['error'](_0x3dfd('0x13'),_0x183acd,_0xf91b44);_0x412c23(_0xf91b44);});});}exports['ShowSound']=function(_0x3eeeeb){var _0x3836d8=this;return new Promise(function(_0x335ec1,_0x434b0b){return db[_0x3dfd('0x17')][_0x3dfd('0x18')]({'raw':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb['options']['raw']===undefined?!![]:![]:!![],'where':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1a')]||null:null,'attributes':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1b')]||null:null,'include':_0x3eeeeb[_0x3dfd('0x19')]?_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1c')]?_[_0x3dfd('0x1d')](_0x3eeeeb[_0x3dfd('0x19')][_0x3dfd('0x1c')],function(_0x57e262){return{'model':db[_0x57e262[_0x3dfd('0x1e')]],'as':_0x57e262['as'],'attributes':_0x57e262['attributes'],'include':_0x57e262[_0x3dfd('0x1c')]?_['map'](_0x57e262[_0x3dfd('0x1c')],function(_0x3beb9b){return{'model':db[_0x3beb9b[_0x3dfd('0x1e')]],'as':_0x3beb9b['as'],'attributes':_0x3beb9b[_0x3dfd('0x1b')],'include':_0x3beb9b[_0x3dfd('0x1c')]?_[_0x3dfd('0x1d')](_0x3beb9b['include'],function(_0x5742fc){return{'model':db[_0x5742fc[_0x3dfd('0x1e')]],'as':_0x5742fc['as'],'attributes':_0x5742fc[_0x3dfd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3dfd('0xb')](function(_0x5078f5){logger[_0x3dfd('0x14')](_0x3dfd('0x1f'),_0x3eeeeb);logger[_0x3dfd('0xd')](_0x3dfd('0x1f'),_0x3eeeeb,JSON['stringify'](_0x5078f5));_0x335ec1(_0x5078f5);})[_0x3dfd('0x16')](function(_0xc102f){logger[_0x3dfd('0x10')](_0x3dfd('0x1f'),_0xc102f['message'],_0x3eeeeb);_0x434b0b(_0x3836d8[_0x3dfd('0x10')](0x1f4,_0xc102f[_0x3dfd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d8c0d8d..19c67c2 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 _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(_0x39e227,_0x21fa81){var _0x558d73=function(_0x282632){while(--_0x282632){_0x39e227['push'](_0x39e227['shift']());}};_0x558d73(++_0x21fa81);}(_0x2032,0xd9));var _0x2203=function(_0x5034bb,_0x4a80ba){_0x5034bb=_0x5034bb-0x0;var _0x3a94fa=_0x2032[_0x5034bb];return _0x3a94fa;};'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 +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x1aac1d,_0x1dca6c){var _0x140f0d=function(_0x3e4db4){while(--_0x3e4db4){_0x1aac1d['push'](_0x1aac1d['shift']());}};_0x140f0d(++_0x1dca6c);}(_0xda3f,0xec));var _0xfda3=function(_0x583abd,_0x552d21){_0x583abd=_0x583abd-0x0;var _0x4c046b=_0xda3f[_0x583abd];return _0x4c046b;};'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('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d61ca1a..871ed0f 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 _0x2e61=['medium','out','exports','STRING'];(function(_0x254163,_0x1b990b){var _0x4bad07=function(_0x419819){while(--_0x419819){_0x254163['push'](_0x254163['shift']());}};_0x4bad07(++_0x1b990b);}(_0x2e61,0x86));var _0x12e6=function(_0x226716,_0x5b24dd){_0x226716=_0x226716-0x0;var _0x45801f=_0x2e61[_0x226716];return _0x45801f;};'use strict';var Sequelize=require('sequelize');module[_0x12e6('0x0')]={'uniqueid':{'type':Sequelize[_0x12e6('0x1')]},'body':{'type':Sequelize['TEXT'](_0x12e6('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x12e6('0x3')),'defaultValue':_0x12e6('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x97e5=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x3072e2,_0x648a09){var _0x42c45b=function(_0x2ddff5){while(--_0x2ddff5){_0x3072e2['push'](_0x3072e2['shift']());}};_0x42c45b(++_0x648a09);}(_0x97e5,0xbf));var _0x597e=function(_0x9673ef,_0x587cd0){_0x9673ef=_0x9673ef-0x0;var _0x3f24a9=_0x97e5[_0x9673ef];return _0x3f24a9;};'use strict';var Sequelize=require(_0x597e('0x0'));module[_0x597e('0x1')]={'uniqueid':{'type':Sequelize[_0x597e('0x2')]},'body':{'type':Sequelize[_0x597e('0x3')](_0x597e('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x597e('0x5')]('in',_0x597e('0x6')),'defaultValue':_0x597e('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x597e('0x2')]},'providerResponse':{'type':Sequelize[_0x597e('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index dc7ab75..279832a 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 _0x87ad=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','stack','name','send','index','SquareMessage','rawAttributes','type','key','model','map','query','keys','intersection','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','attributes','length','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x279dce,_0x2f2d2){var _0x1d7e03=function(_0x949a){while(--_0x949a){_0x279dce['push'](_0x279dce['shift']());}};_0x1d7e03(++_0x2f2d2);}(_0x87ad,0x76));var _0xd87a=function(_0x67e2b1,_0x11bb74){_0x67e2b1=_0x67e2b1-0x0;var _0xb0fe50=_0x87ad[_0x67e2b1];return _0xb0fe50;};'use strict';var emlformat=require(_0xd87a('0x0'));var rimraf=require(_0xd87a('0x1'));var zipdir=require(_0xd87a('0x2'));var jsonpatch=require(_0xd87a('0x3'));var rp=require(_0xd87a('0x4'));var moment=require('moment');var BPromise=require(_0xd87a('0x5'));var Mustache=require(_0xd87a('0x6'));var util=require(_0xd87a('0x7'));var path=require(_0xd87a('0x8'));var sox=require('sox');var csv=require(_0xd87a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd87a('0xa'));var _=require('lodash');var squel=require(_0xd87a('0xb'));var crypto=require(_0xd87a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd87a('0xd'));var toCsv=require(_0xd87a('0x9'));var querystring=require('querystring');var Papa=require(_0xd87a('0xe'));var Redis=require(_0xd87a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd87a('0x10'));var as=require(_0xd87a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd87a('0x12'));var utils=require('../../config/utils');var config=require(_0xd87a('0x13'));var licenseUtil=require(_0xd87a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151fd8,_0xefa9c3){_0xefa9c3=_0xefa9c3||0xcc;return function(_0x310a88){if(_0x310a88){return _0x151fd8[_0xd87a('0x15')](_0xefa9c3);}return _0x151fd8[_0xd87a('0x16')](_0xefa9c3)[_0xd87a('0x17')]();};}function respondWithResult(_0x47a8ee,_0x404e9a){_0x404e9a=_0x404e9a||0xc8;return function(_0x167137){if(_0x167137){return _0x47a8ee[_0xd87a('0x16')](_0x404e9a)[_0xd87a('0x18')](_0x167137);}};}function respondWithFilteredResult(_0x58f15a,_0xc309c5){return function(_0xf15100){if(_0xf15100){var _0x472171=typeof _0xc309c5[_0xd87a('0x19')]==='undefined'&&typeof _0xc309c5[_0xd87a('0x1a')]==='undefined';var _0x3e825a=_0xf15100[_0xd87a('0x1b')];var _0x54f072=_0x472171?0x0:_0xc309c5[_0xd87a('0x19')];var _0x1427dd=_0x472171?_0xf15100[_0xd87a('0x1b')]:_0xc309c5[_0xd87a('0x19')]+_0xc309c5[_0xd87a('0x1a')];var _0x4f91ad;if(_0x1427dd>=_0x3e825a){_0x1427dd=_0x3e825a;_0x4f91ad=0xc8;}else{_0x4f91ad=0xce;}_0x58f15a['status'](_0x4f91ad);return _0x58f15a[_0xd87a('0x1c')](_0xd87a('0x1d'),_0x54f072+'-'+_0x1427dd+'/'+_0x3e825a)[_0xd87a('0x18')](_0xf15100);}return null;};}function patchUpdates(_0x9f87b1){return function(_0x5893b5){try{jsonpatch['apply'](_0x5893b5,_0x9f87b1,!![]);}catch(_0x3d44ab){return BPromise[_0xd87a('0x1e')](_0x3d44ab);}return _0x5893b5[_0xd87a('0x1f')]();};}function saveUpdates(_0x4dcf66,_0x2a591c){return function(_0x459cf9){if(_0x459cf9){return _0x459cf9['update'](_0x4dcf66)[_0xd87a('0x20')](function(_0xc01c43){return _0xc01c43;});}return null;};}function removeEntity(_0x445d81,_0x54a286){return function(_0x4bb6f7){if(_0x4bb6f7){return _0x4bb6f7['destroy']()[_0xd87a('0x20')](function(){_0x445d81[_0xd87a('0x16')](0xcc)[_0xd87a('0x17')]();});}};}function handleEntityNotFound(_0x22ebc3,_0x175096){return function(_0xd569dc){if(!_0xd569dc){_0x22ebc3['sendStatus'](0x194);}return _0xd569dc;};}function handleError(_0x9241f9,_0x134a47){_0x134a47=_0x134a47||0x1f4;return function(_0x35a2c5){logger['error'](_0x35a2c5[_0xd87a('0x21')]);if(_0x35a2c5['name']){delete _0x35a2c5[_0xd87a('0x22')];}_0x9241f9[_0xd87a('0x16')](_0x134a47)[_0xd87a('0x23')](_0x35a2c5);};}exports[_0xd87a('0x24')]=function(_0x43e5b9,_0x1003c6){var _0x3cf5fd={},_0x353c50={},_0x192d66={'count':0x0,'rows':[]};var _0x2e7e7e=_['map'](db[_0xd87a('0x25')][_0xd87a('0x26')],function(_0x2c96e6){return{'name':_0x2c96e6['fieldName'],'type':_0x2c96e6[_0xd87a('0x27')][_0xd87a('0x28')]};});_0x353c50[_0xd87a('0x29')]=_[_0xd87a('0x2a')](_0x2e7e7e,_0xd87a('0x22'));_0x353c50[_0xd87a('0x2b')]=_[_0xd87a('0x2c')](_0x43e5b9[_0xd87a('0x2b')]);_0x353c50['filters']=_[_0xd87a('0x2d')](_0x353c50['model'],_0x353c50['query']);_0x3cf5fd['attributes']=_[_0xd87a('0x2d')](_0x353c50[_0xd87a('0x29')],qs['fields'](_0x43e5b9['query'][_0xd87a('0x2e')]));_0x3cf5fd['attributes']=_0x3cf5fd['attributes']['length']?_0x3cf5fd['attributes']:_0x353c50[_0xd87a('0x29')];if(!_0x43e5b9[_0xd87a('0x2b')]['hasOwnProperty']('nolimit')){_0x3cf5fd[_0xd87a('0x1a')]=qs[_0xd87a('0x1a')](_0x43e5b9[_0xd87a('0x2b')][_0xd87a('0x1a')]);_0x3cf5fd[_0xd87a('0x19')]=qs[_0xd87a('0x19')](_0x43e5b9[_0xd87a('0x2b')][_0xd87a('0x19')]);}_0x3cf5fd[_0xd87a('0x2f')]=qs[_0xd87a('0x30')](_0x43e5b9['query'][_0xd87a('0x30')]);_0x3cf5fd[_0xd87a('0x31')]=qs[_0xd87a('0x32')](_[_0xd87a('0x33')](_0x43e5b9[_0xd87a('0x2b')],_0x353c50[_0xd87a('0x32')]),_0x2e7e7e);if(_0x43e5b9[_0xd87a('0x2b')][_0xd87a('0x34')]){_0x3cf5fd[_0xd87a('0x31')]=_[_0xd87a('0x35')](_0x3cf5fd[_0xd87a('0x31')],{'$or':_[_0xd87a('0x2a')](_0x2e7e7e,function(_0x3a05e7){if(_0x3a05e7[_0xd87a('0x27')]!==_0xd87a('0x36')){var _0x2f3fc4={};_0x2f3fc4[_0x3a05e7[_0xd87a('0x22')]]={'$like':'%'+_0x43e5b9['query'][_0xd87a('0x34')]+'%'};return _0x2f3fc4;}})});}_0x3cf5fd=_[_0xd87a('0x35')]({},_0x3cf5fd,_0x43e5b9['options']);var _0x23bf2b={'where':_0x3cf5fd['where']};return db[_0xd87a('0x25')]['count'](_0x23bf2b)['then'](function(_0x5eab61){_0x192d66['count']=_0x5eab61;if(_0x43e5b9['query']['includeAll']){_0x3cf5fd[_0xd87a('0x37')]=[{'all':!![]}];}return db[_0xd87a('0x25')][_0xd87a('0x38')](_0x3cf5fd);})[_0xd87a('0x20')](function(_0x206167){_0x192d66['rows']=_0x206167;return _0x192d66;})[_0xd87a('0x20')](respondWithFilteredResult(_0x1003c6,_0x3cf5fd))[_0xd87a('0x39')](handleError(_0x1003c6,null));};exports[_0xd87a('0x3a')]=function(_0x8e8022,_0x218559){var _0x1cf02a={'raw':!![],'where':{'id':_0x8e8022[_0xd87a('0x3b')]['id']}},_0x13a3ba={};_0x13a3ba[_0xd87a('0x29')]=_[_0xd87a('0x2c')](db[_0xd87a('0x25')][_0xd87a('0x26')]);_0x13a3ba['query']=_[_0xd87a('0x2c')](_0x8e8022['query']);_0x13a3ba[_0xd87a('0x32')]=_[_0xd87a('0x2d')](_0x13a3ba[_0xd87a('0x29')],_0x13a3ba[_0xd87a('0x2b')]);_0x1cf02a['attributes']=_[_0xd87a('0x2d')](_0x13a3ba[_0xd87a('0x29')],qs[_0xd87a('0x2e')](_0x8e8022['query'][_0xd87a('0x2e')]));_0x1cf02a[_0xd87a('0x3c')]=_0x1cf02a[_0xd87a('0x3c')][_0xd87a('0x3d')]?_0x1cf02a[_0xd87a('0x3c')]:_0x13a3ba[_0xd87a('0x29')];if(_0x8e8022[_0xd87a('0x2b')][_0xd87a('0x3e')]){_0x1cf02a['include']=[{'all':!![]}];}_0x1cf02a=_['merge']({},_0x1cf02a,_0x8e8022[_0xd87a('0x3f')]);return db[_0xd87a('0x25')][_0xd87a('0x40')](_0x1cf02a)['then'](handleEntityNotFound(_0x218559,null))[_0xd87a('0x20')](respondWithResult(_0x218559,null))[_0xd87a('0x39')](handleError(_0x218559,null));};exports[_0xd87a('0x41')]=function(_0x2e4d30,_0x4cd367){return db[_0xd87a('0x25')]['create'](_0x2e4d30[_0xd87a('0x42')],{})['then'](respondWithResult(_0x4cd367,0xc9))[_0xd87a('0x39')](handleError(_0x4cd367,null));};exports['update']=function(_0x4d21a8,_0xce0fb9){if(_0x4d21a8['body']['id']){delete _0x4d21a8['body']['id'];}return db[_0xd87a('0x25')][_0xd87a('0x40')]({'where':{'id':_0x4d21a8[_0xd87a('0x3b')]['id']}})[_0xd87a('0x20')](handleEntityNotFound(_0xce0fb9,null))[_0xd87a('0x20')](saveUpdates(_0x4d21a8[_0xd87a('0x42')],null))[_0xd87a('0x20')](respondWithResult(_0xce0fb9,null))[_0xd87a('0x39')](handleError(_0xce0fb9,null));};exports[_0xd87a('0x43')]=function(_0x47b504,_0x254b84){return db[_0xd87a('0x25')]['find']({'where':{'id':_0x47b504['params']['id']}})[_0xd87a('0x20')](handleEntityNotFound(_0x254b84,null))[_0xd87a('0x20')](removeEntity(_0x254b84,null))[_0xd87a('0x39')](handleError(_0x254b84,null));}; \ No newline at end of file +var _0x3cd0=['eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','name','send','map','SquareMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0x16a2bc,_0x1d4c4e){var _0x5af146=function(_0x55c6b8){while(--_0x55c6b8){_0x16a2bc['push'](_0x16a2bc['shift']());}};_0x5af146(++_0x1d4c4e);}(_0x3cd0,0x8a));var _0x03cd=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0x3cd0[_0x4bcf38];return _0x4a89be;};'use strict';var emlformat=require(_0x03cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03cd('0x1'));var rp=require('request-promise');var moment=require(_0x03cd('0x2'));var BPromise=require(_0x03cd('0x3'));var Mustache=require(_0x03cd('0x4'));var util=require(_0x03cd('0x5'));var path=require(_0x03cd('0x6'));var sox=require('sox');var csv=require(_0x03cd('0x7'));var ejs=require(_0x03cd('0x8'));var fs=require('fs');var fs_extra=require(_0x03cd('0x9'));var _=require(_0x03cd('0xa'));var squel=require(_0x03cd('0xb'));var crypto=require('crypto');var jsforce=require(_0x03cd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03cd('0x7'));var querystring=require(_0x03cd('0xd'));var Papa=require(_0x03cd('0xe'));var Redis=require(_0x03cd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x03cd('0x10'));var as=require(_0x03cd('0x11'));var hardwareService=require(_0x03cd('0x12'));var logger=require(_0x03cd('0x13'))(_0x03cd('0x14'));var utils=require(_0x03cd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03cd('0x16'))['db'];function respondWithStatusCode(_0x315a6c,_0xaa6a21){_0xaa6a21=_0xaa6a21||0xcc;return function(_0x1d88e6){if(_0x1d88e6){return _0x315a6c['sendStatus'](_0xaa6a21);}return _0x315a6c[_0x03cd('0x17')](_0xaa6a21)[_0x03cd('0x18')]();};}function respondWithResult(_0x5d0c1c,_0x4f8f17){_0x4f8f17=_0x4f8f17||0xc8;return function(_0x58c000){if(_0x58c000){return _0x5d0c1c[_0x03cd('0x17')](_0x4f8f17)[_0x03cd('0x19')](_0x58c000);}};}function respondWithFilteredResult(_0x17961d,_0x77b1bf){return function(_0x526102){if(_0x526102){var _0xdf7488=typeof _0x77b1bf[_0x03cd('0x1a')]===_0x03cd('0x1b')&&typeof _0x77b1bf[_0x03cd('0x1c')]===_0x03cd('0x1b');var _0x5ac997=_0x526102[_0x03cd('0x1d')];var _0x27de4f=_0xdf7488?0x0:_0x77b1bf[_0x03cd('0x1a')];var _0x12b3ea=_0xdf7488?_0x526102[_0x03cd('0x1d')]:_0x77b1bf['offset']+_0x77b1bf[_0x03cd('0x1c')];var _0xa1122b;if(_0x12b3ea>=_0x5ac997){_0x12b3ea=_0x5ac997;_0xa1122b=0xc8;}else{_0xa1122b=0xce;}_0x17961d[_0x03cd('0x17')](_0xa1122b);return _0x17961d[_0x03cd('0x1e')]('Content-Range',_0x27de4f+'-'+_0x12b3ea+'/'+_0x5ac997)[_0x03cd('0x19')](_0x526102);}return null;};}function patchUpdates(_0x4d0a58){return function(_0x1d51fa){try{jsonpatch[_0x03cd('0x1f')](_0x1d51fa,_0x4d0a58,!![]);}catch(_0x85ac1b){return BPromise['reject'](_0x85ac1b);}return _0x1d51fa['save']();};}function saveUpdates(_0x255c96,_0x19ad78){return function(_0x4e8ff6){if(_0x4e8ff6){return _0x4e8ff6[_0x03cd('0x20')](_0x255c96)[_0x03cd('0x21')](function(_0x56ec2b){return _0x56ec2b;});}return null;};}function removeEntity(_0x440df7,_0x514c11){return function(_0x4f1b33){if(_0x4f1b33){return _0x4f1b33[_0x03cd('0x22')]()[_0x03cd('0x21')](function(){_0x440df7[_0x03cd('0x17')](0xcc)[_0x03cd('0x18')]();});}};}function handleEntityNotFound(_0x5173e9,_0x2f32df){return function(_0x4d64a6){if(!_0x4d64a6){_0x5173e9['sendStatus'](0x194);}return _0x4d64a6;};}function handleError(_0x245154,_0x491b16){_0x491b16=_0x491b16||0x1f4;return function(_0x3203b1){logger['error'](_0x3203b1['stack']);if(_0x3203b1[_0x03cd('0x23')]){delete _0x3203b1['name'];}_0x245154[_0x03cd('0x17')](_0x491b16)[_0x03cd('0x24')](_0x3203b1);};}exports['index']=function(_0x13242a,_0x38117e){var _0xb5eb0={},_0x12ec99={},_0x1d3309={'count':0x0,'rows':[]};var _0x49693c=_[_0x03cd('0x25')](db[_0x03cd('0x26')][_0x03cd('0x27')],function(_0x1e8827){return{'name':_0x1e8827['fieldName'],'type':_0x1e8827[_0x03cd('0x28')][_0x03cd('0x29')]};});_0x12ec99[_0x03cd('0x2a')]=_[_0x03cd('0x25')](_0x49693c,_0x03cd('0x23'));_0x12ec99[_0x03cd('0x2b')]=_[_0x03cd('0x2c')](_0x13242a[_0x03cd('0x2b')]);_0x12ec99[_0x03cd('0x2d')]=_[_0x03cd('0x2e')](_0x12ec99[_0x03cd('0x2a')],_0x12ec99[_0x03cd('0x2b')]);_0xb5eb0[_0x03cd('0x2f')]=_['intersection'](_0x12ec99['model'],qs[_0x03cd('0x30')](_0x13242a['query'][_0x03cd('0x30')]));_0xb5eb0[_0x03cd('0x2f')]=_0xb5eb0['attributes']['length']?_0xb5eb0[_0x03cd('0x2f')]:_0x12ec99[_0x03cd('0x2a')];if(!_0x13242a[_0x03cd('0x2b')][_0x03cd('0x31')]('nolimit')){_0xb5eb0[_0x03cd('0x1c')]=qs[_0x03cd('0x1c')](_0x13242a[_0x03cd('0x2b')][_0x03cd('0x1c')]);_0xb5eb0[_0x03cd('0x1a')]=qs[_0x03cd('0x1a')](_0x13242a['query'][_0x03cd('0x1a')]);}_0xb5eb0[_0x03cd('0x32')]=qs[_0x03cd('0x33')](_0x13242a['query'][_0x03cd('0x33')]);_0xb5eb0[_0x03cd('0x34')]=qs[_0x03cd('0x2d')](_[_0x03cd('0x35')](_0x13242a[_0x03cd('0x2b')],_0x12ec99[_0x03cd('0x2d')]),_0x49693c);if(_0x13242a[_0x03cd('0x2b')]['filter']){_0xb5eb0[_0x03cd('0x34')]=_[_0x03cd('0x36')](_0xb5eb0['where'],{'$or':_[_0x03cd('0x25')](_0x49693c,function(_0x43c266){if(_0x43c266[_0x03cd('0x28')]!==_0x03cd('0x37')){var _0x4f54f5={};_0x4f54f5[_0x43c266[_0x03cd('0x23')]]={'$like':'%'+_0x13242a[_0x03cd('0x2b')][_0x03cd('0x38')]+'%'};return _0x4f54f5;}})});}_0xb5eb0=_[_0x03cd('0x36')]({},_0xb5eb0,_0x13242a[_0x03cd('0x39')]);var _0x3be9c2={'where':_0xb5eb0[_0x03cd('0x34')]};return db[_0x03cd('0x26')]['count'](_0x3be9c2)['then'](function(_0x7a788e){_0x1d3309[_0x03cd('0x1d')]=_0x7a788e;if(_0x13242a[_0x03cd('0x2b')][_0x03cd('0x3a')]){_0xb5eb0[_0x03cd('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0x03cd('0x3c')](_0xb5eb0);})[_0x03cd('0x21')](function(_0x473e2f){_0x1d3309[_0x03cd('0x3d')]=_0x473e2f;return _0x1d3309;})[_0x03cd('0x21')](respondWithFilteredResult(_0x38117e,_0xb5eb0))[_0x03cd('0x3e')](handleError(_0x38117e,null));};exports[_0x03cd('0x3f')]=function(_0xb07f50,_0x36eb53){var _0x28e481={'raw':!![],'where':{'id':_0xb07f50[_0x03cd('0x40')]['id']}},_0x59de59={};_0x59de59[_0x03cd('0x2a')]=_[_0x03cd('0x2c')](db[_0x03cd('0x26')][_0x03cd('0x27')]);_0x59de59[_0x03cd('0x2b')]=_[_0x03cd('0x2c')](_0xb07f50['query']);_0x59de59['filters']=_[_0x03cd('0x2e')](_0x59de59[_0x03cd('0x2a')],_0x59de59[_0x03cd('0x2b')]);_0x28e481[_0x03cd('0x2f')]=_[_0x03cd('0x2e')](_0x59de59[_0x03cd('0x2a')],qs[_0x03cd('0x30')](_0xb07f50['query'][_0x03cd('0x30')]));_0x28e481[_0x03cd('0x2f')]=_0x28e481[_0x03cd('0x2f')][_0x03cd('0x41')]?_0x28e481[_0x03cd('0x2f')]:_0x59de59[_0x03cd('0x2a')];if(_0xb07f50['query']['includeAll']){_0x28e481['include']=[{'all':!![]}];}_0x28e481=_['merge']({},_0x28e481,_0xb07f50[_0x03cd('0x39')]);return db[_0x03cd('0x26')][_0x03cd('0x42')](_0x28e481)[_0x03cd('0x21')](handleEntityNotFound(_0x36eb53,null))[_0x03cd('0x21')](respondWithResult(_0x36eb53,null))[_0x03cd('0x3e')](handleError(_0x36eb53,null));};exports[_0x03cd('0x43')]=function(_0x318d87,_0x51f648){return db['SquareMessage'][_0x03cd('0x43')](_0x318d87[_0x03cd('0x44')],{})['then'](respondWithResult(_0x51f648,0xc9))['catch'](handleError(_0x51f648,null));};exports['update']=function(_0xbb7b57,_0x2e10c4){if(_0xbb7b57['body']['id']){delete _0xbb7b57[_0x03cd('0x44')]['id'];}return db[_0x03cd('0x26')][_0x03cd('0x42')]({'where':{'id':_0xbb7b57['params']['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x2e10c4,null))[_0x03cd('0x21')](saveUpdates(_0xbb7b57[_0x03cd('0x44')],null))[_0x03cd('0x21')](respondWithResult(_0x2e10c4,null))[_0x03cd('0x3e')](handleError(_0x2e10c4,null));};exports['destroy']=function(_0x27107b,_0x18d4fc){return db[_0x03cd('0x26')][_0x03cd('0x42')]({'where':{'id':_0x27107b[_0x03cd('0x40')]['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x18d4fc,null))[_0x03cd('0x21')](removeEntity(_0x18d4fc,null))['catch'](handleError(_0x18d4fc,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 954e99a..78d7cfb 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 _0xd596=['./squareMessage.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2ad0af,_0x52fd58){var _0x226a55=function(_0x29769e){while(--_0x29769e){_0x2ad0af['push'](_0x2ad0af['shift']());}};_0x226a55(++_0x52fd58);}(_0xd596,0xc1));var _0x6d59=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xd596[_0x30a31e];return _0x170879;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var logger=require(_0x6d59('0x2'))(_0x6d59('0x3'));var moment=require('moment');var BPromise=require(_0x6d59('0x4'));var rp=require(_0x6d59('0x5'));var fs=require('fs');var path=require(_0x6d59('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d59('0x7'));module[_0x6d59('0x8')]=function(_0x1707b4,_0x31f8fc){return _0x1707b4[_0x6d59('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1af3=['bluebird','request-promise','../../config/environment','./squareMessage.attributes','define','square_messages','lodash','util','../../config/logger','api'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x1af3,0xd8));var _0x31af=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x1af3[_0xe896bf];return _0x4c7a8a;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var logger=require(_0x31af('0x2'))(_0x31af('0x3'));var moment=require('moment');var BPromise=require(_0x31af('0x4'));var rp=require(_0x31af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31af('0x6'));var attributes=require(_0x31af('0x7'));module['exports']=function(_0x4a4d97,_0x300018){return _0x4a4d97[_0x31af('0x8')]('SquareMessage',attributes,{'tableName':_0x31af('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 d6bb7b3..9be277b 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 _0x1e9d=['rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareMessage','SquareMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x1e9d,0x190));var _0xd1e9=function(_0xe88ee9,_0x919d){_0xe88ee9=_0xe88ee9-0x0;var _0x118922=_0x1e9d[_0xe88ee9];return _0x118922;};'use strict';var _=require(_0xd1e9('0x0'));var util=require(_0xd1e9('0x1'));var moment=require(_0xd1e9('0x2'));var BPromise=require(_0xd1e9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1e9('0x4'));var db=require(_0xd1e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1e9('0x6'));var config=require(_0xd1e9('0x7'));var jayson=require(_0xd1e9('0x8'));var client=jayson[_0xd1e9('0x9')][_0xd1e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a57cf,_0x5c356a,_0x56de96){return new BPromise(function(_0x5de7f3,_0x44a69a){return client[_0xd1e9('0xb')](_0x4a57cf,_0x56de96)['then'](function(_0x555980){logger[_0xd1e9('0xc')](_0xd1e9('0xd'),_0x5c356a,_0xd1e9('0xe'));logger[_0xd1e9('0xf')](_0xd1e9('0x10'),_0x5c356a,'request\x20sent',JSON[_0xd1e9('0x11')](_0x555980));if(_0x555980[_0xd1e9('0x12')]){if(_0x555980[_0xd1e9('0x12')][_0xd1e9('0x13')]===0x1f4){logger[_0xd1e9('0x12')](_0xd1e9('0xd'),_0x5c356a,_0x555980[_0xd1e9('0x12')][_0xd1e9('0x14')]);return _0x44a69a(_0x555980[_0xd1e9('0x12')]['message']);}logger['error'](_0xd1e9('0xd'),_0x5c356a,_0x555980[_0xd1e9('0x12')][_0xd1e9('0x14')]);return _0x5de7f3(_0x555980[_0xd1e9('0x12')][_0xd1e9('0x14')]);}else{logger[_0xd1e9('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5c356a,_0xd1e9('0xe'));_0x5de7f3(_0x555980['result'][_0xd1e9('0x14')]);}})['catch'](function(_0xd1f86a){logger[_0xd1e9('0x12')](_0xd1e9('0xd'),_0x5c356a,_0xd1f86a);_0x44a69a(_0xd1f86a);});});}exports[_0xd1e9('0x15')]=function(_0x447e05){var _0x53443c=this;return new Promise(function(_0x3b2cfa,_0xb56ab0){return db[_0xd1e9('0x16')][_0xd1e9('0x17')](_0x447e05[_0xd1e9('0x18')],{'raw':_0x447e05[_0xd1e9('0x19')]?_0x447e05[_0xd1e9('0x19')][_0xd1e9('0x1a')]===undefined?!![]:![]:!![]})[_0xd1e9('0x1b')](function(_0x2818eb){logger[_0xd1e9('0xc')](_0xd1e9('0x15'),_0x447e05);logger[_0xd1e9('0xf')](_0xd1e9('0x15'),_0x447e05,JSON[_0xd1e9('0x11')](_0x2818eb));_0x3b2cfa(_0x2818eb);})[_0xd1e9('0x1c')](function(_0x1fb961){logger[_0xd1e9('0x12')]('CreateSquareMessage',_0x1fb961[_0xd1e9('0x14')],_0x447e05);_0xb56ab0(_0x53443c[_0xd1e9('0x12')](0x1f4,_0x1fb961['message']));});});}; \ No newline at end of file +var _0x8224=['create','body','options','raw','debug','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x302576,_0x3c76d2){var _0x16e985=function(_0x579607){while(--_0x579607){_0x302576['push'](_0x302576['shift']());}};_0x16e985(++_0x3c76d2);}(_0x8224,0x164));var _0x4822=function(_0x1b870e,_0x1038ef){_0x1b870e=_0x1b870e-0x0;var _0x392dfc=_0x8224[_0x1b870e];return _0x392dfc;};'use strict';var _=require('lodash');var util=require(_0x4822('0x0'));var moment=require('moment');var BPromise=require(_0x4822('0x1'));var rs=require(_0x4822('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4822('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4822('0x4'))(_0x4822('0x5'));var config=require(_0x4822('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4822('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d6075,_0x49d2f,_0x3822de){return new BPromise(function(_0x5be4dd,_0x31edf3){return client[_0x4822('0x8')](_0x3d6075,_0x3822de)[_0x4822('0x9')](function(_0x812d5f){logger['info'](_0x4822('0xa'),_0x49d2f,'request\x20sent');logger['debug'](_0x4822('0xb'),_0x49d2f,_0x4822('0xc'),JSON[_0x4822('0xd')](_0x812d5f));if(_0x812d5f[_0x4822('0xe')]){if(_0x812d5f[_0x4822('0xe')][_0x4822('0xf')]===0x1f4){logger[_0x4822('0xe')]('SquareMessage,\x20%s,\x20%s',_0x49d2f,_0x812d5f[_0x4822('0xe')]['message']);return _0x31edf3(_0x812d5f['error'][_0x4822('0x10')]);}logger['error'](_0x4822('0xa'),_0x49d2f,_0x812d5f[_0x4822('0xe')]['message']);return _0x5be4dd(_0x812d5f[_0x4822('0xe')][_0x4822('0x10')]);}else{logger[_0x4822('0x11')](_0x4822('0xa'),_0x49d2f,_0x4822('0xc'));_0x5be4dd(_0x812d5f[_0x4822('0x12')][_0x4822('0x10')]);}})[_0x4822('0x13')](function(_0x40b2eb){logger['error'](_0x4822('0xa'),_0x49d2f,_0x40b2eb);_0x31edf3(_0x40b2eb);});});}exports[_0x4822('0x14')]=function(_0x504aed){var _0xfea72e=this;return new Promise(function(_0x3d1e79,_0x41521f){return db[_0x4822('0x15')][_0x4822('0x16')](_0x504aed[_0x4822('0x17')],{'raw':_0x504aed[_0x4822('0x18')]?_0x504aed[_0x4822('0x18')][_0x4822('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x32029){logger['info'](_0x4822('0x14'),_0x504aed);logger[_0x4822('0x1a')](_0x4822('0x14'),_0x504aed,JSON['stringify'](_0x32029));_0x3d1e79(_0x32029);})['catch'](function(_0x48b0a3){logger[_0x4822('0xe')](_0x4822('0x14'),_0x48b0a3[_0x4822('0x10')],_0x504aed);_0x41521f(_0xfea72e[_0x4822('0xe')](0x1f4,_0x48b0a3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 3a68fa7..f2b1a76 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 _0xf596=['put','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post'];(function(_0x588c5f,_0x5e6c75){var _0xe23d5b=function(_0x1c24f7){while(--_0x1c24f7){_0x588c5f['push'](_0x588c5f['shift']());}};_0xe23d5b(++_0x5e6c75);}(_0xf596,0x92));var _0x6f59=function(_0x4ca08f,_0x1a1da9){_0x4ca08f=_0x4ca08f-0x0;var _0x48fa19=_0xf596[_0x4ca08f];return _0x48fa19;};'use strict';var multer=require('multer');var util=require(_0x6f59('0x0'));var path=require(_0x6f59('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f59('0x2'));var router=express['Router']();var fs_extra=require(_0x6f59('0x3'));var auth=require(_0x6f59('0x4'));var interaction=require(_0x6f59('0x5'));var config=require(_0x6f59('0x6'));var controller=require(_0x6f59('0x7'));router[_0x6f59('0x8')]('/',auth[_0x6f59('0x9')](),controller[_0x6f59('0xa')]);router[_0x6f59('0x8')](_0x6f59('0xb'),auth[_0x6f59('0x9')](),controller[_0x6f59('0xc')]);router[_0x6f59('0x8')](_0x6f59('0xd'),auth[_0x6f59('0x9')](),timeout('15s'),controller[_0x6f59('0xe')]);router[_0x6f59('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6f59('0x10')](_0x6f59('0xb'),auth[_0x6f59('0x9')](),controller['update']);router['delete'](_0x6f59('0xb'),auth[_0x6f59('0x9')](),controller[_0x6f59('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa89e=['show','15s','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x2fa5e9,_0x23ff57){var _0x4f78db=function(_0x17cf56){while(--_0x17cf56){_0x2fa5e9['push'](_0x2fa5e9['shift']());}};_0x4f78db(++_0x23ff57);}(_0xa89e,0x15d));var _0xea89=function(_0x2150cb,_0x4f0a46){_0x2150cb=_0x2150cb-0x0;var _0x2ed67=_0xa89e[_0x2150cb];return _0x2ed67;};'use strict';var multer=require('multer');var util=require(_0xea89('0x0'));var path=require(_0xea89('0x1'));var timeout=require(_0xea89('0x2'));var express=require(_0xea89('0x3'));var router=express['Router']();var fs_extra=require(_0xea89('0x4'));var auth=require(_0xea89('0x5'));var interaction=require(_0xea89('0x6'));var config=require('../../config/environment');var controller=require(_0xea89('0x7'));router[_0xea89('0x8')]('/',auth[_0xea89('0x9')](),controller[_0xea89('0xa')]);router[_0xea89('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xea89('0xb')]);router[_0xea89('0x8')]('/:id/test',auth[_0xea89('0x9')](),timeout(_0xea89('0xc')),controller['test']);router[_0xea89('0xd')]('/',auth['isAuthenticated'](),controller[_0xea89('0xe')]);router[_0xea89('0xf')]('/:id',auth[_0xea89('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xea89('0x10')]);module[_0xea89('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 c88869f..486d213 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 _0x70d7=['exports','STRING','sequelize'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x70d7,0xfe));var _0x770d=function(_0x49327d,_0x4a484b){_0x49327d=_0x49327d-0x0;var _0x4f2c09=_0x70d7[_0x49327d];return _0x4f2c09;};'use strict';var Sequelize=require(_0x770d('0x0'));module[_0x770d('0x1')]={'name':{'type':Sequelize[_0x770d('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x770d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x50a1=['sequelize'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x50a1,0x163));var _0x150a=function(_0x28092d,_0x8263ab){_0x28092d=_0x28092d-0x0;var _0x53b2e1=_0x50a1[_0x28092d];return _0x53b2e1;};'use strict';var Sequelize=require(_0x150a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 683a32f..1e9f754 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 _0xadc0=['UserProfileResource','stack','name','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','include','findAll','rows','catch','keys','includeAll','create','body','user','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','closeSync','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','ODBC'];(function(_0x571f9b,_0x335971){var _0x3418a1=function(_0x427177){while(--_0x427177){_0x571f9b['push'](_0x571f9b['shift']());}};_0x3418a1(++_0x335971);}(_0xadc0,0x1bc));var _0x0adc=function(_0x5e68c5,_0x494261){_0x5e68c5=_0x5e68c5-0x0;var _0x309549=_0xadc0[_0x5e68c5];return _0x309549;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0adc('0x0'));var rp=require(_0x0adc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0adc('0x2'));var util=require(_0x0adc('0x3'));var path=require(_0x0adc('0x4'));var sox=require('sox');var csv=require(_0x0adc('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0adc('0x6'));var _=require(_0x0adc('0x7'));var squel=require(_0x0adc('0x8'));var crypto=require('crypto');var jsforce=require(_0x0adc('0x9'));var deskjs=require(_0x0adc('0xa'));var toCsv=require(_0x0adc('0x5'));var querystring=require(_0x0adc('0xb'));var Papa=require(_0x0adc('0xc'));var Redis=require(_0x0adc('0xd'));var authService=require(_0x0adc('0xe'));var qs=require(_0x0adc('0xf'));var as=require(_0x0adc('0x10'));var hardwareService=require(_0x0adc('0x11'));var logger=require(_0x0adc('0x12'))(_0x0adc('0x13'));var utils=require(_0x0adc('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0adc('0x15'))['db'];function respondWithStatusCode(_0x58be9d,_0x277492){_0x277492=_0x277492||0xcc;return function(_0x5c161c){if(_0x5c161c){return _0x58be9d['sendStatus'](_0x277492);}return _0x58be9d[_0x0adc('0x16')](_0x277492)[_0x0adc('0x17')]();};}function respondWithResult(_0x3ff09a,_0x5c8a3e){_0x5c8a3e=_0x5c8a3e||0xc8;return function(_0x14f401){if(_0x14f401){return _0x3ff09a[_0x0adc('0x16')](_0x5c8a3e)[_0x0adc('0x18')](_0x14f401);}};}function respondWithFilteredResult(_0x663f29,_0x480daa){return function(_0x2b7a7f){if(_0x2b7a7f){var _0x36fa46=typeof _0x480daa[_0x0adc('0x19')]===_0x0adc('0x1a')&&typeof _0x480daa[_0x0adc('0x1b')]==='undefined';var _0x3027a2=_0x2b7a7f[_0x0adc('0x1c')];var _0x4f51cd=_0x36fa46?0x0:_0x480daa[_0x0adc('0x19')];var _0x21a6d1=_0x36fa46?_0x2b7a7f[_0x0adc('0x1c')]:_0x480daa[_0x0adc('0x19')]+_0x480daa[_0x0adc('0x1b')];var _0x4ce6d4;if(_0x21a6d1>=_0x3027a2){_0x21a6d1=_0x3027a2;_0x4ce6d4=0xc8;}else{_0x4ce6d4=0xce;}_0x663f29['status'](_0x4ce6d4);return _0x663f29[_0x0adc('0x1d')](_0x0adc('0x1e'),_0x4f51cd+'-'+_0x21a6d1+'/'+_0x3027a2)[_0x0adc('0x18')](_0x2b7a7f);}return null;};}function patchUpdates(_0x1e68af){return function(_0x28f902){try{jsonpatch[_0x0adc('0x1f')](_0x28f902,_0x1e68af,!![]);}catch(_0x1bb5cd){return BPromise['reject'](_0x1bb5cd);}return _0x28f902['save']();};}function saveUpdates(_0x59ab72,_0x446ff6){return function(_0x5d4c3e){if(_0x5d4c3e){return _0x5d4c3e[_0x0adc('0x20')](_0x59ab72)[_0x0adc('0x21')](function(_0x2cb248){return _0x2cb248;});}return null;};}function removeEntity(_0x1d8101,_0x24457e){return function(_0x51f6ac){if(_0x51f6ac){return _0x51f6ac[_0x0adc('0x22')]()['then'](function(){var _0x2634b8=_0x51f6ac['get']({'plain':!![]});var _0x9d1e13=_0x0adc('0x23');return db[_0x0adc('0x24')]['destroy']({'where':{'type':_0x9d1e13,'resourceId':_0x2634b8['id']}})[_0x0adc('0x21')](function(){return _0x51f6ac;});})[_0x0adc('0x21')](function(){_0x1d8101[_0x0adc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27d8a3,_0x24545e){return function(_0x4be6af){if(!_0x4be6af){_0x27d8a3['sendStatus'](0x194);}return _0x4be6af;};}function handleError(_0xbb4fb8,_0x5773d9){_0x5773d9=_0x5773d9||0x1f4;return function(_0xc342b3){logger['error'](_0xc342b3[_0x0adc('0x25')]);if(_0xc342b3[_0x0adc('0x26')]){delete _0xc342b3['name'];}_0xbb4fb8[_0x0adc('0x16')](_0x5773d9)['send'](_0xc342b3);};}exports['index']=function(_0x2c2dcd,_0xa7685e){var _0x5b2209={},_0x23d8ad={},_0x52fd5b={'count':0x0,'rows':[]};var _0x2f3065=_[_0x0adc('0x27')](db['SquareOdbc'][_0x0adc('0x28')],function(_0x4586bb){return{'name':_0x4586bb[_0x0adc('0x29')],'type':_0x4586bb[_0x0adc('0x2a')][_0x0adc('0x2b')]};});_0x23d8ad[_0x0adc('0x2c')]=_[_0x0adc('0x27')](_0x2f3065,'name');_0x23d8ad['query']=_['keys'](_0x2c2dcd['query']);_0x23d8ad[_0x0adc('0x2d')]=_[_0x0adc('0x2e')](_0x23d8ad[_0x0adc('0x2c')],_0x23d8ad['query']);_0x5b2209['attributes']=_[_0x0adc('0x2e')](_0x23d8ad[_0x0adc('0x2c')],qs['fields'](_0x2c2dcd[_0x0adc('0x2f')][_0x0adc('0x30')]));_0x5b2209[_0x0adc('0x31')]=_0x5b2209['attributes'][_0x0adc('0x32')]?_0x5b2209[_0x0adc('0x31')]:_0x23d8ad[_0x0adc('0x2c')];if(!_0x2c2dcd[_0x0adc('0x2f')]['hasOwnProperty'](_0x0adc('0x33'))){_0x5b2209[_0x0adc('0x1b')]=qs[_0x0adc('0x1b')](_0x2c2dcd[_0x0adc('0x2f')][_0x0adc('0x1b')]);_0x5b2209['offset']=qs[_0x0adc('0x19')](_0x2c2dcd[_0x0adc('0x2f')]['offset']);}_0x5b2209[_0x0adc('0x34')]=qs[_0x0adc('0x35')](_0x2c2dcd[_0x0adc('0x2f')][_0x0adc('0x35')]);_0x5b2209[_0x0adc('0x36')]=qs['filters'](_[_0x0adc('0x37')](_0x2c2dcd[_0x0adc('0x2f')],_0x23d8ad['filters']),_0x2f3065);if(_0x2c2dcd[_0x0adc('0x2f')][_0x0adc('0x38')]){_0x5b2209['where']=_[_0x0adc('0x39')](_0x5b2209['where'],{'$or':_['map'](_0x2f3065,function(_0x29bcce){if(_0x29bcce[_0x0adc('0x2a')]!==_0x0adc('0x3a')){var _0x56af26={};_0x56af26[_0x29bcce[_0x0adc('0x26')]]={'$like':'%'+_0x2c2dcd[_0x0adc('0x2f')]['filter']+'%'};return _0x56af26;}})});}_0x5b2209=_['merge']({},_0x5b2209,_0x2c2dcd[_0x0adc('0x3b')]);var _0x2bf421={'where':_0x5b2209[_0x0adc('0x36')]};return db[_0x0adc('0x3c')][_0x0adc('0x1c')](_0x2bf421)['then'](function(_0x2e9b21){_0x52fd5b[_0x0adc('0x1c')]=_0x2e9b21;if(_0x2c2dcd[_0x0adc('0x2f')]['includeAll']){_0x5b2209[_0x0adc('0x3d')]=[{'all':!![]}];}return db[_0x0adc('0x3c')][_0x0adc('0x3e')](_0x5b2209);})[_0x0adc('0x21')](function(_0x1e261c){_0x52fd5b[_0x0adc('0x3f')]=_0x1e261c;return _0x52fd5b;})['then'](respondWithFilteredResult(_0xa7685e,_0x5b2209))[_0x0adc('0x40')](handleError(_0xa7685e,null));};exports['show']=function(_0x28f148,_0x2c7d7e){var _0x1de6ba={'raw':!![],'where':{'id':_0x28f148['params']['id']}},_0x508655={};_0x508655[_0x0adc('0x2c')]=_[_0x0adc('0x41')](db['SquareOdbc'][_0x0adc('0x28')]);_0x508655[_0x0adc('0x2f')]=_[_0x0adc('0x41')](_0x28f148['query']);_0x508655[_0x0adc('0x2d')]=_[_0x0adc('0x2e')](_0x508655[_0x0adc('0x2c')],_0x508655[_0x0adc('0x2f')]);_0x1de6ba[_0x0adc('0x31')]=_['intersection'](_0x508655['model'],qs[_0x0adc('0x30')](_0x28f148[_0x0adc('0x2f')][_0x0adc('0x30')]));_0x1de6ba['attributes']=_0x1de6ba[_0x0adc('0x31')]['length']?_0x1de6ba['attributes']:_0x508655[_0x0adc('0x2c')];if(_0x28f148[_0x0adc('0x2f')][_0x0adc('0x42')]){_0x1de6ba[_0x0adc('0x3d')]=[{'all':!![]}];}_0x1de6ba=_['merge']({},_0x1de6ba,_0x28f148[_0x0adc('0x3b')]);return db[_0x0adc('0x3c')]['find'](_0x1de6ba)[_0x0adc('0x21')](handleEntityNotFound(_0x2c7d7e,null))[_0x0adc('0x21')](respondWithResult(_0x2c7d7e,null))[_0x0adc('0x40')](handleError(_0x2c7d7e,null));};exports[_0x0adc('0x43')]=function(_0x4bfdca,_0x62e264){return db[_0x0adc('0x3c')]['create'](_0x4bfdca[_0x0adc('0x44')],{})['then'](function(_0x15085b){var _0x4ac607=_0x4bfdca[_0x0adc('0x45')][_0x0adc('0x46')]({'plain':!![]});if(!_0x4ac607)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ac607['role']==='user'){var _0x2a0504=_0x15085b[_0x0adc('0x46')]({'plain':!![]});var _0x174667='ODBC';return db[_0x0adc('0x47')][_0x0adc('0x48')]({'where':{'name':_0x174667,'userProfileId':_0x4ac607[_0x0adc('0x49')]},'raw':!![]})[_0x0adc('0x21')](function(_0x4c2b45){if(_0x4c2b45&&_0x4c2b45['autoAssociation']===0x0){return db[_0x0adc('0x24')][_0x0adc('0x43')]({'name':_0x2a0504[_0x0adc('0x26')],'resourceId':_0x2a0504['id'],'type':_0x4c2b45['name'],'sectionId':_0x4c2b45['id']},{})[_0x0adc('0x21')](function(){return _0x15085b;});}else{return _0x15085b;}})[_0x0adc('0x40')](function(_0x50ac04){logger['error'](_0x0adc('0x4a'),_0x50ac04);throw _0x50ac04;});}return _0x15085b;})[_0x0adc('0x21')](respondWithResult(_0x62e264,0xc9))[_0x0adc('0x40')](handleError(_0x62e264,null));};exports[_0x0adc('0x20')]=function(_0x373794,_0x15e0f0){if(_0x373794[_0x0adc('0x44')]['id']){delete _0x373794['body']['id'];}return db[_0x0adc('0x3c')][_0x0adc('0x48')]({'where':{'id':_0x373794[_0x0adc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15e0f0,null))['then'](saveUpdates(_0x373794['body'],null))[_0x0adc('0x21')](respondWithResult(_0x15e0f0,null))[_0x0adc('0x40')](handleError(_0x15e0f0,null));};exports[_0x0adc('0x22')]=function(_0x622688,_0x59b630){return db[_0x0adc('0x3c')][_0x0adc('0x48')]({'where':{'id':_0x622688['params']['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x59b630,null))[_0x0adc('0x21')](removeEntity(_0x59b630,null))['catch'](handleError(_0x59b630,null));};exports[_0x0adc('0x4c')]=function(_0x26c7cb,_0x9a79fd,_0x50e7c7){var _0x222060;return db[_0x0adc('0x3c')]['find']({'where':{'id':_0x26c7cb[_0x0adc('0x4b')]['id']},'attributes':['id',_0x0adc('0x4d')]})['then'](handleEntityNotFound(_0x9a79fd,null))[_0x0adc('0x21')](function(_0x22cf0e){if(_0x22cf0e){var _0xf2cca0=require(_0x0adc('0x4e'))();_0xf2cca0['openSync'](_0x22cf0e['dsn']);_0xf2cca0[_0x0adc('0x4f')]();return _0x22cf0e;}})[_0x0adc('0x21')](respondWithResult(_0x9a79fd,null))[_0x0adc('0x40')](handleError(_0x9a79fd,null));}; \ No newline at end of file +var _0xc1c5=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','length','options','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','get','ODBC','UserProfileResource','destroy','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter'];(function(_0x4e54e9,_0x40a2b7){var _0x32be8f=function(_0x5d91b3){while(--_0x5d91b3){_0x4e54e9['push'](_0x4e54e9['shift']());}};_0x32be8f(++_0x40a2b7);}(_0xc1c5,0x125));var _0x5c1c=function(_0x165d8,_0x4a2b9c){_0x165d8=_0x165d8-0x0;var _0x1c831a=_0xc1c5[_0x165d8];return _0x1c831a;};'use strict';var emlformat=require(_0x5c1c('0x0'));var rimraf=require(_0x5c1c('0x1'));var zipdir=require(_0x5c1c('0x2'));var jsonpatch=require(_0x5c1c('0x3'));var rp=require(_0x5c1c('0x4'));var moment=require(_0x5c1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c1c('0x6'));var util=require(_0x5c1c('0x7'));var path=require('path');var sox=require(_0x5c1c('0x8'));var csv=require(_0x5c1c('0x9'));var ejs=require(_0x5c1c('0xa'));var fs=require('fs');var fs_extra=require(_0x5c1c('0xb'));var _=require(_0x5c1c('0xc'));var squel=require(_0x5c1c('0xd'));var crypto=require(_0x5c1c('0xe'));var jsforce=require(_0x5c1c('0xf'));var deskjs=require(_0x5c1c('0x10'));var toCsv=require(_0x5c1c('0x9'));var querystring=require(_0x5c1c('0x11'));var Papa=require(_0x5c1c('0x12'));var Redis=require('ioredis');var authService=require(_0x5c1c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c1c('0x14'));var logger=require(_0x5c1c('0x15'))(_0x5c1c('0x16'));var utils=require(_0x5c1c('0x17'));var config=require(_0x5c1c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c1c('0x19'))['db'];function respondWithStatusCode(_0x5e4768,_0x45ba36){_0x45ba36=_0x45ba36||0xcc;return function(_0x3df6d1){if(_0x3df6d1){return _0x5e4768[_0x5c1c('0x1a')](_0x45ba36);}return _0x5e4768[_0x5c1c('0x1b')](_0x45ba36)[_0x5c1c('0x1c')]();};}function respondWithResult(_0x329071,_0x19f71b){_0x19f71b=_0x19f71b||0xc8;return function(_0x5d7733){if(_0x5d7733){return _0x329071[_0x5c1c('0x1b')](_0x19f71b)[_0x5c1c('0x1d')](_0x5d7733);}};}function respondWithFilteredResult(_0x255cc9,_0x2ba795){return function(_0x5629ea){if(_0x5629ea){var _0xd71bce=typeof _0x2ba795[_0x5c1c('0x1e')]===_0x5c1c('0x1f')&&typeof _0x2ba795['limit']===_0x5c1c('0x1f');var _0x372c67=_0x5629ea[_0x5c1c('0x20')];var _0x4531c3=_0xd71bce?0x0:_0x2ba795[_0x5c1c('0x1e')];var _0x5f062d=_0xd71bce?_0x5629ea[_0x5c1c('0x20')]:_0x2ba795[_0x5c1c('0x1e')]+_0x2ba795['limit'];var _0x401232;if(_0x5f062d>=_0x372c67){_0x5f062d=_0x372c67;_0x401232=0xc8;}else{_0x401232=0xce;}_0x255cc9[_0x5c1c('0x1b')](_0x401232);return _0x255cc9['set'](_0x5c1c('0x21'),_0x4531c3+'-'+_0x5f062d+'/'+_0x372c67)[_0x5c1c('0x1d')](_0x5629ea);}return null;};}function patchUpdates(_0x324835){return function(_0x2c1ec6){try{jsonpatch[_0x5c1c('0x22')](_0x2c1ec6,_0x324835,!![]);}catch(_0x170f97){return BPromise[_0x5c1c('0x23')](_0x170f97);}return _0x2c1ec6[_0x5c1c('0x24')]();};}function saveUpdates(_0x7d0abc,_0x4fdf6d){return function(_0xd5ae75){if(_0xd5ae75){return _0xd5ae75[_0x5c1c('0x25')](_0x7d0abc)[_0x5c1c('0x26')](function(_0x57cbce){return _0x57cbce;});}return null;};}function removeEntity(_0x51ac8f,_0x4bb545){return function(_0x186f08){if(_0x186f08){return _0x186f08['destroy']()[_0x5c1c('0x26')](function(){var _0x585e20=_0x186f08[_0x5c1c('0x27')]({'plain':!![]});var _0x3e798d=_0x5c1c('0x28');return db[_0x5c1c('0x29')][_0x5c1c('0x2a')]({'where':{'type':_0x3e798d,'resourceId':_0x585e20['id']}})[_0x5c1c('0x26')](function(){return _0x186f08;});})[_0x5c1c('0x26')](function(){_0x51ac8f[_0x5c1c('0x1b')](0xcc)[_0x5c1c('0x1c')]();});}};}function handleEntityNotFound(_0x390c72,_0x4323d9){return function(_0x3cc157){if(!_0x3cc157){_0x390c72['sendStatus'](0x194);}return _0x3cc157;};}function handleError(_0x440eb2,_0x5324dd){_0x5324dd=_0x5324dd||0x1f4;return function(_0x4f809d){logger[_0x5c1c('0x2b')](_0x4f809d[_0x5c1c('0x2c')]);if(_0x4f809d[_0x5c1c('0x2d')]){delete _0x4f809d[_0x5c1c('0x2d')];}_0x440eb2[_0x5c1c('0x1b')](_0x5324dd)[_0x5c1c('0x2e')](_0x4f809d);};}exports['index']=function(_0x4f88c7,_0x2b743e){var _0x3b7057={},_0x5c1d32={},_0x167998={'count':0x0,'rows':[]};var _0x4a5308=_['map'](db[_0x5c1c('0x2f')][_0x5c1c('0x30')],function(_0x5338db){return{'name':_0x5338db[_0x5c1c('0x31')],'type':_0x5338db[_0x5c1c('0x32')][_0x5c1c('0x33')]};});_0x5c1d32[_0x5c1c('0x34')]=_[_0x5c1c('0x35')](_0x4a5308,_0x5c1c('0x2d'));_0x5c1d32['query']=_[_0x5c1c('0x36')](_0x4f88c7[_0x5c1c('0x37')]);_0x5c1d32[_0x5c1c('0x38')]=_[_0x5c1c('0x39')](_0x5c1d32[_0x5c1c('0x34')],_0x5c1d32['query']);_0x3b7057[_0x5c1c('0x3a')]=_[_0x5c1c('0x39')](_0x5c1d32[_0x5c1c('0x34')],qs[_0x5c1c('0x3b')](_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x3b')]));_0x3b7057[_0x5c1c('0x3a')]=_0x3b7057[_0x5c1c('0x3a')]['length']?_0x3b7057[_0x5c1c('0x3a')]:_0x5c1d32[_0x5c1c('0x34')];if(!_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x3c')](_0x5c1c('0x3d'))){_0x3b7057[_0x5c1c('0x3e')]=qs[_0x5c1c('0x3e')](_0x4f88c7['query'][_0x5c1c('0x3e')]);_0x3b7057['offset']=qs[_0x5c1c('0x1e')](_0x4f88c7['query'][_0x5c1c('0x1e')]);}_0x3b7057[_0x5c1c('0x3f')]=qs[_0x5c1c('0x40')](_0x4f88c7['query'][_0x5c1c('0x40')]);_0x3b7057['where']=qs[_0x5c1c('0x38')](_[_0x5c1c('0x41')](_0x4f88c7[_0x5c1c('0x37')],_0x5c1d32[_0x5c1c('0x38')]),_0x4a5308);if(_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x42')]){_0x3b7057[_0x5c1c('0x43')]=_[_0x5c1c('0x44')](_0x3b7057['where'],{'$or':_['map'](_0x4a5308,function(_0x3a60dc){if(_0x3a60dc['type']!==_0x5c1c('0x45')){var _0x292a5c={};_0x292a5c[_0x3a60dc['name']]={'$like':'%'+_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x42')]+'%'};return _0x292a5c;}})});}_0x3b7057=_[_0x5c1c('0x44')]({},_0x3b7057,_0x4f88c7['options']);var _0x3e0e9e={'where':_0x3b7057[_0x5c1c('0x43')]};return db[_0x5c1c('0x2f')][_0x5c1c('0x20')](_0x3e0e9e)['then'](function(_0x1f14b0){_0x167998['count']=_0x1f14b0;if(_0x4f88c7[_0x5c1c('0x37')][_0x5c1c('0x46')]){_0x3b7057['include']=[{'all':!![]}];}return db[_0x5c1c('0x2f')][_0x5c1c('0x47')](_0x3b7057);})[_0x5c1c('0x26')](function(_0x429909){_0x167998[_0x5c1c('0x48')]=_0x429909;return _0x167998;})[_0x5c1c('0x26')](respondWithFilteredResult(_0x2b743e,_0x3b7057))[_0x5c1c('0x49')](handleError(_0x2b743e,null));};exports['show']=function(_0x153589,_0x98482a){var _0x430c4d={'raw':!![],'where':{'id':_0x153589[_0x5c1c('0x4a')]['id']}},_0x166f46={};_0x166f46[_0x5c1c('0x34')]=_[_0x5c1c('0x36')](db[_0x5c1c('0x2f')]['rawAttributes']);_0x166f46[_0x5c1c('0x37')]=_[_0x5c1c('0x36')](_0x153589[_0x5c1c('0x37')]);_0x166f46[_0x5c1c('0x38')]=_[_0x5c1c('0x39')](_0x166f46[_0x5c1c('0x34')],_0x166f46[_0x5c1c('0x37')]);_0x430c4d[_0x5c1c('0x3a')]=_[_0x5c1c('0x39')](_0x166f46[_0x5c1c('0x34')],qs[_0x5c1c('0x3b')](_0x153589['query'][_0x5c1c('0x3b')]));_0x430c4d[_0x5c1c('0x3a')]=_0x430c4d['attributes'][_0x5c1c('0x4b')]?_0x430c4d[_0x5c1c('0x3a')]:_0x166f46['model'];if(_0x153589['query'][_0x5c1c('0x46')]){_0x430c4d['include']=[{'all':!![]}];}_0x430c4d=_[_0x5c1c('0x44')]({},_0x430c4d,_0x153589[_0x5c1c('0x4c')]);return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')](_0x430c4d)['then'](handleEntityNotFound(_0x98482a,null))['then'](respondWithResult(_0x98482a,null))[_0x5c1c('0x49')](handleError(_0x98482a,null));};exports['create']=function(_0x17eb7b,_0x1c8946){return db['SquareOdbc']['create'](_0x17eb7b[_0x5c1c('0x4e')],{})[_0x5c1c('0x26')](function(_0x3f7195){var _0x9680f1=_0x17eb7b[_0x5c1c('0x4f')][_0x5c1c('0x27')]({'plain':!![]});if(!_0x9680f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9680f1[_0x5c1c('0x50')]===_0x5c1c('0x4f')){var _0x2e3af4=_0x3f7195[_0x5c1c('0x27')]({'plain':!![]});var _0x50f9a2=_0x5c1c('0x28');return db[_0x5c1c('0x51')]['find']({'where':{'name':_0x50f9a2,'userProfileId':_0x9680f1[_0x5c1c('0x52')]},'raw':!![]})['then'](function(_0x307fed){if(_0x307fed&&_0x307fed[_0x5c1c('0x53')]===0x0){return db[_0x5c1c('0x29')]['create']({'name':_0x2e3af4['name'],'resourceId':_0x2e3af4['id'],'type':_0x307fed[_0x5c1c('0x2d')],'sectionId':_0x307fed['id']},{})[_0x5c1c('0x26')](function(){return _0x3f7195;});}else{return _0x3f7195;}})[_0x5c1c('0x49')](function(_0x483555){logger[_0x5c1c('0x2b')](_0x5c1c('0x54'),_0x483555);throw _0x483555;});}return _0x3f7195;})['then'](respondWithResult(_0x1c8946,0xc9))[_0x5c1c('0x49')](handleError(_0x1c8946,null));};exports[_0x5c1c('0x25')]=function(_0x5719d7,_0xaf38c5){if(_0x5719d7['body']['id']){delete _0x5719d7[_0x5c1c('0x4e')]['id'];}return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')]({'where':{'id':_0x5719d7[_0x5c1c('0x4a')]['id']}})[_0x5c1c('0x26')](handleEntityNotFound(_0xaf38c5,null))[_0x5c1c('0x26')](saveUpdates(_0x5719d7[_0x5c1c('0x4e')],null))[_0x5c1c('0x26')](respondWithResult(_0xaf38c5,null))[_0x5c1c('0x49')](handleError(_0xaf38c5,null));};exports[_0x5c1c('0x2a')]=function(_0x2bd7f9,_0x3acc6e){return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')]({'where':{'id':_0x2bd7f9[_0x5c1c('0x4a')]['id']}})[_0x5c1c('0x26')](handleEntityNotFound(_0x3acc6e,null))[_0x5c1c('0x26')](removeEntity(_0x3acc6e,null))[_0x5c1c('0x49')](handleError(_0x3acc6e,null));};exports[_0x5c1c('0x55')]=function(_0x5cf278,_0x328d18,_0x4d9cc8){var _0x36ce2f;return db[_0x5c1c('0x2f')][_0x5c1c('0x4d')]({'where':{'id':_0x5cf278[_0x5c1c('0x4a')]['id']},'attributes':['id',_0x5c1c('0x56')]})[_0x5c1c('0x26')](handleEntityNotFound(_0x328d18,null))[_0x5c1c('0x26')](function(_0x5d10b8){if(_0x5d10b8){var _0x17eb16=require(_0x5c1c('0x57'))();_0x17eb16[_0x5c1c('0x58')](_0x5d10b8[_0x5c1c('0x56')]);_0x17eb16[_0x5c1c('0x59')]();return _0x5d10b8;}})[_0x5c1c('0x26')](respondWithResult(_0x328d18,null))[_0x5c1c('0x49')](handleError(_0x328d18,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d7d60b5..14383be 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 _0xec9e=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec9e,0x102));var _0xeec9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec9e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xeec9('0x0'));var util=require('util');var logger=require(_0xeec9('0x1'))(_0xeec9('0x2'));var moment=require(_0xeec9('0x3'));var BPromise=require('bluebird');var rp=require(_0xeec9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeec9('0x5'));var config=require(_0xeec9('0x6'));var attributes=require(_0xeec9('0x7'));module[_0xeec9('0x8')]=function(_0x4bcfa7,_0x4accdf){return _0x4bcfa7[_0xeec9('0x9')](_0xeec9('0xa'),attributes,{'tableName':_0xeec9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb344=['request-promise','path','rimraf','./squareOdbc.attributes','exports','SquareOdbc','../../config/logger','api','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb344,0x150));var _0x4b34=function(_0x1a58d1,_0xa90685){_0x1a58d1=_0x1a58d1-0x0;var _0x101adc=_0xb344[_0x1a58d1];return _0x101adc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b34('0x0'))(_0x4b34('0x1'));var moment=require(_0x4b34('0x2'));var BPromise=require(_0x4b34('0x3'));var rp=require(_0x4b34('0x4'));var fs=require('fs');var path=require(_0x4b34('0x5'));var rimraf=require(_0x4b34('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b34('0x7'));module[_0x4b34('0x8')]=function(_0xa09244,_0x20f445){return _0xa09244['define'](_0x4b34('0x9'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 09aa126..2d811d0 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 _0x78df=['rpc','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','model','map','lodash','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x3768f3,_0x4a40f1){var _0x526a13=function(_0x350126){while(--_0x350126){_0x3768f3['push'](_0x3768f3['shift']());}};_0x526a13(++_0x4a40f1);}(_0x78df,0x100));var _0xf78d=function(_0x33f03f,_0x110c53){_0x33f03f=_0x33f03f-0x0;var _0x2bf3c9=_0x78df[_0x33f03f];return _0x2bf3c9;};'use strict';var _=require(_0xf78d('0x0'));var util=require('util');var moment=require(_0xf78d('0x1'));var BPromise=require(_0xf78d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf78d('0x3'));var logger=require(_0xf78d('0x4'))(_0xf78d('0x5'));var config=require('../../config/environment');var jayson=require(_0xf78d('0x6'));var client=jayson['client'][_0xf78d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x232c57,_0x1b5c14,_0x2622f9){return new BPromise(function(_0x381122,_0x469706){return client[_0xf78d('0x8')](_0x232c57,_0x2622f9)[_0xf78d('0x9')](function(_0x4d5cf2){logger['info'](_0xf78d('0xa'),_0x1b5c14,'request\x20sent');logger[_0xf78d('0xb')](_0xf78d('0xc'),_0x1b5c14,_0xf78d('0xd'),JSON[_0xf78d('0xe')](_0x4d5cf2));if(_0x4d5cf2[_0xf78d('0xf')]){if(_0x4d5cf2[_0xf78d('0xf')][_0xf78d('0x10')]===0x1f4){logger[_0xf78d('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x1b5c14,_0x4d5cf2[_0xf78d('0xf')][_0xf78d('0x11')]);return _0x469706(_0x4d5cf2[_0xf78d('0xf')]['message']);}logger[_0xf78d('0xf')](_0xf78d('0xa'),_0x1b5c14,_0x4d5cf2['error'][_0xf78d('0x11')]);return _0x381122(_0x4d5cf2['error'][_0xf78d('0x11')]);}else{logger[_0xf78d('0x12')](_0xf78d('0xa'),_0x1b5c14,_0xf78d('0xd'));_0x381122(_0x4d5cf2['result']['message']);}})[_0xf78d('0x13')](function(_0x1059a5){logger[_0xf78d('0xf')](_0xf78d('0xa'),_0x1b5c14,_0x1059a5);_0x469706(_0x1059a5);});});}exports[_0xf78d('0x14')]=function(_0x1a9399){var _0x4bb31b=this;return new Promise(function(_0x3be8db,_0x100f79){return db[_0xf78d('0x15')][_0xf78d('0x16')]({'raw':_0x1a9399[_0xf78d('0x17')]?_0x1a9399['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a9399[_0xf78d('0x17')]?_0x1a9399['options'][_0xf78d('0x18')]||null:null,'attributes':_0x1a9399[_0xf78d('0x17')]?_0x1a9399[_0xf78d('0x17')][_0xf78d('0x19')]||null:null,'include':_0x1a9399[_0xf78d('0x17')]?_0x1a9399[_0xf78d('0x17')]['include']?_['map'](_0x1a9399[_0xf78d('0x17')][_0xf78d('0x1a')],function(_0x287ee7){return{'model':db[_0x287ee7[_0xf78d('0x1b')]],'as':_0x287ee7['as'],'attributes':_0x287ee7[_0xf78d('0x19')],'include':_0x287ee7[_0xf78d('0x1a')]?_[_0xf78d('0x1c')](_0x287ee7[_0xf78d('0x1a')],function(_0x21500c){return{'model':db[_0x21500c['model']],'as':_0x21500c['as'],'attributes':_0x21500c[_0xf78d('0x19')],'include':_0x21500c[_0xf78d('0x1a')]?_['map'](_0x21500c[_0xf78d('0x1a')],function(_0x5646e1){return{'model':db[_0x5646e1[_0xf78d('0x1b')]],'as':_0x5646e1['as'],'attributes':_0x5646e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x10245a){logger['info'](_0xf78d('0x14'),_0x1a9399);logger[_0xf78d('0xb')](_0xf78d('0x14'),_0x1a9399,JSON[_0xf78d('0xe')](_0x10245a));_0x3be8db(_0x10245a);})[_0xf78d('0x13')](function(_0xb89446){logger[_0xf78d('0xf')](_0xf78d('0x14'),_0xb89446[_0xf78d('0x11')],_0x1a9399);_0x100f79(_0x4bb31b[_0xf78d('0xf')](0x1f4,_0xb89446[_0xf78d('0x11')]));});});}; \ No newline at end of file +var _0x3fe2=['info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','model','attributes','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x3fe2,0x1d3));var _0x23fe=function(_0x4456f3,_0x26a709){_0x4456f3=_0x4456f3-0x0;var _0xf17e5a=_0x3fe2[_0x4456f3];return _0xf17e5a;};'use strict';var _=require(_0x23fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23fe('0x1'));var rs=require(_0x23fe('0x2'));var fs=require('fs');var Redis=require(_0x23fe('0x3'));var db=require(_0x23fe('0x4'))['db'];var utils=require(_0x23fe('0x5'));var logger=require(_0x23fe('0x6'))(_0x23fe('0x7'));var config=require(_0x23fe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23fe('0x9')][_0x23fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494d1f,_0x437a90,_0x497d37){return new BPromise(function(_0x26bd35,_0xa12efc){return client[_0x23fe('0xb')](_0x494d1f,_0x497d37)[_0x23fe('0xc')](function(_0x44bb03){logger[_0x23fe('0xd')](_0x23fe('0xe'),_0x437a90,_0x23fe('0xf'));logger[_0x23fe('0x10')](_0x23fe('0x11'),_0x437a90,_0x23fe('0xf'),JSON[_0x23fe('0x12')](_0x44bb03));if(_0x44bb03[_0x23fe('0x13')]){if(_0x44bb03[_0x23fe('0x13')]['code']===0x1f4){logger[_0x23fe('0x13')](_0x23fe('0xe'),_0x437a90,_0x44bb03[_0x23fe('0x13')][_0x23fe('0x14')]);return _0xa12efc(_0x44bb03[_0x23fe('0x13')][_0x23fe('0x14')]);}logger[_0x23fe('0x13')](_0x23fe('0xe'),_0x437a90,_0x44bb03[_0x23fe('0x13')][_0x23fe('0x14')]);return _0x26bd35(_0x44bb03['error'][_0x23fe('0x14')]);}else{logger[_0x23fe('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x437a90,_0x23fe('0xf'));_0x26bd35(_0x44bb03[_0x23fe('0x15')]['message']);}})['catch'](function(_0x4b158e){logger[_0x23fe('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x437a90,_0x4b158e);_0xa12efc(_0x4b158e);});});}exports[_0x23fe('0x16')]=function(_0x4fd2a7){var _0x506b38=this;return new Promise(function(_0x2b8fd8,_0x419630){return db[_0x23fe('0x17')][_0x23fe('0x18')]({'raw':_0x4fd2a7['options']?_0x4fd2a7[_0x23fe('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4fd2a7[_0x23fe('0x19')]?_0x4fd2a7['options'][_0x23fe('0x1a')]||null:null,'attributes':_0x4fd2a7['options']?_0x4fd2a7[_0x23fe('0x19')]['attributes']||null:null,'include':_0x4fd2a7[_0x23fe('0x19')]?_0x4fd2a7['options'][_0x23fe('0x1b')]?_[_0x23fe('0x1c')](_0x4fd2a7[_0x23fe('0x19')][_0x23fe('0x1b')],function(_0x58412c){return{'model':db[_0x58412c[_0x23fe('0x1d')]],'as':_0x58412c['as'],'attributes':_0x58412c[_0x23fe('0x1e')],'include':_0x58412c['include']?_[_0x23fe('0x1c')](_0x58412c[_0x23fe('0x1b')],function(_0x2a32e0){return{'model':db[_0x2a32e0[_0x23fe('0x1d')]],'as':_0x2a32e0['as'],'attributes':_0x2a32e0['attributes'],'include':_0x2a32e0[_0x23fe('0x1b')]?_['map'](_0x2a32e0[_0x23fe('0x1b')],function(_0x3ef8e6){return{'model':db[_0x3ef8e6[_0x23fe('0x1d')]],'as':_0x3ef8e6['as'],'attributes':_0x3ef8e6['attributes']};}):[]};}):[]};}):[]:[]})[_0x23fe('0xc')](function(_0x5710b3){logger['info'](_0x23fe('0x16'),_0x4fd2a7);logger[_0x23fe('0x10')](_0x23fe('0x16'),_0x4fd2a7,JSON[_0x23fe('0x12')](_0x5710b3));_0x2b8fd8(_0x5710b3);})[_0x23fe('0x1f')](function(_0x558a55){logger[_0x23fe('0x13')](_0x23fe('0x16'),_0x558a55[_0x23fe('0x14')],_0x4fd2a7);_0x419630(_0x506b38[_0x23fe('0x13')](0x1f4,_0x558a55[_0x23fe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e222ed3..96c9133 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 _0xc660=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy'];(function(_0x535b59,_0x59eb31){var _0x109a40=function(_0x355d17){while(--_0x355d17){_0x535b59['push'](_0x535b59['shift']());}};_0x109a40(++_0x59eb31);}(_0xc660,0x16a));var _0x0c66=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc660[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0c66('0x0'));var util=require(_0x0c66('0x1'));var path=require(_0x0c66('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0c66('0x3')]();var fs_extra=require(_0x0c66('0x4'));var auth=require(_0x0c66('0x5'));var interaction=require(_0x0c66('0x6'));var config=require(_0x0c66('0x7'));var controller=require(_0x0c66('0x8'));router[_0x0c66('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c66('0xa')]);router['get'](_0x0c66('0xb'),auth[_0x0c66('0xc')](),controller[_0x0c66('0xd')]);router[_0x0c66('0xe')]('/',auth[_0x0c66('0xc')](),controller['create']);router[_0x0c66('0xf')](_0x0c66('0xb'),auth[_0x0c66('0xc')](),controller[_0x0c66('0x10')]);router['delete'](_0x0c66('0xb'),auth[_0x0c66('0xc')](),controller[_0x0c66('0x11')]);module[_0x0c66('0x12')]=router; \ No newline at end of file +var _0xca3f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x148ac8,_0x2cfc6a){var _0x655338=function(_0x27178e){while(--_0x27178e){_0x148ac8['push'](_0x148ac8['shift']());}};_0x655338(++_0x2cfc6a);}(_0xca3f,0x9c));var _0xfca3=function(_0x4ef339,_0x319478){_0x4ef339=_0x4ef339-0x0;var _0x4b8059=_0xca3f[_0x4ef339];return _0x4b8059;};'use strict';var multer=require(_0xfca3('0x0'));var util=require(_0xfca3('0x1'));var path=require(_0xfca3('0x2'));var timeout=require(_0xfca3('0x3'));var express=require(_0xfca3('0x4'));var router=express[_0xfca3('0x5')]();var fs_extra=require(_0xfca3('0x6'));var auth=require(_0xfca3('0x7'));var interaction=require(_0xfca3('0x8'));var config=require('../../config/environment');var controller=require(_0xfca3('0x9'));router[_0xfca3('0xa')]('/',auth[_0xfca3('0xb')](),controller[_0xfca3('0xc')]);router[_0xfca3('0xa')](_0xfca3('0xd'),auth[_0xfca3('0xb')](),controller[_0xfca3('0xe')]);router[_0xfca3('0xf')]('/',auth[_0xfca3('0xb')](),controller[_0xfca3('0x10')]);router[_0xfca3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfca3('0x12')](_0xfca3('0xd'),auth[_0xfca3('0xb')](),controller['destroy']);module[_0xfca3('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f514bbb..57dfad6 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 _0xd0cd=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE','sequelize','exports','STRING'];(function(_0x26de0e,_0xa9ee8e){var _0x149d7c=function(_0x41d76b){while(--_0x41d76b){_0x26de0e['push'](_0x26de0e['shift']());}};_0x149d7c(++_0xa9ee8e);}(_0xd0cd,0xe7));var _0xdd0c=function(_0x1401e1,_0xabb499){_0x1401e1=_0x1401e1-0x0;var _0x1aab56=_0xd0cd[_0x1401e1];return _0x1aab56;};'use strict';var Sequelize=require(_0xdd0c('0x0'));module[_0xdd0c('0x1')]={'name':{'type':Sequelize[_0xdd0c('0x2')],'unique':_0xdd0c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xdd0c('0x4')]},'preproduction':{'type':Sequelize[_0xdd0c('0x5')](_0xdd0c('0x6')),'get':function(){if(this[_0xdd0c('0x7')](_0xdd0c('0x8'))){return this[_0xdd0c('0x7')](_0xdd0c('0x8'))[_0xdd0c('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xdd0c('0x6')),'get':function(){if(this[_0xdd0c('0x7')](_0xdd0c('0xa'))){return this['getDataValue']('production')[_0xdd0c('0x9')](_0xdd0c('0xb'));}}},'savedAt':{'type':Sequelize[_0xdd0c('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x890c=['BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','TEXT'];(function(_0x38f34e,_0x287825){var _0x3f3adf=function(_0x40c089){while(--_0x40c089){_0x38f34e['push'](_0x38f34e['shift']());}};_0x3f3adf(++_0x287825);}(_0x890c,0x18e));var _0xc890=function(_0x530a71,_0xeca2c2){_0x530a71=_0x530a71-0x0;var _0x16d1f8=_0x890c[_0x530a71];return _0x16d1f8;};'use strict';var Sequelize=require(_0xc890('0x0'));module[_0xc890('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc890('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc890('0x3')]},'notes':{'type':Sequelize[_0xc890('0x4')]},'preproduction':{'type':Sequelize[_0xc890('0x5')](_0xc890('0x6')),'get':function(){if(this[_0xc890('0x7')](_0xc890('0x8'))){return this['getDataValue'](_0xc890('0x8'))[_0xc890('0x9')](_0xc890('0xa'));}}},'production':{'type':Sequelize[_0xc890('0x5')](_0xc890('0x6')),'get':function(){if(this[_0xc890('0x7')]('production')){return this[_0xc890('0x7')](_0xc890('0xb'))[_0xc890('0x9')](_0xc890('0xa'));}}},'savedAt':{'type':Sequelize[_0xc890('0xc')]},'publishedAt':{'type':Sequelize[_0xc890('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index be27830..6016033 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 _0xaf93=['../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','limit','undefined','count','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','agi','error','name','index','map','SquareProject','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','production','ioredis','../../components/parsers/qs'];(function(_0x21baab,_0x4f4817){var _0x4bc12f=function(_0x323a82){while(--_0x323a82){_0x21baab['push'](_0x21baab['shift']());}};_0x4bc12f(++_0x4f4817);}(_0xaf93,0x143));var _0x3af9=function(_0x10134a,_0x3f714a){_0x10134a=_0x10134a-0x0;var _0x17386a=_0xaf93[_0x10134a];return _0x17386a;};'use strict';var _=require('lodash');var Redis=require(_0x3af9('0x0'));var qs=require(_0x3af9('0x1'));var logger=require(_0x3af9('0x2'))('api');var config=require('../../config/environment');var db=require(_0x3af9('0x3'))['db'];config[_0x3af9('0x4')]=_[_0x3af9('0x5')](config[_0x3af9('0x4')],{'host':_0x3af9('0x6'),'port':0x18eb});var socket=require(_0x3af9('0x7'))(new Redis(config[_0x3af9('0x4')]));require(_0x3af9('0x8'))[_0x3af9('0x9')](socket);function respondWithResult(_0x577323,_0x32e82a){_0x32e82a=_0x32e82a||0xc8;return function(_0x2cef9c){if(_0x2cef9c){return _0x577323[_0x3af9('0xa')](_0x32e82a)['json'](_0x2cef9c);}};}function respondWithFilteredResult(_0x1d800b,_0x16d4bc){return function(_0x324d42){if(_0x324d42){var _0x33f433=typeof _0x16d4bc[_0x3af9('0xb')]==='undefined'&&typeof _0x16d4bc[_0x3af9('0xc')]===_0x3af9('0xd');var _0x1a7a39=_0x324d42[_0x3af9('0xe')];var _0x47cafb=_0x33f433?0x0:_0x16d4bc[_0x3af9('0xb')];var _0x21919b=_0x33f433?_0x324d42[_0x3af9('0xe')]:_0x16d4bc['offset']+_0x16d4bc[_0x3af9('0xc')];var _0xf49db8;if(_0x21919b>=_0x1a7a39){_0x21919b=_0x1a7a39;_0xf49db8=0xc8;}else{_0xf49db8=0xce;}_0x1d800b[_0x3af9('0xa')](_0xf49db8);return _0x1d800b[_0x3af9('0xf')](_0x3af9('0x10'),_0x47cafb+'-'+_0x21919b+'/'+_0x1a7a39)['json'](_0x324d42);}return null;};}function saveUpdates(_0x3c3b2f){return function(_0x1cb15c){if(_0x1cb15c){return _0x1cb15c[_0x3af9('0x11')](_0x3c3b2f)['then'](function(_0x3db4ee){return _0x3db4ee;});}return null;};}function removeEntity(_0x149c0d){return function(_0x5373be){if(_0x5373be){return _0x5373be[_0x3af9('0x12')]()[_0x3af9('0x13')](function(){var _0x29cfab=_0x5373be[_0x3af9('0x14')]({'plain':!![]});var _0xcaa302=_0x3af9('0x15');return db[_0x3af9('0x16')]['destroy']({'where':{'type':_0xcaa302,'resourceId':_0x29cfab['id']}})[_0x3af9('0x13')](function(){return _0x5373be;});})[_0x3af9('0x13')](function(){var _0x102117=new Redis(config['redis']);_0x102117['publish'](_0x3af9('0x17'),JSON['stringify']({'id':_0x5373be['id'],'deleted':!![]}));})['then'](function(){_0x149c0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec61f){return function(_0x4be941){if(!_0x4be941){_0x5ec61f['sendStatus'](0x194);}return _0x4be941;};}function handleError(_0x455591,_0x38688b){_0x38688b=_0x38688b||0x1f4;return function(_0x36d043){logger[_0x3af9('0x18')](_0x36d043['stack']);if(_0x36d043[_0x3af9('0x19')]){delete _0x36d043['name'];}_0x455591[_0x3af9('0xa')](_0x38688b)['send'](_0x36d043);};}exports[_0x3af9('0x1a')]=function(_0x16c015,_0xbe6e94){var _0x2c2769={},_0x7d8e9d={},_0x45028b={'count':0x0,'rows':[]};var _0xc77628=_[_0x3af9('0x1b')](db[_0x3af9('0x1c')][_0x3af9('0x1d')],function(_0x554630){return{'name':_0x554630['fieldName'],'type':_0x554630[_0x3af9('0x1e')]['key']};});_0x7d8e9d[_0x3af9('0x1f')]=_[_0x3af9('0x1b')](_0xc77628,_0x3af9('0x19'));_0x7d8e9d[_0x3af9('0x20')]=_['keys'](_0x16c015[_0x3af9('0x20')]);_0x7d8e9d[_0x3af9('0x21')]=_[_0x3af9('0x22')](_0x7d8e9d[_0x3af9('0x1f')],_0x7d8e9d[_0x3af9('0x20')]);_0x2c2769[_0x3af9('0x23')]=_['intersection'](_0x7d8e9d['model'],qs[_0x3af9('0x24')](_0x16c015[_0x3af9('0x20')][_0x3af9('0x24')]));_0x2c2769['attributes']=_0x2c2769[_0x3af9('0x23')][_0x3af9('0x25')]?_0x2c2769[_0x3af9('0x23')]:_0x7d8e9d[_0x3af9('0x1f')];if(!_0x16c015[_0x3af9('0x20')][_0x3af9('0x26')]('nolimit')){_0x2c2769['limit']=qs[_0x3af9('0xc')](_0x16c015[_0x3af9('0x20')]['limit']);_0x2c2769[_0x3af9('0xb')]=qs[_0x3af9('0xb')](_0x16c015['query'][_0x3af9('0xb')]);}_0x2c2769[_0x3af9('0x27')]=qs[_0x3af9('0x28')](_0x16c015[_0x3af9('0x20')][_0x3af9('0x28')]);_0x2c2769[_0x3af9('0x29')]=qs[_0x3af9('0x21')](_[_0x3af9('0x2a')](_0x16c015[_0x3af9('0x20')],_0x7d8e9d[_0x3af9('0x21')]),_0xc77628);if(_0x16c015[_0x3af9('0x20')][_0x3af9('0x2b')]){_0x2c2769[_0x3af9('0x29')]=_[_0x3af9('0x2c')](_0x2c2769['where'],{'$or':_[_0x3af9('0x1b')](_0xc77628,function(_0x31db53){if(_0x31db53['type']!==_0x3af9('0x2d')){var _0x4d3043={};_0x4d3043[_0x31db53['name']]={'$like':'%'+_0x16c015[_0x3af9('0x20')][_0x3af9('0x2b')]+'%'};return _0x4d3043;}})});}_0x2c2769=_[_0x3af9('0x2c')]({},_0x2c2769,_0x16c015[_0x3af9('0x2e')]);var _0x31bc9d={'where':_0x2c2769[_0x3af9('0x29')]};return db[_0x3af9('0x1c')]['count'](_0x31bc9d)[_0x3af9('0x13')](function(_0x21e393){_0x45028b[_0x3af9('0xe')]=_0x21e393;if(_0x16c015[_0x3af9('0x20')][_0x3af9('0x2f')]){_0x2c2769['include']=[{'all':!![]}];}return db['SquareProject'][_0x3af9('0x30')](_0x2c2769);})[_0x3af9('0x13')](function(_0x577c5c){_0x45028b['rows']=_0x577c5c;return _0x45028b;})[_0x3af9('0x13')](respondWithFilteredResult(_0xbe6e94,_0x2c2769))[_0x3af9('0x31')](handleError(_0xbe6e94,null));};exports[_0x3af9('0x32')]=function(_0x8b2a0,_0x28cc82){var _0x1e92e6={'raw':![],'where':{'id':_0x8b2a0[_0x3af9('0x33')]['id']}},_0x34d054={};_0x34d054[_0x3af9('0x1f')]=_['keys'](db[_0x3af9('0x1c')][_0x3af9('0x1d')]);_0x34d054[_0x3af9('0x20')]=_[_0x3af9('0x34')](_0x8b2a0[_0x3af9('0x20')]);_0x34d054[_0x3af9('0x21')]=_[_0x3af9('0x22')](_0x34d054['model'],_0x34d054['query']);_0x1e92e6[_0x3af9('0x23')]=_[_0x3af9('0x22')](_0x34d054[_0x3af9('0x1f')],qs[_0x3af9('0x24')](_0x8b2a0[_0x3af9('0x20')][_0x3af9('0x24')]));_0x1e92e6[_0x3af9('0x23')]=_0x1e92e6['attributes'][_0x3af9('0x25')]?_0x1e92e6[_0x3af9('0x23')]:_0x34d054[_0x3af9('0x1f')];if(_0x8b2a0[_0x3af9('0x20')]['includeAll']){_0x1e92e6[_0x3af9('0x35')]=[{'all':!![]}];}_0x1e92e6=_[_0x3af9('0x2c')]({},_0x1e92e6,_0x8b2a0['options']);return db['SquareProject'][_0x3af9('0x36')](_0x1e92e6)[_0x3af9('0x13')](handleEntityNotFound(_0x28cc82,null))[_0x3af9('0x13')](respondWithResult(_0x28cc82,null))[_0x3af9('0x31')](handleError(_0x28cc82,null));};exports[_0x3af9('0x37')]=function(_0x47559f,_0x2ea4b7){return db['SquareProject'][_0x3af9('0x37')](_0x47559f[_0x3af9('0x38')],{})[_0x3af9('0x13')](function(_0x394d4d){var _0x1e5688=_0x47559f['user']['get']({'plain':!![]});if(!_0x1e5688)throw new Error(_0x3af9('0x39'));if(_0x1e5688[_0x3af9('0x3a')]===_0x3af9('0x3b')){var _0x1b0566=_0x394d4d['get']({'plain':!![]});var _0x507ee2=_0x3af9('0x15');return db['UserProfileSection'][_0x3af9('0x36')]({'where':{'name':_0x507ee2,'userProfileId':_0x1e5688[_0x3af9('0x3c')]},'raw':!![]})[_0x3af9('0x13')](function(_0xf819d1){if(_0xf819d1&&_0xf819d1['autoAssociation']===0x0){return db[_0x3af9('0x16')]['create']({'name':_0x1b0566[_0x3af9('0x19')],'resourceId':_0x1b0566['id'],'type':_0xf819d1['name'],'sectionId':_0xf819d1['id']},{})[_0x3af9('0x13')](function(){return _0x394d4d;});}else{return _0x394d4d;}})[_0x3af9('0x31')](function(_0x4c1125){logger[_0x3af9('0x18')](_0x3af9('0x3d'),_0x4c1125);throw _0x4c1125;});}return _0x394d4d;})[_0x3af9('0x13')](respondWithResult(_0x2ea4b7,0xc9))[_0x3af9('0x31')](handleError(_0x2ea4b7,null));};exports[_0x3af9('0x11')]=function(_0x21a0de,_0x39eab4){if(_0x21a0de['body']['id']){delete _0x21a0de[_0x3af9('0x38')]['id'];}return db[_0x3af9('0x1c')][_0x3af9('0x36')]({'where':{'id':_0x21a0de[_0x3af9('0x33')]['id']}})['then'](handleEntityNotFound(_0x39eab4,null))['then'](saveUpdates(_0x21a0de[_0x3af9('0x38')],null))[_0x3af9('0x13')](function(_0x4f0a5e){if(!_0x4f0a5e)return;var _0x26416f=_0x4f0a5e[_0x3af9('0x14')]({'plain':!![]});return _0x26416f;})['then'](function(_0x3668e0){var _0x4176a8=new Redis(config['redis']);_0x4176a8[_0x3af9('0x3e')]('agi',JSON[_0x3af9('0x3f')](_[_0x3af9('0x2a')](_0x3668e0,['id','name',_0x3af9('0x40')])));return _0x3668e0;})[_0x3af9('0x13')](respondWithResult(_0x39eab4,null))[_0x3af9('0x31')](handleError(_0x39eab4,null));};exports[_0x3af9('0x12')]=function(_0x12527a,_0x1d0045){return db[_0x3af9('0x1c')][_0x3af9('0x36')]({'where':{'id':_0x12527a[_0x3af9('0x33')]['id']}})[_0x3af9('0x13')](handleEntityNotFound(_0x1d0045,null))[_0x3af9('0x13')](removeEntity(_0x1d0045,null))['catch'](handleError(_0x1d0045,null));}; \ No newline at end of file +var _0x1063=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','publish','agi','stringify','end','error','stack','name','index','map','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareProject','includeAll','include','findAll','catch','show','keys','find','create'];(function(_0x4222b5,_0x37422c){var _0x425d4c=function(_0x53e442){while(--_0x53e442){_0x4222b5['push'](_0x4222b5['shift']());}};_0x425d4c(++_0x37422c);}(_0x1063,0x95));var _0x3106=function(_0x53cd3f,_0x42da3b){_0x53cd3f=_0x53cd3f-0x0;var _0x3f2af3=_0x1063[_0x53cd3f];return _0x3f2af3;};'use strict';var _=require(_0x3106('0x0'));var Redis=require(_0x3106('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x3106('0x2'))(_0x3106('0x3'));var config=require(_0x3106('0x4'));var db=require(_0x3106('0x5'))['db'];config[_0x3106('0x6')]=_['defaults'](config[_0x3106('0x6')],{'host':_0x3106('0x7'),'port':0x18eb});var socket=require(_0x3106('0x8'))(new Redis(config['redis']));require(_0x3106('0x9'))['register'](socket);function respondWithResult(_0x3a1a32,_0x4d5bb5){_0x4d5bb5=_0x4d5bb5||0xc8;return function(_0x6f7668){if(_0x6f7668){return _0x3a1a32[_0x3106('0xa')](_0x4d5bb5)[_0x3106('0xb')](_0x6f7668);}};}function respondWithFilteredResult(_0x25d5f1,_0x46821f){return function(_0x1731ed){if(_0x1731ed){var _0x13250b=typeof _0x46821f[_0x3106('0xc')]===_0x3106('0xd')&&typeof _0x46821f[_0x3106('0xe')]===_0x3106('0xd');var _0x276452=_0x1731ed[_0x3106('0xf')];var _0x5c7904=_0x13250b?0x0:_0x46821f[_0x3106('0xc')];var _0x4b41ee=_0x13250b?_0x1731ed[_0x3106('0xf')]:_0x46821f[_0x3106('0xc')]+_0x46821f[_0x3106('0xe')];var _0x2e255c;if(_0x4b41ee>=_0x276452){_0x4b41ee=_0x276452;_0x2e255c=0xc8;}else{_0x2e255c=0xce;}_0x25d5f1['status'](_0x2e255c);return _0x25d5f1[_0x3106('0x10')]('Content-Range',_0x5c7904+'-'+_0x4b41ee+'/'+_0x276452)[_0x3106('0xb')](_0x1731ed);}return null;};}function saveUpdates(_0x5b6496){return function(_0x22e649){if(_0x22e649){return _0x22e649[_0x3106('0x11')](_0x5b6496)[_0x3106('0x12')](function(_0x40be08){return _0x40be08;});}return null;};}function removeEntity(_0x138454){return function(_0x49aeeb){if(_0x49aeeb){return _0x49aeeb[_0x3106('0x13')]()[_0x3106('0x12')](function(){var _0x3df44f=_0x49aeeb[_0x3106('0x14')]({'plain':!![]});var _0x185ba8='SquareProjects';return db[_0x3106('0x15')][_0x3106('0x13')]({'where':{'type':_0x185ba8,'resourceId':_0x3df44f['id']}})['then'](function(){return _0x49aeeb;});})[_0x3106('0x12')](function(){var _0x52ea6a=new Redis(config[_0x3106('0x6')]);_0x52ea6a[_0x3106('0x16')](_0x3106('0x17'),JSON[_0x3106('0x18')]({'id':_0x49aeeb['id'],'deleted':!![]}));})[_0x3106('0x12')](function(){_0x138454[_0x3106('0xa')](0xcc)[_0x3106('0x19')]();});}};}function handleEntityNotFound(_0x46a7c1){return function(_0x1331df){if(!_0x1331df){_0x46a7c1['sendStatus'](0x194);}return _0x1331df;};}function handleError(_0x1d3889,_0x723c5b){_0x723c5b=_0x723c5b||0x1f4;return function(_0x3c94bf){logger[_0x3106('0x1a')](_0x3c94bf[_0x3106('0x1b')]);if(_0x3c94bf['name']){delete _0x3c94bf[_0x3106('0x1c')];}_0x1d3889['status'](_0x723c5b)['send'](_0x3c94bf);};}exports[_0x3106('0x1d')]=function(_0x1508b0,_0x3e2664){var _0x5b89e0={},_0x31e571={},_0x468be={'count':0x0,'rows':[]};var _0x118f51=_[_0x3106('0x1e')](db['SquareProject'][_0x3106('0x1f')],function(_0x19a2cb){return{'name':_0x19a2cb['fieldName'],'type':_0x19a2cb['type']['key']};});_0x31e571[_0x3106('0x20')]=_[_0x3106('0x1e')](_0x118f51,'name');_0x31e571[_0x3106('0x21')]=_['keys'](_0x1508b0[_0x3106('0x21')]);_0x31e571[_0x3106('0x22')]=_[_0x3106('0x23')](_0x31e571[_0x3106('0x20')],_0x31e571[_0x3106('0x21')]);_0x5b89e0[_0x3106('0x24')]=_[_0x3106('0x23')](_0x31e571[_0x3106('0x20')],qs[_0x3106('0x25')](_0x1508b0[_0x3106('0x21')]['fields']));_0x5b89e0['attributes']=_0x5b89e0[_0x3106('0x24')][_0x3106('0x26')]?_0x5b89e0['attributes']:_0x31e571['model'];if(!_0x1508b0[_0x3106('0x21')]['hasOwnProperty'](_0x3106('0x27'))){_0x5b89e0['limit']=qs[_0x3106('0xe')](_0x1508b0[_0x3106('0x21')]['limit']);_0x5b89e0[_0x3106('0xc')]=qs[_0x3106('0xc')](_0x1508b0[_0x3106('0x21')][_0x3106('0xc')]);}_0x5b89e0[_0x3106('0x28')]=qs[_0x3106('0x29')](_0x1508b0[_0x3106('0x21')][_0x3106('0x29')]);_0x5b89e0[_0x3106('0x2a')]=qs[_0x3106('0x22')](_[_0x3106('0x2b')](_0x1508b0[_0x3106('0x21')],_0x31e571[_0x3106('0x22')]),_0x118f51);if(_0x1508b0['query'][_0x3106('0x2c')]){_0x5b89e0[_0x3106('0x2a')]=_[_0x3106('0x2d')](_0x5b89e0[_0x3106('0x2a')],{'$or':_[_0x3106('0x1e')](_0x118f51,function(_0x4a4556){if(_0x4a4556[_0x3106('0x2e')]!==_0x3106('0x2f')){var _0x41e2a8={};_0x41e2a8[_0x4a4556[_0x3106('0x1c')]]={'$like':'%'+_0x1508b0[_0x3106('0x21')]['filter']+'%'};return _0x41e2a8;}})});}_0x5b89e0=_['merge']({},_0x5b89e0,_0x1508b0[_0x3106('0x30')]);var _0x48e8e3={'where':_0x5b89e0[_0x3106('0x2a')]};return db[_0x3106('0x31')][_0x3106('0xf')](_0x48e8e3)['then'](function(_0x445cc6){_0x468be[_0x3106('0xf')]=_0x445cc6;if(_0x1508b0[_0x3106('0x21')][_0x3106('0x32')]){_0x5b89e0[_0x3106('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x3106('0x34')](_0x5b89e0);})[_0x3106('0x12')](function(_0x52eec3){_0x468be['rows']=_0x52eec3;return _0x468be;})['then'](respondWithFilteredResult(_0x3e2664,_0x5b89e0))[_0x3106('0x35')](handleError(_0x3e2664,null));};exports[_0x3106('0x36')]=function(_0x197bf6,_0x203c15){var _0x5bf596={'raw':![],'where':{'id':_0x197bf6['params']['id']}},_0xbf1b2c={};_0xbf1b2c[_0x3106('0x20')]=_[_0x3106('0x37')](db[_0x3106('0x31')][_0x3106('0x1f')]);_0xbf1b2c[_0x3106('0x21')]=_['keys'](_0x197bf6[_0x3106('0x21')]);_0xbf1b2c['filters']=_[_0x3106('0x23')](_0xbf1b2c[_0x3106('0x20')],_0xbf1b2c[_0x3106('0x21')]);_0x5bf596[_0x3106('0x24')]=_[_0x3106('0x23')](_0xbf1b2c[_0x3106('0x20')],qs[_0x3106('0x25')](_0x197bf6[_0x3106('0x21')][_0x3106('0x25')]));_0x5bf596['attributes']=_0x5bf596[_0x3106('0x24')][_0x3106('0x26')]?_0x5bf596[_0x3106('0x24')]:_0xbf1b2c['model'];if(_0x197bf6[_0x3106('0x21')][_0x3106('0x32')]){_0x5bf596[_0x3106('0x33')]=[{'all':!![]}];}_0x5bf596=_['merge']({},_0x5bf596,_0x197bf6[_0x3106('0x30')]);return db[_0x3106('0x31')][_0x3106('0x38')](_0x5bf596)[_0x3106('0x12')](handleEntityNotFound(_0x203c15,null))[_0x3106('0x12')](respondWithResult(_0x203c15,null))[_0x3106('0x35')](handleError(_0x203c15,null));};exports['create']=function(_0x278392,_0x2ccdbe){return db[_0x3106('0x31')][_0x3106('0x39')](_0x278392['body'],{})[_0x3106('0x12')](function(_0x523967){var _0x4bb138=_0x278392[_0x3106('0x3a')]['get']({'plain':!![]});if(!_0x4bb138)throw new Error(_0x3106('0x3b'));if(_0x4bb138[_0x3106('0x3c')]===_0x3106('0x3a')){var _0x226f94=_0x523967[_0x3106('0x14')]({'plain':!![]});var _0xdec29c=_0x3106('0x3d');return db[_0x3106('0x3e')][_0x3106('0x38')]({'where':{'name':_0xdec29c,'userProfileId':_0x4bb138[_0x3106('0x3f')]},'raw':!![]})[_0x3106('0x12')](function(_0x51ffe5){if(_0x51ffe5&&_0x51ffe5[_0x3106('0x40')]===0x0){return db[_0x3106('0x15')][_0x3106('0x39')]({'name':_0x226f94['name'],'resourceId':_0x226f94['id'],'type':_0x51ffe5['name'],'sectionId':_0x51ffe5['id']},{})[_0x3106('0x12')](function(){return _0x523967;});}else{return _0x523967;}})[_0x3106('0x35')](function(_0x2c187c){logger['error'](_0x3106('0x41'),_0x2c187c);throw _0x2c187c;});}return _0x523967;})['then'](respondWithResult(_0x2ccdbe,0xc9))['catch'](handleError(_0x2ccdbe,null));};exports[_0x3106('0x11')]=function(_0x131e23,_0x3d940f){if(_0x131e23[_0x3106('0x42')]['id']){delete _0x131e23[_0x3106('0x42')]['id'];}return db['SquareProject'][_0x3106('0x38')]({'where':{'id':_0x131e23[_0x3106('0x43')]['id']}})[_0x3106('0x12')](handleEntityNotFound(_0x3d940f,null))[_0x3106('0x12')](saveUpdates(_0x131e23[_0x3106('0x42')],null))[_0x3106('0x12')](function(_0x3ad58e){if(!_0x3ad58e)return;var _0x1bc594=_0x3ad58e[_0x3106('0x14')]({'plain':!![]});return _0x1bc594;})['then'](function(_0x571f43){var _0x29a080=new Redis(config[_0x3106('0x6')]);_0x29a080[_0x3106('0x16')](_0x3106('0x17'),JSON[_0x3106('0x18')](_[_0x3106('0x2b')](_0x571f43,['id',_0x3106('0x1c'),_0x3106('0x44')])));return _0x571f43;})['then'](respondWithResult(_0x3d940f,null))[_0x3106('0x35')](handleError(_0x3d940f,null));};exports['destroy']=function(_0x197d2c,_0x543082){return db['SquareProject'][_0x3106('0x38')]({'where':{'id':_0x197d2c['params']['id']}})['then'](handleEntityNotFound(_0x543082,null))[_0x3106('0x12')](removeEntity(_0x543082,null))[_0x3106('0x35')](handleError(_0x543082,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index edfdb11..d77a431 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 _0x9e75=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4eb05d,_0xbdd9c4){var _0xad239=function(_0x22798b){while(--_0x22798b){_0x4eb05d['push'](_0x4eb05d['shift']());}};_0xad239(++_0xbdd9c4);}(_0x9e75,0x132));var _0x59e7=function(_0x5e9397,_0x4a4b36){_0x5e9397=_0x5e9397-0x0;var _0x50de38=_0x9e75[_0x5e9397];return _0x50de38;};'use strict';var EventEmitter=require(_0x59e7('0x0'));var SquareProject=require(_0x59e7('0x1'))['db'][_0x59e7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x59e7('0x3')](0x0);var events={'afterCreate':_0x59e7('0x4'),'afterUpdate':_0x59e7('0x5'),'afterDestroy':_0x59e7('0x6')};function emitEvent(_0x30310a){return function(_0x23e4b6,_0x235804,_0x3526e3){SquareProjectEvents[_0x59e7('0x7')](_0x30310a+':'+_0x23e4b6['id'],_0x23e4b6);SquareProjectEvents[_0x59e7('0x7')](_0x30310a,_0x23e4b6);_0x3526e3(null);};}for(var e in events){if(events[_0x59e7('0x8')](e)){var event=events[e];SquareProject[_0x59e7('0x9')](e,emitEvent(event));}}module[_0x59e7('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xd860=['SquareProject','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x105702,_0x3d4a6c){var _0x10ff6b=function(_0x26ddf0){while(--_0x26ddf0){_0x105702['push'](_0x105702['shift']());}};_0x10ff6b(++_0x3d4a6c);}(_0xd860,0xe5));var _0x0d86=function(_0x3f9aeb,_0x231e27){_0x3f9aeb=_0x3f9aeb-0x0;var _0x1772b4=_0xd860[_0x3f9aeb];return _0x1772b4;};'use strict';var EventEmitter=require(_0x0d86('0x0'));var SquareProject=require(_0x0d86('0x1'))['db'][_0x0d86('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d86('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c34f4){return function(_0x59d53e,_0x439b1d,_0x1b8754){SquareProjectEvents[_0x0d86('0x4')](_0x5c34f4+':'+_0x59d53e['id'],_0x59d53e);SquareProjectEvents['emit'](_0x5c34f4,_0x59d53e);_0x1b8754(null);};}for(var e in events){if(events[_0x0d86('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x0d86('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 57ab879..2dc96a9 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 _0x1852=['../../config/environment','./squareProject.attributes','exports','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','path','rimraf'];(function(_0x56348b,_0x2eaf26){var _0x2bfa14=function(_0x45c745){while(--_0x45c745){_0x56348b['push'](_0x56348b['shift']());}};_0x2bfa14(++_0x2eaf26);}(_0x1852,0xa4));var _0x2185=function(_0x4f1a5b,_0x2bc292){_0x4f1a5b=_0x4f1a5b-0x0;var _0xc738c5=_0x1852[_0x4f1a5b];return _0xc738c5;};'use strict';var _=require(_0x2185('0x0'));var util=require(_0x2185('0x1'));var logger=require('../../config/logger')(_0x2185('0x2'));var moment=require(_0x2185('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2185('0x4'));var rimraf=require(_0x2185('0x5'));var config=require(_0x2185('0x6'));var attributes=require(_0x2185('0x7'));module[_0x2185('0x8')]=function(_0x25ae57,_0x239dae){return _0x25ae57['define'](_0x2185('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9726e3,_0x33c7da,_0x13773e){if(_0x9726e3[_0x2185('0xa')](_0x2185('0xb'))){_0x9726e3[_0x2185('0xc')]=moment()[_0x2185('0xd')](_0x2185('0xe'));}if(_0x9726e3['changed'](_0x2185('0xf'))){_0x9726e3[_0x2185('0x10')]=moment()[_0x2185('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x13773e(null,_0x9726e3);}}});}; \ No newline at end of file +var _0xd6c3=['rimraf','../../config/environment','exports','SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xd6c3,0x1da));var _0x3d6c=function(_0x5ca922,_0x1cc200){_0x5ca922=_0x5ca922-0x0;var _0x3069e6=_0xd6c3[_0x5ca922];return _0x3069e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d6c('0x0'))(_0x3d6c('0x1'));var moment=require(_0x3d6c('0x2'));var BPromise=require(_0x3d6c('0x3'));var rp=require(_0x3d6c('0x4'));var fs=require('fs');var path=require(_0x3d6c('0x5'));var rimraf=require(_0x3d6c('0x6'));var config=require(_0x3d6c('0x7'));var attributes=require('./squareProject.attributes');module[_0x3d6c('0x8')]=function(_0x3023b7,_0x1f6329){return _0x3023b7['define'](_0x3d6c('0x9'),attributes,{'tableName':_0x3d6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6eaf6f,_0x18ac23,_0xe3c3fb){if(_0x6eaf6f['changed'](_0x3d6c('0xb'))){_0x6eaf6f['savedAt']=moment()[_0x3d6c('0xc')](_0x3d6c('0xd'));}if(_0x6eaf6f[_0x3d6c('0xe')](_0x3d6c('0xf'))){_0x6eaf6f['publishedAt']=moment()['format'](_0x3d6c('0xd'));}_0xe3c3fb(null,_0x6eaf6f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 91f337f..a153c13 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 _0x70e7=['findAll','options','raw','where','attributes','include','model','map','then','debug','stringify','catch','error','message','ShowSquareProject','find','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject'];(function(_0x4573fb,_0x4cb139){var _0x237a36=function(_0x46c30a){while(--_0x46c30a){_0x4573fb['push'](_0x4573fb['shift']());}};_0x237a36(++_0x4cb139);}(_0x70e7,0x18a));var _0x770e=function(_0x2eef84,_0x52ac4c){_0x2eef84=_0x2eef84-0x0;var _0x545899=_0x70e7[_0x2eef84];return _0x545899;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x770e('0x0'))['db'];var logger=require(_0x770e('0x1'))(_0x770e('0x2'));var config=require(_0x770e('0x3'));config['redis']=_[_0x770e('0x4')](config[_0x770e('0x5')],{'host':_0x770e('0x6'),'port':0x18eb});var socket=require(_0x770e('0x7'))(new Redis(config[_0x770e('0x5')]));require('./squareProject.socket')[_0x770e('0x8')](socket);exports[_0x770e('0x9')]=function(_0x49e169){var _0x3fdda1=this;return new Promise(function(_0x1e4564,_0x15a57a){return db[_0x770e('0xa')][_0x770e('0xb')]({'raw':_0x49e169[_0x770e('0xc')]?_0x49e169['options'][_0x770e('0xd')]===undefined?!![]:![]:!![],'where':_0x49e169[_0x770e('0xc')]?_0x49e169['options'][_0x770e('0xe')]||null:null,'attributes':_0x49e169['options']?_0x49e169['options'][_0x770e('0xf')]||null:null,'limit':_0x49e169['options']?_0x49e169[_0x770e('0xc')]['limit']||null:null,'include':_0x49e169['options']?_0x49e169['options'][_0x770e('0x10')]?_['map'](_0x49e169[_0x770e('0xc')][_0x770e('0x10')],function(_0x464d57){return{'model':db[_0x464d57[_0x770e('0x11')]],'as':_0x464d57['as'],'attributes':_0x464d57[_0x770e('0xf')],'include':_0x464d57[_0x770e('0x10')]?_[_0x770e('0x12')](_0x464d57[_0x770e('0x10')],function(_0x3a0dd1){return{'model':db[_0x3a0dd1[_0x770e('0x11')]],'as':_0x3a0dd1['as'],'attributes':_0x3a0dd1[_0x770e('0xf')],'include':_0x3a0dd1['include']?_[_0x770e('0x12')](_0x3a0dd1[_0x770e('0x10')],function(_0x5b3379){return{'model':db[_0x5b3379[_0x770e('0x11')]],'as':_0x5b3379['as'],'attributes':_0x5b3379[_0x770e('0xf')]};}):[]};}):[]};}):[]:[]})[_0x770e('0x13')](function(_0x3b95a0){logger['info'](_0x770e('0x9'),_0x49e169);logger[_0x770e('0x14')]('GetSquareProjects',_0x49e169,JSON[_0x770e('0x15')](_0x3b95a0));_0x1e4564(_0x3b95a0);})[_0x770e('0x16')](function(_0x4617b6){logger[_0x770e('0x17')](_0x770e('0x9'),_0x4617b6[_0x770e('0x18')],_0x49e169);_0x15a57a(_0x3fdda1[_0x770e('0x17')](0x1f4,_0x4617b6[_0x770e('0x18')]));});});};exports[_0x770e('0x19')]=function(_0x3fb466){var _0x53fc68=this;return new Promise(function(_0x532600,_0x28e7b6){return db['SquareProject'][_0x770e('0x1a')]({'raw':_0x3fb466['options']?_0x3fb466['options'][_0x770e('0xd')]===undefined?!![]:![]:!![],'where':_0x3fb466[_0x770e('0xc')]?_0x3fb466[_0x770e('0xc')][_0x770e('0xe')]||null:null,'attributes':_0x3fb466[_0x770e('0xc')]?_0x3fb466[_0x770e('0xc')][_0x770e('0xf')]||null:null,'include':_0x3fb466[_0x770e('0xc')]?_0x3fb466[_0x770e('0xc')][_0x770e('0x10')]?_['map'](_0x3fb466[_0x770e('0xc')]['include'],function(_0x2e7d59){return{'model':db[_0x2e7d59['model']],'as':_0x2e7d59['as'],'attributes':_0x2e7d59[_0x770e('0xf')],'include':_0x2e7d59[_0x770e('0x10')]?_['map'](_0x2e7d59[_0x770e('0x10')],function(_0x2faff9){return{'model':db[_0x2faff9[_0x770e('0x11')]],'as':_0x2faff9['as'],'attributes':_0x2faff9[_0x770e('0xf')],'include':_0x2faff9[_0x770e('0x10')]?_['map'](_0x2faff9[_0x770e('0x10')],function(_0x597f15){return{'model':db[_0x597f15[_0x770e('0x11')]],'as':_0x597f15['as'],'attributes':_0x597f15[_0x770e('0xf')]};}):[]};}):[]};}):[]:[]})[_0x770e('0x13')](function(_0x2b50c7){logger['info']('ShowSquareProject',_0x3fb466);logger[_0x770e('0x14')](_0x770e('0x19'),_0x3fb466,JSON[_0x770e('0x15')](_0x2b50c7));_0x532600(_0x2b50c7);})['catch'](function(_0x1a2244){logger[_0x770e('0x17')]('ShowSquareProject',_0x1a2244['message'],_0x3fb466);_0x28e7b6(_0x53fc68[_0x770e('0x17')](0x1f4,_0x1a2244['message']));});});}; \ No newline at end of file +var _0x1569=['./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','GetSquareProjects','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost'];(function(_0x9864da,_0x5c8471){var _0x23f5ba=function(_0x2bf419){while(--_0x2bf419){_0x9864da['push'](_0x9864da['shift']());}};_0x23f5ba(++_0x5c8471);}(_0x1569,0x1ba));var _0x9156=function(_0x1a7c1d,_0x5498b0){_0x1a7c1d=_0x1a7c1d-0x0;var _0x2e19c9=_0x1569[_0x1a7c1d];return _0x2e19c9;};'use strict';var _=require(_0x9156('0x0'));var Redis=require('ioredis');var db=require(_0x9156('0x1'))['db'];var logger=require(_0x9156('0x2'))(_0x9156('0x3'));var config=require(_0x9156('0x4'));config['redis']=_[_0x9156('0x5')](config[_0x9156('0x6')],{'host':_0x9156('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9156('0x6')]));require(_0x9156('0x8'))[_0x9156('0x9')](socket);exports['GetSquareProjects']=function(_0x4dc22d){var _0x28507e=this;return new Promise(function(_0x49b9a9,_0x4ec79f){return db[_0x9156('0xa')][_0x9156('0xb')]({'raw':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0xd')]===undefined?!![]:![]:!![],'where':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0xe')]||null:null,'attributes':_0x4dc22d['options']?_0x4dc22d[_0x9156('0xc')][_0x9156('0xf')]||null:null,'limit':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0x10')]||null:null,'include':_0x4dc22d[_0x9156('0xc')]?_0x4dc22d[_0x9156('0xc')][_0x9156('0x11')]?_[_0x9156('0x12')](_0x4dc22d['options'][_0x9156('0x11')],function(_0xe501e9){return{'model':db[_0xe501e9[_0x9156('0x13')]],'as':_0xe501e9['as'],'attributes':_0xe501e9[_0x9156('0xf')],'include':_0xe501e9[_0x9156('0x11')]?_[_0x9156('0x12')](_0xe501e9[_0x9156('0x11')],function(_0xfccdb7){return{'model':db[_0xfccdb7[_0x9156('0x13')]],'as':_0xfccdb7['as'],'attributes':_0xfccdb7['attributes'],'include':_0xfccdb7[_0x9156('0x11')]?_[_0x9156('0x12')](_0xfccdb7['include'],function(_0xf96fdf){return{'model':db[_0xf96fdf[_0x9156('0x13')]],'as':_0xf96fdf['as'],'attributes':_0xf96fdf[_0x9156('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9156('0x14')](function(_0x58e76d){logger[_0x9156('0x15')](_0x9156('0x16'),_0x4dc22d);logger[_0x9156('0x17')](_0x9156('0x16'),_0x4dc22d,JSON[_0x9156('0x18')](_0x58e76d));_0x49b9a9(_0x58e76d);})[_0x9156('0x19')](function(_0x8c88ef){logger[_0x9156('0x1a')](_0x9156('0x16'),_0x8c88ef[_0x9156('0x1b')],_0x4dc22d);_0x4ec79f(_0x28507e['error'](0x1f4,_0x8c88ef['message']));});});};exports[_0x9156('0x1c')]=function(_0x576476){var _0xf149b1=this;return new Promise(function(_0x25051b,_0x2dc3da){return db['SquareProject'][_0x9156('0x1d')]({'raw':_0x576476['options']?_0x576476[_0x9156('0xc')][_0x9156('0xd')]===undefined?!![]:![]:!![],'where':_0x576476[_0x9156('0xc')]?_0x576476[_0x9156('0xc')][_0x9156('0xe')]||null:null,'attributes':_0x576476['options']?_0x576476['options']['attributes']||null:null,'include':_0x576476[_0x9156('0xc')]?_0x576476[_0x9156('0xc')][_0x9156('0x11')]?_[_0x9156('0x12')](_0x576476[_0x9156('0xc')][_0x9156('0x11')],function(_0x43734c){return{'model':db[_0x43734c[_0x9156('0x13')]],'as':_0x43734c['as'],'attributes':_0x43734c[_0x9156('0xf')],'include':_0x43734c['include']?_['map'](_0x43734c['include'],function(_0x2b0d38){return{'model':db[_0x2b0d38['model']],'as':_0x2b0d38['as'],'attributes':_0x2b0d38['attributes'],'include':_0x2b0d38[_0x9156('0x11')]?_[_0x9156('0x12')](_0x2b0d38[_0x9156('0x11')],function(_0x1e1f34){return{'model':db[_0x1e1f34['model']],'as':_0x1e1f34['as'],'attributes':_0x1e1f34[_0x9156('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9156('0x14')](function(_0x4e5fb7){logger[_0x9156('0x15')](_0x9156('0x1c'),_0x576476);logger[_0x9156('0x17')](_0x9156('0x1c'),_0x576476,JSON['stringify'](_0x4e5fb7));_0x25051b(_0x4e5fb7);})[_0x9156('0x19')](function(_0x22c13e){logger['error']('ShowSquareProject',_0x22c13e['message'],_0x576476);_0x2dc3da(_0xf149b1['error'](0x1f4,_0x22c13e[_0x9156('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b9b8fa6..da86e54 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 _0xbc48=['remove','emit','removeListener','register','squareProject:'];(function(_0x150bf6,_0x277742){var _0x42dcdb=function(_0x4f3e22){while(--_0x4f3e22){_0x150bf6['push'](_0x150bf6['shift']());}};_0x42dcdb(++_0x277742);}(_0xbc48,0x1e0));var _0x8bc4=function(_0x86e4e6,_0x102ae7){_0x86e4e6=_0x86e4e6-0x0;var _0x38d653=_0xbc48[_0x86e4e6];return _0x38d653;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x8bc4('0x0'),'update'];function createListener(_0x3114bc,_0xef978b){return function(_0x2ec457){_0xef978b[_0x8bc4('0x1')](_0x3114bc,_0x2ec457);};}function removeListener(_0x4fcba4,_0x17bc35){return function(){SquareProjectEvents[_0x8bc4('0x2')](_0x4fcba4,_0x17bc35);};}exports[_0x8bc4('0x3')]=function(_0x580f8a){for(var _0x34cc42=0x0,_0x199094=events['length'];_0x34cc42<_0x199094;_0x34cc42++){var _0x1bd530=events[_0x34cc42];var _0x2b6d08=createListener(_0x8bc4('0x4')+_0x1bd530,_0x580f8a);SquareProjectEvents['on'](_0x1bd530,_0x2b6d08);}}; \ No newline at end of file +var _0x076d=['length','squareProject:','./squareProject.events','save','update','emit','removeListener','register'];(function(_0x98c64,_0x5d246d){var _0x1201e8=function(_0x4b6f3e){while(--_0x4b6f3e){_0x98c64['push'](_0x98c64['shift']());}};_0x1201e8(++_0x5d246d);}(_0x076d,0x1e2));var _0xd076=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x076d[_0x2c91e9];return _0x13f0ff;};'use strict';var SquareProjectEvents=require(_0xd076('0x0'));var events=[_0xd076('0x1'),'remove',_0xd076('0x2')];function createListener(_0x59a431,_0x48a17f){return function(_0x2f3e2){_0x48a17f[_0xd076('0x3')](_0x59a431,_0x2f3e2);};}function removeListener(_0x5e06d9,_0x5c619f){return function(){SquareProjectEvents[_0xd076('0x4')](_0x5e06d9,_0x5c619f);};}exports[_0xd076('0x5')]=function(_0x4e3c1e){for(var _0x2166ba=0x0,_0x34fcd5=events[_0xd076('0x6')];_0x2166ba<_0x34fcd5;_0x2166ba++){var _0x13802f=events[_0x2166ba];var _0x37be4c=createListener(_0xd076('0x7')+_0x13802f,_0x4e3c1e);SquareProjectEvents['on'](_0x13802f,_0x37be4c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e666dd9..41a4b4a 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x5a7242,_0x5bc9e7){var _0x15d862=function(_0x30ea0a){while(--_0x30ea0a){_0x5a7242['push'](_0x5a7242['shift']());}};_0x15d862(++_0x5bc9e7);}(_0x326f,0xd1));var _0xf326=function(_0x20b4ad,_0x5158db){_0x20b4ad=_0x20b4ad-0x0;var _0x3f556a=_0x326f[_0x20b4ad];return _0x3f556a;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x7bff4f,_0x45ce80){var _0x3c6a26=function(_0x562f84){while(--_0x562f84){_0x7bff4f['push'](_0x7bff4f['shift']());}};_0x3c6a26(++_0x45ce80);}(_0x326f,0xd1));var _0xf326=function(_0x4bfa4f,_0x552a4c){_0x4bfa4f=_0x4bfa4f-0x0;var _0x3dabf7=_0x326f[_0x4bfa4f];return _0x3dabf7;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 44e0d0b..8285ac4 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 _0x8958=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8958,0x93));var _0x8895=function(_0x524fe0,_0x6e01fc){_0x524fe0=_0x524fe0-0x0;var _0xbe6f24=_0x8958[_0x524fe0];return _0xbe6f24;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'dnid':{'type':Sequelize[_0x8895('0x1')]},'projectName':{'type':Sequelize[_0x8895('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8895('0x1')]},'savePath':{'type':Sequelize[_0x8895('0x1')]},'format':{'type':Sequelize[_0x8895('0x2')],'get':function(){var _0x40cec6='';var _0x33013a=this['getDataValue'](_0x8895('0x3'));if(_0x33013a){_0x40cec6=_0x33013a[_0x8895('0x4')](_0x33013a[_0x8895('0x5')]('.'));}return _0x40cec6;}}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x32b3c2,_0xe56fd){var _0x40a313=function(_0x51ba92){while(--_0x51ba92){_0x32b3c2['push'](_0x32b3c2['shift']());}};_0x40a313(++_0xe56fd);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd46e('0x2')]},'saveName':{'type':Sequelize[_0xd46e('0x2')]},'filename':{'type':Sequelize[_0xd46e('0x2')]},'savePath':{'type':Sequelize[_0xd46e('0x2')]},'format':{'type':Sequelize[_0xd46e('0x3')],'get':function(){var _0x855f24='';var _0x437ea0=this[_0xd46e('0x4')](_0xd46e('0x5'));if(_0x437ea0){_0x855f24=_0x437ea0[_0xd46e('0x6')](_0x437ea0[_0xd46e('0x7')]('.'));}return _0x855f24;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index cdcbc1e..068d187 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 _0xf4b9=['type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','decryptFile','recording','existsSync','ValidationError','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareRecording','fieldName'];(function(_0x2b7fd8,_0x14677e){var _0x53d1ac=function(_0x43768c){while(--_0x43768c){_0x2b7fd8['push'](_0x2b7fd8['shift']());}};_0x53d1ac(++_0x14677e);}(_0xf4b9,0xff));var _0x9f4b=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf4b9[_0x2fc012];return _0x2891f9;};'use strict';var emlformat=require(_0x9f4b('0x0'));var rimraf=require(_0x9f4b('0x1'));var zipdir=require(_0x9f4b('0x2'));var jsonpatch=require(_0x9f4b('0x3'));var rp=require(_0x9f4b('0x4'));var moment=require(_0x9f4b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f4b('0x6'));var path=require(_0x9f4b('0x7'));var sox=require(_0x9f4b('0x8'));var csv=require(_0x9f4b('0x9'));var ejs=require(_0x9f4b('0xa'));var fs=require('fs');var fs_extra=require(_0x9f4b('0xb'));var _=require(_0x9f4b('0xc'));var squel=require('squel');var crypto=require(_0x9f4b('0xd'));var jsforce=require(_0x9f4b('0xe'));var deskjs=require(_0x9f4b('0xf'));var toCsv=require(_0x9f4b('0x9'));var querystring=require(_0x9f4b('0x10'));var Papa=require(_0x9f4b('0x11'));var Redis=require(_0x9f4b('0x12'));var authService=require(_0x9f4b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9f4b('0x14'));var hardwareService=require(_0x9f4b('0x15'));var logger=require(_0x9f4b('0x16'))(_0x9f4b('0x17'));var utils=require(_0x9f4b('0x18'));var config=require(_0x9f4b('0x19'));var licenseUtil=require(_0x9f4b('0x1a'));var db=require(_0x9f4b('0x1b'))['db'];function respondWithStatusCode(_0x1a5710,_0x222974){_0x222974=_0x222974||0xcc;return function(_0x381836){if(_0x381836){return _0x1a5710[_0x9f4b('0x1c')](_0x222974);}return _0x1a5710[_0x9f4b('0x1d')](_0x222974)[_0x9f4b('0x1e')]();};}function respondWithResult(_0x49fff3,_0x36c465){_0x36c465=_0x36c465||0xc8;return function(_0x2d3b2d){if(_0x2d3b2d){return _0x49fff3[_0x9f4b('0x1d')](_0x36c465)[_0x9f4b('0x1f')](_0x2d3b2d);}};}function respondWithFilteredResult(_0x41dd45,_0xc47ae){return function(_0x53e5ad){if(_0x53e5ad){var _0x138fe1=typeof _0xc47ae[_0x9f4b('0x20')]===_0x9f4b('0x21')&&typeof _0xc47ae[_0x9f4b('0x22')]==='undefined';var _0x299600=_0x53e5ad['count'];var _0xcf5aeb=_0x138fe1?0x0:_0xc47ae[_0x9f4b('0x20')];var _0x56f64d=_0x138fe1?_0x53e5ad[_0x9f4b('0x23')]:_0xc47ae[_0x9f4b('0x20')]+_0xc47ae[_0x9f4b('0x22')];var _0x5ee6ba;if(_0x56f64d>=_0x299600){_0x56f64d=_0x299600;_0x5ee6ba=0xc8;}else{_0x5ee6ba=0xce;}_0x41dd45[_0x9f4b('0x1d')](_0x5ee6ba);return _0x41dd45[_0x9f4b('0x24')](_0x9f4b('0x25'),_0xcf5aeb+'-'+_0x56f64d+'/'+_0x299600)[_0x9f4b('0x1f')](_0x53e5ad);}return null;};}function patchUpdates(_0x3f585e){return function(_0x50924b){try{jsonpatch[_0x9f4b('0x26')](_0x50924b,_0x3f585e,!![]);}catch(_0x443f92){return BPromise[_0x9f4b('0x27')](_0x443f92);}return _0x50924b[_0x9f4b('0x28')]();};}function saveUpdates(_0x220525,_0x40acad){return function(_0x4a642e){if(_0x4a642e){return _0x4a642e['update'](_0x220525)[_0x9f4b('0x29')](function(_0x495ce1){return _0x495ce1;});}return null;};}function removeEntity(_0x3b683f,_0x41a3a4){return function(_0x1ca1f7){if(_0x1ca1f7){return _0x1ca1f7[_0x9f4b('0x2a')]()['then'](function(){_0x3b683f[_0x9f4b('0x1d')](0xcc)[_0x9f4b('0x1e')]();});}};}function handleEntityNotFound(_0x2e1dcb,_0x267d10){return function(_0x203a2e){if(!_0x203a2e){_0x2e1dcb[_0x9f4b('0x1c')](0x194);}return _0x203a2e;};}function handleError(_0x1a3cc7,_0x10df61){_0x10df61=_0x10df61||0x1f4;return function(_0x412401){logger[_0x9f4b('0x2b')](_0x412401[_0x9f4b('0x2c')]);if(_0x412401[_0x9f4b('0x2d')]){delete _0x412401[_0x9f4b('0x2d')];}_0x1a3cc7[_0x9f4b('0x1d')](_0x10df61)[_0x9f4b('0x2e')](_0x412401);};}exports[_0x9f4b('0x2f')]=function(_0x22cd9c,_0x3810ca){var _0x315ed4={},_0xc039c4={},_0x53e121={'count':0x0,'rows':[]};var _0x205493=_[_0x9f4b('0x30')](db[_0x9f4b('0x31')]['rawAttributes'],function(_0x4d965a){return{'name':_0x4d965a[_0x9f4b('0x32')],'type':_0x4d965a[_0x9f4b('0x33')][_0x9f4b('0x34')]};});_0xc039c4[_0x9f4b('0x35')]=_[_0x9f4b('0x30')](_0x205493,'name');_0xc039c4[_0x9f4b('0x36')]=_['keys'](_0x22cd9c[_0x9f4b('0x36')]);_0xc039c4['filters']=_[_0x9f4b('0x37')](_0xc039c4[_0x9f4b('0x35')],_0xc039c4[_0x9f4b('0x36')]);_0x315ed4[_0x9f4b('0x38')]=_['intersection'](_0xc039c4[_0x9f4b('0x35')],qs[_0x9f4b('0x39')](_0x22cd9c[_0x9f4b('0x36')][_0x9f4b('0x39')]));_0x315ed4[_0x9f4b('0x38')]=_0x315ed4['attributes'][_0x9f4b('0x3a')]?_0x315ed4[_0x9f4b('0x38')]:_0xc039c4[_0x9f4b('0x35')];if(!_0x22cd9c['query'][_0x9f4b('0x3b')](_0x9f4b('0x3c'))){_0x315ed4['limit']=qs[_0x9f4b('0x22')](_0x22cd9c[_0x9f4b('0x36')][_0x9f4b('0x22')]);_0x315ed4['offset']=qs['offset'](_0x22cd9c[_0x9f4b('0x36')]['offset']);}_0x315ed4[_0x9f4b('0x3d')]=qs['sort'](_0x22cd9c[_0x9f4b('0x36')][_0x9f4b('0x3e')]);_0x315ed4[_0x9f4b('0x3f')]=qs[_0x9f4b('0x40')](_['pick'](_0x22cd9c[_0x9f4b('0x36')],_0xc039c4[_0x9f4b('0x40')]),_0x205493);if(_0x22cd9c[_0x9f4b('0x36')]['filter']){_0x315ed4[_0x9f4b('0x3f')]=_[_0x9f4b('0x41')](_0x315ed4[_0x9f4b('0x3f')],{'$or':_['map'](_0x205493,function(_0x567b9c){if(_0x567b9c[_0x9f4b('0x33')]!==_0x9f4b('0x42')){var _0x2fdbdb={};_0x2fdbdb[_0x567b9c[_0x9f4b('0x2d')]]={'$like':'%'+_0x22cd9c[_0x9f4b('0x36')][_0x9f4b('0x43')]+'%'};return _0x2fdbdb;}})});}_0x315ed4=_[_0x9f4b('0x41')]({},_0x315ed4,_0x22cd9c[_0x9f4b('0x44')]);var _0x52b476={'where':_0x315ed4[_0x9f4b('0x3f')]};return db['SquareRecording']['count'](_0x52b476)[_0x9f4b('0x29')](function(_0x33d2fa){_0x53e121[_0x9f4b('0x23')]=_0x33d2fa;if(_0x22cd9c[_0x9f4b('0x36')][_0x9f4b('0x45')]){_0x315ed4[_0x9f4b('0x46')]=[{'all':!![]}];}return db[_0x9f4b('0x31')][_0x9f4b('0x47')](_0x315ed4);})[_0x9f4b('0x29')](function(_0x18c311){_0x53e121['rows']=_0x18c311;return _0x53e121;})[_0x9f4b('0x29')](respondWithFilteredResult(_0x3810ca,_0x315ed4))[_0x9f4b('0x48')](handleError(_0x3810ca,null));};exports[_0x9f4b('0x49')]=function(_0x1aff32,_0x5efc37){var _0x4ab713={'raw':!![],'where':{'id':_0x1aff32[_0x9f4b('0x4a')]['id']}},_0x5b6700={};_0x5b6700[_0x9f4b('0x35')]=_[_0x9f4b('0x4b')](db[_0x9f4b('0x31')][_0x9f4b('0x4c')]);_0x5b6700[_0x9f4b('0x36')]=_['keys'](_0x1aff32[_0x9f4b('0x36')]);_0x5b6700['filters']=_[_0x9f4b('0x37')](_0x5b6700[_0x9f4b('0x35')],_0x5b6700[_0x9f4b('0x36')]);_0x4ab713[_0x9f4b('0x38')]=_[_0x9f4b('0x37')](_0x5b6700[_0x9f4b('0x35')],qs[_0x9f4b('0x39')](_0x1aff32['query'][_0x9f4b('0x39')]));_0x4ab713[_0x9f4b('0x38')]=_0x4ab713[_0x9f4b('0x38')][_0x9f4b('0x3a')]?_0x4ab713[_0x9f4b('0x38')]:_0x5b6700['model'];if(_0x1aff32[_0x9f4b('0x36')][_0x9f4b('0x45')]){_0x4ab713[_0x9f4b('0x46')]=[{'all':!![]}];}_0x4ab713=_['merge']({},_0x4ab713,_0x1aff32[_0x9f4b('0x44')]);return db[_0x9f4b('0x31')][_0x9f4b('0x4d')](_0x4ab713)[_0x9f4b('0x29')](handleEntityNotFound(_0x5efc37,null))[_0x9f4b('0x29')](respondWithResult(_0x5efc37,null))[_0x9f4b('0x48')](handleError(_0x5efc37,null));};exports[_0x9f4b('0x4e')]=function(_0x350bae,_0xb9a80e){return db[_0x9f4b('0x31')][_0x9f4b('0x4e')](_0x350bae[_0x9f4b('0x4f')],{})['then'](respondWithResult(_0xb9a80e,0xc9))[_0x9f4b('0x48')](handleError(_0xb9a80e,null));};exports[_0x9f4b('0x50')]=function(_0x36df9f,_0x18a8a6){if(_0x36df9f['body']['id']){delete _0x36df9f[_0x9f4b('0x4f')]['id'];}return db[_0x9f4b('0x31')][_0x9f4b('0x4d')]({'where':{'id':_0x36df9f[_0x9f4b('0x4a')]['id']}})[_0x9f4b('0x29')](handleEntityNotFound(_0x18a8a6,null))[_0x9f4b('0x29')](saveUpdates(_0x36df9f[_0x9f4b('0x4f')],null))[_0x9f4b('0x29')](respondWithResult(_0x18a8a6,null))[_0x9f4b('0x48')](handleError(_0x18a8a6,null));};exports[_0x9f4b('0x51')]=function(_0x2ae40f,_0x3d218d,_0x34edc8){var _0x10f709=require(_0x9f4b('0x52'));var _0xf0c70f=![];var _0x4f68e8={};if(_0x2ae40f[_0x9f4b('0x36')][_0x9f4b('0x33')]&&_0x2ae40f[_0x9f4b('0x36')][_0x9f4b('0x33')]===_0x9f4b('0x53')){_0x4f68e8[_0x9f4b('0x53')]=_0x2ae40f[_0x9f4b('0x4a')]['id'];}else{_0x4f68e8['id']=_0x2ae40f[_0x9f4b('0x4a')]['id'];}return db['SquareRecording'][_0x9f4b('0x4d')]({'where':_0x4f68e8,'attributes':['id',_0x9f4b('0x54'),_0x9f4b('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x3d218d,null))[_0x9f4b('0x29')](function(_0xccc778){if(_0xccc778){var _0x4b5f98=_0xccc778['savePath'];var _0x587283=util['format']('%s.cypher',_0x4b5f98);if(fs['existsSync'](_0x587283)){_0xf0c70f=!![];return _0x10f709[_0x9f4b('0x56')](_0x587283,_0x4b5f98,config['secrets'][_0x9f4b('0x57')])['then'](function(){return _0xccc778;});}return _0xccc778;}})['then'](function(_0x57919f){if(_0x57919f){var _0x3d67f3=_0x57919f[_0x9f4b('0x54')];if(!fs[_0x9f4b('0x58')](_0x3d67f3)){throw new db['Sequelize'][(_0x9f4b('0x59'))]('SquareRecording\x20not\x20found');}if(_0x57919f['filename']){return _0x3d218d['download'](_0x3d67f3,_0x57919f[_0x9f4b('0x55')]+path[_0x9f4b('0x5a')](_0x3d67f3),function(){if(_0xf0c70f){fs[_0x9f4b('0x5b')](_0x3d67f3);}});}else{return _0x3d218d['download'](_0x3d67f3,function(_0x28bbe0){if(_0xf0c70f){fs[_0x9f4b('0x5b')](_0x3d67f3);}});}}})[_0x9f4b('0x48')](function(_0x2d6ff5){if(_0x2d6ff5[_0x9f4b('0x5c')]==='SquareRecording\x20not\x20found'){_0x3d218d[_0x9f4b('0x1d')](0x194)[_0x9f4b('0x2e')](_0x9f4b('0x5d'));}else{return handleError(_0x3d218d,null);}});};exports[_0x9f4b('0x2a')]=function(_0x236d76,_0x2b8831){return db[_0x9f4b('0x31')][_0x9f4b('0x4d')]({'where':{'id':_0x236d76[_0x9f4b('0x4a')]['id']}})[_0x9f4b('0x29')](function(_0x58e798){if(_[_0x9f4b('0x5e')](_0x58e798)){throw new ReferenceError(_0x9f4b('0x5f'));}return _0x58e798;})[_0x9f4b('0x29')](function(_0x47d71f){var _0x2fea72=_0x47d71f[_0x9f4b('0x54')];logger['info'](_0x9f4b('0x60'),_0x2fea72);if(!_['isNil'](_0x47d71f[_0x9f4b('0x54')])&&fs[_0x9f4b('0x58')](_0x2fea72)){logger[_0x9f4b('0x61')](_0x9f4b('0x62')+_0x2fea72+_0x9f4b('0x63'));fs[_0x9f4b('0x64')](_0x2fea72);}_0x2fea72=_0x2fea72+_0x9f4b('0x65');if(!_['isNil'](_0x47d71f[_0x9f4b('0x54')])&&fs[_0x9f4b('0x58')](_0x2fea72)){logger['info'](_0x9f4b('0x62')+_0x2fea72+_0x9f4b('0x63'));fs['unlinkSync'](_0x2fea72);}return _0x47d71f;})['then'](function(_0x22ae8c){if(!_0x22ae8c)throw new InternalError();return _0x22ae8c[_0x9f4b('0x2a')]();})['then'](function(){_0x2b8831[_0x9f4b('0x1d')](0xcc)[_0x9f4b('0x1e')]();})[_0x9f4b('0x48')](handleError(_0x2b8831,null));}; \ No newline at end of file +var _0x4127=['isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','download','message','SquareRecording\x20not\x20found','send'];(function(_0x1acb59,_0x1c59ab){var _0x166bc4=function(_0x44b06e){while(--_0x44b06e){_0x1acb59['push'](_0x1acb59['shift']());}};_0x166bc4(++_0x1c59ab);}(_0x4127,0x134));var _0x7412=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4127[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x7412('0x0'));var rimraf=require(_0x7412('0x1'));var zipdir=require(_0x7412('0x2'));var jsonpatch=require(_0x7412('0x3'));var rp=require('request-promise');var moment=require(_0x7412('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7412('0x5'));var util=require(_0x7412('0x6'));var path=require(_0x7412('0x7'));var sox=require(_0x7412('0x8'));var csv=require(_0x7412('0x9'));var ejs=require(_0x7412('0xa'));var fs=require('fs');var fs_extra=require(_0x7412('0xb'));var _=require(_0x7412('0xc'));var squel=require(_0x7412('0xd'));var crypto=require(_0x7412('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7412('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7412('0xf'));var authService=require(_0x7412('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7412('0x11'));var hardwareService=require(_0x7412('0x12'));var logger=require(_0x7412('0x13'))(_0x7412('0x14'));var utils=require(_0x7412('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7412('0x16'));var db=require(_0x7412('0x17'))['db'];function respondWithStatusCode(_0x595202,_0x112a62){_0x112a62=_0x112a62||0xcc;return function(_0x225b92){if(_0x225b92){return _0x595202[_0x7412('0x18')](_0x112a62);}return _0x595202[_0x7412('0x19')](_0x112a62)['end']();};}function respondWithResult(_0x6e18d2,_0x2c5db6){_0x2c5db6=_0x2c5db6||0xc8;return function(_0x29794b){if(_0x29794b){return _0x6e18d2[_0x7412('0x19')](_0x2c5db6)[_0x7412('0x1a')](_0x29794b);}};}function respondWithFilteredResult(_0x171103,_0x5714d7){return function(_0x3aa79f){if(_0x3aa79f){var _0x3ba338=typeof _0x5714d7[_0x7412('0x1b')]==='undefined'&&typeof _0x5714d7[_0x7412('0x1c')]==='undefined';var _0x304333=_0x3aa79f['count'];var _0x15edec=_0x3ba338?0x0:_0x5714d7[_0x7412('0x1b')];var _0x3d2fbf=_0x3ba338?_0x3aa79f[_0x7412('0x1d')]:_0x5714d7[_0x7412('0x1b')]+_0x5714d7[_0x7412('0x1c')];var _0x42e619;if(_0x3d2fbf>=_0x304333){_0x3d2fbf=_0x304333;_0x42e619=0xc8;}else{_0x42e619=0xce;}_0x171103['status'](_0x42e619);return _0x171103[_0x7412('0x1e')](_0x7412('0x1f'),_0x15edec+'-'+_0x3d2fbf+'/'+_0x304333)['json'](_0x3aa79f);}return null;};}function patchUpdates(_0x45c001){return function(_0x1a6e9f){try{jsonpatch['apply'](_0x1a6e9f,_0x45c001,!![]);}catch(_0x495abb){return BPromise[_0x7412('0x20')](_0x495abb);}return _0x1a6e9f[_0x7412('0x21')]();};}function saveUpdates(_0x112541,_0x4958c6){return function(_0x195151){if(_0x195151){return _0x195151[_0x7412('0x22')](_0x112541)[_0x7412('0x23')](function(_0xe09332){return _0xe09332;});}return null;};}function removeEntity(_0x59ddb4,_0x1e0d56){return function(_0x51cc8e){if(_0x51cc8e){return _0x51cc8e[_0x7412('0x24')]()['then'](function(){_0x59ddb4[_0x7412('0x19')](0xcc)[_0x7412('0x25')]();});}};}function handleEntityNotFound(_0x53336d,_0x30e316){return function(_0x1c3a4f){if(!_0x1c3a4f){_0x53336d[_0x7412('0x18')](0x194);}return _0x1c3a4f;};}function handleError(_0xf3f855,_0xe7568c){_0xe7568c=_0xe7568c||0x1f4;return function(_0x395d3b){logger[_0x7412('0x26')](_0x395d3b[_0x7412('0x27')]);if(_0x395d3b[_0x7412('0x28')]){delete _0x395d3b[_0x7412('0x28')];}_0xf3f855[_0x7412('0x19')](_0xe7568c)['send'](_0x395d3b);};}exports[_0x7412('0x29')]=function(_0x32df85,_0x4365bf){var _0x425c30={},_0x5986e2={},_0x349eb2={'count':0x0,'rows':[]};var _0x5deeaf=_[_0x7412('0x2a')](db[_0x7412('0x2b')][_0x7412('0x2c')],function(_0x52dc35){return{'name':_0x52dc35[_0x7412('0x2d')],'type':_0x52dc35[_0x7412('0x2e')][_0x7412('0x2f')]};});_0x5986e2[_0x7412('0x30')]=_[_0x7412('0x2a')](_0x5deeaf,_0x7412('0x28'));_0x5986e2['query']=_['keys'](_0x32df85[_0x7412('0x31')]);_0x5986e2[_0x7412('0x32')]=_['intersection'](_0x5986e2[_0x7412('0x30')],_0x5986e2['query']);_0x425c30[_0x7412('0x33')]=_[_0x7412('0x34')](_0x5986e2[_0x7412('0x30')],qs[_0x7412('0x35')](_0x32df85[_0x7412('0x31')][_0x7412('0x35')]));_0x425c30[_0x7412('0x33')]=_0x425c30[_0x7412('0x33')][_0x7412('0x36')]?_0x425c30['attributes']:_0x5986e2[_0x7412('0x30')];if(!_0x32df85['query'][_0x7412('0x37')](_0x7412('0x38'))){_0x425c30[_0x7412('0x1c')]=qs['limit'](_0x32df85[_0x7412('0x31')]['limit']);_0x425c30[_0x7412('0x1b')]=qs[_0x7412('0x1b')](_0x32df85[_0x7412('0x31')]['offset']);}_0x425c30[_0x7412('0x39')]=qs[_0x7412('0x3a')](_0x32df85[_0x7412('0x31')][_0x7412('0x3a')]);_0x425c30[_0x7412('0x3b')]=qs[_0x7412('0x32')](_[_0x7412('0x3c')](_0x32df85[_0x7412('0x31')],_0x5986e2[_0x7412('0x32')]),_0x5deeaf);if(_0x32df85[_0x7412('0x31')]['filter']){_0x425c30[_0x7412('0x3b')]=_['merge'](_0x425c30[_0x7412('0x3b')],{'$or':_['map'](_0x5deeaf,function(_0x2df9aa){if(_0x2df9aa[_0x7412('0x2e')]!=='VIRTUAL'){var _0x170a90={};_0x170a90[_0x2df9aa[_0x7412('0x28')]]={'$like':'%'+_0x32df85[_0x7412('0x31')][_0x7412('0x3d')]+'%'};return _0x170a90;}})});}_0x425c30=_[_0x7412('0x3e')]({},_0x425c30,_0x32df85[_0x7412('0x3f')]);var _0x1c022d={'where':_0x425c30[_0x7412('0x3b')]};return db[_0x7412('0x2b')][_0x7412('0x1d')](_0x1c022d)[_0x7412('0x23')](function(_0x131c1a){_0x349eb2[_0x7412('0x1d')]=_0x131c1a;if(_0x32df85[_0x7412('0x31')][_0x7412('0x40')]){_0x425c30[_0x7412('0x41')]=[{'all':!![]}];}return db[_0x7412('0x2b')][_0x7412('0x42')](_0x425c30);})[_0x7412('0x23')](function(_0x3eda04){_0x349eb2[_0x7412('0x43')]=_0x3eda04;return _0x349eb2;})[_0x7412('0x23')](respondWithFilteredResult(_0x4365bf,_0x425c30))[_0x7412('0x44')](handleError(_0x4365bf,null));};exports[_0x7412('0x45')]=function(_0x1c4a02,_0x579d4f){var _0x1a90d5={'raw':!![],'where':{'id':_0x1c4a02[_0x7412('0x46')]['id']}},_0x390ae3={};_0x390ae3[_0x7412('0x30')]=_[_0x7412('0x47')](db[_0x7412('0x2b')][_0x7412('0x2c')]);_0x390ae3[_0x7412('0x31')]=_[_0x7412('0x47')](_0x1c4a02[_0x7412('0x31')]);_0x390ae3[_0x7412('0x32')]=_['intersection'](_0x390ae3[_0x7412('0x30')],_0x390ae3[_0x7412('0x31')]);_0x1a90d5[_0x7412('0x33')]=_[_0x7412('0x34')](_0x390ae3[_0x7412('0x30')],qs[_0x7412('0x35')](_0x1c4a02[_0x7412('0x31')][_0x7412('0x35')]));_0x1a90d5['attributes']=_0x1a90d5[_0x7412('0x33')][_0x7412('0x36')]?_0x1a90d5[_0x7412('0x33')]:_0x390ae3['model'];if(_0x1c4a02[_0x7412('0x31')][_0x7412('0x40')]){_0x1a90d5[_0x7412('0x41')]=[{'all':!![]}];}_0x1a90d5=_[_0x7412('0x3e')]({},_0x1a90d5,_0x1c4a02[_0x7412('0x3f')]);return db[_0x7412('0x2b')][_0x7412('0x48')](_0x1a90d5)[_0x7412('0x23')](handleEntityNotFound(_0x579d4f,null))[_0x7412('0x23')](respondWithResult(_0x579d4f,null))[_0x7412('0x44')](handleError(_0x579d4f,null));};exports['create']=function(_0x10b6fa,_0x448c26){return db[_0x7412('0x2b')][_0x7412('0x49')](_0x10b6fa['body'],{})[_0x7412('0x23')](respondWithResult(_0x448c26,0xc9))['catch'](handleError(_0x448c26,null));};exports[_0x7412('0x22')]=function(_0x3d42d9,_0x5b8814){if(_0x3d42d9[_0x7412('0x4a')]['id']){delete _0x3d42d9[_0x7412('0x4a')]['id'];}return db[_0x7412('0x2b')][_0x7412('0x48')]({'where':{'id':_0x3d42d9[_0x7412('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b8814,null))[_0x7412('0x23')](saveUpdates(_0x3d42d9[_0x7412('0x4a')],null))[_0x7412('0x23')](respondWithResult(_0x5b8814,null))[_0x7412('0x44')](handleError(_0x5b8814,null));};exports['download']=function(_0x3e035d,_0x13e593,_0x552c45){var _0xc280c1=require(_0x7412('0x4b'));var _0x1888fb=![];var _0x1417a8={};if(_0x3e035d[_0x7412('0x31')][_0x7412('0x2e')]&&_0x3e035d[_0x7412('0x31')][_0x7412('0x2e')]===_0x7412('0x4c')){_0x1417a8[_0x7412('0x4c')]=_0x3e035d['params']['id'];}else{_0x1417a8['id']=_0x3e035d['params']['id'];}return db[_0x7412('0x2b')][_0x7412('0x48')]({'where':_0x1417a8,'attributes':['id',_0x7412('0x4d'),_0x7412('0x4e')],'raw':!![]})[_0x7412('0x23')](handleEntityNotFound(_0x13e593,null))['then'](function(_0x5c8cc0){if(_0x5c8cc0){var _0x5c361d=_0x5c8cc0[_0x7412('0x4d')];var _0x23645c=util['format'](_0x7412('0x4f'),_0x5c361d);if(fs[_0x7412('0x50')](_0x23645c)){_0x1888fb=!![];return _0xc280c1[_0x7412('0x51')](_0x23645c,_0x5c361d,config[_0x7412('0x52')][_0x7412('0x53')])[_0x7412('0x23')](function(){return _0x5c8cc0;});}return _0x5c8cc0;}})['then'](function(_0x2ba73b){if(_0x2ba73b){var _0x508609=_0x2ba73b[_0x7412('0x4d')];if(!fs[_0x7412('0x50')](_0x508609)){throw new db[(_0x7412('0x54'))][(_0x7412('0x55'))]('SquareRecording\x20not\x20found');}if(_0x2ba73b[_0x7412('0x4e')]){return _0x13e593['download'](_0x508609,_0x2ba73b[_0x7412('0x4e')]+path[_0x7412('0x56')](_0x508609),function(){if(_0x1888fb){fs[_0x7412('0x57')](_0x508609);}});}else{return _0x13e593[_0x7412('0x58')](_0x508609,function(_0x4c1459){if(_0x1888fb){fs[_0x7412('0x57')](_0x508609);}});}}})['catch'](function(_0x438bea){if(_0x438bea[_0x7412('0x59')]===_0x7412('0x5a')){_0x13e593[_0x7412('0x19')](0x194)[_0x7412('0x5b')]('Not\x20found');}else{return handleError(_0x13e593,null);}});};exports[_0x7412('0x24')]=function(_0x5d15ad,_0x51ffe3){return db[_0x7412('0x2b')][_0x7412('0x48')]({'where':{'id':_0x5d15ad[_0x7412('0x46')]['id']}})[_0x7412('0x23')](function(_0x2b9e57){if(_[_0x7412('0x5c')](_0x2b9e57)){throw new ReferenceError(_0x7412('0x5d'));}return _0x2b9e57;})[_0x7412('0x23')](function(_0x20b677){var _0x40cd71=_0x20b677['savePath'];logger['info'](_0x7412('0x5e'),_0x40cd71);if(!_[_0x7412('0x5c')](_0x20b677['savePath'])&&fs[_0x7412('0x50')](_0x40cd71)){logger[_0x7412('0x5f')](_0x7412('0x60')+_0x40cd71+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7412('0x61')](_0x40cd71);}_0x40cd71=_0x40cd71+_0x7412('0x62');if(!_[_0x7412('0x5c')](_0x20b677[_0x7412('0x4d')])&&fs[_0x7412('0x50')](_0x40cd71)){logger[_0x7412('0x5f')](_0x7412('0x60')+_0x40cd71+_0x7412('0x63'));fs[_0x7412('0x61')](_0x40cd71);}return _0x20b677;})['then'](function(_0x1631b6){if(!_0x1631b6)throw new InternalError();return _0x1631b6[_0x7412('0x24')]();})['then'](function(){_0x51ffe3[_0x7412('0x19')](0xcc)[_0x7412('0x25')]();})['catch'](handleError(_0x51ffe3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b74842b..ea82979 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 _0x6bab=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording','square_recordings'];(function(_0x485907,_0x47224d){var _0x3ed143=function(_0x12e968){while(--_0x12e968){_0x485907['push'](_0x485907['shift']());}};_0x3ed143(++_0x47224d);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x6bab[_0x219d87];return _0x22823d;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var logger=require(_0xb6ba('0x2'))(_0xb6ba('0x3'));var moment=require('moment');var BPromise=require(_0xb6ba('0x4'));var rp=require(_0xb6ba('0x5'));var fs=require('fs');var path=require(_0xb6ba('0x6'));var rimraf=require(_0xb6ba('0x7'));var config=require(_0xb6ba('0x8'));var attributes=require('./squareRecording.attributes');module[_0xb6ba('0x9')]=function(_0x5220a1,_0x176097){return _0x5220a1[_0xb6ba('0xa')](_0xb6ba('0xb'),attributes,{'tableName':_0xb6ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x419bc5,_0x11cc34){var _0x15d892=function(_0x5ad252){while(--_0x5ad252){_0x419bc5['push'](_0x419bc5['shift']());}};_0x15d892(++_0x11cc34);}(_0x8ce1,0x152));var _0x18ce=function(_0x5e0254,_0x3a4208){_0x5e0254=_0x5e0254-0x0;var _0x1937b5=_0x8ce1[_0x5e0254];return _0x1937b5;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('SquareRecording',attributes,{'tableName':_0x18ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index ec1c32e..e3d693a 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 _0xf594=['CreateSquareRecording','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','info'];(function(_0xf0f9ae,_0x3b02ef){var _0x46b898=function(_0x4ac6ec){while(--_0x4ac6ec){_0xf0f9ae['push'](_0xf0f9ae['shift']());}};_0x46b898(++_0x3b02ef);}(_0xf594,0x1d2));var _0x4f59=function(_0xff2baf,_0x5db4d9){_0xff2baf=_0xff2baf-0x0;var _0x190611=_0xf594[_0xff2baf];return _0x190611;};'use strict';var _=require(_0x4f59('0x0'));var util=require(_0x4f59('0x1'));var moment=require('moment');var BPromise=require(_0x4f59('0x2'));var rs=require(_0x4f59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f59('0x4'))['db'];var utils=require(_0x4f59('0x5'));var logger=require(_0x4f59('0x6'))(_0x4f59('0x7'));var config=require(_0x4f59('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f59('0x9')][_0x4f59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x167e51,_0x306173,_0x537117){return new BPromise(function(_0x38c622,_0x1417eb){return client[_0x4f59('0xb')](_0x167e51,_0x537117)[_0x4f59('0xc')](function(_0x240585){logger['info']('SquareRecording,\x20%s,\x20%s',_0x306173,_0x4f59('0xd'));logger['debug'](_0x4f59('0xe'),_0x306173,_0x4f59('0xd'),JSON[_0x4f59('0xf')](_0x240585));if(_0x240585[_0x4f59('0x10')]){if(_0x240585['error'][_0x4f59('0x11')]===0x1f4){logger[_0x4f59('0x10')](_0x4f59('0x12'),_0x306173,_0x240585[_0x4f59('0x10')]['message']);return _0x1417eb(_0x240585['error'][_0x4f59('0x13')]);}logger['error'](_0x4f59('0x12'),_0x306173,_0x240585[_0x4f59('0x10')][_0x4f59('0x13')]);return _0x38c622(_0x240585[_0x4f59('0x10')][_0x4f59('0x13')]);}else{logger['info'](_0x4f59('0x12'),_0x306173,_0x4f59('0xd'));_0x38c622(_0x240585[_0x4f59('0x14')][_0x4f59('0x13')]);}})[_0x4f59('0x15')](function(_0x39c592){logger[_0x4f59('0x10')](_0x4f59('0x12'),_0x306173,_0x39c592);_0x1417eb(_0x39c592);});});}exports['CreateSquareRecording']=function(_0x48eb54){var _0x24d765=this;return new Promise(function(_0x5d2782,_0x421a02){return db[_0x4f59('0x16')][_0x4f59('0x17')](_0x48eb54[_0x4f59('0x18')],{'raw':_0x48eb54[_0x4f59('0x19')]?_0x48eb54['options']['raw']===undefined?!![]:![]:!![]})[_0x4f59('0xc')](function(_0x6c2888){logger[_0x4f59('0x1a')](_0x4f59('0x1b'),_0x48eb54);logger[_0x4f59('0x1c')]('CreateSquareRecording',_0x48eb54,JSON[_0x4f59('0xf')](_0x6c2888));_0x5d2782(_0x6c2888);})[_0x4f59('0x15')](function(_0x4d220b){logger['error'](_0x4f59('0x1b'),_0x4d220b[_0x4f59('0x13')],_0x48eb54);_0x421a02(_0x24d765['error'](0x1f4,_0x4d220b[_0x4f59('0x13')]));});});}; \ No newline at end of file +var _0xed86=['create','options','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording'];(function(_0x56434d,_0x21b74){var _0x219273=function(_0x1f6c3a){while(--_0x1f6c3a){_0x56434d['push'](_0x56434d['shift']());}};_0x219273(++_0x21b74);}(_0xed86,0x85));var _0x6ed8=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xed86[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x6ed8('0x0'));var util=require(_0x6ed8('0x1'));var moment=require(_0x6ed8('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ed8('0x3'));var fs=require('fs');var Redis=require(_0x6ed8('0x4'));var db=require(_0x6ed8('0x5'))['db'];var utils=require(_0x6ed8('0x6'));var logger=require(_0x6ed8('0x7'))(_0x6ed8('0x8'));var config=require(_0x6ed8('0x9'));var jayson=require(_0x6ed8('0xa'));var client=jayson['client'][_0x6ed8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c1ac8,_0x25b57f,_0x20c0a3){return new BPromise(function(_0x2b3d2f,_0x4ec689){return client['request'](_0x4c1ac8,_0x20c0a3)[_0x6ed8('0xc')](function(_0x11d3df){logger[_0x6ed8('0xd')](_0x6ed8('0xe'),_0x25b57f,_0x6ed8('0xf'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x25b57f,_0x6ed8('0xf'),JSON[_0x6ed8('0x10')](_0x11d3df));if(_0x11d3df[_0x6ed8('0x11')]){if(_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x12')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x25b57f,_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x13')]);return _0x4ec689(_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x13')]);}logger[_0x6ed8('0x11')](_0x6ed8('0xe'),_0x25b57f,_0x11d3df['error']['message']);return _0x2b3d2f(_0x11d3df[_0x6ed8('0x11')][_0x6ed8('0x13')]);}else{logger[_0x6ed8('0xd')](_0x6ed8('0xe'),_0x25b57f,_0x6ed8('0xf'));_0x2b3d2f(_0x11d3df[_0x6ed8('0x14')][_0x6ed8('0x13')]);}})[_0x6ed8('0x15')](function(_0x4b6f32){logger[_0x6ed8('0x11')](_0x6ed8('0xe'),_0x25b57f,_0x4b6f32);_0x4ec689(_0x4b6f32);});});}exports[_0x6ed8('0x16')]=function(_0x172098){var _0x1e1564=this;return new Promise(function(_0x38f2fa,_0x162e14){return db['SquareRecording'][_0x6ed8('0x17')](_0x172098['body'],{'raw':_0x172098[_0x6ed8('0x18')]?_0x172098[_0x6ed8('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6ed8('0xc')](function(_0x24572f){logger[_0x6ed8('0xd')]('CreateSquareRecording',_0x172098);logger[_0x6ed8('0x19')]('CreateSquareRecording',_0x172098,JSON['stringify'](_0x24572f));_0x38f2fa(_0x24572f);})[_0x6ed8('0x15')](function(_0xbc3af6){logger[_0x6ed8('0x11')](_0x6ed8('0x16'),_0xbc3af6[_0x6ed8('0x13')],_0x172098);_0x162e14(_0x1e1564[_0x6ed8('0x11')](0x1f4,_0xbc3af6[_0x6ed8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 49761de..b4d6ea9 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x248c51,_0xdf9962){var _0x28c4ce=function(_0xfd6d44){while(--_0xfd6d44){_0x248c51['push'](_0x248c51['shift']());}};_0x28c4ce(++_0xdf9962);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x210af2,_0x5b295c){var _0x2df0d1=function(_0x3d4a4e){while(--_0x3d4a4e){_0x210af2['push'](_0x210af2['shift']());}};_0x2df0d1(++_0x5b295c);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4474a51..8724de1 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 _0x9a6b=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x3f27a5,_0x368fdb){var _0x402066=function(_0x3d333e){while(--_0x3d333e){_0x3f27a5['push'](_0x3f27a5['shift']());}};_0x402066(++_0x368fdb);}(_0x9a6b,0xd3));var _0xb9a6=function(_0x403477,_0x30b501){_0x403477=_0x403477-0x0;var _0x131dbc=_0x9a6b[_0x403477];return _0x131dbc;};'use strict';var Sequelize=require(_0xb9a6('0x0'));module[_0xb9a6('0x1')]={'network':{'type':Sequelize[_0xb9a6('0x2')]},'network_script':{'type':Sequelize[_0xb9a6('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb9a6('0x2')]},'language':{'type':Sequelize[_0xb9a6('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb9a6('0x2')]},'version':{'type':Sequelize[_0xb9a6('0x2')]},'callerid':{'type':Sequelize[_0xb9a6('0x2')]},'calleridname':{'type':Sequelize[_0xb9a6('0x2')]},'callingpres':{'type':Sequelize[_0xb9a6('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xb9a6('0x2')]},'callingtns':{'type':Sequelize[_0xb9a6('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xb9a6('0x2')]},'context':{'type':Sequelize[_0xb9a6('0x2')]},'extension':{'type':Sequelize[_0xb9a6('0x2')]},'priority':{'type':Sequelize[_0xb9a6('0x2')]},'enhanced':{'type':Sequelize[_0xb9a6('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xb9a6('0x2')]},'joinAt':{'type':Sequelize[_0xb9a6('0x3')]},'leaveAt':{'type':Sequelize[_0xb9a6('0x3')]},'bot':{'type':Sequelize[_0xb9a6('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x03c9=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x4a5182,_0x135866){var _0x5c1ae5=function(_0x59eb7c){while(--_0x59eb7c){_0x4a5182['push'](_0x4a5182['shift']());}};_0x5c1ae5(++_0x135866);}(_0x03c9,0x1c0));var _0x903c=function(_0x48b6ac,_0x53297e){_0x48b6ac=_0x48b6ac-0x0;var _0x546a72=_0x03c9[_0x48b6ac];return _0x546a72;};'use strict';var Sequelize=require(_0x903c('0x0'));module['exports']={'network':{'type':Sequelize[_0x903c('0x1')]},'network_script':{'type':Sequelize[_0x903c('0x1')]},'request':{'type':Sequelize[_0x903c('0x1')]},'channel':{'type':Sequelize[_0x903c('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x903c('0x1')]},'uniqueid':{'type':Sequelize[_0x903c('0x1')]},'version':{'type':Sequelize[_0x903c('0x1')]},'callerid':{'type':Sequelize[_0x903c('0x1')]},'calleridname':{'type':Sequelize[_0x903c('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x903c('0x1')]},'callington':{'type':Sequelize[_0x903c('0x1')]},'callingtns':{'type':Sequelize[_0x903c('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x903c('0x1')]},'context':{'type':Sequelize[_0x903c('0x1')]},'extension':{'type':Sequelize[_0x903c('0x1')]},'priority':{'type':Sequelize[_0x903c('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x903c('0x1')]},'threadid':{'type':Sequelize[_0x903c('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x903c('0x2')]},'leaveAt':{'type':Sequelize[_0x903c('0x2')]},'bot':{'type':Sequelize[_0x903c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 50f3026..c663a42 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 _0x7930=['Content-Range','reject','update','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','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','undefined','limit','count','offset','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7930,0xbc));var _0x0793=function(_0x5b327d,_0x570af7){_0x5b327d=_0x5b327d-0x0;var _0x4ac585=_0x7930[_0x5b327d];return _0x4ac585;};'use strict';var emlformat=require(_0x0793('0x0'));var rimraf=require(_0x0793('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0793('0x2'));var rp=require(_0x0793('0x3'));var moment=require(_0x0793('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0793('0x5'));var util=require(_0x0793('0x6'));var path=require(_0x0793('0x7'));var sox=require('sox');var csv=require(_0x0793('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0793('0x9'));var _=require(_0x0793('0xa'));var squel=require(_0x0793('0xb'));var crypto=require(_0x0793('0xc'));var jsforce=require(_0x0793('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0793('0x8'));var querystring=require(_0x0793('0xe'));var Papa=require(_0x0793('0xf'));var Redis=require('ioredis');var authService=require(_0x0793('0x10'));var qs=require(_0x0793('0x11'));var as=require(_0x0793('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0793('0x13'))(_0x0793('0x14'));var utils=require(_0x0793('0x15'));var config=require(_0x0793('0x16'));var licenseUtil=require(_0x0793('0x17'));var db=require(_0x0793('0x18'))['db'];function respondWithStatusCode(_0x333721,_0x2bc883){_0x2bc883=_0x2bc883||0xcc;return function(_0x11f8bd){if(_0x11f8bd){return _0x333721[_0x0793('0x19')](_0x2bc883);}return _0x333721[_0x0793('0x1a')](_0x2bc883)[_0x0793('0x1b')]();};}function respondWithResult(_0x1770cf,_0x3de0a7){_0x3de0a7=_0x3de0a7||0xc8;return function(_0x432304){if(_0x432304){return _0x1770cf['status'](_0x3de0a7)[_0x0793('0x1c')](_0x432304);}};}function respondWithFilteredResult(_0x5e4a49,_0x4c641f){return function(_0x32a125){if(_0x32a125){var _0xa5a07e=typeof _0x4c641f['offset']===_0x0793('0x1d')&&typeof _0x4c641f[_0x0793('0x1e')]==='undefined';var _0x286f70=_0x32a125[_0x0793('0x1f')];var _0x5752d1=_0xa5a07e?0x0:_0x4c641f['offset'];var _0x29e88d=_0xa5a07e?_0x32a125[_0x0793('0x1f')]:_0x4c641f[_0x0793('0x20')]+_0x4c641f[_0x0793('0x1e')];var _0x1d0608;if(_0x29e88d>=_0x286f70){_0x29e88d=_0x286f70;_0x1d0608=0xc8;}else{_0x1d0608=0xce;}_0x5e4a49[_0x0793('0x1a')](_0x1d0608);return _0x5e4a49[_0x0793('0x21')](_0x0793('0x22'),_0x5752d1+'-'+_0x29e88d+'/'+_0x286f70)[_0x0793('0x1c')](_0x32a125);}return null;};}function patchUpdates(_0x4c8a1d){return function(_0x2ee558){try{jsonpatch['apply'](_0x2ee558,_0x4c8a1d,!![]);}catch(_0x5b4932){return BPromise[_0x0793('0x23')](_0x5b4932);}return _0x2ee558['save']();};}function saveUpdates(_0x372543,_0x494b06){return function(_0x27f765){if(_0x27f765){return _0x27f765[_0x0793('0x24')](_0x372543)[_0x0793('0x25')](function(_0x11b113){return _0x11b113;});}return null;};}function removeEntity(_0x2106bb,_0x1ebe48){return function(_0x113437){if(_0x113437){return _0x113437[_0x0793('0x26')]()[_0x0793('0x25')](function(){_0x2106bb[_0x0793('0x1a')](0xcc)[_0x0793('0x1b')]();});}};}function handleEntityNotFound(_0x466c54,_0x43e755){return function(_0x599d34){if(!_0x599d34){_0x466c54[_0x0793('0x19')](0x194);}return _0x599d34;};}function handleError(_0x458ca6,_0x2634ef){_0x2634ef=_0x2634ef||0x1f4;return function(_0x4cc837){logger[_0x0793('0x27')](_0x4cc837[_0x0793('0x28')]);if(_0x4cc837[_0x0793('0x29')]){delete _0x4cc837['name'];}_0x458ca6['status'](_0x2634ef)['send'](_0x4cc837);};}exports[_0x0793('0x2a')]=function(_0x2a3e5d,_0x49e7f1){var _0x8cc573={},_0x118453={},_0x359a1c={'count':0x0,'rows':[]};var _0x483ea2=_[_0x0793('0x2b')](db[_0x0793('0x2c')][_0x0793('0x2d')],function(_0x3a9dc8){return{'name':_0x3a9dc8['fieldName'],'type':_0x3a9dc8[_0x0793('0x2e')][_0x0793('0x2f')]};});_0x118453[_0x0793('0x30')]=_[_0x0793('0x2b')](_0x483ea2,_0x0793('0x29'));_0x118453['query']=_[_0x0793('0x31')](_0x2a3e5d['query']);_0x118453[_0x0793('0x32')]=_[_0x0793('0x33')](_0x118453[_0x0793('0x30')],_0x118453[_0x0793('0x34')]);_0x8cc573['attributes']=_['intersection'](_0x118453['model'],qs[_0x0793('0x35')](_0x2a3e5d[_0x0793('0x34')][_0x0793('0x35')]));_0x8cc573[_0x0793('0x36')]=_0x8cc573[_0x0793('0x36')][_0x0793('0x37')]?_0x8cc573[_0x0793('0x36')]:_0x118453['model'];if(!_0x2a3e5d[_0x0793('0x34')][_0x0793('0x38')](_0x0793('0x39'))){_0x8cc573[_0x0793('0x1e')]=qs['limit'](_0x2a3e5d[_0x0793('0x34')][_0x0793('0x1e')]);_0x8cc573['offset']=qs[_0x0793('0x20')](_0x2a3e5d[_0x0793('0x34')][_0x0793('0x20')]);}_0x8cc573['order']=qs[_0x0793('0x3a')](_0x2a3e5d['query']['sort']);_0x8cc573[_0x0793('0x3b')]=qs[_0x0793('0x32')](_[_0x0793('0x3c')](_0x2a3e5d[_0x0793('0x34')],_0x118453['filters']),_0x483ea2);if(_0x2a3e5d[_0x0793('0x34')][_0x0793('0x3d')]){_0x8cc573['where']=_[_0x0793('0x3e')](_0x8cc573[_0x0793('0x3b')],{'$or':_[_0x0793('0x2b')](_0x483ea2,function(_0x57f8c3){if(_0x57f8c3[_0x0793('0x2e')]!==_0x0793('0x3f')){var _0x1a38c3={};_0x1a38c3[_0x57f8c3[_0x0793('0x29')]]={'$like':'%'+_0x2a3e5d['query'][_0x0793('0x3d')]+'%'};return _0x1a38c3;}})});}_0x8cc573=_[_0x0793('0x3e')]({},_0x8cc573,_0x2a3e5d[_0x0793('0x40')]);var _0x4da202={'where':_0x8cc573[_0x0793('0x3b')]};return db[_0x0793('0x2c')]['count'](_0x4da202)[_0x0793('0x25')](function(_0x464f88){_0x359a1c[_0x0793('0x1f')]=_0x464f88;if(_0x2a3e5d[_0x0793('0x34')][_0x0793('0x41')]){_0x8cc573[_0x0793('0x42')]=[{'all':!![]}];}return db[_0x0793('0x2c')]['findAll'](_0x8cc573);})['then'](function(_0x4db4ca){_0x359a1c[_0x0793('0x43')]=_0x4db4ca;return _0x359a1c;})[_0x0793('0x25')](respondWithFilteredResult(_0x49e7f1,_0x8cc573))[_0x0793('0x44')](handleError(_0x49e7f1,null));};exports[_0x0793('0x45')]=function(_0x138adb,_0xde1a76){var _0x56cd69={'raw':!![],'where':{'id':_0x138adb['params']['id']}},_0x31050c={};_0x31050c[_0x0793('0x30')]=_[_0x0793('0x31')](db['SquareReport'][_0x0793('0x2d')]);_0x31050c[_0x0793('0x34')]=_['keys'](_0x138adb['query']);_0x31050c[_0x0793('0x32')]=_['intersection'](_0x31050c[_0x0793('0x30')],_0x31050c[_0x0793('0x34')]);_0x56cd69[_0x0793('0x36')]=_['intersection'](_0x31050c[_0x0793('0x30')],qs[_0x0793('0x35')](_0x138adb['query'][_0x0793('0x35')]));_0x56cd69[_0x0793('0x36')]=_0x56cd69[_0x0793('0x36')]['length']?_0x56cd69[_0x0793('0x36')]:_0x31050c[_0x0793('0x30')];if(_0x138adb[_0x0793('0x34')][_0x0793('0x41')]){_0x56cd69[_0x0793('0x42')]=[{'all':!![]}];}_0x56cd69=_['merge']({},_0x56cd69,_0x138adb['options']);return db[_0x0793('0x2c')]['find'](_0x56cd69)['then'](handleEntityNotFound(_0xde1a76,null))[_0x0793('0x25')](respondWithResult(_0xde1a76,null))[_0x0793('0x44')](handleError(_0xde1a76,null));};exports[_0x0793('0x46')]=function(_0x188522,_0x5203c5){return db[_0x0793('0x2c')][_0x0793('0x46')](_0x188522[_0x0793('0x47')],{})['then'](respondWithResult(_0x5203c5,0xc9))[_0x0793('0x44')](handleError(_0x5203c5,null));};exports[_0x0793('0x24')]=function(_0x2347df,_0x15d320){if(_0x2347df[_0x0793('0x47')]['id']){delete _0x2347df['body']['id'];}return db[_0x0793('0x2c')]['find']({'where':{'id':_0x2347df[_0x0793('0x48')]['id']}})[_0x0793('0x25')](handleEntityNotFound(_0x15d320,null))[_0x0793('0x25')](saveUpdates(_0x2347df['body'],null))[_0x0793('0x25')](respondWithResult(_0x15d320,null))[_0x0793('0x44')](handleError(_0x15d320,null));};exports['destroy']=function(_0x1f4c36,_0x37f940){return db[_0x0793('0x2c')]['find']({'where':{'id':_0x1f4c36['params']['id']}})[_0x0793('0x25')](handleEntityNotFound(_0x37f940,null))[_0x0793('0x25')](removeEntity(_0x37f940,null))[_0x0793('0x44')](handleError(_0x37f940,null));};exports['describe']=function(_0x5b8278,_0x898b2b){return db[_0x0793('0x2c')][_0x0793('0x49')]()[_0x0793('0x25')](respondWithResult(_0x898b2b,null))['catch'](handleError(_0x898b2b,null));}; \ No newline at end of file +var _0xecd7=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','includeAll','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','SquareReport','fieldName','type','key','model','query','keys','filters'];(function(_0x1dbb77,_0x16c5a9){var _0x1fef05=function(_0x54f51a){while(--_0x54f51a){_0x1dbb77['push'](_0x1dbb77['shift']());}};_0x1fef05(++_0x16c5a9);}(_0xecd7,0x1e0));var _0x7ecd=function(_0x5ad7f3,_0x1d0571){_0x5ad7f3=_0x5ad7f3-0x0;var _0x4bd568=_0xecd7[_0x5ad7f3];return _0x4bd568;};'use strict';var emlformat=require(_0x7ecd('0x0'));var rimraf=require(_0x7ecd('0x1'));var zipdir=require(_0x7ecd('0x2'));var jsonpatch=require(_0x7ecd('0x3'));var rp=require(_0x7ecd('0x4'));var moment=require('moment');var BPromise=require(_0x7ecd('0x5'));var Mustache=require(_0x7ecd('0x6'));var util=require(_0x7ecd('0x7'));var path=require(_0x7ecd('0x8'));var sox=require(_0x7ecd('0x9'));var csv=require(_0x7ecd('0xa'));var ejs=require(_0x7ecd('0xb'));var fs=require('fs');var fs_extra=require(_0x7ecd('0xc'));var _=require(_0x7ecd('0xd'));var squel=require(_0x7ecd('0xe'));var crypto=require('crypto');var jsforce=require(_0x7ecd('0xf'));var deskjs=require(_0x7ecd('0x10'));var toCsv=require(_0x7ecd('0xa'));var querystring=require(_0x7ecd('0x11'));var Papa=require(_0x7ecd('0x12'));var Redis=require(_0x7ecd('0x13'));var authService=require(_0x7ecd('0x14'));var qs=require(_0x7ecd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ecd('0x16'))('api');var utils=require(_0x7ecd('0x17'));var config=require(_0x7ecd('0x18'));var licenseUtil=require(_0x7ecd('0x19'));var db=require(_0x7ecd('0x1a'))['db'];function respondWithStatusCode(_0xd9b03d,_0x5b09da){_0x5b09da=_0x5b09da||0xcc;return function(_0x46b29c){if(_0x46b29c){return _0xd9b03d['sendStatus'](_0x5b09da);}return _0xd9b03d[_0x7ecd('0x1b')](_0x5b09da)[_0x7ecd('0x1c')]();};}function respondWithResult(_0x5b0fb2,_0x46b776){_0x46b776=_0x46b776||0xc8;return function(_0x2e8600){if(_0x2e8600){return _0x5b0fb2[_0x7ecd('0x1b')](_0x46b776)[_0x7ecd('0x1d')](_0x2e8600);}};}function respondWithFilteredResult(_0x10405f,_0x35709f){return function(_0x24e8eb){if(_0x24e8eb){var _0x189803=typeof _0x35709f[_0x7ecd('0x1e')]==='undefined'&&typeof _0x35709f[_0x7ecd('0x1f')]==='undefined';var _0x1c8512=_0x24e8eb[_0x7ecd('0x20')];var _0x15d24e=_0x189803?0x0:_0x35709f[_0x7ecd('0x1e')];var _0x6cb70e=_0x189803?_0x24e8eb[_0x7ecd('0x20')]:_0x35709f[_0x7ecd('0x1e')]+_0x35709f['limit'];var _0x59dda2;if(_0x6cb70e>=_0x1c8512){_0x6cb70e=_0x1c8512;_0x59dda2=0xc8;}else{_0x59dda2=0xce;}_0x10405f['status'](_0x59dda2);return _0x10405f['set']('Content-Range',_0x15d24e+'-'+_0x6cb70e+'/'+_0x1c8512)[_0x7ecd('0x1d')](_0x24e8eb);}return null;};}function patchUpdates(_0x2660f0){return function(_0x4f380a){try{jsonpatch[_0x7ecd('0x21')](_0x4f380a,_0x2660f0,!![]);}catch(_0x139f1d){return BPromise[_0x7ecd('0x22')](_0x139f1d);}return _0x4f380a[_0x7ecd('0x23')]();};}function saveUpdates(_0x3768e9,_0x4a30bf){return function(_0x37b8d1){if(_0x37b8d1){return _0x37b8d1['update'](_0x3768e9)[_0x7ecd('0x24')](function(_0x2c4f70){return _0x2c4f70;});}return null;};}function removeEntity(_0x546634,_0x356711){return function(_0x1f8c9f){if(_0x1f8c9f){return _0x1f8c9f[_0x7ecd('0x25')]()[_0x7ecd('0x24')](function(){_0x546634[_0x7ecd('0x1b')](0xcc)[_0x7ecd('0x1c')]();});}};}function handleEntityNotFound(_0x204f9f,_0x196b4f){return function(_0xc57ae3){if(!_0xc57ae3){_0x204f9f[_0x7ecd('0x26')](0x194);}return _0xc57ae3;};}function handleError(_0x3950f5,_0x5675f4){_0x5675f4=_0x5675f4||0x1f4;return function(_0x5b09ae){logger[_0x7ecd('0x27')](_0x5b09ae['stack']);if(_0x5b09ae[_0x7ecd('0x28')]){delete _0x5b09ae[_0x7ecd('0x28')];}_0x3950f5['status'](_0x5675f4)[_0x7ecd('0x29')](_0x5b09ae);};}exports[_0x7ecd('0x2a')]=function(_0x14846b,_0x2ef46f){var _0x5d5c90={},_0x379135={},_0x35c819={'count':0x0,'rows':[]};var _0x256f2f=_[_0x7ecd('0x2b')](db[_0x7ecd('0x2c')]['rawAttributes'],function(_0x29360e){return{'name':_0x29360e[_0x7ecd('0x2d')],'type':_0x29360e[_0x7ecd('0x2e')][_0x7ecd('0x2f')]};});_0x379135[_0x7ecd('0x30')]=_[_0x7ecd('0x2b')](_0x256f2f,_0x7ecd('0x28'));_0x379135[_0x7ecd('0x31')]=_[_0x7ecd('0x32')](_0x14846b[_0x7ecd('0x31')]);_0x379135[_0x7ecd('0x33')]=_[_0x7ecd('0x34')](_0x379135[_0x7ecd('0x30')],_0x379135[_0x7ecd('0x31')]);_0x5d5c90[_0x7ecd('0x35')]=_[_0x7ecd('0x34')](_0x379135[_0x7ecd('0x30')],qs[_0x7ecd('0x36')](_0x14846b['query'][_0x7ecd('0x36')]));_0x5d5c90[_0x7ecd('0x35')]=_0x5d5c90['attributes'][_0x7ecd('0x37')]?_0x5d5c90['attributes']:_0x379135[_0x7ecd('0x30')];if(!_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x38')](_0x7ecd('0x39'))){_0x5d5c90[_0x7ecd('0x1f')]=qs[_0x7ecd('0x1f')](_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x1f')]);_0x5d5c90[_0x7ecd('0x1e')]=qs[_0x7ecd('0x1e')](_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x1e')]);}_0x5d5c90[_0x7ecd('0x3a')]=qs[_0x7ecd('0x3b')](_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x3b')]);_0x5d5c90[_0x7ecd('0x3c')]=qs[_0x7ecd('0x33')](_[_0x7ecd('0x3d')](_0x14846b[_0x7ecd('0x31')],_0x379135[_0x7ecd('0x33')]),_0x256f2f);if(_0x14846b[_0x7ecd('0x31')][_0x7ecd('0x3e')]){_0x5d5c90[_0x7ecd('0x3c')]=_[_0x7ecd('0x3f')](_0x5d5c90[_0x7ecd('0x3c')],{'$or':_['map'](_0x256f2f,function(_0x1585ae){if(_0x1585ae['type']!==_0x7ecd('0x40')){var _0x20e47c={};_0x20e47c[_0x1585ae[_0x7ecd('0x28')]]={'$like':'%'+_0x14846b[_0x7ecd('0x31')]['filter']+'%'};return _0x20e47c;}})});}_0x5d5c90=_['merge']({},_0x5d5c90,_0x14846b['options']);var _0x527fe0={'where':_0x5d5c90[_0x7ecd('0x3c')]};return db[_0x7ecd('0x2c')][_0x7ecd('0x20')](_0x527fe0)[_0x7ecd('0x24')](function(_0x54c690){_0x35c819[_0x7ecd('0x20')]=_0x54c690;if(_0x14846b[_0x7ecd('0x31')]['includeAll']){_0x5d5c90[_0x7ecd('0x41')]=[{'all':!![]}];}return db[_0x7ecd('0x2c')]['findAll'](_0x5d5c90);})[_0x7ecd('0x24')](function(_0x4a2518){_0x35c819[_0x7ecd('0x42')]=_0x4a2518;return _0x35c819;})[_0x7ecd('0x24')](respondWithFilteredResult(_0x2ef46f,_0x5d5c90))[_0x7ecd('0x43')](handleError(_0x2ef46f,null));};exports[_0x7ecd('0x44')]=function(_0x4156a3,_0x43d5d7){var _0xbd56a8={'raw':!![],'where':{'id':_0x4156a3['params']['id']}},_0x1bed14={};_0x1bed14[_0x7ecd('0x30')]=_[_0x7ecd('0x32')](db[_0x7ecd('0x2c')]['rawAttributes']);_0x1bed14['query']=_[_0x7ecd('0x32')](_0x4156a3[_0x7ecd('0x31')]);_0x1bed14[_0x7ecd('0x33')]=_[_0x7ecd('0x34')](_0x1bed14[_0x7ecd('0x30')],_0x1bed14['query']);_0xbd56a8['attributes']=_[_0x7ecd('0x34')](_0x1bed14['model'],qs[_0x7ecd('0x36')](_0x4156a3[_0x7ecd('0x31')][_0x7ecd('0x36')]));_0xbd56a8[_0x7ecd('0x35')]=_0xbd56a8['attributes'][_0x7ecd('0x37')]?_0xbd56a8[_0x7ecd('0x35')]:_0x1bed14['model'];if(_0x4156a3[_0x7ecd('0x31')][_0x7ecd('0x45')]){_0xbd56a8[_0x7ecd('0x41')]=[{'all':!![]}];}_0xbd56a8=_['merge']({},_0xbd56a8,_0x4156a3['options']);return db[_0x7ecd('0x2c')][_0x7ecd('0x46')](_0xbd56a8)[_0x7ecd('0x24')](handleEntityNotFound(_0x43d5d7,null))[_0x7ecd('0x24')](respondWithResult(_0x43d5d7,null))[_0x7ecd('0x43')](handleError(_0x43d5d7,null));};exports[_0x7ecd('0x47')]=function(_0x1ac4e4,_0x41c3f1){return db[_0x7ecd('0x2c')]['create'](_0x1ac4e4[_0x7ecd('0x48')],{})[_0x7ecd('0x24')](respondWithResult(_0x41c3f1,0xc9))[_0x7ecd('0x43')](handleError(_0x41c3f1,null));};exports[_0x7ecd('0x49')]=function(_0x12fe69,_0x1b37c7){if(_0x12fe69[_0x7ecd('0x48')]['id']){delete _0x12fe69[_0x7ecd('0x48')]['id'];}return db[_0x7ecd('0x2c')][_0x7ecd('0x46')]({'where':{'id':_0x12fe69[_0x7ecd('0x4a')]['id']}})[_0x7ecd('0x24')](handleEntityNotFound(_0x1b37c7,null))[_0x7ecd('0x24')](saveUpdates(_0x12fe69[_0x7ecd('0x48')],null))[_0x7ecd('0x24')](respondWithResult(_0x1b37c7,null))[_0x7ecd('0x43')](handleError(_0x1b37c7,null));};exports[_0x7ecd('0x25')]=function(_0x10ca44,_0x2df47e){return db[_0x7ecd('0x2c')][_0x7ecd('0x46')]({'where':{'id':_0x10ca44[_0x7ecd('0x4a')]['id']}})[_0x7ecd('0x24')](handleEntityNotFound(_0x2df47e,null))[_0x7ecd('0x24')](removeEntity(_0x2df47e,null))[_0x7ecd('0x43')](handleError(_0x2df47e,null));};exports[_0x7ecd('0x4b')]=function(_0x44f139,_0x57c11d){return db['SquareReport'][_0x7ecd('0x4b')]()['then'](respondWithResult(_0x57c11d,null))[_0x7ecd('0x43')](handleError(_0x57c11d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2859bcb..a9622d4 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 _0xd121=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api'];(function(_0x51b360,_0x19092c){var _0x544947=function(_0x48ce13){while(--_0x48ce13){_0x51b360['push'](_0x51b360['shift']());}};_0x544947(++_0x19092c);}(_0xd121,0x10c));var _0x1d12=function(_0x5d4746,_0x35320f){_0x5d4746=_0x5d4746-0x0;var _0x2ea358=_0xd121[_0x5d4746];return _0x2ea358;};'use strict';var _=require(_0x1d12('0x0'));var util=require(_0x1d12('0x1'));var logger=require(_0x1d12('0x2'))(_0x1d12('0x3'));var moment=require(_0x1d12('0x4'));var BPromise=require(_0x1d12('0x5'));var rp=require(_0x1d12('0x6'));var fs=require('fs');var path=require(_0x1d12('0x7'));var rimraf=require(_0x1d12('0x8'));var config=require(_0x1d12('0x9'));var attributes=require('./squareReport.attributes');module[_0x1d12('0xa')]=function(_0x16f336,_0x202ab0){return _0x16f336['define'](_0x1d12('0xb'),attributes,{'tableName':_0x1d12('0xc'),'paranoid':![],'indexes':[{'name':_0x1d12('0xd'),'fields':[_0x1d12('0xe'),_0x1d12('0xf')]},{'name':_0x1d12('0x10'),'fields':[_0x1d12('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c70=['path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b58ae,_0x5e34de){var _0x96c539=function(_0x5b6d32){while(--_0x5b6d32){_0x5b58ae['push'](_0x5b58ae['shift']());}};_0x96c539(++_0x5e34de);}(_0x2c70,0xa4));var _0x02c7=function(_0x4b3b1d,_0x161f01){_0x4b3b1d=_0x4b3b1d-0x0;var _0x288ae5=_0x2c70[_0x4b3b1d];return _0x288ae5;};'use strict';var _=require('lodash');var util=require(_0x02c7('0x0'));var logger=require(_0x02c7('0x1'))(_0x02c7('0x2'));var moment=require(_0x02c7('0x3'));var BPromise=require(_0x02c7('0x4'));var rp=require(_0x02c7('0x5'));var fs=require('fs');var path=require(_0x02c7('0x6'));var rimraf=require(_0x02c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x02c7('0x8'));module[_0x02c7('0x9')]=function(_0x4b9492,_0x2633f1){return _0x4b9492[_0x02c7('0xa')](_0x02c7('0xb'),attributes,{'tableName':_0x02c7('0xc'),'paranoid':![],'indexes':[{'name':_0x02c7('0xd'),'fields':[_0x02c7('0xe'),_0x02c7('0xf')]},{'name':_0x02c7('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 3c64d41..39ded1a 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 _0x271d=['body','options','then','CreateSquareReport','debug','stringify','UpdateSquareReport','update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','info','result','catch','create'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x271d,0x120));var _0xd271=function(_0x5eca56,_0x426d1b){_0x5eca56=_0x5eca56-0x0;var _0x54d607=_0x271d[_0x5eca56];return _0x54d607;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var moment=require(_0xd271('0x2'));var BPromise=require(_0xd271('0x3'));var rs=require(_0xd271('0x4'));var fs=require('fs');var Redis=require(_0xd271('0x5'));var db=require(_0xd271('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd271('0x7'))(_0xd271('0x8'));var config=require(_0xd271('0x9'));var jayson=require(_0xd271('0xa'));var client=jayson[_0xd271('0xb')][_0xd271('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6020,_0x3211f7,_0x5e3da3){return new BPromise(function(_0x4075da,_0xe0d21f){return client['request'](_0x5c6020,_0x5e3da3)['then'](function(_0x3ddfac){logger['info']('SquareReport,\x20%s,\x20%s',_0x3211f7,_0xd271('0xd'));logger['debug'](_0xd271('0xe'),_0x3211f7,_0xd271('0xd'),JSON['stringify'](_0x3ddfac));if(_0x3ddfac[_0xd271('0xf')]){if(_0x3ddfac['error']['code']===0x1f4){logger['error'](_0xd271('0x10'),_0x3211f7,_0x3ddfac[_0xd271('0xf')][_0xd271('0x11')]);return _0xe0d21f(_0x3ddfac['error'][_0xd271('0x11')]);}logger[_0xd271('0xf')](_0xd271('0x10'),_0x3211f7,_0x3ddfac[_0xd271('0xf')][_0xd271('0x11')]);return _0x4075da(_0x3ddfac[_0xd271('0xf')][_0xd271('0x11')]);}else{logger[_0xd271('0x12')]('SquareReport,\x20%s,\x20%s',_0x3211f7,'request\x20sent');_0x4075da(_0x3ddfac[_0xd271('0x13')][_0xd271('0x11')]);}})[_0xd271('0x14')](function(_0x29b5e2){logger[_0xd271('0xf')](_0xd271('0x10'),_0x3211f7,_0x29b5e2);_0xe0d21f(_0x29b5e2);});});}exports['CreateSquareReport']=function(_0x27cdc3){var _0x3002b2=this;return new Promise(function(_0x57bbc8,_0x509db0){return db['SquareReport'][_0xd271('0x15')](_0x27cdc3[_0xd271('0x16')],{'raw':_0x27cdc3[_0xd271('0x17')]?_0x27cdc3['options']['raw']===undefined?!![]:![]:!![]})[_0xd271('0x18')](function(_0x5b0229){logger['info'](_0xd271('0x19'),_0x27cdc3);logger[_0xd271('0x1a')](_0xd271('0x19'),_0x27cdc3,JSON[_0xd271('0x1b')](_0x5b0229));_0x57bbc8(_0x5b0229);})[_0xd271('0x14')](function(_0x445238){logger[_0xd271('0xf')](_0xd271('0x19'),_0x445238['message'],_0x27cdc3);_0x509db0(_0x3002b2[_0xd271('0xf')](0x1f4,_0x445238[_0xd271('0x11')]));});});};exports[_0xd271('0x1c')]=function(_0x29d849){var _0x1cab92=this;return new Promise(function(_0x411ff9,_0x5a665e){return db['SquareReport'][_0xd271('0x1d')](_0x29d849[_0xd271('0x16')],{'raw':_0x29d849[_0xd271('0x17')]?_0x29d849[_0xd271('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d849[_0xd271('0x17')]?_0x29d849[_0xd271('0x17')]['where']||null:null,'attributes':_0x29d849[_0xd271('0x17')]?_0x29d849['options'][_0xd271('0x1e')]||null:null,'limit':_0x29d849[_0xd271('0x17')]?_0x29d849[_0xd271('0x17')]['limit']||null:null})[_0xd271('0x18')](function(_0x3eb190){logger[_0xd271('0x12')]('UpdateSquareReport',_0x29d849);logger[_0xd271('0x1a')](_0xd271('0x1c'),_0x29d849,JSON[_0xd271('0x1b')](_0x3eb190));_0x411ff9(_0x3eb190);})[_0xd271('0x14')](function(_0x498fc5){logger[_0xd271('0xf')](_0xd271('0x1c'),_0x498fc5['message'],_0x29d849);_0x5a665e(_0x1cab92['error'](0x1f4,_0x498fc5['message']));});});}; \ No newline at end of file +var _0x4fe6=['options','raw','CreateSquareReport','stringify','UpdateSquareReport','update','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','result','SquareReport','create','body'];(function(_0x51ec59,_0x812a9f){var _0x267197=function(_0xcb8b33){while(--_0xcb8b33){_0x51ec59['push'](_0x51ec59['shift']());}};_0x267197(++_0x812a9f);}(_0x4fe6,0xdc));var _0x64fe=function(_0x2191b6,_0x577472){_0x2191b6=_0x2191b6-0x0;var _0x407781=_0x4fe6[_0x2191b6];return _0x407781;};'use strict';var _=require(_0x64fe('0x0'));var util=require(_0x64fe('0x1'));var moment=require('moment');var BPromise=require(_0x64fe('0x2'));var rs=require(_0x64fe('0x3'));var fs=require('fs');var Redis=require(_0x64fe('0x4'));var db=require(_0x64fe('0x5'))['db'];var utils=require(_0x64fe('0x6'));var logger=require(_0x64fe('0x7'))('rpc');var config=require(_0x64fe('0x8'));var jayson=require(_0x64fe('0x9'));var client=jayson[_0x64fe('0xa')][_0x64fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ed2b0,_0x51d2ea,_0x42d22e){return new BPromise(function(_0x34ab51,_0x5b7196){return client[_0x64fe('0xc')](_0x3ed2b0,_0x42d22e)[_0x64fe('0xd')](function(_0xcd355c){logger[_0x64fe('0xe')]('SquareReport,\x20%s,\x20%s',_0x51d2ea,_0x64fe('0xf'));logger[_0x64fe('0x10')](_0x64fe('0x11'),_0x51d2ea,_0x64fe('0xf'),JSON['stringify'](_0xcd355c));if(_0xcd355c[_0x64fe('0x12')]){if(_0xcd355c[_0x64fe('0x12')]['code']===0x1f4){logger['error'](_0x64fe('0x13'),_0x51d2ea,_0xcd355c[_0x64fe('0x12')]['message']);return _0x5b7196(_0xcd355c[_0x64fe('0x12')][_0x64fe('0x14')]);}logger[_0x64fe('0x12')]('SquareReport,\x20%s,\x20%s',_0x51d2ea,_0xcd355c[_0x64fe('0x12')][_0x64fe('0x14')]);return _0x34ab51(_0xcd355c[_0x64fe('0x12')][_0x64fe('0x14')]);}else{logger[_0x64fe('0xe')](_0x64fe('0x13'),_0x51d2ea,_0x64fe('0xf'));_0x34ab51(_0xcd355c[_0x64fe('0x15')][_0x64fe('0x14')]);}})['catch'](function(_0xbf354b){logger[_0x64fe('0x12')]('SquareReport,\x20%s,\x20%s',_0x51d2ea,_0xbf354b);_0x5b7196(_0xbf354b);});});}exports['CreateSquareReport']=function(_0x311ec5){var _0x555010=this;return new Promise(function(_0x452c05,_0x11b752){return db[_0x64fe('0x16')][_0x64fe('0x17')](_0x311ec5[_0x64fe('0x18')],{'raw':_0x311ec5[_0x64fe('0x19')]?_0x311ec5[_0x64fe('0x19')][_0x64fe('0x1a')]===undefined?!![]:![]:!![]})[_0x64fe('0xd')](function(_0x5d2ca6){logger[_0x64fe('0xe')](_0x64fe('0x1b'),_0x311ec5);logger[_0x64fe('0x10')](_0x64fe('0x1b'),_0x311ec5,JSON[_0x64fe('0x1c')](_0x5d2ca6));_0x452c05(_0x5d2ca6);})['catch'](function(_0x4fa11e){logger[_0x64fe('0x12')](_0x64fe('0x1b'),_0x4fa11e['message'],_0x311ec5);_0x11b752(_0x555010[_0x64fe('0x12')](0x1f4,_0x4fa11e[_0x64fe('0x14')]));});});};exports[_0x64fe('0x1d')]=function(_0x131202){var _0x3734bd=this;return new Promise(function(_0x4ece50,_0x23b554){return db[_0x64fe('0x16')][_0x64fe('0x1e')](_0x131202['body'],{'raw':_0x131202[_0x64fe('0x19')]?_0x131202['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131202['options']?_0x131202[_0x64fe('0x19')][_0x64fe('0x1f')]||null:null,'attributes':_0x131202[_0x64fe('0x19')]?_0x131202['options'][_0x64fe('0x20')]||null:null,'limit':_0x131202[_0x64fe('0x19')]?_0x131202[_0x64fe('0x19')][_0x64fe('0x21')]||null:null})[_0x64fe('0xd')](function(_0x4f0389){logger[_0x64fe('0xe')]('UpdateSquareReport',_0x131202);logger[_0x64fe('0x10')](_0x64fe('0x1d'),_0x131202,JSON[_0x64fe('0x1c')](_0x4f0389));_0x4ece50(_0x4f0389);})[_0x64fe('0x22')](function(_0xf684d5){logger[_0x64fe('0x12')](_0x64fe('0x1d'),_0xf684d5[_0x64fe('0x14')],_0x131202);_0x23b554(_0x3734bd[_0x64fe('0x12')](0x1f4,_0xf684d5[_0x64fe('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6207120..6beb4a1 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 _0x8392=['../../config/environment','get','isAuthenticated','describe','show','post','create','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8392,0x181));var _0x2839=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8392[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2839('0x0'));var util=require('util');var path=require(_0x2839('0x1'));var timeout=require(_0x2839('0x2'));var express=require(_0x2839('0x3'));var router=express['Router']();var fs_extra=require(_0x2839('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2839('0x5'));var config=require(_0x2839('0x6'));var controller=require('./squareReportDetail.controller');router[_0x2839('0x7')]('/',auth[_0x2839('0x8')](),controller['index']);router[_0x2839('0x7')]('/describe',auth[_0x2839('0x8')](),controller[_0x2839('0x9')]);router[_0x2839('0x7')]('/:id',auth[_0x2839('0x8')](),controller[_0x2839('0xa')]);router[_0x2839('0xb')]('/',auth[_0x2839('0x8')](),controller[_0x2839('0xc')]);router['put'](_0x2839('0xd'),auth[_0x2839('0x8')](),controller[_0x2839('0xe')]);router['delete']('/:id',auth[_0x2839('0x8')](),controller[_0x2839('0xf')]);module[_0x2839('0x10')]=router; \ No newline at end of file +var _0x1be9=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0x1be9,0x1c3));var _0x91be=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1be9[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x91be('0x0'));var util=require(_0x91be('0x1'));var path=require(_0x91be('0x2'));var timeout=require(_0x91be('0x3'));var express=require(_0x91be('0x4'));var router=express[_0x91be('0x5')]();var fs_extra=require(_0x91be('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x91be('0x7'));var controller=require('./squareReportDetail.controller');router[_0x91be('0x8')]('/',auth[_0x91be('0x9')](),controller[_0x91be('0xa')]);router[_0x91be('0x8')](_0x91be('0xb'),auth[_0x91be('0x9')](),controller[_0x91be('0xc')]);router['get'](_0x91be('0xd'),auth[_0x91be('0x9')](),controller['show']);router[_0x91be('0xe')]('/',auth[_0x91be('0x9')](),controller[_0x91be('0xf')]);router[_0x91be('0x10')](_0x91be('0xd'),auth[_0x91be('0x9')](),controller[_0x91be('0x11')]);router[_0x91be('0x12')](_0x91be('0xd'),auth[_0x91be('0x9')](),controller[_0x91be('0x13')]);module[_0x91be('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 d64b16f..8fa5a23 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 _0x97c8=['STRING','TEXT','sequelize','exports'];(function(_0x728750,_0x5ce59a){var _0xb27740=function(_0x1539ba){while(--_0x1539ba){_0x728750['push'](_0x728750['shift']());}};_0xb27740(++_0x5ce59a);}(_0x97c8,0x1ae));var _0x897c=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x97c8[_0x40b2ed];return _0x18397d;};'use strict';var Sequelize=require(_0x897c('0x0'));module[_0x897c('0x1')]={'uniqueid':{'type':Sequelize[_0x897c('0x2')]},'node':{'type':Sequelize[_0x897c('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x897c('0x3')]},'project_name':{'type':Sequelize[_0x897c('0x2')]},'callerid':{'type':Sequelize[_0x897c('0x2')]}}; \ No newline at end of file +var _0x2e37=['STRING','sequelize','exports'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0x2e37,0x82));var _0x72e3=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x2e37[_0x516927];return _0x30749b;};'use strict';var Sequelize=require(_0x72e3('0x0'));module[_0x72e3('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x72e3('0x2')]},'application':{'type':Sequelize[_0x72e3('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x72e3('0x2')]},'callerid':{'type':Sequelize[_0x72e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c0f64bd..c78a814 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 _0x66f1=['reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareDetailsReport','includeAll','include','rows','show','find','catch','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x66f1,0x114));var _0x166f=function(_0x45fc9c,_0x70f2cb){_0x45fc9c=_0x45fc9c-0x0;var _0x984946=_0x66f1[_0x45fc9c];return _0x984946;};'use strict';var emlformat=require(_0x166f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x166f('0x1'));var jsonpatch=require(_0x166f('0x2'));var rp=require(_0x166f('0x3'));var moment=require(_0x166f('0x4'));var BPromise=require(_0x166f('0x5'));var Mustache=require(_0x166f('0x6'));var util=require(_0x166f('0x7'));var path=require(_0x166f('0x8'));var sox=require(_0x166f('0x9'));var csv=require(_0x166f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x166f('0xb'));var _=require(_0x166f('0xc'));var squel=require(_0x166f('0xd'));var crypto=require('crypto');var jsforce=require(_0x166f('0xe'));var deskjs=require(_0x166f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x166f('0x10'));var Redis=require(_0x166f('0x11'));var authService=require(_0x166f('0x12'));var qs=require(_0x166f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x166f('0x14'))('api');var utils=require(_0x166f('0x15'));var config=require(_0x166f('0x16'));var licenseUtil=require(_0x166f('0x17'));var db=require(_0x166f('0x18'))['db'];function respondWithStatusCode(_0x243ab3,_0x2966ce){_0x2966ce=_0x2966ce||0xcc;return function(_0x37f6b5){if(_0x37f6b5){return _0x243ab3[_0x166f('0x19')](_0x2966ce);}return _0x243ab3['status'](_0x2966ce)[_0x166f('0x1a')]();};}function respondWithResult(_0x3395bc,_0x67aaf4){_0x67aaf4=_0x67aaf4||0xc8;return function(_0x10ef80){if(_0x10ef80){return _0x3395bc[_0x166f('0x1b')](_0x67aaf4)[_0x166f('0x1c')](_0x10ef80);}};}function respondWithFilteredResult(_0x314f28,_0x2aa402){return function(_0x18d8d0){if(_0x18d8d0){var _0x28e7cf=typeof _0x2aa402[_0x166f('0x1d')]==='undefined'&&typeof _0x2aa402['limit']===_0x166f('0x1e');var _0x33f2d0=_0x18d8d0[_0x166f('0x1f')];var _0x4f0656=_0x28e7cf?0x0:_0x2aa402[_0x166f('0x1d')];var _0x1c264d=_0x28e7cf?_0x18d8d0[_0x166f('0x1f')]:_0x2aa402[_0x166f('0x1d')]+_0x2aa402[_0x166f('0x20')];var _0x370288;if(_0x1c264d>=_0x33f2d0){_0x1c264d=_0x33f2d0;_0x370288=0xc8;}else{_0x370288=0xce;}_0x314f28[_0x166f('0x1b')](_0x370288);return _0x314f28[_0x166f('0x21')](_0x166f('0x22'),_0x4f0656+'-'+_0x1c264d+'/'+_0x33f2d0)[_0x166f('0x1c')](_0x18d8d0);}return null;};}function patchUpdates(_0x3a7de2){return function(_0x11ea2d){try{jsonpatch[_0x166f('0x23')](_0x11ea2d,_0x3a7de2,!![]);}catch(_0x1527c9){return BPromise[_0x166f('0x24')](_0x1527c9);}return _0x11ea2d['save']();};}function saveUpdates(_0xeb7759,_0x20fb6c){return function(_0x154e8f){if(_0x154e8f){return _0x154e8f['update'](_0xeb7759)[_0x166f('0x25')](function(_0x2a945b){return _0x2a945b;});}return null;};}function removeEntity(_0x2c3ab4,_0x54269a){return function(_0x2a8ae7){if(_0x2a8ae7){return _0x2a8ae7[_0x166f('0x26')]()['then'](function(){_0x2c3ab4['status'](0xcc)[_0x166f('0x1a')]();});}};}function handleEntityNotFound(_0x18c658,_0x51f28f){return function(_0x3af54f){if(!_0x3af54f){_0x18c658[_0x166f('0x19')](0x194);}return _0x3af54f;};}function handleError(_0x5205d7,_0x8faf2e){_0x8faf2e=_0x8faf2e||0x1f4;return function(_0x7086c1){logger[_0x166f('0x27')](_0x7086c1[_0x166f('0x28')]);if(_0x7086c1[_0x166f('0x29')]){delete _0x7086c1['name'];}_0x5205d7[_0x166f('0x1b')](_0x8faf2e)['send'](_0x7086c1);};}exports[_0x166f('0x2a')]=function(_0x2c4bd4,_0x239620){var _0x3e3ac3={},_0x131425={},_0x516c7c={'count':0x0,'rows':[]};var _0x1c76a2=_[_0x166f('0x2b')](db['SquareDetailsReport'][_0x166f('0x2c')],function(_0x4a1d2f){return{'name':_0x4a1d2f[_0x166f('0x2d')],'type':_0x4a1d2f[_0x166f('0x2e')][_0x166f('0x2f')]};});_0x131425[_0x166f('0x30')]=_[_0x166f('0x2b')](_0x1c76a2,_0x166f('0x29'));_0x131425[_0x166f('0x31')]=_[_0x166f('0x32')](_0x2c4bd4[_0x166f('0x31')]);_0x131425[_0x166f('0x33')]=_[_0x166f('0x34')](_0x131425[_0x166f('0x30')],_0x131425[_0x166f('0x31')]);_0x3e3ac3['attributes']=_[_0x166f('0x34')](_0x131425[_0x166f('0x30')],qs['fields'](_0x2c4bd4[_0x166f('0x31')][_0x166f('0x35')]));_0x3e3ac3[_0x166f('0x36')]=_0x3e3ac3['attributes'][_0x166f('0x37')]?_0x3e3ac3[_0x166f('0x36')]:_0x131425['model'];if(!_0x2c4bd4[_0x166f('0x31')][_0x166f('0x38')](_0x166f('0x39'))){_0x3e3ac3['limit']=qs[_0x166f('0x20')](_0x2c4bd4[_0x166f('0x31')][_0x166f('0x20')]);_0x3e3ac3[_0x166f('0x1d')]=qs[_0x166f('0x1d')](_0x2c4bd4[_0x166f('0x31')][_0x166f('0x1d')]);}_0x3e3ac3[_0x166f('0x3a')]=qs[_0x166f('0x3b')](_0x2c4bd4['query'][_0x166f('0x3b')]);_0x3e3ac3[_0x166f('0x3c')]=qs[_0x166f('0x33')](_[_0x166f('0x3d')](_0x2c4bd4[_0x166f('0x31')],_0x131425[_0x166f('0x33')]),_0x1c76a2);if(_0x2c4bd4[_0x166f('0x31')]['filter']){_0x3e3ac3[_0x166f('0x3c')]=_[_0x166f('0x3e')](_0x3e3ac3[_0x166f('0x3c')],{'$or':_[_0x166f('0x2b')](_0x1c76a2,function(_0x37fddb){if(_0x37fddb[_0x166f('0x2e')]!==_0x166f('0x3f')){var _0x10604={};_0x10604[_0x37fddb[_0x166f('0x29')]]={'$like':'%'+_0x2c4bd4[_0x166f('0x31')][_0x166f('0x40')]+'%'};return _0x10604;}})});}_0x3e3ac3=_[_0x166f('0x3e')]({},_0x3e3ac3,_0x2c4bd4[_0x166f('0x41')]);var _0x253b91={'where':_0x3e3ac3[_0x166f('0x3c')]};return db[_0x166f('0x42')]['count'](_0x253b91)[_0x166f('0x25')](function(_0x3bd151){_0x516c7c[_0x166f('0x1f')]=_0x3bd151;if(_0x2c4bd4[_0x166f('0x31')][_0x166f('0x43')]){_0x3e3ac3[_0x166f('0x44')]=[{'all':!![]}];}return db[_0x166f('0x42')]['findAll'](_0x3e3ac3);})['then'](function(_0x1d4f6e){_0x516c7c[_0x166f('0x45')]=_0x1d4f6e;return _0x516c7c;})[_0x166f('0x25')](respondWithFilteredResult(_0x239620,_0x3e3ac3))['catch'](handleError(_0x239620,null));};exports[_0x166f('0x46')]=function(_0x4f0c98,_0x1d715b){var _0x3fa6d2={'raw':!![],'where':{'id':_0x4f0c98['params']['id']}},_0x1e5905={};_0x1e5905[_0x166f('0x30')]=_[_0x166f('0x32')](db[_0x166f('0x42')][_0x166f('0x2c')]);_0x1e5905[_0x166f('0x31')]=_[_0x166f('0x32')](_0x4f0c98[_0x166f('0x31')]);_0x1e5905[_0x166f('0x33')]=_[_0x166f('0x34')](_0x1e5905[_0x166f('0x30')],_0x1e5905[_0x166f('0x31')]);_0x3fa6d2[_0x166f('0x36')]=_[_0x166f('0x34')](_0x1e5905['model'],qs['fields'](_0x4f0c98[_0x166f('0x31')]['fields']));_0x3fa6d2[_0x166f('0x36')]=_0x3fa6d2[_0x166f('0x36')]['length']?_0x3fa6d2[_0x166f('0x36')]:_0x1e5905['model'];if(_0x4f0c98[_0x166f('0x31')]['includeAll']){_0x3fa6d2[_0x166f('0x44')]=[{'all':!![]}];}_0x3fa6d2=_[_0x166f('0x3e')]({},_0x3fa6d2,_0x4f0c98['options']);return db[_0x166f('0x42')][_0x166f('0x47')](_0x3fa6d2)[_0x166f('0x25')](handleEntityNotFound(_0x1d715b,null))[_0x166f('0x25')](respondWithResult(_0x1d715b,null))[_0x166f('0x48')](handleError(_0x1d715b,null));};exports[_0x166f('0x49')]=function(_0x175e7d,_0x51d2eb){return db[_0x166f('0x42')][_0x166f('0x49')](_0x175e7d[_0x166f('0x4a')],{})[_0x166f('0x25')](respondWithResult(_0x51d2eb,0xc9))['catch'](handleError(_0x51d2eb,null));};exports[_0x166f('0x4b')]=function(_0x67b554,_0x1f6103){if(_0x67b554[_0x166f('0x4a')]['id']){delete _0x67b554[_0x166f('0x4a')]['id'];}return db[_0x166f('0x42')]['find']({'where':{'id':_0x67b554[_0x166f('0x4c')]['id']}})[_0x166f('0x25')](handleEntityNotFound(_0x1f6103,null))[_0x166f('0x25')](saveUpdates(_0x67b554[_0x166f('0x4a')],null))[_0x166f('0x25')](respondWithResult(_0x1f6103,null))[_0x166f('0x48')](handleError(_0x1f6103,null));};exports['destroy']=function(_0x223f50,_0x1d8d85){return db[_0x166f('0x42')]['find']({'where':{'id':_0x223f50[_0x166f('0x4c')]['id']}})[_0x166f('0x25')](handleEntityNotFound(_0x1d8d85,null))[_0x166f('0x25')](removeEntity(_0x1d8d85,null))[_0x166f('0x48')](handleError(_0x1d8d85,null));};exports[_0x166f('0x4d')]=function(_0x574f28,_0x2b86dd){return db[_0x166f('0x42')]['describe']()[_0x166f('0x25')](respondWithResult(_0x2b86dd,null))[_0x166f('0x48')](handleError(_0x2b86dd,null));}; \ No newline at end of file +var _0x032a=['fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x032a,0x6c));var _0xa032=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x032a[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0xa032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa032('0x1'));var jsonpatch=require(_0xa032('0x2'));var rp=require(_0xa032('0x3'));var moment=require('moment');var BPromise=require(_0xa032('0x4'));var Mustache=require(_0xa032('0x5'));var util=require(_0xa032('0x6'));var path=require(_0xa032('0x7'));var sox=require(_0xa032('0x8'));var csv=require(_0xa032('0x9'));var ejs=require(_0xa032('0xa'));var fs=require('fs');var fs_extra=require(_0xa032('0xb'));var _=require('lodash');var squel=require(_0xa032('0xc'));var crypto=require('crypto');var jsforce=require(_0xa032('0xd'));var deskjs=require(_0xa032('0xe'));var toCsv=require(_0xa032('0x9'));var querystring=require('querystring');var Papa=require(_0xa032('0xf'));var Redis=require(_0xa032('0x10'));var authService=require(_0xa032('0x11'));var qs=require(_0xa032('0x12'));var as=require(_0xa032('0x13'));var hardwareService=require(_0xa032('0x14'));var logger=require('../../config/logger')(_0xa032('0x15'));var utils=require(_0xa032('0x16'));var config=require(_0xa032('0x17'));var licenseUtil=require(_0xa032('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5027a7,_0x16067a){_0x16067a=_0x16067a||0xcc;return function(_0x11ccba){if(_0x11ccba){return _0x5027a7[_0xa032('0x19')](_0x16067a);}return _0x5027a7[_0xa032('0x1a')](_0x16067a)[_0xa032('0x1b')]();};}function respondWithResult(_0x5c7ab4,_0x49b1a9){_0x49b1a9=_0x49b1a9||0xc8;return function(_0x549d22){if(_0x549d22){return _0x5c7ab4[_0xa032('0x1a')](_0x49b1a9)['json'](_0x549d22);}};}function respondWithFilteredResult(_0x1fe206,_0x19b3c1){return function(_0x5cfd5b){if(_0x5cfd5b){var _0x41132c=typeof _0x19b3c1['offset']===_0xa032('0x1c')&&typeof _0x19b3c1['limit']===_0xa032('0x1c');var _0x58f24f=_0x5cfd5b[_0xa032('0x1d')];var _0x58f73b=_0x41132c?0x0:_0x19b3c1[_0xa032('0x1e')];var _0x493111=_0x41132c?_0x5cfd5b[_0xa032('0x1d')]:_0x19b3c1[_0xa032('0x1e')]+_0x19b3c1[_0xa032('0x1f')];var _0x91bb7e;if(_0x493111>=_0x58f24f){_0x493111=_0x58f24f;_0x91bb7e=0xc8;}else{_0x91bb7e=0xce;}_0x1fe206[_0xa032('0x1a')](_0x91bb7e);return _0x1fe206[_0xa032('0x20')](_0xa032('0x21'),_0x58f73b+'-'+_0x493111+'/'+_0x58f24f)[_0xa032('0x22')](_0x5cfd5b);}return null;};}function patchUpdates(_0x16b693){return function(_0x1a7660){try{jsonpatch[_0xa032('0x23')](_0x1a7660,_0x16b693,!![]);}catch(_0x2c0ca4){return BPromise[_0xa032('0x24')](_0x2c0ca4);}return _0x1a7660[_0xa032('0x25')]();};}function saveUpdates(_0x290ab6,_0x1ae94e){return function(_0x2ce36f){if(_0x2ce36f){return _0x2ce36f[_0xa032('0x26')](_0x290ab6)[_0xa032('0x27')](function(_0x50667b){return _0x50667b;});}return null;};}function removeEntity(_0x3a1a6e,_0x5caf8c){return function(_0x46dec0){if(_0x46dec0){return _0x46dec0[_0xa032('0x28')]()['then'](function(){_0x3a1a6e[_0xa032('0x1a')](0xcc)[_0xa032('0x1b')]();});}};}function handleEntityNotFound(_0x48b286,_0x37d7a4){return function(_0x14d324){if(!_0x14d324){_0x48b286[_0xa032('0x19')](0x194);}return _0x14d324;};}function handleError(_0x588bfb,_0x5b2d48){_0x5b2d48=_0x5b2d48||0x1f4;return function(_0x1ffd09){logger[_0xa032('0x29')](_0x1ffd09[_0xa032('0x2a')]);if(_0x1ffd09[_0xa032('0x2b')]){delete _0x1ffd09[_0xa032('0x2b')];}_0x588bfb['status'](_0x5b2d48)[_0xa032('0x2c')](_0x1ffd09);};}exports['index']=function(_0x32caff,_0x2489b5){var _0x53e829={},_0xf7e270={},_0x19fe05={'count':0x0,'rows':[]};var _0x507d35=_[_0xa032('0x2d')](db[_0xa032('0x2e')][_0xa032('0x2f')],function(_0x543c51){return{'name':_0x543c51[_0xa032('0x30')],'type':_0x543c51[_0xa032('0x31')]['key']};});_0xf7e270[_0xa032('0x32')]=_[_0xa032('0x2d')](_0x507d35,_0xa032('0x2b'));_0xf7e270['query']=_[_0xa032('0x33')](_0x32caff[_0xa032('0x34')]);_0xf7e270[_0xa032('0x35')]=_['intersection'](_0xf7e270[_0xa032('0x32')],_0xf7e270['query']);_0x53e829[_0xa032('0x36')]=_[_0xa032('0x37')](_0xf7e270[_0xa032('0x32')],qs[_0xa032('0x38')](_0x32caff[_0xa032('0x34')][_0xa032('0x38')]));_0x53e829[_0xa032('0x36')]=_0x53e829['attributes']['length']?_0x53e829['attributes']:_0xf7e270[_0xa032('0x32')];if(!_0x32caff[_0xa032('0x34')][_0xa032('0x39')](_0xa032('0x3a'))){_0x53e829['limit']=qs[_0xa032('0x1f')](_0x32caff[_0xa032('0x34')][_0xa032('0x1f')]);_0x53e829[_0xa032('0x1e')]=qs[_0xa032('0x1e')](_0x32caff[_0xa032('0x34')][_0xa032('0x1e')]);}_0x53e829[_0xa032('0x3b')]=qs[_0xa032('0x3c')](_0x32caff[_0xa032('0x34')][_0xa032('0x3c')]);_0x53e829[_0xa032('0x3d')]=qs[_0xa032('0x35')](_[_0xa032('0x3e')](_0x32caff[_0xa032('0x34')],_0xf7e270[_0xa032('0x35')]),_0x507d35);if(_0x32caff[_0xa032('0x34')][_0xa032('0x3f')]){_0x53e829[_0xa032('0x3d')]=_[_0xa032('0x40')](_0x53e829[_0xa032('0x3d')],{'$or':_[_0xa032('0x2d')](_0x507d35,function(_0x28a6bc){if(_0x28a6bc[_0xa032('0x31')]!==_0xa032('0x41')){var _0xdae6e1={};_0xdae6e1[_0x28a6bc['name']]={'$like':'%'+_0x32caff[_0xa032('0x34')]['filter']+'%'};return _0xdae6e1;}})});}_0x53e829=_[_0xa032('0x40')]({},_0x53e829,_0x32caff[_0xa032('0x42')]);var _0x432fb7={'where':_0x53e829[_0xa032('0x3d')]};return db[_0xa032('0x2e')][_0xa032('0x1d')](_0x432fb7)['then'](function(_0x3c9e2c){_0x19fe05['count']=_0x3c9e2c;if(_0x32caff['query'][_0xa032('0x43')]){_0x53e829['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xa032('0x44')](_0x53e829);})[_0xa032('0x27')](function(_0xd45535){_0x19fe05[_0xa032('0x45')]=_0xd45535;return _0x19fe05;})['then'](respondWithFilteredResult(_0x2489b5,_0x53e829))[_0xa032('0x46')](handleError(_0x2489b5,null));};exports[_0xa032('0x47')]=function(_0x58e044,_0x2d6bc6){var _0x13be3a={'raw':!![],'where':{'id':_0x58e044['params']['id']}},_0x40775e={};_0x40775e[_0xa032('0x32')]=_['keys'](db[_0xa032('0x2e')][_0xa032('0x2f')]);_0x40775e[_0xa032('0x34')]=_[_0xa032('0x33')](_0x58e044[_0xa032('0x34')]);_0x40775e[_0xa032('0x35')]=_[_0xa032('0x37')](_0x40775e['model'],_0x40775e['query']);_0x13be3a[_0xa032('0x36')]=_[_0xa032('0x37')](_0x40775e[_0xa032('0x32')],qs[_0xa032('0x38')](_0x58e044['query'][_0xa032('0x38')]));_0x13be3a['attributes']=_0x13be3a['attributes']['length']?_0x13be3a[_0xa032('0x36')]:_0x40775e[_0xa032('0x32')];if(_0x58e044['query'][_0xa032('0x43')]){_0x13be3a[_0xa032('0x48')]=[{'all':!![]}];}_0x13be3a=_['merge']({},_0x13be3a,_0x58e044[_0xa032('0x42')]);return db['SquareDetailsReport'][_0xa032('0x49')](_0x13be3a)[_0xa032('0x27')](handleEntityNotFound(_0x2d6bc6,null))[_0xa032('0x27')](respondWithResult(_0x2d6bc6,null))[_0xa032('0x46')](handleError(_0x2d6bc6,null));};exports['create']=function(_0x4a09c6,_0x569634){return db[_0xa032('0x2e')][_0xa032('0x4a')](_0x4a09c6[_0xa032('0x4b')],{})[_0xa032('0x27')](respondWithResult(_0x569634,0xc9))['catch'](handleError(_0x569634,null));};exports[_0xa032('0x26')]=function(_0x1c55f3,_0x4bb139){if(_0x1c55f3[_0xa032('0x4b')]['id']){delete _0x1c55f3[_0xa032('0x4b')]['id'];}return db[_0xa032('0x2e')][_0xa032('0x49')]({'where':{'id':_0x1c55f3[_0xa032('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bb139,null))['then'](saveUpdates(_0x1c55f3[_0xa032('0x4b')],null))[_0xa032('0x27')](respondWithResult(_0x4bb139,null))[_0xa032('0x46')](handleError(_0x4bb139,null));};exports[_0xa032('0x28')]=function(_0x1d820b,_0x31dbd3){return db[_0xa032('0x2e')][_0xa032('0x49')]({'where':{'id':_0x1d820b[_0xa032('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31dbd3,null))[_0xa032('0x27')](removeEntity(_0x31dbd3,null))[_0xa032('0x46')](handleError(_0x31dbd3,null));};exports['describe']=function(_0x8ec4be,_0x10d735){return db[_0xa032('0x2e')][_0xa032('0x4d')]()[_0xa032('0x27')](respondWithResult(_0x10d735,null))['catch'](handleError(_0x10d735,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index af3cdfe..093ee70 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 _0xb493=['path','rimraf','../../config/environment','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x56400d,_0x30ccef){var _0x17387d=function(_0x10e32d){while(--_0x10e32d){_0x56400d['push'](_0x56400d['shift']());}};_0x17387d(++_0x30ccef);}(_0xb493,0xf5));var _0x3b49=function(_0x2ebac6,_0x57c469){_0x2ebac6=_0x2ebac6-0x0;var _0x4a59e7=_0xb493[_0x2ebac6];return _0x4a59e7;};'use strict';var _=require(_0x3b49('0x0'));var util=require('util');var logger=require(_0x3b49('0x1'))(_0x3b49('0x2'));var moment=require('moment');var BPromise=require(_0x3b49('0x3'));var rp=require(_0x3b49('0x4'));var fs=require('fs');var path=require(_0x3b49('0x5'));var rimraf=require(_0x3b49('0x6'));var config=require(_0x3b49('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x418fd5,_0x20d71c){return _0x418fd5['define'](_0x3b49('0x8'),attributes,{'tableName':_0x3b49('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f12=['request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0x165259,_0x5d6abf){var _0x58252a=function(_0x2cda3a){while(--_0x2cda3a){_0x165259['push'](_0x165259['shift']());}};_0x58252a(++_0x5d6abf);}(_0x7f12,0x7f));var _0x27f1=function(_0x5b3546,_0x4f4571){_0x5b3546=_0x5b3546-0x0;var _0x40f027=_0x7f12[_0x5b3546];return _0x40f027;};'use strict';var _=require(_0x27f1('0x0'));var util=require(_0x27f1('0x1'));var logger=require(_0x27f1('0x2'))('api');var moment=require(_0x27f1('0x3'));var BPromise=require(_0x27f1('0x4'));var rp=require(_0x27f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27f1('0x6'));var config=require('../../config/environment');var attributes=require(_0x27f1('0x7'));module[_0x27f1('0x8')]=function(_0x33b9a7,_0xd43e3e){return _0x33b9a7[_0x27f1('0x9')](_0x27f1('0xa'),attributes,{'tableName':_0x27f1('0xb'),'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 890d382..38da70a 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 _0x15b8=['options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x51e656,_0x4c0ec6){var _0x10d0eb=function(_0x6df727){while(--_0x6df727){_0x51e656['push'](_0x51e656['shift']());}};_0x10d0eb(++_0x4c0ec6);}(_0x15b8,0xcd));var _0x815b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x15b8[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});}exports[_0x815b('0x18')]=function(_0x92d86a){var _0x26a8a3=this;return new Promise(function(_0x2fa2bd,_0x2ade43){return db[_0x815b('0x19')][_0x815b('0x1a')](_0x92d86a['body'],{'raw':_0x92d86a[_0x815b('0x1b')]?_0x92d86a[_0x815b('0x1b')][_0x815b('0x1c')]===undefined?!![]:![]:!![]})[_0x815b('0xc')](function(_0x3f710c){logger['info'](_0x815b('0x18'),_0x92d86a);logger[_0x815b('0x10')](_0x815b('0x18'),_0x92d86a,JSON['stringify'](_0x3f710c));_0x2fa2bd(_0x3f710c);})['catch'](function(_0x3ffdb7){logger[_0x815b('0x13')](_0x815b('0x18'),_0x3ffdb7[_0x815b('0x15')],_0x92d86a);_0x2ade43(_0x26a8a3[_0x815b('0x13')](0x1f4,_0x3ffdb7[_0x815b('0x15')]));});});}; \ No newline at end of file +var _0x5423=['options','raw','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5423,0xe3));var _0x3542=function(_0x9c8e6a,_0x10cd07){_0x9c8e6a=_0x9c8e6a-0x0;var _0x480e2b=_0x5423[_0x9c8e6a];return _0x480e2b;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')](_0x3d5199['body'],{'raw':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![]})[_0x3542('0x1b')](function(_0x212950){logger['info']('CreateSquareDetailsReport',_0x3d5199);logger['debug'](_0x3542('0x16'),_0x3d5199,JSON['stringify'](_0x212950));_0x32df3f(_0x212950);})[_0x3542('0x15')](function(_0x551645){logger[_0x3542('0x10')]('CreateSquareDetailsReport',_0x551645['message'],_0x3d5199);_0x53d4aa(_0x493d95[_0x3542('0x10')](0x1f4,_0x551645[_0x3542('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ea4ac3e..695ff2c 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 _0xbc39=['../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill','exports','express','Router'];(function(_0x102f4c,_0x58899b){var _0x5942e2=function(_0x2acb45){while(--_0x2acb45){_0x102f4c['push'](_0x102f4c['shift']());}};_0x5942e2(++_0x58899b);}(_0xbc39,0x115));var _0x9bc3=function(_0x321575,_0x458292){_0x321575=_0x321575-0x0;var _0x147fc3=_0xbc39[_0x321575];return _0x147fc3;};'use strict';var express=require(_0x9bc3('0x0'));var router=express[_0x9bc3('0x1')]();var auth=require(_0x9bc3('0x2'));var controller=require(_0x9bc3('0x3'));router['get']('/',auth[_0x9bc3('0x4')](),controller[_0x9bc3('0x5')]);router[_0x9bc3('0x6')](_0x9bc3('0x7'),auth[_0x9bc3('0x4')](),controller['killProcess']);module[_0x9bc3('0x8')]=router; \ No newline at end of file +var _0x64ef=['express','../../components/auth/service','get','index','/process/:pid/kill','killProcess'];(function(_0x16da1b,_0x1b7945){var _0x57d944=function(_0x5597e3){while(--_0x5597e3){_0x16da1b['push'](_0x16da1b['shift']());}};_0x57d944(++_0x1b7945);}(_0x64ef,0x108));var _0xf64e=function(_0x501284,_0x1d3657){_0x501284=_0x501284-0x0;var _0x1312d7=_0x64ef[_0x501284];return _0x1312d7;};'use strict';var express=require(_0xf64e('0x0'));var router=express['Router']();var auth=require(_0xf64e('0x1'));var controller=require('./system.controller');router[_0xf64e('0x2')]('/',auth['isAuthenticated'](),controller[_0xf64e('0x3')]);router[_0xf64e('0x2')](_0xf64e('0x4'),auth['isAuthenticated'](),controller[_0xf64e('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 52e2548..c0b5cf0 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 _0x32a6=['split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','inspect','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid'];(function(_0x1ca02b,_0x58460d){var _0x17a719=function(_0x56334a){while(--_0x56334a){_0x1ca02b['push'](_0x1ca02b['shift']());}};_0x17a719(++_0x58460d);}(_0x32a6,0xa3));var _0x632a=function(_0x17e05a,_0x25e3a){_0x17e05a=_0x17e05a-0x0;var _0x5a1bb9=_0x32a6[_0x17e05a];return _0x5a1bb9;};'use strict';var info=require(_0x632a('0x0'));var exec=require(_0x632a('0x1'))[_0x632a('0x2')];var logger=require(_0x632a('0x3'))(_0x632a('0x4'));var util=require(_0x632a('0x5'));var BPromise=require(_0x632a('0x6'));var _=require(_0x632a('0x7'));function handleError(_0x209cb7,_0x20ddcc,_0x4651ec){_0x20ddcc=_0x20ddcc||0x1f4;return function(_0x5ac67b){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4651ec,_0x20ddcc,util[_0x632a('0x8')](_0x5ac67b,{'showHidden':![],'depth':null}));delete _0x5ac67b['name'];_0x209cb7[_0x632a('0x9')](_0x20ddcc)[_0x632a('0xa')](_0x5ac67b);};}exports[_0x632a('0xb')]=function(_0x22e619,_0x3f9608){return info['getAllData']()[_0x632a('0xc')](function(_0x41fea8){return _0x3f9608[_0x632a('0x9')](0xc8)[_0x632a('0xd')](_0x41fea8);})[_0x632a('0xe')](function(_0x3bc3b1){return _0x3f9608[_0x632a('0x9')](0x1f4)[_0x632a('0xd')](_0x3bc3b1);});};exports[_0x632a('0xf')]=function(_0x2a9f30,_0x10e0ac){var _0x204ca7=['components/import/cm'];return new BPromise(function(_0x154e85,_0x37600a){return exec(util[_0x632a('0x10')](_0x632a('0x11'),_0x2a9f30['params'][_0x632a('0x12')]),function(_0x373213,_0x325646,_0x3a13e9){if(_0x373213){return _0x37600a(_0x373213);}return _0x154e85(_0x325646);});})[_0x632a('0xc')](function(_0x12dabb){var _0x3f0458=![];var _0x251bc2=_0x12dabb[_0x632a('0x13')](/\n/);for(var _0x3e1e18=0x0,_0x490af7=_0x204ca7[_0x632a('0x14')];_0x3e1e18<_0x490af7,_0x3f0458===![];_0x3e1e18+=0x1){if(_0x12dabb[_0x632a('0x15')](_0x204ca7[_0x3e1e18])>=0x0){_0x3f0458=!![];}}if(!_0x3f0458){throw new Error(util['format'](_0x632a('0x16'),_0x2a9f30[_0x632a('0x17')][_0x632a('0x12')]));}process[_0x632a('0x18')](_0x2a9f30[_0x632a('0x17')][_0x632a('0x12')],_0x632a('0x19'));return _0x10e0ac[_0x632a('0x9')](0xc8)['json']({'message':util[_0x632a('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2a9f30[_0x632a('0x17')][_0x632a('0x12')])});})[_0x632a('0xe')](handleError(_0x10e0ac,null,_0x632a('0xf')));}; \ No newline at end of file +var _0x0ccb=['components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','json','catch','killProcess'];(function(_0x48c691,_0x3b4b6b){var _0x27a6ba=function(_0x367371){while(--_0x367371){_0x48c691['push'](_0x48c691['shift']());}};_0x27a6ba(++_0x3b4b6b);}(_0x0ccb,0x128));var _0xb0cc=function(_0x4a3bba,_0x3e0670){_0x4a3bba=_0x4a3bba-0x0;var _0x3f9596=_0x0ccb[_0x4a3bba];return _0x3f9596;};'use strict';var info=require(_0xb0cc('0x0'));var exec=require('child_process')['exec'];var logger=require(_0xb0cc('0x1'))(_0xb0cc('0x2'));var util=require(_0xb0cc('0x3'));var BPromise=require(_0xb0cc('0x4'));var _=require(_0xb0cc('0x5'));function handleError(_0x4cfbf0,_0x3cc43d,_0x5ff222){_0x3cc43d=_0x3cc43d||0x1f4;return function(_0x5a560b){logger[_0xb0cc('0x6')](_0xb0cc('0x7'),_0x5ff222,_0x3cc43d,util[_0xb0cc('0x8')](_0x5a560b,{'showHidden':![],'depth':null}));delete _0x5a560b[_0xb0cc('0x9')];_0x4cfbf0[_0xb0cc('0xa')](_0x3cc43d)[_0xb0cc('0xb')](_0x5a560b);};}exports['index']=function(_0x41abfa,_0x4554b6){return info[_0xb0cc('0xc')]()['then'](function(_0x27d91b){return _0x4554b6['status'](0xc8)[_0xb0cc('0xd')](_0x27d91b);})[_0xb0cc('0xe')](function(_0xd5102b){return _0x4554b6[_0xb0cc('0xa')](0x1f4)[_0xb0cc('0xd')](_0xd5102b);});};exports[_0xb0cc('0xf')]=function(_0x4c8b4c,_0x181eef){var _0x5d892d=[_0xb0cc('0x10')];return new BPromise(function(_0x455250,_0x4520a6){return exec(util[_0xb0cc('0x11')](_0xb0cc('0x12'),_0x4c8b4c[_0xb0cc('0x13')][_0xb0cc('0x14')]),function(_0x56b60d,_0x2869b1,_0x52fe78){if(_0x56b60d){return _0x4520a6(_0x56b60d);}return _0x455250(_0x2869b1);});})['then'](function(_0x285094){var _0x3f83f6=![];var _0x1ed947=_0x285094[_0xb0cc('0x15')](/\n/);for(var _0x15aa48=0x0,_0x21a012=_0x5d892d[_0xb0cc('0x16')];_0x15aa48<_0x21a012,_0x3f83f6===![];_0x15aa48+=0x1){if(_0x285094[_0xb0cc('0x17')](_0x5d892d[_0x15aa48])>=0x0){_0x3f83f6=!![];}}if(!_0x3f83f6){throw new Error(util[_0xb0cc('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4c8b4c[_0xb0cc('0x13')]['pid']));}process['kill'](_0x4c8b4c[_0xb0cc('0x13')]['pid'],_0xb0cc('0x18'));return _0x181eef[_0xb0cc('0xa')](0xc8)[_0xb0cc('0xd')]({'message':util[_0xb0cc('0x11')](_0xb0cc('0x19'),_0x4c8b4c['params'][_0xb0cc('0x14')])});})[_0xb0cc('0xe')](handleError(_0x181eef,null,_0xb0cc('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index bf159b8..342c974 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 _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2dae,0xc3));var _0xe2da=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x2dae[_0x2ae2ad];return _0x26dbd7;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=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','./tag.controller','get','index','/describe','show','post'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 020ccda..1dfd9a3 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 _0x6f3e=['exports','STRING','name','#0091EA','sequelize'];(function(_0x532e0b,_0x217981){var _0x58009b=function(_0x46857a){while(--_0x46857a){_0x532e0b['push'](_0x532e0b['shift']());}};_0x58009b(++_0x217981);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f3e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe6f3('0x0'));module[_0xe6f3('0x1')]={'name':{'type':Sequelize[_0xe6f3('0x2')],'unique':_0xe6f3('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe6f3('0x2')],'defaultValue':_0xe6f3('0x4')},'description':{'type':Sequelize[_0xe6f3('0x2')]}}; \ No newline at end of file +var _0x253d=['sequelize','#0091EA','STRING'];(function(_0x1f0e3b,_0x23d2c8){var _0x202952=function(_0x10b678){while(--_0x10b678){_0x1f0e3b['push'](_0x1f0e3b['shift']());}};_0x202952(++_0x23d2c8);}(_0x253d,0x1b3));var _0xd253=function(_0x5f2a3f,_0x274522){_0x5f2a3f=_0x5f2a3f-0x0;var _0x338c10=_0x253d[_0x5f2a3f];return _0x338c10;};'use strict';var Sequelize=require(_0xd253('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xd253('0x1')},'description':{'type':Sequelize[_0xd253('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index bb4e99f..637fecf 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 _0xedca=['merge','options','includeAll','findAll','show','params','include','find','create','body','user','role','userProfileId','autoAssociation','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0xb56068,_0x1cd7a0){var _0x4b9c59=function(_0x137e25){while(--_0x137e25){_0xb56068['push'](_0xb56068['shift']());}};_0x4b9c59(++_0x1cd7a0);}(_0xedca,0x15c));var _0xaedc=function(_0xd99387,_0x2be94f){_0xd99387=_0xd99387-0x0;var _0x393bc2=_0xedca[_0xd99387];return _0x393bc2;};'use strict';var emlformat=require(_0xaedc('0x0'));var rimraf=require(_0xaedc('0x1'));var zipdir=require(_0xaedc('0x2'));var jsonpatch=require(_0xaedc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaedc('0x4'));var Mustache=require(_0xaedc('0x5'));var util=require(_0xaedc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xaedc('0x7'));var ejs=require(_0xaedc('0x8'));var fs=require('fs');var fs_extra=require(_0xaedc('0x9'));var _=require('lodash');var squel=require(_0xaedc('0xa'));var crypto=require(_0xaedc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaedc('0xc'));var toCsv=require(_0xaedc('0x7'));var querystring=require(_0xaedc('0xd'));var Papa=require(_0xaedc('0xe'));var Redis=require(_0xaedc('0xf'));var authService=require(_0xaedc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaedc('0x11'));var hardwareService=require(_0xaedc('0x12'));var logger=require(_0xaedc('0x13'))(_0xaedc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaedc('0x15'));var db=require(_0xaedc('0x16'))['db'];function respondWithStatusCode(_0x547bc0,_0x3c0dd3){_0x3c0dd3=_0x3c0dd3||0xcc;return function(_0x5c0660){if(_0x5c0660){return _0x547bc0[_0xaedc('0x17')](_0x3c0dd3);}return _0x547bc0['status'](_0x3c0dd3)[_0xaedc('0x18')]();};}function respondWithResult(_0x297cce,_0x22c711){_0x22c711=_0x22c711||0xc8;return function(_0x5e349f){if(_0x5e349f){return _0x297cce['status'](_0x22c711)['json'](_0x5e349f);}};}function respondWithFilteredResult(_0x5e4a6d,_0x12cf5d){return function(_0x5f01d5){if(_0x5f01d5){var _0x5d3252=typeof _0x12cf5d[_0xaedc('0x19')]===_0xaedc('0x1a')&&typeof _0x12cf5d[_0xaedc('0x1b')]===_0xaedc('0x1a');var _0x36a176=_0x5f01d5[_0xaedc('0x1c')];var _0x4b222a=_0x5d3252?0x0:_0x12cf5d['offset'];var _0x510893=_0x5d3252?_0x5f01d5['count']:_0x12cf5d[_0xaedc('0x19')]+_0x12cf5d[_0xaedc('0x1b')];var _0x46f2a4;if(_0x510893>=_0x36a176){_0x510893=_0x36a176;_0x46f2a4=0xc8;}else{_0x46f2a4=0xce;}_0x5e4a6d[_0xaedc('0x1d')](_0x46f2a4);return _0x5e4a6d[_0xaedc('0x1e')](_0xaedc('0x1f'),_0x4b222a+'-'+_0x510893+'/'+_0x36a176)[_0xaedc('0x20')](_0x5f01d5);}return null;};}function patchUpdates(_0x1b4937){return function(_0x40d844){try{jsonpatch[_0xaedc('0x21')](_0x40d844,_0x1b4937,!![]);}catch(_0x26dcf1){return BPromise[_0xaedc('0x22')](_0x26dcf1);}return _0x40d844[_0xaedc('0x23')]();};}function saveUpdates(_0xb1582d,_0x4ade2a){return function(_0x151b1f){if(_0x151b1f){return _0x151b1f[_0xaedc('0x24')](_0xb1582d)[_0xaedc('0x25')](function(_0x161e9c){return _0x161e9c;});}return null;};}function removeEntity(_0x65c624,_0x352b58){return function(_0x4a5c5e){if(_0x4a5c5e){return _0x4a5c5e['destroy']()['then'](function(){var _0x18f775=_0x4a5c5e[_0xaedc('0x26')]({'plain':!![]});var _0x2b5e00=_0xaedc('0x27');return db[_0xaedc('0x28')][_0xaedc('0x29')]({'where':{'type':_0x2b5e00,'resourceId':_0x18f775['id']}})[_0xaedc('0x25')](function(){return _0x4a5c5e;});})[_0xaedc('0x25')](function(){_0x65c624[_0xaedc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249d26,_0x3a1c42){return function(_0x4f7832){if(!_0x4f7832){_0x249d26[_0xaedc('0x17')](0x194);}return _0x4f7832;};}function handleError(_0x18ab69,_0x4ac4f2){_0x4ac4f2=_0x4ac4f2||0x1f4;return function(_0x689239){logger[_0xaedc('0x2a')](_0x689239[_0xaedc('0x2b')]);if(_0x689239[_0xaedc('0x2c')]){delete _0x689239[_0xaedc('0x2c')];}_0x18ab69['status'](_0x4ac4f2)[_0xaedc('0x2d')](_0x689239);};}exports['index']=function(_0x2e0609,_0x5d02b0){var _0x47227a={},_0x345bab={},_0x70fd96={'count':0x0,'rows':[]};var _0x1f82ce=_[_0xaedc('0x2e')](db[_0xaedc('0x2f')][_0xaedc('0x30')],function(_0x376904){return{'name':_0x376904[_0xaedc('0x31')],'type':_0x376904[_0xaedc('0x32')][_0xaedc('0x33')]};});_0x345bab[_0xaedc('0x34')]=_[_0xaedc('0x2e')](_0x1f82ce,_0xaedc('0x2c'));_0x345bab[_0xaedc('0x35')]=_[_0xaedc('0x36')](_0x2e0609[_0xaedc('0x35')]);_0x345bab['filters']=_[_0xaedc('0x37')](_0x345bab[_0xaedc('0x34')],_0x345bab[_0xaedc('0x35')]);_0x47227a['attributes']=_['intersection'](_0x345bab[_0xaedc('0x34')],qs['fields'](_0x2e0609[_0xaedc('0x35')][_0xaedc('0x38')]));_0x47227a[_0xaedc('0x39')]=_0x47227a[_0xaedc('0x39')][_0xaedc('0x3a')]?_0x47227a[_0xaedc('0x39')]:_0x345bab[_0xaedc('0x34')];if(!_0x2e0609[_0xaedc('0x35')][_0xaedc('0x3b')]('nolimit')){_0x47227a[_0xaedc('0x1b')]=qs[_0xaedc('0x1b')](_0x2e0609[_0xaedc('0x35')]['limit']);_0x47227a[_0xaedc('0x19')]=qs[_0xaedc('0x19')](_0x2e0609[_0xaedc('0x35')][_0xaedc('0x19')]);}_0x47227a[_0xaedc('0x3c')]=qs[_0xaedc('0x3d')](_0x2e0609[_0xaedc('0x35')]['sort']);_0x47227a[_0xaedc('0x3e')]=qs[_0xaedc('0x3f')](_[_0xaedc('0x40')](_0x2e0609[_0xaedc('0x35')],_0x345bab['filters']),_0x1f82ce);if(_0x2e0609[_0xaedc('0x35')][_0xaedc('0x41')]){_0x47227a[_0xaedc('0x3e')]=_['merge'](_0x47227a[_0xaedc('0x3e')],{'$or':_['map'](_0x1f82ce,function(_0x28ca06){if(_0x28ca06[_0xaedc('0x32')]!==_0xaedc('0x42')){var _0x188d47={};_0x188d47[_0x28ca06[_0xaedc('0x2c')]]={'$like':'%'+_0x2e0609[_0xaedc('0x35')][_0xaedc('0x41')]+'%'};return _0x188d47;}})});}_0x47227a=_[_0xaedc('0x43')]({},_0x47227a,_0x2e0609[_0xaedc('0x44')]);var _0x54a9fe={'where':_0x47227a['where']};return db['Tag'][_0xaedc('0x1c')](_0x54a9fe)[_0xaedc('0x25')](function(_0xad9b95){_0x70fd96[_0xaedc('0x1c')]=_0xad9b95;if(_0x2e0609[_0xaedc('0x35')][_0xaedc('0x45')]){_0x47227a['include']=[{'all':!![]}];}return db[_0xaedc('0x2f')][_0xaedc('0x46')](_0x47227a);})[_0xaedc('0x25')](function(_0x176d49){_0x70fd96['rows']=_0x176d49;return _0x70fd96;})[_0xaedc('0x25')](respondWithFilteredResult(_0x5d02b0,_0x47227a))['catch'](handleError(_0x5d02b0,null));};exports[_0xaedc('0x47')]=function(_0x57cd34,_0x1ac64b){var _0x400991={'raw':!![],'where':{'id':_0x57cd34[_0xaedc('0x48')]['id']}},_0x324003={};_0x324003['model']=_[_0xaedc('0x36')](db['Tag'][_0xaedc('0x30')]);_0x324003[_0xaedc('0x35')]=_['keys'](_0x57cd34['query']);_0x324003[_0xaedc('0x3f')]=_[_0xaedc('0x37')](_0x324003[_0xaedc('0x34')],_0x324003['query']);_0x400991['attributes']=_[_0xaedc('0x37')](_0x324003[_0xaedc('0x34')],qs['fields'](_0x57cd34[_0xaedc('0x35')][_0xaedc('0x38')]));_0x400991[_0xaedc('0x39')]=_0x400991['attributes']['length']?_0x400991[_0xaedc('0x39')]:_0x324003[_0xaedc('0x34')];if(_0x57cd34[_0xaedc('0x35')][_0xaedc('0x45')]){_0x400991[_0xaedc('0x49')]=[{'all':!![]}];}_0x400991=_[_0xaedc('0x43')]({},_0x400991,_0x57cd34[_0xaedc('0x44')]);return db[_0xaedc('0x2f')][_0xaedc('0x4a')](_0x400991)['then'](handleEntityNotFound(_0x1ac64b,null))[_0xaedc('0x25')](respondWithResult(_0x1ac64b,null))['catch'](handleError(_0x1ac64b,null));};exports[_0xaedc('0x4b')]=function(_0x2a88ff,_0x10acd0){return db[_0xaedc('0x2f')][_0xaedc('0x4b')](_0x2a88ff[_0xaedc('0x4c')],{})[_0xaedc('0x25')](function(_0x5ba65a){var _0x314ff1=_0x2a88ff[_0xaedc('0x4d')][_0xaedc('0x26')]({'plain':!![]});if(!_0x314ff1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x314ff1[_0xaedc('0x4e')]===_0xaedc('0x4d')){var _0x19626b=_0x5ba65a[_0xaedc('0x26')]({'plain':!![]});var _0x1e57a5='Tags';return db['UserProfileSection'][_0xaedc('0x4a')]({'where':{'name':_0x1e57a5,'userProfileId':_0x314ff1[_0xaedc('0x4f')]},'raw':!![]})[_0xaedc('0x25')](function(_0x188fa9){if(_0x188fa9&&_0x188fa9[_0xaedc('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x19626b[_0xaedc('0x2c')],'resourceId':_0x19626b['id'],'type':_0x188fa9[_0xaedc('0x2c')],'sectionId':_0x188fa9['id']},{})['then'](function(){return _0x5ba65a;});}else{return _0x5ba65a;}})['catch'](function(_0x2326cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2326cd);throw _0x2326cd;});}return _0x5ba65a;})[_0xaedc('0x25')](respondWithResult(_0x10acd0,0xc9))[_0xaedc('0x51')](handleError(_0x10acd0,null));};exports[_0xaedc('0x24')]=function(_0x1cf8f6,_0x53bcb7){if(_0x1cf8f6[_0xaedc('0x4c')]['id']){delete _0x1cf8f6[_0xaedc('0x4c')]['id'];}return db[_0xaedc('0x2f')][_0xaedc('0x4a')]({'where':{'id':_0x1cf8f6[_0xaedc('0x48')]['id']}})[_0xaedc('0x25')](handleEntityNotFound(_0x53bcb7,null))[_0xaedc('0x25')](saveUpdates(_0x1cf8f6['body'],null))['then'](respondWithResult(_0x53bcb7,null))[_0xaedc('0x51')](handleError(_0x53bcb7,null));};exports[_0xaedc('0x29')]=function(_0x4046b1,_0x285307){return db['Tag']['find']({'where':{'id':_0x4046b1['params']['id']}})[_0xaedc('0x25')](handleEntityNotFound(_0x285307,null))[_0xaedc('0x25')](removeEntity(_0x285307,null))['catch'](handleError(_0x285307,null));};exports[_0xaedc('0x52')]=function(_0x391639,_0x5e145d){return db[_0xaedc('0x2f')]['describe']()[_0xaedc('0x25')](respondWithResult(_0x5e145d,null))[_0xaedc('0x51')](handleError(_0x5e145d,null));}; \ No newline at end of file +var _0xd653=['order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','end','error','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x34a923,_0x3ce38d){var _0x46442b=function(_0x110960){while(--_0x110960){_0x34a923['push'](_0x34a923['shift']());}};_0x46442b(++_0x3ce38d);}(_0xd653,0x6e));var _0x3d65=function(_0x3a65c8,_0x536dd7){_0x3a65c8=_0x3a65c8-0x0;var _0x523b8a=_0xd653[_0x3a65c8];return _0x523b8a;};'use strict';var emlformat=require(_0x3d65('0x0'));var rimraf=require(_0x3d65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3d65('0x2'));var moment=require(_0x3d65('0x3'));var BPromise=require(_0x3d65('0x4'));var Mustache=require('mustache');var util=require(_0x3d65('0x5'));var path=require(_0x3d65('0x6'));var sox=require(_0x3d65('0x7'));var csv=require(_0x3d65('0x8'));var ejs=require(_0x3d65('0x9'));var fs=require('fs');var fs_extra=require(_0x3d65('0xa'));var _=require('lodash');var squel=require(_0x3d65('0xb'));var crypto=require(_0x3d65('0xc'));var jsforce=require(_0x3d65('0xd'));var deskjs=require(_0x3d65('0xe'));var toCsv=require(_0x3d65('0x8'));var querystring=require(_0x3d65('0xf'));var Papa=require('papaparse');var Redis=require(_0x3d65('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3d65('0x11'));var as=require(_0x3d65('0x12'));var hardwareService=require(_0x3d65('0x13'));var logger=require('../../config/logger')(_0x3d65('0x14'));var utils=require(_0x3d65('0x15'));var config=require(_0x3d65('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x525b0c,_0x4cbd80){_0x4cbd80=_0x4cbd80||0xcc;return function(_0x27aa6d){if(_0x27aa6d){return _0x525b0c[_0x3d65('0x17')](_0x4cbd80);}return _0x525b0c[_0x3d65('0x18')](_0x4cbd80)['end']();};}function respondWithResult(_0x3a2e6c,_0x1ad518){_0x1ad518=_0x1ad518||0xc8;return function(_0x1c7997){if(_0x1c7997){return _0x3a2e6c[_0x3d65('0x18')](_0x1ad518)[_0x3d65('0x19')](_0x1c7997);}};}function respondWithFilteredResult(_0x201c42,_0x48b80e){return function(_0x16415d){if(_0x16415d){var _0x3d4c68=typeof _0x48b80e[_0x3d65('0x1a')]==='undefined'&&typeof _0x48b80e[_0x3d65('0x1b')]===_0x3d65('0x1c');var _0x55aa01=_0x16415d['count'];var _0x32bdb9=_0x3d4c68?0x0:_0x48b80e['offset'];var _0x3497c8=_0x3d4c68?_0x16415d[_0x3d65('0x1d')]:_0x48b80e[_0x3d65('0x1a')]+_0x48b80e[_0x3d65('0x1b')];var _0x370cc7;if(_0x3497c8>=_0x55aa01){_0x3497c8=_0x55aa01;_0x370cc7=0xc8;}else{_0x370cc7=0xce;}_0x201c42[_0x3d65('0x18')](_0x370cc7);return _0x201c42[_0x3d65('0x1e')]('Content-Range',_0x32bdb9+'-'+_0x3497c8+'/'+_0x55aa01)[_0x3d65('0x19')](_0x16415d);}return null;};}function patchUpdates(_0x180f43){return function(_0x2d9c6d){try{jsonpatch[_0x3d65('0x1f')](_0x2d9c6d,_0x180f43,!![]);}catch(_0x230b37){return BPromise[_0x3d65('0x20')](_0x230b37);}return _0x2d9c6d['save']();};}function saveUpdates(_0x47f19f,_0x19a8a3){return function(_0x7a1759){if(_0x7a1759){return _0x7a1759[_0x3d65('0x21')](_0x47f19f)[_0x3d65('0x22')](function(_0x5ab424){return _0x5ab424;});}return null;};}function removeEntity(_0x1d1015,_0x559817){return function(_0x95a21a){if(_0x95a21a){return _0x95a21a[_0x3d65('0x23')]()['then'](function(){var _0x639b31=_0x95a21a[_0x3d65('0x24')]({'plain':!![]});var _0x53584f=_0x3d65('0x25');return db[_0x3d65('0x26')][_0x3d65('0x23')]({'where':{'type':_0x53584f,'resourceId':_0x639b31['id']}})[_0x3d65('0x22')](function(){return _0x95a21a;});})[_0x3d65('0x22')](function(){_0x1d1015[_0x3d65('0x18')](0xcc)[_0x3d65('0x27')]();});}};}function handleEntityNotFound(_0x5f21ce,_0x5d9bf5){return function(_0x1edf67){if(!_0x1edf67){_0x5f21ce[_0x3d65('0x17')](0x194);}return _0x1edf67;};}function handleError(_0x198d17,_0x15271e){_0x15271e=_0x15271e||0x1f4;return function(_0x20dad7){logger[_0x3d65('0x28')](_0x20dad7['stack']);if(_0x20dad7[_0x3d65('0x29')]){delete _0x20dad7[_0x3d65('0x29')];}_0x198d17['status'](_0x15271e)[_0x3d65('0x2a')](_0x20dad7);};}exports[_0x3d65('0x2b')]=function(_0x5593e4,_0x3c24db){var _0x50ae1b={},_0x4ea44a={},_0x51d17c={'count':0x0,'rows':[]};var _0x3a2295=_[_0x3d65('0x2c')](db[_0x3d65('0x2d')][_0x3d65('0x2e')],function(_0x2519d5){return{'name':_0x2519d5[_0x3d65('0x2f')],'type':_0x2519d5[_0x3d65('0x30')]['key']};});_0x4ea44a[_0x3d65('0x31')]=_[_0x3d65('0x2c')](_0x3a2295,'name');_0x4ea44a[_0x3d65('0x32')]=_[_0x3d65('0x33')](_0x5593e4['query']);_0x4ea44a['filters']=_[_0x3d65('0x34')](_0x4ea44a['model'],_0x4ea44a['query']);_0x50ae1b[_0x3d65('0x35')]=_[_0x3d65('0x34')](_0x4ea44a[_0x3d65('0x31')],qs['fields'](_0x5593e4['query'][_0x3d65('0x36')]));_0x50ae1b[_0x3d65('0x35')]=_0x50ae1b['attributes'][_0x3d65('0x37')]?_0x50ae1b[_0x3d65('0x35')]:_0x4ea44a[_0x3d65('0x31')];if(!_0x5593e4[_0x3d65('0x32')][_0x3d65('0x38')](_0x3d65('0x39'))){_0x50ae1b['limit']=qs['limit'](_0x5593e4[_0x3d65('0x32')][_0x3d65('0x1b')]);_0x50ae1b[_0x3d65('0x1a')]=qs[_0x3d65('0x1a')](_0x5593e4['query'][_0x3d65('0x1a')]);}_0x50ae1b[_0x3d65('0x3a')]=qs[_0x3d65('0x3b')](_0x5593e4['query'][_0x3d65('0x3b')]);_0x50ae1b[_0x3d65('0x3c')]=qs['filters'](_[_0x3d65('0x3d')](_0x5593e4[_0x3d65('0x32')],_0x4ea44a[_0x3d65('0x3e')]),_0x3a2295);if(_0x5593e4[_0x3d65('0x32')][_0x3d65('0x3f')]){_0x50ae1b['where']=_[_0x3d65('0x40')](_0x50ae1b[_0x3d65('0x3c')],{'$or':_[_0x3d65('0x2c')](_0x3a2295,function(_0x379a09){if(_0x379a09[_0x3d65('0x30')]!==_0x3d65('0x41')){var _0x1d1e37={};_0x1d1e37[_0x379a09[_0x3d65('0x29')]]={'$like':'%'+_0x5593e4['query'][_0x3d65('0x3f')]+'%'};return _0x1d1e37;}})});}_0x50ae1b=_[_0x3d65('0x40')]({},_0x50ae1b,_0x5593e4[_0x3d65('0x42')]);var _0xc7541c={'where':_0x50ae1b['where']};return db[_0x3d65('0x2d')][_0x3d65('0x1d')](_0xc7541c)[_0x3d65('0x22')](function(_0x3709ce){_0x51d17c[_0x3d65('0x1d')]=_0x3709ce;if(_0x5593e4[_0x3d65('0x32')][_0x3d65('0x43')]){_0x50ae1b[_0x3d65('0x44')]=[{'all':!![]}];}return db['Tag'][_0x3d65('0x45')](_0x50ae1b);})[_0x3d65('0x22')](function(_0x2193ce){_0x51d17c[_0x3d65('0x46')]=_0x2193ce;return _0x51d17c;})['then'](respondWithFilteredResult(_0x3c24db,_0x50ae1b))['catch'](handleError(_0x3c24db,null));};exports[_0x3d65('0x47')]=function(_0x3bdcd4,_0x1b10cb){var _0x27e191={'raw':!![],'where':{'id':_0x3bdcd4[_0x3d65('0x48')]['id']}},_0x252bb8={};_0x252bb8[_0x3d65('0x31')]=_[_0x3d65('0x33')](db[_0x3d65('0x2d')][_0x3d65('0x2e')]);_0x252bb8[_0x3d65('0x32')]=_[_0x3d65('0x33')](_0x3bdcd4[_0x3d65('0x32')]);_0x252bb8[_0x3d65('0x3e')]=_[_0x3d65('0x34')](_0x252bb8[_0x3d65('0x31')],_0x252bb8['query']);_0x27e191[_0x3d65('0x35')]=_[_0x3d65('0x34')](_0x252bb8[_0x3d65('0x31')],qs['fields'](_0x3bdcd4['query'][_0x3d65('0x36')]));_0x27e191['attributes']=_0x27e191[_0x3d65('0x35')][_0x3d65('0x37')]?_0x27e191[_0x3d65('0x35')]:_0x252bb8['model'];if(_0x3bdcd4[_0x3d65('0x32')][_0x3d65('0x43')]){_0x27e191[_0x3d65('0x44')]=[{'all':!![]}];}_0x27e191=_[_0x3d65('0x40')]({},_0x27e191,_0x3bdcd4['options']);return db[_0x3d65('0x2d')][_0x3d65('0x49')](_0x27e191)[_0x3d65('0x22')](handleEntityNotFound(_0x1b10cb,null))['then'](respondWithResult(_0x1b10cb,null))['catch'](handleError(_0x1b10cb,null));};exports[_0x3d65('0x4a')]=function(_0xd98b72,_0x3efef8){return db[_0x3d65('0x2d')][_0x3d65('0x4a')](_0xd98b72[_0x3d65('0x4b')],{})['then'](function(_0x19a9a0){var _0x14b588=_0xd98b72[_0x3d65('0x4c')][_0x3d65('0x24')]({'plain':!![]});if(!_0x14b588)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14b588[_0x3d65('0x4d')]==='user'){var _0x44f874=_0x19a9a0[_0x3d65('0x24')]({'plain':!![]});var _0x38e02a='Tags';return db[_0x3d65('0x4e')][_0x3d65('0x49')]({'where':{'name':_0x38e02a,'userProfileId':_0x14b588[_0x3d65('0x4f')]},'raw':!![]})[_0x3d65('0x22')](function(_0x42cae8){if(_0x42cae8&&_0x42cae8[_0x3d65('0x50')]===0x0){return db['UserProfileResource'][_0x3d65('0x4a')]({'name':_0x44f874['name'],'resourceId':_0x44f874['id'],'type':_0x42cae8['name'],'sectionId':_0x42cae8['id']},{})[_0x3d65('0x22')](function(){return _0x19a9a0;});}else{return _0x19a9a0;}})[_0x3d65('0x51')](function(_0x22bd5c){logger[_0x3d65('0x28')](_0x3d65('0x52'),_0x22bd5c);throw _0x22bd5c;});}return _0x19a9a0;})[_0x3d65('0x22')](respondWithResult(_0x3efef8,0xc9))[_0x3d65('0x51')](handleError(_0x3efef8,null));};exports['update']=function(_0x23d56a,_0x48ace4){if(_0x23d56a['body']['id']){delete _0x23d56a['body']['id'];}return db[_0x3d65('0x2d')][_0x3d65('0x49')]({'where':{'id':_0x23d56a[_0x3d65('0x48')]['id']}})[_0x3d65('0x22')](handleEntityNotFound(_0x48ace4,null))[_0x3d65('0x22')](saveUpdates(_0x23d56a[_0x3d65('0x4b')],null))[_0x3d65('0x22')](respondWithResult(_0x48ace4,null))[_0x3d65('0x51')](handleError(_0x48ace4,null));};exports[_0x3d65('0x23')]=function(_0xcea814,_0x47c13e){return db[_0x3d65('0x2d')][_0x3d65('0x49')]({'where':{'id':_0xcea814['params']['id']}})[_0x3d65('0x22')](handleEntityNotFound(_0x47c13e,null))[_0x3d65('0x22')](removeEntity(_0x47c13e,null))[_0x3d65('0x51')](handleError(_0x47c13e,null));};exports[_0x3d65('0x53')]=function(_0x433d3b,_0x7dd267){return db[_0x3d65('0x2d')][_0x3d65('0x53')]()[_0x3d65('0x22')](respondWithResult(_0x7dd267,null))['catch'](handleError(_0x7dd267,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0632499..1533b82 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 _0x274c=['path','rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x274c,0xae));var _0xc274=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x274c[_0x491faa];return _0x414440;};'use strict';var _=require(_0xc274('0x0'));var util=require(_0xc274('0x1'));var logger=require(_0xc274('0x2'))(_0xc274('0x3'));var moment=require(_0xc274('0x4'));var BPromise=require(_0xc274('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc274('0x6'));var rimraf=require(_0xc274('0x7'));var config=require('../../config/environment');var attributes=require(_0xc274('0x8'));module[_0xc274('0x9')]=function(_0x294072,_0x21a674){return _0x294072[_0xc274('0xa')]('Tag',attributes,{'tableName':_0xc274('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2db4=['moment','bluebird','request-promise','path','../../config/environment','exports','define','Tag','tools_tags','util','../../config/logger','api'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x2db4,0xd5));var _0x42db=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2db4[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0x42db('0x0'));var logger=require(_0x42db('0x1'))(_0x42db('0x2'));var moment=require(_0x42db('0x3'));var BPromise=require(_0x42db('0x4'));var rp=require(_0x42db('0x5'));var fs=require('fs');var path=require(_0x42db('0x6'));var rimraf=require('rimraf');var config=require(_0x42db('0x7'));var attributes=require('./tag.attributes');module[_0x42db('0x8')]=function(_0x1bccb4,_0x3b612c){return _0x1bccb4[_0x42db('0x9')](_0x42db('0xa'),attributes,{'tableName':_0x42db('0xb'),'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 1f9fb96..a6604d7 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 _0x43fd=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x43fd,0x1ec));var _0xd43f=function(_0x583c7c,_0x437395){_0x583c7c=_0x583c7c-0x0;var _0x8be7b1=_0x43fd[_0x583c7c];return _0x8be7b1;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('Tag,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('Tag,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file +var _0x72b1=['stringify','error','Tag,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s'];(function(_0x4d6581,_0x3fd72e){var _0x5e8cdf=function(_0x6667fe){while(--_0x6667fe){_0x4d6581['push'](_0x4d6581['shift']());}};_0x5e8cdf(++_0x3fd72e);}(_0x72b1,0x16e));var _0x172b=function(_0x58f6ff,_0x1af70d){_0x58f6ff=_0x58f6ff-0x0;var _0x5cdcfd=_0x72b1[_0x58f6ff];return _0x5cdcfd;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var moment=require(_0x172b('0x1'));var BPromise=require(_0x172b('0x2'));var rs=require(_0x172b('0x3'));var fs=require('fs');var Redis=require(_0x172b('0x4'));var db=require(_0x172b('0x5'))['db'];var utils=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('rpc');var config=require(_0x172b('0x8'));var jayson=require(_0x172b('0x9'));var client=jayson[_0x172b('0xa')][_0x172b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571994,_0x345e5e,_0x517363){return new BPromise(function(_0x1f98e9,_0x531b10){return client[_0x172b('0xc')](_0x571994,_0x517363)[_0x172b('0xd')](function(_0x977f18){logger[_0x172b('0xe')]('Tag,\x20%s,\x20%s',_0x345e5e,_0x172b('0xf'));logger[_0x172b('0x10')](_0x172b('0x11'),_0x345e5e,_0x172b('0xf'),JSON[_0x172b('0x12')](_0x977f18));if(_0x977f18[_0x172b('0x13')]){if(_0x977f18[_0x172b('0x13')]['code']===0x1f4){logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18[_0x172b('0x13')]['message']);return _0x531b10(_0x977f18[_0x172b('0x13')]['message']);}logger[_0x172b('0x13')](_0x172b('0x14'),_0x345e5e,_0x977f18['error'][_0x172b('0x15')]);return _0x1f98e9(_0x977f18[_0x172b('0x13')][_0x172b('0x15')]);}else{logger[_0x172b('0xe')]('Tag,\x20%s,\x20%s',_0x345e5e,'request\x20sent');_0x1f98e9(_0x977f18[_0x172b('0x16')][_0x172b('0x15')]);}})[_0x172b('0x17')](function(_0x3c7fff){logger['error']('Tag,\x20%s,\x20%s',_0x345e5e,_0x3c7fff);_0x531b10(_0x3c7fff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a3a3428..7c93268 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 450eb85..3f914b8 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x3f62d0,_0x4ff9c1){var _0x1fb2ba=function(_0x349819){while(--_0x349819){_0x3f62d0['push'](_0x3f62d0['shift']());}};_0x1fb2ba(++_0x4ff9c1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a368dc9..48862f7 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 _0x9833=['UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','Queue','rawAttributes','pick','toLowerCase','Unknown\x20channel','add','Queues','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','removeAgents','Queue:remove','filter','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','sendStatus','error','name','send','index','map','Team','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','options','findAll','then','rows','show','params','keys','include','catch','create','body','user','get','role','Teams'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x9833,0x181));var _0x3983=function(_0x5c8b1d,_0x90782a){_0x5c8b1d=_0x5c8b1d-0x0;var _0x59db68=_0x9833[_0x5c8b1d];return _0x59db68;};'use strict';var emlformat=require(_0x3983('0x0'));var rimraf=require(_0x3983('0x1'));var zipdir=require(_0x3983('0x2'));var jsonpatch=require(_0x3983('0x3'));var rp=require(_0x3983('0x4'));var moment=require(_0x3983('0x5'));var BPromise=require(_0x3983('0x6'));var Mustache=require('mustache');var util=require(_0x3983('0x7'));var path=require(_0x3983('0x8'));var sox=require(_0x3983('0x9'));var csv=require(_0x3983('0xa'));var ejs=require(_0x3983('0xb'));var fs=require('fs');var fs_extra=require(_0x3983('0xc'));var _=require('lodash');var squel=require(_0x3983('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3983('0xa'));var querystring=require('querystring');var Papa=require(_0x3983('0xe'));var Redis=require(_0x3983('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3983('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3983('0x11'))(_0x3983('0x12'));var utils=require(_0x3983('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3983('0x14'));var db=require(_0x3983('0x15'))['db'];config[_0x3983('0x16')]=_[_0x3983('0x17')](config[_0x3983('0x16')],{'host':_0x3983('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x3983('0x19')](socket);function respondWithStatusCode(_0x22515d,_0x5c18fb){_0x5c18fb=_0x5c18fb||0xcc;return function(_0x3f580c){if(_0x3f580c){return _0x22515d['sendStatus'](_0x5c18fb);}return _0x22515d[_0x3983('0x1a')](_0x5c18fb)[_0x3983('0x1b')]();};}function respondWithResult(_0x20deda,_0x36f2e8){_0x36f2e8=_0x36f2e8||0xc8;return function(_0x264fc5){if(_0x264fc5){return _0x20deda[_0x3983('0x1a')](_0x36f2e8)[_0x3983('0x1c')](_0x264fc5);}};}function respondWithFilteredResult(_0x5c10ce,_0x29b45c){return function(_0x3cb042){if(_0x3cb042){var _0x8a9d5e=typeof _0x29b45c[_0x3983('0x1d')]===_0x3983('0x1e')&&typeof _0x29b45c[_0x3983('0x1f')]===_0x3983('0x1e');var _0x51f069=_0x3cb042['count'];var _0x282083=_0x8a9d5e?0x0:_0x29b45c[_0x3983('0x1d')];var _0xeed825=_0x8a9d5e?_0x3cb042[_0x3983('0x20')]:_0x29b45c[_0x3983('0x1d')]+_0x29b45c['limit'];var _0x2517f3;if(_0xeed825>=_0x51f069){_0xeed825=_0x51f069;_0x2517f3=0xc8;}else{_0x2517f3=0xce;}_0x5c10ce[_0x3983('0x1a')](_0x2517f3);return _0x5c10ce[_0x3983('0x21')](_0x3983('0x22'),_0x282083+'-'+_0xeed825+'/'+_0x51f069)[_0x3983('0x1c')](_0x3cb042);}return null;};}function patchUpdates(_0x597cb2){return function(_0x5c7003){try{jsonpatch['apply'](_0x5c7003,_0x597cb2,!![]);}catch(_0x189fa7){return BPromise[_0x3983('0x23')](_0x189fa7);}return _0x5c7003[_0x3983('0x24')]();};}function saveUpdates(_0x255840,_0x50cf14){return function(_0x55e46b){if(_0x55e46b){return _0x55e46b[_0x3983('0x25')](_0x255840)['then'](function(_0x347efe){return _0x347efe;});}return null;};}function handleEntityNotFound(_0x3f6e22,_0x3b79c0){return function(_0x10e6c3){if(!_0x10e6c3){_0x3f6e22[_0x3983('0x26')](0x194);}return _0x10e6c3;};}function handleError(_0x47fe0d,_0x45c498){_0x45c498=_0x45c498||0x1f4;return function(_0x60a5e7){logger[_0x3983('0x27')](_0x60a5e7['stack']);if(_0x60a5e7[_0x3983('0x28')]){delete _0x60a5e7[_0x3983('0x28')];}_0x47fe0d['status'](_0x45c498)[_0x3983('0x29')](_0x60a5e7);};}exports[_0x3983('0x2a')]=function(_0x31b8f3,_0x513608){var _0x5514c3={},_0x5a0817={},_0x585c6d={'count':0x0,'rows':[]};var _0x267e93=_[_0x3983('0x2b')](db[_0x3983('0x2c')]['rawAttributes'],function(_0x251f55){return{'name':_0x251f55[_0x3983('0x2d')],'type':_0x251f55[_0x3983('0x2e')][_0x3983('0x2f')]};});_0x5a0817['model']=_[_0x3983('0x2b')](_0x267e93,_0x3983('0x28'));_0x5a0817[_0x3983('0x30')]=_['keys'](_0x31b8f3[_0x3983('0x30')]);_0x5a0817['filters']=_[_0x3983('0x31')](_0x5a0817[_0x3983('0x32')],_0x5a0817['query']);_0x5514c3[_0x3983('0x33')]=_[_0x3983('0x31')](_0x5a0817[_0x3983('0x32')],qs['fields'](_0x31b8f3[_0x3983('0x30')][_0x3983('0x34')]));_0x5514c3['attributes']=_0x5514c3[_0x3983('0x33')][_0x3983('0x35')]?_0x5514c3[_0x3983('0x33')]:_0x5a0817['model'];if(!_0x31b8f3['query'][_0x3983('0x36')](_0x3983('0x37'))){_0x5514c3[_0x3983('0x1f')]=qs[_0x3983('0x1f')](_0x31b8f3['query']['limit']);_0x5514c3['offset']=qs['offset'](_0x31b8f3['query'][_0x3983('0x1d')]);}_0x5514c3[_0x3983('0x38')]=qs[_0x3983('0x39')](_0x31b8f3['query'][_0x3983('0x39')]);_0x5514c3['where']=qs[_0x3983('0x3a')](_['pick'](_0x31b8f3[_0x3983('0x30')],_0x5a0817[_0x3983('0x3a')]),_0x267e93);if(_0x31b8f3[_0x3983('0x30')]['filter']){_0x5514c3[_0x3983('0x3b')]=_[_0x3983('0x3c')](_0x5514c3[_0x3983('0x3b')],{'$or':_['map'](_0x267e93,function(_0x169c8c){if(_0x169c8c[_0x3983('0x2e')]!==_0x3983('0x3d')){var _0x150458={};_0x150458[_0x169c8c['name']]={'$like':'%'+_0x31b8f3[_0x3983('0x30')]['filter']+'%'};return _0x150458;}})});}_0x5514c3=_[_0x3983('0x3c')]({},_0x5514c3,_0x31b8f3[_0x3983('0x3e')]);var _0x2c5b07={'where':_0x5514c3[_0x3983('0x3b')]};return db[_0x3983('0x2c')][_0x3983('0x20')](_0x2c5b07)['then'](function(_0x9b8424){_0x585c6d[_0x3983('0x20')]=_0x9b8424;if(_0x31b8f3[_0x3983('0x30')]['includeAll']){_0x5514c3['include']=[{'all':!![]}];}return db[_0x3983('0x2c')][_0x3983('0x3f')](_0x5514c3);})[_0x3983('0x40')](function(_0x171132){_0x585c6d[_0x3983('0x41')]=_0x171132;return _0x585c6d;})[_0x3983('0x40')](respondWithFilteredResult(_0x513608,_0x5514c3))['catch'](handleError(_0x513608,null));};exports[_0x3983('0x42')]=function(_0x1432bc,_0x279347){var _0x2b2ac9={'raw':![],'where':{'id':_0x1432bc[_0x3983('0x43')]['id']}},_0x3f0af3={};_0x3f0af3[_0x3983('0x32')]=_[_0x3983('0x44')](db[_0x3983('0x2c')]['rawAttributes']);_0x3f0af3[_0x3983('0x30')]=_[_0x3983('0x44')](_0x1432bc[_0x3983('0x30')]);_0x3f0af3[_0x3983('0x3a')]=_[_0x3983('0x31')](_0x3f0af3[_0x3983('0x32')],_0x3f0af3['query']);_0x2b2ac9[_0x3983('0x33')]=_['intersection'](_0x3f0af3[_0x3983('0x32')],qs[_0x3983('0x34')](_0x1432bc[_0x3983('0x30')]['fields']));_0x2b2ac9[_0x3983('0x33')]=_0x2b2ac9[_0x3983('0x33')][_0x3983('0x35')]?_0x2b2ac9[_0x3983('0x33')]:_0x3f0af3['model'];if(_0x1432bc[_0x3983('0x30')]['includeAll']){_0x2b2ac9[_0x3983('0x45')]=[{'all':!![]}];}_0x2b2ac9=_[_0x3983('0x3c')]({},_0x2b2ac9,_0x1432bc[_0x3983('0x3e')]);return db[_0x3983('0x2c')]['find'](_0x2b2ac9)[_0x3983('0x40')](handleEntityNotFound(_0x279347,null))[_0x3983('0x40')](respondWithResult(_0x279347,null))[_0x3983('0x46')](handleError(_0x279347,null));};exports[_0x3983('0x47')]=function(_0x74fbfc,_0x10d369){return db[_0x3983('0x2c')][_0x3983('0x47')](_0x74fbfc[_0x3983('0x48')],{})[_0x3983('0x40')](function(_0x10fdac){var _0x277e74=_0x74fbfc[_0x3983('0x49')][_0x3983('0x4a')]({'plain':!![]});if(!_0x277e74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x277e74[_0x3983('0x4b')]===_0x3983('0x49')){var _0x58f6cc=_0x10fdac[_0x3983('0x4a')]({'plain':!![]});var _0x4f941b=_0x3983('0x4c');return db[_0x3983('0x4d')][_0x3983('0x4e')]({'where':{'name':_0x4f941b,'userProfileId':_0x277e74[_0x3983('0x4f')]},'raw':!![]})[_0x3983('0x40')](function(_0x3af0a5){if(_0x3af0a5&&_0x3af0a5[_0x3983('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x58f6cc[_0x3983('0x28')],'resourceId':_0x58f6cc['id'],'type':_0x3af0a5[_0x3983('0x28')],'sectionId':_0x3af0a5['id']},{})[_0x3983('0x40')](function(){return _0x10fdac;});}else{return _0x10fdac;}})[_0x3983('0x46')](function(_0x5edd0a){logger[_0x3983('0x27')](_0x3983('0x51'),_0x5edd0a);throw _0x5edd0a;});}return _0x10fdac;})[_0x3983('0x40')](respondWithResult(_0x10d369,0xc9))[_0x3983('0x46')](handleError(_0x10d369,null));};exports[_0x3983('0x25')]=function(_0x19e5a7,_0x5915bc){if(_0x19e5a7[_0x3983('0x48')]['id']){delete _0x19e5a7[_0x3983('0x48')]['id'];}return db[_0x3983('0x2c')][_0x3983('0x4e')]({'where':{'id':_0x19e5a7['params']['id']}})[_0x3983('0x40')](handleEntityNotFound(_0x5915bc,null))[_0x3983('0x40')](saveUpdates(_0x19e5a7[_0x3983('0x48')],null))['then'](respondWithResult(_0x5915bc,null))[_0x3983('0x46')](handleError(_0x5915bc,null));};exports[_0x3983('0x52')]=function(_0xc3d597,_0x1a1351){var _0x1b584e=_0xc3d597[_0x3983('0x43')]['id'];var _0x181b0d=[];return db['sequelize']['transaction'](function(_0x3b34a4){var _0x48a0df=_0x3983('0x53')+_0x1b584e;return db[_0x3983('0x54')]['query'](_0x48a0df,{'type':db['Sequelize'][_0x3983('0x55')]['SELECT'],'raw':!![],'transaction':_0x3b34a4})[_0x3983('0x40')](function(_0x381702){_0x181b0d=_[_0x3983('0x2b')](_0x381702,function(_0x527fb4){return Number(_0x527fb4[_0x3983('0x56')]);});})[_0x3983('0x40')](function(){var _0x44761b=_0x3983('0x57')+_0x1b584e;return db[_0x3983('0x54')][_0x3983('0x30')](_0x44761b,{'type':db[_0x3983('0x58')][_0x3983('0x55')][_0x3983('0x59')],'raw':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0x12da6a){var _0x10c75f=_['map'](_0x12da6a,function(_0x30a8c3){return Number(_0x30a8c3[_0x3983('0x5a')]);});return db['UserVoiceQueue'][_0x3983('0x52')]({'where':{'UserId':{'$in':_0x181b0d},'VoiceQueueId':{'$in':_0x10c75f}},'transaction':_0x3b34a4});})[_0x3983('0x40')](function(){var _0x28decf=_0x3983('0x5b')+_0x1b584e;return db['sequelize'][_0x3983('0x30')](_0x28decf,{'type':db[_0x3983('0x58')][_0x3983('0x55')]['SELECT'],'raw':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0x61daa7){var _0x45e01b=_[_0x3983('0x2b')](_0x61daa7,function(_0x4c2a00){return Number(_0x4c2a00['MailQueueId']);});return db[_0x3983('0x5c')][_0x3983('0x52')]({'where':{'UserId':{'$in':_0x181b0d},'MailQueueId':{'$in':_0x45e01b}},'transaction':_0x3b34a4});})[_0x3983('0x40')](function(){var _0x1acb19=_0x3983('0x5d')+_0x1b584e;return db[_0x3983('0x54')][_0x3983('0x30')](_0x1acb19,{'type':db[_0x3983('0x58')]['QueryTypes'][_0x3983('0x59')],'raw':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0x18b41d){var _0x8438b=_['map'](_0x18b41d,function(_0x167335){return Number(_0x167335[_0x3983('0x5e')]);});return db[_0x3983('0x5f')][_0x3983('0x52')]({'where':{'UserId':{'$in':_0x181b0d},'SmsQueueId':{'$in':_0x8438b}},'transaction':_0x3b34a4});})['then'](function(){var _0x15fc46='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b584e;return db[_0x3983('0x54')][_0x3983('0x30')](_0x15fc46,{'type':db[_0x3983('0x58')][_0x3983('0x55')][_0x3983('0x59')],'raw':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0x4b3c6b){var _0x3888c9=_[_0x3983('0x2b')](_0x4b3c6b,function(_0x3e70eb){return Number(_0x3e70eb[_0x3983('0x60')]);});return db[_0x3983('0x61')]['destroy']({'where':{'UserId':{'$in':_0x181b0d},'ChatQueueId':{'$in':_0x3888c9}},'transaction':_0x3b34a4});})[_0x3983('0x40')](function(){var _0x551a2a=_0x3983('0x62')+_0x1b584e;return db[_0x3983('0x54')][_0x3983('0x30')](_0x551a2a,{'type':db[_0x3983('0x58')][_0x3983('0x55')]['SELECT'],'raw':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0x3dd0fc){var _0x1a127a=_['map'](_0x3dd0fc,function(_0x4f5e3a){return Number(_0x4f5e3a[_0x3983('0x63')]);});return db['UserFaxQueue'][_0x3983('0x52')]({'where':{'UserId':{'$in':_0x181b0d},'FaxQueueId':{'$in':_0x1a127a}},'transaction':_0x3b34a4});})[_0x3983('0x40')](function(){var _0x513a98=_0x3983('0x64')+_0x1b584e;return db[_0x3983('0x54')][_0x3983('0x30')](_0x513a98,{'type':db[_0x3983('0x58')][_0x3983('0x55')]['SELECT'],'raw':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0xc843d1){var _0x4ea973=_[_0x3983('0x2b')](_0xc843d1,function(_0x2068be){return Number(_0x2068be['OpenchannelQueueId']);});return db[_0x3983('0x65')][_0x3983('0x52')]({'where':{'UserId':{'$in':_0x181b0d},'OpenchannelQueueId':{'$in':_0x4ea973}},'transaction':_0x3b34a4});})[_0x3983('0x40')](function(){var _0x3ec049=_0x3983('0x66')+_0x1b584e;return db['sequelize']['query'](_0x3ec049,{'type':db['Sequelize'][_0x3983('0x55')][_0x3983('0x59')],'raw':!![],'transaction':_0x3b34a4});})['then'](function(_0x36c58b){var _0x4166c5=_[_0x3983('0x2b')](_0x36c58b,function(_0x150927){return Number(_0x150927['WhatsappQueueId']);});return db[_0x3983('0x67')][_0x3983('0x52')]({'where':{'UserId':{'$in':_0x181b0d},'WhatsappQueueId':{'$in':_0x4166c5}},'transaction':_0x3b34a4});})['then'](function(){return db[_0x3983('0x68')][_0x3983('0x4e')]({'where':{'TeamId':_0x1b584e}});})[_0x3983('0x40')](function(_0x207591){if(_0x207591===null){return;}return db[_0x3983('0x69')]['destroy']({'where':{'UserId':{'$in':_0x181b0d},'VoicePrefixId':_0x207591[_0x3983('0x6a')]},'transaction':_0x3b34a4});})[_0x3983('0x40')](function(){return db[_0x3983('0x2c')][_0x3983('0x52')]({'where':{'id':_0x1b584e},'cascade':!![],'transaction':_0x3b34a4});})[_0x3983('0x40')](function(_0x4735de){if(_0x4735de===0x0){_0x1a1351[_0x3983('0x26')](0x194);}else{return db[_0x3983('0x6b')][_0x3983('0x52')]({'where':{'type':_0x3983('0x4c'),'resourceId':_0x1b584e},'cascade':!![],'transaction':_0x3b34a4})[_0x3983('0x40')](function(){_0x1a1351[_0x3983('0x1a')](0xcc)['end']();});}})[_0x3983('0x46')](function(_0x5c387e){_0x1a1351[_0x3983('0x1a')](0x1f4)[_0x3983('0x29')](_0x5c387e);});});};exports[_0x3983('0x6c')]=function(_0x41a275,_0xfa1666,_0x56c632){return db[_0x3983('0x2c')][_0x3983('0x6d')]({'where':{'id':_0x41a275[_0x3983('0x43')]['id']}})['then'](handleEntityNotFound(_0xfa1666,null))[_0x3983('0x40')](function(_0x88f30d){if(!_0x41a275[_0x3983('0x30')][_0x3983('0x6e')]||!utils[_0x3983('0x6f')](_0x41a275[_0x3983('0x30')]['channel'])){throw new db['Sequelize'][(_0x3983('0x70'))]('Unknown\x20channel');}var _0x5d6d7f={};var _0x48849e={};_0x48849e[_0x3983('0x32')]=_[_0x3983('0x44')](db[_[_0x3983('0x71')](_0x41a275[_0x3983('0x30')][_0x3983('0x6e')]['toLowerCase']())+_0x3983('0x72')][_0x3983('0x73')]);_0x48849e[_0x3983('0x30')]=_[_0x3983('0x44')](_0x41a275[_0x3983('0x30')]);_0x48849e[_0x3983('0x3a')]=_[_0x3983('0x31')](_0x48849e[_0x3983('0x32')],_0x48849e[_0x3983('0x30')]);_0x5d6d7f[_0x3983('0x33')]=_['intersection'](_0x48849e[_0x3983('0x32')],qs['fields'](_0x41a275[_0x3983('0x30')]['fields']));_0x5d6d7f['attributes']=_0x5d6d7f[_0x3983('0x33')][_0x3983('0x35')]?_0x5d6d7f['attributes']:_0x48849e['model'];_0x5d6d7f[_0x3983('0x1f')]=qs['limit'](_0x41a275['query'][_0x3983('0x1f')]);_0x5d6d7f['offset']=qs['offset'](_0x41a275[_0x3983('0x30')][_0x3983('0x1d')]);_0x5d6d7f[_0x3983('0x38')]=qs[_0x3983('0x39')](_0x41a275['query'][_0x3983('0x39')]);_0x5d6d7f['where']=qs[_0x3983('0x3a')](_[_0x3983('0x74')](_0x41a275[_0x3983('0x30')],_0x48849e[_0x3983('0x3a')]));_0x5d6d7f=_[_0x3983('0x3c')]({},_0x5d6d7f,_0x41a275[_0x3983('0x3e')]);return _0x88f30d[_0x3983('0x4a')+_[_0x3983('0x71')](_0x41a275[_0x3983('0x30')][_0x3983('0x6e')][_0x3983('0x75')]())+'Queues'](_0x5d6d7f);})['then'](respondWithResult(_0xfa1666,null))[_0x3983('0x46')](handleError(_0xfa1666,null));};exports['addQueues']=function(_0x4c93a0,_0x66efe0,_0x258729){return db['Team']['findOne']({'where':{'id':_0x4c93a0[_0x3983('0x43')]['id']}})[_0x3983('0x40')](function(_0x8d7644){if(_0x8d7644){if(!_0x4c93a0[_0x3983('0x48')]['channel']||!utils[_0x3983('0x6f')](_0x4c93a0['body'][_0x3983('0x6e')])){throw new db[(_0x3983('0x58'))]['ValidationError'](_0x3983('0x76'));}return _0x8d7644[_0x3983('0x77')+_[_0x3983('0x71')](_0x4c93a0[_0x3983('0x48')][_0x3983('0x6e')][_0x3983('0x75')]())+_0x3983('0x78')](_0x4c93a0[_0x3983('0x48')]['ids']);}return null;})[_0x3983('0x40')](handleEntityNotFound(_0x66efe0,null))[_0x3983('0x40')](respondWithStatusCode(_0x66efe0,null))[_0x3983('0x46')](handleError(_0x66efe0,null));};exports[_0x3983('0x79')]=function(_0x5d7a5c,_0x556952,_0x2c24a9){return db['Team'][_0x3983('0x6d')]({'where':{'id':_0x5d7a5c[_0x3983('0x43')]['id']}})[_0x3983('0x40')](function(_0x4c0896){if(_0x4c0896){if(!_0x5d7a5c['query'][_0x3983('0x6e')]||!utils[_0x3983('0x6f')](_0x5d7a5c['query'][_0x3983('0x6e')])){throw new db['Sequelize'][(_0x3983('0x70'))](_0x3983('0x76'));}return _0x4c0896[_0x3983('0x7a')+_[_0x3983('0x71')](_0x5d7a5c[_0x3983('0x30')][_0x3983('0x6e')][_0x3983('0x75')]())+_0x3983('0x78')](_0x5d7a5c[_0x3983('0x30')][_0x3983('0x7b')]);}return null;})[_0x3983('0x40')](handleEntityNotFound(_0x556952,null))['then'](respondWithStatusCode(_0x556952,null))[_0x3983('0x46')](handleError(_0x556952,null));};exports[_0x3983('0x7c')]=function(_0x2e4557,_0x31b4d2){var _0x1219c5=_[_0x3983('0x7d')](_0x2e4557[_0x3983('0x48')]['ids'])?_0x2e4557['body'][_0x3983('0x7b')]:[_0x2e4557[_0x3983('0x48')][_0x3983('0x7b')]];var _0x527d0e=_0x2e4557[_0x3983('0x43')]['id'];return db[_0x3983('0x2c')][_0x3983('0x4e')]({'where':{'id':_0x527d0e}})[_0x3983('0x40')](handleEntityNotFound(_0x31b4d2,null))[_0x3983('0x40')](function(_0x5c4130){if(_0x5c4130){var _0x56ea67=[_0x3983('0x7e'),_0x3983('0x7f'),_0x3983('0x80'),_0x3983('0x81'),_0x3983('0x82'),_0x3983('0x83'),_0x3983('0x84')];return db[_0x3983('0x54')][_0x3983('0x85')](function(_0x72f25){var _0x21358c=_[_0x3983('0x2b')](_0x56ea67,function(_0x6bd378){var _0x56eb62={'attributes':['id','name']};if(_0x6bd378===_0x3983('0x7e')){_0x56eb62[_0x3983('0x86')]={'attributes':[_0x3983('0x87')]};}return _0x5c4130[_0x3983('0x4a')+_0x6bd378+_0x3983('0x78')](_0x56eb62)[_0x3983('0x40')](function(_0x1ce55f){var _0x53b89c=_[_0x3983('0x2b')](_0x1ce55f,function(_0x333ba6){var _0x380133=_[_0x3983('0x2b')](_0x1219c5,function(_0x439fd3){var _0x4244cb={'where':{'UserId':_0x439fd3,[_0x6bd378+_0x3983('0x88')]:_0x333ba6['id']},'transaction':_0x72f25};if(_0x6bd378===_0x3983('0x7e')){_0x4244cb['defaults']={'penalty':_0x333ba6[_0x3983('0x89')][_0x3983('0x87')]};}return db[_0x3983('0x8a')+_0x6bd378+'Queue'][_0x3983('0x8b')](_0x4244cb)[_0x3983('0x40')](function(){socket[_0x3983('0x8c')](_0x3983('0x49')+_0x6bd378+'Queue:save',{'UserId':_0x439fd3,[_0x6bd378+'QueueId']:_0x333ba6['id']});if(_0x6bd378!==_0x3983('0x7e')){return;}return db['User']['findAll']({'where':{'id':_0x1219c5,'online':0x1},'attributes':['id','name',_0x3983('0x8d'),_0x3983('0x8e'),_0x3983('0x8f')],'raw':!![]})[_0x3983('0x40')](function(_0x2d55c4){var _0x1e7d64=_[_0x3983('0x2b')](_0x2d55c4,function(_0x5237af){return db[_0x3983('0x90')]['upsert']({'membername':_0x5237af[_0x3983('0x28')],'UserId':_0x5237af['id'],'queue_name':_0x333ba6[_0x3983('0x28')],'VoiceQueueId':_0x333ba6['id'],'interface':_[_0x3983('0x91')](_0x5237af['interface'])?util[_0x3983('0x92')](_0x3983('0x93'),_0x5237af[_0x3983('0x28')]):_0x5237af[_0x3983('0x8f')],'paused':_0x5237af[_0x3983('0x8e')]||![],'penalty':_0x333ba6[_0x3983('0x89')][_0x3983('0x87')]},{'transaction':_0x72f25});});return Promise[_0x3983('0x94')](_0x1e7d64);});});});return Promise[_0x3983('0x94')](_0x380133);});return Promise[_0x3983('0x94')](_0x53b89c);})[_0x3983('0x40')](function(){return db[_0x3983('0x68')]['findOne']({'where':{'teamId':_0x527d0e}})['then'](function(_0x1959ce){if(_0x1959ce){var _0x5bf336=_[_0x3983('0x2b')](_0x1219c5,function(_0x3561b0){db[_0x3983('0x69')][_0x3983('0x95')]({'UserId':_0x3561b0,'VoicePrefixId':_0x1959ce[_0x3983('0x6a')]});});return Promise[_0x3983('0x94')](_0x5bf336);}});});});return Promise[_0x3983('0x94')](_0x21358c)['then'](function(){return _0x5c4130[_0x3983('0x7c')](_0x1219c5,{'transaction':_0x72f25})['spread'](function(_0xe772bc){return _0xe772bc;});});});}})[_0x3983('0x40')](respondWithResult(_0x31b4d2,null))[_0x3983('0x46')](handleError(_0x31b4d2,null));};exports[_0x3983('0x96')]=function(_0x74bddd,_0x2f1043){var _0xbd28b5=_[_0x3983('0x7d')](_0x74bddd[_0x3983('0x30')][_0x3983('0x7b')])?_0x74bddd[_0x3983('0x30')]['ids']:[_0x74bddd[_0x3983('0x30')]['ids']];var _0x21e11c=_0x74bddd[_0x3983('0x43')]['id'];return db['Team']['find']({'where':{'id':_0x21e11c}})[_0x3983('0x40')](handleEntityNotFound(_0x2f1043,null))[_0x3983('0x40')](function(_0x55f742){if(_0x55f742){var _0x4c149b=[_0x3983('0x7e'),_0x3983('0x7f'),_0x3983('0x80'),'Sms','Fax','Openchannel','Whatsapp'];return db[_0x3983('0x54')][_0x3983('0x85')](function(_0x433129){var _0x37a2c1=_[_0x3983('0x2b')](_0x4c149b,function(_0x2b550f){var _0x3cfe61={'attributes':['id',_0x3983('0x28')]};return _0x55f742[_0x3983('0x4a')+_0x2b550f+_0x3983('0x78')](_0x3cfe61)['then'](function(_0x45b201){var _0x2b41f9=_['map'](_0x45b201,function(_0x40968f){return _0x40968f[_0x3983('0x96')](_0xbd28b5,{'transaction':_0x433129})['then'](function(){var _0x3ea38f=_[_0x3983('0x2b')](_0xbd28b5,function(_0x546465){socket['emit'](_0x3983('0x49')+_0x2b550f+_0x3983('0x97'),{'UserId':Number(_0x546465),[_0x2b550f+_0x3983('0x88')]:_0x40968f['id']});if(_0x2b550f!=='Voice'){return;}return db[_0x3983('0x90')][_0x3983('0x52')]({'where':{'VoiceQueueId':_0x40968f['id'],'UserId':_0x546465},'transaction':_0x433129});});return Promise[_0x3983('0x94')](_0x3ea38f);});});return Promise[_0x3983('0x94')](_0x2b41f9);});});return Promise[_0x3983('0x94')](_0x37a2c1)[_0x3983('0x40')](function(){return _0x55f742[_0x3983('0x96')](_0xbd28b5,{'transaction':_0x433129});})['then'](function(){return db[_0x3983('0x68')][_0x3983('0x6d')]({'where':{'teamId':_0x21e11c}})['then'](function(_0x26846b){if(_0x26846b){var _0x1e0335=_['map'](_0xbd28b5,function(_0x531a48){db[_0x3983('0x69')]['destroy']({'where':{'UserId':_0x531a48,'VoicePrefixId':_0x26846b[_0x3983('0x6a')]}});});return Promise[_0x3983('0x94')](_0x1e0335);}});});});}})['then'](respondWithStatusCode(_0x2f1043,null))[_0x3983('0x46')](handleError(_0x2f1043,null));};exports['getAgents']=function(_0x3a65e2,_0x51c114,_0x24b820){var _0xae0bb6={};var _0x195351={};var _0x28f1e5;var _0x3e4c92;return db[_0x3983('0x2c')][_0x3983('0x6d')]({'where':{'id':_0x3a65e2[_0x3983('0x43')]['id']}})[_0x3983('0x40')](handleEntityNotFound(_0x51c114,null))[_0x3983('0x40')](function(_0x41d430){if(_0x41d430){_0x28f1e5=_0x41d430;_0x195351['model']=_[_0x3983('0x44')](db[_0x3983('0x8a')]['rawAttributes']);_0x195351[_0x3983('0x30')]=_[_0x3983('0x44')](_0x3a65e2[_0x3983('0x30')]);_0x195351[_0x3983('0x3a')]=_[_0x3983('0x31')](_0x195351['model'],_0x195351[_0x3983('0x30')]);_0xae0bb6[_0x3983('0x33')]=_[_0x3983('0x31')](_0x195351['model'],qs[_0x3983('0x34')](_0x3a65e2['query'][_0x3983('0x34')]));_0xae0bb6[_0x3983('0x33')]=_0xae0bb6[_0x3983('0x33')][_0x3983('0x35')]?_0xae0bb6[_0x3983('0x33')]:_0x195351[_0x3983('0x32')];_0xae0bb6[_0x3983('0x38')]=qs['sort'](_0x3a65e2['query'][_0x3983('0x39')]);_0xae0bb6[_0x3983('0x3b')]=qs[_0x3983('0x3a')](_[_0x3983('0x74')](_0x3a65e2[_0x3983('0x30')],_0x195351[_0x3983('0x3a')]));if(_0x3a65e2[_0x3983('0x30')][_0x3983('0x98')]){_0xae0bb6[_0x3983('0x3b')]=_[_0x3983('0x3c')](_0xae0bb6[_0x3983('0x3b')],{'$or':_[_0x3983('0x2b')](_0xae0bb6[_0x3983('0x33')],function(_0x47e917){var _0x3bf7ce={};_0x3bf7ce[_0x47e917]={'$like':'%'+_0x3a65e2[_0x3983('0x30')]['filter']+'%'};return _0x3bf7ce;})});}_0xae0bb6=_[_0x3983('0x3c')]({},_0xae0bb6,_0x3a65e2[_0x3983('0x3e')]);return _0x28f1e5[_0x3983('0x99')](_0xae0bb6);}})[_0x3983('0x40')](function(_0x222811){if(_0x222811){_0x3e4c92=_0x222811[_0x3983('0x35')];if(!_0x3a65e2[_0x3983('0x30')]['hasOwnProperty'](_0x3983('0x37'))){_0xae0bb6[_0x3983('0x1f')]=qs[_0x3983('0x1f')](_0x3a65e2[_0x3983('0x30')][_0x3983('0x1f')]);_0xae0bb6[_0x3983('0x1d')]=qs[_0x3983('0x1d')](_0x3a65e2[_0x3983('0x30')]['offset']);}return _0x28f1e5[_0x3983('0x99')](_0xae0bb6);}})[_0x3983('0x40')](function(_0x26cb2a){if(_0x26cb2a){return _0x26cb2a?{'count':_0x3e4c92,'rows':_0x26cb2a}:null;}})[_0x3983('0x40')](respondWithResult(_0x51c114,null))['catch'](handleError(_0x51c114,null));}; \ No newline at end of file +var _0x6b07=['lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','name','send','map','Team','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','addQueues','findOne','add','Queues','removeQueues','ids','addAgents','Voice','Sms','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','removeAgents','Chat','Mail','Queue:remove','UserVoicePrefix','getAgents','rimraf','zip-dir','fast-json-patch','util','sox','to-csv','ejs','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6b07,0x8d));var _0x76b0=function(_0xaff09d,_0x38ee49){_0xaff09d=_0xaff09d-0x0;var _0x1e65da=_0x6b07[_0xaff09d];return _0x1e65da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76b0('0x0'));var zipdir=require(_0x76b0('0x1'));var jsonpatch=require(_0x76b0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76b0('0x3'));var path=require('path');var sox=require(_0x76b0('0x4'));var csv=require(_0x76b0('0x5'));var ejs=require(_0x76b0('0x6'));var fs=require('fs');var fs_extra=require(_0x76b0('0x7'));var _=require(_0x76b0('0x8'));var squel=require(_0x76b0('0x9'));var crypto=require(_0x76b0('0xa'));var jsforce=require(_0x76b0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x76b0('0xc'));var Papa=require(_0x76b0('0xd'));var Redis=require('ioredis');var authService=require(_0x76b0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x76b0('0xf'));var hardwareService=require(_0x76b0('0x10'));var logger=require('../../config/logger')(_0x76b0('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x76b0('0x12'));var db=require(_0x76b0('0x13'))['db'];config['redis']=_[_0x76b0('0x14')](config[_0x76b0('0x15')],{'host':_0x76b0('0x16'),'port':0x18eb});var socket=require(_0x76b0('0x17'))(new Redis(config[_0x76b0('0x15')]));require(_0x76b0('0x18'))[_0x76b0('0x19')](socket);function respondWithStatusCode(_0x48836d,_0x120290){_0x120290=_0x120290||0xcc;return function(_0x4d8437){if(_0x4d8437){return _0x48836d[_0x76b0('0x1a')](_0x120290);}return _0x48836d[_0x76b0('0x1b')](_0x120290)[_0x76b0('0x1c')]();};}function respondWithResult(_0x2e6591,_0x4e31d3){_0x4e31d3=_0x4e31d3||0xc8;return function(_0x17f4cf){if(_0x17f4cf){return _0x2e6591[_0x76b0('0x1b')](_0x4e31d3)[_0x76b0('0x1d')](_0x17f4cf);}};}function respondWithFilteredResult(_0x949e53,_0x414a70){return function(_0x501116){if(_0x501116){var _0x46c62f=typeof _0x414a70[_0x76b0('0x1e')]===_0x76b0('0x1f')&&typeof _0x414a70['limit']===_0x76b0('0x1f');var _0x4edf33=_0x501116[_0x76b0('0x20')];var _0x337017=_0x46c62f?0x0:_0x414a70['offset'];var _0x36948c=_0x46c62f?_0x501116[_0x76b0('0x20')]:_0x414a70[_0x76b0('0x1e')]+_0x414a70[_0x76b0('0x21')];var _0x4c26ea;if(_0x36948c>=_0x4edf33){_0x36948c=_0x4edf33;_0x4c26ea=0xc8;}else{_0x4c26ea=0xce;}_0x949e53[_0x76b0('0x1b')](_0x4c26ea);return _0x949e53[_0x76b0('0x22')](_0x76b0('0x23'),_0x337017+'-'+_0x36948c+'/'+_0x4edf33)['json'](_0x501116);}return null;};}function patchUpdates(_0x53d780){return function(_0x6dc6be){try{jsonpatch[_0x76b0('0x24')](_0x6dc6be,_0x53d780,!![]);}catch(_0x50f4a8){return BPromise['reject'](_0x50f4a8);}return _0x6dc6be[_0x76b0('0x25')]();};}function saveUpdates(_0x3158b8,_0x569e45){return function(_0x2a1118){if(_0x2a1118){return _0x2a1118[_0x76b0('0x26')](_0x3158b8)[_0x76b0('0x27')](function(_0x2c00d0){return _0x2c00d0;});}return null;};}function handleEntityNotFound(_0x295aa1,_0x1fef95){return function(_0x27bb55){if(!_0x27bb55){_0x295aa1['sendStatus'](0x194);}return _0x27bb55;};}function handleError(_0x352f8b,_0x425faf){_0x425faf=_0x425faf||0x1f4;return function(_0x4504c7){logger[_0x76b0('0x28')](_0x4504c7['stack']);if(_0x4504c7[_0x76b0('0x29')]){delete _0x4504c7[_0x76b0('0x29')];}_0x352f8b[_0x76b0('0x1b')](_0x425faf)[_0x76b0('0x2a')](_0x4504c7);};}exports['index']=function(_0x398921,_0x22cd6b){var _0x3dfab9={},_0x3c1c20={},_0x4e3c2b={'count':0x0,'rows':[]};var _0x115337=_[_0x76b0('0x2b')](db[_0x76b0('0x2c')][_0x76b0('0x2d')],function(_0x5c407b){return{'name':_0x5c407b[_0x76b0('0x2e')],'type':_0x5c407b[_0x76b0('0x2f')][_0x76b0('0x30')]};});_0x3c1c20['model']=_[_0x76b0('0x2b')](_0x115337,_0x76b0('0x29'));_0x3c1c20[_0x76b0('0x31')]=_[_0x76b0('0x32')](_0x398921['query']);_0x3c1c20['filters']=_[_0x76b0('0x33')](_0x3c1c20[_0x76b0('0x34')],_0x3c1c20[_0x76b0('0x31')]);_0x3dfab9['attributes']=_[_0x76b0('0x33')](_0x3c1c20[_0x76b0('0x34')],qs[_0x76b0('0x35')](_0x398921[_0x76b0('0x31')][_0x76b0('0x35')]));_0x3dfab9['attributes']=_0x3dfab9[_0x76b0('0x36')][_0x76b0('0x37')]?_0x3dfab9[_0x76b0('0x36')]:_0x3c1c20[_0x76b0('0x34')];if(!_0x398921[_0x76b0('0x31')][_0x76b0('0x38')](_0x76b0('0x39'))){_0x3dfab9[_0x76b0('0x21')]=qs[_0x76b0('0x21')](_0x398921[_0x76b0('0x31')][_0x76b0('0x21')]);_0x3dfab9[_0x76b0('0x1e')]=qs[_0x76b0('0x1e')](_0x398921[_0x76b0('0x31')][_0x76b0('0x1e')]);}_0x3dfab9['order']=qs['sort'](_0x398921[_0x76b0('0x31')][_0x76b0('0x3a')]);_0x3dfab9[_0x76b0('0x3b')]=qs['filters'](_['pick'](_0x398921[_0x76b0('0x31')],_0x3c1c20[_0x76b0('0x3c')]),_0x115337);if(_0x398921[_0x76b0('0x31')][_0x76b0('0x3d')]){_0x3dfab9[_0x76b0('0x3b')]=_[_0x76b0('0x3e')](_0x3dfab9[_0x76b0('0x3b')],{'$or':_[_0x76b0('0x2b')](_0x115337,function(_0xa18edb){if(_0xa18edb[_0x76b0('0x2f')]!==_0x76b0('0x3f')){var _0x2a9822={};_0x2a9822[_0xa18edb[_0x76b0('0x29')]]={'$like':'%'+_0x398921['query'][_0x76b0('0x3d')]+'%'};return _0x2a9822;}})});}_0x3dfab9=_[_0x76b0('0x3e')]({},_0x3dfab9,_0x398921[_0x76b0('0x40')]);var _0x453db4={'where':_0x3dfab9['where']};return db['Team'][_0x76b0('0x20')](_0x453db4)[_0x76b0('0x27')](function(_0x5da0b2){_0x4e3c2b[_0x76b0('0x20')]=_0x5da0b2;if(_0x398921[_0x76b0('0x31')][_0x76b0('0x41')]){_0x3dfab9[_0x76b0('0x42')]=[{'all':!![]}];}return db[_0x76b0('0x2c')][_0x76b0('0x43')](_0x3dfab9);})[_0x76b0('0x27')](function(_0x11b12e){_0x4e3c2b['rows']=_0x11b12e;return _0x4e3c2b;})[_0x76b0('0x27')](respondWithFilteredResult(_0x22cd6b,_0x3dfab9))[_0x76b0('0x44')](handleError(_0x22cd6b,null));};exports[_0x76b0('0x45')]=function(_0x228f2b,_0x41483e){var _0xd2a0bb={'raw':![],'where':{'id':_0x228f2b[_0x76b0('0x46')]['id']}},_0x331a45={};_0x331a45[_0x76b0('0x34')]=_[_0x76b0('0x32')](db[_0x76b0('0x2c')]['rawAttributes']);_0x331a45[_0x76b0('0x31')]=_[_0x76b0('0x32')](_0x228f2b['query']);_0x331a45[_0x76b0('0x3c')]=_[_0x76b0('0x33')](_0x331a45[_0x76b0('0x34')],_0x331a45[_0x76b0('0x31')]);_0xd2a0bb[_0x76b0('0x36')]=_[_0x76b0('0x33')](_0x331a45[_0x76b0('0x34')],qs['fields'](_0x228f2b[_0x76b0('0x31')][_0x76b0('0x35')]));_0xd2a0bb[_0x76b0('0x36')]=_0xd2a0bb[_0x76b0('0x36')][_0x76b0('0x37')]?_0xd2a0bb[_0x76b0('0x36')]:_0x331a45[_0x76b0('0x34')];if(_0x228f2b['query'][_0x76b0('0x41')]){_0xd2a0bb[_0x76b0('0x42')]=[{'all':!![]}];}_0xd2a0bb=_['merge']({},_0xd2a0bb,_0x228f2b[_0x76b0('0x40')]);return db['Team'][_0x76b0('0x47')](_0xd2a0bb)[_0x76b0('0x27')](handleEntityNotFound(_0x41483e,null))[_0x76b0('0x27')](respondWithResult(_0x41483e,null))[_0x76b0('0x44')](handleError(_0x41483e,null));};exports['create']=function(_0x2f54b9,_0x279ceb){return db[_0x76b0('0x2c')][_0x76b0('0x48')](_0x2f54b9['body'],{})[_0x76b0('0x27')](function(_0x36b805){var _0x1926ef=_0x2f54b9[_0x76b0('0x49')][_0x76b0('0x4a')]({'plain':!![]});if(!_0x1926ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1926ef[_0x76b0('0x4b')]===_0x76b0('0x49')){var _0x509c48=_0x36b805[_0x76b0('0x4a')]({'plain':!![]});var _0x577bd2=_0x76b0('0x4c');return db[_0x76b0('0x4d')][_0x76b0('0x47')]({'where':{'name':_0x577bd2,'userProfileId':_0x1926ef[_0x76b0('0x4e')]},'raw':!![]})[_0x76b0('0x27')](function(_0x501d7c){if(_0x501d7c&&_0x501d7c[_0x76b0('0x4f')]===0x0){return db['UserProfileResource'][_0x76b0('0x48')]({'name':_0x509c48[_0x76b0('0x29')],'resourceId':_0x509c48['id'],'type':_0x501d7c[_0x76b0('0x29')],'sectionId':_0x501d7c['id']},{})['then'](function(){return _0x36b805;});}else{return _0x36b805;}})['catch'](function(_0x4c1a2b){logger[_0x76b0('0x28')](_0x76b0('0x50'),_0x4c1a2b);throw _0x4c1a2b;});}return _0x36b805;})[_0x76b0('0x27')](respondWithResult(_0x279ceb,0xc9))['catch'](handleError(_0x279ceb,null));};exports[_0x76b0('0x26')]=function(_0x2d7897,_0x27fb29){if(_0x2d7897[_0x76b0('0x51')]['id']){delete _0x2d7897[_0x76b0('0x51')]['id'];}return db[_0x76b0('0x2c')]['find']({'where':{'id':_0x2d7897['params']['id']}})[_0x76b0('0x27')](handleEntityNotFound(_0x27fb29,null))[_0x76b0('0x27')](saveUpdates(_0x2d7897[_0x76b0('0x51')],null))[_0x76b0('0x27')](respondWithResult(_0x27fb29,null))[_0x76b0('0x44')](handleError(_0x27fb29,null));};exports[_0x76b0('0x52')]=function(_0x3092d7,_0x52c2cc){var _0x302d25=_0x3092d7['params']['id'];var _0x56bef9=[];return db[_0x76b0('0x53')][_0x76b0('0x54')](function(_0x28409e){var _0x41e120='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x41e120,{'type':db[_0x76b0('0x55')][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e})[_0x76b0('0x27')](function(_0x38f74d){_0x56bef9=_[_0x76b0('0x2b')](_0x38f74d,function(_0x44b63c){return Number(_0x44b63c[_0x76b0('0x58')]);});})[_0x76b0('0x27')](function(){var _0x491fe5=_0x76b0('0x59')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x491fe5,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})['then'](function(_0x1ee00b){var _0x38951e=_[_0x76b0('0x2b')](_0x1ee00b,function(_0xc013e8){return Number(_0xc013e8['VoiceQueueId']);});return db['UserVoiceQueue'][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'VoiceQueueId':{'$in':_0x38951e}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x52bf69='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x52bf69,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})['then'](function(_0x189068){var _0x1458a4=_['map'](_0x189068,function(_0x48aaa9){return Number(_0x48aaa9[_0x76b0('0x5a')]);});return db[_0x76b0('0x5b')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'MailQueueId':{'$in':_0x1458a4}},'transaction':_0x28409e});})['then'](function(){var _0x2dab3b=_0x76b0('0x5c')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x2dab3b,{'type':db[_0x76b0('0x55')][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})['then'](function(_0x36f5bc){var _0x65f465=_[_0x76b0('0x2b')](_0x36f5bc,function(_0x123e09){return Number(_0x123e09[_0x76b0('0x5d')]);});return db[_0x76b0('0x5e')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'SmsQueueId':{'$in':_0x65f465}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x2b5d79=_0x76b0('0x5f')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x2b5d79,{'type':db[_0x76b0('0x55')]['QueryTypes'][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x293db0){var _0x3678d4=_[_0x76b0('0x2b')](_0x293db0,function(_0x4ed9e6){return Number(_0x4ed9e6['ChatQueueId']);});return db[_0x76b0('0x60')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'ChatQueueId':{'$in':_0x3678d4}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x1a43ee=_0x76b0('0x61')+_0x302d25;return db['sequelize'][_0x76b0('0x31')](_0x1a43ee,{'type':db['Sequelize']['QueryTypes'][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x576648){var _0x39bcaa=_[_0x76b0('0x2b')](_0x576648,function(_0x5b182b){return Number(_0x5b182b[_0x76b0('0x62')]);});return db[_0x76b0('0x63')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'FaxQueueId':{'$in':_0x39bcaa}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x272aee='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x272aee,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x2e30da){var _0xddcb51=_[_0x76b0('0x2b')](_0x2e30da,function(_0x1483d1){return Number(_0x1483d1[_0x76b0('0x64')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x56bef9},'OpenchannelQueueId':{'$in':_0xddcb51}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){var _0x11ceed=_0x76b0('0x65')+_0x302d25;return db[_0x76b0('0x53')][_0x76b0('0x31')](_0x11ceed,{'type':db['Sequelize'][_0x76b0('0x56')][_0x76b0('0x57')],'raw':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x54d23d){var _0x4026ed=_['map'](_0x54d23d,function(_0x50fb13){return Number(_0x50fb13['WhatsappQueueId']);});return db[_0x76b0('0x66')][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'WhatsappQueueId':{'$in':_0x4026ed}},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){return db[_0x76b0('0x67')][_0x76b0('0x47')]({'where':{'TeamId':_0x302d25}});})[_0x76b0('0x27')](function(_0x1b7641){if(_0x1b7641===null){return;}return db['UserVoicePrefix'][_0x76b0('0x52')]({'where':{'UserId':{'$in':_0x56bef9},'VoicePrefixId':_0x1b7641[_0x76b0('0x68')]},'transaction':_0x28409e});})[_0x76b0('0x27')](function(){return db['Team'][_0x76b0('0x52')]({'where':{'id':_0x302d25},'cascade':!![],'transaction':_0x28409e});})[_0x76b0('0x27')](function(_0x29031c){if(_0x29031c===0x0){_0x52c2cc['sendStatus'](0x194);}else{return db[_0x76b0('0x69')][_0x76b0('0x52')]({'where':{'type':_0x76b0('0x4c'),'resourceId':_0x302d25},'cascade':!![],'transaction':_0x28409e})[_0x76b0('0x27')](function(){_0x52c2cc[_0x76b0('0x1b')](0xcc)[_0x76b0('0x1c')]();});}})[_0x76b0('0x44')](function(_0x2cb245){_0x52c2cc[_0x76b0('0x1b')](0x1f4)[_0x76b0('0x2a')](_0x2cb245);});});};exports[_0x76b0('0x6a')]=function(_0x5260bd,_0x536521,_0x52a8af){return db[_0x76b0('0x2c')]['findOne']({'where':{'id':_0x5260bd['params']['id']}})['then'](handleEntityNotFound(_0x536521,null))[_0x76b0('0x27')](function(_0x3ef146){if(!_0x5260bd[_0x76b0('0x31')][_0x76b0('0x6b')]||!utils[_0x76b0('0x6c')](_0x5260bd['query']['channel'])){throw new db[(_0x76b0('0x55'))][(_0x76b0('0x6d'))](_0x76b0('0x6e'));}var _0x5b4d71={};var _0x2c6c1e={};_0x2c6c1e['model']=_[_0x76b0('0x32')](db[_[_0x76b0('0x6f')](_0x5260bd['query'][_0x76b0('0x6b')][_0x76b0('0x70')]())+_0x76b0('0x71')][_0x76b0('0x2d')]);_0x2c6c1e['query']=_[_0x76b0('0x32')](_0x5260bd[_0x76b0('0x31')]);_0x2c6c1e['filters']=_['intersection'](_0x2c6c1e[_0x76b0('0x34')],_0x2c6c1e[_0x76b0('0x31')]);_0x5b4d71['attributes']=_[_0x76b0('0x33')](_0x2c6c1e[_0x76b0('0x34')],qs[_0x76b0('0x35')](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x35')]));_0x5b4d71[_0x76b0('0x36')]=_0x5b4d71['attributes'][_0x76b0('0x37')]?_0x5b4d71[_0x76b0('0x36')]:_0x2c6c1e['model'];_0x5b4d71['limit']=qs[_0x76b0('0x21')](_0x5260bd[_0x76b0('0x31')]['limit']);_0x5b4d71[_0x76b0('0x1e')]=qs[_0x76b0('0x1e')](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x1e')]);_0x5b4d71[_0x76b0('0x72')]=qs['sort'](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x3a')]);_0x5b4d71[_0x76b0('0x3b')]=qs['filters'](_['pick'](_0x5260bd[_0x76b0('0x31')],_0x2c6c1e['filters']));_0x5b4d71=_['merge']({},_0x5b4d71,_0x5260bd['options']);return _0x3ef146[_0x76b0('0x4a')+_[_0x76b0('0x6f')](_0x5260bd[_0x76b0('0x31')][_0x76b0('0x6b')][_0x76b0('0x70')]())+'Queues'](_0x5b4d71);})['then'](respondWithResult(_0x536521,null))[_0x76b0('0x44')](handleError(_0x536521,null));};exports[_0x76b0('0x73')]=function(_0x215c67,_0x107ada,_0x1f2c71){return db[_0x76b0('0x2c')][_0x76b0('0x74')]({'where':{'id':_0x215c67[_0x76b0('0x46')]['id']}})[_0x76b0('0x27')](function(_0x3a4f71){if(_0x3a4f71){if(!_0x215c67[_0x76b0('0x51')]['channel']||!utils[_0x76b0('0x6c')](_0x215c67[_0x76b0('0x51')][_0x76b0('0x6b')])){throw new db[(_0x76b0('0x55'))]['ValidationError'](_0x76b0('0x6e'));}return _0x3a4f71[_0x76b0('0x75')+_[_0x76b0('0x6f')](_0x215c67[_0x76b0('0x51')][_0x76b0('0x6b')][_0x76b0('0x70')]())+_0x76b0('0x76')](_0x215c67[_0x76b0('0x51')]['ids']);}return null;})[_0x76b0('0x27')](handleEntityNotFound(_0x107ada,null))['then'](respondWithStatusCode(_0x107ada,null))['catch'](handleError(_0x107ada,null));};exports[_0x76b0('0x77')]=function(_0x3924d3,_0x159266,_0x39f9c0){return db[_0x76b0('0x2c')][_0x76b0('0x74')]({'where':{'id':_0x3924d3['params']['id']}})[_0x76b0('0x27')](function(_0x425e26){if(_0x425e26){if(!_0x3924d3[_0x76b0('0x31')][_0x76b0('0x6b')]||!utils[_0x76b0('0x6c')](_0x3924d3[_0x76b0('0x31')][_0x76b0('0x6b')])){throw new db[(_0x76b0('0x55'))][(_0x76b0('0x6d'))](_0x76b0('0x6e'));}return _0x425e26['remove'+_['capitalize'](_0x3924d3[_0x76b0('0x31')][_0x76b0('0x6b')][_0x76b0('0x70')]())+'Queues'](_0x3924d3['query'][_0x76b0('0x78')]);}return null;})[_0x76b0('0x27')](handleEntityNotFound(_0x159266,null))[_0x76b0('0x27')](respondWithStatusCode(_0x159266,null))[_0x76b0('0x44')](handleError(_0x159266,null));};exports[_0x76b0('0x79')]=function(_0x31b22e,_0x2317b9){var _0x239b79=_['isArray'](_0x31b22e[_0x76b0('0x51')][_0x76b0('0x78')])?_0x31b22e[_0x76b0('0x51')]['ids']:[_0x31b22e[_0x76b0('0x51')]['ids']];var _0x325c1e=_0x31b22e[_0x76b0('0x46')]['id'];return db[_0x76b0('0x2c')][_0x76b0('0x47')]({'where':{'id':_0x325c1e}})['then'](handleEntityNotFound(_0x2317b9,null))[_0x76b0('0x27')](function(_0x5d19fb){if(_0x5d19fb){var _0x316a2b=[_0x76b0('0x7a'),'Chat','Mail',_0x76b0('0x7b'),_0x76b0('0x7c'),_0x76b0('0x7d'),_0x76b0('0x7e')];return db['sequelize']['transaction'](function(_0x3d97ef){var _0x397897=_[_0x76b0('0x2b')](_0x316a2b,function(_0x35dd70){var _0x555ca0={'attributes':['id',_0x76b0('0x29')]};if(_0x35dd70===_0x76b0('0x7a')){_0x555ca0[_0x76b0('0x7f')]={'attributes':[_0x76b0('0x80')]};}return _0x5d19fb[_0x76b0('0x4a')+_0x35dd70+_0x76b0('0x76')](_0x555ca0)[_0x76b0('0x27')](function(_0x4119da){var _0x2832ef=_[_0x76b0('0x2b')](_0x4119da,function(_0x4e0dbf){var _0x5d1419=_[_0x76b0('0x2b')](_0x239b79,function(_0x2cbefd){var _0x14e3d5={'where':{'UserId':_0x2cbefd,[_0x35dd70+'QueueId']:_0x4e0dbf['id']},'transaction':_0x3d97ef};if(_0x35dd70==='Voice'){_0x14e3d5[_0x76b0('0x14')]={'penalty':_0x4e0dbf[_0x76b0('0x81')][_0x76b0('0x80')]};}return db[_0x76b0('0x82')+_0x35dd70+_0x76b0('0x71')][_0x76b0('0x83')](_0x14e3d5)[_0x76b0('0x27')](function(){socket[_0x76b0('0x84')](_0x76b0('0x49')+_0x35dd70+_0x76b0('0x85'),{'UserId':_0x2cbefd,[_0x35dd70+_0x76b0('0x86')]:_0x4e0dbf['id']});if(_0x35dd70!=='Voice'){return;}return db['User'][_0x76b0('0x43')]({'where':{'id':_0x239b79,'online':0x1},'attributes':['id',_0x76b0('0x29'),_0x76b0('0x87'),_0x76b0('0x88'),_0x76b0('0x89')],'raw':!![]})[_0x76b0('0x27')](function(_0x12641f){var _0xfe32d6=_[_0x76b0('0x2b')](_0x12641f,function(_0x2e5db2){return db[_0x76b0('0x8a')][_0x76b0('0x8b')]({'membername':_0x2e5db2[_0x76b0('0x29')],'UserId':_0x2e5db2['id'],'queue_name':_0x4e0dbf[_0x76b0('0x29')],'VoiceQueueId':_0x4e0dbf['id'],'interface':_[_0x76b0('0x8c')](_0x2e5db2['interface'])?util[_0x76b0('0x8d')]('SIP/%s',_0x2e5db2[_0x76b0('0x29')]):_0x2e5db2[_0x76b0('0x89')],'paused':_0x2e5db2['voicePause']||![],'penalty':_0x4e0dbf['TeamVoiceQueue'][_0x76b0('0x80')]},{'transaction':_0x3d97ef});});return Promise[_0x76b0('0x8e')](_0xfe32d6);});});});return Promise['all'](_0x5d1419);});return Promise[_0x76b0('0x8e')](_0x2832ef);})[_0x76b0('0x27')](function(){return db[_0x76b0('0x67')][_0x76b0('0x74')]({'where':{'teamId':_0x325c1e}})[_0x76b0('0x27')](function(_0x342df0){if(_0x342df0){var _0x5d99a5=_[_0x76b0('0x2b')](_0x239b79,function(_0x365492){db['UserVoicePrefix']['upsert']({'UserId':_0x365492,'VoicePrefixId':_0x342df0[_0x76b0('0x68')]});});return Promise[_0x76b0('0x8e')](_0x5d99a5);}});});});return Promise[_0x76b0('0x8e')](_0x397897)['then'](function(){return _0x5d19fb[_0x76b0('0x79')](_0x239b79,{'transaction':_0x3d97ef})['spread'](function(_0x23b3a7){return _0x23b3a7;});});});}})[_0x76b0('0x27')](respondWithResult(_0x2317b9,null))[_0x76b0('0x44')](handleError(_0x2317b9,null));};exports[_0x76b0('0x8f')]=function(_0x3787c8,_0x21f68e){var _0x47eeef=_['isArray'](_0x3787c8[_0x76b0('0x31')][_0x76b0('0x78')])?_0x3787c8[_0x76b0('0x31')]['ids']:[_0x3787c8[_0x76b0('0x31')][_0x76b0('0x78')]];var _0x4915e6=_0x3787c8[_0x76b0('0x46')]['id'];return db[_0x76b0('0x2c')][_0x76b0('0x47')]({'where':{'id':_0x4915e6}})['then'](handleEntityNotFound(_0x21f68e,null))['then'](function(_0x4b3f4e){if(_0x4b3f4e){var _0x45c43e=[_0x76b0('0x7a'),_0x76b0('0x90'),_0x76b0('0x91'),_0x76b0('0x7b'),'Fax','Openchannel',_0x76b0('0x7e')];return db[_0x76b0('0x53')]['transaction'](function(_0x232299){var _0x1025cb=_[_0x76b0('0x2b')](_0x45c43e,function(_0x1b8862){var _0xe6f7c5={'attributes':['id',_0x76b0('0x29')]};return _0x4b3f4e[_0x76b0('0x4a')+_0x1b8862+_0x76b0('0x76')](_0xe6f7c5)[_0x76b0('0x27')](function(_0x54492c){var _0x2bb301=_[_0x76b0('0x2b')](_0x54492c,function(_0x3af0a3){return _0x3af0a3[_0x76b0('0x8f')](_0x47eeef,{'transaction':_0x232299})['then'](function(){var _0x3038d8=_[_0x76b0('0x2b')](_0x47eeef,function(_0x591e80){socket[_0x76b0('0x84')](_0x76b0('0x49')+_0x1b8862+_0x76b0('0x92'),{'UserId':Number(_0x591e80),[_0x1b8862+'QueueId']:_0x3af0a3['id']});if(_0x1b8862!==_0x76b0('0x7a')){return;}return db['UserVoiceQueueRt'][_0x76b0('0x52')]({'where':{'VoiceQueueId':_0x3af0a3['id'],'UserId':_0x591e80},'transaction':_0x232299});});return Promise[_0x76b0('0x8e')](_0x3038d8);});});return Promise[_0x76b0('0x8e')](_0x2bb301);});});return Promise[_0x76b0('0x8e')](_0x1025cb)['then'](function(){return _0x4b3f4e[_0x76b0('0x8f')](_0x47eeef,{'transaction':_0x232299});})[_0x76b0('0x27')](function(){return db[_0x76b0('0x67')][_0x76b0('0x74')]({'where':{'teamId':_0x4915e6}})[_0x76b0('0x27')](function(_0xa9ebd3){if(_0xa9ebd3){var _0x32d982=_[_0x76b0('0x2b')](_0x47eeef,function(_0x30b042){db[_0x76b0('0x93')][_0x76b0('0x52')]({'where':{'UserId':_0x30b042,'VoicePrefixId':_0xa9ebd3[_0x76b0('0x68')]}});});return Promise[_0x76b0('0x8e')](_0x32d982);}});});});}})[_0x76b0('0x27')](respondWithStatusCode(_0x21f68e,null))[_0x76b0('0x44')](handleError(_0x21f68e,null));};exports[_0x76b0('0x94')]=function(_0x2b4b27,_0x431b5d,_0x4e5273){var _0xd03e79={};var _0x55e4ae={};var _0x18018f;var _0x3f176e;return db[_0x76b0('0x2c')][_0x76b0('0x74')]({'where':{'id':_0x2b4b27[_0x76b0('0x46')]['id']}})[_0x76b0('0x27')](handleEntityNotFound(_0x431b5d,null))[_0x76b0('0x27')](function(_0x987d5){if(_0x987d5){_0x18018f=_0x987d5;_0x55e4ae['model']=_[_0x76b0('0x32')](db[_0x76b0('0x82')][_0x76b0('0x2d')]);_0x55e4ae['query']=_['keys'](_0x2b4b27[_0x76b0('0x31')]);_0x55e4ae['filters']=_[_0x76b0('0x33')](_0x55e4ae[_0x76b0('0x34')],_0x55e4ae['query']);_0xd03e79[_0x76b0('0x36')]=_[_0x76b0('0x33')](_0x55e4ae['model'],qs[_0x76b0('0x35')](_0x2b4b27[_0x76b0('0x31')]['fields']));_0xd03e79[_0x76b0('0x36')]=_0xd03e79[_0x76b0('0x36')][_0x76b0('0x37')]?_0xd03e79[_0x76b0('0x36')]:_0x55e4ae[_0x76b0('0x34')];_0xd03e79[_0x76b0('0x72')]=qs['sort'](_0x2b4b27[_0x76b0('0x31')][_0x76b0('0x3a')]);_0xd03e79[_0x76b0('0x3b')]=qs[_0x76b0('0x3c')](_['pick'](_0x2b4b27[_0x76b0('0x31')],_0x55e4ae[_0x76b0('0x3c')]));if(_0x2b4b27[_0x76b0('0x31')][_0x76b0('0x3d')]){_0xd03e79[_0x76b0('0x3b')]=_[_0x76b0('0x3e')](_0xd03e79[_0x76b0('0x3b')],{'$or':_['map'](_0xd03e79[_0x76b0('0x36')],function(_0x53385c){var _0x1721f8={};_0x1721f8[_0x53385c]={'$like':'%'+_0x2b4b27['query']['filter']+'%'};return _0x1721f8;})});}_0xd03e79=_[_0x76b0('0x3e')]({},_0xd03e79,_0x2b4b27[_0x76b0('0x40')]);return _0x18018f[_0x76b0('0x94')](_0xd03e79);}})[_0x76b0('0x27')](function(_0x2540dd){if(_0x2540dd){_0x3f176e=_0x2540dd['length'];if(!_0x2b4b27[_0x76b0('0x31')]['hasOwnProperty'](_0x76b0('0x39'))){_0xd03e79[_0x76b0('0x21')]=qs[_0x76b0('0x21')](_0x2b4b27['query'][_0x76b0('0x21')]);_0xd03e79[_0x76b0('0x1e')]=qs[_0x76b0('0x1e')](_0x2b4b27[_0x76b0('0x31')]['offset']);}return _0x18018f[_0x76b0('0x94')](_0xd03e79);}})[_0x76b0('0x27')](function(_0x587bb8){if(_0x587bb8){return _0x587bb8?{'count':_0x3f176e,'rows':_0x587bb8}:null;}})[_0x76b0('0x27')](respondWithResult(_0x431b5d,null))[_0x76b0('0x44')](handleError(_0x431b5d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 965d34c..e5e0a12 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 _0x1cf1=['events','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x162d0a,_0x5369a7){var _0x4bd392=function(_0x4e1070){while(--_0x4e1070){_0x162d0a['push'](_0x162d0a['shift']());}};_0x4bd392(++_0x5369a7);}(_0x1cf1,0x183));var _0x11cf=function(_0x19c7fa,_0x52914b){_0x19c7fa=_0x19c7fa-0x0;var _0x4a7476=_0x1cf1[_0x19c7fa];return _0x4a7476;};'use strict';var EventEmitter=require(_0x11cf('0x0'));var Team=require(_0x11cf('0x1'))['db'][_0x11cf('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x11cf('0x3')](0x0);var events={'afterCreate':_0x11cf('0x4'),'afterUpdate':'update','afterDestroy':_0x11cf('0x5')};function emitEvent(_0x1cf3dd){return function(_0x420a4,_0x5800ba,_0x20a9b8){TeamEvents[_0x11cf('0x6')](_0x1cf3dd+':'+_0x420a4['id'],_0x420a4);TeamEvents[_0x11cf('0x6')](_0x1cf3dd,_0x420a4);_0x20a9b8(null);};}for(var e in events){if(events[_0x11cf('0x7')](e)){var event=events[e];Team[_0x11cf('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x9633=['setMaxListeners','save','update','emit','hook','events','../../mysqldb','Team'];(function(_0xd5edf7,_0x43c249){var _0x5cb898=function(_0x7c6bb4){while(--_0x7c6bb4){_0xd5edf7['push'](_0xd5edf7['shift']());}};_0x5cb898(++_0x43c249);}(_0x9633,0xc5));var _0x3963=function(_0x1eec3c,_0x27eb00){_0x1eec3c=_0x1eec3c-0x0;var _0x39c1d4=_0x9633[_0x1eec3c];return _0x39c1d4;};'use strict';var EventEmitter=require(_0x3963('0x0'));var Team=require(_0x3963('0x1'))['db'][_0x3963('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3963('0x3')](0x0);var events={'afterCreate':_0x3963('0x4'),'afterUpdate':_0x3963('0x5'),'afterDestroy':'remove'};function emitEvent(_0x39fe25){return function(_0x38550a,_0x148ddf,_0x42ba5e){TeamEvents['emit'](_0x39fe25+':'+_0x38550a['id'],_0x38550a);TeamEvents[_0x3963('0x6')](_0x39fe25,_0x38550a);_0x42ba5e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x3963('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 99928e1..b33013b 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 _0x1ce6=['Chat','Mail','Openchannel','Sms','all','lodash','get','then','map','channel','catch','exports','define','Team','teams'];(function(_0x187f71,_0xf40f00){var _0xdf027a=function(_0x127e87){while(--_0x127e87){_0x187f71['push'](_0x187f71['shift']());}};_0xdf027a(++_0xf40f00);}(_0x1ce6,0x1f4));var _0x61ce=function(_0x19b475,_0x5062b6){_0x19b475=_0x19b475-0x0;var _0x333eea=_0x1ce6[_0x19b475];return _0x333eea;};'use strict';var _=require(_0x61ce('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x35709b,_0x2a0f22){var _0x320ec0=_0x61ce('0x1')+_0x2a0f22+'Queues';return _0x35709b[_0x320ec0]()[_0x61ce('0x2')](function(_0x432719){return _[_0x61ce('0x3')](_0x432719,function(_0x5f5234){_0x5f5234['setDataValue'](_0x61ce('0x4'),_0x2a0f22);return _0x5f5234;});})[_0x61ce('0x5')](function(_0xa6665c){throw _0xa6665c;});}module[_0x61ce('0x6')]=function(_0x37a09b){return _0x37a09b[_0x61ce('0x7')](_0x61ce('0x8'),attributes,{'tableName':_0x61ce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x432443=this;var _0x22a795=[_0x61ce('0xa'),'Fax',_0x61ce('0xb'),_0x61ce('0xc'),_0x61ce('0xd'),'Voice','Whatsapp'];return Promise['resolve']()[_0x61ce('0x2')](function(){var _0x5d9a83=_[_0x61ce('0x3')](_0x22a795,function(_0x40aa5d){return getQueuesByChannel(_0x432443,_0x40aa5d);});return Promise[_0x61ce('0xe')](_0x5d9a83);})[_0x61ce('0x5')](function(_0x171914){throw _0x171914;});}}});}; \ No newline at end of file +var _0x3afd=['define','teams','Fax','Mail','Sms','Voice','Whatsapp','resolve','map','all','catch','./team.attributes','get','Queues','then','channel'];(function(_0x50d0ca,_0x20df20){var _0x41ee03=function(_0x569667){while(--_0x569667){_0x50d0ca['push'](_0x50d0ca['shift']());}};_0x41ee03(++_0x20df20);}(_0x3afd,0x19b));var _0xd3af=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x3afd[_0x45b034];return _0x509cb0;};'use strict';var _=require('lodash');var attributes=require(_0xd3af('0x0'));function getQueuesByChannel(_0x3f7022,_0xa3ff06){var _0x5a709d=_0xd3af('0x1')+_0xa3ff06+_0xd3af('0x2');return _0x3f7022[_0x5a709d]()[_0xd3af('0x3')](function(_0x2b3dd4){return _['map'](_0x2b3dd4,function(_0x32da38){_0x32da38['setDataValue'](_0xd3af('0x4'),_0xa3ff06);return _0x32da38;});})['catch'](function(_0x210876){throw _0x210876;});}module['exports']=function(_0x3956b7){return _0x3956b7[_0xd3af('0x5')]('Team',attributes,{'tableName':_0xd3af('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x241206=this;var _0x41e3ae=['Chat',_0xd3af('0x7'),_0xd3af('0x8'),'Openchannel',_0xd3af('0x9'),_0xd3af('0xa'),_0xd3af('0xb')];return Promise[_0xd3af('0xc')]()[_0xd3af('0x3')](function(){var _0x433047=_[_0xd3af('0xd')](_0x41e3ae,function(_0x3d9437){return getQueuesByChannel(_0x241206,_0x3d9437);});return Promise[_0xd3af('0xe')](_0x433047);})[_0xd3af('0xf')](function(_0x102006){throw _0x102006;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 1a2c6ae..6b57b47 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 _0x2fd3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./team.socket','register','info','request\x20sent','error','Team,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2e3b7c,_0xc17939){var _0x421487=function(_0x15c703){while(--_0x15c703){_0x2e3b7c['push'](_0x2e3b7c['shift']());}};_0x421487(++_0xc17939);}(_0x2fd3,0x18c));var _0x32fd=function(_0x1fb524,_0x33d1d3){_0x1fb524=_0x1fb524-0x0;var _0x3a76d3=_0x2fd3[_0x1fb524];return _0x3a76d3;};'use strict';var _=require('lodash');var util=require(_0x32fd('0x0'));var moment=require(_0x32fd('0x1'));var BPromise=require(_0x32fd('0x2'));var rs=require(_0x32fd('0x3'));var fs=require('fs');var Redis=require(_0x32fd('0x4'));var db=require(_0x32fd('0x5'))['db'];var utils=require(_0x32fd('0x6'));var logger=require(_0x32fd('0x7'))(_0x32fd('0x8'));var config=require(_0x32fd('0x9'));var jayson=require(_0x32fd('0xa'));var client=jayson[_0x32fd('0xb')][_0x32fd('0xc')]({'port':0x232a});config['redis']=_[_0x32fd('0xd')](config['redis'],{'host':_0x32fd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32fd('0xf')]));require(_0x32fd('0x10'))[_0x32fd('0x11')](socket);function respondWithRpcPromise(_0x1c2f04,_0x4ab8f2,_0x56f4f8){return new BPromise(function(_0x3f2e81,_0x1f4326){return client['request'](_0x1c2f04,_0x56f4f8)['then'](function(_0x2578c9){logger[_0x32fd('0x12')]('Team,\x20%s,\x20%s',_0x4ab8f2,_0x32fd('0x13'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x4ab8f2,'request\x20sent',JSON['stringify'](_0x2578c9));if(_0x2578c9[_0x32fd('0x14')]){if(_0x2578c9[_0x32fd('0x14')]['code']===0x1f4){logger['error'](_0x32fd('0x15'),_0x4ab8f2,_0x2578c9['error'][_0x32fd('0x16')]);return _0x1f4326(_0x2578c9[_0x32fd('0x14')][_0x32fd('0x16')]);}logger[_0x32fd('0x14')](_0x32fd('0x15'),_0x4ab8f2,_0x2578c9[_0x32fd('0x14')][_0x32fd('0x16')]);return _0x3f2e81(_0x2578c9[_0x32fd('0x14')]['message']);}else{logger[_0x32fd('0x12')](_0x32fd('0x15'),_0x4ab8f2,_0x32fd('0x13'));_0x3f2e81(_0x2578c9[_0x32fd('0x17')][_0x32fd('0x16')]);}})[_0x32fd('0x18')](function(_0x661ea0){logger['error'](_0x32fd('0x15'),_0x4ab8f2,_0x661ea0);_0x1f4326(_0x661ea0);});});} \ No newline at end of file +var _0xd585=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message'];(function(_0x55ec6c,_0x5b22aa){var _0x312e90=function(_0x1a0cfc){while(--_0x1a0cfc){_0x55ec6c['push'](_0x55ec6c['shift']());}};_0x312e90(++_0x5b22aa);}(_0xd585,0x17b));var _0x5d58=function(_0x53147a,_0x4516e3){_0x53147a=_0x53147a-0x0;var _0x13a9cd=_0xd585[_0x53147a];return _0x13a9cd;};'use strict';var _=require(_0x5d58('0x0'));var util=require(_0x5d58('0x1'));var moment=require(_0x5d58('0x2'));var BPromise=require(_0x5d58('0x3'));var rs=require(_0x5d58('0x4'));var fs=require('fs');var Redis=require(_0x5d58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d58('0x6'));var logger=require(_0x5d58('0x7'))('rpc');var config=require(_0x5d58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d58('0x9')][_0x5d58('0xa')]({'port':0x232a});config[_0x5d58('0xb')]=_[_0x5d58('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d58('0xd'))(new Redis(config[_0x5d58('0xb')]));require(_0x5d58('0xe'))[_0x5d58('0xf')](socket);function respondWithRpcPromise(_0x4dfc59,_0x479791,_0x39ac6a){return new BPromise(function(_0xbdffbc,_0x15e7a0){return client[_0x5d58('0x10')](_0x4dfc59,_0x39ac6a)[_0x5d58('0x11')](function(_0x854580){logger[_0x5d58('0x12')]('Team,\x20%s,\x20%s',_0x479791,_0x5d58('0x13'));logger[_0x5d58('0x14')](_0x5d58('0x15'),_0x479791,_0x5d58('0x13'),JSON['stringify'](_0x854580));if(_0x854580[_0x5d58('0x16')]){if(_0x854580[_0x5d58('0x16')][_0x5d58('0x17')]===0x1f4){logger[_0x5d58('0x16')](_0x5d58('0x18'),_0x479791,_0x854580['error'][_0x5d58('0x19')]);return _0x15e7a0(_0x854580[_0x5d58('0x16')][_0x5d58('0x19')]);}logger[_0x5d58('0x16')]('Team,\x20%s,\x20%s',_0x479791,_0x854580[_0x5d58('0x16')]['message']);return _0xbdffbc(_0x854580['error']['message']);}else{logger[_0x5d58('0x12')](_0x5d58('0x18'),_0x479791,_0x5d58('0x13'));_0xbdffbc(_0x854580['result'][_0x5d58('0x19')]);}})[_0x5d58('0x1a')](function(_0x20a48f){logger[_0x5d58('0x16')]('Team,\x20%s,\x20%s',_0x479791,_0x20a48f);_0x15e7a0(_0x20a48f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0edc4ee..e097457 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 _0xab7f=['remove','update','emit','register','length','team:','./team.events','save'];(function(_0x819bcc,_0x11d8b2){var _0x55fc0e=function(_0x5937f8){while(--_0x5937f8){_0x819bcc['push'](_0x819bcc['shift']());}};_0x55fc0e(++_0x11d8b2);}(_0xab7f,0xa6));var _0xfab7=function(_0xe8acf6,_0xce88e6){_0xe8acf6=_0xe8acf6-0x0;var _0x354cfb=_0xab7f[_0xe8acf6];return _0x354cfb;};'use strict';var TeamEvents=require(_0xfab7('0x0'));var events=[_0xfab7('0x1'),_0xfab7('0x2'),_0xfab7('0x3')];function createListener(_0x22a471,_0x4e1b3d){return function(_0x7693da){_0x4e1b3d[_0xfab7('0x4')](_0x22a471,_0x7693da);};}function removeListener(_0x233cd9,_0x1e13c6){return function(){TeamEvents['removeListener'](_0x233cd9,_0x1e13c6);};}exports[_0xfab7('0x5')]=function(_0x1213a8){for(var _0x5cde2d=0x0,_0x704224=events[_0xfab7('0x6')];_0x5cde2d<_0x704224;_0x5cde2d++){var _0x40610b=events[_0x5cde2d];var _0x2025c9=createListener(_0xfab7('0x7')+_0x40610b,_0x1213a8);TeamEvents['on'](_0x40610b,_0x2025c9);}}; \ No newline at end of file +var _0x063e=['length','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x063e,0x111));var _0xe063=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x063e[_0x1d1779];return _0x2377e9;};'use strict';var TeamEvents=require(_0xe063('0x0'));var events=[_0xe063('0x1'),_0xe063('0x2'),_0xe063('0x3')];function createListener(_0x2dc38f,_0x29be6d){return function(_0x31ff69){_0x29be6d[_0xe063('0x4')](_0x2dc38f,_0x31ff69);};}function removeListener(_0x3b58ec,_0x35a88b){return function(){TeamEvents[_0xe063('0x5')](_0x3b58ec,_0x35a88b);};}exports[_0xe063('0x6')]=function(_0x4cc570){for(var _0x5e99c3=0x0,_0x561d7b=events[_0xe063('0x7')];_0x5e99c3<_0x561d7b;_0x5e99c3++){var _0x661f34=events[_0x5e99c3];var _0x1c48ea=createListener('team:'+_0x661f34,_0x4cc570);TeamEvents['on'](_0x661f34,_0x1c48ea);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index f0029ab..634e9d1 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 _0xde46=['sequelize','INTEGER'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xde46,0x174));var _0x6de4=function(_0x537a14,_0x4dbf52){_0x537a14=_0x537a14-0x0;var _0x4c554b=_0xde46[_0x537a14];return _0x4c554b;};'use strict';var Sequelize=require(_0x6de4('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x6de4('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3e8e=['exports','INTEGER'];(function(_0xae8a9e,_0x22e774){var _0x3e4e9b=function(_0xa4fdef){while(--_0xa4fdef){_0xae8a9e['push'](_0xae8a9e['shift']());}};_0x3e4e9b(++_0x22e774);}(_0x3e8e,0x106));var _0xe3e8=function(_0x2fc18a,_0xf934a7){_0x2fc18a=_0x2fc18a-0x0;var _0x22343c=_0x3e8e[_0x2fc18a];return _0x22343c;};'use strict';var Sequelize=require('sequelize');module[_0xe3e8('0x0')]={'TeamId':{'type':Sequelize[_0xe3e8('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xe3e8('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0d6c072..8cda781 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 _0x6f3e=['exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var logger=require(_0xe6f3('0x2'))(_0xe6f3('0x3'));var moment=require(_0xe6f3('0x4'));var BPromise=require(_0xe6f3('0x5'));var rp=require(_0xe6f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6f3('0x7'));var config=require(_0xe6f3('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0xe6f3('0x9')]=function(_0x46e7ef,_0x2723be){return _0x46e7ef['define'](_0xe6f3('0xa'),attributes,{'tableName':_0xe6f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69d3=['../../config/logger','moment','bluebird','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x69d3,0xda));var _0x369d=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0x69d3[_0x48b724];return _0x4d38b3;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var logger=require(_0x369d('0x2'))('api');var moment=require(_0x369d('0x3'));var BPromise=require(_0x369d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x369d('0x5'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x369d('0x6')]=function(_0x2f2a53,_0x18c9f1){return _0x2f2a53[_0x369d('0x7')](_0x369d('0x8'),attributes,{'tableName':_0x369d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index b721d5a..daeba77 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(_0x43c0d8,_0x59449e){var _0x255aaf=function(_0x204b32){while(--_0x204b32){_0x43c0d8['push'](_0x43c0d8['shift']());}};_0x255aaf(++_0x59449e);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'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(_0x2c654f,_0x11ce94){var _0xa53d15=function(_0x4db4a9){while(--_0x4db4a9){_0x2c654f['push'](_0x2c654f['shift']());}};_0xa53d15(++_0x11ce94);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index cd43c83..ed255ce 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 _0xb4e9=['exports','INTEGER','sequelize'];(function(_0x31b456,_0x134a1f){var _0x45c588=function(_0x57fede){while(--_0x57fede){_0x31b456['push'](_0x31b456['shift']());}};_0x45c588(++_0x134a1f);}(_0xb4e9,0xda));var _0x9b4e=function(_0x2b7fd3,_0x17556d){_0x2b7fd3=_0x2b7fd3-0x0;var _0x1bd260=_0xb4e9[_0x2b7fd3];return _0x1bd260;};'use strict';var Sequelize=require(_0x9b4e('0x0'));module[_0x9b4e('0x1')]={'penalty':{'type':Sequelize[_0x9b4e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa0cf=['exports','INTEGER','sequelize'];(function(_0x11b2bd,_0x3c32ae){var _0x102c71=function(_0x5ebe11){while(--_0x5ebe11){_0x11b2bd['push'](_0x11b2bd['shift']());}};_0x102c71(++_0x3c32ae);}(_0xa0cf,0x164));var _0xfa0c=function(_0x367ac0,_0x5ddbf7){_0x367ac0=_0x367ac0-0x0;var _0x5c6ea7=_0xa0cf[_0x367ac0];return _0x5c6ea7;};'use strict';var Sequelize=require(_0xfa0c('0x0'));module[_0xfa0c('0x1')]={'penalty':{'type':Sequelize[_0xfa0c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index e85cb74..db32eb9 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 _0x4876=['../../config/environment','./teamVoiceQueue.attributes','TeamVoiceQueue','team_has_voice_queues','../../config/logger','bluebird','path','rimraf'];(function(_0x413891,_0xa01a2f){var _0xe46731=function(_0x30dfa7){while(--_0x30dfa7){_0x413891['push'](_0x413891['shift']());}};_0xe46731(++_0xa01a2f);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x192f=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x5a9345,_0x5eb4b6){var _0x5d8b74=function(_0x226765){while(--_0x226765){_0x5a9345['push'](_0x5a9345['shift']());}};_0x5d8b74(++_0x5eb4b6);}(_0x192f,0xd6));var _0xf192=function(_0x4bbaf5,_0x5979ab){_0x4bbaf5=_0x4bbaf5-0x0;var _0x163996=_0x192f[_0x4bbaf5];return _0x163996;};'use strict';var _=require(_0xf192('0x0'));var util=require('util');var logger=require(_0xf192('0x1'))('api');var moment=require(_0xf192('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf192('0x3'));var rimraf=require(_0xf192('0x4'));var config=require(_0xf192('0x5'));var attributes=require(_0xf192('0x6'));module[_0xf192('0x7')]=function(_0x221f55,_0x5a05b0){return _0x221f55[_0xf192('0x8')](_0xf192('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 81a6cd0..260e555 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 _0xa7d7=['message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x29829d,_0x1ff9bf){var _0xaf67d0=function(_0x1ce9c4){while(--_0x1ce9c4){_0x29829d['push'](_0x29829d['shift']());}};_0xaf67d0(++_0x1ff9bf);}(_0xa7d7,0x179));var _0x7a7d=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xa7d7[_0x412e27];return _0x53da42;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require(_0x7a7d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a7d('0x5'))['db'];var utils=require(_0x7a7d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7a7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a7d('0x8')][_0x7a7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40a223,_0x234018,_0x3494b8){return new BPromise(function(_0x131422,_0x43f29b){return client[_0x7a7d('0xa')](_0x40a223,_0x3494b8)[_0x7a7d('0xb')](function(_0x55adbf){logger['info'](_0x7a7d('0xc'),_0x234018,'request\x20sent');logger[_0x7a7d('0xd')](_0x7a7d('0xe'),_0x234018,_0x7a7d('0xf'),JSON[_0x7a7d('0x10')](_0x55adbf));if(_0x55adbf[_0x7a7d('0x11')]){if(_0x55adbf[_0x7a7d('0x11')][_0x7a7d('0x12')]===0x1f4){logger[_0x7a7d('0x11')](_0x7a7d('0xc'),_0x234018,_0x55adbf[_0x7a7d('0x11')]['message']);return _0x43f29b(_0x55adbf['error'][_0x7a7d('0x13')]);}logger['error'](_0x7a7d('0xc'),_0x234018,_0x55adbf['error']['message']);return _0x131422(_0x55adbf[_0x7a7d('0x11')]['message']);}else{logger[_0x7a7d('0x14')](_0x7a7d('0xc'),_0x234018,_0x7a7d('0xf'));_0x131422(_0x55adbf['result'][_0x7a7d('0x13')]);}})[_0x7a7d('0x15')](function(_0x3f9462){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x234018,_0x3f9462);_0x43f29b(_0x3f9462);});});} \ No newline at end of file +var _0xbef6=['rpc','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbef6,0x1b0));var _0x6bef=function(_0x42071f,_0x2655e5){_0x42071f=_0x42071f-0x0;var _0x4f7061=_0xbef6[_0x42071f];return _0x4f7061;};'use strict';var _=require(_0x6bef('0x0'));var util=require(_0x6bef('0x1'));var moment=require('moment');var BPromise=require(_0x6bef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bef('0x4'))(_0x6bef('0x5'));var config=require('../../config/environment');var jayson=require(_0x6bef('0x6'));var client=jayson[_0x6bef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a59d,_0x7e58a9,_0x590b4c){return new BPromise(function(_0x4d47d0,_0x30639d){return client[_0x6bef('0x8')](_0x11a59d,_0x590b4c)[_0x6bef('0x9')](function(_0x19d992){logger[_0x6bef('0xa')](_0x6bef('0xb'),_0x7e58a9,_0x6bef('0xc'));logger[_0x6bef('0xd')](_0x6bef('0xe'),_0x7e58a9,_0x6bef('0xc'),JSON[_0x6bef('0xf')](_0x19d992));if(_0x19d992[_0x6bef('0x10')]){if(_0x19d992[_0x6bef('0x10')]['code']===0x1f4){logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);return _0x30639d(_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);}logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);return _0x4d47d0(_0x19d992[_0x6bef('0x10')][_0x6bef('0x11')]);}else{logger[_0x6bef('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x7e58a9,_0x6bef('0xc'));_0x4d47d0(_0x19d992['result'][_0x6bef('0x11')]);}})[_0x6bef('0x12')](function(_0x35bd32){logger[_0x6bef('0x10')](_0x6bef('0xb'),_0x7e58a9,_0x35bd32);_0x30639d(_0x35bd32);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index dc37a76..550a3bd 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 _0x0af5=['create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id'];(function(_0xdd3b79,_0x3d7db8){var _0x7fd880=function(_0x4f82c0){while(--_0x4f82c0){_0xdd3b79['push'](_0xdd3b79['shift']());}};_0x7fd880(++_0x3d7db8);}(_0x0af5,0x158));var _0x50af=function(_0x172ba2,_0x1cef77){_0x172ba2=_0x172ba2-0x0;var _0x1d0858=_0x0af5[_0x172ba2];return _0x1d0858;};'use strict';var multer=require('multer');var util=require(_0x50af('0x0'));var path=require(_0x50af('0x1'));var timeout=require(_0x50af('0x2'));var express=require(_0x50af('0x3'));var router=express[_0x50af('0x4')]();var fs_extra=require(_0x50af('0x5'));var auth=require(_0x50af('0x6'));var interaction=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var controller=require(_0x50af('0x9'));router[_0x50af('0xa')]('/',auth[_0x50af('0xb')](),controller['index']);router['get'](_0x50af('0xc'),auth[_0x50af('0xb')](),controller['show']);router['post']('/',auth[_0x50af('0xb')](),controller[_0x50af('0xd')]);router['put']('/:id',auth[_0x50af('0xb')](),controller[_0x50af('0xe')]);router['delete'](_0x50af('0xc'),auth[_0x50af('0xb')](),controller[_0x50af('0xf')]);module[_0x50af('0x10')]=router; \ No newline at end of file +var _0xab00=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4abf46,_0x2335c8){var _0x71c905=function(_0x271e04){while(--_0x271e04){_0x4abf46['push'](_0x4abf46['shift']());}};_0x71c905(++_0x2335c8);}(_0xab00,0x1b9));var _0x0ab0=function(_0x3499dc,_0x118dc7){_0x3499dc=_0x3499dc-0x0;var _0xac6975=_0xab00[_0x3499dc];return _0xac6975;};'use strict';var multer=require(_0x0ab0('0x0'));var util=require(_0x0ab0('0x1'));var path=require(_0x0ab0('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ab0('0x3'));var router=express[_0x0ab0('0x4')]();var fs_extra=require(_0x0ab0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ab0('0x6'));var config=require('../../config/environment');var controller=require(_0x0ab0('0x7'));router[_0x0ab0('0x8')]('/',auth[_0x0ab0('0x9')](),controller[_0x0ab0('0xa')]);router[_0x0ab0('0x8')](_0x0ab0('0xb'),auth['isAuthenticated'](),controller[_0x0ab0('0xc')]);router[_0x0ab0('0xd')]('/',auth['isAuthenticated'](),controller[_0x0ab0('0xe')]);router['put'](_0x0ab0('0xb'),auth[_0x0ab0('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ab0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 46c4471..ac0344c 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 _0xe6c4=['exports','STRING','TEXT'];(function(_0x43b459,_0x1523bf){var _0x12110a=function(_0x4d0023){while(--_0x4d0023){_0x43b459['push'](_0x43b459['shift']());}};_0x12110a(++_0x1523bf);}(_0xe6c4,0x1aa));var _0x4e6c=function(_0x34cf54,_0x18f11){_0x34cf54=_0x34cf54-0x0;var _0x4c97ab=_0xe6c4[_0x34cf54];return _0x4c97ab;};'use strict';var Sequelize=require('sequelize');module[_0x4e6c('0x0')]={'name':{'type':Sequelize[_0x4e6c('0x1')]},'description':{'type':Sequelize[_0x4e6c('0x1')]},'html':{'type':Sequelize[_0x4e6c('0x2')]}}; \ No newline at end of file +var _0xab78=['STRING','TEXT','sequelize','exports'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0xab78,0x16e));var _0x8ab7=function(_0x5c0c8a,_0x366ae8){_0x5c0c8a=_0x5c0c8a-0x0;var _0x611af3=_0xab78[_0x5c0c8a];return _0x611af3;};'use strict';var Sequelize=require(_0x8ab7('0x0'));module[_0x8ab7('0x1')]={'name':{'type':Sequelize[_0x8ab7('0x2')]},'description':{'type':Sequelize[_0x8ab7('0x2')]},'html':{'type':Sequelize[_0x8ab7('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6134a64..68fcd80 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 _0xda4a=['get','Templates','UserProfileResource','then','end','error','stack','name','Template','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','params','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy'];(function(_0x32bd11,_0x684ee3){var _0x319ad7=function(_0x1e0843){while(--_0x1e0843){_0x32bd11['push'](_0x32bd11['shift']());}};_0x319ad7(++_0x684ee3);}(_0xda4a,0x1eb));var _0xada4=function(_0x11c40b,_0x14fd54){_0x11c40b=_0x11c40b-0x0;var _0x4bee1b=_0xda4a[_0x11c40b];return _0x4bee1b;};'use strict';var emlformat=require(_0xada4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xada4('0x1'));var rp=require(_0xada4('0x2'));var moment=require(_0xada4('0x3'));var BPromise=require(_0xada4('0x4'));var Mustache=require('mustache');var util=require(_0xada4('0x5'));var path=require(_0xada4('0x6'));var sox=require(_0xada4('0x7'));var csv=require('to-csv');var ejs=require(_0xada4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xada4('0x9'));var squel=require(_0xada4('0xa'));var crypto=require('crypto');var jsforce=require(_0xada4('0xb'));var deskjs=require(_0xada4('0xc'));var toCsv=require(_0xada4('0xd'));var querystring=require(_0xada4('0xe'));var Papa=require('papaparse');var Redis=require(_0xada4('0xf'));var authService=require(_0xada4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xada4('0x11'));var hardwareService=require(_0xada4('0x12'));var logger=require('../../config/logger')(_0xada4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xada4('0x14'));var db=require(_0xada4('0x15'))['db'];function respondWithStatusCode(_0x500e89,_0x11d197){_0x11d197=_0x11d197||0xcc;return function(_0x2c4c5c){if(_0x2c4c5c){return _0x500e89[_0xada4('0x16')](_0x11d197);}return _0x500e89['status'](_0x11d197)['end']();};}function respondWithResult(_0x53edd1,_0x9c279b){_0x9c279b=_0x9c279b||0xc8;return function(_0x402996){if(_0x402996){return _0x53edd1[_0xada4('0x17')](_0x9c279b)[_0xada4('0x18')](_0x402996);}};}function respondWithFilteredResult(_0x619114,_0x1978f4){return function(_0x291ee1){if(_0x291ee1){var _0x478f39=typeof _0x1978f4[_0xada4('0x19')]===_0xada4('0x1a')&&typeof _0x1978f4[_0xada4('0x1b')]==='undefined';var _0x322918=_0x291ee1[_0xada4('0x1c')];var _0x3ce22e=_0x478f39?0x0:_0x1978f4[_0xada4('0x19')];var _0x5f53da=_0x478f39?_0x291ee1[_0xada4('0x1c')]:_0x1978f4[_0xada4('0x19')]+_0x1978f4[_0xada4('0x1b')];var _0x4d1ae6;if(_0x5f53da>=_0x322918){_0x5f53da=_0x322918;_0x4d1ae6=0xc8;}else{_0x4d1ae6=0xce;}_0x619114[_0xada4('0x17')](_0x4d1ae6);return _0x619114['set'](_0xada4('0x1d'),_0x3ce22e+'-'+_0x5f53da+'/'+_0x322918)[_0xada4('0x18')](_0x291ee1);}return null;};}function patchUpdates(_0x27838b){return function(_0x3e81f8){try{jsonpatch[_0xada4('0x1e')](_0x3e81f8,_0x27838b,!![]);}catch(_0x379917){return BPromise[_0xada4('0x1f')](_0x379917);}return _0x3e81f8['save']();};}function saveUpdates(_0x206dcf,_0x4b3be6){return function(_0x411b33){if(_0x411b33){return _0x411b33[_0xada4('0x20')](_0x206dcf)['then'](function(_0x1d15cf){return _0x1d15cf;});}return null;};}function removeEntity(_0x19849b,_0x55665c){return function(_0x3b696){if(_0x3b696){return _0x3b696[_0xada4('0x21')]()['then'](function(){var _0x71a27b=_0x3b696[_0xada4('0x22')]({'plain':!![]});var _0x582a9a=_0xada4('0x23');return db[_0xada4('0x24')][_0xada4('0x21')]({'where':{'type':_0x582a9a,'resourceId':_0x71a27b['id']}})[_0xada4('0x25')](function(){return _0x3b696;});})['then'](function(){_0x19849b[_0xada4('0x17')](0xcc)[_0xada4('0x26')]();});}};}function handleEntityNotFound(_0x106ce3,_0x14ae4e){return function(_0x2e91dc){if(!_0x2e91dc){_0x106ce3[_0xada4('0x16')](0x194);}return _0x2e91dc;};}function handleError(_0x58e442,_0x5bfd2f){_0x5bfd2f=_0x5bfd2f||0x1f4;return function(_0x24e1ac){logger[_0xada4('0x27')](_0x24e1ac[_0xada4('0x28')]);if(_0x24e1ac[_0xada4('0x29')]){delete _0x24e1ac[_0xada4('0x29')];}_0x58e442[_0xada4('0x17')](_0x5bfd2f)['send'](_0x24e1ac);};}exports['index']=function(_0x33f6e1,_0x293e9e){var _0x57a97f={},_0x541f65={},_0x3dc263={'count':0x0,'rows':[]};var _0x467d69=_['map'](db[_0xada4('0x2a')]['rawAttributes'],function(_0x34f99f){return{'name':_0x34f99f[_0xada4('0x2b')],'type':_0x34f99f['type'][_0xada4('0x2c')]};});_0x541f65[_0xada4('0x2d')]=_[_0xada4('0x2e')](_0x467d69,'name');_0x541f65[_0xada4('0x2f')]=_[_0xada4('0x30')](_0x33f6e1[_0xada4('0x2f')]);_0x541f65[_0xada4('0x31')]=_[_0xada4('0x32')](_0x541f65[_0xada4('0x2d')],_0x541f65['query']);_0x57a97f['attributes']=_[_0xada4('0x32')](_0x541f65['model'],qs[_0xada4('0x33')](_0x33f6e1[_0xada4('0x2f')][_0xada4('0x33')]));_0x57a97f[_0xada4('0x34')]=_0x57a97f[_0xada4('0x34')][_0xada4('0x35')]?_0x57a97f[_0xada4('0x34')]:_0x541f65['model'];if(!_0x33f6e1[_0xada4('0x2f')]['hasOwnProperty'](_0xada4('0x36'))){_0x57a97f[_0xada4('0x1b')]=qs[_0xada4('0x1b')](_0x33f6e1[_0xada4('0x2f')][_0xada4('0x1b')]);_0x57a97f[_0xada4('0x19')]=qs[_0xada4('0x19')](_0x33f6e1[_0xada4('0x2f')][_0xada4('0x19')]);}_0x57a97f['order']=qs[_0xada4('0x37')](_0x33f6e1[_0xada4('0x2f')][_0xada4('0x37')]);_0x57a97f[_0xada4('0x38')]=qs['filters'](_[_0xada4('0x39')](_0x33f6e1[_0xada4('0x2f')],_0x541f65['filters']),_0x467d69);if(_0x33f6e1[_0xada4('0x2f')][_0xada4('0x3a')]){_0x57a97f[_0xada4('0x38')]=_[_0xada4('0x3b')](_0x57a97f['where'],{'$or':_[_0xada4('0x2e')](_0x467d69,function(_0x319997){if(_0x319997[_0xada4('0x3c')]!==_0xada4('0x3d')){var _0x49897f={};_0x49897f[_0x319997['name']]={'$like':'%'+_0x33f6e1[_0xada4('0x2f')][_0xada4('0x3a')]+'%'};return _0x49897f;}})});}_0x57a97f=_[_0xada4('0x3b')]({},_0x57a97f,_0x33f6e1[_0xada4('0x3e')]);var _0x52ac70={'where':_0x57a97f[_0xada4('0x38')]};return db['Template'][_0xada4('0x1c')](_0x52ac70)[_0xada4('0x25')](function(_0x1c0762){_0x3dc263[_0xada4('0x1c')]=_0x1c0762;if(_0x33f6e1[_0xada4('0x2f')][_0xada4('0x3f')]){_0x57a97f['include']=[{'all':!![]}];}return db['Template'][_0xada4('0x40')](_0x57a97f);})['then'](function(_0x42d818){_0x3dc263['rows']=_0x42d818;return _0x3dc263;})[_0xada4('0x25')](respondWithFilteredResult(_0x293e9e,_0x57a97f))['catch'](handleError(_0x293e9e,null));};exports['show']=function(_0xfb2dad,_0x368329){var _0xa53b09={'raw':!![],'where':{'id':_0xfb2dad[_0xada4('0x41')]['id']}},_0x370b20={};_0x370b20[_0xada4('0x2d')]=_[_0xada4('0x30')](db[_0xada4('0x2a')]['rawAttributes']);_0x370b20[_0xada4('0x2f')]=_['keys'](_0xfb2dad[_0xada4('0x2f')]);_0x370b20[_0xada4('0x31')]=_['intersection'](_0x370b20[_0xada4('0x2d')],_0x370b20[_0xada4('0x2f')]);_0xa53b09[_0xada4('0x34')]=_[_0xada4('0x32')](_0x370b20[_0xada4('0x2d')],qs['fields'](_0xfb2dad[_0xada4('0x2f')][_0xada4('0x33')]));_0xa53b09[_0xada4('0x34')]=_0xa53b09[_0xada4('0x34')][_0xada4('0x35')]?_0xa53b09['attributes']:_0x370b20['model'];if(_0xfb2dad[_0xada4('0x2f')]['includeAll']){_0xa53b09[_0xada4('0x42')]=[{'all':!![]}];}_0xa53b09=_[_0xada4('0x3b')]({},_0xa53b09,_0xfb2dad[_0xada4('0x3e')]);return db[_0xada4('0x2a')][_0xada4('0x43')](_0xa53b09)[_0xada4('0x25')](handleEntityNotFound(_0x368329,null))[_0xada4('0x25')](respondWithResult(_0x368329,null))[_0xada4('0x44')](handleError(_0x368329,null));};exports[_0xada4('0x45')]=function(_0x130483,_0x574809){return db[_0xada4('0x2a')][_0xada4('0x45')](_0x130483['body'],{})['then'](function(_0x458f0d){var _0x148033=_0x130483[_0xada4('0x46')][_0xada4('0x22')]({'plain':!![]});if(!_0x148033)throw new Error(_0xada4('0x47'));if(_0x148033[_0xada4('0x48')]==='user'){var _0x2002c8=_0x458f0d[_0xada4('0x22')]({'plain':!![]});var _0x3f6928=_0xada4('0x23');return db['UserProfileSection'][_0xada4('0x43')]({'where':{'name':_0x3f6928,'userProfileId':_0x148033['userProfileId']},'raw':!![]})[_0xada4('0x25')](function(_0x3247fc){if(_0x3247fc&&_0x3247fc[_0xada4('0x49')]===0x0){return db[_0xada4('0x24')][_0xada4('0x45')]({'name':_0x2002c8[_0xada4('0x29')],'resourceId':_0x2002c8['id'],'type':_0x3247fc[_0xada4('0x29')],'sectionId':_0x3247fc['id']},{})['then'](function(){return _0x458f0d;});}else{return _0x458f0d;}})[_0xada4('0x44')](function(_0x2f6833){logger[_0xada4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f6833);throw _0x2f6833;});}return _0x458f0d;})[_0xada4('0x25')](respondWithResult(_0x574809,0xc9))['catch'](handleError(_0x574809,null));};exports[_0xada4('0x20')]=function(_0x2041cc,_0x19ae6a){if(_0x2041cc[_0xada4('0x4a')]['id']){delete _0x2041cc[_0xada4('0x4a')]['id'];}return db[_0xada4('0x2a')][_0xada4('0x43')]({'where':{'id':_0x2041cc['params']['id']}})[_0xada4('0x25')](handleEntityNotFound(_0x19ae6a,null))[_0xada4('0x25')](saveUpdates(_0x2041cc[_0xada4('0x4a')],null))[_0xada4('0x25')](respondWithResult(_0x19ae6a,null))[_0xada4('0x44')](handleError(_0x19ae6a,null));};exports['destroy']=function(_0x3b5884,_0x4a15bb){return db[_0xada4('0x2a')][_0xada4('0x43')]({'where':{'id':_0x3b5884[_0xada4('0x41')]['id']}})[_0xada4('0x25')](handleEntityNotFound(_0x4a15bb,null))[_0xada4('0x25')](removeEntity(_0x4a15bb,null))[_0xada4('0x44')](handleError(_0x4a15bb,null));}; \ No newline at end of file +var _0x7be5=['stack','name','index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Templates','destroy','error'];(function(_0x164547,_0x2b19d4){var _0x32b31f=function(_0x39054c){while(--_0x39054c){_0x164547['push'](_0x164547['shift']());}};_0x32b31f(++_0x2b19d4);}(_0x7be5,0xd8));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57be('0x0'));var zipdir=require(_0x57be('0x1'));var jsonpatch=require(_0x57be('0x2'));var rp=require(_0x57be('0x3'));var moment=require(_0x57be('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x57be('0x5'));var path=require(_0x57be('0x6'));var sox=require(_0x57be('0x7'));var csv=require(_0x57be('0x8'));var ejs=require(_0x57be('0x9'));var fs=require('fs');var fs_extra=require(_0x57be('0xa'));var _=require(_0x57be('0xb'));var squel=require(_0x57be('0xc'));var crypto=require(_0x57be('0xd'));var jsforce=require(_0x57be('0xe'));var deskjs=require(_0x57be('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57be('0x10'));var Redis=require(_0x57be('0x11'));var authService=require(_0x57be('0x12'));var qs=require(_0x57be('0x13'));var as=require(_0x57be('0x14'));var hardwareService=require(_0x57be('0x15'));var logger=require(_0x57be('0x16'))(_0x57be('0x17'));var utils=require(_0x57be('0x18'));var config=require(_0x57be('0x19'));var licenseUtil=require(_0x57be('0x1a'));var db=require(_0x57be('0x1b'))['db'];function respondWithStatusCode(_0x24d0f0,_0x44a9ac){_0x44a9ac=_0x44a9ac||0xcc;return function(_0x74460){if(_0x74460){return _0x24d0f0[_0x57be('0x1c')](_0x44a9ac);}return _0x24d0f0['status'](_0x44a9ac)[_0x57be('0x1d')]();};}function respondWithResult(_0x2f3450,_0x49a36c){_0x49a36c=_0x49a36c||0xc8;return function(_0x226fcb){if(_0x226fcb){return _0x2f3450[_0x57be('0x1e')](_0x49a36c)['json'](_0x226fcb);}};}function respondWithFilteredResult(_0xce8865,_0x297bc6){return function(_0x31b6d7){if(_0x31b6d7){var _0x55df33=typeof _0x297bc6[_0x57be('0x1f')]===_0x57be('0x20')&&typeof _0x297bc6[_0x57be('0x21')]===_0x57be('0x20');var _0x5308e1=_0x31b6d7[_0x57be('0x22')];var _0x558d80=_0x55df33?0x0:_0x297bc6['offset'];var _0x4422ff=_0x55df33?_0x31b6d7[_0x57be('0x22')]:_0x297bc6[_0x57be('0x1f')]+_0x297bc6[_0x57be('0x21')];var _0x40104e;if(_0x4422ff>=_0x5308e1){_0x4422ff=_0x5308e1;_0x40104e=0xc8;}else{_0x40104e=0xce;}_0xce8865[_0x57be('0x1e')](_0x40104e);return _0xce8865[_0x57be('0x23')](_0x57be('0x24'),_0x558d80+'-'+_0x4422ff+'/'+_0x5308e1)['json'](_0x31b6d7);}return null;};}function patchUpdates(_0x1d4e6d){return function(_0x199749){try{jsonpatch[_0x57be('0x25')](_0x199749,_0x1d4e6d,!![]);}catch(_0x57a2fb){return BPromise['reject'](_0x57a2fb);}return _0x199749[_0x57be('0x26')]();};}function saveUpdates(_0x49160c,_0x34215a){return function(_0x4e2ea8){if(_0x4e2ea8){return _0x4e2ea8[_0x57be('0x27')](_0x49160c)[_0x57be('0x28')](function(_0x12b1cf){return _0x12b1cf;});}return null;};}function removeEntity(_0x39260d,_0x1df461){return function(_0x597258){if(_0x597258){return _0x597258['destroy']()[_0x57be('0x28')](function(){var _0x515568=_0x597258[_0x57be('0x29')]({'plain':!![]});var _0x59d06a=_0x57be('0x2a');return db['UserProfileResource'][_0x57be('0x2b')]({'where':{'type':_0x59d06a,'resourceId':_0x515568['id']}})['then'](function(){return _0x597258;});})[_0x57be('0x28')](function(){_0x39260d[_0x57be('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de139,_0x3db199){return function(_0x341b0e){if(!_0x341b0e){_0x3de139['sendStatus'](0x194);}return _0x341b0e;};}function handleError(_0x163a26,_0xfa344c){_0xfa344c=_0xfa344c||0x1f4;return function(_0x501d95){logger[_0x57be('0x2c')](_0x501d95[_0x57be('0x2d')]);if(_0x501d95[_0x57be('0x2e')]){delete _0x501d95[_0x57be('0x2e')];}_0x163a26[_0x57be('0x1e')](_0xfa344c)['send'](_0x501d95);};}exports[_0x57be('0x2f')]=function(_0xa225c4,_0x1924b3){var _0x1e00a4={},_0x54778e={},_0x548de0={'count':0x0,'rows':[]};var _0x2573da=_[_0x57be('0x30')](db[_0x57be('0x31')][_0x57be('0x32')],function(_0x3451ca){return{'name':_0x3451ca['fieldName'],'type':_0x3451ca[_0x57be('0x33')][_0x57be('0x34')]};});_0x54778e[_0x57be('0x35')]=_['map'](_0x2573da,_0x57be('0x2e'));_0x54778e[_0x57be('0x36')]=_[_0x57be('0x37')](_0xa225c4[_0x57be('0x36')]);_0x54778e[_0x57be('0x38')]=_[_0x57be('0x39')](_0x54778e['model'],_0x54778e[_0x57be('0x36')]);_0x1e00a4[_0x57be('0x3a')]=_[_0x57be('0x39')](_0x54778e[_0x57be('0x35')],qs[_0x57be('0x3b')](_0xa225c4['query']['fields']));_0x1e00a4[_0x57be('0x3a')]=_0x1e00a4[_0x57be('0x3a')]['length']?_0x1e00a4[_0x57be('0x3a')]:_0x54778e[_0x57be('0x35')];if(!_0xa225c4['query'][_0x57be('0x3c')](_0x57be('0x3d'))){_0x1e00a4[_0x57be('0x21')]=qs['limit'](_0xa225c4[_0x57be('0x36')][_0x57be('0x21')]);_0x1e00a4[_0x57be('0x1f')]=qs['offset'](_0xa225c4[_0x57be('0x36')][_0x57be('0x1f')]);}_0x1e00a4[_0x57be('0x3e')]=qs[_0x57be('0x3f')](_0xa225c4[_0x57be('0x36')][_0x57be('0x3f')]);_0x1e00a4['where']=qs['filters'](_[_0x57be('0x40')](_0xa225c4[_0x57be('0x36')],_0x54778e[_0x57be('0x38')]),_0x2573da);if(_0xa225c4[_0x57be('0x36')][_0x57be('0x41')]){_0x1e00a4[_0x57be('0x42')]=_[_0x57be('0x43')](_0x1e00a4['where'],{'$or':_[_0x57be('0x30')](_0x2573da,function(_0x3c522e){if(_0x3c522e[_0x57be('0x33')]!==_0x57be('0x44')){var _0x3a792a={};_0x3a792a[_0x3c522e['name']]={'$like':'%'+_0xa225c4[_0x57be('0x36')]['filter']+'%'};return _0x3a792a;}})});}_0x1e00a4=_[_0x57be('0x43')]({},_0x1e00a4,_0xa225c4[_0x57be('0x45')]);var _0xf285={'where':_0x1e00a4['where']};return db['Template']['count'](_0xf285)[_0x57be('0x28')](function(_0x3198a0){_0x548de0['count']=_0x3198a0;if(_0xa225c4['query']['includeAll']){_0x1e00a4[_0x57be('0x46')]=[{'all':!![]}];}return db['Template']['findAll'](_0x1e00a4);})[_0x57be('0x28')](function(_0x2a74fb){_0x548de0[_0x57be('0x47')]=_0x2a74fb;return _0x548de0;})['then'](respondWithFilteredResult(_0x1924b3,_0x1e00a4))[_0x57be('0x48')](handleError(_0x1924b3,null));};exports[_0x57be('0x49')]=function(_0x253c84,_0x36e47c){var _0x1bbd34={'raw':!![],'where':{'id':_0x253c84[_0x57be('0x4a')]['id']}},_0x4b7fc8={};_0x4b7fc8[_0x57be('0x35')]=_['keys'](db[_0x57be('0x31')]['rawAttributes']);_0x4b7fc8['query']=_[_0x57be('0x37')](_0x253c84[_0x57be('0x36')]);_0x4b7fc8[_0x57be('0x38')]=_['intersection'](_0x4b7fc8[_0x57be('0x35')],_0x4b7fc8['query']);_0x1bbd34['attributes']=_[_0x57be('0x39')](_0x4b7fc8[_0x57be('0x35')],qs[_0x57be('0x3b')](_0x253c84['query'][_0x57be('0x3b')]));_0x1bbd34['attributes']=_0x1bbd34[_0x57be('0x3a')][_0x57be('0x4b')]?_0x1bbd34[_0x57be('0x3a')]:_0x4b7fc8[_0x57be('0x35')];if(_0x253c84[_0x57be('0x36')][_0x57be('0x4c')]){_0x1bbd34[_0x57be('0x46')]=[{'all':!![]}];}_0x1bbd34=_[_0x57be('0x43')]({},_0x1bbd34,_0x253c84[_0x57be('0x45')]);return db[_0x57be('0x31')][_0x57be('0x4d')](_0x1bbd34)['then'](handleEntityNotFound(_0x36e47c,null))[_0x57be('0x28')](respondWithResult(_0x36e47c,null))['catch'](handleError(_0x36e47c,null));};exports[_0x57be('0x4e')]=function(_0x32e012,_0x574dae){return db['Template'][_0x57be('0x4e')](_0x32e012[_0x57be('0x4f')],{})['then'](function(_0x47b508){var _0x4774da=_0x32e012[_0x57be('0x50')][_0x57be('0x29')]({'plain':!![]});if(!_0x4774da)throw new Error(_0x57be('0x51'));if(_0x4774da[_0x57be('0x52')]==='user'){var _0x1305ed=_0x47b508[_0x57be('0x29')]({'plain':!![]});var _0x5bd09b=_0x57be('0x2a');return db[_0x57be('0x53')][_0x57be('0x4d')]({'where':{'name':_0x5bd09b,'userProfileId':_0x4774da[_0x57be('0x54')]},'raw':!![]})[_0x57be('0x28')](function(_0x1f0034){if(_0x1f0034&&_0x1f0034[_0x57be('0x55')]===0x0){return db[_0x57be('0x56')][_0x57be('0x4e')]({'name':_0x1305ed[_0x57be('0x2e')],'resourceId':_0x1305ed['id'],'type':_0x1f0034[_0x57be('0x2e')],'sectionId':_0x1f0034['id']},{})['then'](function(){return _0x47b508;});}else{return _0x47b508;}})[_0x57be('0x48')](function(_0x5dfd46){logger[_0x57be('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dfd46);throw _0x5dfd46;});}return _0x47b508;})['then'](respondWithResult(_0x574dae,0xc9))[_0x57be('0x48')](handleError(_0x574dae,null));};exports[_0x57be('0x27')]=function(_0x45f433,_0x6765f6){if(_0x45f433['body']['id']){delete _0x45f433['body']['id'];}return db[_0x57be('0x31')][_0x57be('0x4d')]({'where':{'id':_0x45f433[_0x57be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6765f6,null))[_0x57be('0x28')](saveUpdates(_0x45f433['body'],null))['then'](respondWithResult(_0x6765f6,null))['catch'](handleError(_0x6765f6,null));};exports[_0x57be('0x2b')]=function(_0x37b1a4,_0x53aec0){return db[_0x57be('0x31')][_0x57be('0x4d')]({'where':{'id':_0x37b1a4[_0x57be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53aec0,null))[_0x57be('0x28')](removeEntity(_0x53aec0,null))[_0x57be('0x48')](handleError(_0x53aec0,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b4ecfdb..33deba2 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 _0x902f=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','Template'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x902f,0x197));var _0xf902=function(_0x8f79e4,_0x30c5d6){_0x8f79e4=_0x8f79e4-0x0;var _0x59ecb0=_0x902f[_0x8f79e4];return _0x59ecb0;};'use strict';var _=require(_0xf902('0x0'));var util=require(_0xf902('0x1'));var logger=require(_0xf902('0x2'))(_0xf902('0x3'));var moment=require(_0xf902('0x4'));var BPromise=require(_0xf902('0x5'));var rp=require(_0xf902('0x6'));var fs=require('fs');var path=require(_0xf902('0x7'));var rimraf=require(_0xf902('0x8'));var config=require('../../config/environment');var attributes=require(_0xf902('0x9'));module[_0xf902('0xa')]=function(_0x1e5c59,_0x4f7914){return _0x1e5c59[_0xf902('0xb')](_0xf902('0xc'),attributes,{'tableName':_0xf902('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x846c=['moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','Template','lodash','../../config/logger'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0x846c,0x15c));var _0xc846=function(_0x2f8ba0,_0x161473){_0x2f8ba0=_0x2f8ba0-0x0;var _0x548c23=_0x846c[_0x2f8ba0];return _0x548c23;};'use strict';var _=require(_0xc846('0x0'));var util=require('util');var logger=require(_0xc846('0x1'))('api');var moment=require(_0xc846('0x2'));var BPromise=require(_0xc846('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc846('0x4'));var rimraf=require(_0xc846('0x5'));var config=require(_0xc846('0x6'));var attributes=require(_0xc846('0x7'));module[_0xc846('0x8')]=function(_0x4a60f2,_0x4e32e9){return _0x4a60f2['define'](_0xc846('0x9'),attributes,{'tableName':'tools_templates','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 ae7ffbe..5fd0689 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 _0x5d87=['Template,\x20%s,\x20%s','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code'];(function(_0x55d6be,_0x5719b3){var _0x23e4ee=function(_0x59bb82){while(--_0x59bb82){_0x55d6be['push'](_0x55d6be['shift']());}};_0x23e4ee(++_0x5719b3);}(_0x5d87,0x12e));var _0x75d8=function(_0x4d0555,_0x5ef323){_0x4d0555=_0x4d0555-0x0;var _0x5da0e1=_0x5d87[_0x4d0555];return _0x5da0e1;};'use strict';var _=require(_0x75d8('0x0'));var util=require(_0x75d8('0x1'));var moment=require(_0x75d8('0x2'));var BPromise=require(_0x75d8('0x3'));var rs=require(_0x75d8('0x4'));var fs=require('fs');var Redis=require(_0x75d8('0x5'));var db=require(_0x75d8('0x6'))['db'];var utils=require(_0x75d8('0x7'));var logger=require(_0x75d8('0x8'))(_0x75d8('0x9'));var config=require(_0x75d8('0xa'));var jayson=require(_0x75d8('0xb'));var client=jayson[_0x75d8('0xc')][_0x75d8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x550842,_0x2a597e,_0x4bac5d){return new BPromise(function(_0x46e053,_0x3af8c9){return client[_0x75d8('0xe')](_0x550842,_0x4bac5d)[_0x75d8('0xf')](function(_0x3d2777){logger[_0x75d8('0x10')]('Template,\x20%s,\x20%s',_0x2a597e,'request\x20sent');logger[_0x75d8('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x2a597e,_0x75d8('0x12'),JSON[_0x75d8('0x13')](_0x3d2777));if(_0x3d2777[_0x75d8('0x14')]){if(_0x3d2777[_0x75d8('0x14')][_0x75d8('0x15')]===0x1f4){logger[_0x75d8('0x14')](_0x75d8('0x16'),_0x2a597e,_0x3d2777[_0x75d8('0x14')]['message']);return _0x3af8c9(_0x3d2777[_0x75d8('0x14')][_0x75d8('0x17')]);}logger[_0x75d8('0x14')](_0x75d8('0x16'),_0x2a597e,_0x3d2777['error'][_0x75d8('0x17')]);return _0x46e053(_0x3d2777[_0x75d8('0x14')][_0x75d8('0x17')]);}else{logger[_0x75d8('0x10')](_0x75d8('0x16'),_0x2a597e,_0x75d8('0x12'));_0x46e053(_0x3d2777[_0x75d8('0x18')][_0x75d8('0x17')]);}})[_0x75d8('0x19')](function(_0x55e00e){logger[_0x75d8('0x14')]('Template,\x20%s,\x20%s',_0x2a597e,_0x55e00e);_0x3af8c9(_0x55e00e);});});}exports[_0x75d8('0x1a')]=function(_0x2aea99){var _0x45dd4a=this;return new Promise(function(_0x2597d3,_0x2234da){return db['Template'][_0x75d8('0x1b')]({'raw':_0x2aea99[_0x75d8('0x1c')]?_0x2aea99['options'][_0x75d8('0x1d')]===undefined?!![]:![]:!![],'where':_0x2aea99[_0x75d8('0x1c')]?_0x2aea99['options'][_0x75d8('0x1e')]||null:null,'attributes':_0x2aea99[_0x75d8('0x1c')]?_0x2aea99[_0x75d8('0x1c')][_0x75d8('0x1f')]||null:null,'limit':_0x2aea99[_0x75d8('0x1c')]?_0x2aea99[_0x75d8('0x1c')][_0x75d8('0x20')]||null:null,'include':_0x2aea99[_0x75d8('0x1c')]?_0x2aea99[_0x75d8('0x1c')][_0x75d8('0x21')]?_['map'](_0x2aea99[_0x75d8('0x1c')]['include'],function(_0x4e6361){return{'model':db[_0x4e6361[_0x75d8('0x22')]],'as':_0x4e6361['as'],'attributes':_0x4e6361[_0x75d8('0x1f')],'include':_0x4e6361[_0x75d8('0x21')]?_['map'](_0x4e6361['include'],function(_0x315449){return{'model':db[_0x315449[_0x75d8('0x22')]],'as':_0x315449['as'],'attributes':_0x315449[_0x75d8('0x1f')],'include':_0x315449[_0x75d8('0x21')]?_[_0x75d8('0x23')](_0x315449[_0x75d8('0x21')],function(_0x179613){return{'model':db[_0x179613[_0x75d8('0x22')]],'as':_0x179613['as'],'attributes':_0x179613['attributes']};}):[]};}):[]};}):[]:[]})[_0x75d8('0xf')](function(_0x2f4239){logger[_0x75d8('0x10')](_0x75d8('0x1a'),_0x2aea99);logger[_0x75d8('0x11')](_0x75d8('0x1a'),_0x2aea99,JSON[_0x75d8('0x13')](_0x2f4239));_0x2597d3(_0x2f4239);})[_0x75d8('0x19')](function(_0x232acb){logger[_0x75d8('0x14')](_0x75d8('0x1a'),_0x232acb[_0x75d8('0x17')],_0x2aea99);_0x2234da(_0x45dd4a[_0x75d8('0x14')](0x1f4,_0x232acb[_0x75d8('0x17')]));});});}; \ No newline at end of file +var _0x0895=['debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','Template','findAll','options','where','limit','include','attributes','map','model','info','GetTemplate','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Template,\x20%s,\x20%s'];(function(_0x12aa7c,_0x4e4eb0){var _0x447ef0=function(_0x52bb24){while(--_0x52bb24){_0x12aa7c['push'](_0x12aa7c['shift']());}};_0x447ef0(++_0x4e4eb0);}(_0x0895,0x1a0));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require(_0x5089('0x1'));var moment=require('moment');var BPromise=require(_0x5089('0x2'));var rs=require(_0x5089('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5089('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5089('0x5'))(_0x5089('0x6'));var config=require(_0x5089('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5089('0x8')][_0x5089('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x214fe9,_0x389fa5,_0x17f23f){return new BPromise(function(_0x1a0578,_0x2aafd8){return client[_0x5089('0xa')](_0x214fe9,_0x17f23f)[_0x5089('0xb')](function(_0x264836){logger['info'](_0x5089('0xc'),_0x389fa5,'request\x20sent');logger[_0x5089('0xd')](_0x5089('0xe'),_0x389fa5,_0x5089('0xf'),JSON[_0x5089('0x10')](_0x264836));if(_0x264836[_0x5089('0x11')]){if(_0x264836[_0x5089('0x11')][_0x5089('0x12')]===0x1f4){logger[_0x5089('0x11')](_0x5089('0xc'),_0x389fa5,_0x264836['error'][_0x5089('0x13')]);return _0x2aafd8(_0x264836['error'][_0x5089('0x13')]);}logger[_0x5089('0x11')](_0x5089('0xc'),_0x389fa5,_0x264836[_0x5089('0x11')][_0x5089('0x13')]);return _0x1a0578(_0x264836[_0x5089('0x11')][_0x5089('0x13')]);}else{logger['info'](_0x5089('0xc'),_0x389fa5,_0x5089('0xf'));_0x1a0578(_0x264836[_0x5089('0x14')][_0x5089('0x13')]);}})['catch'](function(_0x3365cb){logger['error'](_0x5089('0xc'),_0x389fa5,_0x3365cb);_0x2aafd8(_0x3365cb);});});}exports['GetTemplate']=function(_0x56c3e9){var _0x5c4e7f=this;return new Promise(function(_0x508ba4,_0x10ab40){return db[_0x5089('0x15')][_0x5089('0x16')]({'raw':_0x56c3e9[_0x5089('0x17')]?_0x56c3e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x56c3e9[_0x5089('0x17')]?_0x56c3e9[_0x5089('0x17')][_0x5089('0x18')]||null:null,'attributes':_0x56c3e9['options']?_0x56c3e9[_0x5089('0x17')]['attributes']||null:null,'limit':_0x56c3e9['options']?_0x56c3e9[_0x5089('0x17')][_0x5089('0x19')]||null:null,'include':_0x56c3e9[_0x5089('0x17')]?_0x56c3e9[_0x5089('0x17')][_0x5089('0x1a')]?_['map'](_0x56c3e9[_0x5089('0x17')][_0x5089('0x1a')],function(_0x428ac5){return{'model':db[_0x428ac5['model']],'as':_0x428ac5['as'],'attributes':_0x428ac5[_0x5089('0x1b')],'include':_0x428ac5[_0x5089('0x1a')]?_[_0x5089('0x1c')](_0x428ac5[_0x5089('0x1a')],function(_0x18f25f){return{'model':db[_0x18f25f[_0x5089('0x1d')]],'as':_0x18f25f['as'],'attributes':_0x18f25f[_0x5089('0x1b')],'include':_0x18f25f['include']?_[_0x5089('0x1c')](_0x18f25f[_0x5089('0x1a')],function(_0x2409a3){return{'model':db[_0x2409a3[_0x5089('0x1d')]],'as':_0x2409a3['as'],'attributes':_0x2409a3[_0x5089('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5089('0xb')](function(_0x222c5e){logger[_0x5089('0x1e')]('GetTemplate',_0x56c3e9);logger[_0x5089('0xd')](_0x5089('0x1f'),_0x56c3e9,JSON[_0x5089('0x10')](_0x222c5e));_0x508ba4(_0x222c5e);})[_0x5089('0x20')](function(_0x6a746c){logger['error']('GetTemplate',_0x6a746c[_0x5089('0x13')],_0x56c3e9);_0x10ab40(_0x5c4e7f[_0x5089('0x11')](0x1f4,_0x6a746c[_0x5089('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7f73056..8a61ab2 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 _0xa49b=['../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','/:id/all_conditions','addAnyCondition','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0xbe0d54,_0x5c3362){var _0x13e619=function(_0xfa3e7f){while(--_0xfa3e7f){_0xbe0d54['push'](_0xbe0d54['shift']());}};_0x13e619(++_0x5c3362);}(_0xa49b,0x126));var _0xba49=function(_0x44bb08,_0xe5930b){_0x44bb08=_0x44bb08-0x0;var _0x55268b=_0xa49b[_0x44bb08];return _0x55268b;};'use strict';var multer=require('multer');var util=require(_0xba49('0x0'));var path=require(_0xba49('0x1'));var timeout=require(_0xba49('0x2'));var express=require(_0xba49('0x3'));var router=express['Router']();var fs_extra=require(_0xba49('0x4'));var auth=require(_0xba49('0x5'));var interaction=require(_0xba49('0x6'));var config=require('../../config/environment');var controller=require(_0xba49('0x7'));router[_0xba49('0x8')]('/',auth[_0xba49('0x9')](),controller['index']);router[_0xba49('0x8')]('/:id',auth[_0xba49('0x9')](),controller[_0xba49('0xa')]);router[_0xba49('0x8')]('/:id/all_conditions',auth[_0xba49('0x9')](),controller[_0xba49('0xb')]);router[_0xba49('0x8')](_0xba49('0xc'),auth['isAuthenticated'](),controller[_0xba49('0xd')]);router[_0xba49('0x8')](_0xba49('0xe'),auth['isAuthenticated'](),controller['getActions']);router[_0xba49('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xba49('0x10'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xba49('0xf')](_0xba49('0xc'),auth[_0xba49('0x9')](),controller[_0xba49('0x11')]);router['post'](_0xba49('0xe'),auth[_0xba49('0x9')](),controller['addAction']);router['put'](_0xba49('0x12'),auth[_0xba49('0x9')](),controller[_0xba49('0x13')]);router[_0xba49('0x14')]('/:id',auth[_0xba49('0x9')](),controller[_0xba49('0x15')]);module[_0xba49('0x16')]=router; \ No newline at end of file +var _0x1f81=['put','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction'];(function(_0x2f592a,_0x2b0a2a){var _0x700052=function(_0x48be0f){while(--_0x48be0f){_0x2f592a['push'](_0x2f592a['shift']());}};_0x700052(++_0x2b0a2a);}(_0x1f81,0xab));var _0x11f8=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x1f81[_0x15b399];return _0x199f2d;};'use strict';var multer=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var path=require('path');var timeout=require(_0x11f8('0x2'));var express=require(_0x11f8('0x3'));var router=express['Router']();var fs_extra=require(_0x11f8('0x4'));var auth=require(_0x11f8('0x5'));var interaction=require(_0x11f8('0x6'));var config=require(_0x11f8('0x7'));var controller=require(_0x11f8('0x8'));router[_0x11f8('0x9')]('/',auth[_0x11f8('0xa')](),controller[_0x11f8('0xb')]);router['get'](_0x11f8('0xc'),auth[_0x11f8('0xa')](),controller[_0x11f8('0xd')]);router[_0x11f8('0x9')](_0x11f8('0xe'),auth[_0x11f8('0xa')](),controller[_0x11f8('0xf')]);router[_0x11f8('0x9')](_0x11f8('0x10'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x11')]);router['get'](_0x11f8('0x12'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x13')]);router[_0x11f8('0x14')]('/',auth[_0x11f8('0xa')](),controller[_0x11f8('0x15')]);router['post'](_0x11f8('0xe'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x16')]);router['post'](_0x11f8('0x10'),auth[_0x11f8('0xa')](),controller[_0x11f8('0x17')]);router[_0x11f8('0x14')]('/:id/actions',auth[_0x11f8('0xa')](),controller[_0x11f8('0x18')]);router[_0x11f8('0x19')](_0x11f8('0xc'),auth[_0x11f8('0xa')](),controller['update']);router[_0x11f8('0x1a')](_0x11f8('0xc'),auth['isAuthenticated'](),controller[_0x11f8('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 66b902a..139d2f2 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 _0xc331=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2df5d3,_0x4336a7){var _0x4a6050=function(_0x33d952){while(--_0x33d952){_0x2df5d3['push'](_0x2df5d3['shift']());}};_0x4a6050(++_0x4336a7);}(_0xc331,0x18b));var _0x1c33=function(_0x29aebc,_0x54bb9e){_0x29aebc=_0x29aebc-0x0;var _0x1528d6=_0xc331[_0x29aebc];return _0x1528d6;};'use strict';var Sequelize=require(_0x1c33('0x0'));module[_0x1c33('0x1')]={'name':{'type':Sequelize[_0x1c33('0x2')]},'channel':{'type':Sequelize[_0x1c33('0x2')]},'description':{'type':Sequelize[_0x1c33('0x2')]},'status':{'type':Sequelize[_0x1c33('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc208=['BOOLEAN','exports','STRING'];(function(_0xc28fe6,_0x44bae7){var _0x114395=function(_0xc3ab84){while(--_0xc3ab84){_0xc28fe6['push'](_0xc28fe6['shift']());}};_0x114395(++_0x44bae7);}(_0xc208,0x148));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x8c20('0x0')]={'name':{'type':Sequelize[_0x8c20('0x1')]},'channel':{'type':Sequelize[_0x8c20('0x1')]},'description':{'type':Sequelize[_0x8c20('0x1')]},'status':{'type':Sequelize[_0x8c20('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 037a0af..5edbfcc 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 _0x8899=['end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Trigger','catch','show','params','intersection','includeAll','include','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x233afe,_0x541c51){var _0x339a10=function(_0x4b0897){while(--_0x4b0897){_0x233afe['push'](_0x233afe['shift']());}};_0x339a10(++_0x541c51);}(_0x8899,0x163));var _0x9889=function(_0x372aec,_0x142987){_0x372aec=_0x372aec-0x0;var _0x15cb5f=_0x8899[_0x372aec];return _0x15cb5f;};'use strict';var emlformat=require(_0x9889('0x0'));var rimraf=require(_0x9889('0x1'));var zipdir=require(_0x9889('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9889('0x3'));var BPromise=require(_0x9889('0x4'));var Mustache=require(_0x9889('0x5'));var util=require(_0x9889('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9889('0x7'));var ejs=require(_0x9889('0x8'));var fs=require('fs');var fs_extra=require(_0x9889('0x9'));var _=require(_0x9889('0xa'));var squel=require(_0x9889('0xb'));var crypto=require(_0x9889('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9889('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9889('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9889('0xf'));var qs=require(_0x9889('0x10'));var as=require(_0x9889('0x11'));var hardwareService=require(_0x9889('0x12'));var logger=require(_0x9889('0x13'))(_0x9889('0x14'));var utils=require('../../config/utils');var config=require(_0x9889('0x15'));var licenseUtil=require(_0x9889('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbac9f,_0x382b9a){_0x382b9a=_0x382b9a||0xcc;return function(_0x59e226){if(_0x59e226){return _0xbac9f[_0x9889('0x17')](_0x382b9a);}return _0xbac9f[_0x9889('0x18')](_0x382b9a)[_0x9889('0x19')]();};}function respondWithResult(_0x586c8b,_0x1cc7e7){_0x1cc7e7=_0x1cc7e7||0xc8;return function(_0x458ccd){if(_0x458ccd){return _0x586c8b['status'](_0x1cc7e7)['json'](_0x458ccd);}};}function respondWithFilteredResult(_0x397a44,_0x176e71){return function(_0x3ecbee){if(_0x3ecbee){var _0x38932d=typeof _0x176e71[_0x9889('0x1a')]===_0x9889('0x1b')&&typeof _0x176e71[_0x9889('0x1c')]==='undefined';var _0x3d98db=_0x3ecbee[_0x9889('0x1d')];var _0x501b5c=_0x38932d?0x0:_0x176e71[_0x9889('0x1a')];var _0x5e3ad7=_0x38932d?_0x3ecbee[_0x9889('0x1d')]:_0x176e71['offset']+_0x176e71[_0x9889('0x1c')];var _0x267b95;if(_0x5e3ad7>=_0x3d98db){_0x5e3ad7=_0x3d98db;_0x267b95=0xc8;}else{_0x267b95=0xce;}_0x397a44[_0x9889('0x18')](_0x267b95);return _0x397a44[_0x9889('0x1e')](_0x9889('0x1f'),_0x501b5c+'-'+_0x5e3ad7+'/'+_0x3d98db)[_0x9889('0x20')](_0x3ecbee);}return null;};}function patchUpdates(_0x27364a){return function(_0x1464cd){try{jsonpatch[_0x9889('0x21')](_0x1464cd,_0x27364a,!![]);}catch(_0x2be8f4){return BPromise[_0x9889('0x22')](_0x2be8f4);}return _0x1464cd[_0x9889('0x23')]();};}function saveUpdates(_0xd9d8c0,_0x452fed){return function(_0x5c7f5e){if(_0x5c7f5e){return _0x5c7f5e[_0x9889('0x24')](_0xd9d8c0)['then'](function(_0x3d5b5c){return _0x3d5b5c;});}return null;};}function removeEntity(_0x26ad74,_0x29bcc9){return function(_0x17ae17){if(_0x17ae17){return _0x17ae17[_0x9889('0x25')]()[_0x9889('0x26')](function(){var _0x4375d6=_0x17ae17['get']({'plain':!![]});var _0xb2ca3a=_0x9889('0x27');return db[_0x9889('0x28')][_0x9889('0x25')]({'where':{'type':_0xb2ca3a,'resourceId':_0x4375d6['id']}})['then'](function(){return _0x17ae17;});})[_0x9889('0x26')](function(){_0x26ad74[_0x9889('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46f5c3,_0x20493e){return function(_0xa5a389){if(!_0xa5a389){_0x46f5c3[_0x9889('0x17')](0x194);}return _0xa5a389;};}function handleError(_0x4d219e,_0x508ad6){_0x508ad6=_0x508ad6||0x1f4;return function(_0xc8efdd){logger[_0x9889('0x29')](_0xc8efdd[_0x9889('0x2a')]);if(_0xc8efdd[_0x9889('0x2b')]){delete _0xc8efdd['name'];}_0x4d219e[_0x9889('0x18')](_0x508ad6)[_0x9889('0x2c')](_0xc8efdd);};}exports[_0x9889('0x2d')]=function(_0x60d720,_0x1eaf42){var _0x72f236={},_0x134df9={},_0x52bc2b={'count':0x0,'rows':[]};var _0x377be7=_[_0x9889('0x2e')](db['Trigger'][_0x9889('0x2f')],function(_0x51d731){return{'name':_0x51d731[_0x9889('0x30')],'type':_0x51d731[_0x9889('0x31')][_0x9889('0x32')]};});_0x134df9[_0x9889('0x33')]=_[_0x9889('0x2e')](_0x377be7,'name');_0x134df9[_0x9889('0x34')]=_[_0x9889('0x35')](_0x60d720['query']);_0x134df9[_0x9889('0x36')]=_['intersection'](_0x134df9[_0x9889('0x33')],_0x134df9[_0x9889('0x34')]);_0x72f236[_0x9889('0x37')]=_['intersection'](_0x134df9['model'],qs[_0x9889('0x38')](_0x60d720[_0x9889('0x34')]['fields']));_0x72f236[_0x9889('0x37')]=_0x72f236['attributes'][_0x9889('0x39')]?_0x72f236[_0x9889('0x37')]:_0x134df9[_0x9889('0x33')];if(!_0x60d720[_0x9889('0x34')]['hasOwnProperty'](_0x9889('0x3a'))){_0x72f236[_0x9889('0x1c')]=qs['limit'](_0x60d720[_0x9889('0x34')][_0x9889('0x1c')]);_0x72f236['offset']=qs[_0x9889('0x1a')](_0x60d720[_0x9889('0x34')][_0x9889('0x1a')]);}_0x72f236[_0x9889('0x3b')]=qs[_0x9889('0x3c')](_0x60d720['query'][_0x9889('0x3c')]);_0x72f236[_0x9889('0x3d')]=qs[_0x9889('0x36')](_[_0x9889('0x3e')](_0x60d720[_0x9889('0x34')],_0x134df9[_0x9889('0x36')]),_0x377be7);if(_0x60d720[_0x9889('0x34')]['filter']){_0x72f236['where']=_[_0x9889('0x3f')](_0x72f236[_0x9889('0x3d')],{'$or':_['map'](_0x377be7,function(_0x43f5ee){if(_0x43f5ee[_0x9889('0x31')]!==_0x9889('0x40')){var _0x44e9dc={};_0x44e9dc[_0x43f5ee[_0x9889('0x2b')]]={'$like':'%'+_0x60d720[_0x9889('0x34')][_0x9889('0x41')]+'%'};return _0x44e9dc;}})});}_0x72f236=_[_0x9889('0x3f')]({},_0x72f236,_0x60d720[_0x9889('0x42')]);var _0x17fe98={'where':_0x72f236['where']};return db['Trigger'][_0x9889('0x1d')](_0x17fe98)[_0x9889('0x26')](function(_0x479883){_0x52bc2b[_0x9889('0x1d')]=_0x479883;if(_0x60d720['query']['includeAll']){_0x72f236['include']=[{'all':!![]}];}return db[_0x9889('0x43')]['findAll'](_0x72f236);})[_0x9889('0x26')](function(_0xd49d69){_0x52bc2b['rows']=_0xd49d69;return _0x52bc2b;})[_0x9889('0x26')](respondWithFilteredResult(_0x1eaf42,_0x72f236))[_0x9889('0x44')](handleError(_0x1eaf42,null));};exports[_0x9889('0x45')]=function(_0x2ff92c,_0x5f4263){var _0x87a2fc={'raw':![],'where':{'id':_0x2ff92c[_0x9889('0x46')]['id']}},_0x654577={};_0x654577[_0x9889('0x33')]=_['keys'](db[_0x9889('0x43')]['rawAttributes']);_0x654577['query']=_[_0x9889('0x35')](_0x2ff92c[_0x9889('0x34')]);_0x654577[_0x9889('0x36')]=_[_0x9889('0x47')](_0x654577[_0x9889('0x33')],_0x654577['query']);_0x87a2fc['attributes']=_[_0x9889('0x47')](_0x654577['model'],qs[_0x9889('0x38')](_0x2ff92c['query'][_0x9889('0x38')]));_0x87a2fc[_0x9889('0x37')]=_0x87a2fc[_0x9889('0x37')][_0x9889('0x39')]?_0x87a2fc['attributes']:_0x654577[_0x9889('0x33')];if(_0x2ff92c[_0x9889('0x34')][_0x9889('0x48')]){_0x87a2fc[_0x9889('0x49')]=[{'all':!![]}];}_0x87a2fc=_[_0x9889('0x3f')]({},_0x87a2fc,_0x2ff92c['options']);return db[_0x9889('0x43')][_0x9889('0x4a')](_0x87a2fc)[_0x9889('0x26')](handleEntityNotFound(_0x5f4263,null))[_0x9889('0x26')](respondWithResult(_0x5f4263,null))[_0x9889('0x44')](handleError(_0x5f4263,null));};exports[_0x9889('0x4b')]=function(_0x3a5f8b,_0x5c8a48){return db['Trigger'][_0x9889('0x4b')](_0x3a5f8b[_0x9889('0x4c')],{})[_0x9889('0x26')](function(_0x8936e){var _0x3cb31e=_0x3a5f8b['user']['get']({'plain':!![]});if(!_0x3cb31e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cb31e[_0x9889('0x4d')]===_0x9889('0x4e')){var _0x200329=_0x8936e[_0x9889('0x4f')]({'plain':!![]});var _0x321f54=_0x9889('0x27');return db[_0x9889('0x50')]['find']({'where':{'name':_0x321f54,'userProfileId':_0x3cb31e[_0x9889('0x51')]},'raw':!![]})[_0x9889('0x26')](function(_0x227246){if(_0x227246&&_0x227246[_0x9889('0x52')]===0x0){return db['UserProfileResource'][_0x9889('0x4b')]({'name':_0x200329[_0x9889('0x2b')],'resourceId':_0x200329['id'],'type':_0x227246[_0x9889('0x2b')],'sectionId':_0x227246['id']},{})[_0x9889('0x26')](function(){return _0x8936e;});}else{return _0x8936e;}})[_0x9889('0x44')](function(_0x1cdc49){logger[_0x9889('0x29')](_0x9889('0x53'),_0x1cdc49);throw _0x1cdc49;});}return _0x8936e;})[_0x9889('0x26')](respondWithResult(_0x5c8a48,0xc9))[_0x9889('0x44')](handleError(_0x5c8a48,null));};exports['update']=function(_0x4c3418,_0x2081a8){if(_0x4c3418[_0x9889('0x4c')]['id']){delete _0x4c3418[_0x9889('0x4c')]['id'];}return db[_0x9889('0x43')][_0x9889('0x4a')]({'where':{'id':_0x4c3418[_0x9889('0x46')]['id']}})['then'](handleEntityNotFound(_0x2081a8,null))['then'](saveUpdates(_0x4c3418[_0x9889('0x4c')],null))['then'](respondWithResult(_0x2081a8,null))[_0x9889('0x44')](handleError(_0x2081a8,null));};exports['destroy']=function(_0x23e928,_0x324dfc){return db[_0x9889('0x43')][_0x9889('0x4a')]({'where':{'id':_0x23e928[_0x9889('0x46')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x324dfc,null))['then'](removeEntity(_0x324dfc,null))[_0x9889('0x44')](handleError(_0x324dfc,null));};exports[_0x9889('0x54')]=function(_0x55cedf,_0x241817,_0x536bfa){if(_0x55cedf[_0x9889('0x4c')]['id']){delete _0x55cedf['body']['id'];}return db[_0x9889('0x43')][_0x9889('0x4a')]({'where':{'id':_0x55cedf['params']['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x241817,null))[_0x9889('0x26')](function(_0x5d5e85){if(_0x5d5e85){_0x55cedf[_0x9889('0x4c')]['TriggerAllId']=_0x5d5e85['id'];return db[_0x9889('0x55')]['create'](_0x55cedf[_0x9889('0x4c')]);}})['then'](respondWithResult(_0x241817,null))['catch'](handleError(_0x241817,null));};exports[_0x9889('0x56')]=function(_0x42f300,_0x353b29,_0x11af91){if(_0x42f300[_0x9889('0x4c')]['id']){delete _0x42f300[_0x9889('0x4c')]['id'];}return db[_0x9889('0x43')]['find']({'where':{'id':_0x42f300['params']['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x353b29,null))['then'](function(_0x183919){if(_0x183919){_0x42f300[_0x9889('0x4c')][_0x9889('0x57')]=_0x183919['id'];return db['Condition'][_0x9889('0x4b')](_0x42f300[_0x9889('0x4c')]);}})[_0x9889('0x26')](respondWithResult(_0x353b29,null))[_0x9889('0x44')](handleError(_0x353b29,null));};exports[_0x9889('0x58')]=function(_0x420b47,_0x1c109d,_0x555660){var _0x1d2015={};var _0x29e376={};var _0x382a34;var _0x3feba2;return db['Trigger'][_0x9889('0x59')]({'where':{'id':_0x420b47[_0x9889('0x46')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x1c109d,null))[_0x9889('0x26')](function(_0x3f5b10){if(_0x3f5b10){_0x382a34=_0x3f5b10;_0x29e376[_0x9889('0x33')]=_['keys'](db['Condition']['rawAttributes']);_0x29e376[_0x9889('0x34')]=_[_0x9889('0x35')](_0x420b47[_0x9889('0x34')]);_0x29e376[_0x9889('0x36')]=_['intersection'](_0x29e376[_0x9889('0x33')],_0x29e376[_0x9889('0x34')]);_0x1d2015[_0x9889('0x37')]=_[_0x9889('0x47')](_0x29e376[_0x9889('0x33')],qs[_0x9889('0x38')](_0x420b47[_0x9889('0x34')][_0x9889('0x38')]));_0x1d2015[_0x9889('0x37')]=_0x1d2015[_0x9889('0x37')][_0x9889('0x39')]?_0x1d2015[_0x9889('0x37')]:_0x29e376[_0x9889('0x33')];_0x1d2015[_0x9889('0x3b')]=qs[_0x9889('0x3c')](_0x420b47['query'][_0x9889('0x3c')]);_0x1d2015[_0x9889('0x3d')]=qs['filters'](_['pick'](_0x420b47[_0x9889('0x34')],_0x29e376['filters']));if(_0x420b47[_0x9889('0x34')][_0x9889('0x41')]){_0x1d2015[_0x9889('0x3d')]=_[_0x9889('0x3f')](_0x1d2015[_0x9889('0x3d')],{'$or':_[_0x9889('0x2e')](_0x1d2015[_0x9889('0x37')],function(_0x26f72e){var _0x11a393={};_0x11a393[_0x26f72e]={'$like':'%'+_0x420b47[_0x9889('0x34')][_0x9889('0x41')]+'%'};return _0x11a393;})});}_0x1d2015=_[_0x9889('0x3f')]({},_0x1d2015,_0x420b47[_0x9889('0x42')]);return _0x382a34[_0x9889('0x58')](_0x1d2015);}})[_0x9889('0x26')](function(_0x14da3e){if(_0x14da3e){_0x3feba2=_0x14da3e[_0x9889('0x39')];if(!_0x420b47[_0x9889('0x34')][_0x9889('0x5a')](_0x9889('0x3a'))){_0x1d2015[_0x9889('0x1c')]=qs[_0x9889('0x1c')](_0x420b47[_0x9889('0x34')][_0x9889('0x1c')]);_0x1d2015['offset']=qs[_0x9889('0x1a')](_0x420b47[_0x9889('0x34')]['offset']);}return _0x382a34[_0x9889('0x58')](_0x1d2015);}})['then'](function(_0x1d118b){if(_0x1d118b){return _0x1d118b?{'count':_0x3feba2,'rows':_0x1d118b}:null;}})[_0x9889('0x26')](respondWithResult(_0x1c109d,null))[_0x9889('0x44')](handleError(_0x1c109d,null));};exports['getAnyConditions']=function(_0x489d9e,_0x4f7442,_0x53a120){var _0x2afe32={};var _0x40a123={};var _0xff907;var _0x164a1e;return db['Trigger']['findOne']({'where':{'id':_0x489d9e[_0x9889('0x46')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x4f7442,null))[_0x9889('0x26')](function(_0x52b12d){if(_0x52b12d){_0xff907=_0x52b12d;_0x40a123[_0x9889('0x33')]=_[_0x9889('0x35')](db[_0x9889('0x55')][_0x9889('0x2f')]);_0x40a123['query']=_[_0x9889('0x35')](_0x489d9e[_0x9889('0x34')]);_0x40a123['filters']=_[_0x9889('0x47')](_0x40a123[_0x9889('0x33')],_0x40a123[_0x9889('0x34')]);_0x2afe32[_0x9889('0x37')]=_['intersection'](_0x40a123[_0x9889('0x33')],qs[_0x9889('0x38')](_0x489d9e['query'][_0x9889('0x38')]));_0x2afe32[_0x9889('0x37')]=_0x2afe32[_0x9889('0x37')][_0x9889('0x39')]?_0x2afe32[_0x9889('0x37')]:_0x40a123[_0x9889('0x33')];_0x2afe32[_0x9889('0x3b')]=qs['sort'](_0x489d9e['query']['sort']);_0x2afe32[_0x9889('0x3d')]=qs[_0x9889('0x36')](_[_0x9889('0x3e')](_0x489d9e[_0x9889('0x34')],_0x40a123[_0x9889('0x36')]));if(_0x489d9e[_0x9889('0x34')][_0x9889('0x41')]){_0x2afe32[_0x9889('0x3d')]=_[_0x9889('0x3f')](_0x2afe32[_0x9889('0x3d')],{'$or':_[_0x9889('0x2e')](_0x2afe32['attributes'],function(_0x1a5c97){var _0x47c969={};_0x47c969[_0x1a5c97]={'$like':'%'+_0x489d9e[_0x9889('0x34')][_0x9889('0x41')]+'%'};return _0x47c969;})});}_0x2afe32=_[_0x9889('0x3f')]({},_0x2afe32,_0x489d9e[_0x9889('0x42')]);return _0xff907['getAnyConditions'](_0x2afe32);}})[_0x9889('0x26')](function(_0x6b381e){if(_0x6b381e){_0x164a1e=_0x6b381e[_0x9889('0x39')];if(!_0x489d9e[_0x9889('0x34')][_0x9889('0x5a')]('nolimit')){_0x2afe32[_0x9889('0x1c')]=qs[_0x9889('0x1c')](_0x489d9e[_0x9889('0x34')][_0x9889('0x1c')]);_0x2afe32['offset']=qs[_0x9889('0x1a')](_0x489d9e[_0x9889('0x34')][_0x9889('0x1a')]);}return _0xff907[_0x9889('0x5b')](_0x2afe32);}})[_0x9889('0x26')](function(_0xdf1bf8){if(_0xdf1bf8){return _0xdf1bf8?{'count':_0x164a1e,'rows':_0xdf1bf8}:null;}})[_0x9889('0x26')](respondWithResult(_0x4f7442,null))[_0x9889('0x44')](handleError(_0x4f7442,null));};exports[_0x9889('0x5c')]=function(_0x1e5f09,_0x244fce,_0x28792b){if(_0x1e5f09[_0x9889('0x4c')]['id']){delete _0x1e5f09[_0x9889('0x4c')]['id'];}return db[_0x9889('0x43')][_0x9889('0x4a')]({'where':{'id':_0x1e5f09[_0x9889('0x46')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x244fce,null))[_0x9889('0x26')](function(_0x4b9b80){if(_0x4b9b80){_0x1e5f09['body']['TriggerId']=_0x4b9b80['id'];return db[_0x9889('0x5d')][_0x9889('0x4b')](_0x1e5f09['body']);}})[_0x9889('0x26')](respondWithResult(_0x244fce,null))[_0x9889('0x44')](handleError(_0x244fce,null));};exports['getActions']=function(_0x9dc02e,_0x3c7d01,_0x297425){var _0xa7f4c9={};var _0x406f52={};var _0x18270e;var _0x293f75;return db['Trigger'][_0x9889('0x59')]({'where':{'id':_0x9dc02e[_0x9889('0x46')]['id']}})[_0x9889('0x26')](handleEntityNotFound(_0x3c7d01,null))[_0x9889('0x26')](function(_0x4237c2){if(_0x4237c2){_0x18270e=_0x4237c2;_0x406f52[_0x9889('0x33')]=_['keys'](db['Action'][_0x9889('0x2f')]);_0x406f52[_0x9889('0x34')]=_[_0x9889('0x35')](_0x9dc02e[_0x9889('0x34')]);_0x406f52['filters']=_['intersection'](_0x406f52[_0x9889('0x33')],_0x406f52['query']);_0xa7f4c9[_0x9889('0x37')]=_['intersection'](_0x406f52[_0x9889('0x33')],qs[_0x9889('0x38')](_0x9dc02e['query'][_0x9889('0x38')]));_0xa7f4c9[_0x9889('0x37')]=_0xa7f4c9[_0x9889('0x37')][_0x9889('0x39')]?_0xa7f4c9['attributes']:_0x406f52[_0x9889('0x33')];_0xa7f4c9[_0x9889('0x3b')]=qs[_0x9889('0x3c')](_0x9dc02e[_0x9889('0x34')][_0x9889('0x3c')]);_0xa7f4c9[_0x9889('0x3d')]=qs[_0x9889('0x36')](_[_0x9889('0x3e')](_0x9dc02e[_0x9889('0x34')],_0x406f52[_0x9889('0x36')]));if(_0x9dc02e[_0x9889('0x34')][_0x9889('0x41')]){_0xa7f4c9['where']=_[_0x9889('0x3f')](_0xa7f4c9[_0x9889('0x3d')],{'$or':_[_0x9889('0x2e')](_0xa7f4c9[_0x9889('0x37')],function(_0x6c84ad){var _0x32d0e9={};_0x32d0e9[_0x6c84ad]={'$like':'%'+_0x9dc02e['query']['filter']+'%'};return _0x32d0e9;})});}_0xa7f4c9=_[_0x9889('0x3f')]({},_0xa7f4c9,_0x9dc02e[_0x9889('0x42')]);return _0x18270e[_0x9889('0x5e')](_0xa7f4c9);}})['then'](function(_0x1263d3){if(_0x1263d3){_0x293f75=_0x1263d3[_0x9889('0x39')];if(!_0x9dc02e[_0x9889('0x34')][_0x9889('0x5a')](_0x9889('0x3a'))){_0xa7f4c9['limit']=qs[_0x9889('0x1c')](_0x9dc02e[_0x9889('0x34')]['limit']);_0xa7f4c9['offset']=qs[_0x9889('0x1a')](_0x9dc02e[_0x9889('0x34')][_0x9889('0x1a')]);}return _0x18270e[_0x9889('0x5e')](_0xa7f4c9);}})[_0x9889('0x26')](function(_0x4063f4){if(_0x4063f4){return _0x4063f4?{'count':_0x293f75,'rows':_0x4063f4}:null;}})['then'](respondWithResult(_0x3c7d01,null))[_0x9889('0x44')](handleError(_0x3c7d01,null));}; \ No newline at end of file +var _0x5b5f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','sendStatus','error','name','send','index','Trigger','rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','destroy','TriggerAllId','addAnyCondition','TriggerAnyId','findOne','Condition','getAllConditions','getAnyConditions','TriggerId','getActions','Action','eml-format'];(function(_0xc83008,_0x219543){var _0xc66520=function(_0x557173){while(--_0x557173){_0xc83008['push'](_0xc83008['shift']());}};_0xc66520(++_0x219543);}(_0x5b5f,0x1d0));var _0xf5b5=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x5b5f[_0x2f3794];return _0x1c9fbe;};'use strict';var emlformat=require(_0xf5b5('0x0'));var rimraf=require(_0xf5b5('0x1'));var zipdir=require(_0xf5b5('0x2'));var jsonpatch=require(_0xf5b5('0x3'));var rp=require(_0xf5b5('0x4'));var moment=require(_0xf5b5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf5b5('0x6'));var sox=require(_0xf5b5('0x7'));var csv=require(_0xf5b5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5b5('0x9'));var _=require(_0xf5b5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf5b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf5b5('0x8'));var querystring=require(_0xf5b5('0xc'));var Papa=require(_0xf5b5('0xd'));var Redis=require(_0xf5b5('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf5b5('0xf'));var hardwareService=require(_0xf5b5('0x10'));var logger=require(_0xf5b5('0x11'))(_0xf5b5('0x12'));var utils=require(_0xf5b5('0x13'));var config=require(_0xf5b5('0x14'));var licenseUtil=require(_0xf5b5('0x15'));var db=require(_0xf5b5('0x16'))['db'];function respondWithStatusCode(_0x39339a,_0x420121){_0x420121=_0x420121||0xcc;return function(_0x13ee74){if(_0x13ee74){return _0x39339a['sendStatus'](_0x420121);}return _0x39339a[_0xf5b5('0x17')](_0x420121)[_0xf5b5('0x18')]();};}function respondWithResult(_0x4993a1,_0x595246){_0x595246=_0x595246||0xc8;return function(_0x379c28){if(_0x379c28){return _0x4993a1[_0xf5b5('0x17')](_0x595246)[_0xf5b5('0x19')](_0x379c28);}};}function respondWithFilteredResult(_0x2e0a13,_0x398572){return function(_0x2837dc){if(_0x2837dc){var _0x3e0777=typeof _0x398572[_0xf5b5('0x1a')]===_0xf5b5('0x1b')&&typeof _0x398572[_0xf5b5('0x1c')]==='undefined';var _0x5da3d4=_0x2837dc[_0xf5b5('0x1d')];var _0x169632=_0x3e0777?0x0:_0x398572['offset'];var _0x506143=_0x3e0777?_0x2837dc[_0xf5b5('0x1d')]:_0x398572['offset']+_0x398572['limit'];var _0x3e8e63;if(_0x506143>=_0x5da3d4){_0x506143=_0x5da3d4;_0x3e8e63=0xc8;}else{_0x3e8e63=0xce;}_0x2e0a13[_0xf5b5('0x17')](_0x3e8e63);return _0x2e0a13[_0xf5b5('0x1e')](_0xf5b5('0x1f'),_0x169632+'-'+_0x506143+'/'+_0x5da3d4)[_0xf5b5('0x19')](_0x2837dc);}return null;};}function patchUpdates(_0xae197e){return function(_0x2094c1){try{jsonpatch[_0xf5b5('0x20')](_0x2094c1,_0xae197e,!![]);}catch(_0x4f6c6b){return BPromise['reject'](_0x4f6c6b);}return _0x2094c1[_0xf5b5('0x21')]();};}function saveUpdates(_0x498c40,_0x3091a8){return function(_0x75b6e2){if(_0x75b6e2){return _0x75b6e2[_0xf5b5('0x22')](_0x498c40)['then'](function(_0x55ed87){return _0x55ed87;});}return null;};}function removeEntity(_0x20d6db,_0x5a4a88){return function(_0x32eaec){if(_0x32eaec){return _0x32eaec['destroy']()[_0xf5b5('0x23')](function(){var _0x716dbf=_0x32eaec[_0xf5b5('0x24')]({'plain':!![]});var _0xf33376='Triggers';return db[_0xf5b5('0x25')]['destroy']({'where':{'type':_0xf33376,'resourceId':_0x716dbf['id']}})['then'](function(){return _0x32eaec;});})[_0xf5b5('0x23')](function(){_0x20d6db[_0xf5b5('0x17')](0xcc)[_0xf5b5('0x18')]();});}};}function handleEntityNotFound(_0xa1703f,_0x521560){return function(_0x56363a){if(!_0x56363a){_0xa1703f[_0xf5b5('0x26')](0x194);}return _0x56363a;};}function handleError(_0x2259ce,_0x11d2e8){_0x11d2e8=_0x11d2e8||0x1f4;return function(_0x4e2074){logger[_0xf5b5('0x27')](_0x4e2074['stack']);if(_0x4e2074[_0xf5b5('0x28')]){delete _0x4e2074[_0xf5b5('0x28')];}_0x2259ce[_0xf5b5('0x17')](_0x11d2e8)[_0xf5b5('0x29')](_0x4e2074);};}exports[_0xf5b5('0x2a')]=function(_0x24fd34,_0x4c432a){var _0x44c880={},_0x4b198e={},_0x117ee1={'count':0x0,'rows':[]};var _0x44764a=_['map'](db[_0xf5b5('0x2b')][_0xf5b5('0x2c')],function(_0x50ab4b){return{'name':_0x50ab4b[_0xf5b5('0x2d')],'type':_0x50ab4b[_0xf5b5('0x2e')]['key']};});_0x4b198e[_0xf5b5('0x2f')]=_[_0xf5b5('0x30')](_0x44764a,_0xf5b5('0x28'));_0x4b198e['query']=_[_0xf5b5('0x31')](_0x24fd34['query']);_0x4b198e[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x4b198e['model'],_0x4b198e[_0xf5b5('0x34')]);_0x44c880[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x4b198e['model'],qs[_0xf5b5('0x36')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x36')]));_0x44c880[_0xf5b5('0x35')]=_0x44c880[_0xf5b5('0x35')][_0xf5b5('0x37')]?_0x44c880[_0xf5b5('0x35')]:_0x4b198e['model'];if(!_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x38')](_0xf5b5('0x39'))){_0x44c880['limit']=qs[_0xf5b5('0x1c')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x1c')]);_0x44c880[_0xf5b5('0x1a')]=qs[_0xf5b5('0x1a')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x1a')]);}_0x44c880[_0xf5b5('0x3a')]=qs[_0xf5b5('0x3b')](_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x3b')]);_0x44c880[_0xf5b5('0x3c')]=qs[_0xf5b5('0x32')](_[_0xf5b5('0x3d')](_0x24fd34[_0xf5b5('0x34')],_0x4b198e[_0xf5b5('0x32')]),_0x44764a);if(_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x3e')]){_0x44c880[_0xf5b5('0x3c')]=_[_0xf5b5('0x3f')](_0x44c880[_0xf5b5('0x3c')],{'$or':_['map'](_0x44764a,function(_0x185270){if(_0x185270[_0xf5b5('0x2e')]!==_0xf5b5('0x40')){var _0x51fa50={};_0x51fa50[_0x185270[_0xf5b5('0x28')]]={'$like':'%'+_0x24fd34['query'][_0xf5b5('0x3e')]+'%'};return _0x51fa50;}})});}_0x44c880=_['merge']({},_0x44c880,_0x24fd34[_0xf5b5('0x41')]);var _0x4690f4={'where':_0x44c880['where']};return db[_0xf5b5('0x2b')][_0xf5b5('0x1d')](_0x4690f4)[_0xf5b5('0x23')](function(_0x3b397a){_0x117ee1[_0xf5b5('0x1d')]=_0x3b397a;if(_0x24fd34[_0xf5b5('0x34')][_0xf5b5('0x42')]){_0x44c880['include']=[{'all':!![]}];}return db[_0xf5b5('0x2b')][_0xf5b5('0x43')](_0x44c880);})[_0xf5b5('0x23')](function(_0x17439c){_0x117ee1['rows']=_0x17439c;return _0x117ee1;})[_0xf5b5('0x23')](respondWithFilteredResult(_0x4c432a,_0x44c880))['catch'](handleError(_0x4c432a,null));};exports[_0xf5b5('0x44')]=function(_0x12d88a,_0x5b9b1a){var _0x58855f={'raw':![],'where':{'id':_0x12d88a[_0xf5b5('0x45')]['id']}},_0x49fa25={};_0x49fa25[_0xf5b5('0x2f')]=_[_0xf5b5('0x31')](db[_0xf5b5('0x2b')][_0xf5b5('0x2c')]);_0x49fa25[_0xf5b5('0x34')]=_[_0xf5b5('0x31')](_0x12d88a['query']);_0x49fa25['filters']=_[_0xf5b5('0x33')](_0x49fa25[_0xf5b5('0x2f')],_0x49fa25[_0xf5b5('0x34')]);_0x58855f[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x49fa25['model'],qs[_0xf5b5('0x36')](_0x12d88a['query']['fields']));_0x58855f[_0xf5b5('0x35')]=_0x58855f['attributes'][_0xf5b5('0x37')]?_0x58855f[_0xf5b5('0x35')]:_0x49fa25[_0xf5b5('0x2f')];if(_0x12d88a[_0xf5b5('0x34')]['includeAll']){_0x58855f[_0xf5b5('0x46')]=[{'all':!![]}];}_0x58855f=_[_0xf5b5('0x3f')]({},_0x58855f,_0x12d88a[_0xf5b5('0x41')]);return db[_0xf5b5('0x2b')][_0xf5b5('0x47')](_0x58855f)[_0xf5b5('0x23')](handleEntityNotFound(_0x5b9b1a,null))['then'](respondWithResult(_0x5b9b1a,null))['catch'](handleError(_0x5b9b1a,null));};exports[_0xf5b5('0x48')]=function(_0x44801f,_0x230806){return db['Trigger']['create'](_0x44801f[_0xf5b5('0x49')],{})['then'](function(_0xafa133){var _0xaad21e=_0x44801f[_0xf5b5('0x4a')][_0xf5b5('0x24')]({'plain':!![]});if(!_0xaad21e)throw new Error(_0xf5b5('0x4b'));if(_0xaad21e[_0xf5b5('0x4c')]===_0xf5b5('0x4a')){var _0x2fd9f6=_0xafa133[_0xf5b5('0x24')]({'plain':!![]});var _0x5b756c='Triggers';return db[_0xf5b5('0x4d')][_0xf5b5('0x47')]({'where':{'name':_0x5b756c,'userProfileId':_0xaad21e[_0xf5b5('0x4e')]},'raw':!![]})['then'](function(_0x483560){if(_0x483560&&_0x483560[_0xf5b5('0x4f')]===0x0){return db['UserProfileResource'][_0xf5b5('0x48')]({'name':_0x2fd9f6['name'],'resourceId':_0x2fd9f6['id'],'type':_0x483560[_0xf5b5('0x28')],'sectionId':_0x483560['id']},{})[_0xf5b5('0x23')](function(){return _0xafa133;});}else{return _0xafa133;}})['catch'](function(_0x2b892e){logger[_0xf5b5('0x27')](_0xf5b5('0x50'),_0x2b892e);throw _0x2b892e;});}return _0xafa133;})[_0xf5b5('0x23')](respondWithResult(_0x230806,0xc9))['catch'](handleError(_0x230806,null));};exports['update']=function(_0x2be69b,_0x2874e4){if(_0x2be69b[_0xf5b5('0x49')]['id']){delete _0x2be69b[_0xf5b5('0x49')]['id'];}return db[_0xf5b5('0x2b')]['find']({'where':{'id':_0x2be69b[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x2874e4,null))[_0xf5b5('0x23')](saveUpdates(_0x2be69b[_0xf5b5('0x49')],null))['then'](respondWithResult(_0x2874e4,null))[_0xf5b5('0x51')](handleError(_0x2874e4,null));};exports[_0xf5b5('0x52')]=function(_0x22904e,_0x55f040){return db[_0xf5b5('0x2b')][_0xf5b5('0x47')]({'where':{'id':_0x22904e[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x55f040,null))[_0xf5b5('0x23')](removeEntity(_0x55f040,null))['catch'](handleError(_0x55f040,null));};exports['addAllCondition']=function(_0x438d84,_0x33e212,_0x5e0ffe){if(_0x438d84['body']['id']){delete _0x438d84[_0xf5b5('0x49')]['id'];}return db['Trigger'][_0xf5b5('0x47')]({'where':{'id':_0x438d84[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x33e212,null))['then'](function(_0x488d75){if(_0x488d75){_0x438d84['body'][_0xf5b5('0x53')]=_0x488d75['id'];return db['Condition'][_0xf5b5('0x48')](_0x438d84[_0xf5b5('0x49')]);}})[_0xf5b5('0x23')](respondWithResult(_0x33e212,null))[_0xf5b5('0x51')](handleError(_0x33e212,null));};exports[_0xf5b5('0x54')]=function(_0x249464,_0x58c2dd,_0x3a2b52){if(_0x249464[_0xf5b5('0x49')]['id']){delete _0x249464[_0xf5b5('0x49')]['id'];}return db[_0xf5b5('0x2b')][_0xf5b5('0x47')]({'where':{'id':_0x249464[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x58c2dd,null))[_0xf5b5('0x23')](function(_0x26c83b){if(_0x26c83b){_0x249464[_0xf5b5('0x49')][_0xf5b5('0x55')]=_0x26c83b['id'];return db['Condition']['create'](_0x249464[_0xf5b5('0x49')]);}})['then'](respondWithResult(_0x58c2dd,null))[_0xf5b5('0x51')](handleError(_0x58c2dd,null));};exports['getAllConditions']=function(_0x4bd45a,_0x2ad65d,_0xa75565){var _0x4967a9={};var _0x3b631a={};var _0x464bbc;var _0x1c2bea;return db[_0xf5b5('0x2b')][_0xf5b5('0x56')]({'where':{'id':_0x4bd45a[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x2ad65d,null))[_0xf5b5('0x23')](function(_0x567d2f){if(_0x567d2f){_0x464bbc=_0x567d2f;_0x3b631a[_0xf5b5('0x2f')]=_[_0xf5b5('0x31')](db[_0xf5b5('0x57')][_0xf5b5('0x2c')]);_0x3b631a[_0xf5b5('0x34')]=_['keys'](_0x4bd45a[_0xf5b5('0x34')]);_0x3b631a[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x3b631a[_0xf5b5('0x2f')],_0x3b631a[_0xf5b5('0x34')]);_0x4967a9[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x3b631a[_0xf5b5('0x2f')],qs[_0xf5b5('0x36')](_0x4bd45a['query']['fields']));_0x4967a9[_0xf5b5('0x35')]=_0x4967a9[_0xf5b5('0x35')][_0xf5b5('0x37')]?_0x4967a9[_0xf5b5('0x35')]:_0x3b631a[_0xf5b5('0x2f')];_0x4967a9[_0xf5b5('0x3a')]=qs['sort'](_0x4bd45a['query']['sort']);_0x4967a9['where']=qs['filters'](_['pick'](_0x4bd45a[_0xf5b5('0x34')],_0x3b631a[_0xf5b5('0x32')]));if(_0x4bd45a['query'][_0xf5b5('0x3e')]){_0x4967a9['where']=_[_0xf5b5('0x3f')](_0x4967a9['where'],{'$or':_[_0xf5b5('0x30')](_0x4967a9[_0xf5b5('0x35')],function(_0x2a4ef1){var _0x34da2b={};_0x34da2b[_0x2a4ef1]={'$like':'%'+_0x4bd45a['query'][_0xf5b5('0x3e')]+'%'};return _0x34da2b;})});}_0x4967a9=_['merge']({},_0x4967a9,_0x4bd45a[_0xf5b5('0x41')]);return _0x464bbc[_0xf5b5('0x58')](_0x4967a9);}})['then'](function(_0x21e51b){if(_0x21e51b){_0x1c2bea=_0x21e51b[_0xf5b5('0x37')];if(!_0x4bd45a[_0xf5b5('0x34')]['hasOwnProperty'](_0xf5b5('0x39'))){_0x4967a9[_0xf5b5('0x1c')]=qs[_0xf5b5('0x1c')](_0x4bd45a[_0xf5b5('0x34')][_0xf5b5('0x1c')]);_0x4967a9['offset']=qs[_0xf5b5('0x1a')](_0x4bd45a['query'][_0xf5b5('0x1a')]);}return _0x464bbc['getAllConditions'](_0x4967a9);}})[_0xf5b5('0x23')](function(_0x1c3003){if(_0x1c3003){return _0x1c3003?{'count':_0x1c2bea,'rows':_0x1c3003}:null;}})['then'](respondWithResult(_0x2ad65d,null))[_0xf5b5('0x51')](handleError(_0x2ad65d,null));};exports['getAnyConditions']=function(_0x13cf8b,_0x22e41e,_0x1d9c1a){var _0x339675={};var _0x2929ee={};var _0x45d667;var _0x44946f;return db[_0xf5b5('0x2b')][_0xf5b5('0x56')]({'where':{'id':_0x13cf8b[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x22e41e,null))[_0xf5b5('0x23')](function(_0x4d5d81){if(_0x4d5d81){_0x45d667=_0x4d5d81;_0x2929ee[_0xf5b5('0x2f')]=_[_0xf5b5('0x31')](db[_0xf5b5('0x57')][_0xf5b5('0x2c')]);_0x2929ee[_0xf5b5('0x34')]=_[_0xf5b5('0x31')](_0x13cf8b[_0xf5b5('0x34')]);_0x2929ee['filters']=_[_0xf5b5('0x33')](_0x2929ee[_0xf5b5('0x2f')],_0x2929ee[_0xf5b5('0x34')]);_0x339675[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x2929ee[_0xf5b5('0x2f')],qs[_0xf5b5('0x36')](_0x13cf8b[_0xf5b5('0x34')][_0xf5b5('0x36')]));_0x339675[_0xf5b5('0x35')]=_0x339675[_0xf5b5('0x35')][_0xf5b5('0x37')]?_0x339675[_0xf5b5('0x35')]:_0x2929ee[_0xf5b5('0x2f')];_0x339675['order']=qs[_0xf5b5('0x3b')](_0x13cf8b[_0xf5b5('0x34')]['sort']);_0x339675[_0xf5b5('0x3c')]=qs[_0xf5b5('0x32')](_[_0xf5b5('0x3d')](_0x13cf8b[_0xf5b5('0x34')],_0x2929ee['filters']));if(_0x13cf8b['query'][_0xf5b5('0x3e')]){_0x339675['where']=_[_0xf5b5('0x3f')](_0x339675[_0xf5b5('0x3c')],{'$or':_['map'](_0x339675['attributes'],function(_0x3dc01e){var _0x2fee92={};_0x2fee92[_0x3dc01e]={'$like':'%'+_0x13cf8b[_0xf5b5('0x34')][_0xf5b5('0x3e')]+'%'};return _0x2fee92;})});}_0x339675=_['merge']({},_0x339675,_0x13cf8b[_0xf5b5('0x41')]);return _0x45d667[_0xf5b5('0x59')](_0x339675);}})[_0xf5b5('0x23')](function(_0x2c3381){if(_0x2c3381){_0x44946f=_0x2c3381[_0xf5b5('0x37')];if(!_0x13cf8b['query']['hasOwnProperty'](_0xf5b5('0x39'))){_0x339675['limit']=qs[_0xf5b5('0x1c')](_0x13cf8b[_0xf5b5('0x34')]['limit']);_0x339675[_0xf5b5('0x1a')]=qs['offset'](_0x13cf8b['query'][_0xf5b5('0x1a')]);}return _0x45d667[_0xf5b5('0x59')](_0x339675);}})[_0xf5b5('0x23')](function(_0x5b182b){if(_0x5b182b){return _0x5b182b?{'count':_0x44946f,'rows':_0x5b182b}:null;}})['then'](respondWithResult(_0x22e41e,null))[_0xf5b5('0x51')](handleError(_0x22e41e,null));};exports['addAction']=function(_0x35a800,_0x3f82a1,_0x1aa9d3){if(_0x35a800[_0xf5b5('0x49')]['id']){delete _0x35a800['body']['id'];}return db[_0xf5b5('0x2b')][_0xf5b5('0x47')]({'where':{'id':_0x35a800[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x3f82a1,null))[_0xf5b5('0x23')](function(_0x27c0d0){if(_0x27c0d0){_0x35a800[_0xf5b5('0x49')][_0xf5b5('0x5a')]=_0x27c0d0['id'];return db['Action'][_0xf5b5('0x48')](_0x35a800[_0xf5b5('0x49')]);}})[_0xf5b5('0x23')](respondWithResult(_0x3f82a1,null))[_0xf5b5('0x51')](handleError(_0x3f82a1,null));};exports[_0xf5b5('0x5b')]=function(_0x539a9a,_0x10f017,_0x2329b1){var _0x132324={};var _0x553037={};var _0x283f65;var _0x5e5196;return db[_0xf5b5('0x2b')][_0xf5b5('0x56')]({'where':{'id':_0x539a9a[_0xf5b5('0x45')]['id']}})[_0xf5b5('0x23')](handleEntityNotFound(_0x10f017,null))[_0xf5b5('0x23')](function(_0x57af01){if(_0x57af01){_0x283f65=_0x57af01;_0x553037['model']=_[_0xf5b5('0x31')](db[_0xf5b5('0x5c')][_0xf5b5('0x2c')]);_0x553037['query']=_[_0xf5b5('0x31')](_0x539a9a[_0xf5b5('0x34')]);_0x553037[_0xf5b5('0x32')]=_[_0xf5b5('0x33')](_0x553037[_0xf5b5('0x2f')],_0x553037['query']);_0x132324[_0xf5b5('0x35')]=_[_0xf5b5('0x33')](_0x553037[_0xf5b5('0x2f')],qs['fields'](_0x539a9a['query'][_0xf5b5('0x36')]));_0x132324[_0xf5b5('0x35')]=_0x132324['attributes'][_0xf5b5('0x37')]?_0x132324[_0xf5b5('0x35')]:_0x553037['model'];_0x132324[_0xf5b5('0x3a')]=qs[_0xf5b5('0x3b')](_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x3b')]);_0x132324['where']=qs['filters'](_['pick'](_0x539a9a[_0xf5b5('0x34')],_0x553037[_0xf5b5('0x32')]));if(_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x3e')]){_0x132324[_0xf5b5('0x3c')]=_[_0xf5b5('0x3f')](_0x132324['where'],{'$or':_['map'](_0x132324[_0xf5b5('0x35')],function(_0x2dc713){var _0x45847c={};_0x45847c[_0x2dc713]={'$like':'%'+_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x3e')]+'%'};return _0x45847c;})});}_0x132324=_[_0xf5b5('0x3f')]({},_0x132324,_0x539a9a[_0xf5b5('0x41')]);return _0x283f65[_0xf5b5('0x5b')](_0x132324);}})[_0xf5b5('0x23')](function(_0x51d367){if(_0x51d367){_0x5e5196=_0x51d367[_0xf5b5('0x37')];if(!_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x38')](_0xf5b5('0x39'))){_0x132324[_0xf5b5('0x1c')]=qs[_0xf5b5('0x1c')](_0x539a9a['query'][_0xf5b5('0x1c')]);_0x132324['offset']=qs[_0xf5b5('0x1a')](_0x539a9a[_0xf5b5('0x34')][_0xf5b5('0x1a')]);}return _0x283f65[_0xf5b5('0x5b')](_0x132324);}})[_0xf5b5('0x23')](function(_0x32d2eb){if(_0x32d2eb){return _0x32d2eb?{'count':_0x5e5196,'rows':_0x32d2eb}:null;}})[_0xf5b5('0x23')](respondWithResult(_0x10f017,null))['catch'](handleError(_0x10f017,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 90d6ae6..0fac93f 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 _0x4c6d=['moment','request-promise','path','rimraf','./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api'];(function(_0xea25aa,_0x4c3a90){var _0x45c7ac=function(_0x52b4bd){while(--_0x52b4bd){_0xea25aa['push'](_0xea25aa['shift']());}};_0x45c7ac(++_0x4c3a90);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x1a0e1b,_0x1ed3d6){_0x1a0e1b=_0x1a0e1b-0x0;var _0x541bf6=_0x4c6d[_0x1a0e1b];return _0x541bf6;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var logger=require(_0xd4c6('0x2'))(_0xd4c6('0x3'));var moment=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4c6('0x5'));var fs=require('fs');var path=require(_0xd4c6('0x6'));var rimraf=require(_0xd4c6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4c6('0x8'));module[_0xd4c6('0x9')]=function(_0x56279c,_0x182671){return _0x56279c[_0xd4c6('0xa')](_0xd4c6('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb201=['tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','Trigger'];(function(_0x40f57e,_0x27c499){var _0x125348=function(_0x47d832){while(--_0x47d832){_0x40f57e['push'](_0x40f57e['shift']());}};_0x125348(++_0x27c499);}(_0xb201,0x1b1));var _0x1b20=function(_0x394563,_0x1bc4e0){_0x394563=_0x394563-0x0;var _0x82079d=_0xb201[_0x394563];return _0x82079d;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var logger=require(_0x1b20('0x1'))(_0x1b20('0x2'));var moment=require(_0x1b20('0x3'));var BPromise=require(_0x1b20('0x4'));var rp=require(_0x1b20('0x5'));var fs=require('fs');var path=require(_0x1b20('0x6'));var rimraf=require('rimraf');var config=require(_0x1b20('0x7'));var attributes=require(_0x1b20('0x8'));module[_0x1b20('0x9')]=function(_0x4da5a7,_0x29fbc1){return _0x4da5a7['define'](_0x1b20('0xa'),attributes,{'tableName':_0x1b20('0xb'),'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 c9905aa..8010096 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 _0xfec8=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','where','limit','include','model','attributes','map','ShowTrigger','find','raw','util','moment','bluebird','randomstring'];(function(_0x38793f,_0x120998){var _0x6a5109=function(_0x3bcc0a){while(--_0x3bcc0a){_0x38793f['push'](_0x38793f['shift']());}};_0x6a5109(++_0x120998);}(_0xfec8,0x65));var _0x8fec=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xfec8[_0x19b84f];return _0x18067b;};'use strict';var _=require('lodash');var util=require(_0x8fec('0x0'));var moment=require(_0x8fec('0x1'));var BPromise=require(_0x8fec('0x2'));var rs=require(_0x8fec('0x3'));var fs=require('fs');var Redis=require(_0x8fec('0x4'));var db=require(_0x8fec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fec('0x6'))(_0x8fec('0x7'));var config=require(_0x8fec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8fec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24b0a9,_0x27948f,_0x23bb82){return new BPromise(function(_0x44a1ef,_0x207b01){return client[_0x8fec('0xa')](_0x24b0a9,_0x23bb82)[_0x8fec('0xb')](function(_0x9371e0){logger[_0x8fec('0xc')](_0x8fec('0xd'),_0x27948f,_0x8fec('0xe'));logger[_0x8fec('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x27948f,_0x8fec('0xe'),JSON[_0x8fec('0x10')](_0x9371e0));if(_0x9371e0[_0x8fec('0x11')]){if(_0x9371e0[_0x8fec('0x11')][_0x8fec('0x12')]===0x1f4){logger[_0x8fec('0x11')](_0x8fec('0xd'),_0x27948f,_0x9371e0[_0x8fec('0x11')][_0x8fec('0x13')]);return _0x207b01(_0x9371e0[_0x8fec('0x11')][_0x8fec('0x13')]);}logger[_0x8fec('0x11')](_0x8fec('0xd'),_0x27948f,_0x9371e0[_0x8fec('0x11')][_0x8fec('0x13')]);return _0x44a1ef(_0x9371e0[_0x8fec('0x11')][_0x8fec('0x13')]);}else{logger[_0x8fec('0xc')](_0x8fec('0xd'),_0x27948f,'request\x20sent');_0x44a1ef(_0x9371e0[_0x8fec('0x14')][_0x8fec('0x13')]);}})[_0x8fec('0x15')](function(_0x2234a2){logger['error'](_0x8fec('0xd'),_0x27948f,_0x2234a2);_0x207b01(_0x2234a2);});});}exports[_0x8fec('0x16')]=function(_0x56f322){var _0x42755a=this;return new Promise(function(_0x59f939,_0x592020){return db[_0x8fec('0x17')][_0x8fec('0x18')]({'raw':_0x56f322[_0x8fec('0x19')]?_0x56f322[_0x8fec('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x56f322[_0x8fec('0x19')]?_0x56f322[_0x8fec('0x19')][_0x8fec('0x1a')]||null:null,'attributes':_0x56f322[_0x8fec('0x19')]?_0x56f322[_0x8fec('0x19')]['attributes']||null:null,'limit':_0x56f322[_0x8fec('0x19')]?_0x56f322[_0x8fec('0x19')][_0x8fec('0x1b')]||null:null,'include':_0x56f322['options']?_0x56f322['options'][_0x8fec('0x1c')]?_['map'](_0x56f322['options'][_0x8fec('0x1c')],function(_0x1d77c5){return{'model':db[_0x1d77c5[_0x8fec('0x1d')]],'as':_0x1d77c5['as'],'attributes':_0x1d77c5[_0x8fec('0x1e')],'include':_0x1d77c5[_0x8fec('0x1c')]?_['map'](_0x1d77c5[_0x8fec('0x1c')],function(_0x33e80a){return{'model':db[_0x33e80a['model']],'as':_0x33e80a['as'],'attributes':_0x33e80a['attributes'],'include':_0x33e80a[_0x8fec('0x1c')]?_[_0x8fec('0x1f')](_0x33e80a[_0x8fec('0x1c')],function(_0x40c4fb){return{'model':db[_0x40c4fb[_0x8fec('0x1d')]],'as':_0x40c4fb['as'],'attributes':_0x40c4fb[_0x8fec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fec('0xb')](function(_0x368f18){logger[_0x8fec('0xc')]('GetTrigger',_0x56f322);logger[_0x8fec('0xf')](_0x8fec('0x16'),_0x56f322,JSON[_0x8fec('0x10')](_0x368f18));_0x59f939(_0x368f18);})['catch'](function(_0xc828c4){logger[_0x8fec('0x11')](_0x8fec('0x16'),_0xc828c4[_0x8fec('0x13')],_0x56f322);_0x592020(_0x42755a[_0x8fec('0x11')](0x1f4,_0xc828c4[_0x8fec('0x13')]));});});};exports[_0x8fec('0x20')]=function(_0x28c729){var _0x3ffdfb=this;return new Promise(function(_0x4b3092,_0xe266b){return db['Trigger'][_0x8fec('0x21')]({'raw':_0x28c729[_0x8fec('0x19')]?_0x28c729[_0x8fec('0x19')][_0x8fec('0x22')]===undefined?!![]:![]:!![],'where':_0x28c729[_0x8fec('0x19')]?_0x28c729['options'][_0x8fec('0x1a')]||null:null,'attributes':_0x28c729[_0x8fec('0x19')]?_0x28c729[_0x8fec('0x19')][_0x8fec('0x1e')]||null:null,'include':_0x28c729[_0x8fec('0x19')]?_0x28c729[_0x8fec('0x19')][_0x8fec('0x1c')]?_[_0x8fec('0x1f')](_0x28c729[_0x8fec('0x19')][_0x8fec('0x1c')],function(_0x15e032){return{'model':db[_0x15e032['model']],'as':_0x15e032['as'],'attributes':_0x15e032[_0x8fec('0x1e')],'include':_0x15e032[_0x8fec('0x1c')]?_[_0x8fec('0x1f')](_0x15e032['include'],function(_0x2f0479){return{'model':db[_0x2f0479[_0x8fec('0x1d')]],'as':_0x2f0479['as'],'attributes':_0x2f0479[_0x8fec('0x1e')],'include':_0x2f0479['include']?_[_0x8fec('0x1f')](_0x2f0479[_0x8fec('0x1c')],function(_0x3d6447){return{'model':db[_0x3d6447[_0x8fec('0x1d')]],'as':_0x3d6447['as'],'attributes':_0x3d6447[_0x8fec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8fec('0xb')](function(_0x52c855){logger['info'](_0x8fec('0x20'),_0x28c729);logger[_0x8fec('0xf')](_0x8fec('0x20'),_0x28c729,JSON[_0x8fec('0x10')](_0x52c855));_0x4b3092(_0x52c855);})[_0x8fec('0x15')](function(_0x2c35ae){logger[_0x8fec('0x11')](_0x8fec('0x20'),_0x2c35ae[_0x8fec('0x13')],_0x28c729);_0xe266b(_0x3ffdfb[_0x8fec('0x11')](0x1f4,_0x2c35ae[_0x8fec('0x13')]));});});}; \ No newline at end of file +var _0x8c23=['attributes','limit','include','model','map','then','ShowTrigger','Trigger','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','findAll','options','raw'];(function(_0x5a8dc7,_0x4fd7ea){var _0x392272=function(_0x13ba47){while(--_0x13ba47){_0x5a8dc7['push'](_0x5a8dc7['shift']());}};_0x392272(++_0x4fd7ea);}(_0x8c23,0x7c));var _0x38c2=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8c23[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x38c2('0x0'));var util=require(_0x38c2('0x1'));var moment=require('moment');var BPromise=require(_0x38c2('0x2'));var rs=require(_0x38c2('0x3'));var fs=require('fs');var Redis=require(_0x38c2('0x4'));var db=require(_0x38c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38c2('0x6'))(_0x38c2('0x7'));var config=require(_0x38c2('0x8'));var jayson=require(_0x38c2('0x9'));var client=jayson[_0x38c2('0xa')][_0x38c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42678a,_0x15834d,_0x1a2cb2){return new BPromise(function(_0x3b7644,_0x39c64e){return client[_0x38c2('0xc')](_0x42678a,_0x1a2cb2)['then'](function(_0x462686){logger[_0x38c2('0xd')](_0x38c2('0xe'),_0x15834d,_0x38c2('0xf'));logger[_0x38c2('0x10')](_0x38c2('0x11'),_0x15834d,_0x38c2('0xf'),JSON[_0x38c2('0x12')](_0x462686));if(_0x462686[_0x38c2('0x13')]){if(_0x462686[_0x38c2('0x13')][_0x38c2('0x14')]===0x1f4){logger[_0x38c2('0x13')](_0x38c2('0xe'),_0x15834d,_0x462686[_0x38c2('0x13')]['message']);return _0x39c64e(_0x462686['error']['message']);}logger['error'](_0x38c2('0xe'),_0x15834d,_0x462686[_0x38c2('0x13')][_0x38c2('0x15')]);return _0x3b7644(_0x462686[_0x38c2('0x13')]['message']);}else{logger[_0x38c2('0xd')](_0x38c2('0xe'),_0x15834d,_0x38c2('0xf'));_0x3b7644(_0x462686[_0x38c2('0x16')][_0x38c2('0x15')]);}})[_0x38c2('0x17')](function(_0x2a9bd9){logger[_0x38c2('0x13')]('Trigger,\x20%s,\x20%s',_0x15834d,_0x2a9bd9);_0x39c64e(_0x2a9bd9);});});}exports[_0x38c2('0x18')]=function(_0x5896db){var _0x5b5f3c=this;return new Promise(function(_0x4e515b,_0x3fe32c){return db['Trigger'][_0x38c2('0x19')]({'raw':_0x5896db[_0x38c2('0x1a')]?_0x5896db[_0x38c2('0x1a')][_0x38c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x5896db['options']?_0x5896db[_0x38c2('0x1a')]['where']||null:null,'attributes':_0x5896db['options']?_0x5896db['options'][_0x38c2('0x1c')]||null:null,'limit':_0x5896db['options']?_0x5896db[_0x38c2('0x1a')][_0x38c2('0x1d')]||null:null,'include':_0x5896db[_0x38c2('0x1a')]?_0x5896db[_0x38c2('0x1a')][_0x38c2('0x1e')]?_['map'](_0x5896db['options'][_0x38c2('0x1e')],function(_0x1d5247){return{'model':db[_0x1d5247[_0x38c2('0x1f')]],'as':_0x1d5247['as'],'attributes':_0x1d5247['attributes'],'include':_0x1d5247[_0x38c2('0x1e')]?_['map'](_0x1d5247[_0x38c2('0x1e')],function(_0x29fa5f){return{'model':db[_0x29fa5f[_0x38c2('0x1f')]],'as':_0x29fa5f['as'],'attributes':_0x29fa5f[_0x38c2('0x1c')],'include':_0x29fa5f['include']?_[_0x38c2('0x20')](_0x29fa5f[_0x38c2('0x1e')],function(_0x31e874){return{'model':db[_0x31e874[_0x38c2('0x1f')]],'as':_0x31e874['as'],'attributes':_0x31e874[_0x38c2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x38c2('0x21')](function(_0x2c4e75){logger[_0x38c2('0xd')](_0x38c2('0x18'),_0x5896db);logger[_0x38c2('0x10')](_0x38c2('0x18'),_0x5896db,JSON[_0x38c2('0x12')](_0x2c4e75));_0x4e515b(_0x2c4e75);})[_0x38c2('0x17')](function(_0x39c46b){logger['error']('GetTrigger',_0x39c46b[_0x38c2('0x15')],_0x5896db);_0x3fe32c(_0x5b5f3c[_0x38c2('0x13')](0x1f4,_0x39c46b[_0x38c2('0x15')]));});});};exports[_0x38c2('0x22')]=function(_0x263741){var _0x260792=this;return new Promise(function(_0xf3ec6a,_0x2217ea){return db[_0x38c2('0x23')][_0x38c2('0x24')]({'raw':_0x263741[_0x38c2('0x1a')]?_0x263741['options'][_0x38c2('0x1b')]===undefined?!![]:![]:!![],'where':_0x263741[_0x38c2('0x1a')]?_0x263741[_0x38c2('0x1a')][_0x38c2('0x25')]||null:null,'attributes':_0x263741[_0x38c2('0x1a')]?_0x263741[_0x38c2('0x1a')][_0x38c2('0x1c')]||null:null,'include':_0x263741[_0x38c2('0x1a')]?_0x263741[_0x38c2('0x1a')][_0x38c2('0x1e')]?_[_0x38c2('0x20')](_0x263741[_0x38c2('0x1a')][_0x38c2('0x1e')],function(_0x1715fe){return{'model':db[_0x1715fe['model']],'as':_0x1715fe['as'],'attributes':_0x1715fe[_0x38c2('0x1c')],'include':_0x1715fe['include']?_[_0x38c2('0x20')](_0x1715fe[_0x38c2('0x1e')],function(_0x4357cc){return{'model':db[_0x4357cc['model']],'as':_0x4357cc['as'],'attributes':_0x4357cc[_0x38c2('0x1c')],'include':_0x4357cc[_0x38c2('0x1e')]?_[_0x38c2('0x20')](_0x4357cc[_0x38c2('0x1e')],function(_0x201566){return{'model':db[_0x201566[_0x38c2('0x1f')]],'as':_0x201566['as'],'attributes':_0x201566[_0x38c2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xebb007){logger[_0x38c2('0xd')](_0x38c2('0x22'),_0x263741);logger[_0x38c2('0x10')](_0x38c2('0x22'),_0x263741,JSON[_0x38c2('0x12')](_0xebb007));_0xf3ec6a(_0xebb007);})[_0x38c2('0x17')](function(_0x2672c1){logger[_0x38c2('0x13')](_0x38c2('0x22'),_0x2672c1[_0x38c2('0x15')],_0x263741);_0x2217ea(_0x260792[_0x38c2('0x13')](0x1f4,_0x2672c1['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5739bcc..d590dc5 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 _0xe239=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','index','get','/:id','isAuthenticated','show','post','clone','create','put','destroy','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xe239,0xe4));var _0x9e23=function(_0x3af4af,_0x44042d){_0x3af4af=_0x3af4af-0x0;var _0x332fc9=_0xe239[_0x3af4af];return _0x332fc9;};'use strict';var multer=require('multer');var util=require(_0x9e23('0x0'));var path=require(_0x9e23('0x1'));var timeout=require(_0x9e23('0x2'));var express=require('express');var router=express[_0x9e23('0x3')]();var fs_extra=require(_0x9e23('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e23('0x5'));var config=require(_0x9e23('0x6'));var controller=require(_0x9e23('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9e23('0x8')]);router[_0x9e23('0x9')](_0x9e23('0xa'),auth[_0x9e23('0xb')](),controller[_0x9e23('0xc')]);router[_0x9e23('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0x9e23('0xe')]);router[_0x9e23('0xd')]('/',auth[_0x9e23('0xb')](),controller[_0x9e23('0xf')]);router[_0x9e23('0x10')](_0x9e23('0xa'),auth[_0x9e23('0xb')](),controller['update']);router['delete'](_0x9e23('0xa'),auth[_0x9e23('0xb')](),controller[_0x9e23('0x11')]);module[_0x9e23('0x12')]=router; \ No newline at end of file +var _0x10c0=['fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','util','connect-timeout','Router'];(function(_0x5f4a84,_0x33d504){var _0x2060fd=function(_0x495cbb){while(--_0x495cbb){_0x5f4a84['push'](_0x5f4a84['shift']());}};_0x2060fd(++_0x33d504);}(_0x10c0,0x14d));var _0x010c=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0x10c0[_0x6287b6];return _0x5d6be4;};'use strict';var multer=require('multer');var util=require(_0x010c('0x0'));var path=require('path');var timeout=require(_0x010c('0x1'));var express=require('express');var router=express[_0x010c('0x2')]();var fs_extra=require(_0x010c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x010c('0x4'));var config=require(_0x010c('0x5'));var controller=require(_0x010c('0x6'));router[_0x010c('0x7')]('/',auth[_0x010c('0x8')](),controller[_0x010c('0x9')]);router[_0x010c('0x7')]('/:id',auth[_0x010c('0x8')](),controller[_0x010c('0xa')]);router[_0x010c('0xb')]('/:id/clone',auth[_0x010c('0x8')](),controller['clone']);router[_0x010c('0xb')]('/',auth[_0x010c('0x8')](),controller['create']);router[_0x010c('0xc')](_0x010c('0xd'),auth[_0x010c('0x8')](),controller[_0x010c('0xe')]);router[_0x010c('0xf')](_0x010c('0xd'),auth['isAuthenticated'](),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 4a438c0..05c4143 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 _0x4712=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','setDataValue','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','outgoing','yes','force_rport,comedia','nat'];(function(_0x2ff6f0,_0x5e2b92){var _0x3560cb=function(_0x124385){while(--_0x124385){_0x2ff6f0['push'](_0x2ff6f0['shift']());}};_0x3560cb(++_0x5e2b92);}(_0x4712,0x132));var _0x2471=function(_0x4e7bc5,_0x373eb1){_0x4e7bc5=_0x4e7bc5-0x0;var _0x523852=_0x4712[_0x4e7bc5];return _0x523852;};'use strict';var Sequelize=require(_0x2471('0x0'));module[_0x2471('0x1')]={'name':{'type':Sequelize[_0x2471('0x2')],'allowNull':![],'unique':_0x2471('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x5'),_0x2471('0x6'),_0x2471('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2471('0x8')},'callingpres':{'type':Sequelize['ENUM'](_0x2471('0x9'),_0x2471('0xa'),_0x2471('0xb'),'ALLOWED',_0x2471('0xc'),_0x2471('0xd'),_0x2471('0xe'),_0x2471('0xf'))},'deny':{'type':Sequelize[_0x2471('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x2471('0x2')]},'md5secret':{'type':Sequelize[_0x2471('0x2')]},'remotesecret':{'type':Sequelize[_0x2471('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x2471('0x10'),'set':function(_0x3ffb7b){this['setDataValue'](_0x2471('0x11'),_0x3ffb7b?_0x3ffb7b[_0x2471('0x12')](','):null);},'get':function(){return this[_0x2471('0x13')](_0x2471('0x11'))?this[_0x2471('0x13')](_0x2471('0x11'))['split'](','):null;},'comment':_0x2471('0x14')},'dtmfmode':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x15'),_0x2471('0x16'),'shortinfo',_0x2471('0x17'),_0x2471('0x18')),'defaultValue':_0x2471('0x15')},'directmedia':{'type':Sequelize[_0x2471('0x4')]('yes','no',_0x2471('0x19'),'update',_0x2471('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2471('0x2')]},'directmediadeny':{'type':Sequelize[_0x2471('0x2')]},'nat':{'type':Sequelize[_0x2471('0x2')],'defaultValue':_0x2471('0x1c'),'set':function(_0x4e4a69){this['setDataValue']('nat',_0x4e4a69?_0x4e4a69['join'](','):null);},'get':function(){return this[_0x2471('0x13')](_0x2471('0x1d'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x2471('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2471('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2471('0x2')]},'language':{'type':Sequelize[_0x2471('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2471('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2471('0x2')],'defaultValue':_0x2471('0x1f')},'allow':{'type':Sequelize[_0x2471('0x2')],'allowNull':![],'defaultValue':_0x2471('0x20'),'set':function(_0x283830){this['setDataValue'](_0x2471('0x21'),_0x283830?_0x283830['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2471('0x13')]('allow')?this['getDataValue'](_0x2471('0x21'))[_0x2471('0x22')](';'):null;},'comment':_0x2471('0x23')},'autoframing':{'type':Sequelize[_0x2471('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2471('0x24'),'set':function(_0x1facc9){this[_0x2471('0x25')](_0x2471('0x26'),_0x1facc9?_0x1facc9[_0x2471('0x12')](','):null);},'get':function(){return this[_0x2471('0x13')](_0x2471('0x26'))?this['getDataValue'](_0x2471('0x26'))[_0x2471('0x22')](','):null;},'comment':_0x2471('0x27')},'trustrpid':{'type':Sequelize['ENUM'](_0x2471('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no',_0x2471('0x28'))},'promiscredir':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x2471('0x29')](0xb)},'setvar':{'type':Sequelize[_0x2471('0x2')]},'callerid':{'type':Sequelize[_0x2471('0x2')],'defaultValue':_0x2471('0x2a')},'amaflags':{'type':Sequelize[_0x2471('0x2')]},'callcounter':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2471('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0x2471('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x2471('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2471('0x4')]('yes','no',_0x2471('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x2471('0x2')]},'session_timers':{'type':Sequelize[_0x2471('0x4')]('accept',_0x2471('0x2c'),_0x2471('0x2d'))},'session_expires':{'type':Sequelize[_0x2471('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x2471('0x29')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2471('0x2e'),_0x2471('0x2f')),'defaultValue':_0x2471('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0x2471('0x2')]},'regexten':{'type':Sequelize[_0x2471('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x2471('0x2')]},'port':{'type':Sequelize[_0x2471('0x29')](0x5)},'qualify':{'type':Sequelize[_0x2471('0x4')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2471('0x29')](0xb)},'defaultip':{'type':Sequelize[_0x2471('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x2471('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2471('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2471('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no',_0x2471('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2471('0x2')]},'callbackextension':{'type':Sequelize[_0x2471('0x2')]},'timert1':{'type':Sequelize[_0x2471('0x29')](0xb)},'timerb':{'type':Sequelize[_0x2471('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2471('0x29')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2471('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2471('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2471('0x29')](0xb)},'encryption':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x2471('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x2471('0x1b'),'no',_0x2471('0x31'),_0x2471('0x32'))},'dtlsrekey':{'type':Sequelize[_0x2471('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2471('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2471('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2471('0x2')]},'dtlscapath':{'type':Sequelize[_0x2471('0x2')]},'dtlssetup':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x33'),_0x2471('0x34'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2471('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2471('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x2471('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2471('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2471('0x2')]},'description':{'type':Sequelize[_0x2471('0x2')]},'host':{'type':Sequelize[_0x2471('0x2')],'defaultValue':_0x2471('0x35')},'canreinvite':{'type':Sequelize[_0x2471('0x4')](_0x2471('0x1b'),'no',_0x2471('0x19'),'update',_0x2471('0x36')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2471('0x37')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2471('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3d5d=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','refuse','originate','uas','pai','fingerprint','certificate','actpass','dynamic','BOOLEAN','sequelize','exports','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue'];(function(_0x1ab9f4,_0x14f8cc){var _0x573210=function(_0x4fbd68){while(--_0x4fbd68){_0x1ab9f4['push'](_0x1ab9f4['shift']());}};_0x573210(++_0x14f8cc);}(_0x3d5d,0x104));var _0xd3d5=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x3d5d[_0x5de532];return _0x4e9192;};'use strict';var Sequelize=require(_0xd3d5('0x0'));module[_0xd3d5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x3'),_0xd3d5('0x4'),'peer'),'allowNull':![],'defaultValue':_0xd3d5('0x3')},'context':{'type':Sequelize[_0xd3d5('0x5')],'allowNull':![],'defaultValue':_0xd3d5('0x6')},'callingpres':{'type':Sequelize[_0xd3d5('0x2')]('ALLOWED_NOT_SCREENED',_0xd3d5('0x7'),'ALLOWED_FAILED_SCREEN',_0xd3d5('0x8'),_0xd3d5('0x9'),_0xd3d5('0xa'),_0xd3d5('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xd3d5('0x5')]},'permit':{'type':Sequelize[_0xd3d5('0x5')]},'secret':{'type':Sequelize[_0xd3d5('0x5')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd3d5('0x5')]},'transport':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'udp','set':function(_0x3c8604){this[_0xd3d5('0xc')](_0xd3d5('0xd'),_0x3c8604?_0x3c8604[_0xd3d5('0xe')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xd3d5('0xf')](_0xd3d5('0xd'))[_0xd3d5('0x10')](','):null;},'comment':_0xd3d5('0x11')},'dtmfmode':{'type':Sequelize[_0xd3d5('0x2')]('rfc2833',_0xd3d5('0x12'),_0xd3d5('0x13'),_0xd3d5('0x14'),'auto'),'defaultValue':_0xd3d5('0x15')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xd3d5('0x16'),'update',_0xd3d5('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd3d5('0x5')]},'nat':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':_0xd3d5('0x19'),'set':function(_0x6c76cb){this[_0xd3d5('0xc')](_0xd3d5('0x1a'),_0x6c76cb?_0x6c76cb[_0xd3d5('0xe')](','):null);},'get':function(){return this[_0xd3d5('0xf')]('nat')?this[_0xd3d5('0xf')](_0xd3d5('0x1a'))[_0xd3d5('0x10')](','):null;},'comment':_0xd3d5('0x1b')},'callgroup':{'type':Sequelize[_0xd3d5('0x5')]},'namedcallgroup':{'type':Sequelize[_0xd3d5('0x5')]},'pickupgroup':{'type':Sequelize[_0xd3d5('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd3d5('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xd3d5('0x1c')},'allow':{'type':Sequelize[_0xd3d5('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x451934){this['setDataValue'](_0xd3d5('0x1d'),_0x451934?_0x451934[_0xd3d5('0xe')](';'):_0xd3d5('0x1e'));},'get':function(){return this[_0xd3d5('0xf')](_0xd3d5('0x1d'))?this['getDataValue'](_0xd3d5('0x1d'))['split'](';'):null;},'comment':_0xd3d5('0x1f')},'autoframing':{'type':Sequelize[_0xd3d5('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':_0xd3d5('0x20'),'set':function(_0x18db9b){this[_0xd3d5('0xc')](_0xd3d5('0x21'),_0x18db9b?_0x18db9b[_0xd3d5('0xe')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xd3d5('0xf')](_0xd3d5('0x21'))[_0xd3d5('0x10')](','):null;},'comment':_0xd3d5('0x22')},'trustrpid':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xd3d5('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd3d5('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd3d5('0x5')]},'videosupport':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd3d5('0x2')]('accept',_0xd3d5('0x25'),_0xd3d5('0x26'))},'session_expires':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xd3d5('0x27')),'defaultValue':_0xd3d5('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xd3d5('0x5')]},'regexten':{'type':Sequelize[_0xd3d5('0x5')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xd3d5('0x5')]},'port':{'type':Sequelize[_0xd3d5('0x23')](0x5)},'qualify':{'type':Sequelize[_0xd3d5('0x2')]('yes','no'),'defaultValue':_0xd3d5('0x18')},'keepalive':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd3d5('0x5')]},'defaultuser':{'type':Sequelize[_0xd3d5('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd3d5('0x5')]},'callbackextension':{'type':Sequelize[_0xd3d5('0x5')]},'timert1':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'timerb':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xd3d5('0x5')]},'contactdeny':{'type':Sequelize[_0xd3d5('0x5')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xd3d5('0x5')]},'use_q850_reason':{'type':Sequelize[_0xd3d5('0x5')]},'maxforwards':{'type':Sequelize[_0xd3d5('0x23')](0xb)},'encryption':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x29'),_0xd3d5('0x2a'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xd3d5('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0xd3d5('0x5')]},'dtlscipher':{'type':Sequelize[_0xd3d5('0x5')]},'dtlscafile':{'type':Sequelize[_0xd3d5('0x5')]},'dtlscapath':{'type':Sequelize[_0xd3d5('0x5')]},'dtlssetup':{'type':Sequelize[_0xd3d5('0x2')]('active','passive',_0xd3d5('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd3d5('0x5')]},'recordofffeature':{'type':Sequelize[_0xd3d5('0x5')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xd3d5('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no')},'vmexten':{'type':Sequelize[_0xd3d5('0x5')]},'mohinterpret':{'type':Sequelize[_0xd3d5('0x5')]},'mohsuggest':{'type':Sequelize[_0xd3d5('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3d5('0x5')]},'host':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':_0xd3d5('0x2c')},'canreinvite':{'type':Sequelize[_0xd3d5('0x2')](_0xd3d5('0x18'),'no',_0xd3d5('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd3d5('0x5')]},'active':{'type':Sequelize[_0xd3d5('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd3d5('0x5')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index de5a7d6..b7e36f4 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 _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x2ef0f7,_0x423785){var _0x24eab7=function(_0x19f822){while(--_0x19f822){_0x2ef0f7['push'](_0x2ef0f7['shift']());}};_0x24eab7(++_0x423785);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x6fd803,_0x46c95d){_0x6fd803=_0x6fd803-0x0;var _0x1608c0=_0x8d0e[_0x6fd803];return _0x1608c0;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x451655,_0x1be29f){var _0x2bdf91=function(_0x593d70){while(--_0x593d70){_0x451655['push'](_0x451655['shift']());}};_0x2bdf91(++_0x1be29f);}(_0x34e8,0x12c));var _0x834e=function(_0x4bded1,_0x1a5c47){_0x4bded1=_0x4bded1-0x0;var _0x38c485=_0x34e8[_0x4bded1];return _0x38c485;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 98fbac3..1d75ee1 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 _0xec0b=['rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2e0ec5,_0x4496a7){var _0x5ca5cd=function(_0x3ae985){while(--_0x3ae985){_0x2e0ec5['push'](_0x2e0ec5['shift']());}};_0x5ca5cd(++_0x4496a7);}(_0xec0b,0xf0));var _0xbec0=function(_0x1902e2,_0x2de9df){_0x1902e2=_0x1902e2-0x0;var _0x47213f=_0xec0b[_0x1902e2];return _0x47213f;};'use strict';var _=require(_0xbec0('0x0'));var util=require(_0xbec0('0x1'));var logger=require(_0xbec0('0x2'))(_0xbec0('0x3'));var moment=require('moment');var BPromise=require(_0xbec0('0x4'));var rp=require(_0xbec0('0x5'));var fs=require('fs');var path=require(_0xbec0('0x6'));var rimraf=require(_0xbec0('0x7'));var config=require(_0xbec0('0x8'));var attributes=require(_0xbec0('0x9'));module[_0xbec0('0xa')]=function(_0x369267,_0xf7794d){return _0x369267[_0xbec0('0xb')]('Trunk',attributes,{'tableName':_0xbec0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77a7=['path','rimraf','../../config/environment','exports','define','../../config/logger','api','moment','bluebird'];(function(_0x251306,_0x59a53e){var _0x386459=function(_0x4d20d7){while(--_0x4d20d7){_0x251306['push'](_0x251306['shift']());}};_0x386459(++_0x59a53e);}(_0x77a7,0xef));var _0x777a=function(_0x8f9dd1,_0x45f985){_0x8f9dd1=_0x8f9dd1-0x0;var _0x16886c=_0x77a7[_0x8f9dd1];return _0x16886c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x777a('0x0'))(_0x777a('0x1'));var moment=require(_0x777a('0x2'));var BPromise=require(_0x777a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x777a('0x4'));var rimraf=require(_0x777a('0x5'));var config=require(_0x777a('0x6'));var attributes=require('./trunk.attributes');module[_0x777a('0x7')]=function(_0x684c08,_0xf861d8){return _0x684c08[_0x777a('0x8')]('Trunk',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 7a48cc5..6d3c2a3 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 _0x6250=['ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','debug','find','raw'];(function(_0x214359,_0x5b8a69){var _0x469780=function(_0x2f8afd){while(--_0x2f8afd){_0x214359['push'](_0x214359['shift']());}};_0x469780(++_0x5b8a69);}(_0x6250,0x91));var _0x0625=function(_0x48506c,_0x20a172){_0x48506c=_0x48506c-0x0;var _0xf69e65=_0x6250[_0x48506c];return _0xf69e65;};'use strict';var _=require(_0x0625('0x0'));var util=require(_0x0625('0x1'));var moment=require(_0x0625('0x2'));var BPromise=require(_0x0625('0x3'));var rs=require(_0x0625('0x4'));var fs=require('fs');var Redis=require(_0x0625('0x5'));var db=require(_0x0625('0x6'))['db'];var utils=require(_0x0625('0x7'));var logger=require('../../config/logger')(_0x0625('0x8'));var config=require('../../config/environment');var jayson=require(_0x0625('0x9'));var client=jayson[_0x0625('0xa')][_0x0625('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48bea1,_0x11f795,_0x4acf86){return new BPromise(function(_0x5d53b8,_0x5ddfed){return client['request'](_0x48bea1,_0x4acf86)[_0x0625('0xc')](function(_0x439457){logger[_0x0625('0xd')]('Trunk,\x20%s,\x20%s',_0x11f795,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x11f795,_0x0625('0xe'),JSON[_0x0625('0xf')](_0x439457));if(_0x439457['error']){if(_0x439457[_0x0625('0x10')][_0x0625('0x11')]===0x1f4){logger[_0x0625('0x10')](_0x0625('0x12'),_0x11f795,_0x439457[_0x0625('0x10')][_0x0625('0x13')]);return _0x5ddfed(_0x439457[_0x0625('0x10')][_0x0625('0x13')]);}logger['error'](_0x0625('0x12'),_0x11f795,_0x439457[_0x0625('0x10')][_0x0625('0x13')]);return _0x5d53b8(_0x439457[_0x0625('0x10')][_0x0625('0x13')]);}else{logger[_0x0625('0xd')](_0x0625('0x12'),_0x11f795,_0x0625('0xe'));_0x5d53b8(_0x439457[_0x0625('0x14')]['message']);}})[_0x0625('0x15')](function(_0x2d5e47){logger['error'](_0x0625('0x12'),_0x11f795,_0x2d5e47);_0x5ddfed(_0x2d5e47);});});}exports[_0x0625('0x16')]=function(_0xb7b942){var _0x51bb07=this;return new Promise(function(_0x20eb30,_0x4e8c7b){return db[_0x0625('0x17')][_0x0625('0x18')]({'raw':_0xb7b942[_0x0625('0x19')]?_0xb7b942['options']['raw']===undefined?!![]:![]:!![],'where':_0xb7b942[_0x0625('0x19')]?_0xb7b942[_0x0625('0x19')][_0x0625('0x1a')]||null:null,'attributes':_0xb7b942[_0x0625('0x19')]?_0xb7b942[_0x0625('0x19')][_0x0625('0x1b')]||null:null,'limit':_0xb7b942[_0x0625('0x19')]?_0xb7b942[_0x0625('0x19')][_0x0625('0x1c')]||null:null,'include':_0xb7b942[_0x0625('0x19')]?_0xb7b942[_0x0625('0x19')][_0x0625('0x1d')]?_[_0x0625('0x1e')](_0xb7b942[_0x0625('0x19')][_0x0625('0x1d')],function(_0x3d715d){return{'model':db[_0x3d715d[_0x0625('0x1f')]],'as':_0x3d715d['as'],'attributes':_0x3d715d[_0x0625('0x1b')],'include':_0x3d715d['include']?_['map'](_0x3d715d['include'],function(_0x18c295){return{'model':db[_0x18c295[_0x0625('0x1f')]],'as':_0x18c295['as'],'attributes':_0x18c295['attributes'],'include':_0x18c295[_0x0625('0x1d')]?_[_0x0625('0x1e')](_0x18c295[_0x0625('0x1d')],function(_0x5617be){return{'model':db[_0x5617be[_0x0625('0x1f')]],'as':_0x5617be['as'],'attributes':_0x5617be[_0x0625('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0625('0xc')](function(_0x5e61ee){logger[_0x0625('0xd')](_0x0625('0x16'),_0xb7b942);logger[_0x0625('0x20')](_0x0625('0x16'),_0xb7b942,JSON['stringify'](_0x5e61ee));_0x20eb30(_0x5e61ee);})[_0x0625('0x15')](function(_0x5cab6a){logger[_0x0625('0x10')]('GetTrunk',_0x5cab6a[_0x0625('0x13')],_0xb7b942);_0x4e8c7b(_0x51bb07['error'](0x1f4,_0x5cab6a[_0x0625('0x13')]));});});};exports['ShowTrunk']=function(_0x691a75){var _0x4533fc=this;return new Promise(function(_0xed012a,_0x392409){return db[_0x0625('0x17')][_0x0625('0x21')]({'raw':_0x691a75[_0x0625('0x19')]?_0x691a75[_0x0625('0x19')][_0x0625('0x22')]===undefined?!![]:![]:!![],'where':_0x691a75[_0x0625('0x19')]?_0x691a75[_0x0625('0x19')][_0x0625('0x1a')]||null:null,'attributes':_0x691a75[_0x0625('0x19')]?_0x691a75[_0x0625('0x19')][_0x0625('0x1b')]||null:null,'include':_0x691a75[_0x0625('0x19')]?_0x691a75[_0x0625('0x19')][_0x0625('0x1d')]?_[_0x0625('0x1e')](_0x691a75['options'][_0x0625('0x1d')],function(_0x1f4b75){return{'model':db[_0x1f4b75['model']],'as':_0x1f4b75['as'],'attributes':_0x1f4b75[_0x0625('0x1b')],'include':_0x1f4b75[_0x0625('0x1d')]?_[_0x0625('0x1e')](_0x1f4b75[_0x0625('0x1d')],function(_0x33c620){return{'model':db[_0x33c620[_0x0625('0x1f')]],'as':_0x33c620['as'],'attributes':_0x33c620[_0x0625('0x1b')],'include':_0x33c620['include']?_[_0x0625('0x1e')](_0x33c620[_0x0625('0x1d')],function(_0x38f860){return{'model':db[_0x38f860[_0x0625('0x1f')]],'as':_0x38f860['as'],'attributes':_0x38f860[_0x0625('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0625('0xc')](function(_0x2db488){logger[_0x0625('0xd')](_0x0625('0x23'),_0x691a75);logger[_0x0625('0x20')]('ShowTrunk',_0x691a75,JSON[_0x0625('0xf')](_0x2db488));_0xed012a(_0x2db488);})[_0x0625('0x15')](function(_0x5e9aa8){logger[_0x0625('0x10')](_0x0625('0x23'),_0x5e9aa8[_0x0625('0x13')],_0x691a75);_0x392409(_0x4533fc['error'](0x1f4,_0x5e9aa8[_0x0625('0x13')]));});});}; \ No newline at end of file +var _0x7ffa=['ShowTrunk','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','then'];(function(_0x5b91a6,_0x43f793){var _0x4b648b=function(_0x51d150){while(--_0x51d150){_0x5b91a6['push'](_0x5b91a6['shift']());}};_0x4b648b(++_0x43f793);}(_0x7ffa,0x1d0));var _0xa7ff=function(_0x11d462,_0x47de06){_0x11d462=_0x11d462-0x0;var _0xb40de4=_0x7ffa[_0x11d462];return _0xb40de4;};'use strict';var _=require(_0xa7ff('0x0'));var util=require(_0xa7ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7ff('0x2'));var fs=require('fs');var Redis=require(_0xa7ff('0x3'));var db=require(_0xa7ff('0x4'))['db'];var utils=require(_0xa7ff('0x5'));var logger=require(_0xa7ff('0x6'))('rpc');var config=require(_0xa7ff('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa7ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34383d,_0x4fdf3b,_0x191831){return new BPromise(function(_0x3f03b5,_0x3f10ed){return client[_0xa7ff('0x9')](_0x34383d,_0x191831)['then'](function(_0x518268){logger[_0xa7ff('0xa')]('Trunk,\x20%s,\x20%s',_0x4fdf3b,'request\x20sent');logger[_0xa7ff('0xb')](_0xa7ff('0xc'),_0x4fdf3b,_0xa7ff('0xd'),JSON['stringify'](_0x518268));if(_0x518268['error']){if(_0x518268['error'][_0xa7ff('0xe')]===0x1f4){logger[_0xa7ff('0xf')](_0xa7ff('0x10'),_0x4fdf3b,_0x518268['error'][_0xa7ff('0x11')]);return _0x3f10ed(_0x518268[_0xa7ff('0xf')]['message']);}logger['error'](_0xa7ff('0x10'),_0x4fdf3b,_0x518268['error'][_0xa7ff('0x11')]);return _0x3f03b5(_0x518268[_0xa7ff('0xf')]['message']);}else{logger[_0xa7ff('0xa')]('Trunk,\x20%s,\x20%s',_0x4fdf3b,_0xa7ff('0xd'));_0x3f03b5(_0x518268[_0xa7ff('0x12')]['message']);}})[_0xa7ff('0x13')](function(_0x19035d){logger[_0xa7ff('0xf')]('Trunk,\x20%s,\x20%s',_0x4fdf3b,_0x19035d);_0x3f10ed(_0x19035d);});});}exports[_0xa7ff('0x14')]=function(_0x331d81){var _0x63a49d=this;return new Promise(function(_0x5140be,_0x1efde5){return db[_0xa7ff('0x15')]['findAll']({'raw':_0x331d81[_0xa7ff('0x16')]?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x17')]===undefined?!![]:![]:!![],'where':_0x331d81[_0xa7ff('0x16')]?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x18')]||null:null,'attributes':_0x331d81['options']?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x19')]||null:null,'limit':_0x331d81['options']?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x1a')]||null:null,'include':_0x331d81[_0xa7ff('0x16')]?_0x331d81[_0xa7ff('0x16')][_0xa7ff('0x1b')]?_['map'](_0x331d81['options'][_0xa7ff('0x1b')],function(_0x4e8321){return{'model':db[_0x4e8321[_0xa7ff('0x1c')]],'as':_0x4e8321['as'],'attributes':_0x4e8321[_0xa7ff('0x19')],'include':_0x4e8321[_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x4e8321[_0xa7ff('0x1b')],function(_0x2a42fd){return{'model':db[_0x2a42fd['model']],'as':_0x2a42fd['as'],'attributes':_0x2a42fd[_0xa7ff('0x19')],'include':_0x2a42fd[_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x2a42fd[_0xa7ff('0x1b')],function(_0x5b910a){return{'model':db[_0x5b910a[_0xa7ff('0x1c')]],'as':_0x5b910a['as'],'attributes':_0x5b910a[_0xa7ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7ff('0x1e')](function(_0x10cea0){logger[_0xa7ff('0xa')](_0xa7ff('0x14'),_0x331d81);logger['debug'](_0xa7ff('0x14'),_0x331d81,JSON['stringify'](_0x10cea0));_0x5140be(_0x10cea0);})[_0xa7ff('0x13')](function(_0x3f5710){logger['error'](_0xa7ff('0x14'),_0x3f5710['message'],_0x331d81);_0x1efde5(_0x63a49d[_0xa7ff('0xf')](0x1f4,_0x3f5710[_0xa7ff('0x11')]));});});};exports[_0xa7ff('0x1f')]=function(_0x34499f){var _0x18b96b=this;return new Promise(function(_0x228fee,_0x2415d1){return db[_0xa7ff('0x15')][_0xa7ff('0x20')]({'raw':_0x34499f[_0xa7ff('0x16')]?_0x34499f[_0xa7ff('0x16')][_0xa7ff('0x17')]===undefined?!![]:![]:!![],'where':_0x34499f[_0xa7ff('0x16')]?_0x34499f[_0xa7ff('0x16')]['where']||null:null,'attributes':_0x34499f[_0xa7ff('0x16')]?_0x34499f[_0xa7ff('0x16')][_0xa7ff('0x19')]||null:null,'include':_0x34499f[_0xa7ff('0x16')]?_0x34499f['options'][_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x34499f[_0xa7ff('0x16')]['include'],function(_0x31075d){return{'model':db[_0x31075d[_0xa7ff('0x1c')]],'as':_0x31075d['as'],'attributes':_0x31075d[_0xa7ff('0x19')],'include':_0x31075d['include']?_[_0xa7ff('0x1d')](_0x31075d[_0xa7ff('0x1b')],function(_0x370a8c){return{'model':db[_0x370a8c[_0xa7ff('0x1c')]],'as':_0x370a8c['as'],'attributes':_0x370a8c[_0xa7ff('0x19')],'include':_0x370a8c[_0xa7ff('0x1b')]?_[_0xa7ff('0x1d')](_0x370a8c[_0xa7ff('0x1b')],function(_0x383b40){return{'model':db[_0x383b40['model']],'as':_0x383b40['as'],'attributes':_0x383b40[_0xa7ff('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7ff('0x1e')](function(_0x210dca){logger[_0xa7ff('0xa')]('ShowTrunk',_0x34499f);logger['debug'](_0xa7ff('0x1f'),_0x34499f,JSON['stringify'](_0x210dca));_0x228fee(_0x210dca);})[_0xa7ff('0x13')](function(_0x3dcc36){logger[_0xa7ff('0xf')](_0xa7ff('0x1f'),_0x3dcc36[_0xa7ff('0x11')],_0x34499f);_0x2415d1(_0x18b96b[_0xa7ff('0xf')](0x1f4,_0x3dcc36[_0xa7ff('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 75f42a4..a4777ca 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e48=['../../components/auth/service','put','/:id','isAuthenticated','update','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6e48,0xd0));var _0x86e4=function(_0x3efed3,_0x354aef){_0x3efed3=_0x3efed3-0x0;var _0x5b885e=_0x6e48[_0x3efed3];return _0x5b885e;};'use strict';var express=require(_0x86e4('0x0'));var router=express[_0x86e4('0x1')]();var auth=require(_0x86e4('0x2'));var controller=require('./user-setting.controller');router[_0x86e4('0x3')](_0x86e4('0x4'),auth[_0x86e4('0x5')](),controller[_0x86e4('0x6')]);module['exports']=router; \ No newline at end of file +var _0x521f=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated'];(function(_0x4db7da,_0x1fc7e6){var _0x280c93=function(_0x2af65f){while(--_0x2af65f){_0x4db7da['push'](_0x4db7da['shift']());}};_0x280c93(++_0x1fc7e6);}(_0x521f,0x72));var _0xf521=function(_0xf63384,_0x5c8d61){_0xf63384=_0xf63384-0x0;var _0x44a17a=_0x521f[_0xf63384];return _0x44a17a;};'use strict';var express=require(_0xf521('0x0'));var router=express[_0xf521('0x1')]();var auth=require(_0xf521('0x2'));var controller=require(_0xf521('0x3'));router['put'](_0xf521('0x4'),auth[_0xf521('0x5')](),controller[_0xf521('0x6')]);module[_0xf521('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 3806867..a8c83c7 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['warning','debug','exports','ENUM','BOOLEAN','TEXT','DATE','UserId','sequelize','error'];(function(_0x1b2569,_0x144dbf){var _0x4ace10=function(_0x37e42d){while(--_0x37e42d){_0x1b2569['push'](_0x1b2569['shift']());}};_0x4ace10(++_0x144dbf);}(_0x53ec,0x8a));var _0xc53e=function(_0x4ef8bc,_0x5eb00d){_0x4ef8bc=_0x4ef8bc-0x0;var _0x5d4d56=_0x53ec[_0x4ef8bc];return _0x5d4d56;};'use strict';var Sequelize=require(_0xc53e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xc53e('0x1'),_0xc53e('0x2'),'info',_0xc53e('0x3')];module[_0xc53e('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xc53e('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc53e('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xc53e('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc53e('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xc53e('0x9')}}; \ No newline at end of file +var _0x36f6=['ENUM','BOOLEAN','TEXT','DATE','INTEGER','error','warning','debug'];(function(_0x251b62,_0x15a292){var _0x578306=function(_0x375d75){while(--_0x375d75){_0x251b62['push'](_0x251b62['shift']());}};_0x578306(++_0x15a292);}(_0x36f6,0x105));var _0x636f=function(_0x8d695e,_0x394999){_0x8d695e=_0x8d695e-0x0;var _0x3d156e=_0x36f6[_0x8d695e];return _0x3d156e;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x636f('0x0'),_0x636f('0x1'),'info',_0x636f('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x636f('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x636f('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x636f('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x636f('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x636f('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x636f('0x7')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index e55dcc9..3056d08 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d0b=['name','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','params','body','lodash','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','then'];(function(_0x3b4f36,_0x5c1bc5){var _0x42c965=function(_0x599a81){while(--_0x599a81){_0x3b4f36['push'](_0x3b4f36['shift']());}};_0x42c965(++_0x5c1bc5);}(_0x6d0b,0x71));var _0xb6d0=function(_0x19e02d,_0x35c766){_0x19e02d=_0x19e02d-0x0;var _0x35481b=_0x6d0b[_0x19e02d];return _0x35481b;};'use strict';var _=require(_0xb6d0('0x0'));var Redis=require('ioredis');var logger=require(_0xb6d0('0x1'))('api');var config=require(_0xb6d0('0x2'));var db=require(_0xb6d0('0x3'))['db'];var socket=require(_0xb6d0('0x4'))(new Redis(config[_0xb6d0('0x5')]));require(_0xb6d0('0x6'))[_0xb6d0('0x7')](socket);config[_0xb6d0('0x5')]=_['defaults'](config[_0xb6d0('0x5')],{'host':_0xb6d0('0x8'),'port':0x18eb});function respondWithResult(_0x23217f,_0x341756){_0x341756=_0x341756||0xc8;return function(_0x440414){if(_0x440414){return _0x23217f[_0xb6d0('0x9')](_0x341756)[_0xb6d0('0xa')](_0x440414);}};}function saveUpdates(_0x354e56){return function(_0x1497e5){if(_0x1497e5){return _0x1497e5[_0xb6d0('0xb')](_0x354e56)[_0xb6d0('0xc')](function(_0x3dff2f){return _0x3dff2f;});}return null;};}function handleEntityNotFound(_0x5d3d75){return function(_0x458941){if(!_0x458941){_0x5d3d75['sendStatus'](0x194);}return _0x458941;};}function handleError(_0x237283,_0x1254cb){_0x1254cb=_0x1254cb||0x1f4;return function(_0x542641){logger['error'](_0x542641['stack']);if(_0x542641[_0xb6d0('0xd')]){delete _0x542641['name'];}_0x237283['status'](_0x1254cb)['send'](_0x542641);};}exports['update']=function(_0x213af0,_0x410af2){if(_0x213af0[_0xb6d0('0xe')][_0xb6d0('0xf')]!==_0xb6d0('0x10'))throw new Error('Unauthorized');if(isNaN(Number(_0x213af0['params']['id'])))throw new Error(_0xb6d0('0x11'));return db[_0xb6d0('0x12')]['find']({'where':{'id':_0x213af0[_0xb6d0('0x13')]['id']}})[_0xb6d0('0xc')](handleEntityNotFound(_0x410af2,null))[_0xb6d0('0xc')](saveUpdates(_0x213af0[_0xb6d0('0x14')],null))[_0xb6d0('0xc')](respondWithResult(_0x410af2,null))['catch'](handleError(_0x410af2,null));}; \ No newline at end of file +var _0x25ad=['role','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch','lodash','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','update','then','stack','name','send','user'];(function(_0x21984f,_0x3f47bd){var _0x40602a=function(_0x31fd31){while(--_0x31fd31){_0x21984f['push'](_0x21984f['shift']());}};_0x40602a(++_0x3f47bd);}(_0x25ad,0x1b1));var _0xd25a=function(_0x153fab,_0x3e1351){_0x153fab=_0x153fab-0x0;var _0x57252a=_0x25ad[_0x153fab];return _0x57252a;};'use strict';var _=require(_0xd25a('0x0'));var Redis=require('ioredis');var logger=require(_0xd25a('0x1'))(_0xd25a('0x2'));var config=require(_0xd25a('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xd25a('0x4'))(new Redis(config[_0xd25a('0x5')]));require(_0xd25a('0x6'))[_0xd25a('0x7')](socket);config[_0xd25a('0x5')]=_[_0xd25a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3694c6,_0x330817){_0x330817=_0x330817||0xc8;return function(_0x5cf769){if(_0x5cf769){return _0x3694c6[_0xd25a('0x9')](_0x330817)[_0xd25a('0xa')](_0x5cf769);}};}function saveUpdates(_0x141f2c){return function(_0x18b7d5){if(_0x18b7d5){return _0x18b7d5[_0xd25a('0xb')](_0x141f2c)[_0xd25a('0xc')](function(_0xa21029){return _0xa21029;});}return null;};}function handleEntityNotFound(_0x5ec33c){return function(_0x1d4a07){if(!_0x1d4a07){_0x5ec33c['sendStatus'](0x194);}return _0x1d4a07;};}function handleError(_0x1ae663,_0x5bafd7){_0x5bafd7=_0x5bafd7||0x1f4;return function(_0x54b88c){logger['error'](_0x54b88c[_0xd25a('0xd')]);if(_0x54b88c[_0xd25a('0xe')]){delete _0x54b88c[_0xd25a('0xe')];}_0x1ae663[_0xd25a('0x9')](_0x5bafd7)[_0xd25a('0xf')](_0x54b88c);};}exports[_0xd25a('0xb')]=function(_0x525e82,_0x320f41){if(_0x525e82[_0xd25a('0x10')][_0xd25a('0x11')]!=='admin')throw new Error(_0xd25a('0x12'));if(isNaN(Number(_0x525e82['params']['id'])))throw new Error(_0xd25a('0x13'));return db[_0xd25a('0x14')][_0xd25a('0x15')]({'where':{'id':_0x525e82[_0xd25a('0x16')]['id']}})['then'](handleEntityNotFound(_0x320f41,null))[_0xd25a('0xc')](saveUpdates(_0x525e82[_0xd25a('0x17')],null))['then'](respondWithResult(_0x320f41,null))[_0xd25a('0x18')](handleError(_0x320f41,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index d668602..0647827 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbca=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3133d3,_0x32f9ef){var _0xe98bb1=function(_0x2b4df5){while(--_0x2b4df5){_0x3133d3['push'](_0x3133d3['shift']());}};_0xe98bb1(++_0x32f9ef);}(_0xfbca,0x9a));var _0xafbc=function(_0x15e807,_0x4880bb){_0x15e807=_0x15e807-0x0;var _0x300e0b=_0xfbca[_0x15e807];return _0x300e0b;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xafbc('0x0')](0x0);var events={'afterCreate':_0xafbc('0x1'),'afterUpdate':'update','afterDestroy':_0xafbc('0x2')};function emitEvent(_0x3e9714){return function(_0xe46f9d,_0x3ee50b,_0x1aff7f){UserSettingEvents[_0xafbc('0x3')](_0x3e9714+':'+_0xe46f9d['id'],_0xe46f9d);UserSettingEvents['emit'](_0x3e9714,_0xe46f9d);_0x1aff7f(null);};}for(var e in events){if(events[_0xafbc('0x4')](e)){var event=events[e];UserSetting[_0xafbc('0x5')](e,emitEvent(event));}}module[_0xafbc('0x6')]=UserSettingEvents; \ No newline at end of file +var _0x2871=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x8d1c0c,_0x53da7c){var _0x3ce8c3=function(_0x12b91d){while(--_0x12b91d){_0x8d1c0c['push'](_0x8d1c0c['shift']());}};_0x3ce8c3(++_0x53da7c);}(_0x2871,0x15a));var _0x1287=function(_0x3d760c,_0x3600e1){_0x3d760c=_0x3d760c-0x0;var _0x399178=_0x2871[_0x3d760c];return _0x399178;};'use strict';var EventEmitter=require(_0x1287('0x0'));var UserSetting=require(_0x1287('0x1'))['db'][_0x1287('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1287('0x3')](0x0);var events={'afterCreate':_0x1287('0x4'),'afterUpdate':'update','afterDestroy':_0x1287('0x5')};function emitEvent(_0x2e6ae1){return function(_0xa47d76,_0x46589e,_0xc2afc3){UserSettingEvents['emit'](_0x2e6ae1+':'+_0xa47d76['id'],_0xa47d76);UserSettingEvents[_0x1287('0x6')](_0x2e6ae1,_0xa47d76);_0xc2afc3(null);};}for(var e in events){if(events[_0x1287('0x7')](e)){var event=events[e];UserSetting[_0x1287('0x8')](e,emitEvent(event));}}module[_0x1287('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 6ecd72e..438d5d5 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24cf=['clientSideLoggingEnabledSince','define','UserSetting','user_settings'];(function(_0xa7657d,_0x16c719){var _0x2c0312=function(_0x3d3f26){while(--_0x3d3f26){_0xa7657d['push'](_0xa7657d['shift']());}};_0x2c0312(++_0x16c719);}(_0x24cf,0x1d5));var _0xf24c=function(_0x28997,_0x1b8246){_0x28997=_0x28997-0x0;var _0x12973f=_0x24cf[_0x28997];return _0x12973f;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x1c670d){return _0x1c670d[_0xf24c('0x0')](_0xf24c('0x1'),attributes,{'tableName':_0xf24c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45f945){if(!_0x45f945['clientSideLoggingEnabled'])_0x45f945[_0xf24c('0x3')]=null;else if(_0x45f945[_0xf24c('0x3')]===null)_0x45f945[_0xf24c('0x3')]=new Date();}}});}; \ No newline at end of file +var _0xeffd=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x1cc161,_0x440a15){var _0x88309c=function(_0x52b501){while(--_0x52b501){_0x1cc161['push'](_0x1cc161['shift']());}};_0x88309c(++_0x440a15);}(_0xeffd,0x6b));var _0xdeff=function(_0x48679a,_0x461b38){_0x48679a=_0x48679a-0x0;var _0x31addd=_0xeffd[_0x48679a];return _0x31addd;};'use strict';var attributes=require(_0xdeff('0x0'));module['exports']=function(_0x1f45fd){return _0x1f45fd[_0xdeff('0x1')](_0xdeff('0x2'),attributes,{'tableName':_0xdeff('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xafbbb1){if(!_0xafbbb1[_0xdeff('0x4')])_0xafbbb1[_0xdeff('0x5')]=null;else if(_0xafbbb1[_0xdeff('0x5')]===null)_0xafbbb1[_0xdeff('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 3dec3f2..477f895 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c10=['length','user-setting:','./user-setting.events','save','update','emit','user-setting:update'];(function(_0x46becf,_0x14443c){var _0x315605=function(_0x523cf8){while(--_0x523cf8){_0x46becf['push'](_0x46becf['shift']());}};_0x315605(++_0x14443c);}(_0x9c10,0x159));var _0x09c1=function(_0x43554e,_0x1e3896){_0x43554e=_0x43554e-0x0;var _0x2e0ff6=_0x9c10[_0x43554e];return _0x2e0ff6;};'use strict';var UserSettingEvents=require(_0x09c1('0x0'));var events=[_0x09c1('0x1'),'remove',_0x09c1('0x2')];function createListener(_0x101ffd,_0x387d84){return function(_0x35da25){_0x387d84[_0x09c1('0x3')](_0x101ffd,_0x35da25);if(_0x101ffd===_0x09c1('0x4')){_0x387d84[_0x09c1('0x3')]('user-setting:update:user-'+_0x35da25['UserId'],_0x35da25);}};}exports['register']=function(_0x3caeb4){for(var _0x56660a=0x0,_0x26888d=events[_0x09c1('0x5')];_0x56660a<_0x26888d;_0x56660a++){var _0x28ac8c=events[_0x56660a];var _0x13d51a=createListener(_0x09c1('0x6')+_0x28ac8c,_0x3caeb4);UserSettingEvents['on'](_0x28ac8c,_0x13d51a);}}; \ No newline at end of file +var _0xfd17=['./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x4f6172,_0x3e1145){var _0x822141=function(_0x490b24){while(--_0x490b24){_0x4f6172['push'](_0x4f6172['shift']());}};_0x822141(++_0x3e1145);}(_0xfd17,0x118));var _0x7fd1=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xfd17[_0xae01dd];return _0x8c26df;};'use strict';var UserSettingEvents=require(_0x7fd1('0x0'));var events=[_0x7fd1('0x1'),_0x7fd1('0x2'),_0x7fd1('0x3')];function createListener(_0x4bc965,_0x50b696){return function(_0x505fec){_0x50b696[_0x7fd1('0x4')](_0x4bc965,_0x505fec);if(_0x4bc965===_0x7fd1('0x5')){_0x50b696[_0x7fd1('0x4')](_0x7fd1('0x6')+_0x505fec[_0x7fd1('0x7')],_0x505fec);}};}exports[_0x7fd1('0x8')]=function(_0xbc7288){for(var _0x376875=0x0,_0xf8ac13=events['length'];_0x376875<_0xf8ac13;_0x376875++){var _0x46f6b6=events[_0x376875];var _0x5943e4=createListener(_0x7fd1('0x9')+_0x46f6b6,_0xbc7288);UserSettingEvents['on'](_0x46f6b6,_0x5943e4);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 582f336..ee63da9 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 _0xae24=['addContacts','post','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','originalname','single','addAvatar','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','/whoami','isAuthenticated','whoami','/presence','getPresence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getSmsInteractions','/:id/fax/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key'];(function(_0x118a88,_0x166f95){var _0x5a5ae7=function(_0x180b2d){while(--_0x180b2d){_0x118a88['push'](_0x118a88['shift']());}};_0x5a5ae7(++_0x166f95);}(_0xae24,0x180));var _0x4ae2=function(_0x94148e,_0x822462){_0x94148e=_0x94148e-0x0;var _0x5bea30=_0xae24[_0x94148e];return _0x5bea30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ae2('0x0'));var timeout=require(_0x4ae2('0x1'));var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require(_0x4ae2('0x4'));var auth=require(_0x4ae2('0x5'));var interaction=require(_0x4ae2('0x6'));var config=require(_0x4ae2('0x7'));var controller=require(_0x4ae2('0x8'));router[_0x4ae2('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ae2('0xa')]);router[_0x4ae2('0x9')](_0x4ae2('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4ae2('0x9')](_0x4ae2('0xc'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0xe')]);router[_0x4ae2('0x9')](_0x4ae2('0xf'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x10')]);router[_0x4ae2('0x9')]('/:id',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x11')]);router['get'](_0x4ae2('0x12'),controller['getAvatar']);router[_0x4ae2('0x9')](_0x4ae2('0x13'),auth['isAuthenticated'](),controller[_0x4ae2('0x14')]);router['get'](_0x4ae2('0x15'),auth[_0x4ae2('0xd')](),controller['getContacts']);router[_0x4ae2('0x9')](_0x4ae2('0x16'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x17')]);router[_0x4ae2('0x9')](_0x4ae2('0x18'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x19')]);router[_0x4ae2('0x9')](_0x4ae2('0x1a'),auth[_0x4ae2('0xd')](),controller['getGroups']);router[_0x4ae2('0x9')](_0x4ae2('0x1b'),auth[_0x4ae2('0xd')](),controller['getRecordings']);router[_0x4ae2('0x9')]('/:id/screen_recordings',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x1c')]);router[_0x4ae2('0x9')]('/:id/chat/interactions',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x1d')]);router[_0x4ae2('0x9')](_0x4ae2('0x1e'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x1f')]);router[_0x4ae2('0x9')]('/:id/mail/interactions',auth[_0x4ae2('0xd')](),controller['getMailInteractions']);router[_0x4ae2('0x9')]('/:id/sms/interactions',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x20')]);router['get'](_0x4ae2('0x21'),auth[_0x4ae2('0xd')](),controller['getFaxInteractions']);router[_0x4ae2('0x9')]('/:id/whatsapp/interactions',auth[_0x4ae2('0xd')](),controller['getWhatsappInteractions']);router[_0x4ae2('0x9')](_0x4ae2('0x22'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x23')]);router[_0x4ae2('0x9')](_0x4ae2('0x24'),auth['isAuthenticated'](),controller[_0x4ae2('0x25')]);router[_0x4ae2('0x9')](_0x4ae2('0x26'),auth[_0x4ae2('0xd')](),controller['getAgents']);router[_0x4ae2('0x9')](_0x4ae2('0x27'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x28')]);router['get'](_0x4ae2('0x29'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x2a')]);router[_0x4ae2('0x9')](_0x4ae2('0x2b'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x2c')]);router[_0x4ae2('0x9')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x4ae2('0x2d'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x2e')]);router[_0x4ae2('0x9')]('/:id/chat_websites',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x2f')]);router[_0x4ae2('0x9')]('/:id/whatsapp_accounts',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x30')]);router[_0x4ae2('0x9')](_0x4ae2('0x31'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x32')]);router[_0x4ae2('0x9')](_0x4ae2('0x33'),auth[_0x4ae2('0xd')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x34')]);router[_0x4ae2('0x35')]('/',auth[_0x4ae2('0xd')](),controller['create']);router[_0x4ae2('0x35')]('/create_many',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x36')]);router['post'](_0x4ae2('0x16'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x37')]);var upload=multer({'storage':multer[_0x4ae2('0x38')]({'destination':function(_0x31d376,_0x5b18a8,_0x4a437b){_0x4a437b(null,path[_0x4ae2('0x39')](config[_0x4ae2('0x3a')],'server/files/images/'));},'filename':function(_0x32f3a0,_0x154930,_0x262007){_0x262007(null,util[_0x4ae2('0x3b')](_0x4ae2('0x3c'),Date['now'](),_0x154930[_0x4ae2('0x3d')]));}})});router[_0x4ae2('0x35')](_0x4ae2('0x12'),upload[_0x4ae2('0x3e')]('file'),controller[_0x4ae2('0x3f')]);router[_0x4ae2('0x35')]('/:id/login',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x40')]);router['post'](_0x4ae2('0x41'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x42')]);router[_0x4ae2('0x35')](_0x4ae2('0x43'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x44')]);router[_0x4ae2('0x35')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x4ae2('0x45')]);router[_0x4ae2('0x35')](_0x4ae2('0x22'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x46')]);router[_0x4ae2('0x35')]('/:id/chat_interactions',auth[_0x4ae2('0xd')](),controller['addChatInteractions']);router[_0x4ae2('0x35')](_0x4ae2('0x47'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x4ae2('0x35')](_0x4ae2('0x48'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x49')]);router[_0x4ae2('0x35')](_0x4ae2('0x4a'),auth[_0x4ae2('0xd')](),controller['addSmsInteractions']);router[_0x4ae2('0x35')](_0x4ae2('0x4b'),auth[_0x4ae2('0xd')](),controller['addOpenchannelInteractions']);router[_0x4ae2('0x35')](_0x4ae2('0x4c'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x4d')]);router['post'](_0x4ae2('0x29'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x4e')]);router[_0x4ae2('0x35')](_0x4ae2('0x2b'),auth['isAuthenticated'](),controller[_0x4ae2('0x4f')]);router[_0x4ae2('0x35')](_0x4ae2('0x50'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x51')]);router['post'](_0x4ae2('0x2d'),auth['isAuthenticated'](),controller[_0x4ae2('0x52')]);router['post'](_0x4ae2('0x53'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x54')]);router['post'](_0x4ae2('0x55'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x56')]);router['post'](_0x4ae2('0x33'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x57')]);router[_0x4ae2('0x58')](_0x4ae2('0x59'),auth['isAuthenticated'](),controller[_0x4ae2('0x5a')]);router[_0x4ae2('0x58')](_0x4ae2('0x5b'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x5c')]);router['delete'](_0x4ae2('0x16'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x5d')]);router[_0x4ae2('0x5e')](_0x4ae2('0x22'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x5f')]);router[_0x4ae2('0x5e')](_0x4ae2('0x59'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x60')]);router[_0x4ae2('0x5e')](_0x4ae2('0x61'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x4ae2('0x5e')](_0x4ae2('0x47'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x62')]);router[_0x4ae2('0x5e')](_0x4ae2('0x48'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x63')]);router[_0x4ae2('0x5e')](_0x4ae2('0x4a'),auth[_0x4ae2('0xd')](),controller['removeSmsInteractions']);router[_0x4ae2('0x5e')](_0x4ae2('0x4b'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x64')]);router[_0x4ae2('0x5e')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x4ae2('0x65')]);router[_0x4ae2('0x5e')](_0x4ae2('0x29'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x4ae2('0x5e')](_0x4ae2('0x2b'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x66')]);router[_0x4ae2('0x5e')]('/:id/openchannel_accounts',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x67')]);router[_0x4ae2('0x5e')](_0x4ae2('0x2d'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x68')]);router[_0x4ae2('0x5e')](_0x4ae2('0x53'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x69')]);router[_0x4ae2('0x5e')]('/:id/whatsapp_accounts',auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x6a')]);router[_0x4ae2('0x5e')](_0x4ae2('0x33'),auth[_0x4ae2('0xd')](),controller[_0x4ae2('0x6b')]);router[_0x4ae2('0x35')]('/:id/messengerSoundNotification',auth[_0x4ae2('0xd')](),controller['messengerSoundNotification']);module[_0x4ae2('0x6c')]=router; \ No newline at end of file +var _0x0a22=['server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeMailAccounts','removeChatWebsites','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','create','post','bulkCreate','addQueues','diskStorage','join','root'];(function(_0x4dfda0,_0x30afa6){var _0x3759c2=function(_0x14484f){while(--_0x14484f){_0x4dfda0['push'](_0x4dfda0['shift']());}};_0x3759c2(++_0x30afa6);}(_0x0a22,0x1eb));var _0x20a2=function(_0x3ce8b8,_0x3c48ff){_0x3ce8b8=_0x3ce8b8-0x0;var _0x575f16=_0x0a22[_0x3ce8b8];return _0x575f16;};'use strict';var multer=require(_0x20a2('0x0'));var util=require(_0x20a2('0x1'));var path=require(_0x20a2('0x2'));var timeout=require(_0x20a2('0x3'));var express=require(_0x20a2('0x4'));var router=express[_0x20a2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x20a2('0x6'));var interaction=require(_0x20a2('0x7'));var config=require(_0x20a2('0x8'));var controller=require(_0x20a2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x20a2('0xa')]);router[_0x20a2('0xb')](_0x20a2('0xc'),auth[_0x20a2('0xd')](),controller['describe']);router['get']('/whoami',auth[_0x20a2('0xd')](),controller['whoami']);router[_0x20a2('0xb')](_0x20a2('0xe'),auth['isAuthenticated'](),controller[_0x20a2('0xf')]);router[_0x20a2('0xb')](_0x20a2('0x10'),auth[_0x20a2('0xd')](),controller['show']);router['get'](_0x20a2('0x11'),controller[_0x20a2('0x12')]);router[_0x20a2('0xb')](_0x20a2('0x13'),auth['isAuthenticated'](),controller[_0x20a2('0x14')]);router['get'](_0x20a2('0x15'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x16')]);router[_0x20a2('0xb')](_0x20a2('0x17'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x18')]);router[_0x20a2('0xb')](_0x20a2('0x19'),auth['isAuthenticated'](),controller[_0x20a2('0x1a')]);router['get'](_0x20a2('0x1b'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x1c')]);router[_0x20a2('0xb')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x20a2('0x1d')]);router[_0x20a2('0xb')](_0x20a2('0x1e'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x1f')]);router[_0x20a2('0xb')]('/:id/chat/interactions',auth[_0x20a2('0xd')](),controller[_0x20a2('0x20')]);router['get'](_0x20a2('0x21'),auth['isAuthenticated'](),controller[_0x20a2('0x22')]);router[_0x20a2('0xb')](_0x20a2('0x23'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x24')]);router[_0x20a2('0xb')](_0x20a2('0x25'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x26')]);router[_0x20a2('0xb')](_0x20a2('0x27'),auth[_0x20a2('0xd')](),controller['getFaxInteractions']);router[_0x20a2('0xb')](_0x20a2('0x28'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x29')]);router['get'](_0x20a2('0x2a'),auth[_0x20a2('0xd')](),controller['getTeams']);router[_0x20a2('0xb')](_0x20a2('0x2b'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x2c')]);router[_0x20a2('0xb')](_0x20a2('0x2d'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x2e')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x20a2('0x2f')]);router[_0x20a2('0xb')](_0x20a2('0x30'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x31')]);router['get'](_0x20a2('0x32'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x33')]);router[_0x20a2('0xb')](_0x20a2('0x34'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x35')]);router[_0x20a2('0xb')](_0x20a2('0x36'),auth[_0x20a2('0xd')](),controller['getSmsAccounts']);router[_0x20a2('0xb')](_0x20a2('0x37'),auth['isAuthenticated'](),controller[_0x20a2('0x38')]);router[_0x20a2('0xb')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x20a2('0x39')]);router[_0x20a2('0xb')](_0x20a2('0x3a'),auth['isAuthenticated'](),controller[_0x20a2('0x3b')]);router[_0x20a2('0xb')](_0x20a2('0x3c'),auth['isAuthenticated'](),controller['getApiKey']);router['post'](_0x20a2('0x15'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x3d')]);router['post']('/',auth[_0x20a2('0xd')](),controller[_0x20a2('0x3e')]);router[_0x20a2('0x3f')]('/create_many',auth[_0x20a2('0xd')](),controller[_0x20a2('0x40')]);router['post'](_0x20a2('0x17'),auth['isAuthenticated'](),controller[_0x20a2('0x41')]);var upload=multer({'storage':multer[_0x20a2('0x42')]({'destination':function(_0x3943b8,_0x3c3c28,_0x5e6004){_0x5e6004(null,path[_0x20a2('0x43')](config[_0x20a2('0x44')],_0x20a2('0x45')));},'filename':function(_0x5800b4,_0x89c08e,_0x18a705){_0x18a705(null,util[_0x20a2('0x46')](_0x20a2('0x47'),Date[_0x20a2('0x48')](),_0x89c08e[_0x20a2('0x49')]));}})});router[_0x20a2('0x3f')]('/:id/avatar',upload['single']('file'),controller[_0x20a2('0x4a')]);router['post']('/:id/login',auth['isAuthenticated'](),controller['login']);router[_0x20a2('0x3f')]('/:id/logout',auth[_0x20a2('0xd')](),controller['logout']);router['post'](_0x20a2('0x4b'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x4c')]);router[_0x20a2('0x3f')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x20a2('0x4d')]);router[_0x20a2('0x3f')]('/:id/teams',auth[_0x20a2('0xd')](),controller[_0x20a2('0x4e')]);router[_0x20a2('0x3f')]('/:id/chat_interactions',auth[_0x20a2('0xd')](),controller[_0x20a2('0x4f')]);router['post'](_0x20a2('0x50'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x51')]);router[_0x20a2('0x3f')](_0x20a2('0x52'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x53')]);router[_0x20a2('0x3f')](_0x20a2('0x54'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x55')]);router[_0x20a2('0x3f')]('/:id/openchannel_interactions',auth[_0x20a2('0xd')](),controller[_0x20a2('0x56')]);router['post'](_0x20a2('0x57'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x58')]);router[_0x20a2('0x3f')](_0x20a2('0x30'),auth['isAuthenticated'](),controller[_0x20a2('0x59')]);router[_0x20a2('0x3f')](_0x20a2('0x32'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5a')]);router[_0x20a2('0x3f')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x20a2('0xd')](),controller[_0x20a2('0x5b')]);router[_0x20a2('0x3f')](_0x20a2('0x37'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5c')]);router[_0x20a2('0x3f')](_0x20a2('0x5d'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5e')]);router[_0x20a2('0x3f')](_0x20a2('0x3c'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x5f')]);router['put']('/:id',auth[_0x20a2('0xd')](),controller['update']);router[_0x20a2('0x60')](_0x20a2('0x61'),auth[_0x20a2('0xd')](),controller['changePassword']);router[_0x20a2('0x62')](_0x20a2('0x17'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x63')]);router['delete'](_0x20a2('0x2a'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x64')]);router[_0x20a2('0x62')](_0x20a2('0x10'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x65')]);router[_0x20a2('0x62')](_0x20a2('0x66'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x67')]);router['delete'](_0x20a2('0x50'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x68')]);router['delete'](_0x20a2('0x52'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x69')]);router['delete'](_0x20a2('0x54'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x20a2('0x62')](_0x20a2('0x6a'),auth[_0x20a2('0xd')](),controller['removeOpenchannelInteractions']);router[_0x20a2('0x62')](_0x20a2('0x57'),auth['isAuthenticated'](),controller[_0x20a2('0x6b')]);router['delete']('/:id/fax_accounts',auth[_0x20a2('0xd')](),controller['removeFaxAccounts']);router[_0x20a2('0x62')](_0x20a2('0x32'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x6c')]);router[_0x20a2('0x62')](_0x20a2('0x34'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x20a2('0x62')](_0x20a2('0x36'),auth[_0x20a2('0xd')](),controller['removeSmsAccounts']);router[_0x20a2('0x62')](_0x20a2('0x37'),auth['isAuthenticated'](),controller[_0x20a2('0x6d')]);router[_0x20a2('0x62')](_0x20a2('0x5d'),auth[_0x20a2('0xd')](),controller['removeWhatsappAccounts']);router[_0x20a2('0x62')](_0x20a2('0x3c'),auth[_0x20a2('0xd')](),controller[_0x20a2('0x6e')]);router[_0x20a2('0x3f')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller['messengerSoundNotification']);module[_0x20a2('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3d13d11..f51fdbe 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 _0x6b8f=['STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','agent','local','INTEGER','accountcode','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','user','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','uac','uas','fingerprint','certificate','passive','actpass','nonat','TEXT','showWebBar','wss','encryption','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','lodash'];(function(_0x12e787,_0x36c9e4){var _0x407e14=function(_0x1b30bf){while(--_0x1b30bf){_0x12e787['push'](_0x12e787['shift']());}};_0x407e14(++_0x36c9e4);}(_0x6b8f,0x105));var _0xf6b8=function(_0xa47f76,_0x1ebb98){_0xa47f76=_0xa47f76-0x0;var _0x428688=_0x6b8f[_0xa47f76];return _0x428688;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var _=require(_0xf6b8('0x2'));module['exports']={'name':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':![],'unique':_0xf6b8('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3887f2){this[_0xf6b8('0x5')](_0xf6b8('0x4'),_0x3887f2);this[_0xf6b8('0x5')](_0xf6b8('0x6'),_0x3887f2);},'comment':_0xf6b8('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x54a89a){this[_0xf6b8('0x5')](_0xf6b8('0x8'),_0x54a89a);this[_0xf6b8('0x5')](_0xf6b8('0x9'),util[_0xf6b8('0xa')](_0xf6b8('0xb'),_0x54a89a,this['getDataValue'](_0xf6b8('0xc'))));}},'alias':{'type':Sequelize[_0xf6b8('0x3')]},'email':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':![],'unique':_0xf6b8('0xd'),'validate':{'isEmail':!![]},'set':function(_0x41d300){if(_0x41d300){this['setDataValue'](_0xf6b8('0xd'),_0x41d300[_0xf6b8('0xe')]());}}},'role':{'type':Sequelize[_0xf6b8('0xf')]('admin','user',_0xf6b8('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf6b8('0x3')],'defaultValue':_0xf6b8('0x11')},'internal':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5b7a8d){this[_0xf6b8('0x5')](_0xf6b8('0xc'),_0x5b7a8d);this[_0xf6b8('0x5')](_0xf6b8('0x13'),_0x5b7a8d);this[_0xf6b8('0x5')](_0xf6b8('0x9'),util['format'](_0xf6b8('0xb'),this[_0xf6b8('0x14')](_0xf6b8('0x8')),_0x5b7a8d));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf6b8('0x3')]},'mobile':{'type':Sequelize[_0xf6b8('0x3')]},'address':{'type':Sequelize[_0xf6b8('0x3')]},'zipcode':{'type':Sequelize[_0xf6b8('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf6b8('0x3')]},'country':{'type':Sequelize[_0xf6b8('0x3')]},'online':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf6b8('0x3')],'defaultValue':_0xf6b8('0x16')},'lastPauseAt':{'type':Sequelize[_0xf6b8('0x17')]},'chatCapacity':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf6b8('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf6b8('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf6b8('0x18')},'ipaddr':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xf6b8('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf6b8('0xf')]('friend',_0xf6b8('0x19'),'peer'),'allowNull':!![],'defaultValue':_0xf6b8('0x1a')},'context':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0xf6b8('0x1b'),_0xf6b8('0x1c'),_0xf6b8('0x1d'),_0xf6b8('0x1e'),_0xf6b8('0x1f'),_0xf6b8('0x20'),'PROHIB_FAILED_SCREEN',_0xf6b8('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![],'defaultValue':_0xf6b8('0x22'),'set':function(_0x17bc7e){this[_0xf6b8('0x5')](_0xf6b8('0x23'),_0x17bc7e?_0x17bc7e[_0xf6b8('0x24')](','):null);},'get':function(){return this[_0xf6b8('0x14')](_0xf6b8('0x23'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xf6b8('0x25'),_0xf6b8('0x26'),_0xf6b8('0x27'),_0xf6b8('0x28'),_0xf6b8('0x29')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no','nonat',_0xf6b8('0x2b'),_0xf6b8('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![],'defaultValue':_0xf6b8('0x2d'),'set':function(_0x5ef6ac){this[_0xf6b8('0x5')](_0xf6b8('0x2e'),_0x5ef6ac?_0x5ef6ac[_0xf6b8('0x24')](','):null);},'get':function(){return this[_0xf6b8('0x14')](_0xf6b8('0x2e'))?this[_0xf6b8('0x14')]('nat')['split'](','):null;},'comment':_0xf6b8('0x2f')},'callgroup':{'type':Sequelize[_0xf6b8('0x3')]},'namedcallgroup':{'type':Sequelize[_0xf6b8('0x3')]},'pickupgroup':{'type':Sequelize[_0xf6b8('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xf6b8('0x3')]},'language':{'type':Sequelize[_0xf6b8('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf6b8('0x3')]},'disallow':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':![],'defaultValue':_0xf6b8('0x30')},'allow':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':![],'defaultValue':_0xf6b8('0x31'),'set':function(_0x3bca88){this[_0xf6b8('0x5')](_0xf6b8('0x32'),_0x3bca88?_0x3bca88[_0xf6b8('0x24')](';'):_0xf6b8('0x31'));},'get':function(){return this['getDataValue'](_0xf6b8('0x32'))?this[_0xf6b8('0x14')](_0xf6b8('0x32'))[_0xf6b8('0x33')](';'):null;},'comment':_0xf6b8('0x34')},'autoframing':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![],'set':function(_0x10ae76){this[_0xf6b8('0x5')](_0xf6b8('0x35'),_0x10ae76?_0x10ae76[_0xf6b8('0x24')](','):null);},'get':function(){return this[_0xf6b8('0x14')](_0xf6b8('0x35'))?this[_0xf6b8('0x14')]('insecure')[_0xf6b8('0x33')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no',_0xf6b8('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![],'defaultValue':_0xf6b8('0x37')},'amaflags':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xf6b8('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf6b8('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no',_0xf6b8('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf6b8('0xf')]('accept','refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x39'),_0xf6b8('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf6b8('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xf6b8('0x2a')},'keepalive':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xf6b8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf6b8('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no',_0xf6b8('0x3b'),_0xf6b8('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf6b8('0xf')]('active',_0xf6b8('0x3d'),_0xf6b8('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf6b8('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xf6b8('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no',_0xf6b8('0x3f'),_0xf6b8('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xf6b8('0x17')]},'passwordResetAt':{'type':Sequelize[_0xf6b8('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf6b8('0x40')]},'showWebBar':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0,'set':function(_0xe10e5f){this[_0xf6b8('0x5')](_0xf6b8('0x41'),_0xe10e5f);var _0x1bb991=this['get']({'plain':!![]});switch(_0xe10e5f){case 0x0:case 0x1:var _0x4515dc=_0x1bb991['transport']?_['isArray'](_0x1bb991['transport'])?_0x1bb991['transport']['join']():_0x1bb991[_0xf6b8('0x23')]:'udp';if(_0x4515dc===_0xf6b8('0x42')){_0x4515dc=_0xf6b8('0x22');}this[_0xf6b8('0x5')](_0xf6b8('0x23'),_0x4515dc);this[_0xf6b8('0x5')](_0xf6b8('0x43'),'no');this[_0xf6b8('0x5')](_0xf6b8('0x44'),null);this[_0xf6b8('0x5')](_0xf6b8('0x45'),null);this['setDataValue'](_0xf6b8('0x46'),null);this['setDataValue']('dtlsenable',null);this[_0xf6b8('0x5')]('dtlsverify',null);this[_0xf6b8('0x5')](_0xf6b8('0x47'),null);this[_0xf6b8('0x5')](_0xf6b8('0x48'),null);this[_0xf6b8('0x5')](_0xf6b8('0x49'),null);this[_0xf6b8('0x5')](_0xf6b8('0x4a'),'no');break;case 0x2:this[_0xf6b8('0x5')]('transport',_0xf6b8('0x42'));this[_0xf6b8('0x5')]('encryption','yes');this['setDataValue']('avpf','yes');this[_0xf6b8('0x5')]('force_avp',_0xf6b8('0x2a'));this['setDataValue'](_0xf6b8('0x46'),'yes');this['setDataValue'](_0xf6b8('0x4b'),_0xf6b8('0x2a'));this[_0xf6b8('0x5')]('dtlsverify','no');this[_0xf6b8('0x5')](_0xf6b8('0x47'),_0xf6b8('0x3e'));this[_0xf6b8('0x5')](_0xf6b8('0x48'),_0x1bb991[_0xf6b8('0x48')]||_0xf6b8('0x4c'));this[_0xf6b8('0x5')](_0xf6b8('0x49'),_0x1bb991['dtlsprivatekey']||_0xf6b8('0x4d'));this['setDataValue'](_0xf6b8('0x4a'),_0xf6b8('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xf6b8('0x40')],'set':function(_0x39fcb8){this['setDataValue'](_0xf6b8('0x4e'),_0x39fcb8?_0x39fcb8[_0xf6b8('0x24')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0xf6b8('0x14')](_0xf6b8('0x4e'))[_0xf6b8('0x33')](','),function(_0x4d0f06){return parseInt(_0x4d0f06,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf6b8('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xf6b8('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf6b8('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf6b8('0xf')](_0xf6b8('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf6b8('0x4f')],'get':function(){return this[_0xf6b8('0x14')](_0xf6b8('0x50'))?this[_0xf6b8('0x14')](_0xf6b8('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf6b8('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![],'set':function(_0x2e9505){if(typeof _0x2e9505==='string'){var _0x49963d=_0x2e9505==='1'?!![]:_0x2e9505==='0'?![]:_0x2e9505===_0xf6b8('0x51')?!![]:_0x2e9505===_0xf6b8('0x52')?![]:![];this[_0xf6b8('0x5')](_0xf6b8('0x53'),_0x49963d);}else{this[_0xf6b8('0x5')](_0xf6b8('0x53'),_0x2e9505);}}},'blocked':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![],'set':function(_0x30f9a1){this[_0xf6b8('0x5')](_0xf6b8('0x54'),_0x30f9a1);if(_0x30f9a1===!![]){this[_0xf6b8('0x5')](_0xf6b8('0x55'),moment());this[_0xf6b8('0x5')](_0xf6b8('0x56'),0x0);}else{this['setDataValue'](_0xf6b8('0x55'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xf6b8('0x12')](0x5)[_0xf6b8('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xf6b8('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xf6b8('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f0e=['ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','telephone','local','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN'];(function(_0x2d8e13,_0x2296b7){var _0xb69c95=function(_0x2d6623){while(--_0x2d6623){_0x2d8e13['push'](_0x2d8e13['shift']());}};_0xb69c95(++_0x2296b7);}(_0x4f0e,0x14f));var _0xe4f0=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x4f0e[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require(_0xe4f0('0x0'));var moment=require(_0xe4f0('0x1'));var util=require(_0xe4f0('0x2'));var _=require('lodash');module[_0xe4f0('0x3')]={'name':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'unique':_0xe4f0('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x39f59c){this[_0xe4f0('0x6')](_0xe4f0('0x5'),_0x39f59c);this['setDataValue'](_0xe4f0('0x7'),_0x39f59c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'set':function(_0x24628b){this[_0xe4f0('0x6')](_0xe4f0('0x8'),_0x24628b);this[_0xe4f0('0x6')](_0xe4f0('0x9'),util[_0xe4f0('0xa')](_0xe4f0('0xb'),_0x24628b,this[_0xe4f0('0xc')](_0xe4f0('0xd'))));}},'alias':{'type':Sequelize[_0xe4f0('0x4')]},'email':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x13e68c){if(_0x13e68c){this[_0xe4f0('0x6')](_0xe4f0('0xe'),_0x13e68c[_0xe4f0('0xf')]());}}},'role':{'type':Sequelize[_0xe4f0('0x10')]('admin',_0xe4f0('0x11'),'agent',_0xe4f0('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe4f0('0x4')],'defaultValue':_0xe4f0('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xe4f0('0xd'),'set':function(_0x1749d7){this['setDataValue'](_0xe4f0('0xd'),_0x1749d7);this[_0xe4f0('0x6')](_0xe4f0('0x14'),_0x1749d7);this[_0xe4f0('0x6')]('callerid',util[_0xe4f0('0xa')](_0xe4f0('0xb'),this[_0xe4f0('0xc')](_0xe4f0('0x8')),_0x1749d7));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe4f0('0x4')]},'mobile':{'type':Sequelize[_0xe4f0('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe4f0('0x4')]},'country':{'type':Sequelize[_0xe4f0('0x4')]},'online':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe4f0('0x16')]},'voicePause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xe4f0('0x17')},'lastPauseAt':{'type':Sequelize[_0xe4f0('0x16')]},'chatCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe4f0('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xe4f0('0x11'),_0xe4f0('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x1a'),_0xe4f0('0x1b'),_0xe4f0('0x1c'),_0xe4f0('0x1d'),'PROHIB_NOT_SCREENED',_0xe4f0('0x1e'),_0xe4f0('0x1f'),_0xe4f0('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'defaultValue':_0xe4f0('0x21'),'set':function(_0x1ed595){this[_0xe4f0('0x6')](_0xe4f0('0x22'),_0x1ed595?_0x1ed595[_0xe4f0('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0xe4f0('0x22'))[_0xe4f0('0x24')](','):null;},'comment':_0xe4f0('0x25')},'dtmfmode':{'type':Sequelize[_0xe4f0('0x10')]('rfc2833',_0xe4f0('0x26'),_0xe4f0('0x27'),_0xe4f0('0x28'),'auto'),'allowNull':!![],'defaultValue':_0xe4f0('0x29')},'directmedia':{'type':Sequelize[_0xe4f0('0x10')]('yes','no',_0xe4f0('0x2a'),'update',_0xe4f0('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe4f0('0x2d'),'set':function(_0x3d2bc9){this['setDataValue'](_0xe4f0('0x2e'),_0x3d2bc9?_0x3d2bc9[_0xe4f0('0x23')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xe4f0('0xc')](_0xe4f0('0x2e'))['split'](','):null;},'comment':_0xe4f0('0x2f')},'callgroup':{'type':Sequelize[_0xe4f0('0x4')]},'namedcallgroup':{'type':Sequelize[_0xe4f0('0x4')]},'pickupgroup':{'type':Sequelize[_0xe4f0('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xe4f0('0x4')]},'language':{'type':Sequelize[_0xe4f0('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe4f0('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4e8654){this['setDataValue'](_0xe4f0('0x30'),_0x4e8654?_0x4e8654['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe4f0('0xc')]('allow')?this[_0xe4f0('0xc')](_0xe4f0('0x30'))[_0xe4f0('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'set':function(_0x1cb6f1){this[_0xe4f0('0x6')](_0xe4f0('0x31'),_0x1cb6f1?_0x1cb6f1[_0xe4f0('0x23')](','):null);},'get':function(){return this[_0xe4f0('0xc')](_0xe4f0('0x31'))?this['getDataValue'](_0xe4f0('0x31'))['split'](','):null;},'comment':_0xe4f0('0x32')},'trustrpid':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xe4f0('0x2c')},'busylevel':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no',_0xe4f0('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x34'),_0xe4f0('0x35'),_0xe4f0('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x37'),'uas'),'allowNull':!![],'defaultValue':_0xe4f0('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xe4f0('0x2c')},'keepalive':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no','fingerprint',_0xe4f0('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe4f0('0x3a'),_0xe4f0('0x3b'),_0xe4f0('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xe4f0('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe4f0('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no','nonat',_0xe4f0('0x3d'),_0xe4f0('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe4f0('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe4f0('0x16')]},'passwordResetAt':{'type':Sequelize[_0xe4f0('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe4f0('0x3f')]},'showWebBar':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0,'set':function(_0x27276b){this['setDataValue'](_0xe4f0('0x40'),_0x27276b);var _0x1cf78f=this[_0xe4f0('0x41')]({'plain':!![]});switch(_0x27276b){case 0x0:case 0x1:var _0x23a7dd=_0x1cf78f[_0xe4f0('0x22')]?_[_0xe4f0('0x42')](_0x1cf78f[_0xe4f0('0x22')])?_0x1cf78f['transport'][_0xe4f0('0x23')]():_0x1cf78f['transport']:'udp';if(_0x23a7dd===_0xe4f0('0x43')){_0x23a7dd=_0xe4f0('0x21');}this['setDataValue'](_0xe4f0('0x22'),_0x23a7dd);this[_0xe4f0('0x6')]('encryption','no');this[_0xe4f0('0x6')](_0xe4f0('0x44'),null);this[_0xe4f0('0x6')]('force_avp',null);this[_0xe4f0('0x6')](_0xe4f0('0x45'),null);this['setDataValue'](_0xe4f0('0x46'),null);this[_0xe4f0('0x6')](_0xe4f0('0x47'),null);this[_0xe4f0('0x6')](_0xe4f0('0x48'),null);this['setDataValue'](_0xe4f0('0x49'),null);this[_0xe4f0('0x6')](_0xe4f0('0x4a'),null);this['setDataValue'](_0xe4f0('0x4b'),'no');break;case 0x2:this[_0xe4f0('0x6')](_0xe4f0('0x22'),_0xe4f0('0x43'));this[_0xe4f0('0x6')]('encryption',_0xe4f0('0x2c'));this[_0xe4f0('0x6')]('avpf',_0xe4f0('0x2c'));this['setDataValue'](_0xe4f0('0x4c'),_0xe4f0('0x2c'));this[_0xe4f0('0x6')](_0xe4f0('0x45'),_0xe4f0('0x2c'));this[_0xe4f0('0x6')](_0xe4f0('0x46'),'yes');this['setDataValue'](_0xe4f0('0x47'),'no');this['setDataValue'](_0xe4f0('0x48'),_0xe4f0('0x3c'));this[_0xe4f0('0x6')]('dtlscertfile',_0x1cf78f[_0xe4f0('0x49')]||_0xe4f0('0x4d'));this[_0xe4f0('0x6')](_0xe4f0('0x4a'),_0x1cf78f[_0xe4f0('0x4a')]||_0xe4f0('0x4e'));this[_0xe4f0('0x6')](_0xe4f0('0x4b'),_0xe4f0('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xe4f0('0x3f')],'set':function(_0x348c88){this[_0xe4f0('0x6')]('permissions',_0x348c88?_0x348c88[_0xe4f0('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0xe4f0('0x4f'))?_[_0xe4f0('0x50')](this['getDataValue'](_0xe4f0('0x4f'))[_0xe4f0('0x24')](','),function(_0x1a8b75){return parseInt(_0x1a8b75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe4f0('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe4f0('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe4f0('0x10')](_0xe4f0('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xe4f0('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe4f0('0x51')],'get':function(){return this[_0xe4f0('0xc')](_0xe4f0('0x52'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe4f0('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf52159){if(typeof _0xf52159===_0xe4f0('0x53')){var _0x38a050=_0xf52159==='1'?!![]:_0xf52159==='0'?![]:_0xf52159===_0xe4f0('0x54')?!![]:_0xf52159===_0xe4f0('0x55')?![]:![];this[_0xe4f0('0x6')](_0xe4f0('0x56'),_0x38a050);}else{this[_0xe4f0('0x6')](_0xe4f0('0x56'),_0xf52159);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f1a75){this[_0xe4f0('0x6')](_0xe4f0('0x57'),_0x4f1a75);if(_0x4f1a75===!![]){this['setDataValue']('blockedAt',moment());this[_0xe4f0('0x6')](_0xe4f0('0x58'),0x0);}else{this[_0xe4f0('0x6')](_0xe4f0('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xe4f0('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xe4f0('0x18')](0x5)[_0xe4f0('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xe4f0('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xe4f0('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d9af245..a1a8088 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 _0x2f37=['socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','concat','isMiddleware','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','smsPause','pauseType','lastPauseAt','getTeams','addTeams','resolve','transaction','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','getDataValue','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','Team','removeAgent','VoicePrefixId','getLists','getAgents','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','firstName','phone','dialActive','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','whoami','getUserSetting','getPresence','idle','unknown','ringing','teams','inbound','flatten','toString','col','asc','substring','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','QueryTypes','select','field','InteractionId','_interactions','OpenTabs','messengerSoundNotification','moment','util','path','lodash','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','defaults','http','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','request','then','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','User,\x20%s,\x20%s','message','result','catch','role','agent','emit','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','destroy','stack','send','User','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','md5secret','index','getOptions','where','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','fax','mail','whatsapp','includeAll','options','openchannel','all','update','body','params','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','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)','SELECT','length','from','voicemail','mailbox','VoiceMail','permissions','101','102','113','110','104','105','106','107','108','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','QueueId','VoiceQueue','get','voice','online','format','SIP/%s','upsert','removeQueues','remove','Queues','isArray','Queue:remove','UserVoiceQueueRt','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','tag','model','keys','Queue','filters','intersection','fields','order','sort','pick','merge','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x2f37,0x89));var _0x72f3=function(_0x5eba9e,_0x4d96bf){_0x5eba9e=_0x5eba9e-0x0;var _0x12b081=_0x2f37[_0x5eba9e];return _0x12b081;};'use strict';var moment=require(_0x72f3('0x0'));var util=require(_0x72f3('0x1'));var path=require(_0x72f3('0x2'));var fs=require('fs');var _=require(_0x72f3('0x3'));var squel=require('squel');var Redis=require(_0x72f3('0x4'));var jayson=require('jayson/promise');var authService=require(_0x72f3('0x5'));var contacts=require(_0x72f3('0x6'));var qs=require(_0x72f3('0x7'));var rta=require(_0x72f3('0x8'));var logger=require(_0x72f3('0x9'))(_0x72f3('0xa'));var utils=require(_0x72f3('0xb'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x72f3('0xc'))[_0x72f3('0xd')];var APINotFoundError=require(_0x72f3('0xc'))['APINotFoundError'];var APIForbiddenError=require(_0x72f3('0xc'))['APIForbiddenrror'];var APIHandleError=require(_0x72f3('0xc'))[_0x72f3('0xe')];var db=require(_0x72f3('0xf'))['db'];var socket=require(_0x72f3('0x10'))(new Redis(config['redis']));require('./user.socket')['register'](socket);config[_0x72f3('0x11')]=_[_0x72f3('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var amiClient=jayson['client'][_0x72f3('0x13')]({'port':0x232a});var values;function respondWithStatusCode(_0x306622,_0x7fd315){_0x7fd315=_0x7fd315||0xcc;return function(_0x5cab87){if(_0x5cab87){return _0x306622[_0x72f3('0x14')](_0x7fd315);}return _0x306622[_0x72f3('0x15')](_0x7fd315)[_0x72f3('0x16')]();};}function respondWithResult(_0x4e2f5a,_0x23e0b8){_0x23e0b8=_0x23e0b8||0xc8;return function(_0x4aee04){if(_0x4aee04){return _0x4e2f5a['status'](_0x23e0b8)[_0x72f3('0x17')](_0x4aee04);}};}function respondWithFilteredResult(_0x389678,_0x475168){return function(_0x55997b){if(_0x55997b){var _0x1c02f3=typeof _0x475168[_0x72f3('0x18')]==='undefined'&&typeof _0x475168[_0x72f3('0x19')]===_0x72f3('0x1a');var _0x438db8=_0x55997b[_0x72f3('0x1b')];var _0x3c87fa=_0x1c02f3?0x0:_0x475168['offset'];var _0x2142c8=_0x1c02f3?_0x55997b[_0x72f3('0x1b')]:_0x475168[_0x72f3('0x18')]+_0x475168[_0x72f3('0x19')];var _0x52157f;if(_0x2142c8>=_0x438db8){_0x2142c8=_0x438db8;_0x52157f=0xc8;}else{_0x52157f=0xce;}_0x389678['status'](_0x52157f);return _0x389678[_0x72f3('0x1c')](_0x72f3('0x1d'),_0x3c87fa+'-'+_0x2142c8+'/'+_0x438db8)[_0x72f3('0x17')](_0x55997b);}return null;};}function respondWithRpcPromise(_0x200118,_0x4b488b,_0x3627c4,_0x10d982){return new Promise(function(_0x46177c,_0xe45db8){var _0x440354=_0x10d982||amiClient;return _0x440354[_0x72f3('0x1e')](_0x200118,_0x3627c4)[_0x72f3('0x1f')](function(_0x311765){logger[_0x72f3('0x20')]('User,\x20%s,\x20%s',_0x4b488b,_0x72f3('0x21'));logger['debug'](_0x72f3('0x22'),_0x4b488b,'request\x20sent',JSON['stringify'](_0x311765));if(_0x311765[_0x72f3('0x23')]){if(_0x311765['error'][_0x72f3('0x24')]===0x1f4){logger[_0x72f3('0x23')](_0x72f3('0x25'),_0x4b488b,_0x311765[_0x72f3('0x23')][_0x72f3('0x26')]);return _0xe45db8(_0x311765['error'][_0x72f3('0x26')]);}logger[_0x72f3('0x23')](_0x72f3('0x25'),_0x4b488b,_0x311765[_0x72f3('0x23')][_0x72f3('0x26')]);return _0x46177c(_0x311765[_0x72f3('0x23')][_0x72f3('0x26')]);}else{logger['info'](_0x72f3('0x25'),_0x4b488b,_0x72f3('0x21'));_0x46177c(_0x311765[_0x72f3('0x27')][_0x72f3('0x26')]);}})[_0x72f3('0x28')](function(_0x42e2d9){logger[_0x72f3('0x23')]('User,\x20%s,\x20%s',_0x4b488b,_0x42e2d9);_0xe45db8(_0x42e2d9);});});}function saveUpdates(_0x2ae62b){return function(_0x39361f){if(_0x39361f){return _0x39361f['update'](_0x2ae62b)['then'](function(_0x2b9ac6){if(_0x2b9ac6[_0x72f3('0x29')]===_0x72f3('0x2a')){socket[_0x72f3('0x2b')]('userNotification:recalc:'+_0x2b9ac6['id'],_0x2b9ac6);}return _0x2b9ac6;});}return null;};}function removeEntity(_0x4f8a62,_0x21b5bd){return function(_0x52a8d7){if(_0x52a8d7){return _0x52a8d7['destroy']({'transaction':_0x21b5bd})[_0x72f3('0x1f')](function(){var _0x4185c5=_0x52a8d7['get']({'plain':!![]});if(_0x4185c5[_0x72f3('0x29')]===_0x72f3('0x2c'))return;var _0x35d2a9=[{'name':_0x72f3('0x2d'),'value':_0x72f3('0x2e'),'ignore':!![]},{'name':_0x72f3('0x2f'),'value':_0x72f3('0x2a'),'ignore':![]},{'name':_0x72f3('0x30'),'value':_0x72f3('0x31'),'ignore':![]}];var _0x1daf98=_(_0x35d2a9)[_0x72f3('0x32')](_0x72f3('0x33'))[_0x72f3('0x34')](_0x72f3('0x35'))['value']();if(_[_0x72f3('0x36')](_0x1daf98,_0x4185c5[_0x72f3('0x29')])){return;}var _0x189cb3=_[_0x72f3('0x37')](_0x35d2a9,['value',_0x4185c5[_0x72f3('0x29')]])[_0x72f3('0x38')];return db[_0x72f3('0x39')][_0x72f3('0x3a')]({'where':{'type':_0x189cb3,'resourceId':_0x4185c5['id']},'transaction':_0x21b5bd})[_0x72f3('0x1f')](function(){return _0x52a8d7;});})['then'](function(){_0x4f8a62[_0x72f3('0x15')](0xcc)[_0x72f3('0x16')]();});}};}function handleEntityNotFound(_0x16dcea){return function(_0x3d7e85){if(!_0x3d7e85){_0x16dcea['sendStatus'](0x194);}return _0x3d7e85;};}function handleError(_0x529028,_0x13eb5c){_0x13eb5c=_0x13eb5c||0x1f4;return function(_0x24bebc){logger[_0x72f3('0x23')](_0x24bebc[_0x72f3('0x3b')]);if(_0x24bebc[_0x72f3('0x38')]){delete _0x24bebc[_0x72f3('0x38')];}_0x529028[_0x72f3('0x15')](_0x13eb5c)[_0x72f3('0x3c')](_0x24bebc);};}function getUserAttributes(){return _(db[_0x72f3('0x3d')][_0x72f3('0x3e')])[_0x72f3('0x34')](function(_0x3fe179){return{'name':_0x3fe179[_0x72f3('0x3f')],'type':_0x3fe179[_0x72f3('0x40')][_0x72f3('0x41')]};})['filter'](function(_0x266b33){return![_0x72f3('0x42'),_0x72f3('0x43'),_0x72f3('0x44'),_0x72f3('0x45'),'resetPasswordExpires',_0x72f3('0x46')][_0x72f3('0x36')](_0x266b33[_0x72f3('0x38')]);})[_0x72f3('0x35')]();}exports[_0x72f3('0x47')]=function(_0x164d30,_0x1c469e){var _0x2cc6f6={},_0x43ee82={'count':0x0,'rows':[]};var _0xbb2715=getUserAttributes();_0x2cc6f6=qs[_0x72f3('0x48')](_0xbb2715,_0x164d30);var _0x182467={'where':_0x2cc6f6[_0x72f3('0x49')]};return db[_0x72f3('0x3d')]['count'](_0x182467)[_0x72f3('0x1f')](function(_0xae1332){_0x43ee82[_0x72f3('0x1b')]=_0xae1332;if(_0x164d30['query']['includeAll']){_0x2cc6f6[_0x72f3('0x4a')]=[{'all':!![]}];}if(_0x164d30[_0x72f3('0x4b')][_0x72f3('0x4c')]===_0x72f3('0x4d')){_0x2cc6f6[_0x72f3('0x4a')]=[{'model':db[_0x72f3('0x4e')],'as':_0x72f3('0x4c')}];}if(!_[_0x72f3('0x36')](_0x2cc6f6['attributes'],'id')){_0x2cc6f6[_0x72f3('0x4f')][_0x72f3('0x50')]('id');}return db[_0x72f3('0x3d')][_0x72f3('0x51')](_0x2cc6f6);})[_0x72f3('0x1f')](function(_0x530b94){_0x43ee82[_0x72f3('0x52')]=_0x530b94;if(_0x164d30[_0x72f3('0x4b')][_0x72f3('0x53')]===_0x72f3('0x4d')){var _0x155348=[];for(var _0x4241b5=0x0;_0x4241b5<_0x43ee82[_0x72f3('0x52')]['length'];_0x4241b5++){_0x155348['push'](get_open_tabs(_0x72f3('0x54'),_0x43ee82[_0x72f3('0x52')][_0x4241b5][_0x72f3('0x55')]));_0x155348[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x56'),_0x43ee82[_0x72f3('0x52')][_0x4241b5][_0x72f3('0x55')]));_0x155348[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x57'),_0x43ee82[_0x72f3('0x52')][_0x4241b5][_0x72f3('0x55')]));_0x155348[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x58'),_0x43ee82[_0x72f3('0x52')][_0x4241b5]['dataValues']));_0x155348['push'](get_open_tabs('openchannel',_0x43ee82[_0x72f3('0x52')][_0x4241b5]['dataValues']));_0x155348[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x59'),_0x43ee82[_0x72f3('0x52')][_0x4241b5][_0x72f3('0x55')]));}return Promise['all'](_0x155348)[_0x72f3('0x1f')](function(){return _0x43ee82;});}else{return _0x43ee82;}})[_0x72f3('0x1f')](respondWithFilteredResult(_0x1c469e,_0x2cc6f6))[_0x72f3('0x28')](handleError(_0x1c469e,null));};exports['show']=function(_0xc1469b,_0x4b2b91){var _0x39a113=getUserAttributes();_0xc1469b['query']['id']=_0xc1469b['params']['id'];var _0x3ce1b7=qs[_0x72f3('0x48')](_0x39a113,_0xc1469b);if(_0xc1469b[_0x72f3('0x4b')][_0x72f3('0x5a')]){_0x3ce1b7[_0x72f3('0x4a')]=[{'all':!![]}];}if(_0xc1469b['query'][_0x72f3('0x4c')]===_0x72f3('0x4d')){_0x3ce1b7['include']=[{'model':db[_0x72f3('0x4e')],'as':_0x72f3('0x4c')}];}_0x3ce1b7=_['merge']({},_0x3ce1b7,_0xc1469b[_0x72f3('0x5b')]);if(!_[_0x72f3('0x36')](_0x3ce1b7[_0x72f3('0x4f')],'id')){_0x3ce1b7[_0x72f3('0x4f')][_0x72f3('0x50')]('id');}return db[_0x72f3('0x3d')][_0x72f3('0x37')](_0x3ce1b7)['then'](handleEntityNotFound(_0x4b2b91,null))[_0x72f3('0x1f')](function(_0x1b3ac9){var _0x376197=[];values=_0x1b3ac9;if(_0xc1469b[_0x72f3('0x4b')]['openTabs']===_0x72f3('0x4d')){_0x376197[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x54'),_0x1b3ac9['dataValues']));_0x376197[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x56'),_0x1b3ac9[_0x72f3('0x55')]));_0x376197['push'](get_open_tabs(_0x72f3('0x5c'),_0x1b3ac9[_0x72f3('0x55')]));_0x376197['push'](get_open_tabs(_0x72f3('0x59'),_0x1b3ac9[_0x72f3('0x55')]));_0x376197[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x57'),_0x1b3ac9[_0x72f3('0x55')]));_0x376197[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x58'),_0x1b3ac9[_0x72f3('0x55')]));return Promise[_0x72f3('0x5d')](_0x376197);}else{return values;}})[_0x72f3('0x1f')](function(){return values;})['then'](respondWithResult(_0x4b2b91,null))[_0x72f3('0x28')](handleError(_0x4b2b91,null));};exports[_0x72f3('0x5e')]=function(_0x3ce1c3,_0x285392){if(_0x3ce1c3[_0x72f3('0x5f')]['id']){delete _0x3ce1c3[_0x72f3('0x5f')]['id'];}delete _0x3ce1c3['body'][_0x72f3('0x29')];return db[_0x72f3('0x3d')][_0x72f3('0x37')]({'where':{'id':_0x3ce1c3[_0x72f3('0x60')]['id']}})['then'](handleEntityNotFound(_0x285392,null))[_0x72f3('0x1f')](saveUpdates(_0x3ce1c3['body'],null))[_0x72f3('0x1f')](respondWithResult(_0x285392,null))[_0x72f3('0x28')](handleError(_0x285392,null));};exports[_0x72f3('0x61')]=function(_0x2035e5,_0x20d0e6){return db[_0x72f3('0x3d')]['describe']()['then'](respondWithResult(_0x20d0e6,null))[_0x72f3('0x28')](handleError(_0x20d0e6,null));};exports[_0x72f3('0x62')]=function(_0x15ff44,_0x210111){return db[_0x72f3('0x3d')]['find']({'where':{'id':_0x15ff44[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x210111,null))[_0x72f3('0x1f')](function(_0x4b0dea){if(_0x4b0dea){return _0x4b0dea[_0x72f3('0x62')](_0x15ff44['body'][_0x72f3('0x63')],_[_0x72f3('0x64')](_0x15ff44[_0x72f3('0x5f')],['ids','id'])||{});}})[_0x72f3('0x1f')](respondWithResult(_0x210111,null))[_0x72f3('0x28')](handleError(_0x210111,null));};function validateUser(_0x2e59a4){return new Promise(function(_0xda585,_0xf4cfe7){if(_0x2e59a4[_0x72f3('0x65')])return _0xda585(_0x2e59a4);return db[_0x72f3('0x66')][_0x72f3('0x67')](0x1)[_0x72f3('0x1f')](function(_0x11a6f8){if(_0x11a6f8['securePassword'])authService[_0x72f3('0x68')](_0x2e59a4[_0x72f3('0x42')]);db[_0x72f3('0x3d')][_0x72f3('0x69')](_0x72f3('0x65'))[_0x72f3('0x1f')](function(_0x142b01){if(_[_0x72f3('0x6a')](_0x142b01)){_0x2e59a4['internal']=_0x11a6f8[_0x72f3('0x6b')]||0x1;return;}if(_[_0x72f3('0x6a')](_0x11a6f8[_0x72f3('0x6b')])||_0x11a6f8[_0x72f3('0x6b')]===_0x142b01){_0x2e59a4[_0x72f3('0x65')]=_0x142b01+0x1;return;}if(_0x11a6f8[_0x72f3('0x6b')]>_0x142b01){_0x2e59a4[_0x72f3('0x65')]=_0x11a6f8[_0x72f3('0x6b')];return;}return db[_0x72f3('0x6c')]['query'](_0x72f3('0x6d'),{'type':db[_0x72f3('0x6c')]['QueryTypes'][_0x72f3('0x6e')]})['then'](function(_0x1e5b6a){if(_0x1e5b6a&&_0x1e5b6a['length']){for(var _0x4c252c=0x0,_0x358ab6=_0x1e5b6a[_0x72f3('0x6f')];_0x4c252c<_0x358ab6&&_[_0x72f3('0x6a')](_0x2e59a4[_0x72f3('0x65')]);_0x4c252c++){if(_0x11a6f8[_0x72f3('0x6b')]<=_0x1e5b6a[_0x4c252c][_0x72f3('0x70')]){_0x2e59a4[_0x72f3('0x65')]=_0x1e5b6a[_0x4c252c][_0x72f3('0x70')];}else if(_0x11a6f8[_0x72f3('0x6b')]>_0x1e5b6a[_0x4c252c]['from']&&_0x11a6f8[_0x72f3('0x6b')]<=_0x1e5b6a[_0x4c252c]['to']){_0x2e59a4[_0x72f3('0x65')]=_0x11a6f8['min_internal'];}}}if(_[_0x72f3('0x6a')](_0x2e59a4[_0x72f3('0x65')])){_0x2e59a4[_0x72f3('0x65')]=_0x142b01+0x1;}return _0xda585(_0x2e59a4);});});})[_0x72f3('0x28')](function(_0x85472a){_0xf4cfe7(_0x85472a);});});}function updateUser(_0x14af22){return new Promise(function(_0x152a82,_0x4b269c){try{if(_0x14af22[_0x72f3('0x71')]){_0x14af22[_0x72f3('0x72')]=_0x14af22[_0x72f3('0x65')];_0x14af22[_0x72f3('0x73')]={'mailbox':_0x14af22[_0x72f3('0x65')],'password':_0x14af22[_0x72f3('0x42')],'fullname':_0x14af22['fullname'],'email':_0x14af22['email']};}if(_0x14af22[_0x72f3('0x29')]===_0x72f3('0x2a')){if(!_0x14af22[_0x72f3('0x74')])_0x14af22[_0x72f3('0x74')]=[_0x72f3('0x75'),_0x72f3('0x76'),'103',_0x72f3('0x77'),_0x72f3('0x78'),_0x72f3('0x79'),_0x72f3('0x7a'),_0x72f3('0x7b'),_0x72f3('0x7c'),_0x72f3('0x7d'),'109',_0x72f3('0x7e'),_0x72f3('0x7f'),_0x72f3('0x80'),_0x72f3('0x81')];}_0x152a82(_0x14af22);}catch(_0x7e6967){_0x4b269c(_0x7e6967);}});}exports[_0x72f3('0x82')]=function(_0xcd0a72,_0xef77a4){if(_0xcd0a72[_0x72f3('0x2e')][_0x72f3('0x29')]===_0x72f3('0x2a'))throw new Error('Unauthorized');if(_0xcd0a72[_0x72f3('0x5f')][_0x72f3('0x29')]===_0x72f3('0x2e')&&_0xcd0a72['user'][_0x72f3('0x29')]!==_0x72f3('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xcd0a72['body'][_0x72f3('0x29')]===_0x72f3('0x2c')&&_0xcd0a72[_0x72f3('0x2e')]['role']!==_0x72f3('0x2c')){throw new Error(_0x72f3('0x83'));}return licenseUtil[_0x72f3('0x84')]([_0xcd0a72['body']])['then'](function(){return validateUser(_0xcd0a72['body']);})[_0x72f3('0x1f')](function(_0x28d333){return updateUser(_0x28d333)[_0x72f3('0x1f')](function(_0x4a6141){if(_0x4a6141['role']===_0x72f3('0x2c')){_0x4a6141[_0x72f3('0x85')]=_0xcd0a72[_0x72f3('0x2e')][_0x72f3('0x85')];delete _0x4a6141[_0x72f3('0x86')];}return _0x4a6141;});})[_0x72f3('0x1f')](function(_0x4d22ca){return db['User']['create'](_0x4d22ca,{'include':[{'model':db[_0x72f3('0x73')],'as':_0x72f3('0x73')}]});})[_0x72f3('0x1f')](function(_0x4d8cd5){if(_0xcd0a72['body'][_0x72f3('0x29')]===_0x72f3('0x2e'))return _0x4d8cd5;if(_0xcd0a72[_0x72f3('0x2e')][_0x72f3('0x29')]!==_0x72f3('0x2e'))return _0x4d8cd5;return db['UserProfileSection']['find']({'where':{'name':_0x4d8cd5['role']==='agent'?'Agents':_0x72f3('0x30'),'userProfileId':_0xcd0a72['user'][_0x72f3('0x86')]},'raw':!![]})[_0x72f3('0x1f')](function(_0x7bc2d5){if(!_0x7bc2d5||_0x7bc2d5['autoAssociation']!=0x0)return _0x4d8cd5;return db[_0x72f3('0x39')][_0x72f3('0x82')]({'name':_0x4d8cd5[_0x72f3('0x38')],'resourceId':_0x4d8cd5['id'],'type':_0x7bc2d5[_0x72f3('0x38')],'sectionId':_0x7bc2d5['id']},{})['then'](function(){return _0x4d8cd5;});})[_0x72f3('0x28')](function(_0x407318){logger[_0x72f3('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x407318);throw _0x407318;});})[_0x72f3('0x1f')](respondWithResult(_0xef77a4,0xc9))['catch'](handleError(_0xef77a4,null));};exports[_0x72f3('0x87')]=function(_0xd9d01a,_0x2d396e){var _0x2b33ae=_0xd9d01a[_0x72f3('0x5f')];var _0x3ffe64=[];if(_0xd9d01a[_0x72f3('0x2e')][_0x72f3('0x29')]===_0x72f3('0x2a'))throw new Error(_0x72f3('0x88'));if(_[_0x72f3('0x89')](_0x2b33ae,['role',_0x72f3('0x2e')])&&_0xd9d01a[_0x72f3('0x2e')][_0x72f3('0x29')]!==_0x72f3('0x2c')){throw new Error(_0x72f3('0x8a'));}if(_[_0x72f3('0x89')](_0x2b33ae,[_0x72f3('0x29'),_0x72f3('0x2c')])&&_0xd9d01a[_0x72f3('0x2e')][_0x72f3('0x29')]!=='admin'){throw new Error(_0x72f3('0x8b'));}return licenseUtil[_0x72f3('0x84')](_0x2b33ae)[_0x72f3('0x1f')](function(){return validateUser(_0x2b33ae[0x0]);})['then'](function(){for(var _0x1096a6=0x1;_0x1096a6<_0x2b33ae[_0x72f3('0x6f')];_0x1096a6++){var _0x25999c=_0x2b33ae[_0x1096a6-0x1][_0x72f3('0x65')];if(!_0x2b33ae[_0x1096a6][_0x72f3('0x65')])_0x2b33ae[_0x1096a6][_0x72f3('0x65')]=_0x25999c+0x1;_0x3ffe64[_0x72f3('0x50')](validateUser(_0x2b33ae[_0x1096a6]));}return Promise[_0x72f3('0x5d')](_0x3ffe64);})[_0x72f3('0x1f')](function(){_0x3ffe64=[];for(var _0x5bd05e=0x0;_0x5bd05e<_0x2b33ae['length'];_0x5bd05e++){_0x3ffe64[_0x72f3('0x50')](updateUser(_0x2b33ae[_0x5bd05e]));}return Promise[_0x72f3('0x5d')](_0x3ffe64);})[_0x72f3('0x1f')](function(){_0x3ffe64=_0x2b33ae[_0x72f3('0x34')](function(_0x76747c){return db[_0x72f3('0x3d')][_0x72f3('0x82')](_0x76747c,{'include':[{'model':db[_0x72f3('0x73')],'as':'VoiceMail'}]})['then'](function(_0x55b5b6){_0x76747c['id']=_0x55b5b6['id'];return _0x76747c;});});return Promise[_0x72f3('0x5d')](_0x3ffe64);})['then'](function(_0x5e9c6d){if(_0xd9d01a[_0x72f3('0x5f')]['role']===_0x72f3('0x2e'))return _0x5e9c6d;if(_0xd9d01a[_0x72f3('0x2e')]['role']!=='user')return _0x5e9c6d;var _0x405c57=_[_0x72f3('0x89')](_0x5e9c6d,function(_0x57c7a0){return _0x57c7a0[_0x72f3('0x29')]===_0x72f3('0x2a')||_0x57c7a0[_0x72f3('0x29')]===_0x72f3('0x31');});if(!_0x405c57)return _0x5e9c6d;return db[_0x72f3('0x8c')][_0x72f3('0x51')]({'where':{'name':{'$or':[_0x72f3('0x2f'),'Telephones']},'userProfileId':_0xd9d01a[_0x72f3('0x2e')][_0x72f3('0x86')]},'raw':!![]})[_0x72f3('0x1f')](function(_0x116e07){if(_[_0x72f3('0x8d')](_0x116e07)||!_['some'](_0x116e07,[_0x72f3('0x8e'),0x0]))return _0x5e9c6d;_0x3ffe64=[];var _0x31242e=_(_0x116e07)[_0x72f3('0x34')](function(_0xc02c28){if(_0xc02c28[_0x72f3('0x8e')]===0x1)return;return _0xc02c28[_0x72f3('0x38')]===_0x72f3('0x2f')?_0x72f3('0x2a'):'telephone';})[_0x72f3('0x8f')]()[_0x72f3('0x35')]();for(var _0x30e2a3=0x0;_0x30e2a3<_0x5e9c6d[_0x72f3('0x6f')];_0x30e2a3++){if(!_[_0x72f3('0x36')](_0x31242e,_0x5e9c6d[_0x30e2a3][_0x72f3('0x29')]))return;var _0x100133=_0x5e9c6d[_0x30e2a3][_0x72f3('0x29')]===_0x72f3('0x2a')?_0x72f3('0x2f'):_0x72f3('0x30');_0x3ffe64['push'](db[_0x72f3('0x39')][_0x72f3('0x82')]({'name':_0x5e9c6d[_0x30e2a3][_0x72f3('0x38')],'resourceId':_0x5e9c6d[_0x30e2a3]['id'],'type':_0x100133,'sectionId':_[_0x72f3('0x37')](_0x116e07,['name',_0x100133])['id']},{}));}return Promise[_0x72f3('0x5d')](_0x3ffe64);});})[_0x72f3('0x1f')](respondWithResult(_0x2d396e,0xc9))[_0x72f3('0x28')](handleError(_0x2d396e,null));};exports[_0x72f3('0x90')]=function(_0x45f809,_0x5cb009){if(_0x45f809[_0x72f3('0x5f')]['id']){delete _0x45f809['body']['id'];}return db[_0x72f3('0x3d')]['find']({'where':{'id':_0x45f809[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](function(_0x363306){if(!_0x363306)return null;if(_0x363306['id']===_0x45f809[_0x72f3('0x2e')]['id']){if(!_0x45f809[_0x72f3('0x5f')][_0x72f3('0x91')]||!_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')]){throw new db[(_0x72f3('0x93'))][(_0x72f3('0x94'))](_0x72f3('0x95'));}if(!_0x363306['authenticate'](_0x45f809[_0x72f3('0x5f')][_0x72f3('0x91')])){throw new db[(_0x72f3('0x93'))][(_0x72f3('0x94'))]('Wrong\x20credentials');}if(_0x45f809[_0x72f3('0x5f')][_0x72f3('0x91')]===_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')]){throw new db[(_0x72f3('0x93'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x45f809[_0x72f3('0x2e')][_0x72f3('0x29')]===_0x72f3('0x2c')){if(!_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')]){throw new db['Sequelize'][(_0x72f3('0x94'))](_0x72f3('0x96'));}}else if(_0x45f809[_0x72f3('0x2e')][_0x72f3('0x29')]===_0x72f3('0x2e')){if(!_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')]){throw new db[(_0x72f3('0x93'))][(_0x72f3('0x94'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x363306[_0x72f3('0x29')]!==_0x72f3('0x2a')){throw new db[(_0x72f3('0x93'))][(_0x72f3('0x94'))](_0x72f3('0x88'));}}else{throw new db[(_0x72f3('0x93'))]['ValidationError'](_0x72f3('0x88'));}return _0x363306;})[_0x72f3('0x1f')](handleEntityNotFound(_0x5cb009,null))[_0x72f3('0x1f')](function(_0x21c82c){return db[_0x72f3('0x66')][_0x72f3('0x97')]({'attributes':['id',_0x72f3('0x98'),_0x72f3('0x99'),_0x72f3('0x9a')]})[_0x72f3('0x1f')](function(_0x1d1fca){if(_0x1d1fca[_0x72f3('0x98')])authService[_0x72f3('0x68')](_0x45f809[_0x72f3('0x5f')]['newPassword']);if(!_0x1d1fca[_0x72f3('0x99')]||!_0x21c82c[_0x72f3('0x44')])return _0x21c82c;authService[_0x72f3('0x9b')](_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')],_0x21c82c['previousPasswords'],_0x1d1fca[_0x72f3('0x9a')]);return _0x21c82c;})[_0x72f3('0x1f')](saveUpdates({'password':_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')],'passwordResetAt':_0x45f809[_0x72f3('0x2e')]['id']==_0x45f809[_0x72f3('0x60')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x45f809[_0x72f3('0x5f')][_0x72f3('0x92')],_0x21c82c[_0x72f3('0x44')])},null));})[_0x72f3('0x1f')](respondWithResult(_0x5cb009,null))[_0x72f3('0x28')](handleError(_0x5cb009,null));};exports['addQueues']=function(_0x568541,_0x2c6e5f){var _0x1034d6=_0x568541[_0x72f3('0x5f')][_0x72f3('0x9c')];return db[_0x72f3('0x3d')][_0x72f3('0x37')]({'where':{'id':_0x568541[_0x72f3('0x60')]['id']},'attributes':['id',_0x72f3('0x38'),_0x72f3('0x29'),'online',_0x72f3('0x9d'),_0x72f3('0x9e'),_0x72f3('0x9f')]})[_0x72f3('0x1f')](handleEntityNotFound(_0x2c6e5f,null))[_0x72f3('0x1f')](function(_0x3ce2bd){if(_0x3ce2bd){if(!utils[_0x72f3('0xa0')](_0x1034d6)){throw new db['Sequelize'][(_0x72f3('0x94'))](_0x72f3('0xa1'));}return _0x3ce2bd[_0x72f3('0xa2')+_[_0x72f3('0xa3')](_0x1034d6[_0x72f3('0xa4')]())+'Queues'](_0x568541[_0x72f3('0x5f')][_0x72f3('0x63')],{'penalty':_0x568541[_0x72f3('0x5f')][_0x72f3('0xa5')]||0x0})['spread'](function(_0x413566){for(var _0x170236=0x0;_0x170236<_0x568541[_0x72f3('0x5f')][_0x72f3('0x63')][_0x72f3('0x6f')];_0x170236+=0x1){var _0x455af3={'UserId':Number(_0x568541[_0x72f3('0x60')]['id'])};_0x455af3[_[_0x72f3('0xa3')](_0x1034d6[_0x72f3('0xa4')]())+_0x72f3('0xa6')]=Number(_0x568541[_0x72f3('0x5f')]['ids'][_0x170236]);socket[_0x72f3('0x2b')](_0x72f3('0x2e')+_['capitalize'](_0x1034d6['toLowerCase']())+'Queue:save',_0x455af3);}return _0x413566;})[_0x72f3('0x1f')](function(){if(_0x1034d6==='voice'){return db[_0x72f3('0xa7')]['findAll']({'where':{'id':_0x568541[_0x72f3('0x5f')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x15e677){var _0x4b1f5f=_0x3ce2bd[_0x72f3('0xa8')]({'plain':!![]});var _0x463cbb=[];if(_0x1034d6===_0x72f3('0xa9')&&_0x4b1f5f[_0x72f3('0x29')]===_0x72f3('0x2a')&&_0x4b1f5f[_0x72f3('0xaa')]){for(let _0x1d0eef=0x0;_0x1d0eef<_0x15e677[_0x72f3('0x6f')];_0x1d0eef+=0x1){_0x463cbb[_0x72f3('0x50')]({'membername':_0x4b1f5f[_0x72f3('0x38')],'UserId':_0x4b1f5f['id'],'queue_name':_0x15e677[_0x1d0eef]['name'],'VoiceQueueId':_0x15e677[_0x1d0eef]['id'],'interface':_[_0x72f3('0x6a')](_0x4b1f5f[_0x72f3('0x9f')])?util[_0x72f3('0xab')](_0x72f3('0xac'),_0x4b1f5f[_0x72f3('0x38')]):_0x4b1f5f['interface'],'paused':_0x4b1f5f[_0x72f3('0x9e')]||![],'penalty':_0x568541[_0x72f3('0x5f')]['penalty']||0x0});}return Promise['all'](_0x463cbb[_0x72f3('0x34')](function(_0x41b112){return db['UserVoiceQueueRt'][_0x72f3('0xad')](_0x41b112);}));}return _0x3ce2bd;});}})['then'](respondWithStatusCode(_0x2c6e5f,null))[_0x72f3('0x28')](handleError(_0x2c6e5f,null));};exports[_0x72f3('0xae')]=function(_0x20bdc9,_0x207524){var _0x1ec3fd,_0x5095df;return db['User']['find']({'where':{'id':_0x20bdc9[_0x72f3('0x60')]['id']},'attributes':['id',_0x72f3('0x38'),_0x72f3('0x29')]})[_0x72f3('0x1f')](handleEntityNotFound(_0x207524,null))[_0x72f3('0x1f')](function(_0x369758){if(_0x369758){_0x1ec3fd=_0x369758;if(!_0x20bdc9[_0x72f3('0x4b')]['channel']||!utils[_0x72f3('0xa0')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')])){throw new db[(_0x72f3('0x93'))][(_0x72f3('0x94'))](_0x72f3('0xa1'));}return _0x369758[_0x72f3('0xaf')+_[_0x72f3('0xa3')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')][_0x72f3('0xa4')]())+_0x72f3('0xb0')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x63')]);}})[_0x72f3('0x1f')](function(_0x1d1cdd){if(_[_0x72f3('0xb1')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x63')])){for(var _0x318aee=0x0;_0x318aee<_0x20bdc9[_0x72f3('0x4b')]['ids'][_0x72f3('0x6f')];_0x318aee+=0x1){_0x5095df={'UserId':Number(_0x20bdc9[_0x72f3('0x60')]['id'])};_0x5095df[_[_0x72f3('0xa3')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')][_0x72f3('0xa4')]())+_0x72f3('0xa6')]=Number(_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x63')][_0x318aee]);socket[_0x72f3('0x2b')](_0x72f3('0x2e')+_[_0x72f3('0xa3')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')]['toLowerCase']())+_0x72f3('0xb2'),_0x5095df);}}else{_0x5095df={'UserId':Number(_0x20bdc9['params']['id'])};_0x5095df[_[_0x72f3('0xa3')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')][_0x72f3('0xa4')]())+_0x72f3('0xa6')]=Number(_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x63')]);socket[_0x72f3('0x2b')]('user'+_[_0x72f3('0xa3')](_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')][_0x72f3('0xa4')]())+_0x72f3('0xb2'),_0x5095df);}return _0x1d1cdd;})['then'](function(){if(_0x20bdc9[_0x72f3('0x4b')][_0x72f3('0x9c')]===_0x72f3('0xa9')){return db[_0x72f3('0xb3')][_0x72f3('0x3a')]({'where':{'UserId':_0x20bdc9[_0x72f3('0x60')]['id'],'VoiceQueueId':_0x20bdc9['query'][_0x72f3('0x63')]},'individualHooks':!![]})[_0x72f3('0x1f')](function(){return _0x1ec3fd;});}return _0x1ec3fd;})[_0x72f3('0x1f')](respondWithStatusCode(_0x207524,null))['catch'](handleError(_0x207524,null));};exports['addAvatar']=function(_0x1b98a5,_0x12eadb){_0x1b98a5[_0x72f3('0x5f')][_0x72f3('0xb4')]=_0x1b98a5[_0x72f3('0xb5')]['filename'];return db[_0x72f3('0x3d')][_0x72f3('0x37')]({'where':{'id':_0x1b98a5[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x12eadb,null))['then'](saveUpdates(_0x1b98a5['body'],null))['then'](respondWithResult(_0x12eadb,null))['catch'](handleError(_0x12eadb,null));};exports[_0x72f3('0xb6')]=function(_0x4d9fe9,_0xf47512){var _0x1fd0dc=path[_0x72f3('0xb7')](config[_0x72f3('0xb8')],_0x72f3('0xb9'));return db[_0x72f3('0x3d')][_0x72f3('0x37')]({'where':{'id':_0x4d9fe9[_0x72f3('0x60')]['id']},'attributes':['id',_0x72f3('0xb4')],'raw':!![]})[_0x72f3('0x1f')](handleEntityNotFound(_0xf47512,null))['then'](function(_0x213cc8){if(_0x213cc8){if(_[_0x72f3('0x6a')](_0x213cc8[_0x72f3('0xb4')])){return _0xf47512[_0x72f3('0xba')](_0x1fd0dc);}else{if(!fs[_0x72f3('0xbb')](path['join'](config['root'],_0x72f3('0xbc'),_0x213cc8[_0x72f3('0xb4')]))){return _0xf47512[_0x72f3('0xba')](_0x1fd0dc);}return _0xf47512[_0x72f3('0xba')](path['join'](config[_0x72f3('0xb8')],_0x72f3('0xbc'),_0x213cc8[_0x72f3('0xb4')]));}}})['catch'](handleError(_0xf47512,null));};exports[_0x72f3('0xbd')]=function(_0x1e1370,_0x1ab289){return db['User'][_0x72f3('0x37')]({'where':{'id':_0x1e1370[_0x72f3('0x60')]['id']},'attributes':['id']})[_0x72f3('0x1f')](handleEntityNotFound(_0x1ab289,null))[_0x72f3('0x1f')](function(_0x47a3fc){var _0x2cd829=[];values=_0x47a3fc[_0x72f3('0x55')];_0x2cd829[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x54'),_0x47a3fc[_0x72f3('0x55')]));_0x2cd829[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x56'),_0x47a3fc[_0x72f3('0x55')]));_0x2cd829['push'](get_open_tabs('openchannel',_0x47a3fc[_0x72f3('0x55')]));_0x2cd829[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x59'),_0x47a3fc['dataValues']));_0x2cd829[_0x72f3('0x50')](get_open_tabs(_0x72f3('0x57'),_0x47a3fc[_0x72f3('0x55')]));_0x2cd829['push'](get_open_tabs(_0x72f3('0x58'),_0x47a3fc[_0x72f3('0x55')]));return Promise[_0x72f3('0x5d')](_0x2cd829);})[_0x72f3('0x1f')](function(_0x5c8382){if(_0x5c8382){var _0x3bbd2b=_['map'](values[_0x72f3('0xbe')],function(_0x52e650){return{'channel':_0x72f3('0xbf'),'id':_0x52e650['id'],'createdAt':_0x52e650['createdAt']};});var _0x306bec=_[_0x72f3('0x34')](values['FaxOpenTabs'],function(_0x4d2a7c){return{'channel':_0x72f3('0xc0'),'id':_0x4d2a7c['id'],'createdAt':_0x4d2a7c[_0x72f3('0xc1')]};});var _0x53affb=_[_0x72f3('0x34')](values[_0x72f3('0xc2')],function(_0x48191a){return{'channel':_0x72f3('0xc3'),'id':_0x48191a['id'],'createdAt':_0x48191a['createdAt']};});var _0x588987=_[_0x72f3('0x34')](values[_0x72f3('0xc4')],function(_0x2830db){return{'channel':'MAIL','id':_0x2830db['id'],'createdAt':_0x2830db[_0x72f3('0xc1')]};});var _0x470861=_[_0x72f3('0x34')](values[_0x72f3('0xc5')],function(_0x5e6ef2){return{'channel':_0x72f3('0xc6'),'id':_0x5e6ef2['id'],'createdAt':_0x5e6ef2[_0x72f3('0xc1')]};});var _0x5b99ad=_['map'](values[_0x72f3('0xc7')],function(_0x9ceaa2){return{'channel':'WHATSAPP','id':_0x9ceaa2['id'],'createdAt':_0x9ceaa2['createdAt']};});var _0x149796=_['concat'](_0x3bbd2b,_0x306bec,_0x53affb,_0x588987,_0x470861,_0x5b99ad);var _0x2d6542={'count':_0x149796[_0x72f3('0x6f')],'rows':_0x149796};return _0x2d6542;}else return null;})[_0x72f3('0x1f')](respondWithResult(_0x1ab289,null))['catch'](handleError(_0x1ab289,null));};exports[_0x72f3('0xc8')]=function(_0x436bb2,_0x5eb286){var _0x405eea={};return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x436bb2[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](function(_0x6e4671){if(!_0x6e4671){throw new APINotFoundError(util[_0x72f3('0xab')](_0x72f3('0xc9'),_0x436bb2['params']['id']));}return contacts['describe']();})['then'](function(_0x5994bb){_0x436bb2['query'][_0x72f3('0x3d')]=_0x436bb2[_0x72f3('0x60')]['id'];_0x405eea=qs['getOptions'](_0x5994bb,_0x436bb2);if(_0x436bb2[_0x72f3('0x4b')][_0x72f3('0xca')]('includeAll')){_0x405eea['include']=[{'model':db[_0x72f3('0xcb')],'as':_0x72f3('0xcc'),'required':![]},{'model':db[_0x72f3('0xcd')],'as':_0x72f3('0xce'),'attributes':['id',_0x72f3('0x38'),'color'],'where':_0x436bb2['query'][_0x72f3('0xcf')]?{'id':_0x436bb2[_0x72f3('0x4b')][_0x72f3('0xcf')]}:undefined,'required':_0x436bb2[_0x72f3('0x4b')][_0x72f3('0xcf')]?!![]:![]}];}return contacts[_0x72f3('0x51')](_0x436bb2[_0x72f3('0x4b')],_0x436bb2[_0x72f3('0x2e')],_0x405eea,_0x5994bb);})[_0x72f3('0x1f')](respondWithFilteredResult(_0x5eb286,_0x405eea))[_0x72f3('0x28')](APIHandleError(_0x5eb286));};exports['getQueues']=function(_0x124737,_0x47a309){var _0x1d7929;var _0x13cdc2={};var _0x339d73;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x124737[_0x72f3('0x60')]['id']},'attributes':['id',_0x72f3('0x38'),_0x72f3('0x29')]})[_0x72f3('0x1f')](handleEntityNotFound(_0x47a309,null))[_0x72f3('0x1f')](function(_0x385ca3){if(!utils[_0x72f3('0xa0')](_0x124737['query'][_0x72f3('0x9c')])){throw new db['Sequelize'][(_0x72f3('0x94'))]('Unknown\x20channel');}_0x1d7929=_0x385ca3;var _0x502ee1={};_0x502ee1[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db[_[_0x72f3('0xa3')](_0x124737[_0x72f3('0x4b')][_0x72f3('0x9c')])+_0x72f3('0xd2')][_0x72f3('0x3e')]);_0x502ee1[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x124737[_0x72f3('0x4b')]);_0x502ee1[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x502ee1[_0x72f3('0xd0')],_0x502ee1['query']);_0x13cdc2[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x502ee1[_0x72f3('0xd0')],qs[_0x72f3('0xd5')](_0x124737[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x13cdc2[_0x72f3('0x4f')]=_0x13cdc2[_0x72f3('0x4f')]['length']?_0x13cdc2[_0x72f3('0x4f')]:_0x502ee1[_0x72f3('0xd0')];_0x13cdc2[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x124737[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x13cdc2[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x124737['query'],_0x502ee1[_0x72f3('0xd3')]));if(_0x124737['query'][_0x72f3('0x32')]){_0x13cdc2[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x13cdc2['where'],{'$or':_[_0x72f3('0x34')](_0x13cdc2['attributes'],function(_0xed127e){var _0x3d46b5={};_0x3d46b5[_0xed127e]={'$like':'%'+_0x124737[_0x72f3('0x4b')][_0x72f3('0x32')]+'%'};return _0x3d46b5;})});}_0x13cdc2=_[_0x72f3('0xd9')]({},_0x13cdc2,_0x124737[_0x72f3('0x5b')]);switch(_0x1d7929[_0x72f3('0x29')]){case _0x72f3('0x2c'):return db[_[_0x72f3('0xa3')](_0x124737[_0x72f3('0x4b')][_0x72f3('0x9c')])+'Queue'][_0x72f3('0x51')](_0x13cdc2);case _0x72f3('0x2e'):case _0x72f3('0x2a'):return _0x1d7929[_0x72f3('0xa8')+_['capitalize'](_0x124737[_0x72f3('0x4b')]['channel'])+_0x72f3('0xb0')](_0x13cdc2);default:throw new db[(_0x72f3('0x93'))]['ValidationError'](_0x72f3('0xda'));}})[_0x72f3('0x1f')](function(_0x484974){_0x339d73=_0x484974[_0x72f3('0x6f')];if(!_0x124737[_0x72f3('0x4b')][_0x72f3('0xca')]('nolimit')){_0x13cdc2[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x124737[_0x72f3('0x4b')][_0x72f3('0x19')]);_0x13cdc2['offset']=qs[_0x72f3('0x18')](_0x124737[_0x72f3('0x4b')]['offset']);}switch(_0x1d7929['role']){case _0x72f3('0x2c'):return db[_[_0x72f3('0xa3')](_0x124737[_0x72f3('0x4b')][_0x72f3('0x9c')])+_0x72f3('0xd2')]['findAll'](_0x13cdc2);case _0x72f3('0x2e'):case _0x72f3('0x2a'):return _0x1d7929[_0x72f3('0xa8')+_[_0x72f3('0xa3')](_0x124737[_0x72f3('0x4b')][_0x72f3('0x9c')])+_0x72f3('0xb0')](_0x13cdc2);}})[_0x72f3('0x1f')](function(_0x4070e9){return{'count':_0x339d73,'rows':_0x4070e9};})[_0x72f3('0x1f')](respondWithResult(_0x47a309,null))[_0x72f3('0x28')](handleError(_0x47a309,null));};exports[_0x72f3('0xdb')]=function(_0x4f40a2,_0x2f5718){var _0x29ed12={};var _0x3347ff={};var _0x16a085;var _0x11bfae;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x4f40a2[_0x72f3('0x60')]['id']}})['then'](handleEntityNotFound(_0x2f5718,null))[_0x72f3('0x1f')](function(_0x2e0472){if(_0x2e0472){_0x16a085=_0x2e0472;_0x3347ff[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db[_0x72f3('0xb3')][_0x72f3('0x3e')]);_0x3347ff[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x4f40a2[_0x72f3('0x4b')]);_0x3347ff[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x3347ff[_0x72f3('0xd0')],_0x3347ff['query']);_0x29ed12[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x3347ff[_0x72f3('0xd0')],qs[_0x72f3('0xd5')](_0x4f40a2[_0x72f3('0x4b')]['fields']));_0x29ed12[_0x72f3('0x4f')]=_0x29ed12[_0x72f3('0x4f')][_0x72f3('0x6f')]?_0x29ed12[_0x72f3('0x4f')]:_0x3347ff[_0x72f3('0xd0')];_0x29ed12['order']=qs[_0x72f3('0xd7')](_0x4f40a2[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x29ed12[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x4f40a2[_0x72f3('0x4b')],_0x3347ff['filters']));if(_0x4f40a2[_0x72f3('0x4b')]['filter']){_0x29ed12[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x29ed12[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x29ed12[_0x72f3('0x4f')],function(_0x1cee2b){var _0x20fd30={};_0x20fd30[_0x1cee2b]={'$like':'%'+_0x4f40a2[_0x72f3('0x4b')]['filter']+'%'};return _0x20fd30;})});}_0x29ed12=_['merge']({},_0x29ed12,_0x4f40a2[_0x72f3('0x5b')]);return _0x16a085[_0x72f3('0xdb')](_0x29ed12);}})[_0x72f3('0x1f')](function(_0x1c584a){if(_0x1c584a){_0x11bfae=_0x1c584a[_0x72f3('0x6f')];if(!_0x4f40a2[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x29ed12[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x4f40a2['query'][_0x72f3('0x19')]);_0x29ed12['offset']=qs['offset'](_0x4f40a2[_0x72f3('0x4b')][_0x72f3('0x18')]);}return _0x16a085[_0x72f3('0xdb')](_0x29ed12);}})[_0x72f3('0x1f')](function(_0x262e04){if(_0x262e04){return _0x262e04?{'count':_0x11bfae,'rows':_0x262e04}:null;}})['then'](respondWithResult(_0x2f5718,null))[_0x72f3('0x28')](handleError(_0x2f5718,null));};exports[_0x72f3('0xdd')]=function(_0x6ad827,_0x1b6077){var _0x398367={};var _0x1af899={};var _0x47c1a3;var _0x21714d;return db[_0x72f3('0x3d')]['findOne']({'where':{'id':_0x6ad827['params']['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x1b6077,null))[_0x72f3('0x1f')](function(_0x561ee1){if(_0x561ee1){_0x47c1a3=_0x561ee1;_0x1af899[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db[_0x72f3('0xde')][_0x72f3('0x3e')]);_0x1af899['query']=_['keys'](_0x6ad827[_0x72f3('0x4b')]);_0x1af899[_0x72f3('0xd3')]=_['intersection'](_0x1af899[_0x72f3('0xd0')],_0x1af899[_0x72f3('0x4b')]);_0x398367[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x1af899[_0x72f3('0xd0')],qs[_0x72f3('0xd5')](_0x6ad827[_0x72f3('0x4b')]['fields']));_0x398367['attributes']=_0x398367[_0x72f3('0x4f')][_0x72f3('0x6f')]?_0x398367['attributes']:_0x1af899[_0x72f3('0xd0')];_0x398367[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x6ad827[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x398367[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x6ad827[_0x72f3('0x4b')],_0x1af899[_0x72f3('0xd3')]));if(_0x6ad827['query']['filter']){_0x398367[_0x72f3('0x49')]=_['merge'](_0x398367[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x398367[_0x72f3('0x4f')],function(_0x2083fb){var _0x58a138={};_0x58a138[_0x2083fb]={'$like':'%'+_0x6ad827[_0x72f3('0x4b')][_0x72f3('0x32')]+'%'};return _0x58a138;})});}_0x398367=_['merge']({},_0x398367,_0x6ad827[_0x72f3('0x5b')]);return _0x47c1a3[_0x72f3('0xdd')](_0x398367);}})[_0x72f3('0x1f')](function(_0x347e46){if(_0x347e46){_0x21714d=_0x347e46[_0x72f3('0x6f')];if(!_0x6ad827[_0x72f3('0x4b')][_0x72f3('0xca')]('nolimit')){_0x398367[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x6ad827[_0x72f3('0x4b')][_0x72f3('0x19')]);_0x398367[_0x72f3('0x18')]=qs['offset'](_0x6ad827['query'][_0x72f3('0x18')]);}return _0x47c1a3[_0x72f3('0xdd')](_0x398367);}})[_0x72f3('0x1f')](function(_0x2cfc9c){if(_0x2cfc9c){return _0x2cfc9c?{'count':_0x21714d,'rows':_0x2cfc9c}:null;}})[_0x72f3('0x1f')](respondWithResult(_0x1b6077,null))[_0x72f3('0x28')](handleError(_0x1b6077,null));};exports[_0x72f3('0xdf')]=function(_0x480a91,_0x581978){var _0xf39084={'raw':!![],'where':{}};var _0x5c2551={};var _0x591c35={'count':0x0,'rows':[]};return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x480a91[_0x72f3('0x60')]['id']}})['then'](handleEntityNotFound(_0x581978,null))[_0x72f3('0x1f')](function(_0x1ecea6){if(_0x1ecea6){_0x5c2551[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db[_0x72f3('0xe0')][_0x72f3('0x3e')]);_0x5c2551[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x480a91['query']);_0x5c2551[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x5c2551[_0x72f3('0xd0')],_0x5c2551[_0x72f3('0x4b')]);_0xf39084[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x5c2551[_0x72f3('0xd0')],qs['fields'](_0x480a91[_0x72f3('0x4b')]['fields']));_0xf39084[_0x72f3('0x4f')]=_0xf39084['attributes'][_0x72f3('0x6f')]?_0xf39084[_0x72f3('0x4f')]:_0x5c2551[_0x72f3('0xd0')];if(!_0x480a91[_0x72f3('0x4b')][_0x72f3('0xca')]('nolimit')){_0xf39084[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x480a91[_0x72f3('0x4b')][_0x72f3('0x19')]);_0xf39084[_0x72f3('0x18')]=qs[_0x72f3('0x18')](_0x480a91['query']['offset']);}_0xf39084[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x480a91['query'][_0x72f3('0xd7')]);_0xf39084[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x480a91['query'],_0x5c2551[_0x72f3('0xd3')]));_0xf39084[_0x72f3('0x49')][_0x72f3('0xe1')]=_0x1ecea6['id'];if(_0x480a91[_0x72f3('0x4b')][_0x72f3('0x32')]){_0xf39084[_0x72f3('0x49')]=_['merge'](_0xf39084[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0xf39084[_0x72f3('0x4f')],function(_0x1a5fad){var _0x5d4dac={};_0x5d4dac[_0x1a5fad]={'$like':'%'+_0x480a91[_0x72f3('0x4b')][_0x72f3('0x32')]+'%'};return _0x5d4dac;})});}_0xf39084=_[_0x72f3('0xd9')]({},_0xf39084,_0x480a91['options']);return db['VoiceRecording'][_0x72f3('0x1b')]({'where':_0xf39084[_0x72f3('0x49')]})[_0x72f3('0x1f')](function(_0x9cbde6){_0x591c35[_0x72f3('0x1b')]=_0x9cbde6;if(_0x480a91['query'][_0x72f3('0x5a')]){_0xf39084['include']=[{'all':!![]}];}return db[_0x72f3('0xe0')][_0x72f3('0x51')](_0xf39084);})[_0x72f3('0x1f')](function(_0x57401e){_0x591c35[_0x72f3('0x52')]=_0x57401e;return _0x591c35;});}})[_0x72f3('0x1f')](respondWithFilteredResult(_0x581978,_0xf39084))[_0x72f3('0x28')](handleError(_0x581978,null));};exports[_0x72f3('0xe2')]=function(_0x5c1964,_0x1f6fa5){var _0x1ef38f={'raw':!![],'where':{}};var _0x2fffe6={};var _0x37dc0c={'count':0x0,'rows':[]};return db[_0x72f3('0x3d')]['findOne']({'where':{'id':_0x5c1964[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x1f6fa5,null))['then'](function(_0x4ab9a6){if(_0x4ab9a6){_0x2fffe6[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db[_0x72f3('0xe3')][_0x72f3('0x3e')]);_0x2fffe6[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x5c1964[_0x72f3('0x4b')]);_0x2fffe6[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x2fffe6['model'],_0x2fffe6[_0x72f3('0x4b')]);_0x1ef38f['attributes']=_[_0x72f3('0xd4')](_0x2fffe6[_0x72f3('0xd0')],qs[_0x72f3('0xd5')](_0x5c1964[_0x72f3('0x4b')]['fields']));_0x1ef38f[_0x72f3('0x4f')]=_0x1ef38f[_0x72f3('0x4f')][_0x72f3('0x6f')]?_0x1ef38f[_0x72f3('0x4f')]:_0x2fffe6[_0x72f3('0xd0')];if(!_0x5c1964[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x1ef38f[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x5c1964[_0x72f3('0x4b')]['limit']);_0x1ef38f[_0x72f3('0x18')]=qs['offset'](_0x5c1964[_0x72f3('0x4b')][_0x72f3('0x18')]);}_0x1ef38f[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x5c1964[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x1ef38f[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x5c1964[_0x72f3('0x4b')],_0x2fffe6[_0x72f3('0xd3')]));_0x1ef38f[_0x72f3('0x49')]['UserId']=_0x4ab9a6['id'];if(_0x5c1964[_0x72f3('0x4b')]['filter']){_0x1ef38f[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x1ef38f['where'],{'$or':_[_0x72f3('0x34')](_0x1ef38f[_0x72f3('0x4f')],function(_0x4bc738){var _0x428902={};_0x428902[_0x4bc738]={'$like':'%'+_0x5c1964[_0x72f3('0x4b')]['filter']+'%'};return _0x428902;})});}_0x1ef38f=_['merge']({},_0x1ef38f,_0x5c1964['options']);return db[_0x72f3('0xe3')]['count']({'where':_0x1ef38f[_0x72f3('0x49')]})[_0x72f3('0x1f')](function(_0x4f5388){_0x37dc0c[_0x72f3('0x1b')]=_0x4f5388;if(_0x5c1964['query'][_0x72f3('0x5a')]){_0x1ef38f['include']=[{'all':!![]}];}return db[_0x72f3('0xe3')][_0x72f3('0x51')](_0x1ef38f);})[_0x72f3('0x1f')](function(_0x12f0be){_0x37dc0c[_0x72f3('0x52')]=_0x12f0be;return _0x37dc0c;});}})[_0x72f3('0x1f')](respondWithFilteredResult(_0x1f6fa5,_0x1ef38f))[_0x72f3('0x28')](handleError(_0x1f6fa5,null));};exports['getChatInteractions']=function(_0x3cd68e,_0x355814){var _0x480a36={};var _0x362e88={};var _0x2cf486;var _0x338427;return db['User'][_0x72f3('0x97')]({'where':{'id':_0x3cd68e[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x355814,null))[_0x72f3('0x1f')](function(_0x5e7214){if(_0x5e7214){_0x2cf486=_0x5e7214;_0x362e88['model']=_[_0x72f3('0xd1')](db[_0x72f3('0xe4')][_0x72f3('0x3e')]);_0x362e88['query']=_[_0x72f3('0xd1')](_0x3cd68e['query']);_0x362e88[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x362e88['model'],_0x362e88[_0x72f3('0x4b')]);_0x480a36['attributes']=_[_0x72f3('0xd4')](_0x362e88[_0x72f3('0xd0')],qs[_0x72f3('0xd5')](_0x3cd68e[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x480a36[_0x72f3('0x4f')]=_0x480a36[_0x72f3('0x4f')][_0x72f3('0x6f')]?_0x480a36[_0x72f3('0x4f')]:_0x362e88['model'];_0x480a36[_0x72f3('0xd6')]=qs['sort'](_0x3cd68e[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x480a36[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x3cd68e['query'],_0x362e88[_0x72f3('0xd3')]));if(_0x3cd68e[_0x72f3('0x4b')][_0x72f3('0x32')]){_0x480a36['where']=_[_0x72f3('0xd9')](_0x480a36[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x480a36['attributes'],function(_0x1c0bf6){var _0x5a90f7={};_0x5a90f7[_0x1c0bf6]={'$like':'%'+_0x3cd68e['query'][_0x72f3('0x32')]+'%'};return _0x5a90f7;})});}_0x480a36=_['merge']({},_0x480a36,_0x3cd68e[_0x72f3('0x5b')]);return _0x2cf486[_0x72f3('0xe5')](_0x480a36);}})['then'](function(_0x39c5f8){if(_0x39c5f8){_0x338427=_0x39c5f8[_0x72f3('0x6f')];if(!_0x3cd68e['query'][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x480a36[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x3cd68e['query']['limit']);_0x480a36[_0x72f3('0x18')]=qs[_0x72f3('0x18')](_0x3cd68e[_0x72f3('0x4b')][_0x72f3('0x18')]);}return _0x2cf486[_0x72f3('0xe5')](_0x480a36);}})[_0x72f3('0x1f')](function(_0x32da63){if(_0x32da63){return _0x32da63?{'count':_0x338427,'rows':_0x32da63}:null;}})['then'](respondWithResult(_0x355814,null))['catch'](handleError(_0x355814,null));};exports['getOpenchannelInteractions']=function(_0x52c371,_0x3e178f){var _0x55e95a={};var _0xc20c2a={};var _0x4d661f;var _0x585a19;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x52c371[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x3e178f,null))[_0x72f3('0x1f')](function(_0x2d4ace){if(_0x2d4ace){_0x4d661f=_0x2d4ace;_0xc20c2a['model']=_[_0x72f3('0xd1')](db[_0x72f3('0xe6')]['rawAttributes']);_0xc20c2a[_0x72f3('0x4b')]=_['keys'](_0x52c371[_0x72f3('0x4b')]);_0xc20c2a[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0xc20c2a[_0x72f3('0xd0')],_0xc20c2a['query']);_0x55e95a[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0xc20c2a[_0x72f3('0xd0')],qs['fields'](_0x52c371[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x55e95a[_0x72f3('0x4f')]=_0x55e95a['attributes']['length']?_0x55e95a[_0x72f3('0x4f')]:_0xc20c2a['model'];_0x55e95a['order']=qs[_0x72f3('0xd7')](_0x52c371['query'][_0x72f3('0xd7')]);_0x55e95a[_0x72f3('0x49')]=qs['filters'](_[_0x72f3('0xd8')](_0x52c371['query'],_0xc20c2a['filters']));if(_0x52c371[_0x72f3('0x4b')][_0x72f3('0x32')]){_0x55e95a['where']=_[_0x72f3('0xd9')](_0x55e95a['where'],{'$or':_[_0x72f3('0x34')](_0x55e95a[_0x72f3('0x4f')],function(_0x147d62){var _0x327c5b={};_0x327c5b[_0x147d62]={'$like':'%'+_0x52c371[_0x72f3('0x4b')][_0x72f3('0x32')]+'%'};return _0x327c5b;})});}_0x55e95a=_[_0x72f3('0xd9')]({},_0x55e95a,_0x52c371['options']);return _0x4d661f[_0x72f3('0xe7')](_0x55e95a);}})[_0x72f3('0x1f')](function(_0x8c8753){if(_0x8c8753){_0x585a19=_0x8c8753['length'];if(!_0x52c371['query'][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x55e95a[_0x72f3('0x19')]=qs['limit'](_0x52c371[_0x72f3('0x4b')][_0x72f3('0x19')]);_0x55e95a['offset']=qs[_0x72f3('0x18')](_0x52c371['query']['offset']);}return _0x4d661f[_0x72f3('0xe7')](_0x55e95a);}})[_0x72f3('0x1f')](function(_0x3c4ada){if(_0x3c4ada){return _0x3c4ada?{'count':_0x585a19,'rows':_0x3c4ada}:null;}})[_0x72f3('0x1f')](respondWithResult(_0x3e178f,null))[_0x72f3('0x28')](handleError(_0x3e178f,null));};exports['getMailInteractions']=function(_0x23638e,_0x2dc7ad){var _0x3d20e9={'raw':!![],'where':{}};var _0x3f2179={};var _0x326f93={'count':0x0,'rows':[]};return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x23638e[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x2dc7ad,null))[_0x72f3('0x1f')](function(_0x2287ba){if(_0x2287ba){_0x3f2179[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db['MailInteraction']['rawAttributes']);_0x3f2179[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x23638e[_0x72f3('0x4b')]);_0x3f2179['filters']=_[_0x72f3('0xd4')](_0x3f2179[_0x72f3('0xd0')],_0x3f2179[_0x72f3('0x4b')]);_0x3d20e9[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x3f2179['model'],qs[_0x72f3('0xd5')](_0x23638e[_0x72f3('0x4b')]['fields']));_0x3d20e9[_0x72f3('0x4f')]=_0x3d20e9['attributes'][_0x72f3('0x6f')]?_0x3d20e9[_0x72f3('0x4f')]:_0x3f2179[_0x72f3('0xd0')];if(!_0x23638e[_0x72f3('0x4b')]['hasOwnProperty'](_0x72f3('0xdc'))){_0x3d20e9[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x23638e[_0x72f3('0x4b')]['limit']);_0x3d20e9[_0x72f3('0x18')]=qs[_0x72f3('0x18')](_0x23638e[_0x72f3('0x4b')][_0x72f3('0x18')]);}_0x3d20e9[_0x72f3('0xd6')]=qs['sort'](_0x23638e[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x3d20e9['where']=qs[_0x72f3('0xd3')](_['pick'](_0x23638e[_0x72f3('0x4b')],_0x3f2179[_0x72f3('0xd3')]));_0x3d20e9[_0x72f3('0x49')]['UserId']=_0x2287ba['id'];if(_0x23638e[_0x72f3('0x4b')][_0x72f3('0x32')]){_0x3d20e9[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x3d20e9['where'],{'$or':_['map'](_0x3d20e9[_0x72f3('0x4f')],function(_0x384a62){var _0x40000b={};_0x40000b[_0x384a62]={'$like':'%'+_0x23638e['query'][_0x72f3('0x32')]+'%'};return _0x40000b;})});}_0x3d20e9=_[_0x72f3('0xd9')]({},_0x3d20e9,_0x23638e[_0x72f3('0x5b')]);return db['MailInteraction'][_0x72f3('0x1b')]({'where':_0x3d20e9['where']})[_0x72f3('0x1f')](function(_0x94c3e4){_0x326f93[_0x72f3('0x1b')]=_0x94c3e4;if(_0x23638e[_0x72f3('0x4b')][_0x72f3('0x5a')]){_0x3d20e9[_0x72f3('0x4a')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x3d20e9);})['then'](function(_0x2aa147){_0x326f93[_0x72f3('0x52')]=_0x2aa147;return _0x326f93;});}})[_0x72f3('0x1f')](respondWithFilteredResult(_0x2dc7ad,_0x3d20e9))['catch'](handleError(_0x2dc7ad,null));};exports[_0x72f3('0xe8')]=function(_0x1a14b2,_0x45c041){var _0x23a8cd={};var _0x5d26ab={};var _0x38674a;var _0x35fa0b;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x1a14b2[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x45c041,null))[_0x72f3('0x1f')](function(_0x473c53){if(_0x473c53){_0x38674a=_0x473c53;_0x5d26ab['model']=_[_0x72f3('0xd1')](db[_0x72f3('0xe9')][_0x72f3('0x3e')]);_0x5d26ab[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x1a14b2[_0x72f3('0x4b')]);_0x5d26ab[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x5d26ab[_0x72f3('0xd0')],_0x5d26ab['query']);_0x23a8cd[_0x72f3('0x4f')]=_['intersection'](_0x5d26ab['model'],qs['fields'](_0x1a14b2['query'][_0x72f3('0xd5')]));_0x23a8cd[_0x72f3('0x4f')]=_0x23a8cd[_0x72f3('0x4f')]['length']?_0x23a8cd['attributes']:_0x5d26ab[_0x72f3('0xd0')];_0x23a8cd[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x1a14b2[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x23a8cd['where']=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x1a14b2[_0x72f3('0x4b')],_0x5d26ab[_0x72f3('0xd3')]));if(_0x1a14b2[_0x72f3('0x4b')]['filter']){_0x23a8cd[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x23a8cd['where'],{'$or':_['map'](_0x23a8cd['attributes'],function(_0x5bf97c){var _0x5310ba={};_0x5310ba[_0x5bf97c]={'$like':'%'+_0x1a14b2['query'][_0x72f3('0x32')]+'%'};return _0x5310ba;})});}_0x23a8cd=_[_0x72f3('0xd9')]({},_0x23a8cd,_0x1a14b2[_0x72f3('0x5b')]);return _0x38674a['getSmsInteractions'](_0x23a8cd);}})[_0x72f3('0x1f')](function(_0x30b5a7){if(_0x30b5a7){_0x35fa0b=_0x30b5a7[_0x72f3('0x6f')];if(!_0x1a14b2[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x23a8cd['limit']=qs['limit'](_0x1a14b2[_0x72f3('0x4b')]['limit']);_0x23a8cd['offset']=qs[_0x72f3('0x18')](_0x1a14b2['query']['offset']);}return _0x38674a['getSmsInteractions'](_0x23a8cd);}})[_0x72f3('0x1f')](function(_0x507547){if(_0x507547){return _0x507547?{'count':_0x35fa0b,'rows':_0x507547}:null;}})[_0x72f3('0x1f')](respondWithResult(_0x45c041,null))['catch'](handleError(_0x45c041,null));};exports[_0x72f3('0xea')]=function(_0x473312,_0x242ccf){var _0x20dabe={};var _0x3f9e8b={};var _0x4908e0;var _0x4555a7;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x473312['params']['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x242ccf,null))['then'](function(_0xb21bb3){if(_0xb21bb3){_0x4908e0=_0xb21bb3;_0x3f9e8b[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db['FaxInteraction']['rawAttributes']);_0x3f9e8b[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x473312['query']);_0x3f9e8b['filters']=_[_0x72f3('0xd4')](_0x3f9e8b[_0x72f3('0xd0')],_0x3f9e8b[_0x72f3('0x4b')]);_0x20dabe[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x3f9e8b['model'],qs[_0x72f3('0xd5')](_0x473312[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x20dabe[_0x72f3('0x4f')]=_0x20dabe[_0x72f3('0x4f')]['length']?_0x20dabe[_0x72f3('0x4f')]:_0x3f9e8b[_0x72f3('0xd0')];_0x20dabe[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x473312[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x20dabe[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x473312[_0x72f3('0x4b')],_0x3f9e8b['filters']));if(_0x473312[_0x72f3('0x4b')]['filter']){_0x20dabe[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x20dabe[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x20dabe['attributes'],function(_0x395436){var _0x2fb97c={};_0x2fb97c[_0x395436]={'$like':'%'+_0x473312[_0x72f3('0x4b')]['filter']+'%'};return _0x2fb97c;})});}_0x20dabe=_[_0x72f3('0xd9')]({},_0x20dabe,_0x473312[_0x72f3('0x5b')]);return _0x4908e0[_0x72f3('0xea')](_0x20dabe);}})[_0x72f3('0x1f')](function(_0x48ef25){if(_0x48ef25){_0x4555a7=_0x48ef25['length'];if(!_0x473312[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x20dabe[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x473312[_0x72f3('0x4b')][_0x72f3('0x19')]);_0x20dabe[_0x72f3('0x18')]=qs[_0x72f3('0x18')](_0x473312[_0x72f3('0x4b')][_0x72f3('0x18')]);}return _0x4908e0['getFaxInteractions'](_0x20dabe);}})[_0x72f3('0x1f')](function(_0x42f9c7){if(_0x42f9c7){return _0x42f9c7?{'count':_0x4555a7,'rows':_0x42f9c7}:null;}})[_0x72f3('0x1f')](respondWithResult(_0x242ccf,null))['catch'](handleError(_0x242ccf,null));};exports[_0x72f3('0xeb')]=function(_0x94dfa,_0xdcf0be){var _0x1fe7e9={};var _0x4ac83b={};var _0x3282db;var _0x16c568;return db['User'][_0x72f3('0x97')]({'where':{'id':_0x94dfa['params']['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0xdcf0be,null))[_0x72f3('0x1f')](function(_0x544a23){if(_0x544a23){_0x3282db=_0x544a23;_0x4ac83b['model']=_[_0x72f3('0xd1')](db[_0x72f3('0xec')][_0x72f3('0x3e')]);_0x4ac83b['query']=_[_0x72f3('0xd1')](_0x94dfa[_0x72f3('0x4b')]);_0x4ac83b[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x4ac83b[_0x72f3('0xd0')],_0x4ac83b[_0x72f3('0x4b')]);_0x1fe7e9[_0x72f3('0x4f')]=_['intersection'](_0x4ac83b[_0x72f3('0xd0')],qs[_0x72f3('0xd5')](_0x94dfa[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x1fe7e9[_0x72f3('0x4f')]=_0x1fe7e9[_0x72f3('0x4f')]['length']?_0x1fe7e9[_0x72f3('0x4f')]:_0x4ac83b[_0x72f3('0xd0')];_0x1fe7e9[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x94dfa[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x1fe7e9[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_['pick'](_0x94dfa['query'],_0x4ac83b['filters']));if(_0x94dfa['query']['filter']){_0x1fe7e9[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x1fe7e9['where'],{'$or':_[_0x72f3('0x34')](_0x1fe7e9[_0x72f3('0x4f')],function(_0x3a99b3){var _0x352316={};_0x352316[_0x3a99b3]={'$like':'%'+_0x94dfa[_0x72f3('0x4b')][_0x72f3('0x32')]+'%'};return _0x352316;})});}_0x1fe7e9=_[_0x72f3('0xd9')]({},_0x1fe7e9,_0x94dfa[_0x72f3('0x5b')]);return _0x3282db[_0x72f3('0xeb')](_0x1fe7e9);}})[_0x72f3('0x1f')](function(_0x38f755){if(_0x38f755){_0x16c568=_0x38f755[_0x72f3('0x6f')];if(!_0x94dfa[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x1fe7e9['limit']=qs[_0x72f3('0x19')](_0x94dfa[_0x72f3('0x4b')][_0x72f3('0x19')]);_0x1fe7e9[_0x72f3('0x18')]=qs['offset'](_0x94dfa[_0x72f3('0x4b')][_0x72f3('0x18')]);}return _0x3282db[_0x72f3('0xeb')](_0x1fe7e9);}})['then'](function(_0xa85c8d){if(_0xa85c8d){return _0xa85c8d?{'count':_0x16c568,'rows':_0xa85c8d}:null;}})[_0x72f3('0x1f')](respondWithResult(_0xdcf0be,null))[_0x72f3('0x28')](handleError(_0xdcf0be,null));};exports[_0x72f3('0xed')]=function(_0x8f14f1,_0x284c7c,_0x2636a5){var _0x1f1b90;var _0x3d2dfb;var _0x40f2a4;var _0x2785f6=!_['isNil'](_0x8f14f1['params']['id'])?_0x8f14f1['params']['id']:!_[_0x72f3('0x6a')](_0x8f14f1[_0x72f3('0x2e')]['id'])?_0x8f14f1[_0x72f3('0x2e')]['id']:null;return db[_0x72f3('0x3d')][_0x72f3('0x37')]({'where':{'id':_0x2785f6,'role':{'$or':[_0x72f3('0x2c'),'user',_0x72f3('0x2a')]}},'attributes':['id','name','phone',_0x72f3('0xee'),_0x72f3('0x29'),_0x72f3('0x65'),_0x72f3('0x9d')]})[_0x72f3('0x1f')](function(_0xf924b7){if(_0xf924b7){if(_0xf924b7[_0x72f3('0x29')]===_0x72f3('0x2a')){_0x1f1b90=_0xf924b7;if(_0x8f14f1['body'][_0x72f3('0x9f')]){_0x40f2a4=util[_0x72f3('0xab')](_0x72f3('0xef'),_0x1f1b90[_0x8f14f1[_0x72f3('0x5f')][_0x72f3('0x9f')]]);}else if(_0x8f14f1[_0x72f3('0x5f')][_0x72f3('0xf0')]){_0x40f2a4=util[_0x72f3('0xab')](_0x72f3('0xac'),_0x8f14f1['body'][_0x72f3('0xf0')]);}else{_0x40f2a4=util[_0x72f3('0xab')](_0x72f3('0xac'),_0x1f1b90['name']);}socket['to'](util[_0x72f3('0xab')](_0x72f3('0xf1'),_0x1f1b90[_0x72f3('0x38')]))['emit'](_0x72f3('0xf2'),{'user':{'id':_0x1f1b90['id'],'name':_0x1f1b90[_0x72f3('0x38')]},'ip':_0x8f14f1[_0x72f3('0xf3')][_0x72f3('0xf4')]||_0x8f14f1[_0x72f3('0xf5')][_0x72f3('0xf6')]||_0x8f14f1['socket'][_0x72f3('0xf6')]||_0x8f14f1[_0x72f3('0xf5')][_0x72f3('0xf7')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x72f3('0x3a')]({'where':{'membername':_0x1f1b90[_0x72f3('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0x72f3('0x93'))][(_0x72f3('0x94'))](_0x72f3('0xf8'));}})[_0x72f3('0x1f')](function(){if(_0x1f1b90){return _0x1f1b90[_0x72f3('0xf9')]({'raw':!![]});}})[_0x72f3('0x1f')](function(_0x28ed42){if(_0x1f1b90){if(_0x28ed42){_0x3d2dfb=_0x28ed42;if(_0x3d2dfb['length']){var _0x4fffaf=_0x3d2dfb['map'](function(_0x3841d8){var _0x16b2e4={'membername':_0x1f1b90['name'],'UserId':_0x1f1b90['id'],'queue_name':_0x3841d8['name'],'VoiceQueueId':_0x3841d8['id'],'interface':_0x40f2a4,'paused':_0x1f1b90[_0x72f3('0x9d')]||![],'penalty':_0x3841d8['UserVoiceQueue.penalty']||0x0};return db[_0x72f3('0xb3')]['upsert'](_0x16b2e4);});return Promise[_0x72f3('0x5d')](_0x4fffaf);}}}})['then'](function(){if(_0x1f1b90){return db[_0x72f3('0xfa')][_0x72f3('0x51')]({'where':{'membername':_0x1f1b90[_0x72f3('0x38')],'exitAt':null}});}})[_0x72f3('0x1f')](function(_0x4d585b){if(_0x1f1b90){var _0x53f1cb=[];_0x4d585b[_0x72f3('0xfb')](function(_0x58aafc){_0x53f1cb[_0x72f3('0x50')](_0x58aafc[_0x72f3('0x5e')]({'exitAt':moment()[_0x72f3('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x72f3('0x5d')](_0x53f1cb);}})[_0x72f3('0x1f')](function(){if(_0x1f1b90){var _0x5244fe=[];var _0x3e0818=[];var _0x51391f=utils[_0x72f3('0xfc')]();var _0x30b510={'membername':_0x1f1b90[_0x72f3('0x38')],'interface':_0x40f2a4,'enterAt':moment()['format'](_0x72f3('0xfd')),'role':_0x1f1b90[_0x72f3('0x29')],'internal':_0x1f1b90['internal']};_0x51391f['forEach'](function(_0x2a23d1){_0x5244fe['push'](_[_0x72f3('0xd9')]({'channel':_0x2a23d1,'type':'LOGIN','data1':_0x8f14f1[_0x72f3('0x5f')][_0x72f3('0xfe')],'data2':_0x40f2a4},_0x30b510));if(_0x1f1b90[_0x72f3('0x9d')]){_0x3e0818[_0x72f3('0x50')](_[_0x72f3('0xd9')]({'channel':_0x2a23d1,'type':_0x72f3('0xff'),'data1':'LOGININPAUSE'},_0x30b510));}});return db[_0x72f3('0xfa')]['bulkCreate'](_0x5244fe[_0x72f3('0x100')](_0x3e0818),{'individualHooks':!![]});}})[_0x72f3('0x1f')](function(){if(_0x1f1b90){return _0x1f1b90[_0x72f3('0x5e')]({'online':!![],'lastLoginAt':moment()['format'](_0x72f3('0xfd')),'voicePause':_0x1f1b90['loginInPause']||![],'mailPause':_0x1f1b90[_0x72f3('0x9d')]||![],'chatPause':_0x1f1b90['loginInPause']||![],'faxPause':_0x1f1b90[_0x72f3('0x9d')]||![],'smsPause':_0x1f1b90[_0x72f3('0x9d')]||![],'openchannelPause':_0x1f1b90[_0x72f3('0x9d')]||![],'whatsappPause':_0x1f1b90[_0x72f3('0x9d')]||![],'pauseType':_0x1f1b90[_0x72f3('0x9d')]?'LOGININPAUSE':null,'interface':_0x40f2a4,'lastPauseAt':moment()[_0x72f3('0xab')](_0x72f3('0xfd'))});}})[_0x72f3('0x1f')](function(_0x4b5aea){if(_0x8f14f1[_0x72f3('0x101')]){return _0x2636a5();}else{return Promise['resolve'](_0x4b5aea)['then'](respondWithResult(_0x284c7c,null));}})['catch'](handleError(_0x284c7c,null));};exports['logout']=function(_0x8e0aaa,_0x48d26e){var _0x206498;return db['User']['find']({'where':{'id':_0x8e0aaa[_0x72f3('0x60')]['id'],'role':_0x72f3('0x2a')},'attributes':['id',_0x72f3('0x38'),_0x72f3('0x29')]})[_0x72f3('0x1f')](handleEntityNotFound(_0x48d26e,null))[_0x72f3('0x1f')](function(_0x4b2eaa){if(_0x4b2eaa){_0x206498=_0x4b2eaa;return db[_0x72f3('0xb3')][_0x72f3('0x3a')]({'where':{'membername':_0x206498[_0x72f3('0x38')]},'individualHooks':!![]});}})[_0x72f3('0x1f')](function(){return db[_0x72f3('0xfa')][_0x72f3('0x51')]({'where':{'membername':_0x206498[_0x72f3('0x38')],'exitAt':null}});})[_0x72f3('0x1f')](function(_0x1eed03){var _0x4edf01=[];_0x1eed03['forEach'](function(_0x5e3ec8){_0x4edf01[_0x72f3('0x50')](_0x5e3ec8[_0x72f3('0x5e')]({'exitAt':moment()[_0x72f3('0xab')](_0x72f3('0xfd'))}));});return Promise[_0x72f3('0x5d')](_0x4edf01);})[_0x72f3('0x1f')](function(){return _0x206498[_0x72f3('0x5e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x72f3('0x1f')](respondWithResult(_0x48d26e,null))[_0x72f3('0x28')](handleError(_0x48d26e,null));};exports[_0x72f3('0x102')]=function(_0x1a4d63,_0x198505){var _0x3251ed;return db[_0x72f3('0xb3')][_0x72f3('0x5e')]({'paused':0x1},{'where':{'UserId':_0x1a4d63[_0x72f3('0x60')]['id']},'individualHooks':!![]})[_0x72f3('0x1f')](function(){return db[_0x72f3('0x3d')]['find']({'where':{'id':_0x1a4d63[_0x72f3('0x60')]['id'],'role':_0x72f3('0x2a')},'attributes':['id',_0x72f3('0x38'),_0x72f3('0x29'),'internal',_0x72f3('0x9f'),_0x72f3('0xaa')]});})['then'](handleEntityNotFound(_0x198505,null))['then'](function(_0x55cc5f){if(_0x55cc5f){_0x3251ed=_0x55cc5f;return respondWithRpcPromise(_0x72f3('0x103'),_0x72f3('0x102'),{'id':_0x3251ed['id'],'name':_0x3251ed[_0x72f3('0x38')],'pause':!![]});}})[_0x72f3('0x1f')](function(){if(_0x3251ed){return db['MemberReport'][_0x72f3('0x51')]({'where':{'membername':_0x3251ed['name'],'type':_0x72f3('0xff'),'exitAt':null}});}})[_0x72f3('0x1f')](function(_0x37c6d5){if(_0x37c6d5[_0x72f3('0x6f')]){var _0x5ca8ab=moment()[_0x72f3('0xab')](_0x72f3('0xfd'));for(var _0x447df7=0x0,_0x149525=_0x37c6d5['length'];_0x447df7<_0x149525;_0x447df7++){_0x37c6d5[_0x447df7][_0x72f3('0x104')]({'exitAt':_0x5ca8ab});}}})[_0x72f3('0x1f')](function(){var _0x265cd8=[];var _0x38fda6=utils[_0x72f3('0xfc')]();_0x38fda6[_0x72f3('0xfb')](function(_0x3e5a07){_0x265cd8[_0x72f3('0x50')]({'channel':_0x3e5a07,'membername':_0x3251ed[_0x72f3('0x38')],'interface':_['isNil'](_0x3251ed[_0x72f3('0x9f')])?util[_0x72f3('0xab')](_0x72f3('0xac'),_0x3251ed[_0x72f3('0x38')]):_0x3251ed[_0x72f3('0x9f')],'type':_0x72f3('0xff'),'enterAt':moment()[_0x72f3('0xab')](_0x72f3('0xfd')),'data1':_0x1a4d63[_0x72f3('0x5f')][_0x72f3('0x40')]||'DEFAULT\x20PAUSE','role':_0x3251ed[_0x72f3('0x29')],'internal':_0x3251ed[_0x72f3('0x65')]});});return db['MemberReport'][_0x72f3('0x87')](_0x265cd8,{'individualHooks':!![]});})['then'](function(){return _0x3251ed[_0x72f3('0x5e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a4d63[_0x72f3('0x5f')][_0x72f3('0x40')]||_0x72f3('0x105'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x72f3('0x1f')](respondWithResult(_0x198505,null))[_0x72f3('0x28')](handleError(_0x198505,null));};exports[_0x72f3('0x106')]=function(_0x55e44e,_0xc21a8f){if(_0x55e44e[_0x72f3('0x5f')][_0x72f3('0x9c')]&&!utils['isValidChannel'](_0x55e44e[_0x72f3('0x5f')]['channel'])){throw new APIBadRequestError(util[_0x72f3('0xab')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x55e44e[_0x72f3('0x5f')][_0x72f3('0x9c')]));}return db['User']['find']({'where':{'id':_0x55e44e[_0x72f3('0x60')]['id']},'attributes':['id',_0x72f3('0x38'),'role','internal',_0x72f3('0x9f'),_0x72f3('0xaa'),_0x72f3('0x9e'),'mailPause',_0x72f3('0x107'),_0x72f3('0x108'),'openchannelPause',_0x72f3('0x109'),'whatsappPause',_0x72f3('0x10a'),_0x72f3('0x10b')]})[_0x72f3('0x1f')](function(_0x51a994){if(!_0x51a994){throw new APINotFoundError(util[_0x72f3('0xab')]('User\x20with\x20id\x20%s\x20not\x20found',_0x55e44e[_0x72f3('0x60')]['id']));}return _0x51a994['unpause'](_0x55e44e['body'][_0x72f3('0x9c')]);})[_0x72f3('0x1f')](respondWithResult(_0xc21a8f,null))['catch'](APIHandleError(_0xc21a8f));};exports['getTeams']=function(_0x4f746b,_0x19b070){var _0x1a1f93={};var _0x1ec90d={};var _0x511c35;var _0x226433;return db['User'][_0x72f3('0x97')]({'where':{'id':_0x4f746b['params']['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x19b070,null))['then'](function(_0x3e4d56){if(_0x3e4d56){_0x511c35=_0x3e4d56;_0x1ec90d[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db['Team'][_0x72f3('0x3e')]);_0x1ec90d[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x4f746b[_0x72f3('0x4b')]);_0x1ec90d[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x1ec90d[_0x72f3('0xd0')],_0x1ec90d['query']);_0x1a1f93[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x1ec90d['model'],qs[_0x72f3('0xd5')](_0x4f746b[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x1a1f93[_0x72f3('0x4f')]=_0x1a1f93[_0x72f3('0x4f')][_0x72f3('0x6f')]?_0x1a1f93[_0x72f3('0x4f')]:_0x1ec90d[_0x72f3('0xd0')];_0x1a1f93[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x4f746b[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x1a1f93[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_['pick'](_0x4f746b['query'],_0x1ec90d[_0x72f3('0xd3')]));if(_0x4f746b[_0x72f3('0x4b')][_0x72f3('0x32')]){_0x1a1f93['where']=_[_0x72f3('0xd9')](_0x1a1f93[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x1a1f93[_0x72f3('0x4f')],function(_0x20f52a){var _0x4a412a={};_0x4a412a[_0x20f52a]={'$like':'%'+_0x4f746b['query']['filter']+'%'};return _0x4a412a;})});}_0x1a1f93=_[_0x72f3('0xd9')]({},_0x1a1f93,_0x4f746b[_0x72f3('0x5b')]);return _0x511c35[_0x72f3('0x10c')](_0x1a1f93);}})['then'](function(_0x4f79cb){if(_0x4f79cb){_0x226433=_0x4f79cb[_0x72f3('0x6f')];if(!_0x4f746b[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x1a1f93[_0x72f3('0x19')]=qs[_0x72f3('0x19')](_0x4f746b[_0x72f3('0x4b')]['limit']);_0x1a1f93[_0x72f3('0x18')]=qs['offset'](_0x4f746b[_0x72f3('0x4b')][_0x72f3('0x18')]);}return _0x511c35[_0x72f3('0x10c')](_0x1a1f93);}})[_0x72f3('0x1f')](function(_0x2e6862){if(_0x2e6862){return _0x2e6862?{'count':_0x226433,'rows':_0x2e6862}:null;}})[_0x72f3('0x1f')](respondWithResult(_0x19b070,null))[_0x72f3('0x28')](handleError(_0x19b070,null));};exports[_0x72f3('0x10d')]=function(_0x1b6d44,_0xca006b){var _0x3be2f6=_0x1b6d44['params']['id'];var _0x2bb9ee=_0x1b6d44[_0x72f3('0x5f')]?_0x1b6d44['body'][_0x72f3('0x63')]:null;var _0x52a849=[];return Promise[_0x72f3('0x10e')]()[_0x72f3('0x1f')](function(){if(!_0x2bb9ee)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x72f3('0x1f')](function(){return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x3be2f6}});})['then'](function(_0x4b36ba){if(!_0x4b36ba)throw new APINotFoundError(util['format'](_0x72f3('0xc9'),_0x1b6d44[_0x72f3('0x60')]['id']));return db[_0x72f3('0x6c')][_0x72f3('0x10f')](function(_0xf3e421){return _0x4b36ba[_0x72f3('0x10d')](_0x2bb9ee,{'transaction':_0xf3e421})['then'](function(){return db['Team'][_0x72f3('0x51')]({'where':{'id':{'$in':_0x2bb9ee}}});})['then'](function(_0x1b21ab){var _0x1745f5=_[_0x72f3('0x34')](_0x1b21ab,function(_0x371312){return _0x371312[_0x72f3('0x110')]();});return Promise['all'](_0x1745f5);})['then'](function(_0x7511c2){_0x52a849=_[_0x72f3('0x111')](_0x7511c2);var _0x5763b2=_[_0x72f3('0x34')](_0x52a849,function(_0x34ac15){return _0x34ac15[_0x72f3('0x112')](_0x4b36ba['id'],{'transaction':_0xf3e421});});return Promise[_0x72f3('0x5d')](_0x5763b2);})[_0x72f3('0x1f')](function(){if(!_0x4b36ba[_0x72f3('0xaa')])return;var _0x2fad6b=_[_0x72f3('0x32')](_0x52a849,function(_0xfaa50){return _0xfaa50['getDataValue'](_0x72f3('0x9c'))===_0x72f3('0x113');});var _0x179bc5=_['map'](_0x2fad6b,function(_0x19a046){return db[_0x72f3('0xb3')][_0x72f3('0xad')]({'membername':_0x4b36ba[_0x72f3('0x38')],'UserId':_0x4b36ba['id'],'queue_name':_0x19a046[_0x72f3('0x38')],'VoiceQueueId':_0x19a046['id'],'interface':_['isNil'](_0x4b36ba[_0x72f3('0x9f')])?util[_0x72f3('0xab')](_0x72f3('0xac'),_0x4b36ba[_0x72f3('0x38')]):_0x4b36ba[_0x72f3('0x9f')],'paused':_0x4b36ba[_0x72f3('0x9e')]||![],'penalty':_0x4b36ba[_0x72f3('0xa5')]},{'transaction':_0xf3e421});});return Promise['all'](_0x179bc5);})[_0x72f3('0x1f')](function(){return db[_0x72f3('0x114')][_0x72f3('0x51')]({'where':{'teamId':{'$in':_0x2bb9ee}}});})[_0x72f3('0x1f')](function(_0xe967b5){var _0x2a4ee5=_[_0x72f3('0x34')](_0xe967b5,function(_0x4bef43){return db['UserVoicePrefix'][_0x72f3('0x82')]({'UserId':_0x4b36ba['id'],'VoicePrefixId':_0x4bef43['VoicePrefixId']},{'transaction':_0xf3e421});});return Promise[_0x72f3('0x5d')](_0x2a4ee5);});});})[_0x72f3('0x1f')](function(){for(var _0x31f0c9=0x0;_0x31f0c9<_0x52a849['length'];_0x31f0c9++){var _0x3cce1f=_0x52a849[_0x31f0c9][_0x72f3('0x115')](_0x72f3('0x9c'));var _0x3c2b6d=_0x3cce1f+_0x72f3('0xa6');socket[_0x72f3('0x2b')](_0x72f3('0x2e')+_0x3cce1f+_0x72f3('0x116'),{'UserId':_0x3be2f6,['queueField']:_0x52a849[_0x31f0c9]['id']});}})['then'](respondWithStatusCode(_0xca006b,null))[_0x72f3('0x28')](APIHandleError(_0xca006b));};exports[_0x72f3('0x117')]=function(_0x29af75,_0x45ed72){var _0x10d356=_0x29af75[_0x72f3('0x60')]['id'];var _0x16e250=null;if(_0x29af75['query'][_0x72f3('0x63')]){_0x16e250=_['isArray'](_0x29af75['query'][_0x72f3('0x63')])?_0x29af75[_0x72f3('0x4b')][_0x72f3('0x63')]:[_0x29af75[_0x72f3('0x4b')][_0x72f3('0x63')]];}var _0x64ac40=[];return Promise[_0x72f3('0x10e')]()[_0x72f3('0x1f')](function(){if(!_0x16e250)throw new APIBadRequestError(_0x72f3('0x118'));})[_0x72f3('0x1f')](function(){return db['User'][_0x72f3('0x97')]({'where':{'id':_0x10d356}});})[_0x72f3('0x1f')](function(_0x2e2ec7){if(!_0x2e2ec7)throw new APINotFoundError(util[_0x72f3('0xab')](_0x72f3('0xc9'),_0x29af75[_0x72f3('0x60')]['id']));return db[_0x72f3('0x6c')][_0x72f3('0x10f')](function(_0x1946e6){return _0x2e2ec7[_0x72f3('0x117')](_0x16e250,{'transaction':_0x1946e6})[_0x72f3('0x1f')](function(){return db[_0x72f3('0x119')][_0x72f3('0x51')]({'where':{'id':{'$in':_0x16e250}}});})[_0x72f3('0x1f')](function(_0x44b188){var _0x5976c4=_[_0x72f3('0x34')](_0x44b188,function(_0x37411a){return _0x37411a['getAssociatedQueues']();});return Promise[_0x72f3('0x5d')](_0x5976c4);})['then'](function(_0x56fb15){_0x64ac40=_['flattenDeep'](_0x56fb15);var _0x1493aa=_[_0x72f3('0x34')](_0x64ac40,function(_0x5df6a0){return _0x5df6a0[_0x72f3('0x11a')](_0x2e2ec7['id'],{'transaction':_0x1946e6});});return Promise[_0x72f3('0x5d')](_0x1493aa);})[_0x72f3('0x1f')](function(){if(!_0x2e2ec7['online'])return;var _0x1fd662=_[_0x72f3('0x32')](_0x64ac40,function(_0x32547f){return _0x32547f['getDataValue'](_0x72f3('0x9c'))===_0x72f3('0x113');});var _0xe9f245=_[_0x72f3('0x34')](_0x1fd662,function(_0x128fda){return db[_0x72f3('0xb3')][_0x72f3('0x3a')]({'where':{'VoiceQueueId':_0x128fda['id'],'UserId':_0x2e2ec7['id']},'transaction':_0x1946e6});});return Promise[_0x72f3('0x5d')](_0xe9f245);})[_0x72f3('0x1f')](function(){return db[_0x72f3('0x114')][_0x72f3('0x51')]({'where':{'teamId':{'$in':_0x16e250}}});})['then'](function(_0xbefbd9){var _0x57799d=_['map'](_0xbefbd9,function(_0x441e63){return db['UserVoicePrefix'][_0x72f3('0x3a')]({'where':{'UserId':_0x2e2ec7['id'],'VoicePrefixId':_0x441e63[_0x72f3('0x11b')]}},{'transaction':_0x1946e6});});return Promise[_0x72f3('0x5d')](_0x57799d);});});})[_0x72f3('0x1f')](function(){for(var _0xbcac96=0x0;_0xbcac96<_0x64ac40[_0x72f3('0x6f')];_0xbcac96++){var _0x459a74=_0x64ac40[_0xbcac96][_0x72f3('0x115')]('channel');var _0x227d8b=_0x459a74+'QueueId';socket[_0x72f3('0x2b')](_0x72f3('0x2e')+_0x459a74+_0x72f3('0xb2'),{'UserId':_0x10d356,['queueField']:_0x64ac40[_0xbcac96]['id']});}})[_0x72f3('0x1f')](respondWithStatusCode(_0x45ed72,null))[_0x72f3('0x28')](APIHandleError(_0x45ed72));};exports['getLists']=function(_0x31074b,_0x551328){var _0x3ee82b={};var _0x4cb3bd={};var _0x8d2e2c;var _0x412f9a;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x31074b[_0x72f3('0x60')]['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x551328,null))[_0x72f3('0x1f')](function(_0x52b08e){if(_0x52b08e){_0x8d2e2c=_0x52b08e;_0x4cb3bd[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db['CmList'][_0x72f3('0x3e')]);_0x4cb3bd[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x31074b[_0x72f3('0x4b')]);_0x4cb3bd[_0x72f3('0xd3')]=_[_0x72f3('0xd4')](_0x4cb3bd[_0x72f3('0xd0')],_0x4cb3bd['query']);_0x3ee82b[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x4cb3bd['model'],qs[_0x72f3('0xd5')](_0x31074b[_0x72f3('0x4b')][_0x72f3('0xd5')]));_0x3ee82b[_0x72f3('0x4f')]=_0x3ee82b[_0x72f3('0x4f')][_0x72f3('0x6f')]?_0x3ee82b[_0x72f3('0x4f')]:_0x4cb3bd[_0x72f3('0xd0')];_0x3ee82b[_0x72f3('0xd6')]=qs[_0x72f3('0xd7')](_0x31074b[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x3ee82b[_0x72f3('0x49')]=qs[_0x72f3('0xd3')](_[_0x72f3('0xd8')](_0x31074b[_0x72f3('0x4b')],_0x4cb3bd['filters']));if(_0x31074b['query'][_0x72f3('0x32')]){_0x3ee82b[_0x72f3('0x49')]=_[_0x72f3('0xd9')](_0x3ee82b[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x3ee82b[_0x72f3('0x4f')],function(_0x5753de){var _0x5acee1={};_0x5acee1[_0x5753de]={'$like':'%'+_0x31074b['query']['filter']+'%'};return _0x5acee1;})});}_0x3ee82b=_['merge']({},_0x3ee82b,_0x31074b[_0x72f3('0x5b')]);return _0x8d2e2c['getLists'](_0x3ee82b);}})[_0x72f3('0x1f')](function(_0x31554a){if(_0x31554a){_0x412f9a=_0x31554a[_0x72f3('0x6f')];if(!_0x31074b[_0x72f3('0x4b')][_0x72f3('0xca')](_0x72f3('0xdc'))){_0x3ee82b[_0x72f3('0x19')]=qs['limit'](_0x31074b[_0x72f3('0x4b')]['limit']);_0x3ee82b[_0x72f3('0x18')]=qs[_0x72f3('0x18')](_0x31074b[_0x72f3('0x4b')][_0x72f3('0x18')]);}return _0x8d2e2c[_0x72f3('0x11c')](_0x3ee82b);}})[_0x72f3('0x1f')](function(_0x529f0d){if(_0x529f0d){return _0x529f0d?{'count':_0x412f9a,'rows':_0x529f0d}:null;}})[_0x72f3('0x1f')](respondWithResult(_0x551328,null))[_0x72f3('0x28')](handleError(_0x551328,null));};exports[_0x72f3('0x11d')]=function(_0x1c08ae,_0x38b3ce){var _0x2684d2={};var _0x59c855={};var _0x1fff47;return db[_0x72f3('0x3d')][_0x72f3('0x97')]({'where':{'id':_0x1c08ae['params']['id']}})[_0x72f3('0x1f')](handleEntityNotFound(_0x38b3ce,null))[_0x72f3('0x1f')](function(_0x4c2df0){if(_0x4c2df0){_0x1fff47=_0x4c2df0;_0x59c855[_0x72f3('0xd0')]=_[_0x72f3('0xd1')](db[_0x72f3('0x3d')]['rawAttributes']);_0x59c855[_0x72f3('0x4b')]=_[_0x72f3('0xd1')](_0x1c08ae[_0x72f3('0x4b')]);_0x59c855['filters']=_[_0x72f3('0xd4')](_0x59c855[_0x72f3('0xd0')],_0x59c855[_0x72f3('0x4b')]);_0x2684d2[_0x72f3('0x4f')]=_[_0x72f3('0xd4')](_0x59c855[_0x72f3('0xd0')],qs['fields'](_0x1c08ae['query'][_0x72f3('0xd5')]));_0x2684d2[_0x72f3('0x4f')]=_0x2684d2['attributes'][_0x72f3('0x6f')]?_0x2684d2['attributes']:_0x59c855[_0x72f3('0xd0')];_0x2684d2['order']=qs['sort'](_0x1c08ae[_0x72f3('0x4b')][_0x72f3('0xd7')]);_0x2684d2[_0x72f3('0x49')]=qs['filters'](_[_0x72f3('0xd8')](_0x1c08ae[_0x72f3('0x4b')],_0x59c855['filters']));if(_0x1c08ae['query'][_0x72f3('0x32')]){_0x2684d2['where']=_[_0x72f3('0xd9')](_0x2684d2[_0x72f3('0x49')],{'$or':_[_0x72f3('0x34')](_0x2684d2['attributes'],function(_0x4b09af){var _0x3aca63={};_0x3aca63[_0x4b09af]={'$like':'%'+_0x1c08ae[_0x72f3('0x4b')]['filter']+'%'};return _0x3aca63;})});}_0x2684d2[_0x72f3('0xd0')]=db['User'];_0x2684d2['as']=_0x72f3('0x2f');_0x2684d2=_['merge']({},_0x2684d2,_0x1c08ae[_0x72f3('0x5b')]);return _0x1fff47['getVoiceQueues']({'include':[_0x2684d2]});}})[_0x72f3('0x1f')](function(_0x7ccbb0){if(_0x7ccbb0){var _0x243ea8={},_0x1b098e=[];for(var _0x229c6c=0x0;_0x229c6c<_0x7ccbb0[_0x72f3('0x6f')];_0x229c6c+=0x1){for(var _0x5cc6af=0x0,_0x4f5019;_0x5cc6af<_0x7ccbb0[_0x229c6c]['Agents'][_0x72f3('0x6f')];_0x5cc6af+=0x1){_0x4f5019=_0x7ccbb0[_0x229c6c][_0x72f3('0x2f')][_0x5cc6af][_0x72f3('0xa8')]({'plain':!![]});_0x243ea8[_0x4f5019['id']]=_0x4f5019;}}_0x243ea8=_['values'](_0x243ea8);for(var _0x1bb00a=qs[_0x72f3('0x18')](_0x1c08ae[_0x72f3('0x4b')]['offset']);_0x1bb00a<_0x243ea8['length']&&_0x1b098e[_0x72f3('0x6f')]=_0x543ea4){_0x125338=_0x543ea4;_0x12fd46=0xc8;}else{_0x12fd46=0xce;}_0x107fe2[_0xb6e3('0x18')](_0x12fd46);return _0x107fe2[_0xb6e3('0x1e')](_0xb6e3('0x1f'),_0x31532e+'-'+_0x125338+'/'+_0x543ea4)['json'](_0x3839f3);}return null;};}function respondWithRpcPromise(_0x119f10,_0x3452c1,_0x6c21e1,_0x6b92bf){return new Promise(function(_0x2fc578,_0xfdb9f7){var _0x3e7b96=_0x6b92bf||amiClient;return _0x3e7b96[_0xb6e3('0x20')](_0x119f10,_0x6c21e1)[_0xb6e3('0x21')](function(_0x55a8a6){logger[_0xb6e3('0x22')]('User,\x20%s,\x20%s',_0x3452c1,'request\x20sent');logger[_0xb6e3('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x3452c1,_0xb6e3('0x24'),JSON[_0xb6e3('0x25')](_0x55a8a6));if(_0x55a8a6[_0xb6e3('0x26')]){if(_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x27')]===0x1f4){logger[_0xb6e3('0x26')](_0xb6e3('0x28'),_0x3452c1,_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x29')]);return _0xfdb9f7(_0x55a8a6['error'][_0xb6e3('0x29')]);}logger['error']('User,\x20%s,\x20%s',_0x3452c1,_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x29')]);return _0x2fc578(_0x55a8a6[_0xb6e3('0x26')][_0xb6e3('0x29')]);}else{logger[_0xb6e3('0x22')](_0xb6e3('0x28'),_0x3452c1,'request\x20sent');_0x2fc578(_0x55a8a6[_0xb6e3('0x2a')][_0xb6e3('0x29')]);}})[_0xb6e3('0x2b')](function(_0x402d8b){logger[_0xb6e3('0x26')](_0xb6e3('0x28'),_0x3452c1,_0x402d8b);_0xfdb9f7(_0x402d8b);});});}function saveUpdates(_0xddca8){return function(_0x535754){if(_0x535754){return _0x535754[_0xb6e3('0x2c')](_0xddca8)['then'](function(_0x20374b){if(_0x20374b[_0xb6e3('0x2d')]===_0xb6e3('0x2e')){socket[_0xb6e3('0x2f')](_0xb6e3('0x30')+_0x20374b['id'],_0x20374b);}return _0x20374b;});}return null;};}function removeEntity(_0x2555c3,_0x13997d){return function(_0x23f25b){if(_0x23f25b){return _0x23f25b['destroy']({'transaction':_0x13997d})[_0xb6e3('0x21')](function(){var _0x5e9167=_0x23f25b[_0xb6e3('0x31')]({'plain':!![]});if(_0x5e9167['role']===_0xb6e3('0x32'))return;var _0x3fed1a=[{'name':_0xb6e3('0x33'),'value':_0xb6e3('0x34'),'ignore':!![]},{'name':_0xb6e3('0x35'),'value':_0xb6e3('0x2e'),'ignore':![]},{'name':_0xb6e3('0x36'),'value':_0xb6e3('0x37'),'ignore':![]}];var _0x3e296c=_(_0x3fed1a)[_0xb6e3('0x38')]('ignore')['map']('value')['value']();if(_[_0xb6e3('0x39')](_0x3e296c,_0x5e9167['role'])){return;}var _0x2220b0=_['find'](_0x3fed1a,[_0xb6e3('0x3a'),_0x5e9167['role']])[_0xb6e3('0x3b')];return db[_0xb6e3('0x3c')]['destroy']({'where':{'type':_0x2220b0,'resourceId':_0x5e9167['id']},'transaction':_0x13997d})['then'](function(){return _0x23f25b;});})[_0xb6e3('0x21')](function(){_0x2555c3[_0xb6e3('0x18')](0xcc)[_0xb6e3('0x3d')]();});}};}function handleEntityNotFound(_0x27114f){return function(_0x2b822b){if(!_0x2b822b){_0x27114f[_0xb6e3('0x3e')](0x194);}return _0x2b822b;};}function handleError(_0x2b6786,_0xf39288){_0xf39288=_0xf39288||0x1f4;return function(_0x340ee3){logger['error'](_0x340ee3[_0xb6e3('0x3f')]);if(_0x340ee3[_0xb6e3('0x3b')]){delete _0x340ee3[_0xb6e3('0x3b')];}_0x2b6786[_0xb6e3('0x18')](_0xf39288)[_0xb6e3('0x40')](_0x340ee3);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0xb6e3('0x41')](function(_0x48344c){return{'name':_0x48344c['fieldName'],'type':_0x48344c[_0xb6e3('0x42')][_0xb6e3('0x43')]};})['filter'](function(_0x52a460){return![_0xb6e3('0x44'),_0xb6e3('0x45'),'previousPasswords','resetPasswordToken',_0xb6e3('0x46'),_0xb6e3('0x47')][_0xb6e3('0x39')](_0x52a460[_0xb6e3('0x3b')]);})['value']();}exports[_0xb6e3('0x48')]=function(_0x3a3e33,_0x4b7395){var _0x161ed8={},_0x784449={'count':0x0,'rows':[]};var _0x27599f=getUserAttributes();_0x161ed8=qs[_0xb6e3('0x49')](_0x27599f,_0x3a3e33);var _0x47f6ae={'where':_0x161ed8[_0xb6e3('0x4a')]};return db[_0xb6e3('0x4b')][_0xb6e3('0x1b')](_0x47f6ae)['then'](function(_0x164c10){_0x784449[_0xb6e3('0x1b')]=_0x164c10;if(_0x3a3e33[_0xb6e3('0x4c')]['includeAll']){_0x161ed8['include']=[{'all':!![]}];}if(_0x3a3e33[_0xb6e3('0x4c')]['userSetting']===_0xb6e3('0x4d')){_0x161ed8['include']=[{'model':db[_0xb6e3('0x4e')],'as':'userSetting'}];}if(!_['includes'](_0x161ed8[_0xb6e3('0x4f')],'id')){_0x161ed8[_0xb6e3('0x4f')][_0xb6e3('0x50')]('id');}return db[_0xb6e3('0x4b')][_0xb6e3('0x51')](_0x161ed8);})[_0xb6e3('0x21')](function(_0x4b9382){_0x784449['rows']=_0x4b9382;if(_0x3a3e33[_0xb6e3('0x4c')][_0xb6e3('0x52')]===_0xb6e3('0x4d')){var _0x5ee2d2=[];for(var _0x44c54c=0x0;_0x44c54c<_0x784449['rows'][_0xb6e3('0x53')];_0x44c54c++){_0x5ee2d2['push'](get_open_tabs(_0xb6e3('0x54'),_0x784449[_0xb6e3('0x55')][_0x44c54c]['dataValues']));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x56'),_0x784449['rows'][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x58'),_0x784449[_0xb6e3('0x55')][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x59'),_0x784449[_0xb6e3('0x55')][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5a'),_0x784449[_0xb6e3('0x55')][_0x44c54c][_0xb6e3('0x57')]));_0x5ee2d2[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5b'),_0x784449[_0xb6e3('0x55')][_0x44c54c]['dataValues']));}return Promise[_0xb6e3('0x5c')](_0x5ee2d2)['then'](function(){return _0x784449;});}else{return _0x784449;}})['then'](respondWithFilteredResult(_0x4b7395,_0x161ed8))[_0xb6e3('0x2b')](handleError(_0x4b7395,null));};exports['show']=function(_0x16655f,_0x25589e){var _0x25cc58=getUserAttributes();_0x16655f[_0xb6e3('0x4c')]['id']=_0x16655f[_0xb6e3('0x5d')]['id'];var _0x57d00a=qs[_0xb6e3('0x49')](_0x25cc58,_0x16655f);if(_0x16655f[_0xb6e3('0x4c')]['includeAll']){_0x57d00a[_0xb6e3('0x5e')]=[{'all':!![]}];}if(_0x16655f[_0xb6e3('0x4c')][_0xb6e3('0x5f')]===_0xb6e3('0x4d')){_0x57d00a[_0xb6e3('0x5e')]=[{'model':db[_0xb6e3('0x4e')],'as':'userSetting'}];}_0x57d00a=_[_0xb6e3('0x60')]({},_0x57d00a,_0x16655f[_0xb6e3('0x61')]);if(!_[_0xb6e3('0x39')](_0x57d00a[_0xb6e3('0x4f')],'id')){_0x57d00a['attributes'][_0xb6e3('0x50')]('id');}return db[_0xb6e3('0x4b')]['find'](_0x57d00a)[_0xb6e3('0x21')](handleEntityNotFound(_0x25589e,null))['then'](function(_0x1260e3){var _0x276b6b=[];values=_0x1260e3;if(_0x16655f[_0xb6e3('0x4c')][_0xb6e3('0x52')]===_0xb6e3('0x4d')){_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x54'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x56'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5a'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5b'),_0x1260e3[_0xb6e3('0x57')]));_0x276b6b[_0xb6e3('0x50')](get_open_tabs('fax',_0x1260e3['dataValues']));_0x276b6b[_0xb6e3('0x50')](get_open_tabs('mail',_0x1260e3['dataValues']));return Promise[_0xb6e3('0x5c')](_0x276b6b);}else{return values;}})[_0xb6e3('0x21')](function(){return values;})[_0xb6e3('0x21')](respondWithResult(_0x25589e,null))[_0xb6e3('0x2b')](handleError(_0x25589e,null));};exports[_0xb6e3('0x2c')]=function(_0x209008,_0xb0ea34){if(_0x209008['body']['id']){delete _0x209008['body']['id'];}delete _0x209008[_0xb6e3('0x62')][_0xb6e3('0x2d')];return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x209008[_0xb6e3('0x5d')]['id']}})['then'](handleEntityNotFound(_0xb0ea34,null))[_0xb6e3('0x21')](saveUpdates(_0x209008[_0xb6e3('0x62')],null))['then'](respondWithResult(_0xb0ea34,null))['catch'](handleError(_0xb0ea34,null));};exports[_0xb6e3('0x64')]=function(_0x511cd6,_0x1e5dc5){return db[_0xb6e3('0x4b')][_0xb6e3('0x64')]()['then'](respondWithResult(_0x1e5dc5,null))[_0xb6e3('0x2b')](handleError(_0x1e5dc5,null));};exports[_0xb6e3('0x65')]=function(_0x498b99,_0x4697b0){return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x498b99[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x4697b0,null))[_0xb6e3('0x21')](function(_0xc781a0){if(_0xc781a0){return _0xc781a0[_0xb6e3('0x65')](_0x498b99[_0xb6e3('0x62')][_0xb6e3('0x66')],_['omit'](_0x498b99[_0xb6e3('0x62')],[_0xb6e3('0x66'),'id'])||{});}})[_0xb6e3('0x21')](respondWithResult(_0x4697b0,null))[_0xb6e3('0x2b')](handleError(_0x4697b0,null));};function validateUser(_0x1e3534){return new Promise(function(_0x2e51a4,_0x4b8c85){if(_0x1e3534[_0xb6e3('0x67')])return _0x2e51a4(_0x1e3534);return db[_0xb6e3('0x68')][_0xb6e3('0x69')](0x1)[_0xb6e3('0x21')](function(_0x4f8a9a){if(_0x4f8a9a[_0xb6e3('0x6a')])authService['validatePasswordPattern'](_0x1e3534[_0xb6e3('0x44')]);db[_0xb6e3('0x4b')][_0xb6e3('0x6b')](_0xb6e3('0x67'))['then'](function(_0x238f34){if(_['isNil'](_0x238f34)){_0x1e3534['internal']=_0x4f8a9a[_0xb6e3('0x6c')]||0x1;return;}if(_[_0xb6e3('0x6d')](_0x4f8a9a['min_internal'])||_0x4f8a9a[_0xb6e3('0x6c')]===_0x238f34){_0x1e3534[_0xb6e3('0x67')]=_0x238f34+0x1;return;}if(_0x4f8a9a[_0xb6e3('0x6c')]>_0x238f34){_0x1e3534[_0xb6e3('0x67')]=_0x4f8a9a['min_internal'];return;}return db[_0xb6e3('0x6e')][_0xb6e3('0x4c')](_0xb6e3('0x6f'),{'type':db[_0xb6e3('0x6e')][_0xb6e3('0x70')][_0xb6e3('0x71')]})[_0xb6e3('0x21')](function(_0x2e7aa9){if(_0x2e7aa9&&_0x2e7aa9[_0xb6e3('0x53')]){for(var _0x2ffc8e=0x0,_0x4afd14=_0x2e7aa9[_0xb6e3('0x53')];_0x2ffc8e<_0x4afd14&&_[_0xb6e3('0x6d')](_0x1e3534[_0xb6e3('0x67')]);_0x2ffc8e++){if(_0x4f8a9a[_0xb6e3('0x6c')]<=_0x2e7aa9[_0x2ffc8e][_0xb6e3('0x72')]){_0x1e3534[_0xb6e3('0x67')]=_0x2e7aa9[_0x2ffc8e]['from'];}else if(_0x4f8a9a[_0xb6e3('0x6c')]>_0x2e7aa9[_0x2ffc8e][_0xb6e3('0x72')]&&_0x4f8a9a[_0xb6e3('0x6c')]<=_0x2e7aa9[_0x2ffc8e]['to']){_0x1e3534[_0xb6e3('0x67')]=_0x4f8a9a[_0xb6e3('0x6c')];}}}if(_[_0xb6e3('0x6d')](_0x1e3534['internal'])){_0x1e3534[_0xb6e3('0x67')]=_0x238f34+0x1;}return _0x2e51a4(_0x1e3534);});});})['catch'](function(_0x43b505){_0x4b8c85(_0x43b505);});});}function updateUser(_0xb22d37){return new Promise(function(_0x5f88b3,_0x11ff3a){try{if(_0xb22d37[_0xb6e3('0x73')]){_0xb22d37[_0xb6e3('0x74')]=_0xb22d37['internal'];_0xb22d37['VoiceMail']={'mailbox':_0xb22d37['internal'],'password':_0xb22d37[_0xb6e3('0x44')],'fullname':_0xb22d37[_0xb6e3('0x75')],'email':_0xb22d37[_0xb6e3('0x76')]};}if(_0xb22d37[_0xb6e3('0x2d')]==='agent'){if(!_0xb22d37['permissions'])_0xb22d37[_0xb6e3('0x77')]=[_0xb6e3('0x78'),_0xb6e3('0x79'),_0xb6e3('0x7a'),_0xb6e3('0x7b'),_0xb6e3('0x7c'),_0xb6e3('0x7d'),'105',_0xb6e3('0x7e'),_0xb6e3('0x7f'),_0xb6e3('0x80'),_0xb6e3('0x81'),'100','111',_0xb6e3('0x82'),_0xb6e3('0x83')];}_0x5f88b3(_0xb22d37);}catch(_0x5abcae){_0x11ff3a(_0x5abcae);}});}exports[_0xb6e3('0x84')]=function(_0x3f2cfc,_0x16ab7e){if(_0x3f2cfc[_0xb6e3('0x34')]['role']===_0xb6e3('0x2e'))throw new Error('Unauthorized');if(_0x3f2cfc['body']['role']===_0xb6e3('0x34')&&_0x3f2cfc['user'][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error(_0xb6e3('0x85'));}if(_0x3f2cfc[_0xb6e3('0x62')][_0xb6e3('0x2d')]===_0xb6e3('0x32')&&_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error(_0xb6e3('0x86'));}return licenseUtil['checkUserLimits']([_0x3f2cfc['body']])[_0xb6e3('0x21')](function(){return validateUser(_0x3f2cfc[_0xb6e3('0x62')]);})[_0xb6e3('0x21')](function(_0x2fbf06){return updateUser(_0x2fbf06)[_0xb6e3('0x21')](function(_0x152770){if(_0x152770[_0xb6e3('0x2d')]==='admin'){_0x152770[_0xb6e3('0x87')]=_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x87')];delete _0x152770['userProfileId'];}return _0x152770;});})['then'](function(_0x2b9fe3){return db[_0xb6e3('0x4b')][_0xb6e3('0x84')](_0x2b9fe3,{'include':[{'model':db[_0xb6e3('0x88')],'as':_0xb6e3('0x88')}]});})[_0xb6e3('0x21')](function(_0x65e5cf){if(_0x3f2cfc[_0xb6e3('0x62')][_0xb6e3('0x2d')]===_0xb6e3('0x34'))return _0x65e5cf;if(_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x2d')]!==_0xb6e3('0x34'))return _0x65e5cf;return db[_0xb6e3('0x89')]['find']({'where':{'name':_0x65e5cf[_0xb6e3('0x2d')]==='agent'?'Agents':'Telephones','userProfileId':_0x3f2cfc[_0xb6e3('0x34')][_0xb6e3('0x8a')]},'raw':!![]})[_0xb6e3('0x21')](function(_0x518b46){if(!_0x518b46||_0x518b46[_0xb6e3('0x8b')]!=0x0)return _0x65e5cf;return db[_0xb6e3('0x3c')][_0xb6e3('0x84')]({'name':_0x65e5cf[_0xb6e3('0x3b')],'resourceId':_0x65e5cf['id'],'type':_0x518b46[_0xb6e3('0x3b')],'sectionId':_0x518b46['id']},{})['then'](function(){return _0x65e5cf;});})[_0xb6e3('0x2b')](function(_0x8431ad){logger[_0xb6e3('0x26')](_0xb6e3('0x8c'),_0x8431ad);throw _0x8431ad;});})[_0xb6e3('0x21')](respondWithResult(_0x16ab7e,0xc9))[_0xb6e3('0x2b')](handleError(_0x16ab7e,null));};exports[_0xb6e3('0x8d')]=function(_0xb917e1,_0x45e7ac){var _0x187edf=_0xb917e1['body'];var _0x48f23a=[];if(_0xb917e1[_0xb6e3('0x34')][_0xb6e3('0x2d')]===_0xb6e3('0x2e'))throw new Error(_0xb6e3('0x8e'));if(_[_0xb6e3('0x8f')](_0x187edf,[_0xb6e3('0x2d'),_0xb6e3('0x34')])&&_0xb917e1['user'][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error(_0xb6e3('0x85'));}if(_[_0xb6e3('0x8f')](_0x187edf,[_0xb6e3('0x2d'),_0xb6e3('0x32')])&&_0xb917e1[_0xb6e3('0x34')][_0xb6e3('0x2d')]!==_0xb6e3('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xb6e3('0x90')](_0x187edf)[_0xb6e3('0x21')](function(){return validateUser(_0x187edf[0x0]);})[_0xb6e3('0x21')](function(){for(var _0x2f1f5a=0x1;_0x2f1f5a<_0x187edf[_0xb6e3('0x53')];_0x2f1f5a++){var _0x75c164=_0x187edf[_0x2f1f5a-0x1][_0xb6e3('0x67')];if(!_0x187edf[_0x2f1f5a][_0xb6e3('0x67')])_0x187edf[_0x2f1f5a]['internal']=_0x75c164+0x1;_0x48f23a[_0xb6e3('0x50')](validateUser(_0x187edf[_0x2f1f5a]));}return Promise[_0xb6e3('0x5c')](_0x48f23a);})['then'](function(){_0x48f23a=[];for(var _0x296a3a=0x0;_0x296a3a<_0x187edf[_0xb6e3('0x53')];_0x296a3a++){_0x48f23a['push'](updateUser(_0x187edf[_0x296a3a]));}return Promise[_0xb6e3('0x5c')](_0x48f23a);})[_0xb6e3('0x21')](function(){_0x48f23a=_0x187edf[_0xb6e3('0x41')](function(_0x5462a6){return db['User']['create'](_0x5462a6,{'include':[{'model':db['VoiceMail'],'as':_0xb6e3('0x88')}]})[_0xb6e3('0x21')](function(_0x5f8c38){_0x5462a6['id']=_0x5f8c38['id'];return _0x5462a6;});});return Promise[_0xb6e3('0x5c')](_0x48f23a);})[_0xb6e3('0x21')](function(_0x4441a3){if(_0xb917e1[_0xb6e3('0x62')][_0xb6e3('0x2d')]===_0xb6e3('0x34'))return _0x4441a3;if(_0xb917e1[_0xb6e3('0x34')]['role']!==_0xb6e3('0x34'))return _0x4441a3;var _0xdddf37=_[_0xb6e3('0x8f')](_0x4441a3,function(_0x1df197){return _0x1df197[_0xb6e3('0x2d')]===_0xb6e3('0x2e')||_0x1df197[_0xb6e3('0x2d')]===_0xb6e3('0x37');});if(!_0xdddf37)return _0x4441a3;return db[_0xb6e3('0x89')][_0xb6e3('0x51')]({'where':{'name':{'$or':[_0xb6e3('0x35'),_0xb6e3('0x36')]},'userProfileId':_0xb917e1[_0xb6e3('0x34')][_0xb6e3('0x8a')]},'raw':!![]})[_0xb6e3('0x21')](function(_0x1b96d2){if(_[_0xb6e3('0x91')](_0x1b96d2)||!_[_0xb6e3('0x8f')](_0x1b96d2,[_0xb6e3('0x8b'),0x0]))return _0x4441a3;_0x48f23a=[];var _0xaadd17=_(_0x1b96d2)[_0xb6e3('0x41')](function(_0x340389){if(_0x340389['autoAssociation']===0x1)return;return _0x340389[_0xb6e3('0x3b')]==='Agents'?_0xb6e3('0x2e'):_0xb6e3('0x37');})[_0xb6e3('0x92')]()['value']();for(var _0x204e99=0x0;_0x204e99<_0x4441a3[_0xb6e3('0x53')];_0x204e99++){if(!_[_0xb6e3('0x39')](_0xaadd17,_0x4441a3[_0x204e99][_0xb6e3('0x2d')]))return;var _0x3bb6fa=_0x4441a3[_0x204e99][_0xb6e3('0x2d')]===_0xb6e3('0x2e')?_0xb6e3('0x35'):_0xb6e3('0x36');_0x48f23a[_0xb6e3('0x50')](db[_0xb6e3('0x3c')]['create']({'name':_0x4441a3[_0x204e99][_0xb6e3('0x3b')],'resourceId':_0x4441a3[_0x204e99]['id'],'type':_0x3bb6fa,'sectionId':_[_0xb6e3('0x63')](_0x1b96d2,[_0xb6e3('0x3b'),_0x3bb6fa])['id']},{}));}return Promise[_0xb6e3('0x5c')](_0x48f23a);});})[_0xb6e3('0x21')](respondWithResult(_0x45e7ac,0xc9))['catch'](handleError(_0x45e7ac,null));};exports[_0xb6e3('0x93')]=function(_0x4d4152,_0x4644c7){if(_0x4d4152['body']['id']){delete _0x4d4152['body']['id'];}return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4d4152['params']['id']}})[_0xb6e3('0x21')](function(_0x2e0eba){if(!_0x2e0eba)return null;if(_0x2e0eba['id']===_0x4d4152[_0xb6e3('0x34')]['id']){if(!_0x4d4152[_0xb6e3('0x62')]['oldPassword']||!_0x4d4152['body'][_0xb6e3('0x94')]){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0x97'));}if(!_0x2e0eba['authenticate'](_0x4d4152[_0xb6e3('0x62')]['oldPassword'])){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0x98'));}if(_0x4d4152[_0xb6e3('0x62')]['oldPassword']===_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')]){throw new db[(_0xb6e3('0x95'))]['ValidationError'](_0xb6e3('0x99'));}}else if(_0x4d4152[_0xb6e3('0x34')][_0xb6e3('0x2d')]===_0xb6e3('0x32')){if(!_0x4d4152['body'][_0xb6e3('0x94')]){throw new db['Sequelize'][(_0xb6e3('0x96'))](_0xb6e3('0x9a'));}}else if(_0x4d4152[_0xb6e3('0x34')][_0xb6e3('0x2d')]===_0xb6e3('0x34')){if(!_0x4d4152['body'][_0xb6e3('0x94')]){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0x9a'));}if(_0x2e0eba[_0xb6e3('0x2d')]!=='agent'){throw new db[(_0xb6e3('0x95'))]['ValidationError'](_0xb6e3('0x8e'));}}else{throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))]('Unauthorized');}return _0x2e0eba;})['then'](handleEntityNotFound(_0x4644c7,null))[_0xb6e3('0x21')](function(_0x2da911){return db[_0xb6e3('0x68')][_0xb6e3('0x9b')]({'attributes':['id',_0xb6e3('0x6a'),'enforcePasswordHistory',_0xb6e3('0x9c')]})['then'](function(_0x5b5b19){if(_0x5b5b19[_0xb6e3('0x6a')])authService['validatePasswordPattern'](_0x4d4152['body'][_0xb6e3('0x94')]);if(!_0x5b5b19[_0xb6e3('0x9d')]||!_0x2da911[_0xb6e3('0x9e')])return _0x2da911;authService['validatePasswordHistory'](_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')],_0x2da911[_0xb6e3('0x9e')],_0x5b5b19['passwordHistoryLimit']);return _0x2da911;})[_0xb6e3('0x21')](saveUpdates({'password':_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')],'passwordResetAt':_0x4d4152['user']['id']==_0x4d4152['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4d4152[_0xb6e3('0x62')][_0xb6e3('0x94')],_0x2da911['previousPasswords'])},null));})[_0xb6e3('0x21')](respondWithResult(_0x4644c7,null))[_0xb6e3('0x2b')](handleError(_0x4644c7,null));};exports[_0xb6e3('0x9f')]=function(_0x2c1ff9,_0x19233e){var _0x41e3a4=_0x2c1ff9['body']['channel'];return db[_0xb6e3('0x4b')]['find']({'where':{'id':_0x2c1ff9[_0xb6e3('0x5d')]['id']},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d'),_0xb6e3('0xa0'),'loginInPause',_0xb6e3('0xa1'),_0xb6e3('0xa2')]})['then'](handleEntityNotFound(_0x19233e,null))[_0xb6e3('0x21')](function(_0x5a5b23){if(_0x5a5b23){if(!utils[_0xb6e3('0xa3')](_0x41e3a4)){throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))]('Unknown\x20channel');}return _0x5a5b23[_0xb6e3('0xa4')+_[_0xb6e3('0xa5')](_0x41e3a4[_0xb6e3('0xa6')]())+_0xb6e3('0xa7')](_0x2c1ff9['body'][_0xb6e3('0x66')],{'penalty':_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0xa8')]||0x0})[_0xb6e3('0xa9')](function(_0x415afd){for(var _0x23794d=0x0;_0x23794d<_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0x66')][_0xb6e3('0x53')];_0x23794d+=0x1){var _0x34bc1d={'UserId':Number(_0x2c1ff9[_0xb6e3('0x5d')]['id'])};_0x34bc1d[_[_0xb6e3('0xa5')](_0x41e3a4[_0xb6e3('0xa6')]())+'QueueId']=Number(_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0x66')][_0x23794d]);socket['emit'](_0xb6e3('0x34')+_[_0xb6e3('0xa5')](_0x41e3a4[_0xb6e3('0xa6')]())+'Queue:save',_0x34bc1d);}return _0x415afd;})[_0xb6e3('0x21')](function(){if(_0x41e3a4==='voice'){return db[_0xb6e3('0xaa')][_0xb6e3('0x51')]({'where':{'id':_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0x66')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xb6e3('0x21')](function(_0x581fbc){var _0x2159c2=_0x5a5b23[_0xb6e3('0x31')]({'plain':!![]});var _0x46e297=[];if(_0x41e3a4==='voice'&&_0x2159c2['role']===_0xb6e3('0x2e')&&_0x2159c2[_0xb6e3('0xa0')]){for(let _0x391a80=0x0;_0x391a80<_0x581fbc['length'];_0x391a80+=0x1){_0x46e297[_0xb6e3('0x50')]({'membername':_0x2159c2[_0xb6e3('0x3b')],'UserId':_0x2159c2['id'],'queue_name':_0x581fbc[_0x391a80][_0xb6e3('0x3b')],'VoiceQueueId':_0x581fbc[_0x391a80]['id'],'interface':_[_0xb6e3('0x6d')](_0x2159c2[_0xb6e3('0xa2')])?util[_0xb6e3('0xab')](_0xb6e3('0xac'),_0x2159c2[_0xb6e3('0x3b')]):_0x2159c2['interface'],'paused':_0x2159c2[_0xb6e3('0xa1')]||![],'penalty':_0x2c1ff9[_0xb6e3('0x62')][_0xb6e3('0xa8')]||0x0});}return Promise[_0xb6e3('0x5c')](_0x46e297[_0xb6e3('0x41')](function(_0x58bd18){return db[_0xb6e3('0xad')][_0xb6e3('0xae')](_0x58bd18);}));}return _0x5a5b23;});}})[_0xb6e3('0x21')](respondWithStatusCode(_0x19233e,null))['catch'](handleError(_0x19233e,null));};exports[_0xb6e3('0xaf')]=function(_0x4813ea,_0x3a2e81){var _0x434f7a,_0x162a71;return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4813ea['params']['id']},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d')]})[_0xb6e3('0x21')](handleEntityNotFound(_0x3a2e81,null))[_0xb6e3('0x21')](function(_0x2707c6){if(_0x2707c6){_0x434f7a=_0x2707c6;if(!_0x4813ea[_0xb6e3('0x4c')]['channel']||!utils['isValidChannel'](_0x4813ea['query']['channel'])){throw new db[(_0xb6e3('0x95'))]['ValidationError']('Unknown\x20channel');}return _0x2707c6[_0xb6e3('0xb0')+_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')]['channel'][_0xb6e3('0xa6')]())+'Queues'](_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0x66')]);}})[_0xb6e3('0x21')](function(_0x15ee34){if(_[_0xb6e3('0xb1')](_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0x66')])){for(var _0x46fd64=0x0;_0x46fd64<_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0x66')]['length'];_0x46fd64+=0x1){_0x162a71={'UserId':Number(_0x4813ea[_0xb6e3('0x5d')]['id'])};_0x162a71[_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')]['channel'][_0xb6e3('0xa6')]())+_0xb6e3('0xb2')]=Number(_0x4813ea['query'][_0xb6e3('0x66')][_0x46fd64]);socket['emit'](_0xb6e3('0x34')+_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')]['channel'][_0xb6e3('0xa6')]())+_0xb6e3('0xb3'),_0x162a71);}}else{_0x162a71={'UserId':Number(_0x4813ea[_0xb6e3('0x5d')]['id'])};_0x162a71[_[_0xb6e3('0xa5')](_0x4813ea[_0xb6e3('0x4c')][_0xb6e3('0xb4')][_0xb6e3('0xa6')]())+'QueueId']=Number(_0x4813ea[_0xb6e3('0x4c')]['ids']);socket[_0xb6e3('0x2f')](_0xb6e3('0x34')+_[_0xb6e3('0xa5')](_0x4813ea['query'][_0xb6e3('0xb4')][_0xb6e3('0xa6')]())+_0xb6e3('0xb3'),_0x162a71);}return _0x15ee34;})[_0xb6e3('0x21')](function(){if(_0x4813ea['query'][_0xb6e3('0xb4')]==='voice'){return db[_0xb6e3('0xad')][_0xb6e3('0xb5')]({'where':{'UserId':_0x4813ea['params']['id'],'VoiceQueueId':_0x4813ea[_0xb6e3('0x4c')]['ids']},'individualHooks':!![]})[_0xb6e3('0x21')](function(){return _0x434f7a;});}return _0x434f7a;})['then'](respondWithStatusCode(_0x3a2e81,null))[_0xb6e3('0x2b')](handleError(_0x3a2e81,null));};exports[_0xb6e3('0xb6')]=function(_0x2e01d6,_0x392777){_0x2e01d6[_0xb6e3('0x62')][_0xb6e3('0xb7')]=_0x2e01d6[_0xb6e3('0xb8')][_0xb6e3('0xb9')];return db['User']['find']({'where':{'id':_0x2e01d6[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x392777,null))[_0xb6e3('0x21')](saveUpdates(_0x2e01d6['body'],null))[_0xb6e3('0x21')](respondWithResult(_0x392777,null))[_0xb6e3('0x2b')](handleError(_0x392777,null));};exports[_0xb6e3('0xba')]=function(_0x8c69c8,_0x3a2566){var _0x587c35=path[_0xb6e3('0xbb')](config['root'],_0xb6e3('0xbc'));return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x8c69c8['params']['id']},'attributes':['id',_0xb6e3('0xb7')],'raw':!![]})[_0xb6e3('0x21')](handleEntityNotFound(_0x3a2566,null))[_0xb6e3('0x21')](function(_0x38581a){if(_0x38581a){if(_[_0xb6e3('0x6d')](_0x38581a[_0xb6e3('0xb7')])){return _0x3a2566[_0xb6e3('0xbd')](_0x587c35);}else{if(!fs[_0xb6e3('0xbe')](path[_0xb6e3('0xbb')](config[_0xb6e3('0xbf')],'server/files/images/',_0x38581a['userpic']))){return _0x3a2566[_0xb6e3('0xbd')](_0x587c35);}return _0x3a2566[_0xb6e3('0xbd')](path['join'](config[_0xb6e3('0xbf')],_0xb6e3('0xc0'),_0x38581a[_0xb6e3('0xb7')]));}}})[_0xb6e3('0x2b')](handleError(_0x3a2566,null));};exports['getOpenTabs']=function(_0x12080b,_0x14ac19){return db['User']['find']({'where':{'id':_0x12080b[_0xb6e3('0x5d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x14ac19,null))[_0xb6e3('0x21')](function(_0x235025){var _0x2ee84b=[];values=_0x235025[_0xb6e3('0x57')];_0x2ee84b[_0xb6e3('0x50')](get_open_tabs('chat',_0x235025[_0xb6e3('0x57')]));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x56'),_0x235025[_0xb6e3('0x57')]));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5a'),_0x235025[_0xb6e3('0x57')]));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x5b'),_0x235025['dataValues']));_0x2ee84b[_0xb6e3('0x50')](get_open_tabs(_0xb6e3('0x58'),_0x235025['dataValues']));_0x2ee84b['push'](get_open_tabs(_0xb6e3('0x59'),_0x235025[_0xb6e3('0x57')]));return Promise['all'](_0x2ee84b);})[_0xb6e3('0x21')](function(_0xfff082){if(_0xfff082){var _0x2043d4=_[_0xb6e3('0x41')](values[_0xb6e3('0xc1')],function(_0xa27d7f){return{'channel':_0xb6e3('0xc2'),'id':_0xa27d7f['id'],'createdAt':_0xa27d7f[_0xb6e3('0xc3')]};});var _0x509bd3=_['map'](values[_0xb6e3('0xc4')],function(_0x32757e){return{'channel':'FAX','id':_0x32757e['id'],'createdAt':_0x32757e[_0xb6e3('0xc3')]};});var _0x2da37c=_['map'](values[_0xb6e3('0xc5')],function(_0x4a5858){return{'channel':'OPENCHANNEL','id':_0x4a5858['id'],'createdAt':_0x4a5858[_0xb6e3('0xc3')]};});var _0x1596f7=_['map'](values[_0xb6e3('0xc6')],function(_0x32e78d){return{'channel':_0xb6e3('0xc7'),'id':_0x32e78d['id'],'createdAt':_0x32e78d[_0xb6e3('0xc3')]};});var _0xeb6561=_['map'](values[_0xb6e3('0xc8')],function(_0x203247){return{'channel':_0xb6e3('0xc9'),'id':_0x203247['id'],'createdAt':_0x203247[_0xb6e3('0xc3')]};});var _0x41ce98=_[_0xb6e3('0x41')](values[_0xb6e3('0xca')],function(_0xf5dfbe){return{'channel':'WHATSAPP','id':_0xf5dfbe['id'],'createdAt':_0xf5dfbe[_0xb6e3('0xc3')]};});var _0x5930ce=_[_0xb6e3('0xcb')](_0x2043d4,_0x509bd3,_0x2da37c,_0x1596f7,_0xeb6561,_0x41ce98);var _0xc16d07={'count':_0x5930ce[_0xb6e3('0x53')],'rows':_0x5930ce};return _0xc16d07;}else return null;})['then'](respondWithResult(_0x14ac19,null))[_0xb6e3('0x2b')](handleError(_0x14ac19,null));};exports[_0xb6e3('0xcc')]=function(_0x33965a,_0xeb9b3e){var _0x145e9a={};return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x33965a[_0xb6e3('0x5d')]['id']}})['then'](function(_0x434812){if(!_0x434812){throw new APINotFoundError(util[_0xb6e3('0xab')](_0xb6e3('0xcd'),_0x33965a[_0xb6e3('0x5d')]['id']));}return contacts[_0xb6e3('0x64')]();})[_0xb6e3('0x21')](function(_0x218d4b){_0x33965a[_0xb6e3('0x4c')][_0xb6e3('0x4b')]=_0x33965a[_0xb6e3('0x5d')]['id'];_0x145e9a=qs[_0xb6e3('0x49')](_0x218d4b,_0x33965a);if(_0x33965a['query'][_0xb6e3('0xce')](_0xb6e3('0xcf'))){_0x145e9a[_0xb6e3('0x5e')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xb6e3('0xd0')],'as':_0xb6e3('0xd1'),'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0xd2')],'where':_0x33965a[_0xb6e3('0x4c')][_0xb6e3('0xd3')]?{'id':_0x33965a[_0xb6e3('0x4c')]['tag']}:undefined,'required':_0x33965a[_0xb6e3('0x4c')][_0xb6e3('0xd3')]?!![]:![]}];}return contacts[_0xb6e3('0x51')](_0x33965a[_0xb6e3('0x4c')],_0x33965a[_0xb6e3('0x34')],_0x145e9a,_0x218d4b);})[_0xb6e3('0x21')](respondWithFilteredResult(_0xeb9b3e,_0x145e9a))[_0xb6e3('0x2b')](APIHandleError(_0xeb9b3e));};exports[_0xb6e3('0xd4')]=function(_0x257706,_0x59f381){var _0x2c0b35;var _0x355b8e={};var _0x584985;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x257706[_0xb6e3('0x5d')]['id']},'attributes':['id',_0xb6e3('0x3b'),'role']})[_0xb6e3('0x21')](handleEntityNotFound(_0x59f381,null))[_0xb6e3('0x21')](function(_0x2d24de){if(!utils[_0xb6e3('0xa3')](_0x257706['query'][_0xb6e3('0xb4')])){throw new db[(_0xb6e3('0x95'))]['ValidationError'](_0xb6e3('0xd5'));}_0x2c0b35=_0x2d24de;var _0x3788b1={};_0x3788b1[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_[_0xb6e3('0xa5')](_0x257706[_0xb6e3('0x4c')][_0xb6e3('0xb4')])+_0xb6e3('0xd8')][_0xb6e3('0xd9')]);_0x3788b1['query']=_[_0xb6e3('0xd7')](_0x257706[_0xb6e3('0x4c')]);_0x3788b1[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x3788b1[_0xb6e3('0xd6')],_0x3788b1[_0xb6e3('0x4c')]);_0x355b8e[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x3788b1[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x257706['query'][_0xb6e3('0xdc')]));_0x355b8e[_0xb6e3('0x4f')]=_0x355b8e[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x355b8e[_0xb6e3('0x4f')]:_0x3788b1[_0xb6e3('0xd6')];_0x355b8e['order']=qs[_0xb6e3('0xdd')](_0x257706['query'][_0xb6e3('0xdd')]);_0x355b8e[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_['pick'](_0x257706[_0xb6e3('0x4c')],_0x3788b1[_0xb6e3('0xda')]));if(_0x257706['query'][_0xb6e3('0x38')]){_0x355b8e[_0xb6e3('0x4a')]=_['merge'](_0x355b8e[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x355b8e[_0xb6e3('0x4f')],function(_0x4290e3){var _0x2ec734={};_0x2ec734[_0x4290e3]={'$like':'%'+_0x257706['query'][_0xb6e3('0x38')]+'%'};return _0x2ec734;})});}_0x355b8e=_[_0xb6e3('0x60')]({},_0x355b8e,_0x257706[_0xb6e3('0x61')]);switch(_0x2c0b35['role']){case _0xb6e3('0x32'):return db[_[_0xb6e3('0xa5')](_0x257706['query'][_0xb6e3('0xb4')])+'Queue'][_0xb6e3('0x51')](_0x355b8e);case _0xb6e3('0x34'):case'agent':return _0x2c0b35[_0xb6e3('0x31')+_[_0xb6e3('0xa5')](_0x257706['query'][_0xb6e3('0xb4')])+_0xb6e3('0xa7')](_0x355b8e);default:throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0xde'));}})[_0xb6e3('0x21')](function(_0x372d41){_0x584985=_0x372d41['length'];if(!_0x257706[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x355b8e['limit']=qs[_0xb6e3('0x1d')](_0x257706[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x355b8e['offset']=qs[_0xb6e3('0x1c')](_0x257706[_0xb6e3('0x4c')]['offset']);}switch(_0x2c0b35['role']){case _0xb6e3('0x32'):return db[_[_0xb6e3('0xa5')](_0x257706['query']['channel'])+_0xb6e3('0xd8')][_0xb6e3('0x51')](_0x355b8e);case _0xb6e3('0x34'):case _0xb6e3('0x2e'):return _0x2c0b35[_0xb6e3('0x31')+_[_0xb6e3('0xa5')](_0x257706[_0xb6e3('0x4c')][_0xb6e3('0xb4')])+'Queues'](_0x355b8e);}})[_0xb6e3('0x21')](function(_0x2343db){return{'count':_0x584985,'rows':_0x2343db};})[_0xb6e3('0x21')](respondWithResult(_0x59f381,null))[_0xb6e3('0x2b')](handleError(_0x59f381,null));};exports[_0xb6e3('0xe0')]=function(_0x4fa3e2,_0x49a10c){var _0x403cb9={};var _0x8b7403={};var _0x48e1c2;var _0x8280df;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x4fa3e2[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x49a10c,null))['then'](function(_0xf9a538){if(_0xf9a538){_0x48e1c2=_0xf9a538;_0x8b7403['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xad')][_0xb6e3('0xd9')]);_0x8b7403[_0xb6e3('0x4c')]=_['keys'](_0x4fa3e2[_0xb6e3('0x4c')]);_0x8b7403['filters']=_[_0xb6e3('0xdb')](_0x8b7403['model'],_0x8b7403[_0xb6e3('0x4c')]);_0x403cb9[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x8b7403['model'],qs[_0xb6e3('0xdc')](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x403cb9[_0xb6e3('0x4f')]=_0x403cb9[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x403cb9[_0xb6e3('0x4f')]:_0x8b7403[_0xb6e3('0xd6')];_0x403cb9[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x403cb9['where']=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x4fa3e2[_0xb6e3('0x4c')],_0x8b7403[_0xb6e3('0xda')]));if(_0x4fa3e2['query'][_0xb6e3('0x38')]){_0x403cb9['where']=_['merge'](_0x403cb9[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x403cb9[_0xb6e3('0x4f')],function(_0x13a3ad){var _0x14adf4={};_0x14adf4[_0x13a3ad]={'$like':'%'+_0x4fa3e2['query']['filter']+'%'};return _0x14adf4;})});}_0x403cb9=_['merge']({},_0x403cb9,_0x4fa3e2[_0xb6e3('0x61')]);return _0x48e1c2[_0xb6e3('0xe0')](_0x403cb9);}})[_0xb6e3('0x21')](function(_0x204908){if(_0x204908){_0x8280df=_0x204908[_0xb6e3('0x53')];if(!_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x403cb9['limit']=qs[_0xb6e3('0x1d')](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x403cb9['offset']=qs['offset'](_0x4fa3e2[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x48e1c2[_0xb6e3('0xe0')](_0x403cb9);}})[_0xb6e3('0x21')](function(_0x449347){if(_0x449347){return _0x449347?{'count':_0x8280df,'rows':_0x449347}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x49a10c,null))[_0xb6e3('0x2b')](handleError(_0x49a10c,null));};exports[_0xb6e3('0xe3')]=function(_0x1e59d0,_0x503e20){var _0xb91afa={};var _0x4a3012={};var _0x1cf72d;var _0x505736;return db['User']['findOne']({'where':{'id':_0x1e59d0[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x503e20,null))[_0xb6e3('0x21')](function(_0x4e612a){if(_0x4e612a){_0x1cf72d=_0x4e612a;_0x4a3012[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xe4')][_0xb6e3('0xd9')]);_0x4a3012['query']=_[_0xb6e3('0xd7')](_0x1e59d0[_0xb6e3('0x4c')]);_0x4a3012[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x4a3012['model'],_0x4a3012[_0xb6e3('0x4c')]);_0xb91afa['attributes']=_[_0xb6e3('0xdb')](_0x4a3012[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x1e59d0['query'][_0xb6e3('0xdc')]));_0xb91afa[_0xb6e3('0x4f')]=_0xb91afa[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0xb91afa['attributes']:_0x4a3012[_0xb6e3('0xd6')];_0xb91afa[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0xb91afa[_0xb6e3('0x4a')]=qs['filters'](_[_0xb6e3('0xe2')](_0x1e59d0[_0xb6e3('0x4c')],_0x4a3012[_0xb6e3('0xda')]));if(_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0xb91afa[_0xb6e3('0x4a')]=_['merge'](_0xb91afa[_0xb6e3('0x4a')],{'$or':_['map'](_0xb91afa[_0xb6e3('0x4f')],function(_0x166a99){var _0x4613e2={};_0x4613e2[_0x166a99]={'$like':'%'+_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x4613e2;})});}_0xb91afa=_[_0xb6e3('0x60')]({},_0xb91afa,_0x1e59d0['options']);return _0x1cf72d[_0xb6e3('0xe3')](_0xb91afa);}})[_0xb6e3('0x21')](function(_0x1cbb18){if(_0x1cbb18){_0x505736=_0x1cbb18[_0xb6e3('0x53')];if(!_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0xce')]('nolimit')){_0xb91afa[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0xb91afa[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x1e59d0[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x1cf72d['getGroups'](_0xb91afa);}})[_0xb6e3('0x21')](function(_0x548e8b){if(_0x548e8b){return _0x548e8b?{'count':_0x505736,'rows':_0x548e8b}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x503e20,null))[_0xb6e3('0x2b')](handleError(_0x503e20,null));};exports[_0xb6e3('0xe5')]=function(_0x48ad30,_0x4fba09){var _0x2cc76a={'raw':!![],'where':{}};var _0x44173d={};var _0x29f840={'count':0x0,'rows':[]};return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x48ad30['params']['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x4fba09,null))['then'](function(_0x4bea31){if(_0x4bea31){_0x44173d[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xe6')][_0xb6e3('0xd9')]);_0x44173d[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x48ad30['query']);_0x44173d[_0xb6e3('0xda')]=_['intersection'](_0x44173d[_0xb6e3('0xd6')],_0x44173d['query']);_0x2cc76a[_0xb6e3('0x4f')]=_['intersection'](_0x44173d['model'],qs['fields'](_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x2cc76a[_0xb6e3('0x4f')]=_0x2cc76a['attributes'][_0xb6e3('0x53')]?_0x2cc76a[_0xb6e3('0x4f')]:_0x44173d[_0xb6e3('0xd6')];if(!_0x48ad30[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x2cc76a[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x2cc76a[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}_0x2cc76a[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x48ad30['query'][_0xb6e3('0xdd')]);_0x2cc76a[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x48ad30['query'],_0x44173d['filters']));_0x2cc76a[_0xb6e3('0x4a')][_0xb6e3('0xe7')]=_0x4bea31['id'];if(_0x48ad30['query'][_0xb6e3('0x38')]){_0x2cc76a['where']=_[_0xb6e3('0x60')](_0x2cc76a[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x2cc76a[_0xb6e3('0x4f')],function(_0x279874){var _0x1a7fff={};_0x1a7fff[_0x279874]={'$like':'%'+_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x1a7fff;})});}_0x2cc76a=_['merge']({},_0x2cc76a,_0x48ad30[_0xb6e3('0x61')]);return db[_0xb6e3('0xe6')][_0xb6e3('0x1b')]({'where':_0x2cc76a['where']})[_0xb6e3('0x21')](function(_0x9b9d42){_0x29f840[_0xb6e3('0x1b')]=_0x9b9d42;if(_0x48ad30[_0xb6e3('0x4c')][_0xb6e3('0xcf')]){_0x2cc76a[_0xb6e3('0x5e')]=[{'all':!![]}];}return db[_0xb6e3('0xe6')][_0xb6e3('0x51')](_0x2cc76a);})[_0xb6e3('0x21')](function(_0x535b5a){_0x29f840['rows']=_0x535b5a;return _0x29f840;});}})[_0xb6e3('0x21')](respondWithFilteredResult(_0x4fba09,_0x2cc76a))[_0xb6e3('0x2b')](handleError(_0x4fba09,null));};exports[_0xb6e3('0xe8')]=function(_0xac9374,_0xd7cff7){var _0x373e09={'raw':!![],'where':{}};var _0x2e4a0a={};var _0x474ffa={'count':0x0,'rows':[]};return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0xac9374[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0xd7cff7,null))[_0xb6e3('0x21')](function(_0x944be){if(_0x944be){_0x2e4a0a['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xe9')][_0xb6e3('0xd9')]);_0x2e4a0a[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0xac9374[_0xb6e3('0x4c')]);_0x2e4a0a['filters']=_[_0xb6e3('0xdb')](_0x2e4a0a[_0xb6e3('0xd6')],_0x2e4a0a[_0xb6e3('0x4c')]);_0x373e09['attributes']=_[_0xb6e3('0xdb')](_0x2e4a0a['model'],qs[_0xb6e3('0xdc')](_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x373e09['attributes']=_0x373e09[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x373e09['attributes']:_0x2e4a0a[_0xb6e3('0xd6')];if(!_0xac9374['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x373e09['limit']=qs[_0xb6e3('0x1d')](_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x373e09[_0xb6e3('0x1c')]=qs['offset'](_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}_0x373e09[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0xac9374[_0xb6e3('0x4c')]['sort']);_0x373e09['where']=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0xac9374['query'],_0x2e4a0a[_0xb6e3('0xda')]));_0x373e09[_0xb6e3('0x4a')]['UserId']=_0x944be['id'];if(_0xac9374[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x373e09['where']=_[_0xb6e3('0x60')](_0x373e09[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x373e09[_0xb6e3('0x4f')],function(_0x487ae3){var _0x59b02b={};_0x59b02b[_0x487ae3]={'$like':'%'+_0xac9374['query'][_0xb6e3('0x38')]+'%'};return _0x59b02b;})});}_0x373e09=_['merge']({},_0x373e09,_0xac9374['options']);return db[_0xb6e3('0xe9')][_0xb6e3('0x1b')]({'where':_0x373e09['where']})[_0xb6e3('0x21')](function(_0x58df75){_0x474ffa[_0xb6e3('0x1b')]=_0x58df75;if(_0xac9374['query'][_0xb6e3('0xcf')]){_0x373e09[_0xb6e3('0x5e')]=[{'all':!![]}];}return db[_0xb6e3('0xe9')][_0xb6e3('0x51')](_0x373e09);})[_0xb6e3('0x21')](function(_0x1148d6){_0x474ffa[_0xb6e3('0x55')]=_0x1148d6;return _0x474ffa;});}})[_0xb6e3('0x21')](respondWithFilteredResult(_0xd7cff7,_0x373e09))[_0xb6e3('0x2b')](handleError(_0xd7cff7,null));};exports[_0xb6e3('0xea')]=function(_0x3ab862,_0xe362de){var _0x345695={};var _0x1dcde8={};var _0x1eb193;var _0x8b915d;return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x3ab862[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0xe362de,null))[_0xb6e3('0x21')](function(_0x381ec5){if(_0x381ec5){_0x1eb193=_0x381ec5;_0x1dcde8[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xeb')][_0xb6e3('0xd9')]);_0x1dcde8[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x3ab862['query']);_0x1dcde8['filters']=_['intersection'](_0x1dcde8[_0xb6e3('0xd6')],_0x1dcde8[_0xb6e3('0x4c')]);_0x345695[_0xb6e3('0x4f')]=_['intersection'](_0x1dcde8[_0xb6e3('0xd6')],qs['fields'](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x345695[_0xb6e3('0x4f')]=_0x345695[_0xb6e3('0x4f')]['length']?_0x345695[_0xb6e3('0x4f')]:_0x1dcde8[_0xb6e3('0xd6')];_0x345695[_0xb6e3('0xe1')]=qs['sort'](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x345695[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x3ab862[_0xb6e3('0x4c')],_0x1dcde8['filters']));if(_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x345695[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x345695[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x345695[_0xb6e3('0x4f')],function(_0x529f2a){var _0x3852fd={};_0x3852fd[_0x529f2a]={'$like':'%'+_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x3852fd;})});}_0x345695=_[_0xb6e3('0x60')]({},_0x345695,_0x3ab862[_0xb6e3('0x61')]);return _0x1eb193['getChatInteractions'](_0x345695);}})[_0xb6e3('0x21')](function(_0x10f943){if(_0x10f943){_0x8b915d=_0x10f943['length'];if(!_0x3ab862['query']['hasOwnProperty']('nolimit')){_0x345695[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x345695[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x3ab862[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x1eb193[_0xb6e3('0xea')](_0x345695);}})['then'](function(_0x4fcb88){if(_0x4fcb88){return _0x4fcb88?{'count':_0x8b915d,'rows':_0x4fcb88}:null;}})[_0xb6e3('0x21')](respondWithResult(_0xe362de,null))[_0xb6e3('0x2b')](handleError(_0xe362de,null));};exports['getOpenchannelInteractions']=function(_0x426598,_0x59342d){var _0x3861ad={};var _0x547091={};var _0x49fe73;var _0x1fdc31;return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x426598['params']['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x59342d,null))[_0xb6e3('0x21')](function(_0x41d70d){if(_0x41d70d){_0x49fe73=_0x41d70d;_0x547091[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db['OpenchannelInteraction'][_0xb6e3('0xd9')]);_0x547091[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x426598[_0xb6e3('0x4c')]);_0x547091[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x547091[_0xb6e3('0xd6')],_0x547091[_0xb6e3('0x4c')]);_0x3861ad[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x547091[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x426598[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x3861ad[_0xb6e3('0x4f')]=_0x3861ad[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x3861ad[_0xb6e3('0x4f')]:_0x547091[_0xb6e3('0xd6')];_0x3861ad[_0xb6e3('0xe1')]=qs['sort'](_0x426598[_0xb6e3('0x4c')]['sort']);_0x3861ad[_0xb6e3('0x4a')]=qs['filters'](_[_0xb6e3('0xe2')](_0x426598[_0xb6e3('0x4c')],_0x547091[_0xb6e3('0xda')]));if(_0x426598[_0xb6e3('0x4c')]['filter']){_0x3861ad[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x3861ad[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x3861ad['attributes'],function(_0xb8e14d){var _0x7295a4={};_0x7295a4[_0xb8e14d]={'$like':'%'+_0x426598['query'][_0xb6e3('0x38')]+'%'};return _0x7295a4;})});}_0x3861ad=_[_0xb6e3('0x60')]({},_0x3861ad,_0x426598['options']);return _0x49fe73[_0xb6e3('0xec')](_0x3861ad);}})['then'](function(_0x188ee7){if(_0x188ee7){_0x1fdc31=_0x188ee7[_0xb6e3('0x53')];if(!_0x426598[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x3861ad[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x426598[_0xb6e3('0x4c')]['limit']);_0x3861ad['offset']=qs[_0xb6e3('0x1c')](_0x426598[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x49fe73['getOpenchannelInteractions'](_0x3861ad);}})[_0xb6e3('0x21')](function(_0x414e77){if(_0x414e77){return _0x414e77?{'count':_0x1fdc31,'rows':_0x414e77}:null;}})['then'](respondWithResult(_0x59342d,null))[_0xb6e3('0x2b')](handleError(_0x59342d,null));};exports[_0xb6e3('0xed')]=function(_0x294fa9,_0x596525){var _0x596a72={'raw':!![],'where':{}};var _0x166874={};var _0x4125de={'count':0x0,'rows':[]};return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x294fa9[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x596525,null))[_0xb6e3('0x21')](function(_0x48bb51){if(_0x48bb51){_0x166874['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xee')][_0xb6e3('0xd9')]);_0x166874[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x294fa9[_0xb6e3('0x4c')]);_0x166874[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x166874['model'],_0x166874[_0xb6e3('0x4c')]);_0x596a72['attributes']=_[_0xb6e3('0xdb')](_0x166874['model'],qs[_0xb6e3('0xdc')](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x596a72[_0xb6e3('0x4f')]=_0x596a72[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x596a72[_0xb6e3('0x4f')]:_0x166874['model'];if(!_0x294fa9['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x596a72['limit']=qs[_0xb6e3('0x1d')](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x596a72[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}_0x596a72['order']=qs['sort'](_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x596a72['where']=qs[_0xb6e3('0xda')](_['pick'](_0x294fa9[_0xb6e3('0x4c')],_0x166874[_0xb6e3('0xda')]));_0x596a72[_0xb6e3('0x4a')]['UserId']=_0x48bb51['id'];if(_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x596a72[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x596a72[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x596a72[_0xb6e3('0x4f')],function(_0x33feed){var _0x5de32f={};_0x5de32f[_0x33feed]={'$like':'%'+_0x294fa9[_0xb6e3('0x4c')]['filter']+'%'};return _0x5de32f;})});}_0x596a72=_[_0xb6e3('0x60')]({},_0x596a72,_0x294fa9['options']);return db['MailInteraction'][_0xb6e3('0x1b')]({'where':_0x596a72[_0xb6e3('0x4a')]})['then'](function(_0x329c04){_0x4125de[_0xb6e3('0x1b')]=_0x329c04;if(_0x294fa9[_0xb6e3('0x4c')][_0xb6e3('0xcf')]){_0x596a72[_0xb6e3('0x5e')]=[{'all':!![]}];}return db[_0xb6e3('0xee')][_0xb6e3('0x51')](_0x596a72);})[_0xb6e3('0x21')](function(_0x343166){_0x4125de[_0xb6e3('0x55')]=_0x343166;return _0x4125de;});}})['then'](respondWithFilteredResult(_0x596525,_0x596a72))['catch'](handleError(_0x596525,null));};exports['getSmsInteractions']=function(_0xe64646,_0x451299){var _0x4b4d07={};var _0x303012={};var _0x2ec483;var _0x2146a6;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0xe64646['params']['id']}})['then'](handleEntityNotFound(_0x451299,null))[_0xb6e3('0x21')](function(_0x2c02a2){if(_0x2c02a2){_0x2ec483=_0x2c02a2;_0x303012[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xef')]['rawAttributes']);_0x303012['query']=_[_0xb6e3('0xd7')](_0xe64646['query']);_0x303012[_0xb6e3('0xda')]=_['intersection'](_0x303012[_0xb6e3('0xd6')],_0x303012['query']);_0x4b4d07[_0xb6e3('0x4f')]=_['intersection'](_0x303012['model'],qs[_0xb6e3('0xdc')](_0xe64646[_0xb6e3('0x4c')]['fields']));_0x4b4d07[_0xb6e3('0x4f')]=_0x4b4d07[_0xb6e3('0x4f')]['length']?_0x4b4d07['attributes']:_0x303012[_0xb6e3('0xd6')];_0x4b4d07['order']=qs[_0xb6e3('0xdd')](_0xe64646[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x4b4d07[_0xb6e3('0x4a')]=qs['filters'](_[_0xb6e3('0xe2')](_0xe64646[_0xb6e3('0x4c')],_0x303012['filters']));if(_0xe64646['query'][_0xb6e3('0x38')]){_0x4b4d07[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x4b4d07['where'],{'$or':_[_0xb6e3('0x41')](_0x4b4d07[_0xb6e3('0x4f')],function(_0x3125c3){var _0x36bb6a={};_0x36bb6a[_0x3125c3]={'$like':'%'+_0xe64646['query'][_0xb6e3('0x38')]+'%'};return _0x36bb6a;})});}_0x4b4d07=_[_0xb6e3('0x60')]({},_0x4b4d07,_0xe64646['options']);return _0x2ec483[_0xb6e3('0xf0')](_0x4b4d07);}})[_0xb6e3('0x21')](function(_0x56d474){if(_0x56d474){_0x2146a6=_0x56d474['length'];if(!_0xe64646[_0xb6e3('0x4c')][_0xb6e3('0xce')]('nolimit')){_0x4b4d07['limit']=qs[_0xb6e3('0x1d')](_0xe64646[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x4b4d07['offset']=qs[_0xb6e3('0x1c')](_0xe64646['query']['offset']);}return _0x2ec483['getSmsInteractions'](_0x4b4d07);}})[_0xb6e3('0x21')](function(_0x98d46e){if(_0x98d46e){return _0x98d46e?{'count':_0x2146a6,'rows':_0x98d46e}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x451299,null))[_0xb6e3('0x2b')](handleError(_0x451299,null));};exports[_0xb6e3('0xf1')]=function(_0x2cb34e,_0x5f1b18){var _0x2cb03b={};var _0x4058d8={};var _0x49d4a4;var _0x2f3fcf;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x2cb34e[_0xb6e3('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5f1b18,null))[_0xb6e3('0x21')](function(_0x4cfd40){if(_0x4cfd40){_0x49d4a4=_0x4cfd40;_0x4058d8[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0xf2')][_0xb6e3('0xd9')]);_0x4058d8['query']=_[_0xb6e3('0xd7')](_0x2cb34e[_0xb6e3('0x4c')]);_0x4058d8['filters']=_[_0xb6e3('0xdb')](_0x4058d8[_0xb6e3('0xd6')],_0x4058d8['query']);_0x2cb03b[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x4058d8[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x2cb03b[_0xb6e3('0x4f')]=_0x2cb03b['attributes'][_0xb6e3('0x53')]?_0x2cb03b[_0xb6e3('0x4f')]:_0x4058d8[_0xb6e3('0xd6')];_0x2cb03b[_0xb6e3('0xe1')]=qs['sort'](_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x2cb03b[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x2cb34e[_0xb6e3('0x4c')],_0x4058d8[_0xb6e3('0xda')]));if(_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x2cb03b[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x2cb03b[_0xb6e3('0x4a')],{'$or':_['map'](_0x2cb03b[_0xb6e3('0x4f')],function(_0x867e8f){var _0x177f4c={};_0x177f4c[_0x867e8f]={'$like':'%'+_0x2cb34e['query'][_0xb6e3('0x38')]+'%'};return _0x177f4c;})});}_0x2cb03b=_[_0xb6e3('0x60')]({},_0x2cb03b,_0x2cb34e[_0xb6e3('0x61')]);return _0x49d4a4[_0xb6e3('0xf1')](_0x2cb03b);}})[_0xb6e3('0x21')](function(_0x5877fa){if(_0x5877fa){_0x2f3fcf=_0x5877fa['length'];if(!_0x2cb34e['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x2cb03b[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x2cb34e[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x2cb03b[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x2cb34e[_0xb6e3('0x4c')]['offset']);}return _0x49d4a4[_0xb6e3('0xf1')](_0x2cb03b);}})[_0xb6e3('0x21')](function(_0x55f4b0){if(_0x55f4b0){return _0x55f4b0?{'count':_0x2f3fcf,'rows':_0x55f4b0}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x5f1b18,null))[_0xb6e3('0x2b')](handleError(_0x5f1b18,null));};exports[_0xb6e3('0xf3')]=function(_0x5cd95b,_0x31a696){var _0x283fb6={};var _0x2cc6d3={};var _0xb3b397;var _0x350e30;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x5cd95b[_0xb6e3('0x5d')]['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x31a696,null))[_0xb6e3('0x21')](function(_0x41f570){if(_0x41f570){_0xb3b397=_0x41f570;_0x2cc6d3['model']=_[_0xb6e3('0xd7')](db[_0xb6e3('0xf4')]['rawAttributes']);_0x2cc6d3[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x5cd95b['query']);_0x2cc6d3[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x2cc6d3[_0xb6e3('0xd6')],_0x2cc6d3[_0xb6e3('0x4c')]);_0x283fb6[_0xb6e3('0x4f')]=_['intersection'](_0x2cc6d3['model'],qs['fields'](_0x5cd95b[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x283fb6[_0xb6e3('0x4f')]=_0x283fb6[_0xb6e3('0x4f')]['length']?_0x283fb6[_0xb6e3('0x4f')]:_0x2cc6d3['model'];_0x283fb6[_0xb6e3('0xe1')]=qs['sort'](_0x5cd95b[_0xb6e3('0x4c')]['sort']);_0x283fb6['where']=qs[_0xb6e3('0xda')](_['pick'](_0x5cd95b[_0xb6e3('0x4c')],_0x2cc6d3[_0xb6e3('0xda')]));if(_0x5cd95b[_0xb6e3('0x4c')]['filter']){_0x283fb6['where']=_[_0xb6e3('0x60')](_0x283fb6[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x283fb6[_0xb6e3('0x4f')],function(_0x4be9e4){var _0x532a2a={};_0x532a2a[_0x4be9e4]={'$like':'%'+_0x5cd95b[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x532a2a;})});}_0x283fb6=_[_0xb6e3('0x60')]({},_0x283fb6,_0x5cd95b[_0xb6e3('0x61')]);return _0xb3b397[_0xb6e3('0xf3')](_0x283fb6);}})[_0xb6e3('0x21')](function(_0x3199df){if(_0x3199df){_0x350e30=_0x3199df['length'];if(!_0x5cd95b['query'][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x283fb6[_0xb6e3('0x1d')]=qs['limit'](_0x5cd95b[_0xb6e3('0x4c')]['limit']);_0x283fb6[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x5cd95b['query'][_0xb6e3('0x1c')]);}return _0xb3b397[_0xb6e3('0xf3')](_0x283fb6);}})[_0xb6e3('0x21')](function(_0x5c4c8c){if(_0x5c4c8c){return _0x5c4c8c?{'count':_0x350e30,'rows':_0x5c4c8c}:null;}})[_0xb6e3('0x21')](respondWithResult(_0x31a696,null))[_0xb6e3('0x2b')](handleError(_0x31a696,null));};exports[_0xb6e3('0xf5')]=function(_0x1c1203,_0x5d0df7,_0x1308f8){var _0x7cc858;var _0x4929fd;var _0x427e8a;var _0x34434f=!_[_0xb6e3('0x6d')](_0x1c1203['params']['id'])?_0x1c1203[_0xb6e3('0x5d')]['id']:!_['isNil'](_0x1c1203[_0xb6e3('0x34')]['id'])?_0x1c1203[_0xb6e3('0x34')]['id']:null;return db['User'][_0xb6e3('0x63')]({'where':{'id':_0x34434f,'role':{'$or':['admin','user',_0xb6e3('0x2e')]}},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0xf6'),'mobile',_0xb6e3('0x2d'),_0xb6e3('0x67'),_0xb6e3('0xf7')]})['then'](function(_0x5db2e7){if(_0x5db2e7){if(_0x5db2e7[_0xb6e3('0x2d')]===_0xb6e3('0x2e')){_0x7cc858=_0x5db2e7;if(_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xa2')]){_0x427e8a=util[_0xb6e3('0xab')](_0xb6e3('0xf8'),_0x7cc858[_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xa2')]]);}else if(_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xf9')]){_0x427e8a=util[_0xb6e3('0xab')](_0xb6e3('0xac'),_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0xf9')]);}else{_0x427e8a=util[_0xb6e3('0xab')](_0xb6e3('0xac'),_0x7cc858[_0xb6e3('0x3b')]);}socket['to'](util[_0xb6e3('0xab')]('user:%s',_0x7cc858[_0xb6e3('0x3b')]))[_0xb6e3('0x2f')]('user:forcelogout',{'user':{'id':_0x7cc858['id'],'name':_0x7cc858[_0xb6e3('0x3b')]},'ip':_0x1c1203['headers'][_0xb6e3('0xfa')]||_0x1c1203['connection'][_0xb6e3('0xfb')]||_0x1c1203[_0xb6e3('0xfc')][_0xb6e3('0xfb')]||_0x1c1203['connection'][_0xb6e3('0xfc')][_0xb6e3('0xfb')]});return db[_0xb6e3('0xad')][_0xb6e3('0xb5')]({'where':{'membername':_0x7cc858['name']},'individualHooks':!![]});}}else{throw new db[(_0xb6e3('0x95'))][(_0xb6e3('0x96'))](_0xb6e3('0xfd'));}})[_0xb6e3('0x21')](function(){if(_0x7cc858){return _0x7cc858[_0xb6e3('0xfe')]({'raw':!![]});}})['then'](function(_0xc080a5){if(_0x7cc858){if(_0xc080a5){_0x4929fd=_0xc080a5;if(_0x4929fd['length']){var _0x176e3c=_0x4929fd['map'](function(_0x5a4770){var _0xe755c={'membername':_0x7cc858[_0xb6e3('0x3b')],'UserId':_0x7cc858['id'],'queue_name':_0x5a4770[_0xb6e3('0x3b')],'VoiceQueueId':_0x5a4770['id'],'interface':_0x427e8a,'paused':_0x7cc858[_0xb6e3('0xf7')]||![],'penalty':_0x5a4770[_0xb6e3('0xff')]||0x0};return db['UserVoiceQueueRt'][_0xb6e3('0xae')](_0xe755c);});return Promise[_0xb6e3('0x5c')](_0x176e3c);}}}})[_0xb6e3('0x21')](function(){if(_0x7cc858){return db['MemberReport'][_0xb6e3('0x51')]({'where':{'membername':_0x7cc858[_0xb6e3('0x3b')],'exitAt':null}});}})[_0xb6e3('0x21')](function(_0x4964ba){if(_0x7cc858){var _0xbbf93=[];_0x4964ba[_0xb6e3('0x100')](function(_0x26dc41){_0xbbf93[_0xb6e3('0x50')](_0x26dc41[_0xb6e3('0x2c')]({'exitAt':moment()[_0xb6e3('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0xbbf93);}})['then'](function(){if(_0x7cc858){var _0x3e814e=[];var _0x78389=[];var _0x45ab0a=utils[_0xb6e3('0x101')]();var _0x5f32e5={'membername':_0x7cc858[_0xb6e3('0x3b')],'interface':_0x427e8a,'enterAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102')),'role':_0x7cc858['role'],'internal':_0x7cc858[_0xb6e3('0x67')]};_0x45ab0a[_0xb6e3('0x100')](function(_0x5605fe){_0x3e814e[_0xb6e3('0x50')](_[_0xb6e3('0x60')]({'channel':_0x5605fe,'type':_0xb6e3('0x103'),'data1':_0x1c1203[_0xb6e3('0x62')][_0xb6e3('0x104')],'data2':_0x427e8a},_0x5f32e5));if(_0x7cc858[_0xb6e3('0xf7')]){_0x78389[_0xb6e3('0x50')](_[_0xb6e3('0x60')]({'channel':_0x5605fe,'type':'PAUSE','data1':'LOGININPAUSE'},_0x5f32e5));}});return db['MemberReport'][_0xb6e3('0x8d')](_0x3e814e[_0xb6e3('0xcb')](_0x78389),{'individualHooks':!![]});}})[_0xb6e3('0x21')](function(){if(_0x7cc858){return _0x7cc858[_0xb6e3('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0xb6e3('0x102')),'voicePause':_0x7cc858[_0xb6e3('0xf7')]||![],'mailPause':_0x7cc858[_0xb6e3('0xf7')]||![],'chatPause':_0x7cc858[_0xb6e3('0xf7')]||![],'faxPause':_0x7cc858[_0xb6e3('0xf7')]||![],'smsPause':_0x7cc858['loginInPause']||![],'openchannelPause':_0x7cc858[_0xb6e3('0xf7')]||![],'whatsappPause':_0x7cc858[_0xb6e3('0xf7')]||![],'pauseType':_0x7cc858[_0xb6e3('0xf7')]?_0xb6e3('0x105'):null,'interface':_0x427e8a,'lastPauseAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102'))});}})['then'](function(_0x37a673){if(_0x1c1203[_0xb6e3('0x106')]){return _0x1308f8();}else{return Promise['resolve'](_0x37a673)[_0xb6e3('0x21')](respondWithResult(_0x5d0df7,null));}})[_0xb6e3('0x2b')](handleError(_0x5d0df7,null));};exports[_0xb6e3('0x107')]=function(_0x4bb56e,_0x40e1ec){var _0x53e20e;return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4bb56e[_0xb6e3('0x5d')]['id'],'role':_0xb6e3('0x2e')},'attributes':['id',_0xb6e3('0x3b'),'role']})[_0xb6e3('0x21')](handleEntityNotFound(_0x40e1ec,null))['then'](function(_0x2505b7){if(_0x2505b7){_0x53e20e=_0x2505b7;return db[_0xb6e3('0xad')]['destroy']({'where':{'membername':_0x53e20e[_0xb6e3('0x3b')]},'individualHooks':!![]});}})['then'](function(){return db[_0xb6e3('0x108')][_0xb6e3('0x51')]({'where':{'membername':_0x53e20e[_0xb6e3('0x3b')],'exitAt':null}});})[_0xb6e3('0x21')](function(_0x191ecb){var _0x97e0e0=[];_0x191ecb['forEach'](function(_0x42b83e){_0x97e0e0[_0xb6e3('0x50')](_0x42b83e[_0xb6e3('0x2c')]({'exitAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102'))}));});return Promise[_0xb6e3('0x5c')](_0x97e0e0);})[_0xb6e3('0x21')](function(){return _0x53e20e[_0xb6e3('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xb6e3('0x21')](respondWithResult(_0x40e1ec,null))['catch'](handleError(_0x40e1ec,null));};exports[_0xb6e3('0x109')]=function(_0x3f23c7,_0x8ce243){var _0x25d7b3;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x3f23c7[_0xb6e3('0x5d')]['id']},'individualHooks':!![]})[_0xb6e3('0x21')](function(){return db['User'][_0xb6e3('0x63')]({'where':{'id':_0x3f23c7[_0xb6e3('0x5d')]['id'],'role':_0xb6e3('0x2e')},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d'),'internal',_0xb6e3('0xa2'),_0xb6e3('0xa0')]});})[_0xb6e3('0x21')](handleEntityNotFound(_0x8ce243,null))[_0xb6e3('0x21')](function(_0x4a988f){if(_0x4a988f){_0x25d7b3=_0x4a988f;return respondWithRpcPromise(_0xb6e3('0x10a'),_0xb6e3('0x109'),{'id':_0x25d7b3['id'],'name':_0x25d7b3[_0xb6e3('0x3b')],'pause':!![]});}})[_0xb6e3('0x21')](function(){if(_0x25d7b3){return db[_0xb6e3('0x108')]['findAll']({'where':{'membername':_0x25d7b3[_0xb6e3('0x3b')],'type':_0xb6e3('0x10b'),'exitAt':null}});}})[_0xb6e3('0x21')](function(_0x56ae78){if(_0x56ae78[_0xb6e3('0x53')]){var _0x2b2e50=moment()['format'](_0xb6e3('0x102'));for(var _0x29cc90=0x0,_0x5702d1=_0x56ae78[_0xb6e3('0x53')];_0x29cc90<_0x5702d1;_0x29cc90++){_0x56ae78[_0x29cc90][_0xb6e3('0x10c')]({'exitAt':_0x2b2e50});}}})[_0xb6e3('0x21')](function(){var _0x486ee1=[];var _0x392908=utils[_0xb6e3('0x101')]();_0x392908[_0xb6e3('0x100')](function(_0x1df768){_0x486ee1[_0xb6e3('0x50')]({'channel':_0x1df768,'membername':_0x25d7b3['name'],'interface':_['isNil'](_0x25d7b3[_0xb6e3('0xa2')])?util['format']('SIP/%s',_0x25d7b3[_0xb6e3('0x3b')]):_0x25d7b3[_0xb6e3('0xa2')],'type':_0xb6e3('0x10b'),'enterAt':moment()[_0xb6e3('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3f23c7[_0xb6e3('0x62')][_0xb6e3('0x42')]||'DEFAULT\x20PAUSE','role':_0x25d7b3[_0xb6e3('0x2d')],'internal':_0x25d7b3[_0xb6e3('0x67')]});});return db[_0xb6e3('0x108')][_0xb6e3('0x8d')](_0x486ee1,{'individualHooks':!![]});})[_0xb6e3('0x21')](function(){return _0x25d7b3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3f23c7[_0xb6e3('0x62')][_0xb6e3('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb6e3('0xab')](_0xb6e3('0x102'))});})[_0xb6e3('0x21')](respondWithResult(_0x8ce243,null))[_0xb6e3('0x2b')](handleError(_0x8ce243,null));};exports['unpause']=function(_0x4bb749,_0x5a3147){if(_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')]&&!utils[_0xb6e3('0xa3')](_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')])){throw new APIBadRequestError(util[_0xb6e3('0xab')](_0xb6e3('0x10d'),_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')]));}return db[_0xb6e3('0x4b')][_0xb6e3('0x63')]({'where':{'id':_0x4bb749[_0xb6e3('0x5d')]['id']},'attributes':['id',_0xb6e3('0x3b'),_0xb6e3('0x2d'),'internal',_0xb6e3('0xa2'),_0xb6e3('0xa0'),_0xb6e3('0xa1'),_0xb6e3('0x10e'),_0xb6e3('0x10f'),_0xb6e3('0x110'),_0xb6e3('0x111'),'smsPause',_0xb6e3('0x112'),_0xb6e3('0x113'),_0xb6e3('0x114')]})[_0xb6e3('0x21')](function(_0x433f5d){if(!_0x433f5d){throw new APINotFoundError(util['format'](_0xb6e3('0xcd'),_0x4bb749[_0xb6e3('0x5d')]['id']));}return _0x433f5d['unpause'](_0x4bb749[_0xb6e3('0x62')][_0xb6e3('0xb4')]);})['then'](respondWithResult(_0x5a3147,null))['catch'](APIHandleError(_0x5a3147));};exports[_0xb6e3('0x115')]=function(_0x231f5a,_0x2b3d5d){var _0x152be7={};var _0x5f5096={};var _0x1d38d6;var _0x2f2f6d;return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x231f5a[_0xb6e3('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2b3d5d,null))['then'](function(_0x152cb8){if(_0x152cb8){_0x1d38d6=_0x152cb8;_0x5f5096[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0x116')][_0xb6e3('0xd9')]);_0x5f5096[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x231f5a[_0xb6e3('0x4c')]);_0x5f5096[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x5f5096[_0xb6e3('0xd6')],_0x5f5096[_0xb6e3('0x4c')]);_0x152be7[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x5f5096[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x231f5a['query'][_0xb6e3('0xdc')]));_0x152be7[_0xb6e3('0x4f')]=_0x152be7[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x152be7[_0xb6e3('0x4f')]:_0x5f5096[_0xb6e3('0xd6')];_0x152be7[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x152be7[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x231f5a[_0xb6e3('0x4c')],_0x5f5096['filters']));if(_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x152be7['where']=_['merge'](_0x152be7[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x152be7['attributes'],function(_0x321b26){var _0x5c7137={};_0x5c7137[_0x321b26]={'$like':'%'+_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x5c7137;})});}_0x152be7=_[_0xb6e3('0x60')]({},_0x152be7,_0x231f5a['options']);return _0x1d38d6[_0xb6e3('0x115')](_0x152be7);}})[_0xb6e3('0x21')](function(_0x497a91){if(_0x497a91){_0x2f2f6d=_0x497a91[_0xb6e3('0x53')];if(!_0x231f5a[_0xb6e3('0x4c')]['hasOwnProperty'](_0xb6e3('0xdf'))){_0x152be7['limit']=qs['limit'](_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x1d')]);_0x152be7['offset']=qs['offset'](_0x231f5a[_0xb6e3('0x4c')][_0xb6e3('0x1c')]);}return _0x1d38d6['getTeams'](_0x152be7);}})[_0xb6e3('0x21')](function(_0xca8d47){if(_0xca8d47){return _0xca8d47?{'count':_0x2f2f6d,'rows':_0xca8d47}:null;}})['then'](respondWithResult(_0x2b3d5d,null))[_0xb6e3('0x2b')](handleError(_0x2b3d5d,null));};exports[_0xb6e3('0x117')]=function(_0x19871e,_0x3a3e26){var _0x169efa=_0x19871e[_0xb6e3('0x5d')]['id'];var _0xbc74e7=_0x19871e[_0xb6e3('0x62')]?_0x19871e[_0xb6e3('0x62')][_0xb6e3('0x66')]:null;var _0x779c1d=[];return Promise[_0xb6e3('0x118')]()['then'](function(){if(!_0xbc74e7)throw new APIBadRequestError(_0xb6e3('0x119'));})[_0xb6e3('0x21')](function(){return db[_0xb6e3('0x4b')]['findOne']({'where':{'id':_0x169efa}});})[_0xb6e3('0x21')](function(_0x47e1d0){if(!_0x47e1d0)throw new APINotFoundError(util[_0xb6e3('0xab')]('User\x20with\x20id\x20%s\x20not\x20found',_0x19871e[_0xb6e3('0x5d')]['id']));return db['sequelize'][_0xb6e3('0x11a')](function(_0x1b2597){return _0x47e1d0[_0xb6e3('0x117')](_0xbc74e7,{'transaction':_0x1b2597})[_0xb6e3('0x21')](function(){return db[_0xb6e3('0x116')][_0xb6e3('0x51')]({'where':{'id':{'$in':_0xbc74e7}}});})['then'](function(_0x7af116){var _0x4f72b9=_['map'](_0x7af116,function(_0x5b6ccd){return _0x5b6ccd[_0xb6e3('0x11b')]();});return Promise['all'](_0x4f72b9);})[_0xb6e3('0x21')](function(_0x3eb00a){_0x779c1d=_['flattenDeep'](_0x3eb00a);var _0x5ad1ba=_['map'](_0x779c1d,function(_0x90b903){return _0x90b903['addAgent'](_0x47e1d0['id'],{'transaction':_0x1b2597});});return Promise['all'](_0x5ad1ba);})[_0xb6e3('0x21')](function(){if(!_0x47e1d0['online'])return;var _0x448cb2=_[_0xb6e3('0x38')](_0x779c1d,function(_0x14f802){return _0x14f802[_0xb6e3('0x11c')](_0xb6e3('0xb4'))===_0xb6e3('0x11d');});var _0x3e5743=_[_0xb6e3('0x41')](_0x448cb2,function(_0x5d4b1d){return db[_0xb6e3('0xad')][_0xb6e3('0xae')]({'membername':_0x47e1d0[_0xb6e3('0x3b')],'UserId':_0x47e1d0['id'],'queue_name':_0x5d4b1d['name'],'VoiceQueueId':_0x5d4b1d['id'],'interface':_[_0xb6e3('0x6d')](_0x47e1d0['interface'])?util[_0xb6e3('0xab')]('SIP/%s',_0x47e1d0['name']):_0x47e1d0[_0xb6e3('0xa2')],'paused':_0x47e1d0['voicePause']||![],'penalty':_0x47e1d0['penalty']},{'transaction':_0x1b2597});});return Promise[_0xb6e3('0x5c')](_0x3e5743);})['then'](function(){return db[_0xb6e3('0x11e')][_0xb6e3('0x51')]({'where':{'teamId':{'$in':_0xbc74e7}}});})[_0xb6e3('0x21')](function(_0x271e50){var _0x52b04d=_[_0xb6e3('0x41')](_0x271e50,function(_0x500f96){return db[_0xb6e3('0x11f')][_0xb6e3('0x84')]({'UserId':_0x47e1d0['id'],'VoicePrefixId':_0x500f96[_0xb6e3('0x120')]},{'transaction':_0x1b2597});});return Promise[_0xb6e3('0x5c')](_0x52b04d);});});})[_0xb6e3('0x21')](function(){for(var _0x31de00=0x0;_0x31de00<_0x779c1d[_0xb6e3('0x53')];_0x31de00++){var _0x2c56a9=_0x779c1d[_0x31de00][_0xb6e3('0x11c')]('channel');var _0x28f359=_0x2c56a9+_0xb6e3('0xb2');socket[_0xb6e3('0x2f')](_0xb6e3('0x34')+_0x2c56a9+_0xb6e3('0x121'),{'UserId':_0x169efa,['queueField']:_0x779c1d[_0x31de00]['id']});}})[_0xb6e3('0x21')](respondWithStatusCode(_0x3a3e26,null))['catch'](APIHandleError(_0x3a3e26));};exports[_0xb6e3('0x122')]=function(_0x59f584,_0x5aef87){var _0x214777=_0x59f584[_0xb6e3('0x5d')]['id'];var _0x24c983=null;if(_0x59f584[_0xb6e3('0x4c')][_0xb6e3('0x66')]){_0x24c983=_['isArray'](_0x59f584['query'][_0xb6e3('0x66')])?_0x59f584[_0xb6e3('0x4c')]['ids']:[_0x59f584['query'][_0xb6e3('0x66')]];}var _0x39952b=[];return Promise['resolve']()[_0xb6e3('0x21')](function(){if(!_0x24c983)throw new APIBadRequestError(_0xb6e3('0x123'));})[_0xb6e3('0x21')](function(){return db['User'][_0xb6e3('0x9b')]({'where':{'id':_0x214777}});})['then'](function(_0x4b1419){if(!_0x4b1419)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x59f584[_0xb6e3('0x5d')]['id']));return db[_0xb6e3('0x6e')]['transaction'](function(_0x549ae8){return _0x4b1419['removeTeams'](_0x24c983,{'transaction':_0x549ae8})[_0xb6e3('0x21')](function(){return db[_0xb6e3('0x116')][_0xb6e3('0x51')]({'where':{'id':{'$in':_0x24c983}}});})[_0xb6e3('0x21')](function(_0xb24317){var _0xe3d63a=_[_0xb6e3('0x41')](_0xb24317,function(_0x1af289){return _0x1af289[_0xb6e3('0x11b')]();});return Promise[_0xb6e3('0x5c')](_0xe3d63a);})[_0xb6e3('0x21')](function(_0x34c18d){_0x39952b=_[_0xb6e3('0x124')](_0x34c18d);var _0x35ac04=_[_0xb6e3('0x41')](_0x39952b,function(_0x537f71){return _0x537f71[_0xb6e3('0x125')](_0x4b1419['id'],{'transaction':_0x549ae8});});return Promise['all'](_0x35ac04);})[_0xb6e3('0x21')](function(){if(!_0x4b1419['online'])return;var _0x44f52a=_[_0xb6e3('0x38')](_0x39952b,function(_0x25acae){return _0x25acae[_0xb6e3('0x11c')]('channel')==='Voice';});var _0x2d9143=_['map'](_0x44f52a,function(_0x30bb7a){return db[_0xb6e3('0xad')][_0xb6e3('0xb5')]({'where':{'VoiceQueueId':_0x30bb7a['id'],'UserId':_0x4b1419['id']},'transaction':_0x549ae8});});return Promise['all'](_0x2d9143);})['then'](function(){return db[_0xb6e3('0x11e')][_0xb6e3('0x51')]({'where':{'teamId':{'$in':_0x24c983}}});})['then'](function(_0x4f4201){var _0x1b7d5c=_[_0xb6e3('0x41')](_0x4f4201,function(_0xfbcfe8){return db[_0xb6e3('0x11f')]['destroy']({'where':{'UserId':_0x4b1419['id'],'VoicePrefixId':_0xfbcfe8[_0xb6e3('0x120')]}},{'transaction':_0x549ae8});});return Promise[_0xb6e3('0x5c')](_0x1b7d5c);});});})[_0xb6e3('0x21')](function(){for(var _0x2031e5=0x0;_0x2031e5<_0x39952b['length'];_0x2031e5++){var _0x500571=_0x39952b[_0x2031e5][_0xb6e3('0x11c')](_0xb6e3('0xb4'));var _0x30034a=_0x500571+_0xb6e3('0xb2');socket['emit'](_0xb6e3('0x34')+_0x500571+_0xb6e3('0xb3'),{'UserId':_0x214777,['queueField']:_0x39952b[_0x2031e5]['id']});}})[_0xb6e3('0x21')](respondWithStatusCode(_0x5aef87,null))[_0xb6e3('0x2b')](APIHandleError(_0x5aef87));};exports[_0xb6e3('0x126')]=function(_0x2c925d,_0x4b72be){var _0x4bb5bd={};var _0x44d5ff={};var _0x1bfab9;var _0x1ee5fc;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x2c925d['params']['id']}})[_0xb6e3('0x21')](handleEntityNotFound(_0x4b72be,null))['then'](function(_0x5bdadd){if(_0x5bdadd){_0x1bfab9=_0x5bdadd;_0x44d5ff[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db[_0xb6e3('0x127')][_0xb6e3('0xd9')]);_0x44d5ff[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x2c925d[_0xb6e3('0x4c')]);_0x44d5ff[_0xb6e3('0xda')]=_[_0xb6e3('0xdb')](_0x44d5ff[_0xb6e3('0xd6')],_0x44d5ff['query']);_0x4bb5bd[_0xb6e3('0x4f')]=_[_0xb6e3('0xdb')](_0x44d5ff[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0xdc')]));_0x4bb5bd[_0xb6e3('0x4f')]=_0x4bb5bd[_0xb6e3('0x4f')][_0xb6e3('0x53')]?_0x4bb5bd[_0xb6e3('0x4f')]:_0x44d5ff[_0xb6e3('0xd6')];_0x4bb5bd[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0xdd')]);_0x4bb5bd[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x2c925d['query'],_0x44d5ff[_0xb6e3('0xda')]));if(_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0x38')]){_0x4bb5bd[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x4bb5bd[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x4bb5bd['attributes'],function(_0x5afbe3){var _0x43a46c={};_0x43a46c[_0x5afbe3]={'$like':'%'+_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0x38')]+'%'};return _0x43a46c;})});}_0x4bb5bd=_[_0xb6e3('0x60')]({},_0x4bb5bd,_0x2c925d[_0xb6e3('0x61')]);return _0x1bfab9[_0xb6e3('0x126')](_0x4bb5bd);}})[_0xb6e3('0x21')](function(_0x4a1c86){if(_0x4a1c86){_0x1ee5fc=_0x4a1c86[_0xb6e3('0x53')];if(!_0x2c925d[_0xb6e3('0x4c')][_0xb6e3('0xce')](_0xb6e3('0xdf'))){_0x4bb5bd[_0xb6e3('0x1d')]=qs[_0xb6e3('0x1d')](_0x2c925d[_0xb6e3('0x4c')]['limit']);_0x4bb5bd[_0xb6e3('0x1c')]=qs[_0xb6e3('0x1c')](_0x2c925d[_0xb6e3('0x4c')]['offset']);}return _0x1bfab9[_0xb6e3('0x126')](_0x4bb5bd);}})[_0xb6e3('0x21')](function(_0x29b81b){if(_0x29b81b){return _0x29b81b?{'count':_0x1ee5fc,'rows':_0x29b81b}:null;}})['then'](respondWithResult(_0x4b72be,null))[_0xb6e3('0x2b')](handleError(_0x4b72be,null));};exports[_0xb6e3('0x128')]=function(_0x5700ce,_0x20926e){var _0x48be66={};var _0x78b061={};var _0x39f317;return db[_0xb6e3('0x4b')][_0xb6e3('0x9b')]({'where':{'id':_0x5700ce['params']['id']}})['then'](handleEntityNotFound(_0x20926e,null))['then'](function(_0xd7c822){if(_0xd7c822){_0x39f317=_0xd7c822;_0x78b061[_0xb6e3('0xd6')]=_[_0xb6e3('0xd7')](db['User'][_0xb6e3('0xd9')]);_0x78b061[_0xb6e3('0x4c')]=_[_0xb6e3('0xd7')](_0x5700ce[_0xb6e3('0x4c')]);_0x78b061[_0xb6e3('0xda')]=_['intersection'](_0x78b061[_0xb6e3('0xd6')],_0x78b061['query']);_0x48be66['attributes']=_[_0xb6e3('0xdb')](_0x78b061[_0xb6e3('0xd6')],qs[_0xb6e3('0xdc')](_0x5700ce['query'][_0xb6e3('0xdc')]));_0x48be66[_0xb6e3('0x4f')]=_0x48be66['attributes'][_0xb6e3('0x53')]?_0x48be66[_0xb6e3('0x4f')]:_0x78b061[_0xb6e3('0xd6')];_0x48be66[_0xb6e3('0xe1')]=qs[_0xb6e3('0xdd')](_0x5700ce['query'][_0xb6e3('0xdd')]);_0x48be66[_0xb6e3('0x4a')]=qs[_0xb6e3('0xda')](_[_0xb6e3('0xe2')](_0x5700ce['query'],_0x78b061[_0xb6e3('0xda')]));if(_0x5700ce['query'][_0xb6e3('0x38')]){_0x48be66[_0xb6e3('0x4a')]=_[_0xb6e3('0x60')](_0x48be66[_0xb6e3('0x4a')],{'$or':_[_0xb6e3('0x41')](_0x48be66[_0xb6e3('0x4f')],function(_0x485a47){var _0x237ea8={};_0x237ea8[_0x485a47]={'$like':'%'+_0x5700ce['query']['filter']+'%'};return _0x237ea8;})});}_0x48be66['model']=db['User'];_0x48be66['as']=_0xb6e3('0x35');_0x48be66=_['merge']({},_0x48be66,_0x5700ce['options']);return _0x39f317[_0xb6e3('0xfe')]({'include':[_0x48be66]});}})[_0xb6e3('0x21')](function(_0x19ae1a){if(_0x19ae1a){var _0x4ae80b={},_0x1ee1ac=[];for(var _0x5311c0=0x0;_0x5311c0<_0x19ae1a[_0xb6e3('0x53')];_0x5311c0+=0x1){for(var _0x285647=0x0,_0x1ddd91;_0x285647<_0x19ae1a[_0x5311c0][_0xb6e3('0x35')]['length'];_0x285647+=0x1){_0x1ddd91=_0x19ae1a[_0x5311c0][_0xb6e3('0x35')][_0x285647][_0xb6e3('0x31')]({'plain':!![]});_0x4ae80b[_0x1ddd91['id']]=_0x1ddd91;}}_0x4ae80b=_[_0xb6e3('0x129')](_0x4ae80b);for(var _0x1418b6=qs[_0xb6e3('0x1c')](_0x5700ce['query'][_0xb6e3('0x1c')]);_0x1418b6<_0x4ae80b[_0xb6e3('0x53')]&&_0x1ee1ac[_0xb6e3('0x53')]=_0x5f4fec[_0xa5c2('0x48')]){throw new Error(_0xa5c2('0x49'));}})[_0xa5c2('0x1d')](function(){if(_0x18676b){return db[_0xa5c2('0x20')][_0xa5c2('0x40')]({'where':{'membername':_0x18676b['name']},'individualHooks':!![]});}})[_0xa5c2('0x1d')](function(){if(_0x18676b){return _0x18676b[_0xa5c2('0x4a')]({'raw':!![]});}})[_0xa5c2('0x1d')](function(_0x486132){if(_0x18676b){if(_0x486132){var _0x392833=[];_0x2e9732=_0x486132;if(_0x2e9732[_0xa5c2('0x4b')]){for(var _0x45013a=0x0;_0x45013a<_0x2e9732[_0xa5c2('0x4b')];_0x45013a++){_0x392833['push'](db[_0xa5c2('0x20')]['upsert']({'membername':_0x18676b['name'],'UserId':_0x18676b['id'],'queue_name':_0x2e9732[_0x45013a][_0xa5c2('0x1b')],'VoiceQueueId':_0x2e9732[_0x45013a]['id'],'interface':_0x37b041,'paused':_0x18676b[_0xa5c2('0x45')]||![],'penalty':_0x2e9732[_0x45013a][_0xa5c2('0x4c')]||0x0}));}return BPromise[_0xa5c2('0x42')](_0x392833);}}}})['then'](function(){if(_0x18676b){return db[_0xa5c2('0x2e')][_0xa5c2('0x4d')]({'where':{'membername':_0x18676b[_0xa5c2('0x1b')],'exitAt':null}});}})[_0xa5c2('0x1d')](function(_0xbba445){if(_0x18676b){if(_0xbba445&&_0xbba445[_0xa5c2('0x4b')]){var _0x158b65=[];_0xbba445['forEach'](function(_0x3b78c9){_0x158b65['push'](_0x3b78c9['update']({'exitAt':moment()[_0xa5c2('0x23')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa5c2('0x42')](_0x158b65);}}})['then'](function(){if(_0x18676b){var _0x32b35b=[];var _0x2f77a6=[];var _0x227e3d=utils[_0xa5c2('0x26')]();var _0xbfab0f={'membername':_0x18676b[_0xa5c2('0x1b')],'interface':_0x37b041,'enterAt':moment()['format'](_0xa5c2('0x24')),'role':_0x18676b['role'],'internal':_0x18676b[_0xa5c2('0x2c')]};_0x227e3d[_0xa5c2('0x27')](function(_0x448bad){_0x32b35b[_0xa5c2('0x41')](_[_0xa5c2('0x4e')]({'channel':_0x448bad,'type':'LOGIN','data1':_0xa5c2('0x4f'),'data2':_0x37b041},_0xbfab0f));if(_0x18676b[_0xa5c2('0x45')]){_0x2f77a6[_0xa5c2('0x41')](_[_0xa5c2('0x4e')]({'channel':_0x448bad,'type':'PAUSE','data1':_0xa5c2('0x50')},_0xbfab0f));}});return db[_0xa5c2('0x2e')][_0xa5c2('0x2f')](_0x32b35b['concat'](_0x2f77a6),{'individualHooks':!![]});}})[_0xa5c2('0x1d')](function(){if(_0x18676b){return _0x18676b[_0xa5c2('0x21')]({'online':!![],'lastLoginAt':moment()['format'](_0xa5c2('0x24')),'voicePause':_0x18676b[_0xa5c2('0x45')]||![],'mailPause':_0x18676b[_0xa5c2('0x45')]||![],'chatPause':_0x18676b['loginInPause']||![],'faxPause':_0x18676b[_0xa5c2('0x45')]||![],'smsPause':_0x18676b['loginInPause']||![],'openchannelPause':_0x18676b['loginInPause']||![],'pauseType':_0x18676b[_0xa5c2('0x45')]?_0xa5c2('0x50'):null,'lastPauseAt':moment()[_0xa5c2('0x23')](_0xa5c2('0x24')),'interface':_0x37b041});}})[_0xa5c2('0x1d')](function(_0xf0163f){_0x58cfbe(_0xf0163f);})[_0xa5c2('0x16')](function(_0x37ef30){_0x25c4ce(_0x22fbc6[_0xa5c2('0x18')](0x1f4,_0x37ef30[_0xa5c2('0x17')]));});});}; \ No newline at end of file +var _0x1b5a=['error','find','raw','ShowUser','message','PauseUser','name','role','internal','interface','format','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','updateAttributes','forEach','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','body','uniqueid','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','destroy','all','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./user.socket','register','GetUser','User','findAll','options','where','attributes','limit','include','model','map','then','info','debug','stringify','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1b5a,0x1b0));var _0xa1b5=function(_0xb51983,_0x700815){_0xb51983=_0xb51983-0x0;var _0xc56ec1=_0x1b5a[_0xb51983];return _0xc56ec1;};'use strict';var _=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var moment=require('moment');var BPromise=require(_0xa1b5('0x2'));var Redis=require(_0xa1b5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa1b5('0x4'));var logger=require(_0xa1b5('0x5'))(_0xa1b5('0x6'));var config=require(_0xa1b5('0x7'));config[_0xa1b5('0x8')]=_[_0xa1b5('0x9')](config[_0xa1b5('0x8')],{'host':_0xa1b5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1b5('0x8')]));require(_0xa1b5('0xb'))[_0xa1b5('0xc')](socket);exports[_0xa1b5('0xd')]=function(_0xabff74){var _0x4176e4=this;return new Promise(function(_0x14da07,_0xf9717e){return db[_0xa1b5('0xe')][_0xa1b5('0xf')]({'raw':_0xabff74[_0xa1b5('0x10')]?_0xabff74[_0xa1b5('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0xabff74[_0xa1b5('0x10')]?_0xabff74[_0xa1b5('0x10')][_0xa1b5('0x11')]||null:null,'attributes':_0xabff74[_0xa1b5('0x10')]?_0xabff74['options'][_0xa1b5('0x12')]||null:null,'limit':_0xabff74[_0xa1b5('0x10')]?_0xabff74['options'][_0xa1b5('0x13')]||null:null,'include':_0xabff74['options']?_0xabff74['options'][_0xa1b5('0x14')]?_['map'](_0xabff74[_0xa1b5('0x10')][_0xa1b5('0x14')],function(_0x4eee5c){return{'model':db[_0x4eee5c[_0xa1b5('0x15')]],'as':_0x4eee5c['as'],'attributes':_0x4eee5c[_0xa1b5('0x12')],'include':_0x4eee5c[_0xa1b5('0x14')]?_[_0xa1b5('0x16')](_0x4eee5c['include'],function(_0x469551){return{'model':db[_0x469551['model']],'as':_0x469551['as'],'attributes':_0x469551[_0xa1b5('0x12')],'include':_0x469551[_0xa1b5('0x14')]?_[_0xa1b5('0x16')](_0x469551[_0xa1b5('0x14')],function(_0x51fd57){return{'model':db[_0x51fd57[_0xa1b5('0x15')]],'as':_0x51fd57['as'],'attributes':_0x51fd57['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1b5('0x17')](function(_0x4aadcf){logger[_0xa1b5('0x18')](_0xa1b5('0xd'),_0xabff74);logger[_0xa1b5('0x19')]('GetUser',_0xabff74,JSON[_0xa1b5('0x1a')](_0x4aadcf));_0x14da07(_0x4aadcf);})[_0xa1b5('0x1b')](function(_0x15308d){logger[_0xa1b5('0x1c')]('GetUser',_0x15308d['message'],_0xabff74);_0xf9717e(_0x4176e4[_0xa1b5('0x1c')](0x1f4,_0x15308d['message']));});});};exports['ShowUser']=function(_0x370673){var _0x4e189b=this;return new Promise(function(_0x39231f,_0x3dd191){return db['User'][_0xa1b5('0x1d')]({'raw':_0x370673[_0xa1b5('0x10')]?_0x370673[_0xa1b5('0x10')][_0xa1b5('0x1e')]===undefined?!![]:![]:!![],'where':_0x370673[_0xa1b5('0x10')]?_0x370673[_0xa1b5('0x10')][_0xa1b5('0x11')]||null:null,'attributes':_0x370673[_0xa1b5('0x10')]?_0x370673[_0xa1b5('0x10')][_0xa1b5('0x12')]||null:null,'include':_0x370673['options']?_0x370673['options'][_0xa1b5('0x14')]?_['map'](_0x370673['options'][_0xa1b5('0x14')],function(_0x2d5327){return{'model':db[_0x2d5327[_0xa1b5('0x15')]],'as':_0x2d5327['as'],'attributes':_0x2d5327['attributes'],'include':_0x2d5327['include']?_[_0xa1b5('0x16')](_0x2d5327[_0xa1b5('0x14')],function(_0x1aba44){return{'model':db[_0x1aba44[_0xa1b5('0x15')]],'as':_0x1aba44['as'],'attributes':_0x1aba44['attributes'],'include':_0x1aba44[_0xa1b5('0x14')]?_['map'](_0x1aba44[_0xa1b5('0x14')],function(_0x2c2b77){return{'model':db[_0x2c2b77['model']],'as':_0x2c2b77['as'],'attributes':_0x2c2b77[_0xa1b5('0x12')]};}):[]};}):[]};}):[]:[]})[_0xa1b5('0x17')](function(_0x556f67){logger[_0xa1b5('0x18')](_0xa1b5('0x1f'),_0x370673);logger[_0xa1b5('0x19')](_0xa1b5('0x1f'),_0x370673,JSON[_0xa1b5('0x1a')](_0x556f67));_0x39231f(_0x556f67);})[_0xa1b5('0x1b')](function(_0x3360e2){logger[_0xa1b5('0x1c')](_0xa1b5('0x1f'),_0x3360e2[_0xa1b5('0x20')],_0x370673);_0x3dd191(_0x4e189b[_0xa1b5('0x1c')](0x1f4,_0x3360e2[_0xa1b5('0x20')]));});});};exports[_0xa1b5('0x21')]=function(_0x3b36ba){var _0x2d39ae;return db[_0xa1b5('0xe')][_0xa1b5('0x1d')]({'where':_0x3b36ba[_0xa1b5('0x10')][_0xa1b5('0x11')]||{},'attributes':['id',_0xa1b5('0x22'),_0xa1b5('0x23'),_0xa1b5('0x24'),_0xa1b5('0x25')]})[_0xa1b5('0x17')](function(_0x257b91){if(!_0x257b91){throw new Error(util[_0xa1b5('0x26')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3b36ba[_0xa1b5('0x27')]['id']));}_0x2d39ae=_0x257b91;return db[_0xa1b5('0x28')][_0xa1b5('0x29')]({'paused':0x1},{'where':{'UserId':_0x2d39ae['id']},'individualHooks':!![]});})['then'](function(){return db[_0xa1b5('0x2a')][_0xa1b5('0xf')]({'where':{'membername':_0x2d39ae[_0xa1b5('0x22')],'type':_0xa1b5('0x2b'),'exitAt':null}});})['then'](function(_0x426ec6){if(_0x426ec6&&_0x426ec6[_0xa1b5('0x2c')]){var _0x182193=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1390e1=0x0,_0x2d7c77=_0x426ec6[_0xa1b5('0x2c')];_0x1390e1<_0x2d7c77;_0x1390e1++){_0x426ec6[_0x1390e1][_0xa1b5('0x2d')]({'exitAt':_0x182193});}}})[_0xa1b5('0x17')](function(){var _0x135752=[];var _0x1d36a4=utils['getChannels']();_0x1d36a4[_0xa1b5('0x2e')](function(_0x29424e){_0x135752[_0xa1b5('0x2f')]({'channel':_0x29424e,'membername':_0x2d39ae['name'],'interface':_[_0xa1b5('0x30')](_0x2d39ae[_0xa1b5('0x25')])?util[_0xa1b5('0x26')](_0xa1b5('0x31'),_0x2d39ae[_0xa1b5('0x22')]):_0x2d39ae[_0xa1b5('0x25')],'type':_0xa1b5('0x2b'),'enterAt':moment()[_0xa1b5('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3b36ba['body'][_0xa1b5('0x32')]||_0xa1b5('0x33'),'role':_0x2d39ae['role'],'internal':_0x2d39ae[_0xa1b5('0x24')],'uniqueid':_0x3b36ba[_0xa1b5('0x34')][_0xa1b5('0x35')]||null});});return db['MemberReport'][_0xa1b5('0x36')](_0x135752,{'individualHooks':!![]});})[_0xa1b5('0x17')](function(){return _0x2d39ae[_0xa1b5('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3b36ba[_0xa1b5('0x34')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37'))});})['catch'](function(_0x51d789){throw _0x51d789;});};exports[_0xa1b5('0x38')]=function(_0x6a98db){return Promise[_0xa1b5('0x39')]()[_0xa1b5('0x17')](function(){if(_0x6a98db['body'][_0xa1b5('0x3a')]&&!utils[_0xa1b5('0x3b')](_0x6a98db[_0xa1b5('0x34')][_0xa1b5('0x3a')])){throw new Error(util['format'](_0xa1b5('0x3c'),_0x6a98db['body'][_0xa1b5('0x3a')]));}return db[_0xa1b5('0xe')][_0xa1b5('0x3d')]({'where':_0x6a98db['options'][_0xa1b5('0x11')]||{},'attributes':['id',_0xa1b5('0x22'),_0xa1b5('0x23'),_0xa1b5('0x24'),'interface',_0xa1b5('0x3e'),'voicePause',_0xa1b5('0x3f'),_0xa1b5('0x40'),_0xa1b5('0x41'),'openchannelPause',_0xa1b5('0x42'),_0xa1b5('0x43'),_0xa1b5('0x44'),_0xa1b5('0x45')]});})[_0xa1b5('0x17')](function(_0x34d544){if(!_0x34d544){throw new Error(util[_0xa1b5('0x26')]('User\x20with\x20id\x20%s\x20not\x20found',_0x6a98db[_0xa1b5('0x27')]['id']));}return _0x34d544[_0xa1b5('0x46')](_0x6a98db[_0xa1b5('0x34')]['channel'],_0xa1b5('0x47'));})[_0xa1b5('0x1b')](function(_0x894844){throw _0x894844;});};exports[_0xa1b5('0x48')]=function(_0x19fff2){var _0x56c44d=this;return new Promise(function(_0x12b9b8,_0x126473){var _0x5c9b8d;return db[_0xa1b5('0xe')][_0xa1b5('0x3d')]({'where':_0x19fff2['options']['where']||{},'attributes':['id',_0xa1b5('0x22')]})[_0xa1b5('0x17')](function(_0x125343){if(_0x125343){_0x5c9b8d=_0x125343;return db[_0xa1b5('0x28')][_0xa1b5('0x49')]({'where':{'membername':_0x5c9b8d['name']},'individualHooks':!![]});}})[_0xa1b5('0x17')](function(){if(_0x5c9b8d){return db['MemberReport'][_0xa1b5('0xf')]({'where':{'membername':_0x5c9b8d[_0xa1b5('0x22')],'exitAt':null}});}})[_0xa1b5('0x17')](function(_0x51e119){if(_0x5c9b8d){if(_0x51e119&&_0x51e119['length']){var _0x59de59=[];_0x51e119[_0xa1b5('0x2e')](function(_0x113c96){_0x59de59[_0xa1b5('0x2f')](_0x113c96['update']({'exitAt':moment()['format'](_0xa1b5('0x37'))}));});return BPromise[_0xa1b5('0x4a')](_0x59de59);}}})[_0xa1b5('0x17')](function(){if(_0x5c9b8d){return _0x5c9b8d[_0xa1b5('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x1d0dbc){_0x12b9b8(_0x1d0dbc);})[_0xa1b5('0x1b')](function(_0x43f95a){_0x126473(_0x56c44d[_0xa1b5('0x1c')](0x1f4,_0x43f95a['message']));});});};exports[_0xa1b5('0x4b')]=function(_0x1cde1c){var _0x890133=this;return new Promise(function(_0x5155ac,_0x44a26b){var _0x1029b7;var _0x1f1a06;var _0x221d9d;var _0x1a856f;return db[_0xa1b5('0xe')][_0xa1b5('0x3d')]({'where':_0x1cde1c['options'][_0xa1b5('0x11')]||{},'attributes':['id','name',_0xa1b5('0x23'),_0xa1b5('0x4c'),'phone',_0xa1b5('0x24'),_0xa1b5('0x4d'),_0xa1b5('0x25')]})[_0xa1b5('0x17')](function(_0x3950c8){if(_0x3950c8){_0x1029b7=_0x3950c8;_0x1a856f=_0x1cde1c[_0xa1b5('0x34')][_0xa1b5('0x25')]?_0x1cde1c[_0xa1b5('0x34')][_0xa1b5('0x25')]:util[_0xa1b5('0x26')]('SIP/%s',_0x1029b7[_0xa1b5('0x22')]);return db[_0xa1b5('0xe')][_0xa1b5('0x4e')]({'where':{'role':_0xa1b5('0x4f'),'online':!![],'id':{'$ne':_0x1029b7['id']}}});}})[_0xa1b5('0x17')](function(_0x3434a6){if(_0x3434a6){_0x221d9d=_0x3434a6;return require(_0xa1b5('0x50'))[_0xa1b5('0x51')]();}})['then'](function(_0x5ddb51){if(_0x5ddb51&&_0x5ddb51[_0xa1b5('0x52')]&&_0x221d9d>=_0x5ddb51[_0xa1b5('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return db[_0xa1b5('0x28')][_0xa1b5('0x49')]({'where':{'membername':_0x1029b7[_0xa1b5('0x22')]},'individualHooks':!![]});}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return _0x1029b7[_0xa1b5('0x53')]({'raw':!![]});}})[_0xa1b5('0x17')](function(_0x508a06){if(_0x1029b7){if(_0x508a06){var _0x56830d=[];_0x1f1a06=_0x508a06;if(_0x1f1a06[_0xa1b5('0x2c')]){for(var _0xf6de52=0x0;_0xf6de52<_0x1f1a06[_0xa1b5('0x2c')];_0xf6de52++){_0x56830d[_0xa1b5('0x2f')](db[_0xa1b5('0x28')][_0xa1b5('0x54')]({'membername':_0x1029b7[_0xa1b5('0x22')],'UserId':_0x1029b7['id'],'queue_name':_0x1f1a06[_0xf6de52][_0xa1b5('0x22')],'VoiceQueueId':_0x1f1a06[_0xf6de52]['id'],'interface':_0x1a856f,'paused':_0x1029b7[_0xa1b5('0x4d')]||![],'penalty':_0x1f1a06[_0xf6de52][_0xa1b5('0x55')]||0x0}));}return BPromise[_0xa1b5('0x4a')](_0x56830d);}}}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return db[_0xa1b5('0x2a')]['findAll']({'where':{'membername':_0x1029b7[_0xa1b5('0x22')],'exitAt':null}});}})[_0xa1b5('0x17')](function(_0x282de7){if(_0x1029b7){if(_0x282de7&&_0x282de7[_0xa1b5('0x2c')]){var _0x50a7b6=[];_0x282de7[_0xa1b5('0x2e')](function(_0x5c2c60){_0x50a7b6['push'](_0x5c2c60['update']({'exitAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37'))}));});return BPromise[_0xa1b5('0x4a')](_0x50a7b6);}}})['then'](function(){if(_0x1029b7){var _0x4391c8=[];var _0x58b4f6=[];var _0x42829b=utils[_0xa1b5('0x56')]();var _0xface5f={'membername':_0x1029b7[_0xa1b5('0x22')],'interface':_0x1a856f,'enterAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37')),'role':_0x1029b7[_0xa1b5('0x23')],'internal':_0x1029b7[_0xa1b5('0x24')]};_0x42829b[_0xa1b5('0x2e')](function(_0x2fd1a0){_0x4391c8[_0xa1b5('0x2f')](_[_0xa1b5('0x57')]({'channel':_0x2fd1a0,'type':_0xa1b5('0x58'),'data1':_0xa1b5('0x59'),'data2':_0x1a856f},_0xface5f));if(_0x1029b7['loginInPause']){_0x58b4f6[_0xa1b5('0x2f')](_[_0xa1b5('0x57')]({'channel':_0x2fd1a0,'type':_0xa1b5('0x2b'),'data1':_0xa1b5('0x5a')},_0xface5f));}});return db[_0xa1b5('0x2a')][_0xa1b5('0x36')](_0x4391c8[_0xa1b5('0x5b')](_0x58b4f6),{'individualHooks':!![]});}})[_0xa1b5('0x17')](function(){if(_0x1029b7){return _0x1029b7[_0xa1b5('0x29')]({'online':!![],'lastLoginAt':moment()[_0xa1b5('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1029b7[_0xa1b5('0x4d')]||![],'mailPause':_0x1029b7[_0xa1b5('0x4d')]||![],'chatPause':_0x1029b7[_0xa1b5('0x4d')]||![],'faxPause':_0x1029b7[_0xa1b5('0x4d')]||![],'smsPause':_0x1029b7[_0xa1b5('0x4d')]||![],'openchannelPause':_0x1029b7[_0xa1b5('0x4d')]||![],'pauseType':_0x1029b7[_0xa1b5('0x4d')]?_0xa1b5('0x5a'):null,'lastPauseAt':moment()[_0xa1b5('0x26')](_0xa1b5('0x37')),'interface':_0x1a856f});}})['then'](function(_0x21c95c){_0x5155ac(_0x21c95c);})[_0xa1b5('0x1b')](function(_0x19ea09){_0x44a26b(_0x890133[_0xa1b5('0x1c')](0x1f4,_0x19ea09[_0xa1b5('0x20')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 29820d5..fd5cc0d 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 _0x5512=['emit','removeListener','register','length','user:','./user.events'];(function(_0xcc523b,_0x1eb463){var _0x6afae7=function(_0x5cc82f){while(--_0x5cc82f){_0xcc523b['push'](_0xcc523b['shift']());}};_0x6afae7(++_0x1eb463);}(_0x5512,0x95));var _0x2551=function(_0x3aabbe,_0x4b8ea1){_0x3aabbe=_0x3aabbe-0x0;var _0x5462e1=_0x5512[_0x3aabbe];return _0x5462e1;};'use strict';var UserEvents=require(_0x2551('0x0'));var events=['save','remove','update'];function createListener(_0x42b458,_0x417cca){return function(_0x1e47e6){_0x417cca[_0x2551('0x1')](_0x42b458,_0x1e47e6);};}function removeListener(_0x210c85,_0x8dc2c4){return function(){UserEvents[_0x2551('0x2')](_0x210c85,_0x8dc2c4);};}exports[_0x2551('0x3')]=function(_0x3c97fa){for(var _0xa8c0ab=0x0,_0x258423=events[_0x2551('0x4')];_0xa8c0ab<_0x258423;_0xa8c0ab++){var _0x286ea7=events[_0xa8c0ab];var _0x40c114=createListener(_0x2551('0x5')+_0x286ea7,_0x3c97fa);UserEvents['on'](_0x286ea7,_0x40c114);}}; \ No newline at end of file +var _0x91fb=['save','remove','update','emit','register','user:','./user.events'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0x91fb,0xb5));var _0xb91f=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x91fb[_0x1abeb2];return _0x48da20;};'use strict';var UserEvents=require(_0xb91f('0x0'));var events=[_0xb91f('0x1'),_0xb91f('0x2'),_0xb91f('0x3')];function createListener(_0x3af23b,_0x4037c3){return function(_0x10d156){_0x4037c3[_0xb91f('0x4')](_0x3af23b,_0x10d156);};}function removeListener(_0x5f3330,_0x27cb92){return function(){UserEvents['removeListener'](_0x5f3330,_0x27cb92);};}exports[_0xb91f('0x5')]=function(_0x269f52){for(var _0x38ac92=0x0,_0x3c77d2=events['length'];_0x38ac92<_0x3c77d2;_0x38ac92++){var _0x4fbb0b=events[_0x38ac92];var _0x54e539=createListener(_0xb91f('0x6')+_0x4fbb0b,_0x269f52);UserEvents['on'](_0x4fbb0b,_0x54e539);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index bfda7f0..7dc84a7 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4034f0,_0x45a177){var _0x4a4119=function(_0x122ca8){while(--_0x122ca8){_0x4034f0['push'](_0x4034f0['shift']());}};_0x4a4119(++_0x45a177);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xb9404d,_0xb9c541){var _0x5cfcf7=function(_0x1732d2){while(--_0x1732d2){_0xb9404d['push'](_0xb9404d['shift']());}};_0x5cfcf7(++_0xb9c541);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 389a6d5..3520406 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 _0x6459=['sequelize','INTEGER'];(function(_0x58460b,_0x358ec0){var _0x49169f=function(_0x5e91d5){while(--_0x5e91d5){_0x58460b['push'](_0x58460b['shift']());}};_0x49169f(++_0x358ec0);}(_0x6459,0x1b8));var _0x9645=function(_0x33e452,_0x503c6b){_0x33e452=_0x33e452-0x0;var _0x46f379=_0x6459[_0x33e452];return _0x46f379;};'use strict';var Sequelize=require(_0x9645('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9645('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9376=['INTEGER','sequelize','exports'];(function(_0x18824e,_0x1fa3a2){var _0x355e42=function(_0x5876ff){while(--_0x5876ff){_0x18824e['push'](_0x18824e['shift']());}};_0x355e42(++_0x1fa3a2);}(_0x9376,0x18a));var _0x6937=function(_0xe936a7,_0x3e8ff1){_0xe936a7=_0xe936a7-0x0;var _0x4096e0=_0x9376[_0xe936a7];return _0x4096e0;};'use strict';var Sequelize=require(_0x6937('0x0'));module[_0x6937('0x1')]={'penalty':{'type':Sequelize[_0x6937('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 19f09df..10eaa37 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 _0xa5e8=['user_has_chat_queues','../../config/logger','moment','bluebird','request-promise','path','./userChatQueue.attributes','exports'];(function(_0x45c883,_0x1c22ba){var _0x333475=function(_0x1eb912){while(--_0x1eb912){_0x45c883['push'](_0x45c883['shift']());}};_0x333475(++_0x1c22ba);}(_0xa5e8,0x1b1));var _0x8a5e=function(_0xbb526f,_0x3e1ff5){_0xbb526f=_0xbb526f-0x0;var _0x38ebaf=_0xa5e8[_0xbb526f];return _0x38ebaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a5e('0x0'))('api');var moment=require(_0x8a5e('0x1'));var BPromise=require(_0x8a5e('0x2'));var rp=require(_0x8a5e('0x3'));var fs=require('fs');var path=require(_0x8a5e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a5e('0x5'));module[_0x8a5e('0x6')]=function(_0x4523d0,_0x5e9558){return _0x4523d0['define']('UserChatQueue',attributes,{'tableName':_0x8a5e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b80=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x3d0958,_0x204a7e){var _0x1c77f8=function(_0x39a179){while(--_0x39a179){_0x3d0958['push'](_0x3d0958['shift']());}};_0x1c77f8(++_0x204a7e);}(_0x6b80,0x134));var _0x06b8=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x6b80[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0x06b8('0x0'));var util=require('util');var logger=require(_0x06b8('0x1'))(_0x06b8('0x2'));var moment=require('moment');var BPromise=require(_0x06b8('0x3'));var rp=require(_0x06b8('0x4'));var fs=require('fs');var path=require(_0x06b8('0x5'));var rimraf=require(_0x06b8('0x6'));var config=require(_0x06b8('0x7'));var attributes=require(_0x06b8('0x8'));module[_0x06b8('0x9')]=function(_0x1786af,_0x44a87f){return _0x1786af[_0x06b8('0xa')](_0x06b8('0xb'),attributes,{'tableName':_0x06b8('0xc'),'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 e0c84ce..6facdac 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 _0x8680=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x2a7a96,_0x232940){var _0xd5a479=function(_0x206f66){while(--_0x206f66){_0x2a7a96['push'](_0x2a7a96['shift']());}};_0xd5a479(++_0x232940);}(_0x8680,0x10c));var _0x0868=function(_0x381005,_0x2b3564){_0x381005=_0x381005-0x0;var _0x7fb157=_0x8680[_0x381005];return _0x7fb157;};'use strict';var _=require(_0x0868('0x0'));var util=require(_0x0868('0x1'));var moment=require(_0x0868('0x2'));var BPromise=require(_0x0868('0x3'));var rs=require(_0x0868('0x4'));var fs=require('fs');var Redis=require(_0x0868('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0868('0x6'));var logger=require('../../config/logger')(_0x0868('0x7'));var config=require(_0x0868('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0868('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7c06ff,_0x3caba2,_0xe533a4){return new BPromise(function(_0xf57d44,_0x3c344b){return client['request'](_0x7c06ff,_0xe533a4)['then'](function(_0x3ab43e){logger[_0x0868('0xa')](_0x0868('0xb'),_0x3caba2,_0x0868('0xc'));logger[_0x0868('0xd')](_0x0868('0xe'),_0x3caba2,_0x0868('0xc'),JSON[_0x0868('0xf')](_0x3ab43e));if(_0x3ab43e[_0x0868('0x10')]){if(_0x3ab43e['error'][_0x0868('0x11')]===0x1f4){logger[_0x0868('0x10')](_0x0868('0xb'),_0x3caba2,_0x3ab43e[_0x0868('0x10')][_0x0868('0x12')]);return _0x3c344b(_0x3ab43e['error'][_0x0868('0x12')]);}logger[_0x0868('0x10')](_0x0868('0xb'),_0x3caba2,_0x3ab43e[_0x0868('0x10')][_0x0868('0x12')]);return _0xf57d44(_0x3ab43e[_0x0868('0x10')]['message']);}else{logger[_0x0868('0xa')](_0x0868('0xb'),_0x3caba2,'request\x20sent');_0xf57d44(_0x3ab43e['result'][_0x0868('0x12')]);}})[_0x0868('0x13')](function(_0x7f211c){logger[_0x0868('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x3caba2,_0x7f211c);_0x3c344b(_0x7f211c);});});} \ No newline at end of file +var _0xbc3e=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x850fbc,_0x1c1107){var _0xb309d6=function(_0x12e5b3){while(--_0x12e5b3){_0x850fbc['push'](_0x850fbc['shift']());}};_0xb309d6(++_0x1c1107);}(_0xbc3e,0xf2));var _0xebc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc3e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebc3('0x0'));var BPromise=require(_0xebc3('0x1'));var rs=require(_0xebc3('0x2'));var fs=require('fs');var Redis=require(_0xebc3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xebc3('0x4'));var logger=require(_0xebc3('0x5'))(_0xebc3('0x6'));var config=require('../../config/environment');var jayson=require(_0xebc3('0x7'));var client=jayson[_0xebc3('0x8')][_0xebc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfe2bd9,_0x3865df,_0x4a78d8){return new BPromise(function(_0x1b8575,_0x506acd){return client[_0xebc3('0xa')](_0xfe2bd9,_0x4a78d8)[_0xebc3('0xb')](function(_0x19cd04){logger[_0xebc3('0xc')](_0xebc3('0xd'),_0x3865df,'request\x20sent');logger['debug'](_0xebc3('0xe'),_0x3865df,_0xebc3('0xf'),JSON[_0xebc3('0x10')](_0x19cd04));if(_0x19cd04['error']){if(_0x19cd04[_0xebc3('0x11')][_0xebc3('0x12')]===0x1f4){logger[_0xebc3('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x3865df,_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);return _0x506acd(_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);}logger[_0xebc3('0x11')](_0xebc3('0xd'),_0x3865df,_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);return _0x1b8575(_0x19cd04[_0xebc3('0x11')][_0xebc3('0x13')]);}else{logger[_0xebc3('0xc')](_0xebc3('0xd'),_0x3865df,'request\x20sent');_0x1b8575(_0x19cd04[_0xebc3('0x14')]['message']);}})[_0xebc3('0x15')](function(_0x53dcd1){logger['error'](_0xebc3('0xd'),_0x3865df,_0x53dcd1);_0x506acd(_0x53dcd1);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 91b4a92..cbf6992 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5096ea,_0xc621e1){var _0x32acd5=function(_0x595f6c){while(--_0x595f6c){_0x5096ea['push'](_0x5096ea['shift']());}};_0x32acd5(++_0xc621e1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb91[_0x58547b];return _0x1d3fd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c1329,_0x44d752){var _0x282631=function(_0x92755d){while(--_0x92755d){_0x5c1329['push'](_0x5c1329['shift']());}};_0x282631(++_0x44d752);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e0ccfc1..6d09094 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 _0x1a74=['STRING','sequelize','INTEGER'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x1a74,0x6d));var _0x41a7=function(_0x3babc2,_0x4f1cd0){_0x3babc2=_0x3babc2-0x0;var _0x169447=_0x1a74[_0x3babc2];return _0x169447;};'use strict';var Sequelize=require(_0x41a7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x41a7('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x41a7('0x2')]}}; \ No newline at end of file +var _0xb5d7=['sequelize','INTEGER','STRING'];(function(_0xe43796,_0x55e3d5){var _0x42fcb2=function(_0x954f54){while(--_0x954f54){_0xe43796['push'](_0xe43796['shift']());}};_0x42fcb2(++_0x55e3d5);}(_0xb5d7,0x18f));var _0x7b5d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb5d7[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7b5d('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b5d('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7b5d('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d4b2271..3d84204 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 _0x0d0d=['./userFaxQueue.attributes','define','UserFaxQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xe6c2cf,_0x617b83){var _0x287854=function(_0x4add9b){while(--_0x4add9b){_0xe6c2cf['push'](_0xe6c2cf['shift']());}};_0x287854(++_0x617b83);}(_0x0d0d,0x92));var _0xd0d0=function(_0x4689f8,_0x2c6232){_0x4689f8=_0x4689f8-0x0;var _0x489cdc=_0x0d0d[_0x4689f8];return _0x489cdc;};'use strict';var _=require(_0xd0d0('0x0'));var util=require('util');var logger=require(_0xd0d0('0x1'))(_0xd0d0('0x2'));var moment=require(_0xd0d0('0x3'));var BPromise=require(_0xd0d0('0x4'));var rp=require(_0xd0d0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0d0('0x6'));var config=require(_0xd0d0('0x7'));var attributes=require(_0xd0d0('0x8'));module['exports']=function(_0x37d489,_0x263908){return _0x37d489[_0xd0d0('0x9')](_0xd0d0('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc125=['user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define'];(function(_0x4372b4,_0x57e41c){var _0x2b3e26=function(_0x189861){while(--_0x189861){_0x4372b4['push'](_0x4372b4['shift']());}};_0x2b3e26(++_0x57e41c);}(_0xc125,0xa6));var _0x5c12=function(_0x215ed0,_0x405474){_0x215ed0=_0x215ed0-0x0;var _0x4a7439=_0xc125[_0x215ed0];return _0x4a7439;};'use strict';var _=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var logger=require(_0x5c12('0x2'))(_0x5c12('0x3'));var moment=require('moment');var BPromise=require(_0x5c12('0x4'));var rp=require(_0x5c12('0x5'));var fs=require('fs');var path=require(_0x5c12('0x6'));var rimraf=require(_0x5c12('0x7'));var config=require('../../config/environment');var attributes=require(_0x5c12('0x8'));module['exports']=function(_0x1d2f84,_0x3d2ab6){return _0x1d2f84[_0x5c12('0x9')]('UserFaxQueue',attributes,{'tableName':_0x5c12('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 9bc523b..396e396 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 _0xefb9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','moment'];(function(_0x5300a8,_0x89fed7){var _0x2081e1=function(_0x181f8d){while(--_0x181f8d){_0x5300a8['push'](_0x5300a8['shift']());}};_0x2081e1(++_0x89fed7);}(_0xefb9,0x1cd));var _0x9efb=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0xefb9[_0x270dba];return _0x36b83b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9efb('0x0'));var BPromise=require(_0x9efb('0x1'));var rs=require(_0x9efb('0x2'));var fs=require('fs');var Redis=require(_0x9efb('0x3'));var db=require(_0x9efb('0x4'))['db'];var utils=require(_0x9efb('0x5'));var logger=require(_0x9efb('0x6'))(_0x9efb('0x7'));var config=require(_0x9efb('0x8'));var jayson=require(_0x9efb('0x9'));var client=jayson['client'][_0x9efb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x109c47,_0x148228,_0x33be74){return new BPromise(function(_0x223456,_0x1ab127){return client[_0x9efb('0xb')](_0x109c47,_0x33be74)[_0x9efb('0xc')](function(_0x2b7dc1){logger[_0x9efb('0xd')](_0x9efb('0xe'),_0x148228,_0x9efb('0xf'));logger[_0x9efb('0x10')](_0x9efb('0x11'),_0x148228,_0x9efb('0xf'),JSON['stringify'](_0x2b7dc1));if(_0x2b7dc1[_0x9efb('0x12')]){if(_0x2b7dc1[_0x9efb('0x12')][_0x9efb('0x13')]===0x1f4){logger[_0x9efb('0x12')](_0x9efb('0xe'),_0x148228,_0x2b7dc1['error'][_0x9efb('0x14')]);return _0x1ab127(_0x2b7dc1[_0x9efb('0x12')][_0x9efb('0x14')]);}logger['error'](_0x9efb('0xe'),_0x148228,_0x2b7dc1['error'][_0x9efb('0x14')]);return _0x223456(_0x2b7dc1[_0x9efb('0x12')][_0x9efb('0x14')]);}else{logger[_0x9efb('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x148228,_0x9efb('0xf'));_0x223456(_0x2b7dc1['result'][_0x9efb('0x14')]);}})['catch'](function(_0x5aa0ab){logger[_0x9efb('0x12')](_0x9efb('0xe'),_0x148228,_0x5aa0ab);_0x1ab127(_0x5aa0ab);});});} \ No newline at end of file +var _0xd8c6=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x1d6c05,_0x407325){var _0x3f534d=function(_0x4995db){while(--_0x4995db){_0x1d6c05['push'](_0x1d6c05['shift']());}};_0x3f534d(++_0x407325);}(_0xd8c6,0x1b6));var _0x6d8c=function(_0x3116b0,_0x4e368e){_0x3116b0=_0x3116b0-0x0;var _0x142b5d=_0xd8c6[_0x3116b0];return _0x142b5d;};'use strict';var _=require(_0x6d8c('0x0'));var util=require(_0x6d8c('0x1'));var moment=require(_0x6d8c('0x2'));var BPromise=require(_0x6d8c('0x3'));var rs=require(_0x6d8c('0x4'));var fs=require('fs');var Redis=require(_0x6d8c('0x5'));var db=require(_0x6d8c('0x6'))['db'];var utils=require(_0x6d8c('0x7'));var logger=require(_0x6d8c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6d8c('0x9'));var client=jayson[_0x6d8c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8863,_0x25a7b0,_0x2514a7){return new BPromise(function(_0x3067eb,_0xa1e4e8){return client['request'](_0x1f8863,_0x2514a7)[_0x6d8c('0xb')](function(_0x2cfb5b){logger['info'](_0x6d8c('0xc'),_0x25a7b0,'request\x20sent');logger[_0x6d8c('0xd')](_0x6d8c('0xe'),_0x25a7b0,_0x6d8c('0xf'),JSON[_0x6d8c('0x10')](_0x2cfb5b));if(_0x2cfb5b[_0x6d8c('0x11')]){if(_0x2cfb5b[_0x6d8c('0x11')][_0x6d8c('0x12')]===0x1f4){logger[_0x6d8c('0x11')](_0x6d8c('0xc'),_0x25a7b0,_0x2cfb5b[_0x6d8c('0x11')][_0x6d8c('0x13')]);return _0xa1e4e8(_0x2cfb5b['error']['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x25a7b0,_0x2cfb5b[_0x6d8c('0x11')]['message']);return _0x3067eb(_0x2cfb5b[_0x6d8c('0x11')][_0x6d8c('0x13')]);}else{logger[_0x6d8c('0x14')](_0x6d8c('0xc'),_0x25a7b0,_0x6d8c('0xf'));_0x3067eb(_0x2cfb5b[_0x6d8c('0x15')][_0x6d8c('0x13')]);}})[_0x6d8c('0x16')](function(_0x287e48){logger[_0x6d8c('0x11')](_0x6d8c('0xc'),_0x25a7b0,_0x287e48);_0xa1e4e8(_0x287e48);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 9ee8e05..e58936f 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x42757,_0x497be6){var _0x5eaf5a=function(_0x255d7c){while(--_0x255d7c){_0x42757['push'](_0x42757['shift']());}};_0x5eaf5a(++_0x497be6);}(_0x70e0,0x17b));var _0x070e=function(_0x244d52,_0x3efd90){_0x244d52=_0x244d52-0x0;var _0x27427d=_0x70e0[_0x244d52];return _0x27427d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb41e9f,_0x531994){var _0xc0f52c=function(_0x5c0c62){while(--_0x5c0c62){_0xb41e9f['push'](_0xb41e9f['shift']());}};_0xc0f52c(++_0x531994);}(_0xe706,0xa3));var _0x6e70=function(_0x54e335,_0x6b782d){_0x54e335=_0x54e335-0x0;var _0x5be44a=_0xe706[_0x54e335];return _0x5be44a;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ab49545..2504557 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 _0x0631=['INTEGER','sequelize'];(function(_0x4037d8,_0x485514){var _0x1fc2b1=function(_0x4fb94a){while(--_0x4fb94a){_0x4037d8['push'](_0x4037d8['shift']());}};_0x1fc2b1(++_0x485514);}(_0x0631,0xcd));var _0x1063=function(_0x4b9b30,_0x4ebf7d){_0x4b9b30=_0x4b9b30-0x0;var _0x8577a9=_0x0631[_0x4b9b30];return _0x8577a9;};'use strict';var Sequelize=require(_0x1063('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1063('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x55a8=['INTEGER','sequelize','exports'];(function(_0x1278b6,_0x24252e){var _0x2cff42=function(_0x46b845){while(--_0x46b845){_0x1278b6['push'](_0x1278b6['shift']());}};_0x2cff42(++_0x24252e);}(_0x55a8,0x148));var _0x855a=function(_0x4864b8,_0x2c542a){_0x4864b8=_0x4864b8-0x0;var _0xff9517=_0x55a8[_0x4864b8];return _0xff9517;};'use strict';var Sequelize=require(_0x855a('0x0'));module[_0x855a('0x1')]={'penalty':{'type':Sequelize[_0x855a('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 88a28ac..66e7988 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 _0x75e5=['bluebird','request-promise','path','rimraf','exports','util','moment'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x75e5,0x1be));var _0x575e=function(_0x31a9d1,_0x283ae9){_0x31a9d1=_0x31a9d1-0x0;var _0x127d8e=_0x75e5[_0x31a9d1];return _0x127d8e;};'use strict';var _=require('lodash');var util=require(_0x575e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x575e('0x1'));var BPromise=require(_0x575e('0x2'));var rp=require(_0x575e('0x3'));var fs=require('fs');var path=require(_0x575e('0x4'));var rimraf=require(_0x575e('0x5'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x575e('0x6')]=function(_0x50408e,_0x48955e){return _0x50408e['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6922=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6922,0x17f));var _0x2692=function(_0x34e149,_0x2a77c9){_0x34e149=_0x34e149-0x0;var _0x119a93=_0x6922[_0x34e149];return _0x119a93;};'use strict';var _=require(_0x2692('0x0'));var util=require(_0x2692('0x1'));var logger=require(_0x2692('0x2'))(_0x2692('0x3'));var moment=require(_0x2692('0x4'));var BPromise=require(_0x2692('0x5'));var rp=require(_0x2692('0x6'));var fs=require('fs');var path=require(_0x2692('0x7'));var rimraf=require(_0x2692('0x8'));var config=require(_0x2692('0x9'));var attributes=require(_0x2692('0xa'));module[_0x2692('0xb')]=function(_0x1103e0,_0x5ee060){return _0x1103e0[_0x2692('0xc')](_0x2692('0xd'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 44745c2..bc133d8 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x53dc94,_0xf90b6e){var _0x37102d=function(_0x5d890b){while(--_0x5d890b){_0x53dc94['push'](_0x53dc94['shift']());}};_0x37102d(++_0xf90b6e);}(_0xe14b,0x93));var _0xbe14=function(_0xde2e64,_0x46b3d6){_0xde2e64=_0xde2e64-0x0;var _0x20fef8=_0xe14b[_0xde2e64];return _0x20fef8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x469fdd,_0x437f23){var _0x3c68f4=function(_0x580d08){while(--_0x580d08){_0x469fdd['push'](_0x469fdd['shift']());}};_0x3c68f4(++_0x437f23);}(_0x55ca,0x126));var _0xa55c=function(_0x1b4bef,_0x5bb6be){_0x1b4bef=_0x1b4bef-0x0;var _0xf377eb=_0x55ca[_0x1b4bef];return _0xf377eb;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7d7b0db..2194941 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 _0x0230=['fs-extra','../../components/auth/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4571aa,_0x255a68){var _0xb0d14f=function(_0x25f35a){while(--_0x25f35a){_0x4571aa['push'](_0x4571aa['shift']());}};_0xb0d14f(++_0x255a68);}(_0x0230,0xb0));var _0x0023=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x0230[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x0023('0x0'));var util=require(_0x0023('0x1'));var path=require(_0x0023('0x2'));var timeout=require(_0x0023('0x3'));var express=require(_0x0023('0x4'));var router=express[_0x0023('0x5')]();var fs_extra=require(_0x0023('0x6'));var auth=require(_0x0023('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0023('0x8'));router[_0x0023('0x9')]('/',auth[_0x0023('0xa')](),controller[_0x0023('0xb')]);module[_0x0023('0xc')]=router; \ No newline at end of file +var _0x7b7a=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x39183f,_0x92ad86){var _0x2c5db7=function(_0x4fd711){while(--_0x4fd711){_0x39183f['push'](_0x39183f['shift']());}};_0x2c5db7(++_0x92ad86);}(_0x7b7a,0x8e));var _0xa7b7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7b7a[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xa7b7('0x0'));var util=require(_0xa7b7('0x1'));var path=require(_0xa7b7('0x2'));var timeout=require(_0xa7b7('0x3'));var express=require(_0xa7b7('0x4'));var router=express['Router']();var fs_extra=require(_0xa7b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7b7('0x6'));var config=require(_0xa7b7('0x7'));var controller=require(_0xa7b7('0x8'));router['post']('/',auth[_0xa7b7('0x9')](),controller[_0xa7b7('0xa')]);module[_0xa7b7('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 3d74796..0d84649 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 _0x2e17=['STRING','BOOLEAN','sequelize'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x2e17,0x80));var _0x72e1=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2e17[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x72e1('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x72e1('0x1')]},'beep':{'type':Sequelize[_0x72e1('0x2')]}}; \ No newline at end of file +var _0xcca3=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcca3,0x70));var _0x3cca=function(_0x19aee6,_0xcb2918){_0x19aee6=_0x19aee6-0x0;var _0x511975=_0xcca3[_0x19aee6];return _0x511975;};'use strict';var Sequelize=require(_0x3cca('0x0'));module[_0x3cca('0x1')]={'body':{'type':Sequelize[_0x3cca('0x2')]},'senderName':{'type':Sequelize[_0x3cca('0x3')]},'recipientsId':{'type':Sequelize[_0x3cca('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3cca('0x3')]},'beep':{'type':Sequelize[_0x3cca('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9ea68d9..258347c 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 _0xe520=['name','send','sendUserNotification','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','Sequelize','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','senderName','fullname','recipientsDescription','beep','SenderId','sortBy','join','transaction','UserNotification','forEach','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','push','all','getAgents','map','catch','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','then','sendStatus','stack'];(function(_0x9bb029,_0x58cba1){var _0x8d3193=function(_0xc050f7){while(--_0xc050f7){_0x9bb029['push'](_0x9bb029['shift']());}};_0x8d3193(++_0x58cba1);}(_0xe520,0x1b7));var _0x0e52=function(_0x13f6e2,_0x404dae){_0x13f6e2=_0x13f6e2-0x0;var _0x32f12f=_0xe520[_0x13f6e2];return _0x32f12f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e52('0x0'));var rp=require(_0x0e52('0x1'));var moment=require(_0x0e52('0x2'));var BPromise=require(_0x0e52('0x3'));var Mustache=require('mustache');var util=require(_0x0e52('0x4'));var path=require(_0x0e52('0x5'));var sox=require(_0x0e52('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e52('0x7'));var _=require(_0x0e52('0x8'));var squel=require(_0x0e52('0x9'));var crypto=require(_0x0e52('0xa'));var jsforce=require(_0x0e52('0xb'));var deskjs=require(_0x0e52('0xc'));var toCsv=require(_0x0e52('0xd'));var querystring=require(_0x0e52('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e52('0xf'));var qs=require(_0x0e52('0x10'));var as=require(_0x0e52('0x11'));var hardwareService=require(_0x0e52('0x12'));var logger=require('../../config/logger')(_0x0e52('0x13'));var utils=require(_0x0e52('0x14'));var config=require(_0x0e52('0x15'));var licenseUtil=require(_0x0e52('0x16'));var db=require(_0x0e52('0x17'))['db'];config['redis']=_[_0x0e52('0x18')](config[_0x0e52('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e52('0x1a'))(new Redis(config[_0x0e52('0x19')]));require('./userNotification.socket')[_0x0e52('0x1b')](socket);function respondWithStatusCode(_0x4cd267,_0x3c7b0d){_0x3c7b0d=_0x3c7b0d||0xcc;return function(_0x42fe63){if(_0x42fe63){return _0x4cd267['sendStatus'](_0x3c7b0d);}return _0x4cd267[_0x0e52('0x1c')](_0x3c7b0d)[_0x0e52('0x1d')]();};}function respondWithResult(_0x111feb,_0x29f23c){_0x29f23c=_0x29f23c||0xc8;return function(_0x4ed540){if(_0x4ed540){return _0x111feb[_0x0e52('0x1c')](_0x29f23c)[_0x0e52('0x1e')](_0x4ed540);}};}function respondWithFilteredResult(_0x2e95e3,_0x599503){return function(_0x3acfba){if(_0x3acfba){var _0x1813e8=typeof _0x599503[_0x0e52('0x1f')]===_0x0e52('0x20')&&typeof _0x599503[_0x0e52('0x21')]===_0x0e52('0x20');var _0x39bc94=_0x3acfba['count'];var _0x1fe5c7=_0x1813e8?0x0:_0x599503['offset'];var _0x213bef=_0x1813e8?_0x3acfba[_0x0e52('0x22')]:_0x599503['offset']+_0x599503[_0x0e52('0x21')];var _0x19bdbe;if(_0x213bef>=_0x39bc94){_0x213bef=_0x39bc94;_0x19bdbe=0xc8;}else{_0x19bdbe=0xce;}_0x2e95e3[_0x0e52('0x1c')](_0x19bdbe);return _0x2e95e3[_0x0e52('0x23')]('Content-Range',_0x1fe5c7+'-'+_0x213bef+'/'+_0x39bc94)[_0x0e52('0x1e')](_0x3acfba);}return null;};}function patchUpdates(_0x18cb2e){return function(_0x4cd4c3){try{jsonpatch[_0x0e52('0x24')](_0x4cd4c3,_0x18cb2e,!![]);}catch(_0x320978){return BPromise[_0x0e52('0x25')](_0x320978);}return _0x4cd4c3['save']();};}function saveUpdates(_0x13edaf,_0xa237e3){return function(_0x44fe18){if(_0x44fe18){return _0x44fe18['update'](_0x13edaf)[_0x0e52('0x26')](function(_0x5430c0){return _0x5430c0;});}return null;};}function removeEntity(_0x22fb43,_0x2527c8){return function(_0x1aa16c){if(_0x1aa16c){return _0x1aa16c['destroy']()[_0x0e52('0x26')](function(){_0x22fb43[_0x0e52('0x1c')](0xcc)[_0x0e52('0x1d')]();});}};}function handleEntityNotFound(_0x457ae3,_0x24385f){return function(_0x5b588b){if(!_0x5b588b){_0x457ae3[_0x0e52('0x27')](0x194);}return _0x5b588b;};}function handleError(_0x319efb,_0x452e60){_0x452e60=_0x452e60||0x1f4;return function(_0x3ca4cb){logger['error'](_0x3ca4cb[_0x0e52('0x28')]);if(_0x3ca4cb[_0x0e52('0x29')]){delete _0x3ca4cb[_0x0e52('0x29')];}_0x319efb[_0x0e52('0x1c')](_0x452e60)[_0x0e52('0x2a')](_0x3ca4cb);};}exports[_0x0e52('0x2b')]=function(_0x50ea1f,_0x4bb040,_0x4dcf96){if(!_0x50ea1f['body'][_0x0e52('0x2c')]('text')&&!_0x50ea1f['body'][_0x0e52('0x2c')](_0x0e52('0x2d'))){throw new db['Sequelize'][(_0x0e52('0x2e'))](_0x0e52('0x2f'));}else{if(_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x2c')](_0x0e52('0x2d'))&&!_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x2c')](_0x0e52('0x31'))){throw new db['Sequelize'][(_0x0e52('0x2e'))](_0x0e52('0x32'));}if(!_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x2c')]('recipients')){throw new db[(_0x0e52('0x33'))][(_0x0e52('0x2e'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5a3a39=JSON[_0x0e52('0x34')](_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x35')]);}catch(_0x43b768){logger[_0x0e52('0x36')](_0x43b768);throw new db[(_0x0e52('0x33'))]['ValidationError'](_0x0e52('0x37'));}var _0x138271=[_0x0e52('0x38'),'faxqueue',_0x0e52('0x39'),_0x0e52('0x3a'),_0x0e52('0x3b'),_0x0e52('0x3c'),_0x0e52('0x3d'),_0x0e52('0x3e'),_0x0e52('0x3f')];if(_['some'](_0x5a3a39,function(_0x3a431d){return!_[_0x0e52('0x40')](_0x138271,_0x3a431d[_0x0e52('0x41')][_0x0e52('0x42')]());})){throw new db[(_0x0e52('0x33'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x535620={};_0x535620[_0x0e52('0x43')]=_0x50ea1f[_0x0e52('0x30')]['hasOwnProperty'](_0x0e52('0x43'))?_0x50ea1f['body'][_0x0e52('0x43')]:_0x50ea1f['user'][_0x0e52('0x44')];_0x535620['recipientsDescription']=_['isEmpty'](_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x45')])?null:_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x45')];_0x535620[_0x0e52('0x46')]=_0x50ea1f[_0x0e52('0x30')][_0x0e52('0x46')]||![];_0x535620[_0x0e52('0x47')]=_0x50ea1f[_0x0e52('0x3f')]['id'];return getContent(_0x50ea1f[_0x0e52('0x30')])[_0x0e52('0x26')](function(_0x139669){_0x535620[_0x0e52('0x30')]=_0x139669;return getRecipients(_0x5a3a39);})['then'](function(_0x394caa){_0x535620['recipientsId']=_[_0x0e52('0x48')](_0x394caa)[_0x0e52('0x49')](',');return db['sequelize'][_0x0e52('0x4a')](function(_0x2a49c7){return db[_0x0e52('0x4b')]['create'](_0x535620,{'raw':!![],'transaction':_0x2a49c7})[_0x0e52('0x26')](function(_0x173f58){var _0x37cf90={'sender':_0x535620[_0x0e52('0x43')],'description':_0x535620[_0x0e52('0x45')],'content':_0x535620[_0x0e52('0x30')],'beep':_0x535620[_0x0e52('0x46')]};_0x394caa[_0x0e52('0x4c')](function(_0x4a69a7){_0x37cf90['recipient']=_0x4a69a7;socket[_0x0e52('0x4d')](_0x0e52('0x4e'),_0x37cf90);});return _0x173f58;});});})[_0x0e52('0x26')](respondWithResult(_0x4bb040,0xc9))['catch'](handleError(_0x4bb040,null));};function getContent(_0x4654e6){return new BPromise(function(_0x53b5ef,_0x2116c4){if(_0x4654e6[_0x0e52('0x4f')]){_0x53b5ef(_0x4654e6[_0x0e52('0x4f')]);return;}return db[_0x0e52('0x50')][_0x0e52('0x51')]({'attributes':[_0x0e52('0x52')],'where':{'id':_0x4654e6[_0x0e52('0x2d')]},'raw':!![]})['then'](function(_0x50741c){if(!_0x50741c)throw new db[(_0x0e52('0x33'))][(_0x0e52('0x2e'))](_0x0e52('0x53'));var _0x408e20=Mustache[_0x0e52('0x54')](_0x50741c[_0x0e52('0x52')],_0x4654e6[_0x0e52('0x31')]);_0x53b5ef(_0x408e20);})['catch'](function(_0x26c50a){_0x2116c4(_0x26c50a);});});}function getRecipients(_0x3d9df0){return new BPromise(function(_0x3ebf7f,_0x202dcf){var _0x5b7c5e=[];var _0x122de5=[];_0x3d9df0['forEach'](function(_0x4a0534){var _0x193d75=_[_0x0e52('0x55')](_0x4a0534[_0x0e52('0x41')][_0x0e52('0x42')]());if(_0x193d75===_0x0e52('0x56')){_0x5b7c5e=_[_0x0e52('0x57')](_0x5b7c5e,_0x4a0534[_0x0e52('0x58')]);}else{if(_['includes'](_0x193d75,_0x0e52('0x59')))_0x193d75=_0x193d75[_0x0e52('0x5a')](_0x0e52('0x59'),'Queue');_0x4a0534['ids']['forEach'](function(_0x56f444){_0x122de5[_0x0e52('0x5b')](getAgents(_0x193d75,_0x56f444));});}});return BPromise[_0x0e52('0x5c')](_0x122de5)[_0x0e52('0x26')](function(_0x3cf514){_0x5b7c5e=_[_0x0e52('0x57')](_0x5b7c5e,_['flatten'](_0x3cf514));_0x3ebf7f(_0x5b7c5e);})['catch'](function(_0x50e0b7){_0x202dcf(_0x50e0b7);});});}function getAgents(_0x43efe6,_0x10fd37){return new BPromise(function(_0xdacbd8,_0x15d19f){return db[_0x43efe6][_0x0e52('0x51')]({'where':{'id':_0x10fd37}})[_0x0e52('0x26')](function(_0x5b2e44){return _0x5b2e44[_0x0e52('0x5d')]({'attributes':['id'],'raw':!![]})[_0x0e52('0x26')](function(_0x36984c){var _0x3bea6=_[_0x0e52('0x5e')](_0x36984c,'id');_0xdacbd8(_0x3bea6);});})[_0x0e52('0x5f')](function(_0x2b555f){_0x15d19f(_0x2b555f);});});} \ No newline at end of file +var _0x10e6=['json','apply','reject','save','update','then','destroy','error','name','send','sendUserNotification','hasOwnProperty','text','Sequelize','body','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','html','render','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','catch','findOne','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','../../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','./userNotification.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range'];(function(_0x5b3269,_0x4182b2){var _0x288b03=function(_0x158144){while(--_0x158144){_0x5b3269['push'](_0x5b3269['shift']());}};_0x288b03(++_0x4182b2);}(_0x10e6,0x16f));var _0x610e=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x10e6[_0xa9a245];return _0x2d0eaa;};'use strict';var emlformat=require(_0x610e('0x0'));var rimraf=require(_0x610e('0x1'));var zipdir=require(_0x610e('0x2'));var jsonpatch=require(_0x610e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x610e('0x4'));var Mustache=require('mustache');var util=require(_0x610e('0x5'));var path=require(_0x610e('0x6'));var sox=require('sox');var csv=require(_0x610e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x610e('0x8'));var _=require('lodash');var squel=require(_0x610e('0x9'));var crypto=require(_0x610e('0xa'));var jsforce=require(_0x610e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x610e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x610e('0xd'));var qs=require(_0x610e('0xe'));var as=require(_0x610e('0xf'));var hardwareService=require(_0x610e('0x10'));var logger=require(_0x610e('0x11'))(_0x610e('0x12'));var utils=require(_0x610e('0x13'));var config=require(_0x610e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x610e('0x15'))['db'];config['redis']=_[_0x610e('0x16')](config[_0x610e('0x17')],{'host':_0x610e('0x18'),'port':0x18eb});var socket=require(_0x610e('0x19'))(new Redis(config[_0x610e('0x17')]));require(_0x610e('0x1a'))[_0x610e('0x1b')](socket);function respondWithStatusCode(_0xbb0283,_0x499757){_0x499757=_0x499757||0xcc;return function(_0x5ebedf){if(_0x5ebedf){return _0xbb0283[_0x610e('0x1c')](_0x499757);}return _0xbb0283[_0x610e('0x1d')](_0x499757)[_0x610e('0x1e')]();};}function respondWithResult(_0x42ca88,_0x4df0f2){_0x4df0f2=_0x4df0f2||0xc8;return function(_0x3347c0){if(_0x3347c0){return _0x42ca88[_0x610e('0x1d')](_0x4df0f2)['json'](_0x3347c0);}};}function respondWithFilteredResult(_0x1aa8da,_0x441678){return function(_0x5eab8c){if(_0x5eab8c){var _0x178c64=typeof _0x441678[_0x610e('0x1f')]==='undefined'&&typeof _0x441678[_0x610e('0x20')]===_0x610e('0x21');var _0x15fee1=_0x5eab8c[_0x610e('0x22')];var _0x31902d=_0x178c64?0x0:_0x441678[_0x610e('0x1f')];var _0x23720c=_0x178c64?_0x5eab8c[_0x610e('0x22')]:_0x441678[_0x610e('0x1f')]+_0x441678['limit'];var _0x17512a;if(_0x23720c>=_0x15fee1){_0x23720c=_0x15fee1;_0x17512a=0xc8;}else{_0x17512a=0xce;}_0x1aa8da[_0x610e('0x1d')](_0x17512a);return _0x1aa8da[_0x610e('0x23')](_0x610e('0x24'),_0x31902d+'-'+_0x23720c+'/'+_0x15fee1)[_0x610e('0x25')](_0x5eab8c);}return null;};}function patchUpdates(_0x58e5de){return function(_0x475f0e){try{jsonpatch[_0x610e('0x26')](_0x475f0e,_0x58e5de,!![]);}catch(_0x2f0635){return BPromise[_0x610e('0x27')](_0x2f0635);}return _0x475f0e[_0x610e('0x28')]();};}function saveUpdates(_0x577c20,_0x33620e){return function(_0x3c8818){if(_0x3c8818){return _0x3c8818[_0x610e('0x29')](_0x577c20)[_0x610e('0x2a')](function(_0x45ec0f){return _0x45ec0f;});}return null;};}function removeEntity(_0x251d5a,_0x572620){return function(_0x3bfbbc){if(_0x3bfbbc){return _0x3bfbbc[_0x610e('0x2b')]()[_0x610e('0x2a')](function(){_0x251d5a[_0x610e('0x1d')](0xcc)[_0x610e('0x1e')]();});}};}function handleEntityNotFound(_0x24816a,_0x457327){return function(_0x45ead8){if(!_0x45ead8){_0x24816a['sendStatus'](0x194);}return _0x45ead8;};}function handleError(_0x184fc3,_0x358941){_0x358941=_0x358941||0x1f4;return function(_0x4174dd){logger[_0x610e('0x2c')](_0x4174dd['stack']);if(_0x4174dd['name']){delete _0x4174dd[_0x610e('0x2d')];}_0x184fc3[_0x610e('0x1d')](_0x358941)[_0x610e('0x2e')](_0x4174dd);};}exports[_0x610e('0x2f')]=function(_0x3ca361,_0x54156b,_0x567e00){if(!_0x3ca361['body'][_0x610e('0x30')](_0x610e('0x31'))&&!_0x3ca361['body']['hasOwnProperty']('TemplateId')){throw new db[(_0x610e('0x32'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3ca361[_0x610e('0x33')][_0x610e('0x30')]('TemplateId')&&!_0x3ca361[_0x610e('0x33')]['hasOwnProperty'](_0x610e('0x34'))){throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))](_0x610e('0x36'));}if(!_0x3ca361['body'][_0x610e('0x30')](_0x610e('0x37'))){throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))](_0x610e('0x38'));}else{try{var _0x1f2e63=JSON[_0x610e('0x39')](_0x3ca361[_0x610e('0x33')][_0x610e('0x37')]);}catch(_0x36da33){logger[_0x610e('0x2c')](_0x36da33);throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))](_0x610e('0x3a'));}var _0x19fae0=[_0x610e('0x3b'),_0x610e('0x3c'),_0x610e('0x3d'),_0x610e('0x3e'),_0x610e('0x3f'),_0x610e('0x40'),_0x610e('0x41'),'team','user'];if(_['some'](_0x1f2e63,function(_0x32bc48){return!_['includes'](_0x19fae0,_0x32bc48[_0x610e('0x42')][_0x610e('0x43')]());})){throw new db[(_0x610e('0x32'))]['ValidationError'](_0x610e('0x44'));}}}var _0x294dcd={};_0x294dcd[_0x610e('0x45')]=_0x3ca361[_0x610e('0x33')][_0x610e('0x30')](_0x610e('0x45'))?_0x3ca361[_0x610e('0x33')][_0x610e('0x45')]:_0x3ca361[_0x610e('0x46')][_0x610e('0x47')];_0x294dcd[_0x610e('0x48')]=_[_0x610e('0x49')](_0x3ca361[_0x610e('0x33')][_0x610e('0x48')])?null:_0x3ca361['body']['recipientsDescription'];_0x294dcd[_0x610e('0x4a')]=_0x3ca361['body'][_0x610e('0x4a')]||![];_0x294dcd['SenderId']=_0x3ca361[_0x610e('0x46')]['id'];return getContent(_0x3ca361[_0x610e('0x33')])[_0x610e('0x2a')](function(_0x235e91){_0x294dcd[_0x610e('0x33')]=_0x235e91;return getRecipients(_0x1f2e63);})[_0x610e('0x2a')](function(_0x5386f3){_0x294dcd[_0x610e('0x4b')]=_[_0x610e('0x4c')](_0x5386f3)[_0x610e('0x4d')](',');return db[_0x610e('0x4e')][_0x610e('0x4f')](function(_0x44ea4a){return db['UserNotification'][_0x610e('0x50')](_0x294dcd,{'raw':!![],'transaction':_0x44ea4a})['then'](function(_0x4bbe6b){var _0x49df86={'sender':_0x294dcd[_0x610e('0x45')],'description':_0x294dcd[_0x610e('0x48')],'content':_0x294dcd['body'],'beep':_0x294dcd[_0x610e('0x4a')]};_0x5386f3[_0x610e('0x51')](function(_0x5b8843){_0x49df86[_0x610e('0x52')]=_0x5b8843;socket[_0x610e('0x53')](_0x610e('0x54'),_0x49df86);});return _0x4bbe6b;});});})[_0x610e('0x2a')](respondWithResult(_0x54156b,0xc9))['catch'](handleError(_0x54156b,null));};function getContent(_0x3d1927){return new BPromise(function(_0x140ad4,_0x357b94){if(_0x3d1927[_0x610e('0x31')]){_0x140ad4(_0x3d1927[_0x610e('0x31')]);return;}return db['Template']['findOne']({'attributes':[_0x610e('0x55')],'where':{'id':_0x3d1927['TemplateId']},'raw':!![]})[_0x610e('0x2a')](function(_0x3281c2){if(!_0x3281c2)throw new db[(_0x610e('0x32'))][(_0x610e('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xdfedfb=Mustache[_0x610e('0x56')](_0x3281c2['html'],_0x3d1927[_0x610e('0x34')]);_0x140ad4(_0xdfedfb);})['catch'](function(_0x54130){_0x357b94(_0x54130);});});}function getRecipients(_0x3a4ac6){return new BPromise(function(_0x55548c,_0x174f2e){var _0xb1d0e0=[];var _0x336d19=[];_0x3a4ac6[_0x610e('0x51')](function(_0x452dc6){var _0x18cbd9=_[_0x610e('0x57')](_0x452dc6['model'][_0x610e('0x43')]());if(_0x18cbd9===_0x610e('0x58')){_0xb1d0e0=_[_0x610e('0x59')](_0xb1d0e0,_0x452dc6[_0x610e('0x5a')]);}else{if(_['includes'](_0x18cbd9,_0x610e('0x5b')))_0x18cbd9=_0x18cbd9[_0x610e('0x5c')](_0x610e('0x5b'),_0x610e('0x5d'));_0x452dc6[_0x610e('0x5a')]['forEach'](function(_0x5d1bf2){_0x336d19[_0x610e('0x5e')](getAgents(_0x18cbd9,_0x5d1bf2));});}});return BPromise[_0x610e('0x5f')](_0x336d19)[_0x610e('0x2a')](function(_0x2d2cdb){_0xb1d0e0=_[_0x610e('0x59')](_0xb1d0e0,_[_0x610e('0x60')](_0x2d2cdb));_0x55548c(_0xb1d0e0);})[_0x610e('0x61')](function(_0x1d53ae){_0x174f2e(_0x1d53ae);});});}function getAgents(_0x1c31b8,_0x45639a){return new BPromise(function(_0x4d9f9d,_0x16358c){return db[_0x1c31b8][_0x610e('0x62')]({'where':{'id':_0x45639a}})[_0x610e('0x2a')](function(_0x125bbb){return _0x125bbb[_0x610e('0x63')]({'attributes':['id'],'raw':!![]})[_0x610e('0x2a')](function(_0x199ddf){var _0xf31060=_[_0x610e('0x64')](_0x199ddf,'id');_0x4d9f9d(_0xf31060);});})[_0x610e('0x61')](function(_0x5cd310){_0x16358c(_0x5cd310);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index c64e98c..e134d1b 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 _0x3363=['exports','events','../../mysqldb','UserNotification','update','remove','hasOwnProperty','hook'];(function(_0x20d0da,_0x388969){var _0x37c3a9=function(_0x985aa3){while(--_0x985aa3){_0x20d0da['push'](_0x20d0da['shift']());}};_0x37c3a9(++_0x388969);}(_0x3363,0x1d1));var _0x3336=function(_0x160a9c,_0x2768f3){_0x160a9c=_0x160a9c-0x0;var _0x522484=_0x3363[_0x160a9c];return _0x522484;};'use strict';var EventEmitter=require(_0x3336('0x0'));var UserNotification=require(_0x3336('0x1'))['db'][_0x3336('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3336('0x3'),'afterDestroy':_0x3336('0x4')};function emitEvent(_0xfa7da9){return function(_0x5c0091,_0x47da69,_0x7933ed){UserNotificationEvents['emit'](_0xfa7da9+':'+_0x5c0091['id'],_0x5c0091);UserNotificationEvents['emit'](_0xfa7da9,_0x5c0091);_0x7933ed(null);};}for(var e in events){if(events[_0x3336('0x5')](e)){var event=events[e];UserNotification[_0x3336('0x6')](e,emitEvent(event));}}module[_0x3336('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xab6a=['remove','emit','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0xb9eba0,_0x2e153e){var _0x292f31=function(_0x1748b2){while(--_0x1748b2){_0xb9eba0['push'](_0xb9eba0['shift']());}};_0x292f31(++_0x2e153e);}(_0xab6a,0x17d));var _0xaab6=function(_0x5daa41,_0x5c05bd){_0x5daa41=_0x5daa41-0x0;var _0x1fb9be=_0xab6a[_0x5daa41];return _0x1fb9be;};'use strict';var EventEmitter=require(_0xaab6('0x0'));var UserNotification=require(_0xaab6('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaab6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaab6('0x3'),'afterDestroy':_0xaab6('0x4')};function emitEvent(_0xf1f583){return function(_0x5cca05,_0x19bf6c,_0x207b9e){UserNotificationEvents['emit'](_0xf1f583+':'+_0x5cca05['id'],_0x5cca05);UserNotificationEvents[_0xaab6('0x5')](_0xf1f583,_0x5cca05);_0x207b9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xaab6('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index dac1c3d..7097b42 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 _0xf0f9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications'];(function(_0x1eff96,_0x56e0b3){var _0x5c40e0=function(_0x2b9e06){while(--_0x2b9e06){_0x1eff96['push'](_0x1eff96['shift']());}};_0x5c40e0(++_0x56e0b3);}(_0xf0f9,0x1c4));var _0x9f0f=function(_0x419435,_0x1ec68c){_0x419435=_0x419435-0x0;var _0x18bdaa=_0xf0f9[_0x419435];return _0x18bdaa;};'use strict';var _=require(_0x9f0f('0x0'));var util=require(_0x9f0f('0x1'));var logger=require('../../config/logger')(_0x9f0f('0x2'));var moment=require(_0x9f0f('0x3'));var BPromise=require(_0x9f0f('0x4'));var rp=require(_0x9f0f('0x5'));var fs=require('fs');var path=require(_0x9f0f('0x6'));var rimraf=require(_0x9f0f('0x7'));var config=require(_0x9f0f('0x8'));var attributes=require(_0x9f0f('0x9'));module[_0x9f0f('0xa')]=function(_0x389b28,_0x18dfc9){return _0x389b28['define'](_0x9f0f('0xb'),attributes,{'tableName':_0x9f0f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f0f('0xd'),'collate':_0x9f0f('0xe')});}; \ No newline at end of file +var _0xf105=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x303053,_0x1ba7e1){var _0x28a09f=function(_0x4d5e10){while(--_0x4d5e10){_0x303053['push'](_0x303053['shift']());}};_0x28a09f(++_0x1ba7e1);}(_0xf105,0x134));var _0x5f10=function(_0x3fa2a9,_0x4582cf){_0x3fa2a9=_0x3fa2a9-0x0;var _0x43dabf=_0xf105[_0x3fa2a9];return _0x43dabf;};'use strict';var _=require(_0x5f10('0x0'));var util=require('util');var logger=require(_0x5f10('0x1'))(_0x5f10('0x2'));var moment=require(_0x5f10('0x3'));var BPromise=require(_0x5f10('0x4'));var rp=require(_0x5f10('0x5'));var fs=require('fs');var path=require(_0x5f10('0x6'));var rimraf=require(_0x5f10('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f10('0x8'));module[_0x5f10('0x9')]=function(_0x1b646b,_0x6b632){return _0x1b646b[_0x5f10('0xa')](_0x5f10('0xb'),attributes,{'tableName':_0x5f10('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f10('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 98a8c41..6813936 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 _0x60d5=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register'];(function(_0x284d33,_0x5b003f){var _0x225cf8=function(_0xe512c4){while(--_0xe512c4){_0x284d33['push'](_0x284d33['shift']());}};_0x225cf8(++_0x5b003f);}(_0x60d5,0x123));var _0x560d=function(_0x339bb4,_0x573f12){_0x339bb4=_0x339bb4-0x0;var _0x15b2c2=_0x60d5[_0x339bb4];return _0x15b2c2;};'use strict';var _=require(_0x560d('0x0'));var util=require(_0x560d('0x1'));var moment=require(_0x560d('0x2'));var BPromise=require(_0x560d('0x3'));var rs=require(_0x560d('0x4'));var fs=require('fs');var Redis=require(_0x560d('0x5'));var db=require(_0x560d('0x6'))['db'];var utils=require(_0x560d('0x7'));var logger=require('../../config/logger')(_0x560d('0x8'));var config=require(_0x560d('0x9'));var jayson=require(_0x560d('0xa'));var client=jayson['client'][_0x560d('0xb')]({'port':0x232a});config[_0x560d('0xc')]=_[_0x560d('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x560d('0xe'))(new Redis(config['redis']));require(_0x560d('0xf'))[_0x560d('0x10')](socket);function respondWithRpcPromise(_0x5e3986,_0x4210fb,_0x5a915b){return new BPromise(function(_0x1849e7,_0x3ed8c6){return client['request'](_0x5e3986,_0x5a915b)[_0x560d('0x11')](function(_0x4b1f2a){logger[_0x560d('0x12')](_0x560d('0x13'),_0x4210fb,_0x560d('0x14'));logger[_0x560d('0x15')](_0x560d('0x16'),_0x4210fb,_0x560d('0x14'),JSON[_0x560d('0x17')](_0x4b1f2a));if(_0x4b1f2a[_0x560d('0x18')]){if(_0x4b1f2a[_0x560d('0x18')]['code']===0x1f4){logger[_0x560d('0x18')](_0x560d('0x13'),_0x4210fb,_0x4b1f2a[_0x560d('0x18')]['message']);return _0x3ed8c6(_0x4b1f2a[_0x560d('0x18')][_0x560d('0x19')]);}logger[_0x560d('0x18')]('UserNotification,\x20%s,\x20%s',_0x4210fb,_0x4b1f2a[_0x560d('0x18')][_0x560d('0x19')]);return _0x1849e7(_0x4b1f2a[_0x560d('0x18')][_0x560d('0x19')]);}else{logger[_0x560d('0x12')]('UserNotification,\x20%s,\x20%s',_0x4210fb,'request\x20sent');_0x1849e7(_0x4b1f2a[_0x560d('0x1a')][_0x560d('0x19')]);}})[_0x560d('0x1b')](function(_0x4b6df5){logger['error'](_0x560d('0x13'),_0x4210fb,_0x4b6df5);_0x3ed8c6(_0x4b6df5);});});} \ No newline at end of file +var _0x4a96=['../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a4682,_0x24368b){var _0x94925d=function(_0x1cb7af){while(--_0x1cb7af){_0x2a4682['push'](_0x2a4682['shift']());}};_0x94925d(++_0x24368b);}(_0x4a96,0x1b8));var _0x64a9=function(_0xe44580,_0x389b2c){_0xe44580=_0xe44580-0x0;var _0x24880d=_0x4a96[_0xe44580];return _0x24880d;};'use strict';var _=require(_0x64a9('0x0'));var util=require(_0x64a9('0x1'));var moment=require(_0x64a9('0x2'));var BPromise=require(_0x64a9('0x3'));var rs=require(_0x64a9('0x4'));var fs=require('fs');var Redis=require(_0x64a9('0x5'));var db=require(_0x64a9('0x6'))['db'];var utils=require(_0x64a9('0x7'));var logger=require(_0x64a9('0x8'))(_0x64a9('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64a9('0xa')][_0x64a9('0xb')]({'port':0x232a});config['redis']=_[_0x64a9('0xc')](config[_0x64a9('0xd')],{'host':_0x64a9('0xe'),'port':0x18eb});var socket=require(_0x64a9('0xf'))(new Redis(config['redis']));require(_0x64a9('0x10'))[_0x64a9('0x11')](socket);function respondWithRpcPromise(_0x244160,_0x5b6a47,_0x4c5aa9){return new BPromise(function(_0x58bf2b,_0x56cfdf){return client[_0x64a9('0x12')](_0x244160,_0x4c5aa9)['then'](function(_0x48a820){logger['info'](_0x64a9('0x13'),_0x5b6a47,'request\x20sent');logger[_0x64a9('0x14')](_0x64a9('0x15'),_0x5b6a47,_0x64a9('0x16'),JSON[_0x64a9('0x17')](_0x48a820));if(_0x48a820[_0x64a9('0x18')]){if(_0x48a820[_0x64a9('0x18')]['code']===0x1f4){logger[_0x64a9('0x18')](_0x64a9('0x13'),_0x5b6a47,_0x48a820['error'][_0x64a9('0x19')]);return _0x56cfdf(_0x48a820[_0x64a9('0x18')]['message']);}logger[_0x64a9('0x18')](_0x64a9('0x13'),_0x5b6a47,_0x48a820['error'][_0x64a9('0x19')]);return _0x58bf2b(_0x48a820[_0x64a9('0x18')][_0x64a9('0x19')]);}else{logger[_0x64a9('0x1a')](_0x64a9('0x13'),_0x5b6a47,_0x64a9('0x16'));_0x58bf2b(_0x48a820['result']['message']);}})[_0x64a9('0x1b')](function(_0x2816e3){logger[_0x64a9('0x18')](_0x64a9('0x13'),_0x5b6a47,_0x2816e3);_0x56cfdf(_0x2816e3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f0539ce..7e53aa3 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 _0x3a25=['emit','removeListener','register','./userNotification.events','save','remove','update'];(function(_0x513a56,_0x2b2a73){var _0x220be6=function(_0x35c0f7){while(--_0x35c0f7){_0x513a56['push'](_0x513a56['shift']());}};_0x220be6(++_0x2b2a73);}(_0x3a25,0x106));var _0x53a2=function(_0x56b3b5,_0xf3ba39){_0x56b3b5=_0x56b3b5-0x0;var _0x10f345=_0x3a25[_0x56b3b5];return _0x10f345;};'use strict';var UserNotificationEvents=require(_0x53a2('0x0'));var events=[_0x53a2('0x1'),_0x53a2('0x2'),_0x53a2('0x3')];function createListener(_0x156752,_0x1287a9){return function(_0x598ae7){_0x1287a9[_0x53a2('0x4')](_0x156752,_0x598ae7);};}function removeListener(_0x19664d,_0x17e903){return function(){UserNotificationEvents[_0x53a2('0x5')](_0x19664d,_0x17e903);};}exports[_0x53a2('0x6')]=function(_0x2ce114){for(var _0x82f072=0x0,_0x361a30=events['length'];_0x82f072<_0x361a30;_0x82f072++){var _0x3a178e=events[_0x82f072];var _0x243e17=createListener('userNotification:'+_0x3a178e,_0x2ce114);UserNotificationEvents['on'](_0x3a178e,_0x243e17);}}; \ No newline at end of file +var _0x707f=['register','length','userNotification:','update','removeListener'];(function(_0x291ec3,_0x2f19a7){var _0x423b99=function(_0x345ddd){while(--_0x345ddd){_0x291ec3['push'](_0x291ec3['shift']());}};_0x423b99(++_0x2f19a7);}(_0x707f,0x80));var _0xf707=function(_0x530b7d,_0x597fa9){_0x530b7d=_0x530b7d-0x0;var _0x151e6a=_0x707f[_0x530b7d];return _0x151e6a;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0xf707('0x0')];function createListener(_0x3c12d7,_0x4e83e9){return function(_0x1d8151){_0x4e83e9['emit'](_0x3c12d7,_0x1d8151);};}function removeListener(_0x56b4e5,_0x5c6d0f){return function(){UserNotificationEvents[_0xf707('0x1')](_0x56b4e5,_0x5c6d0f);};}exports[_0xf707('0x2')]=function(_0x55e28d){for(var _0x540b6c=0x0,_0x5b1d35=events[_0xf707('0x3')];_0x540b6c<_0x5b1d35;_0x540b6c++){var _0x2a1b32=events[_0x540b6c];var _0x3de327=createListener(_0xf707('0x4')+_0x2a1b32,_0x55e28d);UserNotificationEvents['on'](_0x2a1b32,_0x3de327);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d4589ed..c13fa2b 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x511dc4,_0xee4397){var _0x28fc9d=function(_0x3137e6){while(--_0x3137e6){_0x511dc4['push'](_0x511dc4['shift']());}};_0x28fc9d(++_0xee4397);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xcb91[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a9d97,_0x38912c){var _0x215a25=function(_0x53e624){while(--_0x53e624){_0x1a9d97['push'](_0x1a9d97['shift']());}};_0x215a25(++_0x38912c);}(_0xe706,0xa3));var _0x6e70=function(_0x25b068,_0xb6ac60){_0x25b068=_0x25b068-0x0;var _0xb9f40f=_0xe706[_0x25b068];return _0xb9f40f;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index acdb3a0..c76c633 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 _0x15ce=['exports'];(function(_0x4d281f,_0x55e16f){var _0xd9b390=function(_0x53d5e9){while(--_0x53d5e9){_0x4d281f['push'](_0x4d281f['shift']());}};_0xd9b390(++_0x55e16f);}(_0x15ce,0x186));var _0xe15c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x15ce[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xe15c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaede=['exports','INTEGER','sequelize'];(function(_0x35348b,_0x48df3d){var _0x7f918=function(_0x42968d){while(--_0x42968d){_0x35348b['push'](_0x35348b['shift']());}};_0x7f918(++_0x48df3d);}(_0xaede,0x11c));var _0xeaed=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xaede[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xeaed('0x0'));module[_0xeaed('0x1')]={'penalty':{'type':Sequelize[_0xeaed('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 08af12a..e16c46f 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 _0x5906=['bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api'];(function(_0x111812,_0x41757c){var _0x1e2943=function(_0xef958d){while(--_0xef958d){_0x111812['push'](_0x111812['shift']());}};_0x1e2943(++_0x41757c);}(_0x5906,0xf0));var _0x6590=function(_0xa497e9,_0x212955){_0xa497e9=_0xa497e9-0x0;var _0x7faf63=_0x5906[_0xa497e9];return _0x7faf63;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6590('0x0'))(_0x6590('0x1'));var moment=require('moment');var BPromise=require(_0x6590('0x2'));var rp=require(_0x6590('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6590('0x4'));var config=require(_0x6590('0x5'));var attributes=require(_0x6590('0x6'));module[_0x6590('0x7')]=function(_0x49667c,_0x3368c1){return _0x49667c[_0x6590('0x8')](_0x6590('0x9'),attributes,{'tableName':_0x6590('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99db=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','UserOpenchannelQueue'];(function(_0x2c87b2,_0x547e3f){var _0x59edb0=function(_0xa070fa){while(--_0xa070fa){_0x2c87b2['push'](_0x2c87b2['shift']());}};_0x59edb0(++_0x547e3f);}(_0x99db,0xa5));var _0xb99d=function(_0x13639d,_0x3c996b){_0x13639d=_0x13639d-0x0;var _0x52ef14=_0x99db[_0x13639d];return _0x52ef14;};'use strict';var _=require(_0xb99d('0x0'));var util=require(_0xb99d('0x1'));var logger=require(_0xb99d('0x2'))(_0xb99d('0x3'));var moment=require(_0xb99d('0x4'));var BPromise=require(_0xb99d('0x5'));var rp=require(_0xb99d('0x6'));var fs=require('fs');var path=require(_0xb99d('0x7'));var rimraf=require(_0xb99d('0x8'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x51a6e4,_0x151a46){return _0x51a6e4[_0xb99d('0x9')](_0xb99d('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index fa9477a..17e34dc 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 _0xa29e=['info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa29e,0x18b));var _0xea29=function(_0xcbff5,_0x50eb75){_0xcbff5=_0xcbff5-0x0;var _0x13a00a=_0xa29e[_0xcbff5];return _0x13a00a;};'use strict';var _=require(_0xea29('0x0'));var util=require('util');var moment=require(_0xea29('0x1'));var BPromise=require(_0xea29('0x2'));var rs=require(_0xea29('0x3'));var fs=require('fs');var Redis=require(_0xea29('0x4'));var db=require(_0xea29('0x5'))['db'];var utils=require(_0xea29('0x6'));var logger=require(_0xea29('0x7'))(_0xea29('0x8'));var config=require(_0xea29('0x9'));var jayson=require(_0xea29('0xa'));var client=jayson['client'][_0xea29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58574f,_0x12e489,_0x30bcb6){return new BPromise(function(_0xab92b5,_0x5e55f4){return client['request'](_0x58574f,_0x30bcb6)[_0xea29('0xc')](function(_0x4f0502){logger[_0xea29('0xd')](_0xea29('0xe'),_0x12e489,'request\x20sent');logger[_0xea29('0xf')](_0xea29('0x10'),_0x12e489,'request\x20sent',JSON[_0xea29('0x11')](_0x4f0502));if(_0x4f0502[_0xea29('0x12')]){if(_0x4f0502['error'][_0xea29('0x13')]===0x1f4){logger[_0xea29('0x12')](_0xea29('0xe'),_0x12e489,_0x4f0502['error']['message']);return _0x5e55f4(_0x4f0502[_0xea29('0x12')]['message']);}logger['error'](_0xea29('0xe'),_0x12e489,_0x4f0502[_0xea29('0x12')][_0xea29('0x14')]);return _0xab92b5(_0x4f0502[_0xea29('0x12')][_0xea29('0x14')]);}else{logger['info'](_0xea29('0xe'),_0x12e489,_0xea29('0x15'));_0xab92b5(_0x4f0502[_0xea29('0x16')][_0xea29('0x14')]);}})[_0xea29('0x17')](function(_0x1456c0){logger[_0xea29('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x12e489,_0x1456c0);_0x5e55f4(_0x1456c0);});});} \ No newline at end of file +var _0x996e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x37f8ac,_0x319ba1){var _0x78418f=function(_0x4551e9){while(--_0x4551e9){_0x37f8ac['push'](_0x37f8ac['shift']());}};_0x78418f(++_0x319ba1);}(_0x996e,0x1d6));var _0xe996=function(_0xcfaee1,_0x503445){_0xcfaee1=_0xcfaee1-0x0;var _0x12ff99=_0x996e[_0xcfaee1];return _0x12ff99;};'use strict';var _=require(_0xe996('0x0'));var util=require(_0xe996('0x1'));var moment=require('moment');var BPromise=require(_0xe996('0x2'));var rs=require(_0xe996('0x3'));var fs=require('fs');var Redis=require(_0xe996('0x4'));var db=require(_0xe996('0x5'))['db'];var utils=require(_0xe996('0x6'));var logger=require(_0xe996('0x7'))('rpc');var config=require(_0xe996('0x8'));var jayson=require(_0xe996('0x9'));var client=jayson[_0xe996('0xa')][_0xe996('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x262b59,_0x2af823,_0x3a6eee){return new BPromise(function(_0x33472d,_0x6fd6e6){return client[_0xe996('0xc')](_0x262b59,_0x3a6eee)[_0xe996('0xd')](function(_0x58bd53){logger[_0xe996('0xe')](_0xe996('0xf'),_0x2af823,_0xe996('0x10'));logger[_0xe996('0x11')](_0xe996('0x12'),_0x2af823,_0xe996('0x10'),JSON[_0xe996('0x13')](_0x58bd53));if(_0x58bd53[_0xe996('0x14')]){if(_0x58bd53[_0xe996('0x14')][_0xe996('0x15')]===0x1f4){logger['error'](_0xe996('0xf'),_0x2af823,_0x58bd53[_0xe996('0x14')][_0xe996('0x16')]);return _0x6fd6e6(_0x58bd53['error'][_0xe996('0x16')]);}logger[_0xe996('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2af823,_0x58bd53['error'][_0xe996('0x16')]);return _0x33472d(_0x58bd53[_0xe996('0x14')][_0xe996('0x16')]);}else{logger[_0xe996('0xe')](_0xe996('0xf'),_0x2af823,_0xe996('0x10'));_0x33472d(_0x58bd53[_0xe996('0x17')][_0xe996('0x16')]);}})[_0xe996('0x18')](function(_0x40cca7){logger[_0xe996('0x14')](_0xe996('0xf'),_0x2af823,_0x40cca7);_0x6fd6e6(_0x40cca7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 11573cd..67f3b8e 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 _0x0032=['/:id/resources','post','/:id/clone','addSections','put','delete','/:id','removeSections','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','show','/:id/sections','getSections'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0032,0x127));var _0x2003=function(_0x36426d,_0x4d62fe){_0x36426d=_0x36426d-0x0;var _0x40bd33=_0x0032[_0x36426d];return _0x40bd33;};'use strict';var multer=require('multer');var util=require(_0x2003('0x0'));var path=require(_0x2003('0x1'));var timeout=require(_0x2003('0x2'));var express=require(_0x2003('0x3'));var router=express[_0x2003('0x4')]();var fs_extra=require(_0x2003('0x5'));var auth=require(_0x2003('0x6'));var interaction=require(_0x2003('0x7'));var config=require(_0x2003('0x8'));var controller=require(_0x2003('0x9'));router[_0x2003('0xa')]('/',auth[_0x2003('0xb')](),controller[_0x2003('0xc')]);router[_0x2003('0xa')](_0x2003('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x2003('0xa')]('/:id',auth[_0x2003('0xb')](),controller[_0x2003('0xe')]);router[_0x2003('0xa')](_0x2003('0xf'),auth['isAuthenticated'](),controller[_0x2003('0x10')]);router['get'](_0x2003('0x11'),auth[_0x2003('0xb')](),controller['getResources']);router[_0x2003('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2003('0x12')](_0x2003('0x13'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x2003('0xf'),auth[_0x2003('0xb')](),controller[_0x2003('0x14')]);router[_0x2003('0x12')]('/:id/resources',auth[_0x2003('0xb')](),controller['addResources']);router[_0x2003('0x15')]('/:id',auth[_0x2003('0xb')](),controller['update']);router[_0x2003('0x16')](_0x2003('0x17'),auth[_0x2003('0xb')](),controller['destroy']);router[_0x2003('0x16')](_0x2003('0xf'),auth[_0x2003('0xb')](),controller[_0x2003('0x18')]);router[_0x2003('0x16')]('/:id/resources',auth[_0x2003('0xb')](),controller[_0x2003('0x19')]);module['exports']=router; \ No newline at end of file +var _0x1851=['fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/sections','post','create','clone','addSections','/:id/resources','addResources','update','delete','destroy','removeSections','exports','multer','util','connect-timeout','express'];(function(_0x3386a6,_0x29a3d5){var _0xd22cc9=function(_0x58b3a6){while(--_0x58b3a6){_0x3386a6['push'](_0x3386a6['shift']());}};_0xd22cc9(++_0x29a3d5);}(_0x1851,0x16c));var _0x1185=function(_0x2ffcd9,_0x25029f){_0x2ffcd9=_0x2ffcd9-0x0;var _0x4f3e89=_0x1851[_0x2ffcd9];return _0x4f3e89;};'use strict';var multer=require(_0x1185('0x0'));var util=require(_0x1185('0x1'));var path=require('path');var timeout=require(_0x1185('0x2'));var express=require(_0x1185('0x3'));var router=express['Router']();var fs_extra=require(_0x1185('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1185('0x5'));var controller=require('./userProfile.controller');router[_0x1185('0x6')]('/',auth[_0x1185('0x7')](),controller['index']);router['get'](_0x1185('0x8'),auth[_0x1185('0x7')](),controller[_0x1185('0x9')]);router[_0x1185('0x6')](_0x1185('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1185('0x6')](_0x1185('0xb'),auth['isAuthenticated'](),controller['getSections']);router[_0x1185('0x6')]('/:id/resources',auth[_0x1185('0x7')](),controller['getResources']);router[_0x1185('0xc')]('/',auth['isAuthenticated'](),controller[_0x1185('0xd')]);router[_0x1185('0xc')]('/:id/clone',auth[_0x1185('0x7')](),controller[_0x1185('0xe')]);router[_0x1185('0xc')](_0x1185('0xb'),auth['isAuthenticated'](),controller[_0x1185('0xf')]);router[_0x1185('0xc')](_0x1185('0x10'),auth[_0x1185('0x7')](),controller[_0x1185('0x11')]);router['put']('/:id',auth[_0x1185('0x7')](),controller[_0x1185('0x12')]);router[_0x1185('0x13')](_0x1185('0xa'),auth['isAuthenticated'](),controller[_0x1185('0x14')]);router['delete'](_0x1185('0xb'),auth['isAuthenticated'](),controller[_0x1185('0x15')]);router[_0x1185('0x13')](_0x1185('0x10'),auth[_0x1185('0x7')](),controller['removeResources']);module[_0x1185('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dfe17f4..2d9f944 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 _0x195b=['split','BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue'];(function(_0x464c8a,_0x53445a){var _0x3c9bca=function(_0x617bb){while(--_0x617bb){_0x464c8a['push'](_0x464c8a['shift']());}};_0x3c9bca(++_0x53445a);}(_0x195b,0x65));var _0xb195=function(_0x478370,_0x534f7a){_0x478370=_0x478370-0x0;var _0x54c0e2=_0x195b[_0x478370];return _0x54c0e2;};'use strict';var Sequelize=require('sequelize');module[_0xb195('0x0')]={'name':{'type':Sequelize[_0xb195('0x1')],'allowNull':![],'unique':_0xb195('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1f15cf){this[_0xb195('0x3')](_0xb195('0x4'),_0x1f15cf?_0x1f15cf[_0xb195('0x5')](''):[]);},'get':function(){return this[_0xb195('0x6')](_0xb195('0x4'))?this['getDataValue'](_0xb195('0x4'))[_0xb195('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb195('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x048a=['name','crudPermissions','join','getDataValue','BOOLEAN','sequelize','STRING'];(function(_0x1160f4,_0xb82c95){var _0x39651d=function(_0x1f2cd3){while(--_0x1f2cd3){_0x1160f4['push'](_0x1160f4['shift']());}};_0x39651d(++_0xb82c95);}(_0x048a,0x1b7));var _0xa048=function(_0x34ae0e,_0x49f01a){_0x34ae0e=_0x34ae0e-0x0;var _0x2297ee=_0x048a[_0x34ae0e];return _0x2297ee;};'use strict';var Sequelize=require(_0xa048('0x0'));module['exports']={'name':{'type':Sequelize[_0xa048('0x1')],'allowNull':![],'unique':_0xa048('0x2')},'crudPermissions':{'type':Sequelize[_0xa048('0x1')],'set':function(_0x2b250e){this['setDataValue'](_0xa048('0x3'),_0x2b250e?_0x2b250e[_0xa048('0x4')](''):[]);},'get':function(){return this[_0xa048('0x5')](_0xa048('0x3'))?this[_0xa048('0x5')](_0xa048('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa048('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa048('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 43d5c70..f228501 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 _0x85ec=['catch','show','params','include','create','body','clone','find','get','omit','createdAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','updatedAt','userProfileId','Resources','destroy','describe','addSections','UserProfileResource','push','removeSections','getSections','findAll','enabled','isEmpty','includes','subsections','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','getResources','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','rows'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x85ec,0x113));var _0xc85e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85ec[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc85e('0x0'));var zipdir=require(_0xc85e('0x1'));var jsonpatch=require(_0xc85e('0x2'));var rp=require('request-promise');var moment=require(_0xc85e('0x3'));var BPromise=require(_0xc85e('0x4'));var Mustache=require(_0xc85e('0x5'));var util=require(_0xc85e('0x6'));var path=require(_0xc85e('0x7'));var sox=require(_0xc85e('0x8'));var csv=require(_0xc85e('0x9'));var ejs=require(_0xc85e('0xa'));var fs=require('fs');var fs_extra=require(_0xc85e('0xb'));var _=require(_0xc85e('0xc'));var squel=require(_0xc85e('0xd'));var crypto=require(_0xc85e('0xe'));var jsforce=require(_0xc85e('0xf'));var deskjs=require(_0xc85e('0x10'));var toCsv=require(_0xc85e('0x9'));var querystring=require(_0xc85e('0x11'));var Papa=require(_0xc85e('0x12'));var Redis=require(_0xc85e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc85e('0x14'));var as=require(_0xc85e('0x15'));var hardwareService=require(_0xc85e('0x16'));var logger=require(_0xc85e('0x17'))(_0xc85e('0x18'));var utils=require(_0xc85e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc85e('0x1a'));var db=require(_0xc85e('0x1b'))['db'];config[_0xc85e('0x1c')]=_['defaults'](config[_0xc85e('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc85e('0x1d'))['register'](socket);function respondWithStatusCode(_0x2c2c19,_0x566fb6){_0x566fb6=_0x566fb6||0xcc;return function(_0xf3533b){if(_0xf3533b){return _0x2c2c19[_0xc85e('0x1e')](_0x566fb6);}return _0x2c2c19[_0xc85e('0x1f')](_0x566fb6)[_0xc85e('0x20')]();};}function respondWithResult(_0x457915,_0x1ee40a){_0x1ee40a=_0x1ee40a||0xc8;return function(_0x18474c){if(_0x18474c){return _0x457915['status'](_0x1ee40a)[_0xc85e('0x21')](_0x18474c);}};}function respondWithFilteredResult(_0x383696,_0x308c50){return function(_0x5da192){if(_0x5da192){var _0x400bd2=typeof _0x308c50[_0xc85e('0x22')]===_0xc85e('0x23')&&typeof _0x308c50[_0xc85e('0x24')]===_0xc85e('0x23');var _0x278aab=_0x5da192['count'];var _0x1c3215=_0x400bd2?0x0:_0x308c50[_0xc85e('0x22')];var _0xeeee4c=_0x400bd2?_0x5da192['count']:_0x308c50[_0xc85e('0x22')]+_0x308c50['limit'];var _0x37759d;if(_0xeeee4c>=_0x278aab){_0xeeee4c=_0x278aab;_0x37759d=0xc8;}else{_0x37759d=0xce;}_0x383696[_0xc85e('0x1f')](_0x37759d);return _0x383696['set'](_0xc85e('0x25'),_0x1c3215+'-'+_0xeeee4c+'/'+_0x278aab)[_0xc85e('0x21')](_0x5da192);}return null;};}function patchUpdates(_0x410ed5){return function(_0x25434d){try{jsonpatch[_0xc85e('0x26')](_0x25434d,_0x410ed5,!![]);}catch(_0x4ae7ca){return BPromise[_0xc85e('0x27')](_0x4ae7ca);}return _0x25434d['save']();};}function saveUpdates(_0x452614,_0x10af2e){return function(_0x269236){if(_0x269236){return _0x269236[_0xc85e('0x28')](_0x452614)[_0xc85e('0x29')](function(_0x3d92d9){return _0x3d92d9;});}return null;};}function removeEntity(_0x4e8e18,_0x17627d){return function(_0x98a1bd){if(_0x98a1bd){return _0x98a1bd['destroy']()['then'](function(){_0x4e8e18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd5c6cc,_0x4933c5){return function(_0x428acb){if(!_0x428acb){_0xd5c6cc[_0xc85e('0x1e')](0x194);}return _0x428acb;};}function handleError(_0x1e85e9,_0x1dffbb){_0x1dffbb=_0x1dffbb||0x1f4;return function(_0x2bc808){logger[_0xc85e('0x2a')](_0x2bc808[_0xc85e('0x2b')]);if(_0x2bc808[_0xc85e('0x2c')]){delete _0x2bc808[_0xc85e('0x2c')];}_0x1e85e9['status'](_0x1dffbb)[_0xc85e('0x2d')](_0x2bc808);};}exports[_0xc85e('0x2e')]=function(_0x24e3b8,_0x3884a0){var _0x144e6b={},_0x33e1ac={},_0x4fd135={'count':0x0,'rows':[]};var _0x22b721=_[_0xc85e('0x2f')](db[_0xc85e('0x30')][_0xc85e('0x31')],function(_0x27538b){return{'name':_0x27538b[_0xc85e('0x32')],'type':_0x27538b['type'][_0xc85e('0x33')]};});_0x33e1ac[_0xc85e('0x34')]=_['map'](_0x22b721,_0xc85e('0x2c'));_0x33e1ac[_0xc85e('0x35')]=_[_0xc85e('0x36')](_0x24e3b8[_0xc85e('0x35')]);_0x33e1ac['filters']=_[_0xc85e('0x37')](_0x33e1ac[_0xc85e('0x34')],_0x33e1ac[_0xc85e('0x35')]);_0x144e6b['attributes']=_[_0xc85e('0x37')](_0x33e1ac[_0xc85e('0x34')],qs['fields'](_0x24e3b8['query'][_0xc85e('0x38')]));_0x144e6b[_0xc85e('0x39')]=_0x144e6b['attributes'][_0xc85e('0x3a')]?_0x144e6b[_0xc85e('0x39')]:_0x33e1ac['model'];if(!_0x24e3b8[_0xc85e('0x35')][_0xc85e('0x3b')](_0xc85e('0x3c'))){_0x144e6b[_0xc85e('0x24')]=qs[_0xc85e('0x24')](_0x24e3b8[_0xc85e('0x35')][_0xc85e('0x24')]);_0x144e6b['offset']=qs[_0xc85e('0x22')](_0x24e3b8[_0xc85e('0x35')][_0xc85e('0x22')]);}_0x144e6b[_0xc85e('0x3d')]=qs[_0xc85e('0x3e')](_0x24e3b8[_0xc85e('0x35')][_0xc85e('0x3e')]);_0x144e6b[_0xc85e('0x3f')]=qs[_0xc85e('0x40')](_[_0xc85e('0x41')](_0x24e3b8[_0xc85e('0x35')],_0x33e1ac[_0xc85e('0x40')]),_0x22b721);if(_0x24e3b8['query'][_0xc85e('0x42')]){_0x144e6b[_0xc85e('0x3f')]=_[_0xc85e('0x43')](_0x144e6b[_0xc85e('0x3f')],{'$or':_[_0xc85e('0x2f')](_0x22b721,function(_0x5eb208){if(_0x5eb208['type']!==_0xc85e('0x44')){var _0x1c3ab2={};_0x1c3ab2[_0x5eb208[_0xc85e('0x2c')]]={'$like':'%'+_0x24e3b8[_0xc85e('0x35')][_0xc85e('0x42')]+'%'};return _0x1c3ab2;}})});}_0x144e6b=_[_0xc85e('0x43')]({},_0x144e6b,_0x24e3b8[_0xc85e('0x45')]);var _0x176aba={'where':_0x144e6b['where']};return db['UserProfile'][_0xc85e('0x46')](_0x176aba)[_0xc85e('0x29')](function(_0x593ff0){_0x4fd135['count']=_0x593ff0;if(_0x24e3b8[_0xc85e('0x35')][_0xc85e('0x47')]){_0x144e6b['include']=[{'all':!![]}];}return db[_0xc85e('0x30')]['findAll'](_0x144e6b);})[_0xc85e('0x29')](function(_0x17196c){_0x4fd135[_0xc85e('0x48')]=_0x17196c;return _0x4fd135;})[_0xc85e('0x29')](respondWithFilteredResult(_0x3884a0,_0x144e6b))[_0xc85e('0x49')](handleError(_0x3884a0,null));};exports[_0xc85e('0x4a')]=function(_0x518c35,_0x47e3ee){var _0x231e60={'raw':![],'where':{'id':_0x518c35[_0xc85e('0x4b')]['id']}},_0x44b365={};_0x44b365[_0xc85e('0x34')]=_[_0xc85e('0x36')](db['UserProfile'][_0xc85e('0x31')]);_0x44b365[_0xc85e('0x35')]=_[_0xc85e('0x36')](_0x518c35[_0xc85e('0x35')]);_0x44b365[_0xc85e('0x40')]=_['intersection'](_0x44b365[_0xc85e('0x34')],_0x44b365[_0xc85e('0x35')]);_0x231e60['attributes']=_[_0xc85e('0x37')](_0x44b365[_0xc85e('0x34')],qs['fields'](_0x518c35[_0xc85e('0x35')][_0xc85e('0x38')]));_0x231e60[_0xc85e('0x39')]=_0x231e60['attributes']['length']?_0x231e60[_0xc85e('0x39')]:_0x44b365[_0xc85e('0x34')];if(_0x518c35[_0xc85e('0x35')][_0xc85e('0x47')]){_0x231e60[_0xc85e('0x4c')]=[{'all':!![]}];}_0x231e60=_['merge']({},_0x231e60,_0x518c35[_0xc85e('0x45')]);return db[_0xc85e('0x30')]['find'](_0x231e60)[_0xc85e('0x29')](handleEntityNotFound(_0x47e3ee,null))[_0xc85e('0x29')](respondWithResult(_0x47e3ee,null))[_0xc85e('0x49')](handleError(_0x47e3ee,null));};exports[_0xc85e('0x4d')]=function(_0x55cd0b,_0x14a67d){return db[_0xc85e('0x30')][_0xc85e('0x4d')](_0x55cd0b[_0xc85e('0x4e')],{})[_0xc85e('0x29')](respondWithResult(_0x14a67d,0xc9))[_0xc85e('0x49')](handleError(_0x14a67d,null));};exports[_0xc85e('0x4f')]=function(_0x355809,_0x403f70){var _0x3239b7={'where':{'id':_0x355809['params']['id']}},_0x41946d={};_0x41946d[_0xc85e('0x34')]=_['keys'](db[_0xc85e('0x30')][_0xc85e('0x31')]);_0x3239b7[_0xc85e('0x39')]=_[_0xc85e('0x37')](_0x41946d[_0xc85e('0x34')],qs['fields'](_0x355809[_0xc85e('0x35')]['fields']));_0x3239b7['attributes']=_0x3239b7[_0xc85e('0x39')][_0xc85e('0x3a')]?_0x3239b7[_0xc85e('0x39')]:_0x41946d[_0xc85e('0x34')];if(_0x355809['query'][_0xc85e('0x47')]){_0x3239b7[_0xc85e('0x4c')]=[{'all':!![]}];}_0x3239b7=_['merge']({},_0x3239b7,_0x355809[_0xc85e('0x45')]);return db[_0xc85e('0x30')][_0xc85e('0x50')](_0x3239b7)[_0xc85e('0x29')](handleEntityNotFound(_0x403f70,null))[_0xc85e('0x29')](function(_0xb7decc){if(_0xb7decc){var _0x37a507=_0xb7decc[_0xc85e('0x51')]({'plain':!![]});_0x37a507=qs[_0xc85e('0x52')](_0x37a507,['id',_0xc85e('0x53'),'updatedAt',_0xc85e('0x54')]);_0x355809[_0xc85e('0x4e')]=_['omit'](_0x355809[_0xc85e('0x4e')],['id',_0xc85e('0x53'),'updatedAt']);return db[_0xc85e('0x55')][_0xc85e('0x56')](function(_0x2fe457){return db['UserProfile'][_0xc85e('0x4d')](_['merge'](_0x37a507,_0x355809[_0xc85e('0x4e')]),{'include':_0x355809[_0xc85e('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2fe457})['then'](function(_0x190fe3){var _0x112960=_0x190fe3[_0xc85e('0x51')]({'plain':!![]});return db[_0xc85e('0x57')]['findAll']({'where':{'userProfileId':_0x355809[_0xc85e('0x4b')]['id']},'raw':!![]})[_0xc85e('0x29')](function(_0x1d862d){if(_0x1d862d){return BPromise[_0xc85e('0x58')](_0x1d862d,function(_0x391e80){return new BPromise(function(_0x1b4f16,_0x12f61d){if(_0x391e80[_0xc85e('0x59')]===null||_0x391e80['autoAssociation']===0x1)_0x1b4f16(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x391e80['id']},'raw':!![]})[_0xc85e('0x29')](function(_0x6a6a17){var _0x3bbf4e=_[_0xc85e('0x2f')](_0x6a6a17,function(_0xf41d5d){return qs[_0xc85e('0x52')](_0xf41d5d,['id',_0xc85e('0x53'),'updatedAt',_0xc85e('0x5a')]);});_0x1b4f16(_0x3bbf4e);})[_0xc85e('0x49')](function(_0x39ffcc){_0x12f61d(_0x39ffcc);});})[_0xc85e('0x29')](function(_0x17ca5f){var _0x1df56e=qs[_0xc85e('0x52')](_0x391e80,['id',_0xc85e('0x53'),_0xc85e('0x5b')]);_0x1df56e[_0xc85e('0x5c')]=_0x112960['id'];if(_0x17ca5f)_0x1df56e[_0xc85e('0x5d')]=_0x17ca5f;return _0x1df56e;})['then'](function(_0x3ae250){return db[_0xc85e('0x57')]['create'](_0x3ae250,{'include':[{'model':db['UserProfileResource'],'as':_0xc85e('0x5d')}],'raw':!![],'transaction':_0x2fe457});});})[_0xc85e('0x29')](function(){return _0x112960;});}});});});}})['then'](respondWithResult(_0x403f70,0xc9))[_0xc85e('0x49')](handleError(_0x403f70,null));};exports[_0xc85e('0x28')]=function(_0x411be9,_0x3a127c){if(_0x411be9[_0xc85e('0x4e')]['id']){delete _0x411be9[_0xc85e('0x4e')]['id'];}return db[_0xc85e('0x30')][_0xc85e('0x50')]({'where':{'id':_0x411be9['params']['id']}})['then'](handleEntityNotFound(_0x3a127c,null))['then'](saveUpdates(_0x411be9[_0xc85e('0x4e')],null))[_0xc85e('0x29')](respondWithResult(_0x3a127c,null))[_0xc85e('0x49')](handleError(_0x3a127c,null));};exports[_0xc85e('0x5e')]=function(_0x44fed5,_0x1aa4f5){return db[_0xc85e('0x30')][_0xc85e('0x50')]({'where':{'id':_0x44fed5['params']['id']}})[_0xc85e('0x29')](handleEntityNotFound(_0x1aa4f5,null))[_0xc85e('0x29')](removeEntity(_0x1aa4f5,null))[_0xc85e('0x49')](handleError(_0x1aa4f5,null));};exports[_0xc85e('0x5f')]=function(_0xa391b6,_0x18d291){return db[_0xc85e('0x30')][_0xc85e('0x5f')]()['then'](respondWithResult(_0x18d291,null))[_0xc85e('0x49')](handleError(_0x18d291,null));};exports[_0xc85e('0x60')]=function(_0x35f20f,_0x377572){var _0x4759a1=_0x35f20f[_0xc85e('0x4e')];return db[_0xc85e('0x30')]['find']({'where':{'id':_0x35f20f[_0xc85e('0x4b')]['id']}})[_0xc85e('0x29')](handleEntityNotFound(_0x377572,null))[_0xc85e('0x29')](function(_0x2a06e6){if(_0x2a06e6){return db[_0xc85e('0x55')]['transaction'](function(_0x7f7e92){return db[_0xc85e('0x57')][_0xc85e('0x5e')]({'where':{'userProfileId':_0x35f20f[_0xc85e('0x4b')]['id'],'sectionId':_[_0xc85e('0x2f')](_0x4759a1,function(_0x4a78b2){return _0x4a78b2[_0xc85e('0x5a')];})},'transaction':_0x7f7e92})[_0xc85e('0x29')](function(){var _0x2998b8=_[_0xc85e('0x2f')](_0x4759a1,function(_0xc8c8d2){_0xc8c8d2[_0xc85e('0x5c')]=_0x35f20f[_0xc85e('0x4b')]['id'];return _0xc8c8d2;});var _0x39951b=[];return BPromise[_0xc85e('0x58')](_0x2998b8,function(_0x102910){return db[_0xc85e('0x57')][_0xc85e('0x4d')](_0x102910,{'include':[{'model':db[_0xc85e('0x61')],'as':_0xc85e('0x5d')}],'raw':!![],'transaction':_0x7f7e92})[_0xc85e('0x29')](function(_0xf456b3){_0x39951b[_0xc85e('0x62')](_0xf456b3['get']({'plain':!![]}));});})[_0xc85e('0x29')](function(){return _0x39951b;});});});}})[_0xc85e('0x29')](function(_0x3ddd29){return _0x3ddd29;})[_0xc85e('0x29')](respondWithResult(_0x377572,null))[_0xc85e('0x49')](handleError(_0x377572,null));};exports[_0xc85e('0x63')]=function(_0x20da86,_0x1310aa){var _0x80de48;return db[_0xc85e('0x30')][_0xc85e('0x50')]({'where':{'id':_0x20da86['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x1310aa,null))['then'](function(_0x460840){if(_0x460840){_0x80de48=_0x460840;return db[_0xc85e('0x57')]['destroy']({'where':{'userProfileId':_0x20da86['params']['id'],'sectionId':_0x20da86[_0xc85e('0x35')]['ids']}});}})['then'](function(){return _0x80de48;})[_0xc85e('0x29')](respondWithStatusCode(_0x1310aa,null))['catch'](handleError(_0x1310aa,null));};exports[_0xc85e('0x64')]=function(_0x39ab3b,_0x271fd2){var _0x2fa033=[];var _0x1c176f=[];return db['UserProfileSection'][_0xc85e('0x65')]({'where':{'userProfileId':_0x39ab3b[_0xc85e('0x4b')]['id']},'raw':!![]})['then'](function(_0xbef6bf){_0x2fa033=_[_0xc85e('0x42')](_0xbef6bf,function(_0x2461b2){return _0x2461b2[_0xc85e('0x66')]===0x1||_['includes']([0x3eb,0x709],_0x2461b2[_0xc85e('0x5a')]);});if(!_[_0xc85e('0x67')](_0x2fa033)){return _[_0xc85e('0x2f')](_0x2fa033,function(_0x5f2c65){return _0x5f2c65['sectionId'];});}else{return;}})[_0xc85e('0x29')](function(_0x2b047c){if(_0x2b047c)_0x1c176f=_0x2b047c;if(_[_0xc85e('0x68')](_0x1c176f,0x64)){var _0x93f95a=_['find'](_0x2fa033,{'sectionId':0x64});return hasDefaultDashboard(_0x93f95a)[_0xc85e('0x29')](function(_0x3b5dbe){return _[_0xc85e('0x2f')](_0x2fa033,function(_0x372e9c){if(_0x372e9c[_0xc85e('0x5a')]===0x64){_0x372e9c[_0xc85e('0x69')]=_0x3b5dbe;}return _0x372e9c;});});}else{return;}})['then'](function(_0x13048b){if(_0x13048b)_0x2fa033=_0x13048b;if(_[_0xc85e('0x68')](_0x1c176f,0x3eb)){var _0x22e11e=_[_0xc85e('0x50')](_0x2fa033,{'sectionId':0x3eb});return getCustomDashboards(_0x22e11e)[_0xc85e('0x29')](function(_0x45c5ef){return _[_0xc85e('0x2f')](_0x2fa033,function(_0x57ed93){if(_0x22e11e[_0xc85e('0x66')]){if(_0x57ed93[_0xc85e('0x5a')]===0x3eb){_0x57ed93['subsections']=_0x45c5ef;}}else{if(_0x57ed93[_0xc85e('0x5a')]===0x64){if(!_0x57ed93[_0xc85e('0x69')]){_0x57ed93['subsections']=[];}_0x57ed93['subsections']=_0x57ed93[_0xc85e('0x69')]['concat'](_0x45c5ef);}}return _0x57ed93;});});}else{return;}})['then'](function(_0x3626e7){if(_0x3626e7)_0x2fa033=_0x3626e7;if(_['includes'](_0x1c176f,0x709)){var _0x2e71d5=_[_0xc85e('0x50')](_0x2fa033,{'sectionId':0x709});return getPlugins(_0x2e71d5)['then'](function(_0x27408a){if(_0x2e71d5['enabled']){return _[_0xc85e('0x2f')](_0x2fa033,function(_0x19619d){if(_0x19619d['sectionId']===0x709){_0x19619d[_0xc85e('0x69')]=_0x27408a;}return _0x19619d;});}else{var _0x101c89={'sectionId':0x76c,'enabled':0x1,'subsections':_0x27408a};var _0x33ca42=_[_0xc85e('0x2f')](_0x2fa033);_0x33ca42['push'](_0x101c89);return _0x33ca42;}});}else{return;}})[_0xc85e('0x29')](function(_0x46ca77){if(_0x46ca77)_0x2fa033=_0x46ca77;return _['filter'](_0x2fa033,[_0xc85e('0x66'),0x1]);})['then'](respondWithResult(_0x271fd2,null))[_0xc85e('0x49')](handleError(_0x271fd2,null));};function hasDefaultDashboard(_0x362711){var _0x2cebbe=[0x65];return new BPromise(function(_0x206c3c,_0x4ccec3){try{if(_0x362711['autoAssociation']){_0x206c3c(_0x2cebbe);}else{return db[_0xc85e('0x61')]['findOne']({'where':{'sectionId':_0x362711['id']},'raw':!![]})[_0xc85e('0x29')](function(_0x24733e){_0x24733e?_0x206c3c(_0x2cebbe):_0x206c3c();});}}catch(_0x3715a7){_0x4ccec3(_0x3715a7);}});}function getCustomDashboards(_0xd55baf){var _0x240e2f=[];return new BPromise(function(_0x5cb574,_0x183400){try{if(_0xd55baf['autoAssociation']){return db[_0xc85e('0x6a')]['findAll']({'raw':!![]})[_0xc85e('0x29')](function(_0x203ec5){_0x203ec5[_0xc85e('0x6b')](function(_0x3c6e30){_0x240e2f[_0xc85e('0x62')](_0x3c6e30['id']+0x1869f);});_0x5cb574(_0x240e2f);});}else{return db['UserProfileResource'][_0xc85e('0x65')]({'where':{'sectionId':_0xd55baf['id']},'raw':!![]})[_0xc85e('0x29')](function(_0x23fc91){_0x23fc91[_0xc85e('0x6b')](function(_0x34657f){_0x240e2f[_0xc85e('0x62')](_0x34657f[_0xc85e('0x6c')]+0x1869f);});_0x5cb574(_0x240e2f);});}}catch(_0x206676){_0x183400(_0x206676);}});}function getPlugins(_0x1df98c){var _0x3d4423=[];return new BPromise(function(_0x1491ea,_0x2b39f7){try{if(_0x1df98c[_0xc85e('0x59')]){return db[_0xc85e('0x6d')][_0xc85e('0x65')]({'raw':!![]})['then'](function(_0x478ee4){_0x478ee4[_0xc85e('0x6b')](function(_0x56c238){_0x3d4423[_0xc85e('0x62')](_0x56c238['id']+0x15b38);});_0x1491ea(_0x3d4423);});}else{return db[_0xc85e('0x61')][_0xc85e('0x65')]({'where':{'sectionId':_0x1df98c['id']},'raw':!![]})[_0xc85e('0x29')](function(_0x4417ac){_0x4417ac[_0xc85e('0x6b')](function(_0x31a722){_0x3d4423[_0xc85e('0x62')](_0x31a722['resourceId']+0x15b38);});_0x1491ea(_0x3d4423);});}}catch(_0x462fb9){_0x2b39f7(_0x462fb9);}});}exports['addResources']=function(_0x3d24ba,_0x16f321){return db[_0xc85e('0x30')][_0xc85e('0x50')]({'where':{'id':_0x3d24ba[_0xc85e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16f321,null))[_0xc85e('0x29')](function(_0x227f74){if(_0x227f74){return db[_0xc85e('0x55')][_0xc85e('0x56')](function(_0x1faa35){return db['UserProfileSection'][_0xc85e('0x65')]({'where':{'userProfileId':_0x3d24ba[_0xc85e('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0xc85e('0x29')](function(_0xc15ddd){if(_0xc15ddd){return db[_0xc85e('0x57')][_0xc85e('0x5e')]({'where':{'userProfileId':_0x3d24ba[_0xc85e('0x4b')]['id'],'id':_[_0xc85e('0x2f')](_0xc15ddd,function(_0x3dbf40){return _0x3dbf40['id'];})},'transaction':_0x1faa35});}})['then'](function(_0x14ece6){var _0x4b363c=_[_0xc85e('0x2f')](_0x3d24ba[_0xc85e('0x4e')],function(_0x25845d){_0x25845d['userProfileId']=_0x3d24ba[_0xc85e('0x4b')]['id'];return _0x25845d;});return db[_0xc85e('0x57')][_0xc85e('0x6e')](_0x4b363c,{'raw':!![],'transaction':_0x1faa35});})[_0xc85e('0x29')](function(_0xef02d3){var _0x53983a=_['filter'](_[_0xc85e('0x2f')](_0xef02d3,function(_0x37aba3){return _0x37aba3[_0xc85e('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x53983a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3d24ba[_0xc85e('0x4b')]['id'],'sectionId':_[_0xc85e('0x2f')](_0x53983a,function(_0xb95cf5){return _0xb95cf5[_0xc85e('0x5a')];})},'attributes':['id',_0xc85e('0x5a')],'raw':!![]})[_0xc85e('0x29')](function(_0x5a994a){var _0x115ee9=_['map'](_0x3d24ba[_0xc85e('0x4e')],function(_0x4ef002){_0x4ef002[_0xc85e('0x5c')]=_0x3d24ba[_0xc85e('0x4b')]['id'];return _0x4ef002;});return db['UserProfileResource']['bulkCreate'](_0x115ee9,{'raw':!![],'transaction':_0x1faa35});});}})[_0xc85e('0x49')](handleError(_0x16f321,null));});}})['then'](function(_0x102395){var _0x4f9e32=_['map'](_0x102395,function(_0x527dfb){return _0x527dfb[_0xc85e('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x16f321,null))['catch'](handleError(_0x16f321,null));};exports[_0xc85e('0x6f')]=function(_0x453196,_0x2dbeb2,_0x2da3c9){return db[_0xc85e('0x30')]['find']({'where':{'id':_0x453196[_0xc85e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2dbeb2,null))[_0xc85e('0x29')](function(_0x5418cb){if(_0x5418cb){return _0x5418cb[_0xc85e('0x6f')](_0x453196[_0xc85e('0x35')][_0xc85e('0x70')]);}})[_0xc85e('0x29')](respondWithStatusCode(_0x2dbeb2,null))[_0xc85e('0x49')](handleError(_0x2dbeb2,null));};exports['getResources']=function(_0x41392f,_0x485509){var _0x755d92={};if(!_0x41392f[_0xc85e('0x35')][_0xc85e('0x71')])throw new Error(_0xc85e('0x72'));if(!_0x41392f['query'][_0xc85e('0x3b')](_0xc85e('0x3c'))){_0x755d92[_0xc85e('0x24')]=qs[_0xc85e('0x24')](_0x41392f['query'][_0xc85e('0x24')]);_0x755d92[_0xc85e('0x22')]=qs[_0xc85e('0x22')](_0x41392f[_0xc85e('0x35')][_0xc85e('0x22')]);}return db[_0xc85e('0x30')][_0xc85e('0x50')]({'where':{'id':_0x41392f[_0xc85e('0x4b')]['id']}})['then'](function(_0x4bd0a4){if(!_0x4bd0a4)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x41392f[_0xc85e('0x4b')]['id']);return db[_0xc85e('0x30')][_0xc85e('0x73')](_0x41392f);})[_0xc85e('0x29')](respondWithFilteredResult(_0x485509,_0x755d92))[_0xc85e('0x49')](handleError(_0x485509,null));}; \ No newline at end of file +var _0xa777=['describe','addSections','UserProfileSection','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','reject','save','update','then','end','sendStatus','error','name','send','map','UserProfile','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','clone','get','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','destroy'];(function(_0x2d4b0a,_0x5147ba){var _0xe59a7a=function(_0x18b7d0){while(--_0x18b7d0){_0x2d4b0a['push'](_0x2d4b0a['shift']());}};_0xe59a7a(++_0x5147ba);}(_0xa777,0xf7));var _0x7a77=function(_0x261338,_0x90122b){_0x261338=_0x261338-0x0;var _0x54360d=_0xa777[_0x261338];return _0x54360d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a77('0x0'));var zipdir=require(_0x7a77('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a77('0x2'));var Mustache=require(_0x7a77('0x3'));var util=require('util');var path=require(_0x7a77('0x4'));var sox=require(_0x7a77('0x5'));var csv=require('to-csv');var ejs=require(_0x7a77('0x6'));var fs=require('fs');var fs_extra=require(_0x7a77('0x7'));var _=require(_0x7a77('0x8'));var squel=require(_0x7a77('0x9'));var crypto=require('crypto');var jsforce=require(_0x7a77('0xa'));var deskjs=require(_0x7a77('0xb'));var toCsv=require(_0x7a77('0xc'));var querystring=require(_0x7a77('0xd'));var Papa=require(_0x7a77('0xe'));var Redis=require(_0x7a77('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7a77('0x10'));var as=require(_0x7a77('0x11'));var hardwareService=require(_0x7a77('0x12'));var logger=require(_0x7a77('0x13'))(_0x7a77('0x14'));var utils=require(_0x7a77('0x15'));var config=require(_0x7a77('0x16'));var licenseUtil=require(_0x7a77('0x17'));var db=require(_0x7a77('0x18'))['db'];config[_0x7a77('0x19')]=_[_0x7a77('0x1a')](config[_0x7a77('0x19')],{'host':_0x7a77('0x1b'),'port':0x18eb});var socket=require(_0x7a77('0x1c'))(new Redis(config[_0x7a77('0x19')]));require('./userProfile.socket')[_0x7a77('0x1d')](socket);function respondWithStatusCode(_0x250792,_0x2902a3){_0x2902a3=_0x2902a3||0xcc;return function(_0x52aac9){if(_0x52aac9){return _0x250792['sendStatus'](_0x2902a3);}return _0x250792[_0x7a77('0x1e')](_0x2902a3)['end']();};}function respondWithResult(_0x71cf71,_0x38f065){_0x38f065=_0x38f065||0xc8;return function(_0xc3a484){if(_0xc3a484){return _0x71cf71['status'](_0x38f065)[_0x7a77('0x1f')](_0xc3a484);}};}function respondWithFilteredResult(_0x4c993f,_0x4afb98){return function(_0x1b33ac){if(_0x1b33ac){var _0x4fac78=typeof _0x4afb98[_0x7a77('0x20')]===_0x7a77('0x21')&&typeof _0x4afb98[_0x7a77('0x22')]==='undefined';var _0x5f4b06=_0x1b33ac[_0x7a77('0x23')];var _0x32d9d7=_0x4fac78?0x0:_0x4afb98[_0x7a77('0x20')];var _0x33e1cb=_0x4fac78?_0x1b33ac[_0x7a77('0x23')]:_0x4afb98[_0x7a77('0x20')]+_0x4afb98[_0x7a77('0x22')];var _0x36e924;if(_0x33e1cb>=_0x5f4b06){_0x33e1cb=_0x5f4b06;_0x36e924=0xc8;}else{_0x36e924=0xce;}_0x4c993f['status'](_0x36e924);return _0x4c993f['set']('Content-Range',_0x32d9d7+'-'+_0x33e1cb+'/'+_0x5f4b06)[_0x7a77('0x1f')](_0x1b33ac);}return null;};}function patchUpdates(_0x15b8f9){return function(_0x11572e){try{jsonpatch['apply'](_0x11572e,_0x15b8f9,!![]);}catch(_0x3c6ba4){return BPromise[_0x7a77('0x24')](_0x3c6ba4);}return _0x11572e[_0x7a77('0x25')]();};}function saveUpdates(_0x3c2578,_0x2a65d3){return function(_0x290b71){if(_0x290b71){return _0x290b71[_0x7a77('0x26')](_0x3c2578)[_0x7a77('0x27')](function(_0x54821c){return _0x54821c;});}return null;};}function removeEntity(_0x2cfb1a,_0x3599d2){return function(_0x292ccb){if(_0x292ccb){return _0x292ccb['destroy']()['then'](function(){_0x2cfb1a[_0x7a77('0x1e')](0xcc)[_0x7a77('0x28')]();});}};}function handleEntityNotFound(_0x43e740,_0x1762f8){return function(_0x185f72){if(!_0x185f72){_0x43e740[_0x7a77('0x29')](0x194);}return _0x185f72;};}function handleError(_0xe5a85b,_0x53fa44){_0x53fa44=_0x53fa44||0x1f4;return function(_0x5abe9a){logger[_0x7a77('0x2a')](_0x5abe9a['stack']);if(_0x5abe9a[_0x7a77('0x2b')]){delete _0x5abe9a['name'];}_0xe5a85b[_0x7a77('0x1e')](_0x53fa44)[_0x7a77('0x2c')](_0x5abe9a);};}exports['index']=function(_0x5ebfb0,_0x54887f){var _0x440b56={},_0x41afc1={},_0x462493={'count':0x0,'rows':[]};var _0x17771d=_[_0x7a77('0x2d')](db[_0x7a77('0x2e')][_0x7a77('0x2f')],function(_0x70ac17){return{'name':_0x70ac17['fieldName'],'type':_0x70ac17['type'][_0x7a77('0x30')]};});_0x41afc1[_0x7a77('0x31')]=_['map'](_0x17771d,_0x7a77('0x2b'));_0x41afc1[_0x7a77('0x32')]=_['keys'](_0x5ebfb0['query']);_0x41afc1['filters']=_['intersection'](_0x41afc1[_0x7a77('0x31')],_0x41afc1['query']);_0x440b56['attributes']=_[_0x7a77('0x33')](_0x41afc1[_0x7a77('0x31')],qs[_0x7a77('0x34')](_0x5ebfb0['query']['fields']));_0x440b56['attributes']=_0x440b56[_0x7a77('0x35')][_0x7a77('0x36')]?_0x440b56[_0x7a77('0x35')]:_0x41afc1['model'];if(!_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x37')]('nolimit')){_0x440b56['limit']=qs['limit'](_0x5ebfb0['query'][_0x7a77('0x22')]);_0x440b56[_0x7a77('0x20')]=qs[_0x7a77('0x20')](_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x20')]);}_0x440b56[_0x7a77('0x38')]=qs['sort'](_0x5ebfb0[_0x7a77('0x32')]['sort']);_0x440b56['where']=qs[_0x7a77('0x39')](_[_0x7a77('0x3a')](_0x5ebfb0[_0x7a77('0x32')],_0x41afc1[_0x7a77('0x39')]),_0x17771d);if(_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x3b')]){_0x440b56['where']=_[_0x7a77('0x3c')](_0x440b56[_0x7a77('0x3d')],{'$or':_[_0x7a77('0x2d')](_0x17771d,function(_0x44dc3e){if(_0x44dc3e['type']!=='VIRTUAL'){var _0x17f77b={};_0x17f77b[_0x44dc3e['name']]={'$like':'%'+_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x3b')]+'%'};return _0x17f77b;}})});}_0x440b56=_['merge']({},_0x440b56,_0x5ebfb0[_0x7a77('0x3e')]);var _0x5b7271={'where':_0x440b56[_0x7a77('0x3d')]};return db[_0x7a77('0x2e')][_0x7a77('0x23')](_0x5b7271)[_0x7a77('0x27')](function(_0x4ac304){_0x462493[_0x7a77('0x23')]=_0x4ac304;if(_0x5ebfb0[_0x7a77('0x32')][_0x7a77('0x3f')]){_0x440b56[_0x7a77('0x40')]=[{'all':!![]}];}return db['UserProfile'][_0x7a77('0x41')](_0x440b56);})[_0x7a77('0x27')](function(_0x1e3c87){_0x462493[_0x7a77('0x42')]=_0x1e3c87;return _0x462493;})[_0x7a77('0x27')](respondWithFilteredResult(_0x54887f,_0x440b56))['catch'](handleError(_0x54887f,null));};exports[_0x7a77('0x43')]=function(_0x13869e,_0x2e339a){var _0x2a1ecd={'raw':![],'where':{'id':_0x13869e[_0x7a77('0x44')]['id']}},_0x1220c3={};_0x1220c3[_0x7a77('0x31')]=_['keys'](db['UserProfile'][_0x7a77('0x2f')]);_0x1220c3[_0x7a77('0x32')]=_[_0x7a77('0x45')](_0x13869e[_0x7a77('0x32')]);_0x1220c3[_0x7a77('0x39')]=_[_0x7a77('0x33')](_0x1220c3[_0x7a77('0x31')],_0x1220c3[_0x7a77('0x32')]);_0x2a1ecd[_0x7a77('0x35')]=_[_0x7a77('0x33')](_0x1220c3[_0x7a77('0x31')],qs[_0x7a77('0x34')](_0x13869e[_0x7a77('0x32')]['fields']));_0x2a1ecd[_0x7a77('0x35')]=_0x2a1ecd[_0x7a77('0x35')][_0x7a77('0x36')]?_0x2a1ecd[_0x7a77('0x35')]:_0x1220c3[_0x7a77('0x31')];if(_0x13869e['query'][_0x7a77('0x3f')]){_0x2a1ecd[_0x7a77('0x40')]=[{'all':!![]}];}_0x2a1ecd=_[_0x7a77('0x3c')]({},_0x2a1ecd,_0x13869e['options']);return db[_0x7a77('0x2e')][_0x7a77('0x46')](_0x2a1ecd)[_0x7a77('0x27')](handleEntityNotFound(_0x2e339a,null))[_0x7a77('0x27')](respondWithResult(_0x2e339a,null))[_0x7a77('0x47')](handleError(_0x2e339a,null));};exports[_0x7a77('0x48')]=function(_0x33e45c,_0x5a79c1){return db[_0x7a77('0x2e')]['create'](_0x33e45c['body'],{})['then'](respondWithResult(_0x5a79c1,0xc9))[_0x7a77('0x47')](handleError(_0x5a79c1,null));};exports[_0x7a77('0x49')]=function(_0x1aac60,_0x461dc5){var _0x487931={'where':{'id':_0x1aac60[_0x7a77('0x44')]['id']}},_0x2e07fb={};_0x2e07fb[_0x7a77('0x31')]=_[_0x7a77('0x45')](db[_0x7a77('0x2e')]['rawAttributes']);_0x487931[_0x7a77('0x35')]=_['intersection'](_0x2e07fb['model'],qs[_0x7a77('0x34')](_0x1aac60[_0x7a77('0x32')][_0x7a77('0x34')]));_0x487931['attributes']=_0x487931[_0x7a77('0x35')][_0x7a77('0x36')]?_0x487931[_0x7a77('0x35')]:_0x2e07fb[_0x7a77('0x31')];if(_0x1aac60[_0x7a77('0x32')][_0x7a77('0x3f')]){_0x487931[_0x7a77('0x40')]=[{'all':!![]}];}_0x487931=_[_0x7a77('0x3c')]({},_0x487931,_0x1aac60[_0x7a77('0x3e')]);return db[_0x7a77('0x2e')][_0x7a77('0x46')](_0x487931)['then'](handleEntityNotFound(_0x461dc5,null))[_0x7a77('0x27')](function(_0x1f506a){if(_0x1f506a){var _0xf7564=_0x1f506a[_0x7a77('0x4a')]({'plain':!![]});_0xf7564=qs['omit'](_0xf7564,['id',_0x7a77('0x4b'),_0x7a77('0x4c'),_0x7a77('0x4d')]);_0x1aac60[_0x7a77('0x4e')]=_['omit'](_0x1aac60[_0x7a77('0x4e')],['id','createdAt',_0x7a77('0x4c')]);return db[_0x7a77('0x4f')][_0x7a77('0x50')](function(_0x52be14){return db[_0x7a77('0x2e')][_0x7a77('0x48')](_[_0x7a77('0x3c')](_0xf7564,_0x1aac60['body']),{'include':_0x1aac60[_0x7a77('0x32')][_0x7a77('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x52be14})[_0x7a77('0x27')](function(_0x206236){var _0x4187d7=_0x206236[_0x7a77('0x4a')]({'plain':!![]});return db['UserProfileSection'][_0x7a77('0x41')]({'where':{'userProfileId':_0x1aac60[_0x7a77('0x44')]['id']},'raw':!![]})['then'](function(_0x38c52e){if(_0x38c52e){return BPromise[_0x7a77('0x51')](_0x38c52e,function(_0x377596){return new BPromise(function(_0x53fe34,_0x379386){if(_0x377596[_0x7a77('0x52')]===null||_0x377596[_0x7a77('0x52')]===0x1)_0x53fe34(null);return db[_0x7a77('0x53')][_0x7a77('0x41')]({'where':{'sectionId':_0x377596['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x59d908){var _0x226dfa=_[_0x7a77('0x2d')](_0x59d908,function(_0x3488db){return qs[_0x7a77('0x54')](_0x3488db,['id',_0x7a77('0x4b'),'updatedAt',_0x7a77('0x55')]);});_0x53fe34(_0x226dfa);})[_0x7a77('0x47')](function(_0x599131){_0x379386(_0x599131);});})[_0x7a77('0x27')](function(_0x1dabab){var _0x17590f=qs[_0x7a77('0x54')](_0x377596,['id',_0x7a77('0x4b'),_0x7a77('0x4c')]);_0x17590f[_0x7a77('0x56')]=_0x4187d7['id'];if(_0x1dabab)_0x17590f[_0x7a77('0x57')]=_0x1dabab;return _0x17590f;})['then'](function(_0x5bf2ce){return db['UserProfileSection'][_0x7a77('0x48')](_0x5bf2ce,{'include':[{'model':db[_0x7a77('0x53')],'as':_0x7a77('0x57')}],'raw':!![],'transaction':_0x52be14});});})[_0x7a77('0x27')](function(){return _0x4187d7;});}});});});}})[_0x7a77('0x27')](respondWithResult(_0x461dc5,0xc9))[_0x7a77('0x47')](handleError(_0x461dc5,null));};exports[_0x7a77('0x26')]=function(_0x391835,_0x7bba0d){if(_0x391835[_0x7a77('0x4e')]['id']){delete _0x391835['body']['id'];}return db[_0x7a77('0x2e')]['find']({'where':{'id':_0x391835['params']['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x7bba0d,null))['then'](saveUpdates(_0x391835[_0x7a77('0x4e')],null))[_0x7a77('0x27')](respondWithResult(_0x7bba0d,null))[_0x7a77('0x47')](handleError(_0x7bba0d,null));};exports[_0x7a77('0x58')]=function(_0x5d25c4,_0x4e232a){return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x5d25c4[_0x7a77('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e232a,null))['then'](removeEntity(_0x4e232a,null))[_0x7a77('0x47')](handleError(_0x4e232a,null));};exports[_0x7a77('0x59')]=function(_0x90e002,_0x840eb){return db['UserProfile']['describe']()[_0x7a77('0x27')](respondWithResult(_0x840eb,null))[_0x7a77('0x47')](handleError(_0x840eb,null));};exports[_0x7a77('0x5a')]=function(_0x24cb74,_0x424e55){var _0x157ea4=_0x24cb74['body'];return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x24cb74['params']['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x424e55,null))[_0x7a77('0x27')](function(_0x317664){if(_0x317664){return db[_0x7a77('0x4f')]['transaction'](function(_0x15acde){return db[_0x7a77('0x5b')][_0x7a77('0x58')]({'where':{'userProfileId':_0x24cb74[_0x7a77('0x44')]['id'],'sectionId':_['map'](_0x157ea4,function(_0x14c57d){return _0x14c57d[_0x7a77('0x55')];})},'transaction':_0x15acde})[_0x7a77('0x27')](function(){var _0x124e98=_[_0x7a77('0x2d')](_0x157ea4,function(_0xbe7dff){_0xbe7dff[_0x7a77('0x56')]=_0x24cb74[_0x7a77('0x44')]['id'];return _0xbe7dff;});var _0x5ac44a=[];return BPromise['each'](_0x124e98,function(_0x389f0a){return db[_0x7a77('0x5b')][_0x7a77('0x48')](_0x389f0a,{'include':[{'model':db[_0x7a77('0x53')],'as':_0x7a77('0x57')}],'raw':!![],'transaction':_0x15acde})[_0x7a77('0x27')](function(_0x9cbc5d){_0x5ac44a[_0x7a77('0x5c')](_0x9cbc5d[_0x7a77('0x4a')]({'plain':!![]}));});})[_0x7a77('0x27')](function(){return _0x5ac44a;});});});}})[_0x7a77('0x27')](function(_0x1eeb5e){return _0x1eeb5e;})[_0x7a77('0x27')](respondWithResult(_0x424e55,null))['catch'](handleError(_0x424e55,null));};exports[_0x7a77('0x5d')]=function(_0x356f5d,_0x489499){var _0x45ff27;return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x356f5d[_0x7a77('0x44')]['id']},'attributes':['id','name']})[_0x7a77('0x27')](handleEntityNotFound(_0x489499,null))[_0x7a77('0x27')](function(_0x4fd228){if(_0x4fd228){_0x45ff27=_0x4fd228;return db[_0x7a77('0x5b')][_0x7a77('0x58')]({'where':{'userProfileId':_0x356f5d[_0x7a77('0x44')]['id'],'sectionId':_0x356f5d[_0x7a77('0x32')][_0x7a77('0x5e')]}});}})[_0x7a77('0x27')](function(){return _0x45ff27;})[_0x7a77('0x27')](respondWithStatusCode(_0x489499,null))[_0x7a77('0x47')](handleError(_0x489499,null));};exports[_0x7a77('0x5f')]=function(_0x5e9734,_0x5bb8ed){var _0x179eb0=[];var _0x5c8fa9=[];return db[_0x7a77('0x5b')][_0x7a77('0x41')]({'where':{'userProfileId':_0x5e9734[_0x7a77('0x44')]['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x2fe247){_0x179eb0=_[_0x7a77('0x3b')](_0x2fe247,function(_0x5082cc){return _0x5082cc['enabled']===0x1||_[_0x7a77('0x60')]([0x3eb,0x709],_0x5082cc[_0x7a77('0x55')]);});if(!_[_0x7a77('0x61')](_0x179eb0)){return _['map'](_0x179eb0,function(_0x151420){return _0x151420['sectionId'];});}else{return;}})['then'](function(_0x43f948){if(_0x43f948)_0x5c8fa9=_0x43f948;if(_['includes'](_0x5c8fa9,0x64)){var _0x550ace=_[_0x7a77('0x46')](_0x179eb0,{'sectionId':0x64});return hasDefaultDashboard(_0x550ace)[_0x7a77('0x27')](function(_0x2ac169){return _[_0x7a77('0x2d')](_0x179eb0,function(_0x185f6d){if(_0x185f6d['sectionId']===0x64){_0x185f6d[_0x7a77('0x62')]=_0x2ac169;}return _0x185f6d;});});}else{return;}})['then'](function(_0x2cc57a){if(_0x2cc57a)_0x179eb0=_0x2cc57a;if(_[_0x7a77('0x60')](_0x5c8fa9,0x3eb)){var _0x17d50e=_[_0x7a77('0x46')](_0x179eb0,{'sectionId':0x3eb});return getCustomDashboards(_0x17d50e)[_0x7a77('0x27')](function(_0x276edb){return _[_0x7a77('0x2d')](_0x179eb0,function(_0x4f8f76){if(_0x17d50e[_0x7a77('0x63')]){if(_0x4f8f76[_0x7a77('0x55')]===0x3eb){_0x4f8f76[_0x7a77('0x62')]=_0x276edb;}}else{if(_0x4f8f76[_0x7a77('0x55')]===0x64){if(!_0x4f8f76['subsections']){_0x4f8f76[_0x7a77('0x62')]=[];}_0x4f8f76[_0x7a77('0x62')]=_0x4f8f76[_0x7a77('0x62')][_0x7a77('0x64')](_0x276edb);}}return _0x4f8f76;});});}else{return;}})[_0x7a77('0x27')](function(_0x278f17){if(_0x278f17)_0x179eb0=_0x278f17;if(_[_0x7a77('0x60')](_0x5c8fa9,0x709)){var _0xb33653=_[_0x7a77('0x46')](_0x179eb0,{'sectionId':0x709});return getPlugins(_0xb33653)[_0x7a77('0x27')](function(_0xbf3b63){if(_0xb33653[_0x7a77('0x63')]){return _[_0x7a77('0x2d')](_0x179eb0,function(_0x314c3d){if(_0x314c3d['sectionId']===0x709){_0x314c3d[_0x7a77('0x62')]=_0xbf3b63;}return _0x314c3d;});}else{var _0xd02811={'sectionId':0x76c,'enabled':0x1,'subsections':_0xbf3b63};var _0xec5507=_[_0x7a77('0x2d')](_0x179eb0);_0xec5507[_0x7a77('0x5c')](_0xd02811);return _0xec5507;}});}else{return;}})['then'](function(_0x1d7d79){if(_0x1d7d79)_0x179eb0=_0x1d7d79;return _[_0x7a77('0x3b')](_0x179eb0,['enabled',0x1]);})[_0x7a77('0x27')](respondWithResult(_0x5bb8ed,null))[_0x7a77('0x47')](handleError(_0x5bb8ed,null));};function hasDefaultDashboard(_0x14f2af){var _0xb40ff6=[0x65];return new BPromise(function(_0x30460a,_0xc0340a){try{if(_0x14f2af[_0x7a77('0x52')]){_0x30460a(_0xb40ff6);}else{return db[_0x7a77('0x53')][_0x7a77('0x65')]({'where':{'sectionId':_0x14f2af['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x246540){_0x246540?_0x30460a(_0xb40ff6):_0x30460a();});}}catch(_0x19a37a){_0xc0340a(_0x19a37a);}});}function getCustomDashboards(_0x51323a){var _0x18d871=[];return new BPromise(function(_0x4444c4,_0x4573da){try{if(_0x51323a['autoAssociation']){return db[_0x7a77('0x66')][_0x7a77('0x41')]({'raw':!![]})[_0x7a77('0x27')](function(_0x390074){_0x390074[_0x7a77('0x67')](function(_0x51101e){_0x18d871[_0x7a77('0x5c')](_0x51101e['id']+0x1869f);});_0x4444c4(_0x18d871);});}else{return db[_0x7a77('0x53')][_0x7a77('0x41')]({'where':{'sectionId':_0x51323a['id']},'raw':!![]})['then'](function(_0x2b3bf6){_0x2b3bf6['forEach'](function(_0x4db97e){_0x18d871['push'](_0x4db97e[_0x7a77('0x68')]+0x1869f);});_0x4444c4(_0x18d871);});}}catch(_0x55ec00){_0x4573da(_0x55ec00);}});}function getPlugins(_0x595c0c){var _0x38427f=[];return new BPromise(function(_0x30b878,_0x3e4747){try{if(_0x595c0c[_0x7a77('0x52')]){return db[_0x7a77('0x69')]['findAll']({'raw':!![]})['then'](function(_0x456614){_0x456614['forEach'](function(_0x429ca8){_0x38427f[_0x7a77('0x5c')](_0x429ca8['id']+0x15b38);});_0x30b878(_0x38427f);});}else{return db['UserProfileResource'][_0x7a77('0x41')]({'where':{'sectionId':_0x595c0c['id']},'raw':!![]})[_0x7a77('0x27')](function(_0x3c8980){_0x3c8980[_0x7a77('0x67')](function(_0x43b20c){_0x38427f[_0x7a77('0x5c')](_0x43b20c[_0x7a77('0x68')]+0x15b38);});_0x30b878(_0x38427f);});}}catch(_0x1ae5b3){_0x3e4747(_0x1ae5b3);}});}exports['addResources']=function(_0x19602d,_0x3b9b76){return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x19602d[_0x7a77('0x44')]['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x3b9b76,null))[_0x7a77('0x27')](function(_0x8c7609){if(_0x8c7609){return db['sequelize'][_0x7a77('0x50')](function(_0x23ff79){return db[_0x7a77('0x5b')][_0x7a77('0x41')]({'where':{'userProfileId':_0x19602d['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4e0d9c){if(_0x4e0d9c){return db[_0x7a77('0x5b')]['destroy']({'where':{'userProfileId':_0x19602d[_0x7a77('0x44')]['id'],'id':_[_0x7a77('0x2d')](_0x4e0d9c,function(_0x3a2879){return _0x3a2879['id'];})},'transaction':_0x23ff79});}})[_0x7a77('0x27')](function(_0x5af588){var _0x26e8f9=_[_0x7a77('0x2d')](_0x19602d[_0x7a77('0x4e')],function(_0x8af969){_0x8af969[_0x7a77('0x56')]=_0x19602d['params']['id'];return _0x8af969;});return db[_0x7a77('0x5b')][_0x7a77('0x6a')](_0x26e8f9,{'raw':!![],'transaction':_0x23ff79});})['then'](function(_0x57ecb2){var _0x3421dd=_[_0x7a77('0x3b')](_[_0x7a77('0x2d')](_0x57ecb2,function(_0x3d1963){return _0x3d1963[_0x7a77('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x3421dd){return db[_0x7a77('0x5b')][_0x7a77('0x41')]({'where':{'userProfileId':_0x19602d[_0x7a77('0x44')]['id'],'sectionId':_[_0x7a77('0x2d')](_0x3421dd,function(_0x2967c3){return _0x2967c3[_0x7a77('0x55')];})},'attributes':['id',_0x7a77('0x55')],'raw':!![]})[_0x7a77('0x27')](function(_0x14ef51){var _0x13e59e=_[_0x7a77('0x2d')](_0x19602d[_0x7a77('0x4e')],function(_0x3ac94a){_0x3ac94a[_0x7a77('0x56')]=_0x19602d[_0x7a77('0x44')]['id'];return _0x3ac94a;});return db[_0x7a77('0x53')]['bulkCreate'](_0x13e59e,{'raw':!![],'transaction':_0x23ff79});});}})[_0x7a77('0x47')](handleError(_0x3b9b76,null));});}})['then'](function(_0x4cfea1){var _0x2d9c8c=_[_0x7a77('0x2d')](_0x4cfea1,function(_0x54eb63){return _0x54eb63[_0x7a77('0x4a')]({'plain':!![]});});})[_0x7a77('0x27')](respondWithResult(_0x3b9b76,null))[_0x7a77('0x47')](handleError(_0x3b9b76,null));};exports[_0x7a77('0x6b')]=function(_0x4830ec,_0x2ea606,_0x30da48){return db[_0x7a77('0x2e')][_0x7a77('0x46')]({'where':{'id':_0x4830ec[_0x7a77('0x44')]['id']}})[_0x7a77('0x27')](handleEntityNotFound(_0x2ea606,null))[_0x7a77('0x27')](function(_0x19d00b){if(_0x19d00b){return _0x19d00b['removeResources'](_0x4830ec[_0x7a77('0x32')]['ids']);}})[_0x7a77('0x27')](respondWithStatusCode(_0x2ea606,null))[_0x7a77('0x47')](handleError(_0x2ea606,null));};exports[_0x7a77('0x6c')]=function(_0x43a00e,_0x4cf50c){var _0x49addf={};if(!_0x43a00e[_0x7a77('0x32')][_0x7a77('0x6d')])throw new Error(_0x7a77('0x6e'));if(!_0x43a00e['query'][_0x7a77('0x37')](_0x7a77('0x6f'))){_0x49addf[_0x7a77('0x22')]=qs['limit'](_0x43a00e[_0x7a77('0x32')]['limit']);_0x49addf[_0x7a77('0x20')]=qs[_0x7a77('0x20')](_0x43a00e[_0x7a77('0x32')][_0x7a77('0x20')]);}return db[_0x7a77('0x2e')]['find']({'where':{'id':_0x43a00e[_0x7a77('0x44')]['id']}})[_0x7a77('0x27')](function(_0x575ed8){if(!_0x575ed8)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x43a00e[_0x7a77('0x44')]['id']);return db['UserProfile']['getResources'](_0x43a00e);})[_0x7a77('0x27')](respondWithFilteredResult(_0x4cf50c,_0x49addf))['catch'](handleError(_0x4cf50c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a8313fc..79959eb 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 _0x66fa=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x66fa,0x117));var _0xa66f=function(_0x4631c4,_0x560c89){_0x4631c4=_0x4631c4-0x0;var _0x467515=_0x66fa[_0x4631c4];return _0x467515;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var UserProfile=require(_0xa66f('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa66f('0x2')](0x0);var events={'afterCreate':_0xa66f('0x3'),'afterUpdate':_0xa66f('0x4'),'afterDestroy':_0xa66f('0x5')};function emitEvent(_0x3d0c49){return function(_0x2a2abf,_0x3f4904,_0x5ebea5){UserProfileEvents['emit'](_0x3d0c49+':'+_0x2a2abf['id'],_0x2a2abf);UserProfileEvents[_0xa66f('0x6')](_0x3d0c49,_0x2a2abf);_0x5ebea5(null);};}for(var e in events){if(events[_0xa66f('0x7')](e)){var event=events[e];UserProfile[_0xa66f('0x8')](e,emitEvent(event));}}module[_0xa66f('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x5fab=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0xc9c555,_0x5d8de7){var _0x5109d9=function(_0x2f5a9d){while(--_0x2f5a9d){_0xc9c555['push'](_0xc9c555['shift']());}};_0x5109d9(++_0x5d8de7);}(_0x5fab,0x177));var _0xb5fa=function(_0x4671a5,_0x1db5f4){_0x4671a5=_0x4671a5-0x0;var _0x12f1ac=_0x5fab[_0x4671a5];return _0x12f1ac;};'use strict';var EventEmitter=require(_0xb5fa('0x0'));var UserProfile=require(_0xb5fa('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb5fa('0x2')](0x0);var events={'afterCreate':_0xb5fa('0x3'),'afterUpdate':_0xb5fa('0x4'),'afterDestroy':_0xb5fa('0x5')};function emitEvent(_0x67e8e8){return function(_0x595d8b,_0x29390a,_0x4341d3){UserProfileEvents[_0xb5fa('0x6')](_0x67e8e8+':'+_0x595d8b['id'],_0x595d8b);UserProfileEvents[_0xb5fa('0x6')](_0x67e8e8,_0x595d8b);_0x4341d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb5fa('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5547869..6163d25 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 _0xf618=['sounds','Sound','tags','Template','triggers','Trigger','Trunk','variables','plugins','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','push','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','ThroughTags','openTabs','true','sms','fax','dataValues','openchannel','whatsapp','lodash','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','Users','role','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule'];(function(_0x5e2407,_0x375bc6){var _0x285838=function(_0x209907){while(--_0x209907){_0x5e2407['push'](_0x5e2407['shift']());}};_0x285838(++_0x375bc6);}(_0xf618,0x1d2));var _0x8f61=function(_0x8b29b3,_0x29ac61){_0x8b29b3=_0x8b29b3-0x0;var _0x294497=_0xf618[_0x8b29b3];return _0x294497;};'use strict';var _=require(_0x8f61('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x8f61('0x1'));module[_0x8f61('0x2')]=function(_0x3bdb81){var _0x193c95=_0x3bdb81[_0x8f61('0x3')];function _0x451612(_0x1bddd4,_0x6c6427){return new Promise(function(_0xa86dc9,_0x1a5f61){if(!_0x6c6427)return _0xa86dc9(null);var _0x2cf43e=_0x6c6427[_0x8f61('0x4')]?{[_0x6c6427[_0x8f61('0x4')][_0x8f61('0x5')]]:_0x6c6427[_0x8f61('0x4')][_0x8f61('0x6')]}:undefined;return _0x193c95[_0x1bddd4][_0x8f61('0x7')]({'where':_0x2cf43e,'raw':!![]})[_0x8f61('0x8')](function(_0x4f1dd8){_0x6c6427[_0x8f61('0x9')]=_[_0x8f61('0xa')](_0x4f1dd8,'id');_0xa86dc9(_0x6c6427);})[_0x8f61('0xb')](function(_0x5891ea){_0x1a5f61(_0x5891ea);});});}function _0x57e1bb(_0x1367b6,_0x4427ec){return new Promise(function(_0x187f80,_0x28a1cc){var _0x578984=_0x1367b6[_0x8f61('0x4')]?{[_0x1367b6[_0x8f61('0x4')]['field']]:_0x1367b6[_0x8f61('0x4')]['value']}:undefined;return _0x193c95[_0x1367b6['model']][_0x8f61('0x7')]({'where':_0x578984,'raw':!![]})[_0x8f61('0x8')](function(_0x5d49b8){_0x4427ec['associatedResources']=_[_0x8f61('0xa')](_0x5d49b8,function(_0x2dd4e3){return _0x2dd4e3[_0x8f61('0xc')];});_0x187f80(_0x4427ec);})[_0x8f61('0xb')](function(_0x3d2da1){_0x28a1cc(_0x3d2da1);});});}function _0x271c5e(_0x4de747,_0x563fbc,_0x4a13d7){if(!_0x563fbc)return Promise[_0x8f61('0xd')](null);return new Promise(function(_0x11b0e3,_0x5d9bb0){return _0x193c95[_0x8f61('0xe')][_0x8f61('0x7')]({'where':{'sectionId':_0x563fbc['id']},'raw':!![]})['then'](function(_0x508afe){if(_0x4de747[_0x8f61('0x5')]&&_0x4de747[_0x8f61('0x5')]!=='id'){_0x563fbc[_0x8f61('0x9')]=_[_0x8f61('0xa')](_0x508afe,function(_0x142803){return _0x142803[_0x4de747[_0x8f61('0x5')]];});}else{if(_0x4a13d7===_0x8f61('0xf')){_0x563fbc['associatedResources']=_[_0x8f61('0xa')](_0x508afe,function(_0x2409c6){return{'id':_0x2409c6[_0x8f61('0x10')],'type':_0x2409c6[_0x8f61('0x11')]};});}else{_0x563fbc[_0x8f61('0x9')]=_[_0x8f61('0xa')](_0x508afe,function(_0x3b193f){return _0x3b193f[_0x8f61('0x10')];});}}_0x11b0e3(_0x563fbc);})['catch'](function(_0xe19d){_0x5d9bb0(_0xe19d);});});}function _0x7c99a2(_0x48dd5c,_0x1bca69){var _0x3a9776={'parentSections':[]};switch(_0x48dd5c['toLowerCase']()){case _0x8f61('0x12'):_0x3a9776['childModel']=_0x8f61('0x13');break;case _0x8f61('0x14'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x16');break;case'squarerecordings':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x17');_0x3a9776[_0x8f61('0x18')]=[{'name':_0x8f61('0x19'),'field':_0x8f61('0xc'),'foreignKey':'projectName'}];break;case _0x8f61('0x1a'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x1b');break;case _0x8f61('0x1c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x1d');_0x3a9776['parentSections']=[{'name':_0x8f61('0x1e'),'field':'id','foreignKey':_0x8f61('0x1f')}];break;case _0x8f61('0x20'):_0x3a9776[_0x8f61('0x15')]='CmList';break;case'companies':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x21');break;case _0x8f61('0x22'):_0x3a9776['childModel']=_0x8f61('0x23');break;case _0x8f61('0x24'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x25');break;case _0x8f61('0x26'):_0x3a9776[_0x8f61('0x15')]='ChatWebsite';break;case _0x8f61('0x27'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x28');break;case'faxaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x29');break;case _0x8f61('0x2a'):case _0x8f61('0x2b'):case'outboundroutes':_0x3a9776[_0x8f61('0x15')]='VoiceExtension';break;case _0x8f61('0x2c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x2d');break;case _0x8f61('0x2e'):_0x3a9776[_0x8f61('0x15')]='VoiceMail';break;case _0x8f61('0x2f'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x30');_0x3a9776[_0x8f61('0x18')]=[{'name':_0x8f61('0x31'),'field':_0x8f61('0xc'),'foreignKey':'membername','model':_0x8f61('0x32'),'filter':{'field':'role','value':[_0x8f61('0x33')]}},{'name':_0x8f61('0x34'),'field':'name','foreignKey':_0x8f61('0x35'),'model':_0x8f61('0x32'),'filter':{'field':'role','value':[_0x8f61('0x36')]}},{'name':_0x8f61('0x37'),'field':_0x8f61('0xc'),'foreignKey':_0x8f61('0x38'),'model':_0x8f61('0x39'),'filter':{'field':'type','value':[_0x8f61('0x3a')]}},{'name':_0x8f61('0x3b'),'field':'name','foreignKey':_0x8f61('0x38'),'model':_0x8f61('0x39'),'filter':{'field':'type','value':['outbound']}}];break;case'musiconholds':_0x3a9776['childModel']=_0x8f61('0x3c');break;case'chanspies':_0x3a9776[_0x8f61('0x15')]='VoiceChanSpy';break;case _0x8f61('0x3d'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x3e');break;case _0x8f61('0x3f'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x40');break;case'mailqueues':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x41');break;case'mailaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x42');break;case'mailsubstatuses':_0x3a9776[_0x8f61('0x15')]='MailSubstatus';break;case _0x8f61('0x43'):_0x3a9776[_0x8f61('0x15')]='OpenchannelQueue';break;case _0x8f61('0x44'):_0x3a9776['childModel']=_0x8f61('0x45');break;case _0x8f61('0x46'):_0x3a9776['childModel']='SmsQueue';break;case _0x8f61('0x47'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x48');break;case _0x8f61('0x49'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x4a');break;case _0x8f61('0x4b'):_0x3a9776['childModel']=_0x8f61('0x4c');break;case _0x8f61('0x4d'):_0x3a9776['childModel']=_0x8f61('0x4e');break;case _0x8f61('0x4f'):case _0x8f61('0x50'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x39');if(_0x1bca69){_0x3a9776[_0x8f61('0x18')]=[{'name':'VoiceQueues'},{'name':_0x8f61('0x3b')}];}break;case'users':case _0x8f61('0x51'):case'telephones':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x32');if(_0x1bca69){_0x3a9776['parentSections']=[{'name':_0x8f61('0x52'),'filter':{'field':_0x8f61('0x53'),'value':[_0x8f61('0x54'),_0x8f61('0x55')]},'ignore':!![]},{'name':_0x8f61('0x31')},{'name':_0x8f61('0x34')}];}break;case'zendeskaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x56');break;case _0x8f61('0x57'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x58');break;case _0x8f61('0x59'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x5a');break;case'sugarcrmaccounts':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x5b');break;case _0x8f61('0x5c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x5d');break;case'zohoaccounts':_0x3a9776[_0x8f61('0x15')]='ZohoAccount';break;case _0x8f61('0x5e'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x32');break;case'cannedanswers':_0x3a9776[_0x8f61('0x15')]='CannedAnswer';break;case _0x8f61('0x5f'):_0x3a9776['childModel']='Disposition';break;case _0x8f61('0x60'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x61');break;case _0x8f61('0x62'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x63');break;case _0x8f61('0x64'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x65');break;case _0x8f61('0x66'):_0x3a9776['childModel']=_0x8f61('0x67');break;case _0x8f61('0x68'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x69');break;case _0x8f61('0x6a'):_0x3a9776[_0x8f61('0x15')]='Tag';break;case'templates':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x6b');break;case _0x8f61('0x6c'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x6d');break;case'trunks':_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x6e');break;case _0x8f61('0x6f'):_0x3a9776[_0x8f61('0x15')]='Variable';break;case _0x8f61('0x70'):_0x3a9776[_0x8f61('0x15')]='Plugin';break;case _0x8f61('0x71'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0xf');_0x3a9776[_0x8f61('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0x8f61('0x72')}];break;case _0x8f61('0x73'):_0x3a9776[_0x8f61('0x15')]=_0x8f61('0x74');break;}return _0x3a9776;}function _0x5e8c09(_0x567af3,_0x5a79ac){var _0x5492e4=_0x567af3[_0x8f61('0x75')](0x0)[_0x8f61('0x76')]()+_0x567af3[_0x8f61('0x77')](0x1);var _0x470dc4={'type':_0x193c95[_0x8f61('0x78')]['QueryTypes'][_0x8f61('0x79')],'raw':!![]};return new Promise(function(_0x51e0d6,_0x3ec0d0){var _0x1ff700=squel[_0x8f61('0x7a')]()[_0x8f61('0x5')](_0x8f61('0x7b')+_0x5492e4+_0x8f61('0x7c'),'id')[_0x8f61('0x5')]('ui.createdAt')[_0x8f61('0x7d')]('user_has_'+_0x567af3+_0x8f61('0x7e'),'ui')[_0x8f61('0x7f')](_0x8f61('0x80'),_0x5a79ac['id']);return _0x193c95['sequelize'][_0x8f61('0x81')](_0x1ff700[_0x8f61('0x82')](),_0x470dc4)[_0x8f61('0x8')](function(_0x315990){_0x5a79ac[_0x5492e4+_0x8f61('0x83')]=_0x315990;_0x51e0d6(_0x315990);})[_0x8f61('0xb')](function(_0x5a2c9f){_0x3ec0d0(_0x5a2c9f);});});}return _0x3bdb81[_0x8f61('0x84')](_0x8f61('0x85'),attributes,{'tableName':_0x8f61('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x203e28){var _0x35952c=require(_0x8f61('0x87'));var _0x4832bc={'raw':_0x203e28[_0x8f61('0x81')][_0x8f61('0x88')],'where':{}};var _0x954566={};var _0xeb1696={'count':0x0,'rows':[]};var _0x577bf6=_0x203e28[_0x8f61('0x81')][_0x8f61('0x89')];var _0x208fcd=_0x203e28[_0x8f61('0x81')][_0x8f61('0x8a')]||![];var _0x9e8ecd=_0x7c99a2(_0x577bf6,_0x208fcd);if(!_0x9e8ecd[_0x8f61('0x15')])throw new Error(_0x8f61('0x8b')+_0x577bf6+'\x27');var _0x4cc6f4=[{'name':_0x577bf6}];if(!_[_0x8f61('0x8c')](_0x9e8ecd['parentSections']))_0x4cc6f4=_0x9e8ecd[_0x8f61('0x18')];var _0x3cd117=[];for(var _0x4f1468=0x0;_0x4f1468<_0x4cc6f4[_0x8f61('0x8d')];_0x4f1468++){_0x3cd117['push'](_0x193c95['UserProfileSection'][_0x8f61('0x8e')]({'where':{'userProfileId':_0x203e28[_0x8f61('0x8f')]['id'],'name':_0x4cc6f4[_0x4f1468][_0x8f61('0xc')]},'raw':!![]}));}return Promise[_0x8f61('0x90')](_0x3cd117)['then'](function(_0x2bb81e){var _0x1c20f2=_[_0x8f61('0x4')](_0x2bb81e,function(_0x4b7c32){return _0x4b7c32?_0x4b7c32:undefined;});var _0x1d1281=_[_0x8f61('0x4')](_0x4cc6f4,[_0x8f61('0x91'),!![]]);var _0x42b2f3=_[_0x8f61('0x8c')](_0x1c20f2)&&_[_0x8f61('0x8c')](_0x1d1281)?null:_['union'](_0x1d1281,_0x1c20f2);if(!_0x42b2f3)return null;var _0x513dd5=[];for(var _0x4e7696=0x0;_0x4e7696<_0x42b2f3[_0x8f61('0x8d')];_0x4e7696++){var _0x1d1b92=_[_0x8f61('0x8e')](_0x4cc6f4,function(_0x13681f){return _0x42b2f3[_0x4e7696]?_0x13681f[_0x8f61('0xc')]===_0x42b2f3[_0x4e7696][_0x8f61('0xc')]:null;});if(_0x1d1b92){if(_0x42b2f3[_0x4e7696]['ignore']){_0x513dd5[_0x8f61('0x92')](_0x451612(_0x9e8ecd[_0x8f61('0x15')],_0x42b2f3[_0x4e7696]));}else{if(!_0x42b2f3[_0x4e7696][_0x8f61('0x93')]){_0x513dd5[_0x8f61('0x92')](_0x271c5e(_0x1d1b92,_0x42b2f3[_0x4e7696],_0x9e8ecd[_0x8f61('0x15')]));}else{if(_0x1d1b92[_0x8f61('0x94')]){_0x513dd5[_0x8f61('0x92')](_0x57e1bb(_0x1d1b92,_0x42b2f3[_0x4e7696]));}}}}}return Promise[_0x8f61('0x90')](_0x513dd5);})['then'](function(_0x9e3e15){var _0xe2e715=_0x9e3e15;var _0x4bbc94=null;if(_0xe2e715){_0x4bbc94=_0xe2e715['length']===0x1?_0xe2e715[0x0]:null;}if(!_0x4bbc94&&!_0xe2e715)return _0xeb1696;var _0x48b4ca=_0x193c95[_0x9e8ecd[_0x8f61('0x15')]][_0x8f61('0x95')];_0x954566[_0x8f61('0x94')]=_[_0x8f61('0x96')](_0x48b4ca);_0x954566[_0x8f61('0x81')]=_[_0x8f61('0x96')](_0x203e28[_0x8f61('0x81')]);_0x954566['filters']=_[_0x8f61('0x97')](_0x954566[_0x8f61('0x94')],_0x954566[_0x8f61('0x81')]);_0x4832bc[_0x8f61('0x98')]=_[_0x8f61('0x97')](_0x954566[_0x8f61('0x94')],_0x35952c['fields'](_0x203e28['query'][_0x8f61('0x99')]));_0x4832bc[_0x8f61('0x98')]=_0x4832bc[_0x8f61('0x98')][_0x8f61('0x8d')]?_0x4832bc[_0x8f61('0x98')]:_0x954566[_0x8f61('0x94')];if(!_0x203e28[_0x8f61('0x81')][_0x8f61('0x9a')](_0x8f61('0x9b'))){_0x4832bc[_0x8f61('0x9c')]=_0x35952c[_0x8f61('0x9c')](_0x203e28[_0x8f61('0x81')][_0x8f61('0x9c')]);_0x4832bc['offset']=_0x35952c[_0x8f61('0x9d')](_0x203e28[_0x8f61('0x81')]['offset']);}_0x4832bc[_0x8f61('0x9e')]=_0x35952c[_0x8f61('0x9f')](_0x203e28['query'][_0x8f61('0x9f')]);_0x4832bc[_0x8f61('0x7f')]=_0x35952c[_0x8f61('0xa0')](_[_0x8f61('0xa1')](_0x203e28[_0x8f61('0x81')],_0x954566['filters']));if(_0x203e28['query'][_0x8f61('0x4')]){_0x4832bc[_0x8f61('0x7f')]=_['merge'](_0x4832bc[_0x8f61('0x7f')],{'$or':_[_0x8f61('0xa')](_0x48b4ca,function(_0x306089){if(_0x306089[_0x8f61('0x11')]['key']!==_0x8f61('0xa2')){var _0x36de75={};_0x36de75[_0x306089[_0x8f61('0x5')]]={'$like':'%'+_0x203e28['query'][_0x8f61('0x4')]+'%'};return _0x36de75;}})});}var _0x4b4be9=[];var _0x5ed69f=null;var _0x5c9521={};if(_0x4bbc94){_0x5ed69f=_['find'](_0x4cc6f4,['name',_0x4bbc94[_0x8f61('0xc')]]);if(_0x5ed69f[_0x8f61('0x5')]){_0x5c9521={};if(_0x9e8ecd[_0x8f61('0x15')]===_0x8f61('0xf')){_0x5c9521[_0x5ed69f['foreignKey']]=_['map'](_0x4bbc94[_0x8f61('0x9')],'id');}else{_0x5c9521[_0x5ed69f[_0x8f61('0xa3')]]=_0x4bbc94[_0x8f61('0x9')];}_0x4b4be9[_0x8f61('0x92')](_0x5c9521);}else{_0x4832bc[_0x8f61('0x7f')]['id']=_0x4bbc94['associatedResources'];}}else{for(var _0x414cc2=0x0;_0x414cc2<_0xe2e715[_0x8f61('0x8d')];_0x414cc2++){_0x5ed69f=_[_0x8f61('0x8e')](_0x4cc6f4,[_0x8f61('0xc'),_0xe2e715[_0x414cc2]['name']]);if(_0x5ed69f[_0x8f61('0x5')]){_0x5c9521={};_0x5c9521[_0x5ed69f[_0x8f61('0xa3')]]=_0xe2e715[_0x414cc2][_0x8f61('0x9')];_0x4b4be9[_0x8f61('0x92')](_0x5c9521);}else{if(!_0x4832bc['where']['id'])_0x4832bc[_0x8f61('0x7f')]['id']=[];_0xe2e715[_0x414cc2]['associatedResources'][_0x8f61('0xa4')](function(_0x28f18e){_0x4832bc[_0x8f61('0x7f')]['id'][_0x8f61('0x92')](_0x28f18e);});}}}if(!_[_0x8f61('0x8c')](_0x4b4be9)){_0x4832bc[_0x8f61('0x7f')]=_[_0x8f61('0xa5')](_0x4832bc[_0x8f61('0x7f')],{'$and':{'$or':_0x4b4be9}});}_0x4832bc=_[_0x8f61('0xa5')]({},_0x4832bc,_0x203e28[_0x8f61('0xa6')]);if(_0x4bbc94&&!_0x4bbc94[_0x8f61('0x93')]&&_0x9e8ecd[_0x8f61('0x15')]==='AnalyticExtractedReport'){if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xa7')]){_0x4832bc[_0x8f61('0xa8')]=[{'all':!![]}];}return _0x193c95[_0x9e8ecd[_0x8f61('0x15')]]['findAll'](_0x4832bc)[_0x8f61('0x8')](function(_0x24812b){var _0x4f16c6=[];_0x24812b[_0x8f61('0xa4')](function(_0x5e2056){var _0x1db45a;switch(_0x5e2056[_0x8f61('0xa9')]){case _0x8f61('0xaa'):_0x1db45a=_['find'](_0x4bbc94[_0x8f61('0x9')],function(_0x25d04b){return _0x25d04b['id']===_0x5e2056[_0x8f61('0x72')]&&_0x25d04b['type']===_0x8f61('0xab');});break;case _0x8f61('0xac'):_0x1db45a=_['find'](_0x4bbc94[_0x8f61('0x9')],function(_0x2fe1ec){return _0x2fe1ec['id']===_0x5e2056[_0x8f61('0x72')]&&_0x2fe1ec[_0x8f61('0x11')]==='CustomReports';});break;}if(_0x1db45a)_0x4f16c6[_0x8f61('0x92')](_0x5e2056);});_0xeb1696[_0x8f61('0xad')]=_0x4f16c6[_0x8f61('0x8d')];_0xeb1696[_0x8f61('0xae')]=_0x4f16c6;return _0xeb1696;});}else{if(!_[_0x8f61('0x8c')](_0x203e28[_0x8f61('0x81')]['ids'])){_0x4832bc[_0x8f61('0x7f')]['id']=_0x4832bc[_0x8f61('0x7f')]['id']?_['intersection'](_0x4832bc[_0x8f61('0x7f')]['id'],_0x203e28[_0x8f61('0x81')][_0x8f61('0xaf')]):_0x203e28[_0x8f61('0x81')][_0x8f61('0xaf')];if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xb0')]){_0x4832bc['order']=_0x203e28[_0x8f61('0x81')][_0x8f61('0xb0')];}}if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xb1')]){_0x4832bc[_0x8f61('0x7f')]=_[_0x8f61('0xa5')](_0x4832bc[_0x8f61('0x7f')],{'$and':_0x203e28['query'][_0x8f61('0xb1')]});}return _0x193c95[_0x9e8ecd[_0x8f61('0x15')]][_0x8f61('0xad')]({'where':_0x4832bc[_0x8f61('0x7f')]})[_0x8f61('0x8')](function(_0x3735cd){_0xeb1696['count']=_0x3735cd;if(_0x203e28[_0x8f61('0x81')][_0x8f61('0xa7')]){if(_0x9e8ecd['childModel']===_0x8f61('0x1d')){_0x4832bc[_0x8f61('0xa8')]=[{'model':_0x193c95[_0x8f61('0xb2')],'as':_0x8f61('0xb3'),'attributes':['id',_0x8f61('0xc'),_0x8f61('0xb4')],'required':_0x203e28[_0x8f61('0x81')][_0x8f61('0xb5')]?!![]:![]},{'model':_0x193c95[_0x8f61('0xb2')],'as':_0x8f61('0xb6'),'attributes':['id',_0x8f61('0xc'),_0x8f61('0xb4')],'through':_0x203e28[_0x8f61('0x81')][_0x8f61('0xb5')]?{'attributes':[],'where':{'TagId':_0x203e28[_0x8f61('0x81')][_0x8f61('0xb5')]||undefined}}:{},'required':_0x203e28['query'][_0x8f61('0xb5')]?!![]:![]}];}else{_0x4832bc[_0x8f61('0xa8')]=[{'all':!![]}];}}return _0x193c95[_0x9e8ecd['childModel']][_0x8f61('0x7')](_0x4832bc);})[_0x8f61('0x8')](function(_0x49c391){_0xeb1696[_0x8f61('0xae')]=_0x49c391;if(_0x577bf6===_0x8f61('0x31')&&_0x203e28[_0x8f61('0x81')][_0x8f61('0xb7')]===_0x8f61('0xb8')){var _0x2be95d=[];for(var _0x3cda78=0x0;_0x3cda78<_0xeb1696[_0x8f61('0xae')][_0x8f61('0x8d')];_0x3cda78++){_0x2be95d[_0x8f61('0x92')](_0x5e8c09('chat',_0xeb1696[_0x8f61('0xae')][_0x3cda78]['dataValues']));_0x2be95d[_0x8f61('0x92')](_0x5e8c09(_0x8f61('0xb9'),_0xeb1696[_0x8f61('0xae')][_0x3cda78]['dataValues']));_0x2be95d['push'](_0x5e8c09(_0x8f61('0xba'),_0xeb1696['rows'][_0x3cda78][_0x8f61('0xbb')]));_0x2be95d['push'](_0x5e8c09('mail',_0xeb1696[_0x8f61('0xae')][_0x3cda78]['dataValues']));_0x2be95d[_0x8f61('0x92')](_0x5e8c09(_0x8f61('0xbc'),_0xeb1696[_0x8f61('0xae')][_0x3cda78][_0x8f61('0xbb')]));_0x2be95d[_0x8f61('0x92')](_0x5e8c09(_0x8f61('0xbd'),_0xeb1696[_0x8f61('0xae')][_0x3cda78][_0x8f61('0xbb')]));}return Promise[_0x8f61('0x90')](_0x2be95d)['then'](function(){return _0xeb1696;});}return _0xeb1696;});}});}}});}; \ No newline at end of file +var _0xc7ba=['params','all','ignore','union','length','autoAssociation','push','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','VIRTUAL','foreignKey','forEach','merge','includeAll','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','tag','ThroughTags','color','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','map','model','findAll','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareRecording','parentSections','projectName','projects','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','Plugin','extractedreports','AnalyticExtractedReport','reportId','toUpperCase','slice','QueryTypes','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','query','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','find'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc7ba,0x1b1));var _0xac7b=function(_0x1da907,_0x44795f){_0x1da907=_0x1da907-0x0;var _0x4c9cca=_0xc7ba[_0x1da907];return _0x4c9cca;};'use strict';var _=require(_0xac7b('0x0'));var attributes=require(_0xac7b('0x1'));var squel=require(_0xac7b('0x2'));module[_0xac7b('0x3')]=function(_0x3a4ea3){var _0x1671d7=_0x3a4ea3[_0xac7b('0x4')];function _0x7f656d(_0x21367a,_0xe72920){return new Promise(function(_0xf0073e,_0x2fb273){if(!_0xe72920)return _0xf0073e(null);var _0x2e02c2=_0xe72920[_0xac7b('0x5')]?{[_0xe72920['filter'][_0xac7b('0x6')]]:_0xe72920[_0xac7b('0x5')][_0xac7b('0x7')]}:undefined;return _0x1671d7[_0x21367a]['findAll']({'where':_0x2e02c2,'raw':!![]})[_0xac7b('0x8')](function(_0x52452f){_0xe72920[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x52452f,'id');_0xf0073e(_0xe72920);})['catch'](function(_0xce0e3d){_0x2fb273(_0xce0e3d);});});}function _0x24e696(_0x1591a1,_0x13617e){return new Promise(function(_0x5662b2,_0x1dc9a5){var _0x3e68d7=_0x1591a1[_0xac7b('0x5')]?{[_0x1591a1['filter']['field']]:_0x1591a1['filter'][_0xac7b('0x7')]}:undefined;return _0x1671d7[_0x1591a1[_0xac7b('0xb')]][_0xac7b('0xc')]({'where':_0x3e68d7,'raw':!![]})[_0xac7b('0x8')](function(_0x3304aa){_0x13617e[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x3304aa,function(_0x160dcc){return _0x160dcc[_0xac7b('0xd')];});_0x5662b2(_0x13617e);})[_0xac7b('0xe')](function(_0x39087f){_0x1dc9a5(_0x39087f);});});}function _0x4373c1(_0xa742cd,_0x250006,_0x3fc6a9){if(!_0x250006)return Promise[_0xac7b('0xf')](null);return new Promise(function(_0x58e185,_0xd47e99){return _0x1671d7[_0xac7b('0x10')][_0xac7b('0xc')]({'where':{'sectionId':_0x250006['id']},'raw':!![]})[_0xac7b('0x8')](function(_0x15508d){if(_0xa742cd[_0xac7b('0x6')]&&_0xa742cd['field']!=='id'){_0x250006[_0xac7b('0x9')]=_[_0xac7b('0xa')](_0x15508d,function(_0x38e206){return _0x38e206[_0xa742cd[_0xac7b('0x6')]];});}else{if(_0x3fc6a9==='AnalyticExtractedReport'){_0x250006['associatedResources']=_[_0xac7b('0xa')](_0x15508d,function(_0x257101){return{'id':_0x257101[_0xac7b('0x11')],'type':_0x257101[_0xac7b('0x12')]};});}else{_0x250006['associatedResources']=_[_0xac7b('0xa')](_0x15508d,function(_0x236866){return _0x236866[_0xac7b('0x11')];});}}_0x58e185(_0x250006);})[_0xac7b('0xe')](function(_0x383a43){_0xd47e99(_0x383a43);});});}function _0x50d370(_0xf0a6c5,_0x578ba9){var _0x54769b={'parentSections':[]};switch(_0xf0a6c5[_0xac7b('0x13')]()){case _0xac7b('0x14'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x16');break;case'odbc':_0x54769b[_0xac7b('0x15')]='SquareOdbc';break;case'squarerecordings':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x17');_0x54769b[_0xac7b('0x18')]=[{'name':'SquareProjects','field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x19')}];break;case _0xac7b('0x1a'):_0x54769b[_0xac7b('0x15')]='JscriptyProject';break;case'contacts':_0x54769b[_0xac7b('0x15')]='CmContact';_0x54769b[_0xac7b('0x18')]=[{'name':_0xac7b('0x1b'),'field':'id','foreignKey':_0xac7b('0x1c')}];break;case _0xac7b('0x1d'):_0x54769b[_0xac7b('0x15')]='CmList';break;case _0xac7b('0x1e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x1f');break;case'globalcustomfields':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x20');break;case _0xac7b('0x21'):_0x54769b[_0xac7b('0x15')]='ChatQueue';break;case'chatwebsites':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x22');break;case _0xac7b('0x23'):_0x54769b['childModel']=_0xac7b('0x24');break;case _0xac7b('0x25'):_0x54769b['childModel']=_0xac7b('0x26');break;case'inboundroutes':case _0xac7b('0x27'):case _0xac7b('0x28'):_0x54769b[_0xac7b('0x15')]='VoiceExtension';break;case'contexts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x29');break;case'voicemails':_0x54769b['childModel']=_0xac7b('0x2a');break;case _0xac7b('0x2b'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2c');_0x54769b[_0xac7b('0x18')]=[{'name':'Agents','field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x2d'),'model':_0xac7b('0x2e'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x30')]}},{'name':_0xac7b('0x31'),'field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x2d'),'model':_0xac7b('0x2e'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x32')]}},{'name':_0xac7b('0x33'),'field':_0xac7b('0xd'),'foreignKey':_0xac7b('0x34'),'model':'VoiceQueue','filter':{'field':_0xac7b('0x12'),'value':[_0xac7b('0x35')]}},{'name':_0xac7b('0x36'),'field':'name','foreignKey':_0xac7b('0x34'),'model':_0xac7b('0x37'),'filter':{'field':'type','value':[_0xac7b('0x38')]}}];break;case _0xac7b('0x39'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3a');break;case _0xac7b('0x3b'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3c');break;case _0xac7b('0x3d'):_0x54769b['childModel']=_0xac7b('0x3e');break;case'ivrcampaigns':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x3f');break;case _0xac7b('0x40'):_0x54769b['childModel']=_0xac7b('0x41');break;case _0xac7b('0x42'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x43');break;case _0xac7b('0x44'):_0x54769b['childModel']=_0xac7b('0x45');break;case _0xac7b('0x46'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x47');break;case _0xac7b('0x48'):_0x54769b['childModel']=_0xac7b('0x49');break;case _0xac7b('0x4a'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4b');break;case'smsaccounts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4c');break;case'whatsappqueues':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4d');break;case _0xac7b('0x4e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x4f');break;case _0xac7b('0x50'):_0x54769b['childModel']=_0xac7b('0x51');break;case _0xac7b('0x52'):case _0xac7b('0x53'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x37');if(_0x578ba9){_0x54769b[_0xac7b('0x18')]=[{'name':'VoiceQueues'},{'name':_0xac7b('0x36')}];}break;case _0xac7b('0x54'):case _0xac7b('0x55'):case _0xac7b('0x56'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2e');if(_0x578ba9){_0x54769b[_0xac7b('0x18')]=[{'name':_0xac7b('0x57'),'filter':{'field':_0xac7b('0x2f'),'value':[_0xac7b('0x58'),_0xac7b('0x59')]},'ignore':!![]},{'name':_0xac7b('0x5a')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x54769b['childModel']=_0xac7b('0x5b');break;case _0xac7b('0x5c'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x5d');break;case _0xac7b('0x5e'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x5f');break;case'sugarcrmaccounts':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x60');break;case _0xac7b('0x61'):_0x54769b['childModel']='DeskAccount';break;case _0xac7b('0x62'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x63');break;case _0xac7b('0x64'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x2e');break;case _0xac7b('0x65'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x66');break;case _0xac7b('0x67'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x68');break;case _0xac7b('0x69'):_0x54769b['childModel']=_0xac7b('0x6a');break;case'intervals':_0x54769b['childModel']=_0xac7b('0x6b');break;case'pauses':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x6c');break;case _0xac7b('0x6d'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x6e');break;case _0xac7b('0x6f'):_0x54769b['childModel']='Sound';break;case _0xac7b('0x70'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x71');break;case _0xac7b('0x72'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x73');break;case _0xac7b('0x74'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x75');break;case _0xac7b('0x76'):_0x54769b['childModel']=_0xac7b('0x77');break;case'variables':_0x54769b['childModel']=_0xac7b('0x78');break;case'plugins':_0x54769b[_0xac7b('0x15')]=_0xac7b('0x79');break;case _0xac7b('0x7a'):_0x54769b[_0xac7b('0x15')]=_0xac7b('0x7b');_0x54769b[_0xac7b('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xac7b('0x7c')}];break;case'metrics':_0x54769b['childModel']='AnalyticMetric';break;}return _0x54769b;}function _0x616678(_0x35a45e,_0x3a40a9){var _0x40ff6c=_0x35a45e['charAt'](0x0)[_0xac7b('0x7d')]()+_0x35a45e[_0xac7b('0x7e')](0x1);var _0x2f1448={'type':_0x1671d7['Sequelize'][_0xac7b('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x3ede66,_0x366a1a){var _0x4392fa=squel['select']()[_0xac7b('0x6')](_0xac7b('0x80')+_0x40ff6c+_0xac7b('0x81'),'id')[_0xac7b('0x6')](_0xac7b('0x82'))[_0xac7b('0x83')](_0xac7b('0x84')+_0x35a45e+'_interactions','ui')[_0xac7b('0x85')](_0xac7b('0x86'),_0x3a40a9['id']);return _0x1671d7['sequelize']['query'](_0x4392fa[_0xac7b('0x87')](),_0x2f1448)[_0xac7b('0x8')](function(_0x483312){_0x3a40a9[_0x40ff6c+_0xac7b('0x88')]=_0x483312;_0x3ede66(_0x483312);})['catch'](function(_0x5ee276){_0x366a1a(_0x5ee276);});});}return _0x3a4ea3[_0xac7b('0x89')]('UserProfile',attributes,{'tableName':_0xac7b('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2145e8){var _0x77afa3=require(_0xac7b('0x8b'));var _0x29d341={'raw':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x8d')],'where':{}};var _0x231b7f={};var _0x37969f={'count':0x0,'rows':[]};var _0x21842d=_0x2145e8[_0xac7b('0x8c')]['section'];var _0x303945=_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x8e')]||![];var _0x5c7873=_0x50d370(_0x21842d,_0x303945);if(!_0x5c7873[_0xac7b('0x15')])throw new Error(_0xac7b('0x8f')+_0x21842d+'\x27');var _0x21d17d=[{'name':_0x21842d}];if(!_[_0xac7b('0x90')](_0x5c7873[_0xac7b('0x18')]))_0x21d17d=_0x5c7873[_0xac7b('0x18')];var _0x1337fe=[];for(var _0x3aee0d=0x0;_0x3aee0d<_0x21d17d['length'];_0x3aee0d++){_0x1337fe['push'](_0x1671d7['UserProfileSection'][_0xac7b('0x91')]({'where':{'userProfileId':_0x2145e8[_0xac7b('0x92')]['id'],'name':_0x21d17d[_0x3aee0d][_0xac7b('0xd')]},'raw':!![]}));}return Promise[_0xac7b('0x93')](_0x1337fe)[_0xac7b('0x8')](function(_0x3ee4f0){var _0x427c63=_['filter'](_0x3ee4f0,function(_0x504a59){return _0x504a59?_0x504a59:undefined;});var _0x29d74d=_[_0xac7b('0x5')](_0x21d17d,[_0xac7b('0x94'),!![]]);var _0x1c0a03=_['isEmpty'](_0x427c63)&&_[_0xac7b('0x90')](_0x29d74d)?null:_[_0xac7b('0x95')](_0x29d74d,_0x427c63);if(!_0x1c0a03)return null;var _0xca6e30=[];for(var _0x1dda09=0x0;_0x1dda09<_0x1c0a03[_0xac7b('0x96')];_0x1dda09++){var _0x14f5e3=_[_0xac7b('0x91')](_0x21d17d,function(_0x3849e6){return _0x1c0a03[_0x1dda09]?_0x3849e6[_0xac7b('0xd')]===_0x1c0a03[_0x1dda09][_0xac7b('0xd')]:null;});if(_0x14f5e3){if(_0x1c0a03[_0x1dda09][_0xac7b('0x94')]){_0xca6e30['push'](_0x7f656d(_0x5c7873[_0xac7b('0x15')],_0x1c0a03[_0x1dda09]));}else{if(!_0x1c0a03[_0x1dda09][_0xac7b('0x97')]){_0xca6e30[_0xac7b('0x98')](_0x4373c1(_0x14f5e3,_0x1c0a03[_0x1dda09],_0x5c7873[_0xac7b('0x15')]));}else{if(_0x14f5e3[_0xac7b('0xb')]){_0xca6e30[_0xac7b('0x98')](_0x24e696(_0x14f5e3,_0x1c0a03[_0x1dda09]));}}}}}return Promise[_0xac7b('0x93')](_0xca6e30);})[_0xac7b('0x8')](function(_0x3219bf){var _0x734297=_0x3219bf;var _0x3e176c=null;if(_0x734297){_0x3e176c=_0x734297[_0xac7b('0x96')]===0x1?_0x734297[0x0]:null;}if(!_0x3e176c&&!_0x734297)return _0x37969f;var _0x1d1662=_0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0x99')];_0x231b7f['model']=_[_0xac7b('0x9a')](_0x1d1662);_0x231b7f[_0xac7b('0x8c')]=_['keys'](_0x2145e8[_0xac7b('0x8c')]);_0x231b7f[_0xac7b('0x9b')]=_[_0xac7b('0x9c')](_0x231b7f['model'],_0x231b7f[_0xac7b('0x8c')]);_0x29d341[_0xac7b('0x9d')]=_[_0xac7b('0x9c')](_0x231b7f[_0xac7b('0xb')],_0x77afa3[_0xac7b('0x9e')](_0x2145e8['query'][_0xac7b('0x9e')]));_0x29d341['attributes']=_0x29d341[_0xac7b('0x9d')][_0xac7b('0x96')]?_0x29d341[_0xac7b('0x9d')]:_0x231b7f['model'];if(!_0x2145e8[_0xac7b('0x8c')][_0xac7b('0x9f')](_0xac7b('0xa0'))){_0x29d341['limit']=_0x77afa3[_0xac7b('0xa1')](_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xa1')]);_0x29d341['offset']=_0x77afa3[_0xac7b('0xa2')](_0x2145e8['query'][_0xac7b('0xa2')]);}_0x29d341[_0xac7b('0xa3')]=_0x77afa3[_0xac7b('0xa4')](_0x2145e8[_0xac7b('0x8c')]['sort']);_0x29d341[_0xac7b('0x85')]=_0x77afa3['filters'](_['pick'](_0x2145e8[_0xac7b('0x8c')],_0x231b7f[_0xac7b('0x9b')]));if(_0x2145e8[_0xac7b('0x8c')]['filter']){_0x29d341[_0xac7b('0x85')]=_['merge'](_0x29d341['where'],{'$or':_[_0xac7b('0xa')](_0x1d1662,function(_0x92652e){if(_0x92652e['type']['key']!==_0xac7b('0xa5')){var _0x25d1a9={};_0x25d1a9[_0x92652e[_0xac7b('0x6')]]={'$like':'%'+_0x2145e8[_0xac7b('0x8c')]['filter']+'%'};return _0x25d1a9;}})});}var _0x2db8d2=[];var _0x520650=null;var _0x2d55e1={};if(_0x3e176c){_0x520650=_['find'](_0x21d17d,[_0xac7b('0xd'),_0x3e176c[_0xac7b('0xd')]]);if(_0x520650[_0xac7b('0x6')]){_0x2d55e1={};if(_0x5c7873[_0xac7b('0x15')]===_0xac7b('0x7b')){_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_[_0xac7b('0xa')](_0x3e176c['associatedResources'],'id');}else{_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_0x3e176c['associatedResources'];}_0x2db8d2[_0xac7b('0x98')](_0x2d55e1);}else{_0x29d341[_0xac7b('0x85')]['id']=_0x3e176c[_0xac7b('0x9')];}}else{for(var _0x344b6f=0x0;_0x344b6f<_0x734297[_0xac7b('0x96')];_0x344b6f++){_0x520650=_[_0xac7b('0x91')](_0x21d17d,['name',_0x734297[_0x344b6f][_0xac7b('0xd')]]);if(_0x520650[_0xac7b('0x6')]){_0x2d55e1={};_0x2d55e1[_0x520650[_0xac7b('0xa6')]]=_0x734297[_0x344b6f][_0xac7b('0x9')];_0x2db8d2['push'](_0x2d55e1);}else{if(!_0x29d341[_0xac7b('0x85')]['id'])_0x29d341[_0xac7b('0x85')]['id']=[];_0x734297[_0x344b6f][_0xac7b('0x9')][_0xac7b('0xa7')](function(_0x1ebd77){_0x29d341['where']['id']['push'](_0x1ebd77);});}}}if(!_['isEmpty'](_0x2db8d2)){_0x29d341[_0xac7b('0x85')]=_['merge'](_0x29d341['where'],{'$and':{'$or':_0x2db8d2}});}_0x29d341=_[_0xac7b('0xa8')]({},_0x29d341,_0x2145e8['options']);if(_0x3e176c&&!_0x3e176c[_0xac7b('0x97')]&&_0x5c7873['childModel']===_0xac7b('0x7b')){if(_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xa9')]){_0x29d341[_0xac7b('0xaa')]=[{'all':!![]}];}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0xc')](_0x29d341)[_0xac7b('0x8')](function(_0x347061){var _0x360a78=[];_0x347061[_0xac7b('0xa7')](function(_0x8aca6){var _0x1b0013;switch(_0x8aca6[_0xac7b('0xab')]){case'default':_0x1b0013=_[_0xac7b('0x91')](_0x3e176c[_0xac7b('0x9')],function(_0x29380f){return _0x29380f['id']===_0x8aca6[_0xac7b('0x7c')]&&_0x29380f[_0xac7b('0x12')]===_0xac7b('0xac');});break;case _0xac7b('0xad'):_0x1b0013=_[_0xac7b('0x91')](_0x3e176c[_0xac7b('0x9')],function(_0x473908){return _0x473908['id']===_0x8aca6[_0xac7b('0x7c')]&&_0x473908[_0xac7b('0x12')]===_0xac7b('0xae');});break;}if(_0x1b0013)_0x360a78[_0xac7b('0x98')](_0x8aca6);});_0x37969f[_0xac7b('0xaf')]=_0x360a78[_0xac7b('0x96')];_0x37969f[_0xac7b('0xb0')]=_0x360a78;return _0x37969f;});}else{if(!_[_0xac7b('0x90')](_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')])){_0x29d341[_0xac7b('0x85')]['id']=_0x29d341['where']['id']?_[_0xac7b('0x9c')](_0x29d341['where']['id'],_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')]):_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb1')];if(_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb2')]){_0x29d341[_0xac7b('0xa3')]=_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb2')];}}if(_0x2145e8[_0xac7b('0x8c')]['extraQueryConditions']){_0x29d341['where']=_[_0xac7b('0xa8')](_0x29d341[_0xac7b('0x85')],{'$and':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb3')]});}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]]['count']({'where':_0x29d341[_0xac7b('0x85')]})['then'](function(_0x423cec){_0x37969f[_0xac7b('0xaf')]=_0x423cec;if(_0x2145e8[_0xac7b('0x8c')]['includeAll']){if(_0x5c7873[_0xac7b('0x15')]===_0xac7b('0xb4')){_0x29d341['include']=[{'model':_0x1671d7['Tag'],'as':_0xac7b('0xb5'),'attributes':['id','name','color'],'required':_0x2145e8['query'][_0xac7b('0xb6')]?!![]:![]},{'model':_0x1671d7[_0xac7b('0x71')],'as':_0xac7b('0xb7'),'attributes':['id','name',_0xac7b('0xb8')],'through':_0x2145e8['query']['tag']?{'attributes':[],'where':{'TagId':_0x2145e8['query'][_0xac7b('0xb6')]||undefined}}:{},'required':_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb6')]?!![]:![]}];}else{_0x29d341[_0xac7b('0xaa')]=[{'all':!![]}];}}return _0x1671d7[_0x5c7873[_0xac7b('0x15')]][_0xac7b('0xc')](_0x29d341);})['then'](function(_0x363633){_0x37969f[_0xac7b('0xb0')]=_0x363633;if(_0x21842d===_0xac7b('0x5a')&&_0x2145e8[_0xac7b('0x8c')][_0xac7b('0xb9')]===_0xac7b('0xba')){var _0x431240=[];for(var _0x27182f=0x0;_0x27182f<_0x37969f['rows'][_0xac7b('0x96')];_0x27182f++){_0x431240[_0xac7b('0x98')](_0x616678('chat',_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbc'),_0x37969f[_0xac7b('0xb0')][_0x27182f]['dataValues']));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbd'),_0x37969f['rows'][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbe'),_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xbf'),_0x37969f[_0xac7b('0xb0')][_0x27182f][_0xac7b('0xbb')]));_0x431240[_0xac7b('0x98')](_0x616678(_0xac7b('0xc0'),_0x37969f[_0xac7b('0xb0')][_0x27182f]['dataValues']));}return Promise[_0xac7b('0x93')](_0x431240)['then'](function(){return _0x37969f;});}return _0x37969f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7dfb065..3e127ff 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 _0xc7b3=['client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3411a4,_0x60d585){var _0x4eb325=function(_0x2356d4){while(--_0x2356d4){_0x3411a4['push'](_0x3411a4['shift']());}};_0x4eb325(++_0x60d585);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc7b3[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var moment=require('moment');var BPromise=require(_0x3c7b('0x2'));var rs=require(_0x3c7b('0x3'));var fs=require('fs');var Redis=require(_0x3c7b('0x4'));var db=require(_0x3c7b('0x5'))['db'];var utils=require(_0x3c7b('0x6'));var logger=require(_0x3c7b('0x7'))('rpc');var config=require(_0x3c7b('0x8'));var jayson=require(_0x3c7b('0x9'));var client=jayson[_0x3c7b('0xa')]['http']({'port':0x232a});config[_0x3c7b('0xb')]=_[_0x3c7b('0xc')](config['redis'],{'host':_0x3c7b('0xd'),'port':0x18eb});var socket=require(_0x3c7b('0xe'))(new Redis(config['redis']));require(_0x3c7b('0xf'))[_0x3c7b('0x10')](socket);function respondWithRpcPromise(_0x3d8744,_0x584cfe,_0x20c47f){return new BPromise(function(_0x5ae6ec,_0x86188c){return client[_0x3c7b('0x11')](_0x3d8744,_0x20c47f)['then'](function(_0x6452a1){logger[_0x3c7b('0x12')](_0x3c7b('0x13'),_0x584cfe,_0x3c7b('0x14'));logger[_0x3c7b('0x15')](_0x3c7b('0x16'),_0x584cfe,'request\x20sent',JSON[_0x3c7b('0x17')](_0x6452a1));if(_0x6452a1['error']){if(_0x6452a1[_0x3c7b('0x18')][_0x3c7b('0x19')]===0x1f4){logger[_0x3c7b('0x18')](_0x3c7b('0x13'),_0x584cfe,_0x6452a1[_0x3c7b('0x18')][_0x3c7b('0x1a')]);return _0x86188c(_0x6452a1[_0x3c7b('0x18')][_0x3c7b('0x1a')]);}logger[_0x3c7b('0x18')](_0x3c7b('0x13'),_0x584cfe,_0x6452a1[_0x3c7b('0x18')][_0x3c7b('0x1a')]);return _0x5ae6ec(_0x6452a1['error'][_0x3c7b('0x1a')]);}else{logger[_0x3c7b('0x12')](_0x3c7b('0x13'),_0x584cfe,_0x3c7b('0x14'));_0x5ae6ec(_0x6452a1[_0x3c7b('0x1b')][_0x3c7b('0x1a')]);}})[_0x3c7b('0x1c')](function(_0x10a6ec){logger[_0x3c7b('0x18')](_0x3c7b('0x13'),_0x584cfe,_0x10a6ec);_0x86188c(_0x10a6ec);});});} \ No newline at end of file +var _0x7af9=['rpc','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27b0b3,_0x5c69cf){var _0x3489c0=function(_0x4e6112){while(--_0x4e6112){_0x27b0b3['push'](_0x27b0b3['shift']());}};_0x3489c0(++_0x5c69cf);}(_0x7af9,0x95));var _0x97af=function(_0x550c99,_0x45f541){_0x550c99=_0x550c99-0x0;var _0x273815=_0x7af9[_0x550c99];return _0x273815;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});config[_0x97af('0x9')]=_[_0x97af('0xa')](config[_0x97af('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x97af('0xb'))(new Redis(config[_0x97af('0x9')]));require(_0x97af('0xc'))['register'](socket);function respondWithRpcPromise(_0x175bbc,_0x5cd1e0,_0x46ac08){return new BPromise(function(_0x19ad23,_0x18a9e5){return client[_0x97af('0xd')](_0x175bbc,_0x46ac08)[_0x97af('0xe')](function(_0x3cc156){logger[_0x97af('0xf')](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));logger[_0x97af('0x12')](_0x97af('0x13'),_0x5cd1e0,'request\x20sent',JSON[_0x97af('0x14')](_0x3cc156));if(_0x3cc156['error']){if(_0x3cc156['error'][_0x97af('0x15')]===0x1f4){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);return _0x18a9e5(_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);}logger['error'](_0x97af('0x10'),_0x5cd1e0,_0x3cc156['error'][_0x97af('0x17')]);return _0x19ad23(_0x3cc156['error'][_0x97af('0x17')]);}else{logger['info'](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));_0x19ad23(_0x3cc156[_0x97af('0x18')][_0x97af('0x17')]);}})[_0x97af('0x19')](function(_0x5ad2bc){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x5ad2bc);_0x18a9e5(_0x5ad2bc);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 7141e53..ece6e05 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 _0xd4cb=['./userProfile.events','save','removeListener','register','length','userProfile:'];(function(_0x512011,_0x4524ed){var _0x187259=function(_0x572dac){while(--_0x572dac){_0x512011['push'](_0x512011['shift']());}};_0x187259(++_0x4524ed);}(_0xd4cb,0xd8));var _0xbd4c=function(_0x29d472,_0x112031){_0x29d472=_0x29d472-0x0;var _0x2bd00d=_0xd4cb[_0x29d472];return _0x2bd00d;};'use strict';var UserProfileEvents=require(_0xbd4c('0x0'));var events=[_0xbd4c('0x1'),'remove','update'];function createListener(_0x22d6e9,_0x3db6df){return function(_0x40e86c){_0x3db6df['emit'](_0x22d6e9,_0x40e86c);};}function removeListener(_0x4e43b2,_0x3f11fc){return function(){UserProfileEvents[_0xbd4c('0x2')](_0x4e43b2,_0x3f11fc);};}exports[_0xbd4c('0x3')]=function(_0x245706){for(var _0x2ea4e4=0x0,_0x117096=events[_0xbd4c('0x4')];_0x2ea4e4<_0x117096;_0x2ea4e4++){var _0x326516=events[_0x2ea4e4];var _0x5f1a0a=createListener(_0xbd4c('0x5')+_0x326516,_0x245706);UserProfileEvents['on'](_0x326516,_0x5f1a0a);}}; \ No newline at end of file +var _0x43c2=['length','userProfile:','save','remove','update','emit','register'];(function(_0x28faf1,_0x1e3645){var _0x543379=function(_0x5ea002){while(--_0x5ea002){_0x28faf1['push'](_0x28faf1['shift']());}};_0x543379(++_0x1e3645);}(_0x43c2,0xd4));var _0x243c=function(_0x27e28f,_0x518a75){_0x27e28f=_0x27e28f-0x0;var _0x249c6=_0x43c2[_0x27e28f];return _0x249c6;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x243c('0x0'),_0x243c('0x1'),_0x243c('0x2')];function createListener(_0x20d426,_0x3c4337){return function(_0x333819){_0x3c4337[_0x243c('0x3')](_0x20d426,_0x333819);};}function removeListener(_0x1f09e4,_0x28bf8f){return function(){UserProfileEvents['removeListener'](_0x1f09e4,_0x28bf8f);};}exports[_0x243c('0x4')]=function(_0xe46096){for(var _0xe69fa8=0x0,_0x4debdc=events[_0x243c('0x5')];_0xe69fa8<_0x4debdc;_0xe69fa8++){var _0x525d81=events[_0xe69fa8];var _0x1e802c=createListener(_0x243c('0x6')+_0x525d81,_0xe46096);UserProfileEvents['on'](_0x525d81,_0x1e802c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a3a3728..275698c 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 _0xd311=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','post','put'];(function(_0x50e347,_0x537dc7){var _0x3d7684=function(_0x244ee2){while(--_0x244ee2){_0x50e347['push'](_0x50e347['shift']());}};_0x3d7684(++_0x537dc7);}(_0xd311,0x143));var _0x1d31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd311[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1d31('0x0'));var util=require(_0x1d31('0x1'));var path=require(_0x1d31('0x2'));var timeout=require(_0x1d31('0x3'));var express=require('express');var router=express[_0x1d31('0x4')]();var fs_extra=require(_0x1d31('0x5'));var auth=require(_0x1d31('0x6'));var interaction=require(_0x1d31('0x7'));var config=require(_0x1d31('0x8'));var controller=require(_0x1d31('0x9'));router[_0x1d31('0xa')]('/',auth[_0x1d31('0xb')](),controller['index']);router[_0x1d31('0xa')](_0x1d31('0xc'),auth[_0x1d31('0xb')](),controller[_0x1d31('0xd')]);router[_0x1d31('0xa')](_0x1d31('0xe'),auth[_0x1d31('0xb')](),controller['show']);router[_0x1d31('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d31('0x10')](_0x1d31('0xe'),auth[_0x1d31('0xb')](),controller[_0x1d31('0x11')]);router['delete']('/:id',auth[_0x1d31('0xb')](),controller[_0x1d31('0x12')]);module[_0x1d31('0x13')]=router; \ No newline at end of file +var _0x1d8f=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x4cffae,_0x1d23eb){var _0x58bc5d=function(_0x583bed){while(--_0x583bed){_0x4cffae['push'](_0x4cffae['shift']());}};_0x58bc5d(++_0x1d23eb);}(_0x1d8f,0xde));var _0xf1d8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1d8f[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xf1d8('0x0'));var util=require(_0xf1d8('0x1'));var path=require(_0xf1d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1d8('0x3'));var router=express['Router']();var fs_extra=require(_0xf1d8('0x4'));var auth=require(_0xf1d8('0x5'));var interaction=require(_0xf1d8('0x6'));var config=require(_0xf1d8('0x7'));var controller=require(_0xf1d8('0x8'));router[_0xf1d8('0x9')]('/',auth[_0xf1d8('0xa')](),controller[_0xf1d8('0xb')]);router[_0xf1d8('0x9')](_0xf1d8('0xc'),auth[_0xf1d8('0xa')](),controller[_0xf1d8('0xd')]);router[_0xf1d8('0x9')](_0xf1d8('0xe'),auth[_0xf1d8('0xa')](),controller[_0xf1d8('0xf')]);router[_0xf1d8('0x10')]('/',auth[_0xf1d8('0xa')](),controller[_0xf1d8('0x11')]);router['put']('/:id',auth[_0xf1d8('0xa')](),controller[_0xf1d8('0x12')]);router[_0xf1d8('0x13')](_0xf1d8('0xe'),auth[_0xf1d8('0xa')](),controller[_0xf1d8('0x14')]);module[_0xf1d8('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2bde8d2..89c0b42 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 _0x3fbd=['exports','STRING','INTEGER','sequelize'];(function(_0x7d0b1f,_0x1397e6){var _0x2de201=function(_0x4db863){while(--_0x4db863){_0x7d0b1f['push'](_0x7d0b1f['shift']());}};_0x2de201(++_0x1397e6);}(_0x3fbd,0x1b3));var _0xd3fb=function(_0x1637b5,_0x12da04){_0x1637b5=_0x1637b5-0x0;var _0x131de8=_0x3fbd[_0x1637b5];return _0x131de8;};'use strict';var Sequelize=require(_0xd3fb('0x0'));module[_0xd3fb('0x1')]={'name':{'type':Sequelize[_0xd3fb('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd3fb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd3fb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x39fe=['sequelize','STRING'];(function(_0x1c8567,_0x5180c6){var _0x5309fd=function(_0x257c5f){while(--_0x257c5f){_0x1c8567['push'](_0x1c8567['shift']());}};_0x5309fd(++_0x5180c6);}(_0x39fe,0x1e2));var _0xe39f=function(_0x123f2b,_0x46c143){_0x123f2b=_0x123f2b-0x0;var _0x3e1efd=_0x39fe[_0x123f2b];return _0x3e1efd;};'use strict';var Sequelize=require(_0xe39f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xe39f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 62bca3f..fd66f0c 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 _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','UserProfileResource','rawAttributes','type'];(function(_0x3fab8d,_0x3a43e0){var _0x652a13=function(_0x53cf7d){while(--_0x53cf7d){_0x3fab8d['push'](_0x3fab8d['shift']());}};_0x652a13(++_0x3a43e0);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['UserProfileResource'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['UserProfileResource']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['UserProfileResource'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x7a54,0x106));var _0x47a5=function(_0x35f9aa,_0x597649){_0x35f9aa=_0x35f9aa-0x0;var _0x6156a9=_0x7a54[_0x35f9aa];return _0x6156a9;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['UserProfileResource'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['UserProfileResource']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 867ca58..fbd405f 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 _0xb9ea=['exports','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','api','moment','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x3bd709,_0x7dffd8){var _0x37813e=function(_0x1c6c2b){while(--_0x1c6c2b){_0x3bd709['push'](_0x3bd709['shift']());}};_0x37813e(++_0x7dffd8);}(_0xb9ea,0x1f3));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var logger=require('../../config/logger')(_0xab9e('0x2'));var moment=require(_0xab9e('0x3'));var BPromise=require('bluebird');var rp=require(_0xab9e('0x4'));var fs=require('fs');var path=require(_0xab9e('0x5'));var rimraf=require(_0xab9e('0x6'));var config=require('../../config/environment');var attributes=require(_0xab9e('0x7'));module[_0xab9e('0x8')]=function(_0x2ece21,_0x26d55c){return _0x2ece21['define'](_0xab9e('0x9'),attributes,{'tableName':_0xab9e('0xa'),'paranoid':![],'indexes':[{'name':_0xab9e('0xb'),'fields':['resourceId',_0xab9e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe319=['sectionId','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x4e0d72,_0x45b1dc){var _0x11c4b1=function(_0x2b5788){while(--_0x2b5788){_0x4e0d72['push'](_0x4e0d72['shift']());}};_0x11c4b1(++_0x45b1dc);}(_0xe319,0xaa));var _0x9e31=function(_0x17984e,_0x512296){_0x17984e=_0x17984e-0x0;var _0x210b21=_0xe319[_0x17984e];return _0x210b21;};'use strict';var _=require(_0x9e31('0x0'));var util=require(_0x9e31('0x1'));var logger=require(_0x9e31('0x2'))('api');var moment=require(_0x9e31('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e31('0x4'));var rimraf=require(_0x9e31('0x5'));var config=require(_0x9e31('0x6'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x564b6e,_0x256b5b){return _0x564b6e[_0x9e31('0x7')](_0x9e31('0x8'),attributes,{'tableName':_0x9e31('0x9'),'paranoid':![],'indexes':[{'name':_0x9e31('0xa'),'fields':[_0x9e31('0xb'),_0x9e31('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index dd8eace..d0b0da5 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 _0x1939=['message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xfdf571,_0x18a56e){var _0x2b405c=function(_0x96f776){while(--_0x96f776){_0xfdf571['push'](_0xfdf571['shift']());}};_0x2b405c(++_0x18a56e);}(_0x1939,0x144));var _0x9193=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x1939[_0x2fb87c];return _0x43038b;};'use strict';var _=require(_0x9193('0x0'));var util=require(_0x9193('0x1'));var moment=require('moment');var BPromise=require(_0x9193('0x2'));var rs=require(_0x9193('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9193('0x4'))['db'];var utils=require(_0x9193('0x5'));var logger=require(_0x9193('0x6'))(_0x9193('0x7'));var config=require('../../config/environment');var jayson=require(_0x9193('0x8'));var client=jayson[_0x9193('0x9')][_0x9193('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x519188,_0x4710e6,_0x1c3be0){return new BPromise(function(_0x1c96f7,_0x52ab7c){return client['request'](_0x519188,_0x1c3be0)[_0x9193('0xb')](function(_0x34cad6){logger[_0x9193('0xc')](_0x9193('0xd'),_0x4710e6,_0x9193('0xe'));logger[_0x9193('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x4710e6,_0x9193('0xe'),JSON[_0x9193('0x10')](_0x34cad6));if(_0x34cad6[_0x9193('0x11')]){if(_0x34cad6[_0x9193('0x11')]['code']===0x1f4){logger[_0x9193('0x11')](_0x9193('0xd'),_0x4710e6,_0x34cad6['error'][_0x9193('0x12')]);return _0x52ab7c(_0x34cad6[_0x9193('0x11')][_0x9193('0x12')]);}logger[_0x9193('0x11')](_0x9193('0xd'),_0x4710e6,_0x34cad6[_0x9193('0x11')][_0x9193('0x12')]);return _0x1c96f7(_0x34cad6[_0x9193('0x11')][_0x9193('0x12')]);}else{logger[_0x9193('0xc')](_0x9193('0xd'),_0x4710e6,_0x9193('0xe'));_0x1c96f7(_0x34cad6['result'][_0x9193('0x12')]);}})['catch'](function(_0x189cb9){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4710e6,_0x189cb9);_0x52ab7c(_0x189cb9);});});} \ No newline at end of file +var _0xc129=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc129,0x197));var _0x9c12=function(_0x211907,_0x5486fe){_0x211907=_0x211907-0x0;var _0x2cc002=_0xc129[_0x211907];return _0x2cc002;};'use strict';var _=require(_0x9c12('0x0'));var util=require(_0x9c12('0x1'));var moment=require(_0x9c12('0x2'));var BPromise=require(_0x9c12('0x3'));var rs=require(_0x9c12('0x4'));var fs=require('fs');var Redis=require(_0x9c12('0x5'));var db=require(_0x9c12('0x6'))['db'];var utils=require(_0x9c12('0x7'));var logger=require(_0x9c12('0x8'))(_0x9c12('0x9'));var config=require('../../config/environment');var jayson=require(_0x9c12('0xa'));var client=jayson['client'][_0x9c12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238655,_0x32e919,_0x20d934){return new BPromise(function(_0x578122,_0x3ef7b7){return client[_0x9c12('0xc')](_0x238655,_0x20d934)[_0x9c12('0xd')](function(_0x2919f8){logger['info'](_0x9c12('0xe'),_0x32e919,_0x9c12('0xf'));logger[_0x9c12('0x10')](_0x9c12('0x11'),_0x32e919,_0x9c12('0xf'),JSON[_0x9c12('0x12')](_0x2919f8));if(_0x2919f8[_0x9c12('0x13')]){if(_0x2919f8[_0x9c12('0x13')][_0x9c12('0x14')]===0x1f4){logger['error'](_0x9c12('0xe'),_0x32e919,_0x2919f8[_0x9c12('0x13')][_0x9c12('0x15')]);return _0x3ef7b7(_0x2919f8[_0x9c12('0x13')][_0x9c12('0x15')]);}logger[_0x9c12('0x13')](_0x9c12('0xe'),_0x32e919,_0x2919f8[_0x9c12('0x13')][_0x9c12('0x15')]);return _0x578122(_0x2919f8['error'][_0x9c12('0x15')]);}else{logger[_0x9c12('0x16')]('UserProfileResource,\x20%s,\x20%s',_0x32e919,_0x9c12('0xf'));_0x578122(_0x2919f8[_0x9c12('0x17')][_0x9c12('0x15')]);}})[_0x9c12('0x18')](function(_0x2184ae){logger[_0x9c12('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x32e919,_0x2184ae);_0x3ef7b7(_0x2184ae);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0b1ec5a..b9c1dd0 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 _0xc208=['express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/:id','post','create','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x42b424,_0x162cdf){var _0x308491=function(_0x1c0e6b){while(--_0x1c0e6b){_0x42b424['push'](_0x42b424['shift']());}};_0x308491(++_0x162cdf);}(_0xc208,0xb7));var _0x8c20=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc208[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x8c20('0x0'));var util=require(_0x8c20('0x1'));var path=require(_0x8c20('0x2'));var timeout=require(_0x8c20('0x3'));var express=require(_0x8c20('0x4'));var router=express[_0x8c20('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c20('0x6'));var interaction=require(_0x8c20('0x7'));var config=require('../../config/environment');var controller=require(_0x8c20('0x8'));router[_0x8c20('0x9')]('/',auth[_0x8c20('0xa')](),controller['index']);router[_0x8c20('0x9')]('/describe',auth[_0x8c20('0xa')](),controller['describe']);router[_0x8c20('0x9')](_0x8c20('0xb'),auth[_0x8c20('0xa')](),controller['show']);router[_0x8c20('0xc')]('/',auth[_0x8c20('0xa')](),controller[_0x8c20('0xd')]);router['put'](_0x8c20('0xb'),auth[_0x8c20('0xa')](),controller[_0x8c20('0xe')]);router[_0x8c20('0xf')](_0x8c20('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8c20('0x10')]=router; \ No newline at end of file +var _0xbfbe=['destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update'];(function(_0x46d684,_0x410baa){var _0x3a1107=function(_0x463f80){while(--_0x463f80){_0x46d684['push'](_0x46d684['shift']());}};_0x3a1107(++_0x410baa);}(_0xbfbe,0x65));var _0xebfb=function(_0x158876,_0x8600fe){_0x158876=_0x158876-0x0;var _0x51c285=_0xbfbe[_0x158876];return _0x51c285;};'use strict';var multer=require('multer');var util=require(_0xebfb('0x0'));var path=require(_0xebfb('0x1'));var timeout=require('connect-timeout');var express=require(_0xebfb('0x2'));var router=express[_0xebfb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xebfb('0x4'));var interaction=require(_0xebfb('0x5'));var config=require(_0xebfb('0x6'));var controller=require(_0xebfb('0x7'));router[_0xebfb('0x8')]('/',auth[_0xebfb('0x9')](),controller[_0xebfb('0xa')]);router[_0xebfb('0x8')](_0xebfb('0xb'),auth[_0xebfb('0x9')](),controller[_0xebfb('0xc')]);router['get']('/:id',auth[_0xebfb('0x9')](),controller[_0xebfb('0xd')]);router[_0xebfb('0xe')]('/',auth['isAuthenticated'](),controller[_0xebfb('0xf')]);router[_0xebfb('0x10')](_0xebfb('0x11'),auth[_0xebfb('0x9')](),controller[_0xebfb('0x12')]);router['delete']('/:id',auth[_0xebfb('0x9')](),controller[_0xebfb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d114dc5..836f487 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 _0x0565=['exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','sequelize'];(function(_0x5cd32e,_0x3b2c6d){var _0x4cc07e=function(_0x2ce1eb){while(--_0x2ce1eb){_0x5cd32e['push'](_0x5cd32e['shift']());}};_0x4cc07e(++_0x3b2c6d);}(_0x0565,0xf2));var _0x5056=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x0565[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5056('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5056('0x2')],'set':function(_0x3657a8){this[_0x5056('0x5')]('crudPermissions',_0x3657a8?_0x3657a8[_0x5056('0x6')](''):[]);},'get':function(){return this[_0x5056('0x7')](_0x5056('0x8'))?this[_0x5056('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x26ceb2,_0x25917d){var _0x550797=function(_0x4a431e){while(--_0x4a431e){_0x26ceb2['push'](_0x26ceb2['shift']());}};_0x550797(++_0x25917d);}(_0x6cb4,0xff));var _0x46cb=function(_0x399329,_0xa4114f){_0x399329=_0x399329-0x0;var _0x5c3001=_0x6cb4[_0x399329];return _0x5c3001;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 05c7f7c..58e4765 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 _0xe270=['eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','find','create','body','params','describe'];(function(_0x20876b,_0x2dda29){var _0x424e9e=function(_0x3a7881){while(--_0x3a7881){_0x20876b['push'](_0x20876b['shift']());}};_0x424e9e(++_0x2dda29);}(_0xe270,0x17c));var _0x0e27=function(_0x206a93,_0xa0af93){_0x206a93=_0x206a93-0x0;var _0x44b940=_0xe270[_0x206a93];return _0x44b940;};'use strict';var emlformat=require(_0x0e27('0x0'));var rimraf=require(_0x0e27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e27('0x2'));var rp=require('request-promise');var moment=require(_0x0e27('0x3'));var BPromise=require(_0x0e27('0x4'));var Mustache=require(_0x0e27('0x5'));var util=require(_0x0e27('0x6'));var path=require(_0x0e27('0x7'));var sox=require(_0x0e27('0x8'));var csv=require(_0x0e27('0x9'));var ejs=require(_0x0e27('0xa'));var fs=require('fs');var fs_extra=require(_0x0e27('0xb'));var _=require(_0x0e27('0xc'));var squel=require('squel');var crypto=require(_0x0e27('0xd'));var jsforce=require(_0x0e27('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e27('0x9'));var querystring=require('querystring');var Papa=require(_0x0e27('0xf'));var Redis=require(_0x0e27('0x10'));var authService=require(_0x0e27('0x11'));var qs=require(_0x0e27('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e27('0x13'));var logger=require(_0x0e27('0x14'))(_0x0e27('0x15'));var utils=require(_0x0e27('0x16'));var config=require(_0x0e27('0x17'));var licenseUtil=require(_0x0e27('0x18'));var db=require(_0x0e27('0x19'))['db'];function respondWithStatusCode(_0x7f86f,_0x3dfc3f){_0x3dfc3f=_0x3dfc3f||0xcc;return function(_0x2ca769){if(_0x2ca769){return _0x7f86f[_0x0e27('0x1a')](_0x3dfc3f);}return _0x7f86f[_0x0e27('0x1b')](_0x3dfc3f)[_0x0e27('0x1c')]();};}function respondWithResult(_0x3b9229,_0x209e2b){_0x209e2b=_0x209e2b||0xc8;return function(_0x2a6fe0){if(_0x2a6fe0){return _0x3b9229[_0x0e27('0x1b')](_0x209e2b)['json'](_0x2a6fe0);}};}function respondWithFilteredResult(_0x283c9a,_0x311efd){return function(_0x2feede){if(_0x2feede){var _0x2f0987=typeof _0x311efd['offset']===_0x0e27('0x1d')&&typeof _0x311efd[_0x0e27('0x1e')]===_0x0e27('0x1d');var _0x21e080=_0x2feede[_0x0e27('0x1f')];var _0x39c0fa=_0x2f0987?0x0:_0x311efd[_0x0e27('0x20')];var _0x7c0645=_0x2f0987?_0x2feede[_0x0e27('0x1f')]:_0x311efd[_0x0e27('0x20')]+_0x311efd[_0x0e27('0x1e')];var _0x28bb96;if(_0x7c0645>=_0x21e080){_0x7c0645=_0x21e080;_0x28bb96=0xc8;}else{_0x28bb96=0xce;}_0x283c9a[_0x0e27('0x1b')](_0x28bb96);return _0x283c9a['set'](_0x0e27('0x21'),_0x39c0fa+'-'+_0x7c0645+'/'+_0x21e080)[_0x0e27('0x22')](_0x2feede);}return null;};}function patchUpdates(_0x422249){return function(_0x503096){try{jsonpatch[_0x0e27('0x23')](_0x503096,_0x422249,!![]);}catch(_0x4e8ed7){return BPromise[_0x0e27('0x24')](_0x4e8ed7);}return _0x503096[_0x0e27('0x25')]();};}function saveUpdates(_0x57d69d,_0x22f177){return function(_0x26be9b){if(_0x26be9b){return _0x26be9b[_0x0e27('0x26')](_0x57d69d)[_0x0e27('0x27')](function(_0xf8e716){return _0xf8e716;});}return null;};}function removeEntity(_0x475fb7,_0x3f14a1){return function(_0x36f3f2){if(_0x36f3f2){return _0x36f3f2[_0x0e27('0x28')]()[_0x0e27('0x27')](function(){_0x475fb7[_0x0e27('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb3b7,_0x42487b){return function(_0x5a04f8){if(!_0x5a04f8){_0x2cb3b7['sendStatus'](0x194);}return _0x5a04f8;};}function handleError(_0x4914fe,_0x55949b){_0x55949b=_0x55949b||0x1f4;return function(_0xe99821){logger[_0x0e27('0x29')](_0xe99821['stack']);if(_0xe99821[_0x0e27('0x2a')]){delete _0xe99821[_0x0e27('0x2a')];}_0x4914fe[_0x0e27('0x1b')](_0x55949b)['send'](_0xe99821);};}exports[_0x0e27('0x2b')]=function(_0x17426f,_0x31f3f3){var _0x1a4fbc={},_0x284546={},_0x761c26={'count':0x0,'rows':[]};var _0x5173cc=_[_0x0e27('0x2c')](db[_0x0e27('0x2d')][_0x0e27('0x2e')],function(_0x357126){return{'name':_0x357126[_0x0e27('0x2f')],'type':_0x357126[_0x0e27('0x30')][_0x0e27('0x31')]};});_0x284546[_0x0e27('0x32')]=_[_0x0e27('0x2c')](_0x5173cc,_0x0e27('0x2a'));_0x284546[_0x0e27('0x33')]=_[_0x0e27('0x34')](_0x17426f['query']);_0x284546[_0x0e27('0x35')]=_[_0x0e27('0x36')](_0x284546['model'],_0x284546[_0x0e27('0x33')]);_0x1a4fbc[_0x0e27('0x37')]=_[_0x0e27('0x36')](_0x284546[_0x0e27('0x32')],qs[_0x0e27('0x38')](_0x17426f[_0x0e27('0x33')][_0x0e27('0x38')]));_0x1a4fbc['attributes']=_0x1a4fbc[_0x0e27('0x37')]['length']?_0x1a4fbc[_0x0e27('0x37')]:_0x284546[_0x0e27('0x32')];if(!_0x17426f[_0x0e27('0x33')][_0x0e27('0x39')](_0x0e27('0x3a'))){_0x1a4fbc[_0x0e27('0x1e')]=qs['limit'](_0x17426f['query'][_0x0e27('0x1e')]);_0x1a4fbc['offset']=qs[_0x0e27('0x20')](_0x17426f['query'][_0x0e27('0x20')]);}_0x1a4fbc[_0x0e27('0x3b')]=qs['sort'](_0x17426f[_0x0e27('0x33')][_0x0e27('0x3c')]);_0x1a4fbc[_0x0e27('0x3d')]=qs[_0x0e27('0x35')](_[_0x0e27('0x3e')](_0x17426f['query'],_0x284546[_0x0e27('0x35')]),_0x5173cc);if(_0x17426f[_0x0e27('0x33')]['filter']){_0x1a4fbc['where']=_[_0x0e27('0x3f')](_0x1a4fbc['where'],{'$or':_[_0x0e27('0x2c')](_0x5173cc,function(_0x3c32f5){if(_0x3c32f5[_0x0e27('0x30')]!=='VIRTUAL'){var _0x4ca6f7={};_0x4ca6f7[_0x3c32f5['name']]={'$like':'%'+_0x17426f['query'][_0x0e27('0x40')]+'%'};return _0x4ca6f7;}})});}_0x1a4fbc=_[_0x0e27('0x3f')]({},_0x1a4fbc,_0x17426f[_0x0e27('0x41')]);var _0x5d69d6={'where':_0x1a4fbc['where']};return db[_0x0e27('0x2d')][_0x0e27('0x1f')](_0x5d69d6)[_0x0e27('0x27')](function(_0x56d76c){_0x761c26['count']=_0x56d76c;if(_0x17426f[_0x0e27('0x33')][_0x0e27('0x42')]){_0x1a4fbc[_0x0e27('0x43')]=[{'all':!![]}];}return db[_0x0e27('0x2d')]['findAll'](_0x1a4fbc);})[_0x0e27('0x27')](function(_0x1a0a65){_0x761c26[_0x0e27('0x44')]=_0x1a0a65;return _0x761c26;})[_0x0e27('0x27')](respondWithFilteredResult(_0x31f3f3,_0x1a4fbc))[_0x0e27('0x45')](handleError(_0x31f3f3,null));};exports[_0x0e27('0x46')]=function(_0x2cb332,_0x20a528){var _0x3a0cd5={'raw':![],'where':{'id':_0x2cb332['params']['id']}},_0xee0a36={};_0xee0a36['model']=_[_0x0e27('0x34')](db['UserProfileSection'][_0x0e27('0x2e')]);_0xee0a36[_0x0e27('0x33')]=_[_0x0e27('0x34')](_0x2cb332[_0x0e27('0x33')]);_0xee0a36[_0x0e27('0x35')]=_[_0x0e27('0x36')](_0xee0a36[_0x0e27('0x32')],_0xee0a36[_0x0e27('0x33')]);_0x3a0cd5['attributes']=_[_0x0e27('0x36')](_0xee0a36['model'],qs['fields'](_0x2cb332['query'][_0x0e27('0x38')]));_0x3a0cd5[_0x0e27('0x37')]=_0x3a0cd5[_0x0e27('0x37')]['length']?_0x3a0cd5[_0x0e27('0x37')]:_0xee0a36['model'];if(_0x2cb332[_0x0e27('0x33')]['includeAll']){_0x3a0cd5[_0x0e27('0x43')]=[{'all':!![]}];}_0x3a0cd5=_[_0x0e27('0x3f')]({},_0x3a0cd5,_0x2cb332['options']);return db[_0x0e27('0x2d')][_0x0e27('0x47')](_0x3a0cd5)[_0x0e27('0x27')](handleEntityNotFound(_0x20a528,null))[_0x0e27('0x27')](respondWithResult(_0x20a528,null))[_0x0e27('0x45')](handleError(_0x20a528,null));};exports[_0x0e27('0x48')]=function(_0x8cbb8c,_0x2c6334){return db['UserProfileSection'][_0x0e27('0x48')](_0x8cbb8c[_0x0e27('0x49')],{})['then'](respondWithResult(_0x2c6334,0xc9))[_0x0e27('0x45')](handleError(_0x2c6334,null));};exports[_0x0e27('0x26')]=function(_0x3640f5,_0x1cd05c){if(_0x3640f5[_0x0e27('0x49')]['id']){delete _0x3640f5[_0x0e27('0x49')]['id'];}return db[_0x0e27('0x2d')][_0x0e27('0x47')]({'where':{'id':_0x3640f5[_0x0e27('0x4a')]['id']}})[_0x0e27('0x27')](handleEntityNotFound(_0x1cd05c,null))[_0x0e27('0x27')](saveUpdates(_0x3640f5[_0x0e27('0x49')],null))['then'](respondWithResult(_0x1cd05c,null))['catch'](handleError(_0x1cd05c,null));};exports[_0x0e27('0x28')]=function(_0x429436,_0x343d37){return db[_0x0e27('0x2d')]['find']({'where':{'id':_0x429436[_0x0e27('0x4a')]['id']}})[_0x0e27('0x27')](handleEntityNotFound(_0x343d37,null))[_0x0e27('0x27')](removeEntity(_0x343d37,null))['catch'](handleError(_0x343d37,null));};exports[_0x0e27('0x4b')]=function(_0x11134d,_0x424bd9){return db[_0x0e27('0x2d')]['describe']()[_0x0e27('0x27')](respondWithResult(_0x424bd9,null))[_0x0e27('0x45')](handleError(_0x424bd9,null));}; \ No newline at end of file +var _0x6614=['intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','UserProfileSection','rawAttributes','type','model','query','keys','filters','attributes'];(function(_0x3b13e1,_0x2ee7eb){var _0x2a1202=function(_0x1fd230){while(--_0x1fd230){_0x3b13e1['push'](_0x3b13e1['shift']());}};_0x2a1202(++_0x2ee7eb);}(_0x6614,0x139));var _0x4661=function(_0x239a98,_0x288178){_0x239a98=_0x239a98-0x0;var _0x16d789=_0x6614[_0x239a98];return _0x16d789;};'use strict';var emlformat=require(_0x4661('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4661('0x1'));var jsonpatch=require(_0x4661('0x2'));var rp=require('request-promise');var moment=require(_0x4661('0x3'));var BPromise=require(_0x4661('0x4'));var Mustache=require(_0x4661('0x5'));var util=require(_0x4661('0x6'));var path=require('path');var sox=require(_0x4661('0x7'));var csv=require(_0x4661('0x8'));var ejs=require(_0x4661('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4661('0xa'));var squel=require('squel');var crypto=require(_0x4661('0xb'));var jsforce=require(_0x4661('0xc'));var deskjs=require(_0x4661('0xd'));var toCsv=require(_0x4661('0x8'));var querystring=require(_0x4661('0xe'));var Papa=require('papaparse');var Redis=require(_0x4661('0xf'));var authService=require(_0x4661('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4661('0x11'));var hardwareService=require(_0x4661('0x12'));var logger=require(_0x4661('0x13'))(_0x4661('0x14'));var utils=require(_0x4661('0x15'));var config=require(_0x4661('0x16'));var licenseUtil=require(_0x4661('0x17'));var db=require(_0x4661('0x18'))['db'];function respondWithStatusCode(_0x5907c1,_0xd3ba15){_0xd3ba15=_0xd3ba15||0xcc;return function(_0x1ac346){if(_0x1ac346){return _0x5907c1[_0x4661('0x19')](_0xd3ba15);}return _0x5907c1['status'](_0xd3ba15)[_0x4661('0x1a')]();};}function respondWithResult(_0x4c5454,_0x134da6){_0x134da6=_0x134da6||0xc8;return function(_0x2bedd3){if(_0x2bedd3){return _0x4c5454[_0x4661('0x1b')](_0x134da6)['json'](_0x2bedd3);}};}function respondWithFilteredResult(_0x2d8588,_0x5b2059){return function(_0x291e86){if(_0x291e86){var _0x8df841=typeof _0x5b2059['offset']===_0x4661('0x1c')&&typeof _0x5b2059[_0x4661('0x1d')]==='undefined';var _0x1ed9fc=_0x291e86['count'];var _0x23088d=_0x8df841?0x0:_0x5b2059[_0x4661('0x1e')];var _0x47f852=_0x8df841?_0x291e86[_0x4661('0x1f')]:_0x5b2059[_0x4661('0x1e')]+_0x5b2059[_0x4661('0x1d')];var _0x17e4f1;if(_0x47f852>=_0x1ed9fc){_0x47f852=_0x1ed9fc;_0x17e4f1=0xc8;}else{_0x17e4f1=0xce;}_0x2d8588[_0x4661('0x1b')](_0x17e4f1);return _0x2d8588[_0x4661('0x20')](_0x4661('0x21'),_0x23088d+'-'+_0x47f852+'/'+_0x1ed9fc)[_0x4661('0x22')](_0x291e86);}return null;};}function patchUpdates(_0x3bde04){return function(_0x57c4f0){try{jsonpatch[_0x4661('0x23')](_0x57c4f0,_0x3bde04,!![]);}catch(_0x38f2e2){return BPromise['reject'](_0x38f2e2);}return _0x57c4f0[_0x4661('0x24')]();};}function saveUpdates(_0xb5eba7,_0x21a3af){return function(_0xebc05c){if(_0xebc05c){return _0xebc05c[_0x4661('0x25')](_0xb5eba7)[_0x4661('0x26')](function(_0x2bb8ee){return _0x2bb8ee;});}return null;};}function removeEntity(_0x46cc75,_0x4de698){return function(_0x359077){if(_0x359077){return _0x359077[_0x4661('0x27')]()[_0x4661('0x26')](function(){_0x46cc75[_0x4661('0x1b')](0xcc)[_0x4661('0x1a')]();});}};}function handleEntityNotFound(_0x74720c,_0x5b0384){return function(_0x1ad7ad){if(!_0x1ad7ad){_0x74720c[_0x4661('0x19')](0x194);}return _0x1ad7ad;};}function handleError(_0xffbbba,_0x2a0f2b){_0x2a0f2b=_0x2a0f2b||0x1f4;return function(_0x12e346){logger['error'](_0x12e346['stack']);if(_0x12e346[_0x4661('0x28')]){delete _0x12e346['name'];}_0xffbbba[_0x4661('0x1b')](_0x2a0f2b)[_0x4661('0x29')](_0x12e346);};}exports[_0x4661('0x2a')]=function(_0x9066a3,_0x27436e){var _0x2d85ac={},_0x449858={},_0x307d51={'count':0x0,'rows':[]};var _0x2e9e86=_[_0x4661('0x2b')](db[_0x4661('0x2c')][_0x4661('0x2d')],function(_0x4bbef9){return{'name':_0x4bbef9['fieldName'],'type':_0x4bbef9[_0x4661('0x2e')]['key']};});_0x449858[_0x4661('0x2f')]=_[_0x4661('0x2b')](_0x2e9e86,_0x4661('0x28'));_0x449858[_0x4661('0x30')]=_[_0x4661('0x31')](_0x9066a3[_0x4661('0x30')]);_0x449858[_0x4661('0x32')]=_['intersection'](_0x449858[_0x4661('0x2f')],_0x449858[_0x4661('0x30')]);_0x2d85ac[_0x4661('0x33')]=_[_0x4661('0x34')](_0x449858[_0x4661('0x2f')],qs[_0x4661('0x35')](_0x9066a3[_0x4661('0x30')][_0x4661('0x35')]));_0x2d85ac[_0x4661('0x33')]=_0x2d85ac[_0x4661('0x33')]['length']?_0x2d85ac[_0x4661('0x33')]:_0x449858['model'];if(!_0x9066a3[_0x4661('0x30')][_0x4661('0x36')](_0x4661('0x37'))){_0x2d85ac[_0x4661('0x1d')]=qs[_0x4661('0x1d')](_0x9066a3['query'][_0x4661('0x1d')]);_0x2d85ac[_0x4661('0x1e')]=qs[_0x4661('0x1e')](_0x9066a3['query'][_0x4661('0x1e')]);}_0x2d85ac[_0x4661('0x38')]=qs[_0x4661('0x39')](_0x9066a3[_0x4661('0x30')][_0x4661('0x39')]);_0x2d85ac[_0x4661('0x3a')]=qs[_0x4661('0x32')](_[_0x4661('0x3b')](_0x9066a3[_0x4661('0x30')],_0x449858[_0x4661('0x32')]),_0x2e9e86);if(_0x9066a3[_0x4661('0x30')][_0x4661('0x3c')]){_0x2d85ac['where']=_[_0x4661('0x3d')](_0x2d85ac[_0x4661('0x3a')],{'$or':_[_0x4661('0x2b')](_0x2e9e86,function(_0x3044d7){if(_0x3044d7['type']!=='VIRTUAL'){var _0xd11261={};_0xd11261[_0x3044d7[_0x4661('0x28')]]={'$like':'%'+_0x9066a3[_0x4661('0x30')][_0x4661('0x3c')]+'%'};return _0xd11261;}})});}_0x2d85ac=_['merge']({},_0x2d85ac,_0x9066a3[_0x4661('0x3e')]);var _0x191680={'where':_0x2d85ac[_0x4661('0x3a')]};return db['UserProfileSection']['count'](_0x191680)[_0x4661('0x26')](function(_0x20c5ff){_0x307d51[_0x4661('0x1f')]=_0x20c5ff;if(_0x9066a3['query'][_0x4661('0x3f')]){_0x2d85ac[_0x4661('0x40')]=[{'all':!![]}];}return db[_0x4661('0x2c')]['findAll'](_0x2d85ac);})[_0x4661('0x26')](function(_0x25597c){_0x307d51[_0x4661('0x41')]=_0x25597c;return _0x307d51;})[_0x4661('0x26')](respondWithFilteredResult(_0x27436e,_0x2d85ac))[_0x4661('0x42')](handleError(_0x27436e,null));};exports['show']=function(_0x239b50,_0x49133c){var _0x481470={'raw':![],'where':{'id':_0x239b50[_0x4661('0x43')]['id']}},_0x16ad5b={};_0x16ad5b[_0x4661('0x2f')]=_[_0x4661('0x31')](db[_0x4661('0x2c')][_0x4661('0x2d')]);_0x16ad5b[_0x4661('0x30')]=_[_0x4661('0x31')](_0x239b50[_0x4661('0x30')]);_0x16ad5b['filters']=_[_0x4661('0x34')](_0x16ad5b['model'],_0x16ad5b['query']);_0x481470[_0x4661('0x33')]=_[_0x4661('0x34')](_0x16ad5b[_0x4661('0x2f')],qs[_0x4661('0x35')](_0x239b50[_0x4661('0x30')][_0x4661('0x35')]));_0x481470[_0x4661('0x33')]=_0x481470[_0x4661('0x33')][_0x4661('0x44')]?_0x481470[_0x4661('0x33')]:_0x16ad5b['model'];if(_0x239b50['query'][_0x4661('0x3f')]){_0x481470[_0x4661('0x40')]=[{'all':!![]}];}_0x481470=_[_0x4661('0x3d')]({},_0x481470,_0x239b50['options']);return db[_0x4661('0x2c')][_0x4661('0x45')](_0x481470)[_0x4661('0x26')](handleEntityNotFound(_0x49133c,null))[_0x4661('0x26')](respondWithResult(_0x49133c,null))[_0x4661('0x42')](handleError(_0x49133c,null));};exports[_0x4661('0x46')]=function(_0x1cc9cd,_0x439a06){return db[_0x4661('0x2c')][_0x4661('0x46')](_0x1cc9cd[_0x4661('0x47')],{})[_0x4661('0x26')](respondWithResult(_0x439a06,0xc9))['catch'](handleError(_0x439a06,null));};exports[_0x4661('0x25')]=function(_0x22474a,_0x25cae7){if(_0x22474a[_0x4661('0x47')]['id']){delete _0x22474a['body']['id'];}return db[_0x4661('0x2c')][_0x4661('0x45')]({'where':{'id':_0x22474a[_0x4661('0x43')]['id']}})[_0x4661('0x26')](handleEntityNotFound(_0x25cae7,null))[_0x4661('0x26')](saveUpdates(_0x22474a['body'],null))[_0x4661('0x26')](respondWithResult(_0x25cae7,null))[_0x4661('0x42')](handleError(_0x25cae7,null));};exports[_0x4661('0x27')]=function(_0x5df4a6,_0x9d4f4c){return db[_0x4661('0x2c')][_0x4661('0x45')]({'where':{'id':_0x5df4a6[_0x4661('0x43')]['id']}})['then'](handleEntityNotFound(_0x9d4f4c,null))[_0x4661('0x26')](removeEntity(_0x9d4f4c,null))[_0x4661('0x42')](handleError(_0x9d4f4c,null));};exports[_0x4661('0x48')]=function(_0x69ded7,_0x377a20){return db[_0x4661('0x2c')]['describe']()[_0x4661('0x26')](respondWithResult(_0x377a20,null))['catch'](handleError(_0x377a20,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index df4b8a1..b144e3b 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 _0x62cb=['moment','bluebird','request-promise','path','rimraf','exports','define','user_profile_has_sections','sectionId','userProfileId','../../config/logger','api'];(function(_0x18af99,_0x10fe15){var _0x55583c=function(_0x29f6d3){while(--_0x29f6d3){_0x18af99['push'](_0x18af99['shift']());}};_0x55583c(++_0x10fe15);}(_0x62cb,0x196));var _0xb62c=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x62cb[_0x1fd675];return _0x16b554;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb62c('0x0'))(_0xb62c('0x1'));var moment=require(_0xb62c('0x2'));var BPromise=require(_0xb62c('0x3'));var rp=require(_0xb62c('0x4'));var fs=require('fs');var path=require(_0xb62c('0x5'));var rimraf=require(_0xb62c('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xb62c('0x7')]=function(_0x2601e,_0x42718c){return _0x2601e[_0xb62c('0x8')]('UserProfileSection',attributes,{'tableName':_0xb62c('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb62c('0xa'),_0xb62c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xece1=['path','rimraf','../../config/environment','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xece1,0x89));var _0x1ece=function(_0x2ff8af,_0xd48e8){_0x2ff8af=_0x2ff8af-0x0;var _0x1d7758=_0xece1[_0x2ff8af];return _0x1d7758;};'use strict';var _=require(_0x1ece('0x0'));var util=require(_0x1ece('0x1'));var logger=require(_0x1ece('0x2'))(_0x1ece('0x3'));var moment=require(_0x1ece('0x4'));var BPromise=require(_0x1ece('0x5'));var rp=require(_0x1ece('0x6'));var fs=require('fs');var path=require(_0x1ece('0x7'));var rimraf=require(_0x1ece('0x8'));var config=require(_0x1ece('0x9'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x219f3a,_0xb621f9){return _0x219f3a['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1ece('0xa'),_0x1ece('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 ee2f369..6dde3d5 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 _0xd7a0=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x108db1,_0x89896d){var _0x16848d=function(_0x2726f6){while(--_0x2726f6){_0x108db1['push'](_0x108db1['shift']());}};_0x16848d(++_0x89896d);}(_0xd7a0,0xa0));var _0x0d7a=function(_0x4670a6,_0x48156b){_0x4670a6=_0x4670a6-0x0;var _0x2cac9d=_0xd7a0[_0x4670a6];return _0x2cac9d;};'use strict';var _=require(_0x0d7a('0x0'));var util=require('util');var moment=require(_0x0d7a('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d7a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d7a('0x3'))['db'];var utils=require(_0x0d7a('0x4'));var logger=require(_0x0d7a('0x5'))(_0x0d7a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d7a('0x7')][_0x0d7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12e36f,_0x62da50,_0x14cbdf){return new BPromise(function(_0x2536e0,_0x532336){return client[_0x0d7a('0x9')](_0x12e36f,_0x14cbdf)[_0x0d7a('0xa')](function(_0x437c32){logger[_0x0d7a('0xb')](_0x0d7a('0xc'),_0x62da50,_0x0d7a('0xd'));logger[_0x0d7a('0xe')](_0x0d7a('0xf'),_0x62da50,_0x0d7a('0xd'),JSON['stringify'](_0x437c32));if(_0x437c32[_0x0d7a('0x10')]){if(_0x437c32[_0x0d7a('0x10')][_0x0d7a('0x11')]===0x1f4){logger[_0x0d7a('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x62da50,_0x437c32['error'][_0x0d7a('0x12')]);return _0x532336(_0x437c32[_0x0d7a('0x10')][_0x0d7a('0x12')]);}logger[_0x0d7a('0x10')](_0x0d7a('0xc'),_0x62da50,_0x437c32[_0x0d7a('0x10')][_0x0d7a('0x12')]);return _0x2536e0(_0x437c32[_0x0d7a('0x10')][_0x0d7a('0x12')]);}else{logger[_0x0d7a('0xb')](_0x0d7a('0xc'),_0x62da50,'request\x20sent');_0x2536e0(_0x437c32[_0x0d7a('0x13')][_0x0d7a('0x12')]);}})[_0x0d7a('0x14')](function(_0x9417ee){logger[_0x0d7a('0x10')](_0x0d7a('0xc'),_0x62da50,_0x9417ee);_0x532336(_0x9417ee);});});} \ No newline at end of file +var _0x8b7c=['message','info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b7c,0x1a4));var _0xc8b7=function(_0x54fdd8,_0x2e81ae){_0x54fdd8=_0x54fdd8-0x0;var _0x4f6f8a=_0x8b7c[_0x54fdd8];return _0x4f6f8a;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var moment=require('moment');var BPromise=require(_0xc8b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8b7('0x3'));var db=require(_0xc8b7('0x4'))['db'];var utils=require(_0xc8b7('0x5'));var logger=require(_0xc8b7('0x6'))(_0xc8b7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc8b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e8b20,_0x36699f,_0x9cf0a){return new BPromise(function(_0x2f4bc5,_0x6957dc){return client[_0xc8b7('0x9')](_0x2e8b20,_0x9cf0a)[_0xc8b7('0xa')](function(_0x4a57d5){logger['info'](_0xc8b7('0xb'),_0x36699f,_0xc8b7('0xc'));logger[_0xc8b7('0xd')](_0xc8b7('0xe'),_0x36699f,_0xc8b7('0xc'),JSON['stringify'](_0x4a57d5));if(_0x4a57d5[_0xc8b7('0xf')]){if(_0x4a57d5['error'][_0xc8b7('0x10')]===0x1f4){logger[_0xc8b7('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x36699f,_0x4a57d5[_0xc8b7('0xf')][_0xc8b7('0x11')]);return _0x6957dc(_0x4a57d5[_0xc8b7('0xf')][_0xc8b7('0x11')]);}logger[_0xc8b7('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x36699f,_0x4a57d5[_0xc8b7('0xf')][_0xc8b7('0x11')]);return _0x2f4bc5(_0x4a57d5['error'][_0xc8b7('0x11')]);}else{logger[_0xc8b7('0x12')](_0xc8b7('0xb'),_0x36699f,'request\x20sent');_0x2f4bc5(_0x4a57d5['result'][_0xc8b7('0x11')]);}})['catch'](function(_0x5b03d9){logger[_0xc8b7('0xf')](_0xc8b7('0xb'),_0x36699f,_0x5b03d9);_0x6957dc(_0x5b03d9);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 4e672c0..3c78a8c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3211f6,_0x47eb23){var _0x273e60=function(_0x56c994){while(--_0x56c994){_0x3211f6['push'](_0x3211f6['shift']());}};_0x273e60(++_0x47eb23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0xbe5e12,_0x267c66){var _0x255547=function(_0x1ed314){while(--_0x1ed314){_0xbe5e12['push'](_0xbe5e12['shift']());}};_0x255547(++_0x267c66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 969f4a5..dd82c52 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 _0x8a25=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a25,0x1aa));var _0x58a2=function(_0x38ca14,_0x879e4b){_0x38ca14=_0x38ca14-0x0;var _0x30e0a=_0x8a25[_0x38ca14];return _0x30e0a;};'use strict';var Sequelize=require(_0x58a2('0x0'));module[_0x58a2('0x1')]={'penalty':{'type':Sequelize[_0x58a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x337e=['exports'];(function(_0x5eb17b,_0x1643f7){var _0x6c2689=function(_0x241f2b){while(--_0x241f2b){_0x5eb17b['push'](_0x5eb17b['shift']());}};_0x6c2689(++_0x1643f7);}(_0x337e,0xb6));var _0xe337=function(_0x55849b,_0x2229c1){_0x55849b=_0x55849b-0x0;var _0x4a7713=_0x337e[_0x55849b];return _0x4a7713;};'use strict';var Sequelize=require('sequelize');module[_0xe337('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 20e3a54..c638615 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x52d776,_0x1290ad){var _0x20c6be=function(_0x5f336f){while(--_0x5f336f){_0x52d776['push'](_0x52d776['shift']());}};_0x20c6be(++_0x1290ad);}(_0x5fab,0x177));var _0xb5fa=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x5fab[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9505=['request-promise','path','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','util','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9505,0x1e5));var _0x5950=function(_0x5ac90a,_0xb14416){_0x5ac90a=_0x5ac90a-0x0;var _0x226a9b=_0x9505[_0x5ac90a];return _0x226a9b;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('UserSmsQueue',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 7e96fb6..2e65875 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 _0x3258=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\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','jayson/promise'];(function(_0xf38492,_0x45d84e){var _0x3e66e3=function(_0xf16ba){while(--_0xf16ba){_0xf38492['push'](_0xf38492['shift']());}};_0x3e66e3(++_0x45d84e);}(_0x3258,0xdf));var _0x8325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3258[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8325('0x0'));var util=require(_0x8325('0x1'));var moment=require(_0x8325('0x2'));var BPromise=require(_0x8325('0x3'));var rs=require(_0x8325('0x4'));var fs=require('fs');var Redis=require(_0x8325('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8325('0x6'));var logger=require(_0x8325('0x7'))(_0x8325('0x8'));var config=require(_0x8325('0x9'));var jayson=require(_0x8325('0xa'));var client=jayson[_0x8325('0xb')][_0x8325('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49f886,_0x3a08be,_0x1a0bc7){return new BPromise(function(_0x4a7b49,_0x15a1dc){return client[_0x8325('0xd')](_0x49f886,_0x1a0bc7)[_0x8325('0xe')](function(_0x34d710){logger[_0x8325('0xf')](_0x8325('0x10'),_0x3a08be,_0x8325('0x11'));logger[_0x8325('0x12')](_0x8325('0x13'),_0x3a08be,'request\x20sent',JSON[_0x8325('0x14')](_0x34d710));if(_0x34d710[_0x8325('0x15')]){if(_0x34d710[_0x8325('0x15')][_0x8325('0x16')]===0x1f4){logger['error'](_0x8325('0x10'),_0x3a08be,_0x34d710['error'][_0x8325('0x17')]);return _0x15a1dc(_0x34d710[_0x8325('0x15')][_0x8325('0x17')]);}logger[_0x8325('0x15')]('UserSmsQueue,\x20%s,\x20%s',_0x3a08be,_0x34d710[_0x8325('0x15')][_0x8325('0x17')]);return _0x4a7b49(_0x34d710['error']['message']);}else{logger[_0x8325('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x3a08be,_0x8325('0x11'));_0x4a7b49(_0x34d710[_0x8325('0x18')][_0x8325('0x17')]);}})[_0x8325('0x19')](function(_0x169a76){logger[_0x8325('0x15')](_0x8325('0x10'),_0x3a08be,_0x169a76);_0x15a1dc(_0x169a76);});});} \ No newline at end of file +var _0x133b=['then','info','request\x20sent','debug','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x133b,0x7e));var _0xb133=function(_0x46c8d6,_0x16fa9b){_0x46c8d6=_0x46c8d6-0x0;var _0x2084ec=_0x133b[_0x46c8d6];return _0x2084ec;};'use strict';var _=require(_0xb133('0x0'));var util=require('util');var moment=require(_0xb133('0x1'));var BPromise=require(_0xb133('0x2'));var rs=require(_0xb133('0x3'));var fs=require('fs');var Redis=require(_0xb133('0x4'));var db=require(_0xb133('0x5'))['db'];var utils=require(_0xb133('0x6'));var logger=require(_0xb133('0x7'))('rpc');var config=require(_0xb133('0x8'));var jayson=require(_0xb133('0x9'));var client=jayson[_0xb133('0xa')][_0xb133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c1fce,_0x594d16,_0x1cdbae){return new BPromise(function(_0x39b9d2,_0x4e0a95){return client['request'](_0x3c1fce,_0x1cdbae)[_0xb133('0xc')](function(_0x445c5f){logger[_0xb133('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x594d16,_0xb133('0xe'));logger[_0xb133('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x594d16,'request\x20sent',JSON[_0xb133('0x10')](_0x445c5f));if(_0x445c5f['error']){if(_0x445c5f[_0xb133('0x11')][_0xb133('0x12')]===0x1f4){logger[_0xb133('0x11')](_0xb133('0x13'),_0x594d16,_0x445c5f[_0xb133('0x11')][_0xb133('0x14')]);return _0x4e0a95(_0x445c5f[_0xb133('0x11')][_0xb133('0x14')]);}logger[_0xb133('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x594d16,_0x445c5f['error'][_0xb133('0x14')]);return _0x39b9d2(_0x445c5f[_0xb133('0x11')][_0xb133('0x14')]);}else{logger[_0xb133('0xd')](_0xb133('0x13'),_0x594d16,_0xb133('0xe'));_0x39b9d2(_0x445c5f[_0xb133('0x15')][_0xb133('0x14')]);}})[_0xb133('0x16')](function(_0x13bb58){logger[_0xb133('0x11')](_0xb133('0x13'),_0x594d16,_0x13bb58);_0x4e0a95(_0x13bb58);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 00440b1..6a78bae 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 _0xa490=['INTEGER','exports'];(function(_0x606704,_0x4a08f8){var _0x11a29d=function(_0x36cae3){while(--_0x36cae3){_0x606704['push'](_0x606704['shift']());}};_0x11a29d(++_0x4a08f8);}(_0xa490,0x151));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x0a49('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0a49('0x1')]}}; \ No newline at end of file +var _0x0507=['exports','sequelize'];(function(_0x506389,_0x48a163){var _0x417922=function(_0x4fcf80){while(--_0x4fcf80){_0x506389['push'](_0x506389['shift']());}};_0x417922(++_0x48a163);}(_0x0507,0x85));var _0x7050=function(_0xbfc4d7,_0x1a0757){_0xbfc4d7=_0xbfc4d7-0x0;var _0x3dbcb2=_0x0507[_0xbfc4d7];return _0x3dbcb2;};'use strict';var Sequelize=require(_0x7050('0x0'));module[_0x7050('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6a68870..b70785a 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(_0x236909,_0x5dd4ee){var _0x42fb15=function(_0x345eb2){while(--_0x345eb2){_0x236909['push'](_0x236909['shift']());}};_0x42fb15(++_0x5dd4ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2d6c87,_0x1c9c8c){var _0x2d8715=function(_0x26120b){while(--_0x26120b){_0x2d6c87['push'](_0x2d6c87['shift']());}};_0x2d8715(++_0x1c9c8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 5f4de8a..027d273 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x80f78a,_0x4a7bc9){var _0x2ce3a0=function(_0x550c9a){while(--_0x550c9a){_0x80f78a['push'](_0x80f78a['shift']());}};_0x2ce3a0(++_0x4a7bc9);}(_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(_0x4cf3b3,_0xf78d5b){var _0xe21965=function(_0x5447ee){while(--_0x5447ee){_0x4cf3b3['push'](_0x4cf3b3['shift']());}};_0xe21965(++_0xf78d5b);}(_0xedd9,0xfc));var _0x9edd=function(_0x8efe25,_0x23a546){_0x8efe25=_0x8efe25-0x0;var _0xe0067=_0xedd9[_0x8efe25];return _0xe0067;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index facaf80..6e5d471 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 _0x9f8b=['exports','INTEGER'];(function(_0x2a789f,_0x52d4a2){var _0x43d2d8=function(_0x71e480){while(--_0x71e480){_0x2a789f['push'](_0x2a789f['shift']());}};_0x43d2d8(++_0x52d4a2);}(_0x9f8b,0x9a));var _0xb9f8=function(_0x550168,_0x13e530){_0x550168=_0x550168-0x0;var _0xbc8494=_0x9f8b[_0x550168];return _0xbc8494;};'use strict';var Sequelize=require('sequelize');module[_0xb9f8('0x0')]={'penalty':{'type':Sequelize[_0xb9f8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8134=['exports','INTEGER'];(function(_0x481952,_0x5014be){var _0x40c8b5=function(_0x5ee5b2){while(--_0x5ee5b2){_0x481952['push'](_0x481952['shift']());}};_0x40c8b5(++_0x5014be);}(_0x8134,0x78));var _0x4813=function(_0xd0f2a,_0x3abff7){_0xd0f2a=_0xd0f2a-0x0;var _0x32ba01=_0x8134[_0xd0f2a];return _0x32ba01;};'use strict';var Sequelize=require('sequelize');module[_0x4813('0x0')]={'penalty':{'type':Sequelize[_0x4813('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 78dcbfb..3972633 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 _0x3bb5=['api','bluebird','request-promise','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util','../../config/logger'];(function(_0x11319c,_0x5c7967){var _0x3b0930=function(_0x4d190d){while(--_0x4d190d){_0x11319c['push'](_0x11319c['shift']());}};_0x3b0930(++_0x5c7967);}(_0x3bb5,0x10c));var _0x53bb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3bb5[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x53bb('0x0'));var logger=require(_0x53bb('0x1'))(_0x53bb('0x2'));var moment=require('moment');var BPromise=require(_0x53bb('0x3'));var rp=require(_0x53bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53bb('0x5'));var config=require('../../config/environment');var attributes=require(_0x53bb('0x6'));module[_0x53bb('0x7')]=function(_0x3329f0,_0x38b374){return _0x3329f0[_0x53bb('0x8')](_0x53bb('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc585=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util'];(function(_0x48c6e6,_0x48473d){var _0x21e8b4=function(_0xeba3e3){while(--_0xeba3e3){_0x48c6e6['push'](_0x48c6e6['shift']());}};_0x21e8b4(++_0x48473d);}(_0xc585,0x1ba));var _0x5c58=function(_0x150e13,_0x31b36a){_0x150e13=_0x150e13-0x0;var _0x2b2a5a=_0xc585[_0x150e13];return _0x2b2a5a;};'use strict';var _=require(_0x5c58('0x0'));var util=require(_0x5c58('0x1'));var logger=require(_0x5c58('0x2'))(_0x5c58('0x3'));var moment=require('moment');var BPromise=require(_0x5c58('0x4'));var rp=require(_0x5c58('0x5'));var fs=require('fs');var path=require(_0x5c58('0x6'));var rimraf=require('rimraf');var config=require(_0x5c58('0x7'));var attributes=require(_0x5c58('0x8'));module[_0x5c58('0x9')]=function(_0x482e4f,_0xf98b8e){return _0x482e4f[_0x5c58('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x5c58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 7faeea4..7ad9896 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 _0x1c7b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0x5de237,_0x2058e8){var _0x3b3d4d=function(_0x3debe1){while(--_0x3debe1){_0x5de237['push'](_0x5de237['shift']());}};_0x3b3d4d(++_0x2058e8);}(_0x1c7b,0x1cc));var _0xb1c7=function(_0x3ed508,_0x5db946){_0x3ed508=_0x3ed508-0x0;var _0x20d2ee=_0x1c7b[_0x3ed508];return _0x20d2ee;};'use strict';var _=require(_0xb1c7('0x0'));var util=require(_0xb1c7('0x1'));var moment=require(_0xb1c7('0x2'));var BPromise=require(_0xb1c7('0x3'));var rs=require(_0xb1c7('0x4'));var fs=require('fs');var Redis=require(_0xb1c7('0x5'));var db=require(_0xb1c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1c7('0x7'))('rpc');var config=require(_0xb1c7('0x8'));var jayson=require(_0xb1c7('0x9'));var client=jayson[_0xb1c7('0xa')][_0xb1c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26cb7a,_0x1b6e27,_0x40f69c){return new BPromise(function(_0x3735d4,_0x4260dc){return client['request'](_0x26cb7a,_0x40f69c)[_0xb1c7('0xc')](function(_0x33556a){logger[_0xb1c7('0xd')](_0xb1c7('0xe'),_0x1b6e27,_0xb1c7('0xf'));logger[_0xb1c7('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1b6e27,'request\x20sent',JSON['stringify'](_0x33556a));if(_0x33556a['error']){if(_0x33556a['error']['code']===0x1f4){logger[_0xb1c7('0x11')](_0xb1c7('0xe'),_0x1b6e27,_0x33556a[_0xb1c7('0x11')][_0xb1c7('0x12')]);return _0x4260dc(_0x33556a['error']['message']);}logger[_0xb1c7('0x11')](_0xb1c7('0xe'),_0x1b6e27,_0x33556a[_0xb1c7('0x11')][_0xb1c7('0x12')]);return _0x3735d4(_0x33556a[_0xb1c7('0x11')][_0xb1c7('0x12')]);}else{logger['info'](_0xb1c7('0xe'),_0x1b6e27,_0xb1c7('0xf'));_0x3735d4(_0x33556a[_0xb1c7('0x13')]['message']);}})[_0xb1c7('0x14')](function(_0x42ed26){logger[_0xb1c7('0x11')](_0xb1c7('0xe'),_0x1b6e27,_0x42ed26);_0x4260dc(_0x42ed26);});});} \ No newline at end of file +var _0x0a07=['client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x19ab8e,_0xa72634){var _0x430315=function(_0x53acd0){while(--_0x53acd0){_0x19ab8e['push'](_0x19ab8e['shift']());}};_0x430315(++_0xa72634);}(_0x0a07,0x1ac));var _0x70a0=function(_0x255af9,_0xf891fe){_0x255af9=_0x255af9-0x0;var _0x35bf86=_0x0a07[_0x255af9];return _0x35bf86;};'use strict';var _=require(_0x70a0('0x0'));var util=require('util');var moment=require(_0x70a0('0x1'));var BPromise=require(_0x70a0('0x2'));var rs=require(_0x70a0('0x3'));var fs=require('fs');var Redis=require(_0x70a0('0x4'));var db=require(_0x70a0('0x5'))['db'];var utils=require(_0x70a0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x70a0('0x7'));var jayson=require(_0x70a0('0x8'));var client=jayson[_0x70a0('0x9')][_0x70a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227bbd,_0x5f2102,_0x5487fe){return new BPromise(function(_0x34ff09,_0x119050){return client[_0x70a0('0xb')](_0x227bbd,_0x5487fe)['then'](function(_0x5ac718){logger[_0x70a0('0xc')](_0x70a0('0xd'),_0x5f2102,_0x70a0('0xe'));logger[_0x70a0('0xf')](_0x70a0('0x10'),_0x5f2102,_0x70a0('0xe'),JSON[_0x70a0('0x11')](_0x5ac718));if(_0x5ac718[_0x70a0('0x12')]){if(_0x5ac718[_0x70a0('0x12')][_0x70a0('0x13')]===0x1f4){logger[_0x70a0('0x12')](_0x70a0('0xd'),_0x5f2102,_0x5ac718[_0x70a0('0x12')][_0x70a0('0x14')]);return _0x119050(_0x5ac718[_0x70a0('0x12')]['message']);}logger[_0x70a0('0x12')](_0x70a0('0xd'),_0x5f2102,_0x5ac718[_0x70a0('0x12')][_0x70a0('0x14')]);return _0x34ff09(_0x5ac718['error']['message']);}else{logger[_0x70a0('0xc')](_0x70a0('0xd'),_0x5f2102,'request\x20sent');_0x34ff09(_0x5ac718[_0x70a0('0x15')][_0x70a0('0x14')]);}})[_0x70a0('0x16')](function(_0x166157){logger[_0x70a0('0x12')](_0x70a0('0xd'),_0x5f2102,_0x166157);_0x119050(_0x166157);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b25e87e..466be8d 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2fc3f6,_0x4eb88a){var _0x1dabbb=function(_0x3bfc26){while(--_0x3bfc26){_0x2fc3f6['push'](_0x2fc3f6['shift']());}};_0x1dabbb(++_0x4eb88a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xcb91[_0x26b5ff];return _0x58603e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x35b8c6,_0x6962b2){var _0x40ef44=function(_0x59d5a2){while(--_0x59d5a2){_0x35b8c6['push'](_0x35b8c6['shift']());}};_0x40ef44(++_0x6962b2);}(_0xedd9,0xfc));var _0x9edd=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0xedd9[_0x27650e];return _0x28fe08;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c99a2c8..ee9fb0b 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 _0xa67a=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xa67a,0x114));var _0xaa67=function(_0x38d49a,_0x2eec68){_0x38d49a=_0x38d49a-0x0;var _0x3f087c=_0xa67a[_0x38d49a];return _0x3f087c;};'use strict';var Sequelize=require(_0xaa67('0x0'));module[_0xaa67('0x1')]={'uniqueid':{'type':Sequelize[_0xaa67('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xaa67('0x3')},'membername':{'type':Sequelize[_0xaa67('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xaa67('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xaa67('0x4')],'allowNull':![],'unique':_0xaa67('0x5'),'comment':_0xaa67('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaa67('0x5'),'comment':_0xaa67('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xaa67('0x3')},'paused':{'type':Sequelize[_0xaa67('0x2')](0xb),'defaultValue':0x0,'comment':_0xaa67('0x3')}}; \ No newline at end of file +var _0xc830=['STRING','INTEGER','queue_interface','sequelize','Required\x20by\x20Asterisk'];(function(_0x319a5d,_0x2ed886){var _0x51e9e7=function(_0x4858fc){while(--_0x4858fc){_0x319a5d['push'](_0x319a5d['shift']());}};_0x51e9e7(++_0x2ed886);}(_0xc830,0x85));var _0x0c83=function(_0xdd0b24,_0x5b3634){_0xdd0b24=_0xdd0b24-0x0;var _0x343dba=_0xc830[_0xdd0b24];return _0x343dba;};'use strict';var Sequelize=require(_0x0c83('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0c83('0x1')},'membername':{'type':Sequelize[_0x0c83('0x2')],'allowNull':![],'comment':_0x0c83('0x1')},'UserId':{'type':Sequelize[_0x0c83('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0c83('0x2')],'allowNull':![],'unique':_0x0c83('0x4'),'comment':_0x0c83('0x1')},'VoiceQueueId':{'type':Sequelize[_0x0c83('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x0c83('0x2')],'allowNull':![],'unique':_0x0c83('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x0c83('0x3')](0xb),'defaultValue':0x0,'comment':_0x0c83('0x1')},'paused':{'type':Sequelize[_0x0c83('0x3')](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 53e95a7..e7ff93d 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 _0x736a=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x736a,0x11f));var _0xa736=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x736a[_0x11ce46];return _0x368a1e;};'use strict';var EventEmitter=require(_0xa736('0x0'));var UserVoiceQueueRt=require(_0xa736('0x1'))['db'][_0xa736('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa736('0x3')](0x0);var events={'afterCreate':_0xa736('0x4'),'afterUpdate':'update','afterDestroy':_0xa736('0x5')};function emitEvent(_0x27ca5d){return function(_0x108c5f,_0x377a0a,_0x229260){UserVoiceQueueRtEvents['emit'](_0x27ca5d+':'+_0x108c5f['id'],_0x108c5f);UserVoiceQueueRtEvents[_0xa736('0x6')](_0x27ca5d,_0x108c5f);_0x229260(null);};}for(var e in events){if(events[_0xa736('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xa736('0x8')](e,emitEvent(event));}}module[_0xa736('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x1608=['remove','hasOwnProperty','hook','events','UserVoiceQueueRt','save','update'];(function(_0x486e64,_0x1e1eb2){var _0x404b49=function(_0x2cd3be){while(--_0x2cd3be){_0x486e64['push'](_0x486e64['shift']());}};_0x404b49(++_0x1e1eb2);}(_0x1608,0x1ae));var _0x8160=function(_0x385ba1,_0x380b3c){_0x385ba1=_0x385ba1-0x0;var _0x5472b6=_0x1608[_0x385ba1];return _0x5472b6;};'use strict';var EventEmitter=require(_0x8160('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x8160('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8160('0x2'),'afterUpdate':_0x8160('0x3'),'afterDestroy':_0x8160('0x4')};function emitEvent(_0x1e32f7){return function(_0x4afcc0,_0x138efd,_0x2bc314){UserVoiceQueueRtEvents['emit'](_0x1e32f7+':'+_0x4afcc0['id'],_0x4afcc0);UserVoiceQueueRtEvents['emit'](_0x1e32f7,_0x4afcc0);_0x2bc314(null);};}for(var e in events){if(events[_0x8160('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x8160('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index cca0632..7371855 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 _0x3a86=['moment','bluebird','request-promise','../../config/environment','exports','define','lodash'];(function(_0x1922c5,_0x4e6689){var _0x4e7ec2=function(_0x23b1d9){while(--_0x23b1d9){_0x1922c5['push'](_0x1922c5['shift']());}};_0x4e7ec2(++_0x4e6689);}(_0x3a86,0xe6));var _0x63a8=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x3a86[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0x63a8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x63a8('0x1'));var BPromise=require(_0x63a8('0x2'));var rp=require(_0x63a8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x63a8('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x63a8('0x5')]=function(_0x35c0be,_0x18fcaf){return _0x35c0be[_0x63a8('0x6')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d20=['user_has_voice_queues_rt','lodash','api','moment','bluebird','request-promise','rimraf','UserVoiceQueueRt'];(function(_0xc44bc,_0x443875){var _0x1c2635=function(_0x5dfa6a){while(--_0x5dfa6a){_0xc44bc['push'](_0xc44bc['shift']());}};_0x1c2635(++_0x443875);}(_0x1d20,0x149));var _0x01d2=function(_0x1ce5cd,_0x5383ba){_0x1ce5cd=_0x1ce5cd-0x0;var _0x557a63=_0x1d20[_0x1ce5cd];return _0x557a63;};'use strict';var _=require(_0x01d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x01d2('0x1'));var moment=require(_0x01d2('0x2'));var BPromise=require(_0x01d2('0x3'));var rp=require(_0x01d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01d2('0x5'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x44f3d1,_0x2a4686){return _0x44f3d1['define'](_0x01d2('0x6'),attributes,{'tableName':_0x01d2('0x7'),'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 ac28e05..4514125 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 _0x0614=['info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x3dbbd2,_0x5a260a){var _0x5520bf=function(_0x2ef2fc){while(--_0x2ef2fc){_0x3dbbd2['push'](_0x3dbbd2['shift']());}};_0x5520bf(++_0x5a260a);}(_0x0614,0x1dc));var _0x4061=function(_0xea7265,_0x58f613){_0xea7265=_0xea7265-0x0;var _0x6f92c8=_0x0614[_0xea7265];return _0x6f92c8;};'use strict';var _=require(_0x4061('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4061('0x1'));var rs=require(_0x4061('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4061('0x3'))['db'];var utils=require(_0x4061('0x4'));var logger=require(_0x4061('0x5'))(_0x4061('0x6'));var config=require(_0x4061('0x7'));var jayson=require(_0x4061('0x8'));var client=jayson[_0x4061('0x9')][_0x4061('0xa')]({'port':0x232a});config[_0x4061('0xb')]=_[_0x4061('0xc')](config[_0x4061('0xb')],{'host':_0x4061('0xd'),'port':0x18eb});var socket=require(_0x4061('0xe'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x4061('0xf')](socket);function respondWithRpcPromise(_0x4b0ca6,_0x59c26a,_0xc62c3d){return new BPromise(function(_0xe1a859,_0x30a964){return client[_0x4061('0x10')](_0x4b0ca6,_0xc62c3d)[_0x4061('0x11')](function(_0x2e9685){logger[_0x4061('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x59c26a,_0x4061('0x13'));logger[_0x4061('0x14')](_0x4061('0x15'),_0x59c26a,_0x4061('0x13'),JSON[_0x4061('0x16')](_0x2e9685));if(_0x2e9685[_0x4061('0x17')]){if(_0x2e9685[_0x4061('0x17')][_0x4061('0x18')]===0x1f4){logger[_0x4061('0x17')](_0x4061('0x19'),_0x59c26a,_0x2e9685['error']['message']);return _0x30a964(_0x2e9685[_0x4061('0x17')]['message']);}logger[_0x4061('0x17')](_0x4061('0x19'),_0x59c26a,_0x2e9685[_0x4061('0x17')][_0x4061('0x1a')]);return _0xe1a859(_0x2e9685[_0x4061('0x17')]['message']);}else{logger[_0x4061('0x12')](_0x4061('0x19'),_0x59c26a,_0x4061('0x13'));_0xe1a859(_0x2e9685[_0x4061('0x1b')]['message']);}})['catch'](function(_0x40359b){logger['error'](_0x4061('0x19'),_0x59c26a,_0x40359b);_0x30a964(_0x40359b);});});}exports[_0x4061('0x1c')]=function(_0x54488f){var _0x40e8c2=this;return new Promise(function(_0x3d2236,_0x13ccdf){return db['UserVoiceQueueRt'][_0x4061('0x1d')]({'raw':_0x54488f[_0x4061('0x1e')]?_0x54488f[_0x4061('0x1e')][_0x4061('0x1f')]===undefined?!![]:![]:!![],'where':_0x54488f[_0x4061('0x1e')]?_0x54488f['options'][_0x4061('0x20')]||null:null,'attributes':[[db[_0x4061('0x21')]['fn']('COUNT',db[_0x4061('0x21')]['fn']('IF',db[_0x4061('0x21')][_0x4061('0x22')](_0x4061('0x23')))),_0x4061('0x24')]]})[_0x4061('0x11')](function(_0x2383a2){logger['info'](_0x4061('0x1c'),_0x54488f);logger[_0x4061('0x14')](_0x4061('0x1c'),_0x54488f,JSON['stringify'](_0x2383a2));_0x3d2236(_0x2383a2);})[_0x4061('0x25')](function(_0x16f980){logger[_0x4061('0x17')](_0x4061('0x1c'),_0x16f980[_0x4061('0x1a')],_0x54488f);_0x13ccdf(_0x40e8c2[_0x4061('0x17')](0x1f4,_0x16f980['message']));});});}; \ No newline at end of file +var _0xde00=['error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0xde00,0xdb));var _0x0de0=function(_0x1f7962,_0x181f16){_0x1f7962=_0x1f7962-0x0;var _0x3af491=_0xde00[_0x1f7962];return _0x3af491;};'use strict';var _=require('lodash');var util=require(_0x0de0('0x0'));var moment=require(_0x0de0('0x1'));var BPromise=require(_0x0de0('0x2'));var rs=require(_0x0de0('0x3'));var fs=require('fs');var Redis=require(_0x0de0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0de0('0x5'));var logger=require(_0x0de0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0de0('0x7'));var client=jayson['client'][_0x0de0('0x8')]({'port':0x232a});config['redis']=_[_0x0de0('0x9')](config['redis'],{'host':_0x0de0('0xa'),'port':0x18eb});var socket=require(_0x0de0('0xb'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x0de0('0xc')](socket);function respondWithRpcPromise(_0x5818f6,_0x107440,_0x37b497){return new BPromise(function(_0x526940,_0x404b69){return client[_0x0de0('0xd')](_0x5818f6,_0x37b497)[_0x0de0('0xe')](function(_0x5a2c4e){logger[_0x0de0('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107440,_0x0de0('0x10'));logger[_0x0de0('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x107440,'request\x20sent',JSON[_0x0de0('0x12')](_0x5a2c4e));if(_0x5a2c4e[_0x0de0('0x13')]){if(_0x5a2c4e['error'][_0x0de0('0x14')]===0x1f4){logger[_0x0de0('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107440,_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);return _0x404b69(_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);}logger[_0x0de0('0x13')](_0x0de0('0x16'),_0x107440,_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);return _0x526940(_0x5a2c4e[_0x0de0('0x13')][_0x0de0('0x15')]);}else{logger[_0x0de0('0xf')](_0x0de0('0x16'),_0x107440,_0x0de0('0x10'));_0x526940(_0x5a2c4e[_0x0de0('0x17')][_0x0de0('0x15')]);}})[_0x0de0('0x18')](function(_0x3e91c4){logger[_0x0de0('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x107440,_0x3e91c4);_0x404b69(_0x3e91c4);});});}exports['GetVoiceQueueRtPauses']=function(_0x178493){var _0x3426f2=this;return new Promise(function(_0x2593bb,_0x21b156){return db['UserVoiceQueueRt'][_0x0de0('0x19')]({'raw':_0x178493[_0x0de0('0x1a')]?_0x178493[_0x0de0('0x1a')][_0x0de0('0x1b')]===undefined?!![]:![]:!![],'where':_0x178493['options']?_0x178493['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x0de0('0x1c'),db[_0x0de0('0x1d')]['fn']('IF',db[_0x0de0('0x1d')][_0x0de0('0x1e')](_0x0de0('0x1f')))),_0x0de0('0x20')]]})[_0x0de0('0xe')](function(_0x38d6ce){logger[_0x0de0('0xf')](_0x0de0('0x21'),_0x178493);logger[_0x0de0('0x11')](_0x0de0('0x21'),_0x178493,JSON['stringify'](_0x38d6ce));_0x2593bb(_0x38d6ce);})['catch'](function(_0xfea0bc){logger[_0x0de0('0x13')](_0x0de0('0x21'),_0xfea0bc[_0x0de0('0x15')],_0x178493);_0x21b156(_0x3426f2[_0x0de0('0x13')](0x1f4,_0xfea0bc['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index afac864..491979d 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 _0xe2fe=['update','emit','register','length','./userVoiceQueueRt.events'];(function(_0x3f2106,_0x1af165){var _0x3db0cf=function(_0x595dd0){while(--_0x595dd0){_0x3f2106['push'](_0x3f2106['shift']());}};_0x3db0cf(++_0x1af165);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var UserVoiceQueueRtEvents=require(_0xee2f('0x0'));var events=['save','remove',_0xee2f('0x1')];function createListener(_0x5e18ae,_0x169cf9){return function(_0x1b6f4c){_0x169cf9[_0xee2f('0x2')](_0x5e18ae,_0x1b6f4c);};}function removeListener(_0x2d2b03,_0xcb45e6){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2d2b03,_0xcb45e6);};}exports[_0xee2f('0x3')]=function(_0x2b7e7c){for(var _0x49926b=0x0,_0x1533a0=events[_0xee2f('0x4')];_0x49926b<_0x1533a0;_0x49926b++){var _0x5a7975=events[_0x49926b];var _0x3c4095=createListener('userVoiceQueueRt:'+_0x5a7975,_0x2b7e7c);UserVoiceQueueRtEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file +var _0x0024=['save','update','length','userVoiceQueueRt:'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x0024,0xa8));var _0x4002=function(_0x1f6895,_0x3193e7){_0x1f6895=_0x1f6895-0x0;var _0x27d864=_0x0024[_0x1f6895];return _0x27d864;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x4002('0x0'),'remove',_0x4002('0x1')];function createListener(_0x4a4ac0,_0x3db8e9){return function(_0x5d7431){_0x3db8e9['emit'](_0x4a4ac0,_0x5d7431);};}function removeListener(_0x423907,_0x1190e7){return function(){UserVoiceQueueRtEvents['removeListener'](_0x423907,_0x1190e7);};}exports['register']=function(_0x36c011){for(var _0x144717=0x0,_0x15d53a=events[_0x4002('0x2')];_0x144717<_0x15d53a;_0x144717++){var _0x47b0bb=events[_0x144717];var _0x41ed1e=createListener(_0x4002('0x3')+_0x47b0bb,_0x36c011);UserVoiceQueueRtEvents['on'](_0x47b0bb,_0x41ed1e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2ee5773..b1deee5 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x23bd2f,_0x1b4ba7){var _0x44892c=function(_0x15ec0b){while(--_0x15ec0b){_0x23bd2f['push'](_0x23bd2f['shift']());}};_0x44892c(++_0x1b4ba7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xcb91[_0x351509];return _0x4e9861;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5169b9,_0x4933ce){var _0x388646=function(_0xb8d21){while(--_0xb8d21){_0x5169b9['push'](_0x5169b9['shift']());}};_0x388646(++_0x4933ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e09ff,_0x361bf3){_0x5e09ff=_0x5e09ff-0x0;var _0x294004=_0xedd9[_0x5e09ff];return _0x294004;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3f0ebed..2435fb3 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 _0xc431=['sequelize','exports','INTEGER'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0xc431,0x15c));var _0x1c43=function(_0x1c1179,_0x5bfcae){_0x1c1179=_0x1c1179-0x0;var _0x428365=_0xc431[_0x1c1179];return _0x428365;};'use strict';var Sequelize=require(_0x1c43('0x0'));module[_0x1c43('0x1')]={'penalty':{'type':Sequelize[_0x1c43('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe211=['sequelize','exports','INTEGER'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe211,0x19e));var _0x1e21=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe211[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1e21('0x0'));module[_0x1e21('0x1')]={'penalty':{'type':Sequelize[_0x1e21('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 a5ff643..ee811c5 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 _0x060c=['util','moment','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x060c,0xd0));var _0xc060=function(_0x33e3ef,_0xa69f4b){_0x33e3ef=_0x33e3ef-0x0;var _0x153137=_0x060c[_0x33e3ef];return _0x153137;};'use strict';var _=require(_0xc060('0x0'));var util=require(_0xc060('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc060('0x2'));var BPromise=require('bluebird');var rp=require(_0xc060('0x3'));var fs=require('fs');var path=require(_0xc060('0x4'));var rimraf=require(_0xc060('0x5'));var config=require('../../config/environment');var attributes=require(_0xc060('0x6'));module[_0xc060('0x7')]=function(_0x5ab3da,_0x24e48f){return _0x5ab3da[_0xc060('0x8')](_0xc060('0x9'),attributes,{'tableName':_0xc060('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e61=['UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0x3d2ad6,_0x2d96cb){var _0x8d0bca=function(_0x516f7f){while(--_0x516f7f){_0x3d2ad6['push'](_0x3d2ad6['shift']());}};_0x8d0bca(++_0x2d96cb);}(_0x8e61,0x65));var _0x18e6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8e61[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x18e6('0x0'))('api');var moment=require(_0x18e6('0x1'));var BPromise=require(_0x18e6('0x2'));var rp=require(_0x18e6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18e6('0x4'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x18e6('0x5')]=function(_0x3e3a27,_0x1c0939){return _0x3e3a27[_0x18e6('0x6')](_0x18e6('0x7'),attributes,{'tableName':_0x18e6('0x8'),'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 f080aa7..918fd3f 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 _0xcf3e=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5eee53,_0x21813a){var _0x186db6=function(_0x2795da){while(--_0x2795da){_0x5eee53['push'](_0x5eee53['shift']());}};_0x186db6(++_0x21813a);}(_0xcf3e,0x1a5));var _0xecf3=function(_0x9d2f05,_0x488ff0){_0x9d2f05=_0x9d2f05-0x0;var _0x1ba001=_0xcf3e[_0x9d2f05];return _0x1ba001;};'use strict';var _=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var moment=require(_0xecf3('0x2'));var BPromise=require(_0xecf3('0x3'));var rs=require(_0xecf3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xecf3('0x5'))['db'];var utils=require(_0xecf3('0x6'));var logger=require(_0xecf3('0x7'))(_0xecf3('0x8'));var config=require(_0xecf3('0x9'));var jayson=require(_0xecf3('0xa'));var client=jayson[_0xecf3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1012c1,_0x56cd2c,_0x35ddd6){return new BPromise(function(_0x21e61e,_0x3bfefd){return client['request'](_0x1012c1,_0x35ddd6)['then'](function(_0x21b6af){logger['info'](_0xecf3('0xc'),_0x56cd2c,_0xecf3('0xd'));logger[_0xecf3('0xe')](_0xecf3('0xf'),_0x56cd2c,_0xecf3('0xd'),JSON[_0xecf3('0x10')](_0x21b6af));if(_0x21b6af[_0xecf3('0x11')]){if(_0x21b6af[_0xecf3('0x11')][_0xecf3('0x12')]===0x1f4){logger[_0xecf3('0x11')](_0xecf3('0xc'),_0x56cd2c,_0x21b6af['error'][_0xecf3('0x13')]);return _0x3bfefd(_0x21b6af[_0xecf3('0x11')][_0xecf3('0x13')]);}logger['error'](_0xecf3('0xc'),_0x56cd2c,_0x21b6af[_0xecf3('0x11')][_0xecf3('0x13')]);return _0x21e61e(_0x21b6af[_0xecf3('0x11')][_0xecf3('0x13')]);}else{logger['info'](_0xecf3('0xc'),_0x56cd2c,_0xecf3('0xd'));_0x21e61e(_0x21b6af[_0xecf3('0x14')]['message']);}})[_0xecf3('0x15')](function(_0x3b3f3e){logger[_0xecf3('0x11')](_0xecf3('0xc'),_0x56cd2c,_0x3b3f3e);_0x3bfefd(_0x3b3f3e);});});} \ No newline at end of file +var _0xbef0=['request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0xbef0,0x197));var _0x0bef=function(_0xf0c2d,_0x37915e){_0xf0c2d=_0xf0c2d-0x0;var _0x2994dc=_0xbef0[_0xf0c2d];return _0x2994dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bef('0x0'));var BPromise=require(_0x0bef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bef('0x3'));var logger=require('../../config/logger')(_0x0bef('0x4'));var config=require(_0x0bef('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0bef('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5f5461,_0x327926,_0xcf097b){return new BPromise(function(_0x57f293,_0x559adc){return client[_0x0bef('0x7')](_0x5f5461,_0xcf097b)[_0x0bef('0x8')](function(_0x397b6d){logger['info'](_0x0bef('0x9'),_0x327926,_0x0bef('0xa'));logger['debug'](_0x0bef('0xb'),_0x327926,'request\x20sent',JSON[_0x0bef('0xc')](_0x397b6d));if(_0x397b6d[_0x0bef('0xd')]){if(_0x397b6d['error'][_0x0bef('0xe')]===0x1f4){logger[_0x0bef('0xd')](_0x0bef('0x9'),_0x327926,_0x397b6d[_0x0bef('0xd')]['message']);return _0x559adc(_0x397b6d[_0x0bef('0xd')][_0x0bef('0xf')]);}logger[_0x0bef('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x327926,_0x397b6d[_0x0bef('0xd')][_0x0bef('0xf')]);return _0x57f293(_0x397b6d[_0x0bef('0xd')]['message']);}else{logger[_0x0bef('0x10')](_0x0bef('0x9'),_0x327926,_0x0bef('0xa'));_0x57f293(_0x397b6d['result'][_0x0bef('0xf')]);}})[_0x0bef('0x11')](function(_0x458dc8){logger[_0x0bef('0xd')](_0x0bef('0x9'),_0x327926,_0x458dc8);_0x559adc(_0x458dc8);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 43f30ba..ca71bc7 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 _0x9589=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x9589,0xbc));var _0x9958=function(_0x465b44,_0x18b4fd){_0x465b44=_0x465b44-0x0;var _0x551b9f=_0x9589[_0x465b44];return _0x551b9f;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var fs_extra=require(_0x9958('0x5'));var auth=require(_0x9958('0x6'));var interaction=require(_0x9958('0x7'));var config=require('../../config/environment');var controller=require(_0x9958('0x8'));router[_0x9958('0x9')]('/',auth[_0x9958('0xa')](),controller[_0x9958('0xb')]);router[_0x9958('0x9')](_0x9958('0xc'),auth['isAuthenticated'](),controller[_0x9958('0xd')]);router[_0x9958('0xe')]('/',auth[_0x9958('0xa')](),controller[_0x9958('0xf')]);router[_0x9958('0x10')](_0x9958('0xc'),auth[_0x9958('0xa')](),controller[_0x9958('0x11')]);router[_0x9958('0x12')](_0x9958('0xc'),auth[_0x9958('0xa')](),controller[_0x9958('0x13')]);module[_0x9958('0x14')]=router; \ No newline at end of file +var _0x692c=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show'];(function(_0x53933b,_0x1be31d){var _0x1e8224=function(_0x531406){while(--_0x531406){_0x53933b['push'](_0x53933b['shift']());}};_0x1e8224(++_0x1be31d);}(_0x692c,0x6a));var _0xc692=function(_0x54ca24,_0x42419e){_0x54ca24=_0x54ca24-0x0;var _0x1db15e=_0x692c[_0x54ca24];return _0x1db15e;};'use strict';var multer=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var path=require(_0xc692('0x2'));var timeout=require(_0xc692('0x3'));var express=require(_0xc692('0x4'));var router=express[_0xc692('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc692('0x6'));var interaction=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var controller=require(_0xc692('0x9'));router[_0xc692('0xa')]('/',auth[_0xc692('0xb')](),controller['index']);router['get'](_0xc692('0xc'),auth[_0xc692('0xb')](),controller[_0xc692('0xd')]);router[_0xc692('0xe')]('/',auth[_0xc692('0xb')](),controller[_0xc692('0xf')]);router[_0xc692('0x10')]('/:id',auth[_0xc692('0xb')](),controller[_0xc692('0x11')]);router[_0xc692('0x12')](_0xc692('0xc'),auth[_0xc692('0xb')](),controller['destroy']);module[_0xc692('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 82328ba..c15433b 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 _0x4a93=['exports','sequelize'];(function(_0xec55,_0x585db9){var _0x43e316=function(_0x4c935e){while(--_0x4c935e){_0xec55['push'](_0xec55['shift']());}};_0x43e316(++_0x585db9);}(_0x4a93,0x1bf));var _0x34a9=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4a93[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x34a9('0x0'));module[_0x34a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1228=['STRING','name','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1228,0x7a));var _0x8122=function(_0x41be90,_0x982c24){_0x41be90=_0x41be90-0x0;var _0xee1c82=_0x1228[_0x41be90];return _0xee1c82;};'use strict';var Sequelize=require('sequelize');module[_0x8122('0x0')]={'name':{'type':Sequelize[_0x8122('0x1')],'unique':_0x8122('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8122('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6d9f832..aa6b42d 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 _0x4413=['pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','Variable','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x53448c,_0x2ef0fe){var _0x233e1a=function(_0x37b75b){while(--_0x37b75b){_0x53448c['push'](_0x53448c['shift']());}};_0x233e1a(++_0x2ef0fe);}(_0x4413,0x158));var _0x3441=function(_0x1ebc32,_0x7cd7cd){_0x1ebc32=_0x1ebc32-0x0;var _0x1d9acb=_0x4413[_0x1ebc32];return _0x1d9acb;};'use strict';var emlformat=require(_0x3441('0x0'));var rimraf=require(_0x3441('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3441('0x2'));var rp=require(_0x3441('0x3'));var moment=require(_0x3441('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3441('0x5'));var util=require(_0x3441('0x6'));var path=require(_0x3441('0x7'));var sox=require(_0x3441('0x8'));var csv=require('to-csv');var ejs=require(_0x3441('0x9'));var fs=require('fs');var fs_extra=require(_0x3441('0xa'));var _=require(_0x3441('0xb'));var squel=require('squel');var crypto=require(_0x3441('0xc'));var jsforce=require(_0x3441('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3441('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3441('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3441('0x10'))(_0x3441('0x11'));var utils=require(_0x3441('0x12'));var config=require(_0x3441('0x13'));var licenseUtil=require(_0x3441('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49ecc8,_0x5ecc85){_0x5ecc85=_0x5ecc85||0xcc;return function(_0x27e178){if(_0x27e178){return _0x49ecc8[_0x3441('0x15')](_0x5ecc85);}return _0x49ecc8[_0x3441('0x16')](_0x5ecc85)[_0x3441('0x17')]();};}function respondWithResult(_0x514658,_0x3414ab){_0x3414ab=_0x3414ab||0xc8;return function(_0x14a2a0){if(_0x14a2a0){return _0x514658[_0x3441('0x16')](_0x3414ab)[_0x3441('0x18')](_0x14a2a0);}};}function respondWithFilteredResult(_0x40d3fe,_0x29677d){return function(_0x4c6386){if(_0x4c6386){var _0x5f3428=typeof _0x29677d[_0x3441('0x19')]==='undefined'&&typeof _0x29677d[_0x3441('0x1a')]===_0x3441('0x1b');var _0x54d276=_0x4c6386[_0x3441('0x1c')];var _0x2f08fb=_0x5f3428?0x0:_0x29677d[_0x3441('0x19')];var _0x4ff7d4=_0x5f3428?_0x4c6386[_0x3441('0x1c')]:_0x29677d[_0x3441('0x19')]+_0x29677d[_0x3441('0x1a')];var _0x1adc43;if(_0x4ff7d4>=_0x54d276){_0x4ff7d4=_0x54d276;_0x1adc43=0xc8;}else{_0x1adc43=0xce;}_0x40d3fe[_0x3441('0x16')](_0x1adc43);return _0x40d3fe[_0x3441('0x1d')](_0x3441('0x1e'),_0x2f08fb+'-'+_0x4ff7d4+'/'+_0x54d276)['json'](_0x4c6386);}return null;};}function patchUpdates(_0x46127){return function(_0x828537){try{jsonpatch[_0x3441('0x1f')](_0x828537,_0x46127,!![]);}catch(_0x63a4d3){return BPromise[_0x3441('0x20')](_0x63a4d3);}return _0x828537[_0x3441('0x21')]();};}function saveUpdates(_0x2e59a5,_0x112405){return function(_0x1e1eaa){if(_0x1e1eaa){return _0x1e1eaa[_0x3441('0x22')](_0x2e59a5)[_0x3441('0x23')](function(_0xe25148){return _0xe25148;});}return null;};}function removeEntity(_0x29071f,_0x118da2){return function(_0x26bb4c){if(_0x26bb4c){return _0x26bb4c['destroy']()[_0x3441('0x23')](function(){var _0x39afa6=_0x26bb4c[_0x3441('0x24')]({'plain':!![]});var _0x1e18a5=_0x3441('0x25');return db[_0x3441('0x26')][_0x3441('0x27')]({'where':{'type':_0x1e18a5,'resourceId':_0x39afa6['id']}})['then'](function(){return _0x26bb4c;});})[_0x3441('0x23')](function(){_0x29071f[_0x3441('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0ef4,_0x19d735){return function(_0x53e87a){if(!_0x53e87a){_0x5b0ef4[_0x3441('0x15')](0x194);}return _0x53e87a;};}function handleError(_0x3a9302,_0x188f23){_0x188f23=_0x188f23||0x1f4;return function(_0x3bafac){logger[_0x3441('0x28')](_0x3bafac[_0x3441('0x29')]);if(_0x3bafac['name']){delete _0x3bafac[_0x3441('0x2a')];}_0x3a9302[_0x3441('0x16')](_0x188f23)[_0x3441('0x2b')](_0x3bafac);};}exports[_0x3441('0x2c')]=function(_0x48bd67,_0x48699e){var _0x113f7f={},_0x288ed0={},_0x38d350={'count':0x0,'rows':[]};var _0x2c0ee3=_['map'](db[_0x3441('0x2d')]['rawAttributes'],function(_0x330cc3){return{'name':_0x330cc3[_0x3441('0x2e')],'type':_0x330cc3[_0x3441('0x2f')]['key']};});_0x288ed0[_0x3441('0x30')]=_[_0x3441('0x31')](_0x2c0ee3,_0x3441('0x2a'));_0x288ed0['query']=_[_0x3441('0x32')](_0x48bd67[_0x3441('0x33')]);_0x288ed0[_0x3441('0x34')]=_[_0x3441('0x35')](_0x288ed0[_0x3441('0x30')],_0x288ed0[_0x3441('0x33')]);_0x113f7f[_0x3441('0x36')]=_[_0x3441('0x35')](_0x288ed0[_0x3441('0x30')],qs['fields'](_0x48bd67[_0x3441('0x33')][_0x3441('0x37')]));_0x113f7f['attributes']=_0x113f7f['attributes'][_0x3441('0x38')]?_0x113f7f[_0x3441('0x36')]:_0x288ed0[_0x3441('0x30')];if(!_0x48bd67['query'][_0x3441('0x39')](_0x3441('0x3a'))){_0x113f7f[_0x3441('0x1a')]=qs[_0x3441('0x1a')](_0x48bd67[_0x3441('0x33')][_0x3441('0x1a')]);_0x113f7f[_0x3441('0x19')]=qs[_0x3441('0x19')](_0x48bd67[_0x3441('0x33')][_0x3441('0x19')]);}_0x113f7f[_0x3441('0x3b')]=qs['sort'](_0x48bd67[_0x3441('0x33')][_0x3441('0x3c')]);_0x113f7f['where']=qs['filters'](_[_0x3441('0x3d')](_0x48bd67['query'],_0x288ed0['filters']),_0x2c0ee3);if(_0x48bd67['query'][_0x3441('0x3e')]){_0x113f7f['where']=_[_0x3441('0x3f')](_0x113f7f[_0x3441('0x40')],{'$or':_[_0x3441('0x31')](_0x2c0ee3,function(_0x362afd){if(_0x362afd[_0x3441('0x2f')]!==_0x3441('0x41')){var _0x131fa9={};_0x131fa9[_0x362afd['name']]={'$like':'%'+_0x48bd67[_0x3441('0x33')][_0x3441('0x3e')]+'%'};return _0x131fa9;}})});}_0x113f7f=_[_0x3441('0x3f')]({},_0x113f7f,_0x48bd67[_0x3441('0x42')]);var _0xb5ec1d={'where':_0x113f7f[_0x3441('0x40')]};return db[_0x3441('0x2d')]['count'](_0xb5ec1d)[_0x3441('0x23')](function(_0x58c7b1){_0x38d350[_0x3441('0x1c')]=_0x58c7b1;if(_0x48bd67['query'][_0x3441('0x43')]){_0x113f7f[_0x3441('0x44')]=[{'all':!![]}];}return db['Variable'][_0x3441('0x45')](_0x113f7f);})['then'](function(_0x15874c){_0x38d350[_0x3441('0x46')]=_0x15874c;return _0x38d350;})['then'](respondWithFilteredResult(_0x48699e,_0x113f7f))['catch'](handleError(_0x48699e,null));};exports[_0x3441('0x47')]=function(_0x135b69,_0x384faf){var _0x190171={'raw':!![],'where':{'id':_0x135b69[_0x3441('0x48')]['id']}},_0xebf653={};_0xebf653[_0x3441('0x30')]=_[_0x3441('0x32')](db[_0x3441('0x2d')]['rawAttributes']);_0xebf653['query']=_[_0x3441('0x32')](_0x135b69[_0x3441('0x33')]);_0xebf653['filters']=_['intersection'](_0xebf653['model'],_0xebf653[_0x3441('0x33')]);_0x190171[_0x3441('0x36')]=_[_0x3441('0x35')](_0xebf653[_0x3441('0x30')],qs[_0x3441('0x37')](_0x135b69[_0x3441('0x33')][_0x3441('0x37')]));_0x190171[_0x3441('0x36')]=_0x190171[_0x3441('0x36')]['length']?_0x190171[_0x3441('0x36')]:_0xebf653[_0x3441('0x30')];if(_0x135b69[_0x3441('0x33')][_0x3441('0x43')]){_0x190171['include']=[{'all':!![]}];}_0x190171=_[_0x3441('0x3f')]({},_0x190171,_0x135b69['options']);return db[_0x3441('0x2d')][_0x3441('0x49')](_0x190171)[_0x3441('0x23')](handleEntityNotFound(_0x384faf,null))['then'](respondWithResult(_0x384faf,null))[_0x3441('0x4a')](handleError(_0x384faf,null));};exports['create']=function(_0x34bf38,_0x14eb1d){return db['Variable'][_0x3441('0x4b')](_0x34bf38[_0x3441('0x4c')],{})[_0x3441('0x23')](function(_0x2c3824){var _0x57a72b=_0x34bf38[_0x3441('0x4d')][_0x3441('0x24')]({'plain':!![]});if(!_0x57a72b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57a72b[_0x3441('0x4e')]===_0x3441('0x4d')){var _0x130ee0=_0x2c3824[_0x3441('0x24')]({'plain':!![]});var _0x43da26=_0x3441('0x25');return db['UserProfileSection'][_0x3441('0x49')]({'where':{'name':_0x43da26,'userProfileId':_0x57a72b[_0x3441('0x4f')]},'raw':!![]})[_0x3441('0x23')](function(_0x4e18e9){if(_0x4e18e9&&_0x4e18e9['autoAssociation']===0x0){return db[_0x3441('0x26')][_0x3441('0x4b')]({'name':_0x130ee0[_0x3441('0x2a')],'resourceId':_0x130ee0['id'],'type':_0x4e18e9['name'],'sectionId':_0x4e18e9['id']},{})[_0x3441('0x23')](function(){return _0x2c3824;});}else{return _0x2c3824;}})[_0x3441('0x4a')](function(_0x3f24fa){logger[_0x3441('0x28')](_0x3441('0x50'),_0x3f24fa);throw _0x3f24fa;});}return _0x2c3824;})[_0x3441('0x23')](respondWithResult(_0x14eb1d,0xc9))[_0x3441('0x4a')](handleError(_0x14eb1d,null));};exports[_0x3441('0x22')]=function(_0x1769e1,_0x263ac4){if(_0x1769e1[_0x3441('0x4c')]['id']){delete _0x1769e1[_0x3441('0x4c')]['id'];}return db[_0x3441('0x2d')][_0x3441('0x49')]({'where':{'id':_0x1769e1[_0x3441('0x48')]['id']}})['then'](handleEntityNotFound(_0x263ac4,null))[_0x3441('0x23')](saveUpdates(_0x1769e1[_0x3441('0x4c')],null))[_0x3441('0x23')](respondWithResult(_0x263ac4,null))[_0x3441('0x4a')](handleError(_0x263ac4,null));};exports[_0x3441('0x27')]=function(_0x4dd5fe,_0x17a103){return db['Variable']['find']({'where':{'id':_0x4dd5fe[_0x3441('0x48')]['id']}})[_0x3441('0x23')](handleEntityNotFound(_0x17a103,null))[_0x3441('0x23')](removeEntity(_0x17a103,null))[_0x3441('0x4a')](handleError(_0x17a103,null));}; \ No newline at end of file +var _0xc060=['undefined','count','limit','set','json','apply','save','then','Variables','UserProfileResource','stack','name','send','index','Variable','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','error','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0xbb9b40,_0x51b63a){var _0x4cd1b3=function(_0x4c0343){while(--_0x4c0343){_0xbb9b40['push'](_0xbb9b40['shift']());}};_0x4cd1b3(++_0x51b63a);}(_0xc060,0xee));var _0x0c06=function(_0x44b5c1,_0x103513){_0x44b5c1=_0x44b5c1-0x0;var _0x4b5734=_0xc060[_0x44b5c1];return _0x4b5734;};'use strict';var emlformat=require(_0x0c06('0x0'));var rimraf=require(_0x0c06('0x1'));var zipdir=require(_0x0c06('0x2'));var jsonpatch=require(_0x0c06('0x3'));var rp=require(_0x0c06('0x4'));var moment=require(_0x0c06('0x5'));var BPromise=require(_0x0c06('0x6'));var Mustache=require(_0x0c06('0x7'));var util=require(_0x0c06('0x8'));var path=require(_0x0c06('0x9'));var sox=require('sox');var csv=require(_0x0c06('0xa'));var ejs=require(_0x0c06('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c06('0xc'));var squel=require(_0x0c06('0xd'));var crypto=require(_0x0c06('0xe'));var jsforce=require(_0x0c06('0xf'));var deskjs=require(_0x0c06('0x10'));var toCsv=require(_0x0c06('0xa'));var querystring=require(_0x0c06('0x11'));var Papa=require(_0x0c06('0x12'));var Redis=require(_0x0c06('0x13'));var authService=require(_0x0c06('0x14'));var qs=require(_0x0c06('0x15'));var as=require(_0x0c06('0x16'));var hardwareService=require(_0x0c06('0x17'));var logger=require(_0x0c06('0x18'))(_0x0c06('0x19'));var utils=require('../../config/utils');var config=require(_0x0c06('0x1a'));var licenseUtil=require(_0x0c06('0x1b'));var db=require(_0x0c06('0x1c'))['db'];function respondWithStatusCode(_0x296835,_0x10f370){_0x10f370=_0x10f370||0xcc;return function(_0xc3dd71){if(_0xc3dd71){return _0x296835['sendStatus'](_0x10f370);}return _0x296835[_0x0c06('0x1d')](_0x10f370)[_0x0c06('0x1e')]();};}function respondWithResult(_0x4f35de,_0x38ec3f){_0x38ec3f=_0x38ec3f||0xc8;return function(_0x1e2281){if(_0x1e2281){return _0x4f35de[_0x0c06('0x1d')](_0x38ec3f)['json'](_0x1e2281);}};}function respondWithFilteredResult(_0x7b01f6,_0x4d55dc){return function(_0x2b86a5){if(_0x2b86a5){var _0x3451ff=typeof _0x4d55dc[_0x0c06('0x1f')]===_0x0c06('0x20')&&typeof _0x4d55dc['limit']===_0x0c06('0x20');var _0x333abd=_0x2b86a5[_0x0c06('0x21')];var _0x1a5870=_0x3451ff?0x0:_0x4d55dc[_0x0c06('0x1f')];var _0x33bbb1=_0x3451ff?_0x2b86a5['count']:_0x4d55dc[_0x0c06('0x1f')]+_0x4d55dc[_0x0c06('0x22')];var _0x3f6cfb;if(_0x33bbb1>=_0x333abd){_0x33bbb1=_0x333abd;_0x3f6cfb=0xc8;}else{_0x3f6cfb=0xce;}_0x7b01f6[_0x0c06('0x1d')](_0x3f6cfb);return _0x7b01f6[_0x0c06('0x23')]('Content-Range',_0x1a5870+'-'+_0x33bbb1+'/'+_0x333abd)[_0x0c06('0x24')](_0x2b86a5);}return null;};}function patchUpdates(_0x14dd89){return function(_0x34658d){try{jsonpatch[_0x0c06('0x25')](_0x34658d,_0x14dd89,!![]);}catch(_0x1e25bc){return BPromise['reject'](_0x1e25bc);}return _0x34658d[_0x0c06('0x26')]();};}function saveUpdates(_0xc90bca,_0x2900a1){return function(_0x46aeb1){if(_0x46aeb1){return _0x46aeb1['update'](_0xc90bca)['then'](function(_0x1f2831){return _0x1f2831;});}return null;};}function removeEntity(_0x4f2ee0,_0x336fe9){return function(_0x55cd3e){if(_0x55cd3e){return _0x55cd3e['destroy']()[_0x0c06('0x27')](function(){var _0x23ef57=_0x55cd3e['get']({'plain':!![]});var _0xb0c225=_0x0c06('0x28');return db[_0x0c06('0x29')]['destroy']({'where':{'type':_0xb0c225,'resourceId':_0x23ef57['id']}})[_0x0c06('0x27')](function(){return _0x55cd3e;});})[_0x0c06('0x27')](function(){_0x4f2ee0['status'](0xcc)[_0x0c06('0x1e')]();});}};}function handleEntityNotFound(_0x337343,_0x4dbff8){return function(_0x577667){if(!_0x577667){_0x337343['sendStatus'](0x194);}return _0x577667;};}function handleError(_0x3203f4,_0x73c041){_0x73c041=_0x73c041||0x1f4;return function(_0x1bdf09){logger['error'](_0x1bdf09[_0x0c06('0x2a')]);if(_0x1bdf09[_0x0c06('0x2b')]){delete _0x1bdf09[_0x0c06('0x2b')];}_0x3203f4[_0x0c06('0x1d')](_0x73c041)[_0x0c06('0x2c')](_0x1bdf09);};}exports[_0x0c06('0x2d')]=function(_0x479f47,_0x5ecd7c){var _0x2a4181={},_0x20a413={},_0x14ca0c={'count':0x0,'rows':[]};var _0x474b6d=_['map'](db[_0x0c06('0x2e')][_0x0c06('0x2f')],function(_0x3f7e21){return{'name':_0x3f7e21[_0x0c06('0x30')],'type':_0x3f7e21['type'][_0x0c06('0x31')]};});_0x20a413[_0x0c06('0x32')]=_[_0x0c06('0x33')](_0x474b6d,_0x0c06('0x2b'));_0x20a413[_0x0c06('0x34')]=_['keys'](_0x479f47['query']);_0x20a413[_0x0c06('0x35')]=_[_0x0c06('0x36')](_0x20a413[_0x0c06('0x32')],_0x20a413[_0x0c06('0x34')]);_0x2a4181[_0x0c06('0x37')]=_['intersection'](_0x20a413['model'],qs[_0x0c06('0x38')](_0x479f47['query']['fields']));_0x2a4181['attributes']=_0x2a4181[_0x0c06('0x37')][_0x0c06('0x39')]?_0x2a4181[_0x0c06('0x37')]:_0x20a413[_0x0c06('0x32')];if(!_0x479f47[_0x0c06('0x34')][_0x0c06('0x3a')](_0x0c06('0x3b'))){_0x2a4181['limit']=qs['limit'](_0x479f47[_0x0c06('0x34')][_0x0c06('0x22')]);_0x2a4181[_0x0c06('0x1f')]=qs[_0x0c06('0x1f')](_0x479f47[_0x0c06('0x34')][_0x0c06('0x1f')]);}_0x2a4181[_0x0c06('0x3c')]=qs['sort'](_0x479f47[_0x0c06('0x34')][_0x0c06('0x3d')]);_0x2a4181[_0x0c06('0x3e')]=qs[_0x0c06('0x35')](_[_0x0c06('0x3f')](_0x479f47['query'],_0x20a413[_0x0c06('0x35')]),_0x474b6d);if(_0x479f47[_0x0c06('0x34')][_0x0c06('0x40')]){_0x2a4181[_0x0c06('0x3e')]=_[_0x0c06('0x41')](_0x2a4181[_0x0c06('0x3e')],{'$or':_['map'](_0x474b6d,function(_0x40b756){if(_0x40b756[_0x0c06('0x42')]!==_0x0c06('0x43')){var _0x33dbc8={};_0x33dbc8[_0x40b756['name']]={'$like':'%'+_0x479f47[_0x0c06('0x34')][_0x0c06('0x40')]+'%'};return _0x33dbc8;}})});}_0x2a4181=_[_0x0c06('0x41')]({},_0x2a4181,_0x479f47[_0x0c06('0x44')]);var _0x43cc1c={'where':_0x2a4181[_0x0c06('0x3e')]};return db[_0x0c06('0x2e')][_0x0c06('0x21')](_0x43cc1c)[_0x0c06('0x27')](function(_0x28e23a){_0x14ca0c[_0x0c06('0x21')]=_0x28e23a;if(_0x479f47[_0x0c06('0x34')][_0x0c06('0x45')]){_0x2a4181[_0x0c06('0x46')]=[{'all':!![]}];}return db[_0x0c06('0x2e')][_0x0c06('0x47')](_0x2a4181);})['then'](function(_0x4fc1c6){_0x14ca0c[_0x0c06('0x48')]=_0x4fc1c6;return _0x14ca0c;})['then'](respondWithFilteredResult(_0x5ecd7c,_0x2a4181))['catch'](handleError(_0x5ecd7c,null));};exports[_0x0c06('0x49')]=function(_0x295c6d,_0x5191ef){var _0x39383d={'raw':!![],'where':{'id':_0x295c6d[_0x0c06('0x4a')]['id']}},_0x177393={};_0x177393['model']=_[_0x0c06('0x4b')](db[_0x0c06('0x2e')][_0x0c06('0x2f')]);_0x177393[_0x0c06('0x34')]=_['keys'](_0x295c6d[_0x0c06('0x34')]);_0x177393['filters']=_[_0x0c06('0x36')](_0x177393['model'],_0x177393[_0x0c06('0x34')]);_0x39383d['attributes']=_[_0x0c06('0x36')](_0x177393[_0x0c06('0x32')],qs['fields'](_0x295c6d[_0x0c06('0x34')][_0x0c06('0x38')]));_0x39383d[_0x0c06('0x37')]=_0x39383d['attributes'][_0x0c06('0x39')]?_0x39383d[_0x0c06('0x37')]:_0x177393[_0x0c06('0x32')];if(_0x295c6d[_0x0c06('0x34')][_0x0c06('0x45')]){_0x39383d[_0x0c06('0x46')]=[{'all':!![]}];}_0x39383d=_[_0x0c06('0x41')]({},_0x39383d,_0x295c6d[_0x0c06('0x44')]);return db[_0x0c06('0x2e')][_0x0c06('0x4c')](_0x39383d)[_0x0c06('0x27')](handleEntityNotFound(_0x5191ef,null))[_0x0c06('0x27')](respondWithResult(_0x5191ef,null))['catch'](handleError(_0x5191ef,null));};exports[_0x0c06('0x4d')]=function(_0x5833c7,_0x58e2e0){return db['Variable']['create'](_0x5833c7['body'],{})[_0x0c06('0x27')](function(_0x221415){var _0x3fd49c=_0x5833c7['user'][_0x0c06('0x4e')]({'plain':!![]});if(!_0x3fd49c)throw new Error(_0x0c06('0x4f'));if(_0x3fd49c[_0x0c06('0x50')]===_0x0c06('0x51')){var _0x3a75dc=_0x221415[_0x0c06('0x4e')]({'plain':!![]});var _0x5d985a=_0x0c06('0x28');return db[_0x0c06('0x52')][_0x0c06('0x4c')]({'where':{'name':_0x5d985a,'userProfileId':_0x3fd49c[_0x0c06('0x53')]},'raw':!![]})['then'](function(_0x5b2473){if(_0x5b2473&&_0x5b2473[_0x0c06('0x54')]===0x0){return db[_0x0c06('0x29')][_0x0c06('0x4d')]({'name':_0x3a75dc[_0x0c06('0x2b')],'resourceId':_0x3a75dc['id'],'type':_0x5b2473['name'],'sectionId':_0x5b2473['id']},{})[_0x0c06('0x27')](function(){return _0x221415;});}else{return _0x221415;}})[_0x0c06('0x55')](function(_0x4b6420){logger[_0x0c06('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b6420);throw _0x4b6420;});}return _0x221415;})[_0x0c06('0x27')](respondWithResult(_0x58e2e0,0xc9))[_0x0c06('0x55')](handleError(_0x58e2e0,null));};exports[_0x0c06('0x57')]=function(_0x28146b,_0x3a6473){if(_0x28146b['body']['id']){delete _0x28146b[_0x0c06('0x58')]['id'];}return db[_0x0c06('0x2e')][_0x0c06('0x4c')]({'where':{'id':_0x28146b[_0x0c06('0x4a')]['id']}})[_0x0c06('0x27')](handleEntityNotFound(_0x3a6473,null))[_0x0c06('0x27')](saveUpdates(_0x28146b[_0x0c06('0x58')],null))['then'](respondWithResult(_0x3a6473,null))[_0x0c06('0x55')](handleError(_0x3a6473,null));};exports[_0x0c06('0x59')]=function(_0x2ea541,_0x422ddb){return db['Variable'][_0x0c06('0x4c')]({'where':{'id':_0x2ea541['params']['id']}})[_0x0c06('0x27')](handleEntityNotFound(_0x422ddb,null))[_0x0c06('0x27')](removeEntity(_0x422ddb,null))[_0x0c06('0x55')](handleError(_0x422ddb,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e5275cf..9aa9edc 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 _0x58c0=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird'];(function(_0x47ec53,_0x5106fd){var _0x54eb20=function(_0x19078e){while(--_0x19078e){_0x47ec53['push'](_0x47ec53['shift']());}};_0x54eb20(++_0x5106fd);}(_0x58c0,0xbf));var _0x058c=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x58c0[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x058c('0x0'));var util=require(_0x058c('0x1'));var logger=require(_0x058c('0x2'))('api');var moment=require(_0x058c('0x3'));var BPromise=require(_0x058c('0x4'));var rp=require(_0x058c('0x5'));var fs=require('fs');var path=require(_0x058c('0x6'));var rimraf=require(_0x058c('0x7'));var config=require(_0x058c('0x8'));var attributes=require(_0x058c('0x9'));module[_0x058c('0xa')]=function(_0x456603,_0x36a260){return _0x456603[_0x058c('0xb')](_0x058c('0xc'),attributes,{'tableName':_0x058c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb6d=['rimraf','../../config/environment','./variable.attributes','define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x32d541,_0xb9712a){var _0x34101f=function(_0x4871dc){while(--_0x4871dc){_0x32d541['push'](_0x32d541['shift']());}};_0x34101f(++_0xb9712a);}(_0xdb6d,0xa1));var _0xddb6=function(_0x16cd9e,_0x518fee){_0x16cd9e=_0x16cd9e-0x0;var _0x431642=_0xdb6d[_0x16cd9e];return _0x431642;};'use strict';var _=require(_0xddb6('0x0'));var util=require(_0xddb6('0x1'));var logger=require(_0xddb6('0x2'))(_0xddb6('0x3'));var moment=require(_0xddb6('0x4'));var BPromise=require(_0xddb6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddb6('0x6'));var rimraf=require(_0xddb6('0x7'));var config=require(_0xddb6('0x8'));var attributes=require(_0xddb6('0x9'));module['exports']=function(_0x19008c,_0x35ba1d){return _0x19008c[_0xddb6('0xa')]('Variable',attributes,{'tableName':_0xddb6('0xb'),'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 bb5824f..a9bdcc8 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0xf94131,_0x58b63d){var _0xdf5c19=function(_0xa00801){while(--_0xa00801){_0xf94131['push'](_0xf94131['shift']());}};_0xdf5c19(++_0x58b63d);}(_0x55ca,0x126));var _0xa55c=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x55ca[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x218a2a,_0x590565){_0x218a2a=_0x218a2a-0x0;var _0x58a012=_0x1cb9[_0x218a2a];return _0x58a012;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 813eefa..db26591 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 _0xc5c8=['reset','/pull','pull','/restart','restart','exports','express','Router','../../components/auth/service','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated'];(function(_0x49d3dc,_0x16ba22){var _0x3e11a6=function(_0x39a120){while(--_0x39a120){_0x49d3dc['push'](_0x49d3dc['shift']());}};_0x3e11a6(++_0x16ba22);}(_0xc5c8,0x156));var _0x8c5c=function(_0x4d59f1,_0x13f4e3){_0x4d59f1=_0x4d59f1-0x0;var _0x51516c=_0xc5c8[_0x4d59f1];return _0x51516c;};'use strict';var express=require(_0x8c5c('0x0'));var router=express[_0x8c5c('0x1')]();var auth=require(_0x8c5c('0x2'));var controller=require('./version.controller');router[_0x8c5c('0x3')]('/',controller[_0x8c5c('0x4')]);router['get'](_0x8c5c('0x5'),auth['isAuthenticated'](),auth[_0x8c5c('0x6')](),controller[_0x8c5c('0x7')]);router[_0x8c5c('0x3')](_0x8c5c('0x8'),auth[_0x8c5c('0x9')](),auth[_0x8c5c('0x6')](),controller[_0x8c5c('0xa')]);router[_0x8c5c('0x3')](_0x8c5c('0xb'),auth['isAuthenticated'](),auth[_0x8c5c('0x6')](),controller[_0x8c5c('0xc')]);router[_0x8c5c('0x3')](_0x8c5c('0xd'),auth['isAuthenticated'](),controller[_0x8c5c('0xe')]);router[_0x8c5c('0x3')]('/migrations',controller['migrations']);module[_0x8c5c('0xf')]=router; \ No newline at end of file +var _0x6a1e=['isAuthenticated','/pull','/restart','restart','/migrations','migrations','express','./version.controller','get','/fetch','canUpdate','fetch'];(function(_0x70d06a,_0x49ae66){var _0x464b4b=function(_0x2ad93e){while(--_0x2ad93e){_0x70d06a['push'](_0x70d06a['shift']());}};_0x464b4b(++_0x49ae66);}(_0x6a1e,0x66));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xe6a1('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe6a1('0x1'));router[_0xe6a1('0x2')]('/',controller['index']);router[_0xe6a1('0x2')](_0xe6a1('0x3'),auth['isAuthenticated'](),auth[_0xe6a1('0x4')](),controller[_0xe6a1('0x5')]);router[_0xe6a1('0x2')]('/reset',auth[_0xe6a1('0x6')](),auth['canUpdate'](),controller['reset']);router['get'](_0xe6a1('0x7'),auth[_0xe6a1('0x6')](),auth[_0xe6a1('0x4')](),controller['pull']);router['get'](_0xe6a1('0x8'),auth[_0xe6a1('0x6')](),controller[_0xe6a1('0x9')]);router[_0xe6a1('0x2')](_0xe6a1('0xa'),controller[_0xe6a1('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 820fe5a..bf167b0 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 _0xd779=['2.0.0','status','origin','master','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length','.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.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','exec','../../config/pm2','../../config/logger','update','root','index','exports','query','latest','fetch','tags'];(function(_0x1c9dd7,_0x275dbb){var _0x4a241a=function(_0x4da5f7){while(--_0x4da5f7){_0x1c9dd7['push'](_0x1c9dd7['shift']());}};_0x4a241a(++_0x275dbb);}(_0xd779,0x92));var _0x9d77=function(_0x43ff33,_0x5322ea){_0x43ff33=_0x43ff33-0x0;var _0x181d7f=_0xd779[_0x43ff33];return _0x181d7f;};'use strict';var Umzug=require(_0x9d77('0x0'));var path=require(_0x9d77('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x9d77('0x2'))(module,_0x9d77('0x3'));var compareVersions=require(_0x9d77('0x4'));var exec=require('child_process')[_0x9d77('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x9d77('0x6'));var logger=require(_0x9d77('0x7'))(_0x9d77('0x8'));var git=require('simple-git')(config[_0x9d77('0x9')]);exports[_0x9d77('0xa')]=function(_0x1ec7e6,_0x526bc3){var _0xa76d79={'current':module[_0x9d77('0xb')][_0x9d77('0x3')],'phonebar':0x2};if(_0x1ec7e6[_0x9d77('0xc')]&&_0x1ec7e6[_0x9d77('0xc')][_0x9d77('0xd')]){return git[_0x9d77('0xe')]()[_0x9d77('0xf')](function(_0x76260b,_0x24e995){_0xa76d79[_0x9d77('0xd')]=(_0x76260b?module[_0x9d77('0xb')][_0x9d77('0x3')]:_0x24e995[_0x9d77('0xd')])||_0x9d77('0x10');return _0x526bc3[_0x9d77('0x11')](0xc8)['json'](_0xa76d79);});}else{return _0x526bc3[_0x9d77('0x11')](0xc8)['json'](_0xa76d79);}};exports[_0x9d77('0xe')]=function(_0x3043,_0xdd367d){return git[_0x9d77('0xe')]([_0x9d77('0x12'),_0x9d77('0x13')],function(_0x4d9772){if(_0x4d9772){logger[_0x9d77('0x14')](_0x4d9772);return _0xdd367d['status'](0x1f4)[_0x9d77('0x15')](_0x4d9772);}logger[_0x9d77('0x16')](_0x9d77('0x17'));return _0xdd367d[_0x9d77('0x11')](0xc8)['json']({'output':_0x9d77('0x18')});});};exports[_0x9d77('0x19')]=function(_0xd8971c,_0x58a9f6){return git[_0x9d77('0x19')](['--hard',_0x9d77('0x1a')],function(_0x4a8487){if(_0x4a8487){logger[_0x9d77('0x14')](_0x4a8487);return _0x58a9f6['status'](0x1f4)['json'](_0x4a8487);}logger['info'](_0x9d77('0x1b'));return _0x58a9f6['status'](0xc8)[_0x9d77('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0x9d77('0x1c')]=function(_0x1aa56d,_0x21add8){exec(_0x9d77('0x1d'),function(_0x5a1c70,_0x3d9a6a,_0x522e5c){logger[_0x9d77('0x16')](_0x3d9a6a);logger['info'](_0x522e5c);if(_0x5a1c70){logger['error'](_0x5a1c70);return _0x21add8[_0x9d77('0x11')](0x1f4)[_0x9d77('0x15')](_0x5a1c70);}return _0x21add8[_0x9d77('0x11')](0xc8)[_0x9d77('0x15')]({'output':_0x3d9a6a});});};exports[_0x9d77('0x1e')]=function(_0x5c2f84,_0x591bdc){return pm2['restart'](_0x9d77('0x1f'))[_0x9d77('0x20')](function(_0xd8acf6){logger[_0x9d77('0x16')](_0x9d77('0x21'),_0xd8acf6);return _0x591bdc['status'](0xc8)['json']({'output':_0x9d77('0x22')});})['catch'](function(_0x47aa20){logger[_0x9d77('0x14')](_0x47aa20);return _0x591bdc[_0x9d77('0x11')](0x1f4)[_0x9d77('0x15')](_0x47aa20);});};exports[_0x9d77('0x23')]=function(_0x2c963a,_0x5cf9c9){var _0x2cac5c=fs[_0x9d77('0x24')](path[_0x9d77('0x25')](config[_0x9d77('0x9')],_0x9d77('0x26'),'migrations'));var _0x5f0a08=[];for(var _0x361245=0x0;_0x361245<_0x2cac5c[_0x9d77('0x27')];_0x361245++){var _0x54d35f=_0x2cac5c[_0x361245]['replace'](_0x9d77('0x28'),'');if(compareVersions(module[_0x9d77('0xb')]['version'],_0x54d35f)===-0x1){_0x5f0a08[_0x9d77('0x29')](_0x54d35f);}}if(_0x5f0a08[_0x9d77('0x27')]){var _0x51dc0e=_0x5f0a08[_0x9d77('0x2a')](compareVersions);var _0x73b16e=new Umzug({'storage':_0x9d77('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x9d77('0x2c'),'columnName':_0x9d77('0x3')},'migrations':{'params':[db[_0x9d77('0x2b')][_0x9d77('0x2d')](),db[_0x9d77('0x2b')][_0x9d77('0x2e')],function(){throw new Error(_0x9d77('0x2f'));}],'path':path[_0x9d77('0x25')](config[_0x9d77('0x9')],_0x9d77('0x26'),_0x9d77('0x23')),'pattern':/\.js$/}});_0x73b16e['up']({'migrations':_[_0x9d77('0x30')](_0x51dc0e,function(_0x48cde2){return _0x48cde2+_0x9d77('0x28');})})[_0x9d77('0x20')](function(){return _0x5cf9c9[_0x9d77('0x11')](0xc8)[_0x9d77('0x15')]({'output':_0x9d77('0x31')+module['exports'][_0x9d77('0x3')]+_0x9d77('0x32')+_[_0x9d77('0x33')](_0x51dc0e),'migrations':_[_0x9d77('0x25')](_0x51dc0e)});})['catch'](function(_0x495973){if(_0x495973 instanceof db[_0x9d77('0x2b')][_0x9d77('0x34')]){return _0x5cf9c9[_0x9d77('0x11')](0xc8)['json']({'output':_0x9d77('0x35')});}else{return _0x5cf9c9[_0x9d77('0x11')](0x1f4)[_0x9d77('0x15')](_0x495973);}});}else{return _0x5cf9c9[_0x9d77('0x11')](0xc8)[_0x9d77('0x15')]({'output':_0x9d77('0x35')});}}; \ No newline at end of file +var _0x6cda=['git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','motion2','then','catch','migrations','readdirSync','root','server','length','replace','.js','push','sort','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','exports','query','latest','fetch','status','json','origin','info','git\x20fetch'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x6cda,0xbb));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0xa6cd('0x0'));var path=require(_0xa6cd('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xa6cd('0x2'))(module,_0xa6cd('0x3'));var compareVersions=require(_0xa6cd('0x4'));var exec=require(_0xa6cd('0x5'))[_0xa6cd('0x6')];var db=require(_0xa6cd('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xa6cd('0x8'));var logger=require(_0xa6cd('0x9'))(_0xa6cd('0xa'));var git=require(_0xa6cd('0xb'))(config['root']);exports['index']=function(_0x2849c8,_0x5cadf9){var _0x6013e1={'current':module[_0xa6cd('0xc')][_0xa6cd('0x3')],'phonebar':0x2};if(_0x2849c8[_0xa6cd('0xd')]&&_0x2849c8[_0xa6cd('0xd')][_0xa6cd('0xe')]){return git[_0xa6cd('0xf')]()['tags'](function(_0xa4bdb9,_0x179199){_0x6013e1['latest']=(_0xa4bdb9?module[_0xa6cd('0xc')][_0xa6cd('0x3')]:_0x179199['latest'])||'2.0.0';return _0x5cadf9[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')](_0x6013e1);});}else{return _0x5cadf9[_0xa6cd('0x10')](0xc8)['json'](_0x6013e1);}};exports['fetch']=function(_0x3eea67,_0x1750eb){return git[_0xa6cd('0xf')]([_0xa6cd('0x12'),'master'],function(_0x34a211){if(_0x34a211){logger['error'](_0x34a211);return _0x1750eb[_0xa6cd('0x10')](0x1f4)[_0xa6cd('0x11')](_0x34a211);}logger[_0xa6cd('0x13')](_0xa6cd('0x14'));return _0x1750eb[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x15')});});};exports['reset']=function(_0x2fffae,_0xfe9d5e){return git[_0xa6cd('0x16')](['--hard','FETCH_HEAD'],function(_0x4f4d09){if(_0x4f4d09){logger['error'](_0x4f4d09);return _0xfe9d5e['status'](0x1f4)[_0xa6cd('0x11')](_0x4f4d09);}logger[_0xa6cd('0x13')](_0xa6cd('0x17'));return _0xfe9d5e[_0xa6cd('0x10')](0xc8)['json']({'output':_0xa6cd('0x18')});});};exports[_0xa6cd('0x19')]=function(_0x28a205,_0x5d9356){exec(_0xa6cd('0x1a'),function(_0x52aec2,_0x5993af,_0x4977b8){logger[_0xa6cd('0x13')](_0x5993af);logger[_0xa6cd('0x13')](_0x4977b8);if(_0x52aec2){logger[_0xa6cd('0x1b')](_0x52aec2);return _0x5d9356[_0xa6cd('0x10')](0x1f4)[_0xa6cd('0x11')](_0x52aec2);}return _0x5d9356[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0x5993af});});};exports['restart']=function(_0x3f3a48,_0x358eb7){return pm2['restart'](_0xa6cd('0x1c'))[_0xa6cd('0x1d')](function(_0x56ae88){logger['info']('pm2\x20restart\x20motion\x20%s',_0x56ae88);return _0x358eb7[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xa6cd('0x1e')](function(_0x216c68){logger[_0xa6cd('0x1b')](_0x216c68);return _0x358eb7[_0xa6cd('0x10')](0x1f4)[_0xa6cd('0x11')](_0x216c68);});};exports[_0xa6cd('0x1f')]=function(_0x303249,_0xe90f8f){var _0x258dbf=fs[_0xa6cd('0x20')](path['join'](config[_0xa6cd('0x21')],_0xa6cd('0x22'),_0xa6cd('0x1f')));var _0x1d81b6=[];for(var _0x5dabb0=0x0;_0x5dabb0<_0x258dbf[_0xa6cd('0x23')];_0x5dabb0++){var _0x53f5d6=_0x258dbf[_0x5dabb0][_0xa6cd('0x24')](_0xa6cd('0x25'),'');if(compareVersions(module[_0xa6cd('0xc')][_0xa6cd('0x3')],_0x53f5d6)===-0x1){_0x1d81b6[_0xa6cd('0x26')](_0x53f5d6);}}if(_0x1d81b6[_0xa6cd('0x23')]){var _0x17963b=_0x1d81b6[_0xa6cd('0x27')](compareVersions);var _0x1a4a30=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xa6cd('0x28'),'columnName':_0xa6cd('0x3')},'migrations':{'params':[db['sequelize'][_0xa6cd('0x29')](),db[_0xa6cd('0x2a')][_0xa6cd('0x2b')],function(){throw new Error(_0xa6cd('0x2c'));}],'path':path[_0xa6cd('0x2d')](config[_0xa6cd('0x21')],'server',_0xa6cd('0x1f')),'pattern':/\.js$/}});_0x1a4a30['up']({'migrations':_[_0xa6cd('0x2e')](_0x17963b,function(_0x2b2586){return _0x2b2586+_0xa6cd('0x25');})})[_0xa6cd('0x1d')](function(){return _0xe90f8f[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x2f')+module[_0xa6cd('0xc')][_0xa6cd('0x3')]+_0xa6cd('0x30')+_[_0xa6cd('0x31')](_0x17963b),'migrations':_[_0xa6cd('0x2d')](_0x17963b)});})[_0xa6cd('0x1e')](function(_0x371177){if(_0x371177 instanceof db[_0xa6cd('0x2a')][_0xa6cd('0x32')]){return _0xe90f8f[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x33')});}else{return _0xe90f8f[_0xa6cd('0x10')](0x1f4)['json'](_0x371177);}});}else{return _0xe90f8f[_0xa6cd('0x10')](0xc8)[_0xa6cd('0x11')]({'output':_0xa6cd('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 062f9c7..154cfb1 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 _0xfdbc=['../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ba8a5,_0x28cf9d){var _0x2ad234=function(_0x3194ea){while(--_0x3194ea){_0x4ba8a5['push'](_0x4ba8a5['shift']());}};_0x2ad234(++_0x28cf9d);}(_0xfdbc,0xb6));var _0xcfdb=function(_0x2a7f5b,_0xf94549){_0x2a7f5b=_0x2a7f5b-0x0;var _0x5e90e4=_0xfdbc[_0x2a7f5b];return _0x5e90e4;};'use strict';var multer=require(_0xcfdb('0x0'));var util=require('util');var path=require(_0xcfdb('0x1'));var timeout=require(_0xcfdb('0x2'));var express=require(_0xcfdb('0x3'));var router=express['Router']();var fs_extra=require(_0xcfdb('0x4'));var auth=require(_0xcfdb('0x5'));var interaction=require(_0xcfdb('0x6'));var config=require(_0xcfdb('0x7'));var controller=require(_0xcfdb('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcfdb('0x9')](_0xcfdb('0xa'),auth[_0xcfdb('0xb')](),controller[_0xcfdb('0xc')]);router[_0xcfdb('0x9')]('/:id',auth[_0xcfdb('0xb')](),controller[_0xcfdb('0xd')]);router[_0xcfdb('0xe')]('/',auth['isAuthenticated'](),controller[_0xcfdb('0xf')]);router[_0xcfdb('0x10')](_0xcfdb('0x11'),auth['isAuthenticated'](),controller[_0xcfdb('0x12')]);router[_0xcfdb('0x13')](_0xcfdb('0x11'),auth[_0xcfdb('0xb')](),controller[_0xcfdb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0bd2=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','create','put'];(function(_0x1f43ab,_0x389191){var _0x2f8025=function(_0x45f07c){while(--_0x45f07c){_0x1f43ab['push'](_0x1f43ab['shift']());}};_0x2f8025(++_0x389191);}(_0x0bd2,0x16c));var _0x20bd=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x0bd2[_0x1eda20];return _0x31b953;};'use strict';var multer=require('multer');var util=require(_0x20bd('0x0'));var path=require('path');var timeout=require(_0x20bd('0x1'));var express=require(_0x20bd('0x2'));var router=express[_0x20bd('0x3')]();var fs_extra=require(_0x20bd('0x4'));var auth=require(_0x20bd('0x5'));var interaction=require(_0x20bd('0x6'));var config=require(_0x20bd('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x20bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x20bd('0x9')]);router[_0x20bd('0x8')](_0x20bd('0xa'),auth[_0x20bd('0xb')](),controller['describe']);router[_0x20bd('0x8')](_0x20bd('0xc'),auth['isAuthenticated'](),controller[_0x20bd('0xd')]);router['post']('/',auth[_0x20bd('0xb')](),controller[_0x20bd('0xe')]);router[_0x20bd('0xf')]('/:id',auth[_0x20bd('0xb')](),controller[_0x20bd('0x10')]);router[_0x20bd('0x11')](_0x20bd('0xc'),auth[_0x20bd('0xb')](),controller[_0x20bd('0x12')]);module[_0x20bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 602beea..7a4882d 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 _0xe493=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x258028,_0x28e1a3){var _0x3dd217=function(_0x2de6de){while(--_0x2de6de){_0x258028['push'](_0x258028['shift']());}};_0x3dd217(++_0x28e1a3);}(_0xe493,0x7e));var _0x3e49=function(_0x14ab9a,_0x410ae6){_0x14ab9a=_0x14ab9a-0x0;var _0x2be6aa=_0xe493[_0x14ab9a];return _0x2be6aa;};'use strict';var Sequelize=require(_0x3e49('0x0'));module[_0x3e49('0x1')]={'type':{'type':Sequelize[_0x3e49('0x2')]},'uniqueid':{'type':Sequelize[_0x3e49('0x2')]},'calleridnum':{'type':Sequelize[_0x3e49('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3e49('0x2')]},'interface':{'type':Sequelize[_0x3e49('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3e49('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x3e49('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3e49('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3e49('0x3')]},'holdtime':{'type':Sequelize[_0x3e49('0x4')]},'agentcomplete':{'type':Sequelize[_0x3e49('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3e49('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3e49('0x4')]},'reason':{'type':Sequelize[_0x3e49('0x2')]},'lastevent':{'type':Sequelize[_0x3e49('0x2')]},'channel':{'type':Sequelize[_0x3e49('0x2')]},'channelstate':{'type':Sequelize[_0x3e49('0x4')]},'channelstatedesc':{'type':Sequelize[_0x3e49('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3e49('0x2')]},'connectedlinename':{'type':Sequelize[_0x3e49('0x2')]},'language':{'type':Sequelize[_0x3e49('0x2')]},'accountcode':{'type':Sequelize[_0x3e49('0x2')]},'context':{'type':Sequelize[_0x3e49('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3e49('0x2')]},'destchannel':{'type':Sequelize[_0x3e49('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x3e49('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3e49('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e49('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3e49('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x3e49('0x2')]},'destcontext':{'type':Sequelize[_0x3e49('0x2')]},'destexten':{'type':Sequelize[_0x3e49('0x2')]},'destpriority':{'type':Sequelize[_0x3e49('0x2')]},'destuniqueid':{'type':Sequelize[_0x3e49('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3e49('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3e49('0x2')]},'transfer':{'type':Sequelize[_0x3e49('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3e49('0x2')],'comment':_0x3e49('0x6')},'transferexten':{'type':Sequelize[_0x3e49('0x2')]},'transferuniqueid':{'type':Sequelize[_0x3e49('0x2')]},'agententerreason':{'type':Sequelize[_0x3e49('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bde=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x485c00,_0x47f062){var _0x209ebb=function(_0x1fa838){while(--_0x1fa838){_0x485c00['push'](_0x485c00['shift']());}};_0x209ebb(++_0x47f062);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x394eaa,_0x3157c3){_0x394eaa=_0x394eaa-0x0;var _0xdd6a6c=_0x4bde[_0x394eaa];return _0xdd6a6c;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'type':{'type':Sequelize[_0xe4bd('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'calleridname':{'type':Sequelize[_0xe4bd('0x2')]},'queue':{'type':Sequelize[_0xe4bd('0x2')]},'interface':{'type':Sequelize[_0xe4bd('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe4bd('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe4bd('0x3')]},'holdtime':{'type':Sequelize[_0xe4bd('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe4bd('0x4')]},'agentacw':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe4bd('0x4')]},'reason':{'type':Sequelize[_0xe4bd('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'connectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe4bd('0x2')]},'context':{'type':Sequelize[_0xe4bd('0x2')]},'exten':{'type':Sequelize[_0xe4bd('0x2')]},'priority':{'type':Sequelize[_0xe4bd('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe4bd('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe4bd('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe4bd('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe4bd('0x2')]},'destlanguage':{'type':Sequelize[_0xe4bd('0x2')]},'destaccountcode':{'type':Sequelize[_0xe4bd('0x2')]},'destcontext':{'type':Sequelize[_0xe4bd('0x2')]},'destexten':{'type':Sequelize[_0xe4bd('0x2')]},'destpriority':{'type':Sequelize[_0xe4bd('0x2')]},'destuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xe4bd('0x2')]},'transfer':{'type':Sequelize[_0xe4bd('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe4bd('0x2')],'comment':_0xe4bd('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xe4bd('0x2')]},'agententerreason':{'type':Sequelize[_0xe4bd('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 4675f9f..1b6bda0 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 0eeeeb0..1d44f57 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 _0xe574=['../../config/environment','./voiceAgentReport.attributes','exports','report_agent','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5be9fc,_0x3df9af){var _0x329b92=function(_0x57e785){while(--_0x57e785){_0x5be9fc['push'](_0x5be9fc['shift']());}};_0x329b92(++_0x3df9af);}(_0xe574,0x100));var _0x4e57=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe574[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x4e57('0x0'));var util=require('util');var logger=require(_0x4e57('0x1'))(_0x4e57('0x2'));var moment=require(_0x4e57('0x3'));var BPromise=require(_0x4e57('0x4'));var rp=require(_0x4e57('0x5'));var fs=require('fs');var path=require(_0x4e57('0x6'));var rimraf=require(_0x4e57('0x7'));var config=require(_0x4e57('0x8'));var attributes=require(_0x4e57('0x9'));module[_0x4e57('0xa')]=function(_0x436174,_0x2825a9){return _0x436174['define']('VoiceAgentReport',attributes,{'tableName':_0x4e57('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f5a=['../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5c499a,_0x11649b){var _0x36a572=function(_0xdeee9c){while(--_0xdeee9c){_0x5c499a['push'](_0x5c499a['shift']());}};_0x36a572(++_0x11649b);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x36387e,_0x2523d2){_0x36387e=_0x36387e-0x0;var _0x97c3e=_0x9f5a[_0x36387e];return _0x97c3e;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))(_0xa9f5('0x3'));var moment=require('moment');var BPromise=require(_0xa9f5('0x4'));var rp=require(_0xa9f5('0x5'));var fs=require('fs');var path=require(_0xa9f5('0x6'));var rimraf=require('rimraf');var config=require(_0xa9f5('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0xa9f5('0x8')]=function(_0x219e89,_0x49e337){return _0x219e89[_0xa9f5('0x9')](_0xa9f5('0xa'),attributes,{'tableName':_0xa9f5('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa9f5('0xc'),_0xa9f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 32a4040..38d3b4f 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 _0xed02=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3b55ce,_0x1e7727){var _0xe4d917=function(_0x5f3c4d){while(--_0x5f3c4d){_0x3b55ce['push'](_0x3b55ce['shift']());}};_0xe4d917(++_0x1e7727);}(_0xed02,0x1c8));var _0x2ed0=function(_0x221840,_0x2a5fb7){_0x221840=_0x221840-0x0;var _0x4706e3=_0xed02[_0x221840];return _0x4706e3;};'use strict';var _=require(_0x2ed0('0x0'));var util=require(_0x2ed0('0x1'));var moment=require(_0x2ed0('0x2'));var BPromise=require(_0x2ed0('0x3'));var rs=require(_0x2ed0('0x4'));var fs=require('fs');var Redis=require(_0x2ed0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ed0('0x6'));var logger=require(_0x2ed0('0x7'))(_0x2ed0('0x8'));var config=require(_0x2ed0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ed0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c580c,_0x11c265,_0xa9425d){return new BPromise(function(_0x423e5f,_0x489892){return client[_0x2ed0('0xb')](_0x4c580c,_0xa9425d)[_0x2ed0('0xc')](function(_0xda8a42){logger[_0x2ed0('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x11c265,_0x2ed0('0xe'));logger[_0x2ed0('0xf')](_0x2ed0('0x10'),_0x11c265,'request\x20sent',JSON[_0x2ed0('0x11')](_0xda8a42));if(_0xda8a42['error']){if(_0xda8a42[_0x2ed0('0x12')][_0x2ed0('0x13')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x11c265,_0xda8a42[_0x2ed0('0x12')]['message']);return _0x489892(_0xda8a42['error'][_0x2ed0('0x14')]);}logger[_0x2ed0('0x12')](_0x2ed0('0x15'),_0x11c265,_0xda8a42['error'][_0x2ed0('0x14')]);return _0x423e5f(_0xda8a42[_0x2ed0('0x12')][_0x2ed0('0x14')]);}else{logger[_0x2ed0('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x11c265,_0x2ed0('0xe'));_0x423e5f(_0xda8a42['result']['message']);}})[_0x2ed0('0x16')](function(_0x2f241d){logger[_0x2ed0('0x12')](_0x2ed0('0x15'),_0x11c265,_0x2f241d);_0x489892(_0x2f241d);});});}exports[_0x2ed0('0x17')]=function(_0xa83f06){var _0x3d2f15=this;return new Promise(function(_0x3bae0e,_0x456470){return db[_0x2ed0('0x18')][_0x2ed0('0x19')](_0xa83f06[_0x2ed0('0x1a')],{'raw':_0xa83f06[_0x2ed0('0x1b')]?_0xa83f06[_0x2ed0('0x1b')][_0x2ed0('0x1c')]===undefined?!![]:![]:!![]})[_0x2ed0('0xc')](function(_0x54a638){logger[_0x2ed0('0xd')](_0x2ed0('0x17'),_0xa83f06);logger[_0x2ed0('0xf')]('CreateVoiceAgentReport',_0xa83f06,JSON[_0x2ed0('0x11')](_0x54a638));_0x3bae0e(_0x54a638);})[_0x2ed0('0x16')](function(_0x3986aa){logger[_0x2ed0('0x12')]('CreateVoiceAgentReport',_0x3986aa[_0x2ed0('0x14')],_0xa83f06);_0x456470(_0x3d2f15[_0x2ed0('0x12')](0x1f4,_0x3986aa[_0x2ed0('0x14')]));});});};exports[_0x2ed0('0x1d')]=function(_0x24f67c){var _0x216995=this;return new Promise(function(_0x32e500,_0x544b01){return db[_0x2ed0('0x18')][_0x2ed0('0x1e')](_0x24f67c['body'],{'raw':_0x24f67c[_0x2ed0('0x1b')]?_0x24f67c['options'][_0x2ed0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24f67c[_0x2ed0('0x1b')]?_0x24f67c[_0x2ed0('0x1b')][_0x2ed0('0x1f')]||null:null,'attributes':_0x24f67c[_0x2ed0('0x1b')]?_0x24f67c[_0x2ed0('0x1b')]['attributes']||null:null,'limit':_0x24f67c['options']?_0x24f67c['options'][_0x2ed0('0x20')]||null:null})[_0x2ed0('0xc')](function(_0x1f8edd){logger[_0x2ed0('0xd')](_0x2ed0('0x1d'),_0x24f67c);logger[_0x2ed0('0xf')](_0x2ed0('0x1d'),_0x24f67c,JSON['stringify'](_0x1f8edd));_0x32e500(_0x1f8edd);})[_0x2ed0('0x16')](function(_0x1be6f6){logger[_0x2ed0('0x12')](_0x2ed0('0x1d'),_0x1be6f6[_0x2ed0('0x14')],_0x24f67c);_0x544b01(_0x216995[_0x2ed0('0x12')](0x1f4,_0x1be6f6[_0x2ed0('0x14')]));});});}; \ No newline at end of file +var _0xcef9=['stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','UpdateVoiceAgentReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x9f9ed5,_0x56f438){var _0xbc71e3=function(_0x1de828){while(--_0x1de828){_0x9f9ed5['push'](_0x9f9ed5['shift']());}};_0xbc71e3(++_0x56f438);}(_0xcef9,0xb4));var _0x9cef=function(_0xcd3127,_0x304d36){_0xcd3127=_0xcd3127-0x0;var _0x3497cf=_0xcef9[_0xcd3127];return _0x3497cf;};'use strict';var _=require(_0x9cef('0x0'));var util=require(_0x9cef('0x1'));var moment=require('moment');var BPromise=require(_0x9cef('0x2'));var rs=require(_0x9cef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cef('0x4'))['db'];var utils=require(_0x9cef('0x5'));var logger=require(_0x9cef('0x6'))('rpc');var config=require(_0x9cef('0x7'));var jayson=require(_0x9cef('0x8'));var client=jayson[_0x9cef('0x9')][_0x9cef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3687cc,_0x584300,_0x4d5c87){return new BPromise(function(_0x1444fb,_0x5c5ad4){return client[_0x9cef('0xb')](_0x3687cc,_0x4d5c87)[_0x9cef('0xc')](function(_0x270813){logger[_0x9cef('0xd')](_0x9cef('0xe'),_0x584300,_0x9cef('0xf'));logger[_0x9cef('0x10')](_0x9cef('0x11'),_0x584300,_0x9cef('0xf'),JSON[_0x9cef('0x12')](_0x270813));if(_0x270813[_0x9cef('0x13')]){if(_0x270813[_0x9cef('0x13')]['code']===0x1f4){logger[_0x9cef('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x584300,_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);return _0x5c5ad4(_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);}logger['error'](_0x9cef('0xe'),_0x584300,_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);return _0x1444fb(_0x270813[_0x9cef('0x13')][_0x9cef('0x14')]);}else{logger[_0x9cef('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x584300,'request\x20sent');_0x1444fb(_0x270813['result'][_0x9cef('0x14')]);}})[_0x9cef('0x15')](function(_0x352663){logger['error'](_0x9cef('0xe'),_0x584300,_0x352663);_0x5c5ad4(_0x352663);});});}exports[_0x9cef('0x16')]=function(_0x480ecd){var _0x1d9805=this;return new Promise(function(_0x433a84,_0xd5355e){return db[_0x9cef('0x17')][_0x9cef('0x18')](_0x480ecd['body'],{'raw':_0x480ecd[_0x9cef('0x19')]?_0x480ecd[_0x9cef('0x19')][_0x9cef('0x1a')]===undefined?!![]:![]:!![]})[_0x9cef('0xc')](function(_0x4a633f){logger[_0x9cef('0xd')](_0x9cef('0x16'),_0x480ecd);logger[_0x9cef('0x10')](_0x9cef('0x16'),_0x480ecd,JSON[_0x9cef('0x12')](_0x4a633f));_0x433a84(_0x4a633f);})[_0x9cef('0x15')](function(_0x1a8bd8){logger[_0x9cef('0x13')](_0x9cef('0x16'),_0x1a8bd8['message'],_0x480ecd);_0xd5355e(_0x1d9805[_0x9cef('0x13')](0x1f4,_0x1a8bd8[_0x9cef('0x14')]));});});};exports[_0x9cef('0x1b')]=function(_0x5af5e6){var _0x404894=this;return new Promise(function(_0x48e244,_0x524470){return db[_0x9cef('0x17')][_0x9cef('0x1c')](_0x5af5e6[_0x9cef('0x1d')],{'raw':_0x5af5e6[_0x9cef('0x19')]?_0x5af5e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af5e6[_0x9cef('0x19')]?_0x5af5e6[_0x9cef('0x19')][_0x9cef('0x1e')]||null:null,'attributes':_0x5af5e6['options']?_0x5af5e6[_0x9cef('0x19')][_0x9cef('0x1f')]||null:null,'limit':_0x5af5e6[_0x9cef('0x19')]?_0x5af5e6[_0x9cef('0x19')][_0x9cef('0x20')]||null:null})[_0x9cef('0xc')](function(_0x164029){logger[_0x9cef('0xd')](_0x9cef('0x1b'),_0x5af5e6);logger['debug'](_0x9cef('0x1b'),_0x5af5e6,JSON[_0x9cef('0x12')](_0x164029));_0x48e244(_0x164029);})[_0x9cef('0x15')](function(_0x5a4c75){logger['error'](_0x9cef('0x1b'),_0x5a4c75[_0x9cef('0x14')],_0x5af5e6);_0x524470(_0x404894[_0x9cef('0x13')](0x1f4,_0x5a4c75['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 82a09e5..21650c2 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 _0xdbfe=['post','create','put','/:id','update','/with-retry/:id','updateWithRetry','delete','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0xb43c8f,_0x1f6041){var _0x467ae5=function(_0x33b071){while(--_0x33b071){_0xb43c8f['push'](_0xb43c8f['shift']());}};_0x467ae5(++_0x1f6041);}(_0xdbfe,0x139));var _0xedbf=function(_0x22dba5,_0x524d1e){_0x22dba5=_0x22dba5-0x0;var _0x36e9a7=_0xdbfe[_0x22dba5];return _0x36e9a7;};'use strict';var express=require(_0xedbf('0x0'));var router=express[_0xedbf('0x1')]();var auth=require(_0xedbf('0x2'));var controller=require(_0xedbf('0x3'));router[_0xedbf('0x4')]('/',auth[_0xedbf('0x5')](),controller['index']);router[_0xedbf('0x4')](_0xedbf('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0xedbf('0x4')]('/:id',auth[_0xedbf('0x5')](),controller['show']);router[_0xedbf('0x7')]('/',auth[_0xedbf('0x5')](),controller[_0xedbf('0x8')]);router[_0xedbf('0x9')](_0xedbf('0xa'),auth[_0xedbf('0x5')](),controller[_0xedbf('0xb')]);router['put'](_0xedbf('0xc'),auth[_0xedbf('0x5')](),controller[_0xedbf('0xd')]);router[_0xedbf('0xe')](_0xedbf('0xa'),auth[_0xedbf('0x5')](),controller['destroy']);module[_0xedbf('0xf')]=router; \ No newline at end of file +var _0xfb22=['put','update','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create'];(function(_0x131bb1,_0x5c91cc){var _0x4b006b=function(_0x236496){while(--_0x236496){_0x131bb1['push'](_0x131bb1['shift']());}};_0x4b006b(++_0x5c91cc);}(_0xfb22,0x186));var _0x2fb2=function(_0x399849,_0x3b630d){_0x399849=_0x399849-0x0;var _0xfbb04=_0xfb22[_0x399849];return _0xfbb04;};'use strict';var express=require(_0x2fb2('0x0'));var router=express[_0x2fb2('0x1')]();var auth=require(_0x2fb2('0x2'));var controller=require(_0x2fb2('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2fb2('0x4')]('/describe',auth[_0x2fb2('0x5')](),controller[_0x2fb2('0x6')]);router[_0x2fb2('0x4')](_0x2fb2('0x7'),auth[_0x2fb2('0x5')](),controller['show']);router[_0x2fb2('0x8')]('/',auth[_0x2fb2('0x5')](),controller[_0x2fb2('0x9')]);router[_0x2fb2('0xa')](_0x2fb2('0x7'),auth[_0x2fb2('0x5')](),controller[_0x2fb2('0xb')]);router['put']('/with-retry/:id',auth[_0x2fb2('0x5')](),controller[_0x2fb2('0xc')]);router[_0x2fb2('0xd')](_0x2fb2('0x7'),auth[_0x2fb2('0x5')](),controller[_0x2fb2('0xe')]);module[_0x2fb2('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index de6dd95..97f57c5 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 _0x2b84=['ENUM','inbound','internal','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x2b84,0x1ed));var _0x42b8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2b84[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x42b8('0x0'));module[_0x42b8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x42b8('0x2')](_0x42b8('0x3'),_0x42b8('0x4'),'outbound',_0x42b8('0x5'),'outbound-fax',_0x42b8('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x42b8('0x7')]},'source':{'type':Sequelize[_0x42b8('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x42b8('0x7')]},'channel':{'type':Sequelize[_0x42b8('0x7')]},'destinationchannel':{'type':Sequelize[_0x42b8('0x7')]},'lastapplication':{'type':Sequelize[_0x42b8('0x7')]},'lastdata':{'type':Sequelize[_0x42b8('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x42b8('0x9')]},'answertime':{'type':Sequelize[_0x42b8('0x9')]},'endtime':{'type':Sequelize[_0x42b8('0x9')]},'duration':{'type':Sequelize[_0x42b8('0xa')]},'billableseconds':{'type':Sequelize[_0x42b8('0xa')]},'mohtime':{'type':Sequelize[_0x42b8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x42b8('0x7')]},'amaflags':{'type':Sequelize[_0x42b8('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x42b8('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x42b8('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x42b8('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x33c4=['exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x16f073,_0x5888d4){var _0x4594d5=function(_0x31a564){while(--_0x31a564){_0x16f073['push'](_0x16f073['shift']());}};_0x4594d5(++_0x5888d4);}(_0x33c4,0xef));var _0x433c=function(_0x454d6c,_0x4ae444){_0x454d6c=_0x454d6c-0x0;var _0x410af9=_0x33c4[_0x454d6c];return _0x410af9;};'use strict';var Sequelize=require(_0x433c('0x0'));module[_0x433c('0x1')]={'uniqueid':{'type':Sequelize[_0x433c('0x2')]},'type':{'type':Sequelize[_0x433c('0x3')](_0x433c('0x4'),_0x433c('0x5'),_0x433c('0x6'),_0x433c('0x7'),'outbound-fax',_0x433c('0x8'))},'tag':{'type':Sequelize[_0x433c('0x2')]},'accountcode':{'type':Sequelize[_0x433c('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x433c('0x2')]},'destinationcontext':{'type':Sequelize[_0x433c('0x2')]},'callerid':{'type':Sequelize[_0x433c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x433c('0x2')]},'lastapplication':{'type':Sequelize[_0x433c('0x2')]},'lastdata':{'type':Sequelize[_0x433c('0x9')]},'starttime':{'type':Sequelize[_0x433c('0xa')]},'systemanswertime':{'type':Sequelize[_0x433c('0xa')]},'answertime':{'type':Sequelize[_0x433c('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x433c('0xb')]},'billableseconds':{'type':Sequelize[_0x433c('0xb')]},'mohtime':{'type':Sequelize[_0x433c('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x433c('0x2')]},'userfield':{'type':Sequelize[_0x433c('0x2')]},'userDisposition':{'type':Sequelize[_0x433c('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x433c('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x433c('0x2')]},'note':{'type':Sequelize[_0x433c('0x2')]},'prefix':{'type':Sequelize[_0x433c('0x2')]},'routeid':{'type':Sequelize[_0x433c('0xb')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e96afe2..dbbda54 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 _0xf555=['find','create','body','describe','user','uniqueid','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','map','VoiceCallReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','type','includeAll','include','fullname','User','findAll','rows','catch','show','params','keys','options'];(function(_0x44db60,_0x4ec8ca){var _0x3fa929=function(_0x5800a6){while(--_0x5800a6){_0x44db60['push'](_0x44db60['shift']());}};_0x3fa929(++_0x4ec8ca);}(_0xf555,0x1c6));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var qs=require(_0x5f55('0x1'));var logger=require(_0x5f55('0x2'))(_0x5f55('0x3'));var db=require(_0x5f55('0x4'))['db'];const promiseRetry=require(_0x5f55('0x5'));function respondWithResult(_0x19c376,_0x46c094){_0x46c094=_0x46c094||0xc8;return function(_0x53e912){if(_0x53e912){return _0x19c376[_0x5f55('0x6')](_0x46c094)[_0x5f55('0x7')](_0x53e912);}};}function respondWithFilteredResult(_0x58dd7d,_0x378a40){return function(_0x5ddea9){if(_0x5ddea9){var _0x578f3f=typeof _0x378a40[_0x5f55('0x8')]===_0x5f55('0x9')&&typeof _0x378a40[_0x5f55('0xa')]===_0x5f55('0x9');var _0x5ab467=_0x5ddea9['count'];var _0x47882c=_0x578f3f?0x0:_0x378a40[_0x5f55('0x8')];var _0x333dce=_0x578f3f?_0x5ddea9[_0x5f55('0xb')]:_0x378a40[_0x5f55('0x8')]+_0x378a40[_0x5f55('0xa')];var _0x34e85a;if(_0x333dce>=_0x5ab467){_0x333dce=_0x5ab467;_0x34e85a=0xc8;}else{_0x34e85a=0xce;}_0x58dd7d[_0x5f55('0x6')](_0x34e85a);return _0x58dd7d[_0x5f55('0xc')](_0x5f55('0xd'),_0x47882c+'-'+_0x333dce+'/'+_0x5ab467)[_0x5f55('0x7')](_0x5ddea9);}return null;};}function saveUpdates(_0x471385){return function(_0x1276ad){if(_0x1276ad){return _0x1276ad[_0x5f55('0xe')](_0x471385)[_0x5f55('0xf')](function(_0x4e0d81){return _0x4e0d81;});}return null;};}function removeEntity(_0x29c193){return function(_0x52a26e){if(_0x52a26e){return _0x52a26e['destroy']()[_0x5f55('0xf')](function(){_0x29c193[_0x5f55('0x6')](0xcc)[_0x5f55('0x10')]();});}};}function handleEntityNotFound(_0x5b1335){return function(_0x5647e2){if(!_0x5647e2){_0x5b1335[_0x5f55('0x11')](0x194);}return _0x5647e2;};}function handleError(_0x4a538f,_0x5c205b){_0x5c205b=_0x5c205b||0x1f4;return function(_0x55f05c){logger[_0x5f55('0x12')](_0x55f05c[_0x5f55('0x13')]);if(_0x55f05c[_0x5f55('0x14')]){delete _0x55f05c['name'];}_0x4a538f[_0x5f55('0x6')](_0x5c205b)[_0x5f55('0x15')](_0x55f05c);};}exports['index']=function(_0x46528e,_0x51b38f){var _0x302383={},_0x42b1f9={},_0x2e2916={'count':0x0,'rows':[]};var _0x18eccd=_[_0x5f55('0x16')](db[_0x5f55('0x17')][_0x5f55('0x18')],function(_0x11562a){return{'name':_0x11562a['fieldName'],'type':_0x11562a['type'][_0x5f55('0x19')]};});_0x42b1f9[_0x5f55('0x1a')]=_['map'](_0x18eccd,'name');_0x42b1f9[_0x5f55('0x1b')]=_['keys'](_0x46528e[_0x5f55('0x1b')]);_0x42b1f9[_0x5f55('0x1c')]=_[_0x5f55('0x1d')](_0x42b1f9[_0x5f55('0x1a')],_0x42b1f9[_0x5f55('0x1b')]);_0x302383[_0x5f55('0x1e')]=_[_0x5f55('0x1d')](_0x42b1f9['model'],qs[_0x5f55('0x1f')](_0x46528e[_0x5f55('0x1b')][_0x5f55('0x1f')]));_0x302383[_0x5f55('0x1e')]=_0x302383['attributes'][_0x5f55('0x20')]?_0x302383[_0x5f55('0x1e')]:_0x42b1f9[_0x5f55('0x1a')];if(!_0x46528e['query'][_0x5f55('0x21')](_0x5f55('0x22'))){_0x302383[_0x5f55('0xa')]=qs['limit'](_0x46528e[_0x5f55('0x1b')][_0x5f55('0xa')]);_0x302383['offset']=qs[_0x5f55('0x8')](_0x46528e['query'][_0x5f55('0x8')]);}_0x302383[_0x5f55('0x23')]=qs['sort'](_0x46528e[_0x5f55('0x1b')]['sort']);_0x302383[_0x5f55('0x24')]=qs[_0x5f55('0x1c')](_['pick'](_0x46528e['query'],_0x42b1f9[_0x5f55('0x1c')]),_0x18eccd);if(_0x46528e['query']['filter']){_0x302383[_0x5f55('0x24')]=_[_0x5f55('0x25')](_0x302383[_0x5f55('0x24')],{'$or':_['map'](_0x18eccd,function(_0x1f0b5a){if(_0x1f0b5a[_0x5f55('0x26')]!=='VIRTUAL'){var _0x520d47={};_0x520d47[_0x1f0b5a['name']]={'$like':'%'+_0x46528e[_0x5f55('0x1b')]['filter']+'%'};return _0x520d47;}})});}_0x302383=_['merge']({},_0x302383,_0x46528e['options']);var _0x2bf8ab={'where':_0x302383[_0x5f55('0x24')]};return db['VoiceCallReport'][_0x5f55('0xb')](_0x2bf8ab)[_0x5f55('0xf')](function(_0x57d907){_0x2e2916[_0x5f55('0xb')]=_0x57d907;if(_0x46528e[_0x5f55('0x1b')][_0x5f55('0x27')]){_0x302383[_0x5f55('0x28')]=[{'attributes':['id',_0x5f55('0x14'),_0x5f55('0x29'),'alias'],'model':db[_0x5f55('0x2a')],'as':_0x5f55('0x2a')}];}return db['VoiceCallReport'][_0x5f55('0x2b')](_0x302383);})['then'](function(_0x548892){_0x2e2916[_0x5f55('0x2c')]=_0x548892;return _0x2e2916;})[_0x5f55('0xf')](respondWithFilteredResult(_0x51b38f,_0x302383))[_0x5f55('0x2d')](handleError(_0x51b38f,null));};exports[_0x5f55('0x2e')]=function(_0x549096,_0x51196f){var _0x5bef98={'raw':!![],'where':{'id':_0x549096[_0x5f55('0x2f')]['id']}},_0x3c1533={};_0x3c1533[_0x5f55('0x1a')]=_[_0x5f55('0x30')](db[_0x5f55('0x17')][_0x5f55('0x18')]);_0x3c1533[_0x5f55('0x1b')]=_[_0x5f55('0x30')](_0x549096[_0x5f55('0x1b')]);_0x3c1533['filters']=_[_0x5f55('0x1d')](_0x3c1533['model'],_0x3c1533[_0x5f55('0x1b')]);_0x5bef98[_0x5f55('0x1e')]=_[_0x5f55('0x1d')](_0x3c1533['model'],qs[_0x5f55('0x1f')](_0x549096[_0x5f55('0x1b')][_0x5f55('0x1f')]));_0x5bef98[_0x5f55('0x1e')]=_0x5bef98['attributes'][_0x5f55('0x20')]?_0x5bef98[_0x5f55('0x1e')]:_0x3c1533[_0x5f55('0x1a')];if(_0x549096[_0x5f55('0x1b')][_0x5f55('0x27')]){_0x5bef98[_0x5f55('0x28')]=[{'all':!![]}];}_0x5bef98=_['merge']({},_0x5bef98,_0x549096[_0x5f55('0x31')]);return db['VoiceCallReport'][_0x5f55('0x32')](_0x5bef98)['then'](handleEntityNotFound(_0x51196f,null))[_0x5f55('0xf')](respondWithResult(_0x51196f,null))[_0x5f55('0x2d')](handleError(_0x51196f,null));};exports[_0x5f55('0x33')]=function(_0x54fc89,_0xc47851){return db[_0x5f55('0x17')]['create'](_0x54fc89[_0x5f55('0x34')],{})[_0x5f55('0xf')](respondWithResult(_0xc47851,0xc9))[_0x5f55('0x2d')](handleError(_0xc47851,null));};exports['destroy']=function(_0x5f073f,_0x5bde7d){return db['VoiceCallReport'][_0x5f55('0x32')]({'where':{'id':_0x5f073f['params']['id']}})[_0x5f55('0xf')](handleEntityNotFound(_0x5bde7d,null))[_0x5f55('0xf')](removeEntity(_0x5bde7d,null))[_0x5f55('0x2d')](handleError(_0x5bde7d,null));};exports[_0x5f55('0x35')]=function(_0x31392c,_0x5aa2dc){return db[_0x5f55('0x17')][_0x5f55('0x35')]()[_0x5f55('0xf')](respondWithResult(_0x5aa2dc,null))[_0x5f55('0x2d')](handleError(_0x5aa2dc,null));};function findForUpdate(_0xec3fd2){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0xec3fd2[_0x5f55('0x2f')]['id'],'UserId':{'$or':[null,_0xec3fd2[_0x5f55('0x36')]['id']]}}});}exports['update']=function(_0x30d460,_0x1d6870){if(_0x30d460[_0x5f55('0x34')][_0x5f55('0x37')]){delete _0x30d460[_0x5f55('0x34')]['uniqueid'];}return findForUpdate(_0x30d460)[_0x5f55('0xf')](handleEntityNotFound(_0x1d6870,null))[_0x5f55('0xf')](saveUpdates(_0x30d460[_0x5f55('0x34')],null))[_0x5f55('0xf')](respondWithResult(_0x1d6870,null))[_0x5f55('0x2d')](handleError(_0x1d6870,null));};exports['updateWithRetry']=function(_0x31b615,_0x1f057c){if(_0x31b615['body']['uniqueid']){delete _0x31b615['body'][_0x5f55('0x37')];}promiseRetry(function(_0x39bffb){return findForUpdate(_0x31b615)[_0x5f55('0xf')](function(_0x1ea130){if(_0x1ea130!==null){return _0x1ea130;}else{_0x39bffb(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x5f55('0xf')](function(_0x406ae9){return _0x406ae9['update'](_0x31b615[_0x5f55('0x34')])['then'](function(_0x484f10){return respondWithResult(_0x1f057c)(_0x484f10);});},function(_0x1803c9){handleEntityNotFound(_0x1f057c)(_0x1803c9);})[_0x5f55('0x2d')](function(_0x2989de){handleEntityNotFound(_0x1f057c)(_0x2989de);});}; \ No newline at end of file +var _0xa9e0=['create','body','describe','user','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','promise-retry','status','json','offset','undefined','count','limit','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','alias','User','findAll','rows','catch','show','params'];(function(_0x37175d,_0x335612){var _0x33dadc=function(_0x2ee0ef){while(--_0x2ee0ef){_0x37175d['push'](_0x37175d['shift']());}};_0x33dadc(++_0x335612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var qs=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x0a9e('0x3'));function respondWithResult(_0x4ce2f1,_0x333808){_0x333808=_0x333808||0xc8;return function(_0x432180){if(_0x432180){return _0x4ce2f1[_0x0a9e('0x4')](_0x333808)[_0x0a9e('0x5')](_0x432180);}};}function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x6')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x7');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x6')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x8')]:_0x57b080[_0x0a9e('0x6')]+_0x57b080[_0x0a9e('0x9')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0x5')](_0x219af0);}return null;};}function saveUpdates(_0x36471c){return function(_0xd5b662){if(_0xd5b662){return _0xd5b662[_0x0a9e('0xa')](_0x36471c)[_0x0a9e('0xb')](function(_0x69aeb7){return _0x69aeb7;});}return null;};}function removeEntity(_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){return _0x4283ce[_0x0a9e('0xc')]()[_0x0a9e('0xb')](function(){_0x5db4b0[_0x0a9e('0x4')](0xcc)[_0x0a9e('0xd')]();});}};}function handleEntityNotFound(_0x4d5611){return function(_0x52a03d){if(!_0x52a03d){_0x4d5611[_0x0a9e('0xe')](0x194);}return _0x52a03d;};}function handleError(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0x1f4;return function(_0x519dfd){logger[_0x0a9e('0xf')](_0x519dfd[_0x0a9e('0x10')]);if(_0x519dfd['name']){delete _0x519dfd[_0x0a9e('0x11')];}_0x5d0880['status'](_0x1985b6)[_0x0a9e('0x12')](_0x519dfd);};}exports[_0x0a9e('0x13')]=function(_0x106033,_0x205fd6){var _0x31b1ca={},_0x2eb11f={},_0x530eb7={'count':0x0,'rows':[]};var _0x20559e=_[_0x0a9e('0x14')](db[_0x0a9e('0x15')][_0x0a9e('0x16')],function(_0x105080){return{'name':_0x105080['fieldName'],'type':_0x105080[_0x0a9e('0x17')][_0x0a9e('0x18')]};});_0x2eb11f['model']=_[_0x0a9e('0x14')](_0x20559e,'name');_0x2eb11f['query']=_[_0x0a9e('0x19')](_0x106033[_0x0a9e('0x1a')]);_0x2eb11f[_0x0a9e('0x1b')]=_[_0x0a9e('0x1c')](_0x2eb11f['model'],_0x2eb11f[_0x0a9e('0x1a')]);_0x31b1ca[_0x0a9e('0x1d')]=_[_0x0a9e('0x1c')](_0x2eb11f[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x1f')]));_0x31b1ca['attributes']=_0x31b1ca['attributes'][_0x0a9e('0x20')]?_0x31b1ca[_0x0a9e('0x1d')]:_0x2eb11f[_0x0a9e('0x1e')];if(!_0x106033[_0x0a9e('0x1a')]['hasOwnProperty'](_0x0a9e('0x21'))){_0x31b1ca['limit']=qs[_0x0a9e('0x9')](_0x106033['query'][_0x0a9e('0x9')]);_0x31b1ca[_0x0a9e('0x6')]=qs[_0x0a9e('0x6')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x6')]);}_0x31b1ca[_0x0a9e('0x22')]=qs[_0x0a9e('0x23')](_0x106033[_0x0a9e('0x1a')]['sort']);_0x31b1ca[_0x0a9e('0x24')]=qs[_0x0a9e('0x1b')](_[_0x0a9e('0x25')](_0x106033[_0x0a9e('0x1a')],_0x2eb11f['filters']),_0x20559e);if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x26')]){_0x31b1ca[_0x0a9e('0x24')]=_[_0x0a9e('0x27')](_0x31b1ca[_0x0a9e('0x24')],{'$or':_[_0x0a9e('0x14')](_0x20559e,function(_0x296f41){if(_0x296f41[_0x0a9e('0x17')]!==_0x0a9e('0x28')){var _0x540530={};_0x540530[_0x296f41[_0x0a9e('0x11')]]={'$like':'%'+_0x106033['query'][_0x0a9e('0x26')]+'%'};return _0x540530;}})});}_0x31b1ca=_[_0x0a9e('0x27')]({},_0x31b1ca,_0x106033[_0x0a9e('0x29')]);var _0x33bdb7={'where':_0x31b1ca[_0x0a9e('0x24')]};return db['VoiceCallReport'][_0x0a9e('0x8')](_0x33bdb7)[_0x0a9e('0xb')](function(_0x40cb85){_0x530eb7[_0x0a9e('0x8')]=_0x40cb85;if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x31b1ca[_0x0a9e('0x2b')]=[{'attributes':['id',_0x0a9e('0x11'),'fullname',_0x0a9e('0x2c')],'model':db['User'],'as':_0x0a9e('0x2d')}];}return db[_0x0a9e('0x15')][_0x0a9e('0x2e')](_0x31b1ca);})[_0x0a9e('0xb')](function(_0x567193){_0x530eb7[_0x0a9e('0x2f')]=_0x567193;return _0x530eb7;})[_0x0a9e('0xb')](respondWithFilteredResult(_0x205fd6,_0x31b1ca))[_0x0a9e('0x30')](handleError(_0x205fd6,null));};exports[_0x0a9e('0x31')]=function(_0x4853b1,_0x54135e){var _0x1e8694={'raw':!![],'where':{'id':_0x4853b1[_0x0a9e('0x32')]['id']}},_0x5640eb={};_0x5640eb[_0x0a9e('0x1e')]=_[_0x0a9e('0x19')](db[_0x0a9e('0x15')]['rawAttributes']);_0x5640eb[_0x0a9e('0x1a')]=_[_0x0a9e('0x19')](_0x4853b1[_0x0a9e('0x1a')]);_0x5640eb['filters']=_[_0x0a9e('0x1c')](_0x5640eb[_0x0a9e('0x1e')],_0x5640eb[_0x0a9e('0x1a')]);_0x1e8694['attributes']=_['intersection'](_0x5640eb[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x4853b1['query'][_0x0a9e('0x1f')]));_0x1e8694[_0x0a9e('0x1d')]=_0x1e8694[_0x0a9e('0x1d')][_0x0a9e('0x20')]?_0x1e8694['attributes']:_0x5640eb['model'];if(_0x4853b1[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x1e8694['include']=[{'all':!![]}];}_0x1e8694=_[_0x0a9e('0x27')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x29')]);return db[_0x0a9e('0x15')]['find'](_0x1e8694)[_0x0a9e('0xb')](handleEntityNotFound(_0x54135e,null))[_0x0a9e('0xb')](respondWithResult(_0x54135e,null))[_0x0a9e('0x30')](handleError(_0x54135e,null));};exports[_0x0a9e('0x33')]=function(_0x13cb1f,_0xeaa5e5){return db[_0x0a9e('0x15')][_0x0a9e('0x33')](_0x13cb1f[_0x0a9e('0x34')],{})[_0x0a9e('0xb')](respondWithResult(_0xeaa5e5,0xc9))[_0x0a9e('0x30')](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0xc')]=function(_0x1a7bce,_0x11ca30){return db[_0x0a9e('0x15')]['find']({'where':{'id':_0x1a7bce['params']['id']}})[_0x0a9e('0xb')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0xb')](removeEntity(_0x11ca30,null))[_0x0a9e('0x30')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x35')]=function(_0x1a69dd,_0xc9a702){return db[_0x0a9e('0x15')][_0x0a9e('0x35')]()[_0x0a9e('0xb')](respondWithResult(_0xc9a702,null))[_0x0a9e('0x30')](handleError(_0xc9a702,null));};function findForUpdate(_0x2c2cb0){return db[_0x0a9e('0x15')]['find']({'where':{'uniqueid':_0x2c2cb0[_0x0a9e('0x32')]['id'],'UserId':{'$or':[null,_0x2c2cb0[_0x0a9e('0x36')]['id']]}}});}exports[_0x0a9e('0xa')]=function(_0xfbd5ad,_0x2e8caf){if(_0xfbd5ad[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0xfbd5ad[_0x0a9e('0x34')]['uniqueid'];}return findForUpdate(_0xfbd5ad)[_0x0a9e('0xb')](handleEntityNotFound(_0x2e8caf,null))['then'](saveUpdates(_0xfbd5ad[_0x0a9e('0x34')],null))[_0x0a9e('0xb')](respondWithResult(_0x2e8caf,null))[_0x0a9e('0x30')](handleError(_0x2e8caf,null));};exports['updateWithRetry']=function(_0x14bec2,_0x7f6eb1){if(_0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')];}promiseRetry(function(_0x45bf7f){return findForUpdate(_0x14bec2)['then'](function(_0x13f44d){if(_0x13f44d!==null){return _0x13f44d;}else{_0x45bf7f(new Error(_0x0a9e('0x38')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x0a9e('0xb')](function(_0x16f976){return _0x16f976[_0x0a9e('0xa')](_0x14bec2[_0x0a9e('0x34')])[_0x0a9e('0xb')](function(_0x19383e){return respondWithResult(_0x7f6eb1)(_0x19383e);});},function(){handleEntityNotFound(_0x7f6eb1)();})[_0x0a9e('0x30')](function(){handleEntityNotFound(_0x7f6eb1)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a386ecb..c6ad13e 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 _0x5826=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','../../config/logger','bluebird'];(function(_0x1ca767,_0x414f22){var _0x126bb6=function(_0x2e0816){while(--_0x2e0816){_0x1ca767['push'](_0x1ca767['shift']());}};_0x126bb6(++_0x414f22);}(_0x5826,0x1ea));var _0x6582=function(_0x10c9ab,_0x3fdb79){_0x10c9ab=_0x10c9ab-0x0;var _0x28af13=_0x5826[_0x10c9ab];return _0x28af13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6582('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6582('0x1'));var rp=require(_0x6582('0x2'));var fs=require('fs');var path=require(_0x6582('0x3'));var rimraf=require(_0x6582('0x4'));var config=require(_0x6582('0x5'));var attributes=require(_0x6582('0x6'));module[_0x6582('0x7')]=function(_0x401271,_0x3d0ce3){return _0x401271[_0x6582('0x8')](_0x6582('0x9'),attributes,{'tableName':_0x6582('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6582('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81a5=['path','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9b77f7,_0x285fed){var _0x202162=function(_0x55dfdf){while(--_0x55dfdf){_0x9b77f7['push'](_0x9b77f7['shift']());}};_0x202162(++_0x285fed);}(_0x81a5,0x1c8));var _0x581a=function(_0x4cfca9,_0x5afaf1){_0x4cfca9=_0x4cfca9-0x0;var _0x55f768=_0x81a5[_0x4cfca9];return _0x55f768;};'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('./voiceCallReport.attributes');module['exports']=function(_0x21fea7,_0x56065e){return _0x21fea7[_0x581a('0x7')](_0x581a('0x8'),attributes,{'tableName':_0x581a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x581a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ad367d0..1b43cd9 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 _0x7759=['debug','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent'];(function(_0x38728a,_0x3079d9){var _0x23118a=function(_0x353a5d){while(--_0x353a5d){_0x38728a['push'](_0x38728a['shift']());}};_0x23118a(++_0x3079d9);}(_0x7759,0x102));var _0x9775=function(_0x113bac,_0x4355bc){_0x113bac=_0x113bac-0x0;var _0x582227=_0x7759[_0x113bac];return _0x582227;};'use strict';var _=require(_0x9775('0x0'));var util=require(_0x9775('0x1'));var moment=require(_0x9775('0x2'));var BPromise=require(_0x9775('0x3'));var rs=require(_0x9775('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9775('0x5'))['db'];var utils=require(_0x9775('0x6'));var logger=require(_0x9775('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9775('0x8'));var client=jayson[_0x9775('0x9')][_0x9775('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe27fe8,_0x21eb15,_0x5ae58a){return new BPromise(function(_0x151783,_0x299bc1){return client[_0x9775('0xb')](_0xe27fe8,_0x5ae58a)['then'](function(_0x11d96a){logger[_0x9775('0xc')](_0x9775('0xd'),_0x21eb15,_0x9775('0xe'));logger[_0x9775('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x21eb15,_0x9775('0xe'),JSON['stringify'](_0x11d96a));if(_0x11d96a['error']){if(_0x11d96a[_0x9775('0x10')][_0x9775('0x11')]===0x1f4){logger[_0x9775('0x10')](_0x9775('0xd'),_0x21eb15,_0x11d96a[_0x9775('0x10')][_0x9775('0x12')]);return _0x299bc1(_0x11d96a[_0x9775('0x10')]['message']);}logger[_0x9775('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x21eb15,_0x11d96a[_0x9775('0x10')]['message']);return _0x151783(_0x11d96a[_0x9775('0x10')]['message']);}else{logger['info'](_0x9775('0xd'),_0x21eb15,_0x9775('0xe'));_0x151783(_0x11d96a[_0x9775('0x13')][_0x9775('0x12')]);}})[_0x9775('0x14')](function(_0x25ceef){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x21eb15,_0x25ceef);_0x299bc1(_0x25ceef);});});}exports[_0x9775('0x15')]=function(_0x1684a8){var _0x500363=this;return new Promise(function(_0x2e599f,_0x1ad192){return db[_0x9775('0x16')][_0x9775('0x17')]({'raw':_0x1684a8[_0x9775('0x18')]?_0x1684a8[_0x9775('0x18')][_0x9775('0x19')]===undefined?!![]:![]:!![],'where':_0x1684a8[_0x9775('0x18')]?_0x1684a8[_0x9775('0x18')][_0x9775('0x1a')]||null:null,'attributes':_0x1684a8[_0x9775('0x18')]?_0x1684a8['options'][_0x9775('0x1b')]||null:null,'limit':_0x1684a8['options']?_0x1684a8[_0x9775('0x18')][_0x9775('0x1c')]||null:null,'include':_0x1684a8[_0x9775('0x18')]?_0x1684a8[_0x9775('0x18')][_0x9775('0x1d')]?_[_0x9775('0x1e')](_0x1684a8[_0x9775('0x18')][_0x9775('0x1d')],function(_0x28be98){return{'model':db[_0x28be98[_0x9775('0x1f')]],'as':_0x28be98['as'],'attributes':_0x28be98['attributes'],'include':_0x28be98[_0x9775('0x1d')]?_[_0x9775('0x1e')](_0x28be98[_0x9775('0x1d')],function(_0x36dcef){return{'model':db[_0x36dcef[_0x9775('0x1f')]],'as':_0x36dcef['as'],'attributes':_0x36dcef[_0x9775('0x1b')],'include':_0x36dcef[_0x9775('0x1d')]?_[_0x9775('0x1e')](_0x36dcef[_0x9775('0x1d')],function(_0x356551){return{'model':db[_0x356551[_0x9775('0x1f')]],'as':_0x356551['as'],'attributes':_0x356551[_0x9775('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9775('0x20')](function(_0x476b5){logger[_0x9775('0xc')](_0x9775('0x15'),_0x1684a8);logger[_0x9775('0xf')](_0x9775('0x15'),_0x1684a8,JSON[_0x9775('0x21')](_0x476b5));_0x2e599f(_0x476b5);})[_0x9775('0x14')](function(_0x20340a){logger[_0x9775('0x10')](_0x9775('0x15'),_0x20340a[_0x9775('0x12')],_0x1684a8);_0x1ad192(_0x500363[_0x9775('0x10')](0x1f4,_0x20340a[_0x9775('0x12')]));});});};exports[_0x9775('0x22')]=function(_0x64bbc3){var _0x4353ef=this;return new Promise(function(_0x2687e8,_0x5796a0){return db['VoiceCallReport'][_0x9775('0x23')](_0x64bbc3[_0x9775('0x24')],{'raw':_0x64bbc3[_0x9775('0x18')]?_0x64bbc3[_0x9775('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9775('0x20')](function(_0x5c7e5c){logger['info']('CreateVoiceCallReport',_0x64bbc3);logger[_0x9775('0xf')](_0x9775('0x22'),_0x64bbc3,JSON[_0x9775('0x21')](_0x5c7e5c));_0x2687e8(_0x5c7e5c);})['catch'](function(_0x350f6b){logger['error'](_0x9775('0x22'),_0x350f6b['message'],_0x64bbc3);_0x5796a0(_0x4353ef[_0x9775('0x10')](0x1f4,_0x350f6b[_0x9775('0x12')]));});});};exports[_0x9775('0x25')]=function(_0x51e3e0){var _0x4fd47b=this;return new Promise(function(_0x255243,_0x4579ab){return db['VoiceCallReport'][_0x9775('0x26')](_0x51e3e0[_0x9775('0x24')],{'raw':_0x51e3e0[_0x9775('0x18')]?_0x51e3e0[_0x9775('0x18')][_0x9775('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51e3e0[_0x9775('0x18')]?_0x51e3e0[_0x9775('0x18')][_0x9775('0x1a')]||null:null,'attributes':_0x51e3e0[_0x9775('0x18')]?_0x51e3e0[_0x9775('0x18')]['attributes']||null:null,'limit':_0x51e3e0[_0x9775('0x18')]?_0x51e3e0[_0x9775('0x18')][_0x9775('0x1c')]||null:null})[_0x9775('0x20')](function(_0x3b8176){logger[_0x9775('0xc')]('UpdateVoiceCallReport',_0x51e3e0);logger[_0x9775('0xf')]('UpdateVoiceCallReport',_0x51e3e0,JSON[_0x9775('0x21')](_0x3b8176));_0x255243(_0x3b8176);})[_0x9775('0x14')](function(_0x43858){logger[_0x9775('0x10')]('UpdateVoiceCallReport',_0x43858[_0x9775('0x12')],_0x51e3e0);_0x4579ab(_0x4fd47b[_0x9775('0x10')](0x1f4,_0x43858[_0x9775('0x12')]));});});}; \ No newline at end of file +var _0x1856=['model','attributes','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','catch','findAll','options','raw','limit','include','map'];(function(_0x7bf378,_0x3d2794){var _0xeaaeb4=function(_0x4c0f1d){while(--_0x4c0f1d){_0x7bf378['push'](_0x7bf378['shift']());}};_0xeaaeb4(++_0x3d2794);}(_0x1856,0x121));var _0x6185=function(_0xe42e8,_0x5f38f7){_0xe42e8=_0xe42e8-0x0;var _0x1b4182=_0x1856[_0xe42e8];return _0x1b4182;};'use strict';var _=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var moment=require(_0x6185('0x2'));var BPromise=require('bluebird');var rs=require(_0x6185('0x3'));var fs=require('fs');var Redis=require(_0x6185('0x4'));var db=require(_0x6185('0x5'))['db'];var utils=require(_0x6185('0x6'));var logger=require(_0x6185('0x7'))(_0x6185('0x8'));var config=require(_0x6185('0x9'));var jayson=require(_0x6185('0xa'));var client=jayson[_0x6185('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29dab7,_0x4f3734,_0x2a2788){return new BPromise(function(_0x1e61b0,_0x587f53){return client[_0x6185('0xc')](_0x29dab7,_0x2a2788)[_0x6185('0xd')](function(_0x3aa4d0){logger[_0x6185('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3734,'request\x20sent');logger[_0x6185('0xf')](_0x6185('0x10'),_0x4f3734,_0x6185('0x11'),JSON[_0x6185('0x12')](_0x3aa4d0));if(_0x3aa4d0[_0x6185('0x13')]){if(_0x3aa4d0[_0x6185('0x13')][_0x6185('0x14')]===0x1f4){logger[_0x6185('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3734,_0x3aa4d0['error'][_0x6185('0x15')]);return _0x587f53(_0x3aa4d0[_0x6185('0x13')][_0x6185('0x15')]);}logger[_0x6185('0x13')](_0x6185('0x16'),_0x4f3734,_0x3aa4d0[_0x6185('0x13')][_0x6185('0x15')]);return _0x1e61b0(_0x3aa4d0[_0x6185('0x13')][_0x6185('0x15')]);}else{logger[_0x6185('0xe')](_0x6185('0x16'),_0x4f3734,'request\x20sent');_0x1e61b0(_0x3aa4d0[_0x6185('0x17')][_0x6185('0x15')]);}})[_0x6185('0x18')](function(_0x812ee0){logger[_0x6185('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x4f3734,_0x812ee0);_0x587f53(_0x812ee0);});});}exports['GetVoiceCallReport']=function(_0x20b08e){var _0x444025=this;return new Promise(function(_0x9bf2de,_0x12c6a4){return db['VoiceCallReport'][_0x6185('0x19')]({'raw':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')][_0x6185('0x1b')]===undefined?!![]:![]:!![],'where':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')]['where']||null:null,'attributes':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')]['attributes']||null:null,'limit':_0x20b08e[_0x6185('0x1a')]?_0x20b08e[_0x6185('0x1a')][_0x6185('0x1c')]||null:null,'include':_0x20b08e[_0x6185('0x1a')]?_0x20b08e['options'][_0x6185('0x1d')]?_[_0x6185('0x1e')](_0x20b08e[_0x6185('0x1a')][_0x6185('0x1d')],function(_0x4e92fa){return{'model':db[_0x4e92fa[_0x6185('0x1f')]],'as':_0x4e92fa['as'],'attributes':_0x4e92fa[_0x6185('0x20')],'include':_0x4e92fa[_0x6185('0x1d')]?_[_0x6185('0x1e')](_0x4e92fa[_0x6185('0x1d')],function(_0x5d9f45){return{'model':db[_0x5d9f45[_0x6185('0x1f')]],'as':_0x5d9f45['as'],'attributes':_0x5d9f45[_0x6185('0x20')],'include':_0x5d9f45[_0x6185('0x1d')]?_['map'](_0x5d9f45[_0x6185('0x1d')],function(_0x2ff34b){return{'model':db[_0x2ff34b[_0x6185('0x1f')]],'as':_0x2ff34b['as'],'attributes':_0x2ff34b[_0x6185('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6185('0xd')](function(_0x3ae4e7){logger['info'](_0x6185('0x21'),_0x20b08e);logger[_0x6185('0xf')](_0x6185('0x21'),_0x20b08e,JSON[_0x6185('0x12')](_0x3ae4e7));_0x9bf2de(_0x3ae4e7);})[_0x6185('0x18')](function(_0x3f2d34){logger[_0x6185('0x13')](_0x6185('0x21'),_0x3f2d34['message'],_0x20b08e);_0x12c6a4(_0x444025[_0x6185('0x13')](0x1f4,_0x3f2d34[_0x6185('0x15')]));});});};exports[_0x6185('0x22')]=function(_0x3a032a){var _0x69a0a4=this;return new Promise(function(_0x42098f,_0x3202f4){return db[_0x6185('0x23')][_0x6185('0x24')](_0x3a032a[_0x6185('0x25')],{'raw':_0x3a032a[_0x6185('0x1a')]?_0x3a032a[_0x6185('0x1a')][_0x6185('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4105de){logger[_0x6185('0xe')](_0x6185('0x22'),_0x3a032a);logger[_0x6185('0xf')](_0x6185('0x22'),_0x3a032a,JSON[_0x6185('0x12')](_0x4105de));_0x42098f(_0x4105de);})[_0x6185('0x18')](function(_0x3ffb8c){logger[_0x6185('0x13')]('CreateVoiceCallReport',_0x3ffb8c['message'],_0x3a032a);_0x3202f4(_0x69a0a4[_0x6185('0x13')](0x1f4,_0x3ffb8c[_0x6185('0x15')]));});});};exports[_0x6185('0x26')]=function(_0xff92fb){var _0x34e580=this;return new Promise(function(_0x59074b,_0x47d1dc){return db[_0x6185('0x23')]['update'](_0xff92fb[_0x6185('0x25')],{'raw':_0xff92fb[_0x6185('0x1a')]?_0xff92fb[_0x6185('0x1a')][_0x6185('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xff92fb[_0x6185('0x1a')]?_0xff92fb[_0x6185('0x1a')][_0x6185('0x27')]||null:null,'attributes':_0xff92fb['options']?_0xff92fb[_0x6185('0x1a')][_0x6185('0x20')]||null:null,'limit':_0xff92fb[_0x6185('0x1a')]?_0xff92fb[_0x6185('0x1a')][_0x6185('0x1c')]||null:null})[_0x6185('0xd')](function(_0x1bc86c){logger[_0x6185('0xe')](_0x6185('0x26'),_0xff92fb);logger[_0x6185('0xf')](_0x6185('0x26'),_0xff92fb,JSON['stringify'](_0x1bc86c));_0x59074b(_0x1bc86c);})[_0x6185('0x18')](function(_0xd14b8){logger[_0x6185('0x13')](_0x6185('0x26'),_0xd14b8[_0x6185('0x15')],_0xff92fb);_0x47d1dc(_0x34e580[_0x6185('0x13')](0x1f4,_0xd14b8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9bf2cf1..352a9d7 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 _0xaf9a=['index','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0xaf9a,0x16c));var _0xaaf9=function(_0x478996,_0x39d8af){_0x478996=_0x478996-0x0;var _0x8fcaea=_0xaf9a[_0x478996];return _0x8fcaea;};'use strict';var multer=require(_0xaaf9('0x0'));var util=require(_0xaaf9('0x1'));var path=require(_0xaaf9('0x2'));var timeout=require(_0xaaf9('0x3'));var express=require('express');var router=express[_0xaaf9('0x4')]();var fs_extra=require(_0xaaf9('0x5'));var auth=require(_0xaaf9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaaf9('0x7'));router[_0xaaf9('0x8')]('/',auth[_0xaaf9('0x9')](),controller[_0xaaf9('0xa')]);router[_0xaaf9('0x8')](_0xaaf9('0xb'),auth[_0xaaf9('0x9')](),controller[_0xaaf9('0xc')]);router['post']('/',auth[_0xaaf9('0x9')](),controller[_0xaaf9('0xd')]);router[_0xaaf9('0xe')](_0xaaf9('0xb'),auth[_0xaaf9('0x9')](),controller['update']);router[_0xaaf9('0xf')]('/:id',auth[_0xaaf9('0x9')](),controller[_0xaaf9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5a03=['isAuthenticated','index','/:id','show','post','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x5a03,0xe5));var _0x35a0=function(_0x33add1,_0x45a7ea){_0x33add1=_0x33add1-0x0;var _0x56aca9=_0x5a03[_0x33add1];return _0x56aca9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35a0('0x0'));var timeout=require(_0x35a0('0x1'));var express=require(_0x35a0('0x2'));var router=express[_0x35a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35a0('0x4'));var interaction=require(_0x35a0('0x5'));var config=require(_0x35a0('0x6'));var controller=require(_0x35a0('0x7'));router[_0x35a0('0x8')]('/',auth[_0x35a0('0x9')](),controller[_0x35a0('0xa')]);router[_0x35a0('0x8')](_0x35a0('0xb'),auth[_0x35a0('0x9')](),controller[_0x35a0('0xc')]);router[_0x35a0('0xd')]('/',auth[_0x35a0('0x9')](),controller['create']);router['put']('/:id',auth[_0x35a0('0x9')](),controller['update']);router[_0x35a0('0xe')](_0x35a0('0xb'),auth[_0x35a0('0x9')](),controller[_0x35a0('0xf')]);module[_0x35a0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9b1ae24..f0b77fa 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 _0xd97d=['name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x36dee4,_0x657d33){var _0x37d1d6=function(_0x20288c){while(--_0x20288c){_0x36dee4['push'](_0x36dee4['shift']());}};_0x37d1d6(++_0x657d33);}(_0xd97d,0x19b));var _0xdd97=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xd97d[_0xbc4560];return _0x298cfb;};'use strict';var Sequelize=require(_0xdd97('0x0'));module[_0xdd97('0x1')]={'name':{'type':Sequelize[_0xdd97('0x2')]},'prefix':{'type':Sequelize[_0xdd97('0x2')],'unique':_0xdd97('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xd5d3c5){this[_0xdd97('0x4')](_0xdd97('0x5'),_0xd5d3c5?_0xd5d3c5[_0xdd97('0x6')](''):[]);},'get':function(){return this[_0xdd97('0x7')]('options')?this[_0xdd97('0x7')](_0xdd97('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xdd97('0x2')]},'record':{'type':Sequelize[_0xdd97('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdd97('0x2')]},'description':{'type':Sequelize[_0xdd97('0x2')]}}; \ No newline at end of file +var _0x2d51=['options','join','getDataValue','BOOLEAN','STRING','name','setDataValue'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x2d51,0x100));var _0x12d5=function(_0x3f771e,_0x3027ec){_0x3f771e=_0x3f771e-0x0;var _0x2436fd=_0x2d51[_0x3f771e];return _0x2436fd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x12d5('0x0')]},'prefix':{'type':Sequelize[_0x12d5('0x0')],'unique':_0x12d5('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x12d5('0x0')],'set':function(_0x525d29){this[_0x12d5('0x2')](_0x12d5('0x3'),_0x525d29?_0x525d29[_0x12d5('0x4')](''):[]);},'get':function(){return this[_0x12d5('0x5')](_0x12d5('0x3'))?this[_0x12d5('0x5')](_0x12d5('0x3'))['split'](''):[];}},'auth':{'type':Sequelize[_0x12d5('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x12d5('0x0')]},'record':{'type':Sequelize[_0x12d5('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x12d5('0x0')]},'description':{'type':Sequelize[_0x12d5('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ac8ad60..5d47423 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 _0x2e54=['apply','reject','save','then','get','ChanSpies','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','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'];(function(_0x212bcd,_0x34cd84){var _0x200258=function(_0x425430){while(--_0x425430){_0x212bcd['push'](_0x212bcd['shift']());}};_0x200258(++_0x34cd84);}(_0x2e54,0x1dd));var _0x42e5=function(_0x511bce,_0x132a34){_0x511bce=_0x511bce-0x0;var _0x24ccc8=_0x2e54[_0x511bce];return _0x24ccc8;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){var _0xf29221=_0x32380f[_0x42e5('0x25')]({'plain':!![]});var _0x275c80=_0x42e5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x275c80,'resourceId':_0xf29221['id']}})[_0x42e5('0x24')](function(){return _0x32380f;});})['then'](function(){_0x37d10e['status'](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x5b1727,_0x392c6b){return function(_0x2d9e65){if(!_0x2d9e65){_0x5b1727[_0x42e5('0x18')](0x194);}return _0x2d9e65;};}function handleError(_0x1c8ee4,_0x27ae27){_0x27ae27=_0x27ae27||0x1f4;return function(_0x2f1edc){logger['error'](_0x2f1edc[_0x42e5('0x27')]);if(_0x2f1edc[_0x42e5('0x28')]){delete _0x2f1edc[_0x42e5('0x28')];}_0x1c8ee4[_0x42e5('0x19')](_0x27ae27)[_0x42e5('0x29')](_0x2f1edc);};}exports[_0x42e5('0x2a')]=function(_0x383e97,_0x282cbf){var _0x5a4930={},_0x2ba9ef={},_0x2c7542={'count':0x0,'rows':[]};var _0x3d9e8b=_[_0x42e5('0x2b')](db['VoiceChanSpy'][_0x42e5('0x2c')],function(_0xf5a3dc){return{'name':_0xf5a3dc[_0x42e5('0x2d')],'type':_0xf5a3dc[_0x42e5('0x2e')]['key']};});_0x2ba9ef['model']=_[_0x42e5('0x2b')](_0x3d9e8b,'name');_0x2ba9ef[_0x42e5('0x2f')]=_['keys'](_0x383e97[_0x42e5('0x2f')]);_0x2ba9ef[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2ba9ef['model'],_0x2ba9ef[_0x42e5('0x2f')]);_0x5a4930[_0x42e5('0x32')]=_['intersection'](_0x2ba9ef[_0x42e5('0x33')],qs['fields'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x5a4930[_0x42e5('0x32')]=_0x5a4930[_0x42e5('0x32')][_0x42e5('0x35')]?_0x5a4930[_0x42e5('0x32')]:_0x2ba9ef[_0x42e5('0x33')];if(!_0x383e97['query']['hasOwnProperty'](_0x42e5('0x36'))){_0x5a4930[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x383e97['query']['limit']);_0x5a4930['offset']=qs['offset'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x5a4930[_0x42e5('0x37')]=qs[_0x42e5('0x38')](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x38')]);_0x5a4930[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_['pick'](_0x383e97[_0x42e5('0x2f')],_0x2ba9ef['filters']),_0x3d9e8b);if(_0x383e97[_0x42e5('0x2f')][_0x42e5('0x3a')]){_0x5a4930[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x5a4930[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x3d9e8b,function(_0xd5e7f5){if(_0xd5e7f5['type']!==_0x42e5('0x3c')){var _0x356ff6={};_0x356ff6[_0xd5e7f5['name']]={'$like':'%'+_0x383e97[_0x42e5('0x2f')]['filter']+'%'};return _0x356ff6;}})});}_0x5a4930=_['merge']({},_0x5a4930,_0x383e97['options']);var _0x1105ea={'where':_0x5a4930[_0x42e5('0x39')]};return db[_0x42e5('0x3d')][_0x42e5('0x1f')](_0x1105ea)[_0x42e5('0x24')](function(_0x77aa22){_0x2c7542[_0x42e5('0x1f')]=_0x77aa22;if(_0x383e97['query'][_0x42e5('0x3e')]){_0x5a4930[_0x42e5('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x42e5('0x40')](_0x5a4930);})[_0x42e5('0x24')](function(_0x5db771){_0x2c7542[_0x42e5('0x41')]=_0x5db771;return _0x2c7542;})[_0x42e5('0x24')](respondWithFilteredResult(_0x282cbf,_0x5a4930))[_0x42e5('0x42')](handleError(_0x282cbf,null));};exports[_0x42e5('0x43')]=function(_0x424304,_0x4d32f4){var _0x41e1fd={'raw':![],'where':{'id':_0x424304[_0x42e5('0x44')]['id']}},_0xc34e51={};_0xc34e51[_0x42e5('0x33')]=_['keys'](db[_0x42e5('0x3d')][_0x42e5('0x2c')]);_0xc34e51[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x424304[_0x42e5('0x2f')]);_0xc34e51[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0xc34e51[_0x42e5('0x33')],_0xc34e51['query']);_0x41e1fd[_0x42e5('0x32')]=_['intersection'](_0xc34e51['model'],qs[_0x42e5('0x34')](_0x424304[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x41e1fd[_0x42e5('0x32')]=_0x41e1fd[_0x42e5('0x32')][_0x42e5('0x35')]?_0x41e1fd[_0x42e5('0x32')]:_0xc34e51['model'];if(_0x424304[_0x42e5('0x2f')][_0x42e5('0x3e')]){_0x41e1fd[_0x42e5('0x3f')]=[{'all':!![]}];}_0x41e1fd=_[_0x42e5('0x3b')]({},_0x41e1fd,_0x424304[_0x42e5('0x46')]);return db[_0x42e5('0x3d')][_0x42e5('0x47')](_0x41e1fd)[_0x42e5('0x24')](handleEntityNotFound(_0x4d32f4,null))['then'](respondWithResult(_0x4d32f4,null))[_0x42e5('0x42')](handleError(_0x4d32f4,null));};exports[_0x42e5('0x48')]=function(_0x3616f4,_0x48757e){return db[_0x42e5('0x3d')][_0x42e5('0x48')](_0x3616f4[_0x42e5('0x49')],{})[_0x42e5('0x24')](function(_0x2586b0){var _0x528ddd=_0x3616f4[_0x42e5('0x4a')]['get']({'plain':!![]});if(!_0x528ddd)throw new Error(_0x42e5('0x4b'));if(_0x528ddd[_0x42e5('0x4c')]===_0x42e5('0x4a')){var _0x48b63b=_0x2586b0['get']({'plain':!![]});var _0x4f0639=_0x42e5('0x26');return db[_0x42e5('0x4d')][_0x42e5('0x47')]({'where':{'name':_0x4f0639,'userProfileId':_0x528ddd[_0x42e5('0x4e')]},'raw':!![]})['then'](function(_0x3ae9de){if(_0x3ae9de&&_0x3ae9de[_0x42e5('0x4f')]===0x0){return db[_0x42e5('0x50')]['create']({'name':_0x48b63b[_0x42e5('0x28')],'resourceId':_0x48b63b['id'],'type':_0x3ae9de['name'],'sectionId':_0x3ae9de['id']},{})[_0x42e5('0x24')](function(){return _0x2586b0;});}else{return _0x2586b0;}})[_0x42e5('0x42')](function(_0x53e29b){logger[_0x42e5('0x51')](_0x42e5('0x52'),_0x53e29b);throw _0x53e29b;});}return _0x2586b0;})[_0x42e5('0x24')](respondWithResult(_0x48757e,0xc9))[_0x42e5('0x42')](handleError(_0x48757e,null));};exports[_0x42e5('0x53')]=function(_0x3f043f,_0x41c1dc){if(_0x3f043f[_0x42e5('0x49')]['id']){delete _0x3f043f[_0x42e5('0x49')]['id'];}return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x3f043f[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x41c1dc,null))[_0x42e5('0x24')](saveUpdates(_0x3f043f[_0x42e5('0x49')],null))[_0x42e5('0x24')](respondWithResult(_0x41c1dc,null))['catch'](handleError(_0x41c1dc,null));};exports[_0x42e5('0x54')]=function(_0x2b226f,_0x40b633){return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x2b226f['params']['id']}})['then'](handleEntityNotFound(_0x40b633,null))[_0x42e5('0x24')](removeEntity(_0x40b633,null))[_0x42e5('0x42')](handleError(_0x40b633,null));}; \ No newline at end of file +var _0x0713=['fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VoiceChanSpy','rows','catch','show','params','keys','fields','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error','stack','name','index','map'];(function(_0x956671,_0x10d4b5){var _0x460fcd=function(_0x1ca84e){while(--_0x1ca84e){_0x956671['push'](_0x956671['shift']());}};_0x460fcd(++_0x10d4b5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){var _0x2793ef=_0xb05b1d[_0x3071('0x29')]({'plain':!![]});var _0x7a4cb4=_0x3071('0x2a');return db[_0x3071('0x2b')]['destroy']({'where':{'type':_0x7a4cb4,'resourceId':_0x2793ef['id']}})[_0x3071('0x27')](function(){return _0xb05b1d;});})[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb1ca,_0x28792d){return function(_0x163604){if(!_0x163604){_0x4fb1ca[_0x3071('0x2c')](0x194);}return _0x163604;};}function handleError(_0x3fa3b8,_0x25b96b){_0x25b96b=_0x25b96b||0x1f4;return function(_0x177b5f){logger[_0x3071('0x2d')](_0x177b5f[_0x3071('0x2e')]);if(_0x177b5f[_0x3071('0x2f')]){delete _0x177b5f[_0x3071('0x2f')];}_0x3fa3b8['status'](_0x25b96b)['send'](_0x177b5f);};}exports[_0x3071('0x30')]=function(_0x149e0d,_0x6ddf96){var _0x40be95={},_0x3f6d90={},_0x29538c={'count':0x0,'rows':[]};var _0x32b6b1=_[_0x3071('0x31')](db['VoiceChanSpy']['rawAttributes'],function(_0x4ab983){return{'name':_0x4ab983[_0x3071('0x32')],'type':_0x4ab983[_0x3071('0x33')]['key']};});_0x3f6d90[_0x3071('0x34')]=_[_0x3071('0x31')](_0x32b6b1,_0x3071('0x2f'));_0x3f6d90[_0x3071('0x35')]=_['keys'](_0x149e0d[_0x3071('0x35')]);_0x3f6d90[_0x3071('0x36')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],_0x3f6d90[_0x3071('0x35')]);_0x40be95[_0x3071('0x38')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],qs['fields'](_0x149e0d[_0x3071('0x35')]['fields']));_0x40be95['attributes']=_0x40be95[_0x3071('0x38')][_0x3071('0x39')]?_0x40be95['attributes']:_0x3f6d90[_0x3071('0x34')];if(!_0x149e0d[_0x3071('0x35')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x40be95[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x149e0d['query'][_0x3071('0x20')]);_0x40be95[_0x3071('0x1e')]=qs['offset'](_0x149e0d[_0x3071('0x35')]['offset']);}_0x40be95[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x149e0d['query']['sort']);_0x40be95[_0x3071('0x3e')]=qs[_0x3071('0x36')](_[_0x3071('0x3f')](_0x149e0d['query'],_0x3f6d90[_0x3071('0x36')]),_0x32b6b1);if(_0x149e0d['query'][_0x3071('0x40')]){_0x40be95['where']=_[_0x3071('0x41')](_0x40be95[_0x3071('0x3e')],{'$or':_[_0x3071('0x31')](_0x32b6b1,function(_0x3113ef){if(_0x3113ef[_0x3071('0x33')]!=='VIRTUAL'){var _0x53ed25={};_0x53ed25[_0x3113ef[_0x3071('0x2f')]]={'$like':'%'+_0x149e0d[_0x3071('0x35')][_0x3071('0x40')]+'%'};return _0x53ed25;}})});}_0x40be95=_[_0x3071('0x41')]({},_0x40be95,_0x149e0d['options']);var _0x3cfc05={'where':_0x40be95[_0x3071('0x3e')]};return db[_0x3071('0x42')][_0x3071('0x21')](_0x3cfc05)[_0x3071('0x27')](function(_0xb9a4b8){_0x29538c['count']=_0xb9a4b8;if(_0x149e0d[_0x3071('0x35')]['includeAll']){_0x40be95['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x40be95);})[_0x3071('0x27')](function(_0x1be8b6){_0x29538c[_0x3071('0x43')]=_0x1be8b6;return _0x29538c;})[_0x3071('0x27')](respondWithFilteredResult(_0x6ddf96,_0x40be95))[_0x3071('0x44')](handleError(_0x6ddf96,null));};exports[_0x3071('0x45')]=function(_0xa711b5,_0x2e6c70){var _0x56589e={'raw':![],'where':{'id':_0xa711b5[_0x3071('0x46')]['id']}},_0x1e8222={};_0x1e8222[_0x3071('0x34')]=_[_0x3071('0x47')](db[_0x3071('0x42')]['rawAttributes']);_0x1e8222['query']=_[_0x3071('0x47')](_0xa711b5[_0x3071('0x35')]);_0x1e8222[_0x3071('0x36')]=_[_0x3071('0x37')](_0x1e8222[_0x3071('0x34')],_0x1e8222['query']);_0x56589e[_0x3071('0x38')]=_['intersection'](_0x1e8222[_0x3071('0x34')],qs['fields'](_0xa711b5['query'][_0x3071('0x48')]));_0x56589e['attributes']=_0x56589e[_0x3071('0x38')]['length']?_0x56589e[_0x3071('0x38')]:_0x1e8222[_0x3071('0x34')];if(_0xa711b5[_0x3071('0x35')][_0x3071('0x49')]){_0x56589e['include']=[{'all':!![]}];}_0x56589e=_[_0x3071('0x41')]({},_0x56589e,_0xa711b5['options']);return db[_0x3071('0x42')]['find'](_0x56589e)[_0x3071('0x27')](handleEntityNotFound(_0x2e6c70,null))[_0x3071('0x27')](respondWithResult(_0x2e6c70,null))['catch'](handleError(_0x2e6c70,null));};exports[_0x3071('0x4a')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x42')][_0x3071('0x4a')](_0x117e73[_0x3071('0x4b')],{})[_0x3071('0x27')](function(_0x577060){var _0x2c6e4c=_0x117e73[_0x3071('0x4c')][_0x3071('0x29')]({'plain':!![]});if(!_0x2c6e4c)throw new Error(_0x3071('0x4d'));if(_0x2c6e4c['role']===_0x3071('0x4c')){var _0x2aea37=_0x577060[_0x3071('0x29')]({'plain':!![]});var _0x2307dd=_0x3071('0x2a');return db[_0x3071('0x4e')][_0x3071('0x4f')]({'where':{'name':_0x2307dd,'userProfileId':_0x2c6e4c[_0x3071('0x50')]},'raw':!![]})[_0x3071('0x27')](function(_0x886f7){if(_0x886f7&&_0x886f7[_0x3071('0x51')]===0x0){return db[_0x3071('0x2b')][_0x3071('0x4a')]({'name':_0x2aea37[_0x3071('0x2f')],'resourceId':_0x2aea37['id'],'type':_0x886f7[_0x3071('0x2f')],'sectionId':_0x886f7['id']},{})[_0x3071('0x27')](function(){return _0x577060;});}else{return _0x577060;}})['catch'](function(_0x47a438){logger[_0x3071('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a438);throw _0x47a438;});}return _0x577060;})[_0x3071('0x27')](respondWithResult(_0x224a70,0xc9))[_0x3071('0x44')](handleError(_0x224a70,null));};exports[_0x3071('0x26')]=function(_0x514821,_0x1ec428){if(_0x514821[_0x3071('0x4b')]['id']){delete _0x514821['body']['id'];}return db['VoiceChanSpy'][_0x3071('0x4f')]({'where':{'id':_0x514821[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1ec428,null))[_0x3071('0x27')](saveUpdates(_0x514821['body'],null))[_0x3071('0x27')](respondWithResult(_0x1ec428,null))[_0x3071('0x44')](handleError(_0x1ec428,null));};exports[_0x3071('0x28')]=function(_0x41f02a,_0x123323){return db['VoiceChanSpy'][_0x3071('0x4f')]({'where':{'id':_0x41f02a[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x123323,null))[_0x3071('0x27')](removeEntity(_0x123323,null))[_0x3071('0x44')](handleError(_0x123323,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d948020..724f5de 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 _0x82d7=['then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','User','findAll','internal','agent'];(function(_0x3b0345,_0x2326ca){var _0x3dd452=function(_0x5e84ac){while(--_0x5e84ac){_0x3b0345['push'](_0x3b0345['shift']());}};_0x3dd452(++_0x2326ca);}(_0x82d7,0xd2));var _0x782d=function(_0x12c8f7,_0x38edf6){_0x12c8f7=_0x12c8f7-0x0;var _0x43c77a=_0x82d7[_0x12c8f7];return _0x43c77a;};'use strict';var _=require(_0x782d('0x0'));var util=require(_0x782d('0x1'));var BPromise=require(_0x782d('0x2'));var attributes=require(_0x782d('0x3'));var getUserApplications=function(_0x536b12,_0x22fa8d,_0x44cb0c){var _0x2dfff5=0x1;var _0x1f285b=[];var _0xb22e84={'context':_0x22fa8d[_0x782d('0x4')]||_0x782d('0x5'),'exten':util[_0x782d('0x6')](_0x782d('0x7'),_0x536b12['prefix'],_0x44cb0c),'type':'system','isApp':![],'ChanSpyId':_0x536b12['id'],'UserId':_0x22fa8d['id']};_0x1f285b['push'](_['merge']({'app':'Set','appdata':util['format'](_0x782d('0x8'),_0x782d('0x9')),'priority':_0x2dfff5++},_0xb22e84));if(_0x536b12[_0x782d('0xa')]){_0x1f285b[_0x782d('0xb')](_[_0x782d('0xc')]({'app':_0x782d('0xd'),'appdata':util[_0x782d('0x6')]('${UNIQUEID}.%s,a',_0x536b12[_0x782d('0xe')]),'priority':_0x2dfff5++},_0xb22e84));}if(_0x536b12[_0x782d('0xf')]){_0x1f285b[_0x782d('0xb')](_[_0x782d('0xc')]({'app':_0x782d('0x10'),'appdata':_0x536b12[_0x782d('0x11')],'priority':_0x2dfff5++},_0xb22e84));}_0x1f285b[_0x782d('0xb')](_[_0x782d('0xc')]({'app':_0x782d('0x12'),'appdata':util['format'](_0x782d('0x13'),_0x22fa8d[_0x782d('0x14')],_0x536b12[_0x782d('0x15')]?_0x536b12[_0x782d('0x15')][_0x782d('0x16')](''):''),'priority':_0x2dfff5++},_0xb22e84));if(_0x536b12[_0x782d('0xa')]){_0x1f285b['push'](_['merge']({'app':_0x782d('0x17'),'priority':_0x2dfff5++},_0xb22e84));}return _0x1f285b;};var getChanSpyApplications=function(_0x51136f,_0x1dfb13){var _0x58fd3c=[];for(var _0xef1c97=0x0,_0x109b4b=0x1;_0xef1c97<_0x1dfb13[_0x782d('0x18')];_0xef1c97++,_0x109b4b=0x1){_0x58fd3c=_0x58fd3c[_0x782d('0x19')](getUserApplications(_0x51136f,_0x1dfb13[_0xef1c97],_0x1dfb13[_0xef1c97]['internal']));if(_0x1dfb13[_0xef1c97]['internal']!=_0x1dfb13[_0xef1c97][_0x782d('0x14')]){_0x58fd3c=_0x58fd3c[_0x782d('0x19')](getUserApplications(_0x51136f,_0x1dfb13[_0xef1c97],_0x1dfb13[_0xef1c97][_0x782d('0x14')]));}}return _0x58fd3c;};var getChanSpyPromise=function(_0x1be6dc,_0x204e49){return new BPromise(function(_0x4fb845,_0x2b60d7){return _0x1be6dc[_0x782d('0x1a')][_0x782d('0x1b')]({'attributes':['id',_0x782d('0x14'),_0x782d('0x1c')],'where':{'role':_0x782d('0x1d'),'chanspy':!![]},'raw':!![]})[_0x782d('0x1e')](function(_0x511ecf){if(_0x511ecf){return _0x4fb845(getChanSpyApplications(_0x204e49,_0x511ecf));}return _0x4fb845([]);})[_0x782d('0x1f')](function(_0x5e19b6){_0x2b60d7(_0x5e19b6);});});};module[_0x782d('0x20')]=function(_0x501196,_0x8e7c96){var _0x4e0af6=_0x501196[_0x782d('0x21')];return _0x501196[_0x782d('0x22')](_0x782d('0x23'),attributes,{'tableName':_0x782d('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d448e,_0x5f3410,_0x32da9b){return getChanSpyPromise(_0x4e0af6,_0x3d448e)[_0x782d('0x1e')](function(_0x5dbe91){if(_0x5dbe91&&_0x5dbe91[_0x782d('0x18')]){return _0x4e0af6[_0x782d('0x25')][_0x782d('0x26')](_0x5dbe91);}})[_0x782d('0x1e')](function(){_0x32da9b();})[_0x782d('0x1f')](function(_0x645a87){_0x32da9b(_0x645a87);});},'afterUpdate':function(_0x1f97c7,_0x54dcd8,_0x3f29fe){return _0x4e0af6[_0x782d('0x25')][_0x782d('0x27')]({'where':{'ChanSpyId':_0x1f97c7['id']}})[_0x782d('0x1e')](function(){return getChanSpyPromise(_0x4e0af6,_0x1f97c7);})[_0x782d('0x1e')](function(_0x597310){if(_0x597310&&_0x597310[_0x782d('0x18')]){return _0x4e0af6[_0x782d('0x25')][_0x782d('0x26')](_0x597310);}})[_0x782d('0x1e')](function(){_0x3f29fe();})[_0x782d('0x1f')](function(_0x17305b){_0x3f29fe(_0x17305b);});},'afterDestroy':function(_0x484500,_0x1984cf,_0x1a7013){return _0x4e0af6[_0x782d('0x25')]['destroy']({'where':{'ChanSpyId':_0x484500['id']}})['then'](function(){_0x1a7013();})[_0x782d('0x1f')](function(_0x1b14a7){_0x1a7013(_0x1b14a7);});}}});}; \ No newline at end of file +var _0x04c5=['auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x25eebd,_0x258e68){var _0x52790b=function(_0x45db39){while(--_0x45db39){_0x25eebd['push'](_0x25eebd['shift']());}};_0x52790b(++_0x258e68);}(_0x04c5,0x102));var _0x504c=function(_0x405ebd,_0x5d56c6){_0x405ebd=_0x405ebd-0x0;var _0x1aada5=_0x04c5[_0x405ebd];return _0x1aada5;};'use strict';var _=require(_0x504c('0x0'));var util=require(_0x504c('0x1'));var BPromise=require('bluebird');var attributes=require(_0x504c('0x2'));var getUserApplications=function(_0x20639b,_0x5aeb80,_0x3d5449){var _0x4ea1cf=0x1;var _0x20b025=[];var _0x1fc09e={'context':_0x5aeb80['context']||'from-sip','exten':util[_0x504c('0x3')](_0x504c('0x4'),_0x20639b[_0x504c('0x5')],_0x3d5449),'type':_0x504c('0x6'),'isApp':![],'ChanSpyId':_0x20639b['id'],'UserId':_0x5aeb80['id']};_0x20b025[_0x504c('0x7')](_['merge']({'app':'Set','appdata':util['format'](_0x504c('0x8'),_0x504c('0x9')),'priority':_0x4ea1cf++},_0x1fc09e));if(_0x20639b[_0x504c('0xa')]){_0x20b025[_0x504c('0x7')](_[_0x504c('0xb')]({'app':_0x504c('0xc'),'appdata':util['format'](_0x504c('0xd'),_0x20639b[_0x504c('0xe')]),'priority':_0x4ea1cf++},_0x1fc09e));}if(_0x20639b[_0x504c('0xf')]){_0x20b025['push'](_[_0x504c('0xb')]({'app':_0x504c('0x10'),'appdata':_0x20639b[_0x504c('0x11')],'priority':_0x4ea1cf++},_0x1fc09e));}_0x20b025[_0x504c('0x7')](_['merge']({'app':'ChanSpy','appdata':util[_0x504c('0x3')](_0x504c('0x12'),_0x5aeb80[_0x504c('0x13')],_0x20639b[_0x504c('0x14')]?_0x20639b[_0x504c('0x14')][_0x504c('0x15')](''):''),'priority':_0x4ea1cf++},_0x1fc09e));if(_0x20639b[_0x504c('0xa')]){_0x20b025['push'](_[_0x504c('0xb')]({'app':_0x504c('0x16'),'priority':_0x4ea1cf++},_0x1fc09e));}return _0x20b025;};var getChanSpyApplications=function(_0x5e49d8,_0x12aab2){var _0x73e0b1=[];for(var _0x430a49=0x0,_0x5941d1=0x1;_0x430a49<_0x12aab2[_0x504c('0x17')];_0x430a49++,_0x5941d1=0x1){_0x73e0b1=_0x73e0b1[_0x504c('0x18')](getUserApplications(_0x5e49d8,_0x12aab2[_0x430a49],_0x12aab2[_0x430a49][_0x504c('0x19')]));if(_0x12aab2[_0x430a49]['internal']!=_0x12aab2[_0x430a49]['name']){_0x73e0b1=_0x73e0b1['concat'](getUserApplications(_0x5e49d8,_0x12aab2[_0x430a49],_0x12aab2[_0x430a49][_0x504c('0x13')]));}}return _0x73e0b1;};var getChanSpyPromise=function(_0x390915,_0x597c1f){return new BPromise(function(_0x42ca96,_0x242c36){return _0x390915[_0x504c('0x1a')][_0x504c('0x1b')]({'attributes':['id',_0x504c('0x13'),_0x504c('0x19')],'where':{'role':_0x504c('0x1c'),'chanspy':!![]},'raw':!![]})[_0x504c('0x1d')](function(_0x323ab1){if(_0x323ab1){return _0x42ca96(getChanSpyApplications(_0x597c1f,_0x323ab1));}return _0x42ca96([]);})[_0x504c('0x1e')](function(_0x47515){_0x242c36(_0x47515);});});};module[_0x504c('0x1f')]=function(_0x2a59be,_0x1e814a){var _0x5b3f51=_0x2a59be[_0x504c('0x20')];return _0x2a59be[_0x504c('0x21')](_0x504c('0x22'),attributes,{'tableName':_0x504c('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x184ba3,_0x24586f,_0x3198b6){return getChanSpyPromise(_0x5b3f51,_0x184ba3)['then'](function(_0x1de49f){if(_0x1de49f&&_0x1de49f['length']){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x25')](_0x1de49f);}})['then'](function(){_0x3198b6();})[_0x504c('0x1e')](function(_0x47514a){_0x3198b6(_0x47514a);});},'afterUpdate':function(_0xa7f691,_0x58e70b,_0x4bdb28){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x26')]({'where':{'ChanSpyId':_0xa7f691['id']}})[_0x504c('0x1d')](function(){return getChanSpyPromise(_0x5b3f51,_0xa7f691);})[_0x504c('0x1d')](function(_0x31fac8){if(_0x31fac8&&_0x31fac8['length']){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x25')](_0x31fac8);}})['then'](function(){_0x4bdb28();})[_0x504c('0x1e')](function(_0x5dfad4){_0x4bdb28(_0x5dfad4);});},'afterDestroy':function(_0x7dac33,_0x52e4cf,_0x3986ae){return _0x5b3f51[_0x504c('0x24')][_0x504c('0x26')]({'where':{'ChanSpyId':_0x7dac33['id']}})[_0x504c('0x1d')](function(){_0x3986ae();})[_0x504c('0x1e')](function(_0xd85e8d){_0x3986ae(_0xd85e8d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6682504..3d0892b 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 _0x1752=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird'];(function(_0x5a4f61,_0x1306a1){var _0x2b444e=function(_0x5f05dd){while(--_0x5f05dd){_0x5a4f61['push'](_0x5a4f61['shift']());}};_0x2b444e(++_0x1306a1);}(_0x1752,0xa5));var _0x2175=function(_0x52ece4,_0x42b575){_0x52ece4=_0x52ece4-0x0;var _0x371c2a=_0x1752[_0x52ece4];return _0x371c2a;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ca87,_0x1bd937,_0x339e4d){return new BPromise(function(_0x672ff1,_0x516ccc){return client[_0x2175('0xc')](_0x19ca87,_0x339e4d)[_0x2175('0xd')](function(_0x407a71){logger[_0x2175('0xe')](_0x2175('0xf'),_0x1bd937,'request\x20sent');logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1bd937,_0x2175('0x10'),JSON['stringify'](_0x407a71));if(_0x407a71['error']){if(_0x407a71['error']['code']===0x1f4){logger[_0x2175('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x516ccc(_0x407a71['error'][_0x2175('0x12')]);}logger[_0x2175('0x11')](_0x2175('0xf'),_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x672ff1(_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);}else{logger[_0x2175('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1bd937,'request\x20sent');_0x672ff1(_0x407a71[_0x2175('0x13')][_0x2175('0x12')]);}})[_0x2175('0x14')](function(_0x4e7cf1){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x1bd937,_0x4e7cf1);_0x516ccc(_0x4e7cf1);});});} \ No newline at end of file +var _0x91a7=['message','VoiceChanSpy,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x40ebdb,_0x342055){var _0x1b6544=function(_0x408e46){while(--_0x408e46){_0x40ebdb['push'](_0x40ebdb['shift']());}};_0x1b6544(++_0x342055);}(_0x91a7,0xe7));var _0x791a=function(_0x19794a,_0x44b935){_0x19794a=_0x19794a-0x0;var _0x5a3210=_0x91a7[_0x19794a];return _0x5a3210;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var BPromise=require(_0x791a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x791a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x791a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x791a('0x5'));var jayson=require(_0x791a('0x6'));var client=jayson['client'][_0x791a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5db6db,_0x33baac,_0x159e24){return new BPromise(function(_0x5aa10a,_0x1a32b4){return client[_0x791a('0x8')](_0x5db6db,_0x159e24)[_0x791a('0x9')](function(_0x80ff65){logger[_0x791a('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'),JSON[_0x791a('0xd')](_0x80ff65));if(_0x80ff65[_0x791a('0xe')]){if(_0x80ff65[_0x791a('0xe')][_0x791a('0xf')]===0x1f4){logger[_0x791a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x1a32b4(_0x80ff65[_0x791a('0xe')]['message']);}logger[_0x791a('0xe')](_0x791a('0x11'),_0x33baac,_0x80ff65['error'][_0x791a('0x10')]);return _0x5aa10a(_0x80ff65[_0x791a('0xe')][_0x791a('0x10')]);}else{logger[_0x791a('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 1a21b05..f258e72 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 _0xafce=['../../components/interaction/service','../../config/environment','./voiceContext.controller','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c665b,_0x31c162){var _0x560cc4=function(_0x5c395f){while(--_0x5c395f){_0x5c665b['push'](_0x5c665b['shift']());}};_0x560cc4(++_0x31c162);}(_0xafce,0x116));var _0xeafc=function(_0x5db2e9,_0x421aaa){_0x5db2e9=_0x5db2e9-0x0;var _0x69a52f=_0xafce[_0x5db2e9];return _0x69a52f;};'use strict';var multer=require(_0xeafc('0x0'));var util=require(_0xeafc('0x1'));var path=require(_0xeafc('0x2'));var timeout=require(_0xeafc('0x3'));var express=require(_0xeafc('0x4'));var router=express[_0xeafc('0x5')]();var fs_extra=require(_0xeafc('0x6'));var auth=require(_0xeafc('0x7'));var interaction=require(_0xeafc('0x8'));var config=require(_0xeafc('0x9'));var controller=require(_0xeafc('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xeafc('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xeafc('0xc')]);router[_0xeafc('0xd')]('/',auth[_0xeafc('0xe')](),controller[_0xeafc('0xf')]);router[_0xeafc('0x10')](_0xeafc('0x11'),auth[_0xeafc('0xe')](),controller[_0xeafc('0x12')]);router[_0xeafc('0x13')](_0xeafc('0x11'),auth['isAuthenticated'](),controller[_0xeafc('0x14')]);module[_0xeafc('0x15')]=router; \ No newline at end of file +var _0xa3d1=['path','connect-timeout','express','Router','fs-extra','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','util'];(function(_0x4767bf,_0x97cf46){var _0x5e9c95=function(_0x23f670){while(--_0x23f670){_0x4767bf['push'](_0x4767bf['shift']());}};_0x5e9c95(++_0x97cf46);}(_0xa3d1,0x164));var _0x1a3d=function(_0x50c53c,_0x297688){_0x50c53c=_0x50c53c-0x0;var _0x836d51=_0xa3d1[_0x50c53c];return _0x836d51;};'use strict';var multer=require('multer');var util=require(_0x1a3d('0x0'));var path=require(_0x1a3d('0x1'));var timeout=require(_0x1a3d('0x2'));var express=require(_0x1a3d('0x3'));var router=express[_0x1a3d('0x4')]();var fs_extra=require(_0x1a3d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a3d('0x6'));router[_0x1a3d('0x7')]('/',auth[_0x1a3d('0x8')](),controller[_0x1a3d('0x9')]);router[_0x1a3d('0x7')](_0x1a3d('0xa'),auth['isAuthenticated'](),controller[_0x1a3d('0xb')]);router[_0x1a3d('0xc')]('/',auth[_0x1a3d('0x8')](),controller['create']);router[_0x1a3d('0xd')](_0x1a3d('0xa'),auth[_0x1a3d('0x8')](),controller[_0x1a3d('0xe')]);router[_0x1a3d('0xf')](_0x1a3d('0xa'),auth['isAuthenticated'](),controller[_0x1a3d('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index d764636..6158781 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 _0xac3b=['sequelize','exports','STRING','name'];(function(_0x2e9989,_0x1ec8f5){var _0x2a8e33=function(_0x3c1fbe){while(--_0x3c1fbe){_0x2e9989['push'](_0x2e9989['shift']());}};_0x2a8e33(++_0x1ec8f5);}(_0xac3b,0x70));var _0xbac3=function(_0x581bc7,_0x2ce3c5){_0x581bc7=_0x581bc7-0x0;var _0x2d951d=_0xac3b[_0x581bc7];return _0x2d951d;};'use strict';var Sequelize=require(_0xbac3('0x0'));module[_0xbac3('0x1')]={'name':{'type':Sequelize[_0xbac3('0x2')],'unique':_0xbac3('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bbe=['exports','STRING','name','sequelize'];(function(_0x15ca55,_0x541d1a){var _0xaeabff=function(_0x1b0032){while(--_0x1b0032){_0x15ca55['push'](_0x15ca55['shift']());}};_0xaeabff(++_0x541d1a);}(_0x4bbe,0x18f));var _0xe4bb=function(_0x320e93,_0x1381a0){_0x320e93=_0x320e93-0x0;var _0x120f9c=_0x4bbe[_0x320e93];return _0x120f9c;};'use strict';var Sequelize=require(_0xe4bb('0x0'));module[_0xe4bb('0x1')]={'name':{'type':Sequelize[_0xe4bb('0x2')],'unique':_0xe4bb('0x3')},'description':{'type':Sequelize[_0xe4bb('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 1749018..e77b748 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 _0x1589=['get','UserProfileResource','destroy','sendStatus','stack','name','index','VoiceContext','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','params','includeAll','find','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save'];(function(_0x1ac1e1,_0x36a4c1){var _0x35bb79=function(_0x3f2667){while(--_0x3f2667){_0x1ac1e1['push'](_0x1ac1e1['shift']());}};_0x35bb79(++_0x36a4c1);}(_0x1589,0x175));var _0x9158=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x1589[_0x154983];return _0x3d1243;};'use strict';var emlformat=require(_0x9158('0x0'));var rimraf=require(_0x9158('0x1'));var zipdir=require(_0x9158('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9158('0x3'));var moment=require('moment');var BPromise=require(_0x9158('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9158('0x5'));var csv=require(_0x9158('0x6'));var ejs=require(_0x9158('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9158('0x8'));var squel=require('squel');var crypto=require(_0x9158('0x9'));var jsforce=require(_0x9158('0xa'));var deskjs=require(_0x9158('0xb'));var toCsv=require(_0x9158('0x6'));var querystring=require(_0x9158('0xc'));var Papa=require(_0x9158('0xd'));var Redis=require(_0x9158('0xe'));var authService=require(_0x9158('0xf'));var qs=require(_0x9158('0x10'));var as=require(_0x9158('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9158('0x12'))('api');var utils=require(_0x9158('0x13'));var config=require(_0x9158('0x14'));var licenseUtil=require(_0x9158('0x15'));var db=require(_0x9158('0x16'))['db'];var jayson=require(_0x9158('0x17'));var client=jayson[_0x9158('0x18')][_0x9158('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x10e6d1,_0x59117c,_0x321e9a,_0x1a54a7){return new BPromise(function(_0x410aa7,_0x45d52d){var _0x161710=_0x1a54a7||client;return _0x161710[_0x9158('0x1a')](_0x10e6d1,_0x321e9a)[_0x9158('0x1b')](function(_0xf5379c){logger[_0x9158('0x1c')](_0x9158('0x1d'),_0x59117c,'request\x20sent');logger[_0x9158('0x1e')](_0x9158('0x1f'),_0x59117c,_0x9158('0x20'),JSON[_0x9158('0x21')](_0xf5379c));if(_0xf5379c[_0x9158('0x22')]){if(_0xf5379c['error'][_0x9158('0x23')]===0x1f4){logger[_0x9158('0x22')](_0x9158('0x1d'),_0x59117c,_0xf5379c[_0x9158('0x22')]['message']);return _0x45d52d(_0xf5379c[_0x9158('0x22')]['message']);}logger[_0x9158('0x22')](_0x9158('0x1d'),_0x59117c,_0xf5379c[_0x9158('0x22')][_0x9158('0x24')]);return _0x410aa7(_0xf5379c[_0x9158('0x22')][_0x9158('0x24')]);}else{logger[_0x9158('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x59117c,_0x9158('0x20'));_0x410aa7(_0xf5379c[_0x9158('0x25')]['message']);}})[_0x9158('0x26')](function(_0x4ba213){logger[_0x9158('0x22')](_0x9158('0x1d'),_0x59117c,_0x4ba213);_0x45d52d(_0x4ba213);});});}function respondWithStatusCode(_0x5484e5,_0xe3b967){_0xe3b967=_0xe3b967||0xcc;return function(_0x5aa15f){if(_0x5aa15f){return _0x5484e5['sendStatus'](_0xe3b967);}return _0x5484e5[_0x9158('0x27')](_0xe3b967)[_0x9158('0x28')]();};}function respondWithResult(_0x41f4c5,_0x917fb3){_0x917fb3=_0x917fb3||0xc8;return function(_0x196171){if(_0x196171){return _0x41f4c5[_0x9158('0x27')](_0x917fb3)['json'](_0x196171);}};}function respondWithFilteredResult(_0x1ac177,_0x2cc62b){return function(_0x3199c4){if(_0x3199c4){var _0x19c3e6=typeof _0x2cc62b['offset']===_0x9158('0x29')&&typeof _0x2cc62b[_0x9158('0x2a')]===_0x9158('0x29');var _0xe37f28=_0x3199c4[_0x9158('0x2b')];var _0x33623f=_0x19c3e6?0x0:_0x2cc62b[_0x9158('0x2c')];var _0x30ce3f=_0x19c3e6?_0x3199c4[_0x9158('0x2b')]:_0x2cc62b[_0x9158('0x2c')]+_0x2cc62b[_0x9158('0x2a')];var _0x5df4fc;if(_0x30ce3f>=_0xe37f28){_0x30ce3f=_0xe37f28;_0x5df4fc=0xc8;}else{_0x5df4fc=0xce;}_0x1ac177[_0x9158('0x27')](_0x5df4fc);return _0x1ac177[_0x9158('0x2d')](_0x9158('0x2e'),_0x33623f+'-'+_0x30ce3f+'/'+_0xe37f28)[_0x9158('0x2f')](_0x3199c4);}return null;};}function patchUpdates(_0x5cc2aa){return function(_0x512266){try{jsonpatch[_0x9158('0x30')](_0x512266,_0x5cc2aa,!![]);}catch(_0x4dbbb0){return BPromise[_0x9158('0x31')](_0x4dbbb0);}return _0x512266[_0x9158('0x32')]();};}function saveUpdates(_0x7bd4ca,_0x2448ef){return function(_0x1b5d41){if(_0x1b5d41){return _0x1b5d41['update'](_0x7bd4ca)[_0x9158('0x1b')](function(_0x1a43cc){return _0x1a43cc;});}return null;};}function removeEntity(_0xd99b52,_0xb41a91){return function(_0x3eec61){if(_0x3eec61){return _0x3eec61['destroy']()[_0x9158('0x1b')](function(){var _0x2bc3e9=_0x3eec61[_0x9158('0x33')]({'plain':!![]});var _0x139c6c='Contexts';return db[_0x9158('0x34')][_0x9158('0x35')]({'where':{'type':_0x139c6c,'resourceId':_0x2bc3e9['id']}})[_0x9158('0x1b')](function(){return _0x3eec61;});})['then'](function(){_0xd99b52['status'](0xcc)[_0x9158('0x28')]();});}};}function handleEntityNotFound(_0x88537b,_0x512206){return function(_0x36f25a){if(!_0x36f25a){_0x88537b[_0x9158('0x36')](0x194);}return _0x36f25a;};}function handleError(_0x1c73de,_0xc53876){_0xc53876=_0xc53876||0x1f4;return function(_0x2a0759){logger[_0x9158('0x22')](_0x2a0759[_0x9158('0x37')]);if(_0x2a0759[_0x9158('0x38')]){delete _0x2a0759[_0x9158('0x38')];}_0x1c73de[_0x9158('0x27')](_0xc53876)['send'](_0x2a0759);};}exports[_0x9158('0x39')]=function(_0x1d713f,_0x4e1e51){var _0xd9cdc0={},_0x372349={},_0x4d2269={'count':0x0,'rows':[]};var _0x4076fc=_['map'](db[_0x9158('0x3a')][_0x9158('0x3b')],function(_0x579e32){return{'name':_0x579e32['fieldName'],'type':_0x579e32[_0x9158('0x3c')][_0x9158('0x3d')]};});_0x372349[_0x9158('0x3e')]=_[_0x9158('0x3f')](_0x4076fc,_0x9158('0x38'));_0x372349[_0x9158('0x40')]=_[_0x9158('0x41')](_0x1d713f[_0x9158('0x40')]);_0x372349[_0x9158('0x42')]=_[_0x9158('0x43')](_0x372349[_0x9158('0x3e')],_0x372349[_0x9158('0x40')]);_0xd9cdc0[_0x9158('0x44')]=_[_0x9158('0x43')](_0x372349[_0x9158('0x3e')],qs[_0x9158('0x45')](_0x1d713f[_0x9158('0x40')]['fields']));_0xd9cdc0[_0x9158('0x44')]=_0xd9cdc0['attributes'][_0x9158('0x46')]?_0xd9cdc0['attributes']:_0x372349[_0x9158('0x3e')];if(!_0x1d713f[_0x9158('0x40')][_0x9158('0x47')](_0x9158('0x48'))){_0xd9cdc0[_0x9158('0x2a')]=qs[_0x9158('0x2a')](_0x1d713f['query'][_0x9158('0x2a')]);_0xd9cdc0[_0x9158('0x2c')]=qs[_0x9158('0x2c')](_0x1d713f[_0x9158('0x40')]['offset']);}_0xd9cdc0[_0x9158('0x49')]=qs[_0x9158('0x4a')](_0x1d713f['query'][_0x9158('0x4a')]);_0xd9cdc0['where']=qs[_0x9158('0x42')](_[_0x9158('0x4b')](_0x1d713f['query'],_0x372349[_0x9158('0x42')]),_0x4076fc);if(_0x1d713f[_0x9158('0x40')][_0x9158('0x4c')]){_0xd9cdc0['where']=_[_0x9158('0x4d')](_0xd9cdc0[_0x9158('0x4e')],{'$or':_[_0x9158('0x3f')](_0x4076fc,function(_0x85f956){if(_0x85f956['type']!==_0x9158('0x4f')){var _0x10273a={};_0x10273a[_0x85f956[_0x9158('0x38')]]={'$like':'%'+_0x1d713f['query'][_0x9158('0x4c')]+'%'};return _0x10273a;}})});}_0xd9cdc0=_[_0x9158('0x4d')]({},_0xd9cdc0,_0x1d713f[_0x9158('0x50')]);var _0x151891={'where':_0xd9cdc0[_0x9158('0x4e')]};return db[_0x9158('0x3a')]['count'](_0x151891)[_0x9158('0x1b')](function(_0x715074){_0x4d2269[_0x9158('0x2b')]=_0x715074;if(_0x1d713f['query']['includeAll']){_0xd9cdc0[_0x9158('0x51')]=[{'all':!![]}];}return db[_0x9158('0x3a')][_0x9158('0x52')](_0xd9cdc0);})[_0x9158('0x1b')](function(_0xef9094){_0x4d2269[_0x9158('0x53')]=_0xef9094;return _0x4d2269;})[_0x9158('0x1b')](respondWithFilteredResult(_0x4e1e51,_0xd9cdc0))[_0x9158('0x26')](handleError(_0x4e1e51,null));};exports['show']=function(_0x58bd68,_0x400b0d){var _0x4cee00={'raw':![],'where':{'id':_0x58bd68[_0x9158('0x54')]['id']}},_0x4c220f={};_0x4c220f[_0x9158('0x3e')]=_[_0x9158('0x41')](db[_0x9158('0x3a')][_0x9158('0x3b')]);_0x4c220f['query']=_[_0x9158('0x41')](_0x58bd68[_0x9158('0x40')]);_0x4c220f[_0x9158('0x42')]=_[_0x9158('0x43')](_0x4c220f[_0x9158('0x3e')],_0x4c220f[_0x9158('0x40')]);_0x4cee00[_0x9158('0x44')]=_[_0x9158('0x43')](_0x4c220f['model'],qs[_0x9158('0x45')](_0x58bd68['query']['fields']));_0x4cee00[_0x9158('0x44')]=_0x4cee00[_0x9158('0x44')]['length']?_0x4cee00[_0x9158('0x44')]:_0x4c220f[_0x9158('0x3e')];if(_0x58bd68[_0x9158('0x40')][_0x9158('0x55')]){_0x4cee00['include']=[{'all':!![]}];}_0x4cee00=_['merge']({},_0x4cee00,_0x58bd68[_0x9158('0x50')]);return db[_0x9158('0x3a')][_0x9158('0x56')](_0x4cee00)[_0x9158('0x1b')](handleEntityNotFound(_0x400b0d,null))[_0x9158('0x1b')](respondWithResult(_0x400b0d,null))[_0x9158('0x26')](handleError(_0x400b0d,null));};exports['create']=function(_0x514c49,_0x424026,_0x203a7e){var _0x70253;return db[_0x9158('0x3a')]['create'](_0x514c49['body'],{'raw':!![]})[_0x9158('0x1b')](function(_0x4dc884){_0x70253=_0x4dc884;return db['VoiceContext'][_0x9158('0x52')]({'raw':!![]});})[_0x9158('0x1b')](function(_0x4c73a2){var _0x1c6fd0=fs[_0x9158('0x57')](path[_0x9158('0x58')](config[_0x9158('0x59')],_0x9158('0x5a')),_0x9158('0x5b'));var _0x4cbf19=ejs[_0x9158('0x5c')](_0x1c6fd0,{'contexts':_0x4c73a2||[]});fs[_0x9158('0x5d')](_0x9158('0x5e'),_0x4cbf19);})[_0x9158('0x1b')](function(){return respondWithRpcPromise(_0x9158('0x5f'),_0x9158('0x60'),{'module':_0x9158('0x61')});})[_0x9158('0x1b')](function(){var _0x220890=_0x514c49[_0x9158('0x62')]['get']({'plain':!![]});if(!_0x220890)throw new Error(_0x9158('0x63'));if(_0x220890[_0x9158('0x64')]===_0x9158('0x62')){var _0x3f37d6=_0x70253[_0x9158('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x9158('0x56')]({'where':{'name':_0x9158('0x65'),'userProfileId':_0x220890[_0x9158('0x66')]},'raw':!![]})[_0x9158('0x1b')](function(_0x4a2671){if(_0x4a2671&&_0x4a2671[_0x9158('0x67')]===0x0){return db[_0x9158('0x34')]['create']({'name':_0x3f37d6['name'],'resourceId':_0x3f37d6['id'],'type':_0x4a2671[_0x9158('0x38')],'sectionId':_0x4a2671['id']},{})[_0x9158('0x1b')](function(){return _0x70253;});}else{return _0x70253;}})[_0x9158('0x26')](function(_0x4a1c31){logger[_0x9158('0x22')](_0x9158('0x68'),_0x4a1c31);throw _0x4a1c31;});}return _0x70253;})[_0x9158('0x1b')](respondWithResult(_0x424026,0xc9))[_0x9158('0x26')](handleError(_0x424026,null));};exports[_0x9158('0x69')]=function(_0x2e4004,_0x1b8fae,_0x595e1a){var _0x1468a7;return db['VoiceContext'][_0x9158('0x56')]({'where':{'id':_0x2e4004[_0x9158('0x54')]['id']}})[_0x9158('0x1b')](handleEntityNotFound(_0x1b8fae,null))[_0x9158('0x1b')](saveUpdates(_0x2e4004['body'],null))['then'](function(_0x40fb77){if(_0x40fb77){_0x1468a7=_0x40fb77;return db[_0x9158('0x3a')][_0x9158('0x52')]({'raw':!![]});}})['then'](function(_0x2c0dbe){var _0x30cbc4=fs['readFileSync'](path[_0x9158('0x58')](config[_0x9158('0x59')],'server/files/templates/context.ejs'),_0x9158('0x5b'));var _0x2d5185=ejs[_0x9158('0x5c')](_0x30cbc4,{'contexts':_0x2c0dbe||[]});fs[_0x9158('0x5d')](_0x9158('0x5e'),_0x2d5185);})[_0x9158('0x1b')](function(){return respondWithRpcPromise('Reload',_0x9158('0x69'),{'module':_0x9158('0x61')});})[_0x9158('0x1b')](function(){return _0x1468a7;})['then'](respondWithResult(_0x1b8fae,null))['catch'](handleError(_0x1b8fae,null));};exports[_0x9158('0x35')]=function(_0xc2afee,_0x5e0236,_0x469278){var _0x5cea10;return db[_0x9158('0x3a')]['find']({'where':{'id':_0xc2afee['params']['id']}})[_0x9158('0x1b')](handleEntityNotFound(_0x5e0236,null))[_0x9158('0x1b')](removeEntity(_0x5e0236,null))[_0x9158('0x1b')](function(){return db[_0x9158('0x3a')][_0x9158('0x52')]({'raw':!![]});})[_0x9158('0x1b')](function(_0x1d4757){var _0x252244=fs[_0x9158('0x57')](path[_0x9158('0x58')](config[_0x9158('0x59')],_0x9158('0x5a')),_0x9158('0x5b'));var _0x125806=ejs[_0x9158('0x5c')](_0x252244,{'contexts':_0x1d4757});fs[_0x9158('0x5d')](_0x9158('0x5e'),_0x125806);return respondWithRpcPromise('Reload','destroy',{'module':_0x9158('0x61')});})[_0x9158('0x26')](handleError(_0x5e0236,null));}; \ No newline at end of file +var _0x1ce6=['message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','readFileSync','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','utf8','render','writeFileSync','root','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2d0d97,_0x2d9560){var _0xfb96e9=function(_0x52a340){while(--_0x52a340){_0x2d0d97['push'](_0x2d0d97['shift']());}};_0xfb96e9(++_0x2d9560);}(_0x1ce6,0xb0));var _0x61ce=function(_0x4902ff,_0x383317){_0x4902ff=_0x4902ff-0x0;var _0x3dda9b=_0x1ce6[_0x4902ff];return _0x3dda9b;};'use strict';var emlformat=require(_0x61ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x61ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61ce('0x2'));var BPromise=require(_0x61ce('0x3'));var Mustache=require(_0x61ce('0x4'));var util=require(_0x61ce('0x5'));var path=require(_0x61ce('0x6'));var sox=require('sox');var csv=require(_0x61ce('0x7'));var ejs=require(_0x61ce('0x8'));var fs=require('fs');var fs_extra=require(_0x61ce('0x9'));var _=require(_0x61ce('0xa'));var squel=require('squel');var crypto=require(_0x61ce('0xb'));var jsforce=require(_0x61ce('0xc'));var deskjs=require(_0x61ce('0xd'));var toCsv=require(_0x61ce('0x7'));var querystring=require(_0x61ce('0xe'));var Papa=require(_0x61ce('0xf'));var Redis=require(_0x61ce('0x10'));var authService=require(_0x61ce('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61ce('0x12'));var logger=require(_0x61ce('0x13'))('api');var utils=require(_0x61ce('0x14'));var config=require(_0x61ce('0x15'));var licenseUtil=require(_0x61ce('0x16'));var db=require(_0x61ce('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x61ce('0x18')][_0x61ce('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x33ca25,_0x33d5cb,_0x382679,_0x4b4e26){return new BPromise(function(_0x1db75e,_0x25b977){var _0x11ac48=_0x4b4e26||client;return _0x11ac48[_0x61ce('0x1a')](_0x33ca25,_0x382679)[_0x61ce('0x1b')](function(_0x13e882){logger[_0x61ce('0x1c')](_0x61ce('0x1d'),_0x33d5cb,_0x61ce('0x1e'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x33d5cb,_0x61ce('0x1e'),JSON[_0x61ce('0x1f')](_0x13e882));if(_0x13e882[_0x61ce('0x20')]){if(_0x13e882[_0x61ce('0x20')][_0x61ce('0x21')]===0x1f4){logger[_0x61ce('0x20')](_0x61ce('0x1d'),_0x33d5cb,_0x13e882[_0x61ce('0x20')]['message']);return _0x25b977(_0x13e882[_0x61ce('0x20')][_0x61ce('0x22')]);}logger[_0x61ce('0x20')](_0x61ce('0x1d'),_0x33d5cb,_0x13e882[_0x61ce('0x20')]['message']);return _0x1db75e(_0x13e882['error']['message']);}else{logger[_0x61ce('0x1c')](_0x61ce('0x1d'),_0x33d5cb,'request\x20sent');_0x1db75e(_0x13e882[_0x61ce('0x23')]['message']);}})['catch'](function(_0x3987ce){logger['error'](_0x61ce('0x1d'),_0x33d5cb,_0x3987ce);_0x25b977(_0x3987ce);});});}function respondWithStatusCode(_0x28ca69,_0x274401){_0x274401=_0x274401||0xcc;return function(_0x5b554d){if(_0x5b554d){return _0x28ca69[_0x61ce('0x24')](_0x274401);}return _0x28ca69[_0x61ce('0x25')](_0x274401)[_0x61ce('0x26')]();};}function respondWithResult(_0x10e957,_0x103471){_0x103471=_0x103471||0xc8;return function(_0x268ad4){if(_0x268ad4){return _0x10e957[_0x61ce('0x25')](_0x103471)[_0x61ce('0x27')](_0x268ad4);}};}function respondWithFilteredResult(_0x44c3dd,_0x248760){return function(_0x35fcde){if(_0x35fcde){var _0x2bca85=typeof _0x248760[_0x61ce('0x28')]==='undefined'&&typeof _0x248760[_0x61ce('0x29')]===_0x61ce('0x2a');var _0x130129=_0x35fcde[_0x61ce('0x2b')];var _0x1ec538=_0x2bca85?0x0:_0x248760[_0x61ce('0x28')];var _0x2f2484=_0x2bca85?_0x35fcde[_0x61ce('0x2b')]:_0x248760[_0x61ce('0x28')]+_0x248760[_0x61ce('0x29')];var _0x4f5e38;if(_0x2f2484>=_0x130129){_0x2f2484=_0x130129;_0x4f5e38=0xc8;}else{_0x4f5e38=0xce;}_0x44c3dd[_0x61ce('0x25')](_0x4f5e38);return _0x44c3dd[_0x61ce('0x2c')](_0x61ce('0x2d'),_0x1ec538+'-'+_0x2f2484+'/'+_0x130129)['json'](_0x35fcde);}return null;};}function patchUpdates(_0x56c7be){return function(_0xe1f800){try{jsonpatch[_0x61ce('0x2e')](_0xe1f800,_0x56c7be,!![]);}catch(_0x5d2dd7){return BPromise[_0x61ce('0x2f')](_0x5d2dd7);}return _0xe1f800[_0x61ce('0x30')]();};}function saveUpdates(_0x2054b,_0xb51fd9){return function(_0x5ac725){if(_0x5ac725){return _0x5ac725[_0x61ce('0x31')](_0x2054b)[_0x61ce('0x1b')](function(_0x8cfc7f){return _0x8cfc7f;});}return null;};}function removeEntity(_0x5c569a,_0x239599){return function(_0x4d47b6){if(_0x4d47b6){return _0x4d47b6[_0x61ce('0x32')]()[_0x61ce('0x1b')](function(){var _0x240f9f=_0x4d47b6[_0x61ce('0x33')]({'plain':!![]});var _0x1345c3='Contexts';return db[_0x61ce('0x34')][_0x61ce('0x32')]({'where':{'type':_0x1345c3,'resourceId':_0x240f9f['id']}})[_0x61ce('0x1b')](function(){return _0x4d47b6;});})[_0x61ce('0x1b')](function(){_0x5c569a[_0x61ce('0x25')](0xcc)[_0x61ce('0x26')]();});}};}function handleEntityNotFound(_0x377993,_0x251e32){return function(_0x54c231){if(!_0x54c231){_0x377993[_0x61ce('0x24')](0x194);}return _0x54c231;};}function handleError(_0x151a15,_0x197de8){_0x197de8=_0x197de8||0x1f4;return function(_0x2b2967){logger[_0x61ce('0x20')](_0x2b2967[_0x61ce('0x35')]);if(_0x2b2967['name']){delete _0x2b2967[_0x61ce('0x36')];}_0x151a15['status'](_0x197de8)[_0x61ce('0x37')](_0x2b2967);};}exports[_0x61ce('0x38')]=function(_0xcb992d,_0x4858a6){var _0x1e06aa={},_0x43664d={},_0x31c2ca={'count':0x0,'rows':[]};var _0x50be0e=_[_0x61ce('0x39')](db[_0x61ce('0x3a')]['rawAttributes'],function(_0x5a993e){return{'name':_0x5a993e[_0x61ce('0x3b')],'type':_0x5a993e['type'][_0x61ce('0x3c')]};});_0x43664d[_0x61ce('0x3d')]=_[_0x61ce('0x39')](_0x50be0e,_0x61ce('0x36'));_0x43664d[_0x61ce('0x3e')]=_[_0x61ce('0x3f')](_0xcb992d[_0x61ce('0x3e')]);_0x43664d['filters']=_[_0x61ce('0x40')](_0x43664d[_0x61ce('0x3d')],_0x43664d[_0x61ce('0x3e')]);_0x1e06aa['attributes']=_[_0x61ce('0x40')](_0x43664d['model'],qs['fields'](_0xcb992d['query'][_0x61ce('0x41')]));_0x1e06aa[_0x61ce('0x42')]=_0x1e06aa[_0x61ce('0x42')][_0x61ce('0x43')]?_0x1e06aa[_0x61ce('0x42')]:_0x43664d[_0x61ce('0x3d')];if(!_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x44')]('nolimit')){_0x1e06aa[_0x61ce('0x29')]=qs[_0x61ce('0x29')](_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x29')]);_0x1e06aa[_0x61ce('0x28')]=qs[_0x61ce('0x28')](_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x28')]);}_0x1e06aa[_0x61ce('0x45')]=qs[_0x61ce('0x46')](_0xcb992d['query'][_0x61ce('0x46')]);_0x1e06aa[_0x61ce('0x47')]=qs['filters'](_['pick'](_0xcb992d['query'],_0x43664d[_0x61ce('0x48')]),_0x50be0e);if(_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x49')]){_0x1e06aa[_0x61ce('0x47')]=_[_0x61ce('0x4a')](_0x1e06aa[_0x61ce('0x47')],{'$or':_[_0x61ce('0x39')](_0x50be0e,function(_0x16813f){if(_0x16813f[_0x61ce('0x4b')]!==_0x61ce('0x4c')){var _0x569d6e={};_0x569d6e[_0x16813f['name']]={'$like':'%'+_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x49')]+'%'};return _0x569d6e;}})});}_0x1e06aa=_['merge']({},_0x1e06aa,_0xcb992d[_0x61ce('0x4d')]);var _0x533906={'where':_0x1e06aa[_0x61ce('0x47')]};return db[_0x61ce('0x3a')]['count'](_0x533906)[_0x61ce('0x1b')](function(_0x164cfe){_0x31c2ca[_0x61ce('0x2b')]=_0x164cfe;if(_0xcb992d[_0x61ce('0x3e')][_0x61ce('0x4e')]){_0x1e06aa[_0x61ce('0x4f')]=[{'all':!![]}];}return db[_0x61ce('0x3a')][_0x61ce('0x50')](_0x1e06aa);})['then'](function(_0x38dae8){_0x31c2ca[_0x61ce('0x51')]=_0x38dae8;return _0x31c2ca;})['then'](respondWithFilteredResult(_0x4858a6,_0x1e06aa))[_0x61ce('0x52')](handleError(_0x4858a6,null));};exports[_0x61ce('0x53')]=function(_0x156b0d,_0x2ec876){var _0x3500a4={'raw':![],'where':{'id':_0x156b0d['params']['id']}},_0x108bc5={};_0x108bc5['model']=_[_0x61ce('0x3f')](db[_0x61ce('0x3a')][_0x61ce('0x54')]);_0x108bc5[_0x61ce('0x3e')]=_[_0x61ce('0x3f')](_0x156b0d[_0x61ce('0x3e')]);_0x108bc5[_0x61ce('0x48')]=_[_0x61ce('0x40')](_0x108bc5[_0x61ce('0x3d')],_0x108bc5[_0x61ce('0x3e')]);_0x3500a4['attributes']=_['intersection'](_0x108bc5['model'],qs[_0x61ce('0x41')](_0x156b0d[_0x61ce('0x3e')][_0x61ce('0x41')]));_0x3500a4[_0x61ce('0x42')]=_0x3500a4[_0x61ce('0x42')][_0x61ce('0x43')]?_0x3500a4[_0x61ce('0x42')]:_0x108bc5[_0x61ce('0x3d')];if(_0x156b0d[_0x61ce('0x3e')][_0x61ce('0x4e')]){_0x3500a4[_0x61ce('0x4f')]=[{'all':!![]}];}_0x3500a4=_['merge']({},_0x3500a4,_0x156b0d['options']);return db['VoiceContext'][_0x61ce('0x55')](_0x3500a4)['then'](handleEntityNotFound(_0x2ec876,null))['then'](respondWithResult(_0x2ec876,null))[_0x61ce('0x52')](handleError(_0x2ec876,null));};exports['create']=function(_0x3ef9c1,_0x3c25fd,_0x31364e){var _0x1ccadc;return db[_0x61ce('0x3a')][_0x61ce('0x56')](_0x3ef9c1[_0x61ce('0x57')],{'raw':!![]})[_0x61ce('0x1b')](function(_0x4105bd){_0x1ccadc=_0x4105bd;return db[_0x61ce('0x3a')][_0x61ce('0x50')]({'raw':!![]});})[_0x61ce('0x1b')](function(_0x49c281){var _0x3b528c=fs[_0x61ce('0x58')](path['join'](config['root'],_0x61ce('0x59')),'utf8');var _0x4ddc88=ejs['render'](_0x3b528c,{'contexts':_0x49c281||[]});fs['writeFileSync'](_0x61ce('0x5a'),_0x4ddc88);})[_0x61ce('0x1b')](function(){return respondWithRpcPromise(_0x61ce('0x5b'),_0x61ce('0x56'),{'module':_0x61ce('0x5c')});})[_0x61ce('0x1b')](function(){var _0x588be4=_0x3ef9c1[_0x61ce('0x5d')][_0x61ce('0x33')]({'plain':!![]});if(!_0x588be4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x588be4[_0x61ce('0x5e')]==='user'){var _0x58e201=_0x1ccadc[_0x61ce('0x33')]({'plain':!![]});return db[_0x61ce('0x5f')][_0x61ce('0x55')]({'where':{'name':_0x61ce('0x60'),'userProfileId':_0x588be4[_0x61ce('0x61')]},'raw':!![]})[_0x61ce('0x1b')](function(_0x875a36){if(_0x875a36&&_0x875a36['autoAssociation']===0x0){return db[_0x61ce('0x34')][_0x61ce('0x56')]({'name':_0x58e201[_0x61ce('0x36')],'resourceId':_0x58e201['id'],'type':_0x875a36['name'],'sectionId':_0x875a36['id']},{})[_0x61ce('0x1b')](function(){return _0x1ccadc;});}else{return _0x1ccadc;}})[_0x61ce('0x52')](function(_0x283be8){logger[_0x61ce('0x20')](_0x61ce('0x62'),_0x283be8);throw _0x283be8;});}return _0x1ccadc;})[_0x61ce('0x1b')](respondWithResult(_0x3c25fd,0xc9))[_0x61ce('0x52')](handleError(_0x3c25fd,null));};exports['update']=function(_0x25e455,_0x6a20de,_0x479ad9){var _0x48a48a;return db[_0x61ce('0x3a')]['find']({'where':{'id':_0x25e455[_0x61ce('0x63')]['id']}})[_0x61ce('0x1b')](handleEntityNotFound(_0x6a20de,null))[_0x61ce('0x1b')](saveUpdates(_0x25e455['body'],null))[_0x61ce('0x1b')](function(_0x30f6c9){if(_0x30f6c9){_0x48a48a=_0x30f6c9;return db['VoiceContext'][_0x61ce('0x50')]({'raw':!![]});}})['then'](function(_0x104a22){var _0x370caf=fs[_0x61ce('0x58')](path[_0x61ce('0x64')](config['root'],_0x61ce('0x59')),_0x61ce('0x65'));var _0x3a1062=ejs[_0x61ce('0x66')](_0x370caf,{'contexts':_0x104a22||[]});fs[_0x61ce('0x67')](_0x61ce('0x5a'),_0x3a1062);})['then'](function(){return respondWithRpcPromise('Reload',_0x61ce('0x31'),{'module':_0x61ce('0x5c')});})[_0x61ce('0x1b')](function(){return _0x48a48a;})[_0x61ce('0x1b')](respondWithResult(_0x6a20de,null))['catch'](handleError(_0x6a20de,null));};exports[_0x61ce('0x32')]=function(_0x230139,_0x4ac28a,_0x9b23f5){var _0x1fd33f;return db[_0x61ce('0x3a')][_0x61ce('0x55')]({'where':{'id':_0x230139[_0x61ce('0x63')]['id']}})[_0x61ce('0x1b')](handleEntityNotFound(_0x4ac28a,null))[_0x61ce('0x1b')](removeEntity(_0x4ac28a,null))['then'](function(){return db[_0x61ce('0x3a')][_0x61ce('0x50')]({'raw':!![]});})[_0x61ce('0x1b')](function(_0x505831){var _0x105c8c=fs[_0x61ce('0x58')](path['join'](config[_0x61ce('0x68')],_0x61ce('0x59')),_0x61ce('0x65'));var _0x2135d4=ejs[_0x61ce('0x66')](_0x105c8c,{'contexts':_0x505831});fs[_0x61ce('0x67')](_0x61ce('0x5a'),_0x2135d4);return respondWithRpcPromise(_0x61ce('0x5b'),_0x61ce('0x32'),{'module':_0x61ce('0x5c')});})[_0x61ce('0x52')](handleError(_0x4ac28a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index df3ed7e..6912528 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 _0xeb36=['VoiceContext','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeb36,0x119));var _0x6eb3=function(_0xab2e03,_0x404aec){_0xab2e03=_0xab2e03-0x0;var _0x39b0cf=_0xeb36[_0xab2e03];return _0x39b0cf;};'use strict';var _=require(_0x6eb3('0x0'));var util=require(_0x6eb3('0x1'));var logger=require(_0x6eb3('0x2'))(_0x6eb3('0x3'));var moment=require(_0x6eb3('0x4'));var BPromise=require(_0x6eb3('0x5'));var rp=require(_0x6eb3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x6eb3('0x7')]=function(_0x2ba6a2,_0x443ab3){return _0x2ba6a2[_0x6eb3('0x8')](_0x6eb3('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb846=['request-promise','../../config/environment','./voiceContext.attributes','exports','voice_contexts','lodash','api','moment','bluebird'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xb846,0x1d0));var _0x6b84=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb846[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b84('0x1'));var moment=require(_0x6b84('0x2'));var BPromise=require(_0x6b84('0x3'));var rp=require(_0x6b84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b84('0x5'));var attributes=require(_0x6b84('0x6'));module[_0x6b84('0x7')]=function(_0x3448d0,_0x31856c){return _0x3448d0['define']('VoiceContext',attributes,{'tableName':_0x6b84('0x8'),'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 8f9db20..d7cb9a7 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 _0xa169=['request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x473738,_0x15ea31){var _0x1df4ae=function(_0x417a72){while(--_0x417a72){_0x473738['push'](_0x473738['shift']());}};_0x1df4ae(++_0x15ea31);}(_0xa169,0xaa));var _0x9a16=function(_0x354957,_0x23aeda){_0x354957=_0x354957-0x0;var _0x36b5a6=_0xa169[_0x354957];return _0x36b5a6;};'use strict';var _=require(_0x9a16('0x0'));var util=require(_0x9a16('0x1'));var moment=require(_0x9a16('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a16('0x3'));var db=require(_0x9a16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a16('0x5'))(_0x9a16('0x6'));var config=require(_0x9a16('0x7'));var jayson=require(_0x9a16('0x8'));var client=jayson[_0x9a16('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31597a,_0x1b3458,_0xae9d70){return new BPromise(function(_0xe871ab,_0x4d164e){return client[_0x9a16('0xa')](_0x31597a,_0xae9d70)['then'](function(_0x3c0f0a){logger['info'](_0x9a16('0xb'),_0x1b3458,_0x9a16('0xc'));logger[_0x9a16('0xd')](_0x9a16('0xe'),_0x1b3458,_0x9a16('0xc'),JSON['stringify'](_0x3c0f0a));if(_0x3c0f0a['error']){if(_0x3c0f0a[_0x9a16('0xf')]['code']===0x1f4){logger['error'](_0x9a16('0xb'),_0x1b3458,_0x3c0f0a[_0x9a16('0xf')][_0x9a16('0x10')]);return _0x4d164e(_0x3c0f0a[_0x9a16('0xf')]['message']);}logger[_0x9a16('0xf')](_0x9a16('0xb'),_0x1b3458,_0x3c0f0a[_0x9a16('0xf')][_0x9a16('0x10')]);return _0xe871ab(_0x3c0f0a[_0x9a16('0xf')][_0x9a16('0x10')]);}else{logger[_0x9a16('0x11')](_0x9a16('0xb'),_0x1b3458,'request\x20sent');_0xe871ab(_0x3c0f0a[_0x9a16('0x12')][_0x9a16('0x10')]);}})[_0x9a16('0x13')](function(_0x33fecb){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b3458,_0x33fecb);_0x4d164e(_0x33fecb);});});} \ No newline at end of file +var _0x98ef=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','lodash'];(function(_0x46d770,_0x35b338){var _0x4033e6=function(_0x448e02){while(--_0x448e02){_0x46d770['push'](_0x46d770['shift']());}};_0x4033e6(++_0x35b338);}(_0x98ef,0x197));var _0xf98e=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x98ef[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var moment=require(_0xf98e('0x2'));var BPromise=require(_0xf98e('0x3'));var rs=require(_0xf98e('0x4'));var fs=require('fs');var Redis=require(_0xf98e('0x5'));var db=require(_0xf98e('0x6'))['db'];var utils=require(_0xf98e('0x7'));var logger=require(_0xf98e('0x8'))(_0xf98e('0x9'));var config=require(_0xf98e('0xa'));var jayson=require(_0xf98e('0xb'));var client=jayson[_0xf98e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8573,_0xa223b9,_0x55f71d){return new BPromise(function(_0x161912,_0x2c6598){return client[_0xf98e('0xd')](_0x3e8573,_0x55f71d)[_0xf98e('0xe')](function(_0xb2d232){logger[_0xf98e('0xf')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xf98e('0x10'));logger[_0xf98e('0x11')](_0xf98e('0x12'),_0xa223b9,_0xf98e('0x10'),JSON['stringify'](_0xb2d232));if(_0xb2d232[_0xf98e('0x13')]){if(_0xb2d232['error'][_0xf98e('0x14')]===0x1f4){logger[_0xf98e('0x13')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xb2d232['error'][_0xf98e('0x15')]);return _0x2c6598(_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);}logger[_0xf98e('0x13')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);return _0x161912(_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);}else{logger[_0xf98e('0xf')](_0xf98e('0x16'),_0xa223b9,_0xf98e('0x10'));_0x161912(_0xb2d232[_0xf98e('0x17')][_0xf98e('0x15')]);}})['catch'](function(_0x14f93f){logger[_0xf98e('0x13')](_0xf98e('0x16'),_0xa223b9,_0x14f93f);_0x2c6598(_0x14f93f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6b091ef..3ebd02a 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 _0x085c=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','delete'];(function(_0x36d291,_0x3c8e13){var _0x45a51a=function(_0x59ff35){while(--_0x59ff35){_0x36d291['push'](_0x36d291['shift']());}};_0x45a51a(++_0x3c8e13);}(_0x085c,0xd9));var _0xc085=function(_0xa911e,_0x1a9f9a){_0xa911e=_0xa911e-0x0;var _0x28bd6f=_0x085c[_0xa911e];return _0x28bd6f;};'use strict';var multer=require(_0xc085('0x0'));var util=require(_0xc085('0x1'));var path=require(_0xc085('0x2'));var timeout=require('connect-timeout');var express=require(_0xc085('0x3'));var router=express['Router']();var fs_extra=require(_0xc085('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc085('0x5'));var config=require(_0xc085('0x6'));var controller=require(_0xc085('0x7'));router[_0xc085('0x8')]('/',auth['isAuthenticated'](),controller[_0xc085('0x9')]);router[_0xc085('0x8')](_0xc085('0xa'),auth[_0xc085('0xb')](),controller[_0xc085('0xc')]);router[_0xc085('0x8')](_0xc085('0xd'),auth['isAuthenticated'](),controller[_0xc085('0xe')]);router['post']('/',auth[_0xc085('0xb')](),controller['create']);router[_0xc085('0xf')](_0xc085('0xd'),auth[_0xc085('0xb')](),controller['update']);router[_0xc085('0x10')](_0xc085('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc085('0x11')]=router; \ No newline at end of file +var _0xb575=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb575,0x1a8));var _0x5b57=function(_0x309a11,_0x33f77e){_0x309a11=_0x309a11-0x0;var _0x22bdf8=_0xb575[_0x309a11];return _0x22bdf8;};'use strict';var multer=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var path=require(_0x5b57('0x2'));var timeout=require(_0x5b57('0x3'));var express=require(_0x5b57('0x4'));var router=express[_0x5b57('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b57('0x6'));var interaction=require(_0x5b57('0x7'));var config=require('../../config/environment');var controller=require(_0x5b57('0x8'));router[_0x5b57('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b57('0x9')](_0x5b57('0xa'),auth[_0x5b57('0xb')](),controller[_0x5b57('0xc')]);router[_0x5b57('0x9')](_0x5b57('0xd'),auth[_0x5b57('0xb')](),controller[_0x5b57('0xe')]);router[_0x5b57('0xf')]('/',auth[_0x5b57('0xb')](),controller[_0x5b57('0x10')]);router[_0x5b57('0x11')](_0x5b57('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5b57('0x12')](_0x5b57('0xd'),auth[_0x5b57('0xb')](),controller[_0x5b57('0x13')]);module[_0x5b57('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 4e64c7d..a8c82c9 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 _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x407461,_0x1cf61c){var _0x2b3ffa=function(_0x2acb31){while(--_0x2acb31){_0x407461['push'](_0x407461['shift']());}};_0x2b3ffa(++_0x1cf61c);}(_0x81bd,0x7c));var _0xd81b=function(_0x2042a4,_0x16f91e){_0x2042a4=_0x2042a4-0x0;var _0x233995=_0x81bd[_0x2042a4];return _0x233995;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file +var _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x36bb37,_0x17323b){_0x36bb37=_0x36bb37-0x0;var _0x2c0d4b=_0xd6d6[_0x36bb37];return _0x2c0d4b;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index bfcc1a8..74b140c 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 _0x7d46=['apply','save','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','destroy','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x11b5cf,_0xb44a04){var _0x45f33d=function(_0x27a181){while(--_0x27a181){_0x11b5cf['push'](_0x11b5cf['shift']());}};_0x45f33d(++_0xb44a04);}(_0x7d46,0x187));var _0x67d4=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x7d46[_0x5f3905];return _0x2923b1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x67d4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67d4('0x1'));var moment=require(_0x67d4('0x2'));var BPromise=require(_0x67d4('0x3'));var Mustache=require(_0x67d4('0x4'));var util=require(_0x67d4('0x5'));var path=require(_0x67d4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x67d4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67d4('0x8'));var crypto=require(_0x67d4('0x9'));var jsforce=require(_0x67d4('0xa'));var deskjs=require(_0x67d4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x67d4('0xc'));var Papa=require('papaparse');var Redis=require(_0x67d4('0xd'));var authService=require(_0x67d4('0xe'));var qs=require(_0x67d4('0xf'));var as=require(_0x67d4('0x10'));var hardwareService=require(_0x67d4('0x11'));var logger=require('../../config/logger')(_0x67d4('0x12'));var utils=require('../../config/utils');var config=require(_0x67d4('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x474f24,_0x1ef770){_0x1ef770=_0x1ef770||0xcc;return function(_0x47862b){if(_0x47862b){return _0x474f24[_0x67d4('0x14')](_0x1ef770);}return _0x474f24[_0x67d4('0x15')](_0x1ef770)[_0x67d4('0x16')]();};}function respondWithResult(_0x2a81ce,_0x9d48d6){_0x9d48d6=_0x9d48d6||0xc8;return function(_0x150bc8){if(_0x150bc8){return _0x2a81ce[_0x67d4('0x15')](_0x9d48d6)[_0x67d4('0x17')](_0x150bc8);}};}function respondWithFilteredResult(_0xc2b0a0,_0x4bda83){return function(_0x35e4a0){if(_0x35e4a0){var _0x37e1e2=typeof _0x4bda83[_0x67d4('0x18')]==='undefined'&&typeof _0x4bda83[_0x67d4('0x19')]===_0x67d4('0x1a');var _0x3e2d90=_0x35e4a0['count'];var _0x1a4443=_0x37e1e2?0x0:_0x4bda83['offset'];var _0x1e9b06=_0x37e1e2?_0x35e4a0[_0x67d4('0x1b')]:_0x4bda83[_0x67d4('0x18')]+_0x4bda83[_0x67d4('0x19')];var _0x42787d;if(_0x1e9b06>=_0x3e2d90){_0x1e9b06=_0x3e2d90;_0x42787d=0xc8;}else{_0x42787d=0xce;}_0xc2b0a0[_0x67d4('0x15')](_0x42787d);return _0xc2b0a0[_0x67d4('0x1c')]('Content-Range',_0x1a4443+'-'+_0x1e9b06+'/'+_0x3e2d90)['json'](_0x35e4a0);}return null;};}function patchUpdates(_0x288291){return function(_0x54e7cd){try{jsonpatch[_0x67d4('0x1d')](_0x54e7cd,_0x288291,!![]);}catch(_0x538201){return BPromise['reject'](_0x538201);}return _0x54e7cd[_0x67d4('0x1e')]();};}function saveUpdates(_0x598117,_0x50c94c){return function(_0x3be796){if(_0x3be796){return _0x3be796[_0x67d4('0x1f')](_0x598117)[_0x67d4('0x20')](function(_0x512b42){return _0x512b42;});}return null;};}function removeEntity(_0x2459e3,_0x10cce7){return function(_0x20d66c){if(_0x20d66c){return _0x20d66c['destroy']()['then'](function(){_0x2459e3[_0x67d4('0x15')](0xcc)[_0x67d4('0x16')]();});}};}function handleEntityNotFound(_0x101d1e,_0x35115d){return function(_0x3c7e0b){if(!_0x3c7e0b){_0x101d1e[_0x67d4('0x14')](0x194);}return _0x3c7e0b;};}function handleError(_0x99974b,_0x7381af){_0x7381af=_0x7381af||0x1f4;return function(_0x28433a){logger[_0x67d4('0x21')](_0x28433a[_0x67d4('0x22')]);if(_0x28433a[_0x67d4('0x23')]){delete _0x28433a[_0x67d4('0x23')];}_0x99974b[_0x67d4('0x15')](_0x7381af)[_0x67d4('0x24')](_0x28433a);};}exports[_0x67d4('0x25')]=function(_0x3bf4ad,_0x27f659){var _0x590c83={},_0x351412={},_0x4e99cc={'count':0x0,'rows':[]};var _0x5b4c3a=_[_0x67d4('0x26')](db[_0x67d4('0x27')][_0x67d4('0x28')],function(_0x533bd9){return{'name':_0x533bd9['fieldName'],'type':_0x533bd9[_0x67d4('0x29')][_0x67d4('0x2a')]};});_0x351412[_0x67d4('0x2b')]=_[_0x67d4('0x26')](_0x5b4c3a,_0x67d4('0x23'));_0x351412['query']=_[_0x67d4('0x2c')](_0x3bf4ad['query']);_0x351412[_0x67d4('0x2d')]=_[_0x67d4('0x2e')](_0x351412[_0x67d4('0x2b')],_0x351412[_0x67d4('0x2f')]);_0x590c83[_0x67d4('0x30')]=_[_0x67d4('0x2e')](_0x351412[_0x67d4('0x2b')],qs['fields'](_0x3bf4ad['query'][_0x67d4('0x31')]));_0x590c83[_0x67d4('0x30')]=_0x590c83['attributes']['length']?_0x590c83[_0x67d4('0x30')]:_0x351412['model'];if(!_0x3bf4ad[_0x67d4('0x2f')]['hasOwnProperty'](_0x67d4('0x32'))){_0x590c83[_0x67d4('0x19')]=qs['limit'](_0x3bf4ad[_0x67d4('0x2f')][_0x67d4('0x19')]);_0x590c83['offset']=qs[_0x67d4('0x18')](_0x3bf4ad[_0x67d4('0x2f')][_0x67d4('0x18')]);}_0x590c83['order']=qs['sort'](_0x3bf4ad[_0x67d4('0x2f')][_0x67d4('0x33')]);_0x590c83[_0x67d4('0x34')]=qs[_0x67d4('0x2d')](_[_0x67d4('0x35')](_0x3bf4ad[_0x67d4('0x2f')],_0x351412[_0x67d4('0x2d')]),_0x5b4c3a);if(_0x3bf4ad[_0x67d4('0x2f')][_0x67d4('0x36')]){_0x590c83[_0x67d4('0x34')]=_[_0x67d4('0x37')](_0x590c83[_0x67d4('0x34')],{'$or':_[_0x67d4('0x26')](_0x5b4c3a,function(_0x23793a){if(_0x23793a[_0x67d4('0x29')]!==_0x67d4('0x38')){var _0x524047={};_0x524047[_0x23793a[_0x67d4('0x23')]]={'$like':'%'+_0x3bf4ad['query'][_0x67d4('0x36')]+'%'};return _0x524047;}})});}_0x590c83=_[_0x67d4('0x37')]({},_0x590c83,_0x3bf4ad[_0x67d4('0x39')]);var _0x5921ac={'where':_0x590c83[_0x67d4('0x34')]};return db['VoiceDialReport']['count'](_0x5921ac)[_0x67d4('0x20')](function(_0x3bf6de){_0x4e99cc[_0x67d4('0x1b')]=_0x3bf6de;if(_0x3bf4ad[_0x67d4('0x2f')][_0x67d4('0x3a')]){_0x590c83[_0x67d4('0x3b')]=[{'all':!![]}];}return db[_0x67d4('0x27')][_0x67d4('0x3c')](_0x590c83);})['then'](function(_0xdda2a4){_0x4e99cc[_0x67d4('0x3d')]=_0xdda2a4;return _0x4e99cc;})['then'](respondWithFilteredResult(_0x27f659,_0x590c83))[_0x67d4('0x3e')](handleError(_0x27f659,null));};exports['show']=function(_0x373eaa,_0x10abe7){var _0x483ab3={'raw':!![],'where':{'id':_0x373eaa[_0x67d4('0x3f')]['id']}},_0x95581={};_0x95581[_0x67d4('0x2b')]=_[_0x67d4('0x2c')](db[_0x67d4('0x27')][_0x67d4('0x28')]);_0x95581[_0x67d4('0x2f')]=_[_0x67d4('0x2c')](_0x373eaa['query']);_0x95581[_0x67d4('0x2d')]=_['intersection'](_0x95581[_0x67d4('0x2b')],_0x95581['query']);_0x483ab3[_0x67d4('0x30')]=_[_0x67d4('0x2e')](_0x95581[_0x67d4('0x2b')],qs[_0x67d4('0x31')](_0x373eaa[_0x67d4('0x2f')][_0x67d4('0x31')]));_0x483ab3['attributes']=_0x483ab3[_0x67d4('0x30')][_0x67d4('0x40')]?_0x483ab3['attributes']:_0x95581['model'];if(_0x373eaa[_0x67d4('0x2f')][_0x67d4('0x3a')]){_0x483ab3[_0x67d4('0x3b')]=[{'all':!![]}];}_0x483ab3=_[_0x67d4('0x37')]({},_0x483ab3,_0x373eaa[_0x67d4('0x39')]);return db[_0x67d4('0x27')]['find'](_0x483ab3)[_0x67d4('0x20')](handleEntityNotFound(_0x10abe7,null))[_0x67d4('0x20')](respondWithResult(_0x10abe7,null))['catch'](handleError(_0x10abe7,null));};exports[_0x67d4('0x41')]=function(_0x3b4fb1,_0x561857){return db[_0x67d4('0x27')][_0x67d4('0x41')](_0x3b4fb1['body'],{})[_0x67d4('0x20')](respondWithResult(_0x561857,0xc9))[_0x67d4('0x3e')](handleError(_0x561857,null));};exports[_0x67d4('0x1f')]=function(_0x1b8149,_0x39ed73){if(_0x1b8149['body']['id']){delete _0x1b8149[_0x67d4('0x42')]['id'];}return db[_0x67d4('0x27')][_0x67d4('0x43')]({'where':{'id':_0x1b8149[_0x67d4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x39ed73,null))[_0x67d4('0x20')](saveUpdates(_0x1b8149[_0x67d4('0x42')],null))[_0x67d4('0x20')](respondWithResult(_0x39ed73,null))[_0x67d4('0x3e')](handleError(_0x39ed73,null));};exports[_0x67d4('0x44')]=function(_0x4624a6,_0x51c31f){return db[_0x67d4('0x27')][_0x67d4('0x43')]({'where':{'id':_0x4624a6['params']['id']}})[_0x67d4('0x20')](handleEntityNotFound(_0x51c31f,null))[_0x67d4('0x20')](removeEntity(_0x51c31f,null))[_0x67d4('0x3e')](handleError(_0x51c31f,null));};exports[_0x67d4('0x45')]=function(_0x4b9e9e,_0x1671c6){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x1671c6,null))[_0x67d4('0x3e')](handleError(_0x1671c6,null));}; \ No newline at end of file +var _0x7da5=['destroy','stack','name','index','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','include','VoiceDialReport','findAll','catch','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0x2cc8cd,_0x44cc3c){var _0x5b63d7=function(_0x3cfa50){while(--_0x3cfa50){_0x2cc8cd['push'](_0x2cc8cd['shift']());}};_0x5b63d7(++_0x44cc3c);}(_0x7da5,0x1cb));var _0x57da=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7da5[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x57da('0x0'));var rimraf=require(_0x57da('0x1'));var zipdir=require(_0x57da('0x2'));var jsonpatch=require(_0x57da('0x3'));var rp=require(_0x57da('0x4'));var moment=require(_0x57da('0x5'));var BPromise=require(_0x57da('0x6'));var Mustache=require('mustache');var util=require(_0x57da('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(_0x57da('0x8'));var _=require(_0x57da('0x9'));var squel=require(_0x57da('0xa'));var crypto=require(_0x57da('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57da('0xc'));var querystring=require('querystring');var Papa=require(_0x57da('0xd'));var Redis=require(_0x57da('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x57da('0xf'));var as=require(_0x57da('0x10'));var hardwareService=require(_0x57da('0x11'));var logger=require(_0x57da('0x12'))(_0x57da('0x13'));var utils=require(_0x57da('0x14'));var config=require(_0x57da('0x15'));var licenseUtil=require(_0x57da('0x16'));var db=require(_0x57da('0x17'))['db'];function respondWithStatusCode(_0x45ad8d,_0x24b5bc){_0x24b5bc=_0x24b5bc||0xcc;return function(_0x23df9b){if(_0x23df9b){return _0x45ad8d[_0x57da('0x18')](_0x24b5bc);}return _0x45ad8d[_0x57da('0x19')](_0x24b5bc)[_0x57da('0x1a')]();};}function respondWithResult(_0x52643f,_0x4af1f1){_0x4af1f1=_0x4af1f1||0xc8;return function(_0x49fde3){if(_0x49fde3){return _0x52643f[_0x57da('0x19')](_0x4af1f1)[_0x57da('0x1b')](_0x49fde3);}};}function respondWithFilteredResult(_0x141fbe,_0x3b2fa9){return function(_0x49359c){if(_0x49359c){var _0x3975b3=typeof _0x3b2fa9[_0x57da('0x1c')]==='undefined'&&typeof _0x3b2fa9[_0x57da('0x1d')]===_0x57da('0x1e');var _0xa7818d=_0x49359c[_0x57da('0x1f')];var _0x2fc785=_0x3975b3?0x0:_0x3b2fa9[_0x57da('0x1c')];var _0x34df25=_0x3975b3?_0x49359c[_0x57da('0x1f')]:_0x3b2fa9['offset']+_0x3b2fa9[_0x57da('0x1d')];var _0x229ccd;if(_0x34df25>=_0xa7818d){_0x34df25=_0xa7818d;_0x229ccd=0xc8;}else{_0x229ccd=0xce;}_0x141fbe[_0x57da('0x19')](_0x229ccd);return _0x141fbe[_0x57da('0x20')](_0x57da('0x21'),_0x2fc785+'-'+_0x34df25+'/'+_0xa7818d)[_0x57da('0x1b')](_0x49359c);}return null;};}function patchUpdates(_0x39ac82){return function(_0x52cc31){try{jsonpatch[_0x57da('0x22')](_0x52cc31,_0x39ac82,!![]);}catch(_0x2ca815){return BPromise[_0x57da('0x23')](_0x2ca815);}return _0x52cc31[_0x57da('0x24')]();};}function saveUpdates(_0x589850,_0x5558c5){return function(_0x1f5761){if(_0x1f5761){return _0x1f5761['update'](_0x589850)[_0x57da('0x25')](function(_0x1aa8a){return _0x1aa8a;});}return null;};}function removeEntity(_0x393d16,_0x5a535e){return function(_0x3b5421){if(_0x3b5421){return _0x3b5421[_0x57da('0x26')]()[_0x57da('0x25')](function(){_0x393d16['status'](0xcc)[_0x57da('0x1a')]();});}};}function handleEntityNotFound(_0x329c32,_0x12975a){return function(_0x41c3fd){if(!_0x41c3fd){_0x329c32['sendStatus'](0x194);}return _0x41c3fd;};}function handleError(_0x248c28,_0x20af9b){_0x20af9b=_0x20af9b||0x1f4;return function(_0x462a24){logger['error'](_0x462a24[_0x57da('0x27')]);if(_0x462a24[_0x57da('0x28')]){delete _0x462a24['name'];}_0x248c28[_0x57da('0x19')](_0x20af9b)['send'](_0x462a24);};}exports[_0x57da('0x29')]=function(_0x1f463c,_0x160757){var _0x5b01d9={},_0x4d7ada={},_0x46a287={'count':0x0,'rows':[]};var _0x296d42=_['map'](db['VoiceDialReport'][_0x57da('0x2a')],function(_0x2040c3){return{'name':_0x2040c3[_0x57da('0x2b')],'type':_0x2040c3['type']['key']};});_0x4d7ada[_0x57da('0x2c')]=_['map'](_0x296d42,'name');_0x4d7ada[_0x57da('0x2d')]=_[_0x57da('0x2e')](_0x1f463c[_0x57da('0x2d')]);_0x4d7ada[_0x57da('0x2f')]=_[_0x57da('0x30')](_0x4d7ada[_0x57da('0x2c')],_0x4d7ada[_0x57da('0x2d')]);_0x5b01d9['attributes']=_[_0x57da('0x30')](_0x4d7ada[_0x57da('0x2c')],qs[_0x57da('0x31')](_0x1f463c[_0x57da('0x2d')][_0x57da('0x31')]));_0x5b01d9['attributes']=_0x5b01d9[_0x57da('0x32')][_0x57da('0x33')]?_0x5b01d9[_0x57da('0x32')]:_0x4d7ada[_0x57da('0x2c')];if(!_0x1f463c[_0x57da('0x2d')][_0x57da('0x34')](_0x57da('0x35'))){_0x5b01d9[_0x57da('0x1d')]=qs[_0x57da('0x1d')](_0x1f463c[_0x57da('0x2d')][_0x57da('0x1d')]);_0x5b01d9[_0x57da('0x1c')]=qs[_0x57da('0x1c')](_0x1f463c[_0x57da('0x2d')]['offset']);}_0x5b01d9[_0x57da('0x36')]=qs[_0x57da('0x37')](_0x1f463c[_0x57da('0x2d')][_0x57da('0x37')]);_0x5b01d9[_0x57da('0x38')]=qs[_0x57da('0x2f')](_[_0x57da('0x39')](_0x1f463c[_0x57da('0x2d')],_0x4d7ada[_0x57da('0x2f')]),_0x296d42);if(_0x1f463c[_0x57da('0x2d')]['filter']){_0x5b01d9['where']=_[_0x57da('0x3a')](_0x5b01d9[_0x57da('0x38')],{'$or':_[_0x57da('0x3b')](_0x296d42,function(_0x9caf68){if(_0x9caf68[_0x57da('0x3c')]!=='VIRTUAL'){var _0x7192bc={};_0x7192bc[_0x9caf68[_0x57da('0x28')]]={'$like':'%'+_0x1f463c['query']['filter']+'%'};return _0x7192bc;}})});}_0x5b01d9=_[_0x57da('0x3a')]({},_0x5b01d9,_0x1f463c['options']);var _0x446c50={'where':_0x5b01d9[_0x57da('0x38')]};return db['VoiceDialReport']['count'](_0x446c50)['then'](function(_0x5b93f8){_0x46a287[_0x57da('0x1f')]=_0x5b93f8;if(_0x1f463c[_0x57da('0x2d')]['includeAll']){_0x5b01d9[_0x57da('0x3d')]=[{'all':!![]}];}return db[_0x57da('0x3e')][_0x57da('0x3f')](_0x5b01d9);})[_0x57da('0x25')](function(_0x5b08ea){_0x46a287['rows']=_0x5b08ea;return _0x46a287;})[_0x57da('0x25')](respondWithFilteredResult(_0x160757,_0x5b01d9))[_0x57da('0x40')](handleError(_0x160757,null));};exports['show']=function(_0x512911,_0x481b4b){var _0x1aaa64={'raw':!![],'where':{'id':_0x512911['params']['id']}},_0x3abaa8={};_0x3abaa8[_0x57da('0x2c')]=_[_0x57da('0x2e')](db[_0x57da('0x3e')][_0x57da('0x2a')]);_0x3abaa8['query']=_[_0x57da('0x2e')](_0x512911['query']);_0x3abaa8[_0x57da('0x2f')]=_[_0x57da('0x30')](_0x3abaa8[_0x57da('0x2c')],_0x3abaa8['query']);_0x1aaa64[_0x57da('0x32')]=_[_0x57da('0x30')](_0x3abaa8[_0x57da('0x2c')],qs['fields'](_0x512911['query']['fields']));_0x1aaa64[_0x57da('0x32')]=_0x1aaa64[_0x57da('0x32')][_0x57da('0x33')]?_0x1aaa64['attributes']:_0x3abaa8['model'];if(_0x512911[_0x57da('0x2d')][_0x57da('0x41')]){_0x1aaa64[_0x57da('0x3d')]=[{'all':!![]}];}_0x1aaa64=_[_0x57da('0x3a')]({},_0x1aaa64,_0x512911['options']);return db[_0x57da('0x3e')][_0x57da('0x42')](_0x1aaa64)[_0x57da('0x25')](handleEntityNotFound(_0x481b4b,null))[_0x57da('0x25')](respondWithResult(_0x481b4b,null))[_0x57da('0x40')](handleError(_0x481b4b,null));};exports[_0x57da('0x43')]=function(_0x3df10b,_0x4ea422){return db['VoiceDialReport'][_0x57da('0x43')](_0x3df10b[_0x57da('0x44')],{})[_0x57da('0x25')](respondWithResult(_0x4ea422,0xc9))[_0x57da('0x40')](handleError(_0x4ea422,null));};exports['update']=function(_0x191d63,_0x4b31be){if(_0x191d63[_0x57da('0x44')]['id']){delete _0x191d63['body']['id'];}return db[_0x57da('0x3e')][_0x57da('0x42')]({'where':{'id':_0x191d63[_0x57da('0x45')]['id']}})[_0x57da('0x25')](handleEntityNotFound(_0x4b31be,null))[_0x57da('0x25')](saveUpdates(_0x191d63[_0x57da('0x44')],null))['then'](respondWithResult(_0x4b31be,null))['catch'](handleError(_0x4b31be,null));};exports['destroy']=function(_0x4e04b8,_0x14b95d){return db[_0x57da('0x3e')][_0x57da('0x42')]({'where':{'id':_0x4e04b8['params']['id']}})[_0x57da('0x25')](handleEntityNotFound(_0x14b95d,null))[_0x57da('0x25')](removeEntity(_0x14b95d,null))[_0x57da('0x40')](handleError(_0x14b95d,null));};exports[_0x57da('0x46')]=function(_0x4d07f4,_0x1f16fb){return db[_0x57da('0x3e')]['describe']()[_0x57da('0x25')](respondWithResult(_0x1f16fb,null))[_0x57da('0x40')](handleError(_0x1f16fb,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 42863b6..2703a83 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 _0xfdef=['define','VoiceDialReport','uniqueid','lodash','../../config/logger','api','rimraf','../../config/environment'];(function(_0x579a52,_0x37605d){var _0xca693b=function(_0x5b161d){while(--_0x5b161d){_0x579a52['push'](_0x579a52['shift']());}};_0xca693b(++_0x37605d);}(_0xfdef,0x17b));var _0xffde=function(_0x5518c8,_0x19c9f5){_0x5518c8=_0x5518c8-0x0;var _0x5c39d9=_0xfdef[_0x5518c8];return _0x5c39d9;};'use strict';var _=require(_0xffde('0x0'));var util=require('util');var logger=require(_0xffde('0x1'))(_0xffde('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(_0xffde('0x3'));var config=require(_0xffde('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x37e216,_0x32107d){return _0x37e216[_0xffde('0x5')](_0xffde('0x6'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xffde('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5813=['moment','bluebird','path','rimraf','../../config/environment','uniqueid','util','../../config/logger'];(function(_0x31477f,_0x35dc14){var _0x5f35ca=function(_0x352845){while(--_0x352845){_0x31477f['push'](_0x31477f['shift']());}};_0x5f35ca(++_0x35dc14);}(_0x5813,0x17e));var _0x3581=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5813[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3581('0x0'));var logger=require(_0x3581('0x1'))('api');var moment=require(_0x3581('0x2'));var BPromise=require(_0x3581('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3581('0x4'));var rimraf=require(_0x3581('0x5'));var config=require(_0x3581('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x338159,_0x165413){return _0x338159['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x3581('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 910c857..33ec687 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 _0xdac9=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','then'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xdac9,0x1ce));var _0x9dac=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xdac9[_0x18fb16];return _0x147b0d;};'use strict';var _=require(_0x9dac('0x0'));var util=require(_0x9dac('0x1'));var moment=require(_0x9dac('0x2'));var BPromise=require(_0x9dac('0x3'));var rs=require(_0x9dac('0x4'));var fs=require('fs');var Redis=require(_0x9dac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dac('0x6'));var logger=require(_0x9dac('0x7'))(_0x9dac('0x8'));var config=require(_0x9dac('0x9'));var jayson=require(_0x9dac('0xa'));var client=jayson[_0x9dac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50c329,_0x222888,_0xe3f39){return new BPromise(function(_0x3f077d,_0x2a4924){return client[_0x9dac('0xc')](_0x50c329,_0xe3f39)['then'](function(_0x367ce1){logger['info'](_0x9dac('0xd'),_0x222888,_0x9dac('0xe'));logger[_0x9dac('0xf')](_0x9dac('0x10'),_0x222888,_0x9dac('0xe'),JSON[_0x9dac('0x11')](_0x367ce1));if(_0x367ce1[_0x9dac('0x12')]){if(_0x367ce1[_0x9dac('0x12')]['code']===0x1f4){logger[_0x9dac('0x12')](_0x9dac('0xd'),_0x222888,_0x367ce1[_0x9dac('0x12')]['message']);return _0x2a4924(_0x367ce1[_0x9dac('0x12')][_0x9dac('0x13')]);}logger['error'](_0x9dac('0xd'),_0x222888,_0x367ce1[_0x9dac('0x12')][_0x9dac('0x13')]);return _0x3f077d(_0x367ce1['error'][_0x9dac('0x13')]);}else{logger[_0x9dac('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x222888,_0x9dac('0xe'));_0x3f077d(_0x367ce1[_0x9dac('0x15')][_0x9dac('0x13')]);}})[_0x9dac('0x16')](function(_0xba2685){logger[_0x9dac('0x12')](_0x9dac('0xd'),_0x222888,_0xba2685);_0x2a4924(_0xba2685);});});}exports['CreateVoiceDialReport']=function(_0x17bd76){var _0x57768e=this;return new Promise(function(_0x5266fe,_0x589867){return db[_0x9dac('0x17')][_0x9dac('0x18')](_0x17bd76[_0x9dac('0x19')],{'raw':_0x17bd76[_0x9dac('0x1a')]?_0x17bd76[_0x9dac('0x1a')][_0x9dac('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x33ceb3){logger[_0x9dac('0x14')](_0x9dac('0x1c'),_0x17bd76);logger[_0x9dac('0xf')]('CreateVoiceDialReport',_0x17bd76,JSON[_0x9dac('0x11')](_0x33ceb3));_0x5266fe(_0x33ceb3);})['catch'](function(_0x2621d5){logger[_0x9dac('0x12')](_0x9dac('0x1c'),_0x2621d5[_0x9dac('0x13')],_0x17bd76);_0x589867(_0x57768e[_0x9dac('0x12')](0x1f4,_0x2621d5['message']));});});};exports[_0x9dac('0x1d')]=function(_0xb03a24){var _0x24f160=this;return new Promise(function(_0x3d0f6e,_0x4b58fe){return db['VoiceDialReport'][_0x9dac('0x1e')](_0xb03a24['body'],{'raw':_0xb03a24[_0x9dac('0x1a')]?_0xb03a24[_0x9dac('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb03a24[_0x9dac('0x1a')]?_0xb03a24['options'][_0x9dac('0x1f')]||null:null,'attributes':_0xb03a24[_0x9dac('0x1a')]?_0xb03a24['options']['attributes']||null:null,'limit':_0xb03a24['options']?_0xb03a24[_0x9dac('0x1a')]['limit']||null:null})[_0x9dac('0x20')](function(_0x303dd4){logger[_0x9dac('0x14')](_0x9dac('0x1d'),_0xb03a24);logger[_0x9dac('0xf')]('UpdateVoiceDialReport',_0xb03a24,JSON[_0x9dac('0x11')](_0x303dd4));_0x3d0f6e(_0x303dd4);})[_0x9dac('0x16')](function(_0x5cd883){logger[_0x9dac('0x12')](_0x9dac('0x1d'),_0x5cd883['message'],_0xb03a24);_0x4b58fe(_0x24f160[_0x9dac('0x12')](0x1f4,_0x5cd883[_0x9dac('0x13')]));});});}; \ No newline at end of file +var _0x2669=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x2669,0x1eb));var _0x9266=function(_0x2fec96,_0x336634){_0x2fec96=_0x2fec96-0x0;var _0x4bebc0=_0x2669[_0x2fec96];return _0x4bebc0;};'use strict';var _=require(_0x9266('0x0'));var util=require('util');var moment=require(_0x9266('0x1'));var BPromise=require(_0x9266('0x2'));var rs=require(_0x9266('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9266('0x4'));var logger=require(_0x9266('0x5'))('rpc');var config=require(_0x9266('0x6'));var jayson=require(_0x9266('0x7'));var client=jayson['client'][_0x9266('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24806c,_0x3b47a4,_0x1f1424){return new BPromise(function(_0x35f768,_0xcdfea5){return client[_0x9266('0x9')](_0x24806c,_0x1f1424)[_0x9266('0xa')](function(_0x2e6fa3){logger[_0x9266('0xb')](_0x9266('0xc'),_0x3b47a4,_0x9266('0xd'));logger[_0x9266('0xe')](_0x9266('0xf'),_0x3b47a4,'request\x20sent',JSON[_0x9266('0x10')](_0x2e6fa3));if(_0x2e6fa3[_0x9266('0x11')]){if(_0x2e6fa3[_0x9266('0x11')][_0x9266('0x12')]===0x1f4){logger[_0x9266('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3b47a4,_0x2e6fa3[_0x9266('0x11')][_0x9266('0x13')]);return _0xcdfea5(_0x2e6fa3[_0x9266('0x11')][_0x9266('0x13')]);}logger[_0x9266('0x11')](_0x9266('0xc'),_0x3b47a4,_0x2e6fa3[_0x9266('0x11')][_0x9266('0x13')]);return _0x35f768(_0x2e6fa3[_0x9266('0x11')]['message']);}else{logger[_0x9266('0xb')](_0x9266('0xc'),_0x3b47a4,_0x9266('0xd'));_0x35f768(_0x2e6fa3[_0x9266('0x14')][_0x9266('0x13')]);}})[_0x9266('0x15')](function(_0x46faf1){logger[_0x9266('0x11')](_0x9266('0xc'),_0x3b47a4,_0x46faf1);_0xcdfea5(_0x46faf1);});});}exports[_0x9266('0x16')]=function(_0x34186e){var _0xf7101b=this;return new Promise(function(_0x47a998,_0x50d6d3){return db[_0x9266('0x17')][_0x9266('0x18')](_0x34186e['body'],{'raw':_0x34186e[_0x9266('0x19')]?_0x34186e[_0x9266('0x19')][_0x9266('0x1a')]===undefined?!![]:![]:!![]})[_0x9266('0xa')](function(_0x55ae64){logger[_0x9266('0xb')]('CreateVoiceDialReport',_0x34186e);logger['debug'](_0x9266('0x16'),_0x34186e,JSON['stringify'](_0x55ae64));_0x47a998(_0x55ae64);})['catch'](function(_0x2a48f8){logger[_0x9266('0x11')](_0x9266('0x16'),_0x2a48f8[_0x9266('0x13')],_0x34186e);_0x50d6d3(_0xf7101b[_0x9266('0x11')](0x1f4,_0x2a48f8[_0x9266('0x13')]));});});};exports[_0x9266('0x1b')]=function(_0x27a9d0){var _0x16ca7d=this;return new Promise(function(_0x5088cc,_0x4dfc49){return db[_0x9266('0x17')][_0x9266('0x1c')](_0x27a9d0[_0x9266('0x1d')],{'raw':_0x27a9d0[_0x9266('0x19')]?_0x27a9d0['options'][_0x9266('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27a9d0['options']?_0x27a9d0[_0x9266('0x19')][_0x9266('0x1e')]||null:null,'attributes':_0x27a9d0[_0x9266('0x19')]?_0x27a9d0[_0x9266('0x19')][_0x9266('0x1f')]||null:null,'limit':_0x27a9d0[_0x9266('0x19')]?_0x27a9d0['options'][_0x9266('0x20')]||null:null})['then'](function(_0x62e410){logger[_0x9266('0xb')](_0x9266('0x1b'),_0x27a9d0);logger[_0x9266('0xe')](_0x9266('0x1b'),_0x27a9d0,JSON[_0x9266('0x10')](_0x62e410));_0x5088cc(_0x62e410);})['catch'](function(_0x4708f0){logger[_0x9266('0x11')](_0x9266('0x1b'),_0x4708f0[_0x9266('0x13')],_0x27a9d0);_0x4dfc49(_0x16ca7d[_0x9266('0x11')](0x1f4,_0x4708f0[_0x9266('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ad04bbc..1fd5e5f 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 _0xc049=['create','/:id/applications','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x14672d,_0x593b3e){var _0x21d0b8=function(_0x535a3f){while(--_0x535a3f){_0x14672d['push'](_0x14672d['shift']());}};_0x21d0b8(++_0x593b3e);}(_0xc049,0x8c));var _0x9c04=function(_0x4ca42d,_0x19fdb0){_0x4ca42d=_0x4ca42d-0x0;var _0x53c5ac=_0xc049[_0x4ca42d];return _0x53c5ac;};'use strict';var multer=require(_0x9c04('0x0'));var util=require(_0x9c04('0x1'));var path=require(_0x9c04('0x2'));var timeout=require(_0x9c04('0x3'));var express=require(_0x9c04('0x4'));var router=express[_0x9c04('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9c04('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x9c04('0x7')]('/',auth[_0x9c04('0x8')](),controller[_0x9c04('0x9')]);router[_0x9c04('0x7')](_0x9c04('0xa'),auth[_0x9c04('0x8')](),controller[_0x9c04('0xb')]);router[_0x9c04('0xc')]('/',auth['isAuthenticated'](),controller[_0x9c04('0xd')]);router[_0x9c04('0xc')](_0x9c04('0xe'),auth[_0x9c04('0x8')](),controller['addApplications']);router['put'](_0x9c04('0xa'),auth[_0x9c04('0x8')](),controller[_0x9c04('0xf')]);router['delete'](_0x9c04('0xa'),auth[_0x9c04('0x8')](),controller['destroy']);module[_0x9c04('0x10')]=router; \ No newline at end of file +var _0xfa45=['exports','util','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','post','create','/:id/applications','addApplications','/:id','update','destroy'];(function(_0xfa847c,_0x444a8c){var _0x3b22bf=function(_0x32de11){while(--_0x32de11){_0xfa847c['push'](_0xfa847c['shift']());}};_0x3b22bf(++_0x444a8c);}(_0xfa45,0xc1));var _0x5fa4=function(_0x432461,_0x4ec44d){_0x432461=_0x432461-0x0;var _0x3db739=_0xfa45[_0x432461];return _0x3db739;};'use strict';var multer=require('multer');var util=require(_0x5fa4('0x0'));var path=require('path');var timeout=require(_0x5fa4('0x1'));var express=require(_0x5fa4('0x2'));var router=express[_0x5fa4('0x3')]();var fs_extra=require(_0x5fa4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x5fa4('0x5')]('/',auth[_0x5fa4('0x6')](),controller[_0x5fa4('0x7')]);router[_0x5fa4('0x5')]('/:id',auth[_0x5fa4('0x6')](),controller['show']);router[_0x5fa4('0x8')]('/',auth[_0x5fa4('0x6')](),controller[_0x5fa4('0x9')]);router[_0x5fa4('0x8')](_0x5fa4('0xa'),auth[_0x5fa4('0x6')](),controller[_0x5fa4('0xb')]);router['put'](_0x5fa4('0xc'),auth[_0x5fa4('0x6')](),controller[_0x5fa4('0xd')]);router['delete'](_0x5fa4('0xc'),auth[_0x5fa4('0x6')](),controller[_0x5fa4('0xe')]);module[_0x5fa4('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 c37bd8e..12541bb 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 _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x2ab7a8,_0x177682){var _0x342299=function(_0x1ab348){while(--_0x1ab348){_0x2ab7a8['push'](_0x2ab7a8['shift']());}};_0x342299(++_0x177682);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file +var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x287468,_0x331ffc){var _0x5bf263=function(_0x37168a){while(--_0x37168a){_0x287468['push'](_0x287468['shift']());}};_0x5bf263(++_0x331ffc);}(_0xe706,0xa3));var _0x6e70=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0xe706[_0x77e7e8];return _0x205a3e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 46e3aa0..fff7f33 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 _0xeaf2=['end','status','json','offset','limit','undefined','count','Content-Range','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','name','UserProfileResource','then','error','stack','VoiceExtension','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','create','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','description','recordingFormat','cutdigits','alias','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','findAndCountAll','finally','send','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xeaf2,0xfe));var _0x2eaf=function(_0x4225aa,_0x582bf2){_0x4225aa=_0x4225aa-0x0;var _0x3f8fab=_0xeaf2[_0x4225aa];return _0x3f8fab;};'use strict';var _=require('lodash');var Redis=require(_0x2eaf('0x0'));var qs=require(_0x2eaf('0x1'));var logger=require('../../config/logger')('api');var config=require(_0x2eaf('0x2'));var db=require(_0x2eaf('0x3'))['db'];config[_0x2eaf('0x4')]=_['defaults'](config[_0x2eaf('0x4')],{'host':_0x2eaf('0x5'),'port':0x18eb});var socket=require(_0x2eaf('0x6'))(new Redis(config[_0x2eaf('0x4')]));require(_0x2eaf('0x7'))[_0x2eaf('0x8')](socket);function respondWithStatusCode(_0x410e72,_0x4a341e){_0x4a341e=_0x4a341e||0xcc;return function(_0x116daa){if(_0x116daa){return _0x410e72[_0x2eaf('0x9')](_0x4a341e);}return _0x410e72['status'](_0x4a341e)[_0x2eaf('0xa')]();};}function respondWithResult(_0x5c29d6,_0x442473){_0x442473=_0x442473||0xc8;return function(_0x36855b){if(_0x36855b){return _0x5c29d6[_0x2eaf('0xb')](_0x442473)[_0x2eaf('0xc')](_0x36855b);}};}function respondWithFilteredResult(_0x42344d,_0x3c0b42){return function(_0x380ca8){if(_0x380ca8){var _0x57e5b9=typeof _0x3c0b42[_0x2eaf('0xd')]==='undefined'&&typeof _0x3c0b42[_0x2eaf('0xe')]===_0x2eaf('0xf');var _0x21f55a=_0x380ca8[_0x2eaf('0x10')];var _0x2c61cd=_0x57e5b9?0x0:_0x3c0b42[_0x2eaf('0xd')];var _0x46ff7c=_0x57e5b9?_0x380ca8[_0x2eaf('0x10')]:_0x3c0b42['offset']+_0x3c0b42[_0x2eaf('0xe')];var _0xaeeefa;if(_0x46ff7c>=_0x21f55a){_0x46ff7c=_0x21f55a;_0xaeeefa=0xc8;}else{_0xaeeefa=0xce;}_0x42344d[_0x2eaf('0xb')](_0xaeeefa);return _0x42344d['set'](_0x2eaf('0x11'),_0x2c61cd+'-'+_0x46ff7c+'/'+_0x21f55a)[_0x2eaf('0xc')](_0x380ca8);}return null;};}function removeEntity(_0x613a18){return function(_0x17cbb8){if(_0x17cbb8){return _0x17cbb8[_0x2eaf('0x12')]()['then'](function(){var _0xa5df54=_0x17cbb8[_0x2eaf('0x13')]({'plain':!![]});var _0x37162b=[{'name':'InboundRoutes','value':_0x2eaf('0x14'),'ignore':![]},{'name':_0x2eaf('0x15'),'value':_0x2eaf('0x16'),'ignore':![]},{'name':_0x2eaf('0x17'),'value':_0x2eaf('0x18'),'ignore':![]}];var _0x3ace03=_(_0x37162b)['filter'](_0x2eaf('0x19'))[_0x2eaf('0x1a')](_0x2eaf('0x1b'))[_0x2eaf('0x1b')]();if(_[_0x2eaf('0x1c')](_0x3ace03,_0xa5df54['type'])){return;}var _0x12acde=_[_0x2eaf('0x1d')](_0x37162b,['value',_0xa5df54[_0x2eaf('0x1e')]])[_0x2eaf('0x1f')];return db[_0x2eaf('0x20')][_0x2eaf('0x12')]({'where':{'type':_0x12acde,'resourceId':_0xa5df54['id']}})[_0x2eaf('0x21')](function(){return _0x17cbb8;});})[_0x2eaf('0x21')](function(){_0x613a18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x319ad4){return function(_0x123de5){if(!_0x123de5){_0x319ad4[_0x2eaf('0x9')](0x194);}return _0x123de5;};}function handleError(_0x394fea,_0x11b043){_0x11b043=_0x11b043||0x1f4;return function(_0x548c70){logger[_0x2eaf('0x22')](_0x548c70[_0x2eaf('0x23')]);if(_0x548c70[_0x2eaf('0x1f')]){delete _0x548c70[_0x2eaf('0x1f')];}_0x394fea['status'](_0x11b043)['send'](_0x548c70);};}exports['index']=function(_0x22f00a,_0x41dc64){var _0x5d7ac0={},_0xd87345={},_0x5b4763={'count':0x0,'rows':[]};var _0x15d30d=_[_0x2eaf('0x1a')](db[_0x2eaf('0x24')][_0x2eaf('0x25')],function(_0x50cd05){return{'name':_0x50cd05[_0x2eaf('0x26')],'type':_0x50cd05[_0x2eaf('0x1e')]['key']};});_0xd87345[_0x2eaf('0x27')]=_['map'](_0x15d30d,_0x2eaf('0x1f'));_0xd87345[_0x2eaf('0x28')]=_['keys'](_0x22f00a[_0x2eaf('0x28')]);_0xd87345[_0x2eaf('0x29')]=_[_0x2eaf('0x2a')](_0xd87345[_0x2eaf('0x27')],_0xd87345[_0x2eaf('0x28')]);_0x5d7ac0[_0x2eaf('0x2b')]=_[_0x2eaf('0x2a')](_0xd87345[_0x2eaf('0x27')],qs[_0x2eaf('0x2c')](_0x22f00a[_0x2eaf('0x28')][_0x2eaf('0x2c')]));_0x5d7ac0[_0x2eaf('0x2b')]=_0x5d7ac0[_0x2eaf('0x2b')]['length']?_0x5d7ac0['attributes']:_0xd87345[_0x2eaf('0x27')];if(!_0x22f00a[_0x2eaf('0x28')][_0x2eaf('0x2d')]('nolimit')){_0x5d7ac0['limit']=qs[_0x2eaf('0xe')](_0x22f00a['query'][_0x2eaf('0xe')]);_0x5d7ac0[_0x2eaf('0xd')]=qs[_0x2eaf('0xd')](_0x22f00a['query']['offset']);}_0x5d7ac0['order']=qs[_0x2eaf('0x2e')](_0x22f00a[_0x2eaf('0x28')][_0x2eaf('0x2e')]);_0x5d7ac0[_0x2eaf('0x2f')]=qs['filters'](_[_0x2eaf('0x30')](_0x22f00a[_0x2eaf('0x28')],_0xd87345['filters']),_0x15d30d);if(_0x22f00a['query'][_0x2eaf('0x31')]){_0x5d7ac0['where']=_[_0x2eaf('0x32')](_0x5d7ac0['where'],{'$or':_[_0x2eaf('0x1a')](_0x15d30d,function(_0x144c1d){if(_0x144c1d[_0x2eaf('0x1e')]!==_0x2eaf('0x33')){var _0x4b53f5={};_0x4b53f5[_0x144c1d['name']]={'$like':'%'+_0x22f00a[_0x2eaf('0x28')]['filter']+'%'};return _0x4b53f5;}})});}_0x5d7ac0=_[_0x2eaf('0x32')]({},_0x5d7ac0,_0x22f00a[_0x2eaf('0x34')]);var _0x45ee74={'where':_0x5d7ac0[_0x2eaf('0x2f')]};return db['VoiceExtension'][_0x2eaf('0x10')](_0x45ee74)[_0x2eaf('0x21')](function(_0x1dcac7){_0x5b4763[_0x2eaf('0x10')]=_0x1dcac7;if(_0x22f00a[_0x2eaf('0x28')][_0x2eaf('0x35')]){_0x5d7ac0[_0x2eaf('0x36')]=[{'all':!![]}];}return db[_0x2eaf('0x24')][_0x2eaf('0x37')](_0x5d7ac0);})[_0x2eaf('0x21')](function(_0x557fd6){_0x5b4763[_0x2eaf('0x38')]=_0x557fd6;return _0x5b4763;})[_0x2eaf('0x21')](respondWithFilteredResult(_0x41dc64,_0x5d7ac0))['catch'](handleError(_0x41dc64,null));};exports[_0x2eaf('0x39')]=function(_0x3cfeac,_0x501076){var _0x452100={'raw':![],'where':{'id':_0x3cfeac[_0x2eaf('0x3a')]['id']}},_0x9a3bde={};_0x9a3bde[_0x2eaf('0x27')]=_[_0x2eaf('0x3b')](db[_0x2eaf('0x24')][_0x2eaf('0x25')]);_0x9a3bde['query']=_['keys'](_0x3cfeac[_0x2eaf('0x28')]);_0x9a3bde[_0x2eaf('0x29')]=_[_0x2eaf('0x2a')](_0x9a3bde['model'],_0x9a3bde[_0x2eaf('0x28')]);_0x452100[_0x2eaf('0x2b')]=_[_0x2eaf('0x2a')](_0x9a3bde['model'],qs['fields'](_0x3cfeac[_0x2eaf('0x28')][_0x2eaf('0x2c')]));_0x452100[_0x2eaf('0x2b')]=_0x452100[_0x2eaf('0x2b')][_0x2eaf('0x3c')]?_0x452100['attributes']:_0x9a3bde[_0x2eaf('0x27')];if(_0x3cfeac[_0x2eaf('0x28')][_0x2eaf('0x35')]){_0x452100[_0x2eaf('0x36')]=[{'all':!![]}];}_0x452100=_[_0x2eaf('0x32')]({},_0x452100,_0x3cfeac['options']);return db[_0x2eaf('0x24')]['find'](_0x452100)[_0x2eaf('0x21')](handleEntityNotFound(_0x501076,null))[_0x2eaf('0x21')](respondWithResult(_0x501076,null))['catch'](handleError(_0x501076,null));};exports[_0x2eaf('0x12')]=function(_0x33a6db,_0x332791){return db[_0x2eaf('0x24')][_0x2eaf('0x1d')]({'where':{'id':_0x33a6db[_0x2eaf('0x3a')]['id']}})['then'](handleEntityNotFound(_0x332791,null))[_0x2eaf('0x21')](removeEntity(_0x332791,null))['catch'](handleError(_0x332791,null));};exports[_0x2eaf('0x3d')]=function(_0x6a11c0,_0x549512){if(_0x6a11c0['body'][_0x2eaf('0x1e')]===_0x2eaf('0x16')&&!_['startsWith'](_0x6a11c0['body'][_0x2eaf('0x3e')],'_')){_0x6a11c0[_0x2eaf('0x3f')]['exten']='_'[_0x2eaf('0x40')](_0x6a11c0[_0x2eaf('0x3f')]['exten']);}return db[_0x2eaf('0x24')]['create'](_0x6a11c0[_0x2eaf('0x3f')],{'raw':![]})['then'](function(_0x255250){var _0x5051f6=_0x6a11c0[_0x2eaf('0x41')][_0x2eaf('0x13')]({'plain':!![]});if(!_0x5051f6)throw new Error(_0x2eaf('0x42'));if(_0x5051f6[_0x2eaf('0x43')]===_0x2eaf('0x41')){var _0x245e9f=_0x255250[_0x2eaf('0x13')]({'plain':!![]});var _0x59cc06=[{'name':_0x2eaf('0x44'),'value':_0x2eaf('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x2eaf('0x17'),'value':'internal'}];var _0x57fa3b=_[_0x2eaf('0x1d')](_0x59cc06,[_0x2eaf('0x1b'),_0x245e9f[_0x2eaf('0x1e')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x57fa3b,'userProfileId':_0x5051f6[_0x2eaf('0x45')]},'raw':!![]})[_0x2eaf('0x21')](function(_0x1fcb51){if(_0x1fcb51&&_0x1fcb51[_0x2eaf('0x46')]===0x0){return db[_0x2eaf('0x20')]['create']({'name':_0x245e9f['name'],'resourceId':_0x245e9f['id'],'type':_0x1fcb51['name'],'sectionId':_0x1fcb51['id']},{})[_0x2eaf('0x21')](function(){return _0x255250;});}else{return _0x255250;}})['catch'](function(_0x50a8ca){logger[_0x2eaf('0x22')](_0x2eaf('0x47'),_0x50a8ca);throw _0x50a8ca;});}return _0x255250;})[_0x2eaf('0x21')](respondWithResult(_0x549512,0xc9))[_0x2eaf('0x48')](handleError(_0x549512,null));};exports[_0x2eaf('0x49')]=function(_0x4141da,_0x1e3be4){if(_0x4141da[_0x2eaf('0x3f')]['id']){delete _0x4141da[_0x2eaf('0x3f')]['id'];}return db[_0x2eaf('0x24')][_0x2eaf('0x1d')]({'where':{'id':_0x4141da['params']['id']}})[_0x2eaf('0x21')](handleEntityNotFound(_0x1e3be4,null))['then'](function(_0x38fd19){if(_0x38fd19){return db[_0x2eaf('0x24')][_0x2eaf('0x49')](_[_0x2eaf('0x30')](_0x4141da[_0x2eaf('0x3f')],[_0x2eaf('0x3e'),'context',_0x2eaf('0x4a'),_0x2eaf('0x4b'),_0x2eaf('0x4c'),'mandatoryDisposition',_0x2eaf('0x4d')]),{'where':{'context':_0x38fd19['context'],'exten':_0x38fd19[_0x2eaf('0x3e')]},'individualHooks':!![]})[_0x2eaf('0x21')](function(_0x342380){return _0x342380;});}return null;})['then'](respondWithStatusCode(_0x1e3be4,null))[_0x2eaf('0x48')](handleError(_0x1e3be4,null));};exports['addApplications']=function(_0x48e799,_0x27a437){var _0x332913=_0x48e799[_0x2eaf('0x3a')]['id'];var _0x2199f2=_0x48e799[_0x2eaf('0x3f')];var _0x242dc1=0xc8;var _0x325d37=null;return db[_0x2eaf('0x4e')][_0x2eaf('0x4f')]({'isolationLevel':db[_0x2eaf('0x4e')][_0x2eaf('0x50')]['ISOLATION_LEVELS'][_0x2eaf('0x51')]},function(_0x500949){return db[_0x2eaf('0x24')][_0x2eaf('0x52')]({'where':{'id':_0x332913},'transaction':_0x500949})[_0x2eaf('0x21')](function(_0x169311){if(_0x169311){return db[_0x2eaf('0x24')][_0x2eaf('0x12')]({'where':{'VoiceExtensionId':_0x332913},'transaction':_0x500949})['then'](function(){var _0x361458=_[_0x2eaf('0x1a')](_0x2199f2,function(_0x125d36){_0x125d36[_0x2eaf('0x53')]=_0x332913;_0x125d36['isApp']=!![];return _0x125d36;});return _0x169311[_0x2eaf('0x54')](_0x361458);})[_0x2eaf('0x21')](function(_0x536503){return db[_0x2eaf('0x24')]['bulkCreate'](_0x536503,{'transaction':_0x500949});});}else{_0x242dc1=0x194;_0x325d37=[];}});})[_0x2eaf('0x21')](function(){if(_0x242dc1!==0x194){return db['VoiceExtension'][_0x2eaf('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x332913},'order':'cast(priority\x20as\x20unsigned)'})[_0x2eaf('0x21')](function(_0x247b26){_0x325d37=_0x247b26;});}})[_0x2eaf('0x48')](function(_0x1d77e6){_0x242dc1=0x1f4;logger['error'](_0x1d77e6[_0x2eaf('0x23')]);if(_0x1d77e6[_0x2eaf('0x1f')]){delete _0x1d77e6[_0x2eaf('0x1f')];}_0x325d37=_0x1d77e6;})[_0x2eaf('0x56')](function(){if(_0x325d37===null){_0x27a437[_0x2eaf('0x9')](_0x242dc1);}else{if(_0x242dc1===0x1f4){_0x27a437[_0x2eaf('0xb')](_0x242dc1)[_0x2eaf('0x57')](_0x325d37);}else{_0x27a437[_0x2eaf('0xb')](_0x242dc1)['json'](_0x325d37);}}});}; \ No newline at end of file +var _0x953d=['InternalRoutes','internal','ignore','map','value','includes','find','end','error','name','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','rows','catch','show','rawAttributes','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','context','description','cutdigits','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x953d,0x15e));var _0xd953=function(_0x2a7b2d,_0x4ef7ca){_0x2a7b2d=_0x2a7b2d-0x0;var _0x606a57=_0x953d[_0x2a7b2d];return _0x606a57;};'use strict';var _=require(_0xd953('0x0'));var Redis=require(_0xd953('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd953('0x2'))(_0xd953('0x3'));var config=require(_0xd953('0x4'));var db=require(_0xd953('0x5'))['db'];config[_0xd953('0x6')]=_[_0xd953('0x7')](config[_0xd953('0x6')],{'host':_0xd953('0x8'),'port':0x18eb});var socket=require(_0xd953('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xd953('0xa')](socket);function respondWithStatusCode(_0x2e2542,_0x4a0104){_0x4a0104=_0x4a0104||0xcc;return function(_0x205433){if(_0x205433){return _0x2e2542[_0xd953('0xb')](_0x4a0104);}return _0x2e2542[_0xd953('0xc')](_0x4a0104)['end']();};}function respondWithResult(_0x23970e,_0x22eb7e){_0x22eb7e=_0x22eb7e||0xc8;return function(_0x419ab2){if(_0x419ab2){return _0x23970e[_0xd953('0xc')](_0x22eb7e)[_0xd953('0xd')](_0x419ab2);}};}function respondWithFilteredResult(_0x474672,_0x2d6158){return function(_0x18354b){if(_0x18354b){var _0x7ca8a1=typeof _0x2d6158[_0xd953('0xe')]===_0xd953('0xf')&&typeof _0x2d6158[_0xd953('0x10')]==='undefined';var _0x1dd3a4=_0x18354b[_0xd953('0x11')];var _0x46b7db=_0x7ca8a1?0x0:_0x2d6158[_0xd953('0xe')];var _0xb775ec=_0x7ca8a1?_0x18354b[_0xd953('0x11')]:_0x2d6158[_0xd953('0xe')]+_0x2d6158[_0xd953('0x10')];var _0x4b7ed3;if(_0xb775ec>=_0x1dd3a4){_0xb775ec=_0x1dd3a4;_0x4b7ed3=0xc8;}else{_0x4b7ed3=0xce;}_0x474672[_0xd953('0xc')](_0x4b7ed3);return _0x474672[_0xd953('0x12')](_0xd953('0x13'),_0x46b7db+'-'+_0xb775ec+'/'+_0x1dd3a4)['json'](_0x18354b);}return null;};}function removeEntity(_0x3c54f4){return function(_0x34c611){if(_0x34c611){return _0x34c611[_0xd953('0x14')]()[_0xd953('0x15')](function(){var _0xe53cf0=_0x34c611[_0xd953('0x16')]({'plain':!![]});var _0x2cad09=[{'name':'InboundRoutes','value':_0xd953('0x17'),'ignore':![]},{'name':_0xd953('0x18'),'value':_0xd953('0x19'),'ignore':![]},{'name':_0xd953('0x1a'),'value':_0xd953('0x1b'),'ignore':![]}];var _0x16346e=_(_0x2cad09)['filter'](_0xd953('0x1c'))[_0xd953('0x1d')](_0xd953('0x1e'))[_0xd953('0x1e')]();if(_[_0xd953('0x1f')](_0x16346e,_0xe53cf0['type'])){return;}var _0x531f4e=_[_0xd953('0x20')](_0x2cad09,[_0xd953('0x1e'),_0xe53cf0['type']])['name'];return db['UserProfileResource'][_0xd953('0x14')]({'where':{'type':_0x531f4e,'resourceId':_0xe53cf0['id']}})[_0xd953('0x15')](function(){return _0x34c611;});})[_0xd953('0x15')](function(){_0x3c54f4['status'](0xcc)[_0xd953('0x21')]();});}};}function handleEntityNotFound(_0x6da868){return function(_0x38afbc){if(!_0x38afbc){_0x6da868[_0xd953('0xb')](0x194);}return _0x38afbc;};}function handleError(_0x1e8971,_0x579ab4){_0x579ab4=_0x579ab4||0x1f4;return function(_0x4822ce){logger[_0xd953('0x22')](_0x4822ce['stack']);if(_0x4822ce['name']){delete _0x4822ce[_0xd953('0x23')];}_0x1e8971[_0xd953('0xc')](_0x579ab4)[_0xd953('0x24')](_0x4822ce);};}exports[_0xd953('0x25')]=function(_0x4b48dc,_0x2a5e8b){var _0x39f2cd={},_0x1eaa0b={},_0x26a069={'count':0x0,'rows':[]};var _0x1f72e1=_[_0xd953('0x1d')](db[_0xd953('0x26')]['rawAttributes'],function(_0x5751db){return{'name':_0x5751db[_0xd953('0x27')],'type':_0x5751db['type'][_0xd953('0x28')]};});_0x1eaa0b[_0xd953('0x29')]=_[_0xd953('0x1d')](_0x1f72e1,_0xd953('0x23'));_0x1eaa0b[_0xd953('0x2a')]=_[_0xd953('0x2b')](_0x4b48dc[_0xd953('0x2a')]);_0x1eaa0b[_0xd953('0x2c')]=_[_0xd953('0x2d')](_0x1eaa0b[_0xd953('0x29')],_0x1eaa0b['query']);_0x39f2cd['attributes']=_['intersection'](_0x1eaa0b['model'],qs[_0xd953('0x2e')](_0x4b48dc['query'][_0xd953('0x2e')]));_0x39f2cd[_0xd953('0x2f')]=_0x39f2cd[_0xd953('0x2f')][_0xd953('0x30')]?_0x39f2cd[_0xd953('0x2f')]:_0x1eaa0b['model'];if(!_0x4b48dc[_0xd953('0x2a')][_0xd953('0x31')](_0xd953('0x32'))){_0x39f2cd[_0xd953('0x10')]=qs['limit'](_0x4b48dc[_0xd953('0x2a')][_0xd953('0x10')]);_0x39f2cd['offset']=qs['offset'](_0x4b48dc['query'][_0xd953('0xe')]);}_0x39f2cd[_0xd953('0x33')]=qs[_0xd953('0x34')](_0x4b48dc['query'][_0xd953('0x34')]);_0x39f2cd[_0xd953('0x35')]=qs[_0xd953('0x2c')](_['pick'](_0x4b48dc['query'],_0x1eaa0b['filters']),_0x1f72e1);if(_0x4b48dc[_0xd953('0x2a')][_0xd953('0x36')]){_0x39f2cd[_0xd953('0x35')]=_[_0xd953('0x37')](_0x39f2cd[_0xd953('0x35')],{'$or':_['map'](_0x1f72e1,function(_0x2c3b96){if(_0x2c3b96[_0xd953('0x38')]!==_0xd953('0x39')){var _0x428007={};_0x428007[_0x2c3b96[_0xd953('0x23')]]={'$like':'%'+_0x4b48dc['query'][_0xd953('0x36')]+'%'};return _0x428007;}})});}_0x39f2cd=_['merge']({},_0x39f2cd,_0x4b48dc[_0xd953('0x3a')]);var _0x16b426={'where':_0x39f2cd[_0xd953('0x35')]};return db['VoiceExtension'][_0xd953('0x11')](_0x16b426)[_0xd953('0x15')](function(_0x3965aa){_0x26a069[_0xd953('0x11')]=_0x3965aa;if(_0x4b48dc[_0xd953('0x2a')]['includeAll']){_0x39f2cd[_0xd953('0x3b')]=[{'all':!![]}];}return db[_0xd953('0x26')]['findAll'](_0x39f2cd);})[_0xd953('0x15')](function(_0x29ba8f){_0x26a069[_0xd953('0x3c')]=_0x29ba8f;return _0x26a069;})['then'](respondWithFilteredResult(_0x2a5e8b,_0x39f2cd))[_0xd953('0x3d')](handleError(_0x2a5e8b,null));};exports[_0xd953('0x3e')]=function(_0x2319ef,_0x2cccdb){var _0x17deb0={'raw':![],'where':{'id':_0x2319ef['params']['id']}},_0x1a1660={};_0x1a1660[_0xd953('0x29')]=_['keys'](db[_0xd953('0x26')][_0xd953('0x3f')]);_0x1a1660[_0xd953('0x2a')]=_[_0xd953('0x2b')](_0x2319ef[_0xd953('0x2a')]);_0x1a1660[_0xd953('0x2c')]=_[_0xd953('0x2d')](_0x1a1660['model'],_0x1a1660[_0xd953('0x2a')]);_0x17deb0[_0xd953('0x2f')]=_[_0xd953('0x2d')](_0x1a1660[_0xd953('0x29')],qs[_0xd953('0x2e')](_0x2319ef['query'][_0xd953('0x2e')]));_0x17deb0[_0xd953('0x2f')]=_0x17deb0[_0xd953('0x2f')][_0xd953('0x30')]?_0x17deb0[_0xd953('0x2f')]:_0x1a1660[_0xd953('0x29')];if(_0x2319ef[_0xd953('0x2a')]['includeAll']){_0x17deb0[_0xd953('0x3b')]=[{'all':!![]}];}_0x17deb0=_[_0xd953('0x37')]({},_0x17deb0,_0x2319ef[_0xd953('0x3a')]);return db['VoiceExtension'][_0xd953('0x20')](_0x17deb0)[_0xd953('0x15')](handleEntityNotFound(_0x2cccdb,null))['then'](respondWithResult(_0x2cccdb,null))[_0xd953('0x3d')](handleError(_0x2cccdb,null));};exports['destroy']=function(_0x6f6013,_0x5979bb){return db[_0xd953('0x26')][_0xd953('0x20')]({'where':{'id':_0x6f6013['params']['id']}})[_0xd953('0x15')](handleEntityNotFound(_0x5979bb,null))[_0xd953('0x15')](removeEntity(_0x5979bb,null))[_0xd953('0x3d')](handleError(_0x5979bb,null));};exports[_0xd953('0x40')]=function(_0x4fdd85,_0x23d975){if(_0x4fdd85[_0xd953('0x41')]['type']===_0xd953('0x19')&&!_[_0xd953('0x42')](_0x4fdd85['body'][_0xd953('0x43')],'_')){_0x4fdd85[_0xd953('0x41')][_0xd953('0x43')]='_'[_0xd953('0x44')](_0x4fdd85[_0xd953('0x41')]['exten']);}return db[_0xd953('0x26')]['create'](_0x4fdd85['body'],{'raw':![]})[_0xd953('0x15')](function(_0x1efcdb){var _0x357a98=_0x4fdd85[_0xd953('0x45')][_0xd953('0x16')]({'plain':!![]});if(!_0x357a98)throw new Error(_0xd953('0x46'));if(_0x357a98[_0xd953('0x47')]===_0xd953('0x45')){var _0x2049bf=_0x1efcdb['get']({'plain':!![]});var _0x554a60=[{'name':'InboundRoutes','value':_0xd953('0x17')},{'name':_0xd953('0x18'),'value':'outbound'},{'name':_0xd953('0x1a'),'value':_0xd953('0x1b')}];var _0xbc25e6=_['find'](_0x554a60,[_0xd953('0x1e'),_0x2049bf['type']])[_0xd953('0x23')];return db[_0xd953('0x48')][_0xd953('0x20')]({'where':{'name':_0xbc25e6,'userProfileId':_0x357a98['userProfileId']},'raw':!![]})['then'](function(_0x1d5bb1){if(_0x1d5bb1&&_0x1d5bb1[_0xd953('0x49')]===0x0){return db[_0xd953('0x4a')][_0xd953('0x40')]({'name':_0x2049bf[_0xd953('0x23')],'resourceId':_0x2049bf['id'],'type':_0x1d5bb1[_0xd953('0x23')],'sectionId':_0x1d5bb1['id']},{})['then'](function(){return _0x1efcdb;});}else{return _0x1efcdb;}})['catch'](function(_0x343196){logger[_0xd953('0x22')](_0xd953('0x4b'),_0x343196);throw _0x343196;});}return _0x1efcdb;})[_0xd953('0x15')](respondWithResult(_0x23d975,0xc9))[_0xd953('0x3d')](handleError(_0x23d975,null));};exports[_0xd953('0x4c')]=function(_0x5ae855,_0x31c95f){if(_0x5ae855['body']['id']){delete _0x5ae855['body']['id'];}return db[_0xd953('0x26')][_0xd953('0x20')]({'where':{'id':_0x5ae855[_0xd953('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31c95f,null))[_0xd953('0x15')](function(_0x20d5f7){if(_0x20d5f7){return db[_0xd953('0x26')][_0xd953('0x4c')](_['pick'](_0x5ae855[_0xd953('0x41')],[_0xd953('0x43'),_0xd953('0x4e'),_0xd953('0x4f'),'recordingFormat',_0xd953('0x50'),'mandatoryDisposition','alias']),{'where':{'context':_0x20d5f7[_0xd953('0x4e')],'exten':_0x20d5f7[_0xd953('0x43')]},'individualHooks':!![]})[_0xd953('0x15')](function(_0x12d865){return _0x12d865;});}return null;})['then'](respondWithStatusCode(_0x31c95f,null))['catch'](handleError(_0x31c95f,null));};exports[_0xd953('0x51')]=function(_0x355f3e,_0x1918a8){var _0x28de9a=_0x355f3e['params']['id'];var _0x5c5aae=_0x355f3e[_0xd953('0x41')];var _0x562216=0xc8;var _0x4b3df3=null;return db[_0xd953('0x52')][_0xd953('0x53')]({'isolationLevel':db['sequelize'][_0xd953('0x54')]['ISOLATION_LEVELS'][_0xd953('0x55')]},function(_0x4a7617){return db['VoiceExtension'][_0xd953('0x56')]({'where':{'id':_0x28de9a},'transaction':_0x4a7617})[_0xd953('0x15')](function(_0x417ebc){if(_0x417ebc){return db[_0xd953('0x26')][_0xd953('0x14')]({'where':{'VoiceExtensionId':_0x28de9a},'transaction':_0x4a7617})[_0xd953('0x15')](function(){var _0x396e79=_[_0xd953('0x1d')](_0x5c5aae,function(_0xf436ba){_0xf436ba[_0xd953('0x57')]=_0x28de9a;_0xf436ba[_0xd953('0x58')]=!![];return _0xf436ba;});return _0x417ebc[_0xd953('0x59')](_0x396e79);})[_0xd953('0x15')](function(_0x48d43a){return db['VoiceExtension']['bulkCreate'](_0x48d43a,{'transaction':_0x4a7617});});}else{_0x562216=0x194;_0x4b3df3=[];}});})['then'](function(){if(_0x562216!==0x194){return db[_0xd953('0x26')][_0xd953('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x28de9a},'order':_0xd953('0x5b')})[_0xd953('0x15')](function(_0x570ddf){_0x4b3df3=_0x570ddf;});}})['catch'](function(_0x54adfe){_0x562216=0x1f4;logger['error'](_0x54adfe[_0xd953('0x5c')]);if(_0x54adfe[_0xd953('0x23')]){delete _0x54adfe[_0xd953('0x23')];}_0x4b3df3=_0x54adfe;})[_0xd953('0x5d')](function(){if(_0x4b3df3===null){_0x1918a8['sendStatus'](_0x562216);}else{if(_0x562216===0x1f4){_0x1918a8[_0xd953('0xc')](_0x562216)[_0xd953('0x24')](_0x4b3df3);}else{_0x1918a8['status'](_0x562216)[_0xd953('0xd')](_0x4b3df3);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 107f3ec..ae00b27 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 _0x0f74=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0f74,0x14c));var _0x40f7=function(_0x21a735,_0xa8f5a3){_0x21a735=_0x21a735-0x0;var _0xcfd1bb=_0x0f74[_0x21a735];return _0xcfd1bb;};'use strict';var EventEmitter=require(_0x40f7('0x0'));var VoiceExtension=require(_0x40f7('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x40f7('0x2')](0x0);var events={'afterCreate':_0x40f7('0x3'),'afterUpdate':_0x40f7('0x4'),'afterDestroy':_0x40f7('0x5')};function emitEvent(_0x58b3d5){return function(_0xa7ef3d,_0x3a2fa5,_0x32def9){VoiceExtensionEvents[_0x40f7('0x6')](_0x58b3d5+':'+_0xa7ef3d['id'],_0xa7ef3d);VoiceExtensionEvents['emit'](_0x58b3d5,_0xa7ef3d);_0x32def9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x40f7('0x7')](e,emitEvent(event));}}module[_0x40f7('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x806e=['setMaxListeners','save','emit','hook','exports','../../mysqldb','VoiceExtension'];(function(_0x414d4c,_0x2b0ddb){var _0x167700=function(_0x522599){while(--_0x522599){_0x414d4c['push'](_0x414d4c['shift']());}};_0x167700(++_0x2b0ddb);}(_0x806e,0x12b));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xe806('0x0'))['db'][_0xe806('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe806('0x2')](0x0);var events={'afterCreate':_0xe806('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ca5e0){return function(_0x515e69,_0x53e97c,_0x2d85fa){VoiceExtensionEvents['emit'](_0x4ca5e0+':'+_0x515e69['id'],_0x515e69);VoiceExtensionEvents[_0xe806('0x4')](_0x4ca5e0,_0x515e69);_0x2d85fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xe806('0x5')](e,emitEvent(event));}}module[_0xe806('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index e1c4cb3..6649def 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 _0xf115=['timeout','options','url','length','name','trunk','param','split','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','hasOwnProperty','tag','CDR(tag)=','toLowerCase','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','Hangup','./voiceExtension.attributes','exports','models','type','Set','exten','inbound','push','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0xf61129,_0x523668){var _0xefa38a=function(_0x3c965f){while(--_0x3c965f){_0xf61129['push'](_0xf61129['shift']());}};_0xefa38a(++_0x523668);}(_0xf115,0x1c8));var _0x5f11=function(_0x530348,_0x333d6){_0x530348=_0x530348-0x0;var _0x50a46e=_0xf115[_0x530348];return _0x50a46e;};'use strict';var _=require('lodash');var attributes=require(_0x5f11('0x0'));module[_0x5f11('0x1')]=function(_0x230480){var _0x4a62a7=_0x230480[_0x5f11('0x2')];function _0x3f4505(_0xe76e6d){var _0xd6eda5=0x2;var _0x4599e9=[{'type':_0xe76e6d[_0x5f11('0x3')],'app':_0x5f11('0x4'),'appdata':'CDR(type)='+_0xe76e6d['type'],'context':_0xe76e6d['context'],'exten':_0xe76e6d[_0x5f11('0x5')],'priority':_0xd6eda5++,'VoiceExtensionId':_0xe76e6d['id']}];if(_0xe76e6d[_0x5f11('0x3')]===_0x5f11('0x6')){_0x4599e9[_0x5f11('0x7')]({'type':_0x5f11('0x6'),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x8')+_0xe76e6d['id'],'context':_0xe76e6d[_0x5f11('0x9')],'exten':_0xe76e6d['exten'],'priority':_0xd6eda5++,'VoiceExtensionId':_0xe76e6d['id']});}_0x4599e9[_0x5f11('0x7')]({'type':_0xe76e6d[_0x5f11('0x3')],'app':_0x5f11('0x4'),'appdata':_0x5f11('0xa'),'context':_0xe76e6d[_0x5f11('0x9')],'exten':_0xe76e6d[_0x5f11('0x5')],'priority':_0xd6eda5++,'VoiceExtensionId':_0xe76e6d['id']},{'type':_0xe76e6d['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0xe76e6d[_0x5f11('0x9')],'exten':_0xe76e6d['exten'],'priority':_0xd6eda5++,'VoiceExtensionId':_0xe76e6d['id']},{'type':_0xe76e6d['type'],'app':_0x5f11('0x4'),'appdata':_0x5f11('0xb'),'context':_0xe76e6d['context'],'exten':_0xe76e6d[_0x5f11('0x5')],'priority':_0xd6eda5++,'VoiceExtensionId':_0xe76e6d['id']});return _0x4599e9;}function _0x1de3e4(_0x3927b9){var _0x2cea9d=0x2;var _0x1f3eb5=[{'type':_0x5f11('0xc'),'app':'Set','appdata':_0x5f11('0xd'),'context':_0x3927b9['context'],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':_0x5f11('0xc'),'app':_0x5f11('0x4'),'appdata':_0x5f11('0xe')+(_0x3927b9['cutdigits']?'${EXTEN:'+_0x3927b9[_0x5f11('0xf')]+'}':_0x5f11('0x10')),'context':_0x3927b9['context'],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':_0x5f11('0xc'),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x8')+_0x3927b9['id'],'context':_0x3927b9[_0x5f11('0x9')],'exten':_0x3927b9['exten'],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':'outbound','app':'ExecIf','appdata':_0x5f11('0x11')+(_0x2cea9d+0x2)+'):Goto('+(_0x2cea9d+0x1)+')','context':_0x3927b9[_0x5f11('0x9')],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':'outbound','app':'Set','appdata':_0x3927b9['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x3927b9[_0x5f11('0xf')]+'}':'CDR(prefix)=noprefix','context':_0x3927b9['context'],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':_0x5f11('0xc'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3927b9[_0x5f11('0x9')],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':'outbound','app':_0x5f11('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3927b9[_0x5f11('0x9')],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':_0x5f11('0xc'),'app':'Set','appdata':_0x5f11('0xb'),'context':_0x3927b9[_0x5f11('0x9')],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':_0x5f11('0xc'),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x12')+_0x3927b9['id'],'context':_0x3927b9['context'],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']}];if(_0x3927b9['hasOwnProperty'](_0x5f11('0x13'))&&_0x3927b9['recordingFormat']!==_0x5f11('0x14')){_0x1f3eb5[_0x5f11('0x7')]({'type':_0x5f11('0xc'),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x15'),'context':_0x3927b9[_0x5f11('0x9')],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']},{'type':_0x5f11('0xc'),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x16')+_0x3927b9[_0x5f11('0x13')]||_0x5f11('0x17'),'context':_0x3927b9['context'],'exten':_0x3927b9[_0x5f11('0x5')],'priority':_0x2cea9d++,'VoiceExtensionId':_0x3927b9['id']});}return _0x1f3eb5;}function _0x4ab39c(_0x4405da,_0x16d2e8){var _0x4ccee0=[{'name':'trunk','param':0x0},{'name':_0x5f11('0x18'),'param':0x1},{'name':_0x5f11('0x19'),'param':0x2},{'name':_0x5f11('0x1a'),'param':0x3}];var _0x150714={};var _0x2a1f23=_0x16d2e8['split'](',');var _0x5339c5=[];for(var _0xabd957=0x0;_0xabd957<_0x4ccee0[_0x5f11('0x1b')];_0xabd957++){switch(_0x4ccee0[_0xabd957][_0x5f11('0x1c')]){case _0x5f11('0x1d'):_0x150714[_0x5f11('0x1d')]=_0x2a1f23[_0x4ccee0[_0xabd957][_0x5f11('0x1e')]][_0x5f11('0x1f')]('/')[0x1];_0x150714[_0x5f11('0x20')]=_0x2a1f23[_0x4ccee0[_0xabd957][_0x5f11('0x1e')]][_0x5f11('0x1f')]('/')[0x2];_0x150714[_0x5f11('0x21')]=_0x150714[_0x5f11('0x20')]?_0x150714[_0x5f11('0x20')][_0x5f11('0x1f')]('$')[0x0]:undefined;_0x150714[_0x5f11('0x20')]=_0x4405da[_0x5f11('0xf')]?(_0x150714[_0x5f11('0x21')]||'')+_0x5f11('0x22')+_0x4405da[_0x5f11('0xf')]+'}':(_0x150714['prefix']||'')+'${EXTEN}';_0x5339c5[_0x4ccee0[_0xabd957]['param']]=[_0x5f11('0x23'),_0x150714[_0x5f11('0x1d')],_0x150714[_0x5f11('0x20')]][_0x5f11('0x24')]('/');break;case'options':_0x150714[_0x5f11('0x19')]=_0x2a1f23[_0x4ccee0[_0xabd957][_0x5f11('0x1e')]];if(_0x4405da[_0x5f11('0x13')]!=='none'){if(_0x150714[_0x5f11('0x19')][_0x5f11('0x25')](_0x5f11('0x26'))<0x0){_0x150714[_0x5f11('0x19')]+=_0x5f11('0x26');}}else{_0x150714[_0x5f11('0x19')]=_0x150714[_0x5f11('0x19')][_0x5f11('0x27')]('U(xcally-mixmonitor-context)','');}_0x5339c5[_0x4ccee0[_0xabd957][_0x5f11('0x1e')]]=_0x150714[_0x5f11('0x19')];break;default:_0x5339c5[_0x4ccee0[_0xabd957][_0x5f11('0x1e')]]=_0x2a1f23[_0x4ccee0[_0xabd957][_0x5f11('0x1e')]];}}return _0x5339c5[_0x5f11('0x24')](',');}function _0x334694(_0x2f3342,_0x21924c,_0x32a3cd){return new Promise(function(_0x3e9469,_0x2f29cd){var _0x2434c4=[];if(_[_0x5f11('0x28')](_0x21924c))return _0x3e9469(_0x2434c4);_0x4a62a7[_0x5f11('0x29')][_0x5f11('0x2a')]({'attributes':['id',_0x5f11('0x2b'),_0x5f11('0x2c')],'raw':!![]})[_0x5f11('0x2d')](function(_0x4712d3){for(var _0x3f4289=0x0,_0x185110=0x0;_0x3f4289<_0x21924c[_0x5f11('0x1b')];_0x3f4289++,_0x185110=0x0){var _0x498fd2=_0x21924c[_0x3f4289];var _0x488143=[];var _0xcf440d=[];delete _0x498fd2['id'];if(_0x498fd2[_0x5f11('0x2b')]!==_0x5f11('0x2e')){_0x498fd2[_0x5f11('0x2f')]=[_0x498fd2[_0x5f11('0x2b')]];}else{_0x498fd2['intervals']=_0x498fd2[_0x5f11('0x2c')]?_['map'](_[_0x5f11('0x30')](_0x4712d3,{'IntervalId':_0x498fd2[_0x5f11('0x2c')]}),'interval'):[];}_0x498fd2[_0x5f11('0x9')]=_0x2f3342['context'];_0x498fd2['exten']=_0x2f3342[_0x5f11('0x5')];if(_0x498fd2[_0x5f11('0x3')])_0x498fd2[_0x5f11('0x3')]=_0x498fd2[_0x5f11('0x3')]['toLowerCase']();if(_0x2f3342[_0x5f11('0x3')]===_0x5f11('0xc')){if(_0x498fd2[_0x5f11('0x31')]('tag')&&_0x498fd2[_0x5f11('0x32')]&&_0x498fd2['tag']!=='--'){_0x488143[_0x5f11('0x7')]({'type':_0x498fd2[_0x5f11('0x3')]['toLowerCase'](),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x33')+_0x498fd2[_0x5f11('0x32')],'context':_0x2f3342[_0x5f11('0x9')],'exten':_0x2f3342[_0x5f11('0x5')],'priority':_0x498fd2[_0x5f11('0x2f')][_0x5f11('0x1b')]+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});}_0x488143['push']({'type':_0x498fd2['type'][_0x5f11('0x34')](),'app':_0x5f11('0x35'),'appdata':_0x5f11('0x36')+(_0x498fd2['callerID']?'Set(CALLERID(all)='+_0x498fd2[_0x5f11('0x37')]+')':_0x5f11('0x38')),'context':_0x2f3342[_0x5f11('0x9')],'exten':_0x2f3342[_0x5f11('0x5')],'priority':_0x498fd2[_0x5f11('0x2f')]['length']+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});}else{if(_0x498fd2['hasOwnProperty'](_0x5f11('0x39'))){if([_0x5f11('0x3a'),_0x5f11('0x3b')][_0x5f11('0x3c')](_0x498fd2[_0x5f11('0x3d')][_0x5f11('0x34')]())&&_0x498fd2['appType']!==_0x5f11('0x3e')){if(_0x498fd2[_0x5f11('0x39')]){_0x488143[_0x5f11('0x7')]({'type':_0x498fd2[_0x5f11('0x3')][_0x5f11('0x34')](),'app':_0x5f11('0x35'),'appdata':_0x5f11('0x3f'),'context':_0x2f3342[_0x5f11('0x9')],'exten':_0x2f3342['exten'],'priority':_0x498fd2[_0x5f11('0x2f')][_0x5f11('0x1b')]+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});_0x488143['push']({'type':_0x498fd2[_0x5f11('0x3')]['toLowerCase'](),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x40'),'context':_0x2f3342[_0x5f11('0x9')],'exten':_0x2f3342[_0x5f11('0x5')],'priority':_0x498fd2['intervals'][_0x5f11('0x1b')]+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});}else{_0x488143[_0x5f11('0x7')]({'type':_0x498fd2[_0x5f11('0x3')]['toLowerCase'](),'app':_0x5f11('0x35'),'appdata':_0x5f11('0x41'),'context':_0x2f3342[_0x5f11('0x9')],'exten':_0x2f3342[_0x5f11('0x5')],'priority':_0x498fd2[_0x5f11('0x2f')][_0x5f11('0x1b')]+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});_0x488143[_0x5f11('0x7')]({'type':_0x498fd2[_0x5f11('0x3')][_0x5f11('0x34')](),'app':'Set','appdata':_0x5f11('0x42'),'context':_0x2f3342['context'],'exten':_0x2f3342['exten'],'priority':_0x498fd2[_0x5f11('0x2f')][_0x5f11('0x1b')]+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});}}}}for(var _0x2547a4=0x0;_0x2547a4<_0x498fd2[_0x5f11('0x2f')][_0x5f11('0x1b')];_0x2547a4++){var _0x3a993d=_0x32a3cd+_0x498fd2['intervals'][_0x5f11('0x1b')];var _0x798d72=_0x2547a4===_0x498fd2[_0x5f11('0x2f')][_0x5f11('0x1b')]-0x1?_0x32a3cd+_0x488143['length']+_0xcf440d[_0x5f11('0x1b')]+0x2:_0x32a3cd+_0x2547a4+0x1;_0x488143['splice'](_0x2547a4,0x0,{'type':_0x2f3342[_0x5f11('0x3')],'app':'GotoIfTime','appdata':_0x498fd2[_0x5f11('0x2f')][_0x2547a4]+'?'+_0x2f3342[_0x5f11('0x9')]+_0x5f11('0x43')+_0x3a993d+':'+_0x2f3342[_0x5f11('0x9')]+',${EXTEN},'+_0x798d72,'exten':_0x2f3342[_0x5f11('0x5')],'context':_0x2f3342[_0x5f11('0x9')],'priority':_0x32a3cd+_0x2547a4,'VoiceExtensionId':_0x2f3342['id']});}if(_0x498fd2[_0x5f11('0x44')]===_0x5f11('0x45')){_0x498fd2[_0x5f11('0x46')]=_0x4ab39c(_0x2f3342,_0x498fd2[_0x5f11('0x46')]);}if(_0x498fd2[_0x5f11('0x44')]===_0x5f11('0x47')){_0x488143[_0x5f11('0x7')]({'type':_0x498fd2[_0x5f11('0x3')]['toLowerCase'](),'app':_0x5f11('0x4'),'appdata':_0x5f11('0x48'),'context':_0x2f3342[_0x5f11('0x9')],'exten':_0x2f3342[_0x5f11('0x5')],'priority':_0x498fd2[_0x5f11('0x2f')]['length']+_0x32a3cd+_0x185110++,'VoiceExtensionId':_0x2f3342['id']});}_0x498fd2[_0x5f11('0x49')]=_0x488143[_0x5f11('0x1b')]?_[_0x5f11('0x4a')](_0x488143)[_0x5f11('0x49')]+0x1:_0x32a3cd;_0x2434c4=_[_0x5f11('0x4b')](_0x2434c4,_0x488143,[_0x498fd2],_0xcf440d);_0x32a3cd=_['last'](_0x2434c4)[_0x5f11('0x49')]+0x1;}return _0x3e9469(_0x2434c4);})['catch'](function(_0x41553a){_0x2f29cd(_0x41553a);});});}return _0x230480[_0x5f11('0x4c')](_0x5f11('0x4d'),attributes,{'tableName':_0x5f11('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4abb89){var _0x2bf1e4=this['get']({'plain':!![]});var _0x84f609=_0x2bf1e4[_0x5f11('0x3')]===_0x5f11('0xc')?_0x1de3e4(_0x2bf1e4):_0x3f4505(_0x2bf1e4);return _0x334694(_0x2bf1e4,_0x4abb89,_[_0x5f11('0x4a')](_0x84f609)[_0x5f11('0x49')]+0x1)[_0x5f11('0x2d')](function(_0x5bf7a0){var _0x22d9e7=_[_0x5f11('0x4b')](_0x84f609,_0x5bf7a0);_0x22d9e7['push']({'type':_0x2bf1e4['type'],'app':_0x5f11('0x4f'),'exten':_0x2bf1e4['exten'],'context':_0x2bf1e4['context'],'priority':_[_0x5f11('0x4a')](_0x22d9e7)['priority']+0x1,'VoiceExtensionId':_0x2bf1e4['id']});return _0x22d9e7;});}}});}; \ No newline at end of file +var _0x6b54=['trunk','timeout','options','split','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','length','*,*,*,*','intervals','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','voice_extensions','get','then','concat','lodash','models','type','Set','CDR(type)=','context','inbound','push','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6b54,0xd0));var _0x46b5=function(_0x3a7455,_0x46b004){_0x3a7455=_0x3a7455-0x0;var _0x216c72=_0x6b54[_0x3a7455];return _0x216c72;};'use strict';var _=require(_0x46b5('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x20ac33){var _0x15aabe=_0x20ac33[_0x46b5('0x1')];function _0x1852f5(_0x29f21a){var _0x3ba090=0x2;var _0x4f6e50=[{'type':_0x29f21a[_0x46b5('0x2')],'app':_0x46b5('0x3'),'appdata':_0x46b5('0x4')+_0x29f21a[_0x46b5('0x2')],'context':_0x29f21a[_0x46b5('0x5')],'exten':_0x29f21a['exten'],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']}];if(_0x29f21a[_0x46b5('0x2')]===_0x46b5('0x6')){_0x4f6e50[_0x46b5('0x7')]({'type':_0x46b5('0x6'),'app':_0x46b5('0x3'),'appdata':'CDR(routeid)='+_0x29f21a['id'],'context':_0x29f21a['context'],'exten':_0x29f21a[_0x46b5('0x8')],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']});}_0x4f6e50['push']({'type':_0x29f21a[_0x46b5('0x2')],'app':_0x46b5('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x29f21a[_0x46b5('0x5')],'exten':_0x29f21a['exten'],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']},{'type':_0x29f21a[_0x46b5('0x2')],'app':_0x46b5('0x3'),'appdata':_0x46b5('0x9'),'context':_0x29f21a['context'],'exten':_0x29f21a[_0x46b5('0x8')],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']},{'type':_0x29f21a[_0x46b5('0x2')],'app':'Set','appdata':_0x46b5('0xa'),'context':_0x29f21a[_0x46b5('0x5')],'exten':_0x29f21a['exten'],'priority':_0x3ba090++,'VoiceExtensionId':_0x29f21a['id']});return _0x4f6e50;}function _0x2fbf2d(_0xd8b226){var _0x23f0e2=0x2;var _0x284a14=[{'type':_0x46b5('0xb'),'app':'Set','appdata':_0x46b5('0xc'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226['exten'],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':_0x46b5('0x3'),'appdata':_0x46b5('0xd')+(_0xd8b226['cutdigits']?_0x46b5('0xe')+_0xd8b226[_0x46b5('0xf')]+'}':_0x46b5('0x10')),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':'Set','appdata':'CDR(routeid)='+_0xd8b226['id'],'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':_0x46b5('0x11'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x23f0e2+0x2)+_0x46b5('0x12')+(_0x23f0e2+0x1)+')','context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226['exten'],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':'Set','appdata':_0xd8b226[_0x46b5('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0xd8b226[_0x46b5('0xf')]+'}':_0x46b5('0x13'),'context':_0xd8b226['context'],'exten':_0xd8b226['exten'],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':'Set','appdata':_0x46b5('0x14'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':_0x46b5('0xb'),'app':_0x46b5('0x3'),'appdata':_0x46b5('0x9'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':_0x46b5('0x3'),'appdata':_0x46b5('0xa'),'context':_0xd8b226['context'],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0xd8b226['id'],'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']}];if(_0xd8b226['hasOwnProperty'](_0x46b5('0x15'))&&_0xd8b226[_0x46b5('0x15')]!==_0x46b5('0x16')){_0x284a14[_0x46b5('0x7')]({'type':_0x46b5('0xb'),'app':_0x46b5('0x3'),'appdata':_0x46b5('0x17'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']},{'type':'outbound','app':_0x46b5('0x3'),'appdata':_0x46b5('0x18')+_0xd8b226['recordingFormat']||_0x46b5('0x19'),'context':_0xd8b226[_0x46b5('0x5')],'exten':_0xd8b226[_0x46b5('0x8')],'priority':_0x23f0e2++,'VoiceExtensionId':_0xd8b226['id']});}return _0x284a14;}function _0x28b04d(_0x134bad,_0x36df25){var _0x4c776c=[{'name':_0x46b5('0x1a'),'param':0x0},{'name':_0x46b5('0x1b'),'param':0x1},{'name':_0x46b5('0x1c'),'param':0x2},{'name':'url','param':0x3}];var _0x65b4bd={};var _0x2d59d1=_0x36df25[_0x46b5('0x1d')](',');var _0x2508c6=[];for(var _0x25f0ed=0x0;_0x25f0ed<_0x4c776c['length'];_0x25f0ed++){switch(_0x4c776c[_0x25f0ed]['name']){case'trunk':_0x65b4bd[_0x46b5('0x1a')]=_0x2d59d1[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]][_0x46b5('0x1d')]('/')[0x1];_0x65b4bd[_0x46b5('0x1f')]=_0x2d59d1[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]]['split']('/')[0x2];_0x65b4bd[_0x46b5('0x20')]=_0x65b4bd[_0x46b5('0x1f')]?_0x65b4bd[_0x46b5('0x1f')][_0x46b5('0x1d')]('$')[0x0]:undefined;_0x65b4bd['phone']=_0x134bad[_0x46b5('0xf')]?(_0x65b4bd[_0x46b5('0x20')]||'')+_0x46b5('0xe')+_0x134bad[_0x46b5('0xf')]+'}':(_0x65b4bd[_0x46b5('0x20')]||'')+_0x46b5('0x10');_0x2508c6[_0x4c776c[_0x25f0ed]['param']]=[_0x46b5('0x21'),_0x65b4bd[_0x46b5('0x1a')],_0x65b4bd[_0x46b5('0x1f')]][_0x46b5('0x22')]('/');break;case _0x46b5('0x1c'):_0x65b4bd[_0x46b5('0x1c')]=_0x2d59d1[_0x4c776c[_0x25f0ed]['param']];if(_0x134bad[_0x46b5('0x15')]!==_0x46b5('0x16')){if(_0x65b4bd[_0x46b5('0x1c')][_0x46b5('0x23')](_0x46b5('0x24'))<0x0){_0x65b4bd[_0x46b5('0x1c')]+='U(xcally-mixmonitor-context)';}}else{_0x65b4bd[_0x46b5('0x1c')]=_0x65b4bd['options'][_0x46b5('0x25')](_0x46b5('0x24'),'');}_0x2508c6[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]]=_0x65b4bd[_0x46b5('0x1c')];break;default:_0x2508c6[_0x4c776c[_0x25f0ed]['param']]=_0x2d59d1[_0x4c776c[_0x25f0ed][_0x46b5('0x1e')]];}}return _0x2508c6[_0x46b5('0x22')](',');}function _0x4bace3(_0x3300da,_0x1f02ea,_0x1e5d3b){return new Promise(function(_0x49dc11,_0x25f15e){var _0x281db7=[];if(_[_0x46b5('0x26')](_0x1f02ea))return _0x49dc11(_0x281db7);_0x15aabe['Interval'][_0x46b5('0x27')]({'attributes':['id',_0x46b5('0x28'),_0x46b5('0x29')],'raw':!![]})['then'](function(_0x404e30){for(var _0x134d33=0x0,_0xf1cbfc=0x0;_0x134d33<_0x1f02ea[_0x46b5('0x2a')];_0x134d33++,_0xf1cbfc=0x0){var _0x23a8dc=_0x1f02ea[_0x134d33];var _0x3b9661=[];var _0x33a46c=[];delete _0x23a8dc['id'];if(_0x23a8dc[_0x46b5('0x28')]!==_0x46b5('0x2b')){_0x23a8dc[_0x46b5('0x2c')]=[_0x23a8dc[_0x46b5('0x28')]];}else{_0x23a8dc[_0x46b5('0x2c')]=_0x23a8dc[_0x46b5('0x29')]?_['map'](_[_0x46b5('0x2d')](_0x404e30,{'IntervalId':_0x23a8dc[_0x46b5('0x29')]}),'interval'):[];}_0x23a8dc['context']=_0x3300da[_0x46b5('0x5')];_0x23a8dc[_0x46b5('0x8')]=_0x3300da[_0x46b5('0x8')];if(_0x23a8dc['type'])_0x23a8dc[_0x46b5('0x2')]=_0x23a8dc[_0x46b5('0x2')]['toLowerCase']();if(_0x3300da[_0x46b5('0x2')]===_0x46b5('0xb')){if(_0x23a8dc[_0x46b5('0x2e')](_0x46b5('0x2f'))&&_0x23a8dc[_0x46b5('0x2f')]&&_0x23a8dc[_0x46b5('0x2f')]!=='--'){_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x3'),'appdata':_0x46b5('0x31')+_0x23a8dc[_0x46b5('0x2f')],'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc['intervals'][_0x46b5('0x2a')]+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x11'),'appdata':_0x46b5('0x32')+(_0x23a8dc[_0x46b5('0x33')]?_0x46b5('0x34')+_0x23a8dc[_0x46b5('0x33')]+')':_0x46b5('0x35')),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc['intervals']['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}else{if(_0x23a8dc[_0x46b5('0x2e')](_0x46b5('0x36'))){if([_0x46b5('0x37'),'playback'][_0x46b5('0x38')](_0x23a8dc['app'][_0x46b5('0x30')]())&&_0x23a8dc[_0x46b5('0x39')]!==_0x46b5('0x3a')){if(_0x23a8dc['answer']){_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x11'),'appdata':_0x46b5('0x3b'),'context':_0x3300da['context'],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')]['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});_0x3b9661['push']({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':'Set','appdata':_0x46b5('0x3c'),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')]['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}else{_0x3b9661[_0x46b5('0x7')]({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x11'),'appdata':_0x46b5('0x3d'),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')]['length']+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});_0x3b9661[_0x46b5('0x7')]({'type':_0x23a8dc[_0x46b5('0x2')][_0x46b5('0x30')](),'app':_0x46b5('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da[_0x46b5('0x8')],'priority':_0x23a8dc[_0x46b5('0x2c')][_0x46b5('0x2a')]+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}}}}for(var _0x547cf3=0x0;_0x547cf3<_0x23a8dc[_0x46b5('0x2c')]['length'];_0x547cf3++){var _0x11e353=_0x1e5d3b+_0x23a8dc[_0x46b5('0x2c')][_0x46b5('0x2a')];var _0x2cc5ef=_0x547cf3===_0x23a8dc['intervals'][_0x46b5('0x2a')]-0x1?_0x1e5d3b+_0x3b9661[_0x46b5('0x2a')]+_0x33a46c['length']+0x2:_0x1e5d3b+_0x547cf3+0x1;_0x3b9661[_0x46b5('0x3e')](_0x547cf3,0x0,{'type':_0x3300da[_0x46b5('0x2')],'app':_0x46b5('0x3f'),'appdata':_0x23a8dc[_0x46b5('0x2c')][_0x547cf3]+'?'+_0x3300da['context']+_0x46b5('0x40')+_0x11e353+':'+_0x3300da[_0x46b5('0x5')]+',${EXTEN},'+_0x2cc5ef,'exten':_0x3300da['exten'],'context':_0x3300da[_0x46b5('0x5')],'priority':_0x1e5d3b+_0x547cf3,'VoiceExtensionId':_0x3300da['id']});}if(_0x23a8dc[_0x46b5('0x39')]===_0x46b5('0x41')){_0x23a8dc[_0x46b5('0x42')]=_0x28b04d(_0x3300da,_0x23a8dc[_0x46b5('0x42')]);}if(_0x23a8dc[_0x46b5('0x39')]===_0x46b5('0x43')){_0x3b9661[_0x46b5('0x7')]({'type':_0x23a8dc[_0x46b5('0x2')]['toLowerCase'](),'app':'Set','appdata':_0x46b5('0x44'),'context':_0x3300da[_0x46b5('0x5')],'exten':_0x3300da['exten'],'priority':_0x23a8dc[_0x46b5('0x2c')][_0x46b5('0x2a')]+_0x1e5d3b+_0xf1cbfc++,'VoiceExtensionId':_0x3300da['id']});}_0x23a8dc[_0x46b5('0x45')]=_0x3b9661['length']?_[_0x46b5('0x46')](_0x3b9661)[_0x46b5('0x45')]+0x1:_0x1e5d3b;_0x281db7=_['concat'](_0x281db7,_0x3b9661,[_0x23a8dc],_0x33a46c);_0x1e5d3b=_[_0x46b5('0x46')](_0x281db7)[_0x46b5('0x45')]+0x1;}return _0x49dc11(_0x281db7);})[_0x46b5('0x47')](function(_0x484459){_0x25f15e(_0x484459);});});}return _0x20ac33[_0x46b5('0x48')](_0x46b5('0x49'),attributes,{'tableName':_0x46b5('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x307b6a){var _0x2f4ea5=this[_0x46b5('0x4b')]({'plain':!![]});var _0xda6cb5=_0x2f4ea5[_0x46b5('0x2')]===_0x46b5('0xb')?_0x2fbf2d(_0x2f4ea5):_0x1852f5(_0x2f4ea5);return _0x4bace3(_0x2f4ea5,_0x307b6a,_['last'](_0xda6cb5)[_0x46b5('0x45')]+0x1)[_0x46b5('0x4c')](function(_0x2571a2){var _0x510744=_[_0x46b5('0x4d')](_0xda6cb5,_0x2571a2);_0x510744[_0x46b5('0x7')]({'type':_0x2f4ea5[_0x46b5('0x2')],'app':'Hangup','exten':_0x2f4ea5[_0x46b5('0x8')],'context':_0x2f4ea5[_0x46b5('0x5')],'priority':_['last'](_0x510744)[_0x46b5('0x45')]+0x1,'VoiceExtensionId':_0x2f4ea5['id']});return _0x510744;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index dc9838f..156422d 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 _0x565f=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','model','map','info','catch','util','moment','bluebird','ioredis'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x565f,0x68));var _0xf565=function(_0x1fe639,_0x5c9728){_0x1fe639=_0x1fe639-0x0;var _0x5338ff=_0x565f[_0x1fe639];return _0x5338ff;};'use strict';var _=require('lodash');var util=require(_0xf565('0x0'));var moment=require(_0xf565('0x1'));var BPromise=require(_0xf565('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf565('0x3'));var db=require(_0xf565('0x4'))['db'];var utils=require(_0xf565('0x5'));var logger=require(_0xf565('0x6'))(_0xf565('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf565('0x8')]({'port':0x232a});config['redis']=_[_0xf565('0x9')](config[_0xf565('0xa')],{'host':_0xf565('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf565('0xa')]));require('./voiceExtension.socket')[_0xf565('0xc')](socket);function respondWithRpcPromise(_0x5aaa3f,_0x2d7f4e,_0x1a362d){return new BPromise(function(_0x80b001,_0x1bc33c){return client[_0xf565('0xd')](_0x5aaa3f,_0x1a362d)[_0xf565('0xe')](function(_0x4c13ed){logger['info'](_0xf565('0xf'),_0x2d7f4e,_0xf565('0x10'));logger[_0xf565('0x11')](_0xf565('0x12'),_0x2d7f4e,_0xf565('0x10'),JSON[_0xf565('0x13')](_0x4c13ed));if(_0x4c13ed[_0xf565('0x14')]){if(_0x4c13ed[_0xf565('0x14')][_0xf565('0x15')]===0x1f4){logger[_0xf565('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x2d7f4e,_0x4c13ed[_0xf565('0x14')][_0xf565('0x16')]);return _0x1bc33c(_0x4c13ed['error'][_0xf565('0x16')]);}logger[_0xf565('0x14')](_0xf565('0xf'),_0x2d7f4e,_0x4c13ed[_0xf565('0x14')][_0xf565('0x16')]);return _0x80b001(_0x4c13ed['error'][_0xf565('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x2d7f4e,_0xf565('0x10'));_0x80b001(_0x4c13ed[_0xf565('0x17')]['message']);}})['catch'](function(_0x2d2197){logger['error'](_0xf565('0xf'),_0x2d7f4e,_0x2d2197);_0x1bc33c(_0x2d2197);});});}exports[_0xf565('0x18')]=function(_0x1f364e){var _0x51215d=this;return new Promise(function(_0x55032c,_0xb7b197){return db[_0xf565('0x19')][_0xf565('0x1a')]({'raw':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')][_0xf565('0x1c')]||null:null,'attributes':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')][_0xf565('0x1d')]||null:null,'limit':_0x1f364e[_0xf565('0x1b')]?_0x1f364e[_0xf565('0x1b')][_0xf565('0x1e')]||null:null,'include':_0x1f364e[_0xf565('0x1b')]?_0x1f364e['options'][_0xf565('0x1f')]?_['map'](_0x1f364e[_0xf565('0x1b')][_0xf565('0x1f')],function(_0x50da32){return{'model':db[_0x50da32[_0xf565('0x20')]],'as':_0x50da32['as'],'attributes':_0x50da32[_0xf565('0x1d')],'include':_0x50da32[_0xf565('0x1f')]?_[_0xf565('0x21')](_0x50da32[_0xf565('0x1f')],function(_0x1239a7){return{'model':db[_0x1239a7[_0xf565('0x20')]],'as':_0x1239a7['as'],'attributes':_0x1239a7[_0xf565('0x1d')],'include':_0x1239a7['include']?_[_0xf565('0x21')](_0x1239a7[_0xf565('0x1f')],function(_0x18082a){return{'model':db[_0x18082a[_0xf565('0x20')]],'as':_0x18082a['as'],'attributes':_0x18082a[_0xf565('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2288db){logger[_0xf565('0x22')](_0xf565('0x18'),_0x1f364e);logger[_0xf565('0x11')](_0xf565('0x18'),_0x1f364e,JSON['stringify'](_0x2288db));_0x55032c(_0x2288db);})[_0xf565('0x23')](function(_0x41d6bf){logger[_0xf565('0x14')](_0xf565('0x18'),_0x41d6bf[_0xf565('0x16')],_0x1f364e);_0xb7b197(_0x51215d[_0xf565('0x14')](0x1f4,_0x41d6bf['message']));});});}; \ No newline at end of file +var _0xfd50=['VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xfd50,0x178));var _0x0fd5=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xfd50[_0x5834bc];return _0x3e183a;};'use strict';var _=require('lodash');var util=require(_0x0fd5('0x0'));var moment=require(_0x0fd5('0x1'));var BPromise=require(_0x0fd5('0x2'));var rs=require(_0x0fd5('0x3'));var fs=require('fs');var Redis=require(_0x0fd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fd5('0x5'));var logger=require(_0x0fd5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0fd5('0x7'));var client=jayson[_0x0fd5('0x8')][_0x0fd5('0x9')]({'port':0x232a});config[_0x0fd5('0xa')]=_['defaults'](config[_0x0fd5('0xa')],{'host':_0x0fd5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fd5('0xa')]));require(_0x0fd5('0xc'))[_0x0fd5('0xd')](socket);function respondWithRpcPromise(_0x4705b2,_0x39eda9,_0x1dfd3f){return new BPromise(function(_0x27bfa9,_0x4e4733){return client[_0x0fd5('0xe')](_0x4705b2,_0x1dfd3f)[_0x0fd5('0xf')](function(_0x47c900){logger[_0x0fd5('0x10')](_0x0fd5('0x11'),_0x39eda9,_0x0fd5('0x12'));logger[_0x0fd5('0x13')](_0x0fd5('0x14'),_0x39eda9,_0x0fd5('0x12'),JSON[_0x0fd5('0x15')](_0x47c900));if(_0x47c900['error']){if(_0x47c900['error'][_0x0fd5('0x16')]===0x1f4){logger['error'](_0x0fd5('0x11'),_0x39eda9,_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);return _0x4e4733(_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);}logger['error'](_0x0fd5('0x11'),_0x39eda9,_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);return _0x27bfa9(_0x47c900[_0x0fd5('0x17')][_0x0fd5('0x18')]);}else{logger[_0x0fd5('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x39eda9,_0x0fd5('0x12'));_0x27bfa9(_0x47c900[_0x0fd5('0x19')][_0x0fd5('0x18')]);}})[_0x0fd5('0x1a')](function(_0x1d86f4){logger['error'](_0x0fd5('0x11'),_0x39eda9,_0x1d86f4);_0x4e4733(_0x1d86f4);});});}exports[_0x0fd5('0x1b')]=function(_0x132df5){var _0x25ed9d=this;return new Promise(function(_0x118d34,_0x50af04){return db[_0x0fd5('0x1c')]['findAll']({'raw':_0x132df5[_0x0fd5('0x1d')]?_0x132df5[_0x0fd5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x132df5[_0x0fd5('0x1d')]?_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x1e')]||null:null,'attributes':_0x132df5[_0x0fd5('0x1d')]?_0x132df5['options'][_0x0fd5('0x1f')]||null:null,'limit':_0x132df5[_0x0fd5('0x1d')]?_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x20')]||null:null,'include':_0x132df5['options']?_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x21')]?_[_0x0fd5('0x22')](_0x132df5[_0x0fd5('0x1d')][_0x0fd5('0x21')],function(_0xc38f30){return{'model':db[_0xc38f30[_0x0fd5('0x23')]],'as':_0xc38f30['as'],'attributes':_0xc38f30[_0x0fd5('0x1f')],'include':_0xc38f30[_0x0fd5('0x21')]?_[_0x0fd5('0x22')](_0xc38f30[_0x0fd5('0x21')],function(_0x2b0991){return{'model':db[_0x2b0991[_0x0fd5('0x23')]],'as':_0x2b0991['as'],'attributes':_0x2b0991['attributes'],'include':_0x2b0991['include']?_['map'](_0x2b0991[_0x0fd5('0x21')],function(_0x4547dd){return{'model':db[_0x4547dd['model']],'as':_0x4547dd['as'],'attributes':_0x4547dd[_0x0fd5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0fd5('0xf')](function(_0x23c6b9){logger[_0x0fd5('0x10')]('GetVoiceExtension',_0x132df5);logger[_0x0fd5('0x13')](_0x0fd5('0x1b'),_0x132df5,JSON[_0x0fd5('0x15')](_0x23c6b9));_0x118d34(_0x23c6b9);})['catch'](function(_0x3e41d4){logger[_0x0fd5('0x17')](_0x0fd5('0x1b'),_0x3e41d4[_0x0fd5('0x18')],_0x132df5);_0x50af04(_0x25ed9d[_0x0fd5('0x17')](0x1f4,_0x3e41d4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 76551df..4873748 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 _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0xd709aa,_0x4674db){var _0x3b763d=function(_0x2c59ab){while(--_0x2c59ab){_0xd709aa['push'](_0xd709aa['shift']());}};_0x3b763d(++_0x4674db);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x7fbe[_0x87239];return _0x53af1e;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x2b0cf2,_0x5aa063){var _0x3d5c8b=function(_0x4fff51){while(--_0x4fff51){_0x2b0cf2['push'](_0x2b0cf2['shift']());}};_0x3d5c8b(++_0x5aa063);}(_0x326f,0xd1));var _0xf326=function(_0x4d5455,_0x56ecbb){_0x4d5455=_0x4d5455-0x0;var _0x2d9ecd=_0x326f[_0x4d5455];return _0x2d9ecd;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1f61c35..ac84fae 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 _0x3f8a=['show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x5ea710,_0x40a4f8){var _0x5397e2=function(_0x234979){while(--_0x234979){_0x5ea710['push'](_0x5ea710['shift']());}};_0x5397e2(++_0x40a4f8);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x41b72e,_0x35330e){_0x41b72e=_0x41b72e-0x0;var _0x215097=_0x3f8a[_0x41b72e];return _0x215097;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['post']('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0x14')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);module[_0xa3f8('0x16')]=router; \ No newline at end of file +var _0x2a07=['getMessages','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0x2a07,0x74));var _0x72a0=function(_0x50d2db,_0x47481f){_0x50d2db=_0x50d2db-0x0;var _0x1c7e27=_0x2a07[_0x50d2db];return _0x1c7e27;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x11')]);router['put'](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x13')](_0x72a0('0xd'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);module[_0x72a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 64c2d59..694984f 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 _0x4882=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','email','trim'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4882,0x159));var _0x2488=function(_0x4ca805,_0x27b886){_0x4ca805=_0x4ca805-0x0;var _0x332848=_0x4882[_0x4ca805];return _0x332848;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x2488('0x0')]},'context':{'type':Sequelize[_0x2488('0x0')],'defaultValue':_0x2488('0x1'),'unique':_0x2488('0x2')},'mailbox':{'type':Sequelize[_0x2488('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2488('0x0')]},'fullname':{'type':Sequelize[_0x2488('0x0')]},'email':{'type':Sequelize[_0x2488('0x0')],'validate':{'isEmail':!![]},'set':function(_0x1d8b97){this['setDataValue'](_0x2488('0x3'),typeof _0x1d8b97==='string'&&_0x1d8b97[_0x2488('0x4')]()?_0x1d8b97[_0x2488('0x4')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x2488('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2488('0x5')](_0x2488('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x2488('0x6'),'no'),'defaultValue':_0x2488('0x6'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x2488('0x0')]},'review':{'type':Sequelize[_0x2488('0x5')](_0x2488('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2488('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2488('0x5')](_0x2488('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2488('0x5')](_0x2488('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2488('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2488('0x5')](_0x2488('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2488('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2488('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2488('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x2488('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2488('0x5')](_0x2488('0x6'),'no'),'defaultValue':_0x2488('0x6'),'allowNull':![]},'stamp':{'type':_0x2488('0x8')},'emailsubject':{'type':Sequelize[_0x2488('0x0')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x2488('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2488('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2488('0xa')](_0x2488('0xb'))+_0x2488('0xc')+this[_0x2488('0xa')](_0x2488('0xd'));}}}; \ No newline at end of file +var _0x5740=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x5740,0x95));var _0x0574=function(_0x1b24cb,_0x26e0fe){_0x1b24cb=_0x1b24cb-0x0;var _0x4160b2=_0x5740[_0x1b24cb];return _0x4160b2;};'use strict';var Sequelize=require(_0x0574('0x0'));module[_0x0574('0x1')]={'customer_id':{'type':Sequelize[_0x0574('0x2')]},'context':{'type':Sequelize[_0x0574('0x2')],'defaultValue':_0x0574('0x3'),'unique':_0x0574('0x4')},'mailbox':{'type':Sequelize[_0x0574('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0574('0x2')]},'fullname':{'type':Sequelize[_0x0574('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x43c29e){this[_0x0574('0x5')](_0x0574('0x6'),typeof _0x43c29e==='string'&&_0x43c29e[_0x0574('0x7')]()?_0x43c29e[_0x0574('0x7')]():null);}},'pager':{'type':Sequelize[_0x0574('0x2')]},'tz':{'type':Sequelize[_0x0574('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':_0x0574('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x0574('0x2')]},'callback':{'type':Sequelize[_0x0574('0x2')]},'review':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0574('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0574('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0574('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0574('0x8')]('yes','no'),'defaultValue':_0x0574('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0574('0x8')](_0x0574('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0574('0xb')},'emailsubject':{'type':Sequelize[_0x0574('0x2')]},'emailbody':{'type':Sequelize[_0x0574('0x2')]},'maxsecs':{'type':Sequelize[_0x0574('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0574('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0574('0xd')],'get':function(){return this[_0x0574('0xe')](_0x0574('0xf'))+_0x0574('0x10')+this[_0x0574('0xe')](_0x0574('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aab1490..bc1fa8c 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 _0x3f8c=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x4f6c7d,_0x258d8f){var _0x5817df=function(_0x16ebc4){while(--_0x16ebc4){_0x4f6c7d['push'](_0x4f6c7d['shift']());}};_0x5817df(++_0x258d8f);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2e607d,_0x36fba6){_0x2e607d=_0x2e607d-0x0;var _0x4432c5=_0x3f8c[_0x2e607d];return _0x4432c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':!![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x20')]=function(_0x4b4adb,_0x1b1e13){if(_0x4b4adb[_0xc3f8('0x49')]['id']){delete _0x4b4adb[_0xc3f8('0x49')]['id'];}return db['VoiceMail'][_0xc3f8('0x46')]({'where':{'id':_0x4b4adb['params']['id']}})['then'](handleEntityNotFound(_0x1b1e13,null))[_0xc3f8('0x21')](saveUpdates(_0x4b4adb['body'],null))[_0xc3f8('0x21')](respondWithResult(_0x1b1e13,null))[_0xc3f8('0x47')](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x24')]=function(_0x490f37,_0xcb45c1){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x490f37[_0xc3f8('0x50')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0xcb45c1,null))['then'](removeEntity(_0xcb45c1,null))['catch'](handleError(_0xcb45c1,null));};exports[_0xc3f8('0x51')]=function(_0x326dcc,_0x2f1b68,_0x3a268d){return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x326dcc[_0xc3f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f1b68,null))[_0xc3f8('0x21')](function(_0x337029){var _0x163264;var _0xd5d6a7={},_0x5c6f6e={};_0x5c6f6e[_0xc3f8('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c6f6e['query']=_[_0xc3f8('0x30')](_0x326dcc[_0xc3f8('0x2f')]);_0x5c6f6e[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5c6f6e[_0xc3f8('0x31')],_0x5c6f6e[_0xc3f8('0x2f')]);_0xd5d6a7[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x5c6f6e['model'],qs[_0xc3f8('0x34')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0xd5d6a7[_0xc3f8('0x32')]=_0xd5d6a7[_0xc3f8('0x32')]['length']?_0xd5d6a7[_0xc3f8('0x32')]:_0x5c6f6e[_0xc3f8('0x31')];if(!_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0xd5d6a7['limit']=qs[_0xc3f8('0x1b')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0xd5d6a7[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x326dcc[_0xc3f8('0x2f')]['offset']);}_0xd5d6a7[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x326dcc[_0xc3f8('0x2f')]['sort']);_0xd5d6a7[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x326dcc['query'],_0x5c6f6e[_0xc3f8('0x3c')]));if(_0x326dcc[_0xc3f8('0x2f')]['filter']){_0xd5d6a7[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0xd5d6a7[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0xd5d6a7[_0xc3f8('0x32')],function(_0x30a23a){var _0x1e62ec={};_0x1e62ec[_0x30a23a]={'$like':'%'+_0x326dcc[_0xc3f8('0x2f')]['filter']+'%'};return _0x1e62ec;})});}_0xd5d6a7['where']=_[_0xc3f8('0x3e')](_0xd5d6a7['where'],{'mailboxuser':_0x337029['mailbox']});_0xd5d6a7=_['merge']({},_0xd5d6a7,_0x326dcc['options']);return db['VoiceMailMessage'][_0xc3f8('0x52')](_0xd5d6a7)[_0xc3f8('0x21')](respondWithFilteredResult(_0x2f1b68,_0xd5d6a7));})[_0xc3f8('0x47')](handleError(_0x2f1b68,null));}; \ No newline at end of file +var _0xb58b=['destroy','then','get','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4937c6,_0x5f40d9){_0x4937c6=_0x4937c6-0x0;var _0x51d83b=_0xb58b[_0x4937c6];return _0x51d83b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){var _0x2d111c=_0x287822[_0xbb58('0x27')]({'plain':!![]});var _0x2d556a=_0xbb58('0x28');return db['UserProfileResource'][_0xbb58('0x25')]({'where':{'type':_0x2d556a,'resourceId':_0x2d111c['id']}})[_0xbb58('0x26')](function(){return _0x287822;});})[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x521d0c,_0x3608dc){return function(_0x2ce7c3){if(!_0x2ce7c3){_0x521d0c[_0xbb58('0x18')](0x194);}return _0x2ce7c3;};}function handleError(_0x2d5b39,_0xf6687e){_0xf6687e=_0xf6687e||0x1f4;return function(_0x28b3a3){logger[_0xbb58('0x29')](_0x28b3a3[_0xbb58('0x2a')]);if(_0x28b3a3[_0xbb58('0x2b')]){delete _0x28b3a3['name'];}_0x2d5b39[_0xbb58('0x19')](_0xf6687e)[_0xbb58('0x2c')](_0x28b3a3);};}exports[_0xbb58('0x2d')]=function(_0x3c9cee,_0x3304b9){var _0x9d379f={},_0x1ba526={},_0x643e0e={'count':0x0,'rows':[]};var _0x3f8db3=_['map'](db[_0xbb58('0x2e')][_0xbb58('0x2f')],function(_0x3edc34){return{'name':_0x3edc34[_0xbb58('0x30')],'type':_0x3edc34[_0xbb58('0x31')][_0xbb58('0x32')]};});_0x1ba526[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x3f8db3,_0xbb58('0x2b'));_0x1ba526[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3c9cee[_0xbb58('0x35')]);_0x1ba526[_0xbb58('0x37')]=_['intersection'](_0x1ba526['model'],_0x1ba526['query']);_0x9d379f[_0xbb58('0x38')]=_[_0xbb58('0x39')](_0x1ba526[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3a')]));_0x9d379f[_0xbb58('0x38')]=_0x9d379f[_0xbb58('0x38')]['length']?_0x9d379f[_0xbb58('0x38')]:_0x1ba526[_0xbb58('0x33')];if(!_0x3c9cee['query'][_0xbb58('0x3b')]('nolimit')){_0x9d379f[_0xbb58('0x1e')]=qs['limit'](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1e')]);_0x9d379f['offset']=qs[_0xbb58('0x1c')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1c')]);}_0x9d379f[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3d')]);_0x9d379f[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3c9cee[_0xbb58('0x35')],_0x1ba526[_0xbb58('0x37')]),_0x3f8db3);if(_0x3c9cee['query']['filter']){_0x9d379f[_0xbb58('0x3e')]=_['merge'](_0x9d379f[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x3f8db3,function(_0x2ab2d8){if(_0x2ab2d8['type']!=='VIRTUAL'){var _0xc29171={};_0xc29171[_0x2ab2d8[_0xbb58('0x2b')]]={'$like':'%'+_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x40')]+'%'};return _0xc29171;}})});}_0x9d379f=_[_0xbb58('0x41')]({},_0x9d379f,_0x3c9cee[_0xbb58('0x42')]);var _0x5797e7={'where':_0x9d379f[_0xbb58('0x3e')]};return db[_0xbb58('0x2e')][_0xbb58('0x1d')](_0x5797e7)[_0xbb58('0x26')](function(_0x1185b3){_0x643e0e[_0xbb58('0x1d')]=_0x1185b3;if(_0x3c9cee['query'][_0xbb58('0x43')]){_0x9d379f['include']=[{'all':!![]}];}return db[_0xbb58('0x2e')][_0xbb58('0x44')](_0x9d379f);})[_0xbb58('0x26')](function(_0x45817f){_0x643e0e['rows']=_0x45817f;return _0x643e0e;})[_0xbb58('0x26')](respondWithFilteredResult(_0x3304b9,_0x9d379f))[_0xbb58('0x45')](handleError(_0x3304b9,null));};exports[_0xbb58('0x46')]=function(_0x3a732c,_0x5b95f7){var _0x2ecc1b={'raw':!![],'where':{'id':_0x3a732c[_0xbb58('0x47')]['id']}},_0x5250e0={};_0x5250e0[_0xbb58('0x33')]=_[_0xbb58('0x36')](db[_0xbb58('0x2e')][_0xbb58('0x2f')]);_0x5250e0[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3a732c[_0xbb58('0x35')]);_0x5250e0[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x5250e0[_0xbb58('0x33')],_0x5250e0[_0xbb58('0x35')]);_0x2ecc1b[_0xbb58('0x38')]=_['intersection'](_0x5250e0[_0xbb58('0x33')],qs['fields'](_0x3a732c['query'][_0xbb58('0x3a')]));_0x2ecc1b[_0xbb58('0x38')]=_0x2ecc1b[_0xbb58('0x38')][_0xbb58('0x48')]?_0x2ecc1b[_0xbb58('0x38')]:_0x5250e0[_0xbb58('0x33')];if(_0x3a732c[_0xbb58('0x35')][_0xbb58('0x43')]){_0x2ecc1b[_0xbb58('0x49')]=[{'all':!![]}];}_0x2ecc1b=_[_0xbb58('0x41')]({},_0x2ecc1b,_0x3a732c[_0xbb58('0x42')]);return db['VoiceMail'][_0xbb58('0x4a')](_0x2ecc1b)[_0xbb58('0x26')](handleEntityNotFound(_0x5b95f7,null))['then'](respondWithResult(_0x5b95f7,null))[_0xbb58('0x45')](handleError(_0x5b95f7,null));};exports[_0xbb58('0x4b')]=function(_0xf94897,_0xdb0ff7){return db['VoiceMail'][_0xbb58('0x4b')](_0xf94897['body'],{})[_0xbb58('0x26')](function(_0x336598){var _0x471917=_0xf94897['user'][_0xbb58('0x27')]({'plain':!![]});if(!_0x471917)throw new Error(_0xbb58('0x4c'));if(_0x471917['role']===_0xbb58('0x4d')){var _0x4ca201=_0x336598[_0xbb58('0x27')]({'plain':!![]});var _0x2d81e0=_0xbb58('0x28');return db[_0xbb58('0x4e')][_0xbb58('0x4a')]({'where':{'name':_0x2d81e0,'userProfileId':_0x471917[_0xbb58('0x4f')]},'raw':!![]})[_0xbb58('0x26')](function(_0x4cb975){if(_0x4cb975&&_0x4cb975[_0xbb58('0x50')]===0x0){return db[_0xbb58('0x51')]['create']({'name':_0x4ca201[_0xbb58('0x2b')],'resourceId':_0x4ca201['id'],'type':_0x4cb975[_0xbb58('0x2b')],'sectionId':_0x4cb975['id']},{})['then'](function(){return _0x336598;});}else{return _0x336598;}})[_0xbb58('0x45')](function(_0x44636b){logger[_0xbb58('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44636b);throw _0x44636b;});}return _0x336598;})[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,0xc9))[_0xbb58('0x45')](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x24')]=function(_0x592879,_0x537ed5){if(_0x592879['body']['id']){delete _0x592879[_0xbb58('0x52')]['id'];}return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x592879['params']['id']}})['then'](handleEntityNotFound(_0x537ed5,null))[_0xbb58('0x26')](saveUpdates(_0x592879[_0xbb58('0x52')],null))[_0xbb58('0x26')](respondWithResult(_0x537ed5,null))[_0xbb58('0x45')](handleError(_0x537ed5,null));};exports[_0xbb58('0x25')]=function(_0x5290be,_0x362b91){return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x5290be['params']['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x362b91,null))[_0xbb58('0x26')](removeEntity(_0x362b91,null))[_0xbb58('0x45')](handleError(_0x362b91,null));};exports[_0xbb58('0x53')]=function(_0x3f5add,_0x5e7ae0,_0x1174b1){return db[_0xbb58('0x2e')][_0xbb58('0x54')]({'where':{'id':_0x3f5add[_0xbb58('0x47')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x5e7ae0,null))[_0xbb58('0x26')](function(_0x85278c){var _0x58ced2;var _0x55d5be={},_0x344b0d={};_0x344b0d['model']=_[_0xbb58('0x36')](db[_0xbb58('0x55')][_0xbb58('0x2f')]);_0x344b0d[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3f5add[_0xbb58('0x35')]);_0x344b0d[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x344b0d[_0xbb58('0x33')],_0x344b0d[_0xbb58('0x35')]);_0x55d5be[_0xbb58('0x38')]=_['intersection'](_0x344b0d[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3f5add[_0xbb58('0x35')]['fields']));_0x55d5be[_0xbb58('0x38')]=_0x55d5be['attributes'][_0xbb58('0x48')]?_0x55d5be[_0xbb58('0x38')]:_0x344b0d['model'];if(!_0x3f5add[_0xbb58('0x35')][_0xbb58('0x3b')](_0xbb58('0x56'))){_0x55d5be[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x3f5add['query']['limit']);_0x55d5be[_0xbb58('0x1c')]=qs[_0xbb58('0x1c')](_0x3f5add[_0xbb58('0x35')]['offset']);}_0x55d5be[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3f5add['query'][_0xbb58('0x3d')]);_0x55d5be[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3f5add[_0xbb58('0x35')],_0x344b0d[_0xbb58('0x37')]));if(_0x3f5add[_0xbb58('0x35')][_0xbb58('0x40')]){_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x55d5be[_0xbb58('0x38')],function(_0x2c9093){var _0x5e17fc={};_0x5e17fc[_0x2c9093]={'$like':'%'+_0x3f5add['query'][_0xbb58('0x40')]+'%'};return _0x5e17fc;})});}_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'mailboxuser':_0x85278c[_0xbb58('0x57')]});_0x55d5be=_[_0xbb58('0x41')]({},_0x55d5be,_0x3f5add[_0xbb58('0x42')]);return db[_0xbb58('0x55')][_0xbb58('0x58')](_0x55d5be)[_0xbb58('0x26')](respondWithFilteredResult(_0x5e7ae0,_0x55d5be));})[_0xbb58('0x45')](handleError(_0x5e7ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5550ff9..141ddd6 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 _0xd6a3=['../../config/environment','exports','VoiceMail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x33f5d9,_0x167ee8){var _0xbf8467=function(_0x3512ff){while(--_0x3512ff){_0x33f5d9['push'](_0x33f5d9['shift']());}};_0xbf8467(++_0x167ee8);}(_0xd6a3,0x18b));var _0x3d6a=function(_0x3c34b5,_0x49d1ee){_0x3c34b5=_0x3c34b5-0x0;var _0x39c455=_0xd6a3[_0x3c34b5];return _0x39c455;};'use strict';var _=require(_0x3d6a('0x0'));var util=require(_0x3d6a('0x1'));var logger=require(_0x3d6a('0x2'))(_0x3d6a('0x3'));var moment=require(_0x3d6a('0x4'));var BPromise=require(_0x3d6a('0x5'));var rp=require(_0x3d6a('0x6'));var fs=require('fs');var path=require(_0x3d6a('0x7'));var rimraf=require('rimraf');var config=require(_0x3d6a('0x8'));var attributes=require('./voiceMail.attributes');module[_0x3d6a('0x9')]=function(_0x451d09,_0x59538f){return _0x451d09['define'](_0x3d6a('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x3d6a('0xb'),'fields':['mailbox',_0x3d6a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2bb=['VoiceMail','voice_voicemail','mailbox_context','mailbox','context','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xe2bb,0xad));var _0xbe2b=function(_0x21afde,_0x4454ce){_0x21afde=_0x21afde-0x0;var _0x33cde=_0xe2bb[_0x21afde];return _0x33cde;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbe2b('0x0'))(_0xbe2b('0x1'));var moment=require(_0xbe2b('0x2'));var BPromise=require(_0xbe2b('0x3'));var rp=require(_0xbe2b('0x4'));var fs=require('fs');var path=require(_0xbe2b('0x5'));var rimraf=require('rimraf');var config=require(_0xbe2b('0x6'));var attributes=require(_0xbe2b('0x7'));module[_0xbe2b('0x8')]=function(_0xb3d2e5,_0x46b8bd){return _0xb3d2e5['define'](_0xbe2b('0x9'),attributes,{'tableName':_0xbe2b('0xa'),'paranoid':![],'indexes':[{'name':_0xbe2b('0xb'),'fields':[_0xbe2b('0xc'),_0xbe2b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 79c229a..2ea06e6 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 _0x3763=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring'];(function(_0xd33d44,_0x398fa4){var _0x3c1655=function(_0x3ad340){while(--_0x3ad340){_0xd33d44['push'](_0xd33d44['shift']());}};_0x3c1655(++_0x398fa4);}(_0x3763,0x1b5));var _0x3376=function(_0x598785,_0x148a9e){_0x598785=_0x598785-0x0;var _0x2235ff=_0x3763[_0x598785];return _0x2235ff;};'use strict';var _=require('lodash');var util=require(_0x3376('0x0'));var moment=require(_0x3376('0x1'));var BPromise=require('bluebird');var rs=require(_0x3376('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3376('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3376('0x4'))(_0x3376('0x5'));var config=require(_0x3376('0x6'));var jayson=require(_0x3376('0x7'));var client=jayson['client'][_0x3376('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28442f,_0x14a033,_0x4a1b36){return new BPromise(function(_0x423886,_0x2150f2){return client[_0x3376('0x9')](_0x28442f,_0x4a1b36)[_0x3376('0xa')](function(_0x1f8789){logger[_0x3376('0xb')](_0x3376('0xc'),_0x14a033,'request\x20sent');logger[_0x3376('0xd')](_0x3376('0xe'),_0x14a033,_0x3376('0xf'),JSON[_0x3376('0x10')](_0x1f8789));if(_0x1f8789['error']){if(_0x1f8789[_0x3376('0x11')][_0x3376('0x12')]===0x1f4){logger[_0x3376('0x11')](_0x3376('0xc'),_0x14a033,_0x1f8789['error'][_0x3376('0x13')]);return _0x2150f2(_0x1f8789[_0x3376('0x11')]['message']);}logger[_0x3376('0x11')](_0x3376('0xc'),_0x14a033,_0x1f8789[_0x3376('0x11')]['message']);return _0x423886(_0x1f8789[_0x3376('0x11')][_0x3376('0x13')]);}else{logger[_0x3376('0xb')](_0x3376('0xc'),_0x14a033,'request\x20sent');_0x423886(_0x1f8789[_0x3376('0x14')][_0x3376('0x13')]);}})[_0x3376('0x15')](function(_0x2b59db){logger['error'](_0x3376('0xc'),_0x14a033,_0x2b59db);_0x2150f2(_0x2b59db);});});} \ No newline at end of file +var _0xa26b=['http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xd05659,_0x4d7e49){var _0x20c9f2=function(_0x330e5c){while(--_0x330e5c){_0xd05659['push'](_0xd05659['shift']());}};_0x20c9f2(++_0x4d7e49);}(_0xa26b,0xad));var _0xba26=function(_0x3b146a,_0x40f083){_0x3b146a=_0x3b146a-0x0;var _0x4d25dd=_0xa26b[_0x3b146a];return _0x4d25dd;};'use strict';var _=require(_0xba26('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba26('0x1'));var rs=require(_0xba26('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba26('0x3'))['db'];var utils=require(_0xba26('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xba26('0x5'));var jayson=require(_0xba26('0x6'));var client=jayson['client'][_0xba26('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4dcfa6,_0x34b607,_0x35a126){return new BPromise(function(_0x4d0333,_0x5ab72a){return client['request'](_0x4dcfa6,_0x35a126)[_0xba26('0x8')](function(_0x287ce6){logger['info'](_0xba26('0x9'),_0x34b607,_0xba26('0xa'));logger[_0xba26('0xb')](_0xba26('0xc'),_0x34b607,_0xba26('0xa'),JSON[_0xba26('0xd')](_0x287ce6));if(_0x287ce6[_0xba26('0xe')]){if(_0x287ce6['error'][_0xba26('0xf')]===0x1f4){logger['error'](_0xba26('0x9'),_0x34b607,_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);return _0x5ab72a(_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);}logger[_0xba26('0xe')](_0xba26('0x9'),_0x34b607,_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);return _0x4d0333(_0x287ce6[_0xba26('0xe')][_0xba26('0x10')]);}else{logger[_0xba26('0x11')](_0xba26('0x9'),_0x34b607,'request\x20sent');_0x4d0333(_0x287ce6[_0xba26('0x12')][_0xba26('0x10')]);}})[_0xba26('0x13')](function(_0x5f3fba){logger[_0xba26('0xe')](_0xba26('0x9'),_0x34b607,_0x5f3fba);_0x5ab72a(_0x5f3fba);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 05130b4..f5d1cd9 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 _0x27ec=['get','index','isAuthenticated','/:id/download','download','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x4e6177,_0x2d4e74){var _0x387878=function(_0x2651f1){while(--_0x2651f1){_0x4e6177['push'](_0x4e6177['shift']());}};_0x387878(++_0x2d4e74);}(_0x27ec,0x138));var _0xc27e=function(_0x2e21a3,_0x323e2b){_0x2e21a3=_0x2e21a3-0x0;var _0xdd774d=_0x27ec[_0x2e21a3];return _0xdd774d;};'use strict';var multer=require(_0xc27e('0x0'));var util=require(_0xc27e('0x1'));var path=require(_0xc27e('0x2'));var timeout=require(_0xc27e('0x3'));var express=require(_0xc27e('0x4'));var router=express[_0xc27e('0x5')]();var fs_extra=require(_0xc27e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc27e('0x7'));var config=require(_0xc27e('0x8'));var controller=require(_0xc27e('0x9'));router[_0xc27e('0xa')]('/',auth['isAuthenticated'](),controller[_0xc27e('0xb')]);router['get']('/:id',auth[_0xc27e('0xc')](),controller['show']);router[_0xc27e('0xa')](_0xc27e('0xd'),auth[_0xc27e('0xc')](),controller[_0xc27e('0xe')]);router[_0xc27e('0xf')]('/',auth[_0xc27e('0xc')](),controller[_0xc27e('0x10')]);router[_0xc27e('0x11')]('/:id',auth[_0xc27e('0xc')](),controller[_0xc27e('0x12')]);router[_0xc27e('0x13')](_0xc27e('0x14'),auth['isAuthenticated'](),controller[_0xc27e('0x15')]);module[_0xc27e('0x16')]=router; \ No newline at end of file +var _0x36de=['../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','create','update','delete','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x10aaa6,_0x2637bf){var _0x123eb3=function(_0x16fcac){while(--_0x16fcac){_0x10aaa6['push'](_0x10aaa6['shift']());}};_0x123eb3(++_0x2637bf);}(_0x36de,0xa5));var _0xe36d=function(_0x760f83,_0x318445){_0x760f83=_0x760f83-0x0;var _0x1f0120=_0x36de[_0x760f83];return _0x1f0120;};'use strict';var multer=require(_0xe36d('0x0'));var util=require(_0xe36d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe36d('0x2')]();var fs_extra=require(_0xe36d('0x3'));var auth=require(_0xe36d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe36d('0x5'));var controller=require(_0xe36d('0x6'));router[_0xe36d('0x7')]('/',auth[_0xe36d('0x8')](),controller[_0xe36d('0x9')]);router[_0xe36d('0x7')](_0xe36d('0xa'),auth[_0xe36d('0x8')](),controller[_0xe36d('0xb')]);router['get'](_0xe36d('0xc'),auth[_0xe36d('0x8')](),controller[_0xe36d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe36d('0xe')]);router['put']('/:id',auth[_0xe36d('0x8')](),controller[_0xe36d('0xf')]);router[_0xe36d('0x10')](_0xe36d('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5d6898a..286d354 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 _0x8684=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x2b99ee,_0xe5ed84){var _0x520b7c=function(_0x3de9b0){while(--_0x3de9b0){_0x2b99ee['push'](_0x2b99ee['shift']());}};_0x520b7c(++_0xe5ed84);}(_0x8684,0x173));var _0x4868=function(_0x12c71b,_0x5cbef0){_0x12c71b=_0x12c71b-0x0;var _0x33bb1a=_0x8684[_0x12c71b];return _0x33bb1a;};'use strict';var Sequelize=require(_0x4868('0x0'));module[_0x4868('0x1')]={'name':{'type':Sequelize[_0x4868('0x2')],'get':function(_0x13cca4){return this[_0x4868('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x4868('0x5')](_0x4868('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4868('0x4')],'defaultValue':''},'stamp':{'type':_0x4868('0x7'),'defaultValue':Sequelize[_0x4868('0x8')](_0x4868('0x9'))}}; \ No newline at end of file +var _0x68ca=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','literal'];(function(_0x499ae9,_0x59c5f9){var _0x7f5632=function(_0x3af95f){while(--_0x3af95f){_0x499ae9['push'](_0x499ae9['shift']());}};_0x7f5632(++_0x59c5f9);}(_0x68ca,0x1f0));var _0xa68c=function(_0x175707,_0x1e9edb){_0x175707=_0x175707-0x0;var _0x2bd9b9=_0x68ca[_0x175707];return _0x2bd9b9;};'use strict';var Sequelize=require('sequelize');module[_0xa68c('0x0')]={'name':{'type':Sequelize[_0xa68c('0x1')],'get':function(_0x3722c8){return this[_0xa68c('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa68c('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa68c('0x5')](_0xa68c('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xa68c('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa68c('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 79ed918..36a70ef 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 _0x71dc=['includeAll','include','rows','catch','params','create','body','update','find','destroy','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','.wav\x22','set','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','then','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options'];(function(_0x41bdda,_0x50b470){var _0x827644=function(_0x49bdcb){while(--_0x49bdcb){_0x41bdda['push'](_0x41bdda['shift']());}};_0x827644(++_0x50b470);}(_0x71dc,0x154));var _0xc71d=function(_0x105ed5,_0x48bff3){_0x105ed5=_0x105ed5-0x0;var _0x493752=_0x71dc[_0x105ed5];return _0x493752;};'use strict';var emlformat=require(_0xc71d('0x0'));var rimraf=require(_0xc71d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc71d('0x2'));var rp=require(_0xc71d('0x3'));var moment=require('moment');var BPromise=require(_0xc71d('0x4'));var Mustache=require(_0xc71d('0x5'));var util=require(_0xc71d('0x6'));var path=require('path');var sox=require(_0xc71d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc71d('0x8'));var _=require(_0xc71d('0x9'));var squel=require(_0xc71d('0xa'));var crypto=require(_0xc71d('0xb'));var jsforce=require(_0xc71d('0xc'));var deskjs=require(_0xc71d('0xd'));var toCsv=require(_0xc71d('0xe'));var querystring=require(_0xc71d('0xf'));var Papa=require(_0xc71d('0x10'));var Redis=require(_0xc71d('0x11'));var authService=require(_0xc71d('0x12'));var qs=require(_0xc71d('0x13'));var as=require(_0xc71d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc71d('0x15'))(_0xc71d('0x16'));var utils=require(_0xc71d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc71d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38a023,_0x458998){_0x458998=_0x458998||0xcc;return function(_0x3c441b){if(_0x3c441b){return _0x38a023[_0xc71d('0x19')](_0x458998);}return _0x38a023[_0xc71d('0x1a')](_0x458998)[_0xc71d('0x1b')]();};}function respondWithResult(_0x4a650b,_0x4f24bf){_0x4f24bf=_0x4f24bf||0xc8;return function(_0x2c57df){if(_0x2c57df){return _0x4a650b[_0xc71d('0x1a')](_0x4f24bf)[_0xc71d('0x1c')](_0x2c57df);}};}function respondWithFilteredResult(_0x339c0c,_0x33a6e9){return function(_0xbecb46){if(_0xbecb46){var _0x1a2717=typeof _0x33a6e9[_0xc71d('0x1d')]===_0xc71d('0x1e')&&typeof _0x33a6e9['limit']===_0xc71d('0x1e');var _0x11ced8=_0xbecb46[_0xc71d('0x1f')];var _0x1dc64e=_0x1a2717?0x0:_0x33a6e9[_0xc71d('0x1d')];var _0xb5d87f=_0x1a2717?_0xbecb46[_0xc71d('0x1f')]:_0x33a6e9[_0xc71d('0x1d')]+_0x33a6e9[_0xc71d('0x20')];var _0x23231a;if(_0xb5d87f>=_0x11ced8){_0xb5d87f=_0x11ced8;_0x23231a=0xc8;}else{_0x23231a=0xce;}_0x339c0c['status'](_0x23231a);return _0x339c0c['set']('Content-Range',_0x1dc64e+'-'+_0xb5d87f+'/'+_0x11ced8)[_0xc71d('0x1c')](_0xbecb46);}return null;};}function patchUpdates(_0x54f831){return function(_0x1eb3bf){try{jsonpatch['apply'](_0x1eb3bf,_0x54f831,!![]);}catch(_0x8533ae){return BPromise[_0xc71d('0x21')](_0x8533ae);}return _0x1eb3bf[_0xc71d('0x22')]();};}function saveUpdates(_0x9fedc8,_0x53e19a){return function(_0x66bd35){if(_0x66bd35){return _0x66bd35['update'](_0x9fedc8)['then'](function(_0x2356cf){return _0x2356cf;});}return null;};}function removeEntity(_0xdd2cb8,_0x35d249){return function(_0x154186){if(_0x154186){return _0x154186['destroy']()[_0xc71d('0x23')](function(){_0xdd2cb8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x594c4d,_0x144580){return function(_0x4556da){if(!_0x4556da){_0x594c4d[_0xc71d('0x19')](0x194);}return _0x4556da;};}function handleError(_0x42ec87,_0xa1fdde){_0xa1fdde=_0xa1fdde||0x1f4;return function(_0x3a758e){logger['error'](_0x3a758e[_0xc71d('0x24')]);if(_0x3a758e[_0xc71d('0x25')]){delete _0x3a758e[_0xc71d('0x25')];}_0x42ec87[_0xc71d('0x1a')](_0xa1fdde)['send'](_0x3a758e);};}exports['index']=function(_0x5d46d6,_0x537a24){var _0xaf470e={},_0x4faf54={},_0x35ae57={'count':0x0,'rows':[]};var _0x1ab2ac=_[_0xc71d('0x26')](db[_0xc71d('0x27')][_0xc71d('0x28')],function(_0xd154d4){return{'name':_0xd154d4[_0xc71d('0x29')],'type':_0xd154d4['type']['key']};});_0x4faf54[_0xc71d('0x2a')]=_['differenceBy'](_['map'](_0x1ab2ac,_0xc71d('0x25')),['name']);_0x4faf54[_0xc71d('0x2b')]=_[_0xc71d('0x2c')](_0x5d46d6[_0xc71d('0x2b')]);_0x4faf54['filters']=_[_0xc71d('0x2d')](_0x4faf54['model'],_0x4faf54['query']);_0xaf470e[_0xc71d('0x2e')]=_['intersection'](_0x4faf54[_0xc71d('0x2a')],qs[_0xc71d('0x2f')](_0x5d46d6[_0xc71d('0x2b')][_0xc71d('0x2f')]));_0xaf470e[_0xc71d('0x2e')]=_0xaf470e[_0xc71d('0x2e')][_0xc71d('0x30')]?_0xaf470e[_0xc71d('0x2e')]:_0x4faf54['model'];if(!_0x5d46d6[_0xc71d('0x2b')]['hasOwnProperty'](_0xc71d('0x31'))){_0xaf470e[_0xc71d('0x20')]=qs[_0xc71d('0x20')](_0x5d46d6[_0xc71d('0x2b')][_0xc71d('0x20')]);_0xaf470e[_0xc71d('0x1d')]=qs[_0xc71d('0x1d')](_0x5d46d6[_0xc71d('0x2b')]['offset']);}_0xaf470e[_0xc71d('0x32')]=qs['sort'](_0x5d46d6[_0xc71d('0x2b')][_0xc71d('0x33')]);_0xaf470e['where']=qs[_0xc71d('0x34')](_[_0xc71d('0x35')](_0x5d46d6['query'],_0x4faf54[_0xc71d('0x34')]),_0x1ab2ac);if(_0x5d46d6[_0xc71d('0x2b')][_0xc71d('0x36')]){_0xaf470e['where']=_['merge'](_0xaf470e[_0xc71d('0x37')],{'$or':_[_0xc71d('0x26')](_0x1ab2ac,function(_0x387e6d){if(_0x387e6d[_0xc71d('0x38')]!==_0xc71d('0x39')){var _0x4d2799={};_0x4d2799[_0x387e6d[_0xc71d('0x25')]]={'$like':'%'+_0x5d46d6[_0xc71d('0x2b')][_0xc71d('0x36')]+'%'};return _0x4d2799;}})});}_0xaf470e=_[_0xc71d('0x3a')]({},_0xaf470e,_0x5d46d6[_0xc71d('0x3b')]);var _0x390467={'where':_0xaf470e[_0xc71d('0x37')]};return db[_0xc71d('0x27')][_0xc71d('0x1f')](_0x390467)[_0xc71d('0x23')](function(_0x18267e){_0x35ae57[_0xc71d('0x1f')]=_0x18267e;if(_0x5d46d6[_0xc71d('0x2b')][_0xc71d('0x3c')]){_0xaf470e[_0xc71d('0x3d')]=[{'all':!![]}];}return db[_0xc71d('0x27')]['findAll'](_0xaf470e);})[_0xc71d('0x23')](function(_0x3a343d){_0x35ae57[_0xc71d('0x3e')]=_0x3a343d;return _0x35ae57;})['then'](respondWithFilteredResult(_0x537a24,_0xaf470e))[_0xc71d('0x3f')](handleError(_0x537a24,null));};exports['show']=function(_0x13ba21,_0x337cb5){var _0x40bf4b={'raw':!![],'where':{'id':_0x13ba21[_0xc71d('0x40')]['id']}},_0x4570da={};_0x4570da[_0xc71d('0x2a')]=_[_0xc71d('0x2c')](db[_0xc71d('0x27')]['rawAttributes']);_0x4570da['query']=_['keys'](_0x13ba21[_0xc71d('0x2b')]);_0x4570da['filters']=_[_0xc71d('0x2d')](_0x4570da[_0xc71d('0x2a')],_0x4570da['query']);_0x40bf4b['attributes']=_[_0xc71d('0x2d')](_0x4570da[_0xc71d('0x2a')],qs[_0xc71d('0x2f')](_0x13ba21[_0xc71d('0x2b')][_0xc71d('0x2f')]));_0x40bf4b['attributes']=_0x40bf4b[_0xc71d('0x2e')][_0xc71d('0x30')]?_0x40bf4b['attributes']:_0x4570da[_0xc71d('0x2a')];if(_0x13ba21['query'][_0xc71d('0x3c')]){_0x40bf4b[_0xc71d('0x3d')]=[{'all':!![]}];}_0x40bf4b=_[_0xc71d('0x3a')]({},_0x40bf4b,_0x13ba21[_0xc71d('0x3b')]);return db[_0xc71d('0x27')]['find'](_0x40bf4b)['then'](handleEntityNotFound(_0x337cb5,null))['then'](respondWithResult(_0x337cb5,null))[_0xc71d('0x3f')](handleError(_0x337cb5,null));};exports['create']=function(_0xd687f1,_0x29d3db){return db[_0xc71d('0x27')][_0xc71d('0x41')](_0xd687f1[_0xc71d('0x42')],{})[_0xc71d('0x23')](respondWithResult(_0x29d3db,0xc9))[_0xc71d('0x3f')](handleError(_0x29d3db,null));};exports[_0xc71d('0x43')]=function(_0x2a1251,_0x141915){if(_0x2a1251[_0xc71d('0x42')]['id']){delete _0x2a1251[_0xc71d('0x42')]['id'];}return db[_0xc71d('0x27')][_0xc71d('0x44')]({'where':{'id':_0x2a1251[_0xc71d('0x40')]['id']}})[_0xc71d('0x23')](handleEntityNotFound(_0x141915,null))[_0xc71d('0x23')](saveUpdates(_0x2a1251[_0xc71d('0x42')],null))[_0xc71d('0x23')](respondWithResult(_0x141915,null))[_0xc71d('0x3f')](handleError(_0x141915,null));};exports[_0xc71d('0x45')]=function(_0x225a7d,_0x235111){return db['VoiceMailMessage'][_0xc71d('0x44')]({'where':{'id':_0x225a7d[_0xc71d('0x40')]['id']}})[_0xc71d('0x23')](handleEntityNotFound(_0x235111,null))[_0xc71d('0x23')](removeEntity(_0x235111,null))[_0xc71d('0x3f')](handleError(_0x235111,null));};exports['download']=function(_0x4252f9,_0xe5741a,_0x3eaf08){return db[_0xc71d('0x27')][_0xc71d('0x44')]({'where':{'id':_0x4252f9[_0xc71d('0x40')]['id']},'attributes':['id','recording','msg_id']})['then'](handleEntityNotFound(_0xe5741a,null))[_0xc71d('0x23')](function(_0x2924ab){if(_0x2924ab){if(!_0x2924ab[_0xc71d('0x46')]){throw new db[(_0xc71d('0x47'))]['ValidationError'](_0xc71d('0x48'));}var _0x19e718={'Content-Type':_0xc71d('0x49'),'Content-Disposition':_0xc71d('0x4a')};if(_0x2924ab[_0xc71d('0x4b')]){_0x19e718[_0xc71d('0x4c')]='attachment;\x20filename=\x22'+_0x2924ab[_0xc71d('0x4b')]+_0xc71d('0x4d');}_0xe5741a[_0xc71d('0x4e')](_0x19e718);return _0xe5741a[_0xc71d('0x4f')](new Buffer(_0x2924ab['recording']));}})['catch'](handleError(_0xe5741a,null));}; \ No newline at end of file +var _0xbe41=['squel','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbe41,0x96));var _0x1be4=function(_0x1297d2,_0x2f38bf){_0x1297d2=_0x1297d2-0x0;var _0x4b3489=_0xbe41[_0x1297d2];return _0x4b3489;};'use strict';var emlformat=require(_0x1be4('0x0'));var rimraf=require(_0x1be4('0x1'));var zipdir=require(_0x1be4('0x2'));var jsonpatch=require(_0x1be4('0x3'));var rp=require(_0x1be4('0x4'));var moment=require(_0x1be4('0x5'));var BPromise=require(_0x1be4('0x6'));var Mustache=require(_0x1be4('0x7'));var util=require(_0x1be4('0x8'));var path=require(_0x1be4('0x9'));var sox=require(_0x1be4('0xa'));var csv=require(_0x1be4('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1be4('0xc'));var _=require(_0x1be4('0xd'));var squel=require(_0x1be4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1be4('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1be4('0xf'));var authService=require(_0x1be4('0x10'));var qs=require(_0x1be4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1be4('0x12'));var utils=require(_0x1be4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1be4('0x14'));var db=require(_0x1be4('0x15'))['db'];function respondWithStatusCode(_0x167dc2,_0x1992a8){_0x1992a8=_0x1992a8||0xcc;return function(_0x15f0f3){if(_0x15f0f3){return _0x167dc2[_0x1be4('0x16')](_0x1992a8);}return _0x167dc2[_0x1be4('0x17')](_0x1992a8)[_0x1be4('0x18')]();};}function respondWithResult(_0xeb16e5,_0x3a3b3f){_0x3a3b3f=_0x3a3b3f||0xc8;return function(_0x3f6727){if(_0x3f6727){return _0xeb16e5[_0x1be4('0x17')](_0x3a3b3f)[_0x1be4('0x19')](_0x3f6727);}};}function respondWithFilteredResult(_0x5866e8,_0x57fb72){return function(_0x13f4f0){if(_0x13f4f0){var _0x530cfa=typeof _0x57fb72[_0x1be4('0x1a')]===_0x1be4('0x1b')&&typeof _0x57fb72['limit']===_0x1be4('0x1b');var _0x51cc30=_0x13f4f0[_0x1be4('0x1c')];var _0x4de86d=_0x530cfa?0x0:_0x57fb72[_0x1be4('0x1a')];var _0x193662=_0x530cfa?_0x13f4f0[_0x1be4('0x1c')]:_0x57fb72[_0x1be4('0x1a')]+_0x57fb72[_0x1be4('0x1d')];var _0x3ad94c;if(_0x193662>=_0x51cc30){_0x193662=_0x51cc30;_0x3ad94c=0xc8;}else{_0x3ad94c=0xce;}_0x5866e8[_0x1be4('0x17')](_0x3ad94c);return _0x5866e8[_0x1be4('0x1e')]('Content-Range',_0x4de86d+'-'+_0x193662+'/'+_0x51cc30)[_0x1be4('0x19')](_0x13f4f0);}return null;};}function patchUpdates(_0x14c53f){return function(_0x4b29a3){try{jsonpatch['apply'](_0x4b29a3,_0x14c53f,!![]);}catch(_0x352a9a){return BPromise[_0x1be4('0x1f')](_0x352a9a);}return _0x4b29a3[_0x1be4('0x20')]();};}function saveUpdates(_0x3ed80e,_0x5289d2){return function(_0x24855e){if(_0x24855e){return _0x24855e[_0x1be4('0x21')](_0x3ed80e)[_0x1be4('0x22')](function(_0x41db06){return _0x41db06;});}return null;};}function removeEntity(_0x401fb2,_0x89734e){return function(_0x14433f){if(_0x14433f){return _0x14433f[_0x1be4('0x23')]()['then'](function(){_0x401fb2[_0x1be4('0x17')](0xcc)[_0x1be4('0x18')]();});}};}function handleEntityNotFound(_0x2dd520,_0x4e8a61){return function(_0x1c2ea6){if(!_0x1c2ea6){_0x2dd520[_0x1be4('0x16')](0x194);}return _0x1c2ea6;};}function handleError(_0x1814fc,_0x29abda){_0x29abda=_0x29abda||0x1f4;return function(_0x3b63e2){logger[_0x1be4('0x24')](_0x3b63e2[_0x1be4('0x25')]);if(_0x3b63e2['name']){delete _0x3b63e2['name'];}_0x1814fc[_0x1be4('0x17')](_0x29abda)[_0x1be4('0x26')](_0x3b63e2);};}exports[_0x1be4('0x27')]=function(_0x434a00,_0xc7bc18){var _0x260488={},_0x1f29c6={},_0x1be9d4={'count':0x0,'rows':[]};var _0x2bfc9d=_[_0x1be4('0x28')](db[_0x1be4('0x29')][_0x1be4('0x2a')],function(_0x5ed492){return{'name':_0x5ed492[_0x1be4('0x2b')],'type':_0x5ed492[_0x1be4('0x2c')]['key']};});_0x1f29c6['model']=_[_0x1be4('0x2d')](_[_0x1be4('0x28')](_0x2bfc9d,_0x1be4('0x2e')),[_0x1be4('0x2e')]);_0x1f29c6[_0x1be4('0x2f')]=_['keys'](_0x434a00[_0x1be4('0x2f')]);_0x1f29c6[_0x1be4('0x30')]=_[_0x1be4('0x31')](_0x1f29c6[_0x1be4('0x32')],_0x1f29c6['query']);_0x260488[_0x1be4('0x33')]=_[_0x1be4('0x31')](_0x1f29c6['model'],qs[_0x1be4('0x34')](_0x434a00[_0x1be4('0x2f')][_0x1be4('0x34')]));_0x260488[_0x1be4('0x33')]=_0x260488[_0x1be4('0x33')][_0x1be4('0x35')]?_0x260488['attributes']:_0x1f29c6['model'];if(!_0x434a00['query'][_0x1be4('0x36')](_0x1be4('0x37'))){_0x260488[_0x1be4('0x1d')]=qs[_0x1be4('0x1d')](_0x434a00[_0x1be4('0x2f')][_0x1be4('0x1d')]);_0x260488['offset']=qs[_0x1be4('0x1a')](_0x434a00[_0x1be4('0x2f')][_0x1be4('0x1a')]);}_0x260488[_0x1be4('0x38')]=qs[_0x1be4('0x39')](_0x434a00['query'][_0x1be4('0x39')]);_0x260488[_0x1be4('0x3a')]=qs[_0x1be4('0x30')](_['pick'](_0x434a00['query'],_0x1f29c6[_0x1be4('0x30')]),_0x2bfc9d);if(_0x434a00[_0x1be4('0x2f')][_0x1be4('0x3b')]){_0x260488[_0x1be4('0x3a')]=_[_0x1be4('0x3c')](_0x260488[_0x1be4('0x3a')],{'$or':_['map'](_0x2bfc9d,function(_0x45536e){if(_0x45536e[_0x1be4('0x2c')]!==_0x1be4('0x3d')){var _0x44ddf0={};_0x44ddf0[_0x45536e[_0x1be4('0x2e')]]={'$like':'%'+_0x434a00[_0x1be4('0x2f')][_0x1be4('0x3b')]+'%'};return _0x44ddf0;}})});}_0x260488=_[_0x1be4('0x3c')]({},_0x260488,_0x434a00['options']);var _0x540e6c={'where':_0x260488[_0x1be4('0x3a')]};return db[_0x1be4('0x29')][_0x1be4('0x1c')](_0x540e6c)['then'](function(_0x24328c){_0x1be9d4[_0x1be4('0x1c')]=_0x24328c;if(_0x434a00[_0x1be4('0x2f')][_0x1be4('0x3e')]){_0x260488[_0x1be4('0x3f')]=[{'all':!![]}];}return db[_0x1be4('0x29')][_0x1be4('0x40')](_0x260488);})[_0x1be4('0x22')](function(_0xb04a2f){_0x1be9d4[_0x1be4('0x41')]=_0xb04a2f;return _0x1be9d4;})[_0x1be4('0x22')](respondWithFilteredResult(_0xc7bc18,_0x260488))[_0x1be4('0x42')](handleError(_0xc7bc18,null));};exports[_0x1be4('0x43')]=function(_0x3fa707,_0x41ab8c){var _0x394e9a={'raw':!![],'where':{'id':_0x3fa707[_0x1be4('0x44')]['id']}},_0x331e4d={};_0x331e4d[_0x1be4('0x32')]=_['keys'](db[_0x1be4('0x29')][_0x1be4('0x2a')]);_0x331e4d[_0x1be4('0x2f')]=_[_0x1be4('0x45')](_0x3fa707[_0x1be4('0x2f')]);_0x331e4d[_0x1be4('0x30')]=_[_0x1be4('0x31')](_0x331e4d[_0x1be4('0x32')],_0x331e4d[_0x1be4('0x2f')]);_0x394e9a[_0x1be4('0x33')]=_[_0x1be4('0x31')](_0x331e4d[_0x1be4('0x32')],qs[_0x1be4('0x34')](_0x3fa707[_0x1be4('0x2f')][_0x1be4('0x34')]));_0x394e9a[_0x1be4('0x33')]=_0x394e9a[_0x1be4('0x33')]['length']?_0x394e9a[_0x1be4('0x33')]:_0x331e4d[_0x1be4('0x32')];if(_0x3fa707['query'][_0x1be4('0x3e')]){_0x394e9a['include']=[{'all':!![]}];}_0x394e9a=_[_0x1be4('0x3c')]({},_0x394e9a,_0x3fa707[_0x1be4('0x46')]);return db[_0x1be4('0x29')][_0x1be4('0x47')](_0x394e9a)[_0x1be4('0x22')](handleEntityNotFound(_0x41ab8c,null))[_0x1be4('0x22')](respondWithResult(_0x41ab8c,null))[_0x1be4('0x42')](handleError(_0x41ab8c,null));};exports[_0x1be4('0x48')]=function(_0x13920f,_0x30504b){return db[_0x1be4('0x29')][_0x1be4('0x48')](_0x13920f['body'],{})[_0x1be4('0x22')](respondWithResult(_0x30504b,0xc9))[_0x1be4('0x42')](handleError(_0x30504b,null));};exports['update']=function(_0xa36d7a,_0x34034c){if(_0xa36d7a['body']['id']){delete _0xa36d7a['body']['id'];}return db[_0x1be4('0x29')]['find']({'where':{'id':_0xa36d7a[_0x1be4('0x44')]['id']}})[_0x1be4('0x22')](handleEntityNotFound(_0x34034c,null))[_0x1be4('0x22')](saveUpdates(_0xa36d7a[_0x1be4('0x49')],null))[_0x1be4('0x22')](respondWithResult(_0x34034c,null))['catch'](handleError(_0x34034c,null));};exports[_0x1be4('0x23')]=function(_0x5b4cac,_0x58e005){return db[_0x1be4('0x29')][_0x1be4('0x47')]({'where':{'id':_0x5b4cac['params']['id']}})[_0x1be4('0x22')](handleEntityNotFound(_0x58e005,null))['then'](removeEntity(_0x58e005,null))[_0x1be4('0x42')](handleError(_0x58e005,null));};exports[_0x1be4('0x4a')]=function(_0x58db67,_0x23c7bc,_0x57679c){return db[_0x1be4('0x29')][_0x1be4('0x47')]({'where':{'id':_0x58db67[_0x1be4('0x44')]['id']},'attributes':['id','recording','msg_id']})[_0x1be4('0x22')](handleEntityNotFound(_0x23c7bc,null))[_0x1be4('0x22')](function(_0x3804ef){if(_0x3804ef){if(!_0x3804ef[_0x1be4('0x4b')]){throw new db['Sequelize'][(_0x1be4('0x4c'))](_0x1be4('0x4d'));}var _0x4707ed={'Content-Type':_0x1be4('0x4e'),'Content-Disposition':'attachment'};if(_0x3804ef[_0x1be4('0x4f')]){_0x4707ed[_0x1be4('0x50')]='attachment;\x20filename=\x22'+_0x3804ef[_0x1be4('0x4f')]+_0x1be4('0x51');}_0x23c7bc['set'](_0x4707ed);return _0x23c7bc[_0x1be4('0x26')](new Buffer(_0x3804ef[_0x1be4('0x4b')]));}})[_0x1be4('0x42')](handleError(_0x23c7bc,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 34600dc..3d2847a 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 _0x6a96=['dir','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage'];(function(_0x4fe416,_0x5a310a){var _0x252725=function(_0x1d67db){while(--_0x1d67db){_0x4fe416['push'](_0x4fe416['shift']());}};_0x252725(++_0x5a310a);}(_0x6a96,0x1bb));var _0x66a9=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x6a96[_0x2a55f8];return _0x245efd;};'use strict';var _=require(_0x66a9('0x0'));var util=require(_0x66a9('0x1'));var logger=require(_0x66a9('0x2'))(_0x66a9('0x3'));var moment=require(_0x66a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x66a9('0x5'));var fs=require('fs');var path=require(_0x66a9('0x6'));var rimraf=require(_0x66a9('0x7'));var config=require(_0x66a9('0x8'));var attributes=require(_0x66a9('0x9'));module['exports']=function(_0x383e7e,_0x5acd82){return _0x383e7e[_0x66a9('0xa')](_0x66a9('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x66a9('0xc'),'fields':[_0x66a9('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x023c=['util','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash'];(function(_0x1c9a61,_0xdb42b4){var _0x30fef2=function(_0x3406bc){while(--_0x3406bc){_0x1c9a61['push'](_0x1c9a61['shift']());}};_0x30fef2(++_0xdb42b4);}(_0x023c,0x15e));var _0xc023=function(_0x1c953a,_0x3174cf){_0x1c953a=_0x1c953a-0x0;var _0x4fdf02=_0x023c[_0x1c953a];return _0x4fdf02;};'use strict';var _=require(_0xc023('0x0'));var util=require(_0xc023('0x1'));var logger=require('../../config/logger')(_0xc023('0x2'));var moment=require(_0xc023('0x3'));var BPromise=require(_0xc023('0x4'));var rp=require(_0xc023('0x5'));var fs=require('fs');var path=require(_0xc023('0x6'));var rimraf=require(_0xc023('0x7'));var config=require('../../config/environment');var attributes=require(_0xc023('0x8'));module[_0xc023('0x9')]=function(_0xf8fc52,_0x3440e9){return _0xf8fc52[_0xc023('0xa')]('VoiceMailMessage',attributes,{'tableName':_0xc023('0xb'),'paranoid':![],'indexes':[{'name':_0xc023('0xc'),'fields':[_0xc023('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 827f9d3..2ac388d 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 _0x0e74=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x23017e,_0x3e2ceb){var _0xe0848a=function(_0x103542){while(--_0x103542){_0x23017e['push'](_0x23017e['shift']());}};_0xe0848a(++_0x3e2ceb);}(_0x0e74,0x72));var _0x40e7=function(_0xf90dc0,_0x59229b){_0xf90dc0=_0xf90dc0-0x0;var _0xf72c1a=_0x0e74[_0xf90dc0];return _0xf72c1a;};'use strict';var _=require(_0x40e7('0x0'));var util=require(_0x40e7('0x1'));var moment=require('moment');var BPromise=require(_0x40e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40e7('0x3'));var db=require(_0x40e7('0x4'))['db'];var utils=require(_0x40e7('0x5'));var logger=require('../../config/logger')(_0x40e7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x40e7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf6db46,_0x4b5778,_0x30f789){return new BPromise(function(_0x6ef3d4,_0x500742){return client['request'](_0xf6db46,_0x30f789)[_0x40e7('0x8')](function(_0x2648d3){logger[_0x40e7('0x9')](_0x40e7('0xa'),_0x4b5778,'request\x20sent');logger[_0x40e7('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4b5778,_0x40e7('0xc'),JSON[_0x40e7('0xd')](_0x2648d3));if(_0x2648d3[_0x40e7('0xe')]){if(_0x2648d3['error'][_0x40e7('0xf')]===0x1f4){logger[_0x40e7('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x4b5778,_0x2648d3[_0x40e7('0xe')][_0x40e7('0x10')]);return _0x500742(_0x2648d3[_0x40e7('0xe')][_0x40e7('0x10')]);}logger[_0x40e7('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x4b5778,_0x2648d3[_0x40e7('0xe')]['message']);return _0x6ef3d4(_0x2648d3[_0x40e7('0xe')][_0x40e7('0x10')]);}else{logger[_0x40e7('0x9')](_0x40e7('0xa'),_0x4b5778,_0x40e7('0xc'));_0x6ef3d4(_0x2648d3[_0x40e7('0x11')][_0x40e7('0x10')]);}})[_0x40e7('0x12')](function(_0x5d1b29){logger[_0x40e7('0xe')](_0x40e7('0xa'),_0x4b5778,_0x5d1b29);_0x500742(_0x5d1b29);});});} \ No newline at end of file +var _0xcc96=['../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x368c09,_0x29b826){var _0x27eb34=function(_0x1f6794){while(--_0x1f6794){_0x368c09['push'](_0x368c09['shift']());}};_0x27eb34(++_0x29b826);}(_0xcc96,0x17f));var _0x6cc9=function(_0x405f6b,_0x33125d){_0x405f6b=_0x405f6b-0x0;var _0x12f6d3=_0xcc96[_0x405f6b];return _0x12f6d3;};'use strict';var _=require('lodash');var util=require(_0x6cc9('0x0'));var moment=require(_0x6cc9('0x1'));var BPromise=require(_0x6cc9('0x2'));var rs=require(_0x6cc9('0x3'));var fs=require('fs');var Redis=require(_0x6cc9('0x4'));var db=require(_0x6cc9('0x5'))['db'];var utils=require(_0x6cc9('0x6'));var logger=require(_0x6cc9('0x7'))('rpc');var config=require(_0x6cc9('0x8'));var jayson=require(_0x6cc9('0x9'));var client=jayson[_0x6cc9('0xa')][_0x6cc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41e751,_0x4840b2,_0x2cd6ce){return new BPromise(function(_0x21f6e6,_0x449eb7){return client[_0x6cc9('0xc')](_0x41e751,_0x2cd6ce)['then'](function(_0x3bef1d){logger[_0x6cc9('0xd')](_0x6cc9('0xe'),_0x4840b2,'request\x20sent');logger[_0x6cc9('0xf')](_0x6cc9('0x10'),_0x4840b2,_0x6cc9('0x11'),JSON[_0x6cc9('0x12')](_0x3bef1d));if(_0x3bef1d[_0x6cc9('0x13')]){if(_0x3bef1d['error'][_0x6cc9('0x14')]===0x1f4){logger[_0x6cc9('0x13')](_0x6cc9('0xe'),_0x4840b2,_0x3bef1d[_0x6cc9('0x13')][_0x6cc9('0x15')]);return _0x449eb7(_0x3bef1d[_0x6cc9('0x13')][_0x6cc9('0x15')]);}logger['error'](_0x6cc9('0xe'),_0x4840b2,_0x3bef1d[_0x6cc9('0x13')]['message']);return _0x21f6e6(_0x3bef1d[_0x6cc9('0x13')][_0x6cc9('0x15')]);}else{logger['info'](_0x6cc9('0xe'),_0x4840b2,_0x6cc9('0x11'));_0x21f6e6(_0x3bef1d[_0x6cc9('0x16')][_0x6cc9('0x15')]);}})['catch'](function(_0xa4615d){logger[_0x6cc9('0x13')](_0x6cc9('0xe'),_0x4840b2,_0xa4615d);_0x449eb7(_0xa4615d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6eb2a9d..03c24d7 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 _0xcf3d=['getSounds','post','create','put','delete','destroy','removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds'];(function(_0x2a1bdf,_0x1291b1){var _0x1b0f13=function(_0x1536ec){while(--_0x1536ec){_0x2a1bdf['push'](_0x2a1bdf['shift']());}};_0x1b0f13(++_0x1291b1);}(_0xcf3d,0x1a6));var _0xdcf3=function(_0x43fab1,_0x2d2876){_0x43fab1=_0x43fab1-0x0;var _0x12c5dd=_0xcf3d[_0x43fab1];return _0x12c5dd;};'use strict';var multer=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var path=require(_0xdcf3('0x2'));var timeout=require('connect-timeout');var express=require(_0xdcf3('0x3'));var router=express[_0xdcf3('0x4')]();var fs_extra=require(_0xdcf3('0x5'));var auth=require(_0xdcf3('0x6'));var interaction=require(_0xdcf3('0x7'));var config=require(_0xdcf3('0x8'));var controller=require(_0xdcf3('0x9'));router[_0xdcf3('0xa')]('/',auth[_0xdcf3('0xb')](),controller['index']);router['get'](_0xdcf3('0xc'),auth[_0xdcf3('0xb')](),controller[_0xdcf3('0xd')]);router[_0xdcf3('0xa')](_0xdcf3('0xe'),auth[_0xdcf3('0xb')](),controller[_0xdcf3('0xf')]);router[_0xdcf3('0x10')]('/',auth['isAuthenticated'](),controller[_0xdcf3('0x11')]);router[_0xdcf3('0x10')](_0xdcf3('0xe'),auth[_0xdcf3('0xb')](),controller['addSound']);router[_0xdcf3('0x12')](_0xdcf3('0xc'),auth[_0xdcf3('0xb')](),controller['update']);router[_0xdcf3('0x13')](_0xdcf3('0xc'),auth[_0xdcf3('0xb')](),controller[_0xdcf3('0x14')]);router[_0xdcf3('0x13')]('/:id/sounds/:id2',auth[_0xdcf3('0xb')](),controller[_0xdcf3('0x15')]);module[_0xdcf3('0x16')]=router; \ No newline at end of file +var _0x7265=['/:id/sounds/:id2','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','create','addSound','put','delete','destroy'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7265,0x17c));var _0x5726=function(_0x4551f2,_0x4483f9){_0x4551f2=_0x4551f2-0x0;var _0x2a14e0=_0x7265[_0x4551f2];return _0x2a14e0;};'use strict';var multer=require(_0x5726('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5726('0x1'));var router=express[_0x5726('0x2')]();var fs_extra=require(_0x5726('0x3'));var auth=require(_0x5726('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5726('0x5'));var controller=require(_0x5726('0x6'));router[_0x5726('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5726('0x7')](_0x5726('0x8'),auth['isAuthenticated'](),controller[_0x5726('0x9')]);router[_0x5726('0x7')](_0x5726('0xa'),auth[_0x5726('0xb')](),controller[_0x5726('0xc')]);router[_0x5726('0xd')]('/',auth[_0x5726('0xb')](),controller[_0x5726('0xe')]);router['post'](_0x5726('0xa'),auth['isAuthenticated'](),controller[_0x5726('0xf')]);router[_0x5726('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5726('0x11')](_0x5726('0x8'),auth[_0x5726('0xb')](),controller[_0x5726('0x12')]);router[_0x5726('0x11')](_0x5726('0x13'),auth[_0x5726('0xb')](),controller['removeSound']);module[_0x5726('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b0184e3..f7359d1 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 _0x0c0c=['ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x55efb4,_0x439d5d){var _0x39042c=function(_0x4a1055){while(--_0x4a1055){_0x55efb4['push'](_0x55efb4['shift']());}};_0x39042c(++_0x439d5d);}(_0x0c0c,0x1a9));var _0xc0c0=function(_0x2283a6,_0x468369){_0x2283a6=_0x2283a6-0x0;var _0x1f87c7=_0x0c0c[_0x2283a6];return _0x1f87c7;};'use strict';var Sequelize=require(_0xc0c0('0x0'));module[_0xc0c0('0x1')]={'name':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':![],'unique':_0xc0c0('0x3')},'mode':{'type':Sequelize[_0xc0c0('0x4')]('custom',_0xc0c0('0x5'),_0xc0c0('0x6'),_0xc0c0('0x7'),_0xc0c0('0x8'),_0xc0c0('0x9')),'allowNull':!![],'defaultValue':_0xc0c0('0x5')},'directory':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![],'defaultValue':_0xc0c0('0xa')},'format':{'type':Sequelize[_0xc0c0('0x2')],'allowNull':!![]},'stamp':{'type':_0xc0c0('0xb')},'defaultEntry':{'type':Sequelize[_0xc0c0('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6bf8=['quietmp3','mp3','files','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb'];(function(_0x3995e9,_0x111598){var _0x583920=function(_0x3e355b){while(--_0x3e355b){_0x3995e9['push'](_0x3995e9['shift']());}};_0x583920(++_0x111598);}(_0x6bf8,0x1bf));var _0x86bf=function(_0x534621,_0x4b9879){_0x534621=_0x534621-0x0;var _0x3c6624=_0x6bf8[_0x534621];return _0x3c6624;};'use strict';var Sequelize=require(_0x86bf('0x0'));module[_0x86bf('0x1')]={'name':{'type':Sequelize[_0x86bf('0x2')],'allowNull':![],'unique':_0x86bf('0x3')},'mode':{'type':Sequelize[_0x86bf('0x4')](_0x86bf('0x5'),'files',_0x86bf('0x6'),_0x86bf('0x7'),_0x86bf('0x8'),_0x86bf('0x9')),'allowNull':!![],'defaultValue':_0x86bf('0xa')},'directory':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x86bf('0x2')],'allowNull':!![]},'stamp':{'type':_0x86bf('0xb')},'defaultEntry':{'type':Sequelize[_0x86bf('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 20ae370..ee11f0c 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 _0xf9fe=['sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','find','body','sequelize','transaction','mode','directory','join','root','server/files/moh','create','files','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','unlinkSync','getSounds','eml-format','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','then','get','MusicOnHolds','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4eacd0,_0x38ea7e){var _0x4ee53f=function(_0x55d256){while(--_0x55d256){_0x4eacd0['push'](_0x4eacd0['shift']());}};_0x4ee53f(++_0x38ea7e);}(_0xf9fe,0x16e));var _0xef9f=function(_0x5c9f8f,_0x254f0c){_0x5c9f8f=_0x5c9f8f-0x0;var _0x2c554d=_0xf9fe[_0x5c9f8f];return _0x2c554d;};'use strict';var emlformat=require(_0xef9f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef9f('0x1'));var moment=require('moment');var BPromise=require(_0xef9f('0x2'));var Mustache=require('mustache');var util=require(_0xef9f('0x3'));var path=require(_0xef9f('0x4'));var sox=require(_0xef9f('0x5'));var csv=require(_0xef9f('0x6'));var ejs=require(_0xef9f('0x7'));var fs=require('fs');var fs_extra=require(_0xef9f('0x8'));var _=require(_0xef9f('0x9'));var squel=require(_0xef9f('0xa'));var crypto=require(_0xef9f('0xb'));var jsforce=require(_0xef9f('0xc'));var deskjs=require(_0xef9f('0xd'));var toCsv=require(_0xef9f('0x6'));var querystring=require('querystring');var Papa=require(_0xef9f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef9f('0xf'));var as=require(_0xef9f('0x10'));var hardwareService=require(_0xef9f('0x11'));var logger=require('../../config/logger')(_0xef9f('0x12'));var utils=require('../../config/utils');var config=require(_0xef9f('0x13'));var licenseUtil=require(_0xef9f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ffcc2,_0x12edfa){_0x12edfa=_0x12edfa||0xcc;return function(_0x2f3c9f){if(_0x2f3c9f){return _0x2ffcc2[_0xef9f('0x15')](_0x12edfa);}return _0x2ffcc2[_0xef9f('0x16')](_0x12edfa)[_0xef9f('0x17')]();};}function respondWithResult(_0x33f0b4,_0x4ac81e){_0x4ac81e=_0x4ac81e||0xc8;return function(_0x3c3a1c){if(_0x3c3a1c){return _0x33f0b4[_0xef9f('0x16')](_0x4ac81e)[_0xef9f('0x18')](_0x3c3a1c);}};}function respondWithFilteredResult(_0x590542,_0x41a645){return function(_0x4e7a77){if(_0x4e7a77){var _0x10d9d2=typeof _0x41a645[_0xef9f('0x19')]===_0xef9f('0x1a')&&typeof _0x41a645['limit']===_0xef9f('0x1a');var _0x272db1=_0x4e7a77[_0xef9f('0x1b')];var _0x4bb917=_0x10d9d2?0x0:_0x41a645[_0xef9f('0x19')];var _0x5e6620=_0x10d9d2?_0x4e7a77[_0xef9f('0x1b')]:_0x41a645['offset']+_0x41a645[_0xef9f('0x1c')];var _0x4b24bb;if(_0x5e6620>=_0x272db1){_0x5e6620=_0x272db1;_0x4b24bb=0xc8;}else{_0x4b24bb=0xce;}_0x590542[_0xef9f('0x16')](_0x4b24bb);return _0x590542[_0xef9f('0x1d')](_0xef9f('0x1e'),_0x4bb917+'-'+_0x5e6620+'/'+_0x272db1)[_0xef9f('0x18')](_0x4e7a77);}return null;};}function patchUpdates(_0xaabe99){return function(_0x53d1ee){try{jsonpatch['apply'](_0x53d1ee,_0xaabe99,!![]);}catch(_0x4e361d){return BPromise[_0xef9f('0x1f')](_0x4e361d);}return _0x53d1ee['save']();};}function saveUpdates(_0x1199d5,_0x5b3669){return function(_0x45f889){if(_0x45f889){return _0x45f889[_0xef9f('0x20')](_0x1199d5)['then'](function(_0x820c86){return _0x820c86;});}return null;};}function removeEntity(_0x24c855,_0x3bba08){return function(_0x5c0f74){if(_0x5c0f74){return _0x5c0f74[_0xef9f('0x21')]()[_0xef9f('0x22')](function(){var _0x4ec459=_0x5c0f74[_0xef9f('0x23')]({'plain':!![]});var _0x42255d=_0xef9f('0x24');return db['UserProfileResource'][_0xef9f('0x21')]({'where':{'type':_0x42255d,'resourceId':_0x4ec459['id']}})[_0xef9f('0x22')](function(){return _0x5c0f74;});})[_0xef9f('0x22')](function(){_0x24c855['status'](0xcc)[_0xef9f('0x17')]();});}};}function handleEntityNotFound(_0x5cbab3,_0x565ddb){return function(_0x4e552d){if(!_0x4e552d){_0x5cbab3[_0xef9f('0x15')](0x194);}return _0x4e552d;};}function handleError(_0x446e49,_0x4ff815){_0x4ff815=_0x4ff815||0x1f4;return function(_0x46f8f4){logger[_0xef9f('0x25')](_0x46f8f4[_0xef9f('0x26')]);if(_0x46f8f4[_0xef9f('0x27')]){delete _0x46f8f4[_0xef9f('0x27')];}_0x446e49[_0xef9f('0x16')](_0x4ff815)[_0xef9f('0x28')](_0x46f8f4);};}exports[_0xef9f('0x29')]=function(_0x3af0dc,_0x3add1a){var _0x2ce3f2={},_0x5540b0={},_0x12faa3={'count':0x0,'rows':[]};var _0x171357=_['map'](db[_0xef9f('0x2a')][_0xef9f('0x2b')],function(_0x3935c8){return{'name':_0x3935c8[_0xef9f('0x2c')],'type':_0x3935c8['type'][_0xef9f('0x2d')]};});_0x5540b0[_0xef9f('0x2e')]=_[_0xef9f('0x2f')](_0x171357,'name');_0x5540b0[_0xef9f('0x30')]=_[_0xef9f('0x31')](_0x3af0dc[_0xef9f('0x30')]);_0x5540b0[_0xef9f('0x32')]=_[_0xef9f('0x33')](_0x5540b0[_0xef9f('0x2e')],_0x5540b0[_0xef9f('0x30')]);_0x2ce3f2[_0xef9f('0x34')]=_['intersection'](_0x5540b0[_0xef9f('0x2e')],qs[_0xef9f('0x35')](_0x3af0dc[_0xef9f('0x30')]['fields']));_0x2ce3f2['attributes']=_0x2ce3f2[_0xef9f('0x34')][_0xef9f('0x36')]?_0x2ce3f2['attributes']:_0x5540b0[_0xef9f('0x2e')];if(!_0x3af0dc[_0xef9f('0x30')][_0xef9f('0x37')](_0xef9f('0x38'))){_0x2ce3f2[_0xef9f('0x1c')]=qs['limit'](_0x3af0dc[_0xef9f('0x30')][_0xef9f('0x1c')]);_0x2ce3f2[_0xef9f('0x19')]=qs[_0xef9f('0x19')](_0x3af0dc[_0xef9f('0x30')]['offset']);}_0x2ce3f2[_0xef9f('0x39')]=qs['sort'](_0x3af0dc[_0xef9f('0x30')][_0xef9f('0x3a')]);delete _0x3af0dc[_0xef9f('0x30')][_0xef9f('0x3a')];_0x2ce3f2[_0xef9f('0x3b')]=qs[_0xef9f('0x32')](_[_0xef9f('0x3c')](_0x3af0dc['query'],_0x5540b0['filters']),_0x171357);if(_0x3af0dc['query'][_0xef9f('0x3d')]){_0x2ce3f2[_0xef9f('0x3b')]=_[_0xef9f('0x3e')](_0x2ce3f2['where'],{'$or':_[_0xef9f('0x2f')](_0x171357,function(_0x4cc090){if(_0x4cc090[_0xef9f('0x3f')]!=='VIRTUAL'){var _0x21b794={};_0x21b794[_0x4cc090[_0xef9f('0x27')]]={'$like':'%'+_0x3af0dc[_0xef9f('0x30')][_0xef9f('0x3d')]+'%'};return _0x21b794;}})});}_0x2ce3f2=_[_0xef9f('0x3e')]({},_0x2ce3f2,_0x3af0dc[_0xef9f('0x40')]);var _0x1fbdaa={'where':_0x2ce3f2['where']};return db['VoiceMusicOnHold']['count'](_0x1fbdaa)[_0xef9f('0x22')](function(_0x162f71){_0x12faa3[_0xef9f('0x1b')]=_0x162f71;if(_0x3af0dc[_0xef9f('0x30')][_0xef9f('0x41')]){_0x2ce3f2[_0xef9f('0x42')]=[{'all':!![]}];}return db[_0xef9f('0x2a')]['findAll'](_0x2ce3f2);})[_0xef9f('0x22')](function(_0x563f78){_0x12faa3[_0xef9f('0x43')]=_0x563f78;return _0x12faa3;})[_0xef9f('0x22')](respondWithFilteredResult(_0x3add1a,_0x2ce3f2))[_0xef9f('0x44')](handleError(_0x3add1a,null));};exports[_0xef9f('0x45')]=function(_0x49f35e,_0x46204d){var _0x51aa98={'raw':![],'where':{'id':_0x49f35e['params']['id']}},_0x47c2ef={};_0x47c2ef[_0xef9f('0x2e')]=_[_0xef9f('0x31')](db[_0xef9f('0x2a')][_0xef9f('0x2b')]);_0x47c2ef['query']=_[_0xef9f('0x31')](_0x49f35e['query']);_0x47c2ef[_0xef9f('0x32')]=_[_0xef9f('0x33')](_0x47c2ef[_0xef9f('0x2e')],_0x47c2ef['query']);_0x51aa98[_0xef9f('0x34')]=_[_0xef9f('0x33')](_0x47c2ef[_0xef9f('0x2e')],qs['fields'](_0x49f35e[_0xef9f('0x30')][_0xef9f('0x35')]));_0x51aa98['attributes']=_0x51aa98[_0xef9f('0x34')][_0xef9f('0x36')]?_0x51aa98[_0xef9f('0x34')]:_0x47c2ef['model'];if(_0x49f35e[_0xef9f('0x30')][_0xef9f('0x41')]){_0x51aa98[_0xef9f('0x42')]=[{'all':!![]}];}_0x51aa98=_[_0xef9f('0x3e')]({},_0x51aa98,_0x49f35e['options']);return db[_0xef9f('0x2a')][_0xef9f('0x46')](_0x51aa98)[_0xef9f('0x22')](handleEntityNotFound(_0x46204d,null))['then'](respondWithResult(_0x46204d,null))[_0xef9f('0x44')](handleError(_0x46204d,null));};exports[_0xef9f('0x20')]=function(_0x204699,_0x21374c){if(_0x204699[_0xef9f('0x47')]['id']){delete _0x204699[_0xef9f('0x47')]['id'];}return db[_0xef9f('0x2a')][_0xef9f('0x46')]({'where':{'id':_0x204699['params']['id']}})[_0xef9f('0x22')](handleEntityNotFound(_0x21374c,null))['then'](saveUpdates(_0x204699[_0xef9f('0x47')],null))['then'](respondWithResult(_0x21374c,null))[_0xef9f('0x44')](handleError(_0x21374c,null));};exports['create']=function(_0xef6a09,_0x5ea9a8,_0x55adcc){return db[_0xef9f('0x48')][_0xef9f('0x49')](function(_0x1188d7){if(_0xef6a09['body'][_0xef9f('0x4a')]==='files'){_0xef6a09[_0xef9f('0x47')][_0xef9f('0x4b')]=path[_0xef9f('0x4c')](config[_0xef9f('0x4d')],_0xef9f('0x4e'),_0xef6a09['body'][_0xef9f('0x27')]);}return db[_0xef9f('0x2a')][_0xef9f('0x4f')](_0xef6a09[_0xef9f('0x47')],{'transaction':_0x1188d7})[_0xef9f('0x22')](function(_0x3bb3bd){if(_0xef6a09['body']['mode']===_0xef9f('0x50')){fs['mkdirSync'](_0x3bb3bd['directory'],parseInt(_0xef9f('0x51'),0x8));}var _0x2f080a=_0xef6a09['user'][_0xef9f('0x23')]({'plain':!![]});if(!_0x2f080a)throw new Error(_0xef9f('0x52'));if(_0x2f080a[_0xef9f('0x53')]===_0xef9f('0x54')){var _0xec798=_0x3bb3bd[_0xef9f('0x23')]({'plain':!![]});return db[_0xef9f('0x55')]['find']({'where':{'name':_0xef9f('0x24'),'userProfileId':_0x2f080a[_0xef9f('0x56')]},'raw':!![]})[_0xef9f('0x22')](function(_0x1c21be){if(_0x1c21be&&_0x1c21be[_0xef9f('0x57')]===0x0){return db['UserProfileResource'][_0xef9f('0x4f')]({'name':_0xec798['name'],'resourceId':_0xec798['id'],'type':_0x1c21be[_0xef9f('0x27')],'sectionId':_0x1c21be['id']},{})[_0xef9f('0x22')](function(){return _0x3bb3bd;});}else{return _0x3bb3bd;}})[_0xef9f('0x44')](function(_0xed0c5c){logger[_0xef9f('0x25')](_0xef9f('0x58'),_0xed0c5c);});}return _0x3bb3bd;});})[_0xef9f('0x22')](respondWithResult(_0x5ea9a8,0xc9))[_0xef9f('0x44')](handleError(_0x5ea9a8,null));};exports[_0xef9f('0x21')]=function(_0x21ea37,_0x52f500,_0x581f8c){var _0x4a890c;return db[_0xef9f('0x2a')][_0xef9f('0x46')]({'where':{'id':_0x21ea37[_0xef9f('0x59')]['id']}})[_0xef9f('0x22')](function(_0x2be7b9){if(_0x2be7b9){return db[_0xef9f('0x48')]['transaction'](function(_0x5e3ffa){return _0x2be7b9[_0xef9f('0x21')]({'transaction':_0x5e3ffa,'raw':!![]})[_0xef9f('0x22')](function(_0x5828af){if(_0x5828af[_0xef9f('0x4b')]){fs['readdirSync'](_0x5828af[_0xef9f('0x4b')])['forEach'](function(_0x53ba2f){fs['unlinkSync'](path[_0xef9f('0x4c')](_0x5828af[_0xef9f('0x4b')],_0x53ba2f));});fs['rmdirSync'](_0x5828af[_0xef9f('0x4b')]);}return _0x5828af;});})['catch'](function(_0x4bc6d0){throw new db['Sequelize'][(_0xef9f('0x5a'))](_0x4bc6d0[_0xef9f('0x5b')]);});}})[_0xef9f('0x22')](handleEntityNotFound(_0x52f500,null))['then'](removeEntity(_0x52f500,null))[_0xef9f('0x44')](handleError(_0x52f500,null));};exports[_0xef9f('0x5c')]=function(_0x1a6064,_0x518d14,_0x57ad25){return db['sequelize'][_0xef9f('0x49')](function(_0x7e1ac9){var _0x1f5d8c;return db[_0xef9f('0x2a')][_0xef9f('0x46')]({'where':{'id':_0x1a6064['params']['id']}})[_0xef9f('0x22')](function(_0x238659){if(_0x238659){_0x1f5d8c=_0x238659;return _0x238659['addSound'](_0x1a6064[_0xef9f('0x47')]['id'],{'transaction':_0x7e1ac9});}})[_0xef9f('0x22')](function(_0x182957){if(_0x182957){return db[_0xef9f('0x5d')][_0xef9f('0x5e')]({'where':{'id':_0x1a6064['body']['id']},'attributes':['id',_0xef9f('0x27'),_0xef9f('0x5f'),_0xef9f('0x60'),'createdAt'],'raw':!![]});}})['then'](function(_0x207669){if(_0x207669){var _0x1a4bbc=path[_0xef9f('0x4c')](config[_0xef9f('0x4d')],_0xef9f('0x61'),util[_0xef9f('0x62')](_0xef9f('0x63'),path[_0xef9f('0x64')](_0x207669['save_name'],path['extname'](_0x207669[_0xef9f('0x5f')])),_0x207669[_0xef9f('0x60')]));var _0x3ce40d=path['join'](config[_0xef9f('0x4d')],'server/files/moh',_0x1f5d8c[_0xef9f('0x27')],util['format'](_0xef9f('0x63'),_0x207669[_0xef9f('0x27')],_0x207669[_0xef9f('0x60')]));fs[_0xef9f('0x65')](_0x1a4bbc,_0x3ce40d);return _0x207669;}})['catch'](function(_0x5b306e){throw new db['Sequelize'][(_0xef9f('0x5a'))](_0x5b306e[_0xef9f('0x5b')]);});})[_0xef9f('0x22')](handleEntityNotFound(_0x518d14,null))[_0xef9f('0x22')](respondWithResult(_0x518d14,0xc9))['catch'](handleError(_0x518d14,null));};exports[_0xef9f('0x66')]=function(_0x49d820,_0x2f28b4,_0x357f77){return db[_0xef9f('0x48')][_0xef9f('0x49')](function(_0x1a1754){var _0x31aecc;return db[_0xef9f('0x2a')]['findOne']({'where':{'id':_0x49d820[_0xef9f('0x59')]['id']}})[_0xef9f('0x22')](handleEntityNotFound(_0x2f28b4,null))[_0xef9f('0x22')](function(_0xe0aae1){if(_0xe0aae1){_0x31aecc=_0xe0aae1;return _0xe0aae1['removeSound'](_0x49d820['params']['id2']);}})[_0xef9f('0x22')](function(_0x5c2335){if(_0x5c2335){return db['Sound'][_0xef9f('0x5e')]({'where':{'id':_0x49d820[_0xef9f('0x59')][_0xef9f('0x67')]},'attributes':['id','name',_0xef9f('0x5f'),_0xef9f('0x60'),'createdAt'],'raw':!![]});}})[_0xef9f('0x22')](function(_0x1d6f75){if(_0x1d6f75){fs[_0xef9f('0x68')](path[_0xef9f('0x4c')](_0x31aecc[_0xef9f('0x4b')],util[_0xef9f('0x62')](_0xef9f('0x63'),_0x1d6f75['name'],_0x1d6f75['converted_format'])));return _0x1d6f75;}})[_0xef9f('0x44')](function(_0x33ec34){throw new db['Sequelize']['ValidationError'](_0x33ec34['message']);});})[_0xef9f('0x22')](handleEntityNotFound(_0x2f28b4,null))[_0xef9f('0x22')](respondWithStatusCode(_0x2f28b4,0xcc))[_0xef9f('0x44')](handleError(_0x2f28b4,null));};exports[_0xef9f('0x69')]=function(_0x28154f,_0xacfb2b,_0x53d832){var _0x111b5a={};var _0x3aa58d={};var _0x56a95f;var _0x11008e;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x28154f[_0xef9f('0x59')]['id']}})[_0xef9f('0x22')](handleEntityNotFound(_0xacfb2b,null))[_0xef9f('0x22')](function(_0x39a46b){if(_0x39a46b){_0x56a95f=_0x39a46b;_0x3aa58d[_0xef9f('0x2e')]=_['keys'](db[_0xef9f('0x5d')][_0xef9f('0x2b')]);_0x3aa58d[_0xef9f('0x30')]=_[_0xef9f('0x31')](_0x28154f['query']);_0x3aa58d[_0xef9f('0x32')]=_['intersection'](_0x3aa58d['model'],_0x3aa58d['query']);_0x111b5a[_0xef9f('0x34')]=_[_0xef9f('0x33')](_0x3aa58d['model'],qs[_0xef9f('0x35')](_0x28154f[_0xef9f('0x30')][_0xef9f('0x35')]));_0x111b5a[_0xef9f('0x34')]=_0x111b5a[_0xef9f('0x34')]['length']?_0x111b5a[_0xef9f('0x34')]:_0x3aa58d[_0xef9f('0x2e')];_0x111b5a[_0xef9f('0x39')]=qs[_0xef9f('0x3a')](_0x28154f[_0xef9f('0x30')][_0xef9f('0x3a')]);_0x111b5a[_0xef9f('0x3b')]=qs[_0xef9f('0x32')](_[_0xef9f('0x3c')](_0x28154f['query'],_0x3aa58d[_0xef9f('0x32')]));if(_0x28154f[_0xef9f('0x30')][_0xef9f('0x3d')]){_0x111b5a[_0xef9f('0x3b')]=_[_0xef9f('0x3e')](_0x111b5a[_0xef9f('0x3b')],{'$or':_[_0xef9f('0x2f')](_0x111b5a['attributes'],function(_0x47615c){var _0x2db3fc={};_0x2db3fc[_0x47615c]={'$like':'%'+_0x28154f[_0xef9f('0x30')][_0xef9f('0x3d')]+'%'};return _0x2db3fc;})});}_0x111b5a=_[_0xef9f('0x3e')]({},_0x111b5a,_0x28154f[_0xef9f('0x40')]);return _0x56a95f[_0xef9f('0x69')](_0x111b5a);}})['then'](function(_0x58c802){if(_0x58c802){_0x11008e=_0x58c802['length'];if(!_0x28154f[_0xef9f('0x30')][_0xef9f('0x37')]('nolimit')){_0x111b5a[_0xef9f('0x1c')]=qs[_0xef9f('0x1c')](_0x28154f[_0xef9f('0x30')][_0xef9f('0x1c')]);_0x111b5a[_0xef9f('0x19')]=qs[_0xef9f('0x19')](_0x28154f[_0xef9f('0x30')]['offset']);}return _0x56a95f[_0xef9f('0x69')](_0x111b5a);}})[_0xef9f('0x22')](function(_0x30c61c){if(_0x30c61c){return _0x30c61c?{'count':_0x11008e,'rows':_0x30c61c}:null;}})[_0xef9f('0x22')](respondWithResult(_0xacfb2b,null))['catch'](handleError(_0xacfb2b,null));}; \ No newline at end of file +var _0xea72=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','name','VoiceMusicOnHold','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','update','body','catch','create','transaction','mode','files','directory','join','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','createdAt','unlinkSync','getSounds','Sound','order','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse'];(function(_0x2e5a71,_0x10713a){var _0x353b4c=function(_0x29e075){while(--_0x29e075){_0x2e5a71['push'](_0x2e5a71['shift']());}};_0x353b4c(++_0x10713a);}(_0xea72,0x1a5));var _0x2ea7=function(_0x3ebf6c,_0x52e062){_0x3ebf6c=_0x3ebf6c-0x0;var _0x1dc737=_0xea72[_0x3ebf6c];return _0x1dc737;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ea7('0x0'));var jsonpatch=require(_0x2ea7('0x1'));var rp=require(_0x2ea7('0x2'));var moment=require(_0x2ea7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ea7('0x4'));var path=require('path');var sox=require(_0x2ea7('0x5'));var csv=require('to-csv');var ejs=require(_0x2ea7('0x6'));var fs=require('fs');var fs_extra=require(_0x2ea7('0x7'));var _=require(_0x2ea7('0x8'));var squel=require(_0x2ea7('0x9'));var crypto=require(_0x2ea7('0xa'));var jsforce=require(_0x2ea7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2ea7('0xc'));var querystring=require(_0x2ea7('0xd'));var Papa=require(_0x2ea7('0xe'));var Redis=require('ioredis');var authService=require(_0x2ea7('0xf'));var qs=require(_0x2ea7('0x10'));var as=require(_0x2ea7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ea7('0x12'))(_0x2ea7('0x13'));var utils=require(_0x2ea7('0x14'));var config=require(_0x2ea7('0x15'));var licenseUtil=require(_0x2ea7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51dcf9,_0x34cb8d){_0x34cb8d=_0x34cb8d||0xcc;return function(_0x2dcb16){if(_0x2dcb16){return _0x51dcf9['sendStatus'](_0x34cb8d);}return _0x51dcf9[_0x2ea7('0x17')](_0x34cb8d)[_0x2ea7('0x18')]();};}function respondWithResult(_0x17b45b,_0x3335c7){_0x3335c7=_0x3335c7||0xc8;return function(_0x5c6932){if(_0x5c6932){return _0x17b45b['status'](_0x3335c7)[_0x2ea7('0x19')](_0x5c6932);}};}function respondWithFilteredResult(_0x41accf,_0x4d9704){return function(_0x57144d){if(_0x57144d){var _0x9ad68=typeof _0x4d9704[_0x2ea7('0x1a')]===_0x2ea7('0x1b')&&typeof _0x4d9704[_0x2ea7('0x1c')]===_0x2ea7('0x1b');var _0x5d1d79=_0x57144d[_0x2ea7('0x1d')];var _0x394914=_0x9ad68?0x0:_0x4d9704['offset'];var _0x50b248=_0x9ad68?_0x57144d[_0x2ea7('0x1d')]:_0x4d9704[_0x2ea7('0x1a')]+_0x4d9704[_0x2ea7('0x1c')];var _0x2b4947;if(_0x50b248>=_0x5d1d79){_0x50b248=_0x5d1d79;_0x2b4947=0xc8;}else{_0x2b4947=0xce;}_0x41accf[_0x2ea7('0x17')](_0x2b4947);return _0x41accf[_0x2ea7('0x1e')]('Content-Range',_0x394914+'-'+_0x50b248+'/'+_0x5d1d79)[_0x2ea7('0x19')](_0x57144d);}return null;};}function patchUpdates(_0x468959){return function(_0x5ea0e){try{jsonpatch[_0x2ea7('0x1f')](_0x5ea0e,_0x468959,!![]);}catch(_0x150816){return BPromise[_0x2ea7('0x20')](_0x150816);}return _0x5ea0e[_0x2ea7('0x21')]();};}function saveUpdates(_0x29d854,_0x274608){return function(_0xffb02d){if(_0xffb02d){return _0xffb02d['update'](_0x29d854)[_0x2ea7('0x22')](function(_0x445866){return _0x445866;});}return null;};}function removeEntity(_0x213f8e,_0x892930){return function(_0x492120){if(_0x492120){return _0x492120[_0x2ea7('0x23')]()['then'](function(){var _0x2c5e01=_0x492120[_0x2ea7('0x24')]({'plain':!![]});var _0x7898b8=_0x2ea7('0x25');return db[_0x2ea7('0x26')]['destroy']({'where':{'type':_0x7898b8,'resourceId':_0x2c5e01['id']}})[_0x2ea7('0x22')](function(){return _0x492120;});})[_0x2ea7('0x22')](function(){_0x213f8e[_0x2ea7('0x17')](0xcc)[_0x2ea7('0x18')]();});}};}function handleEntityNotFound(_0x5312a9,_0x2768b0){return function(_0x141a47){if(!_0x141a47){_0x5312a9[_0x2ea7('0x27')](0x194);}return _0x141a47;};}function handleError(_0x476e85,_0x23eea5){_0x23eea5=_0x23eea5||0x1f4;return function(_0x12f044){logger[_0x2ea7('0x28')](_0x12f044['stack']);if(_0x12f044[_0x2ea7('0x29')]){delete _0x12f044['name'];}_0x476e85[_0x2ea7('0x17')](_0x23eea5)['send'](_0x12f044);};}exports['index']=function(_0x141773,_0x4ba8aa){var _0x24b0e2={},_0xf7308={},_0x3991e1={'count':0x0,'rows':[]};var _0x5105ae=_['map'](db[_0x2ea7('0x2a')]['rawAttributes'],function(_0x407c86){return{'name':_0x407c86['fieldName'],'type':_0x407c86['type'][_0x2ea7('0x2b')]};});_0xf7308[_0x2ea7('0x2c')]=_[_0x2ea7('0x2d')](_0x5105ae,_0x2ea7('0x29'));_0xf7308[_0x2ea7('0x2e')]=_[_0x2ea7('0x2f')](_0x141773['query']);_0xf7308[_0x2ea7('0x30')]=_[_0x2ea7('0x31')](_0xf7308[_0x2ea7('0x2c')],_0xf7308[_0x2ea7('0x2e')]);_0x24b0e2['attributes']=_[_0x2ea7('0x31')](_0xf7308[_0x2ea7('0x2c')],qs['fields'](_0x141773['query'][_0x2ea7('0x32')]));_0x24b0e2[_0x2ea7('0x33')]=_0x24b0e2[_0x2ea7('0x33')][_0x2ea7('0x34')]?_0x24b0e2[_0x2ea7('0x33')]:_0xf7308['model'];if(!_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x35')](_0x2ea7('0x36'))){_0x24b0e2['limit']=qs[_0x2ea7('0x1c')](_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x1c')]);_0x24b0e2[_0x2ea7('0x1a')]=qs[_0x2ea7('0x1a')](_0x141773[_0x2ea7('0x2e')]['offset']);}_0x24b0e2['order']=qs['sort'](_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x37')]);delete _0x141773['query'][_0x2ea7('0x37')];_0x24b0e2[_0x2ea7('0x38')]=qs[_0x2ea7('0x30')](_[_0x2ea7('0x39')](_0x141773[_0x2ea7('0x2e')],_0xf7308[_0x2ea7('0x30')]),_0x5105ae);if(_0x141773[_0x2ea7('0x2e')][_0x2ea7('0x3a')]){_0x24b0e2[_0x2ea7('0x38')]=_[_0x2ea7('0x3b')](_0x24b0e2['where'],{'$or':_[_0x2ea7('0x2d')](_0x5105ae,function(_0x2f3f9a){if(_0x2f3f9a[_0x2ea7('0x3c')]!=='VIRTUAL'){var _0x35f4f5={};_0x35f4f5[_0x2f3f9a[_0x2ea7('0x29')]]={'$like':'%'+_0x141773[_0x2ea7('0x2e')]['filter']+'%'};return _0x35f4f5;}})});}_0x24b0e2=_[_0x2ea7('0x3b')]({},_0x24b0e2,_0x141773['options']);var _0x10eae5={'where':_0x24b0e2[_0x2ea7('0x38')]};return db[_0x2ea7('0x2a')][_0x2ea7('0x1d')](_0x10eae5)['then'](function(_0x297090){_0x3991e1[_0x2ea7('0x1d')]=_0x297090;if(_0x141773['query'][_0x2ea7('0x3d')]){_0x24b0e2[_0x2ea7('0x3e')]=[{'all':!![]}];}return db[_0x2ea7('0x2a')][_0x2ea7('0x3f')](_0x24b0e2);})['then'](function(_0x1552f1){_0x3991e1[_0x2ea7('0x40')]=_0x1552f1;return _0x3991e1;})[_0x2ea7('0x22')](respondWithFilteredResult(_0x4ba8aa,_0x24b0e2))['catch'](handleError(_0x4ba8aa,null));};exports[_0x2ea7('0x41')]=function(_0x1551b3,_0x147f5a){var _0xa09ddc={'raw':![],'where':{'id':_0x1551b3[_0x2ea7('0x42')]['id']}},_0x1afdc4={};_0x1afdc4[_0x2ea7('0x2c')]=_['keys'](db[_0x2ea7('0x2a')][_0x2ea7('0x43')]);_0x1afdc4['query']=_[_0x2ea7('0x2f')](_0x1551b3[_0x2ea7('0x2e')]);_0x1afdc4['filters']=_[_0x2ea7('0x31')](_0x1afdc4[_0x2ea7('0x2c')],_0x1afdc4['query']);_0xa09ddc[_0x2ea7('0x33')]=_[_0x2ea7('0x31')](_0x1afdc4[_0x2ea7('0x2c')],qs[_0x2ea7('0x32')](_0x1551b3[_0x2ea7('0x2e')][_0x2ea7('0x32')]));_0xa09ddc[_0x2ea7('0x33')]=_0xa09ddc[_0x2ea7('0x33')][_0x2ea7('0x34')]?_0xa09ddc[_0x2ea7('0x33')]:_0x1afdc4[_0x2ea7('0x2c')];if(_0x1551b3[_0x2ea7('0x2e')][_0x2ea7('0x3d')]){_0xa09ddc[_0x2ea7('0x3e')]=[{'all':!![]}];}_0xa09ddc=_[_0x2ea7('0x3b')]({},_0xa09ddc,_0x1551b3[_0x2ea7('0x44')]);return db[_0x2ea7('0x2a')][_0x2ea7('0x45')](_0xa09ddc)['then'](handleEntityNotFound(_0x147f5a,null))[_0x2ea7('0x22')](respondWithResult(_0x147f5a,null))['catch'](handleError(_0x147f5a,null));};exports[_0x2ea7('0x46')]=function(_0x34cf41,_0x7f75a7){if(_0x34cf41[_0x2ea7('0x47')]['id']){delete _0x34cf41[_0x2ea7('0x47')]['id'];}return db[_0x2ea7('0x2a')][_0x2ea7('0x45')]({'where':{'id':_0x34cf41['params']['id']}})['then'](handleEntityNotFound(_0x7f75a7,null))[_0x2ea7('0x22')](saveUpdates(_0x34cf41[_0x2ea7('0x47')],null))[_0x2ea7('0x22')](respondWithResult(_0x7f75a7,null))[_0x2ea7('0x48')](handleError(_0x7f75a7,null));};exports[_0x2ea7('0x49')]=function(_0x2c7b64,_0x4f0bdd,_0x2e7bf7){return db['sequelize'][_0x2ea7('0x4a')](function(_0x516d22){if(_0x2c7b64[_0x2ea7('0x47')][_0x2ea7('0x4b')]===_0x2ea7('0x4c')){_0x2c7b64[_0x2ea7('0x47')][_0x2ea7('0x4d')]=path[_0x2ea7('0x4e')](config['root'],'server/files/moh',_0x2c7b64['body'][_0x2ea7('0x29')]);}return db[_0x2ea7('0x2a')][_0x2ea7('0x49')](_0x2c7b64['body'],{'transaction':_0x516d22})[_0x2ea7('0x22')](function(_0xa2c2ff){if(_0x2c7b64['body'][_0x2ea7('0x4b')]===_0x2ea7('0x4c')){fs['mkdirSync'](_0xa2c2ff[_0x2ea7('0x4d')],parseInt(_0x2ea7('0x4f'),0x8));}var _0x159edb=_0x2c7b64['user']['get']({'plain':!![]});if(!_0x159edb)throw new Error(_0x2ea7('0x50'));if(_0x159edb[_0x2ea7('0x51')]==='user'){var _0x358df6=_0xa2c2ff[_0x2ea7('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x2ea7('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x159edb[_0x2ea7('0x52')]},'raw':!![]})[_0x2ea7('0x22')](function(_0x567d45){if(_0x567d45&&_0x567d45[_0x2ea7('0x53')]===0x0){return db['UserProfileResource'][_0x2ea7('0x49')]({'name':_0x358df6[_0x2ea7('0x29')],'resourceId':_0x358df6['id'],'type':_0x567d45[_0x2ea7('0x29')],'sectionId':_0x567d45['id']},{})[_0x2ea7('0x22')](function(){return _0xa2c2ff;});}else{return _0xa2c2ff;}})['catch'](function(_0x2f3557){logger[_0x2ea7('0x28')](_0x2ea7('0x54'),_0x2f3557);});}return _0xa2c2ff;});})[_0x2ea7('0x22')](respondWithResult(_0x4f0bdd,0xc9))[_0x2ea7('0x48')](handleError(_0x4f0bdd,null));};exports[_0x2ea7('0x23')]=function(_0x875bea,_0x410b68,_0x50caca){var _0x23c216;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x875bea['params']['id']}})[_0x2ea7('0x22')](function(_0x3127c6){if(_0x3127c6){return db[_0x2ea7('0x55')]['transaction'](function(_0x529ee8){return _0x3127c6[_0x2ea7('0x23')]({'transaction':_0x529ee8,'raw':!![]})[_0x2ea7('0x22')](function(_0x55b84d){if(_0x55b84d[_0x2ea7('0x4d')]){fs[_0x2ea7('0x56')](_0x55b84d['directory'])[_0x2ea7('0x57')](function(_0x3ca9b9){fs['unlinkSync'](path[_0x2ea7('0x4e')](_0x55b84d[_0x2ea7('0x4d')],_0x3ca9b9));});fs['rmdirSync'](_0x55b84d[_0x2ea7('0x4d')]);}return _0x55b84d;});})['catch'](function(_0x5d1cf3){throw new db[(_0x2ea7('0x58'))][(_0x2ea7('0x59'))](_0x5d1cf3[_0x2ea7('0x5a')]);});}})['then'](handleEntityNotFound(_0x410b68,null))['then'](removeEntity(_0x410b68,null))[_0x2ea7('0x48')](handleError(_0x410b68,null));};exports[_0x2ea7('0x5b')]=function(_0x45f608,_0xecedf1,_0x4c848f){return db[_0x2ea7('0x55')][_0x2ea7('0x4a')](function(_0x2097f2){var _0x4d9a45;return db[_0x2ea7('0x2a')][_0x2ea7('0x45')]({'where':{'id':_0x45f608[_0x2ea7('0x42')]['id']}})['then'](function(_0x5da46c){if(_0x5da46c){_0x4d9a45=_0x5da46c;return _0x5da46c[_0x2ea7('0x5b')](_0x45f608[_0x2ea7('0x47')]['id'],{'transaction':_0x2097f2});}})[_0x2ea7('0x22')](function(_0x16530a){if(_0x16530a){return db['Sound'][_0x2ea7('0x5c')]({'where':{'id':_0x45f608[_0x2ea7('0x47')]['id']},'attributes':['id',_0x2ea7('0x29'),_0x2ea7('0x5d'),_0x2ea7('0x5e'),'createdAt'],'raw':!![]});}})[_0x2ea7('0x22')](function(_0x22475c){if(_0x22475c){var _0x9c3b49=path[_0x2ea7('0x4e')](config[_0x2ea7('0x5f')],_0x2ea7('0x60'),util[_0x2ea7('0x61')](_0x2ea7('0x62'),path[_0x2ea7('0x63')](_0x22475c[_0x2ea7('0x5d')],path[_0x2ea7('0x64')](_0x22475c[_0x2ea7('0x5d')])),_0x22475c[_0x2ea7('0x5e')]));var _0x5df60b=path[_0x2ea7('0x4e')](config[_0x2ea7('0x5f')],'server/files/moh',_0x4d9a45['name'],util[_0x2ea7('0x61')](_0x2ea7('0x62'),_0x22475c[_0x2ea7('0x29')],_0x22475c[_0x2ea7('0x5e')]));fs[_0x2ea7('0x65')](_0x9c3b49,_0x5df60b);return _0x22475c;}})['catch'](function(_0x2ed412){throw new db['Sequelize'][(_0x2ea7('0x59'))](_0x2ed412['message']);});})[_0x2ea7('0x22')](handleEntityNotFound(_0xecedf1,null))[_0x2ea7('0x22')](respondWithResult(_0xecedf1,0xc9))[_0x2ea7('0x48')](handleError(_0xecedf1,null));};exports['removeSound']=function(_0xfa533d,_0x4f747c,_0x3445ea){return db['sequelize'][_0x2ea7('0x4a')](function(_0x389009){var _0x29cfd2;return db[_0x2ea7('0x2a')][_0x2ea7('0x5c')]({'where':{'id':_0xfa533d[_0x2ea7('0x42')]['id']}})[_0x2ea7('0x22')](handleEntityNotFound(_0x4f747c,null))[_0x2ea7('0x22')](function(_0x475c39){if(_0x475c39){_0x29cfd2=_0x475c39;return _0x475c39[_0x2ea7('0x66')](_0xfa533d[_0x2ea7('0x42')]['id2']);}})[_0x2ea7('0x22')](function(_0x5a96da){if(_0x5a96da){return db['Sound'][_0x2ea7('0x5c')]({'where':{'id':_0xfa533d[_0x2ea7('0x42')][_0x2ea7('0x67')]},'attributes':['id',_0x2ea7('0x29'),_0x2ea7('0x5d'),_0x2ea7('0x5e'),_0x2ea7('0x68')],'raw':!![]});}})[_0x2ea7('0x22')](function(_0x36b824){if(_0x36b824){fs[_0x2ea7('0x69')](path[_0x2ea7('0x4e')](_0x29cfd2[_0x2ea7('0x4d')],util[_0x2ea7('0x61')](_0x2ea7('0x62'),_0x36b824[_0x2ea7('0x29')],_0x36b824[_0x2ea7('0x5e')])));return _0x36b824;}})[_0x2ea7('0x48')](function(_0x421e28){throw new db[(_0x2ea7('0x58'))][(_0x2ea7('0x59'))](_0x421e28[_0x2ea7('0x5a')]);});})[_0x2ea7('0x22')](handleEntityNotFound(_0x4f747c,null))[_0x2ea7('0x22')](respondWithStatusCode(_0x4f747c,0xcc))[_0x2ea7('0x48')](handleError(_0x4f747c,null));};exports[_0x2ea7('0x6a')]=function(_0x256012,_0x3ea577,_0x14890b){var _0x588f5d={};var _0x5acf17={};var _0x68cc4e;var _0x4abcac;return db[_0x2ea7('0x2a')][_0x2ea7('0x5c')]({'where':{'id':_0x256012[_0x2ea7('0x42')]['id']}})[_0x2ea7('0x22')](handleEntityNotFound(_0x3ea577,null))[_0x2ea7('0x22')](function(_0x123009){if(_0x123009){_0x68cc4e=_0x123009;_0x5acf17[_0x2ea7('0x2c')]=_['keys'](db[_0x2ea7('0x6b')]['rawAttributes']);_0x5acf17[_0x2ea7('0x2e')]=_[_0x2ea7('0x2f')](_0x256012[_0x2ea7('0x2e')]);_0x5acf17[_0x2ea7('0x30')]=_['intersection'](_0x5acf17[_0x2ea7('0x2c')],_0x5acf17[_0x2ea7('0x2e')]);_0x588f5d['attributes']=_[_0x2ea7('0x31')](_0x5acf17[_0x2ea7('0x2c')],qs[_0x2ea7('0x32')](_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x32')]));_0x588f5d[_0x2ea7('0x33')]=_0x588f5d[_0x2ea7('0x33')][_0x2ea7('0x34')]?_0x588f5d[_0x2ea7('0x33')]:_0x5acf17[_0x2ea7('0x2c')];_0x588f5d[_0x2ea7('0x6c')]=qs[_0x2ea7('0x37')](_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x37')]);_0x588f5d[_0x2ea7('0x38')]=qs[_0x2ea7('0x30')](_[_0x2ea7('0x39')](_0x256012['query'],_0x5acf17['filters']));if(_0x256012[_0x2ea7('0x2e')]['filter']){_0x588f5d[_0x2ea7('0x38')]=_[_0x2ea7('0x3b')](_0x588f5d[_0x2ea7('0x38')],{'$or':_[_0x2ea7('0x2d')](_0x588f5d[_0x2ea7('0x33')],function(_0x220540){var _0x10c4d1={};_0x10c4d1[_0x220540]={'$like':'%'+_0x256012['query'][_0x2ea7('0x3a')]+'%'};return _0x10c4d1;})});}_0x588f5d=_['merge']({},_0x588f5d,_0x256012[_0x2ea7('0x44')]);return _0x68cc4e[_0x2ea7('0x6a')](_0x588f5d);}})[_0x2ea7('0x22')](function(_0x49a14c){if(_0x49a14c){_0x4abcac=_0x49a14c[_0x2ea7('0x34')];if(!_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x35')](_0x2ea7('0x36'))){_0x588f5d[_0x2ea7('0x1c')]=qs[_0x2ea7('0x1c')](_0x256012['query']['limit']);_0x588f5d[_0x2ea7('0x1a')]=qs[_0x2ea7('0x1a')](_0x256012[_0x2ea7('0x2e')][_0x2ea7('0x1a')]);}return _0x68cc4e[_0x2ea7('0x6a')](_0x588f5d);}})[_0x2ea7('0x22')](function(_0x1a39e7){if(_0x1a39e7){return _0x1a39e7?{'count':_0x4abcac,'rows':_0x1a39e7}:null;}})[_0x2ea7('0x22')](respondWithResult(_0x3ea577,null))['catch'](handleError(_0x3ea577,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f697966..d2e5f3b 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 _0xa135=['request-promise','rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','../../config/logger','api','moment'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xa135,0x7d));var _0x5a13=function(_0x23a9cc,_0x49aaf7){_0x23a9cc=_0x23a9cc-0x0;var _0x34f9d1=_0xa135[_0x23a9cc];return _0x34f9d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a13('0x0'))(_0x5a13('0x1'));var moment=require(_0x5a13('0x2'));var BPromise=require('bluebird');var rp=require(_0x5a13('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a13('0x4'));var config=require('../../config/environment');var attributes=require(_0x5a13('0x5'));module[_0x5a13('0x6')]=function(_0x95ff05,_0x4913e0){return _0x95ff05['define'](_0x5a13('0x7'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7d1=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util'];(function(_0x21ad96,_0x351509){var _0xa41e65=function(_0x17be59){while(--_0x17be59){_0x21ad96['push'](_0x21ad96['shift']());}};_0xa41e65(++_0x351509);}(_0xc7d1,0x1b6));var _0x1c7d=function(_0x23c825,_0x400749){_0x23c825=_0x23c825-0x0;var _0x51a6d7=_0xc7d1[_0x23c825];return _0x51a6d7;};'use strict';var _=require(_0x1c7d('0x0'));var util=require(_0x1c7d('0x1'));var logger=require(_0x1c7d('0x2'))(_0x1c7d('0x3'));var moment=require(_0x1c7d('0x4'));var BPromise=require(_0x1c7d('0x5'));var rp=require(_0x1c7d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c7d('0x7'));var attributes=require(_0x1c7d('0x8'));module['exports']=function(_0x8f3f74,_0xe9cc11){return _0x8f3f74[_0x1c7d('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x1c7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 9f5d20f..7a399b1 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(_0x1982dd,_0x1a257c){var _0x4c5157=function(_0x2de203){while(--_0x2de203){_0x1982dd['push'](_0x1982dd['shift']());}};_0x4c5157(++_0x1a257c);}(_0x34e8,0x12c));var _0x834e=function(_0x2926a4,_0x54be09){_0x2926a4=_0x2926a4-0x0;var _0x5457d2=_0x34e8[_0x2926a4];return _0x5457d2;};'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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d88da,_0x50d5d6){var _0x234c06=function(_0x1f1181){while(--_0x1f1181){_0x5d88da['push'](_0x5d88da['shift']());}};_0x234c06(++_0x50d5d6);}(_0xe706,0xa3));var _0x6e70=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xe706[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e86edfc..4cde511 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 _0xdffe=['removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy','removeAgents'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0xdffe,0x1d2));var _0xedff=function(_0x2e397f,_0x41b105){_0x2e397f=_0x2e397f-0x0;var _0x24ef43=_0xdffe[_0x2e397f];return _0x24ef43;};'use strict';var multer=require('multer');var util=require(_0xedff('0x0'));var path=require('path');var timeout=require(_0xedff('0x1'));var express=require(_0xedff('0x2'));var router=express[_0xedff('0x3')]();var fs_extra=require(_0xedff('0x4'));var auth=require(_0xedff('0x5'));var interaction=require(_0xedff('0x6'));var config=require('../../config/environment');var controller=require(_0xedff('0x7'));router[_0xedff('0x8')]('/',auth[_0xedff('0x9')](),controller[_0xedff('0xa')]);router['get'](_0xedff('0xb'),auth[_0xedff('0x9')](),controller[_0xedff('0xc')]);router[_0xedff('0x8')](_0xedff('0xd'),auth[_0xedff('0x9')](),controller[_0xedff('0xe')]);router[_0xedff('0x8')](_0xedff('0xf'),auth[_0xedff('0x9')](),controller[_0xedff('0x10')]);router[_0xedff('0x8')](_0xedff('0x11'),auth[_0xedff('0x9')](),controller[_0xedff('0x12')]);router[_0xedff('0x13')]('/',auth[_0xedff('0x9')](),controller[_0xedff('0x14')]);router[_0xedff('0x13')]('/:id/users',auth[_0xedff('0x9')](),controller['addAgents']);router['post'](_0xedff('0x11'),auth['isAuthenticated'](),controller[_0xedff('0x15')]);router[_0xedff('0x16')]('/:id',auth[_0xedff('0x9')](),controller[_0xedff('0x17')]);router[_0xedff('0x18')](_0xedff('0xd'),auth[_0xedff('0x9')](),controller[_0xedff('0x19')]);router[_0xedff('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xedff('0x1a')]);router[_0xedff('0x18')]('/:id/teams',auth[_0xedff('0x9')](),controller[_0xedff('0x1b')]);module[_0xedff('0x1c')]=router; \ No newline at end of file +var _0xfb92=['/:id','update','destroy','removeAgents','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','post','create','addAgents','/:id/teams','addTeams','put'];(function(_0x4cb23e,_0x588d15){var _0x54184a=function(_0x5bd568){while(--_0x5bd568){_0x4cb23e['push'](_0x4cb23e['shift']());}};_0x54184a(++_0x588d15);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x5e854c,_0x59f76a){_0x5e854c=_0x5e854c-0x0;var _0x54c6b8=_0xfb92[_0x5e854c];return _0x54c6b8;};'use strict';var multer=require(_0x2fb9('0x0'));var util=require('util');var path=require(_0x2fb9('0x1'));var timeout=require(_0x2fb9('0x2'));var express=require(_0x2fb9('0x3'));var router=express[_0x2fb9('0x4')]();var fs_extra=require(_0x2fb9('0x5'));var auth=require(_0x2fb9('0x6'));var interaction=require(_0x2fb9('0x7'));var config=require(_0x2fb9('0x8'));var controller=require(_0x2fb9('0x9'));router[_0x2fb9('0xa')]('/',auth[_0x2fb9('0xb')](),controller['index']);router['get']('/describe',auth[_0x2fb9('0xb')](),controller[_0x2fb9('0xc')]);router[_0x2fb9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2fb9('0xd')]);router[_0x2fb9('0xa')](_0x2fb9('0xe'),auth[_0x2fb9('0xb')](),controller['getAgents']);router[_0x2fb9('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x2fb9('0xf')]('/',auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x10')]);router[_0x2fb9('0xf')](_0x2fb9('0xe'),auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x11')]);router[_0x2fb9('0xf')](_0x2fb9('0x12'),auth['isAuthenticated'](),controller[_0x2fb9('0x13')]);router[_0x2fb9('0x14')](_0x2fb9('0x15'),auth['isAuthenticated'](),controller[_0x2fb9('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2fb9('0x17')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x2fb9('0x18')]);router[_0x2fb9('0x19')](_0x2fb9('0x12'),auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x1a')]);module[_0x2fb9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 03169eb..ce4d1d3 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 _0x8161=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x8161,0x9b));var _0x1816=function(_0xaa344c,_0x5032e2){_0xaa344c=_0xaa344c-0x0;var _0x8a22c3=_0x8161[_0xaa344c];return _0x8a22c3;};'use strict';var Sequelize=require(_0x1816('0x0'));module[_0x1816('0x1')]={'name':{'type':Sequelize[_0x1816('0x2')],'allowNull':![],'unique':_0x1816('0x3')},'prefix':{'type':Sequelize[_0x1816('0x4')],'get':function(_0xd52ede){return _0x1816('0x5')+this['getDataValue'](_0x1816('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x1816('0x6')]}}; \ No newline at end of file +var _0x4b75=['STRING','INTEGER','sequelize','name','VIRTUAL','system-','getDataValue'];(function(_0x1315df,_0xff128c){var _0x4ecda5=function(_0x33adc1){while(--_0x33adc1){_0x1315df['push'](_0x1315df['shift']());}};_0x4ecda5(++_0xff128c);}(_0x4b75,0xa3));var _0x54b7=function(_0x3a911f,_0x324db1){_0x3a911f=_0x3a911f-0x0;var _0x279f5d=_0x4b75[_0x3a911f];return _0x279f5d;};'use strict';var Sequelize=require(_0x54b7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54b7('0x1')},'prefix':{'type':Sequelize[_0x54b7('0x2')],'get':function(_0x1d337f){return _0x54b7('0x3')+this[_0x54b7('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x54b7('0x5')]},'callerIdAll':{'type':Sequelize[_0x54b7('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x54b7('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7cca93a..5e56c33 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 _0x3266=['index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','emit','userVoicePrefix:save','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','getTeams','Team','interface','Agents','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0x3266,0x6a));var _0x6326=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x3266[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];config[_0x6326('0x1c')]=_['defaults'](config['redis'],{'host':_0x6326('0x1d'),'port':0x18eb});var socket=require(_0x6326('0x1e'))(new Redis(config['redis']));require(_0x6326('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2d9b,_0x20dcc6){_0x20dcc6=_0x20dcc6||0xcc;return function(_0x3d6ac0){if(_0x3d6ac0){return _0x2d2d9b[_0x6326('0x20')](_0x20dcc6);}return _0x2d2d9b[_0x6326('0x21')](_0x20dcc6)[_0x6326('0x22')]();};}function respondWithResult(_0x55923a,_0x1104c5){_0x1104c5=_0x1104c5||0xc8;return function(_0x518e6f){if(_0x518e6f){return _0x55923a['status'](_0x1104c5)['json'](_0x518e6f);}};}function respondWithFilteredResult(_0x51e7b9,_0x5d402d){return function(_0x58e960){if(_0x58e960){var _0xdf5ced=typeof _0x5d402d[_0x6326('0x23')]===_0x6326('0x24')&&typeof _0x5d402d['limit']==='undefined';var _0x954ed5=_0x58e960[_0x6326('0x25')];var _0x272b5c=_0xdf5ced?0x0:_0x5d402d[_0x6326('0x23')];var _0x3c08db=_0xdf5ced?_0x58e960[_0x6326('0x25')]:_0x5d402d[_0x6326('0x23')]+_0x5d402d['limit'];var _0x22307f;if(_0x3c08db>=_0x954ed5){_0x3c08db=_0x954ed5;_0x22307f=0xc8;}else{_0x22307f=0xce;}_0x51e7b9['status'](_0x22307f);return _0x51e7b9[_0x6326('0x26')](_0x6326('0x27'),_0x272b5c+'-'+_0x3c08db+'/'+_0x954ed5)[_0x6326('0x28')](_0x58e960);}return null;};}function patchUpdates(_0x24fb78){return function(_0x43cdfc){try{jsonpatch[_0x6326('0x29')](_0x43cdfc,_0x24fb78,!![]);}catch(_0x225555){return BPromise[_0x6326('0x2a')](_0x225555);}return _0x43cdfc[_0x6326('0x2b')]();};}function saveUpdates(_0x2d0d00,_0x34954b){return function(_0x4933e1){if(_0x4933e1){return _0x4933e1[_0x6326('0x2c')](_0x2d0d00)[_0x6326('0x2d')](function(_0x575701){return _0x575701;});}return null;};}function removeEntity(_0x4e272b,_0x4d28fd){return function(_0x405474){if(_0x405474){return _0x405474['destroy']()[_0x6326('0x2d')](function(){var _0x1a48da=_0x405474['get']({'plain':!![]});var _0x15e33d=_0x6326('0x2e');return db[_0x6326('0x2f')][_0x6326('0x30')]({'where':{'type':_0x15e33d,'resourceId':_0x1a48da['id']}})[_0x6326('0x2d')](function(){return _0x405474;});})[_0x6326('0x2d')](function(){_0x4e272b[_0x6326('0x21')](0xcc)[_0x6326('0x22')]();});}};}function handleEntityNotFound(_0x461e0f,_0x127744){return function(_0x4980f6){if(!_0x4980f6){_0x461e0f[_0x6326('0x20')](0x194);}return _0x4980f6;};}function handleError(_0x331772,_0x134524){_0x134524=_0x134524||0x1f4;return function(_0x2e0445){logger[_0x6326('0x31')](_0x2e0445['stack']);if(_0x2e0445[_0x6326('0x32')]){delete _0x2e0445[_0x6326('0x32')];}_0x331772[_0x6326('0x21')](_0x134524)['send'](_0x2e0445);};}exports[_0x6326('0x33')]=function(_0x4d7807,_0x4e703a){var _0xfb6b62={},_0x7ac8d9={},_0x160a12={'count':0x0,'rows':[]};var _0x103b1c=_[_0x6326('0x34')](db[_0x6326('0x35')][_0x6326('0x36')],function(_0x46c803){return{'name':_0x46c803[_0x6326('0x37')],'type':_0x46c803[_0x6326('0x38')][_0x6326('0x39')]};});_0x7ac8d9[_0x6326('0x3a')]=_['map'](_0x103b1c,_0x6326('0x32'));_0x7ac8d9[_0x6326('0x3b')]=_['keys'](_0x4d7807[_0x6326('0x3b')]);_0x7ac8d9[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x7ac8d9['model'],_0x7ac8d9[_0x6326('0x3b')]);_0xfb6b62['attributes']=_['intersection'](_0x7ac8d9[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x4d7807[_0x6326('0x3b')]['fields']));_0xfb6b62[_0x6326('0x3f')]=_0xfb6b62['attributes'][_0x6326('0x40')]?_0xfb6b62['attributes']:_0x7ac8d9[_0x6326('0x3a')];if(!_0x4d7807[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0xfb6b62[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x4d7807['query'][_0x6326('0x43')]);_0xfb6b62[_0x6326('0x23')]=qs['offset'](_0x4d7807[_0x6326('0x3b')]['offset']);}_0xfb6b62['order']=qs[_0x6326('0x44')](_0x4d7807[_0x6326('0x3b')][_0x6326('0x44')]);_0xfb6b62[_0x6326('0x45')]=qs[_0x6326('0x3c')](_[_0x6326('0x46')](_0x4d7807['query'],_0x7ac8d9['filters']),_0x103b1c);if(_0x4d7807[_0x6326('0x3b')]['filter']){_0xfb6b62[_0x6326('0x45')]=_['merge'](_0xfb6b62[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x103b1c,function(_0x335feb){if(_0x335feb[_0x6326('0x38')]!==_0x6326('0x47')){var _0x1b754d={};_0x1b754d[_0x335feb[_0x6326('0x32')]]={'$like':'%'+_0x4d7807[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x1b754d;}})});}_0xfb6b62=_[_0x6326('0x49')]({},_0xfb6b62,_0x4d7807[_0x6326('0x4a')]);var _0x5d36b1={'where':_0xfb6b62[_0x6326('0x45')]};return db['VoicePrefix'][_0x6326('0x25')](_0x5d36b1)[_0x6326('0x2d')](function(_0x16fc33){_0x160a12[_0x6326('0x25')]=_0x16fc33;if(_0x4d7807['query'][_0x6326('0x4b')]){_0xfb6b62[_0x6326('0x4c')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6326('0x4d')](_0xfb6b62);})[_0x6326('0x2d')](function(_0x7a5057){_0x160a12[_0x6326('0x4e')]=_0x7a5057;return _0x160a12;})['then'](respondWithFilteredResult(_0x4e703a,_0xfb6b62))[_0x6326('0x4f')](handleError(_0x4e703a,null));};exports[_0x6326('0x50')]=function(_0x231e15,_0x28504f){var _0x44d852={'raw':![],'where':{'id':_0x231e15[_0x6326('0x51')]['id']}},_0x165953={};_0x165953['model']=_[_0x6326('0x52')](db[_0x6326('0x35')][_0x6326('0x36')]);_0x165953[_0x6326('0x3b')]=_['keys'](_0x231e15[_0x6326('0x3b')]);_0x165953['filters']=_[_0x6326('0x3d')](_0x165953[_0x6326('0x3a')],_0x165953[_0x6326('0x3b')]);_0x44d852[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x165953['model'],qs[_0x6326('0x3e')](_0x231e15['query']['fields']));_0x44d852[_0x6326('0x3f')]=_0x44d852[_0x6326('0x3f')]['length']?_0x44d852[_0x6326('0x3f')]:_0x165953[_0x6326('0x3a')];if(_0x231e15[_0x6326('0x3b')][_0x6326('0x4b')]){_0x44d852[_0x6326('0x4c')]=[{'all':!![]}];}_0x44d852=_['merge']({},_0x44d852,_0x231e15['options']);return db[_0x6326('0x35')][_0x6326('0x53')](_0x44d852)[_0x6326('0x2d')](handleEntityNotFound(_0x28504f,null))[_0x6326('0x2d')](respondWithResult(_0x28504f,null))[_0x6326('0x4f')](handleError(_0x28504f,null));};exports[_0x6326('0x30')]=function(_0xdc4522,_0x55bcd6){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0xdc4522[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x55bcd6,null))[_0x6326('0x2d')](removeEntity(_0x55bcd6,null))['catch'](handleError(_0x55bcd6,null));};exports[_0x6326('0x54')]=function(_0x55537a,_0x216972){return db[_0x6326('0x35')]['describe']()[_0x6326('0x2d')](respondWithResult(_0x216972,null))['catch'](handleError(_0x216972,null));};exports[_0x6326('0x55')]=function(_0x202fd3,_0x2ee8df){var _0x35400e;return db['sequelize'][_0x6326('0x56')](function(_0xbe6b3e){return db['VoicePrefix'][_0x6326('0x55')](_0x202fd3[_0x6326('0x57')],{'transaction':_0xbe6b3e})[_0x6326('0x2d')](function(_0x4a42ae){_0x35400e=_0x4a42ae[_0x6326('0x58')]({'plain':!![]});return db[_0x6326('0x59')]['find']({'where':{'id':_0x35400e[_0x6326('0x5a')]},'raw':!![]})['then'](function(_0x1f1463){return createVoicePrefixExtensions(_0x35400e,_0x1f1463,_0xbe6b3e);});});})[_0x6326('0x2d')](function(){var _0x3e9825=_0x202fd3[_0x6326('0x5b')][_0x6326('0x58')]({'plain':!![]});if(!_0x3e9825)throw new Error(_0x6326('0x5c'));if(_0x3e9825[_0x6326('0x5d')]==='user'){var _0x51adce=_0x35400e;return db['UserProfileSection'][_0x6326('0x53')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9825[_0x6326('0x5e')]},'raw':!![]})[_0x6326('0x2d')](function(_0xcae454){if(_0xcae454&&_0xcae454[_0x6326('0x5f')]===0x0){return db[_0x6326('0x2f')]['create']({'name':_0x51adce[_0x6326('0x32')],'resourceId':_0x51adce['id'],'type':_0xcae454[_0x6326('0x32')],'sectionId':_0xcae454['id']},{})['then'](function(){return _0x35400e;});}else{return _0x35400e;}})[_0x6326('0x4f')](function(_0xdeba28){logger[_0x6326('0x31')](_0x6326('0x60'),_0xdeba28);throw _0xdeba28;});}return _0x35400e;})[_0x6326('0x2d')](respondWithResult(_0x2ee8df,null))[_0x6326('0x4f')](handleError(_0x2ee8df,null));};function Extension(_0x320d43,_0x2f624f,_0x2c7a8d,_0x37506f){this['context']=_0x6326('0x61');this[_0x6326('0x62')]=_0x320d43;this[_0x6326('0x63')]=_0x2c7a8d;this[_0x6326('0x38')]='system';this['description']=_0x6326('0x64');this[_0x6326('0x65')]=_0x2f624f;this[_0x6326('0x66')]=_0x37506f;}function createVoicePrefixExtensions(_0x10f54b,_0x3ac39d,_0x54a9eb){return new BPromise(function(_0x4cec50,_0x13fc10){var _0x447b34=new Extension(formatPrefixName(_0x10f54b[_0x6326('0x67')]),0x1,_0x6326('0x68'),'Voice\x20Prefix');_0x447b34[_0x6326('0x69')]=_0x10f54b['id'];return db[_0x6326('0x59')][_0x6326('0x55')](_0x447b34,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x4197d6){var _0xc8f404=_0x4197d6['get']({'plain':!![]});var _0x2bc08a=_['map'](addVoicePrefixExtensions(_0x10f54b,_0x3ac39d),function(_0x4877c8){_0x4877c8[_0x6326('0x5a')]=_0xc8f404['id'];_0x4877c8['VoicePrefixId']=_0x10f54b['id'];return _0x4877c8;});return db[_0x6326('0x59')][_0x6326('0x6a')](_0x2bc08a,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x3b6de7){if(!_0x3b6de7){return _0x13fc10(_0x6326('0x6b'));}else{return _0x4cec50(_0x3b6de7);}})[_0x6326('0x4f')](function(_0x1e8d86){return _0x13fc10(_0x1e8d86);});});;});};function addVoicePrefixExtensions(_0x75e3a7,_0xa2928e){var _0x3f5e2e=[];var _0x53ff60=formatPrefixName(_0x75e3a7[_0x6326('0x67')]);_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x2,_0x6326('0x6d'),_0x6326('0x6e')+_0x75e3a7[_0x6326('0x32')]));if(_0x75e3a7['callerIdAll']){_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,_0x6326('0x6d'),_0x6326('0x6f')+_0x75e3a7[_0x6326('0x70')]));}else{_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,'NoOp',_0x6326('0x71')));}_0x3f5e2e['push'](new Extension(_0x53ff60,0x4,'goto',_0xa2928e[_0x6326('0x72')]+','+_0x6326('0x73')+(0x8+_0x75e3a7[_0x6326('0x32')][_0x6326('0x40')])+'}'+','+0x1));return _0x3f5e2e;}function formatPrefixName(_0x4fd921){var _0x4fbede='_';for(var _0x5cadb2=0x0;_0x5cadb2<_0x4fd921['length'];_0x5cadb2++){if(_0x4fd921[_0x6326('0x74')](_0x5cadb2)=='-'){_0x4fbede+=_0x4fd921['charAt'](_0x5cadb2);}else{_0x4fbede+='['+_0x4fd921[_0x6326('0x74')](_0x5cadb2)+']';}}_0x4fbede+='.';return _0x4fbede;}exports[_0x6326('0x2c')]=function(_0x54730e,_0x4c1d7e,_0x5401cf){var _0x5e86bc=_0x54730e['body'];_0x5e86bc[_0x6326('0x67')]='system-'+_0x5e86bc['name']+'-';return db['sequelize']['transaction'](function(_0x19916e){return db['VoicePrefix'][_0x6326('0x2c')](_0x5e86bc,{'where':{'id':_0x5e86bc['id']},'transaction':_0x19916e})[_0x6326('0x2d')](function(){return db['VoiceExtension'][_0x6326('0x30')]({'where':{'VoicePrefixId':_0x5e86bc['id']},'transaction':_0x19916e})['then'](function(){return db[_0x6326('0x59')][_0x6326('0x53')]({'where':{'id':_0x5e86bc[_0x6326('0x5a')]},'raw':!![]})[_0x6326('0x2d')](function(_0x339838){return createVoicePrefixExtensions(_0x5e86bc,_0x339838,_0x19916e);});});});})[_0x6326('0x2d')](function(){return db[_0x6326('0x35')][_0x6326('0x75')](_0x5e86bc['id']);})[_0x6326('0x2d')](respondWithResult(_0x4c1d7e,null))[_0x6326('0x4f')](handleError(_0x4c1d7e,null));};exports[_0x6326('0x76')]=function(_0x19cc2b,_0x3bc5f3,_0x27a505){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0x19cc2b[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x3bc5f3,null))['then'](function(_0x543792){if(_0x543792){return _0x543792['addAgents'](_0x19cc2b[_0x6326('0x57')]['ids'],_['omit'](_0x19cc2b['body'],['ids','id'])||{})['spread'](function(_0x5a1a9f){for(var _0xe845d6=0x0;_0xe845d6<_0x19cc2b[_0x6326('0x57')]['ids'][_0x6326('0x40')];_0xe845d6+=0x1){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':Number(_0x19cc2b['body'][_0x6326('0x79')][_0xe845d6]),'VoicePrefixId':Number(_0x19cc2b[_0x6326('0x51')]['id'])});}return _0x5a1a9f;});}})[_0x6326('0x2d')](respondWithResult(_0x3bc5f3,null))[_0x6326('0x4f')](handleError(_0x3bc5f3,null));};exports[_0x6326('0x7a')]=function(_0x483813,_0x3bff09,_0x4aec22){return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x483813['params']['id']}})['then'](handleEntityNotFound(_0x3bff09,null))['then'](function(_0x491f2e){if(_0x491f2e){return _0x491f2e['removeAgents'](_0x483813['query']['ids'])[_0x6326('0x2d')](function(){if(_[_0x6326('0x7b')](_0x483813[_0x6326('0x3b')][_0x6326('0x79')])){for(var _0x590e06=0x0;_0x590e06<_0x483813['query']['ids'][_0x6326('0x40')];_0x590e06+=0x1){socket[_0x6326('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x483813[_0x6326('0x3b')]['ids'][_0x590e06]),'VoicePrefixId':Number(_0x483813['params']['id'])});}}else{socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':Number(_0x483813[_0x6326('0x3b')][_0x6326('0x79')]),'VoicePrefixId':Number(_0x483813[_0x6326('0x51')]['id'])});}});}})[_0x6326('0x2d')](respondWithStatusCode(_0x3bff09,null))[_0x6326('0x4f')](handleError(_0x3bff09,null));};exports['getAgents']=function(_0x5afd24,_0x4c8bde,_0x1ec0ef){var _0x5223f4={};var _0x48631a={};var _0xaea64f;var _0x429c41;return db['VoicePrefix'][_0x6326('0x7d')]({'where':{'id':_0x5afd24['params']['id']}})['then'](handleEntityNotFound(_0x4c8bde,null))[_0x6326('0x2d')](function(_0xbca686){if(_0xbca686){_0xaea64f=_0xbca686;_0x48631a['model']=_['keys'](db[_0x6326('0x7e')][_0x6326('0x36')]);_0x48631a[_0x6326('0x3b')]=_[_0x6326('0x52')](_0x5afd24['query']);_0x48631a['filters']=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],_0x48631a[_0x6326('0x3b')]);_0x5223f4[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x5afd24[_0x6326('0x3b')]['fields']));_0x5223f4[_0x6326('0x3f')]=_0x5223f4['attributes'][_0x6326('0x40')]?_0x5223f4[_0x6326('0x3f')]:_0x48631a[_0x6326('0x3a')];_0x5223f4[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x5afd24[_0x6326('0x3b')]['sort']);_0x5223f4[_0x6326('0x45')]=qs[_0x6326('0x3c')](_['pick'](_0x5afd24[_0x6326('0x3b')],_0x48631a[_0x6326('0x3c')]));if(_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]){_0x5223f4[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5223f4[_0x6326('0x45')],{'$or':_['map'](_0x5223f4[_0x6326('0x3f')],function(_0x21ccbf){var _0x458a7e={};_0x458a7e[_0x21ccbf]={'$like':'%'+_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x458a7e;})});}_0x5223f4=_['merge']({},_0x5223f4,_0x5afd24[_0x6326('0x4a')]);return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})['then'](function(_0x411fe5){if(_0x411fe5){_0x429c41=_0x411fe5[_0x6326('0x40')];if(!_0x5afd24[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5223f4[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x5afd24[_0x6326('0x3b')]['limit']);_0x5223f4[_0x6326('0x23')]=qs[_0x6326('0x23')](_0x5afd24[_0x6326('0x3b')][_0x6326('0x23')]);}return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})[_0x6326('0x2d')](function(_0xcb5683){if(_0xcb5683){return _0xcb5683?{'count':_0x429c41,'rows':_0xcb5683}:null;}})['then'](respondWithResult(_0x4c8bde,null))[_0x6326('0x4f')](handleError(_0x4c8bde,null));};exports['getTeams']=function(_0x44cea5,_0x57e6ad,_0x3a9312){var _0x5b251f={};var _0x2b885b={};var _0xda3005;var _0x29682b;return db[_0x6326('0x35')][_0x6326('0x7d')]({'where':{'id':_0x44cea5[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x57e6ad,null))['then'](function(_0x1da431){if(_0x1da431){_0xda3005=_0x1da431;_0x2b885b[_0x6326('0x3a')]=_[_0x6326('0x52')](db['Team'][_0x6326('0x36')]);_0x2b885b['query']=_[_0x6326('0x52')](_0x44cea5[_0x6326('0x3b')]);_0x2b885b[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x2b885b[_0x6326('0x3a')],_0x2b885b[_0x6326('0x3b')]);_0x5b251f[_0x6326('0x3f')]=_['intersection'](_0x2b885b[_0x6326('0x3a')],qs['fields'](_0x44cea5[_0x6326('0x3b')][_0x6326('0x3e')]));_0x5b251f[_0x6326('0x3f')]=_0x5b251f[_0x6326('0x3f')]['length']?_0x5b251f['attributes']:_0x2b885b[_0x6326('0x3a')];_0x5b251f[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x44cea5[_0x6326('0x3b')]['sort']);_0x5b251f[_0x6326('0x45')]=qs['filters'](_['pick'](_0x44cea5[_0x6326('0x3b')],_0x2b885b[_0x6326('0x3c')]));if(_0x44cea5[_0x6326('0x3b')][_0x6326('0x48')]){_0x5b251f[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5b251f[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x5b251f[_0x6326('0x3f')],function(_0x3884db){var _0x5ccb35={};_0x5ccb35[_0x3884db]={'$like':'%'+_0x44cea5['query'][_0x6326('0x48')]+'%'};return _0x5ccb35;})});}_0x5b251f=_['merge']({},_0x5b251f,_0x44cea5[_0x6326('0x4a')]);return _0xda3005['getTeams'](_0x5b251f);}})['then'](function(_0x10d3c6){if(_0x10d3c6){_0x29682b=_0x10d3c6[_0x6326('0x40')];if(!_0x44cea5[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5b251f[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x44cea5[_0x6326('0x3b')]['limit']);_0x5b251f['offset']=qs[_0x6326('0x23')](_0x44cea5['query'][_0x6326('0x23')]);}return _0xda3005[_0x6326('0x81')](_0x5b251f);}})['then'](function(_0x5c57e5){if(_0x5c57e5){return _0x5c57e5?{'count':_0x29682b,'rows':_0x5c57e5}:null;}})[_0x6326('0x2d')](respondWithResult(_0x57e6ad,null))['catch'](handleError(_0x57e6ad,null));};exports['addTeams']=function(_0x50d766,_0x4f45a6,_0x3a9a9e){var _0x22c60d=_0x50d766[_0x6326('0x57')][_0x6326('0x79')];var _0x26f784;return db[_0x6326('0x82')]['findAll']({'where':{'id':_0x22c60d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0x6326('0x83')],'raw':!![]}]})[_0x6326('0x2d')](function(_0x215db1){if(_0x215db1){_0x26f784=_0x215db1;var _0x2a9f5c=_['flatMap'](_0x215db1,function(_0x20f5ea){var _0x293f72=_0x20f5ea['get']({'plain':!![]});return _0x293f72[_0x6326('0x84')];});return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x50d766[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](function(_0x5d4b0a){return db['sequelize'][_0x6326('0x56')](function(_0xf912fe){return _0x5d4b0a[_0x6326('0x85')](_0x22c60d,{'transaction':_0xf912fe})['then'](function(){return BPromise[_0x6326('0x86')](_0x26f784,function(_0x464914){return db[_0x6326('0x87')]['upsert']({'TeamId':_0x464914['id'],'VoicePrefixId':_0x50d766[_0x6326('0x51')]['id']},{'transaction':_0xf912fe});});})['then'](function(){return BPromise[_0x6326('0x86')](_0x2a9f5c,function(_0x5a7b49){return db[_0x6326('0x88')][_0x6326('0x89')]({'where':{'UserId':_0x5a7b49['id'],'VoicePrefixId':_0x50d766['params']['id']},'transaction':_0xf912fe});});})[_0x6326('0x2d')](function(){_0x2a9f5c[_0x6326('0x8a')](function(_0x38d8c8){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':_0x38d8c8['id'],'VoicePrefixId':_0x5d4b0a['id']});});});});});}})[_0x6326('0x2d')](respondWithStatusCode(_0x4f45a6,null))[_0x6326('0x4f')](handleError(_0x4f45a6,null));};exports[_0x6326('0x8b')]=function(_0x43dc1e,_0x26ea69,_0x1a4b94){return db[_0x6326('0x82')][_0x6326('0x4d')]({'where':{'id':_0x43dc1e['query'][_0x6326('0x79')]},'attributes':['id'],'include':[{'model':db[_0x6326('0x7e')],'as':_0x6326('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26ea69,null))['then'](function(_0x489226){var _0x5db6b3=_[_0x6326('0x34')](_0x489226,'id');var _0x5135df=[];var _0x4c15d2=[];var _0xd9c385=squel['select']();_0xd9c385['field'](_0x6326('0x8c'))['from'](_0x6326('0x8d'),'tq')[_0x6326('0x8e')](_0x6326('0x8f'),'ut',_0x6326('0x90'))[_0x6326('0x45')](_0x6326('0x91'),_0x43dc1e[_0x6326('0x51')]['id']);for(var _0x26391c=0x0;_0x26391c<_0x489226[_0x6326('0x40')];_0x26391c+=0x1){let _0x1adcbc=_0x489226[_0x26391c];for(var _0x46bece=0x0;_0x46bece<_0x1adcbc[_0x6326('0x84')][_0x6326('0x40')];_0x46bece+=0x1){let _0x30d31a=_0x1adcbc[_0x6326('0x84')][_0x46bece];var _0x3ec241=_0xd9c385[_0x6326('0x92')]();_0x3ec241[_0x6326('0x45')](_0x6326('0x93'),_0x30d31a['id']);_0x4c15d2[_0x6326('0x6c')](db['sequelize'][_0x6326('0x3b')](_0x3ec241[_0x6326('0x94')](),{'type':db[_0x6326('0x95')][_0x6326('0x96')][_0x6326('0x97')]})[_0x6326('0x2d')](function(_0x292657){if(_0x292657[_0x6326('0x40')]===0x1){return _0x30d31a['id'];}else{var _0x909cce=_[_0x6326('0x98')](_['map'](_0x292657,_0x6326('0x99')),function(_0x4b493a){return _[_0x6326('0x9a')](_0x5db6b3,_0x4b493a);});if(_0x909cce){return _0x30d31a['id'];}}}));}}return BPromise[_0x6326('0x9b')](_0x4c15d2)['then'](function(_0x2b98a4){_0x5135df=_(_0x5135df)[_0x6326('0x9c')](_0x2b98a4)['compact']()['value']();return db[_0x6326('0x35')]['find']({'where':{'id':_0x43dc1e[_0x6326('0x51')]['id']}})['then'](function(_0x4a470e){return db[_0x6326('0x95')][_0x6326('0x56')](function(_0x298a11){return _0x4a470e[_0x6326('0x8b')](_0x43dc1e[_0x6326('0x3b')][_0x6326('0x79')],{'transaction':_0x298a11})[_0x6326('0x2d')](function(){if(!_['isEmpty'](_0x5135df)){return _0x4a470e['removeAgents'](_0x5135df,{'transaction':_0x298a11});}})[_0x6326('0x2d')](function(){_0x5135df[_0x6326('0x8a')](function(_0x42d1db){socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':_0x42d1db,'VoicePrefixId':_0x4a470e['id']});});});});});});})['then'](respondWithStatusCode(_0x26ea69,null))[_0x6326('0x4f')](handleError(_0x26ea69,null));}; \ No newline at end of file +var _0x6cb4=['map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','filters','filter','where','merge','VoicePrefix','catch','show','params','include','find','describe','sequelize','transaction','create','VoiceExtensionId','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','body','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','sort','pick','hasOwnProperty','getTeams','Team','options','addTeams','findAll','Agents','online','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index'];(function(_0x1fcbf6,_0x1aee59){var _0x4244ce=function(_0x5eac5f){while(--_0x5eac5f){_0x1fcbf6['push'](_0x1fcbf6['shift']());}};_0x4244ce(++_0x1aee59);}(_0x6cb4,0xff));var _0x46cb=function(_0x41fab1,_0x39ec37){_0x41fab1=_0x41fab1-0x0;var _0x170e2d=_0x6cb4[_0x41fab1];return _0x170e2d;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];config[_0x46cb('0x18')]=_[_0x46cb('0x19')](config[_0x46cb('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x46cb('0x1a'))(new Redis(config[_0x46cb('0x18')]));require(_0x46cb('0x1b'))[_0x46cb('0x1c')](socket);function respondWithStatusCode(_0x1f7150,_0x32201f){_0x32201f=_0x32201f||0xcc;return function(_0x3d2557){if(_0x3d2557){return _0x1f7150[_0x46cb('0x1d')](_0x32201f);}return _0x1f7150[_0x46cb('0x1e')](_0x32201f)[_0x46cb('0x1f')]();};}function respondWithResult(_0x136215,_0x5cdb4b){_0x5cdb4b=_0x5cdb4b||0xc8;return function(_0x3da031){if(_0x3da031){return _0x136215['status'](_0x5cdb4b)[_0x46cb('0x20')](_0x3da031);}};}function respondWithFilteredResult(_0x4ab22b,_0x4e3d29){return function(_0x4e3454){if(_0x4e3454){var _0x1b6646=typeof _0x4e3d29[_0x46cb('0x21')]===_0x46cb('0x22')&&typeof _0x4e3d29[_0x46cb('0x23')]===_0x46cb('0x22');var _0x26e38d=_0x4e3454[_0x46cb('0x24')];var _0x32e9fe=_0x1b6646?0x0:_0x4e3d29[_0x46cb('0x21')];var _0xfc9064=_0x1b6646?_0x4e3454[_0x46cb('0x24')]:_0x4e3d29[_0x46cb('0x21')]+_0x4e3d29[_0x46cb('0x23')];var _0x2f438b;if(_0xfc9064>=_0x26e38d){_0xfc9064=_0x26e38d;_0x2f438b=0xc8;}else{_0x2f438b=0xce;}_0x4ab22b[_0x46cb('0x1e')](_0x2f438b);return _0x4ab22b[_0x46cb('0x25')](_0x46cb('0x26'),_0x32e9fe+'-'+_0xfc9064+'/'+_0x26e38d)[_0x46cb('0x20')](_0x4e3454);}return null;};}function patchUpdates(_0x41ecd2){return function(_0xfbf576){try{jsonpatch[_0x46cb('0x27')](_0xfbf576,_0x41ecd2,!![]);}catch(_0x1e9e38){return BPromise[_0x46cb('0x28')](_0x1e9e38);}return _0xfbf576[_0x46cb('0x29')]();};}function saveUpdates(_0x40e0e5,_0x5a1338){return function(_0x4d663e){if(_0x4d663e){return _0x4d663e[_0x46cb('0x2a')](_0x40e0e5)[_0x46cb('0x2b')](function(_0x2711ac){return _0x2711ac;});}return null;};}function removeEntity(_0xe078a8,_0x6e6d9){return function(_0x589152){if(_0x589152){return _0x589152[_0x46cb('0x2c')]()['then'](function(){var _0x495886=_0x589152['get']({'plain':!![]});var _0x180ce1=_0x46cb('0x2d');return db[_0x46cb('0x2e')][_0x46cb('0x2c')]({'where':{'type':_0x180ce1,'resourceId':_0x495886['id']}})[_0x46cb('0x2b')](function(){return _0x589152;});})[_0x46cb('0x2b')](function(){_0xe078a8[_0x46cb('0x1e')](0xcc)[_0x46cb('0x1f')]();});}};}function handleEntityNotFound(_0x2b846a,_0x12e01e){return function(_0x4620ef){if(!_0x4620ef){_0x2b846a['sendStatus'](0x194);}return _0x4620ef;};}function handleError(_0x1ce88f,_0xf3d376){_0xf3d376=_0xf3d376||0x1f4;return function(_0x4c73bd){logger['error'](_0x4c73bd[_0x46cb('0x2f')]);if(_0x4c73bd['name']){delete _0x4c73bd[_0x46cb('0x30')];}_0x1ce88f[_0x46cb('0x1e')](_0xf3d376)[_0x46cb('0x31')](_0x4c73bd);};}exports[_0x46cb('0x32')]=function(_0x9b9d03,_0x33c248){var _0x5dc551={},_0x2e2d36={},_0x49ffc5={'count':0x0,'rows':[]};var _0x2661d6=_[_0x46cb('0x33')](db['VoicePrefix'][_0x46cb('0x34')],function(_0x3f0eb4){return{'name':_0x3f0eb4[_0x46cb('0x35')],'type':_0x3f0eb4[_0x46cb('0x36')][_0x46cb('0x37')]};});_0x2e2d36['model']=_[_0x46cb('0x33')](_0x2661d6,'name');_0x2e2d36[_0x46cb('0x38')]=_[_0x46cb('0x39')](_0x9b9d03[_0x46cb('0x38')]);_0x2e2d36['filters']=_[_0x46cb('0x3a')](_0x2e2d36[_0x46cb('0x3b')],_0x2e2d36['query']);_0x5dc551[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x2e2d36[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x3d')]));_0x5dc551[_0x46cb('0x3c')]=_0x5dc551[_0x46cb('0x3c')][_0x46cb('0x3e')]?_0x5dc551[_0x46cb('0x3c')]:_0x2e2d36[_0x46cb('0x3b')];if(!_0x9b9d03['query']['hasOwnProperty']('nolimit')){_0x5dc551[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x23')]);_0x5dc551[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x9b9d03['query'][_0x46cb('0x21')]);}_0x5dc551['order']=qs['sort'](_0x9b9d03[_0x46cb('0x38')]['sort']);_0x5dc551['where']=qs[_0x46cb('0x3f')](_['pick'](_0x9b9d03['query'],_0x2e2d36[_0x46cb('0x3f')]),_0x2661d6);if(_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x40')]){_0x5dc551[_0x46cb('0x41')]=_[_0x46cb('0x42')](_0x5dc551[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0x2661d6,function(_0x56efa8){if(_0x56efa8[_0x46cb('0x36')]!=='VIRTUAL'){var _0x391a6b={};_0x391a6b[_0x56efa8['name']]={'$like':'%'+_0x9b9d03[_0x46cb('0x38')][_0x46cb('0x40')]+'%'};return _0x391a6b;}})});}_0x5dc551=_[_0x46cb('0x42')]({},_0x5dc551,_0x9b9d03['options']);var _0x43b5d2={'where':_0x5dc551[_0x46cb('0x41')]};return db['VoicePrefix'][_0x46cb('0x24')](_0x43b5d2)[_0x46cb('0x2b')](function(_0x1f67af){_0x49ffc5[_0x46cb('0x24')]=_0x1f67af;if(_0x9b9d03[_0x46cb('0x38')]['includeAll']){_0x5dc551['include']=[{'all':!![]}];}return db[_0x46cb('0x43')]['findAll'](_0x5dc551);})[_0x46cb('0x2b')](function(_0x41f76c){_0x49ffc5['rows']=_0x41f76c;return _0x49ffc5;})[_0x46cb('0x2b')](respondWithFilteredResult(_0x33c248,_0x5dc551))[_0x46cb('0x44')](handleError(_0x33c248,null));};exports[_0x46cb('0x45')]=function(_0x5d94db,_0x4f957b){var _0x5cbdad={'raw':![],'where':{'id':_0x5d94db[_0x46cb('0x46')]['id']}},_0x57fedd={};_0x57fedd[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x43')][_0x46cb('0x34')]);_0x57fedd['query']=_['keys'](_0x5d94db[_0x46cb('0x38')]);_0x57fedd[_0x46cb('0x3f')]=_['intersection'](_0x57fedd[_0x46cb('0x3b')],_0x57fedd[_0x46cb('0x38')]);_0x5cbdad[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x57fedd[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x5d94db[_0x46cb('0x38')]['fields']));_0x5cbdad['attributes']=_0x5cbdad[_0x46cb('0x3c')]['length']?_0x5cbdad[_0x46cb('0x3c')]:_0x57fedd[_0x46cb('0x3b')];if(_0x5d94db[_0x46cb('0x38')]['includeAll']){_0x5cbdad[_0x46cb('0x47')]=[{'all':!![]}];}_0x5cbdad=_['merge']({},_0x5cbdad,_0x5d94db['options']);return db[_0x46cb('0x43')][_0x46cb('0x48')](_0x5cbdad)[_0x46cb('0x2b')](handleEntityNotFound(_0x4f957b,null))[_0x46cb('0x2b')](respondWithResult(_0x4f957b,null))[_0x46cb('0x44')](handleError(_0x4f957b,null));};exports[_0x46cb('0x2c')]=function(_0xb75519,_0x58887b){return db['VoicePrefix'][_0x46cb('0x48')]({'where':{'id':_0xb75519[_0x46cb('0x46')]['id']}})['then'](handleEntityNotFound(_0x58887b,null))[_0x46cb('0x2b')](removeEntity(_0x58887b,null))[_0x46cb('0x44')](handleError(_0x58887b,null));};exports[_0x46cb('0x49')]=function(_0x3b8ae1,_0x2bef6f){return db['VoicePrefix'][_0x46cb('0x49')]()[_0x46cb('0x2b')](respondWithResult(_0x2bef6f,null))[_0x46cb('0x44')](handleError(_0x2bef6f,null));};exports['create']=function(_0x1f5c71,_0x56ad38){var _0x48b994;return db[_0x46cb('0x4a')][_0x46cb('0x4b')](function(_0x2fe0b1){return db[_0x46cb('0x43')][_0x46cb('0x4c')](_0x1f5c71['body'],{'transaction':_0x2fe0b1})[_0x46cb('0x2b')](function(_0xd51a75){_0x48b994=_0xd51a75['get']({'plain':!![]});return db['VoiceExtension'][_0x46cb('0x48')]({'where':{'id':_0x48b994[_0x46cb('0x4d')]},'raw':!![]})[_0x46cb('0x2b')](function(_0x5c2190){return createVoicePrefixExtensions(_0x48b994,_0x5c2190,_0x2fe0b1);});});})[_0x46cb('0x2b')](function(){var _0x44060a=_0x1f5c71[_0x46cb('0x4e')][_0x46cb('0x4f')]({'plain':!![]});if(!_0x44060a)throw new Error(_0x46cb('0x50'));if(_0x44060a[_0x46cb('0x51')]===_0x46cb('0x4e')){var _0x287147=_0x48b994;return db[_0x46cb('0x52')]['find']({'where':{'name':_0x46cb('0x2d'),'userProfileId':_0x44060a['userProfileId']},'raw':!![]})[_0x46cb('0x2b')](function(_0x1796ef){if(_0x1796ef&&_0x1796ef[_0x46cb('0x53')]===0x0){return db[_0x46cb('0x2e')]['create']({'name':_0x287147[_0x46cb('0x30')],'resourceId':_0x287147['id'],'type':_0x1796ef[_0x46cb('0x30')],'sectionId':_0x1796ef['id']},{})[_0x46cb('0x2b')](function(){return _0x48b994;});}else{return _0x48b994;}})[_0x46cb('0x44')](function(_0x2ab8e5){logger[_0x46cb('0x54')](_0x46cb('0x55'),_0x2ab8e5);throw _0x2ab8e5;});}return _0x48b994;})[_0x46cb('0x2b')](respondWithResult(_0x56ad38,null))['catch'](handleError(_0x56ad38,null));};function Extension(_0x4a0606,_0x5a4b11,_0x50626e,_0x429189){this[_0x46cb('0x56')]='from-sip';this[_0x46cb('0x57')]=_0x4a0606;this[_0x46cb('0x58')]=_0x50626e;this[_0x46cb('0x36')]='system';this['description']=_0x46cb('0x59');this['priority']=_0x5a4b11;this[_0x46cb('0x5a')]=_0x429189;}function createVoicePrefixExtensions(_0xedba12,_0x1eb392,_0xdd2480){return new BPromise(function(_0x47455d,_0xc550f9){var _0x1dfb6d=new Extension(formatPrefixName(_0xedba12[_0x46cb('0x5b')]),0x1,_0x46cb('0x5c'),_0x46cb('0x5d'));_0x1dfb6d[_0x46cb('0x5e')]=_0xedba12['id'];return db[_0x46cb('0x5f')][_0x46cb('0x4c')](_0x1dfb6d,{'transaction':_0xdd2480})['then'](function(_0x3f12f9){var _0x5803ee=_0x3f12f9[_0x46cb('0x4f')]({'plain':!![]});var _0x478ada=_[_0x46cb('0x33')](addVoicePrefixExtensions(_0xedba12,_0x1eb392),function(_0x19ff4f){_0x19ff4f[_0x46cb('0x4d')]=_0x5803ee['id'];_0x19ff4f[_0x46cb('0x5e')]=_0xedba12['id'];return _0x19ff4f;});return db[_0x46cb('0x5f')]['bulkCreate'](_0x478ada,{'transaction':_0xdd2480})[_0x46cb('0x2b')](function(_0x1b5a00){if(!_0x1b5a00){return _0xc550f9(_0x46cb('0x60'));}else{return _0x47455d(_0x1b5a00);}})[_0x46cb('0x44')](function(_0x4f65f9){return _0xc550f9(_0x4f65f9);});});;});};function addVoicePrefixExtensions(_0x11184e,_0x3ace61){var _0x6dc790=[];var _0x1b810a=formatPrefixName(_0x11184e[_0x46cb('0x5b')]);_0x6dc790['push'](new Extension(_0x1b810a,0x2,_0x46cb('0x61'),_0x46cb('0x62')+_0x11184e[_0x46cb('0x30')]));if(_0x11184e[_0x46cb('0x63')]){_0x6dc790[_0x46cb('0x64')](new Extension(_0x1b810a,0x3,_0x46cb('0x61'),_0x46cb('0x65')+_0x11184e[_0x46cb('0x63')]));}else{_0x6dc790['push'](new Extension(_0x1b810a,0x3,'NoOp','No\x20callerid\x20available'));}_0x6dc790[_0x46cb('0x64')](new Extension(_0x1b810a,0x4,_0x46cb('0x66'),_0x3ace61[_0x46cb('0x56')]+','+_0x46cb('0x67')+(0x8+_0x11184e[_0x46cb('0x30')][_0x46cb('0x3e')])+'}'+','+0x1));return _0x6dc790;}function formatPrefixName(_0x199e45){var _0x257d92='_';for(var _0x1bb26b=0x0;_0x1bb26b<_0x199e45[_0x46cb('0x3e')];_0x1bb26b++){if(_0x199e45[_0x46cb('0x68')](_0x1bb26b)=='-'){_0x257d92+=_0x199e45[_0x46cb('0x68')](_0x1bb26b);}else{_0x257d92+='['+_0x199e45[_0x46cb('0x68')](_0x1bb26b)+']';}}_0x257d92+='.';return _0x257d92;}exports[_0x46cb('0x2a')]=function(_0x5c9f3c,_0x2e23e4,_0x5ab62f){var _0x42e9de=_0x5c9f3c['body'];_0x42e9de[_0x46cb('0x5b')]=_0x46cb('0x69')+_0x42e9de[_0x46cb('0x30')]+'-';return db[_0x46cb('0x4a')]['transaction'](function(_0xa7d3ab){return db[_0x46cb('0x43')]['update'](_0x42e9de,{'where':{'id':_0x42e9de['id']},'transaction':_0xa7d3ab})['then'](function(){return db[_0x46cb('0x5f')][_0x46cb('0x2c')]({'where':{'VoicePrefixId':_0x42e9de['id']},'transaction':_0xa7d3ab})[_0x46cb('0x2b')](function(){return db[_0x46cb('0x5f')][_0x46cb('0x48')]({'where':{'id':_0x42e9de['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b427b){return createVoicePrefixExtensions(_0x42e9de,_0x4b427b,_0xa7d3ab);});});});})[_0x46cb('0x2b')](function(){return db[_0x46cb('0x43')][_0x46cb('0x6a')](_0x42e9de['id']);})[_0x46cb('0x2b')](respondWithResult(_0x2e23e4,null))[_0x46cb('0x44')](handleError(_0x2e23e4,null));};exports[_0x46cb('0x6b')]=function(_0x218663,_0x145b3d,_0xd9f049){return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x218663['params']['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x145b3d,null))[_0x46cb('0x2b')](function(_0x84534){if(_0x84534){return _0x84534[_0x46cb('0x6b')](_0x218663['body'][_0x46cb('0x6c')],_[_0x46cb('0x6d')](_0x218663[_0x46cb('0x6e')],[_0x46cb('0x6c'),'id'])||{})['spread'](function(_0x2f87ed){for(var _0x19d6a8=0x0;_0x19d6a8<_0x218663[_0x46cb('0x6e')][_0x46cb('0x6c')]['length'];_0x19d6a8+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x218663[_0x46cb('0x6e')]['ids'][_0x19d6a8]),'VoicePrefixId':Number(_0x218663[_0x46cb('0x46')]['id'])});}return _0x2f87ed;});}})['then'](respondWithResult(_0x145b3d,null))[_0x46cb('0x44')](handleError(_0x145b3d,null));};exports[_0x46cb('0x6f')]=function(_0x29566a,_0x323db7,_0x57256a){return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x29566a[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x323db7,null))['then'](function(_0x555efa){if(_0x555efa){return _0x555efa[_0x46cb('0x6f')](_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')])[_0x46cb('0x2b')](function(){if(_[_0x46cb('0x70')](_0x29566a[_0x46cb('0x38')]['ids'])){for(var _0x53f307=0x0;_0x53f307<_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')]['length'];_0x53f307+=0x1){socket[_0x46cb('0x71')](_0x46cb('0x72'),{'UserId':Number(_0x29566a[_0x46cb('0x38')][_0x46cb('0x6c')][_0x53f307]),'VoicePrefixId':Number(_0x29566a[_0x46cb('0x46')]['id'])});}}else{socket[_0x46cb('0x71')](_0x46cb('0x72'),{'UserId':Number(_0x29566a['query'][_0x46cb('0x6c')]),'VoicePrefixId':Number(_0x29566a[_0x46cb('0x46')]['id'])});}});}})[_0x46cb('0x2b')](respondWithStatusCode(_0x323db7,null))[_0x46cb('0x44')](handleError(_0x323db7,null));};exports[_0x46cb('0x73')]=function(_0x11003d,_0x465296,_0x3e4cec){var _0x5567cc={};var _0x51315a={};var _0x3cb612;var _0xbe8e16;return db[_0x46cb('0x43')][_0x46cb('0x74')]({'where':{'id':_0x11003d['params']['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x465296,null))['then'](function(_0x52afba){if(_0x52afba){_0x3cb612=_0x52afba;_0x51315a[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x75')][_0x46cb('0x34')]);_0x51315a['query']=_[_0x46cb('0x39')](_0x11003d['query']);_0x51315a[_0x46cb('0x3f')]=_[_0x46cb('0x3a')](_0x51315a[_0x46cb('0x3b')],_0x51315a[_0x46cb('0x38')]);_0x5567cc[_0x46cb('0x3c')]=_[_0x46cb('0x3a')](_0x51315a['model'],qs['fields'](_0x11003d[_0x46cb('0x38')]['fields']));_0x5567cc[_0x46cb('0x3c')]=_0x5567cc['attributes'][_0x46cb('0x3e')]?_0x5567cc[_0x46cb('0x3c')]:_0x51315a[_0x46cb('0x3b')];_0x5567cc['order']=qs[_0x46cb('0x76')](_0x11003d[_0x46cb('0x38')][_0x46cb('0x76')]);_0x5567cc[_0x46cb('0x41')]=qs[_0x46cb('0x3f')](_[_0x46cb('0x77')](_0x11003d[_0x46cb('0x38')],_0x51315a[_0x46cb('0x3f')]));if(_0x11003d[_0x46cb('0x38')][_0x46cb('0x40')]){_0x5567cc['where']=_['merge'](_0x5567cc[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0x5567cc['attributes'],function(_0x191c9b){var _0x4a529b={};_0x4a529b[_0x191c9b]={'$like':'%'+_0x11003d['query'][_0x46cb('0x40')]+'%'};return _0x4a529b;})});}_0x5567cc=_[_0x46cb('0x42')]({},_0x5567cc,_0x11003d['options']);return _0x3cb612[_0x46cb('0x73')](_0x5567cc);}})[_0x46cb('0x2b')](function(_0x1e7f26){if(_0x1e7f26){_0xbe8e16=_0x1e7f26[_0x46cb('0x3e')];if(!_0x11003d[_0x46cb('0x38')][_0x46cb('0x78')]('nolimit')){_0x5567cc[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x11003d[_0x46cb('0x38')][_0x46cb('0x23')]);_0x5567cc[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x11003d[_0x46cb('0x38')]['offset']);}return _0x3cb612[_0x46cb('0x73')](_0x5567cc);}})[_0x46cb('0x2b')](function(_0x3ffe97){if(_0x3ffe97){return _0x3ffe97?{'count':_0xbe8e16,'rows':_0x3ffe97}:null;}})[_0x46cb('0x2b')](respondWithResult(_0x465296,null))[_0x46cb('0x44')](handleError(_0x465296,null));};exports[_0x46cb('0x79')]=function(_0x3715c6,_0x500896,_0x4c8666){var _0xf82b6d={};var _0x36cc75={};var _0x2ef7d8;var _0x99a2b1;return db[_0x46cb('0x43')][_0x46cb('0x74')]({'where':{'id':_0x3715c6[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](handleEntityNotFound(_0x500896,null))['then'](function(_0x33e6aa){if(_0x33e6aa){_0x2ef7d8=_0x33e6aa;_0x36cc75[_0x46cb('0x3b')]=_[_0x46cb('0x39')](db[_0x46cb('0x7a')][_0x46cb('0x34')]);_0x36cc75['query']=_['keys'](_0x3715c6[_0x46cb('0x38')]);_0x36cc75[_0x46cb('0x3f')]=_[_0x46cb('0x3a')](_0x36cc75['model'],_0x36cc75['query']);_0xf82b6d[_0x46cb('0x3c')]=_['intersection'](_0x36cc75[_0x46cb('0x3b')],qs[_0x46cb('0x3d')](_0x3715c6['query'][_0x46cb('0x3d')]));_0xf82b6d[_0x46cb('0x3c')]=_0xf82b6d[_0x46cb('0x3c')][_0x46cb('0x3e')]?_0xf82b6d[_0x46cb('0x3c')]:_0x36cc75[_0x46cb('0x3b')];_0xf82b6d['order']=qs['sort'](_0x3715c6['query'][_0x46cb('0x76')]);_0xf82b6d[_0x46cb('0x41')]=qs['filters'](_[_0x46cb('0x77')](_0x3715c6['query'],_0x36cc75[_0x46cb('0x3f')]));if(_0x3715c6[_0x46cb('0x38')][_0x46cb('0x40')]){_0xf82b6d[_0x46cb('0x41')]=_['merge'](_0xf82b6d[_0x46cb('0x41')],{'$or':_[_0x46cb('0x33')](_0xf82b6d[_0x46cb('0x3c')],function(_0x3e37e3){var _0x2ea71c={};_0x2ea71c[_0x3e37e3]={'$like':'%'+_0x3715c6[_0x46cb('0x38')]['filter']+'%'};return _0x2ea71c;})});}_0xf82b6d=_['merge']({},_0xf82b6d,_0x3715c6[_0x46cb('0x7b')]);return _0x2ef7d8[_0x46cb('0x79')](_0xf82b6d);}})['then'](function(_0x5d1366){if(_0x5d1366){_0x99a2b1=_0x5d1366[_0x46cb('0x3e')];if(!_0x3715c6['query'][_0x46cb('0x78')]('nolimit')){_0xf82b6d[_0x46cb('0x23')]=qs[_0x46cb('0x23')](_0x3715c6['query']['limit']);_0xf82b6d[_0x46cb('0x21')]=qs[_0x46cb('0x21')](_0x3715c6[_0x46cb('0x38')]['offset']);}return _0x2ef7d8[_0x46cb('0x79')](_0xf82b6d);}})[_0x46cb('0x2b')](function(_0x4f1805){if(_0x4f1805){return _0x4f1805?{'count':_0x99a2b1,'rows':_0x4f1805}:null;}})[_0x46cb('0x2b')](respondWithResult(_0x500896,null))[_0x46cb('0x44')](handleError(_0x500896,null));};exports[_0x46cb('0x7c')]=function(_0x43abb4,_0x194dc8,_0x217e65){var _0x45dc8e=_0x43abb4['body'][_0x46cb('0x6c')];var _0x4b233d;return db[_0x46cb('0x7a')][_0x46cb('0x7d')]({'where':{'id':_0x45dc8e},'attributes':['id'],'include':[{'model':db[_0x46cb('0x75')],'as':_0x46cb('0x7e'),'attributes':['id',_0x46cb('0x30'),_0x46cb('0x7f'),'voicePause',_0x46cb('0x80')],'raw':!![]}]})[_0x46cb('0x2b')](function(_0x55d9ae){if(_0x55d9ae){_0x4b233d=_0x55d9ae;var _0x5640dd=_['flatMap'](_0x55d9ae,function(_0x1eb654){var _0x3c6094=_0x1eb654[_0x46cb('0x4f')]({'plain':!![]});return _0x3c6094[_0x46cb('0x7e')];});return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x43abb4[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](function(_0x349f95){return db[_0x46cb('0x4a')][_0x46cb('0x4b')](function(_0x1b5624){return _0x349f95[_0x46cb('0x7c')](_0x45dc8e,{'transaction':_0x1b5624})[_0x46cb('0x2b')](function(){return BPromise[_0x46cb('0x81')](_0x4b233d,function(_0xf2766f){return db[_0x46cb('0x82')][_0x46cb('0x83')]({'TeamId':_0xf2766f['id'],'VoicePrefixId':_0x43abb4['params']['id']},{'transaction':_0x1b5624});});})['then'](function(){return BPromise['each'](_0x5640dd,function(_0x686d2b){return db[_0x46cb('0x84')][_0x46cb('0x85')]({'where':{'UserId':_0x686d2b['id'],'VoicePrefixId':_0x43abb4[_0x46cb('0x46')]['id']},'transaction':_0x1b5624});});})[_0x46cb('0x2b')](function(){_0x5640dd[_0x46cb('0x86')](function(_0xfdb016){socket[_0x46cb('0x71')](_0x46cb('0x87'),{'UserId':_0xfdb016['id'],'VoicePrefixId':_0x349f95['id']});});});});});}})[_0x46cb('0x2b')](respondWithStatusCode(_0x194dc8,null))[_0x46cb('0x44')](handleError(_0x194dc8,null));};exports['removeTeams']=function(_0x257d26,_0x3a3acf,_0x592a54){return db['Team'][_0x46cb('0x7d')]({'where':{'id':_0x257d26[_0x46cb('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x46cb('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x46cb('0x2b')](handleEntityNotFound(_0x3a3acf,null))[_0x46cb('0x2b')](function(_0x22838d){var _0x311d75=_[_0x46cb('0x33')](_0x22838d,'id');var _0x30dad4=[];var _0x21a550=[];var _0x484b26=squel[_0x46cb('0x88')]();_0x484b26['field'](_0x46cb('0x89'))[_0x46cb('0x8a')](_0x46cb('0x8b'),'tq')[_0x46cb('0x8c')](_0x46cb('0x8d'),'ut',_0x46cb('0x8e'))[_0x46cb('0x41')](_0x46cb('0x8f'),_0x257d26[_0x46cb('0x46')]['id']);for(var _0x471f08=0x0;_0x471f08<_0x22838d[_0x46cb('0x3e')];_0x471f08+=0x1){let _0x51bd7a=_0x22838d[_0x471f08];for(var _0x4a22c1=0x0;_0x4a22c1<_0x51bd7a[_0x46cb('0x7e')][_0x46cb('0x3e')];_0x4a22c1+=0x1){let _0x4481d6=_0x51bd7a['Agents'][_0x4a22c1];var _0x2e875b=_0x484b26['clone']();_0x2e875b[_0x46cb('0x41')](_0x46cb('0x90'),_0x4481d6['id']);_0x21a550['push'](db['sequelize'][_0x46cb('0x38')](_0x2e875b[_0x46cb('0x91')](),{'type':db['sequelize'][_0x46cb('0x92')]['SELECT']})[_0x46cb('0x2b')](function(_0x2cf5f3){if(_0x2cf5f3[_0x46cb('0x3e')]===0x1){return _0x4481d6['id'];}else{var _0x4f4a7b=_['every'](_[_0x46cb('0x33')](_0x2cf5f3,_0x46cb('0x93')),function(_0x1c7ffb){return _[_0x46cb('0x94')](_0x311d75,_0x1c7ffb);});if(_0x4f4a7b){return _0x4481d6['id'];}}}));}}return BPromise[_0x46cb('0x95')](_0x21a550)[_0x46cb('0x2b')](function(_0x11c28a){_0x30dad4=_(_0x30dad4)[_0x46cb('0x96')](_0x11c28a)['compact']()['value']();return db[_0x46cb('0x43')][_0x46cb('0x48')]({'where':{'id':_0x257d26[_0x46cb('0x46')]['id']}})[_0x46cb('0x2b')](function(_0x196557){return db[_0x46cb('0x4a')]['transaction'](function(_0x250e79){return _0x196557[_0x46cb('0x97')](_0x257d26[_0x46cb('0x38')][_0x46cb('0x6c')],{'transaction':_0x250e79})['then'](function(){if(!_[_0x46cb('0x98')](_0x30dad4)){return _0x196557['removeAgents'](_0x30dad4,{'transaction':_0x250e79});}})[_0x46cb('0x2b')](function(){_0x30dad4[_0x46cb('0x86')](function(_0xfbbc9c){socket[_0x46cb('0x71')]('userVoicePrefix:remove',{'UserId':_0xfbbc9c,'VoicePrefixId':_0x196557['id']});});});});});});})[_0x46cb('0x2b')](respondWithStatusCode(_0x3a3acf,null))['catch'](handleError(_0x3a3acf,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 316b43b..8cb66ad 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 _0xb7fd=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x22893c,_0x2d1ab9){var _0x58dc82=function(_0x2055bd){while(--_0x2055bd){_0x22893c['push'](_0x22893c['shift']());}};_0x58dc82(++_0x2d1ab9);}(_0xb7fd,0x112));var _0xdb7f=function(_0x157b8d,_0xa9045a){_0x157b8d=_0x157b8d-0x0;var _0x4107b6=_0xb7fd[_0x157b8d];return _0x4107b6;};'use strict';var EventEmitter=require(_0xdb7f('0x0'));var VoicePrefix=require(_0xdb7f('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xdb7f('0x2')](0x0);var events={'afterCreate':_0xdb7f('0x3'),'afterUpdate':_0xdb7f('0x4'),'afterDestroy':_0xdb7f('0x5')};function emitEvent(_0x5d33bd){return function(_0x36a44a,_0x2592e6,_0x6374f2){VoicePrefixEvents[_0xdb7f('0x6')](_0x5d33bd+':'+_0x36a44a['id'],_0x36a44a);VoicePrefixEvents[_0xdb7f('0x6')](_0x5d33bd,_0x36a44a);_0x6374f2(null);};}for(var e in events){if(events[_0xdb7f('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xdb7f('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xd9e0=['VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x33b3e7,_0x306ade){var _0x274ab4=function(_0x59ff2b){while(--_0x59ff2b){_0x33b3e7['push'](_0x33b3e7['shift']());}};_0x274ab4(++_0x306ade);}(_0xd9e0,0xc6));var _0x0d9e=function(_0x99251c,_0x1ea4ca){_0x99251c=_0x99251c-0x0;var _0xf893cb=_0xd9e0[_0x99251c];return _0xf893cb;};'use strict';var EventEmitter=require(_0x0d9e('0x0'));var VoicePrefix=require(_0x0d9e('0x1'))['db'][_0x0d9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0d9e('0x3')](0x0);var events={'afterCreate':_0x0d9e('0x4'),'afterUpdate':'update','afterDestroy':_0x0d9e('0x5')};function emitEvent(_0x23fd6a){return function(_0x58dea9,_0x32b60c,_0x4b29c2){VoicePrefixEvents[_0x0d9e('0x6')](_0x23fd6a+':'+_0x58dea9['id'],_0x58dea9);VoicePrefixEvents[_0x0d9e('0x6')](_0x23fd6a,_0x58dea9);_0x4b29c2(null);};}for(var e in events){if(events[_0x0d9e('0x7')](e)){var event=events[e];VoicePrefix[_0x0d9e('0x8')](e,emitEvent(event));}}module[_0x0d9e('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 951b3bd..51f6c04 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 _0x1a22=['../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1edd20,_0x1dbc2f){var _0x4188b9=function(_0x465e48){while(--_0x465e48){_0x1edd20['push'](_0x1edd20['shift']());}};_0x4188b9(++_0x1dbc2f);}(_0x1a22,0x1d9));var _0x21a2=function(_0x296db4,_0x3244dc){_0x296db4=_0x296db4-0x0;var _0x44e41c=_0x1a22[_0x296db4];return _0x44e41c;};'use strict';var _=require(_0x21a2('0x0'));var util=require(_0x21a2('0x1'));var logger=require(_0x21a2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x21a2('0x3'));var rp=require(_0x21a2('0x4'));var fs=require('fs');var path=require(_0x21a2('0x5'));var rimraf=require(_0x21a2('0x6'));var config=require(_0x21a2('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x21a2('0x8')]=function(_0x1b564f,_0x540e2a){return _0x1b564f[_0x21a2('0x9')](_0x21a2('0xa'),attributes,{'tableName':_0x21a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf657=['path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','moment','bluebird'];(function(_0x3c984e,_0x164d5b){var _0x547f7=function(_0xebe7aa){while(--_0xebe7aa){_0x3c984e['push'](_0x3c984e['shift']());}};_0x547f7(++_0x164d5b);}(_0xf657,0x146));var _0x7f65=function(_0x6eac03,_0x41d4a0){_0x6eac03=_0x6eac03-0x0;var _0x1c5c4a=_0xf657[_0x6eac03];return _0x1c5c4a;};'use strict';var _=require(_0x7f65('0x0'));var util=require('util');var logger=require(_0x7f65('0x1'))('api');var moment=require(_0x7f65('0x2'));var BPromise=require(_0x7f65('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f65('0x4'));var rimraf=require(_0x7f65('0x5'));var config=require('../../config/environment');var attributes=require(_0x7f65('0x6'));module[_0x7f65('0x7')]=function(_0x255be8,_0x29591e){return _0x255be8[_0x7f65('0x8')](_0x7f65('0x9'),attributes,{'tableName':_0x7f65('0xa'),'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 0f8b03c..5e19947 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 _0x1122=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird'];(function(_0x358e5e,_0x25feaf){var _0x411885=function(_0x3966bd){while(--_0x3966bd){_0x358e5e['push'](_0x358e5e['shift']());}};_0x411885(++_0x25feaf);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var moment=require(_0x2112('0x1'));var BPromise=require(_0x2112('0x2'));var rs=require(_0x2112('0x3'));var fs=require('fs');var Redis=require(_0x2112('0x4'));var db=require(_0x2112('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2112('0x6'));var config=require('../../config/environment');var jayson=require(_0x2112('0x7'));var client=jayson[_0x2112('0x8')]['http']({'port':0x232a});config[_0x2112('0x9')]=_[_0x2112('0xa')](config[_0x2112('0x9')],{'host':_0x2112('0xb'),'port':0x18eb});var socket=require(_0x2112('0xc'))(new Redis(config[_0x2112('0x9')]));require(_0x2112('0xd'))[_0x2112('0xe')](socket);function respondWithRpcPromise(_0x18a596,_0x485a3d,_0x4690e6){return new BPromise(function(_0x46fc8b,_0x42eddd){return client[_0x2112('0xf')](_0x18a596,_0x4690e6)['then'](function(_0xa0a089){logger[_0x2112('0x10')](_0x2112('0x11'),_0x485a3d,_0x2112('0x12'));logger[_0x2112('0x13')](_0x2112('0x14'),_0x485a3d,_0x2112('0x12'),JSON['stringify'](_0xa0a089));if(_0xa0a089[_0x2112('0x15')]){if(_0xa0a089['error'][_0x2112('0x16')]===0x1f4){logger[_0x2112('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x485a3d,_0xa0a089[_0x2112('0x15')]['message']);return _0x42eddd(_0xa0a089[_0x2112('0x15')]['message']);}logger[_0x2112('0x15')](_0x2112('0x11'),_0x485a3d,_0xa0a089['error'][_0x2112('0x17')]);return _0x46fc8b(_0xa0a089['error'][_0x2112('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x485a3d,_0x2112('0x12'));_0x46fc8b(_0xa0a089['result']['message']);}})[_0x2112('0x18')](function(_0x28d498){logger[_0x2112('0x15')](_0x2112('0x11'),_0x485a3d,_0x28d498);_0x42eddd(_0x28d498);});});} \ No newline at end of file +var _0xa24d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa24d,0x1c1));var _0xda24=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0xa24d[_0x593f03];return _0x178299;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var moment=require(_0xda24('0x2'));var BPromise=require(_0xda24('0x3'));var rs=require(_0xda24('0x4'));var fs=require('fs');var Redis=require(_0xda24('0x5'));var db=require(_0xda24('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda24('0x7'))(_0xda24('0x8'));var config=require(_0xda24('0x9'));var jayson=require(_0xda24('0xa'));var client=jayson['client'][_0xda24('0xb')]({'port':0x232a});config[_0xda24('0xc')]=_['defaults'](config[_0xda24('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xda24('0xd'))(new Redis(config[_0xda24('0xc')]));require(_0xda24('0xe'))[_0xda24('0xf')](socket);function respondWithRpcPromise(_0x54f108,_0x243fc8,_0x3374a7){return new BPromise(function(_0x22776c,_0x3a508b){return client[_0xda24('0x10')](_0x54f108,_0x3374a7)['then'](function(_0x32c867){logger['info'](_0xda24('0x11'),_0x243fc8,_0xda24('0x12'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x243fc8,_0xda24('0x12'),JSON[_0xda24('0x13')](_0x32c867));if(_0x32c867[_0xda24('0x14')]){if(_0x32c867[_0xda24('0x14')]['code']===0x1f4){logger[_0xda24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x243fc8,_0x32c867[_0xda24('0x14')][_0xda24('0x15')]);return _0x3a508b(_0x32c867['error']['message']);}logger[_0xda24('0x14')](_0xda24('0x11'),_0x243fc8,_0x32c867[_0xda24('0x14')][_0xda24('0x15')]);return _0x22776c(_0x32c867[_0xda24('0x14')][_0xda24('0x15')]);}else{logger[_0xda24('0x16')](_0xda24('0x11'),_0x243fc8,_0xda24('0x12'));_0x22776c(_0x32c867['result'][_0xda24('0x15')]);}})[_0xda24('0x17')](function(_0x52b393){logger[_0xda24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x243fc8,_0x52b393);_0x3a508b(_0x52b393);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0a08e67..b03624e 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 _0x19c3=['emit','removeListener','length','voicePrefix:','./voicePrefix.events','remove','update'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x19c3,0xf9));var _0x319c=function(_0x296866,_0x42c00b){_0x296866=_0x296866-0x0;var _0x52c9d8=_0x19c3[_0x296866];return _0x52c9d8;};'use strict';var VoicePrefixEvents=require(_0x319c('0x0'));var events=['save',_0x319c('0x1'),_0x319c('0x2')];function createListener(_0x55e0b2,_0x1db6c9){return function(_0x259d2e){_0x1db6c9[_0x319c('0x3')](_0x55e0b2,_0x259d2e);};}function removeListener(_0x350517,_0x3a96b1){return function(){VoicePrefixEvents[_0x319c('0x4')](_0x350517,_0x3a96b1);};}exports['register']=function(_0x20f77e){for(var _0x53a1de=0x0,_0x2e38c4=events[_0x319c('0x5')];_0x53a1de<_0x2e38c4;_0x53a1de++){var _0x9a5cf8=events[_0x53a1de];var _0x306a4b=createListener(_0x319c('0x6')+_0x9a5cf8,_0x20f77e);VoicePrefixEvents['on'](_0x9a5cf8,_0x306a4b);}}; \ No newline at end of file +var _0xb921=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x3f2ef7,_0x48d9cb){var _0x587c06=function(_0x448af0){while(--_0x448af0){_0x3f2ef7['push'](_0x3f2ef7['shift']());}};_0x587c06(++_0x48d9cb);}(_0xb921,0x16a));var _0x1b92=function(_0x511723,_0x4db8e2){_0x511723=_0x511723-0x0;var _0x25add0=_0xb921[_0x511723];return _0x25add0;};'use strict';var VoicePrefixEvents=require(_0x1b92('0x0'));var events=[_0x1b92('0x1'),_0x1b92('0x2'),_0x1b92('0x3')];function createListener(_0x87553a,_0x4de8de){return function(_0x51e457){_0x4de8de[_0x1b92('0x4')](_0x87553a,_0x51e457);};}function removeListener(_0xc3832e,_0x1e49a8){return function(){VoicePrefixEvents[_0x1b92('0x5')](_0xc3832e,_0x1e49a8);};}exports[_0x1b92('0x6')]=function(_0x29a1db){for(var _0x4358e3=0x0,_0x8a6282=events[_0x1b92('0x7')];_0x4358e3<_0x8a6282;_0x4358e3++){var _0x352406=events[_0x4358e3];var _0x1545f9=createListener(_0x1b92('0x8')+_0x352406,_0x29a1db);VoicePrefixEvents['on'](_0x352406,_0x1545f9);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e158493..4f3190f 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x350c20,_0x4d634f){var _0x1be143=function(_0x5d1f6e){while(--_0x5d1f6e){_0x350c20['push'](_0x350c20['shift']());}};_0x1be143(++_0x4d634f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xb10b,0x12a));var _0xbb10=function(_0x34bff6,_0x36f01d){_0x34bff6=_0x34bff6-0x0;var _0x2704ee=_0xb10b[_0x34bff6];return _0x2704ee;};'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 5e01857..855b72b 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 _0xd7f0=['#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#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','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','inbound','default','leastrecent','fewestcalls','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','outbound','preview','rrmemory','includes','INTEGER','yes','all','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x5657bb,_0x2f1219){var _0x2a5ecb=function(_0x193add){while(--_0x193add){_0x5657bb['push'](_0x5657bb['shift']());}};_0x2a5ecb(++_0x2f1219);}(_0xd7f0,0xba));var _0x0d7f=function(_0x134afa,_0x797f89){_0x134afa=_0x134afa-0x0;var _0x435337=_0xd7f0[_0x134afa];return _0x435337;};'use strict';var Sequelize=require(_0x0d7f('0x0'));module[_0x0d7f('0x1')]={'name':{'type':Sequelize[_0x0d7f('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x0d7f('0x4')},'musiconhold':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':_0x0d7f('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0d7f('0x3')]('rr','ringall',_0x0d7f('0x6'),_0x0d7f('0x7'),'random','rrmemory',_0x0d7f('0x8'),_0x0d7f('0x9'),_0x0d7f('0xa')),'allowNull':![],'defaultValue':_0x0d7f('0xb'),'set':function(_0x522c64){this[_0x0d7f('0xc')](_0x0d7f('0xd'),_0x522c64?_0x522c64:'rrmemory');},'get':function(){var _0x1869cc=this[_0x0d7f('0xe')](_0x0d7f('0xf'));var _0x63f879=this[_0x0d7f('0xe')]('dialMethod');var _0x4fee09=this[_0x0d7f('0xe')]('strategy');if(_0x1869cc===_0x0d7f('0x10')){if(_0x63f879===_0x0d7f('0x11')){return null;}if(_0x63f879==='booked'&&![_0x0d7f('0x12'),'roundrobin'][_0x0d7f('0x13')](_0x4fee09)){this['setDataValue'](_0x0d7f('0xd'),'rrmemory');}}return _0x4fee09;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0d7f('0x14')](0xb)},'timeout':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x0d7f('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x0d7f('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x0d7f('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0d7f('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0d7f('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0d7f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0d7f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x0d7f('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0d7f('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0d7f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0d7f('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0d7f('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0d7f('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x0d7f('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1e5565){this[_0x0d7f('0xc')](_0x0d7f('0x17'),_0x1e5565?_0x1e5565[_0x0d7f('0x18')](','):[]);},'get':function(){return this['getDataValue'](_0x0d7f('0x17'))?this[_0x0d7f('0xe')]('periodic_announce')[_0x0d7f('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':_0x0d7f('0x15'),'set':function(_0x4c4a81){this['setDataValue'](_0x0d7f('0x1a'),_0x4c4a81?_0x4c4a81[_0x0d7f('0x18')](','):undefined);},'get':function(){return this['getDataValue'](_0x0d7f('0x1a'))?this[_0x0d7f('0xe')](_0x0d7f('0x1a'))[_0x0d7f('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':'no','set':function(_0x1ec921){this[_0x0d7f('0xc')](_0x0d7f('0x1b'),_0x1ec921?_0x1ec921[_0x0d7f('0x18')](','):undefined);},'get':function(){return this[_0x0d7f('0xe')](_0x0d7f('0x1b'))?this[_0x0d7f('0xe')](_0x0d7f('0x1b'))[_0x0d7f('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0d7f('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0d7f('0x2')]},'description':{'type':Sequelize[_0x0d7f('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x544b4e){this[_0x0d7f('0xc')](_0x0d7f('0x1c'),_0x544b4e);if(_0x544b4e){if(this[_0x0d7f('0xe')](_0x0d7f('0x1d'))<0x2){this[_0x0d7f('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0d7f('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':0x0,'comment':_0x0d7f('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x0d7f('0x11'),_0x0d7f('0x20'),_0x0d7f('0x21'),_0x0d7f('0x22'),_0x0d7f('0x23')),'defaultValue':_0x0d7f('0x20'),'comment':_0x0d7f('0x24')},'dialLimitChannel':{'type':Sequelize[_0x0d7f('0x14')](0x4)[_0x0d7f('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x0d7f('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0d7f('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0d7f('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0d7f('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x28'),'dropRate'),'defaultValue':_0x0d7f('0x29'),'comment':_0x0d7f('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0d7f('0x2b')](0x2)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0d7f('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0d7f('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0d7f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0d7f('0x2f'),'comment':_0x0d7f('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x0d7f('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0d7f('0x14')](0x5)[_0x0d7f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0d7f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7f('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0d7f('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0d7f('0x36'),'never',_0x0d7f('0x37')),'defaultValue':_0x0d7f('0x36')},'dialAMDActive':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':0x0,'comment':_0x0d7f('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x0d7f('0x14')](0x9)[_0x0d7f('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0d7f('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x0d7f('0x14')](0x9)[_0x0d7f('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0d7f('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0d7f('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0d7f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d7f('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x0d7f('0x14')](0x9)[_0x0d7f('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0d7f('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0d7f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0d7f('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0d7f('0x14')](0x9)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0d7f('0x14')](0x5)[_0x0d7f('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0d7f('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0d7f('0x14')](0x9)[_0x0d7f('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d7f('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x0d7f('0x14')](0x5)[_0x0d7f('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0d7f('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':0x0,'comment':_0x0d7f('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0d7f('0x3')](_0x0d7f('0x43'),_0x0d7f('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x0d7f('0x2')],'comment':_0x0d7f('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0d7f('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d7f('0x45')},'dialCutDigit':{'type':Sequelize[_0x0d7f('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d7f('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0d7f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7f('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x0d7f('0x14')](0x5)[_0x0d7f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7f('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d7f('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0d7f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7f('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7f('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0d7f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7f('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x0d7f('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c051c){if(!_0x3c051c)this[_0x0d7f('0xc')](_0x0d7f('0x50'),null);this[_0x0d7f('0xc')]('mandatoryDisposition',_0x3c051c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x0d7f('0x14')](0x3)[_0x0d7f('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0d7f('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x0d7f('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x0d7f('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x230a=['wrapuptime','power','predictive','booked','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','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\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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','inbound','outbound','ENUM','ringall','fewestcalls','random','rrmemory','wrandom','setDataValue','strategy','type','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN'];(function(_0x217f7d,_0x480545){var _0x4fb160=function(_0x2c6464){while(--_0x2c6464){_0x217f7d['push'](_0x217f7d['shift']());}};_0x4fb160(++_0x480545);}(_0x230a,0x15a));var _0xa230=function(_0x5b34a7,_0x4a6f65){_0x5b34a7=_0x5b34a7-0x0;var _0x20f2b6=_0x230a[_0x5b34a7];return _0x20f2b6;};'use strict';var Sequelize=require(_0xa230('0x0'));module['exports']={'name':{'type':Sequelize[_0xa230('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xa230('0x2'),_0xa230('0x3')),'allowNull':![],'defaultValue':_0xa230('0x2')},'musiconhold':{'type':Sequelize[_0xa230('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xa230('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa230('0x4')]('rr',_0xa230('0x5'),'leastrecent',_0xa230('0x6'),_0xa230('0x7'),_0xa230('0x8'),'linear',_0xa230('0x9'),'rrordered'),'allowNull':![],'defaultValue':_0xa230('0x5'),'set':function(_0x1f7f70){this[_0xa230('0xa')](_0xa230('0xb'),_0x1f7f70?_0x1f7f70:_0xa230('0x8'));},'get':function(){var _0x1b5f0d=this['getDataValue'](_0xa230('0xc'));var _0x647a80=this[_0xa230('0xd')](_0xa230('0xe'));var _0x1d503d=this[_0xa230('0xd')](_0xa230('0xb'));if(_0x1b5f0d===_0xa230('0x3')){if(_0x647a80===_0xa230('0xf')){return null;}if(_0x647a80==='booked'&&![_0xa230('0x8'),_0xa230('0x10')][_0xa230('0x11')](_0x1d503d)){this[_0xa230('0xa')](_0xa230('0xb'),_0xa230('0x8'));}}return _0x1d503d;}},'servicelevel':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa230('0x12')](0xb)},'timeout':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa230('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no',_0xa230('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa230('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xa230('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa230('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa230('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa230('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa230('0x13'),'no'),'defaultValue':_0xa230('0x13')},'announce_holdtime':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no',_0xa230('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa230('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xa230('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa230('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa230('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa230('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa230('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xa230('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xa230('0x1')]},'queue_less_than':{'type':Sequelize[_0xa230('0x1')]},'periodic_announce':{'type':Sequelize[_0xa230('0x16')],'set':function(_0x32ab37){this[_0xa230('0xa')](_0xa230('0x17'),_0x32ab37?_0x32ab37[_0xa230('0x18')](','):[]);},'get':function(){return this[_0xa230('0xd')](_0xa230('0x17'))?this[_0xa230('0xd')](_0xa230('0x17'))[_0xa230('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xa230('0x1')],'defaultValue':_0xa230('0x13'),'set':function(_0x1f062b){this[_0xa230('0xa')](_0xa230('0x1a'),_0x1f062b?_0x1f062b[_0xa230('0x18')](','):undefined);},'get':function(){return this[_0xa230('0xd')]('joinempty')?this[_0xa230('0xd')](_0xa230('0x1a'))[_0xa230('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x158773){this['setDataValue']('leavewhenempty',_0x158773?_0x158773[_0xa230('0x18')](','):undefined);},'get':function(){return this[_0xa230('0xd')](_0xa230('0x1b'))?this['getDataValue'](_0xa230('0x1b'))[_0xa230('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa230('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa230('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':0x0,'set':function(_0x4ce79d){this[_0xa230('0xa')]('acw',_0x4ce79d);if(_0x4ce79d){if(this[_0xa230('0xd')](_0xa230('0x1d'))<0x2){this[_0xa230('0xa')](_0xa230('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xa230('0xf'),'progressive',_0xa230('0x1e'),_0xa230('0x1f'),_0xa230('0x20')),'defaultValue':_0xa230('0x21'),'comment':_0xa230('0x22')},'dialLimitChannel':{'type':Sequelize[_0xa230('0x12')](0x4)[_0xa230('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xa230('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa230('0x24')},'dialPowerLevel':{'type':Sequelize[_0xa230('0x25')](0x2)[_0xa230('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa230('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xa230('0x4')]('agentBusyFactor',_0xa230('0x27')),'defaultValue':'dropRate','comment':_0xa230('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa230('0x25')](0x2)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa230('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa230('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa230('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x2b')},'dialQueueOptions':{'type':Sequelize[_0xa230('0x1')],'defaultValue':_0xa230('0x2c'),'comment':_0xa230('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa230('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa230('0x30')},'dialTimezone':{'type':Sequelize[_0xa230('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa230('0x1')],'defaultValue':_0xa230('0x31')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x32'),_0xa230('0x33'),'onlyIfOpen'),'defaultValue':_0xa230('0x32')},'dialAMDActive':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':0x0,'comment':_0xa230('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xa230('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa230('0x35')},'dialAMDGreeting':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa230('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa230('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa230('0x37')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa230('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa230('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa230('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xa230('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa230('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa230('0x12')](0x9)[_0xa230('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xa230('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa230('0x4')](_0xa230('0x3c'),'ASC'),'defaultValue':_0xa230('0x3c')},'dialQueueProject2':{'type':Sequelize[_0xa230('0x1')],'comment':_0xa230('0x3d')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa230('0x3e')},'dialCutDigit':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa230('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x41')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa230('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa230('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa230('0x12')](0x5)[_0xa230('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa230('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa230('0x12')],'allowNull':!![],'comment':_0xa230('0x48')},'mandatoryDisposition':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e0058){if(!_0x4e0058)this[_0xa230('0xa')](_0xa230('0x49'),null);this[_0xa230('0xa')](_0xa230('0x4a'),_0x4e0058);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa230('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa230('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa230('0x12')](0x3)[_0xa230('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa230('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 8534c26..87cff03 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 _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x668ef9,_0x217ad4){var _0x4641dc=function(_0x551422){while(--_0x551422){_0x668ef9['push'](_0x668ef9['shift']());}};_0x4641dc(++_0x217ad4);}(_0xe14b,0x93));var _0xbe14=function(_0x44ebfe,_0x5c4d5a){_0x44ebfe=_0x44ebfe-0x0;var _0x48d4b8=_0xe14b[_0x44ebfe];return _0x48d4b8;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file +var _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x2e0f70,_0x18264a){var _0x403ba3=function(_0x3f2f24){while(--_0x3f2f24){_0x2e0f70['push'](_0x2e0f70['shift']());}};_0x403ba3(++_0x18264a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 64a53f5..c3946c9 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 _0xb7a0=['update','remove','emit','hook','exports','VoiceQueue','setMaxListeners','save'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0xb7a0,0x12d));var _0x0b7a=function(_0x59b2ed,_0x122ae1){_0x59b2ed=_0x59b2ed-0x0;var _0x101c29=_0xb7a0[_0x59b2ed];return _0x101c29;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x0b7a('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0b7a('0x1')](0x0);var events={'afterCreate':_0x0b7a('0x2'),'afterUpdate':_0x0b7a('0x3'),'afterDestroy':_0x0b7a('0x4')};function emitEvent(_0x5c5eae){return function(_0x4313f1,_0x1f6f00,_0x58041a){VoiceQueueEvents['emit'](_0x5c5eae+':'+_0x4313f1['id'],_0x4313f1);VoiceQueueEvents[_0x0b7a('0x5')](_0x5c5eae,_0x4313f1);_0x58041a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x0b7a('0x6')](e,emitEvent(event));}}module[_0x0b7a('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xca87=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1d7966,_0x359208){var _0x27bbf7=function(_0x4ea9dc){while(--_0x4ea9dc){_0x1d7966['push'](_0x1d7966['shift']());}};_0x27bbf7(++_0x359208);}(_0xca87,0x165));var _0x7ca8=function(_0x2ac1f2,_0x56819b){_0x2ac1f2=_0x2ac1f2-0x0;var _0x12f64d=_0xca87[_0x2ac1f2];return _0x12f64d;};'use strict';var EventEmitter=require(_0x7ca8('0x0'));var VoiceQueue=require(_0x7ca8('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7ca8('0x2')](0x0);var events={'afterCreate':_0x7ca8('0x3'),'afterUpdate':_0x7ca8('0x4'),'afterDestroy':_0x7ca8('0x5')};function emitEvent(_0x3a3043){return function(_0x57690b,_0x47d889,_0x15b550){VoiceQueueEvents[_0x7ca8('0x6')](_0x3a3043+':'+_0x57690b['id'],_0x57690b);VoiceQueueEvents[_0x7ca8('0x6')](_0x3a3043,_0x57690b);_0x15b550(null);};}for(var e in events){if(events[_0x7ca8('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x7ca8('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 583e1f6..cf23366 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(_0xadf6e1,_0x37aa83){var _0x93d3b3=function(_0x529436){while(--_0x529436){_0xadf6e1['push'](_0xadf6e1['shift']());}};_0x93d3b3(++_0x37aa83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1e8b87,_0x5cbcc0){var _0x178e0f=function(_0x27fd2b){while(--_0x27fd2b){_0x1e8b87['push'](_0x1e8b87['shift']());}};_0x178e0f(++_0x5cbcc0);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ca1ce44..97bdfe7 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 _0x2e1b=['find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','info','ShowVoiceQueue'];(function(_0x4091ae,_0x33008a){var _0x40776d=function(_0x1e4749){while(--_0x1e4749){_0x4091ae['push'](_0x4091ae['shift']());}};_0x40776d(++_0x33008a);}(_0x2e1b,0x19b));var _0xb2e1=function(_0x4fb0ca,_0xfe887b){_0x4fb0ca=_0x4fb0ca-0x0;var _0x152efb=_0x2e1b[_0x4fb0ca];return _0x152efb;};'use strict';var _=require(_0xb2e1('0x0'));var util=require(_0xb2e1('0x1'));var moment=require(_0xb2e1('0x2'));var BPromise=require(_0xb2e1('0x3'));var rs=require(_0xb2e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2e1('0x6'))(_0xb2e1('0x7'));var config=require(_0xb2e1('0x8'));var jayson=require(_0xb2e1('0x9'));var client=jayson[_0xb2e1('0xa')][_0xb2e1('0xb')]({'port':0x232a});config[_0xb2e1('0xc')]=_[_0xb2e1('0xd')](config['redis'],{'host':_0xb2e1('0xe'),'port':0x18eb});var socket=require(_0xb2e1('0xf'))(new Redis(config[_0xb2e1('0xc')]));require('./voiceQueue.socket')[_0xb2e1('0x10')](socket);function respondWithRpcPromise(_0x552d86,_0x19e802,_0x31fc36){return new BPromise(function(_0x2cb5a9,_0x3cefe4){return client['request'](_0x552d86,_0x31fc36)[_0xb2e1('0x11')](function(_0x4cff28){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x19e802,'request\x20sent');logger[_0xb2e1('0x12')](_0xb2e1('0x13'),_0x19e802,_0xb2e1('0x14'),JSON[_0xb2e1('0x15')](_0x4cff28));if(_0x4cff28[_0xb2e1('0x16')]){if(_0x4cff28[_0xb2e1('0x16')][_0xb2e1('0x17')]===0x1f4){logger['error'](_0xb2e1('0x18'),_0x19e802,_0x4cff28[_0xb2e1('0x16')]['message']);return _0x3cefe4(_0x4cff28[_0xb2e1('0x16')]['message']);}logger[_0xb2e1('0x16')](_0xb2e1('0x18'),_0x19e802,_0x4cff28[_0xb2e1('0x16')][_0xb2e1('0x19')]);return _0x2cb5a9(_0x4cff28['error'][_0xb2e1('0x19')]);}else{logger['info'](_0xb2e1('0x18'),_0x19e802,_0xb2e1('0x14'));_0x2cb5a9(_0x4cff28[_0xb2e1('0x1a')][_0xb2e1('0x19')]);}})[_0xb2e1('0x1b')](function(_0x76a517){logger['error'](_0xb2e1('0x18'),_0x19e802,_0x76a517);_0x3cefe4(_0x76a517);});});}exports[_0xb2e1('0x1c')]=function(_0x2dd167){var _0xdd852=this;return new Promise(function(_0x4b8c32,_0x374ea4){return db[_0xb2e1('0x1d')]['findAll']({'raw':_0x2dd167['options']?_0x2dd167[_0xb2e1('0x1e')][_0xb2e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2dd167['options']?_0x2dd167[_0xb2e1('0x1e')][_0xb2e1('0x20')]||null:null,'attributes':_0x2dd167[_0xb2e1('0x1e')]?_0x2dd167[_0xb2e1('0x1e')][_0xb2e1('0x21')]||null:null,'limit':_0x2dd167[_0xb2e1('0x1e')]?_0x2dd167[_0xb2e1('0x1e')][_0xb2e1('0x22')]||null:null,'include':_0x2dd167['options']?_0x2dd167[_0xb2e1('0x1e')][_0xb2e1('0x23')]?_[_0xb2e1('0x24')](_0x2dd167[_0xb2e1('0x1e')][_0xb2e1('0x23')],function(_0x2c96fb){return{'model':db[_0x2c96fb[_0xb2e1('0x25')]],'as':_0x2c96fb['as'],'attributes':_0x2c96fb[_0xb2e1('0x21')],'include':_0x2c96fb[_0xb2e1('0x23')]?_[_0xb2e1('0x24')](_0x2c96fb[_0xb2e1('0x23')],function(_0x3cece9){return{'model':db[_0x3cece9['model']],'as':_0x3cece9['as'],'attributes':_0x3cece9[_0xb2e1('0x21')],'include':_0x3cece9['include']?_['map'](_0x3cece9[_0xb2e1('0x23')],function(_0x59e711){return{'model':db[_0x59e711[_0xb2e1('0x25')]],'as':_0x59e711['as'],'attributes':_0x59e711[_0xb2e1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb2e1('0x11')](function(_0x5d4d5d){logger[_0xb2e1('0x26')](_0xb2e1('0x1c'),_0x2dd167);logger['debug'](_0xb2e1('0x1c'),_0x2dd167,JSON[_0xb2e1('0x15')](_0x5d4d5d));_0x4b8c32(_0x5d4d5d);})[_0xb2e1('0x1b')](function(_0x2a7d54){logger['error'](_0xb2e1('0x1c'),_0x2a7d54['message'],_0x2dd167);_0x374ea4(_0xdd852[_0xb2e1('0x16')](0x1f4,_0x2a7d54[_0xb2e1('0x19')]));});});};exports[_0xb2e1('0x27')]=function(_0x224e51){var _0x2a7796=this;return new Promise(function(_0xa08c5c,_0x37532b){return db['VoiceQueue'][_0xb2e1('0x28')]({'raw':_0x224e51[_0xb2e1('0x1e')]?_0x224e51['options'][_0xb2e1('0x1f')]===undefined?!![]:![]:!![],'where':_0x224e51[_0xb2e1('0x1e')]?_0x224e51[_0xb2e1('0x1e')]['where']||null:null,'attributes':_0x224e51[_0xb2e1('0x1e')]?_0x224e51[_0xb2e1('0x1e')][_0xb2e1('0x21')]||null:null,'include':_0x224e51[_0xb2e1('0x1e')]?_0x224e51[_0xb2e1('0x1e')]['include']?_[_0xb2e1('0x24')](_0x224e51[_0xb2e1('0x1e')]['include'],function(_0x3ddca1){return{'model':db[_0x3ddca1[_0xb2e1('0x25')]],'as':_0x3ddca1['as'],'attributes':_0x3ddca1[_0xb2e1('0x21')],'include':_0x3ddca1[_0xb2e1('0x23')]?_['map'](_0x3ddca1[_0xb2e1('0x23')],function(_0x17dfe2){return{'model':db[_0x17dfe2[_0xb2e1('0x25')]],'as':_0x17dfe2['as'],'attributes':_0x17dfe2[_0xb2e1('0x21')],'include':_0x17dfe2[_0xb2e1('0x23')]?_[_0xb2e1('0x24')](_0x17dfe2[_0xb2e1('0x23')],function(_0x393fdc){return{'model':db[_0x393fdc['model']],'as':_0x393fdc['as'],'attributes':_0x393fdc[_0xb2e1('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb2e1('0x11')](function(_0x3a4f27){logger[_0xb2e1('0x26')](_0xb2e1('0x27'),_0x224e51);logger[_0xb2e1('0x12')]('ShowVoiceQueue',_0x224e51,JSON[_0xb2e1('0x15')](_0x3a4f27));_0xa08c5c(_0x3a4f27);})[_0xb2e1('0x1b')](function(_0x58f125){logger[_0xb2e1('0x16')]('ShowVoiceQueue',_0x58f125[_0xb2e1('0x19')],_0x224e51);_0x37532b(_0x2a7796['error'](0x1f4,_0x58f125[_0xb2e1('0x19')]));});});}; \ No newline at end of file +var _0xa6bc=['localhost','./voiceQueue.socket','register','request','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowVoiceQueue','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x40b92f,_0x39dbb5){var _0x25b785=function(_0x459592){while(--_0x459592){_0x40b92f['push'](_0x40b92f['shift']());}};_0x25b785(++_0x39dbb5);}(_0xa6bc,0x75));var _0xca6b=function(_0x56fd29,_0x17790b){_0x56fd29=_0x56fd29-0x0;var _0x2a0bf7=_0xa6bc[_0x56fd29];return _0x2a0bf7;};'use strict';var _=require(_0xca6b('0x0'));var util=require('util');var moment=require(_0xca6b('0x1'));var BPromise=require(_0xca6b('0x2'));var rs=require(_0xca6b('0x3'));var fs=require('fs');var Redis=require(_0xca6b('0x4'));var db=require(_0xca6b('0x5'))['db'];var utils=require(_0xca6b('0x6'));var logger=require(_0xca6b('0x7'))(_0xca6b('0x8'));var config=require(_0xca6b('0x9'));var jayson=require(_0xca6b('0xa'));var client=jayson[_0xca6b('0xb')][_0xca6b('0xc')]({'port':0x232a});config[_0xca6b('0xd')]=_[_0xca6b('0xe')](config[_0xca6b('0xd')],{'host':_0xca6b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca6b('0xd')]));require(_0xca6b('0x10'))[_0xca6b('0x11')](socket);function respondWithRpcPromise(_0x1b8c73,_0x335a72,_0x1a351d){return new BPromise(function(_0x49ecd0,_0x20b83b){return client[_0xca6b('0x12')](_0x1b8c73,_0x1a351d)['then'](function(_0x2f4f0e){logger[_0xca6b('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x335a72,'request\x20sent');logger[_0xca6b('0x14')](_0xca6b('0x15'),_0x335a72,_0xca6b('0x16'),JSON[_0xca6b('0x17')](_0x2f4f0e));if(_0x2f4f0e[_0xca6b('0x18')]){if(_0x2f4f0e[_0xca6b('0x18')][_0xca6b('0x19')]===0x1f4){logger[_0xca6b('0x18')](_0xca6b('0x1a'),_0x335a72,_0x2f4f0e[_0xca6b('0x18')]['message']);return _0x20b83b(_0x2f4f0e[_0xca6b('0x18')][_0xca6b('0x1b')]);}logger[_0xca6b('0x18')](_0xca6b('0x1a'),_0x335a72,_0x2f4f0e['error']['message']);return _0x49ecd0(_0x2f4f0e[_0xca6b('0x18')][_0xca6b('0x1b')]);}else{logger[_0xca6b('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x335a72,_0xca6b('0x16'));_0x49ecd0(_0x2f4f0e[_0xca6b('0x1c')][_0xca6b('0x1b')]);}})[_0xca6b('0x1d')](function(_0x4ea66e){logger['error'](_0xca6b('0x1a'),_0x335a72,_0x4ea66e);_0x20b83b(_0x4ea66e);});});}exports[_0xca6b('0x1e')]=function(_0x1d6d98){var _0x10b571=this;return new Promise(function(_0x132269,_0x1ba9fe){return db[_0xca6b('0x1f')][_0xca6b('0x20')]({'raw':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x22')]===undefined?!![]:![]:!![],'where':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x23')]||null:null,'attributes':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x24')]||null:null,'limit':_0x1d6d98[_0xca6b('0x21')]?_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x25')]||null:null,'include':_0x1d6d98['options']?_0x1d6d98['options']['include']?_[_0xca6b('0x26')](_0x1d6d98[_0xca6b('0x21')][_0xca6b('0x27')],function(_0x29610d){return{'model':db[_0x29610d['model']],'as':_0x29610d['as'],'attributes':_0x29610d[_0xca6b('0x24')],'include':_0x29610d[_0xca6b('0x27')]?_[_0xca6b('0x26')](_0x29610d[_0xca6b('0x27')],function(_0x3ea0eb){return{'model':db[_0x3ea0eb[_0xca6b('0x28')]],'as':_0x3ea0eb['as'],'attributes':_0x3ea0eb[_0xca6b('0x24')],'include':_0x3ea0eb['include']?_['map'](_0x3ea0eb[_0xca6b('0x27')],function(_0x8a1925){return{'model':db[_0x8a1925[_0xca6b('0x28')]],'as':_0x8a1925['as'],'attributes':_0x8a1925[_0xca6b('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2650df){logger[_0xca6b('0x13')](_0xca6b('0x1e'),_0x1d6d98);logger[_0xca6b('0x14')](_0xca6b('0x1e'),_0x1d6d98,JSON[_0xca6b('0x17')](_0x2650df));_0x132269(_0x2650df);})['catch'](function(_0xdb791){logger[_0xca6b('0x18')](_0xca6b('0x1e'),_0xdb791['message'],_0x1d6d98);_0x1ba9fe(_0x10b571[_0xca6b('0x18')](0x1f4,_0xdb791['message']));});});};exports[_0xca6b('0x29')]=function(_0x32c170){var _0xeca890=this;return new Promise(function(_0x7f8f5,_0x5bc4f8){return db[_0xca6b('0x1f')][_0xca6b('0x2a')]({'raw':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x22')]===undefined?!![]:![]:!![],'where':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x23')]||null:null,'attributes':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x24')]||null:null,'include':_0x32c170[_0xca6b('0x21')]?_0x32c170[_0xca6b('0x21')][_0xca6b('0x27')]?_['map'](_0x32c170[_0xca6b('0x21')][_0xca6b('0x27')],function(_0x23d26a){return{'model':db[_0x23d26a[_0xca6b('0x28')]],'as':_0x23d26a['as'],'attributes':_0x23d26a[_0xca6b('0x24')],'include':_0x23d26a[_0xca6b('0x27')]?_[_0xca6b('0x26')](_0x23d26a[_0xca6b('0x27')],function(_0x3c1d7c){return{'model':db[_0x3c1d7c[_0xca6b('0x28')]],'as':_0x3c1d7c['as'],'attributes':_0x3c1d7c[_0xca6b('0x24')],'include':_0x3c1d7c[_0xca6b('0x27')]?_['map'](_0x3c1d7c[_0xca6b('0x27')],function(_0x4064fd){return{'model':db[_0x4064fd['model']],'as':_0x4064fd['as'],'attributes':_0x4064fd[_0xca6b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xca6b('0x2b')](function(_0x2f9225){logger[_0xca6b('0x13')](_0xca6b('0x29'),_0x32c170);logger['debug']('ShowVoiceQueue',_0x32c170,JSON[_0xca6b('0x17')](_0x2f9225));_0x7f8f5(_0x2f9225);})[_0xca6b('0x1d')](function(_0x3f4f8b){logger[_0xca6b('0x18')](_0xca6b('0x29'),_0x3f4f8b[_0xca6b('0x1b')],_0x32c170);_0x5bc4f8(_0xeca890[_0xca6b('0x18')](0x1f4,_0x3f4f8b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7f10cb6..f9d390d 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 _0x520b=['save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x5377a1,_0x22e1e4){var _0x45ff6f=function(_0x2510d7){while(--_0x2510d7){_0x5377a1['push'](_0x5377a1['shift']());}};_0x45ff6f(++_0x22e1e4);}(_0x520b,0x1c8));var _0xb520=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x520b[_0x277721];return _0x286051;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xb520('0x0'),_0xb520('0x1'),_0xb520('0x2')];function createListener(_0x5296b2,_0xbce8cf){return function(_0x2328b7){_0xbce8cf[_0xb520('0x3')](_0x5296b2,_0x2328b7);};}function removeListener(_0x581cce,_0x23cf26){return function(){VoiceQueueEvents[_0xb520('0x4')](_0x581cce,_0x23cf26);};}exports[_0xb520('0x5')]=function(_0x33e257){for(var _0x2a661e=0x0,_0x2ce21b=events[_0xb520('0x6')];_0x2a661e<_0x2ce21b;_0x2a661e++){var _0x8bfa1e=events[_0x2a661e];var _0x5e36a0=createListener(_0xb520('0x7')+_0x8bfa1e,_0x33e257);VoiceQueueEvents['on'](_0x8bfa1e,_0x5e36a0);}}; \ No newline at end of file +var _0x1668=['register','length','voiceQueue:','./voiceQueue.events','removeListener'];(function(_0x2b2ae0,_0xf2d050){var _0x28a66d=function(_0x20cf45){while(--_0x20cf45){_0x2b2ae0['push'](_0x2b2ae0['shift']());}};_0x28a66d(++_0xf2d050);}(_0x1668,0xee));var _0x8166=function(_0x46f5ea,_0x1af440){_0x46f5ea=_0x46f5ea-0x0;var _0x4ef12d=_0x1668[_0x46f5ea];return _0x4ef12d;};'use strict';var VoiceQueueEvents=require(_0x8166('0x0'));var events=['save','remove','update'];function createListener(_0x49ade5,_0x1c28cc){return function(_0x42cac2){_0x1c28cc['emit'](_0x49ade5,_0x42cac2);};}function removeListener(_0x4ae3e1,_0x40a176){return function(){VoiceQueueEvents[_0x8166('0x1')](_0x4ae3e1,_0x40a176);};}exports[_0x8166('0x2')]=function(_0x2ac9bb){for(var _0x817d9d=0x0,_0x23bc74=events[_0x8166('0x3')];_0x817d9d<_0x23bc74;_0x817d9d++){var _0x385751=events[_0x817d9d];var _0x5ecf7e=createListener(_0x8166('0x4')+_0x385751,_0x2ac9bb);VoiceQueueEvents['on'](_0x385751,_0x5ecf7e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d145a17..67968ab 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 _0x7316=['isAuthenticated','index','/describe','describe','/index','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','Router','./voiceQueueReport.controller','get'];(function(_0x394b9b,_0x581ef4){var _0xdc7e37=function(_0x3f00c4){while(--_0x3f00c4){_0x394b9b['push'](_0x394b9b['shift']());}};_0xdc7e37(++_0x581ef4);}(_0x7316,0xe4));var _0x6731=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x7316[_0x1daaa9];return _0x1dd221;};'use strict';var multer=require(_0x6731('0x0'));var util=require(_0x6731('0x1'));var path=require('path');var timeout=require(_0x6731('0x2'));var express=require('express');var router=express[_0x6731('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(_0x6731('0x4'));router[_0x6731('0x5')]('/',auth[_0x6731('0x6')](),controller[_0x6731('0x7')]);router[_0x6731('0x5')](_0x6731('0x8'),auth['isAuthenticated'](),controller[_0x6731('0x9')]);router[_0x6731('0x5')](_0x6731('0xa'),auth[_0x6731('0x6')](),controller['getVoiceQueuesReport']);router['get'](_0x6731('0xb'),auth[_0x6731('0x6')](),controller[_0x6731('0xc')]);router[_0x6731('0xd')]('/',auth['isAuthenticated'](),controller[_0x6731('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6731('0xf')]);router[_0x6731('0x10')](_0x6731('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6731('0x11')]=router; \ No newline at end of file +var _0xcfa7=['destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/index','/:id','show','post','create','put','update','delete'];(function(_0x563d85,_0x5164ec){var _0x128f7f=function(_0x529ba2){while(--_0x529ba2){_0x563d85['push'](_0x563d85['shift']());}};_0x128f7f(++_0x5164ec);}(_0xcfa7,0xdd));var _0x7cfa=function(_0x5a49ae,_0x1f6582){_0x5a49ae=_0x5a49ae-0x0;var _0x225918=_0xcfa7[_0x5a49ae];return _0x225918;};'use strict';var multer=require(_0x7cfa('0x0'));var util=require(_0x7cfa('0x1'));var path=require(_0x7cfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7cfa('0x4'));var interaction=require(_0x7cfa('0x5'));var config=require(_0x7cfa('0x6'));var controller=require(_0x7cfa('0x7'));router[_0x7cfa('0x8')]('/',auth[_0x7cfa('0x9')](),controller[_0x7cfa('0xa')]);router[_0x7cfa('0x8')]('/describe',auth[_0x7cfa('0x9')](),controller['describe']);router[_0x7cfa('0x8')](_0x7cfa('0xb'),auth[_0x7cfa('0x9')](),controller['getVoiceQueuesReport']);router['get'](_0x7cfa('0xc'),auth[_0x7cfa('0x9')](),controller[_0x7cfa('0xd')]);router[_0x7cfa('0xe')]('/',auth[_0x7cfa('0x9')](),controller[_0x7cfa('0xf')]);router[_0x7cfa('0x10')](_0x7cfa('0xc'),auth[_0x7cfa('0x9')](),controller[_0x7cfa('0x11')]);router[_0x7cfa('0x12')](_0x7cfa('0xc'),auth['isAuthenticated'](),controller[_0x7cfa('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 0251157..8dedb32 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 _0x663f=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x5ad3f1,_0x28729c){var _0x31595b=function(_0x2b2dc0){while(--_0x2b2dc0){_0x5ad3f1['push'](_0x5ad3f1['shift']());}};_0x31595b(++_0x28729c);}(_0x663f,0xf0));var _0xf663=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x663f[_0x5581ba];return _0x1e927f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf663('0x0'));module[_0xf663('0x1')]={'type':{'type':Sequelize[_0xf663('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf663('0x2')]},'calleridname':{'type':Sequelize[_0xf663('0x2')]},'queue':{'type':Sequelize[_0xf663('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xf663('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x21cf96){var _0x3f47fd=moment(_0x21cf96);var _0x5e6fe2=moment(this[_0xf663('0x4')](_0xf663('0x5')))['format'](_0xf663('0x6'));var _0x4bdc96=_0x3f47fd[_0xf663('0x7')](_0x5e6fe2,_0xf663('0x8'));this[_0xf663('0x9')](_0xf663('0xa'),_0x21cf96);this[_0xf663('0x9')](_0xf663('0xb'),_0x4bdc96||null);}},'position':{'type':Sequelize[_0xf663('0xc')]},'count':{'type':Sequelize[_0xf663('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xf663('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xf663('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf663('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xf663('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xf663('0x2')],'comment':_0xf663('0xe')},'originalposition':{'type':Sequelize[_0xf663('0xc')]},'channel':{'type':Sequelize[_0xf663('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf663('0x2')]},'exten':{'type':Sequelize[_0xf663('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf663('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf663('0x2')]},'transfer':{'type':Sequelize[_0xf663('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf663('0x2')],'comment':_0xf663('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xf663('0x2')]},'disposition':{'type':Sequelize[_0xf663('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf663('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xf663('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0xf663('0x2')]}}; \ No newline at end of file +var _0x2440=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x770601,_0x5af16a){var _0x37632c=function(_0x4f1476){while(--_0x4f1476){_0x770601['push'](_0x770601['shift']());}};_0x37632c(++_0x5af16a);}(_0x2440,0x9b));var _0x0244=function(_0x46909b,_0xb8582e){_0x46909b=_0x46909b-0x0;var _0x6d3521=_0x2440[_0x46909b];return _0x6d3521;};'use strict';var Sequelize=require(_0x0244('0x0'));var moment=require(_0x0244('0x1'));module[_0x0244('0x2')]={'type':{'type':Sequelize[_0x0244('0x3')]},'uniqueid':{'type':Sequelize[_0x0244('0x3')]},'calleridnum':{'type':Sequelize[_0x0244('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0244('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0244('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0244('0x4')],'set':function(_0x26903e){var _0x365be5=moment(_0x26903e);var _0x338633=moment(this[_0x0244('0x5')](_0x0244('0x6')))[_0x0244('0x7')](_0x0244('0x8'));var _0x3b0ec4=_0x365be5[_0x0244('0x9')](_0x338633,_0x0244('0xa'));this[_0x0244('0xb')](_0x0244('0xc'),_0x26903e);this[_0x0244('0xb')](_0x0244('0xd'),_0x3b0ec4||null);}},'position':{'type':Sequelize[_0x0244('0xe')]},'count':{'type':Sequelize[_0x0244('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0244('0x4')]},'queuecallerexit':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0244('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0244('0x3')],'comment':_0x0244('0x10')},'originalposition':{'type':Sequelize[_0x0244('0xe')]},'channel':{'type':Sequelize[_0x0244('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0244('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0244('0x3')]},'context':{'type':Sequelize[_0x0244('0x3')]},'exten':{'type':Sequelize[_0x0244('0x3')]},'priority':{'type':Sequelize[_0x0244('0x3')]},'holdtime':{'type':Sequelize[_0x0244('0xe')]},'mohtime':{'type':Sequelize[_0x0244('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0244('0x3')]},'transfer':{'type':Sequelize[_0x0244('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0244('0x3')],'comment':_0x0244('0x11')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x0244('0x3')]},'disposition':{'type':Sequelize[_0x0244('0x3')]},'secondDisposition':{'type':Sequelize[_0x0244('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x0244('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index f3ff5b5..5ffa3d5 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 _0x68dd=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','VoiceQueueReport','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x46dfda,_0x31a106){var _0x86d52=function(_0x4de4f0){while(--_0x4de4f0){_0x46dfda['push'](_0x46dfda['shift']());}};_0x86d52(++_0x31a106);}(_0x68dd,0xa0));var _0xd68d=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x68dd[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd68d('0x0'));var zipdir=require(_0xd68d('0x1'));var jsonpatch=require(_0xd68d('0x2'));var rp=require(_0xd68d('0x3'));var moment=require(_0xd68d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd68d('0x5'));var util=require(_0xd68d('0x6'));var path=require(_0xd68d('0x7'));var sox=require(_0xd68d('0x8'));var csv=require(_0xd68d('0x9'));var ejs=require(_0xd68d('0xa'));var fs=require('fs');var fs_extra=require(_0xd68d('0xb'));var _=require('lodash');var squel=require(_0xd68d('0xc'));var crypto=require('crypto');var jsforce=require(_0xd68d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd68d('0xe'));var Papa=require(_0xd68d('0xf'));var Redis=require(_0xd68d('0x10'));var authService=require(_0xd68d('0x11'));var qs=require(_0xd68d('0x12'));var as=require(_0xd68d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd68d('0x14'))(_0xd68d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd68d('0x16'))['db'];config['redis']=_[_0xd68d('0x17')](config[_0xd68d('0x18')],{'host':_0xd68d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd68d('0x18')]));require(_0xd68d('0x1a'))[_0xd68d('0x1b')](socket);function respondWithStatusCode(_0x2e46c1,_0x1b69ba){_0x1b69ba=_0x1b69ba||0xcc;return function(_0x347b1e){if(_0x347b1e){return _0x2e46c1[_0xd68d('0x1c')](_0x1b69ba);}return _0x2e46c1[_0xd68d('0x1d')](_0x1b69ba)[_0xd68d('0x1e')]();};}function respondWithResult(_0xec211c,_0x166d07){_0x166d07=_0x166d07||0xc8;return function(_0x58408e){if(_0x58408e){return _0xec211c['status'](_0x166d07)[_0xd68d('0x1f')](_0x58408e);}};}function respondWithFilteredResult(_0x349ab9,_0x41a13b){return function(_0x4894e5){if(_0x4894e5){var _0x3db67f=typeof _0x41a13b[_0xd68d('0x20')]===_0xd68d('0x21')&&typeof _0x41a13b[_0xd68d('0x22')]===_0xd68d('0x21');var _0x58668e=_0x4894e5[_0xd68d('0x23')];var _0x3d3cf3=_0x3db67f?0x0:_0x41a13b['offset'];var _0x292a76=_0x3db67f?_0x4894e5[_0xd68d('0x23')]:_0x41a13b[_0xd68d('0x20')]+_0x41a13b[_0xd68d('0x22')];var _0x51b08a;if(_0x292a76>=_0x58668e){_0x292a76=_0x58668e;_0x51b08a=0xc8;}else{_0x51b08a=0xce;}_0x349ab9[_0xd68d('0x1d')](_0x51b08a);return _0x349ab9[_0xd68d('0x24')](_0xd68d('0x25'),_0x3d3cf3+'-'+_0x292a76+'/'+_0x58668e)['json'](_0x4894e5);}return null;};}function patchUpdates(_0xb3ded3){return function(_0x4eb120){try{jsonpatch['apply'](_0x4eb120,_0xb3ded3,!![]);}catch(_0x833418){return BPromise[_0xd68d('0x26')](_0x833418);}return _0x4eb120[_0xd68d('0x27')]();};}function saveUpdates(_0x29aae0,_0x1fdbbb){return function(_0x5d14c4){if(_0x5d14c4){return _0x5d14c4[_0xd68d('0x28')](_0x29aae0)['then'](function(_0x54ec72){return _0x54ec72;});}return null;};}function removeEntity(_0x13a2fe,_0x5b2c58){return function(_0x3031d3){if(_0x3031d3){return _0x3031d3[_0xd68d('0x29')]()[_0xd68d('0x2a')](function(){_0x13a2fe[_0xd68d('0x1d')](0xcc)[_0xd68d('0x1e')]();});}};}function handleEntityNotFound(_0x5016e3,_0x19b00c){return function(_0x126991){if(!_0x126991){_0x5016e3['sendStatus'](0x194);}return _0x126991;};}function handleError(_0x3741f5,_0x196399){_0x196399=_0x196399||0x1f4;return function(_0x3249c7){logger['error'](_0x3249c7[_0xd68d('0x2b')]);if(_0x3249c7[_0xd68d('0x2c')]){delete _0x3249c7[_0xd68d('0x2c')];}_0x3741f5[_0xd68d('0x1d')](_0x196399)[_0xd68d('0x2d')](_0x3249c7);};}exports[_0xd68d('0x2e')]=function(_0x11ef22,_0x78da2c){var _0x554254={},_0x3b69f4={},_0x1947b8={'count':0x0,'rows':[]};var _0xbbf6c6=_[_0xd68d('0x2f')](db['VoiceQueueReport'][_0xd68d('0x30')],function(_0x4f265e){return{'name':_0x4f265e[_0xd68d('0x31')],'type':_0x4f265e[_0xd68d('0x32')]['key']};});_0x3b69f4[_0xd68d('0x33')]=_[_0xd68d('0x2f')](_0xbbf6c6,'name');_0x3b69f4[_0xd68d('0x34')]=_[_0xd68d('0x35')](_0x11ef22[_0xd68d('0x34')]);_0x3b69f4[_0xd68d('0x36')]=_[_0xd68d('0x37')](_0x3b69f4[_0xd68d('0x33')],_0x3b69f4['query']);_0x554254[_0xd68d('0x38')]=_[_0xd68d('0x37')](_0x3b69f4['model'],qs[_0xd68d('0x39')](_0x11ef22[_0xd68d('0x34')][_0xd68d('0x39')]));_0x554254[_0xd68d('0x38')]=_0x554254[_0xd68d('0x38')][_0xd68d('0x3a')]?_0x554254['attributes']:_0x3b69f4[_0xd68d('0x33')];if(!_0x11ef22['query'][_0xd68d('0x3b')](_0xd68d('0x3c'))){_0x554254[_0xd68d('0x22')]=qs[_0xd68d('0x22')](_0x11ef22['query'][_0xd68d('0x22')]);_0x554254[_0xd68d('0x20')]=qs[_0xd68d('0x20')](_0x11ef22[_0xd68d('0x34')][_0xd68d('0x20')]);}_0x554254[_0xd68d('0x3d')]=qs[_0xd68d('0x3e')](_0x11ef22['query'][_0xd68d('0x3e')]);_0x554254['where']=qs[_0xd68d('0x36')](_[_0xd68d('0x3f')](_0x11ef22['query'],_0x3b69f4[_0xd68d('0x36')]),_0xbbf6c6);if(_0x11ef22['query']['filter']){_0x554254['where']=_[_0xd68d('0x40')](_0x554254[_0xd68d('0x41')],{'$or':_[_0xd68d('0x2f')](_0xbbf6c6,function(_0x41ac81){if(_0x41ac81[_0xd68d('0x32')]!==_0xd68d('0x42')){var _0x2104b5={};_0x2104b5[_0x41ac81[_0xd68d('0x2c')]]={'$like':'%'+_0x11ef22[_0xd68d('0x34')][_0xd68d('0x43')]+'%'};return _0x2104b5;}})});}_0x554254=_['merge']({},_0x554254,_0x11ef22['options']);var _0x17eb45={'where':_0x554254[_0xd68d('0x41')]};return db[_0xd68d('0x44')][_0xd68d('0x23')](_0x17eb45)[_0xd68d('0x2a')](function(_0x4d519c){_0x1947b8[_0xd68d('0x23')]=_0x4d519c;if(_0x11ef22[_0xd68d('0x34')][_0xd68d('0x45')]){_0x554254['include']=[{'all':!![]}];}return db[_0xd68d('0x44')][_0xd68d('0x46')](_0x554254);})[_0xd68d('0x2a')](function(_0x500860){_0x1947b8[_0xd68d('0x47')]=_0x500860;return _0x1947b8;})[_0xd68d('0x2a')](respondWithFilteredResult(_0x78da2c,_0x554254))[_0xd68d('0x48')](handleError(_0x78da2c,null));};exports[_0xd68d('0x49')]=function(_0x4eaa4b,_0x5e12af){var _0x31f1c9={'raw':![],'where':{'id':_0x4eaa4b[_0xd68d('0x4a')]['id']}},_0xab54a9={};_0xab54a9[_0xd68d('0x33')]=_['keys'](db[_0xd68d('0x44')]['rawAttributes']);_0xab54a9[_0xd68d('0x34')]=_['keys'](_0x4eaa4b[_0xd68d('0x34')]);_0xab54a9[_0xd68d('0x36')]=_[_0xd68d('0x37')](_0xab54a9[_0xd68d('0x33')],_0xab54a9['query']);_0x31f1c9['attributes']=_[_0xd68d('0x37')](_0xab54a9[_0xd68d('0x33')],qs[_0xd68d('0x39')](_0x4eaa4b[_0xd68d('0x34')][_0xd68d('0x39')]));_0x31f1c9['attributes']=_0x31f1c9[_0xd68d('0x38')][_0xd68d('0x3a')]?_0x31f1c9['attributes']:_0xab54a9['model'];if(_0x4eaa4b[_0xd68d('0x34')][_0xd68d('0x45')]){_0x31f1c9[_0xd68d('0x4b')]=[{'all':!![]}];}_0x31f1c9=_['merge']({},_0x31f1c9,_0x4eaa4b[_0xd68d('0x4c')]);return db['VoiceQueueReport'][_0xd68d('0x4d')](_0x31f1c9)[_0xd68d('0x2a')](handleEntityNotFound(_0x5e12af,null))[_0xd68d('0x2a')](respondWithResult(_0x5e12af,null))[_0xd68d('0x48')](handleError(_0x5e12af,null));};exports[_0xd68d('0x4e')]=function(_0x2298f1,_0x15eb79){return db[_0xd68d('0x44')][_0xd68d('0x4e')](_0x2298f1[_0xd68d('0x4f')],{})[_0xd68d('0x2a')](respondWithResult(_0x15eb79,0xc9))[_0xd68d('0x48')](handleError(_0x15eb79,null));};exports['update']=function(_0x438342,_0x27bb76){if(_0x438342[_0xd68d('0x4f')]['id']){delete _0x438342[_0xd68d('0x4f')]['id'];}return db[_0xd68d('0x44')][_0xd68d('0x4d')]({'where':{'id':_0x438342['params']['id']}})[_0xd68d('0x2a')](handleEntityNotFound(_0x27bb76,null))[_0xd68d('0x2a')](saveUpdates(_0x438342[_0xd68d('0x4f')],null))[_0xd68d('0x2a')](respondWithResult(_0x27bb76,null))[_0xd68d('0x48')](handleError(_0x27bb76,null));};exports[_0xd68d('0x29')]=function(_0x21ed04,_0x5e1ecc){return db[_0xd68d('0x44')]['find']({'where':{'id':_0x21ed04[_0xd68d('0x4a')]['id']}})[_0xd68d('0x2a')](handleEntityNotFound(_0x5e1ecc,null))[_0xd68d('0x2a')](removeEntity(_0x5e1ecc,null))[_0xd68d('0x48')](handleError(_0x5e1ecc,null));};exports[_0xd68d('0x50')]=function(_0x3161ff,_0x23881e){return db[_0xd68d('0x44')]['describe']()[_0xd68d('0x2a')](respondWithResult(_0x23881e,null))['catch'](handleError(_0x23881e,null));};exports['getVoiceQueuesReport']=function(_0x1351c0,_0x2c7ea5){var _0x58ceb6={},_0x2b8d0e={},_0x3bff27={'count':0x0,'rows':[]};_0x2b8d0e[_0xd68d('0x33')]=_[_0xd68d('0x35')](db[_0xd68d('0x44')][_0xd68d('0x30')]);_0x2b8d0e[_0xd68d('0x34')]=_[_0xd68d('0x35')](_0x1351c0['query']);_0x2b8d0e[_0xd68d('0x36')]=_[_0xd68d('0x37')](_0x2b8d0e[_0xd68d('0x33')],_0x2b8d0e[_0xd68d('0x34')]);_0x58ceb6[_0xd68d('0x38')]=_['intersection'](_0x2b8d0e['model'],qs[_0xd68d('0x39')](_0x1351c0[_0xd68d('0x34')][_0xd68d('0x39')]));_0x58ceb6['attributes']=_0x58ceb6[_0xd68d('0x38')][_0xd68d('0x3a')]?_0x58ceb6[_0xd68d('0x38')]:_0x2b8d0e['model'];if(!_0x1351c0[_0xd68d('0x34')]['hasOwnProperty']('nolimit')){_0x58ceb6[_0xd68d('0x22')]=qs[_0xd68d('0x22')](_0x1351c0[_0xd68d('0x34')][_0xd68d('0x22')]);_0x58ceb6['offset']=qs[_0xd68d('0x20')](_0x1351c0[_0xd68d('0x34')][_0xd68d('0x20')]);}_0x58ceb6['order']=qs[_0xd68d('0x3e')](_0x1351c0[_0xd68d('0x34')]['sort']);_0x58ceb6[_0xd68d('0x41')]=qs['filters'](_[_0xd68d('0x3f')](_0x1351c0[_0xd68d('0x34')],_0x2b8d0e[_0xd68d('0x36')]));if(_0x1351c0[_0xd68d('0x34')][_0xd68d('0x43')]){_0x58ceb6[_0xd68d('0x41')]=_[_0xd68d('0x40')](_0x58ceb6[_0xd68d('0x41')],{'$or':_[_0xd68d('0x2f')](_0x58ceb6['attributes'],function(_0x380559){var _0x4c1cda={};_0x4c1cda[_0x380559]={'$like':'%'+_0x1351c0[_0xd68d('0x34')]['filter']+'%'};return _0x4c1cda;})});}_0x58ceb6=_[_0xd68d('0x40')]({},_0x58ceb6,_0x1351c0[_0xd68d('0x4c')]);var _0x49b73f={'where':_0x58ceb6[_0xd68d('0x41')]};return db[_0xd68d('0x44')][_0xd68d('0x23')](_0x49b73f)['then'](function(_0x194df7){_0x3bff27['count']=_0x194df7;if(_0x1351c0[_0xd68d('0x34')][_0xd68d('0x45')]){_0x58ceb6[_0xd68d('0x4b')]=[{'all':!![]}];}return db[_0xd68d('0x44')][_0xd68d('0x46')](_0x58ceb6);})[_0xd68d('0x2a')](function(_0x4ada29){_0x3bff27['rows']=_0x4ada29;return _0x3bff27;})['then'](respondWithFilteredResult(_0x2c7ea5,_0x58ceb6,'getVoiceQueuesReport'))[_0xd68d('0x48')](handleError(_0x2c7ea5,null,_0xd68d('0x51')));}; \ No newline at end of file +var _0xd31f=['VoiceQueueReport','findAll','rows','show','params','keys','length','include','find','catch','create','update','body','describe','getVoiceQueuesReport','rawAttributes','order','pick','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','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','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll'];(function(_0x5755ff,_0x4ba487){var _0xd361ad=function(_0x34ba60){while(--_0x34ba60){_0x5755ff['push'](_0x5755ff['shift']());}};_0xd361ad(++_0x4ba487);}(_0xd31f,0x1a7));var _0xfd31=function(_0x9b243d,_0x344c5d){_0x9b243d=_0x9b243d-0x0;var _0x375c79=_0xd31f[_0x9b243d];return _0x375c79;};'use strict';var emlformat=require(_0xfd31('0x0'));var rimraf=require(_0xfd31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfd31('0x2'));var moment=require('moment');var BPromise=require(_0xfd31('0x3'));var Mustache=require(_0xfd31('0x4'));var util=require('util');var path=require(_0xfd31('0x5'));var sox=require(_0xfd31('0x6'));var csv=require(_0xfd31('0x7'));var ejs=require(_0xfd31('0x8'));var fs=require('fs');var fs_extra=require(_0xfd31('0x9'));var _=require(_0xfd31('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfd31('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfd31('0xc'));var Papa=require(_0xfd31('0xd'));var Redis=require(_0xfd31('0xe'));var authService=require(_0xfd31('0xf'));var qs=require(_0xfd31('0x10'));var as=require(_0xfd31('0x11'));var hardwareService=require(_0xfd31('0x12'));var logger=require(_0xfd31('0x13'))('api');var utils=require(_0xfd31('0x14'));var config=require(_0xfd31('0x15'));var licenseUtil=require(_0xfd31('0x16'));var db=require('../../mysqldb')['db'];config[_0xfd31('0x17')]=_[_0xfd31('0x18')](config[_0xfd31('0x17')],{'host':_0xfd31('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd31('0x17')]));require(_0xfd31('0x1a'))[_0xfd31('0x1b')](socket);function respondWithStatusCode(_0x3a8f34,_0x1668f7){_0x1668f7=_0x1668f7||0xcc;return function(_0x48a4b3){if(_0x48a4b3){return _0x3a8f34[_0xfd31('0x1c')](_0x1668f7);}return _0x3a8f34[_0xfd31('0x1d')](_0x1668f7)[_0xfd31('0x1e')]();};}function respondWithResult(_0x1c4fa3,_0xb024f7){_0xb024f7=_0xb024f7||0xc8;return function(_0x1fc256){if(_0x1fc256){return _0x1c4fa3['status'](_0xb024f7)[_0xfd31('0x1f')](_0x1fc256);}};}function respondWithFilteredResult(_0x244e4a,_0x499cd6){return function(_0x28c628){if(_0x28c628){var _0x248151=typeof _0x499cd6[_0xfd31('0x20')]===_0xfd31('0x21')&&typeof _0x499cd6[_0xfd31('0x22')]==='undefined';var _0x2e46d3=_0x28c628[_0xfd31('0x23')];var _0x4e77da=_0x248151?0x0:_0x499cd6['offset'];var _0x98b8df=_0x248151?_0x28c628[_0xfd31('0x23')]:_0x499cd6[_0xfd31('0x20')]+_0x499cd6[_0xfd31('0x22')];var _0x172584;if(_0x98b8df>=_0x2e46d3){_0x98b8df=_0x2e46d3;_0x172584=0xc8;}else{_0x172584=0xce;}_0x244e4a[_0xfd31('0x1d')](_0x172584);return _0x244e4a['set'](_0xfd31('0x24'),_0x4e77da+'-'+_0x98b8df+'/'+_0x2e46d3)['json'](_0x28c628);}return null;};}function patchUpdates(_0x5c5769){return function(_0xb471c8){try{jsonpatch['apply'](_0xb471c8,_0x5c5769,!![]);}catch(_0x3b08a4){return BPromise[_0xfd31('0x25')](_0x3b08a4);}return _0xb471c8['save']();};}function saveUpdates(_0x371a38,_0x2ae6bd){return function(_0xa8ce72){if(_0xa8ce72){return _0xa8ce72['update'](_0x371a38)[_0xfd31('0x26')](function(_0x482c5a){return _0x482c5a;});}return null;};}function removeEntity(_0x59004c,_0x32e9c9){return function(_0x241f29){if(_0x241f29){return _0x241f29[_0xfd31('0x27')]()[_0xfd31('0x26')](function(){_0x59004c[_0xfd31('0x1d')](0xcc)[_0xfd31('0x1e')]();});}};}function handleEntityNotFound(_0x1747ba,_0xda5c81){return function(_0x44ef08){if(!_0x44ef08){_0x1747ba[_0xfd31('0x1c')](0x194);}return _0x44ef08;};}function handleError(_0xd88041,_0x43abe6){_0x43abe6=_0x43abe6||0x1f4;return function(_0x4421cf){logger[_0xfd31('0x28')](_0x4421cf['stack']);if(_0x4421cf[_0xfd31('0x29')]){delete _0x4421cf[_0xfd31('0x29')];}_0xd88041[_0xfd31('0x1d')](_0x43abe6)[_0xfd31('0x2a')](_0x4421cf);};}exports[_0xfd31('0x2b')]=function(_0x54ceef,_0x501f77){var _0x2a8815={},_0x2c0b54={},_0x11956c={'count':0x0,'rows':[]};var _0x3f1a1f=_[_0xfd31('0x2c')](db['VoiceQueueReport']['rawAttributes'],function(_0x511ce9){return{'name':_0x511ce9[_0xfd31('0x2d')],'type':_0x511ce9[_0xfd31('0x2e')][_0xfd31('0x2f')]};});_0x2c0b54[_0xfd31('0x30')]=_[_0xfd31('0x2c')](_0x3f1a1f,_0xfd31('0x29'));_0x2c0b54['query']=_['keys'](_0x54ceef[_0xfd31('0x31')]);_0x2c0b54[_0xfd31('0x32')]=_[_0xfd31('0x33')](_0x2c0b54[_0xfd31('0x30')],_0x2c0b54[_0xfd31('0x31')]);_0x2a8815[_0xfd31('0x34')]=_['intersection'](_0x2c0b54['model'],qs[_0xfd31('0x35')](_0x54ceef[_0xfd31('0x31')]['fields']));_0x2a8815[_0xfd31('0x34')]=_0x2a8815[_0xfd31('0x34')]['length']?_0x2a8815[_0xfd31('0x34')]:_0x2c0b54[_0xfd31('0x30')];if(!_0x54ceef[_0xfd31('0x31')][_0xfd31('0x36')](_0xfd31('0x37'))){_0x2a8815['limit']=qs[_0xfd31('0x22')](_0x54ceef[_0xfd31('0x31')]['limit']);_0x2a8815['offset']=qs[_0xfd31('0x20')](_0x54ceef['query']['offset']);}_0x2a8815['order']=qs[_0xfd31('0x38')](_0x54ceef[_0xfd31('0x31')]['sort']);_0x2a8815[_0xfd31('0x39')]=qs[_0xfd31('0x32')](_['pick'](_0x54ceef[_0xfd31('0x31')],_0x2c0b54[_0xfd31('0x32')]),_0x3f1a1f);if(_0x54ceef[_0xfd31('0x31')][_0xfd31('0x3a')]){_0x2a8815['where']=_[_0xfd31('0x3b')](_0x2a8815[_0xfd31('0x39')],{'$or':_['map'](_0x3f1a1f,function(_0x6cdb6){if(_0x6cdb6['type']!==_0xfd31('0x3c')){var _0x5399c2={};_0x5399c2[_0x6cdb6[_0xfd31('0x29')]]={'$like':'%'+_0x54ceef[_0xfd31('0x31')][_0xfd31('0x3a')]+'%'};return _0x5399c2;}})});}_0x2a8815=_[_0xfd31('0x3b')]({},_0x2a8815,_0x54ceef[_0xfd31('0x3d')]);var _0x3074df={'where':_0x2a8815[_0xfd31('0x39')]};return db['VoiceQueueReport'][_0xfd31('0x23')](_0x3074df)[_0xfd31('0x26')](function(_0x44a5b5){_0x11956c[_0xfd31('0x23')]=_0x44a5b5;if(_0x54ceef[_0xfd31('0x31')][_0xfd31('0x3e')]){_0x2a8815['include']=[{'all':!![]}];}return db[_0xfd31('0x3f')][_0xfd31('0x40')](_0x2a8815);})['then'](function(_0x22b219){_0x11956c[_0xfd31('0x41')]=_0x22b219;return _0x11956c;})[_0xfd31('0x26')](respondWithFilteredResult(_0x501f77,_0x2a8815))['catch'](handleError(_0x501f77,null));};exports[_0xfd31('0x42')]=function(_0x4ece61,_0x4c1524){var _0x10a979={'raw':![],'where':{'id':_0x4ece61[_0xfd31('0x43')]['id']}},_0x56b43c={};_0x56b43c['model']=_[_0xfd31('0x44')](db[_0xfd31('0x3f')]['rawAttributes']);_0x56b43c[_0xfd31('0x31')]=_[_0xfd31('0x44')](_0x4ece61['query']);_0x56b43c['filters']=_['intersection'](_0x56b43c['model'],_0x56b43c[_0xfd31('0x31')]);_0x10a979[_0xfd31('0x34')]=_[_0xfd31('0x33')](_0x56b43c[_0xfd31('0x30')],qs[_0xfd31('0x35')](_0x4ece61[_0xfd31('0x31')]['fields']));_0x10a979[_0xfd31('0x34')]=_0x10a979['attributes'][_0xfd31('0x45')]?_0x10a979[_0xfd31('0x34')]:_0x56b43c[_0xfd31('0x30')];if(_0x4ece61[_0xfd31('0x31')]['includeAll']){_0x10a979[_0xfd31('0x46')]=[{'all':!![]}];}_0x10a979=_[_0xfd31('0x3b')]({},_0x10a979,_0x4ece61['options']);return db[_0xfd31('0x3f')][_0xfd31('0x47')](_0x10a979)[_0xfd31('0x26')](handleEntityNotFound(_0x4c1524,null))[_0xfd31('0x26')](respondWithResult(_0x4c1524,null))[_0xfd31('0x48')](handleError(_0x4c1524,null));};exports[_0xfd31('0x49')]=function(_0x394a06,_0x1a7ce2){return db[_0xfd31('0x3f')][_0xfd31('0x49')](_0x394a06['body'],{})['then'](respondWithResult(_0x1a7ce2,0xc9))[_0xfd31('0x48')](handleError(_0x1a7ce2,null));};exports[_0xfd31('0x4a')]=function(_0x1f43c5,_0x58f98c){if(_0x1f43c5[_0xfd31('0x4b')]['id']){delete _0x1f43c5[_0xfd31('0x4b')]['id'];}return db[_0xfd31('0x3f')][_0xfd31('0x47')]({'where':{'id':_0x1f43c5[_0xfd31('0x43')]['id']}})['then'](handleEntityNotFound(_0x58f98c,null))[_0xfd31('0x26')](saveUpdates(_0x1f43c5[_0xfd31('0x4b')],null))['then'](respondWithResult(_0x58f98c,null))[_0xfd31('0x48')](handleError(_0x58f98c,null));};exports['destroy']=function(_0x45acea,_0x50e0c7){return db[_0xfd31('0x3f')][_0xfd31('0x47')]({'where':{'id':_0x45acea['params']['id']}})[_0xfd31('0x26')](handleEntityNotFound(_0x50e0c7,null))[_0xfd31('0x26')](removeEntity(_0x50e0c7,null))['catch'](handleError(_0x50e0c7,null));};exports[_0xfd31('0x4c')]=function(_0x31d735,_0x4126d8){return db['VoiceQueueReport'][_0xfd31('0x4c')]()[_0xfd31('0x26')](respondWithResult(_0x4126d8,null))[_0xfd31('0x48')](handleError(_0x4126d8,null));};exports[_0xfd31('0x4d')]=function(_0x561ab3,_0x4e430e){var _0x8f17fb={},_0x5b4c79={},_0x565b2d={'count':0x0,'rows':[]};_0x5b4c79[_0xfd31('0x30')]=_[_0xfd31('0x44')](db[_0xfd31('0x3f')][_0xfd31('0x4e')]);_0x5b4c79[_0xfd31('0x31')]=_[_0xfd31('0x44')](_0x561ab3['query']);_0x5b4c79['filters']=_['intersection'](_0x5b4c79['model'],_0x5b4c79[_0xfd31('0x31')]);_0x8f17fb[_0xfd31('0x34')]=_['intersection'](_0x5b4c79[_0xfd31('0x30')],qs[_0xfd31('0x35')](_0x561ab3[_0xfd31('0x31')][_0xfd31('0x35')]));_0x8f17fb[_0xfd31('0x34')]=_0x8f17fb['attributes'][_0xfd31('0x45')]?_0x8f17fb[_0xfd31('0x34')]:_0x5b4c79[_0xfd31('0x30')];if(!_0x561ab3[_0xfd31('0x31')]['hasOwnProperty'](_0xfd31('0x37'))){_0x8f17fb[_0xfd31('0x22')]=qs['limit'](_0x561ab3[_0xfd31('0x31')][_0xfd31('0x22')]);_0x8f17fb[_0xfd31('0x20')]=qs[_0xfd31('0x20')](_0x561ab3[_0xfd31('0x31')][_0xfd31('0x20')]);}_0x8f17fb[_0xfd31('0x4f')]=qs['sort'](_0x561ab3['query'][_0xfd31('0x38')]);_0x8f17fb[_0xfd31('0x39')]=qs[_0xfd31('0x32')](_[_0xfd31('0x50')](_0x561ab3[_0xfd31('0x31')],_0x5b4c79[_0xfd31('0x32')]));if(_0x561ab3[_0xfd31('0x31')][_0xfd31('0x3a')]){_0x8f17fb[_0xfd31('0x39')]=_[_0xfd31('0x3b')](_0x8f17fb['where'],{'$or':_['map'](_0x8f17fb[_0xfd31('0x34')],function(_0x37bc1a){var _0x14d416={};_0x14d416[_0x37bc1a]={'$like':'%'+_0x561ab3['query'][_0xfd31('0x3a')]+'%'};return _0x14d416;})});}_0x8f17fb=_[_0xfd31('0x3b')]({},_0x8f17fb,_0x561ab3[_0xfd31('0x3d')]);var _0xf5366e={'where':_0x8f17fb['where']};return db[_0xfd31('0x3f')][_0xfd31('0x23')](_0xf5366e)[_0xfd31('0x26')](function(_0x574d49){_0x565b2d['count']=_0x574d49;if(_0x561ab3[_0xfd31('0x31')][_0xfd31('0x3e')]){_0x8f17fb[_0xfd31('0x46')]=[{'all':!![]}];}return db[_0xfd31('0x3f')][_0xfd31('0x40')](_0x8f17fb);})[_0xfd31('0x26')](function(_0x207a39){_0x565b2d['rows']=_0x207a39;return _0x565b2d;})['then'](respondWithFilteredResult(_0x4e430e,_0x8f17fb,_0xfd31('0x4d')))[_0xfd31('0x48')](handleError(_0x4e430e,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index aea6dea..ad406bd 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 _0xdb4b=['emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0xdb4b,0x1a1));var _0xbdb4=function(_0x33aefe,_0x371ccd){_0x33aefe=_0x33aefe-0x0;var _0x471d19=_0xdb4b[_0x33aefe];return _0x471d19;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbdb4('0x0'))['db'][_0xbdb4('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbdb4('0x2')](0x0);var events={'afterCreate':_0xbdb4('0x3'),'afterUpdate':_0xbdb4('0x4'),'afterDestroy':_0xbdb4('0x5')};function emitEvent(_0x447a15){return function(_0x457e24,_0x2ddc64,_0x126dcf){VoiceQueueReportEvents[_0xbdb4('0x6')](_0x447a15+':'+_0x457e24['id'],_0x457e24);VoiceQueueReportEvents[_0xbdb4('0x6')](_0x447a15,_0x457e24);_0x126dcf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xbdb4('0x7')](e,emitEvent(event));}}module[_0xbdb4('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x378e=['remove','emit','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3dff38,_0x120e42){var _0x3d8ca1=function(_0x2e2e1a){while(--_0x2e2e1a){_0x3dff38['push'](_0x3dff38['shift']());}};_0x3d8ca1(++_0x120e42);}(_0x378e,0x133));var _0xe378=function(_0xeb74f,_0x16c8b5){_0xeb74f=_0xeb74f-0x0;var _0x3ab646=_0x378e[_0xeb74f];return _0x3ab646;};'use strict';var EventEmitter=require(_0xe378('0x0'));var VoiceQueueReport=require(_0xe378('0x1'))['db'][_0xe378('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe378('0x3')](0x0);var events={'afterCreate':_0xe378('0x4'),'afterUpdate':'update','afterDestroy':_0xe378('0x5')};function emitEvent(_0x19c0f9){return function(_0x201a56,_0x243902,_0x416ae6){VoiceQueueReportEvents['emit'](_0x19c0f9+':'+_0x201a56['id'],_0x201a56);VoiceQueueReportEvents[_0xe378('0x6')](_0x19c0f9,_0x201a56);_0x416ae6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xe378('0x7')](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 22516d2..800da18 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 _0x93a0=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','report_queue','uniqueid','calleridnum','lodash'];(function(_0x5b79c1,_0x360bf0){var _0x248497=function(_0x1b1dad){while(--_0x1b1dad){_0x5b79c1['push'](_0x5b79c1['shift']());}};_0x248497(++_0x360bf0);}(_0x93a0,0x12b));var _0x093a=function(_0x4334de,_0x4c8031){_0x4334de=_0x4334de-0x0;var _0x54dc66=_0x93a0[_0x4334de];return _0x54dc66;};'use strict';var _=require(_0x093a('0x0'));var util=require('util');var logger=require(_0x093a('0x1'))('api');var moment=require(_0x093a('0x2'));var BPromise=require(_0x093a('0x3'));var rp=require(_0x093a('0x4'));var fs=require('fs');var path=require(_0x093a('0x5'));var rimraf=require('rimraf');var config=require(_0x093a('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x093a('0x7')]=function(_0x10eb5a,_0xc7db32){return _0x10eb5a[_0x093a('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x093a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x093a('0xa')]},{'fields':[_0x093a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0579=['calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0x1b801a,_0x361869){var _0x369776=function(_0x3862fb){while(--_0x3862fb){_0x1b801a['push'](_0x1b801a['shift']());}};_0x369776(++_0x361869);}(_0x0579,0x111));var _0x9057=function(_0x47768a,_0x372ebf){_0x47768a=_0x47768a-0x0;var _0x5252db=_0x0579[_0x47768a];return _0x5252db;};'use strict';var _=require(_0x9057('0x0'));var util=require(_0x9057('0x1'));var logger=require(_0x9057('0x2'))(_0x9057('0x3'));var moment=require(_0x9057('0x4'));var BPromise=require(_0x9057('0x5'));var rp=require(_0x9057('0x6'));var fs=require('fs');var path=require(_0x9057('0x7'));var rimraf=require(_0x9057('0x8'));var config=require(_0x9057('0x9'));var attributes=require(_0x9057('0xa'));module[_0x9057('0xb')]=function(_0x345fc2,_0x2fb7e3){return _0x345fc2[_0x9057('0xc')](_0x9057('0xd'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x9057('0xe')]},{'fields':[_0x9057('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 47daa8f..7fda385 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 _0x3df7=['options','where','attributes','limit','map','include','model','debug','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x3df7,0x1c8));var _0x73df=function(_0x3e4fd6,_0x584a06){_0x3e4fd6=_0x3e4fd6-0x0;var _0x370a11=_0x3df7[_0x3e4fd6];return _0x370a11;};'use strict';var _=require(_0x73df('0x0'));var util=require('util');var moment=require(_0x73df('0x1'));var BPromise=require(_0x73df('0x2'));var rs=require(_0x73df('0x3'));var fs=require('fs');var Redis=require(_0x73df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x73df('0x5'));var logger=require(_0x73df('0x6'))('rpc');var config=require(_0x73df('0x7'));var jayson=require(_0x73df('0x8'));var client=jayson[_0x73df('0x9')][_0x73df('0xa')]({'port':0x232a});config[_0x73df('0xb')]=_[_0x73df('0xc')](config[_0x73df('0xb')],{'host':_0x73df('0xd'),'port':0x18eb});var socket=require(_0x73df('0xe'))(new Redis(config[_0x73df('0xb')]));require(_0x73df('0xf'))['register'](socket);function respondWithRpcPromise(_0x51f40c,_0x31f733,_0x75f40a){return new BPromise(function(_0xb5bb13,_0x4f5481){return client['request'](_0x51f40c,_0x75f40a)[_0x73df('0x10')](function(_0x1d7c23){logger[_0x73df('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x31f733,_0x73df('0x12'));logger['debug'](_0x73df('0x13'),_0x31f733,'request\x20sent',JSON[_0x73df('0x14')](_0x1d7c23));if(_0x1d7c23[_0x73df('0x15')]){if(_0x1d7c23[_0x73df('0x15')][_0x73df('0x16')]===0x1f4){logger[_0x73df('0x15')](_0x73df('0x17'),_0x31f733,_0x1d7c23['error']['message']);return _0x4f5481(_0x1d7c23[_0x73df('0x15')][_0x73df('0x18')]);}logger[_0x73df('0x15')](_0x73df('0x17'),_0x31f733,_0x1d7c23[_0x73df('0x15')][_0x73df('0x18')]);return _0xb5bb13(_0x1d7c23[_0x73df('0x15')]['message']);}else{logger[_0x73df('0x11')](_0x73df('0x17'),_0x31f733,_0x73df('0x12'));_0xb5bb13(_0x1d7c23[_0x73df('0x19')]['message']);}})['catch'](function(_0x3fbf12){logger[_0x73df('0x15')](_0x73df('0x17'),_0x31f733,_0x3fbf12);_0x4f5481(_0x3fbf12);});});}exports['GetVoiceQueueReport']=function(_0xf6641b){var _0x53a158=this;return new Promise(function(_0x21912a,_0x5f542e){return db[_0x73df('0x1a')][_0x73df('0x1b')]({'raw':_0xf6641b[_0x73df('0x1c')]?_0xf6641b[_0x73df('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xf6641b['options']?_0xf6641b['options'][_0x73df('0x1d')]||null:null,'attributes':_0xf6641b[_0x73df('0x1c')]?_0xf6641b['options'][_0x73df('0x1e')]||null:null,'limit':_0xf6641b[_0x73df('0x1c')]?_0xf6641b['options'][_0x73df('0x1f')]||null:null,'include':_0xf6641b[_0x73df('0x1c')]?_0xf6641b[_0x73df('0x1c')]['include']?_[_0x73df('0x20')](_0xf6641b[_0x73df('0x1c')][_0x73df('0x21')],function(_0x2d7bb8){return{'model':db[_0x2d7bb8['model']],'as':_0x2d7bb8['as'],'attributes':_0x2d7bb8['attributes'],'include':_0x2d7bb8[_0x73df('0x21')]?_[_0x73df('0x20')](_0x2d7bb8['include'],function(_0x276f91){return{'model':db[_0x276f91[_0x73df('0x22')]],'as':_0x276f91['as'],'attributes':_0x276f91[_0x73df('0x1e')],'include':_0x276f91['include']?_[_0x73df('0x20')](_0x276f91[_0x73df('0x21')],function(_0x1095d3){return{'model':db[_0x1095d3['model']],'as':_0x1095d3['as'],'attributes':_0x1095d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xed60ff){logger[_0x73df('0x11')]('GetVoiceQueueReport',_0xf6641b);logger[_0x73df('0x23')](_0x73df('0x24'),_0xf6641b,JSON[_0x73df('0x14')](_0xed60ff));_0x21912a(_0xed60ff);})[_0x73df('0x25')](function(_0x1c0c2b){logger['error'](_0x73df('0x24'),_0x1c0c2b[_0x73df('0x18')],_0xf6641b);_0x5f542e(_0x53a158['error'](0x1f4,_0x1c0c2b['message']));});});};exports[_0x73df('0x26')]=function(_0x214c3a){var _0x58a991=this;return new Promise(function(_0x477a5b,_0x305a79){return db['VoiceQueueReport'][_0x73df('0x27')](_0x214c3a[_0x73df('0x28')],{'raw':_0x214c3a[_0x73df('0x1c')]?_0x214c3a[_0x73df('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x73df('0x10')](function(_0x5a03ed){logger[_0x73df('0x11')](_0x73df('0x26'),_0x214c3a);logger[_0x73df('0x23')]('CreateVoiceQueueReport',_0x214c3a,JSON['stringify'](_0x5a03ed));_0x477a5b(_0x5a03ed);})[_0x73df('0x25')](function(_0x1064dc){logger[_0x73df('0x15')](_0x73df('0x26'),_0x1064dc[_0x73df('0x18')],_0x214c3a);_0x305a79(_0x58a991[_0x73df('0x15')](0x1f4,_0x1064dc['message']));});});};exports[_0x73df('0x29')]=function(_0x168bee){var _0x1db36a=this;return new Promise(function(_0x13f691,_0x156b8b){return db[_0x73df('0x1a')][_0x73df('0x2a')](_0x168bee[_0x73df('0x28')],{'raw':_0x168bee['options']?_0x168bee[_0x73df('0x1c')][_0x73df('0x2b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x168bee[_0x73df('0x1c')]?_0x168bee['options'][_0x73df('0x1d')]||null:null,'attributes':_0x168bee[_0x73df('0x1c')]?_0x168bee[_0x73df('0x1c')][_0x73df('0x1e')]||null:null,'limit':_0x168bee['options']?_0x168bee[_0x73df('0x1c')][_0x73df('0x1f')]||null:null})[_0x73df('0x10')](function(_0x39f35e){logger[_0x73df('0x11')]('UpdateVoiceQueueReport',_0x168bee);logger['debug'](_0x73df('0x29'),_0x168bee,JSON[_0x73df('0x14')](_0x39f35e));_0x13f691(_0x39f35e);})[_0x73df('0x25')](function(_0x43889b){logger[_0x73df('0x15')](_0x73df('0x29'),_0x43889b['message'],_0x168bee);_0x156b8b(_0x1db36a[_0x73df('0x15')](0x1f4,_0x43889b[_0x73df('0x18')]));});});}; \ No newline at end of file +var _0xbc8c=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','stringify','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe0a9d7,_0x334412){var _0x3a820b=function(_0x555cfc){while(--_0x555cfc){_0xe0a9d7['push'](_0xe0a9d7['shift']());}};_0x3a820b(++_0x334412);}(_0xbc8c,0xdf));var _0xcbc8=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xbc8c[_0x2d9c6a];return _0xf3c918;};'use strict';var _=require(_0xcbc8('0x0'));var util=require(_0xcbc8('0x1'));var moment=require('moment');var BPromise=require(_0xcbc8('0x2'));var rs=require(_0xcbc8('0x3'));var fs=require('fs');var Redis=require(_0xcbc8('0x4'));var db=require(_0xcbc8('0x5'))['db'];var utils=require(_0xcbc8('0x6'));var logger=require(_0xcbc8('0x7'))(_0xcbc8('0x8'));var config=require('../../config/environment');var jayson=require(_0xcbc8('0x9'));var client=jayson[_0xcbc8('0xa')][_0xcbc8('0xb')]({'port':0x232a});config[_0xcbc8('0xc')]=_[_0xcbc8('0xd')](config[_0xcbc8('0xc')],{'host':_0xcbc8('0xe'),'port':0x18eb});var socket=require(_0xcbc8('0xf'))(new Redis(config[_0xcbc8('0xc')]));require('./voiceQueueReport.socket')[_0xcbc8('0x10')](socket);function respondWithRpcPromise(_0xefc6f0,_0x297b87,_0x2c6122){return new BPromise(function(_0x50559e,_0xf530f9){return client[_0xcbc8('0x11')](_0xefc6f0,_0x2c6122)['then'](function(_0x4ba5bc){logger[_0xcbc8('0x12')](_0xcbc8('0x13'),_0x297b87,_0xcbc8('0x14'));logger[_0xcbc8('0x15')](_0xcbc8('0x16'),_0x297b87,_0xcbc8('0x14'),JSON['stringify'](_0x4ba5bc));if(_0x4ba5bc[_0xcbc8('0x17')]){if(_0x4ba5bc[_0xcbc8('0x17')][_0xcbc8('0x18')]===0x1f4){logger[_0xcbc8('0x17')](_0xcbc8('0x13'),_0x297b87,_0x4ba5bc['error'][_0xcbc8('0x19')]);return _0xf530f9(_0x4ba5bc['error']['message']);}logger[_0xcbc8('0x17')](_0xcbc8('0x13'),_0x297b87,_0x4ba5bc[_0xcbc8('0x17')][_0xcbc8('0x19')]);return _0x50559e(_0x4ba5bc['error'][_0xcbc8('0x19')]);}else{logger[_0xcbc8('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x297b87,'request\x20sent');_0x50559e(_0x4ba5bc[_0xcbc8('0x1a')]['message']);}})[_0xcbc8('0x1b')](function(_0x1bd97f){logger[_0xcbc8('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x297b87,_0x1bd97f);_0xf530f9(_0x1bd97f);});});}exports[_0xcbc8('0x1c')]=function(_0x3535d0){var _0x22a14b=this;return new Promise(function(_0x45252c,_0x1e02de){return db[_0xcbc8('0x1d')][_0xcbc8('0x1e')]({'raw':_0x3535d0[_0xcbc8('0x1f')]?_0x3535d0[_0xcbc8('0x1f')][_0xcbc8('0x20')]===undefined?!![]:![]:!![],'where':_0x3535d0[_0xcbc8('0x1f')]?_0x3535d0[_0xcbc8('0x1f')]['where']||null:null,'attributes':_0x3535d0['options']?_0x3535d0[_0xcbc8('0x1f')][_0xcbc8('0x21')]||null:null,'limit':_0x3535d0[_0xcbc8('0x1f')]?_0x3535d0[_0xcbc8('0x1f')]['limit']||null:null,'include':_0x3535d0['options']?_0x3535d0[_0xcbc8('0x1f')][_0xcbc8('0x22')]?_[_0xcbc8('0x23')](_0x3535d0[_0xcbc8('0x1f')]['include'],function(_0x481014){return{'model':db[_0x481014[_0xcbc8('0x24')]],'as':_0x481014['as'],'attributes':_0x481014[_0xcbc8('0x21')],'include':_0x481014[_0xcbc8('0x22')]?_[_0xcbc8('0x23')](_0x481014[_0xcbc8('0x22')],function(_0x2753a0){return{'model':db[_0x2753a0[_0xcbc8('0x24')]],'as':_0x2753a0['as'],'attributes':_0x2753a0[_0xcbc8('0x21')],'include':_0x2753a0[_0xcbc8('0x22')]?_['map'](_0x2753a0['include'],function(_0x5dab8b){return{'model':db[_0x5dab8b[_0xcbc8('0x24')]],'as':_0x5dab8b['as'],'attributes':_0x5dab8b[_0xcbc8('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c92ca){logger['info'](_0xcbc8('0x1c'),_0x3535d0);logger[_0xcbc8('0x15')](_0xcbc8('0x1c'),_0x3535d0,JSON[_0xcbc8('0x25')](_0x4c92ca));_0x45252c(_0x4c92ca);})['catch'](function(_0x3f03a7){logger[_0xcbc8('0x17')](_0xcbc8('0x1c'),_0x3f03a7[_0xcbc8('0x19')],_0x3535d0);_0x1e02de(_0x22a14b[_0xcbc8('0x17')](0x1f4,_0x3f03a7[_0xcbc8('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x51d9fa){var _0x2a7d70=this;return new Promise(function(_0x558119,_0x269d35){return db[_0xcbc8('0x1d')][_0xcbc8('0x26')](_0x51d9fa[_0xcbc8('0x27')],{'raw':_0x51d9fa[_0xcbc8('0x1f')]?_0x51d9fa[_0xcbc8('0x1f')][_0xcbc8('0x20')]===undefined?!![]:![]:!![]})[_0xcbc8('0x28')](function(_0x3c348e){logger[_0xcbc8('0x12')]('CreateVoiceQueueReport',_0x51d9fa);logger[_0xcbc8('0x15')]('CreateVoiceQueueReport',_0x51d9fa,JSON[_0xcbc8('0x25')](_0x3c348e));_0x558119(_0x3c348e);})[_0xcbc8('0x1b')](function(_0x22aa87){logger[_0xcbc8('0x17')](_0xcbc8('0x29'),_0x22aa87[_0xcbc8('0x19')],_0x51d9fa);_0x269d35(_0x2a7d70[_0xcbc8('0x17')](0x1f4,_0x22aa87[_0xcbc8('0x19')]));});});};exports[_0xcbc8('0x2a')]=function(_0x2c2f5b){var _0x5c1f4=this;return new Promise(function(_0x4a50ac,_0x6098bc){return db[_0xcbc8('0x1d')][_0xcbc8('0x2b')](_0x2c2f5b[_0xcbc8('0x27')],{'raw':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b['options'][_0xcbc8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b[_0xcbc8('0x1f')][_0xcbc8('0x2c')]||null:null,'attributes':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b[_0xcbc8('0x1f')]['attributes']||null:null,'limit':_0x2c2f5b[_0xcbc8('0x1f')]?_0x2c2f5b[_0xcbc8('0x1f')][_0xcbc8('0x2d')]||null:null})[_0xcbc8('0x28')](function(_0x117e4f){logger[_0xcbc8('0x12')](_0xcbc8('0x2a'),_0x2c2f5b);logger[_0xcbc8('0x15')](_0xcbc8('0x2a'),_0x2c2f5b,JSON[_0xcbc8('0x25')](_0x117e4f));_0x4a50ac(_0x117e4f);})['catch'](function(_0x2b81e1){logger[_0xcbc8('0x17')]('UpdateVoiceQueueReport',_0x2b81e1[_0xcbc8('0x19')],_0x2c2f5b);_0x6098bc(_0x5c1f4[_0xcbc8('0x17')](0x1f4,_0x2b81e1[_0xcbc8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index c508e85..340a50a 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 _0xac31=['remove','update','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3500a2,_0x2ce6e5){var _0x5bdf7a=function(_0x465bc1){while(--_0x465bc1){_0x3500a2['push'](_0x3500a2['shift']());}};_0x5bdf7a(++_0x2ce6e5);}(_0xac31,0xca));var _0x1ac3=function(_0x183f08,_0x155653){_0x183f08=_0x183f08-0x0;var _0x557516=_0xac31[_0x183f08];return _0x557516;};'use strict';var VoiceQueueReportEvents=require(_0x1ac3('0x0'));var events=[_0x1ac3('0x1'),_0x1ac3('0x2'),_0x1ac3('0x3')];function createListener(_0xd6934,_0x11dd6d){return function(_0x95548d){_0x11dd6d['emit'](_0xd6934,_0x95548d);};}function removeListener(_0x33b5ab,_0x434b5e){return function(){VoiceQueueReportEvents['removeListener'](_0x33b5ab,_0x434b5e);};}exports['register']=function(_0xbe22b7){for(var _0x20027f=0x0,_0x2bf9b1=events[_0x1ac3('0x4')];_0x20027f<_0x2bf9b1;_0x20027f++){var _0x157604=events[_0x20027f];var _0x57893c=createListener(_0x1ac3('0x5')+_0x157604,_0xbe22b7);VoiceQueueReportEvents['on'](_0x157604,_0x57893c);}}; \ No newline at end of file +var _0x5024=['removeListener','register','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x53bef4,_0x3faddf){var _0xc5c4f0=function(_0x48b61d){while(--_0x48b61d){_0x53bef4['push'](_0x53bef4['shift']());}};_0xc5c4f0(++_0x3faddf);}(_0x5024,0xf7));var _0x4502=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x5024[_0x3f3f40];return _0x403b7a;};'use strict';var VoiceQueueReportEvents=require(_0x4502('0x0'));var events=[_0x4502('0x1'),_0x4502('0x2'),_0x4502('0x3')];function createListener(_0x52d140,_0x2360b0){return function(_0x3c81c6){_0x2360b0[_0x4502('0x4')](_0x52d140,_0x3c81c6);};}function removeListener(_0x2c91c6,_0x7b4655){return function(){VoiceQueueReportEvents[_0x4502('0x5')](_0x2c91c6,_0x7b4655);};}exports[_0x4502('0x6')]=function(_0x5eddab){for(var _0x548459=0x0,_0x429d5f=events['length'];_0x548459<_0x429d5f;_0x548459++){var _0x45d2eb=events[_0x548459];var _0x254536=createListener('voiceQueueReport:'+_0x45d2eb,_0x5eddab);VoiceQueueReportEvents['on'](_0x45d2eb,_0x254536);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 10c61bd..1b01b24 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 _0x3620=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','post','/:id','update','delete','destroy','exports','connect-timeout'];(function(_0xcc24e8,_0x230fe5){var _0x279917=function(_0x5838ad){while(--_0x5838ad){_0xcc24e8['push'](_0xcc24e8['shift']());}};_0x279917(++_0x230fe5);}(_0x3620,0xcf));var _0x0362=function(_0x30ca24,_0x5e963e){_0x30ca24=_0x30ca24-0x0;var _0x338b02=_0x3620[_0x30ca24];return _0x338b02;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0362('0x0'));var express=require(_0x0362('0x1'));var router=express[_0x0362('0x2')]();var fs_extra=require(_0x0362('0x3'));var auth=require(_0x0362('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0362('0x5'));var controller=require(_0x0362('0x6'));router[_0x0362('0x7')]('/',auth[_0x0362('0x8')](),controller[_0x0362('0x9')]);router[_0x0362('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0362('0xa')]('/',auth[_0x0362('0x8')](),controller['create']);router['put'](_0x0362('0xb'),auth[_0x0362('0x8')](),controller[_0x0362('0xc')]);router[_0x0362('0xd')](_0x0362('0xb'),auth[_0x0362('0x8')](),controller[_0x0362('0xe')]);module[_0x0362('0xf')]=router; \ No newline at end of file +var _0x002e=['connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0x447eef,_0x2666c3){var _0x23c503=function(_0x4c83d7){while(--_0x4c83d7){_0x447eef['push'](_0x447eef['shift']());}};_0x23c503(++_0x2666c3);}(_0x002e,0xb8));var _0xe002=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x002e[_0x35b195];return _0x2433bf;};'use strict';var multer=require(_0xe002('0x0'));var util=require(_0xe002('0x1'));var path=require(_0xe002('0x2'));var timeout=require(_0xe002('0x3'));var express=require('express');var router=express[_0xe002('0x4')]();var fs_extra=require(_0xe002('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe002('0x6'));var config=require('../../config/environment');var controller=require(_0xe002('0x7'));router['get']('/',auth[_0xe002('0x8')](),controller[_0xe002('0x9')]);router['get'](_0xe002('0xa'),auth[_0xe002('0x8')](),controller[_0xe002('0xb')]);router[_0xe002('0xc')]('/',auth['isAuthenticated'](),controller[_0xe002('0xd')]);router[_0xe002('0xe')](_0xe002('0xa'),auth[_0xe002('0x8')](),controller['update']);router[_0xe002('0xf')]('/:id',auth[_0xe002('0x8')](),controller['destroy']);module[_0xe002('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 524e892..17ee8b4 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 _0x119b=['exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x119b,0xd1));var _0xb119=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x119b[_0x2adfb1];return _0xa52d45;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb119('0x0'));module[_0xb119('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb119('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb119('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xb119('0x4'))}}; \ No newline at end of file +var _0xdf67=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x33009c,_0x5920b8){var _0x2c41e1=function(_0x1d60d6){while(--_0x1d60d6){_0x33009c['push'](_0x33009c['shift']());}};_0x2c41e1(++_0x5920b8);}(_0xdf67,0x1eb));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7df6('0x0'));module[_0x7df6('0x1')]={'time':{'type':Sequelize[_0x7df6('0x2')]},'callid':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7df6('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7df6('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x7df6('0x4')](_0x7df6('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 607fbdb..d2e9910 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 _0x0c4d=['create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','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/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','destroy','then','end','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceQueuesLog','includeAll','findAll','rows','catch','show','include','find'];(function(_0x30e307,_0x24cabd){var _0xc5e1e6=function(_0xe881ef){while(--_0xe881ef){_0x30e307['push'](_0x30e307['shift']());}};_0xc5e1e6(++_0x24cabd);}(_0x0c4d,0x94));var _0xd0c4=function(_0x5ab634,_0x3d9e91){_0x5ab634=_0x5ab634-0x0;var _0xfab104=_0x0c4d[_0x5ab634];return _0xfab104;};'use strict';var emlformat=require(_0xd0c4('0x0'));var rimraf=require(_0xd0c4('0x1'));var zipdir=require(_0xd0c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0c4('0x3'));var moment=require(_0xd0c4('0x4'));var BPromise=require(_0xd0c4('0x5'));var Mustache=require('mustache');var util=require(_0xd0c4('0x6'));var path=require('path');var sox=require(_0xd0c4('0x7'));var csv=require(_0xd0c4('0x8'));var ejs=require(_0xd0c4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0c4('0xa'));var _=require(_0xd0c4('0xb'));var squel=require(_0xd0c4('0xc'));var crypto=require(_0xd0c4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd0c4('0x8'));var querystring=require(_0xd0c4('0xe'));var Papa=require(_0xd0c4('0xf'));var Redis=require(_0xd0c4('0x10'));var authService=require(_0xd0c4('0x11'));var qs=require(_0xd0c4('0x12'));var as=require(_0xd0c4('0x13'));var hardwareService=require(_0xd0c4('0x14'));var logger=require(_0xd0c4('0x15'))(_0xd0c4('0x16'));var utils=require('../../config/utils');var config=require(_0xd0c4('0x17'));var licenseUtil=require(_0xd0c4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33f284,_0x37bf28){_0x37bf28=_0x37bf28||0xcc;return function(_0x56f1bf){if(_0x56f1bf){return _0x33f284[_0xd0c4('0x19')](_0x37bf28);}return _0x33f284['status'](_0x37bf28)['end']();};}function respondWithResult(_0x2f655a,_0x3cfa0e){_0x3cfa0e=_0x3cfa0e||0xc8;return function(_0x3523c9){if(_0x3523c9){return _0x2f655a[_0xd0c4('0x1a')](_0x3cfa0e)['json'](_0x3523c9);}};}function respondWithFilteredResult(_0xacb47d,_0x52dbb7){return function(_0x3d1af2){if(_0x3d1af2){var _0x1901a6=typeof _0x52dbb7[_0xd0c4('0x1b')]===_0xd0c4('0x1c')&&typeof _0x52dbb7[_0xd0c4('0x1d')]===_0xd0c4('0x1c');var _0x341ad1=_0x3d1af2[_0xd0c4('0x1e')];var _0x1ed733=_0x1901a6?0x0:_0x52dbb7[_0xd0c4('0x1b')];var _0x32336b=_0x1901a6?_0x3d1af2['count']:_0x52dbb7[_0xd0c4('0x1b')]+_0x52dbb7[_0xd0c4('0x1d')];var _0x30bdc9;if(_0x32336b>=_0x341ad1){_0x32336b=_0x341ad1;_0x30bdc9=0xc8;}else{_0x30bdc9=0xce;}_0xacb47d[_0xd0c4('0x1a')](_0x30bdc9);return _0xacb47d[_0xd0c4('0x1f')]('Content-Range',_0x1ed733+'-'+_0x32336b+'/'+_0x341ad1)[_0xd0c4('0x20')](_0x3d1af2);}return null;};}function patchUpdates(_0x5b04eb){return function(_0x4c34fe){try{jsonpatch['apply'](_0x4c34fe,_0x5b04eb,!![]);}catch(_0x115261){return BPromise['reject'](_0x115261);}return _0x4c34fe['save']();};}function saveUpdates(_0x3ce32d,_0x587c76){return function(_0x1b1611){if(_0x1b1611){return _0x1b1611['update'](_0x3ce32d)['then'](function(_0x552d85){return _0x552d85;});}return null;};}function removeEntity(_0x5a4b01,_0x36de69){return function(_0x5b5f09){if(_0x5b5f09){return _0x5b5f09[_0xd0c4('0x21')]()[_0xd0c4('0x22')](function(){_0x5a4b01['status'](0xcc)[_0xd0c4('0x23')]();});}};}function handleEntityNotFound(_0x33592b,_0x4c1247){return function(_0xf97e28){if(!_0xf97e28){_0x33592b[_0xd0c4('0x19')](0x194);}return _0xf97e28;};}function handleError(_0xf6041d,_0x10c3fb){_0x10c3fb=_0x10c3fb||0x1f4;return function(_0x4c67de){logger['error'](_0x4c67de[_0xd0c4('0x24')]);if(_0x4c67de['name']){delete _0x4c67de['name'];}_0xf6041d['status'](_0x10c3fb)[_0xd0c4('0x25')](_0x4c67de);};}exports[_0xd0c4('0x26')]=function(_0x148afb,_0x4946eb){var _0xd33fec={},_0xd1cd3={},_0x4aea16={'count':0x0,'rows':[]};var _0x5d6b38=_[_0xd0c4('0x27')](db['VoiceQueuesLog'][_0xd0c4('0x28')],function(_0x52f159){return{'name':_0x52f159[_0xd0c4('0x29')],'type':_0x52f159[_0xd0c4('0x2a')]['key']};});_0xd1cd3[_0xd0c4('0x2b')]=_['map'](_0x5d6b38,_0xd0c4('0x2c'));_0xd1cd3[_0xd0c4('0x2d')]=_[_0xd0c4('0x2e')](_0x148afb[_0xd0c4('0x2d')]);_0xd1cd3[_0xd0c4('0x2f')]=_[_0xd0c4('0x30')](_0xd1cd3['model'],_0xd1cd3[_0xd0c4('0x2d')]);_0xd33fec[_0xd0c4('0x31')]=_['intersection'](_0xd1cd3[_0xd0c4('0x2b')],qs[_0xd0c4('0x32')](_0x148afb['query']['fields']));_0xd33fec[_0xd0c4('0x31')]=_0xd33fec[_0xd0c4('0x31')]['length']?_0xd33fec['attributes']:_0xd1cd3[_0xd0c4('0x2b')];if(!_0x148afb[_0xd0c4('0x2d')][_0xd0c4('0x33')](_0xd0c4('0x34'))){_0xd33fec['limit']=qs[_0xd0c4('0x1d')](_0x148afb[_0xd0c4('0x2d')][_0xd0c4('0x1d')]);_0xd33fec[_0xd0c4('0x1b')]=qs[_0xd0c4('0x1b')](_0x148afb[_0xd0c4('0x2d')]['offset']);}_0xd33fec[_0xd0c4('0x35')]=qs[_0xd0c4('0x36')](_0x148afb[_0xd0c4('0x2d')][_0xd0c4('0x36')]);_0xd33fec[_0xd0c4('0x37')]=qs[_0xd0c4('0x2f')](_[_0xd0c4('0x38')](_0x148afb[_0xd0c4('0x2d')],_0xd1cd3[_0xd0c4('0x2f')]),_0x5d6b38);if(_0x148afb['query'][_0xd0c4('0x39')]){_0xd33fec[_0xd0c4('0x37')]=_[_0xd0c4('0x3a')](_0xd33fec[_0xd0c4('0x37')],{'$or':_[_0xd0c4('0x27')](_0x5d6b38,function(_0x5d767a){if(_0x5d767a['type']!=='VIRTUAL'){var _0x46c479={};_0x46c479[_0x5d767a[_0xd0c4('0x2c')]]={'$like':'%'+_0x148afb[_0xd0c4('0x2d')][_0xd0c4('0x39')]+'%'};return _0x46c479;}})});}_0xd33fec=_[_0xd0c4('0x3a')]({},_0xd33fec,_0x148afb[_0xd0c4('0x3b')]);var _0x13ab14={'where':_0xd33fec[_0xd0c4('0x37')]};return db[_0xd0c4('0x3c')]['count'](_0x13ab14)[_0xd0c4('0x22')](function(_0x2e2826){_0x4aea16['count']=_0x2e2826;if(_0x148afb[_0xd0c4('0x2d')][_0xd0c4('0x3d')]){_0xd33fec['include']=[{'all':!![]}];}return db[_0xd0c4('0x3c')][_0xd0c4('0x3e')](_0xd33fec);})[_0xd0c4('0x22')](function(_0x40a073){_0x4aea16[_0xd0c4('0x3f')]=_0x40a073;return _0x4aea16;})['then'](respondWithFilteredResult(_0x4946eb,_0xd33fec))[_0xd0c4('0x40')](handleError(_0x4946eb,null));};exports[_0xd0c4('0x41')]=function(_0x1c7da0,_0x28aa27){var _0x252a5f={'raw':!![],'where':{'id':_0x1c7da0['params']['id']}},_0x4b79cd={};_0x4b79cd[_0xd0c4('0x2b')]=_[_0xd0c4('0x2e')](db[_0xd0c4('0x3c')][_0xd0c4('0x28')]);_0x4b79cd[_0xd0c4('0x2d')]=_['keys'](_0x1c7da0[_0xd0c4('0x2d')]);_0x4b79cd[_0xd0c4('0x2f')]=_['intersection'](_0x4b79cd['model'],_0x4b79cd[_0xd0c4('0x2d')]);_0x252a5f[_0xd0c4('0x31')]=_[_0xd0c4('0x30')](_0x4b79cd[_0xd0c4('0x2b')],qs[_0xd0c4('0x32')](_0x1c7da0['query'][_0xd0c4('0x32')]));_0x252a5f[_0xd0c4('0x31')]=_0x252a5f['attributes']['length']?_0x252a5f[_0xd0c4('0x31')]:_0x4b79cd[_0xd0c4('0x2b')];if(_0x1c7da0['query'][_0xd0c4('0x3d')]){_0x252a5f[_0xd0c4('0x42')]=[{'all':!![]}];}_0x252a5f=_[_0xd0c4('0x3a')]({},_0x252a5f,_0x1c7da0[_0xd0c4('0x3b')]);return db[_0xd0c4('0x3c')][_0xd0c4('0x43')](_0x252a5f)['then'](handleEntityNotFound(_0x28aa27,null))[_0xd0c4('0x22')](respondWithResult(_0x28aa27,null))['catch'](handleError(_0x28aa27,null));};exports[_0xd0c4('0x44')]=function(_0x21bd54,_0x351120){return db['VoiceQueuesLog'][_0xd0c4('0x44')](_0x21bd54[_0xd0c4('0x45')],{})['then'](respondWithResult(_0x351120,0xc9))[_0xd0c4('0x40')](handleError(_0x351120,null));};exports[_0xd0c4('0x46')]=function(_0x2dd930,_0x4d074d){if(_0x2dd930['body']['id']){delete _0x2dd930[_0xd0c4('0x45')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x2dd930[_0xd0c4('0x47')]['id']}})[_0xd0c4('0x22')](handleEntityNotFound(_0x4d074d,null))['then'](saveUpdates(_0x2dd930[_0xd0c4('0x45')],null))[_0xd0c4('0x22')](respondWithResult(_0x4d074d,null))[_0xd0c4('0x40')](handleError(_0x4d074d,null));};exports[_0xd0c4('0x21')]=function(_0x5acea8,_0x1fd4da){return db['VoiceQueuesLog']['find']({'where':{'id':_0x5acea8[_0xd0c4('0x47')]['id']}})[_0xd0c4('0x22')](handleEntityNotFound(_0x1fd4da,null))[_0xd0c4('0x22')](removeEntity(_0x1fd4da,null))[_0xd0c4('0x40')](handleError(_0x1fd4da,null));}; \ No newline at end of file +var _0xd48f=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VoiceQueuesLog','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','rimraf','zip-dir','path','sox','to-csv','ejs'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd48f,0xd2));var _0xfd48=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd48f[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd48('0x0'));var zipdir=require(_0xfd48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfd48('0x2'));var sox=require(_0xfd48('0x3'));var csv=require(_0xfd48('0x4'));var ejs=require(_0xfd48('0x5'));var fs=require('fs');var fs_extra=require(_0xfd48('0x6'));var _=require(_0xfd48('0x7'));var squel=require('squel');var crypto=require(_0xfd48('0x8'));var jsforce=require(_0xfd48('0x9'));var deskjs=require(_0xfd48('0xa'));var toCsv=require('to-csv');var querystring=require(_0xfd48('0xb'));var Papa=require(_0xfd48('0xc'));var Redis=require(_0xfd48('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfd48('0xe'));var hardwareService=require(_0xfd48('0xf'));var logger=require(_0xfd48('0x10'))(_0xfd48('0x11'));var utils=require(_0xfd48('0x12'));var config=require(_0xfd48('0x13'));var licenseUtil=require(_0xfd48('0x14'));var db=require(_0xfd48('0x15'))['db'];function respondWithStatusCode(_0x1e911a,_0x26b424){_0x26b424=_0x26b424||0xcc;return function(_0xb03446){if(_0xb03446){return _0x1e911a[_0xfd48('0x16')](_0x26b424);}return _0x1e911a[_0xfd48('0x17')](_0x26b424)['end']();};}function respondWithResult(_0x297ece,_0x59ad43){_0x59ad43=_0x59ad43||0xc8;return function(_0x20789a){if(_0x20789a){return _0x297ece[_0xfd48('0x17')](_0x59ad43)[_0xfd48('0x18')](_0x20789a);}};}function respondWithFilteredResult(_0xcde2cd,_0x3a39ff){return function(_0x3d4102){if(_0x3d4102){var _0x115d71=typeof _0x3a39ff[_0xfd48('0x19')]==='undefined'&&typeof _0x3a39ff['limit']===_0xfd48('0x1a');var _0x11be92=_0x3d4102[_0xfd48('0x1b')];var _0x3a67b9=_0x115d71?0x0:_0x3a39ff['offset'];var _0x153216=_0x115d71?_0x3d4102[_0xfd48('0x1b')]:_0x3a39ff[_0xfd48('0x19')]+_0x3a39ff['limit'];var _0x31da09;if(_0x153216>=_0x11be92){_0x153216=_0x11be92;_0x31da09=0xc8;}else{_0x31da09=0xce;}_0xcde2cd[_0xfd48('0x17')](_0x31da09);return _0xcde2cd[_0xfd48('0x1c')](_0xfd48('0x1d'),_0x3a67b9+'-'+_0x153216+'/'+_0x11be92)['json'](_0x3d4102);}return null;};}function patchUpdates(_0x2e9a39){return function(_0x46ebd9){try{jsonpatch['apply'](_0x46ebd9,_0x2e9a39,!![]);}catch(_0x50544d){return BPromise[_0xfd48('0x1e')](_0x50544d);}return _0x46ebd9[_0xfd48('0x1f')]();};}function saveUpdates(_0x3eca1a,_0x14e29f){return function(_0x33b50c){if(_0x33b50c){return _0x33b50c[_0xfd48('0x20')](_0x3eca1a)[_0xfd48('0x21')](function(_0x117bea){return _0x117bea;});}return null;};}function removeEntity(_0x59e39e,_0x324973){return function(_0x42e469){if(_0x42e469){return _0x42e469[_0xfd48('0x22')]()[_0xfd48('0x21')](function(){_0x59e39e[_0xfd48('0x17')](0xcc)[_0xfd48('0x23')]();});}};}function handleEntityNotFound(_0x3d0c3d,_0x59387b){return function(_0x26ae00){if(!_0x26ae00){_0x3d0c3d[_0xfd48('0x16')](0x194);}return _0x26ae00;};}function handleError(_0x3c9977,_0x2a3ff9){_0x2a3ff9=_0x2a3ff9||0x1f4;return function(_0xaea78d){logger['error'](_0xaea78d[_0xfd48('0x24')]);if(_0xaea78d['name']){delete _0xaea78d[_0xfd48('0x25')];}_0x3c9977[_0xfd48('0x17')](_0x2a3ff9)[_0xfd48('0x26')](_0xaea78d);};}exports[_0xfd48('0x27')]=function(_0x242d90,_0x3eac7d){var _0x510c5a={},_0x42d5de={},_0x26b588={'count':0x0,'rows':[]};var _0x10e797=_['map'](db['VoiceQueuesLog'][_0xfd48('0x28')],function(_0x35373f){return{'name':_0x35373f[_0xfd48('0x29')],'type':_0x35373f['type'][_0xfd48('0x2a')]};});_0x42d5de[_0xfd48('0x2b')]=_[_0xfd48('0x2c')](_0x10e797,_0xfd48('0x25'));_0x42d5de[_0xfd48('0x2d')]=_[_0xfd48('0x2e')](_0x242d90[_0xfd48('0x2d')]);_0x42d5de[_0xfd48('0x2f')]=_['intersection'](_0x42d5de[_0xfd48('0x2b')],_0x42d5de[_0xfd48('0x2d')]);_0x510c5a[_0xfd48('0x30')]=_[_0xfd48('0x31')](_0x42d5de[_0xfd48('0x2b')],qs[_0xfd48('0x32')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x32')]));_0x510c5a[_0xfd48('0x30')]=_0x510c5a[_0xfd48('0x30')][_0xfd48('0x33')]?_0x510c5a[_0xfd48('0x30')]:_0x42d5de[_0xfd48('0x2b')];if(!_0x242d90['query'][_0xfd48('0x34')](_0xfd48('0x35'))){_0x510c5a['limit']=qs[_0xfd48('0x36')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x36')]);_0x510c5a[_0xfd48('0x19')]=qs[_0xfd48('0x19')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x19')]);}_0x510c5a['order']=qs[_0xfd48('0x37')](_0x242d90[_0xfd48('0x2d')][_0xfd48('0x37')]);_0x510c5a[_0xfd48('0x38')]=qs['filters'](_[_0xfd48('0x39')](_0x242d90[_0xfd48('0x2d')],_0x42d5de['filters']),_0x10e797);if(_0x242d90['query'][_0xfd48('0x3a')]){_0x510c5a['where']=_[_0xfd48('0x3b')](_0x510c5a[_0xfd48('0x38')],{'$or':_[_0xfd48('0x2c')](_0x10e797,function(_0x4b19af){if(_0x4b19af['type']!=='VIRTUAL'){var _0x5c5c01={};_0x5c5c01[_0x4b19af[_0xfd48('0x25')]]={'$like':'%'+_0x242d90[_0xfd48('0x2d')][_0xfd48('0x3a')]+'%'};return _0x5c5c01;}})});}_0x510c5a=_['merge']({},_0x510c5a,_0x242d90['options']);var _0x26377d={'where':_0x510c5a[_0xfd48('0x38')]};return db[_0xfd48('0x3c')][_0xfd48('0x1b')](_0x26377d)[_0xfd48('0x21')](function(_0xb82ea6){_0x26b588[_0xfd48('0x1b')]=_0xb82ea6;if(_0x242d90['query'][_0xfd48('0x3d')]){_0x510c5a[_0xfd48('0x3e')]=[{'all':!![]}];}return db[_0xfd48('0x3c')][_0xfd48('0x3f')](_0x510c5a);})[_0xfd48('0x21')](function(_0x44fe32){_0x26b588[_0xfd48('0x40')]=_0x44fe32;return _0x26b588;})[_0xfd48('0x21')](respondWithFilteredResult(_0x3eac7d,_0x510c5a))['catch'](handleError(_0x3eac7d,null));};exports[_0xfd48('0x41')]=function(_0x211f65,_0x1d77fd){var _0x520f0b={'raw':!![],'where':{'id':_0x211f65[_0xfd48('0x42')]['id']}},_0x2bd861={};_0x2bd861[_0xfd48('0x2b')]=_[_0xfd48('0x2e')](db['VoiceQueuesLog'][_0xfd48('0x28')]);_0x2bd861[_0xfd48('0x2d')]=_['keys'](_0x211f65[_0xfd48('0x2d')]);_0x2bd861[_0xfd48('0x2f')]=_['intersection'](_0x2bd861[_0xfd48('0x2b')],_0x2bd861[_0xfd48('0x2d')]);_0x520f0b[_0xfd48('0x30')]=_[_0xfd48('0x31')](_0x2bd861[_0xfd48('0x2b')],qs[_0xfd48('0x32')](_0x211f65[_0xfd48('0x2d')][_0xfd48('0x32')]));_0x520f0b[_0xfd48('0x30')]=_0x520f0b['attributes'][_0xfd48('0x33')]?_0x520f0b[_0xfd48('0x30')]:_0x2bd861['model'];if(_0x211f65[_0xfd48('0x2d')][_0xfd48('0x3d')]){_0x520f0b[_0xfd48('0x3e')]=[{'all':!![]}];}_0x520f0b=_[_0xfd48('0x3b')]({},_0x520f0b,_0x211f65[_0xfd48('0x43')]);return db['VoiceQueuesLog'][_0xfd48('0x44')](_0x520f0b)[_0xfd48('0x21')](handleEntityNotFound(_0x1d77fd,null))[_0xfd48('0x21')](respondWithResult(_0x1d77fd,null))['catch'](handleError(_0x1d77fd,null));};exports[_0xfd48('0x45')]=function(_0x23ef38,_0x35f657){return db['VoiceQueuesLog'][_0xfd48('0x45')](_0x23ef38[_0xfd48('0x46')],{})[_0xfd48('0x21')](respondWithResult(_0x35f657,0xc9))[_0xfd48('0x47')](handleError(_0x35f657,null));};exports[_0xfd48('0x20')]=function(_0x1d3891,_0x2dfdb8){if(_0x1d3891['body']['id']){delete _0x1d3891[_0xfd48('0x46')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1d3891[_0xfd48('0x42')]['id']}})[_0xfd48('0x21')](handleEntityNotFound(_0x2dfdb8,null))[_0xfd48('0x21')](saveUpdates(_0x1d3891[_0xfd48('0x46')],null))[_0xfd48('0x21')](respondWithResult(_0x2dfdb8,null))['catch'](handleError(_0x2dfdb8,null));};exports[_0xfd48('0x22')]=function(_0x5b03a7,_0xc0861b){return db[_0xfd48('0x3c')][_0xfd48('0x44')]({'where':{'id':_0x5b03a7[_0xfd48('0x42')]['id']}})[_0xfd48('0x21')](handleEntityNotFound(_0xc0861b,null))['then'](removeEntity(_0xc0861b,null))[_0xfd48('0x47')](handleError(_0xc0861b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 28edf76..cca1fa5 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 _0x6183=['voice_queues_log','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog'];(function(_0x2a94cf,_0x2b970d){var _0x22147f=function(_0xfc71ab){while(--_0xfc71ab){_0x2a94cf['push'](_0x2a94cf['shift']());}};_0x22147f(++_0x2b970d);}(_0x6183,0x1e2));var _0x3618=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x6183[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x3618('0x0'));var util=require(_0x3618('0x1'));var logger=require(_0x3618('0x2'))(_0x3618('0x3'));var moment=require(_0x3618('0x4'));var BPromise=require(_0x3618('0x5'));var rp=require(_0x3618('0x6'));var fs=require('fs');var path=require(_0x3618('0x7'));var rimraf=require(_0x3618('0x8'));var config=require(_0x3618('0x9'));var attributes=require(_0x3618('0xa'));module[_0x3618('0xb')]=function(_0x2f4ab4,_0x430360){return _0x2f4ab4['define'](_0x3618('0xc'),attributes,{'tableName':_0x3618('0xd'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x3618('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x5460=['define','VoiceQueuesLog','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x3df5cb,_0x11f3a0){var _0x32b8d3=function(_0x115bc0){while(--_0x115bc0){_0x3df5cb['push'](_0x3df5cb['shift']());}};_0x32b8d3(++_0x11f3a0);}(_0x5460,0x1e5));var _0x0546=function(_0x167544,_0x34f43a){_0x167544=_0x167544-0x0;var _0x4c976b=_0x5460[_0x167544];return _0x4c976b;};'use strict';var _=require(_0x0546('0x0'));var util=require(_0x0546('0x1'));var logger=require(_0x0546('0x2'))(_0x0546('0x3'));var moment=require(_0x0546('0x4'));var BPromise=require(_0x0546('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0546('0x6'));var rimraf=require('rimraf');var config=require(_0x0546('0x7'));var attributes=require(_0x0546('0x8'));module['exports']=function(_0x4f85c7,_0x1094e7){return _0x4f85c7[_0x0546('0x9')](_0x0546('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0546('0xb'),_0x0546('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0063454..74fec62 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 _0x138d=['VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0xffe84a,_0x55007d){var _0x227656=function(_0x267c9a){while(--_0x267c9a){_0xffe84a['push'](_0xffe84a['shift']());}};_0x227656(++_0x55007d);}(_0x138d,0x1ab));var _0xd138=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x138d[_0x34bc6c];return _0x168820;};'use strict';var _=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var moment=require('moment');var BPromise=require(_0xd138('0x2'));var rs=require(_0xd138('0x3'));var fs=require('fs');var Redis=require(_0xd138('0x4'));var db=require(_0xd138('0x5'))['db'];var utils=require(_0xd138('0x6'));var logger=require(_0xd138('0x7'))('rpc');var config=require(_0xd138('0x8'));var jayson=require(_0xd138('0x9'));var client=jayson[_0xd138('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19869d,_0x1edfa7,_0x117c23){return new BPromise(function(_0x5790ff,_0x54e1f2){return client[_0xd138('0xb')](_0x19869d,_0x117c23)[_0xd138('0xc')](function(_0x121cce){logger['info'](_0xd138('0xd'),_0x1edfa7,'request\x20sent');logger['debug'](_0xd138('0xe'),_0x1edfa7,_0xd138('0xf'),JSON[_0xd138('0x10')](_0x121cce));if(_0x121cce[_0xd138('0x11')]){if(_0x121cce['error'][_0xd138('0x12')]===0x1f4){logger['error'](_0xd138('0xd'),_0x1edfa7,_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);return _0x54e1f2(_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);}logger[_0xd138('0x11')](_0xd138('0xd'),_0x1edfa7,_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);return _0x5790ff(_0x121cce[_0xd138('0x11')][_0xd138('0x13')]);}else{logger[_0xd138('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1edfa7,_0xd138('0xf'));_0x5790ff(_0x121cce[_0xd138('0x15')]['message']);}})['catch'](function(_0x502d3b){logger[_0xd138('0x11')](_0xd138('0xd'),_0x1edfa7,_0x502d3b);_0x54e1f2(_0x502d3b);});});} \ No newline at end of file +var _0x7b79=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x7b79,0x1b6));var _0x97b7=function(_0x15923d,_0x37c6e7){_0x15923d=_0x15923d-0x0;var _0x319ab9=_0x7b79[_0x15923d];return _0x319ab9;};'use strict';var _=require(_0x97b7('0x0'));var util=require(_0x97b7('0x1'));var moment=require(_0x97b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x97b7('0x3'));var fs=require('fs');var Redis=require(_0x97b7('0x4'));var db=require(_0x97b7('0x5'))['db'];var utils=require(_0x97b7('0x6'));var logger=require('../../config/logger')(_0x97b7('0x7'));var config=require(_0x97b7('0x8'));var jayson=require(_0x97b7('0x9'));var client=jayson[_0x97b7('0xa')][_0x97b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43390b,_0x54d06e,_0x58d79a){return new BPromise(function(_0x59cbc1,_0x5e7124){return client[_0x97b7('0xc')](_0x43390b,_0x58d79a)[_0x97b7('0xd')](function(_0x3d245c){logger[_0x97b7('0xe')](_0x97b7('0xf'),_0x54d06e,'request\x20sent');logger[_0x97b7('0x10')](_0x97b7('0x11'),_0x54d06e,'request\x20sent',JSON[_0x97b7('0x12')](_0x3d245c));if(_0x3d245c[_0x97b7('0x13')]){if(_0x3d245c['error'][_0x97b7('0x14')]===0x1f4){logger[_0x97b7('0x13')](_0x97b7('0xf'),_0x54d06e,_0x3d245c['error'][_0x97b7('0x15')]);return _0x5e7124(_0x3d245c[_0x97b7('0x13')][_0x97b7('0x15')]);}logger[_0x97b7('0x13')](_0x97b7('0xf'),_0x54d06e,_0x3d245c[_0x97b7('0x13')][_0x97b7('0x15')]);return _0x59cbc1(_0x3d245c[_0x97b7('0x13')]['message']);}else{logger[_0x97b7('0xe')](_0x97b7('0xf'),_0x54d06e,'request\x20sent');_0x59cbc1(_0x3d245c[_0x97b7('0x16')][_0x97b7('0x15')]);}})[_0x97b7('0x17')](function(_0x3afd52){logger[_0x97b7('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x54d06e,_0x3afd52);_0x5e7124(_0x3afd52);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e09beec..8f63eb7 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 _0xd41b=['download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','show'];(function(_0x47c412,_0x5d84b9){var _0x5930af=function(_0xec1613){while(--_0xec1613){_0x47c412['push'](_0x47c412['shift']());}};_0x5930af(++_0x5d84b9);}(_0xd41b,0x1e0));var _0xbd41=function(_0x12ce22,_0x3f9f96){_0x12ce22=_0x12ce22-0x0;var _0xbabcc4=_0xd41b[_0x12ce22];return _0xbabcc4;};'use strict';var multer=require(_0xbd41('0x0'));var util=require('util');var path=require(_0xbd41('0x1'));var timeout=require(_0xbd41('0x2'));var express=require(_0xbd41('0x3'));var router=express[_0xbd41('0x4')]();var fs_extra=require(_0xbd41('0x5'));var auth=require(_0xbd41('0x6'));var interaction=require(_0xbd41('0x7'));var config=require('../../config/environment');var controller=require(_0xbd41('0x8'));router[_0xbd41('0x9')]('/',auth[_0xbd41('0xa')](),controller[_0xbd41('0xb')]);router[_0xbd41('0x9')](_0xbd41('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xbd41('0x9')]('/:id',auth[_0xbd41('0xa')](),controller[_0xbd41('0xd')]);router[_0xbd41('0x9')]('/:id/download',auth[_0xbd41('0xa')](),controller[_0xbd41('0xe')]);router[_0xbd41('0x9')](_0xbd41('0xf'),controller[_0xbd41('0x10')]);router[_0xbd41('0x9')](_0xbd41('0x11'),auth['isAuthenticated'](),controller[_0xbd41('0x12')]);router[_0xbd41('0x13')]('/',auth[_0xbd41('0xa')](),controller[_0xbd41('0x14')]);router[_0xbd41('0x13')](_0xbd41('0x11'),auth[_0xbd41('0xa')](),controller['runTranscribe']);router[_0xbd41('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbd41('0x16')]);router['delete'](_0xbd41('0x17'),auth[_0xbd41('0xa')](),controller[_0xbd41('0x18')]);module[_0xbd41('0x19')]=router; \ No newline at end of file +var _0xb507=['delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe'];(function(_0x1fb86d,_0xc5978a){var _0x3f7334=function(_0x4b74b9){while(--_0x4b74b9){_0x1fb86d['push'](_0x1fb86d['shift']());}};_0x3f7334(++_0xc5978a);}(_0xb507,0xb1));var _0x7b50=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0xb507[_0x7fd9e9];return _0x285d92;};'use strict';var multer=require('multer');var util=require(_0x7b50('0x0'));var path=require(_0x7b50('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b50('0x2'));var router=express['Router']();var fs_extra=require(_0x7b50('0x3'));var auth=require(_0x7b50('0x4'));var interaction=require(_0x7b50('0x5'));var config=require(_0x7b50('0x6'));var controller=require('./voiceRecording.controller');router[_0x7b50('0x7')]('/',auth[_0x7b50('0x8')](),controller[_0x7b50('0x9')]);router['get'](_0x7b50('0xa'),auth[_0x7b50('0x8')](),controller[_0x7b50('0xb')]);router[_0x7b50('0x7')](_0x7b50('0xc'),auth[_0x7b50('0x8')](),controller[_0x7b50('0xd')]);router['get'](_0x7b50('0xe'),auth[_0x7b50('0x8')](),controller[_0x7b50('0xf')]);router[_0x7b50('0x7')](_0x7b50('0x10'),controller[_0x7b50('0x11')]);router[_0x7b50('0x7')](_0x7b50('0x12'),auth['isAuthenticated'](),controller[_0x7b50('0x13')]);router[_0x7b50('0x14')]('/',auth[_0x7b50('0x8')](),controller[_0x7b50('0x15')]);router[_0x7b50('0x14')]('/:id/transcribe',auth[_0x7b50('0x8')](),controller[_0x7b50('0x16')]);router['put']('/:id',auth[_0x7b50('0x8')](),controller['update']);router[_0x7b50('0x17')](_0x7b50('0xc'),auth[_0x7b50('0x8')](),controller[_0x7b50('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4ed15e9..304ff8a 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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 dee2bcc..42a28c1 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 _0x74fc=['params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','existsSync','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Sequelize','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','desk.js','to-csv','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceRecording','includeAll','findAll','show','include','find','create','body','catch'];(function(_0x18edfb,_0x5303af){var _0x1884a0=function(_0x3b42db){while(--_0x3b42db){_0x18edfb['push'](_0x18edfb['shift']());}};_0x1884a0(++_0x5303af);}(_0x74fc,0x17a));var _0xc74f=function(_0x3ecafd,_0x592c37){_0x3ecafd=_0x3ecafd-0x0;var _0x12c422=_0x74fc[_0x3ecafd];return _0x12c422;};'use strict';var emlformat=require(_0xc74f('0x0'));var rimraf=require(_0xc74f('0x1'));var zipdir=require(_0xc74f('0x2'));var jsonpatch=require(_0xc74f('0x3'));var rp=require(_0xc74f('0x4'));var moment=require(_0xc74f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc74f('0x6'));var util=require(_0xc74f('0x7'));var path=require(_0xc74f('0x8'));var sox=require(_0xc74f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc74f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc74f('0xb'));var toCsv=require(_0xc74f('0xc'));var querystring=require(_0xc74f('0xd'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xc74f('0xe'));var Redis=require(_0xc74f('0xf'));var authService=require(_0xc74f('0x10'));var qs=require(_0xc74f('0x11'));var as=require(_0xc74f('0x12'));var hardwareService=require(_0xc74f('0x13'));var logger=require(_0xc74f('0x14'))(_0xc74f('0x15'));var utils=require(_0xc74f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc74f('0x17'));var db=require(_0xc74f('0x18'))['db'];function respondWithStatusCode(_0x5cc4ac,_0x1753fe){_0x1753fe=_0x1753fe||0xcc;return function(_0x81cfa){if(_0x81cfa){return _0x5cc4ac[_0xc74f('0x19')](_0x1753fe);}return _0x5cc4ac['status'](_0x1753fe)[_0xc74f('0x1a')]();};}function respondWithResult(_0x2859b8,_0x3d6847){_0x3d6847=_0x3d6847||0xc8;return function(_0x47d8b7){if(_0x47d8b7){return _0x2859b8[_0xc74f('0x1b')](_0x3d6847)[_0xc74f('0x1c')](_0x47d8b7);}};}function respondWithFilteredResult(_0x4687c3,_0x5a8cbb){return function(_0x1676d1){if(_0x1676d1){var _0x2d8968=typeof _0x5a8cbb[_0xc74f('0x1d')]===_0xc74f('0x1e')&&typeof _0x5a8cbb[_0xc74f('0x1f')]===_0xc74f('0x1e');var _0x274965=_0x1676d1['count'];var _0x3cbb49=_0x2d8968?0x0:_0x5a8cbb['offset'];var _0x460aad=_0x2d8968?_0x1676d1[_0xc74f('0x20')]:_0x5a8cbb[_0xc74f('0x1d')]+_0x5a8cbb[_0xc74f('0x1f')];var _0x5b9998;if(_0x460aad>=_0x274965){_0x460aad=_0x274965;_0x5b9998=0xc8;}else{_0x5b9998=0xce;}_0x4687c3[_0xc74f('0x1b')](_0x5b9998);return _0x4687c3['set'](_0xc74f('0x21'),_0x3cbb49+'-'+_0x460aad+'/'+_0x274965)[_0xc74f('0x1c')](_0x1676d1);}return null;};}function patchUpdates(_0x533489){return function(_0x13a5f2){try{jsonpatch[_0xc74f('0x22')](_0x13a5f2,_0x533489,!![]);}catch(_0x1d2f9a){return BPromise[_0xc74f('0x23')](_0x1d2f9a);}return _0x13a5f2[_0xc74f('0x24')]();};}function saveUpdates(_0x155414,_0x474156){return function(_0x2e84d5){if(_0x2e84d5){return _0x2e84d5[_0xc74f('0x25')](_0x155414)[_0xc74f('0x26')](function(_0x24d610){return _0x24d610;});}return null;};}function removeEntity(_0x5075ee,_0x22b396){return function(_0x45f5f4){if(_0x45f5f4){return _0x45f5f4[_0xc74f('0x27')]()[_0xc74f('0x26')](function(){_0x5075ee[_0xc74f('0x1b')](0xcc)[_0xc74f('0x1a')]();});}};}function handleEntityNotFound(_0x51b642,_0x42147f){return function(_0x2c6536){if(!_0x2c6536){_0x51b642[_0xc74f('0x19')](0x194);}return _0x2c6536;};}function handleError(_0xccd16b,_0x1909b8){_0x1909b8=_0x1909b8||0x1f4;return function(_0x507554){logger['error'](_0x507554['stack']);if(_0x507554[_0xc74f('0x28')]){delete _0x507554['name'];}_0xccd16b[_0xc74f('0x1b')](_0x1909b8)[_0xc74f('0x29')](_0x507554);};}exports['index']=function(_0x2f88cc,_0x4b7e54){var _0x1dec60={},_0x144e39={},_0x163271={'count':0x0,'rows':[]};var _0x148d34=_[_0xc74f('0x2a')](db['VoiceRecording'][_0xc74f('0x2b')],function(_0x423763){return{'name':_0x423763[_0xc74f('0x2c')],'type':_0x423763[_0xc74f('0x2d')][_0xc74f('0x2e')]};});_0x144e39[_0xc74f('0x2f')]=_[_0xc74f('0x30')](_['map'](_0x148d34,'name'),[_0xc74f('0x31')]);_0x144e39[_0xc74f('0x32')]=_[_0xc74f('0x33')](_0x2f88cc[_0xc74f('0x32')]);_0x144e39[_0xc74f('0x34')]=_['intersection'](_0x144e39[_0xc74f('0x2f')],_0x144e39[_0xc74f('0x32')]);_0x1dec60[_0xc74f('0x35')]=_[_0xc74f('0x36')](_0x144e39[_0xc74f('0x2f')],qs[_0xc74f('0x37')](_0x2f88cc[_0xc74f('0x32')]['fields']));_0x1dec60[_0xc74f('0x35')]=_0x1dec60[_0xc74f('0x35')][_0xc74f('0x38')]?_0x1dec60['attributes']:_0x144e39[_0xc74f('0x2f')];if(!_0x2f88cc[_0xc74f('0x32')][_0xc74f('0x39')]('nolimit')){_0x1dec60[_0xc74f('0x1f')]=qs['limit'](_0x2f88cc[_0xc74f('0x32')]['limit']);_0x1dec60[_0xc74f('0x1d')]=qs[_0xc74f('0x1d')](_0x2f88cc[_0xc74f('0x32')]['offset']);}_0x1dec60[_0xc74f('0x3a')]=qs[_0xc74f('0x3b')](_0x2f88cc[_0xc74f('0x32')]['sort']);_0x1dec60[_0xc74f('0x3c')]=qs['filters'](_[_0xc74f('0x3d')](_0x2f88cc[_0xc74f('0x32')],_0x144e39['filters']),_0x148d34);if(_0x2f88cc['query']['filter']){_0x1dec60[_0xc74f('0x3c')]=_[_0xc74f('0x3e')](_0x1dec60[_0xc74f('0x3c')],{'$or':_[_0xc74f('0x2a')](_0x148d34,function(_0x5c2ae6){if(_0x5c2ae6['type']!==_0xc74f('0x3f')){var _0x408167={};_0x408167[_0x5c2ae6[_0xc74f('0x28')]]={'$like':'%'+_0x2f88cc[_0xc74f('0x32')][_0xc74f('0x40')]+'%'};return _0x408167;}})});}_0x1dec60=_[_0xc74f('0x3e')]({},_0x1dec60,_0x2f88cc[_0xc74f('0x41')]);var _0x10bbb4={'where':_0x1dec60[_0xc74f('0x3c')]};return db[_0xc74f('0x42')]['count'](_0x10bbb4)['then'](function(_0x2d5d94){_0x163271[_0xc74f('0x20')]=_0x2d5d94;if(_0x2f88cc[_0xc74f('0x32')][_0xc74f('0x43')]){_0x1dec60['include']=[{'all':!![]}];}return db[_0xc74f('0x42')][_0xc74f('0x44')](_0x1dec60);})['then'](function(_0x3e21af){_0x163271['rows']=_0x3e21af;return _0x163271;})[_0xc74f('0x26')](respondWithFilteredResult(_0x4b7e54,_0x1dec60))['catch'](handleError(_0x4b7e54,null));};exports[_0xc74f('0x45')]=function(_0x1e5981,_0x1f91c2){var _0x4042be={'raw':![],'where':{'id':_0x1e5981['params']['id']}},_0x454a73={};_0x454a73[_0xc74f('0x2f')]=_['keys'](db[_0xc74f('0x42')][_0xc74f('0x2b')]);_0x454a73[_0xc74f('0x32')]=_[_0xc74f('0x33')](_0x1e5981[_0xc74f('0x32')]);_0x454a73[_0xc74f('0x34')]=_[_0xc74f('0x36')](_0x454a73[_0xc74f('0x2f')],_0x454a73[_0xc74f('0x32')]);_0x4042be[_0xc74f('0x35')]=_[_0xc74f('0x36')](_0x454a73[_0xc74f('0x2f')],qs[_0xc74f('0x37')](_0x1e5981[_0xc74f('0x32')][_0xc74f('0x37')]));_0x4042be['attributes']=_0x4042be['attributes'][_0xc74f('0x38')]?_0x4042be[_0xc74f('0x35')]:_0x454a73['model'];if(_0x1e5981[_0xc74f('0x32')][_0xc74f('0x43')]){_0x4042be[_0xc74f('0x46')]=[{'all':!![]}];}_0x4042be=_['merge']({},_0x4042be,_0x1e5981[_0xc74f('0x41')]);return db['VoiceRecording'][_0xc74f('0x47')](_0x4042be)[_0xc74f('0x26')](handleEntityNotFound(_0x1f91c2,null))['then'](respondWithResult(_0x1f91c2,null))['catch'](handleError(_0x1f91c2,null));};exports[_0xc74f('0x48')]=function(_0x53ad2f,_0x492b3e){return db['VoiceRecording']['create'](_0x53ad2f[_0xc74f('0x49')],{})[_0xc74f('0x26')](respondWithResult(_0x492b3e,0xc9))[_0xc74f('0x4a')](handleError(_0x492b3e,null));};exports[_0xc74f('0x25')]=function(_0x6854bf,_0x428525){if(_0x6854bf['body']['id']){delete _0x6854bf['body']['id'];}return db[_0xc74f('0x42')][_0xc74f('0x47')]({'where':{'id':_0x6854bf[_0xc74f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x428525,null))[_0xc74f('0x26')](saveUpdates(_0x6854bf['body'],null))[_0xc74f('0x26')](respondWithResult(_0x428525,null))[_0xc74f('0x4a')](handleError(_0x428525,null));};exports[_0xc74f('0x4c')]=function(_0x15b94d,_0x14e39a){return db[_0xc74f('0x42')][_0xc74f('0x4c')]()[_0xc74f('0x26')](respondWithResult(_0x14e39a,null))[_0xc74f('0x4a')](handleError(_0x14e39a,null));};exports[_0xc74f('0x4d')]=function(_0x503675,_0x33639a,_0x2cd68a){var _0x3e16ba=require(_0xc74f('0x4e'));var _0x3b083a=![];var _0x3f88ba={};if(_0x503675[_0xc74f('0x32')][_0xc74f('0x2d')]&&_0x503675[_0xc74f('0x32')][_0xc74f('0x2d')]==='uniqueid'){_0x3f88ba[_0xc74f('0x4f')]=_0x503675[_0xc74f('0x4b')]['id'];}else{_0x3f88ba['id']=_0x503675[_0xc74f('0x4b')]['id'];}return db[_0xc74f('0x42')][_0xc74f('0x47')]({'where':_0x3f88ba,'attributes':['id',_0xc74f('0x50')],'raw':!![]})[_0xc74f('0x26')](handleEntityNotFound(_0x33639a,null))[_0xc74f('0x26')](function(_0x456b0c){if(_0x456b0c){var _0x24aee6=_0x456b0c[_0xc74f('0x50')];var _0x472114=util[_0xc74f('0x31')](_0xc74f('0x51'),_0x24aee6);if(fs['existsSync'](_0x472114)){_0x3b083a=!![];return _0x3e16ba[_0xc74f('0x52')](_0x472114,_0x24aee6,config['secrets'][_0xc74f('0x53')])[_0xc74f('0x26')](function(){return _0x456b0c;});}return _0x456b0c;}})[_0xc74f('0x26')](function(_0x266ef3){if(_0x266ef3){var _0xcf438b=_0x266ef3['value'];if(!fs['existsSync'](_0xcf438b)){throw new db['Sequelize'][(_0xc74f('0x54'))](_0xc74f('0x55'));}if(_0x266ef3[_0xc74f('0x56')]){return _0x33639a[_0xc74f('0x4d')](_0xcf438b,_0x266ef3[_0xc74f('0x56')]+path[_0xc74f('0x57')](_0xcf438b),function(){if(_0x3b083a){fs[_0xc74f('0x58')](_0xcf438b);}});}else{return _0x33639a[_0xc74f('0x4d')](_0xcf438b,function(_0x4e4fc6){if(_0x3b083a){fs[_0xc74f('0x58')](_0xcf438b);}});}}})[_0xc74f('0x4a')](function(_0x1f7982){if(_0x1f7982[_0xc74f('0x59')]===_0xc74f('0x55')){_0x33639a['status'](0x194)[_0xc74f('0x29')](_0xc74f('0x5a'));}else{return handleError(_0x33639a,null);}});};exports[_0xc74f('0x5b')]=function(_0x3439c2,_0x457afb,_0x1dae0a){var _0xba7b9b=require(_0xc74f('0x4e'));var _0x1ce873=![];var _0x263c83={'$and':[db[_0xc74f('0x5c')][_0xc74f('0x3c')](db[_0xc74f('0x5c')]['fn'](_0xc74f('0x5d'),db[_0xc74f('0x5c')][_0xc74f('0x5e')]('uniqueid')),_0x3439c2['query'][_0xc74f('0x5f')])]};if(_0x3439c2[_0xc74f('0x32')][_0xc74f('0x2d')]&&_0x3439c2['query'][_0xc74f('0x2d')]===_0xc74f('0x4f')){_0x263c83[_0xc74f('0x60')][_0xc74f('0x61')]({'uniqueid':_0x3439c2['params']['id']});}else{_0x263c83[_0xc74f('0x60')][_0xc74f('0x61')]({'id':_0x3439c2[_0xc74f('0x4b')]['id']});}return db['VoiceRecording']['find']({'where':_0x263c83,'attributes':['id',_0xc74f('0x50')],'raw':!![]})[_0xc74f('0x26')](handleEntityNotFound(_0x457afb,null))[_0xc74f('0x26')](function(_0x33b17b){if(_0x33b17b){var _0xc5f57f=util[_0xc74f('0x31')](_0xc74f('0x51'),_0x33b17b[_0xc74f('0x50')]);if(fs['existsSync'](_0xc5f57f)){_0x1ce873=!![];return _0xba7b9b[_0xc74f('0x52')](_0xc5f57f,_0x33b17b['value'],config[_0xc74f('0x62')]['recording'])[_0xc74f('0x26')](function(){return _0x33b17b;});}return _0x33b17b;}})[_0xc74f('0x26')](function(_0x13b861){if(_0x13b861){if(!fs[_0xc74f('0x63')](_0x13b861[_0xc74f('0x50')])){throw new db['Sequelize'][(_0xc74f('0x54'))](_0xc74f('0x55'));}if(_0x13b861[_0xc74f('0x56')]){return _0x457afb['download'](_0x13b861[_0xc74f('0x50')],_0x13b861[_0xc74f('0x56')]+path[_0xc74f('0x57')](_0x13b861[_0xc74f('0x50')]),function(){if(_0x1ce873){fs['unlink'](_0x13b861[_0xc74f('0x50')]);}});}else{return _0x457afb[_0xc74f('0x4d')](_0x13b861[_0xc74f('0x50')],function(_0x3cf874){if(_0x1ce873){fs[_0xc74f('0x58')](_0x13b861[_0xc74f('0x50')]);}});}}})[_0xc74f('0x4a')](handleError(_0x457afb,null));};exports['destroy']=function(_0x43c174,_0x2a8acf){return db[_0xc74f('0x42')][_0xc74f('0x47')]({'where':{'id':_0x43c174[_0xc74f('0x4b')]['id']}})[_0xc74f('0x26')](function(_0x5b115d){if(_['isNil'](_0x5b115d)){throw new ReferenceError(_0xc74f('0x64'));}return _0x5b115d;})[_0xc74f('0x26')](function(_0x5eb355){var _0x247218=_0x5eb355[_0xc74f('0x50')];logger[_0xc74f('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x247218);if(!_[_0xc74f('0x66')](_0x5eb355['value'])&&fs['existsSync'](_0x247218)){logger[_0xc74f('0x65')]('File:\x20\x22'+_0x247218+_0xc74f('0x67'));fs[_0xc74f('0x68')](_0x247218);}_0x247218=_0x247218+'.cypher';if(!_[_0xc74f('0x66')](_0x5eb355[_0xc74f('0x50')])&&fs[_0xc74f('0x63')](_0x247218)){logger[_0xc74f('0x65')](_0xc74f('0x69')+_0x247218+_0xc74f('0x67'));fs[_0xc74f('0x68')](_0x247218);}return _0x5eb355;})['then'](function(_0x4c0944){if(!_0x4c0944)throw new InternalError();return _0x4c0944[_0xc74f('0x27')]();})[_0xc74f('0x26')](function(){_0x2a8acf['status'](0xcc)[_0xc74f('0x1a')]();})[_0xc74f('0x4a')](handleError(_0x2a8acf,null));};function getBucketslist(_0x557155,_0x589e97,_0x2c9786){return new Promise(function(_0x4f2f7c,_0x324ffb){var _0x1fd652=new AWS['S3']({'accessKeyId':_0x589e97,'secretAccessKey':_0x557155,'region':_0x2c9786});_0x1fd652[_0xc74f('0x6a')]({},function(_0x38a812,_0x25803b){if(_0x38a812){return _0x324ffb(_0x38a812);}else{return _0x4f2f7c(_0x25803b);}});});}function createBucket(_0x347815,_0x4c214,_0x57d94e,_0x18bb86){return new Promise(function(_0x3616da,_0x455373){var _0x3538c2=new AWS['S3']({'accessKeyId':_0x4c214,'secretAccessKey':_0x347815,'region':_0x57d94e});_0x3538c2[_0xc74f('0x6b')]({'Bucket':_0x18bb86},function(_0x1343c4,_0x52fe02){if(_0x1343c4){return _0x455373(_0x1343c4);}else{return _0x3616da(_0x52fe02);}});});}function uploadFile(_0x2dd9cc,_0x2937c2,_0x516d0f,_0x522333,_0x5cb8c7,_0x189087){return new Promise(function(_0x5b763f,_0x53539a){var _0xc8337d=new AWS['S3']({'accessKeyId':_0x2937c2,'secretAccessKey':_0x2dd9cc,'region':_0x516d0f});_0xc8337d['upload']({'Bucket':_0x522333,'Key':_0x5cb8c7,'Body':_0x189087},function(_0x1a65b4,_0x2c3847){if(_0x1a65b4){return _0x53539a(_0x1a65b4);}else{return _0x5b763f(_0x2c3847);}});});}function startTranscribe(_0x4402b4,_0x2ed1b8,_0x1bde86,_0x188103,_0x2b87b3,_0xe0fd1b){return new Promise(function(_0x539e22,_0x232ae1){var _0xe6d68d=new AWS[(_0xc74f('0x6c'))]({'accessKeyId':_0x2ed1b8,'secretAccessKey':_0x4402b4,'region':_0x1bde86});_0xe6d68d[_0xc74f('0x6d')]({'TranscriptionJobName':_0x188103,'LanguageCode':_0x2b87b3,'Media':{'MediaFileUri':_0xe0fd1b}},function(_0x3f1ab9,_0x40f810){if(_0x3f1ab9){return _0x232ae1(_0x3f1ab9);}else{return _0x539e22(_0x40f810);}});});}function transcribe(_0x46e4ac,_0x4b0bb4,_0x3336c0,_0x528d9c,_0x1b5ccb,_0x20eb9e,_0x17833f){return new Promise(function(_0x56c1cc,_0x36c6fe){var _0x47559d={};logger[_0xc74f('0x65')](util[_0xc74f('0x31')](_0xc74f('0x6e'),_0x46e4ac,_0x1b5ccb));return uploadFile(_0x4b0bb4,_0x3336c0,_0x528d9c,_0x1b5ccb,path[_0xc74f('0x6f')](_0x20eb9e),fs[_0xc74f('0x70')](_0x20eb9e))[_0xc74f('0x26')](function(_0x208908){logger[_0xc74f('0x65')](util[_0xc74f('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x46e4ac,_0x1b5ccb,_0x208908[_0xc74f('0x71')]));_0x47559d[_0xc74f('0x72')]=_0x208908['Bucket'];_0x47559d[_0xc74f('0x73')]=_0x208908[_0xc74f('0x71')];logger[_0xc74f('0x65')](util[_0xc74f('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x46e4ac));return startTranscribe(_0x4b0bb4,_0x3336c0,_0x528d9c,uuidv4(),_0x17833f,_0x208908[_0xc74f('0x71')]);})[_0xc74f('0x26')](function(_0x56e52e){logger[_0xc74f('0x65')](util['format'](_0xc74f('0x74'),_0x46e4ac,_0x56e52e[_0xc74f('0x75')]['TranscriptionJobName']));_0x47559d[_0xc74f('0x76')]=_0x56e52e[_0xc74f('0x75')][_0xc74f('0x77')];_0x47559d[_0xc74f('0x78')]=_0x56e52e[_0xc74f('0x75')]['TranscriptionJobStatus'];return _0x56c1cc(_0x47559d);})['catch'](function(_0x4b8c05){return _0x36c6fe(_0x4b8c05);});});}exports[_0xc74f('0x79')]=function(_0x552b7b,_0x54a42e,_0x3a9459){var _0x86a559;var _0x3cd9ba;var _0x251e17;var _0x1fd6a2=require('../../components/encryptor');return db['VoiceRecording'][_0xc74f('0x7a')]({'where':{'id':_0x552b7b[_0xc74f('0x4b')]['id']}})['then'](function(_0x4c3b1e){if(_0x4c3b1e){var _0x400e36=util['format'](_0xc74f('0x51'),_0x4c3b1e['value']);if(fs[_0xc74f('0x63')](_0x400e36)){cypher=!![];return _0x1fd6a2['decryptFile'](_0x400e36,_0x4c3b1e[_0xc74f('0x50')],config[_0xc74f('0x62')][_0xc74f('0x53')])['then'](function(){return _0x4c3b1e;});}return _0x4c3b1e;}})[_0xc74f('0x26')](function(_0x5b8cf9){if(!_0x5b8cf9){throw new db[(_0xc74f('0x7b'))][(_0xc74f('0x54'))]('Voice\x20Recording\x20not\x20found');}_0x3cd9ba=_0x5b8cf9;return db[_0xc74f('0x7c')][_0xc74f('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x54a42e,null))['then'](function(_0x42557b){if(_0x42557b){_0x86a559=_0x42557b;if(!_0x86a559[_0xc74f('0x7d')]||!_0x86a559[_0xc74f('0x7e')]||!_0x86a559[_0xc74f('0x7f')]||!_0x86a559[_0xc74f('0x80')]||!_0x86a559['bucket']){throw new db[(_0xc74f('0x7b'))]['ValidationError'](_0xc74f('0x81'));}if(_0x552b7b[_0xc74f('0x49')]['runSentiment']&&(!_0x86a559[_0xc74f('0x82')]||!_0x86a559[_0xc74f('0x83')]||!_0x86a559[_0xc74f('0x84')]||!_0x86a559[_0xc74f('0x80')]||!_0x86a559[_0xc74f('0x72')])){throw new db['Sequelize'][(_0xc74f('0x54'))](_0xc74f('0x85'));}return db[_0xc74f('0x86')]['findOne']({'where':{'id':_0x86a559['transcribeAccountId']}});}})[_0xc74f('0x26')](function(_0x3d6021){if(!_0x3d6021){throw new db[(_0xc74f('0x7b'))][(_0xc74f('0x54'))](_0xc74f('0x87'));}if(!_0x3d6021[_0xc74f('0x88')]||!_0x3d6021[_0xc74f('0x89')]){throw new db['Sequelize'][(_0xc74f('0x54'))](_0xc74f('0x8a'));}_0x251e17=_0x3d6021;return getBucketslist(_0x251e17['data1'],_0x251e17[_0xc74f('0x89')],_0x86a559[_0xc74f('0x7f')]);})[_0xc74f('0x26')](function(_0x47d95f){if(_0x47d95f&&_0x47d95f[_0xc74f('0x8b')]){var _0x307ecb=_['find'](_0x47d95f['Buckets'],function(_0x290426){return _0x290426['Name']===_0x86a559[_0xc74f('0x72')];});if(!_0x307ecb){logger[_0xc74f('0x65')](util['format'](_0xc74f('0x8c'),_0x552b7b['params']['id'],_0x86a559[_0xc74f('0x72')]));return createBucket(_0x251e17[_0xc74f('0x88')],_0x251e17[_0xc74f('0x89')],_0x86a559[_0xc74f('0x7f')],_0x86a559[_0xc74f('0x72')]);}logger[_0xc74f('0x65')](util[_0xc74f('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x552b7b[_0xc74f('0x4b')]['id'],_0x86a559['bucket']));return;}})['then'](function(_0x43d690){if(_0x3cd9ba[_0xc74f('0x78')]==='NEW'){return transcribe(_0x552b7b[_0xc74f('0x4b')]['id'],_0x251e17[_0xc74f('0x88')],_0x251e17[_0xc74f('0x89')],_0x86a559['transcribeRegion'],_0x86a559[_0xc74f('0x72')],_0x3cd9ba[_0xc74f('0x50')],_0x86a559[_0xc74f('0x80')]);}else{logger[_0xc74f('0x65')](util[_0xc74f('0x31')](_0xc74f('0x8d'),_0x552b7b[_0xc74f('0x4b')]['id']));return{'transcribeStatus':_0xc74f('0x8e')};}})[_0xc74f('0x26')](function(_0x463885){if(_0x463885){_0x463885[_0xc74f('0x8f')]=_0x552b7b[_0xc74f('0x49')][_0xc74f('0x90')];return _0x3cd9ba[_0xc74f('0x91')](_0x463885);}})[_0xc74f('0x26')](respondWithResult(_0x54a42e,null))[_0xc74f('0x4a')](handleError(_0x54a42e,null));};function writeFile(_0x11312a,_0x576a75){return new Promise(function(_0x5e92a0,_0x3ffed2){fs[_0xc74f('0x92')](_0x576a75,_0x11312a,function(_0x1e52a6,_0x13f710){if(_0x1e52a6){return _0x3ffed2(_0x1e52a6);}else{return _0x5e92a0(_0x13f710);}});});}exports[_0xc74f('0x93')]=function(_0x420633,_0x3cc16a,_0x8e9fdf){return db[_0xc74f('0x42')]['findOne']({'where':{'id':_0x420633[_0xc74f('0x4b')]['id']}})[_0xc74f('0x26')](handleEntityNotFound(_0x3cc16a))[_0xc74f('0x26')](function(_0x509a22){if(_0x509a22&&_0x509a22[_0xc74f('0x94')]){var _0x3f9c1c=_0x509a22[_0xc74f('0x94')];var _0x21d1d4=config[_0xc74f('0x95')]+_0xc74f('0x96')+_0x509a22['id']+'.txt';if(fs['existsSync'](_0x21d1d4)){return _0x21d1d4;}return writeFile(_0x3f9c1c,_0x21d1d4)[_0xc74f('0x26')](function(){return _0x21d1d4;});}else{throw new db['Sequelize'][(_0xc74f('0x54'))]('Transcript\x20not\x20available');}})[_0xc74f('0x26')](function(_0x216501){return _0x3cc16a[_0xc74f('0x4d')](_0x216501);})[_0xc74f('0x4a')](handleError(_0x3cc16a));}; \ No newline at end of file +var _0xf859=['startTranscriptionJob','readFileSync','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','runSentiment','sentimentRegion','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','findAll','rows','show','params','rawAttributes','filters','include','options','find','catch','create','body','describe','download','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','VoiceRecording\x20not\x20found','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','Sequelize','ValidationError','filename','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','TranscribeService'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf859,0xb8));var _0x9f85=function(_0x3ad5fc,_0x45a830){_0x3ad5fc=_0x3ad5fc-0x0;var _0x23aa52=_0xf859[_0x3ad5fc];return _0x23aa52;};'use strict';var emlformat=require(_0x9f85('0x0'));var rimraf=require(_0x9f85('0x1'));var zipdir=require(_0x9f85('0x2'));var jsonpatch=require(_0x9f85('0x3'));var rp=require('request-promise');var moment=require(_0x9f85('0x4'));var BPromise=require(_0x9f85('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9f85('0x6'));var sox=require(_0x9f85('0x7'));var csv=require('to-csv');var ejs=require(_0x9f85('0x8'));var fs=require('fs');var fs_extra=require(_0x9f85('0x9'));var _=require(_0x9f85('0xa'));var squel=require('squel');var crypto=require(_0x9f85('0xb'));var jsforce=require(_0x9f85('0xc'));var deskjs=require(_0x9f85('0xd'));var toCsv=require(_0x9f85('0xe'));var querystring=require(_0x9f85('0xf'));var Papa=require(_0x9f85('0x10'));var AWS=require(_0x9f85('0x11'));var uuidv4=require(_0x9f85('0x12'));var Redis=require(_0x9f85('0x13'));var authService=require(_0x9f85('0x14'));var qs=require(_0x9f85('0x15'));var as=require(_0x9f85('0x16'));var hardwareService=require(_0x9f85('0x17'));var logger=require(_0x9f85('0x18'))(_0x9f85('0x19'));var utils=require('../../config/utils');var config=require(_0x9f85('0x1a'));var licenseUtil=require(_0x9f85('0x1b'));var db=require(_0x9f85('0x1c'))['db'];function respondWithStatusCode(_0x38ac7a,_0x10c70d){_0x10c70d=_0x10c70d||0xcc;return function(_0x1ce556){if(_0x1ce556){return _0x38ac7a[_0x9f85('0x1d')](_0x10c70d);}return _0x38ac7a[_0x9f85('0x1e')](_0x10c70d)[_0x9f85('0x1f')]();};}function respondWithResult(_0x69521,_0x10a3a0){_0x10a3a0=_0x10a3a0||0xc8;return function(_0x2ccfaf){if(_0x2ccfaf){return _0x69521[_0x9f85('0x1e')](_0x10a3a0)[_0x9f85('0x20')](_0x2ccfaf);}};}function respondWithFilteredResult(_0xe5d522,_0x37017d){return function(_0x3776ba){if(_0x3776ba){var _0x466afe=typeof _0x37017d[_0x9f85('0x21')]===_0x9f85('0x22')&&typeof _0x37017d['limit']==='undefined';var _0x348bd6=_0x3776ba['count'];var _0x5e2dad=_0x466afe?0x0:_0x37017d[_0x9f85('0x21')];var _0x15d37c=_0x466afe?_0x3776ba[_0x9f85('0x23')]:_0x37017d[_0x9f85('0x21')]+_0x37017d[_0x9f85('0x24')];var _0x1040a7;if(_0x15d37c>=_0x348bd6){_0x15d37c=_0x348bd6;_0x1040a7=0xc8;}else{_0x1040a7=0xce;}_0xe5d522[_0x9f85('0x1e')](_0x1040a7);return _0xe5d522[_0x9f85('0x25')](_0x9f85('0x26'),_0x5e2dad+'-'+_0x15d37c+'/'+_0x348bd6)['json'](_0x3776ba);}return null;};}function patchUpdates(_0x1bf7b3){return function(_0x59e6c6){try{jsonpatch[_0x9f85('0x27')](_0x59e6c6,_0x1bf7b3,!![]);}catch(_0x3b2b66){return BPromise[_0x9f85('0x28')](_0x3b2b66);}return _0x59e6c6[_0x9f85('0x29')]();};}function saveUpdates(_0xb1124d,_0x21643b){return function(_0xd62f4e){if(_0xd62f4e){return _0xd62f4e[_0x9f85('0x2a')](_0xb1124d)[_0x9f85('0x2b')](function(_0x1ca0eb){return _0x1ca0eb;});}return null;};}function removeEntity(_0x18311f,_0x2f4243){return function(_0xf88ff6){if(_0xf88ff6){return _0xf88ff6[_0x9f85('0x2c')]()[_0x9f85('0x2b')](function(){_0x18311f[_0x9f85('0x1e')](0xcc)[_0x9f85('0x1f')]();});}};}function handleEntityNotFound(_0x3952ea,_0x46b043){return function(_0x47bb77){if(!_0x47bb77){_0x3952ea[_0x9f85('0x1d')](0x194);}return _0x47bb77;};}function handleError(_0x20d766,_0x1d86b9){_0x1d86b9=_0x1d86b9||0x1f4;return function(_0x4ef5e1){logger['error'](_0x4ef5e1['stack']);if(_0x4ef5e1['name']){delete _0x4ef5e1[_0x9f85('0x2d')];}_0x20d766[_0x9f85('0x1e')](_0x1d86b9)[_0x9f85('0x2e')](_0x4ef5e1);};}exports[_0x9f85('0x2f')]=function(_0x257619,_0x275feb){var _0xadfe41={},_0x13d1e6={},_0xec3299={'count':0x0,'rows':[]};var _0x49601b=_[_0x9f85('0x30')](db[_0x9f85('0x31')]['rawAttributes'],function(_0x2e26c6){return{'name':_0x2e26c6[_0x9f85('0x32')],'type':_0x2e26c6[_0x9f85('0x33')][_0x9f85('0x34')]};});_0x13d1e6[_0x9f85('0x35')]=_[_0x9f85('0x36')](_[_0x9f85('0x30')](_0x49601b,_0x9f85('0x2d')),['format']);_0x13d1e6['query']=_[_0x9f85('0x37')](_0x257619['query']);_0x13d1e6['filters']=_[_0x9f85('0x38')](_0x13d1e6['model'],_0x13d1e6[_0x9f85('0x39')]);_0xadfe41[_0x9f85('0x3a')]=_['intersection'](_0x13d1e6[_0x9f85('0x35')],qs[_0x9f85('0x3b')](_0x257619[_0x9f85('0x39')][_0x9f85('0x3b')]));_0xadfe41['attributes']=_0xadfe41[_0x9f85('0x3a')][_0x9f85('0x3c')]?_0xadfe41['attributes']:_0x13d1e6[_0x9f85('0x35')];if(!_0x257619['query'][_0x9f85('0x3d')](_0x9f85('0x3e'))){_0xadfe41[_0x9f85('0x24')]=qs[_0x9f85('0x24')](_0x257619[_0x9f85('0x39')][_0x9f85('0x24')]);_0xadfe41[_0x9f85('0x21')]=qs[_0x9f85('0x21')](_0x257619[_0x9f85('0x39')]['offset']);}_0xadfe41[_0x9f85('0x3f')]=qs[_0x9f85('0x40')](_0x257619[_0x9f85('0x39')][_0x9f85('0x40')]);_0xadfe41['where']=qs['filters'](_['pick'](_0x257619[_0x9f85('0x39')],_0x13d1e6['filters']),_0x49601b);if(_0x257619[_0x9f85('0x39')][_0x9f85('0x41')]){_0xadfe41[_0x9f85('0x42')]=_[_0x9f85('0x43')](_0xadfe41['where'],{'$or':_[_0x9f85('0x30')](_0x49601b,function(_0x1f6a2d){if(_0x1f6a2d['type']!==_0x9f85('0x44')){var _0x3e22c2={};_0x3e22c2[_0x1f6a2d['name']]={'$like':'%'+_0x257619[_0x9f85('0x39')]['filter']+'%'};return _0x3e22c2;}})});}_0xadfe41=_[_0x9f85('0x43')]({},_0xadfe41,_0x257619['options']);var _0x5c2a0a={'where':_0xadfe41['where']};return db['VoiceRecording'][_0x9f85('0x23')](_0x5c2a0a)[_0x9f85('0x2b')](function(_0x3e7117){_0xec3299[_0x9f85('0x23')]=_0x3e7117;if(_0x257619[_0x9f85('0x39')]['includeAll']){_0xadfe41['include']=[{'all':!![]}];}return db[_0x9f85('0x31')][_0x9f85('0x45')](_0xadfe41);})[_0x9f85('0x2b')](function(_0x466f6e){_0xec3299[_0x9f85('0x46')]=_0x466f6e;return _0xec3299;})[_0x9f85('0x2b')](respondWithFilteredResult(_0x275feb,_0xadfe41))['catch'](handleError(_0x275feb,null));};exports[_0x9f85('0x47')]=function(_0x469f48,_0x57429e){var _0x19aaf0={'raw':![],'where':{'id':_0x469f48[_0x9f85('0x48')]['id']}},_0xfaf415={};_0xfaf415[_0x9f85('0x35')]=_[_0x9f85('0x37')](db[_0x9f85('0x31')][_0x9f85('0x49')]);_0xfaf415['query']=_['keys'](_0x469f48['query']);_0xfaf415[_0x9f85('0x4a')]=_[_0x9f85('0x38')](_0xfaf415['model'],_0xfaf415[_0x9f85('0x39')]);_0x19aaf0['attributes']=_[_0x9f85('0x38')](_0xfaf415['model'],qs[_0x9f85('0x3b')](_0x469f48[_0x9f85('0x39')][_0x9f85('0x3b')]));_0x19aaf0[_0x9f85('0x3a')]=_0x19aaf0[_0x9f85('0x3a')][_0x9f85('0x3c')]?_0x19aaf0[_0x9f85('0x3a')]:_0xfaf415['model'];if(_0x469f48[_0x9f85('0x39')]['includeAll']){_0x19aaf0[_0x9f85('0x4b')]=[{'all':!![]}];}_0x19aaf0=_[_0x9f85('0x43')]({},_0x19aaf0,_0x469f48[_0x9f85('0x4c')]);return db[_0x9f85('0x31')][_0x9f85('0x4d')](_0x19aaf0)[_0x9f85('0x2b')](handleEntityNotFound(_0x57429e,null))[_0x9f85('0x2b')](respondWithResult(_0x57429e,null))[_0x9f85('0x4e')](handleError(_0x57429e,null));};exports[_0x9f85('0x4f')]=function(_0x1129d2,_0x58cc9b){return db[_0x9f85('0x31')][_0x9f85('0x4f')](_0x1129d2[_0x9f85('0x50')],{})['then'](respondWithResult(_0x58cc9b,0xc9))[_0x9f85('0x4e')](handleError(_0x58cc9b,null));};exports[_0x9f85('0x2a')]=function(_0x194b4e,_0x1dc92c){if(_0x194b4e[_0x9f85('0x50')]['id']){delete _0x194b4e[_0x9f85('0x50')]['id'];}return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':{'id':_0x194b4e['params']['id']}})[_0x9f85('0x2b')](handleEntityNotFound(_0x1dc92c,null))[_0x9f85('0x2b')](saveUpdates(_0x194b4e[_0x9f85('0x50')],null))[_0x9f85('0x2b')](respondWithResult(_0x1dc92c,null))[_0x9f85('0x4e')](handleError(_0x1dc92c,null));};exports[_0x9f85('0x51')]=function(_0x1e19e6,_0x47728d){return db[_0x9f85('0x31')][_0x9f85('0x51')]()['then'](respondWithResult(_0x47728d,null))[_0x9f85('0x4e')](handleError(_0x47728d,null));};exports[_0x9f85('0x52')]=function(_0x2260e4,_0x446271,_0x236fbe){var _0x3a90fb=require('../../components/encryptor');var _0x16280c=![];var _0x182c6d={};if(_0x2260e4['query'][_0x9f85('0x33')]&&_0x2260e4['query'][_0x9f85('0x33')]==='uniqueid'){_0x182c6d[_0x9f85('0x53')]=_0x2260e4[_0x9f85('0x48')]['id'];}else{_0x182c6d['id']=_0x2260e4[_0x9f85('0x48')]['id'];}return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':_0x182c6d,'attributes':['id',_0x9f85('0x54')],'raw':!![]})[_0x9f85('0x2b')](handleEntityNotFound(_0x446271,null))[_0x9f85('0x2b')](function(_0x23c8b9){if(_0x23c8b9){var _0x1e23ba=_0x23c8b9[_0x9f85('0x54')];var _0x22f2dc=util[_0x9f85('0x55')](_0x9f85('0x56'),_0x1e23ba);if(fs[_0x9f85('0x57')](_0x22f2dc)){_0x16280c=!![];return _0x3a90fb[_0x9f85('0x58')](_0x22f2dc,_0x1e23ba,config[_0x9f85('0x59')][_0x9f85('0x5a')])[_0x9f85('0x2b')](function(){return _0x23c8b9;});}return _0x23c8b9;}})['then'](function(_0x5205d3){if(_0x5205d3){var _0x52fccb=_0x5205d3['value'];if(!fs[_0x9f85('0x57')](_0x52fccb)){throw new db['Sequelize']['ValidationError'](_0x9f85('0x5b'));}if(_0x5205d3['filename']){return _0x446271[_0x9f85('0x52')](_0x52fccb,_0x5205d3['filename']+path[_0x9f85('0x5c')](_0x52fccb),function(){if(_0x16280c){fs[_0x9f85('0x5d')](_0x52fccb);}});}else{return _0x446271[_0x9f85('0x52')](_0x52fccb,function(_0xed4d45){if(_0x16280c){fs[_0x9f85('0x5d')](_0x52fccb);}});}}})[_0x9f85('0x4e')](function(_0x3e3cce){if(_0x3e3cce[_0x9f85('0x5e')]==='VoiceRecording\x20not\x20found'){_0x446271[_0x9f85('0x1e')](0x194)[_0x9f85('0x2e')](_0x9f85('0x5f'));}else{return handleError(_0x446271,null);}});};exports[_0x9f85('0x60')]=function(_0x1a4dac,_0x1ab770,_0x2ff085){var _0x7298b1=require('../../components/encryptor');var _0x59abf1=![];var _0x509d8f={'$and':[db['sequelize'][_0x9f85('0x42')](db[_0x9f85('0x61')]['fn'](_0x9f85('0x62'),db['sequelize'][_0x9f85('0x63')](_0x9f85('0x53'))),_0x1a4dac['query'][_0x9f85('0x64')])]};if(_0x1a4dac[_0x9f85('0x39')][_0x9f85('0x33')]&&_0x1a4dac['query'][_0x9f85('0x33')]===_0x9f85('0x53')){_0x509d8f['$and']['push']({'uniqueid':_0x1a4dac[_0x9f85('0x48')]['id']});}else{_0x509d8f[_0x9f85('0x65')]['push']({'id':_0x1a4dac[_0x9f85('0x48')]['id']});}return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':_0x509d8f,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x1ab770,null))['then'](function(_0x5e73b8){if(_0x5e73b8){var _0x5928e1=util[_0x9f85('0x55')](_0x9f85('0x56'),_0x5e73b8[_0x9f85('0x54')]);if(fs['existsSync'](_0x5928e1)){_0x59abf1=!![];return _0x7298b1['decryptFile'](_0x5928e1,_0x5e73b8[_0x9f85('0x54')],config[_0x9f85('0x59')][_0x9f85('0x5a')])[_0x9f85('0x2b')](function(){return _0x5e73b8;});}return _0x5e73b8;}})['then'](function(_0x584098){if(_0x584098){if(!fs[_0x9f85('0x57')](_0x584098[_0x9f85('0x54')])){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('VoiceRecording\x20not\x20found');}if(_0x584098['filename']){return _0x1ab770['download'](_0x584098[_0x9f85('0x54')],_0x584098[_0x9f85('0x68')]+path[_0x9f85('0x5c')](_0x584098[_0x9f85('0x54')]),function(){if(_0x59abf1){fs[_0x9f85('0x5d')](_0x584098[_0x9f85('0x54')]);}});}else{return _0x1ab770[_0x9f85('0x52')](_0x584098[_0x9f85('0x54')],function(_0x3b89bd){if(_0x59abf1){fs['unlink'](_0x584098[_0x9f85('0x54')]);}});}}})[_0x9f85('0x4e')](handleError(_0x1ab770,null));};exports[_0x9f85('0x2c')]=function(_0x23a080,_0xb04d4b){return db[_0x9f85('0x31')][_0x9f85('0x4d')]({'where':{'id':_0x23a080[_0x9f85('0x48')]['id']}})[_0x9f85('0x2b')](function(_0x3041fe){if(_[_0x9f85('0x69')](_0x3041fe)){throw new ReferenceError(_0x9f85('0x6a'));}return _0x3041fe;})[_0x9f85('0x2b')](function(_0x3d9917){var _0x298f2b=_0x3d9917[_0x9f85('0x54')];logger[_0x9f85('0x6b')]('cancellazione\x20fisica\x20documento\x20%s',_0x298f2b);if(!_[_0x9f85('0x69')](_0x3d9917[_0x9f85('0x54')])&&fs['existsSync'](_0x298f2b)){logger[_0x9f85('0x6b')](_0x9f85('0x6c')+_0x298f2b+_0x9f85('0x6d'));fs[_0x9f85('0x6e')](_0x298f2b);}_0x298f2b=_0x298f2b+'.cypher';if(!_[_0x9f85('0x69')](_0x3d9917[_0x9f85('0x54')])&&fs[_0x9f85('0x57')](_0x298f2b)){logger['info']('File:\x20\x22'+_0x298f2b+_0x9f85('0x6d'));fs[_0x9f85('0x6e')](_0x298f2b);}return _0x3d9917;})[_0x9f85('0x2b')](function(_0x13a61e){if(!_0x13a61e)throw new InternalError();return _0x13a61e[_0x9f85('0x2c')]();})[_0x9f85('0x2b')](function(){_0xb04d4b[_0x9f85('0x1e')](0xcc)['end']();})[_0x9f85('0x4e')](handleError(_0xb04d4b,null));};function getBucketslist(_0x3d8d89,_0x824cf1,_0x3977a8){return new Promise(function(_0x5d55b0,_0xa634dd){var _0x274727=new AWS['S3']({'accessKeyId':_0x824cf1,'secretAccessKey':_0x3d8d89,'region':_0x3977a8});_0x274727[_0x9f85('0x6f')]({},function(_0x3e9125,_0x3a9721){if(_0x3e9125){return _0xa634dd(_0x3e9125);}else{return _0x5d55b0(_0x3a9721);}});});}function createBucket(_0x3697bc,_0x380af9,_0x55697e,_0x262079){return new Promise(function(_0x4d1785,_0x5720d9){var _0x3fcdd8=new AWS['S3']({'accessKeyId':_0x380af9,'secretAccessKey':_0x3697bc,'region':_0x55697e});_0x3fcdd8[_0x9f85('0x70')]({'Bucket':_0x262079},function(_0x2973bf,_0x236795){if(_0x2973bf){return _0x5720d9(_0x2973bf);}else{return _0x4d1785(_0x236795);}});});}function uploadFile(_0x27a3d5,_0x5b6831,_0x166fbc,_0x549676,_0x4bd88d,_0x49ed8e){return new Promise(function(_0x4593ec,_0x5bc088){var _0x119c57=new AWS['S3']({'accessKeyId':_0x5b6831,'secretAccessKey':_0x27a3d5,'region':_0x166fbc});_0x119c57['upload']({'Bucket':_0x549676,'Key':_0x4bd88d,'Body':_0x49ed8e},function(_0x50cfa2,_0x3d4854){if(_0x50cfa2){return _0x5bc088(_0x50cfa2);}else{return _0x4593ec(_0x3d4854);}});});}function startTranscribe(_0x4b2206,_0x5aa764,_0x30bab0,_0x5b64ea,_0x4a8eec,_0x53ef7b){return new Promise(function(_0x3b1468,_0x253391){var _0x204448=new AWS[(_0x9f85('0x71'))]({'accessKeyId':_0x5aa764,'secretAccessKey':_0x4b2206,'region':_0x30bab0});_0x204448[_0x9f85('0x72')]({'TranscriptionJobName':_0x5b64ea,'LanguageCode':_0x4a8eec,'Media':{'MediaFileUri':_0x53ef7b}},function(_0x55f1e9,_0x48a747){if(_0x55f1e9){return _0x253391(_0x55f1e9);}else{return _0x3b1468(_0x48a747);}});});}function transcribe(_0x1f7f78,_0x1d878e,_0x53df27,_0x208a0b,_0x1e5d99,_0x149ef3,_0x28f6f7){return new Promise(function(_0x35d9cf,_0x4fae9d){var _0x2a06a0={};logger[_0x9f85('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1f7f78,_0x1e5d99));return uploadFile(_0x1d878e,_0x53df27,_0x208a0b,_0x1e5d99,path['basename'](_0x149ef3),fs[_0x9f85('0x73')](_0x149ef3))['then'](function(_0x453e33){logger[_0x9f85('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1f7f78,_0x1e5d99,_0x453e33['Location']));_0x2a06a0[_0x9f85('0x74')]=_0x453e33[_0x9f85('0x75')];_0x2a06a0['location']=_0x453e33[_0x9f85('0x76')];logger['info'](util['format'](_0x9f85('0x77'),_0x1f7f78));return startTranscribe(_0x1d878e,_0x53df27,_0x208a0b,uuidv4(),_0x28f6f7,_0x453e33[_0x9f85('0x76')]);})['then'](function(_0x131075){logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x78'),_0x1f7f78,_0x131075['TranscriptionJob'][_0x9f85('0x79')]));_0x2a06a0['transcribeName']=_0x131075[_0x9f85('0x7a')]['TranscriptionJobName'];_0x2a06a0['transcribeStatus']=_0x131075[_0x9f85('0x7a')][_0x9f85('0x7b')];return _0x35d9cf(_0x2a06a0);})[_0x9f85('0x4e')](function(_0x500a9b){return _0x4fae9d(_0x500a9b);});});}exports[_0x9f85('0x7c')]=function(_0x567619,_0x692133,_0x33cb82){var _0x342c48;var _0x55034c;var _0x121cc9;var _0x2c83a9=require('../../components/encryptor');return db[_0x9f85('0x31')][_0x9f85('0x7d')]({'where':{'id':_0x567619[_0x9f85('0x48')]['id']}})[_0x9f85('0x2b')](function(_0x229c2f){if(_0x229c2f){var _0x110ad5=util[_0x9f85('0x55')](_0x9f85('0x56'),_0x229c2f[_0x9f85('0x54')]);if(fs['existsSync'](_0x110ad5)){cypher=!![];return _0x2c83a9[_0x9f85('0x58')](_0x110ad5,_0x229c2f[_0x9f85('0x54')],config[_0x9f85('0x59')][_0x9f85('0x5a')])['then'](function(){return _0x229c2f;});}return _0x229c2f;}})['then'](function(_0xe0c749){if(!_0xe0c749){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))](_0x9f85('0x7e'));}_0x55034c=_0xe0c749;return db[_0x9f85('0x7f')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x692133,null))[_0x9f85('0x2b')](function(_0xfa410c){if(_0xfa410c){_0x342c48=_0xfa410c;if(!_0x342c48['transcribe']||!_0x342c48[_0x9f85('0x80')]||!_0x342c48['transcribeRegion']||!_0x342c48[_0x9f85('0x81')]||!_0x342c48[_0x9f85('0x74')]){throw new db[(_0x9f85('0x66'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x567619[_0x9f85('0x50')][_0x9f85('0x82')]&&(!_0x342c48['sentiment']||!_0x342c48['sentimentAccountId']||!_0x342c48[_0x9f85('0x83')]||!_0x342c48[_0x9f85('0x81')]||!_0x342c48['bucket'])){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x9f85('0x84')]['findOne']({'where':{'id':_0x342c48[_0x9f85('0x80')]}});}})['then'](function(_0x4e9c5f){if(!_0x4e9c5f){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4e9c5f[_0x9f85('0x85')]||!_0x4e9c5f['data2']){throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))]('Cloud\x20Provider\x20not\x20configured');}_0x121cc9=_0x4e9c5f;return getBucketslist(_0x121cc9['data1'],_0x121cc9[_0x9f85('0x86')],_0x342c48['transcribeRegion']);})[_0x9f85('0x2b')](function(_0x1b42ee){if(_0x1b42ee&&_0x1b42ee[_0x9f85('0x87')]){var _0x4cdd23=_[_0x9f85('0x4d')](_0x1b42ee[_0x9f85('0x87')],function(_0x2c7b64){return _0x2c7b64[_0x9f85('0x88')]===_0x342c48[_0x9f85('0x74')];});if(!_0x4cdd23){logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x89'),_0x567619[_0x9f85('0x48')]['id'],_0x342c48[_0x9f85('0x74')]));return createBucket(_0x121cc9[_0x9f85('0x85')],_0x121cc9[_0x9f85('0x86')],_0x342c48[_0x9f85('0x8a')],_0x342c48[_0x9f85('0x74')]);}logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x8b'),_0x567619[_0x9f85('0x48')]['id'],_0x342c48[_0x9f85('0x74')]));return;}})[_0x9f85('0x2b')](function(_0x3091f9){if(_0x55034c[_0x9f85('0x8c')]===_0x9f85('0x8d')){return transcribe(_0x567619[_0x9f85('0x48')]['id'],_0x121cc9['data1'],_0x121cc9[_0x9f85('0x86')],_0x342c48[_0x9f85('0x8a')],_0x342c48[_0x9f85('0x74')],_0x55034c[_0x9f85('0x54')],_0x342c48[_0x9f85('0x81')]);}else{logger[_0x9f85('0x6b')](util[_0x9f85('0x55')](_0x9f85('0x8e'),_0x567619[_0x9f85('0x48')]['id']));return{'transcribeStatus':_0x9f85('0x8f')};}})['then'](function(_0x3803c1){if(_0x3803c1){_0x3803c1[_0x9f85('0x90')]=_0x567619[_0x9f85('0x50')][_0x9f85('0x82')];return _0x55034c[_0x9f85('0x91')](_0x3803c1);}})[_0x9f85('0x2b')](respondWithResult(_0x692133,null))['catch'](handleError(_0x692133,null));};function writeFile(_0xd36871,_0x90349a){return new Promise(function(_0x3bb2cb,_0x17fcc6){fs[_0x9f85('0x92')](_0x90349a,_0xd36871,function(_0x324777,_0x35b076){if(_0x324777){return _0x17fcc6(_0x324777);}else{return _0x3bb2cb(_0x35b076);}});});}exports['downloadTranscribe']=function(_0x11f5da,_0x10e101,_0x1f58cf){return db[_0x9f85('0x31')][_0x9f85('0x7d')]({'where':{'id':_0x11f5da[_0x9f85('0x48')]['id']}})[_0x9f85('0x2b')](handleEntityNotFound(_0x10e101))[_0x9f85('0x2b')](function(_0x2294bc){if(_0x2294bc&&_0x2294bc[_0x9f85('0x93')]){var _0x3d163b=_0x2294bc[_0x9f85('0x93')];var _0x5cd029=config['root']+'/server/files/transcribes/transcribe_'+_0x2294bc['id']+'.txt';if(fs[_0x9f85('0x57')](_0x5cd029)){return _0x5cd029;}return writeFile(_0x3d163b,_0x5cd029)[_0x9f85('0x2b')](function(){return _0x5cd029;});}else{throw new db[(_0x9f85('0x66'))][(_0x9f85('0x67'))](_0x9f85('0x94'));}})[_0x9f85('0x2b')](function(_0x1abcbc){return _0x10e101[_0x9f85('0x52')](_0x1abcbc);})[_0x9f85('0x4e')](handleError(_0x10e101));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3ecc342..5566c4b 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 _0x668b=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x668b,0x140));var _0xb668=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x668b[_0x130705];return _0x1fa991;};'use strict';var attributes=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea){return _0x51555f[_0xb668('0x2')]('VoiceRecording',attributes,{'tableName':_0xb668('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb668('0x4')]},{'name':_0xb668('0x5'),'fields':[_0xb668('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ce9=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6ce9,0x76));var _0x96ce=function(_0x52a35c,_0x428a26){_0x52a35c=_0x52a35c-0x0;var _0x5c9744=_0x6ce9[_0x52a35c];return _0x5c9744;};'use strict';var attributes=require(_0x96ce('0x0'));module[_0x96ce('0x1')]=function(_0x1d736b,_0x59dbfa){return _0x1d736b['define'](_0x96ce('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x96ce('0x3'),'fields':[_0x96ce('0x3')]},{'name':_0x96ce('0x4'),'fields':[_0x96ce('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 35eeb5c..d2f06c1 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 _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x578afc,_0x152817){var _0x5e46a2=function(_0x12947f){while(--_0x12947f){_0x578afc['push'](_0x578afc['shift']());}};_0x5e46a2(++_0x152817);}(_0x66fa,0x117));var _0xa66f=function(_0x46d11a,_0x29a6d9){_0x46d11a=_0x46d11a-0x0;var _0x5a08c7=_0x66fa[_0x46d11a];return _0x5a08c7;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x627e=['VoiceRecording','create','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateVoiceRecording','update','options','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption'];(function(_0x165b43,_0x3de42d){var _0x39e8b8=function(_0x48c8d6){while(--_0x48c8d6){_0x165b43['push'](_0x165b43['shift']());}};_0x39e8b8(++_0x3de42d);}(_0x627e,0x14a));var _0xe627=function(_0x59a595,_0x204da9){_0x59a595=_0x59a595-0x0;var _0x29bf1f=_0x627e[_0x59a595];return _0x29bf1f;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['VoiceRecording'][_0xe627('0x15')](_0x56559b['body'],{'raw':_0x56559b['options']?_0x56559b[_0xe627('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56559b[_0xe627('0x16')]?_0x56559b[_0xe627('0x16')]['where']||null:null,'attributes':_0x56559b['options']?_0x56559b['options'][_0xe627('0x17')]||null:null,'limit':_0x56559b[_0xe627('0x16')]?_0x56559b['options'][_0xe627('0x18')]||null:null})[_0xe627('0x19')](function(_0x4873e6){logger[_0xe627('0xb')](_0xe627('0x14'),_0x56559b);logger['debug'](_0xe627('0x14'),_0x56559b,JSON[_0xe627('0xf')](_0x4873e6));_0x538b22(_0x4873e6);})[_0xe627('0x13')](function(_0x536b02){logger[_0xe627('0x10')](_0xe627('0x14'),_0x536b02[_0xe627('0x12')],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0x536b02['message']));});});};exports[_0xe627('0x1a')]=function(_0x1fe192){var _0x1635a0=this;return new Promise(function(_0x29eb8e,_0xda614){var _0x40ab91=require(_0xe627('0x1b'));var _0x44c9f7;return db[_0xe627('0x1c')]['findOne']({'attributes':['id',_0xe627('0x1d')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5cd7c8){_0x44c9f7=_0x5cd7c8;return db[_0xe627('0x1e')][_0xe627('0x1f')](_0x1fe192['body']);})[_0xe627('0x19')](function(_0x54029d){if(_0x44c9f7[_0xe627('0x1d')]&&fs['existsSync'](_0x54029d[_0xe627('0x20')])){var _0x26833a=util['format'](_0xe627('0x21'),_0x54029d['value']);return _0x40ab91[_0xe627('0x22')](_0x54029d[_0xe627('0x20')],_0x26833a,config[_0xe627('0x23')][_0xe627('0x24')])[_0xe627('0x19')](function(){fs[_0xe627('0x25')](_0x54029d[_0xe627('0x20')]);logger[_0xe627('0xb')](_0xe627('0x26'));return _0x54029d;});}return _0x54029d;})[_0xe627('0x19')](function(_0x12ebc9){logger['info']('CreateVoiceRecording',_0x1fe192);logger[_0xe627('0x27')]('CreateVoiceRecording',_0x1fe192,JSON[_0xe627('0xf')](_0x12ebc9));_0x29eb8e(_0x12ebc9);})['catch'](function(_0x56d1d7){logger[_0xe627('0x10')]('CreateVoiceRecording',_0x56d1d7['message'],_0x1fe192);_0xda614(_0x1635a0[_0xe627('0x10')](0x1f4,_0x56d1d7[_0xe627('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 168cdef..52a4534 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 _0x6a9e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','describe','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x5e2e39,_0x5f43c1){var _0x8b3070=function(_0x233cae){while(--_0x233cae){_0x5e2e39['push'](_0x5e2e39['shift']());}};_0x8b3070(++_0x5f43c1);}(_0x6a9e,0x6a));var _0xe6a9=function(_0x2181d2,_0x33ff0e){_0x2181d2=_0x2181d2-0x0;var _0x52e2bb=_0x6a9e[_0x2181d2];return _0x52e2bb;};'use strict';var multer=require('multer');var util=require(_0xe6a9('0x0'));var path=require(_0xe6a9('0x1'));var timeout=require(_0xe6a9('0x2'));var express=require(_0xe6a9('0x3'));var router=express[_0xe6a9('0x4')]();var fs_extra=require(_0xe6a9('0x5'));var auth=require(_0xe6a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe6a9('0x7'));var controller=require(_0xe6a9('0x8'));router[_0xe6a9('0x9')]('/',auth['isAuthenticated'](),controller[_0xe6a9('0xa')]);router[_0xe6a9('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe6a9('0xb')]);router['get']('/:id',auth[_0xe6a9('0xc')](),controller[_0xe6a9('0xd')]);router[_0xe6a9('0xe')]('/',auth['isAuthenticated'](),controller[_0xe6a9('0xf')]);router[_0xe6a9('0x10')](_0xe6a9('0x11'),auth['isAuthenticated'](),controller[_0xe6a9('0x12')]);router[_0xe6a9('0x13')](_0xe6a9('0x11'),auth[_0xe6a9('0xc')](),controller['destroy']);module[_0xe6a9('0x14')]=router; \ No newline at end of file +var _0xc85e=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','show','create','put','update','delete','/:id','exports'];(function(_0x20b7aa,_0x3a5091){var _0x392922=function(_0x3f60b3){while(--_0x3f60b3){_0x20b7aa['push'](_0x20b7aa['shift']());}};_0x392922(++_0x3a5091);}(_0xc85e,0x90));var _0xec85=function(_0x44135a,_0x51b809){_0x44135a=_0x44135a-0x0;var _0x418199=_0xc85e[_0x44135a];return _0x418199;};'use strict';var multer=require('multer');var util=require(_0xec85('0x0'));var path=require(_0xec85('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xec85('0x2')]();var fs_extra=require(_0xec85('0x3'));var auth=require(_0xec85('0x4'));var interaction=require(_0xec85('0x5'));var config=require(_0xec85('0x6'));var controller=require(_0xec85('0x7'));router[_0xec85('0x8')]('/',auth[_0xec85('0x9')](),controller[_0xec85('0xa')]);router[_0xec85('0x8')]('/describe',auth[_0xec85('0x9')](),controller['describe']);router[_0xec85('0x8')]('/:id',auth[_0xec85('0x9')](),controller[_0xec85('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xec85('0xc')]);router[_0xec85('0xd')]('/:id',auth[_0xec85('0x9')](),controller[_0xec85('0xe')]);router[_0xec85('0xf')](_0xec85('0x10'),auth[_0xec85('0x9')](),controller['destroy']);module[_0xec85('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 04e0668..cfe2042 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 _0xa381=['ENUM','blind','attended','STRING','sequelize','moment','exports'];(function(_0x53e3bf,_0x547106){var _0x59b198=function(_0x329bb4){while(--_0x329bb4){_0x53e3bf['push'](_0x53e3bf['shift']());}};_0x59b198(++_0x547106);}(_0xa381,0xdd));var _0x1a38=function(_0x54e1e3,_0x362b34){_0x54e1e3=_0x54e1e3-0x0;var _0x491335=_0xa381[_0x54e1e3];return _0x491335;};'use strict';var Sequelize=require(_0x1a38('0x0'));var moment=require(_0x1a38('0x1'));module[_0x1a38('0x2')]={'type':{'type':Sequelize[_0x1a38('0x3')](_0x1a38('0x4'),_0x1a38('0x5'))},'result':{'type':Sequelize[_0x1a38('0x6')]},'transfererchannel':{'type':Sequelize[_0x1a38('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x1a38('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1a38('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x1a38('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x1a38('0x6')]},'transferercontext':{'type':Sequelize[_0x1a38('0x6')]},'transfererexten':{'type':Sequelize[_0x1a38('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x1a38('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x1a38('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x1a38('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x1a38('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1a38('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x1a38('0x6')]},'isexternal':{'type':Sequelize[_0x1a38('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x1a38('0x6')]},'extension':{'type':Sequelize[_0x1a38('0x6')]}}; \ No newline at end of file +var _0x33c8=['sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x44c882,_0x37b7dd){var _0x5cd976=function(_0xcc6884){while(--_0xcc6884){_0x44c882['push'](_0x44c882['shift']());}};_0x5cd976(++_0x37b7dd);}(_0x33c8,0xc6));var _0x833c=function(_0x442f16,_0x4ed123){_0x442f16=_0x442f16-0x0;var _0x94ae3f=_0x33c8[_0x442f16];return _0x94ae3f;};'use strict';var Sequelize=require(_0x833c('0x0'));var moment=require('moment');module[_0x833c('0x1')]={'type':{'type':Sequelize[_0x833c('0x2')](_0x833c('0x3'),_0x833c('0x4'))},'result':{'type':Sequelize[_0x833c('0x5')]},'transfererchannel':{'type':Sequelize[_0x833c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x833c('0x5')]},'transferercalleridname':{'type':Sequelize[_0x833c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x833c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x833c('0x5')]},'transferercontext':{'type':Sequelize[_0x833c('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x833c('0x5')]},'transfereechannel':{'type':Sequelize[_0x833c('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x833c('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x833c('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x833c('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x833c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x833c('0x5')]},'isexternal':{'type':Sequelize[_0x833c('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x833c('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 61fe3d2..9aff060 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 _0x5b45=['include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','stack','send','index','VoiceTransferReport','fieldName','type','key','map','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll'];(function(_0x586ca2,_0x114748){var _0x326509=function(_0x4a5331){while(--_0x4a5331){_0x586ca2['push'](_0x586ca2['shift']());}};_0x326509(++_0x114748);}(_0x5b45,0x17d));var _0x55b4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5b45[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x55b4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x55b4('0x1'));var BPromise=require(_0x55b4('0x2'));var Mustache=require(_0x55b4('0x3'));var util=require(_0x55b4('0x4'));var path=require(_0x55b4('0x5'));var sox=require('sox');var csv=require(_0x55b4('0x6'));var ejs=require(_0x55b4('0x7'));var fs=require('fs');var fs_extra=require(_0x55b4('0x8'));var _=require(_0x55b4('0x9'));var squel=require(_0x55b4('0xa'));var crypto=require(_0x55b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x55b4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x55b4('0xd'));var Papa=require(_0x55b4('0xe'));var Redis=require(_0x55b4('0xf'));var authService=require(_0x55b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x55b4('0x11'));var hardwareService=require(_0x55b4('0x12'));var logger=require(_0x55b4('0x13'))(_0x55b4('0x14'));var utils=require(_0x55b4('0x15'));var config=require(_0x55b4('0x16'));var licenseUtil=require(_0x55b4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34e038,_0xdd586){_0xdd586=_0xdd586||0xcc;return function(_0x55ac3a){if(_0x55ac3a){return _0x34e038['sendStatus'](_0xdd586);}return _0x34e038[_0x55b4('0x18')](_0xdd586)['end']();};}function respondWithResult(_0x5ed855,_0x35c2d6){_0x35c2d6=_0x35c2d6||0xc8;return function(_0x48bfce){if(_0x48bfce){return _0x5ed855['status'](_0x35c2d6)[_0x55b4('0x19')](_0x48bfce);}};}function respondWithFilteredResult(_0x3d6da4,_0x513a35){return function(_0x42a9e1){if(_0x42a9e1){var _0x422518=typeof _0x513a35[_0x55b4('0x1a')]===_0x55b4('0x1b')&&typeof _0x513a35[_0x55b4('0x1c')]==='undefined';var _0x2d2a65=_0x42a9e1[_0x55b4('0x1d')];var _0x890ccb=_0x422518?0x0:_0x513a35[_0x55b4('0x1a')];var _0xbad9fd=_0x422518?_0x42a9e1['count']:_0x513a35[_0x55b4('0x1a')]+_0x513a35[_0x55b4('0x1c')];var _0x34af34;if(_0xbad9fd>=_0x2d2a65){_0xbad9fd=_0x2d2a65;_0x34af34=0xc8;}else{_0x34af34=0xce;}_0x3d6da4['status'](_0x34af34);return _0x3d6da4[_0x55b4('0x1e')]('Content-Range',_0x890ccb+'-'+_0xbad9fd+'/'+_0x2d2a65)[_0x55b4('0x19')](_0x42a9e1);}return null;};}function patchUpdates(_0x1ae50d){return function(_0x34f3a6){try{jsonpatch['apply'](_0x34f3a6,_0x1ae50d,!![]);}catch(_0x116bc2){return BPromise[_0x55b4('0x1f')](_0x116bc2);}return _0x34f3a6[_0x55b4('0x20')]();};}function saveUpdates(_0xf01ae6,_0x4f58bf){return function(_0x151601){if(_0x151601){return _0x151601[_0x55b4('0x21')](_0xf01ae6)[_0x55b4('0x22')](function(_0x350a11){return _0x350a11;});}return null;};}function removeEntity(_0x1e2b06,_0x59fc77){return function(_0x32d1fc){if(_0x32d1fc){return _0x32d1fc[_0x55b4('0x23')]()[_0x55b4('0x22')](function(){_0x1e2b06[_0x55b4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353d98,_0x1ddc13){return function(_0x63892b){if(!_0x63892b){_0x353d98[_0x55b4('0x24')](0x194);}return _0x63892b;};}function handleError(_0xcd3106,_0x42f45a){_0x42f45a=_0x42f45a||0x1f4;return function(_0x28a29e){logger['error'](_0x28a29e[_0x55b4('0x25')]);if(_0x28a29e['name']){delete _0x28a29e['name'];}_0xcd3106['status'](_0x42f45a)[_0x55b4('0x26')](_0x28a29e);};}exports[_0x55b4('0x27')]=function(_0xf19be1,_0x211579){var _0x4cff32={},_0x3fd84a={},_0x5233f7={'count':0x0,'rows':[]};var _0x565095=_['map'](db[_0x55b4('0x28')]['rawAttributes'],function(_0x29f72f){return{'name':_0x29f72f[_0x55b4('0x29')],'type':_0x29f72f[_0x55b4('0x2a')][_0x55b4('0x2b')]};});_0x3fd84a['model']=_[_0x55b4('0x2c')](_0x565095,_0x55b4('0x2d'));_0x3fd84a[_0x55b4('0x2e')]=_[_0x55b4('0x2f')](_0xf19be1[_0x55b4('0x2e')]);_0x3fd84a['filters']=_[_0x55b4('0x30')](_0x3fd84a[_0x55b4('0x31')],_0x3fd84a['query']);_0x4cff32[_0x55b4('0x32')]=_[_0x55b4('0x30')](_0x3fd84a['model'],qs[_0x55b4('0x33')](_0xf19be1[_0x55b4('0x2e')][_0x55b4('0x33')]));_0x4cff32[_0x55b4('0x32')]=_0x4cff32['attributes'][_0x55b4('0x34')]?_0x4cff32['attributes']:_0x3fd84a[_0x55b4('0x31')];if(!_0xf19be1[_0x55b4('0x2e')][_0x55b4('0x35')](_0x55b4('0x36'))){_0x4cff32[_0x55b4('0x1c')]=qs[_0x55b4('0x1c')](_0xf19be1['query']['limit']);_0x4cff32[_0x55b4('0x1a')]=qs[_0x55b4('0x1a')](_0xf19be1[_0x55b4('0x2e')]['offset']);}_0x4cff32['order']=qs[_0x55b4('0x37')](_0xf19be1['query']['sort']);_0x4cff32[_0x55b4('0x38')]=qs['filters'](_[_0x55b4('0x39')](_0xf19be1[_0x55b4('0x2e')],_0x3fd84a[_0x55b4('0x3a')]),_0x565095);if(_0xf19be1['query'][_0x55b4('0x3b')]){_0x4cff32[_0x55b4('0x38')]=_['merge'](_0x4cff32['where'],{'$or':_['map'](_0x565095,function(_0x43130c){if(_0x43130c[_0x55b4('0x2a')]!=='VIRTUAL'){var _0x330748={};_0x330748[_0x43130c[_0x55b4('0x2d')]]={'$like':'%'+_0xf19be1[_0x55b4('0x2e')][_0x55b4('0x3b')]+'%'};return _0x330748;}})});}_0x4cff32=_[_0x55b4('0x3c')]({},_0x4cff32,_0xf19be1[_0x55b4('0x3d')]);var _0x1c4a88={'where':_0x4cff32[_0x55b4('0x38')]};return db['VoiceTransferReport'][_0x55b4('0x1d')](_0x1c4a88)[_0x55b4('0x22')](function(_0x14e009){_0x5233f7[_0x55b4('0x1d')]=_0x14e009;if(_0xf19be1[_0x55b4('0x2e')][_0x55b4('0x3e')]){_0x4cff32[_0x55b4('0x3f')]=[{'all':!![]}];}return db[_0x55b4('0x28')][_0x55b4('0x40')](_0x4cff32);})['then'](function(_0x574eaa){_0x5233f7[_0x55b4('0x41')]=_0x574eaa;return _0x5233f7;})[_0x55b4('0x22')](respondWithFilteredResult(_0x211579,_0x4cff32))[_0x55b4('0x42')](handleError(_0x211579,null));};exports[_0x55b4('0x43')]=function(_0x3d73ec,_0xf77cea){var _0xb69989={'raw':!![],'where':{'id':_0x3d73ec[_0x55b4('0x44')]['id']}},_0x3e946f={};_0x3e946f[_0x55b4('0x31')]=_[_0x55b4('0x2f')](db['VoiceTransferReport'][_0x55b4('0x45')]);_0x3e946f[_0x55b4('0x2e')]=_[_0x55b4('0x2f')](_0x3d73ec['query']);_0x3e946f[_0x55b4('0x3a')]=_[_0x55b4('0x30')](_0x3e946f[_0x55b4('0x31')],_0x3e946f['query']);_0xb69989['attributes']=_[_0x55b4('0x30')](_0x3e946f[_0x55b4('0x31')],qs[_0x55b4('0x33')](_0x3d73ec[_0x55b4('0x2e')][_0x55b4('0x33')]));_0xb69989['attributes']=_0xb69989[_0x55b4('0x32')][_0x55b4('0x34')]?_0xb69989['attributes']:_0x3e946f[_0x55b4('0x31')];if(_0x3d73ec[_0x55b4('0x2e')][_0x55b4('0x3e')]){_0xb69989[_0x55b4('0x3f')]=[{'all':!![]}];}_0xb69989=_[_0x55b4('0x3c')]({},_0xb69989,_0x3d73ec[_0x55b4('0x3d')]);return db[_0x55b4('0x28')]['find'](_0xb69989)[_0x55b4('0x22')](handleEntityNotFound(_0xf77cea,null))[_0x55b4('0x22')](respondWithResult(_0xf77cea,null))[_0x55b4('0x42')](handleError(_0xf77cea,null));};exports[_0x55b4('0x46')]=function(_0x1b87d7,_0x16e2a9){return db[_0x55b4('0x28')][_0x55b4('0x46')](_0x1b87d7[_0x55b4('0x47')],{})['then'](respondWithResult(_0x16e2a9,0xc9))[_0x55b4('0x42')](handleError(_0x16e2a9,null));};exports['update']=function(_0x1ecc02,_0x30b7a5){if(_0x1ecc02[_0x55b4('0x47')]['id']){delete _0x1ecc02['body']['id'];}return db[_0x55b4('0x28')][_0x55b4('0x48')]({'where':{'id':_0x1ecc02[_0x55b4('0x44')]['id']}})[_0x55b4('0x22')](handleEntityNotFound(_0x30b7a5,null))['then'](saveUpdates(_0x1ecc02[_0x55b4('0x47')],null))[_0x55b4('0x22')](respondWithResult(_0x30b7a5,null))[_0x55b4('0x42')](handleError(_0x30b7a5,null));};exports[_0x55b4('0x23')]=function(_0x4dbd04,_0x100f9f){return db['VoiceTransferReport'][_0x55b4('0x48')]({'where':{'id':_0x4dbd04['params']['id']}})[_0x55b4('0x22')](handleEntityNotFound(_0x100f9f,null))[_0x55b4('0x22')](removeEntity(_0x100f9f,null))['catch'](handleError(_0x100f9f,null));};exports[_0x55b4('0x49')]=function(_0x5dcd50,_0x2722fa){return db[_0x55b4('0x28')][_0x55b4('0x49')]()[_0x55b4('0x22')](respondWithResult(_0x2722fa,null))[_0x55b4('0x42')](handleError(_0x2722fa,null));}; \ No newline at end of file +var _0x4c1f=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','status','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','VoiceTransferReport','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe','eml-format','rimraf'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x4c1f,0x92));var _0xf4c1=function(_0x45be44,_0x295880){_0x45be44=_0x45be44-0x0;var _0x12e2e6=_0x4c1f[_0x45be44];return _0x12e2e6;};'use strict';var emlformat=require(_0xf4c1('0x0'));var rimraf=require(_0xf4c1('0x1'));var zipdir=require(_0xf4c1('0x2'));var jsonpatch=require(_0xf4c1('0x3'));var rp=require(_0xf4c1('0x4'));var moment=require('moment');var BPromise=require(_0xf4c1('0x5'));var Mustache=require(_0xf4c1('0x6'));var util=require('util');var path=require(_0xf4c1('0x7'));var sox=require('sox');var csv=require(_0xf4c1('0x8'));var ejs=require(_0xf4c1('0x9'));var fs=require('fs');var fs_extra=require(_0xf4c1('0xa'));var _=require(_0xf4c1('0xb'));var squel=require(_0xf4c1('0xc'));var crypto=require(_0xf4c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf4c1('0x8'));var querystring=require(_0xf4c1('0xe'));var Papa=require('papaparse');var Redis=require(_0xf4c1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4c1('0x10'));var as=require(_0xf4c1('0x11'));var hardwareService=require(_0xf4c1('0x12'));var logger=require(_0xf4c1('0x13'))(_0xf4c1('0x14'));var utils=require(_0xf4c1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf4c1('0x16'));var db=require(_0xf4c1('0x17'))['db'];function respondWithStatusCode(_0x2c8f0f,_0x238473){_0x238473=_0x238473||0xcc;return function(_0x580ea3){if(_0x580ea3){return _0x2c8f0f['sendStatus'](_0x238473);}return _0x2c8f0f['status'](_0x238473)[_0xf4c1('0x18')]();};}function respondWithResult(_0x5a4510,_0xfd5076){_0xfd5076=_0xfd5076||0xc8;return function(_0x5527da){if(_0x5527da){return _0x5a4510['status'](_0xfd5076)[_0xf4c1('0x19')](_0x5527da);}};}function respondWithFilteredResult(_0x39b13b,_0x490da5){return function(_0x51086d){if(_0x51086d){var _0x43b74d=typeof _0x490da5['offset']===_0xf4c1('0x1a')&&typeof _0x490da5[_0xf4c1('0x1b')]==='undefined';var _0x5db159=_0x51086d[_0xf4c1('0x1c')];var _0x123514=_0x43b74d?0x0:_0x490da5[_0xf4c1('0x1d')];var _0x4ce0d0=_0x43b74d?_0x51086d[_0xf4c1('0x1c')]:_0x490da5[_0xf4c1('0x1d')]+_0x490da5['limit'];var _0x43937f;if(_0x4ce0d0>=_0x5db159){_0x4ce0d0=_0x5db159;_0x43937f=0xc8;}else{_0x43937f=0xce;}_0x39b13b['status'](_0x43937f);return _0x39b13b[_0xf4c1('0x1e')](_0xf4c1('0x1f'),_0x123514+'-'+_0x4ce0d0+'/'+_0x5db159)[_0xf4c1('0x19')](_0x51086d);}return null;};}function patchUpdates(_0x4bc072){return function(_0x562ae5){try{jsonpatch['apply'](_0x562ae5,_0x4bc072,!![]);}catch(_0x52a428){return BPromise[_0xf4c1('0x20')](_0x52a428);}return _0x562ae5[_0xf4c1('0x21')]();};}function saveUpdates(_0x506166,_0x28603e){return function(_0x5c76d8){if(_0x5c76d8){return _0x5c76d8[_0xf4c1('0x22')](_0x506166)[_0xf4c1('0x23')](function(_0x1898e2){return _0x1898e2;});}return null;};}function removeEntity(_0x112667,_0x4cbde7){return function(_0x841b1c){if(_0x841b1c){return _0x841b1c[_0xf4c1('0x24')]()['then'](function(){_0x112667[_0xf4c1('0x25')](0xcc)[_0xf4c1('0x18')]();});}};}function handleEntityNotFound(_0x2bfd36,_0x169874){return function(_0x1e8696){if(!_0x1e8696){_0x2bfd36[_0xf4c1('0x26')](0x194);}return _0x1e8696;};}function handleError(_0xbdbb3c,_0x18ea34){_0x18ea34=_0x18ea34||0x1f4;return function(_0x4131e3){logger['error'](_0x4131e3[_0xf4c1('0x27')]);if(_0x4131e3[_0xf4c1('0x28')]){delete _0x4131e3[_0xf4c1('0x28')];}_0xbdbb3c[_0xf4c1('0x25')](_0x18ea34)[_0xf4c1('0x29')](_0x4131e3);};}exports['index']=function(_0x24d9d8,_0x408e94){var _0x364132={},_0x29c95e={},_0x2f2ce3={'count':0x0,'rows':[]};var _0x5f392e=_[_0xf4c1('0x2a')](db['VoiceTransferReport'][_0xf4c1('0x2b')],function(_0x44ae1b){return{'name':_0x44ae1b[_0xf4c1('0x2c')],'type':_0x44ae1b[_0xf4c1('0x2d')]['key']};});_0x29c95e[_0xf4c1('0x2e')]=_[_0xf4c1('0x2a')](_0x5f392e,_0xf4c1('0x28'));_0x29c95e[_0xf4c1('0x2f')]=_['keys'](_0x24d9d8[_0xf4c1('0x2f')]);_0x29c95e['filters']=_['intersection'](_0x29c95e['model'],_0x29c95e['query']);_0x364132[_0xf4c1('0x30')]=_[_0xf4c1('0x31')](_0x29c95e['model'],qs[_0xf4c1('0x32')](_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x32')]));_0x364132[_0xf4c1('0x30')]=_0x364132[_0xf4c1('0x30')][_0xf4c1('0x33')]?_0x364132['attributes']:_0x29c95e[_0xf4c1('0x2e')];if(!_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x34')](_0xf4c1('0x35'))){_0x364132[_0xf4c1('0x1b')]=qs[_0xf4c1('0x1b')](_0x24d9d8['query'][_0xf4c1('0x1b')]);_0x364132['offset']=qs[_0xf4c1('0x1d')](_0x24d9d8['query']['offset']);}_0x364132[_0xf4c1('0x36')]=qs[_0xf4c1('0x37')](_0x24d9d8[_0xf4c1('0x2f')]['sort']);_0x364132[_0xf4c1('0x38')]=qs[_0xf4c1('0x39')](_['pick'](_0x24d9d8[_0xf4c1('0x2f')],_0x29c95e[_0xf4c1('0x39')]),_0x5f392e);if(_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x3a')]){_0x364132[_0xf4c1('0x38')]=_['merge'](_0x364132[_0xf4c1('0x38')],{'$or':_['map'](_0x5f392e,function(_0x479325){if(_0x479325[_0xf4c1('0x2d')]!==_0xf4c1('0x3b')){var _0xe672fa={};_0xe672fa[_0x479325[_0xf4c1('0x28')]]={'$like':'%'+_0x24d9d8[_0xf4c1('0x2f')][_0xf4c1('0x3a')]+'%'};return _0xe672fa;}})});}_0x364132=_[_0xf4c1('0x3c')]({},_0x364132,_0x24d9d8['options']);var _0x150af0={'where':_0x364132[_0xf4c1('0x38')]};return db[_0xf4c1('0x3d')][_0xf4c1('0x1c')](_0x150af0)['then'](function(_0x4155f3){_0x2f2ce3[_0xf4c1('0x1c')]=_0x4155f3;if(_0x24d9d8[_0xf4c1('0x2f')]['includeAll']){_0x364132[_0xf4c1('0x3e')]=[{'all':!![]}];}return db[_0xf4c1('0x3d')][_0xf4c1('0x3f')](_0x364132);})[_0xf4c1('0x23')](function(_0x525665){_0x2f2ce3[_0xf4c1('0x40')]=_0x525665;return _0x2f2ce3;})[_0xf4c1('0x23')](respondWithFilteredResult(_0x408e94,_0x364132))[_0xf4c1('0x41')](handleError(_0x408e94,null));};exports[_0xf4c1('0x42')]=function(_0x3ba1a0,_0x3680fe){var _0x5cd4c3={'raw':!![],'where':{'id':_0x3ba1a0[_0xf4c1('0x43')]['id']}},_0x5b6395={};_0x5b6395[_0xf4c1('0x2e')]=_[_0xf4c1('0x44')](db['VoiceTransferReport'][_0xf4c1('0x2b')]);_0x5b6395[_0xf4c1('0x2f')]=_['keys'](_0x3ba1a0[_0xf4c1('0x2f')]);_0x5b6395[_0xf4c1('0x39')]=_[_0xf4c1('0x31')](_0x5b6395[_0xf4c1('0x2e')],_0x5b6395[_0xf4c1('0x2f')]);_0x5cd4c3['attributes']=_[_0xf4c1('0x31')](_0x5b6395[_0xf4c1('0x2e')],qs['fields'](_0x3ba1a0[_0xf4c1('0x2f')][_0xf4c1('0x32')]));_0x5cd4c3[_0xf4c1('0x30')]=_0x5cd4c3[_0xf4c1('0x30')][_0xf4c1('0x33')]?_0x5cd4c3['attributes']:_0x5b6395['model'];if(_0x3ba1a0[_0xf4c1('0x2f')]['includeAll']){_0x5cd4c3[_0xf4c1('0x3e')]=[{'all':!![]}];}_0x5cd4c3=_['merge']({},_0x5cd4c3,_0x3ba1a0[_0xf4c1('0x45')]);return db[_0xf4c1('0x3d')]['find'](_0x5cd4c3)['then'](handleEntityNotFound(_0x3680fe,null))[_0xf4c1('0x23')](respondWithResult(_0x3680fe,null))['catch'](handleError(_0x3680fe,null));};exports['create']=function(_0x2c0674,_0x3ad1a5){return db[_0xf4c1('0x3d')][_0xf4c1('0x46')](_0x2c0674[_0xf4c1('0x47')],{})[_0xf4c1('0x23')](respondWithResult(_0x3ad1a5,0xc9))[_0xf4c1('0x41')](handleError(_0x3ad1a5,null));};exports[_0xf4c1('0x22')]=function(_0x77daae,_0x4e1366){if(_0x77daae[_0xf4c1('0x47')]['id']){delete _0x77daae[_0xf4c1('0x47')]['id'];}return db[_0xf4c1('0x3d')][_0xf4c1('0x48')]({'where':{'id':_0x77daae[_0xf4c1('0x43')]['id']}})[_0xf4c1('0x23')](handleEntityNotFound(_0x4e1366,null))[_0xf4c1('0x23')](saveUpdates(_0x77daae[_0xf4c1('0x47')],null))[_0xf4c1('0x23')](respondWithResult(_0x4e1366,null))[_0xf4c1('0x41')](handleError(_0x4e1366,null));};exports[_0xf4c1('0x24')]=function(_0x5b9c5c,_0x4ff6c2){return db[_0xf4c1('0x3d')][_0xf4c1('0x48')]({'where':{'id':_0x5b9c5c['params']['id']}})[_0xf4c1('0x23')](handleEntityNotFound(_0x4ff6c2,null))[_0xf4c1('0x23')](removeEntity(_0x4ff6c2,null))[_0xf4c1('0x41')](handleError(_0x4ff6c2,null));};exports[_0xf4c1('0x49')]=function(_0x1a37a5,_0x4870bd){return db[_0xf4c1('0x3d')][_0xf4c1('0x49')]()[_0xf4c1('0x23')](respondWithResult(_0x4870bd,null))['catch'](handleError(_0x4870bd,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d2d8fd2..7087662 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 _0xeb88=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xeb88,0x1db));var _0x8eb8=function(_0x10f945,_0x3c92c4){_0x10f945=_0x10f945-0x0;var _0x3e2160=_0xeb88[_0x10f945];return _0x3e2160;};'use strict';var _=require(_0x8eb8('0x0'));var util=require(_0x8eb8('0x1'));var logger=require(_0x8eb8('0x2'))(_0x8eb8('0x3'));var moment=require(_0x8eb8('0x4'));var BPromise=require(_0x8eb8('0x5'));var rp=require(_0x8eb8('0x6'));var fs=require('fs');var path=require(_0x8eb8('0x7'));var rimraf=require(_0x8eb8('0x8'));var config=require(_0x8eb8('0x9'));var attributes=require(_0x8eb8('0xa'));module[_0x8eb8('0xb')]=function(_0x12c8ce,_0x2e71c3){return _0x12c8ce['define'](_0x8eb8('0xc'),attributes,{'tableName':_0x8eb8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7729=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x479bd7,_0x2c44aa){var _0x4e8635=function(_0x512093){while(--_0x512093){_0x479bd7['push'](_0x479bd7['shift']());}};_0x4e8635(++_0x2c44aa);}(_0x7729,0x18b));var _0x9772=function(_0x3b6a5d,_0x2676cf){_0x3b6a5d=_0x3b6a5d-0x0;var _0x4126a9=_0x7729[_0x3b6a5d];return _0x4126a9;};'use strict';var _=require('lodash');var util=require(_0x9772('0x0'));var logger=require(_0x9772('0x1'))(_0x9772('0x2'));var moment=require(_0x9772('0x3'));var BPromise=require('bluebird');var rp=require(_0x9772('0x4'));var fs=require('fs');var path=require(_0x9772('0x5'));var rimraf=require(_0x9772('0x6'));var config=require(_0x9772('0x7'));var attributes=require(_0x9772('0x8'));module[_0x9772('0x9')]=function(_0x5172e1,_0x305db8){return _0x5172e1[_0x9772('0xa')](_0x9772('0xb'),attributes,{'tableName':_0x9772('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 9fba6f7..5aea89d 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 _0x01af=['VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30988e,_0x556a9c){var _0x1c9942=function(_0x2b450e){while(--_0x2b450e){_0x30988e['push'](_0x30988e['shift']());}};_0x1c9942(++_0x556a9c);}(_0x01af,0x79));var _0xf01a=function(_0x4efd94,_0x5ae15e){_0x4efd94=_0x4efd94-0x0;var _0x4002dd=_0x01af[_0x4efd94];return _0x4002dd;};'use strict';var _=require('lodash');var util=require(_0xf01a('0x0'));var moment=require(_0xf01a('0x1'));var BPromise=require('bluebird');var rs=require(_0xf01a('0x2'));var fs=require('fs');var Redis=require(_0xf01a('0x3'));var db=require(_0xf01a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf01a('0x5'))(_0xf01a('0x6'));var config=require(_0xf01a('0x7'));var jayson=require(_0xf01a('0x8'));var client=jayson[_0xf01a('0x9')][_0xf01a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x523d42,_0x4481b0,_0x10e717){return new BPromise(function(_0x50e579,_0x4b81e9){return client[_0xf01a('0xb')](_0x523d42,_0x10e717)[_0xf01a('0xc')](function(_0xed1d45){logger[_0xf01a('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4481b0,_0xf01a('0xe'));logger[_0xf01a('0xf')](_0xf01a('0x10'),_0x4481b0,'request\x20sent',JSON[_0xf01a('0x11')](_0xed1d45));if(_0xed1d45[_0xf01a('0x12')]){if(_0xed1d45[_0xf01a('0x12')]['code']===0x1f4){logger['error'](_0xf01a('0x13'),_0x4481b0,_0xed1d45[_0xf01a('0x12')][_0xf01a('0x14')]);return _0x4b81e9(_0xed1d45[_0xf01a('0x12')][_0xf01a('0x14')]);}logger[_0xf01a('0x12')](_0xf01a('0x13'),_0x4481b0,_0xed1d45[_0xf01a('0x12')][_0xf01a('0x14')]);return _0x50e579(_0xed1d45[_0xf01a('0x12')]['message']);}else{logger[_0xf01a('0xd')](_0xf01a('0x13'),_0x4481b0,'request\x20sent');_0x50e579(_0xed1d45[_0xf01a('0x15')][_0xf01a('0x14')]);}})['catch'](function(_0x7a3549){logger[_0xf01a('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4481b0,_0x7a3549);_0x4b81e9(_0x7a3549);});});}exports[_0xf01a('0x16')]=function(_0x4497fb){var _0x3cc6ea=this;return new Promise(function(_0xade017,_0x7caa18){return db[_0xf01a('0x17')][_0xf01a('0x18')](_0x4497fb['body'],{'raw':_0x4497fb[_0xf01a('0x19')]?_0x4497fb[_0xf01a('0x19')][_0xf01a('0x1a')]===undefined?!![]:![]:!![]})[_0xf01a('0xc')](function(_0x5d319b){logger[_0xf01a('0xd')](_0xf01a('0x16'),_0x4497fb);logger[_0xf01a('0xf')](_0xf01a('0x16'),_0x4497fb,JSON[_0xf01a('0x11')](_0x5d319b));_0xade017(_0x5d319b);})[_0xf01a('0x1b')](function(_0x5762ae){logger[_0xf01a('0x12')](_0xf01a('0x16'),_0x5762ae[_0xf01a('0x14')],_0x4497fb);_0x7caa18(_0x3cc6ea[_0xf01a('0x12')](0x1f4,_0x5762ae[_0xf01a('0x14')]));});});}; \ No newline at end of file +var _0xabf6=['request\x20sent','debug','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xabf6,0x13f));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6abf('0x0'));var util=require(_0x6abf('0x1'));var moment=require(_0x6abf('0x2'));var BPromise=require(_0x6abf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6abf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6abf('0x5'))(_0x6abf('0x6'));var config=require('../../config/environment');var jayson=require(_0x6abf('0x7'));var client=jayson['client'][_0x6abf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58de84,_0x2d7abc,_0xb60e6){return new BPromise(function(_0x274a8d,_0x19d321){return client[_0x6abf('0x9')](_0x58de84,_0xb60e6)['then'](function(_0x198ae8){logger[_0x6abf('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x2d7abc,_0x6abf('0xb'));logger[_0x6abf('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2d7abc,_0x6abf('0xb'),JSON[_0x6abf('0xd')](_0x198ae8));if(_0x198ae8['error']){if(_0x198ae8[_0x6abf('0xe')]['code']===0x1f4){logger[_0x6abf('0xe')](_0x6abf('0xf'),_0x2d7abc,_0x198ae8[_0x6abf('0xe')][_0x6abf('0x10')]);return _0x19d321(_0x198ae8[_0x6abf('0xe')][_0x6abf('0x10')]);}logger[_0x6abf('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x2d7abc,_0x198ae8[_0x6abf('0xe')][_0x6abf('0x10')]);return _0x274a8d(_0x198ae8['error'][_0x6abf('0x10')]);}else{logger[_0x6abf('0xa')](_0x6abf('0xf'),_0x2d7abc,_0x6abf('0xb'));_0x274a8d(_0x198ae8['result']['message']);}})[_0x6abf('0x11')](function(_0x290f53){logger[_0x6abf('0xe')](_0x6abf('0xf'),_0x2d7abc,_0x290f53);_0x19d321(_0x290f53);});});}exports[_0x6abf('0x12')]=function(_0x195f0){var _0x35ce55=this;return new Promise(function(_0x16e326,_0x13f23f){return db[_0x6abf('0x13')][_0x6abf('0x14')](_0x195f0['body'],{'raw':_0x195f0['options']?_0x195f0[_0x6abf('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24fc2a){logger[_0x6abf('0xa')](_0x6abf('0x12'),_0x195f0);logger[_0x6abf('0xc')]('CreateVoiceTransferReport',_0x195f0,JSON[_0x6abf('0xd')](_0x24fc2a));_0x16e326(_0x24fc2a);})[_0x6abf('0x11')](function(_0x5e9911){logger[_0x6abf('0xe')]('CreateVoiceTransferReport',_0x5e9911['message'],_0x195f0);_0x13f23f(_0x35ce55[_0x6abf('0xe')](0x1f4,_0x5e9911[_0x6abf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7ba656e..cd11efa 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 _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x341ee8,_0x1f054b){_0x341ee8=_0x341ee8-0x0;var _0x51085a=_0xb43b[_0x341ee8];return _0x51085a;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index ab731db..f57dc08 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 _0xacae=['callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','format','webbar:hangup','hangup\x20executed!','catch','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','util','bluebird','client','http','ioredis','redis','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','info','body','validate','json','userId','callNumber'];(function(_0x3883e5,_0x1e1b05){var _0x10ae71=function(_0x110986){while(--_0x110986){_0x3883e5['push'](_0x3883e5['shift']());}};_0x10ae71(++_0x1e1b05);}(_0xacae,0x67));var _0xeaca=function(_0x3bbda5,_0x6e3256){_0x3bbda5=_0x3bbda5-0x0;var _0x16b40a=_0xacae[_0x3bbda5];return _0x16b40a;};'use strict';var path=require(_0xeaca('0x0'));var fs=require('fs');var _=require(_0xeaca('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0xeaca('0x2'));var BPromise=require(_0xeaca('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xeaca('0x4')][_0xeaca('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xeaca('0x6'));config[_0xeaca('0x7')]=_['defaults'](config[_0xeaca('0x7')],{'host':_0xeaca('0x8'),'port':0x18eb});var io=require(_0xeaca('0x9'))(new Redis(config[_0xeaca('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xeaca('0xa'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xeaca('0xb'),'required':[!![],_0xeaca('0xc')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xeaca('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0xeaca('0xa'),'required':[!![],_0xeaca('0xd')]},'sessionId':{'type':_0xeaca('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xeaca('0xa'),'required':[!![],_0xeaca('0xd')]},'sessionId':{'type':_0xeaca('0xb'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xeaca('0xa'),'required':[!![],_0xeaca('0xd')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0xeaca('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xeaca('0xd')]},'sessionId':{'type':_0xeaca('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xeaca('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xeaca('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xeaca('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xeaca('0xa'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x109875,_0x1a6d3b,_0xa09ced){logger['info'](_0x109875,_0x1a6d3b,JSON['stringify'](_0xa09ced));io['to'](_0x109875)[_0xeaca('0xf')](_0x1a6d3b,_0xa09ced);}function handleError(_0x26a0d7){return function(_0x29dc34){console[_0xeaca('0x10')](_0xeaca('0x11'),_0x29dc34,_0x29dc34 instanceof RangeError);logger[_0xeaca('0x12')](_0x29dc34[_0xeaca('0x13')]);if(_0x29dc34 instanceof RangeError){if(_0x29dc34[_0xeaca('0x14')]){delete _0x29dc34[_0xeaca('0x14')];}_0x26a0d7[_0xeaca('0x15')](0x194)[_0xeaca('0x16')](_0x29dc34);}else{if(_0x29dc34['name']){delete _0x29dc34[_0xeaca('0x14')];}_0x26a0d7['status'](0x1f4)[_0xeaca('0x16')](_0x29dc34);}};}function checkError(){return function(_0x261af1){if(!_0x261af1){throw new RangeError(_0xeaca('0x17'));}return _0x261af1;};}function respondWithRpcPromise(_0x3043f0,_0x108151){return new BPromise(function(_0x4c4f5e,_0x28437a){var _0x1528ed=amiClient;return _0x1528ed[_0xeaca('0x18')](_0x3043f0,_0x108151)[_0xeaca('0x19')](function(_0x2fb31f){if(_0x2fb31f['error']){if(_0x2fb31f[_0xeaca('0x12')]['code']===0x1f4){return _0x28437a(_0x2fb31f[_0xeaca('0x12')][_0xeaca('0x1a')]);}return _0x4c4f5e(_0x2fb31f[_0xeaca('0x12')][_0xeaca('0x1a')]);}else{_0x4c4f5e(_0x2fb31f[_0xeaca('0x1b')]);}})['catch'](function(_0x179a83){_0x28437a(_0x179a83);});});}function getAgent(_0x5affec){return db[_0xeaca('0x1c')][_0xeaca('0x1d')]({'where':{'id':_0x5affec,'role':_0xeaca('0x1e')}})[_0xeaca('0x19')](checkError());}function getAgentCheckSession(_0x4a5a81,_0x39f71d){return new BPromise(function(_0x3c9f8f,_0x224c17){var _0x209a7b=respondWithRpcPromise(_0xeaca('0x1f'));var _0x3bb328=getAgent(_0x4a5a81);Promise[_0xeaca('0x20')]([_0x209a7b,_0x3bb328])[_0xeaca('0x19')](function(_0xfe2575){var _0x25b185=_0xfe2575[0x0];var _0x5c77b7=_0xfe2575[0x1];var _0x468d0c=_[_0xeaca('0x21')](_0x25b185[_0xeaca('0x22')],function(_0x4ff445){return _0x4ff445[_0xeaca('0x23')]==_0x5c77b7['id']&&_0x4ff445['sessionId']==_0x39f71d;});if(_0x468d0c[_0xeaca('0x24')]==0x1){_0x3c9f8f(_0x5c77b7);}else{_0x224c17(new RangeError('sessionId\x20'+_0x39f71d+'\x20not\x20found!'));}});});}exports['originate']=function(_0x3accea,_0x2ada45){logger[_0xeaca('0x25')]('originate\x20fired:',_0x3accea[_0xeaca('0x26')]);var _0x3ab2b4=originateValidation[_0xeaca('0x27')](_0x3accea[_0xeaca('0x26')]);if(_0x3ab2b4[_0xeaca('0x24')]>0x0){return _0x2ada45[_0xeaca('0x15')](0x190)[_0xeaca('0x28')](_0x3ab2b4);}var _0x442eeb=_0x3accea['body'][_0xeaca('0x29')];var _0x21859a=_0x3accea[_0xeaca('0x26')][_0xeaca('0x2a')];var _0x16e569=_0x3accea['body'][_0xeaca('0x2b')];var _0xc7e961=_0x3accea[_0xeaca('0x26')][_0xeaca('0x2c')];return getAgent(_0x442eeb)[_0xeaca('0x19')](function(_0x1b9bf0){logger[_0xeaca('0x25')](_0xeaca('0x2d'),_0x1b9bf0[_0xeaca('0x14')]);emit(util['format'](_0xeaca('0x2e'),_0x1b9bf0[_0xeaca('0x14')]),_0xeaca('0x2f'),{'callNumber':_0x21859a,'callerId':_0x16e569,'callbackUrl':_0xc7e961});return _0x2ada45['status'](0xc8)[_0xeaca('0x28')]({'error':![],'message':_0xeaca('0x30')});})['catch'](handleError(_0x2ada45));};exports[_0xeaca('0x31')]=function(_0x136c06,_0x2a5ad3){logger[_0xeaca('0x25')](_0xeaca('0x32'),_0x136c06[_0xeaca('0x26')]);var _0x310f17=hangupValidation[_0xeaca('0x27')](_0x136c06[_0xeaca('0x26')]);if(_0x310f17[_0xeaca('0x24')]>0x0){return _0x2a5ad3[_0xeaca('0x15')](0x190)[_0xeaca('0x28')](_0x310f17);}var _0x462feb=_0x136c06[_0xeaca('0x26')][_0xeaca('0x29')];var _0x47b41d=_0x136c06['body'][_0xeaca('0x33')];return getAgent(_0x462feb)[_0xeaca('0x19')](function(_0x43dfd6){logger[_0xeaca('0x25')](_0xeaca('0x2d'),_0x43dfd6[_0xeaca('0x14')]);emit(util[_0xeaca('0x34')]('user:%s',_0x43dfd6[_0xeaca('0x14')]),_0xeaca('0x35'),{'sessionId':_0x47b41d});return _0x2a5ad3[_0xeaca('0x15')](0xc8)[_0xeaca('0x28')]({'error':![],'message':_0xeaca('0x36')});})[_0xeaca('0x37')](handleError(_0x2a5ad3));};exports['answer']=function(_0x5e4142,_0x91eb68){logger[_0xeaca('0x25')]('answer\x20fired:',_0x5e4142[_0xeaca('0x26')]);var _0x190901=answerValidation[_0xeaca('0x27')](_0x5e4142['body']);if(_0x190901[_0xeaca('0x24')]>0x0){return _0x91eb68[_0xeaca('0x15')](0x190)[_0xeaca('0x28')](_0x190901);}var _0x1a3321=_0x5e4142[_0xeaca('0x26')][_0xeaca('0x29')];var _0x2ca874=_0x5e4142[_0xeaca('0x26')]['sessionId'];return getAgent(_0x1a3321)['then'](function(_0x3651a5){logger[_0xeaca('0x25')](_0xeaca('0x2d'),_0x3651a5[_0xeaca('0x14')]);emit(util['format'](_0xeaca('0x2e'),_0x3651a5[_0xeaca('0x14')]),_0xeaca('0x38'),{'sessionId':_0x2ca874});return _0x91eb68[_0xeaca('0x15')](0xc8)[_0xeaca('0x28')]({'error':![],'message':_0xeaca('0x39')});})[_0xeaca('0x37')](handleError(_0x91eb68));};exports[_0xeaca('0x3a')]=function(_0x3d0ac7,_0x16cc96){logger[_0xeaca('0x25')](_0xeaca('0x3b'),_0x3d0ac7[_0xeaca('0x26')]);var _0x39f2a3=holdValidation[_0xeaca('0x27')](_0x3d0ac7['body']);if(_0x39f2a3[_0xeaca('0x24')]>0x0){return _0x16cc96[_0xeaca('0x15')](0x190)['json'](_0x39f2a3);}var _0x10ff5b=_0x3d0ac7[_0xeaca('0x26')][_0xeaca('0x29')];var _0x301dcb=_0x3d0ac7['body']['sessionId'];return getAgent(_0x10ff5b)[_0xeaca('0x19')](function(_0xe16d23){logger['info'](_0xeaca('0x2d'),_0xe16d23[_0xeaca('0x14')]);emit(util[_0xeaca('0x34')](_0xeaca('0x2e'),_0xe16d23[_0xeaca('0x14')]),'webbar:hold',{'sessionId':_0x301dcb});return _0x16cc96[_0xeaca('0x15')](0xc8)[_0xeaca('0x28')]({'error':![],'message':_0xeaca('0x3c')});})[_0xeaca('0x37')](handleError(_0x16cc96));};exports['unhold']=function(_0x1fec71,_0x46ce33){logger[_0xeaca('0x25')](_0xeaca('0x3d'),_0x1fec71['body']);var _0x347395=unholdValidation[_0xeaca('0x27')](_0x1fec71[_0xeaca('0x26')]);if(_0x347395[_0xeaca('0x24')]>0x0){return _0x46ce33['status'](0x190)['json'](_0x347395);}var _0x2cf431=_0x1fec71[_0xeaca('0x26')][_0xeaca('0x29')];var _0x1b1c8c=_0x1fec71[_0xeaca('0x26')][_0xeaca('0x33')];return getAgent(_0x2cf431)['then'](function(_0x637a33){logger['info'](_0xeaca('0x2d'),_0x637a33['name']);emit(util['format'](_0xeaca('0x2e'),_0x637a33['name']),'webbar:unhold',{'sessionId':_0x1b1c8c});return _0x46ce33[_0xeaca('0x15')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x46ce33));};exports[_0xeaca('0x3e')]=function(_0x146799,_0x30f935){logger[_0xeaca('0x25')](_0xeaca('0x3f'),_0x30f935[_0xeaca('0x26')]);var _0x29a6c0=callsValidation['validate'](_0x146799[_0xeaca('0x26')]);if(_0x29a6c0[_0xeaca('0x24')]>0x0){return _0x30f935[_0xeaca('0x15')](0x190)[_0xeaca('0x28')](_0x29a6c0);}var _0x204c5f=_0x146799[_0xeaca('0x26')]['userId'];var _0x3c2387=respondWithRpcPromise(_0xeaca('0x1f'));var _0x15c5cb=getAgent(_0x204c5f);return Promise['all']([_0x3c2387,_0x15c5cb])[_0xeaca('0x19')](function(_0x43e776){var _0x125252=_0x43e776[0x0];var _0xeffe6b=_0x43e776[0x1];var _0x4b72da=_['filter'](_0x125252[_0xeaca('0x22')],function(_0x3bebd1){return _0x3bebd1[_0xeaca('0x23')]==_0xeffe6b['id'];});return _0x30f935['status'](0xc8)[_0xeaca('0x28')]({'count':_0x4b72da[_0xeaca('0x24')],'rows':_0x4b72da});})[_0xeaca('0x37')](handleError(_0x30f935));};exports[_0xeaca('0x40')]=function(_0x20806f,_0x503a20){logger[_0xeaca('0x25')](_0xeaca('0x41'),_0x20806f[_0xeaca('0x26')]);var _0x4b227b=conferenceValidation[_0xeaca('0x27')](_0x20806f[_0xeaca('0x26')]);if(_0x4b227b[_0xeaca('0x24')]>0x0){return _0x503a20['status'](0x190)['json'](_0x4b227b);}var _0x42bdf0=_0x20806f[_0xeaca('0x26')][_0xeaca('0x29')];return getAgent(_0x42bdf0)[_0xeaca('0x19')](function(_0x166ff1){logger[_0xeaca('0x25')](_0xeaca('0x2d'),_0x166ff1[_0xeaca('0x14')]);emit(util['format'](_0xeaca('0x2e'),_0x166ff1['name']),_0xeaca('0x42'));return _0x503a20[_0xeaca('0x15')](0xc8)[_0xeaca('0x28')]({'error':![],'message':_0xeaca('0x43')});})['catch'](handleError(_0x503a20));};exports[_0xeaca('0x44')]=function(_0x3d8e07,_0x32e082){logger[_0xeaca('0x25')](_0xeaca('0x45'),_0x3d8e07['body']);var _0x1530ac=transferValidation[_0xeaca('0x27')](_0x3d8e07[_0xeaca('0x26')]);if(_0x1530ac[_0xeaca('0x24')]>0x0){return _0x32e082[_0xeaca('0x15')](0x190)[_0xeaca('0x28')](_0x1530ac);}var _0x1f4ae1=_0x3d8e07[_0xeaca('0x26')][_0xeaca('0x29')];var _0x25312a=_0x3d8e07[_0xeaca('0x26')][_0xeaca('0x33')];var _0x263c92=_0x3d8e07[_0xeaca('0x26')][_0xeaca('0x46')];return getAgent(_0x1f4ae1)[_0xeaca('0x19')](function(_0x3346fc){logger['info'](_0xeaca('0x2d'),_0x3346fc[_0xeaca('0x14')]);emit(util[_0xeaca('0x34')](_0xeaca('0x2e'),_0x3346fc[_0xeaca('0x14')]),_0xeaca('0x47'),{'sessionId':_0x25312a,'transferNumber':_0x263c92});return _0x32e082[_0xeaca('0x15')](0xc8)['json']({'error':![],'message':_0xeaca('0x48')});})[_0xeaca('0x37')](handleError(_0x32e082));}; \ No newline at end of file +var _0x9234=['client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','stringify','emit','error','name','send','status','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','json','length','hangup\x20executed!','answer','answer\x20fired:','entityFound:','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x9234,0x1bd));var _0x4923=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x9234[_0x55c485];return _0x6bb521;};'use strict';var path=require(_0x4923('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4923('0x1'))['db'];var config=require(_0x4923('0x2'));var util=require(_0x4923('0x3'));var BPromise=require(_0x4923('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x4923('0x5')][_0x4923('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x4923('0x7'));var Redis=require(_0x4923('0x8'));config[_0x4923('0x9')]=_[_0x4923('0xa')](config[_0x4923('0x9')],{'host':_0x4923('0xb'),'port':0x18eb});var io=require(_0x4923('0xc'))(new Redis(config['redis']));var Schema=require(_0x4923('0xd'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4923('0xe')]},'callNumber':{'type':_0x4923('0xf'),'required':[!![],_0x4923('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4923('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x4923('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]},'sessionId':{'type':_0x4923('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4923('0x11'),'required':[!![],_0x4923('0xe')]}});function emit(_0x2897da,_0x2e9944,_0x3fedc7){logger['info'](_0x2897da,_0x2e9944,JSON[_0x4923('0x13')](_0x3fedc7));io['to'](_0x2897da)[_0x4923('0x14')](_0x2e9944,_0x3fedc7);}function handleError(_0x5dbb86){return function(_0x1be04d){console['log']('handleError:',_0x1be04d,_0x1be04d instanceof RangeError);logger[_0x4923('0x15')](_0x1be04d['stack']);if(_0x1be04d instanceof RangeError){if(_0x1be04d[_0x4923('0x16')]){delete _0x1be04d[_0x4923('0x16')];}_0x5dbb86['status'](0x194)[_0x4923('0x17')](_0x1be04d);}else{if(_0x1be04d[_0x4923('0x16')]){delete _0x1be04d[_0x4923('0x16')];}_0x5dbb86[_0x4923('0x18')](0x1f4)['send'](_0x1be04d);}};}function checkError(){return function(_0x3742d0){if(!_0x3742d0){throw new RangeError(_0x4923('0x19'));}return _0x3742d0;};}function respondWithRpcPromise(_0x5f4d43,_0x43326e){return new BPromise(function(_0x522753,_0x3de8f5){var _0x168bb4=amiClient;return _0x168bb4['request'](_0x5f4d43,_0x43326e)[_0x4923('0x1a')](function(_0xb1b3d3){if(_0xb1b3d3[_0x4923('0x15')]){if(_0xb1b3d3[_0x4923('0x15')][_0x4923('0x1b')]===0x1f4){return _0x3de8f5(_0xb1b3d3[_0x4923('0x15')][_0x4923('0x1c')]);}return _0x522753(_0xb1b3d3['error']['message']);}else{_0x522753(_0xb1b3d3[_0x4923('0x1d')]);}})[_0x4923('0x1e')](function(_0xdb893b){_0x3de8f5(_0xdb893b);});});}function getAgent(_0x32d508){return db[_0x4923('0x1f')][_0x4923('0x20')]({'where':{'id':_0x32d508,'role':_0x4923('0x21')}})[_0x4923('0x1a')](checkError());}function getAgentCheckSession(_0x9982e8,_0x18fc90){return new BPromise(function(_0x3a7852,_0x52b433){var _0x1cc7c4=respondWithRpcPromise(_0x4923('0x22'));var _0x7944b2=getAgent(_0x9982e8);Promise[_0x4923('0x23')]([_0x1cc7c4,_0x7944b2])[_0x4923('0x1a')](function(_0x47158c){var _0x158a30=_0x47158c[0x0];var _0x7a97f3=_0x47158c[0x1];var _0xb88ca4=_[_0x4923('0x24')](_0x158a30[_0x4923('0x25')],function(_0x425b3c){return _0x425b3c[_0x4923('0x26')]==_0x7a97f3['id']&&_0x425b3c[_0x4923('0x27')]==_0x18fc90;});if(_0xb88ca4['length']==0x1){_0x3a7852(_0x7a97f3);}else{_0x52b433(new RangeError(_0x4923('0x28')+_0x18fc90+_0x4923('0x29')));}});});}exports[_0x4923('0x2a')]=function(_0x3c92bd,_0xf3bc52){logger[_0x4923('0x2b')](_0x4923('0x2c'),_0x3c92bd[_0x4923('0x2d')]);var _0x557756=originateValidation['validate'](_0x3c92bd[_0x4923('0x2d')]);if(_0x557756['length']>0x0){return _0xf3bc52['status'](0x190)['json'](_0x557756);}var _0x207392=_0x3c92bd[_0x4923('0x2d')][_0x4923('0x2e')];var _0x25a9f7=_0x3c92bd['body'][_0x4923('0x2f')];var _0x58b0c1=_0x3c92bd[_0x4923('0x2d')][_0x4923('0x30')];var _0x368d50=_0x3c92bd[_0x4923('0x2d')][_0x4923('0x31')];return getAgent(_0x207392)['then'](function(_0x43ed8e){logger['info']('entityFound:',_0x43ed8e[_0x4923('0x16')]);emit(util[_0x4923('0x32')](_0x4923('0x33'),_0x43ed8e[_0x4923('0x16')]),_0x4923('0x34'),{'callNumber':_0x25a9f7,'callerId':_0x58b0c1,'callbackUrl':_0x368d50});return _0xf3bc52[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':'originate\x20executed!'});})[_0x4923('0x1e')](handleError(_0xf3bc52));};exports['hangup']=function(_0x4b01da,_0x35eaea){logger[_0x4923('0x2b')]('hangup\x20fired:',_0x4b01da[_0x4923('0x2d')]);var _0x306436=hangupValidation['validate'](_0x4b01da['body']);if(_0x306436[_0x4923('0x36')]>0x0){return _0x35eaea[_0x4923('0x18')](0x190)['json'](_0x306436);}var _0x51cb0e=_0x4b01da[_0x4923('0x2d')][_0x4923('0x2e')];var _0x3345e1=_0x4b01da[_0x4923('0x2d')][_0x4923('0x27')];return getAgent(_0x51cb0e)['then'](function(_0x2a02e0){logger[_0x4923('0x2b')]('entityFound:',_0x2a02e0[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x2a02e0[_0x4923('0x16')]),'webbar:hangup',{'sessionId':_0x3345e1});return _0x35eaea[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x37')});})[_0x4923('0x1e')](handleError(_0x35eaea));};exports[_0x4923('0x38')]=function(_0x3ea276,_0x580092){logger[_0x4923('0x2b')](_0x4923('0x39'),_0x3ea276['body']);var _0x2a7355=answerValidation['validate'](_0x3ea276[_0x4923('0x2d')]);if(_0x2a7355[_0x4923('0x36')]>0x0){return _0x580092[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x2a7355);}var _0x120a77=_0x3ea276[_0x4923('0x2d')][_0x4923('0x2e')];var _0x1de781=_0x3ea276['body'][_0x4923('0x27')];return getAgent(_0x120a77)[_0x4923('0x1a')](function(_0xbab297){logger[_0x4923('0x2b')](_0x4923('0x3a'),_0xbab297[_0x4923('0x16')]);emit(util[_0x4923('0x32')](_0x4923('0x33'),_0xbab297[_0x4923('0x16')]),'webbar:answer',{'sessionId':_0x1de781});return _0x580092[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':'answer\x20executed!'});})[_0x4923('0x1e')](handleError(_0x580092));};exports[_0x4923('0x3b')]=function(_0x456fd7,_0xf092a1){logger[_0x4923('0x2b')](_0x4923('0x3c'),_0x456fd7[_0x4923('0x2d')]);var _0x2fb017=holdValidation[_0x4923('0xd')](_0x456fd7['body']);if(_0x2fb017['length']>0x0){return _0xf092a1['status'](0x190)[_0x4923('0x35')](_0x2fb017);}var _0x58c1c7=_0x456fd7[_0x4923('0x2d')]['userId'];var _0x278ccc=_0x456fd7[_0x4923('0x2d')][_0x4923('0x27')];return getAgent(_0x58c1c7)[_0x4923('0x1a')](function(_0x2b89be){logger[_0x4923('0x2b')](_0x4923('0x3a'),_0x2b89be[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x2b89be[_0x4923('0x16')]),_0x4923('0x3d'),{'sessionId':_0x278ccc});return _0xf092a1[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x3e')});})[_0x4923('0x1e')](handleError(_0xf092a1));};exports[_0x4923('0x3f')]=function(_0x4eb38f,_0x218f49){logger[_0x4923('0x2b')](_0x4923('0x40'),_0x4eb38f[_0x4923('0x2d')]);var _0x5a092d=unholdValidation[_0x4923('0xd')](_0x4eb38f[_0x4923('0x2d')]);if(_0x5a092d[_0x4923('0x36')]>0x0){return _0x218f49[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x5a092d);}var _0x2ee03b=_0x4eb38f[_0x4923('0x2d')]['userId'];var _0x4527da=_0x4eb38f['body']['sessionId'];return getAgent(_0x2ee03b)[_0x4923('0x1a')](function(_0x36a27c){logger[_0x4923('0x2b')]('entityFound:',_0x36a27c[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x36a27c['name']),_0x4923('0x41'),{'sessionId':_0x4527da});return _0x218f49[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x42')});})[_0x4923('0x1e')](handleError(_0x218f49));};exports['calls']=function(_0x2d0a14,_0x103a7e){logger[_0x4923('0x2b')](_0x4923('0x43'),_0x103a7e[_0x4923('0x2d')]);var _0xff2e1d=callsValidation['validate'](_0x2d0a14[_0x4923('0x2d')]);if(_0xff2e1d[_0x4923('0x36')]>0x0){return _0x103a7e[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0xff2e1d);}var _0x125421=_0x2d0a14[_0x4923('0x2d')][_0x4923('0x2e')];var _0x4ea676=respondWithRpcPromise(_0x4923('0x22'));var _0xf7fdfe=getAgent(_0x125421);return Promise[_0x4923('0x23')]([_0x4ea676,_0xf7fdfe])[_0x4923('0x1a')](function(_0x3b59e6){var _0x3a75d2=_0x3b59e6[0x0];var _0x338613=_0x3b59e6[0x1];var _0x59ac29=_[_0x4923('0x24')](_0x3a75d2[_0x4923('0x25')],function(_0x618948){return _0x618948['UserId']==_0x338613['id'];});return _0x103a7e[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'count':_0x59ac29['length'],'rows':_0x59ac29});})['catch'](handleError(_0x103a7e));};exports[_0x4923('0x44')]=function(_0x3d9df9,_0x2e60c3){logger[_0x4923('0x2b')](_0x4923('0x45'),_0x3d9df9[_0x4923('0x2d')]);var _0x224e30=conferenceValidation[_0x4923('0xd')](_0x3d9df9['body']);if(_0x224e30[_0x4923('0x36')]>0x0){return _0x2e60c3[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x224e30);}var _0x36ede5=_0x3d9df9[_0x4923('0x2d')]['userId'];return getAgent(_0x36ede5)[_0x4923('0x1a')](function(_0x1d2724){logger[_0x4923('0x2b')]('entityFound:',_0x1d2724['name']);emit(util[_0x4923('0x32')](_0x4923('0x33'),_0x1d2724['name']),'webbar:conference');return _0x2e60c3[_0x4923('0x18')](0xc8)[_0x4923('0x35')]({'error':![],'message':_0x4923('0x46')});})['catch'](handleError(_0x2e60c3));};exports[_0x4923('0x47')]=function(_0x2c5f79,_0x52e228){logger['info']('transfer\x20fired:',_0x2c5f79[_0x4923('0x2d')]);var _0x520df2=transferValidation[_0x4923('0xd')](_0x2c5f79[_0x4923('0x2d')]);if(_0x520df2[_0x4923('0x36')]>0x0){return _0x52e228[_0x4923('0x18')](0x190)[_0x4923('0x35')](_0x520df2);}var _0x5b54b4=_0x2c5f79[_0x4923('0x2d')]['userId'];var _0x1fc770=_0x2c5f79[_0x4923('0x2d')][_0x4923('0x27')];var _0x497e63=_0x2c5f79[_0x4923('0x2d')][_0x4923('0x48')];return getAgent(_0x5b54b4)['then'](function(_0x1adc05){logger[_0x4923('0x2b')](_0x4923('0x3a'),_0x1adc05[_0x4923('0x16')]);emit(util['format'](_0x4923('0x33'),_0x1adc05['name']),_0x4923('0x49'),{'sessionId':_0x1fc770,'transferNumber':_0x497e63});return _0x52e228[_0x4923('0x18')](0xc8)['json']({'error':![],'message':_0x4923('0x4a')});})['catch'](handleError(_0x52e228));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 768d8e7..b17361a 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 _0x0bf7=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x0bf7,0xd1));var _0x70bf=function(_0x1af2e4,_0x3c4f9e){_0x1af2e4=_0x1af2e4-0x0;var _0x39bd89=_0x0bf7[_0x1af2e4];return _0x39bd89;};'use strict';var multer=require('multer');var util=require(_0x70bf('0x0'));var path=require(_0x70bf('0x1'));var timeout=require('connect-timeout');var express=require(_0x70bf('0x2'));var router=express['Router']();var fs_extra=require(_0x70bf('0x3'));var auth=require(_0x70bf('0x4'));var interaction=require(_0x70bf('0x5'));var config=require(_0x70bf('0x6'));var controller=require(_0x70bf('0x7'));router[_0x70bf('0x8')]('/',auth[_0x70bf('0x9')](),controller[_0x70bf('0xa')]);router[_0x70bf('0x8')](_0x70bf('0xb'),auth[_0x70bf('0x9')](),controller[_0x70bf('0xc')]);router[_0x70bf('0x8')](_0x70bf('0xd'),auth[_0x70bf('0x9')](),controller[_0x70bf('0xe')]);router[_0x70bf('0x8')](_0x70bf('0xf'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x10')]);router[_0x70bf('0x8')](_0x70bf('0x11'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x12')]);router[_0x70bf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x70bf('0x13')]);router[_0x70bf('0x8')](_0x70bf('0x14'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x15')]);router[_0x70bf('0x16')]('/',auth[_0x70bf('0x9')](),controller[_0x70bf('0x17')]);router['post'](_0x70bf('0xf'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x18')]);router['post'](_0x70bf('0x11'),auth['isAuthenticated'](),controller[_0x70bf('0x19')]);router[_0x70bf('0x16')]('/:id/users',auth[_0x70bf('0x9')](),controller[_0x70bf('0x1a')]);router[_0x70bf('0x16')](_0x70bf('0x14'),auth['isAuthenticated'](),controller[_0x70bf('0x1b')]);router[_0x70bf('0x16')](_0x70bf('0x1c'),controller[_0x70bf('0x1d')]);router[_0x70bf('0x16')]('/:id/send',auth[_0x70bf('0x9')](),controller['send']);router['put'](_0x70bf('0xd'),auth[_0x70bf('0x9')](),controller['update']);router[_0x70bf('0x1e')]('/:id',auth[_0x70bf('0x9')](),controller[_0x70bf('0x1f')]);router['delete'](_0x70bf('0xf'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x20')]);router[_0x70bf('0x1e')](_0x70bf('0x11'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x21')]);router[_0x70bf('0x1e')](_0x70bf('0x22'),auth[_0x70bf('0x9')](),controller[_0x70bf('0x23')]);module[_0x70bf('0x24')]=router; \ No newline at end of file +var _0x23af=['addAgents','addApplications','/:id/notify','send','put','update','delete','destroy','removeAnswers','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer'];(function(_0x43d18d,_0x104718){var _0x5026ff=function(_0x178d71){while(--_0x178d71){_0x43d18d['push'](_0x43d18d['shift']());}};_0x5026ff(++_0x104718);}(_0x23af,0x1d1));var _0xf23a=function(_0x4b01ae,_0x4ec3fe){_0x4b01ae=_0x4b01ae-0x0;var _0x32086b=_0x23af[_0x4b01ae];return _0x32086b;};'use strict';var multer=require(_0xf23a('0x0'));var util=require(_0xf23a('0x1'));var path=require(_0xf23a('0x2'));var timeout=require(_0xf23a('0x3'));var express=require(_0xf23a('0x4'));var router=express['Router']();var fs_extra=require(_0xf23a('0x5'));var auth=require(_0xf23a('0x6'));var interaction=require(_0xf23a('0x7'));var config=require(_0xf23a('0x8'));var controller=require(_0xf23a('0x9'));router[_0xf23a('0xa')]('/',auth['isAuthenticated'](),controller[_0xf23a('0xb')]);router['get'](_0xf23a('0xc'),auth['isAuthenticated'](),controller[_0xf23a('0xd')]);router['get'](_0xf23a('0xe'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x10')]);router[_0xf23a('0xa')](_0xf23a('0x11'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x12')]);router[_0xf23a('0xa')](_0xf23a('0x13'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x14')]);router[_0xf23a('0xa')](_0xf23a('0x15'),auth['isAuthenticated'](),controller[_0xf23a('0x16')]);router[_0xf23a('0xa')](_0xf23a('0x17'),auth['isAuthenticated'](),controller[_0xf23a('0x18')]);router[_0xf23a('0x19')]('/',auth[_0xf23a('0xf')](),controller[_0xf23a('0x1a')]);router[_0xf23a('0x19')](_0xf23a('0x11'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x1b')]);router[_0xf23a('0x19')](_0xf23a('0x13'),auth['isAuthenticated'](),controller[_0xf23a('0x1c')]);router[_0xf23a('0x19')](_0xf23a('0x15'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x1d')]);router[_0xf23a('0x19')](_0xf23a('0x17'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x1e')]);router[_0xf23a('0x19')](_0xf23a('0x1f'),controller['notify']);router['post']('/:id/send',auth[_0xf23a('0xf')](),controller[_0xf23a('0x20')]);router[_0xf23a('0x21')](_0xf23a('0xe'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x22')]);router[_0xf23a('0x23')]('/:id',auth[_0xf23a('0xf')](),controller[_0xf23a('0x24')]);router[_0xf23a('0x23')](_0xf23a('0x11'),auth[_0xf23a('0xf')](),controller['removeDispositions']);router['delete'](_0xf23a('0x13'),auth[_0xf23a('0xf')](),controller[_0xf23a('0x25')]);router['delete'](_0xf23a('0x15'),auth[_0xf23a('0xf')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index e9aa03e..f08f7ee 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 _0xb5d6=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio','sinch'];(function(_0x46aa6b,_0x978c0d){var _0x42cfdd=function(_0x4cbb05){while(--_0x4cbb05){_0x46aa6b['push'](_0x46aa6b['shift']());}};_0x42cfdd(++_0x978c0d);}(_0xb5d6,0x165));var _0x6b5d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb5d6[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x6b5d('0x0'));var rs=require('randomstring');module[_0x6b5d('0x1')]={'name':{'type':Sequelize[_0x6b5d('0x2')],'unique':_0x6b5d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6b5d('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6b5d('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6b5d('0x2')],'defaultValue':function(){return rs[_0x6b5d('0x4')]();}},'phone':{'type':Sequelize[_0x6b5d('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6b5d('0x5'),_0x6b5d('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x6b5d('0x2')]},'authToken':{'type':Sequelize[_0x6b5d('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6b5d('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6b5d('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6b5d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6b5d('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6b5d('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6b5d('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6b5d('0x9')],'comment':_0x6b5d('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2483ab){if(!_0x2483ab){this[_0x6b5d('0xb')](_0x6b5d('0xc'),null);}this[_0x6b5d('0xb')](_0x6b5d('0xd'),_0x2483ab);}},'description':{'type':Sequelize[_0x6b5d('0x2')]}}; \ No newline at end of file +var _0xea4a=['mandatoryDispositionPauseId','setDataValue','sequelize','STRING','name','generate','ENUM','twilio','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'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xea4a,0xf0));var _0xaea4=function(_0x5e71d4,_0x5a3f20){_0x5e71d4=_0x5e71d4-0x0;var _0x38373d=_0xea4a[_0x5e71d4];return _0x38373d;};'use strict';var Sequelize=require(_0xaea4('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xaea4('0x1')],'unique':_0xaea4('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xaea4('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xaea4('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaea4('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xaea4('0x4')](_0xaea4('0x5'),_0xaea4('0x6'))},'accountSid':{'type':Sequelize[_0xaea4('0x1')]},'baseUrl':{'type':Sequelize[_0xaea4('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xaea4('0x7')],'defaultValue':function(){return _0xaea4('0x8');}},'notificationSound':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaea4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xaea4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaea4('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaea4('0xa')],'comment':_0xaea4('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xaea4('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x19e400){if(!_0x19e400){this['setDataValue'](_0xaea4('0xc'),null);}this[_0xaea4('0xd')]('mandatoryDisposition',_0x19e400);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 871de69..bdaf5a3 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 _0x8c11=['message_id','applications','orderBy','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','replace','whatsapp:','messageId','MessageSid','notifications','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','UserId','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','stringify','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','get','WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','type','VIRTUAL','options','WhatsappAccount','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','WhatsappAccountId','Disposition','rawAttributes','hasOwnProperty','filter','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','pick','removeAnswers','addAgents','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp'];(function(_0x4e8403,_0x2f04c1){var _0x245e4f=function(_0x3f0814){while(--_0x3f0814){_0x4e8403['push'](_0x4e8403['shift']());}};_0x245e4f(++_0x2f04c1);}(_0x8c11,0xf5));var _0x18c1=function(_0x5ba5e4,_0x64c96f){_0x5ba5e4=_0x5ba5e4-0x0;var _0x18b643=_0x8c11[_0x5ba5e4];return _0x18b643;};'use strict';var emlformat=require(_0x18c1('0x0'));var rimraf=require(_0x18c1('0x1'));var zipdir=require(_0x18c1('0x2'));var jsonpatch=require(_0x18c1('0x3'));var rp=require(_0x18c1('0x4'));var moment=require(_0x18c1('0x5'));var BPromise=require(_0x18c1('0x6'));var Mustache=require('mustache');var util=require(_0x18c1('0x7'));var path=require(_0x18c1('0x8'));var sox=require(_0x18c1('0x9'));var csv=require(_0x18c1('0xa'));var ejs=require(_0x18c1('0xb'));var fs=require('fs');var fs_extra=require(_0x18c1('0xc'));var _=require(_0x18c1('0xd'));var squel=require(_0x18c1('0xe'));var crypto=require('crypto');var jsforce=require(_0x18c1('0xf'));var deskjs=require(_0x18c1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x18c1('0x11'));var Papa=require(_0x18c1('0x12'));var Redis=require(_0x18c1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x18c1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x18c1('0x15'))(_0x18c1('0x16'));var utils=require(_0x18c1('0x17'));var config=require(_0x18c1('0x18'));var licenseUtil=require(_0x18c1('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x18c1('0x1a')](config[_0x18c1('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18c1('0x1b')]));require(_0x18c1('0x1c'))[_0x18c1('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x7e1efb,_0x118952,_0xf5817c,_0x142974){return new BPromise(function(_0x50c969,_0x459947){var _0x6306f1=_0x142974||client;return _0x6306f1[_0x18c1('0x1e')](_0x7e1efb,_0xf5817c)['then'](function(_0x253964){logger[_0x18c1('0x1f')](_0x18c1('0x20'),_0x118952,_0x18c1('0x21'));logger[_0x18c1('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x118952,_0x18c1('0x21'),JSON['stringify'](_0x253964));if(_0x253964[_0x18c1('0x23')]){if(_0x253964['error']['code']===0x1f4){logger[_0x18c1('0x23')](_0x18c1('0x20'),_0x118952,_0x253964[_0x18c1('0x23')][_0x18c1('0x24')]);return _0x459947(_0x253964[_0x18c1('0x23')]['message']);}logger[_0x18c1('0x23')](_0x18c1('0x20'),_0x118952,_0x253964['error']['message']);return _0x50c969(_0x253964[_0x18c1('0x23')][_0x18c1('0x24')]);}else{logger[_0x18c1('0x1f')](_0x18c1('0x20'),_0x118952,_0x18c1('0x21'));_0x50c969(_0x253964[_0x18c1('0x25')][_0x18c1('0x24')]);}})['catch'](function(_0x24c1e4){logger[_0x18c1('0x23')](_0x18c1('0x20'),_0x118952,_0x24c1e4);_0x459947(_0x24c1e4);});});}function respondWithStatusCode(_0x40e1e1,_0x1498e9){_0x1498e9=_0x1498e9||0xcc;return function(_0x211a1f){if(_0x211a1f){return _0x40e1e1[_0x18c1('0x26')](_0x1498e9);}return _0x40e1e1[_0x18c1('0x27')](_0x1498e9)['end']();};}function respondWithResult(_0x1f198c,_0x5b8d67){_0x5b8d67=_0x5b8d67||0xc8;return function(_0x504047){if(_0x504047){return _0x1f198c['status'](_0x5b8d67)['json'](_0x504047);}};}function respondWithFilteredResult(_0x26d649,_0x195dc9){return function(_0x2e2988){if(_0x2e2988){var _0x1d3ffc=typeof _0x195dc9[_0x18c1('0x28')]===_0x18c1('0x29')&&typeof _0x195dc9['limit']===_0x18c1('0x29');var _0x19b10a=_0x2e2988[_0x18c1('0x2a')];var _0x228850=_0x1d3ffc?0x0:_0x195dc9[_0x18c1('0x28')];var _0xdfcb2=_0x1d3ffc?_0x2e2988[_0x18c1('0x2a')]:_0x195dc9['offset']+_0x195dc9[_0x18c1('0x2b')];var _0x1431f3;if(_0xdfcb2>=_0x19b10a){_0xdfcb2=_0x19b10a;_0x1431f3=0xc8;}else{_0x1431f3=0xce;}_0x26d649[_0x18c1('0x27')](_0x1431f3);return _0x26d649[_0x18c1('0x2c')](_0x18c1('0x2d'),_0x228850+'-'+_0xdfcb2+'/'+_0x19b10a)[_0x18c1('0x2e')](_0x2e2988);}return null;};}function patchUpdates(_0x2fe8d7){return function(_0x7b41ae){try{jsonpatch['apply'](_0x7b41ae,_0x2fe8d7,!![]);}catch(_0xb0a211){return BPromise[_0x18c1('0x2f')](_0xb0a211);}return _0x7b41ae[_0x18c1('0x30')]();};}function saveUpdates(_0x3683bb,_0x78736f){return function(_0x26fa93){if(_0x26fa93){return _0x26fa93[_0x18c1('0x31')](_0x3683bb)[_0x18c1('0x32')](function(_0x54bc73){return _0x54bc73;});}return null;};}function removeEntity(_0x2c8874,_0x2332c5){return function(_0x19d2ea){if(_0x19d2ea){return _0x19d2ea['destroy']()[_0x18c1('0x32')](function(){var _0x31405e=_0x19d2ea[_0x18c1('0x33')]({'plain':!![]});var _0x4f87b0=_0x18c1('0x34');return db[_0x18c1('0x35')][_0x18c1('0x36')]({'where':{'type':_0x4f87b0,'resourceId':_0x31405e['id']}})[_0x18c1('0x32')](function(){return _0x19d2ea;});})['then'](function(){_0x2c8874[_0x18c1('0x27')](0xcc)[_0x18c1('0x37')]();});}};}function handleEntityNotFound(_0x3d59c6,_0x344c8){return function(_0x8e213d){if(!_0x8e213d){_0x3d59c6['sendStatus'](0x194);}return _0x8e213d;};}function handleError(_0x33d108,_0x523cfa){_0x523cfa=_0x523cfa||0x1f4;return function(_0x98428e){logger['error'](_0x98428e[_0x18c1('0x38')]);if(_0x98428e[_0x18c1('0x39')]){delete _0x98428e['name'];}_0x33d108[_0x18c1('0x27')](_0x523cfa)[_0x18c1('0x3a')](_0x98428e);};}exports['index']=function(_0x558fde,_0x1dc89a){var _0x5eee5b={'include':[{'model':db[_0x18c1('0x3b')],'as':_0x18c1('0x3c')}]},_0x5bbeec={},_0x15e234={'count':0x0,'rows':[]};var _0x1b0113=_[_0x18c1('0x3d')](db['WhatsappAccount']['rawAttributes'],function(_0xd37174){return{'name':_0xd37174[_0x18c1('0x3e')],'type':_0xd37174['type'][_0x18c1('0x3f')]};});_0x5bbeec[_0x18c1('0x40')]=_[_0x18c1('0x3d')](_0x1b0113,_0x18c1('0x39'));_0x5bbeec[_0x18c1('0x41')]=_[_0x18c1('0x42')](_0x558fde['query']);_0x5bbeec[_0x18c1('0x43')]=_['intersection'](_0x5bbeec[_0x18c1('0x40')],_0x5bbeec['query']);_0x5eee5b[_0x18c1('0x44')]=_[_0x18c1('0x45')](_0x5bbeec['model'],qs[_0x18c1('0x46')](_0x558fde[_0x18c1('0x41')][_0x18c1('0x46')]));_0x5eee5b[_0x18c1('0x44')]=_0x5eee5b[_0x18c1('0x44')][_0x18c1('0x47')]?_0x5eee5b['attributes']:_0x5bbeec[_0x18c1('0x40')];if(!_0x558fde['query']['hasOwnProperty'](_0x18c1('0x48'))){_0x5eee5b[_0x18c1('0x2b')]=qs[_0x18c1('0x2b')](_0x558fde['query'][_0x18c1('0x2b')]);_0x5eee5b[_0x18c1('0x28')]=qs[_0x18c1('0x28')](_0x558fde[_0x18c1('0x41')][_0x18c1('0x28')]);}_0x5eee5b[_0x18c1('0x49')]=qs[_0x18c1('0x4a')](_0x558fde[_0x18c1('0x41')][_0x18c1('0x4a')]);_0x5eee5b[_0x18c1('0x4b')]=qs[_0x18c1('0x43')](_['pick'](_0x558fde[_0x18c1('0x41')],_0x5bbeec[_0x18c1('0x43')]),_0x1b0113);if(_0x558fde[_0x18c1('0x41')]['filter']){_0x5eee5b[_0x18c1('0x4b')]=_['merge'](_0x5eee5b[_0x18c1('0x4b')],{'$or':_[_0x18c1('0x3d')](_0x1b0113,function(_0x28f0e6){if(_0x28f0e6[_0x18c1('0x4c')]!==_0x18c1('0x4d')){var _0x2795e6={};_0x2795e6[_0x28f0e6[_0x18c1('0x39')]]={'$like':'%'+_0x558fde[_0x18c1('0x41')]['filter']+'%'};return _0x2795e6;}})});}_0x5eee5b=_['merge']({},_0x5eee5b,_0x558fde[_0x18c1('0x4e')]);var _0x140fd8={'where':_0x5eee5b[_0x18c1('0x4b')]};return db[_0x18c1('0x4f')][_0x18c1('0x2a')](_0x140fd8)[_0x18c1('0x32')](function(_0x3dfee4){_0x15e234[_0x18c1('0x2a')]=_0x3dfee4;if(_0x558fde[_0x18c1('0x41')][_0x18c1('0x50')]){_0x5eee5b['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x18c1('0x51')](_0x5eee5b);})[_0x18c1('0x32')](function(_0x4d2fb0){_0x15e234[_0x18c1('0x52')]=_0x4d2fb0;return _0x15e234;})[_0x18c1('0x32')](respondWithFilteredResult(_0x1dc89a,_0x5eee5b))[_0x18c1('0x53')](handleError(_0x1dc89a,null));};exports[_0x18c1('0x54')]=function(_0x102081,_0x179e35){var _0xe7bce7={'raw':![],'where':{'id':_0x102081[_0x18c1('0x55')]['id']},'include':[{'model':db[_0x18c1('0x3b')],'as':'mandatoryDispositionPause'}]},_0x37b26f={};_0x37b26f[_0x18c1('0x40')]=_['keys'](db[_0x18c1('0x4f')]['rawAttributes']);_0x37b26f[_0x18c1('0x41')]=_[_0x18c1('0x42')](_0x102081['query']);_0x37b26f[_0x18c1('0x43')]=_[_0x18c1('0x45')](_0x37b26f[_0x18c1('0x40')],_0x37b26f[_0x18c1('0x41')]);_0xe7bce7[_0x18c1('0x44')]=_[_0x18c1('0x45')](_0x37b26f[_0x18c1('0x40')],qs[_0x18c1('0x46')](_0x102081[_0x18c1('0x41')][_0x18c1('0x46')]));_0xe7bce7[_0x18c1('0x44')]=_0xe7bce7['attributes'][_0x18c1('0x47')]?_0xe7bce7[_0x18c1('0x44')]:_0x37b26f[_0x18c1('0x40')];if(_0x102081[_0x18c1('0x41')]['includeAll']){_0xe7bce7[_0x18c1('0x56')]=[{'all':!![]}];}_0xe7bce7=_[_0x18c1('0x57')]({},_0xe7bce7,_0x102081[_0x18c1('0x4e')]);return db[_0x18c1('0x4f')][_0x18c1('0x58')](_0xe7bce7)[_0x18c1('0x32')](handleEntityNotFound(_0x179e35,null))[_0x18c1('0x32')](respondWithResult(_0x179e35,null))[_0x18c1('0x53')](handleError(_0x179e35,null));};exports[_0x18c1('0x59')]=function(_0x45f36a,_0x44d4ce){return db[_0x18c1('0x4f')][_0x18c1('0x59')](_0x45f36a[_0x18c1('0x5a')],{})[_0x18c1('0x32')](function(_0x582cb2){var _0x9c0b02=_0x45f36a[_0x18c1('0x5b')][_0x18c1('0x33')]({'plain':!![]});if(!_0x9c0b02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9c0b02[_0x18c1('0x5c')]===_0x18c1('0x5b')){var _0x4d6ab8=_0x582cb2['get']({'plain':!![]});var _0x3d8f2b=_0x18c1('0x34');return db[_0x18c1('0x5d')][_0x18c1('0x58')]({'where':{'name':_0x3d8f2b,'userProfileId':_0x9c0b02[_0x18c1('0x5e')]},'raw':!![]})[_0x18c1('0x32')](function(_0x537897){if(_0x537897&&_0x537897[_0x18c1('0x5f')]===0x0){return db['UserProfileResource'][_0x18c1('0x59')]({'name':_0x4d6ab8[_0x18c1('0x39')],'resourceId':_0x4d6ab8['id'],'type':_0x537897['name'],'sectionId':_0x537897['id']},{})['then'](function(){return _0x582cb2;});}else{return _0x582cb2;}})[_0x18c1('0x53')](function(_0x135354){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x135354);throw _0x135354;});}return _0x582cb2;})[_0x18c1('0x32')](respondWithResult(_0x44d4ce,0xc9))['catch'](handleError(_0x44d4ce,null));};exports['update']=function(_0xba9ac1,_0x3a26c7){if(_0xba9ac1[_0x18c1('0x5a')]['id']){delete _0xba9ac1[_0x18c1('0x5a')]['id'];}return db[_0x18c1('0x4f')][_0x18c1('0x58')]({'where':{'id':_0xba9ac1['params']['id']},'include':[{'model':db['Pause'],'as':_0x18c1('0x3c')}]})[_0x18c1('0x32')](handleEntityNotFound(_0x3a26c7,null))[_0x18c1('0x32')](saveUpdates(_0xba9ac1[_0x18c1('0x5a')],null))[_0x18c1('0x32')](respondWithResult(_0x3a26c7,null))[_0x18c1('0x53')](handleError(_0x3a26c7,null));};exports[_0x18c1('0x36')]=function(_0x374377,_0x521a6d){return db[_0x18c1('0x4f')][_0x18c1('0x58')]({'where':{'id':_0x374377[_0x18c1('0x55')]['id']}})[_0x18c1('0x32')](handleEntityNotFound(_0x521a6d,null))[_0x18c1('0x32')](removeEntity(_0x521a6d,null))[_0x18c1('0x53')](handleError(_0x521a6d,null));};exports[_0x18c1('0x60')]=function(_0x2be454,_0x4d2aef){return db['WhatsappAccount'][_0x18c1('0x60')]()['then'](respondWithResult(_0x4d2aef,null))[_0x18c1('0x53')](handleError(_0x4d2aef,null));};exports['addDisposition']=function(_0x3a1146,_0x319cf4,_0x592a2c){if(_0x3a1146['body']['id']){delete _0x3a1146['body']['id'];}return db['WhatsappAccount'][_0x18c1('0x58')]({'where':{'id':_0x3a1146[_0x18c1('0x55')]['id']}})[_0x18c1('0x32')](handleEntityNotFound(_0x319cf4,null))[_0x18c1('0x32')](function(_0x4d44b0){if(_0x4d44b0){_0x3a1146['body'][_0x18c1('0x61')]=_0x4d44b0['id'];return db[_0x18c1('0x62')][_0x18c1('0x59')](_0x3a1146[_0x18c1('0x5a')]);}})[_0x18c1('0x32')](respondWithResult(_0x319cf4,null))[_0x18c1('0x53')](handleError(_0x319cf4,null));};exports['getDispositions']=function(_0x1ba277,_0x5a5245,_0x191d70){var _0x5ec772={'raw':![],'where':{}};var _0xbe55de={};var _0x8cbce5={'count':0x0,'rows':[]};return db[_0x18c1('0x4f')]['findOne']({'where':{'id':_0x1ba277[_0x18c1('0x55')]['id']}})['then'](handleEntityNotFound(_0x5a5245,null))['then'](function(_0x1b7379){if(_0x1b7379){_0xbe55de['model']=_['keys'](db['Disposition'][_0x18c1('0x63')]);_0xbe55de[_0x18c1('0x41')]=_[_0x18c1('0x42')](_0x1ba277['query']);_0xbe55de['filters']=_['intersection'](_0xbe55de[_0x18c1('0x40')],_0xbe55de['query']);_0x5ec772[_0x18c1('0x44')]=_['intersection'](_0xbe55de[_0x18c1('0x40')],qs[_0x18c1('0x46')](_0x1ba277[_0x18c1('0x41')]['fields']));_0x5ec772[_0x18c1('0x44')]=_0x5ec772[_0x18c1('0x44')]['length']?_0x5ec772[_0x18c1('0x44')]:_0xbe55de['model'];if(!_0x1ba277['query'][_0x18c1('0x64')]('nolimit')){_0x5ec772[_0x18c1('0x2b')]=qs['limit'](_0x1ba277[_0x18c1('0x41')][_0x18c1('0x2b')]);_0x5ec772['offset']=qs['offset'](_0x1ba277[_0x18c1('0x41')][_0x18c1('0x28')]);}_0x5ec772[_0x18c1('0x49')]=qs[_0x18c1('0x4a')](_0x1ba277[_0x18c1('0x41')][_0x18c1('0x4a')]);_0x5ec772['where']=qs['filters'](_['pick'](_0x1ba277[_0x18c1('0x41')],_0xbe55de[_0x18c1('0x43')]));_0x5ec772[_0x18c1('0x4b')][_0x18c1('0x61')]=_0x1b7379['id'];if(_0x1ba277['query'][_0x18c1('0x65')]){_0x5ec772[_0x18c1('0x4b')]=_['merge'](_0x5ec772[_0x18c1('0x4b')],{'$or':_[_0x18c1('0x3d')](_0x5ec772[_0x18c1('0x44')],function(_0x15a3f6){var _0x29e3b5={};_0x29e3b5[_0x15a3f6]={'$like':'%'+_0x1ba277[_0x18c1('0x41')]['filter']+'%'};return _0x29e3b5;})});}_0x5ec772=_['merge']({},_0x5ec772,_0x1ba277['options']);return db[_0x18c1('0x62')]['count']({'where':_0x5ec772[_0x18c1('0x4b')]})[_0x18c1('0x32')](function(_0x59e386){_0x8cbce5[_0x18c1('0x2a')]=_0x59e386;if(_0x1ba277[_0x18c1('0x41')]['includeAll']){_0x5ec772[_0x18c1('0x56')]=[{'all':!![]}];}return db[_0x18c1('0x62')][_0x18c1('0x51')](_0x5ec772);})[_0x18c1('0x32')](function(_0x682bcd){_0x8cbce5['rows']=_0x682bcd;return _0x8cbce5;});}})[_0x18c1('0x32')](respondWithFilteredResult(_0x5a5245,_0x5ec772))[_0x18c1('0x53')](handleError(_0x5a5245,null));};exports['removeDispositions']=function(_0x30ddd,_0x27ddb0,_0x27f8f6){return db['WhatsappAccount']['find']({'where':{'id':_0x30ddd[_0x18c1('0x55')]['id']}})['then'](handleEntityNotFound(_0x27ddb0,null))['then'](function(_0x4fc3d6){if(_0x4fc3d6){return _0x4fc3d6[_0x18c1('0x66')](_0x30ddd[_0x18c1('0x41')][_0x18c1('0x67')]);}})[_0x18c1('0x32')](respondWithStatusCode(_0x27ddb0,null))[_0x18c1('0x53')](handleError(_0x27ddb0,null));};exports[_0x18c1('0x68')]=function(_0x4eb066,_0xf40248,_0x4bf306){if(_0x4eb066[_0x18c1('0x5a')]['id']){delete _0x4eb066[_0x18c1('0x5a')]['id'];}return db[_0x18c1('0x4f')][_0x18c1('0x58')]({'where':{'id':_0x4eb066[_0x18c1('0x55')]['id']}})['then'](handleEntityNotFound(_0xf40248,null))[_0x18c1('0x32')](function(_0x3a1f8b){if(_0x3a1f8b){_0x4eb066['body'][_0x18c1('0x61')]=_0x3a1f8b['id'];return db['CannedAnswer']['create'](_0x4eb066[_0x18c1('0x5a')]);}})[_0x18c1('0x32')](respondWithResult(_0xf40248,null))[_0x18c1('0x53')](handleError(_0xf40248,null));};exports[_0x18c1('0x69')]=function(_0x5d3773,_0x2c62ed,_0x728fa9){var _0x5bd92d={'raw':![],'where':{}};var _0x494a07={};var _0x2f382e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x18c1('0x6a')]({'where':{'id':_0x5d3773[_0x18c1('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c62ed,null))[_0x18c1('0x32')](function(_0x4a3c6){if(_0x4a3c6){_0x494a07['model']=_['keys'](db[_0x18c1('0x6b')][_0x18c1('0x63')]);_0x494a07['query']=_[_0x18c1('0x42')](_0x5d3773[_0x18c1('0x41')]);_0x494a07[_0x18c1('0x43')]=_[_0x18c1('0x45')](_0x494a07[_0x18c1('0x40')],_0x494a07[_0x18c1('0x41')]);_0x5bd92d[_0x18c1('0x44')]=_[_0x18c1('0x45')](_0x494a07[_0x18c1('0x40')],qs[_0x18c1('0x46')](_0x5d3773[_0x18c1('0x41')][_0x18c1('0x46')]));_0x5bd92d[_0x18c1('0x44')]=_0x5bd92d[_0x18c1('0x44')][_0x18c1('0x47')]?_0x5bd92d['attributes']:_0x494a07['model'];if(!_0x5d3773[_0x18c1('0x41')][_0x18c1('0x64')](_0x18c1('0x48'))){_0x5bd92d['limit']=qs[_0x18c1('0x2b')](_0x5d3773[_0x18c1('0x41')][_0x18c1('0x2b')]);_0x5bd92d[_0x18c1('0x28')]=qs[_0x18c1('0x28')](_0x5d3773[_0x18c1('0x41')][_0x18c1('0x28')]);}_0x5bd92d[_0x18c1('0x49')]=qs[_0x18c1('0x4a')](_0x5d3773[_0x18c1('0x41')]['sort']);_0x5bd92d[_0x18c1('0x4b')]=qs[_0x18c1('0x43')](_[_0x18c1('0x6c')](_0x5d3773[_0x18c1('0x41')],_0x494a07['filters']));_0x5bd92d[_0x18c1('0x4b')][_0x18c1('0x61')]=_0x4a3c6['id'];if(_0x5d3773[_0x18c1('0x41')][_0x18c1('0x65')]){_0x5bd92d['where']=_[_0x18c1('0x57')](_0x5bd92d[_0x18c1('0x4b')],{'$or':_['map'](_0x5bd92d[_0x18c1('0x44')],function(_0x57480c){var _0x415631={};_0x415631[_0x57480c]={'$like':'%'+_0x5d3773[_0x18c1('0x41')][_0x18c1('0x65')]+'%'};return _0x415631;})});}_0x5bd92d=_[_0x18c1('0x57')]({},_0x5bd92d,_0x5d3773[_0x18c1('0x4e')]);return db['CannedAnswer']['count']({'where':_0x5bd92d[_0x18c1('0x4b')]})['then'](function(_0x266095){_0x2f382e[_0x18c1('0x2a')]=_0x266095;if(_0x5d3773[_0x18c1('0x41')][_0x18c1('0x50')]){_0x5bd92d[_0x18c1('0x56')]=[{'all':!![]}];}return db[_0x18c1('0x6b')][_0x18c1('0x51')](_0x5bd92d);})[_0x18c1('0x32')](function(_0x177bbe){_0x2f382e['rows']=_0x177bbe;return _0x2f382e;});}})[_0x18c1('0x32')](respondWithFilteredResult(_0x2c62ed,_0x5bd92d))[_0x18c1('0x53')](handleError(_0x2c62ed,null));};exports[_0x18c1('0x6d')]=function(_0xb602af,_0xc9f2c2,_0x1aadc4){return db[_0x18c1('0x4f')][_0x18c1('0x58')]({'where':{'id':_0xb602af[_0x18c1('0x55')]['id']}})[_0x18c1('0x32')](handleEntityNotFound(_0xc9f2c2,null))[_0x18c1('0x32')](function(_0x571039){if(_0x571039){return _0x571039[_0x18c1('0x6d')](_0xb602af[_0x18c1('0x41')]['ids']);}})[_0x18c1('0x32')](respondWithStatusCode(_0xc9f2c2,null))[_0x18c1('0x53')](handleError(_0xc9f2c2,null));};exports['addAgents']=function(_0x44dd12,_0x1d1365,_0xb94295){return db['WhatsappAccount'][_0x18c1('0x58')]({'where':{'id':_0x44dd12[_0x18c1('0x55')]['id']}})[_0x18c1('0x32')](handleEntityNotFound(_0x1d1365,null))['then'](function(_0xfc8a16){if(_0xfc8a16){return _0xfc8a16[_0x18c1('0x6e')](_0x44dd12[_0x18c1('0x5a')][_0x18c1('0x67')],_['omit'](_0x44dd12[_0x18c1('0x5a')],[_0x18c1('0x67'),'id'])||{})['spread'](function(_0x5c94f9){for(var _0x53df84=0x0;_0x53df84<_0x44dd12[_0x18c1('0x5a')]['ids'][_0x18c1('0x47')];_0x53df84+=0x1){socket['emit'](_0x18c1('0x6f'),{'UserId':Number(_0x44dd12['body'][_0x18c1('0x67')][_0x53df84]),'WhatsappAccountId':Number(_0x44dd12[_0x18c1('0x55')]['id'])});}return _0x5c94f9;});}})['then'](respondWithResult(_0x1d1365,null))[_0x18c1('0x53')](handleError(_0x1d1365,null));};exports[_0x18c1('0x70')]=function(_0x3f786a,_0x57dd54,_0x3339a3){return db[_0x18c1('0x4f')][_0x18c1('0x58')]({'where':{'id':_0x3f786a[_0x18c1('0x55')]['id']}})[_0x18c1('0x32')](handleEntityNotFound(_0x57dd54,null))[_0x18c1('0x32')](function(_0x1b3a66){if(_0x1b3a66){return _0x1b3a66[_0x18c1('0x70')](_0x3f786a[_0x18c1('0x41')][_0x18c1('0x67')])[_0x18c1('0x32')](function(){if(_[_0x18c1('0x71')](_0x3f786a[_0x18c1('0x41')][_0x18c1('0x67')])){for(var _0x187a2c=0x0;_0x187a2c<_0x3f786a['query'][_0x18c1('0x67')][_0x18c1('0x47')];_0x187a2c+=0x1){socket[_0x18c1('0x72')](_0x18c1('0x73'),{'UserId':Number(_0x3f786a[_0x18c1('0x41')][_0x18c1('0x67')][_0x187a2c]),'WhatsappAccountId':Number(_0x3f786a['params']['id'])});}}else{socket[_0x18c1('0x72')](_0x18c1('0x73'),{'UserId':Number(_0x3f786a[_0x18c1('0x41')][_0x18c1('0x67')]),'WhatsappAccountId':Number(_0x3f786a[_0x18c1('0x55')]['id'])});}});}})[_0x18c1('0x32')](respondWithStatusCode(_0x57dd54,null))[_0x18c1('0x53')](handleError(_0x57dd54,null));};exports[_0x18c1('0x74')]=function(_0x2b61d2,_0x10676a,_0x4b1008){var _0x8a66b0={};var _0x10a182={};var _0x8a3048;var _0x32fee2;return db[_0x18c1('0x4f')][_0x18c1('0x6a')]({'where':{'id':_0x2b61d2['params']['id']}})[_0x18c1('0x32')](handleEntityNotFound(_0x10676a,null))['then'](function(_0x37257c){if(_0x37257c){_0x8a3048=_0x37257c;_0x10a182[_0x18c1('0x40')]=_[_0x18c1('0x42')](db[_0x18c1('0x75')][_0x18c1('0x63')]);_0x10a182[_0x18c1('0x41')]=_[_0x18c1('0x42')](_0x2b61d2['query']);_0x10a182[_0x18c1('0x43')]=_[_0x18c1('0x45')](_0x10a182[_0x18c1('0x40')],_0x10a182['query']);_0x8a66b0[_0x18c1('0x44')]=_[_0x18c1('0x45')](_0x10a182[_0x18c1('0x40')],qs[_0x18c1('0x46')](_0x2b61d2[_0x18c1('0x41')][_0x18c1('0x46')]));_0x8a66b0['attributes']=_0x8a66b0[_0x18c1('0x44')]['length']?_0x8a66b0[_0x18c1('0x44')]:_0x10a182[_0x18c1('0x40')];_0x8a66b0[_0x18c1('0x49')]=qs[_0x18c1('0x4a')](_0x2b61d2[_0x18c1('0x41')][_0x18c1('0x4a')]);_0x8a66b0[_0x18c1('0x4b')]=qs[_0x18c1('0x43')](_[_0x18c1('0x6c')](_0x2b61d2[_0x18c1('0x41')],_0x10a182[_0x18c1('0x43')]));if(_0x2b61d2['query'][_0x18c1('0x65')]){_0x8a66b0[_0x18c1('0x4b')]=_[_0x18c1('0x57')](_0x8a66b0[_0x18c1('0x4b')],{'$or':_[_0x18c1('0x3d')](_0x8a66b0[_0x18c1('0x44')],function(_0x4ad894){var _0x53e94e={};_0x53e94e[_0x4ad894]={'$like':'%'+_0x2b61d2[_0x18c1('0x41')][_0x18c1('0x65')]+'%'};return _0x53e94e;})});}_0x8a66b0=_[_0x18c1('0x57')]({},_0x8a66b0,_0x2b61d2[_0x18c1('0x4e')]);return _0x8a3048[_0x18c1('0x74')](_0x8a66b0);}})[_0x18c1('0x32')](function(_0x4c8045){if(_0x4c8045){_0x32fee2=_0x4c8045['length'];if(!_0x2b61d2[_0x18c1('0x41')][_0x18c1('0x64')](_0x18c1('0x48'))){_0x8a66b0[_0x18c1('0x2b')]=qs[_0x18c1('0x2b')](_0x2b61d2['query'][_0x18c1('0x2b')]);_0x8a66b0[_0x18c1('0x28')]=qs[_0x18c1('0x28')](_0x2b61d2[_0x18c1('0x41')]['offset']);}return _0x8a3048[_0x18c1('0x74')](_0x8a66b0);}})['then'](function(_0x4ac998){if(_0x4ac998){return _0x4ac998?{'count':_0x32fee2,'rows':_0x4ac998}:null;}})[_0x18c1('0x32')](respondWithResult(_0x10676a,null))[_0x18c1('0x53')](handleError(_0x10676a,null));};exports[_0x18c1('0x76')]=function(_0x22183b,_0x2b57a6){var _0xc41bb9=_0x22183b[_0x18c1('0x55')]['id'];var _0x2c5c66=_0x22183b[_0x18c1('0x5a')];var _0x4c8ef6=0xc8;var _0xf0306d=null;return db['sequelize'][_0x18c1('0x77')]({'isolationLevel':db[_0x18c1('0x78')][_0x18c1('0x79')]['ISOLATION_LEVELS'][_0x18c1('0x7a')]},function(_0x1fee64){return db[_0x18c1('0x4f')][_0x18c1('0x6a')]({'where':{'id':_0xc41bb9},'transaction':_0x1fee64})['then'](function(_0x310e47){if(_0x310e47){return db['WhatsappApplication'][_0x18c1('0x36')]({'where':{'WhatsappAccountId':_0xc41bb9},'transaction':_0x1fee64})[_0x18c1('0x32')](function(){var _0x323d2e=_['map'](_0x2c5c66,function(_0x28df1d){_0x28df1d[_0x18c1('0x61')]=_0xc41bb9;return _0x28df1d;});return db[_0x18c1('0x7b')]['bulkCreate'](_0x323d2e,{'transaction':_0x1fee64});});}else{_0x4c8ef6=0x194;_0xf0306d=[];}});})[_0x18c1('0x32')](function(){if(_0x4c8ef6!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0xc41bb9},'order':_0x18c1('0x7c')})[_0x18c1('0x32')](function(_0x2ee37b){_0xf0306d=_0x2ee37b;});}})[_0x18c1('0x53')](function(_0x39a397){_0x4c8ef6=0x1f4;logger[_0x18c1('0x23')](_0x39a397[_0x18c1('0x38')]);if(_0x39a397['name']){delete _0x39a397[_0x18c1('0x39')];}_0xf0306d=_0x39a397;})[_0x18c1('0x7d')](function(){if(_0xf0306d===null){_0x2b57a6[_0x18c1('0x26')](_0x4c8ef6);}else{if(_0x4c8ef6===0x1f4){_0x2b57a6[_0x18c1('0x27')](_0x4c8ef6)[_0x18c1('0x3a')](_0xf0306d);}else{_0x2b57a6[_0x18c1('0x27')](_0x4c8ef6)[_0x18c1('0x2e')](_0xf0306d);}}});};exports[_0x18c1('0x7e')]=function(_0xa2ed50,_0x1cd42a,_0x96eeb6){var _0x2ca680={};var _0x4cccf6={};var _0x30ef86;var _0x1df8d6;return db[_0x18c1('0x4f')][_0x18c1('0x6a')]({'where':{'id':_0xa2ed50['params']['id']}})['then'](handleEntityNotFound(_0x1cd42a,null))['then'](function(_0x2c91d2){if(_0x2c91d2){_0x30ef86=_0x2c91d2;_0x4cccf6['model']=_[_0x18c1('0x42')](db[_0x18c1('0x7b')][_0x18c1('0x63')]);_0x4cccf6['query']=_[_0x18c1('0x42')](_0xa2ed50[_0x18c1('0x41')]);_0x4cccf6[_0x18c1('0x43')]=_['intersection'](_0x4cccf6[_0x18c1('0x40')],_0x4cccf6[_0x18c1('0x41')]);_0x2ca680[_0x18c1('0x44')]=_[_0x18c1('0x45')](_0x4cccf6[_0x18c1('0x40')],qs[_0x18c1('0x46')](_0xa2ed50[_0x18c1('0x41')][_0x18c1('0x46')]));_0x2ca680[_0x18c1('0x44')]=_0x2ca680[_0x18c1('0x44')][_0x18c1('0x47')]?_0x2ca680[_0x18c1('0x44')]:_0x4cccf6[_0x18c1('0x40')];_0x2ca680[_0x18c1('0x49')]=qs[_0x18c1('0x4a')](_0xa2ed50[_0x18c1('0x41')][_0x18c1('0x4a')]);_0x2ca680[_0x18c1('0x4b')]=qs[_0x18c1('0x43')](_[_0x18c1('0x6c')](_0xa2ed50[_0x18c1('0x41')],_0x4cccf6[_0x18c1('0x43')]));if(_0xa2ed50[_0x18c1('0x41')][_0x18c1('0x65')]){_0x2ca680[_0x18c1('0x4b')]=_[_0x18c1('0x57')](_0x2ca680['where'],{'$or':_['map'](_0x2ca680[_0x18c1('0x44')],function(_0xb4f4ab){var _0x4c5df3={};_0x4c5df3[_0xb4f4ab]={'$like':'%'+_0xa2ed50[_0x18c1('0x41')]['filter']+'%'};return _0x4c5df3;})});}_0x2ca680=_['merge']({},_0x2ca680,_0xa2ed50[_0x18c1('0x4e')]);return _0x30ef86[_0x18c1('0x7e')](_0x2ca680);}})[_0x18c1('0x32')](function(_0x419197){if(_0x419197){_0x1df8d6=_0x419197[_0x18c1('0x47')];if(!_0xa2ed50[_0x18c1('0x41')]['hasOwnProperty'](_0x18c1('0x48'))){_0x2ca680[_0x18c1('0x2b')]=qs['limit'](_0xa2ed50[_0x18c1('0x41')][_0x18c1('0x2b')]);_0x2ca680[_0x18c1('0x28')]=qs['offset'](_0xa2ed50[_0x18c1('0x41')][_0x18c1('0x28')]);}return _0x30ef86[_0x18c1('0x7e')](_0x2ca680);}})[_0x18c1('0x32')](function(_0xd585d2){if(_0xd585d2){return _0xd585d2?{'count':_0x1df8d6,'rows':_0xd585d2}:null;}})[_0x18c1('0x32')](respondWithResult(_0x1cd42a,null))['catch'](handleError(_0x1cd42a,null));};exports[_0x18c1('0x7f')]=function(_0x501a7f,_0x1a9ab0,_0x16bb9c){var _0x49e632={'channel':_0x18c1('0x80')};var _0x41e767=[];var _0x41c74d=[];var _0x35550e={};return db['WhatsappAccount'][_0x18c1('0x58')]({'where':{'id':_0x501a7f[_0x18c1('0x55')]['id']},'include':[{'model':db[_0x18c1('0x7b')],'as':_0x18c1('0x81')}]})[_0x18c1('0x32')](handleEntityNotFound(_0x1a9ab0,null))[_0x18c1('0x32')](function(_0x299ff4){_0x49e632['account']=_0x299ff4;if(_0x49e632['account']&&_0x49e632[_0x18c1('0x82')][_0x18c1('0x4c')]===_0x18c1('0x83')&&_0x501a7f[_0x18c1('0x5a')][_0x18c1('0x84')]){if(_0x501a7f[_0x18c1('0x5a')][_0x18c1('0x84')]['length']===0x0)return;if(_0x501a7f[_0x18c1('0x5a')][_0x18c1('0x84')][0x0][_0x18c1('0x85')]!==_0x18c1('0x86'))return;return db[_0x18c1('0x87')][_0x18c1('0x31')]({'read':!![],'readAt':_0x501a7f['body']['statuses'][0x0][_0x18c1('0x88')]},{'where':{'messageId':_0x501a7f['body']['statuses'][0x0][_0x18c1('0x89')]},'individualHooks':!![]})['then'](function(_0x5bf176){return _0x1a9ab0[_0x18c1('0x27')](0xc8)['json'](_0x5bf176);});}_0x49e632[_0x18c1('0x8a')]=_[_0x18c1('0x8b')](_0x299ff4[_0x18c1('0x81')],[_0x18c1('0x7c')],['asc']);if(_0x49e632[_0x18c1('0x82')][_0x18c1('0x81')]){delete _0x49e632[_0x18c1('0x82')][_0x18c1('0x81')];}return db['CmContact'][_0x18c1('0x60')]()[_0x18c1('0x32')](function(_0xce8b2){if(!_0xce8b2){throw new db[(_0x18c1('0x8c'))][(_0x18c1('0x8d'))]('no\x20available\x20attributes');}_0x41e767=_[_0x18c1('0x8e')](_[_0x18c1('0x42')](_0xce8b2),[_0x18c1('0x8f'),_0x18c1('0x90')]);_0x41c74d=_[_0x18c1('0x8e')](_[_0x18c1('0x42')](_0xce8b2),['createdAt',_0x18c1('0x90'),'CompanyId',_0x18c1('0x91')]);_0x49e632[_0x18c1('0x5a')]={'mapKey':_0x18c1('0x92')};if(_0x49e632[_0x18c1('0x82')]&&_0x49e632[_0x18c1('0x82')][_0x18c1('0x4c')]===_0x18c1('0x93')){_0x49e632['body'][_0x18c1('0x94')]=_0x501a7f[_0x18c1('0x5a')]['From'][_0x18c1('0x95')](_0x18c1('0x96'),'');_0x49e632[_0x18c1('0x5a')][_0x18c1('0x5a')]=_0x501a7f[_0x18c1('0x5a')]['Body'];_0x49e632[_0x18c1('0x5a')][_0x18c1('0x97')]=_0x501a7f['body'][_0x18c1('0x98')];}if(_0x49e632['account']&&_0x49e632[_0x18c1('0x82')][_0x18c1('0x4c')]===_0x18c1('0x83')){_0x49e632[_0x18c1('0x5a')][_0x18c1('0x94')]=_0x501a7f[_0x18c1('0x5a')][_0x18c1('0x99')][0x0][_0x18c1('0x94')];_0x49e632[_0x18c1('0x5a')][_0x18c1('0x5a')]=_0x501a7f['body'][_0x18c1('0x99')][0x0]['message'][_0x18c1('0x5a')];_0x49e632['body']['messageId']=_0x501a7f[_0x18c1('0x5a')]['notifications'][0x0][_0x18c1('0x89')];}if(_0x49e632['body']['id']){delete _0x49e632[_0x18c1('0x5a')]['id'];}if(_[_0x18c1('0x9a')](_0x49e632['body'][_0x18c1('0x94')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x49e632['body'][_0x18c1('0x5a')])||_0x49e632[_0x18c1('0x5a')][_0x18c1('0x5a')]===''){throw new db[(_0x18c1('0x8c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x49e632[_0x18c1('0x5a')][_0x18c1('0x9b')])){throw new db['Sequelize'][(_0x18c1('0x8d'))](_0x18c1('0x9c')+_0x41c74d);}if(!_['includes'](_0x41c74d,_0x49e632[_0x18c1('0x5a')][_0x18c1('0x9b')])){throw new db[(_0x18c1('0x8c'))][(_0x18c1('0x8d'))](_0x18c1('0x9d')+_0x41c74d);}_0x35550e[_0x49e632[_0x18c1('0x5a')][_0x18c1('0x9b')]]=_0x49e632[_0x18c1('0x5a')][_0x18c1('0x94')];return db[_0x18c1('0x9e')][_0x18c1('0x58')]({'where':{'id':_0x49e632[_0x18c1('0x82')][_0x18c1('0x91')]},'include':[{'model':db[_0x18c1('0x9f')],'as':_0x18c1('0xa0'),'where':_0x35550e,'limit':0x1,'order':[[_0x18c1('0x90'),_0x18c1('0xa1')]]}]});})[_0x18c1('0x32')](handleEntityNotFound(_0x1a9ab0,null))[_0x18c1('0x32')](function(_0x5b77f5){if(_0x5b77f5){_0x49e632[_0x18c1('0xa2')]=_['omit'](_0x5b77f5,[_0x18c1('0xa0')]);if(_0x5b77f5[_0x18c1('0xa0')][_0x18c1('0x47')]){return _0x5b77f5[_0x18c1('0xa0')][0x0];}var _0x1a145f=_[_0x18c1('0x1a')](_0x49e632[_0x18c1('0x5a')],{'firstName':_0x49e632[_0x18c1('0x5a')]['from'],'ListId':_0x5b77f5['id']});_0x1a145f[_0x49e632[_0x18c1('0x5a')][_0x18c1('0x9b')]]=_0x49e632[_0x18c1('0x5a')][_0x18c1('0x94')];return db['CmContact'][_0x18c1('0x59')](_0x1a145f,{'fields':_0x41e767,'raw':!![]});}})['then'](handleEntityNotFound(_0x1a9ab0,null))[_0x18c1('0x32')](function(_0x133d89){if(_0x133d89){_0x49e632[_0x18c1('0xa3')]=_0x133d89;var _0x11bea4={'ContactId':_0x133d89['id'],'phone':_0x49e632[_0x18c1('0x5a')][_0x18c1('0x94')],'WhatsappAccountId':_0x501a7f['params']['id']};var _0x19a479={'ContactId':_0x133d89['id'],'WhatsappAccountId':_0x501a7f[_0x18c1('0x55')]['id'],'closed':![]};return db[_0x18c1('0xa4')][_0x18c1('0x58')]({'where':_0x19a479})[_0x18c1('0x32')](function(_0x553007){if(_0x553007){return[_0x553007,![]];}return db[_0x18c1('0xa4')][_0x18c1('0x59')](_0x11bea4)[_0x18c1('0x32')](function(_0x3f8dae){return[_0x3f8dae,!![]];});});}})[_0x18c1('0xa5')](function(_0x5b6c15,_0x32a15a){_0x49e632[_0x18c1('0xa6')]=_0x5b6c15['get']({'plain':!![]});_0x49e632['interaction']['created']=![];if(_0x32a15a){if(_0x49e632[_0x18c1('0x82')][_0x18c1('0xa7')]){_0x49e632[_0x18c1('0x8a')][_0x18c1('0xa8')]({'id':0x0,'priority':_0x49e632[_0x18c1('0x8a')]['length']+0x1,'app':_0x18c1('0xa9'),'appdata':_0x18c1('0xaa'),'interval':'*,*,*,*'});}_0x49e632['interaction'][_0x18c1('0xab')]=!![];}return db[_0x18c1('0x87')][_0x18c1('0x59')]({'phone':_0x49e632[_0x18c1('0x5a')][_0x18c1('0x94')],'messageId':_0x49e632[_0x18c1('0x5a')][_0x18c1('0x97')],'body':_0x49e632[_0x18c1('0x5a')]['body'],'WhatsappAccountId':_0x501a7f['params']['id'],'WhatsappInteractionId':_0x5b6c15['id'],'direction':'in','ContactId':_0x5b6c15[_0x18c1('0xac')],'AttachmentId':_0x49e632['body'][_0x18c1('0xad')]});})[_0x18c1('0x32')](function(_0x522b29){_0x49e632[_0x18c1('0x24')]=_0x522b29;if(!_0x49e632[_0x18c1('0xa6')]['UserId'])return;return db['User'][_0x18c1('0x58')]({'attributes':['id',_0x18c1('0x39')],'where':{'id':_0x49e632['interaction'][_0x18c1('0xae')]}});})['then'](function(_0xd805bd){if(_0xd805bd){_0x49e632[_0x18c1('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xd805bd[_0x18c1('0x39')]+','+(_0x49e632[_0x18c1('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x18c1('0xaf')});}if(!_0x49e632['interaction']['queueId'])return;return db['WhatsappQueue'][_0x18c1('0x58')]({'attributes':['id','name'],'where':{'id':_0x49e632[_0x18c1('0xa6')][_0x18c1('0xb0')]}});})['then'](function(_0x3cecd2){if(_0x3cecd2){_0x49e632[_0x18c1('0x8a')]['unshift']({'id':0x0,'priority':0x1,'app':_0x18c1('0xb1'),'appdata':_0x3cecd2['name']+','+(_0x49e632[_0x18c1('0x82')][_0x18c1('0xb2')]||0x12c),'interval':_0x18c1('0xaf')});}return respondWithRpcPromise(_0x18c1('0xb3'),_0x18c1('0xb4'),_0x49e632);})[_0x18c1('0x32')](function(_0x17e534){if(_0x17e534){var _0x489fbb=0xc8;var _0xe7f775=_0x18c1('0xb5');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe7f775,_0x489fbb,'entity\x20found');logger[_0x18c1('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xe7f775,_0x489fbb,_0x18c1('0xb6'),JSON[_0x18c1('0xb7')](_0x17e534));if(_0x49e632[_0x18c1('0x82')][_0x18c1('0x4c')]===_0x18c1('0x93')){return _0x1a9ab0['status'](_0x489fbb)[_0x18c1('0x2c')]('Content-Type',_0x18c1('0xb8'))[_0x18c1('0x3a')]('\x0a');}else{return _0x1a9ab0['status'](_0x489fbb)[_0x18c1('0x2e')](_0x17e534);}}});})['catch'](handleError(_0x1a9ab0,null));};exports[_0x18c1('0x3a')]=function(_0x3307d1,_0x97ec4f,_0x39f4d3){var _0x4d2b58,_0x3e8391,_0x108299;if(_[_0x18c1('0x9a')](_0x3307d1[_0x18c1('0x5a')][_0x18c1('0x5a')])||_0x3307d1[_0x18c1('0x5a')][_0x18c1('0x5a')]===''){throw new db[(_0x18c1('0x8c'))][(_0x18c1('0x8d'))](_0x18c1('0xb9'));}if(_[_0x18c1('0x9a')](_0x3307d1[_0x18c1('0x5a')]['to'])){throw new db[(_0x18c1('0x8c'))][(_0x18c1('0x8d'))](_0x18c1('0xba'));}_0x4d2b58=_0x3307d1[_0x18c1('0x5a')]['to'];return db[_0x18c1('0x4f')]['find']({'where':{'id':_0x3307d1[_0x18c1('0x55')]['id']},'include':[{'model':db[_0x18c1('0x9e')],'as':'List','include':[{'model':db[_0x18c1('0x9f')],'as':'Contacts','where':{'mobile':_0x4d2b58},'limit':0x1,'order':[[_0x18c1('0x90'),'DESC']]}]}]})[_0x18c1('0x32')](handleEntityNotFound(_0x97ec4f,null))[_0x18c1('0x32')](function(_0x15d675){if(_0x15d675&&_0x15d675['List']){_0x3e8391=_0x15d675[_0x18c1('0x33')]({'plain':!![]});if(_0x3e8391[_0x18c1('0xbb')]&&_0x3e8391['List'][_0x18c1('0xa0')][_0x18c1('0x47')]){return _0x3e8391[_0x18c1('0xbb')][_0x18c1('0xa0')][0x0];}return db['CmContact'][_0x18c1('0x59')](_['defaults'](_0x3307d1[_0x18c1('0x5a')],{'firstName':_0x4d2b58,'mobile':_0x4d2b58,'phone':_0x4d2b58,'ListId':_0x3e8391[_0x18c1('0x91')]}));}})[_0x18c1('0x32')](handleEntityNotFound(_0x97ec4f,null))['then'](function(_0x38a295){if(_0x38a295){_0x108299=_0x38a295;return db['WhatsappInteraction'][_0x18c1('0x58')]({'where':{'ContactId':_0x108299['id'],'closed':![],'WhatsappAccountId':_0x3e8391['id']}})[_0x18c1('0x32')](function(_0x220410){if(_0x220410){return[_0x220410,![]];}return db[_0x18c1('0xa4')]['create']({'UserId':_0x3307d1[_0x18c1('0x5b')]['id'],'ContactId':_0x108299['id'],'WhatsappAccountId':_0x3e8391['id'],'phone':_0x4d2b58,'firstMsgDirection':_0x18c1('0xbc'),'Messages':[_[_0x18c1('0x57')](_0x3307d1['body'],{'read':![],'body':_0x3307d1['body'][_0x18c1('0x5a')],'phone':_0x4d2b58,'WhatsappAccountId':_0x3e8391['id'],'UserId':_0x3307d1[_0x18c1('0x5b')]['id'],'ContactId':_0x108299['id']})]},{'include':[{'model':db[_0x18c1('0x87')],'as':_0x18c1('0xbd')}]})[_0x18c1('0x32')](function(_0x2f15fc){return[_0x2f15fc,!![]];});});}})['spread'](function(_0xc7d6c4,_0x25af78){if(_0x25af78){return _0xc7d6c4;}return db[_0x18c1('0x87')][_0x18c1('0x59')](_[_0x18c1('0x57')](_0x3307d1['body'],{'read':![],'body':_0x3307d1[_0x18c1('0x5a')][_0x18c1('0x5a')],'phone':_0x4d2b58,'WhatsappAccountId':_0x3e8391['id'],'WhatsappInteractionId':_0xc7d6c4['id'],'UserId':_0x3307d1[_0x18c1('0x5b')]['id'],'ContactId':_0x108299['id']}))[_0x18c1('0x32')](function(_0x116ed1){_0xc7d6c4[_0x18c1('0xbe')][_0x18c1('0xbd')]=[];_0xc7d6c4['dataValues']['Messages'][_0x18c1('0xa8')](_0x116ed1[_0x18c1('0xbe')]);return _0xc7d6c4;});})[_0x18c1('0x32')](respondWithResult(_0x97ec4f,null))[_0x18c1('0x53')](handleError(_0x97ec4f,null));}; \ No newline at end of file +var _0xa72d=['sinch','from','notifications','messageId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','CmContact','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','get','WhatsappAccounts','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','WhatsappAccount','findAll','params','intersection','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','message_id','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','whatsapp:','MessageSid'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa72d,0x1bf));var _0xda72=function(_0x36a328,_0xb08213){_0x36a328=_0x36a328-0x0;var _0x56442e=_0xa72d[_0x36a328];return _0x56442e;};'use strict';var emlformat=require(_0xda72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda72('0x1'));var rp=require(_0xda72('0x2'));var moment=require(_0xda72('0x3'));var BPromise=require(_0xda72('0x4'));var Mustache=require(_0xda72('0x5'));var util=require(_0xda72('0x6'));var path=require(_0xda72('0x7'));var sox=require(_0xda72('0x8'));var csv=require('to-csv');var ejs=require(_0xda72('0x9'));var fs=require('fs');var fs_extra=require(_0xda72('0xa'));var _=require(_0xda72('0xb'));var squel=require('squel');var crypto=require(_0xda72('0xc'));var jsforce=require(_0xda72('0xd'));var deskjs=require(_0xda72('0xe'));var toCsv=require(_0xda72('0xf'));var querystring=require(_0xda72('0x10'));var Papa=require(_0xda72('0x11'));var Redis=require(_0xda72('0x12'));var authService=require(_0xda72('0x13'));var qs=require(_0xda72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda72('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xda72('0x16'));var licenseUtil=require(_0xda72('0x17'));var db=require('../../mysqldb')['db'];config[_0xda72('0x18')]=_[_0xda72('0x19')](config[_0xda72('0x18')],{'host':_0xda72('0x1a'),'port':0x18eb});var socket=require(_0xda72('0x1b'))(new Redis(config['redis']));require(_0xda72('0x1c'))[_0xda72('0x1d')](socket);var jayson=require(_0xda72('0x1e'));var client=jayson[_0xda72('0x1f')][_0xda72('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x145ff0,_0x12a2ed,_0x251236,_0x4e14d3){return new BPromise(function(_0x4dbe31,_0x461ca7){var _0x1aa4fe=_0x4e14d3||client;return _0x1aa4fe[_0xda72('0x21')](_0x145ff0,_0x251236)[_0xda72('0x22')](function(_0x128e26){logger[_0xda72('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x12a2ed,_0xda72('0x24'));logger[_0xda72('0x25')](_0xda72('0x26'),_0x12a2ed,_0xda72('0x24'),JSON[_0xda72('0x27')](_0x128e26));if(_0x128e26[_0xda72('0x28')]){if(_0x128e26[_0xda72('0x28')]['code']===0x1f4){logger[_0xda72('0x28')](_0xda72('0x29'),_0x12a2ed,_0x128e26[_0xda72('0x28')][_0xda72('0x2a')]);return _0x461ca7(_0x128e26['error'][_0xda72('0x2a')]);}logger['error'](_0xda72('0x29'),_0x12a2ed,_0x128e26[_0xda72('0x28')][_0xda72('0x2a')]);return _0x4dbe31(_0x128e26[_0xda72('0x28')][_0xda72('0x2a')]);}else{logger['info'](_0xda72('0x29'),_0x12a2ed,'request\x20sent');_0x4dbe31(_0x128e26['result']['message']);}})[_0xda72('0x2b')](function(_0xf986f3){logger[_0xda72('0x28')](_0xda72('0x29'),_0x12a2ed,_0xf986f3);_0x461ca7(_0xf986f3);});});}function respondWithStatusCode(_0x2ffa30,_0x1eb770){_0x1eb770=_0x1eb770||0xcc;return function(_0x4abc33){if(_0x4abc33){return _0x2ffa30[_0xda72('0x2c')](_0x1eb770);}return _0x2ffa30[_0xda72('0x2d')](_0x1eb770)['end']();};}function respondWithResult(_0x3a9f1d,_0x257775){_0x257775=_0x257775||0xc8;return function(_0x55071f){if(_0x55071f){return _0x3a9f1d['status'](_0x257775)[_0xda72('0x2e')](_0x55071f);}};}function respondWithFilteredResult(_0x453f9b,_0x5172ba){return function(_0x4c7be5){if(_0x4c7be5){var _0x52ddc1=typeof _0x5172ba['offset']==='undefined'&&typeof _0x5172ba['limit']===_0xda72('0x2f');var _0x3bd907=_0x4c7be5[_0xda72('0x30')];var _0x30b207=_0x52ddc1?0x0:_0x5172ba[_0xda72('0x31')];var _0x5908cf=_0x52ddc1?_0x4c7be5[_0xda72('0x30')]:_0x5172ba[_0xda72('0x31')]+_0x5172ba[_0xda72('0x32')];var _0x2c4b85;if(_0x5908cf>=_0x3bd907){_0x5908cf=_0x3bd907;_0x2c4b85=0xc8;}else{_0x2c4b85=0xce;}_0x453f9b[_0xda72('0x2d')](_0x2c4b85);return _0x453f9b[_0xda72('0x33')](_0xda72('0x34'),_0x30b207+'-'+_0x5908cf+'/'+_0x3bd907)['json'](_0x4c7be5);}return null;};}function patchUpdates(_0x3805d4){return function(_0x59f739){try{jsonpatch['apply'](_0x59f739,_0x3805d4,!![]);}catch(_0x6633d9){return BPromise['reject'](_0x6633d9);}return _0x59f739[_0xda72('0x35')]();};}function saveUpdates(_0x4ba23a,_0x36ea9c){return function(_0x539815){if(_0x539815){return _0x539815[_0xda72('0x36')](_0x4ba23a)[_0xda72('0x22')](function(_0x3b43e7){return _0x3b43e7;});}return null;};}function removeEntity(_0x29838e,_0x2bcb7d){return function(_0x361def){if(_0x361def){return _0x361def['destroy']()[_0xda72('0x22')](function(){var _0x5773e5=_0x361def[_0xda72('0x37')]({'plain':!![]});var _0x473dce=_0xda72('0x38');return db['UserProfileResource'][_0xda72('0x39')]({'where':{'type':_0x473dce,'resourceId':_0x5773e5['id']}})[_0xda72('0x22')](function(){return _0x361def;});})[_0xda72('0x22')](function(){_0x29838e[_0xda72('0x2d')](0xcc)[_0xda72('0x3a')]();});}};}function handleEntityNotFound(_0x38ce39,_0x2b371c){return function(_0x42831d){if(!_0x42831d){_0x38ce39['sendStatus'](0x194);}return _0x42831d;};}function handleError(_0x4d3aee,_0x338188){_0x338188=_0x338188||0x1f4;return function(_0x7f4de0){logger[_0xda72('0x28')](_0x7f4de0[_0xda72('0x3b')]);if(_0x7f4de0[_0xda72('0x3c')]){delete _0x7f4de0['name'];}_0x4d3aee['status'](_0x338188)[_0xda72('0x3d')](_0x7f4de0);};}exports[_0xda72('0x3e')]=function(_0x1d3ea3,_0x12888b){var _0x422b76={'include':[{'model':db[_0xda72('0x3f')],'as':_0xda72('0x40')}]},_0x314f8b={},_0x1b7477={'count':0x0,'rows':[]};var _0x49ab41=_['map'](db['WhatsappAccount'][_0xda72('0x41')],function(_0x2a6e53){return{'name':_0x2a6e53[_0xda72('0x42')],'type':_0x2a6e53[_0xda72('0x43')]['key']};});_0x314f8b['model']=_[_0xda72('0x44')](_0x49ab41,_0xda72('0x3c'));_0x314f8b[_0xda72('0x45')]=_[_0xda72('0x46')](_0x1d3ea3['query']);_0x314f8b[_0xda72('0x47')]=_['intersection'](_0x314f8b[_0xda72('0x48')],_0x314f8b[_0xda72('0x45')]);_0x422b76[_0xda72('0x49')]=_['intersection'](_0x314f8b['model'],qs['fields'](_0x1d3ea3[_0xda72('0x45')][_0xda72('0x4a')]));_0x422b76['attributes']=_0x422b76[_0xda72('0x49')][_0xda72('0x4b')]?_0x422b76['attributes']:_0x314f8b[_0xda72('0x48')];if(!_0x1d3ea3[_0xda72('0x45')][_0xda72('0x4c')](_0xda72('0x4d'))){_0x422b76[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x1d3ea3[_0xda72('0x45')][_0xda72('0x32')]);_0x422b76[_0xda72('0x31')]=qs[_0xda72('0x31')](_0x1d3ea3[_0xda72('0x45')]['offset']);}_0x422b76['order']=qs['sort'](_0x1d3ea3[_0xda72('0x45')][_0xda72('0x4e')]);_0x422b76[_0xda72('0x4f')]=qs['filters'](_['pick'](_0x1d3ea3[_0xda72('0x45')],_0x314f8b[_0xda72('0x47')]),_0x49ab41);if(_0x1d3ea3[_0xda72('0x45')][_0xda72('0x50')]){_0x422b76[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x422b76['where'],{'$or':_[_0xda72('0x44')](_0x49ab41,function(_0x34628d){if(_0x34628d['type']!==_0xda72('0x52')){var _0x200b28={};_0x200b28[_0x34628d[_0xda72('0x3c')]]={'$like':'%'+_0x1d3ea3[_0xda72('0x45')]['filter']+'%'};return _0x200b28;}})});}_0x422b76=_[_0xda72('0x51')]({},_0x422b76,_0x1d3ea3[_0xda72('0x53')]);var _0x4efb56={'where':_0x422b76['where']};return db['WhatsappAccount'][_0xda72('0x30')](_0x4efb56)[_0xda72('0x22')](function(_0x3eb874){_0x1b7477['count']=_0x3eb874;if(_0x1d3ea3[_0xda72('0x45')][_0xda72('0x54')]){_0x422b76[_0xda72('0x55')]=[{'all':!![]}];}return db[_0xda72('0x56')][_0xda72('0x57')](_0x422b76);})[_0xda72('0x22')](function(_0xf726fb){_0x1b7477['rows']=_0xf726fb;return _0x1b7477;})[_0xda72('0x22')](respondWithFilteredResult(_0x12888b,_0x422b76))[_0xda72('0x2b')](handleError(_0x12888b,null));};exports['show']=function(_0x598ade,_0xceb538){var _0x4e2f36={'raw':![],'where':{'id':_0x598ade[_0xda72('0x58')]['id']},'include':[{'model':db[_0xda72('0x3f')],'as':_0xda72('0x40')}]},_0x4f7722={};_0x4f7722[_0xda72('0x48')]=_[_0xda72('0x46')](db[_0xda72('0x56')][_0xda72('0x41')]);_0x4f7722[_0xda72('0x45')]=_['keys'](_0x598ade[_0xda72('0x45')]);_0x4f7722['filters']=_[_0xda72('0x59')](_0x4f7722[_0xda72('0x48')],_0x4f7722[_0xda72('0x45')]);_0x4e2f36[_0xda72('0x49')]=_[_0xda72('0x59')](_0x4f7722[_0xda72('0x48')],qs[_0xda72('0x4a')](_0x598ade['query'][_0xda72('0x4a')]));_0x4e2f36['attributes']=_0x4e2f36[_0xda72('0x49')]['length']?_0x4e2f36[_0xda72('0x49')]:_0x4f7722[_0xda72('0x48')];if(_0x598ade['query'][_0xda72('0x54')]){_0x4e2f36['include']=[{'all':!![]}];}_0x4e2f36=_[_0xda72('0x51')]({},_0x4e2f36,_0x598ade[_0xda72('0x53')]);return db[_0xda72('0x56')]['find'](_0x4e2f36)[_0xda72('0x22')](handleEntityNotFound(_0xceb538,null))[_0xda72('0x22')](respondWithResult(_0xceb538,null))[_0xda72('0x2b')](handleError(_0xceb538,null));};exports[_0xda72('0x5a')]=function(_0xad1a41,_0x56bfa1){return db[_0xda72('0x56')][_0xda72('0x5a')](_0xad1a41[_0xda72('0x5b')],{})[_0xda72('0x22')](function(_0x989e70){var _0x566c81=_0xad1a41[_0xda72('0x5c')][_0xda72('0x37')]({'plain':!![]});if(!_0x566c81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x566c81[_0xda72('0x5d')]===_0xda72('0x5c')){var _0x1755e4=_0x989e70[_0xda72('0x37')]({'plain':!![]});var _0x41ff0c='WhatsappAccounts';return db[_0xda72('0x5e')][_0xda72('0x5f')]({'where':{'name':_0x41ff0c,'userProfileId':_0x566c81[_0xda72('0x60')]},'raw':!![]})['then'](function(_0x48f47e){if(_0x48f47e&&_0x48f47e[_0xda72('0x61')]===0x0){return db[_0xda72('0x62')][_0xda72('0x5a')]({'name':_0x1755e4['name'],'resourceId':_0x1755e4['id'],'type':_0x48f47e[_0xda72('0x3c')],'sectionId':_0x48f47e['id']},{})[_0xda72('0x22')](function(){return _0x989e70;});}else{return _0x989e70;}})['catch'](function(_0xc5da89){logger[_0xda72('0x28')](_0xda72('0x63'),_0xc5da89);throw _0xc5da89;});}return _0x989e70;})[_0xda72('0x22')](respondWithResult(_0x56bfa1,0xc9))[_0xda72('0x2b')](handleError(_0x56bfa1,null));};exports[_0xda72('0x36')]=function(_0x5ecd60,_0x27fc44){if(_0x5ecd60[_0xda72('0x5b')]['id']){delete _0x5ecd60[_0xda72('0x5b')]['id'];}return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x5ecd60[_0xda72('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xda72('0x40')}]})[_0xda72('0x22')](handleEntityNotFound(_0x27fc44,null))[_0xda72('0x22')](saveUpdates(_0x5ecd60[_0xda72('0x5b')],null))[_0xda72('0x22')](respondWithResult(_0x27fc44,null))['catch'](handleError(_0x27fc44,null));};exports[_0xda72('0x39')]=function(_0x437991,_0x3d9d94){return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x437991['params']['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x3d9d94,null))[_0xda72('0x22')](removeEntity(_0x3d9d94,null))[_0xda72('0x2b')](handleError(_0x3d9d94,null));};exports[_0xda72('0x64')]=function(_0x463b40,_0xf3f89a){return db[_0xda72('0x56')][_0xda72('0x64')]()[_0xda72('0x22')](respondWithResult(_0xf3f89a,null))[_0xda72('0x2b')](handleError(_0xf3f89a,null));};exports[_0xda72('0x65')]=function(_0x57090d,_0x599099,_0x90d8df){if(_0x57090d[_0xda72('0x5b')]['id']){delete _0x57090d['body']['id'];}return db['WhatsappAccount'][_0xda72('0x5f')]({'where':{'id':_0x57090d[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x599099,null))[_0xda72('0x22')](function(_0x525f79){if(_0x525f79){_0x57090d['body'][_0xda72('0x66')]=_0x525f79['id'];return db[_0xda72('0x67')][_0xda72('0x5a')](_0x57090d[_0xda72('0x5b')]);}})[_0xda72('0x22')](respondWithResult(_0x599099,null))['catch'](handleError(_0x599099,null));};exports['getDispositions']=function(_0x276394,_0x2397a9,_0x549c75){var _0x2bb04c={'raw':![],'where':{}};var _0x25a7a5={};var _0x36397e={'count':0x0,'rows':[]};return db[_0xda72('0x56')]['findOne']({'where':{'id':_0x276394[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x2397a9,null))[_0xda72('0x22')](function(_0x174d51){if(_0x174d51){_0x25a7a5[_0xda72('0x48')]=_[_0xda72('0x46')](db[_0xda72('0x67')]['rawAttributes']);_0x25a7a5[_0xda72('0x45')]=_[_0xda72('0x46')](_0x276394[_0xda72('0x45')]);_0x25a7a5[_0xda72('0x47')]=_[_0xda72('0x59')](_0x25a7a5[_0xda72('0x48')],_0x25a7a5[_0xda72('0x45')]);_0x2bb04c[_0xda72('0x49')]=_['intersection'](_0x25a7a5[_0xda72('0x48')],qs[_0xda72('0x4a')](_0x276394[_0xda72('0x45')][_0xda72('0x4a')]));_0x2bb04c[_0xda72('0x49')]=_0x2bb04c['attributes'][_0xda72('0x4b')]?_0x2bb04c[_0xda72('0x49')]:_0x25a7a5[_0xda72('0x48')];if(!_0x276394[_0xda72('0x45')][_0xda72('0x4c')](_0xda72('0x4d'))){_0x2bb04c[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x276394['query'][_0xda72('0x32')]);_0x2bb04c[_0xda72('0x31')]=qs[_0xda72('0x31')](_0x276394[_0xda72('0x45')][_0xda72('0x31')]);}_0x2bb04c[_0xda72('0x68')]=qs['sort'](_0x276394[_0xda72('0x45')]['sort']);_0x2bb04c[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0x276394[_0xda72('0x45')],_0x25a7a5['filters']));_0x2bb04c[_0xda72('0x4f')][_0xda72('0x66')]=_0x174d51['id'];if(_0x276394[_0xda72('0x45')][_0xda72('0x50')]){_0x2bb04c[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x2bb04c[_0xda72('0x4f')],{'$or':_['map'](_0x2bb04c['attributes'],function(_0x5ead38){var _0x4a8510={};_0x4a8510[_0x5ead38]={'$like':'%'+_0x276394['query'][_0xda72('0x50')]+'%'};return _0x4a8510;})});}_0x2bb04c=_['merge']({},_0x2bb04c,_0x276394['options']);return db[_0xda72('0x67')]['count']({'where':_0x2bb04c[_0xda72('0x4f')]})[_0xda72('0x22')](function(_0x2a5a84){_0x36397e[_0xda72('0x30')]=_0x2a5a84;if(_0x276394[_0xda72('0x45')][_0xda72('0x54')]){_0x2bb04c[_0xda72('0x55')]=[{'all':!![]}];}return db[_0xda72('0x67')][_0xda72('0x57')](_0x2bb04c);})[_0xda72('0x22')](function(_0x9cee51){_0x36397e[_0xda72('0x6a')]=_0x9cee51;return _0x36397e;});}})['then'](respondWithFilteredResult(_0x2397a9,_0x2bb04c))[_0xda72('0x2b')](handleError(_0x2397a9,null));};exports[_0xda72('0x6b')]=function(_0x1dfbd7,_0x23f5da,_0xdf6df0){return db[_0xda72('0x56')]['find']({'where':{'id':_0x1dfbd7[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x23f5da,null))[_0xda72('0x22')](function(_0x3286c5){if(_0x3286c5){return _0x3286c5[_0xda72('0x6b')](_0x1dfbd7[_0xda72('0x45')][_0xda72('0x6c')]);}})[_0xda72('0x22')](respondWithStatusCode(_0x23f5da,null))[_0xda72('0x2b')](handleError(_0x23f5da,null));};exports[_0xda72('0x6d')]=function(_0x48d9ca,_0x1dc7bf,_0x1d2179){if(_0x48d9ca['body']['id']){delete _0x48d9ca[_0xda72('0x5b')]['id'];}return db['WhatsappAccount'][_0xda72('0x5f')]({'where':{'id':_0x48d9ca[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x1dc7bf,null))[_0xda72('0x22')](function(_0x7f7435){if(_0x7f7435){_0x48d9ca[_0xda72('0x5b')][_0xda72('0x66')]=_0x7f7435['id'];return db[_0xda72('0x6e')][_0xda72('0x5a')](_0x48d9ca[_0xda72('0x5b')]);}})[_0xda72('0x22')](respondWithResult(_0x1dc7bf,null))[_0xda72('0x2b')](handleError(_0x1dc7bf,null));};exports['getAnswers']=function(_0x85ef4e,_0x201627,_0x1953b4){var _0x5a5aa9={'raw':![],'where':{}};var _0x1c9a61={};var _0x5c3385={'count':0x0,'rows':[]};return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0x85ef4e['params']['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x201627,null))[_0xda72('0x22')](function(_0x332718){if(_0x332718){_0x1c9a61['model']=_['keys'](db[_0xda72('0x6e')][_0xda72('0x41')]);_0x1c9a61[_0xda72('0x45')]=_['keys'](_0x85ef4e[_0xda72('0x45')]);_0x1c9a61['filters']=_[_0xda72('0x59')](_0x1c9a61[_0xda72('0x48')],_0x1c9a61[_0xda72('0x45')]);_0x5a5aa9[_0xda72('0x49')]=_[_0xda72('0x59')](_0x1c9a61[_0xda72('0x48')],qs[_0xda72('0x4a')](_0x85ef4e[_0xda72('0x45')][_0xda72('0x4a')]));_0x5a5aa9[_0xda72('0x49')]=_0x5a5aa9['attributes'][_0xda72('0x4b')]?_0x5a5aa9['attributes']:_0x1c9a61[_0xda72('0x48')];if(!_0x85ef4e[_0xda72('0x45')][_0xda72('0x4c')]('nolimit')){_0x5a5aa9[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x85ef4e[_0xda72('0x45')][_0xda72('0x32')]);_0x5a5aa9[_0xda72('0x31')]=qs['offset'](_0x85ef4e[_0xda72('0x45')][_0xda72('0x31')]);}_0x5a5aa9[_0xda72('0x68')]=qs[_0xda72('0x4e')](_0x85ef4e[_0xda72('0x45')][_0xda72('0x4e')]);_0x5a5aa9[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0x85ef4e[_0xda72('0x45')],_0x1c9a61[_0xda72('0x47')]));_0x5a5aa9[_0xda72('0x4f')][_0xda72('0x66')]=_0x332718['id'];if(_0x85ef4e['query'][_0xda72('0x50')]){_0x5a5aa9[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x5a5aa9[_0xda72('0x4f')],{'$or':_[_0xda72('0x44')](_0x5a5aa9[_0xda72('0x49')],function(_0x513bc9){var _0x3d2e31={};_0x3d2e31[_0x513bc9]={'$like':'%'+_0x85ef4e[_0xda72('0x45')][_0xda72('0x50')]+'%'};return _0x3d2e31;})});}_0x5a5aa9=_[_0xda72('0x51')]({},_0x5a5aa9,_0x85ef4e['options']);return db['CannedAnswer'][_0xda72('0x30')]({'where':_0x5a5aa9[_0xda72('0x4f')]})['then'](function(_0x39e93f){_0x5c3385[_0xda72('0x30')]=_0x39e93f;if(_0x85ef4e['query'][_0xda72('0x54')]){_0x5a5aa9[_0xda72('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xda72('0x57')](_0x5a5aa9);})[_0xda72('0x22')](function(_0x391a13){_0x5c3385[_0xda72('0x6a')]=_0x391a13;return _0x5c3385;});}})[_0xda72('0x22')](respondWithFilteredResult(_0x201627,_0x5a5aa9))[_0xda72('0x2b')](handleError(_0x201627,null));};exports['removeAnswers']=function(_0xe6523,_0x2c7dc8,_0x1370b1){return db['WhatsappAccount'][_0xda72('0x5f')]({'where':{'id':_0xe6523[_0xda72('0x58')]['id']}})['then'](handleEntityNotFound(_0x2c7dc8,null))[_0xda72('0x22')](function(_0x455392){if(_0x455392){return _0x455392[_0xda72('0x70')](_0xe6523[_0xda72('0x45')][_0xda72('0x6c')]);}})[_0xda72('0x22')](respondWithStatusCode(_0x2c7dc8,null))[_0xda72('0x2b')](handleError(_0x2c7dc8,null));};exports[_0xda72('0x71')]=function(_0x2637dd,_0x1f572c,_0x589120){return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x2637dd[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x1f572c,null))['then'](function(_0xab6d97){if(_0xab6d97){return _0xab6d97[_0xda72('0x71')](_0x2637dd[_0xda72('0x5b')][_0xda72('0x6c')],_['omit'](_0x2637dd['body'],[_0xda72('0x6c'),'id'])||{})[_0xda72('0x72')](function(_0x33c3cd){for(var _0x3b5fa1=0x0;_0x3b5fa1<_0x2637dd[_0xda72('0x5b')][_0xda72('0x6c')][_0xda72('0x4b')];_0x3b5fa1+=0x1){socket['emit'](_0xda72('0x73'),{'UserId':Number(_0x2637dd[_0xda72('0x5b')][_0xda72('0x6c')][_0x3b5fa1]),'WhatsappAccountId':Number(_0x2637dd[_0xda72('0x58')]['id'])});}return _0x33c3cd;});}})['then'](respondWithResult(_0x1f572c,null))['catch'](handleError(_0x1f572c,null));};exports[_0xda72('0x74')]=function(_0x3f19f7,_0x5caef3,_0x16df17){return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x3f19f7['params']['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x5caef3,null))[_0xda72('0x22')](function(_0x3459b1){if(_0x3459b1){return _0x3459b1['removeAgents'](_0x3f19f7[_0xda72('0x45')]['ids'])[_0xda72('0x22')](function(){if(_['isArray'](_0x3f19f7[_0xda72('0x45')][_0xda72('0x6c')])){for(var _0x5259ae=0x0;_0x5259ae<_0x3f19f7['query'][_0xda72('0x6c')]['length'];_0x5259ae+=0x1){socket[_0xda72('0x75')](_0xda72('0x76'),{'UserId':Number(_0x3f19f7[_0xda72('0x45')][_0xda72('0x6c')][_0x5259ae]),'WhatsappAccountId':Number(_0x3f19f7[_0xda72('0x58')]['id'])});}}else{socket[_0xda72('0x75')](_0xda72('0x76'),{'UserId':Number(_0x3f19f7[_0xda72('0x45')]['ids']),'WhatsappAccountId':Number(_0x3f19f7[_0xda72('0x58')]['id'])});}});}})[_0xda72('0x22')](respondWithStatusCode(_0x5caef3,null))[_0xda72('0x2b')](handleError(_0x5caef3,null));};exports[_0xda72('0x77')]=function(_0x13f4b7,_0x361d9a,_0x3a7e72){var _0x583522={};var _0x994e6f={};var _0x392c31;var _0x236c51;return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0x13f4b7[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x361d9a,null))['then'](function(_0x11f937){if(_0x11f937){_0x392c31=_0x11f937;_0x994e6f[_0xda72('0x48')]=_['keys'](db['User']['rawAttributes']);_0x994e6f[_0xda72('0x45')]=_[_0xda72('0x46')](_0x13f4b7[_0xda72('0x45')]);_0x994e6f['filters']=_[_0xda72('0x59')](_0x994e6f[_0xda72('0x48')],_0x994e6f[_0xda72('0x45')]);_0x583522[_0xda72('0x49')]=_[_0xda72('0x59')](_0x994e6f['model'],qs[_0xda72('0x4a')](_0x13f4b7[_0xda72('0x45')][_0xda72('0x4a')]));_0x583522['attributes']=_0x583522[_0xda72('0x49')][_0xda72('0x4b')]?_0x583522[_0xda72('0x49')]:_0x994e6f[_0xda72('0x48')];_0x583522['order']=qs[_0xda72('0x4e')](_0x13f4b7['query'][_0xda72('0x4e')]);_0x583522[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0x13f4b7[_0xda72('0x45')],_0x994e6f[_0xda72('0x47')]));if(_0x13f4b7[_0xda72('0x45')][_0xda72('0x50')]){_0x583522[_0xda72('0x4f')]=_['merge'](_0x583522[_0xda72('0x4f')],{'$or':_[_0xda72('0x44')](_0x583522[_0xda72('0x49')],function(_0x5c510c){var _0x4da6cf={};_0x4da6cf[_0x5c510c]={'$like':'%'+_0x13f4b7[_0xda72('0x45')][_0xda72('0x50')]+'%'};return _0x4da6cf;})});}_0x583522=_['merge']({},_0x583522,_0x13f4b7[_0xda72('0x53')]);return _0x392c31[_0xda72('0x77')](_0x583522);}})[_0xda72('0x22')](function(_0x48d1b0){if(_0x48d1b0){_0x236c51=_0x48d1b0[_0xda72('0x4b')];if(!_0x13f4b7[_0xda72('0x45')][_0xda72('0x4c')](_0xda72('0x4d'))){_0x583522[_0xda72('0x32')]=qs[_0xda72('0x32')](_0x13f4b7[_0xda72('0x45')][_0xda72('0x32')]);_0x583522[_0xda72('0x31')]=qs['offset'](_0x13f4b7[_0xda72('0x45')][_0xda72('0x31')]);}return _0x392c31[_0xda72('0x77')](_0x583522);}})[_0xda72('0x22')](function(_0xe74e9a){if(_0xe74e9a){return _0xe74e9a?{'count':_0x236c51,'rows':_0xe74e9a}:null;}})[_0xda72('0x22')](respondWithResult(_0x361d9a,null))['catch'](handleError(_0x361d9a,null));};exports[_0xda72('0x78')]=function(_0x208afd,_0x2d3ff7){var _0x135df5=_0x208afd[_0xda72('0x58')]['id'];var _0x13484e=_0x208afd[_0xda72('0x5b')];var _0x459daf=0xc8;var _0x50f4d8=null;return db[_0xda72('0x79')][_0xda72('0x7a')]({'isolationLevel':db[_0xda72('0x79')][_0xda72('0x7b')]['ISOLATION_LEVELS'][_0xda72('0x7c')]},function(_0x653d43){return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0x135df5},'transaction':_0x653d43})[_0xda72('0x22')](function(_0xf154d3){if(_0xf154d3){return db[_0xda72('0x7d')][_0xda72('0x39')]({'where':{'WhatsappAccountId':_0x135df5},'transaction':_0x653d43})['then'](function(){var _0x26e963=_[_0xda72('0x44')](_0x13484e,function(_0x3b3be3){_0x3b3be3['WhatsappAccountId']=_0x135df5;return _0x3b3be3;});return db[_0xda72('0x7d')][_0xda72('0x7e')](_0x26e963,{'transaction':_0x653d43});});}else{_0x459daf=0x194;_0x50f4d8=[];}});})['then'](function(){if(_0x459daf!==0x194){return db[_0xda72('0x7d')][_0xda72('0x7f')]({'where':{'WhatsappAccountId':_0x135df5},'order':_0xda72('0x80')})['then'](function(_0x1bdf42){_0x50f4d8=_0x1bdf42;});}})[_0xda72('0x2b')](function(_0x3cf5d5){_0x459daf=0x1f4;logger[_0xda72('0x28')](_0x3cf5d5[_0xda72('0x3b')]);if(_0x3cf5d5[_0xda72('0x3c')]){delete _0x3cf5d5['name'];}_0x50f4d8=_0x3cf5d5;})[_0xda72('0x81')](function(){if(_0x50f4d8===null){_0x2d3ff7[_0xda72('0x2c')](_0x459daf);}else{if(_0x459daf===0x1f4){_0x2d3ff7[_0xda72('0x2d')](_0x459daf)[_0xda72('0x3d')](_0x50f4d8);}else{_0x2d3ff7[_0xda72('0x2d')](_0x459daf)[_0xda72('0x2e')](_0x50f4d8);}}});};exports['getApplications']=function(_0xecae83,_0x180ddd,_0x3147ec){var _0x39f19e={};var _0x202901={};var _0x38650c;var _0x45db93;return db[_0xda72('0x56')][_0xda72('0x6f')]({'where':{'id':_0xecae83[_0xda72('0x58')]['id']}})[_0xda72('0x22')](handleEntityNotFound(_0x180ddd,null))[_0xda72('0x22')](function(_0xa80b4b){if(_0xa80b4b){_0x38650c=_0xa80b4b;_0x202901[_0xda72('0x48')]=_['keys'](db['WhatsappApplication'][_0xda72('0x41')]);_0x202901[_0xda72('0x45')]=_[_0xda72('0x46')](_0xecae83['query']);_0x202901[_0xda72('0x47')]=_[_0xda72('0x59')](_0x202901['model'],_0x202901[_0xda72('0x45')]);_0x39f19e[_0xda72('0x49')]=_[_0xda72('0x59')](_0x202901[_0xda72('0x48')],qs[_0xda72('0x4a')](_0xecae83[_0xda72('0x45')][_0xda72('0x4a')]));_0x39f19e['attributes']=_0x39f19e[_0xda72('0x49')][_0xda72('0x4b')]?_0x39f19e[_0xda72('0x49')]:_0x202901['model'];_0x39f19e[_0xda72('0x68')]=qs[_0xda72('0x4e')](_0xecae83[_0xda72('0x45')][_0xda72('0x4e')]);_0x39f19e[_0xda72('0x4f')]=qs[_0xda72('0x47')](_[_0xda72('0x69')](_0xecae83[_0xda72('0x45')],_0x202901[_0xda72('0x47')]));if(_0xecae83[_0xda72('0x45')][_0xda72('0x50')]){_0x39f19e[_0xda72('0x4f')]=_[_0xda72('0x51')](_0x39f19e[_0xda72('0x4f')],{'$or':_[_0xda72('0x44')](_0x39f19e[_0xda72('0x49')],function(_0x4ae2cc){var _0x14af8f={};_0x14af8f[_0x4ae2cc]={'$like':'%'+_0xecae83[_0xda72('0x45')][_0xda72('0x50')]+'%'};return _0x14af8f;})});}_0x39f19e=_['merge']({},_0x39f19e,_0xecae83['options']);return _0x38650c[_0xda72('0x82')](_0x39f19e);}})[_0xda72('0x22')](function(_0x264fcc){if(_0x264fcc){_0x45db93=_0x264fcc[_0xda72('0x4b')];if(!_0xecae83['query']['hasOwnProperty'](_0xda72('0x4d'))){_0x39f19e[_0xda72('0x32')]=qs[_0xda72('0x32')](_0xecae83[_0xda72('0x45')][_0xda72('0x32')]);_0x39f19e['offset']=qs[_0xda72('0x31')](_0xecae83[_0xda72('0x45')][_0xda72('0x31')]);}return _0x38650c[_0xda72('0x82')](_0x39f19e);}})[_0xda72('0x22')](function(_0x4ea680){if(_0x4ea680){return _0x4ea680?{'count':_0x45db93,'rows':_0x4ea680}:null;}})[_0xda72('0x22')](respondWithResult(_0x180ddd,null))[_0xda72('0x2b')](handleError(_0x180ddd,null));};exports[_0xda72('0x83')]=function(_0x2a341f,_0x37a7e9,_0x559402){var _0x4920e5={'channel':_0xda72('0x84')};var _0x40d409=[];var _0x5186c1=[];var _0x4ec426={};return db[_0xda72('0x56')]['find']({'where':{'id':_0x2a341f[_0xda72('0x58')]['id']},'include':[{'model':db[_0xda72('0x7d')],'as':_0xda72('0x85')}]})['then'](handleEntityNotFound(_0x37a7e9,null))[_0xda72('0x22')](function(_0x19be5c){_0x4920e5[_0xda72('0x86')]=_0x19be5c;if(_0x4920e5[_0xda72('0x86')]&&_0x4920e5[_0xda72('0x86')][_0xda72('0x43')]==='sinch'&&_0x2a341f['body'][_0xda72('0x87')]){if(_0x2a341f[_0xda72('0x5b')]['statuses'][_0xda72('0x4b')]===0x0)return;if(_0x2a341f[_0xda72('0x5b')][_0xda72('0x87')][0x0]['state']!==_0xda72('0x88'))return;return db['WhatsappMessage'][_0xda72('0x36')]({'read':!![],'readAt':_0x2a341f['body'][_0xda72('0x87')][0x0]['timestamp']},{'where':{'messageId':_0x2a341f['body'][_0xda72('0x87')][0x0][_0xda72('0x89')]},'individualHooks':!![]})[_0xda72('0x22')](function(_0xc61304){return _0x37a7e9[_0xda72('0x2d')](0xc8)[_0xda72('0x2e')](_0xc61304);});}_0x4920e5[_0xda72('0x8a')]=_[_0xda72('0x8b')](_0x19be5c[_0xda72('0x85')],[_0xda72('0x80')],['asc']);if(_0x4920e5[_0xda72('0x86')][_0xda72('0x85')]){delete _0x4920e5[_0xda72('0x86')][_0xda72('0x85')];}return db['CmContact'][_0xda72('0x64')]()['then'](function(_0x5ffb9d){if(!_0x5ffb9d){throw new db[(_0xda72('0x8c'))]['ValidationError'](_0xda72('0x8d'));}_0x40d409=_[_0xda72('0x8e')](_[_0xda72('0x46')](_0x5ffb9d),[_0xda72('0x8f'),_0xda72('0x90')]);_0x5186c1=_[_0xda72('0x8e')](_[_0xda72('0x46')](_0x5ffb9d),['createdAt',_0xda72('0x90'),_0xda72('0x91'),_0xda72('0x92')]);_0x4920e5[_0xda72('0x5b')]={'mapKey':_0xda72('0x93')};if(_0x4920e5[_0xda72('0x86')]&&_0x4920e5[_0xda72('0x86')][_0xda72('0x43')]==='twilio'){_0x4920e5[_0xda72('0x5b')]['from']=_0x2a341f[_0xda72('0x5b')]['From']['replace'](_0xda72('0x94'),'');_0x4920e5['body']['body']=_0x2a341f[_0xda72('0x5b')]['Body'];_0x4920e5[_0xda72('0x5b')]['messageId']=_0x2a341f[_0xda72('0x5b')][_0xda72('0x95')];}if(_0x4920e5[_0xda72('0x86')]&&_0x4920e5[_0xda72('0x86')][_0xda72('0x43')]===_0xda72('0x96')){_0x4920e5[_0xda72('0x5b')][_0xda72('0x97')]=_0x2a341f[_0xda72('0x5b')]['notifications'][0x0][_0xda72('0x97')];_0x4920e5[_0xda72('0x5b')][_0xda72('0x5b')]=_0x2a341f[_0xda72('0x5b')][_0xda72('0x98')][0x0][_0xda72('0x2a')]['body'];_0x4920e5[_0xda72('0x5b')][_0xda72('0x99')]=_0x2a341f[_0xda72('0x5b')]['notifications'][0x0][_0xda72('0x89')];}if(_0x4920e5[_0xda72('0x5b')]['id']){delete _0x4920e5[_0xda72('0x5b')]['id'];}if(_[_0xda72('0x9a')](_0x4920e5[_0xda72('0x5b')][_0xda72('0x97')])){throw new db[(_0xda72('0x8c'))][(_0xda72('0x9b'))](_0xda72('0x9c'));}if(_[_0xda72('0x9a')](_0x4920e5['body'][_0xda72('0x5b')])||_0x4920e5[_0xda72('0x5b')][_0xda72('0x5b')]===''){throw new db[(_0xda72('0x8c'))][(_0xda72('0x9b'))](_0xda72('0x9d'));}if(_[_0xda72('0x9a')](_0x4920e5[_0xda72('0x5b')][_0xda72('0x9e')])){throw new db['Sequelize'][(_0xda72('0x9b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5186c1);}if(!_[_0xda72('0x9f')](_0x5186c1,_0x4920e5[_0xda72('0x5b')][_0xda72('0x9e')])){throw new db[(_0xda72('0x8c'))][(_0xda72('0x9b'))](_0xda72('0xa0')+_0x5186c1);}_0x4ec426[_0x4920e5[_0xda72('0x5b')][_0xda72('0x9e')]]=_0x4920e5['body'][_0xda72('0x97')];return db[_0xda72('0xa1')][_0xda72('0x5f')]({'where':{'id':_0x4920e5[_0xda72('0x86')][_0xda72('0x92')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ec426,'limit':0x1,'order':[[_0xda72('0x90'),_0xda72('0xa2')]]}]});})['then'](handleEntityNotFound(_0x37a7e9,null))['then'](function(_0x2358d0){if(_0x2358d0){_0x4920e5[_0xda72('0xa3')]=_[_0xda72('0xa4')](_0x2358d0,[_0xda72('0xa5')]);if(_0x2358d0[_0xda72('0xa5')][_0xda72('0x4b')]){return _0x2358d0[_0xda72('0xa5')][0x0];}var _0x6f955f=_[_0xda72('0x19')](_0x4920e5[_0xda72('0x5b')],{'firstName':_0x4920e5[_0xda72('0x5b')]['from'],'ListId':_0x2358d0['id']});_0x6f955f[_0x4920e5['body'][_0xda72('0x9e')]]=_0x4920e5[_0xda72('0x5b')]['from'];return db[_0xda72('0xa6')][_0xda72('0x5a')](_0x6f955f,{'fields':_0x40d409,'raw':!![]});}})['then'](handleEntityNotFound(_0x37a7e9,null))[_0xda72('0x22')](function(_0x403b84){if(_0x403b84){_0x4920e5[_0xda72('0xa7')]=_0x403b84;var _0x8c9b2c={'ContactId':_0x403b84['id'],'phone':_0x4920e5[_0xda72('0x5b')]['from'],'WhatsappAccountId':_0x2a341f['params']['id']};var _0x3e1abf={'ContactId':_0x403b84['id'],'WhatsappAccountId':_0x2a341f['params']['id'],'closed':![]};return db[_0xda72('0xa8')]['find']({'where':_0x3e1abf})[_0xda72('0x22')](function(_0x159e52){if(_0x159e52){return[_0x159e52,![]];}return db[_0xda72('0xa8')][_0xda72('0x5a')](_0x8c9b2c)['then'](function(_0x410251){return[_0x410251,!![]];});});}})[_0xda72('0x72')](function(_0x24648b,_0x19997f){_0x4920e5[_0xda72('0xa9')]=_0x24648b[_0xda72('0x37')]({'plain':!![]});_0x4920e5[_0xda72('0xa9')]['created']=![];if(_0x19997f){if(_0x4920e5['account'][_0xda72('0xaa')]){_0x4920e5[_0xda72('0x8a')]['push']({'id':0x0,'priority':_0x4920e5['applications'][_0xda72('0x4b')]+0x1,'app':_0xda72('0xab'),'appdata':_0xda72('0xac'),'interval':_0xda72('0xad')});}_0x4920e5[_0xda72('0xa9')][_0xda72('0xae')]=!![];}return db[_0xda72('0xaf')]['create']({'phone':_0x4920e5[_0xda72('0x5b')][_0xda72('0x97')],'messageId':_0x4920e5['body'][_0xda72('0x99')],'body':_0x4920e5['body'][_0xda72('0x5b')],'WhatsappAccountId':_0x2a341f[_0xda72('0x58')]['id'],'WhatsappInteractionId':_0x24648b['id'],'direction':'in','ContactId':_0x24648b[_0xda72('0xb0')],'AttachmentId':_0x4920e5['body'][_0xda72('0xb1')]});})['then'](function(_0x36d08d){_0x4920e5[_0xda72('0x2a')]=_0x36d08d;if(!_0x4920e5['interaction']['UserId'])return;return db[_0xda72('0xb2')]['find']({'attributes':['id',_0xda72('0x3c')],'where':{'id':_0x4920e5[_0xda72('0xa9')][_0xda72('0xb3')]}});})['then'](function(_0x327b6e){if(_0x327b6e){_0x4920e5[_0xda72('0x8a')][_0xda72('0xb4')]({'id':0x0,'priority':0x0,'app':_0xda72('0xb5'),'appdata':_0x327b6e[_0xda72('0x3c')]+','+(_0x4920e5['account'][_0xda72('0xb6')]||0xa),'interval':'*,*,*,*'});}if(!_0x4920e5[_0xda72('0xa9')][_0xda72('0xb7')])return;return db[_0xda72('0xb8')][_0xda72('0x5f')]({'attributes':['id','name'],'where':{'id':_0x4920e5[_0xda72('0xa9')]['queueId']}});})[_0xda72('0x22')](function(_0x322018){if(_0x322018){_0x4920e5[_0xda72('0x8a')]['unshift']({'id':0x0,'priority':0x1,'app':_0xda72('0xb9'),'appdata':_0x322018[_0xda72('0x3c')]+','+(_0x4920e5[_0xda72('0x86')][_0xda72('0xba')]||0x12c),'interval':_0xda72('0xad')});}return respondWithRpcPromise('Start',_0xda72('0xbb'),_0x4920e5);})[_0xda72('0x22')](function(_0x4cf7e9){if(_0x4cf7e9){var _0x265f84=0xc8;var _0x2867a9=_0xda72('0xbc');logger[_0xda72('0x23')](_0xda72('0x26'),_0x2867a9,_0x265f84,_0xda72('0xbd'));logger[_0xda72('0x25')](_0xda72('0xbe'),_0x2867a9,_0x265f84,_0xda72('0xbd'),JSON['stringify'](_0x4cf7e9));if(_0x4920e5['account']['type']===_0xda72('0xbf')){return _0x37a7e9['status'](_0x265f84)[_0xda72('0x33')](_0xda72('0xc0'),'text/xml')['send'](_0xda72('0xc1'));}else{return _0x37a7e9[_0xda72('0x2d')](_0x265f84)[_0xda72('0x2e')](_0x4cf7e9);}}});})[_0xda72('0x2b')](handleError(_0x37a7e9,null));};exports[_0xda72('0x3d')]=function(_0x46c173,_0x32c613,_0x9ee8b9){var _0xf7147a,_0x4bb2af,_0x177850;if(_[_0xda72('0x9a')](_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')])||_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')]===''){throw new db[(_0xda72('0x8c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x46c173['body']['to'])){throw new db['Sequelize'][(_0xda72('0x9b'))](_0xda72('0xc2'));}_0xf7147a=_0x46c173[_0xda72('0x5b')]['to'];return db[_0xda72('0x56')][_0xda72('0x5f')]({'where':{'id':_0x46c173[_0xda72('0x58')]['id']},'include':[{'model':db[_0xda72('0xa1')],'as':_0xda72('0xc3'),'include':[{'model':db[_0xda72('0xa6')],'as':_0xda72('0xa5'),'where':{'mobile':_0xf7147a},'limit':0x1,'order':[[_0xda72('0x90'),_0xda72('0xa2')]]}]}]})[_0xda72('0x22')](handleEntityNotFound(_0x32c613,null))[_0xda72('0x22')](function(_0x129e27){if(_0x129e27&&_0x129e27[_0xda72('0xc3')]){_0x4bb2af=_0x129e27['get']({'plain':!![]});if(_0x4bb2af[_0xda72('0xc3')]&&_0x4bb2af[_0xda72('0xc3')][_0xda72('0xa5')]['length']){return _0x4bb2af[_0xda72('0xc3')][_0xda72('0xa5')][0x0];}return db[_0xda72('0xa6')][_0xda72('0x5a')](_[_0xda72('0x19')](_0x46c173[_0xda72('0x5b')],{'firstName':_0xf7147a,'mobile':_0xf7147a,'phone':_0xf7147a,'ListId':_0x4bb2af[_0xda72('0x92')]}));}})[_0xda72('0x22')](handleEntityNotFound(_0x32c613,null))[_0xda72('0x22')](function(_0x5b9d78){if(_0x5b9d78){_0x177850=_0x5b9d78;return db[_0xda72('0xa8')]['find']({'where':{'ContactId':_0x177850['id'],'closed':![],'WhatsappAccountId':_0x4bb2af['id']}})[_0xda72('0x22')](function(_0x54ff9a){if(_0x54ff9a){return[_0x54ff9a,![]];}return db[_0xda72('0xa8')][_0xda72('0x5a')]({'UserId':_0x46c173['user']['id'],'ContactId':_0x177850['id'],'WhatsappAccountId':_0x4bb2af['id'],'phone':_0xf7147a,'firstMsgDirection':_0xda72('0xc4'),'Messages':[_[_0xda72('0x51')](_0x46c173['body'],{'read':![],'body':_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')],'phone':_0xf7147a,'WhatsappAccountId':_0x4bb2af['id'],'UserId':_0x46c173[_0xda72('0x5c')]['id'],'ContactId':_0x177850['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xda72('0xc5')}]})[_0xda72('0x22')](function(_0x532c68){return[_0x532c68,!![]];});});}})[_0xda72('0x72')](function(_0x24029d,_0xe824ae){if(_0xe824ae){return _0x24029d;}return db[_0xda72('0xaf')][_0xda72('0x5a')](_[_0xda72('0x51')](_0x46c173[_0xda72('0x5b')],{'read':![],'body':_0x46c173[_0xda72('0x5b')][_0xda72('0x5b')],'phone':_0xf7147a,'WhatsappAccountId':_0x4bb2af['id'],'WhatsappInteractionId':_0x24029d['id'],'UserId':_0x46c173[_0xda72('0x5c')]['id'],'ContactId':_0x177850['id']}))[_0xda72('0x22')](function(_0x1fb792){_0x24029d[_0xda72('0xc6')]['Messages']=[];_0x24029d[_0xda72('0xc6')][_0xda72('0xc5')]['push'](_0x1fb792[_0xda72('0xc6')]);return _0x24029d;});})[_0xda72('0x22')](respondWithResult(_0x32c613,null))[_0xda72('0x2b')](handleError(_0x32c613,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c77fd57..e1f3bd9 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 _0x8e02=['WhatsappAccount','save','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x504a84,_0x19e541){var _0x4ccfa3=function(_0x11e502){while(--_0x11e502){_0x504a84['push'](_0x504a84['shift']());}};_0x4ccfa3(++_0x19e541);}(_0x8e02,0x91));var _0x28e0=function(_0x1a68f6,_0x3241d2){_0x1a68f6=_0x1a68f6-0x0;var _0x2272d0=_0x8e02[_0x1a68f6];return _0x2272d0;};'use strict';var EventEmitter=require(_0x28e0('0x0'));var WhatsappAccount=require(_0x28e0('0x1'))['db'][_0x28e0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28e0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2346b3){return function(_0x550f46,_0x2db366,_0x125db9){WhatsappAccountEvents[_0x28e0('0x4')](_0x2346b3+':'+_0x550f46['id'],_0x550f46);WhatsappAccountEvents[_0x28e0('0x4')](_0x2346b3,_0x550f46);_0x125db9(null);};}for(var e in events){if(events[_0x28e0('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x28e0('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9277=['events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x94db91,_0x9549f2){var _0x481783=function(_0x4d6343){while(--_0x4d6343){_0x94db91['push'](_0x94db91['shift']());}};_0x481783(++_0x9549f2);}(_0x9277,0x110));var _0x7927=function(_0x5a7188,_0x2ec5ad){_0x5a7188=_0x5a7188-0x0;var _0x805ef=_0x9277[_0x5a7188];return _0x805ef;};'use strict';var EventEmitter=require(_0x7927('0x0'));var WhatsappAccount=require(_0x7927('0x1'))['db'][_0x7927('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7927('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7927('0x4')};function emitEvent(_0x24b3eb){return function(_0xe86455,_0x37e5e7,_0x1e8bf8){WhatsappAccountEvents['emit'](_0x24b3eb+':'+_0xe86455['id'],_0xe86455);WhatsappAccountEvents[_0x7927('0x5')](_0x24b3eb,_0xe86455);_0x1e8bf8(null);};}for(var e in events){if(events[_0x7927('0x6')](e)){var event=events[e];WhatsappAccount[_0x7927('0x7')](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 0266cfe..9e86732 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 _0xa2ba=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','define'];(function(_0x2b6bb5,_0x2629dd){var _0x548237=function(_0x1ad47e){while(--_0x1ad47e){_0x2b6bb5['push'](_0x2b6bb5['shift']());}};_0x548237(++_0x2629dd);}(_0xa2ba,0xab));var _0xaa2b=function(_0x3a2a35,_0x52ebd6){_0x3a2a35=_0x3a2a35-0x0;var _0x3ca3b9=_0xa2ba[_0x3a2a35];return _0x3ca3b9;};'use strict';var _=require(_0xaa2b('0x0'));var util=require(_0xaa2b('0x1'));var logger=require(_0xaa2b('0x2'))(_0xaa2b('0x3'));var moment=require(_0xaa2b('0x4'));var BPromise=require(_0xaa2b('0x5'));var rp=require(_0xaa2b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa2b('0x7'));var config=require(_0xaa2b('0x8'));var attributes=require(_0xaa2b('0x9'));module['exports']=function(_0x5b21d1,_0x53bf62){return _0x5b21d1[_0xaa2b('0xa')](_0xaa2b('0xb'),attributes,{'tableName':_0xaa2b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a6=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1966eb,_0x5a5a16){var _0x4b6220=function(_0x2cff24){while(--_0x2cff24){_0x1966eb['push'](_0x1966eb['shift']());}};_0x4b6220(++_0x5a5a16);}(_0x98a6,0x195));var _0x698a=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x98a6[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x698a('0x0'));var util=require(_0x698a('0x1'));var logger=require(_0x698a('0x2'))(_0x698a('0x3'));var moment=require(_0x698a('0x4'));var BPromise=require(_0x698a('0x5'));var rp=require(_0x698a('0x6'));var fs=require('fs');var path=require(_0x698a('0x7'));var rimraf=require(_0x698a('0x8'));var config=require(_0x698a('0x9'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x191a8d,_0x22ddbc){return _0x191a8d[_0x698a('0xa')](_0x698a('0xb'),attributes,{'tableName':_0x698a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 589e20b..05c116a 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 _0xb3dd=['ShowWhatsappAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','raw','where','include','map','model','attributes'];(function(_0x551218,_0x5dc26b){var _0x50e036=function(_0x1a61c6){while(--_0x1a61c6){_0x551218['push'](_0x551218['shift']());}};_0x50e036(++_0x5dc26b);}(_0xb3dd,0x76));var _0xdb3d=function(_0x4ce78c,_0x5e82e9){_0x4ce78c=_0x4ce78c-0x0;var _0x3a3534=_0xb3dd[_0x4ce78c];return _0x3a3534;};'use strict';var _=require('lodash');var util=require(_0xdb3d('0x0'));var moment=require(_0xdb3d('0x1'));var BPromise=require(_0xdb3d('0x2'));var rs=require(_0xdb3d('0x3'));var fs=require('fs');var Redis=require(_0xdb3d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb3d('0x5'));var logger=require(_0xdb3d('0x6'))(_0xdb3d('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb3d('0x8'));var client=jayson[_0xdb3d('0x9')][_0xdb3d('0xa')]({'port':0x232a});config[_0xdb3d('0xb')]=_[_0xdb3d('0xc')](config[_0xdb3d('0xb')],{'host':_0xdb3d('0xd'),'port':0x18eb});var socket=require(_0xdb3d('0xe'))(new Redis(config['redis']));require(_0xdb3d('0xf'))[_0xdb3d('0x10')](socket);function respondWithRpcPromise(_0xfd6996,_0x4fa86a,_0x3e45bd){return new BPromise(function(_0x28517d,_0x2dd2e7){return client[_0xdb3d('0x11')](_0xfd6996,_0x3e45bd)[_0xdb3d('0x12')](function(_0x57ad24){logger[_0xdb3d('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x4fa86a,'request\x20sent');logger[_0xdb3d('0x14')](_0xdb3d('0x15'),_0x4fa86a,_0xdb3d('0x16'),JSON[_0xdb3d('0x17')](_0x57ad24));if(_0x57ad24[_0xdb3d('0x18')]){if(_0x57ad24[_0xdb3d('0x18')][_0xdb3d('0x19')]===0x1f4){logger[_0xdb3d('0x18')](_0xdb3d('0x1a'),_0x4fa86a,_0x57ad24[_0xdb3d('0x18')][_0xdb3d('0x1b')]);return _0x2dd2e7(_0x57ad24[_0xdb3d('0x18')][_0xdb3d('0x1b')]);}logger[_0xdb3d('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x4fa86a,_0x57ad24[_0xdb3d('0x18')][_0xdb3d('0x1b')]);return _0x28517d(_0x57ad24[_0xdb3d('0x18')]['message']);}else{logger[_0xdb3d('0x13')](_0xdb3d('0x1a'),_0x4fa86a,'request\x20sent');_0x28517d(_0x57ad24['result'][_0xdb3d('0x1b')]);}})[_0xdb3d('0x1c')](function(_0x3bbaf7){logger[_0xdb3d('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x4fa86a,_0x3bbaf7);_0x2dd2e7(_0x3bbaf7);});});}exports['ShowWhatsappAccount']=function(_0x9c978e){var _0x20eec4=this;return new Promise(function(_0x4c8efc,_0x51b6d3){return db[_0xdb3d('0x1d')][_0xdb3d('0x1e')]({'raw':_0x9c978e[_0xdb3d('0x1f')]?_0x9c978e[_0xdb3d('0x1f')][_0xdb3d('0x20')]===undefined?!![]:![]:!![],'where':_0x9c978e[_0xdb3d('0x1f')]?_0x9c978e[_0xdb3d('0x1f')][_0xdb3d('0x21')]||null:null,'attributes':_0x9c978e[_0xdb3d('0x1f')]?_0x9c978e[_0xdb3d('0x1f')]['attributes']||null:null,'include':_0x9c978e[_0xdb3d('0x1f')]?_0x9c978e['options'][_0xdb3d('0x22')]?_[_0xdb3d('0x23')](_0x9c978e[_0xdb3d('0x1f')][_0xdb3d('0x22')],function(_0x5865bf){return{'model':db[_0x5865bf[_0xdb3d('0x24')]],'as':_0x5865bf['as'],'attributes':_0x5865bf[_0xdb3d('0x25')],'include':_0x5865bf[_0xdb3d('0x22')]?_[_0xdb3d('0x23')](_0x5865bf['include'],function(_0x3fa6d0){return{'model':db[_0x3fa6d0[_0xdb3d('0x24')]],'as':_0x3fa6d0['as'],'attributes':_0x3fa6d0[_0xdb3d('0x25')],'include':_0x3fa6d0[_0xdb3d('0x22')]?_[_0xdb3d('0x23')](_0x3fa6d0[_0xdb3d('0x22')],function(_0x3d6bcc){return{'model':db[_0x3d6bcc['model']],'as':_0x3d6bcc['as'],'attributes':_0x3d6bcc[_0xdb3d('0x25')]};}):[]};}):[]};}):[]:[]})[_0xdb3d('0x12')](function(_0x4157bb){logger[_0xdb3d('0x13')]('ShowWhatsappAccount',_0x9c978e);logger['debug'](_0xdb3d('0x26'),_0x9c978e,JSON[_0xdb3d('0x17')](_0x4157bb));_0x4c8efc(_0x4157bb);})[_0xdb3d('0x1c')](function(_0x658211){logger['error'](_0xdb3d('0x26'),_0x658211['message'],_0x9c978e);_0x51b6d3(_0x20eec4['error'](0x1f4,_0x658211[_0xdb3d('0x1b')]));});});}; \ No newline at end of file +var _0x88b5=['options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowWhatsappAccount','WhatsappAccount','find'];(function(_0x22b61b,_0x1de239){var _0x437ce8=function(_0x1b9cdb){while(--_0x1b9cdb){_0x22b61b['push'](_0x22b61b['shift']());}};_0x437ce8(++_0x1de239);}(_0x88b5,0x167));var _0x588b=function(_0x4ec51e,_0x2ce800){_0x4ec51e=_0x4ec51e-0x0;var _0x148029=_0x88b5[_0x4ec51e];return _0x148029;};'use strict';var _=require(_0x588b('0x0'));var util=require(_0x588b('0x1'));var moment=require(_0x588b('0x2'));var BPromise=require(_0x588b('0x3'));var rs=require(_0x588b('0x4'));var fs=require('fs');var Redis=require(_0x588b('0x5'));var db=require(_0x588b('0x6'))['db'];var utils=require(_0x588b('0x7'));var logger=require(_0x588b('0x8'))(_0x588b('0x9'));var config=require(_0x588b('0xa'));var jayson=require(_0x588b('0xb'));var client=jayson[_0x588b('0xc')]['http']({'port':0x232a});config[_0x588b('0xd')]=_[_0x588b('0xe')](config[_0x588b('0xd')],{'host':_0x588b('0xf'),'port':0x18eb});var socket=require(_0x588b('0x10'))(new Redis(config[_0x588b('0xd')]));require(_0x588b('0x11'))['register'](socket);function respondWithRpcPromise(_0x17ade2,_0x875406,_0x15db9c){return new BPromise(function(_0x2423ab,_0xb28e92){return client['request'](_0x17ade2,_0x15db9c)[_0x588b('0x12')](function(_0xd858c9){logger['info'](_0x588b('0x13'),_0x875406,_0x588b('0x14'));logger[_0x588b('0x15')](_0x588b('0x16'),_0x875406,_0x588b('0x14'),JSON['stringify'](_0xd858c9));if(_0xd858c9[_0x588b('0x17')]){if(_0xd858c9[_0x588b('0x17')][_0x588b('0x18')]===0x1f4){logger[_0x588b('0x17')](_0x588b('0x13'),_0x875406,_0xd858c9['error'][_0x588b('0x19')]);return _0xb28e92(_0xd858c9['error'][_0x588b('0x19')]);}logger[_0x588b('0x17')](_0x588b('0x13'),_0x875406,_0xd858c9[_0x588b('0x17')][_0x588b('0x19')]);return _0x2423ab(_0xd858c9['error'][_0x588b('0x19')]);}else{logger[_0x588b('0x1a')](_0x588b('0x13'),_0x875406,_0x588b('0x14'));_0x2423ab(_0xd858c9[_0x588b('0x1b')][_0x588b('0x19')]);}})['catch'](function(_0x556804){logger[_0x588b('0x17')](_0x588b('0x13'),_0x875406,_0x556804);_0xb28e92(_0x556804);});});}exports[_0x588b('0x1c')]=function(_0x5f387c){var _0x15471b=this;return new Promise(function(_0xc0ede9,_0x1dc14a){return db[_0x588b('0x1d')][_0x588b('0x1e')]({'raw':_0x5f387c[_0x588b('0x1f')]?_0x5f387c[_0x588b('0x1f')][_0x588b('0x20')]===undefined?!![]:![]:!![],'where':_0x5f387c[_0x588b('0x1f')]?_0x5f387c[_0x588b('0x1f')][_0x588b('0x21')]||null:null,'attributes':_0x5f387c['options']?_0x5f387c[_0x588b('0x1f')]['attributes']||null:null,'include':_0x5f387c['options']?_0x5f387c['options'][_0x588b('0x22')]?_[_0x588b('0x23')](_0x5f387c[_0x588b('0x1f')][_0x588b('0x22')],function(_0x4e0294){return{'model':db[_0x4e0294[_0x588b('0x24')]],'as':_0x4e0294['as'],'attributes':_0x4e0294['attributes'],'include':_0x4e0294[_0x588b('0x22')]?_[_0x588b('0x23')](_0x4e0294[_0x588b('0x22')],function(_0x59e306){return{'model':db[_0x59e306[_0x588b('0x24')]],'as':_0x59e306['as'],'attributes':_0x59e306[_0x588b('0x25')],'include':_0x59e306[_0x588b('0x22')]?_['map'](_0x59e306[_0x588b('0x22')],function(_0x150c38){return{'model':db[_0x150c38[_0x588b('0x24')]],'as':_0x150c38['as'],'attributes':_0x150c38[_0x588b('0x25')]};}):[]};}):[]};}):[]:[]})[_0x588b('0x12')](function(_0x37f5ae){logger[_0x588b('0x1a')](_0x588b('0x1c'),_0x5f387c);logger[_0x588b('0x15')](_0x588b('0x1c'),_0x5f387c,JSON['stringify'](_0x37f5ae));_0xc0ede9(_0x37f5ae);})[_0x588b('0x26')](function(_0x5b1b08){logger['error'](_0x588b('0x1c'),_0x5b1b08[_0x588b('0x19')],_0x5f387c);_0x1dc14a(_0x15471b[_0x588b('0x17')](0x1f4,_0x5b1b08[_0x588b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5844406..97e6dff 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 _0x46d6=['register','length','whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener'];(function(_0x2b62c8,_0x36c80b){var _0x569ebb=function(_0x1f2f37){while(--_0x1f2f37){_0x2b62c8['push'](_0x2b62c8['shift']());}};_0x569ebb(++_0x36c80b);}(_0x46d6,0x1bb));var _0x646d=function(_0x1fb6be,_0x2fd9a3){_0x1fb6be=_0x1fb6be-0x0;var _0x1eebff=_0x46d6[_0x1fb6be];return _0x1eebff;};'use strict';var WhatsappAccountEvents=require(_0x646d('0x0'));var events=[_0x646d('0x1'),_0x646d('0x2'),'update'];function createListener(_0x3be5a7,_0x2a9cfe){return function(_0x3cb158){_0x2a9cfe[_0x646d('0x3')](_0x3be5a7,_0x3cb158);};}function removeListener(_0x51403b,_0xc4a619){return function(){WhatsappAccountEvents[_0x646d('0x4')](_0x51403b,_0xc4a619);};}exports[_0x646d('0x5')]=function(_0x5602ad){for(var _0xb8afb3=0x0,_0x44e524=events[_0x646d('0x6')];_0xb8afb3<_0x44e524;_0xb8afb3++){var _0x9bd856=events[_0xb8afb3];var _0x83b8e5=createListener(_0x646d('0x7')+_0x9bd856,_0x5602ad);WhatsappAccountEvents['on'](_0x9bd856,_0x83b8e5);}}; \ No newline at end of file +var _0x58e0=['save','emit','removeListener','whatsappAccount:','./whatsappAccount.events'];(function(_0x23e5b5,_0x4d8e1b){var _0x1afbb1=function(_0x51083d){while(--_0x51083d){_0x23e5b5['push'](_0x23e5b5['shift']());}};_0x1afbb1(++_0x4d8e1b);}(_0x58e0,0x11c));var _0x058e=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x58e0[_0x4b7895];return _0x264180;};'use strict';var WhatsappAccountEvents=require(_0x058e('0x0'));var events=[_0x058e('0x1'),'remove','update'];function createListener(_0x1c857b,_0x583c3a){return function(_0x5e487f){_0x583c3a[_0x058e('0x2')](_0x1c857b,_0x5e487f);};}function removeListener(_0xe6a6ac,_0x35c411){return function(){WhatsappAccountEvents[_0x058e('0x3')](_0xe6a6ac,_0x35c411);};}exports['register']=function(_0xcbfc20){for(var _0x66032d=0x0,_0x5d051e=events['length'];_0x66032d<_0x5d051e;_0x66032d++){var _0x2a61e4=events[_0x66032d];var _0x20b800=createListener(_0x058e('0x4')+_0x2a61e4,_0xcbfc20);WhatsappAccountEvents['on'](_0x2a61e4,_0x20b800);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 30bbdec..b13a00d 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 _0x7cb3=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x7cb3,0x7d));var _0x37cb=function(_0x1a79ac,_0x8ef293){_0x1a79ac=_0x1a79ac-0x0;var _0x185fe5=_0x7cb3[_0x1a79ac];return _0x185fe5;};'use strict';var multer=require(_0x37cb('0x0'));var util=require(_0x37cb('0x1'));var path=require(_0x37cb('0x2'));var timeout=require(_0x37cb('0x3'));var express=require(_0x37cb('0x4'));var router=express[_0x37cb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x37cb('0x6'));var config=require(_0x37cb('0x7'));var controller=require(_0x37cb('0x8'));router[_0x37cb('0x9')]('/',auth[_0x37cb('0xa')](),controller[_0x37cb('0xb')]);router[_0x37cb('0x9')]('/:id',auth[_0x37cb('0xa')](),controller[_0x37cb('0xc')]);router[_0x37cb('0xd')]('/',auth[_0x37cb('0xa')](),controller[_0x37cb('0xe')]);router[_0x37cb('0xf')](_0x37cb('0x10'),auth[_0x37cb('0xa')](),controller[_0x37cb('0x11')]);router[_0x37cb('0x12')](_0x37cb('0x10'),auth[_0x37cb('0xa')](),controller[_0x37cb('0x13')]);module[_0x37cb('0x14')]=router; \ No newline at end of file +var _0xc5db=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5bf38a,_0x5a298e){var _0x7f29cd=function(_0x5c7c51){while(--_0x5c7c51){_0x5bf38a['push'](_0x5bf38a['shift']());}};_0x7f29cd(++_0x5a298e);}(_0xc5db,0x188));var _0xbc5d=function(_0x59d84c,_0x5005d2){_0x59d84c=_0x59d84c-0x0;var _0x32ac58=_0xc5db[_0x59d84c];return _0x32ac58;};'use strict';var multer=require(_0xbc5d('0x0'));var util=require(_0xbc5d('0x1'));var path=require(_0xbc5d('0x2'));var timeout=require(_0xbc5d('0x3'));var express=require(_0xbc5d('0x4'));var router=express[_0xbc5d('0x5')]();var fs_extra=require(_0xbc5d('0x6'));var auth=require(_0xbc5d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbc5d('0x8'));var controller=require(_0xbc5d('0x9'));router[_0xbc5d('0xa')]('/',auth[_0xbc5d('0xb')](),controller[_0xbc5d('0xc')]);router[_0xbc5d('0xa')](_0xbc5d('0xd'),auth[_0xbc5d('0xb')](),controller[_0xbc5d('0xe')]);router[_0xbc5d('0xf')]('/',auth[_0xbc5d('0xb')](),controller[_0xbc5d('0x10')]);router[_0xbc5d('0x11')](_0xbc5d('0xd'),auth[_0xbc5d('0xb')](),controller[_0xbc5d('0x12')]);router[_0xbc5d('0x13')](_0xbc5d('0xd'),auth['isAuthenticated'](),controller[_0xbc5d('0x14')]);module[_0xbc5d('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index a7911d2..5c7e74a 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 _0xd358=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xd358,0x1dd));var _0x8d35=function(_0x38b147,_0x1801fd){_0x38b147=_0x38b147-0x0;var _0x32125f=_0xd358[_0x38b147];return _0x32125f;};'use strict';var Sequelize=require(_0x8d35('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8d35('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8d35('0x2')],'allowNull':![],'defaultValue':_0x8d35('0x3')},'appdata':{'type':Sequelize[_0x8d35('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8d35('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9e8d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9e8d,0x184));var _0xd9e8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x9e8d[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xd9e8('0x0'));module[_0xd9e8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd9e8('0x2')],'allowNull':![],'defaultValue':_0xd9e8('0x3')},'appdata':{'type':Sequelize[_0xd9e8('0x4')]()},'description':{'type':Sequelize[_0xd9e8('0x2')]},'interval':{'type':Sequelize[_0xd9e8('0x2')],'defaultValue':_0xd9e8('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c6619a5..4f1ca57 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 _0x6333=['VIRTUAL','options','includeAll','include','catch','params','create','body','find','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x6333,0x83));var _0x3633=function(_0x3883ef,_0x4bfa0f){_0x3883ef=_0x3883ef-0x0;var _0x59531a=_0x6333[_0x3883ef];return _0x59531a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3633('0x0'));var rp=require('request-promise');var moment=require(_0x3633('0x1'));var BPromise=require(_0x3633('0x2'));var Mustache=require('mustache');var util=require(_0x3633('0x3'));var path=require('path');var sox=require(_0x3633('0x4'));var csv=require(_0x3633('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3633('0x6'));var squel=require(_0x3633('0x7'));var crypto=require(_0x3633('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3633('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3633('0x9'));var authService=require(_0x3633('0xa'));var qs=require(_0x3633('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3633('0xc'));var logger=require(_0x3633('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x3633('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337f72,_0xf1346){_0xf1346=_0xf1346||0xcc;return function(_0x51a78a){if(_0x51a78a){return _0x337f72[_0x3633('0xf')](_0xf1346);}return _0x337f72[_0x3633('0x10')](_0xf1346)['end']();};}function respondWithResult(_0x3231f9,_0x28f08e){_0x28f08e=_0x28f08e||0xc8;return function(_0x5bf51b){if(_0x5bf51b){return _0x3231f9[_0x3633('0x10')](_0x28f08e)['json'](_0x5bf51b);}};}function respondWithFilteredResult(_0x4c71ea,_0x1b5728){return function(_0x377f19){if(_0x377f19){var _0x2f5eab=typeof _0x1b5728[_0x3633('0x11')]===_0x3633('0x12')&&typeof _0x1b5728[_0x3633('0x13')]==='undefined';var _0x2d123e=_0x377f19[_0x3633('0x14')];var _0x578e08=_0x2f5eab?0x0:_0x1b5728['offset'];var _0x38a7bc=_0x2f5eab?_0x377f19['count']:_0x1b5728['offset']+_0x1b5728[_0x3633('0x13')];var _0x13f7af;if(_0x38a7bc>=_0x2d123e){_0x38a7bc=_0x2d123e;_0x13f7af=0xc8;}else{_0x13f7af=0xce;}_0x4c71ea[_0x3633('0x10')](_0x13f7af);return _0x4c71ea['set'](_0x3633('0x15'),_0x578e08+'-'+_0x38a7bc+'/'+_0x2d123e)[_0x3633('0x16')](_0x377f19);}return null;};}function patchUpdates(_0x107b5a){return function(_0x47d57b){try{jsonpatch[_0x3633('0x17')](_0x47d57b,_0x107b5a,!![]);}catch(_0x2b7f86){return BPromise[_0x3633('0x18')](_0x2b7f86);}return _0x47d57b['save']();};}function saveUpdates(_0x55686f,_0x17a013){return function(_0x4ed8e3){if(_0x4ed8e3){return _0x4ed8e3[_0x3633('0x19')](_0x55686f)[_0x3633('0x1a')](function(_0x1d5270){return _0x1d5270;});}return null;};}function removeEntity(_0x1115dd,_0x4306ef){return function(_0x27511a){if(_0x27511a){return _0x27511a[_0x3633('0x1b')]()[_0x3633('0x1a')](function(){_0x1115dd[_0x3633('0x10')](0xcc)[_0x3633('0x1c')]();});}};}function handleEntityNotFound(_0x2c781f,_0x3844d5){return function(_0x4b0ad7){if(!_0x4b0ad7){_0x2c781f[_0x3633('0xf')](0x194);}return _0x4b0ad7;};}function handleError(_0x145e3c,_0x493e14){_0x493e14=_0x493e14||0x1f4;return function(_0x19c36c){logger[_0x3633('0x1d')](_0x19c36c[_0x3633('0x1e')]);if(_0x19c36c[_0x3633('0x1f')]){delete _0x19c36c[_0x3633('0x1f')];}_0x145e3c[_0x3633('0x10')](_0x493e14)[_0x3633('0x20')](_0x19c36c);};}exports['index']=function(_0x9fa0fd,_0x55d70a){var _0x1ea384={},_0xbf7c64={},_0x2306e4={'count':0x0,'rows':[]};var _0x142c48=_[_0x3633('0x21')](db[_0x3633('0x22')][_0x3633('0x23')],function(_0x2ceabb){return{'name':_0x2ceabb['fieldName'],'type':_0x2ceabb[_0x3633('0x24')][_0x3633('0x25')]};});_0xbf7c64[_0x3633('0x26')]=_[_0x3633('0x21')](_0x142c48,_0x3633('0x1f'));_0xbf7c64[_0x3633('0x27')]=_[_0x3633('0x28')](_0x9fa0fd['query']);_0xbf7c64[_0x3633('0x29')]=_[_0x3633('0x2a')](_0xbf7c64['model'],_0xbf7c64[_0x3633('0x27')]);_0x1ea384[_0x3633('0x2b')]=_[_0x3633('0x2a')](_0xbf7c64[_0x3633('0x26')],qs[_0x3633('0x2c')](_0x9fa0fd['query'][_0x3633('0x2c')]));_0x1ea384['attributes']=_0x1ea384['attributes'][_0x3633('0x2d')]?_0x1ea384['attributes']:_0xbf7c64[_0x3633('0x26')];if(!_0x9fa0fd[_0x3633('0x27')]['hasOwnProperty'](_0x3633('0x2e'))){_0x1ea384[_0x3633('0x13')]=qs['limit'](_0x9fa0fd['query'][_0x3633('0x13')]);_0x1ea384[_0x3633('0x11')]=qs[_0x3633('0x11')](_0x9fa0fd[_0x3633('0x27')]['offset']);}_0x1ea384[_0x3633('0x2f')]=qs[_0x3633('0x30')](_0x9fa0fd[_0x3633('0x27')]['sort']);_0x1ea384[_0x3633('0x31')]=qs['filters'](_[_0x3633('0x32')](_0x9fa0fd[_0x3633('0x27')],_0xbf7c64[_0x3633('0x29')]),_0x142c48);if(_0x9fa0fd[_0x3633('0x27')]['filter']){_0x1ea384[_0x3633('0x31')]=_[_0x3633('0x33')](_0x1ea384['where'],{'$or':_[_0x3633('0x21')](_0x142c48,function(_0x4c4647){if(_0x4c4647[_0x3633('0x24')]!==_0x3633('0x34')){var _0x1b1302={};_0x1b1302[_0x4c4647['name']]={'$like':'%'+_0x9fa0fd[_0x3633('0x27')]['filter']+'%'};return _0x1b1302;}})});}_0x1ea384=_[_0x3633('0x33')]({},_0x1ea384,_0x9fa0fd[_0x3633('0x35')]);var _0x10bbfd={'where':_0x1ea384[_0x3633('0x31')]};return db['WhatsappApplication'][_0x3633('0x14')](_0x10bbfd)[_0x3633('0x1a')](function(_0x1dfdcb){_0x2306e4[_0x3633('0x14')]=_0x1dfdcb;if(_0x9fa0fd[_0x3633('0x27')][_0x3633('0x36')]){_0x1ea384[_0x3633('0x37')]=[{'all':!![]}];}return db[_0x3633('0x22')]['findAll'](_0x1ea384);})['then'](function(_0x2cdeee){_0x2306e4['rows']=_0x2cdeee;return _0x2306e4;})[_0x3633('0x1a')](respondWithFilteredResult(_0x55d70a,_0x1ea384))[_0x3633('0x38')](handleError(_0x55d70a,null));};exports['show']=function(_0x192561,_0x3cf8d9){var _0x1edb4b={'raw':!![],'where':{'id':_0x192561[_0x3633('0x39')]['id']}},_0x399a80={};_0x399a80['model']=_['keys'](db[_0x3633('0x22')][_0x3633('0x23')]);_0x399a80[_0x3633('0x27')]=_[_0x3633('0x28')](_0x192561[_0x3633('0x27')]);_0x399a80[_0x3633('0x29')]=_[_0x3633('0x2a')](_0x399a80['model'],_0x399a80[_0x3633('0x27')]);_0x1edb4b[_0x3633('0x2b')]=_[_0x3633('0x2a')](_0x399a80['model'],qs['fields'](_0x192561[_0x3633('0x27')]['fields']));_0x1edb4b[_0x3633('0x2b')]=_0x1edb4b['attributes'][_0x3633('0x2d')]?_0x1edb4b[_0x3633('0x2b')]:_0x399a80[_0x3633('0x26')];if(_0x192561[_0x3633('0x27')][_0x3633('0x36')]){_0x1edb4b[_0x3633('0x37')]=[{'all':!![]}];}_0x1edb4b=_[_0x3633('0x33')]({},_0x1edb4b,_0x192561[_0x3633('0x35')]);return db['WhatsappApplication']['find'](_0x1edb4b)[_0x3633('0x1a')](handleEntityNotFound(_0x3cf8d9,null))[_0x3633('0x1a')](respondWithResult(_0x3cf8d9,null))['catch'](handleError(_0x3cf8d9,null));};exports[_0x3633('0x3a')]=function(_0x352260,_0x2f14e5){return db['WhatsappApplication']['create'](_0x352260[_0x3633('0x3b')],{})[_0x3633('0x1a')](respondWithResult(_0x2f14e5,0xc9))[_0x3633('0x38')](handleError(_0x2f14e5,null));};exports[_0x3633('0x19')]=function(_0xb39d18,_0x2ae7bd){if(_0xb39d18['body']['id']){delete _0xb39d18[_0x3633('0x3b')]['id'];}return db[_0x3633('0x22')][_0x3633('0x3c')]({'where':{'id':_0xb39d18[_0x3633('0x39')]['id']}})[_0x3633('0x1a')](handleEntityNotFound(_0x2ae7bd,null))[_0x3633('0x1a')](saveUpdates(_0xb39d18[_0x3633('0x3b')],null))['then'](respondWithResult(_0x2ae7bd,null))[_0x3633('0x38')](handleError(_0x2ae7bd,null));};exports['destroy']=function(_0x321429,_0x31a072){return db['WhatsappApplication'][_0x3633('0x3c')]({'where':{'id':_0x321429['params']['id']}})[_0x3633('0x1a')](handleEntityNotFound(_0x31a072,null))[_0x3633('0x1a')](removeEntity(_0x31a072,null))[_0x3633('0x38')](handleError(_0x31a072,null));}; \ No newline at end of file +var _0x0b78=['WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x17d9fd,_0x4b2b91){var _0x4aa02e=function(_0x757a1f){while(--_0x757a1f){_0x17d9fd['push'](_0x17d9fd['shift']());}};_0x4aa02e(++_0x4b2b91);}(_0x0b78,0x1d6));var _0x80b7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0b78[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80b7('0x0'));var zipdir=require(_0x80b7('0x1'));var jsonpatch=require(_0x80b7('0x2'));var rp=require('request-promise');var moment=require(_0x80b7('0x3'));var BPromise=require(_0x80b7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x80b7('0x5'));var csv=require(_0x80b7('0x6'));var ejs=require(_0x80b7('0x7'));var fs=require('fs');var fs_extra=require(_0x80b7('0x8'));var _=require(_0x80b7('0x9'));var squel=require(_0x80b7('0xa'));var crypto=require('crypto');var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require(_0x80b7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0xe'));var as=require(_0x80b7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80b7('0x10'))(_0x80b7('0x11'));var utils=require(_0x80b7('0x12'));var config=require(_0x80b7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac007,_0x1bbe9f){_0x1bbe9f=_0x1bbe9f||0xcc;return function(_0x16976c){if(_0x16976c){return _0x3ac007[_0x80b7('0x14')](_0x1bbe9f);}return _0x3ac007[_0x80b7('0x15')](_0x1bbe9f)[_0x80b7('0x16')]();};}function respondWithResult(_0x3d71a0,_0x32cecc){_0x32cecc=_0x32cecc||0xc8;return function(_0x416d32){if(_0x416d32){return _0x3d71a0['status'](_0x32cecc)['json'](_0x416d32);}};}function respondWithFilteredResult(_0x5c64df,_0x57e428){return function(_0x2c6bff){if(_0x2c6bff){var _0x459f67=typeof _0x57e428[_0x80b7('0x17')]===_0x80b7('0x18')&&typeof _0x57e428[_0x80b7('0x19')]===_0x80b7('0x18');var _0x262cd5=_0x2c6bff[_0x80b7('0x1a')];var _0x22abaa=_0x459f67?0x0:_0x57e428[_0x80b7('0x17')];var _0x25b5e9=_0x459f67?_0x2c6bff[_0x80b7('0x1a')]:_0x57e428[_0x80b7('0x17')]+_0x57e428['limit'];var _0x2165df;if(_0x25b5e9>=_0x262cd5){_0x25b5e9=_0x262cd5;_0x2165df=0xc8;}else{_0x2165df=0xce;}_0x5c64df[_0x80b7('0x15')](_0x2165df);return _0x5c64df[_0x80b7('0x1b')](_0x80b7('0x1c'),_0x22abaa+'-'+_0x25b5e9+'/'+_0x262cd5)[_0x80b7('0x1d')](_0x2c6bff);}return null;};}function patchUpdates(_0x3ebdd6){return function(_0x220133){try{jsonpatch[_0x80b7('0x1e')](_0x220133,_0x3ebdd6,!![]);}catch(_0x3da240){return BPromise[_0x80b7('0x1f')](_0x3da240);}return _0x220133[_0x80b7('0x20')]();};}function saveUpdates(_0x1ef249,_0x53046f){return function(_0x55bf6e){if(_0x55bf6e){return _0x55bf6e[_0x80b7('0x21')](_0x1ef249)[_0x80b7('0x22')](function(_0x158b65){return _0x158b65;});}return null;};}function removeEntity(_0x5e8093,_0x9fccdc){return function(_0x390d8a){if(_0x390d8a){return _0x390d8a[_0x80b7('0x23')]()[_0x80b7('0x22')](function(){_0x5e8093[_0x80b7('0x15')](0xcc)[_0x80b7('0x16')]();});}};}function handleEntityNotFound(_0x44ab49,_0xea1ea0){return function(_0x23a876){if(!_0x23a876){_0x44ab49[_0x80b7('0x14')](0x194);}return _0x23a876;};}function handleError(_0x1221c7,_0x4cb8c9){_0x4cb8c9=_0x4cb8c9||0x1f4;return function(_0x328c15){logger[_0x80b7('0x24')](_0x328c15[_0x80b7('0x25')]);if(_0x328c15[_0x80b7('0x26')]){delete _0x328c15[_0x80b7('0x26')];}_0x1221c7[_0x80b7('0x15')](_0x4cb8c9)[_0x80b7('0x27')](_0x328c15);};}exports[_0x80b7('0x28')]=function(_0x479335,_0x42e7a6){var _0x23958b={},_0x1dc2df={},_0x396144={'count':0x0,'rows':[]};var _0x46b76b=_['map'](db[_0x80b7('0x29')][_0x80b7('0x2a')],function(_0x2cc6f7){return{'name':_0x2cc6f7[_0x80b7('0x2b')],'type':_0x2cc6f7[_0x80b7('0x2c')][_0x80b7('0x2d')]};});_0x1dc2df[_0x80b7('0x2e')]=_['map'](_0x46b76b,_0x80b7('0x26'));_0x1dc2df[_0x80b7('0x2f')]=_['keys'](_0x479335[_0x80b7('0x2f')]);_0x1dc2df[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x1dc2df[_0x80b7('0x2e')],_0x1dc2df[_0x80b7('0x2f')]);_0x23958b[_0x80b7('0x32')]=_['intersection'](_0x1dc2df[_0x80b7('0x2e')],qs[_0x80b7('0x33')](_0x479335[_0x80b7('0x2f')]['fields']));_0x23958b[_0x80b7('0x32')]=_0x23958b[_0x80b7('0x32')][_0x80b7('0x34')]?_0x23958b['attributes']:_0x1dc2df[_0x80b7('0x2e')];if(!_0x479335[_0x80b7('0x2f')][_0x80b7('0x35')](_0x80b7('0x36'))){_0x23958b[_0x80b7('0x19')]=qs[_0x80b7('0x19')](_0x479335[_0x80b7('0x2f')][_0x80b7('0x19')]);_0x23958b['offset']=qs['offset'](_0x479335[_0x80b7('0x2f')][_0x80b7('0x17')]);}_0x23958b[_0x80b7('0x37')]=qs[_0x80b7('0x38')](_0x479335['query']['sort']);_0x23958b[_0x80b7('0x39')]=qs[_0x80b7('0x30')](_[_0x80b7('0x3a')](_0x479335[_0x80b7('0x2f')],_0x1dc2df['filters']),_0x46b76b);if(_0x479335[_0x80b7('0x2f')][_0x80b7('0x3b')]){_0x23958b['where']=_[_0x80b7('0x3c')](_0x23958b['where'],{'$or':_[_0x80b7('0x3d')](_0x46b76b,function(_0x490b91){if(_0x490b91['type']!==_0x80b7('0x3e')){var _0x76ffba={};_0x76ffba[_0x490b91[_0x80b7('0x26')]]={'$like':'%'+_0x479335[_0x80b7('0x2f')]['filter']+'%'};return _0x76ffba;}})});}_0x23958b=_['merge']({},_0x23958b,_0x479335[_0x80b7('0x3f')]);var _0x4f50ca={'where':_0x23958b[_0x80b7('0x39')]};return db[_0x80b7('0x29')]['count'](_0x4f50ca)['then'](function(_0x15fe0d){_0x396144[_0x80b7('0x1a')]=_0x15fe0d;if(_0x479335[_0x80b7('0x2f')]['includeAll']){_0x23958b[_0x80b7('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x23958b);})[_0x80b7('0x22')](function(_0x1b2fda){_0x396144[_0x80b7('0x41')]=_0x1b2fda;return _0x396144;})[_0x80b7('0x22')](respondWithFilteredResult(_0x42e7a6,_0x23958b))[_0x80b7('0x42')](handleError(_0x42e7a6,null));};exports[_0x80b7('0x43')]=function(_0xa12f05,_0x2070fc){var _0xa5d1bf={'raw':!![],'where':{'id':_0xa12f05[_0x80b7('0x44')]['id']}},_0x190d41={};_0x190d41[_0x80b7('0x2e')]=_['keys'](db[_0x80b7('0x29')][_0x80b7('0x2a')]);_0x190d41[_0x80b7('0x2f')]=_[_0x80b7('0x45')](_0xa12f05[_0x80b7('0x2f')]);_0x190d41[_0x80b7('0x30')]=_[_0x80b7('0x31')](_0x190d41[_0x80b7('0x2e')],_0x190d41[_0x80b7('0x2f')]);_0xa5d1bf[_0x80b7('0x32')]=_[_0x80b7('0x31')](_0x190d41['model'],qs[_0x80b7('0x33')](_0xa12f05['query'][_0x80b7('0x33')]));_0xa5d1bf[_0x80b7('0x32')]=_0xa5d1bf[_0x80b7('0x32')][_0x80b7('0x34')]?_0xa5d1bf['attributes']:_0x190d41[_0x80b7('0x2e')];if(_0xa12f05[_0x80b7('0x2f')]['includeAll']){_0xa5d1bf[_0x80b7('0x40')]=[{'all':!![]}];}_0xa5d1bf=_[_0x80b7('0x3c')]({},_0xa5d1bf,_0xa12f05['options']);return db[_0x80b7('0x29')][_0x80b7('0x46')](_0xa5d1bf)['then'](handleEntityNotFound(_0x2070fc,null))['then'](respondWithResult(_0x2070fc,null))[_0x80b7('0x42')](handleError(_0x2070fc,null));};exports[_0x80b7('0x47')]=function(_0xb75a61,_0x29bee7){return db[_0x80b7('0x29')][_0x80b7('0x47')](_0xb75a61[_0x80b7('0x48')],{})['then'](respondWithResult(_0x29bee7,0xc9))['catch'](handleError(_0x29bee7,null));};exports['update']=function(_0x599205,_0x52fd0b){if(_0x599205['body']['id']){delete _0x599205[_0x80b7('0x48')]['id'];}return db[_0x80b7('0x29')][_0x80b7('0x46')]({'where':{'id':_0x599205['params']['id']}})[_0x80b7('0x22')](handleEntityNotFound(_0x52fd0b,null))[_0x80b7('0x22')](saveUpdates(_0x599205[_0x80b7('0x48')],null))['then'](respondWithResult(_0x52fd0b,null))[_0x80b7('0x42')](handleError(_0x52fd0b,null));};exports['destroy']=function(_0x1e7536,_0x2a642e){return db[_0x80b7('0x29')]['find']({'where':{'id':_0x1e7536[_0x80b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a642e,null))['then'](removeEntity(_0x2a642e,null))[_0x80b7('0x42')](handleError(_0x2a642e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ebde0a2..dbc1202 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 _0x0f89=['../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x317cc3,_0xac1185){var _0x281c9a=function(_0x114f48){while(--_0x114f48){_0x317cc3['push'](_0x317cc3['shift']());}};_0x281c9a(++_0xac1185);}(_0x0f89,0x111));var _0x90f8=function(_0x39d62a,_0x366229){_0x39d62a=_0x39d62a-0x0;var _0x266a40=_0x0f89[_0x39d62a];return _0x266a40;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var logger=require(_0x90f8('0x2'))('api');var moment=require(_0x90f8('0x3'));var BPromise=require(_0x90f8('0x4'));var rp=require(_0x90f8('0x5'));var fs=require('fs');var path=require(_0x90f8('0x6'));var rimraf=require('rimraf');var config=require(_0x90f8('0x7'));var attributes=require(_0x90f8('0x8'));module['exports']=function(_0x7b8d25,_0x4439a9){return _0x7b8d25[_0x90f8('0x9')](_0x90f8('0xa'),attributes,{'tableName':_0x90f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90f8('0xc'),'collate':_0x90f8('0xd')});}; \ No newline at end of file +var _0x3685=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4b9e00,_0x41a27e){var _0x53040e=function(_0x5e607e){while(--_0x5e607e){_0x4b9e00['push'](_0x4b9e00['shift']());}};_0x53040e(++_0x41a27e);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var fs=require('fs');var path=require(_0x5368('0x6'));var rimraf=require(_0x5368('0x7'));var config=require(_0x5368('0x8'));var attributes=require(_0x5368('0x9'));module[_0x5368('0xa')]=function(_0x4fc6ed,_0x1a4450){return _0x4fc6ed[_0x5368('0xb')](_0x5368('0xc'),attributes,{'tableName':_0x5368('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5368('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 993cf0b..00939aa 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x50c912,_0x42b23b){var _0x4b51e5=function(_0x305da9){while(--_0x305da9){_0x50c912['push'](_0x50c912['shift']());}};_0x4b51e5(++_0x42b23b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2883ca,_0xda104d){_0x2883ca=_0x2883ca-0x0;var _0x4ba901=_0x6f0d[_0x2883ca];return _0x4ba901;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x562163,_0x264e2a){var _0x551eed=function(_0x5ecde8){while(--_0x5ecde8){_0x562163['push'](_0x562163['shift']());}};_0x551eed(++_0x264e2a);}(_0x2d17,0x17e));var _0x72d1=function(_0x1080b1,_0x966ac6){_0x1080b1=_0x1080b1-0x0;var _0x542181=_0x2d17[_0x1080b1];return _0x542181;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 23c3532..4a4ad6c 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 _0xc7a3=['show','/:id/messages','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','update','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x4176cc,_0x35766d){_0x4176cc=_0x4176cc-0x0;var _0x4e5532=_0xc7a3[_0x4176cc];return _0x4e5532;};'use strict';var multer=require('multer');var util=require(_0x3c7a('0x0'));var path=require(_0x3c7a('0x1'));var timeout=require(_0x3c7a('0x2'));var express=require(_0x3c7a('0x3'));var router=express[_0x3c7a('0x4')]();var fs_extra=require(_0x3c7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x3c7a('0x8')]('/',auth[_0x3c7a('0x9')](),controller[_0x3c7a('0xa')]);router['get'](_0x3c7a('0xb'),auth['isAuthenticated'](),controller[_0x3c7a('0xc')]);router['get'](_0x3c7a('0xd'),auth[_0x3c7a('0x9')](),controller[_0x3c7a('0xe')]);router['get'](_0x3c7a('0xf'),auth[_0x3c7a('0x9')](),controller['getMessages']);router[_0x3c7a('0x8')]('/:id/download',auth[_0x3c7a('0x9')](),controller['download']);router[_0x3c7a('0x10')]('/',auth[_0x3c7a('0x9')](),controller[_0x3c7a('0x11')]);router[_0x3c7a('0x10')](_0x3c7a('0xf'),auth['isAuthenticated'](),controller[_0x3c7a('0x12')]);router[_0x3c7a('0x10')](_0x3c7a('0x13'),auth[_0x3c7a('0x9')](),interaction[_0x3c7a('0x14')]('whatsapp',_0x3c7a('0x15')),controller[_0x3c7a('0x16')]);router['put']('/:id',auth[_0x3c7a('0x9')](),interaction[_0x3c7a('0x14')](_0x3c7a('0x17'),'whatsappinteraction:update'),controller[_0x3c7a('0x18')]);router['delete'](_0x3c7a('0xd'),auth[_0x3c7a('0x9')](),interaction[_0x3c7a('0x14')](_0x3c7a('0x17'),_0x3c7a('0x19')),controller[_0x3c7a('0x1a')]);router['delete'](_0x3c7a('0x13'),auth[_0x3c7a('0x9')](),controller[_0x3c7a('0x1b')]);module[_0x3c7a('0x1c')]=router; \ No newline at end of file +var _0x8d0a=['whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','whatsapp'];(function(_0x22aabe,_0x1667d4){var _0x7ae05=function(_0x3c3440){while(--_0x3c3440){_0x22aabe['push'](_0x22aabe['shift']());}};_0x7ae05(++_0x1667d4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x5d41b7,_0x275630){_0x5d41b7=_0x5d41b7-0x0;var _0x755243=_0x8d0a[_0x5d41b7];return _0x755243;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['describe']);router['get'](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),controller['show']);router['get']('/:id/messages',auth[_0xa8d0('0xa')](),controller['getMessages']);router[_0xa8d0('0xc')](_0xa8d0('0xf'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);router[_0xa8d0('0x11')]('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x12')]);router[_0xa8d0('0x11')](_0xa8d0('0x13'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x14')]);router['post'](_0xa8d0('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xa8d0('0x16'),_0xa8d0('0x17')),controller['addTags']);router[_0xa8d0('0x18')](_0xa8d0('0xe'),auth[_0xa8d0('0xa')](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),_0xa8d0('0x1a')),controller['update']);router[_0xa8d0('0x1b')](_0xa8d0('0xe'),auth['isAuthenticated'](),interaction[_0xa8d0('0x19')](_0xa8d0('0x16'),'whatsappinteraction:destroy'),controller[_0xa8d0('0x1c')]);router[_0xa8d0('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa8d0('0x1d')]);module[_0xa8d0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 8ba4084..f8a6660 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 _0x56c8=['moment','exports','BOOLEAN','STRING','ENUM','out','DATE','sequelize'];(function(_0x55595e,_0x3de1f2){var _0x36e1c2=function(_0x272dbd){while(--_0x272dbd){_0x55595e['push'](_0x55595e['shift']());}};_0x36e1c2(++_0x3de1f2);}(_0x56c8,0x12f));var _0x856c=function(_0x3d4860,_0x15c37e){_0x3d4860=_0x3d4860-0x0;var _0x12519a=_0x56c8[_0x3d4860];return _0x12519a;};'use strict';var Sequelize=require(_0x856c('0x0'));var moment=require(_0x856c('0x1'));module[_0x856c('0x2')]={'closed':{'type':Sequelize[_0x856c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x856c('0x4')]},'secondDisposition':{'type':Sequelize[_0x856c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x856c('0x4')]},'note':{'type':Sequelize[_0x856c('0x4')]},'phone':{'type':Sequelize[_0x856c('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x856c('0x5')]('in',_0x856c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x856c('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x856c('0x5')]('in',_0x856c('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x856c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3cae=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x5e753f,_0x460beb){var _0x59abbb=function(_0xff4437){while(--_0xff4437){_0x5e753f['push'](_0x5e753f['shift']());}};_0x59abbb(++_0x460beb);}(_0x3cae,0x117));var _0xe3ca=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x3cae[_0x480bc8];return _0x28c245;};'use strict';var Sequelize=require(_0xe3ca('0x0'));var moment=require(_0xe3ca('0x1'));module[_0xe3ca('0x2')]={'closed':{'type':Sequelize[_0xe3ca('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe3ca('0x4')]},'disposition':{'type':Sequelize[_0xe3ca('0x5')]},'secondDisposition':{'type':Sequelize[_0xe3ca('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe3ca('0x5')]},'phone':{'type':Sequelize[_0xe3ca('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe3ca('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe3ca('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe3ca('0x6')]('in',_0xe3ca('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe3ca('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ee6a771..a7a200d 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 _0xd65c=['pipe','direction','out','value','views','downloadInteraction.ejs','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','map','WhatsappInteraction','fieldName','type','key','findAll','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','where','pick','WhatsappInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','createdAt','read','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','format','closed','closedAt','Messages','basename','existsSync'];(function(_0x1a6c7f,_0x5aee3f){var _0x1d378d=function(_0x3faee3){while(--_0x3faee3){_0x1a6c7f['push'](_0x1a6c7f['shift']());}};_0x1d378d(++_0x5aee3f);}(_0xd65c,0x177));var _0xcd65=function(_0x5e0092,_0x4ad55b){_0x5e0092=_0x5e0092-0x0;var _0x367956=_0xd65c[_0x5e0092];return _0x367956;};'use strict';var rimraf=require(_0xcd65('0x0'));var zipdir=require(_0xcd65('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xcd65('0x2'));var path=require(_0xcd65('0x3'));var ejs=require(_0xcd65('0x4'));var fs=require('fs');var _=require(_0xcd65('0x5'));var Redis=require(_0xcd65('0x6'));var interaction=require(_0xcd65('0x7'));var qs=require(_0xcd65('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xcd65('0x9'))('api');var config=require(_0xcd65('0xa'));var db=require(_0xcd65('0xb'))['db'];config[_0xcd65('0xc')]=_[_0xcd65('0xd')](config['redis'],{'host':_0xcd65('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd65('0xc')]));require('./whatsappInteraction.socket')[_0xcd65('0xf')](socket);function respondWithStatusCode(_0x1ea700,_0x39c45e){_0x39c45e=_0x39c45e||0xcc;return function(_0x142259){if(_0x142259){return _0x1ea700['sendStatus'](_0x39c45e);}return _0x1ea700[_0xcd65('0x10')](_0x39c45e)[_0xcd65('0x11')]();};}function respondWithResult(_0x4f1be6,_0x252923){_0x252923=_0x252923||0xc8;return function(_0x210c77){if(_0x210c77){return _0x4f1be6[_0xcd65('0x10')](_0x252923)['json'](_0x210c77);}};}function respondWithFilteredResult(_0x55e8f2,_0x1ddb87){return function(_0x2215d5){if(_0x2215d5){var _0x10f99d=typeof _0x1ddb87[_0xcd65('0x12')]===_0xcd65('0x13')&&typeof _0x1ddb87[_0xcd65('0x14')]===_0xcd65('0x13');var _0x91c997=_0x2215d5[_0xcd65('0x15')];var _0x5c1c12=_0x10f99d?0x0:_0x1ddb87['offset'];var _0x414297=_0x10f99d?_0x2215d5[_0xcd65('0x15')]:_0x1ddb87[_0xcd65('0x12')]+_0x1ddb87[_0xcd65('0x14')];var _0x299104;if(_0x414297>=_0x91c997){_0x414297=_0x91c997;_0x299104=0xc8;}else{_0x299104=0xce;}_0x55e8f2[_0xcd65('0x10')](_0x299104);return _0x55e8f2[_0xcd65('0x16')](_0xcd65('0x17'),_0x5c1c12+'-'+_0x414297+'/'+_0x91c997)[_0xcd65('0x18')](_0x2215d5);}return null;};}function saveUpdates(_0x28c9){return function(_0x46ef67){if(_0x46ef67){return _0x46ef67['update'](_0x28c9)[_0xcd65('0x19')](function(_0x27dbd8){return _0x27dbd8;});}return null;};}function removeEntity(_0x46f15f){return function(_0x407fa0){if(_0x407fa0){return _0x407fa0[_0xcd65('0x1a')]()[_0xcd65('0x19')](function(){_0x46f15f[_0xcd65('0x10')](0xcc)[_0xcd65('0x11')]();});}};}function handleEntityNotFound(_0x6bc064){return function(_0x4f151c){if(!_0x4f151c){_0x6bc064[_0xcd65('0x1b')](0x194);}return _0x4f151c;};}function handleError(_0x896ccc,_0x302877){_0x302877=_0x302877||0x1f4;return function(_0x29c308){logger[_0xcd65('0x1c')](_0x29c308[_0xcd65('0x1d')]);if(_0x29c308[_0xcd65('0x1e')]){delete _0x29c308['name'];}_0x896ccc[_0xcd65('0x10')](_0x302877)[_0xcd65('0x1f')](_0x29c308);};}exports['index']=function(_0x28f790,_0x3c4478){var _0x317e87={};var _0x4d72f6=_[_0xcd65('0x20')](db[_0xcd65('0x21')]['rawAttributes'],function(_0x453d2b){return{'name':_0x453d2b[_0xcd65('0x22')],'type':_0x453d2b[_0xcd65('0x23')][_0xcd65('0x24')]};});_0x317e87=qs['getOptions'](_0x4d72f6,_0x28f790);return interaction[_0xcd65('0x25')]('whatsapp',_0x28f790['query'],_0x28f790[_0xcd65('0x26')],_0x317e87,_0x4d72f6)[_0xcd65('0x19')](respondWithFilteredResult(_0x3c4478,_0x317e87))[_0xcd65('0x27')](handleError(_0x3c4478,null));};exports[_0xcd65('0x28')]=function(_0x5e66bf,_0x40c541){var _0x231439={'raw':![],'where':{'id':_0x5e66bf[_0xcd65('0x29')]['id']}},_0x2dc213={};_0x2dc213[_0xcd65('0x2a')]=_[_0xcd65('0x2b')](db[_0xcd65('0x21')]['rawAttributes']);_0x2dc213[_0xcd65('0x2c')]=_[_0xcd65('0x2b')](_0x5e66bf[_0xcd65('0x2c')]);_0x2dc213[_0xcd65('0x2d')]=_[_0xcd65('0x2e')](_0x2dc213[_0xcd65('0x2a')],_0x2dc213[_0xcd65('0x2c')]);_0x231439[_0xcd65('0x2f')]=_[_0xcd65('0x2e')](_0x2dc213[_0xcd65('0x2a')],qs[_0xcd65('0x30')](_0x5e66bf[_0xcd65('0x2c')][_0xcd65('0x30')]));_0x231439[_0xcd65('0x2f')]=_0x231439[_0xcd65('0x2f')][_0xcd65('0x31')]?_0x231439['attributes']:_0x2dc213['model'];if(_0x5e66bf['query']['includeAll']){_0x231439[_0xcd65('0x32')]=[{'all':!![]}];}_0x231439=_[_0xcd65('0x33')]({},_0x231439,_0x5e66bf[_0xcd65('0x34')]);return db[_0xcd65('0x21')][_0xcd65('0x35')](_0x231439)[_0xcd65('0x19')](handleEntityNotFound(_0x40c541,null))['then'](respondWithResult(_0x40c541,null))[_0xcd65('0x27')](handleError(_0x40c541,null));};exports[_0xcd65('0x36')]=function(_0xf40995,_0x3a3dfd){return db[_0xcd65('0x21')][_0xcd65('0x36')](_0xf40995[_0xcd65('0x37')],{})[_0xcd65('0x19')](respondWithResult(_0x3a3dfd,0xc9))[_0xcd65('0x27')](handleError(_0x3a3dfd,null));};exports[_0xcd65('0x38')]=function(_0x32b8e9,_0x65413e){if(_0x32b8e9['body']['id']){delete _0x32b8e9[_0xcd65('0x37')]['id'];}return db[_0xcd65('0x21')][_0xcd65('0x35')]({'where':{'id':_0x32b8e9[_0xcd65('0x29')]['id']}})[_0xcd65('0x19')](handleEntityNotFound(_0x65413e,null))['then'](saveUpdates(_0x32b8e9[_0xcd65('0x37')],null))[_0xcd65('0x19')](respondWithResult(_0x65413e,null))[_0xcd65('0x27')](handleError(_0x65413e,null));};exports['destroy']=function(_0x156944,_0xf7ac18){return db[_0xcd65('0x21')]['find']({'where':{'id':_0x156944['params']['id']}})[_0xcd65('0x19')](handleEntityNotFound(_0xf7ac18,null))['then'](removeEntity(_0xf7ac18,null))[_0xcd65('0x27')](handleError(_0xf7ac18,null));};exports[_0xcd65('0x39')]=function(_0x306c2f,_0x39d834){return db[_0xcd65('0x21')][_0xcd65('0x39')]()[_0xcd65('0x19')](respondWithResult(_0x39d834,null))['catch'](handleError(_0x39d834,null));};exports[_0xcd65('0x3a')]=function(_0x1b4dac,_0x2d8a62){return db[_0xcd65('0x3b')][_0xcd65('0x35')]({'where':{'id':_0x1b4dac['params']['id']}})[_0xcd65('0x19')](handleEntityNotFound(_0x2d8a62,null))['then'](function(_0x18ba4f){if(_0x18ba4f){return _0x18ba4f['addMessage'](_0x1b4dac[_0xcd65('0x37')][_0xcd65('0x3c')],_[_0xcd65('0x3d')](_0x1b4dac['body'],[_0xcd65('0x3c'),'id'])||{});}})[_0xcd65('0x19')](respondWithResult(_0x2d8a62,null))['catch'](handleError(_0x2d8a62,null));};exports[_0xcd65('0x3e')]=function(_0x4437fc,_0xc77c67){var _0x70d5c7={'raw':![],'where':{}};var _0xac1382={};var _0x17b868={'count':0x0,'rows':[]};return db[_0xcd65('0x21')][_0xcd65('0x3f')]({'where':{'id':_0x4437fc[_0xcd65('0x29')]['id']}})[_0xcd65('0x19')](handleEntityNotFound(_0xc77c67,null))[_0xcd65('0x19')](function(_0x47e024){if(_0x47e024){_0xac1382[_0xcd65('0x2a')]=_[_0xcd65('0x2b')](db[_0xcd65('0x3b')][_0xcd65('0x40')]);_0xac1382[_0xcd65('0x2c')]=_[_0xcd65('0x2b')](_0x4437fc[_0xcd65('0x2c')]);_0xac1382['filters']=_[_0xcd65('0x2e')](_0xac1382[_0xcd65('0x2a')],_0xac1382[_0xcd65('0x2c')]);_0x70d5c7['attributes']=_[_0xcd65('0x2e')](_0xac1382['model'],qs[_0xcd65('0x30')](_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x30')]));_0x70d5c7[_0xcd65('0x2f')]=_0x70d5c7[_0xcd65('0x2f')]['length']?_0x70d5c7[_0xcd65('0x2f')]:_0xac1382[_0xcd65('0x2a')];if(!_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x41')](_0xcd65('0x42'))){_0x70d5c7['limit']=qs['limit'](_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x14')]);_0x70d5c7[_0xcd65('0x12')]=qs[_0xcd65('0x12')](_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x12')]);}_0x70d5c7[_0xcd65('0x43')]=qs['sort'](_0x4437fc[_0xcd65('0x2c')]['sort']);_0x70d5c7[_0xcd65('0x44')]=qs['filters'](_[_0xcd65('0x45')](_0x4437fc['query'],_0xac1382[_0xcd65('0x2d')]));_0x70d5c7[_0xcd65('0x44')][_0xcd65('0x46')]=_0x47e024['id'];if(_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x47')]){_0x70d5c7[_0xcd65('0x44')]=_[_0xcd65('0x33')](_0x70d5c7['where'],{'$or':_[_0xcd65('0x20')](_0x70d5c7['attributes'],function(_0x122999){var _0x5dda0d={};_0x5dda0d[_0x122999]={'$like':'%'+_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x47')]+'%'};return _0x5dda0d;})});}if(_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x48')]){var _0x5db821=_0x4437fc['query']['$gte']['split'](',');var _0x2c1f84={};_0x2c1f84[_0x5db821[0x0]]={'$gte':moment(_0x5db821[0x1])['format'](_0xcd65('0x49'))};_0x70d5c7[_0xcd65('0x44')]=_[_0xcd65('0x33')](_0x70d5c7[_0xcd65('0x44')],_0x2c1f84);}_0x70d5c7=_['merge']({},_0x70d5c7,_0x4437fc[_0xcd65('0x34')]);return db[_0xcd65('0x3b')][_0xcd65('0x15')]({'where':_0x70d5c7[_0xcd65('0x44')]})[_0xcd65('0x19')](function(_0x41df9a){_0x17b868[_0xcd65('0x15')]=_0x41df9a;if(_0x4437fc[_0xcd65('0x2c')][_0xcd65('0x4a')]){_0x70d5c7[_0xcd65('0x32')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xcd65('0x25')](_0x70d5c7);})[_0xcd65('0x19')](function(_0x4d9c0d){_0x17b868[_0xcd65('0x4b')]=_0x4d9c0d;return _0x17b868;});}})[_0xcd65('0x19')](respondWithFilteredResult(_0xc77c67,_0x70d5c7))['catch'](handleError(_0xc77c67,null));};exports[_0xcd65('0x4c')]=function(_0x5cdd57,_0x32f245){return db[_0xcd65('0x21')][_0xcd65('0x35')]({'where':{'id':_0x5cdd57[_0xcd65('0x29')]['id']}})['then'](handleEntityNotFound(_0x32f245,null))[_0xcd65('0x19')](function(_0xd8056b){if(_0xd8056b){return _0xd8056b[_0xcd65('0x4d')](_0x5cdd57[_0xcd65('0x37')]['ids'],_['omit'](_0x5cdd57[_0xcd65('0x37')],['ids','id'])||{})[_0xcd65('0x4e')](function(){return db[_0xcd65('0x4f')]['findAll']({'attributes':['id',_0xcd65('0x1e'),'color'],'where':{'id':_0x5cdd57[_0xcd65('0x37')][_0xcd65('0x3c')]}});})[_0xcd65('0x19')](function(_0x5b6f87){socket[_0xcd65('0x50')](_0xcd65('0x51'),{'id':Number(_0x5cdd57[_0xcd65('0x29')]['id']),'tags':_0x5b6f87||[]});return{'id':Number(_0x5cdd57[_0xcd65('0x29')]['id']),'tags':_0x5b6f87||[]};});}})[_0xcd65('0x19')](respondWithResult(_0x32f245,null))[_0xcd65('0x27')](handleError(_0x32f245,null));};exports[_0xcd65('0x52')]=function(_0x216b60,_0x2bdc3a){return db[_0xcd65('0x21')][_0xcd65('0x35')]({'where':{'id':_0x216b60['params']['id']}})['then'](handleEntityNotFound(_0x2bdc3a,null))[_0xcd65('0x19')](function(_0x41d5d5){if(_0x41d5d5){return _0x41d5d5[_0xcd65('0x52')](_0x216b60[_0xcd65('0x2c')][_0xcd65('0x3c')]);}})[_0xcd65('0x19')](respondWithStatusCode(_0x2bdc3a,null))[_0xcd65('0x27')](handleError(_0x2bdc3a,null));};exports[_0xcd65('0x53')]=function(_0x539409,_0x4ae791){var _0x4363cc=moment()['unix']()[_0xcd65('0x54')]();var _0x554def=path[_0xcd65('0x55')](config[_0xcd65('0x56')],_0xcd65('0x57'),_0xcd65('0x58'),_0xcd65('0x59'));var _0x48cc4a=path['join'](config[_0xcd65('0x56')],_0xcd65('0x57'),_0xcd65('0x58'),_0xcd65('0x5a'));var _0x2dffe4=path[_0xcd65('0x55')](_0x554def,_0x4363cc);var _0x13debe=util['format'](_0xcd65('0x5b'),_0x539409[_0xcd65('0x29')]['id'],_0x4363cc);var _0xdda38e=path['join'](_0x554def,_0x13debe);var _0x5a85a6=[];_0x5a85a6[_0xcd65('0x5c')]({'model':db[_0xcd65('0x5d')],'as':_0xcd65('0x5d'),'attributes':['id',_0xcd65('0x5e')],'raw':!![]});_0x5a85a6['push']({'model':db['CmContact'],'as':_0xcd65('0x5f'),'attributes':['id',_0xcd65('0x60'),_0xcd65('0x61')],'raw':!![]});if(_0x539409[_0xcd65('0x2c')][_0xcd65('0x5a')]){_0x5a85a6['push']({'model':db[_0xcd65('0x62')],'as':_0xcd65('0x62'),'raw':!![]});}var _0x22d255=[{'model':db[_0xcd65('0x3b')],'as':'Messages','attributes':['id','body',_0xcd65('0x63'),'direction','secret',_0xcd65('0x64')],'include':_0x5a85a6}];_0x22d255['push']({'model':db[_0xcd65('0x65')],'as':_0xcd65('0x66'),'attributes':['id',_0xcd65('0x1e')]});_0x22d255[_0xcd65('0x5c')]({'model':db['User'],'as':_0xcd65('0x67'),'attributes':['id',_0xcd65('0x5e')]});return db['WhatsappInteraction'][_0xcd65('0x35')]({'where':{'id':_0x539409[_0xcd65('0x29')]['id']},'include':_0x22d255})[_0xcd65('0x19')](handleEntityNotFound(_0x4ae791,null))[_0xcd65('0x19')](function(_0x50cb13){if(_0x50cb13){var _0x3d721c=_0x50cb13[_0xcd65('0x68')]({'plain':!![]});fs['mkdirSync'](_0x2dffe4);var _0x354dea={'channel':_0xcd65('0x69'),'account':_0x3d721c[_0xcd65('0x66')][_0xcd65('0x1e')],'agent':_0x3d721c[_0xcd65('0x67')]?_0x3d721c[_0xcd65('0x67')][_0xcd65('0x5e')]:_0xcd65('0x6a'),'createdAt':moment(_0x3d721c[_0xcd65('0x63')])[_0xcd65('0x6b')](_0xcd65('0x49'))[_0xcd65('0x54')](),'closedAt':_0x3d721c[_0xcd65('0x6c')]?moment(_0x3d721c[_0xcd65('0x6d')])[_0xcd65('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3d721c['disposition'],'messages':_(_0x3d721c[_0xcd65('0x6e')])[_0xcd65('0x47')]({'secret':![]})[_0xcd65('0x20')](function(_0x43ea40){if(_0x43ea40[_0xcd65('0x62')]){var _0xcafe8a=path[_0xcd65('0x55')](_0x48cc4a,_0x43ea40[_0xcd65('0x62')][_0xcd65('0x6f')]);if(fs[_0xcd65('0x70')](_0xcafe8a)){fs['createReadStream'](_0xcafe8a)[_0xcd65('0x71')](fs['createWriteStream'](path[_0xcd65('0x55')](_0x2dffe4,_0x43ea40[_0xcd65('0x62')][_0xcd65('0x6f')])));}}return{'date':moment(_0x43ea40[_0xcd65('0x63')])[_0xcd65('0x6b')](_0xcd65('0x49'))[_0xcd65('0x54')](),'sender':_0x43ea40[_0xcd65('0x72')]===_0xcd65('0x73')?_0x43ea40[_0xcd65('0x5d')]?_0x43ea40[_0xcd65('0x5d')][_0xcd65('0x5e')]:'System':_0x43ea40['Contact'][_0xcd65('0x60')]+(_0x43ea40[_0xcd65('0x5f')][_0xcd65('0x61')]?'\x20'+_0x43ea40[_0xcd65('0x5f')][_0xcd65('0x61')]:''),'body':_0x43ea40['Attachment']?_0x43ea40[_0xcd65('0x62')][_0xcd65('0x6f')]:_0x43ea40['body'],'direction':_0x43ea40['direction']===_0xcd65('0x73')?'A':'C','secret':_0x43ea40['secret'],'read':_0x43ea40[_0xcd65('0x64')],'attachment':_0x43ea40['Attachment']};})[_0xcd65('0x74')]()};return ejs['renderFile'](path['join'](config[_0xcd65('0x56')],_0xcd65('0x57'),_0xcd65('0x75'),_0xcd65('0x76')),{'interaction':_0x354dea})['then'](function(_0x3cbd9b){var _0x11ebe2=path[_0xcd65('0x55')](_0x2dffe4,'transcript-'+_0x3d721c['id']+'-'+_0x4363cc+'.pdf');var _0x5e2dcc={'path':_0x11ebe2,'channel':'Whatsapp','interactionId':_0x3d721c['id']};return pdf[_0xcd65('0x77')](_0x3cbd9b,_0x5e2dcc);})[_0xcd65('0x19')](function(){return new BPromise(function(_0x11bdff,_0x1bf045){zipdir(_0x2dffe4,{'saveTo':_0xdda38e},function(_0x305c8f,_0x17ca57){if(_0x305c8f)return _0x1bf045(_0x305c8f);return _0x11bdff(_0x17ca57);});})[_0xcd65('0x19')](function(){return new BPromise(function(_0x1dd722,_0x5056d8){rimraf(_0x2dffe4,function(_0x2323de){if(_0x2323de)_0x5056d8(_0x2323de);return _0x1dd722();});});})[_0xcd65('0x19')](function(){return _0x4ae791['download'](_0xdda38e,_0x13debe,function(_0x548d68){if(_0x548d68){console[_0xcd65('0x78')]('err',_0x548d68);}else{fs[_0xcd65('0x79')](_0xdda38e);}});});});}else{return _0x4ae791[_0xcd65('0x1b')](0xc8);}})[_0xcd65('0x27')](handleError(_0x4ae791,null));}; \ No newline at end of file +var _0xd0cd=['offset','undefined','count','limit','Content-Range','update','then','destroy','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','catch','describe','addMessage','WhatsappMessage','params','ids','omit','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','rows','addTags','setTags','Tag','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','format','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','Owner','get','mkdirSync','Whatsapp','Account','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','toString','disposition','existsSync','createReadStream','createWriteStream','basename','direction','out','System','read','value','views','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xd0cd,0xe7));var _0xdd0c=function(_0x3c6456,_0x3be8db){_0x3c6456=_0x3c6456-0x0;var _0x258853=_0xd0cd[_0x3c6456];return _0x258853;};'use strict';var rimraf=require(_0xdd0c('0x0'));var zipdir=require(_0xdd0c('0x1'));var moment=require(_0xdd0c('0x2'));var BPromise=require(_0xdd0c('0x3'));var util=require('util');var path=require(_0xdd0c('0x4'));var ejs=require(_0xdd0c('0x5'));var fs=require('fs');var _=require(_0xdd0c('0x6'));var Redis=require(_0xdd0c('0x7'));var interaction=require(_0xdd0c('0x8'));var qs=require(_0xdd0c('0x9'));var pdf=require(_0xdd0c('0xa'));var logger=require(_0xdd0c('0xb'))('api');var config=require('../../config/environment');var db=require(_0xdd0c('0xc'))['db'];config[_0xdd0c('0xd')]=_[_0xdd0c('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdd0c('0xf'))(new Redis(config[_0xdd0c('0xd')]));require(_0xdd0c('0x10'))['register'](socket);function respondWithStatusCode(_0x135571,_0x36660f){_0x36660f=_0x36660f||0xcc;return function(_0x478fbc){if(_0x478fbc){return _0x135571[_0xdd0c('0x11')](_0x36660f);}return _0x135571[_0xdd0c('0x12')](_0x36660f)[_0xdd0c('0x13')]();};}function respondWithResult(_0x25e9eb,_0x567962){_0x567962=_0x567962||0xc8;return function(_0x17d9b7){if(_0x17d9b7){return _0x25e9eb[_0xdd0c('0x12')](_0x567962)[_0xdd0c('0x14')](_0x17d9b7);}};}function respondWithFilteredResult(_0x35cfca,_0x42379b){return function(_0x50f6e5){if(_0x50f6e5){var _0x830e43=typeof _0x42379b[_0xdd0c('0x15')]===_0xdd0c('0x16')&&typeof _0x42379b['limit']===_0xdd0c('0x16');var _0x5b3ae6=_0x50f6e5[_0xdd0c('0x17')];var _0x206f1c=_0x830e43?0x0:_0x42379b[_0xdd0c('0x15')];var _0x5c05e1=_0x830e43?_0x50f6e5['count']:_0x42379b['offset']+_0x42379b[_0xdd0c('0x18')];var _0x151844;if(_0x5c05e1>=_0x5b3ae6){_0x5c05e1=_0x5b3ae6;_0x151844=0xc8;}else{_0x151844=0xce;}_0x35cfca[_0xdd0c('0x12')](_0x151844);return _0x35cfca['set'](_0xdd0c('0x19'),_0x206f1c+'-'+_0x5c05e1+'/'+_0x5b3ae6)[_0xdd0c('0x14')](_0x50f6e5);}return null;};}function saveUpdates(_0x1c959b){return function(_0x27d5ab){if(_0x27d5ab){return _0x27d5ab[_0xdd0c('0x1a')](_0x1c959b)[_0xdd0c('0x1b')](function(_0x1362a0){return _0x1362a0;});}return null;};}function removeEntity(_0x2ae969){return function(_0x3a9997){if(_0x3a9997){return _0x3a9997[_0xdd0c('0x1c')]()[_0xdd0c('0x1b')](function(){_0x2ae969[_0xdd0c('0x12')](0xcc)[_0xdd0c('0x13')]();});}};}function handleEntityNotFound(_0x4fd59c){return function(_0x3b5de9){if(!_0x3b5de9){_0x4fd59c[_0xdd0c('0x11')](0x194);}return _0x3b5de9;};}function handleError(_0x5c0f08,_0x4d46a1){_0x4d46a1=_0x4d46a1||0x1f4;return function(_0x3a8bb0){logger['error'](_0x3a8bb0[_0xdd0c('0x1d')]);if(_0x3a8bb0[_0xdd0c('0x1e')]){delete _0x3a8bb0[_0xdd0c('0x1e')];}_0x5c0f08['status'](_0x4d46a1)['send'](_0x3a8bb0);};}exports[_0xdd0c('0x1f')]=function(_0x3eff30,_0x568b0f){var _0x195988={};var _0xae0ee1=_[_0xdd0c('0x20')](db[_0xdd0c('0x21')][_0xdd0c('0x22')],function(_0x4bf380){return{'name':_0x4bf380[_0xdd0c('0x23')],'type':_0x4bf380[_0xdd0c('0x24')][_0xdd0c('0x25')]};});_0x195988=qs[_0xdd0c('0x26')](_0xae0ee1,_0x3eff30);return interaction[_0xdd0c('0x27')](_0xdd0c('0x28'),_0x3eff30[_0xdd0c('0x29')],_0x3eff30[_0xdd0c('0x2a')],_0x195988,_0xae0ee1)[_0xdd0c('0x1b')](respondWithFilteredResult(_0x568b0f,_0x195988))['catch'](handleError(_0x568b0f,null));};exports['show']=function(_0xe91a4f,_0x49e480){var _0x13b18f={'raw':![],'where':{'id':_0xe91a4f['params']['id']}},_0x13d80e={};_0x13d80e[_0xdd0c('0x2b')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x13d80e[_0xdd0c('0x29')]=_[_0xdd0c('0x2c')](_0xe91a4f[_0xdd0c('0x29')]);_0x13d80e[_0xdd0c('0x2d')]=_[_0xdd0c('0x2e')](_0x13d80e[_0xdd0c('0x2b')],_0x13d80e[_0xdd0c('0x29')]);_0x13b18f[_0xdd0c('0x2f')]=_[_0xdd0c('0x2e')](_0x13d80e[_0xdd0c('0x2b')],qs[_0xdd0c('0x30')](_0xe91a4f[_0xdd0c('0x29')][_0xdd0c('0x30')]));_0x13b18f[_0xdd0c('0x2f')]=_0x13b18f[_0xdd0c('0x2f')][_0xdd0c('0x31')]?_0x13b18f['attributes']:_0x13d80e['model'];if(_0xe91a4f[_0xdd0c('0x29')][_0xdd0c('0x32')]){_0x13b18f[_0xdd0c('0x33')]=[{'all':!![]}];}_0x13b18f=_[_0xdd0c('0x34')]({},_0x13b18f,_0xe91a4f[_0xdd0c('0x35')]);return db['WhatsappInteraction'][_0xdd0c('0x36')](_0x13b18f)[_0xdd0c('0x1b')](handleEntityNotFound(_0x49e480,null))[_0xdd0c('0x1b')](respondWithResult(_0x49e480,null))['catch'](handleError(_0x49e480,null));};exports[_0xdd0c('0x37')]=function(_0x2e4e79,_0xa38e06){return db['WhatsappInteraction']['create'](_0x2e4e79[_0xdd0c('0x38')],{})['then'](respondWithResult(_0xa38e06,0xc9))[_0xdd0c('0x39')](handleError(_0xa38e06,null));};exports[_0xdd0c('0x1a')]=function(_0x5aa213,_0x224a5a){if(_0x5aa213[_0xdd0c('0x38')]['id']){delete _0x5aa213['body']['id'];}return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x5aa213['params']['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x224a5a,null))[_0xdd0c('0x1b')](saveUpdates(_0x5aa213['body'],null))[_0xdd0c('0x1b')](respondWithResult(_0x224a5a,null))[_0xdd0c('0x39')](handleError(_0x224a5a,null));};exports[_0xdd0c('0x1c')]=function(_0x266bab,_0x3477c7){return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x266bab['params']['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x3477c7,null))['then'](removeEntity(_0x3477c7,null))[_0xdd0c('0x39')](handleError(_0x3477c7,null));};exports[_0xdd0c('0x3a')]=function(_0xe1e84b,_0x27b607){return db[_0xdd0c('0x21')][_0xdd0c('0x3a')]()[_0xdd0c('0x1b')](respondWithResult(_0x27b607,null))[_0xdd0c('0x39')](handleError(_0x27b607,null));};exports[_0xdd0c('0x3b')]=function(_0x3d806e,_0x3972f9){return db[_0xdd0c('0x3c')]['find']({'where':{'id':_0x3d806e[_0xdd0c('0x3d')]['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x3972f9,null))['then'](function(_0x54080a){if(_0x54080a){return _0x54080a[_0xdd0c('0x3b')](_0x3d806e[_0xdd0c('0x38')][_0xdd0c('0x3e')],_[_0xdd0c('0x3f')](_0x3d806e[_0xdd0c('0x38')],[_0xdd0c('0x3e'),'id'])||{});}})[_0xdd0c('0x1b')](respondWithResult(_0x3972f9,null))[_0xdd0c('0x39')](handleError(_0x3972f9,null));};exports['getMessages']=function(_0x30d596,_0x8fdbb7){var _0x20c76b={'raw':![],'where':{}};var _0xf877d8={};var _0x2d140b={'count':0x0,'rows':[]};return db[_0xdd0c('0x21')]['findOne']({'where':{'id':_0x30d596[_0xdd0c('0x3d')]['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x8fdbb7,null))[_0xdd0c('0x1b')](function(_0x5e84d2){if(_0x5e84d2){_0xf877d8[_0xdd0c('0x2b')]=_[_0xdd0c('0x2c')](db[_0xdd0c('0x3c')][_0xdd0c('0x22')]);_0xf877d8[_0xdd0c('0x29')]=_[_0xdd0c('0x2c')](_0x30d596['query']);_0xf877d8[_0xdd0c('0x2d')]=_['intersection'](_0xf877d8[_0xdd0c('0x2b')],_0xf877d8['query']);_0x20c76b[_0xdd0c('0x2f')]=_[_0xdd0c('0x2e')](_0xf877d8[_0xdd0c('0x2b')],qs[_0xdd0c('0x30')](_0x30d596[_0xdd0c('0x29')]['fields']));_0x20c76b[_0xdd0c('0x2f')]=_0x20c76b['attributes'][_0xdd0c('0x31')]?_0x20c76b['attributes']:_0xf877d8[_0xdd0c('0x2b')];if(!_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x40')](_0xdd0c('0x41'))){_0x20c76b['limit']=qs['limit'](_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x18')]);_0x20c76b[_0xdd0c('0x15')]=qs[_0xdd0c('0x15')](_0x30d596['query'][_0xdd0c('0x15')]);}_0x20c76b[_0xdd0c('0x42')]=qs['sort'](_0x30d596['query'][_0xdd0c('0x43')]);_0x20c76b[_0xdd0c('0x44')]=qs[_0xdd0c('0x2d')](_['pick'](_0x30d596[_0xdd0c('0x29')],_0xf877d8[_0xdd0c('0x2d')]));_0x20c76b['where'][_0xdd0c('0x45')]=_0x5e84d2['id'];if(_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x46')]){_0x20c76b[_0xdd0c('0x44')]=_['merge'](_0x20c76b[_0xdd0c('0x44')],{'$or':_['map'](_0x20c76b[_0xdd0c('0x2f')],function(_0x1c4c5d){var _0x1a01f7={};_0x1a01f7[_0x1c4c5d]={'$like':'%'+_0x30d596['query'][_0xdd0c('0x46')]+'%'};return _0x1a01f7;})});}if(_0x30d596['query'][_0xdd0c('0x47')]){var _0x3a3110=_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x47')][_0xdd0c('0x48')](',');var _0x417fa9={};_0x417fa9[_0x3a3110[0x0]]={'$gte':moment(_0x3a3110[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x20c76b['where']=_[_0xdd0c('0x34')](_0x20c76b[_0xdd0c('0x44')],_0x417fa9);}_0x20c76b=_['merge']({},_0x20c76b,_0x30d596[_0xdd0c('0x35')]);return db['WhatsappMessage'][_0xdd0c('0x17')]({'where':_0x20c76b[_0xdd0c('0x44')]})[_0xdd0c('0x1b')](function(_0x3e8a10){_0x2d140b[_0xdd0c('0x17')]=_0x3e8a10;if(_0x30d596[_0xdd0c('0x29')][_0xdd0c('0x32')]){_0x20c76b['include']=[{'all':!![]}];}return db[_0xdd0c('0x3c')][_0xdd0c('0x27')](_0x20c76b);})['then'](function(_0xd2c98){_0x2d140b[_0xdd0c('0x49')]=_0xd2c98;return _0x2d140b;});}})[_0xdd0c('0x1b')](respondWithFilteredResult(_0x8fdbb7,_0x20c76b))[_0xdd0c('0x39')](handleError(_0x8fdbb7,null));};exports[_0xdd0c('0x4a')]=function(_0x4c3423,_0xca343c){return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x4c3423['params']['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0xca343c,null))['then'](function(_0x34e2e4){if(_0x34e2e4){return _0x34e2e4[_0xdd0c('0x4b')](_0x4c3423[_0xdd0c('0x38')][_0xdd0c('0x3e')],_[_0xdd0c('0x3f')](_0x4c3423[_0xdd0c('0x38')],[_0xdd0c('0x3e'),'id'])||{})['spread'](function(){return db[_0xdd0c('0x4c')][_0xdd0c('0x27')]({'attributes':['id','name','color'],'where':{'id':_0x4c3423['body']['ids']}});})['then'](function(_0x178577){socket[_0xdd0c('0x4d')](_0xdd0c('0x4e'),{'id':Number(_0x4c3423['params']['id']),'tags':_0x178577||[]});return{'id':Number(_0x4c3423[_0xdd0c('0x3d')]['id']),'tags':_0x178577||[]};});}})[_0xdd0c('0x1b')](respondWithResult(_0xca343c,null))[_0xdd0c('0x39')](handleError(_0xca343c,null));};exports[_0xdd0c('0x4f')]=function(_0x44d6b3,_0x4796b9){return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x44d6b3[_0xdd0c('0x3d')]['id']}})[_0xdd0c('0x1b')](handleEntityNotFound(_0x4796b9,null))[_0xdd0c('0x1b')](function(_0x5a1f8e){if(_0x5a1f8e){return _0x5a1f8e[_0xdd0c('0x4f')](_0x44d6b3[_0xdd0c('0x29')][_0xdd0c('0x3e')]);}})[_0xdd0c('0x1b')](respondWithStatusCode(_0x4796b9,null))[_0xdd0c('0x39')](handleError(_0x4796b9,null));};exports['download']=function(_0x4aaaaa,_0x32a254){var _0x1448f2=moment()[_0xdd0c('0x50')]()['toString']();var _0x1854be=path[_0xdd0c('0x51')](config[_0xdd0c('0x52')],_0xdd0c('0x53'),'files',_0xdd0c('0x54'));var _0x4431cf=path[_0xdd0c('0x51')](config['root'],_0xdd0c('0x53'),_0xdd0c('0x55'),_0xdd0c('0x56'));var _0x485b9c=path[_0xdd0c('0x51')](_0x1854be,_0x1448f2);var _0x18adb1=util[_0xdd0c('0x57')]('transcript-%d-%s.zip',_0x4aaaaa[_0xdd0c('0x3d')]['id'],_0x1448f2);var _0x477741=path[_0xdd0c('0x51')](_0x1854be,_0x18adb1);var _0x4941a4=[];_0x4941a4[_0xdd0c('0x58')]({'model':db[_0xdd0c('0x59')],'as':_0xdd0c('0x59'),'attributes':['id',_0xdd0c('0x5a')],'raw':!![]});_0x4941a4['push']({'model':db[_0xdd0c('0x5b')],'as':_0xdd0c('0x5c'),'attributes':['id',_0xdd0c('0x5d'),_0xdd0c('0x5e')],'raw':!![]});if(_0x4aaaaa[_0xdd0c('0x29')][_0xdd0c('0x56')]){_0x4941a4[_0xdd0c('0x58')]({'model':db[_0xdd0c('0x5f')],'as':_0xdd0c('0x5f'),'raw':!![]});}var _0x35d9e7=[{'model':db[_0xdd0c('0x3c')],'as':_0xdd0c('0x60'),'attributes':['id',_0xdd0c('0x38'),'createdAt','direction',_0xdd0c('0x61'),'read'],'include':_0x4941a4}];_0x35d9e7[_0xdd0c('0x58')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0xdd0c('0x1e')]});_0x35d9e7[_0xdd0c('0x58')]({'model':db[_0xdd0c('0x59')],'as':_0xdd0c('0x62'),'attributes':['id',_0xdd0c('0x5a')]});return db[_0xdd0c('0x21')][_0xdd0c('0x36')]({'where':{'id':_0x4aaaaa[_0xdd0c('0x3d')]['id']},'include':_0x35d9e7})['then'](handleEntityNotFound(_0x32a254,null))[_0xdd0c('0x1b')](function(_0x27e851){if(_0x27e851){var _0x532439=_0x27e851[_0xdd0c('0x63')]({'plain':!![]});fs[_0xdd0c('0x64')](_0x485b9c);var _0x21131a={'channel':_0xdd0c('0x65'),'account':_0x532439[_0xdd0c('0x66')][_0xdd0c('0x1e')],'agent':_0x532439['Owner']?_0x532439[_0xdd0c('0x62')]['fullname']:_0xdd0c('0x67'),'createdAt':moment(_0x532439[_0xdd0c('0x68')])['format'](_0xdd0c('0x69'))['toString'](),'closedAt':_0x532439['closed']?moment(_0x532439[_0xdd0c('0x6a')])[_0xdd0c('0x57')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdd0c('0x6b')]():'','disposition':_0x532439[_0xdd0c('0x6c')],'messages':_(_0x532439[_0xdd0c('0x60')])[_0xdd0c('0x46')]({'secret':![]})['map'](function(_0x5c70cf){if(_0x5c70cf[_0xdd0c('0x5f')]){var _0x4bd1b8=path[_0xdd0c('0x51')](_0x4431cf,_0x5c70cf[_0xdd0c('0x5f')]['basename']);if(fs[_0xdd0c('0x6d')](_0x4bd1b8)){fs[_0xdd0c('0x6e')](_0x4bd1b8)['pipe'](fs[_0xdd0c('0x6f')](path[_0xdd0c('0x51')](_0x485b9c,_0x5c70cf[_0xdd0c('0x5f')][_0xdd0c('0x70')])));}}return{'date':moment(_0x5c70cf['createdAt'])[_0xdd0c('0x57')](_0xdd0c('0x69'))[_0xdd0c('0x6b')](),'sender':_0x5c70cf[_0xdd0c('0x71')]===_0xdd0c('0x72')?_0x5c70cf[_0xdd0c('0x59')]?_0x5c70cf[_0xdd0c('0x59')][_0xdd0c('0x5a')]:_0xdd0c('0x73'):_0x5c70cf[_0xdd0c('0x5c')][_0xdd0c('0x5d')]+(_0x5c70cf[_0xdd0c('0x5c')][_0xdd0c('0x5e')]?'\x20'+_0x5c70cf[_0xdd0c('0x5c')][_0xdd0c('0x5e')]:''),'body':_0x5c70cf['Attachment']?_0x5c70cf[_0xdd0c('0x5f')][_0xdd0c('0x70')]:_0x5c70cf['body'],'direction':_0x5c70cf['direction']===_0xdd0c('0x72')?'A':'C','secret':_0x5c70cf['secret'],'read':_0x5c70cf[_0xdd0c('0x74')],'attachment':_0x5c70cf['Attachment']};})[_0xdd0c('0x75')]()};return ejs['renderFile'](path[_0xdd0c('0x51')](config[_0xdd0c('0x52')],_0xdd0c('0x53'),_0xdd0c('0x76'),'downloadInteraction.ejs'),{'interaction':_0x21131a})['then'](function(_0xbe0809){var _0x42b8e1=path[_0xdd0c('0x51')](_0x485b9c,_0xdd0c('0x77')+_0x532439['id']+'-'+_0x1448f2+_0xdd0c('0x78'));var _0x226b3e={'path':_0x42b8e1,'channel':_0xdd0c('0x65'),'interactionId':_0x532439['id']};return pdf[_0xdd0c('0x79')](_0xbe0809,_0x226b3e);})[_0xdd0c('0x1b')](function(){return new BPromise(function(_0x38ebf2,_0x4ce568){zipdir(_0x485b9c,{'saveTo':_0x477741},function(_0xb5a7f5,_0x5dd5a9){if(_0xb5a7f5)return _0x4ce568(_0xb5a7f5);return _0x38ebf2(_0x5dd5a9);});})[_0xdd0c('0x1b')](function(){return new BPromise(function(_0x3f7aaa,_0x466f1d){rimraf(_0x485b9c,function(_0x4ba87d){if(_0x4ba87d)_0x466f1d(_0x4ba87d);return _0x3f7aaa();});});})['then'](function(){return _0x32a254[_0xdd0c('0x7a')](_0x477741,_0x18adb1,function(_0x282f65){if(_0x282f65){console[_0xdd0c('0x7b')](_0xdd0c('0x7c'),_0x282f65);}else{fs[_0xdd0c('0x7d')](_0x477741);}});});});}else{return _0x32a254[_0xdd0c('0x11')](0xc8);}})['catch'](handleError(_0x32a254,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a1141ad..df69513 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 _0xc817=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch'];(function(_0x3cc91b,_0x250f20){var _0x1dafcc=function(_0x4197f1){while(--_0x4197f1){_0x3cc91b['push'](_0x3cc91b['shift']());}};_0x1dafcc(++_0x250f20);}(_0xc817,0x75));var _0x7c81=function(_0x1941c7,_0x1df6a1){_0x1941c7=_0x1941c7-0x0;var _0x4356f5=_0xc817[_0x1941c7];return _0x4356f5;};'use strict';var EventEmitter=require(_0x7c81('0x0'));var WhatsappInteraction=require(_0x7c81('0x1'))['db'][_0x7c81('0x2')];var WhatsappMessage=require(_0x7c81('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7c81('0x3')](0x0);var events={'afterCreate':_0x7c81('0x4'),'afterUpdate':_0x7c81('0x5'),'afterDestroy':_0x7c81('0x6')};function emitEvent(_0x298913){return function(_0xac7432,_0x53d1fa,_0x2113a0){_0xac7432[_0x7c81('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x38be9c){_0xac7432[_0x7c81('0x8')]('Users',_0x38be9c[_0x7c81('0x9')](function(_0x210481){return{'id':_0x210481['id']};}));return WhatsappMessage[_0x7c81('0xa')]({'where':{'WhatsappInteractionId':_0xac7432['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c81('0xb')](function(_0x1220d0){_0xac7432['setDataValue'](_0x7c81('0xc'),_0x1220d0[_0x7c81('0xd')]);WhatsappInteractionEvents[_0x7c81('0xe')](_0x298913+':'+_0xac7432['id'],_0xac7432);WhatsappInteractionEvents[_0x7c81('0xe')](_0x298913,_0xac7432);_0x2113a0(null);})[_0x7c81('0xf')](_0x2113a0(null));};}for(var e in events){if(events[_0x7c81('0x10')](e)){var event=events[e];WhatsappInteraction[_0x7c81('0x11')](e,emitEvent(event));}}module[_0x7c81('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xcbe1=['update','then','setDataValue','Users','map','findAll','length','emit','catch','hook','../../mysqldb','save'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0xe2c665,_0x5467a0){_0xe2c665=_0xe2c665-0x0;var _0x5bcbb7=_0xcbe1[_0xe2c665];return _0x5bcbb7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x1cbe('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cbe('0x1'),'afterUpdate':_0x1cbe('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1ba56c){return function(_0x563162,_0x940654,_0x168121){_0x563162['getUsers']({'attributes':['id'],'raw':!![]})[_0x1cbe('0x3')](function(_0x21342a){_0x563162[_0x1cbe('0x4')](_0x1cbe('0x5'),_0x21342a[_0x1cbe('0x6')](function(_0x3e72a0){return{'id':_0x3e72a0['id']};}));return WhatsappMessage[_0x1cbe('0x7')]({'where':{'WhatsappInteractionId':_0x563162['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cbe('0x3')](function(_0x5af288){_0x563162[_0x1cbe('0x4')]('unreadMessages',_0x5af288[_0x1cbe('0x8')]);WhatsappInteractionEvents[_0x1cbe('0x9')](_0x1ba56c+':'+_0x563162['id'],_0x563162);WhatsappInteractionEvents[_0x1cbe('0x9')](_0x1ba56c,_0x563162);_0x168121(null);})[_0x1cbe('0xa')](_0x168121(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x1cbe('0xb')](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 b918280..72dbf1f 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 _0xa01e=['util','api','bluebird','request-promise','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','lodash'];(function(_0x2c70d5,_0x2537cb){var _0x3f1c2f=function(_0x5ce098){while(--_0x5ce098){_0x2c70d5['push'](_0x2c70d5['shift']());}};_0x3f1c2f(++_0x2537cb);}(_0xa01e,0x137));var _0xea01=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa01e[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0xea01('0x0'));var util=require(_0xea01('0x1'));var logger=require('../../config/logger')(_0xea01('0x2'));var moment=require('moment');var BPromise=require(_0xea01('0x3'));var rp=require(_0xea01('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea01('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0xea01('0x6')]=function(_0x35b412,_0x171a03){return _0x35b412[_0xea01('0x7')](_0xea01('0x8'),attributes,{'tableName':_0xea01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x544ffb,_0x943ad0,_0x559130){if(_0x544ffb[_0xea01('0xa')](_0xea01('0xb'))){_0x544ffb[_0xea01('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x559130(null,_0x544ffb);}}});}; \ No newline at end of file +var _0xf944=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x175a95,_0x5c9701){var _0x39e134=function(_0x48d93f){while(--_0x48d93f){_0x175a95['push'](_0x175a95['shift']());}};_0x39e134(++_0x5c9701);}(_0xf944,0x1a9));var _0x4f94=function(_0xd04bfe,_0x4307b7){_0xd04bfe=_0xd04bfe-0x0;var _0x44d6f9=_0xf944[_0xd04bfe];return _0x44d6f9;};'use strict';var _=require(_0x4f94('0x0'));var util=require(_0x4f94('0x1'));var logger=require('../../config/logger')(_0x4f94('0x2'));var moment=require(_0x4f94('0x3'));var BPromise=require(_0x4f94('0x4'));var rp=require(_0x4f94('0x5'));var fs=require('fs');var path=require(_0x4f94('0x6'));var rimraf=require('rimraf');var config=require(_0x4f94('0x7'));var attributes=require(_0x4f94('0x8'));module['exports']=function(_0x114068,_0x2a80d7){return _0x114068[_0x4f94('0x9')](_0x4f94('0xa'),attributes,{'tableName':_0x4f94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34e65a,_0x17a608,_0x5ba50a){if(_0x34e65a[_0x4f94('0xc')](_0x4f94('0xd'))){_0x34e65a[_0x4f94('0xe')]=moment()[_0x4f94('0xf')](_0x4f94('0x10'));}_0x5ba50a(null,_0x34e65a);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a63fef9..85a51df 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 _0x99cc=['lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','stringify','find','addTags','omit','ids','spread','AddTags'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x99cc,0x1a2));var _0xc99c=function(_0x4f2818,_0x217636){_0x4f2818=_0x4f2818-0x0;var _0x341c8a=_0x99cc[_0x4f2818];return _0x341c8a;};'use strict';var _=require(_0xc99c('0x0'));var util=require(_0xc99c('0x1'));var moment=require('moment');var BPromise=require(_0xc99c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc99c('0x3'));var logger=require('../../config/logger')(_0xc99c('0x4'));var config=require(_0xc99c('0x5'));var jayson=require(_0xc99c('0x6'));var client=jayson[_0xc99c('0x7')][_0xc99c('0x8')]({'port':0x232a});config[_0xc99c('0x9')]=_[_0xc99c('0xa')](config[_0xc99c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc99c('0x9')]));require('./whatsappInteraction.socket')[_0xc99c('0xb')](socket);function respondWithRpcPromise(_0x3ba077,_0x11ac1f,_0x14e286){return new BPromise(function(_0x301aa3,_0x5befc4){return client['request'](_0x3ba077,_0x14e286)[_0xc99c('0xc')](function(_0x8dbcf7){logger[_0xc99c('0xd')](_0xc99c('0xe'),_0x11ac1f,_0xc99c('0xf'));logger[_0xc99c('0x10')](_0xc99c('0x11'),_0x11ac1f,_0xc99c('0xf'),JSON['stringify'](_0x8dbcf7));if(_0x8dbcf7[_0xc99c('0x12')]){if(_0x8dbcf7[_0xc99c('0x12')][_0xc99c('0x13')]===0x1f4){logger[_0xc99c('0x12')](_0xc99c('0xe'),_0x11ac1f,_0x8dbcf7[_0xc99c('0x12')][_0xc99c('0x14')]);return _0x5befc4(_0x8dbcf7[_0xc99c('0x12')][_0xc99c('0x14')]);}logger[_0xc99c('0x12')](_0xc99c('0xe'),_0x11ac1f,_0x8dbcf7[_0xc99c('0x12')][_0xc99c('0x14')]);return _0x301aa3(_0x8dbcf7[_0xc99c('0x12')]['message']);}else{logger[_0xc99c('0xd')](_0xc99c('0xe'),_0x11ac1f,_0xc99c('0xf'));_0x301aa3(_0x8dbcf7[_0xc99c('0x15')][_0xc99c('0x14')]);}})[_0xc99c('0x16')](function(_0x3de141){logger[_0xc99c('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x11ac1f,_0x3de141);_0x5befc4(_0x3de141);});});}exports[_0xc99c('0x17')]=function(_0x1c58f0){var _0x38f55a=this;return new Promise(function(_0x3f4516,_0x30b469){return db[_0xc99c('0x18')][_0xc99c('0x19')](_0x1c58f0[_0xc99c('0x1a')],{'raw':_0x1c58f0[_0xc99c('0x1b')]?_0x1c58f0[_0xc99c('0x1b')][_0xc99c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c58f0[_0xc99c('0x1b')]?_0x1c58f0[_0xc99c('0x1b')][_0xc99c('0x1d')]||null:null,'attributes':_0x1c58f0[_0xc99c('0x1b')]?_0x1c58f0[_0xc99c('0x1b')]['attributes']||null:null,'limit':_0x1c58f0[_0xc99c('0x1b')]?_0x1c58f0[_0xc99c('0x1b')][_0xc99c('0x1e')]||null:null})[_0xc99c('0xc')](function(_0x317dc7){logger[_0xc99c('0xd')]('UpdateWhatsappInteraction',_0x1c58f0);logger[_0xc99c('0x10')](_0xc99c('0x17'),_0x1c58f0,JSON[_0xc99c('0x1f')](_0x317dc7));_0x3f4516(_0x317dc7);})[_0xc99c('0x16')](function(_0x5b9a00){logger[_0xc99c('0x12')](_0xc99c('0x17'),_0x5b9a00['message'],_0x1c58f0);_0x30b469(_0x38f55a['error'](0x1f4,_0x5b9a00[_0xc99c('0x14')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x49f079){return new Promise(function(_0x5514ae,_0x798a74){return db['WhatsappInteraction'][_0xc99c('0x20')]({'where':_0x49f079[_0xc99c('0x1b')]?_0x49f079[_0xc99c('0x1b')][_0xc99c('0x1d')]||null:null})['then'](function(_0x48fc00){if(_0x48fc00){return _0x48fc00[_0xc99c('0x21')](_0x49f079['body']['ids'],_[_0xc99c('0x22')](_0x49f079[_0xc99c('0x1a')],[_0xc99c('0x23'),'id'])||{});}})[_0xc99c('0x24')](function(_0x224b97){logger[_0xc99c('0xd')](_0xc99c('0x25'),_0x49f079);logger[_0xc99c('0x10')]('AddTags',_0x49f079,JSON[_0xc99c('0x1f')](_0x224b97));_0x5514ae(_0x224b97);})[_0xc99c('0x16')](function(_0x572221){logger[_0xc99c('0x12')](_0xc99c('0x25'),_0x572221['message'],_0x49f079);_0x798a74(_this['error'](0x1f4,_0x572221['message']));});});}; \ No newline at end of file +var _0x8305=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0x324720,_0x57ef04){var _0x5a6b14=function(_0x59b309){while(--_0x59b309){_0x324720['push'](_0x324720['shift']());}};_0x5a6b14(++_0x57ef04);}(_0x8305,0x1d3));var _0x5830=function(_0x11cf50,_0x5e60e2){_0x11cf50=_0x11cf50-0x0;var _0x11da0f=_0x8305[_0x11cf50];return _0x11da0f;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5830('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5830('0x2'));var db=require(_0x5830('0x3'))['db'];var utils=require(_0x5830('0x4'));var logger=require(_0x5830('0x5'))(_0x5830('0x6'));var config=require(_0x5830('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5830('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5830('0x9')],{'host':_0x5830('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5830('0x9')]));require(_0x5830('0xb'))[_0x5830('0xc')](socket);function respondWithRpcPromise(_0x55658a,_0x24f6e0,_0x589979){return new BPromise(function(_0x2ac30f,_0x48773e){return client['request'](_0x55658a,_0x589979)['then'](function(_0x1c0f70){logger[_0x5830('0xd')](_0x5830('0xe'),_0x24f6e0,_0x5830('0xf'));logger[_0x5830('0x10')](_0x5830('0x11'),_0x24f6e0,_0x5830('0xf'),JSON[_0x5830('0x12')](_0x1c0f70));if(_0x1c0f70[_0x5830('0x13')]){if(_0x1c0f70[_0x5830('0x13')][_0x5830('0x14')]===0x1f4){logger[_0x5830('0x13')](_0x5830('0xe'),_0x24f6e0,_0x1c0f70[_0x5830('0x13')]['message']);return _0x48773e(_0x1c0f70[_0x5830('0x13')]['message']);}logger[_0x5830('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x24f6e0,_0x1c0f70[_0x5830('0x13')][_0x5830('0x15')]);return _0x2ac30f(_0x1c0f70[_0x5830('0x13')]['message']);}else{logger[_0x5830('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x24f6e0,_0x5830('0xf'));_0x2ac30f(_0x1c0f70['result'][_0x5830('0x15')]);}})[_0x5830('0x16')](function(_0xf70922){logger['error'](_0x5830('0xe'),_0x24f6e0,_0xf70922);_0x48773e(_0xf70922);});});}exports[_0x5830('0x17')]=function(_0x2c3526){var _0x2e710f=this;return new Promise(function(_0x94fa55,_0x155c22){return db[_0x5830('0x18')][_0x5830('0x19')](_0x2c3526[_0x5830('0x1a')],{'raw':_0x2c3526[_0x5830('0x1b')]?_0x2c3526['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c3526[_0x5830('0x1b')]?_0x2c3526[_0x5830('0x1b')][_0x5830('0x1c')]||null:null,'attributes':_0x2c3526[_0x5830('0x1b')]?_0x2c3526[_0x5830('0x1b')][_0x5830('0x1d')]||null:null,'limit':_0x2c3526[_0x5830('0x1b')]?_0x2c3526[_0x5830('0x1b')][_0x5830('0x1e')]||null:null})[_0x5830('0x1f')](function(_0x1fcf2f){logger[_0x5830('0xd')](_0x5830('0x17'),_0x2c3526);logger[_0x5830('0x10')](_0x5830('0x17'),_0x2c3526,JSON[_0x5830('0x12')](_0x1fcf2f));_0x94fa55(_0x1fcf2f);})[_0x5830('0x16')](function(_0x4ffa39){logger[_0x5830('0x13')](_0x5830('0x17'),_0x4ffa39[_0x5830('0x15')],_0x2c3526);_0x155c22(_0x2e710f[_0x5830('0x13')](0x1f4,_0x4ffa39[_0x5830('0x15')]));});});};exports[_0x5830('0x20')]=function(_0x383e40){return new Promise(function(_0x38b381,_0x5e3345){return db[_0x5830('0x18')][_0x5830('0x21')]({'where':_0x383e40[_0x5830('0x1b')]?_0x383e40['options']['where']||null:null})[_0x5830('0x1f')](function(_0x5a5ed5){if(_0x5a5ed5){return _0x5a5ed5[_0x5830('0x22')](_0x383e40[_0x5830('0x1a')][_0x5830('0x23')],_[_0x5830('0x24')](_0x383e40[_0x5830('0x1a')],[_0x5830('0x23'),'id'])||{});}})[_0x5830('0x25')](function(_0x59db5a){logger[_0x5830('0xd')](_0x5830('0x26'),_0x383e40);logger[_0x5830('0x10')](_0x5830('0x26'),_0x383e40,JSON[_0x5830('0x12')](_0x59db5a));_0x38b381(_0x59db5a);})[_0x5830('0x16')](function(_0x367438){logger[_0x5830('0x13')](_0x5830('0x26'),_0x367438[_0x5830('0x15')],_0x383e40);_0x5e3345(_this[_0x5830('0x13')](0x1f4,_0x367438[_0x5830('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 9fa219a..6253b28 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 _0xe5a7=['./whatsappInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xe5a7,0x173));var _0x7e5a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe5a7[_0x491a7f];return _0x3d8f44;};'use strict';var WhatsappInteractionEvents=require(_0x7e5a('0x0'));var events=['save',_0x7e5a('0x1'),_0x7e5a('0x2')];function createListener(_0x4fcdc7,_0x32572a){return function(_0xb2df6a){_0x32572a[_0x7e5a('0x3')](_0x4fcdc7,_0xb2df6a);};}function removeListener(_0x2020c9,_0x2dd415){return function(){WhatsappInteractionEvents[_0x7e5a('0x4')](_0x2020c9,_0x2dd415);};}exports[_0x7e5a('0x5')]=function(_0xeec8f9){for(var _0x384bfc=0x0,_0x2652ca=events[_0x7e5a('0x6')];_0x384bfc<_0x2652ca;_0x384bfc++){var _0x1b3d0f=events[_0x384bfc];var _0x20230c=createListener('whatsappInteraction:'+_0x1b3d0f,_0xeec8f9);WhatsappInteractionEvents['on'](_0x1b3d0f,_0x20230c);}}; \ No newline at end of file +var _0x5232=['removeListener','register','./whatsappInteraction.events','save','remove','emit'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x5232,0xf2));var _0x2523=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x5232[_0xd1b4d7];return _0x3002ec;};'use strict';var WhatsappInteractionEvents=require(_0x2523('0x0'));var events=[_0x2523('0x1'),_0x2523('0x2'),'update'];function createListener(_0x40a780,_0x2fbadf){return function(_0x53dd79){_0x2fbadf[_0x2523('0x3')](_0x40a780,_0x53dd79);};}function removeListener(_0x40a06c,_0xc3a045){return function(){WhatsappInteractionEvents[_0x2523('0x4')](_0x40a06c,_0xc3a045);};}exports[_0x2523('0x5')]=function(_0x3009b5){for(var _0x48d18e=0x0,_0x1a13f5=events['length'];_0x48d18e<_0x1a13f5;_0x48d18e++){var _0x5601c5=events[_0x48d18e];var _0x328164=createListener('whatsappInteraction:'+_0x5601c5,_0x3009b5);WhatsappInteractionEvents['on'](_0x5601c5,_0x328164);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3b2b794..a071e79 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 _0x46ce=['tracked','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','post'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x46ce,0x139));var _0xe46c=function(_0x1eb0d9,_0x12c11c){_0x1eb0d9=_0x1eb0d9-0x0;var _0x324ea6=_0x46ce[_0x1eb0d9];return _0x324ea6;};'use strict';var multer=require(_0xe46c('0x0'));var util=require(_0xe46c('0x1'));var path=require(_0xe46c('0x2'));var timeout=require(_0xe46c('0x3'));var express=require('express');var router=express[_0xe46c('0x4')]();var fs_extra=require(_0xe46c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe46c('0x6'));var config=require(_0xe46c('0x7'));var controller=require(_0xe46c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe46c('0x9')]('/describe',auth[_0xe46c('0xa')](),controller['describe']);router['get']('/:id',auth[_0xe46c('0xa')](),controller['show']);router[_0xe46c('0xb')]('/',auth[_0xe46c('0xa')](),interaction[_0xe46c('0xc')]('whatsapp',_0xe46c('0xd')),controller[_0xe46c('0xe')]);router[_0xe46c('0xb')](_0xe46c('0xf'),controller[_0xe46c('0x10')]);router[_0xe46c('0x11')](_0xe46c('0x12'),auth[_0xe46c('0xa')](),controller['update']);router[_0xe46c('0x11')](_0xe46c('0x13'),auth[_0xe46c('0xa')](),controller[_0xe46c('0x14')]);router[_0xe46c('0x11')]('/:id/reject',auth[_0xe46c('0xa')](),controller[_0xe46c('0x15')]);router[_0xe46c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xe46c('0x17')]);module[_0xe46c('0x18')]=router; \ No newline at end of file +var _0xb904=['/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x2992cb,_0x102ca6){var _0x499699=function(_0x25d001){while(--_0x25d001){_0x2992cb['push'](_0x2992cb['shift']());}};_0x499699(++_0x102ca6);}(_0xb904,0xcf));var _0x4b90=function(_0x180c86,_0x36de15){_0x180c86=_0x180c86-0x0;var _0x37a672=_0xb904[_0x180c86];return _0x37a672;};'use strict';var multer=require(_0x4b90('0x0'));var util=require('util');var path=require(_0x4b90('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b90('0x2'));var router=express[_0x4b90('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b90('0x4'));var config=require(_0x4b90('0x5'));var controller=require(_0x4b90('0x6'));router[_0x4b90('0x7')]('/',auth[_0x4b90('0x8')](),controller['index']);router[_0x4b90('0x7')](_0x4b90('0x9'),auth[_0x4b90('0x8')](),controller[_0x4b90('0xa')]);router[_0x4b90('0x7')](_0x4b90('0xb'),auth[_0x4b90('0x8')](),controller[_0x4b90('0xc')]);router[_0x4b90('0xd')]('/',auth[_0x4b90('0x8')](),interaction[_0x4b90('0xe')](_0x4b90('0xf'),_0x4b90('0x10')),controller[_0x4b90('0x11')]);router[_0x4b90('0xd')]('/:id/status',controller['status']);router[_0x4b90('0x12')](_0x4b90('0xb'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x13')]);router[_0x4b90('0x12')](_0x4b90('0x14'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x15')]);router[_0x4b90('0x12')](_0x4b90('0x16'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x17')]);router[_0x4b90('0x18')](_0x4b90('0xb'),auth[_0x4b90('0x8')](),controller[_0x4b90('0x19')]);module[_0x4b90('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 70cccb4..c238344 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 _0x8626=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x290dc7,_0x34cc30){var _0x1f9680=function(_0x4461ab){while(--_0x4461ab){_0x290dc7['push'](_0x290dc7['shift']());}};_0x1f9680(++_0x34cc30);}(_0x8626,0xd9));var _0x6862=function(_0x3bda42,_0x5d9175){_0x3bda42=_0x3bda42-0x0;var _0x4ad782=_0x8626[_0x3bda42];return _0x4ad782;};'use strict';var Sequelize=require('sequelize');module[_0x6862('0x0')]={'body':{'type':Sequelize[_0x6862('0x1')](_0x6862('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6862('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6862('0x4')]('in',_0x6862('0x5')),'defaultValue':_0x6862('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6862('0x6')](0xbe)},'phone':{'type':Sequelize[_0x6862('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x6862('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6862('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4c50=['BOOLEAN','exports','TEXT','medium','out','STRING'];(function(_0x57a5da,_0x445680){var _0x37fde7=function(_0x157d23){while(--_0x157d23){_0x57a5da['push'](_0x57a5da['shift']());}};_0x37fde7(++_0x445680);}(_0x4c50,0xf7));var _0x04c5=function(_0xb8db3e,_0x1efca5){_0xb8db3e=_0xb8db3e-0x0;var _0x52b0ee=_0x4c50[_0xb8db3e];return _0x52b0ee;};'use strict';var Sequelize=require('sequelize');module[_0x04c5('0x0')]={'body':{'type':Sequelize[_0x04c5('0x1')](_0x04c5('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x04c5('0x3')),'defaultValue':_0x04c5('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x04c5('0x4')](0xbe)},'phone':{'type':Sequelize[_0x04c5('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x04c5('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x04c5('0x4')]},'providerResponse':{'type':Sequelize[_0x04c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 89583b8..bde011f 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 _0x289a=['key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','show','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','rejectMessage','Sequelize','internal','interface','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type'];(function(_0x48dab5,_0x51fab6){var _0x3f47be=function(_0x1e0166){while(--_0x1e0166){_0x48dab5['push'](_0x48dab5['shift']());}};_0x3f47be(++_0x51fab6);}(_0x289a,0xd6));var _0xa289=function(_0x3bb45b,_0x2dcc0b){_0x3bb45b=_0x3bb45b-0x0;var _0x513162=_0x289a[_0x3bb45b];return _0x513162;};'use strict';var emlformat=require(_0xa289('0x0'));var rimraf=require(_0xa289('0x1'));var zipdir=require(_0xa289('0x2'));var jsonpatch=require(_0xa289('0x3'));var rp=require(_0xa289('0x4'));var moment=require(_0xa289('0x5'));var BPromise=require(_0xa289('0x6'));var Mustache=require(_0xa289('0x7'));var util=require('util');var path=require(_0xa289('0x8'));var sox=require('sox');var csv=require(_0xa289('0x9'));var ejs=require(_0xa289('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa289('0xb'));var squel=require(_0xa289('0xc'));var crypto=require(_0xa289('0xd'));var jsforce=require(_0xa289('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa289('0x9'));var querystring=require(_0xa289('0xf'));var Papa=require(_0xa289('0x10'));var Redis=require(_0xa289('0x11'));var authService=require(_0xa289('0x12'));var qs=require(_0xa289('0x13'));var as=require(_0xa289('0x14'));var hardwareService=require(_0xa289('0x15'));var logger=require(_0xa289('0x16'))(_0xa289('0x17'));var utils=require(_0xa289('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa289('0x19'));var db=require(_0xa289('0x1a'))['db'];config[_0xa289('0x1b')]=_[_0xa289('0x1c')](config[_0xa289('0x1b')],{'host':_0xa289('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa289('0x1b')]));require(_0xa289('0x1e'))[_0xa289('0x1f')](socket);var jayson=require(_0xa289('0x20'));var client=jayson[_0xa289('0x21')][_0xa289('0x22')]({'port':0x232c});var client9002=jayson[_0xa289('0x21')][_0xa289('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1bd211,_0x1ea250,_0x5d3a3e,_0x35eed8){return new BPromise(function(_0x501f93,_0x5eaeed){var _0x2514f8=_0x35eed8||client;return _0x2514f8['request'](_0x1bd211,_0x5d3a3e)[_0xa289('0x23')](function(_0x3313e2){logger[_0xa289('0x24')](_0xa289('0x25'),_0x1ea250,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1ea250,_0xa289('0x26'),JSON['stringify'](_0x3313e2));if(_0x3313e2[_0xa289('0x27')]){if(_0x3313e2[_0xa289('0x27')][_0xa289('0x28')]===0x1f4){logger[_0xa289('0x27')](_0xa289('0x25'),_0x1ea250,_0x3313e2['error'][_0xa289('0x29')]);return _0x5eaeed(_0x3313e2[_0xa289('0x27')][_0xa289('0x29')]);}logger['error'](_0xa289('0x25'),_0x1ea250,_0x3313e2[_0xa289('0x27')][_0xa289('0x29')]);return _0x501f93(_0x3313e2[_0xa289('0x27')][_0xa289('0x29')]);}else{logger[_0xa289('0x24')](_0xa289('0x25'),_0x1ea250,_0xa289('0x26'));_0x501f93(_0x3313e2['result'][_0xa289('0x29')]);}})[_0xa289('0x2a')](function(_0x4da549){logger[_0xa289('0x27')](_0xa289('0x25'),_0x1ea250,_0x4da549);_0x5eaeed(_0x4da549);});});}function respondWithStatusCode(_0x4d3213,_0x16173e){_0x16173e=_0x16173e||0xcc;return function(_0x3180dd){if(_0x3180dd){return _0x4d3213['sendStatus'](_0x16173e);}return _0x4d3213['status'](_0x16173e)['end']();};}function respondWithResult(_0x5908c5,_0xab447e){_0xab447e=_0xab447e||0xc8;return function(_0x429847){if(_0x429847){return _0x5908c5[_0xa289('0x2b')](_0xab447e)[_0xa289('0x2c')](_0x429847);}};}function respondWithFilteredResult(_0x5e4aa6,_0x391281){return function(_0x1ea47e){if(_0x1ea47e){var _0x58b302=typeof _0x391281[_0xa289('0x2d')]===_0xa289('0x2e')&&typeof _0x391281['limit']===_0xa289('0x2e');var _0x55cf90=_0x1ea47e[_0xa289('0x2f')];var _0x5abfcb=_0x58b302?0x0:_0x391281['offset'];var _0x4bc8b9=_0x58b302?_0x1ea47e[_0xa289('0x2f')]:_0x391281['offset']+_0x391281[_0xa289('0x30')];var _0x397f43;if(_0x4bc8b9>=_0x55cf90){_0x4bc8b9=_0x55cf90;_0x397f43=0xc8;}else{_0x397f43=0xce;}_0x5e4aa6['status'](_0x397f43);return _0x5e4aa6[_0xa289('0x31')](_0xa289('0x32'),_0x5abfcb+'-'+_0x4bc8b9+'/'+_0x55cf90)[_0xa289('0x2c')](_0x1ea47e);}return null;};}function patchUpdates(_0x2312ae){return function(_0x238cd4){try{jsonpatch[_0xa289('0x33')](_0x238cd4,_0x2312ae,!![]);}catch(_0x3235ec){return BPromise[_0xa289('0x34')](_0x3235ec);}return _0x238cd4[_0xa289('0x35')]();};}function saveUpdates(_0x53938f,_0x2f954c){return function(_0x5770d8){if(_0x5770d8){return _0x5770d8[_0xa289('0x36')](_0x53938f)[_0xa289('0x23')](function(_0x23b18d){return _0x23b18d;});}return null;};}function removeEntity(_0xa04e60,_0x2e1d73){return function(_0x5c80bb){if(_0x5c80bb){return _0x5c80bb[_0xa289('0x37')]()[_0xa289('0x23')](function(){_0xa04e60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5587cd,_0x396a6c){return function(_0x40055b){if(!_0x40055b){_0x5587cd['sendStatus'](0x194);}return _0x40055b;};}function handleError(_0x23a4e3,_0xde38f4){_0xde38f4=_0xde38f4||0x1f4;return function(_0x563e7e){logger['error'](_0x563e7e[_0xa289('0x38')]);if(_0x563e7e[_0xa289('0x39')]){delete _0x563e7e[_0xa289('0x39')];}_0x23a4e3[_0xa289('0x2b')](_0xde38f4)[_0xa289('0x3a')](_0x563e7e);};}exports[_0xa289('0x3b')]=function(_0x396416,_0x1014a6){var _0x231e09={},_0x3fbfc1={},_0x5f498b={'count':0x0,'rows':[]};var _0x39fcd3=_['map'](db[_0xa289('0x3c')][_0xa289('0x3d')],function(_0x340a5f){return{'name':_0x340a5f[_0xa289('0x3e')],'type':_0x340a5f[_0xa289('0x3f')][_0xa289('0x40')]};});_0x3fbfc1[_0xa289('0x41')]=_[_0xa289('0x42')](_0x39fcd3,'name');_0x3fbfc1['query']=_[_0xa289('0x43')](_0x396416[_0xa289('0x44')]);_0x3fbfc1[_0xa289('0x45')]=_[_0xa289('0x46')](_0x3fbfc1[_0xa289('0x41')],_0x3fbfc1['query']);_0x231e09[_0xa289('0x47')]=_[_0xa289('0x46')](_0x3fbfc1[_0xa289('0x41')],qs[_0xa289('0x48')](_0x396416[_0xa289('0x44')]['fields']));_0x231e09['attributes']=_0x231e09[_0xa289('0x47')][_0xa289('0x49')]?_0x231e09[_0xa289('0x47')]:_0x3fbfc1[_0xa289('0x41')];if(!_0x396416[_0xa289('0x44')][_0xa289('0x4a')](_0xa289('0x4b'))){_0x231e09['limit']=qs['limit'](_0x396416[_0xa289('0x44')][_0xa289('0x30')]);_0x231e09[_0xa289('0x2d')]=qs[_0xa289('0x2d')](_0x396416[_0xa289('0x44')][_0xa289('0x2d')]);}_0x231e09[_0xa289('0x4c')]=qs[_0xa289('0x4d')](_0x396416[_0xa289('0x44')][_0xa289('0x4d')]);_0x231e09[_0xa289('0x4e')]=qs[_0xa289('0x45')](_['pick'](_0x396416['query'],_0x3fbfc1['filters']),_0x39fcd3);if(_0x396416[_0xa289('0x44')][_0xa289('0x4f')]){_0x231e09[_0xa289('0x4e')]=_[_0xa289('0x50')](_0x231e09['where'],{'$or':_[_0xa289('0x42')](_0x39fcd3,function(_0x4a650f){if(_0x4a650f[_0xa289('0x3f')]!==_0xa289('0x51')){var _0x425519={};_0x425519[_0x4a650f['name']]={'$like':'%'+_0x396416[_0xa289('0x44')][_0xa289('0x4f')]+'%'};return _0x425519;}})});}_0x231e09=_[_0xa289('0x50')]({},_0x231e09,_0x396416['options']);var _0x2de8ef={'where':_0x231e09['where']};return db[_0xa289('0x3c')][_0xa289('0x2f')](_0x2de8ef)[_0xa289('0x23')](function(_0x449faa){_0x5f498b[_0xa289('0x2f')]=_0x449faa;if(_0x396416[_0xa289('0x44')][_0xa289('0x52')]){_0x231e09[_0xa289('0x53')]=[{'all':!![]}];}return db[_0xa289('0x3c')]['findAll'](_0x231e09);})[_0xa289('0x23')](function(_0xbbcfa7){_0x5f498b['rows']=_0xbbcfa7;return _0x5f498b;})['then'](respondWithFilteredResult(_0x1014a6,_0x231e09))[_0xa289('0x2a')](handleError(_0x1014a6,null));};exports[_0xa289('0x54')]=function(_0x433cd0,_0x38f5b6){var _0x2a1142={'raw':!![],'where':{'id':_0x433cd0['params']['id']}},_0x21daab={};_0x21daab['model']=_[_0xa289('0x43')](db[_0xa289('0x3c')][_0xa289('0x3d')]);_0x21daab[_0xa289('0x44')]=_['keys'](_0x433cd0[_0xa289('0x44')]);_0x21daab['filters']=_[_0xa289('0x46')](_0x21daab['model'],_0x21daab[_0xa289('0x44')]);_0x2a1142[_0xa289('0x47')]=_['intersection'](_0x21daab[_0xa289('0x41')],qs[_0xa289('0x48')](_0x433cd0[_0xa289('0x44')]['fields']));_0x2a1142['attributes']=_0x2a1142[_0xa289('0x47')][_0xa289('0x49')]?_0x2a1142['attributes']:_0x21daab[_0xa289('0x41')];if(_0x433cd0['query'][_0xa289('0x52')]){_0x2a1142[_0xa289('0x53')]=[{'all':!![]}];}_0x2a1142=_[_0xa289('0x50')]({},_0x2a1142,_0x433cd0['options']);return db[_0xa289('0x3c')]['find'](_0x2a1142)[_0xa289('0x23')](handleEntityNotFound(_0x38f5b6,null))['then'](respondWithResult(_0x38f5b6,null))[_0xa289('0x2a')](handleError(_0x38f5b6,null));};exports[_0xa289('0x55')]=function(_0xb34e19,_0x49cc2a){return db['WhatsappMessage'][_0xa289('0x55')](_0xb34e19[_0xa289('0x56')],{})['then'](respondWithResult(_0x49cc2a,0xc9))[_0xa289('0x2a')](handleError(_0x49cc2a,null));};exports[_0xa289('0x36')]=function(_0x306af6,_0x5eb0fb){if(_0x306af6['body']['id']){delete _0x306af6['body']['id'];}return db[_0xa289('0x3c')][_0xa289('0x57')]({'where':{'id':_0x306af6[_0xa289('0x58')]['id']}})['then'](handleEntityNotFound(_0x5eb0fb,null))['then'](saveUpdates(_0x306af6[_0xa289('0x56')],null))[_0xa289('0x23')](respondWithResult(_0x5eb0fb,null))[_0xa289('0x2a')](handleError(_0x5eb0fb,null));};exports[_0xa289('0x37')]=function(_0xb24cf0,_0x2a029c){return db[_0xa289('0x3c')]['find']({'where':{'id':_0xb24cf0['params']['id']}})['then'](handleEntityNotFound(_0x2a029c,null))[_0xa289('0x23')](removeEntity(_0x2a029c,null))[_0xa289('0x2a')](handleError(_0x2a029c,null));};exports['describe']=function(_0x2c9f39,_0x2f19f7){return db[_0xa289('0x3c')][_0xa289('0x59')]()[_0xa289('0x23')](respondWithResult(_0x2f19f7,null))[_0xa289('0x2a')](handleError(_0x2f19f7,null));};var interaction_log=require('../../config/logger')(_0xa289('0x5a'));exports[_0xa289('0x5b')]=function(_0x343176,_0x27cff1,_0x5f2ba3){var _0x4fd94c={'agent':{},'channel':_0xa289('0x5c')};if(_0x343176[_0xa289('0x56')]['id']){delete _0x343176[_0xa289('0x56')]['id'];}_0x343176['body']['read']=!![];_0x343176[_0xa289('0x56')][_0xa289('0x5d')]=moment()['format'](_0xa289('0x5e'));_0x343176[_0xa289('0x56')][_0xa289('0x5f')]=_0x343176[_0xa289('0x56')][_0xa289('0x5f')]||_0x343176[_0xa289('0x60')]['id'];_0x4fd94c[_0xa289('0x61')]['id']=_0x343176[_0xa289('0x56')][_0xa289('0x5f')];return db[_0xa289('0x3c')][_0xa289('0x57')]({'where':{'id':_0x343176['params']['id'],'UserId':null}})[_0xa289('0x23')](handleEntityNotFound(_0x27cff1,null))[_0xa289('0x23')](saveUpdates(_0x343176['body'],null))[_0xa289('0x23')](function(_0x310f83){if(_0x310f83){_0x4fd94c[_0xa289('0x29')]=_0x310f83[_0xa289('0x62')]({'plain':!![]});return db[_0xa289('0x63')][_0xa289('0x57')]({'where':{'id':_0x310f83[_0xa289('0x64')]}});}return null;})[_0xa289('0x23')](handleEntityNotFound(_0x27cff1,null))[_0xa289('0x23')](function(_0x41d8c9){if(_0x41d8c9){return _0x41d8c9['update']({'UserId':_0x343176[_0xa289('0x56')][_0xa289('0x5f')],'read1stAt':_['isNil'](_0x41d8c9[_0xa289('0x65')])?moment()[_0xa289('0x66')](_0xa289('0x5e')):undefined});}return null;})['then'](function(_0x5ebd5a){if(_0x5ebd5a){_0x4fd94c[_0xa289('0x67')]=_0x5ebd5a[_0xa289('0x62')]({'plain':!![]});interaction_log[_0xa289('0x24')](_0xa289('0x68'),_0x343176[_0xa289('0x60')]['id'],_0x343176[_0xa289('0x60')][_0xa289('0x39')],_0x343176[_0xa289('0x60')]['role'],_0x4fd94c[_0xa289('0x67')]['id'],_0x343176[_0xa289('0x56')]?JSON['stringify'](_0x343176[_0xa289('0x56')]):_0xa289('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa289('0x6a'),_0x4fd94c);}return null;})[_0xa289('0x23')](function(_0x5a51a6){var _0x5d57e9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a51a6[_0xa289('0x29')][_0xa289('0x6b')];return db[_0xa289('0x6c')][_0xa289('0x44')](_0x5d57e9,{'type':db['Sequelize'][_0xa289('0x6d')][_0xa289('0x6e')],'raw':!![]})[_0xa289('0x23')](function(_0x190456){return _0x190456;});})[_0xa289('0x23')](function(_0x57924a){if(_0x57924a){_0x4fd94c[_0xa289('0x29')][_0xa289('0x6f')]=_0x57924a[0x0];if(!_0x343176[_0xa289('0x56')][_0xa289('0x5f')])return;return db[_0xa289('0x70')][_0xa289('0x57')]({'where':{'id':_0x343176[_0xa289('0x56')]['UserId'],'role':_0xa289('0x61')},'attributes':['id',_0xa289('0x39'),_0xa289('0x71'),_0xa289('0x72'),'internal'],'raw':!![]});}return null;})[_0xa289('0x23')](function(_0x3957d2){if(!_0x3957d2)return null;_0x4fd94c[_0xa289('0x29')][_0xa289('0x61')]=_0x3957d2;return _0x4fd94c;})['then'](function(_0x1835f3){if(_0x1835f3){if(_0x343176['body'][_0xa289('0x73')]){_0x4fd94c[_0xa289('0x29')]['interface']=util[_0xa289('0x66')]('SIP/%s',_0x343176['user']['name']);_0x4fd94c[_0xa289('0x29')]['channel']=_0x4fd94c['channel'];_0x4fd94c[_0xa289('0x29')]['motionChannel']=_0x4fd94c[_0xa289('0x74')];_0x4fd94c[_0xa289('0x29')][_0xa289('0x75')]=_0xa289('0x5b');return respondWithRpcPromise(_0xa289('0x76'),_0xa289('0x76'),{'event':_0xa289('0x77'),'message':_0x4fd94c[_0xa289('0x29')]},client9002)[_0xa289('0x23')](function(){return _0x4fd94c;});}return _0x4fd94c;}return null;})['then'](respondWithResult(_0x27cff1,null))['catch'](handleError(_0x27cff1,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xa289('0x34')]=function(_0x2ec2c6,_0x287ce5,_0x12b2f1){var _0x300a56={'agent':{},'channel':_0xa289('0x5c')};if(_0x2ec2c6[_0xa289('0x56')]['id']){delete _0x2ec2c6[_0xa289('0x56')]['id'];}_0x2ec2c6[_0xa289('0x56')][_0xa289('0x5f')]=_0x2ec2c6['body'][_0xa289('0x5f')]||_0x2ec2c6[_0xa289('0x60')]['id'];_0x300a56[_0xa289('0x61')]['id']=_0x2ec2c6[_0xa289('0x56')][_0xa289('0x5f')];return db['WhatsappMessage'][_0xa289('0x57')]({'where':{'id':_0x2ec2c6[_0xa289('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x287ce5,null))[_0xa289('0x23')](function(_0x253a51){if(_0x253a51){_0x300a56[_0xa289('0x29')]=_0x253a51[_0xa289('0x62')]({'plain':!![]});return db[_0xa289('0x63')][_0xa289('0x57')]({'where':{'id':_0x253a51[_0xa289('0x64')]}});}return null;})[_0xa289('0x23')](handleEntityNotFound(_0x287ce5,null))['then'](function(_0x1734ff){if(_0x1734ff){_0x300a56['interaction']=_0x1734ff[_0xa289('0x62')]({'plain':!![]});interaction_log[_0xa289('0x24')](_0xa289('0x78'),_0x2ec2c6['user']['id'],_0x2ec2c6[_0xa289('0x60')][_0xa289('0x39')],_0x2ec2c6[_0xa289('0x60')][_0xa289('0x79')],_0x300a56[_0xa289('0x67')]['id'],_0x2ec2c6[_0xa289('0x56')]?JSON[_0xa289('0x7a')](_0x2ec2c6[_0xa289('0x56')]):'null');return respondWithRpcPromise(_0xa289('0x7b'),_0xa289('0x7c'),_0x300a56);}return null;})['then'](function(_0x1ee709){var _0x46e1b2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ee709['message'][_0xa289('0x6b')];return db['sequelize']['query'](_0x46e1b2,{'type':db[_0xa289('0x7d')][_0xa289('0x6d')][_0xa289('0x6e')],'raw':!![]})['then'](function(_0x1c0c40){return _0x1c0c40;});})['then'](function(_0x9df20){if(_0x9df20){_0x300a56['message'][_0xa289('0x6f')]=_0x9df20[0x0];if(!_0x2ec2c6[_0xa289('0x56')]['UserId'])return;return db[_0xa289('0x70')]['find']({'where':{'id':_0x2ec2c6[_0xa289('0x56')][_0xa289('0x5f')],'role':_0xa289('0x61')},'attributes':['id',_0xa289('0x39'),'fullname','email',_0xa289('0x7e')],'raw':!![]});}return null;})[_0xa289('0x23')](function(_0x51dc2a){if(!_0x51dc2a)return null;_0x300a56['message']['agent']=_0x51dc2a;return _0x300a56;})[_0xa289('0x23')](function(_0x49f157){if(_0x49f157){_0x49f157[_0xa289('0x29')][_0xa289('0x7f')]=util[_0xa289('0x66')](_0xa289('0x80'),_0x2ec2c6['user']['name']);_0x49f157[_0xa289('0x29')][_0xa289('0x74')]=_0x300a56[_0xa289('0x74')];_0x49f157[_0xa289('0x29')]['motionChannel']=_0x300a56['channel'];_0x49f157[_0xa289('0x29')][_0xa289('0x75')]=_0xa289('0x34');respondWithRpcPromise(_0xa289('0x76'),_0xa289('0x76'),{'event':_0xa289('0x81'),'message':_0x49f157[_0xa289('0x29')]},client9002);return _0x300a56;}return null;})[_0xa289('0x23')](respondWithResult(_0x287ce5,null))['catch'](handleError(_0x287ce5,null));};exports[_0xa289('0x2b')]=function(_0x206cce,_0x1d785a,_0x6e2bb1){if(_0x206cce['body']['id']){delete _0x206cce[_0xa289('0x56')]['id'];}var _0x106228;return db[_0xa289('0x3c')]['find']({'where':{'id':_0x206cce[_0xa289('0x58')]['id']}})[_0xa289('0x23')](handleEntityNotFound(_0x1d785a,null))[_0xa289('0x23')](function(_0x4e3e91){if(_0x4e3e91){_0x106228=_0x4e3e91;return db[_0xa289('0x82')]['find']({'where':{'id':_0x4e3e91[_0xa289('0x83')]}});}})[_0xa289('0x23')](handleEntityNotFound(_0x1d785a,null))['then'](function(_0x192f35){if(_0x192f35){logger[_0xa289('0x84')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xa289('0x2b'),_0xa289('0x85'),_0x192f35[_0xa289('0x3f')],util[_0xa289('0x86')](_0x206cce[_0xa289('0x56')],{'showHidden':![],'depth':null}));switch(_0x192f35[_0xa289('0x3f')]){case _0xa289('0x87'):if(_0x206cce[_0xa289('0x56')][_0xa289('0x88')]&&_0x206cce[_0xa289('0x56')][_0xa289('0x88')]===_0x106228[_0xa289('0x89')]&&_0x206cce[_0xa289('0x56')][_0xa289('0x8a')]&&_0x206cce[_0xa289('0x56')]['MessageStatus']==='read'){return _0x106228[_0xa289('0x36')]({'read':!![]});}else{logger[_0xa289('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa289('0x2b'),_0xa289('0x87'),util['inspect'](_0x206cce[_0xa289('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x106228;}})[_0xa289('0x23')](respondWithResult(_0x1d785a,null))['catch'](handleError(_0x1d785a,null));}; \ No newline at end of file +var _0x9960=['hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','WhatsappMessage','includeAll','include','findAll','rows','show','rawAttributes','options','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','User','fullname','email','manual','interface','SIP/%s','event','EventManager','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','channel','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy','stack','name','send','index','map','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9960,0x1e3));var _0x0996=function(_0x3c5445,_0x450cbb){_0x3c5445=_0x3c5445-0x0;var _0xda5931=_0x9960[_0x3c5445];return _0xda5931;};'use strict';var emlformat=require(_0x0996('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0996('0x1'));var jsonpatch=require(_0x0996('0x2'));var rp=require(_0x0996('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0996('0x4'));var util=require(_0x0996('0x5'));var path=require(_0x0996('0x6'));var sox=require('sox');var csv=require(_0x0996('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0996('0x8'));var _=require('lodash');var squel=require(_0x0996('0x9'));var crypto=require(_0x0996('0xa'));var jsforce=require(_0x0996('0xb'));var deskjs=require(_0x0996('0xc'));var toCsv=require(_0x0996('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0996('0xd'));var authService=require(_0x0996('0xe'));var qs=require(_0x0996('0xf'));var as=require(_0x0996('0x10'));var hardwareService=require(_0x0996('0x11'));var logger=require(_0x0996('0x12'))('api');var utils=require(_0x0996('0x13'));var config=require(_0x0996('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0996('0x15')]=_[_0x0996('0x16')](config[_0x0996('0x15')],{'host':_0x0996('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0996('0x15')]));require('./whatsappMessage.socket')[_0x0996('0x18')](socket);var jayson=require(_0x0996('0x19'));var client=jayson[_0x0996('0x1a')][_0x0996('0x1b')]({'port':0x232c});var client9002=jayson[_0x0996('0x1a')][_0x0996('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3e138c,_0x5c460a,_0x1d3ff3,_0x584334){return new BPromise(function(_0x19bb7f,_0x6aa0eb){var _0x597379=_0x584334||client;return _0x597379[_0x0996('0x1c')](_0x3e138c,_0x1d3ff3)['then'](function(_0x11ba1c){logger[_0x0996('0x1d')](_0x0996('0x1e'),_0x5c460a,_0x0996('0x1f'));logger[_0x0996('0x20')](_0x0996('0x21'),_0x5c460a,_0x0996('0x1f'),JSON['stringify'](_0x11ba1c));if(_0x11ba1c[_0x0996('0x22')]){if(_0x11ba1c[_0x0996('0x22')]['code']===0x1f4){logger[_0x0996('0x22')](_0x0996('0x1e'),_0x5c460a,_0x11ba1c[_0x0996('0x22')]['message']);return _0x6aa0eb(_0x11ba1c[_0x0996('0x22')][_0x0996('0x23')]);}logger[_0x0996('0x22')](_0x0996('0x1e'),_0x5c460a,_0x11ba1c['error'][_0x0996('0x23')]);return _0x19bb7f(_0x11ba1c[_0x0996('0x22')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5c460a,'request\x20sent');_0x19bb7f(_0x11ba1c[_0x0996('0x24')][_0x0996('0x23')]);}})[_0x0996('0x25')](function(_0x4b4184){logger[_0x0996('0x22')](_0x0996('0x1e'),_0x5c460a,_0x4b4184);_0x6aa0eb(_0x4b4184);});});}function respondWithStatusCode(_0x5af04f,_0x28dbc8){_0x28dbc8=_0x28dbc8||0xcc;return function(_0x3f4223){if(_0x3f4223){return _0x5af04f[_0x0996('0x26')](_0x28dbc8);}return _0x5af04f[_0x0996('0x27')](_0x28dbc8)[_0x0996('0x28')]();};}function respondWithResult(_0x30a7d0,_0x28a45f){_0x28a45f=_0x28a45f||0xc8;return function(_0x622978){if(_0x622978){return _0x30a7d0[_0x0996('0x27')](_0x28a45f)[_0x0996('0x29')](_0x622978);}};}function respondWithFilteredResult(_0x542683,_0x56a71d){return function(_0xac42e){if(_0xac42e){var _0x1289bd=typeof _0x56a71d[_0x0996('0x2a')]==='undefined'&&typeof _0x56a71d['limit']===_0x0996('0x2b');var _0x15bca2=_0xac42e['count'];var _0x1bcf1e=_0x1289bd?0x0:_0x56a71d['offset'];var _0x144ef3=_0x1289bd?_0xac42e[_0x0996('0x2c')]:_0x56a71d['offset']+_0x56a71d[_0x0996('0x2d')];var _0x768a0d;if(_0x144ef3>=_0x15bca2){_0x144ef3=_0x15bca2;_0x768a0d=0xc8;}else{_0x768a0d=0xce;}_0x542683[_0x0996('0x27')](_0x768a0d);return _0x542683['set']('Content-Range',_0x1bcf1e+'-'+_0x144ef3+'/'+_0x15bca2)[_0x0996('0x29')](_0xac42e);}return null;};}function patchUpdates(_0x559066){return function(_0x13fe89){try{jsonpatch[_0x0996('0x2e')](_0x13fe89,_0x559066,!![]);}catch(_0xeb14d3){return BPromise[_0x0996('0x2f')](_0xeb14d3);}return _0x13fe89['save']();};}function saveUpdates(_0x59fe69,_0x149b80){return function(_0x59309a){if(_0x59309a){return _0x59309a[_0x0996('0x30')](_0x59fe69)[_0x0996('0x31')](function(_0x56a0fd){return _0x56a0fd;});}return null;};}function removeEntity(_0x4c275c,_0x123307){return function(_0x3de867){if(_0x3de867){return _0x3de867[_0x0996('0x32')]()[_0x0996('0x31')](function(){_0x4c275c['status'](0xcc)[_0x0996('0x28')]();});}};}function handleEntityNotFound(_0x38c894,_0x50769){return function(_0xa599e0){if(!_0xa599e0){_0x38c894[_0x0996('0x26')](0x194);}return _0xa599e0;};}function handleError(_0x1cafae,_0x348570){_0x348570=_0x348570||0x1f4;return function(_0x1dde45){logger[_0x0996('0x22')](_0x1dde45[_0x0996('0x33')]);if(_0x1dde45[_0x0996('0x34')]){delete _0x1dde45['name'];}_0x1cafae[_0x0996('0x27')](_0x348570)[_0x0996('0x35')](_0x1dde45);};}exports[_0x0996('0x36')]=function(_0x1b0e1f,_0x3975a8){var _0x3f25d5={},_0x3c961d={},_0x36f3be={'count':0x0,'rows':[]};var _0x277d94=_[_0x0996('0x37')](db['WhatsappMessage']['rawAttributes'],function(_0x2e0f84){return{'name':_0x2e0f84['fieldName'],'type':_0x2e0f84[_0x0996('0x38')][_0x0996('0x39')]};});_0x3c961d['model']=_[_0x0996('0x37')](_0x277d94,'name');_0x3c961d[_0x0996('0x3a')]=_['keys'](_0x1b0e1f[_0x0996('0x3a')]);_0x3c961d[_0x0996('0x3b')]=_[_0x0996('0x3c')](_0x3c961d[_0x0996('0x3d')],_0x3c961d[_0x0996('0x3a')]);_0x3f25d5[_0x0996('0x3e')]=_[_0x0996('0x3c')](_0x3c961d[_0x0996('0x3d')],qs[_0x0996('0x3f')](_0x1b0e1f[_0x0996('0x3a')]['fields']));_0x3f25d5[_0x0996('0x3e')]=_0x3f25d5['attributes'][_0x0996('0x40')]?_0x3f25d5['attributes']:_0x3c961d[_0x0996('0x3d')];if(!_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x41')](_0x0996('0x42'))){_0x3f25d5[_0x0996('0x2d')]=qs['limit'](_0x1b0e1f['query'][_0x0996('0x2d')]);_0x3f25d5[_0x0996('0x2a')]=qs[_0x0996('0x2a')](_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x2a')]);}_0x3f25d5[_0x0996('0x43')]=qs[_0x0996('0x44')](_0x1b0e1f['query'][_0x0996('0x44')]);_0x3f25d5['where']=qs['filters'](_['pick'](_0x1b0e1f[_0x0996('0x3a')],_0x3c961d[_0x0996('0x3b')]),_0x277d94);if(_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x45')]){_0x3f25d5[_0x0996('0x46')]=_[_0x0996('0x47')](_0x3f25d5[_0x0996('0x46')],{'$or':_[_0x0996('0x37')](_0x277d94,function(_0x579f0d){if(_0x579f0d[_0x0996('0x38')]!==_0x0996('0x48')){var _0x3527e0={};_0x3527e0[_0x579f0d['name']]={'$like':'%'+_0x1b0e1f[_0x0996('0x3a')][_0x0996('0x45')]+'%'};return _0x3527e0;}})});}_0x3f25d5=_[_0x0996('0x47')]({},_0x3f25d5,_0x1b0e1f['options']);var _0x226b70={'where':_0x3f25d5[_0x0996('0x46')]};return db[_0x0996('0x49')][_0x0996('0x2c')](_0x226b70)['then'](function(_0x3fc3a0){_0x36f3be[_0x0996('0x2c')]=_0x3fc3a0;if(_0x1b0e1f['query'][_0x0996('0x4a')]){_0x3f25d5[_0x0996('0x4b')]=[{'all':!![]}];}return db[_0x0996('0x49')][_0x0996('0x4c')](_0x3f25d5);})[_0x0996('0x31')](function(_0x4cd736){_0x36f3be[_0x0996('0x4d')]=_0x4cd736;return _0x36f3be;})[_0x0996('0x31')](respondWithFilteredResult(_0x3975a8,_0x3f25d5))[_0x0996('0x25')](handleError(_0x3975a8,null));};exports[_0x0996('0x4e')]=function(_0xaec0ad,_0x518d55){var _0x5b6b2a={'raw':!![],'where':{'id':_0xaec0ad['params']['id']}},_0x1e7920={};_0x1e7920[_0x0996('0x3d')]=_['keys'](db[_0x0996('0x49')][_0x0996('0x4f')]);_0x1e7920[_0x0996('0x3a')]=_['keys'](_0xaec0ad[_0x0996('0x3a')]);_0x1e7920[_0x0996('0x3b')]=_[_0x0996('0x3c')](_0x1e7920[_0x0996('0x3d')],_0x1e7920[_0x0996('0x3a')]);_0x5b6b2a[_0x0996('0x3e')]=_[_0x0996('0x3c')](_0x1e7920['model'],qs[_0x0996('0x3f')](_0xaec0ad[_0x0996('0x3a')][_0x0996('0x3f')]));_0x5b6b2a[_0x0996('0x3e')]=_0x5b6b2a[_0x0996('0x3e')][_0x0996('0x40')]?_0x5b6b2a[_0x0996('0x3e')]:_0x1e7920['model'];if(_0xaec0ad[_0x0996('0x3a')][_0x0996('0x4a')]){_0x5b6b2a[_0x0996('0x4b')]=[{'all':!![]}];}_0x5b6b2a=_[_0x0996('0x47')]({},_0x5b6b2a,_0xaec0ad[_0x0996('0x50')]);return db[_0x0996('0x49')]['find'](_0x5b6b2a)[_0x0996('0x31')](handleEntityNotFound(_0x518d55,null))['then'](respondWithResult(_0x518d55,null))[_0x0996('0x25')](handleError(_0x518d55,null));};exports[_0x0996('0x51')]=function(_0x46d047,_0x4653f9){return db[_0x0996('0x49')][_0x0996('0x51')](_0x46d047[_0x0996('0x52')],{})[_0x0996('0x31')](respondWithResult(_0x4653f9,0xc9))[_0x0996('0x25')](handleError(_0x4653f9,null));};exports[_0x0996('0x30')]=function(_0x1b8168,_0x26ae6c){if(_0x1b8168[_0x0996('0x52')]['id']){delete _0x1b8168[_0x0996('0x52')]['id'];}return db[_0x0996('0x49')][_0x0996('0x53')]({'where':{'id':_0x1b8168[_0x0996('0x54')]['id']}})['then'](handleEntityNotFound(_0x26ae6c,null))[_0x0996('0x31')](saveUpdates(_0x1b8168[_0x0996('0x52')],null))[_0x0996('0x31')](respondWithResult(_0x26ae6c,null))['catch'](handleError(_0x26ae6c,null));};exports['destroy']=function(_0x4f4cca,_0xe3f7ec){return db[_0x0996('0x49')][_0x0996('0x53')]({'where':{'id':_0x4f4cca['params']['id']}})[_0x0996('0x31')](handleEntityNotFound(_0xe3f7ec,null))[_0x0996('0x31')](removeEntity(_0xe3f7ec,null))[_0x0996('0x25')](handleError(_0xe3f7ec,null));};exports[_0x0996('0x55')]=function(_0x53361d,_0x475e2a){return db[_0x0996('0x49')]['describe']()[_0x0996('0x31')](respondWithResult(_0x475e2a,null))['catch'](handleError(_0x475e2a,null));};var interaction_log=require(_0x0996('0x12'))(_0x0996('0x56'));exports[_0x0996('0x57')]=function(_0x5ed646,_0x368e90,_0x149001){var _0x1960f3={'agent':{},'channel':_0x0996('0x58')};if(_0x5ed646[_0x0996('0x52')]['id']){delete _0x5ed646[_0x0996('0x52')]['id'];}_0x5ed646[_0x0996('0x52')]['read']=!![];_0x5ed646[_0x0996('0x52')][_0x0996('0x59')]=moment()[_0x0996('0x5a')](_0x0996('0x5b'));_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')]=_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')]||_0x5ed646[_0x0996('0x5d')]['id'];_0x1960f3[_0x0996('0x5e')]['id']=_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')];return db[_0x0996('0x49')]['find']({'where':{'id':_0x5ed646['params']['id'],'UserId':null}})[_0x0996('0x31')](handleEntityNotFound(_0x368e90,null))[_0x0996('0x31')](saveUpdates(_0x5ed646['body'],null))[_0x0996('0x31')](function(_0x429258){if(_0x429258){_0x1960f3[_0x0996('0x23')]=_0x429258[_0x0996('0x5f')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x429258['WhatsappInteractionId']}});}return null;})[_0x0996('0x31')](handleEntityNotFound(_0x368e90,null))[_0x0996('0x31')](function(_0xc7bc01){if(_0xc7bc01){return _0xc7bc01['update']({'UserId':_0x5ed646[_0x0996('0x52')]['UserId'],'read1stAt':_[_0x0996('0x60')](_0xc7bc01[_0x0996('0x61')])?moment()[_0x0996('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0996('0x31')](function(_0x20f192){if(_0x20f192){_0x1960f3[_0x0996('0x62')]=_0x20f192[_0x0996('0x5f')]({'plain':!![]});interaction_log['info'](_0x0996('0x63'),_0x5ed646[_0x0996('0x5d')]['id'],_0x5ed646[_0x0996('0x5d')][_0x0996('0x34')],_0x5ed646[_0x0996('0x5d')][_0x0996('0x64')],_0x1960f3[_0x0996('0x62')]['id'],_0x5ed646[_0x0996('0x52')]?JSON['stringify'](_0x5ed646[_0x0996('0x52')]):_0x0996('0x65'));return respondWithRpcPromise(_0x0996('0x66'),_0x0996('0x67'),_0x1960f3);}return null;})[_0x0996('0x31')](function(_0x4b3031){var _0xa4cd64=_0x0996('0x68')+_0x4b3031[_0x0996('0x23')][_0x0996('0x69')];return db['sequelize']['query'](_0xa4cd64,{'type':db[_0x0996('0x6a')]['QueryTypes'][_0x0996('0x6b')],'raw':!![]})[_0x0996('0x31')](function(_0x5c45da){return _0x5c45da;});})[_0x0996('0x31')](function(_0x5f18b1){if(_0x5f18b1){_0x1960f3[_0x0996('0x23')]['contact']=_0x5f18b1[0x0];if(!_0x5ed646['body'][_0x0996('0x5c')])return;return db[_0x0996('0x6c')]['find']({'where':{'id':_0x5ed646[_0x0996('0x52')][_0x0996('0x5c')],'role':_0x0996('0x5e')},'attributes':['id',_0x0996('0x34'),_0x0996('0x6d'),_0x0996('0x6e'),'internal'],'raw':!![]});}return null;})[_0x0996('0x31')](function(_0x51ba39){if(!_0x51ba39)return null;_0x1960f3['message'][_0x0996('0x5e')]=_0x51ba39;return _0x1960f3;})['then'](function(_0x4c122a){if(_0x4c122a){if(_0x5ed646[_0x0996('0x52')][_0x0996('0x6f')]){_0x1960f3[_0x0996('0x23')][_0x0996('0x70')]=util[_0x0996('0x5a')](_0x0996('0x71'),_0x5ed646['user']['name']);_0x1960f3[_0x0996('0x23')]['channel']=_0x1960f3['channel'];_0x1960f3['message']['motionChannel']=_0x1960f3['channel'];_0x1960f3['message'][_0x0996('0x72')]=_0x0996('0x57');return respondWithRpcPromise(_0x0996('0x73'),_0x0996('0x73'),{'event':'acceptmessage','message':_0x1960f3[_0x0996('0x23')]},client9002)[_0x0996('0x31')](function(){return _0x1960f3;});}return _0x1960f3;}return null;})[_0x0996('0x31')](respondWithResult(_0x368e90,null))[_0x0996('0x25')](handleError(_0x368e90,null));};var interaction_log=require(_0x0996('0x12'))(_0x0996('0x56'));exports['reject']=function(_0x4c78ef,_0x328e1c,_0x36aa43){var _0x3ac46b={'agent':{},'channel':_0x0996('0x58')};if(_0x4c78ef[_0x0996('0x52')]['id']){delete _0x4c78ef['body']['id'];}_0x4c78ef['body'][_0x0996('0x5c')]=_0x4c78ef['body'][_0x0996('0x5c')]||_0x4c78ef['user']['id'];_0x3ac46b['agent']['id']=_0x4c78ef['body'][_0x0996('0x5c')];return db[_0x0996('0x49')]['find']({'where':{'id':_0x4c78ef['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x328e1c,null))[_0x0996('0x31')](function(_0x1920ac){if(_0x1920ac){_0x3ac46b['message']=_0x1920ac[_0x0996('0x5f')]({'plain':!![]});return db[_0x0996('0x74')]['find']({'where':{'id':_0x1920ac[_0x0996('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x328e1c,null))['then'](function(_0x2034bb){if(_0x2034bb){_0x3ac46b[_0x0996('0x62')]=_0x2034bb['get']({'plain':!![]});interaction_log[_0x0996('0x1d')](_0x0996('0x76'),_0x4c78ef[_0x0996('0x5d')]['id'],_0x4c78ef[_0x0996('0x5d')][_0x0996('0x34')],_0x4c78ef[_0x0996('0x5d')][_0x0996('0x64')],_0x3ac46b[_0x0996('0x62')]['id'],_0x4c78ef[_0x0996('0x52')]?JSON['stringify'](_0x4c78ef['body']):_0x0996('0x65'));return respondWithRpcPromise(_0x0996('0x77'),_0x0996('0x78'),_0x3ac46b);}return null;})[_0x0996('0x31')](function(_0x2e24e9){var _0xf67e61='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e24e9[_0x0996('0x23')][_0x0996('0x69')];return db[_0x0996('0x79')][_0x0996('0x3a')](_0xf67e61,{'type':db[_0x0996('0x6a')][_0x0996('0x7a')][_0x0996('0x6b')],'raw':!![]})[_0x0996('0x31')](function(_0x328323){return _0x328323;});})[_0x0996('0x31')](function(_0x1121e4){if(_0x1121e4){_0x3ac46b['message'][_0x0996('0x7b')]=_0x1121e4[0x0];if(!_0x4c78ef[_0x0996('0x52')][_0x0996('0x5c')])return;return db[_0x0996('0x6c')][_0x0996('0x53')]({'where':{'id':_0x4c78ef[_0x0996('0x52')]['UserId'],'role':_0x0996('0x5e')},'attributes':['id',_0x0996('0x34'),'fullname',_0x0996('0x6e'),'internal'],'raw':!![]});}return null;})[_0x0996('0x31')](function(_0x45b2cc){if(!_0x45b2cc)return null;_0x3ac46b['message']['agent']=_0x45b2cc;return _0x3ac46b;})[_0x0996('0x31')](function(_0x27b033){if(_0x27b033){_0x27b033[_0x0996('0x23')]['interface']=util[_0x0996('0x5a')](_0x0996('0x71'),_0x4c78ef[_0x0996('0x5d')][_0x0996('0x34')]);_0x27b033[_0x0996('0x23')][_0x0996('0x7c')]=_0x3ac46b[_0x0996('0x7c')];_0x27b033[_0x0996('0x23')][_0x0996('0x7d')]=_0x3ac46b[_0x0996('0x7c')];_0x27b033[_0x0996('0x23')][_0x0996('0x72')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x0996('0x7e'),'message':_0x27b033[_0x0996('0x23')]},client9002);return _0x3ac46b;}return null;})[_0x0996('0x31')](respondWithResult(_0x328e1c,null))['catch'](handleError(_0x328e1c,null));};exports[_0x0996('0x27')]=function(_0x1aa4de,_0x317418,_0x35b960){if(_0x1aa4de['body']['id']){delete _0x1aa4de[_0x0996('0x52')]['id'];}var _0x36b2fe;return db['WhatsappMessage']['find']({'where':{'id':_0x1aa4de[_0x0996('0x54')]['id']}})[_0x0996('0x31')](handleEntityNotFound(_0x317418,null))[_0x0996('0x31')](function(_0x9c9598){if(_0x9c9598){_0x36b2fe=_0x9c9598;return db['WhatsappAccount'][_0x0996('0x53')]({'where':{'id':_0x9c9598[_0x0996('0x7f')]}});}})[_0x0996('0x31')](handleEntityNotFound(_0x317418,null))['then'](function(_0x2792bd){if(_0x2792bd){logger[_0x0996('0x20')](_0x0996('0x80'),_0x0996('0x27'),_0x0996('0x81'),_0x2792bd[_0x0996('0x38')],util[_0x0996('0x82')](_0x1aa4de[_0x0996('0x52')],{'showHidden':![],'depth':null}));switch(_0x2792bd[_0x0996('0x38')]){case'twilio':if(_0x1aa4de[_0x0996('0x52')][_0x0996('0x83')]&&_0x1aa4de[_0x0996('0x52')]['MessageSid']===_0x36b2fe[_0x0996('0x84')]&&_0x1aa4de['body'][_0x0996('0x85')]&&_0x1aa4de[_0x0996('0x52')][_0x0996('0x85')]===_0x0996('0x86')){return _0x36b2fe[_0x0996('0x30')]({'read':!![]});}else{logger['error'](_0x0996('0x87'),'status',_0x0996('0x88'),util[_0x0996('0x82')](_0x1aa4de[_0x0996('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x36b2fe;}})[_0x0996('0x31')](respondWithResult(_0x317418,null))[_0x0996('0x25')](handleError(_0x317418,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ad984e0..253969e 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 _0x55f1=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4290f2,_0x245b14){var _0x3f4cc9=function(_0x4ceacd){while(--_0x4ceacd){_0x4290f2['push'](_0x4290f2['shift']());}};_0x3f4cc9(++_0x245b14);}(_0x55f1,0x9b));var _0x155f=function(_0x4499d2,_0x4edac2){_0x4499d2=_0x4499d2-0x0;var _0x4b1485=_0x55f1[_0x4499d2];return _0x4b1485;};'use strict';var EventEmitter=require(_0x155f('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x155f('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x155f('0x2')](0x0);var events={'afterCreate':_0x155f('0x3'),'afterUpdate':_0x155f('0x4'),'afterDestroy':_0x155f('0x5')};function emitEvent(_0x13e2af){return function(_0x2089cc,_0x5c3d6c,_0x5cd807){WhatsappMessageEvents[_0x155f('0x6')](_0x13e2af+':'+_0x2089cc['id'],_0x2089cc);WhatsappMessageEvents['emit'](_0x13e2af,_0x2089cc);_0x5cd807(null);};}for(var e in events){if(events[_0x155f('0x7')](e)){var event=events[e];WhatsappMessage[_0x155f('0x8')](e,emitEvent(event));}}module[_0x155f('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0xed3c=['WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3a420f,_0x8f3a3b){var _0x5c96b9=function(_0xe1c2b1){while(--_0xe1c2b1){_0x3a420f['push'](_0x3a420f['shift']());}};_0x5c96b9(++_0x8f3a3b);}(_0xed3c,0x1a6));var _0xced3=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xed3c[_0x294b6];return _0x38bb97;};'use strict';var EventEmitter=require(_0xced3('0x0'));var WhatsappMessage=require(_0xced3('0x1'))['db'][_0xced3('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xced3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xced3('0x4'),'afterDestroy':_0xced3('0x5')};function emitEvent(_0x14488e){return function(_0x5f03e0,_0x51e500,_0x3d3aa0){WhatsappMessageEvents[_0xced3('0x6')](_0x14488e+':'+_0x5f03e0['id'],_0x5f03e0);WhatsappMessageEvents[_0xced3('0x6')](_0x14488e,_0x5f03e0);_0x3d3aa0(null);};}for(var e in events){if(events[_0xced3('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 6b66794..b6f6a88 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 _0xde9f=['sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xde9f,0x16d));var _0xfde9=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0xde9f[_0x28d225];return _0x1f79e1;};'use strict';var _=require(_0xfde9('0x0'));var util=require(_0xfde9('0x1'));var logger=require('../../config/logger')(_0xfde9('0x2'));var moment=require('moment');var BPromise=require(_0xfde9('0x3'));var rp=require(_0xfde9('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xfde9('0x5'));var rimraf=require(_0xfde9('0x6'));var config=require(_0xfde9('0x7'));var attributes=require(_0xfde9('0x8'));module['exports']=function(_0x506122,_0x48d38d){return _0x506122[_0xfde9('0x9')](_0xfde9('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xfde9('0xb'),'fields':['messageId']},{'name':_0xfde9('0xc'),'fields':[_0xfde9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x408148,_0x3cdb94,_0xe8a94b){var _0x19a902=_0x506122[_0xfde9('0xe')];var _0x5d682b=_0x408148[_0xfde9('0xf')]({'plain':!![]});if(_0x5d682b[_0xfde9('0x10')][_0xfde9('0x11')]()==='in'||_0x5d682b[_0xfde9('0x10')][_0xfde9('0x11')]()===_0xfde9('0x12')&&!_0x5d682b['secret']&&!_[_0xfde9('0x13')](_0x5d682b['UserId'])){_0x19a902[_0xfde9('0x14')][_0xfde9('0x15')]({'where':{'id':_0x5d682b[_0xfde9('0x16')]}})['then'](function(_0x200ef6){if(_0x200ef6){_0x200ef6[_0xfde9('0x17')]({'lastMsgAt':_0x5d682b[_0xfde9('0x18')],'lastMsgDirection':_0x5d682b[_0xfde9('0x10')]['toLowerCase']()});}})[_0xfde9('0x19')](function(_0x196e80){console['error'](_0x196e80);});}if(_0x5d682b[_0xfde9('0x10')]==='out'&&!_0x5d682b['secret']){var _0x451061;_0x19a902[_0xfde9('0x1a')][_0xfde9('0x1b')]({'where':{'id':_0x5d682b[_0xfde9('0x1c')]},'raw':!![]})[_0xfde9('0x1d')](function(_0x207b7b){_0x451061=_0x207b7b;if(_0x451061&&_0x451061[_0xfde9('0x1e')]){switch(_0x451061[_0xfde9('0x1e')]){case _0xfde9('0x1f'):var _0xa2072d=require(_0xfde9('0x1f'));if(_0x451061[_0xfde9('0x20')]&&_0x451061[_0xfde9('0x21')]&&_0x451061[_0xfde9('0x22')]){var _0x290328=new _0xa2072d(_0x451061[_0xfde9('0x20')],_0x451061['authToken']);_0x290328[_0xfde9('0x23')][_0xfde9('0x24')]({'body':_0x5d682b[_0xfde9('0xd')],'to':'whatsapp:'+_0x5d682b[_0xfde9('0x22')],'from':_0xfde9('0x25')+_0x451061[_0xfde9('0x22')],'statusCallback':_0x451061[_0xfde9('0x26')]+'/api/whatsapp/messages/'+_0x5d682b['id']+_0xfde9('0x27')+_0x451061[_0xfde9('0x28')]})[_0xfde9('0x1d')](function(_0x5c888a){if(_0x5c888a[_0xfde9('0x29')]){return _0x408148[_0xfde9('0x17')]({'messageId':_0x5c888a[_0xfde9('0x29')]});}})[_0xfde9('0x19')](function(_0x2f4b3e){logger[_0xfde9('0x2a')](_0xfde9('0x2b'),_0xfde9('0x2c'),'twilio',util[_0xfde9('0x2d')](_0x2f4b3e,{'showHidden':![],'depth':null}));});}else{logger[_0xfde9('0x2a')](_0xfde9('0x2b'),_0xfde9('0x2c'),_0xfde9('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xfde9('0x2e'):var _0x366dcd=_0x451061[_0xfde9('0x20')];var _0x41f70c=_0x451061[_0xfde9('0x21')];var _0x455b7b=_0x451061[_0xfde9('0x2f')]+_0xfde9('0x30')+_0x366dcd+_0xfde9('0x31');var _0x554ea0={'to':[_0x5d682b[_0xfde9('0x22')]],'message':{'type':_0xfde9('0x32'),'text':_0x5d682b[_0xfde9('0xd')]}};var _0x345445={'method':'POST','uri':_0x455b7b,'headers':{'Authorization':_0xfde9('0x33')+_0x41f70c,'Content-Type':'application/json'},'body':_0x554ea0,'json':!![]};rp(_0x345445)[_0xfde9('0x1d')](function(_0x30dd29){if(_0x30dd29[_0xfde9('0x34')][0x0][_0xfde9('0x35')]){return _0x408148[_0xfde9('0x17')]({'messageId':_0x30dd29['statuses'][0x0][_0xfde9('0x35')]});}})[_0xfde9('0x19')](function(_0x27edc9){logger[_0xfde9('0x36')]('WhatsappMessage,\x20%s',_0x27edc9);});break;}}})[_0xfde9('0x37')](function(){_0xe8a94b();});}else{_0xe8a94b();}}},'charset':_0xfde9('0x38'),'collate':_0xfde9('0x39')});}; \ No newline at end of file +var _0x7266=['sinch','baseUrl','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','node-fetch','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','out','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x5d1f9a,_0x3c75fd){var _0x864ff7=function(_0x388bdc){while(--_0x388bdc){_0x5d1f9a['push'](_0x5d1f9a['shift']());}};_0x864ff7(++_0x3c75fd);}(_0x7266,0xec));var _0x6726=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7266[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var logger=require(_0x6726('0x2'))(_0x6726('0x3'));var moment=require(_0x6726('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x6726('0x5'));var fs=require('fs');var path=require(_0x6726('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6726('0x7'));module[_0x6726('0x8')]=function(_0x1c2cfd,_0x180502){return _0x1c2cfd[_0x6726('0x9')](_0x6726('0xa'),attributes,{'tableName':_0x6726('0xb'),'paranoid':![],'indexes':[{'name':_0x6726('0xc'),'fields':[_0x6726('0xc')]},{'name':_0x6726('0xd'),'fields':[_0x6726('0xe')],'type':_0x6726('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdda3e6,_0x5e8efb,_0x44ff0c){var _0x1265e8=_0x1c2cfd[_0x6726('0x10')];var _0x16786f=_0xdda3e6['get']({'plain':!![]});if(_0x16786f[_0x6726('0x11')]['toLowerCase']()==='in'||_0x16786f[_0x6726('0x11')][_0x6726('0x12')]()==='out'&&!_0x16786f[_0x6726('0x13')]&&!_[_0x6726('0x14')](_0x16786f[_0x6726('0x15')])){_0x1265e8[_0x6726('0x16')]['findOne']({'where':{'id':_0x16786f[_0x6726('0x17')]}})[_0x6726('0x18')](function(_0x4dc47d){if(_0x4dc47d){_0x4dc47d[_0x6726('0x19')]({'lastMsgAt':_0x16786f['createdAt'],'lastMsgDirection':_0x16786f[_0x6726('0x11')][_0x6726('0x12')]()});}})[_0x6726('0x1a')](function(_0x3a3b6a){console['error'](_0x3a3b6a);});}if(_0x16786f[_0x6726('0x11')]===_0x6726('0x1b')&&!_0x16786f['secret']){var _0x153832;_0x1265e8['WhatsappAccount']['find']({'where':{'id':_0x16786f['WhatsappAccountId']},'raw':!![]})[_0x6726('0x18')](function(_0x2e9d00){_0x153832=_0x2e9d00;if(_0x153832&&_0x153832['type']){switch(_0x153832[_0x6726('0x1c')]){case _0x6726('0x1d'):var _0x27562c=require(_0x6726('0x1d'));if(_0x153832[_0x6726('0x1e')]&&_0x153832[_0x6726('0x1f')]&&_0x153832['phone']){var _0x300e56=new _0x27562c(_0x153832['accountSid'],_0x153832[_0x6726('0x1f')]);_0x300e56[_0x6726('0x20')][_0x6726('0x21')]({'body':_0x16786f[_0x6726('0xe')],'to':_0x6726('0x22')+_0x16786f[_0x6726('0x23')],'from':'whatsapp:'+_0x153832[_0x6726('0x23')],'statusCallback':_0x153832[_0x6726('0x24')]+_0x6726('0x25')+_0x16786f['id']+_0x6726('0x26')+_0x153832['token']})[_0x6726('0x18')](function(_0x48373b){if(_0x48373b['sid']){return _0xdda3e6[_0x6726('0x19')]({'messageId':_0x48373b[_0x6726('0x27')]});}})[_0x6726('0x1a')](function(_0x3b0abf){logger['error'](_0x6726('0x28'),_0x6726('0x29'),_0x6726('0x1d'),util['inspect'](_0x3b0abf,{'showHidden':![],'depth':null}));});}else{logger[_0x6726('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x6726('0x2b'));}break;case _0x6726('0x2c'):var _0x199af0=_0x153832[_0x6726('0x1e')];var _0x5156ae=_0x153832[_0x6726('0x1f')];var _0x119cb0=_0x153832[_0x6726('0x2d')]+'/whatsapp/v1/'+_0x199af0+_0x6726('0x2e');var _0xcf8209={'to':[_0x16786f['phone']],'message':{'type':_0x6726('0x2f'),'text':_0x16786f[_0x6726('0xe')]}};var _0x385bda={'method':_0x6726('0x30'),'uri':_0x119cb0,'headers':{'Authorization':_0x6726('0x31')+_0x5156ae,'Content-Type':_0x6726('0x32')},'body':_0xcf8209,'json':!![]};rp(_0x385bda)[_0x6726('0x18')](function(_0x4a3cf){if(_0x4a3cf['statuses'][0x0][_0x6726('0x33')]){return _0xdda3e6[_0x6726('0x19')]({'messageId':_0x4a3cf[_0x6726('0x34')][0x0][_0x6726('0x33')]});}})[_0x6726('0x1a')](function(_0x2b1c64){logger[_0x6726('0x35')](_0x6726('0x36'),_0x2b1c64);});break;}}})['finally'](function(){_0x44ff0c();});}else{_0x44ff0c();}}},'charset':'utf8mb4','collate':_0x6726('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a946a53..cb4f21a 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 _0xbd37=['client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','WhatsappMessage','create','body','options','raw','catch','CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e9f5f,_0x56b80b){var _0x5bdc62=function(_0x34edc2){while(--_0x34edc2){_0x2e9f5f['push'](_0x2e9f5f['shift']());}};_0x5bdc62(++_0x56b80b);}(_0xbd37,0x1ed));var _0x7bd3=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0xbd37[_0x291ec3];return _0x423b99;};'use strict';var _=require(_0x7bd3('0x0'));var util=require(_0x7bd3('0x1'));var moment=require('moment');var BPromise=require(_0x7bd3('0x2'));var rs=require(_0x7bd3('0x3'));var fs=require('fs');var Redis=require(_0x7bd3('0x4'));var db=require(_0x7bd3('0x5'))['db'];var utils=require(_0x7bd3('0x6'));var logger=require(_0x7bd3('0x7'))(_0x7bd3('0x8'));var config=require(_0x7bd3('0x9'));var jayson=require(_0x7bd3('0xa'));var client=jayson[_0x7bd3('0xb')][_0x7bd3('0xc')]({'port':0x232a});config[_0x7bd3('0xd')]=_[_0x7bd3('0xe')](config[_0x7bd3('0xd')],{'host':_0x7bd3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bd3('0xd')]));require(_0x7bd3('0x10'))[_0x7bd3('0x11')](socket);function respondWithRpcPromise(_0x5909fd,_0x438f78,_0x4c9be6){return new BPromise(function(_0x144ba2,_0x3333c9){return client[_0x7bd3('0x12')](_0x5909fd,_0x4c9be6)[_0x7bd3('0x13')](function(_0x4fef8d){logger['info'](_0x7bd3('0x14'),_0x438f78,_0x7bd3('0x15'));logger[_0x7bd3('0x16')](_0x7bd3('0x17'),_0x438f78,_0x7bd3('0x15'),JSON[_0x7bd3('0x18')](_0x4fef8d));if(_0x4fef8d[_0x7bd3('0x19')]){if(_0x4fef8d['error'][_0x7bd3('0x1a')]===0x1f4){logger[_0x7bd3('0x19')](_0x7bd3('0x14'),_0x438f78,_0x4fef8d[_0x7bd3('0x19')][_0x7bd3('0x1b')]);return _0x3333c9(_0x4fef8d['error'][_0x7bd3('0x1b')]);}logger[_0x7bd3('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x438f78,_0x4fef8d[_0x7bd3('0x19')][_0x7bd3('0x1b')]);return _0x144ba2(_0x4fef8d[_0x7bd3('0x19')]['message']);}else{logger[_0x7bd3('0x1c')]('WhatsappMessage,\x20%s,\x20%s',_0x438f78,_0x7bd3('0x15'));_0x144ba2(_0x4fef8d['result'][_0x7bd3('0x1b')]);}})['catch'](function(_0x480573){logger[_0x7bd3('0x19')](_0x7bd3('0x14'),_0x438f78,_0x480573);_0x3333c9(_0x480573);});});}exports['CreateWhatsappMessage']=function(_0x21d680){var _0x458f3e=this;return new Promise(function(_0x5840c5,_0x2453fd){return db[_0x7bd3('0x1d')][_0x7bd3('0x1e')](_0x21d680[_0x7bd3('0x1f')],{'raw':_0x21d680[_0x7bd3('0x20')]?_0x21d680[_0x7bd3('0x20')][_0x7bd3('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x47ba04){logger[_0x7bd3('0x1c')]('CreateWhatsappMessage',_0x21d680);logger[_0x7bd3('0x16')]('CreateWhatsappMessage',_0x21d680,JSON['stringify'](_0x47ba04));_0x5840c5(_0x47ba04);})[_0x7bd3('0x22')](function(_0x40e900){logger[_0x7bd3('0x19')](_0x7bd3('0x23'),_0x40e900['message'],_0x21d680);_0x2453fd(_0x458f3e[_0x7bd3('0x19')](0x1f4,_0x40e900[_0x7bd3('0x1b')]));});});}; \ No newline at end of file +var _0x8421=['lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x25061e,_0xf822a9){var _0xc65a3c=function(_0x19baa7){while(--_0x19baa7){_0x25061e['push'](_0x25061e['shift']());}};_0xc65a3c(++_0xf822a9);}(_0x8421,0x70));var _0x1842=function(_0x1a06ab,_0x3e8061){_0x1a06ab=_0x1a06ab-0x0;var _0x1ebd32=_0x8421[_0x1a06ab];return _0x1ebd32;};'use strict';var _=require(_0x1842('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1842('0x1'));var fs=require('fs');var Redis=require(_0x1842('0x2'));var db=require(_0x1842('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1842('0x4'))('rpc');var config=require(_0x1842('0x5'));var jayson=require(_0x1842('0x6'));var client=jayson[_0x1842('0x7')]['http']({'port':0x232a});config[_0x1842('0x8')]=_['defaults'](config[_0x1842('0x8')],{'host':_0x1842('0x9'),'port':0x18eb});var socket=require(_0x1842('0xa'))(new Redis(config[_0x1842('0x8')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a3792,_0x45646c,_0x3cc38d){return new BPromise(function(_0x524ed1,_0x59b8c1){return client['request'](_0x2a3792,_0x3cc38d)[_0x1842('0xb')](function(_0xbfffeb){logger[_0x1842('0xc')]('WhatsappMessage,\x20%s,\x20%s',_0x45646c,'request\x20sent');logger[_0x1842('0xd')](_0x1842('0xe'),_0x45646c,_0x1842('0xf'),JSON[_0x1842('0x10')](_0xbfffeb));if(_0xbfffeb[_0x1842('0x11')]){if(_0xbfffeb[_0x1842('0x11')][_0x1842('0x12')]===0x1f4){logger[_0x1842('0x11')](_0x1842('0x13'),_0x45646c,_0xbfffeb[_0x1842('0x11')]['message']);return _0x59b8c1(_0xbfffeb[_0x1842('0x11')][_0x1842('0x14')]);}logger[_0x1842('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x45646c,_0xbfffeb[_0x1842('0x11')]['message']);return _0x524ed1(_0xbfffeb[_0x1842('0x11')][_0x1842('0x14')]);}else{logger['info'](_0x1842('0x13'),_0x45646c,'request\x20sent');_0x524ed1(_0xbfffeb[_0x1842('0x15')]['message']);}})[_0x1842('0x16')](function(_0x519a24){logger[_0x1842('0x11')](_0x1842('0x13'),_0x45646c,_0x519a24);_0x59b8c1(_0x519a24);});});}exports[_0x1842('0x17')]=function(_0xbb34f5){var _0x26d294=this;return new Promise(function(_0x6f9fe8,_0x3a776f){return db[_0x1842('0x18')][_0x1842('0x19')](_0xbb34f5[_0x1842('0x1a')],{'raw':_0xbb34f5[_0x1842('0x1b')]?_0xbb34f5[_0x1842('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51325d){logger[_0x1842('0xc')](_0x1842('0x17'),_0xbb34f5);logger[_0x1842('0xd')](_0x1842('0x17'),_0xbb34f5,JSON[_0x1842('0x10')](_0x51325d));_0x6f9fe8(_0x51325d);})[_0x1842('0x16')](function(_0x5db623){logger[_0x1842('0x11')](_0x1842('0x17'),_0x5db623[_0x1842('0x14')],_0xbb34f5);_0x3a776f(_0x26d294[_0x1842('0x11')](0x1f4,_0x5db623[_0x1842('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6ea951b..74661ff 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 _0x9e8d=['remove','update','emit','length','whatsappMessage:','save'];(function(_0x2600c7,_0xb9a210){var _0x39ecb3=function(_0x316613){while(--_0x316613){_0x2600c7['push'](_0x2600c7['shift']());}};_0x39ecb3(++_0xb9a210);}(_0x9e8d,0x6b));var _0xd9e8=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x9e8d[_0x46aff0];return _0x9d78cf;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd9e8('0x0'),_0xd9e8('0x1'),_0xd9e8('0x2')];function createListener(_0x247ee0,_0x25023){return function(_0x287384){_0x25023[_0xd9e8('0x3')](_0x247ee0,_0x287384);};}function removeListener(_0x4a395f,_0x52916b){return function(){WhatsappMessageEvents['removeListener'](_0x4a395f,_0x52916b);};}exports['register']=function(_0x1a3297){for(var _0x591fc0=0x0,_0x2735b9=events[_0xd9e8('0x4')];_0x591fc0<_0x2735b9;_0x591fc0++){var _0xeacd92=events[_0x591fc0];var _0x49ad09=createListener(_0xd9e8('0x5')+_0xeacd92,_0x1a3297);WhatsappMessageEvents['on'](_0xeacd92,_0x49ad09);}}; \ No newline at end of file +var _0xf95e=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x8d1720,_0x1abeaa){var _0xee362a=function(_0x58e6ac){while(--_0x58e6ac){_0x8d1720['push'](_0x8d1720['shift']());}};_0xee362a(++_0x1abeaa);}(_0xf95e,0x125));var _0xef95=function(_0x48c069,_0x553ea7){_0x48c069=_0x48c069-0x0;var _0xf7514c=_0xf95e[_0x48c069];return _0xf7514c;};'use strict';var WhatsappMessageEvents=require(_0xef95('0x0'));var events=[_0xef95('0x1'),_0xef95('0x2'),_0xef95('0x3')];function createListener(_0x5a93fb,_0x27235b){return function(_0x52c6c7){_0x27235b[_0xef95('0x4')](_0x5a93fb,_0x52c6c7);};}function removeListener(_0x5e2630,_0x34ccf3){return function(){WhatsappMessageEvents[_0xef95('0x5')](_0x5e2630,_0x34ccf3);};}exports[_0xef95('0x6')]=function(_0x413fea){for(var _0xfdf2d3=0x0,_0x3fc229=events[_0xef95('0x7')];_0xfdf2d3<_0x3fc229;_0xfdf2d3++){var _0x47013a=events[_0xfdf2d3];var _0x367e54=createListener(_0xef95('0x8')+_0x47013a,_0x413fea);WhatsappMessageEvents['on'](_0x47013a,_0x367e54);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d387076..340584b 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 _0x523e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x4511e6,_0x2c3afe){var _0x573951=function(_0x24f895){while(--_0x24f895){_0x4511e6['push'](_0x4511e6['shift']());}};_0x573951(++_0x2c3afe);}(_0x523e,0x146));var _0xe523=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x523e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xe523('0x0'));var util=require(_0xe523('0x1'));var path=require(_0xe523('0x2'));var timeout=require(_0xe523('0x3'));var express=require(_0xe523('0x4'));var router=express[_0xe523('0x5')]();var fs_extra=require(_0xe523('0x6'));var auth=require(_0xe523('0x7'));var interaction=require(_0xe523('0x8'));var config=require(_0xe523('0x9'));var controller=require('./whatsappQueue.controller');router[_0xe523('0xa')]('/',auth[_0xe523('0xb')](),controller['index']);router['get']('/describe',auth[_0xe523('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe523('0xc')]);router[_0xe523('0xa')](_0xe523('0xd'),auth[_0xe523('0xb')](),controller[_0xe523('0xe')]);router[_0xe523('0xa')](_0xe523('0xf'),auth[_0xe523('0xb')](),controller['getTeams']);router['get'](_0xe523('0x10'),auth['isAuthenticated'](),controller[_0xe523('0x11')]);router[_0xe523('0x12')]('/',auth[_0xe523('0xb')](),controller[_0xe523('0x13')]);router['post']('/:id/teams',auth[_0xe523('0xb')](),controller[_0xe523('0x14')]);router[_0xe523('0x12')](_0xe523('0x10'),auth['isAuthenticated'](),controller[_0xe523('0x15')]);router[_0xe523('0x16')](_0xe523('0x17'),auth[_0xe523('0xb')](),controller[_0xe523('0x18')]);router[_0xe523('0x19')](_0xe523('0x17'),auth[_0xe523('0xb')](),controller[_0xe523('0x1a')]);router[_0xe523('0x19')](_0xe523('0xf'),auth[_0xe523('0xb')](),controller[_0xe523('0x1b')]);router[_0xe523('0x19')](_0xe523('0x10'),auth['isAuthenticated'](),controller[_0xe523('0x1c')]);module[_0xe523('0x1d')]=router; \ No newline at end of file +var _0x8486=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addAgents','/:id','update','delete','destroy','removeTeams','exports'];(function(_0x523671,_0x4657fc){var _0x5b0bdc=function(_0x301007){while(--_0x301007){_0x523671['push'](_0x523671['shift']());}};_0x5b0bdc(++_0x4657fc);}(_0x8486,0x70));var _0x6848=function(_0x207ba8,_0x343c30){_0x207ba8=_0x207ba8-0x0;var _0x1f933d=_0x8486[_0x207ba8];return _0x1f933d;};'use strict';var multer=require(_0x6848('0x0'));var util=require(_0x6848('0x1'));var path=require(_0x6848('0x2'));var timeout=require('connect-timeout');var express=require(_0x6848('0x3'));var router=express[_0x6848('0x4')]();var fs_extra=require(_0x6848('0x5'));var auth=require(_0x6848('0x6'));var interaction=require(_0x6848('0x7'));var config=require(_0x6848('0x8'));var controller=require('./whatsappQueue.controller');router[_0x6848('0x9')]('/',auth[_0x6848('0xa')](),controller[_0x6848('0xb')]);router['get'](_0x6848('0xc'),auth[_0x6848('0xa')](),controller[_0x6848('0xd')]);router[_0x6848('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6848('0xe')]);router['get'](_0x6848('0xf'),auth[_0x6848('0xa')](),controller['getMembers']);router[_0x6848('0x9')](_0x6848('0x10'),auth[_0x6848('0xa')](),controller['getTeams']);router['get'](_0x6848('0x11'),auth[_0x6848('0xa')](),controller[_0x6848('0x12')]);router[_0x6848('0x13')]('/',auth[_0x6848('0xa')](),controller[_0x6848('0x14')]);router[_0x6848('0x13')](_0x6848('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x6848('0x13')]('/:id/users',auth[_0x6848('0xa')](),controller[_0x6848('0x15')]);router['put'](_0x6848('0x16'),auth[_0x6848('0xa')](),controller[_0x6848('0x17')]);router[_0x6848('0x18')](_0x6848('0x16'),auth[_0x6848('0xa')](),controller[_0x6848('0x19')]);router[_0x6848('0x18')](_0x6848('0x10'),auth[_0x6848('0xa')](),controller[_0x6848('0x1a')]);router['delete'](_0x6848('0x11'),auth[_0x6848('0xa')](),controller['removeAgents']);module[_0x6848('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 13808b0..6f01ce4 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 _0x3360=['STRING','sequelize','exports','ENUM','roundrobin'];(function(_0x2e9754,_0x36d727){var _0xcfb848=function(_0x433286){while(--_0x433286){_0x2e9754['push'](_0x2e9754['shift']());}};_0xcfb848(++_0x36d727);}(_0x3360,0x1d7));var _0x0336=function(_0x348914,_0x59ede3){_0x348914=_0x348914-0x0;var _0x39d759=_0x3360[_0x348914];return _0x39d759;};'use strict';var Sequelize=require(_0x0336('0x0'));module[_0x0336('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0336('0x2')]('rrmemory','beepall',_0x0336('0x3'))},'description':{'type':Sequelize[_0x0336('0x4')]}}; \ No newline at end of file +var _0xf403=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x34ee31,_0x3d0de8){var _0x5e1fea=function(_0x1b54e1){while(--_0x1b54e1){_0x34ee31['push'](_0x34ee31['shift']());}};_0x5e1fea(++_0x3d0de8);}(_0xf403,0x1d3));var _0x3f40=function(_0x56f271,_0x26ff95){_0x56f271=_0x56f271-0x0;var _0x2c58bd=_0xf403[_0x56f271];return _0x2c58bd;};'use strict';var Sequelize=require(_0x3f40('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f40('0x1')],'unique':_0x3f40('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x3f40('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f40('0x4')](_0x3f40('0x5'),_0x3f40('0x6'),_0x3f40('0x7'))},'description':{'type':Sequelize[_0x3f40('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 1a41a20..a037aa3 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 _0x11cb=['fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','describe','findOne','model','UserWhatsappQueue','filters','nolimit','order','sort','pick','filter','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','emit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','get','UserProfileResource','end','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','show','params','keys','attributes','intersection'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0x11cb,0xc4));var _0xb11c=function(_0x4bcec5,_0x4578c1){_0x4bcec5=_0x4bcec5-0x0;var _0x3dfe8d=_0x11cb[_0x4bcec5];return _0x3dfe8d;};'use strict';var BPromise=require(_0xb11c('0x0'));var util=require(_0xb11c('0x1'));var _=require(_0xb11c('0x2'));var squel=require(_0xb11c('0x3'));var Redis=require(_0xb11c('0x4'));var qs=require(_0xb11c('0x5'));var logger=require('../../config/logger')(_0xb11c('0x6'));var config=require('../../config/environment');var db=require(_0xb11c('0x7'))['db'];config[_0xb11c('0x8')]=_[_0xb11c('0x9')](config[_0xb11c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb11c('0xa'))(new Redis(config['redis']));require(_0xb11c('0xb'))[_0xb11c('0xc')](socket);function respondWithStatusCode(_0x978ac7,_0x567f6a){_0x567f6a=_0x567f6a||0xcc;return function(_0x1ec5bb){if(_0x1ec5bb){return _0x978ac7[_0xb11c('0xd')](_0x567f6a);}return _0x978ac7[_0xb11c('0xe')](_0x567f6a)['end']();};}function respondWithResult(_0x30e4b8,_0x4f8cd6){_0x4f8cd6=_0x4f8cd6||0xc8;return function(_0x1fb801){if(_0x1fb801){return _0x30e4b8[_0xb11c('0xe')](_0x4f8cd6)[_0xb11c('0xf')](_0x1fb801);}};}function respondWithFilteredResult(_0x52d489,_0x2c1d0e){return function(_0xf72ea8){if(_0xf72ea8){var _0x5d9bae=typeof _0x2c1d0e[_0xb11c('0x10')]==='undefined'&&typeof _0x2c1d0e[_0xb11c('0x11')]===_0xb11c('0x12');var _0x8cc3be=_0xf72ea8[_0xb11c('0x13')];var _0x635c50=_0x5d9bae?0x0:_0x2c1d0e[_0xb11c('0x10')];var _0x18cfd6=_0x5d9bae?_0xf72ea8['count']:_0x2c1d0e[_0xb11c('0x10')]+_0x2c1d0e[_0xb11c('0x11')];var _0x248e36;if(_0x18cfd6>=_0x8cc3be){_0x18cfd6=_0x8cc3be;_0x248e36=0xc8;}else{_0x248e36=0xce;}_0x52d489[_0xb11c('0xe')](_0x248e36);return _0x52d489[_0xb11c('0x14')](_0xb11c('0x15'),_0x635c50+'-'+_0x18cfd6+'/'+_0x8cc3be)[_0xb11c('0xf')](_0xf72ea8);}return null;};}function saveUpdates(_0x5881e4){return function(_0x512b09){if(_0x512b09){return _0x512b09[_0xb11c('0x16')](_0x5881e4)['then'](function(_0x51b514){return _0x51b514;});}return null;};}function removeEntity(_0x161059){return function(_0x38bea4){if(_0x38bea4){return _0x38bea4[_0xb11c('0x17')]()[_0xb11c('0x18')](function(){var _0x3cadb6=_0x38bea4[_0xb11c('0x19')]({'plain':!![]});var _0xbca260='WhatsappQueues';return db[_0xb11c('0x1a')]['destroy']({'where':{'type':_0xbca260,'resourceId':_0x3cadb6['id']}})[_0xb11c('0x18')](function(){return _0x38bea4;});})[_0xb11c('0x18')](function(){_0x161059[_0xb11c('0xe')](0xcc)[_0xb11c('0x1b')]();});}};}function handleEntityNotFound(_0x29320a){return function(_0x4e060c){if(!_0x4e060c){_0x29320a['sendStatus'](0x194);}return _0x4e060c;};}function handleError(_0x5c6df9,_0x5f6011){_0x5f6011=_0x5f6011||0x1f4;return function(_0x363b16){logger['error'](_0x363b16[_0xb11c('0x1c')]);if(_0x363b16[_0xb11c('0x1d')]){delete _0x363b16[_0xb11c('0x1d')];}_0x5c6df9[_0xb11c('0xe')](_0x5f6011)['send'](_0x363b16);};}exports[_0xb11c('0x1e')]=function(_0x48339e,_0x2865f2){var _0x10b64c={};var _0x37b086={'count':0x0,'rows':[]};var _0x1670c0=_[_0xb11c('0x1f')](db[_0xb11c('0x20')][_0xb11c('0x21')],function(_0x4764d3){return{'name':_0x4764d3[_0xb11c('0x22')],'type':_0x4764d3[_0xb11c('0x23')][_0xb11c('0x24')]};});_0x10b64c=qs[_0xb11c('0x25')](_0x1670c0,_0x48339e);var _0x46fa5a={'where':_0x10b64c[_0xb11c('0x26')]};return db[_0xb11c('0x20')][_0xb11c('0x13')](_0x46fa5a)['then'](function(_0x1271bb){_0x37b086[_0xb11c('0x13')]=_0x1271bb;_0x10b64c['include']=qs[_0xb11c('0x27')](_0x48339e[_0xb11c('0x28')]);return db['WhatsappQueue']['findAll'](_0x10b64c);})[_0xb11c('0x18')](function(_0x4afa08){_0x37b086['rows']=_0x4afa08;return _0x37b086;})['then'](respondWithFilteredResult(_0x2865f2,_0x10b64c))['catch'](handleError(_0x2865f2,null));};exports[_0xb11c('0x29')]=function(_0x3fe012,_0x197eaa){var _0x5868c5={'raw':!![],'where':{'id':_0x3fe012[_0xb11c('0x2a')]['id']}},_0x5573ac={};_0x5573ac['model']=_[_0xb11c('0x2b')](db[_0xb11c('0x20')]['rawAttributes']);_0x5573ac[_0xb11c('0x28')]=_[_0xb11c('0x2b')](_0x3fe012[_0xb11c('0x28')]);_0x5573ac['filters']=_['intersection'](_0x5573ac['model'],_0x5573ac[_0xb11c('0x28')]);_0x5868c5[_0xb11c('0x2c')]=_[_0xb11c('0x2d')](_0x5573ac['model'],qs[_0xb11c('0x2e')](_0x3fe012['query']['fields']));_0x5868c5[_0xb11c('0x2c')]=_0x5868c5[_0xb11c('0x2c')][_0xb11c('0x2f')]?_0x5868c5[_0xb11c('0x2c')]:_0x5573ac['model'];if(_0x3fe012['query'][_0xb11c('0x30')]){_0x5868c5['include']=[{'all':!![]}];}_0x5868c5=_[_0xb11c('0x31')]({},_0x5868c5,_0x3fe012[_0xb11c('0x32')]);return db[_0xb11c('0x20')][_0xb11c('0x33')](_0x5868c5)[_0xb11c('0x18')](handleEntityNotFound(_0x197eaa,null))['then'](respondWithResult(_0x197eaa,null))[_0xb11c('0x34')](handleError(_0x197eaa,null));};exports[_0xb11c('0x35')]=function(_0x2b9b30,_0x3c34e6){return db[_0xb11c('0x20')][_0xb11c('0x35')](_0x2b9b30[_0xb11c('0x36')],{})['then'](function(_0x837bda){var _0x402486=_0x2b9b30[_0xb11c('0x37')][_0xb11c('0x19')]({'plain':!![]});if(!_0x402486)throw new Error(_0xb11c('0x38'));if(_0x402486['role']===_0xb11c('0x37')){var _0x27e6f9=_0x837bda[_0xb11c('0x19')]({'plain':!![]});var _0x1600cc=_0xb11c('0x39');return db[_0xb11c('0x3a')][_0xb11c('0x33')]({'where':{'name':_0x1600cc,'userProfileId':_0x402486[_0xb11c('0x3b')]},'raw':!![]})[_0xb11c('0x18')](function(_0x43ef12){if(_0x43ef12&&_0x43ef12[_0xb11c('0x3c')]===0x0){return db[_0xb11c('0x1a')][_0xb11c('0x35')]({'name':_0x27e6f9[_0xb11c('0x1d')],'resourceId':_0x27e6f9['id'],'type':_0x43ef12[_0xb11c('0x1d')],'sectionId':_0x43ef12['id']},{})[_0xb11c('0x18')](function(){return _0x837bda;});}else{return _0x837bda;}})[_0xb11c('0x34')](function(_0x4d9f2b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d9f2b);throw _0x4d9f2b;});}return _0x837bda;})[_0xb11c('0x18')](respondWithResult(_0x3c34e6,0xc9))[_0xb11c('0x34')](handleError(_0x3c34e6,null));};exports[_0xb11c('0x16')]=function(_0x3ad310,_0x264d70){if(_0x3ad310[_0xb11c('0x36')]['id']){delete _0x3ad310[_0xb11c('0x36')]['id'];}return db[_0xb11c('0x20')][_0xb11c('0x33')]({'where':{'id':_0x3ad310[_0xb11c('0x2a')]['id']}})[_0xb11c('0x18')](handleEntityNotFound(_0x264d70,null))['then'](saveUpdates(_0x3ad310[_0xb11c('0x36')],null))['then'](respondWithResult(_0x264d70,null))[_0xb11c('0x34')](handleError(_0x264d70,null));};exports[_0xb11c('0x17')]=function(_0x3c86e4,_0x7762d9){return db[_0xb11c('0x20')][_0xb11c('0x33')]({'where':{'id':_0x3c86e4[_0xb11c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x7762d9,null))[_0xb11c('0x18')](removeEntity(_0x7762d9,null))[_0xb11c('0x34')](handleError(_0x7762d9,null));};exports['describe']=function(_0x56886f,_0x488370){return db[_0xb11c('0x20')][_0xb11c('0x3d')]()[_0xb11c('0x18')](respondWithResult(_0x488370,null))[_0xb11c('0x34')](handleError(_0x488370,null));};exports['getMembers']=function(_0x3ca4df,_0x367ea3){var _0x3c4761={'raw':!![],'where':{}},_0xecbfcf={},_0x5bc8bb;return db[_0xb11c('0x20')][_0xb11c('0x3e')]({'where':{'id':_0x3ca4df['params']['id']}})[_0xb11c('0x18')](handleEntityNotFound(_0x367ea3,null))['then'](function(_0x561447){if(_0x561447){_0x5bc8bb=_0x561447['get']({'plain':!![]});_0xecbfcf[_0xb11c('0x3f')]=_[_0xb11c('0x2b')](db[_0xb11c('0x40')][_0xb11c('0x21')]);_0xecbfcf[_0xb11c('0x28')]=_[_0xb11c('0x2b')](_0x3ca4df[_0xb11c('0x28')]);_0xecbfcf[_0xb11c('0x41')]=_[_0xb11c('0x2d')](_0xecbfcf[_0xb11c('0x3f')],_0xecbfcf[_0xb11c('0x28')]);_0x3c4761[_0xb11c('0x2c')]=_[_0xb11c('0x2d')](_0xecbfcf[_0xb11c('0x3f')],qs['fields'](_0x3ca4df[_0xb11c('0x28')][_0xb11c('0x2e')]));_0x3c4761['attributes']=_0x3c4761['attributes'][_0xb11c('0x2f')]?_0x3c4761[_0xb11c('0x2c')]:_0xecbfcf['model'];if(!_0x3ca4df[_0xb11c('0x28')]['hasOwnProperty'](_0xb11c('0x42'))){_0x3c4761['limit']=qs[_0xb11c('0x11')](_0x3ca4df[_0xb11c('0x28')][_0xb11c('0x11')]);_0x3c4761[_0xb11c('0x10')]=qs['offset'](_0x3ca4df[_0xb11c('0x28')][_0xb11c('0x10')]);}_0x3c4761[_0xb11c('0x43')]=qs['sort'](_0x3ca4df[_0xb11c('0x28')][_0xb11c('0x44')]);_0x3c4761[_0xb11c('0x26')]=qs['filters'](_[_0xb11c('0x45')](_0x3ca4df[_0xb11c('0x28')],_0xecbfcf[_0xb11c('0x41')]));_0x3c4761[_0xb11c('0x26')]['WhatsappQueueId']=_0x561447['id'];if(_0x3ca4df[_0xb11c('0x28')]['filter']){_0x3c4761[_0xb11c('0x26')]=_['merge'](_0x3c4761['where'],{'$or':_[_0xb11c('0x1f')](_0x3c4761[_0xb11c('0x2c')],function(_0x460fcc){var _0x13ed63={};_0x13ed63[_0x460fcc]={'$like':'%'+_0x3ca4df[_0xb11c('0x28')][_0xb11c('0x46')]+'%'};return _0x13ed63;})});}_0x3c4761=_[_0xb11c('0x31')]({},_0x3c4761,_0x3ca4df['options']);return db['UserWhatsappQueue'][_0xb11c('0x47')](_0x3c4761);}})[_0xb11c('0x18')](function(_0x414df2){if(_0x414df2){return db[_0xb11c('0x48')][_0xb11c('0x49')]({'where':{'id':_[_0xb11c('0x1f')](_0x414df2,_0xb11c('0x4a')),'role':_0xb11c('0x4b')},'attributes':['id',_0xb11c('0x1d'),_0xb11c('0x4c'),_0xb11c('0x4d'),'createdAt']});}})[_0xb11c('0x18')](function(_0x12ac69){if(_0x12ac69){return{'count':_0x12ac69[_0xb11c('0x13')],'rows':_[_0xb11c('0x1f')](_0x12ac69[_0xb11c('0x4e')],function(_0x420443){return{'membername':_0x420443[_0xb11c('0x1d')],'UserId':_0x420443['id'],'queue_name':_0x5bc8bb[_0xb11c('0x1d')],'WhatsappQueueId':_0x5bc8bb['id'],'interface':util[_0xb11c('0x4f')](_0xb11c('0x50'),_0xb11c('0x51'),_0x420443[_0xb11c('0x1d')]),'penalty':0x0,'paused':_0x420443[_0xb11c('0x4c')],'createdAt':_0x420443[_0xb11c('0x52')],'updatedAt':_0x420443[_0xb11c('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb11c('0x18')](respondWithFilteredResult(_0x367ea3,_0x3c4761))[_0xb11c('0x34')](handleError(_0x367ea3,null));};exports[_0xb11c('0x53')]=function(_0x1db9c7,_0x24285f){var _0x5e70b5={};var _0x3b7fe2={};var _0x27aa89;var _0x4278a1;return db['WhatsappQueue'][_0xb11c('0x3e')]({'where':{'id':_0x1db9c7['params']['id']}})['then'](handleEntityNotFound(_0x24285f,null))[_0xb11c('0x18')](function(_0x443fa2){if(_0x443fa2){_0x27aa89=_0x443fa2;_0x3b7fe2[_0xb11c('0x3f')]=_['keys'](db['Team']['rawAttributes']);_0x3b7fe2['query']=_[_0xb11c('0x2b')](_0x1db9c7[_0xb11c('0x28')]);_0x3b7fe2['filters']=_[_0xb11c('0x2d')](_0x3b7fe2[_0xb11c('0x3f')],_0x3b7fe2[_0xb11c('0x28')]);_0x5e70b5['attributes']=_[_0xb11c('0x2d')](_0x3b7fe2[_0xb11c('0x3f')],qs[_0xb11c('0x2e')](_0x1db9c7[_0xb11c('0x28')][_0xb11c('0x2e')]));_0x5e70b5['attributes']=_0x5e70b5[_0xb11c('0x2c')]['length']?_0x5e70b5[_0xb11c('0x2c')]:_0x3b7fe2[_0xb11c('0x3f')];_0x5e70b5[_0xb11c('0x43')]=qs[_0xb11c('0x44')](_0x1db9c7['query'][_0xb11c('0x44')]);_0x5e70b5['where']=qs['filters'](_[_0xb11c('0x45')](_0x1db9c7[_0xb11c('0x28')],_0x3b7fe2[_0xb11c('0x41')]));if(_0x1db9c7['query'][_0xb11c('0x46')]){_0x5e70b5[_0xb11c('0x26')]=_[_0xb11c('0x31')](_0x5e70b5['where'],{'$or':_[_0xb11c('0x1f')](_0x5e70b5['attributes'],function(_0x185b46){var _0xd99385={};_0xd99385[_0x185b46]={'$like':'%'+_0x1db9c7[_0xb11c('0x28')][_0xb11c('0x46')]+'%'};return _0xd99385;})});}_0x5e70b5=_['merge']({},_0x5e70b5,_0x1db9c7['options']);return _0x27aa89['getTeams'](_0x5e70b5);}})[_0xb11c('0x18')](function(_0x314eb0){if(_0x314eb0){_0x4278a1=_0x314eb0[_0xb11c('0x2f')];if(!_0x1db9c7[_0xb11c('0x28')][_0xb11c('0x54')](_0xb11c('0x42'))){_0x5e70b5[_0xb11c('0x11')]=qs['limit'](_0x1db9c7[_0xb11c('0x28')][_0xb11c('0x11')]);_0x5e70b5[_0xb11c('0x10')]=qs['offset'](_0x1db9c7[_0xb11c('0x28')][_0xb11c('0x10')]);}return _0x27aa89[_0xb11c('0x53')](_0x5e70b5);}})['then'](function(_0x3c6dca){if(_0x3c6dca){return _0x3c6dca?{'count':_0x4278a1,'rows':_0x3c6dca}:null;}})[_0xb11c('0x18')](respondWithResult(_0x24285f,null))[_0xb11c('0x34')](handleError(_0x24285f,null));};exports[_0xb11c('0x55')]=function(_0x5bde05,_0x37d726){var _0x19ed05=_0x5bde05[_0xb11c('0x36')][_0xb11c('0x56')];return db[_0xb11c('0x57')]['findAll']({'where':{'id':_0x19ed05},'attributes':['id'],'include':[{'model':db[_0xb11c('0x48')],'as':_0xb11c('0x58'),'attributes':['id',_0xb11c('0x1d'),_0xb11c('0x59'),_0xb11c('0x5a'),_0xb11c('0x5b')],'raw':!![]}]})['then'](function(_0x38280b){if(_0x38280b){var _0x46eb63=_[_0xb11c('0x5c')](_0x38280b,function(_0x15d923){var _0x168099=_0x15d923[_0xb11c('0x19')]({'plain':!![]});return _0x168099[_0xb11c('0x58')];});return db[_0xb11c('0x20')][_0xb11c('0x33')]({'where':{'id':_0x5bde05['params']['id']}})[_0xb11c('0x18')](function(_0xb01a6e){return db[_0xb11c('0x5d')]['transaction'](function(_0x3adf41){return _0xb01a6e[_0xb11c('0x55')](_0x19ed05,{'transaction':_0x3adf41})[_0xb11c('0x18')](function(){return BPromise[_0xb11c('0x5e')](_0x46eb63,function(_0x3f6608){return db[_0xb11c('0x40')][_0xb11c('0x5f')]({'where':{'UserId':_0x3f6608['id'],'WhatsappQueueId':_0x5bde05[_0xb11c('0x2a')]['id']},'transaction':_0x3adf41});});})['then'](function(){_0x46eb63['forEach'](function(_0x3de743){socket['emit'](_0xb11c('0x60'),{'UserId':_0x3de743['id'],'WhatsappQueueId':_0xb01a6e['id']});});});});});}})[_0xb11c('0x18')](respondWithStatusCode(_0x37d726,null))[_0xb11c('0x34')](handleError(_0x37d726,null));};exports[_0xb11c('0x61')]=function(_0x36d5ba,_0x50ac8a){return db[_0xb11c('0x57')][_0xb11c('0x47')]({'where':{'id':_0x36d5ba[_0xb11c('0x28')][_0xb11c('0x56')]},'attributes':['id'],'include':[{'model':db[_0xb11c('0x48')],'as':_0xb11c('0x58'),'attributes':['id'],'raw':!![]}]})[_0xb11c('0x18')](handleEntityNotFound(_0x50ac8a,null))[_0xb11c('0x18')](function(_0x37816a){var _0x35ebb1=_['map'](_0x37816a,'id');var _0x4f3aac=[];var _0x4d14c1=[];var _0x555704=squel[_0xb11c('0x62')]();_0x555704['field']('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0xb11c('0x63')](_0xb11c('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xb11c('0x65'),_0x36d5ba['params']['id']);for(var _0x5bd7c6=0x0;_0x5bd7c6<_0x37816a[_0xb11c('0x2f')];_0x5bd7c6+=0x1){let _0x3752b9=_0x37816a[_0x5bd7c6];for(var _0x2b2938=0x0;_0x2b2938<_0x3752b9[_0xb11c('0x58')]['length'];_0x2b2938+=0x1){let _0x1d59a4=_0x3752b9['Agents'][_0x2b2938];var _0x53f309=_0x555704[_0xb11c('0x66')]();_0x53f309[_0xb11c('0x26')](_0xb11c('0x67'),_0x1d59a4['id']);_0x4d14c1['push'](db[_0xb11c('0x5d')][_0xb11c('0x28')](_0x53f309['toString'](),{'type':db['sequelize'][_0xb11c('0x68')][_0xb11c('0x69')]})[_0xb11c('0x18')](function(_0x402918){if(_0x402918[_0xb11c('0x2f')]===0x1){return _0x1d59a4['id'];}else{var _0x4eb438=_[_0xb11c('0x6a')](_[_0xb11c('0x1f')](_0x402918,_0xb11c('0x6b')),function(_0x228084){return _[_0xb11c('0x6c')](_0x35ebb1,_0x228084);});if(_0x4eb438){return _0x1d59a4['id'];}}}));}}return BPromise[_0xb11c('0x6d')](_0x4d14c1)[_0xb11c('0x18')](function(_0x377701){_0x4f3aac=_(_0x4f3aac)['union'](_0x377701)[_0xb11c('0x6e')]()[_0xb11c('0x6f')]();return db['WhatsappQueue']['find']({'where':{'id':_0x36d5ba[_0xb11c('0x2a')]['id']}})[_0xb11c('0x18')](function(_0x48e3b8){return db[_0xb11c('0x5d')]['transaction'](function(_0xebb41){return _0x48e3b8[_0xb11c('0x61')](_0x36d5ba[_0xb11c('0x28')][_0xb11c('0x56')],{'transaction':_0xebb41})['then'](function(){if(!_[_0xb11c('0x70')](_0x4f3aac)){return _0x48e3b8[_0xb11c('0x71')](_0x4f3aac,{'transaction':_0xebb41});}})[_0xb11c('0x18')](function(){_0x4f3aac[_0xb11c('0x72')](function(_0x58841c){socket['emit'](_0xb11c('0x73'),{'UserId':_0x58841c,'WhatsappQueueId':_0x48e3b8['id']});});});});});});})['then'](respondWithStatusCode(_0x50ac8a,null))['catch'](handleError(_0x50ac8a,null));};exports[_0xb11c('0x74')]=function(_0x313e27,_0x1fbeda){return db[_0xb11c('0x20')]['find']({'where':{'id':_0x313e27[_0xb11c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1fbeda,null))[_0xb11c('0x18')](function(_0x1e9686){if(_0x1e9686){return _0x1e9686['addAgents'](_0x313e27[_0xb11c('0x36')][_0xb11c('0x56')],_[_0xb11c('0x75')](_0x313e27[_0xb11c('0x36')],[_0xb11c('0x56'),'id'])||{})['spread'](function(_0x4d78ca){for(var _0x572661=0x0;_0x572661<_0x313e27[_0xb11c('0x36')][_0xb11c('0x56')]['length'];_0x572661+=0x1){socket[_0xb11c('0x76')](_0xb11c('0x60'),{'UserId':Number(_0x313e27[_0xb11c('0x36')][_0xb11c('0x56')][_0x572661]),'WhatsappQueueId':Number(_0x313e27[_0xb11c('0x2a')]['id'])});}return _0x4d78ca;});}})[_0xb11c('0x18')](respondWithResult(_0x1fbeda,null))['catch'](handleError(_0x1fbeda,null));};exports[_0xb11c('0x71')]=function(_0x5eb1c6,_0xf2c3f9){return db['WhatsappQueue'][_0xb11c('0x33')]({'where':{'id':_0x5eb1c6[_0xb11c('0x2a')]['id']}})[_0xb11c('0x18')](handleEntityNotFound(_0xf2c3f9,null))[_0xb11c('0x18')](function(_0xf63754){if(_0xf63754){return _0xf63754[_0xb11c('0x71')](_0x5eb1c6[_0xb11c('0x28')][_0xb11c('0x56')])['then'](function(){if(_[_0xb11c('0x77')](_0x5eb1c6[_0xb11c('0x28')][_0xb11c('0x56')])){for(var _0x3c986a=0x0;_0x3c986a<_0x5eb1c6[_0xb11c('0x28')]['ids'][_0xb11c('0x2f')];_0x3c986a+=0x1){socket[_0xb11c('0x76')](_0xb11c('0x73'),{'UserId':Number(_0x5eb1c6[_0xb11c('0x28')][_0xb11c('0x56')][_0x3c986a]),'WhatsappQueueId':Number(_0x5eb1c6[_0xb11c('0x2a')]['id'])});}}else{socket[_0xb11c('0x76')]('userWhatsappQueue:remove',{'UserId':Number(_0x5eb1c6[_0xb11c('0x28')][_0xb11c('0x56')]),'WhatsappQueueId':Number(_0x5eb1c6['params']['id'])});}});}})['then'](respondWithStatusCode(_0xf2c3f9,null))[_0xb11c('0x34')](handleError(_0xf2c3f9,null));};exports['getAgents']=function(_0x2edd9b,_0xc2cccc){var _0x4a2820={};var _0x56c4bf={};var _0x13ddba;var _0x5b0993;return db[_0xb11c('0x20')]['findOne']({'where':{'id':_0x2edd9b[_0xb11c('0x2a')]['id']}})[_0xb11c('0x18')](handleEntityNotFound(_0xc2cccc,null))[_0xb11c('0x18')](function(_0x282354){if(_0x282354){_0x13ddba=_0x282354;_0x56c4bf[_0xb11c('0x3f')]=_[_0xb11c('0x2b')](db[_0xb11c('0x48')]['rawAttributes']);_0x56c4bf[_0xb11c('0x28')]=_[_0xb11c('0x2b')](_0x2edd9b['query']);_0x56c4bf['filters']=_[_0xb11c('0x2d')](_0x56c4bf[_0xb11c('0x3f')],_0x56c4bf[_0xb11c('0x28')]);_0x4a2820[_0xb11c('0x2c')]=_[_0xb11c('0x2d')](_0x56c4bf[_0xb11c('0x3f')],qs[_0xb11c('0x2e')](_0x2edd9b[_0xb11c('0x28')][_0xb11c('0x2e')]));_0x4a2820[_0xb11c('0x2c')]=_0x4a2820['attributes'][_0xb11c('0x2f')]?_0x4a2820[_0xb11c('0x2c')]:_0x56c4bf[_0xb11c('0x3f')];_0x4a2820['order']=qs['sort'](_0x2edd9b[_0xb11c('0x28')]['sort']);_0x4a2820[_0xb11c('0x26')]=qs['filters'](_['pick'](_0x2edd9b[_0xb11c('0x28')],_0x56c4bf[_0xb11c('0x41')]));if(_0x2edd9b[_0xb11c('0x28')][_0xb11c('0x46')]){_0x4a2820['where']=_['merge'](_0x4a2820[_0xb11c('0x26')],{'$or':_[_0xb11c('0x1f')](_0x4a2820[_0xb11c('0x2c')],function(_0x256035){var _0x20c465={};_0x20c465[_0x256035]={'$like':'%'+_0x2edd9b[_0xb11c('0x28')][_0xb11c('0x46')]+'%'};return _0x20c465;})});}_0x4a2820=_[_0xb11c('0x31')]({},_0x4a2820,_0x2edd9b[_0xb11c('0x32')]);return _0x13ddba[_0xb11c('0x78')](_0x4a2820);}})[_0xb11c('0x18')](function(_0x18463d){if(_0x18463d){_0x5b0993=_0x18463d[_0xb11c('0x2f')];if(!_0x2edd9b['query'][_0xb11c('0x54')]('nolimit')){_0x4a2820[_0xb11c('0x11')]=qs[_0xb11c('0x11')](_0x2edd9b['query']['limit']);_0x4a2820[_0xb11c('0x10')]=qs['offset'](_0x2edd9b['query'][_0xb11c('0x10')]);}return _0x13ddba[_0xb11c('0x78')](_0x4a2820);}})[_0xb11c('0x18')](function(_0x446ad9){if(_0x446ad9){return _0x446ad9?{'count':_0x5b0993,'rows':_0x446ad9}:null;}})[_0xb11c('0x18')](respondWithResult(_0xc2cccc,null))[_0xb11c('0x34')](handleError(_0xc2cccc,null));}; \ No newline at end of file +var _0x4b68=['show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','SIP','whatsappPause','getTeams','findOne','Team','options','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','SELECT','includes','union','compact','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','include','query','findAll','catch'];(function(_0x5a0d79,_0x17aed4){var _0x5bee8d=function(_0x12a468){while(--_0x12a468){_0x5a0d79['push'](_0x5a0d79['shift']());}};_0x5bee8d(++_0x17aed4);}(_0x4b68,0xc3));var _0x84b6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4b68[_0x42cae2];return _0x5f256f;};'use strict';var BPromise=require(_0x84b6('0x0'));var util=require(_0x84b6('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x84b6('0x2'));var qs=require(_0x84b6('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x84b6('0x4'));var db=require(_0x84b6('0x5'))['db'];config['redis']=_['defaults'](config[_0x84b6('0x6')],{'host':_0x84b6('0x7'),'port':0x18eb});var socket=require(_0x84b6('0x8'))(new Redis(config[_0x84b6('0x6')]));require('./whatsappQueue.socket')[_0x84b6('0x9')](socket);function respondWithStatusCode(_0x39c567,_0x52914c){_0x52914c=_0x52914c||0xcc;return function(_0x1fc329){if(_0x1fc329){return _0x39c567[_0x84b6('0xa')](_0x52914c);}return _0x39c567[_0x84b6('0xb')](_0x52914c)[_0x84b6('0xc')]();};}function respondWithResult(_0x28f1b2,_0x5b83d5){_0x5b83d5=_0x5b83d5||0xc8;return function(_0x349cc5){if(_0x349cc5){return _0x28f1b2['status'](_0x5b83d5)[_0x84b6('0xd')](_0x349cc5);}};}function respondWithFilteredResult(_0x1d5e8e,_0x27a10c){return function(_0x173db6){if(_0x173db6){var _0x53e877=typeof _0x27a10c['offset']===_0x84b6('0xe')&&typeof _0x27a10c[_0x84b6('0xf')]===_0x84b6('0xe');var _0x2a6705=_0x173db6[_0x84b6('0x10')];var _0x15bd68=_0x53e877?0x0:_0x27a10c['offset'];var _0x5f1fbd=_0x53e877?_0x173db6['count']:_0x27a10c[_0x84b6('0x11')]+_0x27a10c[_0x84b6('0xf')];var _0x52732b;if(_0x5f1fbd>=_0x2a6705){_0x5f1fbd=_0x2a6705;_0x52732b=0xc8;}else{_0x52732b=0xce;}_0x1d5e8e[_0x84b6('0xb')](_0x52732b);return _0x1d5e8e[_0x84b6('0x12')](_0x84b6('0x13'),_0x15bd68+'-'+_0x5f1fbd+'/'+_0x2a6705)[_0x84b6('0xd')](_0x173db6);}return null;};}function saveUpdates(_0x41e940){return function(_0x114f48){if(_0x114f48){return _0x114f48[_0x84b6('0x14')](_0x41e940)['then'](function(_0x1de4ea){return _0x1de4ea;});}return null;};}function removeEntity(_0x5f3b71){return function(_0x286c26){if(_0x286c26){return _0x286c26[_0x84b6('0x15')]()[_0x84b6('0x16')](function(){var _0x2cf0e6=_0x286c26[_0x84b6('0x17')]({'plain':!![]});var _0x46b9d3=_0x84b6('0x18');return db[_0x84b6('0x19')]['destroy']({'where':{'type':_0x46b9d3,'resourceId':_0x2cf0e6['id']}})[_0x84b6('0x16')](function(){return _0x286c26;});})[_0x84b6('0x16')](function(){_0x5f3b71[_0x84b6('0xb')](0xcc)[_0x84b6('0xc')]();});}};}function handleEntityNotFound(_0x2802b5){return function(_0x2f22ff){if(!_0x2f22ff){_0x2802b5[_0x84b6('0xa')](0x194);}return _0x2f22ff;};}function handleError(_0x5b0432,_0x6a1c1d){_0x6a1c1d=_0x6a1c1d||0x1f4;return function(_0x4a588f){logger[_0x84b6('0x1a')](_0x4a588f[_0x84b6('0x1b')]);if(_0x4a588f[_0x84b6('0x1c')]){delete _0x4a588f[_0x84b6('0x1c')];}_0x5b0432['status'](_0x6a1c1d)[_0x84b6('0x1d')](_0x4a588f);};}exports[_0x84b6('0x1e')]=function(_0x258ed9,_0x2b9ef9){var _0x421495={};var _0x561364={'count':0x0,'rows':[]};var _0x222074=_[_0x84b6('0x1f')](db[_0x84b6('0x20')][_0x84b6('0x21')],function(_0x18bc34){return{'name':_0x18bc34[_0x84b6('0x22')],'type':_0x18bc34[_0x84b6('0x23')][_0x84b6('0x24')]};});_0x421495=qs['getOptions'](_0x222074,_0x258ed9);var _0x5cbf06={'where':_0x421495['where']};return db[_0x84b6('0x20')][_0x84b6('0x10')](_0x5cbf06)['then'](function(_0x5355ab){_0x561364[_0x84b6('0x10')]=_0x5355ab;_0x421495[_0x84b6('0x25')]=qs['include'](_0x258ed9[_0x84b6('0x26')]);return db['WhatsappQueue'][_0x84b6('0x27')](_0x421495);})['then'](function(_0x3c2f7a){_0x561364['rows']=_0x3c2f7a;return _0x561364;})[_0x84b6('0x16')](respondWithFilteredResult(_0x2b9ef9,_0x421495))[_0x84b6('0x28')](handleError(_0x2b9ef9,null));};exports[_0x84b6('0x29')]=function(_0xd3a60e,_0x3c598d){var _0xaea1e0={'raw':!![],'where':{'id':_0xd3a60e[_0x84b6('0x2a')]['id']}},_0x1e8797={};_0x1e8797[_0x84b6('0x2b')]=_['keys'](db[_0x84b6('0x20')][_0x84b6('0x21')]);_0x1e8797[_0x84b6('0x26')]=_[_0x84b6('0x2c')](_0xd3a60e[_0x84b6('0x26')]);_0x1e8797['filters']=_[_0x84b6('0x2d')](_0x1e8797[_0x84b6('0x2b')],_0x1e8797[_0x84b6('0x26')]);_0xaea1e0[_0x84b6('0x2e')]=_[_0x84b6('0x2d')](_0x1e8797['model'],qs['fields'](_0xd3a60e[_0x84b6('0x26')][_0x84b6('0x2f')]));_0xaea1e0[_0x84b6('0x2e')]=_0xaea1e0[_0x84b6('0x2e')][_0x84b6('0x30')]?_0xaea1e0[_0x84b6('0x2e')]:_0x1e8797[_0x84b6('0x2b')];if(_0xd3a60e[_0x84b6('0x26')][_0x84b6('0x31')]){_0xaea1e0[_0x84b6('0x25')]=[{'all':!![]}];}_0xaea1e0=_[_0x84b6('0x32')]({},_0xaea1e0,_0xd3a60e['options']);return db[_0x84b6('0x20')][_0x84b6('0x33')](_0xaea1e0)[_0x84b6('0x16')](handleEntityNotFound(_0x3c598d,null))[_0x84b6('0x16')](respondWithResult(_0x3c598d,null))['catch'](handleError(_0x3c598d,null));};exports[_0x84b6('0x34')]=function(_0x4d6132,_0x190013){return db['WhatsappQueue'][_0x84b6('0x34')](_0x4d6132['body'],{})['then'](function(_0x5042a6){var _0x259d3f=_0x4d6132[_0x84b6('0x35')]['get']({'plain':!![]});if(!_0x259d3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x259d3f[_0x84b6('0x36')]==='user'){var _0x3001bd=_0x5042a6[_0x84b6('0x17')]({'plain':!![]});var _0xdbbcd9=_0x84b6('0x18');return db[_0x84b6('0x37')][_0x84b6('0x33')]({'where':{'name':_0xdbbcd9,'userProfileId':_0x259d3f[_0x84b6('0x38')]},'raw':!![]})[_0x84b6('0x16')](function(_0x3983f9){if(_0x3983f9&&_0x3983f9[_0x84b6('0x39')]===0x0){return db[_0x84b6('0x19')][_0x84b6('0x34')]({'name':_0x3001bd[_0x84b6('0x1c')],'resourceId':_0x3001bd['id'],'type':_0x3983f9['name'],'sectionId':_0x3983f9['id']},{})[_0x84b6('0x16')](function(){return _0x5042a6;});}else{return _0x5042a6;}})[_0x84b6('0x28')](function(_0x44a828){logger[_0x84b6('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44a828);throw _0x44a828;});}return _0x5042a6;})[_0x84b6('0x16')](respondWithResult(_0x190013,0xc9))['catch'](handleError(_0x190013,null));};exports[_0x84b6('0x14')]=function(_0x48b043,_0x31931d){if(_0x48b043[_0x84b6('0x3a')]['id']){delete _0x48b043[_0x84b6('0x3a')]['id'];}return db[_0x84b6('0x20')][_0x84b6('0x33')]({'where':{'id':_0x48b043['params']['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x31931d,null))[_0x84b6('0x16')](saveUpdates(_0x48b043[_0x84b6('0x3a')],null))[_0x84b6('0x16')](respondWithResult(_0x31931d,null))[_0x84b6('0x28')](handleError(_0x31931d,null));};exports[_0x84b6('0x15')]=function(_0x179e74,_0x2cea2e){return db['WhatsappQueue'][_0x84b6('0x33')]({'where':{'id':_0x179e74['params']['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x2cea2e,null))[_0x84b6('0x16')](removeEntity(_0x2cea2e,null))['catch'](handleError(_0x2cea2e,null));};exports['describe']=function(_0x56f3a0,_0x543a56){return db[_0x84b6('0x20')][_0x84b6('0x3b')]()['then'](respondWithResult(_0x543a56,null))[_0x84b6('0x28')](handleError(_0x543a56,null));};exports[_0x84b6('0x3c')]=function(_0x1aa127,_0x555bf8){var _0x443618={'raw':!![],'where':{}},_0x32e100={},_0x507f9f;return db[_0x84b6('0x20')]['findOne']({'where':{'id':_0x1aa127['params']['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x555bf8,null))['then'](function(_0x24176b){if(_0x24176b){_0x507f9f=_0x24176b['get']({'plain':!![]});_0x32e100[_0x84b6('0x2b')]=_[_0x84b6('0x2c')](db[_0x84b6('0x3d')][_0x84b6('0x21')]);_0x32e100[_0x84b6('0x26')]=_[_0x84b6('0x2c')](_0x1aa127['query']);_0x32e100[_0x84b6('0x3e')]=_[_0x84b6('0x2d')](_0x32e100['model'],_0x32e100['query']);_0x443618['attributes']=_[_0x84b6('0x2d')](_0x32e100[_0x84b6('0x2b')],qs[_0x84b6('0x2f')](_0x1aa127['query']['fields']));_0x443618['attributes']=_0x443618['attributes']['length']?_0x443618['attributes']:_0x32e100[_0x84b6('0x2b')];if(!_0x1aa127[_0x84b6('0x26')][_0x84b6('0x3f')](_0x84b6('0x40'))){_0x443618[_0x84b6('0xf')]=qs[_0x84b6('0xf')](_0x1aa127[_0x84b6('0x26')]['limit']);_0x443618['offset']=qs[_0x84b6('0x11')](_0x1aa127[_0x84b6('0x26')][_0x84b6('0x11')]);}_0x443618[_0x84b6('0x41')]=qs[_0x84b6('0x42')](_0x1aa127[_0x84b6('0x26')][_0x84b6('0x42')]);_0x443618['where']=qs[_0x84b6('0x3e')](_[_0x84b6('0x43')](_0x1aa127[_0x84b6('0x26')],_0x32e100[_0x84b6('0x3e')]));_0x443618[_0x84b6('0x44')][_0x84b6('0x45')]=_0x24176b['id'];if(_0x1aa127[_0x84b6('0x26')][_0x84b6('0x46')]){_0x443618[_0x84b6('0x44')]=_['merge'](_0x443618[_0x84b6('0x44')],{'$or':_[_0x84b6('0x1f')](_0x443618['attributes'],function(_0xc6c1bd){var _0x2059e8={};_0x2059e8[_0xc6c1bd]={'$like':'%'+_0x1aa127[_0x84b6('0x26')][_0x84b6('0x46')]+'%'};return _0x2059e8;})});}_0x443618=_[_0x84b6('0x32')]({},_0x443618,_0x1aa127['options']);return db['UserWhatsappQueue'][_0x84b6('0x27')](_0x443618);}})[_0x84b6('0x16')](function(_0x103a6b){if(_0x103a6b){return db[_0x84b6('0x47')][_0x84b6('0x48')]({'where':{'id':_['map'](_0x103a6b,_0x84b6('0x49')),'role':_0x84b6('0x4a')},'attributes':['id',_0x84b6('0x1c'),'whatsappPause',_0x84b6('0x4b'),_0x84b6('0x4c')]});}})[_0x84b6('0x16')](function(_0x551512){if(_0x551512){return{'count':_0x551512['count'],'rows':_[_0x84b6('0x1f')](_0x551512[_0x84b6('0x4d')],function(_0x5ba181){return{'membername':_0x5ba181[_0x84b6('0x1c')],'UserId':_0x5ba181['id'],'queue_name':_0x507f9f[_0x84b6('0x1c')],'WhatsappQueueId':_0x507f9f['id'],'interface':util[_0x84b6('0x4e')]('%s/%s',_0x84b6('0x4f'),_0x5ba181[_0x84b6('0x1c')]),'penalty':0x0,'paused':_0x5ba181[_0x84b6('0x50')],'createdAt':_0x5ba181[_0x84b6('0x4c')],'updatedAt':_0x5ba181[_0x84b6('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x555bf8,_0x443618))['catch'](handleError(_0x555bf8,null));};exports[_0x84b6('0x51')]=function(_0x56b1d0,_0x327373){var _0x30b3cb={};var _0x3cafad={};var _0x2e6ec9;var _0x34898f;return db[_0x84b6('0x20')][_0x84b6('0x52')]({'where':{'id':_0x56b1d0[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x327373,null))[_0x84b6('0x16')](function(_0x1e7dc7){if(_0x1e7dc7){_0x2e6ec9=_0x1e7dc7;_0x3cafad[_0x84b6('0x2b')]=_[_0x84b6('0x2c')](db[_0x84b6('0x53')][_0x84b6('0x21')]);_0x3cafad[_0x84b6('0x26')]=_['keys'](_0x56b1d0['query']);_0x3cafad[_0x84b6('0x3e')]=_[_0x84b6('0x2d')](_0x3cafad[_0x84b6('0x2b')],_0x3cafad[_0x84b6('0x26')]);_0x30b3cb[_0x84b6('0x2e')]=_[_0x84b6('0x2d')](_0x3cafad[_0x84b6('0x2b')],qs[_0x84b6('0x2f')](_0x56b1d0['query'][_0x84b6('0x2f')]));_0x30b3cb[_0x84b6('0x2e')]=_0x30b3cb['attributes'][_0x84b6('0x30')]?_0x30b3cb['attributes']:_0x3cafad[_0x84b6('0x2b')];_0x30b3cb[_0x84b6('0x41')]=qs[_0x84b6('0x42')](_0x56b1d0[_0x84b6('0x26')][_0x84b6('0x42')]);_0x30b3cb[_0x84b6('0x44')]=qs[_0x84b6('0x3e')](_[_0x84b6('0x43')](_0x56b1d0[_0x84b6('0x26')],_0x3cafad[_0x84b6('0x3e')]));if(_0x56b1d0[_0x84b6('0x26')][_0x84b6('0x46')]){_0x30b3cb[_0x84b6('0x44')]=_[_0x84b6('0x32')](_0x30b3cb['where'],{'$or':_[_0x84b6('0x1f')](_0x30b3cb[_0x84b6('0x2e')],function(_0x15978e){var _0x4f405b={};_0x4f405b[_0x15978e]={'$like':'%'+_0x56b1d0[_0x84b6('0x26')]['filter']+'%'};return _0x4f405b;})});}_0x30b3cb=_[_0x84b6('0x32')]({},_0x30b3cb,_0x56b1d0[_0x84b6('0x54')]);return _0x2e6ec9[_0x84b6('0x51')](_0x30b3cb);}})[_0x84b6('0x16')](function(_0x13c886){if(_0x13c886){_0x34898f=_0x13c886[_0x84b6('0x30')];if(!_0x56b1d0[_0x84b6('0x26')][_0x84b6('0x3f')](_0x84b6('0x40'))){_0x30b3cb['limit']=qs['limit'](_0x56b1d0[_0x84b6('0x26')][_0x84b6('0xf')]);_0x30b3cb[_0x84b6('0x11')]=qs[_0x84b6('0x11')](_0x56b1d0['query']['offset']);}return _0x2e6ec9[_0x84b6('0x51')](_0x30b3cb);}})['then'](function(_0x5e1f3b){if(_0x5e1f3b){return _0x5e1f3b?{'count':_0x34898f,'rows':_0x5e1f3b}:null;}})[_0x84b6('0x16')](respondWithResult(_0x327373,null))['catch'](handleError(_0x327373,null));};exports['addTeams']=function(_0x5b912f,_0x12d1bd){var _0x10ffcb=_0x5b912f[_0x84b6('0x3a')][_0x84b6('0x55')];return db['Team'][_0x84b6('0x27')]({'where':{'id':_0x10ffcb},'attributes':['id'],'include':[{'model':db[_0x84b6('0x47')],'as':_0x84b6('0x56'),'attributes':['id',_0x84b6('0x1c'),_0x84b6('0x57'),_0x84b6('0x58'),_0x84b6('0x59')],'raw':!![]}]})[_0x84b6('0x16')](function(_0x24bc88){if(_0x24bc88){var _0x35cbbb=_[_0x84b6('0x5a')](_0x24bc88,function(_0x3a660e){var _0x5d05eb=_0x3a660e[_0x84b6('0x17')]({'plain':!![]});return _0x5d05eb[_0x84b6('0x56')];});return db[_0x84b6('0x20')][_0x84b6('0x33')]({'where':{'id':_0x5b912f[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](function(_0x3f1250){return db[_0x84b6('0x5b')]['transaction'](function(_0x50ca9b){return _0x3f1250[_0x84b6('0x5c')](_0x10ffcb,{'transaction':_0x50ca9b})['then'](function(){return BPromise['each'](_0x35cbbb,function(_0x2e7244){return db[_0x84b6('0x3d')]['findOrCreate']({'where':{'UserId':_0x2e7244['id'],'WhatsappQueueId':_0x5b912f['params']['id']},'transaction':_0x50ca9b});});})['then'](function(){_0x35cbbb['forEach'](function(_0x449e99){socket[_0x84b6('0x5d')](_0x84b6('0x5e'),{'UserId':_0x449e99['id'],'WhatsappQueueId':_0x3f1250['id']});});});});});}})[_0x84b6('0x16')](respondWithStatusCode(_0x12d1bd,null))[_0x84b6('0x28')](handleError(_0x12d1bd,null));};exports[_0x84b6('0x5f')]=function(_0x4f5a10,_0x259df5){return db[_0x84b6('0x53')]['findAll']({'where':{'id':_0x4f5a10['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x84b6('0x47')],'as':_0x84b6('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x259df5,null))[_0x84b6('0x16')](function(_0x55b24f){var _0x4f45fd=_[_0x84b6('0x1f')](_0x55b24f,'id');var _0x3f47e4=[];var _0x81a01f=[];var _0x2b64a6=squel[_0x84b6('0x60')]();_0x2b64a6[_0x84b6('0x61')]('tq.TeamId')[_0x84b6('0x62')](_0x84b6('0x63'),'tq')[_0x84b6('0x64')](_0x84b6('0x65'),'ut',_0x84b6('0x66'))[_0x84b6('0x44')]('WhatsappQueueId\x20=\x20?',_0x4f5a10['params']['id']);for(var _0xc4016f=0x0;_0xc4016f<_0x55b24f['length'];_0xc4016f+=0x1){let _0x396dfb=_0x55b24f[_0xc4016f];for(var _0x4a0ede=0x0;_0x4a0ede<_0x396dfb['Agents'][_0x84b6('0x30')];_0x4a0ede+=0x1){let _0x306add=_0x396dfb[_0x84b6('0x56')][_0x4a0ede];var _0x595b93=_0x2b64a6['clone']();_0x595b93[_0x84b6('0x44')](_0x84b6('0x67'),_0x306add['id']);_0x81a01f[_0x84b6('0x68')](db[_0x84b6('0x5b')][_0x84b6('0x26')](_0x595b93['toString'](),{'type':db[_0x84b6('0x5b')]['QueryTypes'][_0x84b6('0x69')]})[_0x84b6('0x16')](function(_0x86dc97){if(_0x86dc97[_0x84b6('0x30')]===0x1){return _0x306add['id'];}else{var _0x30176a=_['every'](_['map'](_0x86dc97,'TeamId'),function(_0x39ca12){return _[_0x84b6('0x6a')](_0x4f45fd,_0x39ca12);});if(_0x30176a){return _0x306add['id'];}}}));}}return BPromise['all'](_0x81a01f)['then'](function(_0xbdb3c6){_0x3f47e4=_(_0x3f47e4)[_0x84b6('0x6b')](_0xbdb3c6)[_0x84b6('0x6c')]()[_0x84b6('0x6d')]();return db['WhatsappQueue'][_0x84b6('0x33')]({'where':{'id':_0x4f5a10['params']['id']}})['then'](function(_0x22c05f){return db['sequelize']['transaction'](function(_0x5820ea){return _0x22c05f[_0x84b6('0x5f')](_0x4f5a10[_0x84b6('0x26')]['ids'],{'transaction':_0x5820ea})['then'](function(){if(!_['isEmpty'](_0x3f47e4)){return _0x22c05f[_0x84b6('0x6e')](_0x3f47e4,{'transaction':_0x5820ea});}})[_0x84b6('0x16')](function(){_0x3f47e4[_0x84b6('0x6f')](function(_0x5f08f5){socket[_0x84b6('0x5d')](_0x84b6('0x70'),{'UserId':_0x5f08f5,'WhatsappQueueId':_0x22c05f['id']});});});});});});})['then'](respondWithStatusCode(_0x259df5,null))[_0x84b6('0x28')](handleError(_0x259df5,null));};exports[_0x84b6('0x71')]=function(_0x557308,_0x4aff96){return db[_0x84b6('0x20')][_0x84b6('0x33')]({'where':{'id':_0x557308[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x4aff96,null))[_0x84b6('0x16')](function(_0x53a950){if(_0x53a950){return _0x53a950[_0x84b6('0x71')](_0x557308['body'][_0x84b6('0x55')],_[_0x84b6('0x72')](_0x557308[_0x84b6('0x3a')],[_0x84b6('0x55'),'id'])||{})[_0x84b6('0x73')](function(_0x1569a4){for(var _0x274a03=0x0;_0x274a03<_0x557308['body']['ids'][_0x84b6('0x30')];_0x274a03+=0x1){socket[_0x84b6('0x5d')](_0x84b6('0x5e'),{'UserId':Number(_0x557308[_0x84b6('0x3a')][_0x84b6('0x55')][_0x274a03]),'WhatsappQueueId':Number(_0x557308[_0x84b6('0x2a')]['id'])});}return _0x1569a4;});}})[_0x84b6('0x16')](respondWithResult(_0x4aff96,null))[_0x84b6('0x28')](handleError(_0x4aff96,null));};exports[_0x84b6('0x6e')]=function(_0x22ecd9,_0x513dd5){return db['WhatsappQueue']['find']({'where':{'id':_0x22ecd9[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x513dd5,null))['then'](function(_0x4ed80a){if(_0x4ed80a){return _0x4ed80a[_0x84b6('0x6e')](_0x22ecd9[_0x84b6('0x26')][_0x84b6('0x55')])['then'](function(){if(_[_0x84b6('0x74')](_0x22ecd9[_0x84b6('0x26')][_0x84b6('0x55')])){for(var _0x2df815=0x0;_0x2df815<_0x22ecd9[_0x84b6('0x26')]['ids']['length'];_0x2df815+=0x1){socket[_0x84b6('0x5d')](_0x84b6('0x70'),{'UserId':Number(_0x22ecd9[_0x84b6('0x26')]['ids'][_0x2df815]),'WhatsappQueueId':Number(_0x22ecd9['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x22ecd9[_0x84b6('0x26')][_0x84b6('0x55')]),'WhatsappQueueId':Number(_0x22ecd9['params']['id'])});}});}})[_0x84b6('0x16')](respondWithStatusCode(_0x513dd5,null))['catch'](handleError(_0x513dd5,null));};exports[_0x84b6('0x75')]=function(_0x509ec9,_0x3a2006){var _0xe3e134={};var _0x49eb61={};var _0x513bab;var _0x5d53f7;return db[_0x84b6('0x20')][_0x84b6('0x52')]({'where':{'id':_0x509ec9[_0x84b6('0x2a')]['id']}})[_0x84b6('0x16')](handleEntityNotFound(_0x3a2006,null))[_0x84b6('0x16')](function(_0x891965){if(_0x891965){_0x513bab=_0x891965;_0x49eb61[_0x84b6('0x2b')]=_[_0x84b6('0x2c')](db[_0x84b6('0x47')][_0x84b6('0x21')]);_0x49eb61[_0x84b6('0x26')]=_['keys'](_0x509ec9['query']);_0x49eb61[_0x84b6('0x3e')]=_[_0x84b6('0x2d')](_0x49eb61['model'],_0x49eb61[_0x84b6('0x26')]);_0xe3e134[_0x84b6('0x2e')]=_[_0x84b6('0x2d')](_0x49eb61[_0x84b6('0x2b')],qs['fields'](_0x509ec9[_0x84b6('0x26')]['fields']));_0xe3e134[_0x84b6('0x2e')]=_0xe3e134[_0x84b6('0x2e')][_0x84b6('0x30')]?_0xe3e134[_0x84b6('0x2e')]:_0x49eb61[_0x84b6('0x2b')];_0xe3e134['order']=qs[_0x84b6('0x42')](_0x509ec9[_0x84b6('0x26')][_0x84b6('0x42')]);_0xe3e134[_0x84b6('0x44')]=qs[_0x84b6('0x3e')](_[_0x84b6('0x43')](_0x509ec9[_0x84b6('0x26')],_0x49eb61[_0x84b6('0x3e')]));if(_0x509ec9[_0x84b6('0x26')]['filter']){_0xe3e134[_0x84b6('0x44')]=_[_0x84b6('0x32')](_0xe3e134[_0x84b6('0x44')],{'$or':_[_0x84b6('0x1f')](_0xe3e134[_0x84b6('0x2e')],function(_0x1fc642){var _0x74e3c1={};_0x74e3c1[_0x1fc642]={'$like':'%'+_0x509ec9['query'][_0x84b6('0x46')]+'%'};return _0x74e3c1;})});}_0xe3e134=_[_0x84b6('0x32')]({},_0xe3e134,_0x509ec9[_0x84b6('0x54')]);return _0x513bab[_0x84b6('0x75')](_0xe3e134);}})[_0x84b6('0x16')](function(_0x308c13){if(_0x308c13){_0x5d53f7=_0x308c13[_0x84b6('0x30')];if(!_0x509ec9[_0x84b6('0x26')]['hasOwnProperty'](_0x84b6('0x40'))){_0xe3e134[_0x84b6('0xf')]=qs[_0x84b6('0xf')](_0x509ec9[_0x84b6('0x26')][_0x84b6('0xf')]);_0xe3e134[_0x84b6('0x11')]=qs[_0x84b6('0x11')](_0x509ec9[_0x84b6('0x26')][_0x84b6('0x11')]);}return _0x513bab['getAgents'](_0xe3e134);}})[_0x84b6('0x16')](function(_0x40b65d){if(_0x40b65d){return _0x40b65d?{'count':_0x5d53f7,'rows':_0x40b65d}:null;}})['then'](respondWithResult(_0x3a2006,null))[_0x84b6('0x28')](handleError(_0x3a2006,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0e597e5..4b50428 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 _0x531e=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue'];(function(_0x16bb50,_0x4248fa){var _0x38a236=function(_0x31576b){while(--_0x31576b){_0x16bb50['push'](_0x16bb50['shift']());}};_0x38a236(++_0x4248fa);}(_0x531e,0x19c));var _0xe531=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x531e[_0x2d8fc2];return _0x3a9e53;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xe531('0x0'))['db'][_0xe531('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe531('0x2'),'afterUpdate':_0xe531('0x3'),'afterDestroy':_0xe531('0x4')};function emitEvent(_0x34fa1b){return function(_0x158d30,_0x3f9d96,_0x2f868f){WhatsappQueueEvents[_0xe531('0x5')](_0x34fa1b+':'+_0x158d30['id'],_0x158d30);WhatsappQueueEvents['emit'](_0x34fa1b,_0x158d30);_0x2f868f(null);};}for(var e in events){if(events[_0xe531('0x6')](e)){var event=events[e];WhatsappQueue[_0xe531('0x7')](e,emitEvent(event));}}module[_0xe531('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6e18=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','save','remove'];(function(_0x22205c,_0x473493){var _0x3f5efe=function(_0x153dbb){while(--_0x153dbb){_0x22205c['push'](_0x22205c['shift']());}};_0x3f5efe(++_0x473493);}(_0x6e18,0x19b));var _0x86e1=function(_0x263c65,_0x22e763){_0x263c65=_0x263c65-0x0;var _0x37f042=_0x6e18[_0x263c65];return _0x37f042;};'use strict';var EventEmitter=require(_0x86e1('0x0'));var WhatsappQueue=require(_0x86e1('0x1'))['db'][_0x86e1('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x86e1('0x3'),'afterUpdate':'update','afterDestroy':_0x86e1('0x4')};function emitEvent(_0x5df3e7){return function(_0x4f7913,_0x5e899b,_0x1608fb){WhatsappQueueEvents[_0x86e1('0x5')](_0x5df3e7+':'+_0x4f7913['id'],_0x4f7913);WhatsappQueueEvents[_0x86e1('0x5')](_0x5df3e7,_0x4f7913);_0x1608fb(null);};}for(var e in events){if(events[_0x86e1('0x6')](e)){var event=events[e];WhatsappQueue[_0x86e1('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 62e4e29..908ff3d 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 _0xf6a9=['lodash','util','api','request-promise','path','../../config/environment','./whatsappQueue.attributes','define'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0xf6a9,0xf8));var _0x9f6a=function(_0x2f4cb1,_0x5b84cc){_0x2f4cb1=_0x2f4cb1-0x0;var _0xd3e972=_0xf6a9[_0x2f4cb1];return _0xd3e972;};'use strict';var _=require(_0x9f6a('0x0'));var util=require(_0x9f6a('0x1'));var logger=require('../../config/logger')(_0x9f6a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f6a('0x3'));var fs=require('fs');var path=require(_0x9f6a('0x4'));var rimraf=require('rimraf');var config=require(_0x9f6a('0x5'));var attributes=require(_0x9f6a('0x6'));module['exports']=function(_0x496013,_0x246073){return _0x496013[_0x9f6a('0x7')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x735f=['moment','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','util','api'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x735f,0x166));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf735('0x0'));var logger=require('../../config/logger')(_0xf735('0x1'));var moment=require(_0xf735('0x2'));var BPromise=require(_0xf735('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf735('0x4'));var rimraf=require(_0xf735('0x5'));var config=require(_0xf735('0x6'));var attributes=require(_0xf735('0x7'));module[_0xf735('0x8')]=function(_0x488e2f,_0x52bc63){return _0x488e2f['define']('WhatsappQueue',attributes,{'tableName':_0xf735('0x9'),'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 719a882..16ad8ca 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 _0x821e=['redis','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','WhatsappQueue','options','where','limit','map','include','model','attributes','GetWhatsappQueue','ShowWhatsappQueue','find','raw','debug','stringify','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a2455,_0xdaa32e){var _0xd2286c=function(_0x1427b2){while(--_0x1427b2){_0x1a2455['push'](_0x1a2455['shift']());}};_0xd2286c(++_0xdaa32e);}(_0x821e,0x100));var _0xe821=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x821e[_0x1c0f41];return _0x369a9f;};'use strict';var _=require(_0xe821('0x0'));var util=require(_0xe821('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe821('0x2'));var fs=require('fs');var Redis=require(_0xe821('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe821('0x4'));var logger=require(_0xe821('0x5'))(_0xe821('0x6'));var config=require(_0xe821('0x7'));var jayson=require(_0xe821('0x8'));var client=jayson[_0xe821('0x9')]['http']({'port':0x232a});config[_0xe821('0xa')]=_['defaults'](config['redis'],{'host':_0xe821('0xb'),'port':0x18eb});var socket=require(_0xe821('0xc'))(new Redis(config[_0xe821('0xa')]));require('./whatsappQueue.socket')[_0xe821('0xd')](socket);function respondWithRpcPromise(_0x34924c,_0x55a216,_0x5ce207){return new BPromise(function(_0xa9d237,_0x367fb0){return client[_0xe821('0xe')](_0x34924c,_0x5ce207)[_0xe821('0xf')](function(_0x2ebfde){logger[_0xe821('0x10')](_0xe821('0x11'),_0x55a216,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x55a216,'request\x20sent',JSON['stringify'](_0x2ebfde));if(_0x2ebfde[_0xe821('0x12')]){if(_0x2ebfde['error'][_0xe821('0x13')]===0x1f4){logger[_0xe821('0x12')](_0xe821('0x11'),_0x55a216,_0x2ebfde[_0xe821('0x12')][_0xe821('0x14')]);return _0x367fb0(_0x2ebfde[_0xe821('0x12')][_0xe821('0x14')]);}logger[_0xe821('0x12')](_0xe821('0x11'),_0x55a216,_0x2ebfde[_0xe821('0x12')][_0xe821('0x14')]);return _0xa9d237(_0x2ebfde[_0xe821('0x12')][_0xe821('0x14')]);}else{logger[_0xe821('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x55a216,_0xe821('0x15'));_0xa9d237(_0x2ebfde[_0xe821('0x16')][_0xe821('0x14')]);}})[_0xe821('0x17')](function(_0x82ec74){logger[_0xe821('0x12')](_0xe821('0x11'),_0x55a216,_0x82ec74);_0x367fb0(_0x82ec74);});});}exports['GetWhatsappQueue']=function(_0x385c22){var _0x4f108f=this;return new Promise(function(_0x26e130,_0x365c6b){return db[_0xe821('0x18')]['findAll']({'raw':_0x385c22[_0xe821('0x19')]?_0x385c22[_0xe821('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x385c22[_0xe821('0x19')]?_0x385c22[_0xe821('0x19')][_0xe821('0x1a')]||null:null,'attributes':_0x385c22[_0xe821('0x19')]?_0x385c22['options']['attributes']||null:null,'limit':_0x385c22[_0xe821('0x19')]?_0x385c22['options'][_0xe821('0x1b')]||null:null,'include':_0x385c22['options']?_0x385c22[_0xe821('0x19')]['include']?_[_0xe821('0x1c')](_0x385c22[_0xe821('0x19')][_0xe821('0x1d')],function(_0x19faf0){return{'model':db[_0x19faf0[_0xe821('0x1e')]],'as':_0x19faf0['as'],'attributes':_0x19faf0[_0xe821('0x1f')],'include':_0x19faf0[_0xe821('0x1d')]?_[_0xe821('0x1c')](_0x19faf0[_0xe821('0x1d')],function(_0x46efe5){return{'model':db[_0x46efe5['model']],'as':_0x46efe5['as'],'attributes':_0x46efe5[_0xe821('0x1f')],'include':_0x46efe5['include']?_[_0xe821('0x1c')](_0x46efe5[_0xe821('0x1d')],function(_0x33dcdf){return{'model':db[_0x33dcdf['model']],'as':_0x33dcdf['as'],'attributes':_0x33dcdf['attributes']};}):[]};}):[]};}):[]:[]})[_0xe821('0xf')](function(_0x30b1ab){logger[_0xe821('0x10')](_0xe821('0x20'),_0x385c22);logger['debug'](_0xe821('0x20'),_0x385c22,JSON['stringify'](_0x30b1ab));_0x26e130(_0x30b1ab);})['catch'](function(_0x5f0550){logger[_0xe821('0x12')](_0xe821('0x20'),_0x5f0550[_0xe821('0x14')],_0x385c22);_0x365c6b(_0x4f108f['error'](0x1f4,_0x5f0550[_0xe821('0x14')]));});});};exports[_0xe821('0x21')]=function(_0xd1d23d){var _0x2022f1=this;return new Promise(function(_0x142368,_0x21776d){return db[_0xe821('0x18')][_0xe821('0x22')]({'raw':_0xd1d23d[_0xe821('0x19')]?_0xd1d23d[_0xe821('0x19')][_0xe821('0x23')]===undefined?!![]:![]:!![],'where':_0xd1d23d['options']?_0xd1d23d[_0xe821('0x19')][_0xe821('0x1a')]||null:null,'attributes':_0xd1d23d[_0xe821('0x19')]?_0xd1d23d['options'][_0xe821('0x1f')]||null:null,'include':_0xd1d23d[_0xe821('0x19')]?_0xd1d23d[_0xe821('0x19')]['include']?_[_0xe821('0x1c')](_0xd1d23d[_0xe821('0x19')][_0xe821('0x1d')],function(_0x212d14){return{'model':db[_0x212d14['model']],'as':_0x212d14['as'],'attributes':_0x212d14[_0xe821('0x1f')],'include':_0x212d14[_0xe821('0x1d')]?_[_0xe821('0x1c')](_0x212d14[_0xe821('0x1d')],function(_0x97ea3a){return{'model':db[_0x97ea3a['model']],'as':_0x97ea3a['as'],'attributes':_0x97ea3a['attributes'],'include':_0x97ea3a[_0xe821('0x1d')]?_[_0xe821('0x1c')](_0x97ea3a[_0xe821('0x1d')],function(_0x2e4b92){return{'model':db[_0x2e4b92[_0xe821('0x1e')]],'as':_0x2e4b92['as'],'attributes':_0x2e4b92[_0xe821('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56e521){logger[_0xe821('0x10')](_0xe821('0x21'),_0xd1d23d);logger[_0xe821('0x24')]('ShowWhatsappQueue',_0xd1d23d,JSON[_0xe821('0x25')](_0x56e521));_0x142368(_0x56e521);})[_0xe821('0x17')](function(_0x35b36f){logger['error']('ShowWhatsappQueue',_0x35b36f[_0xe821('0x14')],_0xd1d23d);_0x21776d(_0x2022f1['error'](0x1f4,_0x35b36f['message']));});});}; \ No newline at end of file +var _0x87c2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','lodash'];(function(_0x4a8f49,_0x13d58f){var _0x16bfde=function(_0x423e44){while(--_0x423e44){_0x4a8f49['push'](_0x4a8f49['shift']());}};_0x16bfde(++_0x13d58f);}(_0x87c2,0x157));var _0x287c=function(_0x3bc06b,_0x398fb4){_0x3bc06b=_0x3bc06b-0x0;var _0x5743d6=_0x87c2[_0x3bc06b];return _0x5743d6;};'use strict';var _=require(_0x287c('0x0'));var util=require('util');var moment=require(_0x287c('0x1'));var BPromise=require(_0x287c('0x2'));var rs=require(_0x287c('0x3'));var fs=require('fs');var Redis=require(_0x287c('0x4'));var db=require(_0x287c('0x5'))['db'];var utils=require(_0x287c('0x6'));var logger=require(_0x287c('0x7'))(_0x287c('0x8'));var config=require(_0x287c('0x9'));var jayson=require(_0x287c('0xa'));var client=jayson[_0x287c('0xb')][_0x287c('0xc')]({'port':0x232a});config[_0x287c('0xd')]=_[_0x287c('0xe')](config['redis'],{'host':_0x287c('0xf'),'port':0x18eb});var socket=require(_0x287c('0x10'))(new Redis(config[_0x287c('0xd')]));require(_0x287c('0x11'))[_0x287c('0x12')](socket);function respondWithRpcPromise(_0x189e97,_0x198a5d,_0xf6bd88){return new BPromise(function(_0x2754a4,_0x211a5f){return client[_0x287c('0x13')](_0x189e97,_0xf6bd88)[_0x287c('0x14')](function(_0x29111d){logger['info'](_0x287c('0x15'),_0x198a5d,_0x287c('0x16'));logger[_0x287c('0x17')](_0x287c('0x18'),_0x198a5d,_0x287c('0x16'),JSON[_0x287c('0x19')](_0x29111d));if(_0x29111d['error']){if(_0x29111d[_0x287c('0x1a')][_0x287c('0x1b')]===0x1f4){logger[_0x287c('0x1a')](_0x287c('0x15'),_0x198a5d,_0x29111d[_0x287c('0x1a')][_0x287c('0x1c')]);return _0x211a5f(_0x29111d[_0x287c('0x1a')][_0x287c('0x1c')]);}logger[_0x287c('0x1a')](_0x287c('0x15'),_0x198a5d,_0x29111d[_0x287c('0x1a')][_0x287c('0x1c')]);return _0x2754a4(_0x29111d[_0x287c('0x1a')]['message']);}else{logger[_0x287c('0x1d')](_0x287c('0x15'),_0x198a5d,_0x287c('0x16'));_0x2754a4(_0x29111d[_0x287c('0x1e')][_0x287c('0x1c')]);}})[_0x287c('0x1f')](function(_0x443956){logger[_0x287c('0x1a')](_0x287c('0x15'),_0x198a5d,_0x443956);_0x211a5f(_0x443956);});});}exports[_0x287c('0x20')]=function(_0x29dbb1){var _0x5f1681=this;return new Promise(function(_0x57bd1f,_0x1b7942){return db[_0x287c('0x21')]['findAll']({'raw':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1['options']['raw']===undefined?!![]:![]:!![],'where':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1[_0x287c('0x22')][_0x287c('0x23')]||null:null,'attributes':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1[_0x287c('0x22')][_0x287c('0x24')]||null:null,'limit':_0x29dbb1['options']?_0x29dbb1[_0x287c('0x22')][_0x287c('0x25')]||null:null,'include':_0x29dbb1[_0x287c('0x22')]?_0x29dbb1[_0x287c('0x22')][_0x287c('0x26')]?_[_0x287c('0x27')](_0x29dbb1['options'][_0x287c('0x26')],function(_0x6dbe27){return{'model':db[_0x6dbe27['model']],'as':_0x6dbe27['as'],'attributes':_0x6dbe27[_0x287c('0x24')],'include':_0x6dbe27[_0x287c('0x26')]?_['map'](_0x6dbe27[_0x287c('0x26')],function(_0x1a4f1d){return{'model':db[_0x1a4f1d['model']],'as':_0x1a4f1d['as'],'attributes':_0x1a4f1d['attributes'],'include':_0x1a4f1d[_0x287c('0x26')]?_[_0x287c('0x27')](_0x1a4f1d[_0x287c('0x26')],function(_0x3b2a8f){return{'model':db[_0x3b2a8f[_0x287c('0x28')]],'as':_0x3b2a8f['as'],'attributes':_0x3b2a8f[_0x287c('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x579e34){logger[_0x287c('0x1d')](_0x287c('0x20'),_0x29dbb1);logger[_0x287c('0x17')](_0x287c('0x20'),_0x29dbb1,JSON['stringify'](_0x579e34));_0x57bd1f(_0x579e34);})[_0x287c('0x1f')](function(_0x3eb88a){logger[_0x287c('0x1a')](_0x287c('0x20'),_0x3eb88a[_0x287c('0x1c')],_0x29dbb1);_0x1b7942(_0x5f1681['error'](0x1f4,_0x3eb88a['message']));});});};exports[_0x287c('0x29')]=function(_0x34b18d){var _0x5f0aa8=this;return new Promise(function(_0x11adf3,_0x55dde6){return db[_0x287c('0x21')][_0x287c('0x2a')]({'raw':_0x34b18d[_0x287c('0x22')]?_0x34b18d[_0x287c('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x34b18d[_0x287c('0x22')]?_0x34b18d['options'][_0x287c('0x23')]||null:null,'attributes':_0x34b18d[_0x287c('0x22')]?_0x34b18d['options'][_0x287c('0x24')]||null:null,'include':_0x34b18d[_0x287c('0x22')]?_0x34b18d[_0x287c('0x22')]['include']?_[_0x287c('0x27')](_0x34b18d[_0x287c('0x22')]['include'],function(_0x217638){return{'model':db[_0x217638['model']],'as':_0x217638['as'],'attributes':_0x217638['attributes'],'include':_0x217638[_0x287c('0x26')]?_[_0x287c('0x27')](_0x217638['include'],function(_0x5d5033){return{'model':db[_0x5d5033[_0x287c('0x28')]],'as':_0x5d5033['as'],'attributes':_0x5d5033[_0x287c('0x24')],'include':_0x5d5033['include']?_[_0x287c('0x27')](_0x5d5033[_0x287c('0x26')],function(_0x41826a){return{'model':db[_0x41826a[_0x287c('0x28')]],'as':_0x41826a['as'],'attributes':_0x41826a[_0x287c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x287c('0x14')](function(_0x427452){logger[_0x287c('0x1d')](_0x287c('0x29'),_0x34b18d);logger[_0x287c('0x17')](_0x287c('0x29'),_0x34b18d,JSON[_0x287c('0x19')](_0x427452));_0x11adf3(_0x427452);})[_0x287c('0x1f')](function(_0x3f6b70){logger[_0x287c('0x1a')](_0x287c('0x29'),_0x3f6b70[_0x287c('0x1c')],_0x34b18d);_0x55dde6(_0x5f0aa8[_0x287c('0x1a')](0x1f4,_0x3f6b70[_0x287c('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 33ea55a..18d567a 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 _0xe911=['remove','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x40fcb3,_0x135010){var _0x251fe8=function(_0x261d3b){while(--_0x261d3b){_0x40fcb3['push'](_0x40fcb3['shift']());}};_0x251fe8(++_0x135010);}(_0xe911,0x18d));var _0x1e91=function(_0x3e7052,_0x3a1c65){_0x3e7052=_0x3e7052-0x0;var _0x566f5f=_0xe911[_0x3e7052];return _0x566f5f;};'use strict';var WhatsappQueueEvents=require(_0x1e91('0x0'));var events=[_0x1e91('0x1'),_0x1e91('0x2'),'update'];function createListener(_0x466479,_0xdb6ada){return function(_0x49548a){_0xdb6ada['emit'](_0x466479,_0x49548a);};}function removeListener(_0x3c2682,_0x3441b7){return function(){WhatsappQueueEvents[_0x1e91('0x3')](_0x3c2682,_0x3441b7);};}exports[_0x1e91('0x4')]=function(_0x491adc){for(var _0x43e7a0=0x0,_0x48c78b=events[_0x1e91('0x5')];_0x43e7a0<_0x48c78b;_0x43e7a0++){var _0x388fe5=events[_0x43e7a0];var _0x17ab2f=createListener(_0x1e91('0x6')+_0x388fe5,_0x491adc);WhatsappQueueEvents['on'](_0x388fe5,_0x17ab2f);}}; \ No newline at end of file +var _0x1b57=['length','./whatsappQueue.events','update','emit','removeListener'];(function(_0x143078,_0x29a590){var _0x1ff4b4=function(_0x4e7aa9){while(--_0x4e7aa9){_0x143078['push'](_0x143078['shift']());}};_0x1ff4b4(++_0x29a590);}(_0x1b57,0x74));var _0x71b5=function(_0x5df794,_0x1eff57){_0x5df794=_0x5df794-0x0;var _0x35376e=_0x1b57[_0x5df794];return _0x35376e;};'use strict';var WhatsappQueueEvents=require(_0x71b5('0x0'));var events=['save','remove',_0x71b5('0x1')];function createListener(_0x55229b,_0x4182c1){return function(_0x32bb23){_0x4182c1[_0x71b5('0x2')](_0x55229b,_0x32bb23);};}function removeListener(_0x46450d,_0x5057bc){return function(){WhatsappQueueEvents[_0x71b5('0x3')](_0x46450d,_0x5057bc);};}exports['register']=function(_0x410ffd){for(var _0x3c84d4=0x0,_0x11f74e=events[_0x71b5('0x4')];_0x3c84d4<_0x11f74e;_0x3c84d4++){var _0x12c28e=events[_0x3c84d4];var _0x26ec65=createListener('whatsappQueue:'+_0x12c28e,_0x410ffd);WhatsappQueueEvents['on'](_0x12c28e,_0x26ec65);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d7dfbb2..9b2f8d8 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 _0x62b0=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x53accd,_0x636b7c){var _0x448716=function(_0x460ecb){while(--_0x460ecb){_0x53accd['push'](_0x53accd['shift']());}};_0x448716(++_0x636b7c);}(_0x62b0,0x1e2));var _0x062b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x062b('0x0'));var util=require(_0x062b('0x1'));var path=require(_0x062b('0x2'));var timeout=require(_0x062b('0x3'));var express=require(_0x062b('0x4'));var router=express[_0x062b('0x5')]();var fs_extra=require(_0x062b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x062b('0x7'));var config=require(_0x062b('0x8'));var controller=require(_0x062b('0x9'));router[_0x062b('0xa')]('/',auth[_0x062b('0xb')](),controller[_0x062b('0xc')]);router[_0x062b('0xa')](_0x062b('0xd'),auth[_0x062b('0xb')](),controller[_0x062b('0xe')]);router['get'](_0x062b('0xf'),auth['isAuthenticated'](),controller[_0x062b('0x10')]);router[_0x062b('0x11')]('/',auth[_0x062b('0xb')](),controller[_0x062b('0x12')]);router[_0x062b('0x13')](_0x062b('0xf'),auth[_0x062b('0xb')](),controller[_0x062b('0x14')]);router['delete'](_0x062b('0xf'),auth[_0x062b('0xb')](),controller[_0x062b('0x15')]);module[_0x062b('0x16')]=router; \ No newline at end of file +var _0x57ce=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','update','/:id','exports','multer','util'];(function(_0x55164c,_0x45bf65){var _0xf5c283=function(_0x2b9223){while(--_0x2b9223){_0x55164c['push'](_0x55164c['shift']());}};_0xf5c283(++_0x45bf65);}(_0x57ce,0x166));var _0xe57c=function(_0x378381,_0x5dbba9){_0x378381=_0x378381-0x0;var _0x5d4378=_0x57ce[_0x378381];return _0x5d4378;};'use strict';var multer=require(_0xe57c('0x0'));var util=require(_0xe57c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe57c('0x2'));var router=express[_0xe57c('0x3')]();var fs_extra=require(_0xe57c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe57c('0x5'));var config=require(_0xe57c('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xe57c('0x7')]('/',auth[_0xe57c('0x8')](),controller[_0xe57c('0x9')]);router[_0xe57c('0x7')](_0xe57c('0xa'),auth[_0xe57c('0x8')](),controller[_0xe57c('0xb')]);router['get']('/:id',auth[_0xe57c('0x8')](),controller[_0xe57c('0xc')]);router[_0xe57c('0xd')]('/',auth[_0xe57c('0x8')](),controller[_0xe57c('0xe')]);router['put']('/:id',auth[_0xe57c('0x8')](),controller[_0xe57c('0xf')]);router['delete'](_0xe57c('0x10'),auth[_0xe57c('0x8')](),controller['destroy']);module[_0xe57c('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b2188f2..50b3b89 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(_0x28fd76,_0x37608c){var _0x434cdc=function(_0x5b87b2){while(--_0x5b87b2){_0x28fd76['push'](_0x28fd76['shift']());}};_0x434cdc(++_0x37608c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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(_0x1deb5f,_0x2fdb8f){var _0x3729a3=function(_0x5def81){while(--_0x5def81){_0x1deb5f['push'](_0x1deb5f['shift']());}};_0x3729a3(++_0x2fdb8f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 fcd8c99..300e54c 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 _0xea28=['end','stack','name','map','WhatsappQueueReport','rawAttributes','fieldName','type','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then'];(function(_0x40197b,_0x4e763f){var _0x3b9c2f=function(_0x41c34f){while(--_0x41c34f){_0x40197b['push'](_0x40197b['shift']());}};_0x3b9c2f(++_0x4e763f);}(_0xea28,0x13a));var _0x8ea2=function(_0x13e774,_0x488ee1){_0x13e774=_0x13e774-0x0;var _0x1a87f5=_0xea28[_0x13e774];return _0x1a87f5;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){_0x199417['status'](0xcc)[_0x8ea2('0x24')]();});}};}function handleEntityNotFound(_0x42bec8,_0x29b38f){return function(_0x4e2106){if(!_0x4e2106){_0x42bec8['sendStatus'](0x194);}return _0x4e2106;};}function handleError(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0x1f4;return function(_0x200a49){logger['error'](_0x200a49[_0x8ea2('0x25')]);if(_0x200a49[_0x8ea2('0x26')]){delete _0x200a49[_0x8ea2('0x26')];}_0x2e4da3[_0x8ea2('0x1b')](_0x4dc7bf)['send'](_0x200a49);};}exports['index']=function(_0xacaa6c,_0x4da5b3){var _0x4a9875={},_0x287078={},_0x24f187={'count':0x0,'rows':[]};var _0x41f482=_[_0x8ea2('0x27')](db[_0x8ea2('0x28')][_0x8ea2('0x29')],function(_0x316707){return{'name':_0x316707[_0x8ea2('0x2a')],'type':_0x316707[_0x8ea2('0x2b')]['key']};});_0x287078['model']=_[_0x8ea2('0x27')](_0x41f482,_0x8ea2('0x26'));_0x287078['query']=_['keys'](_0xacaa6c[_0x8ea2('0x2c')]);_0x287078['filters']=_[_0x8ea2('0x2d')](_0x287078[_0x8ea2('0x2e')],_0x287078['query']);_0x4a9875[_0x8ea2('0x2f')]=_[_0x8ea2('0x2d')](_0x287078[_0x8ea2('0x2e')],qs['fields'](_0xacaa6c['query']['fields']));_0x4a9875[_0x8ea2('0x2f')]=_0x4a9875[_0x8ea2('0x2f')][_0x8ea2('0x30')]?_0x4a9875['attributes']:_0x287078[_0x8ea2('0x2e')];if(!_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x31')](_0x8ea2('0x32'))){_0x4a9875[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x1f')]);_0x4a9875['offset']=qs[_0x8ea2('0x1d')](_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x1d')]);}_0x4a9875[_0x8ea2('0x33')]=qs['sort'](_0xacaa6c[_0x8ea2('0x2c')]['sort']);_0x4a9875[_0x8ea2('0x34')]=qs[_0x8ea2('0x35')](_[_0x8ea2('0x36')](_0xacaa6c[_0x8ea2('0x2c')],_0x287078['filters']),_0x41f482);if(_0xacaa6c[_0x8ea2('0x2c')]['filter']){_0x4a9875['where']=_[_0x8ea2('0x37')](_0x4a9875['where'],{'$or':_[_0x8ea2('0x27')](_0x41f482,function(_0x2f0779){if(_0x2f0779[_0x8ea2('0x2b')]!==_0x8ea2('0x38')){var _0x134584={};_0x134584[_0x2f0779['name']]={'$like':'%'+_0xacaa6c[_0x8ea2('0x2c')]['filter']+'%'};return _0x134584;}})});}_0x4a9875=_[_0x8ea2('0x37')]({},_0x4a9875,_0xacaa6c[_0x8ea2('0x39')]);var _0x6d0e0c={'where':_0x4a9875[_0x8ea2('0x34')]};return db['WhatsappQueueReport'][_0x8ea2('0x20')](_0x6d0e0c)['then'](function(_0x3f0c78){_0x24f187['count']=_0x3f0c78;if(_0xacaa6c[_0x8ea2('0x2c')][_0x8ea2('0x3a')]){_0x4a9875[_0x8ea2('0x3b')]=[{'all':!![]}];}return db[_0x8ea2('0x28')][_0x8ea2('0x3c')](_0x4a9875);})[_0x8ea2('0x23')](function(_0x2f4fa8){_0x24f187['rows']=_0x2f4fa8;return _0x24f187;})['then'](respondWithFilteredResult(_0x4da5b3,_0x4a9875))[_0x8ea2('0x3d')](handleError(_0x4da5b3,null));};exports['show']=function(_0x4b03fa,_0x59e2fa){var _0x3cbc09={'raw':!![],'where':{'id':_0x4b03fa[_0x8ea2('0x3e')]['id']}},_0x5d9ba0={};_0x5d9ba0[_0x8ea2('0x2e')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x28')][_0x8ea2('0x29')]);_0x5d9ba0[_0x8ea2('0x2c')]=_[_0x8ea2('0x3f')](_0x4b03fa[_0x8ea2('0x2c')]);_0x5d9ba0['filters']=_[_0x8ea2('0x2d')](_0x5d9ba0[_0x8ea2('0x2e')],_0x5d9ba0[_0x8ea2('0x2c')]);_0x3cbc09['attributes']=_[_0x8ea2('0x2d')](_0x5d9ba0[_0x8ea2('0x2e')],qs[_0x8ea2('0x40')](_0x4b03fa[_0x8ea2('0x2c')][_0x8ea2('0x40')]));_0x3cbc09['attributes']=_0x3cbc09[_0x8ea2('0x2f')][_0x8ea2('0x30')]?_0x3cbc09[_0x8ea2('0x2f')]:_0x5d9ba0['model'];if(_0x4b03fa[_0x8ea2('0x2c')][_0x8ea2('0x3a')]){_0x3cbc09[_0x8ea2('0x3b')]=[{'all':!![]}];}_0x3cbc09=_[_0x8ea2('0x37')]({},_0x3cbc09,_0x4b03fa[_0x8ea2('0x39')]);return db[_0x8ea2('0x28')][_0x8ea2('0x41')](_0x3cbc09)[_0x8ea2('0x23')](handleEntityNotFound(_0x59e2fa,null))[_0x8ea2('0x23')](respondWithResult(_0x59e2fa,null))[_0x8ea2('0x3d')](handleError(_0x59e2fa,null));};exports[_0x8ea2('0x42')]=function(_0x52d203,_0x220970){return db[_0x8ea2('0x28')]['create'](_0x52d203[_0x8ea2('0x43')],{})[_0x8ea2('0x23')](respondWithResult(_0x220970,0xc9))[_0x8ea2('0x3d')](handleError(_0x220970,null));};exports[_0x8ea2('0x22')]=function(_0x182a46,_0x1daa25){if(_0x182a46[_0x8ea2('0x43')]['id']){delete _0x182a46[_0x8ea2('0x43')]['id'];}return db['WhatsappQueueReport'][_0x8ea2('0x41')]({'where':{'id':_0x182a46[_0x8ea2('0x3e')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x1daa25,null))['then'](saveUpdates(_0x182a46['body'],null))[_0x8ea2('0x23')](respondWithResult(_0x1daa25,null))[_0x8ea2('0x3d')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x44')]=function(_0x5e5c37,_0x3d86f3){return db[_0x8ea2('0x28')][_0x8ea2('0x41')]({'where':{'id':_0x5e5c37[_0x8ea2('0x3e')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x3d86f3,null))['then'](removeEntity(_0x3d86f3,null))['catch'](handleError(_0x3d86f3,null));};exports[_0x8ea2('0x45')]=function(_0x4148c1,_0x1b8c4b){return db['WhatsappQueueReport'][_0x8ea2('0x45')]()[_0x8ea2('0x23')](respondWithResult(_0x1b8c4b,null))[_0x8ea2('0x3d')](handleError(_0x1b8c4b,null));}; \ No newline at end of file +var _0xb688=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','show','includeAll','include','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x26cb44,_0x19d68a){var _0x3ba86c=function(_0xdf5f39){while(--_0xdf5f39){_0x26cb44['push'](_0x26cb44['shift']());}};_0x3ba86c(++_0x19d68a);}(_0xb688,0xcf));var _0x8b68=function(_0x1d8927,_0x3a6c9a){_0x1d8927=_0x1d8927-0x0;var _0x73fb01=_0xb688[_0x1d8927];return _0x73fb01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){_0x32ddc5['status'](0xcc)[_0x8b68('0x27')]();});}};}function handleEntityNotFound(_0x3cf8d2,_0x240b0b){return function(_0x5590ec){if(!_0x5590ec){_0x3cf8d2['sendStatus'](0x194);}return _0x5590ec;};}function handleError(_0x4fe8f6,_0x92d186){_0x92d186=_0x92d186||0x1f4;return function(_0x448e43){logger[_0x8b68('0x28')](_0x448e43['stack']);if(_0x448e43[_0x8b68('0x29')]){delete _0x448e43['name'];}_0x4fe8f6['status'](_0x92d186)[_0x8b68('0x2a')](_0x448e43);};}exports['index']=function(_0x26cad7,_0x3ac356){var _0x48e2c8={},_0x494ce4={},_0x357635={'count':0x0,'rows':[]};var _0x1cd230=_[_0x8b68('0x2b')](db[_0x8b68('0x2c')][_0x8b68('0x2d')],function(_0x2ad2df){return{'name':_0x2ad2df[_0x8b68('0x2e')],'type':_0x2ad2df['type'][_0x8b68('0x2f')]};});_0x494ce4['model']=_[_0x8b68('0x2b')](_0x1cd230,_0x8b68('0x29'));_0x494ce4['query']=_[_0x8b68('0x30')](_0x26cad7[_0x8b68('0x31')]);_0x494ce4[_0x8b68('0x32')]=_['intersection'](_0x494ce4['model'],_0x494ce4[_0x8b68('0x31')]);_0x48e2c8[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x494ce4[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x36')]));_0x48e2c8[_0x8b68('0x33')]=_0x48e2c8[_0x8b68('0x33')][_0x8b68('0x37')]?_0x48e2c8[_0x8b68('0x33')]:_0x494ce4[_0x8b68('0x35')];if(!_0x26cad7[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x48e2c8[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x1f')]);_0x48e2c8[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x26cad7[_0x8b68('0x31')]['offset']);}_0x48e2c8['order']=qs[_0x8b68('0x3a')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3a')]);_0x48e2c8[_0x8b68('0x3b')]=qs[_0x8b68('0x32')](_[_0x8b68('0x3c')](_0x26cad7[_0x8b68('0x31')],_0x494ce4[_0x8b68('0x32')]),_0x1cd230);if(_0x26cad7['query'][_0x8b68('0x3d')]){_0x48e2c8[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x48e2c8[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x2b')](_0x1cd230,function(_0x3e0032){if(_0x3e0032[_0x8b68('0x3f')]!==_0x8b68('0x40')){var _0x517571={};_0x517571[_0x3e0032[_0x8b68('0x29')]]={'$like':'%'+_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3d')]+'%'};return _0x517571;}})});}_0x48e2c8=_[_0x8b68('0x3e')]({},_0x48e2c8,_0x26cad7[_0x8b68('0x41')]);var _0x3b3394={'where':_0x48e2c8[_0x8b68('0x3b')]};return db['WhatsappQueueReport'][_0x8b68('0x21')](_0x3b3394)[_0x8b68('0x25')](function(_0x48f159){_0x357635[_0x8b68('0x21')]=_0x48f159;if(_0x26cad7[_0x8b68('0x31')]['includeAll']){_0x48e2c8['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x48e2c8);})[_0x8b68('0x25')](function(_0x23d24a){_0x357635['rows']=_0x23d24a;return _0x357635;})[_0x8b68('0x25')](respondWithFilteredResult(_0x3ac356,_0x48e2c8))['catch'](handleError(_0x3ac356,null));};exports[_0x8b68('0x42')]=function(_0x3841d2,_0x5a3193){var _0x2f90d9={'raw':!![],'where':{'id':_0x3841d2['params']['id']}},_0x5ae345={};_0x5ae345['model']=_[_0x8b68('0x30')](db[_0x8b68('0x2c')][_0x8b68('0x2d')]);_0x5ae345[_0x8b68('0x31')]=_['keys'](_0x3841d2[_0x8b68('0x31')]);_0x5ae345['filters']=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],_0x5ae345['query']);_0x2f90d9[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x3841d2['query'][_0x8b68('0x36')]));_0x2f90d9[_0x8b68('0x33')]=_0x2f90d9[_0x8b68('0x33')][_0x8b68('0x37')]?_0x2f90d9[_0x8b68('0x33')]:_0x5ae345[_0x8b68('0x35')];if(_0x3841d2[_0x8b68('0x31')][_0x8b68('0x43')]){_0x2f90d9[_0x8b68('0x44')]=[{'all':!![]}];}_0x2f90d9=_[_0x8b68('0x3e')]({},_0x2f90d9,_0x3841d2[_0x8b68('0x41')]);return db[_0x8b68('0x2c')][_0x8b68('0x45')](_0x2f90d9)[_0x8b68('0x25')](handleEntityNotFound(_0x5a3193,null))[_0x8b68('0x25')](respondWithResult(_0x5a3193,null))[_0x8b68('0x46')](handleError(_0x5a3193,null));};exports['create']=function(_0x3b7b06,_0x20681a){return db['WhatsappQueueReport'][_0x8b68('0x47')](_0x3b7b06['body'],{})['then'](respondWithResult(_0x20681a,0xc9))['catch'](handleError(_0x20681a,null));};exports[_0x8b68('0x24')]=function(_0x35874b,_0x34047c){if(_0x35874b[_0x8b68('0x48')]['id']){delete _0x35874b['body']['id'];}return db['WhatsappQueueReport'][_0x8b68('0x45')]({'where':{'id':_0x35874b[_0x8b68('0x49')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))['then'](saveUpdates(_0x35874b[_0x8b68('0x48')],null))[_0x8b68('0x25')](respondWithResult(_0x34047c,null))['catch'](handleError(_0x34047c,null));};exports[_0x8b68('0x26')]=function(_0xacac82,_0x595942){return db[_0x8b68('0x2c')][_0x8b68('0x45')]({'where':{'id':_0xacac82['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x595942,null))[_0x8b68('0x25')](removeEntity(_0x595942,null))['catch'](handleError(_0x595942,null));};exports['describe']=function(_0x5e3e99,_0x28f82d){return db[_0x8b68('0x2c')][_0x8b68('0x4a')]()[_0x8b68('0x25')](respondWithResult(_0x28f82d,null))['catch'](handleError(_0x28f82d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index acf725d..6d7a34c 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 _0x35aa=['lodash','util','../../config/logger','moment','bluebird','path','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0xd7d0d0,_0xf533cf){var _0x3c6e6d=function(_0x33d253){while(--_0x33d253){_0xd7d0d0['push'](_0xd7d0d0['shift']());}};_0x3c6e6d(++_0xf533cf);}(_0x35aa,0xa5));var _0xa35a=function(_0x508823,_0x316707){_0x508823=_0x508823-0x0;var _0x13523b=_0x35aa[_0x508823];return _0x13523b;};'use strict';var _=require(_0xa35a('0x0'));var util=require(_0xa35a('0x1'));var logger=require(_0xa35a('0x2'))('api');var moment=require(_0xa35a('0x3'));var BPromise=require(_0xa35a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa35a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa35a('0x6'));module['exports']=function(_0x468857,_0x513dbe){return _0x468857[_0xa35a('0x7')](_0xa35a('0x8'),attributes,{'tableName':_0xa35a('0x9'),'paranoid':![],'indexes':[{'name':_0xa35a('0xa'),'fields':[_0xa35a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd84=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x138e50,_0x4c6de7){var _0x11bd9d=function(_0x19d90a){while(--_0x19d90a){_0x138e50['push'](_0x138e50['shift']());}};_0x11bd9d(++_0x4c6de7);}(_0xdd84,0x1bb));var _0x4dd8=function(_0x1d8472,_0x4d166){_0x1d8472=_0x1d8472-0x0;var _0x10dc38=_0xdd84[_0x1d8472];return _0x10dc38;};'use strict';var _=require(_0x4dd8('0x0'));var util=require(_0x4dd8('0x1'));var logger=require(_0x4dd8('0x2'))('api');var moment=require(_0x4dd8('0x3'));var BPromise=require(_0x4dd8('0x4'));var rp=require(_0x4dd8('0x5'));var fs=require('fs');var path=require(_0x4dd8('0x6'));var rimraf=require(_0x4dd8('0x7'));var config=require(_0x4dd8('0x8'));var attributes=require(_0x4dd8('0x9'));module[_0x4dd8('0xa')]=function(_0x2da053,_0x13835d){return _0x2da053[_0x4dd8('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x4dd8('0xc'),'paranoid':![],'indexes':[{'name':_0x4dd8('0xd'),'fields':[_0x4dd8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4637d7b..ca6758c 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 _0xf765=['message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','raw','UpdateWhatsappQueueReport','update','options','where','limit','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x5f2973,_0xb7a143){var _0x2478dd=function(_0x303101){while(--_0x303101){_0x5f2973['push'](_0x5f2973['shift']());}};_0x2478dd(++_0xb7a143);}(_0xf765,0xd7));var _0x5f76=function(_0x20f2e4,_0x20e4cc){_0x20f2e4=_0x20f2e4-0x0;var _0x303401=_0xf765[_0x20f2e4];return _0x303401;};'use strict';var _=require(_0x5f76('0x0'));var util=require(_0x5f76('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5f76('0x2'));var fs=require('fs');var Redis=require(_0x5f76('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f76('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f76('0x5'));var jayson=require(_0x5f76('0x6'));var client=jayson[_0x5f76('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81de35,_0x2c4c8a,_0x2116ee){return new BPromise(function(_0x1ad041,_0x58fe82){return client[_0x5f76('0x8')](_0x81de35,_0x2116ee)[_0x5f76('0x9')](function(_0x12a880){logger[_0x5f76('0xa')](_0x5f76('0xb'),_0x2c4c8a,_0x5f76('0xc'));logger[_0x5f76('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2c4c8a,_0x5f76('0xc'),JSON[_0x5f76('0xe')](_0x12a880));if(_0x12a880['error']){if(_0x12a880['error'][_0x5f76('0xf')]===0x1f4){logger[_0x5f76('0x10')](_0x5f76('0xb'),_0x2c4c8a,_0x12a880['error'][_0x5f76('0x11')]);return _0x58fe82(_0x12a880[_0x5f76('0x10')][_0x5f76('0x11')]);}logger[_0x5f76('0x10')](_0x5f76('0xb'),_0x2c4c8a,_0x12a880['error'][_0x5f76('0x11')]);return _0x1ad041(_0x12a880[_0x5f76('0x10')][_0x5f76('0x11')]);}else{logger[_0x5f76('0xa')](_0x5f76('0xb'),_0x2c4c8a,_0x5f76('0xc'));_0x1ad041(_0x12a880[_0x5f76('0x12')][_0x5f76('0x11')]);}})[_0x5f76('0x13')](function(_0x2963a5){logger[_0x5f76('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c4c8a,_0x2963a5);_0x58fe82(_0x2963a5);});});}exports[_0x5f76('0x14')]=function(_0x572f1f){var _0x2d3e4a=this;return new Promise(function(_0x3a921f,_0x814ee){return db[_0x5f76('0x15')]['create'](_0x572f1f[_0x5f76('0x16')],{'raw':_0x572f1f['options']?_0x572f1f['options'][_0x5f76('0x17')]===undefined?!![]:![]:!![]})[_0x5f76('0x9')](function(_0x3ff877){logger['info'](_0x5f76('0x14'),_0x572f1f);logger['debug'](_0x5f76('0x14'),_0x572f1f,JSON[_0x5f76('0xe')](_0x3ff877));_0x3a921f(_0x3ff877);})['catch'](function(_0x4c421d){logger['error']('CreateWhatsappQueueReport',_0x4c421d[_0x5f76('0x11')],_0x572f1f);_0x814ee(_0x2d3e4a[_0x5f76('0x10')](0x1f4,_0x4c421d[_0x5f76('0x11')]));});});};exports[_0x5f76('0x18')]=function(_0x559dc0){var _0x3217d9=this;return new Promise(function(_0x2b044a,_0x1948e9){return db['WhatsappQueueReport'][_0x5f76('0x19')](_0x559dc0[_0x5f76('0x16')],{'raw':_0x559dc0[_0x5f76('0x1a')]?_0x559dc0[_0x5f76('0x1a')][_0x5f76('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x559dc0[_0x5f76('0x1a')]?_0x559dc0[_0x5f76('0x1a')][_0x5f76('0x1b')]||null:null,'attributes':_0x559dc0[_0x5f76('0x1a')]?_0x559dc0[_0x5f76('0x1a')]['attributes']||null:null,'limit':_0x559dc0[_0x5f76('0x1a')]?_0x559dc0['options'][_0x5f76('0x1c')]||null:null})[_0x5f76('0x9')](function(_0x29788e){logger[_0x5f76('0xa')](_0x5f76('0x18'),_0x559dc0);logger[_0x5f76('0xd')](_0x5f76('0x18'),_0x559dc0,JSON['stringify'](_0x29788e));_0x2b044a(_0x29788e);})['catch'](function(_0x21821e){logger[_0x5f76('0x10')](_0x5f76('0x18'),_0x21821e[_0x5f76('0x11')],_0x559dc0);_0x1948e9(_0x3217d9[_0x5f76('0x10')](0x1f4,_0x21821e[_0x5f76('0x11')]));});});}; \ No newline at end of file +var _0x6d3f=['info','result','catch','WhatsappQueueReport','create','body','options','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message'];(function(_0x16ffe9,_0x26b266){var _0x440b0d=function(_0x875847){while(--_0x875847){_0x16ffe9['push'](_0x16ffe9['shift']());}};_0x440b0d(++_0x26b266);}(_0x6d3f,0x72));var _0xf6d3=function(_0x375892,_0x1bead7){_0x375892=_0x375892-0x0;var _0x3ed844=_0x6d3f[_0x375892];return _0x3ed844;};'use strict';var _=require(_0xf6d3('0x0'));var util=require(_0xf6d3('0x1'));var moment=require(_0xf6d3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6d3('0x3'))['db'];var utils=require(_0xf6d3('0x4'));var logger=require(_0xf6d3('0x5'))(_0xf6d3('0x6'));var config=require(_0xf6d3('0x7'));var jayson=require(_0xf6d3('0x8'));var client=jayson[_0xf6d3('0x9')][_0xf6d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb43f,_0xd3f434,_0x174ff4){return new BPromise(function(_0x13b174,_0x3a60d4){return client['request'](_0x2eb43f,_0x174ff4)['then'](function(_0x8e9ab6){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xd3f434,_0xf6d3('0xb'));logger[_0xf6d3('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd3f434,_0xf6d3('0xb'),JSON[_0xf6d3('0xd')](_0x8e9ab6));if(_0x8e9ab6[_0xf6d3('0xe')]){if(_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0xf')]===0x1f4){logger[_0xf6d3('0xe')](_0xf6d3('0x10'),_0xd3f434,_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0x11')]);return _0x3a60d4(_0x8e9ab6['error'][_0xf6d3('0x11')]);}logger['error'](_0xf6d3('0x10'),_0xd3f434,_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0x11')]);return _0x13b174(_0x8e9ab6[_0xf6d3('0xe')][_0xf6d3('0x11')]);}else{logger[_0xf6d3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd3f434,'request\x20sent');_0x13b174(_0x8e9ab6[_0xf6d3('0x13')][_0xf6d3('0x11')]);}})[_0xf6d3('0x14')](function(_0x3935a6){logger[_0xf6d3('0xe')](_0xf6d3('0x10'),_0xd3f434,_0x3935a6);_0x3a60d4(_0x3935a6);});});}exports['CreateWhatsappQueueReport']=function(_0x1e5852){var _0x1fbbe4=this;return new Promise(function(_0xf0de71,_0x41ac83){return db[_0xf6d3('0x15')][_0xf6d3('0x16')](_0x1e5852[_0xf6d3('0x17')],{'raw':_0x1e5852[_0xf6d3('0x18')]?_0x1e5852[_0xf6d3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf6d3('0x19')](function(_0x2ef325){logger[_0xf6d3('0x12')](_0xf6d3('0x1a'),_0x1e5852);logger[_0xf6d3('0xc')](_0xf6d3('0x1a'),_0x1e5852,JSON[_0xf6d3('0xd')](_0x2ef325));_0xf0de71(_0x2ef325);})['catch'](function(_0x246657){logger[_0xf6d3('0xe')](_0xf6d3('0x1a'),_0x246657[_0xf6d3('0x11')],_0x1e5852);_0x41ac83(_0x1fbbe4[_0xf6d3('0xe')](0x1f4,_0x246657['message']));});});};exports[_0xf6d3('0x1b')]=function(_0x2d38bc){var _0x1fa97a=this;return new Promise(function(_0x2e6fe8,_0x53c1e4){return db[_0xf6d3('0x15')][_0xf6d3('0x1c')](_0x2d38bc['body'],{'raw':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc[_0xf6d3('0x18')][_0xf6d3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc['options'][_0xf6d3('0x1e')]||null:null,'attributes':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc[_0xf6d3('0x18')][_0xf6d3('0x1f')]||null:null,'limit':_0x2d38bc[_0xf6d3('0x18')]?_0x2d38bc[_0xf6d3('0x18')][_0xf6d3('0x20')]||null:null})[_0xf6d3('0x19')](function(_0x217c83){logger[_0xf6d3('0x12')](_0xf6d3('0x1b'),_0x2d38bc);logger[_0xf6d3('0xc')](_0xf6d3('0x1b'),_0x2d38bc,JSON['stringify'](_0x217c83));_0x2e6fe8(_0x217c83);})[_0xf6d3('0x14')](function(_0x1a4b88){logger[_0xf6d3('0xe')](_0xf6d3('0x1b'),_0x1a4b88[_0xf6d3('0x11')],_0x2d38bc);_0x53c1e4(_0x1fa97a[_0xf6d3('0xe')](0x1f4,_0x1a4b88['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 90313f6..9d1acb9 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 _0x2de5=['index','describe','show','post','create','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x2236cb,_0x2e8bfd){var _0x5d9487=function(_0x27c147){while(--_0x27c147){_0x2236cb['push'](_0x2236cb['shift']());}};_0x5d9487(++_0x2e8bfd);}(_0x2de5,0xa0));var _0x52de=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2de5[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x52de('0x0'));var util=require(_0x52de('0x1'));var path=require('path');var timeout=require(_0x52de('0x2'));var express=require('express');var router=express[_0x52de('0x3')]();var fs_extra=require(_0x52de('0x4'));var auth=require(_0x52de('0x5'));var interaction=require(_0x52de('0x6'));var config=require(_0x52de('0x7'));var controller=require(_0x52de('0x8'));router[_0x52de('0x9')]('/',auth[_0x52de('0xa')](),controller[_0x52de('0xb')]);router[_0x52de('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x52de('0xc')]);router[_0x52de('0x9')]('/:id',auth[_0x52de('0xa')](),controller[_0x52de('0xd')]);router[_0x52de('0xe')]('/',auth[_0x52de('0xa')](),controller[_0x52de('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x52de('0x10')]);router[_0x52de('0x11')]('/:id',auth[_0x52de('0xa')](),controller['destroy']);module[_0x52de('0x12')]=router; \ No newline at end of file +var _0x09d9=['/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x550ece,_0x2e6bd4){var _0x3ae2f6=function(_0x14b402){while(--_0x14b402){_0x550ece['push'](_0x550ece['shift']());}};_0x3ae2f6(++_0x2e6bd4);}(_0x09d9,0xcf));var _0x909d=function(_0x497497,_0x4135a8){_0x497497=_0x497497-0x0;var _0x41eeff=_0x09d9[_0x497497];return _0x41eeff;};'use strict';var multer=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var path=require(_0x909d('0x2'));var timeout=require(_0x909d('0x3'));var express=require('express');var router=express[_0x909d('0x4')]();var fs_extra=require(_0x909d('0x5'));var auth=require(_0x909d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x909d('0x7'));var controller=require(_0x909d('0x8'));router[_0x909d('0x9')]('/',auth[_0x909d('0xa')](),controller[_0x909d('0xb')]);router[_0x909d('0x9')](_0x909d('0xc'),auth[_0x909d('0xa')](),controller['describe']);router[_0x909d('0x9')](_0x909d('0xd'),auth[_0x909d('0xa')](),controller[_0x909d('0xe')]);router[_0x909d('0xf')]('/',auth[_0x909d('0xa')](),controller['create']);router[_0x909d('0x10')](_0x909d('0xd'),auth[_0x909d('0xa')](),controller[_0x909d('0x11')]);router['delete'](_0x909d('0xd'),auth['isAuthenticated'](),controller[_0x909d('0x12')]);module[_0x909d('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 28c7749..b2d3e9c 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 _0x689b=['queue','DATE','sequelize','STRING','agent'];(function(_0x154911,_0x570fd9){var _0x40764b=function(_0x2a153a){while(--_0x2a153a){_0x154911['push'](_0x154911['shift']());}};_0x40764b(++_0x570fd9);}(_0x689b,0x142));var _0xb689=function(_0x3e06a2,_0x2be4d2){_0x3e06a2=_0x3e06a2-0x0;var _0x5c5827=_0x689b[_0x3e06a2];return _0x5c5827;};'use strict';var Sequelize=require(_0xb689('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb689('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xb689('0x2'),_0xb689('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb689('0x4')]}}; \ No newline at end of file +var _0xa3b7=['queue','DATE','sequelize','STRING','account','agent'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0xa3b7[_0x55677b];return _0x104b88;};'use strict';var Sequelize=require(_0x7a3b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7a3b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7a3b('0x2'),_0x7a3b('0x3'),_0x7a3b('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7a3b('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6570605..2ef5f51 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 _0xc7d5=['destroy','then','stack','name','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','options','include','findAll','catch','show','params','includeAll','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','status','end','offset','limit','undefined','count','set','Content-Range','apply','update'];(function(_0x38ea25,_0x3231de){var _0x5afea6=function(_0x4243b6){while(--_0x4243b6){_0x38ea25['push'](_0x38ea25['shift']());}};_0x5afea6(++_0x3231de);}(_0xc7d5,0x6b));var _0x5c7d=function(_0x3429b5,_0x3e7d3b){_0x3429b5=_0x3429b5-0x0;var _0x559b14=_0xc7d5[_0x3429b5];return _0x559b14;};'use strict';var emlformat=require(_0x5c7d('0x0'));var rimraf=require(_0x5c7d('0x1'));var zipdir=require(_0x5c7d('0x2'));var jsonpatch=require(_0x5c7d('0x3'));var rp=require(_0x5c7d('0x4'));var moment=require(_0x5c7d('0x5'));var BPromise=require(_0x5c7d('0x6'));var Mustache=require('mustache');var util=require(_0x5c7d('0x7'));var path=require(_0x5c7d('0x8'));var sox=require(_0x5c7d('0x9'));var csv=require(_0x5c7d('0xa'));var ejs=require(_0x5c7d('0xb'));var fs=require('fs');var fs_extra=require(_0x5c7d('0xc'));var _=require(_0x5c7d('0xd'));var squel=require(_0x5c7d('0xe'));var crypto=require(_0x5c7d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5c7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c7d('0x11'));var Papa=require(_0x5c7d('0x12'));var Redis=require(_0x5c7d('0x13'));var authService=require(_0x5c7d('0x14'));var qs=require(_0x5c7d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c7d('0x16'));var logger=require(_0x5c7d('0x17'))('api');var utils=require(_0x5c7d('0x18'));var config=require(_0x5c7d('0x19'));var licenseUtil=require(_0x5c7d('0x1a'));var db=require(_0x5c7d('0x1b'))['db'];function respondWithStatusCode(_0x1e5510,_0x1bff69){_0x1bff69=_0x1bff69||0xcc;return function(_0x263fbf){if(_0x263fbf){return _0x1e5510[_0x5c7d('0x1c')](_0x1bff69);}return _0x1e5510[_0x5c7d('0x1d')](_0x1bff69)[_0x5c7d('0x1e')]();};}function respondWithResult(_0x3af70c,_0x6bb486){_0x6bb486=_0x6bb486||0xc8;return function(_0x25c295){if(_0x25c295){return _0x3af70c['status'](_0x6bb486)['json'](_0x25c295);}};}function respondWithFilteredResult(_0x1deffa,_0x382ffb){return function(_0x406154){if(_0x406154){var _0x3052a7=typeof _0x382ffb[_0x5c7d('0x1f')]==='undefined'&&typeof _0x382ffb[_0x5c7d('0x20')]===_0x5c7d('0x21');var _0x47c882=_0x406154[_0x5c7d('0x22')];var _0x54386c=_0x3052a7?0x0:_0x382ffb[_0x5c7d('0x1f')];var _0x5349b3=_0x3052a7?_0x406154[_0x5c7d('0x22')]:_0x382ffb[_0x5c7d('0x1f')]+_0x382ffb[_0x5c7d('0x20')];var _0x54e1b5;if(_0x5349b3>=_0x47c882){_0x5349b3=_0x47c882;_0x54e1b5=0xc8;}else{_0x54e1b5=0xce;}_0x1deffa[_0x5c7d('0x1d')](_0x54e1b5);return _0x1deffa[_0x5c7d('0x23')](_0x5c7d('0x24'),_0x54386c+'-'+_0x5349b3+'/'+_0x47c882)['json'](_0x406154);}return null;};}function patchUpdates(_0x454644){return function(_0x215d85){try{jsonpatch[_0x5c7d('0x25')](_0x215d85,_0x454644,!![]);}catch(_0xfa9b3d){return BPromise['reject'](_0xfa9b3d);}return _0x215d85['save']();};}function saveUpdates(_0x51b60b,_0x24230c){return function(_0xe55249){if(_0xe55249){return _0xe55249[_0x5c7d('0x26')](_0x51b60b)['then'](function(_0x4cf542){return _0x4cf542;});}return null;};}function removeEntity(_0x5f5da5,_0x8cd3c3){return function(_0x27332b){if(_0x27332b){return _0x27332b[_0x5c7d('0x27')]()[_0x5c7d('0x28')](function(){_0x5f5da5[_0x5c7d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e234,_0x15f4ff){return function(_0x1355ee){if(!_0x1355ee){_0x20e234[_0x5c7d('0x1c')](0x194);}return _0x1355ee;};}function handleError(_0x4fd478,_0x1d04a2){_0x1d04a2=_0x1d04a2||0x1f4;return function(_0x5bcbd1){logger['error'](_0x5bcbd1[_0x5c7d('0x29')]);if(_0x5bcbd1['name']){delete _0x5bcbd1[_0x5c7d('0x2a')];}_0x4fd478['status'](_0x1d04a2)['send'](_0x5bcbd1);};}exports['index']=function(_0x307480,_0x4b85bd){var _0x3dbebe={},_0x2f4c3e={},_0x158dfd={'count':0x0,'rows':[]};var _0x22a841=_['map'](db[_0x5c7d('0x2b')][_0x5c7d('0x2c')],function(_0x3ae164){return{'name':_0x3ae164[_0x5c7d('0x2d')],'type':_0x3ae164[_0x5c7d('0x2e')][_0x5c7d('0x2f')]};});_0x2f4c3e['model']=_['map'](_0x22a841,_0x5c7d('0x2a'));_0x2f4c3e[_0x5c7d('0x30')]=_[_0x5c7d('0x31')](_0x307480[_0x5c7d('0x30')]);_0x2f4c3e[_0x5c7d('0x32')]=_['intersection'](_0x2f4c3e[_0x5c7d('0x33')],_0x2f4c3e[_0x5c7d('0x30')]);_0x3dbebe['attributes']=_[_0x5c7d('0x34')](_0x2f4c3e[_0x5c7d('0x33')],qs[_0x5c7d('0x35')](_0x307480[_0x5c7d('0x30')]['fields']));_0x3dbebe[_0x5c7d('0x36')]=_0x3dbebe[_0x5c7d('0x36')][_0x5c7d('0x37')]?_0x3dbebe[_0x5c7d('0x36')]:_0x2f4c3e[_0x5c7d('0x33')];if(!_0x307480[_0x5c7d('0x30')][_0x5c7d('0x38')]('nolimit')){_0x3dbebe[_0x5c7d('0x20')]=qs[_0x5c7d('0x20')](_0x307480[_0x5c7d('0x30')][_0x5c7d('0x20')]);_0x3dbebe['offset']=qs['offset'](_0x307480[_0x5c7d('0x30')][_0x5c7d('0x1f')]);}_0x3dbebe[_0x5c7d('0x39')]=qs['sort'](_0x307480['query'][_0x5c7d('0x3a')]);_0x3dbebe['where']=qs[_0x5c7d('0x32')](_[_0x5c7d('0x3b')](_0x307480[_0x5c7d('0x30')],_0x2f4c3e[_0x5c7d('0x32')]),_0x22a841);if(_0x307480[_0x5c7d('0x30')][_0x5c7d('0x3c')]){_0x3dbebe[_0x5c7d('0x3d')]=_[_0x5c7d('0x3e')](_0x3dbebe['where'],{'$or':_[_0x5c7d('0x3f')](_0x22a841,function(_0x3719f5){if(_0x3719f5[_0x5c7d('0x2e')]!=='VIRTUAL'){var _0x4881e6={};_0x4881e6[_0x3719f5[_0x5c7d('0x2a')]]={'$like':'%'+_0x307480[_0x5c7d('0x30')][_0x5c7d('0x3c')]+'%'};return _0x4881e6;}})});}_0x3dbebe=_['merge']({},_0x3dbebe,_0x307480[_0x5c7d('0x40')]);var _0x596bf1={'where':_0x3dbebe['where']};return db[_0x5c7d('0x2b')][_0x5c7d('0x22')](_0x596bf1)[_0x5c7d('0x28')](function(_0x3fb4b1){_0x158dfd[_0x5c7d('0x22')]=_0x3fb4b1;if(_0x307480[_0x5c7d('0x30')]['includeAll']){_0x3dbebe[_0x5c7d('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x5c7d('0x42')](_0x3dbebe);})[_0x5c7d('0x28')](function(_0x15fa2f){_0x158dfd['rows']=_0x15fa2f;return _0x158dfd;})[_0x5c7d('0x28')](respondWithFilteredResult(_0x4b85bd,_0x3dbebe))[_0x5c7d('0x43')](handleError(_0x4b85bd,null));};exports[_0x5c7d('0x44')]=function(_0x9b2864,_0x20cad6){var _0x172350={'raw':!![],'where':{'id':_0x9b2864[_0x5c7d('0x45')]['id']}},_0x190d14={};_0x190d14[_0x5c7d('0x33')]=_[_0x5c7d('0x31')](db['WhatsappTransferReport'][_0x5c7d('0x2c')]);_0x190d14['query']=_[_0x5c7d('0x31')](_0x9b2864['query']);_0x190d14['filters']=_[_0x5c7d('0x34')](_0x190d14[_0x5c7d('0x33')],_0x190d14['query']);_0x172350[_0x5c7d('0x36')]=_[_0x5c7d('0x34')](_0x190d14[_0x5c7d('0x33')],qs['fields'](_0x9b2864[_0x5c7d('0x30')]['fields']));_0x172350[_0x5c7d('0x36')]=_0x172350[_0x5c7d('0x36')][_0x5c7d('0x37')]?_0x172350[_0x5c7d('0x36')]:_0x190d14[_0x5c7d('0x33')];if(_0x9b2864[_0x5c7d('0x30')][_0x5c7d('0x46')]){_0x172350[_0x5c7d('0x41')]=[{'all':!![]}];}_0x172350=_[_0x5c7d('0x3e')]({},_0x172350,_0x9b2864[_0x5c7d('0x40')]);return db[_0x5c7d('0x2b')]['find'](_0x172350)[_0x5c7d('0x28')](handleEntityNotFound(_0x20cad6,null))['then'](respondWithResult(_0x20cad6,null))[_0x5c7d('0x43')](handleError(_0x20cad6,null));};exports['create']=function(_0x4d3a46,_0x34569f){return db[_0x5c7d('0x2b')]['create'](_0x4d3a46[_0x5c7d('0x47')],{})[_0x5c7d('0x28')](respondWithResult(_0x34569f,0xc9))['catch'](handleError(_0x34569f,null));};exports[_0x5c7d('0x26')]=function(_0x4159e0,_0x3da3b8){if(_0x4159e0[_0x5c7d('0x47')]['id']){delete _0x4159e0[_0x5c7d('0x47')]['id'];}return db[_0x5c7d('0x2b')]['find']({'where':{'id':_0x4159e0[_0x5c7d('0x45')]['id']}})[_0x5c7d('0x28')](handleEntityNotFound(_0x3da3b8,null))['then'](saveUpdates(_0x4159e0['body'],null))[_0x5c7d('0x28')](respondWithResult(_0x3da3b8,null))['catch'](handleError(_0x3da3b8,null));};exports[_0x5c7d('0x27')]=function(_0x2636e3,_0x1abe29){return db[_0x5c7d('0x2b')]['find']({'where':{'id':_0x2636e3[_0x5c7d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1abe29,null))[_0x5c7d('0x28')](removeEntity(_0x1abe29,null))[_0x5c7d('0x43')](handleError(_0x1abe29,null));};exports[_0x5c7d('0x48')]=function(_0x464f03,_0x1221d0){return db[_0x5c7d('0x2b')][_0x5c7d('0x48')]()[_0x5c7d('0x28')](respondWithResult(_0x1221d0,null))[_0x5c7d('0x43')](handleError(_0x1221d0,null));}; \ No newline at end of file +var _0xab40=['describe','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','then','stack','name','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','WhatsappTransferReport','findAll','rows','show','params','include','catch','create','body','update','find'];(function(_0xf25cf8,_0x1b0383){var _0x316dd9=function(_0x1d4b43){while(--_0x1d4b43){_0xf25cf8['push'](_0xf25cf8['shift']());}};_0x316dd9(++_0x1b0383);}(_0xab40,0xcd));var _0x0ab4=function(_0x232a38,_0x1cb94d){_0x232a38=_0x232a38-0x0;var _0x1c7a65=_0xab40[_0x232a38];return _0x1c7a65;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){_0x14087f[_0x0ab4('0x16')](0xcc)[_0x0ab4('0x17')]();});}};}function handleEntityNotFound(_0x4ea9aa,_0x4c5caf){return function(_0x176ff1){if(!_0x176ff1){_0x4ea9aa[_0x0ab4('0x15')](0x194);}return _0x176ff1;};}function handleError(_0x1a17ce,_0x4ae515){_0x4ae515=_0x4ae515||0x1f4;return function(_0x519b23){logger['error'](_0x519b23[_0x0ab4('0x20')]);if(_0x519b23['name']){delete _0x519b23[_0x0ab4('0x21')];}_0x1a17ce[_0x0ab4('0x16')](_0x4ae515)['send'](_0x519b23);};}exports['index']=function(_0x4d0cc1,_0x3d38a4){var _0x183bac={},_0x1cfdad={},_0x3f61cb={'count':0x0,'rows':[]};var _0x25385e=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x2e7a97){return{'name':_0x2e7a97[_0x0ab4('0x22')],'type':_0x2e7a97[_0x0ab4('0x23')][_0x0ab4('0x24')]};});_0x1cfdad[_0x0ab4('0x25')]=_['map'](_0x25385e,'name');_0x1cfdad[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0x4d0cc1[_0x0ab4('0x26')]);_0x1cfdad['filters']=_['intersection'](_0x1cfdad[_0x0ab4('0x25')],_0x1cfdad['query']);_0x183bac[_0x0ab4('0x28')]=_[_0x0ab4('0x29')](_0x1cfdad[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x183bac['attributes']=_0x183bac[_0x0ab4('0x28')][_0x0ab4('0x2b')]?_0x183bac[_0x0ab4('0x28')]:_0x1cfdad[_0x0ab4('0x25')];if(!_0x4d0cc1['query']['hasOwnProperty'](_0x0ab4('0x2c'))){_0x183bac[_0x0ab4('0x1b')]=qs[_0x0ab4('0x1b')](_0x4d0cc1['query']['limit']);_0x183bac['offset']=qs[_0x0ab4('0x19')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x19')]);}_0x183bac['order']=qs['sort'](_0x4d0cc1['query'][_0x0ab4('0x2d')]);_0x183bac[_0x0ab4('0x2e')]=qs[_0x0ab4('0x2f')](_[_0x0ab4('0x30')](_0x4d0cc1[_0x0ab4('0x26')],_0x1cfdad[_0x0ab4('0x2f')]),_0x25385e);if(_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]){_0x183bac[_0x0ab4('0x2e')]=_[_0x0ab4('0x32')](_0x183bac['where'],{'$or':_[_0x0ab4('0x33')](_0x25385e,function(_0x31e234){if(_0x31e234[_0x0ab4('0x23')]!==_0x0ab4('0x34')){var _0x2e1da9={};_0x2e1da9[_0x31e234[_0x0ab4('0x21')]]={'$like':'%'+_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]+'%'};return _0x2e1da9;}})});}_0x183bac=_[_0x0ab4('0x32')]({},_0x183bac,_0x4d0cc1[_0x0ab4('0x35')]);var _0x449437={'where':_0x183bac[_0x0ab4('0x2e')]};return db['WhatsappTransferReport'][_0x0ab4('0x36')](_0x449437)[_0x0ab4('0x1f')](function(_0x1cee1c){_0x3f61cb[_0x0ab4('0x36')]=_0x1cee1c;if(_0x4d0cc1['query'][_0x0ab4('0x37')]){_0x183bac['include']=[{'all':!![]}];}return db[_0x0ab4('0x38')][_0x0ab4('0x39')](_0x183bac);})[_0x0ab4('0x1f')](function(_0x245021){_0x3f61cb[_0x0ab4('0x3a')]=_0x245021;return _0x3f61cb;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x3d38a4,_0x183bac))['catch'](handleError(_0x3d38a4,null));};exports[_0x0ab4('0x3b')]=function(_0x3cc364,_0xe3df73){var _0x48029f={'raw':!![],'where':{'id':_0x3cc364[_0x0ab4('0x3c')]['id']}},_0x395e0b={};_0x395e0b[_0x0ab4('0x25')]=_[_0x0ab4('0x27')](db[_0x0ab4('0x38')]['rawAttributes']);_0x395e0b['query']=_['keys'](_0x3cc364[_0x0ab4('0x26')]);_0x395e0b[_0x0ab4('0x2f')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],_0x395e0b['query']);_0x48029f[_0x0ab4('0x28')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x48029f[_0x0ab4('0x28')]=_0x48029f[_0x0ab4('0x28')]['length']?_0x48029f[_0x0ab4('0x28')]:_0x395e0b[_0x0ab4('0x25')];if(_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x37')]){_0x48029f[_0x0ab4('0x3d')]=[{'all':!![]}];}_0x48029f=_[_0x0ab4('0x32')]({},_0x48029f,_0x3cc364['options']);return db[_0x0ab4('0x38')]['find'](_0x48029f)[_0x0ab4('0x1f')](handleEntityNotFound(_0xe3df73,null))[_0x0ab4('0x1f')](respondWithResult(_0xe3df73,null))[_0x0ab4('0x3e')](handleError(_0xe3df73,null));};exports['create']=function(_0x5b09e,_0x1fcc3b){return db[_0x0ab4('0x38')][_0x0ab4('0x3f')](_0x5b09e[_0x0ab4('0x40')],{})[_0x0ab4('0x1f')](respondWithResult(_0x1fcc3b,0xc9))['catch'](handleError(_0x1fcc3b,null));};exports[_0x0ab4('0x41')]=function(_0xdcc118,_0x302894){if(_0xdcc118[_0x0ab4('0x40')]['id']){delete _0xdcc118[_0x0ab4('0x40')]['id'];}return db[_0x0ab4('0x38')][_0x0ab4('0x42')]({'where':{'id':_0xdcc118[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x302894,null))[_0x0ab4('0x1f')](saveUpdates(_0xdcc118[_0x0ab4('0x40')],null))[_0x0ab4('0x1f')](respondWithResult(_0x302894,null))[_0x0ab4('0x3e')](handleError(_0x302894,null));};exports['destroy']=function(_0x2c3a0a,_0x354bc){return db['WhatsappTransferReport'][_0x0ab4('0x42')]({'where':{'id':_0x2c3a0a['params']['id']}})['then'](handleEntityNotFound(_0x354bc,null))[_0x0ab4('0x1f')](removeEntity(_0x354bc,null))[_0x0ab4('0x3e')](handleError(_0x354bc,null));};exports[_0x0ab4('0x43')]=function(_0x4966bc,_0x12a2df){return db[_0x0ab4('0x38')][_0x0ab4('0x43')]()[_0x0ab4('0x1f')](respondWithResult(_0x12a2df,null))[_0x0ab4('0x3e')](handleError(_0x12a2df,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 77ef9b5..359f55c 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 _0xe55d=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x36d8d9,_0x17b58a){var _0x1ac3a2=function(_0x392196){while(--_0x392196){_0x36d8d9['push'](_0x36d8d9['shift']());}};_0x1ac3a2(++_0x17b58a);}(_0xe55d,0xd3));var _0xde55=function(_0x2be481,_0x3ea049){_0x2be481=_0x2be481-0x0;var _0x43a610=_0xe55d[_0x2be481];return _0x43a610;};'use strict';var _=require('lodash');var util=require(_0xde55('0x0'));var logger=require(_0xde55('0x1'))(_0xde55('0x2'));var moment=require('moment');var BPromise=require(_0xde55('0x3'));var rp=require(_0xde55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde55('0x5'));var config=require(_0xde55('0x6'));var attributes=require(_0xde55('0x7'));module[_0xde55('0x8')]=function(_0x1b7f0d,_0x5be13f){return _0x1b7f0d[_0xde55('0x9')](_0xde55('0xa'),attributes,{'tableName':_0xde55('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xde55('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0dc=['uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','WhatsappTransferReport'];(function(_0x14937c,_0x4cb94e){var _0x4fa8bf=function(_0x49d1ae){while(--_0x49d1ae){_0x14937c['push'](_0x14937c['shift']());}};_0x4fa8bf(++_0x4cb94e);}(_0xe0dc,0x1cd));var _0xce0d=function(_0x2ba054,_0x4cfa79){_0x2ba054=_0x2ba054-0x0;var _0x5d2153=_0xe0dc[_0x2ba054];return _0x5d2153;};'use strict';var _=require(_0xce0d('0x0'));var util=require(_0xce0d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce0d('0x2'));var BPromise=require(_0xce0d('0x3'));var rp=require(_0xce0d('0x4'));var fs=require('fs');var path=require(_0xce0d('0x5'));var rimraf=require(_0xce0d('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xce0d('0x7')]=function(_0x9fc975,_0x596603){return _0x9fc975['define'](_0xce0d('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xce0d('0x9'),'fields':[_0xce0d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 37cfde4..cc84ece 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 _0xc1bc=['../../config/logger','rpc','../../config/environment','client','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cb41d,_0x2d7f6d){var _0x4dc372=function(_0x2e7351){while(--_0x2e7351){_0x3cb41d['push'](_0x3cb41d['shift']());}};_0x4dc372(++_0x2d7f6d);}(_0xc1bc,0x173));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcc1b('0x0'));var util=require(_0xcc1b('0x1'));var moment=require('moment');var BPromise=require(_0xcc1b('0x2'));var rs=require(_0xcc1b('0x3'));var fs=require('fs');var Redis=require(_0xcc1b('0x4'));var db=require(_0xcc1b('0x5'))['db'];var utils=require(_0xcc1b('0x6'));var logger=require(_0xcc1b('0x7'))(_0xcc1b('0x8'));var config=require(_0xcc1b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcc1b('0xa')][_0xcc1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x172878,_0x5ca729,_0x4a45b9){return new BPromise(function(_0x16c769,_0x594ff8){return client[_0xcc1b('0xc')](_0x172878,_0x4a45b9)['then'](function(_0x24becd){logger['info'](_0xcc1b('0xd'),_0x5ca729,_0xcc1b('0xe'));logger[_0xcc1b('0xf')](_0xcc1b('0x10'),_0x5ca729,'request\x20sent',JSON[_0xcc1b('0x11')](_0x24becd));if(_0x24becd[_0xcc1b('0x12')]){if(_0x24becd['error']['code']===0x1f4){logger[_0xcc1b('0x12')](_0xcc1b('0xd'),_0x5ca729,_0x24becd[_0xcc1b('0x12')][_0xcc1b('0x13')]);return _0x594ff8(_0x24becd[_0xcc1b('0x12')]['message']);}logger[_0xcc1b('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5ca729,_0x24becd[_0xcc1b('0x12')]['message']);return _0x16c769(_0x24becd[_0xcc1b('0x12')][_0xcc1b('0x13')]);}else{logger['info'](_0xcc1b('0xd'),_0x5ca729,_0xcc1b('0xe'));_0x16c769(_0x24becd['result'][_0xcc1b('0x13')]);}})[_0xcc1b('0x14')](function(_0x4c8acf){logger['error'](_0xcc1b('0xd'),_0x5ca729,_0x4c8acf);_0x594ff8(_0x4c8acf);});});} \ No newline at end of file +var _0x5c65=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1da193,_0x150541){var _0x2e9d1e=function(_0x399e1a){while(--_0x399e1a){_0x1da193['push'](_0x1da193['shift']());}};_0x2e9d1e(++_0x150541);}(_0x5c65,0xd3));var _0x55c6=function(_0x2359a0,_0x51ab9c){_0x2359a0=_0x2359a0-0x0;var _0x269f47=_0x5c65[_0x2359a0];return _0x269f47;};'use strict';var _=require(_0x55c6('0x0'));var util=require('util');var moment=require(_0x55c6('0x1'));var BPromise=require(_0x55c6('0x2'));var rs=require(_0x55c6('0x3'));var fs=require('fs');var Redis=require(_0x55c6('0x4'));var db=require(_0x55c6('0x5'))['db'];var utils=require(_0x55c6('0x6'));var logger=require(_0x55c6('0x7'))(_0x55c6('0x8'));var config=require(_0x55c6('0x9'));var jayson=require(_0x55c6('0xa'));var client=jayson[_0x55c6('0xb')][_0x55c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7c2f,_0x506af9,_0xea3041){return new BPromise(function(_0x104095,_0x59a496){return client['request'](_0x3c7c2f,_0xea3041)[_0x55c6('0xd')](function(_0x4a73f1){logger[_0x55c6('0xe')](_0x55c6('0xf'),_0x506af9,_0x55c6('0x10'));logger[_0x55c6('0x11')](_0x55c6('0x12'),_0x506af9,_0x55c6('0x10'),JSON[_0x55c6('0x13')](_0x4a73f1));if(_0x4a73f1[_0x55c6('0x14')]){if(_0x4a73f1['error']['code']===0x1f4){logger[_0x55c6('0x14')](_0x55c6('0xf'),_0x506af9,_0x4a73f1[_0x55c6('0x14')][_0x55c6('0x15')]);return _0x59a496(_0x4a73f1[_0x55c6('0x14')]['message']);}logger['error'](_0x55c6('0xf'),_0x506af9,_0x4a73f1[_0x55c6('0x14')][_0x55c6('0x15')]);return _0x104095(_0x4a73f1[_0x55c6('0x14')][_0x55c6('0x15')]);}else{logger[_0x55c6('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x506af9,_0x55c6('0x10'));_0x104095(_0x4a73f1[_0x55c6('0x16')][_0x55c6('0x15')]);}})[_0x55c6('0x17')](function(_0xb20f0){logger[_0x55c6('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x506af9,_0xb20f0);_0x59a496(_0xb20f0);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 0c869e0..4f7cb71 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a88=['Online\x20apps:','online','join','Offline\x20apps:','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','then','seedDB','default','info','start','filter','number','exitCode','length','map','pm2_env','name'];(function(_0x2f6dfe,_0x115dab){var _0x5e5c9c=function(_0x502840){while(--_0x502840){_0x2f6dfe['push'](_0x2f6dfe['shift']());}};_0x5e5c9c(++_0x115dab);}(_0x6a88,0xa9));var _0x86a8=function(_0x38d8e2,_0x48603c){_0x38d8e2=_0x38d8e2-0x0;var _0x5afbee=_0x6a88[_0x38d8e2];return _0x5afbee;};'use strict';var _=require(_0x86a8('0x0'));var db=require(_0x86a8('0x1'))['db'];var seedDb=require(_0x86a8('0x2'));var checkLicense=require(_0x86a8('0x3'));var rpc=require(_0x86a8('0x4'));var config=require(_0x86a8('0x5'));var logger=require(_0x86a8('0x6'))('app');var pm2=require(_0x86a8('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x86a8('0x8'));var whatsapp=require(_0x86a8('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x86a8('0xa'));function main(){return db['sequelize']['sync']()[_0x86a8('0xb')](function(){if(config[_0x86a8('0xc')]){return seedDb['default']();}})[_0x86a8('0xb')](function(){return checkLicense[_0x86a8('0xd')]();})['then'](function(){return rpc['listen']();})[_0x86a8('0xb')](function(_0x413416){logger[_0x86a8('0xe')](_0x413416);return chat[_0x86a8('0xf')]();})[_0x86a8('0xb')](function(){return whatsapp[_0x86a8('0xf')]();})[_0x86a8('0xb')](function(){return schedule[_0x86a8('0xf')]();})[_0x86a8('0xb')](function(){return transcribe[_0x86a8('0xf')]();})['then'](function(){return provider[_0x86a8('0xf')]();})['then'](function(_0x54194f){logger[_0x86a8('0xe')](_0x54194f);return pm2[_0x86a8('0xf')](pm2Config);})['then'](function(_0x520697){var _0x4f8076=_0x520697[_0x86a8('0x10')](function(_0x2554be){return typeof _0x2554be['exitCode']===_0x86a8('0x11')&&_0x2554be[_0x86a8('0x12')]>=0x0;});if(_0x4f8076[_0x86a8('0x13')]>0x0){throw new Error(_0x4f8076[_0x86a8('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x86a8('0x14')](_0x4f8076,function(_0x4e1147){return'\x22'+_0x4e1147[_0x86a8('0x15')][_0x86a8('0x16')]+'\x22';}));}logger[_0x86a8('0xe')](_0x86a8('0x17'),_[_0x86a8('0x14')](_[_0x86a8('0x10')](_0x520697,{'status':_0x86a8('0x18')}),_0x86a8('0x16'))[_0x86a8('0x19')]());logger['info'](_0x86a8('0x1a'),_[_0x86a8('0x14')](_[_0x86a8('0x10')](_0x520697,function(_0x20e4a6){return _0x20e4a6['status']!=='online';}),_0x86a8('0x16'))[_0x86a8('0x19')]()||'None');console[_0x86a8('0x1b')](_0x86a8('0x1c'));})['catch'](function(_0x3a2060){console[_0x86a8('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3a2060);logger[_0x86a8('0x1d')](_0x86a8('0x1e'),_0x3a2060);process[_0x86a8('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x8bc3=['./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','Offline\x20apps:','status','online','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./rpc','./config/environment','app','./config/pm2'];(function(_0x38a45d,_0x4398b9){var _0x59ca4b=function(_0x294ec4){while(--_0x294ec4){_0x38a45d['push'](_0x38a45d['shift']());}};_0x59ca4b(++_0x4398b9);}(_0x8bc3,0x82));var _0x38bc=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x8bc3[_0x408de5];return _0x2015a1;};'use strict';var _=require(_0x38bc('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x38bc('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x38bc('0x2'));var config=require(_0x38bc('0x3'));var logger=require('./config/logger')(_0x38bc('0x4'));var pm2=require(_0x38bc('0x5'));var pm2Config=require(_0x38bc('0x6'));var schedule=require(_0x38bc('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x38bc('0x8'));var transcribe=require(_0x38bc('0x9'));var provider=require(_0x38bc('0xa'));function main(){return db[_0x38bc('0xb')][_0x38bc('0xc')]()['then'](function(){if(config['seedDB']){return seedDb[_0x38bc('0xd')]();}})[_0x38bc('0xe')](function(){return checkLicense[_0x38bc('0xd')]();})[_0x38bc('0xe')](function(){return rpc[_0x38bc('0xf')]();})[_0x38bc('0xe')](function(_0x122a46){logger[_0x38bc('0x10')](_0x122a46);return chat[_0x38bc('0x11')]();})[_0x38bc('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x38bc('0x11')]();})['then'](function(){return provider['start']();})['then'](function(_0x4fd437){logger[_0x38bc('0x10')](_0x4fd437);return pm2[_0x38bc('0x11')](pm2Config);})[_0x38bc('0xe')](function(_0x5d4997){var _0x22f87b=_0x5d4997[_0x38bc('0x12')](function(_0x1ff95d){return typeof _0x1ff95d[_0x38bc('0x13')]===_0x38bc('0x14')&&_0x1ff95d[_0x38bc('0x13')]>=0x0;});if(_0x22f87b[_0x38bc('0x15')]>0x0){throw new Error(_0x22f87b[_0x38bc('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x38bc('0x16')](_0x22f87b,function(_0x55940b){return'\x22'+_0x55940b[_0x38bc('0x17')][_0x38bc('0x18')]+'\x22';}));}logger[_0x38bc('0x10')](_0x38bc('0x19'),_[_0x38bc('0x16')](_[_0x38bc('0x12')](_0x5d4997,{'status':'online'}),_0x38bc('0x18'))['join']());logger['info'](_0x38bc('0x1a'),_[_0x38bc('0x16')](_[_0x38bc('0x12')](_0x5d4997,function(_0x19f3af){return _0x19f3af[_0x38bc('0x1b')]!==_0x38bc('0x1c');}),_0x38bc('0x18'))['join']()||'None');console[_0x38bc('0x1d')](_0x38bc('0x1e'));})['catch'](function(_0x2d32fe){console['log'](_0x38bc('0x1f'),_0x2d32fe);logger[_0x38bc('0x20')](_0x38bc('0x21'),_0x2d32fe);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 09df22b..4c2f82d 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 _0x2ffe=['findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','add','minutes','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','update','Forbidden','getLicense','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','randomBytes','toString','hex','floor','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','name','internal','email','userpic','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isAuthenticated','user','ChatInteraction','params','closed','disposition','then','query','forceDownload','status','unmanaged','catch','headers','authorization','Basic','find','pass','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','sub','Setting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ffe,0x151));var _0xe2ff=function(_0x1c8222,_0x18a20a){_0x1c8222=_0x1c8222-0x0;var _0x154a0a=_0x2ffe[_0x1c8222];return _0x154a0a;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe2ff('0x0'));var hardwareConf=require(_0xe2ff('0x1'));var licenseUtil=require(_0xe2ff('0x2'));var encryptor=require(_0xe2ff('0x3'));var _=require(_0xe2ff('0x4'));var jwt=require(_0xe2ff('0x5'));var expressJwt=require(_0xe2ff('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xe2ff('0x7'));var crypto=require(_0xe2ff('0x8'));var BPromise=require(_0xe2ff('0x9'));var util=require(_0xe2ff('0xa'));var moment=require(_0xe2ff('0xb'));var validateJwt=expressJwt({'secret':config[_0xe2ff('0xc')][_0xe2ff('0xd')]});var userAttributes=['id','role','fullname',_0xe2ff('0xe'),_0xe2ff('0xf'),_0xe2ff('0x10'),_0xe2ff('0x11'),'permissions','md5secret',_0xe2ff('0x12'),_0xe2ff('0x13'),_0xe2ff('0x14'),_0xe2ff('0x15'),_0xe2ff('0x16'),_0xe2ff('0x17'),_0xe2ff('0x18'),'showWebBar',_0xe2ff('0x19'),_0xe2ff('0x1a'),_0xe2ff('0x1b'),_0xe2ff('0x1c'),_0xe2ff('0x1d'),'alias','phoneBarAutoAnswer',_0xe2ff('0x1e'),_0xe2ff('0x1f'),_0xe2ff('0x20'),_0xe2ff('0x21'),_0xe2ff('0x22'),_0xe2ff('0x23'),'phoneBarPrefixRequired',_0xe2ff('0x24'),'phoneBarRemoteControlPort','hotdesk','interface',_0xe2ff('0x25'),_0xe2ff('0x26'),_0xe2ff('0x27'),_0xe2ff('0x28'),_0xe2ff('0x29'),'downloadOmnichannelInteractions','downloadAttachments',_0xe2ff('0x2a'),_0xe2ff('0x2b'),_0xe2ff('0x2c'),_0xe2ff('0x2d'),_0xe2ff('0x2e'),_0xe2ff('0x2f'),_0xe2ff('0x30'),_0xe2ff('0x31'),_0xe2ff('0x32'),_0xe2ff('0x33'),_0xe2ff('0x34'),_0xe2ff('0x35'),_0xe2ff('0x36'),_0xe2ff('0x37'),_0xe2ff('0x38')];exports['isChatInteractionAuthorized']=function(){return this[_0xe2ff('0x39')](!![])['use'](function(_0x34fbf3,_0x596a22,_0x386827){if(_0x34fbf3[_0xe2ff('0x3a')]){_0x386827();}else{return db[_0xe2ff('0x3b')]['findOne']({'where':{'id':_0x34fbf3[_0xe2ff('0x3c')]['id']},'attributes':['id',_0xe2ff('0x3d'),_0xe2ff('0x3e')],'raw':!![]})[_0xe2ff('0x3f')](function(_0x174812){if(_0x174812&&_0x174812[_0xe2ff('0x3d')]&&!_0x34fbf3[_0xe2ff('0x40')][_0xe2ff('0x41')]){return _0x596a22[_0xe2ff('0x42')](_0x174812[_0xe2ff('0x3e')]==='unmanaged'?0x195:0x193)['json']({'message':_0x174812[_0xe2ff('0x3e')]===_0xe2ff('0x43')?'Unmanaged.':'Forbidden.'});}else{_0x386827();}})[_0xe2ff('0x44')](function(_0x380224){_0x386827(_0x380224);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4cfa6c){return compose()['use'](function(_0x35428c,_0x14a9e0,_0x128225){var _0x2d5169;if(_0x35428c[_0xe2ff('0x45')][_0xe2ff('0x46')]){if(_['startsWith'](_0x35428c[_0xe2ff('0x45')][_0xe2ff('0x46')],_0xe2ff('0x47'))){var _0x1de907=basicAuth(_0x35428c);db['User'][_0xe2ff('0x48')]({'where':{'name':_0x1de907[_0xe2ff('0xe')]}})[_0xe2ff('0x3f')](function(_0x312f16){if(!_0x312f16||!_0x312f16['authenticate'](_0x1de907[_0xe2ff('0x49')])){return _0x14a9e0[_0xe2ff('0x42')](0x191)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x4b')});}_0x35428c[_0xe2ff('0x3a')]={'id':_0x312f16['id']};_0x128225();})[_0xe2ff('0x44')](function(_0x35f536){_0x128225(_0x35f536);});}else if(_['startsWith'](_0x35428c[_0xe2ff('0x45')][_0xe2ff('0x46')],_0xe2ff('0x4c'))){validateJwt(_0x35428c,_0x14a9e0,_0x128225);}else{if(_0x4cfa6c){_0x128225();}else{return _0x14a9e0[_0xe2ff('0x42')](0x193)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x4d')});}}}else if(_0x35428c[_0xe2ff('0x40')][_0xe2ff('0x4e')]){try{var _0x48f44d={'audience':hardwareConf[_0xe2ff('0x4f')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x35428c[_0xe2ff('0x40')][_0xe2ff('0x4e')],_0x48f44d)['then'](function(_0x26eb66){return db[_0xe2ff('0x50')][_0xe2ff('0x48')]({'where':{'id':_0x26eb66[_0xe2ff('0x51')]}})[_0xe2ff('0x3f')](function(_0x31f1ce){_0x2d5169=_0x31f1ce;return db[_0xe2ff('0x52')][_0xe2ff('0x53')]({'where':{'id':0x1},'attributes':[_0xe2ff('0x54'),_0xe2ff('0x55')],'raw':!![]});})['then'](function(_0x5265ef){if(!_0x2d5169||!_[_0xe2ff('0x56')](_0x2d5169[_0xe2ff('0x57')],_0x26eb66[_0xe2ff('0x58')])){return _0x14a9e0[_0xe2ff('0x42')](0x191)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x59')});}if(_0x2d5169['disabled']){return _0x14a9e0['status'](0x191)[_0xe2ff('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x2d5169[_0xe2ff('0x5a')]){if(_0x5265ef['blockDuration']>0x0){if(moment(_0x2d5169['blockedAt'])[_0xe2ff('0x5b')](_0x5265ef[_0xe2ff('0x55')],_0xe2ff('0x5c'))>moment()){return _0x14a9e0[_0xe2ff('0x42')](0x191)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x5d')});}}else{return _0x14a9e0[_0xe2ff('0x42')](0x191)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x5d')});}}_0x35428c[_0xe2ff('0x3a')]={'id':_0x2d5169['id']};_0x128225();});})[_0xe2ff('0x44')](function(){return _0x14a9e0['status'](0x191)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x5d')});});}catch(_0x2f0a63){_0x128225(_0x2f0a63);}}else if(_0x4cfa6c){_0x128225();}else{return _0x14a9e0[_0xe2ff('0x42')](0x193)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x4d')});}})[_0xe2ff('0x5e')](function(_0x5de640,_0x547b96,_0x218292){if(_0x5de640['user']){db[_0xe2ff('0x50')][_0xe2ff('0x48')]({'where':{'id':_0x5de640[_0xe2ff('0x3a')]['id']},'attributes':userAttributes})[_0xe2ff('0x3f')](function(_0x324a1b){if(!_0x324a1b){return _0x547b96[_0xe2ff('0x42')](0x194)['json']({'message':_0xe2ff('0x5f')});}_0x5de640[_0xe2ff('0x3a')]=_0x324a1b;_0x218292();})[_0xe2ff('0x44')](function(_0x486acc){_0x218292(_0x486acc);});}else if(_0x4cfa6c){_0x218292();}else{return _0x547b96[_0xe2ff('0x42')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xe2ff('0x5e')](function(_0x5c57a7,_0x3be482,_0x3cbc36){return licenseUtil['getLicense']()[_0xe2ff('0x3f')](function(_0x537ca9){if(_0x537ca9[_0xe2ff('0x60')]){_0x3cbc36();}else{return _0x3be482['status'](0x193)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x61')});}})['catch'](function(_0x4fab02){_0x3cbc36(_0x4fab02);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xe2ff('0x5e')](function(_0x959ba7,_0x30111e,_0x4deaa6){return licenseUtil[_0xe2ff('0x62')]()[_0xe2ff('0x3f')](function(_0x43e6e3){if(_0x43e6e3[_0xe2ff('0x63')]){_0x4deaa6();}else{return _0x30111e['status'](0x193)[_0xe2ff('0x4a')]({'message':'Forbidden'});}})[_0xe2ff('0x44')](function(_0x511970){_0x4deaa6(_0x511970);});});};exports[_0xe2ff('0x64')]=function(_0xd2b1d7,_0x13dabb,_0x1ddef6){_0xd2b1d7[_0xe2ff('0x64')]=!![];return _0x1ddef6();};exports[_0xe2ff('0x65')]=function signToken(_0x361efa){return signJwt(_0x361efa);};exports['setTokenCookie']=function(_0x465ab8,_0x5c23d4){if(!_0x465ab8[_0xe2ff('0x3a')]){return _0x5c23d4[_0xe2ff('0x42')](0x194)[_0xe2ff('0x4a')]({'message':_0xe2ff('0x66')});}var _0x4fb5fe={'payload':{'id':_0x465ab8['user']['id'],'role':_0x465ab8[_0xe2ff('0x3a')][_0xe2ff('0x67')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4fb5fe)[_0xe2ff('0x3f')](function(_0x5f0dce){_0x5c23d4[_0xe2ff('0x68')](_0xe2ff('0x69'),_0x5f0dce);_0x5c23d4[_0xe2ff('0x6a')](_0xe2ff('0x6b'));})['catch'](function(_0x3894a0){return _0x5c23d4['status'](0x1f4)[_0xe2ff('0x6c')](_0x3894a0);});};exports['retrieveApiKey']=function(_0x40c507){if(_[_0xe2ff('0x6d')](_0x40c507[_0xe2ff('0x57')])||_[_0xe2ff('0x6d')](_0x40c507[_0xe2ff('0x6e')])){return null;}else{return createJwt(_0x40c507);}};exports['generateApiKey']=function(_0x16c74d){_0x16c74d[_0xe2ff('0x57')]=generateNonce();_0x16c74d[_0xe2ff('0x6e')]=generateIssuedAt();return createJwt(_0x16c74d);};exports[_0xe2ff('0x6f')]=function(_0x41f350,_0x5c320b){var _0x41010e=_0x41f350['query'][_0xe2ff('0x4e')];if(_0x41010e){var _0x1a6342={'nonce':_0x5c320b[_0xe2ff('0x57')],'iat':_0x5c320b['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xe2ff('0x4f')]()};return verifyJwt(_0x41010e,_0x1a6342)[_0xe2ff('0x3f')](function(){return generateApiKey(_0x5c320b);});}else{throw{'message':_0xe2ff('0x70')};}};exports[_0xe2ff('0x71')]=function(_0x3f12d5){var _0x32e454=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x32e454[_0xe2ff('0x72')](_0x3f12d5))throw new db[(_0xe2ff('0x73'))][(_0xe2ff('0x74'))](_0xe2ff('0x75'));return;};exports['validatePasswordHistory']=function(_0x362e59,_0x2ac201,_0x1737ed){var _0x5bc158=encryptor[_0xe2ff('0x76')](_0x2ac201)[_0xe2ff('0x77')](',');for(var _0x2c2a83=0x0;_0x2c2a83<_0x1737ed;_0x2c2a83++){if(!_0x5bc158[_0x2c2a83])break;if(_0x362e59[_0xe2ff('0x78')]()===_0x5bc158[_0x2c2a83][_0xe2ff('0x78')]()){var _0x24e852=util[_0xe2ff('0x79')](_0xe2ff('0x7a'),_0x1737ed);if(_0x1737ed===0x1){_0x24e852=_0xe2ff('0x7b');}throw new db[(_0xe2ff('0x73'))][(_0xe2ff('0x74'))](_0x24e852);}}return;};exports[_0xe2ff('0x7c')]=function(_0x24766e,_0xfb1f30){var _0x416d6e=_0xfb1f30?encryptor['decryptString'](_0xfb1f30)[_0xe2ff('0x77')](','):[];if(_0x416d6e[_0xe2ff('0x7d')]===0x5){_0x416d6e[_0xe2ff('0x7e')](-0x1,0x1);}_0x416d6e[_0xe2ff('0x7f')](_0x24766e);return encryptor[_0xe2ff('0x80')](_0x416d6e[_0xe2ff('0x81')](','));};function signJwt(_0x353c69){var _0x4677dd=BPromise[_0xe2ff('0x82')](jwt[_0xe2ff('0x83')],{'context':jwt});var _0x3b71ae=_0x353c69[_0xe2ff('0x84')]||config['secrets']['session'];return new BPromise(function(_0x5f062f,_0x2c77fe){_0x4677dd(_0x353c69[_0xe2ff('0x85')],_0x3b71ae,_0x353c69[_0xe2ff('0x86')])[_0xe2ff('0x3f')](function(_0x362234){_0x5f062f(_0x362234);})[_0xe2ff('0x44')](function(_0x51db18){_0x2c77fe(_0x51db18);});});}function verifyJwt(_0x1319a6,_0x2d3622,_0x20e60e){var _0x5967b5=BPromise[_0xe2ff('0x82')](jwt['verify'],{'context':jwt});var _0x569afa=_0x20e60e||config[_0xe2ff('0xc')][_0xe2ff('0xd')];return new BPromise(function(_0x4e1062,_0x58622e){_0x5967b5(_0x1319a6,_0x569afa,_0x2d3622)[_0xe2ff('0x3f')](function(_0x37aa1c){_0x4e1062(_0x37aa1c);})[_0xe2ff('0x44')](function(_0x1ff63a){_0x58622e(_0x1ff63a);});});}function generateNonce(){return crypto[_0xe2ff('0x87')](0x10)[_0xe2ff('0x88')](_0xe2ff('0x89'));}function generateIssuedAt(){return Math[_0xe2ff('0x8a')](Date['now']()/0x3e8)[_0xe2ff('0x88')]();}function createJwt(_0x181995){var _0x117364={'payload':{'iat':_0x181995[_0xe2ff('0x6e')],'nonce':_0x181995[_0xe2ff('0x57')]},'options':{'algorithm':_0xe2ff('0x8b'),'subject':_0x181995['id'][_0xe2ff('0x88')](),'issuer':hardwareConf[_0xe2ff('0x4f')](),'audience':hardwareConf[_0xe2ff('0x4f')]()}};return signJwt(_0x117364)[_0xe2ff('0x3f')](function(_0x115735){return{'iat':_0x181995[_0xe2ff('0x6e')],'nonce':_0x181995[_0xe2ff('0x57')],'token':_0x115735};});} \ No newline at end of file +var _0xf2f9=['emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','User','name','startsWith','authorization','Bearer','apikey','getUuid','find','Setting','blockDuration','nonce','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','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','decryptString','splice','join','payload','promisify','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','crypto','bluebird','secrets','role','fullname','internal','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay'];(function(_0x157236,_0x4c22c5){var _0x3f5cd8=function(_0x30e756){while(--_0x30e756){_0x157236['push'](_0x157236['shift']());}};_0x3f5cd8(++_0x4c22c5);}(_0xf2f9,0x1e2));var _0x9f2f=function(_0x482d06,_0x1c7c4a){_0x482d06=_0x482d06-0x0;var _0x3bdd88=_0xf2f9[_0x482d06];return _0x3bdd88;};'use strict';var db=require(_0x9f2f('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x9f2f('0x1'));var licenseUtil=require(_0x9f2f('0x2'));var encryptor=require(_0x9f2f('0x3'));var _=require(_0x9f2f('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x9f2f('0x5'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x9f2f('0x6'));var BPromise=require(_0x9f2f('0x7'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x9f2f('0x8')]['session']});var userAttributes=['id',_0x9f2f('0x9'),_0x9f2f('0xa'),'name',_0x9f2f('0xb'),'email',_0x9f2f('0xc'),_0x9f2f('0xd'),_0x9f2f('0xe'),_0x9f2f('0xf'),'chatPause',_0x9f2f('0x10'),_0x9f2f('0x11'),_0x9f2f('0x12'),_0x9f2f('0x13'),'pauseType','showWebBar',_0x9f2f('0x14'),_0x9f2f('0x15'),'crudPermissions',_0x9f2f('0x16'),'passwordResetAt',_0x9f2f('0x17'),_0x9f2f('0x18'),_0x9f2f('0x19'),_0x9f2f('0x1a'),_0x9f2f('0x1b'),_0x9f2f('0x1c'),'phoneBarEnableSettings',_0x9f2f('0x1d'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x9f2f('0x1e'),_0x9f2f('0x1f'),_0x9f2f('0x20'),_0x9f2f('0x21'),_0x9f2f('0x22'),'settingsEnabled',_0x9f2f('0x23'),'downloadVoiceRecordings',_0x9f2f('0x24'),_0x9f2f('0x25'),_0x9f2f('0x26'),_0x9f2f('0x27'),_0x9f2f('0x28'),_0x9f2f('0x29'),_0x9f2f('0x2a'),_0x9f2f('0x2b'),_0x9f2f('0x2c'),_0x9f2f('0x2d'),'openchannelAutoanswer',_0x9f2f('0x2e'),_0x9f2f('0x2f'),_0x9f2f('0x30'),_0x9f2f('0x31'),_0x9f2f('0x32'),_0x9f2f('0x33')];exports[_0x9f2f('0x34')]=function(){return this[_0x9f2f('0x35')](!![])['use'](function(_0x2304e6,_0xf8ebed,_0x271ca4){if(_0x2304e6[_0x9f2f('0x36')]){_0x271ca4();}else{return db[_0x9f2f('0x37')][_0x9f2f('0x38')]({'where':{'id':_0x2304e6['params']['id']},'attributes':['id',_0x9f2f('0x39'),_0x9f2f('0x3a')],'raw':!![]})[_0x9f2f('0x3b')](function(_0x1d91dd){if(_0x1d91dd&&_0x1d91dd[_0x9f2f('0x39')]&&!_0x2304e6[_0x9f2f('0x3c')][_0x9f2f('0x3d')]){return _0xf8ebed[_0x9f2f('0x3e')](_0x1d91dd[_0x9f2f('0x3a')]===_0x9f2f('0x3f')?0x195:0x193)[_0x9f2f('0x40')]({'message':_0x1d91dd[_0x9f2f('0x3a')]==='unmanaged'?_0x9f2f('0x41'):_0x9f2f('0x42')});}else{_0x271ca4();}})[_0x9f2f('0x43')](function(_0x704581){_0x271ca4(_0x704581);});}});};exports[_0x9f2f('0x35')]=function isAuthenticated(_0x2030f1){return compose()[_0x9f2f('0x44')](function(_0x18a359,_0x1198ea,_0x1f20ab){var _0x2670d7;if(_0x18a359[_0x9f2f('0x45')]['authorization']){if(_['startsWith'](_0x18a359['headers']['authorization'],'Basic')){var _0x10df80=basicAuth(_0x18a359);db[_0x9f2f('0x46')]['find']({'where':{'name':_0x10df80[_0x9f2f('0x47')]}})[_0x9f2f('0x3b')](function(_0x537f3a){if(!_0x537f3a||!_0x537f3a['authenticate'](_0x10df80['pass'])){return _0x1198ea['status'](0x191)[_0x9f2f('0x40')]({'message':'Wrong\x20credentials.'});}_0x18a359[_0x9f2f('0x36')]={'id':_0x537f3a['id']};_0x1f20ab();})[_0x9f2f('0x43')](function(_0x8959d8){_0x1f20ab(_0x8959d8);});}else if(_[_0x9f2f('0x48')](_0x18a359[_0x9f2f('0x45')][_0x9f2f('0x49')],_0x9f2f('0x4a'))){validateJwt(_0x18a359,_0x1198ea,_0x1f20ab);}else{if(_0x2030f1){_0x1f20ab();}else{return _0x1198ea[_0x9f2f('0x3e')](0x193)[_0x9f2f('0x40')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x18a359[_0x9f2f('0x3c')][_0x9f2f('0x4b')]){try{var _0x5e9457={'audience':hardwareConf[_0x9f2f('0x4c')](),'issuer':hardwareConf[_0x9f2f('0x4c')]()};verifyJwt(_0x18a359[_0x9f2f('0x3c')][_0x9f2f('0x4b')],_0x5e9457)[_0x9f2f('0x3b')](function(_0x4963d1){return db['User'][_0x9f2f('0x4d')]({'where':{'id':_0x4963d1['sub']}})[_0x9f2f('0x3b')](function(_0x53beba){_0x2670d7=_0x53beba;return db[_0x9f2f('0x4e')][_0x9f2f('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9f2f('0x4f')],'raw':!![]});})[_0x9f2f('0x3b')](function(_0x250c8f){if(!_0x2670d7||!_['isEqual'](_0x2670d7['apiKeyNonce'],_0x4963d1[_0x9f2f('0x50')])){return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2670d7[_0x9f2f('0x51')]){return _0x1198ea[_0x9f2f('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x2670d7['blocked']){if(_0x250c8f[_0x9f2f('0x4f')]>0x0){if(moment(_0x2670d7[_0x9f2f('0x52')])[_0x9f2f('0x53')](_0x250c8f[_0x9f2f('0x4f')],_0x9f2f('0x54'))>moment()){return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x18a359[_0x9f2f('0x36')]={'id':_0x2670d7['id']};_0x1f20ab();});})[_0x9f2f('0x43')](function(){return _0x1198ea[_0x9f2f('0x3e')](0x191)[_0x9f2f('0x40')]({'message':_0x9f2f('0x55')});});}catch(_0x5d2f59){_0x1f20ab(_0x5d2f59);}}else if(_0x2030f1){_0x1f20ab();}else{return _0x1198ea[_0x9f2f('0x3e')](0x193)[_0x9f2f('0x40')]({'message':_0x9f2f('0x56')});}})[_0x9f2f('0x44')](function(_0x4c92fe,_0x98d034,_0xfa67ee){if(_0x4c92fe['user']){db['User'][_0x9f2f('0x4d')]({'where':{'id':_0x4c92fe[_0x9f2f('0x36')]['id']},'attributes':userAttributes})['then'](function(_0x47c93b){if(!_0x47c93b){return _0x98d034['status'](0x194)[_0x9f2f('0x40')]({'message':_0x9f2f('0x57')});}_0x4c92fe[_0x9f2f('0x36')]=_0x47c93b;_0xfa67ee();})[_0x9f2f('0x43')](function(_0x2a8072){_0xfa67ee(_0x2a8072);});}else if(_0x2030f1){_0xfa67ee();}else{return _0x98d034[_0x9f2f('0x3e')](0x194)[_0x9f2f('0x40')]({'message':_0x9f2f('0x58')});}});};exports[_0x9f2f('0x59')]=function canUpdate(){return compose()[_0x9f2f('0x44')](function(_0x452e88,_0x28b5c5,_0x5ad3d4){return licenseUtil[_0x9f2f('0x5a')]()[_0x9f2f('0x3b')](function(_0x2296ee){if(_0x2296ee[_0x9f2f('0x5b')]){_0x5ad3d4();}else{return _0x28b5c5[_0x9f2f('0x3e')](0x193)[_0x9f2f('0x40')]({'message':_0x9f2f('0x5c')});}})[_0x9f2f('0x43')](function(_0x25898b){_0x5ad3d4(_0x25898b);});});};exports[_0x9f2f('0x5d')]=function isWebrtcLicence(){return compose()[_0x9f2f('0x44')](function(_0x50073c,_0x29303a,_0x53d7ff){return licenseUtil[_0x9f2f('0x5a')]()[_0x9f2f('0x3b')](function(_0xea6c4b){if(_0xea6c4b[_0x9f2f('0x5e')]){_0x53d7ff();}else{return _0x29303a['status'](0x193)['json']({'message':_0x9f2f('0x5c')});}})[_0x9f2f('0x43')](function(_0x5e025e){_0x53d7ff(_0x5e025e);});});};exports[_0x9f2f('0x5f')]=function(_0x267d56,_0x4903b6,_0x1e0656){_0x267d56[_0x9f2f('0x5f')]=!![];return _0x1e0656();};exports[_0x9f2f('0x60')]=function signToken(_0x3b2812){return signJwt(_0x3b2812);};exports[_0x9f2f('0x61')]=function(_0x409178,_0x5b0fbe){if(!_0x409178[_0x9f2f('0x36')]){return _0x5b0fbe[_0x9f2f('0x3e')](0x194)[_0x9f2f('0x40')]({'message':_0x9f2f('0x62')});}var _0x10a2a0={'payload':{'id':_0x409178['user']['id'],'role':_0x409178[_0x9f2f('0x36')][_0x9f2f('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x10a2a0)[_0x9f2f('0x3b')](function(_0x5ab9d1){_0x5b0fbe[_0x9f2f('0x63')](_0x9f2f('0x64'),_0x5ab9d1);_0x5b0fbe[_0x9f2f('0x65')](_0x9f2f('0x66'));})['catch'](function(_0x1fb080){return _0x5b0fbe['status'](0x1f4)['send'](_0x1fb080);});};exports[_0x9f2f('0x67')]=function(_0x2f6949){if(_[_0x9f2f('0x68')](_0x2f6949[_0x9f2f('0x69')])||_['isNil'](_0x2f6949[_0x9f2f('0x6a')])){return null;}else{return createJwt(_0x2f6949);}};exports[_0x9f2f('0x6b')]=function(_0x226cb2){_0x226cb2['apiKeyNonce']=generateNonce();_0x226cb2[_0x9f2f('0x6a')]=generateIssuedAt();return createJwt(_0x226cb2);};exports[_0x9f2f('0x6c')]=function(_0x3878b8,_0x3e8df1){var _0x450751=_0x3878b8[_0x9f2f('0x3c')]['apikey'];if(_0x450751){var _0x28d29e={'nonce':_0x3e8df1['apiKeyNonce'],'iat':_0x3e8df1[_0x9f2f('0x6a')],'audience':hardwareConf[_0x9f2f('0x4c')](),'issuer':hardwareConf[_0x9f2f('0x4c')]()};return verifyJwt(_0x450751,_0x28d29e)['then'](function(){return generateApiKey(_0x3e8df1);});}else{throw{'message':_0x9f2f('0x6d')};}};exports[_0x9f2f('0x6e')]=function(_0x1702b5){var _0x4f2811=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4f2811['test'](_0x1702b5))throw new db[(_0x9f2f('0x6f'))][(_0x9f2f('0x70'))](_0x9f2f('0x71'));return;};exports[_0x9f2f('0x72')]=function(_0x51c074,_0x35fd02,_0x28b452){var _0x3d2a58=encryptor['decryptString'](_0x35fd02)[_0x9f2f('0x73')](',');for(var _0x35447f=0x0;_0x35447f<_0x28b452;_0x35447f++){if(!_0x3d2a58[_0x35447f])break;if(_0x51c074[_0x9f2f('0x74')]()===_0x3d2a58[_0x35447f][_0x9f2f('0x74')]()){var _0x4c49ae=util[_0x9f2f('0x75')](_0x9f2f('0x76'),_0x28b452);if(_0x28b452===0x1){_0x4c49ae=_0x9f2f('0x77');}throw new db[(_0x9f2f('0x6f'))][(_0x9f2f('0x70'))](_0x4c49ae);}}return;};exports[_0x9f2f('0x78')]=function(_0x2b08b5,_0x423200){var _0xd2abf5=_0x423200?encryptor[_0x9f2f('0x79')](_0x423200)[_0x9f2f('0x73')](','):[];if(_0xd2abf5['length']===0x5){_0xd2abf5[_0x9f2f('0x7a')](-0x1,0x1);}_0xd2abf5['unshift'](_0x2b08b5);return encryptor['encryptString'](_0xd2abf5[_0x9f2f('0x7b')](','));};function signJwt(_0x47b2d6){var _0x4e3fbb=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x31422c=_0x47b2d6['secret']||config['secrets']['session'];return new BPromise(function(_0x563271,_0x29351e){_0x4e3fbb(_0x47b2d6[_0x9f2f('0x7c')],_0x31422c,_0x47b2d6['options'])[_0x9f2f('0x3b')](function(_0x60139e){_0x563271(_0x60139e);})[_0x9f2f('0x43')](function(_0x5cd809){_0x29351e(_0x5cd809);});});}function verifyJwt(_0x4ca60b,_0x28d278,_0x31a7f1){var _0x537d8f=BPromise[_0x9f2f('0x7d')](jwt[_0x9f2f('0x7e')],{'context':jwt});var _0x34a24a=_0x31a7f1||config[_0x9f2f('0x8')]['session'];return new BPromise(function(_0x2d1fb5,_0x35d211){_0x537d8f(_0x4ca60b,_0x34a24a,_0x28d278)[_0x9f2f('0x3b')](function(_0x2577f7){_0x2d1fb5(_0x2577f7);})['catch'](function(_0x491f77){_0x35d211(_0x491f77);});});}function generateNonce(){return crypto[_0x9f2f('0x7f')](0x10)[_0x9f2f('0x80')](_0x9f2f('0x81'));}function generateIssuedAt(){return Math['floor'](Date[_0x9f2f('0x82')]()/0x3e8)[_0x9f2f('0x80')]();}function createJwt(_0x5b0529){var _0x35ce26={'payload':{'iat':_0x5b0529[_0x9f2f('0x6a')],'nonce':_0x5b0529['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x5b0529['id']['toString'](),'issuer':hardwareConf[_0x9f2f('0x4c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x35ce26)[_0x9f2f('0x3b')](function(_0x4d2b7e){return{'iat':_0x5b0529[_0x9f2f('0x6a')],'nonce':_0x5b0529[_0x9f2f('0x69')],'token':_0x4d2b7e};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index db61899..b94f9c0 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x557f=['User','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','filter','startsWith','cf_','CmCustomField','slice','all','length','fieldType','type','map','keys','lodash','./sql-utils','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','default','where','clause','user','skip','checkListsRestrictions','ids','countFilteredContacts','count'];(function(_0x203ab8,_0x3db544){var _0x3034fe=function(_0x214417){while(--_0x214417){_0x203ab8['push'](_0x203ab8['shift']());}};_0x3034fe(++_0x3db544);}(_0x557f,0x1e7));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf557('0x0'));var sqlUtils=require(_0xf557('0x1'));var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x199e8b,_0x415eaf,_0x4f1068,_0x34ce9b){var _0x8ca18b={'count':0x0,'rows':[]};var _0x106f0c=sqlUtils[_0xf557('0x2')](_0x415eaf,_0x199e8b);if(_0x106f0c){return Promise[_0xf557('0x3')](_0x8ca18b);}var _0x2be493=sqlUtils[_0xf557('0x4')]();var _0x581f39={};var _0x15d127=![];var _0x105171=![];return Promise[_0xf557('0x3')]()[_0xf557('0x5')](function(){if(_0x199e8b[_0xf557('0x6')]){return sqlUtils[_0xf557('0x7')](_0x199e8b[_0xf557('0x6')],_0x34ce9b);}else{return sqlUtils['parseQueryParameters'](_0x199e8b,_0x34ce9b);}})[_0xf557('0x5')](function(_0x4e7bbd){_0x2be493['where'](_0x4e7bbd[_0xf557('0x8')]);_0x2be493['where'](_0x4e7bbd['fields']);_0x2be493['where'](_0x4e7bbd['filter']);_0x2be493[_0xf557('0x9')](_0x4e7bbd['user'][_0xf557('0xa')]);_0x581f39=_0x4e7bbd['tags'];_0x105171=_0x4e7bbd[_0xf557('0xb')][_0xf557('0xc')];return sqlUtils[_0xf557('0xd')](_0x415eaf,_0x199e8b,_0x105171);})[_0xf557('0x5')](function(_0x2b4851){_0x2be493['where'](_0x2b4851);var _0x2f42d9=_0x199e8b[_0xf557('0x6')]?_0x581f39[_0xf557('0xe')]:_0x199e8b['tag'];_0x15d127=_0x2f42d9?!![]:![];return sqlUtils[_0xf557('0xf')](_0x2be493,_0x2f42d9);})[_0xf557('0x5')](function(_0x4af885){_0x8ca18b[_0xf557('0x10')]=_0x4af885;if(_0x8ca18b['count']===0x0){return;}if(_0x199e8b[_0xf557('0x11')]){_0x105171=!![];}return sqlUtils[_0xf557('0x12')](_0x2be493,_0x199e8b[_0xf557('0x13')],_0x4f1068,_0x15d127,_0x581f39['clause'],_0x105171);})[_0xf557('0x5')](function(_0x40a64f){if(!_0x40a64f){return[];}return sqlUtils[_0xf557('0x14')](_0x40a64f,_0x199e8b,_0x4f1068);})[_0xf557('0x5')](function(_0x4d8628){_0x8ca18b[_0xf557('0x15')]=_0x4d8628;return _0x8ca18b;})[_0xf557('0x16')](function(_0x2db90e){throw _0x2db90e;});};exports[_0xf557('0x17')]=function(){var _0x43b1d4={};var _0x2c802a=[];return db[_0xf557('0x18')][_0xf557('0x17')]()[_0xf557('0x5')](function(_0x32ddc4){_0x43b1d4=_0x32ddc4;var _0x4c3b1d=Object['keys'](_0x43b1d4)[_0xf557('0x19')](function(_0x466024){return _[_0xf557('0x1a')](_0x466024,_0xf557('0x1b'))?_0x466024:undefined;});var _0x61ac51=_0x4c3b1d['map'](function(_0x180f69){return db[_0xf557('0x1c')]['findOne']({'where':{'id':_0x180f69[_0xf557('0x1d')](0x3)},'raw':!![]});});return Promise[_0xf557('0x1e')](_0x61ac51);})[_0xf557('0x5')](function(_0x5924f9){for(var _0x252e23=0x0;_0x252e23<_0x5924f9[_0xf557('0x1f')];_0x252e23++){if(_0x5924f9[_0x252e23]){var _0x4662c5=_0xf557('0x1b')+_0x5924f9[_0x252e23]['id'];_0x43b1d4[_0x4662c5][_0xf557('0x20')]=_0x5924f9[_0x252e23][_0xf557('0x21')];}}_0x2c802a=_[_0xf557('0x22')](Object[_0xf557('0x23')](_0x43b1d4),function(_0x5f4284){return{'name':_0x5f4284,'type':_0x43b1d4[_0x5f4284][_0xf557('0x21')]};});return _0x2c802a;})[_0xf557('0x16')](function(_0x46612a){throw _0x46612a;});}; \ No newline at end of file +var _0x0a38=['default','fields','user','clause','checkListsRestrictions','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','filter','startsWith','CmCustomField','slice','all','length','cf_','fieldType','map','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','then','search','parseQueryParameters','where'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x0a38,0x139));var _0x80a3=function(_0x396cd1,_0x2eb368){_0x396cd1=_0x396cd1-0x0;var _0x59dd4a=_0x0a38[_0x396cd1];return _0x59dd4a;};'use strict';var _=require(_0x80a3('0x0'));var sqlUtils=require(_0x80a3('0x1'));var db=require(_0x80a3('0x2'))['db'];exports[_0x80a3('0x3')]=function(_0x5bf6c9,_0x46b4d7,_0xc5a584,_0x390dd1){var _0x56c3f5={'count':0x0,'rows':[]};var _0x4bf28e=sqlUtils[_0x80a3('0x4')](_0x46b4d7,_0x5bf6c9);if(_0x4bf28e){return Promise['resolve'](_0x56c3f5);}var _0x544dfd=sqlUtils[_0x80a3('0x5')]();var _0x1d8034={};var _0x924213=![];var _0x4269c5=![];return Promise[_0x80a3('0x6')]()[_0x80a3('0x7')](function(){if(_0x5bf6c9['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x5bf6c9[_0x80a3('0x8')],_0x390dd1);}else{return sqlUtils[_0x80a3('0x9')](_0x5bf6c9,_0x390dd1);}})[_0x80a3('0x7')](function(_0x142cc8){_0x544dfd[_0x80a3('0xa')](_0x142cc8[_0x80a3('0xb')]);_0x544dfd[_0x80a3('0xa')](_0x142cc8[_0x80a3('0xc')]);_0x544dfd[_0x80a3('0xa')](_0x142cc8['filter']);_0x544dfd[_0x80a3('0xa')](_0x142cc8[_0x80a3('0xd')][_0x80a3('0xe')]);_0x1d8034=_0x142cc8['tags'];_0x4269c5=_0x142cc8[_0x80a3('0xd')]['skip'];return sqlUtils[_0x80a3('0xf')](_0x46b4d7,_0x5bf6c9,_0x4269c5);})[_0x80a3('0x7')](function(_0x2fc89d){_0x544dfd['where'](_0x2fc89d);var _0x50517b=_0x5bf6c9[_0x80a3('0x8')]?_0x1d8034['ids']:_0x5bf6c9[_0x80a3('0x10')];_0x924213=_0x50517b?!![]:![];return sqlUtils[_0x80a3('0x11')](_0x544dfd,_0x50517b);})[_0x80a3('0x7')](function(_0x245867){_0x56c3f5[_0x80a3('0x12')]=_0x245867;if(_0x56c3f5[_0x80a3('0x12')]===0x0){return;}if(_0x5bf6c9['User']){_0x4269c5=!![];}return sqlUtils[_0x80a3('0x13')](_0x544dfd,_0x5bf6c9[_0x80a3('0xc')],_0xc5a584,_0x924213,_0x1d8034[_0x80a3('0xe')],_0x4269c5);})[_0x80a3('0x7')](function(_0x549309){if(!_0x549309){return[];}return sqlUtils[_0x80a3('0x14')](_0x549309,_0x5bf6c9,_0xc5a584);})[_0x80a3('0x7')](function(_0x3cfee5){_0x56c3f5[_0x80a3('0x15')]=_0x3cfee5;return _0x56c3f5;})[_0x80a3('0x16')](function(_0x2a1231){throw _0x2a1231;});};exports[_0x80a3('0x17')]=function(){var _0x17a669={};var _0x1ae810=[];return db[_0x80a3('0x18')][_0x80a3('0x17')]()[_0x80a3('0x7')](function(_0x591456){_0x17a669=_0x591456;var _0xc0b73b=Object[_0x80a3('0x19')](_0x17a669)[_0x80a3('0x1a')](function(_0x1e261f){return _[_0x80a3('0x1b')](_0x1e261f,'cf_')?_0x1e261f:undefined;});var _0x2d4c44=_0xc0b73b['map'](function(_0x4c1805){return db[_0x80a3('0x1c')]['findOne']({'where':{'id':_0x4c1805[_0x80a3('0x1d')](0x3)},'raw':!![]});});return Promise[_0x80a3('0x1e')](_0x2d4c44);})[_0x80a3('0x7')](function(_0x3d9af5){for(var _0x67ae9=0x0;_0x67ae9<_0x3d9af5[_0x80a3('0x1f')];_0x67ae9++){if(_0x3d9af5[_0x67ae9]){var _0x5f521a=_0x80a3('0x20')+_0x3d9af5[_0x67ae9]['id'];_0x17a669[_0x5f521a][_0x80a3('0x21')]=_0x3d9af5[_0x67ae9]['type'];}}_0x1ae810=_[_0x80a3('0x22')](Object['keys'](_0x17a669),function(_0x125c2d){return{'name':_0x125c2d,'type':_0x17a669[_0x125c2d][_0x80a3('0x23')]};});return _0x1ae810;})['catch'](function(_0xb17dc8){throw _0xb17dc8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 58cc805..c9b7f69 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc366=['search','ListId','true','select','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','c.ListId\x20IN\x20?','concat','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','sequelize','toString','Tags','clone','getSelectedTags','t.id\x20IN\x20?','SELECT','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc366,0x65));var _0x6c36=function(_0x16027d,_0x43be7c){_0x16027d=_0x16027d-0x0;var _0x1c72b5=_0xc366[_0x16027d];return _0x1c72b5;};'use strict';var _=require(_0x6c36('0x0'));var squel=require(_0x6c36('0x1'));var as=require(_0x6c36('0x2'));var qs=require(_0x6c36('0x3'));var utils=require('../interaction/utils');var db=require(_0x6c36('0x4'))['db'];function skipContactsQuery(_0x4242e9,_0x1a5cd0){var _0xeb44b3=![];if(_0x4242e9[_0x6c36('0x5')]===_0x6c36('0x6')&&!_0x1a5cd0[_0x6c36('0x7')]&&!_0x1a5cd0[_0x6c36('0x8')]&&_0x1a5cd0['autocomplete']!==_0x6c36('0x9')){_0xeb44b3=!![];}return _0xeb44b3;}function getContactsSubquery(){return squel[_0x6c36('0xa')]()[_0x6c36('0xb')](_0x6c36('0xc'),'c')[_0x6c36('0xd')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0xbdf060,_0x385d30){var _0x543d70=_0x385d30?'c':_0x6c36('0xe');_0xbdf060[_0x6c36('0xf')](_0x6c36('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x543d70+_0x6c36('0x11'))['left_join'](_0x6c36('0x12'),'ct',_0x6c36('0x13')+_0x543d70+_0x6c36('0x11'))['left_join'](_0x6c36('0x14'),'t',_0x6c36('0x15'));return _0xbdf060;}function addFieldsToQuery(_0x5821f2,_0x2892fa,_0x3afd78,_0x3e58f0,_0x1942a6){var _0x34016b=_0x1942a6?'c':'subqry';if(!_0x2892fa){_0x2892fa=['id',_0x6c36('0x16'),_0x6c36('0x17'),_0x6c36('0x18'),'mobile','fax',_0x6c36('0x19'),_0x6c36('0x8'),_0x6c36('0x1a'),_0x6c36('0x1b'),_0x6c36('0x1c'),_0x6c36('0x1d'),_0x6c36('0x1e')];}else if(!_0x2892fa['includes']('id')){_0x2892fa['push']('id');}var _0x3ef849=_0x3afd78&&_0x1942a6||!_0x3afd78&&!_0x1942a6;if(_0x3e58f0){_0x3ef849=_0x3e58f0&&_0x1942a6||!_0x3e58f0&&!_0x1942a6;}_0x2892fa[_0x6c36('0x1f')](function(_0x44d098){if(_0x44d098===_0x6c36('0x1e')){if(_0x3ef849){_0x5821f2[_0x6c36('0x20')](_0x6c36('0x21'),_0x44d098);}else if(_0x3afd78||_0x3e58f0){_0x5821f2[_0x6c36('0x20')](_0x34016b+'.'+_0x44d098);}}else{_0x5821f2['field'](_0x34016b+'.'+_0x44d098);}});return _0x5821f2;}function getSqlClauses(){var _0x4c366c={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x6c36('0x22')](),'ids':null},'user':{'clause':squel[_0x6c36('0x22')](),'skip':![]}};return _0x4c366c;}function parseTagParameter(_0x1f7346){var _0x36f73f=squel[_0x6c36('0x22')]();if(_0x1f7346){var _0x185bb6=utils['getSelectedTags'](_0x1f7346);_0x185bb6[_0x6c36('0x1f')](function(_0x1ba039){_0x36f73f['or'](_0x6c36('0x23'),'%,'+_0x1ba039+',%');});}return _0x36f73f;}function parseSearchFilter(_0x4fc3f3){var _0x11ebda=squel[_0x6c36('0x22')]();if(_0x4fc3f3){var _0x29121f=_0x4fc3f3[_0x6c36('0x24')]('\x5c','\x5c\x5c')[_0x6c36('0x24')](/'/g,'\x27\x27');if(_0x29121f[_0x6c36('0x25')]('\x20')[_0x6c36('0x26')]>0x1){_0x11ebda['or'](_0x6c36('0x27'),qs[_0x6c36('0x28')](_0x29121f,!![]),null);}else{if(qs[_0x6c36('0x29')](_0x29121f)){_0x11ebda['or']('c.id\x20LIKE\x20?',_0x29121f+'%');_0x11ebda['or'](_0x6c36('0x2a'),_0x29121f+'%');_0x11ebda['or'](_0x6c36('0x2b'),_0x29121f+'%');_0x11ebda['or'](_0x6c36('0x2c'),_0x29121f+'%');}else if(qs[_0x6c36('0x2d')](_0x29121f)){_0x11ebda['or'](_0x6c36('0x2e'),_0x29121f+'%');}else{_0x11ebda['or']('c.firstName\x20LIKE\x20?','%'+_0x29121f+'%');_0x11ebda['or']('c.lastName\x20LIKE\x20?','%'+_0x29121f+'%');_0x11ebda['or']('c.email\x20LIKE\x20?','%'+_0x29121f+'%');}}}return _0x11ebda;}function parseAdvancedSearchFilter(_0x5d2583,_0x2e0bd7){var _0x1feb26=getSqlClauses();var _0x598e5b=as[_0x6c36('0x2f')](_0x5d2583);var _0x75deb0=_0x598e5b[_0x6c36('0x30')];for(var _0x49c667=0x0;_0x49c667<_0x598e5b[_0x6c36('0x31')][_0x6c36('0x26')];_0x49c667++){var _0x2cc3c1=_0x598e5b['conditions'][_0x49c667];var _0x8c1a04='c';var _0x44ab9f=_[_0x6c36('0x32')](_0x2e0bd7,['name',_0x2cc3c1['field']]);if(_0x44ab9f){if(_0x2cc3c1['field']===_0x6c36('0x33')||_0x44ab9f[_0x6c36('0x34')]===_0x6c36('0x35')){_0x2cc3c1[_0x6c36('0x36')]='DATE';}var _0x2ed2cc=as[_0x6c36('0x37')](_0x8c1a04,_0x44ab9f[_0x6c36('0x38')],_0x2cc3c1);_0x1feb26[_0x6c36('0x39')][_0x75deb0](_0x2ed2cc[_0x6c36('0x3a')],_0x2ed2cc[_0x6c36('0x3b')][_0x6c36('0x3c')],_0x2ed2cc[_0x6c36('0x3b')]['end']);}else{if(_0x2cc3c1['field']===_0x6c36('0x3d')){var _0x3e4c22=_0x2cc3c1[_0x6c36('0x3b')][_0x6c36('0x25')](',')[_0x6c36('0x3e')](function(_0x3d5a65){return Number(_0x3d5a65);});var _0x28c929=parseTagParameter(_0x3e4c22);_0x1feb26[_0x6c36('0x3f')][_0x6c36('0x40')][_0x6c36('0x41')](_0x28c929);_0x1feb26[_0x6c36('0x3f')][_0x6c36('0x42')]=_0x3e4c22;}else if(_0x2cc3c1[_0x6c36('0x20')]===_0x6c36('0x43')){_0x1feb26[_0x6c36('0x44')][_0x6c36('0x40')]['and'](_0x6c36('0x45'),_0x2cc3c1['value']);_0x1feb26[_0x6c36('0x44')][_0x6c36('0x46')]=!![];}}}return _0x1feb26;}function parseModelFields(_0x1228fb,_0x1e7ee8){var _0x286c7d=squel[_0x6c36('0x22')]();var _0x353f50=_(_0x1228fb)[_0x6c36('0x47')]()[_0x6c36('0x3e')](function(_0x352b5b){return _[_0x6c36('0x48')](_0x1e7ee8,[_0x6c36('0x49'),_0x352b5b])?_0x352b5b:undefined;})[_0x6c36('0x4a')]()[_0x6c36('0x3b')]();if(_0x1228fb['Contact']){_0x353f50['push'](_0x6c36('0x4b'));}if(_0x1228fb[_0x6c36('0x43')]){_0x353f50['push'](_0x6c36('0x43'));}if(_0x353f50[_0x6c36('0x26')]>0x0){_0x353f50[_0x6c36('0x1f')](function(_0x35ca0c){if(_0x35ca0c===_0x6c36('0x8')){_0x286c7d[_0x6c36('0x41')](_0x6c36('0x4c'),[][_0x6c36('0x4d')](_0x1228fb[_0x35ca0c]));}else if(_0x35ca0c===_0x6c36('0x4b')){var _0x750857='%'+_0x1228fb[_0x35ca0c]+'%';_0x286c7d['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x750857);}else if(_0x35ca0c==='User'){_0x286c7d[_0x6c36('0x41')](_0x6c36('0x45'),_0x1228fb[_0x35ca0c]);}else{_0x286c7d[_0x6c36('0x41')]('c.'+_0x35ca0c+'\x20=\x20?',_0x1228fb[_0x35ca0c]);}});}return _0x286c7d;}function parseQueryParameters(_0x4fd530,_0x416640){var _0x5267ee=getSqlClauses();return Promise[_0x6c36('0x4e')]()[_0x6c36('0x4f')](function(){return parseModelFields(_0x4fd530,_0x416640);})[_0x6c36('0x4f')](function(_0x16fd88){_0x5267ee[_0x6c36('0x50')][_0x6c36('0x41')](_0x16fd88);return parseTagParameter(_0x4fd530[_0x6c36('0x51')]);})[_0x6c36('0x4f')](function(_0x8c002b){_0x5267ee[_0x6c36('0x3f')][_0x6c36('0x40')][_0x6c36('0x41')](_0x8c002b);return parseSearchFilter(_0x4fd530[_0x6c36('0x52')]);})['then'](function(_0x3c6158){_0x5267ee['filter']=_0x3c6158;return _0x5267ee;});}function checkListsRestrictions(_0x30c31b,_0x5c6a6d,_0x1cb1db){var _0x4dcac9=squel['expr']();return Promise[_0x6c36('0x4e')]()[_0x6c36('0x4f')](function(){if(_0x5c6a6d['search']&&_0x30c31b['role']==='agent'&&!_0x1cb1db){return _0x30c31b[_0x6c36('0x53')]({'attributes':['id'],'raw':!![]});}})[_0x6c36('0x4f')](function(_0x1b1771){if(_0x1b1771){if(_0x1b1771[_0x6c36('0x26')]===0x0){_0x4dcac9['and'](_0x6c36('0x54'));}else{_0x4dcac9['and']('c.ListId\x20IN\x20?',_['map'](_0x1b1771,'id'));}}})[_0x6c36('0x4f')](function(){return _0x4dcac9;});}function buildContactsQuery(_0x1f9b6f,_0x44f660,_0x2039b3,_0x5799a9,_0x3e6b12,_0x5e77b){if(_0x44f660){_0x44f660=_0x2039b3[_0x6c36('0x55')];}_0x1f9b6f=addFieldsToQuery(_0x1f9b6f,_0x44f660,_0x5799a9,_0x5e77b,!![]);var _0x1481d2=squel[_0x6c36('0xa')]();_0x1481d2=addFieldsToQuery(_0x1481d2,_0x44f660,_0x5799a9,_0x5e77b,![]);if(_0x5799a9||_0x5e77b){_0x1f9b6f=applyJoinClauses(_0x1f9b6f,!![]);_0x1f9b6f['group'](_0x6c36('0x56'));if(_0x2039b3['limit']){_0x1481d2[_0x6c36('0x57')](_0x2039b3[_0x6c36('0x57')]);}if(_0x2039b3[_0x6c36('0x58')]){_0x1481d2[_0x6c36('0x58')](_0x2039b3[_0x6c36('0x58')]);}}else{_0x1481d2=applyJoinClauses(_0x1481d2,![]);_0x1481d2[_0x6c36('0x59')]('subqry.id');if(_0x2039b3[_0x6c36('0x57')]){_0x1f9b6f[_0x6c36('0x57')](_0x2039b3['limit']);}if(_0x2039b3[_0x6c36('0x58')]){_0x1f9b6f['offset'](_0x2039b3[_0x6c36('0x58')]);}}_0x1481d2[_0x6c36('0x5a')](_0x3e6b12);if(_0x2039b3[_0x6c36('0x5b')]){_0x2039b3[_0x6c36('0x5b')]['forEach'](function(_0x396fa1){_0x1f9b6f[_0x6c36('0x5b')]('c.'+_0x396fa1[0x0],_0x396fa1[0x1]===_0x6c36('0x5c')?![]:!![]);_0x1481d2['order'](_0x6c36('0x5d')+_0x396fa1[0x0],_0x396fa1[0x1]===_0x6c36('0x5c')?![]:!![]);});}_0x1481d2[_0x6c36('0xb')](_0x1f9b6f,'subqry');return _0x1481d2;}function getFilteredContacts(_0x2c3b15){var _0x2a776b=[];return db['Tag'][_0x6c36('0x5e')]({'attributes':['id','name',_0x6c36('0x5f')],'raw':!![]})['then'](function(_0xeb0130){_0x2a776b=_[_0x6c36('0x60')](_0xeb0130,'id');var _0xd234c7={'type':db[_0x6c36('0x61')][_0x6c36('0x62')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6c36('0x63')]['query'](_0x2c3b15[_0x6c36('0x64')](),_0xd234c7);})['then'](function(_0xfc3567){_0xfc3567[_0x6c36('0x1f')](function(_0x27f5e6){if(_0x27f5e6[_0x6c36('0x1e')]){_0x27f5e6[_0x6c36('0x65')]=[];_0x27f5e6[_0x6c36('0x1e')][_0x6c36('0x25')](',')[_0x6c36('0x1f')](function(_0x397baf){_0x27f5e6[_0x6c36('0x65')]['push'](_0x2a776b[_0x397baf]);});}delete _0x27f5e6['TagIds'];});return _0xfc3567;});}function countFilteredContacts(_0x43817f,_0x4e59ed){var _0x568a63=_0x43817f[_0x6c36('0x66')]();_0x568a63[_0x6c36('0x20')]('COUNT(*)');_0x568a63=applyJoinClauses(_0x568a63,!![]);_0x43817f['group'](_0x6c36('0x56'));var _0x57a756=utils[_0x6c36('0x67')](_0x4e59ed);if(!_['isEmpty'](_0x57a756)){_0x568a63[_0x6c36('0xd')](_0x6c36('0x68'),_0x57a756);}var _0x1f22d4={'type':db[_0x6c36('0x61')][_0x6c36('0x62')][_0x6c36('0x69')],'raw':!![]};return db[_0x6c36('0x63')]['query'](_0x568a63[_0x6c36('0x64')](),_0x1f22d4)[_0x6c36('0x4f')](function(_0x5c6897){return _0x5c6897[0x0][_0x6c36('0x6a')];});}module[_0x6c36('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7d85=['c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','value','end','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','map','some','Contact','ListId','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','limit','offset','subqry.id','order','subqry.','DESC','Tag','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7d85,0xb4));var _0x57d8=function(_0x50dc6c,_0x2de62c){_0x50dc6c=_0x50dc6c-0x0;var _0x392e67=_0x7d85[_0x50dc6c];return _0x392e67;};'use strict';var _=require(_0x57d8('0x0'));var squel=require(_0x57d8('0x1'));var as=require(_0x57d8('0x2'));var qs=require(_0x57d8('0x3'));var utils=require(_0x57d8('0x4'));var db=require(_0x57d8('0x5'))['db'];function skipContactsQuery(_0x47ea70,_0x4d0443){var _0x5631c0=![];if(_0x47ea70['role']===_0x57d8('0x6')&&!_0x4d0443[_0x57d8('0x7')]&&!_0x4d0443['ListId']&&_0x4d0443[_0x57d8('0x8')]!==_0x57d8('0x9')){_0x5631c0=!![];}return _0x5631c0;}function getContactsSubquery(){return squel['select']()[_0x57d8('0xa')](_0x57d8('0xb'),'c')[_0x57d8('0xc')](_0x57d8('0xd'));}function applyJoinClauses(_0x503163,_0x4f7b91){var _0x39d480=_0x4f7b91?'c':_0x57d8('0xe');_0x503163[_0x57d8('0xf')](_0x57d8('0x10'),'uc',_0x57d8('0x11')+_0x39d480+_0x57d8('0x12'))['left_join'](_0x57d8('0x13'),'ct',_0x57d8('0x14')+_0x39d480+_0x57d8('0x12'))[_0x57d8('0xf')](_0x57d8('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x503163;}function addFieldsToQuery(_0xe824fc,_0x39b462,_0x3afe94,_0x53e6d4,_0x3f8f58){var _0x2551bf=_0x3f8f58?'c':'subqry';if(!_0x39b462){_0x39b462=['id',_0x57d8('0x16'),'lastName','phone',_0x57d8('0x17'),_0x57d8('0x18'),_0x57d8('0x19'),'ListId',_0x57d8('0x1a'),_0x57d8('0x1b'),_0x57d8('0x1c'),_0x57d8('0x1d'),_0x57d8('0x1e')];}else if(!_0x39b462[_0x57d8('0x1f')]('id')){_0x39b462[_0x57d8('0x20')]('id');}var _0x275d4c=_0x3afe94&&_0x3f8f58||!_0x3afe94&&!_0x3f8f58;if(_0x53e6d4){_0x275d4c=_0x53e6d4&&_0x3f8f58||!_0x53e6d4&&!_0x3f8f58;}_0x39b462[_0x57d8('0x21')](function(_0x5843c3){if(_0x5843c3===_0x57d8('0x1e')){if(_0x275d4c){_0xe824fc[_0x57d8('0x22')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5843c3);}else if(_0x3afe94||_0x53e6d4){_0xe824fc[_0x57d8('0x22')](_0x2551bf+'.'+_0x5843c3);}}else{_0xe824fc[_0x57d8('0x22')](_0x2551bf+'.'+_0x5843c3);}});return _0xe824fc;}function getSqlClauses(){var _0x185864={'default':squel[_0x57d8('0x23')](),'fields':squel[_0x57d8('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x57d8('0x23')](),'ids':null},'user':{'clause':squel[_0x57d8('0x23')](),'skip':![]}};return _0x185864;}function parseTagParameter(_0x39539b){var _0x43c7a1=squel[_0x57d8('0x23')]();if(_0x39539b){var _0x222e49=utils[_0x57d8('0x24')](_0x39539b);_0x222e49[_0x57d8('0x21')](function(_0x352592){_0x43c7a1['or'](_0x57d8('0x25'),'%,'+_0x352592+',%');});}return _0x43c7a1;}function parseSearchFilter(_0x4e136b){var _0x1bd654=squel[_0x57d8('0x23')]();if(_0x4e136b){var _0x2f3f7b=_0x4e136b[_0x57d8('0x26')]('\x5c','\x5c\x5c')[_0x57d8('0x26')](/'/g,'\x27\x27');if(_0x2f3f7b[_0x57d8('0x27')]('\x20')[_0x57d8('0x28')]>0x1){_0x1bd654['or'](_0x57d8('0x29'),qs[_0x57d8('0x2a')](_0x2f3f7b,!![]),null);}else{if(qs[_0x57d8('0x2b')](_0x2f3f7b)){_0x1bd654['or'](_0x57d8('0x2c'),_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x2d'),_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x2e'),_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x2f'),_0x2f3f7b+'%');}else if(qs['isEmail'](_0x2f3f7b)){_0x1bd654['or'](_0x57d8('0x30'),_0x2f3f7b+'%');}else{_0x1bd654['or'](_0x57d8('0x31'),'%'+_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x32'),'%'+_0x2f3f7b+'%');_0x1bd654['or'](_0x57d8('0x30'),'%'+_0x2f3f7b+'%');}}}return _0x1bd654;}function parseAdvancedSearchFilter(_0x524880,_0x266cd0){var _0x175e64=getSqlClauses();var _0x339b1e=as['parseSearch'](_0x524880);var _0x27c3d5=_0x339b1e[_0x57d8('0x33')];for(var _0x8c5f71=0x0;_0x8c5f71<_0x339b1e[_0x57d8('0x34')][_0x57d8('0x28')];_0x8c5f71++){var _0x2cd5d6=_0x339b1e[_0x57d8('0x34')][_0x8c5f71];var _0x5a66da='c';var _0x3b98e5=_['find'](_0x266cd0,[_0x57d8('0x35'),_0x2cd5d6[_0x57d8('0x22')]]);if(_0x3b98e5){if(_0x2cd5d6[_0x57d8('0x22')]===_0x57d8('0x36')||_0x3b98e5[_0x57d8('0x37')]===_0x57d8('0x38')){_0x2cd5d6[_0x57d8('0x39')]=_0x57d8('0x3a');}var _0x18d747=as['buildExpression'](_0x5a66da,_0x3b98e5[_0x57d8('0x3b')],_0x2cd5d6);_0x175e64[_0x57d8('0x3c')][_0x27c3d5](_0x18d747['text'],_0x18d747[_0x57d8('0x3d')]['start'],_0x18d747[_0x57d8('0x3d')][_0x57d8('0x3e')]);}else{if(_0x2cd5d6[_0x57d8('0x22')]==='Tag'){var _0x5b7fa6=_0x2cd5d6[_0x57d8('0x3d')][_0x57d8('0x27')](',')['map'](function(_0x218839){return Number(_0x218839);});var _0x54436b=parseTagParameter(_0x5b7fa6);_0x175e64[_0x57d8('0x3f')][_0x57d8('0x40')][_0x57d8('0x41')](_0x54436b);_0x175e64[_0x57d8('0x3f')][_0x57d8('0x42')]=_0x5b7fa6;}else if(_0x2cd5d6[_0x57d8('0x22')]===_0x57d8('0x43')){_0x175e64[_0x57d8('0x44')]['clause'][_0x57d8('0x41')](_0x57d8('0x45'),_0x2cd5d6['value']);_0x175e64[_0x57d8('0x44')][_0x57d8('0x46')]=!![];}}}return _0x175e64;}function parseModelFields(_0x30e69e,_0x2e1852){var _0x52abb1=squel[_0x57d8('0x23')]();var _0x5c4ba7=_(_0x30e69e)[_0x57d8('0x47')]()[_0x57d8('0x48')](function(_0x597403){return _[_0x57d8('0x49')](_0x2e1852,[_0x57d8('0x35'),_0x597403])?_0x597403:undefined;})['compact']()['value']();if(_0x30e69e['Contact']){_0x5c4ba7['push'](_0x57d8('0x4a'));}if(_0x30e69e['User']){_0x5c4ba7['push'](_0x57d8('0x43'));}if(_0x5c4ba7[_0x57d8('0x28')]>0x0){_0x5c4ba7['forEach'](function(_0x4b8241){if(_0x4b8241===_0x57d8('0x4b')){_0x52abb1[_0x57d8('0x41')](_0x57d8('0x4c'),[]['concat'](_0x30e69e[_0x4b8241]));}else if(_0x4b8241===_0x57d8('0x4a')){var _0x26adbe='%'+_0x30e69e[_0x4b8241]+'%';_0x52abb1[_0x57d8('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x26adbe);}else if(_0x4b8241==='User'){_0x52abb1[_0x57d8('0x41')](_0x57d8('0x45'),_0x30e69e[_0x4b8241]);}else{_0x52abb1[_0x57d8('0x41')]('c.'+_0x4b8241+_0x57d8('0x4d'),_0x30e69e[_0x4b8241]);}});}return _0x52abb1;}function parseQueryParameters(_0x3ac976,_0x4a6388){var _0x1998a7=getSqlClauses();return Promise[_0x57d8('0x4e')]()['then'](function(){return parseModelFields(_0x3ac976,_0x4a6388);})[_0x57d8('0x4f')](function(_0xe53ff4){_0x1998a7[_0x57d8('0x50')][_0x57d8('0x41')](_0xe53ff4);return parseTagParameter(_0x3ac976[_0x57d8('0x51')]);})[_0x57d8('0x4f')](function(_0x3f6740){_0x1998a7[_0x57d8('0x3f')]['clause'][_0x57d8('0x41')](_0x3f6740);return parseSearchFilter(_0x3ac976[_0x57d8('0x52')]);})[_0x57d8('0x4f')](function(_0x18e410){_0x1998a7[_0x57d8('0x52')]=_0x18e410;return _0x1998a7;});}function checkListsRestrictions(_0x619ecf,_0x54a746,_0x2efdc7){var _0x569212=squel[_0x57d8('0x23')]();return Promise[_0x57d8('0x4e')]()[_0x57d8('0x4f')](function(){if(_0x54a746[_0x57d8('0x7')]&&_0x619ecf['role']===_0x57d8('0x6')&&!_0x2efdc7){return _0x619ecf[_0x57d8('0x53')]({'attributes':['id'],'raw':!![]});}})[_0x57d8('0x4f')](function(_0x11fcb5){if(_0x11fcb5){if(_0x11fcb5[_0x57d8('0x28')]===0x0){_0x569212[_0x57d8('0x41')](_0x57d8('0x54'));}else{_0x569212['and']('c.ListId\x20IN\x20?',_[_0x57d8('0x48')](_0x11fcb5,'id'));}}})[_0x57d8('0x4f')](function(){return _0x569212;});}function buildContactsQuery(_0x54053c,_0x2e3b04,_0x13fc0f,_0xc2cb17,_0x193bb6,_0x5994ce){if(_0x2e3b04){_0x2e3b04=_0x13fc0f[_0x57d8('0x55')];}_0x54053c=addFieldsToQuery(_0x54053c,_0x2e3b04,_0xc2cb17,_0x5994ce,!![]);var _0x574dd9=squel[_0x57d8('0x56')]();_0x574dd9=addFieldsToQuery(_0x574dd9,_0x2e3b04,_0xc2cb17,_0x5994ce,![]);if(_0xc2cb17||_0x5994ce){_0x54053c=applyJoinClauses(_0x54053c,!![]);_0x54053c[_0x57d8('0x57')]('c.id');if(_0x13fc0f['limit']){_0x574dd9['limit'](_0x13fc0f[_0x57d8('0x58')]);}if(_0x13fc0f[_0x57d8('0x59')]){_0x574dd9['offset'](_0x13fc0f['offset']);}}else{_0x574dd9=applyJoinClauses(_0x574dd9,![]);_0x574dd9[_0x57d8('0x57')](_0x57d8('0x5a'));if(_0x13fc0f[_0x57d8('0x58')]){_0x54053c['limit'](_0x13fc0f[_0x57d8('0x58')]);}if(_0x13fc0f[_0x57d8('0x59')]){_0x54053c[_0x57d8('0x59')](_0x13fc0f[_0x57d8('0x59')]);}}_0x574dd9['having'](_0x193bb6);if(_0x13fc0f[_0x57d8('0x5b')]){_0x13fc0f[_0x57d8('0x5b')]['forEach'](function(_0x3c7cfb){_0x54053c[_0x57d8('0x5b')]('c.'+_0x3c7cfb[0x0],_0x3c7cfb[0x1]==='DESC'?![]:!![]);_0x574dd9[_0x57d8('0x5b')](_0x57d8('0x5c')+_0x3c7cfb[0x0],_0x3c7cfb[0x1]===_0x57d8('0x5d')?![]:!![]);});}_0x574dd9[_0x57d8('0xa')](_0x54053c,_0x57d8('0xe'));return _0x574dd9;}function getFilteredContacts(_0x345de0){var _0x711419=[];return db[_0x57d8('0x5e')][_0x57d8('0x5f')]({'attributes':['id',_0x57d8('0x35'),_0x57d8('0x60')],'raw':!![]})[_0x57d8('0x4f')](function(_0x170808){_0x711419=_[_0x57d8('0x61')](_0x170808,'id');var _0x1b4335={'type':db[_0x57d8('0x62')]['QueryTypes'][_0x57d8('0x63')],'model':db[_0x57d8('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x57d8('0x65')][_0x57d8('0x66')](_0x345de0[_0x57d8('0x67')](),_0x1b4335);})[_0x57d8('0x4f')](function(_0x354ec1){_0x354ec1[_0x57d8('0x21')](function(_0x11ea0e){if(_0x11ea0e['TagIds']){_0x11ea0e[_0x57d8('0x68')]=[];_0x11ea0e[_0x57d8('0x1e')]['split'](',')[_0x57d8('0x21')](function(_0x240b4f){_0x11ea0e['Tags'][_0x57d8('0x20')](_0x711419[_0x240b4f]);});}delete _0x11ea0e[_0x57d8('0x1e')];});return _0x354ec1;});}function countFilteredContacts(_0x1a07c3,_0x1b4d5f){var _0x29ab63=_0x1a07c3[_0x57d8('0x69')]();_0x29ab63[_0x57d8('0x22')](_0x57d8('0x6a'));_0x29ab63=applyJoinClauses(_0x29ab63,!![]);_0x1a07c3[_0x57d8('0x57')](_0x57d8('0x6b'));var _0x1a2460=utils[_0x57d8('0x24')](_0x1b4d5f);if(!_[_0x57d8('0x6c')](_0x1a2460)){_0x29ab63[_0x57d8('0xc')](_0x57d8('0x6d'),_0x1a2460);}var _0x190ca6={'type':db['Sequelize'][_0x57d8('0x6e')][_0x57d8('0x63')],'raw':!![]};return db['sequelize']['query'](_0x29ab63[_0x57d8('0x67')](),_0x190ca6)[_0x57d8('0x4f')](function(_0x480c9b){return _0x480c9b[0x0]['COUNT(*)'];});}module[_0x57d8('0x6f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 970de26..f3e1fe4 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 _0xb695=['test','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','unlink','decryptFile','createDecipher','final','close','secret','utf8','base64','decryptString','crypto','bluebird','lodash','app','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x578f1f,_0x1e7c32){var _0x31e4e1=function(_0x3d5a77){while(--_0x3d5a77){_0x578f1f['push'](_0x578f1f['shift']());}};_0x31e4e1(++_0x1e7c32);}(_0xb695,0x1a7));var _0x5b69=function(_0xf2f347,_0x22d5a7){_0xf2f347=_0xf2f347-0x0;var _0x37a440=_0xb695[_0xf2f347];return _0x37a440;};'use strict';var crypto=require(_0x5b69('0x0'));var fs=require('fs');var BPromise=require(_0x5b69('0x1'));var _=require(_0x5b69('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x5b69('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x5b69('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5b69('0x5')};if(config[_0x5b69('0x6')]&&config[_0x5b69('0x6')][_0x5b69('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x5b69('0x7')]);if(isSupported){fileOptions[_0x5b69('0x7')]=config[_0x5b69('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5b69('0x8')](',\x20');logger[_0x5b69('0x9')](config[_0x5b69('0x6')][_0x5b69('0x7')],_0x5b69('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x22e478){return AES_SUPPORTED_RX[_0x5b69('0xb')](_0x22e478);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x5b69('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2fce25){return getSupportedCiphers()['indexOf'](_0x2fce25)>-0x1;}function combineOptions(_0x98a90d){var _0x372d6={};for(var _0x53c116 in fileOptions){if(fileOptions[_0x5b69('0xd')](_0x53c116)){_0x372d6[_0x53c116]=fileOptions[_0x53c116];}}if(_0x98a90d){for(var _0x5d707c in _0x98a90d){if(_0x98a90d[_0x5b69('0xd')](_0x5d707c)){_0x372d6[_0x5d707c]=_0x98a90d[_0x5d707c];}}}return _0x372d6;}exports[_0x5b69('0xe')]=function(_0x56b951,_0x3eba40,_0x562392,_0x4dd123){return new BPromise(function(_0x3afd2b,_0x47a89c){_0x4dd123=combineOptions(_0x4dd123);var _0x281d63=new Buffer(_0x562392);var _0x25652a=fs[_0x5b69('0xf')](_0x56b951);var _0x26e4b8=fs[_0x5b69('0x10')](_0x3eba40);var _0x3f3ba5=crypto['createCipher'](_0x4dd123[_0x5b69('0x7')],_0x281d63);_0x25652a['on'](_0x5b69('0x11'),function(_0x2a2ee0){var _0x5293be=new Buffer(_0x3f3ba5[_0x5b69('0x12')](_0x2a2ee0),_0x5b69('0x13'));_0x26e4b8[_0x5b69('0x14')](_0x5293be);});_0x25652a['on'](_0x5b69('0x15'),function(){try{var _0x139783=new Buffer(_0x3f3ba5['final'](_0x5b69('0x13')),_0x5b69('0x13'));_0x26e4b8[_0x5b69('0x14')](_0x139783);_0x26e4b8['end']();_0x26e4b8['on']('close',function(){return _0x3afd2b(_0x3eba40);});}catch(_0x376233){fs[_0x5b69('0x16')](_0x3eba40);return _0x47a89c(_0x376233);}});});};exports[_0x5b69('0x17')]=function(_0x532e51,_0x2d269e,_0x1850d0,_0x2f9940){return new BPromise(function(_0x527491,_0x5ebcb8){_0x2f9940=combineOptions(_0x2f9940);var _0x3ec19c=new Buffer(_0x1850d0);var _0xf87693=fs[_0x5b69('0xf')](_0x532e51);var _0x2637c4=fs[_0x5b69('0x10')](_0x2d269e);var _0x1bbbc9=crypto[_0x5b69('0x18')](_0x2f9940[_0x5b69('0x7')],_0x3ec19c);_0xf87693['on'](_0x5b69('0x11'),function(_0x282f26){var _0xcb4f52=new Buffer(_0x1bbbc9[_0x5b69('0x12')](_0x282f26),_0x5b69('0x13'));_0x2637c4[_0x5b69('0x14')](_0xcb4f52);});_0xf87693['on'](_0x5b69('0x15'),function(){try{var _0x5b1a2d=new Buffer(_0x1bbbc9[_0x5b69('0x19')](_0x5b69('0x13')),'binary');_0x2637c4[_0x5b69('0x14')](_0x5b1a2d);_0x2637c4[_0x5b69('0x15')]();_0x2637c4['on'](_0x5b69('0x1a'),function(){return _0x527491(_0x2d269e);});}catch(_0x58ae2e){fs[_0x5b69('0x16')](_0x2d269e);return _0x5ebcb8(_0x58ae2e);}});});};exports['encryptString']=function(_0x3dead6,_0x13948d,_0x33c35e){var _0x3413bf=_0x33c35e||stringOptions[_0x5b69('0x7')];var _0x221e65=_0x13948d||stringOptions[_0x5b69('0x1b')];var _0x10600c=crypto['createCipher'](_0x3413bf,_0x221e65);var _0x4de9c2=_0x10600c[_0x5b69('0x12')](_0x3dead6,_0x5b69('0x1c'),_0x5b69('0x1d'));_0x4de9c2+=_0x10600c[_0x5b69('0x19')](_0x5b69('0x1d'));return _0x4de9c2;};exports[_0x5b69('0x1e')]=function(_0xdc327c,_0x71433d,_0x4aac69){var _0x479f20=_0x4aac69||stringOptions['algorithm'];var _0x37c2ad=_0x71433d||stringOptions[_0x5b69('0x1b')];var _0x535892=crypto['createDecipher'](_0x479f20,_0x37c2ad);var _0x3e4317=_0x535892[_0x5b69('0x12')](_0xdc327c,'base64',_0x5b69('0x1c'));_0x3e4317+=_0x535892[_0x5b69('0x19')]('utf8');return _0x3e4317;}; \ No newline at end of file +var _0xc0d7=['update','binary','write','close','unlink','createDecipher','final','end','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data'];(function(_0x4ebbf9,_0x33921c){var _0x21cb48=function(_0x4d1008){while(--_0x4d1008){_0x4ebbf9['push'](_0x4ebbf9['shift']());}};_0x21cb48(++_0x33921c);}(_0xc0d7,0x1e1));var _0x7c0d=function(_0x108759,_0x48d8c4){_0x108759=_0x108759-0x0;var _0x229633=_0xc0d7[_0x108759];return _0x229633;};'use strict';var crypto=require(_0x7c0d('0x0'));var fs=require('fs');var BPromise=require(_0x7c0d('0x1'));var _=require(_0x7c0d('0x2'));var config=require(_0x7c0d('0x3'));var logger=require('../../config/logger')(_0x7c0d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7c0d('0x5')][_0x7c0d('0x6')],'algorithm':_0x7c0d('0x7')};const fileOptions={'algorithm':_0x7c0d('0x8')};if(config[_0x7c0d('0x9')]&&config[_0x7c0d('0x9')][_0x7c0d('0xa')]){var isSupported=isAlgorithmSupported(config[_0x7c0d('0x9')][_0x7c0d('0xa')]);if(isSupported){fileOptions[_0x7c0d('0xa')]=config[_0x7c0d('0x9')][_0x7c0d('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7c0d('0xb')](',\x20');logger[_0x7c0d('0xc')](config[_0x7c0d('0x9')][_0x7c0d('0xa')],_0x7c0d('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x2faca9){return AES_SUPPORTED_RX['test'](_0x2faca9);}function getSupportedCiphers(){return crypto[_0x7c0d('0xe')]()[_0x7c0d('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xd668d8){return getSupportedCiphers()[_0x7c0d('0x10')](_0xd668d8)>-0x1;}function combineOptions(_0x5ae6cf){var _0x4c53fb={};for(var _0xa31749 in fileOptions){if(fileOptions[_0x7c0d('0x11')](_0xa31749)){_0x4c53fb[_0xa31749]=fileOptions[_0xa31749];}}if(_0x5ae6cf){for(var _0x849bb1 in _0x5ae6cf){if(_0x5ae6cf['hasOwnProperty'](_0x849bb1)){_0x4c53fb[_0x849bb1]=_0x5ae6cf[_0x849bb1];}}}return _0x4c53fb;}exports[_0x7c0d('0x12')]=function(_0x4af857,_0x5a4abf,_0x4dcc95,_0x55f1e7){return new BPromise(function(_0x45feba,_0x377859){_0x55f1e7=combineOptions(_0x55f1e7);var _0x53eac3=new Buffer(_0x4dcc95);var _0x4cc8eb=fs[_0x7c0d('0x13')](_0x4af857);var _0x11ee52=fs[_0x7c0d('0x14')](_0x5a4abf);var _0x508f57=crypto[_0x7c0d('0x15')](_0x55f1e7[_0x7c0d('0xa')],_0x53eac3);_0x4cc8eb['on'](_0x7c0d('0x16'),function(_0x56cf54){var _0x5580da=new Buffer(_0x508f57[_0x7c0d('0x17')](_0x56cf54),_0x7c0d('0x18'));_0x11ee52[_0x7c0d('0x19')](_0x5580da);});_0x4cc8eb['on']('end',function(){try{var _0xd17ab4=new Buffer(_0x508f57['final'](_0x7c0d('0x18')),_0x7c0d('0x18'));_0x11ee52[_0x7c0d('0x19')](_0xd17ab4);_0x11ee52['end']();_0x11ee52['on'](_0x7c0d('0x1a'),function(){return _0x45feba(_0x5a4abf);});}catch(_0x219bf4){fs[_0x7c0d('0x1b')](_0x5a4abf);return _0x377859(_0x219bf4);}});});};exports['decryptFile']=function(_0x1d5fdf,_0x1bfd44,_0x2576b9,_0x1a36dc){return new BPromise(function(_0x297310,_0x5696a5){_0x1a36dc=combineOptions(_0x1a36dc);var _0x5abfc4=new Buffer(_0x2576b9);var _0x253768=fs[_0x7c0d('0x13')](_0x1d5fdf);var _0x3c8de6=fs['createWriteStream'](_0x1bfd44);var _0x189641=crypto[_0x7c0d('0x1c')](_0x1a36dc[_0x7c0d('0xa')],_0x5abfc4);_0x253768['on'](_0x7c0d('0x16'),function(_0x18fc7f){var _0x2b053a=new Buffer(_0x189641[_0x7c0d('0x17')](_0x18fc7f),_0x7c0d('0x18'));_0x3c8de6[_0x7c0d('0x19')](_0x2b053a);});_0x253768['on']('end',function(){try{var _0x1fe9e7=new Buffer(_0x189641[_0x7c0d('0x1d')](_0x7c0d('0x18')),_0x7c0d('0x18'));_0x3c8de6[_0x7c0d('0x19')](_0x1fe9e7);_0x3c8de6[_0x7c0d('0x1e')]();_0x3c8de6['on'](_0x7c0d('0x1a'),function(){return _0x297310(_0x1bfd44);});}catch(_0x20d998){fs[_0x7c0d('0x1b')](_0x1bfd44);return _0x5696a5(_0x20d998);}});});};exports[_0x7c0d('0x1f')]=function(_0x13aad4,_0x36348e,_0x3eb82b){var _0x7d1937=_0x3eb82b||stringOptions[_0x7c0d('0xa')];var _0x161dbf=_0x36348e||stringOptions[_0x7c0d('0x20')];var _0x3995c4=crypto[_0x7c0d('0x15')](_0x7d1937,_0x161dbf);var _0x55193a=_0x3995c4[_0x7c0d('0x17')](_0x13aad4,_0x7c0d('0x21'),_0x7c0d('0x22'));_0x55193a+=_0x3995c4['final'](_0x7c0d('0x22'));return _0x55193a;};exports[_0x7c0d('0x23')]=function(_0x3787c3,_0x31142d,_0x4c6ed5){var _0x16bfec=_0x4c6ed5||stringOptions[_0x7c0d('0xa')];var _0x4abacf=_0x31142d||stringOptions[_0x7c0d('0x20')];var _0x42de82=crypto['createDecipher'](_0x16bfec,_0x4abacf);var _0x18f68f=_0x42de82[_0x7c0d('0x17')](_0x3787c3,_0x7c0d('0x22'),'utf8');_0x18f68f+=_0x42de82[_0x7c0d('0x1d')]('utf8');return _0x18f68f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index acc376c..01e7ce9 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 _0xcaa9=['exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','info','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','inspect','Failed','finally'];(function(_0x12387e,_0x4a34f2){var _0x50657c=function(_0x44dfb5){while(--_0x44dfb5){_0x12387e['push'](_0x12387e['shift']());}};_0x50657c(++_0x4a34f2);}(_0xcaa9,0x65));var _0x9caa=function(_0x13a585,_0x3bf10d){_0x13a585=_0x13a585-0x0;var _0x459345=_0xcaa9[_0x13a585];return _0x459345;};'use strict';var util=require(_0x9caa('0x0'));var path=require(_0x9caa('0x1'));var _=require(_0x9caa('0x2'));var csv=require(_0x9caa('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x9caa('0x4'));var rimraf=require(_0x9caa('0x5'));var db=require(_0x9caa('0x6'))['db'];var dbH=require(_0x9caa('0x6'))[_0x9caa('0x7')];var logger=require(_0x9caa('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x9caa('0x9')][0x2]);var QUERY=process[_0x9caa('0x9')][0x3];var PATH=process[_0x9caa('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37f928,_0x982a94){var _0x400b6c={'status':_0x37f928};var _0xb72913={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x982a94){_0x400b6c['savename']=_0x982a94;}return db[_0x9caa('0xa')]['update'](_0x400b6c,_0xb72913);}function main(){var _0x5f46fc=0x1388;var _0x47d24b;logger['info'](util[_0x9caa('0xb')](_0x9caa('0xc'),EXTRACTED_REPORT_ID,_0x9caa('0xd')));return db[_0x9caa('0xe')][_0x9caa('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9caa('0x10'),_0x9caa('0x11')]})[_0x9caa('0x12')](function(_0x5524e6){if(_0x5524e6){_0x47d24b=_0x5524e6;_0x5f46fc=_0x47d24b[_0x9caa('0x11')]||0x1388;}})[_0x9caa('0x12')](function(){return dbH[_0x9caa('0x13')][_0x9caa('0x14')](util[_0x9caa('0xb')](_0x9caa('0x15'),QUERY),{'type':dbH[_0x9caa('0x13')][_0x9caa('0x16')][_0x9caa('0x17')]});})['then'](function(_0xdc3267){if(!_0xdc3267[0x0][_0x9caa('0x18')]){return analyticExtractedReport(_0x9caa('0x19'));}var _0x168a31=[];var _0x5ac9b7=0x0;if(_0x47d24b['split']){if(_0xdc3267&&_0xdc3267[_0x9caa('0x1a')]){var _0x5f13c9=_[_0x9caa('0x1b')](_0xdc3267[0x0][_0x9caa('0x18')]/_0x5f46fc);var _0x5f48f5=Number[_0x9caa('0x1c')](_0xdc3267[0x0][_0x9caa('0x18')]/_0x5f46fc)?_0xdc3267[0x0][_0x9caa('0x18')]%_0x5f46fc:0x0;_0x5f13c9[_0x9caa('0x1d')](function(_0x54fcf1){if(_0x54fcf1>0x0){_0x5ac9b7+=_0x5f46fc;}_0x168a31[_0x9caa('0x1e')](dbH[_0x9caa('0x13')][_0x9caa('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5f46fc,_0x5ac9b7),{'type':dbH[_0x9caa('0x13')][_0x9caa('0x16')]['SELECT']}));});if(_0x5f48f5>0x0){_0x5ac9b7+=_0x5f46fc;_0x168a31[_0x9caa('0x1e')](dbH[_0x9caa('0x13')]['query'](util['format'](_0x9caa('0x1f'),QUERY,_0x5f48f5,_0x5ac9b7),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x168a31['push'](dbH[_0x9caa('0x13')][_0x9caa('0x14')](QUERY,{'type':dbH[_0x9caa('0x13')][_0x9caa('0x16')][_0x9caa('0x17')]}));}var _0x137f50=path['dirname'](PATH);var _0x285ce4=path['basename'](PATH,'.csv');var _0x3884ec=_0x47d24b[_0x9caa('0x10')]&&_0x168a31[_0x9caa('0x1a')]>0x1;var _0x210144=[];if(!fs[_0x9caa('0x20')](path[_0x9caa('0x21')](_0x137f50,_0x285ce4))&&_0x3884ec){fs[_0x9caa('0x22')](path[_0x9caa('0x21')](_0x137f50,_0x285ce4));}return BPromise[_0x9caa('0x23')](_0x168a31,function(_0x92978b){_0x210144[_0x9caa('0x1e')](_0x92978b);})[_0x9caa('0x12')](function(){for(var _0xb8441b=0x0;_0xb8441b<_0x210144['length'];_0xb8441b+=0x1){var _0x2f2af5;var _0x53c7f5=_0x210144[_0xb8441b];if(_0x3884ec){_0x2f2af5=path['join'](_0x137f50,_0x285ce4,util[_0x9caa('0xb')](_0x9caa('0x24'),_0x285ce4,_0xb8441b,'csv'));}else{_0x2f2af5=path[_0x9caa('0x21')](_0x137f50,util[_0x9caa('0xb')](_0x9caa('0x25'),_0x285ce4,_0x9caa('0x26')));}fs[_0x9caa('0x27')](_0x2f2af5,csv(_0x53c7f5));}})['then'](function(){if(_0x3884ec){return new Promise(function(_0x43496d){zipdir(path['join'](_0x137f50,_0x285ce4),{'saveTo':path['join'](_0x137f50,util[_0x9caa('0xb')](_0x9caa('0x25'),_0x285ce4,_0x9caa('0x28')))},function(_0xfe6b3f,_0xa067ec){rimraf(path['join'](_0x137f50,_0x285ce4),function(){});_0x43496d('zip\x20finished');});});}})['then'](function(){logger[_0x9caa('0x29')](util[_0x9caa('0xb')](_0x9caa('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x9caa('0x2b'),_0x3884ec?util[_0x9caa('0xb')](_0x9caa('0x25'),_0x285ce4,_0x3884ec?_0x9caa('0x28'):_0x9caa('0x26')):null);});})[_0x9caa('0x2c')](function(_0x4e67e0){logger['info'](util['format'](_0x9caa('0x2d'),EXTRACTED_REPORT_ID,_0x9caa('0xd')),util[_0x9caa('0x2e')](_0x4e67e0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9caa('0x2f'));})[_0x9caa('0x30')](function(){process[_0x9caa('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4b59=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','length','join','mkdirSync','each','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','range','isInteger','push','SELECT'];(function(_0x4dcfbd,_0x10a2f8){var _0x12c261=function(_0x56420b){while(--_0x56420b){_0x4dcfbd['push'](_0x4dcfbd['shift']());}};_0x12c261(++_0x10a2f8);}(_0x4b59,0x1e6));var _0x94b5=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x4b59[_0x4ee9cd];return _0x328a5b;};'use strict';var util=require(_0x94b5('0x0'));var path=require(_0x94b5('0x1'));var _=require(_0x94b5('0x2'));var csv=require(_0x94b5('0x3'));var fs=require('fs');var BPromise=require(_0x94b5('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x94b5('0x5'))['db'];var dbH=require(_0x94b5('0x5'))[_0x94b5('0x6')];var logger=require(_0x94b5('0x7'))(_0x94b5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x94b5('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x287fe4,_0x4e395a){var _0xef9705={'status':_0x287fe4};var _0x1f7e6a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e395a){_0xef9705[_0x94b5('0xa')]=_0x4e395a;}return db[_0x94b5('0xb')][_0x94b5('0xc')](_0xef9705,_0x1f7e6a);}function main(){var _0x77edbc=0x1388;var _0x2e7ed4;logger[_0x94b5('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x94b5('0xe')));return db[_0x94b5('0xf')][_0x94b5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x94b5('0x11'),_0x94b5('0x12')]})[_0x94b5('0x13')](function(_0x32649f){if(_0x32649f){_0x2e7ed4=_0x32649f;_0x77edbc=_0x2e7ed4[_0x94b5('0x12')]||0x1388;}})[_0x94b5('0x13')](function(){return dbH[_0x94b5('0x14')][_0x94b5('0x15')](util[_0x94b5('0x16')](_0x94b5('0x17'),QUERY),{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')]['SELECT']});})[_0x94b5('0x13')](function(_0x417e38){if(!_0x417e38[0x0][_0x94b5('0x19')]){return analyticExtractedReport(_0x94b5('0x1a'));}var _0x3f132b=[];var _0x5d6b7c=0x0;if(_0x2e7ed4['split']){if(_0x417e38&&_0x417e38['length']){var _0xb114b4=_[_0x94b5('0x1b')](_0x417e38[0x0]['num']/_0x77edbc);var _0x2ac96d=Number[_0x94b5('0x1c')](_0x417e38[0x0][_0x94b5('0x19')]/_0x77edbc)?_0x417e38[0x0][_0x94b5('0x19')]%_0x77edbc:0x0;_0xb114b4['forEach'](function(_0x39ce93){if(_0x39ce93>0x0){_0x5d6b7c+=_0x77edbc;}_0x3f132b[_0x94b5('0x1d')](dbH[_0x94b5('0x14')][_0x94b5('0x15')](util[_0x94b5('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x77edbc,_0x5d6b7c),{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')][_0x94b5('0x1e')]}));});if(_0x2ac96d>0x0){_0x5d6b7c+=_0x77edbc;_0x3f132b[_0x94b5('0x1d')](dbH[_0x94b5('0x14')][_0x94b5('0x15')](util['format'](_0x94b5('0x1f'),QUERY,_0x2ac96d,_0x5d6b7c),{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')]['SELECT']}));}}}else{_0x3f132b[_0x94b5('0x1d')](dbH[_0x94b5('0x14')][_0x94b5('0x15')](QUERY,{'type':dbH[_0x94b5('0x14')][_0x94b5('0x18')][_0x94b5('0x1e')]}));}var _0x487879=path[_0x94b5('0x20')](PATH);var _0x2c1d64=path['basename'](PATH,_0x94b5('0x21'));var _0xedd072=_0x2e7ed4[_0x94b5('0x11')]&&_0x3f132b[_0x94b5('0x22')]>0x1;var _0x546716=[];if(!fs['existsSync'](path[_0x94b5('0x23')](_0x487879,_0x2c1d64))&&_0xedd072){fs[_0x94b5('0x24')](path[_0x94b5('0x23')](_0x487879,_0x2c1d64));}return BPromise[_0x94b5('0x25')](_0x3f132b,function(_0xb2f71d){_0x546716[_0x94b5('0x1d')](_0xb2f71d);})['then'](function(){for(var _0xd6986d=0x0;_0xd6986d<_0x546716[_0x94b5('0x22')];_0xd6986d+=0x1){var _0x5a1b29;var _0x5bbf4e=_0x546716[_0xd6986d];if(_0xedd072){_0x5a1b29=path[_0x94b5('0x23')](_0x487879,_0x2c1d64,util['format']('%s%d.%s',_0x2c1d64,_0xd6986d,_0x94b5('0x26')));}else{_0x5a1b29=path['join'](_0x487879,util['format'](_0x94b5('0x27'),_0x2c1d64,_0x94b5('0x26')));}fs['writeFileSync'](_0x5a1b29,csv(_0x5bbf4e));}})[_0x94b5('0x13')](function(){if(_0xedd072){return new Promise(function(_0x4c92dc){zipdir(path[_0x94b5('0x23')](_0x487879,_0x2c1d64),{'saveTo':path[_0x94b5('0x23')](_0x487879,util['format']('%s.%s',_0x2c1d64,_0x94b5('0x28')))},function(_0x50c3ad,_0x445193){rimraf(path[_0x94b5('0x23')](_0x487879,_0x2c1d64),function(){});_0x4c92dc(_0x94b5('0x29'));});});}})[_0x94b5('0x13')](function(){logger[_0x94b5('0xd')](util['format'](_0x94b5('0x2a'),EXTRACTED_REPORT_ID,_0x94b5('0xe')));return analyticExtractedReport(_0x94b5('0x2b'),_0xedd072?util[_0x94b5('0x16')](_0x94b5('0x27'),_0x2c1d64,_0xedd072?_0x94b5('0x28'):_0x94b5('0x26')):null);});})['catch'](function(_0x11c6fc){logger['info'](util[_0x94b5('0x16')](_0x94b5('0x2c'),EXTRACTED_REPORT_ID,_0x94b5('0xe')),util[_0x94b5('0x2d')](_0x11c6fc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x94b5('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4b407ec..3e1ee74 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 _0x5e9f=['inspect','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','\x20/\x20','footer','black','right','Setting','find','split','splitSizePdf','then','range','isInteger','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','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'];(function(_0x5db8ab,_0x3ab288){var _0x10ddc4=function(_0x37b9dc){while(--_0x37b9dc){_0x5db8ab['push'](_0x5db8ab['shift']());}};_0x10ddc4(++_0x3ab288);}(_0x5e9f,0x12b));var _0xf5e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5e9('0x0'));var fs=require('fs');var util=require(_0xf5e9('0x1'));var path=require(_0xf5e9('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0xf5e9('0x3'));var PdfPrinter=require(_0xf5e9('0x4'));var zipdir=require(_0xf5e9('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xf5e9('0x6'))[_0xf5e9('0x7')];var window=new JSDOM('')[_0xf5e9('0x8')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5e9('0x9')];var logger=require(_0xf5e9('0xa'))(_0xf5e9('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xf5e9('0xc')][0x2]);var QUERY=process[_0xf5e9('0xc')][0x3];var PATH=process[_0xf5e9('0xc')][0x4];var NAME=process[_0xf5e9('0xc')][0x5];var FORMAT=_0xf5e9('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c4175,_0x4e5d08){var _0x5d5936={'status':_0x4c4175};var _0x1895df={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e5d08){_0x5d5936[_0xf5e9('0xe')]=_0x4e5d08;}return db[_0xf5e9('0xf')][_0xf5e9('0x10')](_0x5d5936,_0x1895df);}function getHeaders(_0x5926ff){return _[_0xf5e9('0x11')](_0x5926ff,function(_0x4f8092){return{'text':_0x4f8092,'style':'tableHeader'};});}function getRows(_0x29547b,_0x1cd86c){return _[_0xf5e9('0x11')](_0x1cd86c,function(_0xd3ac9f){return _(_0xd3ac9f)[_0xf5e9('0x12')](_0x29547b)[_0xf5e9('0x11')](function(_0x311bf3){return _0x311bf3?_[_0xf5e9('0x13')](_0x311bf3):'';})[_0xf5e9('0x14')]();});}function createTable(_0x462692,_0x17719b){var _0x515cda={'widths':_[_0xf5e9('0x15')](Array(_0x462692[_0xf5e9('0x16')]),0x91),'heights':function(_0x3133ac){return _0x3133ac===0x0?_0xf5e9('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x147251=getHeaders(_0x462692);_0x515cda['body'][_0xf5e9('0x18')](_0x147251);var _0x30173e=getRows(_0x462692,_0x17719b);_0x515cda['body']=_0x515cda[_0xf5e9('0x19')][_0xf5e9('0x1a')](_0x30173e);return _0x515cda;}function createTables(_0x4bbce3){var _0x55121b=[];var _0x3743a3=_[_0xf5e9('0x1b')](Object[_0xf5e9('0x1c')](_0x4bbce3[0x0]),0x5);_0x3743a3[_0xf5e9('0x1d')](function(_0x148924){_0x55121b[_0xf5e9('0x18')](createTable(_0x148924,_0x4bbce3));});return _0x55121b;}function getPDFDocDefinition(_0xcbe526){var _0x501bc9=util[_0xf5e9('0x1e')](_0xf5e9('0x1f'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xf5e9('0x20')])[_0xf5e9('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xf5e9('0x21')])['format'](FORMAT));var _0x12c6f9=[];for(var _0x1d9386=0x0;_0x1d9386<_0xcbe526[_0xf5e9('0x16')];_0x1d9386++){var _0x200fc3=[];if(_0x1d9386===0x0){_0x200fc3[_0xf5e9('0x18')]({'text':_0x501bc9,'style':_0xf5e9('0x22')});}var _0x28d4bc={'table':_0xcbe526[_0x1d9386]};if(_0x1d9386>0x0){_0x28d4bc[_0xf5e9('0x23')]=_0xf5e9('0x24');_0x28d4bc[_0xf5e9('0x25')]=[0x0,0x46,0x0,0x0];}_0x200fc3['push'](_0x28d4bc);_0x12c6f9['push'](_0x200fc3);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x12c6f9,'footer':function(_0x4b4da1,_0x4d969e){return{'text':_0x4b4da1[_0xf5e9('0x13')]()+_0xf5e9('0x26')+_0x4d969e,'style':_0xf5e9('0x27')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xf5e9('0x28')},'footer':{'alignment':_0xf5e9('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x32184c){var _0x455733=0x1388;var _0x1af884;if(!_0x32184c[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xf5e9('0x2a')][_0xf5e9('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5e9('0x2c'),_0xf5e9('0x2d')]})['then'](function(_0x2e4f2a){if(_0x2e4f2a){_0x1af884=_0x2e4f2a;_0x455733=_0x1af884[_0xf5e9('0x2d')]||0x3e8;}})[_0xf5e9('0x2e')](function(){var _0x229d17=[];var _0x2c59b8=0x0;if(_0x1af884['split']){if(_0x32184c&&_0x32184c['length']){var _0x602eac=_[_0xf5e9('0x2f')](_0x32184c[0x0]['num']/_0x455733);var _0x171923=Number[_0xf5e9('0x30')](_0x32184c[0x0][_0xf5e9('0x31')]/_0x455733)?_0x32184c[0x0][_0xf5e9('0x31')]%_0x455733:0x0;_0x602eac['forEach'](function(_0x2c40ce){if(_0x2c40ce>0x0){_0x2c59b8+=_0x455733;}_0x229d17[_0xf5e9('0x18')](dbH[_0xf5e9('0x32')][_0xf5e9('0x33')](util[_0xf5e9('0x1e')](_0xf5e9('0x34'),QUERY,_0x455733,_0x2c59b8),{'type':dbH['sequelize'][_0xf5e9('0x35')][_0xf5e9('0x36')]}));});if(_0x171923>0x0){_0x2c59b8+=_0x455733;_0x229d17['push'](dbH['sequelize'][_0xf5e9('0x33')](util[_0xf5e9('0x1e')](_0xf5e9('0x34'),QUERY,_0x171923,_0x2c59b8),{'type':dbH['sequelize'][_0xf5e9('0x35')]['SELECT']}));}}}else{_0x229d17[_0xf5e9('0x18')](dbH['sequelize'][_0xf5e9('0x33')](QUERY,{'type':dbH['sequelize'][_0xf5e9('0x35')][_0xf5e9('0x36')]}));}var _0x36fe90=path[_0xf5e9('0x37')](PATH);var _0x442cee=path[_0xf5e9('0x38')](PATH,_0xf5e9('0x39'));var _0x13bd87=_0x1af884[_0xf5e9('0x2c')]&&_0x229d17[_0xf5e9('0x16')]>0x1;var _0x5a00f4=[];if(!fs[_0xf5e9('0x3a')](path[_0xf5e9('0x3b')](_0x36fe90,_0x442cee))&&_0x13bd87){fs[_0xf5e9('0x3c')](path[_0xf5e9('0x3b')](_0x36fe90,_0x442cee));}return BPromise[_0xf5e9('0x3d')](_0x229d17,function(_0x893313){_0x5a00f4[_0xf5e9('0x18')](_0x893313);})[_0xf5e9('0x2e')](function(){var _0x49406b=[];for(var _0x15600d=0x0;_0x15600d<_0x5a00f4[_0xf5e9('0x16')];_0x15600d+=0x1){var _0x1562b4=_0x5a00f4[_0x15600d];var _0x4b9dc0=createTables(_[_0xf5e9('0x3e')](_0x1562b4));var _0x1b41cc;var _0x15ea75=getPDFDocDefinition(_0x4b9dc0);var _0x52fe2f=getPDFPrinter();var _0x46cf29=_0x52fe2f[_0xf5e9('0x3f')](_0x15ea75);if(_0x13bd87){_0x1b41cc=path[_0xf5e9('0x3b')](_0x36fe90,_0x442cee,util['format'](_0xf5e9('0x40'),_0x442cee,_0x15600d,'pdf'));}else{_0x1b41cc=path[_0xf5e9('0x3b')](_0x36fe90,util[_0xf5e9('0x1e')]('%s.%s',_0x442cee,_0xf5e9('0x41')));}_0x49406b['push'](writePDFDocument(_0x46cf29,_0x1b41cc));}return Promise[_0xf5e9('0x42')](_0x49406b);})[_0xf5e9('0x2e')](function(){if(_0x13bd87){return new Promise(function(_0x244545){zipdir(path[_0xf5e9('0x3b')](_0x36fe90,_0x442cee),{'saveTo':path[_0xf5e9('0x3b')](_0x36fe90,util[_0xf5e9('0x1e')](_0xf5e9('0x43'),_0x442cee,_0xf5e9('0x44')))},function(){rimraf(path[_0xf5e9('0x3b')](_0x36fe90,_0x442cee),function(){});_0x244545('zip\x20finished');});});}})[_0xf5e9('0x2e')](function(){if(!_0x13bd87)return;rimraf(path[_0xf5e9('0x3b')](_0x36fe90,_0x442cee),function(){});})['then'](function(){logger[_0xf5e9('0x45')](util['format'](_0xf5e9('0x46'),EXTRACTED_REPORT_ID,_0xf5e9('0x47')));return analyticExtractedReport('Completed',_0x13bd87?util[_0xf5e9('0x1e')](_0xf5e9('0x43'),_0x442cee,_0x13bd87?_0xf5e9('0x44'):_0xf5e9('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf5e9('0x45')](util[_0xf5e9('0x1e')](_0xf5e9('0x48'),EXTRACTED_REPORT_ID,_0xf5e9('0x47')));return db[_0xf5e9('0xf')][_0xf5e9('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5e9('0x2e')](function(_0x4798ae){EXTRACTED_REPORT=_0x4798ae;return dbH['sequelize'][_0xf5e9('0x33')](util[_0xf5e9('0x1e')](_0xf5e9('0x4a'),QUERY),{'type':dbH[_0xf5e9('0x32')][_0xf5e9('0x35')][_0xf5e9('0x36')]});})['then'](extractReport)[_0xf5e9('0x4b')](function(_0x460fc1){logger['info'](util[_0xf5e9('0x1e')](_0xf5e9('0x4c'),EXTRACTED_REPORT_ID,_0xf5e9('0x47')),util[_0xf5e9('0x4d')](_0x460fc1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xf5e9('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x276c11=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xf5e9('0x4f'),'italics':__dirname+_0xf5e9('0x50'),'bolditalics':__dirname+_0xf5e9('0x51')}});return _0x276c11;}function getPDFDocDefinitionFromHTML(_0x56e468,_0x38b2cf){var _0x4f4b3d=util[_0xf5e9('0x1e')]('%s\x20#%d',_0x38b2cf[_0xf5e9('0x52')],_0x38b2cf[_0xf5e9('0x53')]);var _0xa80cdd=moment()[_0xf5e9('0x1e')](_0xf5e9('0x54'))[_0xf5e9('0x13')]();var _0x3c2d59=htmlToPdfmake(_0x56e468,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3c2d59],'defaultStyle':{'font':_0xf5e9('0x55')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf5e9('0x56'),'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':_0xf5e9('0x56')}},'header':function(){return[{'text':_0xf5e9('0x57'),'style':_0xf5e9('0x22')}];},'footer':function(_0x572670,_0x2d5b59){return[{'text':util[_0xf5e9('0x1e')](_0xf5e9('0x58'),_0x4f4b3d,_0x572670,_0x2d5b59,_0xa80cdd),'style':_0xf5e9('0x27')}];}};}function writePDFDocument(_0x4373b0,_0x45eb58){return new Promise(function(_0x4206e3,_0x25aace){var _0x452bfd=_0x4373b0[_0xf5e9('0x59')](fs[_0xf5e9('0x5a')](_0x45eb58));_0x452bfd['on']('finish',function(){_0x4206e3('finish');});_0x452bfd['on'](_0xf5e9('0x5b'),function(_0x6dbeb5){_0x25aace(_0x6dbeb5);});_0x4373b0[_0xf5e9('0x5c')]();});}exports[_0xf5e9('0x5d')]=function(_0x1732aa,_0x5c0130){var _0x68955f=getPDFPrinter();var _0x6e66b0=getPDFDocDefinitionFromHTML(_0x1732aa,_0x5c0130);var _0x4d75b7=_0x68955f['createPdfKitDocument'](_0x6e66b0);return writePDFDocument(_0x4d75b7,_0x5c0130[_0xf5e9('0x2')])[_0xf5e9('0x4b')](function(_0x43cf4d){throw _0x43cf4d;});}; \ No newline at end of file +var _0x2b97=['auto','body','push','concat','chunk','keys','forEach','format','startDate','endDate','header','pageBreak','before','landscape','toString','footer','Arial','black','num','Empty','find','split','splitSizePdf','then','range','isInteger','sequelize','QueryTypes','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','info','PDF','Completed','pdf','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','Failed','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','value','length'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x2b97,0x1df));var _0x72b9=function(_0x45a2a6,_0x1291f0){_0x45a2a6=_0x45a2a6-0x0;var _0x3d848d=_0x2b97[_0x45a2a6];return _0x3d848d;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x72b9('0x0'));var moment=require(_0x72b9('0x1'));var htmlToPdfmake=require(_0x72b9('0x2'));var PdfPrinter=require(_0x72b9('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x72b9('0x4'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x72b9('0x5')];var BPromise=require(_0x72b9('0x6'));var db=require(_0x72b9('0x7'))['db'];var dbH=require(_0x72b9('0x7'))[_0x72b9('0x8')];var logger=require('../../config/logger')(_0x72b9('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x72b9('0xa')][0x2]);var QUERY=process[_0x72b9('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x72b9('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b06df,_0x277972){var _0x491834={'status':_0x2b06df};var _0x24c94a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x277972){_0x491834[_0x72b9('0xc')]=_0x277972;}return db[_0x72b9('0xd')]['update'](_0x491834,_0x24c94a);}function getHeaders(_0x4a9a3b){return _[_0x72b9('0xe')](_0x4a9a3b,function(_0x1b2712){return{'text':_0x1b2712,'style':_0x72b9('0xf')};});}function getRows(_0x4ad8f3,_0x5ccd7c){return _[_0x72b9('0xe')](_0x5ccd7c,function(_0x438938){return _(_0x438938)[_0x72b9('0x10')](_0x4ad8f3)['map'](function(_0x4d599d){return _0x4d599d?_['toString'](_0x4d599d):'';})[_0x72b9('0x11')]();});}function createTable(_0x429e92,_0x2f0b8b){var _0x2a7a6c={'widths':_['fill'](Array(_0x429e92[_0x72b9('0x12')]),0x91),'heights':function(_0x2635eb){return _0x2635eb===0x0?_0x72b9('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2ae008=getHeaders(_0x429e92);_0x2a7a6c[_0x72b9('0x14')][_0x72b9('0x15')](_0x2ae008);var _0x53af44=getRows(_0x429e92,_0x2f0b8b);_0x2a7a6c[_0x72b9('0x14')]=_0x2a7a6c['body'][_0x72b9('0x16')](_0x53af44);return _0x2a7a6c;}function createTables(_0x46679e){var _0xf20b9e=[];var _0x2813ee=_[_0x72b9('0x17')](Object[_0x72b9('0x18')](_0x46679e[0x0]),0x5);_0x2813ee[_0x72b9('0x19')](function(_0x546d2a){_0xf20b9e[_0x72b9('0x15')](createTable(_0x546d2a,_0x46679e));});return _0xf20b9e;}function getPDFDocDefinition(_0x5e917f){var _0x358e1b=util[_0x72b9('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x72b9('0x1b')])[_0x72b9('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x72b9('0x1c')])[_0x72b9('0x1a')](FORMAT));var _0x35e78d=[];for(var _0x392d8d=0x0;_0x392d8d<_0x5e917f[_0x72b9('0x12')];_0x392d8d++){var _0x440448=[];if(_0x392d8d===0x0){_0x440448['push']({'text':_0x358e1b,'style':_0x72b9('0x1d')});}var _0x2464d0={'table':_0x5e917f[_0x392d8d]};if(_0x392d8d>0x0){_0x2464d0[_0x72b9('0x1e')]=_0x72b9('0x1f');_0x2464d0['margin']=[0x0,0x46,0x0,0x0];}_0x440448[_0x72b9('0x15')](_0x2464d0);_0x35e78d[_0x72b9('0x15')](_0x440448);}return{'pageSize':'A4','pageOrientation':_0x72b9('0x20'),'content':_0x35e78d,'footer':function(_0x42a141,_0x8e34f2){return{'text':_0x42a141[_0x72b9('0x21')]()+'\x20/\x20'+_0x8e34f2,'style':_0x72b9('0x22')};},'defaultStyle':{'font':_0x72b9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x72b9('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1aafe0){var _0x25b69c=0x1388;var _0x250f3a;if(!_0x1aafe0[0x0][_0x72b9('0x25')]){return analyticExtractedReport(_0x72b9('0x26'));}return db['Setting'][_0x72b9('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x72b9('0x28'),_0x72b9('0x29')]})[_0x72b9('0x2a')](function(_0x415da2){if(_0x415da2){_0x250f3a=_0x415da2;_0x25b69c=_0x250f3a[_0x72b9('0x29')]||0x3e8;}})[_0x72b9('0x2a')](function(){var _0x314ae1=[];var _0xc1166c=0x0;if(_0x250f3a[_0x72b9('0x28')]){if(_0x1aafe0&&_0x1aafe0[_0x72b9('0x12')]){var _0x2b6ab1=_[_0x72b9('0x2b')](_0x1aafe0[0x0][_0x72b9('0x25')]/_0x25b69c);var _0x5c304f=Number[_0x72b9('0x2c')](_0x1aafe0[0x0][_0x72b9('0x25')]/_0x25b69c)?_0x1aafe0[0x0][_0x72b9('0x25')]%_0x25b69c:0x0;_0x2b6ab1[_0x72b9('0x19')](function(_0x5766d8){if(_0x5766d8>0x0){_0xc1166c+=_0x25b69c;}_0x314ae1[_0x72b9('0x15')](dbH[_0x72b9('0x2d')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x25b69c,_0xc1166c),{'type':dbH[_0x72b9('0x2d')][_0x72b9('0x2e')]['SELECT']}));});if(_0x5c304f>0x0){_0xc1166c+=_0x25b69c;_0x314ae1[_0x72b9('0x15')](dbH[_0x72b9('0x2d')][_0x72b9('0x2f')](util[_0x72b9('0x1a')](_0x72b9('0x30'),QUERY,_0x5c304f,_0xc1166c),{'type':dbH['sequelize']['QueryTypes'][_0x72b9('0x31')]}));}}}else{_0x314ae1[_0x72b9('0x15')](dbH[_0x72b9('0x2d')][_0x72b9('0x2f')](QUERY,{'type':dbH[_0x72b9('0x2d')][_0x72b9('0x2e')][_0x72b9('0x31')]}));}var _0x54e4c6=path[_0x72b9('0x32')](PATH);var _0x58f70e=path['basename'](PATH,_0x72b9('0x33'));var _0x56e4c=_0x250f3a[_0x72b9('0x28')]&&_0x314ae1[_0x72b9('0x12')]>0x1;var _0x54710d=[];if(!fs[_0x72b9('0x34')](path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e))&&_0x56e4c){fs[_0x72b9('0x36')](path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e));}return BPromise[_0x72b9('0x37')](_0x314ae1,function(_0x5b8740){_0x54710d[_0x72b9('0x15')](_0x5b8740);})['then'](function(){var _0x37b85d=[];for(var _0x2a8454=0x0;_0x2a8454<_0x54710d[_0x72b9('0x12')];_0x2a8454+=0x1){var _0x1e8f91=_0x54710d[_0x2a8454];var _0x1a7587=createTables(_[_0x72b9('0x38')](_0x1e8f91));var _0x3882a9;var _0x26cff1=getPDFDocDefinition(_0x1a7587);var _0x3a9580=getPDFPrinter();var _0x3ac994=_0x3a9580[_0x72b9('0x39')](_0x26cff1);if(_0x56e4c){_0x3882a9=path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e,util[_0x72b9('0x1a')](_0x72b9('0x3a'),_0x58f70e,_0x2a8454,'pdf'));}else{_0x3882a9=path[_0x72b9('0x35')](_0x54e4c6,util['format'](_0x72b9('0x3b'),_0x58f70e,'pdf'));}_0x37b85d[_0x72b9('0x15')](writePDFDocument(_0x3ac994,_0x3882a9));}return Promise[_0x72b9('0x3c')](_0x37b85d);})[_0x72b9('0x2a')](function(){if(_0x56e4c){return new Promise(function(_0x1962a0){zipdir(path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e),{'saveTo':path[_0x72b9('0x35')](_0x54e4c6,util['format'](_0x72b9('0x3b'),_0x58f70e,_0x72b9('0x3d')))},function(){rimraf(path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e),function(){});_0x1962a0('zip\x20finished');});});}})['then'](function(){if(!_0x56e4c)return;rimraf(path[_0x72b9('0x35')](_0x54e4c6,_0x58f70e),function(){});})[_0x72b9('0x2a')](function(){logger[_0x72b9('0x3e')](util[_0x72b9('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x72b9('0x3f')));return analyticExtractedReport(_0x72b9('0x40'),_0x56e4c?util['format'](_0x72b9('0x3b'),_0x58f70e,_0x56e4c?_0x72b9('0x3d'):_0x72b9('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x72b9('0x3e')](util[_0x72b9('0x1a')](_0x72b9('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x72b9('0xd')][_0x72b9('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x72b9('0x2a')](function(_0xee61b6){EXTRACTED_REPORT=_0xee61b6;return dbH[_0x72b9('0x2d')][_0x72b9('0x2f')](util[_0x72b9('0x1a')](_0x72b9('0x44'),QUERY),{'type':dbH[_0x72b9('0x2d')][_0x72b9('0x2e')]['SELECT']});})[_0x72b9('0x2a')](extractReport)[_0x72b9('0x45')](function(_0x110f80){logger[_0x72b9('0x3e')](util[_0x72b9('0x1a')](_0x72b9('0x46'),EXTRACTED_REPORT_ID,_0x72b9('0x3f')),util['inspect'](_0x110f80,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x72b9('0x47'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x136364=new PdfPrinter({'Arial':{'normal':__dirname+_0x72b9('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x72b9('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x136364;}function getPDFDocDefinitionFromHTML(_0x98eb32,_0x3e1030){var _0x549158=util[_0x72b9('0x1a')]('%s\x20#%d',_0x3e1030['channel'],_0x3e1030[_0x72b9('0x4a')]);var _0x3fe8a2=moment()['format'](_0x72b9('0x4b'))[_0x72b9('0x21')]();var _0x5b8587=htmlToPdfmake(_0x98eb32,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5b8587],'defaultStyle':{'font':_0x72b9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x72b9('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x72b9('0x4c'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x72b9('0x4c')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x72b9('0x1d')}];},'footer':function(_0xca85da,_0x194888){return[{'text':util[_0x72b9('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x549158,_0xca85da,_0x194888,_0x3fe8a2),'style':_0x72b9('0x22')}];}};}function writePDFDocument(_0x2b6383,_0x135797){return new Promise(function(_0x3531ce,_0x60a0d){var _0x4c5054=_0x2b6383[_0x72b9('0x4d')](fs[_0x72b9('0x4e')](_0x135797));_0x4c5054['on'](_0x72b9('0x4f'),function(){_0x3531ce(_0x72b9('0x4f'));});_0x4c5054['on'](_0x72b9('0x50'),function(_0x578113){_0x60a0d(_0x578113);});_0x2b6383[_0x72b9('0x51')]();});}exports[_0x72b9('0x52')]=function(_0x9e47dc,_0x7d2148){var _0x290b01=getPDFPrinter();var _0x29bb67=getPDFDocDefinitionFromHTML(_0x9e47dc,_0x7d2148);var _0x110082=_0x290b01[_0x72b9('0x39')](_0x29bb67);return writePDFDocument(_0x110082,_0x7d2148[_0x72b9('0x0')])[_0x72b9('0x45')](function(_0x4186fc){throw _0x4186fc;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a0ac9bd..ed379bd 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 _0xaa1b=['bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','xlsx','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash'];(function(_0xc838b8,_0x2f4309){var _0x18c0be=function(_0x2d81cd){while(--_0x2d81cd){_0xc838b8['push'](_0xc838b8['shift']());}};_0x18c0be(++_0x2f4309);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xbaa1('0x0'));var path=require(_0xbaa1('0x1'));var _=require(_0xbaa1('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xbaa1('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xbaa1('0x4'));var db=require(_0xbaa1('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xbaa1('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xbaa1('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbaa1('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x56e7ec,_0x364ce9){var _0x15b968={'status':_0x56e7ec};var _0x339e3e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x364ce9){_0x15b968[_0xbaa1('0x8')]=_0x364ce9;}return db[_0xbaa1('0x9')][_0xbaa1('0xa')](_0x15b968,_0x339e3e);}function main(){var _0x4f8933=0x1388;var _0x39b669;logger[_0xbaa1('0xb')](util[_0xbaa1('0xc')](_0xbaa1('0xd'),EXTRACTED_REPORT_ID,_0xbaa1('0xe')));return db[_0xbaa1('0xf')][_0xbaa1('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbaa1('0x11'),_0xbaa1('0x12')]})[_0xbaa1('0x13')](function(_0x8ce72d){if(_0x8ce72d){_0x39b669=_0x8ce72d;_0x4f8933=_0x39b669[_0xbaa1('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util['format'](_0xbaa1('0x14'),QUERY),{'type':dbH[_0xbaa1('0x15')][_0xbaa1('0x16')][_0xbaa1('0x17')]});})[_0xbaa1('0x13')](function(_0x2e7db5){if(!_0x2e7db5[0x0][_0xbaa1('0x18')]){return analyticExtractedReport(_0xbaa1('0x19'));}var _0x35a3fd=[];var _0x2a0c0b=0x0;if(_0x39b669[_0xbaa1('0x11')]){if(_0x2e7db5&&_0x2e7db5[_0xbaa1('0x1a')]){var _0x449dfc=_[_0xbaa1('0x1b')](_0x2e7db5[0x0][_0xbaa1('0x18')]/_0x4f8933);var _0x155a16=Number[_0xbaa1('0x1c')](_0x2e7db5[0x0][_0xbaa1('0x18')]/_0x4f8933)?_0x2e7db5[0x0][_0xbaa1('0x18')]%_0x4f8933:0x0;_0x449dfc['forEach'](function(_0x10bfd3){if(_0x10bfd3>0x0){_0x2a0c0b+=_0x4f8933;}_0x35a3fd[_0xbaa1('0x1d')](dbH[_0xbaa1('0x15')][_0xbaa1('0x1e')](util[_0xbaa1('0xc')](_0xbaa1('0x1f'),QUERY,_0x4f8933,_0x2a0c0b),{'type':dbH['sequelize'][_0xbaa1('0x16')][_0xbaa1('0x17')]}));});if(_0x155a16>0x0){_0x2a0c0b+=_0x4f8933;_0x35a3fd[_0xbaa1('0x1d')](dbH[_0xbaa1('0x15')][_0xbaa1('0x1e')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x155a16,_0x2a0c0b),{'type':dbH[_0xbaa1('0x15')][_0xbaa1('0x16')][_0xbaa1('0x17')]}));}}}else{_0x35a3fd[_0xbaa1('0x1d')](dbH[_0xbaa1('0x15')][_0xbaa1('0x1e')](QUERY,{'type':dbH['sequelize'][_0xbaa1('0x16')][_0xbaa1('0x17')]}));}var _0x28e508=path[_0xbaa1('0x20')](PATH);var _0x1204f4=path[_0xbaa1('0x21')](PATH,_0xbaa1('0x22'));var _0x2d208e=_0x39b669[_0xbaa1('0x11')]&&_0x35a3fd['length']>0x1;var _0x2b80a4=[];if(!fs[_0xbaa1('0x23')](path[_0xbaa1('0x24')](_0x28e508,_0x1204f4))&&_0x2d208e){fs[_0xbaa1('0x25')](path[_0xbaa1('0x24')](_0x28e508,_0x1204f4));}return BPromise[_0xbaa1('0x26')](_0x35a3fd,function(_0x594578){_0x2b80a4['push'](_0x594578);})[_0xbaa1('0x13')](function(){for(var _0x1e1869=0x0;_0x1e1869<_0x2b80a4[_0xbaa1('0x1a')];_0x1e1869+=0x1){var _0x48cbc0;var _0xf3ff18=_0x2b80a4[_0x1e1869];if(_0x2d208e){_0x48cbc0=path[_0xbaa1('0x24')](_0x28e508,_0x1204f4,util['format'](_0xbaa1('0x27'),_0x1204f4,_0x1e1869,'xlsx'));}else{_0x48cbc0=path[_0xbaa1('0x24')](_0x28e508,util[_0xbaa1('0xc')](_0xbaa1('0x28'),_0x1204f4,'xlsx'));}fs['writeFileSync'](_0x48cbc0,json2xls(_0xf3ff18),_0xbaa1('0x29'));}})[_0xbaa1('0x13')](function(){if(_0x2d208e){return new Promise(function(_0x279b72){zipdir(path[_0xbaa1('0x24')](_0x28e508,_0x1204f4),{'saveTo':path[_0xbaa1('0x24')](_0x28e508,util[_0xbaa1('0xc')]('%s.%s',_0x1204f4,_0xbaa1('0x2a')))},function(_0xe4036e,_0x2cfabc){rimraf(path[_0xbaa1('0x24')](_0x28e508,_0x1204f4),function(){});_0x279b72('zip\x20finished');});});}})[_0xbaa1('0x13')](function(){logger['info'](util[_0xbaa1('0xc')](_0xbaa1('0x2b'),EXTRACTED_REPORT_ID,_0xbaa1('0xe')));return analyticExtractedReport(_0xbaa1('0x2c'),_0x2d208e?util['format'](_0xbaa1('0x28'),_0x1204f4,_0x2d208e?_0xbaa1('0x2a'):_0xbaa1('0x2d')):null);});})['catch'](function(_0x38eeb4){logger[_0xbaa1('0xb')](util['format'](_0xbaa1('0x2e'),EXTRACTED_REPORT_ID,_0xbaa1('0xe')),util[_0xbaa1('0x2f')](_0x38eeb4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xbaa1('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0e5b=['writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','Failed','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','split','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx'];(function(_0x26c802,_0x204b2a){var _0x266dd1=function(_0x307b91){while(--_0x307b91){_0x26c802['push'](_0x26c802['shift']());}};_0x266dd1(++_0x204b2a);}(_0x0e5b,0x9d));var _0xb0e5=function(_0x4eb1b5,_0x44a3c5){_0x4eb1b5=_0x4eb1b5-0x0;var _0x341cf7=_0x0e5b[_0x4eb1b5];return _0x341cf7;};'use strict';var util=require('util');var path=require(_0xb0e5('0x0'));var _=require(_0xb0e5('0x1'));var fs=require('fs');var json2xls=require(_0xb0e5('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xb0e5('0x3'));var rimraf=require(_0xb0e5('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb0e5('0x5'))[_0xb0e5('0x6')];var logger=require(_0xb0e5('0x7'))(_0xb0e5('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb0e5('0x9')][0x3];var PATH=process[_0xb0e5('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52b427,_0x2109a7){var _0x86616d={'status':_0x52b427};var _0x559a09={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2109a7){_0x86616d['savename']=_0x2109a7;}return db['AnalyticExtractedReport'][_0xb0e5('0xa')](_0x86616d,_0x559a09);}function main(){var _0x122612=0x1388;var _0x1847da;logger[_0xb0e5('0xb')](util[_0xb0e5('0xc')](_0xb0e5('0xd'),EXTRACTED_REPORT_ID,_0xb0e5('0xe')));return db[_0xb0e5('0xf')][_0xb0e5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb0e5('0x11')]})[_0xb0e5('0x12')](function(_0x32e3cd){if(_0x32e3cd){_0x1847da=_0x32e3cd;_0x122612=_0x1847da['splitSizeXlsx']||0x1388;}})[_0xb0e5('0x12')](function(){return dbH[_0xb0e5('0x13')][_0xb0e5('0x14')](util[_0xb0e5('0xc')](_0xb0e5('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xb0e5('0x12')](function(_0x57171e){if(!_0x57171e[0x0][_0xb0e5('0x16')]){return analyticExtractedReport('Empty');}var _0x4a76b2=[];var _0x184443=0x0;if(_0x1847da[_0xb0e5('0x17')]){if(_0x57171e&&_0x57171e[_0xb0e5('0x18')]){var _0x3e6368=_[_0xb0e5('0x19')](_0x57171e[0x0]['num']/_0x122612);var _0x4dafbf=Number['isInteger'](_0x57171e[0x0][_0xb0e5('0x16')]/_0x122612)?_0x57171e[0x0]['num']%_0x122612:0x0;_0x3e6368['forEach'](function(_0x1a6b46){if(_0x1a6b46>0x0){_0x184443+=_0x122612;}_0x4a76b2[_0xb0e5('0x1a')](dbH[_0xb0e5('0x13')][_0xb0e5('0x14')](util['format'](_0xb0e5('0x1b'),QUERY,_0x122612,_0x184443),{'type':dbH[_0xb0e5('0x13')]['QueryTypes'][_0xb0e5('0x1c')]}));});if(_0x4dafbf>0x0){_0x184443+=_0x122612;_0x4a76b2[_0xb0e5('0x1a')](dbH[_0xb0e5('0x13')][_0xb0e5('0x14')](util['format'](_0xb0e5('0x1b'),QUERY,_0x4dafbf,_0x184443),{'type':dbH[_0xb0e5('0x13')][_0xb0e5('0x1d')][_0xb0e5('0x1c')]}));}}}else{_0x4a76b2[_0xb0e5('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xb0e5('0x13')]['QueryTypes'][_0xb0e5('0x1c')]}));}var _0x452bfc=path[_0xb0e5('0x1e')](PATH);var _0xec456e=path[_0xb0e5('0x1f')](PATH,_0xb0e5('0x20'));var _0x1650ff=_0x1847da['split']&&_0x4a76b2['length']>0x1;var _0x17ee8f=[];if(!fs[_0xb0e5('0x21')](path[_0xb0e5('0x22')](_0x452bfc,_0xec456e))&&_0x1650ff){fs[_0xb0e5('0x23')](path[_0xb0e5('0x22')](_0x452bfc,_0xec456e));}return BPromise[_0xb0e5('0x24')](_0x4a76b2,function(_0x560f84){_0x17ee8f[_0xb0e5('0x1a')](_0x560f84);})[_0xb0e5('0x12')](function(){for(var _0xa8abfd=0x0;_0xa8abfd<_0x17ee8f[_0xb0e5('0x18')];_0xa8abfd+=0x1){var _0x2dd470;var _0x33900b=_0x17ee8f[_0xa8abfd];if(_0x1650ff){_0x2dd470=path[_0xb0e5('0x22')](_0x452bfc,_0xec456e,util[_0xb0e5('0xc')](_0xb0e5('0x25'),_0xec456e,_0xa8abfd,'xlsx'));}else{_0x2dd470=path[_0xb0e5('0x22')](_0x452bfc,util[_0xb0e5('0xc')]('%s.%s',_0xec456e,_0xb0e5('0x26')));}fs[_0xb0e5('0x27')](_0x2dd470,json2xls(_0x33900b),_0xb0e5('0x28'));}})[_0xb0e5('0x12')](function(){if(_0x1650ff){return new Promise(function(_0x2d5836){zipdir(path[_0xb0e5('0x22')](_0x452bfc,_0xec456e),{'saveTo':path[_0xb0e5('0x22')](_0x452bfc,util[_0xb0e5('0xc')]('%s.%s',_0xec456e,_0xb0e5('0x29')))},function(_0x1631b6,_0x5b2a73){rimraf(path[_0xb0e5('0x22')](_0x452bfc,_0xec456e),function(){});_0x2d5836(_0xb0e5('0x2a'));});});}})[_0xb0e5('0x12')](function(){logger[_0xb0e5('0xb')](util['format'](_0xb0e5('0x2b'),EXTRACTED_REPORT_ID,_0xb0e5('0xe')));return analyticExtractedReport(_0xb0e5('0x2c'),_0x1650ff?util['format'](_0xb0e5('0x2d'),_0xec456e,_0x1650ff?'zip':_0xb0e5('0x26')):null);});})['catch'](function(_0x4a710c){logger[_0xb0e5('0xb')](util[_0xb0e5('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb0e5('0xe')),util['inspect'](_0x4a710c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb0e5('0x2e'));})[_0xb0e5('0x2f')](function(){process[_0xb0e5('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 18c1797..4f2a75e 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 _0x5cc8=['updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','util','then','intervals','models','findAll','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','priority','extensions','extension','find','push','type','Set','format','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x1e4e40,_0x4ea87d){var _0x5e93fa=function(_0xc08b86){while(--_0xc08b86){_0x1e4e40['push'](_0x1e4e40['shift']());}};_0x5e93fa(++_0x4ea87d);}(_0x5cc8,0x183));var _0x85cc=function(_0x4bee3e,_0x94b87a){_0x4bee3e=_0x4bee3e-0x0;var _0x2749b0=_0x5cc8[_0x4bee3e];return _0x2749b0;};'use strict';var _=require('lodash');var util=require(_0x85cc('0x0'));function rewrite(_0x5ed8a4,_0x32be79){var _0xd98514=this;return _0x5ed8a4['models']['Interval']['findAll']({'raw':!![]})[_0x85cc('0x1')](function(_0x10812){_0xd98514[_0x85cc('0x2')]=_0x10812;return _0x5ed8a4[_0x85cc('0x3')]['VoiceExtension'][_0x85cc('0x4')]({'where':{'IntervalId':_0x32be79[_0x85cc('0x5')]},'raw':!![]});})[_0x85cc('0x1')](function(_0x41fca7){return _0x5ed8a4['models'][_0x85cc('0x6')][_0x85cc('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x85cc('0x7')](_0x41fca7,_0x85cc('0x8')))}},'order':[{'raw':_0x85cc('0x9')}],'raw':!![]});})['then'](function(_0x4935e0){var _0x547ca3=_[_0x85cc('0xa')](_0x4935e0,{'priority':'1'});var _0x57df87=_['filter'](_0x4935e0,{'isApp':0x1});var _0x1d9636=_['groupBy'](_0x57df87,_0x85cc('0x8'));var _0x57cc85=[_0x85cc('0xb'),_0x85cc('0xc')];var _0x456d5b=[];var _0x273acb=[];for(var _0x12a708 in _0x1d9636){if(_0x1d9636['hasOwnProperty'](_0x12a708)){_0xd98514[_0x85cc('0xd')]=0x2;_0xd98514[_0x85cc('0xe')]=[];_0xd98514[_0x85cc('0xf')]=_[_0x85cc('0x10')](_0x547ca3,{'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')]});_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':util[_0x85cc('0x14')]('CDR(type)=%s',_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')]),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0]['VoiceExtensionId']});if(_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')]===_0x85cc('0x16')){_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':'Set','appdata':_0x85cc('0x17')+_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')],'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0]['VoiceExtensionId']});}else if(_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')]===_0x85cc('0x19')){if(_0xd98514[_0x85cc('0xf')]){_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':'Set','appdata':_0x85cc('0x1a')+(_0xd98514[_0x85cc('0xf')]['cutdigits']?'${EXTEN:'+_0xd98514[_0x85cc('0xf')][_0x85cc('0x1b')]+'}':_0x85cc('0x1c')),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514['priority']++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0]['VoiceExtensionId']});}_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0]['type'],'app':_0x85cc('0x13'),'appdata':_0x85cc('0x17')+_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')],'context':_0x1d9636[_0x12a708][0x0]['context'],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0]['VoiceExtensionId']});var _0x58c8dd=_0xd98514['priority']++;_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x1d'),'appdata':_0x85cc('0x1e')+(_0x58c8dd+0x2)+_0x85cc('0x1f')+(_0x58c8dd+0x1)+')','context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0x58c8dd,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});if(_0xd98514['extension']){_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0]['type'],'app':'Set','appdata':_0xd98514['extension'][_0x85cc('0x1b')]?_0x85cc('0x20')+_0xd98514[_0x85cc('0xf')][_0x85cc('0x1b')]+'}':_0x85cc('0x21'),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0]['VoiceExtensionId']});}_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':'outboundrouteid='+_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')],'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0]['exten'],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});if(_0xd98514[_0x85cc('0xf')]&&_0xd98514[_0x85cc('0xf')][_0x85cc('0x22')]('recordingFormat')&&_0xd98514[_0x85cc('0xf')][_0x85cc('0x23')]!==_0x85cc('0x24')){_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});_0xd98514[_0x85cc('0xe')]['push']({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':'Set','appdata':_0x85cc('0x25')+_0xd98514[_0x85cc('0xf')][_0x85cc('0x23')]||_0x85cc('0x26'),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});}}_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':_0x85cc('0x27'),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514['priority']++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0]['VoiceExtensionId']});_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':_0x85cc('0x28'),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514['priority']++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});_0xd98514[_0x85cc('0xe')]['push']({'type':_0x1d9636[_0x12a708][0x0][_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':_0x85cc('0x29'),'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'priority':_0xd98514[_0x85cc('0xd')]++,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});for(var _0x4e78f9=0x0,_0x38fc39=0x0;_0x4e78f9<_0x1d9636[_0x12a708][_0x85cc('0x2a')];_0x4e78f9+=0x1,_0x38fc39=0x0){var _0x5aa228=_0x1d9636[_0x12a708][_0x4e78f9];if(_0x5aa228[_0x85cc('0x12')]){_0x5aa228['type']=_0x5aa228[_0x85cc('0x12')][_0x85cc('0x2b')]();}var _0xf08134=[];var _0x12c4d2=[];delete _0x5aa228['id'];delete _0x5aa228[_0x85cc('0x2c')];delete _0x5aa228[_0x85cc('0x2d')];var _0x4d1cd5=_0x5aa228[_0x85cc('0x2e')]!==_0x85cc('0x2f')?[_0x5aa228['interval']]:_0x5aa228['IntervalId']?_['map'](_[_0x85cc('0xa')](_0xd98514['intervals'],{'IntervalId':_0x5aa228[_0x85cc('0x5')]}),'interval'):[];if(_0x5aa228['hasOwnProperty']('tag')){if(_0x5aa228['tag']&&_0x5aa228[_0x85cc('0x30')]!=='--'){_0xf08134[_0x85cc('0x11')]({'type':_0x5aa228[_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':'CDR(tag)='+_0x5aa228[_0x85cc('0x30')],'context':_0x5aa228[_0x85cc('0x15')],'exten':_0x5aa228[_0x85cc('0x8')],'priority':_0x4d1cd5[_0x85cc('0x2a')]+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228[_0x85cc('0x18')]});}}if(_0x5aa228['type']===_0x85cc('0x19')&&_0x5aa228['hasOwnProperty'](_0x85cc('0x31'))){if(_0x5aa228[_0x85cc('0x31')]){_0xf08134[_0x85cc('0x11')]({'type':_0x5aa228[_0x85cc('0x12')],'app':_0x85cc('0x1d'),'appdata':_0x85cc('0x32')+_0x5aa228['callerID']+')','context':_0x5aa228[_0x85cc('0x15')],'exten':_0x5aa228['exten'],'priority':_0x4d1cd5[_0x85cc('0x2a')]+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228['VoiceExtensionId']});}else{_0xf08134[_0x85cc('0x11')]({'type':_0x5aa228[_0x85cc('0x12')],'app':'ExecIf','appdata':_0x85cc('0x33'),'context':_0x5aa228['context'],'exten':_0x5aa228['exten'],'priority':_0x4d1cd5[_0x85cc('0x2a')]+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228[_0x85cc('0x18')]});}}if(_0x5aa228[_0x85cc('0x22')]('answer')){if(_0x57cc85[_0x85cc('0x34')](_0x5aa228[_0x85cc('0x35')][_0x85cc('0x2b')]())>=0x0&&_0x5aa228[_0x85cc('0x36')]!==_0x85cc('0x37')){if(_0x5aa228[_0x85cc('0x38')]){_0xf08134['push']({'type':_0x5aa228['type'],'app':_0x85cc('0x1d'),'appdata':_0x85cc('0x39'),'context':_0x5aa228[_0x85cc('0x15')],'exten':_0x5aa228[_0x85cc('0x8')],'priority':_0x4d1cd5[_0x85cc('0x2a')]+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228[_0x85cc('0x18')]});_0xf08134[_0x85cc('0x11')]({'type':_0x5aa228['type'],'app':_0x85cc('0x13'),'appdata':_0x85cc('0x3a'),'context':_0x5aa228[_0x85cc('0x15')],'exten':_0x5aa228[_0x85cc('0x8')],'priority':_0x4d1cd5['length']+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228['VoiceExtensionId']});}else{_0xf08134['push']({'type':_0x5aa228[_0x85cc('0x12')],'app':_0x85cc('0x1d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5aa228[_0x85cc('0x15')],'exten':_0x5aa228[_0x85cc('0x8')],'priority':_0x4d1cd5[_0x85cc('0x2a')]+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228[_0x85cc('0x18')]});_0xf08134[_0x85cc('0x11')]({'type':_0x5aa228[_0x85cc('0x12')],'app':_0x85cc('0x13'),'appdata':_0x85cc('0x3b'),'context':_0x5aa228['context'],'exten':_0x5aa228[_0x85cc('0x8')],'priority':_0x4d1cd5[_0x85cc('0x2a')]+_0xd98514[_0x85cc('0xd')]+_0x38fc39++,'VoiceExtensionId':_0x5aa228[_0x85cc('0x18')]});}}}for(var _0x1e3a71=0x0;_0x1e3a71<_0x4d1cd5[_0x85cc('0x2a')];_0x1e3a71+=0x1){var _0x1dcb89=_0xd98514[_0x85cc('0xd')]+_0x4d1cd5[_0x85cc('0x2a')];var _0x142985=_0x1e3a71===_0x4d1cd5[_0x85cc('0x2a')]-0x1?_0xd98514[_0x85cc('0xd')]+_0xf08134[_0x85cc('0x2a')]+_0x12c4d2['length']+0x2:_0xd98514[_0x85cc('0xd')]+_0x1e3a71+0x1;_0xf08134[_0x85cc('0x3c')](_0x1e3a71,0x0,{'type':_0x5aa228[_0x85cc('0x12')],'app':'GotoIfTime','appdata':_0x4d1cd5[_0x1e3a71]+'?'+_0x5aa228[_0x85cc('0x15')]+_0x85cc('0x3d')+_0x1dcb89+':'+_0x5aa228['context']+',${EXTEN},'+_0x142985,'exten':_0x5aa228[_0x85cc('0x8')],'context':_0x5aa228[_0x85cc('0x15')],'priority':_0xd98514[_0x85cc('0xd')]+_0x1e3a71,'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});}_0x5aa228[_0x85cc('0xd')]=_0xf08134[_0x85cc('0x2a')]?_[_0x85cc('0x3e')](_0xf08134)[_0x85cc('0xd')]+0x1:_0xd98514['priority'];_0xd98514[_0x85cc('0xd')]=(_0x12c4d2[_0x85cc('0x2a')]?_[_0x85cc('0x3e')](_0x12c4d2)[_0x85cc('0xd')]:_0x5aa228[_0x85cc('0xd')])+0x1;_0xd98514['extensions']=_[_0x85cc('0x3f')](_0xd98514[_0x85cc('0xe')],_0xf08134,[_0x5aa228],_0x12c4d2);}_0xd98514[_0x85cc('0xe')][_0x85cc('0x11')]({'type':_0x1d9636[_0x12a708][0x0]['type'],'app':_0x85cc('0x40'),'exten':_0x1d9636[_0x12a708][0x0][_0x85cc('0x8')],'context':_0x1d9636[_0x12a708][0x0][_0x85cc('0x15')],'priority':_0xd98514['priority'],'VoiceExtensionId':_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]});_0x456d5b[_0x85cc('0x11')](_0x1d9636[_0x12a708][0x0][_0x85cc('0x18')]);_0x273acb=_[_0x85cc('0x3f')](_0x273acb,_0xd98514[_0x85cc('0xe')]);}}return _0x5ed8a4[_0x85cc('0x41')](function(_0x1afab1){return _0x5ed8a4[_0x85cc('0x3')][_0x85cc('0x6')][_0x85cc('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x456d5b}},'transaction':_0x1afab1})[_0x85cc('0x1')](function(_0x1ee142){return _0x5ed8a4['models'][_0x85cc('0x6')][_0x85cc('0x43')](_[_0x85cc('0x44')](_0x273acb,_0x85cc('0xd')),{'transaction':_0x1afab1});});});})[_0x85cc('0x45')](function(_0x2f5501){console[_0x85cc('0x46')](_0x2f5501);});}exports[_0x85cc('0x47')]=rewrite; \ No newline at end of file +var _0xf0b5=['XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','hasOwnProperty','priority','extension','find','extensions','format','CDR(type)=%s','context','VoiceExtensionId','type','push','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','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)','answer','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress'];(function(_0x2fe977,_0x36c636){var _0x27de25=function(_0x2d394a){while(--_0x2d394a){_0x2fe977['push'](_0x2fe977['shift']());}};_0x27de25(++_0x36c636);}(_0xf0b5,0x19e));var _0x5f0b=function(_0x57b4ed,_0x35a4ab){_0x57b4ed=_0x57b4ed-0x0;var _0x2af230=_0xf0b5[_0x57b4ed];return _0x2af230;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3ad0aa,_0x484b2e){var _0x54ee63=this;return _0x3ad0aa['models'][_0x5f0b('0x0')][_0x5f0b('0x1')]({'raw':!![]})[_0x5f0b('0x2')](function(_0x2dc72d){_0x54ee63[_0x5f0b('0x3')]=_0x2dc72d;return _0x3ad0aa[_0x5f0b('0x4')][_0x5f0b('0x5')]['findAll']({'where':{'IntervalId':_0x484b2e[_0x5f0b('0x6')]},'raw':!![]});})[_0x5f0b('0x2')](function(_0x44dc79){return _0x3ad0aa['models']['VoiceExtension'][_0x5f0b('0x1')]({'where':{'exten':{'$in':_[_0x5f0b('0x7')](_[_0x5f0b('0x8')](_0x44dc79,_0x5f0b('0x9')))}},'order':[{'raw':_0x5f0b('0xa')}],'raw':!![]});})[_0x5f0b('0x2')](function(_0x2d4120){var _0x4032e8=_['filter'](_0x2d4120,{'priority':'1'});var _0x5ab3ab=_['filter'](_0x2d4120,{'isApp':0x1});var _0x5c379e=_[_0x5f0b('0xb')](_0x5ab3ab,_0x5f0b('0x9'));var _0x52deca=['queue','playback'];var _0x18a6ef=[];var _0x32245e=[];for(var _0x5e36fe in _0x5c379e){if(_0x5c379e[_0x5f0b('0xc')](_0x5e36fe)){_0x54ee63[_0x5f0b('0xd')]=0x2;_0x54ee63['extensions']=[];_0x54ee63[_0x5f0b('0xe')]=_[_0x5f0b('0xf')](_0x4032e8,{'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')]});_0x54ee63[_0x5f0b('0x10')]['push']({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':'Set','appdata':util[_0x5f0b('0x11')](_0x5f0b('0x12'),_0x5c379e[_0x5e36fe][0x0]['type']),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});if(_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')]==='inbound'){_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x18')+_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')],'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63['priority']++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0]['VoiceExtensionId']});}else if(_0x5c379e[_0x5e36fe][0x0]['type']===_0x5f0b('0x19')){if(_0x54ee63[_0x5f0b('0xe')]){_0x54ee63[_0x5f0b('0x10')]['push']({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':'Set','appdata':'CDR(destination)='+(_0x54ee63['extension'][_0x5f0b('0x1a')]?'${EXTEN:'+_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x1a')]+'}':_0x5f0b('0x1b')),'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0]['exten'],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x18')+_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')],'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});var _0x32bfb4=_0x54ee63['priority']++;_0x54ee63['extensions'][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x1d')+(_0x32bfb4+0x2)+_0x5f0b('0x1e')+(_0x32bfb4+0x1)+')','context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0]['exten'],'priority':_0x32bfb4,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0]['VoiceExtensionId']});if(_0x54ee63[_0x5f0b('0xe')]){_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':'Set','appdata':_0x54ee63[_0x5f0b('0xe')]['cutdigits']?_0x5f0b('0x1f')+_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x1a')]+'}':'CDR(prefix)=noprefix','context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0]['exten'],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x20')+_0x5c379e[_0x5e36fe][0x0]['VoiceExtensionId'],'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});if(_0x54ee63[_0x5f0b('0xe')]&&_0x54ee63[_0x5f0b('0xe')]['hasOwnProperty'](_0x5f0b('0x21'))&&_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x21')]!=='none'){_0x54ee63['extensions']['push']({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x22'),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63['priority']++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x23')+_0x54ee63[_0x5f0b('0xe')][_0x5f0b('0x21')]||_0x5f0b('0x24'),'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}}_0x54ee63['extensions'][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x25'),'context':_0x5c379e[_0x5e36fe][0x0]['context'],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x54ee63['extensions'][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':'Set','appdata':_0x5f0b('0x26'),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63[_0x5f0b('0xd')]++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0]['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x27'),'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'priority':_0x54ee63['priority']++,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});for(var _0xb04269=0x0,_0xeea35a=0x0;_0xb04269<_0x5c379e[_0x5e36fe]['length'];_0xb04269+=0x1,_0xeea35a=0x0){var _0x2dd323=_0x5c379e[_0x5e36fe][_0xb04269];if(_0x2dd323[_0x5f0b('0x15')]){_0x2dd323['type']=_0x2dd323[_0x5f0b('0x15')][_0x5f0b('0x28')]();}var _0x12ce56=[];var _0x1eeefd=[];delete _0x2dd323['id'];delete _0x2dd323[_0x5f0b('0x29')];delete _0x2dd323[_0x5f0b('0x2a')];var _0x5ede3a=_0x2dd323[_0x5f0b('0x2b')]!==_0x5f0b('0x2c')?[_0x2dd323['interval']]:_0x2dd323[_0x5f0b('0x6')]?_[_0x5f0b('0x8')](_['filter'](_0x54ee63[_0x5f0b('0x3')],{'IntervalId':_0x2dd323[_0x5f0b('0x6')]}),_0x5f0b('0x2b')):[];if(_0x2dd323[_0x5f0b('0xc')](_0x5f0b('0x2d'))){if(_0x2dd323[_0x5f0b('0x2d')]&&_0x2dd323[_0x5f0b('0x2d')]!=='--'){_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x2e')+_0x2dd323[_0x5f0b('0x2d')],'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323['VoiceExtensionId']});}}if(_0x2dd323[_0x5f0b('0x15')]===_0x5f0b('0x19')&&_0x2dd323[_0x5f0b('0xc')](_0x5f0b('0x30'))){if(_0x2dd323[_0x5f0b('0x30')]){_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323['type'],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x31')+_0x2dd323['callerID']+')','context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}else{_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x32'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}}if(_0x2dd323[_0x5f0b('0xc')](_0x5f0b('0x33'))){if(_0x52deca['indexOf'](_0x2dd323['app'][_0x5f0b('0x28')]())>=0x0&&_0x2dd323[_0x5f0b('0x34')]!=='custom'){if(_0x2dd323[_0x5f0b('0x33')]){_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323['type'],'app':_0x5f0b('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323['exten'],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63['priority']+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});_0x12ce56[_0x5f0b('0x16')]({'type':_0x2dd323['type'],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x35'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a[_0x5f0b('0x2f')]+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}else{_0x12ce56['push']({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x1c'),'appdata':_0x5f0b('0x36'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a['length']+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});_0x12ce56['push']({'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x17'),'appdata':_0x5f0b('0x37'),'context':_0x2dd323[_0x5f0b('0x13')],'exten':_0x2dd323[_0x5f0b('0x9')],'priority':_0x5ede3a['length']+_0x54ee63[_0x5f0b('0xd')]+_0xeea35a++,'VoiceExtensionId':_0x2dd323[_0x5f0b('0x14')]});}}}for(var _0x388601=0x0;_0x388601<_0x5ede3a[_0x5f0b('0x2f')];_0x388601+=0x1){var _0x32b44c=_0x54ee63[_0x5f0b('0xd')]+_0x5ede3a['length'];var _0x86580=_0x388601===_0x5ede3a['length']-0x1?_0x54ee63['priority']+_0x12ce56[_0x5f0b('0x2f')]+_0x1eeefd[_0x5f0b('0x2f')]+0x2:_0x54ee63[_0x5f0b('0xd')]+_0x388601+0x1;_0x12ce56['splice'](_0x388601,0x0,{'type':_0x2dd323[_0x5f0b('0x15')],'app':_0x5f0b('0x38'),'appdata':_0x5ede3a[_0x388601]+'?'+_0x2dd323[_0x5f0b('0x13')]+_0x5f0b('0x39')+_0x32b44c+':'+_0x2dd323[_0x5f0b('0x13')]+',${EXTEN},'+_0x86580,'exten':_0x2dd323['exten'],'context':_0x2dd323[_0x5f0b('0x13')],'priority':_0x54ee63[_0x5f0b('0xd')]+_0x388601,'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});}_0x2dd323[_0x5f0b('0xd')]=_0x12ce56[_0x5f0b('0x2f')]?_[_0x5f0b('0x3a')](_0x12ce56)[_0x5f0b('0xd')]+0x1:_0x54ee63[_0x5f0b('0xd')];_0x54ee63['priority']=(_0x1eeefd[_0x5f0b('0x2f')]?_[_0x5f0b('0x3a')](_0x1eeefd)[_0x5f0b('0xd')]:_0x2dd323[_0x5f0b('0xd')])+0x1;_0x54ee63['extensions']=_[_0x5f0b('0x3b')](_0x54ee63[_0x5f0b('0x10')],_0x12ce56,[_0x2dd323],_0x1eeefd);}_0x54ee63[_0x5f0b('0x10')][_0x5f0b('0x16')]({'type':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x15')],'app':_0x5f0b('0x3c'),'exten':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x9')],'context':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x13')],'priority':_0x54ee63['priority'],'VoiceExtensionId':_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]});_0x18a6ef[_0x5f0b('0x16')](_0x5c379e[_0x5e36fe][0x0][_0x5f0b('0x14')]);_0x32245e=_[_0x5f0b('0x3b')](_0x32245e,_0x54ee63['extensions']);}}return _0x3ad0aa[_0x5f0b('0x3d')](function(_0x54d75a){return _0x3ad0aa[_0x5f0b('0x4')][_0x5f0b('0x5')][_0x5f0b('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x18a6ef}},'transaction':_0x54d75a})[_0x5f0b('0x2')](function(_0x4413b2){return _0x3ad0aa[_0x5f0b('0x4')][_0x5f0b('0x5')][_0x5f0b('0x3f')](_[_0x5f0b('0x40')](_0x32245e,_0x5f0b('0xd')),{'transaction':_0x54d75a});});});})[_0x5f0b('0x41')](function(_0xb8b1f8){console[_0x5f0b('0x42')](_0xb8b1f8);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 677825e..f57ec7f 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 _0x5616=['get','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','BlackLists','Lists','always','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','CmContact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList'];(function(_0x5cac4a,_0x35926e){var _0x1e7dbb=function(_0x4ade69){while(--_0x4ade69){_0x5cac4a['push'](_0x5cac4a['shift']());}};_0x1e7dbb(++_0x35926e);}(_0x5616,0x15c));var _0x6561=function(_0x4d94fa,_0x2c0d1e){_0x4d94fa=_0x4d94fa-0x0;var _0x312217=_0x5616[_0x4d94fa];return _0x312217;};'use strict';var BPromise=require(_0x6561('0x0'));var util=require(_0x6561('0x1'));var _=require(_0x6561('0x2'));var fs=require('fs');var squel=require(_0x6561('0x3'));var Papa=require(_0x6561('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x6561('0x5'));var logger=require(_0x6561('0x6'))(_0x6561('0x7'));config[_0x6561('0x8')]=_[_0x6561('0x9')](config[_0x6561('0x8')],{'host':_0x6561('0xa'),'port':0x18eb});var socket=require(_0x6561('0xb'))(new Redis(config[_0x6561('0x8')]));require(_0x6561('0xc'))[_0x6561('0xd')](socket);try{if(!process[_0x6561('0xe')][0x2]||process['argv'][0x2]==='undefined'||process[_0x6561('0xe')][0x2]===_0x6561('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x6561('0xe')][0x2];if(!process[_0x6561('0xe')][0x3]||process['argv'][0x3]===_0x6561('0x10')||process['argv'][0x3]==='null'||!process[_0x6561('0xe')][0x4]||process['argv'][0x4]===_0x6561('0x10')||process[_0x6561('0xe')][0x4]===_0x6561('0xf')){throw new Error(_0x6561('0x11'));}var FIELDS=_[_0x6561('0x12')](process[_0x6561('0xe')][0x3][_0x6561('0x13')](','),process[_0x6561('0xe')][0x4][_0x6561('0x13')](','));if(!process[_0x6561('0xe')][0x5]||process[_0x6561('0xe')][0x5]===_0x6561('0x10')||process[_0x6561('0xe')][0x5]===_0x6561('0xf')){throw new Error(_0x6561('0x14'));}var LISTID=process[_0x6561('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6561('0xe')][0x6]!==_0x6561('0x10')&&process[_0x6561('0xe')][0x6]!==_0x6561('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x6561('0xe')][0x7]&&process[_0x6561('0xe')][0x7]!=='undefined'&&process[_0x6561('0xe')][0x7]!==_0x6561('0xf')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x6561('0xe')][0x8]===_0x6561('0x10')||process[_0x6561('0xe')][0x8]===_0x6561('0xf')){throw new Error(_0x6561('0x15'));}var SOCKET_TIMESTAMP=process[_0x6561('0xe')][0x8];}catch(_0x158c74){logger[_0x6561('0x16')](_0x158c74);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(_0x40609c,_0x444bbc,_0x18e93a,_0x30719c){var _0x1c3914={'message':_0x444bbc};_0x1c3914[_0x40609c]=!![];if(_0x18e93a){_0x1c3914['contact']=_0x18e93a;}if(_0x30719c){_0x1c3914['index']=_0x30719c;}return _0x1c3914;}function isEmail(_0x5e5e37){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'](_0x5e5e37);}function checkRow(_0x2e1cce,_0x4b3eaf,_0x4937c4){return new BPromise(function(_0x5349ed,_0x438426){if(_['isNil'](_0x2e1cce)){return _0x438426(handleCheckRowError(_0x6561('0x16'),_0x6561('0x17'),null,_0x4937c4));}if(_0x2e1cce[_0x6561('0x18')]&&_0x2e1cce[_0x6561('0x18')][_0x6561('0x19')]){var _0x39f94d=_[_0x6561('0x1a')](_0x2e1cce[_0x6561('0x18')],_0x6561('0x1b'))[_0x6561('0x1c')](';');return _0x438426(handleCheckRowError(_0x6561('0x16'),_0x39f94d,null,_0x4937c4));}var _0x118cc6={};for(var _0x5c64a7 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5c64a7)&&FIELDS[_0x5c64a7]){_0x118cc6[_0x5c64a7]=_0x2e1cce[_0x6561('0x1d')][0x0][FIELDS[_0x5c64a7]]||_0x2e1cce[_0x6561('0x1d')][0x0]['\ufeff'+FIELDS[_0x5c64a7]];}}if(!_0x118cc6[_0x6561('0x1e')]){return _0x438426(handleCheckRowError(_0x6561('0x16'),_0x6561('0x1f'),null,_0x4937c4));}if(!_0x118cc6[_0x6561('0x20')]){return _0x438426(handleCheckRowError('error',_0x6561('0x21'),null,_0x4937c4));}if(_0x118cc6[_0x6561('0x22')]){var _0x57e581=moment(_0x118cc6[_0x6561('0x22')],'YYYY-MM-DD');if(!_0x57e581[_0x6561('0x23')]()){return _0x438426(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4937c4));}}if(_0x118cc6[_0x6561('0x24')]){if(!isEmail(_0x118cc6[_0x6561('0x24')])){return _0x438426(handleCheckRowError(_0x6561('0x16'),_0x6561('0x25'),null,_0x4937c4));}}_0x118cc6['ListId']=LISTID;_0x118cc6[_0x6561('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6561('0x19')]&&_0x4b3eaf){var _0x267fb2={};for(var _0x311223=0x0,_0x40480b=DUPLICATES['length'];_0x311223<_0x40480b;_0x311223+=0x1){_0x267fb2[DUPLICATES[_0x311223]]=_0x118cc6[DUPLICATES[_0x311223]];}var _0x310c94=_[_0x6561('0x27')](_0x4b3eaf,_0x267fb2);if(_0x310c94){return _0x438426(handleCheckRowError(_0x6561('0x28'),'Duplicate\x20Contact',_0x310c94,_0x4937c4));}}return db[_0x6561('0x29')]['create'](_0x118cc6,{'raw':!![],'hooks':![],'fields':_[_0x6561('0x2a')](_0x118cc6)})[_0x6561('0x2b')](function(_0x9e3c4f){if(DUPLICATES&&DUPLICATES[_0x6561('0x19')]&&_0x4b3eaf){_0x4b3eaf[_0x6561('0x2c')](_[_0x6561('0x2d')](_0x118cc6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9e3c4f['id'];return _0x5349ed();})['catch'](function(_0x15f2b2){return _0x438426(handleCheckRowError(_0x6561('0x16'),_0x6561('0x2e')+(_0x15f2b2[_0x6561('0x1b')]||JSON['stringify'](_0x15f2b2)),null,_0x4937c4));});});}function checkHopper(){function _0xb18af5(){return function(_0x2074fe){logger['error'](_0x6561('0x2f'),_0x6561('0x30'),util[_0x6561('0x31')](_0x2074fe,{'showHidden':![],'depth':null}));};}var _0x134278=function(_0x1051e0,_0x552524){var _0xf61c3e=squel[_0x6561('0x32')]()[_0x6561('0x33')](_0x6561('0x34'))[_0x6561('0x35')]([_0x6561('0x20'),'scheduledAt',_0x6561('0x36'),_0x6561('0x37'),_0x552524,_0x6561('0x38'),_0x6561('0x39')],squel[_0x6561('0x3a')]()[_0x6561('0x3b')](_0x6561('0x20'),_0x6561('0x20'))[_0x6561('0x3b')](_0x6561('0x3c'),_0x6561('0x3d'))['field']('id','ContactId')[_0x6561('0x3b')](LISTID[_0x6561('0x3e')](),_0x6561('0x37'))[_0x6561('0x3b')](_0x1051e0['id'][_0x6561('0x3e')](),_0x552524)['field'](_0x6561('0x3c'),_0x6561('0x38'))[_0x6561('0x3b')](_0x6561('0x3c'),_0x6561('0x39'))[_0x6561('0x3f')](_0x6561('0x40'))['where']('deletedAt\x20IS\x20NULL')[_0x6561('0x41')](_0x6561('0x42'),LISTID[_0x6561('0x3e')]())[_0x6561('0x41')](_0x6561('0x43'))[_0x6561('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6561('0x3a')]()[_0x6561('0x3b')](_0x6561('0x20'))[_0x6561('0x3f')](_0x6561('0x34'))['where'](_0x552524+_0x6561('0x44'),_0x1051e0['id'][_0x6561('0x3e')]())))[_0x6561('0x3e')]();return _0xf61c3e;};var _0x267085=function(_0x57a6b2,_0x16dd8b){var _0x34ef12=squel[_0x6561('0x32')]()[_0x6561('0x33')](_0x6561('0x34'))[_0x6561('0x35')](['phone',_0x6561('0x3d'),'ContactId','ListId',_0x16dd8b,_0x6561('0x38'),_0x6561('0x39')],squel[_0x6561('0x3a')]()[_0x6561('0x3b')](_0x6561('0x20'),_0x6561('0x20'))[_0x6561('0x3b')](_0x6561('0x3c'),_0x6561('0x3d'))['field']('id','ContactId')['field'](LISTID[_0x6561('0x3e')](),_0x6561('0x37'))[_0x6561('0x3b')](_0x57a6b2['id'][_0x6561('0x3e')](),_0x16dd8b)[_0x6561('0x3b')]('NOW()','createdAt')[_0x6561('0x3b')](_0x6561('0x3c'),_0x6561('0x39'))[_0x6561('0x3f')](_0x6561('0x40'))['where'](_0x6561('0x45'))[_0x6561('0x41')](_0x6561('0x42'),LISTID['toString']())[_0x6561('0x41')](_0x6561('0x46'),squel[_0x6561('0x47')](hopperContacts))[_0x6561('0x41')](_0x6561('0x43'))[_0x6561('0x41')](_0x6561('0x48'),squel[_0x6561('0x3a')]()[_0x6561('0x3b')]('calleridnum')[_0x6561('0x3f')](_0x6561('0x49'))['where'](_0x16dd8b+'\x20=\x20?',_0x57a6b2['id'][_0x6561('0x3e')]()))[_0x6561('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6561('0x3a')]()['field'](_0x6561('0x20'))[_0x6561('0x3f')](_0x6561('0x34'))['where'](_0x16dd8b+_0x6561('0x44'),_0x57a6b2['id'][_0x6561('0x3e')]())))[_0x6561('0x3e')]();return _0x34ef12;};function _0x34e4b4(_0x5530da,_0x48439b){var _0x103f97=squel[_0x6561('0x32')]()[_0x6561('0x33')](_0x6561('0x34'))['fromQuery']([_0x6561('0x20'),_0x6561('0x3d'),_0x6561('0x36'),_0x6561('0x37'),_0x48439b,_0x6561('0x38'),_0x6561('0x39')],squel[_0x6561('0x3a')]()['field'](_0x6561('0x20'),_0x6561('0x20'))[_0x6561('0x3b')](_0x6561('0x3c'),_0x6561('0x3d'))[_0x6561('0x3b')]('id',_0x6561('0x36'))[_0x6561('0x3b')](LISTID[_0x6561('0x3e')](),'ListId')[_0x6561('0x3b')](_0x5530da['id']['toString'](),_0x48439b)['field'](_0x6561('0x3c'),_0x6561('0x38'))[_0x6561('0x3b')](_0x6561('0x3c'),_0x6561('0x39'))[_0x6561('0x3f')]('cm_contacts')[_0x6561('0x41')](_0x6561('0x45'))[_0x6561('0x41')](_0x6561('0x42'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x6561('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6561('0x3e')]();return _0x103f97;}function _0x1955a1(_0x3d34b5,_0x58be18){var _0x90ac6c=squel[_0x6561('0x32')]()[_0x6561('0x33')](_0x6561('0x4a'))[_0x6561('0x35')]([_0x6561('0x20'),'ContactId',_0x6561('0x37'),_0x58be18,_0x6561('0x38'),_0x6561('0x39')],squel[_0x6561('0x3a')]()[_0x6561('0x3b')]('phone','phone')['field']('id',_0x6561('0x36'))[_0x6561('0x3b')](LISTID[_0x6561('0x3e')](),'ListId')[_0x6561('0x3b')](_0x3d34b5['id'][_0x6561('0x3e')](),_0x58be18)['field'](_0x6561('0x3c'),_0x6561('0x38'))['field']('NOW()',_0x6561('0x39'))[_0x6561('0x3f')]('cm_contacts')[_0x6561('0x41')](_0x6561('0x45'))[_0x6561('0x41')](_0x6561('0x42'),LISTID['toString']())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6561('0x41')](_0x6561('0x43')))[_0x6561('0x3e')]();return _0x90ac6c;}return db[_0x6561('0x4b')][_0x6561('0x4c')]({'where':{'type':_0x6561('0x4d')},'attributes':['id',_0x6561('0x4e')],'include':[{'model':db[_0x6561('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0x6561('0x2b')](function(_0x504099){var _0xc58249=[];if(_0x504099){var _0x1b78d1;for(var _0x4cbac4=0x0,_0xb7bcf5;_0x4cbac4<_0x504099[_0x6561('0x19')];_0x4cbac4+=0x1){_0xb7bcf5=_0x504099[_0x4cbac4][_0x6561('0x50')]({'plain':!![]});switch(_0xb7bcf5['dialCheckDuplicateType']){case'always':_0xc58249[_0x6561('0x2c')](db[_0x6561('0x51')][_0x6561('0x52')](_0x267085(_0xb7bcf5,_0x6561('0x53')))[_0x6561('0x2b')](function(){})[_0x6561('0x54')](_0xb18af5()));break;case _0x6561('0x55'):_0xc58249[_0x6561('0x2c')](db[_0x6561('0x51')][_0x6561('0x52')](_0x134278(_0xb7bcf5,'VoiceQueueId'))['then'](function(){})[_0x6561('0x54')](_0xb18af5()));break;default:_0xc58249[_0x6561('0x2c')](db[_0x6561('0x51')]['query'](_0x34e4b4(_0xb7bcf5,'VoiceQueueId'))[_0x6561('0x2b')](function(){})[_0x6561('0x54')](_0xb18af5()));}}}return _0xc58249;})[_0x6561('0x56')]()[_0x6561('0x2b')](function(){return db[_0x6561('0x4b')][_0x6561('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x6561('0x4f')],'as':_0x6561('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x22f71f){var _0x506ccb=[];if(_0x22f71f){var _0x5d9473;for(var _0x563139=0x0,_0x392e0a;_0x563139<_0x22f71f['length'];_0x563139+=0x1){_0x392e0a=_0x22f71f[_0x563139][_0x6561('0x50')]({'plain':!![]});_0x506ccb[_0x6561('0x2c')](db[_0x6561('0x51')][_0x6561('0x52')](_0x1955a1(_0x392e0a,'VoiceQueueId'))[_0x6561('0x2b')](function(){})[_0x6561('0x54')](_0xb18af5()));}}return _0x506ccb;})[_0x6561('0x56')]();})['then'](function(){return db['Campaign'][_0x6561('0x4c')]({'attributes':['id',_0x6561('0x4e')],'include':[{'model':db[_0x6561('0x4f')],'as':_0x6561('0x58'),'where':{'id':LISTID}}]})[_0x6561('0x2b')](function(_0xb6fda1){var _0x2225d0=[];if(_0xb6fda1){for(var _0x4c9a83=0x0,_0x302cf7;_0x4c9a83<_0xb6fda1[_0x6561('0x19')];_0x4c9a83+=0x1){_0x302cf7=_0xb6fda1[_0x4c9a83]['get']({'plain':!![]});switch(_0x302cf7[_0x6561('0x4e')]){case _0x6561('0x59'):_0x2225d0[_0x6561('0x2c')](db['sequelize'][_0x6561('0x52')](_0x267085(_0x302cf7,_0x6561('0x5a')))[_0x6561('0x2b')](function(){})[_0x6561('0x54')](_0xb18af5()));break;case _0x6561('0x55'):_0x2225d0['push'](db[_0x6561('0x51')][_0x6561('0x52')](_0x134278(_0x302cf7,_0x6561('0x5a')))['then'](function(){})[_0x6561('0x54')](_0xb18af5()));break;default:_0x2225d0[_0x6561('0x2c')](db[_0x6561('0x51')][_0x6561('0x52')](_0x34e4b4(_0x302cf7,_0x6561('0x5a')))['then'](function(){})[_0x6561('0x54')](_0xb18af5()));}}}return _0x2225d0;})[_0x6561('0x56')]();})[_0x6561('0x2b')](function(){return db['Campaign'][_0x6561('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x43bd67){var _0x19e576=[];if(_0x43bd67){for(var _0x45f17d=0x0,_0x396f0f;_0x45f17d<_0x43bd67[_0x6561('0x19')];_0x45f17d+=0x1){_0x396f0f=_0x43bd67[_0x45f17d][_0x6561('0x50')]({'plain':!![]});_0x19e576[_0x6561('0x2c')](db[_0x6561('0x51')][_0x6561('0x52')](_0x1955a1(_0x396f0f,_0x6561('0x5a')))[_0x6561('0x2b')](function(){})['catch'](_0xb18af5()));}}return _0x19e576;})['all']();})[_0x6561('0x54')](function(_0x48f13f){logger[_0x6561('0x16')]('cmContact,\x20%s,\x20%s',_0x6561('0x5b'),_0x48f13f[_0x6561('0x1b')]);});}var processPromises=function(_0xe263da){return BPromise[_0x6561('0x56')](promises)[_0x6561('0x2b')](function(_0x19372a){})[_0x6561('0x54')](function(_0x525d2b){logger[_0x6561('0x16')](_0x6561('0x5c'),JSON[_0x6561('0x5d')](_0x525d2b));})[_0x6561('0x5e')](function(){socket[_0x6561('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xe263da){return _0xe263da[_0x6561('0x60')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x6561('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x6561('0x2b')](function(){socket[_0x6561('0x5f')](_0x6561('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6561('0x62')](FILEPATH);}catch(_0x193d33){logger[_0x6561('0x16')](_0x6561('0x63'),JSON[_0x6561('0x5d')](_0x193d33));}finally{process[_0x6561('0x64')](0x0);}});};process['on']('SIGINT',function(){logger[_0x6561('0x65')](_0x6561('0x66'));endCsv();});function main(){return BPromise[_0x6561('0x67')]()[_0x6561('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6561('0x13')](',');return db[_0x6561('0x29')][_0x6561('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6561('0x2b')](function(_0x26a52b){var _0x5cd7a6=fs[_0x6561('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6561('0x69')](_0x5cd7a6,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ccb2f,_0x3d81ae){total+=0x1;var _0x439e43=total;promises['push'](checkRow(_0x2ccb2f,_0x26a52b,_0x439e43)[_0x6561('0x2b')](function(){success+=0x1;})['catch'](function(_0x46204d){if(_0x46204d[_0x6561('0x16')]){errors+=0x1;delete _0x46204d[_0x6561('0x16')];}else if(_0x46204d['duplicate']){duplicates+=0x1;delete _0x46204d['duplicate'];}rows[_0x6561('0x2c')](_0x46204d);}));if(total%0xc8===0x0){_0x3d81ae['pause']();return processPromises(_0x3d81ae);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x148d94,_0x2dda29){logger['info']('CSV\x20parse\x20error',JSON[_0x6561('0x5d')](_0x148d94));endCsv();}});})['catch'](function(_0x1e51d2){logger[_0x6561('0x16')](_0x6561('0x6a'),JSON[_0x6561('0x5d')](_0x1e51d2));});}main(); \ No newline at end of file +var _0x338a=['finally','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','hasOwnProperty','data','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','message','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','NOW()','toString','updatedAt','from','cm_contacts','where','createdAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','\x20=\x20?','into','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','catch','onlyIfOpen','query','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify'];(function(_0x53f33a,_0x361a3b){var _0x14dabf=function(_0x4f51ca){while(--_0x4f51ca){_0x53f33a['push'](_0x53f33a['shift']());}};_0x14dabf(++_0x361a3b);}(_0x338a,0x7e));var _0xa338=function(_0x57dc44,_0x480aaa){_0x57dc44=_0x57dc44-0x0;var _0x19f5bf=_0x338a[_0x57dc44];return _0x19f5bf;};'use strict';var BPromise=require('bluebird');var util=require(_0xa338('0x0'));var _=require(_0xa338('0x1'));var fs=require('fs');var squel=require(_0xa338('0x2'));var Papa=require(_0xa338('0x3'));var Redis=require(_0xa338('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xa338('0x5'));var logger=require(_0xa338('0x6'))(_0xa338('0x7'));config[_0xa338('0x8')]=_[_0xa338('0x9')](config['redis'],{'host':_0xa338('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa338('0xb'))['register'](socket);try{if(!process[_0xa338('0xc')][0x2]||process['argv'][0x2]===_0xa338('0xd')||process['argv'][0x2]===_0xa338('0xe')){throw new Error(_0xa338('0xf'));}var FILEPATH=process[_0xa338('0xc')][0x2];if(!process[_0xa338('0xc')][0x3]||process[_0xa338('0xc')][0x3]==='undefined'||process['argv'][0x3]===_0xa338('0xe')||!process[_0xa338('0xc')][0x4]||process[_0xa338('0xc')][0x4]==='undefined'||process[_0xa338('0xc')][0x4]==='null'){throw new Error(_0xa338('0x10'));}var FIELDS=_['zipObject'](process[_0xa338('0xc')][0x3][_0xa338('0x11')](','),process[_0xa338('0xc')][0x4][_0xa338('0x11')](','));if(!process[_0xa338('0xc')][0x5]||process[_0xa338('0xc')][0x5]===_0xa338('0xd')||process[_0xa338('0xc')][0x5]===_0xa338('0xe')){throw new Error(_0xa338('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xa338('0xc')][0x6]&&process[_0xa338('0xc')][0x6]!=='undefined'&&process[_0xa338('0xc')][0x6]!==_0xa338('0xe')?process[_0xa338('0xc')][0x6]:null;var DUPLICATES=process[_0xa338('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xa338('0xc')][0x7]!=='null'?process[_0xa338('0xc')][0x7]:null;if(!process[_0xa338('0xc')][0x8]||process[_0xa338('0xc')][0x8]===_0xa338('0xd')||process['argv'][0x8]===_0xa338('0xe')){throw new Error(_0xa338('0x13'));}var SOCKET_TIMESTAMP=process[_0xa338('0xc')][0x8];}catch(_0x16b199){logger[_0xa338('0x14')](_0x16b199);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(_0x14bb26,_0x2e9a67,_0x38e911,_0x4ef014){var _0x2db216={'message':_0x2e9a67};_0x2db216[_0x14bb26]=!![];if(_0x38e911){_0x2db216['contact']=_0x38e911;}if(_0x4ef014){_0x2db216[_0xa338('0x15')]=_0x4ef014;}return _0x2db216;}function isEmail(_0x3e1bcf){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))*$/[_0xa338('0x16')](_0x3e1bcf);}function checkRow(_0x5ee162,_0x52c2fc,_0xcf7e62){return new BPromise(function(_0x4f1985,_0x2aaaf5){if(_[_0xa338('0x17')](_0x5ee162)){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0xa338('0x18'),null,_0xcf7e62));}if(_0x5ee162[_0xa338('0x19')]&&_0x5ee162['errors'][_0xa338('0x1a')]){var _0x525914=_[_0xa338('0x1b')](_0x5ee162[_0xa338('0x19')],'message')['join'](';');return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0x525914,null,_0xcf7e62));}var _0x2edde3={};for(var _0x5d54dd in FIELDS){if(FIELDS[_0xa338('0x1c')](_0x5d54dd)&&FIELDS[_0x5d54dd]){_0x2edde3[_0x5d54dd]=_0x5ee162['data'][0x0][FIELDS[_0x5d54dd]]||_0x5ee162[_0xa338('0x1d')][0x0]['\ufeff'+FIELDS[_0x5d54dd]];}}if(!_0x2edde3['firstName']){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),'firstName\x20not\x20specified!',null,_0xcf7e62));}if(!_0x2edde3[_0xa338('0x1e')]){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),'phone\x20not\x20specified!',null,_0xcf7e62));}if(_0x2edde3[_0xa338('0x1f')]){var _0x2352c3=moment(_0x2edde3['birthDate'],_0xa338('0x20'));if(!_0x2352c3['isValid']()){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0xa338('0x21'),null,_0xcf7e62));}}if(_0x2edde3['email']){if(!isEmail(_0x2edde3[_0xa338('0x22')])){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),_0xa338('0x23'),null,_0xcf7e62));}}_0x2edde3['ListId']=LISTID;_0x2edde3[_0xa338('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa338('0x1a')]&&_0x52c2fc){var _0x469e34={};for(var _0x44da8f=0x0,_0x135a96=DUPLICATES[_0xa338('0x1a')];_0x44da8f<_0x135a96;_0x44da8f+=0x1){_0x469e34[DUPLICATES[_0x44da8f]]=_0x2edde3[DUPLICATES[_0x44da8f]];}var _0x156308=_[_0xa338('0x25')](_0x52c2fc,_0x469e34);if(_0x156308){return _0x2aaaf5(handleCheckRowError('duplicate',_0xa338('0x26'),_0x156308,_0xcf7e62));}}return db[_0xa338('0x27')][_0xa338('0x28')](_0x2edde3,{'raw':!![],'hooks':![],'fields':_[_0xa338('0x29')](_0x2edde3)})[_0xa338('0x2a')](function(_0x139a00){if(DUPLICATES&&DUPLICATES[_0xa338('0x1a')]&&_0x52c2fc){_0x52c2fc[_0xa338('0x2b')](_['pick'](_0x2edde3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x139a00['id'];return _0x4f1985();})['catch'](function(_0x1b99ec){return _0x2aaaf5(handleCheckRowError(_0xa338('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1b99ec[_0xa338('0x2c')]||JSON['stringify'](_0x1b99ec)),null,_0xcf7e62));});});}function checkHopper(){function _0x4e9a28(){return function(_0xb47b1f){logger[_0xa338('0x14')](_0xa338('0x2d'),_0xa338('0x2e'),util['inspect'](_0xb47b1f,{'showHidden':![],'depth':null}));};}var _0x3c96ff=function(_0x361898,_0x15e843){var _0x44bcd6=squel[_0xa338('0x2f')]()['into'](_0xa338('0x30'))[_0xa338('0x31')]([_0xa338('0x1e'),_0xa338('0x32'),_0xa338('0x33'),_0xa338('0x34'),_0x15e843,'createdAt','updatedAt'],squel[_0xa338('0x35')]()[_0xa338('0x36')](_0xa338('0x1e'),_0xa338('0x1e'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x32'))[_0xa338('0x36')]('id',_0xa338('0x33'))[_0xa338('0x36')](LISTID[_0xa338('0x38')](),_0xa338('0x34'))['field'](_0x361898['id'][_0xa338('0x38')](),_0x15e843)[_0xa338('0x36')](_0xa338('0x37'),'createdAt')['field']('NOW()',_0xa338('0x39'))[_0xa338('0x3a')](_0xa338('0x3b'))[_0xa338('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xa338('0x38')]())[_0xa338('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xa338('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa338('0x35')]()[_0xa338('0x36')](_0xa338('0x1e'))[_0xa338('0x3a')](_0xa338('0x30'))[_0xa338('0x3c')](_0x15e843+'\x20=\x20?',_0x361898['id'][_0xa338('0x38')]())))[_0xa338('0x38')]();return _0x44bcd6;};var _0x194e22=function(_0x1f215f,_0x3fcd43){var _0xae00b9=squel[_0xa338('0x2f')]()['into'](_0xa338('0x30'))[_0xa338('0x31')]([_0xa338('0x1e'),_0xa338('0x32'),'ContactId',_0xa338('0x34'),_0x3fcd43,'createdAt','updatedAt'],squel[_0xa338('0x35')]()['field'](_0xa338('0x1e'),_0xa338('0x1e'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x32'))[_0xa338('0x36')]('id',_0xa338('0x33'))[_0xa338('0x36')](LISTID[_0xa338('0x38')](),_0xa338('0x34'))[_0xa338('0x36')](_0x1f215f['id'][_0xa338('0x38')](),_0x3fcd43)[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x3d'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x39'))['from'](_0xa338('0x3b'))['where'](_0xa338('0x3e'))['where'](_0xa338('0x3f'),LISTID['toString']())[_0xa338('0x3c')](_0xa338('0x40'),squel[_0xa338('0x41')](hopperContacts))[_0xa338('0x3c')](_0xa338('0x42'))[_0xa338('0x3c')](_0xa338('0x43'),squel[_0xa338('0x35')]()['field']('calleridnum')[_0xa338('0x3a')](_0xa338('0x44'))['where'](_0x3fcd43+_0xa338('0x45'),_0x1f215f['id'][_0xa338('0x38')]()))[_0xa338('0x3c')](_0xa338('0x43'),squel['select']()[_0xa338('0x36')]('phone')[_0xa338('0x3a')](_0xa338('0x30'))[_0xa338('0x3c')](_0x3fcd43+'\x20=\x20?',_0x1f215f['id']['toString']())))['toString']();return _0xae00b9;};function _0x301f68(_0x84f4ba,_0x3adfba){var _0x42ec8b=squel[_0xa338('0x2f')]()[_0xa338('0x46')](_0xa338('0x30'))[_0xa338('0x31')]([_0xa338('0x1e'),_0xa338('0x32'),'ContactId','ListId',_0x3adfba,_0xa338('0x3d'),_0xa338('0x39')],squel[_0xa338('0x35')]()['field'](_0xa338('0x1e'),'phone')[_0xa338('0x36')](_0xa338('0x37'),'scheduledAt')[_0xa338('0x36')]('id',_0xa338('0x33'))['field'](LISTID['toString'](),_0xa338('0x34'))[_0xa338('0x36')](_0x84f4ba['id']['toString'](),_0x3adfba)[_0xa338('0x36')]('NOW()',_0xa338('0x3d'))[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x39'))[_0xa338('0x3a')](_0xa338('0x3b'))[_0xa338('0x3c')]('deletedAt\x20IS\x20NULL')[_0xa338('0x3c')]('ListId\x20=\x20?',LISTID[_0xa338('0x38')]())[_0xa338('0x3c')](_0xa338('0x40'),squel[_0xa338('0x41')](hopperContacts))[_0xa338('0x3c')](_0xa338('0x42')))[_0xa338('0x38')]();return _0x42ec8b;}function _0x3baf91(_0x36b594,_0x476d8b){var _0x32e363=squel[_0xa338('0x2f')]()[_0xa338('0x46')](_0xa338('0x47'))['fromQuery']([_0xa338('0x1e'),_0xa338('0x33'),'ListId',_0x476d8b,_0xa338('0x3d'),_0xa338('0x39')],squel['select']()[_0xa338('0x36')](_0xa338('0x1e'),_0xa338('0x1e'))['field']('id',_0xa338('0x33'))[_0xa338('0x36')](LISTID[_0xa338('0x38')](),'ListId')[_0xa338('0x36')](_0x36b594['id']['toString'](),_0x476d8b)[_0xa338('0x36')](_0xa338('0x37'),_0xa338('0x3d'))['field'](_0xa338('0x37'),_0xa338('0x39'))[_0xa338('0x3a')](_0xa338('0x3b'))['where'](_0xa338('0x3e'))[_0xa338('0x3c')](_0xa338('0x3f'),LISTID[_0xa338('0x38')]())[_0xa338('0x3c')]('id\x20IN\x20?',squel[_0xa338('0x41')](hopperContacts))[_0xa338('0x3c')](_0xa338('0x42')))['toString']();return _0x32e363;}return db[_0xa338('0x48')][_0xa338('0x49')]({'where':{'type':_0xa338('0x4a')},'attributes':['id',_0xa338('0x4b')],'include':[{'model':db[_0xa338('0x4c')],'as':_0xa338('0x4d'),'where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x571b9c){var _0x3c2d54=[];if(_0x571b9c){var _0x29d186;for(var _0x5acc6c=0x0,_0x4c791c;_0x5acc6c<_0x571b9c[_0xa338('0x1a')];_0x5acc6c+=0x1){_0x4c791c=_0x571b9c[_0x5acc6c][_0xa338('0x4e')]({'plain':!![]});switch(_0x4c791c[_0xa338('0x4b')]){case _0xa338('0x4f'):_0x3c2d54[_0xa338('0x2b')](db[_0xa338('0x50')]['query'](_0x194e22(_0x4c791c,_0xa338('0x51')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));break;case _0xa338('0x53'):_0x3c2d54['push'](db[_0xa338('0x50')][_0xa338('0x54')](_0x3c96ff(_0x4c791c,_0xa338('0x51')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));break;default:_0x3c2d54[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x301f68(_0x4c791c,_0xa338('0x51')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));}}}return _0x3c2d54;})[_0xa338('0x55')]()[_0xa338('0x2a')](function(){return db[_0xa338('0x48')][_0xa338('0x49')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xa338('0x56'),'where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x4030a6){var _0x3e6823=[];if(_0x4030a6){var _0x2916b9;for(var _0x49e579=0x0,_0x5164e8;_0x49e579<_0x4030a6[_0xa338('0x1a')];_0x49e579+=0x1){_0x5164e8=_0x4030a6[_0x49e579][_0xa338('0x4e')]({'plain':!![]});_0x3e6823[_0xa338('0x2b')](db['sequelize'][_0xa338('0x54')](_0x3baf91(_0x5164e8,'VoiceQueueId'))[_0xa338('0x2a')](function(){})['catch'](_0x4e9a28()));}}return _0x3e6823;})[_0xa338('0x55')]();})[_0xa338('0x2a')](function(){return db[_0xa338('0x57')][_0xa338('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa338('0x4c')],'as':_0xa338('0x4d'),'where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x4765f7){var _0x1f223c=[];if(_0x4765f7){for(var _0x31599e=0x0,_0x1ce75d;_0x31599e<_0x4765f7[_0xa338('0x1a')];_0x31599e+=0x1){_0x1ce75d=_0x4765f7[_0x31599e][_0xa338('0x4e')]({'plain':!![]});switch(_0x1ce75d[_0xa338('0x4b')]){case _0xa338('0x4f'):_0x1f223c[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x194e22(_0x1ce75d,_0xa338('0x58')))[_0xa338('0x2a')](function(){})['catch'](_0x4e9a28()));break;case _0xa338('0x53'):_0x1f223c[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x3c96ff(_0x1ce75d,_0xa338('0x58')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));break;default:_0x1f223c['push'](db[_0xa338('0x50')]['query'](_0x301f68(_0x1ce75d,_0xa338('0x58')))[_0xa338('0x2a')](function(){})[_0xa338('0x52')](_0x4e9a28()));}}}return _0x1f223c;})['all']();})[_0xa338('0x2a')](function(){return db[_0xa338('0x57')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa338('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa338('0x2a')](function(_0x2d77c6){var _0x3f0554=[];if(_0x2d77c6){for(var _0x37b8bb=0x0,_0x5561fc;_0x37b8bb<_0x2d77c6[_0xa338('0x1a')];_0x37b8bb+=0x1){_0x5561fc=_0x2d77c6[_0x37b8bb][_0xa338('0x4e')]({'plain':!![]});_0x3f0554[_0xa338('0x2b')](db[_0xa338('0x50')][_0xa338('0x54')](_0x3baf91(_0x5561fc,_0xa338('0x58')))[_0xa338('0x2a')](function(){})['catch'](_0x4e9a28()));}}return _0x3f0554;})[_0xa338('0x55')]();})['catch'](function(_0x17077b){logger[_0xa338('0x14')](_0xa338('0x59'),'generalCheckHopper',_0x17077b[_0xa338('0x2c')]);});}var processPromises=function(_0x18edae){return BPromise[_0xa338('0x55')](promises)[_0xa338('0x2a')](function(_0x70dafb){})[_0xa338('0x52')](function(_0x3481ec){logger[_0xa338('0x14')](_0xa338('0x5a'),JSON[_0xa338('0x5b')](_0x3481ec));})[_0xa338('0x5c')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x18edae){return _0x18edae[_0xa338('0x5d')]();}});};var endCsv=function(){return BPromise[_0xa338('0x5e')]()[_0xa338('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xa338('0x2a')](function(){socket['emit'](_0xa338('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa338('0x60')](FILEPATH);}catch(_0x509131){logger['error'](_0xa338('0x61'),JSON[_0xa338('0x5b')](_0x509131));}finally{process[_0xa338('0x62')](0x0);}});};process['on'](_0xa338('0x63'),function(){logger[_0xa338('0x64')](_0xa338('0x65'));endCsv();});function main(){return BPromise[_0xa338('0x5e')]()[_0xa338('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa338('0x27')][_0xa338('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa338('0x2a')](function(_0x4db32b){var _0x4579df=fs[_0xa338('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa338('0x67')](_0x4579df,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4b0ad1,_0x4dd4a6){total+=0x1;var _0x5396f6=total;promises['push'](checkRow(_0x4b0ad1,_0x4db32b,_0x5396f6)[_0xa338('0x2a')](function(){success+=0x1;})['catch'](function(_0xc234a7){if(_0xc234a7[_0xa338('0x14')]){errors+=0x1;delete _0xc234a7[_0xa338('0x14')];}else if(_0xc234a7['duplicate']){duplicates+=0x1;delete _0xc234a7[_0xa338('0x68')];}rows['push'](_0xc234a7);}));if(total%0xc8===0x0){_0x4dd4a6[_0xa338('0x69')]();return processPromises(_0x4dd4a6);}},'complete':function(){return processPromises()[_0xa338('0x2a')](function(){logger[_0xa338('0x64')](_0xa338('0x6a'));endCsv();});},'error':function(_0x55656e,_0x5caa8c){logger['info'](_0xa338('0x6b'),JSON[_0xa338('0x5b')](_0x55656e));endCsv();}});})[_0xa338('0x52')](function(_0x5f3c66){logger[_0xa338('0x14')](_0xa338('0x6c'),JSON[_0xa338('0x5b')](_0x5f3c66));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 30b28ab..d32bcd7 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 _0xd189=['writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','timezones','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','voice_queues','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','all','AdditionalPhones','push','split','isNil','filter','CmContactHasItem','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ListId','createdAt','updatedAt','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','into','cm_hopper_black','.CmListId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.id','cm_contacts.UserId','scheduledat','ContactId','priority','recallme','cm_contacts','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','catch','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','utcOffset','set','offset','dialTimezone','main','send','start','binding','socket_timestamp','server/files/tmp','.csv','header','ContactItemType','name','_description'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xd189,0x1a6));var _0x9d18=function(_0x3f2475,_0x587901){_0x3f2475=_0x3f2475-0x0;var _0x47520b=_0xd189[_0x3f2475];return _0x47520b;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x9d18('0x0'));var util=require('util');var BPromise=require(_0x9d18('0x1'));var moment=require('moment');var squel=require(_0x9d18('0x2'));var Redis=require(_0x9d18('0x3'));var db=require(_0x9d18('0x4'))['db'];var config=require('../../../config/environment');var shared=require(_0x9d18('0x5'));var logger=require(_0x9d18('0x6'))(_0x9d18('0x7'));config[_0x9d18('0x8')]=_[_0x9d18('0x9')](config[_0x9d18('0x8')],{'host':_0x9d18('0xa'),'port':0x18eb});var socket=require(_0x9d18('0xb'))(new Redis(config[_0x9d18('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x9d18('0xc')](_0x9d18('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3a5458){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))*$/[_0x9d18('0xe')](_0x3a5458);}function selectNotIn(_0x5d1288,_0x36dae3,_0x5c710b,_0x5a28fd,_0x92509){return squel[_0x9d18('0xf')]()[_0x9d18('0x10')](_0x9d18('0x11'))[_0x9d18('0x12')](_0x5a28fd)[_0x9d18('0x13')](_0x36dae3,null,_0x36dae3+_0x9d18('0x14')+_0x5a28fd+'.'+_0x5c710b)[_0x9d18('0x15')](_0x5a28fd+'.'+_0x5c710b+_0x9d18('0x16')+_0x5d1288+'.'+_0x5c710b)[_0x9d18('0x15')](_0x36dae3+_0x9d18('0x17')+_0x92509['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4923cd,_0x357380){promisesAdditionalPhones=[];return db[_0x9d18('0x18')][_0x9d18('0x19')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x9d18('0x1a')](function(_0x2c14db){if(_0x2c14db!==null){var _0x4473ee=[];for(var _0x41a4fe=0x0;_0x41a4fe<_0x2c14db[_0x9d18('0x1b')];_0x41a4fe++){var _0x2c05f2=_0x2c14db[_0x41a4fe];_0x4473ee['push'](insertAdditionalPhones(_0x2c05f2));}}Promise[_0x9d18('0x1c')](_0x4473ee)[_0x9d18('0x1a')](function(){_0x4923cd({'val':0x1});});});});}function insertAdditionalPhones(_0x3174c4){return new Promise(function(_0xcfec5e,_0x54653e){var _0x5bd23e=_0x3174c4[_0x9d18('0x1d')];var _0x3bfddf=_0x5bd23e['split'](';');var _0x3b252f=[];orderBy=0x0;for(var _0x4077e2=0x0;_0x4077e2<_0x3bfddf[_0x9d18('0x1b')];_0x4077e2++){_0x3b252f[_0x9d18('0x1e')](splitAdditionalPhone(_0x3174c4['id'],_0x3bfddf[_0x4077e2]));}Promise[_0x9d18('0x1c')](_0x3b252f)['then'](function(){_0xcfec5e({'val':_0x3bfddf[_0x9d18('0x1b')]});});});}function splitAdditionalPhone(_0x4c7da3,_0x1f44d0){return new Promise(function(_0x59f00b,_0x4b640f){var _0x3f13d8=_0x1f44d0[_0x9d18('0x1f')](':');var _0x51fcda=_0x3f13d8[0x0];var _0x27ec47=_0x3f13d8[0x1];if(!_[_0x9d18('0x20')](_0x27ec47)){var _0x21be22=_0x27ec47[_0x9d18('0x1f')]('|');var _0x3c035=[];for(var _0x59aefd=0x0;_0x59aefd<_0x21be22[_0x9d18('0x1b')];_0x59aefd++){if(_0x21be22[_0x59aefd]!==''){var _0x5c3b5b=_[_0x9d18('0x21')](promisesAdditionalPhones,{'contactId':_0x4c7da3,'phone':_0x21be22[_0x59aefd]});if(_0x5c3b5b[_0x9d18('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x9d18('0x1e')]({'contactId':_0x4c7da3,'contactTypeId':_0x51fcda,'phone':_0x21be22[_0x59aefd],'orderBy':orderBy});}}}_0x59f00b({'ok':0x1});}else _0x59f00b({'res':0x0});});}function createAdditionalPhone(_0x2d8735,_0x406ae9,_0x483803,_0x308894){var _0x1088fb='';var _0x2c51bd='';var _0x265266=_0x483803['split']('§');_0x1088fb=_0x265266[0x0];if(_0x265266[_0x9d18('0x1b')]==0x2)_0x2c51bd=_0x265266[0x1];return new Promise(function(_0x595be8,_0xd35710){return db[_0x9d18('0x22')]['findOne']({'where':{'CmContactId':_0x2d8735,'item':_0x1088fb}})[_0x9d18('0x1a')](function(_0x393fd7){if(_0x393fd7){return db[_0x9d18('0x22')]['update']({'ItemTypeId':_0x406ae9,'description':_0x2c51bd,'OrderBy':_0x308894},{'where':{'CmContactId':_0x2d8735,'item':_0x1088fb}})[_0x9d18('0x1a')](function(_0x3523c9){_0x595be8({'res':'updated'});});}else{return db[_0x9d18('0x22')]['create']({'CmContactId':_0x2d8735,'item':_0x1088fb,'description':_0x2c51bd,'ItemTypeId':_0x406ae9,'OrderBy':_0x308894,'ItemClass':_0x9d18('0x23')})['then'](function(_0x4bd992){_0x595be8({'res':_0x9d18('0x24')});});}});});}function insertCmHopper(_0x834f8a,_0x4f9bed,_0x3d8ca2,_0x188287,_0x413ff9){var _0x26b205=['cm_contacts.phone',_0x9d18('0x25'),'cm_contacts.id',_0x9d18('0x26'),_0x4f9bed+'.'+_0x188287,_0x9d18('0x27'),_0x9d18('0x28'),_0x9d18('0x29'),'cm_contacts.UserId','\x22'+_0x413ff9+'\x22'];return squel[_0x9d18('0x2a')]()['into'](_0x9d18('0x2b'))[_0x9d18('0x2c')]([_0x9d18('0x11'),'scheduledat','ContactId',_0x9d18('0x2d'),_0x188287,_0x9d18('0x2e'),_0x9d18('0x2f'),'priority',_0x9d18('0x30'),'recallme'],squel['select']()[_0x9d18('0x31')](_0x26b205)[_0x9d18('0x12')](_0x4f9bed)[_0x9d18('0x13')]('cm_contacts',null,_0x9d18('0x32')+_0x4f9bed+'.CmListId')[_0x9d18('0x13')](_0x3d8ca2,null,_0x3d8ca2+_0x9d18('0x14')+_0x4f9bed+'.'+_0x188287)[_0x9d18('0x15')](_0x4f9bed+_0x9d18('0x33'),_0x834f8a)[_0x9d18('0x15')](_0x9d18('0x34'),NOW)[_0x9d18('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f9bed,_0x3d8ca2,_0x188287,_0x9d18('0x2b'),['\x22always\x22',_0x9d18('0x35')]))[_0x9d18('0x15')](_0x9d18('0x36'),selectNotIn(_0x4f9bed,_0x3d8ca2,_0x188287,_0x9d18('0x2b'),[_0x9d18('0x37')])))[_0x9d18('0x38')]();}function insertCmHopperBlack(_0x15762b,_0x4e6cc7,_0x3a095c,_0x276442){var _0x51f920=[_0x9d18('0x39'),'cm_contacts.id',_0x9d18('0x26'),_0x4e6cc7+'.'+_0x276442,_0x9d18('0x27'),'cm_contacts.updatedAt'];return squel[_0x9d18('0x2a')]()[_0x9d18('0x3a')](_0x9d18('0x3b'))['fromQuery']([_0x9d18('0x11'),'ContactId',_0x9d18('0x2d'),_0x276442,_0x9d18('0x2e'),_0x9d18('0x2f')],squel[_0x9d18('0xf')]()[_0x9d18('0x31')](_0x51f920)[_0x9d18('0x12')](_0x4e6cc7)[_0x9d18('0x13')]('cm_contacts',null,_0x9d18('0x32')+_0x4e6cc7+_0x9d18('0x3c'))[_0x9d18('0x13')](_0x3a095c,null,_0x3a095c+'.id\x20=\x20'+_0x4e6cc7+'.'+_0x276442)[_0x9d18('0x15')](_0x4e6cc7+_0x9d18('0x33'),_0x15762b)[_0x9d18('0x15')](_0x9d18('0x34'),NOW)['where'](_0x9d18('0x36'),squel[_0x9d18('0xf')]()['field'](_0x9d18('0x11'))[_0x9d18('0x12')](_0x9d18('0x3b'))[_0x9d18('0x15')](_0x9d18('0x3d'),_0x15762b)[_0x9d18('0x15')](_0x276442+'\x20=\x20'+_0x4e6cc7+'.'+_0x276442)))[_0x9d18('0x38')]();}function insertTzCmHopper(_0x5bc4d4,_0x529760,_0x1edfdc,_0x312309,_0x4c222f,_0x42d836){var _0x35678f=['cm_contacts.phone',_0x9d18('0x3e')+_0x42d836+'.offset-cm_contacts.utcOffset\x20minute)',_0x9d18('0x3f'),_0x9d18('0x26'),_0x529760+'.'+_0x312309,'cm_contacts.createdAt',_0x9d18('0x28'),'cm_contacts.priority',_0x9d18('0x40'),'\x22'+_0x4c222f+'\x22'];var _0x424021=squel[_0x9d18('0x2a')]()[_0x9d18('0x3a')](_0x9d18('0x2b'))['fromQuery']([_0x9d18('0x11'),_0x9d18('0x41'),_0x9d18('0x42'),_0x9d18('0x2d'),_0x312309,_0x9d18('0x2e'),_0x9d18('0x2f'),_0x9d18('0x43'),_0x9d18('0x30'),_0x9d18('0x44')],squel[_0x9d18('0xf')]()[_0x9d18('0x31')](_0x35678f)[_0x9d18('0x12')](_0x529760)[_0x9d18('0x13')]('cm_contacts',null,_0x9d18('0x32')+_0x529760+'.CmListId')['join'](_0x1edfdc,null,_0x1edfdc+_0x9d18('0x14')+_0x529760+'.'+_0x312309)[_0x9d18('0x13')](_0x42d836,null,_0x42d836+_0x9d18('0x14')+_0x529760+'.'+_0x312309)[_0x9d18('0x15')](_0x529760+'.CmListId\x20=\x20?',_0x5bc4d4)[_0x9d18('0x15')](_0x9d18('0x34'),NOW)[_0x9d18('0x15')](_0x9d18('0x36'),selectNotIn(_0x529760,_0x1edfdc,_0x312309,'cm_hopper',[_0x9d18('0x37'),_0x9d18('0x35')]))[_0x9d18('0x15')](_0x9d18('0x36'),selectNotIn(_0x529760,_0x1edfdc,_0x312309,_0x9d18('0x2b'),[_0x9d18('0x37')])))[_0x9d18('0x38')]();return _0x424021;}function insertTzCmHopperBlack(_0x378114,_0x3e8eee,_0xa65413,_0x3d4bd6){var _0x5c287d=[_0x9d18('0x39'),_0x9d18('0x3f'),_0x9d18('0x26'),_0x3e8eee+'.'+_0x3d4bd6,'cm_contacts.createdAt',_0x9d18('0x28')];return squel[_0x9d18('0x2a')]()[_0x9d18('0x3a')](_0x9d18('0x3b'))[_0x9d18('0x2c')]([_0x9d18('0x11'),'ContactId',_0x9d18('0x2d'),_0x3d4bd6,_0x9d18('0x2e'),_0x9d18('0x2f')],squel[_0x9d18('0xf')]()[_0x9d18('0x31')](_0x5c287d)[_0x9d18('0x12')](_0x3e8eee)['join'](_0x9d18('0x45'),null,_0x9d18('0x32')+_0x3e8eee+_0x9d18('0x3c'))['join'](_0xa65413,null,_0xa65413+_0x9d18('0x14')+_0x3e8eee+'.'+_0x3d4bd6)['where'](_0x3e8eee+_0x9d18('0x33'),_0x378114)[_0x9d18('0x15')](_0x9d18('0x34'),NOW)['where'](_0x9d18('0x36'),squel[_0x9d18('0xf')]()['field'](_0x9d18('0x11'))[_0x9d18('0x12')](_0x9d18('0x3b'))[_0x9d18('0x15')](_0x9d18('0x3d'),_0x378114)['where'](_0x3d4bd6+_0x9d18('0x16')+_0x3e8eee+'.'+_0x3d4bd6)))[_0x9d18('0x38')]();}function insertCmHopperAdditionalPhones(_0x244082){var _0x56dc26=[_0x9d18('0x46'),_0x9d18('0x47'),_0x9d18('0x48'),_0x9d18('0x49'),_0x9d18('0x4a')];return squel[_0x9d18('0x2a')]()[_0x9d18('0x3a')](_0x9d18('0x4b'))[_0x9d18('0x2c')]([_0x9d18('0x4c'),_0x9d18('0x11'),_0x9d18('0x4d'),_0x9d18('0x2e'),_0x9d18('0x2f')],squel[_0x9d18('0xf')]()[_0x9d18('0x31')](_0x56dc26)[_0x9d18('0x12')]('cm_hopper')[_0x9d18('0x13')]('cm_contacts',null,_0x9d18('0x4e'))['join'](_0x9d18('0x4f'),null,_0x9d18('0x50'))['where'](_0x9d18('0x51'),_0x244082)[_0x9d18('0x15')](_0x9d18('0x34'),NOW))[_0x9d18('0x38')]();}function insertCmContact(_0x269d7d,_0x1d3891,_0x5c84cb,_0x5dcdf4){var _0x24ef30=_[_0x9d18('0x52')](_[_0x9d18('0x53')](_0x5dcdf4),[_0x9d18('0x2d'),'CompanyId',_0x9d18('0x2e'),_0x9d18('0x2f'),_0x9d18('0x54')]);return squel['insert']()[_0x9d18('0x3a')](_0x9d18('0x45'))[_0x9d18('0x2c')](_0x24ef30,squel[_0x9d18('0xf')]()[_0x9d18('0x31')](_0x24ef30)[_0x9d18('0x12')](_0x1d3891)['where']('('+_0x5c84cb[_0x9d18('0x13')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x9d18('0x31')](_0x5c84cb)[_0x9d18('0x12')]('cm_contacts')[_0x9d18('0x15')]('ListId\x20=\x20?',_0x269d7d)[_0x9d18('0x15')](_0x9d18('0x55')))[_0x9d18('0x15')]('id\x20IN\x20?',squel['select']()['field'](_0x9d18('0x56'),_0x9d18('0x57'))['from'](_0x1d3891)[_0x9d18('0x58')](_0x5c84cb[_0x9d18('0x13')](','))))[_0x9d18('0x38')]();}function handleStop(){logger[_0x9d18('0x59')](_0x9d18('0x5a'));stopped=!![];}function handleUncaughtException(_0x2ab815){logger[_0x9d18('0x5b')](_0x2ab815['message']);process[_0x9d18('0x5c')](0x1);}function handleError(_0x66647c,_0x5e90d8){stats[_0x9d18('0x5d')][_0x9d18('0x1e')]({'name':_0x5e90d8[_0x9d18('0x5e')],'message':_0x5e90d8[_0x9d18('0x5f')],'row':_0x66647c});}function handleQuery(_0x45d8dd){logger[_0x9d18('0x59')](_0x45d8dd);return db[_0x9d18('0x60')][_0x9d18('0x61')](_0x45d8dd)[_0x9d18('0x62')](function(_0x39bb4b){results[_0x9d18('0x1e')](_0x39bb4b);})[_0x9d18('0x63')](function(_0x4a1ee7){logger[_0x9d18('0x5b')](_0x4a1ee7['message']);});}function updateTzCampaigns(_0x2dd977){return new Promise(function(_0x2706c5,_0x2081ab){var _0xb11451=squel[_0x9d18('0xf')]()[_0x9d18('0x31')]([_0x9d18('0x64'),'campaigns.dialTimezone'])[_0x9d18('0x12')]('campaigns')['join'](_0x9d18('0x65'),null,_0x9d18('0x66'))[_0x9d18('0x15')]('campaigns_has_cm_lists.CmListId='+_0x2dd977);db['sequelize'][_0x9d18('0x61')](_0xb11451[_0x9d18('0x38')]())[_0x9d18('0x62')](function(_0x1ebab0){var _0xefc070=[];for(var _0x225ecf=0x0;_0x225ecf<_0x1ebab0[_0x9d18('0x1b')];_0x225ecf++){_0xefc070[_0x9d18('0x1e')](getTimezoneData(_0x1ebab0[_0x225ecf],tmp_campaigns));}BPromise[_0x9d18('0x1c')](_0xefc070)[_0x9d18('0x1a')](function(){_0x2706c5({'val':0x1});});})[_0x9d18('0x63')](function(_0x59655d){logger[_0x9d18('0x5b')](_0x59655d[_0x9d18('0x5f')]);_0x2706c5({'val':0x0});});});}function updateTzVoiceQueues(_0x43bc63){return new Promise(function(_0x4f0ea9,_0x24dd75){var _0xc2afe4=squel[_0x9d18('0xf')]()['fields']([_0x9d18('0x67'),_0x9d18('0x68')])[_0x9d18('0x12')]('voice_queues')[_0x9d18('0x13')](_0x9d18('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x9d18('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x43bc63);db[_0x9d18('0x60')][_0x9d18('0x61')](_0xc2afe4['toString']())['spread'](function(_0x31d83a){var _0x128c0d=[];for(var _0x5822c1=0x0;_0x5822c1<_0x31d83a[_0x9d18('0x1b')];_0x5822c1++){_0x128c0d[_0x9d18('0x1e')](getTimezoneData(_0x31d83a[_0x5822c1],tmp_voice_queues));}BPromise[_0x9d18('0x1c')](_0x128c0d)[_0x9d18('0x1a')](function(){_0x4f0ea9({'val':0x1});});})[_0x9d18('0x63')](function(_0x4931a8){logger[_0x9d18('0x5b')](_0x4931a8['message']);_0x4f0ea9({'val':0x0});});});}function getTimezoneData(_0x5651f9,_0x7ecbe3){return new Promise(function(_0x426748,_0x39c4e4){var _0x5ed2f6=shared['timezones'];var _0x53743c=_0x5ed2f6[_0x5651f9['dialTimezone']];if(_[_0x9d18('0x20')](_0x53743c)){_0x426748({'ret':0x1});}else{var _0xd886=_0x53743c[_0x9d18('0x6a')];var _0x23b9e4=squel[_0x9d18('0x2a')]()[_0x9d18('0x3a')](_0x7ecbe3)[_0x9d18('0x6b')]('id',_0x5651f9['id'])[_0x9d18('0x6b')](_0x9d18('0x6c'),_0xd886)[_0x9d18('0x6b')](_0x9d18('0x6d'),_0x5651f9[_0x9d18('0x6d')])[_0x9d18('0x38')]();return db[_0x9d18('0x60')][_0x9d18('0x61')](_0x23b9e4)[_0x9d18('0x62')](function(_0x103624){_0x426748({'ret':0x1});})[_0x9d18('0x63')](function(_0xa0005a){logger['error'](_0xa0005a[_0x9d18('0x5f')]);_0x39c4e4({'ret':0x1});});}});}function handleTZQuery(_0x282004){logger[_0x9d18('0x59')](_0x282004);return db[_0x9d18('0x60')][_0x9d18('0x61')](_0x282004)[_0x9d18('0x62')](function(_0x5c5d33){})[_0x9d18('0x63')](function(_0x1af823){logger['error'](_0x1af823['message']);});}function main(_0x5f2d3b,_0x1c406e,_0x5ad1db,_0x722456){logger[_0x9d18('0x59')](_0x9d18('0x6e'),_0x5f2d3b,JSON['stringify'](_0x1c406e));process[_0x9d18('0x6f')](_0x9d18('0x70'));var _0x3ea154=_0x1c406e[_0x9d18('0x71')];var _0x5c0ad1=_['clone'](_0x3ea154);var _0x44207f=_0x1c406e[_0x9d18('0x72')];var _0x3bf81d=path['join'](config['root'],_0x9d18('0x73'),_0x44207f+_0x9d18('0x74'));hasTZ=_['keys'](_0x3ea154)['includes'](_0x9d18('0x6d'));var _0x28f70c=_[_0x9d18('0x53')](_0x3ea154)['join']();logger[_0x9d18('0x59')](_0x9d18('0x75'),_0x28f70c);db[_0x9d18('0x76')][_0x9d18('0x19')]({'raw':!![],'attributes':['id',_0x9d18('0x77')]})[_0x9d18('0x1a')](function(_0x1b5881){for(var _0x235c88=0x0;_0x235c88<_0x1b5881[_0x9d18('0x1b')];_0x235c88++){if(_0x1b5881[_0x235c88]['name']in _0x3ea154){contactItemTypes[_0x9d18('0x1e')](_0x1b5881[_0x235c88]);delete _0x5c0ad1[_0x1b5881[_0x235c88][_0x9d18('0x77')]];hasAdditionalPhones=!![];}for(var _0x22201b in _0x3ea154){if(_0x1b5881[_0x235c88][_0x9d18('0x77')]+_0x9d18('0x78')===_0x22201b){phoneDescriptions[_0x9d18('0x1e')]({'itemTypeId':_0x1b5881[_0x235c88]['id'],'description':_0x22201b});delete _0x5c0ad1[_0x22201b];}}}if(hasAdditionalPhones)_0x5c0ad1[_0x9d18('0x1d')]='';var _0x566e0d=_['keys'](_0x5c0ad1)[_0x9d18('0x13')]();logger[_0x9d18('0x59')]('header',_0x566e0d);fs[_0x9d18('0x79')](_0x3bf81d,_0x566e0d+'\x0a');Papa[_0x9d18('0x7a')](fs[_0x9d18('0x7b')](_0x5f2d3b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c4fb2,_0x1fa542){try{for(var _0x1a2b64=0x0,_0x3bf623=[];_0x1a2b64<_0x3c4fb2[_0x9d18('0x7c')][_0x9d18('0x1b')];_0x1a2b64++){stats[_0x9d18('0x7d')]+=0x1;if(_0x3c4fb2[_0x9d18('0x5d')][_0x1a2b64]){handleError(_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64],_0x3c4fb2[_0x9d18('0x5d')][_0x1a2b64]);}else{var _0xdeba24=[];var _0x48192d=[];var _0x2b68ef={};for(var _0x39e72c in _0x3ea154){let _0x243502=contactItemTypes[_0x9d18('0x7e')](_0x5989d9=>_0x5989d9[_0x9d18('0x77')]===_0x39e72c);let _0x371271=contactItemTypes[_0x9d18('0x7e')](_0x45672c=>_0x45672c[_0x9d18('0x77')]+_0x9d18('0x78')===_0x39e72c);if(_['isNil'](_0x243502)&&_[_0x9d18('0x20')](_0x371271)){if(_0x3ea154[_0x9d18('0x7f')](_0x39e72c)){if(_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64][_0x3ea154[_0x39e72c]]){var _0x4b85d1=_[_0x9d18('0x80')](_0x3c4fb2['data'][_0x1a2b64][_0x3ea154[_0x39e72c]][_0x9d18('0x81')](/"/g,'\x27'));switch(_0x39e72c){case _0x9d18('0x41'):var _0x42569d=moment(_0x4b85d1,_0x9d18('0xd'),!![]);if(_0x42569d[_0x9d18('0x82')]()){_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x4b85d1+'\x22');}else{_0xdeba24[_0x9d18('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x256590=parseInt(_0x4b85d1);_0x4b85d1=_[_0x9d18('0x83')](_0x256590)||_0x256590<0x0||_0x256590>0x4?_0x722456?0x3:0x2:_0x256590;_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x4b85d1+'\x22');break;case _0x9d18('0x30'):var _0x6ef16=parseInt(_0x4b85d1);if(_['isNumber'](_0x6ef16)&&_['includes'](_0x5ad1db,_0x6ef16)){_0x3bf623['push']('\x22'+_0x6ef16+'\x22');}else{_0xdeba24[_0x9d18('0x1e')](_0x9d18('0x84'));}break;case _0x9d18('0x85'):if(isEmail(_0x4b85d1)){_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x4b85d1+'\x22');}else{_0xdeba24[_0x9d18('0x1e')]('email\x20wrong\x20format');}break;case _0x9d18('0x86'):var _0x379e47=moment(_0x4b85d1,_0x9d18('0x87'),!![]);if(_0x379e47['isValid']()){_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x4b85d1+'\x22');}else{_0xdeba24[_0x9d18('0x1e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x9d18('0x6d'):var _0x19e3e4=shared[_0x9d18('0x88')];var _0x3021e5=_0x19e3e4[_0x4b85d1];if(!_['isNil'](_0x3021e5)){var _0x17e8d2=_0x3021e5[_0x9d18('0x6a')];_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x4b85d1+'\x22');_0x3bf623['push']('\x22'+_0x17e8d2+'\x22');}break;default:_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x4b85d1+'\x22');}}else{switch(_0x39e72c){case _0x9d18('0x89'):case'phone':_0xdeba24[_0x9d18('0x1e')](_0x39e72c+_0x9d18('0x8a'));break;default:_0x3bf623[_0x9d18('0x1e')]('\x22\x22');}}}}else{var _0x17e168='';if(!_['isNil'](_0x243502)){if(!_0x2b68ef[_0x9d18('0x7f')](_0x243502['id'])){if(!_[_0x9d18('0x20')](_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64][_0x3ea154[_0x39e72c]])){var _0x4b85d1=_[_0x9d18('0x80')](_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64][_0x3ea154[_0x39e72c]][_0x9d18('0x81')](/"/g,'\x27'));var _0x7592c3=phoneDescriptions[_0x9d18('0x7e')](_0x4639c0=>_0x4639c0[_0x9d18('0x8b')]===_0x243502['id']);if(!_[_0x9d18('0x20')](_0x7592c3)){var _0x2915cd=_[_0x9d18('0x80')](_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64][_0x3ea154[_0x7592c3[_0x9d18('0x8c')]]][_0x9d18('0x81')](/"/g,'\x27'));if(!_['isNil'](_0x2915cd))_0x4b85d1=_0x4b85d1+'§'+_0x2915cd;}if(_0x17e168=='')_0x17e168=_0x4b85d1;else _0x17e168+='|'+_0x4b85d1;}_0x48192d[_0x9d18('0x1e')](_0x243502['id']+':'+_0x17e168);_0x2b68ef[_0x243502['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3bf623[_0x9d18('0x1e')]('\x22'+_0x48192d['join'](';')+'\x22');}if(_0xdeba24[_0x9d18('0x1b')]){handleError(_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64],{'code':_0x9d18('0x8d'),'message':_0xdeba24[_0x9d18('0x13')]()});}else{fs[_0x9d18('0x8e')](_0x3bf81d,_0x3bf623[_0x9d18('0x13')]()+'\x0a');}_0x3bf623=[];}if(!(stats[_0x9d18('0x7d')]%0xc8)){socket[_0x9d18('0x8f')]('contact:import:'+_0x44207f,stats);stats['errors']=[];}}if(stopped){logger[_0x9d18('0x59')](_0x9d18('0x90'));_0x1fa542[_0x9d18('0x91')]();}}catch(_0x257e83){handleError(_0x3c4fb2[_0x9d18('0x7c')][_0x1a2b64],{'code':_0x9d18('0x92'),'message':_0x257e83['message']});logger['error'](_0x9d18('0x93'),_0x257e83[_0x9d18('0x5f')]);}},'complete':function(){try{var _0x1fb2e2=[];var _0x3d9b30=[];var _0x153e43='cm_contacts';if(_0x1c406e[_0x9d18('0x94')]&&_0x1c406e[_0x9d18('0x94')]['length']){_0x153e43=_0x9d18('0x95')+_0x44207f;_0x1fb2e2[_0x9d18('0x1e')](_0x9d18('0x96')+_0x153e43+_0x9d18('0x97'));}tmp_campaigns=_0x9d18('0x98')+_0x44207f;tmp_voice_queues=_0x9d18('0x99')+_0x44207f;_0x3d9b30['push'](_0x9d18('0x96')+tmp_campaigns+_0x9d18('0x9a'));_0x3d9b30[_0x9d18('0x1e')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x9d18('0x9a'));BPromise[_0x9d18('0x9b')](_0x3d9b30,handleTZQuery)[_0x9d18('0x1a')](function(_0x5877e9){updateTzCampaigns(_0x1c406e[_0x9d18('0x2d')])[_0x9d18('0x1a')](function(_0x558250){updateTzVoiceQueues(_0x1c406e[_0x9d18('0x2d')])[_0x9d18('0x1a')](function(_0xc27327){if(hasTZ)_0x566e0d=_0x566e0d[_0x9d18('0x81')](_0x9d18('0x6d'),_0x9d18('0x9c'));var _0xfc487=util['format'](_0x9d18('0x9d'),_0x3bf81d,_0x153e43,_0x566e0d,_0x1c406e[_0x9d18('0x2d')],_0x1c406e[_0x9d18('0x9e')]||null,NOW,NOW);if(_[_0x9d18('0x20')](_0x3ea154[_0x9d18('0x41')])){_0xfc487+=_0x9d18('0x9f');}_0x1fb2e2[_0x9d18('0x1e')](_0xfc487);if(_0x1c406e[_0x9d18('0x94')]&&_0x1c406e[_0x9d18('0x94')][_0x9d18('0x1b')]){_0x1fb2e2['push'](insertCmContact(_0x1c406e['ListId'],_0x153e43,_0x1c406e[_0x9d18('0x94')],_0x3ea154));_0x1fb2e2[_0x9d18('0x1e')](_0x9d18('0xa0')+_0x153e43+';');}BPromise[_0x9d18('0x9b')](_0x1fb2e2,handleQuery)[_0x9d18('0x1a')](function(_0x4955eb){BPromise[_0x9d18('0x1c')]([handleAdditionalPhones()])[_0x9d18('0x1a')](function(){_0x1fb2e2=[];for(var _0x5e9e8c=0x0;_0x5e9e8c\x20\x20','existsSync','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','split','then','isNil','filter','findOne','update','updated','CmContactHasItem','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','ListId\x20=\x20?','priority','.CmListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0xb22c,0x108));var _0xcb22=function(_0x55aa8a,_0x1bbae4){_0x55aa8a=_0x55aa8a-0x0;var _0x2e4710=_0xb22c[_0x55aa8a];return _0x2e4710;};'use strict';var fs=require('fs');var path=require(_0xcb22('0x0'));var _=require(_0xcb22('0x1'));var Papa=require(_0xcb22('0x2'));var util=require(_0xcb22('0x3'));var BPromise=require(_0xcb22('0x4'));var moment=require(_0xcb22('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xcb22('0x6'))['db'];var config=require(_0xcb22('0x7'));var shared=require(_0xcb22('0x8'));var logger=require(_0xcb22('0x9'))(_0xcb22('0xa'));config[_0xcb22('0xb')]=_[_0xcb22('0xc')](config['redis'],{'host':_0xcb22('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb22('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xcb22('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xcb22('0xf')](_0xcb22('0xe'));function isEmail(_0x464117){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))*$/[_0xcb22('0x10')](_0x464117);}function selectNotIn(_0x5e4633,_0x3ba3c7,_0x5362d0,_0x2082b5,_0x4d41b5){return squel[_0xcb22('0x11')]()[_0xcb22('0x12')](_0xcb22('0x13'))['from'](_0x2082b5)[_0xcb22('0x14')](_0x3ba3c7,null,_0x3ba3c7+_0xcb22('0x15')+_0x2082b5+'.'+_0x5362d0)[_0xcb22('0x16')](_0x2082b5+'.'+_0x5362d0+_0xcb22('0x17')+_0x5e4633+'.'+_0x5362d0)[_0xcb22('0x16')](_0x3ba3c7+_0xcb22('0x18')+_0x4d41b5['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x51a846,_0x4a29c4){promisesAdditionalPhones=[];return db[_0xcb22('0x19')][_0xcb22('0x1a')]({'raw':!![],'attributes':['id',_0xcb22('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4a23c4){if(_0x4a23c4!==null){var _0x2f08bf=[];for(var _0x1969cd=0x0;_0x1969cd<_0x4a23c4[_0xcb22('0x1c')];_0x1969cd++){var _0x355212=_0x4a23c4[_0x1969cd];_0x2f08bf[_0xcb22('0x1d')](insertAdditionalPhones(_0x355212));}}Promise[_0xcb22('0x1e')](_0x2f08bf)['then'](function(){_0x51a846({'val':0x1});});});});}function insertAdditionalPhones(_0x1902cb){return new Promise(function(_0x282c56,_0x42ed7b){var _0x4041fb=_0x1902cb[_0xcb22('0x1b')];var _0x2e9f78=_0x4041fb[_0xcb22('0x1f')](';');var _0x5d4109=[];orderBy=0x0;for(var _0x1cffe3=0x0;_0x1cffe3<_0x2e9f78[_0xcb22('0x1c')];_0x1cffe3++){_0x5d4109[_0xcb22('0x1d')](splitAdditionalPhone(_0x1902cb['id'],_0x2e9f78[_0x1cffe3]));}Promise[_0xcb22('0x1e')](_0x5d4109)[_0xcb22('0x20')](function(){_0x282c56({'val':_0x2e9f78['length']});});});}function splitAdditionalPhone(_0x6bb31b,_0x4804a8){return new Promise(function(_0x45ec05,_0x3e6b47){var _0x78021f=_0x4804a8[_0xcb22('0x1f')](':');var _0x48f580=_0x78021f[0x0];var _0x3ea145=_0x78021f[0x1];if(!_[_0xcb22('0x21')](_0x3ea145)){var _0x37a218=_0x3ea145[_0xcb22('0x1f')]('|');var _0x4dc271=[];for(var _0x97fc6e=0x0;_0x97fc6e<_0x37a218[_0xcb22('0x1c')];_0x97fc6e++){if(_0x37a218[_0x97fc6e]!==''){var _0x56895c=_[_0xcb22('0x22')](promisesAdditionalPhones,{'contactId':_0x6bb31b,'phone':_0x37a218[_0x97fc6e]});if(_0x56895c['length']==0x0){orderBy++;promisesAdditionalPhones[_0xcb22('0x1d')]({'contactId':_0x6bb31b,'contactTypeId':_0x48f580,'phone':_0x37a218[_0x97fc6e],'orderBy':orderBy});}}}_0x45ec05({'ok':0x1});}else _0x45ec05({'res':0x0});});}function createAdditionalPhone(_0x382ae1,_0x1818fd,_0x4833a4,_0x474abf){var _0x93ceec='';var _0x168998='';var _0x144b91=_0x4833a4[_0xcb22('0x1f')]('§');_0x93ceec=_0x144b91[0x0];if(_0x144b91[_0xcb22('0x1c')]==0x2)_0x168998=_0x144b91[0x1];return new Promise(function(_0x5b9316,_0x18456e){return db['CmContactHasItem'][_0xcb22('0x23')]({'where':{'CmContactId':_0x382ae1,'item':_0x93ceec}})[_0xcb22('0x20')](function(_0xd7e779){if(_0xd7e779){return db['CmContactHasItem'][_0xcb22('0x24')]({'ItemTypeId':_0x1818fd,'description':_0x168998,'OrderBy':_0x474abf},{'where':{'CmContactId':_0x382ae1,'item':_0x93ceec}})['then'](function(_0x3aefdd){_0x5b9316({'res':_0xcb22('0x25')});});}else{return db[_0xcb22('0x26')]['create']({'CmContactId':_0x382ae1,'item':_0x93ceec,'description':_0x168998,'ItemTypeId':_0x1818fd,'OrderBy':_0x474abf,'ItemClass':_0xcb22('0x27')})[_0xcb22('0x20')](function(_0x393fa){_0x5b9316({'res':_0xcb22('0x28')});});}});});}function insertCmHopper(_0x193020,_0x44a618,_0x1b4ae7,_0x1ccb75,_0x16f3c3){var _0x5b6842=[_0xcb22('0x29'),'cm_contacts.scheduledat','cm_contacts.id',_0xcb22('0x2a'),_0x44a618+'.'+_0x1ccb75,_0xcb22('0x2b'),_0xcb22('0x2c'),_0xcb22('0x2d'),_0xcb22('0x2e'),'\x22'+_0x16f3c3+'\x22'];return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x31'))[_0xcb22('0x32')]([_0xcb22('0x13'),_0xcb22('0x33'),_0xcb22('0x34'),_0xcb22('0x35'),_0x1ccb75,_0xcb22('0x36'),_0xcb22('0x37'),'priority',_0xcb22('0x38'),_0xcb22('0x39')],squel['select']()[_0xcb22('0x3a')](_0x5b6842)[_0xcb22('0x3b')](_0x44a618)[_0xcb22('0x14')](_0xcb22('0x3c'),null,_0xcb22('0x3d')+_0x44a618+_0xcb22('0x3e'))[_0xcb22('0x14')](_0x1b4ae7,null,_0x1b4ae7+_0xcb22('0x15')+_0x44a618+'.'+_0x1ccb75)[_0xcb22('0x16')](_0x44a618+'.CmListId\x20=\x20?',_0x193020)[_0xcb22('0x16')](_0xcb22('0x3f'),NOW)[_0xcb22('0x16')](_0xcb22('0x40'),selectNotIn(_0x44a618,_0x1b4ae7,_0x1ccb75,_0xcb22('0x31'),[_0xcb22('0x41'),_0xcb22('0x42')]))[_0xcb22('0x16')](_0xcb22('0x40'),selectNotIn(_0x44a618,_0x1b4ae7,_0x1ccb75,_0xcb22('0x31'),[_0xcb22('0x41')])))[_0xcb22('0x43')]();}function insertCmHopperBlack(_0x27b13a,_0x5a7b7b,_0x36dcca,_0x43a81b){var _0x21cbf3=[_0xcb22('0x29'),_0xcb22('0x44'),_0xcb22('0x2a'),_0x5a7b7b+'.'+_0x43a81b,_0xcb22('0x2b'),_0xcb22('0x2c')];return squel['insert']()['into'](_0xcb22('0x45'))[_0xcb22('0x32')]([_0xcb22('0x13'),'ContactId','ListId',_0x43a81b,_0xcb22('0x36'),'updatedAt'],squel['select']()[_0xcb22('0x3a')](_0x21cbf3)['from'](_0x5a7b7b)[_0xcb22('0x14')](_0xcb22('0x3c'),null,_0xcb22('0x3d')+_0x5a7b7b+_0xcb22('0x3e'))['join'](_0x36dcca,null,_0x36dcca+'.id\x20=\x20'+_0x5a7b7b+'.'+_0x43a81b)['where'](_0x5a7b7b+'.CmListId\x20=\x20?',_0x27b13a)[_0xcb22('0x16')](_0xcb22('0x3f'),NOW)[_0xcb22('0x16')](_0xcb22('0x40'),squel[_0xcb22('0x11')]()['field'](_0xcb22('0x13'))[_0xcb22('0x3b')](_0xcb22('0x45'))[_0xcb22('0x16')](_0xcb22('0x46'),_0x27b13a)[_0xcb22('0x16')](_0x43a81b+_0xcb22('0x17')+_0x5a7b7b+'.'+_0x43a81b)))[_0xcb22('0x43')]();}function insertTzCmHopper(_0x13f82d,_0x47df32,_0x188651,_0x3bc17e,_0x11e743,_0x4aef67){var _0x23b7b4=[_0xcb22('0x29'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x4aef67+'.offset-cm_contacts.utcOffset\x20minute)',_0xcb22('0x44'),_0xcb22('0x2a'),_0x47df32+'.'+_0x3bc17e,_0xcb22('0x2b'),_0xcb22('0x2c'),_0xcb22('0x2d'),_0xcb22('0x2e'),'\x22'+_0x11e743+'\x22'];var _0x4d6a2f=squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x31'))[_0xcb22('0x32')]([_0xcb22('0x13'),_0xcb22('0x33'),_0xcb22('0x34'),_0xcb22('0x35'),_0x3bc17e,_0xcb22('0x36'),_0xcb22('0x37'),_0xcb22('0x47'),_0xcb22('0x38'),_0xcb22('0x39')],squel[_0xcb22('0x11')]()[_0xcb22('0x3a')](_0x23b7b4)['from'](_0x47df32)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x47df32+_0xcb22('0x3e'))[_0xcb22('0x14')](_0x188651,null,_0x188651+'.id\x20=\x20'+_0x47df32+'.'+_0x3bc17e)[_0xcb22('0x14')](_0x4aef67,null,_0x4aef67+_0xcb22('0x15')+_0x47df32+'.'+_0x3bc17e)[_0xcb22('0x16')](_0x47df32+_0xcb22('0x48'),_0x13f82d)[_0xcb22('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xcb22('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x47df32,_0x188651,_0x3bc17e,'cm_hopper',[_0xcb22('0x41'),_0xcb22('0x42')]))[_0xcb22('0x16')](_0xcb22('0x40'),selectNotIn(_0x47df32,_0x188651,_0x3bc17e,'cm_hopper',[_0xcb22('0x41')])))[_0xcb22('0x43')]();return _0x4d6a2f;}function insertTzCmHopperBlack(_0x32689b,_0x3dc565,_0x218ec4,_0x94f2a3){var _0x80000a=[_0xcb22('0x29'),_0xcb22('0x44'),_0xcb22('0x2a'),_0x3dc565+'.'+_0x94f2a3,'cm_contacts.createdAt',_0xcb22('0x2c')];return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x45'))[_0xcb22('0x32')]([_0xcb22('0x13'),_0xcb22('0x34'),'ListId',_0x94f2a3,_0xcb22('0x36'),_0xcb22('0x37')],squel[_0xcb22('0x11')]()['fields'](_0x80000a)[_0xcb22('0x3b')](_0x3dc565)['join']('cm_contacts',null,_0xcb22('0x3d')+_0x3dc565+_0xcb22('0x3e'))['join'](_0x218ec4,null,_0x218ec4+_0xcb22('0x15')+_0x3dc565+'.'+_0x94f2a3)[_0xcb22('0x16')](_0x3dc565+_0xcb22('0x48'),_0x32689b)['where'](_0xcb22('0x3f'),NOW)[_0xcb22('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcb22('0x12')](_0xcb22('0x13'))[_0xcb22('0x3b')](_0xcb22('0x45'))[_0xcb22('0x16')](_0xcb22('0x46'),_0x32689b)[_0xcb22('0x16')](_0x94f2a3+'\x20=\x20'+_0x3dc565+'.'+_0x94f2a3)))[_0xcb22('0x43')]();}function insertCmHopperAdditionalPhones(_0x5b4166){var _0x17cc0a=[_0xcb22('0x49'),_0xcb22('0x4a'),_0xcb22('0x4b'),_0xcb22('0x4c'),_0xcb22('0x4d')];return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')]('cm_hopper_additional_phones')['fromQuery']([_0xcb22('0x4e'),'phone','OrderBy',_0xcb22('0x36'),_0xcb22('0x37')],squel[_0xcb22('0x11')]()['fields'](_0x17cc0a)[_0xcb22('0x3b')](_0xcb22('0x31'))[_0xcb22('0x14')]('cm_contacts',null,_0xcb22('0x4f'))[_0xcb22('0x14')](_0xcb22('0x50'),null,_0xcb22('0x51'))[_0xcb22('0x16')](_0xcb22('0x52'),_0x5b4166)[_0xcb22('0x16')](_0xcb22('0x3f'),NOW))[_0xcb22('0x43')]();}function insertCmContact(_0x371435,_0x3d596f,_0x554c6f,_0x5b3600){var _0x3f246b=_[_0xcb22('0x53')](_[_0xcb22('0x54')](_0x5b3600),['ListId',_0xcb22('0x55'),_0xcb22('0x36'),_0xcb22('0x37'),_0xcb22('0x56')]);return squel[_0xcb22('0x2f')]()[_0xcb22('0x30')](_0xcb22('0x3c'))[_0xcb22('0x32')](_0x3f246b,squel['select']()['fields'](_0x3f246b)['from'](_0x3d596f)[_0xcb22('0x16')]('('+_0x554c6f[_0xcb22('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0xcb22('0x11')]()[_0xcb22('0x3a')](_0x554c6f)[_0xcb22('0x3b')]('cm_contacts')[_0xcb22('0x16')](_0xcb22('0x46'),_0x371435)[_0xcb22('0x16')](_0xcb22('0x57')))['where'](_0xcb22('0x58'),squel[_0xcb22('0x11')]()[_0xcb22('0x12')](_0xcb22('0x59'),'min_id')[_0xcb22('0x3b')](_0x3d596f)[_0xcb22('0x5a')](_0x554c6f[_0xcb22('0x14')](','))))[_0xcb22('0x43')]();}function handleStop(){logger[_0xcb22('0x5b')](_0xcb22('0x5c'));stopped=!![];}function handleUncaughtException(_0x1ad81f){logger[_0xcb22('0x5d')](_0x1ad81f[_0xcb22('0x5e')]);process[_0xcb22('0x5f')](0x1);}function handleError(_0x49ee19,_0x3c7e6e){stats[_0xcb22('0x60')]['push']({'name':_0x3c7e6e[_0xcb22('0x61')],'message':_0x3c7e6e['message'],'row':_0x49ee19});}function handleQuery(_0x24d65b){logger[_0xcb22('0x5b')](_0x24d65b);return db[_0xcb22('0x62')][_0xcb22('0x63')](_0x24d65b)[_0xcb22('0x64')](function(_0x471a1f){results[_0xcb22('0x1d')](_0x471a1f);})[_0xcb22('0x65')](function(_0x285216){logger[_0xcb22('0x5d')](_0x285216['message']);});}function updateTzCampaigns(_0x249f6f){return new Promise(function(_0x5ab3d6,_0x2dc087){var _0x30e329=squel[_0xcb22('0x11')]()['fields']([_0xcb22('0x66'),_0xcb22('0x67')])['from'](_0xcb22('0x68'))['join']('campaigns_has_cm_lists',null,_0xcb22('0x69'))['where'](_0xcb22('0x6a')+_0x249f6f);db['sequelize'][_0xcb22('0x63')](_0x30e329[_0xcb22('0x43')]())[_0xcb22('0x64')](function(_0x40106c){var _0x4b0e54=[];for(var _0x4bf52e=0x0;_0x4bf52e<_0x40106c['length'];_0x4bf52e++){_0x4b0e54[_0xcb22('0x1d')](getTimezoneData(_0x40106c[_0x4bf52e],tmp_campaigns));}BPromise[_0xcb22('0x1e')](_0x4b0e54)['then'](function(){_0x5ab3d6({'val':0x1});});})['catch'](function(_0x21362c){logger[_0xcb22('0x5d')](_0x21362c[_0xcb22('0x5e')]);_0x5ab3d6({'val':0x0});});});}function updateTzVoiceQueues(_0x5808fa){return new Promise(function(_0x1bba36,_0x4ec494){var _0x2c83f9=squel[_0xcb22('0x11')]()[_0xcb22('0x3a')](['voice_queues.id',_0xcb22('0x6b')])[_0xcb22('0x3b')](_0xcb22('0x6c'))[_0xcb22('0x14')](_0xcb22('0x6d'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xcb22('0x16')](_0xcb22('0x6e')+_0x5808fa);db[_0xcb22('0x62')]['query'](_0x2c83f9[_0xcb22('0x43')]())[_0xcb22('0x64')](function(_0x515c05){var _0x4b47ce=[];for(var _0xdac442=0x0;_0xdac442<_0x515c05[_0xcb22('0x1c')];_0xdac442++){_0x4b47ce[_0xcb22('0x1d')](getTimezoneData(_0x515c05[_0xdac442],tmp_voice_queues));}BPromise[_0xcb22('0x1e')](_0x4b47ce)[_0xcb22('0x20')](function(){_0x1bba36({'val':0x1});});})[_0xcb22('0x65')](function(_0x49809d){logger['error'](_0x49809d[_0xcb22('0x5e')]);_0x1bba36({'val':0x0});});});}function getTimezoneData(_0x4eb171,_0x1ec6ef){return new Promise(function(_0x3054c3,_0x8525f9){var _0x5a3f45=shared['timezones'];var _0x14e15b=_0x5a3f45[_0x4eb171['dialTimezone']];if(_[_0xcb22('0x21')](_0x14e15b)){_0x3054c3({'ret':0x1});}else{var _0x109543=_0x14e15b[_0xcb22('0x6f')];var _0x14b66b=squel['insert']()['into'](_0x1ec6ef)[_0xcb22('0x70')]('id',_0x4eb171['id'])[_0xcb22('0x70')](_0xcb22('0x71'),_0x109543)['set']('dialTimezone',_0x4eb171[_0xcb22('0x72')])['toString']();return db[_0xcb22('0x62')][_0xcb22('0x63')](_0x14b66b)['spread'](function(_0x171d53){_0x3054c3({'ret':0x1});})['catch'](function(_0x4cff6f){logger[_0xcb22('0x5d')](_0x4cff6f[_0xcb22('0x5e')]);_0x8525f9({'ret':0x1});});}});}function handleTZQuery(_0x30c3a9){logger['info'](_0x30c3a9);return db['sequelize']['query'](_0x30c3a9)[_0xcb22('0x64')](function(_0x990992){})['catch'](function(_0x4cd288){logger[_0xcb22('0x5d')](_0x4cd288[_0xcb22('0x5e')]);});}function main(_0x34a392,_0x4f898a,_0x3309b0,_0x4605b6){logger[_0xcb22('0x5b')](_0xcb22('0x73'),_0x34a392,JSON[_0xcb22('0x74')](_0x4f898a));process[_0xcb22('0x75')](_0xcb22('0x76'));var _0x23b049=_0x4f898a[_0xcb22('0x77')];var _0x4d4e49=_[_0xcb22('0x78')](_0x23b049);var _0x561e98=_0x4f898a[_0xcb22('0x79')];var _0x12e5ed=path[_0xcb22('0x14')](config[_0xcb22('0x7a')],_0xcb22('0x7b'),_0x561e98+'.csv');hasTZ=_[_0xcb22('0x54')](_0x23b049)[_0xcb22('0x7c')](_0xcb22('0x72'));var _0x431407=_['keys'](_0x23b049)[_0xcb22('0x14')]();logger[_0xcb22('0x5b')](_0xcb22('0x7d'),_0x431407);db[_0xcb22('0x7e')][_0xcb22('0x1a')]({'raw':!![],'attributes':['id',_0xcb22('0x7f')]})[_0xcb22('0x20')](function(_0x45b912){for(var _0xd07b4f=0x0;_0xd07b4f<_0x45b912['length'];_0xd07b4f++){if(_0x45b912[_0xd07b4f]['name']in _0x23b049){contactItemTypes[_0xcb22('0x1d')](_0x45b912[_0xd07b4f]);delete _0x4d4e49[_0x45b912[_0xd07b4f][_0xcb22('0x7f')]];hasAdditionalPhones=!![];}for(var _0x38ef8b in _0x23b049){if(_0x45b912[_0xd07b4f][_0xcb22('0x7f')]+'_description'===_0x38ef8b){phoneDescriptions[_0xcb22('0x1d')]({'itemTypeId':_0x45b912[_0xd07b4f]['id'],'description':_0x38ef8b});delete _0x4d4e49[_0x38ef8b];}}}if(hasAdditionalPhones)_0x4d4e49[_0xcb22('0x1b')]='';var _0x367511=_[_0xcb22('0x54')](_0x4d4e49)[_0xcb22('0x14')]();logger[_0xcb22('0x5b')](_0xcb22('0x7d'),_0x367511);fs[_0xcb22('0x80')](_0x12e5ed,_0x367511+'\x0a');Papa[_0xcb22('0x81')](fs[_0xcb22('0x82')](_0x34a392),{'header':!![],'skipEmptyLines':!![],'step':function(_0x29f20d,_0x52bbdd){try{for(var _0xc44340=0x0,_0x2b4637=[];_0xc44340<_0x29f20d[_0xcb22('0x83')][_0xcb22('0x1c')];_0xc44340++){stats['rows']+=0x1;if(_0x29f20d[_0xcb22('0x60')][_0xc44340]){handleError(_0x29f20d[_0xcb22('0x83')][_0xc44340],_0x29f20d[_0xcb22('0x60')][_0xc44340]);}else{var _0x24e843=[];var _0x58c858=[];var _0x63e724={};for(var _0x5139a8 in _0x23b049){let _0x15232a=contactItemTypes[_0xcb22('0x84')](_0xc73950=>_0xc73950[_0xcb22('0x7f')]===_0x5139a8);let _0x1dc3dc=contactItemTypes[_0xcb22('0x84')](_0x2a04e1=>_0x2a04e1[_0xcb22('0x7f')]+_0xcb22('0x85')===_0x5139a8);if(_[_0xcb22('0x21')](_0x15232a)&&_['isNil'](_0x1dc3dc)){if(_0x23b049[_0xcb22('0x86')](_0x5139a8)){if(_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]]){var _0x3af75f=_['trim'](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]]['replace'](/"/g,'\x27'));switch(_0x5139a8){case'scheduledat':var _0x597720=moment(_0x3af75f,_0xcb22('0xe'),!![]);if(_0x597720['isValid']()){_0x2b4637['push']('\x22'+_0x3af75f+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x87'));}break;case _0xcb22('0x47'):var _0x4f23ed=parseInt(_0x3af75f);_0x3af75f=_[_0xcb22('0x88')](_0x4f23ed)||_0x4f23ed<0x0||_0x4f23ed>0x4?_0x4605b6?0x3:0x2:_0x4f23ed;_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');break;case _0xcb22('0x38'):var _0x50945a=parseInt(_0x3af75f);if(_[_0xcb22('0x89')](_0x50945a)&&_[_0xcb22('0x7c')](_0x3309b0,_0x50945a)){_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x50945a+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x8a'));}break;case _0xcb22('0x8b'):if(isEmail(_0x3af75f)){_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x8c'));}break;case _0xcb22('0x8d'):var _0x26047c=moment(_0x3af75f,_0xcb22('0x8e'),!![]);if(_0x26047c[_0xcb22('0x8f')]()){_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');}else{_0x24e843[_0xcb22('0x1d')](_0xcb22('0x90'));}break;case _0xcb22('0x72'):var _0xdc07d0=shared[_0xcb22('0x91')];var _0x536f48=_0xdc07d0[_0x3af75f];if(!_[_0xcb22('0x21')](_0x536f48)){var _0x43527b=_0x536f48['utcOffset'];_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x3af75f+'\x22');_0x2b4637[_0xcb22('0x1d')]('\x22'+_0x43527b+'\x22');}break;default:_0x2b4637['push']('\x22'+_0x3af75f+'\x22');}}else{switch(_0x5139a8){case _0xcb22('0x92'):case _0xcb22('0x13'):_0x24e843[_0xcb22('0x1d')](_0x5139a8+_0xcb22('0x93'));break;default:_0x2b4637[_0xcb22('0x1d')]('\x22\x22');}}}}else{var _0x29b101='';if(!_[_0xcb22('0x21')](_0x15232a)){if(!_0x63e724[_0xcb22('0x86')](_0x15232a['id'])){if(!_[_0xcb22('0x21')](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]])){var _0x3af75f=_[_0xcb22('0x94')](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0x5139a8]][_0xcb22('0x95')](/"/g,'\x27'));var _0xa7d1c6=phoneDescriptions[_0xcb22('0x84')](_0xbc06de=>_0xbc06de[_0xcb22('0x96')]===_0x15232a['id']);if(!_[_0xcb22('0x21')](_0xa7d1c6)){var _0x2ed6d6=_['trim'](_0x29f20d[_0xcb22('0x83')][_0xc44340][_0x23b049[_0xa7d1c6[_0xcb22('0x97')]]][_0xcb22('0x95')](/"/g,'\x27'));if(!_[_0xcb22('0x21')](_0x2ed6d6))_0x3af75f=_0x3af75f+'§'+_0x2ed6d6;}if(_0x29b101=='')_0x29b101=_0x3af75f;else _0x29b101+='|'+_0x3af75f;}_0x58c858[_0xcb22('0x1d')](_0x15232a['id']+':'+_0x29b101);_0x63e724[_0x15232a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b4637['push']('\x22'+_0x58c858['join'](';')+'\x22');}if(_0x24e843[_0xcb22('0x1c')]){handleError(_0x29f20d[_0xcb22('0x83')][_0xc44340],{'code':'SystemRow','message':_0x24e843['join']()});}else{fs[_0xcb22('0x98')](_0x12e5ed,_0x2b4637[_0xcb22('0x14')]()+'\x0a');}_0x2b4637=[];}if(!(stats[_0xcb22('0x99')]%0xc8)){socket[_0xcb22('0x9a')]('contact:import:'+_0x561e98,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xcb22('0x9b'));_0x52bbdd[_0xcb22('0x9c')]();}}catch(_0x10c87d){handleError(_0x29f20d['data'][_0xc44340],{'code':_0xcb22('0x9d'),'message':_0x10c87d[_0xcb22('0x5e')]});logger[_0xcb22('0x5d')](_0xcb22('0x9e'),_0x10c87d['message']);}},'complete':function(){try{var _0x1bae0b=[];var _0xaff53c=[];var _0x4c16ed=_0xcb22('0x3c');if(_0x4f898a[_0xcb22('0x9f')]&&_0x4f898a[_0xcb22('0x9f')]['length']){_0x4c16ed='cm_contacts_'+_0x561e98;_0x1bae0b['push'](_0xcb22('0xa0')+_0x4c16ed+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x561e98;tmp_voice_queues=_0xcb22('0xa1')+_0x561e98;_0xaff53c['push'](_0xcb22('0xa0')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0xaff53c[_0xcb22('0x1d')](_0xcb22('0xa0')+tmp_voice_queues+_0xcb22('0xa2'));BPromise[_0xcb22('0xa3')](_0xaff53c,handleTZQuery)[_0xcb22('0x20')](function(_0x438774){updateTzCampaigns(_0x4f898a['ListId'])['then'](function(_0x48d93d){updateTzVoiceQueues(_0x4f898a['ListId'])['then'](function(_0x2257f1){if(hasTZ)_0x367511=_0x367511['replace'](_0xcb22('0x72'),_0xcb22('0xa4'));var _0x2f533f=util[_0xcb22('0xf')]('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',_0x12e5ed,_0x4c16ed,_0x367511,_0x4f898a[_0xcb22('0x35')],_0x4f898a['CompanyId']||null,NOW,NOW);if(_[_0xcb22('0x21')](_0x23b049[_0xcb22('0x33')])){_0x2f533f+=_0xcb22('0xa5');}_0x1bae0b[_0xcb22('0x1d')](_0x2f533f);if(_0x4f898a['duplicates']&&_0x4f898a[_0xcb22('0x9f')]['length']){_0x1bae0b[_0xcb22('0x1d')](insertCmContact(_0x4f898a[_0xcb22('0x35')],_0x4c16ed,_0x4f898a[_0xcb22('0x9f')],_0x23b049));_0x1bae0b['push'](_0xcb22('0xa6')+_0x4c16ed+';');}BPromise[_0xcb22('0xa3')](_0x1bae0b,handleQuery)['then'](function(_0xf9dd67){BPromise[_0xcb22('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x1bae0b=[];for(var _0x4b3486=0x0;_0x4b3486\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../config/logger','import','defaults','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','message','split','filter','CmContactHasItem','findOne','update','create','PHONE','CmContact','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','cm_contacts.ListId','insert','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x3134,0xdf));var _0x4313=function(_0x430041,_0x484afa){_0x430041=_0x430041-0x0;var _0x50dc27=_0x3134[_0x430041];return _0x50dc27;};'use strict';var fs=require('fs');var path=require(_0x4313('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x4313('0x1'));var BPromise=require(_0x4313('0x2'));var moment=require(_0x4313('0x3'));var squel=require(_0x4313('0x4'));var Redis=require(_0x4313('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x4313('0x6'))(_0x4313('0x7'));config['redis']=_[_0x4313('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4313('0x9'))(new Redis(config[_0x4313('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x4313('0xb')](_0x4313('0xc'));var tempTableName=_0x4313('0xd')+moment()[_0x4313('0xb')](_0x4313('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x333913){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))*$/[_0x4313('0xf')](_0x333913);}function selectNotIn(_0x49e6c0,_0x3dfa75,_0x11329a,_0x7d6c8,_0x523cea){return squel[_0x4313('0x10')]()[_0x4313('0x11')](_0x4313('0x12'))[_0x4313('0x13')](_0x7d6c8)[_0x4313('0x14')](_0x3dfa75,null,_0x3dfa75+_0x4313('0x15')+_0x7d6c8+'.'+_0x11329a)[_0x4313('0x16')](_0x7d6c8+'.'+_0x11329a+_0x4313('0x17')+_0x49e6c0+'.'+_0x11329a)[_0x4313('0x16')](_0x3dfa75+_0x4313('0x18')+_0x523cea[_0x4313('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2ca18f,_0x176aac){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4313('0x19')][_0x4313('0x1a')](_0x4313('0x1b')+tempTableName)[_0x4313('0x1c')](function(_0x3750c7){if(_0x3750c7!==null){var _0x4826d5=[];for(var _0x3eaf4a=0x0;_0x3eaf4a<_0x3750c7[_0x4313('0x1d')];_0x3eaf4a++){var _0x5c37e9=_0x3750c7[_0x3eaf4a];if(!_[_0x4313('0x1e')](_0x5c37e9['phone'])){if(!_[_0x4313('0x1e')](_0x5c37e9[_0x4313('0x1f')]))_0x4826d5[_0x4313('0x20')](insertAdditionalPhones(_0x5c37e9));promisesContact[_0x4313('0x20')]({'contact':_0x5c37e9});}}}Promise[_0x4313('0x21')](_0x4826d5)[_0x4313('0x22')](function(){_0x2ca18f({'val':0x1});});})[_0x4313('0x23')](function(_0x20d36a){logger['error'](_0x20d36a[_0x4313('0x24')]);});});}function insertAdditionalPhones(_0x18a981){return new Promise(function(_0x2ecec2,_0x57706c){var _0xff5a30=_0x18a981['AdditionalPhones'];if(_[_0x4313('0x1e')](_0xff5a30))_0x57706c({'val':0x0});else{var _0x5eedd8=_0xff5a30[_0x4313('0x25')](';');var _0x5e21f6=[];orderBy=0x0;for(var _0x926b7f=0x0;_0x926b7f<_0x5eedd8['length'];_0x926b7f++){_0x5e21f6[_0x4313('0x20')](splitAdditionalPhone(_0x18a981['id'],_0x5eedd8[_0x926b7f]));}Promise[_0x4313('0x21')](_0x5e21f6)[_0x4313('0x22')](function(){_0x2ecec2({'val':_0x5eedd8[_0x4313('0x1d')]});});}});}function splitAdditionalPhone(_0x47ffc7,_0x29c151){return new Promise(function(_0x5782bf,_0x28ed3b){var _0x451d9a=_0x29c151[_0x4313('0x25')](':');var _0x5e4730=_0x451d9a[0x0];var _0x2a1b10=_0x451d9a[0x1];if(_0x2a1b10!==''){var _0x29209e=_0x2a1b10[_0x4313('0x25')]('|');var _0x192211=[];for(var _0x7bfba3=0x0;_0x7bfba3<_0x29209e[_0x4313('0x1d')];_0x7bfba3++){if(_0x29209e[_0x7bfba3]!==''){var _0x4739f1=_[_0x4313('0x26')](promisesAdditionalPhones,{'contactId':_0x47ffc7,'phone':_0x29209e[_0x7bfba3]});if(_0x4739f1['length']==0x0){orderBy++;promisesAdditionalPhones[_0x4313('0x20')]({'contactId':_0x47ffc7,'contactTypeId':_0x5e4730,'phone':_0x29209e[_0x7bfba3],'orderBy':orderBy});}}}_0x5782bf({'ok':0x1});}else _0x5782bf({'res':0x0});});}function createAdditionalPhone(_0x10b3f9,_0x21b235,_0x180b46,_0x4fd186){var _0x5cf20f='';var _0x3376b4='';var _0xe69494=_0x180b46['split']('§');_0x5cf20f=_0xe69494[0x0];if(_0xe69494[_0x4313('0x1d')]==0x2)_0x3376b4=_0xe69494[0x1];return new Promise(function(_0x5ed99b,_0x31f8d8){return db[_0x4313('0x27')][_0x4313('0x28')]({'where':{'CmContactId':_0x10b3f9,'item':_0x5cf20f}})[_0x4313('0x22')](function(_0x2d1bef){if(_0x2d1bef){return db['CmContactHasItem'][_0x4313('0x29')]({'ItemTypeId':_0x21b235,'description':_0x3376b4,'OrderBy':_0x4fd186},{'where':{'CmContactId':_0x10b3f9,'item':_0x5cf20f}})[_0x4313('0x22')](function(_0x21d15f){_0x5ed99b({'res':'updated'});});}else{return db['CmContactHasItem'][_0x4313('0x2a')]({'CmContactId':_0x10b3f9,'item':_0x5cf20f,'ItemTypeId':_0x21b235,'description':_0x3376b4,'OrderBy':_0x4fd186,'ItemClass':_0x4313('0x2b')})[_0x4313('0x22')](function(_0x179ec9){_0x5ed99b({'res':'inserted'});});}});});}function updateContact(_0xeea6a3){return new Promise(function(_0x844a6,_0x224f5c){var _0xf9e0f7=_0xeea6a3['id'];delete _0xeea6a3['id'];return db[_0x4313('0x2c')][_0x4313('0x29')](_0xeea6a3,{'where':{'id':_0xf9e0f7}})[_0x4313('0x22')](function(_0xee20b8){updatedRows+=0x1;return db['CmHopper'][_0x4313('0x29')]({'phone':_0xeea6a3[_0x4313('0x12')]},{'where':{'ContactId':_0xf9e0f7}})[_0x4313('0x22')](function(_0x2b88b9){_0x844a6({'ret':'OK'});});});});}function insertCmHopper(_0x4f4070,_0x376118,_0x3401bd,_0x4a64ad,_0x340eee){var _0x2296a3=['cm_contacts.phone',_0x4313('0x2d'),'cm_contacts.id','cm_contacts.ListId',_0x376118+'.'+_0x4a64ad,_0x4313('0x2e'),_0x4313('0x2f'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x340eee+'\x22'];return squel['insert']()['into']('cm_hopper')[_0x4313('0x30')]([_0x4313('0x12'),'scheduledat',_0x4313('0x31'),_0x4313('0x32'),_0x4a64ad,_0x4313('0x33'),_0x4313('0x34'),_0x4313('0x35'),_0x4313('0x36'),_0x4313('0x37')],squel[_0x4313('0x10')]()[_0x4313('0x38')](_0x2296a3)[_0x4313('0x13')](_0x376118)[_0x4313('0x14')](_0x4313('0x39'),null,_0x4313('0x3a')+_0x376118+_0x4313('0x3b'))[_0x4313('0x14')](_0x3401bd,null,_0x3401bd+'.id\x20=\x20'+_0x376118+'.'+_0x4a64ad)[_0x4313('0x16')](_0x376118+_0x4313('0x3c'),_0x4f4070)[_0x4313('0x16')](_0x4313('0x3d'),NOW)[_0x4313('0x16')](_0x4313('0x3e'),selectNotIn(_0x376118,_0x3401bd,_0x4a64ad,'cm_hopper',[_0x4313('0x3f'),_0x4313('0x40')]))[_0x4313('0x16')](_0x4313('0x3e'),selectNotIn(_0x376118,_0x3401bd,_0x4a64ad,_0x4313('0x41'),[_0x4313('0x3f')])))['toString']();}function insertCmHopperBlack(_0x1e29b5,_0x47f3a8,_0x42c3cb,_0x28902f){var _0x4d59d3=['cm_contacts.phone','cm_contacts.id',_0x4313('0x42'),_0x47f3a8+'.'+_0x28902f,_0x4313('0x2e'),_0x4313('0x2f')];return squel[_0x4313('0x43')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0x4313('0x31'),'ListId',_0x28902f,_0x4313('0x33'),'updatedAt'],squel[_0x4313('0x10')]()[_0x4313('0x38')](_0x4d59d3)[_0x4313('0x13')](_0x47f3a8)[_0x4313('0x14')](_0x4313('0x39'),null,_0x4313('0x3a')+_0x47f3a8+_0x4313('0x3b'))[_0x4313('0x14')](_0x42c3cb,null,_0x42c3cb+'.id\x20=\x20'+_0x47f3a8+'.'+_0x28902f)['where'](_0x47f3a8+_0x4313('0x3c'),_0x1e29b5)[_0x4313('0x16')](_0x4313('0x3d'),NOW)[_0x4313('0x16')](_0x4313('0x3e'),squel[_0x4313('0x10')]()[_0x4313('0x11')]('phone')[_0x4313('0x13')](_0x4313('0x44'))[_0x4313('0x16')](_0x4313('0x45'),_0x1e29b5)[_0x4313('0x16')](_0x28902f+_0x4313('0x46'),_0x47f3a8+'.'+_0x28902f)))['toString']();}function insertCmHopperAdditionalPhones(_0x5c6e83){var _0x16bec5=['cm_hopper.id',_0x4313('0x47'),_0x4313('0x48'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x4313('0x43')]()[_0x4313('0x49')]('cm_hopper_additional_phones')[_0x4313('0x30')]([_0x4313('0x4a'),_0x4313('0x12'),_0x4313('0x4b'),_0x4313('0x33'),_0x4313('0x34')],squel[_0x4313('0x10')]()[_0x4313('0x38')](_0x16bec5)[_0x4313('0x13')]('cm_hopper')[_0x4313('0x14')](_0x4313('0x39'),null,_0x4313('0x4c'))[_0x4313('0x14')](_0x4313('0x4d'),null,_0x4313('0x4e'))[_0x4313('0x16')](_0x4313('0x4f'),_0x5c6e83)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x4313('0x50')]();}function insertCmContact(_0x1003ed,_0x2d81ea,_0x4e7c73,_0xbaa949){var _0x20a804=_[_0x4313('0x51')](_['keys'](_0xbaa949),[_0x4313('0x32'),_0x4313('0x52'),_0x4313('0x33'),_0x4313('0x34')]);return squel[_0x4313('0x43')]()[_0x4313('0x49')](_0x4313('0x39'))[_0x4313('0x30')](_0x20a804,squel[_0x4313('0x10')]()[_0x4313('0x38')](_0x20a804)[_0x4313('0x13')](_0x2d81ea)[_0x4313('0x16')]('('+_0x4e7c73[_0x4313('0x14')](',')+_0x4313('0x53'),squel['select']()[_0x4313('0x38')](_0x4e7c73)[_0x4313('0x13')]('cm_contacts')[_0x4313('0x16')](_0x4313('0x45'),_0x1003ed))[_0x4313('0x16')](_0x4313('0x54'),squel['select']()[_0x4313('0x11')]('MIN(id)',_0x4313('0x55'))[_0x4313('0x13')](_0x2d81ea)['group'](_0x4e7c73['join'](','))))[_0x4313('0x50')]();}function handleStop(){logger[_0x4313('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x373c72){logger[_0x4313('0x57')](_0x373c72[_0x4313('0x24')]);process[_0x4313('0x58')](0x1);}function handleError(_0x209eb5,_0xa287e0){stats[_0x4313('0x59')][_0x4313('0x20')]({'name':_0xa287e0['code'],'message':_0xa287e0[_0x4313('0x24')],'row':_0x209eb5});}function handleQuery(_0x177b65){logger[_0x4313('0x56')](_0x177b65);return db[_0x4313('0x19')][_0x4313('0x1a')](_0x177b65)[_0x4313('0x1c')](function(_0x3a67dd){results['push'](_0x3a67dd);})[_0x4313('0x23')](function(_0x500479){logger[_0x4313('0x57')](_0x500479[_0x4313('0x24')]);});}function main(_0x4f0bd2,_0x592392,_0x35c26e,_0x4ac2df){logger[_0x4313('0x56')](_0x4313('0x5a'),_0x4f0bd2,JSON[_0x4313('0x5b')](_0x592392));process[_0x4313('0x5c')](_0x4313('0x5d'));var _0x2b9cd7=_0x592392['binding'];var _0x4f344d=_[_0x4313('0x5e')](_0x2b9cd7);var _0x2585b9=_0x592392['socket_timestamp'];var _0x3ea44e=path['join'](config[_0x4313('0x5f')],_0x4313('0x60'),_0x2585b9+'.csv');logger[_0x4313('0x56')](_0x4313('0x61'),_0x592392);db[_0x4313('0x62')][_0x4313('0x63')]({'raw':!![],'attributes':['id','name']})[_0x4313('0x22')](function(_0x475352){for(var _0x805bec=0x0;_0x805bec<_0x475352[_0x4313('0x1d')];_0x805bec++){if(_0x475352[_0x805bec][_0x4313('0x64')]in _0x2b9cd7){contactItemTypes[_0x4313('0x20')](_0x475352[_0x805bec]);delete _0x4f344d[_0x475352[_0x805bec][_0x4313('0x64')]];hasAdditionalPhones=!![];}for(var _0xea8c32 in _0x2b9cd7){if(_0x475352[_0x805bec][_0x4313('0x64')]+_0x4313('0x65')===_0xea8c32){phoneDescriptions[_0x4313('0x20')]({'itemTypeId':_0x475352[_0x805bec]['id'],'description':_0xea8c32});delete _0x4f344d[_0xea8c32];}}}if(hasAdditionalPhones)_0x4f344d[_0x4313('0x1f')]='';var _0x50bcb6=_['keys'](_0x4f344d)[_0x4313('0x14')]();logger[_0x4313('0x56')]('header',_0x50bcb6);fs[_0x4313('0x66')](_0x3ea44e,_0x50bcb6+'\x0a');Papa[_0x4313('0x67')](fs[_0x4313('0x68')](_0x4f0bd2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x351871,_0x3e33e4){try{for(var _0x5cad0e=0x0,_0x1d5623=[];_0x5cad0e<_0x351871[_0x4313('0x69')][_0x4313('0x1d')];_0x5cad0e++){stats[_0x4313('0x6a')]+=0x1;if(_0x351871[_0x4313('0x59')][_0x5cad0e]){handleError(_0x351871[_0x4313('0x69')][_0x5cad0e],_0x351871[_0x4313('0x59')][_0x5cad0e]);}else{var _0x38e711=[];var _0x27c7e2=[];var _0x4dd156={};for(var _0x34a4e5 in _0x2b9cd7){let _0x59bf76=contactItemTypes['find'](_0x41c123=>_0x41c123['name']===_0x34a4e5);let _0x3ddbcf=contactItemTypes[_0x4313('0x6b')](_0x26044f=>_0x26044f['name']+'_description'===_0x34a4e5);if(_[_0x4313('0x1e')](_0x59bf76)&&_[_0x4313('0x1e')](_0x3ddbcf)){if(_0x2b9cd7[_0x4313('0x6c')](_0x34a4e5)){if(_0x351871[_0x4313('0x69')][_0x5cad0e][_0x2b9cd7[_0x34a4e5]]){var _0x3c1402=_['trim'](_0x351871[_0x4313('0x69')][_0x5cad0e][_0x2b9cd7[_0x34a4e5]][_0x4313('0x6d')](/"/g,'\x27'));switch(_0x34a4e5){case'scheduledat':var _0x5565a1=moment(_0x3c1402,_0x4313('0xc'),!![]);if(_0x5565a1[_0x4313('0x6e')]()){_0x1d5623[_0x4313('0x20')]('\x22'+_0x3c1402+'\x22');}else{_0x38e711[_0x4313('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x4313('0x35'):var _0xe01b2d=parseInt(_0x3c1402);_0x3c1402=_[_0x4313('0x6f')](_0xe01b2d)||_0xe01b2d<0x0||_0xe01b2d>0x4?_0x4ac2df?0x3:0x2:_0xe01b2d;_0x1d5623[_0x4313('0x20')]('\x22'+_0x3c1402+'\x22');break;case _0x4313('0x36'):var _0xdddcf8=parseInt(_0x3c1402);if(_[_0x4313('0x70')](_0xdddcf8)&&_['includes'](_0x35c26e,_0xdddcf8)){_0x1d5623[_0x4313('0x20')]('\x22'+_0xdddcf8+'\x22');}else{_0x38e711['push']('agent\x20not\x20exists');}break;case _0x4313('0x71'):if(isEmail(_0x3c1402)){_0x1d5623['push']('\x22'+_0x3c1402+'\x22');}else{_0x38e711['push'](_0x4313('0x72'));}break;case _0x4313('0x73'):var _0x2aa3af=moment(_0x3c1402,_0x4313('0x74'),!![]);if(_0x2aa3af['isValid']()){_0x1d5623['push']('\x22'+_0x3c1402+'\x22');}else{_0x38e711['push'](_0x4313('0x75'));}break;default:_0x1d5623['push']('\x22'+_0x3c1402+'\x22');}}else{switch(_0x34a4e5){case'firstName':case'phone':_0x38e711['push'](_0x34a4e5+'\x20not\x20specified');break;default:_0x1d5623[_0x4313('0x20')]('\x22\x22');}}}}else{var _0xe74264='';if(!_['isNil'](_0x59bf76)){if(!_0x4dd156['hasOwnProperty'](_0x59bf76['id'])){for(var _0xf5de2=0x0;_0xf5de2<_0x2b9cd7[_0x34a4e5][_0x4313('0x1d')];_0xf5de2++){var _0x3c1402=_[_0x4313('0x76')](_0x351871['data'][_0x5cad0e][_0x2b9cd7[_0x34a4e5][_0xf5de2]][_0x4313('0x6d')](/"/g,'\x27'));var _0x465fd4=phoneDescriptions[_0x4313('0x6b')](_0x2b6e0d=>_0x2b6e0d['itemTypeId']===_0x59bf76['id']);if(!_['isNil'](_0x465fd4)){var _0x12a816=_[_0x4313('0x76')](_0x351871[_0x4313('0x69')][_0x5cad0e][_0x2b9cd7[_0x465fd4[_0x4313('0x77')]][0x0]][_0x4313('0x6d')](/"/g,'\x27'));if(!_[_0x4313('0x1e')](_0x12a816))_0x3c1402=_0x3c1402+'§'+_0x12a816;}if(_0xe74264=='')_0xe74264=_0x3c1402;else _0xe74264+='|'+_0x3c1402;}_0x27c7e2['push'](_0x59bf76['id']+':'+_0xe74264);_0x4dd156[_0x59bf76['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d5623['push']('\x22'+_0x27c7e2[_0x4313('0x14')](';')+'\x22');}if(_0x38e711['length']){handleError(_0x351871[_0x4313('0x69')][_0x5cad0e],{'code':'SystemRow','message':_0x38e711[_0x4313('0x14')]()});}else{fs[_0x4313('0x78')](_0x3ea44e,_0x1d5623[_0x4313('0x14')]()+'\x0a');}_0x1d5623=[];}if(!(stats[_0x4313('0x6a')]%0xc8)){socket[_0x4313('0x79')](_0x4313('0x7a')+_0x2585b9,stats);stats[_0x4313('0x59')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x3e33e4[_0x4313('0x7b')]();}}catch(_0x1308af){handleError(_0x351871['data'][_0x5cad0e],{'code':'SystemError','message':_0x1308af[_0x4313('0x24')]});logger[_0x4313('0x57')](_0x4313('0x7c'),_0x1308af[_0x4313('0x24')]);}},'complete':function(){try{var _0x3404d6=[];var _0x1ecd6a=tempTableName;_0x3404d6[_0x4313('0x20')](_0x4313('0x7d')+_0x1ecd6a+_0x4313('0x7e'));logger[_0x4313('0x56')](_0x4313('0x7f'),contactItemTypes[_0x4313('0x1d')]);var _0x19121e=util['format'](_0x4313('0x80'),_0x3ea44e,_0x1ecd6a,_0x50bcb6,_0x592392['ListId'],_0x592392[_0x4313('0x52')]||null,NOW,NOW);if(_[_0x4313('0x1e')](_0x2b9cd7['scheduledat'])){_0x19121e+=_0x4313('0x81');}_0x3404d6[_0x4313('0x20')](_0x19121e);BPromise[_0x4313('0x82')](_0x3404d6,handleQuery)['then'](function(_0x313ab6){BPromise[_0x4313('0x21')]([handleAdditionalPhones()])[_0x4313('0x22')](function(){_0x3404d6=[];for(var _0x3118a0=0x0;_0x3118a0_0xb028b3[_0x458a('0x70')]===_0x2ea9ce);let _0x494710=contactItemTypes[_0x458a('0x78')](_0xed002=>_0xed002[_0x458a('0x70')]+_0x458a('0x71')===_0x2ea9ce);if(_[_0x458a('0x1d')](_0x48d7f2)&&_[_0x458a('0x1d')](_0x494710)){if(_0x5779cb['hasOwnProperty'](_0x2ea9ce)){if(_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x2ea9ce]]){var _0x239e2f=_['trim'](_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x2ea9ce]][_0x458a('0x79')](/"/g,'\x27'));switch(_0x2ea9ce){case _0x458a('0x39'):var _0x5e01af=moment(_0x239e2f,_0x458a('0x10'),!![]);if(_0x5e01af[_0x458a('0x7a')]()){_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');}else{_0x120b8e[_0x458a('0x1f')](_0x458a('0x7b'));}break;case _0x458a('0x3d'):var _0x38cff5=parseInt(_0x239e2f);_0x239e2f=_[_0x458a('0x7c')](_0x38cff5)||_0x38cff5<0x0||_0x38cff5>0x4?_0x4c97b4?0x3:0x2:_0x38cff5;_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');break;case _0x458a('0x3e'):var _0x486687=parseInt(_0x239e2f);if(_['isNumber'](_0x486687)&&_['includes'](_0xbd36cc,_0x486687)){_0x31074e[_0x458a('0x1f')]('\x22'+_0x486687+'\x22');}else{_0x120b8e['push'](_0x458a('0x7d'));}break;case _0x458a('0x7e'):if(isEmail(_0x239e2f)){_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');}else{_0x120b8e[_0x458a('0x1f')](_0x458a('0x7f'));}break;case _0x458a('0x80'):var _0x46df7c=moment(_0x239e2f,'YYYY-MM-DD',!![]);if(_0x46df7c[_0x458a('0x7a')]()){_0x31074e[_0x458a('0x1f')]('\x22'+_0x239e2f+'\x22');}else{_0x120b8e['push'](_0x458a('0x81'));}break;default:_0x31074e['push']('\x22'+_0x239e2f+'\x22');}}else{switch(_0x2ea9ce){case _0x458a('0x82'):case'phone':_0x120b8e[_0x458a('0x1f')](_0x2ea9ce+_0x458a('0x83'));break;default:_0x31074e[_0x458a('0x1f')]('\x22\x22');}}}}else{var _0x1fe8a1='';if(!_['isNil'](_0x48d7f2)){if(!_0x10dde3[_0x458a('0x84')](_0x48d7f2['id'])){for(var _0x14b95e=0x0;_0x14b95e<_0x5779cb[_0x2ea9ce][_0x458a('0x1c')];_0x14b95e++){var _0x239e2f=_[_0x458a('0x85')](_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x2ea9ce][_0x14b95e]][_0x458a('0x79')](/"/g,'\x27'));var _0x259ab5=phoneDescriptions['find'](_0x3674f8=>_0x3674f8[_0x458a('0x86')]===_0x48d7f2['id']);if(!_[_0x458a('0x1d')](_0x259ab5)){var _0x4212af=_['trim'](_0x3745d5[_0x458a('0x76')][_0x413d7c][_0x5779cb[_0x259ab5[_0x458a('0x87')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x458a('0x1d')](_0x4212af))_0x239e2f=_0x239e2f+'§'+_0x4212af;}if(_0x1fe8a1=='')_0x1fe8a1=_0x239e2f;else _0x1fe8a1+='|'+_0x239e2f;}_0x573089[_0x458a('0x1f')](_0x48d7f2['id']+':'+_0x1fe8a1);_0x10dde3[_0x48d7f2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x31074e[_0x458a('0x1f')]('\x22'+_0x573089[_0x458a('0x16')](';')+'\x22');}if(_0x120b8e[_0x458a('0x1c')]){handleError(_0x3745d5['data'][_0x413d7c],{'code':_0x458a('0x88'),'message':_0x120b8e[_0x458a('0x16')]()});}else{fs[_0x458a('0x89')](_0x582ff7,_0x31074e[_0x458a('0x16')]()+'\x0a');}_0x31074e=[];}if(!(stats[_0x458a('0x77')]%0xc8)){socket[_0x458a('0x8a')](_0x458a('0x8b')+_0x17b611,stats);stats['errors']=[];}}if(stopped){logger[_0x458a('0x60')]('Abort\x20parser');_0x2b67dd[_0x458a('0x8c')]();}}catch(_0x36e650){handleError(_0x3745d5[_0x458a('0x76')][_0x413d7c],{'code':'SystemError','message':_0x36e650[_0x458a('0x22')]});logger['error']('step',_0x36e650[_0x458a('0x22')]);}},'complete':function(){try{var _0x400601=[];var _0x5464a5=tempTableName;_0x400601['push'](_0x458a('0x8d')+_0x5464a5+_0x458a('0x8e'));logger[_0x458a('0x60')](_0x458a('0x8f'),contactItemTypes[_0x458a('0x1c')]);var _0x50f1e0=util[_0x458a('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x582ff7,_0x5464a5,_0x527c09,_0x2e187b[_0x458a('0x3b')],_0x2e187b[_0x458a('0x5b')]||null,NOW,NOW);if(_[_0x458a('0x1d')](_0x5779cb['scheduledat'])){_0x50f1e0+=_0x458a('0x90');}_0x400601[_0x458a('0x1f')](_0x50f1e0);BPromise['each'](_0x400601,handleQuery)[_0x458a('0x24')](function(_0x5bf72f){BPromise[_0x458a('0x91')]([handleAdditionalPhones()])[_0x458a('0x24')](function(){_0x400601=[];for(var _0x470a3f=0x0;_0x470a3f\x20\x20');}var _0x4f29d3=path[_0x458a('0x16')](config[_0x458a('0x6a')],_0x458a('0x6b'),process[_0x458a('0x9a')][0x2]);if(!fs[_0x458a('0x9b')](_0x4f29d3)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x35d808={};try{_0x35d808=JSON[_0x458a('0x74')](process[_0x458a('0x9a')][0x3]);if(!_0x35d808[_0x458a('0x68')]){throw new Error(_0x458a('0x9c'));}var _0x2fa49e=0x0;if(_0x35d808[_0x458a('0x68')][_0x458a('0x3e')]){_0x2fa49e=0x1;}if(!_0x35d808['ListId']){throw new Error(_0x458a('0x9d'));}}catch(_0x3ec574){throw new Error(_0x458a('0x9e'));}var _0x45a134=[];try{_0x45a134=_[_0x458a('0x9f')](JSON[_0x458a('0x74')](process[_0x458a('0x9a')][0x4]),'id');}catch(_0x483a96){logger['info']('No\x20agent\x20available');}main(_0x4f29d3,_0x35d808,_0x45a134,_0x2fa49e);}validate();process['on']('SIGINT',handleStop);process['on'](_0x458a('0xa0'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 840fdbe..b4292fc 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 _0xe658=['Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','getSubjects','string','voice','toLowerCase','push','variable','calleridnum','outbound','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Call\x20To','destexten','queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xe658,0x146));var _0x8e65=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe658[_0x17d9e3];return _0x14192d;};'use strict';exports[_0x8e65('0x0')]=function(_0xc79a6b,_0x31df48){var _0xd0d9ea=[{'type':_0x8e65('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0xc79a6b['toLowerCase']()){case _0x8e65('0x2'):switch(_0x31df48[_0x8e65('0x3')]()){case'inbound':_0xd0d9ea[_0x8e65('0x4')]({'type':_0x8e65('0x5'),'content':'','variableName':'queue'});_0xd0d9ea[_0x8e65('0x4')]({'type':_0x8e65('0x5'),'content':'','variableName':_0x8e65('0x6')});break;case _0x8e65('0x7'):_0xd0d9ea[_0x8e65('0x4')]({'type':_0x8e65('0x1'),'content':'Outbound\x20Call','variableName':null});_0xd0d9ea[_0x8e65('0x4')]({'type':_0x8e65('0x5'),'content':'','variableName':_0x8e65('0x8')});break;}}return _0xd0d9ea;};exports['getDescriptions']=function(_0x10e29,_0x33bea1){var _0x391501=[];switch(_0x10e29[_0x8e65('0x3')]()){case _0x8e65('0x2'):switch(_0x33bea1['toLowerCase']()){case'inbound':_0x391501=[{'type':'string','content':_0x8e65('0x9'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8e65('0xa'),'keyType':'variable','variableName':_0x8e65('0x6')},{'type':_0x8e65('0xb'),'content':'','key':'Caller\x20Name','keyType':_0x8e65('0x5'),'variableName':'calleridname'},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0xc'),'keyType':'variable','variableName':_0x8e65('0xd')},{'type':_0x8e65('0xb'),'content':'','key':'Queue','keyType':'variable','variableName':_0x8e65('0xe')},{'type':'keyValue','content':'','key':_0x8e65('0xf'),'keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x10')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x11'),'keyType':_0x8e65('0x5'),'variableName':'agentcalledAt'},{'type':_0x8e65('0x1'),'content':_0x8e65('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x13'),'keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x14')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x15'),'keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x8')},{'type':'string','content':_0x8e65('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8e65('0x17'),'keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x18')},{'type':'keyValue','content':'','key':_0x8e65('0x19'),'keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x1a')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x1b'),'keyType':_0x8e65('0x5'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x1c')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x1d'),'keyType':_0x8e65('0x5'),'variableName':_0x8e65('0x1e')}];break;case _0x8e65('0x7'):_0x391501=[{'type':_0x8e65('0x1'),'content':_0x8e65('0x9'),'variableName':null},{'type':_0x8e65('0xb'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x8e65('0x8')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x1f'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':_0x8e65('0x20')},{'type':'keyValue','content':'','key':_0x8e65('0xf'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':_0x8e65('0x10')},{'type':'keyValue','content':'','key':_0x8e65('0x11'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':_0x8e65('0x21')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x8e65('0x22'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':_0x8e65('0x23')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x24'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':_0x8e65('0x25')},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x26'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x8e65('0xb'),'content':'','key':_0x8e65('0x27'),'keyType':_0x8e65('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x391501;}; \ No newline at end of file +var _0x8ac6=['uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','queue','UniqueId'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x8ac6,0x180));var _0x68ac=function(_0x3c64b2,_0x55836e){_0x3c64b2=_0x3c64b2-0x0;var _0x588738=_0x8ac6[_0x3c64b2];return _0x588738;};'use strict';exports[_0x68ac('0x0')]=function(_0xbcd42c,_0x5553c1){var _0x104a12=[{'type':'string','content':_0x68ac('0x1'),'variableName':null}];switch(_0xbcd42c[_0x68ac('0x2')]()){case _0x68ac('0x3'):switch(_0x5553c1['toLowerCase']()){case _0x68ac('0x4'):_0x104a12[_0x68ac('0x5')]({'type':_0x68ac('0x6'),'content':'','variableName':'queue'});_0x104a12['push']({'type':_0x68ac('0x6'),'content':'','variableName':_0x68ac('0x7')});break;case'outbound':_0x104a12[_0x68ac('0x5')]({'type':_0x68ac('0x8'),'content':_0x68ac('0x9'),'variableName':null});_0x104a12['push']({'type':_0x68ac('0x6'),'content':'','variableName':_0x68ac('0xa')});break;}}return _0x104a12;};exports[_0x68ac('0xb')]=function(_0x1b541b,_0x4ef3d4){var _0x28e02b=[];switch(_0x1b541b[_0x68ac('0x2')]()){case _0x68ac('0x3'):switch(_0x4ef3d4[_0x68ac('0x2')]()){case _0x68ac('0x4'):_0x28e02b=[{'type':_0x68ac('0x8'),'content':_0x68ac('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x68ac('0xd'),'keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x7')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0xf'),'keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x10')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x11'),'keyType':'variable','variableName':_0x68ac('0x12')},{'type':_0x68ac('0xe'),'content':'','key':'Queue','keyType':'variable','variableName':_0x68ac('0x13')},{'type':'keyValue','content':'','key':_0x68ac('0x14'),'keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x15')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x16'),'keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x17')},{'type':_0x68ac('0x8'),'content':_0x68ac('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x19'),'keyType':'variable','variableName':_0x68ac('0x1a')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x1b'),'keyType':'variable','variableName':_0x68ac('0xa')},{'type':_0x68ac('0x8'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x68ac('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x17')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x1c')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x1d'),'keyType':_0x68ac('0x6'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x68ac('0x1e'),'keyType':'variable','variableName':_0x68ac('0x1f')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x20'),'keyType':_0x68ac('0x6'),'variableName':_0x68ac('0x21')}];break;case'outbound':_0x28e02b=[{'type':_0x68ac('0x8'),'content':_0x68ac('0xc'),'variableName':null},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x22'),'keyType':_0x68ac('0x6'),'keyContent':'','variableName':_0x68ac('0xa')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x23'),'keyType':_0x68ac('0x6'),'keyContent':'','variableName':_0x68ac('0x24')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x14'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x16'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x68ac('0x8'),'content':_0x68ac('0x25')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x26'),'keyType':'variable','keyContent':'','variableName':_0x68ac('0x27')},{'type':_0x68ac('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x68ac('0x6'),'keyContent':'','variableName':_0x68ac('0x28')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x29'),'keyType':_0x68ac('0x6'),'keyContent':'','variableName':_0x68ac('0x2a')},{'type':_0x68ac('0xe'),'content':'','key':_0x68ac('0x2b'),'keyType':_0x68ac('0x6'),'keyContent':'','variableName':_0x68ac('0x2c')}];break;}}return _0x28e02b;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b09e78a..8ff29bd 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 _0x1e54=['i.id','tag','countFilteredInteractions','length','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','rows','tracked','clone','phone','mobile','lodash','./sql-utils','findAll','resolve','getInteractionsQuery','then','parseAdvancedSearchFilter','where','body','contact','fields','filter','user','having','read','checkAccountsRestrictions'];(function(_0x2cb58b,_0x5a879d){var _0xe9dd9c=function(_0x11e835){while(--_0x11e835){_0x2cb58b['push'](_0x2cb58b['shift']());}};_0xe9dd9c(++_0x5a879d);}(_0x1e54,0x1b0));var _0x41e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e54[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41e5('0x0'));var sqlUtils=require(_0x41e5('0x1'));var utils=require('./utils');exports[_0x41e5('0x2')]=function(_0x3a2dc3,_0x4ecce1,_0x43b9ea,_0xc560f4,_0x79b7ca){var _0x581429={'count':0x0,'rows':[]};var _0x434ee8=sqlUtils['skipInteractionsQuery'](_0x3a2dc3,_0x43b9ea,_0x4ecce1);if(_0x434ee8){return Promise[_0x41e5('0x3')](_0x581429);}var _0x58deab=sqlUtils[_0x41e5('0x4')](_0x3a2dc3);var _0x54ff08={};return Promise['resolve']()[_0x41e5('0x5')](function(){if(_0x4ecce1['search']){return sqlUtils[_0x41e5('0x6')](_0x4ecce1['search'],_0x79b7ca);}else{return sqlUtils['parseQueryParameters'](_0x3a2dc3,_0x4ecce1,_0x79b7ca);}})[_0x41e5('0x5')](function(_0x289742){_0x58deab[_0x41e5('0x7')](_0x289742[_0x41e5('0x8')]);_0x58deab[_0x41e5('0x7')](_0x289742[_0x41e5('0x9')]);_0x58deab[_0x41e5('0x7')](_0x289742['default']);_0x58deab[_0x41e5('0x7')](_0x289742[_0x41e5('0xa')]);_0x58deab[_0x41e5('0x7')](_0x289742[_0x41e5('0xb')]);_0x58deab[_0x41e5('0x7')](_0x289742[_0x41e5('0xc')]);_0x58deab[_0x41e5('0xd')](_0x289742[_0x41e5('0xe')]);_0x54ff08=_0x289742['tags'];return sqlUtils[_0x41e5('0xf')](_0x3a2dc3,_0x43b9ea,_0x4ecce1);})[_0x41e5('0x5')](function(_0x4d020e){_0x58deab['where'](_0x4d020e);_0x58deab['group'](_0x41e5('0x10'));var _0x84fb92=_0x4ecce1['search']?_0x54ff08['ids']:_0x4ecce1[_0x41e5('0x11')];return sqlUtils[_0x41e5('0x12')](_0x58deab,_0x84fb92);})['then'](function(_0x37a141){_0x581429['count']=_0x37a141[_0x41e5('0x13')];if(_0x581429['count']===0x0){return[];}_0x58deab[_0x41e5('0xd')](_0x54ff08[_0x41e5('0x14')]);if(_0xc560f4[_0x41e5('0x15')]){_0xc560f4[_0x41e5('0x15')][_0x41e5('0x16')](function(_0x436305){var _0x2b892e=_0x436305[0x0]===_0x41e5('0x17')?_0x436305[0x0]:'i.'+_0x436305[0x0];_0x58deab['order'](_0x2b892e,_0x436305[0x1]===_0x41e5('0x18')?![]:!![]);if(_0x436305[0x0]===_0x41e5('0x19')){var _0x558d66=sqlUtils['getClosedOrderClause'](_0x3a2dc3,_0x4ecce1);_0x58deab[_0x41e5('0x15')](_0x558d66,_0x436305[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x41e5('0x1a')](_0x3a2dc3,_0x58deab,_0x4ecce1,_0xc560f4);})[_0x41e5('0x5')](function(_0x35a3ed){_0x581429[_0x41e5('0x1b')]=_0x35a3ed;return _0x581429;})['catch'](function(_0x4c9244){throw _0x4c9244;});};exports[_0x41e5('0x1c')]=function(_0x55ef16,_0x3fdba8){return function(_0x592edd,_0x520559,_0x4201d6){var _0x2d9fdd=_0x592edd[_0x41e5('0xc')];var _0x5e36c2={};var _0x192eb9=_0x592edd['query'];if(_0x5e36c2){_0x5e36c2=_[_0x41e5('0x1d')](_0x592edd[_0x41e5('0x8')]);_0x5e36c2=_['omit'](_0x5e36c2,[_0x41e5('0x8'),'html',_0x41e5('0x1e'),'fax',_0x41e5('0x1f')]);}utils['updateUser'](_0x2d9fdd,_0x5e36c2,_0x192eb9,_0x55ef16,_0x3fdba8);_0x4201d6(null);};}; \ No newline at end of file +var _0x41d7=['rows','catch','tracked','clone','omit','phone','fax','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','body','fields','user','tags','checkAccountsRestrictions','group','ids','countFilteredInteractions','length','count','having','clause','order','forEach','DESC','closed','getClosedOrderClause','getFilteredInteractions'];(function(_0x4cf460,_0x3b70a9){var _0x120894=function(_0x42203c){while(--_0x42203c){_0x4cf460['push'](_0x4cf460['shift']());}};_0x120894(++_0x3b70a9);}(_0x41d7,0x9b));var _0x741d=function(_0x19aa42,_0x2ffddc){_0x19aa42=_0x19aa42-0x0;var _0xe8ea2a=_0x41d7[_0x19aa42];return _0xe8ea2a;};'use strict';var _=require(_0x741d('0x0'));var sqlUtils=require(_0x741d('0x1'));var utils=require(_0x741d('0x2'));exports[_0x741d('0x3')]=function(_0x8356f5,_0x267908,_0x1534ba,_0x196e97,_0x48e58c){var _0x2b8d7a={'count':0x0,'rows':[]};var _0x145a4c=sqlUtils[_0x741d('0x4')](_0x8356f5,_0x1534ba,_0x267908);if(_0x145a4c){return Promise[_0x741d('0x5')](_0x2b8d7a);}var _0xa74881=sqlUtils[_0x741d('0x6')](_0x8356f5);var _0x84bf6c={};return Promise[_0x741d('0x5')]()['then'](function(){if(_0x267908[_0x741d('0x7')]){return sqlUtils[_0x741d('0x8')](_0x267908[_0x741d('0x7')],_0x48e58c);}else{return sqlUtils[_0x741d('0x9')](_0x8356f5,_0x267908,_0x48e58c);}})[_0x741d('0xa')](function(_0x5e9332){_0xa74881[_0x741d('0xb')](_0x5e9332[_0x741d('0xc')]);_0xa74881[_0x741d('0xb')](_0x5e9332['contact']);_0xa74881[_0x741d('0xb')](_0x5e9332['default']);_0xa74881[_0x741d('0xb')](_0x5e9332[_0x741d('0xd')]);_0xa74881[_0x741d('0xb')](_0x5e9332['filter']);_0xa74881[_0x741d('0xb')](_0x5e9332[_0x741d('0xe')]);_0xa74881['having'](_0x5e9332['read']);_0x84bf6c=_0x5e9332[_0x741d('0xf')];return sqlUtils[_0x741d('0x10')](_0x8356f5,_0x1534ba,_0x267908);})['then'](function(_0x5b0e01){_0xa74881[_0x741d('0xb')](_0x5b0e01);_0xa74881[_0x741d('0x11')]('i.id');var _0x2c52ea=_0x267908['search']?_0x84bf6c[_0x741d('0x12')]:_0x267908['tag'];return sqlUtils[_0x741d('0x13')](_0xa74881,_0x2c52ea);})[_0x741d('0xa')](function(_0x54de68){_0x2b8d7a['count']=_0x54de68[_0x741d('0x14')];if(_0x2b8d7a[_0x741d('0x15')]===0x0){return[];}_0xa74881[_0x741d('0x16')](_0x84bf6c[_0x741d('0x17')]);if(_0x196e97[_0x741d('0x18')]){_0x196e97[_0x741d('0x18')][_0x741d('0x19')](function(_0x19aa9a){var _0x44da68=_0x19aa9a[0x0]==='contactName'?_0x19aa9a[0x0]:'i.'+_0x19aa9a[0x0];_0xa74881[_0x741d('0x18')](_0x44da68,_0x19aa9a[0x1]===_0x741d('0x1a')?![]:!![]);if(_0x19aa9a[0x0]===_0x741d('0x1b')){var _0x45f159=sqlUtils[_0x741d('0x1c')](_0x8356f5,_0x267908);_0xa74881[_0x741d('0x18')](_0x45f159,_0x19aa9a[0x1]===_0x741d('0x1a')?![]:!![]);}});}return sqlUtils[_0x741d('0x1d')](_0x8356f5,_0xa74881,_0x267908,_0x196e97);})[_0x741d('0xa')](function(_0x57d7d6){_0x2b8d7a[_0x741d('0x1e')]=_0x57d7d6;return _0x2b8d7a;})[_0x741d('0x1f')](function(_0x38f1d7){throw _0x38f1d7;});};exports[_0x741d('0x20')]=function(_0x5a2cb2,_0x2d6850){return function(_0x37721a,_0x31a391,_0x5a78da){var _0x4c65fa=_0x37721a[_0x741d('0xe')];var _0x45c066={};var _0x28440e=_0x37721a['query'];if(_0x45c066){_0x45c066=_[_0x741d('0x21')](_0x37721a[_0x741d('0xc')]);_0x45c066=_[_0x741d('0x22')](_0x45c066,[_0x741d('0xc'),'html',_0x741d('0x23'),_0x741d('0x24'),'mobile']);}utils['updateUser'](_0x4c65fa,_0x45c066,_0x28440e,_0x5a2cb2,_0x2d6850);_0x5a78da(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 330609b..d24e784 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbba6=['parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','tag','filter','get','capitalize','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','isEmpty','exports','lodash','../parsers/qs','./update-interaction','updateInteraction','./utils','agent','search','select','field','name','tools_tags','user_has_','_interactions','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','\x20IN\x20?','map','getInteractionsTables','getAccountFK','getInteractionFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.email\x20LIKE\x20?','mail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','length','conditions','find','buildExpression','type','default','start','end','value','operator','$substring','split','contact','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','text','Tag','tags','clause','and','ids','User','user','UserId','body','plainBody','keys','some','compact'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xbba6,0xf4));var _0x6bba=function(_0x344cca,_0x523392){_0x344cca=_0x344cca-0x0;var _0x420a87=_0xbba6[_0x344cca];return _0x420a87;};'use strict';var _=require(_0x6bba('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0x6bba('0x1'));var updateInteraction=require(_0x6bba('0x2'))[_0x6bba('0x3')];var utils=require(_0x6bba('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x47fc85,_0x22e4fb,_0x3a027c){var _0x23aac7=![];var _0x20f7f0=utils['getAccountFK'](_0x47fc85);if(_0x22e4fb['role']===_0x6bba('0x5')&&!_0x3a027c[_0x6bba('0x6')]&&!_0x3a027c[_0x20f7f0]){_0x23aac7=!![];}return _0x23aac7;}function getTagsQuery(){return squel[_0x6bba('0x7')]()[_0x6bba('0x8')]('id')['field'](_0x6bba('0x9'))[_0x6bba('0x8')]('color')['from'](_0x6bba('0xa'));}function getUsersQuery(_0x362feb,_0x40b190){var _0x3fe1c8=utils['getInteractionFK'](_0x362feb);var _0x2147e8=_0x6bba('0xb')+_0x362feb+_0x6bba('0xc');var _0x3761b7=squel['select']()['field']('u.id')[_0x6bba('0x8')](_0x6bba('0xd'))[_0x6bba('0x8')](_0x6bba('0xe')+_0x3fe1c8)[_0x6bba('0xf')](_0x2147e8,'ui')[_0x6bba('0x10')](_0x6bba('0x11'),'u',_0x6bba('0x12'));if(_0x40b190['length']>0x0){_0x3761b7['where'](_0x6bba('0xe')+_0x3fe1c8+_0x6bba('0x13'),_[_0x6bba('0x14')](_0x40b190,'id'));}return _0x3761b7;}function getInteractionsQuery(_0x4f4fb5){var _0x3f81fb=utils[_0x6bba('0x15')](_0x4f4fb5);var _0x58d621=utils[_0x6bba('0x16')](_0x4f4fb5);var _0x3f56be=utils[_0x6bba('0x17')](_0x4f4fb5);return squel[_0x6bba('0x7')]()[_0x6bba('0xf')](_0x3f81fb['interactions'],'i')[_0x6bba('0x10')](_0x6bba('0x18'),'c',_0x6bba('0x19'))['left_join']('users','o',_0x6bba('0x1a'))[_0x6bba('0x10')](_0x3f81fb['accounts'],'a',_0x6bba('0x1b')+_0x58d621)[_0x6bba('0x10')](_0x3f81fb[_0x6bba('0x1c')],'me',_0x6bba('0x1d')+_0x3f56be+_0x6bba('0x1e'))[_0x6bba('0x10')](_0x3f81fb[_0x6bba('0x1f')],'it',_0x6bba('0x20')+_0x3f56be+'\x20=\x20i.id')[_0x6bba('0x10')](_0x6bba('0xa'),'t',_0x6bba('0x21'));}function getSqlClauses(){var _0x1dc544={'body':squel['expr'](),'contact':squel[_0x6bba('0x22')](),'default':squel[_0x6bba('0x22')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x6bba('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x6bba('0x22')]()};return _0x1dc544;}function parseTagParameter(_0x4e9c23){var _0x462aea=squel['expr']();if(_0x4e9c23){var _0x1e43d6=utils['getSelectedTags'](_0x4e9c23);_0x1e43d6[_0x6bba('0x23')](function(_0xe81f4d){_0x462aea['or'](_0x6bba('0x24'),'%,'+_0xe81f4d+',%');});}return _0x462aea;}function parseReadParameter(_0x1747ba){var _0xd00c84='';if(_0x1747ba){_0xd00c84='unreadMessages\x20{OPERATOR}\x200';if(_0x1747ba==='1'){_0xd00c84=_0xd00c84[_0x6bba('0x25')]('{OPERATOR}','=');}else{_0xd00c84=_0xd00c84['replace'](_0x6bba('0x26'),'>');}}return _0xd00c84;}function parseSearchFilter(_0x5093d4,_0x195173){var _0x5b86fe=squel[_0x6bba('0x22')]();if(_0x195173){var _0x326af6=_0x195173[_0x6bba('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6bba('0x27')](_0x326af6)){_0x5b86fe['or'](_0x6bba('0x28'),_0x326af6+'%');switch(_0x5093d4){case _0x6bba('0x29'):case'whatsapp':_0x5b86fe['or'](_0x6bba('0x2a'),_0x326af6+'%');break;case _0x6bba('0x2b'):_0x5b86fe['or'](_0x6bba('0x2c'),_0x326af6+'%');break;case _0x6bba('0x2d'):_0x5b86fe['or']('i.from\x20LIKE\x20?',_0x326af6+'%');break;case'mail':_0x5b86fe['or'](_0x6bba('0x2e'),qs['getFullTextValue'](_0x326af6,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6bba('0x2f')](_0x326af6));break;}}else if(_0x5093d4==='mail'&&qs['isEmail'](_0x326af6)){_0x5b86fe['or'](_0x6bba('0x30'),_0x326af6+'%');}else{if(_0x5093d4===_0x6bba('0x31')){_0x5b86fe['or'](_0x6bba('0x2e'),qs[_0x6bba('0x2f')](_0x326af6,!![]))['or'](_0x6bba('0x32'),qs['getFullTextValue'](_0x326af6));}else if(_0x5093d4!==_0x6bba('0x2b')){_0x5b86fe['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6bba('0x2f')](_0x326af6));}_0x5b86fe['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6bba('0x2f')](_0x326af6,!![]),null);}}return _0x5b86fe;}function parseAdvancedSearchFilter(_0x5c1251,_0x3fbd6e){var _0x2bcd3b=getSqlClauses();var _0xb2dbea=as[_0x6bba('0x33')](_0x5c1251);var _0x3466f5=_0xb2dbea['sqlOperator'];for(var _0x301cdd=0x0;_0x301cdd<_0xb2dbea['conditions'][_0x6bba('0x34')];_0x301cdd++){var _0x385971=_0xb2dbea[_0x6bba('0x35')][_0x301cdd];var _0x2337a8='i';var _0x4de6b3=_[_0x6bba('0x36')](_0x3fbd6e,['name',_0x385971[_0x6bba('0x8')]]);if(_0x4de6b3){var _0x25844f=as[_0x6bba('0x37')](_0x2337a8,_0x4de6b3[_0x6bba('0x38')],_0x385971);_0x2bcd3b[_0x6bba('0x39')][_0x3466f5](_0x25844f['text'],_0x25844f['value'][_0x6bba('0x3a')],_0x25844f['value'][_0x6bba('0x3b')]);}else{switch(_0x385971['field']){case'unreadMessages':var _0x29803d=parseReadParameter(_0x385971[_0x6bba('0x3c')]);_0x2bcd3b['read']['and'](_0x29803d);break;case'Contact':if(_0x385971[_0x6bba('0x3d')]===_0x6bba('0x3e')){if(_0x385971['value'][_0x6bba('0x3f')]('\x20')[_0x6bba('0x34')]>0x1){_0x2bcd3b[_0x6bba('0x40')][_0x3466f5](_0x6bba('0x41'),qs[_0x6bba('0x2f')](_0x385971[_0x6bba('0x3c')],!![]),null);}else{var _0x16e720='%'+_0x385971['value']+'%';_0x2bcd3b[_0x6bba('0x40')][_0x3466f5](_0x6bba('0x42'),_0x16e720,_0x16e720,_0x16e720);}}else{_0x4de6b3=_[_0x6bba('0x36')](_0x3fbd6e,[_0x6bba('0x9'),_0x6bba('0x43')]);_0x385971[_0x6bba('0x8')]='ContactId';_0x25844f=as[_0x6bba('0x37')](_0x2337a8,_0x4de6b3[_0x6bba('0x38')],_0x385971);_0x2bcd3b[_0x6bba('0x40')][_0x3466f5](_0x25844f[_0x6bba('0x44')],_0x25844f['value']['start'],_0x25844f['value']['end']);}break;case _0x6bba('0x45'):var _0x56dcc5=_0x385971[_0x6bba('0x3c')][_0x6bba('0x3f')](',')['map'](function(_0x464640){return Number(_0x464640);});var _0x664af0=parseTagParameter(_0x56dcc5);_0x2bcd3b[_0x6bba('0x46')][_0x6bba('0x47')][_0x6bba('0x48')](_0x664af0);_0x2bcd3b[_0x6bba('0x46')][_0x6bba('0x49')]=_0x56dcc5;break;case _0x6bba('0x4a'):if(_0x385971[_0x6bba('0x3d')]===_0x6bba('0x3e')){_0x2bcd3b[_0x6bba('0x4b')][_0x3466f5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x385971[_0x6bba('0x3c')]+'%',null);}else{_0x4de6b3=_[_0x6bba('0x36')](_0x3fbd6e,['name',_0x6bba('0x4c')]);_0x385971[_0x6bba('0x8')]=_0x6bba('0x4c');_0x25844f=as[_0x6bba('0x37')](_0x2337a8,_0x4de6b3[_0x6bba('0x38')],_0x385971);_0x2bcd3b[_0x6bba('0x4b')][_0x3466f5](_0x25844f[_0x6bba('0x44')],_0x25844f[_0x6bba('0x3c')][_0x6bba('0x3a')],_0x25844f[_0x6bba('0x3c')][_0x6bba('0x3b')]);}break;case _0x6bba('0x4d'):case _0x6bba('0x4e'):_0x25844f=as[_0x6bba('0x37')]('me',null,_0x385971);_0x2bcd3b[_0x6bba('0x4d')][_0x3466f5](_0x25844f[_0x6bba('0x44')],_0x25844f['value'][_0x6bba('0x3a')],_0x25844f[_0x6bba('0x3c')][_0x6bba('0x3b')]);break;}}}return _0x2bcd3b;}function parseModelFields(_0x58c496,_0x1cf170,_0x30f1cd){var _0x3ef5ef=utils['getAccountFK'](_0x58c496);var _0x2c1a33=squel[_0x6bba('0x22')]();var _0x3fd8a4=_(_0x1cf170)[_0x6bba('0x4f')]()[_0x6bba('0x14')](function(_0x4a8936){return _[_0x6bba('0x50')](_0x30f1cd,[_0x6bba('0x9'),_0x4a8936])?_0x4a8936:undefined;})[_0x6bba('0x51')]()['value']();if(_0x3fd8a4[_0x6bba('0x34')]>0x0){_0x3fd8a4[_0x6bba('0x23')](function(_0x2f0207){if(_0x2f0207===_0x3ef5ef){_0x2c1a33[_0x6bba('0x48')]('i.'+_0x3ef5ef+_0x6bba('0x13'),[]['concat'](_0x1cf170[_0x2f0207]));}else if(_0x2f0207==='createdAt'){var _0x552b68=JSON[_0x6bba('0x52')](_0x1cf170[_0x2f0207])[_0x6bba('0x53')];var _0x11fe69=JSON[_0x6bba('0x52')](_0x1cf170[_0x2f0207])[_0x6bba('0x54')];_0x2c1a33['and'](_0x6bba('0x55'),_0x552b68,_0x11fe69);}else{if(_0x1cf170[_0x2f0207]===_0x6bba('0x56')){_0x2c1a33[_0x6bba('0x48')]('i.'+_0x2f0207+_0x6bba('0x57'));}else{_0x2c1a33['and']('i.'+_0x2f0207+_0x6bba('0x58'),_0x1cf170[_0x2f0207]);}}});}return _0x2c1a33;}function parseQueryParameters(_0x246e67,_0x3c736f,_0x32ace2){var _0x41ac97=getSqlClauses();return Promise[_0x6bba('0x59')]()[_0x6bba('0x5a')](function(){return parseModelFields(_0x246e67,_0x3c736f,_0x32ace2);})[_0x6bba('0x5a')](function(_0x10bc59){_0x41ac97['fields'][_0x6bba('0x48')](_0x10bc59);return parseReadParameter(_0x3c736f[_0x6bba('0x5b')]);})[_0x6bba('0x5a')](function(_0x57d562){_0x41ac97[_0x6bba('0x5b')]['and'](_0x57d562);return parseTagParameter(_0x3c736f[_0x6bba('0x5c')]);})['then'](function(_0x43767a){_0x41ac97['tags'][_0x6bba('0x47')][_0x6bba('0x48')](_0x43767a);return parseSearchFilter(_0x246e67,_0x3c736f[_0x6bba('0x5d')]);})['then'](function(_0x356cc9){_0x41ac97[_0x6bba('0x5d')]=_0x356cc9;return _0x41ac97;});}function checkAccountsRestrictions(_0x4d7f83,_0x1a8aee,_0x1663eb){var _0x3d6993=utils[_0x6bba('0x16')](_0x4d7f83);var _0x2e7dd5=_0x6bba('0x5e')+_[_0x6bba('0x5f')](_0x4d7f83)+(_0x4d7f83==='chat'?_0x6bba('0x60'):_0x6bba('0x61'));var _0x206ecc=squel[_0x6bba('0x22')]();return Promise[_0x6bba('0x59')]()[_0x6bba('0x5a')](function(){if(_0x1663eb[_0x6bba('0x6')]&&_0x1a8aee[_0x6bba('0x62')]==='agent'){return _0x1a8aee[_0x2e7dd5]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xf54391){if(_0xf54391){if(_0xf54391[_0x6bba('0x34')]===0x0){_0x206ecc[_0x6bba('0x48')]('i.'+_0x3d6993+_0x6bba('0x57'));}else{_0x206ecc['and']('i.'+_0x3d6993+'\x20IN\x20?',_[_0x6bba('0x14')](_0xf54391,'id'));}}else if(!_0x1663eb[_0x3d6993]){_0x206ecc[_0x6bba('0x48')]('i.'+_0x3d6993+_0x6bba('0x63'));}})[_0x6bba('0x5a')](function(){return _0x206ecc;});}function getClosedOrderClause(_0x44bce1,_0x2f062f){var _0x1af822='';var _0xd8160c=[_0x6bba('0x64'),'i.secondDisposition',_0x6bba('0x65')];if(_0x44bce1===_0x6bba('0x31')){_0xd8160c[_0x6bba('0x66')](_0x6bba('0x67'));}if(_0x2f062f[_0x6bba('0x68')]==='0'&&_0x44bce1===_0x6bba('0x31')){_0x1af822='i.substatus';}else{if(_0x2f062f['closed']==='1'){_0xd8160c[_0x6bba('0x69')]();}_0x1af822=_0x6bba('0x6a')+_0xd8160c[_0x6bba('0x6b')](',\x20')+')';}return _0x1af822;}function getFilteredInteractions(_0x4c3162,_0x4cacd4,_0x3f54b5,_0x453db0){var _0xb784f0=utils[_0x6bba('0x17')](_0x4c3162);var _0x504a6d=_[_0x6bba('0x5f')](_0x4c3162)+_0x6bba('0x6c');var _0x14b504=[];var _0x2da198=getTagsQuery();var _0x20ee1b={'type':db[_0x6bba('0x6d')][_0x6bba('0x6e')][_0x6bba('0x6f')],'raw':!![]};var _0x5740b7=[];var _0x5a2251=[];return db[_0x6bba('0x70')][_0x6bba('0x71')](_0x2da198[_0x6bba('0x72')](),_0x20ee1b)[_0x6bba('0x5a')](function(_0xce296e){_0x14b504=_['keyBy'](_0xce296e,'id');_0x20ee1b=_['merge'](_0x20ee1b,{'model':db[_0x504a6d],'mapToModel':!![],'nest':!![]});if(_0x3f54b5[_0x6bba('0x73')]){_0x453db0[_0x6bba('0x74')][_0x6bba('0x23')](function(_0x37ba15){_0x4cacd4[_0x6bba('0x8')]('i.'+_0x37ba15);});}else{_0x4cacd4['field'](_0x6bba('0x75'),_0x6bba('0x76'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x77'),_0x6bba('0x78'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x79'),_0x6bba('0x7a'));if(_0x4c3162===_0x6bba('0x31')){_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x7b'),_0x6bba('0x7c'));_0x4cacd4[_0x6bba('0x8')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x6bba('0x7d'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x7e'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x7f'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x80'));_0x4cacd4['field'](_0x6bba('0x81'));_0x4cacd4[_0x6bba('0x8')]('i.closedAt');_0x4cacd4['field'](_0x6bba('0x82'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x83'));_0x4cacd4['field'](_0x6bba('0x84'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x85'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x65'));_0x4cacd4['field'](_0x6bba('0x86'));_0x4cacd4['field'](_0x6bba('0x64'));_0x4cacd4[_0x6bba('0x8')]('i.substatus');_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x87'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x88'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x89'));_0x4cacd4['field']('i.UserId');}else if(_0x4c3162===_0x6bba('0x2d')){_0x4cacd4['field'](_0x6bba('0x8a'),_0x6bba('0x7d'));}else{_0x4cacd4['field'](_0x6bba('0x8b'),_0x6bba('0x7d'));}if(_0x4c3162!==_0x6bba('0x31')){_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x8c'));}_0x4cacd4['field'](_0x6bba('0x8d'),_0x6bba('0x8e'));_0x4cacd4[_0x6bba('0x8')]('c.lastName',_0x6bba('0x8f'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x90'),_0x6bba('0x91'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x92'),'Contact.phone');_0x4cacd4[_0x6bba('0x8')]('c.mobile',_0x6bba('0x93'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x94'),'Contact.fax');_0x4cacd4[_0x6bba('0x8')]('o.fullname',_0x6bba('0x95'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x96'),_0x6bba('0x97'));_0x4cacd4[_0x6bba('0x8')](_0x6bba('0x98'),_0x6bba('0x99'));}if(_0x453db0['limit']){_0x4cacd4[_0x6bba('0x9a')](_0x453db0[_0x6bba('0x9a')]);}if(_0x453db0[_0x6bba('0x9b')]){_0x4cacd4['offset'](_0x453db0['offset']);}return db[_0x6bba('0x70')][_0x6bba('0x71')](_0x4cacd4[_0x6bba('0x72')](),_0x20ee1b);})[_0x6bba('0x5a')](function(_0x338452){_0x5740b7=_0x338452;var _0x43d934=getUsersQuery(_0x4c3162,_0x5740b7);return db[_0x6bba('0x70')][_0x6bba('0x71')](_0x43d934[_0x6bba('0x72')](),_0x20ee1b);})[_0x6bba('0x5a')](function(_0x2ccd16){_0x5a2251=_[_0x6bba('0x9c')](_0x2ccd16,_0xb784f0);if(_0x4c3162===_0x6bba('0x31')){return db[_0x6bba('0x9d')]['findOne']({'attributes':[_0x6bba('0x9e')],'raw':!![]});}})[_0x6bba('0x5a')](function(_0x110da9){var _0x1f160e=_0x110da9?_0x110da9['enableEmailPreview']:undefined;var _0x62fc9d=_0x5740b7[_0x6bba('0x14')](function(_0x484896){return updateInteraction(_0x484896,_0x14b504,_0x5a2251,_0x1f160e);});return Promise['all'](_0x62fc9d);});}function countFilteredInteractions(_0x4629d0,_0x9f59ac){var _0x16bec4=_0x4629d0[_0x6bba('0x9f')]();_0x16bec4[_0x6bba('0x8')](_0x6bba('0xa0'));_0x16bec4[_0x6bba('0x8')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x46fc58=utils['getSelectedTags'](_0x9f59ac);if(!_[_0x6bba('0xa1')](_0x46fc58)){_0x16bec4['where']('t.id\x20IN\x20?',_0x46fc58);}var _0x273b24={'type':db['Sequelize'][_0x6bba('0x6e')]['SELECT'],'raw':!![]};return db[_0x6bba('0x70')][_0x6bba('0x71')](_0x16bec4[_0x6bba('0x72')](),_0x273b24);}module[_0x6bba('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x2dc3=['i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','capitalize','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','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.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','select','field','name','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','i.phone\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','default','text','value','end','unreadMessages','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','split','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','buildExpression','plainBody','body','some','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','Websites','Accounts','resolve','agent','i.thirdDisposition'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2dc3,0x183));var _0x32dc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2dc3[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var squel=require(_0x32dc('0x0'));var as=require(_0x32dc('0x1'));var qs=require(_0x32dc('0x2'));var updateInteraction=require(_0x32dc('0x3'))[_0x32dc('0x4')];var utils=require(_0x32dc('0x5'));var db=require(_0x32dc('0x6'))['db'];function skipInteractionsQuery(_0x2534ba,_0x2ed11d,_0x39dbf8){var _0x1f74d5=![];var _0x10dc57=utils[_0x32dc('0x7')](_0x2534ba);if(_0x2ed11d['role']==='agent'&&!_0x39dbf8['search']&&!_0x39dbf8[_0x10dc57]){_0x1f74d5=!![];}return _0x1f74d5;}function getTagsQuery(){return squel[_0x32dc('0x8')]()[_0x32dc('0x9')]('id')[_0x32dc('0x9')](_0x32dc('0xa'))[_0x32dc('0x9')]('color')['from'](_0x32dc('0xb'));}function getUsersQuery(_0x24e2f2,_0x459919){var _0x2dd7f6=utils[_0x32dc('0xc')](_0x24e2f2);var _0x3fdcd1=_0x32dc('0xd')+_0x24e2f2+_0x32dc('0xe');var _0x41de5a=squel['select']()[_0x32dc('0x9')]('u.id')[_0x32dc('0x9')](_0x32dc('0xf'))[_0x32dc('0x9')](_0x32dc('0x10')+_0x2dd7f6)[_0x32dc('0x11')](_0x3fdcd1,'ui')[_0x32dc('0x12')](_0x32dc('0x13'),'u',_0x32dc('0x14'));if(_0x459919[_0x32dc('0x15')]>0x0){_0x41de5a[_0x32dc('0x16')](_0x32dc('0x10')+_0x2dd7f6+_0x32dc('0x17'),_[_0x32dc('0x18')](_0x459919,'id'));}return _0x41de5a;}function getInteractionsQuery(_0x3700cb){var _0x32954b=utils[_0x32dc('0x19')](_0x3700cb);var _0x217349=utils[_0x32dc('0x7')](_0x3700cb);var _0x7184c9=utils['getInteractionFK'](_0x3700cb);return squel['select']()[_0x32dc('0x11')](_0x32954b['interactions'],'i')[_0x32dc('0x12')](_0x32dc('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x32dc('0x13'),'o',_0x32dc('0x1b'))[_0x32dc('0x12')](_0x32954b['accounts'],'a',_0x32dc('0x1c')+_0x217349)['left_join'](_0x32954b[_0x32dc('0x1d')],'me',_0x32dc('0x1e')+_0x7184c9+_0x32dc('0x1f'))['left_join'](_0x32954b['interactionsTags'],'it',_0x32dc('0x20')+_0x7184c9+_0x32dc('0x1f'))[_0x32dc('0x12')]('tools_tags','t',_0x32dc('0x21'));}function getSqlClauses(){var _0xac7d3a={'body':squel['expr'](),'contact':squel[_0x32dc('0x22')](),'default':squel[_0x32dc('0x22')](),'fields':squel[_0x32dc('0x22')](),'filter':squel[_0x32dc('0x22')](),'read':squel[_0x32dc('0x22')](),'tags':{'clause':squel[_0x32dc('0x22')](),'ids':null},'user':squel['expr']()};return _0xac7d3a;}function parseTagParameter(_0x499192){var _0x9a7a87=squel['expr']();if(_0x499192){var _0x20e5d5=utils[_0x32dc('0x23')](_0x499192);_0x20e5d5[_0x32dc('0x24')](function(_0x5e90f3){_0x9a7a87['or'](_0x32dc('0x25'),'%,'+_0x5e90f3+',%');});}return _0x9a7a87;}function parseReadParameter(_0x783847){var _0x4bf063='';if(_0x783847){_0x4bf063=_0x32dc('0x26');if(_0x783847==='1'){_0x4bf063=_0x4bf063['replace']('{OPERATOR}','=');}else{_0x4bf063=_0x4bf063[_0x32dc('0x27')](_0x32dc('0x28'),'>');}}return _0x4bf063;}function parseSearchFilter(_0x220ba6,_0x26a810){var _0x30104a=squel[_0x32dc('0x22')]();if(_0x26a810){var _0x5a7c5c=_0x26a810[_0x32dc('0x27')]('\x5c','\x5c\x5c')[_0x32dc('0x27')](/'/g,'\x27\x27');if(qs[_0x32dc('0x29')](_0x5a7c5c)){_0x30104a['or']('i.id\x20LIKE\x20?',_0x5a7c5c+'%');switch(_0x220ba6){case _0x32dc('0x2a'):case _0x32dc('0x2b'):_0x30104a['or'](_0x32dc('0x2c'),_0x5a7c5c+'%');break;case'fax':_0x30104a['or']('i.fax\x20LIKE\x20?',_0x5a7c5c+'%');break;case _0x32dc('0x2d'):_0x30104a['or'](_0x32dc('0x2e'),_0x5a7c5c+'%');break;case _0x32dc('0x2f'):_0x30104a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32dc('0x30')](_0x5a7c5c,!![]))['or'](_0x32dc('0x31'),qs['getFullTextValue'](_0x5a7c5c));break;}}else if(_0x220ba6===_0x32dc('0x2f')&&qs['isEmail'](_0x5a7c5c)){_0x30104a['or'](_0x32dc('0x32'),_0x5a7c5c+'%');}else{if(_0x220ba6===_0x32dc('0x2f')){_0x30104a['or'](_0x32dc('0x33'),qs[_0x32dc('0x30')](_0x5a7c5c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32dc('0x30')](_0x5a7c5c));}else if(_0x220ba6!==_0x32dc('0x34')){_0x30104a['or'](_0x32dc('0x35'),qs[_0x32dc('0x30')](_0x5a7c5c));}_0x30104a['or'](_0x32dc('0x36'),qs['getFullTextValue'](_0x5a7c5c,!![]),null);}}return _0x30104a;}function parseAdvancedSearchFilter(_0x4951a6,_0x2b23c9){var _0x7511dc=getSqlClauses();var _0x471b0e=as[_0x32dc('0x37')](_0x4951a6);var _0x2e93f0=_0x471b0e[_0x32dc('0x38')];for(var _0x53cb98=0x0;_0x53cb98<_0x471b0e[_0x32dc('0x39')][_0x32dc('0x15')];_0x53cb98++){var _0x159d37=_0x471b0e[_0x32dc('0x39')][_0x53cb98];var _0x366abf='i';var _0x4fc9f3=_[_0x32dc('0x3a')](_0x2b23c9,[_0x32dc('0xa'),_0x159d37[_0x32dc('0x9')]]);if(_0x4fc9f3){var _0x5c657d=as['buildExpression'](_0x366abf,_0x4fc9f3[_0x32dc('0x3b')],_0x159d37);_0x7511dc[_0x32dc('0x3c')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')]['start'],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x3f')]);}else{switch(_0x159d37[_0x32dc('0x9')]){case _0x32dc('0x40'):var _0x33b245=parseReadParameter(_0x159d37[_0x32dc('0x3e')]);_0x7511dc[_0x32dc('0x41')][_0x32dc('0x42')](_0x33b245);break;case _0x32dc('0x43'):if(_0x159d37[_0x32dc('0x44')]===_0x32dc('0x45')){if(_0x159d37[_0x32dc('0x3e')]['split']('\x20')[_0x32dc('0x15')]>0x1){_0x7511dc[_0x32dc('0x46')][_0x2e93f0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x32dc('0x30')](_0x159d37[_0x32dc('0x3e')],!![]),null);}else{var _0x9dce3b='%'+_0x159d37[_0x32dc('0x3e')]+'%';_0x7511dc[_0x32dc('0x46')][_0x2e93f0](_0x32dc('0x47'),_0x9dce3b,_0x9dce3b,_0x9dce3b);}}else{_0x4fc9f3=_[_0x32dc('0x3a')](_0x2b23c9,[_0x32dc('0xa'),'ContactId']);_0x159d37[_0x32dc('0x9')]=_0x32dc('0x48');_0x5c657d=as['buildExpression'](_0x366abf,_0x4fc9f3[_0x32dc('0x3b')],_0x159d37);_0x7511dc[_0x32dc('0x46')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x49')],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x3f')]);}break;case _0x32dc('0x4a'):var _0x3f4093=_0x159d37[_0x32dc('0x3e')][_0x32dc('0x4b')](',')[_0x32dc('0x18')](function(_0x1ecbda){return Number(_0x1ecbda);});var _0x2160b7=parseTagParameter(_0x3f4093);_0x7511dc[_0x32dc('0x4c')][_0x32dc('0x4d')]['and'](_0x2160b7);_0x7511dc[_0x32dc('0x4c')][_0x32dc('0x4e')]=_0x3f4093;break;case _0x32dc('0x4f'):if(_0x159d37[_0x32dc('0x44')]===_0x32dc('0x45')){_0x7511dc[_0x32dc('0x50')][_0x2e93f0](_0x32dc('0x51'),'%'+_0x159d37[_0x32dc('0x3e')]+'%',null);}else{_0x4fc9f3=_[_0x32dc('0x3a')](_0x2b23c9,[_0x32dc('0xa'),_0x32dc('0x52')]);_0x159d37['field']=_0x32dc('0x52');_0x5c657d=as[_0x32dc('0x53')](_0x366abf,_0x4fc9f3[_0x32dc('0x3b')],_0x159d37);_0x7511dc[_0x32dc('0x50')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x49')],_0x5c657d[_0x32dc('0x3e')]['end']);}break;case'body':case _0x32dc('0x54'):_0x5c657d=as[_0x32dc('0x53')]('me',null,_0x159d37);_0x7511dc[_0x32dc('0x55')][_0x2e93f0](_0x5c657d[_0x32dc('0x3d')],_0x5c657d[_0x32dc('0x3e')]['start'],_0x5c657d[_0x32dc('0x3e')][_0x32dc('0x3f')]);break;}}}return _0x7511dc;}function parseModelFields(_0x106ce7,_0x9157d6,_0x5df39e){var _0x45efeb=utils[_0x32dc('0x7')](_0x106ce7);var _0x5ac4d8=squel[_0x32dc('0x22')]();var _0x5f4147=_(_0x9157d6)['keys']()[_0x32dc('0x18')](function(_0x182377){return _[_0x32dc('0x56')](_0x5df39e,[_0x32dc('0xa'),_0x182377])?_0x182377:undefined;})['compact']()['value']();if(_0x5f4147['length']>0x0){_0x5f4147[_0x32dc('0x24')](function(_0x397da5){if(_0x397da5===_0x45efeb){_0x5ac4d8[_0x32dc('0x42')]('i.'+_0x45efeb+'\x20IN\x20?',[][_0x32dc('0x57')](_0x9157d6[_0x397da5]));}else if(_0x397da5===_0x32dc('0x58')){var _0x4a887e=JSON['parse'](_0x9157d6[_0x397da5])[_0x32dc('0x59')];var _0x58a3f1=JSON[_0x32dc('0x5a')](_0x9157d6[_0x397da5])[_0x32dc('0x5b')];_0x5ac4d8['and'](_0x32dc('0x5c'),_0x4a887e,_0x58a3f1);}else{if(_0x9157d6[_0x397da5]==='null'){_0x5ac4d8[_0x32dc('0x42')]('i.'+_0x397da5+_0x32dc('0x5d'));}else{_0x5ac4d8[_0x32dc('0x42')]('i.'+_0x397da5+_0x32dc('0x5e'),_0x9157d6[_0x397da5]);}}});}return _0x5ac4d8;}function parseQueryParameters(_0x1c130f,_0x295a59,_0x3a6bac){var _0x44084f=getSqlClauses();return Promise['resolve']()[_0x32dc('0x5f')](function(){return parseModelFields(_0x1c130f,_0x295a59,_0x3a6bac);})[_0x32dc('0x5f')](function(_0x5ce180){_0x44084f[_0x32dc('0x60')][_0x32dc('0x42')](_0x5ce180);return parseReadParameter(_0x295a59['read']);})[_0x32dc('0x5f')](function(_0x316d6c){_0x44084f[_0x32dc('0x41')]['and'](_0x316d6c);return parseTagParameter(_0x295a59[_0x32dc('0x61')]);})[_0x32dc('0x5f')](function(_0x3c193a){_0x44084f[_0x32dc('0x4c')][_0x32dc('0x4d')][_0x32dc('0x42')](_0x3c193a);return parseSearchFilter(_0x1c130f,_0x295a59[_0x32dc('0x62')]);})[_0x32dc('0x5f')](function(_0x5de78e){_0x44084f[_0x32dc('0x62')]=_0x5de78e;return _0x44084f;});}function checkAccountsRestrictions(_0x2200f8,_0x50ec92,_0x2e0fab){var _0x3298c1=utils[_0x32dc('0x7')](_0x2200f8);var _0x17eb10=_0x32dc('0x63')+_['capitalize'](_0x2200f8)+(_0x2200f8==='chat'?_0x32dc('0x64'):_0x32dc('0x65'));var _0x56e9d6=squel[_0x32dc('0x22')]();return Promise[_0x32dc('0x66')]()[_0x32dc('0x5f')](function(){if(_0x2e0fab['search']&&_0x50ec92['role']===_0x32dc('0x67')){return _0x50ec92[_0x17eb10]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x21b4e8){if(_0x21b4e8){if(_0x21b4e8[_0x32dc('0x15')]===0x0){_0x56e9d6['and']('i.'+_0x3298c1+_0x32dc('0x5d'));}else{_0x56e9d6[_0x32dc('0x42')]('i.'+_0x3298c1+_0x32dc('0x17'),_[_0x32dc('0x18')](_0x21b4e8,'id'));}}else if(!_0x2e0fab[_0x3298c1]){_0x56e9d6[_0x32dc('0x42')]('i.'+_0x3298c1+'\x20IS\x20NOT\x20NULL');}})[_0x32dc('0x5f')](function(){return _0x56e9d6;});}function getClosedOrderClause(_0x5c882d,_0x335d39){var _0x28f206='';var _0x26f3d1=[_0x32dc('0x68'),_0x32dc('0x69'),_0x32dc('0x6a')];if(_0x5c882d==='mail'){_0x26f3d1[_0x32dc('0x6b')](_0x32dc('0x6c'));}if(_0x335d39[_0x32dc('0x6d')]==='0'&&_0x5c882d===_0x32dc('0x2f')){_0x28f206='i.substatus';}else{if(_0x335d39[_0x32dc('0x6d')]==='1'){_0x26f3d1['shift']();}_0x28f206=_0x32dc('0x6e')+_0x26f3d1['join'](',\x20')+')';}return _0x28f206;}function getFilteredInteractions(_0x4208b5,_0x3aeff8,_0x5de883,_0x486349){var _0x87f387=utils[_0x32dc('0xc')](_0x4208b5);var _0x1b1ebc=_[_0x32dc('0x6f')](_0x4208b5)+'Interaction';var _0x3aa663=[];var _0x27f643=getTagsQuery();var _0x39758f={'type':db[_0x32dc('0x70')][_0x32dc('0x71')][_0x32dc('0x72')],'raw':!![]};var _0x2bb7d2=[];var _0xd79d0d=[];return db['sequelize'][_0x32dc('0x73')](_0x27f643[_0x32dc('0x74')](),_0x39758f)[_0x32dc('0x5f')](function(_0x2f4e00){_0x3aa663=_[_0x32dc('0x75')](_0x2f4e00,'id');_0x39758f=_[_0x32dc('0x76')](_0x39758f,{'model':db[_0x1b1ebc],'mapToModel':!![],'nest':!![]});if(_0x5de883[_0x32dc('0x60')]){_0x486349[_0x32dc('0x77')][_0x32dc('0x24')](function(_0x36d9f1){_0x3aeff8['field']('i.'+_0x36d9f1);});}else{_0x3aeff8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x32dc('0x40'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x78'),'Account.key');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x79'),_0x32dc('0x7a'));if(_0x4208b5==='mail'){_0x3aeff8[_0x32dc('0x9')]('a.email','Account.email');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x7b'),_0x32dc('0x7c'));_0x3aeff8[_0x32dc('0x9')]('i.id');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x7d'));_0x3aeff8['field'](_0x32dc('0x7e'));_0x3aeff8[_0x32dc('0x9')]('i.closed');_0x3aeff8[_0x32dc('0x9')]('i.closedAt');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x7f'));_0x3aeff8['field'](_0x32dc('0x80'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x81'));_0x3aeff8['field'](_0x32dc('0x82'));_0x3aeff8[_0x32dc('0x9')]('i.disposition');_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x69'));_0x3aeff8['field'](_0x32dc('0x68'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x6c'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x83'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x84'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x85'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x86'));}else if(_0x4208b5===_0x32dc('0x2d')){_0x3aeff8[_0x32dc('0x9')]('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',_0x32dc('0x7c'));}else{_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x87'),'contactName');}if(_0x4208b5!==_0x32dc('0x2f')){_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x88'));}_0x3aeff8[_0x32dc('0x9')]('c.firstName',_0x32dc('0x89'));_0x3aeff8[_0x32dc('0x9')]('c.lastName',_0x32dc('0x8a'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x8b'),_0x32dc('0x8c'));_0x3aeff8[_0x32dc('0x9')]('c.phone',_0x32dc('0x8d'));_0x3aeff8[_0x32dc('0x9')]('c.mobile',_0x32dc('0x8e'));_0x3aeff8['field'](_0x32dc('0x8f'),_0x32dc('0x90'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x91'),_0x32dc('0x92'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x93'),_0x32dc('0x94'));_0x3aeff8[_0x32dc('0x9')](_0x32dc('0x95'),'TagIds');}if(_0x486349['limit']){_0x3aeff8[_0x32dc('0x96')](_0x486349[_0x32dc('0x96')]);}if(_0x486349[_0x32dc('0x97')]){_0x3aeff8[_0x32dc('0x97')](_0x486349['offset']);}return db[_0x32dc('0x98')][_0x32dc('0x73')](_0x3aeff8[_0x32dc('0x74')](),_0x39758f);})[_0x32dc('0x5f')](function(_0x52ba2d){_0x2bb7d2=_0x52ba2d;var _0x2e18ae=getUsersQuery(_0x4208b5,_0x2bb7d2);return db['sequelize'][_0x32dc('0x73')](_0x2e18ae['toString'](),_0x39758f);})['then'](function(_0x3f3864){_0xd79d0d=_[_0x32dc('0x99')](_0x3f3864,_0x87f387);if(_0x4208b5===_0x32dc('0x2f')){return db[_0x32dc('0x9a')][_0x32dc('0x9b')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x32dc('0x5f')](function(_0xad1505){var _0x1f212d=_0xad1505?_0xad1505[_0x32dc('0x9c')]:undefined;var _0x86d5a1=_0x2bb7d2[_0x32dc('0x18')](function(_0xaf2677){return updateInteraction(_0xaf2677,_0x3aa663,_0xd79d0d,_0x1f212d);});return Promise[_0x32dc('0x9d')](_0x86d5a1);});}function countFilteredInteractions(_0x1d2082,_0x2bbc8c){var _0x351d9a=_0x1d2082[_0x32dc('0x9e')]();_0x351d9a[_0x32dc('0x9')](_0x32dc('0x9f'));_0x351d9a['field'](_0x32dc('0xa0'),_0x32dc('0x40'));var _0xf41f9f=utils['getSelectedTags'](_0x2bbc8c);if(!_[_0x32dc('0xa1')](_0xf41f9f)){_0x351d9a[_0x32dc('0x16')](_0x32dc('0xa2'),_0xf41f9f);}var _0x3e0378={'type':db['Sequelize'][_0x32dc('0x71')][_0x32dc('0x72')],'raw':!![]};return db['sequelize'][_0x32dc('0x73')](_0x351d9a[_0x32dc('0x74')](),_0x3e0378);}module[_0x32dc('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 1fb4b4c..c572848 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87ed=['talking','answered','unmanaged','total','closed','disposition','abandoned','UserId','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x87ed,0x1e5));var _0xd87e=function(_0x554b32,_0x577efd){_0x554b32=_0x554b32-0x0;var _0x2d896d=_0x87ed[_0x554b32];return _0x2d896d;};'use strict';var _=require(_0xd87e('0x0'));var db=require(_0xd87e('0x1'))['db'];function getInteractionUsers(_0x2891b1,_0x51bf97){return new Promise(function(_0x2da767,_0x8ce900){try{var _0x5f0064=[];if(_0x51bf97[_0x2891b1]){_0x5f0064=_0x51bf97[_0x2891b1][_0xd87e('0x2')](function(_0x27e869){return{'id':_0x27e869['id'],'fullname':_0x27e869[_0xd87e('0x3')]};});}return _0x2da767(_0x5f0064);}catch(_0x4347bc){_0x8ce900(_0x4347bc);}});}function getInteractionTags(_0x34e1ea,_0x34f337){var _0x6fdf5d=[];if(_0x34e1ea){_0x34e1ea[_0xd87e('0x4')](',')[_0xd87e('0x5')](function(_0x14bc16){_0x6fdf5d[_0xd87e('0x6')](_0x34f337[_0x14bc16]);});}return _0x6fdf5d;}function updateWaitingCounter(_0x3fe7e6){if(_0x3fe7e6[_0xd87e('0x7')]){_0x3fe7e6['waiting']-=0x1;}}function updateInteractionCounters(_0x433f2a){_0x433f2a[_0xd87e('0x7')]=0x0;_0x433f2a[_0xd87e('0x8')]=0x0;_0x433f2a[_0xd87e('0x9')]=0x0;_0x433f2a[_0xd87e('0xa')]=0x0;_0x433f2a['abandoned']=0x0;_0x433f2a[_0xd87e('0xb')]=0x0;if(_0x433f2a[_0xd87e('0xc')]){if(_0x433f2a[_0xd87e('0xd')]==='abandoned'){_0x433f2a[_0xd87e('0xe')]+=0x1;updateWaitingCounter(_0x433f2a);}if(_0x433f2a[_0xd87e('0xf')]){_0x433f2a['answered']+=0x1;if(_0x433f2a[_0xd87e('0x8')]){_0x433f2a[_0xd87e('0x8')]-=0x1;}}else{if(_0x433f2a['disposition']){_0x433f2a[_0xd87e('0xa')]+=0x1;updateWaitingCounter(_0x433f2a);}}}else{if(!_0x433f2a[_0xd87e('0xf')]){_0x433f2a['waiting']+=0x1;}if(_0x433f2a[_0xd87e('0xf')]){_0x433f2a['talking']+=0x1;updateWaitingCounter(_0x433f2a);}}_0x433f2a[_0xd87e('0xb')]+=0x1;return _0x433f2a;}function getLastMessageText(_0x59dbec){return db[_0xd87e('0x10')][_0xd87e('0x11')]({'where':{'$and':[{'MailInteractionId':_0x59dbec['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xd87e('0x12')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xd87e('0x13')],'order':_0xd87e('0x14'),'raw':!![]})['then'](function(_0x3e1e4d){if(_0x3e1e4d&&_0x3e1e4d[_0xd87e('0x13')]){_0x59dbec[_0xd87e('0x15')]=_[_0xd87e('0x16')](_0x3e1e4d[_0xd87e('0x13')]);}return _0x59dbec;})[_0xd87e('0x17')](function(_0x5c97cc){throw _0x5c97cc;});}exports[_0xd87e('0x18')]=function(_0x3b33fe,_0x1f23c4,_0x480ae8,_0xd7c98b){return new Promise(function(_0x275905,_0x3a04aa){return getInteractionUsers(_0x3b33fe['id'],_0x480ae8)[_0xd87e('0x19')](function(_0x294251){_0x3b33fe[_0xd87e('0x1a')]=_0x294251;return getInteractionTags(_0x3b33fe[_0xd87e('0x1b')],_0x1f23c4);})[_0xd87e('0x19')](function(_0x9f53e3){_0x3b33fe[_0xd87e('0x1c')]=_0x9f53e3;delete _0x3b33fe['TagIds'];return updateInteractionCounters(_0x3b33fe);})[_0xd87e('0x19')](function(_0x37e23c){if(_0xd7c98b){return getLastMessageText(_0x37e23c);}else{return _0x37e23c;}})[_0xd87e('0x19')](function(_0x4a4249){_0x275905(_0x4a4249);})[_0xd87e('0x17')](function(_0x22f97d){_0x3a04aa(_0x22f97d);});});}; \ No newline at end of file +var _0xc561=['catch','then','TagIds','lodash','../../mysqldb','fullname','split','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','MailMessage','findOne','out','plainBody','trimStart'];(function(_0x45943c,_0x292e90){var _0xe1cf98=function(_0x4ba1ae){while(--_0x4ba1ae){_0x45943c['push'](_0x45943c['shift']());}};_0xe1cf98(++_0x292e90);}(_0xc561,0x153));var _0x1c56=function(_0x570e73,_0x538538){_0x570e73=_0x570e73-0x0;var _0x13134b=_0xc561[_0x570e73];return _0x13134b;};'use strict';var _=require(_0x1c56('0x0'));var db=require(_0x1c56('0x1'))['db'];function getInteractionUsers(_0x3d1ed8,_0x364c46){return new Promise(function(_0x5bc88d,_0x34408b){try{var _0x592912=[];if(_0x364c46[_0x3d1ed8]){_0x592912=_0x364c46[_0x3d1ed8]['map'](function(_0x251f8a){return{'id':_0x251f8a['id'],'fullname':_0x251f8a[_0x1c56('0x2')]};});}return _0x5bc88d(_0x592912);}catch(_0x2240f5){_0x34408b(_0x2240f5);}});}function getInteractionTags(_0x3e567d,_0x295fbc){var _0x163147=[];if(_0x3e567d){_0x3e567d[_0x1c56('0x3')](',')['forEach'](function(_0xe0c284){_0x163147['push'](_0x295fbc[_0xe0c284]);});}return _0x163147;}function updateWaitingCounter(_0x43e821){if(_0x43e821['waiting']){_0x43e821[_0x1c56('0x4')]-=0x1;}}function updateInteractionCounters(_0x2ffa05){_0x2ffa05[_0x1c56('0x4')]=0x0;_0x2ffa05[_0x1c56('0x5')]=0x0;_0x2ffa05[_0x1c56('0x6')]=0x0;_0x2ffa05[_0x1c56('0x7')]=0x0;_0x2ffa05[_0x1c56('0x8')]=0x0;_0x2ffa05['total']=0x0;if(_0x2ffa05[_0x1c56('0x9')]){if(_0x2ffa05[_0x1c56('0xa')]===_0x1c56('0x8')){_0x2ffa05['abandoned']+=0x1;updateWaitingCounter(_0x2ffa05);}if(_0x2ffa05[_0x1c56('0xb')]){_0x2ffa05[_0x1c56('0x6')]+=0x1;if(_0x2ffa05['talking']){_0x2ffa05[_0x1c56('0x5')]-=0x1;}}else{if(_0x2ffa05[_0x1c56('0xa')]){_0x2ffa05['unmanaged']+=0x1;updateWaitingCounter(_0x2ffa05);}}}else{if(!_0x2ffa05[_0x1c56('0xb')]){_0x2ffa05['waiting']+=0x1;}if(_0x2ffa05[_0x1c56('0xb')]){_0x2ffa05[_0x1c56('0x5')]+=0x1;updateWaitingCounter(_0x2ffa05);}}_0x2ffa05[_0x1c56('0xc')]+=0x1;return _0x2ffa05;}function getLastMessageText(_0x2ef6c7){return db[_0x1c56('0xd')][_0x1c56('0xe')]({'where':{'$and':[{'MailInteractionId':_0x2ef6c7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1c56('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1c56('0x10')],'order':'-id','raw':!![]})['then'](function(_0x388907){if(_0x388907&&_0x388907[_0x1c56('0x10')]){_0x2ef6c7['lastMsgText']=_[_0x1c56('0x11')](_0x388907[_0x1c56('0x10')]);}return _0x2ef6c7;})[_0x1c56('0x12')](function(_0x2efc66){throw _0x2efc66;});}exports['updateInteraction']=function(_0x2d1b7f,_0x5d61d7,_0x50800e,_0x1d7dd6){return new Promise(function(_0x5fc6ce,_0x4b44f9){return getInteractionUsers(_0x2d1b7f['id'],_0x50800e)[_0x1c56('0x13')](function(_0xc9bbae){_0x2d1b7f['Users']=_0xc9bbae;return getInteractionTags(_0x2d1b7f[_0x1c56('0x14')],_0x5d61d7);})['then'](function(_0xa8989a){_0x2d1b7f['Tags']=_0xa8989a;delete _0x2d1b7f[_0x1c56('0x14')];return updateInteractionCounters(_0x2d1b7f);})['then'](function(_0x377979){if(_0x1d7dd6){return getLastMessageText(_0x377979);}else{return _0x377979;}})[_0x1c56('0x13')](function(_0x440ea6){_0x5fc6ce(_0x440ea6);})[_0x1c56('0x12')](function(_0x5c7462){_0x4b44f9(_0x5c7462);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 7410fc1..d29584a 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3aab=['name','role','null','Interaction','findOne','then','update','info','catch','error','lodash','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0xe9ffcd,_0x2627fe){var _0x144bae=function(_0x3554fe){while(--_0x3554fe){_0xe9ffcd['push'](_0xe9ffcd['shift']());}};_0x144bae(++_0x2627fe);}(_0x3aab,0x13e));var _0xb3aa=function(_0x5004cf,_0x67fc6c){_0x5004cf=_0x5004cf-0x0;var _0x2c42b2=_0x3aab[_0x5004cf];return _0x2c42b2;};'use strict';var _=require(_0xb3aa('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0xb3aa('0x1')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xb3aa('0x2'))(_0xb3aa('0x3')),'sms':require('../../config/logger')(_0xb3aa('0x4')),'chat':require(_0xb3aa('0x2'))(_0xb3aa('0x5')),'whatsapp':require(_0xb3aa('0x2'))(_0xb3aa('0x6'))};function getAccountFK(_0x4c5a4c){return _[_0xb3aa('0x7')](_0x4c5a4c)+(_0x4c5a4c==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0x44e48c){return _['capitalize'](_0x44e48c)+_0xb3aa('0x8');}function getInteractionId(_0x306576,_0xc05c27,_0x40e539){if(_0x306576&&_0x306576[_[_0xb3aa('0x9')](_0x40e539)+_0xb3aa('0x8')]){return _0x306576[_['upperFirst'](_0x40e539)+'InteractionId'];}else if(_0x306576&&_0x306576['id']){return _0x306576['id'];}else if(_0xc05c27&&_0xc05c27['id']){return _0xc05c27['id'];}else{return _0xb3aa('0xa');}}function getInteractionsTables(_0x8c9213){return{'accounts':_0x8c9213+'_'+(_0x8c9213==='chat'?'websites':_0xb3aa('0xb')),'interactions':_0x8c9213+_0xb3aa('0xc'),'interactionsTags':_0x8c9213+_0xb3aa('0xd'),'messages':_0x8c9213+_0xb3aa('0xe'),'userInteractions':_0xb3aa('0xf')+_0x8c9213+_0xb3aa('0xc')};}function getSelectedTags(_0x259ea4){var _0x42284a=[];if(_0x259ea4){_0x42284a=Array[_0xb3aa('0x10')](_0x259ea4)?_0x259ea4:[_0x259ea4];}return _0x42284a;}function log(_0x448bce,_0x236aaa,_0x1dbea3,_0x27a2dd,_0x4ec865,_0x167196){loggers[_0x4ec865['toLowerCase']()][_0x448bce](_0xb3aa('0x11'),_0x167196['toUpperCase'](),_0x236aaa?_0x236aaa['id']:null,_0x236aaa?_0x236aaa[_0xb3aa('0x12')]:null,_0x236aaa?_0x236aaa[_0xb3aa('0x13')]:null,getInteractionId(_0x1dbea3,_0x27a2dd,_0x4ec865),_0x1dbea3?JSON['stringify'](_0x1dbea3):_0xb3aa('0x14'));}function updateUser(_0x208f1c,_0x141e64,_0x427f69,_0x44845e,_0x19d44e){db[_[_0xb3aa('0x9')](_0x44845e)+_0xb3aa('0x15')][_0xb3aa('0x16')]({'where':{'id':getInteractionId(_0x141e64,_0x427f69,_0x44845e)}})[_0xb3aa('0x17')](function(_0x4cbefb){if(_0x4cbefb){return _0x4cbefb[_0xb3aa('0x18')]({'UserId':_0x208f1c?_0x208f1c['id']:null});}})['then'](function(_0x71b44b){if(_0x71b44b){log(_0xb3aa('0x19'),_0x208f1c,_0x141e64,_0x427f69,_0x44845e,_0x19d44e);}})[_0xb3aa('0x1a')](function(){log(_0xb3aa('0x1b'),_0x208f1c,_0x141e64,_0x427f69,_0x44845e,_0x19d44e);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x3a3d=['info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','findOne','then'];(function(_0xc6e4ea,_0x35edbe){var _0x76c775=function(_0x7dbd2b){while(--_0x7dbd2b){_0xc6e4ea['push'](_0xc6e4ea['shift']());}};_0x76c775(++_0x35edbe);}(_0x3a3d,0x159));var _0xd3a3=function(_0x5d0b8a,_0x2c191){_0x5d0b8a=_0x5d0b8a-0x0;var _0x480785=_0x3a3d[_0x5d0b8a];return _0x480785;};'use strict';var _=require(_0xd3a3('0x0'));var db=require(_0xd3a3('0x1'))['db'];var loggers={'openchannel':require(_0xd3a3('0x2'))(_0xd3a3('0x3')),'mail':require(_0xd3a3('0x2'))('mail-interactions'),'fax':require(_0xd3a3('0x2'))(_0xd3a3('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xd3a3('0x2'))(_0xd3a3('0x5')),'whatsapp':require(_0xd3a3('0x2'))(_0xd3a3('0x6'))};function getAccountFK(_0x497d72){return _[_0xd3a3('0x7')](_0x497d72)+(_0x497d72===_0xd3a3('0x8')?'Website':'Account')+'Id';}function getInteractionFK(_0x500a6a){return _[_0xd3a3('0x7')](_0x500a6a)+'InteractionId';}function getInteractionId(_0x342404,_0x17f554,_0x251987){if(_0x342404&&_0x342404[_[_0xd3a3('0x9')](_0x251987)+'InteractionId']){return _0x342404[_['upperFirst'](_0x251987)+_0xd3a3('0xa')];}else if(_0x342404&&_0x342404['id']){return _0x342404['id'];}else if(_0x17f554&&_0x17f554['id']){return _0x17f554['id'];}else{return _0xd3a3('0xb');}}function getInteractionsTables(_0x5ef69f){return{'accounts':_0x5ef69f+'_'+(_0x5ef69f===_0xd3a3('0x8')?_0xd3a3('0xc'):_0xd3a3('0xd')),'interactions':_0x5ef69f+_0xd3a3('0xe'),'interactionsTags':_0x5ef69f+_0xd3a3('0xf'),'messages':_0x5ef69f+_0xd3a3('0x10'),'userInteractions':_0xd3a3('0x11')+_0x5ef69f+_0xd3a3('0xe')};}function getSelectedTags(_0x27f0cd){var _0xe1e145=[];if(_0x27f0cd){_0xe1e145=Array[_0xd3a3('0x12')](_0x27f0cd)?_0x27f0cd:[_0x27f0cd];}return _0xe1e145;}function log(_0x2668a0,_0x5d77c5,_0x2c0e57,_0x15acc6,_0x18366,_0xe93358){loggers[_0x18366[_0xd3a3('0x13')]()][_0x2668a0](_0xd3a3('0x14'),_0xe93358['toUpperCase'](),_0x5d77c5?_0x5d77c5['id']:null,_0x5d77c5?_0x5d77c5[_0xd3a3('0x15')]:null,_0x5d77c5?_0x5d77c5[_0xd3a3('0x16')]:null,getInteractionId(_0x2c0e57,_0x15acc6,_0x18366),_0x2c0e57?JSON['stringify'](_0x2c0e57):_0xd3a3('0x17'));}function updateUser(_0x1faafe,_0x974c01,_0x17bc5e,_0x13a552,_0x55624e){db[_[_0xd3a3('0x9')](_0x13a552)+_0xd3a3('0x18')][_0xd3a3('0x19')]({'where':{'id':getInteractionId(_0x974c01,_0x17bc5e,_0x13a552)}})[_0xd3a3('0x1a')](function(_0x5dfefc){if(_0x5dfefc){return _0x5dfefc['update']({'UserId':_0x1faafe?_0x1faafe['id']:null});}})[_0xd3a3('0x1a')](function(_0x5c89ef){if(_0x5c89ef){log(_0xd3a3('0x1b'),_0x1faafe,_0x974c01,_0x17bc5e,_0x13a552,_0x55624e);}})[_0xd3a3('0x1c')](function(){log(_0xd3a3('0x1d'),_0x1faafe,_0x974c01,_0x17bc5e,_0x13a552,_0x55624e);});}module[_0xd3a3('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index bbe2242..81edc9a 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 _0x5fd6=['crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','user','isUserLimit'];(function(_0x4284e4,_0x9f2d2a){var _0x5a14ce=function(_0x2a40cd){while(--_0x2a40cd){_0x4284e4['push'](_0x4284e4['shift']());}};_0x5a14ce(++_0x9f2d2a);}(_0x5fd6,0xfc));var _0x65fd=function(_0x24d810,_0x12ca85){_0x24d810=_0x24d810-0x0;var _0x14f990=_0x5fd6[_0x24d810];return _0x14f990;};'use strict';var crypto=require(_0x65fd('0x0'));var util=require(_0x65fd('0x1'));var compose=require(_0x65fd('0x2'));var db=require(_0x65fd('0x3'))['db'];var config=require(_0x65fd('0x4'));function getValueFromLicense(_0x485409,_0x5e04b0){if(_0x485409&&_0x5e04b0){if(_0x5e04b0[_0x65fd('0x5')]&&_0x5e04b0[_0x65fd('0x6')]){var _0x5383eb=_0x5e04b0[_0x65fd('0x5')];var _0x224548=_0x5e04b0['license'];var _0x5cb199=_0x5383eb[_0x65fd('0x7')]('-')[0x4];var _0x41a459=_0x5383eb['split']('-')[0x0];var _0x48141c=crypto[_0x65fd('0x8')]('aes-256-ctr',util[_0x65fd('0x9')](_0x65fd('0xa'),_0x5cb199,_0x5383eb,_0x41a459));var _0x32714b=_0x48141c[_0x65fd('0xb')](_0x224548,'base64',_0x65fd('0xc'));_0x32714b+=_0x48141c[_0x65fd('0xd')](_0x65fd('0xc'));var _0x27622d=JSON[_0x65fd('0xe')](_0x32714b);return _0x27622d[_0x65fd('0xf')](_0x485409)?_0x27622d[_0x485409]:null;}}return null;}function isLimit(_0x17d5e5,_0x243a3c,_0x1ebdcc,_0x1b36ce){var _0x7c4530=_0x243a3c;return compose()[_0x65fd('0x10')](function(_0x1141c9,_0x38dd72,_0x1a1485){return db[_0x65fd('0x11')][_0x65fd('0x12')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3a5b4c){var _0x339279=getValueFromLicense(_0x17d5e5,_0x3a5b4c);return _0x339279?_0x339279:_0x7c4530;})[_0x65fd('0x13')](function(_0x46a03f){_0x7c4530=_0x46a03f;return _0x1ebdcc[_0x65fd('0x14')](_0x1b36ce);})['then'](function(_0xe23e2f){if(_0xe23e2f>=_0x7c4530){return _0x38dd72[_0x65fd('0x15')](0x193)[_0x65fd('0x16')]({'message':util[_0x65fd('0x9')](_0x65fd('0x17'),_0x17d5e5)});}_0x1a1485();})['catch'](function(_0x253380){_0x1a1485(_0x253380);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x65fd('0x18')],{'where':{'$or':[{'role':_0x65fd('0x19')},{'role':_0x65fd('0x1a')}]}});}exports[_0x65fd('0x1b')]=isUserLimit; \ No newline at end of file +var _0x4d45=['then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','update','base64','utf8','final','parse','use','License'];(function(_0x297524,_0x1f308e){var _0x9bb17e=function(_0x116ef0){while(--_0x116ef0){_0x297524['push'](_0x297524['shift']());}};_0x9bb17e(++_0x1f308e);}(_0x4d45,0x14e));var _0x54d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d45[_0x3b380d];return _0x54502b;};'use strict';var crypto=require(_0x54d4('0x0'));var util=require('util');var compose=require(_0x54d4('0x1'));var db=require(_0x54d4('0x2'))['db'];var config=require(_0x54d4('0x3'));function getValueFromLicense(_0x251a0a,_0x2bc9aa){if(_0x251a0a&&_0x2bc9aa){if(_0x2bc9aa[_0x54d4('0x4')]&&_0x2bc9aa[_0x54d4('0x5')]){var _0x4a9efb=_0x2bc9aa[_0x54d4('0x4')];var _0x3ee04b=_0x2bc9aa['license'];var _0x45ef6c=_0x4a9efb[_0x54d4('0x6')]('-')[0x4];var _0x3fee9b=_0x4a9efb[_0x54d4('0x6')]('-')[0x0];var _0x3d9bb9=crypto[_0x54d4('0x7')]('aes-256-ctr',util[_0x54d4('0x8')]('%s:%s:%s',_0x45ef6c,_0x4a9efb,_0x3fee9b));var _0x88c6af=_0x3d9bb9[_0x54d4('0x9')](_0x3ee04b,_0x54d4('0xa'),_0x54d4('0xb'));_0x88c6af+=_0x3d9bb9[_0x54d4('0xc')]('utf8');var _0xd56d93=JSON[_0x54d4('0xd')](_0x88c6af);return _0xd56d93['hasOwnProperty'](_0x251a0a)?_0xd56d93[_0x251a0a]:null;}}return null;}function isLimit(_0x3829dc,_0xb5610b,_0x31aff9,_0x295afe){var _0x6b920a=_0xb5610b;return compose()[_0x54d4('0xe')](function(_0x35e6dd,_0x56df9c,_0xc53795){return db[_0x54d4('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x54d4('0x10')](function(_0x112bf1){var _0x4d885c=getValueFromLicense(_0x3829dc,_0x112bf1);return _0x4d885c?_0x4d885c:_0x6b920a;})['then'](function(_0x6390bd){_0x6b920a=_0x6390bd;return _0x31aff9[_0x54d4('0x11')](_0x295afe);})[_0x54d4('0x10')](function(_0x563713){if(_0x563713>=_0x6b920a){return _0x56df9c[_0x54d4('0x12')](0x193)[_0x54d4('0x13')]({'message':util[_0x54d4('0x8')](_0x54d4('0x14'),_0x3829dc)});}_0xc53795();})[_0x54d4('0x15')](function(_0x1db093){_0xc53795(_0x1db093);});});}function isUserLimit(){return isLimit(_0x54d4('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x54d4('0x17')},{'role':_0x54d4('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0a066c0..1520acb 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 _0x9c62=['[$and]','[$or]','split','length','slice','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','format','castTo','CAST(','field','\x20AS\x20','includes','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','$lte','<=\x20?','$gte','start','shift','utcOffset','hours','minutes','seconds','lodash','parseSearch','and','replace'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x9c62,0x98));var _0x29c6=function(_0x362fa2,_0x42ff83){_0x362fa2=_0x362fa2-0x0;var _0x507057=_0x9c62[_0x362fa2];return _0x507057;};'use strict';var _=require(_0x29c6('0x0'));var moment=require('moment');exports[_0x29c6('0x1')]=function(_0x2bcf7c){var _0x127da7={'conditions':[]};_0x127da7['sqlOperator']=_['startsWith'](_0x2bcf7c,'[$or]')?'or':_0x29c6('0x2');var _0x24f369=_0x2bcf7c[_0x29c6('0x3')](_0x29c6('0x4'),'')[_0x29c6('0x3')](_0x29c6('0x5'),'')[_0x29c6('0x6')]('||');for(var _0x769f89=0x0;_0x769f89<_0x24f369[_0x29c6('0x7')];_0x769f89++){var _0x5a13ed=_0x24f369[_0x769f89][_0x29c6('0x6')](':=');var _0x7c0631=_0x5a13ed[0x0];var _0x3500c5=_0x5a13ed[_0x29c6('0x8')](0x1);_0x3500c5['forEach'](function(_0x2153e0){var _0x460d76=_0x2153e0[_0x29c6('0x6')]('[')['shift']();var _0x252ff5=_0x2153e0[_0x29c6('0x9')](/\[(.*?)\]/g);_0x252ff5[_0x29c6('0xa')](function(_0x20a9ba){var _0x3d3e74=_0x20a9ba[_0x29c6('0x6')]('[')[_0x29c6('0xb')](function(_0x4e1946){return _0x4e1946[_0x29c6('0xc')](']')>-0x1;})[_0x29c6('0xd')](function(_0x17163e){return _0x17163e['split'](']')[0x0];})[0x0];_0x127da7[_0x29c6('0xe')][_0x29c6('0xf')]({'field':_0x7c0631,'operator':_0x460d76,'value':_0x3d3e74});});});}return _0x127da7;};exports[_0x29c6('0x10')]=function(_0x3c2818,_0x4da4d4,_0x3d14be){var _0xa0ee76={};if(_0x4da4d4===_0x29c6('0x11')){if(_0x3d14be[_0x29c6('0x12')]===_0x29c6('0x13')){_0x3d14be['operator']=_0x29c6('0x14');_0x3d14be[_0x29c6('0x15')]+=','+_0x3d14be['value'];}else if(_['includes']([_0x29c6('0x16'),'$lte'],_0x3d14be['operator'])){_0x3d14be[_0x29c6('0x15')]=moment(_0x3d14be[_0x29c6('0x15')])[_0x29c6('0x17')](0x1,_0x29c6('0x18'))[_0x29c6('0x19')]('YYYY-MM-DD');}}if(_0x3d14be[_0x29c6('0x1a')]){_0x4da4d4=_0x3d14be[_0x29c6('0x1a')];_0xa0ee76['text']=_0x29c6('0x1b')+_0x3c2818+'.'+_0x3d14be[_0x29c6('0x1c')]+_0x29c6('0x1d')+_0x3d14be[_0x29c6('0x1a')]+')\x20'+parseOperator(_0x3d14be['operator']);}else{_0xa0ee76['text']=_0x3c2818+'.'+_0x3d14be[_0x29c6('0x1c')]+'\x20'+parseOperator(_0x3d14be[_0x29c6('0x12')]);}if(_[_0x29c6('0x1e')]([_0x29c6('0x1f'),_0x29c6('0x20')],_0x3d14be['operator']))_0xa0ee76[_0x29c6('0x21')]='('+_0xa0ee76['text']+_0x29c6('0x22')+_0x3c2818+'.'+_0x3d14be[_0x29c6('0x1c')]+_0x29c6('0x23');_0xa0ee76[_0x29c6('0x15')]=parseValue(_0x4da4d4,_0x3d14be[_0x29c6('0x12')],_0x3d14be[_0x29c6('0x15')]);return _0xa0ee76;};function parseOperator(_0x50a684){var _0x2cbc81;switch(_0x50a684){case'$in':_0x2cbc81='IN\x20?';break;case _0x29c6('0x20'):_0x2cbc81=_0x29c6('0x24');break;case _0x29c6('0x13'):_0x2cbc81=_0x29c6('0x25');break;case _0x29c6('0x1f'):_0x2cbc81=_0x29c6('0x26');break;case'$substring':case _0x29c6('0x27'):case _0x29c6('0x28'):_0x2cbc81='LIKE\x20?';break;case'$lt':_0x2cbc81=_0x29c6('0x29');break;case _0x29c6('0x16'):_0x2cbc81=_0x29c6('0x2a');break;case _0x29c6('0x2b'):_0x2cbc81=_0x29c6('0x2c');break;case _0x29c6('0x2d'):_0x2cbc81='>=\x20?';break;case'$between':_0x2cbc81='BETWEEN\x20?\x20AND\x20?';break;}return _0x2cbc81;}function parseValue(_0x1f4f9a,_0x5be21a,_0x18c45e){var _0x3de07d={'start':undefined,'end':undefined};switch(_0x5be21a){case'$in':case _0x29c6('0x20'):_0x3de07d[_0x29c6('0x2e')]=_0x18c45e[_0x29c6('0x6')](',');break;case'$substring':_0x3de07d[_0x29c6('0x2e')]='%'+_0x18c45e+'%';break;case'$startsWith':_0x3de07d['start']=_0x18c45e+'%';break;case _0x29c6('0x28'):_0x3de07d[_0x29c6('0x2e')]='%'+_0x18c45e;break;case _0x29c6('0x14'):var _0x4f8365=_0x18c45e[_0x29c6('0x6')](',');var _0x18c45e=_0x4f8365[_0x29c6('0x2f')]();var _0xe18e30=_0x4f8365['pop']();if(_0x1f4f9a===_0x29c6('0x11')){_0x18c45e=moment(_0x18c45e)[_0x29c6('0x30')](0x0,!![])[_0x29c6('0x19')]();_0xe18e30=moment(_0xe18e30)[_0x29c6('0x30')](0x0,!![])[_0x29c6('0x17')](0x17,_0x29c6('0x31'))[_0x29c6('0x17')](0x3b,_0x29c6('0x32'))[_0x29c6('0x17')](0x3b,_0x29c6('0x33'))[_0x29c6('0x19')]();}_0x3de07d={'start':_0x18c45e,'end':_0xe18e30};break;default:_0x3de07d[_0x29c6('0x2e')]=_0x18c45e;break;}return _0x3de07d;} \ No newline at end of file +var _0xba3c=['$eq','value','$gt','$lte','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','operator','text','includes','$ne','\x20OR\x20','IN\x20?','$notIn','=\x20?','<>\x20?','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$startsWith','$between','shift','pop','DATE','utcOffset','add','minutes','seconds','lodash','moment','[$or]','replace','split','length','slice','forEach','indexOf','map','conditions','push'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xba3c,0x1de));var _0xcba3=function(_0x40f170,_0x4e26c6){_0x40f170=_0x40f170-0x0;var _0x5ed0a4=_0xba3c[_0x40f170];return _0x5ed0a4;};'use strict';var _=require(_0xcba3('0x0'));var moment=require(_0xcba3('0x1'));exports['parseSearch']=function(_0x187c1e){var _0x2ce731={'conditions':[]};_0x2ce731['sqlOperator']=_['startsWith'](_0x187c1e,_0xcba3('0x2'))?'or':'and';var _0x242ec8=_0x187c1e[_0xcba3('0x3')]('[$and]','')['replace'](_0xcba3('0x2'),'')[_0xcba3('0x4')]('||');for(var _0x4cc330=0x0;_0x4cc330<_0x242ec8[_0xcba3('0x5')];_0x4cc330++){var _0x2a296a=_0x242ec8[_0x4cc330][_0xcba3('0x4')](':=');var _0x1b7e22=_0x2a296a[0x0];var _0x127ab2=_0x2a296a[_0xcba3('0x6')](0x1);_0x127ab2['forEach'](function(_0x16ed3a){var _0x5bc8d9=_0x16ed3a[_0xcba3('0x4')]('[')['shift']();var _0x17a7e8=_0x16ed3a['match'](/\[(.*?)\]/g);_0x17a7e8[_0xcba3('0x7')](function(_0x19b119){var _0x578661=_0x19b119[_0xcba3('0x4')]('[')['filter'](function(_0x2c4e43){return _0x2c4e43[_0xcba3('0x8')](']')>-0x1;})[_0xcba3('0x9')](function(_0x5523a2){return _0x5523a2[_0xcba3('0x4')](']')[0x0];})[0x0];_0x2ce731[_0xcba3('0xa')][_0xcba3('0xb')]({'field':_0x1b7e22,'operator':_0x5bc8d9,'value':_0x578661});});});}return _0x2ce731;};exports['buildExpression']=function(_0x56a24b,_0x57530a,_0x27c175){var _0x2c6e07={};if(_0x57530a==='DATE'){if(_0x27c175['operator']===_0xcba3('0xc')){_0x27c175['operator']='$between';_0x27c175[_0xcba3('0xd')]+=','+_0x27c175[_0xcba3('0xd')];}else if(_['includes']([_0xcba3('0xe'),_0xcba3('0xf')],_0x27c175['operator'])){_0x27c175[_0xcba3('0xd')]=moment(_0x27c175[_0xcba3('0xd')])['add'](0x1,'days')[_0xcba3('0x10')](_0xcba3('0x11'));}}if(_0x27c175[_0xcba3('0x12')]){_0x57530a=_0x27c175['castTo'];_0x2c6e07['text']=_0xcba3('0x13')+_0x56a24b+'.'+_0x27c175[_0xcba3('0x14')]+_0xcba3('0x15')+_0x27c175[_0xcba3('0x12')]+')\x20'+parseOperator(_0x27c175[_0xcba3('0x16')]);}else{_0x2c6e07[_0xcba3('0x17')]=_0x56a24b+'.'+_0x27c175['field']+'\x20'+parseOperator(_0x27c175[_0xcba3('0x16')]);}if(_[_0xcba3('0x18')]([_0xcba3('0x19'),'$notIn'],_0x27c175['operator']))_0x2c6e07[_0xcba3('0x17')]='('+_0x2c6e07[_0xcba3('0x17')]+_0xcba3('0x1a')+_0x56a24b+'.'+_0x27c175[_0xcba3('0x14')]+'\x20IS\x20NULL)';_0x2c6e07[_0xcba3('0xd')]=parseValue(_0x57530a,_0x27c175[_0xcba3('0x16')],_0x27c175[_0xcba3('0xd')]);return _0x2c6e07;};function parseOperator(_0xebae26){var _0x19c85a;switch(_0xebae26){case'$in':_0x19c85a=_0xcba3('0x1b');break;case _0xcba3('0x1c'):_0x19c85a='NOT\x20IN\x20?';break;case _0xcba3('0xc'):_0x19c85a=_0xcba3('0x1d');break;case _0xcba3('0x19'):_0x19c85a=_0xcba3('0x1e');break;case'$substring':case'$startsWith':case _0xcba3('0x1f'):_0x19c85a='LIKE\x20?';break;case'$lt':_0x19c85a=_0xcba3('0x20');break;case _0xcba3('0xe'):_0x19c85a=_0xcba3('0x21');break;case'$lte':_0x19c85a=_0xcba3('0x22');break;case _0xcba3('0x23'):_0x19c85a='>=\x20?';break;case'$between':_0x19c85a=_0xcba3('0x24');break;}return _0x19c85a;}function parseValue(_0x3a6e8a,_0x27e5e4,_0x1beee4){var _0xa622e2={'start':undefined,'end':undefined};switch(_0x27e5e4){case _0xcba3('0x25'):case _0xcba3('0x1c'):_0xa622e2[_0xcba3('0x26')]=_0x1beee4[_0xcba3('0x4')](',');break;case _0xcba3('0x27'):_0xa622e2[_0xcba3('0x26')]='%'+_0x1beee4+'%';break;case _0xcba3('0x28'):_0xa622e2['start']=_0x1beee4+'%';break;case'$endsWith':_0xa622e2[_0xcba3('0x26')]='%'+_0x1beee4;break;case _0xcba3('0x29'):var _0x4a9f54=_0x1beee4[_0xcba3('0x4')](',');var _0x1beee4=_0x4a9f54[_0xcba3('0x2a')]();var _0x5ff952=_0x4a9f54[_0xcba3('0x2b')]();if(_0x3a6e8a===_0xcba3('0x2c')){_0x1beee4=moment(_0x1beee4)['utcOffset'](0x0,!![])['format']();_0x5ff952=moment(_0x5ff952)[_0xcba3('0x2d')](0x0,!![])['add'](0x17,'hours')[_0xcba3('0x2e')](0x3b,_0xcba3('0x2f'))[_0xcba3('0x2e')](0x3b,_0xcba3('0x30'))['format']();}_0xa622e2={'start':_0x1beee4,'end':_0x5ff952};break;default:_0xa622e2[_0xcba3('0x26')]=_0x1beee4;break;}return _0xa622e2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6381df5..0a8f536 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 _0xf5a7=['parse','keys','includes','model','alias','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','utc','$lte','subtract','name','isArray','split','limit','offset','sort','priority','cast','col','unsigned','DESC','omit','length','isObject','unset','match','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','push','{EXPR}','getOptions','$id','query','map','intersection','attributes','nolimit','pick','filter','object','columns','value','merge','where','VIRTUAL','lower','options','includeAll','include','lodash','sequelize','../../mysqldb'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf5a7,0x133));var _0x7f5a=function(_0x311572,_0x4c8a6b){_0x311572=_0x311572-0x0;var _0x35763e=_0xf5a7[_0x311572];return _0x35763e;};'use strict';var _=require(_0x7f5a('0x0'));var sequelize=require(_0x7f5a('0x1'));var moment=require('moment');var db=require(_0x7f5a('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x13cc6f){var _0x15a24a=['ne'];try{var _0x25616d=JSON[_0x7f5a('0x3')](_0x13cc6f);var _0x342fa0=Object[_0x7f5a('0x4')](_0x25616d)[0x0];return _0x15a24a[_0x7f5a('0x5')](_0x342fa0);}catch(_0x35ec90){return![];}}function getOperatorValue(_0x520bf9){var _0x2808f2=JSON[_0x7f5a('0x3')](_0x520bf9);var _0x585e25=Object[_0x7f5a('0x4')](_0x2808f2)[0x0];var _0x46d6d5=_0x2808f2[_0x585e25];return{['$'+_0x585e25]:_0x46d6d5};}function parseIncludeModel(_0x2a21fe){var _0x4da417=JSON['parse'](_0x2a21fe);return{'model':db[_0x4da417[_0x7f5a('0x6')]],'as':_0x4da417[_0x7f5a('0x7')],'attributes':_0x4da417['fields'],'raw':_0x4da417['raw']};}exports[_0x7f5a('0x8')]=function(_0x3bf4bd){var _0x4b2af6=null;if(_0x3bf4bd){_0x4b2af6=_0x3bf4bd['split'](',');}return _0x4b2af6;};exports[_0x7f5a('0x9')]=function(_0x276766,_0x2882a2){var _0x25efad={};if(!_[_0x7f5a('0xa')](_0x276766)){_[_0x7f5a('0xb')](_0x276766,function(_0x55ca4b,_0xc6795b){try{if(_0x2882a2){var _0x405223=_[_0x7f5a('0xc')](_0x2882a2,{'name':_0xc6795b})||{};if(hasSequelizeOperator(_0x55ca4b)){_0x25efad[_0xc6795b]=getOperatorValue(_0x55ca4b);}else if(_0x405223[_0x7f5a('0xd')]===_0x7f5a('0xe')&&_[_0x7f5a('0xf')](_0x55ca4b)){var _0x117772=JSON[_0x7f5a('0x3')](_0x55ca4b);var _0x4ce5c2={'$gte':moment(moment(_0x117772[_0x7f5a('0x10')])[_0x7f5a('0x11')]('YYYY-MM-DD'))[_0x7f5a('0x12')]()[_0x7f5a('0x11')](),'$lte':moment(moment(_0x117772[_0x7f5a('0x13')])[_0x7f5a('0x11')]('YYYY-MM-DD'))[_0x7f5a('0x12')]()[_0x7f5a('0x14')](0x1,'s')[_0x7f5a('0x11')]()};_0x25efad[_0xc6795b]=_0x4ce5c2;}else if(_0x405223[_0x7f5a('0x15')]==='uniqueid'){_0x25efad[_0xc6795b]=_0x55ca4b;}else{_0x25efad[_0xc6795b]=_[_0x7f5a('0x16')](_0x55ca4b)?_0x55ca4b:JSON[_0x7f5a('0x3')](_0x55ca4b);}}else{_0x25efad[_0xc6795b]=_['isArray'](_0x55ca4b)?_0x55ca4b:JSON['parse'](_0x55ca4b);}}catch(_0x137dea){_0x25efad[_0xc6795b]=_0x55ca4b[_0x7f5a('0x17')](',');}});}return _0x25efad;};exports[_0x7f5a('0x18')]=function(_0x90c080){_0x90c080=parseInt(_0x90c080,0xa);if(!_0x90c080||_0x90c080<0x0){_0x90c080=LIMIT_VALUE;}return _0x90c080;};exports[_0x7f5a('0x19')]=function(_0xa06d71){_0xa06d71=parseInt(_0xa06d71,0xa);if(!_0xa06d71||_0xa06d71<0x0){_0xa06d71=0x0;}return _0xa06d71;};exports[_0x7f5a('0x1a')]=function(_0x440a5f){var _0x589a64,_0x4b8d6b=null;if(_0x440a5f){_0x589a64=_0x440a5f[_0x7f5a('0x17')](',');_0x4b8d6b=_['map'](_0x589a64,function(_0x1a4734){if(_0x1a4734['indexOf']('-')===0x0){return[_0x1a4734===_0x7f5a('0x1b')?sequelize[_0x7f5a('0x1c')](sequelize[_0x7f5a('0x1d')](_0x7f5a('0x1b')),_0x7f5a('0x1e')):_0x1a4734['substr'](0x1),_0x7f5a('0x1f')];}else{return[_0x1a4734==='priority'?sequelize[_0x7f5a('0x1c')](sequelize[_0x7f5a('0x1d')]('priority'),_0x7f5a('0x1e')):_0x1a4734,'ASC'];}});}return _0x4b8d6b;};exports[_0x7f5a('0x20')]=function(_0x2bfbfe,_0x3d0d6b){if(_[_0x7f5a('0xa')](_0x2bfbfe)){return _0x2bfbfe;}if(_['isArray'](_0x2bfbfe)){for(var _0xf07e85=0x0;_0xf07e85<_0x2bfbfe[_0x7f5a('0x21')];_0xf07e85+=0x1){_0x2bfbfe[_0xf07e85]=this[_0x7f5a('0x20')](_0x2bfbfe[_0xf07e85],_0x3d0d6b);}return _0x2bfbfe;}if(!_[_0x7f5a('0x22')](_0x2bfbfe)){return _0x2bfbfe;}if(_['isString'](_0x3d0d6b)){_0x3d0d6b=[_0x3d0d6b];}if(!_['isArray'](_0x3d0d6b)){return _0x2bfbfe;}for(var _0x550e81=0x0;_0x550e81<_0x3d0d6b[_0x7f5a('0x21')];_0x550e81+=0x1){_[_0x7f5a('0x23')](_0x2bfbfe,_0x3d0d6b[_0x550e81]);}for(var _0x332baa in _0x2bfbfe){if(_0x2bfbfe['hasOwnProperty'](_0x332baa)){_0x2bfbfe[_0x332baa]=this[_0x7f5a('0x20')](_0x2bfbfe[_0x332baa],_0x3d0d6b);}}return _0x2bfbfe;};exports['isNumeric']=function(_0x347d5c){return _0x347d5c[_0x7f5a('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x7f5a('0x25')]=function(_0x33d54c){return _0x33d54c[_0x7f5a('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x7f5a('0x26')]=function(_0x1db97,_0x974d87){var _0xe0e60f=[];var _0x9cc236=/[ `!@#$%^&*()_\-?~]/;var _0x5d706c=_0x974d87?_0x7f5a('0x27'):'{EXPR}';_0x1db97['split'](/[ ,]+/)['forEach'](function(_0x2ed581){_0x2ed581=_0x2ed581[_0x7f5a('0x28')](/([^:]")"+/g,'$1');_0x2ed581='+'+_0x2ed581+'*';var _0x276c8c=_0x2ed581[_0x7f5a('0x24')](_0x9cc236);if(_0x276c8c){_0x2ed581='\x22'+_0x2ed581+'\x22';}_0xe0e60f[_0x7f5a('0x29')](_0x2ed581);});_0x5d706c=_0x5d706c['replace'](_0x7f5a('0x2a'),_0xe0e60f['join']('\x20'));return _0x5d706c;};exports[_0x7f5a('0x2b')]=function(_0x5ecb31,_0x777184,_0x2e6964){var _0x3bf019={},_0x5d24cc={};if(_0x777184['query'][_0x7f5a('0x2c')]){_0x777184[_0x7f5a('0x2d')]['id']=_0x777184[_0x7f5a('0x2d')]['$id'];delete _0x777184[_0x7f5a('0x2d')]['$id'];}_0x3bf019['model']=_[_0x7f5a('0x2e')](_0x5ecb31,_0x7f5a('0x15'));_0x3bf019['query']=_[_0x7f5a('0x4')](_0x777184[_0x7f5a('0x2d')]);_0x3bf019[_0x7f5a('0x9')]=_[_0x7f5a('0x2f')](_0x3bf019[_0x7f5a('0x6')],_0x3bf019['query']);_0x5d24cc['attributes']=_['intersection'](_0x3bf019['model'],this[_0x7f5a('0x8')](_0x777184['query'][_0x7f5a('0x8')]));_0x5d24cc[_0x7f5a('0x30')]=_0x5d24cc[_0x7f5a('0x30')][_0x7f5a('0x21')]?_0x5d24cc[_0x7f5a('0x30')]:_0x3bf019['model'];if(!_0x777184[_0x7f5a('0x2d')]['hasOwnProperty'](_0x7f5a('0x31'))){_0x5d24cc[_0x7f5a('0x18')]=this[_0x7f5a('0x18')](_0x777184['query'][_0x7f5a('0x18')]);_0x5d24cc['offset']=this[_0x7f5a('0x19')](_0x777184[_0x7f5a('0x2d')]['offset']);}_0x5d24cc['order']=this['sort'](_0x777184[_0x7f5a('0x2d')]['sort']);_0x5d24cc['where']=this[_0x7f5a('0x9')](_[_0x7f5a('0x32')](_0x777184[_0x7f5a('0x2d')],_0x3bf019[_0x7f5a('0x9')]),_0x5ecb31);if(_0x777184[_0x7f5a('0x2d')][_0x7f5a('0x33')]){var _0x121fdf=_0x5ecb31;var _0x29b022=_0x777184[_0x7f5a('0x2d')][_0x7f5a('0x33')];if(typeof _0x29b022===_0x7f5a('0x34')){_0x121fdf=_['filter'](_0x5ecb31,function(_0x15d141){return _['includes'](_0x29b022[_0x7f5a('0x35')],_0x15d141[_0x7f5a('0x15')]);});_0x29b022=_0x29b022[_0x7f5a('0x36')];}_0x5d24cc['where']=_[_0x7f5a('0x37')](_0x5d24cc[_0x7f5a('0x38')],{'$or':_[_0x7f5a('0x2e')](_0x121fdf,function(_0xf36d39){if(_0xf36d39[_0x7f5a('0xd')]!==_0x7f5a('0x39')){if(_0x2e6964){return sequelize[_0x7f5a('0x38')](sequelize['fn']('lower',sequelize[_0x7f5a('0x1d')](_0xf36d39[_0x7f5a('0x15')])),{'$like':sequelize['fn'](_0x7f5a('0x3a'),'%'+_0x777184[_0x7f5a('0x2d')][_0x7f5a('0x33')]+'%')});}else{var _0x3c4325={};_0x3c4325[_0xf36d39['name']]={'$like':'%'+_0x777184[_0x7f5a('0x2d')][_0x7f5a('0x33')]+'%'};return _0x3c4325;}}})});}_0x5d24cc=_[_0x7f5a('0x37')]({},_0x5d24cc,_0x777184[_0x7f5a('0x3b')]);return _0x5d24cc;};exports['include']=function(_0x2d6242){var _0x340d5b=[];if(_0x2d6242[_0x7f5a('0x3c')]){_0x340d5b[_0x7f5a('0x29')]({'all':!![]});}else if(_0x2d6242[_0x7f5a('0x3d')]){if(Array[_0x7f5a('0x16')](_0x2d6242[_0x7f5a('0x3d')])){_0x340d5b=Object[_0x7f5a('0x4')](_0x2d6242[_0x7f5a('0x3d')])[_0x7f5a('0x2e')](function(_0x3ef20a){return parseIncludeModel(_0x2d6242[_0x7f5a('0x3d')][_0x3ef20a]);});}else{var _0xaabf0f=parseIncludeModel(_0x2d6242[_0x7f5a('0x3d')]);_0x340d5b['push'](_0xaabf0f);}}return _0x340d5b;}; \ No newline at end of file +var _0x70a1=['VIRTUAL','lower','options','includeAll','include','lodash','sequelize','moment','parse','includes','fields','raw','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','join','getOptions','$id','query','model','keys','attributes','intersection','hasOwnProperty','where','pick','filter','object','value','merge'];(function(_0x3c5313,_0x256745){var _0x42a7ae=function(_0xc8b959){while(--_0xc8b959){_0x3c5313['push'](_0x3c5313['shift']());}};_0x42a7ae(++_0x256745);}(_0x70a1,0x154));var _0x170a=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x70a1[_0x2ca9d4];return _0x258956;};'use strict';var _=require(_0x170a('0x0'));var sequelize=require(_0x170a('0x1'));var moment=require(_0x170a('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4c0f14){var _0x496cee=['ne'];try{var _0x278333=JSON[_0x170a('0x3')](_0x4c0f14);var _0x1dcca8=Object['keys'](_0x278333)[0x0];return _0x496cee[_0x170a('0x4')](_0x1dcca8);}catch(_0x30977b){return![];}}function getOperatorValue(_0x21c8f2){var _0x1d6e4f=JSON[_0x170a('0x3')](_0x21c8f2);var _0x407d3f=Object['keys'](_0x1d6e4f)[0x0];var _0x53c135=_0x1d6e4f[_0x407d3f];return{['$'+_0x407d3f]:_0x53c135};}function parseIncludeModel(_0x460606){var _0x2db3f7=JSON[_0x170a('0x3')](_0x460606);return{'model':db[_0x2db3f7['model']],'as':_0x2db3f7['alias'],'attributes':_0x2db3f7[_0x170a('0x5')],'raw':_0x2db3f7[_0x170a('0x6')]};}exports[_0x170a('0x5')]=function(_0x45a0e5){var _0x7c9473=null;if(_0x45a0e5){_0x7c9473=_0x45a0e5['split'](',');}return _0x7c9473;};exports[_0x170a('0x7')]=function(_0x3201a6,_0x74e59){var _0x1d5d53={};if(!_[_0x170a('0x8')](_0x3201a6)){_[_0x170a('0x9')](_0x3201a6,function(_0x1c8480,_0x5c873e){try{if(_0x74e59){var _0x34c2b3=_[_0x170a('0xa')](_0x74e59,{'name':_0x5c873e})||{};if(hasSequelizeOperator(_0x1c8480)){_0x1d5d53[_0x5c873e]=getOperatorValue(_0x1c8480);}else if(_0x34c2b3[_0x170a('0xb')]===_0x170a('0xc')&&_[_0x170a('0xd')](_0x1c8480)){var _0x488137=JSON[_0x170a('0x3')](_0x1c8480);var _0x1b752e={'$gte':moment(moment(_0x488137[_0x170a('0xe')])[_0x170a('0xf')](_0x170a('0x10')))[_0x170a('0x11')]()[_0x170a('0xf')](),'$lte':moment(moment(_0x488137[_0x170a('0x12')])['format'](_0x170a('0x10')))[_0x170a('0x11')]()[_0x170a('0x13')](0x1,'s')[_0x170a('0xf')]()};_0x1d5d53[_0x5c873e]=_0x1b752e;}else if(_0x34c2b3[_0x170a('0x14')]==='uniqueid'){_0x1d5d53[_0x5c873e]=_0x1c8480;}else{_0x1d5d53[_0x5c873e]=_[_0x170a('0x15')](_0x1c8480)?_0x1c8480:JSON[_0x170a('0x3')](_0x1c8480);}}else{_0x1d5d53[_0x5c873e]=_['isArray'](_0x1c8480)?_0x1c8480:JSON[_0x170a('0x3')](_0x1c8480);}}catch(_0x153084){_0x1d5d53[_0x5c873e]=_0x1c8480[_0x170a('0x16')](',');}});}return _0x1d5d53;};exports[_0x170a('0x17')]=function(_0x3a86e5){_0x3a86e5=parseInt(_0x3a86e5,0xa);if(!_0x3a86e5||_0x3a86e5<0x0){_0x3a86e5=LIMIT_VALUE;}return _0x3a86e5;};exports[_0x170a('0x18')]=function(_0x2622b0){_0x2622b0=parseInt(_0x2622b0,0xa);if(!_0x2622b0||_0x2622b0<0x0){_0x2622b0=0x0;}return _0x2622b0;};exports[_0x170a('0x19')]=function(_0x444098){var _0x391775,_0x2fc3d1=null;if(_0x444098){_0x391775=_0x444098[_0x170a('0x16')](',');_0x2fc3d1=_[_0x170a('0x1a')](_0x391775,function(_0x1649eb){if(_0x1649eb[_0x170a('0x1b')]('-')===0x0){return[_0x1649eb===_0x170a('0x1c')?sequelize[_0x170a('0x1d')](sequelize[_0x170a('0x1e')](_0x170a('0x1c')),_0x170a('0x1f')):_0x1649eb[_0x170a('0x20')](0x1),'DESC'];}else{return[_0x1649eb===_0x170a('0x1c')?sequelize['cast'](sequelize[_0x170a('0x1e')](_0x170a('0x1c')),_0x170a('0x1f')):_0x1649eb,'ASC'];}});}return _0x2fc3d1;};exports[_0x170a('0x21')]=function(_0x3f540e,_0x14b0f8){if(_[_0x170a('0x8')](_0x3f540e)){return _0x3f540e;}if(_[_0x170a('0x15')](_0x3f540e)){for(var _0x1d5562=0x0;_0x1d5562<_0x3f540e[_0x170a('0x22')];_0x1d5562+=0x1){_0x3f540e[_0x1d5562]=this[_0x170a('0x21')](_0x3f540e[_0x1d5562],_0x14b0f8);}return _0x3f540e;}if(!_[_0x170a('0x23')](_0x3f540e)){return _0x3f540e;}if(_[_0x170a('0x24')](_0x14b0f8)){_0x14b0f8=[_0x14b0f8];}if(!_['isArray'](_0x14b0f8)){return _0x3f540e;}for(var _0x53aaea=0x0;_0x53aaea<_0x14b0f8[_0x170a('0x22')];_0x53aaea+=0x1){_[_0x170a('0x25')](_0x3f540e,_0x14b0f8[_0x53aaea]);}for(var _0x5a797f in _0x3f540e){if(_0x3f540e['hasOwnProperty'](_0x5a797f)){_0x3f540e[_0x5a797f]=this['omit'](_0x3f540e[_0x5a797f],_0x14b0f8);}}return _0x3f540e;};exports[_0x170a('0x26')]=function(_0x458cb7){return _0x458cb7[_0x170a('0x27')](RegExp(_0x170a('0x28')))?!![]:![];};exports[_0x170a('0x29')]=function(_0x4fde12){return _0x4fde12[_0x170a('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x170a('0x2a')]=function(_0x46c40a,_0x3b546e){var _0x29f81b=[];var _0xf2aa7b=/[ `!@#$%^&*()_\-?~]/;var _0x959b51=_0x3b546e?_0x170a('0x2b'):'{EXPR}';_0x46c40a[_0x170a('0x16')](/[ ,]+/)[_0x170a('0x2c')](function(_0x5d5b46){_0x5d5b46=_0x5d5b46[_0x170a('0x2d')](/([^:]")"+/g,'$1');_0x5d5b46='+'+_0x5d5b46+'*';var _0x10044e=_0x5d5b46[_0x170a('0x27')](_0xf2aa7b);if(_0x10044e){_0x5d5b46='\x22'+_0x5d5b46+'\x22';}_0x29f81b[_0x170a('0x2e')](_0x5d5b46);});_0x959b51=_0x959b51[_0x170a('0x2d')]('{EXPR}',_0x29f81b[_0x170a('0x2f')]('\x20'));return _0x959b51;};exports[_0x170a('0x30')]=function(_0x2f0dda,_0x1773e5,_0xcb33be){var _0x7c95c9={},_0xe302fb={};if(_0x1773e5['query'][_0x170a('0x31')]){_0x1773e5[_0x170a('0x32')]['id']=_0x1773e5[_0x170a('0x32')][_0x170a('0x31')];delete _0x1773e5['query']['$id'];}_0x7c95c9[_0x170a('0x33')]=_[_0x170a('0x1a')](_0x2f0dda,'name');_0x7c95c9[_0x170a('0x32')]=_[_0x170a('0x34')](_0x1773e5[_0x170a('0x32')]);_0x7c95c9[_0x170a('0x7')]=_['intersection'](_0x7c95c9[_0x170a('0x33')],_0x7c95c9[_0x170a('0x32')]);_0xe302fb[_0x170a('0x35')]=_[_0x170a('0x36')](_0x7c95c9[_0x170a('0x33')],this[_0x170a('0x5')](_0x1773e5[_0x170a('0x32')][_0x170a('0x5')]));_0xe302fb[_0x170a('0x35')]=_0xe302fb[_0x170a('0x35')][_0x170a('0x22')]?_0xe302fb['attributes']:_0x7c95c9['model'];if(!_0x1773e5[_0x170a('0x32')][_0x170a('0x37')]('nolimit')){_0xe302fb[_0x170a('0x17')]=this[_0x170a('0x17')](_0x1773e5['query'][_0x170a('0x17')]);_0xe302fb[_0x170a('0x18')]=this[_0x170a('0x18')](_0x1773e5[_0x170a('0x32')]['offset']);}_0xe302fb['order']=this['sort'](_0x1773e5[_0x170a('0x32')][_0x170a('0x19')]);_0xe302fb[_0x170a('0x38')]=this[_0x170a('0x7')](_[_0x170a('0x39')](_0x1773e5[_0x170a('0x32')],_0x7c95c9[_0x170a('0x7')]),_0x2f0dda);if(_0x1773e5[_0x170a('0x32')][_0x170a('0x3a')]){var _0x3ca395=_0x2f0dda;var _0x2aa6b5=_0x1773e5[_0x170a('0x32')]['filter'];if(typeof _0x2aa6b5===_0x170a('0x3b')){_0x3ca395=_['filter'](_0x2f0dda,function(_0x2e8375){return _[_0x170a('0x4')](_0x2aa6b5['columns'],_0x2e8375['name']);});_0x2aa6b5=_0x2aa6b5[_0x170a('0x3c')];}_0xe302fb[_0x170a('0x38')]=_[_0x170a('0x3d')](_0xe302fb[_0x170a('0x38')],{'$or':_[_0x170a('0x1a')](_0x3ca395,function(_0x15f2eb){if(_0x15f2eb[_0x170a('0xb')]!==_0x170a('0x3e')){if(_0xcb33be){return sequelize[_0x170a('0x38')](sequelize['fn'](_0x170a('0x3f'),sequelize[_0x170a('0x1e')](_0x15f2eb[_0x170a('0x14')])),{'$like':sequelize['fn'](_0x170a('0x3f'),'%'+_0x1773e5[_0x170a('0x32')]['filter']+'%')});}else{var _0x3e3630={};_0x3e3630[_0x15f2eb[_0x170a('0x14')]]={'$like':'%'+_0x1773e5['query'][_0x170a('0x3a')]+'%'};return _0x3e3630;}}})});}_0xe302fb=_[_0x170a('0x3d')]({},_0xe302fb,_0x1773e5[_0x170a('0x40')]);return _0xe302fb;};exports['include']=function(_0x225666){var _0x2ab535=[];if(_0x225666[_0x170a('0x41')]){_0x2ab535['push']({'all':!![]});}else if(_0x225666[_0x170a('0x42')]){if(Array[_0x170a('0x15')](_0x225666[_0x170a('0x42')])){_0x2ab535=Object['keys'](_0x225666[_0x170a('0x42')])['map'](function(_0x3ef1e5){return parseIncludeModel(_0x225666[_0x170a('0x42')][_0x3ef1e5]);});}else{var _0x4a27da=parseIncludeModel(_0x225666[_0x170a('0x42')]);_0x2ab535['push'](_0x4a27da);}}return _0x2ab535;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index c9d7191..5636ead 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6a6=['smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','filterAgentAttributes','openchannelStatus','mailCurrentCapacity','whatsappCurrentCapacity','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','http','client','chatPause','faxPause','mailPause','smsPause','voicePause','every','length','idle','ringing','isNil','pause','faxStatus','mailStatus','smsStatus','voiceStatus','whatsappStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','getRealtimeAgents','unknown','isArray','startCase','Queue','map','getAgents','flatten','uniq','filter','busy','getAgentIdsByStatus','resolve','includes','User','findAll','name','fullname','openchannelPause','whatsappPause','pauseType','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x388932,_0x140e78){_0x388932=_0x388932-0x0;var _0x252ae4=_0xb6a6[_0x388932];return _0x252ae4;};'use strict';var _=require(_0x6b6a('0x0'));var jayson=require(_0x6b6a('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x6b6a('0x2')]({'port':0x232a});var routingClient=jayson[_0x6b6a('0x3')][_0x6b6a('0x2')]({'port':0x232c});function isAgentPaused(_0x8abe65,_0xe80650){var _0x494fb4=[_0x8abe65[_0x6b6a('0x4')],_0x8abe65[_0x6b6a('0x5')],_0x8abe65[_0x6b6a('0x6')],_0x8abe65['openchannelPause'],_0x8abe65[_0x6b6a('0x7')],_0x8abe65[_0x6b6a('0x8')],_0x8abe65['whatsappPause']];if(!_0xe80650)return _[_0x6b6a('0x9')](_0x494fb4);var _0x15ccc9=_['filter'](_0x494fb4);return _0x15ccc9[_0x6b6a('0xa')]>0x0&&_0x15ccc9['length']<_0x494fb4[_0x6b6a('0xa')]?!![]:![];}function isIdle(_0x39fc5b){return _0x39fc5b===_0x6b6a('0xb')||_0x39fc5b==='unknown'||_0x39fc5b==='unavailable'||_0x39fc5b===_0x6b6a('0xc')||_[_0x6b6a('0xd')](_0x39fc5b);}function isAgentIdle(_0x47c2dd){if(_0x47c2dd['voiceStatus']!==_0x6b6a('0xb')&&_0x47c2dd[_0x6b6a('0x8')]){_0x47c2dd['voiceStatus']=_0x6b6a('0xe');return![];}return _[_0x6b6a('0x9')]([_0x47c2dd['chatStatus'],_0x47c2dd[_0x6b6a('0xf')],_0x47c2dd[_0x6b6a('0x10')],_0x47c2dd['openchannelStatus'],_0x47c2dd[_0x6b6a('0x11')],_0x47c2dd[_0x6b6a('0x12')],_0x47c2dd[_0x6b6a('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x6b6a('0x14')]('Agents',{})[_0x6b6a('0x15')](function(_0x3b58cb){if(_0x3b58cb['error']){throw new Error(_0x6b6a('0x16'));}var _0x12faf8=_0x3b58cb[_0x6b6a('0x17')];return routingClient[_0x6b6a('0x14')](_0x6b6a('0x18'),{})['then'](function(_0x36c02e){if(_0x36c02e[_0x6b6a('0x19')]){throw new Error(_0x6b6a('0x1a'));}var _0x580d86=_0x36c02e[_0x6b6a('0x17')];return _['merge']({},_0x12faf8,_0x580d86);});})[_0x6b6a('0x1b')](function(_0x7a82bc){throw _0x7a82bc;});}exports[_0x6b6a('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x351306){var _0x84b0e5=_0x6b6a('0x1d');if(isAgentPaused(_0x351306))_0x84b0e5='pause';else if(isAgentPaused(_0x351306,!![]))_0x84b0e5='*pause';else if(isAgentIdle(_0x351306))_0x84b0e5=_0x6b6a('0xb');else _0x84b0e5='busy';return _0x84b0e5;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x1edaf0,_0x4c29eb){var _0x7f44b1=_[_0x6b6a('0x1e')](_0x1edaf0)?_0x1edaf0:[_0x1edaf0];var _0x1327e9=_[_0x6b6a('0x1f')](_0x4c29eb)+_0x6b6a('0x20');var _0xcea9de=_[_0x6b6a('0x21')](_0x7f44b1,function(_0x8dffc0){return db[_0x1327e9]['findOne']({'where':{'id':_0x8dffc0}})['then'](function(_0x4d0f5d){if(!_0x4d0f5d)return[];return _0x4d0f5d[_0x6b6a('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0xcea9de)[_0x6b6a('0x15')](function(_0x4c4ca5){var _0x56f08f=_(_0x4c4ca5)[_0x6b6a('0x23')]()['map']('id')[_0x6b6a('0x24')]()['value']();return _0x56f08f;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5ce125,_0x30f322,_0x207a1b){try{if(_0x30f322[_0x6b6a('0xa')]>0x0){_0x5ce125=_0x5ce125['filter'](function(_0xa6ce4b){return _0x30f322['includes'](_0xa6ce4b['id']);});}var _0x12a4d2=_0x5ce125[_0x6b6a('0x25')](function(_0x313f20){var _0x2278e0=_0x6b6a('0x26');if(isAgentIdle(_0x313f20)){_0x2278e0=_0x6b6a('0xb');}return _0x2278e0===_0x207a1b;});return _['map'](_0x12a4d2,'id');}catch(_0x484f6d){throw _0x484f6d;}}exports[_0x6b6a('0x27')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5edac0,_0x4b68eb,_0x57e5b7){return Promise[_0x6b6a('0x28')]()[_0x6b6a('0x15')](function(){if(_0x4b68eb[_0x6b6a('0xa')]>0x0){_0x5edac0=_0x5edac0[_0x6b6a('0x25')](function(_0x31384d){return _0x4b68eb[_0x6b6a('0x29')](_0x31384d['id']);});}return _0x5edac0;})[_0x6b6a('0x15')](function(){return db[_0x6b6a('0x2a')][_0x6b6a('0x2b')]({'attributes':['id',_0x6b6a('0x2c'),_0x6b6a('0x2d'),_0x6b6a('0x4'),'faxPause',_0x6b6a('0x6'),_0x6b6a('0x2e'),_0x6b6a('0x7'),_0x6b6a('0x8'),_0x6b6a('0x2f'),_0x6b6a('0x30')],'where':{'id':{'$in':_['map'](_0x5edac0,'id')}},'raw':!![]});})[_0x6b6a('0x15')](function(_0x134c77){return _0x134c77[_0x6b6a('0x21')](function(_0x5c6416){var _0x1d23e=_[_0x6b6a('0x31')](_0x5edac0,['id',_0x5c6416['id']]);var _0x11b8f7=filterAgentAttributes(_0x1d23e);_[_0x6b6a('0x32')](_0x5c6416,_0x11b8f7);_0x5c6416[_0x6b6a('0x33')]=getAgentStatus(_0x5c6416);return _0x5c6416;});})['then'](function(_0x371ccf){var _0x559522=sortAgentsByStatus(_0x371ccf,_0x57e5b7);return _[_0x6b6a('0x21')](_0x559522,'id');})[_0x6b6a('0x1b')](function(_0x1fda57){throw _0x1fda57;});}exports[_0x6b6a('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4025c4){var _0x2dbde3={'fields':[],'order':null};var _0x2caa9a=_0x4025c4[_0x6b6a('0x35')](',');_0x2dbde3[_0x6b6a('0x36')]=_['filter'](_0x2caa9a,function(_0x31782f){if(!_0x31782f[_0x6b6a('0x29')](_0x6b6a('0x33'))){return!![];}_0x2dbde3[_0x6b6a('0x37')]=_[_0x6b6a('0x38')](_0x31782f,'-')?_0x6b6a('0x39'):_0x6b6a('0x3a');return![];});return _0x2dbde3;}exports[_0x6b6a('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x2c1959){if(!_0x2c1959){_0x2c1959=_0x6b6a('0x3c');}if(_0x2c1959[_0x6b6a('0x29')](_0x6b6a('0x2d'))&&!_0x2c1959[_0x6b6a('0x29')](_0x6b6a('0x3d'))){var _0x19c361=_0x2c1959['substring'](0x0,_0x2c1959[_0x6b6a('0x3e')](_0x6b6a('0x2d')));_0x2c1959+=','+_0x19c361+_0x6b6a('0x3d');}return _0x2c1959;}exports[_0x6b6a('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x62ff02,_0x110482){var _0x445a2f=_0x62ff02[_0x6b6a('0x40')](function(_0x55580f,_0x2d4cd1){if(_0x55580f[_0x6b6a('0x33')]===_0x2d4cd1['globalStatus']){if(_0x55580f[_0x6b6a('0x33')]===_0x6b6a('0xe')){if(_0x110482===_0x6b6a('0x39')){return(_0x55580f[_0x6b6a('0x30')]||'')<(_0x2d4cd1[_0x6b6a('0x30')]||'')||_0x55580f[_0x6b6a('0x2d')]['toLowerCase']()>_0x2d4cd1[_0x6b6a('0x2d')][_0x6b6a('0x41')]()?0x1:-0x1;}else{return(_0x55580f[_0x6b6a('0x30')]||'')<(_0x2d4cd1['pauseType']||'')||_0x55580f[_0x6b6a('0x2d')]['toLowerCase']()>_0x2d4cd1['fullname'][_0x6b6a('0x41')]()?-0x1:0x1;}}else{if(_0x110482==='DESC'){return _0x55580f['fullname'][_0x6b6a('0x41')]()<_0x2d4cd1[_0x6b6a('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x55580f[_0x6b6a('0x2d')][_0x6b6a('0x41')]()<_0x2d4cd1['fullname'][_0x6b6a('0x41')]()?-0x1:0x1;}}}else{if(_0x110482===_0x6b6a('0x39')){return _0x55580f[_0x6b6a('0x33')]<_0x2d4cd1['globalStatus']?0x1:-0x1;}else{return _0x55580f[_0x6b6a('0x33')]<_0x2d4cd1['globalStatus']?-0x1:0x1;}}});return _0x445a2f;}exports[_0x6b6a('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x315709){var _0x5264d2=[_0x6b6a('0x43'),_0x6b6a('0x44'),_0x6b6a('0x45'),_0x6b6a('0x46'),_0x6b6a('0x30'),_0x6b6a('0x46'),'internal','address',_0x6b6a('0x4'),_0x6b6a('0x2e'),_0x6b6a('0x6'),'smsPause',_0x6b6a('0x2f'),_0x6b6a('0x5'),_0x6b6a('0x8'),_0x6b6a('0x47'),_0x6b6a('0x48'),_0x6b6a('0x49'),_0x6b6a('0x4a'),_0x6b6a('0x4b'),_0x6b6a('0x4c'),_0x6b6a('0x4d'),_0x6b6a('0x4e'),'mailCurrentCapacity',_0x6b6a('0x4f'),'whatsappCurrentCapacity',_0x6b6a('0x50'),'chatStatus','openchannelStatus','mailStatus',_0x6b6a('0x11'),'whatsappStatus','faxStatus','voiceStatus',_0x6b6a('0x51'),_0x6b6a('0x52'),_0x6b6a('0x53'),_0x6b6a('0x54'),_0x6b6a('0x55'),'faxStatusTime',_0x6b6a('0x56'),_0x6b6a('0x57'),'destconnectedlinenum','screenrecording',_0x6b6a('0x58'),_0x6b6a('0x59')];var _0x15fac4=['chatPause',_0x6b6a('0x2e'),_0x6b6a('0x6'),_0x6b6a('0x7'),_0x6b6a('0x2f'),_0x6b6a('0x5'),'voicePause',_0x6b6a('0x44')];var _0x216659=_(_0x315709)['omit'](_0x15fac4)[_0x6b6a('0x5a')](_0x5264d2)['value']();return _0x216659;}exports[_0x6b6a('0x5b')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x6b6a('0x2c'),_0x6b6a('0x2d'),'role',_0x6b6a('0x3d'),'online',_0x6b6a('0x33'),'userpic','lastLoginAt',_0x6b6a('0x30'),_0x6b6a('0x46'),_0x6b6a('0x5'),_0x6b6a('0x4'),'mailPause',_0x6b6a('0x2e'),_0x6b6a('0x7'),_0x6b6a('0x8'),_0x6b6a('0x2f'),'chatStatus',_0x6b6a('0xf'),_0x6b6a('0x10'),_0x6b6a('0x5c'),'smsStatus',_0x6b6a('0x12'),_0x6b6a('0x13'),_0x6b6a('0x51'),'faxStatusTime',_0x6b6a('0x53'),_0x6b6a('0x52'),_0x6b6a('0x54'),_0x6b6a('0x56'),_0x6b6a('0x55'),'chatCapacity',_0x6b6a('0x4c'),_0x6b6a('0x49'),_0x6b6a('0x48'),_0x6b6a('0x4a'),_0x6b6a('0x4b'),_0x6b6a('0x4d'),_0x6b6a('0x50'),_0x6b6a('0x5d'),_0x6b6a('0x4e'),_0x6b6a('0x4f'),_0x6b6a('0x5e'),_0x6b6a('0x58'),_0x6b6a('0x59'),_0x6b6a('0x5f'),_0x6b6a('0x60'),'queue','screenrecording'];}exports[_0x6b6a('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xa49b=['phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','role','userpic','chatStatus','whatsappStatusTime','whatsappCurrentCapacity','onhold','queue','screenrecording','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','whatsappPause','every','length','unknown','unavailable','ringing','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','getRealtimeAgents','*pause','idle','busy','getAgentStatus','startCase','findOne','getAgents','all','map','uniq','value','filter','includes','findAll','name','fullname','openchannelPause','voicePause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','DESC','getUpdatedSortOptions','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent'];(function(_0x1276d5,_0x359954){var _0x3f52c9=function(_0x4a9c72){while(--_0x4a9c72){_0x1276d5['push'](_0x1276d5['shift']());}};_0x3f52c9(++_0x359954);}(_0xa49b,0x126));var _0xba49=function(_0x45fd0c,_0x258637){_0x45fd0c=_0x45fd0c-0x0;var _0x38227d=_0xa49b[_0x45fd0c];return _0x38227d;};'use strict';var _=require('lodash');var jayson=require(_0xba49('0x0'));var db=require(_0xba49('0x1'))['db'];var amiClient=jayson[_0xba49('0x2')][_0xba49('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xba49('0x3')]({'port':0x232c});function isAgentPaused(_0x1a1207,_0x26c4ef){var _0x5a2c15=[_0x1a1207[_0xba49('0x4')],_0x1a1207[_0xba49('0x5')],_0x1a1207[_0xba49('0x6')],_0x1a1207['openchannelPause'],_0x1a1207[_0xba49('0x7')],_0x1a1207['voicePause'],_0x1a1207[_0xba49('0x8')]];if(!_0x26c4ef)return _[_0xba49('0x9')](_0x5a2c15);var _0x2bfae5=_['filter'](_0x5a2c15);return _0x2bfae5[_0xba49('0xa')]>0x0&&_0x2bfae5[_0xba49('0xa')]<_0x5a2c15[_0xba49('0xa')]?!![]:![];}function isIdle(_0x5251e4){return _0x5251e4==='idle'||_0x5251e4===_0xba49('0xb')||_0x5251e4===_0xba49('0xc')||_0x5251e4===_0xba49('0xd')||_['isNil'](_0x5251e4);}function isAgentIdle(_0x5d0f30){if(_0x5d0f30[_0xba49('0xe')]!=='idle'&&_0x5d0f30['voicePause']){_0x5d0f30['voiceStatus']=_0xba49('0xf');return![];}return _['every']([_0x5d0f30['chatStatus'],_0x5d0f30[_0xba49('0x10')],_0x5d0f30[_0xba49('0x11')],_0x5d0f30[_0xba49('0x12')],_0x5d0f30[_0xba49('0x13')],_0x5d0f30['voiceStatus'],_0x5d0f30[_0xba49('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xba49('0x15')]('Agents',{})['then'](function(_0xc1053a){if(_0xc1053a[_0xba49('0x16')]){throw new Error(_0xba49('0x17'));}var _0x153b4c=_0xc1053a['result'];return routingClient[_0xba49('0x15')](_0xba49('0x18'),{})[_0xba49('0x19')](function(_0x5cc0fe){if(_0x5cc0fe[_0xba49('0x16')]){throw new Error(_0xba49('0x1a'));}var _0x2cb910=_0x5cc0fe[_0xba49('0x1b')];return _['merge']({},_0x153b4c,_0x2cb910);});})[_0xba49('0x1c')](function(_0x59af33){throw _0x59af33;});}exports[_0xba49('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x5cd475){var _0x2c6617=_0xba49('0xb');if(isAgentPaused(_0x5cd475))_0x2c6617=_0xba49('0xf');else if(isAgentPaused(_0x5cd475,!![]))_0x2c6617=_0xba49('0x1e');else if(isAgentIdle(_0x5cd475))_0x2c6617=_0xba49('0x1f');else _0x2c6617=_0xba49('0x20');return _0x2c6617;}exports[_0xba49('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x331ec2,_0x2abc3b){var _0x4f1f1d=_['isArray'](_0x331ec2)?_0x331ec2:[_0x331ec2];var _0x2a4d17=_[_0xba49('0x22')](_0x2abc3b)+'Queue';var _0x54c9cd=_['map'](_0x4f1f1d,function(_0x4e65c4){return db[_0x2a4d17][_0xba49('0x23')]({'where':{'id':_0x4e65c4}})[_0xba49('0x19')](function(_0x45ed70){if(!_0x45ed70)return[];return _0x45ed70[_0xba49('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xba49('0x25')](_0x54c9cd)[_0xba49('0x19')](function(_0x26e3d3){var _0x216e1e=_(_0x26e3d3)['flatten']()[_0xba49('0x26')]('id')[_0xba49('0x27')]()[_0xba49('0x28')]();return _0x216e1e;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x23d288,_0xf4d76c,_0x4b78fc){try{if(_0xf4d76c['length']>0x0){_0x23d288=_0x23d288[_0xba49('0x29')](function(_0x15f9ac){return _0xf4d76c['includes'](_0x15f9ac['id']);});}var _0x2c0854=_0x23d288[_0xba49('0x29')](function(_0x18e661){var _0x25b35d=_0xba49('0x20');if(isAgentIdle(_0x18e661)){_0x25b35d=_0xba49('0x1f');}return _0x25b35d===_0x4b78fc;});return _['map'](_0x2c0854,'id');}catch(_0x3a7708){throw _0x3a7708;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc64929,_0x3a1ef4,_0x321e59){return Promise['resolve']()[_0xba49('0x19')](function(){if(_0x3a1ef4[_0xba49('0xa')]>0x0){_0xc64929=_0xc64929[_0xba49('0x29')](function(_0x5281e2){return _0x3a1ef4[_0xba49('0x2a')](_0x5281e2['id']);});}return _0xc64929;})[_0xba49('0x19')](function(){return db['User'][_0xba49('0x2b')]({'attributes':['id',_0xba49('0x2c'),_0xba49('0x2d'),'chatPause','faxPause',_0xba49('0x6'),_0xba49('0x2e'),_0xba49('0x7'),_0xba49('0x2f'),_0xba49('0x8'),_0xba49('0x30')],'where':{'id':{'$in':_['map'](_0xc64929,'id')}},'raw':!![]});})[_0xba49('0x19')](function(_0x360cd6){return _0x360cd6['map'](function(_0x1636fd){var _0x5d103e=_['find'](_0xc64929,['id',_0x1636fd['id']]);var _0x34c3c4=filterAgentAttributes(_0x5d103e);_['merge'](_0x1636fd,_0x34c3c4);_0x1636fd[_0xba49('0x31')]=getAgentStatus(_0x1636fd);return _0x1636fd;});})[_0xba49('0x19')](function(_0x13bd5c){var _0x115aaf=sortAgentsByStatus(_0x13bd5c,_0x321e59);return _[_0xba49('0x26')](_0x115aaf,'id');})[_0xba49('0x1c')](function(_0x3b9cf4){throw _0x3b9cf4;});}exports[_0xba49('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3e7031){var _0x1e23b9={'fields':[],'order':null};var _0x49b294=_0x3e7031[_0xba49('0x33')](',');_0x1e23b9[_0xba49('0x34')]=_[_0xba49('0x29')](_0x49b294,function(_0x115168){if(!_0x115168[_0xba49('0x2a')](_0xba49('0x31'))){return!![];}_0x1e23b9[_0xba49('0x35')]=_['startsWith'](_0x115168,'-')?_0xba49('0x36'):'ASC';return![];});return _0x1e23b9;}exports[_0xba49('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x532c40){if(!_0x532c40){_0x532c40='fullname,internal';}if(_0x532c40[_0xba49('0x2a')](_0xba49('0x2d'))&&!_0x532c40[_0xba49('0x2a')]('internal')){var _0x5da01b=_0x532c40['substring'](0x0,_0x532c40[_0xba49('0x38')]('fullname'));_0x532c40+=','+_0x5da01b+_0xba49('0x39');}return _0x532c40;}exports[_0xba49('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x47ddfa,_0x1a9c77){var _0x402742=_0x47ddfa[_0xba49('0x3b')](function(_0x8ece29,_0x1911d1){if(_0x8ece29[_0xba49('0x31')]===_0x1911d1['globalStatus']){if(_0x8ece29['globalStatus']===_0xba49('0xf')){if(_0x1a9c77===_0xba49('0x36')){return(_0x8ece29[_0xba49('0x30')]||'')<(_0x1911d1[_0xba49('0x30')]||'')||_0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()>_0x1911d1[_0xba49('0x2d')][_0xba49('0x3c')]()?0x1:-0x1;}else{return(_0x8ece29[_0xba49('0x30')]||'')<(_0x1911d1[_0xba49('0x30')]||'')||_0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()>_0x1911d1[_0xba49('0x2d')][_0xba49('0x3c')]()?-0x1:0x1;}}else{if(_0x1a9c77==='DESC'){return _0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()<_0x1911d1[_0xba49('0x2d')]['toLowerCase']()?0x1:-0x1;}else{return _0x8ece29[_0xba49('0x2d')][_0xba49('0x3c')]()<_0x1911d1['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1a9c77===_0xba49('0x36')){return _0x8ece29['globalStatus']<_0x1911d1[_0xba49('0x31')]?0x1:-0x1;}else{return _0x8ece29[_0xba49('0x31')]<_0x1911d1[_0xba49('0x31')]?-0x1:0x1;}}});return _0x402742;}exports[_0xba49('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x10e0a8){var _0x759b1c=['userpic',_0xba49('0x3e'),_0xba49('0x3f'),_0xba49('0x40'),_0xba49('0x30'),'lastPauseAt',_0xba49('0x39'),_0xba49('0x41'),_0xba49('0x4'),'openchannelPause','mailPause',_0xba49('0x7'),_0xba49('0x8'),_0xba49('0x5'),'voicePause',_0xba49('0x42'),_0xba49('0x43'),_0xba49('0x44'),'smsCapacity',_0xba49('0x45'),_0xba49('0x46'),_0xba49('0x47'),_0xba49('0x48'),_0xba49('0x49'),_0xba49('0x4a'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0xba49('0x12'),_0xba49('0x11'),'smsStatus',_0xba49('0x14'),_0xba49('0x10'),_0xba49('0xe'),_0xba49('0x4b'),'openchannelStatusTime',_0xba49('0x4c'),_0xba49('0x4d'),'whatsappStatusTime',_0xba49('0x4e'),_0xba49('0x4f'),'queue',_0xba49('0x50'),'screenrecording',_0xba49('0x51'),_0xba49('0x52')];var _0xbd3bcb=[_0xba49('0x4'),_0xba49('0x2e'),_0xba49('0x6'),'smsPause',_0xba49('0x8'),_0xba49('0x5'),'voicePause','online'];var _0x122bd0=_(_0x10e0a8)[_0xba49('0x53')](_0xbd3bcb)[_0xba49('0x54')](_0x759b1c)[_0xba49('0x28')]();return _0x122bd0;}exports[_0xba49('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xba49('0x2c'),_0xba49('0x2d'),_0xba49('0x56'),_0xba49('0x39'),'online',_0xba49('0x31'),_0xba49('0x57'),_0xba49('0x3f'),_0xba49('0x30'),_0xba49('0x40'),_0xba49('0x5'),_0xba49('0x4'),_0xba49('0x6'),_0xba49('0x2e'),_0xba49('0x7'),_0xba49('0x2f'),'whatsappPause',_0xba49('0x58'),'faxStatus','mailStatus',_0xba49('0x12'),_0xba49('0x13'),'voiceStatus','whatsappStatus',_0xba49('0x4b'),_0xba49('0x4e'),'mailStatusTime','openchannelStatusTime',_0xba49('0x4d'),_0xba49('0x4f'),_0xba49('0x59'),_0xba49('0x42'),_0xba49('0x46'),'mailCapacity',_0xba49('0x43'),'smsCapacity',_0xba49('0x45'),'chatCurrentCapacity','faxCurrentCapacity',_0xba49('0x49'),_0xba49('0x48'),'smsCurrentCapacity',_0xba49('0x5a'),_0xba49('0x51'),_0xba49('0x52'),_0xba49('0x50'),_0xba49('0x5b'),_0xba49('0x5c'),_0xba49('0x5d')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index d6e364f..4b9b3bf 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0540=['unknown','pTalking','originated','message','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','error','format','result','catch','getRealtimeQueues','concat','get','talking','outbound','find','pick','jayson/promise','client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','unavailable'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0540,0x1c7));var _0x0054=function(_0x17c70f,_0x4ed9b7){_0x17c70f=_0x17c70f-0x0;var _0xa66a2=_0x0540[_0x17c70f];return _0xa66a2;};'use strict';var _=require('lodash');var jayson=require(_0x0054('0x0'));var util=require('util');var amiClient=jayson[_0x0054('0x1')][_0x0054('0x2')]({'port':0x232a});var routingClient=jayson[_0x0054('0x1')][_0x0054('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x0054('0x3'),'loggedIn',_0x0054('0x4'),_0x0054('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x0054('0x6'),_0x0054('0x7'),_0x0054('0x8'),_0x0054('0x9'),_0x0054('0xa'),_0x0054('0xb'),_0x0054('0xc'),_0x0054('0xd'),'talking',_0x0054('0xe'),_0x0054('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x0054('0x10'),_0x0054('0x11'),_0x0054('0x12'),'statusMessage',_0x0054('0x13'),'dialMethod',_0x0054('0x14'),_0x0054('0x15'),'startProgressive',_0x0054('0x16'),_0x0054('0x17'),_0x0054('0x18'),_0x0054('0x19'),_0x0054('0x1a'),_0x0054('0x1b'),'dialPredictiveIntervalMinThreshold',_0x0054('0x1c'),'predictiveIntervalTotalCalls',_0x0054('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x0054('0x1e'),_0x0054('0x1f'),_0x0054('0x20')];function getRealtimeQueues(_0x3b647f,_0x4f2a48){var _0x2a5d50=_0x4f2a48===_0x0054('0x21')?amiClient:routingClient;return _0x2a5d50['request'](_[_0x0054('0x22')](_0x4f2a48)+'Queues',_0x3b647f)[_0x0054('0x23')](function(_0x55fec9){if(_0x55fec9[_0x0054('0x24')])throw new Error(util[_0x0054('0x25')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x4f2a48));return _0x55fec9[_0x0054('0x26')];})[_0x0054('0x27')](function(_0x4805b8){throw _0x4805b8;});}exports[_0x0054('0x28')]=getRealtimeQueues;function initializeQueues(_0x26276f,_0x3a8301,_0xef63f7,_0x4f6531){var _0x21dea1=DEFAULT_QUEUE_ATTRIBUTES;if(_0xef63f7==='voice'){if(_0x4f6531==='inbound'){_0x21dea1=_0x21dea1[_0x0054('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4f6531==='outbound'){_0x21dea1=_0x21dea1[_0x0054('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x26276f['map'](function(_0x2cceea){var _0x2c13c6=_0x2cceea[_0x0054('0x2a')]({'plain':!![]});_0x2c13c6[_0x0054('0x4')]=0x0;_0x2c13c6[_0x0054('0x9')]=0x0;_0x2c13c6['loggedIn']=0x0;_0x2c13c6[_0x0054('0x3')]=0x0;_0x2c13c6['waiting']=0x0;if(_0xef63f7===_0x0054('0x21')){_0x2c13c6[_0x0054('0x2b')]=0x0;_0x2c13c6[_0x0054('0x6')]=0x0;if(_0x4f6531===_0x0054('0x2c')){_0x2c13c6[_0x0054('0x10')]=0x0;_0x2c13c6[_0x0054('0x11')]=0x0;}}var _0x3d2fd2=_[_0x0054('0x2d')](_0x3a8301,['id',_0x2c13c6['id']]);if(_0x3d2fd2){_['merge'](_0x2c13c6,_[_0x0054('0x2e')](_0x3d2fd2,_0x21dea1));}return _0x2c13c6;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x7b35=['startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','result','catch','getRealtimeQueues','inbound','concat','map','busy','outbound','pTalking','find','pick','lodash','jayson/promise','http','client','available','loggedIn','paused','waiting','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','statusMessage','dialActive','dialMethod','Trunk'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b35,0xb8));var _0x57b3=function(_0x16badc,_0x1e1c50){_0x16badc=_0x16badc-0x0;var _0x27c4da=_0x7b35[_0x16badc];return _0x27c4da;};'use strict';var _=require(_0x57b3('0x0'));var jayson=require(_0x57b3('0x1'));var util=require('util');var amiClient=jayson['client'][_0x57b3('0x2')]({'port':0x232a});var routingClient=jayson[_0x57b3('0x3')][_0x57b3('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x57b3('0x4'),_0x57b3('0x5'),_0x57b3('0x6'),_0x57b3('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x57b3('0x8'),_0x57b3('0x9'),_0x57b3('0xa'),_0x57b3('0xb'),_0x57b3('0xc'),_0x57b3('0xd'),_0x57b3('0xe'),_0x57b3('0xf'),_0x57b3('0x10'),_0x57b3('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x57b3('0x12'),_0x57b3('0x13'),_0x57b3('0x14'),_0x57b3('0x15'),_0x57b3('0x16'),_0x57b3('0x17'),_0x57b3('0x18'),'startProgressive',_0x57b3('0x19'),_0x57b3('0x1a'),_0x57b3('0x1b'),'erlangBusyFactor',_0x57b3('0x1c'),_0x57b3('0x1d'),_0x57b3('0x1e'),'predictiveIntervalAvailable',_0x57b3('0x1f'),_0x57b3('0x20'),_0x57b3('0x21'),_0x57b3('0x22'),_0x57b3('0x23'),_0x57b3('0x24')];function getRealtimeQueues(_0x1e9607,_0x503c80){var _0x32dd3a=_0x503c80===_0x57b3('0x25')?amiClient:routingClient;return _0x32dd3a[_0x57b3('0x26')](_['startCase'](_0x503c80)+_0x57b3('0x27'),_0x1e9607)[_0x57b3('0x28')](function(_0x15d59a){if(_0x15d59a['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x503c80));return _0x15d59a[_0x57b3('0x29')];})[_0x57b3('0x2a')](function(_0x477480){throw _0x477480;});}exports[_0x57b3('0x2b')]=getRealtimeQueues;function initializeQueues(_0x53b512,_0x434f6a,_0x435263,_0x50bd78){var _0x231ebb=DEFAULT_QUEUE_ATTRIBUTES;if(_0x435263==='voice'){if(_0x50bd78===_0x57b3('0x2c')){_0x231ebb=_0x231ebb[_0x57b3('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x50bd78==='outbound'){_0x231ebb=_0x231ebb[_0x57b3('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x53b512[_0x57b3('0x2e')](function(_0x1c00d3){var _0x2d10e9=_0x1c00d3['get']({'plain':!![]});_0x2d10e9[_0x57b3('0x6')]=0x0;_0x2d10e9[_0x57b3('0xa')]=0x0;_0x2d10e9[_0x57b3('0x5')]=0x0;_0x2d10e9[_0x57b3('0x4')]=0x0;_0x2d10e9[_0x57b3('0x7')]=0x0;if(_0x435263==='voice'){_0x2d10e9[_0x57b3('0xf')]=0x0;_0x2d10e9[_0x57b3('0x2f')]=0x0;if(_0x50bd78===_0x57b3('0x30')){_0x2d10e9[_0x57b3('0x31')]=0x0;_0x2d10e9[_0x57b3('0x12')]=0x0;}}var _0x31a648=_[_0x57b3('0x32')](_0x434f6a,['id',_0x2d10e9['id']]);if(_0x31a648){_['merge'](_0x2d10e9,_[_0x57b3('0x33')](_0x31a648,_0x231ebb));}return _0x2d10e9;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1eaa295..79b6822 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3520b8,_0x2d2034){var _0x262768=function(_0xd3aab){while(--_0xd3aab){_0x3520b8['push'](_0x3520b8['shift']());}};_0x262768(++_0x2d2034);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2a32ac3..21e5608 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 _0xac06=['win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','execSync','../environment','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','model','join','createHash','md5','update','digest','hex','platform','licenseToken','test'];(function(_0x2cf4b1,_0x568919){var _0xa06d2e=function(_0x3e0faf){while(--_0x3e0faf){_0x2cf4b1['push'](_0x2cf4b1['shift']());}};_0xa06d2e(++_0x568919);}(_0xac06,0x187));var _0x6ac0=function(_0x32d785,_0x2934f5){_0x32d785=_0x32d785-0x0;var _0x24dcc7=_0xac06[_0x32d785];return _0x24dcc7;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x6ac0('0x0')];var config=require(_0x6ac0('0x1'));function getInterfaces(){var _0x25c700=[];var _0x37a2b5=os['networkInterfaces']();var _0x4fc9dd=_['orderBy'](_[_0x6ac0('0x2')](_0x37a2b5));for(var _0x5788c5=0x0;_0x5788c5<_0x4fc9dd[_0x6ac0('0x3')];_0x5788c5++){var _0xc8995c=_0x37a2b5[_0x4fc9dd[_0x5788c5]][_0x6ac0('0x4')](function(_0x5e2a76){return _0x5e2a76[_0x6ac0('0x5')]===_0x6ac0('0x6')&&_0x5e2a76['internal']===![];});_0x25c700=_0x25c700[_0x6ac0('0x7')](_0xc8995c);}return _0x25c700;}function getFirstInterface(){var _0x4e7aa7=_[_0x6ac0('0x8')](getInterfaces());return{'macAddress':_0x4e7aa7&&_0x4e7aa7[_0x6ac0('0x9')]?_0x4e7aa7[_0x6ac0('0x9')]:_0x6ac0('0xa'),'ipAddress':_0x4e7aa7&&_0x4e7aa7[_0x6ac0('0xb')]?_0x4e7aa7[_0x6ac0('0xb')]:'127.0.0.1'};}exports[_0x6ac0('0xc')]=getFirstInterface;function getCPUhash(){var _0x4f3581=_[_0x6ac0('0xd')](os[_0x6ac0('0xe')]()['map'](function(_0x295c7f){return _0x295c7f[_0x6ac0('0xf')];}))[_0x6ac0('0x10')](':');return crypto[_0x6ac0('0x11')](_0x6ac0('0x12'))[_0x6ac0('0x13')](_0x4f3581)[_0x6ac0('0x14')](_0x6ac0('0x15'));}exports['getUuid']=function(){var _0x2dd727=os[_0x6ac0('0x16')]();var _0x2fc310=/[0-9a-f-]{36}/;if(config[_0x6ac0('0x17')]&&_0x2fc310[_0x6ac0('0x18')](config[_0x6ac0('0x17')])){return config['licenseToken'];}else if(_0x2dd727===_0x6ac0('0x19')){return exec(_0x6ac0('0x1a'),{'encoding':'utf8'})[_0x6ac0('0x1b')]('\x0d\x0a','');}else{var _0x2239ba=getFirstInterface();var _0x361824=getCPUhash();var _0x3eed18=_0x361824+'|'+os[_0x6ac0('0x1c')]()+'|'+_0x2239ba[_0x6ac0('0x1d')]+'|'+_0x2239ba[_0x6ac0('0x1e')];var _0x3c7273=crypto['createHash'](_0x6ac0('0x12'))[_0x6ac0('0x13')](_0x3eed18)['digest'](_0x6ac0('0x15'));return _0x3c7273[_0x6ac0('0x1f')](0x0,0x8)+'-'+_0x3c7273['substring'](0x8,0xc)+'-'+_0x3c7273[_0x6ac0('0x1f')](0xc,0x10)+'-'+_0x3c7273[_0x6ac0('0x1f')](0x10,0x14)+'-'+_0x3c7273[_0x6ac0('0x1f')](0x14);}}; \ No newline at end of file +var _0xf040=['createHash','md5','update','digest','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','hostname','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xf040,0x7a));var _0x0f04=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0xf040[_0x2fe689];return _0x35ea44;};'use strict';var _=require(_0x0f04('0x0'));var os=require('os');var crypto=require(_0x0f04('0x1'));var machine=require(_0x0f04('0x2'));var exec=require(_0x0f04('0x3'))['execSync'];var config=require(_0x0f04('0x4'));function getInterfaces(){var _0x2cf55d=[];var _0x3e9ab0=os[_0x0f04('0x5')]();var _0x452ae4=_[_0x0f04('0x6')](_[_0x0f04('0x7')](_0x3e9ab0));for(var _0x2cdb95=0x0;_0x2cdb95<_0x452ae4[_0x0f04('0x8')];_0x2cdb95++){var _0x10e380=_0x3e9ab0[_0x452ae4[_0x2cdb95]][_0x0f04('0x9')](function(_0x30aa28){return _0x30aa28[_0x0f04('0xa')]===_0x0f04('0xb')&&_0x30aa28[_0x0f04('0xc')]===![];});_0x2cf55d=_0x2cf55d[_0x0f04('0xd')](_0x10e380);}return _0x2cf55d;}function getFirstInterface(){var _0x1f48f7=_[_0x0f04('0xe')](getInterfaces());return{'macAddress':_0x1f48f7&&_0x1f48f7[_0x0f04('0xf')]?_0x1f48f7[_0x0f04('0xf')]:_0x0f04('0x10'),'ipAddress':_0x1f48f7&&_0x1f48f7['address']?_0x1f48f7[_0x0f04('0x11')]:'127.0.0.1'};}exports[_0x0f04('0x12')]=getFirstInterface;function getCPUhash(){var _0x32f7f9=_['orderBy'](os[_0x0f04('0x13')]()[_0x0f04('0x14')](function(_0xaf0718){return _0xaf0718[_0x0f04('0x15')];}))['join'](':');return crypto[_0x0f04('0x16')](_0x0f04('0x17'))[_0x0f04('0x18')](_0x32f7f9)[_0x0f04('0x19')](_0x0f04('0x1a'));}exports[_0x0f04('0x1b')]=function(){var _0x328f62=os[_0x0f04('0x1c')]();var _0x175701=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x175701[_0x0f04('0x1d')](config[_0x0f04('0x1e')])){return config[_0x0f04('0x1e')];}else if(_0x328f62===_0x0f04('0x1f')){return exec(_0x0f04('0x20'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x468490=getFirstInterface();var _0x43eb99=getCPUhash();var _0x5e361f=_0x43eb99+'|'+os[_0x0f04('0x21')]()+'|'+_0x468490['macAddress']+'|'+_0x468490[_0x0f04('0x22')];var _0x4623e5=crypto['createHash']('md5')[_0x0f04('0x18')](_0x5e361f)['digest'](_0x0f04('0x1a'));return _0x4623e5[_0x0f04('0x23')](0x0,0x8)+'-'+_0x4623e5[_0x0f04('0x23')](0x8,0xc)+'-'+_0x4623e5['substring'](0xc,0x10)+'-'+_0x4623e5[_0x0f04('0x23')](0x10,0x14)+'-'+_0x4623e5[_0x0f04('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a66dcf1..7aa4237 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 _0x28b0=['findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','catch','error','message','getUuid','License'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x28b0,0x114));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x028b('0x0'));var moment=require('moment');var rp=require(_0x028b('0x1'));var BPromise=require(_0x028b('0x2'));var pkginfo=require(_0x028b('0x3'))(module,'version');var db=require(_0x028b('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x028b('0x5'));var logger=require(_0x028b('0x6'))(_0x028b('0x7'));var HOST=_0x028b('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x40e6a7){return new BPromise(function(_0x2b713a,_0x2ce9aa){var _0x42b8dd=util[_0x028b('0x9')](_0x028b('0xa'),HOST,_0x40e6a7,module[_0x028b('0xb')][_0x028b('0xc')]);if(oldToken){_0x42b8dd=util[_0x028b('0x9')](_0x028b('0xd'),HOST,_0x40e6a7,module[_0x028b('0xb')][_0x028b('0xc')],oldToken);}var _0x46d333={'uri':_0x42b8dd,'method':_0x028b('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x46d333)[_0x028b('0xf')](function(_0x2e0e05){_0x2b713a(_0x2e0e05);})['catch'](function(_0x530896){_0x2ce9aa(_0x530896);});});}function manageLicense(_0x3b071e,_0x570d8c){var _0xd1e031=_0x570d8c[_0x028b('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0xd1e031[_0x028b('0x11')]!==_0x3b071e&&!_0xd1e031[_0x028b('0x12')]){oldToken=_0xd1e031[_0x028b('0x11')];}httpRequest(_0x3b071e)[_0x028b('0xf')](function(_0x66ee1d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x66ee1d['active']){isOldTokenSent=![];if(!_0xd1e031[_0x028b('0x7')]&&_0xd1e031['license']!=_0x66ee1d[_0x028b('0x7')]||_0xd1e031[_0x028b('0x7')]&&_0xd1e031[_0x028b('0x12')]){logger[_0x028b('0x13')](_0x028b('0x14'));}if(_0xd1e031[_0x028b('0x7')]&&!_0xd1e031['data2']&&_0xd1e031[_0x028b('0x7')]!=_0x66ee1d['license']){logger[_0x028b('0x13')](_0x028b('0x15'));}if(_0xd1e031['license']&&!_0xd1e031[_0x028b('0x12')]&&_0xd1e031['license']==_0x66ee1d['license']){return _0x570d8c;}return _0x570d8c[_0x028b('0x16')]({'data1':_0x3b071e,'data2':null,'license':_0x66ee1d[_0x028b('0x7')]});}else{if(_0x66ee1d[_0x028b('0x7')]||_0xd1e031[_0x028b('0x7')]){if(!_0xd1e031[_0x028b('0x12')]){if(_0xd1e031['data1']==_0x3b071e){GRAY_PERIOD_REASON=_0x028b('0x17');logger[_0x028b('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x028b('0x18');logger['info'](_0x028b('0x19'),_0xd1e031[_0x028b('0x11')],_0x3b071e);}logger[_0x028b('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x028b('0x1a')](),moment()[_0x028b('0x9')](_0x028b('0x1b')));return _0x570d8c[_0x028b('0x16')]({'data2':encryptor['encryptString'](moment()[_0x028b('0x9')](_0x028b('0x1b')))});}else{if(moment()[_0x028b('0x1c')](encryptor[_0x028b('0x1d')](_0xd1e031[_0x028b('0x12')]),_0x028b('0x1e'))>DAYS){logger[_0x028b('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0x028b('0x9')](_0x028b('0x1b')));isOldTokenSent=![];return _0x570d8c['update']({'data1':_0x3b071e,'data2':null,'license':null});}}}else{if(_0xd1e031[_0x028b('0x11')]!=_0x3b071e){logger[_0x028b('0x13')](_0x028b('0x19'),_0xd1e031['data1'],_0x3b071e);return _0x570d8c[_0x028b('0x16')]({'data1':_0x3b071e,'data2':null,'license':null});}}}return _0x570d8c;})['then'](function(_0x1ee706){_0x570d8c=_0x1ee706;})[_0x028b('0x1f')](function(_0x56a966){logger[_0x028b('0x20')](_0x56a966[_0x028b('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x028b('0x22')](),_0x570d8c);},TIME);});}function defaultLicense(){var _0x330a98=hardware['getUuid']();if(_0x330a98){return db[_0x028b('0x23')][_0x028b('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x330a98}})['spread'](function(_0xff5b31,_0x425c7b){logger[_0x028b('0x13')](_0x028b('0x25'),_0x330a98);manageLicense(_0x330a98,_0xff5b31);})[_0x028b('0x1f')](function(_0x2f17a3){logger[_0x028b('0x20')](_0x2f17a3[_0x028b('0x21')]);});}}exports[_0x028b('0x26')]=defaultLicense; \ No newline at end of file +var _0x0a04=['get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch'];(function(_0x4b3661,_0x1be781){var _0x582d0c=function(_0x1a1ee4){while(--_0x1a1ee4){_0x4b3661['push'](_0x4b3661['shift']());}};_0x582d0c(++_0x1be781);}(_0x0a04,0x194));var _0x40a0=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0a04[_0x1beef3];return _0x5af964;};'use strict';var util=require(_0x40a0('0x0'));var moment=require(_0x40a0('0x1'));var rp=require('request-promise');var BPromise=require(_0x40a0('0x2'));var pkginfo=require(_0x40a0('0x3'))(module,_0x40a0('0x4'));var db=require(_0x40a0('0x5'))['db'];var encryptor=require(_0x40a0('0x6'));var hardware=require(_0x40a0('0x7'));var logger=require(_0x40a0('0x8'))(_0x40a0('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x57aaa5){return new BPromise(function(_0x4cde13,_0x5a7099){var _0x5c97aa=util[_0x40a0('0xa')](_0x40a0('0xb'),HOST,_0x57aaa5,module['exports'][_0x40a0('0x4')]);if(oldToken){_0x5c97aa=util[_0x40a0('0xa')](_0x40a0('0xc'),HOST,_0x57aaa5,module[_0x40a0('0xd')][_0x40a0('0x4')],oldToken);}var _0x186975={'uri':_0x5c97aa,'method':_0x40a0('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x186975)['then'](function(_0x4d6fce){_0x4cde13(_0x4d6fce);})[_0x40a0('0xf')](function(_0x22f4eb){_0x5a7099(_0x22f4eb);});});}function manageLicense(_0x3d276e,_0x3c0c80){var _0x3ce571=_0x3c0c80[_0x40a0('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3ce571[_0x40a0('0x11')]!==_0x3d276e&&!_0x3ce571[_0x40a0('0x12')]){oldToken=_0x3ce571['data1'];}httpRequest(_0x3d276e)[_0x40a0('0x13')](function(_0x5d9a2f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5d9a2f[_0x40a0('0x14')]){isOldTokenSent=![];if(!_0x3ce571['license']&&_0x3ce571[_0x40a0('0x9')]!=_0x5d9a2f[_0x40a0('0x9')]||_0x3ce571[_0x40a0('0x9')]&&_0x3ce571['data2']){logger[_0x40a0('0x15')](_0x40a0('0x16'));}if(_0x3ce571[_0x40a0('0x9')]&&!_0x3ce571[_0x40a0('0x12')]&&_0x3ce571['license']!=_0x5d9a2f[_0x40a0('0x9')]){logger[_0x40a0('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3ce571[_0x40a0('0x9')]&&!_0x3ce571[_0x40a0('0x12')]&&_0x3ce571[_0x40a0('0x9')]==_0x5d9a2f[_0x40a0('0x9')]){return _0x3c0c80;}return _0x3c0c80['update']({'data1':_0x3d276e,'data2':null,'license':_0x5d9a2f['license']});}else{if(_0x5d9a2f['license']||_0x3ce571[_0x40a0('0x9')]){if(!_0x3ce571[_0x40a0('0x12')]){if(_0x3ce571[_0x40a0('0x11')]==_0x3d276e){GRAY_PERIOD_REASON=_0x40a0('0x17');logger[_0x40a0('0x15')](_0x40a0('0x18'));}else{GRAY_PERIOD_REASON=_0x40a0('0x19');logger[_0x40a0('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce571['data1'],_0x3d276e);}logger[_0x40a0('0x15')](_0x40a0('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x40a0('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x3c0c80[_0x40a0('0x1b')]({'data2':encryptor[_0x40a0('0x1c')](moment()[_0x40a0('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x40a0('0x1d')](encryptor[_0x40a0('0x1e')](_0x3ce571['data2']),_0x40a0('0x1f'))>DAYS){logger[_0x40a0('0x15')](_0x40a0('0x20'),moment()[_0x40a0('0xa')](_0x40a0('0x21')));isOldTokenSent=![];return _0x3c0c80['update']({'data1':_0x3d276e,'data2':null,'license':null});}}}else{if(_0x3ce571[_0x40a0('0x11')]!=_0x3d276e){logger[_0x40a0('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3ce571[_0x40a0('0x11')],_0x3d276e);return _0x3c0c80[_0x40a0('0x1b')]({'data1':_0x3d276e,'data2':null,'license':null});}}}return _0x3c0c80;})[_0x40a0('0x13')](function(_0x1749b0){_0x3c0c80=_0x1749b0;})[_0x40a0('0xf')](function(_0x388217){logger['error'](_0x388217['message']);})[_0x40a0('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x40a0('0x23')](),_0x3c0c80);},TIME);});}function defaultLicense(){var _0x37f778=hardware[_0x40a0('0x23')]();if(_0x37f778){return db[_0x40a0('0x24')][_0x40a0('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x37f778}})['spread'](function(_0x1bcb3e,_0x1e6464){logger[_0x40a0('0x15')](_0x40a0('0x26'),_0x37f778);manageLicense(_0x37f778,_0x1bcb3e);})[_0x40a0('0xf')](function(_0x2e417b){logger[_0x40a0('0x27')](_0x2e417b[_0x40a0('0x28')]);});}}exports[_0x40a0('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c6b0096..b088cf5 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 _0x308a=['role','sequelize','COUNT','col','count','admin','user','telephone','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','defaults','then','catch','data1','isEmpty','data2','split','decryptString','format','%s:%s:%s','uuid','machineUuid','gray','deadline','add','days','grayReason','message','findAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x308a,0x1bb));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xa308('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xa308('0x1'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xa308('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa308('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa308('0x4'),'machineUuid':hardware[_0xa308('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa308('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xa308('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4188ee){return new BPromise(function(_0x5d422e,_0x3114d2){return db['License']['find'](_[_0xa308('0x6')](_0x4188ee,{'raw':!![],'where':{'id':0x1}}))[_0xa308('0x7')](function(_0x48027a){return checkLicense(_0x48027a,null);})[_0xa308('0x7')](function(_0x15cc8d){_0x5d422e(_0x15cc8d);return;})[_0xa308('0x8')](function(_0x54b368){_0x3114d2(_0x54b368);});});}function checkLicense(_0x16baec,_0x43780b){if(!_0x16baec){demoLicense['uuid']=_0x16baec[_0xa308('0x9')];return demoLicense;}try{var _0x23b2d2=_0x43780b||_0x16baec['license'];if(_[_0xa308('0xa')](_0x23b2d2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x39ae1e=_0x16baec[_0xa308('0x9')];var _0x3977ef=_0x16baec[_0xa308('0xb')];var _0x22e054=_0x39ae1e[_0xa308('0xc')]('-')[0x4];var _0x351a33=_0x39ae1e[_0xa308('0xc')]('-')[0x0];var _0x1e6846=encryptor[_0xa308('0xd')](_0x23b2d2,util[_0xa308('0xe')](_0xa308('0xf'),_0x22e054,_0x39ae1e,_0x351a33));var _0x464aad=JSON['parse'](_0x1e6846);_0x464aad['demo']=![];_0x464aad[_0xa308('0x10')]=_0x39ae1e;_0x464aad[_0xa308('0x11')]=hardware[_0xa308('0x5')]();if(_0x3977ef){var _0x409820=encryptor[_0xa308('0xd')](_0x3977ef);_0x464aad[_0xa308('0x12')]=_0x409820;_0x464aad[_0xa308('0x13')]=moment(_0x409820)[_0xa308('0x14')](0x7,_0xa308('0x15'))['format']();_0x464aad[_0xa308('0x16')]=_0x464aad[_0xa308('0x10')]!=_0x464aad['machineUuid']?'changed':'disabled';}return _0x464aad;}catch(_0x277d39){breakingLicense[_0xa308('0x10')]=_0x16baec[_0xa308('0x9')];breakingLicense[_0xa308('0x17')]=_0x277d39[_0xa308('0x17')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x37b762,_0x22c227){getLicense()[_0xa308('0x7')](function(_0x23ad79){return db['User'][_0xa308('0x18')]({'attributes':[_0xa308('0x19'),[db[_0xa308('0x1a')]['fn'](_0xa308('0x1b'),db[_0xa308('0x1a')][_0xa308('0x1c')](_0xa308('0x19'))),_0xa308('0x1d')]],'group':_0xa308('0x19'),'where':{'role':{'$or':[_0xa308('0x1e'),_0xa308('0x1f'),_0xa308('0x20')]}},'raw':!![]})[_0xa308('0x7')](function(_0x62cfaf){var _0x2839b2={'user':_0x23ad79['users']||0x0,'telephone':_0x23ad79[_0xa308('0x21')]||0x0};_0x62cfaf[_0xa308('0x22')](function(_0x24e4bd){var _0x2a1a7c=_0x24e4bd[_0xa308('0x19')]==='admin'?'user':_0x24e4bd[_0xa308('0x19')];_0x2839b2[_0x2a1a7c]-=_0x24e4bd[_0xa308('0x1d')];if(_0x2839b2[_0x2a1a7c]<0x0)_0x2839b2[_0x2a1a7c]=0x0;});_0x37b762(_0x2839b2);return;});})[_0xa308('0x8')](function(_0x3e87b3){_0x22c227(_0x3e87b3);});});}function checkUserLimits(_0x551dd7){return new BPromise(function(_0x156626,_0x131e8a){getLimits()['then'](function(_0x1b501c){var _0x368a1b=_['pick'](_[_0xa308('0x23')](_0x551dd7,_0xa308('0x19')),['admin','user','telephone']);var _0x264edc=(_0x368a1b[_0xa308('0x1e')]||0x0)+(_0x368a1b[_0xa308('0x1f')]||0x0);var _0x5da068=_0x368a1b[_0xa308('0x20')]||0x0;if(_0x264edc>_0x1b501c['user'])return _0x131e8a(_0xa308('0x24'));if(_0x5da068>_0x1b501c[_0xa308('0x20')])return _0x131e8a(_0xa308('0x25'));return _0x156626();})[_0xa308('0x8')](function(_0x5481d1){_0x131e8a(_0x5481d1);});});}module[_0xa308('0x26')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x180d=['demo','machineUuid','gray','add','days','disabled','message','User','role','sequelize','COUNT','col','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format'];(function(_0x5e56de,_0x189fa7){var _0x26c6ec=function(_0x2ed7cf){while(--_0x2ed7cf){_0x5e56de['push'](_0x5e56de['shift']());}};_0x26c6ec(++_0x189fa7);}(_0x180d,0x120));var _0xd180=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x180d[_0x1ccdf7];return _0x52a0ae;};'use strict';var util=require('util');var _=require(_0xd180('0x0'));var moment=require(_0xd180('0x1'));var BPromise=require(_0xd180('0x2'));var hardware=require(_0xd180('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xd180('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd180('0x5'),'machineUuid':hardware[_0xd180('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd180('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x350607){return new BPromise(function(_0x518e50,_0xa58fbf){return db['License'][_0xd180('0x8')](_[_0xd180('0x9')](_0x350607,{'raw':!![],'where':{'id':0x1}}))[_0xd180('0xa')](function(_0x2e82a5){return checkLicense(_0x2e82a5,null);})['then'](function(_0x468461){_0x518e50(_0x468461);return;})[_0xd180('0xb')](function(_0x14790f){_0xa58fbf(_0x14790f);});});}function checkLicense(_0x3e4f5a,_0x1884d7){if(!_0x3e4f5a){demoLicense[_0xd180('0xc')]=_0x3e4f5a[_0xd180('0xd')];return demoLicense;}try{var _0x12a8c8=_0x1884d7||_0x3e4f5a[_0xd180('0xe')];if(_[_0xd180('0xf')](_0x12a8c8)){throw new Error(_0xd180('0x10'));}var _0x1c0d34=_0x3e4f5a['data1'];var _0x20b0f2=_0x3e4f5a['data2'];var _0x375cfb=_0x1c0d34[_0xd180('0x11')]('-')[0x4];var _0x5ca9b5=_0x1c0d34[_0xd180('0x11')]('-')[0x0];var _0x257ffe=encryptor[_0xd180('0x12')](_0x12a8c8,util[_0xd180('0x13')]('%s:%s:%s',_0x375cfb,_0x1c0d34,_0x5ca9b5));var _0xf35175=JSON['parse'](_0x257ffe);_0xf35175[_0xd180('0x14')]=![];_0xf35175[_0xd180('0xc')]=_0x1c0d34;_0xf35175[_0xd180('0x15')]=hardware[_0xd180('0x6')]();if(_0x20b0f2){var _0x1f7dce=encryptor[_0xd180('0x12')](_0x20b0f2);_0xf35175[_0xd180('0x16')]=_0x1f7dce;_0xf35175['deadline']=moment(_0x1f7dce)[_0xd180('0x17')](0x7,_0xd180('0x18'))[_0xd180('0x13')]();_0xf35175['grayReason']=_0xf35175[_0xd180('0xc')]!=_0xf35175[_0xd180('0x15')]?'changed':_0xd180('0x19');}return _0xf35175;}catch(_0x140572){breakingLicense[_0xd180('0xc')]=_0x3e4f5a[_0xd180('0xd')];breakingLicense['message']=_0x140572[_0xd180('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xe93030,_0x19a5fb){getLicense()['then'](function(_0xf7ef5e){return db[_0xd180('0x1b')]['findAll']({'attributes':[_0xd180('0x1c'),[db[_0xd180('0x1d')]['fn'](_0xd180('0x1e'),db[_0xd180('0x1d')][_0xd180('0x1f')](_0xd180('0x1c'))),_0xd180('0x20')]],'group':_0xd180('0x1c'),'where':{'role':{'$or':['admin',_0xd180('0x21'),_0xd180('0x22')]}},'raw':!![]})['then'](function(_0x19eb2d){var _0x2fc4f3={'user':_0xf7ef5e[_0xd180('0x23')]||0x0,'telephone':_0xf7ef5e[_0xd180('0x24')]||0x0};_0x19eb2d[_0xd180('0x25')](function(_0x1efe30){var _0xb3791d=_0x1efe30[_0xd180('0x1c')]===_0xd180('0x26')?_0xd180('0x21'):_0x1efe30['role'];_0x2fc4f3[_0xb3791d]-=_0x1efe30['count'];if(_0x2fc4f3[_0xb3791d]<0x0)_0x2fc4f3[_0xb3791d]=0x0;});_0xe93030(_0x2fc4f3);return;});})[_0xd180('0xb')](function(_0x2eca16){_0x19a5fb(_0x2eca16);});});}function checkUserLimits(_0x2270f7){return new BPromise(function(_0x20ab0d,_0x804205){getLimits()[_0xd180('0xa')](function(_0x29edc9){var _0x2075c=_[_0xd180('0x27')](_[_0xd180('0x28')](_0x2270f7,_0xd180('0x1c')),[_0xd180('0x26'),_0xd180('0x21'),'telephone']);var _0x2b32ce=(_0x2075c['admin']||0x0)+(_0x2075c[_0xd180('0x21')]||0x0);var _0x795aaa=_0x2075c['telephone']||0x0;if(_0x2b32ce>_0x29edc9[_0xd180('0x21')])return _0x804205(_0xd180('0x29'));if(_0x795aaa>_0x29edc9[_0xd180('0x22')])return _0x804205(_0xd180('0x2a'));return _0x20ab0d();})[_0xd180('0xb')](function(_0x459d56){_0x804205(_0x459d56);});});}module[_0xd180('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 143193d..039e8f5 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 _0x160f=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xf160('0x0')]={'DOMAIN':_0xf160('0x1'),'SESSION_SECRET':_0xf160('0x2'),'GOOGLE_ID':_0xf160('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x7880=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4c9784,_0x299275){var _0x3db2bd=function(_0x5da8b3){while(--_0x5da8b3){_0x4c9784['push'](_0x4c9784['shift']());}};_0x3db2bd(++_0x299275);}(_0x7880,0x1f4));var _0x0788=function(_0x170d16,_0x443724){_0x170d16=_0x170d16-0x0;var _0x1bf864=_0x7880[_0x170d16];return _0x1bf864;};'use strict';module['exports']={'DOMAIN':_0x0788('0x0'),'SESSION_SECRET':_0x0788('0x1'),'GOOGLE_ID':_0x0788('0x2'),'GOOGLE_SECRET':_0x0788('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 52dc063..0790547 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5a4=['exports','../utils/loggers','fileLogger'];(function(_0x3b838f,_0x445acf){var _0x200ed6=function(_0x5894b3){while(--_0x5894b3){_0x3b838f['push'](_0x3b838f['shift']());}};_0x200ed6(++_0x445acf);}(_0xd5a4,0x1f0));var _0x4d5a=function(_0x4cdb25,_0x3d068e){_0x4cdb25=_0x4cdb25-0x0;var _0x1c0419=_0xd5a4[_0x4cdb25];return _0x1c0419;};'use strict';var fileLogger=require(_0x4d5a('0x0'))[_0x4d5a('0x1')];module[_0x4d5a('0x2')]=fileLogger; \ No newline at end of file +var _0x487b=['fileLogger','../utils/loggers'];(function(_0x4fef1b,_0x4fff32){var _0x2aa380=function(_0x458f91){while(--_0x458f91){_0x4fef1b['push'](_0x4fef1b['shift']());}};_0x2aa380(++_0x4fff32);}(_0x487b,0x1ed));var _0xb487=function(_0x204528,_0x35f523){_0x204528=_0x204528-0x0;var _0x4d853a=_0x487b[_0x204528];return _0x4d853a;};'use strict';var fileLogger=require(_0xb487('0x0'))[_0xb487('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 1c4d3d3..b6d0653 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 _0xa2c0=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','path','../../config/environment','resolve','join','legacy-libs','express','../../services/ami/index.js'];(function(_0x12c3e7,_0x3e3488){var _0x48406d=function(_0x21d5bc){while(--_0x21d5bc){_0x12c3e7['push'](_0x12c3e7['shift']());}};_0x48406d(++_0x3e3488);}(_0xa2c0,0x172));var _0x0a2c=function(_0x1aa710,_0x48395){_0x1aa710=_0x1aa710-0x0;var _0x557557=_0xa2c0[_0x1aa710];return _0x557557;};'use strict';var path=require(_0x0a2c('0x0'));var cfg=require(_0x0a2c('0x1'));var env={'NODE_PATH':path[_0x0a2c('0x2')](path[_0x0a2c('0x3')](cfg['root'],_0x0a2c('0x4')))};var pm2config={'apps':[{'name':_0x0a2c('0x5'),'script':path[_0x0a2c('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x0a2c('0x3')](__dirname,_0x0a2c('0x6')),'env':env},{'name':'agi','script':path['join'](__dirname,_0x0a2c('0x7')),'env':env},{'name':_0x0a2c('0x8'),'script':path['join'](__dirname,_0x0a2c('0x9')),'env':env},{'name':_0x0a2c('0xa'),'script':path[_0x0a2c('0x3')](__dirname,_0x0a2c('0xb')),'env':env},{'name':_0x0a2c('0xc'),'script':path[_0x0a2c('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x39a8=['routing','../../services/routing/index.js','path','../../config/environment','resolve','root','express','join','../../services/express/index.js','ami','agi','email','../../services/email/index.js'];(function(_0x14361d,_0x4aa821){var _0x518d84=function(_0x5a9e49){while(--_0x5a9e49){_0x14361d['push'](_0x14361d['shift']());}};_0x518d84(++_0x4aa821);}(_0x39a8,0x84));var _0x839a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39a8[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x839a('0x0'));var cfg=require(_0x839a('0x1'));var env={'NODE_PATH':path[_0x839a('0x2')](path['join'](cfg[_0x839a('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x839a('0x4'),'script':path[_0x839a('0x5')](__dirname,_0x839a('0x6')),'env':env},{'name':_0x839a('0x7'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x839a('0x8'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x839a('0x9'),'script':path[_0x839a('0x5')](__dirname,_0x839a('0xa')),'env':env},{'name':_0x839a('0xb'),'script':path[_0x839a('0x5')](__dirname,_0x839a('0xc')),'env':env},{'name':'xdr','script':path[_0x839a('0x5')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9ad9d52..7c116af 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 _0xce43=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','bluebird','./config'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xce43,0xa7));var _0x3ce4=function(_0x37b70c,_0x27750){_0x37b70c=_0x37b70c-0x0;var _0x54bc7e=_0xce43[_0x37b70c];return _0x54bc7e;};'use strict';var pm2=require('pm2');var BPromise=require(_0x3ce4('0x0'));var config=require(_0x3ce4('0x1'));function connect(){return new BPromise(function(_0x3e2ea1,_0x2a0d8c){return pm2[_0x3ce4('0x2')](function(_0x25f0d9){if(_0x25f0d9){return _0x2a0d8c(_0x25f0d9);}return _0x3e2ea1(_0x3ce4('0x3'));});});};exports[_0x3ce4('0x4')]=function(_0x58a846){return connect()[_0x3ce4('0x5')](function(){return new BPromise(function(_0x35500d,_0x4ce968){return pm2['start'](_0x58a846,function(_0xa61002,_0xab8f0b){if(_0xa61002){return _0x4ce968(_0xa61002);}pm2[_0x3ce4('0x6')]();return _0x35500d(_0xab8f0b);});});});};exports[_0x3ce4('0x7')]=function(_0x35bc38){return connect()['then'](function(){return new BPromise(function(_0x325ea4,_0x52c086){return pm2[_0x3ce4('0x7')](_0x35bc38,function(_0x424059,_0x21688e){if(_0x424059){return _0x52c086(_0x424059);}pm2['disconnect']();return _0x325ea4(_0x21688e);});});});};exports[_0x3ce4('0x8')]=function(_0x586d0e){return connect()[_0x3ce4('0x5')](function(){return new BPromise(function(_0x272c90,_0x5cc562){return pm2[_0x3ce4('0x8')](_0x586d0e,function(_0x5c0425,_0x2e99e4){if(_0x5c0425){return _0x5cc562(_0x5c0425);}pm2[_0x3ce4('0x6')]();return _0x272c90(_0x2e99e4);});});});};exports[_0x3ce4('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4ba40e,_0x3801ba){return pm2[_0x3ce4('0x9')](function(_0x2546a6,_0x840416){if(_0x2546a6){return _0x3801ba(_0x2546a6);}pm2['disconnect']();return _0x4ba40e(_0x840416);});});});};exports[_0x3ce4('0xa')]=function(_0x3c0750){return connect()[_0x3ce4('0x5')](function(){return new BPromise(function(_0x91573c,_0x449b8d){return pm2['describe'](_0x3c0750,function(_0x25c727,_0x284c39){if(_0x25c727){return _0x449b8d(_0x25c727);}pm2[_0x3ce4('0x6')]();return _0x91573c(_0x284c39);});});});};exports[_0x3ce4('0xb')]=function(_0x4a4359){return connect()[_0x3ce4('0x5')](function(){return new BPromise(function(_0x32f6af,_0x1e1e6c){return pm2[_0x3ce4('0xb')](_0x4a4359,function(_0xc69d04,_0x30a7b6){if(_0xc69d04){return _0x1e1e6c(_0xc69d04);}pm2[_0x3ce4('0x6')]();return _0x32f6af(_0x30a7b6);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x303929,_0x2c96e4){return pm2[_0x3ce4('0xc')](function(_0x44d988){if(_0x44d988){return _0x2c96e4(_0x44d988);}return _0x303929('saved');});});});}; \ No newline at end of file +var _0xf967=['list','describe','delete','dump','pm2','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x2bddf9,_0x22c873){var _0x3f3ae9=function(_0x2d91ac){while(--_0x2d91ac){_0x2bddf9['push'](_0x2bddf9['shift']());}};_0x3f3ae9(++_0x22c873);}(_0xf967,0x1be));var _0x7f96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf967[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x7f96('0x0'));var BPromise=require('bluebird');var config=require(_0x7f96('0x1'));function connect(){return new BPromise(function(_0x632c8d,_0x2adc85){return pm2[_0x7f96('0x2')](function(_0x3a5c2a){if(_0x3a5c2a){return _0x2adc85(_0x3a5c2a);}return _0x632c8d(_0x7f96('0x3'));});});};exports[_0x7f96('0x4')]=function(_0xb97ca){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x3e0ece,_0x520a7d){return pm2[_0x7f96('0x4')](_0xb97ca,function(_0x56ec9e,_0x2157f6){if(_0x56ec9e){return _0x520a7d(_0x56ec9e);}pm2['disconnect']();return _0x3e0ece(_0x2157f6);});});});};exports[_0x7f96('0x6')]=function(_0x1aa398){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x2dd8cd,_0x54031c){return pm2[_0x7f96('0x6')](_0x1aa398,function(_0x53abe0,_0x259860){if(_0x53abe0){return _0x54031c(_0x53abe0);}pm2[_0x7f96('0x7')]();return _0x2dd8cd(_0x259860);});});});};exports[_0x7f96('0x8')]=function(_0x4cd5c9){return connect()['then'](function(){return new BPromise(function(_0x2f062a,_0x35b82a){return pm2[_0x7f96('0x8')](_0x4cd5c9,function(_0x40ef85,_0x1cfb3d){if(_0x40ef85){return _0x35b82a(_0x40ef85);}pm2[_0x7f96('0x7')]();return _0x2f062a(_0x1cfb3d);});});});};exports[_0x7f96('0x9')]=function(){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x2a5063,_0xc98756){return pm2[_0x7f96('0x9')](function(_0x3f50c0,_0x13bc71){if(_0x3f50c0){return _0xc98756(_0x3f50c0);}pm2['disconnect']();return _0x2a5063(_0x13bc71);});});});};exports[_0x7f96('0xa')]=function(_0x3603bb){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x34ce56,_0x4d7232){return pm2[_0x7f96('0xa')](_0x3603bb,function(_0x2a49e5,_0x26c135){if(_0x2a49e5){return _0x4d7232(_0x2a49e5);}pm2[_0x7f96('0x7')]();return _0x34ce56(_0x26c135);});});});};exports['delete']=function(_0x141131){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0x2adbae,_0x5c25f3){return pm2[_0x7f96('0xb')](_0x141131,function(_0xc63b16,_0x2cb9df){if(_0xc63b16){return _0x5c25f3(_0xc63b16);}pm2['disconnect']();return _0x2adbae(_0x2cb9df);});});});};exports[_0x7f96('0xc')]=function(){return connect()[_0x7f96('0x5')](function(){return new BPromise(function(_0xe0fb6d,_0x7714fa){return pm2[_0x7f96('0xc')](function(_0x212ff9){if(_0x212ff9){return _0x7714fa(_0x212ff9);}return _0xe0fb6d('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2e76d04..174db53 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 _0xd29c=['ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','Setting','find','then','chatTimeout'];(function(_0x2e5baf,_0x4b77a1){var _0x4c0797=function(_0x32f4fc){while(--_0x32f4fc){_0x2e5baf['push'](_0x2e5baf['shift']());}};_0x4c0797(++_0x4b77a1);}(_0xd29c,0x175));var _0xcd29=function(_0xf414e4,_0x569702){_0xf414e4=_0xf414e4-0x0;var _0x5db5d1=_0xd29c[_0xf414e4];return _0x5db5d1;};'use strict';var _=require(_0xcd29('0x0'));var moment=require('moment');var Redis=require(_0xcd29('0x1'));var util=require('util');var config=require(_0xcd29('0x2'));var db=require(_0xcd29('0x3'))['db'];var logger=require(_0xcd29('0x4'))(_0xcd29('0x5'));config[_0xcd29('0x6')]=_[_0xcd29('0x7')](config[_0xcd29('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcd29('0x6')]));function closeInteractions(){var _0x1046cb=0x0;var _0x250445=[];return db[_0xcd29('0x8')][_0xcd29('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xcd29('0xa')](function(_0x148509){_0x1046cb=_0x148509[_0xcd29('0xb')];if(_0x1046cb){return db[_0xcd29('0xc')][_0xcd29('0xd')]({'raw':!![],'attributes':['id',_0xcd29('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xcd29('0xf')](_0x148509[_0xcd29('0xb')],_0xcd29('0x10'))}}});}else{return[];}})[_0xcd29('0xa')](function(_0x13e8cb){if(_0x13e8cb&&_0x13e8cb[_0xcd29('0x11')]){_0x250445=_[_0xcd29('0x12')](_0x13e8cb||[],'id');logger[_0xcd29('0x13')](_0xcd29('0x14'),_0x250445[_0xcd29('0x15')]());return db[_0xcd29('0xc')][_0xcd29('0x16')]({'closeReason':_0xcd29('0x17'),'disposition':_0xcd29('0x18'),'closed':!![],'closedAt':moment()[_0xcd29('0x19')](_0xcd29('0x1a'))},{'where':{'id':_0x250445}});}})[_0xcd29('0xa')](function(){if(_0x250445&&_0x250445['length']){logger[_0xcd29('0x13')](_0xcd29('0x1b'),_0x250445[_0xcd29('0x15')]());for(var _0x41cf7f=0x0;_0x41cf7f<_0x250445[_0xcd29('0x11')];_0x41cf7f++){io[_0xcd29('0x1c')](_0xcd29('0x1d'),{'id':_0x250445[_0x41cf7f],'closed':!![]});}}})[_0xcd29('0x1e')](function(_0x5aead7){logger[_0xcd29('0x1f')](_0xcd29('0x20'),_0x5aead7?util[_0xcd29('0x21')](_0x5aead7,{'showHidden':![],'depth':null}):'');});}exports[_0xcd29('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xccec=['defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x3acdef,_0x2a7ae7){var _0x3a252a=function(_0x43b100){while(--_0x43b100){_0x3acdef['push'](_0x3acdef['shift']());}};_0x3a252a(++_0x2a7ae7);}(_0xccec,0x118));var _0xccce=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0xccec[_0x41010e];return _0x59e342;};'use strict';var _=require(_0xccce('0x0'));var moment=require(_0xccce('0x1'));var Redis=require(_0xccce('0x2'));var util=require(_0xccce('0x3'));var config=require(_0xccce('0x4'));var db=require(_0xccce('0x5'))['db'];var logger=require(_0xccce('0x6'))(_0xccce('0x7'));config['redis']=_[_0xccce('0x8')](config[_0xccce('0x9')],{'host':_0xccce('0xa'),'port':0x18eb});var io=require(_0xccce('0xb'))(new Redis(config[_0xccce('0x9')]));function closeInteractions(){var _0x24e1bd=0x0;var _0x95f579=[];return db[_0xccce('0xc')][_0xccce('0xd')]({'raw':!![],'attributes':['id',_0xccce('0xe')],'where':{'id':0x1}})[_0xccce('0xf')](function(_0x596cc4){_0x24e1bd=_0x596cc4[_0xccce('0xe')];if(_0x24e1bd){return db[_0xccce('0x10')][_0xccce('0x11')]({'raw':!![],'attributes':['id',_0xccce('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xccce('0x13')](_0x596cc4[_0xccce('0xe')],_0xccce('0x14'))}}});}else{return[];}})[_0xccce('0xf')](function(_0x26925a){if(_0x26925a&&_0x26925a[_0xccce('0x15')]){_0x95f579=_[_0xccce('0x16')](_0x26925a||[],'id');logger[_0xccce('0x17')](_0xccce('0x18'),_0x95f579[_0xccce('0x19')]());return db[_0xccce('0x10')]['update']({'closeReason':_0xccce('0x1a'),'disposition':_0xccce('0x1b'),'closed':!![],'closedAt':moment()[_0xccce('0x1c')](_0xccce('0x1d'))},{'where':{'id':_0x95f579}});}})[_0xccce('0xf')](function(){if(_0x95f579&&_0x95f579['length']){logger[_0xccce('0x17')](_0xccce('0x1e'),_0x95f579[_0xccce('0x19')]());for(var _0x5cb068=0x0;_0x5cb068<_0x95f579[_0xccce('0x15')];_0x5cb068++){io[_0xccce('0x1f')]('chatInteraction:update',{'id':_0x95f579[_0x5cb068],'closed':!![]});}}})[_0xccce('0x20')](function(_0x3c137c){logger['error'](_0xccce('0x21'),_0x3c137c?util[_0xccce('0x22')](_0x3c137c,{'showHidden':![],'depth':null}):'');});}exports[_0xccce('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 7821064..39c6a03 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb99=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x38ba7c,_0x4594fb){var _0x1251a3=function(_0x5b7d77){while(--_0x5b7d77){_0x38ba7c['push'](_0x38ba7c['shift']());}};_0x1251a3(++_0x4594fb);}(_0xbb99,0x1e6));var _0x9bb9=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xbb99[_0x4099ee];return _0x1b7bfc;};'use strict';function start(){var _0x5e9c54=require(_0x9bb9('0x0'));return _0x5e9c54[_0x9bb9('0x1')]();}module[_0x9bb9('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4069=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x5a02c2,_0x27bda2){var _0xfd0566=function(_0x26980f){while(--_0x26980f){_0x5a02c2['push'](_0x5a02c2['shift']());}};_0xfd0566(++_0x27bda2);}(_0x4069,0x1f4));var _0x9406=function(_0x3694b2,_0x121f3a){_0x3694b2=_0x3694b2-0x0;var _0x4a18e0=_0x4069[_0x3694b2];return _0x4a18e0;};'use strict';function start(){var _0x551d1e=require(_0x9406('0x0'));return _0x551d1e[_0x9406('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ef88b9a..e113185 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 _0xb155=['startAt','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','AnalyticExtractedReport','then','catch','error','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','zip','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','email\x20sent','error\x20mail','case\x20loading','currentAttempt','retries','job','operation','stop','data','case\x20failed','Unrecognized\x20status:','dataValues','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','toString','keyBy','difference','intersection','length','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','endAt','add','start','exists','deleteJob'];(function(_0x1102f5,_0x571721){var _0x442222=function(_0x261ce0){while(--_0x261ce0){_0x1102f5['push'](_0x1102f5['shift']());}};_0x442222(++_0x571721);}(_0xb155,0x134));var _0x5b15=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xb155[_0x57da0a];return _0x3145d5;};'use strict';var fs=require('fs');var util=require(_0x5b15('0x0'));var path=require(_0x5b15('0x1'));var _=require(_0x5b15('0x2'));var moment=require(_0x5b15('0x3'));var CronJobManager=require(_0x5b15('0x4'));var jayson=require(_0x5b15('0x5'));var BPromise=require('bluebird');var logger=require(_0x5b15('0x6'))(_0x5b15('0x7'));var db=require(_0x5b15('0x8'))['db'];const retry=require(_0x5b15('0x9'));var analyticCustomReportController=require(_0x5b15('0xa'));var analyticDefaultReportController=require(_0x5b15('0xb'));var client=jayson[_0x5b15('0xc')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4f79d4){const _0x7ba906={};if(typeof _0x4f79d4==='number'){_0x7ba906['id']=_0x4f79d4;}return db[_0x5b15('0xd')]['findOne']({'where':_0x7ba906})[_0x5b15('0xe')](function(_0x2ec5e7){return _0x2ec5e7;})[_0x5b15('0xf')](function(_0x579b8c){logger[_0x5b15('0x10')](_0x579b8c);});}function handleSendEmail(_0x215eec,_0x155ee6){logger['info'](_0x5b15('0x11'),_0x215eec[_0x5b15('0x12')]);var _0x23c69b=!![];var _0x217441=_0x215eec[_0x5b15('0x13')]['getSmtpOptions']();var _0x5d286a={'account':_0x217441,'message':{'from':util[_0x5b15('0x14')](_0x5b15('0x15'),_0x215eec[_0x5b15('0x13')][_0x5b15('0x16')],_0x215eec[_0x5b15('0x13')]['email']||_0x215eec[_0x5b15('0x13')][_0x5b15('0x17')][_0x5b15('0x18')]),'to':_0x215eec[_0x5b15('0x12')],'cc':_0x215eec['cc'],'bcc':_0x215eec[_0x5b15('0x19')],'subject':util['format'](_0x5b15('0x1a'),_0x155ee6[_0x5b15('0x16')],_0x215eec[_0x5b15('0x1b')],_0x215eec[_0x5b15('0x1c')])}};var _0x638421=path[_0x5b15('0x1d')](__dirname,_0x5b15('0x1e'));var _0x3e1ccc=_0x155ee6[_0x5b15('0x1f')];var _0x43f0b4=util[_0x5b15('0x14')]('%s.%s',path[_0x5b15('0x20')](_0x155ee6[_0x5b15('0x1f')],path['extname'](_0x155ee6['savename'])),_0x5b15('0x21'));var _0x52706e=path[_0x5b15('0x1d')](_0x638421,_0x3e1ccc);var _0x419cd4=path[_0x5b15('0x1d')](_0x638421,_0x43f0b4);if(fs['existsSync'](_0x52706e)){_0x155ee6['status']=_0x5b15('0x22');_0x5d286a['message'][_0x5b15('0x23')]=[{'filename':_0x3e1ccc,'path':_0x52706e}];_0x5d286a[_0x5b15('0x24')]['text']=util[_0x5b15('0x14')](_0x5b15('0x25'),JSON[_0x5b15('0x26')](_0x155ee6,null,0x2));}else if(fs[_0x5b15('0x27')](_0x419cd4)){_0x155ee6[_0x5b15('0x28')]=_0x5b15('0x22');_0x5d286a['message']['attachments']=[{'filename':_0x43f0b4,'path':_0x419cd4}];}else{if(_0x155ee6[_0x5b15('0x28')]==='Empty'){_0x5d286a['message'][_0x5b15('0x29')]=_0x5b15('0x2a');if(!_0x215eec[_0x5b15('0x2b')]){_0x23c69b=![];logger[_0x5b15('0x2c')](_0x5b15('0x2d'));}}else if(_0x155ee6[_0x5b15('0x28')]==='Loading'){_0x5d286a['message']['text']=_0x5b15('0x2e');}else if(_0x155ee6['status']===_0x5b15('0x2f')){_0x5d286a[_0x5b15('0x24')][_0x5b15('0x29')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x155ee6['status']==='Failed'){_0x5d286a[_0x5b15('0x24')][_0x5b15('0x29')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x5b15('0x10')](_0x5b15('0x30'),_0x155ee6[_0x5b15('0x28')]);}}if(_0x23c69b){return client[_0x5b15('0x31')](_0x5b15('0x32'),_0x5d286a)[_0x5b15('0xe')](function(_0x1c565a){if(_0x1c565a[_0x5b15('0x10')]){return logger[_0x5b15('0x10')]('error\x20mail',JSON['stringify'](_0x1c565a));}return logger[_0x5b15('0x2c')](_0x5b15('0x33'));})[_0x5b15('0xf')](function(_0x468b99){return logger[_0x5b15('0x10')](_0x5b15('0x34'),JSON['stringify'](_0x468b99));});}}function handleError(){return function(_0x5da25d){return logger['error'](JSON[_0x5b15('0x26')](_0x5da25d));};}function loading(_0x5660da){logger[_0x5b15('0x2c')](_0x5b15('0x35'));if(_0x5660da[_0x5b15('0x36')]===_0x5660da['retryOptions'][_0x5b15('0x37')]){handleSendEmail(_0x5660da[_0x5b15('0x38')],_0x5660da['data']);_0x5660da[_0x5b15('0x39')][_0x5b15('0x3a')]();}else{_0x5660da['operation'][_0x5b15('0x9')]('still\x20loading');}}function completed(_0x3e186b){logger['info']('case\x20completed');handleSendEmail(_0x3e186b[_0x5b15('0x38')],_0x3e186b[_0x5b15('0x3b')]);_0x3e186b[_0x5b15('0x39')][_0x5b15('0x3a')]();}function empty(_0x19f832){logger[_0x5b15('0x2c')]('case\x20empty');handleSendEmail(_0x19f832[_0x5b15('0x38')],_0x19f832[_0x5b15('0x3b')]);_0x19f832[_0x5b15('0x39')][_0x5b15('0x3a')]();}function failed(_0x30e164){logger[_0x5b15('0x2c')](_0x5b15('0x3c'));handleSendEmail(_0x30e164[_0x5b15('0x38')],_0x30e164[_0x5b15('0x3b')]);_0x30e164[_0x5b15('0x39')][_0x5b15('0x3a')]();}function urecognized(_0x5a10e6){logger['error'](_0x5b15('0x3d'),_0x5a10e6['entity'][_0x5b15('0x3e')]['status']);_0x5a10e6[_0x5b15('0x39')][_0x5b15('0x3a')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x356e4e,_0x7e2434){const _0x32b08d={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x6c1ba5=retry[_0x5b15('0x39')](_0x32b08d);_0x6c1ba5['attempt'](_0x4b36bf=>{logger[_0x5b15('0x2c')](_0x5b15('0x3f')+_0x356e4e['id']+'\x20Attempt\x20#:'+_0x4b36bf);try{getReportData(_0x7e2434['id'])[_0x5b15('0xe')](function(_0x5638bf){_0x7e2434=_0x5638bf;logger[_0x5b15('0x2c')]('report\x20status:',_0x5638bf[_0x5b15('0x3e')][_0x5b15('0x28')]);if(!reportStatusStrategies[_0x5638bf[_0x5b15('0x3e')][_0x5b15('0x28')]]){logger[_0x5b15('0x10')](_0x5b15('0x40'),_0x5638bf[_0x5b15('0x3e')][_0x5b15('0x28')]);_0x6c1ba5['retry']();}reportStatusStrategies[_0x5638bf['dataValues'][_0x5b15('0x28')]]({'operation':_0x6c1ba5,'currentAttempt':_0x4b36bf,'retryOptions':_0x32b08d,'job':_0x356e4e,'data':_0x7e2434,'entity':_0x5638bf});});}catch(_0x3b9823){_0x6c1ba5[_0x5b15('0x9')](_0x3b9823);}});}function handleResult(_0x1bff63){return function(_0x6b35fc){if(_0x1bff63[_0x5b15('0x41')]&&_0x1bff63['MailAccount']&&_0x1bff63[_0x5b15('0x13')][_0x5b15('0x17')]&&!_[_0x5b15('0x42')](_0x1bff63['email'])){retryer(_0x1bff63,_0x6b35fc);}};}function handleJob(_0x4c09a1){return function(){try{if(_[_0x5b15('0x42')](_0x4c09a1[_0x5b15('0x1b')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x5b15('0x42')](_0x4c09a1[_0x5b15('0x1c')])){return logger['info'](_0x5b15('0x43'));}var _0xd7bc0f={'startDate':moment()['subtract'](_0x4c09a1[_0x5b15('0x1b')],_0x4c09a1['subtractUnit'])[_0x5b15('0x14')](_0x5b15('0x44')),'endDate':moment()[_0x5b15('0x14')](_0x5b15('0x44')),'type':'scheduled','output':_0x4c09a1[_0x5b15('0x45')],'name':_0x4c09a1[_0x5b15('0x16')]};if(!_[_0x5b15('0x42')](_0x4c09a1[_0x5b15('0x46')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4c09a1['DefaultReportId']);return analyticDefaultReportController[_0x5b15('0x47')]({'id':_0x4c09a1[_0x5b15('0x46')]},_0xd7bc0f)[_0x5b15('0xe')](handleResult(_0x4c09a1))[_0x5b15('0xf')](handleError());}if(!_[_0x5b15('0x42')](_0x4c09a1[_0x5b15('0x48')])){logger['info'](_0x5b15('0x49'),_0x4c09a1[_0x5b15('0x48')]);return analyticCustomReportController[_0x5b15('0x47')]({'id':_0x4c09a1[_0x5b15('0x48')]},_0xd7bc0f)[_0x5b15('0xe')](handleResult(_0x4c09a1))[_0x5b15('0xf')](handleError());}}catch(_0x5d4b9f){logger[_0x5b15('0x10')](JSON[_0x5b15('0x26')](_0x5d4b9f));}return logger[_0x5b15('0x2c')](_0x5b15('0x4a'));};}function getJobs(_0x577379){var _0x4a03ed={};if(_0x577379){_0x4a03ed['id']=_0x577379;}return db[_0x5b15('0x4b')]['findAll']({'where':_0x4a03ed,'include':[{'model':db[_0x5b15('0x13')],'attributes':['id',_0x5b15('0x16'),_0x5b15('0x12')],'include':[{'model':db['MailServerOut'],'as':_0x5b15('0x17'),'include':[{'model':db[_0x5b15('0x4c')],'as':_0x5b15('0x4c')}]}]}]})[_0x5b15('0xe')](function(_0x1de88a){var _0x7bb0d2=_[_0x5b15('0x4d')](manager[_0x5b15('0x4e')]);var _0x4cd8f6=_['map'](_0x1de88a,function(_0x492e5c){return _0x492e5c['id'][_0x5b15('0x4f')]();});var _0x2199d5=_[_0x5b15('0x50')](_0x1de88a,function(_0x5926ad){return _0x5926ad['id'][_0x5b15('0x4f')]();});var _0x5088c8=_0x577379?_0x4cd8f6:_[_0x5b15('0x51')](_0x4cd8f6,_0x7bb0d2);var _0x566f1b=_[_0x5b15('0x52')](_0x4cd8f6,_0x7bb0d2);var _0x3fb239=_['difference'](_0x7bb0d2,_0x4cd8f6);var _0x5ed2c6;var _0x56f04b;for(_0x5ed2c6=0x0;_0x5ed2c6<_0x3fb239[_0x5b15('0x53')]&&!_0x577379;_0x5ed2c6+=0x1){_0x56f04b=_0x3fb239[_0x5ed2c6][_0x5b15('0x4f')]();if(manager['exists'](_0x56f04b)){manager['stop'](_0x56f04b);manager['deleteJob'](_0x56f04b);logger[_0x5b15('0x2c')](_0x5b15('0x54'),_0x56f04b);}}logger[_0x5b15('0x2c')](_0x5b15('0x55'),JSON[_0x5b15('0x26')](_0x5088c8));for(_0x5ed2c6=0x0;_0x5ed2c6<_0x5088c8[_0x5b15('0x53')];_0x5ed2c6+=0x1){_0x56f04b=_0x5088c8[_0x5ed2c6][_0x5b15('0x4f')]();if(_0x577379){logger[_0x5b15('0x2c')](JSON[_0x5b15('0x26')](_0x2199d5[_0x56f04b]));BPromise[_0x5b15('0x56')]()[_0x5b15('0xe')](handleJob(_0x2199d5[_0x56f04b]));logger[_0x5b15('0x2c')](_0x5b15('0x57'),_0x2199d5[_0x56f04b]['name'],_0x2199d5[_0x56f04b]['cron']);}else if(_0x2199d5[_0x56f04b][_0x5b15('0x58')]&&_0x2199d5[_0x56f04b][_0x5b15('0x59')]&&moment()[_0x5b15('0x5a')](_0x2199d5[_0x56f04b]['startAt'],_0x2199d5[_0x56f04b][_0x5b15('0x5b')])){manager[_0x5b15('0x5c')](_0x56f04b,_0x2199d5[_0x56f04b][_0x5b15('0x58')],handleJob(_0x2199d5[_0x56f04b]));manager[_0x5b15('0x5d')](_0x56f04b);logger[_0x5b15('0x2c')]('add\x20cron',_0x2199d5[_0x56f04b][_0x5b15('0x16')],_0x2199d5[_0x56f04b][_0x5b15('0x58')]);}else if(manager[_0x5b15('0x5e')](_0x56f04b)){manager[_0x5b15('0x3a')](_0x56f04b);manager[_0x5b15('0x5f')](_0x56f04b);logger[_0x5b15('0x2c')]('stop\x20cron',_0x2199d5[_0x56f04b][_0x5b15('0x16')],_0x2199d5[_0x56f04b]['cron']);}}for(_0x5ed2c6=0x0,_0x56f04b;_0x5ed2c6<_0x566f1b[_0x5b15('0x53')]&&!_0x577379;_0x5ed2c6+=0x1){_0x56f04b=_0x566f1b[_0x5ed2c6][_0x5b15('0x4f')]();if(manager[_0x5b15('0x5e')](_0x56f04b)){if(_0x2199d5[_0x56f04b][_0x5b15('0x58')]&&_0x2199d5[_0x56f04b][_0x5b15('0x59')]&&moment()[_0x5b15('0x5a')](_0x2199d5[_0x56f04b][_0x5b15('0x60')],_0x2199d5[_0x56f04b][_0x5b15('0x5b')])){manager[_0x5b15('0x61')](_0x56f04b,_0x2199d5[_0x56f04b][_0x5b15('0x58')],handleJob(_0x2199d5[_0x56f04b]));logger[_0x5b15('0x2c')](_0x5b15('0x62'),_0x2199d5[_0x56f04b][_0x5b15('0x16')],_0x2199d5[_0x56f04b][_0x5b15('0x58')]);}else{manager[_0x5b15('0x3a')](_0x56f04b);manager['deleteJob'](_0x56f04b);logger[_0x5b15('0x2c')](_0x5b15('0x63'),_0x2199d5[_0x56f04b][_0x5b15('0x16')],_0x2199d5[_0x56f04b][_0x5b15('0x58')]);}}}})[_0x5b15('0xf')](function(_0x1a01e4){logger['error'](JSON[_0x5b15('0x26')](_0x1a01e4));});}exports[_0x5b15('0x64')]=function(_0x3c2d61){return getJobs(_0x3c2d61);};exports[_0x5b15('0x5d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7a92=['message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Empty','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','job','operation','case\x20completed','data','case\x20empty','stop','case\x20failed','entity','dataValues','attempt','Job\x20ID\x20','report\x20status:','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','cron','active','startAt','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','existsSync','status','Sent'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a92,0xa8));var _0x27a9=function(_0x36d768,_0x4ac92e){_0x36d768=_0x36d768-0x0;var _0x255ea5=_0x7a92[_0x36d768];return _0x255ea5;};'use strict';var fs=require('fs');var util=require(_0x27a9('0x0'));var path=require(_0x27a9('0x1'));var _=require('lodash');var moment=require(_0x27a9('0x2'));var CronJobManager=require(_0x27a9('0x3'));var jayson=require(_0x27a9('0x4'));var BPromise=require(_0x27a9('0x5'));var logger=require(_0x27a9('0x6'))('schedule');var db=require(_0x27a9('0x7'))['db'];const retry=require(_0x27a9('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x27a9('0x9'));var client=jayson[_0x27a9('0xa')][_0x27a9('0xb')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x305339){const _0x38c122={};if(typeof _0x305339==='number'){_0x38c122['id']=_0x305339;}return db['AnalyticExtractedReport'][_0x27a9('0xc')]({'where':_0x38c122})[_0x27a9('0xd')](function(_0x2ba2f8){return _0x2ba2f8;})[_0x27a9('0xe')](function(_0x2f9bcd){logger[_0x27a9('0xf')](_0x2f9bcd);});}function handleSendEmail(_0x243138,_0x617061){logger[_0x27a9('0x10')](_0x27a9('0x11'),_0x243138[_0x27a9('0x12')]);var _0x87414b=!![];var _0x362089=_0x243138['MailAccount'][_0x27a9('0x13')]();var _0x2724a5={'account':_0x362089,'message':{'from':util[_0x27a9('0x14')](_0x27a9('0x15'),_0x243138[_0x27a9('0x16')]['name'],_0x243138[_0x27a9('0x16')][_0x27a9('0x12')]||_0x243138[_0x27a9('0x16')]['Smtp'][_0x27a9('0x17')]),'to':_0x243138[_0x27a9('0x12')],'cc':_0x243138['cc'],'bcc':_0x243138['bcc'],'subject':util['format'](_0x27a9('0x18'),_0x617061[_0x27a9('0x19')],_0x243138[_0x27a9('0x1a')],_0x243138[_0x27a9('0x1b')])}};var _0x193acf=path[_0x27a9('0x1c')](__dirname,_0x27a9('0x1d'));var _0x2e09c4=_0x617061[_0x27a9('0x1e')];var _0x98b3fa=util[_0x27a9('0x14')](_0x27a9('0x1f'),path[_0x27a9('0x20')](_0x617061[_0x27a9('0x1e')],path['extname'](_0x617061[_0x27a9('0x1e')])),'zip');var _0x5475d0=path[_0x27a9('0x1c')](_0x193acf,_0x2e09c4);var _0x1b82f3=path[_0x27a9('0x1c')](_0x193acf,_0x98b3fa);if(fs[_0x27a9('0x21')](_0x5475d0)){_0x617061[_0x27a9('0x22')]=_0x27a9('0x23');_0x2724a5[_0x27a9('0x24')]['attachments']=[{'filename':_0x2e09c4,'path':_0x5475d0}];_0x2724a5[_0x27a9('0x24')][_0x27a9('0x25')]=util['format'](_0x27a9('0x26'),JSON[_0x27a9('0x27')](_0x617061,null,0x2));}else if(fs['existsSync'](_0x1b82f3)){_0x617061[_0x27a9('0x22')]='Sent';_0x2724a5[_0x27a9('0x24')][_0x27a9('0x28')]=[{'filename':_0x98b3fa,'path':_0x1b82f3}];}else{if(_0x617061[_0x27a9('0x22')]===_0x27a9('0x29')){_0x2724a5[_0x27a9('0x24')][_0x27a9('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x243138[_0x27a9('0x2a')]){_0x87414b=![];logger[_0x27a9('0x10')](_0x27a9('0x2b'));}}else if(_0x617061['status']===_0x27a9('0x2c')){_0x2724a5['message']['text']=_0x27a9('0x2d');}else if(_0x617061['status']===_0x27a9('0x2e')){_0x2724a5['message'][_0x27a9('0x25')]=_0x27a9('0x2f');}else if(_0x617061[_0x27a9('0x22')]==='Failed'){_0x2724a5[_0x27a9('0x24')][_0x27a9('0x25')]=_0x27a9('0x30');}else{logger['error']('[handleSendEmail]\x20Unrecognized\x20status:',_0x617061[_0x27a9('0x22')]);}}if(_0x87414b){return client[_0x27a9('0x31')](_0x27a9('0x32'),_0x2724a5)['then'](function(_0x11451a){if(_0x11451a[_0x27a9('0xf')]){return logger[_0x27a9('0xf')](_0x27a9('0x33'),JSON['stringify'](_0x11451a));}return logger[_0x27a9('0x10')](_0x27a9('0x34'));})['catch'](function(_0x2b4217){return logger[_0x27a9('0xf')](_0x27a9('0x33'),JSON[_0x27a9('0x27')](_0x2b4217));});}}function handleError(){return function(_0x5113ed){return logger[_0x27a9('0xf')](JSON[_0x27a9('0x27')](_0x5113ed));};}function loading(_0x48b6f8){logger[_0x27a9('0x10')](_0x27a9('0x35'));if(_0x48b6f8[_0x27a9('0x36')]===_0x48b6f8[_0x27a9('0x37')]['retries']){handleSendEmail(_0x48b6f8[_0x27a9('0x38')],_0x48b6f8['data']);_0x48b6f8[_0x27a9('0x39')]['stop']();}else{_0x48b6f8['operation'][_0x27a9('0x8')]('still\x20loading');}}function completed(_0x2893d5){logger[_0x27a9('0x10')](_0x27a9('0x3a'));handleSendEmail(_0x2893d5['job'],_0x2893d5[_0x27a9('0x3b')]);_0x2893d5[_0x27a9('0x39')]['stop']();}function empty(_0x2a1d60){logger[_0x27a9('0x10')](_0x27a9('0x3c'));handleSendEmail(_0x2a1d60[_0x27a9('0x38')],_0x2a1d60[_0x27a9('0x3b')]);_0x2a1d60['operation'][_0x27a9('0x3d')]();}function failed(_0x2d2d29){logger[_0x27a9('0x10')](_0x27a9('0x3e'));handleSendEmail(_0x2d2d29[_0x27a9('0x38')],_0x2d2d29[_0x27a9('0x3b')]);_0x2d2d29[_0x27a9('0x39')][_0x27a9('0x3d')]();}function urecognized(_0xe31df0){logger[_0x27a9('0xf')]('Unrecognized\x20status:',_0xe31df0[_0x27a9('0x3f')][_0x27a9('0x40')][_0x27a9('0x22')]);_0xe31df0[_0x27a9('0x39')][_0x27a9('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x27fd44,_0x29de9c){const _0x49ae0f={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x597d10=retry['operation'](_0x49ae0f);_0x597d10[_0x27a9('0x41')](_0x11744b=>{logger[_0x27a9('0x10')](_0x27a9('0x42')+_0x27fd44['id']+'\x20Attempt\x20#:'+_0x11744b);try{getReportData(_0x29de9c['id'])[_0x27a9('0xd')](function(_0x37e501){_0x29de9c=_0x37e501;logger[_0x27a9('0x10')](_0x27a9('0x43'),_0x37e501[_0x27a9('0x40')]['status']);if(!reportStatusStrategies[_0x37e501['dataValues']['status']]){logger[_0x27a9('0xf')](_0x27a9('0x43'),_0x37e501[_0x27a9('0x40')][_0x27a9('0x22')]);_0x597d10[_0x27a9('0x8')]();}reportStatusStrategies[_0x37e501['dataValues']['status']]({'operation':_0x597d10,'currentAttempt':_0x11744b,'retryOptions':_0x49ae0f,'job':_0x27fd44,'data':_0x29de9c,'entity':_0x37e501});});}catch(_0x5e0364){_0x597d10[_0x27a9('0x8')](_0x5e0364);}});}function handleResult(_0xc2460e){return function(_0x282da4){if(_0xc2460e[_0x27a9('0x44')]&&_0xc2460e[_0x27a9('0x16')]&&_0xc2460e[_0x27a9('0x16')][_0x27a9('0x45')]&&!_['isNil'](_0xc2460e[_0x27a9('0x12')])){retryer(_0xc2460e,_0x282da4);}};}function handleJob(_0x31d779){return function(){try{if(_[_0x27a9('0x46')](_0x31d779['subtractNumber'])){return logger[_0x27a9('0x10')](_0x27a9('0x47'));}if(_[_0x27a9('0x46')](_0x31d779[_0x27a9('0x1b')])){return logger[_0x27a9('0x10')]('subtractUnit\x20null\x20or\x20undefined');}var _0x260d54={'startDate':moment()['subtract'](_0x31d779['subtractNumber'],_0x31d779[_0x27a9('0x1b')])[_0x27a9('0x14')](_0x27a9('0x48')),'endDate':moment()['format'](_0x27a9('0x48')),'type':_0x27a9('0x49'),'output':_0x31d779[_0x27a9('0x4a')],'name':_0x31d779[_0x27a9('0x19')]};if(!_[_0x27a9('0x46')](_0x31d779[_0x27a9('0x4b')])){logger[_0x27a9('0x10')](_0x27a9('0x4c'),_0x31d779[_0x27a9('0x4b')]);return analyticDefaultReportController[_0x27a9('0x4d')]({'id':_0x31d779[_0x27a9('0x4b')]},_0x260d54)[_0x27a9('0xd')](handleResult(_0x31d779))[_0x27a9('0xe')](handleError());}if(!_[_0x27a9('0x46')](_0x31d779[_0x27a9('0x4e')])){logger[_0x27a9('0x10')](_0x27a9('0x4f'),_0x31d779['CustomReportId']);return analyticCustomReportController[_0x27a9('0x4d')]({'id':_0x31d779[_0x27a9('0x4e')]},_0x260d54)['then'](handleResult(_0x31d779))[_0x27a9('0xe')](handleError());}}catch(_0x3c9ef9){logger[_0x27a9('0xf')](JSON[_0x27a9('0x27')](_0x3c9ef9));}return logger[_0x27a9('0x10')]('no\x20report\x20id');};}function getJobs(_0x596a9d){var _0x5d92ed={};if(_0x596a9d){_0x5d92ed['id']=_0x596a9d;}return db['Schedule'][_0x27a9('0x50')]({'where':_0x5d92ed,'include':[{'model':db['MailAccount'],'attributes':['id',_0x27a9('0x19'),_0x27a9('0x12')],'include':[{'model':db[_0x27a9('0x51')],'as':_0x27a9('0x45'),'include':[{'model':db['CloudProvider'],'as':_0x27a9('0x52')}]}]}]})[_0x27a9('0xd')](function(_0x9a70b2){var _0x42719a=_['keys'](manager[_0x27a9('0x53')]);var _0xef71ca=_['map'](_0x9a70b2,function(_0x592f0f){return _0x592f0f['id']['toString']();});var _0x3000d=_[_0x27a9('0x54')](_0x9a70b2,function(_0x1504c2){return _0x1504c2['id'][_0x27a9('0x55')]();});var _0x39447f=_0x596a9d?_0xef71ca:_[_0x27a9('0x56')](_0xef71ca,_0x42719a);var _0x374cf9=_[_0x27a9('0x57')](_0xef71ca,_0x42719a);var _0x394ded=_['difference'](_0x42719a,_0xef71ca);var _0x481570;var _0x259b29;for(_0x481570=0x0;_0x481570<_0x394ded[_0x27a9('0x58')]&&!_0x596a9d;_0x481570+=0x1){_0x259b29=_0x394ded[_0x481570][_0x27a9('0x55')]();if(manager[_0x27a9('0x59')](_0x259b29)){manager[_0x27a9('0x3d')](_0x259b29);manager[_0x27a9('0x5a')](_0x259b29);logger['info'](_0x27a9('0x5b'),_0x259b29);}}logger[_0x27a9('0x10')](_0x27a9('0x5c'),JSON['stringify'](_0x39447f));for(_0x481570=0x0;_0x481570<_0x39447f['length'];_0x481570+=0x1){_0x259b29=_0x39447f[_0x481570][_0x27a9('0x55')]();if(_0x596a9d){logger[_0x27a9('0x10')](JSON[_0x27a9('0x27')](_0x3000d[_0x259b29]));BPromise['resolve']()['then'](handleJob(_0x3000d[_0x259b29]));logger[_0x27a9('0x10')]('run\x20job',_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}else if(_0x3000d[_0x259b29][_0x27a9('0x5d')]&&_0x3000d[_0x259b29][_0x27a9('0x5e')]&&moment()['isBetween'](_0x3000d[_0x259b29][_0x27a9('0x5f')],_0x3000d[_0x259b29][_0x27a9('0x60')])){manager['add'](_0x259b29,_0x3000d[_0x259b29][_0x27a9('0x5d')],handleJob(_0x3000d[_0x259b29]));manager[_0x27a9('0x61')](_0x259b29);logger['info'](_0x27a9('0x62'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}else if(manager[_0x27a9('0x59')](_0x259b29)){manager['stop'](_0x259b29);manager[_0x27a9('0x5a')](_0x259b29);logger[_0x27a9('0x10')](_0x27a9('0x63'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29]['cron']);}}for(_0x481570=0x0,_0x259b29;_0x481570<_0x374cf9[_0x27a9('0x58')]&&!_0x596a9d;_0x481570+=0x1){_0x259b29=_0x374cf9[_0x481570][_0x27a9('0x55')]();if(manager[_0x27a9('0x59')](_0x259b29)){if(_0x3000d[_0x259b29][_0x27a9('0x5d')]&&_0x3000d[_0x259b29][_0x27a9('0x5e')]&&moment()['isBetween'](_0x3000d[_0x259b29]['startAt'],_0x3000d[_0x259b29]['endAt'])){manager[_0x27a9('0x64')](_0x259b29,_0x3000d[_0x259b29][_0x27a9('0x5d')],handleJob(_0x3000d[_0x259b29]));logger[_0x27a9('0x10')](_0x27a9('0x65'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}else{manager[_0x27a9('0x3d')](_0x259b29);manager[_0x27a9('0x5a')](_0x259b29);logger[_0x27a9('0x10')](_0x27a9('0x63'),_0x3000d[_0x259b29][_0x27a9('0x19')],_0x3000d[_0x259b29][_0x27a9('0x5d')]);}}}})['catch'](function(_0x1f73f3){logger[_0x27a9('0xf')](JSON[_0x27a9('0x27')](_0x1f73f3));});}exports['run']=function(_0x43a1be){return getJobs(_0x43a1be);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index eb58642..f40443b 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 _0x220b=['transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','Mixed','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','all','aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion'];(function(_0x364bad,_0xa51113){var _0x1153a0=function(_0x41c2ef){while(--_0x41c2ef){_0x364bad['push'](_0x364bad['shift']());}};_0x1153a0(++_0xa51113);}(_0x220b,0x1a2));var _0xb220=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x220b[_0x2c9b79];return _0x265032;};var _=require('lodash');var AWS=require(_0xb220('0x0'));var rp=require(_0xb220('0x1'));var util=require(_0xb220('0x2'));var BPromise=require(_0xb220('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xb220('0x4'))('transcribe');function getTranscriptionJob(_0x1aa3b8,_0x4dc358,_0x124b93,_0x2ff855){return new Promise(function(_0x1d2be4,_0x366a4d){var _0x5d7d19=new AWS[(_0xb220('0x5'))]({'accessKeyId':_0x4dc358,'secretAccessKey':_0x1aa3b8,'region':_0x124b93});_0x5d7d19[_0xb220('0x6')]({'TranscriptionJobName':_0x2ff855},function(_0x5b83b9,_0x12c68c){if(_0x5b83b9){return _0x366a4d(_0x5b83b9);}else{return _0x1d2be4(_0x12c68c);}});});}function sentiment(_0x3697f3,_0x33ae28,_0x2821a6,_0x16edb6,_0x2aaf7c){return new Promise(function(_0x24e6d9,_0x301978){var _0x1f30ee=new AWS['Comprehend']({'accessKeyId':_0x33ae28,'secretAccessKey':_0x3697f3,'region':_0x2821a6});_0x1f30ee[_0xb220('0x7')]({'Text':_0x16edb6,'LanguageCode':_0x2aaf7c[_0xb220('0x8')](0x0,0x2)},function(_0x5b39d5,_0x5c9af1){if(_0x5b39d5){return _0x301978(_0x5b39d5);}else{return _0x24e6d9(_0x5c9af1);}});});}function checkTranscribeJob(_0x4e6ba7,_0x528ce0,_0x59ef3e){var _0x11229c;return new BPromise(function(_0x573971,_0x3c310c){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0xb'),_0x4e6ba7['id'],_0x4e6ba7['transcribeName']));return getTranscriptionJob(_0x59ef3e['data1'],_0x59ef3e[_0xb220('0xc')],_0x528ce0[_0xb220('0xd')],_0x4e6ba7[_0xb220('0xe')])[_0xb220('0xf')](function(_0x16a34b){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x10'),_0x4e6ba7['id'],_0x4e6ba7[_0xb220('0xe')],_0x16a34b[_0xb220('0x11')][_0xb220('0x12')]));if(!_0x4e6ba7[_0xb220('0x13')]){switch(_0x16a34b[_0xb220('0x11')][_0xb220('0x12')]){case _0xb220('0x14'):var _0xe10309={'transcribeStatus':_0x16a34b[_0xb220('0x11')][_0xb220('0x12')],'fileUri':_0x16a34b[_0xb220('0x11')][_0xb220('0x15')][_0xb220('0x16')]};logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x17'),_0x4e6ba7['id']));return rp({'uri':_0x16a34b['TranscriptionJob'][_0xb220('0x15')]['TranscriptFileUri'],'json':!![]})[_0xb220('0xf')](function(_0x5c4d46){logger[_0xb220('0x9')](util['format'](_0xb220('0x18'),_0x4e6ba7['id']));if(_0x5c4d46&&_0x5c4d46[_0xb220('0x19')]&&_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')]&&_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')]['length']){_0xe10309[_0xb220('0x13')]='';for(var _0x108450=0x0;_0x108450<_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')][_0xb220('0x1b')];_0x108450++){_0xe10309['fileText']+=_0x5c4d46[_0xb220('0x19')][_0xb220('0x1a')][_0x108450]['transcript']+'';}}return _0x4e6ba7[_0xb220('0x1c')](_0xe10309);})[_0xb220('0xf')](function(){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x1d'),_0x4e6ba7['id']));if(!_0x4e6ba7[_0xb220('0x1e')]){throw new db['Sequelize'][(_0xb220('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x528ce0['sentiment']||!_0x528ce0[_0xb220('0x20')]||!_0x528ce0[_0xb220('0x21')]||!_0x528ce0[_0xb220('0x22')]||!_0x528ce0[_0xb220('0x23')]){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x25'));}if(!_0xe10309[_0xb220('0x13')]){throw new Error(_0xb220('0x26'));}if(_0x528ce0[_0xb220('0x20')]===_0x59ef3e['id']){return _0x59ef3e;}else{return db['CloudProvider'][_0xb220('0x27')]({'where':{'id':_settings[_0xb220('0x20')]}});}})[_0xb220('0xf')](function(_0x5edd84){if(!_0x5edd84){throw new db['Sequelize'][(_0xb220('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5edd84['data1']||!_0x5edd84['data2']){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x28'));}_0x11229c=_0x5edd84;logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x29'),_0x4e6ba7['id']));return sentiment(_0x11229c['data1'],_0x11229c['data2'],_0x528ce0[_0xb220('0x21')],_0xe10309[_0xb220('0x13')],_0x528ce0['language']);})[_0xb220('0xf')](function(_0x4d855d){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x2a'),_0x4e6ba7['id']));return _0x4e6ba7[_0xb220('0x1c')]({'sentiment':_0x4d855d[_0xb220('0x2b')],'sPositive':_0x4d855d['SentimentScore']['Positive'],'sNegative':_0x4d855d['SentimentScore'][_0xb220('0x2c')],'sMixed':_0x4d855d['SentimentScore'][_0xb220('0x2d')],'sNeutral':_0x4d855d[_0xb220('0x2e')][_0xb220('0x2f')]});})['then'](function(){logger['info'](util[_0xb220('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e6ba7['id']));_0x573971();});case _0xb220('0x30'):return _0x4e6ba7[_0xb220('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x16a34b[_0xb220('0x11')][_0xb220('0x31')]})[_0xb220('0xf')](function(){logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x1d'),_0x4e6ba7['id']));_0x573971();});default:logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x32'),_0x4e6ba7['id']));break;}}else{return BPromise[_0xb220('0x33')]()[_0xb220('0xf')](function(){if(!_0x4e6ba7[_0xb220('0x1e')]){throw new db[(_0xb220('0x24'))]['ValidationError'](_0xb220('0x34'));}if(!_0x528ce0[_0xb220('0x35')]||!_0x528ce0[_0xb220('0x20')]||!_0x528ce0[_0xb220('0x21')]||!_0x528ce0[_0xb220('0x22')]||!_0x528ce0['bucket']){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x25'));}if(!_0x4e6ba7[_0xb220('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x528ce0['sentimentAccountId']===_0x59ef3e['id']){return _0x59ef3e;}else{return db[_0xb220('0x36')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xb220('0xf')](function(_0x5dc84b){if(!_0x5dc84b){throw new db['Sequelize'][(_0xb220('0x1f'))](_0xb220('0x37'));}if(!_0x5dc84b[_0xb220('0x38')]||!_0x5dc84b[_0xb220('0xc')]){throw new db[(_0xb220('0x24'))]['ValidationError'](_0xb220('0x28'));}_0x11229c=_0x5dc84b;logger[_0xb220('0x9')](util[_0xb220('0xa')](_0xb220('0x29'),_0x4e6ba7['id']));return sentiment(_0x11229c[_0xb220('0x38')],_0x11229c[_0xb220('0xc')],_0x528ce0[_0xb220('0x21')],_0x4e6ba7[_0xb220('0x13')],_0x528ce0[_0xb220('0x22')]);})['then'](function(_0x494089){logger['info'](util[_0xb220('0xa')](_0xb220('0x2a'),_0x4e6ba7['id']));return _0x4e6ba7[_0xb220('0x1c')]({'sentiment':_0x494089[_0xb220('0x2b')],'sPositive':_0x494089[_0xb220('0x2e')][_0xb220('0x39')],'sNegative':_0x494089[_0xb220('0x2e')][_0xb220('0x2c')],'sMixed':_0x494089[_0xb220('0x2e')][_0xb220('0x2d')],'sNeutral':_0x494089[_0xb220('0x2e')][_0xb220('0x2f')],'transcribeStatus':_0xb220('0x14')});})['then'](function(){logger[_0xb220('0x9')](util[_0xb220('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e6ba7['id']));_0x573971();});}})[_0xb220('0x3a')](function(_0x431af1){if(_0x431af1){if(!_0x431af1[_0xb220('0x3b')]||_0x431af1[_0xb220('0x3b')]!==_0xb220('0x3c')){logger[_0xb220('0x3d')](util[_0xb220('0xa')](_0xb220('0x3e'),_0x4e6ba7['id']),util[_0xb220('0x3f')](_0x431af1,{'showHidden':![],'depth':null}));}}_0x573971();});});}function checkTranscribe(){var _0x124901;var _0x4b50d3;var _0x56fb72;return db['VoiceRecording'][_0xb220('0x40')]({'where':{'transcribeStatus':_0xb220('0x41')}})[_0xb220('0xf')](function(_0x375d14){if(!_0x375d14||!_0x375d14['length']){throw new db['Sequelize'][(_0xb220('0x1f'))](_0xb220('0x42'));}_0x124901=_0x375d14;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xb220('0xf')](function(_0x5ef174){if(!_0x5ef174){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x43'));}_0x4b50d3=_0x5ef174;if(!_0x4b50d3[_0xb220('0x44')]||!_0x4b50d3[_0xb220('0x45')]||!_0x4b50d3[_0xb220('0xd')]||!_0x4b50d3['language']||!_0x4b50d3[_0xb220('0x23')]){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x46'));}return db[_0xb220('0x36')][_0xb220('0x27')]({'where':{'id':_0x4b50d3['transcribeAccountId']}});})['then'](function(_0x179cc5){if(!_0x179cc5){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x37'));}if(!_0x179cc5[_0xb220('0x38')]||!_0x179cc5[_0xb220('0xc')]){throw new db[(_0xb220('0x24'))][(_0xb220('0x1f'))](_0xb220('0x28'));}_0x56fb72=_0x179cc5;var _0x212521=[];_0x124901['forEach'](function(_0x1c5065){_0x212521['push'](checkTranscribeJob(_0x1c5065,_0x4b50d3,_0x56fb72));});return BPromise[_0xb220('0x47')](_0x212521);})[_0xb220('0x3a')](function(_0x139c69){if(_0x139c69){if(!_0x139c69[_0xb220('0x3b')]||_0x139c69[_0xb220('0x3b')]!==_0xb220('0x3c')){logger[_0xb220('0x3d')](util['inspect'](_0x139c69,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8d08=['bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','substring','transcribeName','data1','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','info','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','push','all','catch','start','lodash','aws-sdk','request-promise','util'];(function(_0x546678,_0x3d6285){var _0x108013=function(_0x3c845d){while(--_0x3c845d){_0x546678['push'](_0x546678['shift']());}};_0x108013(++_0x3d6285);}(_0x8d08,0x118));var _0x88d0=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0x8d08[_0x513f27];return _0xa316b7;};var _=require(_0x88d0('0x0'));var AWS=require(_0x88d0('0x1'));var rp=require(_0x88d0('0x2'));var util=require(_0x88d0('0x3'));var BPromise=require(_0x88d0('0x4'));var db=require(_0x88d0('0x5'))['db'];var logger=require(_0x88d0('0x6'))(_0x88d0('0x7'));function getTranscriptionJob(_0x3209a7,_0x7e0c16,_0x234e58,_0x47341c){return new Promise(function(_0x560c5b,_0x9897ca){var _0x14eafb=new AWS['TranscribeService']({'accessKeyId':_0x7e0c16,'secretAccessKey':_0x3209a7,'region':_0x234e58});_0x14eafb[_0x88d0('0x8')]({'TranscriptionJobName':_0x47341c},function(_0x511c4a,_0x473151){if(_0x511c4a){return _0x9897ca(_0x511c4a);}else{return _0x560c5b(_0x473151);}});});}function sentiment(_0x5c3aa7,_0x29f12e,_0x2fb116,_0x2c1e83,_0x48ad20){return new Promise(function(_0x36ec26,_0x35f14c){var _0x5307e8=new AWS[(_0x88d0('0x9'))]({'accessKeyId':_0x29f12e,'secretAccessKey':_0x5c3aa7,'region':_0x2fb116});_0x5307e8['detectSentiment']({'Text':_0x2c1e83,'LanguageCode':_0x48ad20[_0x88d0('0xa')](0x0,0x2)},function(_0x46b444,_0xfe67d8){if(_0x46b444){return _0x35f14c(_0x46b444);}else{return _0x36ec26(_0xfe67d8);}});});}function checkTranscribeJob(_0x592703,_0x5de471,_0x5da161){var _0x2854a5;return new BPromise(function(_0xacee29,_0x233d96){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x592703['id'],_0x592703[_0x88d0('0xb')]));return getTranscriptionJob(_0x5da161[_0x88d0('0xc')],_0x5da161['data2'],_0x5de471[_0x88d0('0xd')],_0x592703[_0x88d0('0xb')])[_0x88d0('0xe')](function(_0x37083a){logger['info'](util[_0x88d0('0xf')](_0x88d0('0x10'),_0x592703['id'],_0x592703[_0x88d0('0xb')],_0x37083a[_0x88d0('0x11')]['TranscriptionJobStatus']));if(!_0x592703[_0x88d0('0x12')]){switch(_0x37083a[_0x88d0('0x11')]['TranscriptionJobStatus']){case _0x88d0('0x13'):var _0x3cc775={'transcribeStatus':_0x37083a['TranscriptionJob'][_0x88d0('0x14')],'fileUri':_0x37083a['TranscriptionJob'][_0x88d0('0x15')][_0x88d0('0x16')]};logger['info'](util[_0x88d0('0xf')](_0x88d0('0x17'),_0x592703['id']));return rp({'uri':_0x37083a[_0x88d0('0x11')][_0x88d0('0x15')]['TranscriptFileUri'],'json':!![]})[_0x88d0('0xe')](function(_0xbeb2f9){logger[_0x88d0('0x18')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x592703['id']));if(_0xbeb2f9&&_0xbeb2f9[_0x88d0('0x19')]&&_0xbeb2f9[_0x88d0('0x19')][_0x88d0('0x1a')]&&_0xbeb2f9[_0x88d0('0x19')][_0x88d0('0x1a')][_0x88d0('0x1b')]){_0x3cc775[_0x88d0('0x12')]='';for(var _0x16cd98=0x0;_0x16cd98<_0xbeb2f9[_0x88d0('0x19')]['transcripts'][_0x88d0('0x1b')];_0x16cd98++){_0x3cc775[_0x88d0('0x12')]+=_0xbeb2f9[_0x88d0('0x19')][_0x88d0('0x1a')][_0x16cd98][_0x88d0('0x1c')]+'';}}return _0x592703[_0x88d0('0x1d')](_0x3cc775);})['then'](function(){logger['info'](util[_0x88d0('0xf')](_0x88d0('0x1e'),_0x592703['id']));if(!_0x592703[_0x88d0('0x1f')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x22'));}if(!_0x5de471[_0x88d0('0x23')]||!_0x5de471['sentimentAccountId']||!_0x5de471[_0x88d0('0x24')]||!_0x5de471[_0x88d0('0x25')]||!_0x5de471[_0x88d0('0x26')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x27'));}if(!_0x3cc775[_0x88d0('0x12')]){throw new Error(_0x88d0('0x28'));}if(_0x5de471[_0x88d0('0x29')]===_0x5da161['id']){return _0x5da161;}else{return db[_0x88d0('0x2a')][_0x88d0('0x2b')]({'where':{'id':_settings[_0x88d0('0x29')]}});}})[_0x88d0('0xe')](function(_0x133fce){if(!_0x133fce){throw new db['Sequelize'][(_0x88d0('0x21'))](_0x88d0('0x2c'));}if(!_0x133fce[_0x88d0('0xc')]||!_0x133fce[_0x88d0('0x2d')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x2e'));}_0x2854a5=_0x133fce;logger[_0x88d0('0x18')](util[_0x88d0('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x592703['id']));return sentiment(_0x2854a5[_0x88d0('0xc')],_0x2854a5[_0x88d0('0x2d')],_0x5de471[_0x88d0('0x24')],_0x3cc775[_0x88d0('0x12')],_0x5de471[_0x88d0('0x25')]);})['then'](function(_0x429e30){logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x2f'),_0x592703['id']));return _0x592703[_0x88d0('0x1d')]({'sentiment':_0x429e30[_0x88d0('0x30')],'sPositive':_0x429e30[_0x88d0('0x31')][_0x88d0('0x32')],'sNegative':_0x429e30[_0x88d0('0x31')][_0x88d0('0x33')],'sMixed':_0x429e30[_0x88d0('0x31')][_0x88d0('0x34')],'sNeutral':_0x429e30[_0x88d0('0x31')][_0x88d0('0x35')]});})['then'](function(){logger[_0x88d0('0x18')](util['format'](_0x88d0('0x1e'),_0x592703['id']));_0xacee29();});case'FAILED':return _0x592703[_0x88d0('0x1d')]({'transcribeStatus':_0x88d0('0x36'),'failureReason':_0x37083a[_0x88d0('0x11')]['FailureReason']})[_0x88d0('0xe')](function(){logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x1e'),_0x592703['id']));_0xacee29();});default:logger[_0x88d0('0x18')](util['format'](_0x88d0('0x37'),_0x592703['id']));break;}}else{return BPromise[_0x88d0('0x38')]()[_0x88d0('0xe')](function(){if(!_0x592703[_0x88d0('0x1f')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5de471[_0x88d0('0x23')]||!_0x5de471['sentimentAccountId']||!_0x5de471[_0x88d0('0x24')]||!_0x5de471['language']||!_0x5de471[_0x88d0('0x26')]){throw new db['Sequelize'][(_0x88d0('0x21'))](_0x88d0('0x27'));}if(!_0x592703[_0x88d0('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x5de471[_0x88d0('0x29')]===_0x5da161['id']){return _0x5da161;}else{return db[_0x88d0('0x2a')][_0x88d0('0x2b')]({'where':{'id':_settings[_0x88d0('0x29')]}});}})[_0x88d0('0xe')](function(_0x48e853){if(!_0x48e853){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x2c'));}if(!_0x48e853[_0x88d0('0xc')]||!_0x48e853[_0x88d0('0x2d')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x2e'));}_0x2854a5=_0x48e853;logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x39'),_0x592703['id']));return sentiment(_0x2854a5['data1'],_0x2854a5[_0x88d0('0x2d')],_0x5de471['sentimentRegion'],_0x592703[_0x88d0('0x12')],_0x5de471['language']);})[_0x88d0('0xe')](function(_0x1543da){logger['info'](util[_0x88d0('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x592703['id']));return _0x592703[_0x88d0('0x1d')]({'sentiment':_0x1543da['Sentiment'],'sPositive':_0x1543da[_0x88d0('0x31')][_0x88d0('0x32')],'sNegative':_0x1543da['SentimentScore'][_0x88d0('0x33')],'sMixed':_0x1543da[_0x88d0('0x31')]['Mixed'],'sNeutral':_0x1543da[_0x88d0('0x31')]['Neutral'],'transcribeStatus':_0x88d0('0x13')});})['then'](function(){logger[_0x88d0('0x18')](util[_0x88d0('0xf')](_0x88d0('0x1e'),_0x592703['id']));_0xacee29();});}})['catch'](function(_0x54e4f5){if(_0x54e4f5){if(!_0x54e4f5[_0x88d0('0x3a')]||_0x54e4f5[_0x88d0('0x3a')]!==_0x88d0('0x3b')){logger[_0x88d0('0x3c')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x592703['id']),util[_0x88d0('0x3d')](_0x54e4f5,{'showHidden':![],'depth':null}));}}_0xacee29();});});}function checkTranscribe(){var _0x1f043f;var _0x436100;var _0x353ecb;return db[_0x88d0('0x3e')][_0x88d0('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3ed26b){if(!_0x3ed26b||!_0x3ed26b['length']){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x40'));}_0x1f043f=_0x3ed26b;return db['Setting'][_0x88d0('0x2b')]({'where':{'id':0x1}});})[_0x88d0('0xe')](function(_0x3700b0){if(!_0x3700b0){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))]('Settings\x20not\x20available');}_0x436100=_0x3700b0;if(!_0x436100[_0x88d0('0x7')]||!_0x436100[_0x88d0('0x41')]||!_0x436100[_0x88d0('0xd')]||!_0x436100[_0x88d0('0x25')]||!_0x436100[_0x88d0('0x26')]){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))](_0x88d0('0x42'));}return db[_0x88d0('0x2a')][_0x88d0('0x2b')]({'where':{'id':_0x436100[_0x88d0('0x41')]}});})[_0x88d0('0xe')](function(_0x34abf7){if(!_0x34abf7){throw new db[(_0x88d0('0x20'))][(_0x88d0('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x34abf7['data1']||!_0x34abf7[_0x88d0('0x2d')]){throw new db['Sequelize'][(_0x88d0('0x21'))](_0x88d0('0x2e'));}_0x353ecb=_0x34abf7;var _0x33cc41=[];_0x1f043f['forEach'](function(_0x32ffc3){_0x33cc41[_0x88d0('0x43')](checkTranscribeJob(_0x32ffc3,_0x436100,_0x353ecb));});return BPromise[_0x88d0('0x44')](_0x33cc41);})[_0x88d0('0x45')](function(_0x206aad){if(_0x206aad){if(!_0x206aad['name']||_0x206aad[_0x88d0('0x3a')]!==_0x88d0('0x3b')){logger[_0x88d0('0x3c')](util['inspect'](_0x206aad,{'showHidden':![],'depth':null}));}}});}exports[_0x88d0('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index fd3da8f..81dca02 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 _0xc731=['WhatsappInteraction','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0xdef646,_0xc790bc){var _0x245ef3=function(_0x57d1ba){while(--_0x57d1ba){_0xdef646['push'](_0xdef646['shift']());}};_0x245ef3(++_0xc790bc);}(_0xc731,0x1e6));var _0x1c73=function(_0x3b31ad,_0x5c016d){_0x3b31ad=_0x3b31ad-0x0;var _0x5d6986=_0xc731[_0x3b31ad];return _0x5d6986;};'use strict';var _=require(_0x1c73('0x0'));var moment=require(_0x1c73('0x1'));var Redis=require('ioredis');var util=require(_0x1c73('0x2'));var config=require(_0x1c73('0x3'));var db=require(_0x1c73('0x4'))['db'];var logger=require('../logger')(_0x1c73('0x5'));config['redis']=_[_0x1c73('0x6')](config[_0x1c73('0x7')],{'host':_0x1c73('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c73('0x7')]));function closeInteractions(){var _0xb0a620=[];return db['WhatsappInteraction'][_0x1c73('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1c73('0xa')](0x18,_0x1c73('0xb'))}}})[_0x1c73('0xc')](function(_0x1bfa81){if(_0x1bfa81&&_0x1bfa81[_0x1c73('0xd')]){_0xb0a620=_[_0x1c73('0xe')](_0x1bfa81||[],'id');logger[_0x1c73('0xf')](_0x1c73('0x10'),_0xb0a620[_0x1c73('0x11')]());return db[_0x1c73('0x12')][_0x1c73('0x13')]({'closeReason':_0x1c73('0x14'),'disposition':_0x1c73('0x15'),'closed':!![],'closedAt':moment()[_0x1c73('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xb0a620}});}})['then'](function(){if(_0xb0a620&&_0xb0a620[_0x1c73('0xd')]){logger[_0x1c73('0xf')](_0x1c73('0x17'),_0xb0a620[_0x1c73('0x11')]());for(var _0x6ec87=0x0;_0x6ec87<_0xb0a620[_0x1c73('0xd')];_0x6ec87++){io[_0x1c73('0x18')](_0x1c73('0x19'),{'id':_0xb0a620[_0x6ec87],'closed':!![]});}}})['catch'](function(_0x2d756f){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2d756f?util[_0x1c73('0x1a')](_0x2d756f,{'showHidden':![],'depth':null}):'');});}exports[_0x1c73('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9133=['ioredis','util','../../config/environment','../../mysqldb','redis','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','length','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment'];(function(_0x1a34f9,_0x5c8961){var _0x2ae688=function(_0x1f4a2a){while(--_0x1f4a2a){_0x1a34f9['push'](_0x1a34f9['shift']());}};_0x2ae688(++_0x5c8961);}(_0x9133,0x178));var _0x3913=function(_0x234514,_0x3f077d){_0x234514=_0x234514-0x0;var _0x16c5a2=_0x9133[_0x234514];return _0x16c5a2;};'use strict';var _=require(_0x3913('0x0'));var moment=require(_0x3913('0x1'));var Redis=require(_0x3913('0x2'));var util=require(_0x3913('0x3'));var config=require(_0x3913('0x4'));var db=require(_0x3913('0x5'))['db'];var logger=require('../logger')('schedule');config[_0x3913('0x6')]=_['defaults'](config[_0x3913('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3913('0x6')]));function closeInteractions(){var _0x351e11=[];return db['WhatsappInteraction'][_0x3913('0x7')]({'raw':!![],'attributes':['id',_0x3913('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3913('0x9')](0x18,_0x3913('0xa'))}}})[_0x3913('0xb')](function(_0x5cad68){if(_0x5cad68&&_0x5cad68['length']){_0x351e11=_[_0x3913('0xc')](_0x5cad68||[],'id');logger[_0x3913('0xd')](_0x3913('0xe'),_0x351e11[_0x3913('0xf')]());return db[_0x3913('0x10')][_0x3913('0x11')]({'closeReason':_0x3913('0x12'),'disposition':_0x3913('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x351e11}});}})[_0x3913('0xb')](function(){if(_0x351e11&&_0x351e11[_0x3913('0x14')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x351e11[_0x3913('0xf')]());for(var _0x37cf63=0x0;_0x37cf63<_0x351e11[_0x3913('0x14')];_0x37cf63++){io[_0x3913('0x15')](_0x3913('0x16'),{'id':_0x351e11[_0x37cf63],'closed':!![]});}}})[_0x3913('0x17')](function(_0x1f8a8f){logger[_0x3913('0x18')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x1f8a8f?util[_0x3913('0x19')](_0x1f8a8f,{'showHidden':![],'depth':null}):'');});}exports[_0x3913('0x1a')]=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 512114b..59b293c 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8409=['now','@xcally.com','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x3a5c9c,_0x5040d1){var _0x32dec7=function(_0x70eced){while(--_0x70eced){_0x3a5c9c['push'](_0x3a5c9c['shift']());}};_0x32dec7(++_0x5040d1);}(_0x8409,0x199));var _0x9840=function(_0x236209,_0x51b840){_0x236209=_0x236209-0x0;var _0x2afd5b=_0x8409[_0x236209];return _0x2afd5b;};'use strict';var util=require(_0x9840('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9840('0x1')]({'id':i,'firstName':_0x9840('0x2')+i,'lastName':_0x9840('0x3')+i,'phone':0xf879fb460+i,'email':_0x9840('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9840('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9840('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x9840('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9840('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9840('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9840('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9840('0x5')](),'updatedAt':Date[_0x9840('0x5')]()});}db[_0x9840('0x7')][_0x9840('0x8')]({'where':{}})[_0x9840('0x9')](function(){return db[_0x9840('0x7')]['bulkCreate'](contacts);})[_0x9840('0x9')](function(){console[_0x9840('0xa')](_0x9840('0xb'),_0x9840('0xc'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0x9840('0xd')][_0x9840('0xe')](hopper);})['then'](function(){console['log'](_0x9840('0xb'),_0x9840('0xf'));return db[_0x9840('0x7')][_0x9840('0xe')](contacts2);})[_0x9840('0x9')](function(){console['log'](_0x9840('0xb'),_0x9840('0x10'));return db[_0x9840('0xd')][_0x9840('0xe')](hopper2);})[_0x9840('0x9')](function(){console[_0x9840('0xa')](_0x9840('0xb'),'hopper2');})[_0x9840('0x11')](function(_0x1c6233){console[_0x9840('0xa')](_0x1c6233);}); \ No newline at end of file +var _0x8246=['bulkCreate','hopper1','hopper2','catch','util','Innocenzo','Biondo','@xcally.com','push','now','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x8246,0x100));var _0x6824=function(_0x5b7425,_0x5be822){_0x5b7425=_0x5b7425-0x0;var _0xdfe51e=_0x8246[_0x5b7425];return _0xdfe51e;};'use strict';var util=require(_0x6824('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x6824('0x1')+i,'lastName':_0x6824('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x6824('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6824('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x6824('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x6824('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x6824('0x1')+i,'lastName':_0x6824('0x2')+i,'phone':0xf879fb460+i,'email':_0x6824('0x6')+i+_0x6824('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x6824('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x6824('0x5')]()});}db[_0x6824('0x7')][_0x6824('0x8')]({'where':{}})[_0x6824('0x9')](function(){return db[_0x6824('0x7')]['bulkCreate'](contacts);})[_0x6824('0x9')](function(){console[_0x6824('0xa')](_0x6824('0xb'),_0x6824('0xc'));return db[_0x6824('0xd')]['destroy']({'where':{}});})[_0x6824('0x9')](function(){return db[_0x6824('0xd')][_0x6824('0xe')](hopper);})[_0x6824('0x9')](function(){console[_0x6824('0xa')](_0x6824('0xb'),_0x6824('0xf'));return db[_0x6824('0x7')][_0x6824('0xe')](contacts2);})[_0x6824('0x9')](function(){console['log']('finished\x20populating','contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0x6824('0x9')](function(){console[_0x6824('0xa')]('finished\x20populating',_0x6824('0x10'));})[_0x6824('0x11')](function(_0xd806ec){console[_0x6824('0xa')](_0xd806ec);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 6baf19d..dc1f962 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3ff=['wss','all','agent','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','add\x20user','log','util','../mysqldb','push','format','%s%s','%s%s@xcally.com','password','friend','udp'];(function(_0x44d1c0,_0x492f77){var _0x53ed87=function(_0x158a81){while(--_0x158a81){_0x44d1c0['push'](_0x44d1c0['shift']());}};_0x53ed87(++_0x492f77);}(_0xb3ff,0x15f));var _0xfb3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3ff[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xfb3f('0x0'));var db=require(_0xfb3f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xfb3f('0x2')]({'name':util[_0xfb3f('0x3')](_0xfb3f('0x4'),'agent',i),'fullname':util[_0xfb3f('0x3')](_0xfb3f('0x4'),'agent',i),'email':util[_0xfb3f('0x3')](_0xfb3f('0x5'),'agent',i),'role':'agent','password':_0xfb3f('0x6'),'internal':0xfa0+i,'type':_0xfb3f('0x7'),'transport':[_0xfb3f('0x8'),'ws',_0xfb3f('0x9')],'disallow':[_0xfb3f('0xa')],'allow':['ulaw'],'defaultuser':util[_0xfb3f('0x3')](_0xfb3f('0x4'),_0xfb3f('0xb'),i),'encryption':'yes','avpf':'yes','force_avp':_0xfb3f('0xc'),'icesupport':_0xfb3f('0xc'),'dtlsenable':_0xfb3f('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xfb3f('0xd'),'dtlssetup':_0xfb3f('0xe'),'callerid':util['format'](_0xfb3f('0xf'),util[_0xfb3f('0x3')](_0xfb3f('0x4'),_0xfb3f('0xb'),i),0xfa0+i)});}db[_0xfb3f('0x10')]['bulkCreate'](users)[_0xfb3f('0x11')](function(){console['log'](_0xfb3f('0x12'));})['catch'](function(_0x468f49){console[_0xfb3f('0x13')](_0x468f49);}); \ No newline at end of file +var _0xb386=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x22e777,_0x98b458){var _0x5c469b=function(_0x97e997){while(--_0x97e997){_0x22e777['push'](_0x22e777['shift']());}};_0x5c469b(++_0x98b458);}(_0xb386,0x170));var _0x6b38=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xb386[_0x5ddaac];return _0x2a9c58;};'use strict';var util=require('util');var db=require(_0x6b38('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x6b38('0x1'),_0x6b38('0x2'),i),'fullname':util[_0x6b38('0x3')](_0x6b38('0x1'),'agent',i),'email':util['format'](_0x6b38('0x4'),_0x6b38('0x2'),i),'role':'agent','password':_0x6b38('0x5'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x6b38('0x6')],'disallow':[_0x6b38('0x7')],'allow':[_0x6b38('0x8')],'defaultuser':util[_0x6b38('0x3')](_0x6b38('0x1'),'agent',i),'encryption':_0x6b38('0x9'),'avpf':'yes','force_avp':_0x6b38('0x9'),'icesupport':_0x6b38('0x9'),'dtlsenable':_0x6b38('0x9'),'dtlsverify':'no','dtlscertfile':_0x6b38('0xa'),'dtlsprivatekey':_0x6b38('0xb'),'dtlssetup':_0x6b38('0xc'),'callerid':util['format'](_0x6b38('0xd'),util[_0x6b38('0x3')](_0x6b38('0x1'),_0x6b38('0x2'),i),0xfa0+i)});}db[_0x6b38('0xe')][_0x6b38('0xf')](users)[_0x6b38('0x10')](function(){console['log'](_0x6b38('0x11'));})[_0x6b38('0x12')](function(_0xa5a4cd){console[_0x6b38('0x13')](_0xa5a4cd);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d275b25..799719a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1d4=['Trunks','UserProfileResource','map','role','Campaign','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteractions','then','format','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueue','FaxQueue','SmsQueues','WhatsappQueues','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','connection','request','remotePort','connectedAt','SocketIO\x20','address','disconnect','DISCONNECTED','lodash','bluebird','./environment','name','User','telephone','agent','type','ivr','findOne','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','findAll','Telephones'];(function(_0x91dc26,_0x37be23){var _0x2ffcb1=function(_0x219cca){while(--_0x219cca){_0x91dc26['push'](_0x91dc26['shift']());}};_0x2ffcb1(++_0x37be23);}(_0xf1d4,0x158));var _0x4f1d=function(_0x803493,_0x76ae83){_0x803493=_0x803493-0x0;var _0x59c118=_0xf1d4[_0x803493];return _0x59c118;};'use strict';var _=require(_0x4f1d('0x0'));var util=require('util');var BPromise=require(_0x4f1d('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x4f1d('0x2'));var queryQueues={'attributes':['id',_0x4f1d('0x3')],'include':[{'as':'Agents','model':db[_0x4f1d('0x4')],'attributes':['id',_0x4f1d('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4f1d('0x3')],'where':{'role':_0x4f1d('0x5')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x4f1d('0x3')],'where':{'role':_0x4f1d('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4f1d('0x3'),_0x4f1d('0x7')],'where':{'type':_0x4f1d('0x8')}};function getAssociatedResources(_0x24c3a3,_0x27f368,_0x47df2f){return db['UserProfileSection'][_0x4f1d('0x9')]({'where':{'name':_0x24c3a3,'userProfileId':_0x27f368},'raw':!![]})['then'](function(_0xe0b6fe){if(_0xe0b6fe){if(_0xe0b6fe[_0x4f1d('0xa')]){switch(_0x24c3a3){case'VoiceQueues':case _0x4f1d('0xb'):case _0x4f1d('0xc'):case'SmsQueues':case'MailQueues':case _0x4f1d('0xd'):case'WhatsappQueues':return db[_0x47df2f][_0x4f1d('0xe')](queryQueues);case _0x4f1d('0xf'):return db[_0x47df2f][_0x4f1d('0xe')](queryTelephones);case _0x4f1d('0x10'):return db[_0x47df2f][_0x4f1d('0xe')](queryTrunks);case'IvrCampaigns':return db[_0x47df2f]['findAll'](queryCampaigns);}}else{return db[_0x4f1d('0x11')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0xe0b6fe['id']},'raw':!![]})['then'](function(_0x115f7f){if(_0x115f7f){var _0x5081e3={'where':{'id':_[_0x4f1d('0x12')](_0x115f7f,'resourceId')},'raw':!![]};switch(_0x47df2f){case _0x4f1d('0x4'):_0x5081e3['where'][_0x4f1d('0x13')]=_0x4f1d('0x5');break;case _0x4f1d('0x14'):_0x5081e3['where'][_0x4f1d('0x7')]=_0x4f1d('0x8');break;}return db[_0x47df2f][_0x4f1d('0xe')](_0x5081e3);}else{return[];}});}}else{return[];}})['then'](function(_0x218d12){return _0x218d12;});}function joinOrLeaveQueues(_0x57bee9,_0x1b45c5,_0x56634c,_0x62b4f6){_0x57bee9[_0x1b45c5](util['format'](_0x4f1d('0x15'),_0x56634c,_0x62b4f6[_0x4f1d('0x3')]));if(_0x62b4f6[_0x4f1d('0x16')]){for(var _0x2775b7=0x0;_0x2775b7<_0x62b4f6[_0x4f1d('0x16')][_0x4f1d('0x17')];_0x2775b7+=0x1){_0x57bee9[_0x1b45c5](util['format'](_0x4f1d('0x18'),_0x62b4f6[_0x4f1d('0x16')][_0x2775b7][_0x4f1d('0x3')]));}}}function joinOrLeave(_0xbe98,_0x53ead6,_0x17b47b){var _0x1d00bf;if(_0xbe98['handshake'][_0x4f1d('0x19')]['id']){db[_0x4f1d('0x4')][_0x4f1d('0x1a')]({'attributes':['id',_0x4f1d('0x3'),_0x4f1d('0x13'),_0x4f1d('0x1b')],'where':{'id':_0xbe98['handshake'][_0x4f1d('0x19')]['id']},'include':[{'model':db[_0x4f1d('0x1c')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4f1d('0x1d'),'attributes':['id'],'raw':!![]},{'model':db[_0x4f1d('0x1e')],'as':_0x4f1d('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x4f1d('0x20')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4f1d('0x21')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x4f1d('0x22'),'attributes':['id'],'raw':!![]}]})[_0x4f1d('0x23')](function(_0x4eabb0){if(_0x4eabb0){_0x1d00bf=_0x4eabb0;_0xbe98[_0x53ead6](util[_0x4f1d('0x24')]('user:%s',_0x4eabb0['name']));var _0x16ba23=[];switch(_0x4eabb0[_0x4f1d('0x13')]){case _0x4f1d('0x25'):_0xbe98[_0x53ead6](_0x4f1d('0x26'));_0xbe98[_0x53ead6](_0x4f1d('0x27'));if(queryQueues[_0x4f1d('0x28')](_0x4f1d('0x29'))){delete queryQueues[_0x4f1d('0x29')];}_0x16ba23['push'](db[_0x4f1d('0x2a')][_0x4f1d('0xe')](queryQueues));_0x16ba23[_0x4f1d('0x2b')](db['ChatQueue'][_0x4f1d('0xe')](queryQueues));_0x16ba23[_0x4f1d('0x2b')](db['FaxQueue']['findAll'](queryQueues));_0x16ba23[_0x4f1d('0x2b')](db[_0x4f1d('0x2c')][_0x4f1d('0xe')](queryQueues));_0x16ba23['push'](db[_0x4f1d('0x2d')][_0x4f1d('0xe')](queryQueues));_0x16ba23[_0x4f1d('0x2b')](db[_0x4f1d('0x2e')][_0x4f1d('0xe')](queryQueues));_0x16ba23['push'](db[_0x4f1d('0x2f')]['findAll'](queryQueues));_0x16ba23['push'](db[_0x4f1d('0x4')][_0x4f1d('0xe')](queryTelephones));_0x16ba23[_0x4f1d('0x2b')](db[_0x4f1d('0x30')][_0x4f1d('0xe')](queryTrunks));_0x16ba23['push'](db[_0x4f1d('0x14')]['findAll'](queryCampaigns));_0x16ba23[_0x4f1d('0x2b')](db[_0x4f1d('0x4')][_0x4f1d('0xe')](queryAgents));break;case _0x4f1d('0x31'):_0xbe98[_0x53ead6](_0x4f1d('0x26'));_0xbe98[_0x53ead6](_0x4f1d('0x27'));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources('VoiceQueues',_0x4eabb0['userProfileId'],'VoiceQueue'));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources(_0x4f1d('0xb'),_0x4eabb0[_0x4f1d('0x1b')],_0x4f1d('0x32')));_0x16ba23['push'](getAssociatedResources(_0x4f1d('0xc'),_0x4eabb0[_0x4f1d('0x1b')],_0x4f1d('0x33')));_0x16ba23['push'](getAssociatedResources(_0x4f1d('0x34'),_0x4eabb0[_0x4f1d('0x1b')],_0x4f1d('0x2c')));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources('MailQueues',_0x4eabb0['userProfileId'],'MailQueue'));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources(_0x4f1d('0xd'),_0x4eabb0['userProfileId'],'OpenchannelQueue'));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources(_0x4f1d('0x35'),_0x4eabb0[_0x4f1d('0x1b')],_0x4f1d('0x2f')));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources('Telephones',_0x4eabb0[_0x4f1d('0x1b')],'User'));_0x16ba23['push'](getAssociatedResources(_0x4f1d('0x10'),_0x4eabb0['userProfileId'],_0x4f1d('0x30')));_0x16ba23[_0x4f1d('0x2b')](getAssociatedResources(_0x4f1d('0x36'),_0x4eabb0[_0x4f1d('0x1b')],_0x4f1d('0x14')));_0x16ba23[_0x4f1d('0x2b')](db['User']['findAll'](queryAgents));break;case _0x4f1d('0x6'):_0xbe98[_0x53ead6](_0x4f1d('0x26'));_0xbe98[_0x53ead6](_0x4f1d('0x27'));_0x16ba23[_0x4f1d('0x2b')](_0x4eabb0[_0x4f1d('0x37')]({'attributes':['id',_0x4f1d('0x3')]}));_0x16ba23[_0x4f1d('0x2b')](_0x4eabb0['getChatQueues']({'attributes':['id',_0x4f1d('0x3')]}));_0x16ba23[_0x4f1d('0x2b')](_0x4eabb0[_0x4f1d('0x38')]({'attributes':['id',_0x4f1d('0x3')]}));_0x16ba23[_0x4f1d('0x2b')](_0x4eabb0[_0x4f1d('0x39')]({'attributes':['id',_0x4f1d('0x3')]}));_0x16ba23['push'](_0x4eabb0[_0x4f1d('0x3a')]({'attributes':['id',_0x4f1d('0x3')]}));_0x16ba23[_0x4f1d('0x2b')](_0x4eabb0[_0x4f1d('0x3b')]({'attributes':['id',_0x4f1d('0x3')]}));_0x16ba23[_0x4f1d('0x2b')](_0x4eabb0['getWhatsappQueues']({'attributes':['id',_0x4f1d('0x3')]}));break;}return BPromise['all'](_0x16ba23);}})[_0x4f1d('0x23')](function(_0x5502d6){if(_0x5502d6&&_0x5502d6['length']){for(var _0x2f7dad=0x0;_0x2f7dad<_0x5502d6[_0x4f1d('0x17')];_0x2f7dad+=0x1){for(var _0x810fc6=0x0;_0x810fc6<_0x5502d6[_0x2f7dad][_0x4f1d('0x17')];_0x810fc6+=0x1){switch(_0x2f7dad){case 0x0:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x3c'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x1:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x3d'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x2:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x3e'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x3:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x3f'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x4:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x40'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x5:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x41'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x6:joinOrLeaveQueues(_0xbe98,_0x53ead6,_0x4f1d('0x42'),_0x5502d6[_0x2f7dad][_0x810fc6]);break;case 0x7:if(_0x1d00bf[_0x4f1d('0x13')]!==_0x4f1d('0x6'))_0xbe98[_0x53ead6](util['format']('telephone:%s',_0x5502d6[_0x2f7dad][_0x810fc6][_0x4f1d('0x3')]));break;case 0x8:if(_0x1d00bf[_0x4f1d('0x13')]!==_0x4f1d('0x6'))_0xbe98[_0x53ead6](util['format'](_0x4f1d('0x43'),_0x5502d6[_0x2f7dad][_0x810fc6][_0x4f1d('0x3')]));break;case 0x9:if(_0x1d00bf[_0x4f1d('0x13')]!==_0x4f1d('0x6'))_0xbe98[_0x53ead6](util['format'](_0x4f1d('0x44'),_0x5502d6[_0x2f7dad][_0x810fc6][_0x4f1d('0x7')],_0x5502d6[_0x2f7dad][_0x810fc6][_0x4f1d('0x3')]));break;case 0xa:_0xbe98[_0x53ead6](util[_0x4f1d('0x24')](_0x4f1d('0x18'),_0x5502d6[_0x2f7dad][_0x810fc6]['name']));break;}}}}})[_0x4f1d('0x23')](function(){if(_0x53ead6===_0x4f1d('0x45')){var _0x43525d=_[_0x4f1d('0x12')](_0x1d00bf[_0x4f1d('0x46')],'id');return _0x1d00bf[_0x4f1d('0x47')](_0x43525d)['then'](function(){for(var _0x220ff5=0x0;_0x220ff5<_0x43525d[_0x4f1d('0x17')];_0x220ff5+=0x1){_0x17b47b[_0x4f1d('0x48')](_0x4f1d('0x49'),{'ChatInteractionId':Number(_0x43525d[_0x220ff5]),'UserId':Number(_0x1d00bf['id'])});}});}})['then'](function(){if(_0x53ead6===_0x4f1d('0x45')){var _0x1de008=_[_0x4f1d('0x12')](_0x1d00bf[_0x4f1d('0x1d')],'id');return _0x1d00bf['removeMailInteractions'](_0x1de008)[_0x4f1d('0x23')](function(){for(var _0x18eb59=0x0;_0x18eb59<_0x1de008[_0x4f1d('0x17')];_0x18eb59+=0x1){_0x17b47b[_0x4f1d('0x48')](_0x4f1d('0x4a'),{'MailInteractionId':Number(_0x1de008[_0x18eb59]),'UserId':Number(_0x1d00bf['id'])});}});}})[_0x4f1d('0x23')](function(){if(_0x53ead6===_0x4f1d('0x45')){var _0x3553a5=_['map'](_0x1d00bf[_0x4f1d('0x1f')],'id');return _0x1d00bf[_0x4f1d('0x4b')](_0x3553a5)['then'](function(){for(var _0x8f690d=0x0;_0x8f690d<_0x3553a5[_0x4f1d('0x17')];_0x8f690d+=0x1){_0x17b47b['emit'](_0x4f1d('0x4c'),{'FaxInteractionId':Number(_0x3553a5[_0x8f690d]),'UserId':Number(_0x1d00bf['id'])});}});}})[_0x4f1d('0x23')](function(){if(_0x53ead6===_0x4f1d('0x45')){var _0x57f9ef=_[_0x4f1d('0x12')](_0x1d00bf[_0x4f1d('0x4d')],'id');return _0x1d00bf[_0x4f1d('0x4e')](_0x57f9ef)[_0x4f1d('0x23')](function(){for(var _0x1b99f6=0x0;_0x1b99f6<_0x57f9ef[_0x4f1d('0x17')];_0x1b99f6+=0x1){_0x17b47b['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x57f9ef[_0x1b99f6]),'UserId':Number(_0x1d00bf['id'])});}});}})[_0x4f1d('0x23')](function(){if(_0x53ead6==='leave'){var _0x1252a4=_[_0x4f1d('0x12')](_0x1d00bf['OpenchannelInteractions'],'id');return _0x1d00bf[_0x4f1d('0x4f')](_0x1252a4)['then'](function(){for(var _0x25af64=0x0;_0x25af64<_0x1252a4['length'];_0x25af64+=0x1){_0x17b47b['emit'](_0x4f1d('0x50'),{'OpenchannelInteractionId':Number(_0x1252a4[_0x25af64]),'UserId':Number(_0x1d00bf['id'])});}});}})[_0x4f1d('0x23')](function(){if(_0x53ead6===_0x4f1d('0x45')){var _0x3453d3=_[_0x4f1d('0x12')](_0x1d00bf[_0x4f1d('0x22')],'id');return _0x1d00bf['removeWhatsappInteractions'](_0x3453d3)['then'](function(){for(var _0x39535d=0x0;_0x39535d<_0x3453d3[_0x4f1d('0x17')];_0x39535d+=0x1){_0x17b47b['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3453d3[_0x39535d]),'UserId':Number(_0x1d00bf['id'])});}});}})['catch'](function(_0x3fb623){_0xbe98[_0x4f1d('0x51')](_0x3fb623);});}}function onDisconnect(_0x5574b5,_0x5ad0b1){joinOrLeave(_0x5574b5,_0x4f1d('0x45'),_0x5ad0b1);}function onConnect(_0x31076a){joinOrLeave(_0x31076a,'join');}exports['default']=function(_0x273f1d){_0x273f1d['on'](_0x4f1d('0x52'),function(_0x6059d4){_0x6059d4['setMaxListeners'](0x0);_0x6059d4['address']=_0x6059d4[_0x4f1d('0x53')][_0x4f1d('0x52')]['remoteAddress']+':'+_0x6059d4['request'][_0x4f1d('0x52')][_0x4f1d('0x54')];_0x6059d4[_0x4f1d('0x55')]=new Date();_0x6059d4[_0x4f1d('0x51')]=function(_0x486164){console[_0x4f1d('0x51')](_0x4f1d('0x56')+_0x6059d4['nsp'][_0x4f1d('0x3')]+'['+_0x6059d4[_0x4f1d('0x57')]+']',_0x486164);};_0x6059d4['on'](_0x4f1d('0x58'),function(){onDisconnect(_0x6059d4,_0x273f1d);_0x6059d4['log'](_0x4f1d('0x59'));});onConnect(_0x6059d4);_0x6059d4[_0x4f1d('0x51')]('CONNECTED');});}; \ No newline at end of file +var _0x5ae0=['FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','MailQueue','Telephones','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','map','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','address','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','util','bluebird','./environment','name','User','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','where','role','Campaign','%s:queue:%s','length','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue'];(function(_0x2de1f6,_0x10026a){var _0x38de93=function(_0x103973){while(--_0x103973){_0x2de1f6['push'](_0x2de1f6['shift']());}};_0x38de93(++_0x10026a);}(_0x5ae0,0xf8));var _0x05ae=function(_0x24dc6a,_0x20300e){_0x24dc6a=_0x24dc6a-0x0;var _0x3ad56d=_0x5ae0[_0x24dc6a];return _0x3ad56d;};'use strict';var _=require('lodash');var util=require(_0x05ae('0x0'));var BPromise=require(_0x05ae('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x05ae('0x2'));var queryQueues={'attributes':['id',_0x05ae('0x3')],'include':[{'as':'Agents','model':db[_0x05ae('0x4')],'attributes':['id',_0x05ae('0x3'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x05ae('0x3')],'where':{'role':_0x05ae('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0x05ae('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x05ae('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x05ae('0x3'),_0x05ae('0x7')],'where':{'type':_0x05ae('0x8')}};function getAssociatedResources(_0x315dd9,_0x34e318,_0x38cf72){return db[_0x05ae('0x9')][_0x05ae('0xa')]({'where':{'name':_0x315dd9,'userProfileId':_0x34e318},'raw':!![]})[_0x05ae('0xb')](function(_0x3e0498){if(_0x3e0498){if(_0x3e0498[_0x05ae('0xc')]){switch(_0x315dd9){case _0x05ae('0xd'):case _0x05ae('0xe'):case _0x05ae('0xf'):case _0x05ae('0x10'):case _0x05ae('0x11'):case _0x05ae('0x12'):case _0x05ae('0x13'):return db[_0x38cf72]['findAll'](queryQueues);case'Telephones':return db[_0x38cf72]['findAll'](queryTelephones);case'Trunks':return db[_0x38cf72][_0x05ae('0x14')](queryTrunks);case _0x05ae('0x15'):return db[_0x38cf72][_0x05ae('0x14')](queryCampaigns);}}else{return db[_0x05ae('0x16')][_0x05ae('0x14')]({'attributes':[_0x05ae('0x17')],'where':{'sectionId':_0x3e0498['id']},'raw':!![]})[_0x05ae('0xb')](function(_0x3de84b){if(_0x3de84b){var _0xf8a649={'where':{'id':_['map'](_0x3de84b,_0x05ae('0x17'))},'raw':!![]};switch(_0x38cf72){case _0x05ae('0x4'):_0xf8a649[_0x05ae('0x18')][_0x05ae('0x19')]=_0x05ae('0x5');break;case _0x05ae('0x1a'):_0xf8a649[_0x05ae('0x18')][_0x05ae('0x7')]=_0x05ae('0x8');break;}return db[_0x38cf72]['findAll'](_0xf8a649);}else{return[];}});}}else{return[];}})[_0x05ae('0xb')](function(_0x17ee83){return _0x17ee83;});}function joinOrLeaveQueues(_0x5a6fe6,_0x361bcc,_0x39f0ce,_0x506d50){_0x5a6fe6[_0x361bcc](util['format'](_0x05ae('0x1b'),_0x39f0ce,_0x506d50[_0x05ae('0x3')]));if(_0x506d50['Agents']){for(var _0x84b684=0x0;_0x84b684<_0x506d50['Agents'][_0x05ae('0x1c')];_0x84b684+=0x1){_0x5a6fe6[_0x361bcc](util[_0x05ae('0x1d')](_0x05ae('0x1e'),_0x506d50['Agents'][_0x84b684][_0x05ae('0x3')]));}}}function joinOrLeave(_0x34e275,_0x4961c9,_0x5e6a27){var _0x39d71c;if(_0x34e275['handshake'][_0x05ae('0x1f')]['id']){db[_0x05ae('0x4')][_0x05ae('0x20')]({'attributes':['id','name','role',_0x05ae('0x21')],'where':{'id':_0x34e275[_0x05ae('0x22')][_0x05ae('0x1f')]['id']},'include':[{'model':db[_0x05ae('0x23')],'as':_0x05ae('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x05ae('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x05ae('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x05ae('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x05ae('0x28')],'as':_0x05ae('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x05ae('0x2a')],'as':_0x05ae('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x208c1b){if(_0x208c1b){_0x39d71c=_0x208c1b;_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x1e'),_0x208c1b['name']));var _0x108bd8=[];switch(_0x208c1b[_0x05ae('0x19')]){case _0x05ae('0x2c'):_0x34e275[_0x4961c9](_0x05ae('0x2d'));_0x34e275[_0x4961c9](_0x05ae('0x2e'));if(queryQueues[_0x05ae('0x2f')](_0x05ae('0x30'))){delete queryQueues[_0x05ae('0x30')];}_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x32')][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x33')]['findAll'](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x34')]['findAll'](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x35')][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db['MailQueue'][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x36')][_0x05ae('0x14')](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x37')]['findAll'](queryQueues));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x4')]['findAll'](queryTelephones));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x38')][_0x05ae('0x14')](queryTrunks));_0x108bd8[_0x05ae('0x31')](db[_0x05ae('0x1a')]['findAll'](queryCampaigns));_0x108bd8[_0x05ae('0x31')](db['User']['findAll'](queryAgents));break;case _0x05ae('0x39'):_0x34e275[_0x4961c9](_0x05ae('0x2d'));_0x34e275[_0x4961c9](_0x05ae('0x2e'));_0x108bd8['push'](getAssociatedResources(_0x05ae('0xd'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x32')));_0x108bd8['push'](getAssociatedResources(_0x05ae('0xe'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x33')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('FaxQueues',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x34')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('SmsQueues',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x35')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('MailQueues',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x3a')));_0x108bd8['push'](getAssociatedResources('OpenchannelQueues',_0x208c1b[_0x05ae('0x21')],'OpenchannelQueue'));_0x108bd8[_0x05ae('0x31')](getAssociatedResources(_0x05ae('0x13'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x37')));_0x108bd8['push'](getAssociatedResources(_0x05ae('0x3b'),_0x208c1b[_0x05ae('0x21')],'User'));_0x108bd8['push'](getAssociatedResources(_0x05ae('0x3c'),_0x208c1b[_0x05ae('0x21')],_0x05ae('0x38')));_0x108bd8[_0x05ae('0x31')](getAssociatedResources('IvrCampaigns',_0x208c1b[_0x05ae('0x21')],_0x05ae('0x1a')));_0x108bd8[_0x05ae('0x31')](db['User']['findAll'](queryAgents));break;case _0x05ae('0x6'):_0x34e275[_0x4961c9](_0x05ae('0x2d'));_0x34e275[_0x4961c9](_0x05ae('0x2e'));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x3d')]({'attributes':['id',_0x05ae('0x3')]}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x3e')]({'attributes':['id',_0x05ae('0x3')]}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x3f')]({'attributes':['id','name']}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x40')]({'attributes':['id','name']}));_0x108bd8[_0x05ae('0x31')](_0x208c1b['getMailQueues']({'attributes':['id',_0x05ae('0x3')]}));_0x108bd8['push'](_0x208c1b[_0x05ae('0x41')]({'attributes':['id','name']}));_0x108bd8[_0x05ae('0x31')](_0x208c1b[_0x05ae('0x42')]({'attributes':['id',_0x05ae('0x3')]}));break;}return BPromise[_0x05ae('0x43')](_0x108bd8);}})[_0x05ae('0xb')](function(_0x42f294){if(_0x42f294&&_0x42f294[_0x05ae('0x1c')]){for(var _0x3a002b=0x0;_0x3a002b<_0x42f294[_0x05ae('0x1c')];_0x3a002b+=0x1){for(var _0x11f71b=0x0;_0x11f71b<_0x42f294[_0x3a002b][_0x05ae('0x1c')];_0x11f71b+=0x1){switch(_0x3a002b){case 0x0:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x44'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x1:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x45'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x2:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x46'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x3:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x47'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x4:joinOrLeaveQueues(_0x34e275,_0x4961c9,_0x05ae('0x48'),_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x5:joinOrLeaveQueues(_0x34e275,_0x4961c9,'openchannel',_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x6:joinOrLeaveQueues(_0x34e275,_0x4961c9,'whatsapp',_0x42f294[_0x3a002b][_0x11f71b]);break;case 0x7:if(_0x39d71c['role']!==_0x05ae('0x6'))_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x49'),_0x42f294[_0x3a002b][_0x11f71b]['name']));break;case 0x8:if(_0x39d71c[_0x05ae('0x19')]!==_0x05ae('0x6'))_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x4a'),_0x42f294[_0x3a002b][_0x11f71b][_0x05ae('0x3')]));break;case 0x9:if(_0x39d71c['role']!=='agent')_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x4b'),_0x42f294[_0x3a002b][_0x11f71b]['type'],_0x42f294[_0x3a002b][_0x11f71b]['name']));break;case 0xa:_0x34e275[_0x4961c9](util[_0x05ae('0x1d')](_0x05ae('0x1e'),_0x42f294[_0x3a002b][_0x11f71b][_0x05ae('0x3')]));break;}}}}})[_0x05ae('0xb')](function(){if(_0x4961c9==='leave'){var _0x53cdcb=_[_0x05ae('0x4c')](_0x39d71c['ChatInteractions'],'id');return _0x39d71c['removeChatInteractions'](_0x53cdcb)[_0x05ae('0xb')](function(){for(var _0x4b405c=0x0;_0x4b405c<_0x53cdcb[_0x05ae('0x1c')];_0x4b405c+=0x1){_0x5e6a27[_0x05ae('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x53cdcb[_0x4b405c]),'UserId':Number(_0x39d71c['id'])});}});}})['then'](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x311032=_[_0x05ae('0x4c')](_0x39d71c['MailInteractions'],'id');return _0x39d71c[_0x05ae('0x4f')](_0x311032)[_0x05ae('0xb')](function(){for(var _0x2df17b=0x0;_0x2df17b<_0x311032[_0x05ae('0x1c')];_0x2df17b+=0x1){_0x5e6a27[_0x05ae('0x4d')](_0x05ae('0x50'),{'MailInteractionId':Number(_0x311032[_0x2df17b]),'UserId':Number(_0x39d71c['id'])});}});}})['then'](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x14819c=_[_0x05ae('0x4c')](_0x39d71c['FaxInteractions'],'id');return _0x39d71c[_0x05ae('0x51')](_0x14819c)[_0x05ae('0xb')](function(){for(var _0x1aa5fb=0x0;_0x1aa5fb<_0x14819c[_0x05ae('0x1c')];_0x1aa5fb+=0x1){_0x5e6a27[_0x05ae('0x4d')](_0x05ae('0x52'),{'FaxInteractionId':Number(_0x14819c[_0x1aa5fb]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0xb')](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x188353=_[_0x05ae('0x4c')](_0x39d71c[_0x05ae('0x53')],'id');return _0x39d71c[_0x05ae('0x54')](_0x188353)[_0x05ae('0xb')](function(){for(var _0x3f97df=0x0;_0x3f97df<_0x188353[_0x05ae('0x1c')];_0x3f97df+=0x1){_0x5e6a27['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x188353[_0x3f97df]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0xb')](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0xd252a1=_[_0x05ae('0x4c')](_0x39d71c['OpenchannelInteractions'],'id');return _0x39d71c[_0x05ae('0x55')](_0xd252a1)[_0x05ae('0xb')](function(){for(var _0x4f9a7d=0x0;_0x4f9a7d<_0xd252a1[_0x05ae('0x1c')];_0x4f9a7d+=0x1){_0x5e6a27['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xd252a1[_0x4f9a7d]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0xb')](function(){if(_0x4961c9===_0x05ae('0x4e')){var _0x2c1bd6=_[_0x05ae('0x4c')](_0x39d71c[_0x05ae('0x2b')],'id');return _0x39d71c[_0x05ae('0x56')](_0x2c1bd6)['then'](function(){for(var _0x417519=0x0;_0x417519<_0x2c1bd6['length'];_0x417519+=0x1){_0x5e6a27[_0x05ae('0x4d')](_0x05ae('0x57'),{'WhatsappInteractionId':Number(_0x2c1bd6[_0x417519]),'UserId':Number(_0x39d71c['id'])});}});}})[_0x05ae('0x58')](function(_0x349430){_0x34e275['log'](_0x349430);});}}function onDisconnect(_0x1df25a,_0x3eba49){joinOrLeave(_0x1df25a,_0x05ae('0x4e'),_0x3eba49);}function onConnect(_0x3cf8f4){joinOrLeave(_0x3cf8f4,_0x05ae('0x59'));}exports['default']=function(_0x542a4c){_0x542a4c['on']('connection',function(_0x4843d5){_0x4843d5['setMaxListeners'](0x0);_0x4843d5[_0x05ae('0x5a')]=_0x4843d5['request'][_0x05ae('0x5b')][_0x05ae('0x5c')]+':'+_0x4843d5[_0x05ae('0x5d')][_0x05ae('0x5b')][_0x05ae('0x5e')];_0x4843d5[_0x05ae('0x5f')]=new Date();_0x4843d5[_0x05ae('0x60')]=function(_0x2540ac){console[_0x05ae('0x60')](_0x05ae('0x61')+_0x4843d5['nsp'][_0x05ae('0x3')]+'['+_0x4843d5[_0x05ae('0x5a')]+']',_0x2540ac);};_0x4843d5['on'](_0x05ae('0x62'),function(){onDisconnect(_0x4843d5,_0x542a4c);_0x4843d5[_0x05ae('0x60')](_0x05ae('0x63'));});onConnect(_0x4843d5);_0x4843d5['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d531de9..7667f64 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 _0xb817=['length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','error','catch','Trigger,\x20%s','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','UserId','interface','format','name','agent','outgoingmessage','get','channel','offlineMessage','opened','then','contact','AfterCreate','changed','closed','substatus','SIP/%s','AfterUpdate','User','find','fullname','email','default'];(function(_0x177cba,_0x3504e6){var _0xf03706=function(_0x349d3e){while(--_0x349d3e){_0x177cba['push'](_0x177cba['shift']());}};_0xf03706(++_0x3504e6);}(_0xb817,0x179));var _0x7b81=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb817[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x7b81('0x0'));var db=require(_0x7b81('0x1'))['db'];var jayson=require(_0x7b81('0x2'));var logger=require(_0x7b81('0x3'))('triggers');var client=jayson['client'][_0x7b81('0x4')]({'port':0x232a});var triggers=[{'channel':_0x7b81('0x5'),'model':'ChatInteraction','event':_0x7b81('0x6'),'condition':_0x7b81('0x7'),'callback':afterCreate},{'channel':_0x7b81('0x5'),'model':_0x7b81('0x8'),'event':_0x7b81('0x9'),'condition':_0x7b81('0xa'),'callback':afterUpdate},{'channel':_0x7b81('0x5'),'model':_0x7b81('0xb'),'event':_0x7b81('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7b81('0x5'),'model':'ChatOfflineMessage','event':'afterCreate','condition':_0x7b81('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x7b81('0xd'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x7b81('0xe'),'model':_0x7b81('0xd'),'event':'afterUpdate','condition':_0x7b81('0xa'),'callback':afterUpdate},{'channel':_0x7b81('0xe'),'model':_0x7b81('0xf'),'event':_0x7b81('0x6'),'condition':_0x7b81('0xc'),'callback':afterCreateMessage},{'channel':_0x7b81('0x10'),'model':_0x7b81('0x11'),'event':_0x7b81('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x7b81('0x11'),'event':_0x7b81('0x9'),'condition':_0x7b81('0xa'),'callback':afterUpdate},{'channel':_0x7b81('0x10'),'model':_0x7b81('0x12'),'event':_0x7b81('0x6'),'condition':_0x7b81('0xc'),'callback':afterCreateMessage},{'channel':_0x7b81('0x13'),'model':_0x7b81('0x14'),'event':_0x7b81('0x6'),'condition':_0x7b81('0x7'),'callback':afterCreate},{'channel':_0x7b81('0x13'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x7b81('0xa'),'callback':afterUpdate},{'channel':'Fax','model':_0x7b81('0x15'),'event':'afterCreate','condition':_0x7b81('0xc'),'callback':afterCreateMessage},{'channel':_0x7b81('0x16'),'model':_0x7b81('0x17'),'event':'afterCreate','condition':_0x7b81('0x7'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0x7b81('0x9'),'condition':_0x7b81('0xa'),'callback':afterUpdate},{'channel':_0x7b81('0x16'),'model':_0x7b81('0x18'),'event':_0x7b81('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7b81('0x19'),'model':_0x7b81('0x1a'),'event':_0x7b81('0x6'),'condition':_0x7b81('0x7'),'callback':afterCreate},{'channel':_0x7b81('0x19'),'model':_0x7b81('0x1a'),'event':_0x7b81('0x9'),'condition':_0x7b81('0xa'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x7b81('0x1b'),'event':_0x7b81('0x6'),'condition':_0x7b81('0xc'),'callback':afterCreateMessage}];function request(_0x32b92a){return client[_0x7b81('0x1c')](_0x7b81('0x1d'),_0x32b92a)['then'](function(_0x23662a){logger[_0x7b81('0x1e')]('Trigger,\x20%s',_0x7b81('0x1d'),_0x23662a);if(_0x23662a['error']){if(_0x23662a[_0x7b81('0x1f')]['code']===0x1f4){logger[_0x7b81('0x1f')]('Trigger,\x20%s','EventManager',_0x23662a[_0x7b81('0x1f')]);}}})[_0x7b81('0x20')](function(_0x275d3a){logger[_0x7b81('0x1f')](_0x7b81('0x21'),_0x7b81('0x1d'),_0x275d3a);});}function afterCreateMessage(_0x40f1a0){return function(_0x41fddb){_0x41fddb=_0x41fddb['get']({'plain':!![]});_0x41fddb['channel']=_0x40f1a0;_0x41fddb[_0x7b81('0x22')]=_0x40f1a0;_0x41fddb[_0x7b81('0x23')]=_0x41fddb[_0x7b81('0x24')];Promise['resolve']()['then'](function(){if(typeof _0x41fddb[_0x7b81('0x25')]===_0x7b81('0x26'))return null;var _0x4734b2=_0x7b81('0x27')+_0x41fddb[_0x7b81('0x25')];return db[_0x7b81('0x28')][_0x7b81('0x29')](_0x4734b2,{'type':db[_0x7b81('0x2a')]['QueryTypes'][_0x7b81('0x2b')],'raw':!![]});})['then'](function(_0x559cc9){if(_0x559cc9){_0x41fddb['contact']=_0x559cc9[0x0];}if(typeof _0x41fddb['UserId']==='undefined')return;return getAgent(_0x41fddb[_0x7b81('0x2c')]);})['then'](function(_0x29a31e){if(_0x29a31e){_0x41fddb[_0x7b81('0x2d')]=util[_0x7b81('0x2e')]('SIP/%s',_0x29a31e[_0x7b81('0x2f')]);_0x41fddb[_0x7b81('0x30')]=_0x29a31e;_0x41fddb['channel']=_0x40f1a0;return request({'event':'incomingmessage','message':_0x41fddb});}else{return request({'event':_0x7b81('0x31'),'message':_0x41fddb});}})[_0x7b81('0x20')](function(_0x295459){logger[_0x7b81('0x1f')](_0x7b81('0x21'),'AfterCreateMessage',_0x295459);});};}function afterCreateOfflineMessage(_0x56c5c7){return function(_0x4b87f4){_0x4b87f4=_0x4b87f4[_0x7b81('0x32')]({'plain':!![]});_0x4b87f4[_0x7b81('0x33')]=_0x56c5c7;_0x4b87f4[_0x7b81('0x22')]=_0x56c5c7;_0x4b87f4[_0x7b81('0x23')]=_0x7b81('0x34');return request({'event':_0x4b87f4['event'],'message':_0x4b87f4});};}function afterCreate(_0x37ea5a,_0x37455e){return function(_0x199e61){_0x199e61=_0x199e61['get']({'plain':!![]});_0x199e61['channel']=_0x37ea5a;_0x199e61[_0x7b81('0x22')]=_0x37ea5a;_0x199e61[_0x7b81('0x23')]=_0x7b81('0x35');Promise['resolve']()[_0x7b81('0x36')](function(){var _0x3d6c96=_0x7b81('0x27')+_0x199e61[_0x7b81('0x25')];return db['sequelize'][_0x7b81('0x29')](_0x3d6c96,{'type':db[_0x7b81('0x2a')]['QueryTypes'][_0x7b81('0x2b')],'raw':!![]});})[_0x7b81('0x36')](function(_0x576085){if(_0x576085){_0x199e61[_0x7b81('0x37')]=_0x576085[0x0];}if(typeof _0x199e61[_0x7b81('0x2c')]===_0x7b81('0x26'))return;return getAgent(_0x199e61[_0x7b81('0x2c')]);})[_0x7b81('0x36')](function(_0x1093fb){if(_0x1093fb){_0x199e61['interface']=util[_0x7b81('0x2e')]('SIP/%s',_0x1093fb[_0x7b81('0x2f')]);_0x199e61['agent']=_0x1093fb;}return request({'event':_0x37455e,'message':_0x199e61});})['catch'](function(_0x527bc6){logger['error'](_0x7b81('0x21'),_0x7b81('0x38'),_0x527bc6);});};}function afterUpdate(_0x8a13f7){return function(_0x21a93c){var _0x1b2e27=_0x21a93c[_0x7b81('0x39')]('closed')&&_0x21a93c[_0x7b81('0x3a')];var _0x36b655=_0x21a93c[_0x7b81('0x39')](_0x7b81('0x3b'));if(_0x1b2e27||_0x36b655){var _0x4302b8=_0x1b2e27?'closedinteraction':_0x7b81('0x3b');var _0x13e1b4=_0x21a93c[_0x7b81('0x32')]({'plain':!![]});_0x13e1b4[_0x7b81('0x33')]=_0x8a13f7;_0x13e1b4['motionChannel']=_0x8a13f7;_0x13e1b4['event']=_0x1b2e27?_0x7b81('0x3a'):_0x7b81('0x3b');var _0x1c45a1=_0x7b81('0x27')+_0x13e1b4[_0x7b81('0x25')];return db[_0x7b81('0x28')][_0x7b81('0x29')](_0x1c45a1,{'type':db[_0x7b81('0x2a')]['QueryTypes'][_0x7b81('0x2b')],'raw':!![]})[_0x7b81('0x36')](function(_0x51e34e){if(_0x51e34e){_0x13e1b4[_0x7b81('0x37')]=_0x51e34e[0x0];}if(typeof _0x13e1b4[_0x7b81('0x2c')]===_0x7b81('0x26'))return;return getAgent(_0x13e1b4['UserId']);})[_0x7b81('0x36')](function(_0x2c8c55){if(_0x2c8c55){_0x13e1b4[_0x7b81('0x2d')]=util['format'](_0x7b81('0x3c'),_0x2c8c55[_0x7b81('0x2f')]);_0x13e1b4[_0x7b81('0x30')]=_0x2c8c55;}return request({'event':_0x4302b8,'message':_0x13e1b4});})['catch'](function(_0x152e41){logger[_0x7b81('0x1f')](_0x7b81('0x21'),_0x7b81('0x3d'),_0x152e41);});}};}function getAgent(_0x70549c){return db[_0x7b81('0x3e')][_0x7b81('0x3f')]({'where':{'id':_0x70549c},'attributes':['id',_0x7b81('0x2f'),_0x7b81('0x40'),_0x7b81('0x41'),'internal'],'raw':!![]})[_0x7b81('0x36')](function(_0x36b1e9){return _0x36b1e9;});}exports[_0x7b81('0x42')]=function(){for(var _0x45589d=0x0;_0x45589d=_0x109ae4[_0xc48b('0x11')]){throw Error(_0xc48b('0x12'));}_0x34a0a3(_0xc08a66);})[_0xc48b('0x13')](function(_0x5eea76){_0x5407ed(_0x5eea76);});});}; \ No newline at end of file +var _0x499d=['../mysqldb','voice','mail','chat','fax','sms','whatsapp','getChannels','isValidChannel','includes','isUndefined','agent','then','getLicense','agents','catch','lodash'];(function(_0x1119cb,_0x72dd4c){var _0x304672=function(_0x3638da){while(--_0x3638da){_0x1119cb['push'](_0x1119cb['shift']());}};_0x304672(++_0x72dd4c);}(_0x499d,0xdc));var _0xd499=function(_0x35d540,_0x427f41){_0x35d540=_0x35d540-0x0;var _0x108656=_0x499d[_0x35d540];return _0x108656;};'use strict';var _=require(_0xd499('0x0'));var BPromise=require('bluebird');var db=require(_0xd499('0x1'))['db'];var util=require('./license/util');var channels=[_0xd499('0x2'),_0xd499('0x3'),_0xd499('0x4'),_0xd499('0x5'),_0xd499('0x6'),_0xd499('0x7'),'openchannel'];exports[_0xd499('0x8')]=function(){return channels;};exports[_0xd499('0x9')]=function(_0x1ecd3b){_0x1ecd3b=_0x1ecd3b['toLowerCase']();return _[_0xd499('0xa')](channels,_0x1ecd3b);};exports['clearBlockUser']=function(_0x419c0e,_0x285313,_0x5e7c82,_0x2c5b3d){var _0x468ef2={'loginAttempts':_0x285313,'blocked':_0x5e7c82};if(!_[_0xd499('0xb')](_0x2c5b3d)){_0x468ef2['blockedAt']=_0x2c5b3d;}return _0x419c0e['updateAttributes'](_0x468ef2);};exports['getLicense']=function(_0xa04e64){return new BPromise(function(_0x5d4a15,_0x3595ad){var _0x58d12f=0x0;if(_0xa04e64['role']!==_0xd499('0xc')){_0x5d4a15(_0xa04e64);}db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0xa04e64['id']}}})[_0xd499('0xd')](function(_0x3c4f7b){_0x58d12f=_0x3c4f7b;return util[_0xd499('0xe')]();})['then'](function(_0x21350e){if(_0x21350e&&_0x21350e[_0xd499('0xf')]&&_0x58d12f>=_0x21350e[_0xd499('0xf')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5d4a15(_0xa04e64);})[_0xd499('0x10')](function(_0x1a35d7){_0x3595ad(_0x1a35d7);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 9472263..e1b5ce6 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55fe=['inherits','Bad\x20Request','Forbidden','Not\x20Found','OutOfInterval','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error'];(function(_0x310d76,_0x511586){var _0x54ebcd=function(_0x1063e7){while(--_0x1063e7){_0x310d76['push'](_0x310d76['shift']());}};_0x54ebcd(++_0x511586);}(_0x55fe,0x1c6));var _0xe55f=function(_0x56595f,_0x5114af){_0x56595f=_0x56595f-0x0;var _0x34d012=_0x55fe[_0x56595f];return _0x34d012;};'use strict';var util=require('util');var logger=require(_0xe55f('0x0'))(_0xe55f('0x1'));var APIError=function(_0x4ad098,_0xc1c65){this[_0xe55f('0x2')]=_0x4ad098||_0xe55f('0x3');this[_0xe55f('0x4')]=_0xc1c65||_0xe55f('0x5');util[_0xe55f('0x6')](APIError,Error);};var APIBadRequestError=function(_0x312220){this[_0xe55f('0x2')]=_0x312220||'Bad\x20Request';this[_0xe55f('0x4')]=_0xe55f('0x7');util[_0xe55f('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x76e405){this[_0xe55f('0x2')]=_0x76e405||_0xe55f('0x8');this[_0xe55f('0x4')]=_0xe55f('0x8');util[_0xe55f('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4224d8){this[_0xe55f('0x2')]=_0x4224d8||'Entity\x20not\x20found';this[_0xe55f('0x4')]=_0xe55f('0x9');util[_0xe55f('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4b8f61){this[_0xe55f('0x2')]=_0x4b8f61||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xe55f('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this['details']={'type':_0xe55f('0xa')};util[_0xe55f('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4c548e){this[_0xe55f('0x2')]=_0x4c548e||_0xe55f('0xb');this[_0xe55f('0x4')]=_0xe55f('0xc');util[_0xe55f('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x30fe26){switch(_0x30fe26){case'Bad\x20Request':return 0x190;case _0xe55f('0x8'),_0xe55f('0xd'):return 0x193;case'Not\x20Found':return 0x194;case _0xe55f('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1b83be){if(_0x1b83be===_0xe55f('0xd'))return _0x1b83be;return null;}function handleError(_0xabb5a9){return function(_0x3a8670){logger[_0xe55f('0xe')](_0x3a8670[_0xe55f('0xf')]);var _0xf14320=getStatusCode(_0x3a8670['name']);var _0x4f1a96=getCustomStatusMessage(_0x3a8670[_0xe55f('0x4')]);if(_0x3a8670[_0xe55f('0x4')]){delete _0x3a8670[_0xe55f('0x4')];}if(_0x4f1a96){_0xabb5a9[_0xe55f('0x10')]=_0x4f1a96;}return _0xabb5a9[_0xe55f('0x11')](_0xf14320)[_0xe55f('0x12')](_0x3a8670);};}module[_0xe55f('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x5635=['statusMessage','status','send','exports','util','../config/logger','api','message','Error','inherits','Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','stack'];(function(_0x473b5a,_0x17fa75){var _0x32dea3=function(_0x530019){while(--_0x530019){_0x473b5a['push'](_0x473b5a['shift']());}};_0x32dea3(++_0x17fa75);}(_0x5635,0x88));var _0x5563=function(_0x991b92,_0x7996d){_0x991b92=_0x991b92-0x0;var _0x16ff6a=_0x5635[_0x991b92];return _0x16ff6a;};'use strict';var util=require(_0x5563('0x0'));var logger=require(_0x5563('0x1'))(_0x5563('0x2'));var APIError=function(_0x37fcc0,_0x5f2931){this[_0x5563('0x3')]=_0x37fcc0||'Internal\x20Server\x20Error';this['name']=_0x5f2931||_0x5563('0x4');util[_0x5563('0x5')](APIError,Error);};var APIBadRequestError=function(_0x154e3a){this[_0x5563('0x3')]=_0x154e3a||_0x5563('0x6');this[_0x5563('0x7')]=_0x5563('0x6');util[_0x5563('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4d89fe){this[_0x5563('0x3')]=_0x4d89fe||_0x5563('0x8');this[_0x5563('0x7')]='Forbidden';util[_0x5563('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x24cb65){this['message']=_0x24cb65||_0x5563('0x9');this[_0x5563('0x7')]='Not\x20Found';util[_0x5563('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x376a6e){this[_0x5563('0x3')]=_0x376a6e||_0x5563('0xa');this[_0x5563('0x7')]=_0x5563('0xb');this[_0x5563('0xc')]=0x193;this[_0x5563('0xd')]={'type':_0x5563('0xe')};util[_0x5563('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1d1d25){this[_0x5563('0x3')]=_0x1d1d25||'Resource\x20Conflict';this['name']=_0x5563('0xf');util[_0x5563('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x2a17ed){switch(_0x2a17ed){case'Bad\x20Request':return 0x190;case _0x5563('0x8'),_0x5563('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x353d04){if(_0x353d04===_0x5563('0xb'))return _0x353d04;return null;}function handleError(_0x4ca27e){return function(_0x59ecdb){logger[_0x5563('0x10')](_0x59ecdb[_0x5563('0x11')]);var _0x3f18ec=getStatusCode(_0x59ecdb['name']);var _0x48804c=getCustomStatusMessage(_0x59ecdb['name']);if(_0x59ecdb[_0x5563('0x7')]){delete _0x59ecdb[_0x5563('0x7')];}if(_0x48804c){_0x4ca27e[_0x5563('0x12')]=_0x48804c;}return _0x4ca27e[_0x5563('0x13')](_0x3f18ec)[_0x5563('0x14')](_0x59ecdb);};}module[_0x5563('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b8773fc..20c5d9c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dd2=['send','status','render','json'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0x4dd2,0xf1));var _0x24dd=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0x4dd2[_0x1809c5];return _0x5254a4;};'use strict';module['exports'][0x194]=function pageNotFound(_0x772476,_0x2ee27b){var _0x2f171a='404';var _0x3d8377=0x194;var _0x5c459c={'status':_0x3d8377};_0x2ee27b[_0x24dd('0x0')](_0x5c459c['status']);_0x2ee27b[_0x24dd('0x1')](_0x2f171a,{},function(_0x2cbda5,_0x317135){if(_0x2cbda5){return _0x2ee27b['status'](_0x5c459c['status'])[_0x24dd('0x2')](_0x5c459c);}_0x2ee27b[_0x24dd('0x3')](_0x317135);});}; \ No newline at end of file +var _0xb84e=['status','render','send','404'];(function(_0x442755,_0x176173){var _0xe2d9fe=function(_0x4710be){while(--_0x4710be){_0x442755['push'](_0x442755['shift']());}};_0xe2d9fe(++_0x176173);}(_0xb84e,0xbf));var _0xeb84=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xb84e[_0x5c38cd];return _0xc985ef;};'use strict';module['exports'][0x194]=function pageNotFound(_0xcb78a,_0x6bfa05){var _0x3b2c5c=_0xeb84('0x0');var _0x49570e=0x194;var _0x512746={'status':_0x49570e};_0x6bfa05[_0xeb84('0x1')](_0x512746[_0xeb84('0x1')]);_0x6bfa05[_0xeb84('0x2')](_0x3b2c5c,{},function(_0x3dca87,_0xb17f52){if(_0x3dca87){return _0x6bfa05[_0xeb84('0x1')](_0x512746['status'])['json'](_0x512746);}_0x6bfa05[_0xeb84('0x3')](_0xb17f52);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b031b6a..914d0fd 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bc6=['WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','CmHopperFinal','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Interactions','ListId','TemplateId','team_has_mail_queues','Messages','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','List','DashboardItem','Items','FaxAccountId','Answers','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','Teams','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','OpenchannelQueueReport','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CmContactId','HopperHistories','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','OwnerId','Queue','Condition','OneAll','AutomationAllId','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','CmContactHasItem','ContactItemType','ItemType','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','Descriptions','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowAccount','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','team_has_sms_queues','team_has_whatsapp_queues','CampaignId','TrunkId','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','Queues','UserProfile','UserProfileSections','UserProfileResource','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','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/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfileSection','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','cascade','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','CmContact','Contacts','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount'];(function(_0x68e1a6,_0x188baa){var _0x49ad62=function(_0x1c2de2){while(--_0x1c2de2){_0x68e1a6['push'](_0x68e1a6['shift']());}};_0x49ad62(++_0x188baa);}(_0x8bc6,0xc4));var _0x68bc=function(_0x47ab21,_0x3907b6){_0x47ab21=_0x47ab21-0x0;var _0x1104e3=_0x8bc6[_0x47ab21];return _0x1104e3;};'use strict';var config=require(_0x68bc('0x0'));var Sequelize=require(_0x68bc('0x1'));var _=require('lodash');var jstz=require(_0x68bc('0x2'));var timezone=jstz[_0x68bc('0x3')]();config['sequelize']=_[_0x68bc('0x4')](config[_0x68bc('0x1')],{'database':_0x68bc('0x5'),'username':_0x68bc('0x6'),'password':'xC@LL1234','options':{'host':_0x68bc('0x7'),'port':0xcea,'dialect':_0x68bc('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x68bc('0x9'),'collate':_0x68bc('0xa')}}});config[_0x68bc('0xb')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x68bc('0x5'),'username':_0x68bc('0x6'),'password':_0x68bc('0xc'),'options':{'host':_0x68bc('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x68bc('0xd')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x68bc('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x68bc('0x1')][_0x68bc('0xe')],config[_0x68bc('0x1')][_0x68bc('0xf')],config[_0x68bc('0x1')][_0x68bc('0x10')],config[_0x68bc('0x1')][_0x68bc('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x68bc('0xb')][_0x68bc('0xe')],config[_0x68bc('0xb')][_0x68bc('0xf')],config[_0x68bc('0xb')][_0x68bc('0x10')],config[_0x68bc('0xb')][_0x68bc('0x11')])};db[_0x68bc('0x12')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x13'));db[_0x68bc('0x14')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x15'));db[_0x68bc('0x16')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x18'));db[_0x68bc('0x19')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x1a'));db['VoiceMusicOnHold']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x1b'));db[_0x68bc('0x1c')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x1d'));db[_0x68bc('0x1e')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x1f'));db[_0x68bc('0x20')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x21'));db[_0x68bc('0x22')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x23'));db[_0x68bc('0x24')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x25'));db[_0x68bc('0x26')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x27'));db['VoiceDialReport']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x28'));db[_0x68bc('0x29')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x2a'));db['VoiceQueueReport']=db[_0x68bc('0x1')]['import'](_0x68bc('0x2b'));db[_0x68bc('0x2c')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x2d'));db[_0x68bc('0x2e')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x2f'));db[_0x68bc('0x30')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x68bc('0x31')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x32'));db[_0x68bc('0x33')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x34'));db[_0x68bc('0x35')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x36'));db[_0x68bc('0x37')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x38'));db[_0x68bc('0x39')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x3a'));db[_0x68bc('0x3b')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x3c'));db[_0x68bc('0x3d')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x3e'));db[_0x68bc('0x3f')]=db[_0x68bc('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x68bc('0x40')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x41'));db[_0x68bc('0x42')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x43'));db[_0x68bc('0x44')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x45'));db[_0x68bc('0x46')]=db['sequelize'][_0x68bc('0x17')]('../api/mailQueue/mailQueue.model');db[_0x68bc('0x47')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x48'));db['MailInteraction']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x49'));db[_0x68bc('0x4a')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x4b'));db[_0x68bc('0x4c')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x4d'));db[_0x68bc('0x4e')]=db['sequelize'][_0x68bc('0x17')]('../api/mailQueueReport/mailQueueReport.model');db[_0x68bc('0x4f')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x50'));db['DashboardItem']=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/dashboardItem/dashboardItem.model');db[_0x68bc('0x51')]=db[_0x68bc('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x68bc('0x52')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x53'));db[_0x68bc('0x54')]=db[_0x68bc('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db[_0x68bc('0x55')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x56'));db[_0x68bc('0x57')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x58'));db['FaxQueueReport']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x59'));db[_0x68bc('0x5a')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x5b'));db[_0x68bc('0x5c')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x5d'));db[_0x68bc('0x5e')]=db['sequelize']['import'](_0x68bc('0x5f'));db[_0x68bc('0x60')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x61'));db[_0x68bc('0x62')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x63'));db['OpenchannelAccount']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x64'));db[_0x68bc('0x65')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/openchannelApplication/openchannelApplication.model');db[_0x68bc('0x66')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x67'));db[_0x68bc('0x68')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x69'));db[_0x68bc('0x6a')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x6b'));db['ChatWebsite']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x6c'));db['OpenchannelQueueReport']=db['sequelize']['import'](_0x68bc('0x6d'));db[_0x68bc('0x6e')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x6f'));db[_0x68bc('0x70')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/chatInteraction/chatInteraction.model');db[_0x68bc('0x71')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x72'));db[_0x68bc('0x73')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x74'));db[_0x68bc('0x75')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x76'));db[_0x68bc('0x77')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x78'));db['ChatProactiveAction']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x79'));db[_0x68bc('0x7a')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x7b'));db['CmContact']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x7c'));db[_0x68bc('0x7d')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x7e'));db['CmHopperBlack']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x7f'));db['CmHopperFinal']=db[_0x68bc('0x1')]['import'](_0x68bc('0x80'));db[_0x68bc('0x81')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x82'));db[_0x68bc('0x83')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x84'));db['CmCustomField']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x85'));db[_0x68bc('0x86')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x87'));db[_0x68bc('0x88')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x89'));db[_0x68bc('0x8a')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/cannedAnswer/cannedAnswer.model');db[_0x68bc('0x8b')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x8c'));db['Condition']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x8d'));db[_0x68bc('0x8e')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x8f'));db[_0x68bc('0x90')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x91'));db[_0x68bc('0x92')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x93'));db[_0x68bc('0x94')]=db['sequelize']['import'](_0x68bc('0x95'));db[_0x68bc('0x96')]=db[_0x68bc('0x1')]['import']('../api/schedule/schedule.model');db[_0x68bc('0x97')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x98'));db['Tag']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x99'));db['ContactItemType']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x9a'));db['CmContactHasItem']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x9b'));db[_0x68bc('0x9c')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x9d'));db[_0x68bc('0x9e')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/template/template.model');db[_0x68bc('0x9f')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xa0'));db[_0x68bc('0xa1')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xa2'));db[_0x68bc('0xa3')]=db['sequelize'][_0x68bc('0x17')]('../api/integration/integration.model');db[_0x68bc('0xa4')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xa5'));db[_0x68bc('0xa6')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xa7'));db[_0x68bc('0xa8')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xa9'));db[_0x68bc('0xaa')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xab'));db[_0x68bc('0xac')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xad'));db[_0x68bc('0xae')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x68bc('0xaf')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x68bc('0xb0')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xb1'));db[_0x68bc('0xb2')]=db['sequelize']['import'](_0x68bc('0xb3'));db[_0x68bc('0xb4')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xb5'));db[_0x68bc('0xb6')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xb7'));db[_0x68bc('0xb8')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xb9'));db[_0x68bc('0xba')]=db[_0x68bc('0x1')]['import'](_0x68bc('0xbb'));db[_0x68bc('0xbc')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xbd'));db[_0x68bc('0xbe')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xbf'));db['ZohoAccount']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xc0'));db[_0x68bc('0xc1')]=db[_0x68bc('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x68bc('0xc2')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xc3'));db['ZendeskAccount']=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x68bc('0xc4')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xc5'));db['ZendeskField']=db[_0x68bc('0x1')]['import'](_0x68bc('0xc6'));db['FreshdeskAccount']=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x68bc('0xc7')]=db[_0x68bc('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db['FreshdeskField']=db[_0x68bc('0x1')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xc8'));db[_0x68bc('0xc9')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xca'));db['VtigerField']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xcb'));db['ServicenowAccount']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xcc'));db[_0x68bc('0xcd')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x68bc('0xce')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xcf'));db[_0x68bc('0xd0')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xd1'));db[_0x68bc('0xd2')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x68bc('0xd3')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xd4'));db['FreshsalesAccount']=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x68bc('0xd5')]=db[_0x68bc('0x1')]['import'](_0x68bc('0xd6'));db[_0x68bc('0xd7')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xd8'));db[_0x68bc('0xa3')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xd9'));db[_0x68bc('0xda')]=db[_0x68bc('0x1')]['import']('../api/network/network.model');db[_0x68bc('0xdb')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xdc'));db[_0x68bc('0xdd')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xde'));db['JscriptyAnswerReport']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xdf'));db[_0x68bc('0xe0')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xe1'));db[_0x68bc('0xe2')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xe3'));db[_0x68bc('0xe4')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xe5'));db[_0x68bc('0xe6')]=db[_0x68bc('0x1')]['import'](_0x68bc('0xe7'));db[_0x68bc('0xe8')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xe9'));db[_0x68bc('0xea')]=db[_0x68bc('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xeb'));db['SquareOdbc']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xec'));db['SquareProject']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xed'));db['SquareRecording']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xee'));db[_0x68bc('0xef')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xf0'));db[_0x68bc('0xf1')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xf2'));db[_0x68bc('0xf3')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xf4'));db['Campaign']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xf5'));db[_0x68bc('0xf6')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xf7'));db[_0x68bc('0xf8')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0xf9'));db['Plugin']=db[_0x68bc('0x1')]['import'](_0x68bc('0xfa'));db[_0x68bc('0xfb')]=db['sequelize'][_0x68bc('0x17')]('../api/mailTransferReport/mailTransferReport.model');db[_0x68bc('0xfc')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0xfd'));db[_0x68bc('0xfe')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/faxTransferReport/faxTransferReport.model');db[_0x68bc('0xff')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x100'));db['SmsTransferReport']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x101'));db[_0x68bc('0x102')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x103'));db[_0x68bc('0x104')]=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/userProfile/userProfile.model');db[_0x68bc('0x105')]=db[_0x68bc('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x106'));db['UserNotification']=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x107'));db['WhatsappAccount']=db[_0x68bc('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x68bc('0x108')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x109'));db[_0x68bc('0x10a')]=db[_0x68bc('0x1')]['import'](_0x68bc('0x10b'));db[_0x68bc('0x10c')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x10d'));db[_0x68bc('0x10e')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x68bc('0x10f')]=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x68bc('0x1')]['import'](_0x68bc('0x110'));db['TeamVoiceQueue']=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x111'));db[_0x68bc('0x112')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x113'));db[_0x68bc('0x114')]=db[_0x68bc('0x1')][_0x68bc('0x17')](_0x68bc('0x115'));db[_0x68bc('0x116')]=db['sequelize'][_0x68bc('0x17')](_0x68bc('0x117'));db['MailInteractionHasTag']=db[_0x68bc('0x1')][_0x68bc('0x17')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x68bc('0x12')][_0x68bc('0x118')](db['VoiceMail'],{'as':_0x68bc('0x22'),'onDelete':'cascade','foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')]['hasOne'](db[_0x68bc('0x116')],{'as':'userSetting','onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x119')});db['User'][_0x68bc('0x11b')](db['VoiceRecording'],{'as':_0x68bc('0x11c'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')]['hasMany'](db[_0x68bc('0x31')],{'as':_0x68bc('0x11d'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')][_0x68bc('0x11b')](db[_0x68bc('0x19')],{'as':_0x68bc('0x11e'),'onDelete':'cascade','hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':_0x68bc('0x11f'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')]['hasMany'](db[_0x68bc('0x81')],{'as':_0x68bc('0x120'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')]['hasMany'](db['ReportAgentPreview'],{'as':_0x68bc('0x83'),'foreignKey':_0x68bc('0x119')});db['User']['hasMany'](db['OpenchannelInteraction'],{'as':_0x68bc('0x121'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')][_0x68bc('0x11b')](db['ChatInteraction'],{'as':_0x68bc('0x122'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')][_0x68bc('0x11b')](db[_0x68bc('0x5e')],{'as':'SmsInteractions','foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')][_0x68bc('0x11b')](db[_0x68bc('0x54')],{'as':'FaxInteractions','foreignKey':_0x68bc('0x119')});db['User'][_0x68bc('0x11b')](db[_0x68bc('0x123')],{'as':_0x68bc('0x124'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')]['hasMany'](db[_0x68bc('0x10a')],{'as':_0x68bc('0x125'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x12')][_0x68bc('0x11b')](db[_0x68bc('0x126')],{'as':_0x68bc('0x127'),'foreignKey':_0x68bc('0x128')});db[_0x68bc('0x12')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0x68bc('0x129')});db['User'][_0x68bc('0x12a')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x68bc('0x12b')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x77')],{'as':_0x68bc('0x12d'),'through':'chat_group_has_users'});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x12f'),'through':_0x68bc('0x130')});db['User']['belongsToMany'](db[_0x68bc('0x102')],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0x68bc('0x12c')](db[_0x68bc('0xf1')],{'through':_0x68bc('0x131')});db['User'][_0x68bc('0x12c')](db[_0x68bc('0x123')],{'as':'MailInteractions','through':_0x68bc('0x132')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db['ChatInteraction'],{'as':_0x68bc('0x122'),'through':_0x68bc('0x133')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x54')],{'as':_0x68bc('0x134'),'through':_0x68bc('0x135')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x5e')],{'as':_0x68bc('0x136'),'through':_0x68bc('0x137')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x66')],{'as':_0x68bc('0x121'),'through':'user_has_openchannel_interactions'});db[_0x68bc('0x12')][_0x68bc('0x12c')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x68bc('0x138')});db[_0x68bc('0x12')]['belongsToMany'](db[_0x68bc('0x1c')],{'as':_0x68bc('0x139'),'through':_0x68bc('0x33'),'required':![]});db['User'][_0x68bc('0x12c')](db[_0x68bc('0x104')],{'as':_0x68bc('0x13a'),'through':'UserVoicePrefix','required':![]});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x46')],{'as':_0x68bc('0x13b'),'through':_0x68bc('0x37'),'required':![]});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x75')],{'as':_0x68bc('0x13c'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x68bc('0x12c')](db[_0x68bc('0x57')],{'as':_0x68bc('0x13d'),'through':_0x68bc('0x39'),'required':![]});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x62')],{'as':_0x68bc('0x13e'),'through':_0x68bc('0x3b'),'required':![]});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x6a')],{'as':_0x68bc('0x13f'),'through':_0x68bc('0x3d'),'required':![]});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x140')],{'as':_0x68bc('0x141'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x68bc('0x12c')](db[_0x68bc('0x102')],{'through':_0x68bc('0x142')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x143')],{'as':_0x68bc('0x144'),'through':_0x68bc('0x145')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x51')],{'as':_0x68bc('0x146'),'through':'user_has_fax_accounts'});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x44')],{'as':'MailAccounts','through':_0x68bc('0x147')});db[_0x68bc('0x12')][_0x68bc('0x12c')](db[_0x68bc('0x148')],{'as':_0x68bc('0x149'),'through':_0x68bc('0x14a')});db['User'][_0x68bc('0x12c')](db['SmsAccount'],{'as':_0x68bc('0x14b'),'through':'user_has_sms_accounts'});db[_0x68bc('0x12')]['belongsToMany'](db[_0x68bc('0x14c')],{'as':_0x68bc('0x14d'),'through':_0x68bc('0x14e')});db['VoiceChanSpy'][_0x68bc('0x11b')](db[_0x68bc('0x19')],{'as':_0x68bc('0x14f'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x150')});db[_0x68bc('0x16')][_0x68bc('0x11b')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x68bc('0x19')]['hasMany'](db[_0x68bc('0x19')],{'as':_0x68bc('0x151'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x152')][_0x68bc('0x12c')](db[_0x68bc('0x97')],{'as':_0x68bc('0x153'),'through':_0x68bc('0x154')});db[_0x68bc('0x1c')]['hasMany'](db[_0x68bc('0x31')],{'as':'Members','foreignKey':_0x68bc('0x155')});db[_0x68bc('0x1c')][_0x68bc('0x11b')](db['CmHopper'],{'as':_0x68bc('0x156'),'foreignKey':_0x68bc('0x155')});db['VoiceQueue'][_0x68bc('0x11b')](db[_0x68bc('0x157')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x68bc('0x1c')]['hasMany'](db[_0x68bc('0x81')],{'as':'HopperHistories','foreignKey':_0x68bc('0x155')});db['VoiceQueue'][_0x68bc('0x11b')](db[_0x68bc('0x83')],{'as':_0x68bc('0x83'),'foreignKey':_0x68bc('0x155')});db['VoiceQueue'][_0x68bc('0x11b')](db[_0x68bc('0x158')],{'as':_0x68bc('0x159'),'foreignKey':_0x68bc('0x155')});db[_0x68bc('0x1c')][_0x68bc('0x11b')](db['JscriptySessionReport'],{'as':_0x68bc('0x15a'),'foreignKey':_0x68bc('0x155')});db[_0x68bc('0x1c')]['belongsTo'](db[_0x68bc('0x2e')],{'as':_0x68bc('0x2e'),'foreignKey':'TrunkId'});db['VoiceQueue']['belongsTo'](db[_0x68bc('0x2e')],{'as':_0x68bc('0x15b'),'foreignKey':_0x68bc('0x15c')});db['VoiceQueue']['belongsTo'](db[_0x68bc('0x8e')],{'as':_0x68bc('0x8e'),'foreignKey':_0x68bc('0x15d')});db[_0x68bc('0x1c')][_0x68bc('0x12a')](db[_0x68bc('0x90')],{'as':_0x68bc('0x15e'),'foreignKey':_0x68bc('0x15f')});db[_0x68bc('0x1c')]['belongsToMany'](db[_0x68bc('0x102')],{'as':_0x68bc('0x160'),'through':_0x68bc('0x161')});db[_0x68bc('0x1c')]['belongsToMany'](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x33')});db[_0x68bc('0x1c')][_0x68bc('0x12c')](db['Team'],{'as':'Teams','through':_0x68bc('0x163')});db['VoiceQueue'][_0x68bc('0x12c')](db[_0x68bc('0x102')],{'as':_0x68bc('0x164'),'through':_0x68bc('0x165')});db[_0x68bc('0x1e')][_0x68bc('0x12a')](db['User'],{'as':_0x68bc('0x12'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x20')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x12'),'foreignKey':_0x68bc('0x119')});db['VoiceMail'][_0x68bc('0x11b')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x68bc('0x166'),'sourceKey':_0x68bc('0x167')});db['VoiceMailMessage']['belongsTo'](db[_0x68bc('0x22')],{'foreignKey':'mailboxuser','targetKey':_0x68bc('0x167')});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0x68bc('0x168'),'foreignKey':_0x68bc('0x169'),'constraints':![]});db[_0x68bc('0x26')][_0x68bc('0x11b')](db[_0x68bc('0x29')],{'as':'AgentReports','foreignKey':_0x68bc('0x169'),'constraints':![]});db[_0x68bc('0x26')]['belongsTo'](db[_0x68bc('0x12')],{'as':'User','foreignKey':_0x68bc('0x119')});db[_0x68bc('0x26')]['belongsTo'](db['CmContact'],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db['MailServerIn'][_0x68bc('0x12a')](db['MailAccount'],{'as':_0x68bc('0x44'),'foreignKey':_0x68bc('0x16c')});db[_0x68bc('0x40')][_0x68bc('0x12a')](db['CloudProvider'],{'as':_0x68bc('0x16d'),'foreignKey':_0x68bc('0x16e'),'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x42')][_0x68bc('0x12a')](db[_0x68bc('0x44')],{'as':_0x68bc('0x44'),'foreignKey':_0x68bc('0x16c')});db[_0x68bc('0x42')][_0x68bc('0x12a')](db[_0x68bc('0x16d')],{'as':'CloudProvider','foreignKey':_0x68bc('0x16e'),'onDelete':'restrict'});db[_0x68bc('0x44')][_0x68bc('0x118')](db['MailServerIn'],{'as':_0x68bc('0x170'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x44')][_0x68bc('0x118')](db[_0x68bc('0x42')],{'as':_0x68bc('0x171'),'onDelete':'cascade'});db[_0x68bc('0x44')]['hasMany'](db[_0x68bc('0x8b')],{'as':_0x68bc('0x172'),'foreignKey':_0x68bc('0x16c'),'onDelete':_0x68bc('0x11a')});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x68bc('0x16c')});db[_0x68bc('0x44')][_0x68bc('0x11b')](db[_0x68bc('0x4a')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x68bc('0x44')]['hasMany'](db[_0x68bc('0x123')],{'as':_0x68bc('0x173')});db[_0x68bc('0x44')][_0x68bc('0x11b')](db[_0x68bc('0x4c')],{'as':_0x68bc('0x151'),'foreignKey':_0x68bc('0x16c'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x44')]['belongsTo'](db[_0x68bc('0x102')],{'as':'List','foreignKey':_0x68bc('0x174')});db[_0x68bc('0x44')][_0x68bc('0x12a')](db[_0x68bc('0x9e')],{'as':_0x68bc('0x9e'),'foreignKey':_0x68bc('0x175')});db[_0x68bc('0x44')][_0x68bc('0x12a')](db[_0x68bc('0x90')],{'as':_0x68bc('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x68bc('0x44')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x147')});db[_0x68bc('0x46')]['belongsToMany'](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x37')});db['MailQueue'][_0x68bc('0x12c')](db[_0x68bc('0xf1')],{'through':_0x68bc('0x176'),'as':'Teams'});db['MailInteraction'][_0x68bc('0x11b')](db[_0x68bc('0x4a')],{'as':_0x68bc('0x177'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x178')});db[_0x68bc('0x123')][_0x68bc('0x12a')](db[_0x68bc('0x44')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x16c')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x123')][_0x68bc('0x12a')](db['User'],{'as':_0x68bc('0x17a'),'foreignKey':'UserId'});db[_0x68bc('0x123')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x17c'),'as':_0x68bc('0x17d')});db[_0x68bc('0x123')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x17c'),'as':_0x68bc('0x17e')});db[_0x68bc('0x123')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'through':_0x68bc('0x132'),'foreignKey':_0x68bc('0x178')});db[_0x68bc('0x4a')]['hasMany'](db['Attachment'],{'as':_0x68bc('0x180'),'onDelete':'cascade'});db['MailMessage'][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x12')});db[_0x68bc('0x4a')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x68bc('0x4a')][_0x68bc('0x12a')](db[_0x68bc('0x123')],{'as':_0x68bc('0x181'),'foreignKey':'MailInteractionId'});db[_0x68bc('0x4a')]['belongsTo'](db[_0x68bc('0x44')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x16c')});db[_0x68bc('0x4a')][_0x68bc('0x12a')](db[_0x68bc('0x143')],{'as':_0x68bc('0x143'),'foreignKey':_0x68bc('0x182')});db[_0x68bc('0x4a')]['belongsTo'](db[_0x68bc('0x73')],{'as':_0x68bc('0x73'),'foreignKey':_0x68bc('0x183')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x68bc('0x46')],{'onDelete':_0x68bc('0x16f')});db['MailApplication'][_0x68bc('0x12a')](db[_0x68bc('0x44')],{'onDelete':'restrict'});db[_0x68bc('0x4c')][_0x68bc('0x12a')](db[_0x68bc('0x8e')],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x15d')});db[_0x68bc('0x4c')][_0x68bc('0x12a')](db[_0x68bc('0x17b')],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x184')});db['MailQueueReport'][_0x68bc('0x12a')](db[_0x68bc('0x44')],{});db[_0x68bc('0x4e')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0x4e')][_0x68bc('0x12a')](db['CmContact'],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db[_0x68bc('0x4e')]['belongsTo'](db['MailMessage'],{});db[_0x68bc('0x4e')]['belongsTo'](db[_0x68bc('0x12')],{});db['MailQueueReport'][_0x68bc('0x12a')](db[_0x68bc('0x46')],{});db[_0x68bc('0x4f')][_0x68bc('0x11b')](db[_0x68bc('0x186')],{'as':_0x68bc('0x187'),'onDelete':_0x68bc('0x11a')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0x68bc('0x172'),'foreignKey':_0x68bc('0x188'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x51')]['hasMany'](db['CannedAnswer'],{'as':_0x68bc('0x189'),'foreignKey':_0x68bc('0x188')});db[_0x68bc('0x51')][_0x68bc('0x11b')](db[_0x68bc('0x54')],{'as':_0x68bc('0x173')});db[_0x68bc('0x51')][_0x68bc('0x11b')](db['FaxApplication'],{'as':_0x68bc('0x151'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db['FaxAccount'][_0x68bc('0x11b')](db[_0x68bc('0x19')],{'as':_0x68bc('0x18a'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x51')]['hasMany'](db[_0x68bc('0x55')],{'as':_0x68bc('0x177')});db['FaxAccount']['belongsTo'](db[_0x68bc('0x2e')],{'as':_0x68bc('0x2e')});db[_0x68bc('0x51')][_0x68bc('0x12a')](db['CmList'],{'as':_0x68bc('0x185'),'foreignKey':'ListId'});db[_0x68bc('0x51')][_0x68bc('0x12a')](db[_0x68bc('0x90')],{'as':'mandatoryDispositionPause','foreignKey':_0x68bc('0x15f')});db['FaxAccount'][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x18b')});db[_0x68bc('0x52')][_0x68bc('0x12a')](db['User'],{'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x52')]['belongsTo'](db[_0x68bc('0x57')],{'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x52')][_0x68bc('0x12a')](db[_0x68bc('0x51')],{'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x52')][_0x68bc('0x12a')](db[_0x68bc('0x17b')],{'onDelete':'restrict','foreignKey':_0x68bc('0x184')});db['FaxInteraction']['hasMany'](db[_0x68bc('0x55')],{'as':_0x68bc('0x177'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x18c')});db[_0x68bc('0x54')]['belongsTo'](db[_0x68bc('0x51')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x188')});db[_0x68bc('0x54')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x54')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':'Owner','foreignKey':_0x68bc('0x119')});db[_0x68bc('0x54')][_0x68bc('0x12c')](db['Tag'],{'through':_0x68bc('0x18d'),'as':_0x68bc('0x17d')});db[_0x68bc('0x54')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x68bc('0x17e')});db['FaxInteraction'][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'through':_0x68bc('0x135'),'foreignKey':_0x68bc('0x18c')});db['FaxMessage'][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x11a'),'as':_0x68bc('0x12')});db[_0x68bc('0x55')][_0x68bc('0x12a')](db[_0x68bc('0x54')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x68bc('0x55')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'onDelete':_0x68bc('0x11a'),'as':'Contact'});db['FaxMessage'][_0x68bc('0x12a')](db['Attachment'],{'as':_0x68bc('0xf8'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x68bc('0x12a')](db[_0x68bc('0x51')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x188')});db[_0x68bc('0x57')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x39')});db[_0x68bc('0x57')][_0x68bc('0x12c')](db[_0x68bc('0xf1')],{'through':_0x68bc('0x18e'),'as':_0x68bc('0x18f')});db['FaxQueueReport'][_0x68bc('0x12a')](db[_0x68bc('0x51')],{});db[_0x68bc('0x190')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db['FaxQueueReport']['belongsTo'](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x190')]['belongsTo'](db[_0x68bc('0x54')],{});db[_0x68bc('0x190')][_0x68bc('0x12a')](db[_0x68bc('0x55')],{});db[_0x68bc('0x190')][_0x68bc('0x12a')](db['User'],{});db[_0x68bc('0x190')][_0x68bc('0x12a')](db[_0x68bc('0x57')],{});db[_0x68bc('0x5a')][_0x68bc('0x11b')](db['Disposition'],{'as':_0x68bc('0x172'),'foreignKey':_0x68bc('0x191'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x5a')][_0x68bc('0x11b')](db[_0x68bc('0x8a')],{'as':_0x68bc('0x189'),'foreignKey':_0x68bc('0x191')});db['SmsAccount'][_0x68bc('0x11b')](db[_0x68bc('0x60')],{'as':_0x68bc('0x177'),'foreignKey':_0x68bc('0x191')});db['SmsAccount'][_0x68bc('0x11b')](db['SmsInteraction'],{'as':_0x68bc('0x173')});db[_0x68bc('0x5a')][_0x68bc('0x11b')](db[_0x68bc('0x5c')],{'as':'Applications','foreignKey':_0x68bc('0x191'),'onDelete':_0x68bc('0x11a')});db['SmsAccount'][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db['SmsAccount'][_0x68bc('0x12a')](db[_0x68bc('0x90')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x68bc('0x5a')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x192')});db['SmsApplication'][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x5c')][_0x68bc('0x12a')](db['SmsQueue'],{'onDelete':_0x68bc('0x16f')});db['SmsApplication']['belongsTo'](db[_0x68bc('0x5a')],{'onDelete':'restrict'});db[_0x68bc('0x5c')][_0x68bc('0x12a')](db[_0x68bc('0x8e')],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x15d')});db[_0x68bc('0x5c')]['belongsTo'](db['Tag'],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x184')});db[_0x68bc('0x5e')][_0x68bc('0x11b')](db['SmsMessage'],{'as':_0x68bc('0x177'),'onDelete':'cascade','foreignKey':_0x68bc('0x193')});db[_0x68bc('0x5e')][_0x68bc('0x12a')](db[_0x68bc('0x5a')],{'as':_0x68bc('0x179'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db['SmsInteraction'][_0x68bc('0x12a')](db['User'],{'as':_0x68bc('0x17a'),'foreignKey':'UserId'});db[_0x68bc('0x5e')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x194'),'as':_0x68bc('0x17d')});db['SmsInteraction']['belongsToMany'](db[_0x68bc('0x17b')],{'through':_0x68bc('0x194'),'as':_0x68bc('0x17e')});db['SmsInteraction']['belongsToMany'](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'through':_0x68bc('0x137'),'foreignKey':_0x68bc('0x193')});db[_0x68bc('0x60')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x12')});db['SmsMessage'][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0x68bc('0x12a')](db[_0x68bc('0x5e')],{'onDelete':_0x68bc('0x11a'),'as':_0x68bc('0x181'),'foreignKey':_0x68bc('0x193')});db[_0x68bc('0x60')][_0x68bc('0x12a')](db[_0x68bc('0x5a')],{'as':_0x68bc('0x179'),'foreignKey':'SmsAccountId'});db[_0x68bc('0x62')]['belongsToMany'](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x3b'),'foreignKey':'SmsQueueId'});db[_0x68bc('0x62')][_0x68bc('0x12c')](db[_0x68bc('0xf1')],{'through':'team_has_sms_queues','as':_0x68bc('0x18f')});db['OpenchannelAccount']['hasMany'](db[_0x68bc('0x8b')],{'as':'Dispositions','foreignKey':_0x68bc('0x195'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x148')][_0x68bc('0x11b')](db[_0x68bc('0x8a')],{'as':_0x68bc('0x189'),'foreignKey':_0x68bc('0x195')});db[_0x68bc('0x148')][_0x68bc('0x11b')](db[_0x68bc('0x66')],{'as':'Interactions','foreignKey':_0x68bc('0x195')});db[_0x68bc('0x148')][_0x68bc('0x11b')](db[_0x68bc('0x68')],{'as':_0x68bc('0x177'),'foreignKey':_0x68bc('0x195')});db[_0x68bc('0x148')][_0x68bc('0x11b')](db[_0x68bc('0x65')],{'as':_0x68bc('0x151'),'foreignKey':_0x68bc('0x195'),'onDelete':'cascade'});db['OpenchannelAccount'][_0x68bc('0x12a')](db['CmList'],{'as':_0x68bc('0x185'),'foreignKey':'ListId'});db[_0x68bc('0x148')]['belongsTo'](db[_0x68bc('0x90')],{'as':_0x68bc('0x15e'),'foreignKey':_0x68bc('0x15f')});db['OpenchannelAccount'][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x14a')});db[_0x68bc('0x65')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x65')][_0x68bc('0x12a')](db[_0x68bc('0x6a')],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x196')});db[_0x68bc('0x65')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x195')});db[_0x68bc('0x65')][_0x68bc('0x12a')](db['Interval'],{'onDelete':_0x68bc('0x16f'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x68bc('0x12a')](db['Tag'],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x184')});db[_0x68bc('0x66')][_0x68bc('0x11b')](db[_0x68bc('0x68')],{'as':_0x68bc('0x177'),'onDelete':_0x68bc('0x11a'),'foreignKey':'OpenchannelInteractionId'});db[_0x68bc('0x66')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x195')});db[_0x68bc('0x66')]['belongsTo'](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17a'),'foreignKey':_0x68bc('0x119')});db[_0x68bc('0x66')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x197'),'as':'Tags'});db[_0x68bc('0x66')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x197'),'as':_0x68bc('0x17e')});db['OpenchannelInteraction'][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'through':_0x68bc('0x198'),'foreignKey':_0x68bc('0x199')});db[_0x68bc('0x68')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':'cascade','as':_0x68bc('0x12')});db['OpenchannelMessage'][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'onDelete':'cascade','as':'Contact'});db[_0x68bc('0x68')][_0x68bc('0x12a')](db[_0x68bc('0x66')],{'onDelete':_0x68bc('0x11a'),'as':_0x68bc('0x181'),'foreignKey':_0x68bc('0x199')});db['OpenchannelMessage'][_0x68bc('0x12a')](db[_0x68bc('0xf8')],{'as':_0x68bc('0xf8'),'foreignKey':_0x68bc('0x19a')});db[_0x68bc('0x68')][_0x68bc('0x12a')](db[_0x68bc('0x148')],{'as':_0x68bc('0x179'),'foreignKey':'OpenchannelAccountId'});db[_0x68bc('0x6a')][_0x68bc('0x12c')](db['User'],{'as':_0x68bc('0x162'),'through':_0x68bc('0x3d'),'foreignKey':_0x68bc('0x196')});db[_0x68bc('0x6a')][_0x68bc('0x12c')](db[_0x68bc('0xf1')],{'through':_0x68bc('0x19b'),'as':'Teams'});db['ChatWebsite']['hasMany'](db[_0x68bc('0x8b')],{'as':_0x68bc('0x172'),'foreignKey':'ChatWebsiteId','onDelete':_0x68bc('0x11a')});db[_0x68bc('0x143')][_0x68bc('0x11b')](db[_0x68bc('0x8a')],{'as':_0x68bc('0x189'),'foreignKey':_0x68bc('0x182')});db[_0x68bc('0x143')][_0x68bc('0x11b')](db[_0x68bc('0x19c')],{'as':_0x68bc('0x19d')});db[_0x68bc('0x143')][_0x68bc('0x11b')](db['ChatInteraction'],{'as':_0x68bc('0x173')});db[_0x68bc('0x143')][_0x68bc('0x11b')](db[_0x68bc('0x6e')],{'as':_0x68bc('0x151'),'foreignKey':'ChatWebsiteId','onDelete':_0x68bc('0x11a')});db['ChatWebsite'][_0x68bc('0x11b')](db[_0x68bc('0x71')],{'as':_0x68bc('0x177')});db[_0x68bc('0x143')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0x143')][_0x68bc('0x12a')](db[_0x68bc('0x8e')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x68bc('0x143')][_0x68bc('0x12a')](db['MailAccount'],{'as':_0x68bc('0x44'),'foreignKey':'MailAccountId'});db[_0x68bc('0x143')][_0x68bc('0x12a')](db[_0x68bc('0x90')],{'as':_0x68bc('0x15e'),'foreignKey':_0x68bc('0x15f')});db['ChatWebsite'][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x68bc('0x12a')](db[_0x68bc('0x148')],{});db[_0x68bc('0x19e')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db['OpenchannelQueueReport'][_0x68bc('0x12a')](db['CmContact'],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x19e')]['belongsTo'](db[_0x68bc('0x66')],{});db[_0x68bc('0x19e')][_0x68bc('0x12a')](db[_0x68bc('0x68')],{});db[_0x68bc('0x19e')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{});db[_0x68bc('0x19e')][_0x68bc('0x12a')](db[_0x68bc('0x6a')],{});db[_0x68bc('0x6e')][_0x68bc('0x12a')](db['User'],{'as':'Agent','foreignKey':'UserId','onDelete':_0x68bc('0x16f')});db[_0x68bc('0x6e')][_0x68bc('0x12a')](db[_0x68bc('0x75')],{'as':'Queue','foreignKey':_0x68bc('0x19f'),'onDelete':'restrict'});db[_0x68bc('0x6e')][_0x68bc('0x12a')](db[_0x68bc('0x143')],{'as':_0x68bc('0x1a0'),'foreignKey':_0x68bc('0x182'),'onDelete':'restrict'});db[_0x68bc('0x6e')][_0x68bc('0x12a')](db[_0x68bc('0x17b')],{'onDelete':'restrict','foreignKey':_0x68bc('0x184')});db[_0x68bc('0x70')]['hasMany'](db[_0x68bc('0x71')],{'as':_0x68bc('0x177'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1a1')});db['ChatInteraction'][_0x68bc('0x12a')](db['ChatWebsite'],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x182')});db[_0x68bc('0x70')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':'Contact','foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x70')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17a'),'foreignKey':_0x68bc('0x119')});db['ChatInteraction']['belongsToMany'](db[_0x68bc('0x17b')],{'through':_0x68bc('0x1a2'),'as':_0x68bc('0x17d')});db[_0x68bc('0x70')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x1a2'),'as':_0x68bc('0x17e')});db[_0x68bc('0x70')]['belongsToMany'](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'through':_0x68bc('0x133'),'foreignKey':'ChatInteractionId'});db[_0x68bc('0x71')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x11a'),'as':_0x68bc('0x12')});db[_0x68bc('0x71')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'onDelete':'cascade','as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x71')][_0x68bc('0x12a')](db[_0x68bc('0x70')],{'onDelete':'cascade','as':_0x68bc('0x181'),'foreignKey':'ChatInteractionId'});db[_0x68bc('0x71')][_0x68bc('0x12a')](db['Attachment'],{'as':_0x68bc('0xf8'),'foreignKey':_0x68bc('0x19a')});db[_0x68bc('0x71')][_0x68bc('0x12a')](db[_0x68bc('0x143')],{'as':'Account','foreignKey':_0x68bc('0x182')});db[_0x68bc('0x73')]['hasMany'](db[_0x68bc('0xf8')],{'as':_0x68bc('0x180'),'foreignKey':_0x68bc('0x183'),'onDelete':_0x68bc('0x11a'),'hooks':!![]});db[_0x68bc('0x73')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'onDelete':_0x68bc('0x11a'),'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x73')][_0x68bc('0x12a')](db[_0x68bc('0x143')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x182')});db['ChatQueue'][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x35'),'hooks':!![]});db[_0x68bc('0x75')]['belongsToMany'](db[_0x68bc('0xf1')],{'through':_0x68bc('0x1a3'),'as':_0x68bc('0x18f')});db[_0x68bc('0x77')][_0x68bc('0x11b')](db[_0x68bc('0xdd')],{'as':_0x68bc('0x177'),'foreignKey':_0x68bc('0x1a4'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x77')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x1a5'),'through':_0x68bc('0x1a6')});db['ChatProactiveAction'][_0x68bc('0x12a')](db[_0x68bc('0x143')],{'as':_0x68bc('0x1a0'),'foreignKey':_0x68bc('0x182')});db[_0x68bc('0x7a')]['hasMany'](db['CmContact'],{'as':_0x68bc('0x12f'),'foreignKey':'CompanyId'});db[_0x68bc('0x12e')]['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x68bc('0x1a7')});db[_0x68bc('0x12e')][_0x68bc('0x11b')](db[_0x68bc('0x7d')],{'as':_0x68bc('0x156'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x12e')][_0x68bc('0x11b')](db[_0x68bc('0x157')],{'as':_0x68bc('0x11f'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x12e')][_0x68bc('0x11b')](db[_0x68bc('0x81')],{'as':_0x68bc('0x1a8'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x12e')]['hasMany'](db[_0x68bc('0x83')],{'as':_0x68bc('0x83'),'foreignKey':_0x68bc('0x16b')});db['CmContact'][_0x68bc('0x11b')](db[_0x68bc('0xe2')],{'as':_0x68bc('0x15a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x12e')][_0x68bc('0x11b')](db['OpenchannelInteraction'],{'as':_0x68bc('0x121'),'foreignKey':'ContactId','onDelete':_0x68bc('0x16f')});db[_0x68bc('0x12e')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x68bc('0x16b'),'onDelete':'restrict'});db[_0x68bc('0x12e')][_0x68bc('0x11b')](db[_0x68bc('0x5e')],{'as':_0x68bc('0x136'),'foreignKey':_0x68bc('0x16b'),'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x12e')]['hasMany'](db[_0x68bc('0x54')],{'as':_0x68bc('0x134'),'foreignKey':_0x68bc('0x16b'),'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x12e')][_0x68bc('0x11b')](db[_0x68bc('0x123')],{'as':_0x68bc('0x124'),'foreignKey':_0x68bc('0x16b'),'onDelete':_0x68bc('0x16f')});db['CmContact'][_0x68bc('0x12a')](db[_0x68bc('0x7a')],{'as':_0x68bc('0x1a9'),'foreignKey':_0x68bc('0x1aa')});db[_0x68bc('0x12e')][_0x68bc('0x12a')](db['CmList'],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174'),'onDelete':'cascade'});db[_0x68bc('0x12e')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':'Users','through':_0x68bc('0x130')});db['CmContact'][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'as':_0x68bc('0x17d'),'through':_0x68bc('0x1ab')});db[_0x68bc('0x12e')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':'cm_contact_has_tags','as':_0x68bc('0x17e')});db['CmHopper'][_0x68bc('0x11b')](db[_0x68bc('0x9c')],{'as':_0x68bc('0x1ac'),'foreignKey':_0x68bc('0x1ad')});db[_0x68bc('0x7d')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b'),'onDelete':_0x68bc('0x11a')});db['CmHopper'][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174'),'onDelete':'cascade'});db[_0x68bc('0x7d')]['belongsTo'](db[_0x68bc('0x12')],{'as':'Agent','foreignKey':'UserId'});db['CmHopper']['belongsTo'](db[_0x68bc('0x1c')],{'as':'Queue','foreignKey':_0x68bc('0x155'),'onDelete':'cascade'});db['CmHopper'][_0x68bc('0x12a')](db[_0x68bc('0x1ae')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x68bc('0x11a')});db[_0x68bc('0x7d')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17a'),'foreignKey':_0x68bc('0x1af')});db[_0x68bc('0x158')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x158')]['belongsTo'](db[_0x68bc('0x102')],{'as':'List','foreignKey':_0x68bc('0x174'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x158')]['belongsTo'](db['VoiceQueue'],{'as':_0x68bc('0x1b0'),'foreignKey':_0x68bc('0x155'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x158')]['belongsTo'](db['Campaign'],{'as':_0x68bc('0x1ae'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x68bc('0x88')][_0x68bc('0x11b')](db[_0x68bc('0x1b1')],{'as':{'plural':'All','singular':_0x68bc('0x1b2')},'foreignKey':_0x68bc('0x1b3'),'onDelete':_0x68bc('0x11a'),'hooks':!![]});db[_0x68bc('0x88')][_0x68bc('0x11b')](db[_0x68bc('0x1b1')],{'as':{'plural':_0x68bc('0x1b4'),'singular':'OneAny'},'foreignKey':_0x68bc('0x1b5'),'onDelete':_0x68bc('0x11a'),'hooks':!![]});db['Automation'][_0x68bc('0x11b')](db['Action'],{'as':_0x68bc('0x1b6'),'foreignKey':_0x68bc('0x1b7'),'onDelete':'cascade','hooks':!![]});db[_0x68bc('0x8b')][_0x68bc('0x11b')](db[_0x68bc('0x8b')],{'as':_0x68bc('0x172'),'foreignKey':_0x68bc('0x1b8'),'onDelete':_0x68bc('0x11a')});db['Interval'][_0x68bc('0x11b')](db[_0x68bc('0x8e')],{'as':_0x68bc('0x1b9'),'foreignKey':'IntervalId','onDelete':_0x68bc('0x11a'),'hooks':!![],'required':![]});db[_0x68bc('0x8e')][_0x68bc('0x11b')](db[_0x68bc('0x19')],{'as':_0x68bc('0x11e'),'foreignKey':_0x68bc('0x15d'),'onDelete':'restrict'});db[_0x68bc('0x8e')][_0x68bc('0x11b')](db[_0x68bc('0x4c')],{'as':'MailApplications','foreignKey':_0x68bc('0x15d')});db[_0x68bc('0x8e')]['hasMany'](db[_0x68bc('0x6e')],{'as':_0x68bc('0x1ba'),'foreignKey':'IntervalId'});db[_0x68bc('0x8e')][_0x68bc('0x11b')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x68bc('0x8e')][_0x68bc('0x11b')](db[_0x68bc('0x5c')],{'as':_0x68bc('0x1bb'),'foreignKey':_0x68bc('0x15d')});db['Schedule'][_0x68bc('0x12a')](db[_0x68bc('0x44')],{});db[_0x68bc('0x96')][_0x68bc('0x12a')](db[_0x68bc('0xa8')],{'foreignKey':_0x68bc('0x1bc')});db[_0x68bc('0x96')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x68bc('0x1bd')});db[_0x68bc('0x97')][_0x68bc('0x12c')](db[_0x68bc('0x152')],{'as':_0x68bc('0x1be'),'through':_0x68bc('0x154'),'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x17b')][_0x68bc('0x12c')](db[_0x68bc('0x12e')],{'through':_0x68bc('0x1ab')});db['Tag'][_0x68bc('0x12c')](db[_0x68bc('0x70')],{'through':_0x68bc('0x1a2')});db[_0x68bc('0x17b')][_0x68bc('0x12c')](db[_0x68bc('0x123')],{'through':_0x68bc('0x17c')});db[_0x68bc('0x17b')][_0x68bc('0x12c')](db[_0x68bc('0x5e')],{'through':_0x68bc('0x194')});db[_0x68bc('0x17b')][_0x68bc('0x12c')](db[_0x68bc('0x54')],{'through':_0x68bc('0x18d')});db[_0x68bc('0x17b')][_0x68bc('0x12c')](db[_0x68bc('0x66')],{'through':_0x68bc('0x197')});db[_0x68bc('0x17b')][_0x68bc('0x12c')](db[_0x68bc('0x10a')],{'through':_0x68bc('0x1bf')});db[_0x68bc('0x1c0')][_0x68bc('0x12a')](db[_0x68bc('0x1c1')],{'as':_0x68bc('0x1c2'),'foreignKey':'ItemTypeId'});db[_0x68bc('0x9c')][_0x68bc('0x12a')](db[_0x68bc('0x7d')],{'as':'Hopper','foreignKey':_0x68bc('0x1ad')});db['CmContactHasItem']['belongsTo'](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x1a7')});db['Trigger'][_0x68bc('0x11b')](db[_0x68bc('0x1b1')],{'as':{'plural':_0x68bc('0x1c3'),'singular':_0x68bc('0x1c4')},'foreignKey':'TriggerAllId','onDelete':_0x68bc('0x11a'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x68bc('0x1b1')],{'as':{'plural':_0x68bc('0x1c5'),'singular':_0x68bc('0x1c6')},'foreignKey':_0x68bc('0x1c7'),'onDelete':'cascade','hooks':!![]});db[_0x68bc('0x9f')][_0x68bc('0x11b')](db[_0x68bc('0x86')],{'as':_0x68bc('0x1b6'),'foreignKey':_0x68bc('0x1c8'),'onDelete':_0x68bc('0x11a'),'hooks':!![]});db[_0x68bc('0xa6')][_0x68bc('0x11b')](db[_0x68bc('0x1c9')],{'as':_0x68bc('0x1ca'),'onDelete':_0x68bc('0x11a'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x68bc('0xa8')][_0x68bc('0x11b')](db[_0x68bc('0x1c9')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x68bc('0x1bc')});db['AnalyticMetric'][_0x68bc('0x11b')](db[_0x68bc('0x1c9')],{'as':_0x68bc('0x1ca'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cb')});db[_0x68bc('0x1c9')][_0x68bc('0x12a')](db[_0x68bc('0xac')],{'foreignKey':'MetricId'});db[_0x68bc('0xaf')][_0x68bc('0x11b')](db[_0x68bc('0xb0')],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xb0')]['hasMany'](db[_0x68bc('0xb2')],{'as':_0x68bc('0x1ce'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xb0')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xb0')][_0x68bc('0x11b')](db[_0x68bc('0xb2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xb0')][_0x68bc('0x12a')](db[_0x68bc('0xaf')],{'as':'Account','foreignKey':'AccountId'});db[_0x68bc('0xb2')][_0x68bc('0x11b')](db['SalesforceField'],{'as':_0x68bc('0x1d2'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xb2')][_0x68bc('0x11b')](db[_0x68bc('0xb2')],{'as':_0x68bc('0x1d3'),'foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xb2')][_0x68bc('0x11b')](db[_0x68bc('0xb2')],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xb2')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x68bc('0xb4')][_0x68bc('0x11b')](db['SugarcrmConfiguration'],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cd')});db['SugarcrmConfiguration'][_0x68bc('0x11b')](db[_0x68bc('0xb8')],{'as':_0x68bc('0x1ce'),'onDelete':_0x68bc('0x11a'),'foreignKey':'SubjectId'});db[_0x68bc('0xb6')][_0x68bc('0x11b')](db[_0x68bc('0xb8')],{'as':_0x68bc('0x1d5'),'onDelete':'cascade','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xb6')][_0x68bc('0x11b')](db[_0x68bc('0xb8')],{'as':_0x68bc('0x1ca'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1d1')});db['SugarcrmConfiguration'][_0x68bc('0x12a')](db['SugarcrmAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x68bc('0xb8')][_0x68bc('0x11b')](db[_0x68bc('0xb8')],{'as':_0x68bc('0x1d2'),'foreignKey':'SubjectId'});db[_0x68bc('0xb8')]['hasMany'](db[_0x68bc('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x68bc('0xb8')][_0x68bc('0x11b')](db[_0x68bc('0xb8')],{'as':'Field','foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xb8')][_0x68bc('0x12a')](db[_0x68bc('0xa1')],{'as':_0x68bc('0xa1'),'foreignKey':_0x68bc('0x1d6')});db[_0x68bc('0xba')][_0x68bc('0x11b')](db[_0x68bc('0xbc')],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':'AccountId'});db[_0x68bc('0xbc')][_0x68bc('0x11b')](db[_0x68bc('0xbe')],{'as':_0x68bc('0x1ce'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cf')});db['DeskConfiguration'][_0x68bc('0x11b')](db[_0x68bc('0xbe')],{'as':'Descriptions','onDelete':_0x68bc('0x11a'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x68bc('0x11b')](db['DeskField'],{'as':_0x68bc('0x1ca'),'onDelete':'cascade','foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xbc')]['belongsTo'](db[_0x68bc('0xba')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xbc')]['belongsToMany'](db['Tag'],{'through':_0x68bc('0x1d7')});db[_0x68bc('0xbe')][_0x68bc('0x11b')](db[_0x68bc('0xbe')],{'as':_0x68bc('0x1d2'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xbe')][_0x68bc('0x11b')](db[_0x68bc('0xbe')],{'as':_0x68bc('0x1d3'),'foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xbe')][_0x68bc('0x11b')](db['DeskField'],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xbe')][_0x68bc('0x12a')](db[_0x68bc('0xa1')],{'as':'Variable','foreignKey':_0x68bc('0x1d6')});db['ZohoAccount'][_0x68bc('0x11b')](db[_0x68bc('0xc1')],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xc1')]['hasMany'](db['ZohoField'],{'as':_0x68bc('0x1ce'),'onDelete':'cascade','foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xc1')][_0x68bc('0x11b')](db[_0x68bc('0xc2')],{'as':_0x68bc('0x1d5'),'onDelete':'cascade','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xc1')]['hasMany'](db[_0x68bc('0xc2')],{'as':_0x68bc('0x1ca'),'onDelete':_0x68bc('0x11a'),'foreignKey':'FieldId'});db[_0x68bc('0xc1')]['belongsTo'](db[_0x68bc('0x1d8')],{'as':_0x68bc('0x179'),'foreignKey':'AccountId'});db[_0x68bc('0xc2')][_0x68bc('0x11b')](db[_0x68bc('0xc2')],{'as':_0x68bc('0x1d2'),'foreignKey':_0x68bc('0x1cf')});db['ZohoField']['hasMany'](db[_0x68bc('0xc2')],{'as':'Description','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xc2')][_0x68bc('0x11b')](db['ZohoField'],{'as':'Field','foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xc2')]['belongsTo'](db['Variable'],{'as':_0x68bc('0xa1'),'foreignKey':_0x68bc('0x1d6')});db[_0x68bc('0x1d9')][_0x68bc('0x11b')](db['ZendeskConfiguration'],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xc4')][_0x68bc('0x11b')](db[_0x68bc('0x1da')],{'as':_0x68bc('0x1ce'),'foreignKey':'SubjectId'});db[_0x68bc('0xc4')]['hasMany'](db[_0x68bc('0x1da')],{'as':_0x68bc('0x1d5'),'foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xc4')]['hasMany'](db[_0x68bc('0x1da')],{'as':_0x68bc('0x1ca'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xc4')][_0x68bc('0x12a')](db[_0x68bc('0x1d9')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xc4')]['belongsToMany'](db[_0x68bc('0x17b')],{'through':_0x68bc('0x1db')});db[_0x68bc('0x1da')]['hasMany'](db['ZendeskField'],{'as':_0x68bc('0x1d2'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0x1da')][_0x68bc('0x11b')](db[_0x68bc('0x1da')],{'as':'Description','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0x1da')][_0x68bc('0x11b')](db[_0x68bc('0x1da')],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0x1da')][_0x68bc('0x12a')](db['Variable'],{'as':_0x68bc('0xa1'),'foreignKey':_0x68bc('0x1d6')});db['FreshdeskAccount'][_0x68bc('0x11b')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cd')});db['FreshdeskConfiguration']['hasMany'](db[_0x68bc('0x1dc')],{'as':_0x68bc('0x1ce'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xc7')]['hasMany'](db['FreshdeskField'],{'as':_0x68bc('0x1d5'),'onDelete':_0x68bc('0x11a'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db[_0x68bc('0x1dc')],{'as':_0x68bc('0x1ca'),'onDelete':_0x68bc('0x11a'),'foreignKey':'FieldId'});db[_0x68bc('0xc7')][_0x68bc('0x12a')](db[_0x68bc('0x1dd')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xc7')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x1de')});db[_0x68bc('0x1dc')]['hasMany'](db[_0x68bc('0x1dc')],{'as':'Subject','foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0x1dc')][_0x68bc('0x11b')](db[_0x68bc('0x1dc')],{'as':_0x68bc('0x1d3'),'foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0x1dc')][_0x68bc('0x11b')](db[_0x68bc('0x1dc')],{'as':'Field','foreignKey':_0x68bc('0x1d1')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x68bc('0x1d6')});db[_0x68bc('0x1df')][_0x68bc('0x11b')](db[_0x68bc('0xc9')],{'as':'Configurations','onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xc9')]['hasMany'](db['VtigerField'],{'as':_0x68bc('0x1ce'),'foreignKey':'SubjectId'});db[_0x68bc('0xc9')][_0x68bc('0x11b')](db[_0x68bc('0x1e0')],{'as':_0x68bc('0x1d5'),'foreignKey':_0x68bc('0x1d0')});db['VtigerConfiguration']['hasMany'](db[_0x68bc('0x1e0')],{'as':'Fields','foreignKey':'FieldId'});db[_0x68bc('0xc9')]['belongsTo'](db[_0x68bc('0x1df')],{'as':_0x68bc('0x179'),'foreignKey':'AccountId'});db[_0x68bc('0x1e0')][_0x68bc('0x11b')](db['VtigerField'],{'as':'Subject','foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0x1e0')][_0x68bc('0x11b')](db['VtigerField'],{'as':_0x68bc('0x1d3'),'foreignKey':_0x68bc('0x1d0')});db['VtigerField'][_0x68bc('0x11b')](db[_0x68bc('0x1e0')],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db['VtigerField'][_0x68bc('0x12a')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x68bc('0x1e1')][_0x68bc('0x11b')](db[_0x68bc('0xcd')],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x68bc('0x11b')](db[_0x68bc('0xce')],{'as':_0x68bc('0x1ce'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xcd')][_0x68bc('0x11b')](db[_0x68bc('0xce')],{'as':'Descriptions','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xcd')][_0x68bc('0x11b')](db[_0x68bc('0xce')],{'as':_0x68bc('0x1ca'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xcd')][_0x68bc('0x12a')](db[_0x68bc('0x1e1')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xce')][_0x68bc('0x11b')](db[_0x68bc('0xce')],{'as':'Subject','foreignKey':_0x68bc('0x1cf')});db['ServicenowField'][_0x68bc('0x11b')](db[_0x68bc('0xce')],{'as':_0x68bc('0x1d3'),'foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xce')][_0x68bc('0x11b')](db['ServicenowField'],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xce')][_0x68bc('0x12a')](db[_0x68bc('0xa1')],{'as':'Variable','foreignKey':'VariableId'});db[_0x68bc('0xd0')][_0x68bc('0x11b')](db[_0x68bc('0xd2')],{'as':_0x68bc('0x1cc'),'onDelete':'cascade','foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xd0')][_0x68bc('0x12a')](db[_0x68bc('0x16d')],{'as':'CloudProvider','foreignKey':_0x68bc('0x16e')});db[_0x68bc('0xd2')][_0x68bc('0x11b')](db['Dynamics365Field'],{'as':_0x68bc('0x1ce'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xd2')]['hasMany'](db[_0x68bc('0xd3')],{'as':_0x68bc('0x1d5'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x68bc('0x11b')](db[_0x68bc('0xd3')],{'as':_0x68bc('0x1ca'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x68bc('0xd2')]['belongsTo'](db[_0x68bc('0xd0')],{'as':_0x68bc('0x179'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x68bc('0x11b')](db[_0x68bc('0xd3')],{'as':'Subject','foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xd3')][_0x68bc('0x11b')](db[_0x68bc('0xd3')],{'as':'Description','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xd3')]['hasMany'](db['Dynamics365Field'],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xd3')]['belongsTo'](db[_0x68bc('0xa1')],{'as':_0x68bc('0xa1'),'foreignKey':_0x68bc('0x1d6')});db['FreshsalesAccount'][_0x68bc('0x11b')](db['FreshsalesConfiguration'],{'as':_0x68bc('0x1cc'),'onDelete':_0x68bc('0x11a'),'foreignKey':'AccountId'});db[_0x68bc('0xd5')][_0x68bc('0x11b')](db[_0x68bc('0xd7')],{'as':_0x68bc('0x1ce'),'foreignKey':'SubjectId'});db[_0x68bc('0xd5')][_0x68bc('0x11b')](db[_0x68bc('0xd7')],{'as':_0x68bc('0x1d5'),'foreignKey':'DescriptionId'});db[_0x68bc('0xd5')][_0x68bc('0x11b')](db[_0x68bc('0xd7')],{'as':_0x68bc('0x1ca'),'foreignKey':'FieldId'});db[_0x68bc('0xd5')][_0x68bc('0x12a')](db[_0x68bc('0x1e2')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x1cd')});db[_0x68bc('0xd7')][_0x68bc('0x11b')](db[_0x68bc('0xd7')],{'as':_0x68bc('0x1d2'),'foreignKey':_0x68bc('0x1cf')});db[_0x68bc('0xd7')]['hasMany'](db['FreshsalesField'],{'as':'Description','foreignKey':_0x68bc('0x1d0')});db[_0x68bc('0xd7')]['hasMany'](db['FreshsalesField'],{'as':_0x68bc('0x1d4'),'foreignKey':_0x68bc('0x1d1')});db[_0x68bc('0xd7')]['belongsTo'](db['Variable'],{'as':_0x68bc('0xa1'),'foreignKey':_0x68bc('0x1d6')});db[_0x68bc('0xdb')]['belongsTo'](db['ChatWebsite'],{});db[_0x68bc('0xdb')]['belongsTo'](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0xdb')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x68bc('0x70')],{});db[_0x68bc('0xdb')][_0x68bc('0x12a')](db[_0x68bc('0x71')],{});db[_0x68bc('0xdb')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{});db[_0x68bc('0xdb')][_0x68bc('0x12a')](db[_0x68bc('0x75')],{});db[_0x68bc('0xdd')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1e3')});db[_0x68bc('0xdd')]['belongsTo'](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x1e4')});db[_0x68bc('0xe2')][_0x68bc('0x11b')](db[_0x68bc('0xe0')],{'foreignKey':_0x68bc('0x1e5'),'onDelete':_0x68bc('0x11a')});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db[_0x68bc('0x5a')],{});db[_0x68bc('0xe4')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':'List','foreignKey':_0x68bc('0x174')});db[_0x68bc('0xe4')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':'Contact','foreignKey':_0x68bc('0x16b')});db[_0x68bc('0xe4')][_0x68bc('0x12a')](db[_0x68bc('0x5e')],{});db[_0x68bc('0xe4')][_0x68bc('0x12a')](db[_0x68bc('0x60')],{});db[_0x68bc('0xe4')]['belongsTo'](db[_0x68bc('0x12')],{});db[_0x68bc('0xe4')][_0x68bc('0x12a')](db['SmsQueue'],{});db[_0x68bc('0xea')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x68bc('0x1e6')});db[_0x68bc('0xea')][_0x68bc('0x11b')](db[_0x68bc('0xe0')],{'foreignKey':_0x68bc('0x1e6')});db[_0x68bc('0xea')][_0x68bc('0x11b')](db[_0x68bc('0x1e7')],{'foreignKey':_0x68bc('0x1e6')});db[_0x68bc('0xf1')]['belongsToMany'](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':_0x68bc('0x131')});db[_0x68bc('0xf1')][_0x68bc('0x12c')](db[_0x68bc('0x1c')],{'through':'TeamVoiceQueue','as':_0x68bc('0x139')});db[_0x68bc('0xf1')][_0x68bc('0x12c')](db[_0x68bc('0x46')],{'through':'team_has_mail_queues','as':_0x68bc('0x13b')});db[_0x68bc('0xf1')][_0x68bc('0x12c')](db[_0x68bc('0x75')],{'through':_0x68bc('0x1a3'),'as':_0x68bc('0x13c')});db['Team'][_0x68bc('0x12c')](db[_0x68bc('0x57')],{'through':_0x68bc('0x18e'),'as':_0x68bc('0x13d')});db[_0x68bc('0xf1')]['belongsToMany'](db[_0x68bc('0x62')],{'through':_0x68bc('0x1e8'),'as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x68bc('0x6a')],{'through':_0x68bc('0x19b'),'as':_0x68bc('0x13f')});db[_0x68bc('0xf1')][_0x68bc('0x12c')](db['WhatsappQueue'],{'through':_0x68bc('0x1e9'),'as':_0x68bc('0x141')});db[_0x68bc('0xf1')][_0x68bc('0x12c')](db[_0x68bc('0x104')],{'through':_0x68bc('0x112'),'as':_0x68bc('0x13a')});db['Campaign']['hasMany'](db[_0x68bc('0x7d')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0x68bc('0x11b')](db[_0x68bc('0x157')],{'as':_0x68bc('0x11f'),'foreignKey':'CampaignId'});db[_0x68bc('0x1ae')][_0x68bc('0x11b')](db[_0x68bc('0x81')],{'as':_0x68bc('0x1a8'),'foreignKey':_0x68bc('0x1ea')});db['Campaign'][_0x68bc('0x11b')](db[_0x68bc('0x158')],{'as':_0x68bc('0x159'),'foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db[_0x68bc('0x2e')],{'as':_0x68bc('0x2e'),'foreignKey':_0x68bc('0x1eb')});db[_0x68bc('0x1ae')][_0x68bc('0x12a')](db[_0x68bc('0x2e')],{'as':_0x68bc('0x15b'),'foreignKey':_0x68bc('0x15c')});db['Campaign'][_0x68bc('0x12a')](db[_0x68bc('0x8e')],{'as':_0x68bc('0x8e'),'foreignKey':_0x68bc('0x15d')});db[_0x68bc('0x1ae')][_0x68bc('0x12a')](db[_0x68bc('0x1ec')],{'as':_0x68bc('0x1ec'),'foreignKey':_0x68bc('0x1ed')});db[_0x68bc('0x1ae')]['belongsToMany'](db[_0x68bc('0x102')],{'as':_0x68bc('0x160'),'through':_0x68bc('0x1ee')});db[_0x68bc('0x1ae')]['belongsToMany'](db[_0x68bc('0x102')],{'as':'BlackLists','through':_0x68bc('0x1ef')});db[_0x68bc('0xf8')]['belongsTo'](db[_0x68bc('0x73')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x68bc('0xfb')][_0x68bc('0x12a')](db['MailMessage'],{});db[_0x68bc('0xfb')][_0x68bc('0x12a')](db[_0x68bc('0x123')],{});db[_0x68bc('0xfb')][_0x68bc('0x12a')](db[_0x68bc('0x44')],{'foreignKey':_0x68bc('0x1f0'),'as':_0x68bc('0x1f1')});db[_0x68bc('0xfb')][_0x68bc('0x12a')](db['User'],{'foreignKey':_0x68bc('0x1f2'),'as':_0x68bc('0x1f3')});db[_0x68bc('0xfb')]['belongsTo'](db[_0x68bc('0x12')],{'foreignKey':_0x68bc('0x1f4'),'as':'ToAgent'});db[_0x68bc('0xfb')][_0x68bc('0x12a')](db['MailQueue'],{'foreignKey':_0x68bc('0x1f5'),'as':_0x68bc('0x1f6')});db[_0x68bc('0xfb')][_0x68bc('0x12a')](db[_0x68bc('0x44')],{'foreignKey':'ToMailAccountId','as':_0x68bc('0x1f7')});db[_0x68bc('0xfc')]['belongsTo'](db[_0x68bc('0x71')],{});db['ChatTransferReport'][_0x68bc('0x12a')](db[_0x68bc('0x70')],{});db[_0x68bc('0xfc')][_0x68bc('0x12a')](db[_0x68bc('0x143')],{'foreignKey':_0x68bc('0x1f8'),'as':_0x68bc('0x1f1')});db[_0x68bc('0xfc')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'foreignKey':_0x68bc('0x1f2'),'as':'FromAgent'});db['ChatTransferReport']['belongsTo'](db[_0x68bc('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x68bc('0xfc')][_0x68bc('0x12a')](db[_0x68bc('0x75')],{'foreignKey':_0x68bc('0x1f9'),'as':_0x68bc('0x1f6')});db[_0x68bc('0xfc')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x68bc('0x1fa'),'as':'ToAccount'});db[_0x68bc('0xfe')][_0x68bc('0x12a')](db[_0x68bc('0x55')],{});db['FaxTransferReport']['belongsTo'](db[_0x68bc('0x54')],{});db[_0x68bc('0xfe')][_0x68bc('0x12a')](db[_0x68bc('0x51')],{'foreignKey':_0x68bc('0x1fb'),'as':_0x68bc('0x1f1')});db[_0x68bc('0xfe')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'foreignKey':'FromUserId','as':_0x68bc('0x1f3')});db[_0x68bc('0xfe')]['belongsTo'](db[_0x68bc('0x12')],{'foreignKey':_0x68bc('0x1f4'),'as':_0x68bc('0x1fc')});db[_0x68bc('0xfe')][_0x68bc('0x12a')](db[_0x68bc('0x57')],{'foreignKey':'ToFaxQueueId','as':_0x68bc('0x1f6')});db[_0x68bc('0xfe')][_0x68bc('0x12a')](db['FaxAccount'],{'foreignKey':_0x68bc('0x1fd'),'as':_0x68bc('0x1f7')});db[_0x68bc('0xff')][_0x68bc('0x12a')](db[_0x68bc('0x68')],{});db[_0x68bc('0xff')][_0x68bc('0x12a')](db[_0x68bc('0x66')],{});db[_0x68bc('0xff')][_0x68bc('0x12a')](db[_0x68bc('0x148')],{'foreignKey':_0x68bc('0x1fe'),'as':_0x68bc('0x1f1')});db[_0x68bc('0xff')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'foreignKey':_0x68bc('0x1f2'),'as':'FromAgent'});db[_0x68bc('0xff')][_0x68bc('0x12a')](db['User'],{'foreignKey':'ToUserId','as':_0x68bc('0x1fc')});db[_0x68bc('0xff')][_0x68bc('0x12a')](db[_0x68bc('0x6a')],{'foreignKey':_0x68bc('0x1ff'),'as':_0x68bc('0x1f6')});db[_0x68bc('0xff')][_0x68bc('0x12a')](db[_0x68bc('0x148')],{'foreignKey':_0x68bc('0x200'),'as':_0x68bc('0x1f7')});db[_0x68bc('0x201')][_0x68bc('0x12a')](db[_0x68bc('0x60')],{});db['SmsTransferReport']['belongsTo'](db[_0x68bc('0x5e')],{});db['SmsTransferReport']['belongsTo'](db[_0x68bc('0x5a')],{'foreignKey':_0x68bc('0x202'),'as':_0x68bc('0x1f1')});db[_0x68bc('0x201')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'foreignKey':'FromUserId','as':_0x68bc('0x1f3')});db[_0x68bc('0x201')]['belongsTo'](db[_0x68bc('0x12')],{'foreignKey':_0x68bc('0x1f4'),'as':_0x68bc('0x1fc')});db[_0x68bc('0x201')][_0x68bc('0x12a')](db[_0x68bc('0x62')],{'foreignKey':_0x68bc('0x203'),'as':_0x68bc('0x1f6')});db['SmsTransferReport'][_0x68bc('0x12a')](db[_0x68bc('0x5a')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db['Disposition'],{'as':_0x68bc('0x172'),'foreignKey':'ListId','onDelete':_0x68bc('0x11a')});db[_0x68bc('0x102')][_0x68bc('0x11b')](db[_0x68bc('0x204')],{'as':_0x68bc('0x205'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0x102')][_0x68bc('0x11b')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x12f'),'onDelete':'cascade','foreignKey':_0x68bc('0x174')});db[_0x68bc('0x102')][_0x68bc('0x11b')](db[_0x68bc('0x157')],{'as':_0x68bc('0x11f'),'foreignKey':'ListId'});db[_0x68bc('0x102')][_0x68bc('0x11b')](db[_0x68bc('0x81')],{'as':_0x68bc('0x120'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0x102')][_0x68bc('0x11b')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x68bc('0x174')});db[_0x68bc('0x102')][_0x68bc('0x12c')](db['VoiceQueue'],{'as':_0x68bc('0x206'),'through':_0x68bc('0x161')});db[_0x68bc('0x102')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x68bc('0x104')]['hasMany'](db[_0x68bc('0x19')],{'as':_0x68bc('0x11e'),'onDelete':'cascade'});db['VoicePrefix']['belongsToMany'](db[_0x68bc('0x12')],{'as':'Agents','through':_0x68bc('0x114')});db[_0x68bc('0x104')][_0x68bc('0x12c')](db[_0x68bc('0xf1')],{'through':'TeamVoicePrefix','as':_0x68bc('0x18f')});db['UserProfile'][_0x68bc('0x11b')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'foreignKey':_0x68bc('0x12b')});db[_0x68bc('0x207')][_0x68bc('0x11b')](db[_0x68bc('0x105')],{'as':_0x68bc('0x208'),'foreignKey':_0x68bc('0x12b'),'onDelete':_0x68bc('0x11a')});db['UserProfileSection'][_0x68bc('0x11b')](db[_0x68bc('0x209')],{'as':'Resources','foreignKey':'sectionId','onDelete':'cascade'});db[_0x68bc('0x14c')]['hasMany'](db['Disposition'],{'as':_0x68bc('0x172'),'foreignKey':_0x68bc('0x20a'),'onDelete':_0x68bc('0x11a')});db['WhatsappAccount']['hasMany'](db[_0x68bc('0x8a')],{'as':_0x68bc('0x189'),'foreignKey':_0x68bc('0x20a')});db[_0x68bc('0x14c')][_0x68bc('0x11b')](db[_0x68bc('0x10c')],{'as':_0x68bc('0x177'),'foreignKey':_0x68bc('0x20a')});db[_0x68bc('0x14c')][_0x68bc('0x11b')](db[_0x68bc('0x10a')],{'as':_0x68bc('0x173')});db['WhatsappAccount']['hasMany'](db[_0x68bc('0x108')],{'as':'Applications','foreignKey':_0x68bc('0x20a'),'onDelete':_0x68bc('0x11a')});db[_0x68bc('0x14c')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0x14c')][_0x68bc('0x12a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x68bc('0x14c')][_0x68bc('0x12c')](db['User'],{'as':'Agents','through':_0x68bc('0x14e')});db[_0x68bc('0x108')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x108')]['belongsTo'](db[_0x68bc('0x140')],{'onDelete':_0x68bc('0x16f')});db['WhatsappApplication']['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x68bc('0x16f')});db['WhatsappApplication'][_0x68bc('0x12a')](db[_0x68bc('0x8e')],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x15d')});db[_0x68bc('0x108')][_0x68bc('0x12a')](db['Tag'],{'onDelete':_0x68bc('0x16f'),'foreignKey':_0x68bc('0x184')});db[_0x68bc('0x10a')]['hasMany'](db['WhatsappMessage'],{'as':_0x68bc('0x177'),'onDelete':_0x68bc('0x11a'),'foreignKey':_0x68bc('0x20b')});db[_0x68bc('0x10a')][_0x68bc('0x12a')](db[_0x68bc('0x14c')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x20a')});db[_0x68bc('0x10a')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x10a')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17a'),'foreignKey':'UserId'});db[_0x68bc('0x10a')][_0x68bc('0x12c')](db[_0x68bc('0x17b')],{'through':_0x68bc('0x1bf'),'as':_0x68bc('0x17d')});db[_0x68bc('0x10a')][_0x68bc('0x12c')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x68bc('0x17e')});db[_0x68bc('0x10a')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x17f'),'through':_0x68bc('0x138'),'foreignKey':'WhatsappInteractionId'});db[_0x68bc('0x10c')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x12')});db[_0x68bc('0x10c')][_0x68bc('0x12a')](db[_0x68bc('0x12e')],{'onDelete':_0x68bc('0x11a'),'as':'Contact'});db['WhatsappMessage']['belongsTo'](db[_0x68bc('0x10a')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x68bc('0x20b')});db[_0x68bc('0x10c')][_0x68bc('0x12a')](db[_0x68bc('0x14c')],{'as':_0x68bc('0x179'),'foreignKey':_0x68bc('0x20a')});db[_0x68bc('0x10e')][_0x68bc('0x12a')](db[_0x68bc('0x14c')],{});db[_0x68bc('0x10e')][_0x68bc('0x12a')](db[_0x68bc('0x102')],{'as':_0x68bc('0x185'),'foreignKey':_0x68bc('0x174')});db[_0x68bc('0x10e')][_0x68bc('0x12a')](db['CmContact'],{'as':_0x68bc('0x16a'),'foreignKey':_0x68bc('0x16b')});db[_0x68bc('0x10e')]['belongsTo'](db[_0x68bc('0x10a')],{});db[_0x68bc('0x10e')]['belongsTo'](db['WhatsappQueue'],{});db[_0x68bc('0x10e')][_0x68bc('0x12a')](db[_0x68bc('0x10c')],{});db[_0x68bc('0x10e')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{});db[_0x68bc('0x10f')][_0x68bc('0x12a')](db[_0x68bc('0x10c')],{});db['WhatsappTransferReport'][_0x68bc('0x12a')](db[_0x68bc('0x10a')],{});db[_0x68bc('0x10f')]['belongsTo'](db[_0x68bc('0x14c')],{'foreignKey':_0x68bc('0x20c'),'as':_0x68bc('0x1f1')});db['WhatsappTransferReport'][_0x68bc('0x12a')](db[_0x68bc('0x14c')],{'foreignKey':_0x68bc('0x20d'),'as':_0x68bc('0x1f7')});db[_0x68bc('0x10f')]['belongsTo'](db[_0x68bc('0x140')],{'foreignKey':'ToQueueId','as':_0x68bc('0x1f6')});db[_0x68bc('0x10f')][_0x68bc('0x12a')](db['User'],{'foreignKey':_0x68bc('0x1f2'),'as':_0x68bc('0x1f3')});db[_0x68bc('0x10f')][_0x68bc('0x12a')](db['User'],{'foreignKey':_0x68bc('0x1f4'),'as':'ToAgent'});db[_0x68bc('0x140')][_0x68bc('0x12c')](db[_0x68bc('0x12')],{'as':_0x68bc('0x162'),'through':'UserWhatsappQueue','foreignKey':_0x68bc('0x20e')});db['WhatsappQueue'][_0x68bc('0x12c')](db['Team'],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x68bc('0x116')][_0x68bc('0x12a')](db[_0x68bc('0x12')],{'as':_0x68bc('0x20f'),'foreignKey':_0x68bc('0x119'),'onDelete':'cascade','hooks':!![]});db[_0x68bc('0x16d')][_0x68bc('0x118')](db[_0x68bc('0xd0')],{'as':_0x68bc('0xd0'),'onDelete':_0x68bc('0x16f')});db['CloudProvider'][_0x68bc('0x118')](db[_0x68bc('0x40')],{'as':_0x68bc('0x170'),'onDelete':_0x68bc('0x16f')});db[_0x68bc('0x16d')][_0x68bc('0x118')](db[_0x68bc('0x42')],{'as':_0x68bc('0x171'),'onDelete':_0x68bc('0x16f')});module[_0x68bc('0x210')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6059=['../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','cascade','hasOne','userSetting','UserId','Recordings','hasMany','VoiceQueuesRt','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','WhatsappInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','CmList','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','VoiceQueueId','Hoppers','CmHopperBlack','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Contact','Items','FaxAccountId','Exntensions','FaxMessage','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Members','ChatProactiveAction','CmCompany','CompanyId','Phones','HopperHistories','JscriptySessions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','AutomationAllId','AutomationAnyId','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','Mohs','moh_has_sounds','WhatsappInteraction','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','AnyConditions','Actions','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoField','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FromId','ToId','SessionId','ProjectId','team_has_chat_queues','WhatsappQueues','TeamVoicePrefix','SquareProject','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','ToAgent','ToQueue','ToAccount','ChatTransferReport','FromUserId','FromAgent','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','127.0.0.1','utf8','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition'];(function(_0x275472,_0x2c9de8){var _0x1490b8=function(_0x16a9a7){while(--_0x16a9a7){_0x275472['push'](_0x275472['shift']());}};_0x1490b8(++_0x2c9de8);}(_0x6059,0x186));var _0x9605=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0x6059[_0x4ec3ab];return _0x229613;};'use strict';var config=require(_0x9605('0x0'));var Sequelize=require(_0x9605('0x1'));var _=require('lodash');var jstz=require(_0x9605('0x2'));var timezone=jstz[_0x9605('0x3')]();config[_0x9605('0x1')]=_[_0x9605('0x4')](config['sequelize'],{'database':_0x9605('0x5'),'username':_0x9605('0x6'),'password':_0x9605('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x9605('0x8'),'dialectOptions':{'charset':_0x9605('0x9')},'logging':![],'timezone':timezone[_0x9605('0xa')](),'define':{'charset':'utf8','collate':_0x9605('0xb')}}});config[_0x9605('0xc')]=_[_0x9605('0x4')](config[_0x9605('0xc')],{'database':_0x9605('0x5'),'username':'xcall','password':_0x9605('0x7'),'options':{'host':_0x9605('0xd'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x9605('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9605('0xe'),'collate':_0x9605('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9605('0x1')][_0x9605('0xf')],config['sequelize'][_0x9605('0x10')],config[_0x9605('0x1')][_0x9605('0x11')],config[_0x9605('0x1')][_0x9605('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9605('0xc')][_0x9605('0xf')],config['sequelizeHistory'][_0x9605('0x10')],config[_0x9605('0xc')][_0x9605('0x11')],config[_0x9605('0xc')]['options'])};db[_0x9605('0x13')]=db[_0x9605('0x1')]['import']('../api/user/user.model');db[_0x9605('0x14')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x16'));db[_0x9605('0x17')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/voiceContext/voiceContext.model');db[_0x9605('0x18')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x19'));db['VoiceMusicOnHold']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x1a'));db[_0x9605('0x1b')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/voiceQueue/voiceQueue.model');db[_0x9605('0x1c')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x1d'));db['ScreenRecording']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x1e'));db[_0x9605('0x1f')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x20'));db[_0x9605('0x21')]=db[_0x9605('0x1')]['import'](_0x9605('0x22'));db[_0x9605('0x23')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x24'));db[_0x9605('0x25')]=db[_0x9605('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x9605('0x1')]['import'](_0x9605('0x26'));db[_0x9605('0x27')]=db['sequelize']['import'](_0x9605('0x28'));db[_0x9605('0x29')]=db[_0x9605('0x1')]['import'](_0x9605('0x2a'));db['Trunk']=db['sequelize'][_0x9605('0x15')](_0x9605('0x2b'));db['VoiceTransferReport']=db['sequelize'][_0x9605('0x15')](_0x9605('0x2c'));db[_0x9605('0x2d')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x2e'));db[_0x9605('0x2f')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x30'));db['UserChatQueue']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x31'));db[_0x9605('0x32')]=db[_0x9605('0x1')]['import'](_0x9605('0x33'));db[_0x9605('0x34')]=db[_0x9605('0x1')]['import'](_0x9605('0x35'));db[_0x9605('0x36')]=db['sequelize']['import'](_0x9605('0x37'));db[_0x9605('0x38')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x9605('0x39')]=db[_0x9605('0x1')]['import'](_0x9605('0x3a'));db['MailServerIn']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x3b'));db[_0x9605('0x3c')]=db['sequelize']['import'](_0x9605('0x3d'));db[_0x9605('0x3e')]=db[_0x9605('0x1')]['import'](_0x9605('0x3f'));db[_0x9605('0x40')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x41'));db[_0x9605('0x42')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x9605('0x43')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x9605('0x44')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x45'));db[_0x9605('0x46')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x47'));db[_0x9605('0x48')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x49'));db[_0x9605('0x4a')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x4b'));db[_0x9605('0x4c')]=db[_0x9605('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x9605('0x15')](_0x9605('0x4d'));db[_0x9605('0x4e')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x4f'));db[_0x9605('0x50')]=db[_0x9605('0x1')]['import'](_0x9605('0x51'));db['FaxMessage']=db['sequelize'][_0x9605('0x15')](_0x9605('0x52'));db[_0x9605('0x53')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/faxQueue/faxQueue.model');db[_0x9605('0x54')]=db[_0x9605('0x1')]['import'](_0x9605('0x55'));db[_0x9605('0x56')]=db['sequelize'][_0x9605('0x15')]('../api/smsAccount/smsAccount.model');db[_0x9605('0x57')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x58'));db['SmsInteraction']=db[_0x9605('0x1')]['import'](_0x9605('0x59'));db[_0x9605('0x5a')]=db['sequelize']['import'](_0x9605('0x5b'));db[_0x9605('0x5c')]=db[_0x9605('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0x9605('0x5d')]=db['sequelize'][_0x9605('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0x9605('0x5e')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0x9605('0x5f')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x9605('0x60')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize']['import'](_0x9605('0x61'));db[_0x9605('0x62')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x63'));db[_0x9605('0x64')]=db[_0x9605('0x1')]['import'](_0x9605('0x65'));db['ChatApplication']=db[_0x9605('0x1')]['import'](_0x9605('0x66'));db[_0x9605('0x67')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0x9605('0x68')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x69'));db[_0x9605('0x6a')]=db['sequelize']['import'](_0x9605('0x6b'));db[_0x9605('0x6c')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x6d'));db[_0x9605('0x6e')]=db[_0x9605('0x1')]['import'](_0x9605('0x6f'));db['ChatProactiveAction']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x70'));db['CmCompany']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x71'));db[_0x9605('0x72')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x73'));db['CmHopper']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x74'));db['CmHopperBlack']=db[_0x9605('0x1')]['import'](_0x9605('0x75'));db['CmHopperFinal']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x76'));db[_0x9605('0x77')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x78'));db[_0x9605('0x79')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x7a'));db[_0x9605('0x7b')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x7c'));db[_0x9605('0x7d')]=db[_0x9605('0x1')]['import'](_0x9605('0x7e'));db[_0x9605('0x7f')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x80'));db['CannedAnswer']=db[_0x9605('0x1')]['import'](_0x9605('0x81'));db[_0x9605('0x82')]=db['sequelize'][_0x9605('0x15')]('../api/disposition/disposition.model');db[_0x9605('0x83')]=db[_0x9605('0x1')]['import'](_0x9605('0x84'));db['Interval']=db['sequelize']['import'](_0x9605('0x85'));db['Pause']=db['sequelize'][_0x9605('0x15')](_0x9605('0x86'));db[_0x9605('0x87')]=db['sequelize'][_0x9605('0x15')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x9605('0x1')]['import'](_0x9605('0x88'));db['Schedule']=db['sequelize'][_0x9605('0x15')](_0x9605('0x89'));db[_0x9605('0x8a')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x8b'));db[_0x9605('0x8c')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x8d'));db[_0x9605('0x8e')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x8f'));db[_0x9605('0x90')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x91'));db[_0x9605('0x92')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x9605('0x93')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x94'));db[_0x9605('0x95')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x96'));db[_0x9605('0x97')]=db[_0x9605('0x1')]['import'](_0x9605('0x98'));db['Integration']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x99'));db['IntegrationReport']=db['sequelize'][_0x9605('0x15')](_0x9605('0x9a'));db[_0x9605('0x9b')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x9c'));db[_0x9605('0x9d')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x9e'));db['AnalyticExtractedReport']=db['sequelize'][_0x9605('0x15')](_0x9605('0x9f'));db[_0x9605('0xa0')]=db[_0x9605('0x1')]['import'](_0x9605('0xa1'));db[_0x9605('0xa2')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xa3'));db[_0x9605('0xa4')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xa5'));db[_0x9605('0xa6')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xa7'));db[_0x9605('0xa8')]=db['sequelize'][_0x9605('0x15')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x9605('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x9605('0xa9')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x9605('0xaa')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xab'));db[_0x9605('0xac')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xad'));db['DeskConfiguration']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xae'));db[_0x9605('0xaf')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb0'));db[_0x9605('0xb1')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb2'));db['ZohoConfiguration']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb3'));db['ZohoField']=db[_0x9605('0x1')]['import'](_0x9605('0xb4'));db[_0x9605('0xb5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xb6'));db[_0x9605('0xb7')]=db['sequelize']['import'](_0x9605('0xb8'));db[_0x9605('0xb9')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xba'));db[_0x9605('0xbb')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xbc'));db[_0x9605('0xbd')]=db[_0x9605('0x1')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9605('0xbe')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xbf'));db[_0x9605('0xc0')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xc1'));db[_0x9605('0xc2')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc3'));db[_0x9605('0xc4')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc5'));db[_0x9605('0xc6')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc7'));db[_0x9605('0xc8')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xc9'));db[_0x9605('0xca')]=db[_0x9605('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x9605('0xcb')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x9605('0xcc')]=db['sequelize'][_0x9605('0x15')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x9605('0xcd')]=db[_0x9605('0x1')]['import'](_0x9605('0xce'));db[_0x9605('0xcf')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xd0'));db[_0x9605('0xd1')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xd2'));db[_0x9605('0xd3')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xd4'));db[_0x9605('0xd5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x99'));db['Network']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xd6'));db[_0x9605('0xd7')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xd8'));db[_0x9605('0xd9')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xda'));db[_0x9605('0xdb')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xdc'));db[_0x9605('0xdd')]=db['sequelize'][_0x9605('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x9605('0xde')]=db[_0x9605('0x1')]['import'](_0x9605('0xdf'));db[_0x9605('0xe0')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xe1'));db[_0x9605('0xe2')]=db[_0x9605('0x1')]['import'](_0x9605('0xe3'));db[_0x9605('0xe4')]=db[_0x9605('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x9605('0xe5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xe6'));db['Setting']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xe7'));db[_0x9605('0xe8')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xe9'));db['SquareProject']=db['sequelize'][_0x9605('0x15')]('../api/squareProject/squareProject.model');db[_0x9605('0xea')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xeb'));db[_0x9605('0xec')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/squareMessage/squareMessage.model');db[_0x9605('0xed')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xee'));db[_0x9605('0xef')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/license/license.model');db['Campaign']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xf0'));db[_0x9605('0xf1')]=db['sequelize'][_0x9605('0x15')](_0x9605('0xf2'));db[_0x9605('0xf3')]=db['sequelize'][_0x9605('0x15')]('../api/attachment/attachment.model');db[_0x9605('0xf4')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/plugin/plugin.model');db[_0x9605('0xf5')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xf6'));db['ChatTransferReport']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xf7'));db[_0x9605('0xf8')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x9605('0xf9')]=db[_0x9605('0x1')]['import'](_0x9605('0xfa'));db[_0x9605('0xfb')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xfc'));db['CmList']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xfd'));db['VoicePrefix']=db[_0x9605('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x9605('0xfe')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0xff'));db[_0x9605('0x100')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x101'));db['UserProfileResource']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x102'));db[_0x9605('0x103')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x104'));db['WhatsappAccount']=db['sequelize'][_0x9605('0x15')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x105'));db['WhatsappInteraction']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x106'));db['WhatsappMessage']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x107'));db[_0x9605('0x108')]=db[_0x9605('0x1')]['import'](_0x9605('0x109'));db[_0x9605('0x10a')]=db[_0x9605('0x1')]['import'](_0x9605('0x10b'));db[_0x9605('0x10c')]=db[_0x9605('0x1')][_0x9605('0x15')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x10d'));db[_0x9605('0x10e')]=db['sequelize'][_0x9605('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db[_0x9605('0x1')][_0x9605('0x15')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x9605('0x10f')]=db['sequelize'][_0x9605('0x15')](_0x9605('0x110'));db[_0x9605('0x111')]=db[_0x9605('0x1')][_0x9605('0x15')](_0x9605('0x112'));db['MailInteractionHasTag']=db['sequelize'][_0x9605('0x15')](_0x9605('0x113'));db[_0x9605('0x13')]['hasOne'](db['VoiceMail'],{'as':_0x9605('0x1f'),'onDelete':_0x9605('0x114'),'foreignKey':'UserId'});db[_0x9605('0x13')][_0x9605('0x115')](db['UserSetting'],{'as':_0x9605('0x116'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x117')});db['User']['hasMany'](db[_0x9605('0x1c')],{'as':_0x9605('0x118'),'foreignKey':'UserId'});db[_0x9605('0x13')][_0x9605('0x119')](db[_0x9605('0x2d')],{'as':_0x9605('0x11a'),'foreignKey':'UserId'});db[_0x9605('0x13')][_0x9605('0x119')](db[_0x9605('0x18')],{'as':'Extensions','onDelete':_0x9605('0x114'),'hooks':!![]});db['User'][_0x9605('0x119')](db[_0x9605('0x11b')],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x13')][_0x9605('0x119')](db[_0x9605('0x77')],{'as':'HopperHistory','foreignKey':_0x9605('0x117')});db[_0x9605('0x13')][_0x9605('0x119')](db['ReportAgentPreview'],{'as':_0x9605('0x79'),'foreignKey':'UserId'});db['User'][_0x9605('0x119')](db[_0x9605('0x5f')],{'as':_0x9605('0x11d'),'foreignKey':_0x9605('0x117')});db['User']['hasMany'](db[_0x9605('0x67')],{'as':_0x9605('0x11e'),'foreignKey':_0x9605('0x117')});db['User'][_0x9605('0x119')](db[_0x9605('0x11f')],{'as':'SmsInteractions','foreignKey':'UserId'});db['User'][_0x9605('0x119')](db[_0x9605('0x50')],{'as':'FaxInteractions','foreignKey':_0x9605('0x117')});db[_0x9605('0x13')]['hasMany'](db[_0x9605('0x43')],{'as':'MailInteractions','foreignKey':_0x9605('0x117')});db[_0x9605('0x13')][_0x9605('0x119')](db['WhatsappInteraction'],{'as':_0x9605('0x120'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x13')]['hasMany'](db['UserNotification'],{'as':_0x9605('0x121'),'foreignKey':_0x9605('0x122')});db[_0x9605('0x13')]['hasMany'](db[_0x9605('0x123')],{'as':'Hoppers','foreignKey':_0x9605('0x117'),'onDelete':_0x9605('0x124')});db['User'][_0x9605('0x125')](db[_0x9605('0xfe')],{'as':'UserProfile','foreignKey':_0x9605('0x126')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x6e')],{'as':_0x9605('0x128'),'through':_0x9605('0x129')});db[_0x9605('0x13')][_0x9605('0x127')](db['CmContact'],{'as':_0x9605('0x12a'),'through':'cm_user_has_contacts'});db[_0x9605('0x13')][_0x9605('0x127')](db['CmList'],{'as':_0x9605('0x12b'),'through':_0x9605('0x12c')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x12d')});db[_0x9605('0x13')][_0x9605('0x127')](db['MailInteraction'],{'as':_0x9605('0x12e'),'through':_0x9605('0x12f')});db[_0x9605('0x13')][_0x9605('0x127')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x9605('0x130')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x50')],{'as':_0x9605('0x131'),'through':_0x9605('0x132')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x11f')],{'as':_0x9605('0x133'),'through':_0x9605('0x134')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x9605('0x135')});db[_0x9605('0x13')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x9605('0x120'),'through':_0x9605('0x136')});db['User'][_0x9605('0x127')](db[_0x9605('0x1b')],{'as':_0x9605('0x137'),'through':_0x9605('0x2f'),'required':![]});db['User'][_0x9605('0x127')](db[_0x9605('0x138')],{'as':'VoicePrefixes','through':_0x9605('0x10f'),'required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db['MailQueue'],{'as':_0x9605('0x139'),'through':'UserMailQueue','required':![]});db[_0x9605('0x13')]['belongsToMany'](db[_0x9605('0x6c')],{'as':_0x9605('0x13a'),'through':_0x9605('0x13b'),'required':![],'hooks':!![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x53')],{'as':_0x9605('0x13c'),'through':_0x9605('0x34'),'required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x5c')],{'as':_0x9605('0x13d'),'through':_0x9605('0x36'),'required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x13e')],{'as':_0x9605('0x13f'),'through':_0x9605('0x38'),'required':![]});db['User'][_0x9605('0x127')](db[_0x9605('0x10c')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x140')],{'through':_0x9605('0x12c')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x62')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x141')],{'as':_0x9605('0x142'),'through':_0x9605('0x143')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x3e')],{'as':_0x9605('0x144'),'through':_0x9605('0x145')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x5d')],{'as':_0x9605('0x146'),'through':_0x9605('0x147')});db[_0x9605('0x13')][_0x9605('0x127')](db['SmsAccount'],{'as':_0x9605('0x148'),'through':_0x9605('0x149')});db[_0x9605('0x13')][_0x9605('0x127')](db[_0x9605('0x14a')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x9605('0x14')][_0x9605('0x119')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x14b')});db[_0x9605('0x17')][_0x9605('0x119')](db[_0x9605('0x18')],{'onDelete':_0x9605('0x114')});db[_0x9605('0x18')]['hasMany'](db[_0x9605('0x18')],{'as':_0x9605('0x14c'),'onDelete':_0x9605('0x114')});db[_0x9605('0x14d')]['belongsToMany'](db[_0x9605('0x8a')],{'as':_0x9605('0x14e'),'through':'moh_has_sounds'});db[_0x9605('0x1b')][_0x9605('0x119')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')][_0x9605('0x119')](db[_0x9605('0x123')],{'as':_0x9605('0x150'),'foreignKey':'VoiceQueueId'});db[_0x9605('0x1b')]['hasMany'](db[_0x9605('0x11b')],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x14f')});db['VoiceQueue'][_0x9605('0x119')](db[_0x9605('0x77')],{'as':'HopperHistories','foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')][_0x9605('0x119')](db['ReportAgentPreview'],{'as':_0x9605('0x79'),'foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')]['hasMany'](db[_0x9605('0x151')],{'as':_0x9605('0x152'),'foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')]['hasMany'](db[_0x9605('0xde')],{'as':'JscriptySessions','foreignKey':_0x9605('0x14f')});db[_0x9605('0x1b')][_0x9605('0x125')](db[_0x9605('0x153')],{'as':'Trunk','foreignKey':_0x9605('0x154')});db[_0x9605('0x1b')][_0x9605('0x125')](db[_0x9605('0x153')],{'as':_0x9605('0x155'),'foreignKey':_0x9605('0x156')});db[_0x9605('0x1b')]['belongsTo'](db[_0x9605('0x157')],{'as':_0x9605('0x157'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x1b')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':_0x9605('0x15a'),'foreignKey':_0x9605('0x15b')});db[_0x9605('0x1b')][_0x9605('0x127')](db[_0x9605('0x140')],{'as':_0x9605('0x12b'),'through':_0x9605('0x15c')});db[_0x9605('0x1b')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':'Agents','through':_0x9605('0x2f')});db[_0x9605('0x1b')]['belongsToMany'](db[_0x9605('0xed')],{'as':_0x9605('0x15d'),'through':_0x9605('0x10e')});db[_0x9605('0x1b')]['belongsToMany'](db[_0x9605('0x140')],{'as':_0x9605('0x15e'),'through':_0x9605('0x15f')});db[_0x9605('0x1c')][_0x9605('0x125')](db['User'],{'as':'User','foreignKey':_0x9605('0x117')});db[_0x9605('0x160')]['belongsTo'](db[_0x9605('0x13')],{'as':_0x9605('0x13'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x1f')][_0x9605('0x119')](db[_0x9605('0x21')],{'as':_0x9605('0x161'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x9605('0x21')][_0x9605('0x125')](db[_0x9605('0x1f')],{'foreignKey':_0x9605('0x162'),'targetKey':_0x9605('0x163')});db[_0x9605('0x23')][_0x9605('0x119')](db[_0x9605('0x27')],{'as':_0x9605('0x164'),'foreignKey':_0x9605('0x165'),'constraints':![]});db['VoiceCallReport'][_0x9605('0x119')](db[_0x9605('0x166')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x9605('0x23')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x13'),'foreignKey':'UserId'});db[_0x9605('0x23')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':_0x9605('0x167')});db['MailServerIn'][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':_0x9605('0x3e'),'foreignKey':_0x9605('0x168')});db[_0x9605('0x169')]['belongsTo'](db['CloudProvider'],{'as':_0x9605('0x16a'),'foreignKey':_0x9605('0x16b'),'onDelete':'restrict'});db[_0x9605('0x3c')][_0x9605('0x125')](db['MailAccount'],{'as':_0x9605('0x3e'),'foreignKey':'MailAccountId'});db[_0x9605('0x3c')][_0x9605('0x125')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x9605('0x16b'),'onDelete':_0x9605('0x16c')});db['MailAccount']['hasOne'](db[_0x9605('0x169')],{'as':_0x9605('0x16d'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')][_0x9605('0x115')](db[_0x9605('0x3c')],{'as':_0x9605('0x16e'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')]['hasMany'](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x168'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':'MailAccountId'});db[_0x9605('0x3e')][_0x9605('0x119')](db['MailMessage'],{'as':_0x9605('0x161'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x9605('0x119')](db[_0x9605('0x43')],{'as':_0x9605('0x172')});db[_0x9605('0x3e')][_0x9605('0x119')](db[_0x9605('0x46')],{'as':_0x9605('0x14c'),'foreignKey':_0x9605('0x168'),'onDelete':_0x9605('0x114')});db[_0x9605('0x3e')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x3e')][_0x9605('0x125')](db[_0x9605('0x93')],{'as':_0x9605('0x93'),'foreignKey':_0x9605('0x175')});db['MailAccount'][_0x9605('0x125')](db[_0x9605('0x159')],{'as':_0x9605('0x15a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9605('0x3e')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':'Agents','through':_0x9605('0x145')});db[_0x9605('0x40')][_0x9605('0x127')](db['User'],{'as':_0x9605('0x176'),'through':'UserMailQueue'});db[_0x9605('0x40')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x177'),'as':_0x9605('0x15d')});db[_0x9605('0x43')][_0x9605('0x119')](db[_0x9605('0x44')],{'as':_0x9605('0x161'),'onDelete':'cascade','foreignKey':_0x9605('0x178')});db[_0x9605('0x43')][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':'Account','foreignKey':_0x9605('0x168')});db[_0x9605('0x43')][_0x9605('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x9605('0x167')});db[_0x9605('0x43')][_0x9605('0x125')](db['User'],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db[_0x9605('0x43')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x17a'),'as':'Tags'});db['MailInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x17a'),'as':_0x9605('0x17b')});db[_0x9605('0x43')]['belongsToMany'](db['User'],{'as':_0x9605('0x17c'),'through':_0x9605('0x12f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x9605('0x119')](db[_0x9605('0xf3')],{'as':_0x9605('0x17d'),'onDelete':_0x9605('0x114')});db[_0x9605('0x44')]['belongsTo'](db[_0x9605('0x13')],{'as':_0x9605('0x13')});db[_0x9605('0x44')][_0x9605('0x125')](db['CmContact'],{'onDelete':_0x9605('0x114'),'as':'Contact'});db[_0x9605('0x44')][_0x9605('0x125')](db[_0x9605('0x43')],{'as':_0x9605('0x17e'),'foreignKey':'MailInteractionId'});db[_0x9605('0x44')][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x168')});db[_0x9605('0x44')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':'ChatWebsite','foreignKey':_0x9605('0x180')});db['MailMessage']['belongsTo'](db[_0x9605('0x6a')],{'as':'ChatOfflineMessage','foreignKey':_0x9605('0x181')});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x40')],{'onDelete':'restrict'});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x3e')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x46')][_0x9605('0x125')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x9605('0x158')});db[_0x9605('0x46')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':'restrict','foreignKey':_0x9605('0x182')});db['MailQueueReport'][_0x9605('0x125')](db[_0x9605('0x3e')],{});db['MailQueueReport'][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x48')][_0x9605('0x125')](db['CmContact'],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x48')][_0x9605('0x125')](db['MailInteraction'],{});db[_0x9605('0x48')]['belongsTo'](db[_0x9605('0x44')],{});db[_0x9605('0x48')]['belongsTo'](db[_0x9605('0x13')],{});db[_0x9605('0x48')][_0x9605('0x125')](db['MailQueue'],{});db[_0x9605('0x4a')][_0x9605('0x119')](db[_0x9605('0x4c')],{'as':_0x9605('0x184'),'onDelete':_0x9605('0x114')});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x185')});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x50')],{'as':_0x9605('0x172')});db['FaxAccount']['hasMany'](db[_0x9605('0x4e')],{'as':'Applications','foreignKey':_0x9605('0x185'),'onDelete':_0x9605('0x114')});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x18')],{'as':_0x9605('0x186'),'onDelete':'cascade'});db[_0x9605('0x141')][_0x9605('0x119')](db[_0x9605('0x187')],{'as':'Messages'});db[_0x9605('0x141')][_0x9605('0x125')](db[_0x9605('0x153')],{'as':_0x9605('0x153')});db[_0x9605('0x141')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':'ListId'});db[_0x9605('0x141')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':_0x9605('0x15a'),'foreignKey':_0x9605('0x15b')});db[_0x9605('0x141')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x143')});db['FaxApplication']['belongsTo'](db[_0x9605('0x13')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x4e')][_0x9605('0x125')](db[_0x9605('0x53')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x4e')][_0x9605('0x125')](db[_0x9605('0x141')],{'onDelete':'restrict'});db[_0x9605('0x4e')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db[_0x9605('0x50')][_0x9605('0x119')](db[_0x9605('0x187')],{'as':'Messages','onDelete':_0x9605('0x114'),'foreignKey':'FaxInteractionId'});db[_0x9605('0x50')][_0x9605('0x125')](db[_0x9605('0x141')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x185')});db[_0x9605('0x50')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x50')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db['FaxInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x188'),'as':_0x9605('0x189')});db['FaxInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x188'),'as':_0x9605('0x17b')});db[_0x9605('0x50')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x132'),'foreignKey':_0x9605('0x18a')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x13')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x50')],{'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x18a')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x183')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0xf3')],{'as':_0x9605('0xf3'),'foreignKey':_0x9605('0x18b')});db[_0x9605('0x187')][_0x9605('0x125')](db[_0x9605('0x141')],{'as':'Account','foreignKey':_0x9605('0x185')});db[_0x9605('0x53')][_0x9605('0x127')](db['User'],{'as':'Agents','through':_0x9605('0x34')});db['FaxQueue'][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x18c'),'as':_0x9605('0x15d')});db['FaxQueueReport'][_0x9605('0x125')](db['FaxAccount'],{});db[_0x9605('0x54')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':'List','foreignKey':_0x9605('0x174')});db[_0x9605('0x54')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':'ContactId'});db[_0x9605('0x54')][_0x9605('0x125')](db[_0x9605('0x50')],{});db[_0x9605('0x54')]['belongsTo'](db[_0x9605('0x187')],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x9605('0x125')](db['FaxQueue'],{});db[_0x9605('0x56')][_0x9605('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9605('0x18d'),'onDelete':_0x9605('0x114')});db['SmsAccount'][_0x9605('0x119')](db['CannedAnswer'],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x18d')});db[_0x9605('0x56')][_0x9605('0x119')](db[_0x9605('0x5a')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x9605('0x56')][_0x9605('0x119')](db[_0x9605('0x11f')],{'as':'Interactions'});db[_0x9605('0x56')]['hasMany'](db[_0x9605('0x57')],{'as':_0x9605('0x14c'),'foreignKey':'SmsAccountId','onDelete':_0x9605('0x114')});db[_0x9605('0x56')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x56')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9605('0x56')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x149')});db[_0x9605('0x57')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'restrict'});db[_0x9605('0x57')][_0x9605('0x125')](db['SmsQueue'],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x57')][_0x9605('0x125')](db['SmsAccount'],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x57')][_0x9605('0x125')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x9605('0x158')});db[_0x9605('0x57')]['belongsTo'](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db[_0x9605('0x11f')]['hasMany'](db[_0x9605('0x5a')],{'as':_0x9605('0x161'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x9605('0x11f')][_0x9605('0x125')](db[_0x9605('0x56')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x18d')});db[_0x9605('0x11f')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x11f')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x11f')]['belongsToMany'](db[_0x9605('0x8c')],{'through':_0x9605('0x18e'),'as':_0x9605('0x189')});db[_0x9605('0x11f')]['belongsToMany'](db['Tag'],{'through':_0x9605('0x18e'),'as':_0x9605('0x17b')});db[_0x9605('0x11f')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x134'),'foreignKey':'SmsInteractionId'});db[_0x9605('0x5a')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':'User'});db['SmsMessage'][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x183')});db[_0x9605('0x5a')][_0x9605('0x125')](db[_0x9605('0x11f')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x18f')});db[_0x9605('0x5a')][_0x9605('0x125')](db[_0x9605('0x56')],{'as':'Account','foreignKey':_0x9605('0x18d')});db['SmsQueue'][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x36'),'foreignKey':_0x9605('0x190')});db[_0x9605('0x5c')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x191'),'as':'Teams'});db[_0x9605('0x5d')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x192'),'onDelete':'cascade'});db[_0x9605('0x5d')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x192')});db['OpenchannelAccount']['hasMany'](db[_0x9605('0x5f')],{'as':_0x9605('0x172'),'foreignKey':_0x9605('0x192')});db[_0x9605('0x5d')][_0x9605('0x119')](db['OpenchannelMessage'],{'as':_0x9605('0x161'),'foreignKey':_0x9605('0x192')});db[_0x9605('0x5d')][_0x9605('0x119')](db[_0x9605('0x5e')],{'as':_0x9605('0x14c'),'foreignKey':_0x9605('0x192'),'onDelete':_0x9605('0x114')});db[_0x9605('0x5d')][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':'ListId'});db[_0x9605('0x5d')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9605('0x15b')});db[_0x9605('0x5d')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x147')});db[_0x9605('0x5e')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'restrict'});db[_0x9605('0x5e')]['belongsTo'](db[_0x9605('0x13e')],{'onDelete':'restrict','foreignKey':_0x9605('0x193')});db[_0x9605('0x5e')][_0x9605('0x125')](db[_0x9605('0x5d')],{'onDelete':'restrict','foreignKey':_0x9605('0x192')});db['OpenchannelApplication'][_0x9605('0x125')](db[_0x9605('0x157')],{'onDelete':_0x9605('0x16c'),'foreignKey':'IntervalId'});db[_0x9605('0x5e')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db['OpenchannelInteraction'][_0x9605('0x119')](db['OpenchannelMessage'],{'as':_0x9605('0x161'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x194')});db['OpenchannelInteraction'][_0x9605('0x125')](db[_0x9605('0x5d')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x192')});db['OpenchannelInteraction'][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x5f')][_0x9605('0x127')](db['Tag'],{'through':_0x9605('0x195'),'as':_0x9605('0x189')});db['OpenchannelInteraction'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x195'),'as':_0x9605('0x17b')});db['OpenchannelInteraction'][_0x9605('0x127')](db['User'],{'as':_0x9605('0x17c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x9605('0x13')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x13')});db['OpenchannelMessage']['belongsTo'](db[_0x9605('0x72')],{'onDelete':'cascade','as':_0x9605('0x183')});db[_0x9605('0x60')]['belongsTo'](db[_0x9605('0x5f')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x194')});db['OpenchannelMessage'][_0x9605('0x125')](db['Attachment'],{'as':_0x9605('0xf3'),'foreignKey':_0x9605('0x18b')});db[_0x9605('0x60')]['belongsTo'](db[_0x9605('0x5d')],{'as':'Account','foreignKey':_0x9605('0x192')});db[_0x9605('0x13e')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x38'),'foreignKey':_0x9605('0x193')});db['OpenchannelQueue'][_0x9605('0x127')](db[_0x9605('0xed')],{'through':_0x9605('0x196'),'as':'Teams'});db[_0x9605('0x62')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':'ChatWebsiteId','onDelete':_0x9605('0x114')});db[_0x9605('0x62')][_0x9605('0x119')](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x9605('0x197')});db[_0x9605('0x62')]['hasMany'](db['ChatInteraction'],{'as':_0x9605('0x172')});db['ChatWebsite'][_0x9605('0x119')](db['ChatApplication'],{'as':_0x9605('0x14c'),'foreignKey':'ChatWebsiteId','onDelete':_0x9605('0x114')});db[_0x9605('0x62')][_0x9605('0x119')](db[_0x9605('0x68')],{'as':_0x9605('0x161')});db['ChatWebsite']['belongsTo'](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x62')][_0x9605('0x125')](db[_0x9605('0x157')],{'as':'Interval','foreignKey':_0x9605('0x158')});db[_0x9605('0x62')][_0x9605('0x125')](db[_0x9605('0x3e')],{'as':_0x9605('0x3e'),'foreignKey':_0x9605('0x168')});db[_0x9605('0x62')][_0x9605('0x125')](db['Pause'],{'as':_0x9605('0x15a'),'foreignKey':_0x9605('0x15b')});db[_0x9605('0x62')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':'Agents','through':_0x9605('0x198')});db[_0x9605('0x64')][_0x9605('0x125')](db[_0x9605('0x5d')],{});db['OpenchannelQueueReport'][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db['OpenchannelQueueReport'][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':'ContactId'});db[_0x9605('0x64')][_0x9605('0x125')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x9605('0x125')](db[_0x9605('0x60')],{});db[_0x9605('0x64')]['belongsTo'](db[_0x9605('0x13')],{});db[_0x9605('0x64')][_0x9605('0x125')](db['OpenchannelQueue'],{});db[_0x9605('0x199')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x19a'),'foreignKey':_0x9605('0x117'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x199')]['belongsTo'](db[_0x9605('0x6c')],{'as':_0x9605('0x19b'),'foreignKey':_0x9605('0x19c'),'onDelete':'restrict'});db[_0x9605('0x199')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x19d'),'foreignKey':_0x9605('0x180'),'onDelete':'restrict'});db[_0x9605('0x199')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db['ChatInteraction'][_0x9605('0x119')](db[_0x9605('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x9605('0x19e')});db['ChatInteraction'][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x180')});db[_0x9605('0x67')]['belongsTo'](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db[_0x9605('0x67')][_0x9605('0x127')](db['Tag'],{'through':_0x9605('0x19f'),'as':_0x9605('0x189')});db[_0x9605('0x67')]['belongsToMany'](db['Tag'],{'through':_0x9605('0x19f'),'as':_0x9605('0x17b')});db[_0x9605('0x67')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x130'),'foreignKey':_0x9605('0x19e')});db[_0x9605('0x68')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':_0x9605('0x114'),'as':'User'});db[_0x9605('0x68')][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':'Contact','foreignKey':_0x9605('0x167')});db['ChatMessage']['belongsTo'](db[_0x9605('0x67')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':_0x9605('0x19e')});db['ChatMessage'][_0x9605('0x125')](db[_0x9605('0xf3')],{'as':_0x9605('0xf3'),'foreignKey':_0x9605('0x18b')});db[_0x9605('0x68')]['belongsTo'](db[_0x9605('0x62')],{'as':'Account','foreignKey':_0x9605('0x180')});db[_0x9605('0x6a')][_0x9605('0x119')](db[_0x9605('0xf3')],{'as':_0x9605('0x17d'),'foreignKey':_0x9605('0x181'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x6a')][_0x9605('0x125')](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x6a')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x180')});db[_0x9605('0x6c')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':'UserChatQueue','hooks':!![]});db[_0x9605('0x6c')][_0x9605('0x127')](db[_0x9605('0xed')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x9605('0x6e')][_0x9605('0x119')](db[_0x9605('0xd9')],{'as':_0x9605('0x161'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x9605('0x6e')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x1a0'),'through':_0x9605('0x129')});db[_0x9605('0x1a1')][_0x9605('0x125')](db[_0x9605('0x62')],{'as':_0x9605('0x19d'),'foreignKey':_0x9605('0x180')});db[_0x9605('0x1a2')][_0x9605('0x119')](db[_0x9605('0x72')],{'as':_0x9605('0x12a'),'foreignKey':_0x9605('0x1a3')});db[_0x9605('0x72')]['hasMany'](db[_0x9605('0x90')],{'as':_0x9605('0x1a4'),'foreignKey':'CmContactId'});db[_0x9605('0x72')]['hasMany'](db[_0x9605('0x123')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x9605('0x72')][_0x9605('0x119')](db['CmHopperFinal'],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x77')],{'as':_0x9605('0x1a5'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x79')],{'as':'ReportAgentPreview','foreignKey':_0x9605('0x167')});db['CmContact'][_0x9605('0x119')](db[_0x9605('0xde')],{'as':_0x9605('0x1a6'),'foreignKey':'ContactId'});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x5f')],{'as':_0x9605('0x11d'),'foreignKey':'ContactId','onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x67')],{'as':'ChatInteractions','foreignKey':_0x9605('0x167'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x11f')],{'as':_0x9605('0x133'),'foreignKey':_0x9605('0x167'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x50')],{'as':_0x9605('0x131'),'foreignKey':'ContactId','onDelete':_0x9605('0x16c')});db[_0x9605('0x72')][_0x9605('0x119')](db[_0x9605('0x43')],{'as':'MailInteractions','foreignKey':_0x9605('0x167'),'onDelete':'restrict'});db[_0x9605('0x72')][_0x9605('0x125')](db[_0x9605('0x1a2')],{'as':_0x9605('0x1a7'),'foreignKey':'CompanyId'});db[_0x9605('0x72')][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':'ListId','onDelete':_0x9605('0x114')});db[_0x9605('0x72')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':'cm_user_has_contacts'});db[_0x9605('0x72')][_0x9605('0x127')](db['Tag'],{'as':_0x9605('0x189'),'through':_0x9605('0x1a8')});db['CmContact'][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1a8'),'as':_0x9605('0x17b')});db[_0x9605('0x123')][_0x9605('0x119')](db['CmHopperAdditionalPhone'],{'as':_0x9605('0x1a9'),'foreignKey':_0x9605('0x1aa')});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167'),'onDelete':'cascade'});db['CmHopper'][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174'),'onDelete':'cascade'});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x13')],{'as':_0x9605('0x19a'),'foreignKey':_0x9605('0x117')});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x9605('0x114')});db[_0x9605('0x123')][_0x9605('0x125')](db[_0x9605('0x1ab')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x9605('0x114')});db[_0x9605('0x123')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x9605('0x1ac')});db['CmHopperBlack'][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167'),'onDelete':_0x9605('0x114')});db[_0x9605('0x151')][_0x9605('0x125')](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174'),'onDelete':_0x9605('0x114')});db[_0x9605('0x151')]['belongsTo'](db[_0x9605('0x1b')],{'as':_0x9605('0x19b'),'foreignKey':_0x9605('0x14f'),'onDelete':_0x9605('0x114')});db[_0x9605('0x151')][_0x9605('0x125')](db['Campaign'],{'as':_0x9605('0x1ab'),'foreignKey':_0x9605('0x1ad'),'onDelete':_0x9605('0x114')});db[_0x9605('0x7f')][_0x9605('0x119')](db['Condition'],{'as':{'plural':_0x9605('0x1ae'),'singular':'OneAll'},'foreignKey':_0x9605('0x1af'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x7f')]['hasMany'](db[_0x9605('0x83')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x9605('0x1b0'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x7f')]['hasMany'](db[_0x9605('0x7d')],{'as':'Actions','foreignKey':_0x9605('0x1b1'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x82')][_0x9605('0x119')](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x1b2'),'onDelete':'cascade'});db['Interval'][_0x9605('0x119')](db['Interval'],{'as':_0x9605('0x1b3'),'foreignKey':_0x9605('0x158'),'onDelete':_0x9605('0x114'),'hooks':!![],'required':![]});db['Interval'][_0x9605('0x119')](db[_0x9605('0x18')],{'as':_0x9605('0x1b4'),'foreignKey':_0x9605('0x158'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x157')]['hasMany'](db[_0x9605('0x46')],{'as':_0x9605('0x1b5'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x157')][_0x9605('0x119')](db[_0x9605('0x199')],{'as':_0x9605('0x1b6'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x157')]['hasMany'](db['FaxApplication'],{'as':_0x9605('0x1b7'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x9605('0x57')],{'as':_0x9605('0x1b8'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x1b9')][_0x9605('0x125')](db['MailAccount'],{});db[_0x9605('0x1b9')][_0x9605('0x125')](db[_0x9605('0x9d')],{'foreignKey':_0x9605('0x1ba')});db[_0x9605('0x1b9')][_0x9605('0x125')](db[_0x9605('0x9b')],{'foreignKey':'CustomReportId'});db[_0x9605('0x8a')][_0x9605('0x127')](db['VoiceMusicOnHold'],{'as':_0x9605('0x1bb'),'through':_0x9605('0x1bc'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x72')],{'through':_0x9605('0x1a8')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x67')],{'through':_0x9605('0x19f')});db[_0x9605('0x8c')]['belongsToMany'](db[_0x9605('0x43')],{'through':'mail_interaction_has_tags'});db[_0x9605('0x8c')]['belongsToMany'](db['SmsInteraction'],{'through':_0x9605('0x18e')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x50')],{'through':_0x9605('0x188')});db[_0x9605('0x8c')]['belongsToMany'](db[_0x9605('0x5f')],{'through':_0x9605('0x195')});db[_0x9605('0x8c')][_0x9605('0x127')](db[_0x9605('0x1bd')],{'through':_0x9605('0x1be')});db[_0x9605('0x90')][_0x9605('0x125')](db[_0x9605('0x8e')],{'as':_0x9605('0x1bf'),'foreignKey':_0x9605('0x1c0')});db[_0x9605('0x92')]['belongsTo'](db[_0x9605('0x123')],{'as':_0x9605('0x1c1'),'foreignKey':_0x9605('0x1aa')});db[_0x9605('0x90')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':_0x9605('0x1c2')});db[_0x9605('0x95')]['hasMany'](db[_0x9605('0x83')],{'as':{'plural':_0x9605('0x1c3'),'singular':_0x9605('0x1c4')},'foreignKey':'TriggerAllId','onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x95')][_0x9605('0x119')](db[_0x9605('0x83')],{'as':{'plural':_0x9605('0x1c5'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x9605('0x114'),'hooks':!![]});db['Trigger'][_0x9605('0x119')](db[_0x9605('0x7d')],{'as':_0x9605('0x1c6'),'foreignKey':_0x9605('0x1c7'),'onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x9b')][_0x9605('0x119')](db['AnalyticFieldReport'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x9605('0x9d')][_0x9605('0x119')](db[_0x9605('0xa2')],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1ba')});db[_0x9605('0xa0')][_0x9605('0x119')](db[_0x9605('0xa2')],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1c9')});db[_0x9605('0xa2')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x9605('0x1c9')});db[_0x9605('0xa4')][_0x9605('0x119')](db[_0x9605('0xa6')],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xa6')][_0x9605('0x119')](db[_0x9605('0xa8')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xa6')][_0x9605('0x119')](db[_0x9605('0xa8')],{'as':_0x9605('0x1ce'),'onDelete':'cascade','foreignKey':_0x9605('0x1cf')});db['SalesforceConfiguration'][_0x9605('0x119')](db['SalesforceField'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xa6')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x9605('0x1cb')});db['SalesforceField'][_0x9605('0x119')](db['SalesforceField'],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xa8')]['hasMany'](db['SalesforceField'],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xa8')][_0x9605('0x119')](db[_0x9605('0xa8')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xa8')]['belongsTo'](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db['SugarcrmAccount'][_0x9605('0x119')](db['SugarcrmConfiguration'],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xa9')][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xa9')][_0x9605('0x119')](db['SugarcrmField'],{'as':_0x9605('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':'Fields','onDelete':_0x9605('0x114'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x9605('0x125')](db[_0x9605('0x1d5')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db['SugarcrmField'][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db['SugarcrmField'][_0x9605('0x119')](db[_0x9605('0xaa')],{'as':_0x9605('0x1d2'),'foreignKey':'DescriptionId'});db[_0x9605('0xaa')][_0x9605('0x119')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db['SugarcrmField'][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db[_0x9605('0xac')][_0x9605('0x119')](db['DeskConfiguration'],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0x1d6')][_0x9605('0x119')](db[_0x9605('0xaf')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':'SubjectId'});db[_0x9605('0x1d6')][_0x9605('0x119')](db[_0x9605('0xaf')],{'as':_0x9605('0x1ce'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0x1d6')]['hasMany'](db['DeskField'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x9605('0x125')](db[_0x9605('0xac')],{'as':_0x9605('0x17f'),'foreignKey':'AccountId'});db[_0x9605('0x1d6')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1d7')});db[_0x9605('0xaf')][_0x9605('0x119')](db['DeskField'],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xaf')][_0x9605('0x119')](db['DeskField'],{'as':_0x9605('0x1d2'),'foreignKey':'DescriptionId'});db['DeskField'][_0x9605('0x119')](db['DeskField'],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xaf')][_0x9605('0x125')](db['Variable'],{'as':_0x9605('0x97'),'foreignKey':'VariableId'});db[_0x9605('0xb1')][_0x9605('0x119')](db['ZohoConfiguration'],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db['ZohoConfiguration'][_0x9605('0x119')](db[_0x9605('0x1d8')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0x1d9')][_0x9605('0x119')](db[_0x9605('0x1d8')],{'as':_0x9605('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x9605('0x119')](db['ZohoField'],{'as':_0x9605('0x1c8'),'onDelete':_0x9605('0x114'),'foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0x9605('0xb1')],{'as':'Account','foreignKey':_0x9605('0x1cb')});db['ZohoField'][_0x9605('0x119')](db[_0x9605('0x1d8')],{'as':'Subject','foreignKey':_0x9605('0x1cd')});db[_0x9605('0x1d8')]['hasMany'](db[_0x9605('0x1d8')],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0x1d8')]['hasMany'](db[_0x9605('0x1d8')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0x1d8')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db[_0x9605('0xb5')][_0x9605('0x119')](db[_0x9605('0xb7')],{'as':'Configurations','onDelete':_0x9605('0x114'),'foreignKey':'AccountId'});db[_0x9605('0xb7')][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':_0x9605('0x1cc'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xb7')][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xb7')]['hasMany'](db['ZendeskField'],{'as':_0x9605('0x1c8'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xb7')][_0x9605('0x125')](db[_0x9605('0xb5')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xb7')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1da')});db['ZendeskField'][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xb9')][_0x9605('0x119')](db[_0x9605('0xb9')],{'as':'Description','foreignKey':_0x9605('0x1cf')});db[_0x9605('0xb9')][_0x9605('0x119')](db['ZendeskField'],{'as':'Field','foreignKey':_0x9605('0x1d0')});db[_0x9605('0xb9')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':'Variable','foreignKey':_0x9605('0x1d4')});db['FreshdeskAccount'][_0x9605('0x119')](db[_0x9605('0xbd')],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db['FreshdeskConfiguration'][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db['FreshdeskConfiguration'][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':'Descriptions','onDelete':_0x9605('0x114'),'foreignKey':'DescriptionId'});db[_0x9605('0xbd')][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9605('0x1d0')});db[_0x9605('0xbd')][_0x9605('0x125')](db[_0x9605('0xbb')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db['FreshdeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x9605('0x1db')});db['FreshdeskField'][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xbe')][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xbe')][_0x9605('0x119')](db[_0x9605('0xbe')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xbe')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':'VariableId'});db[_0x9605('0xc0')][_0x9605('0x119')](db[_0x9605('0xc2')],{'as':_0x9605('0x1ca'),'onDelete':'cascade','foreignKey':_0x9605('0x1cb')});db[_0x9605('0xc2')][_0x9605('0x119')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x9605('0xc2')][_0x9605('0x119')](db['VtigerField'],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xc2')][_0x9605('0x119')](db[_0x9605('0xc4')],{'as':_0x9605('0x1c8'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xc2')][_0x9605('0x125')](db[_0x9605('0xc0')],{'as':_0x9605('0x17f'),'foreignKey':'AccountId'});db['VtigerField'][_0x9605('0x119')](db[_0x9605('0xc4')],{'as':_0x9605('0x1d1'),'foreignKey':'SubjectId'});db[_0x9605('0xc4')]['hasMany'](db[_0x9605('0xc4')],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xc4')][_0x9605('0x119')](db[_0x9605('0xc4')],{'as':'Field','foreignKey':_0x9605('0x1d0')});db[_0x9605('0xc4')]['belongsTo'](db[_0x9605('0x97')],{'as':'Variable','foreignKey':_0x9605('0x1d4')});db['ServicenowAccount']['hasMany'](db[_0x9605('0xc8')],{'as':_0x9605('0x1ca'),'onDelete':'cascade','foreignKey':_0x9605('0x1cb')});db['ServicenowConfiguration'][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1cc'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xc8')][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db['ServicenowConfiguration'][_0x9605('0x119')](db[_0x9605('0xca')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x9605('0x125')](db['ServicenowAccount'],{'as':_0x9605('0x17f'),'foreignKey':'AccountId'});db['ServicenowField'][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xca')]['hasMany'](db[_0x9605('0xca')],{'as':'Description','foreignKey':_0x9605('0x1cf')});db[_0x9605('0xca')][_0x9605('0x119')](db[_0x9605('0xca')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xca')]['belongsTo'](db['Variable'],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db['Dynamics365Account'][_0x9605('0x119')](db[_0x9605('0xcc')],{'as':_0x9605('0x1ca'),'onDelete':_0x9605('0x114'),'foreignKey':'AccountId'});db['Dynamics365Account']['belongsTo'](db[_0x9605('0x16a')],{'as':_0x9605('0x16a'),'foreignKey':'CloudProviderId'});db[_0x9605('0xcc')][_0x9605('0x119')](db[_0x9605('0xcd')],{'as':_0x9605('0x1cc'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cd')});db['Dynamics365Configuration']['hasMany'](db[_0x9605('0xcd')],{'as':_0x9605('0x1ce'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cf')});db[_0x9605('0xcc')][_0x9605('0x119')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xcc')][_0x9605('0x125')](db[_0x9605('0xcb')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xcd')]['hasMany'](db[_0x9605('0xcd')],{'as':_0x9605('0x1d1'),'foreignKey':'SubjectId'});db[_0x9605('0xcd')]['hasMany'](db[_0x9605('0xcd')],{'as':'Description','foreignKey':_0x9605('0x1cf')});db['Dynamics365Field']['hasMany'](db[_0x9605('0xcd')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db['Dynamics365Field'][_0x9605('0x125')](db[_0x9605('0x97')],{'as':'Variable','foreignKey':_0x9605('0x1d4')});db[_0x9605('0xcf')][_0x9605('0x119')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1cb')});db[_0x9605('0xd1')][_0x9605('0x119')](db['FreshsalesField'],{'as':_0x9605('0x1cc'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xd1')]['hasMany'](db[_0x9605('0xd3')],{'as':_0x9605('0x1ce'),'foreignKey':_0x9605('0x1cf')});db['FreshsalesConfiguration'][_0x9605('0x119')](db['FreshsalesField'],{'as':_0x9605('0x1c8'),'foreignKey':'FieldId'});db[_0x9605('0xd1')][_0x9605('0x125')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x9605('0x1cb')});db[_0x9605('0xd3')][_0x9605('0x119')](db[_0x9605('0xd3')],{'as':_0x9605('0x1d1'),'foreignKey':_0x9605('0x1cd')});db[_0x9605('0xd3')][_0x9605('0x119')](db['FreshsalesField'],{'as':_0x9605('0x1d2'),'foreignKey':_0x9605('0x1cf')});db['FreshsalesField'][_0x9605('0x119')](db[_0x9605('0xd3')],{'as':_0x9605('0x1d3'),'foreignKey':_0x9605('0x1d0')});db[_0x9605('0xd3')][_0x9605('0x125')](db[_0x9605('0x97')],{'as':_0x9605('0x97'),'foreignKey':_0x9605('0x1d4')});db['ChatQueueReport'][_0x9605('0x125')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x9605('0x125')](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x67')],{});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x68')],{});db[_0x9605('0xd7')][_0x9605('0x125')](db['User'],{});db[_0x9605('0xd7')][_0x9605('0x125')](db[_0x9605('0x6c')],{});db[_0x9605('0xd9')][_0x9605('0x125')](db['User'],{'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x1dc')});db[_0x9605('0xd9')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'cascade','foreignKey':_0x9605('0x1dd')});db['JscriptySessionReport'][_0x9605('0x119')](db[_0x9605('0xdd')],{'foreignKey':_0x9605('0x1de'),'onDelete':_0x9605('0x114')});db[_0x9605('0xde')][_0x9605('0x119')](db[_0x9605('0xdb')],{'foreignKey':_0x9605('0x1de'),'onDelete':_0x9605('0x114')});db[_0x9605('0xe0')]['belongsTo'](db['SmsAccount'],{});db[_0x9605('0xe0')]['belongsTo'](db['CmList'],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0xe0')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0xe0')]['belongsTo'](db[_0x9605('0x11f')],{});db[_0x9605('0xe0')][_0x9605('0x125')](db[_0x9605('0x5a')],{});db[_0x9605('0xe0')][_0x9605('0x125')](db['User'],{});db[_0x9605('0xe0')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0x9605('0x119')](db[_0x9605('0xde')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x9605('0x119')](db[_0x9605('0xdd')],{'foreignKey':_0x9605('0x1df')});db[_0x9605('0xe5')][_0x9605('0x119')](db[_0x9605('0xdb')],{'foreignKey':_0x9605('0x1df')});db[_0x9605('0xed')][_0x9605('0x127')](db['User'],{'as':_0x9605('0x176'),'through':_0x9605('0x12d')});db['Team'][_0x9605('0x127')](db[_0x9605('0x1b')],{'through':_0x9605('0x10e'),'as':_0x9605('0x137')});db[_0x9605('0xed')][_0x9605('0x127')](db[_0x9605('0x40')],{'through':_0x9605('0x177'),'as':_0x9605('0x139')});db[_0x9605('0xed')]['belongsToMany'](db[_0x9605('0x6c')],{'through':_0x9605('0x1e0'),'as':_0x9605('0x13a')});db[_0x9605('0xed')][_0x9605('0x127')](db[_0x9605('0x53')],{'through':'team_has_fax_queues','as':_0x9605('0x13c')});db[_0x9605('0xed')][_0x9605('0x127')](db['SmsQueue'],{'through':_0x9605('0x191'),'as':'SmsQueues'});db[_0x9605('0xed')]['belongsToMany'](db['OpenchannelQueue'],{'through':_0x9605('0x196'),'as':_0x9605('0x13f')});db['Team'][_0x9605('0x127')](db[_0x9605('0x10c')],{'through':'team_has_whatsapp_queues','as':_0x9605('0x1e1')});db[_0x9605('0xed')]['belongsToMany'](db['VoicePrefix'],{'through':_0x9605('0x1e2'),'as':'VoicePrefixes'});db[_0x9605('0x1ab')][_0x9605('0x119')](db[_0x9605('0x123')],{'as':_0x9605('0x150'),'foreignKey':'CampaignId'});db['Campaign'][_0x9605('0x119')](db[_0x9605('0x11b')],{'as':_0x9605('0x11c'),'foreignKey':_0x9605('0x1ad')});db['Campaign'][_0x9605('0x119')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x9605('0x1ad')});db[_0x9605('0x1ab')][_0x9605('0x119')](db[_0x9605('0x151')],{'as':_0x9605('0x152'),'foreignKey':_0x9605('0x1ad')});db[_0x9605('0x1ab')]['belongsTo'](db[_0x9605('0x153')],{'as':'Trunk','foreignKey':_0x9605('0x154')});db['Campaign']['belongsTo'](db[_0x9605('0x153')],{'as':_0x9605('0x155'),'foreignKey':_0x9605('0x156')});db[_0x9605('0x1ab')][_0x9605('0x125')](db[_0x9605('0x157')],{'as':_0x9605('0x157'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x1ab')][_0x9605('0x125')](db[_0x9605('0x1e3')],{'as':_0x9605('0x1e3'),'foreignKey':_0x9605('0x1e4')});db[_0x9605('0x1ab')]['belongsToMany'](db['CmList'],{'as':_0x9605('0x12b'),'through':_0x9605('0x1e5')});db[_0x9605('0x1ab')][_0x9605('0x127')](db[_0x9605('0x140')],{'as':'BlackLists','through':_0x9605('0x1e6')});db['Attachment'][_0x9605('0x125')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x9605('0x181')});db[_0x9605('0xf5')]['belongsTo'](db[_0x9605('0x44')],{});db['MailTransferReport'][_0x9605('0x125')](db['MailInteraction'],{});db[_0x9605('0xf5')][_0x9605('0x125')](db[_0x9605('0x3e')],{'foreignKey':_0x9605('0x1e7'),'as':_0x9605('0x1e8')});db[_0x9605('0xf5')][_0x9605('0x125')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x9605('0xf5')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':'ToUserId','as':_0x9605('0x1e9')});db[_0x9605('0xf5')]['belongsTo'](db[_0x9605('0x40')],{'foreignKey':'ToMailQueueId','as':_0x9605('0x1ea')});db[_0x9605('0xf5')]['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x9605('0x1eb')});db[_0x9605('0x1ec')]['belongsTo'](db[_0x9605('0x68')],{});db[_0x9605('0x1ec')]['belongsTo'](db[_0x9605('0x67')],{});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x62')],{'foreignKey':'FromChatWebsiteId','as':_0x9605('0x1e8')});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ed'),'as':_0x9605('0x1ee')});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db[_0x9605('0x1ec')][_0x9605('0x125')](db[_0x9605('0x6c')],{'foreignKey':_0x9605('0x1f0'),'as':_0x9605('0x1ea')});db[_0x9605('0x1ec')]['belongsTo'](db[_0x9605('0x62')],{'foreignKey':_0x9605('0x1f1'),'as':_0x9605('0x1eb')});db[_0x9605('0xf8')][_0x9605('0x125')](db['FaxMessage'],{});db['FaxTransferReport'][_0x9605('0x125')](db[_0x9605('0x50')],{});db[_0x9605('0xf8')]['belongsTo'](db[_0x9605('0x141')],{'foreignKey':_0x9605('0x1f2'),'as':_0x9605('0x1e8')});db[_0x9605('0xf8')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ed'),'as':_0x9605('0x1ee')});db['FaxTransferReport']['belongsTo'](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db['FaxTransferReport'][_0x9605('0x125')](db[_0x9605('0x53')],{'foreignKey':_0x9605('0x1f3'),'as':_0x9605('0x1ea')});db[_0x9605('0xf8')][_0x9605('0x125')](db[_0x9605('0x141')],{'foreignKey':_0x9605('0x1f4'),'as':_0x9605('0x1eb')});db[_0x9605('0xf9')][_0x9605('0x125')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x9605('0x125')](db[_0x9605('0x5f')],{});db['OpenchannelTransferReport'][_0x9605('0x125')](db['OpenchannelAccount'],{'foreignKey':_0x9605('0x1f5'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x9605('0x125')](db['User'],{'foreignKey':_0x9605('0x1ed'),'as':_0x9605('0x1ee')});db[_0x9605('0xf9')][_0x9605('0x125')](db['User'],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9605('0x13e')],{'foreignKey':_0x9605('0x1f6'),'as':'ToQueue'});db[_0x9605('0xf9')][_0x9605('0x125')](db[_0x9605('0x5d')],{'foreignKey':'ToOpenchannelAccountId','as':_0x9605('0x1eb')});db[_0x9605('0xfb')]['belongsTo'](db[_0x9605('0x5a')],{});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x11f')],{});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x56')],{'foreignKey':_0x9605('0x1f7'),'as':_0x9605('0x1e8')});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':'FromUserId','as':_0x9605('0x1ee')});db['SmsTransferReport'][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':'ToAgent'});db[_0x9605('0xfb')][_0x9605('0x125')](db[_0x9605('0x5c')],{'foreignKey':_0x9605('0x1f8'),'as':_0x9605('0x1ea')});db[_0x9605('0xfb')]['belongsTo'](db[_0x9605('0x56')],{'foreignKey':_0x9605('0x1f9'),'as':_0x9605('0x1eb')});db[_0x9605('0x140')]['hasMany'](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x174'),'onDelete':'cascade'});db['CmList'][_0x9605('0x119')](db[_0x9605('0x7b')],{'as':_0x9605('0x1fa'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x140')][_0x9605('0x119')](db[_0x9605('0x72')],{'as':_0x9605('0x12a'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x9605('0x140')][_0x9605('0x119')](db[_0x9605('0x11b')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x9605('0x140')][_0x9605('0x119')](db[_0x9605('0x77')],{'as':_0x9605('0x1fb'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x140')][_0x9605('0x119')](db['ReportAgentPreview'],{'as':_0x9605('0x79'),'foreignKey':_0x9605('0x174')});db['CmList'][_0x9605('0x127')](db[_0x9605('0x1b')],{'as':_0x9605('0x1fc'),'through':_0x9605('0x15c')});db[_0x9605('0x140')]['belongsToMany'](db['User'],{'as':_0x9605('0x176'),'through':'cm_user_has_lists'});db[_0x9605('0x138')]['hasMany'](db[_0x9605('0x18')],{'as':'Extensions','onDelete':_0x9605('0x114')});db['VoicePrefix'][_0x9605('0x127')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0x9605('0x138')][_0x9605('0x127')](db['Team'],{'through':_0x9605('0x1e2'),'as':_0x9605('0x15d')});db[_0x9605('0xfe')]['hasMany'](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'foreignKey':_0x9605('0x126')});db[_0x9605('0xfe')][_0x9605('0x119')](db[_0x9605('0x100')],{'as':_0x9605('0x1fd'),'foreignKey':_0x9605('0x126'),'onDelete':'cascade'});db['UserProfileSection'][_0x9605('0x119')](db[_0x9605('0x1fe')],{'as':_0x9605('0x1ff'),'foreignKey':_0x9605('0x200'),'onDelete':_0x9605('0x114')});db['WhatsappAccount']['hasMany'](db[_0x9605('0x82')],{'as':_0x9605('0x16f'),'foreignKey':_0x9605('0x201'),'onDelete':'cascade'});db['WhatsappAccount']['hasMany'](db[_0x9605('0x170')],{'as':_0x9605('0x171'),'foreignKey':_0x9605('0x201')});db[_0x9605('0x14a')][_0x9605('0x119')](db[_0x9605('0x202')],{'as':_0x9605('0x161'),'foreignKey':_0x9605('0x201')});db[_0x9605('0x14a')][_0x9605('0x119')](db[_0x9605('0x1bd')],{'as':_0x9605('0x172')});db[_0x9605('0x14a')][_0x9605('0x119')](db[_0x9605('0x203')],{'as':_0x9605('0x14c'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x9605('0x14a')]['belongsTo'](db[_0x9605('0x140')],{'as':_0x9605('0x173'),'foreignKey':_0x9605('0x174')});db[_0x9605('0x14a')][_0x9605('0x125')](db[_0x9605('0x159')],{'as':'mandatoryDispositionPause','foreignKey':_0x9605('0x15b')});db[_0x9605('0x14a')][_0x9605('0x127')](db['User'],{'as':_0x9605('0x176'),'through':'user_has_whatsapp_accounts'});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x13')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9605('0x125')](db[_0x9605('0x10c')],{'onDelete':'restrict'});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x14a')],{'onDelete':_0x9605('0x16c')});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x157')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x158')});db[_0x9605('0x203')][_0x9605('0x125')](db[_0x9605('0x8c')],{'onDelete':_0x9605('0x16c'),'foreignKey':_0x9605('0x182')});db[_0x9605('0x1bd')][_0x9605('0x119')](db['WhatsappMessage'],{'as':_0x9605('0x161'),'onDelete':_0x9605('0x114'),'foreignKey':_0x9605('0x204')});db[_0x9605('0x1bd')]['belongsTo'](db[_0x9605('0x14a')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x9605('0x1bd')][_0x9605('0x125')](db['CmContact'],{'as':_0x9605('0x183'),'foreignKey':_0x9605('0x167')});db[_0x9605('0x1bd')][_0x9605('0x125')](db['User'],{'as':_0x9605('0x179'),'foreignKey':'UserId'});db[_0x9605('0x1bd')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':'whatsapp_interaction_has_tags','as':_0x9605('0x189')});db[_0x9605('0x1bd')][_0x9605('0x127')](db[_0x9605('0x8c')],{'through':_0x9605('0x1be'),'as':_0x9605('0x17b')});db[_0x9605('0x1bd')][_0x9605('0x127')](db[_0x9605('0x13')],{'as':_0x9605('0x17c'),'through':_0x9605('0x136'),'foreignKey':_0x9605('0x204')});db[_0x9605('0x202')]['belongsTo'](db['User'],{'as':_0x9605('0x13')});db[_0x9605('0x202')]['belongsTo'](db[_0x9605('0x72')],{'onDelete':_0x9605('0x114'),'as':'Contact'});db[_0x9605('0x202')]['belongsTo'](db[_0x9605('0x1bd')],{'onDelete':_0x9605('0x114'),'as':_0x9605('0x17e'),'foreignKey':'WhatsappInteractionId'});db[_0x9605('0x202')][_0x9605('0x125')](db[_0x9605('0x14a')],{'as':_0x9605('0x17f'),'foreignKey':_0x9605('0x201')});db['WhatsappQueueReport'][_0x9605('0x125')](db[_0x9605('0x14a')],{});db['WhatsappQueueReport'][_0x9605('0x125')](db[_0x9605('0x140')],{'as':'List','foreignKey':'ListId'});db[_0x9605('0x108')][_0x9605('0x125')](db[_0x9605('0x72')],{'as':'Contact','foreignKey':_0x9605('0x167')});db[_0x9605('0x108')]['belongsTo'](db[_0x9605('0x1bd')],{});db[_0x9605('0x108')][_0x9605('0x125')](db[_0x9605('0x10c')],{});db[_0x9605('0x108')]['belongsTo'](db[_0x9605('0x202')],{});db['WhatsappQueueReport'][_0x9605('0x125')](db['User'],{});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x202')],{});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x1bd')],{});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x14a')],{'foreignKey':_0x9605('0x205'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x9605('0x125')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x9605('0x1eb')});db[_0x9605('0x10a')]['belongsTo'](db[_0x9605('0x10c')],{'foreignKey':_0x9605('0x206'),'as':'ToQueue'});db[_0x9605('0x10a')]['belongsTo'](db[_0x9605('0x13')],{'foreignKey':'FromUserId','as':_0x9605('0x1ee')});db[_0x9605('0x10a')][_0x9605('0x125')](db[_0x9605('0x13')],{'foreignKey':_0x9605('0x1ef'),'as':_0x9605('0x1e9')});db[_0x9605('0x10c')]['belongsToMany'](db[_0x9605('0x13')],{'as':_0x9605('0x176'),'through':_0x9605('0x39'),'foreignKey':_0x9605('0x207')});db[_0x9605('0x10c')]['belongsToMany'](db[_0x9605('0xed')],{'through':_0x9605('0x208'),'as':_0x9605('0x15d')});db[_0x9605('0x111')][_0x9605('0x125')](db['User'],{'as':_0x9605('0x209'),'foreignKey':'UserId','onDelete':_0x9605('0x114'),'hooks':!![]});db[_0x9605('0x16a')][_0x9605('0x115')](db['Dynamics365Account'],{'as':_0x9605('0xcb'),'onDelete':_0x9605('0x16c')});db[_0x9605('0x16a')][_0x9605('0x115')](db[_0x9605('0x169')],{'as':'Imap','onDelete':_0x9605('0x16c')});db[_0x9605('0x16a')]['hasOne'](db[_0x9605('0x3c')],{'as':_0x9605('0x16e'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5ceaf6e..e336290 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f05=['./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/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/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','./api/contactItemType','/api/cm_contact_has_items','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticMetric','./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/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','/api/pm2','./api/pm2','./api/webbar','static','join','/apidoc','/www','root','/demo','3.10.1','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages'];(function(_0xb94781,_0xa2314b){var _0x3e1881=function(_0x57c689){while(--_0x57c689){_0xb94781['push'](_0xb94781['shift']());}};_0x3e1881(++_0xa2314b);}(_0x7f05,0xdc));var _0x57f0=function(_0x2d980a,_0x3f6769){_0x2d980a=_0x2d980a-0x0;var _0x1fa864=_0x7f05[_0x2d980a];return _0x1fa864;};'use strict';var path=require(_0x57f0('0x0'));var express=require(_0x57f0('0x1'));var errors=require(_0x57f0('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x57f0('0x3'))['setupLoggers'];var clientSideLogs=require(_0x57f0('0x4'));exports[_0x57f0('0x5')]=function(_0x52bde5){return setupLoggers(_0x52bde5)[_0x57f0('0x6')](function(){_0x52bde5[_0x57f0('0x7')]('/api/users',require(_0x57f0('0x8')));_0x52bde5[_0x57f0('0x7')]('/api/voice/chanspy',require(_0x57f0('0x9')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa'),require('./api/voiceContext'));_0x52bde5['use'](_0x57f0('0xb'),require('./api/voiceExtension'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xc'),require(_0x57f0('0xd')));_0x52bde5[_0x57f0('0x7')]('/api/voice/queues',require('./api/voiceQueue'));_0x52bde5[_0x57f0('0x7')]('/api/voice/recordings',require('./api/voiceRecording'));_0x52bde5['use']('/api/screen/recordings',require('./api/screenRecording'));_0x52bde5['use'](_0x57f0('0xe'),require(_0x57f0('0xf')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x10'),require('./api/voiceMailMessage'));_0x52bde5['use'](_0x57f0('0x11'),require(_0x57f0('0x12')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x13'),require(_0x57f0('0x14')));_0x52bde5[_0x57f0('0x7')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x52bde5[_0x57f0('0x7')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x52bde5['use']('/api/members/reports',require(_0x57f0('0x15')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x16'),require('./api/trunk'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x17'),require(_0x57f0('0x18')));_0x52bde5['use'](_0x57f0('0x19'),require(_0x57f0('0x1a')));_0x52bde5['use']('/api/mail/accounts',require(_0x57f0('0x1b')));_0x52bde5[_0x57f0('0x7')]('/api/mail/queues',require(_0x57f0('0x1c')));_0x52bde5['use'](_0x57f0('0x1d'),require(_0x57f0('0x1e')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x1f'),require('./api/mailInteraction'));_0x52bde5['use'](_0x57f0('0x20'),require('./api/mailMessage'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x21'),require(_0x57f0('0x22')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x23'),require(_0x57f0('0x24')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x25'),require('./api/dashboard'));_0x52bde5[_0x57f0('0x7')]('/api/dashboards/items',require('./api/dashboardItem'));_0x52bde5[_0x57f0('0x7')]('/api/fax/accounts',require(_0x57f0('0x26')));_0x52bde5['use']('/api/fax/applications',require(_0x57f0('0x27')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x28'),require(_0x57f0('0x29')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x2a'),require(_0x57f0('0x2b')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x2c'),require(_0x57f0('0x2d')));_0x52bde5['use'](_0x57f0('0x2e'),require(_0x57f0('0x2f')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x30'),require(_0x57f0('0x31')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x32'),require(_0x57f0('0x33')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x34'),require(_0x57f0('0x35')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x36'),require(_0x57f0('0x37')));_0x52bde5['use'](_0x57f0('0x38'),require(_0x57f0('0x39')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x3a'),require('./api/openchannelAccount'));_0x52bde5['use']('/api/openchannel/applications',require(_0x57f0('0x3b')));_0x52bde5['use'](_0x57f0('0x3c'),require(_0x57f0('0x3d')));_0x52bde5[_0x57f0('0x7')]('/api/openchannel/messages',require(_0x57f0('0x3e')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x3f'),require(_0x57f0('0x40')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x41'),require(_0x57f0('0x42')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x43'),require(_0x57f0('0x44')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x45'),require(_0x57f0('0x46')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x47'),require(_0x57f0('0x48')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x49'),require(_0x57f0('0x4a')));_0x52bde5['use']('/api/chat/offline_messages',require(_0x57f0('0x4b')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x4c'),require('./api/chatQueue'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x4d'),require(_0x57f0('0x4e')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x4f'),require(_0x57f0('0x50')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x51'),require(_0x57f0('0x52')));_0x52bde5['use'](_0x57f0('0x53'),require(_0x57f0('0x54')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x55'),require('./api/cmHopper'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x56'),require('./api/cmHopperBlack'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x57'),require(_0x57f0('0x58')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x59'),require(_0x57f0('0x5a')));_0x52bde5[_0x57f0('0x7')]('/api/cm/custom_fields',require(_0x57f0('0x5b')));_0x52bde5['use'](_0x57f0('0x5c'),require('./api/action'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x5d'),require(_0x57f0('0x5e')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x5f'),require(_0x57f0('0x60')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x61'),require(_0x57f0('0x62')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x63'),require('./api/condition'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x64'),require('./api/interval'));_0x52bde5['use'](_0x57f0('0x65'),require('./api/pause'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x66'),require(_0x57f0('0x67')));_0x52bde5['use'](_0x57f0('0x68'),require(_0x57f0('0x69')));_0x52bde5['use'](_0x57f0('0x6a'),require(_0x57f0('0x6b')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x6c'),require(_0x57f0('0x6d')));_0x52bde5[_0x57f0('0x7')]('/api/tags',require(_0x57f0('0x6e')));_0x52bde5[_0x57f0('0x7')]('/api/contact_item_types',require(_0x57f0('0x6f')));_0x52bde5['use'](_0x57f0('0x70'),require('./api/cmContactHasItem'));_0x52bde5[_0x57f0('0x7')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x71'),require(_0x57f0('0x72')));_0x52bde5['use'](_0x57f0('0x73'),require(_0x57f0('0x74')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x75'),require(_0x57f0('0x76')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x77'),require(_0x57f0('0x78')));_0x52bde5[_0x57f0('0x7')]('/api/integrations/reports',require(_0x57f0('0x79')));_0x52bde5[_0x57f0('0x7')]('/api/analytics/custom_reports',require(_0x57f0('0x7a')));_0x52bde5[_0x57f0('0x7')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x7b'),require('./api/analyticExtractedReport'));_0x52bde5['use']('/api/analytics/metrics',require(_0x57f0('0x7c')));_0x52bde5[_0x57f0('0x7')]('/api/analytics/field_reports',require(_0x57f0('0x7d')));_0x52bde5['use'](_0x57f0('0x7e'),require(_0x57f0('0x7f')));_0x52bde5['use'](_0x57f0('0x80'),require(_0x57f0('0x81')));_0x52bde5['use'](_0x57f0('0x82'),require(_0x57f0('0x83')));_0x52bde5['use'](_0x57f0('0x84'),require(_0x57f0('0x85')));_0x52bde5[_0x57f0('0x7')]('/api/integrations/sugarcrm/accounts',require(_0x57f0('0x86')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x87'),require('./api/intSugarcrmConfiguration'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x88'),require(_0x57f0('0x89')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x8a'),require(_0x57f0('0x8b')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x8c'),require(_0x57f0('0x8d')));_0x52bde5['use'](_0x57f0('0x8e'),require(_0x57f0('0x8f')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x90'),require(_0x57f0('0x91')));_0x52bde5[_0x57f0('0x7')]('/api/integrations/zoho/configurations',require(_0x57f0('0x92')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x93'),require('./api/intZohoField'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x94'),require(_0x57f0('0x95')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x96'),require(_0x57f0('0x97')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x98'),require(_0x57f0('0x99')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x9a'),require(_0x57f0('0x9b')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x9c'),require(_0x57f0('0x9d')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0x9e'),require(_0x57f0('0x9f')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa0'),require('./api/intVtigerAccount'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa1'),require('./api/intVtigerConfiguration'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa2'),require('./api/intVtigerField'));_0x52bde5['use'](_0x57f0('0xa3'),require(_0x57f0('0xa4')));_0x52bde5[_0x57f0('0x7')]('/api/integrations/servicenow/configurations',require(_0x57f0('0xa5')));_0x52bde5[_0x57f0('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa6'),require('./api/intDynamics365Account'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa7'),require(_0x57f0('0xa8')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xa9'),require(_0x57f0('0xaa')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xab'),require(_0x57f0('0xac')));_0x52bde5[_0x57f0('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x52bde5['use'](_0x57f0('0xad'),require('./api/intFreshsalesField'));_0x52bde5['use'](_0x57f0('0xae'),require(_0x57f0('0xaf')));_0x52bde5[_0x57f0('0x7')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x52bde5[_0x57f0('0x7')]('/api/chat/internal/messages',require(_0x57f0('0xb0')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xb1'),require(_0x57f0('0xb2')));_0x52bde5['use'](_0x57f0('0xb3'),require('./api/jscriptyQuestionReport'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xb4'),require(_0x57f0('0xb5')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xb6'),require(_0x57f0('0xb7')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xb8'),require(_0x57f0('0xb9')));_0x52bde5['use'](_0x57f0('0xba'),require(_0x57f0('0xbb')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xbc'),require(_0x57f0('0xbd')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xbe'),require(_0x57f0('0xbf')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xc0'),require(_0x57f0('0xc1')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xc2'),require('./api/squareProject'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xc3'),require(_0x57f0('0xc4')));_0x52bde5['use'](_0x57f0('0xc5'),require(_0x57f0('0xc6')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xc7'),require('./api/team'));_0x52bde5['use'](_0x57f0('0xc8'),require('./api/license'));_0x52bde5['use'](_0x57f0('0xc9'),require(_0x57f0('0xca')));_0x52bde5['use'](_0x57f0('0xcb'),require('./api/migration'));_0x52bde5[_0x57f0('0x7')]('/api/attachments',require(_0x57f0('0xcc')));_0x52bde5[_0x57f0('0x7')]('/api/plugins',require(_0x57f0('0xcd')));_0x52bde5['use'](_0x57f0('0xce'),require('./api/mailTransferReport'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xcf'),require(_0x57f0('0xd0')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xd1'),require('./api/faxTransferReport'));_0x52bde5[_0x57f0('0x7')]('/api/openchannel/reports/transfer',require(_0x57f0('0xd2')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xd3'),require(_0x57f0('0xd4')));_0x52bde5[_0x57f0('0x7')]('/api/cm/lists',require(_0x57f0('0xd5')));_0x52bde5[_0x57f0('0x7')]('/api/voice/prefixes',require(_0x57f0('0xd6')));_0x52bde5[_0x57f0('0x7')]('/api/userProfiles',require(_0x57f0('0xd7')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xd8'),require(_0x57f0('0xd9')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xda'),require(_0x57f0('0xdb')));_0x52bde5[_0x57f0('0x7')]('/api/userNotifications',require(_0x57f0('0xdc')));_0x52bde5['use'](_0x57f0('0xdd'),require(_0x57f0('0xde')));_0x52bde5['use'](_0x57f0('0xdf'),require(_0x57f0('0xe0')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xe1'),require(_0x57f0('0xe2')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xe3'),require(_0x57f0('0xe4')));_0x52bde5[_0x57f0('0x7')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x52bde5[_0x57f0('0x7')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x52bde5[_0x57f0('0x7')]('/api/whatsapp/queues',require(_0x57f0('0xe5')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xe6'),require(_0x57f0('0xe7')));_0x52bde5['use'](_0x57f0('0xe8'),require(_0x57f0('0xe9')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xea'),require(_0x57f0('0xeb')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xec'),require(_0x57f0('0xed')));_0x52bde5['use']('/api/auth/local',require(_0x57f0('0xee')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xef'),require('./api/authGoogle'));_0x52bde5['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xf0'),require(_0x57f0('0xf1')));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xf2'),require(_0x57f0('0xf3')));_0x52bde5['use']('/api/version',require('./api/version'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xf4'),require('./api/system'));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xf5'),require(_0x57f0('0xf6')));_0x52bde5[_0x57f0('0x7')]('/api/webbar',require(_0x57f0('0xf7')));_0x52bde5[_0x57f0('0x7')]('/api/logs',clientSideLogs);_0x52bde5[_0x57f0('0x7')]('/apidoc',express[_0x57f0('0xf8')](path[_0x57f0('0xf9')](config['root'],_0x57f0('0xfa'))));_0x52bde5['use'](_0x57f0('0xfb'),express['static'](path[_0x57f0('0xf9')](config[_0x57f0('0xfc')],_0x57f0('0xfb'))));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xfd'),express['static'](path[_0x57f0('0xf9')](config[_0x57f0('0xfc')],_0x57f0('0xfd'))));_0x52bde5[_0x57f0('0x7')]('/snippet',express['static'](path[_0x57f0('0xf9')](config['root'],'snippet',_0x57f0('0xfe'))));_0x52bde5[_0x57f0('0x7')](_0x57f0('0xff'),express['static'](path[_0x57f0('0xf9')](config[_0x57f0('0xfc')],_0x57f0('0x100'))));_0x52bde5['route'](_0x57f0('0x101'))[_0x57f0('0x102')](errors[0x194]);_0x52bde5[_0x57f0('0x103')]('/*')[_0x57f0('0x102')](function(_0x179dcb,_0x4bd1eb){_0x4bd1eb['sendFile'](path[_0x57f0('0x104')](_0x52bde5['get'](_0x57f0('0x105'))+_0x57f0('0x106')));});return _0x52bde5;});}; \ No newline at end of file +var _0x294b=['/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','/api/system','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport'];(function(_0x59b482,_0x5470b0){var _0x4b8c93=function(_0x46df07){while(--_0x46df07){_0x59b482['push'](_0x59b482['shift']());}};_0x4b8c93(++_0x5470b0);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xb294('0x0'));var express=require('express');var errors=require(_0xb294('0x1'));var config=require(_0xb294('0x2'));var setupLoggers=require(_0xb294('0x3'))[_0xb294('0x4')];var clientSideLogs=require(_0xb294('0x5'));exports[_0xb294('0x6')]=function(_0x58fe24){return setupLoggers(_0x58fe24)['then'](function(){_0x58fe24[_0xb294('0x7')](_0xb294('0x8'),require(_0xb294('0x9')));_0x58fe24[_0xb294('0x7')](_0xb294('0xa'),require('./api/voiceChanSpy'));_0x58fe24[_0xb294('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x58fe24['use'](_0xb294('0xb'),require(_0xb294('0xc')));_0x58fe24[_0xb294('0x7')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x58fe24['use'](_0xb294('0xd'),require(_0xb294('0xe')));_0x58fe24[_0xb294('0x7')](_0xb294('0xf'),require(_0xb294('0x10')));_0x58fe24[_0xb294('0x7')](_0xb294('0x11'),require(_0xb294('0x12')));_0x58fe24[_0xb294('0x7')](_0xb294('0x13'),require('./api/voiceMail'));_0x58fe24['use'](_0xb294('0x14'),require('./api/voiceMailMessage'));_0x58fe24['use'](_0xb294('0x15'),require(_0xb294('0x16')));_0x58fe24[_0xb294('0x7')](_0xb294('0x17'),require(_0xb294('0x18')));_0x58fe24[_0xb294('0x7')](_0xb294('0x19'),require(_0xb294('0x1a')));_0x58fe24[_0xb294('0x7')](_0xb294('0x1b'),require(_0xb294('0x1c')));_0x58fe24['use'](_0xb294('0x1d'),require(_0xb294('0x1e')));_0x58fe24['use']('/api/trunks',require(_0xb294('0x1f')));_0x58fe24[_0xb294('0x7')](_0xb294('0x20'),require(_0xb294('0x21')));_0x58fe24[_0xb294('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x58fe24[_0xb294('0x7')](_0xb294('0x22'),require('./api/mailAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x23'),require('./api/mailQueue'));_0x58fe24[_0xb294('0x7')](_0xb294('0x24'),require(_0xb294('0x25')));_0x58fe24['use']('/api/mail/interactions',require(_0xb294('0x26')));_0x58fe24['use'](_0xb294('0x27'),require(_0xb294('0x28')));_0x58fe24[_0xb294('0x7')]('/api/mail/applications',require(_0xb294('0x29')));_0x58fe24['use'](_0xb294('0x2a'),require(_0xb294('0x2b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x2c'),require(_0xb294('0x2d')));_0x58fe24[_0xb294('0x7')](_0xb294('0x2e'),require(_0xb294('0x2f')));_0x58fe24[_0xb294('0x7')]('/api/fax/accounts',require('./api/faxAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x30'),require(_0xb294('0x31')));_0x58fe24[_0xb294('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x58fe24[_0xb294('0x7')](_0xb294('0x32'),require(_0xb294('0x33')));_0x58fe24[_0xb294('0x7')]('/api/fax/queues',require('./api/faxQueue'));_0x58fe24['use'](_0xb294('0x34'),require(_0xb294('0x35')));_0x58fe24[_0xb294('0x7')](_0xb294('0x36'),require(_0xb294('0x37')));_0x58fe24[_0xb294('0x7')](_0xb294('0x38'),require(_0xb294('0x39')));_0x58fe24[_0xb294('0x7')](_0xb294('0x3a'),require(_0xb294('0x3b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x3c'),require('./api/smsMessage'));_0x58fe24['use'](_0xb294('0x3d'),require('./api/smsQueue'));_0x58fe24[_0xb294('0x7')](_0xb294('0x3e'),require(_0xb294('0x3f')));_0x58fe24[_0xb294('0x7')]('/api/openchannel/applications',require(_0xb294('0x40')));_0x58fe24[_0xb294('0x7')](_0xb294('0x41'),require(_0xb294('0x42')));_0x58fe24[_0xb294('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x58fe24['use'](_0xb294('0x43'),require(_0xb294('0x44')));_0x58fe24[_0xb294('0x7')](_0xb294('0x45'),require(_0xb294('0x46')));_0x58fe24[_0xb294('0x7')](_0xb294('0x47'),require('./api/openchannelQueueReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0x48'),require(_0xb294('0x49')));_0x58fe24[_0xb294('0x7')](_0xb294('0x4a'),require(_0xb294('0x4b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x4c'),require('./api/chatMessage'));_0x58fe24['use'](_0xb294('0x4d'),require('./api/chatOfflineMessage'));_0x58fe24[_0xb294('0x7')]('/api/chat/queues',require(_0xb294('0x4e')));_0x58fe24[_0xb294('0x7')](_0xb294('0x4f'),require(_0xb294('0x50')));_0x58fe24[_0xb294('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x58fe24[_0xb294('0x7')](_0xb294('0x51'),require(_0xb294('0x52')));_0x58fe24[_0xb294('0x7')](_0xb294('0x53'),require(_0xb294('0x54')));_0x58fe24['use']('/api/cm/hopper',require(_0xb294('0x55')));_0x58fe24[_0xb294('0x7')](_0xb294('0x56'),require(_0xb294('0x57')));_0x58fe24['use']('/api/cm/hopper_final',require(_0xb294('0x58')));_0x58fe24['use'](_0xb294('0x59'),require(_0xb294('0x5a')));_0x58fe24['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x58fe24[_0xb294('0x7')](_0xb294('0x5b'),require(_0xb294('0x5c')));_0x58fe24['use'](_0xb294('0x5d'),require(_0xb294('0x5e')));_0x58fe24[_0xb294('0x7')](_0xb294('0x5f'),require(_0xb294('0x60')));_0x58fe24[_0xb294('0x7')](_0xb294('0x61'),require('./api/disposition'));_0x58fe24['use'](_0xb294('0x62'),require(_0xb294('0x63')));_0x58fe24['use']('/api/intervals',require(_0xb294('0x64')));_0x58fe24[_0xb294('0x7')](_0xb294('0x65'),require(_0xb294('0x66')));_0x58fe24['use'](_0xb294('0x67'),require('./api/cdr'));_0x58fe24['use'](_0xb294('0x68'),require(_0xb294('0x69')));_0x58fe24[_0xb294('0x7')](_0xb294('0x6a'),require(_0xb294('0x6b')));_0x58fe24['use'](_0xb294('0x6c'),require(_0xb294('0x6d')));_0x58fe24[_0xb294('0x7')]('/api/tags',require('./api/tag'));_0x58fe24[_0xb294('0x7')](_0xb294('0x6e'),require(_0xb294('0x6f')));_0x58fe24[_0xb294('0x7')](_0xb294('0x70'),require('./api/cmContactHasItem'));_0x58fe24[_0xb294('0x7')](_0xb294('0x71'),require(_0xb294('0x72')));_0x58fe24[_0xb294('0x7')](_0xb294('0x73'),require(_0xb294('0x74')));_0x58fe24[_0xb294('0x7')](_0xb294('0x75'),require(_0xb294('0x76')));_0x58fe24[_0xb294('0x7')]('/api/variables',require(_0xb294('0x77')));_0x58fe24['use'](_0xb294('0x78'),require(_0xb294('0x79')));_0x58fe24[_0xb294('0x7')](_0xb294('0x7a'),require(_0xb294('0x7b')));_0x58fe24['use']('/api/analytics/custom_reports',require(_0xb294('0x7c')));_0x58fe24[_0xb294('0x7')](_0xb294('0x7d'),require(_0xb294('0x7e')));_0x58fe24['use'](_0xb294('0x7f'),require(_0xb294('0x80')));_0x58fe24[_0xb294('0x7')](_0xb294('0x81'),require(_0xb294('0x82')));_0x58fe24[_0xb294('0x7')]('/api/analytics/field_reports',require(_0xb294('0x83')));_0x58fe24[_0xb294('0x7')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x58fe24[_0xb294('0x7')]('/api/integrations/salesforce/accounts',require(_0xb294('0x84')));_0x58fe24['use']('/api/integrations/salesforce/configurations',require(_0xb294('0x85')));_0x58fe24[_0xb294('0x7')](_0xb294('0x86'),require(_0xb294('0x87')));_0x58fe24[_0xb294('0x7')](_0xb294('0x88'),require(_0xb294('0x89')));_0x58fe24['use']('/api/integrations/sugarcrm/configurations',require(_0xb294('0x8a')));_0x58fe24[_0xb294('0x7')](_0xb294('0x8b'),require('./api/intSugarcrmField'));_0x58fe24[_0xb294('0x7')]('/api/integrations/desk/accounts',require(_0xb294('0x8c')));_0x58fe24[_0xb294('0x7')](_0xb294('0x8d'),require(_0xb294('0x8e')));_0x58fe24[_0xb294('0x7')](_0xb294('0x8f'),require('./api/intDeskField'));_0x58fe24['use']('/api/integrations/zoho/accounts',require(_0xb294('0x90')));_0x58fe24[_0xb294('0x7')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x58fe24[_0xb294('0x7')](_0xb294('0x91'),require(_0xb294('0x92')));_0x58fe24[_0xb294('0x7')](_0xb294('0x93'),require('./api/intZendeskAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x94'),require(_0xb294('0x95')));_0x58fe24[_0xb294('0x7')](_0xb294('0x96'),require(_0xb294('0x97')));_0x58fe24['use'](_0xb294('0x98'),require(_0xb294('0x99')));_0x58fe24[_0xb294('0x7')](_0xb294('0x9a'),require(_0xb294('0x9b')));_0x58fe24[_0xb294('0x7')](_0xb294('0x9c'),require('./api/intFreshdeskField'));_0x58fe24['use'](_0xb294('0x9d'),require('./api/intVtigerAccount'));_0x58fe24[_0xb294('0x7')](_0xb294('0x9e'),require(_0xb294('0x9f')));_0x58fe24['use']('/api/integrations/vtiger/fields',require(_0xb294('0xa0')));_0x58fe24[_0xb294('0x7')](_0xb294('0xa1'),require(_0xb294('0xa2')));_0x58fe24['use'](_0xb294('0xa3'),require('./api/intServicenowConfiguration'));_0x58fe24['use'](_0xb294('0xa4'),require(_0xb294('0xa5')));_0x58fe24[_0xb294('0x7')]('/api/integrations/dynamics365/accounts',require(_0xb294('0xa6')));_0x58fe24['use'](_0xb294('0xa7'),require(_0xb294('0xa8')));_0x58fe24[_0xb294('0x7')]('/api/integrations/dynamics365/fields',require(_0xb294('0xa9')));_0x58fe24['use'](_0xb294('0xaa'),require('./api/intFreshsalesAccount'));_0x58fe24[_0xb294('0x7')]('/api/integrations/freshsales/configurations',require(_0xb294('0xab')));_0x58fe24[_0xb294('0x7')]('/api/integrations/freshsales/fields',require(_0xb294('0xac')));_0x58fe24['use']('/api/networks',require(_0xb294('0xad')));_0x58fe24[_0xb294('0x7')](_0xb294('0xae'),require('./api/chatQueueReport'));_0x58fe24[_0xb294('0x7')]('/api/chat/internal/messages',require(_0xb294('0xaf')));_0x58fe24[_0xb294('0x7')](_0xb294('0xb0'),require(_0xb294('0xb1')));_0x58fe24[_0xb294('0x7')]('/api/jscripty/questions/reports',require(_0xb294('0xb2')));_0x58fe24['use'](_0xb294('0xb3'),require(_0xb294('0xb4')));_0x58fe24['use'](_0xb294('0xb5'),require(_0xb294('0xb6')));_0x58fe24['use'](_0xb294('0xb7'),require(_0xb294('0xb8')));_0x58fe24[_0xb294('0x7')](_0xb294('0xb9'),require(_0xb294('0xba')));_0x58fe24[_0xb294('0x7')]('/api/jscripty/projects',require(_0xb294('0xbb')));_0x58fe24[_0xb294('0x7')](_0xb294('0xbc'),require('./api/setting'));_0x58fe24[_0xb294('0x7')](_0xb294('0xbd'),require(_0xb294('0xbe')));_0x58fe24[_0xb294('0x7')](_0xb294('0xbf'),require(_0xb294('0xc0')));_0x58fe24['use'](_0xb294('0xc1'),require(_0xb294('0xc2')));_0x58fe24[_0xb294('0x7')]('/api/square/messages',require(_0xb294('0xc3')));_0x58fe24[_0xb294('0x7')]('/api/teams',require('./api/team'));_0x58fe24[_0xb294('0x7')](_0xb294('0xc4'),require('./api/license'));_0x58fe24[_0xb294('0x7')]('/api/campaigns',require(_0xb294('0xc5')));_0x58fe24[_0xb294('0x7')](_0xb294('0xc6'),require(_0xb294('0xc7')));_0x58fe24[_0xb294('0x7')]('/api/attachments',require(_0xb294('0xc8')));_0x58fe24[_0xb294('0x7')](_0xb294('0xc9'),require(_0xb294('0xca')));_0x58fe24[_0xb294('0x7')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0xcb'),require('./api/chatTransferReport'));_0x58fe24['use'](_0xb294('0xcc'),require('./api/faxTransferReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0xcd'),require(_0xb294('0xce')));_0x58fe24[_0xb294('0x7')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x58fe24[_0xb294('0x7')](_0xb294('0xcf'),require(_0xb294('0xd0')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd1'),require('./api/voicePrefix'));_0x58fe24[_0xb294('0x7')](_0xb294('0xd2'),require('./api/userProfile'));_0x58fe24[_0xb294('0x7')](_0xb294('0xd3'),require(_0xb294('0xd4')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd5'),require(_0xb294('0xd6')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd7'),require(_0xb294('0xd8')));_0x58fe24[_0xb294('0x7')](_0xb294('0xd9'),require(_0xb294('0xda')));_0x58fe24['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x58fe24[_0xb294('0x7')](_0xb294('0xdb'),require(_0xb294('0xdc')));_0x58fe24[_0xb294('0x7')](_0xb294('0xdd'),require(_0xb294('0xde')));_0x58fe24[_0xb294('0x7')]('/api/whatsapp/reports/queue',require(_0xb294('0xdf')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe0'),require(_0xb294('0xe1')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe2'),require(_0xb294('0xe3')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe4'),require(_0xb294('0xe5')));_0x58fe24[_0xb294('0x7')](_0xb294('0xe6'),require(_0xb294('0xe7')));_0x58fe24['use'](_0xb294('0xe8'),require(_0xb294('0xe9')));_0x58fe24['use'](_0xb294('0xea'),require(_0xb294('0xeb')));_0x58fe24[_0xb294('0x7')](_0xb294('0xec'),require(_0xb294('0xed')));_0x58fe24['use']('/api/auth/google',require('./api/authGoogle'));_0x58fe24[_0xb294('0x7')](_0xb294('0xee'),require(_0xb294('0xef')));_0x58fe24[_0xb294('0x7')]('/api/jira',require('./api/jira'));_0x58fe24[_0xb294('0x7')](_0xb294('0xf0'),require(_0xb294('0xf1')));_0x58fe24[_0xb294('0x7')](_0xb294('0xf2'),require('./api/version'));_0x58fe24['use'](_0xb294('0xf3'),require('./api/system'));_0x58fe24[_0xb294('0x7')]('/api/pm2',require('./api/pm2'));_0x58fe24[_0xb294('0x7')]('/api/webbar',require(_0xb294('0xf4')));_0x58fe24['use'](_0xb294('0xf5'),clientSideLogs);_0x58fe24[_0xb294('0x7')](_0xb294('0xf6'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config['root'],_0xb294('0xf6'))));_0x58fe24['use'](_0xb294('0xf9'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config[_0xb294('0xfa')],_0xb294('0xf9'))));_0x58fe24['use'](_0xb294('0xfb'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config[_0xb294('0xfa')],'/demo')));_0x58fe24[_0xb294('0x7')]('/snippet',express[_0xb294('0xf7')](path['join'](config['root'],_0xb294('0xfc'),_0xb294('0xfd'))));_0x58fe24[_0xb294('0x7')](_0xb294('0xfe'),express[_0xb294('0xf7')](path[_0xb294('0xf8')](config['root'],_0xb294('0xff'))));_0x58fe24[_0xb294('0x100')](_0xb294('0x101'))[_0xb294('0x102')](errors[0x194]);_0x58fe24[_0xb294('0x100')]('/*')[_0xb294('0x102')](function(_0x18b4d1,_0x32db0b){_0x32db0b['sendFile'](path['resolve'](_0x58fe24[_0xb294('0x102')](_0xb294('0x103'))+_0xb294('0x104')));});return _0x58fe24;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index cb209fe..fd4abe1 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5b1=['../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0xd5b1,0x116));var _0x1d5b=function(_0x4f7e37,_0x291c9f){_0x4f7e37=_0x4f7e37-0x0;var _0x442ea8=_0xd5b1[_0x4f7e37];return _0x442ea8;};'use strict';var jayson=require(_0x1d5b('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x1d5b('0x1')]=function(){return new Promise(function(_0x510342,_0x151066){var _0x2d3bcc={};_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x2')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x3')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x5')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x6')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x7')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x8')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x9')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0xa')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0xb')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0xc')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0xd')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0xe')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0xf')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x10')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x11')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x12')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x13')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x14')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x15')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x16')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x17')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/faxMessage/faxMessage.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x18')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x19')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x1a')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/smsInteraction/smsInteraction.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x1b')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/smsQueue/smsQueue.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x1c')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x1d')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x1e')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x1f')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x20')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/chatInteraction/chatInteraction.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x21')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x22')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x23')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/cmHopper/cmHopper.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x24')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x25')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x26')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x27')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/sound/sound.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x28')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x29')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x2a')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x2b')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x2c')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x2d')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x2e')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x2f')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x30')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x31')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x32')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require('../api/squareReport/squareReport.rpc'));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x33')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/setting/setting.rpc'));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/squareOdbc/squareOdbc.rpc'));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x34')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x35')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x36')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x37')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x38')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x39')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x3a')));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x3b')));_0x2d3bcc=_[_0x1d5b('0x4')](_0x2d3bcc,require(_0x1d5b('0x3c')));_0x2d3bcc=_['merge'](_0x2d3bcc,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2d3bcc=_['merge'](_0x2d3bcc,require(_0x1d5b('0x3d')));var _0x2a3f48=jayson['server'](_0x2d3bcc)[_0x1d5b('0x3e')]();var _0xf15e44=config[_0x1d5b('0x3f')][_0x1d5b('0x40')]||config['port']+0x1;var _0x425ef8=config[_0x1d5b('0x3f')]['ip']||_0x1d5b('0x41');_0x2a3f48['on'](_0x1d5b('0x42'),function(_0x13796e){return _0x151066(_0x13796e);});_0x2a3f48['listen'](_0xf15e44,_0x425ef8,function(){console[_0x1d5b('0x43')](_0x1d5b('0x44'),_0x425ef8,_0xf15e44);require(_0x1d5b('0x45'))['default']();return _0x510342(_0x1d5b('0x46')+_0x425ef8+':'+_0xf15e44);});});}; \ No newline at end of file +var _0xcd59=['../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/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/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x343577,_0x38d27c){var _0x1ee35b=function(_0x3df59c){while(--_0x3df59c){_0x343577['push'](_0x343577['shift']());}};_0x1ee35b(++_0x38d27c);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5ebf85,_0x598413){_0x5ebf85=_0x5ebf85-0x0;var _0x5b175a=_0xcd59[_0x5ebf85];return _0x5b175a;};'use strict';var jayson=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var config=require(_0x9cd5('0x2'));exports[_0x9cd5('0x3')]=function(){return new Promise(function(_0x271070,_0x302b21){var _0x4b93b9={};_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x5')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x6')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x7')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x8')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x9')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0xa')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xb')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xc')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xd')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/trunk/trunk.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xe')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0xf')));_0x4b93b9=_['merge'](_0x4b93b9,require('../api/mailServerIn/mailServerIn.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x10')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x11')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x12')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x13')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x14')));_0x4b93b9=_['merge'](_0x4b93b9,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x15')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/faxApplication/faxApplication.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x16')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/faxMessage/faxMessage.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x17')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x18')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x19')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x1a')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1b')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1c')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x1d')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1e')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x1f')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x20')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x21')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x22')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x23')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/chatQueue/chatQueue.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x24')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x25')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x26')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x27')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x28')));_0x4b93b9=_['merge'](_0x4b93b9,require('../api/pause/pause.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x29')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2a')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2b')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2c')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2d')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2e')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x2f')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x30')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x31')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x32')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x33')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x34')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x35')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x36')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x37')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x38')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x39')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3a')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/campaign/campaign.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/attachment/attachment.rpc'));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x3b')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3c')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3d')));_0x4b93b9=_[_0x9cd5('0x4')](_0x4b93b9,require(_0x9cd5('0x3e')));_0x4b93b9=_['merge'](_0x4b93b9,require(_0x9cd5('0x3f')));var _0x3f50de=jayson[_0x9cd5('0x40')](_0x4b93b9)[_0x9cd5('0x41')]();var _0x2c6626=config[_0x9cd5('0x42')]['port']||config[_0x9cd5('0x43')]+0x1;var _0x2cbc5f=config[_0x9cd5('0x42')]['ip']||_0x9cd5('0x44');_0x3f50de['on'](_0x9cd5('0x45'),function(_0x4182bd){return _0x302b21(_0x4182bd);});_0x3f50de[_0x9cd5('0x3')](_0x2c6626,_0x2cbc5f,function(){console[_0x9cd5('0x46')](_0x9cd5('0x47'),_0x2cbc5f,_0x2c6626);require(_0x9cd5('0x48'))[_0x9cd5('0x49')]();return _0x271070(_0x9cd5('0x4a')+_0x2cbc5f+':'+_0x2c6626);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 739299b..e6902e5 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 _0x6f8e=['command','write','inherits','prototype','sync','sendRequest','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./reply','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe'];(function(_0x3b0c35,_0x19bcbe){var _0x3e1971=function(_0x762a43){while(--_0x762a43){_0x3b0c35['push'](_0x3b0c35['shift']());}};_0x3e1971(++_0x19bcbe);}(_0x6f8e,0x15a));var _0xe6f8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6f8e[_0x5ddb1c];return _0x354adc;};'use strict';var util=require(_0xe6f8('0x0'));var _=require(_0xe6f8('0x1'));var EventEmitter=require(_0xe6f8('0x2'))['EventEmitter'];var AGIReply=require(_0xe6f8('0x3'));var AGIError=require('./error');function AGIChannel(_0x50033d){var _0x448909=this,_0x1ca3f0=new AGIReply(),_0x99844e=![],_0x2c9515={};EventEmitter[_0xe6f8('0x4')](_0x448909);_0x50033d[_0xe6f8('0x5')](_0xe6f8('0x6'));_0x50033d[_0xe6f8('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ca3f0['setEncoding'](_0xe6f8('0x6'));_0x1ca3f0['on'](_0xe6f8('0x8'),function(_0x3ec0b2){for(var _0x1524dd in _0x3ec0b2){_0x448909[_0x1524dd]=_0x3ec0b2[_0x1524dd];}_0x448909['emit'](_0xe6f8('0x9'));});_0x1ca3f0['on'](_0xe6f8('0xa'),function(_0x1e3610){if(_0x1e3610[_0xe6f8('0xb')]()==_0xe6f8('0xc')){_0x448909[_0xe6f8('0xd')](_0xe6f8('0xc'));return;}if(_0x1e3610[_0xe6f8('0xe')](0x0,0xb)==_0xe6f8('0xf')){_0x99844e=!![];}if(_0x99844e){_0x2c9515['rx']+=_0x1e3610+'\x0a';if(_0x1e3610[_0xe6f8('0x10')](_0xe6f8('0x11'))!=-0x1){_0x99844e=![];}}else{_0x2c9515['rx']=_0x1e3610;}if(_0x99844e){return;}if(typeof _0x2c9515['cb']==_0xe6f8('0x12')){var _0x4d7669=_0x2c9515['rx'][_0xe6f8('0xe')](0x0,0x3),_0xa7df3c=null,_0x31679a=null;_0x4d7669=parseInt(_0x4d7669);if(isNaN(_0x4d7669)){_0x2c9515['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe6f8('0x13')});return;}if(_0x4d7669!=0xc8){_0x2c9515['cb'](null,{'code':_0x4d7669,'result':-0x1,'extra':'KO'});return;}_0xa7df3c=_0x2c9515['rx']['substring'](0x4)[_0xe6f8('0x14')](_0xe6f8('0x15'),'');if(_0xa7df3c[_0xe6f8('0x16')]('\x20')!=-0x1){_0xa7df3c=_0xa7df3c['substr'](0x0,_0xa7df3c[_0xe6f8('0x16')]('\x20'));}if(_[_0xe6f8('0x17')](_0xa7df3c,'-1')){_0xa7df3c=parseInt(_0xa7df3c);}_0x31679a=_0x2c9515['rx'][_0xe6f8('0x18')]('\x20');if(_0x31679a[_0xe6f8('0x19')]==0x3){_0x31679a=_0x31679a[0x2][_0xe6f8('0xe')](0x1,_0x31679a[0x2][_0xe6f8('0x19')]-0x1);}else if(_0x31679a[_0xe6f8('0x19')]>0x3){var _0x31d72a=/\((.+)\)/;var _0x2e71c0=_0x2c9515['rx'][_0xe6f8('0x1a')](_0x31d72a);if(_0x2e71c0){_0x31679a=_0x2e71c0[0x1];}else{_0x31679a=null;}}else{_0x31679a=null;}_0x2c9515['cb'](null,{'code':_0x4d7669,'result':_0xa7df3c,'extra':_0x31679a});}});_0x50033d['on'](_0xe6f8('0x1b'),function(_0x225a29){_0x448909[_0xe6f8('0xd')]('error',new AGIError(_0xe6f8('0x1c'),_0x225a29['code']));});_0x50033d['on']('close',function(){_0x448909[_0xe6f8('0xd')](_0xe6f8('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x50033d['on'](_0xe6f8('0x1e'),function(){_0x448909[_0xe6f8('0xd')](_0xe6f8('0x1e'),new AGIError(_0xe6f8('0x1f')));_0x50033d[_0xe6f8('0x20')]();});_0x50033d[_0xe6f8('0x21')](_0x1ca3f0);this[_0xe6f8('0x22')]=function(_0x582dcc,_0x37ab06){var _0x582dcc=_0x582dcc||'',_0x37ab06=typeof _0x37ab06==_0xe6f8('0x12')?_0x37ab06:new Function();_0x2c9515={'tx':_0x582dcc,'rx':'','cb':_0x37ab06};_0x50033d[_0xe6f8('0x23')](_0x582dcc+'\x0a');},this[_0xe6f8('0x1d')]=function(){_0x50033d[_0xe6f8('0x20')]();};}util[_0xe6f8('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xe6f8('0x25')]['sendRequest']=function(_0x52c810){return this[_0xe6f8('0x22')][_0xe6f8('0x26')](this,_0x52c810);};AGIChannel[_0xe6f8('0x25')]['answer']=function(){return this[_0xe6f8('0x27')](_0xe6f8('0x28'));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x29')]=function(_0x3ee83d,_0x2abe5d,_0x4fc462){_0x3ee83d=_0x3ee83d===undefined?_0xe6f8('0x2a'):_0x3ee83d;_0x2abe5d=_0x2abe5d===undefined?'5':_0x2abe5d;_0x4fc462=_0x4fc462===undefined?'1':_0x4fc462;return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x3ee83d,_0x2abe5d*0x3e8,_0x4fc462));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x2c')]=function(_0x5e023e){_0x5e023e=_0x5e023e||'NO\x20MESSAGE';return this['sendRequest'](util['format'](_0xe6f8('0x2d'),_0x5e023e));};AGIChannel[_0xe6f8('0x25')]['exec']=function(_0x45ae3d,_0x3cee1d){if(_[_0xe6f8('0x2e')](_0x3cee1d)){return this['sendRequest'](util['format'](_0xe6f8('0x2f'),_0x45ae3d,_0x3cee1d[_0xe6f8('0x30')](',')));}return this['sendRequest'](util[_0xe6f8('0x2b')]('EXEC\x20%s\x20%s',_0x45ae3d,_0x3cee1d));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x31')]=function(_0x301c84){return this['sendRequest'](util[_0xe6f8('0x2b')]('SET\x20CONTEXT\x20%s',_0x301c84));};AGIChannel[_0xe6f8('0x25')]['setExtension']=function(_0x4f6fdd){return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')](_0xe6f8('0x32'),_0x4f6fdd));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x33')]=function(_0x39d073){return this['sendRequest'](util[_0xe6f8('0x2b')](_0xe6f8('0x34'),_0x39d073));};AGIChannel['prototype']['hangup']=function(){return this[_0xe6f8('0x27')]('HANGUP');};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x35')]=function(_0x3d180b,_0x3208f0){var _0x2fb4ba=_['isBoolean'](_0x3208f0)||_[_0xe6f8('0x36')](_0x3208f0)?_0x3208f0['toString']():_0x3208f0;return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3d180b,_0x2fb4ba?_0x2fb4ba['toString']()[_0xe6f8('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x37')]=function(_0x272eb1,_0x24bbc3){return this[_0xe6f8('0x27')](util['format'](_0xe6f8('0x38'),_0x272eb1,_0x24bbc3));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x39')]=function(_0x2cd8a2,_0x15500c){return this[_0xe6f8('0x27')](util['format'](_0xe6f8('0x3a'),_0x2cd8a2,_0x15500c));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x3b')]=function(_0x4761e3,_0x3a15e2){return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')](_0xe6f8('0x3c'),_0x4761e3,_0x3a15e2));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x3d')]=function(_0x11c43f,_0x4b2e12,_0xa87cb9){_0x4b2e12=_0x4b2e12||this[_0xe6f8('0x3e')];_0xa87cb9=_0xa87cb9||0x1;this[_0xe6f8('0x31')](_0x11c43f);this[_0xe6f8('0x3f')](_0x4b2e12);this[_0xe6f8('0x33')](_0xa87cb9);return this[_0xe6f8('0x2c')](util[_0xe6f8('0x2b')](_0xe6f8('0x40'),_0x11c43f,_0x4b2e12,_0xa87cb9));};AGIChannel[_0xe6f8('0x25')]['getVariable']=function(_0x3ba474){return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')](_0xe6f8('0x41'),_0x3ba474));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x42')]=function(_0x434ef4,_0x1db2a5,_0x77717b,_0x353310,_0x2f38a1,_0x3fb216){_0x1db2a5=_0x1db2a5||'wav';_0x77717b=_0x77717b||'';_0x353310=_0x353310===undefined?-0x1:_0x353310==='-1'?-0x1:_0x353310*0x3e8;_0x2f38a1=_0x2f38a1===undefined?'':'s='+_0x2f38a1;_0x3fb216=_0x3fb216?'BEEP':'';return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')](_0xe6f8('0x43'),_0x434ef4,_0x1db2a5,_0x77717b,_0x353310,_0x3fb216,_0x2f38a1));};AGIChannel['prototype'][_0xe6f8('0x44')]=function(_0x10c3bb,_0x25288a){_0x25288a=_0x25288a||'';return this[_0xe6f8('0x27')](util[_0xe6f8('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x10c3bb,_0x25288a));};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x45')]=function(_0x38c246){return this[_0xe6f8('0x46')](_0xe6f8('0x47'),_0x38c246);};AGIChannel[_0xe6f8('0x25')][_0xe6f8('0x48')]=function(_0x2c250f){return this[_0xe6f8('0x46')](_0xe6f8('0x49'),_0x2c250f);};AGIChannel['prototype']['error']=function(_0x44e2c7,_0xffc4e5){this[_0xe6f8('0x2c')](util[_0xe6f8('0x2b')](_0xe6f8('0x4a'),_0x44e2c7['id'],_0x44e2c7[_0xe6f8('0x4b')],_0xffc4e5));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x89d6=['code','close','emit','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sendRequest','prototype','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR'];(function(_0x43045e,_0xf8a854){var _0x267f39=function(_0x8fb6e6){while(--_0x8fb6e6){_0x43045e['push'](_0x43045e['shift']());}};_0x267f39(++_0xf8a854);}(_0x89d6,0x119));var _0x689d=function(_0x1517a4,_0x1db496){_0x1517a4=_0x1517a4-0x0;var _0x49c07c=_0x89d6[_0x1517a4];return _0x49c07c;};'use strict';var util=require(_0x689d('0x0'));var _=require(_0x689d('0x1'));var EventEmitter=require(_0x689d('0x2'))[_0x689d('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x689d('0x4'));function AGIChannel(_0x33b6ca){var _0x36ca6d=this,_0x48dd20=new AGIReply(),_0x2d9ee9=![],_0x3da648={};EventEmitter[_0x689d('0x5')](_0x36ca6d);_0x33b6ca[_0x689d('0x6')](_0x689d('0x7'));_0x33b6ca[_0x689d('0x8')](0x8*0x3c*0x3c*0x3e8);_0x48dd20['setEncoding'](_0x689d('0x7'));_0x48dd20['on'](_0x689d('0x9'),function(_0xaa8c77){for(var _0x5258ce in _0xaa8c77){_0x36ca6d[_0x5258ce]=_0xaa8c77[_0x5258ce];}_0x36ca6d['emit'](_0x689d('0xa'));});_0x48dd20['on'](_0x689d('0xb'),function(_0x46e636){if(_0x46e636[_0x689d('0xc')]()=='hangup'){_0x36ca6d['emit'](_0x689d('0xd'));return;}if(_0x46e636[_0x689d('0xe')](0x0,0xb)==_0x689d('0xf')){_0x2d9ee9=!![];}if(_0x2d9ee9){_0x3da648['rx']+=_0x46e636+'\x0a';if(_0x46e636[_0x689d('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x2d9ee9=![];}}else{_0x3da648['rx']=_0x46e636;}if(_0x2d9ee9){return;}if(typeof _0x3da648['cb']==_0x689d('0x11')){var _0x1e5c7a=_0x3da648['rx'][_0x689d('0xe')](0x0,0x3),_0x4a3284=null,_0x2f0f8=null;_0x1e5c7a=parseInt(_0x1e5c7a);if(isNaN(_0x1e5c7a)){_0x3da648['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x689d('0x12')});return;}if(_0x1e5c7a!=0xc8){_0x3da648['cb'](null,{'code':_0x1e5c7a,'result':-0x1,'extra':'KO'});return;}_0x4a3284=_0x3da648['rx'][_0x689d('0xe')](0x4)[_0x689d('0x13')]('result=','');if(_0x4a3284[_0x689d('0x14')]('\x20')!=-0x1){_0x4a3284=_0x4a3284[_0x689d('0x15')](0x0,_0x4a3284['indexOf']('\x20'));}if(_['startsWith'](_0x4a3284,'-1')){_0x4a3284=parseInt(_0x4a3284);}_0x2f0f8=_0x3da648['rx'][_0x689d('0x16')]('\x20');if(_0x2f0f8[_0x689d('0x17')]==0x3){_0x2f0f8=_0x2f0f8[0x2][_0x689d('0xe')](0x1,_0x2f0f8[0x2][_0x689d('0x17')]-0x1);}else if(_0x2f0f8[_0x689d('0x17')]>0x3){var _0x561301=/\((.+)\)/;var _0x1b0e8d=_0x3da648['rx'][_0x689d('0x18')](_0x561301);if(_0x1b0e8d){_0x2f0f8=_0x1b0e8d[0x1];}else{_0x2f0f8=null;}}else{_0x2f0f8=null;}_0x3da648['cb'](null,{'code':_0x1e5c7a,'result':_0x4a3284,'extra':_0x2f0f8});}});_0x33b6ca['on']('error',function(_0x3110df){_0x36ca6d['emit'](_0x689d('0x19'),new AGIError(_0x689d('0x1a'),_0x3110df[_0x689d('0x1b')]));});_0x33b6ca['on'](_0x689d('0x1c'),function(){_0x36ca6d[_0x689d('0x1d')](_0x689d('0x1c'),new AGIError(_0x689d('0x1e')));});_0x33b6ca['on']('timeout',function(){_0x36ca6d[_0x689d('0x1d')]('timeout',new AGIError(_0x689d('0x1f')));_0x33b6ca['destroy']();});_0x33b6ca[_0x689d('0x20')](_0x48dd20);this[_0x689d('0x21')]=function(_0x4469e4,_0x55ebc6){var _0x4469e4=_0x4469e4||'',_0x55ebc6=typeof _0x55ebc6==_0x689d('0x11')?_0x55ebc6:new Function();_0x3da648={'tx':_0x4469e4,'rx':'','cb':_0x55ebc6};_0x33b6ca[_0x689d('0x22')](_0x4469e4+'\x0a');},this[_0x689d('0x1c')]=function(){_0x33b6ca[_0x689d('0x23')]();};}util[_0x689d('0x24')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x689d('0x25')]=function(_0x22a3cf){return this[_0x689d('0x21')]['sync'](this,_0x22a3cf);};AGIChannel[_0x689d('0x26')][_0x689d('0x27')]=function(){return this[_0x689d('0x25')](_0x689d('0x28'));};AGIChannel[_0x689d('0x26')]['getData']=function(_0x477190,_0x4fc325,_0x22f0fc){_0x477190=_0x477190===undefined?_0x689d('0x29'):_0x477190;_0x4fc325=_0x4fc325===undefined?'5':_0x4fc325;_0x22f0fc=_0x22f0fc===undefined?'1':_0x22f0fc;return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x2b'),_0x477190,_0x4fc325*0x3e8,_0x22f0fc));};AGIChannel['prototype'][_0x689d('0x2c')]=function(_0x539279){_0x539279=_0x539279||'NO\x20MESSAGE';return this['sendRequest'](util[_0x689d('0x2a')](_0x689d('0x2d'),_0x539279));};AGIChannel[_0x689d('0x26')][_0x689d('0x2e')]=function(_0x5057df,_0x5963cf){if(_['isArray'](_0x5963cf)){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x2f'),_0x5057df,_0x5963cf[_0x689d('0x30')](',')));}return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x2f'),_0x5057df,_0x5963cf));};AGIChannel['prototype'][_0x689d('0x31')]=function(_0x368fef){return this['sendRequest'](util[_0x689d('0x2a')](_0x689d('0x32'),_0x368fef));};AGIChannel['prototype'][_0x689d('0x33')]=function(_0x10f861){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x34'),_0x10f861));};AGIChannel[_0x689d('0x26')][_0x689d('0x35')]=function(_0x455183){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x36'),_0x455183));};AGIChannel[_0x689d('0x26')][_0x689d('0xd')]=function(){return this[_0x689d('0x25')](_0x689d('0x37'));};AGIChannel['prototype'][_0x689d('0x38')]=function(_0x9d169f,_0x26ebff){var _0x435827=_[_0x689d('0x39')](_0x26ebff)||_['isNumber'](_0x26ebff)?_0x26ebff[_0x689d('0x3a')]():_0x26ebff;return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x3b'),_0x9d169f,_0x435827?_0x435827[_0x689d('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x689d('0x3c')]=function(_0x8e73f,_0x3a4059){return this['sendRequest'](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x8e73f,_0x3a4059));};AGIChannel[_0x689d('0x26')]['sayDigits']=function(_0x1b0d16,_0x39ad63){return this[_0x689d('0x25')](util[_0x689d('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x1b0d16,_0x39ad63));};AGIChannel[_0x689d('0x26')][_0x689d('0x3d')]=function(_0x53d54b,_0x4a3844){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x53d54b,_0x4a3844));};AGIChannel[_0x689d('0x26')][_0x689d('0x3e')]=function(_0x54260e,_0x490a90,_0x31d6a3){_0x490a90=_0x490a90||this[_0x689d('0x3f')];_0x31d6a3=_0x31d6a3||0x1;this[_0x689d('0x31')](_0x54260e);this['setExtension'](_0x490a90);this['setPriority'](_0x31d6a3);return this['noop'](util[_0x689d('0x2a')](_0x689d('0x40'),_0x54260e,_0x490a90,_0x31d6a3));};AGIChannel[_0x689d('0x26')]['getVariable']=function(_0x202a79){return this[_0x689d('0x25')](util[_0x689d('0x2a')](_0x689d('0x41'),_0x202a79));};AGIChannel['prototype'][_0x689d('0x42')]=function(_0x39bf4e,_0xa03f8d,_0x30bee2,_0x2f5e21,_0x1a8680,_0x155d7d){_0xa03f8d=_0xa03f8d||_0x689d('0x43');_0x30bee2=_0x30bee2||'';_0x2f5e21=_0x2f5e21===undefined?-0x1:_0x2f5e21==='-1'?-0x1:_0x2f5e21*0x3e8;_0x1a8680=_0x1a8680===undefined?'':'s='+_0x1a8680;_0x155d7d=_0x155d7d?_0x689d('0x44'):'';return this[_0x689d('0x25')](util[_0x689d('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x39bf4e,_0xa03f8d,_0x30bee2,_0x2f5e21,_0x155d7d,_0x1a8680));};AGIChannel[_0x689d('0x26')][_0x689d('0x45')]=function(_0x38379d,_0x305db){_0x305db=_0x305db||'';return this['sendRequest'](util['format'](_0x689d('0x46'),_0x38379d,_0x305db));};AGIChannel[_0x689d('0x26')][_0x689d('0x47')]=function(_0x4cd7b9){return this['exec'](_0x689d('0x48'),_0x4cd7b9);};AGIChannel[_0x689d('0x26')]['wait']=function(_0x24822c){return this[_0x689d('0x2e')](_0x689d('0x49'),_0x24822c);};AGIChannel[_0x689d('0x26')][_0x689d('0x19')]=function(_0xf85bf6,_0x24167a){this[_0x689d('0x2c')](util[_0x689d('0x2a')](_0x689d('0x4a'),_0xf85bf6['id'],_0xf85bf6[_0x689d('0x4b')],_0x24167a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x689d('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5a7bb4e..8be8228 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 _0x68fe=['name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message'];(function(_0x4e6e52,_0x6e340b){var _0x5779d9=function(_0x472604){while(--_0x472604){_0x4e6e52['push'](_0x4e6e52['shift']());}};_0x5779d9(++_0x6e340b);}(_0x68fe,0xc4));var _0xe68f=function(_0x3dac27,_0x1bcf24){_0x3dac27=_0x3dac27-0x0;var _0x2281d5=_0x68fe[_0x3dac27];return _0x2281d5;};'use strict';var util=require(_0xe68f('0x0'));var error={'E_AGI_UNDEFINED':_0xe68f('0x1'),'E_AGI_ARGUMENT_PORT':_0xe68f('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xe68f('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xe68f('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xe68f('0x5'),'E_AGI_SOCKET_CLOSE':_0xe68f('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe68f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe68f('0x8'),'E_AGI_IVR_ENTRY':_0xe68f('0x9')};function AGIError(_0x50074){var _0x50074=_0x50074||null,_0x21a3be=_0x21a3be||[],_0x6e0a42=0x1,_0x2630ec='';if(!error[_0x50074]){_0x50074=_0xe68f('0xa');}_0x21a3be[_0xe68f('0xb')](error[_0x50074]);while(arguments[_0x6e0a42]){_0x21a3be[_0xe68f('0xb')](arguments[_0x6e0a42]);_0x6e0a42++;}_0x2630ec=util['format'][_0xe68f('0xc')](util,_0x21a3be);this[_0xe68f('0xd')]=_0x2630ec;this[_0xe68f('0xe')]=_0x50074;}module['exports']=AGIError; \ No newline at end of file +var _0xbd4d=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x1f0391,_0xa401fd){var _0x5729e0=function(_0xbabee2){while(--_0xbabee2){_0x1f0391['push'](_0x1f0391['shift']());}};_0x5729e0(++_0xa401fd);}(_0xbd4d,0xd8));var _0xdbd4=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xbd4d[_0x38ced4];return _0x547c07;};'use strict';var util=require(_0xdbd4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xdbd4('0x1'),'E_AGI_SERVER_ERROR':_0xdbd4('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xdbd4('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xdbd4('0x4'),'E_AGI_SOCKET_CLOSE':_0xdbd4('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xdbd4('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdbd4('0x7'),'E_AGI_IVR_ENTRY':_0xdbd4('0x8')};function AGIError(_0x34bb0b){var _0x34bb0b=_0x34bb0b||null,_0x46d4f1=_0x46d4f1||[],_0x4372cf=0x1,_0x37721e='';if(!error[_0x34bb0b]){_0x34bb0b=_0xdbd4('0x9');}_0x46d4f1['push'](error[_0x34bb0b]);while(arguments[_0x4372cf]){_0x46d4f1['push'](arguments[_0x4372cf]);_0x4372cf++;}_0x37721e=util[_0xdbd4('0xa')][_0xdbd4('0xb')](util,_0x46d4f1);this[_0xdbd4('0xc')]=_0x37721e;this[_0xdbd4('0xd')]=_0x34bb0b;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 9ef075b..8ae2a66 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb752=['EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb752,0x107));var _0x2b75=function(_0x3cfad3,_0x2e7f32){_0x3cfad3=_0x3cfad3-0x0;var _0x1c5b45=_0xb752[_0x3cfad3];return _0x1c5b45;};'use strict';var _=require('lodash');var EventEmitter=require(_0x2b75('0x0'))[_0x2b75('0x1')];var Redis=require(_0x2b75('0x2'));var AGIError=require(_0x2b75('0x3'));var config=require(_0x2b75('0x4'));config[_0x2b75('0x5')]=_[_0x2b75('0x6')](config[_0x2b75('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2b75('0x5')]);sub[_0x2b75('0x7')](_0x2b75('0x8'),function(_0x186360){if(_0x186360)return eventEmitter[_0x2b75('0x9')](_0x2b75('0xa'),new AGIError(_0x2b75('0xb'),_0x186360));});sub['on']('message',function(_0x5a5bbd,_0x3bd80d){if(_0x5a5bbd!==_0x2b75('0x8'))return;try{var _0x201aae=JSON['parse'](_0x3bd80d);eventEmitter[_0x2b75('0x9')]('projectUpdate',_0x201aae);}catch(_0x31d7e9){eventEmitter[_0x2b75('0x9')]('error',new AGIError(_0x2b75('0xb'),_0x31d7e9));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x4159=['redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter','../../config/environment'];(function(_0x536a34,_0x2f63ee){var _0x48aaf6=function(_0x6a5dc3){while(--_0x6a5dc3){_0x536a34['push'](_0x536a34['shift']());}};_0x48aaf6(++_0x2f63ee);}(_0x4159,0x66));var _0x9415=function(_0x39a2a4,_0x2a7f6d){_0x39a2a4=_0x39a2a4-0x0;var _0x5b2f1b=_0x4159[_0x39a2a4];return _0x5b2f1b;};'use strict';var _=require(_0x9415('0x0'));var EventEmitter=require('events')[_0x9415('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x9415('0x2'));config[_0x9415('0x3')]=_[_0x9415('0x4')](config[_0x9415('0x3')],{'host':_0x9415('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x9415('0x3')]);sub[_0x9415('0x6')](_0x9415('0x7'),function(_0x33463d){if(_0x33463d)return eventEmitter[_0x9415('0x8')](_0x9415('0x9'),new AGIError(_0x9415('0xa'),_0x33463d));});sub['on'](_0x9415('0xb'),function(_0x19956f,_0x3532eb){if(_0x19956f!==_0x9415('0x7'))return;try{var _0x376d38=JSON[_0x9415('0xc')](_0x3532eb);eventEmitter[_0x9415('0x8')](_0x9415('0xd'),_0x376d38);}catch(_0x5c988a){eventEmitter[_0x9415('0x8')](_0x9415('0x9'),new AGIError(_0x9415('0xa'),_0x5c988a));}});module[_0x9415('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 8997843..f05974b 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 _0xa3eb=['vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','split','agicommand','target','invalid'];(function(_0x2c5d4e,_0x6d5975){var _0xe27290=function(_0x4ef4d6){while(--_0x4ef4d6){_0x2c5d4e['push'](_0x2c5d4e['shift']());}};_0xe27290(++_0x6d5975);}(_0xa3eb,0x1c5));var _0xba3e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa3eb[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xba3e('0x0'));var logger=require(_0xba3e('0x1'))('agi');var verticesWithRetry=[_0xba3e('0x2'),_0xba3e('0x3'),_0xba3e('0x4')];var Graph=function(){this[_0xba3e('0x5')]={};this[_0xba3e('0x6')]={};this[_0xba3e('0x7')]=0x0;};Graph[_0xba3e('0x8')][_0xba3e('0x9')]=function(_0x168d54){this[_0xba3e('0x5')][_0x168d54['id']]=_0x168d54;this[_0xba3e('0x6')][_0x168d54['id']]=[];};Graph[_0xba3e('0x8')][_0xba3e('0xa')]=function(_0x3bbc06,_0x5ce8bd,_0x52be27){this[_0xba3e('0x6')][_0x3bbc06]['push']({'target':_0x5ce8bd,'condition':_0x52be27});this[_0xba3e('0x7')]+=0x1;};Graph[_0xba3e('0x8')][_0xba3e('0xb')]=function(){return _[_0xba3e('0xb')](this[_0xba3e('0x5')]);};Graph[_0xba3e('0x8')][_0xba3e('0xc')]=function(){return this[_0xba3e('0x7')];};Graph[_0xba3e('0x8')][_0xba3e('0xd')]=function(_0x4d4165){return this[_0xba3e('0x5')][_0x4d4165];};Graph[_0xba3e('0x8')][_0xba3e('0xe')]=function(_0x23d9a9,_0x2f4af3){if(!this['vertices'][_0x23d9a9]){return logger['info']('no\x20vertex\x20found');}var _0x5bfdae=_0x2f4af3(this['vertices'][_0x23d9a9]);if(!_0x5bfdae){return logger[_0xba3e('0xf')](_0xba3e('0x10'));}if(this['edges'][_0x23d9a9][_0xba3e('0x11')]===0x0){return logger[_0xba3e('0xf')]('no\x20edge/s\x20available');}for(var _0x3b0fa1=0x0,_0x32ddaa=[],_0x5bc2ae=![];_0x3b0fa1\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','indexOf','agi_','substring','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','handleUnpublished','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults'];(function(_0x582ce5,_0x195e26){var _0x4d4bb5=function(_0x16a7c2){while(--_0x16a7c2){_0x582ce5['push'](_0x582ce5['shift']());}};_0x4d4bb5(++_0x195e26);}(_0xf9de,0x1c7));var _0xef9d=function(_0x4978ff,_0x43edd8){_0x4978ff=_0x4978ff-0x0;var _0x53b488=_0xf9de[_0x4978ff];return _0x53b488;};'use strict';var _=require(_0xef9d('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0xef9d('0x1'));var logger=require('../../config/logger')(_0xef9d('0x2'));var utilLicense=require(_0xef9d('0x3'));var rpc=require(_0xef9d('0x4'));var Project=require(_0xef9d('0x5'));var AGIEmitter=require(_0xef9d('0x6'))[_0xef9d('0x7')];var projects=[];config[_0xef9d('0x2')]=_[_0xef9d('0x8')](config['agi'],{'ip':_0xef9d('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x10b905){process[_0xef9d('0xa')](function(){syncho(function(){try{setChannelVariables(_0x10b905);agiHandler(_0x10b905);}catch(_0x369fee){logger[_0xef9d('0xb')](_0x369fee[_0xef9d('0xc')]);}});});}function projectUpdateHandler(_0x3b2fd6){try{var _0x3b9454=_[_0xef9d('0xd')](projects,['id',_0x3b2fd6['id']]);if(_0x3b9454>-0x1){if(_0x3b2fd6[_0xef9d('0xe')]===!![]){projects[_0xef9d('0xf')](_0x3b9454,0x1);}else{projects[_0x3b9454]=_0x3b2fd6;}}else{projects['push'](_0x3b2fd6);}}catch(_0x382a0a){logger['error'](_0x382a0a[_0xef9d('0xc')]);}}function listeningHandler(){console[_0xef9d('0x10')](_0xef9d('0x11'),config[_0xef9d('0x2')][_0xef9d('0x12')]);logger[_0xef9d('0x13')](util[_0xef9d('0x14')](_0xef9d('0x15'),config['agi']['ip'],config[_0xef9d('0x2')][_0xef9d('0x12')]));}function errorHandler(_0x4cdcca){if(_0x4cdcca&&_0x4cdcca[_0xef9d('0x16')]&&_0x4cdcca['message']){logger[_0xef9d('0xb')](util[_0xef9d('0x14')](_0xef9d('0x17'),_0x4cdcca[_0xef9d('0x16')],_0x4cdcca[_0xef9d('0x18')]));}else{logger['error'](util[_0xef9d('0x14')](_0xef9d('0x19'),_0x4cdcca[_0xef9d('0xc')]));}}function closeHandler(){logger[_0xef9d('0x13')](util[_0xef9d('0x14')](_0xef9d('0x1a'),this[_0xef9d('0x1b')],this[_0xef9d('0x1c')],this[_0xef9d('0x1d')],this[_0xef9d('0x1e')],this[_0xef9d('0x1f')]));try{createSquareReport(this);}catch(_0x343626){logger[_0xef9d('0xb')](_0x343626[_0xef9d('0xc')]);}}function timeoutHandler(){logger[_0xef9d('0x13')](util[_0xef9d('0x14')](_0xef9d('0x20'),this[_0xef9d('0x1b')],this['calleridname'],this['callerid'],this[_0xef9d('0x1e')],this[_0xef9d('0x1f')]));}function hangupHandler(){logger[_0xef9d('0x13')](util['format'](_0xef9d('0x21'),this['arg_1'],this['calleridname'],this[_0xef9d('0x1d')],this[_0xef9d('0x1e')],this[_0xef9d('0x1f')]));this[_0xef9d('0x22')]=!![];}function createSquareReport(_0x5588e0,_0x3d386e){rpc[_0xef9d('0x23')](_0x5588e0)['then'](function(_0x3f3234){if(_0x3d386e){_0x3d386e(null,_0x3f3234);}})[_0xef9d('0x24')](function(_0x4c254f){if(_0x3d386e){_0x3d386e(null,_0x4c254f);}});}function setChannelVariables(_0xe3e1dd){for(var _0x8067a2 in _0xe3e1dd){if(_0xe3e1dd['hasOwnProperty'](_0x8067a2)){if(_0x8067a2[_0xef9d('0x25')](_0xef9d('0x26'))===0x0){_0xe3e1dd[_0x8067a2[_0xef9d('0x27')](0x4)]=_0xe3e1dd[_0x8067a2];delete _0xe3e1dd[_0x8067a2];}}}}function agiHandler(_0x516804){logger['debug']('variables',JSON[_0xef9d('0x28')](_0x516804,null,0x2));logger[_0xef9d('0x13')](util[_0xef9d('0x14')](_0xef9d('0x29'),_0x516804[_0xef9d('0x1b')],_0x516804[_0xef9d('0x1c')],_0x516804[_0xef9d('0x1d')],_0x516804[_0xef9d('0x1e')],_0x516804['uniqueid']));_0x516804['on'](_0xef9d('0xb'),errorHandler);_0x516804['on'](_0xef9d('0x2a'),closeHandler);_0x516804['on']('timeout',timeoutHandler);_0x516804[_0xef9d('0x22')]=![];_0x516804['on'](_0xef9d('0x2b'),hangupHandler);var _0x147020=_[_0xef9d('0x2c')](projects,[_0xef9d('0x16'),_0x516804[_0xef9d('0x1b')]]);if(!_0x147020)return Project[_0xef9d('0x2d')](_0x516804);if(!_0x147020['production'])return Project[_0xef9d('0x2e')](_0x516804);return Project['initialize'](_0x147020,_0x516804);}function main(){var _0x58f773;return utilLicense[_0xef9d('0x2f')]()[_0xef9d('0x30')](function(_0x44a75f){if(!_0x44a75f)return;if(_0x44a75f[_0xef9d('0x31')]){if(_0x44a75f[_0xef9d('0x32')]&&_0x44a75f[_0xef9d('0x32')]>0x0){logger[_0xef9d('0x13')](util[_0xef9d('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x44a75f[_0xef9d('0x32')]));_0x58f773=_0x44a75f[_0xef9d('0x32')];}else{logger[_0xef9d('0x13')](_0xef9d('0x33'));}}else{logger[_0xef9d('0x13')](_0xef9d('0x34'));_0x58f773=-0x1;}})[_0xef9d('0x30')](function(){return Project[_0xef9d('0x35')]();})[_0xef9d('0x30')](function(_0xe9196b){projects=_0xe9196b;return;})['catch'](function(_0x45f95b){logger[_0xef9d('0xb')](_0xef9d('0x36'),_0x45f95b[_0xef9d('0xc')]);})[_0xef9d('0x37')](function(){var _0x562c43=require('./server')(config[_0xef9d('0x2')][_0xef9d('0x12')],config[_0xef9d('0x2')]['ip'],_0x58f773);_0x562c43['on']('error',errorHandler);_0x562c43['on'](_0xef9d('0x38'),listeningHandler);_0x562c43['on'](_0xef9d('0x39'),connectionHandler);_0x562c43['on'](_0xef9d('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x0206=['push','error','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','projectUpdate','nextTick','findIndex','deleted','splice'];(function(_0x9334be,_0x2f75d7){var _0x5ab7a0=function(_0x311cf6){while(--_0x311cf6){_0x9334be['push'](_0x9334be['shift']());}};_0x5ab7a0(++_0x2f75d7);}(_0x0206,0x6c));var _0x6020=function(_0x532061,_0x57e2e0){_0x532061=_0x532061-0x0;var _0x3905ae=_0x0206[_0x532061];return _0x3905ae;};'use strict';var _=require(_0x6020('0x0'));var syncho=require(_0x6020('0x1'));var util=require(_0x6020('0x2'));var config=require(_0x6020('0x3'));var logger=require(_0x6020('0x4'))(_0x6020('0x5'));var utilLicense=require(_0x6020('0x6'));var rpc=require(_0x6020('0x7'));var Project=require(_0x6020('0x8'));var AGIEmitter=require(_0x6020('0x9'))['EventEmitter'];var projects=[];config[_0x6020('0x5')]=_[_0x6020('0xa')](config[_0x6020('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x6020('0xb'),projectUpdateHandler);function connectionHandler(_0x1e7063){process[_0x6020('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1e7063);agiHandler(_0x1e7063);}catch(_0x4e858c){logger['error'](_0x4e858c['stack']);}});});}function projectUpdateHandler(_0x7fc73e){try{var _0x535d41=_[_0x6020('0xd')](projects,['id',_0x7fc73e['id']]);if(_0x535d41>-0x1){if(_0x7fc73e[_0x6020('0xe')]===!![]){projects[_0x6020('0xf')](_0x535d41,0x1);}else{projects[_0x535d41]=_0x7fc73e;}}else{projects[_0x6020('0x10')](_0x7fc73e);}}catch(_0x35b520){logger[_0x6020('0x11')](_0x35b520['stack']);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x6020('0x5')][_0x6020('0x12')]);logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x15'),config[_0x6020('0x5')]['ip'],config['agi'][_0x6020('0x12')]));}function errorHandler(_0x17745a){if(_0x17745a&&_0x17745a[_0x6020('0x16')]&&_0x17745a[_0x6020('0x17')]){logger[_0x6020('0x11')](util[_0x6020('0x14')]('[%s]\x20%s',_0x17745a[_0x6020('0x16')],_0x17745a['message']));}else{logger[_0x6020('0x11')](util[_0x6020('0x14')](_0x6020('0x18'),_0x17745a[_0x6020('0x19')]));}}function closeHandler(){logger[_0x6020('0x13')](util['format'](_0x6020('0x1a'),this[_0x6020('0x1b')],this[_0x6020('0x1c')],this[_0x6020('0x1d')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x1646d8){logger['error'](_0x1646d8[_0x6020('0x19')]);}}function timeoutHandler(){logger[_0x6020('0x13')](util['format'](_0x6020('0x1e'),this[_0x6020('0x1b')],this[_0x6020('0x1c')],this[_0x6020('0x1d')],this[_0x6020('0x1f')],this[_0x6020('0x20')]));}function hangupHandler(){logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x21'),this[_0x6020('0x1b')],this[_0x6020('0x1c')],this['callerid'],this['dnid'],this[_0x6020('0x20')]));this[_0x6020('0x22')]=!![];}function createSquareReport(_0x18941e,_0x5f206e){rpc['createSquareReport'](_0x18941e)[_0x6020('0x23')](function(_0x13fdf1){if(_0x5f206e){_0x5f206e(null,_0x13fdf1);}})[_0x6020('0x24')](function(_0x31f2bd){if(_0x5f206e){_0x5f206e(null,_0x31f2bd);}});}function setChannelVariables(_0x2dd1df){for(var _0x457493 in _0x2dd1df){if(_0x2dd1df[_0x6020('0x25')](_0x457493)){if(_0x457493[_0x6020('0x26')](_0x6020('0x27'))===0x0){_0x2dd1df[_0x457493[_0x6020('0x28')](0x4)]=_0x2dd1df[_0x457493];delete _0x2dd1df[_0x457493];}}}}function agiHandler(_0x1867e0){logger[_0x6020('0x29')](_0x6020('0x2a'),JSON[_0x6020('0x2b')](_0x1867e0,null,0x2));logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x2c'),_0x1867e0[_0x6020('0x1b')],_0x1867e0[_0x6020('0x1c')],_0x1867e0[_0x6020('0x1d')],_0x1867e0['dnid'],_0x1867e0['uniqueid']));_0x1867e0['on'](_0x6020('0x11'),errorHandler);_0x1867e0['on'](_0x6020('0x2d'),closeHandler);_0x1867e0['on'](_0x6020('0x2e'),timeoutHandler);_0x1867e0[_0x6020('0x22')]=![];_0x1867e0['on']('hangup',hangupHandler);var _0x20397a=_['find'](projects,[_0x6020('0x16'),_0x1867e0[_0x6020('0x1b')]]);if(!_0x20397a)return Project[_0x6020('0x2f')](_0x1867e0);if(!_0x20397a[_0x6020('0x30')])return Project[_0x6020('0x31')](_0x1867e0);return Project[_0x6020('0x32')](_0x20397a,_0x1867e0);}function main(){var _0x31bfa4;return utilLicense[_0x6020('0x33')]()[_0x6020('0x23')](function(_0x3fe85f){if(!_0x3fe85f)return;if(_0x3fe85f[_0x6020('0x34')]){if(_0x3fe85f[_0x6020('0x35')]&&_0x3fe85f[_0x6020('0x35')]>0x0){logger[_0x6020('0x13')](util[_0x6020('0x14')](_0x6020('0x36'),_0x3fe85f[_0x6020('0x35')]));_0x31bfa4=_0x3fe85f[_0x6020('0x35')];}else{logger['info'](_0x6020('0x37'));}}else{logger['info'](_0x6020('0x38'));_0x31bfa4=-0x1;}})['then'](function(){return Project[_0x6020('0x39')]();})[_0x6020('0x23')](function(_0x4618d7){projects=_0x4618d7;return;})[_0x6020('0x24')](function(_0x19307c){logger[_0x6020('0x11')]('[LICENSE]',_0x19307c['stack']);})[_0x6020('0x3a')](function(){var _0x3bf1b2=require(_0x6020('0x3b'))(config[_0x6020('0x5')]['port'],config['agi']['ip'],_0x31bfa4);_0x3bf1b2['on']('error',errorHandler);_0x3bf1b2['on'](_0x6020('0x3c'),listeningHandler);_0x3bf1b2['on'](_0x6020('0x3d'),connectionHandler);_0x3bf1b2['on'](_0x6020('0x2d'),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 b734cf7..8cdb765 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 _0x3d28=['SendMail','bluebird','jayson/promise','http','then','error','message','result','catch','sendMailMessage'];(function(_0x1d04b5,_0x30792c){var _0x161342=function(_0x94ff92){while(--_0x94ff92){_0x1d04b5['push'](_0x1d04b5['shift']());}};_0x161342(++_0x30792c);}(_0x3d28,0x169));var _0x83d2=function(_0x5df26e,_0x18c475){_0x5df26e=_0x5df26e-0x0;var _0xf4d985=_0x3d28[_0x5df26e];return _0xf4d985;};'use strict';var BPromise=require(_0x83d2('0x0'));var jayson=require(_0x83d2('0x1'));var client=jayson['client'][_0x83d2('0x2')]({'port':0x232b});function request(_0xe7debf,_0x51af10){return new BPromise(function(_0x4a8585,_0x4b340c){return client['request'](_0xe7debf,_0x51af10)[_0x83d2('0x3')](function(_0x3ed0d8){if(_0x3ed0d8[_0x83d2('0x4')]){return _0x4b340c(_0x3ed0d8['error'][_0x83d2('0x5')]);}else{return _0x4a8585(_0x3ed0d8[_0x83d2('0x6')]);}})[_0x83d2('0x7')](function(_0x50fce7){return _0x4b340c(_0x50fce7);});});}exports[_0x83d2('0x8')]=function(_0x77d65,_0x206257){return request(_0x83d2('0x9'),{'account':_0x77d65,'message':_0x206257});}; \ No newline at end of file +var _0x91b5=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','then'];(function(_0x2e69ff,_0x53eff9){var _0x1f1225=function(_0x2130d6){while(--_0x2130d6){_0x2e69ff['push'](_0x2e69ff['shift']());}};_0x1f1225(++_0x53eff9);}(_0x91b5,0xb9));var _0x591b=function(_0x453fdb,_0x4a5234){_0x453fdb=_0x453fdb-0x0;var _0x2732e4=_0x91b5[_0x453fdb];return _0x2732e4;};'use strict';var BPromise=require(_0x591b('0x0'));var jayson=require(_0x591b('0x1'));var client=jayson[_0x591b('0x2')]['http']({'port':0x232b});function request(_0xf11f1f,_0x11dea7){return new BPromise(function(_0x196540,_0x28cc8d){return client['request'](_0xf11f1f,_0x11dea7)[_0x591b('0x3')](function(_0x30d96a){if(_0x30d96a[_0x591b('0x4')]){return _0x28cc8d(_0x30d96a[_0x591b('0x4')][_0x591b('0x5')]);}else{return _0x196540(_0x30d96a[_0x591b('0x6')]);}})[_0x591b('0x7')](function(_0x163ed4){return _0x28cc8d(_0x163ed4);});});}exports[_0x591b('0x8')]=function(_0x3b75bd,_0x595460){return request('SendMail',{'account':_0x3b75bd,'message':_0x595460});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d7d55a7..d3aecd5 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabe2=['util','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','value','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','result','evtHangup','isUndefined','toString','response','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json'];(function(_0x3c3ad3,_0x3b98c1){var _0x2c628f=function(_0x3527e3){while(--_0x3527e3){_0x3c3ad3['push'](_0x3c3ad3['shift']());}};_0x2c628f(++_0x3b98c1);}(_0xabe2,0x1bd));var _0x2abe=function(_0x210d1d,_0x131cc9){_0x210d1d=_0x210d1d-0x0;var _0x5b1608=_0xabe2[_0x210d1d];return _0x5b1608;};'use strict';var _=require(_0x2abe('0x0'));var moment=require(_0x2abe('0x1'));var parser=require(_0x2abe('0x2'));var util=require(_0x2abe('0x3'));var logger=require(_0x2abe('0x4'))('agi');var rpc=require(_0x2abe('0x5'));var mailRpc=require(_0x2abe('0x6'));var Graph=require(_0x2abe('0x7'));var Vertices=require(_0x2abe('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2abe('0x9')]()[_0x2abe('0xa')](function(_0x36f177){logger[_0x2abe('0xb')](_0x2abe('0xc'),_0x36f177[_0x2abe('0xd')]);return[];});}function addVertex(_0x3492e5,_0x2fa0e6,_0x5f58a7){_0x2fa0e6['agicommand']=_0x5f58a7;if(_0x2fa0e6[_0x2abe('0xe')](_0x2abe('0xf'))){_0x2fa0e6[_0x2abe('0x10')]=parseInt(_0x2fa0e6[_0x2abe('0xf')],0xa);}_0x3492e5[_0x2abe('0x11')](_[_0x2abe('0x12')](_0x2fa0e6,'mxCell'));}function initGraph(_0x225ca9,_0x30d6f2){var _0x232927=new Graph();for(var _0xe61379 in _0x225ca9){if(_0x225ca9[_0x2abe('0xe')](_0xe61379)){if(_[_0x2abe('0x13')](_0x225ca9[_0xe61379])){for(var _0x2fe13d=0x0;_0x2fe13d<_0x225ca9[_0xe61379][_0x2abe('0x14')];_0x2fe13d+=0x1){addVertex(_0x232927,_0x225ca9[_0xe61379][_0x2fe13d],_0xe61379);}}else{addVertex(_0x232927,_0x225ca9[_0xe61379],_0xe61379);}}}for(var _0x2b71aa=0x0;_0x2b71aa<_0x30d6f2[_0x2abe('0x14')];_0x2b71aa+=0x1){if(_0x30d6f2[_0x2b71aa][_0x2abe('0x15')]&&_0x30d6f2[_0x2b71aa][_0x2abe('0x16')]){_0x232927['addEdge'](_0x30d6f2[_0x2b71aa][_0x2abe('0x15')],_0x30d6f2[_0x2b71aa]['target'],_0x30d6f2[_0x2b71aa][_0x2abe('0x17')]);}}return _0x232927;}function getRoot(_0x1fae99){return parser['toJson'](_0x1fae99,{'object':!![]})[_0x2abe('0x18')][_0x2abe('0x19')];}function inspect(_0x2436b6){return util[_0x2abe('0x1a')](_0x2436b6,{'showHidden':![],'depth':null});}function initialize(_0x4327e6,_0x3567fc){var _0x4b8040=getRoot(_0x4327e6['production']);if(!_0x4b8040||!_0x4b8040[_0x2abe('0x1b')])return;var _0x476c80,_0x115093,_0x18e15f;logger[_0x2abe('0x1c')]('root',JSON[_0x2abe('0x1d')](_0x4b8040,null,0x2));_0x3567fc[_0x2abe('0x1e')]=moment()[_0x2abe('0x1f')](_0x2abe('0x20'));_0x476c80=initGraph(_[_0x2abe('0x12')](_0x4b8040,_0x2abe('0x21')),_0x4b8040[_0x2abe('0x21')]);_0x115093=new Vertices(_0x3567fc,rpc,mailRpc);logger[_0x2abe('0x22')](util['format'](_0x2abe('0x23'),_0x3567fc[_0x2abe('0x24')],_0x3567fc[_0x2abe('0x25')],_0x3567fc[_0x2abe('0x26')],_0x3567fc['dnid'],_0x3567fc[_0x2abe('0x27')]));_0x476c80[_0x2abe('0x28')](_0x4b8040[_0x2abe('0x1b')]['id'],function(_0x1ecd2d){try{_0x1ecd2d=_0x115093[_0x2abe('0x29')](_0x1ecd2d);logger[_0x2abe('0x1c')](_0x2abe('0x2a'),JSON['stringify'](_0x1ecd2d,null,0x2));if(_0x1ecd2d[_0x2abe('0x2b')]===_0x2abe('0x2c')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3567fc[_0x2abe('0x2d')]=_0x1ecd2d[_0x2abe('0x2d')]||_0x3567fc['context'];_0x3567fc['extension']=_0x1ecd2d[_0x2abe('0x2e')];_0x3567fc[_0x2abe('0x2f')]=_0x1ecd2d[_0x2abe('0x2f')]?_0x1ecd2d[_0x2abe('0x2f')]-0x1:0x1;return null;}else if(_0x1ecd2d&&_0x115093[_0x1ecd2d['agicommand']]){_0x18e15f=_0x115093[_0x1ecd2d[_0x2abe('0x2b')]](_0x1ecd2d);logger[_0x2abe('0x22')]('response',JSON[_0x2abe('0x1d')](_0x18e15f,null,0x2));if(_0x18e15f&&_0x18e15f['code']===AGI_CODE_SUCCESS&&_0x18e15f[_0x2abe('0x30')]!==AGI_RESULT_ERROR&&!_0x3567fc[_0x2abe('0x31')]){logger['debug']('response',inspect(_0x18e15f));return _[_0x2abe('0x32')](_0x18e15f[_0x2abe('0x30')])?null:_0x18e15f[_0x2abe('0x30')][_0x2abe('0x33')]();}else{logger[_0x2abe('0xb')](_0x2abe('0x34'),inspect(_0x18e15f));return null;}}else{logger[_0x2abe('0xb')](_0x2abe('0x35'));return null;}}catch(_0x312de4){logger[_0x2abe('0xb')](_0x312de4[_0x2abe('0xd')]);return null;}});if(_0x4b8040[_0x2abe('0x36')]){logger[_0x2abe('0x22')](util[_0x2abe('0x1f')](_0x2abe('0x37'),_0x3567fc[_0x2abe('0x24')],_0x3567fc[_0x2abe('0x25')],_0x3567fc[_0x2abe('0x26')],_0x3567fc[_0x2abe('0x38')],_0x3567fc[_0x2abe('0x27')]));_0x476c80[_0x2abe('0x28')](_0x4b8040[_0x2abe('0x36')]['id'],function(_0x53a8b9){try{_0x53a8b9=_0x115093[_0x2abe('0x29')](_0x53a8b9);logger[_0x2abe('0x1c')](_0x2abe('0x2a'),JSON['stringify'](_0x53a8b9,null,0x2));if(_0x53a8b9&&_0x115093[_0x53a8b9[_0x2abe('0x2b')]]){_0x18e15f=_0x115093[_0x53a8b9[_0x2abe('0x2b')]](_0x53a8b9);if(_0x18e15f){logger['debug'](_0x2abe('0x34'),inspect(_0x18e15f));return _['isUndefined'](_0x18e15f[_0x2abe('0x30')])?null:_0x18e15f['result'][_0x2abe('0x33')]();}else{logger[_0x2abe('0xb')](_0x2abe('0x34'),inspect(_0x18e15f));return null;}}else{logger['error'](_0x2abe('0x35'));return null;}}catch(_0x3cc340){logger[_0x2abe('0xb')](_0x3cc340['stack']);return null;}});}logger[_0x2abe('0x22')](util['format'](_0x2abe('0x39'),_0x3567fc['arg_1'],_0x3567fc[_0x2abe('0x25')],_0x3567fc[_0x2abe('0x26')],_0x3567fc['dnid'],_0x3567fc[_0x2abe('0x27')]));logger[_0x2abe('0x22')](util[_0x2abe('0x1f')](_0x2abe('0x3a'),_0x3567fc[_0x2abe('0x2d')],_0x3567fc[_0x2abe('0x2e')],parseInt(_0x3567fc[_0x2abe('0x2f')],0xa)+0x1));_0x3567fc[_0x2abe('0x3b')](_0x3567fc[_0x2abe('0x2d')],_0x3567fc[_0x2abe('0x2e')],parseInt(_0x3567fc['priority'],0xa)+0x1);_0x3567fc[_0x2abe('0x3c')]();}function handleNotFound(_0x5af7b3){logger[_0x2abe('0xb')](util['format'](_0x2abe('0x3d'),_0x5af7b3[_0x2abe('0x24')]));_0x5af7b3[_0x2abe('0x3b')](_0x5af7b3[_0x2abe('0x2d')],_0x5af7b3[_0x2abe('0x2e')],parseInt(_0x5af7b3[_0x2abe('0x2f')],0xa)+0x1);_0x5af7b3[_0x2abe('0x3c')]();}function handleUnpublished(_0x46aa29){logger['error'](util['format'](_0x2abe('0x3e'),_0x46aa29[_0x2abe('0x24')]));_0x46aa29['continueAt'](_0x46aa29[_0x2abe('0x2d')],_0x46aa29[_0x2abe('0x2e')],parseInt(_0x46aa29['priority'],0xa)+0x1);_0x46aa29[_0x2abe('0x3c')]();}module[_0x2abe('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xd69d=['toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','../../config/logger','./rpc','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','source','target','addEdge','value','toJson','root','inspect','start','debug','stringify','joinAt','info','format','arg_1','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','context','extension','priority','response','code','result','evtHangup'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xd69d,0xad));var _0xdd69=function(_0x5d2af9,_0x350f19){_0x5d2af9=_0x5d2af9-0x0;var _0x11b3a0=_0xd69d[_0x5d2af9];return _0x11b3a0;};'use strict';var _=require(_0xdd69('0x0'));var moment=require(_0xdd69('0x1'));var parser=require('xml2json');var util=require('util');var logger=require(_0xdd69('0x2'))('agi');var rpc=require(_0xdd69('0x3'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xdd69('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xdd69('0x5')](function(_0x168c7a){logger[_0xdd69('0x6')](_0xdd69('0x7'),_0x168c7a[_0xdd69('0x8')]);return[];});}function addVertex(_0x805696,_0x514a34,_0x226214){_0x514a34[_0xdd69('0x9')]=_0x226214;if(_0x514a34[_0xdd69('0xa')](_0xdd69('0xb'))){_0x514a34[_0xdd69('0xc')]=parseInt(_0x514a34[_0xdd69('0xb')],0xa);}_0x805696['addVertex'](_[_0xdd69('0xd')](_0x514a34,_0xdd69('0xe')));}function initGraph(_0x5f0d61,_0xc2a974){var _0x395b4e=new Graph();for(var _0x5afccb in _0x5f0d61){if(_0x5f0d61[_0xdd69('0xa')](_0x5afccb)){if(_[_0xdd69('0xf')](_0x5f0d61[_0x5afccb])){for(var _0x5dcc20=0x0;_0x5dcc20<_0x5f0d61[_0x5afccb]['length'];_0x5dcc20+=0x1){addVertex(_0x395b4e,_0x5f0d61[_0x5afccb][_0x5dcc20],_0x5afccb);}}else{addVertex(_0x395b4e,_0x5f0d61[_0x5afccb],_0x5afccb);}}}for(var _0x1b579c=0x0;_0x1b579c<_0xc2a974['length'];_0x1b579c+=0x1){if(_0xc2a974[_0x1b579c][_0xdd69('0x10')]&&_0xc2a974[_0x1b579c][_0xdd69('0x11')]){_0x395b4e[_0xdd69('0x12')](_0xc2a974[_0x1b579c]['source'],_0xc2a974[_0x1b579c][_0xdd69('0x11')],_0xc2a974[_0x1b579c][_0xdd69('0x13')]);}}return _0x395b4e;}function getRoot(_0x6f7cc6){return parser[_0xdd69('0x14')](_0x6f7cc6,{'object':!![]})['mxGraphModel'][_0xdd69('0x15')];}function inspect(_0x46e54d){return util[_0xdd69('0x16')](_0x46e54d,{'showHidden':![],'depth':null});}function initialize(_0x200a58,_0x59f534){var _0x451e43=getRoot(_0x200a58['production']);if(!_0x451e43||!_0x451e43[_0xdd69('0x17')])return;var _0x3424e0,_0x347259,_0x5a0e97;logger[_0xdd69('0x18')](_0xdd69('0x15'),JSON[_0xdd69('0x19')](_0x451e43,null,0x2));_0x59f534[_0xdd69('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3424e0=initGraph(_[_0xdd69('0xd')](_0x451e43,_0xdd69('0xe')),_0x451e43[_0xdd69('0xe')]);_0x347259=new Vertices(_0x59f534,rpc,mailRpc);logger[_0xdd69('0x1b')](util[_0xdd69('0x1c')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x59f534[_0xdd69('0x1d')],_0x59f534['calleridname'],_0x59f534[_0xdd69('0x1e')],_0x59f534[_0xdd69('0x1f')],_0x59f534[_0xdd69('0x20')]));_0x3424e0[_0xdd69('0x21')](_0x451e43[_0xdd69('0x17')]['id'],function(_0x163086){try{_0x163086=_0x347259['clear'](_0x163086);logger[_0xdd69('0x18')](_0xdd69('0x22'),JSON[_0xdd69('0x19')](_0x163086,null,0x2));if(_0x163086['agicommand']===_0xdd69('0x23')){logger[_0xdd69('0x1b')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x59f534['context']=_0x163086[_0xdd69('0x24')]||_0x59f534[_0xdd69('0x24')];_0x59f534[_0xdd69('0x25')]=_0x163086[_0xdd69('0x25')];_0x59f534[_0xdd69('0x26')]=_0x163086[_0xdd69('0x26')]?_0x163086[_0xdd69('0x26')]-0x1:0x1;return null;}else if(_0x163086&&_0x347259[_0x163086[_0xdd69('0x9')]]){_0x5a0e97=_0x347259[_0x163086[_0xdd69('0x9')]](_0x163086);logger[_0xdd69('0x1b')](_0xdd69('0x27'),JSON[_0xdd69('0x19')](_0x5a0e97,null,0x2));if(_0x5a0e97&&_0x5a0e97[_0xdd69('0x28')]===AGI_CODE_SUCCESS&&_0x5a0e97[_0xdd69('0x29')]!==AGI_RESULT_ERROR&&!_0x59f534[_0xdd69('0x2a')]){logger[_0xdd69('0x18')](_0xdd69('0x27'),inspect(_0x5a0e97));return _['isUndefined'](_0x5a0e97['result'])?null:_0x5a0e97[_0xdd69('0x29')][_0xdd69('0x2b')]();}else{logger['error']('response',inspect(_0x5a0e97));return null;}}else{logger[_0xdd69('0x6')]('agicommand\x20not\x20found');return null;}}catch(_0x418e5b){logger['error'](_0x418e5b[_0xdd69('0x8')]);return null;}});if(_0x451e43['finally']){logger['info'](util[_0xdd69('0x1c')](_0xdd69('0x2c'),_0x59f534[_0xdd69('0x1d')],_0x59f534['calleridname'],_0x59f534[_0xdd69('0x1e')],_0x59f534[_0xdd69('0x1f')],_0x59f534[_0xdd69('0x20')]));_0x3424e0[_0xdd69('0x21')](_0x451e43['finally']['id'],function(_0x5437e9){try{_0x5437e9=_0x347259[_0xdd69('0x2d')](_0x5437e9);logger[_0xdd69('0x18')](_0xdd69('0x22'),JSON[_0xdd69('0x19')](_0x5437e9,null,0x2));if(_0x5437e9&&_0x347259[_0x5437e9[_0xdd69('0x9')]]){_0x5a0e97=_0x347259[_0x5437e9['agicommand']](_0x5437e9);if(_0x5a0e97){logger['debug'](_0xdd69('0x27'),inspect(_0x5a0e97));return _['isUndefined'](_0x5a0e97['result'])?null:_0x5a0e97[_0xdd69('0x29')]['toString']();}else{logger[_0xdd69('0x6')](_0xdd69('0x27'),inspect(_0x5a0e97));return null;}}else{logger[_0xdd69('0x6')](_0xdd69('0x2e'));return null;}}catch(_0xce3d03){logger['error'](_0xce3d03[_0xdd69('0x8')]);return null;}});}logger[_0xdd69('0x1b')](util['format'](_0xdd69('0x2f'),_0x59f534['arg_1'],_0x59f534[_0xdd69('0x30')],_0x59f534[_0xdd69('0x1e')],_0x59f534['dnid'],_0x59f534[_0xdd69('0x20')]));logger[_0xdd69('0x1b')](util[_0xdd69('0x1c')](_0xdd69('0x31'),_0x59f534[_0xdd69('0x24')],_0x59f534[_0xdd69('0x25')],parseInt(_0x59f534[_0xdd69('0x26')],0xa)+0x1));_0x59f534[_0xdd69('0x32')](_0x59f534[_0xdd69('0x24')],_0x59f534[_0xdd69('0x25')],parseInt(_0x59f534[_0xdd69('0x26')],0xa)+0x1);_0x59f534[_0xdd69('0x33')]();}function handleNotFound(_0x30a5ff){logger[_0xdd69('0x6')](util[_0xdd69('0x1c')](_0xdd69('0x34'),_0x30a5ff[_0xdd69('0x1d')]));_0x30a5ff[_0xdd69('0x32')](_0x30a5ff[_0xdd69('0x24')],_0x30a5ff[_0xdd69('0x25')],parseInt(_0x30a5ff[_0xdd69('0x26')],0xa)+0x1);_0x30a5ff[_0xdd69('0x33')]();}function handleUnpublished(_0x488bcb){logger[_0xdd69('0x6')](util[_0xdd69('0x1c')]('Project\x20%s\x20not\x20published',_0x488bcb[_0xdd69('0x1d')]));_0x488bcb[_0xdd69('0x32')](_0x488bcb[_0xdd69('0x24')],_0x488bcb[_0xdd69('0x25')],parseInt(_0x488bcb['priority'],0xa)+0x1);_0x488bcb[_0xdd69('0x33')]();}module[_0xdd69('0x35')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0854f98..0298a15 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 _0xce5b=['_localBuffer','toString','substring','length','slice','trim','emit','headers','indexOf','exports','util','stream','Transform','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x19f8b6,_0x2b4e8c){var _0x213ebc=function(_0x40fc8c){while(--_0x40fc8c){_0x19f8b6['push'](_0x19f8b6['shift']());}};_0x213ebc(++_0x2b4e8c);}(_0xce5b,0x76));var _0xbce5=function(_0x192c4b,_0x1ad8ae){_0x192c4b=_0x192c4b-0x0;var _0x15f32b=_0xce5b[_0x192c4b];return _0x15f32b;};'use strict';var util=require(_0xbce5('0x0'));var Transform=require(_0xbce5('0x1'))[_0xbce5('0x2')];function AGIReply(_0x222f3c){Transform[_0xbce5('0x3')](this,_0x222f3c);this['_localBuffer']='';this[_0xbce5('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xbce5('0x5')][_0xbce5('0x6')]=function(_0x4e4b04,_0x5dee20,_0x8def8){var _0x154abc='\x0a',_0x45a360=['\x0a\x0a',_0xbce5('0x7')],_0x2e2d25=-0x1,_0xbf3f37=-0x1,_0x48dabf='',_0x529566=0x0,_0x522416='',_0x5eea49='';this[_0xbce5('0x8')]+=_0x4e4b04[_0xbce5('0x9')]();_0x522416=this['_localBuffer'];if(!this[_0xbce5('0x4')]){_0x529566=0x0;while(_0x45a360[_0x529566]){while((_0xbf3f37=_0x522416['indexOf'](_0x45a360[_0x529566]))!=-0x1){_0x48dabf=_0x45a360[_0x529566];_0x5eea49=_0x522416[_0xbce5('0xa')](0x0,_0xbf3f37);_0x522416=_0x522416['substring'](_0xbf3f37+_0x48dabf[_0xbce5('0xb')]);var _0x2dc1ea=_0x5eea49['split'](_0x154abc),_0x3cf258=0x0,_0x255196={},_0x1b6e71='',_0x28c6ae='',_0xae4570=-0x1;while(_0x2dc1ea[_0x3cf258]){_0xae4570=_0x2dc1ea[_0x3cf258]['indexOf'](':');if(_0xae4570!=-0x1){_0x1b6e71=_0x2dc1ea[_0x3cf258][_0xbce5('0xc')](0x0,_0xae4570)[_0xbce5('0xd')]();_0x28c6ae=_0x2dc1ea[_0x3cf258][_0xbce5('0xc')](_0xae4570+0x1)['trim']();if(_0x1b6e71[_0xbce5('0xb')]>0x0){_0x255196[_0x1b6e71]=_0x28c6ae;}}else{}_0x3cf258++;}this[_0xbce5('0xe')](_0xbce5('0xf'),_0x255196);this['_inBody']=!![];}_0x529566++;}this[_0xbce5('0x8')]=_0x522416;}else{while((_0x2e2d25=_0x522416[_0xbce5('0x10')](_0x154abc))!=-0x1){_0x5eea49=_0x522416[_0xbce5('0xa')](0x0,_0x2e2d25);this['emit']('line',_0x5eea49);_0x522416=_0x522416['substring'](_0x2e2d25+_0x154abc[_0xbce5('0xb')]);}this[_0xbce5('0x8')]=_0x522416;}_0x8def8();};module[_0xbce5('0x11')]=AGIReply; \ No newline at end of file +var _0xe237=['_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','trim','length','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x2f6413,_0x9a71cc){var _0x2b03a5=function(_0x3039ab){while(--_0x3039ab){_0x2f6413['push'](_0x2f6413['shift']());}};_0x2b03a5(++_0x9a71cc);}(_0xe237,0xd4));var _0x7e23=function(_0x1a7dc,_0x45fb5f){_0x1a7dc=_0x1a7dc-0x0;var _0x13dcb6=_0xe237[_0x1a7dc];return _0x13dcb6;};'use strict';var util=require(_0x7e23('0x0'));var Transform=require(_0x7e23('0x1'))[_0x7e23('0x2')];function AGIReply(_0x3b4617){Transform[_0x7e23('0x3')](this,_0x3b4617);this[_0x7e23('0x4')]='';this[_0x7e23('0x5')]=![];}util[_0x7e23('0x6')](AGIReply,Transform);AGIReply[_0x7e23('0x7')][_0x7e23('0x8')]=function(_0x39dfbb,_0x50e9e1,_0xc8e200){var _0x596c92='\x0a',_0x30e6e7=['\x0a\x0a',_0x7e23('0x9')],_0x22e41d=-0x1,_0x16800d=-0x1,_0x2e18e9='',_0x82a49c=0x0,_0x4f6fab='',_0x24fa66='';this['_localBuffer']+=_0x39dfbb[_0x7e23('0xa')]();_0x4f6fab=this[_0x7e23('0x4')];if(!this['_inBody']){_0x82a49c=0x0;while(_0x30e6e7[_0x82a49c]){while((_0x16800d=_0x4f6fab[_0x7e23('0xb')](_0x30e6e7[_0x82a49c]))!=-0x1){_0x2e18e9=_0x30e6e7[_0x82a49c];_0x24fa66=_0x4f6fab['substring'](0x0,_0x16800d);_0x4f6fab=_0x4f6fab[_0x7e23('0xc')](_0x16800d+_0x2e18e9['length']);var _0x3bce2b=_0x24fa66[_0x7e23('0xd')](_0x596c92),_0x44e299=0x0,_0x4cf8e5={},_0xbcf674='',_0x3692d9='',_0x1f4c9e=-0x1;while(_0x3bce2b[_0x44e299]){_0x1f4c9e=_0x3bce2b[_0x44e299][_0x7e23('0xb')](':');if(_0x1f4c9e!=-0x1){_0xbcf674=_0x3bce2b[_0x44e299]['slice'](0x0,_0x1f4c9e)['trim']();_0x3692d9=_0x3bce2b[_0x44e299]['slice'](_0x1f4c9e+0x1)[_0x7e23('0xe')]();if(_0xbcf674[_0x7e23('0xf')]>0x0){_0x4cf8e5[_0xbcf674]=_0x3692d9;}}else{}_0x44e299++;}this[_0x7e23('0x10')](_0x7e23('0x11'),_0x4cf8e5);this['_inBody']=!![];}_0x82a49c++;}this[_0x7e23('0x4')]=_0x4f6fab;}else{while((_0x22e41d=_0x4f6fab[_0x7e23('0xb')](_0x596c92))!=-0x1){_0x24fa66=_0x4f6fab[_0x7e23('0xc')](0x0,_0x22e41d);this[_0x7e23('0x10')](_0x7e23('0x12'),_0x24fa66);_0x4f6fab=_0x4f6fab[_0x7e23('0xc')](_0x22e41d+_0x596c92[_0x7e23('0xf')]);}this['_localBuffer']=_0x4f6fab;}_0xc8e200();};module[_0x7e23('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 573a77c..d2d05fb 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 _0xf873=['getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','jayson/promise','client','http','request','error','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production'];(function(_0x41d5a4,_0x186f91){var _0x20fb36=function(_0x15c2ed){while(--_0x15c2ed){_0x41d5a4['push'](_0x41d5a4['shift']());}};_0x20fb36(++_0x186f91);}(_0xf873,0xb2));var _0x3f87=function(_0x38b246,_0x5c875c){_0x38b246=_0x38b246-0x0;var _0x401469=_0xf873[_0x38b246];return _0x401469;};'use strict';var _=require('lodash');var moment=require(_0x3f87('0x0'));var jayson=require(_0x3f87('0x1'));var client=jayson[_0x3f87('0x2')][_0x3f87('0x3')]({'port':0x2329});function request(_0x1c56a3,_0xd4592c){return new Promise(function(_0x2fbb4f,_0x1d68dd){return client[_0x3f87('0x4')](_0x1c56a3,_0xd4592c)['then'](function(_0x2e2177){if(_0x2e2177[_0x3f87('0x5')]){return _0x1d68dd(_0x2e2177[_0x3f87('0x5')]['message']);}else{return _0x2fbb4f(_0x2e2177[_0x3f87('0x6')]);}})[_0x3f87('0x7')](function(_0x3b8e92){return _0x1d68dd(_0x3b8e92);});});}exports[_0x3f87('0x8')]=function(){return request(_0x3f87('0x9'),{'options':{'raw':![],'attributes':['id',_0x3f87('0xa'),'production']}});};exports[_0x3f87('0xb')]=function(_0x435ca8){return request(_0x3f87('0xc'),{'options':{'raw':![],'where':{'name':_0x435ca8},'attributes':[_0x3f87('0xd')]}});};exports[_0x3f87('0xe')]=function(_0xd41ca0){return request(_0x3f87('0xf'),{'options':{'raw':![],'where':{'id':_0xd41ca0},'include':[{'model':_0x3f87('0x10'),'as':_0x3f87('0x11'),'include':[{'model':_0x3f87('0x12'),'as':_0x3f87('0x12')}]}],'attributes':['id',_0x3f87('0xa'),_0x3f87('0x13')],'smtp':!![]}});};exports[_0x3f87('0x14')]=function(_0x5aff02){return request(_0x3f87('0xc'),{'options':{'where':{'id':_0x5aff02},'attributes':[_0x3f87('0xa')]}});};exports['getVoiceQueueById']=function(_0x1cfba3){return request(_0x3f87('0x15'),{'options':{'where':{'id':_0x1cfba3},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x16')]=function(_0x3f192a){return request(_0x3f87('0x17'),{'options':{'where':{'id':_0x3f192a},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x18')]=function(_0x5f0b2b){return request(_0x3f87('0x19'),{'options':{'where':{'id':_0x5f0b2b},'attributes':[_0x3f87('0x1a')]}});};exports[_0x3f87('0x1b')]=function(_0x4e1df8){return request(_0x3f87('0x1c'),{'options':{'where':{'id':_0x4e1df8},'attributes':['name']}});};exports[_0x3f87('0x1d')]=function(_0x13550c){return request(_0x3f87('0x1e'),{'options':{'where':{'phone':_0x13550c[_0x3f87('0x1f')]},'attributes':['id']}});};exports[_0x3f87('0x20')]=function(_0x4fe75c){return request(_0x3f87('0x21'),{'options':{'where':{'id':_0x4fe75c},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x22')]=function(_0x3a602a){return request('ShowSound',{'options':{'where':{'id':_0x3a602a},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x73aba6){return request(_0x3f87('0x23'),{'options':{'raw':![],'where':{'id':_0x73aba6},'include':[{'model':_0x3f87('0x24'),'as':'Intervals'}]}});};exports[_0x3f87('0x25')]=function(_0xb01673){return request(_0x3f87('0x26'),{'options':{'where':{'id':_0xb01673},'attributes':['id',_0x3f87('0xa')]}});};exports[_0x3f87('0x27')]=function(_0x46d773){return request(_0x3f87('0x28'),{'body':_0x46d773});};exports[_0x3f87('0x29')]=function(_0x197ff4){return request(_0x3f87('0x2a'),{'body':_0x197ff4});};exports[_0x3f87('0x2b')]=function(_0x37b8b9){return request('CreateSquareReport',{'body':_[_0x3f87('0x2c')](_0x37b8b9,{'project_name':_0x37b8b9[_0x3f87('0x2d')],'prev_project_name':_0x37b8b9[_0x3f87('0x2e')]||'','is_subproject':_0x37b8b9['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x3f87('0x2f'))})});};exports[_0x3f87('0x30')]=function(_0x18df70){return request(_0x3f87('0x31'),{'body':_0x18df70});};exports[_0x3f87('0x32')]=function(_0x148d8e){return request(_0x3f87('0x33'),{'body':_0x148d8e});};exports[_0x3f87('0x34')]=function(_0x113e40){return request(_0x3f87('0x35'),{'options':{'raw':![],'where':{'phone':_0x113e40[_0x3f87('0x1f')],'ListId':_0x113e40[_0x3f87('0x36')]}}})[_0x3f87('0x37')](function(_0x241d88){if(_0x241d88){return _0x241d88;}return request(_0x3f87('0x38'),{'body':_0x113e40});});};exports[_0x3f87('0x39')]=function(_0x5d6fc2){return request(_0x3f87('0x3a'),{'options':{'where':{'id':_0x5d6fc2},'attributes':[_0x3f87('0xa')]}});};exports[_0x3f87('0x3b')]=function(_0x2f0f05,_0x5495ed){return request('LoginUser',{'body':{'interface':_0x5495ed},'options':{'where':_0x2f0f05}});};exports['agentPause']=function(_0x221800,_0xcafb7d,_0x1d90d4){return request(_0x3f87('0x3c'),{'body':{'type':_0xcafb7d,'uniqueid':_0x1d90d4},'options':{'where':_0x221800}});};exports[_0x3f87('0x3d')]=function(_0x5e4570){return request(_0x3f87('0x3e'),{'body':{},'options':{'where':_0x5e4570}});};exports['agentLogout']=function(_0x2e4bc7){return request(_0x3f87('0x3f'),{'body':{},'options':{'where':_0x2e4bc7}});}; \ No newline at end of file +var _0xa7dc=['getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','getSoundById','ShowSound','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production'];(function(_0x5cbad4,_0x5aae44){var _0x106965=function(_0x583914){while(--_0x583914){_0x5cbad4['push'](_0x5cbad4['shift']());}};_0x106965(++_0x5aae44);}(_0xa7dc,0x11d));var _0xca7d=function(_0x1f8616,_0x26a9d2){_0x1f8616=_0x1f8616-0x0;var _0x327965=_0xa7dc[_0x1f8616];return _0x327965;};'use strict';var _=require(_0xca7d('0x0'));var moment=require(_0xca7d('0x1'));var jayson=require(_0xca7d('0x2'));var client=jayson['client'][_0xca7d('0x3')]({'port':0x2329});function request(_0x524adc,_0x3588cd){return new Promise(function(_0x75fca7,_0xc9d57a){return client[_0xca7d('0x4')](_0x524adc,_0x3588cd)[_0xca7d('0x5')](function(_0x40ae95){if(_0x40ae95[_0xca7d('0x6')]){return _0xc9d57a(_0x40ae95[_0xca7d('0x6')]['message']);}else{return _0x75fca7(_0x40ae95[_0xca7d('0x7')]);}})[_0xca7d('0x8')](function(_0x4d5bc7){return _0xc9d57a(_0x4d5bc7);});});}exports[_0xca7d('0x9')]=function(){return request(_0xca7d('0xa'),{'options':{'raw':![],'attributes':['id',_0xca7d('0xb'),'production']}});};exports[_0xca7d('0xc')]=function(_0x256e06){return request(_0xca7d('0xd'),{'options':{'raw':![],'where':{'name':_0x256e06},'attributes':[_0xca7d('0xe')]}});};exports[_0xca7d('0xf')]=function(_0x5b03b6){return request(_0xca7d('0x10'),{'options':{'raw':![],'where':{'id':_0x5b03b6},'include':[{'model':'MailServerOut','as':_0xca7d('0x11'),'include':[{'model':'CloudProvider','as':_0xca7d('0x12')}]}],'attributes':['id',_0xca7d('0xb'),_0xca7d('0x13')],'smtp':!![]}});};exports[_0xca7d('0x14')]=function(_0x4c1618){return request('ShowSquareProject',{'options':{'where':{'id':_0x4c1618},'attributes':['name']}});};exports[_0xca7d('0x15')]=function(_0x36f922){return request(_0xca7d('0x16'),{'options':{'where':{'id':_0x36f922},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x17')]=function(_0x1fc20b){return request(_0xca7d('0x18'),{'options':{'where':{'id':_0x1fc20b},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x19')]=function(_0x1a6cb7){return request(_0xca7d('0x1a'),{'options':{'where':{'id':_0x1a6cb7},'attributes':[_0xca7d('0x1b')]}});};exports['getUserById']=function(_0x536c28){return request(_0xca7d('0x1c'),{'options':{'where':{'id':_0x536c28},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x1d')]=function(_0x46eac1){return request(_0xca7d('0x1e'),{'options':{'where':{'phone':_0x46eac1['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0xcb2e83){return request('ShowTrunk',{'options':{'where':{'id':_0xcb2e83},'attributes':[_0xca7d('0xb')]}});};exports[_0xca7d('0x1f')]=function(_0x5f06c5){return request(_0xca7d('0x20'),{'options':{'where':{'id':_0x5f06c5},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x408b07){return request(_0xca7d('0x21'),{'options':{'raw':![],'where':{'id':_0x408b07},'include':[{'model':_0xca7d('0x22'),'as':_0xca7d('0x23')}]}});};exports['getSmsAccountById']=function(_0x4121ce){return request(_0xca7d('0x24'),{'options':{'where':{'id':_0x4121ce},'attributes':['id',_0xca7d('0xb')]}});};exports[_0xca7d('0x25')]=function(_0x79fc7d){return request(_0xca7d('0x26'),{'body':_0x79fc7d});};exports[_0xca7d('0x27')]=function(_0x44e415){return request(_0xca7d('0x28'),{'body':_0x44e415});};exports[_0xca7d('0x29')]=function(_0x59c71a){return request(_0xca7d('0x2a'),{'body':_[_0xca7d('0x2b')](_0x59c71a,{'project_name':_0x59c71a[_0xca7d('0x2c')],'prev_project_name':_0x59c71a[_0xca7d('0x2d')]||'','is_subproject':_0x59c71a[_0xca7d('0x2d')]?!![]:![],'leaveAt':moment()[_0xca7d('0x2e')](_0xca7d('0x2f'))})});};exports[_0xca7d('0x30')]=function(_0xb08cfd){return request(_0xca7d('0x31'),{'body':_0xb08cfd});};exports['createSquareMessage']=function(_0x445fad){return request(_0xca7d('0x32'),{'body':_0x445fad});};exports['createCmContact']=function(_0x3a1082){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3a1082['phone'],'ListId':_0x3a1082[_0xca7d('0x33')]}}})['then'](function(_0x37c8a6){if(_0x37c8a6){return _0x37c8a6;}return request(_0xca7d('0x34'),{'body':_0x3a1082});});};exports[_0xca7d('0x35')]=function(_0x3071e5){return request(_0xca7d('0x36'),{'options':{'where':{'id':_0x3071e5},'attributes':[_0xca7d('0xb')]}});};exports['agentLogin']=function(_0x86cfac,_0x2a3b98){return request(_0xca7d('0x37'),{'body':{'interface':_0x2a3b98},'options':{'where':_0x86cfac}});};exports['agentPause']=function(_0x324eaf,_0x3d9356,_0x4487bd){return request(_0xca7d('0x38'),{'body':{'type':_0x3d9356,'uniqueid':_0x4487bd},'options':{'where':_0x324eaf}});};exports[_0xca7d('0x39')]=function(_0x382fb3){return request(_0xca7d('0x3a'),{'body':{},'options':{'where':_0x382fb3}});};exports[_0xca7d('0x3b')]=function(_0x5bba0f){return request('LogoutUser',{'body':{},'options':{'where':_0x5bba0f}});}; \ 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 c4cbf58..b36630c 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 _0x3981=['./polly','exports'];(function(_0x2a532c,_0x3f5c49){var _0xe7d81d=function(_0x49d469){while(--_0x49d469){_0x2a532c['push'](_0x2a532c['shift']());}};_0xe7d81d(++_0x3f5c49);}(_0x3981,0x144));var _0x1398=function(_0x1bfb3c,_0x2ac29a){_0x1bfb3c=_0x1bfb3c-0x0;var _0xcaac0c=_0x3981[_0x1bfb3c];return _0xcaac0c;};var polly=require(_0x1398('0x0'));var lex=require('./lex');module[_0x1398('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x1419=['exports','./polly','./lex'];(function(_0x1693c3,_0x633f4b){var _0x5b136b=function(_0x2e7968){while(--_0x2e7968){_0x1693c3['push'](_0x1693c3['shift']());}};_0x5b136b(++_0x633f4b);}(_0x1419,0x127));var _0x9141=function(_0x21d441,_0x35f8b2){_0x21d441=_0x21d441-0x0;var _0x19a70b=_0x1419[_0x21d441];return _0x19a70b;};var polly=require(_0x9141('0x0'));var lex=require(_0x9141('0x1'));module[_0x9141('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 d10b0a3..9e3c538 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 _0x2dae=['./lib/api'];(function(_0x1e919d,_0x1f7d59){var _0x32e36c=function(_0x259582){while(--_0x259582){_0x1e919d['push'](_0x1e919d['shift']());}};_0x32e36c(++_0x1f7d59);}(_0x2dae,0xc3));var _0xe2da=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x2dae[_0x176317];return _0xef2759;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ No newline at end of file +var _0x4ea3=['./lib/api','exports'];(function(_0x384f38,_0x12f7fd){var _0x2c311b=function(_0x143bb5){while(--_0x143bb5){_0x384f38['push'](_0x384f38['shift']());}};_0x2c311b(++_0x12f7fd);}(_0x4ea3,0x70));var _0x34ea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4ea3[_0x6131cd];return _0x47e916;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ 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 816d8a9..1d6ed61 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(_0x37a299,_0x5d10c3){var _0x390267=function(_0x32b0a1){while(--_0x32b0a1){_0x37a299['push'](_0x37a299['shift']());}};_0x390267(++_0x5d10c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x2845ad,_0x21bf4a){var _0x1a5985=function(_0x32ce9d){while(--_0x32ce9d){_0x2845ad['push'](_0x2845ad['shift']());}};_0x1a5985(++_0x21bf4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 8cbdc1d..6e52208 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 _0xeed2=['exports'];(function(_0xbf3f5b,_0x45c769){var _0x6afa06=function(_0x431d06){while(--_0x431d06){_0xbf3f5b['push'](_0xbf3f5b['shift']());}};_0x6afa06(++_0x45c769);}(_0xeed2,0xcc));var _0x2eed=function(_0x50ca2c,_0xe9fb09){_0x50ca2c=_0x50ca2c-0x0;var _0x44f0ac=_0xeed2[_0x50ca2c];return _0x44f0ac;};'use strict';var polly=require('./lib/api');module[_0x2eed('0x0')]=function(_0x4051c6,_0x1077c4,_0x1dbc57,_0x5aa036,_0xbdc22e,_0x5972dc,_0x392bd2){return polly(_0x4051c6,_0x1077c4,_0x1dbc57,_0x5aa036,_0xbdc22e,_0x5972dc,_0x392bd2);}; \ No newline at end of file +var _0x6fe4=['./lib/api','exports'];(function(_0xfca4f9,_0x508b93){var _0x2334dd=function(_0x3b1554){while(--_0x3b1554){_0xfca4f9['push'](_0xfca4f9['shift']());}};_0x2334dd(++_0x508b93);}(_0x6fe4,0x14a));var _0x46fe=function(_0x4ef51c,_0x4e3a7d){_0x4ef51c=_0x4ef51c-0x0;var _0x4cc2e8=_0x6fe4[_0x4ef51c];return _0x4cc2e8;};'use strict';var polly=require(_0x46fe('0x0'));module[_0x46fe('0x1')]=function(_0x48ea67,_0x3c1dcf,_0x34ff98,_0x4098b9,_0xb2bb90,_0x53c170,_0xd3c20b){return polly(_0x48ea67,_0x3c1dcf,_0x34ff98,_0x4098b9,_0xb2bb90,_0x53c170,_0xd3c20b);}; \ 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 9b88cb1..5ea04c5 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 _0xc4b0=['AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','randomstring','writeFile'];(function(_0x144114,_0x5f0b0d){var _0x2d84f5=function(_0x2a71c8){while(--_0x2a71c8){_0x144114['push'](_0x144114['shift']());}};_0x2d84f5(++_0x5f0b0d);}(_0xc4b0,0x114));var _0x0c4b=function(_0x58f9a8,_0x46cc13){_0x58f9a8=_0x58f9a8-0x0;var _0x551362=_0xc4b0[_0x58f9a8];return _0x551362;};'use strict';var fs=require('fs');var path=require(_0x0c4b('0x0'));var BPromise=require('bluebird');var rs=require(_0x0c4b('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x26189f,_0x47bb1e,_0x460e73){return new BPromise(function(_0x36fc54,_0x2de9bc){_0x26189f['synthesizeSpeech'](_0x47bb1e,function(_0x5b47f5,_0x4667ab){if(_0x5b47f5){_0x2de9bc(_0x5b47f5);}else if(_0x4667ab){if(_0x4667ab['AudioStream']instanceof Buffer){fs[_0x0c4b('0x2')](_0x460e73,_0x4667ab[_0x0c4b('0x3')],function(_0x3f8984){if(_0x3f8984){_0x2de9bc(_0x3f8984);}else{_0x36fc54();}});}else{_0x2de9bc(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2de9bc(new Error(_0x0c4b('0x4')));}});});}module[_0x0c4b('0x5')]=function(_0x5625f4,_0x4d69af,_0x4675b5,_0x4ea8bc,_0x3a4485,_0x36c2d9,_0x47a651){var _0x4bda69=new AWS[(_0x0c4b('0x6'))]({'accessKeyId':_0x5625f4,'secretAccessKey':_0x4d69af,'region':_0x4675b5});var _0x25dc4e={'Text':_0x3a4485,'TextType':_0x36c2d9||_0x0c4b('0x7'),'OutputFormat':_0x0c4b('0x8'),'VoiceId':_0x4ea8bc};return pollyResult(_0x4bda69,_0x25dc4e,_0x47a651);}; \ No newline at end of file +var _0xcb45=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1f7f0d,_0x378063){var _0x545d6a=function(_0x34df7c){while(--_0x34df7c){_0x1f7f0d['push'](_0x1f7f0d['shift']());}};_0x545d6a(++_0x378063);}(_0xcb45,0xe9));var _0x5cb4=function(_0x34d8ab,_0x16029d){_0x34d8ab=_0x34d8ab-0x0;var _0x1b7ae5=_0xcb45[_0x34d8ab];return _0x1b7ae5;};'use strict';var fs=require('fs');var path=require(_0x5cb4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x5cb4('0x1'));function pollyResult(_0x3a1354,_0x2d5c0b,_0x480a8d){return new BPromise(function(_0x56a3b0,_0x28283d){_0x3a1354[_0x5cb4('0x2')](_0x2d5c0b,function(_0xb07c5,_0x391acc){if(_0xb07c5){_0x28283d(_0xb07c5);}else if(_0x391acc){if(_0x391acc[_0x5cb4('0x3')]instanceof Buffer){fs[_0x5cb4('0x4')](_0x480a8d,_0x391acc[_0x5cb4('0x3')],function(_0x358187){if(_0x358187){_0x28283d(_0x358187);}else{_0x56a3b0();}});}else{_0x28283d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x28283d(new Error(_0x5cb4('0x5')));}});});}module[_0x5cb4('0x6')]=function(_0x442d94,_0x5c62d6,_0x260029,_0x380f1c,_0x1c1e43,_0x52086f,_0x2535f4){var _0x55dd60=new AWS['Polly']({'accessKeyId':_0x442d94,'secretAccessKey':_0x5c62d6,'region':_0x260029});var _0xa5bd00={'Text':_0x1c1e43,'TextType':_0x52086f||'text','OutputFormat':'mp3','VoiceId':_0x380f1c};return pollyResult(_0x55dd60,_0xa5bd00,_0x2535f4);}; \ 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 43e800d..6cc4669 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 _0x624d=['./lib/api'];(function(_0x2e8a6f,_0x118c61){var _0x30cbb4=function(_0x3f5c8b){while(--_0x3f5c8b){_0x2e8a6f['push'](_0x2e8a6f['shift']());}};_0x30cbb4(++_0x118c61);}(_0x624d,0x1a0));var _0xd624=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x624d[_0x1d1d09];return _0x8827e;};'use strict';var asr=require(_0xd624('0x0'));module['exports']=function(_0x57e0f4,_0x9f608b,_0x574b7a,_0x4d6c90){return asr(_0x57e0f4,_0x9f608b,_0x574b7a);}; \ No newline at end of file +var _0x75cb=['./lib/api'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x75cb,0x1d2));var _0xb75c=function(_0x448a56,_0x3cd4d1){_0x448a56=_0x448a56-0x0;var _0x1ba466=_0x75cb[_0x448a56];return _0x1ba466;};'use strict';var asr=require(_0xb75c('0x0'));module['exports']=function(_0x12b767,_0x175c16,_0x207112,_0xb128b0){return asr(_0x12b767,_0x175c16,_0x207112);}; \ 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 b280ef4..54bc9b7 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 _0x0a12=['base64','POST','/v1/speech:recognize?key=','8000','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x503287,_0x252ead){var _0x3709ef=function(_0x39e5f5){while(--_0x39e5f5){_0x503287['push'](_0x503287['shift']());}};_0x3709ef(++_0x252ead);}(_0x0a12,0xb8));var _0x20a1=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0a12[_0x27af45];return _0x18df21;};'use strict';var url=require('url');var BPromise=require(_0x20a1('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x538550,_0x38a7da,_0x4ec1f1){return new BPromise(function(_0x3fe991,_0x2079d8){var _0x2cd34f;if(typeof _0x538550!==_0x20a1('0x1')||_0x538550[_0x20a1('0x2')]===0x0){return _0x2079d8(_0x20a1('0x3'));}if(typeof _0x38a7da!==_0x20a1('0x1')||_0x38a7da['length']===0x0){return _0x2079d8('key\x20should\x20be\x20a\x20string');}if(typeof _0x4ec1f1!==_0x20a1('0x4')&&(typeof _0x4ec1f1!=='string'||_0x4ec1f1['length']===0x0)){return _0x2079d8(_0x20a1('0x5'));}try{_0x2cd34f=fs[_0x20a1('0x6')](_0x538550)[_0x20a1('0x7')](_0x20a1('0x8'));}catch(_0x24f114){return _0x2079d8(_0x24f114);}return _0x3fe991({'method':_0x20a1('0x9'),'uri':host+_0x20a1('0xa')+_0x38a7da,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x20a1('0xb'),'languageCode':_0x4ec1f1},'audio':{'content':_0x2cd34f}},'json':!![]});});}; \ No newline at end of file +var _0x524a=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x109f94,_0x5ab6e4){var _0x5ad1bd=function(_0x53ce8c){while(--_0x53ce8c){_0x109f94['push'](_0x109f94['shift']());}};_0x5ad1bd(++_0x5ab6e4);}(_0x524a,0xf5));var _0xa524=function(_0x4af4f3,_0x15af2d){_0x4af4f3=_0x4af4f3-0x0;var _0x155022=_0x524a[_0x4af4f3];return _0x155022;};'use strict';var url=require(_0xa524('0x0'));var BPromise=require(_0xa524('0x1'));var fs=require('fs');var host=_0xa524('0x2');module[_0xa524('0x3')]=function(_0x53c48c,_0x4a29b7,_0x2ef77c){return new BPromise(function(_0xa89d8c,_0x56ab08){var _0x50ec75;if(typeof _0x53c48c!==_0xa524('0x4')||_0x53c48c[_0xa524('0x5')]===0x0){return _0x56ab08(_0xa524('0x6'));}if(typeof _0x4a29b7!=='string'||_0x4a29b7[_0xa524('0x5')]===0x0){return _0x56ab08('key\x20should\x20be\x20a\x20string');}if(typeof _0x2ef77c!==_0xa524('0x7')&&(typeof _0x2ef77c!==_0xa524('0x4')||_0x2ef77c['length']===0x0)){return _0x56ab08(_0xa524('0x8'));}try{_0x50ec75=fs[_0xa524('0x9')](_0x53c48c)[_0xa524('0xa')](_0xa524('0xb'));}catch(_0x3b484b){return _0x56ab08(_0x3b484b);}return _0xa89d8c({'method':'POST','uri':host+_0xa524('0xc')+_0x4a29b7,'body':{'config':{'encoding':_0xa524('0xd'),'sampleRateHertz':'8000','languageCode':_0x2ef77c},'audio':{'content':_0x50ec75}},'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 f93e12c..026b053 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 _0x4abf=['exports'];(function(_0x28dcbe,_0x1f0cd6){var _0x5ce45d=function(_0x3b595b){while(--_0x3b595b){_0x28dcbe['push'](_0x28dcbe['shift']());}};_0x5ce45d(++_0x1f0cd6);}(_0x4abf,0xf4));var _0xf4ab=function(_0x3aff71,_0x493a7c){_0x3aff71=_0x3aff71-0x0;var _0x23b3ed=_0x4abf[_0x3aff71];return _0x23b3ed;};var asr=require('./asr');module[_0xf4ab('0x0')]={'asr':asr}; \ No newline at end of file +var _0x8825=['exports'];(function(_0x1e0cce,_0x4e2913){var _0x2f2a85=function(_0x1b5c08){while(--_0x1b5c08){_0x1e0cce['push'](_0x1e0cce['shift']());}};_0x2f2a85(++_0x4e2913);}(_0x8825,0x17e));var _0x5882=function(_0x447fdd,_0x21f753){_0x447fdd=_0x447fdd-0x0;var _0x3075e0=_0x8825[_0x447fdd];return _0x3075e0;};var asr=require('./asr');module[_0x5882('0x0')]={'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 c4c8199..8bb315d 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 _0xd3e6=['transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','endConversation','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','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','parse','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','input','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','asr','uri','results','map','alternatives'];(function(_0x3fa4bd,_0x14a72d){var _0x358c95=function(_0x55c7fc){while(--_0x55c7fc){_0x3fa4bd['push'](_0x3fa4bd['shift']());}};_0x358c95(++_0x14a72d);}(_0xd3e6,0x153));var _0x6d3e=function(_0x105390,_0x261196){_0x105390=_0x105390-0x0;var _0x1b742c=_0xd3e6[_0x105390];return _0x1b742c;};'use strict';var apiai=require(_0x6d3e('0x0'));var BPromise=require(_0x6d3e('0x1'));var dialogflow=require(_0x6d3e('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x6d3e('0x3'));var md5=require('md5');var path=require(_0x6d3e('0x4'));var querystring=require(_0x6d3e('0x5'));var rp=require(_0x6d3e('0x6'));var rs=require(_0x6d3e('0x7'));var sox=require(_0x6d3e('0x8'));var tts=require(_0x6d3e('0x9'));var urlParse=require(_0x6d3e('0xa'))['parse'];var util=require(_0x6d3e('0xb'));var aws=require('./aws');var google=require(_0x6d3e('0xc'));var sestek=require(_0x6d3e('0xd'));var tilde=require(_0x6d3e('0xe'));var logger=require(_0x6d3e('0xf'))(_0x6d3e('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3bed96,_0x32f4f0){return new BPromise(function(_0x4acdfb,_0x28bba9){var _0x363f4d=urlParse(_0x3bed96);var _0xbd2cd6=_0x363f4d[_0x6d3e('0x11')]===_0x6d3e('0x12')?https:http;var _0x2cd039={'host':_0x363f4d[_0x6d3e('0x13')],'path':_0x363f4d[_0x6d3e('0x4')],'headers':{'user-agent':_0x6d3e('0x14')}};_0xbd2cd6[_0x6d3e('0x15')](_0x2cd039,function(_0x20b903){if(_0x20b903[_0x6d3e('0x16')]!==0xc8){logger['error'](_0x6d3e('0x17')+_0x3bed96+'\x20failed,\x20status\x20code\x20=\x20'+_0x20b903[_0x6d3e('0x16')]+'\x20('+_0x20b903[_0x6d3e('0x18')]+')');_0x28bba9(new Error(_0x6d3e('0x17')+_0x3bed96+'\x20failed,\x20status\x20code\x20=\x20'+_0x20b903['statusCode']+'\x20('+_0x20b903[_0x6d3e('0x18')]+')'));return;}var _0x59ba58=fs[_0x6d3e('0x19')](_0x32f4f0);_0x59ba58['on'](_0x6d3e('0x1a'),function(){logger[_0x6d3e('0x1b')](_0x6d3e('0x1c'));_0x59ba58[_0x6d3e('0x1d')](_0x4acdfb);});_0x59ba58['on'](_0x6d3e('0x1e'),function(_0x3abd7c){fs[_0x6d3e('0x1f')](_0x32f4f0);logger[_0x6d3e('0x1e')](_0x6d3e('0x20'),_0x3abd7c);_0x28bba9(_0x3abd7c);});_0x20b903[_0x6d3e('0x21')](_0x59ba58);})['on'](_0x6d3e('0x1e'),function(_0x308438){logger['error'](_0x308438);_0x28bba9(_0x308438);})[_0x6d3e('0x22')]();});}function uploadFile(_0x53141f){return new BPromise(function(_0x2f26fc,_0x2c00b3){var _0x21f336=urlParse(_0x53141f);var _0x427b42=_0x21f336[_0x6d3e('0x11')]===_0x6d3e('0x12')?https:http;var _0x4d0fba={'host':_0x21f336['host'],'path':_0x21f336[_0x6d3e('0x4')],'headers':{'user-agent':_0x6d3e('0x14')}};_0x427b42['get'](_0x4d0fba,function(_0x1d0908){if(_0x1d0908[_0x6d3e('0x16')]!==0xc8){_0x2c00b3(new Error(_0x6d3e('0x17')+_0x53141f+_0x6d3e('0x23')+_0x1d0908[_0x6d3e('0x16')]+'\x20('+_0x1d0908[_0x6d3e('0x18')]+')'));return;}var _0x389485='';_0x1d0908['on'](_0x6d3e('0x24'),function(_0x27a771){_0x389485+=_0x27a771;});_0x1d0908['on']('end',function(){_0x2f26fc(_0x389485);});})['on'](_0x6d3e('0x1e'),function(_0x906a1e){_0x2c00b3(_0x906a1e);})[_0x6d3e('0x22')]();});}function convertFile(_0x36f084,_0x24907f){return new BPromise(function(_0x3cadbc,_0x1bf3d0){var _0x4f70a3=sox[_0x6d3e('0x25')](_0x36f084,_0x24907f,{'sampleRate':0x1f40,'format':_0x6d3e('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4f70a3['on'](_0x6d3e('0x1e'),function(_0x493232){logger[_0x6d3e('0x1e')](_0x6d3e('0x27'),_0x493232);_0x1bf3d0(_0x493232);});_0x4f70a3['on']('end',function(){logger['info'](_0x6d3e('0x28'));_0x3cadbc();});_0x4f70a3[_0x6d3e('0x29')]();});}function base64Decode(_0x255c4f,_0x81c141){var _0x3c00bb=path[_0x6d3e('0x2a')](__dirname,_0x6d3e('0x2b'),rs[_0x6d3e('0x2c')](0x4)+_0x6d3e('0x2d'));fs['writeFileSync'](_0x3c00bb,_0x255c4f,_0x6d3e('0x2e'));return convertFile(_0x3c00bb,_0x81c141)[_0x6d3e('0x2f')](function(){try{fs[_0x6d3e('0x1f')](_0x3c00bb);fs[_0x6d3e('0x30')](_0x81c141,_0x6d3e('0x31'));}catch(_0xc0e96b){logger[_0x6d3e('0x1e')](_0xc0e96b);}return _0x81c141[_0x6d3e('0x32')]('.')[0x0];});}function base64Encode(_0x35d58c){var _0xe99cab=fs[_0x6d3e('0x33')](_0x35d58c);return new Buffer(_0xe99cab)[_0x6d3e('0x34')](_0x6d3e('0x2e'));}exports[_0x6d3e('0x35')]=function(_0x58248f,_0x320c09,_0x1b1313,_0x2f0be4,_0x5a3747,_0x166ae9){var _0x4c7d6e,_0x2794e8;var _0x35c302='https://texttospeech.googleapis.com/v1/';var _0x54b86a=_0x6d3e('0x36')+_0x58248f;var _0x27f1ea={};if(_0x320c09==='ssml'){_0x27f1ea[_0x6d3e('0x37')]={'ssml':_0x1b1313};}else{_0x27f1ea['input']={'text':_0x1b1313};};_0x27f1ea['voice']={'languageCode':_0x2f0be4,'ssmlGender':_0x5a3747};_0x27f1ea[_0x6d3e('0x38')]={'audioEncoding':_0x6d3e('0x39'),'sampleRateHertz':0x1f40};var _0xd5f8e8={'url':_0x35c302+_0x6d3e('0x3a')+_0x54b86a,'method':'POST','json':!![],'body':_0x27f1ea};return rp(_0xd5f8e8)[_0x6d3e('0x2f')](function(_0x33ccb4){return new BPromise(function(_0x226b1d,_0x2b1959){_0x4c7d6e=path[_0x6d3e('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0x6d3e('0x3b'));var _0xf491fd=Buffer[_0x6d3e('0x3c')](_0x33ccb4[_0x6d3e('0x3d')],_0x6d3e('0x2e'));return fs[_0x6d3e('0x3e')](_0x4c7d6e,_0xf491fd,function(_0x33bab7){_0x2b1959(_0x33bab7);},function(_0x588b22){fs[_0x6d3e('0x30')](_0x4c7d6e,_0x6d3e('0x31'));_0x226b1d(_0x588b22);});});})[_0x6d3e('0x2f')](function(_0x88c2eb){_0x2794e8=path[_0x6d3e('0x2a')](__dirname,'tmp',rs[_0x6d3e('0x2c')](0x4)+'.wav');return convertFile(_0x4c7d6e,_0x2794e8);})[_0x6d3e('0x2f')](function(){try{fs['unlink'](_0x4c7d6e);fs[_0x6d3e('0x30')](_0x2794e8,_0x6d3e('0x31'));}catch(_0x5722dd){logger[_0x6d3e('0x1e')](_0x5722dd);}logger[_0x6d3e('0x1b')](_0x6d3e('0x3f'),_0x2794e8[_0x6d3e('0x32')]('.')[0x0]);return _0x2794e8['split']('.')[0x0];});};exports[_0x6d3e('0x40')]=function(_0x31b206,_0x26d4ef){var _0x542a7c=_0x6d3e('0x41');var _0x190d4a,_0x5118e0;var _0x22fd0d;var _0x576b6={'encoding':'utf8','method':_0x6d3e('0x42'),'timeout':0x2710,'url':_0x542a7c,'headers':{'Content-Type':_0x6d3e('0x43')},'body':_0x6d3e('0x44')+encodeURIComponent(JSON[_0x6d3e('0x45')]([[[_0x6d3e('0x46'),JSON[_0x6d3e('0x45')]([_0x31b206,_0x26d4ef||'en',![],'null']),null,'generic']]]))};return rp(_0x576b6)[_0x6d3e('0x2f')](function(_0x224b74){try{_0x22fd0d=eval(_0x224b74['slice'](0x5))[0x0][0x2];}catch(_0x35165a){throw new Error(_0x6d3e('0x47')+_0x224b74['data']);}if(!_0x22fd0d){if(_0x31b206[_0x6d3e('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x6d3e('0x49')+_0x26d4ef+_0x6d3e('0x4a'));}}try{_0x22fd0d=eval(_0x22fd0d)[0x0];}catch(_0xe5ab86){throw new Error(_0x6d3e('0x47')+res[_0x6d3e('0x24')]);}const _0xbb85fb=_0x22fd0d;_0x190d4a=path[_0x6d3e('0x2a')](__dirname,_0x6d3e('0x2b'),rs[_0x6d3e('0x2c')](0x4)+'.mp3');fs[_0x6d3e('0x4b')](_0x190d4a,_0x22fd0d,{'encoding':'base64'});_0x5118e0=path[_0x6d3e('0x2a')](__dirname,_0x6d3e('0x2b'),rs['generate'](0x4)+_0x6d3e('0x2d'));return convertFile(_0x190d4a,_0x5118e0);})[_0x6d3e('0x2f')](function(){try{fs[_0x6d3e('0x1f')](_0x190d4a);fs[_0x6d3e('0x30')](_0x5118e0,_0x6d3e('0x31'));}catch(_0xd08c57){logger[_0x6d3e('0x1e')](_0xd08c57);}logger[_0x6d3e('0x1b')]('goggleTTS\x20path',_0x5118e0['split']('.')[0x0]);return _0x5118e0[_0x6d3e('0x32')]('.')[0x0];});};exports['googleASR']=function(_0x1a1ad1,_0x40b15a,_0x3dca0c){return google[_0x6d3e('0x4c')](_0x1a1ad1,_0x40b15a,_0x3dca0c)[_0x6d3e('0x2f')](function(_0x42367c){logger[_0x6d3e('0x1b')](_0x42367c[_0x6d3e('0x4d')]);return rp(_0x42367c);})[_0x6d3e('0x2f')](function(_0x3fd4ab){var _0x1597da='';var _0x39855a=0x0;try{fs[_0x6d3e('0x1f')](_0x1a1ad1);}catch(_0x4ba2a1){logger['error'](_0x4ba2a1);}if(_0x3fd4ab&&_0x3fd4ab[_0x6d3e('0x4e')]){_0x1597da=_0x3fd4ab[_0x6d3e('0x4e')][_0x6d3e('0x4f')](function(_0x5e3ac6){return _0x5e3ac6&&_0x5e3ac6['alternatives'][0x0]&&_0x5e3ac6[_0x6d3e('0x50')][0x0][_0x6d3e('0x51')]?_0x5e3ac6[_0x6d3e('0x50')][0x0]['transcript']:'';})[_0x6d3e('0x52')]('\x0a');_0x39855a=_0x3fd4ab[_0x6d3e('0x4e')]['map'](function(_0x3f3d9b){return _0x3f3d9b&&_0x3f3d9b[_0x6d3e('0x50')][0x0]&&_0x3f3d9b[_0x6d3e('0x50')][0x0][_0x6d3e('0x53')]?_0x3f3d9b[_0x6d3e('0x50')][0x0]['confidence']:0x0;})[_0x6d3e('0x52')]('\x0a');}logger['info'](_0x6d3e('0x54'),_0x1597da);logger[_0x6d3e('0x1b')](_0x6d3e('0x55'),_0x39855a);return{'transcript':_0x1597da,'confidence':_0x39855a};})['catch'](function(_0x1841ca){logger[_0x6d3e('0x1e')](_0x6d3e('0x56'),_0x1841ca['statusCode'],_0x1841ca[_0x6d3e('0x57')],_0x1841ca[_0x6d3e('0x58')]);});};exports[_0x6d3e('0x59')]=function(_0x257812,_0x1f97a9,_0x2a6422,_0x25bfdc){var _0x38e2c5=apiai(_0x1f97a9,{'language':_0x25bfdc||'en'});return _0x38e2c5['textRequest'](_0x2a6422,{'sessionId':md5(_0x257812)})['then'](function(_0x149aef){logger[_0x6d3e('0x1b')](JSON['stringify'](_0x149aef));return{'source':_0x149aef['result'][_0x6d3e('0x5a')],'resolvedQuery':_0x149aef[_0x6d3e('0x5b')][_0x6d3e('0x5c')],'action':_0x149aef[_0x6d3e('0x5b')][_0x6d3e('0x5d')],'actionIncomplete':_0x149aef['result'][_0x6d3e('0x5e')],'speech':_0x149aef[_0x6d3e('0x5b')][_0x6d3e('0x5f')][_0x6d3e('0x60')],'score':_0x149aef['result'][_0x6d3e('0x61')],'statusCode':_0x149aef[_0x6d3e('0x62')][_0x6d3e('0x63')],'endConversation':_0x149aef[_0x6d3e('0x5b')]['metadata'][_0x6d3e('0x64')]||![],'isFallbackIntent':_0x149aef['result'][_0x6d3e('0x65')]['isFallbackIntent']};});};exports[_0x6d3e('0x66')]=function(_0x3a02ac,_0x49a6d4,_0x44c057,_0x3e2455,_0x56c4f3,_0x2c8981){var _0x3df7aa=_0x3e2455[_0x6d3e('0x67')](/\\n/g,'\x0a');var _0x4544bd={'credentials':{'private_key':_0x3df7aa,'client_email':_0x44c057}};var _0x56296d=new dialogflow[(_0x6d3e('0x68'))](_0x4544bd);var _0x180b30=_0x56296d[_0x6d3e('0x69')](_0x49a6d4,md5(_0x3a02ac));var _0x368690={'session':_0x180b30,'queryInput':{'text':{'text':_0x56c4f3,'languageCode':_0x2c8981}}};return _0x56296d[_0x6d3e('0x6a')](_0x368690)[_0x6d3e('0x2f')](function(_0x26368b){if(_0x26368b&&_0x26368b['length']){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0x6d3e('0x45')](_0x26368b));var _0x27d784=_0x26368b[0x0];if(_0x27d784){var _0x1f35ef={'action':_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x5d')],'allRequiredParamsPresent':_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x6c')],'endConversation':_0x27d784[_0x6d3e('0x6b')]['diagnosticInfo']&&_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x6d')][_0x6d3e('0x6e')]?_0x27d784[_0x6d3e('0x6b')]['diagnosticInfo'][_0x6d3e('0x6e')][_0x6d3e('0x6f')]['boolValue']:![],'fulfillmentText':_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x70')],'intentName':_0x27d784[_0x6d3e('0x6b')]['intent'][_0x6d3e('0x57')],'intentDisplayName':_0x27d784[_0x6d3e('0x6b')]['intent']['displayName'],'isFallbackIntent':_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x71')][_0x6d3e('0x72')],'languageCode':_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x73')],'queryText':_0x27d784[_0x6d3e('0x6b')][_0x6d3e('0x74')],'responseId':_0x27d784[_0x6d3e('0x75')],'score':_0x27d784[_0x6d3e('0x6b')]['intentDetectionConfidence'],'speech':_0x27d784['queryResult'][_0x6d3e('0x70')],'providerResponse':JSON[_0x6d3e('0x45')](_0x26368b)};return _0x1f35ef;}}});};exports[_0x6d3e('0x76')]=function(_0xa7f7c,_0x1ebed7,_0x1ce22b,_0x5e9b62){return tilde['asr'](_0xa7f7c,_0x1ebed7,_0x1ce22b,_0x5e9b62)[_0x6d3e('0x2f')](function(_0x4c35b1){try{fs[_0x6d3e('0x1f')](_0xa7f7c);}catch(_0x443082){logger[_0x6d3e('0x1e')](_0x443082);}logger['info'](_0x6d3e('0x77'),_0x4c35b1[_0x6d3e('0x51')]);logger['info'](_0x6d3e('0x78'),_0x4c35b1['confidence']);return _0x4c35b1;});};exports[_0x6d3e('0x79')]=function(_0x275bb3,_0x3f73a3,_0xa5be96,_0x3c6d4b,_0x485ce7,_0x22f0b1){var _0x442647=path['resolve'](__dirname,_0x6d3e('0x2b'),rs['generate'](0x4)+'.mp3');var _0x568821;return aws[_0x6d3e('0x7a')](_0x275bb3,_0x3f73a3,_0xa5be96,_0x3c6d4b,_0x485ce7,_0x22f0b1,_0x442647)[_0x6d3e('0x2f')](function(){_0x568821=path[_0x6d3e('0x2a')](__dirname,'tmp',rs[_0x6d3e('0x2c')](0x4)+_0x6d3e('0x2d'));return convertFile(_0x442647,_0x568821);})['then'](function(){try{fs[_0x6d3e('0x1f')](_0x442647);fs[_0x6d3e('0x30')](_0x568821,_0x6d3e('0x31'));}catch(_0x432d34){logger[_0x6d3e('0x1e')](_0x432d34);}return _0x568821[_0x6d3e('0x32')]('.')[0x0];});};exports[_0x6d3e('0x7b')]=function(_0x10c60c,_0x5c1562,_0xffd8b,_0x5ae729,_0x3a82c0,_0x3e826f){return aws[_0x6d3e('0x7c')](_0x10c60c,_0x5c1562,_0xffd8b,_0x5ae729,_0x3a82c0,_0x3e826f)['then'](function(_0x4bbdf3){logger['info'](JSON[_0x6d3e('0x45')](_0x4bbdf3));return _0x4bbdf3;});};exports['ispeechTTS']=function(_0x3c8877,_0x1a2c70,_0x8cfa8e,_0x23dc74){var _0x48f917=util[_0x6d3e('0x7d')](_0x6d3e('0x7e'),ISPEECH_API,_0x3c8877,encodeURIComponent(_0x1a2c70),_0x8cfa8e,_0x23dc74);var _0xb541d0=path[_0x6d3e('0x2a')](__dirname,_0x6d3e('0x2b'),rs['generate'](0x4)+_0x6d3e('0x3b'));var _0xdb2152;return downloadFile(_0x48f917,_0xb541d0)['then'](function(){_0xdb2152=path['resolve'](__dirname,_0x6d3e('0x2b'),rs[_0x6d3e('0x2c')](0x4)+_0x6d3e('0x2d'));return convertFile(_0xb541d0,_0xdb2152);})[_0x6d3e('0x2f')](function(){try{fs[_0x6d3e('0x1f')](_0xb541d0);fs[_0x6d3e('0x30')](_0xdb2152,_0x6d3e('0x31'));}catch(_0x47a787){logger[_0x6d3e('0x1e')](_0x47a787);}return _0xdb2152[_0x6d3e('0x32')]('.')[0x0];});};exports[_0x6d3e('0x7f')]=function(_0x4ef0be,_0x3b754c,_0x426045,_0x1e397b){var _0x4dcddf=util[_0x6d3e('0x7d')](_0x6d3e('0x80'),ISPEECH_API,_0x3b754c,_0x426045,base64Encode(_0x4ef0be),_0x1e397b?util['format'](_0x6d3e('0x81'),encodeURIComponent(_0x1e397b)):_0x6d3e('0x82'));return uploadFile(_0x4dcddf)[_0x6d3e('0x2f')](function(_0x587e23){return querystring[_0x6d3e('0x83')](_0x587e23);});};exports['sestekNDA']=function(_0x59adce,_0xa712c2){return sestek[_0x6d3e('0x84')](_0x59adce,_0xa712c2)[_0x6d3e('0x2f')](function(_0x15ff68){logger[_0x6d3e('0x1b')](JSON[_0x6d3e('0x45')](_0x15ff68));var _0x212575={'speech':_0x15ff68['text'],'action':_0x15ff68['channelData']?_0x15ff68[_0x6d3e('0x85')][_0x6d3e('0x86')]:undefined,'actiondata':_0x15ff68[_0x6d3e('0x85')]?_0x15ff68['channelData'][_0x6d3e('0x87')]:undefined};if(_0x15ff68[_0x6d3e('0x85')]&&_0x15ff68[_0x6d3e('0x85')][_0x6d3e('0x88')]){return base64Decode(_0x15ff68['channelData'][_0x6d3e('0x88')][_0x6d3e('0x89')],path[_0x6d3e('0x2a')](__dirname,_0x6d3e('0x2b'),rs[_0x6d3e('0x2c')](0x4)+_0x6d3e('0x2d')))[_0x6d3e('0x2f')](function(_0x401611){_0x212575[_0x6d3e('0x8a')]=_0x401611;return _0x212575;});}return _0x212575;});};exports[_0x6d3e('0x8b')]=function(){return __dirname;}; \ No newline at end of file +var _0x5311=['score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','isFallback','languageCode','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','http','https','md5','path','querystring','randomstring','sox','url','util','./aws','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','download\x20error','pipe','end','WHAT_EVER','data','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','then','unlink','chmodSync','777','split','toString','base64','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','POST','tmp','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech'];(function(_0x3608b6,_0x200aa2){var _0x48c903=function(_0x209a5d){while(--_0x209a5d){_0x3608b6['push'](_0x3608b6['shift']());}};_0x48c903(++_0x200aa2);}(_0x5311,0x138));var _0x1531=function(_0x53fb27,_0x3f4c7e){_0x53fb27=_0x53fb27-0x0;var _0x41de0d=_0x5311[_0x53fb27];return _0x41de0d;};'use strict';var apiai=require(_0x1531('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x1531('0x1'));var https=require(_0x1531('0x2'));var md5=require(_0x1531('0x3'));var path=require(_0x1531('0x4'));var querystring=require(_0x1531('0x5'));var rp=require('request-promise');var rs=require(_0x1531('0x6'));var sox=require(_0x1531('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x1531('0x8'))['parse'];var util=require(_0x1531('0x9'));var aws=require(_0x1531('0xa'));var google=require('./google');var sestek=require(_0x1531('0xb'));var tilde=require(_0x1531('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x1531('0xd');function downloadFile(_0x249da0,_0x5b29a3){return new BPromise(function(_0x5993a6,_0x3f0c31){var _0x4a17ef=urlParse(_0x249da0);var _0x5e169e=_0x4a17ef[_0x1531('0xe')]===_0x1531('0xf')?https:http;var _0x39b3e5={'host':_0x4a17ef[_0x1531('0x10')],'path':_0x4a17ef['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x5e169e[_0x1531('0x11')](_0x39b3e5,function(_0xf9ae09){if(_0xf9ae09[_0x1531('0x12')]!==0xc8){logger[_0x1531('0x13')]('request\x20to\x20'+_0x249da0+'\x20failed,\x20status\x20code\x20=\x20'+_0xf9ae09[_0x1531('0x12')]+'\x20('+_0xf9ae09['statusMessage']+')');_0x3f0c31(new Error(_0x1531('0x14')+_0x249da0+_0x1531('0x15')+_0xf9ae09[_0x1531('0x12')]+'\x20('+_0xf9ae09[_0x1531('0x16')]+')'));return;}var _0xeb98d7=fs[_0x1531('0x17')](_0x5b29a3);_0xeb98d7['on'](_0x1531('0x18'),function(){logger[_0x1531('0x19')]('finish\x20download\x20file');_0xeb98d7['close'](_0x5993a6);});_0xeb98d7['on'](_0x1531('0x13'),function(_0x42c27f){fs['unlink'](_0x5b29a3);logger['error'](_0x1531('0x1a'),_0x42c27f);_0x3f0c31(_0x42c27f);});_0xf9ae09[_0x1531('0x1b')](_0xeb98d7);})['on'](_0x1531('0x13'),function(_0x3a3602){logger['error'](_0x3a3602);_0x3f0c31(_0x3a3602);})[_0x1531('0x1c')]();});}function uploadFile(_0x30752a){return new BPromise(function(_0x432eca,_0x128358){var _0x4eaf31=urlParse(_0x30752a);var _0x36751a=_0x4eaf31[_0x1531('0xe')]===_0x1531('0xf')?https:http;var _0x2d47d8={'host':_0x4eaf31[_0x1531('0x10')],'path':_0x4eaf31['path'],'headers':{'user-agent':_0x1531('0x1d')}};_0x36751a[_0x1531('0x11')](_0x2d47d8,function(_0x44d9f5){if(_0x44d9f5[_0x1531('0x12')]!==0xc8){_0x128358(new Error(_0x1531('0x14')+_0x30752a+_0x1531('0x15')+_0x44d9f5[_0x1531('0x12')]+'\x20('+_0x44d9f5['statusMessage']+')'));return;}var _0x5290c9='';_0x44d9f5['on'](_0x1531('0x1e'),function(_0x2d26e1){_0x5290c9+=_0x2d26e1;});_0x44d9f5['on'](_0x1531('0x1c'),function(){_0x432eca(_0x5290c9);});})['on'](_0x1531('0x13'),function(_0xaa69e4){_0x128358(_0xaa69e4);})[_0x1531('0x1c')]();});}function convertFile(_0x583753,_0x299127){return new BPromise(function(_0x42ceea,_0x168b0d){var _0x26ba25=sox[_0x1531('0x1f')](_0x583753,_0x299127,{'sampleRate':0x1f40,'format':_0x1531('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26ba25['on'](_0x1531('0x13'),function(_0x96a6df){logger['error']('error\x20convert',_0x96a6df);_0x168b0d(_0x96a6df);});_0x26ba25['on'](_0x1531('0x1c'),function(){logger['info'](_0x1531('0x21'));_0x42ceea();});_0x26ba25[_0x1531('0x22')]();});}function base64Decode(_0x2c9508,_0x4bb1b5){var _0x545f1a=path[_0x1531('0x23')](__dirname,'tmp',rs[_0x1531('0x24')](0x4)+_0x1531('0x25'));fs[_0x1531('0x26')](_0x545f1a,_0x2c9508,'base64');return convertFile(_0x545f1a,_0x4bb1b5)[_0x1531('0x27')](function(){try{fs[_0x1531('0x28')](_0x545f1a);fs[_0x1531('0x29')](_0x4bb1b5,_0x1531('0x2a'));}catch(_0x1a3f9c){logger[_0x1531('0x13')](_0x1a3f9c);}return _0x4bb1b5[_0x1531('0x2b')]('.')[0x0];});}function base64Encode(_0x5a5fde){var _0x4d3d2b=fs['readFileSync'](_0x5a5fde);return new Buffer(_0x4d3d2b)[_0x1531('0x2c')](_0x1531('0x2d'));}exports['googleCloudTTS']=function(_0x344f2d,_0x314c75,_0x5b950d,_0x436aa7,_0x21b0b4,_0x46fff4){var _0x21cc9d,_0x56ba75;var _0x2feb28=_0x1531('0x2e');var _0x527803='?key='+_0x344f2d;var _0x502154={};if(_0x314c75===_0x1531('0x2f')){_0x502154[_0x1531('0x30')]={'ssml':_0x5b950d};}else{_0x502154['input']={'text':_0x5b950d};};_0x502154['voice']={'languageCode':_0x436aa7,'ssmlGender':_0x21b0b4};_0x502154[_0x1531('0x31')]={'audioEncoding':_0x1531('0x32'),'sampleRateHertz':0x1f40};var _0x1cbb93={'url':_0x2feb28+'text:synthesize'+_0x527803,'method':_0x1531('0x33'),'json':!![],'body':_0x502154};return rp(_0x1cbb93)[_0x1531('0x27')](function(_0x4c83ca){return new BPromise(function(_0x397c13,_0x1d481c){_0x21cc9d=path['resolve'](__dirname,_0x1531('0x34'),rs[_0x1531('0x24')](0x4)+_0x1531('0x35'));var _0x3def3a=Buffer['from'](_0x4c83ca[_0x1531('0x36')],_0x1531('0x2d'));return fs[_0x1531('0x37')](_0x21cc9d,_0x3def3a,function(_0x28b5ea){_0x1d481c(_0x28b5ea);},function(_0xbccc4b){fs[_0x1531('0x29')](_0x21cc9d,_0x1531('0x2a'));_0x397c13(_0xbccc4b);});});})[_0x1531('0x27')](function(_0x3d3a1b){_0x56ba75=path[_0x1531('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x21cc9d,_0x56ba75);})[_0x1531('0x27')](function(){try{fs['unlink'](_0x21cc9d);fs[_0x1531('0x29')](_0x56ba75,_0x1531('0x2a'));}catch(_0x575bda){logger['error'](_0x575bda);}logger['info'](_0x1531('0x38'),_0x56ba75['split']('.')[0x0]);return _0x56ba75[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x39')]=function(_0x809dd3,_0x4b69eb){var _0x347651='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x47464e,_0x20cf12;var _0x48e578;var _0xa41a04={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x347651,'headers':{'Content-Type':_0x1531('0x3a')},'body':'f.req='+encodeURIComponent(JSON[_0x1531('0x3b')]([[[_0x1531('0x3c'),JSON[_0x1531('0x3b')]([_0x809dd3,_0x4b69eb||'en',![],_0x1531('0x3d')]),null,_0x1531('0x3e')]]]))};return rp(_0xa41a04)['then'](function(_0x3ece6a){try{_0x48e578=eval(_0x3ece6a[_0x1531('0x3f')](0x5))[0x0][0x2];}catch(_0x28fd9a){throw new Error('parse\x20response\x20failed:\x0a'+_0x3ece6a[_0x1531('0x1e')]);}if(!_0x48e578){if(_0x809dd3[_0x1531('0x40')]>0xc8){throw new Error(_0x1531('0x41'));}else{throw new Error('lang\x20\x22'+_0x4b69eb+_0x1531('0x42'));}}try{_0x48e578=eval(_0x48e578)[0x0];}catch(_0x37a142){throw new Error(_0x1531('0x43')+res[_0x1531('0x1e')]);}const _0x4fbe2d=_0x48e578;_0x47464e=path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs[_0x1531('0x24')](0x4)+_0x1531('0x35'));fs[_0x1531('0x26')](_0x47464e,_0x48e578,{'encoding':_0x1531('0x2d')});_0x20cf12=path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs['generate'](0x4)+'.wav');return convertFile(_0x47464e,_0x20cf12);})[_0x1531('0x27')](function(){try{fs[_0x1531('0x28')](_0x47464e);fs['chmodSync'](_0x20cf12,_0x1531('0x2a'));}catch(_0x587c63){logger[_0x1531('0x13')](_0x587c63);}logger[_0x1531('0x19')](_0x1531('0x44'),_0x20cf12[_0x1531('0x2b')]('.')[0x0]);return _0x20cf12[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x45')]=function(_0x1b4a1a,_0x1d3a6b,_0x4edaf2){return google[_0x1531('0x46')](_0x1b4a1a,_0x1d3a6b,_0x4edaf2)[_0x1531('0x27')](function(_0xee4819){logger['info'](_0xee4819[_0x1531('0x47')]);return rp(_0xee4819);})[_0x1531('0x27')](function(_0x3d3f7c){var _0x486ec3='';var _0x477f01=0x0;try{fs['unlink'](_0x1b4a1a);}catch(_0x45bb7e){logger['error'](_0x45bb7e);}if(_0x3d3f7c&&_0x3d3f7c[_0x1531('0x48')]){_0x486ec3=_0x3d3f7c['results']['map'](function(_0x3e5b5d){return _0x3e5b5d&&_0x3e5b5d[_0x1531('0x49')][0x0]&&_0x3e5b5d[_0x1531('0x49')][0x0]['transcript']?_0x3e5b5d['alternatives'][0x0][_0x1531('0x4a')]:'';})['join']('\x0a');_0x477f01=_0x3d3f7c[_0x1531('0x48')][_0x1531('0x4b')](function(_0x222a80){return _0x222a80&&_0x222a80[_0x1531('0x49')][0x0]&&_0x222a80[_0x1531('0x49')][0x0][_0x1531('0x4c')]?_0x222a80[_0x1531('0x49')][0x0][_0x1531('0x4c')]:0x0;})['join']('\x0a');}logger[_0x1531('0x19')]('googleASR\x20transcription',_0x486ec3);logger[_0x1531('0x19')]('googleASR\x20confidence',_0x477f01);return{'transcript':_0x486ec3,'confidence':_0x477f01};})['catch'](function(_0x3c57e8){logger[_0x1531('0x13')]('[%s]\x20%s:%s',_0x3c57e8[_0x1531('0x12')],_0x3c57e8['name'],_0x3c57e8[_0x1531('0x4d')]);});};exports[_0x1531('0x4e')]=function(_0x2f8edd,_0x2fe85c,_0x2357e1,_0x3535f8){var _0x88c76b=apiai(_0x2fe85c,{'language':_0x3535f8||'en'});return _0x88c76b[_0x1531('0x4f')](_0x2357e1,{'sessionId':md5(_0x2f8edd)})[_0x1531('0x27')](function(_0x12a2f1){logger[_0x1531('0x19')](JSON['stringify'](_0x12a2f1));return{'source':_0x12a2f1[_0x1531('0x50')][_0x1531('0x51')],'resolvedQuery':_0x12a2f1[_0x1531('0x50')][_0x1531('0x52')],'action':_0x12a2f1[_0x1531('0x50')][_0x1531('0x53')],'actionIncomplete':_0x12a2f1[_0x1531('0x50')][_0x1531('0x54')],'speech':_0x12a2f1['result'][_0x1531('0x55')][_0x1531('0x56')],'score':_0x12a2f1[_0x1531('0x50')][_0x1531('0x57')],'statusCode':_0x12a2f1['status'][_0x1531('0x58')],'endConversation':_0x12a2f1[_0x1531('0x50')][_0x1531('0x59')][_0x1531('0x5a')]||![],'isFallbackIntent':_0x12a2f1[_0x1531('0x50')]['metadata'][_0x1531('0x5b')]};});};exports[_0x1531('0x5c')]=function(_0x3c51bf,_0x416214,_0x92eabf,_0x19a64c,_0x16f999,_0x20c437){var _0x2c06dd=_0x19a64c[_0x1531('0x5d')](/\\n/g,'\x0a');var _0xa8d81={'credentials':{'private_key':_0x2c06dd,'client_email':_0x92eabf}};var _0x399c95=new dialogflow[(_0x1531('0x5e'))](_0xa8d81);var _0x392374=_0x399c95[_0x1531('0x5f')](_0x416214,md5(_0x3c51bf));var _0x28cb59={'session':_0x392374,'queryInput':{'text':{'text':_0x16f999,'languageCode':_0x20c437}}};return _0x399c95[_0x1531('0x60')](_0x28cb59)[_0x1531('0x27')](function(_0x2b1550){if(_0x2b1550&&_0x2b1550[_0x1531('0x40')]){logger['info'](_0x1531('0x61'),JSON['stringify'](_0x2b1550));var _0x322d35=_0x2b1550[0x0];if(_0x322d35){var _0xac5793={'action':_0x322d35[_0x1531('0x62')][_0x1531('0x53')],'allRequiredParamsPresent':_0x322d35['queryResult']['allRequiredParamsPresent'],'endConversation':_0x322d35[_0x1531('0x62')][_0x1531('0x63')]&&_0x322d35[_0x1531('0x62')][_0x1531('0x63')][_0x1531('0x64')]?_0x322d35['queryResult'][_0x1531('0x63')][_0x1531('0x64')][_0x1531('0x65')][_0x1531('0x66')]:![],'fulfillmentText':_0x322d35[_0x1531('0x62')]['fulfillmentText'],'intentName':_0x322d35[_0x1531('0x62')][_0x1531('0x67')]['name'],'intentDisplayName':_0x322d35[_0x1531('0x62')][_0x1531('0x67')]['displayName'],'isFallbackIntent':_0x322d35[_0x1531('0x62')][_0x1531('0x67')][_0x1531('0x68')],'languageCode':_0x322d35[_0x1531('0x62')][_0x1531('0x69')],'queryText':_0x322d35[_0x1531('0x62')]['queryText'],'responseId':_0x322d35[_0x1531('0x6a')],'score':_0x322d35[_0x1531('0x62')][_0x1531('0x6b')],'speech':_0x322d35[_0x1531('0x62')][_0x1531('0x6c')],'providerResponse':JSON['stringify'](_0x2b1550)};return _0xac5793;}}});};exports[_0x1531('0x6d')]=function(_0xc9621b,_0x17991e,_0x4219be,_0x4580c4){return tilde[_0x1531('0x46')](_0xc9621b,_0x17991e,_0x4219be,_0x4580c4)['then'](function(_0x1cfe63){try{fs['unlink'](_0xc9621b);}catch(_0x1b538f){logger['error'](_0x1b538f);}logger[_0x1531('0x19')](_0x1531('0x6e'),_0x1cfe63[_0x1531('0x4a')]);logger[_0x1531('0x19')](_0x1531('0x6f'),_0x1cfe63['confidence']);return _0x1cfe63;});};exports[_0x1531('0x70')]=function(_0xb1d020,_0x2e24a6,_0x48f912,_0x205328,_0x32127b,_0x3791d4){var _0x56612c=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x1f6a89;return aws[_0x1531('0x71')](_0xb1d020,_0x2e24a6,_0x48f912,_0x205328,_0x32127b,_0x3791d4,_0x56612c)['then'](function(){_0x1f6a89=path[_0x1531('0x23')](__dirname,'tmp',rs[_0x1531('0x24')](0x4)+_0x1531('0x25'));return convertFile(_0x56612c,_0x1f6a89);})[_0x1531('0x27')](function(){try{fs['unlink'](_0x56612c);fs[_0x1531('0x29')](_0x1f6a89,'777');}catch(_0x40820a){logger[_0x1531('0x13')](_0x40820a);}return _0x1f6a89[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x72')]=function(_0x2c1c57,_0x26f7d7,_0x204c5f,_0x2b9eb7,_0x231d6b,_0x49cbac){return aws[_0x1531('0x73')](_0x2c1c57,_0x26f7d7,_0x204c5f,_0x2b9eb7,_0x231d6b,_0x49cbac)[_0x1531('0x27')](function(_0xbaa5e){logger['info'](JSON[_0x1531('0x3b')](_0xbaa5e));return _0xbaa5e;});};exports[_0x1531('0x74')]=function(_0x310059,_0x29609a,_0x35fb00,_0x358377){var _0x22baae=util[_0x1531('0x75')](_0x1531('0x76'),ISPEECH_API,_0x310059,encodeURIComponent(_0x29609a),_0x35fb00,_0x358377);var _0xffd7c6=path[_0x1531('0x23')](__dirname,'tmp',rs[_0x1531('0x24')](0x4)+_0x1531('0x35'));var _0x27734b;return downloadFile(_0x22baae,_0xffd7c6)[_0x1531('0x27')](function(){_0x27734b=path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs[_0x1531('0x24')](0x4)+_0x1531('0x25'));return convertFile(_0xffd7c6,_0x27734b);})['then'](function(){try{fs[_0x1531('0x28')](_0xffd7c6);fs[_0x1531('0x29')](_0x27734b,_0x1531('0x2a'));}catch(_0x578f90){logger[_0x1531('0x13')](_0x578f90);}return _0x27734b[_0x1531('0x2b')]('.')[0x0];});};exports[_0x1531('0x77')]=function(_0x10946b,_0x49c7ef,_0x2e3d2,_0x2185bb){var _0x80996b=util[_0x1531('0x75')](_0x1531('0x78'),ISPEECH_API,_0x49c7ef,_0x2e3d2,base64Encode(_0x10946b),_0x2185bb?util['format'](_0x1531('0x79'),encodeURIComponent(_0x2185bb)):_0x1531('0x7a'));return uploadFile(_0x80996b)[_0x1531('0x27')](function(_0xa5d516){return querystring[_0x1531('0x7b')](_0xa5d516);});};exports[_0x1531('0x7c')]=function(_0x1f95c4,_0x222932){return sestek[_0x1531('0x7d')](_0x1f95c4,_0x222932)[_0x1531('0x27')](function(_0x1bd753){logger[_0x1531('0x19')](JSON[_0x1531('0x3b')](_0x1bd753));var _0x206f17={'speech':_0x1bd753[_0x1531('0x7e')],'action':_0x1bd753['channelData']?_0x1bd753[_0x1531('0x7f')][_0x1531('0x80')]:undefined,'actiondata':_0x1bd753[_0x1531('0x7f')]?_0x1bd753[_0x1531('0x7f')]['CustomActionData']:undefined};if(_0x1bd753[_0x1531('0x7f')]&&_0x1bd753['channelData']['AudioFromTts']){return base64Decode(_0x1bd753[_0x1531('0x7f')][_0x1531('0x81')][_0x1531('0x82')],path[_0x1531('0x23')](__dirname,_0x1531('0x34'),rs['generate'](0x4)+_0x1531('0x25')))['then'](function(_0x206f24){_0x206f17[_0x1531('0x83')]=_0x206f24;return _0x206f17;});}return _0x206f17;});};exports[_0x1531('0x84')]=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 33c8ee4..192efa2 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 _0x205e=['./nda'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x205e,0x15d));var _0xe205=function(_0x129c94,_0x25f95a){_0x129c94=_0x129c94-0x0;var _0x100742=_0x205e[_0x129c94];return _0x100742;};var nda=require(_0xe205('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x76ff=['./nda'];(function(_0x3be78b,_0x59c0cd){var _0x3c50b4=function(_0x2105ee){while(--_0x2105ee){_0x3be78b['push'](_0x3be78b['shift']());}};_0x3c50b4(++_0x59c0cd);}(_0x76ff,0x1d1));var _0xf76f=function(_0x556a90,_0x4ca532){_0x556a90=_0x556a90-0x0;var _0x57e79d=_0x76ff[_0x556a90];return _0x57e79d;};var nda=require(_0xf76f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 00bcaa9..cad51e8 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 _0xcf14=['Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x26f14e,_0x2f5ad0){var _0x31f4b2=function(_0x57d1fe){while(--_0x57d1fe){_0x26f14e['push'](_0x26f14e['shift']());}};_0x31f4b2(++_0x2f5ad0);}(_0xcf14,0xa1));var _0x4cf1=function(_0x5928e,_0x15b268){_0x5928e=_0x5928e-0x0;var _0x11e5cd=_0xcf14[_0x5928e];return _0x11e5cd;};'use strict';var rp=require(_0x4cf1('0x0'));var url=require('url');var logger=require(_0x4cf1('0x1'))(_0x4cf1('0x2'));module['exports']=function(_0x3401df,_0x15f9b9){var _0x46add7={'method':_0x4cf1('0x3'),'uri':url['resolve'](_0x15f9b9[_0x4cf1('0x4')],_0x4cf1('0x5')),'form':{'grant_type':_0x4cf1('0x6'),'username':_0x15f9b9[_0x4cf1('0x7')],'password':_0x15f9b9[_0x4cf1('0x6')]},'json':!![]};return rp(_0x46add7)[_0x4cf1('0x8')](function(_0x9efe60){var _0x50273f={'method':_0x4cf1('0x3'),'uri':url[_0x4cf1('0x9')](_0x15f9b9[_0x4cf1('0xa')],_0x4cf1('0xb')),'body':{'type':_0x15f9b9[_0x4cf1('0xc')]||_0x4cf1('0xd'),'channelId':_0x4cf1('0xe'),'conversation':{'id':_0x3401df[_0x4cf1('0xf')]},'from':{'id':_0x3401df[_0x4cf1('0x10')],'name':_0x3401df[_0x4cf1('0x11')]},'recipient':{'id':_0x3401df[_0x4cf1('0x12')],'name':_0x3401df[_0x4cf1('0x13')]},'text':_0x15f9b9[_0x4cf1('0x14')],'channelData':{}},'headers':{'Authorization':_0x4cf1('0x15')+_0x9efe60['access_token']},'json':!![]};if(_0x15f9b9[_0x4cf1('0x16')]){_0x50273f[_0x4cf1('0x17')][_0x4cf1('0x18')][_0x4cf1('0x19')]=_0x15f9b9[_0x4cf1('0x16')];}if(_0x15f9b9[_0x4cf1('0x1a')]=='1'){_0x50273f[_0x4cf1('0x17')][_0x4cf1('0x18')][_0x4cf1('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4cf1('0x1c')};}if(_0x15f9b9[_0x4cf1('0x1d')]){_0x50273f[_0x4cf1('0x17')][_0x4cf1('0x18')][_0x4cf1('0x1e')]=_0x15f9b9[_0x4cf1('0x1d')];if(_0x15f9b9['custom_action_data']){_0x50273f[_0x4cf1('0x17')]['channelData'][_0x4cf1('0x1f')]=_0x15f9b9[_0x4cf1('0x20')];}}logger[_0x4cf1('0x21')](JSON[_0x4cf1('0x22')](_0x50273f));return rp(_0x50273f);});}; \ No newline at end of file +var _0x131e=['body','AudioOutputSettings','audio/wav','custom_action','CustomActionData','stringify','agi','exports','POST','ndauth_url','/token','password','username','resolve','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','channelData','ProjectName','project','ndagenerate_audio'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x131e,0x1ec));var _0xe131=function(_0x1001cb,_0x3723ff){_0x1001cb=_0x1001cb-0x0;var _0x281685=_0x131e[_0x1001cb];return _0x281685;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0xe131('0x0'));module[_0xe131('0x1')]=function(_0x2615f2,_0x418ed5){var _0x30486b={'method':_0xe131('0x2'),'uri':url['resolve'](_0x418ed5[_0xe131('0x3')],_0xe131('0x4')),'form':{'grant_type':_0xe131('0x5'),'username':_0x418ed5[_0xe131('0x6')],'password':_0x418ed5[_0xe131('0x5')]},'json':!![]};return rp(_0x30486b)['then'](function(_0x5c4eb5){var _0x562617={'method':'POST','uri':url[_0xe131('0x7')](_0x418ed5[_0xe131('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x418ed5[_0xe131('0x9')]||'message','channelId':_0xe131('0xa'),'conversation':{'id':_0x2615f2[_0xe131('0xb')]},'from':{'id':_0x2615f2[_0xe131('0xc')],'name':_0x2615f2[_0xe131('0xd')]},'recipient':{'id':_0x2615f2[_0xe131('0xe')],'name':_0x2615f2[_0xe131('0xf')]},'text':_0x418ed5[_0xe131('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5c4eb5['access_token']},'json':!![]};if(_0x418ed5['project']){_0x562617['body'][_0xe131('0x11')][_0xe131('0x12')]=_0x418ed5[_0xe131('0x13')];}if(_0x418ed5[_0xe131('0x14')]=='1'){_0x562617[_0xe131('0x15')][_0xe131('0x11')][_0xe131('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe131('0x17')};}if(_0x418ed5[_0xe131('0x18')]){_0x562617['body']['channelData']['CustomAction']=_0x418ed5['custom_action'];if(_0x418ed5['custom_action_data']){_0x562617[_0xe131('0x15')][_0xe131('0x11')][_0xe131('0x19')]=_0x418ed5['custom_action_data'];}}logger['info'](JSON[_0xe131('0x1a')](_0x562617));return rp(_0x562617);});}; \ 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 3f0b246..06eb579 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb064=['./lib/api','exports'];(function(_0x14e74f,_0x4ff83e){var _0x318fa6=function(_0x2b7615){while(--_0x2b7615){_0x14e74f['push'](_0x14e74f['shift']());}};_0x318fa6(++_0x4ff83e);}(_0xb064,0x19e));var _0x4b06=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xb064[_0x1caf6a];return _0x1bf493;};'use strict';var asr=require(_0x4b06('0x0'));module[_0x4b06('0x1')]=function(_0x51a420,_0x3a0eb9,_0x51dab3,_0x11a9bb){return asr(_0x51a420,_0x3a0eb9,_0x51dab3,_0x11a9bb);}; \ No newline at end of file +var _0x6fba=['./lib/api','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6fba,0x17c));var _0xa6fb=function(_0x42261d,_0x598eb6){_0x42261d=_0x42261d-0x0;var _0x434c32=_0x6fba[_0x42261d];return _0x434c32;};'use strict';var asr=require(_0xa6fb('0x0'));module[_0xa6fb('0x1')]=function(_0x5f50ab,_0x23fccb,_0x569ded,_0x254e92){return asr(_0x5f50ab,_0x23fccb,_0x569ded,_0x254e92);}; \ 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 2938138..676056a 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 _0xb74f=['agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','info','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash','moment','../../../../../../config/logger'];(function(_0x4ad97d,_0x442617){var _0x1e6c22=function(_0xd152a0){while(--_0xd152a0){_0x4ad97d['push'](_0x4ad97d['shift']());}};_0x1e6c22(++_0x442617);}(_0xb74f,0x1b5));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var _=require(_0xfb74('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfb74('0x1'));var crypto=require('crypto');var logger=require(_0xfb74('0x2'))(_0xfb74('0x3'));module[_0xfb74('0x4')]=function(_0x2bc6bd,_0x262fde,_0x4a97e2,_0x86a170){return new BPromise(function(_0x4921bb,_0x4fb248){logger['info'](_0xfb74('0x5'),_0x86a170||_0xfb74('0x6'));var _0x560938=new WebSocket(_0x86a170||_0xfb74('0x6'),{'perMessageDeflate':![]});var _0x458c53='';var _0x19acb0='0';var _0x1da7bf='1';var _0x1fa77b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3b0664(_0x187fd2){var _0x33341c=crypto[_0xfb74('0x7')](_0xfb74('0x8'));_0x33341c[_0xfb74('0x9')](_0x187fd2);return _0x33341c[_0xfb74('0xa')](_0xfb74('0xb'));}function _0x32c8ff(){try{logger[_0xfb74('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x346b85=moment()[_0xfb74('0xd')]();var _0xfa3514=_0x3b0664(_0x346b85+_0x262fde+_0x4a97e2);_0x560938[_0xfb74('0xe')](JSON[_0xfb74('0xf')]({'appID':_0x262fde,'timestamp':_0x346b85,'appKey':_0xfa3514}));var _0x4f4691=fs[_0xfb74('0x10')](_0x2bc6bd);_0x4f4691['on'](_0xfb74('0x11'),function(_0x29ee21){_0x560938[_0xfb74('0xe')](_0x29ee21);});_0x4f4691['on'](_0xfb74('0x12'),function(){_0x560938['send'](_0xfb74('0x13'));});}catch(_0x480971){logger[_0xfb74('0x14')](_0xfb74('0x15'),JSON[_0xfb74('0xf')](_0x480971));_0x560938[_0xfb74('0x16')]();}}function _0x12bf8d(_0x5142fa){try{if(_0x5142fa){var _0x2d1103=JSON[_0xfb74('0x17')](_0x5142fa);switch(_0x2d1103[_0xfb74('0x18')]){case 0x0:if(_0x2d1103[_0xfb74('0x19')]){if(_0x2d1103[_0xfb74('0x19')][_0xfb74('0x1a')]){logger['info'](_0xfb74('0x1b'),JSON[_0xfb74('0xf')](_0x2d1103['result'][_0xfb74('0x1c')]));_0x458c53=_0x2d1103[_0xfb74('0x19')][_0xfb74('0x1c')][0x0][_0xfb74('0x1d')];_0x19acb0=_0x2d1103[_0xfb74('0x19')][_0xfb74('0x1c')][0x0]['likelihood'];_0x1da7bf='0';_0x1fa77b='Success.';_0x560938['terminate']();}}break;case 0x1:logger[_0xfb74('0xc')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1da7bf='1';_0x1fa77b=_0xfb74('0x1e');break;case 0x2:logger[_0xfb74('0xc')](_0xfb74('0x1f'));_0x1da7bf='2';_0x1fa77b=_0xfb74('0x1f');break;case 0x9:logger[_0xfb74('0xc')](_0xfb74('0x20'));_0x1da7bf='9';_0x1fa77b=_0xfb74('0x20');break;case 0xa:logger[_0xfb74('0xc')]('Authentication\x20failed.');_0x1da7bf='10';_0x1fa77b='Authentication\x20failed.';break;case 0xb:logger[_0xfb74('0xc')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x1da7bf='11';_0x1fa77b=_0xfb74('0x21');}}}catch(_0x1ed81a){logger[_0xfb74('0x14')](_0xfb74('0x22'),JSON[_0xfb74('0xf')](_0x1ed81a));_0x560938[_0xfb74('0x16')]();}}function _0x3d6906(){logger['info'](_0xfb74('0x23'));_0x4921bb({'transcript':_0x458c53,'confidence':_0x19acb0,'status':_0x1da7bf,'status_message':_0x1fa77b});}function _0x3394e8(_0xfb73f1){logger[_0xfb74('0x14')](_0xfb74('0x24'));if(!_['isNil'](_0xfb73f1)){logger[_0xfb74('0x14')](_[_0xfb74('0x25')](_0xfb73f1)?JSON[_0xfb74('0xf')](_0xfb73f1):_0xfb73f1);}}_0x560938['on'](_0xfb74('0x26'),_0x32c8ff);_0x560938['on'](_0xfb74('0x27'),_0x12bf8d);_0x560938['on'](_0xfb74('0x12'),_0x3d6906);_0x560938['on'](_0xfb74('0x14'),_0x3394e8);});}; \ No newline at end of file +var _0xd219=['update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','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'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xd219,0x77));var _0x9d21=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd219[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0x9d21('0x0'));var _=require(_0x9d21('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9d21('0x2'));var crypto=require(_0x9d21('0x3'));var logger=require(_0x9d21('0x4'))(_0x9d21('0x5'));module[_0x9d21('0x6')]=function(_0xe94496,_0x2e8e78,_0x4ba843,_0x4114e1){return new BPromise(function(_0x54bf70,_0x2ebef2){logger[_0x9d21('0x7')](_0x9d21('0x8'),_0x4114e1||_0x9d21('0x9'));var _0x51a61f=new WebSocket(_0x4114e1||_0x9d21('0x9'),{'perMessageDeflate':![]});var _0x5bb34a='';var _0x5c379a='0';var _0x511256='1';var _0xab0d81=_0x9d21('0xa');function _0x2522f3(_0x4e726d){var _0x46f899=crypto[_0x9d21('0xb')](_0x9d21('0xc'));_0x46f899[_0x9d21('0xd')](_0x4e726d);return _0x46f899[_0x9d21('0xe')](_0x9d21('0xf'));}function _0x15721f(){try{logger[_0x9d21('0x7')](_0x9d21('0x10'));var _0x3ec3b0=moment()[_0x9d21('0x11')]();var _0x5217eb=_0x2522f3(_0x3ec3b0+_0x2e8e78+_0x4ba843);_0x51a61f[_0x9d21('0x12')](JSON[_0x9d21('0x13')]({'appID':_0x2e8e78,'timestamp':_0x3ec3b0,'appKey':_0x5217eb}));var _0x54ca8f=fs[_0x9d21('0x14')](_0xe94496);_0x54ca8f['on'](_0x9d21('0x15'),function(_0x157b92){_0x51a61f[_0x9d21('0x12')](_0x157b92);});_0x54ca8f['on'](_0x9d21('0x16'),function(){_0x51a61f[_0x9d21('0x12')](_0x9d21('0x17'));});}catch(_0x35eb37){logger['error'](_0x9d21('0x18'),JSON[_0x9d21('0x13')](_0x35eb37));_0x51a61f[_0x9d21('0x19')]();}}function _0x3c154e(_0x30c6c9){try{if(_0x30c6c9){var _0x456bec=JSON['parse'](_0x30c6c9);switch(_0x456bec['status']){case 0x0:if(_0x456bec[_0x9d21('0x1a')]){if(_0x456bec[_0x9d21('0x1a')][_0x9d21('0x1b')]){logger[_0x9d21('0x7')](_0x9d21('0x1c'),JSON[_0x9d21('0x13')](_0x456bec[_0x9d21('0x1a')]['hypotheses']));_0x5bb34a=_0x456bec[_0x9d21('0x1a')][_0x9d21('0x1d')][0x0][_0x9d21('0x1e')];_0x5c379a=_0x456bec[_0x9d21('0x1a')][_0x9d21('0x1d')][0x0][_0x9d21('0x1f')];_0x511256='0';_0xab0d81=_0x9d21('0x20');_0x51a61f[_0x9d21('0x19')]();}}break;case 0x1:logger[_0x9d21('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x511256='1';_0xab0d81='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x9d21('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x511256='2';_0xab0d81=_0x9d21('0x21');break;case 0x9:logger['info'](_0x9d21('0x22'));_0x511256='9';_0xab0d81=_0x9d21('0x22');break;case 0xa:logger[_0x9d21('0x7')](_0x9d21('0x23'));_0x511256='10';_0xab0d81=_0x9d21('0x23');break;case 0xb:logger[_0x9d21('0x7')](_0x9d21('0x24'));_0x511256='11';_0xab0d81='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x372c45){logger[_0x9d21('0x25')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9d21('0x13')](_0x372c45));_0x51a61f[_0x9d21('0x19')]();}}function _0x5cfcbf(){logger[_0x9d21('0x7')](_0x9d21('0x26'));_0x54bf70({'transcript':_0x5bb34a,'confidence':_0x5c379a,'status':_0x511256,'status_message':_0xab0d81});}function _0x24e595(_0x27ad61){logger[_0x9d21('0x25')](_0x9d21('0x27'));if(!_[_0x9d21('0x28')](_0x27ad61)){logger[_0x9d21('0x25')](_[_0x9d21('0x29')](_0x27ad61)?JSON[_0x9d21('0x13')](_0x27ad61):_0x27ad61);}}_0x51a61f['on'](_0x9d21('0x2a'),_0x15721f);_0x51a61f['on'](_0x9d21('0x2b'),_0x3c154e);_0x51a61f['on']('close',_0x5cfcbf);_0x51a61f['on'](_0x9d21('0x25'),_0x24e595);});}; \ 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 10cb4be..ac6c10f 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xfcae=['./asr','exports'];(function(_0x4ef4c2,_0x4b6a68){var _0x2c569d=function(_0x56c91c){while(--_0x56c91c){_0x4ef4c2['push'](_0x4ef4c2['shift']());}};_0x2c569d(++_0x4b6a68);}(_0xfcae,0x16a));var _0xefca=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xfcae[_0x13d07a];return _0x5ee0ee;};var asr=require(_0xefca('0x0'));module[_0xefca('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index eff2afb..9e0c596 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 _0xd8b0=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection'];(function(_0x2b6618,_0x506202){var _0x139943=function(_0x411128){while(--_0x411128){_0x2b6618['push'](_0x2b6618['shift']());}};_0x139943(++_0x506202);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0d8b('0x0'));var net=require(_0x0d8b('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0d8b('0x2'));var AGIServer=function(_0x5b9b89,_0x43bca1,_0x364286){var _0x8196ed=this;var _0x577834=null;var _0x5e15e6=0x0;if(!_0x5b9b89)_0x5b9b89=0x11dd;if(!_0x43bca1)_0x43bca1=_0x0d8b('0x3');EventEmitter[_0x0d8b('0x4')](_0x8196ed);function _0x39f43a(){if(!_0x5b9b89){_0x8196ed['emit'](_0x0d8b('0x5'),new AGIError(_0x0d8b('0x6')));return![];}_0x577834=net['createServer']();_0x577834[_0x0d8b('0x7')](_0x5b9b89,_0x43bca1);_0x577834['on'](_0x0d8b('0x8'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x8'));});_0x577834['on'](_0x0d8b('0xa'),function(_0x1cac62){_0x577834[_0x0d8b('0xb')](function(_0x28f87c,_0x48fa16){if(_0x28f87c){_0x8196ed[_0x0d8b('0x9')]('error',new AGIError(_0x0d8b('0xc'),_0x28f87c));}else if(_0x364286&&_0x364286<0x0){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xd')));_0x1cac62[_0x0d8b('0xe')]();}else if(_0x364286&&_0x364286>0x0&&_0x364286<_0x48fa16){_0x5e15e6+=0x1;_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xf'),_0x5e15e6));_0x1cac62[_0x0d8b('0xe')]();}else{var _0x2ce75e=new AGIChannel(_0x1cac62);_0x2ce75e['on'](_0x0d8b('0x10'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x2ce75e);});}});});_0x577834['on'](_0x0d8b('0x5'),function(_0x4f6f21){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xc'),_0x4f6f21[_0x0d8b('0x11')]));});_0x577834['on'](_0x0d8b('0x12'),function(){_0x8196ed['emit'](_0x0d8b('0x12'),new AGIError(_0x0d8b('0x13')));});}process[_0x0d8b('0x14')](function(){_0x39f43a();});};util[_0x0d8b('0x15')](AGIServer,EventEmitter);module[_0x0d8b('0x16')]=function(_0x18dd2d,_0x264b39,_0xa3612a){return new AGIServer(_0x18dd2d,_0x264b39,_0xa3612a);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index dac3e19..2a3755a 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 _0xec39=['getSmsAccount','getSmsAccountById','createSmsMessage','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPause','agentPause','agent','uniqueid','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','includes','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','getVariable','toString','getAndSetVariable','sync','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','query:\x20%s','getQueryOdbc','createSquareDetailsReport','variable_id','forEach','%s[%s][%s]','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','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','getData','response','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','extra','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','math\x20%s','operation','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','agentUnpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','open','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'];(function(_0xd4f90b,_0x148333){var _0x451848=function(_0x12c95c){while(--_0x12c95c){_0xd4f90b['push'](_0xd4f90b['shift']());}};_0x451848(++_0x148333);}(_0xec39,0x19f));var _0x9ec3=function(_0xd9295b,_0x121f60){_0xd9295b=_0xd9295b-0x0;var _0x53d62e=_0xec39[_0xd9295b];return _0x53d62e;};'use strict';var fs=require('fs');var util=require(_0x9ec3('0x0'));var _=require(_0x9ec3('0x1'));var sh=require(_0x9ec3('0x2'));var odbc=require(_0x9ec3('0x3'))();var rs=require(_0x9ec3('0x4'));var moment=require(_0x9ec3('0x5'));var Mustache=require(_0x9ec3('0x6'));var rp=require('request-promise');var logger=require(_0x9ec3('0x7'))(_0x9ec3('0x8'));var config=require(_0x9ec3('0x9'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x9ec3('0xa')];var verticesWithRetry=[_0x9ec3('0xb'),_0x9ec3('0xc'),'getsecretdigits'];var AGIVertices=function(_0x570a91,_0xb10fef,_0x2e49f3){this[_0x9ec3('0xd')]=_0x570a91;this[_0x9ec3('0xe')]=_0xb10fef;this[_0x9ec3('0xf')]=_0x2e49f3;};AGIVertices[_0x9ec3('0x10')]['getVariable']=function(_0x1a0555,_0xaa1307){this[_0x9ec3('0xe')][_0x9ec3('0x11')](_0x1a0555)[_0x9ec3('0x12')](function(_0x18ef85){_0xaa1307(null,_0x18ef85?_0x18ef85[_0x9ec3('0x13')]:![]);})['catch'](function(_0x2790dc){_0xaa1307(_0x2790dc);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x14')]=function(_0x4bb1b3,_0x2b9f69){this['rpc'][_0x9ec3('0x15')](_0x4bb1b3)[_0x9ec3('0x12')](function(_0xcbb897){_0x2b9f69(null,_0xcbb897?_0xcbb897[_0x9ec3('0x13')]:![]);})[_0x9ec3('0x16')](function(_0x2c0ad5){_0x2b9f69(_0x2c0ad5);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x17')]=function(_0x453010,_0x58dd6f){this[_0x9ec3('0xe')]['getSquareProjectById'](_0x453010)['then'](function(_0x2ae9bd){_0x58dd6f(null,_0x2ae9bd?_0x2ae9bd[_0x9ec3('0x13')]:![]);})[_0x9ec3('0x16')](function(_0xa3bade){_0x58dd6f(_0xa3bade);});};AGIVertices[_0x9ec3('0x10')]['getSquareOdbc']=function(_0x16e34d,_0x4a413c){this[_0x9ec3('0xe')]['getSquareOdbcById'](_0x16e34d)[_0x9ec3('0x12')](function(_0x28e31f){_0x4a413c(null,_0x28e31f?_0x28e31f[_0x9ec3('0x18')]:![]);})['catch'](function(_0x70227a){_0x4a413c(_0x70227a);});};AGIVertices['prototype'][_0x9ec3('0x19')]=function(_0x4a8c62,_0xcb54c){this[_0x9ec3('0xe')][_0x9ec3('0x1a')](_0x4a8c62)[_0x9ec3('0x12')](function(_0x36f64c){_0xcb54c(null,_0x36f64c?_0x36f64c[_0x9ec3('0x13')]:![]);})[_0x9ec3('0x16')](function(_0x5efa81){_0xcb54c(_0x5efa81);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1b')]=function(_0x484891,_0x3b11db){this[_0x9ec3('0xe')][_0x9ec3('0x1c')](_0x484891)[_0x9ec3('0x12')](function(_0x4782c9){_0x3b11db(null,_0x4782c9?_0x4782c9[_0x9ec3('0x13')]:![]);})[_0x9ec3('0x16')](function(_0xb99216){_0x3b11db(_0xb99216);});};AGIVertices['prototype'][_0x9ec3('0x1d')]=function(_0x2c9e39,_0x30abfb){var _0x1fd911=this;this['rpc'][_0x9ec3('0x1e')](_0x2c9e39)[_0x9ec3('0x12')](function(_0x141149){_0x30abfb(null,_0x141149?_0x1fd911[_0x9ec3('0x1f')](_0x141149[_0x9ec3('0x20')]):![]);})[_0x9ec3('0x16')](function(_0x3d67be){_0x30abfb(_0x3d67be);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x21')]=function(_0x15a602,_0xe21f81){this[_0x9ec3('0xe')][_0x9ec3('0x22')](_0x15a602)[_0x9ec3('0x12')](function(_0x2b7113){_0xe21f81(null,_0x2b7113?_0x2b7113:![]);})[_0x9ec3('0x16')](function(_0x2f4224){_0xe21f81(_0x2f4224);});};AGIVertices['prototype']['sendMailMessage']=function(_0x4c50fd,_0x1e86a7,_0x3c18a7){this[_0x9ec3('0xf')][_0x9ec3('0x23')](_0x4c50fd,_0x1e86a7)[_0x9ec3('0x12')](function(){_0x3c18a7(null);})[_0x9ec3('0x16')](function(_0x2891fc){_0x3c18a7(_0x2891fc);});};AGIVertices['prototype'][_0x9ec3('0x24')]=function(_0x22910c,_0x1f8962){this['rpc'][_0x9ec3('0x25')](_0x22910c)[_0x9ec3('0x12')](function(_0x5bb3db){if(_0x5bb3db){if(_0x5bb3db[_0x9ec3('0x26')]){_0x1f8962(null,[_0x5bb3db[_0x9ec3('0x27')]]);}else{_0x1f8962(null,_[_0x9ec3('0x28')](_0x5bb3db[_0x9ec3('0x29')],_0x9ec3('0x27')));}}else{_0x1f8962(null,![]);}})[_0x9ec3('0x16')](function(_0x29103d){_0x1f8962(_0x29103d);});};AGIVertices['prototype'][_0x9ec3('0x1f')]=function(_0x32581e){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x32581e);};AGIVertices[_0x9ec3('0x10')]['getQueryOdbc']=function(_0x338298,_0x1bd8a0,_0x1b9704){odbc[_0x9ec3('0x2a')](_0x338298,function(_0x57e954){if(_0x57e954){logger[_0x9ec3('0x2b')](_0x9ec3('0x2c'),_0x57e954);_0x1b9704(_0x57e954);}else{logger[_0x9ec3('0x2d')](_0x9ec3('0x2e'));odbc[_0x9ec3('0x2f')](_0x1bd8a0,function(_0x149bf1,_0x51a6ad){if(_0x149bf1){logger['info']('Error\x20executing\x20query\x20%s',_0x1bd8a0);_0x1b9704(_0x149bf1);}else{logger[_0x9ec3('0x2d')](_0x9ec3('0x30'),_0x1bd8a0);odbc[_0x9ec3('0x31')](function(_0x2ab229){if(_0x2ab229){logger[_0x9ec3('0x2b')](_0x9ec3('0x32'),_0x2ab229);}_0x1b9704(null,_0x51a6ad);});}});}});};AGIVertices['prototype'][_0x9ec3('0x33')]=function(_0x4241b1,_0x58ed33){this[_0x9ec3('0xe')][_0x9ec3('0x34')](_0x4241b1)[_0x9ec3('0x12')](function(_0x2bafea){_0x58ed33(null,_0x2bafea?_0x2bafea:![]);})['catch'](function(_0xc41a94){_0x58ed33(_0xc41a94);});};AGIVertices['prototype'][_0x9ec3('0x35')]=function(_0x3f6cbe,_0x3d16ce){this[_0x9ec3('0xe')][_0x9ec3('0x35')](_0x3f6cbe)['then'](function(_0x5ef1dc){_0x3d16ce(null,_0x5ef1dc);})[_0x9ec3('0x16')](function(_0x512e5c){_0x3d16ce(_0x512e5c);});};AGIVertices[_0x9ec3('0x10')]['createSquareDetailsReport']=function(_0x3d54e4,_0x4e279c,_0x14b1f1){this[_0x9ec3('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x9ec3('0xd')]['uniqueid'],'node':_0x3d54e4[_0x9ec3('0x36')],'application':_0x3d54e4[_0x9ec3('0x37')],'data':_0x4e279c||null,'project_name':this['channel'][_0x9ec3('0x38')],'callerid':this[_0x9ec3('0xd')][_0x9ec3('0x39')]})['then'](function(_0x42347e){if(_0x14b1f1){_0x14b1f1(null,_0x42347e);}})[_0x9ec3('0x16')](function(_0x551be3){if(_0x14b1f1){_0x14b1f1(_0x551be3);}});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x3a')]=function(_0x341b8d,_0xc0900b,_0x46ad5f,_0xd2b4a7){this[_0x9ec3('0xe')][_0x9ec3('0x3a')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x9ec3('0xd')][_0x9ec3('0x39')],'calleridname':this['channel'][_0x9ec3('0x3b')],'context':this[_0x9ec3('0xd')]['context'],'extension':this[_0x9ec3('0xd')][_0x9ec3('0x3c')],'priority':this[_0x9ec3('0xd')][_0x9ec3('0x3d')],'accountcode':this[_0x9ec3('0xd')][_0x9ec3('0x3e')],'dnid':this[_0x9ec3('0xd')][_0x9ec3('0x3f')],'projectName':this[_0x9ec3('0xd')][_0x9ec3('0x38')],'saveName':_0xc0900b,'filename':_0x341b8d[_0x9ec3('0x40')]||_0xc0900b,'savePath':_0x46ad5f})[_0x9ec3('0x12')](function(_0x284088){_0xd2b4a7(null,_0x284088);})['catch'](function(_0x60ac46){_0xd2b4a7(_0x60ac46);});};AGIVertices['prototype'][_0x9ec3('0x41')]=function(_0x1e7766,_0x7713b5,_0x58c812,_0x55c7e2,_0x53bb29){this[_0x9ec3('0xe')][_0x9ec3('0x41')]({'uniqueid':this[_0x9ec3('0xd')]['uniqueid'],'body':_0x1e7766,'direction':_0x7713b5,'providerName':_0x58c812,'providerResponse':_0x55c7e2})['then'](function(_0x5d48d1){if(_0x53bb29){_0x53bb29(null,_0x5d48d1);}})[_0x9ec3('0x16')](function(_0x25333a){if(_0x53bb29){_0x53bb29(_0x25333a);}});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x42')]=function(_0x3c837b,_0x38e099){this['rpc'][_0x9ec3('0x42')]({'firstName':_[_0x9ec3('0x43')](_0x3c837b[_0x9ec3('0x13')])||_[_0x9ec3('0x44')](_0x3c837b[_0x9ec3('0x13')])?_0x9ec3('0x45')+Math[_0x9ec3('0x46')]():_0x3c837b[_0x9ec3('0x13')],'lastName':_[_0x9ec3('0x43')](_0x3c837b[_0x9ec3('0x47')])||_[_0x9ec3('0x44')](_0x3c837b['lastName'])?null:_0x3c837b['lastName'],'phone':_0x3c837b[_0x9ec3('0x48')],'ListId':_0x3c837b[_0x9ec3('0x49')],'scheduledat':_0x3c837b['scheduledAt'],'callbackUniqueid':this[_0x9ec3('0xd')]['uniqueid'],'tags':'callback','description':_0x9ec3('0x4a')+_0x3c837b[_0x9ec3('0x4b')]['toString'](),'priority':_0x3c837b[_0x9ec3('0x4c')]})[_0x9ec3('0x12')](function(_0x13e9f1){_0x38e099(null,_0x13e9f1);})[_0x9ec3('0x16')](function(_0x38f161){_0x38e099(_0x38f161);});};AGIVertices['prototype'][_0x9ec3('0x4d')]=function(_0xa3153a,_0x5a8b24){this[_0x9ec3('0xe')]['getPauseById'](_0xa3153a)[_0x9ec3('0x12')](function(_0x1d7b7d){_0x5a8b24(null,_0x1d7b7d?_0x1d7b7d[_0x9ec3('0x13')]:![]);})[_0x9ec3('0x16')](function(_0x18813b){_0x5a8b24(_0x18813b);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x4e')]=function(_0x4d30aa,_0x5baa8c,_0x508c7f){var _0x41bbd7={'role':_0x9ec3('0x4f')};_0x41bbd7[_0x4d30aa]=this[_0x9ec3('0xd')][_0x9ec3('0x39')];this[_0x9ec3('0xe')][_0x9ec3('0x4e')](_0x41bbd7,_0x5baa8c,this[_0x9ec3('0xd')][_0x9ec3('0x50')])[_0x9ec3('0x12')](function(_0x1d41ff){_0x508c7f(null,_[_0x9ec3('0x44')](_0x1d41ff)?![]:!![]);})[_0x9ec3('0x16')](function(_0x1ac7ba){logger[_0x9ec3('0x2b')](_0x1ac7ba);_0x508c7f(null,![]);});};AGIVertices[_0x9ec3('0x10')]['agentUnpause']=function(_0x54fa71,_0x4f96d3){var _0xe85f62={'role':_0x9ec3('0x4f')};_0xe85f62[_0x54fa71]=this[_0x9ec3('0xd')][_0x9ec3('0x39')];this[_0x9ec3('0xe')]['agentUnpause'](_0xe85f62)[_0x9ec3('0x12')](function(_0x4842e0){_0x4f96d3(null,_[_0x9ec3('0x44')](_0x4842e0)?![]:!![]);})[_0x9ec3('0x16')](function(_0x1d0b50){logger[_0x9ec3('0x2b')](_0x1d0b50);_0x4f96d3(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x2cf716,_0x5e04f9){var _0x30dc77={'role':_0x9ec3('0x4f')};_0x30dc77[_0x2cf716]=this['channel'][_0x9ec3('0x39')];this['rpc'][_0x9ec3('0x51')](_0x30dc77)[_0x9ec3('0x12')](function(_0x401d93){_0x5e04f9(null,_[_0x9ec3('0x44')](_0x401d93)?![]:!![]);})[_0x9ec3('0x16')](function(_0x56f621){logger['error'](_0x56f621);_0x5e04f9(null,![]);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x52')]=function(_0x333e11,_0x3428d8){var _0x53c877={'role':'agent'};_0x53c877[_0x333e11]=this[_0x9ec3('0xd')][_0x9ec3('0x39')];var _0x16deb9=_0x333e11!=_0x9ec3('0x53')?util[_0x9ec3('0x54')](_0x9ec3('0x55'),_0x9ec3('0x56'),this['channel'][_0x9ec3('0x39')]):undefined;this[_0x9ec3('0xe')]['agentLogin'](_0x53c877,_0x16deb9)[_0x9ec3('0x12')](function(_0x4a1bd7){_0x3428d8(null,_[_0x9ec3('0x44')](_0x4a1bd7)?![]:!![]);})['catch'](function(_0x38506d){logger[_0x9ec3('0x2b')](_0x38506d);_0x3428d8(null,![]);});};AGIVertices[_0x9ec3('0x10')]['shellCommand']=function(_0x4e9f91,_0x379841){sh[_0x9ec3('0x57')](_['trim'](_0x4e9f91),function(_0x2fed2b,_0x299d23){var _0x3f3e2b=_0x299d23[_0x9ec3('0x58')](/(\r\n|\n|\r)/gm,'');_0x379841(null,_0x3f3e2b);});};AGIVertices[_0x9ec3('0x10')]['googleCloudTTS']=function(_0x2bcc6e,_0x27d979){scripts[_0x9ec3('0x59')](_0x2bcc6e[_0x9ec3('0x5a')],_0x2bcc6e[_0x9ec3('0x5b')]||_0x9ec3('0x5c'),_0x2bcc6e[_0x9ec3('0x5c')],_0x2bcc6e[_0x9ec3('0x5d')]||_0x9ec3('0x5e'),_0x2bcc6e[_0x9ec3('0x5f')]||_0x9ec3('0x60'),_0x2bcc6e[_0x9ec3('0x61')]||'MP3')[_0x9ec3('0x12')](function(_0x1d6a70){_0x27d979(null,_0x1d6a70);})['catch'](function(_0x2cc923){_0x27d979(_0x2cc923);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x62')]=function(_0x3d4f76,_0x253876){scripts[_0x9ec3('0x62')](_0x3d4f76[_0x9ec3('0x5c')],_0x3d4f76[_0x9ec3('0x63')]||'en',0x1)[_0x9ec3('0x12')](function(_0x5a147a){_0x253876(null,_0x5a147a);})[_0x9ec3('0x16')](function(_0x5261d0){_0x253876(_0x5261d0);});};AGIVertices['prototype']['restAPI']=function(_0xe1b497,_0x2edfe5){var _0x4881ff={'uri':_0xe1b497[_0x9ec3('0x64')],'method':_0xe1b497[_0x9ec3('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xe1b497[_0x9ec3('0x66')])===_0x9ec3('0x67')&&parseInt(_0xe1b497[_0x9ec3('0x66')])>=0x1?parseInt(_0xe1b497[_0x9ec3('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x9ec3('0x68')](['POST',_0x9ec3('0x69')],_0x4881ff[_0x9ec3('0x65')][_0x9ec3('0x6a')]())){try{_0x4881ff['body']=_0xe1b497[_0x9ec3('0xa')]?JSON[_0x9ec3('0x6b')](_0xe1b497[_0x9ec3('0xa')]):{};}catch(_0x15b7ec){logger[_0x9ec3('0x2b')](_0x9ec3('0x6c'),_0x15b7ec);}}try{_0x4881ff[_0x9ec3('0x6d')]=_0xe1b497[_0x9ec3('0x6e')]?JSON[_0x9ec3('0x6b')](_0xe1b497[_0x9ec3('0x6e')]):{};}catch(_0x3e0c77){logger[_0x9ec3('0x2b')](_0x9ec3('0x6f'),_0x3e0c77);}if(_0xe1b497[_0x9ec3('0x70')]){try{var _0xd43828=require(_0xe1b497[_0x9ec3('0x70')])['sync'](this,_0x4881ff);_0x4881ff[_0x9ec3('0x71')]=Mustache[_0x9ec3('0x72')](_0xe1b497[_0x9ec3('0x64')],_0xd43828,{},['$$','$$']);if(_0x4881ff[_0x9ec3('0x6d')]){_0x4881ff[_0x9ec3('0x6d')]=JSON[_0x9ec3('0x6b')](Mustache[_0x9ec3('0x72')](JSON[_0x9ec3('0x73')](_0x4881ff[_0x9ec3('0x6d')]),_0xd43828,{},['$$','$$']));}if(_0x4881ff['body']){_0x4881ff['body']=JSON[_0x9ec3('0x6b')](Mustache[_0x9ec3('0x72')](JSON[_0x9ec3('0x73')](_0x4881ff[_0x9ec3('0x74')]),_0xd43828,{},['$$','$$']));}}catch(_0x274845){logger[_0x9ec3('0x2b')](_0x9ec3('0x75'),_0x274845);}}rp(_0x4881ff)[_0x9ec3('0x12')](function(_0x2ec1a4){var _0x39bfdd={'statusCode':_0x2ec1a4[_0x9ec3('0x76')]||0xc8,'statusMessage':_0x2ec1a4['statusMessage']||'OK','headers':_0x2ec1a4['headers']||{},'body':_0x2ec1a4[_0x9ec3('0x74')]||{}};_0x2edfe5(null,_0x39bfdd);})['catch'](function(_0x15bc09){var _0x5cdec1={'statusCode':_0x15bc09[_0x9ec3('0x76')]||0x1f4,'statusMessage':_0x15bc09[_0x9ec3('0x77')]||_0x9ec3('0x78'),'headers':_0x15bc09['options'][_0x9ec3('0x6d')]||{},'body':_0x15bc09[_0x9ec3('0x79')][_0x9ec3('0x74')]||{}};_0x2edfe5(null,_0x5cdec1);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x7a')]=function(_0x2f0b22,_0x54258d){scripts[_0x9ec3('0x7a')](this['channel'][_0x9ec3('0x50')],_0x2f0b22[_0x9ec3('0x7b')],_0x2f0b22['text'],_0x2f0b22[_0x9ec3('0x7c')]||'en')['then'](function(_0x30e0cd){_0x54258d(null,_0x30e0cd);})[_0x9ec3('0x16')](function(_0x5df3a4){_0x54258d(_0x5df3a4);});};AGIVertices['prototype'][_0x9ec3('0x7d')]=function(_0xc2ba5b,_0x40cb7f){scripts[_0x9ec3('0x7d')](this[_0x9ec3('0xd')][_0x9ec3('0x50')],_0xc2ba5b[_0x9ec3('0x7e')],_0xc2ba5b[_0x9ec3('0x7f')],_0xc2ba5b['private_key'],_0xc2ba5b[_0x9ec3('0x5c')],_0xc2ba5b[_0x9ec3('0x80')]||'en')['then'](function(_0x1a760f){_0x40cb7f(null,_0x1a760f);})[_0x9ec3('0x16')](function(_0x4f2584){_0x40cb7f(_0x4f2584);});};AGIVertices[_0x9ec3('0x10')]['sestekNDA']=function(_0x839158,_0x5f2bcf){scripts['sestekNDA'](this[_0x9ec3('0xd')],_0x839158)[_0x9ec3('0x12')](function(_0x39339e){_0x5f2bcf(null,_0x39339e);})[_0x9ec3('0x16')](function(_0x586cc5){_0x5f2bcf(_0x586cc5);});};AGIVertices['prototype'][_0x9ec3('0x81')]=function(_0x56feee,_0x4485de){scripts[_0x9ec3('0x81')](_0x56feee['key'],_0x56feee['text'],_0x56feee[_0x9ec3('0x82')]||_0x9ec3('0x5e'),_0x56feee[_0x9ec3('0x83')])[_0x9ec3('0x12')](function(_0x3ceb8d){_0x4485de(null,_0x3ceb8d);})['catch'](function(_0x472e62){_0x4485de(_0x472e62);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x84')]=function(_0x3cb91d,_0x5cc4ee,_0x540df8){scripts[_0x9ec3('0x84')](_0x5cc4ee,_0x3cb91d[_0x9ec3('0x7b')],_0x3cb91d[_0x9ec3('0x85')]||_0x9ec3('0x5e'),this[_0x9ec3('0x86')](_0x3cb91d[_0x9ec3('0x87')])?_0x3cb91d['model']:undefined)[_0x9ec3('0x12')](function(_0x55c74e){_0x540df8(null,_0x55c74e);})[_0x9ec3('0x16')](function(_0x4216c8){_0x540df8(_0x4216c8);});};AGIVertices['prototype'][_0x9ec3('0x88')]=function(_0x1d36a7,_0x4fadc3){scripts[_0x9ec3('0x88')](_0x1d36a7[_0x9ec3('0x89')],_0x1d36a7['aws_secret_access_key'],_0x1d36a7['aws_polly_region'],_0x1d36a7[_0x9ec3('0x8a')]||_0x9ec3('0x8b'),_0x1d36a7[_0x9ec3('0x5c')],_0x1d36a7[_0x9ec3('0x8c')]||'text')[_0x9ec3('0x12')](function(_0x48c901){_0x4fadc3(null,_0x48c901);})[_0x9ec3('0x16')](function(_0x20bde9){_0x4fadc3(_0x20bde9);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x8d')]=function(_0x59b75e,_0x1f4137){scripts['awsLex'](this[_0x9ec3('0xd')]['uniqueid'],_0x59b75e[_0x9ec3('0x89')],_0x59b75e[_0x9ec3('0x8e')],_0x59b75e[_0x9ec3('0x8f')],_0x59b75e['text'],_0x59b75e[_0x9ec3('0x90')])['then'](function(_0x4b9178){_0x1f4137(null,_0x4b9178);})[_0x9ec3('0x16')](function(_0xd8dca8){_0x1f4137(_0xd8dca8);});};AGIVertices['prototype'][_0x9ec3('0x91')]=function(_0x491c73,_0x1608b7,_0x122853){scripts[_0x9ec3('0x91')](_0x1608b7,_0x491c73[_0x9ec3('0x7b')],_0x491c73[_0x9ec3('0x92')]||_0x9ec3('0x5e'))[_0x9ec3('0x12')](function(_0x39a344){_0x122853(null,_0x39a344);})[_0x9ec3('0x16')](function(_0x3386a6){_0x122853(_0x3386a6);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x93')]=function(_0x5ab726,_0x3e7b12,_0xde6002){scripts[_0x9ec3('0x93')](_0x3e7b12,_0x5ab726['appid'],_0x5ab726[_0x9ec3('0x94')],_0x5ab726['uri'])['then'](function(_0x5c47a0){_0xde6002(null,_0x5c47a0);})['catch'](function(_0x4571b6){_0xde6002(_0x4571b6);});};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x95')]=function(_0x1abda8){var _0x41f8e5=_[_0x9ec3('0x68')](verticesWithRetry,_0x1abda8['agicommand'])?_0x1abda8:_[_0x9ec3('0x96')](_0x1abda8);for(var _0x1b31d0 in _0x41f8e5){if(_0x41f8e5[_0x9ec3('0x97')](_0x1b31d0)){if(_0x41f8e5[_0x1b31d0]&&_[_0x9ec3('0x98')](_0x41f8e5[_0x1b31d0])){if(_[_0x9ec3('0x68')](recursiveMapAttributes,_0x1b31d0)){_0x41f8e5[_0x1b31d0]=this[_0x9ec3('0x99')](_0x41f8e5[_0x1b31d0]);}else{_0x41f8e5[_0x1b31d0]=this['replaceAllVariables'](_0x41f8e5[_0x1b31d0]);}}}}return _0x41f8e5;};AGIVertices['prototype'][_0x9ec3('0x9a')]=function(_0x2a3493){for(var _0x4ce718 in _0x2a3493){if(_0x2a3493[_0x9ec3('0x97')](_0x4ce718)){if(_[_0x9ec3('0x9b')](_0x2a3493[_0x4ce718])){this[_0x9ec3('0x9a')](_0x2a3493[_0x4ce718]);}else if(_[_0x9ec3('0x9c')](_0x2a3493[_0x4ce718])){for(var _0x311661=0x0;_0x311661<_0x2a3493[_0x4ce718][_0x9ec3('0x9d')];_0x311661++){this[_0x9ec3('0x9a')](_0x2a3493[_0x4ce718][_0x311661]);}}else if(_[_0x9ec3('0x98')](_0x2a3493[_0x4ce718])){_0x2a3493[_0x4ce718]=this['replaceAllVariables'](_0x2a3493[_0x4ce718]);}}}};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x9e')]=function(_0x129ffe,_0x2afa71){for(var _0x465fce in _0x129ffe){if(_0x129ffe[_0x9ec3('0x97')](_0x465fce)){if(_[_0x9ec3('0x9b')](_0x129ffe[_0x465fce])){if(!_[_0x9ec3('0x43')](_0x129ffe[_0x465fce])){this[_0x9ec3('0x9e')](_0x129ffe[_0x465fce],util[_0x9ec3('0x54')]('%s.%s',_0x2afa71,_0x465fce));}}else if(_[_0x9ec3('0x9c')](_0x129ffe[_0x465fce])){for(var _0x21da07=0x0;_0x21da07<_0x129ffe[_0x465fce][_0x9ec3('0x9d')];_0x21da07++){this[_0x9ec3('0x9e')](_0x129ffe[_0x465fce][_0x21da07],util[_0x9ec3('0x54')](_0x9ec3('0x9f'),_0x2afa71,_0x465fce+'['+_0x21da07+']'));}}else{if(!_[_0x9ec3('0x44')](_0x129ffe[_0x465fce])){this['channel'][_0x9ec3('0xa0')](util[_0x9ec3('0x54')](_0x9ec3('0x9f'),_0x2afa71,_0x465fce),_0x129ffe[_0x465fce]);}}}}};AGIVertices['prototype'][_0x9ec3('0x99')]=function(_0x240a88){try{var _0x4ddd4f=JSON[_0x9ec3('0x6b')](_0x240a88);this[_0x9ec3('0x9a')](_0x4ddd4f);return JSON[_0x9ec3('0x73')](_0x4ddd4f);}catch(_0x29e21a){return this['replaceAllVariables'](_0x240a88);}};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xa1')]=function(_0x537330){var _0x1900a6=_0x537330[_0x9ec3('0xa2')]('{');for(var _0x1a0575=0x1;_0x1a0575<_0x1900a6[_0x9ec3('0x9d')];_0x1a0575+=0x1){var _0x266d3c=_0x1900a6[_0x1a0575]['split']('}');if(_0x266d3c[_0x9ec3('0x9d')]>0x1){_0x537330=_0x537330[_0x9ec3('0xa3')]('{'+_0x266d3c[0x0]+'}',this[_0x9ec3('0xd')][_0x9ec3('0xa4')](_0x266d3c[0x0])['extra']||_0x266d3c[0x0]);}}if(_0x1900a6[_0x9ec3('0x9d')]===0x1){return _0x537330[_0x9ec3('0xa5')]();}return this[_0x9ec3('0xa1')](_0x537330);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xa6')]=function(_0x4c7054,_0x3eec3e){var _0x50980d=this[_0x9ec3('0xd')][_0x9ec3('0xa4')](_0x4c7054);if(_0x50980d['result']===-0x1){return _0x50980d;}logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3eec3e,_0x50980d['extra']));return this[_0x9ec3('0xd')][_0x9ec3('0xa0')](_0x3eec3e,_0x50980d['extra']);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x86')]=function(_0x16bdf1){return _0x16bdf1&&_0x16bdf1!=='0'&&_0x16bdf1!=='-1'&&_0x16bdf1!=='';};AGIVertices[_0x9ec3('0x10')]['maxRetry']=function(_0x158a3a){this['createSquareDetailsReport'][_0x9ec3('0xa7')](this,_0x158a3a,'-');_0x158a3a[_0x9ec3('0xa8')]=_0x158a3a[_0x9ec3('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9ec3('0x10')]['mrcpsynth']=function(_0x12ccca){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xaa'),_0x12ccca[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x12ccca[_0x9ec3('0x5c')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}var _0x2ab6b1='\x22'+_0x12ccca[_0x9ec3('0x5c')]+'\x22';if(this[_0x9ec3('0x86')](_0x12ccca[_0x9ec3('0x79')])){_0x2ab6b1+=','+_0x12ccca[_0x9ec3('0x79')];}var _0x1fc8e5=this['channel'][_0x9ec3('0x57')](_0x9ec3('0xad'),_0x2ab6b1);if(_0x1fc8e5[_0x9ec3('0xae')]===-0x1){return _0x1fc8e5;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util['format'](_0x9ec3('0xaf'),_0x2ab6b1));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xb0')]=function(_0x226558){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xb1'),_0x226558['label']));if(!this[_0x9ec3('0x86')](_0x226558['grammar'])){return this[_0x9ec3('0xd')]['noop'](_0x9ec3('0xb2'));}var _0x29b75e=_0x226558[_0x9ec3('0xb3')];if(this[_0x9ec3('0x86')](_0x226558[_0x9ec3('0x79')])){_0x29b75e+=','+_0x226558[_0x9ec3('0x79')];}var _0x26665b=this['channel'][_0x9ec3('0x57')](_0x9ec3('0xb4'),_0x29b75e);if(_0x26665b[_0x9ec3('0xae')]===-0x1){return _0x26665b;}var _0x25d32e=this[_0x9ec3('0xa6')](_0x9ec3('0xb5'),_0x9ec3('0xb6'));if(_0x25d32e[_0x9ec3('0xae')]===-0x1){return _0x25d32e;}var _0xff2974=this[_0x9ec3('0xa6')](_0x9ec3('0xb7'),_0x9ec3('0xb8'));if(_0xff2974[_0x9ec3('0xae')]===-0x1){return _0xff2974;}var _0x4bcaee=this[_0x9ec3('0xa6')](_0x9ec3('0xb9'),_0x9ec3('0xba'));if(_0x4bcaee[_0x9ec3('0xae')]===-0x1){return _0x4bcaee;}return this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0xbb'),_0x29b75e));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x8')]=function(_0x26db44){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0xbc'),_0x26db44[_0x9ec3('0x36')]));return this['channel']['agi']([_0x26db44[_0x9ec3('0xbd')],_0x26db44[_0x9ec3('0xbe')]]);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xbf')]=function(_0xf7e31e){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0xc0'),_0xf7e31e[_0x9ec3('0x36')]));if(this[_0x9ec3('0x86')](_0xf7e31e[_0x9ec3('0x66')])){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0xc1'),_0xf7e31e['timeout']));var _0x2f7884=this[_0x9ec3('0xd')][_0x9ec3('0xc2')](_0xf7e31e['timeout']);if(_0x2f7884[_0x9ec3('0xae')]===-0x1){return _0x2f7884;}}return this[_0x9ec3('0xd')][_0x9ec3('0xbf')]();};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xc3')]=function(_0x56943b){logger[_0x9ec3('0x2d')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x56943b[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x56943b[_0x9ec3('0x49')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x56943b,_0x9ec3('0xc4'));}_0x56943b[_0x9ec3('0x4b')]=moment();if(this[_0x9ec3('0x86')](_0x56943b[_0x9ec3('0xc5')])){_0x56943b[_0x9ec3('0x4b')]=moment()[_0x9ec3('0xc6')](_0x56943b[_0x9ec3('0xc5')],_0x9ec3('0xc7'));}if(!this[_0x9ec3('0x86')](_0x56943b[_0x9ec3('0x4c')])){_0x56943b['callback_priority']=0x2;}this['createCmContact'][_0x9ec3('0xa7')](this,_0x56943b);return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x56943b[_0x9ec3('0x48')],_0x56943b[_0x9ec3('0x49')],_0x56943b[_0x9ec3('0x4b')]));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xc8')]=function(_0x4a838f){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xc9'),_0x4a838f[_0x9ec3('0x36')]));var _0x141034=this[_0x9ec3('0xd')][_0x9ec3('0x57')](_0x4a838f[_0x9ec3('0xca')],_0x4a838f[_0x9ec3('0x79')]);if(_0x141034[_0x9ec3('0xae')]===-0x1){return _0x141034;}return this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('Executed\x20command\x20%s\x20%s',_0x4a838f['application'],_0x4a838f[_0x9ec3('0x79')]));};AGIVertices[_0x9ec3('0x10')]['lumenvoxtts']=function(_0x5ae9a9){logger[_0x9ec3('0x2d')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x5ae9a9[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x5ae9a9[_0x9ec3('0x5c')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')]('no\x20text\x20configured');}var _0x13ed62='\x22'+_0x5ae9a9[_0x9ec3('0x5c')]+'\x22';if(this[_0x9ec3('0x86')](_0x5ae9a9['options'])){_0x13ed62+=','+_0x5ae9a9[_0x9ec3('0x79')];}var _0x44d37d=this[_0x9ec3('0xd')][_0x9ec3('0x57')]('MRCPSynth',_0x13ed62);if(_0x44d37d['result']===-0x1){return _0x44d37d;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0xaf'),_0x13ed62));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xcb')]=function(_0xa500f5){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xcc'),_0xa500f5[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0xa500f5['text'])){return this[_0x9ec3('0xd')]['noop']('no\x20text\x20configured');}var _0x145895='\x22'+_0xa500f5[_0x9ec3('0x5c')]+'\x22';if(this[_0x9ec3('0x86')](_0xa500f5[_0x9ec3('0x79')])){_0x145895+=','+_0xa500f5['options'];}var _0x1ea438=this[_0x9ec3('0xd')]['exec']('MRCPSynth',_0x145895);if(_0x1ea438[_0x9ec3('0xae')]===-0x1){return _0x1ea438;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('Executed\x20command\x20MRCPSynth\x20%s',_0x145895));};AGIVertices[_0x9ec3('0x10')]['lumenvoxasr']=function(_0x29e6cd){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xcd'),_0x29e6cd['label']));if(!this[_0x9ec3('0x86')](_0x29e6cd[_0x9ec3('0xb3')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xb2'));}var _0x27f467=_0x29e6cd[_0x9ec3('0xb3')];if(this[_0x9ec3('0x86')](_0x29e6cd[_0x9ec3('0x79')])){_0x27f467+=','+_0x29e6cd[_0x9ec3('0x79')];}var _0x482df8=this['channel'][_0x9ec3('0x57')](_0x9ec3('0xb4'),_0x27f467);if(_0x482df8[_0x9ec3('0xae')]===-0x1){return _0x482df8;}var _0x2d3033=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9ec3('0xce'));if(_0x2d3033[_0x9ec3('0xae')]===-0x1){return _0x2d3033;}var _0x14b172=this['getAndSetVariable'](_0x9ec3('0xb7'),_0x9ec3('0xcf'));if(_0x14b172[_0x9ec3('0xae')]===-0x1){return _0x14b172;}var _0x55039d=this[_0x9ec3('0xa6')](_0x9ec3('0xb9'),'LUMENVOX_ASR_INSTANCE');if(_0x55039d['result']===-0x1){return _0x55039d;}return this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0xbb'),_0x27f467));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xd0')]=function(_0x4c8c59){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xd1'),_0x4c8c59[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x4c8c59[_0x9ec3('0xb3')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xb2'));}var _0x465257=_0x4c8c59[_0x9ec3('0xb3')];if(this[_0x9ec3('0x86')](_0x4c8c59[_0x9ec3('0x79')])){_0x465257+=','+_0x4c8c59[_0x9ec3('0x79')];}var _0x40a753=this[_0x9ec3('0xd')][_0x9ec3('0x57')](_0x9ec3('0xb4'),_0x465257);if(_0x40a753[_0x9ec3('0xae')]===-0x1){return _0x40a753;}var _0x3b3d76=this[_0x9ec3('0xa6')](_0x9ec3('0xb5'),_0x9ec3('0xd2'));if(_0x3b3d76[_0x9ec3('0xae')]===-0x1){return _0x3b3d76;}var _0x59aa74=this['getAndSetVariable'](_0x9ec3('0xb7'),'SESTEK_ASR_TRANSCRIPT');if(_0x59aa74[_0x9ec3('0xae')]===-0x1){return _0x59aa74;}var _0x5e30f8=this[_0x9ec3('0xa6')]('RECOG_INSTANCE()',_0x9ec3('0xd3'));if(_0x5e30f8['result']===-0x1){return _0x5e30f8;}return this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('Executed\x20command\x20MRCPRecog\x20%s',_0x465257));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xd4')]=function(_0x12eab9){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xd5'),_0x12eab9[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x12eab9[_0x9ec3('0xd6')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x12eab9,_0x9ec3('0xd7'));}var _0x1b6720=this[_0x9ec3('0xd8')][_0x9ec3('0xa7')](this,_0x12eab9[_0x9ec3('0xd6')]);if(!_0x1b6720){return this['channel'][_0x9ec3('0x2b')](_0x12eab9,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x12eab9[_0x9ec3('0x2f')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x12eab9,'no\x20query\x20configured');}var _0x22e517=_0x12eab9[_0x9ec3('0x2f')][_0x9ec3('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0xd9'),_0x22e517));var _0x57313b=this[_0x9ec3('0xda')][_0x9ec3('0xa7')](this,_0x1b6720,_0x22e517);this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x12eab9,_0x22e517);if(!this[_0x9ec3('0x86')](_0x12eab9[_0x9ec3('0xdc')])){return this[_0x9ec3('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2ecb7c=this[_0x9ec3('0xa4')]['sync'](this,_0x12eab9[_0x9ec3('0xdc')]);if(!_0x2ecb7c){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x12eab9,'no\x20variable\x20found');}var _0x121331=this;_0x57313b[_0x9ec3('0xdd')](function(_0x252d62,_0x48abe0){Object['keys'](_0x252d62)[_0x9ec3('0xdd')](function(_0x1e1165){_0x121331[_0x9ec3('0xd')]['setVariable'](util['format'](_0x9ec3('0xde'),_0x2ecb7c,_0x48abe0,_0x1e1165),_0x252d62[_0x1e1165]);});});this['channel'][_0x9ec3('0xa0')](util[_0x9ec3('0x54')]('%s_ROWS_COUNT',_0x2ecb7c),_0x57313b[_0x9ec3('0x9d')]);return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('variable\x20%s\x20set',_0x2ecb7c));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xdf')]=function(_0x379199){logger[_0x9ec3('0xe0')](util[_0x9ec3('0x54')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x379199['label']));if(!this[_0x9ec3('0x86')](_0x379199[_0x9ec3('0xe1')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x379199,_0x9ec3('0xe2'));}var _0x3090e9=this[_0x9ec3('0x19')][_0x9ec3('0xa7')](this,_0x379199['sip_id']);if(!_0x3090e9){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x379199,_0x9ec3('0xe3'));}var _0x2e65cf=this[_0x9ec3('0xd')][_0x9ec3('0x57')]('DIAL',[util[_0x9ec3('0x54')](_0x9ec3('0xe4'),_0x3090e9),_0x379199[_0x9ec3('0x66')],_0x379199[_0x9ec3('0xe5')],_0x379199[_0x9ec3('0x64')]]);if(_0x2e65cf[_0x9ec3('0xae')]===-0x1){return _0x2e65cf;}return this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0xe6'),_0x9ec3('0xe7')));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xe8')]=function(_0xd10e34){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xe9'),_0xd10e34['label']));if(!this[_0x9ec3('0x86')](_0xd10e34[_0x9ec3('0x7b')])){return this[_0x9ec3('0xd')]['noop']('no\x20key\x20configured');}if(!this[_0x9ec3('0x86')](_0xd10e34[_0x9ec3('0x5c')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}this[_0x9ec3('0xd')][_0x9ec3('0xea')]=!![];this[_0x9ec3('0xdb')](_0xd10e34);this[_0x9ec3('0x41')](_0xd10e34[_0x9ec3('0x5c')],'in','','');this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0xeb'),_0xd10e34[_0x9ec3('0x5c')]));var _0x16ad23=this[_0x9ec3('0x7a')][_0x9ec3('0xa7')](this,_0xd10e34);if(_0x16ad23){for(var _0xebc4a in _0x16ad23){if(_0x16ad23[_0x9ec3('0x97')](_0xebc4a)){this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util[_0x9ec3('0x54')]('DIALOGFLOW_%s',_0xebc4a[_0x9ec3('0x6a')]()),_0x16ad23[_0xebc4a]);}}this[_0x9ec3('0x41')](_0x16ad23[_0x9ec3('0xec')],_0x9ec3('0xed'),_0x9ec3('0xe8'),'');return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util['format']('Dialogflow\x20Result\x20%s',_0x16ad23[_0x9ec3('0xec')]));}return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0xd10e34,_0x9ec3('0xee'));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xef')]=function(_0x3d6248){logger[_0x9ec3('0x2d')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3d6248['label']));if(!this[_0x9ec3('0x86')](_0x3d6248[_0x9ec3('0x7e')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xf0'));}if(!this['isConfigured'](_0x3d6248[_0x9ec3('0x7f')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xf1'));}if(!this[_0x9ec3('0x86')](_0x3d6248[_0x9ec3('0xf2')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xf3'));}if(!this[_0x9ec3('0x86')](_0x3d6248[_0x9ec3('0x80')])){return this['channel']['noop'](_0x9ec3('0xf4'));}if(!this[_0x9ec3('0x86')](_0x3d6248[_0x9ec3('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x9ec3('0xd')][_0x9ec3('0xea')]=!![];this[_0x9ec3('0xdb')](_0x3d6248);this[_0x9ec3('0x41')](_0x3d6248[_0x9ec3('0x5c')],'in','','');this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0xf5'),_0x3d6248['text']));var _0x466fa3=this[_0x9ec3('0x7d')][_0x9ec3('0xa7')](this,_0x3d6248);if(_0x466fa3){for(var _0x59cefe in _0x466fa3){if(_0x466fa3[_0x9ec3('0x97')](_0x59cefe)){if(_0x59cefe!==_0x9ec3('0xf6')){this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util['format'](_0x9ec3('0xf7'),_0x59cefe[_0x9ec3('0x6a')]()),_0x466fa3[_0x59cefe]);}}}this[_0x9ec3('0x41')](_0x466fa3[_0x9ec3('0xec')],_0x9ec3('0xed'),'dialogflowV2',_0x466fa3[_0x9ec3('0xf6')]);return this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')]('DialogflowV2\x20Result\x20%s',_0x466fa3[_0x9ec3('0xec')]));}return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x3d6248,_0x9ec3('0xf8'));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xf9')]=function(_0x14b340){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0xfa'),_0x14b340[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x14b340[_0x9ec3('0xfb')])){return this['channel'][_0x9ec3('0xab')](_0x9ec3('0xfc'));}if(!this[_0x9ec3('0x86')](_0x14b340['username'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xfd'));}if(!this[_0x9ec3('0x86')](_0x14b340[_0x9ec3('0xfe')])){return this[_0x9ec3('0xd')]['noop']('no\x20password\x20configured');}if(!this[_0x9ec3('0x86')](_0x14b340[_0x9ec3('0xff')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}this[_0x9ec3('0xd')][_0x9ec3('0xea')]=!![];this[_0x9ec3('0xdb')](_0x14b340);this[_0x9ec3('0x41')](_0x14b340['text'],'in','','');this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x100'),_0x14b340[_0x9ec3('0x5c')]));var _0x2e6b2c=this['sestekNDA'][_0x9ec3('0xa7')](this,_0x14b340);if(_0x2e6b2c){for(var _0x5ab381 in _0x2e6b2c){if(_0x2e6b2c[_0x9ec3('0x97')](_0x5ab381)){this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util[_0x9ec3('0x54')]('SESTEK_NDA_%s',_0x5ab381[_0x9ec3('0x6a')]()),_0x2e6b2c[_0x5ab381]);}}this['createSquareMessage'](_0x2e6b2c['speech'],_0x9ec3('0xed'),_0x9ec3('0xf9'),'');if(_0x2e6b2c['audiofile']){this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x101'),_0x2e6b2c[_0x9ec3('0x102')]));var _0x127863=this[_0x9ec3('0xd')][_0x9ec3('0x103')](_0x2e6b2c['audiofile']);try{fs[_0x9ec3('0x104')](_0x2e6b2c[_0x9ec3('0x102')]+_0x9ec3('0x105'));}catch(_0x526195){logger[_0x9ec3('0x2b')](_0x526195);}return _0x127863;}else{return this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x106'),_0x2e6b2c[_0x9ec3('0xec')]));}}return this['channel'][_0x9ec3('0x2b')](_0x14b340,_0x9ec3('0x107'));};AGIVertices['prototype'][_0x9ec3('0x108')]=function(_0x13bb35){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x109'),_0x13bb35[_0x9ec3('0x36')]));return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x108'));};AGIVertices[_0x9ec3('0x10')]['ext_dial']=function(_0x2273f9){logger['info'](util['format'](_0x9ec3('0x10a'),_0x2273f9[_0x9ec3('0x36')]));var _0x48f931='';if(_0x2273f9[_0x9ec3('0x10b')]){if(!this[_0x9ec3('0x86')](_0x2273f9[_0x9ec3('0x10b')])){return this['channel']['error'](_0x2273f9,_0x9ec3('0x10c'));}else{var _0x3b507a=parseInt(_0x2273f9[_0x9ec3('0x10b')],0xa);if(isNaN(_0x3b507a)){_0x48f931=_0x2273f9['trunk_id'];}else{_0x48f931=this[_0x9ec3('0x1b')][_0x9ec3('0xa7')](this,_0x2273f9['trunk_id']);if(!_0x48f931){return this[_0x9ec3('0xd')]['error'](_0x2273f9,_0x9ec3('0x10d'));}}}}else if(_0x2273f9[_0x9ec3('0x10e')]){_0x48f931=_0x2273f9[_0x9ec3('0x10e')];}else{return this[_0x9ec3('0xd')]['error'](_0x2273f9,_0x9ec3('0x10c'));}var _0x4ccbc1=this['channel'][_0x9ec3('0x57')](_0x9ec3('0xe7'),[util[_0x9ec3('0x54')](_0x9ec3('0x10f'),_0x48f931,_0x2273f9[_0x9ec3('0x48')]),_0x2273f9[_0x9ec3('0x66')],_0x2273f9['opts'],_0x2273f9['url']]);if(_0x4ccbc1[_0x9ec3('0xae')]===-0x1){return _0x4ccbc1;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util['format'](_0x9ec3('0xe6'),_0x9ec3('0xe7')));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x110')]=function(_0x467d3f){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x111'),_0x467d3f[_0x9ec3('0x36')]));return this[_0x9ec3('0xd')][_0x9ec3('0xab')]('finally');};AGIVertices['prototype'][_0x9ec3('0xc')]=function(_0x14ad2b){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x112'),_0x14ad2b[_0x9ec3('0x36')]));if(_0x14ad2b['retry']===0x0){return this[_0x9ec3('0xa9')](_0x14ad2b);}_0x14ad2b['retry']-=0x1;if(!this['isConfigured'](_0x14ad2b[_0x9ec3('0x113')])){return this['channel'][_0x9ec3('0x2b')](_0x14ad2b,_0x9ec3('0x114'));}var _0x4f2998=this[_0x9ec3('0x1d')][_0x9ec3('0xa7')](this,_0x14ad2b['file_id']);if(!_0x4f2998){return this[_0x9ec3('0xd')]['error'](_0x14ad2b,'no\x20file\x20audio\x20found');}if(!this[_0x9ec3('0x86')](_0x14ad2b[_0x9ec3('0xdc')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x14a34b=this[_0x9ec3('0xd')][_0x9ec3('0x115')](_0x4f2998,_0x14ad2b[_0x9ec3('0x116')],_0x14ad2b['maxdigit']);var _0x5b5284=_0x14a34b['result']?_0x14a34b[_0x9ec3('0xae')]['toString']():'';logger[_0x9ec3('0x2d')](_0x9ec3('0x117'),JSON[_0x9ec3('0x73')](_0x14a34b));if(_0x14a34b[_0x9ec3('0xae')]===-0x1){this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x14ad2b,_0x5b5284);return _0x14a34b;}else if(_0x14a34b['extra']===_0x9ec3('0x66')){_0x14a34b[_0x9ec3('0xae')]=_0x5b5284['length']>=parseInt(_0x14ad2b[_0x9ec3('0x118')])?'x':'i';}else{_0x14a34b['result']=_0x5b5284[_0x9ec3('0x9d')]>=parseInt(_0x14ad2b[_0x9ec3('0x118')])&&_0x5b5284[_0x9ec3('0x9d')]<=parseInt(_0x14ad2b['maxdigit'])?'x':'i';}var _0x56362b=this[_0x9ec3('0xa4')][_0x9ec3('0xa7')](this,_0x14ad2b[_0x9ec3('0xdc')]);if(!_0x56362b){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x14ad2b,_0x9ec3('0x119'));}this[_0x9ec3('0xd')][_0x9ec3('0xa0')](_0x56362b,_0x5b5284);if(this['isConfigured'](_0x14ad2b[_0x9ec3('0x11a')])){var _0x18f487=parseInt(_0x14ad2b[_0x9ec3('0x11a')],0xa);var _0x4b008e=rs[_0x9ec3('0x11b')]({'charset':'*','length':_0x18f487});var _0x407fca=_0x5b5284[_0x9ec3('0x9d')];if(_0x407fca>0x0){if(_0x407fca>_0x18f487){this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x14ad2b,_0x14ad2b[_0x9ec3('0x11c')]===_0x9ec3('0x11d')?_0x4b008e+_0x5b5284[_0x9ec3('0x11e')](_0x18f487):_0x5b5284[_0x9ec3('0x11e')](0x0,_0x407fca-_0x18f487)+_0x4b008e);}else{this[_0x9ec3('0xdb')]['sync'](this,_0x14ad2b,rs[_0x9ec3('0x11b')]({'charset':'*','length':_0x407fca}));}}else{this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x14ad2b,'');}}else{this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x14ad2b,_0x5b5284);}return _0x14a34b;};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x11f')]=function(_0x33ecf3){logger['info'](util['format'](_0x9ec3('0x120'),_0x33ecf3[_0x9ec3('0x36')]));return this[_0x9ec3('0xc')](_0x33ecf3);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x121')]=function(_0x2aa113){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x122'),_0x2aa113['label']));this['createSquareDetailsReport'][_0x9ec3('0xa7')](this,_0x2aa113,_0x2aa113[_0x9ec3('0x123')]);return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x124'),_0x2aa113[_0x9ec3('0x123')]));};AGIVertices[_0x9ec3('0x10')]['awspolly']=function(_0x40dd8e){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x125'),_0x40dd8e['label']));if(!this['isConfigured'](_0x40dd8e[_0x9ec3('0x89')])||!this['isConfigured'](_0x40dd8e['aws_secret_access_key'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x126'));}if(!this[_0x9ec3('0x86')](_0x40dd8e[_0x9ec3('0x5c')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}this['channel']['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x127'),_0x40dd8e['text']));var _0x454558=this[_0x9ec3('0x88')][_0x9ec3('0xa7')](this,_0x40dd8e);if(_0x454558){this['channel'][_0x9ec3('0xab')](util['format'](_0x9ec3('0x128'),_0x454558));var _0x3ae314=this[_0x9ec3('0xd')][_0x9ec3('0x103')](_0x454558);try{fs[_0x9ec3('0x104')](_0x454558+_0x9ec3('0x105'));}catch(_0x44054f){logger[_0x9ec3('0x2b')](_0x44054f);}return _0x3ae314;}return this['channel'][_0x9ec3('0x2b')](_0x40dd8e,_0x9ec3('0x129'));};AGIVertices['prototype'][_0x9ec3('0x12a')]=function(_0x4c49a1){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x12b'),_0x4c49a1[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x4c49a1['aws_access_key_id'])||!this['isConfigured'](_0x4c49a1[_0x9ec3('0x8e')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x126'));}if(!this[_0x9ec3('0x86')](_0x4c49a1['aws_bot_name'])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x9ec3('0x86')](_0x4c49a1['text'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}this[_0x9ec3('0xd')]['bot']=!![];this[_0x9ec3('0xdb')](_0x4c49a1);this[_0x9ec3('0x41')](_0x4c49a1[_0x9ec3('0x5c')],'in','','');this['channel']['noop'](util[_0x9ec3('0x54')]('Trying\x20Amazon\x20Lex:\x20%s',_0x4c49a1['text']));var _0x529dc6=this[_0x9ec3('0x8d')][_0x9ec3('0xa7')](this,_0x4c49a1);if(_0x529dc6){for(var _0x15fefd in _0x529dc6){if(_0x529dc6['hasOwnProperty'](_0x15fefd)&&_[_0x9ec3('0x98')](_0x529dc6[_0x15fefd])){this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util[_0x9ec3('0x54')]('AWS_LEX_%s',_0x15fefd[_0x9ec3('0x6a')]()),_0x529dc6[_0x15fefd]);}}if(_[_0x9ec3('0x44')](_0x529dc6[_0x9ec3('0x77')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x12c'));}else{this[_0x9ec3('0x41')](_0x529dc6[_0x9ec3('0x77')],_0x9ec3('0xed'),'amazonlex','');return this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x12d'),_0x529dc6[_0x9ec3('0x77')]));}}return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x4c49a1,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x12e')]=function(_0x5d36db){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x12f'),_0x5d36db[_0x9ec3('0x36')],_0x5d36db[_0x9ec3('0x66')]));if(!this['isConfigured'](_0x5d36db['key'])){return this[_0x9ec3('0xd')]['noop'](_0x9ec3('0x130'));}var _0x38de5b=_0x9ec3('0x131');var _0x5ce27b=util['format'](_0x9ec3('0x132'),FILES_PATH,rs['generate'](0x4));var _0x106242=util[_0x9ec3('0x54')]('%s.%s',_0x5ce27b,_0x38de5b);var _0x4f245b=!![];if(_0x5d36db['beep']===_0x9ec3('0x133')){_0x4f245b=![];}var _0x36e3f1=this[_0x9ec3('0xd')][_0x9ec3('0x134')](_0x5ce27b,_0x38de5b,_0x5d36db[_0x9ec3('0x135')],_0x5d36db[_0x9ec3('0x66')],undefined,_0x4f245b);if(_0x36e3f1[_0x9ec3('0xae')]!==-0x1){this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x136'),_0x106242));var _0x21c57a=this[_0x9ec3('0x91')][_0x9ec3('0xa7')](this,_0x5d36db,_0x106242);if(_0x21c57a){for(var _0x709f6a in _0x21c57a){if(_0x21c57a[_0x9ec3('0x97')](_0x709f6a)){this[_0x9ec3('0xd')]['setVariable'](util[_0x9ec3('0x54')](_0x9ec3('0x137'),_0x709f6a[_0x9ec3('0x6a')]()),_0x21c57a[_0x709f6a]);}}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x138'),JSON['stringify'](_0x21c57a)));}}return _0x36e3f1;};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x139')]=function(_0x1f4663){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x13a'),_0x1f4663[_0x9ec3('0x36')]));if(!this['isConfigured'](_0x1f4663['appid'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x13b'));}if(!this[_0x9ec3('0x86')](_0x1f4663[_0x9ec3('0x94')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x13c'));}var _0x5d18e2=_0x9ec3('0x131');var _0x3c5229=util[_0x9ec3('0x54')]('%s/recordings/%s',FILES_PATH,rs[_0x9ec3('0x11b')](0x4));var _0x19f06a=util[_0x9ec3('0x54')](_0x9ec3('0x9f'),_0x3c5229,_0x5d18e2);var _0x52fc43=!![];if(_0x1f4663['beep']==='NOBEEP'){_0x52fc43=![];}var _0x564056=this[_0x9ec3('0xd')][_0x9ec3('0x134')](_0x3c5229,_0x5d18e2,_0x1f4663[_0x9ec3('0x135')],_0x1f4663['timeout'],undefined,_0x52fc43);if(_0x564056[_0x9ec3('0xae')]!==-0x1){this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x13d'),_0x19f06a));var _0x103b96=this['tildeASR'][_0x9ec3('0xa7')](this,_0x1f4663,_0x19f06a);if(_0x103b96){for(var _0x5ef8c5 in _0x103b96){if(_0x103b96[_0x9ec3('0x97')](_0x5ef8c5)){this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util[_0x9ec3('0x54')](_0x9ec3('0x13e'),_0x5ef8c5[_0x9ec3('0x6a')]()),_0x103b96[_0x5ef8c5]);}}return this['channel']['noop'](util['format'](_0x9ec3('0x13f'),JSON['stringify'](_0x103b96)));}}return _0x564056;};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x140')]=function(_0x51be70){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x51be70[_0x9ec3('0x36')]));return this['channel'][_0x9ec3('0x141')](_0x51be70[_0x9ec3('0x142')],_0x51be70[_0x9ec3('0x3c')],_0x51be70[_0x9ec3('0x3d')]);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x143')]=function(_0x51d704){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x144'),_0x51d704[_0x9ec3('0x36')]));if(!this['isConfigured'](_0x51d704[_0x9ec3('0x145')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x51d704,_0x9ec3('0x146'));}try{var _0x1d5792=eval(_0x51d704[_0x9ec3('0x145')])?_0x9ec3('0x147'):_0x9ec3('0x148');this[_0x9ec3('0xd')]['noop'](util['format'](_0x9ec3('0x149'),_0x51d704[_0x9ec3('0x145')],_0x1d5792));return{'code':0xc8,'result':_0x1d5792};}catch(_0x5cf6db){return{'code':0xc8,'result':_0x9ec3('0x148')};}};AGIVertices['prototype'][_0x9ec3('0x14a')]=function(_0x21d95c){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x14b'),_0x21d95c[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x21d95c['interval_id'])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x21d95c,_0x9ec3('0x14c'));}var _0x54ad8a=this[_0x9ec3('0x24')][_0x9ec3('0xa7')](this,_0x21d95c[_0x9ec3('0x14d')]);if(!_0x54ad8a){return this['channel'][_0x9ec3('0x2b')](_0x21d95c,_0x9ec3('0x14e'));}for(var _0x1e9e3e=0x0;_0x1e9e3e<_0x54ad8a[_0x9ec3('0x9d')];_0x1e9e3e+=0x1){var _0x46136a=this[_0x9ec3('0xd')]['getVariable'](util['format'](_0x9ec3('0x14f'),_0x54ad8a[_0x1e9e3e]));if(_0x46136a[_0x9ec3('0xae')]===-0x1){return _0x46136a;}logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x150'),_0x54ad8a[_0x1e9e3e],_0x46136a[_0x9ec3('0x151')]));if(_0x46136a['extra']==='true'){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x150'),_0x54ad8a[_0x1e9e3e],_0x9ec3('0x147')));this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x150'),_0x54ad8a[_0x1e9e3e],_0x9ec3('0x147')));return{'code':0xc8,'result':_0x9ec3('0x147')};}else{logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x150'),_0x54ad8a[_0x1e9e3e],_0x9ec3('0x148')));this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x150'),_0x54ad8a[_0x1e9e3e],'false'));}}return{'code':0xc8,'result':_0x9ec3('0x148')};};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x152')]=function(_0x5ddb5f){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x153'),_0x5ddb5f[_0x9ec3('0x36')]));return this[_0x9ec3('0xd')][_0x9ec3('0x152')]();};AGIVertices['prototype'][_0x9ec3('0x154')]=function(_0x54b848){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x54b848[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x54b848[_0x9ec3('0x7b')])){return this['channel'][_0x9ec3('0xab')]('no\x20key\x20configured');}var _0x33347a=_0x9ec3('0x131');var _0x10aeae=util[_0x9ec3('0x54')](_0x9ec3('0x132'),FILES_PATH,rs['generate'](0x4));var _0x1ea25f=util[_0x9ec3('0x54')](_0x9ec3('0x9f'),_0x10aeae,_0x33347a);var _0x21d022=!![];if(_0x54b848[_0x9ec3('0x155')]===_0x9ec3('0x133')){_0x21d022=![];}var _0x36d3ea=this['channel'][_0x9ec3('0x134')](_0x10aeae,_0x33347a,_0x54b848[_0x9ec3('0x135')],_0x54b848[_0x9ec3('0x66')],undefined,_0x21d022);if(_0x36d3ea[_0x9ec3('0xae')]!==-0x1){this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x156'),_0x1ea25f));var _0x41dbcc=this[_0x9ec3('0x84')]['sync'](this,_0x54b848,_0x1ea25f);if(_0x41dbcc){for(var _0x20dc08 in _0x41dbcc){if(_0x41dbcc[_0x9ec3('0x97')](_0x20dc08)){this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util[_0x9ec3('0x54')](_0x9ec3('0x157'),_0x20dc08[_0x9ec3('0x6a')]()),_0x41dbcc[_0x20dc08]);}}return this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x158'),JSON['stringify'](_0x41dbcc)));}}return _0x36d3ea;};AGIVertices['prototype'][_0x9ec3('0x159')]=function(_0x541fd1){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x541fd1[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x541fd1[_0x9ec3('0x7b')])){return this['channel'][_0x9ec3('0xab')]('no\x20key\x20configured');}if(!this[_0x9ec3('0x86')](_0x541fd1['text'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x15a'),_0x541fd1[_0x9ec3('0x5c')]));var _0x40f10b=this['ispeechTTS'][_0x9ec3('0xa7')](this,_0x541fd1);if(_0x40f10b){this['channel']['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x156'),_0x40f10b));var _0x4c185b=this['channel']['streamFile'](_0x40f10b,_0x541fd1[_0x9ec3('0x135')]);try{fs[_0x9ec3('0x104')](_0x40f10b+_0x9ec3('0x105'));}catch(_0x21eaa8){logger[_0x9ec3('0x2b')](_0x21eaa8);}return _0x4c185b;}return this[_0x9ec3('0xd')]['error'](_0x541fd1,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x15b')]=function(_0x489958){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x15c'),_0x489958[_0x9ec3('0x36')]));if(!this['isConfigured'](_0x489958[_0x9ec3('0x15d')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x489958,_0x9ec3('0x15e'));}logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x489958[_0x9ec3('0x15d')]));var _0x137d02=this[_0x9ec3('0x52')][_0x9ec3('0xa7')](this,_0x489958[_0x9ec3('0x15d')]);if(_0x137d02){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x15f'),this['channel'][_0x9ec3('0x39')],_0x489958[_0x9ec3('0x15d')]));this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x15f'),this['channel'][_0x9ec3('0x39')],_0x489958[_0x9ec3('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x160'),this[_0x9ec3('0xd')]['callerid'],_0x489958[_0x9ec3('0x15d')]));this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x489958[_0x9ec3('0x15d')]));return{'code':0xc8,'result':_0x9ec3('0x161')};}};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x162')]=function(_0x597476){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x163'),_0x597476['label']));if(!this['isConfigured'](_0x597476[_0x9ec3('0x15d')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x597476,'no\x20find\x20by\x20configured');}logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x164'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x597476[_0x9ec3('0x15d')]));var _0xc18e08=this[_0x9ec3('0x51')][_0x9ec3('0xa7')](this,_0x597476['findBy']);if(_0xc18e08){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x15f'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x597476['findBy']));this['channel']['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x15f'),this['channel'][_0x9ec3('0x39')],_0x597476[_0x9ec3('0x15d')]));return{'code':0xc8,'result':_0x9ec3('0x165')};}else{logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x160'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x597476[_0x9ec3('0x15d')]));this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x597476[_0x9ec3('0x15d')]));return{'code':0xc8,'result':_0x9ec3('0x161')};}};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x166')]=function(_0x5ae8fc){logger['info'](util[_0x9ec3('0x54')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5ae8fc[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x5ae8fc['operation'])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x5ae8fc,'no\x20operation\x20configured');}this[_0x9ec3('0xd')][_0x9ec3('0xab')](util['format'](_0x9ec3('0x167'),_0x5ae8fc[_0x9ec3('0x168')]));var _0x417a73=eval(_0x5ae8fc[_0x9ec3('0x168')]);if(!this[_0x9ec3('0x86')](_0x5ae8fc[_0x9ec3('0xdc')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x169'));}var _0x568065=this[_0x9ec3('0xa4')][_0x9ec3('0xa7')](this,_0x5ae8fc[_0x9ec3('0xdc')]);if(!_0x568065){return this[_0x9ec3('0xd')]['error'](_0x5ae8fc,_0x9ec3('0x119'));}if(_[_0x9ec3('0x9c')](_0x417a73)){var _0x301159=this;_0x417a73[_0x9ec3('0xdd')](function(_0x1fbce6,_0x1af158){_0x301159[_0x9ec3('0xd')][_0x9ec3('0xa0')](util['format'](_0x9ec3('0x16a'),_0x568065,_0x1af158),_0x1fbce6);});return this['channel'][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('variable\x20%s[key]\x20set',_0x568065));}else{return this[_0x9ec3('0xd')][_0x9ec3('0xa0')](_0x568065,_0x417a73);}};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xb')]=function(_0x56dd18){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x16b'),_0x56dd18[_0x9ec3('0x36')]));if(_0x56dd18[_0x9ec3('0xa8')]===0x0){return this[_0x9ec3('0xa9')](_0x56dd18);}_0x56dd18[_0x9ec3('0xa8')]-=0x1;if(!this[_0x9ec3('0x86')](_0x56dd18['file_id'])){return this[_0x9ec3('0xd')]['error'](_0x56dd18,_0x9ec3('0x114'));}var _0x379aed=this['getSound'][_0x9ec3('0xa7')](this,_0x56dd18['file_id']);if(!_0x379aed){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x56dd18,_0x9ec3('0x16c'));}var _0x1aaf8c=this['channel'][_0x9ec3('0x115')](_0x379aed,_0x56dd18['response'],_0x56dd18[_0x9ec3('0x16d')]);var _0x53f208=_0x1aaf8c['result'];if(_0x1aaf8c[_0x9ec3('0xae')]===-0x1){this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x56dd18,'-1');return _0x1aaf8c;}else if(_0x1aaf8c[_0x9ec3('0x151')]===_0x9ec3('0x66')){_0x1aaf8c[_0x9ec3('0xae')]=_0x1aaf8c[_0x9ec3('0xae')][_0x9ec3('0x9d')]>0x0?_0x1aaf8c[_0x9ec3('0xae')]:'t';}else if(_[_0x9ec3('0x43')](_0x1aaf8c[_0x9ec3('0xae')])){_0x1aaf8c[_0x9ec3('0xae')]='#';_0x53f208='#';}if(!this['isConfigured'](_0x56dd18[_0x9ec3('0xdc')])){this['channel'][_0x9ec3('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x443a3b=this[_0x9ec3('0xa4')][_0x9ec3('0xa7')](this,_0x56dd18['variable_id']);if(!_0x443a3b){return this['channel'][_0x9ec3('0x2b')](_0x56dd18,_0x9ec3('0x119'));}this[_0x9ec3('0xd')][_0x9ec3('0xa0')](_0x443a3b,_0x53f208);}this['createSquareDetailsReport'][_0x9ec3('0xa7')](this,_0x56dd18,_0x53f208);return _0x1aaf8c;};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0xab')]=function(_0x3fa738){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x16e'),_0x3fa738[_0x9ec3('0x36')]));return this[_0x9ec3('0xd')]['noop'](_0x3fa738[_0x9ec3('0x16f')]||_0x3fa738[_0x9ec3('0x36')]);};AGIVertices[_0x9ec3('0x10')]['pause']=function(_0x4a47a9){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x170'),_0x4a47a9[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x4a47a9['findBy'])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x4a47a9,_0x9ec3('0x15e'));}logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x164'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x4a47a9[_0x9ec3('0x15d')]));var _0x43e876=this[_0x9ec3('0x4d')]['sync'](this,_0x4a47a9[_0x9ec3('0x171')]);var _0x782c27=this[_0x9ec3('0x4e')][_0x9ec3('0xa7')](this,_0x4a47a9[_0x9ec3('0x15d')],_0x43e876);if(_0x782c27){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x15f'),this[_0x9ec3('0xd')]['callerid'],_0x4a47a9[_0x9ec3('0x15d')]));this['channel'][_0x9ec3('0xab')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x4a47a9[_0x9ec3('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x160'),this[_0x9ec3('0xd')]['callerid'],_0x4a47a9[_0x9ec3('0x15d')]));this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x15f'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x4a47a9[_0x9ec3('0x15d')]));return{'code':0xc8,'result':_0x9ec3('0x161')};}};AGIVertices['prototype'][_0x9ec3('0x172')]=function(_0x5c2973){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x173'),_0x5c2973[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x5c2973[_0x9ec3('0x113')])){return this['channel'][_0x9ec3('0x2b')](_0x5c2973,_0x9ec3('0x114'));}var _0x5e535c=this[_0x9ec3('0x1d')][_0x9ec3('0xa7')](this,_0x5c2973['file_id']);if(!_0x5e535c){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x5c2973,'no\x20file\x20audio\x20found');}var _0x2b2c24=this[_0x9ec3('0xd')][_0x9ec3('0x57')](_0x9ec3('0x174'),[_0x5e535c,_0x5c2973[_0x9ec3('0xe5')]]);if(_0x2b2c24['result']===-0x1){return _0x2b2c24;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x175'),_0x9ec3('0x174'),_0x5e535c));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x176')]=function(_0x53f036){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x177'),_0x53f036[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x53f036[_0x9ec3('0x178')])){return this[_0x9ec3('0xd')]['error'](_0x53f036,_0x9ec3('0x179'));}var _0x5c1b38='';var _0x4a4ede=parseInt(_0x53f036[_0x9ec3('0x178')],0xa);if(isNaN(_0x4a4ede)){_0x5c1b38=_0x53f036['queue_id'];}else{_0x5c1b38=this['getVoiceQueue'][_0x9ec3('0xa7')](this,_0x53f036[_0x9ec3('0x178')]);if(!_0x5c1b38){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x53f036,_0x9ec3('0x17a'));}}var _0x1990c5='';if(this[_0x9ec3('0x86')](_0x53f036[_0x9ec3('0x113')])){var _0x30a67c=this['getSound'][_0x9ec3('0xa7')](this,_0x53f036[_0x9ec3('0x113')]);if(_0x30a67c){_0x1990c5=_0x30a67c;}}this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x53f036,_0x5c1b38);if(_0x53f036[_0x9ec3('0xe5')][_0x9ec3('0x17b')]('x')<0x0){_0x53f036[_0x9ec3('0xe5')]+='x';}if(_0x53f036['opts'][_0x9ec3('0x17b')]('X')<0x0){_0x53f036[_0x9ec3('0xe5')]+='X';}this[_0x9ec3('0xd')][_0x9ec3('0xa0')]('XMCS-QUEUE',_0x5c1b38?_0x5c1b38[_0x9ec3('0x17c')]():'');var _0x2b4869=this[_0x9ec3('0xd')][_0x9ec3('0x57')](_0x9ec3('0x17d'),[_0x5c1b38,_0x53f036[_0x9ec3('0xe5')],_0x53f036['url'],_0x1990c5,_0x53f036[_0x9ec3('0x66')],_0x53f036[_0x9ec3('0x8')],_0x53f036[_0x9ec3('0x17e')],_0x53f036[_0x9ec3('0x17f')],'',_0x53f036[_0x9ec3('0x180')]]);if(_0x2b4869['result']===-0x1){return _0x2b4869;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x175'),'QUEUE',_0x5c1b38));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x181')]=function(_0x24c50e){logger['info'](util['format'](_0x9ec3('0x182'),_0x24c50e[_0x9ec3('0x36')]));var _0x5cc028=_0x24c50e[_0x9ec3('0x183')]||_0x9ec3('0x131');var _0x195eb6=util[_0x9ec3('0x54')](_0x9ec3('0x184'),this[_0x9ec3('0xd')][_0x9ec3('0x50')],rs[_0x9ec3('0x11b')](0x5));var _0x538a2b=util[_0x9ec3('0x54')](_0x9ec3('0x185'),FILES_PATH,_0x195eb6,_0x5cc028);var _0x11978d=util[_0x9ec3('0x54')]('%s/recordings/%s',FILES_PATH,_0x195eb6);this[_0x9ec3('0x3a')][_0x9ec3('0xa7')](this,_0x24c50e,_0x195eb6,_0x538a2b);this[_0x9ec3('0xd')][_0x9ec3('0xa0')](_0x9ec3('0x186'),_0x195eb6);logger[_0x9ec3('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x11978d,_0x5cc028,_0x24c50e[_0x9ec3('0x187')],_0x24c50e[_0x9ec3('0x66')]);return this['channel'][_0x9ec3('0x134')](_0x11978d,_0x5cc028,_0x24c50e[_0x9ec3('0x187')],_0x24c50e['timeout'],undefined,!![]);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x188')]=function(_0x15d92d){logger[_0x9ec3('0x2d')](util['format'](_0x9ec3('0x189'),_0x15d92d[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x15d92d[_0x9ec3('0x64')])){return this[_0x9ec3('0xd')]['noop'](_0x9ec3('0x18a'));}var _0xe067d9=this['restAPI'][_0x9ec3('0xa7')](this,_0x15d92d);logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Response:',util['inspect'](_0xe067d9,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x15d92d[_0x9ec3('0xdc')])){return this[_0x9ec3('0xd')]['noop'](_0x9ec3('0x18b'));}var _0x46173b=this[_0x9ec3('0xa4')][_0x9ec3('0xa7')](this,_0x15d92d[_0x9ec3('0xdc')]);if(!_0x46173b){return this['channel'][_0x9ec3('0x2b')](_0x15d92d,_0x9ec3('0x119'));}this[_0x9ec3('0xd')]['setVariable'](util[_0x9ec3('0x54')](_0x9ec3('0x18c'),_0x46173b),_0xe067d9[_0x9ec3('0x76')]?_0xe067d9[_0x9ec3('0x76')]:_0x9ec3('0x18d'));this[_0x9ec3('0xd')][_0x9ec3('0xa0')](util[_0x9ec3('0x54')](_0x9ec3('0x18e'),_0x46173b),_0xe067d9[_0x9ec3('0x18f')]?_0xe067d9['statusMessage']:'OK');if(_0xe067d9[_0x9ec3('0x74')]){try{this[_0x9ec3('0x9e')](_0xe067d9['body'],_0x46173b);}catch(_0x4a1d8c){logger[_0x9ec3('0x2b')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x46173b));}}return this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x190'),_0x46173b));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x191')]=function(_0x1f30ec){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x192'),_0x1f30ec[_0x9ec3('0x36')]));return this[_0x9ec3('0xd')]['sayDigits'](_0x1f30ec[_0x9ec3('0x193')][_0x9ec3('0x58')](/\s+/g,''),_0x1f30ec['escape_digits']);};AGIVertices['prototype'][_0x9ec3('0x194')]=function(_0x3aa3f0){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x195'),_0x3aa3f0['label']));return this[_0x9ec3('0xd')][_0x9ec3('0x196')](_0x3aa3f0['number']['replace'](/\s+/g,''),_0x3aa3f0['escape_digits']);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x197')]=function(_0x11aa1a){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x198'),_0x11aa1a[_0x9ec3('0x36')]));return this['channel'][_0x9ec3('0x199')](_0x11aa1a[_0x9ec3('0x5c')],_0x11aa1a['escape_digits']);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x19a')]=function(_0x27bc2d){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x27bc2d['label']));if(!this[_0x9ec3('0x86')](_0x27bc2d[_0x9ec3('0x19b')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')]('no\x20mail\x20account\x20configured');}var _0x3a2868=this[_0x9ec3('0x21')][_0x9ec3('0xa7')](this,_0x27bc2d[_0x9ec3('0x19b')]);if(!_0x3a2868||!_0x3a2868[_0x9ec3('0x19c')]){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x27bc2d,_0x9ec3('0x19d'));}var _0x3471e0={'from':util[_0x9ec3('0x54')](_0x9ec3('0x19e'),_0x3a2868['name'],_0x3a2868['email']||_0x3a2868[_0x9ec3('0x19c')][_0x9ec3('0x19f')]),'to':_0x27bc2d['to']||'','cc':_0x27bc2d['cc']||'','bcc':_0x27bc2d['bcc']||'','subject':_0x27bc2d[_0x9ec3('0x1a0')],'html':_0x27bc2d['text'],'text':_0x27bc2d[_0x9ec3('0x5c')]};if(this[_0x9ec3('0x86')](_0x27bc2d['template_id'])){}logger[_0x9ec3('0xe0')]('sendMail\x20message',JSON[_0x9ec3('0x73')](_0x3471e0));this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x27bc2d,_0x27bc2d[_0x9ec3('0x19b')]);this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x1a1'),_0x3a2868['name']));this['sendMailMessage'][_0x9ec3('0xa7')](this,_0x3a2868['smtpOptions'],_0x3471e0);return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x1a2'));};AGIVertices[_0x9ec3('0x10')]['sendFax']=function(_0x3fa3ef){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x1a3'),_0x3fa3ef[_0x9ec3('0x36')]));return this[_0x9ec3('0xd')]['noop'](_0x9ec3('0x1a4'));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1a5')]=function(_0x2221db){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x1a6'),_0x2221db[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x2221db['sms_account_id'])){return this['channel'][_0x9ec3('0xab')]('no\x20sms\x20account\x20configured');}var _0x13f35e=this[_0x9ec3('0x33')][_0x9ec3('0xa7')](this,_0x2221db['sms_account_id']);if(!_0x13f35e){return this['channel'][_0x9ec3('0x2b')](_0x2221db,_0x9ec3('0x1a7'));}var _0x3f149f={'body':_0x2221db[_0x9ec3('0x1a8')],'phone':_0x2221db['to']||'','SmsAccountId':_0x13f35e['id']};logger[_0x9ec3('0xe0')](_0x9ec3('0x1a9'),JSON[_0x9ec3('0x73')](_0x3f149f));this[_0x9ec3('0xdb')]['sync'](this,_0x2221db,_0x2221db['sms_account_id']);this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x1aa'),_0x13f35e[_0x9ec3('0x13')]));this[_0x9ec3('0x35')]['sync'](this,_0x3f149f);return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x1ab'));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1ac')]=function(_0x353a24){logger['info'](util['format'](_0x9ec3('0x1ad'),_0x353a24['label']));if(!this[_0x9ec3('0x86')](_0x353a24[_0x9ec3('0xdc')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x353a24,'no\x20variable\x20selected');}var _0x33d41d=this[_0x9ec3('0xa4')]['sync'](this,_0x353a24[_0x9ec3('0xdc')]);if(!_0x33d41d){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x353a24,_0x9ec3('0x119'));}return this['channel'][_0x9ec3('0xa0')](_0x33d41d,_0x353a24[_0x9ec3('0x1ae')]);};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1af')]=function(_0xddee15){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x1b0'),_0xddee15[_0x9ec3('0x36')]));this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x1b1'));var _0x212f78=this[_0x9ec3('0xd')][_0x9ec3('0xa4')](_0x9ec3('0x1b2'));if(!_[_0x9ec3('0x43')](_0x212f78[_0x9ec3('0x151')])){this[_0x9ec3('0xd')]['uniqueid']=_0x212f78[_0x9ec3('0x151')];}if(_0xddee15['answer']===_0x9ec3('0x1b3')){this['channel'][_0x9ec3('0xab')](_0x9ec3('0x1b4'));return this[_0x9ec3('0xd')][_0x9ec3('0xbf')]();}return this[_0x9ec3('0xd')]['noop'](_0x9ec3('0x1b5'));};AGIVertices[_0x9ec3('0x10')]['subproject']=function(_0x4d918a){logger['info'](util['format'](_0x9ec3('0x1b6'),_0x4d918a[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x4d918a['project_id'])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x4d918a,_0x9ec3('0x1b7'));}var _0x510ffc=this[_0x9ec3('0x17')][_0x9ec3('0xa7')](this,_0x4d918a['project_id']);if(!this[_0x9ec3('0x86')](_0x510ffc)){return this['channel'][_0x9ec3('0x2b')](_0x4d918a,util['format'](_0x9ec3('0x1b8'),_0x4d918a[_0x9ec3('0x1b9')]));}if(_0x510ffc===this[_0x9ec3('0xd')][_0x9ec3('0x38')]){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x4d918a,_0x9ec3('0x1ba'));}this['createSquareDetailsReport'][_0x9ec3('0xa7')](this,_0x4d918a,_0x510ffc);var _0x330d3d=this[_0x9ec3('0xd')]['exec']('AGI',util[_0x9ec3('0x54')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9ec3('0x8')]['host']||_0x9ec3('0x1bb'),_0x510ffc,this['channel']['arg_1']));if(_0x330d3d[_0x9ec3('0xae')]===-0x1){return _0x330d3d;}return this['channel']['noop'](util['format'](_0x9ec3('0x175'),'AGI',_0x510ffc));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1bc')]=function(_0x54b21d){logger['info'](util[_0x9ec3('0x54')](_0x9ec3('0x1bd'),_0x54b21d[_0x9ec3('0x36')]));var _0x416181=this['shellCommand'][_0x9ec3('0xa7')](this,_0x54b21d[_0x9ec3('0xbd')]);this[_0x9ec3('0xdb')][_0x9ec3('0xa7')](this,_0x54b21d,_0x54b21d[_0x9ec3('0xbd')]);if(this[_0x9ec3('0x86')](_0x54b21d[_0x9ec3('0xdc')])){var _0x231289=this[_0x9ec3('0xa4')][_0x9ec3('0xa7')](this,_0x54b21d[_0x9ec3('0xdc')]);if(_0x231289){this['channel'][_0x9ec3('0xa0')](_0x231289,_0x416181);return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x54b21d[_0x9ec3('0xbd')],_0x231289));}}return this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x1be'),_0x54b21d[_0x9ec3('0xbd')]));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1bf')]=function(_0x440133){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x1c0'),_0x440133[_0x9ec3('0x36')]));_0x440133[_0x9ec3('0x5c')]=_0x440133['text'][_0x9ec3('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9ec3('0x86')](_0x440133['apiKey'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0x1c1'));}if(!this[_0x9ec3('0x86')](_0x440133[_0x9ec3('0x5c')])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')](_0x9ec3('0xac'));}this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x1c2'),_0x440133[_0x9ec3('0x5c')]));var _0x293723=this[_0x9ec3('0x59')][_0x9ec3('0xa7')](this,_0x440133);if(_0x293723){this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x1c3'),_0x293723));var _0x5d224a=this[_0x9ec3('0xd')][_0x9ec3('0x103')](_0x293723);try{fs['unlink'](_0x293723+_0x9ec3('0x105'));}catch(_0x5fd47f){logger[_0x9ec3('0x2b')](_0x5fd47f);}return _0x5d224a;}return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x440133,_0x9ec3('0x1c4'));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1c5')]=function(_0x1676a1){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1676a1[_0x9ec3('0x36')]));_0x1676a1[_0x9ec3('0x5c')]=_0x1676a1[_0x9ec3('0x5c')][_0x9ec3('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1676a1['text'])){return this[_0x9ec3('0xd')][_0x9ec3('0xab')]('no\x20text\x20configured');}this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x1c6'),_0x1676a1[_0x9ec3('0x5c')]));var _0x2319e0=this['googleTTS'][_0x9ec3('0xa7')](this,_0x1676a1);if(_0x2319e0){this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x1c7'),_0x2319e0));var _0x3bdc82=this['channel']['streamFile'](_0x2319e0);try{fs[_0x9ec3('0x104')](_0x2319e0+_0x9ec3('0x105'));}catch(_0x2105ec){logger[_0x9ec3('0x2b')](_0x2105ec);}return _0x3bdc82;}return this[_0x9ec3('0xd')]['error'](_0x1676a1,_0x9ec3('0x1c8'));};AGIVertices[_0x9ec3('0x10')][_0x9ec3('0x1c9')]=function(_0x493194){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x493194[_0x9ec3('0x36')]));if(!this[_0x9ec3('0x86')](_0x493194[_0x9ec3('0x15d')])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x493194,_0x9ec3('0x15e'));}logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x164'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x493194[_0x9ec3('0x15d')]));var _0x2ba433=this[_0x9ec3('0x1ca')]['sync'](this,_0x493194[_0x9ec3('0x15d')]);if(_0x2ba433){logger['info'](util['format'](_0x9ec3('0x15f'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x493194[_0x9ec3('0x15d')]));this[_0x9ec3('0xd')]['noop'](util['format'](_0x9ec3('0x15f'),this['channel'][_0x9ec3('0x39')],_0x493194[_0x9ec3('0x15d')]));return{'code':0xc8,'result':_0x9ec3('0x165')};}else{logger['info'](util[_0x9ec3('0x54')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x493194[_0x9ec3('0x15d')]));this[_0x9ec3('0xd')]['noop'](util[_0x9ec3('0x54')](_0x9ec3('0x160'),this[_0x9ec3('0xd')][_0x9ec3('0x39')],_0x493194[_0x9ec3('0x15d')]));return{'code':0xc8,'result':_0x9ec3('0x161')};}};AGIVertices[_0x9ec3('0x10')]['voicemail']=function(_0x25b582){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')](_0x9ec3('0x1cb'),_0x25b582[_0x9ec3('0x36')]));var _0xcc4749=this[_0x9ec3('0xd')][_0x9ec3('0x57')](_0x9ec3('0x1cc'),[_0x25b582[_0x9ec3('0x1cd')],_0x25b582['options']]);if(_0xcc4749['result']===-0x1){return _0xcc4749;}return this[_0x9ec3('0xd')][_0x9ec3('0xab')](util[_0x9ec3('0x54')](_0x9ec3('0x175'),'VOICEMAIL',_0x25b582[_0x9ec3('0x1cd')]));};AGIVertices['prototype'][_0x9ec3('0x1ce')]=function(_0x14907f){logger[_0x9ec3('0x2d')](util[_0x9ec3('0x54')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x14907f[_0x9ec3('0x36')]));if(!this['isConfigured'](_0x14907f['variable_id'])){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x14907f,_0x9ec3('0x1cf'));}var _0x1f2295=this['getVariable']['sync'](this,_0x14907f['variable_id']);if(!_0x1f2295){return this[_0x9ec3('0xd')][_0x9ec3('0x2b')](_0x14907f,_0x9ec3('0x119'));}var _0x572d4f=this['channel'][_0x9ec3('0xa4')](_0x1f2295);return{'code':0xc8,'result':_0x572d4f[_0x9ec3('0x151')]?_0x572d4f[_0x9ec3('0x151')]:'-'};};String[_0x9ec3('0x10')][_0x9ec3('0xa3')]=function(_0x3b5384,_0xd42c2b){return this[_0x9ec3('0xa2')](_0x3b5384)[_0x9ec3('0x1d0')](_0xd42c2b);};module[_0x9ec3('0x1d1')]=AGIVertices; \ No newline at end of file +var _0xf2cb=['noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','key','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','dialogflow','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','menu','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','smtpOptions','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','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','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','lodash','odbc','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','catch','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','createSquareRecording','callerid','calleridname','context','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','POST','toUpperCase','body','parse','computedVariables','sync','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','setVariable','%s.%s','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf2cb,0x130));var _0xbf2c=function(_0x8dbb7c,_0x222938){_0x8dbb7c=_0x8dbb7c-0x0;var _0x5c8ed5=_0xf2cb[_0x8dbb7c];return _0x5c8ed5;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xbf2c('0x0'));var sh=require('shelljs');var odbc=require(_0xbf2c('0x1'))();var rs=require('randomstring');var moment=require(_0xbf2c('0x2'));var Mustache=require('mustache');var rp=require(_0xbf2c('0x3'));var logger=require(_0xbf2c('0x4'))('agi');var config=require('../../config/environment');var scripts=require(_0xbf2c('0x5'));var FILES_PATH=_0xbf2c('0x6');var recursiveMapAttributes=[_0xbf2c('0x7'),_0xbf2c('0x8')];var verticesWithRetry=['menu',_0xbf2c('0x9'),'getsecretdigits'];var AGIVertices=function(_0x25d0a6,_0x5e070d,_0x5f25ea){this[_0xbf2c('0xa')]=_0x25d0a6;this[_0xbf2c('0xb')]=_0x5e070d;this[_0xbf2c('0xc')]=_0x5f25ea;};AGIVertices['prototype'][_0xbf2c('0xd')]=function(_0x2fe412,_0x2da108){this[_0xbf2c('0xb')][_0xbf2c('0xe')](_0x2fe412)[_0xbf2c('0xf')](function(_0x20b260){_0x2da108(null,_0x20b260?_0x20b260[_0xbf2c('0x10')]:![]);})['catch'](function(_0x149235){_0x2da108(_0x149235);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x12')]=function(_0x2879de,_0x5220e2){this[_0xbf2c('0xb')]['getVoiceQueueById'](_0x2879de)['then'](function(_0x160fff){_0x5220e2(null,_0x160fff?_0x160fff['name']:![]);})['catch'](function(_0x3ed1c3){_0x5220e2(_0x3ed1c3);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x13')]=function(_0x334900,_0x2af371){this['rpc'][_0xbf2c('0x14')](_0x334900)['then'](function(_0x4ced7f){_0x2af371(null,_0x4ced7f?_0x4ced7f[_0xbf2c('0x10')]:![]);})[_0xbf2c('0x15')](function(_0x32a44d){_0x2af371(_0x32a44d);});};AGIVertices[_0xbf2c('0x11')]['getSquareOdbc']=function(_0x31196d,_0x1fbfe8){this[_0xbf2c('0xb')][_0xbf2c('0x16')](_0x31196d)[_0xbf2c('0xf')](function(_0x102cef){_0x1fbfe8(null,_0x102cef?_0x102cef[_0xbf2c('0x17')]:![]);})['catch'](function(_0x61248b){_0x1fbfe8(_0x61248b);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x18')]=function(_0xe6dad9,_0x57873c){this[_0xbf2c('0xb')][_0xbf2c('0x19')](_0xe6dad9)['then'](function(_0x3f79fe){_0x57873c(null,_0x3f79fe?_0x3f79fe[_0xbf2c('0x10')]:![]);})[_0xbf2c('0x15')](function(_0x52ecb4){_0x57873c(_0x52ecb4);});};AGIVertices['prototype'][_0xbf2c('0x1a')]=function(_0x3c546d,_0xae9c7){this[_0xbf2c('0xb')][_0xbf2c('0x1b')](_0x3c546d)[_0xbf2c('0xf')](function(_0x11ffbe){_0xae9c7(null,_0x11ffbe?_0x11ffbe['name']:![]);})['catch'](function(_0x169948){_0xae9c7(_0x169948);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1c')]=function(_0x4314d6,_0x3ed68d){var _0x4a0257=this;this[_0xbf2c('0xb')][_0xbf2c('0x1d')](_0x4314d6)[_0xbf2c('0xf')](function(_0x4f3191){_0x3ed68d(null,_0x4f3191?_0x4a0257[_0xbf2c('0x1e')](_0x4f3191['save_name']):![]);})[_0xbf2c('0x15')](function(_0x3442fa){_0x3ed68d(_0x3442fa);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1f')]=function(_0x7c6f3b,_0x502943){this[_0xbf2c('0xb')][_0xbf2c('0x20')](_0x7c6f3b)[_0xbf2c('0xf')](function(_0x13e238){_0x502943(null,_0x13e238?_0x13e238:![]);})[_0xbf2c('0x15')](function(_0x32d7e8){_0x502943(_0x32d7e8);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x21')]=function(_0x4d731d,_0x37cf35,_0x3dfe0e){this[_0xbf2c('0xc')]['sendMailMessage'](_0x4d731d,_0x37cf35)['then'](function(){_0x3dfe0e(null);})[_0xbf2c('0x15')](function(_0x24e3cf){_0x3dfe0e(_0x24e3cf);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x22')]=function(_0x286634,_0x45f743){this[_0xbf2c('0xb')][_0xbf2c('0x23')](_0x286634)[_0xbf2c('0xf')](function(_0x5ef32a){if(_0x5ef32a){if(_0x5ef32a[_0xbf2c('0x24')]){_0x45f743(null,[_0x5ef32a[_0xbf2c('0x25')]]);}else{_0x45f743(null,_[_0xbf2c('0x26')](_0x5ef32a[_0xbf2c('0x27')],_0xbf2c('0x25')));}}else{_0x45f743(null,![]);}})[_0xbf2c('0x15')](function(_0x18ddfb){_0x45f743(_0x18ddfb);});};AGIVertices[_0xbf2c('0x11')]['getSoundPath']=function(_0x3a9323){return util[_0xbf2c('0x28')](_0xbf2c('0x29'),FILES_PATH,_0x3a9323);};AGIVertices['prototype'][_0xbf2c('0x2a')]=function(_0x608bb4,_0x3b4d8a,_0x5402ff){odbc[_0xbf2c('0x2b')](_0x608bb4,function(_0x43f1ad){if(_0x43f1ad){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x43f1ad);_0x5402ff(_0x43f1ad);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x3b4d8a,function(_0x17f680,_0x13652a){if(_0x17f680){logger[_0xbf2c('0x2c')](_0xbf2c('0x2d'),_0x3b4d8a);_0x5402ff(_0x17f680);}else{logger[_0xbf2c('0x2c')](_0xbf2c('0x2e'),_0x3b4d8a);odbc[_0xbf2c('0x2f')](function(_0x325581){if(_0x325581){logger[_0xbf2c('0x30')](_0xbf2c('0x31'),_0x325581);}_0x5402ff(null,_0x13652a);});}});}});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x32')]=function(_0x3fbf90,_0x1eac50){this[_0xbf2c('0xb')][_0xbf2c('0x33')](_0x3fbf90)['then'](function(_0x294684){_0x1eac50(null,_0x294684?_0x294684:![]);})[_0xbf2c('0x15')](function(_0x6bbc64){_0x1eac50(_0x6bbc64);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x34')]=function(_0x458756,_0x43464f){this[_0xbf2c('0xb')]['createSmsMessage'](_0x458756)[_0xbf2c('0xf')](function(_0x2bccc2){_0x43464f(null,_0x2bccc2);})[_0xbf2c('0x15')](function(_0x3fe481){_0x43464f(_0x3fe481);});};AGIVertices['prototype'][_0xbf2c('0x35')]=function(_0x5067d2,_0x369bdc,_0x613b14){this[_0xbf2c('0xb')][_0xbf2c('0x35')]({'uniqueid':this[_0xbf2c('0xa')][_0xbf2c('0x36')],'node':_0x5067d2['label'],'application':_0x5067d2[_0xbf2c('0x37')],'data':_0x369bdc||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xbf2c('0xa')]['callerid']})['then'](function(_0x7f696c){if(_0x613b14){_0x613b14(null,_0x7f696c);}})[_0xbf2c('0x15')](function(_0x56fc01){if(_0x613b14){_0x613b14(_0x56fc01);}});};AGIVertices[_0xbf2c('0x11')]['createSquareRecording']=function(_0x780c85,_0x4995e9,_0x467d00,_0x409377){this[_0xbf2c('0xb')][_0xbf2c('0x38')]({'uniqueid':this[_0xbf2c('0xa')][_0xbf2c('0x36')],'callerid':this['channel'][_0xbf2c('0x39')],'calleridname':this[_0xbf2c('0xa')][_0xbf2c('0x3a')],'context':this[_0xbf2c('0xa')][_0xbf2c('0x3b')],'extension':this['channel']['extension'],'priority':this[_0xbf2c('0xa')]['priority'],'accountcode':this[_0xbf2c('0xa')][_0xbf2c('0x3c')],'dnid':this[_0xbf2c('0xa')][_0xbf2c('0x3d')],'projectName':this[_0xbf2c('0xa')][_0xbf2c('0x3e')],'saveName':_0x4995e9,'filename':_0x780c85[_0xbf2c('0x3f')]||_0x4995e9,'savePath':_0x467d00})[_0xbf2c('0xf')](function(_0x128e97){_0x409377(null,_0x128e97);})[_0xbf2c('0x15')](function(_0x31791b){_0x409377(_0x31791b);});};AGIVertices['prototype'][_0xbf2c('0x40')]=function(_0x22af02,_0x90276,_0x387d4a,_0x5d02d3,_0x4edca4){this['rpc'][_0xbf2c('0x40')]({'uniqueid':this[_0xbf2c('0xa')]['uniqueid'],'body':_0x22af02,'direction':_0x90276,'providerName':_0x387d4a,'providerResponse':_0x5d02d3})['then'](function(_0x4ab854){if(_0x4edca4){_0x4edca4(null,_0x4ab854);}})[_0xbf2c('0x15')](function(_0x314f7b){if(_0x4edca4){_0x4edca4(_0x314f7b);}});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x41')]=function(_0x3a8d9a,_0xd91a88){this['rpc'][_0xbf2c('0x41')]({'firstName':_[_0xbf2c('0x42')](_0x3a8d9a[_0xbf2c('0x10')])||_[_0xbf2c('0x43')](_0x3a8d9a[_0xbf2c('0x10')])?_0xbf2c('0x44')+Math[_0xbf2c('0x45')]():_0x3a8d9a[_0xbf2c('0x10')],'lastName':_['isEmpty'](_0x3a8d9a['lastName'])||_['isNil'](_0x3a8d9a[_0xbf2c('0x46')])?null:_0x3a8d9a[_0xbf2c('0x46')],'phone':_0x3a8d9a[_0xbf2c('0x47')],'ListId':_0x3a8d9a[_0xbf2c('0x48')],'scheduledat':_0x3a8d9a['scheduledAt'],'callbackUniqueid':this[_0xbf2c('0xa')][_0xbf2c('0x36')],'tags':'callback','description':_0xbf2c('0x49')+_0x3a8d9a[_0xbf2c('0x4a')][_0xbf2c('0x4b')](),'priority':_0x3a8d9a['callback_priority']})['then'](function(_0x4b6253){_0xd91a88(null,_0x4b6253);})['catch'](function(_0x39c10e){_0xd91a88(_0x39c10e);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x4c')]=function(_0x195169,_0x46a0f6){this['rpc'][_0xbf2c('0x4d')](_0x195169)[_0xbf2c('0xf')](function(_0x58b66a){_0x46a0f6(null,_0x58b66a?_0x58b66a[_0xbf2c('0x10')]:![]);})[_0xbf2c('0x15')](function(_0x4fe788){_0x46a0f6(_0x4fe788);});};AGIVertices['prototype']['agentPause']=function(_0x363f77,_0x5df133,_0x5cf1df){var _0x38b789={'role':_0xbf2c('0x4e')};_0x38b789[_0x363f77]=this[_0xbf2c('0xa')][_0xbf2c('0x39')];this['rpc']['agentPause'](_0x38b789,_0x5df133,this[_0xbf2c('0xa')][_0xbf2c('0x36')])[_0xbf2c('0xf')](function(_0x2960fc){_0x5cf1df(null,_[_0xbf2c('0x43')](_0x2960fc)?![]:!![]);})['catch'](function(_0x533be2){logger[_0xbf2c('0x30')](_0x533be2);_0x5cf1df(null,![]);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x4f')]=function(_0x45b91c,_0x1f984e){var _0x13e5ba={'role':'agent'};_0x13e5ba[_0x45b91c]=this['channel'][_0xbf2c('0x39')];this[_0xbf2c('0xb')][_0xbf2c('0x4f')](_0x13e5ba)[_0xbf2c('0xf')](function(_0x2177b1){_0x1f984e(null,_[_0xbf2c('0x43')](_0x2177b1)?![]:!![]);})[_0xbf2c('0x15')](function(_0x38a5e6){logger[_0xbf2c('0x30')](_0x38a5e6);_0x1f984e(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x2e4d40,_0x168f55){var _0x38ce66={'role':_0xbf2c('0x4e')};_0x38ce66[_0x2e4d40]=this['channel'][_0xbf2c('0x39')];this[_0xbf2c('0xb')][_0xbf2c('0x50')](_0x38ce66)['then'](function(_0x2d10a8){_0x168f55(null,_[_0xbf2c('0x43')](_0x2d10a8)?![]:!![]);})[_0xbf2c('0x15')](function(_0x7b8adc){logger['error'](_0x7b8adc);_0x168f55(null,![]);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x51')]=function(_0x425a46,_0x531188){var _0x4feece={'role':_0xbf2c('0x4e')};_0x4feece[_0x425a46]=this['channel']['callerid'];var _0x1e2d67=_0x425a46!=_0xbf2c('0x52')?util[_0xbf2c('0x28')](_0xbf2c('0x53'),_0xbf2c('0x54'),this['channel']['callerid']):undefined;this[_0xbf2c('0xb')][_0xbf2c('0x51')](_0x4feece,_0x1e2d67)['then'](function(_0x396222){_0x531188(null,_[_0xbf2c('0x43')](_0x396222)?![]:!![]);})['catch'](function(_0x475637){logger['error'](_0x475637);_0x531188(null,![]);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x55')]=function(_0x354591,_0x59516e){sh[_0xbf2c('0x56')](_[_0xbf2c('0x57')](_0x354591),function(_0xcbc240,_0xac22cf){var _0x16c94d=_0xac22cf[_0xbf2c('0x58')](/(\r\n|\n|\r)/gm,'');_0x59516e(null,_0x16c94d);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x59')]=function(_0x30a968,_0x4e5c26){scripts['googleCloudTTS'](_0x30a968[_0xbf2c('0x5a')],_0x30a968[_0xbf2c('0x5b')]||_0xbf2c('0x5c'),_0x30a968[_0xbf2c('0x5c')],_0x30a968[_0xbf2c('0x5d')]||_0xbf2c('0x5e'),_0x30a968[_0xbf2c('0x5f')]||'MALE',_0x30a968[_0xbf2c('0x60')]||_0xbf2c('0x61'))[_0xbf2c('0xf')](function(_0x9c91e6){_0x4e5c26(null,_0x9c91e6);})[_0xbf2c('0x15')](function(_0x4e82f3){_0x4e5c26(_0x4e82f3);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x62')]=function(_0x3cc51d,_0x2400ff){scripts['googleTTS'](_0x3cc51d[_0xbf2c('0x5c')],_0x3cc51d[_0xbf2c('0x63')]||'en',0x1)[_0xbf2c('0xf')](function(_0x26c94a){_0x2400ff(null,_0x26c94a);})[_0xbf2c('0x15')](function(_0x26897e){_0x2400ff(_0x26897e);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x64')]=function(_0x51617d,_0x79cc7){var _0x5440a8={'uri':_0x51617d[_0xbf2c('0x65')],'method':_0x51617d[_0xbf2c('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x51617d[_0xbf2c('0x67')])==='number'&&parseInt(_0x51617d[_0xbf2c('0x67')])>=0x1?parseInt(_0x51617d[_0xbf2c('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xbf2c('0x68'),'PUT'],_0x5440a8[_0xbf2c('0x66')][_0xbf2c('0x69')]())){try{_0x5440a8[_0xbf2c('0x6a')]=_0x51617d[_0xbf2c('0x8')]?JSON['parse'](_0x51617d['rawBody']):{};}catch(_0x464537){logger[_0xbf2c('0x30')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x464537);}}try{_0x5440a8['headers']=_0x51617d[_0xbf2c('0x7')]?JSON[_0xbf2c('0x6b')](_0x51617d[_0xbf2c('0x7')]):{};}catch(_0x195658){logger[_0xbf2c('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x195658);}if(_0x51617d[_0xbf2c('0x6c')]){try{var _0x2323f9=require(_0x51617d[_0xbf2c('0x6c')])[_0xbf2c('0x6d')](this,_0x5440a8);_0x5440a8[_0xbf2c('0x6e')]=Mustache[_0xbf2c('0x6f')](_0x51617d[_0xbf2c('0x65')],_0x2323f9,{},['$$','$$']);if(_0x5440a8[_0xbf2c('0x70')]){_0x5440a8[_0xbf2c('0x70')]=JSON[_0xbf2c('0x6b')](Mustache[_0xbf2c('0x6f')](JSON[_0xbf2c('0x71')](_0x5440a8['headers']),_0x2323f9,{},['$$','$$']));}if(_0x5440a8[_0xbf2c('0x6a')]){_0x5440a8[_0xbf2c('0x6a')]=JSON[_0xbf2c('0x6b')](Mustache[_0xbf2c('0x6f')](JSON[_0xbf2c('0x71')](_0x5440a8[_0xbf2c('0x6a')]),_0x2323f9,{},['$$','$$']));}}catch(_0x545447){logger[_0xbf2c('0x30')](_0xbf2c('0x72'),_0x545447);}}rp(_0x5440a8)['then'](function(_0x355f04){var _0x33d88c={'statusCode':_0x355f04[_0xbf2c('0x73')]||0xc8,'statusMessage':_0x355f04[_0xbf2c('0x74')]||'OK','headers':_0x355f04['headers']||{},'body':_0x355f04[_0xbf2c('0x6a')]||{}};_0x79cc7(null,_0x33d88c);})[_0xbf2c('0x15')](function(_0x4cd3da){var _0x241234={'statusCode':_0x4cd3da[_0xbf2c('0x73')]||0x1f4,'statusMessage':_0x4cd3da[_0xbf2c('0x75')]||_0xbf2c('0x76'),'headers':_0x4cd3da[_0xbf2c('0x77')][_0xbf2c('0x70')]||{},'body':_0x4cd3da['options'][_0xbf2c('0x6a')]||{}};_0x79cc7(null,_0x241234);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x78')]=function(_0x4fa011,_0x2aa3c3){scripts[_0xbf2c('0x78')](this[_0xbf2c('0xa')][_0xbf2c('0x36')],_0x4fa011['key'],_0x4fa011[_0xbf2c('0x5c')],_0x4fa011[_0xbf2c('0x79')]||'en')[_0xbf2c('0xf')](function(_0x2544fd){_0x2aa3c3(null,_0x2544fd);})[_0xbf2c('0x15')](function(_0x23a925){_0x2aa3c3(_0x23a925);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x7a')]=function(_0x2fcb0a,_0x391208){scripts[_0xbf2c('0x7a')](this['channel'][_0xbf2c('0x36')],_0x2fcb0a['dialogflowV2_project_id'],_0x2fcb0a[_0xbf2c('0x7b')],_0x2fcb0a[_0xbf2c('0x7c')],_0x2fcb0a['text'],_0x2fcb0a[_0xbf2c('0x7d')]||'en')['then'](function(_0x3b7838){_0x391208(null,_0x3b7838);})[_0xbf2c('0x15')](function(_0x388cae){_0x391208(_0x388cae);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x7e')]=function(_0x6340c1,_0x458971){scripts[_0xbf2c('0x7e')](this[_0xbf2c('0xa')],_0x6340c1)['then'](function(_0x2a28e2){_0x458971(null,_0x2a28e2);})[_0xbf2c('0x15')](function(_0x2ed748){_0x458971(_0x2ed748);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x7f')]=function(_0x3a7900,_0x4e7b5a){scripts[_0xbf2c('0x7f')](_0x3a7900['key'],_0x3a7900['text'],_0x3a7900['ispeech_tts_language']||_0xbf2c('0x5e'),_0x3a7900[_0xbf2c('0x80')])['then'](function(_0x4e476a){_0x4e7b5a(null,_0x4e476a);})['catch'](function(_0x2f2308){_0x4e7b5a(_0x2f2308);});};AGIVertices['prototype'][_0xbf2c('0x81')]=function(_0x455c1a,_0x1e6e6b,_0x11c689){scripts[_0xbf2c('0x81')](_0x1e6e6b,_0x455c1a['key'],_0x455c1a[_0xbf2c('0x82')]||_0xbf2c('0x5e'),this[_0xbf2c('0x83')](_0x455c1a[_0xbf2c('0x84')])?_0x455c1a[_0xbf2c('0x84')]:undefined)['then'](function(_0x5e126b){_0x11c689(null,_0x5e126b);})[_0xbf2c('0x15')](function(_0x47d9bd){_0x11c689(_0x47d9bd);});};AGIVertices['prototype'][_0xbf2c('0x85')]=function(_0xe3b0be,_0x460624){scripts['awsPolly'](_0xe3b0be[_0xbf2c('0x86')],_0xe3b0be[_0xbf2c('0x87')],_0xe3b0be[_0xbf2c('0x88')],_0xe3b0be[_0xbf2c('0x89')]||_0xbf2c('0x8a'),_0xe3b0be[_0xbf2c('0x5c')],_0xe3b0be[_0xbf2c('0x8b')]||_0xbf2c('0x5c'))[_0xbf2c('0xf')](function(_0x23eb0f){_0x460624(null,_0x23eb0f);})['catch'](function(_0x3009cc){_0x460624(_0x3009cc);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x8c')]=function(_0x177627,_0x312df9){scripts[_0xbf2c('0x8c')](this[_0xbf2c('0xa')][_0xbf2c('0x36')],_0x177627[_0xbf2c('0x86')],_0x177627[_0xbf2c('0x87')],_0x177627['aws_lex_region'],_0x177627[_0xbf2c('0x5c')],_0x177627[_0xbf2c('0x8d')])[_0xbf2c('0xf')](function(_0x4e6347){_0x312df9(null,_0x4e6347);})['catch'](function(_0x5a9421){_0x312df9(_0x5a9421);});};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x8e')]=function(_0x314a66,_0x20dff1,_0x394297){scripts[_0xbf2c('0x8e')](_0x20dff1,_0x314a66['key'],_0x314a66[_0xbf2c('0x8f')]||'en-US')[_0xbf2c('0xf')](function(_0x99aff4){_0x394297(null,_0x99aff4);})['catch'](function(_0xa7b27f){_0x394297(_0xa7b27f);});};AGIVertices['prototype'][_0xbf2c('0x90')]=function(_0x5a029e,_0x13eabf,_0x25c3db){scripts[_0xbf2c('0x90')](_0x13eabf,_0x5a029e[_0xbf2c('0x91')],_0x5a029e[_0xbf2c('0x92')],_0x5a029e[_0xbf2c('0x6e')])[_0xbf2c('0xf')](function(_0x15410a){_0x25c3db(null,_0x15410a);})[_0xbf2c('0x15')](function(_0x371461){_0x25c3db(_0x371461);});};AGIVertices[_0xbf2c('0x11')]['clear']=function(_0x1fbbd6){var _0x2604b5=_[_0xbf2c('0x93')](verticesWithRetry,_0x1fbbd6[_0xbf2c('0x37')])?_0x1fbbd6:_[_0xbf2c('0x94')](_0x1fbbd6);for(var _0xe15450 in _0x2604b5){if(_0x2604b5[_0xbf2c('0x95')](_0xe15450)){if(_0x2604b5[_0xe15450]&&_[_0xbf2c('0x96')](_0x2604b5[_0xe15450])){if(_[_0xbf2c('0x93')](recursiveMapAttributes,_0xe15450)){_0x2604b5[_0xe15450]=this[_0xbf2c('0x97')](_0x2604b5[_0xe15450]);}else{_0x2604b5[_0xe15450]=this[_0xbf2c('0x98')](_0x2604b5[_0xe15450]);}}}}return _0x2604b5;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x99')]=function(_0x54bb51){for(var _0x4d5006 in _0x54bb51){if(_0x54bb51[_0xbf2c('0x95')](_0x4d5006)){if(_[_0xbf2c('0x9a')](_0x54bb51[_0x4d5006])){this[_0xbf2c('0x99')](_0x54bb51[_0x4d5006]);}else if(_[_0xbf2c('0x9b')](_0x54bb51[_0x4d5006])){for(var _0x231f50=0x0;_0x231f50<_0x54bb51[_0x4d5006][_0xbf2c('0x9c')];_0x231f50++){this[_0xbf2c('0x99')](_0x54bb51[_0x4d5006][_0x231f50]);}}else if(_[_0xbf2c('0x96')](_0x54bb51[_0x4d5006])){_0x54bb51[_0x4d5006]=this[_0xbf2c('0x98')](_0x54bb51[_0x4d5006]);}}}};AGIVertices['prototype'][_0xbf2c('0x9d')]=function(_0x531dfe,_0x26fe2b){for(var _0x2acdef in _0x531dfe){if(_0x531dfe[_0xbf2c('0x95')](_0x2acdef)){if(_[_0xbf2c('0x9a')](_0x531dfe[_0x2acdef])){if(!_[_0xbf2c('0x42')](_0x531dfe[_0x2acdef])){this[_0xbf2c('0x9d')](_0x531dfe[_0x2acdef],util[_0xbf2c('0x28')]('%s.%s',_0x26fe2b,_0x2acdef));}}else if(_[_0xbf2c('0x9b')](_0x531dfe[_0x2acdef])){for(var _0x52b509=0x0;_0x52b509<_0x531dfe[_0x2acdef][_0xbf2c('0x9c')];_0x52b509++){this[_0xbf2c('0x9d')](_0x531dfe[_0x2acdef][_0x52b509],util[_0xbf2c('0x28')]('%s.%s',_0x26fe2b,_0x2acdef+'['+_0x52b509+']'));}}else{if(!_[_0xbf2c('0x43')](_0x531dfe[_0x2acdef])){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util['format'](_0xbf2c('0x9f'),_0x26fe2b,_0x2acdef),_0x531dfe[_0x2acdef]);}}}}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x97')]=function(_0x588b65){try{var _0x2f2098=JSON['parse'](_0x588b65);this['recursiveNodeIndex'](_0x2f2098);return JSON[_0xbf2c('0x71')](_0x2f2098);}catch(_0x3a8165){return this['replaceAllVariables'](_0x588b65);}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x98')]=function(_0xa93660){var _0x1fb2d4=_0xa93660[_0xbf2c('0xa0')]('{');for(var _0x1f5ecb=0x1;_0x1f5ecb<_0x1fb2d4['length'];_0x1f5ecb+=0x1){var _0xd0f031=_0x1fb2d4[_0x1f5ecb][_0xbf2c('0xa0')]('}');if(_0xd0f031[_0xbf2c('0x9c')]>0x1){_0xa93660=_0xa93660['replaceAll']('{'+_0xd0f031[0x0]+'}',this[_0xbf2c('0xa')][_0xbf2c('0xd')](_0xd0f031[0x0])[_0xbf2c('0xa1')]||_0xd0f031[0x0]);}}if(_0x1fb2d4[_0xbf2c('0x9c')]===0x1){return _0xa93660[_0xbf2c('0x4b')]();}return this['replaceAllVariables'](_0xa93660);};AGIVertices['prototype'][_0xbf2c('0xa2')]=function(_0x3ccc70,_0x46afec){var _0xe0191c=this[_0xbf2c('0xa')][_0xbf2c('0xd')](_0x3ccc70);if(_0xe0191c[_0xbf2c('0xa3')]===-0x1){return _0xe0191c;}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xa4'),_0x46afec,_0xe0191c[_0xbf2c('0xa1')]));return this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0x46afec,_0xe0191c[_0xbf2c('0xa1')]);};AGIVertices[_0xbf2c('0x11')]['isConfigured']=function(_0x5e3fc8){return _0x5e3fc8&&_0x5e3fc8!=='0'&&_0x5e3fc8!=='-1'&&_0x5e3fc8!=='';};AGIVertices['prototype'][_0xbf2c('0xa5')]=function(_0xc1d33d){this[_0xbf2c('0x35')]['sync'](this,_0xc1d33d,'-');_0xc1d33d[_0xbf2c('0xa6')]=_0xc1d33d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xbf2c('0xa7')]=function(_0x22e4d2){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xa8'),_0x22e4d2[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x22e4d2[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20text\x20configured');}var _0x329850='\x22'+_0x22e4d2[_0xbf2c('0x5c')]+'\x22';if(this[_0xbf2c('0x83')](_0x22e4d2[_0xbf2c('0x77')])){_0x329850+=','+_0x22e4d2[_0xbf2c('0x77')];}var _0x46fe81=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xab'),_0x329850);if(_0x46fe81[_0xbf2c('0xa3')]===-0x1){return _0x46fe81;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xac'),_0x329850));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xad')]=function(_0xe2c49d){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xae'),_0xe2c49d['label']));if(!this[_0xbf2c('0x83')](_0xe2c49d[_0xbf2c('0xaf')])){return this['channel'][_0xbf2c('0xaa')]('no\x20grammar\x20configured');}var _0x19d7cd=_0xe2c49d[_0xbf2c('0xaf')];if(this[_0xbf2c('0x83')](_0xe2c49d[_0xbf2c('0x77')])){_0x19d7cd+=','+_0xe2c49d[_0xbf2c('0x77')];}var _0x58903d=this[_0xbf2c('0xa')][_0xbf2c('0x56')]('MRCPRecog',_0x19d7cd);if(_0x58903d[_0xbf2c('0xa3')]===-0x1){return _0x58903d;}var _0x1e01dd=this[_0xbf2c('0xa2')](_0xbf2c('0xb0'),_0xbf2c('0xb1'));if(_0x1e01dd[_0xbf2c('0xa3')]===-0x1){return _0x1e01dd;}var _0x12d073=this[_0xbf2c('0xa2')](_0xbf2c('0xb2'),_0xbf2c('0xb3'));if(_0x12d073[_0xbf2c('0xa3')]===-0x1){return _0x12d073;}var _0x5d9ff0=this['getAndSetVariable']('RECOG_INSTANCE()',_0xbf2c('0xb4'));if(_0x5d9ff0[_0xbf2c('0xa3')]===-0x1){return _0x5d9ff0;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x19d7cd));};AGIVertices[_0xbf2c('0x11')]['agi']=function(_0xe900e3){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xb5'),_0xe900e3['label']));return this[_0xbf2c('0xa')][_0xbf2c('0xb6')]([_0xe900e3[_0xbf2c('0xb7')],_0xe900e3[_0xbf2c('0xb8')]]);};AGIVertices[_0xbf2c('0x11')]['answer']=function(_0x423363){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0xb9'),_0x423363[_0xbf2c('0xa9')]));if(this['isConfigured'](_0x423363[_0xbf2c('0x67')])){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xba'),_0x423363[_0xbf2c('0x67')]));var _0x2f996d=this[_0xbf2c('0xa')][_0xbf2c('0xbb')](_0x423363[_0xbf2c('0x67')]);if(_0x2f996d['result']===-0x1){return _0x2f996d;}}return this[_0xbf2c('0xa')]['answer']();};AGIVertices[_0xbf2c('0x11')]['callback']=function(_0x1aa6fa){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xbc'),_0x1aa6fa[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x1aa6fa[_0xbf2c('0x48')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x1aa6fa,'no\x20list\x20selected');}_0x1aa6fa[_0xbf2c('0x4a')]=moment();if(this[_0xbf2c('0x83')](_0x1aa6fa[_0xbf2c('0xbd')])){_0x1aa6fa[_0xbf2c('0x4a')]=moment()[_0xbf2c('0xbe')](_0x1aa6fa['delay'],'minutes');}if(!this['isConfigured'](_0x1aa6fa[_0xbf2c('0xbf')])){_0x1aa6fa[_0xbf2c('0xbf')]=0x2;}this['createCmContact'][_0xbf2c('0x6d')](this,_0x1aa6fa);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xc0'),_0x1aa6fa[_0xbf2c('0x47')],_0x1aa6fa[_0xbf2c('0x48')],_0x1aa6fa[_0xbf2c('0x4a')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xc1')]=function(_0x13ce54){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0xc2'),_0x13ce54[_0xbf2c('0xa9')]));var _0x22cd78=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0x13ce54[_0xbf2c('0xc3')],_0x13ce54[_0xbf2c('0x77')]);if(_0x22cd78['result']===-0x1){return _0x22cd78;}return this['channel']['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0x13ce54['application'],_0x13ce54[_0xbf2c('0x77')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xc5')]=function(_0x2e893d){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0xc6'),_0x2e893d[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x2e893d[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}var _0x1e2f41='\x22'+_0x2e893d['text']+'\x22';if(this[_0xbf2c('0x83')](_0x2e893d[_0xbf2c('0x77')])){_0x1e2f41+=','+_0x2e893d[_0xbf2c('0x77')];}var _0xb4138f=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xab'),_0x1e2f41);if(_0xb4138f[_0xbf2c('0xa3')]===-0x1){return _0xb4138f;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xac'),_0x1e2f41));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xc8')]=function(_0x4a9ebe){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xc9'),_0x4a9ebe['label']));if(!this[_0xbf2c('0x83')](_0x4a9ebe['text'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}var _0x2fae4e='\x22'+_0x4a9ebe[_0xbf2c('0x5c')]+'\x22';if(this[_0xbf2c('0x83')](_0x4a9ebe[_0xbf2c('0x77')])){_0x2fae4e+=','+_0x4a9ebe[_0xbf2c('0x77')];}var _0x58a3e2=this[_0xbf2c('0xa')][_0xbf2c('0x56')]('MRCPSynth',_0x2fae4e);if(_0x58a3e2[_0xbf2c('0xa3')]===-0x1){return _0x58a3e2;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xac'),_0x2fae4e));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xca')]=function(_0xc417d1){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xcb'),_0xc417d1[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0xc417d1[_0xbf2c('0xaf')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20grammar\x20configured');}var _0x1a8f9a=_0xc417d1[_0xbf2c('0xaf')];if(this[_0xbf2c('0x83')](_0xc417d1[_0xbf2c('0x77')])){_0x1a8f9a+=','+_0xc417d1['options'];}var _0x10d96a=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xcc'),_0x1a8f9a);if(_0x10d96a[_0xbf2c('0xa3')]===-0x1){return _0x10d96a;}var _0x24976d=this[_0xbf2c('0xa2')](_0xbf2c('0xb0'),_0xbf2c('0xcd'));if(_0x24976d[_0xbf2c('0xa3')]===-0x1){return _0x24976d;}var _0x45a0dc=this[_0xbf2c('0xa2')](_0xbf2c('0xb2'),_0xbf2c('0xce'));if(_0x45a0dc['result']===-0x1){return _0x45a0dc;}var _0xcce9be=this[_0xbf2c('0xa2')](_0xbf2c('0xcf'),_0xbf2c('0xd0'));if(_0xcce9be[_0xbf2c('0xa3')]===-0x1){return _0xcce9be;}return this['channel']['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xd1'),_0x1a8f9a));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xd2')]=function(_0x160bbf){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xd3'),_0x160bbf[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x160bbf['grammar'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xd4'));}var _0x5b6f66=_0x160bbf[_0xbf2c('0xaf')];if(this['isConfigured'](_0x160bbf[_0xbf2c('0x77')])){_0x5b6f66+=','+_0x160bbf[_0xbf2c('0x77')];}var _0x5d78df=this[_0xbf2c('0xa')]['exec'](_0xbf2c('0xcc'),_0x5b6f66);if(_0x5d78df[_0xbf2c('0xa3')]===-0x1){return _0x5d78df;}var _0xef9d1e=this['getAndSetVariable'](_0xbf2c('0xb0'),_0xbf2c('0xd5'));if(_0xef9d1e[_0xbf2c('0xa3')]===-0x1){return _0xef9d1e;}var _0x1e846d=this[_0xbf2c('0xa2')](_0xbf2c('0xb2'),_0xbf2c('0xd6'));if(_0x1e846d[_0xbf2c('0xa3')]===-0x1){return _0x1e846d;}var _0x4cedd9=this[_0xbf2c('0xa2')]('RECOG_INSTANCE()',_0xbf2c('0xd7'));if(_0x4cedd9[_0xbf2c('0xa3')]===-0x1){return _0x4cedd9;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5b6f66));};AGIVertices[_0xbf2c('0x11')]['database']=function(_0x31c9bf){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0xd8'),_0x31c9bf[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x31c9bf[_0xbf2c('0xd9')])){return this['channel'][_0xbf2c('0x30')](_0x31c9bf,_0xbf2c('0xda'));}var _0x27e07e=this[_0xbf2c('0xdb')][_0xbf2c('0x6d')](this,_0x31c9bf[_0xbf2c('0xd9')]);if(!_0x27e07e){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x31c9bf,_0xbf2c('0xdc'));}if(!this['isConfigured'](_0x31c9bf[_0xbf2c('0xdd')])){return this[_0xbf2c('0xa')]['error'](_0x31c9bf,'no\x20query\x20configured');}var _0x58ee7d=_0x31c9bf[_0xbf2c('0xdd')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xde'),_0x58ee7d));var _0x4d77ad=this['getQueryOdbc'][_0xbf2c('0x6d')](this,_0x27e07e,_0x58ee7d);this[_0xbf2c('0x35')]['sync'](this,_0x31c9bf,_0x58ee7d);if(!this['isConfigured'](_0x31c9bf[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1e6bce=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x31c9bf['variable_id']);if(!_0x1e6bce){return this['channel']['error'](_0x31c9bf,_0xbf2c('0xe0'));}var _0x5159db=this;_0x4d77ad['forEach'](function(_0x2594a9,_0x27ee3b){Object['keys'](_0x2594a9)[_0xbf2c('0xe1')](function(_0x4527d4){_0x5159db['channel']['setVariable'](util[_0xbf2c('0x28')](_0xbf2c('0xe2'),_0x1e6bce,_0x27ee3b,_0x4527d4),_0x2594a9[_0x4527d4]);});});this['channel']['setVariable'](util['format'](_0xbf2c('0xe3'),_0x1e6bce),_0x4d77ad[_0xbf2c('0x9c')]);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xe4'),_0x1e6bce));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xe5')]=function(_0x12dd7d){logger[_0xbf2c('0xe6')](util['format'](_0xbf2c('0xe7'),_0x12dd7d[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x12dd7d[_0xbf2c('0xe8')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x12dd7d,'no\x20user\x20selected');}var _0x143bd5=this[_0xbf2c('0x18')]['sync'](this,_0x12dd7d[_0xbf2c('0xe8')]);if(!_0x143bd5){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x12dd7d,'no\x20user\x20found');}var _0x5e8b20=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xe9'),[util['format'](_0xbf2c('0xea'),_0x143bd5),_0x12dd7d['timeout'],_0x12dd7d[_0xbf2c('0xeb')],_0x12dd7d[_0xbf2c('0x65')]]);if(_0x5e8b20[_0xbf2c('0xa3')]===-0x1){return _0x5e8b20;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xec'),_0xbf2c('0xe9')));};AGIVertices['prototype']['dialogflow']=function(_0x49f2b1){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x49f2b1[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x49f2b1[_0xbf2c('0xed')])){return this['channel']['noop'](_0xbf2c('0xee'));}if(!this[_0xbf2c('0x83')](_0x49f2b1[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20text\x20configured');}this[_0xbf2c('0xa')][_0xbf2c('0xef')]=!![];this[_0xbf2c('0x35')](_0x49f2b1);this['createSquareMessage'](_0x49f2b1['text'],'in','','');this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xf0'),_0x49f2b1[_0xbf2c('0x5c')]));var _0x585ac3=this['googleDialogflow'][_0xbf2c('0x6d')](this,_0x49f2b1);if(_0x585ac3){for(var _0x4f5f15 in _0x585ac3){if(_0x585ac3[_0xbf2c('0x95')](_0x4f5f15)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')]('DIALOGFLOW_%s',_0x4f5f15[_0xbf2c('0x69')]()),_0x585ac3[_0x4f5f15]);}}this['createSquareMessage'](_0x585ac3['speech'],'out',_0xbf2c('0xf1'),'');return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xf2'),_0x585ac3[_0xbf2c('0xf3')]));}return this[_0xbf2c('0xa')]['error'](_0x49f2b1,_0xbf2c('0xf4'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xf5')]=function(_0x23fb7){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x23fb7[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x23fb7[_0xbf2c('0xf6')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xf7'));}if(!this['isConfigured'](_0x23fb7[_0xbf2c('0x7b')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xf8'));}if(!this[_0xbf2c('0x83')](_0x23fb7[_0xbf2c('0x7c')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xf9'));}if(!this[_0xbf2c('0x83')](_0x23fb7[_0xbf2c('0x7d')])){return this['channel']['noop'](_0xbf2c('0xfa'));}if(!this['isConfigured'](_0x23fb7[_0xbf2c('0x5c')])){return this['channel'][_0xbf2c('0xaa')]('no\x20text\x20configured');}this[_0xbf2c('0xa')][_0xbf2c('0xef')]=!![];this[_0xbf2c('0x35')](_0x23fb7);this[_0xbf2c('0x40')](_0x23fb7[_0xbf2c('0x5c')],'in','','');this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xfb'),_0x23fb7['text']));var _0x33441d=this[_0xbf2c('0x7a')][_0xbf2c('0x6d')](this,_0x23fb7);if(_0x33441d){for(var _0x245ca7 in _0x33441d){if(_0x33441d[_0xbf2c('0x95')](_0x245ca7)){if(_0x245ca7!==_0xbf2c('0xfc')){this[_0xbf2c('0xa')]['setVariable'](util[_0xbf2c('0x28')]('DIALOGFLOW_%s',_0x245ca7[_0xbf2c('0x69')]()),_0x33441d[_0x245ca7]);}}}this['createSquareMessage'](_0x33441d['speech'],'out',_0xbf2c('0xf5'),_0x33441d[_0xbf2c('0xfc')]);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xfd'),_0x33441d['speech']));}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x23fb7,_0xbf2c('0xfe'));};AGIVertices['prototype'][_0xbf2c('0xff')]=function(_0x107900){logger['info'](util[_0xbf2c('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x107900[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x107900['ndauth_url'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x100'));}if(!this[_0xbf2c('0x83')](_0x107900[_0xbf2c('0x101')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20username\x20configured');}if(!this[_0xbf2c('0x83')](_0x107900[_0xbf2c('0x102')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x103'));}if(!this[_0xbf2c('0x83')](_0x107900[_0xbf2c('0x104')])){return this['channel']['noop'](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')]['bot']=!![];this[_0xbf2c('0x35')](_0x107900);this[_0xbf2c('0x40')](_0x107900['text'],'in','','');this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x105'),_0x107900['text']));var _0x3bef1b=this[_0xbf2c('0x7e')]['sync'](this,_0x107900);if(_0x3bef1b){for(var _0x3733a1 in _0x3bef1b){if(_0x3bef1b[_0xbf2c('0x95')](_0x3733a1)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')](_0xbf2c('0x106'),_0x3733a1[_0xbf2c('0x69')]()),_0x3bef1b[_0x3733a1]);}}this[_0xbf2c('0x40')](_0x3bef1b[_0xbf2c('0xf3')],_0xbf2c('0x107'),_0xbf2c('0xff'),'');if(_0x3bef1b[_0xbf2c('0x108')]){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x109'),_0x3bef1b[_0xbf2c('0x108')]));var _0x2d17ad=this['channel'][_0xbf2c('0x10a')](_0x3bef1b[_0xbf2c('0x108')]);try{fs[_0xbf2c('0x10b')](_0x3bef1b[_0xbf2c('0x108')]+_0xbf2c('0x10c'));}catch(_0xdd33ed){logger['error'](_0xdd33ed);}return _0x2d17ad;}else{return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x10d'),_0x3bef1b[_0xbf2c('0xf3')]));}}return this[_0xbf2c('0xa')]['error'](_0x107900,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x10e')]=function(_0x31aba3){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x31aba3['label']));return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0x10e'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x10f')]=function(_0x36de13){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x110'),_0x36de13['label']));var _0x435f75='';if(_0x36de13[_0xbf2c('0x111')]){if(!this[_0xbf2c('0x83')](_0x36de13[_0xbf2c('0x111')])){return this['channel']['error'](_0x36de13,_0xbf2c('0x112'));}else{var _0x4ba605=parseInt(_0x36de13['trunk_id'],0xa);if(isNaN(_0x4ba605)){_0x435f75=_0x36de13[_0xbf2c('0x111')];}else{_0x435f75=this[_0xbf2c('0x1a')][_0xbf2c('0x6d')](this,_0x36de13[_0xbf2c('0x111')]);if(!_0x435f75){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36de13,'no\x20trunk\x20found');}}}}else if(_0x36de13[_0xbf2c('0x113')]){_0x435f75=_0x36de13[_0xbf2c('0x113')];}else{return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36de13,_0xbf2c('0x112'));}var _0x2533b7=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0xe9'),[util['format'](_0xbf2c('0x114'),_0x435f75,_0x36de13[_0xbf2c('0x47')]),_0x36de13[_0xbf2c('0x67')],_0x36de13['opts'],_0x36de13['url']]);if(_0x2533b7[_0xbf2c('0xa3')]===-0x1){return _0x2533b7;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xec'),_0xbf2c('0xe9')));};AGIVertices[_0xbf2c('0x11')]['finally']=function(_0x2fb53e){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x115'),_0x2fb53e[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x116'));};AGIVertices['prototype'][_0xbf2c('0x9')]=function(_0x4805ce){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x117'),_0x4805ce['label']));if(_0x4805ce[_0xbf2c('0xa6')]===0x0){return this[_0xbf2c('0xa5')](_0x4805ce);}_0x4805ce[_0xbf2c('0xa6')]-=0x1;if(!this[_0xbf2c('0x83')](_0x4805ce[_0xbf2c('0x118')])){return this['channel'][_0xbf2c('0x30')](_0x4805ce,_0xbf2c('0x119'));}var _0x423782=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x4805ce[_0xbf2c('0x118')]);if(!_0x423782){return this[_0xbf2c('0xa')]['error'](_0x4805ce,_0xbf2c('0x11a'));}if(!this[_0xbf2c('0x83')](_0x4805ce[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xbf2c('0x11b'));}var _0x4ad19f=this[_0xbf2c('0xa')][_0xbf2c('0x11c')](_0x423782,_0x4805ce['response'],_0x4805ce[_0xbf2c('0x11d')]);var _0x50749b=_0x4ad19f[_0xbf2c('0xa3')]?_0x4ad19f[_0xbf2c('0xa3')][_0xbf2c('0x4b')]():'';logger[_0xbf2c('0x2c')](_0xbf2c('0x11e'),JSON['stringify'](_0x4ad19f));if(_0x4ad19f[_0xbf2c('0xa3')]===-0x1){this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,_0x50749b);return _0x4ad19f;}else if(_0x4ad19f[_0xbf2c('0xa1')]===_0xbf2c('0x67')){_0x4ad19f[_0xbf2c('0xa3')]=_0x50749b['length']>=parseInt(_0x4805ce[_0xbf2c('0x11f')])?'x':'i';}else{_0x4ad19f[_0xbf2c('0xa3')]=_0x50749b[_0xbf2c('0x9c')]>=parseInt(_0x4805ce['mindigit'])&&_0x50749b['length']<=parseInt(_0x4805ce[_0xbf2c('0x11d')])?'x':'i';}var _0x1c9bfa=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x4805ce[_0xbf2c('0xdf')]);if(!_0x1c9bfa){return this['channel']['error'](_0x4805ce,_0xbf2c('0xe0'));}this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0x1c9bfa,_0x50749b);if(this[_0xbf2c('0x83')](_0x4805ce['hiddendigitsnum'])){var _0x35f94e=parseInt(_0x4805ce[_0xbf2c('0x120')],0xa);var _0x4a3436=rs['generate']({'charset':'*','length':_0x35f94e});var _0xc947c3=_0x50749b['length'];if(_0xc947c3>0x0){if(_0xc947c3>_0x35f94e){this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,_0x4805ce[_0xbf2c('0x121')]===_0xbf2c('0x122')?_0x4a3436+_0x50749b[_0xbf2c('0x123')](_0x35f94e):_0x50749b[_0xbf2c('0x123')](0x0,_0xc947c3-_0x35f94e)+_0x4a3436);}else{this[_0xbf2c('0x35')]['sync'](this,_0x4805ce,rs[_0xbf2c('0x124')]({'charset':'*','length':_0xc947c3}));}}else{this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,'');}}else{this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x4805ce,_0x50749b);}return _0x4ad19f;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x125')]=function(_0x3f6110){logger['info'](util[_0xbf2c('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3f6110[_0xbf2c('0xa9')]));return this['getdigits'](_0x3f6110);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x126')]=function(_0x25b6d9){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x127'),_0x25b6d9['label']));this['createSquareDetailsReport'][_0xbf2c('0x6d')](this,_0x25b6d9,_0x25b6d9[_0xbf2c('0x128')]);return this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x129'),_0x25b6d9[_0xbf2c('0x128')]));};AGIVertices['prototype']['awspolly']=function(_0x339aa3){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x12a'),_0x339aa3[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x339aa3[_0xbf2c('0x86')])||!this[_0xbf2c('0x83')](_0x339aa3['aws_secret_access_key'])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x12b'));}if(!this[_0xbf2c('0x83')](_0x339aa3[_0xbf2c('0x5c')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x12c'),_0x339aa3['text']));var _0x58a40a=this[_0xbf2c('0x85')][_0xbf2c('0x6d')](this,_0x339aa3);if(_0x58a40a){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x12d'),_0x58a40a));var _0x27b274=this[_0xbf2c('0xa')]['streamFile'](_0x58a40a);try{fs[_0xbf2c('0x10b')](_0x58a40a+_0xbf2c('0x10c'));}catch(_0x2d0e30){logger['error'](_0x2d0e30);}return _0x27b274;}return this['channel'][_0xbf2c('0x30')](_0x339aa3,_0xbf2c('0x12e'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x12f')]=function(_0x5627b7){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x130'),_0x5627b7[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x5627b7['aws_access_key_id'])||!this[_0xbf2c('0x83')](_0x5627b7[_0xbf2c('0x87')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0x12b'));}if(!this[_0xbf2c('0x83')](_0x5627b7[_0xbf2c('0x8d')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x131'));}if(!this[_0xbf2c('0x83')](_0x5627b7[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')][_0xbf2c('0xef')]=!![];this[_0xbf2c('0x35')](_0x5627b7);this[_0xbf2c('0x40')](_0x5627b7['text'],'in','','');this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x132'),_0x5627b7['text']));var _0x477a33=this[_0xbf2c('0x8c')][_0xbf2c('0x6d')](this,_0x5627b7);if(_0x477a33){for(var _0x2e735b in _0x477a33){if(_0x477a33[_0xbf2c('0x95')](_0x2e735b)&&_[_0xbf2c('0x96')](_0x477a33[_0x2e735b])){this[_0xbf2c('0xa')]['setVariable'](util[_0xbf2c('0x28')]('AWS_LEX_%s',_0x2e735b[_0xbf2c('0x69')]()),_0x477a33[_0x2e735b]);}}if(_[_0xbf2c('0x43')](_0x477a33[_0xbf2c('0x75')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xbf2c('0x40')](_0x477a33['message'],'out',_0xbf2c('0x133'),'');return this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x134'),_0x477a33[_0xbf2c('0x75')]));}}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x5627b7,_0xbf2c('0x135'));};AGIVertices['prototype'][_0xbf2c('0x136')]=function(_0xbb10d3){logger['info'](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xbb10d3[_0xbf2c('0xa9')],_0xbb10d3['timeout']));if(!this[_0xbf2c('0x83')](_0xbb10d3[_0xbf2c('0xed')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0xee'));}var _0x15f135='wav';var _0x49c222=util[_0xbf2c('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xbf2c('0x124')](0x4));var _0x5e4a6d=util[_0xbf2c('0x28')](_0xbf2c('0x9f'),_0x49c222,_0x15f135);var _0x2d8d40=!![];if(_0xbb10d3['beep']===_0xbf2c('0x137')){_0x2d8d40=![];}var _0x5f101c=this['channel'][_0xbf2c('0x138')](_0x49c222,_0x15f135,_0xbb10d3[_0xbf2c('0x139')],_0xbb10d3[_0xbf2c('0x67')],undefined,_0x2d8d40);if(_0x5f101c[_0xbf2c('0xa3')]!==-0x1){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x13a'),_0x5e4a6d));var _0x17e895=this[_0xbf2c('0x8e')][_0xbf2c('0x6d')](this,_0xbb10d3,_0x5e4a6d);if(_0x17e895){for(var _0x3b371c in _0x17e895){if(_0x17e895[_0xbf2c('0x95')](_0x3b371c)){this[_0xbf2c('0xa')]['setVariable'](util[_0xbf2c('0x28')](_0xbf2c('0x13b'),_0x3b371c['toUpperCase']()),_0x17e895[_0x3b371c]);}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x13c'),JSON['stringify'](_0x17e895)));}}return _0x5f101c;};AGIVertices[_0xbf2c('0x11')]['tildeasr']=function(_0x52092c){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x13d'),_0x52092c[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x52092c['appid'])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x13e'));}if(!this[_0xbf2c('0x83')](_0x52092c[_0xbf2c('0x92')])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x13f'));}var _0x3b7aba=_0xbf2c('0x140');var _0x52d27c=util[_0xbf2c('0x28')](_0xbf2c('0x141'),FILES_PATH,rs['generate'](0x4));var _0x30caac=util[_0xbf2c('0x28')]('%s.%s',_0x52d27c,_0x3b7aba);var _0x1a00a7=!![];if(_0x52092c['beep']==='NOBEEP'){_0x1a00a7=![];}var _0x5e54c3=this[_0xbf2c('0xa')][_0xbf2c('0x138')](_0x52d27c,_0x3b7aba,_0x52092c[_0xbf2c('0x139')],_0x52092c[_0xbf2c('0x67')],undefined,_0x1a00a7);if(_0x5e54c3[_0xbf2c('0xa3')]!==-0x1){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('tilde\x20%s\x20file\x20created',_0x30caac));var _0x26e26c=this[_0xbf2c('0x90')][_0xbf2c('0x6d')](this,_0x52092c,_0x30caac);if(_0x26e26c){for(var _0x522ae5 in _0x26e26c){if(_0x26e26c[_0xbf2c('0x95')](_0x522ae5)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')](_0xbf2c('0x142'),_0x522ae5[_0xbf2c('0x69')]()),_0x26e26c[_0x522ae5]);}}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x143'),JSON['stringify'](_0x26e26c)));}}return _0x5e54c3;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x144')]=function(_0x5f1fad){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x145'),_0x5f1fad[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')][_0xbf2c('0x146')](_0x5f1fad[_0xbf2c('0x3b')],_0x5f1fad[_0xbf2c('0x147')],_0x5f1fad[_0xbf2c('0x148')]);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x149')]=function(_0xadc128){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x14a'),_0xadc128[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0xadc128[_0xbf2c('0x14b')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xadc128,_0xbf2c('0x14c'));}try{var _0x5db225=eval(_0xadc128[_0xbf2c('0x14b')])?_0xbf2c('0x14d'):'false';this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x14e'),_0xadc128[_0xbf2c('0x14b')],_0x5db225));return{'code':0xc8,'result':_0x5db225};}catch(_0x3db097){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xbf2c('0x14f')]=function(_0xdb98a0){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x150'),_0xdb98a0[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0xdb98a0[_0xbf2c('0x151')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xdb98a0,_0xbf2c('0x152'));}var _0x4b8b3e=this[_0xbf2c('0x22')][_0xbf2c('0x6d')](this,_0xdb98a0[_0xbf2c('0x151')]);if(!_0x4b8b3e){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0xdb98a0,_0xbf2c('0x153'));}for(var _0x5eabfe=0x0;_0x5eabfe<_0x4b8b3e[_0xbf2c('0x9c')];_0x5eabfe+=0x1){var _0x131fce=this[_0xbf2c('0xa')][_0xbf2c('0xd')](util[_0xbf2c('0x28')]('IFTIME(%s?true:false)',_0x4b8b3e[_0x5eabfe]));if(_0x131fce[_0xbf2c('0xa3')]===-0x1){return _0x131fce;}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0x131fce[_0xbf2c('0xa1')]));if(_0x131fce[_0xbf2c('0xa1')]==='true'){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0xbf2c('0x14d')));this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')]('IFTIME\x20%s\x20%s',_0x4b8b3e[_0x5eabfe],_0xbf2c('0x14d')));return{'code':0xc8,'result':_0xbf2c('0x14d')};}else{logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0xbf2c('0x155')));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x154'),_0x4b8b3e[_0x5eabfe],_0xbf2c('0x155')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xbf2c('0x156')]=function(_0x71a955){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x157'),_0x71a955['label']));return this[_0xbf2c('0xa')][_0xbf2c('0x156')]();};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x158')]=function(_0x1d9e50){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1d9e50['label']));if(!this['isConfigured'](_0x1d9e50[_0xbf2c('0xed')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20key\x20configured');}var _0xeb8a4a=_0xbf2c('0x140');var _0x52d048=util['format'](_0xbf2c('0x141'),FILES_PATH,rs['generate'](0x4));var _0x187999=util[_0xbf2c('0x28')](_0xbf2c('0x9f'),_0x52d048,_0xeb8a4a);var _0x2aebb7=!![];if(_0x1d9e50[_0xbf2c('0x159')]===_0xbf2c('0x137')){_0x2aebb7=![];}var _0x38bf99=this[_0xbf2c('0xa')]['recordFile'](_0x52d048,_0xeb8a4a,_0x1d9e50['intKey'],_0x1d9e50[_0xbf2c('0x67')],undefined,_0x2aebb7);if(_0x38bf99[_0xbf2c('0xa3')]!==-0x1){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x15a'),_0x187999));var _0x50f3f8=this[_0xbf2c('0x81')][_0xbf2c('0x6d')](this,_0x1d9e50,_0x187999);if(_0x50f3f8){for(var _0x49b4d9 in _0x50f3f8){if(_0x50f3f8['hasOwnProperty'](_0x49b4d9)){this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')](_0xbf2c('0x15b'),_0x49b4d9[_0xbf2c('0x69')]()),_0x50f3f8[_0x49b4d9]);}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0xbf2c('0x71')](_0x50f3f8)));}}return _0x38bf99;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x15c')]=function(_0x477c73){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x15d'),_0x477c73[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x477c73[_0xbf2c('0xed')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0xee'));}if(!this[_0xbf2c('0x83')](_0x477c73['text'])){return this[_0xbf2c('0xa')]['noop'](_0xbf2c('0xc7'));}this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x15e'),_0x477c73[_0xbf2c('0x5c')]));var _0x3eb2d4=this['ispeechTTS'][_0xbf2c('0x6d')](this,_0x477c73);if(_0x3eb2d4){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('ispeech\x20%s\x20file\x20created',_0x3eb2d4));var _0x2bb820=this[_0xbf2c('0xa')][_0xbf2c('0x10a')](_0x3eb2d4,_0x477c73[_0xbf2c('0x139')]);try{fs[_0xbf2c('0x10b')](_0x3eb2d4+_0xbf2c('0x10c'));}catch(_0x49534d){logger[_0xbf2c('0x30')](_0x49534d);}return _0x2bb820;}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x477c73,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbf2c('0x11')]['login']=function(_0x584c87){logger['info'](util['format'](_0xbf2c('0x15f'),_0x584c87[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x584c87[_0xbf2c('0x160')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x584c87,_0xbf2c('0x161'));}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x162'),this[_0xbf2c('0xa')]['callerid'],_0x584c87[_0xbf2c('0x160')]));var _0xc887b3=this['agentLogin'][_0xbf2c('0x6d')](this,_0x584c87[_0xbf2c('0x160')]);if(_0xc887b3){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));this['channel'][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x163'),this['channel'][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x164')};}else{logger[_0xbf2c('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this['channel'][_0xbf2c('0x39')],_0x584c87[_0xbf2c('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x166')]=function(_0x344a9a){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x167'),_0x344a9a[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x344a9a[_0xbf2c('0x160')])){return this['channel'][_0xbf2c('0x30')](_0x344a9a,_0xbf2c('0x161'));}logger[_0xbf2c('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));var _0x255a49=this['agentLogout'][_0xbf2c('0x6d')](this,_0x344a9a[_0xbf2c('0x160')]);if(_0x255a49){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this['channel'][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x163'),this[_0xbf2c('0xa')]['callerid'],_0x344a9a[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x164')};}else{logger['info'](util[_0xbf2c('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x344a9a[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x168')};}};AGIVertices['prototype'][_0xbf2c('0x169')]=function(_0x4645b0){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x16a'),_0x4645b0['label']));if(!this[_0xbf2c('0x83')](_0x4645b0['operation'])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4645b0,_0xbf2c('0x16b'));}this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('math\x20%s',_0x4645b0[_0xbf2c('0x16c')]));var _0x15635d=eval(_0x4645b0['operation']);if(!this['isConfigured'](_0x4645b0[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x11b'));}var _0xd33ce8=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x4645b0[_0xbf2c('0xdf')]);if(!_0xd33ce8){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4645b0,'no\x20variable\x20found');}if(_[_0xbf2c('0x9b')](_0x15635d)){var _0x6bee32=this;_0x15635d[_0xbf2c('0xe1')](function(_0x5239d7,_0x450929){_0x6bee32['channel'][_0xbf2c('0x9e')](util[_0xbf2c('0x28')]('%s[%s]',_0xd33ce8,_0x450929),_0x5239d7);});return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x16d'),_0xd33ce8));}else{return this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0xd33ce8,_0x15635d);}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x16e')]=function(_0x366dee){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x366dee[_0xbf2c('0xa9')]));if(_0x366dee['retry']===0x0){return this['maxRetry'](_0x366dee);}_0x366dee[_0xbf2c('0xa6')]-=0x1;if(!this[_0xbf2c('0x83')](_0x366dee[_0xbf2c('0x118')])){return this[_0xbf2c('0xa')]['error'](_0x366dee,_0xbf2c('0x119'));}var _0x253fa4=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x366dee[_0xbf2c('0x118')]);if(!_0x253fa4){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x366dee,_0xbf2c('0x11a'));}var _0x13f9b0=this['channel'][_0xbf2c('0x11c')](_0x253fa4,_0x366dee[_0xbf2c('0x16f')],_0x366dee[_0xbf2c('0x170')]);var _0xc2d501=_0x13f9b0[_0xbf2c('0xa3')];if(_0x13f9b0[_0xbf2c('0xa3')]===-0x1){this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x366dee,'-1');return _0x13f9b0;}else if(_0x13f9b0['extra']===_0xbf2c('0x67')){_0x13f9b0[_0xbf2c('0xa3')]=_0x13f9b0[_0xbf2c('0xa3')][_0xbf2c('0x9c')]>0x0?_0x13f9b0[_0xbf2c('0xa3')]:'t';}else if(_['isEmpty'](_0x13f9b0[_0xbf2c('0xa3')])){_0x13f9b0[_0xbf2c('0xa3')]='#';_0xc2d501='#';}if(!this[_0xbf2c('0x83')](_0x366dee[_0xbf2c('0xdf')])){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x11b'));}else{var _0x4dd09c=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x366dee[_0xbf2c('0xdf')]);if(!_0x4dd09c){return this[_0xbf2c('0xa')]['error'](_0x366dee,_0xbf2c('0xe0'));}this['channel'][_0xbf2c('0x9e')](_0x4dd09c,_0xc2d501);}this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x366dee,_0xc2d501);return _0x13f9b0;};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0xaa')]=function(_0x1147cc){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x171'),_0x1147cc['label']));return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0x1147cc[_0xbf2c('0x172')]||_0x1147cc[_0xbf2c('0xa9')]);};AGIVertices[_0xbf2c('0x11')]['pause']=function(_0x338046){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x173'),_0x338046['label']));if(!this[_0xbf2c('0x83')](_0x338046['findBy'])){return this[_0xbf2c('0xa')]['error'](_0x338046,_0xbf2c('0x161'));}logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf2c('0xa')]['callerid'],_0x338046[_0xbf2c('0x160')]));var _0x1e56a1=this[_0xbf2c('0x4c')][_0xbf2c('0x6d')](this,_0x338046['pause_id']);var _0x5c4110=this[_0xbf2c('0x174')][_0xbf2c('0x6d')](this,_0x338046['findBy'],_0x1e56a1);if(_0x5c4110){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x338046[_0xbf2c('0x160')]));this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x163'),this[_0xbf2c('0xa')]['callerid'],_0x338046[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x164')};}else{logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x338046['findBy']));this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x338046[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x168')};}};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x175')]=function(_0x16ca34){logger['info'](util['format'](_0xbf2c('0x176'),_0x16ca34[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x16ca34[_0xbf2c('0x118')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x16ca34,_0xbf2c('0x119'));}var _0x5d7e46=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x16ca34['file_id']);if(!_0x5d7e46){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x16ca34,_0xbf2c('0x11a'));}var _0x279159=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0x177'),[_0x5d7e46,_0x16ca34[_0xbf2c('0xeb')]]);if(_0x279159[_0xbf2c('0xa3')]===-0x1){return _0x279159;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0xbf2c('0x177'),_0x5d7e46));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x178')]=function(_0x4844df){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x179'),_0x4844df[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x4844df['queue_id'])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4844df,'no\x20queue\x20selected');}var _0x58a56e='';var _0x230cbb=parseInt(_0x4844df[_0xbf2c('0x17a')],0xa);if(isNaN(_0x230cbb)){_0x58a56e=_0x4844df['queue_id'];}else{_0x58a56e=this[_0xbf2c('0x12')][_0xbf2c('0x6d')](this,_0x4844df[_0xbf2c('0x17a')]);if(!_0x58a56e){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x4844df,_0xbf2c('0x17b'));}}var _0x52f031='';if(this[_0xbf2c('0x83')](_0x4844df['file_id'])){var _0x572181=this[_0xbf2c('0x1c')][_0xbf2c('0x6d')](this,_0x4844df[_0xbf2c('0x118')]);if(_0x572181){_0x52f031=_0x572181;}}this[_0xbf2c('0x35')]['sync'](this,_0x4844df,_0x58a56e);if(_0x4844df[_0xbf2c('0xeb')][_0xbf2c('0x17c')]('x')<0x0){_0x4844df[_0xbf2c('0xeb')]+='x';}if(_0x4844df[_0xbf2c('0xeb')]['indexOf']('X')<0x0){_0x4844df[_0xbf2c('0xeb')]+='X';}this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0xbf2c('0x17d'),_0x58a56e?_0x58a56e[_0xbf2c('0x17e')]():'');var _0xdbc96e=this[_0xbf2c('0xa')][_0xbf2c('0x56')](_0xbf2c('0x17f'),[_0x58a56e,_0x4844df[_0xbf2c('0xeb')],_0x4844df[_0xbf2c('0x65')],_0x52f031,_0x4844df[_0xbf2c('0x67')],_0x4844df[_0xbf2c('0xb6')],_0x4844df['macro'],_0x4844df[_0xbf2c('0x180')],'',_0x4844df[_0xbf2c('0x181')]]);if(_0xdbc96e[_0xbf2c('0xa3')]===-0x1){return _0xdbc96e;}return this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0xbf2c('0x17f'),_0x58a56e));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x182')]=function(_0x3c3b99){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x183'),_0x3c3b99['label']));var _0x5d0623=_0x3c3b99[_0xbf2c('0x184')]||_0xbf2c('0x140');var _0x337ed4=util[_0xbf2c('0x28')](_0xbf2c('0x185'),this['channel'][_0xbf2c('0x36')],rs[_0xbf2c('0x124')](0x5));var _0x4cf345=util[_0xbf2c('0x28')](_0xbf2c('0x186'),FILES_PATH,_0x337ed4,_0x5d0623);var _0x38ca70=util['format'](_0xbf2c('0x141'),FILES_PATH,_0x337ed4);this[_0xbf2c('0x38')][_0xbf2c('0x6d')](this,_0x3c3b99,_0x337ed4,_0x4cf345);this[_0xbf2c('0xa')]['setVariable'](_0xbf2c('0x187'),_0x337ed4);logger[_0xbf2c('0x2c')](_0xbf2c('0x188'),_0x38ca70,_0x5d0623,_0x3c3b99['escape_digits'],_0x3c3b99[_0xbf2c('0x67')]);return this[_0xbf2c('0xa')]['recordFile'](_0x38ca70,_0x5d0623,_0x3c3b99[_0xbf2c('0x189')],_0x3c3b99['timeout'],undefined,!![]);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x18a')]=function(_0x9aeb1a){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x18b'),_0x9aeb1a['label']));if(!this['isConfigured'](_0x9aeb1a[_0xbf2c('0x65')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x18c'));}var _0x4202f2=this['restAPI'][_0xbf2c('0x6d')](this,_0x9aeb1a);logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x18d'),util[_0xbf2c('0x18e')](_0x4202f2,{'showHidden':![],'depth':null})));if(!this[_0xbf2c('0x83')](_0x9aeb1a[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x18f'));}var _0x4ee188=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x9aeb1a[_0xbf2c('0xdf')]);if(!_0x4ee188){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x9aeb1a,_0xbf2c('0xe0'));}this[_0xbf2c('0xa')][_0xbf2c('0x9e')](util[_0xbf2c('0x28')]('%s_STATUS_CODE',_0x4ee188),_0x4202f2[_0xbf2c('0x73')]?_0x4202f2[_0xbf2c('0x73')]:_0xbf2c('0x190'));this['channel']['setVariable'](util[_0xbf2c('0x28')](_0xbf2c('0x191'),_0x4ee188),_0x4202f2[_0xbf2c('0x74')]?_0x4202f2[_0xbf2c('0x74')]:'OK');if(_0x4202f2['body']){try{this[_0xbf2c('0x9d')](_0x4202f2[_0xbf2c('0x6a')],_0x4ee188);}catch(_0x3c87fc){logger['error'](util[_0xbf2c('0x28')](_0xbf2c('0x192'),_0x4ee188));}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0xe4'),_0x4ee188));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x193')]=function(_0x543e76){logger['info'](util[_0xbf2c('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x543e76['label']));return this[_0xbf2c('0xa')][_0xbf2c('0x194')](_0x543e76[_0xbf2c('0x195')][_0xbf2c('0x58')](/\s+/g,''),_0x543e76['escape_digits']);};AGIVertices[_0xbf2c('0x11')]['saynumber']=function(_0x3c6bed){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x196'),_0x3c6bed[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')]['sayNumber'](_0x3c6bed[_0xbf2c('0x197')][_0xbf2c('0x58')](/\s+/g,''),_0x3c6bed['escape_digits']);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x198')]=function(_0x348335){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x199'),_0x348335[_0xbf2c('0xa9')]));return this[_0xbf2c('0xa')][_0xbf2c('0x19a')](_0x348335['text'],_0x348335[_0xbf2c('0x189')]);};AGIVertices['prototype'][_0xbf2c('0x19b')]=function(_0x510f0d){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x19c'),_0x510f0d[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x510f0d[_0xbf2c('0x19d')])){return this['channel']['noop'](_0xbf2c('0x19e'));}var _0x4ce3ee=this[_0xbf2c('0x1f')]['sync'](this,_0x510f0d['account_id']);if(!_0x4ce3ee||!_0x4ce3ee[_0xbf2c('0x19f')]){return this['channel'][_0xbf2c('0x30')](_0x510f0d,_0xbf2c('0x1a0'));}var _0x3a3ce9={'from':util['format'](_0xbf2c('0x1a1'),_0x4ce3ee['name'],_0x4ce3ee[_0xbf2c('0x1a2')]||_0x4ce3ee[_0xbf2c('0x19f')]['user']),'to':_0x510f0d['to']||'','cc':_0x510f0d['cc']||'','bcc':_0x510f0d[_0xbf2c('0x1a3')]||'','subject':_0x510f0d[_0xbf2c('0x1a4')],'html':_0x510f0d['text'],'text':_0x510f0d[_0xbf2c('0x5c')]};if(this['isConfigured'](_0x510f0d[_0xbf2c('0x1a5')])){}logger[_0xbf2c('0xe6')](_0xbf2c('0x1a6'),JSON[_0xbf2c('0x71')](_0x3a3ce9));this[_0xbf2c('0x35')]['sync'](this,_0x510f0d,_0x510f0d[_0xbf2c('0x19d')]);this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4ce3ee[_0xbf2c('0x10')]));this[_0xbf2c('0x21')]['sync'](this,_0x4ce3ee[_0xbf2c('0x1a7')],_0x3a3ce9);return this['channel'][_0xbf2c('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xbf2c('0x1a8')]=function(_0xd888e5){logger[_0xbf2c('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xd888e5['label']));return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0x1a9'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1aa')]=function(_0x5ee4c6){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1ab'),_0x5ee4c6['label']));if(!this[_0xbf2c('0x83')](_0x5ee4c6['sms_account_id'])){return this['channel']['noop'](_0xbf2c('0x1ac'));}var _0x14d72a=this[_0xbf2c('0x32')][_0xbf2c('0x6d')](this,_0x5ee4c6['sms_account_id']);if(!_0x14d72a){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x5ee4c6,_0xbf2c('0x1ad'));}var _0x5714a7={'body':_0x5ee4c6[_0xbf2c('0x1ae')],'phone':_0x5ee4c6['to']||'','SmsAccountId':_0x14d72a['id']};logger[_0xbf2c('0xe6')](_0xbf2c('0x1af'),JSON[_0xbf2c('0x71')](_0x5714a7));this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x5ee4c6,_0x5ee4c6[_0xbf2c('0x1b0')]);this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0x1b1'),_0x14d72a['name']));this[_0xbf2c('0x34')][_0xbf2c('0x6d')](this,_0x5714a7);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1b2'));};AGIVertices[_0xbf2c('0x11')]['set']=function(_0x36297d){logger['info'](util['format'](_0xbf2c('0x1b3'),_0x36297d['label']));if(!this[_0xbf2c('0x83')](_0x36297d[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36297d,_0xbf2c('0x1b4'));}var _0x4dc726=this[_0xbf2c('0xd')]['sync'](this,_0x36297d[_0xbf2c('0xdf')]);if(!_0x4dc726){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x36297d,_0xbf2c('0xe0'));}return this[_0xbf2c('0xa')][_0xbf2c('0x9e')](_0x4dc726,_0x36297d[_0xbf2c('0x1b5')]);};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1b6')]=function(_0x4e83c6){logger['info'](util['format'](_0xbf2c('0x1b7'),_0x4e83c6['label']));this[_0xbf2c('0xa')]['noop'](_0xbf2c('0x1b8'));var _0x4c4ee3=this['channel'][_0xbf2c('0xd')](_0xbf2c('0x1b9'));if(!_[_0xbf2c('0x42')](_0x4c4ee3[_0xbf2c('0xa1')])){this[_0xbf2c('0xa')][_0xbf2c('0x36')]=_0x4c4ee3[_0xbf2c('0xa1')];}if(_0x4e83c6['answer']===_0xbf2c('0x1ba')){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1bb'));return this[_0xbf2c('0xa')][_0xbf2c('0x1bc')]();}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1bd'));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1be')]=function(_0x1c54d6){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1bf'),_0x1c54d6[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x1c54d6['project_id'])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x1c54d6,_0xbf2c('0x1c0'));}var _0x495538=this[_0xbf2c('0x13')]['sync'](this,_0x1c54d6[_0xbf2c('0x1c1')]);if(!this[_0xbf2c('0x83')](_0x495538)){return this[_0xbf2c('0xa')]['error'](_0x1c54d6,util[_0xbf2c('0x28')](_0xbf2c('0x1c2'),_0x1c54d6['project_id']));}if(_0x495538===this[_0xbf2c('0xa')][_0xbf2c('0x3e')]){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x1c54d6,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x1c54d6,_0x495538);var _0x53bb39=this['channel'][_0xbf2c('0x56')](_0xbf2c('0x1c3'),util[_0xbf2c('0x28')](_0xbf2c('0x1c4'),config[_0xbf2c('0xb6')]['host']||_0xbf2c('0x1c5'),_0x495538,this[_0xbf2c('0xa')][_0xbf2c('0x3e')]));if(_0x53bb39[_0xbf2c('0xa3')]===-0x1){return _0x53bb39;}return this[_0xbf2c('0xa')]['noop'](util[_0xbf2c('0x28')](_0xbf2c('0xc4'),_0xbf2c('0x1c3'),_0x495538));};AGIVertices['prototype'][_0xbf2c('0x1c6')]=function(_0x2dd74b){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2dd74b[_0xbf2c('0xa9')]));var _0x250522=this[_0xbf2c('0x55')][_0xbf2c('0x6d')](this,_0x2dd74b['command']);this[_0xbf2c('0x35')][_0xbf2c('0x6d')](this,_0x2dd74b,_0x2dd74b['command']);if(this['isConfigured'](_0x2dd74b[_0xbf2c('0xdf')])){var _0x308e8b=this['getVariable'][_0xbf2c('0x6d')](this,_0x2dd74b[_0xbf2c('0xdf')]);if(_0x308e8b){this[_0xbf2c('0xa')]['setVariable'](_0x308e8b,_0x250522);return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2dd74b['command'],_0x308e8b));}}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x1c7'),_0x2dd74b[_0xbf2c('0xb7')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1c8')]=function(_0x5eb1cc){logger[_0xbf2c('0x2c')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5eb1cc[_0xbf2c('0xa9')]));_0x5eb1cc[_0xbf2c('0x5c')]=_0x5eb1cc[_0xbf2c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbf2c('0x83')](_0x5eb1cc[_0xbf2c('0x5a')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](_0xbf2c('0x1c9'));}if(!this[_0xbf2c('0x83')](_0x5eb1cc[_0xbf2c('0x5c')])){return this[_0xbf2c('0xa')][_0xbf2c('0xaa')]('no\x20text\x20configured');}this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format'](_0xbf2c('0x1ca'),_0x5eb1cc[_0xbf2c('0x5c')]));var _0x3e17ad=this[_0xbf2c('0x59')]['sync'](this,_0x5eb1cc);if(_0x3e17ad){this[_0xbf2c('0xa')]['noop'](util['format'](_0xbf2c('0x1cb'),_0x3e17ad));var _0x4fe342=this[_0xbf2c('0xa')][_0xbf2c('0x10a')](_0x3e17ad);try{fs['unlink'](_0x3e17ad+_0xbf2c('0x10c'));}catch(_0x2162f3){logger[_0xbf2c('0x30')](_0x2162f3);}return _0x4fe342;}return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x5eb1cc,_0xbf2c('0x1cc'));};AGIVertices['prototype'][_0xbf2c('0x1cd')]=function(_0xbfad7d){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1ce'),_0xbfad7d[_0xbf2c('0xa9')]));_0xbfad7d[_0xbf2c('0x5c')]=_0xbfad7d[_0xbf2c('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbf2c('0x83')](_0xbfad7d[_0xbf2c('0x5c')])){return this['channel'][_0xbf2c('0xaa')](_0xbf2c('0xc7'));}this['channel'][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Trying\x20Google\x20TTS\x20%s',_0xbfad7d[_0xbf2c('0x5c')]));var _0x366c7d=this['googleTTS'][_0xbf2c('0x6d')](this,_0xbfad7d);if(_0x366c7d){this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x1cf'),_0x366c7d));var _0x4b7ec5=this['channel'][_0xbf2c('0x10a')](_0x366c7d);try{fs[_0xbf2c('0x10b')](_0x366c7d+_0xbf2c('0x10c'));}catch(_0x2afeea){logger[_0xbf2c('0x30')](_0x2afeea);}return _0x4b7ec5;}return this['channel'][_0xbf2c('0x30')](_0xbfad7d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1d0')]=function(_0x48a346){logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x1d1'),_0x48a346[_0xbf2c('0xa9')]));if(!this[_0xbf2c('0x83')](_0x48a346[_0xbf2c('0x160')])){return this[_0xbf2c('0xa')][_0xbf2c('0x30')](_0x48a346,_0xbf2c('0x161'));}logger['info'](util[_0xbf2c('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf2c('0xa')]['callerid'],_0x48a346['findBy']));var _0x4547e6=this[_0xbf2c('0x4f')][_0xbf2c('0x6d')](this,_0x48a346[_0xbf2c('0x160')]);if(_0x4547e6){logger[_0xbf2c('0x2c')](util['format'](_0xbf2c('0x163'),this['channel'][_0xbf2c('0x39')],_0x48a346[_0xbf2c('0x160')]));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x48a346[_0xbf2c('0x160')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this[_0xbf2c('0xa')][_0xbf2c('0x39')],_0x48a346['findBy']));this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')](_0xbf2c('0x165'),this['channel'][_0xbf2c('0x39')],_0x48a346[_0xbf2c('0x160')]));return{'code':0xc8,'result':_0xbf2c('0x168')};}};AGIVertices['prototype'][_0xbf2c('0x1d2')]=function(_0x21d416){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x21d416[_0xbf2c('0xa9')]));var _0x27ceea=this[_0xbf2c('0xa')]['exec'](_0xbf2c('0x1d3'),[_0x21d416[_0xbf2c('0x1d4')],_0x21d416[_0xbf2c('0x77')]]);if(_0x27ceea['result']===-0x1){return _0x27ceea;}return this[_0xbf2c('0xa')][_0xbf2c('0xaa')](util[_0xbf2c('0x28')]('Executed\x20command\x20%s\x20%s',_0xbf2c('0x1d3'),_0x21d416[_0xbf2c('0x1d4')]));};AGIVertices[_0xbf2c('0x11')][_0xbf2c('0x1d5')]=function(_0x1bb25a){logger[_0xbf2c('0x2c')](util[_0xbf2c('0x28')](_0xbf2c('0x1d6'),_0x1bb25a[_0xbf2c('0xa9')]));if(!this['isConfigured'](_0x1bb25a[_0xbf2c('0xdf')])){return this[_0xbf2c('0xa')]['error'](_0x1bb25a,_0xbf2c('0x1b4'));}var _0x13e4f8=this[_0xbf2c('0xd')][_0xbf2c('0x6d')](this,_0x1bb25a[_0xbf2c('0xdf')]);if(!_0x13e4f8){return this['channel'][_0xbf2c('0x30')](_0x1bb25a,'no\x20variable\x20found');}var _0x2afcb0=this[_0xbf2c('0xa')][_0xbf2c('0xd')](_0x13e4f8);return{'code':0xc8,'result':_0x2afcb0[_0xbf2c('0xa1')]?_0x2afcb0[_0xbf2c('0xa1')]:'-'};};String[_0xbf2c('0x11')][_0xbf2c('0x1d7')]=function(_0x5f5d6f,_0xb79022){return this[_0xbf2c('0xa0')](_0x5f5d6f)[_0xbf2c('0x1d8')](_0xb79022);};module[_0xbf2c('0x1d9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 079e1ee..de698b3 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 _0x53ef=['uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','ACW','mandatoryDispositionPause','name','QueuePause','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','[ACW][START]\x20%s','message','getAgent','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x53ef,0x13e));var _0xf53e=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x53ef[_0x57fa33];return _0x12e724;};'use strict';var _=require(_0xf53e('0x0'));var moment=require('moment');var ami=require(_0xf53e('0x1'));var logger=require(_0xf53e('0x2'))(_0xf53e('0x3'));var RpcUser=require(_0xf53e('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5dda47){this['voiceQueues']=_0x5dda47[_0xf53e('0x5')];this[_0xf53e('0x6')]=_0x5dda47[_0xf53e('0x6')];this[_0xf53e('0x7')]=_0x5dda47[_0xf53e('0x7')];this['channels']={};ami['on'](_0xf53e('0x8'),this[_0xf53e('0x9')][_0xf53e('0xa')](this));ami['on'](_0xf53e('0xb'),this['syncHangupRequest'][_0xf53e('0xa')](this));ami['on']('hangup',this[_0xf53e('0xc')][_0xf53e('0xa')](this));ami['on']('agentringnoanswer',this[_0xf53e('0xd')][_0xf53e('0xa')](this));ami['on'](_0xf53e('0xe'),this[_0xf53e('0xf')][_0xf53e('0xa')](this));ami['on'](_0xf53e('0x10'),this[_0xf53e('0x11')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0xf53e('0x12')][_0xf53e('0xa')](this));}function getDiff(_0x2d63f8){var _0x281411=moment()[_0xf53e('0x13')](0x0);var _0x485273=moment(_0x2d63f8)[_0xf53e('0x13')](0x0);return _0x281411[_0xf53e('0x14')](_0x485273,_0xf53e('0x15'));}Acw[_0xf53e('0x16')]['updateAcw']=function(_0x19e2fb,_0x3061a2){var _0x95f37c=this;var _0x7137a9=getDiff(_0x95f37c[_0xf53e('0x7')][_0x19e2fb][_0xf53e('0x17')]);clearTimeout(_0x95f37c[_0xf53e('0x7')][_0x19e2fb][_0xf53e('0x18')]);_0x95f37c[_0xf53e('0x7')][_0x19e2fb][_0xf53e('0x18')]=![];return RpcVoiceAgentReport[_0xf53e('0x19')]({'acwtime':_0x7137a9},_0x95f37c[_0xf53e('0x7')][_0x19e2fb][_0xf53e('0x1a')],_0x19e2fb)[_0xf53e('0x1b')](function(_0x322044){logger['info'](_0xf53e('0x1c'),_0x3061a2,_0x7137a9,_0x322044);})[_0xf53e('0x1d')](function(_0x30e922){logger[_0xf53e('0x1e')](_0xf53e('0x1f'),_0x3061a2,_0x30e922);})[_0xf53e('0x20')](function(){delete _0x95f37c[_0xf53e('0x7')][_0x19e2fb];});};Acw['prototype'][_0xf53e('0x21')]=function(_0x38cdf3){try{var _0x347d0b=this;var _0x20c454=this[_0xf53e('0x22')][_0x38cdf3][_0xf53e('0x23')];var _0x3c7ab9=this[_0xf53e('0x22')][_0x38cdf3]['queue'];var _0x4b2238=this[_0xf53e('0x5')][_0x3c7ab9];var _0x38a91e=![];var _0x14dca0=_0xf53e('0x24');if(_0x4b2238['mandatoryDisposition']&&_0x4b2238[_0xf53e('0x25')][_0xf53e('0x26')]){_0x38a91e=!![];_0x14dca0=_0x4b2238[_0xf53e('0x25')]['name'];}return ami['Action']({'action':_0xf53e('0x27'),'interface':_0x20c454,'paused':!![],'reason':_0x14dca0})['then'](function(){if(_0x347d0b['agents'][_0x20c454]){return RpcUser['getAgent'](_0x347d0b[_0xf53e('0x6')][_0x20c454]['id'])[_0xf53e('0x1b')](function(_0x3a4d01){if(!_0x3a4d01||_0x3a4d01[_0xf53e('0x28')]){logger[_0xf53e('0x29')](_0xf53e('0x2a'),_0x38cdf3,_0x20c454,_0x3c7ab9);return;}logger[_0xf53e('0x29')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x38cdf3,_0x20c454,_0x3c7ab9);var _0x4d802f=_0x347d0b[_0xf53e('0x22')][_0x38cdf3]['attended']&&_0x347d0b[_0xf53e('0x22')][_0x38cdf3]['destlinkedid']?_0x347d0b['channels'][_0x38cdf3][_0xf53e('0x2b')]:_0x38cdf3;return RpcUser[_0xf53e('0x2c')](_0x347d0b[_0xf53e('0x6')][_0x20c454],_0x14dca0,_0x4d802f)['then'](function(_0x1e25d2){_0x347d0b[_0xf53e('0x5')][_0x3c7ab9][_0xf53e('0x2d')]-=0x1;_0x347d0b['voiceQueues'][_0x3c7ab9][_0xf53e('0x2e')]+=0x1;return _0x1e25d2;});})[_0xf53e('0x1b')](function(_0x1edd95){if(_0x38a91e||!_0x1edd95){return;}_0x347d0b['timers'][_0x20c454]={};logger[_0xf53e('0x29')](_0xf53e('0x2f'),_0x38cdf3,_0x347d0b[_0xf53e('0x5')][_0x3c7ab9][_0xf53e('0x30')],_0x20c454,_0x3c7ab9);_0x347d0b[_0xf53e('0x7')][_0x20c454]['timer']=setTimeout(_0x347d0b[_0xf53e('0x31')]['bind'](_0x347d0b,_0x20c454),_0x347d0b[_0xf53e('0x5')][_0x3c7ab9][_0xf53e('0x30')]*0x3e8);_0x347d0b['timers'][_0x20c454][_0xf53e('0x17')]=moment()[_0xf53e('0x32')](_0xf53e('0x33'));_0x347d0b[_0xf53e('0x7')][_0x20c454][_0xf53e('0x1a')]=_0x38cdf3;_0x347d0b[_0xf53e('0x7')][_0x20c454][_0xf53e('0x34')]=_0x3c7ab9;_0x347d0b[_0xf53e('0x7')][_0x20c454][_0xf53e('0x35')]=_0x347d0b[_0xf53e('0x35')][_0xf53e('0xa')](_0x347d0b,_0x20c454,_0x38cdf3);});}})[_0xf53e('0x1d')](function(){logger[_0xf53e('0x1e')](_0xf53e('0x2f'),_0x38cdf3,_0x347d0b[_0xf53e('0x5')][_0x3c7ab9][_0xf53e('0x30')],_0x20c454,_0x3c7ab9);})[_0xf53e('0x20')](function(){delete _0x347d0b[_0xf53e('0x22')][_0x38cdf3];});}catch(_0x3b7b7f){logger[_0xf53e('0x1e')](_0xf53e('0x36'),_0x3b7b7f[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')][_0xf53e('0x31')]=function(_0x53567f){try{var _0x447400=this;if(_0x447400['timers'][_0x53567f]){_0x447400['timers'][_0x53567f][_0xf53e('0x18')]=![];var _0x5e045b=_0x447400[_0xf53e('0x7')][_0x53567f][_0xf53e('0x1a')];var _0xf5587c=_0x447400[_0xf53e('0x7')][_0x53567f][_0xf53e('0x34')];var _0x816c7c=_0x447400[_0xf53e('0x5')][_0xf5587c][_0xf53e('0x30')];logger[_0xf53e('0x29')]('[%s][TIMER][STOP][AGENT:%s]',_0x5e045b,_0x53567f);RpcUser[_0xf53e('0x38')](this[_0xf53e('0x6')][_0x53567f]['id'])[_0xf53e('0x1b')](function(_0x5260bb){if(_0x5260bb[_0xf53e('0x39')]==='ACW'){return RpcUser[_0xf53e('0x3a')](_0x447400[_0xf53e('0x6')][_0x53567f]);}});RpcVoiceAgentReport['update']({'acwtime':_0x816c7c,'agentacw':!![]},_0x5e045b,_0x53567f)['then'](function(_0x40b448){logger[_0xf53e('0x29')](_0xf53e('0x1c'),_0x5e045b,_0x816c7c,_0x40b448);})['catch'](function(_0x3fb534){logger[_0xf53e('0x1e')](_0xf53e('0x1f'),_0x5e045b,_0x3fb534);});}else{logger[_0xf53e('0x1e')](_0xf53e('0x3b'),_0x53567f);if(_0x447400[_0xf53e('0x7')]){logger[_0xf53e('0x29')](_0xf53e('0x3c'),JSON['stringify'](_0x447400['timers']));}}}catch(_0x7bc65c){logger[_0xf53e('0x1e')]('[ACW][STOP]\x20%s',_0x7bc65c[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')]['syncAgentConnect']=function(_0x1c3add){try{if(this[_0xf53e('0x5')][_0x1c3add['queue']]&&(this[_0xf53e('0x5')][_0x1c3add[_0xf53e('0x34')]][_0xf53e('0x3')]||this[_0xf53e('0x5')][_0x1c3add[_0xf53e('0x34')]][_0xf53e('0x3d')])){if(this[_0xf53e('0x6')][_0x1c3add['interface']]){this[_0xf53e('0x22')][_0x1c3add[_0xf53e('0x1a')]]={'queue':_0x1c3add['queue'],'interface':_0x1c3add['interface'],'destlinkedid':_0x1c3add[_0xf53e('0x2b')]};}}}catch(_0x549e45){logger[_0xf53e('0x1e')](_0xf53e('0x3e'),_0x549e45[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')]['syncAgentConnectPreview']=function(_0x15d5c4){try{if(this[_0xf53e('0x5')][_0x15d5c4[_0xf53e('0x34')]]&&(this['voiceQueues'][_0x15d5c4[_0xf53e('0x34')]][_0xf53e('0x3')]||this['voiceQueues'][_0x15d5c4['queue']][_0xf53e('0x3d')])){if(this[_0xf53e('0x6')][_0x15d5c4[_0xf53e('0x23')]]){this['channels'][_0x15d5c4['uniqueid']]={'queue':_0x15d5c4[_0xf53e('0x34')],'interface':_0x15d5c4[_0xf53e('0x23')]};}}}catch(_0x2e52df){logger[_0xf53e('0x1e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2e52df[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')]['syncHangupRequest']=function(_0x287c51){try{if(this[_0xf53e('0x22')][_0x287c51[_0xf53e('0x1a')]]&&_[_0xf53e('0x3f')](this[_0xf53e('0x22')][_0x287c51[_0xf53e('0x1a')]][_0xf53e('0x40')])){logger[_0xf53e('0x29')]('[%s][HANGUP:UNIQUEID]',_0x287c51['uniqueid']);this['startAcw'](_0x287c51['uniqueid']);}else if(this['channels'][_0x287c51[_0xf53e('0x41')]]&&_['isUndefined'](this[_0xf53e('0x22')][_0x287c51[_0xf53e('0x41')]]['attended'])){logger['info'](_0xf53e('0x42'),_0x287c51[_0xf53e('0x41')]);this['startAcw'](_0x287c51[_0xf53e('0x41')]);}}catch(_0x24914f){logger[_0xf53e('0x1e')](_0xf53e('0x43'),_0x24914f[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')][_0xf53e('0xc')]=function(_0x3e16f3){try{if(this[_0xf53e('0x22')][_0x3e16f3[_0xf53e('0x1a')]]&&this[_0xf53e('0x22')][_0x3e16f3[_0xf53e('0x1a')]][_0xf53e('0x40')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3e16f3[_0xf53e('0x1a')]);this[_0xf53e('0x21')](_0x3e16f3['uniqueid']);}else if(this['channels'][_0x3e16f3[_0xf53e('0x41')]]&&this[_0xf53e('0x22')][_0x3e16f3['linkedid']][_0xf53e('0x40')]){logger[_0xf53e('0x29')](_0xf53e('0x44'),_0x3e16f3['linkedid']);this[_0xf53e('0x21')](_0x3e16f3[_0xf53e('0x41')]);}}catch(_0x1b42c3){logger[_0xf53e('0x1e')]('[ACW][syncHangup]\x20%s',_0x1b42c3[_0xf53e('0x37')]);}};Acw['prototype'][_0xf53e('0xf')]=function(_0x3c0b88){try{if(!_[_0xf53e('0x45')](this[_0xf53e('0x22')][_0x3c0b88['transfereeuniqueid']])){this[_0xf53e('0x21')](_0x3c0b88[_0xf53e('0x46')]);if(this['channels'][_0x3c0b88[_0xf53e('0x47')]]){this['channels'][_0x3c0b88['secondtransfereruniqueid']][_0xf53e('0x40')]=!![];this['channels'][_0x3c0b88[_0xf53e('0x48')]]=this['channels'][_0x3c0b88[_0xf53e('0x47')]];this[_0xf53e('0x49')](_0x3c0b88['secondtransfereruniqueid']);}}else if(!_[_0xf53e('0x45')](this[_0xf53e('0x22')][_0x3c0b88[_0xf53e('0x48')]])){this[_0xf53e('0x21')](_0x3c0b88[_0xf53e('0x48')]);if(this[_0xf53e('0x22')][_0x3c0b88[_0xf53e('0x4a')]]){this['channels'][_0x3c0b88[_0xf53e('0x4a')]][_0xf53e('0x40')]=!![];this[_0xf53e('0x22')][_0x3c0b88[_0xf53e('0x46')]]=this[_0xf53e('0x22')][_0x3c0b88[_0xf53e('0x4a')]];this['deleteChannelAfterTimeout'](_0x3c0b88[_0xf53e('0x4a')]);}}}catch(_0x3e6507){logger[_0xf53e('0x1e')](_0xf53e('0x4b'),_0x3e6507[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')][_0xf53e('0x11')]=function(_0xb49605){try{if(this['channels'][_0xb49605['transfereruniqueid']]){logger[_0xf53e('0x29')](_0xf53e('0x4c'),JSON['stringify'](_0xb49605[_0xf53e('0x4d')]));this[_0xf53e('0x21')](_0xb49605[_0xf53e('0x4d')]);}else if(this[_0xf53e('0x22')][_0xb49605[_0xf53e('0x4e')]]){logger[_0xf53e('0x29')](_0xf53e('0x4f'),JSON[_0xf53e('0x50')](_0xb49605[_0xf53e('0x4e')]));this[_0xf53e('0x21')](_0xb49605[_0xf53e('0x4e')]);}}catch(_0x132d34){logger[_0xf53e('0x1e')]('[ACW][syncBlindTransfer]\x20%s',_0x132d34[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')][_0xf53e('0xd')]=function(_0x529891){try{if(this['voiceQueues'][_0x529891[_0xf53e('0x34')]]&&this[_0xf53e('0x5')][_0x529891['queue']][_0xf53e('0x51')]===_0xf53e('0x52')){if(this[_0xf53e('0x6')][_0x529891['interface']]){logger[_0xf53e('0x29')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x529891['uniqueid'],_0x529891[_0xf53e('0x23')],_0x529891[_0xf53e('0x34')]);return RpcUser[_0xf53e('0x2c')](this[_0xf53e('0x6')][_0x529891[_0xf53e('0x23')]],_0xf53e('0x53'),_0x529891['uniqueid']);}}}catch(_0x458a77){logger[_0xf53e('0x1e')](_0xf53e('0x54'),_0x458a77[_0xf53e('0x37')]);}};Acw[_0xf53e('0x16')]['deleteChannelAfterTimeout']=function(_0x4ebcaf,_0x415a4c=0x2710){if(this[_0xf53e('0x22')][_0x4ebcaf]){setTimeout(()=>{delete this[_0xf53e('0x22')][_0x4ebcaf];},_0x415a4c);}};module[_0xf53e('0x55')]=Acw; \ No newline at end of file +var _0x81f4=['isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','timer','update','uniqueid','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','channels','queue','ACW','mandatoryDispositionPause','name','Action','agents','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','startAcw','linkedid'];(function(_0x156ae4,_0x5ce5af){var _0x282e46=function(_0x2e0372){while(--_0x2e0372){_0x156ae4['push'](_0x156ae4['shift']());}};_0x282e46(++_0x5ce5af);}(_0x81f4,0x19e));var _0x481f=function(_0x63c002,_0x55cbab){_0x63c002=_0x63c002-0x0;var _0x30e206=_0x81f4[_0x63c002];return _0x30e206;};'use strict';var _=require(_0x481f('0x0'));var moment=require(_0x481f('0x1'));var ami=require(_0x481f('0x2'));var logger=require(_0x481f('0x3'))(_0x481f('0x4'));var RpcUser=require(_0x481f('0x5'));var RpcVoiceAgentReport=require(_0x481f('0x6'));function Acw(_0x2a943a){this[_0x481f('0x7')]=_0x2a943a[_0x481f('0x7')];this['agents']=_0x2a943a['agents'];this[_0x481f('0x8')]=_0x2a943a[_0x481f('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x481f('0x9')]['bind'](this));ami['on'](_0x481f('0xa'),this[_0x481f('0xb')][_0x481f('0xc')](this));ami['on'](_0x481f('0xd'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x481f('0xc')](this));ami['on'](_0x481f('0xe'),this[_0x481f('0xf')][_0x481f('0xc')](this));ami['on']('blindtransfer',this[_0x481f('0x10')][_0x481f('0xc')](this));ami['on'](_0x481f('0x11'),this[_0x481f('0x12')][_0x481f('0xc')](this));}function getDiff(_0x1a63f1){var _0x4efbbb=moment()[_0x481f('0x13')](0x0);var _0x5d3f46=moment(_0x1a63f1)['milliseconds'](0x0);return _0x4efbbb['diff'](_0x5d3f46,_0x481f('0x14'));}Acw[_0x481f('0x15')][_0x481f('0x16')]=function(_0x164d0c,_0x38750f){var _0x4ff4b0=this;var _0x294ba2=getDiff(_0x4ff4b0['timers'][_0x164d0c]['lastPauseAt']);clearTimeout(_0x4ff4b0[_0x481f('0x8')][_0x164d0c][_0x481f('0x17')]);_0x4ff4b0['timers'][_0x164d0c][_0x481f('0x17')]=![];return RpcVoiceAgentReport[_0x481f('0x18')]({'acwtime':_0x294ba2},_0x4ff4b0[_0x481f('0x8')][_0x164d0c][_0x481f('0x19')],_0x164d0c)[_0x481f('0x1a')](function(_0x21c23f){logger[_0x481f('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x38750f,_0x294ba2,_0x21c23f);})[_0x481f('0x1c')](function(_0x31b0e9){logger[_0x481f('0x1d')](_0x481f('0x1e'),_0x38750f,_0x31b0e9);})[_0x481f('0x1f')](function(){delete _0x4ff4b0[_0x481f('0x8')][_0x164d0c];});};Acw[_0x481f('0x15')]['startAcw']=function(_0x369661){try{var _0x4794c1=this;var _0x4a18a7=this[_0x481f('0x20')][_0x369661]['interface'];var _0x361e9c=this[_0x481f('0x20')][_0x369661][_0x481f('0x21')];var _0x406d17=this[_0x481f('0x7')][_0x361e9c];var _0x1e5632=![];var _0x5f3734=_0x481f('0x22');if(_0x406d17['mandatoryDisposition']&&_0x406d17['mandatoryDispositionPause']['name']){_0x1e5632=!![];_0x5f3734=_0x406d17[_0x481f('0x23')][_0x481f('0x24')];}return ami[_0x481f('0x25')]({'action':'QueuePause','interface':_0x4a18a7,'paused':!![],'reason':_0x5f3734})[_0x481f('0x1a')](function(){if(_0x4794c1[_0x481f('0x26')][_0x4a18a7]){return RpcUser[_0x481f('0x27')](_0x4794c1[_0x481f('0x26')][_0x4a18a7]['id'])[_0x481f('0x1a')](function(_0x3ed43e){if(!_0x3ed43e||_0x3ed43e[_0x481f('0x28')]){logger['info'](_0x481f('0x29'),_0x369661,_0x4a18a7,_0x361e9c);return;}logger[_0x481f('0x1b')](_0x481f('0x2a'),_0x369661,_0x4a18a7,_0x361e9c);var _0x3880cd=_0x4794c1[_0x481f('0x20')][_0x369661][_0x481f('0x2b')]&&_0x4794c1[_0x481f('0x20')][_0x369661][_0x481f('0x2c')]?_0x4794c1[_0x481f('0x20')][_0x369661][_0x481f('0x2c')]:_0x369661;return RpcUser['savePause'](_0x4794c1[_0x481f('0x26')][_0x4a18a7],_0x5f3734,_0x3880cd)[_0x481f('0x1a')](function(_0x19b856){_0x4794c1[_0x481f('0x7')][_0x361e9c][_0x481f('0x2d')]-=0x1;_0x4794c1[_0x481f('0x7')][_0x361e9c]['paused']+=0x1;return _0x19b856;});})['then'](function(_0x1e6ecc){if(_0x1e5632||!_0x1e6ecc){return;}_0x4794c1[_0x481f('0x8')][_0x4a18a7]={};logger[_0x481f('0x1b')](_0x481f('0x2e'),_0x369661,_0x4794c1[_0x481f('0x7')][_0x361e9c]['acwTimeout'],_0x4a18a7,_0x361e9c);_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x17')]=setTimeout(_0x4794c1[_0x481f('0x2f')][_0x481f('0xc')](_0x4794c1,_0x4a18a7),_0x4794c1[_0x481f('0x7')][_0x361e9c][_0x481f('0x30')]*0x3e8);_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x31')]=moment()['format'](_0x481f('0x32'));_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x19')]=_0x369661;_0x4794c1[_0x481f('0x8')][_0x4a18a7][_0x481f('0x21')]=_0x361e9c;_0x4794c1['timers'][_0x4a18a7][_0x481f('0x16')]=_0x4794c1[_0x481f('0x16')]['bind'](_0x4794c1,_0x4a18a7,_0x369661);});}})['catch'](function(){logger[_0x481f('0x1d')](_0x481f('0x2e'),_0x369661,_0x4794c1[_0x481f('0x7')][_0x361e9c]['acwTimeout'],_0x4a18a7,_0x361e9c);})[_0x481f('0x1f')](function(){delete _0x4794c1['channels'][_0x369661];});}catch(_0x1673f7){logger[_0x481f('0x1d')]('[ACW][START]\x20%s',_0x1673f7[_0x481f('0x33')]);}};Acw['prototype']['stopAcw']=function(_0x18d8b9){try{var _0x27054d=this;if(_0x27054d['timers'][_0x18d8b9]){_0x27054d[_0x481f('0x8')][_0x18d8b9]['timer']=![];var _0x538cd7=_0x27054d['timers'][_0x18d8b9][_0x481f('0x19')];var _0x4394f0=_0x27054d[_0x481f('0x8')][_0x18d8b9][_0x481f('0x21')];var _0x1e23f0=_0x27054d[_0x481f('0x7')][_0x4394f0][_0x481f('0x30')];logger[_0x481f('0x1b')]('[%s][TIMER][STOP][AGENT:%s]',_0x538cd7,_0x18d8b9);RpcUser[_0x481f('0x27')](this[_0x481f('0x26')][_0x18d8b9]['id'])['then'](function(_0x107d1e){if(_0x107d1e['pauseType']===_0x481f('0x22')){return RpcUser[_0x481f('0x34')](_0x27054d['agents'][_0x18d8b9]);}});RpcVoiceAgentReport['update']({'acwtime':_0x1e23f0,'agentacw':!![]},_0x538cd7,_0x18d8b9)['then'](function(_0x30ef2e){logger[_0x481f('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x538cd7,_0x1e23f0,_0x30ef2e);})[_0x481f('0x1c')](function(_0x2156f4){logger[_0x481f('0x1d')](_0x481f('0x1e'),_0x538cd7,_0x2156f4);});}else{logger['error'](_0x481f('0x35'),_0x18d8b9);if(_0x27054d[_0x481f('0x8')]){logger[_0x481f('0x1b')](_0x481f('0x36'),JSON['stringify'](_0x27054d[_0x481f('0x8')]));}}}catch(_0x2aceae){logger[_0x481f('0x1d')]('[ACW][STOP]\x20%s',_0x2aceae[_0x481f('0x33')]);}};Acw[_0x481f('0x15')][_0x481f('0x9')]=function(_0x1e29ce){try{if(this[_0x481f('0x7')][_0x1e29ce[_0x481f('0x21')]]&&(this['voiceQueues'][_0x1e29ce[_0x481f('0x21')]][_0x481f('0x4')]||this['voiceQueues'][_0x1e29ce[_0x481f('0x21')]][_0x481f('0x37')])){if(this[_0x481f('0x26')][_0x1e29ce[_0x481f('0x38')]]){this['channels'][_0x1e29ce[_0x481f('0x19')]]={'queue':_0x1e29ce[_0x481f('0x21')],'interface':_0x1e29ce[_0x481f('0x38')],'destlinkedid':_0x1e29ce[_0x481f('0x2c')]};}}}catch(_0x459b67){logger[_0x481f('0x1d')](_0x481f('0x39'),_0x459b67[_0x481f('0x33')]);}};Acw[_0x481f('0x15')][_0x481f('0x12')]=function(_0xa368e4){try{if(this[_0x481f('0x7')][_0xa368e4[_0x481f('0x21')]]&&(this[_0x481f('0x7')][_0xa368e4[_0x481f('0x21')]][_0x481f('0x4')]||this['voiceQueues'][_0xa368e4[_0x481f('0x21')]][_0x481f('0x37')])){if(this['agents'][_0xa368e4['interface']]){this[_0x481f('0x20')][_0xa368e4[_0x481f('0x19')]]={'queue':_0xa368e4[_0x481f('0x21')],'interface':_0xa368e4['interface']};}}}catch(_0x47bbb8){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x47bbb8['message']);}};Acw['prototype']['syncHangupRequest']=function(_0x1b69c5){try{if(this['channels'][_0x1b69c5['uniqueid']]&&_['isUndefined'](this[_0x481f('0x20')][_0x1b69c5[_0x481f('0x19')]][_0x481f('0x2b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x1b69c5['uniqueid']);this[_0x481f('0x3a')](_0x1b69c5[_0x481f('0x19')]);}else if(this['channels'][_0x1b69c5[_0x481f('0x3b')]]&&_[_0x481f('0x3c')](this[_0x481f('0x20')][_0x1b69c5['linkedid']][_0x481f('0x2b')])){logger[_0x481f('0x1b')](_0x481f('0x3d'),_0x1b69c5[_0x481f('0x3b')]);this[_0x481f('0x3a')](_0x1b69c5[_0x481f('0x3b')]);}}catch(_0x1494d1){logger[_0x481f('0x1d')]('[ACW][syncHangupRequest]\x20%s',_0x1494d1[_0x481f('0x33')]);}};Acw[_0x481f('0x15')]['syncHangup']=function(_0x1a7aeb){try{if(this[_0x481f('0x20')][_0x1a7aeb[_0x481f('0x19')]]&&this[_0x481f('0x20')][_0x1a7aeb['uniqueid']][_0x481f('0x2b')]){logger[_0x481f('0x1b')](_0x481f('0x3e'),_0x1a7aeb['uniqueid']);this['startAcw'](_0x1a7aeb[_0x481f('0x19')]);}else if(this[_0x481f('0x20')][_0x1a7aeb[_0x481f('0x3b')]]&&this[_0x481f('0x20')][_0x1a7aeb[_0x481f('0x3b')]][_0x481f('0x2b')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1a7aeb[_0x481f('0x3b')]);this[_0x481f('0x3a')](_0x1a7aeb['linkedid']);}}catch(_0x431a0e){logger[_0x481f('0x1d')]('[ACW][syncHangup]\x20%s',_0x431a0e[_0x481f('0x33')]);}};Acw[_0x481f('0x15')]['syncAttendedTransfer']=function(_0x1731cf){try{if(!_[_0x481f('0x3f')](this[_0x481f('0x20')][_0x1731cf[_0x481f('0x40')]])){this[_0x481f('0x3a')](_0x1731cf[_0x481f('0x40')]);if(this[_0x481f('0x20')][_0x1731cf[_0x481f('0x41')]]){this[_0x481f('0x20')][_0x1731cf[_0x481f('0x41')]][_0x481f('0x2b')]=!![];this[_0x481f('0x20')][_0x1731cf[_0x481f('0x42')]]=this[_0x481f('0x20')][_0x1731cf['secondtransfereruniqueid']];this[_0x481f('0x43')](_0x1731cf['secondtransfereruniqueid']);}}else if(!_[_0x481f('0x3f')](this[_0x481f('0x20')][_0x1731cf['transfertargetuniqueid']])){this['startAcw'](_0x1731cf[_0x481f('0x42')]);if(this['channels'][_0x1731cf[_0x481f('0x44')]]){this[_0x481f('0x20')][_0x1731cf[_0x481f('0x44')]]['attended']=!![];this[_0x481f('0x20')][_0x1731cf[_0x481f('0x40')]]=this[_0x481f('0x20')][_0x1731cf[_0x481f('0x44')]];this['deleteChannelAfterTimeout'](_0x1731cf[_0x481f('0x44')]);}}}catch(_0x5c0f29){logger[_0x481f('0x1d')](_0x481f('0x45'),_0x5c0f29['message']);}};Acw[_0x481f('0x15')][_0x481f('0x10')]=function(_0x22df09){try{if(this['channels'][_0x22df09[_0x481f('0x46')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x481f('0x47')](_0x22df09[_0x481f('0x46')]));this['startAcw'](_0x22df09['transfereruniqueid']);}else if(this[_0x481f('0x20')][_0x22df09[_0x481f('0x48')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x481f('0x47')](_0x22df09[_0x481f('0x48')]));this[_0x481f('0x3a')](_0x22df09['transfererlinkedid']);}}catch(_0x150a53){logger['error'](_0x481f('0x49'),_0x150a53[_0x481f('0x33')]);}};Acw[_0x481f('0x15')][_0x481f('0x4a')]=function(_0x499d70){try{if(this[_0x481f('0x7')][_0x499d70[_0x481f('0x21')]]&&this[_0x481f('0x7')][_0x499d70[_0x481f('0x21')]]['autopause']==='all'){if(this[_0x481f('0x26')][_0x499d70[_0x481f('0x38')]]){logger['info'](_0x481f('0x4b'),_0x499d70[_0x481f('0x19')],_0x499d70[_0x481f('0x38')],_0x499d70[_0x481f('0x21')]);return RpcUser['savePause'](this[_0x481f('0x26')][_0x499d70[_0x481f('0x38')]],_0x481f('0x4c'),_0x499d70[_0x481f('0x19')]);}}}catch(_0xcb0b04){logger[_0x481f('0x1d')](_0x481f('0x4d'),_0xcb0b04[_0x481f('0x33')]);}};Acw[_0x481f('0x15')]['deleteChannelAfterTimeout']=function(_0x1d9b47,_0x15153f=0x2710){if(this['channels'][_0x1d9b47]){setTimeout(()=>{delete this['channels'][_0x1d9b47];},_0x15153f);}};module[_0x481f('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 4313798..7eaaed3 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 _0x9a08=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','bluebird','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','promisify'];(function(_0x4dfb8a,_0x332d52){var _0x37aaea=function(_0x281884){while(--_0x281884){_0x4dfb8a['push'](_0x4dfb8a['shift']());}};_0x37aaea(++_0x332d52);}(_0x9a08,0xf3));var _0x89a0=function(_0x44d88c,_0x4e0cb4){_0x44d88c=_0x44d88c-0x0;var _0x508da7=_0x9a08[_0x44d88c];return _0x508da7;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x89a0('0x0'));var util=require('util');var logger=require(_0x89a0('0x1'))('ami');var config=require(_0x89a0('0x2'));var ami=new Manager(config[_0x89a0('0x3')][_0x89a0('0x4')],config[_0x89a0('0x3')]['ip'],config['asterisk'][_0x89a0('0x5')],config[_0x89a0('0x3')][_0x89a0('0x6')],!![]);ami[_0x89a0('0x7')]();ami['Action']=BPromise[_0x89a0('0x8')](ami['action']);function error(_0x329fee){logger[_0x89a0('0x9')](util[_0x89a0('0xa')](_0x89a0('0xb'),config[_0x89a0('0x3')]['username'],config[_0x89a0('0x3')]['ip'],config['asterisk'][_0x89a0('0x4')],util[_0x89a0('0xc')](_0x329fee,![],null)));}function close(){logger[_0x89a0('0x9')](util['format'](_0x89a0('0xd'),config[_0x89a0('0x3')]['username'],config[_0x89a0('0x3')]['ip'],config[_0x89a0('0x3')][_0x89a0('0x4')]));}ami[_0x89a0('0xe')]=function(){return function(){return ami[_0x89a0('0xf')]({'action':_0x89a0('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x89a0('0xf')]({'action':'devicestatelist'});};};ami[_0x89a0('0x11')]=function(){return function(){return ami[_0x89a0('0xf')]({'action':_0x89a0('0x12')});};};ami[_0x89a0('0x13')]=function(){return function(){return ami[_0x89a0('0xf')]({'action':'queuesummary'});};};ami[_0x89a0('0x14')]=function(){return function(){return ami[_0x89a0('0xf')]({'action':_0x89a0('0x15')});};};function connect(){logger['info'](util[_0x89a0('0xa')](_0x89a0('0x16'),config[_0x89a0('0x3')][_0x89a0('0x5')],config[_0x89a0('0x3')]['ip'],config[_0x89a0('0x3')][_0x89a0('0x4')]));ami[_0x89a0('0x17')](_0x89a0('0x9'),error);ami[_0x89a0('0x17')](_0x89a0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0x89a0('0x19'),function(_0x2f80af){logger[_0x89a0('0x1a')](util[_0x89a0('0xa')](_0x89a0('0x1b'),config[_0x89a0('0x3')][_0x89a0('0x5')],config[_0x89a0('0x3')]['ip'],config[_0x89a0('0x3')][_0x89a0('0x4')],util[_0x89a0('0xc')](_0x2f80af,![],null)));});ami['on'](_0x89a0('0x1c'),function(){logger[_0x89a0('0x1a')](util['format'](_0x89a0('0x1d'),config[_0x89a0('0x3')][_0x89a0('0x5')],config['asterisk']['ip'],config[_0x89a0('0x3')][_0x89a0('0x4')]));return Promise[_0x89a0('0x1e')]()[_0x89a0('0x1f')](ami[_0x89a0('0xe')]())[_0x89a0('0x1f')](ami[_0x89a0('0x20')]())['then'](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x89a0('0x21')](function(_0x2e2663){logger[_0x89a0('0x9')](_0x89a0('0x22'),util[_0x89a0('0xc')](_0x2e2663,{'showHidden':![],'depth':null}));});});ami['once'](_0x89a0('0x9'),error);ami[_0x89a0('0x17')]('close',close);module[_0x89a0('0x23')]=ami; \ No newline at end of file +var _0x8dbc=['actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','[ami.js][fullybooted]','asterisk-manager','util','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','actionSipShowRegistry','devicestatelist','sippeerstatus','actionQueueSummary'];(function(_0x443939,_0x7946a7){var _0x511440=function(_0x29d34e){while(--_0x29d34e){_0x443939['push'](_0x443939['shift']());}};_0x511440(++_0x7946a7);}(_0x8dbc,0x1de));var _0xc8db=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x8dbc[_0x2cf2e9];return _0xd3670d;};'use strict';var Manager=require(_0xc8db('0x0'));var BPromise=require('bluebird');var util=require(_0xc8db('0x1'));var logger=require('../../config/logger')(_0xc8db('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xc8db('0x3')][_0xc8db('0x4')],config[_0xc8db('0x3')]['ip'],config['asterisk'][_0xc8db('0x5')],config[_0xc8db('0x3')][_0xc8db('0x6')],!![]);ami[_0xc8db('0x7')]();ami[_0xc8db('0x8')]=BPromise['promisify'](ami[_0xc8db('0x9')]);function error(_0x212088){logger[_0xc8db('0xa')](util[_0xc8db('0xb')](_0xc8db('0xc'),config[_0xc8db('0x3')]['username'],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')],util['inspect'](_0x212088,![],null)));}function close(){logger[_0xc8db('0xa')](util[_0xc8db('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xc8db('0x3')][_0xc8db('0x5')],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')]));}ami[_0xc8db('0xd')]=function(){return function(){return ami[_0xc8db('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xc8db('0x8')]({'action':_0xc8db('0xe')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xc8db('0x8')]({'action':_0xc8db('0xf')});};};ami[_0xc8db('0x10')]=function(){return function(){return ami[_0xc8db('0x8')]({'action':'queuesummary'});};};ami[_0xc8db('0x11')]=function(){return function(){return ami[_0xc8db('0x8')]({'action':_0xc8db('0x12')});};};function connect(){logger[_0xc8db('0x13')](util[_0xc8db('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc8db('0x3')][_0xc8db('0x5')],config['asterisk']['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')]));ami[_0xc8db('0x14')]('error',error);ami[_0xc8db('0x14')](_0xc8db('0x15'),close);}ami['on'](_0xc8db('0x16'),connect);ami['on']('shutdown',function(_0x105bd2){logger['info'](util[_0xc8db('0xb')](_0xc8db('0x17'),config['asterisk'][_0xc8db('0x5')],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')][_0xc8db('0x4')],util[_0xc8db('0x18')](_0x105bd2,![],null)));});ami['on'](_0xc8db('0x19'),function(){logger[_0xc8db('0x13')](util[_0xc8db('0xb')](_0xc8db('0x1a'),config[_0xc8db('0x3')][_0xc8db('0x5')],config[_0xc8db('0x3')]['ip'],config[_0xc8db('0x3')]['port']));return Promise[_0xc8db('0x1b')]()[_0xc8db('0x1c')](ami[_0xc8db('0xd')]())['then'](ami[_0xc8db('0x1d')]())[_0xc8db('0x1c')](ami[_0xc8db('0x1e')]())[_0xc8db('0x1c')](ami[_0xc8db('0x10')]())['then'](ami[_0xc8db('0x11')]())[_0xc8db('0x1f')](function(_0x588862){logger['error'](_0xc8db('0x20'),util[_0xc8db('0x18')](_0x588862,{'showHidden':![],'depth':null}));});});ami[_0xc8db('0x14')]('error',error);ami[_0xc8db('0x14')](_0xc8db('0x15'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 15c34bf..32733ad 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0xac4a,0x13f));var _0xaac4=function(_0xaac358,_0x2ae01c){_0xaac358=_0xaac358-0x0;var _0x3394ae=_0xac4a[_0xaac358];return _0x3394ae;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xcb91[_0x4b369d];return _0x571a98;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 75e55be..32b4cbe 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 _0x9046=['actions','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','merge','pick','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','Success','callProgressDetecting','variable','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','buildObj','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','running','statusMessage','available','talking','ACTIVE','queueSummaryCountersUpdated','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','reachable','resolve','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','[syncAgentComplete][createHistory][0]','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkIsBlackList','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice:queue:%s','voice_queue:save','isEmpty','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','startProgressive','name','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','stack','inspect','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','error','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','isTrunkReachable','active','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','iftime\x20%s,%s','content','true','push','command','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','resetActiveCalls','syncCampaigns','dialTimezone','Interval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Global:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','rescheduleContact','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]'];(function(_0x3e055e,_0x37c730){var _0x3e792f=function(_0x1ac384){while(--_0x1ac384){_0x3e055e['push'](_0x3e055e['shift']());}};_0x3e792f(++_0x37c730);}(_0x9046,0x125));var _0x6904=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x9046[_0x20ef64];return _0x3707d8;};'use strict';var util=require(_0x6904('0x0'));var _=require('lodash');var uuid=require(_0x6904('0x1'));var moment=require(_0x6904('0x2'));var rr=require('rr');var Redis=require(_0x6904('0x3'));var utils=require(_0x6904('0x4'));var hopperUtils=require(_0x6904('0x5'));var ut=require(_0x6904('0x6'));var config=require(_0x6904('0x7'));var logger=require(_0x6904('0x8'))(_0x6904('0x9'));var loggerBooked=require(_0x6904('0x8'))(_0x6904('0xa'));var loggerPredictive=require(_0x6904('0x8'))(_0x6904('0xb'));var loggerPredictiveCalls=require(_0x6904('0x8'))(_0x6904('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x6904('0xd'));var ami=require(_0x6904('0xe'));config[_0x6904('0xf')]=_[_0x6904('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6904('0x11'))(new Redis(config[_0x6904('0xf')]));var cmHopper=require(_0x6904('0x12'));var voiceQueueRt=require(_0x6904('0x13'));var RpcSetting=require(_0x6904('0x14'));var Interval=require(_0x6904('0x15'));var Action=require(_0x6904('0x16'));var History=require('./models/history');var Final=require(_0x6904('0x17'));var AgentComplete=require(_0x6904('0x18'));var QueueCallerAbandon=require(_0x6904('0x19'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x6904('0x1a')]||_0x6904('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6904('0x1c')][_0x6904('0x1d')]=function(_0x2c895c){this['tail']=this[_0x6904('0x1e')]?this[_0x6904('0x1e')][_0x6904('0x1f')](_0x2c895c):_0x2c895c();};function Dialer(_0x546a3f,_0x2ee263){this[_0x6904('0x20')]=new Sequence();this[_0x6904('0x21')]=_0x2ee263;this[_0x6904('0x22')]=_0x546a3f[_0x6904('0x22')];this['campaigns']=_0x546a3f[_0x6904('0x23')];this[_0x6904('0x24')]=_0x546a3f['agents'];this['trunks']=_0x546a3f[_0x6904('0x25')];this['maxNumberOriginate']=config[_0x6904('0x26')]||0x2;this[_0x6904('0x27')]={};this['actions']={};this['contactsId']={};this[_0x6904('0x28')]={};this[_0x6904('0x29')]={};this[_0x6904('0x2a')]={};this['startProgressive']={};this[_0x6904('0x2b')]={};this[_0x6904('0x2c')]={};this[_0x6904('0x2d')]={};this[_0x6904('0x2e')]={};ami['on'](_0x6904('0x2f'),this[_0x6904('0x30')][_0x6904('0x31')](this));ami['on'](_0x6904('0x32'),this[_0x6904('0x33')]['bind'](this));ami['on'](_0x6904('0x34'),this[_0x6904('0x35')][_0x6904('0x31')](this));ami['on'](_0x6904('0x36'),this[_0x6904('0x37')][_0x6904('0x31')](this));ami['on'](_0x6904('0x38'),this[_0x6904('0xd')][_0x6904('0x31')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x6904('0x31')](this));ami['on']('hangup',this[_0x6904('0x39')]['bind'](this));ami['on']('newexten',this[_0x6904('0x3a')][_0x6904('0x31')](this));ami['on']('varset',this[_0x6904('0x3b')]['bind'](this));ami['on'](_0x6904('0x3c'),this[_0x6904('0x3d')][_0x6904('0x31')](this));ami['on'](_0x6904('0x3e'),this[_0x6904('0x3f')][_0x6904('0x31')](this));this[_0x6904('0x40')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x6904('0x41')](function(_0x314edc){previewRecallmeReminderInterval=_0x314edc['previewRecallmeReminderInterval'];});}function isNotNull(_0x13ee0e){return _0x13ee0e!==null&&!_[_0x6904('0x42')](_0x13ee0e);}function msgResponse(_0x22614c,_0x4c9533,_0x5a60eb){return{'action':_0x22614c,'response':_0x4c9533,'message':_0x5a60eb,'stack':_0x5a60eb};}function emit(_0x147b7a,_0x1df29f,_0x2186f7){io['to'](_0x147b7a)[_0x6904('0x43')](_0x1df29f,_0x2186f7);}function emitOutboundVoiceQueueSummary(_0x1c440c){if(_0x1c440c[_0x6904('0x44')]==='outbound'){logger[_0x6904('0x45')](_0x6904('0x46'),util['inspect'](_0x1c440c,{'showHidden':![],'depth':null}));emit(util['format'](_0x6904('0x47'),_0x1c440c['name']),_0x6904('0x48'),_0x1c440c);}}function checkGetDataPredictive(_0x5039a9){if(isNotNull(_0x5039a9)&&!_[_0x6904('0x49')](_0x5039a9)){loggerPredictive[_0x6904('0x4a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x6904('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5039a9['predictiveIntervalTotalCalls']);loggerPredictive[_0x6904('0x4a')](_0x6904('0x4b'),_0x5039a9[_0x6904('0x4c')]);loggerPredictive[_0x6904('0x4a')](_0x6904('0x4d'),_0x5039a9['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x6904('0x4e'),_0x5039a9['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x6904('0x4f'),_0x5039a9[_0x6904('0x50')]);loggerPredictive[_0x6904('0x4a')](_0x6904('0x51'),_0x5039a9['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x6904('0x52'));if(_0x5039a9['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6904('0x42')](_0x5039a9[_0x6904('0x53')])&&_0x5039a9[_0x6904('0x53')]>0x0){return!![];}loggerPredictive[_0x6904('0x4a')](_0x6904('0x54'));if(!_[_0x6904('0x42')](_0x5039a9['predictiveIntervalAvgHoldtime'])&&_0x5039a9[_0x6904('0x50')]>0x0){return!![];}loggerPredictive[_0x6904('0x4a')](_0x6904('0x55'));}else{loggerPredictive[_0x6904('0x4a')](_0x6904('0x56'));}}else{loggerPredictive[_0x6904('0x4a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x33fa29){return function(_0x5c0807){loggerPredictive[_0x6904('0x4a')](_0x6904('0x57'));loggerPredictive[_0x6904('0x4a')](_0x6904('0x58'),_0x5c0807[_0x6904('0x59')]);loggerPredictive[_0x6904('0x4a')](_0x6904('0x5a'),_0x5c0807[_0x6904('0x5b')]);loggerPredictive[_0x6904('0x4a')](_0x6904('0x5c'),_0x5c0807[_0x6904('0x5d')]);loggerPredictive['info'](_0x6904('0x5e'),_0x5c0807[_0x6904('0x5f')]);loggerPredictive[_0x6904('0x4a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5c0807[_0x6904('0x5d')]);loggerPredictive['info'](_0x6904('0x52'));_['merge'](_0x33fa29,_0x5c0807);};}function ifInterval(_0x5e7ece,_0x4c5426){if(_[_0x6904('0x42')](_0x4c5426)){return![];}return utils[_0x6904('0x60')](undefined,_0x4c5426)<_0x5e7ece*0x3c;}function clearPredictiveAttributes(_0x3e21b5){if(_0x3e21b5[_0x6904('0x61')]){_0x3e21b5[_0x6904('0x61')]=undefined;loggerPredictive['debug'](_0x3e21b5[_0x6904('0x62')],_0x6904('0x63'));}if(_0x3e21b5['startPredictive']){_0x3e21b5[_0x6904('0x2a')]=undefined;loggerPredictive['debug'](_0x3e21b5['name'],'startPredictive\x20value\x20cleared');}if(_0x3e21b5[_0x6904('0x64')]){clearInterval(_0x3e21b5['handlePredictive']);_0x3e21b5['handlePredictive']=undefined;loggerPredictive[_0x6904('0x45')](_0x3e21b5[_0x6904('0x62')],_0x6904('0x65'));}}function loggerCatchPredictive(_0x55f3cc,_0x11f830){return function(_0x220b0f){loggerPredictive['error'](_0x11f830[_0x6904('0x62')],_0x55f3cc);loggerPredictive['error'](_0x220b0f[_0x6904('0x66')]);clearPredictiveAttributes(_0x11f830);};}function loggerCatch(_0x4d5ac9){return function(_0x99e899){logger['error'](_0x4d5ac9,util[_0x6904('0x67')](_0x99e899,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4e3146,_0x4b3491,_0x19ae87){return function(_0x568584){utils[_0x6904('0x68')](_0x4b3491,_0x19ae87,0x0);_0x4b3491[_0x6904('0x69')]=0x0;logger['error'](_0x4e3146,util[_0x6904('0x67')](_0x568584,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x43d734){return function(_0x17aa03){if(isNotNull(_0x17aa03)&&isNotNull(_0x17aa03[0x0])){if(_0x17aa03[0x0][_0x6904('0x6a')]>0x0){_0x43d734[_0x6904('0x6b')]=utils[_0x6904('0x6c')][_0x6904('0x6d')];logger[_0x6904('0x4a')]('[getContactDialer2][ReScheduled]'+_0x43d734['name'],_0x17aa03[0x0][_0x6904('0x6a')],_0x6904('0x6e'));}else{_0x43d734[_0x6904('0x6b')]=utils['CAMPAIGN_STATUS'][_0x6904('0x6f')];logger['info'](_0x6904('0x70')+_0x43d734[_0x6904('0x62')]);}}};}function createObjHistory(_0x7fe7b9,_0x428f12,_0x58beeb,_0x273d6c,_0x367974){_0x7fe7b9[_0x6904('0x6b')]=_0x58beeb;var _0x155953=new Action(_0x7fe7b9,_0x428f12);var _0x286700=new History(_0x155953);_0x286700[_0x6904('0x71')]=_0x273d6c;_0x286700[_0x6904('0x72')]=_0x367974;_0x286700['endtime']=_0x155953[_0x6904('0x73')];return _0x286700;}function unlockQueueStatus(_0x5a983f,_0x1e1b1a){setTimeout(function(){if(_[_0x6904('0x42')](_0x5a983f[_0x6904('0x74')])){loggerBooked[_0x6904('0x75')]('[unlockQueueStatus][undefined]',_0x1e1b1a);}_0x5a983f[_0x6904('0x74')]=!![];loggerBooked[_0x6904('0x4a')]('[booked][unlockQueueStatus]',_0x1e1b1a,JSON[_0x6904('0x76')](_['pick'](_0x5a983f,['name',_0x6904('0x74')])));},0x1f3);}function checkInterval(_0x37dea1){return function(){if(!isNotNull(_0x37dea1['Interval'])){_0x37dea1[_0x6904('0x6b')]=utils['CAMPAIGN_STATUS'][_0x6904('0x77')];throw _0x37dea1[_0x6904('0x62')]+_0x6904('0x78');}if(!isNotNull(_0x37dea1['Interval'][_0x6904('0x79')])){_0x37dea1[_0x6904('0x6b')]=utils['CAMPAIGN_STATUS'][_0x6904('0x77')];throw _0x37dea1[_0x6904('0x62')]+_0x6904('0x78');}if(!isNotNull(_[_0x6904('0x49')](_0x37dea1['Interval'][_0x6904('0x79')]))){_0x37dea1[_0x6904('0x6b')]=utils[_0x6904('0x6c')][_0x6904('0x77')];throw _0x37dea1[_0x6904('0x62')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x464d0){return function(){if(!utils[_0x6904('0x7a')](_0x464d0)){_0x464d0[_0x6904('0x6b')]=utils['CAMPAIGN_STATUS'][_0x6904('0x7b')];throw _0x464d0['name']+_0x6904('0x7c');}};}function emitCampaignSummary(_0x24081e){if(utils[_0x6904('0x7d')](_0x24081e)){emit(util[_0x6904('0x7e')]('campaign:ivr:%s',_0x24081e[_0x6904('0x62')]),_0x6904('0x7f'),_0x24081e);}}function loggerCatchQueueSummary(_0x1aa8b2,_0x5de5a8){return function(_0x3b644c){clearPredictiveAttributes(_0x5de5a8);emitCampaignSummary(_0x5de5a8);loggerSyncQueueSummary[_0x6904('0x45')](_0x1aa8b2,util[_0x6904('0x67')](_0x3b644c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x16e7c4){if(_0x16e7c4[_0x6904('0x80')]){if(_0x16e7c4[_0x6904('0x81')]===0x0){_0x16e7c4['sendMessageOneNotActive']=![];_0x16e7c4[_0x6904('0x6b')]=utils[_0x6904('0x6c')][_0x6904('0x7b')];loggerSyncQueueSummary[_0x6904('0x45')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x16e7c4['name'],_0x6904('0x82'));}else{_0x16e7c4['message']=utils[_0x6904('0x6c')]['DISACTIVED'];loggerSyncQueueSummary[_0x6904('0x45')](_0x6904('0x83'),_0x16e7c4['name'],'is\x20disactive');}emitCampaignSummary(_0x16e7c4);}}function myreject(_0x4138db){return function(_0x1a1cb9){return _0x4138db(msgResponse(_0x6904('0x84'),_0x6904('0x85'),JSON[_0x6904('0x76')](_0x1a1cb9)));};}Dialer[_0x6904('0x1c')][_0x6904('0x86')]=function(_0x35ead2){return!_[_0x6904('0x42')](_0x35ead2)&&_0x35ead2&&!_['isUndefined'](_0x35ead2[_0x6904('0x62')])&&!_[_0x6904('0x42')](_0x35ead2[_0x6904('0x87')])&&_0x35ead2[_0x6904('0x87')]&&(this[_0x6904('0x25')][util[_0x6904('0x7e')]('SIP/%s',_0x35ead2[_0x6904('0x62')])][_0x6904('0x88')]==='reachable'||this[_0x6904('0x25')][util['format']('SIP/%s',_0x35ead2[_0x6904('0x62')])][_0x6904('0x88')]===_0x6904('0x89'));};Dialer[_0x6904('0x1c')][_0x6904('0x8a')]=function(_0x179db3){var _0x50852c=this;return function(){if(!_0x50852c['isTrunkReachable'](_0x179db3[_0x6904('0x8b')])){if(!_0x50852c[_0x6904('0x86')](_0x179db3[_0x6904('0x8c')])){_0x179db3[_0x6904('0x6b')]=utils[_0x6904('0x6c')][_0x6904('0x8d')];throw _0x179db3[_0x6904('0x62')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x6904('0x8e')]=function(_0x564ffb,_0x2603bd,_0x3ba22b,_0x23e943){var _0x17461e=this;return function(){var _0xd56d04=!![];return _0x17461e[_0x6904('0x8f')](_0x564ffb,_0x2603bd,_0x3ba22b,_0x23e943,_0xd56d04);};};Dialer['prototype'][_0x6904('0x90')]=function(_0x261e22,_0x2b3211,_0xdef309,_0x5839e2){var _0x5492f2=this;return function(){var _0x410430=![];return _0x5492f2[_0x6904('0x8f')](_0x261e22['Intervals'],_0x2b3211,_0xdef309,_0x5839e2,_0x410430);};};Dialer['prototype'][_0x6904('0x8f')]=function(_0x55f62e,_0x42ce80,_0x354fc3,_0x51fba9,_0x1060ac){var _0x2fd1bc=[];return new Promise(function(_0x16731d,_0x160b63){if(!isNotNull(_0x55f62e)){_0x51fba9[_0x6904('0x6b')]=utils['CAMPAIGN_STATUS'][_0x6904('0x77')];return _0x160b63(msgResponse(_0x6904('0x91'),_0x6904('0x92'),_0x354fc3+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x6904('0x49')](_0x55f62e)){_0x51fba9[_0x6904('0x6b')]=utils[_0x6904('0x6c')][_0x6904('0x93')];return _0x160b63(msgResponse(_0x6904('0x91'),_0x6904('0x92'),_0x354fc3+_0x6904('0x94')));}if(_0x42ce80&&_['isUndefined'](config[_0x6904('0x95')][_0x42ce80])){_0x51fba9[_0x6904('0x6b')]=utils['CAMPAIGN_STATUS'][_0x6904('0x96')];return _0x160b63(msgResponse(_0x6904('0x91'),_0x6904('0x92'),_0x354fc3+_0x6904('0x97')+_0x42ce80));}if(_[_0x6904('0x98')](_0x55f62e)){for(var _0x2a97e1=0x0;_0x2a97e1<_0x55f62e['length'];_0x2a97e1+=0x1){_0x2fd1bc['push'](ami[_0x6904('0x99')]({'action':'command','command':util[_0x6904('0x7e')](_0x6904('0x9a'),_0x55f62e[_0x2a97e1]['interval'],!_[_0x6904('0x42')](config['timezones'][_0x42ce80])?_0x42ce80:'')})['then'](function(_0x38a11b){return _0x38a11b[_0x6904('0x9b')]['indexOf'](_0x6904('0x9c'))>=0x0;})['catch'](myreject(_0x160b63)));}}else{_0x2fd1bc[_0x6904('0x9d')](ami[_0x6904('0x99')]({'action':_0x6904('0x9e'),'command':util[_0x6904('0x7e')](_0x6904('0x9a'),_0x55f62e,!_['isUndefined'](config[_0x6904('0x95')][_0x42ce80])?_0x42ce80:'')})[_0x6904('0x41')](function(_0xd84ec8){return _0xd84ec8[_0x6904('0x9b')]['indexOf'](_0x6904('0x9c'))>=0x0;})['catch'](myreject(_0x160b63)));}Promise[_0x6904('0x9f')](_0x2fd1bc)[_0x6904('0x41')](function(_0x399c13){var _0x3d0feb=_[_0x6904('0xa0')](_0x399c13);if(_0x3d0feb){return _0x16731d(_0x3d0feb);}else{_0x51fba9[_0x6904('0x6b')]=_0x1060ac?utils[_0x6904('0x6c')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x6904('0xa1')];return _0x160b63(msgResponse(_0x6904('0xa2'),_0x6904('0x92'),'Global:\x20'+_0x1060ac+'\x20'+_0x354fc3+_0x6904('0xa3')+util[_0x6904('0x67')](_0x55f62e,{'showHidden':![],'depth':null})+_0x6904('0xa4')+_0x42ce80));}})[_0x6904('0xa5')](function(_0x526a6c){return _0x160b63(msgResponse(_0x6904('0x91'),'Failure',JSON['stringify'](_0x526a6c)));});});};Dialer[_0x6904('0x1c')][_0x6904('0x40')]=function(){var _0x117918=this;return cmHopper[_0x6904('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x6904('0x41')](function(){setInterval(function(){_0x117918[_0x6904('0xa7')]();},0x3e8);});};Dialer[_0x6904('0x1c')][_0x6904('0xa7')]=function(){var _0x3e2777=this;var _0x1a788e;for(var _0x5ac3f3 in this[_0x6904('0x23')]){if(typeof this[_0x6904('0x23')][_0x5ac3f3]!=='undefined'){_0x1a788e=this[_0x6904('0x23')][_0x5ac3f3];if(utils[_0x6904('0x7d')](_0x1a788e)&&utils[_0x6904('0x7a')](_0x1a788e)){_0x1a788e[_0x6904('0x80')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x1a788e))[_0x6904('0x41')](checkInterval(_0x1a788e))[_0x6904('0x41')](_0x3e2777[_0x6904('0x8a')](_0x1a788e))['then'](_0x3e2777['checkIfTime'](_0x1a788e['dialGlobalInterval'],_0x1a788e[_0x6904('0xa8')],_0x1a788e[_0x6904('0x62')],_0x1a788e))[_0x6904('0x41')](_0x3e2777[_0x6904('0x90')](_0x1a788e[_0x6904('0xa9')],_0x1a788e['dialTimezone'],_0x1a788e[_0x6904('0x62')],_0x1a788e))[_0x6904('0x41')](_0x3e2777[_0x6904('0xaa')](_0x1a788e))[_0x6904('0xa5')](loggerCatchQueueSummary(_0x6904('0xab'),_0x1a788e));}else{notSendMessagesCampaign(_0x1a788e);}}}};Dialer[_0x6904('0x1c')][_0x6904('0xac')]=function(_0x2f46dc){if(_0x2f46dc[_0x6904('0xad')]!==_0x6904('0xb')){clearPredictiveAttributes(_0x2f46dc);}switch(_0x2f46dc[_0x6904('0xad')]){case'progressive':this['handlePower'](_0x2f46dc,0x1);break;case _0x6904('0xae'):this[_0x6904('0xaf')](_0x2f46dc,_0x2f46dc[_0x6904('0xb0')]);break;case _0x6904('0xb'):this[_0x6904('0xb')](_0x2f46dc);break;case _0x6904('0xa'):this[_0x6904('0xaf')](_0x2f46dc,0x1);break;default:logger[_0x6904('0x75')](_0x6904('0xb1'),_0x2f46dc[_0x6904('0x62')],_0x6904('0xb2'));}};Dialer['prototype'][_0x6904('0x91')]=function(_0x2e1b2e,_0x3e7761){var _0xff7ff6=_0x2e1b2e['dialTimezone'];var _0x5ea369=_0x3e7761?_0x2e1b2e[_0x6904('0xb3')]:_0x2e1b2e[_0x6904('0xa9')][_0x6904('0x79')];logger['silly'](_0x6904('0xb4'),_0x5ea369,_0xff7ff6,_0x2e1b2e[_0x6904('0x62')],util[_0x6904('0x7e')](_0x6904('0xb5'),_0x2e1b2e[_0x6904('0x62')],_0x2e1b2e['id']));var _0x5cb81b=null;return Interval[_0x6904('0xb6')](_0x5ea369,_0xff7ff6)[_0x6904('0x41')](function(_0x2eb7cf){if(_0x2eb7cf===!![]){return _0x2eb7cf;}else{_0x2e1b2e[_0x6904('0x6b')]=_0x3e7761?utils[_0x6904('0x6c')][_0x6904('0xb7')]:utils[_0x6904('0x6c')][_0x6904('0xa1')];_0x5cb81b=msgResponse(_0x6904('0xa2'),_0x6904('0x92'),_0x6904('0xb8')+_0x3e7761+'\x20'+_0x2e1b2e[_0x6904('0x62')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x6904('0x67')](_0x5ea369,{'showHidden':![],'depth':null})+_0x6904('0xa4')+_0xff7ff6);}if(_0x5cb81b!==null){logger[_0x6904('0xb9')](_0x6904('0xba'),_0x5cb81b);_0x5cb81b[_0x6904('0xbb')]=_0x3e7761;throw _0x5cb81b;}})[_0x6904('0xa5')](function(_0x234058){logger['error'](_0x6904('0xbc'),_0x234058);throw msgResponse(_0x6904('0x84'),_0x6904('0x85'),util['inspect'](_0x234058,{'showHidden':![],'depth':null}));});};Dialer[_0x6904('0x1c')]['syncAgentConnect']=function(_0x40c5a6){if(this[_0x6904('0x22')][_0x40c5a6[_0x6904('0xbd')]]){if(this[_0x6904('0x28')][_0x40c5a6['uniqueid']]&&this[_0x6904('0x28')][_0x40c5a6[_0x6904('0xbe')]][_0x6904('0x44')]!==_0x6904('0xbf')){this[_0x6904('0xc0')](this[_0x6904('0x22')][_0x40c5a6['queue']]);this[_0x6904('0x28')][_0x40c5a6[_0x6904('0xbe')]][_0x6904('0xc1')]=moment()[_0x6904('0x7e')](_0x6904('0xc2'));}}};Dialer[_0x6904('0x1c')][_0x6904('0x37')]=function(_0x267913){var _0x4d9a79=this[_0x6904('0x28')][_0x267913[_0x6904('0xbe')]];if(this[_0x6904('0x22')][_0x267913[_0x6904('0xbd')]]){if(_0x4d9a79&&_0x4d9a79[_0x6904('0x44')]!==_0x6904('0xbf')){delete this[_0x6904('0x28')][_0x267913['uniqueid']];this['voiceQueues'][_0x267913[_0x6904('0xbd')]][_0x6904('0xc3')]+=0x1;var _0xaa6a81=new AgentComplete(_0x4d9a79,_0x267913);if(_0x267913[_0x6904('0xc4')]===_0x6904('0xc5')){_0xaa6a81[_0x6904('0xc6')]=this['voiceQueues'][_0x267913['queue']][_0x6904('0xc7')]&&this['voiceQueues'][_0x267913['queue']][_0x6904('0xc8')]?moment()[_0x6904('0x7e')](_0x6904('0xc2')):undefined;}hopperUtils['createHistory'](_0xaa6a81)[_0x6904('0xa5')](loggerCatch(_0x6904('0xc9')));hopperUtils[_0x6904('0xca')](_0xaa6a81)['catch'](loggerCatch(_0x6904('0xcb')));}}};Dialer[_0x6904('0x1c')][_0x6904('0x33')]=function(_0x59c471){var _0x3b9cc5=this[_0x6904('0x28')][_0x59c471[_0x6904('0xbe')]];var _0x5f4fe9=this;var _0x43358d=![];var _0x4f8043;var _0x1477c4;if(this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]]){if(_0x3b9cc5&&_0x3b9cc5[_0x6904('0x44')]!=='ivr'){delete this['uniqueId'][_0x59c471[_0x6904('0xbe')]];this[_0x6904('0xc0')](this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]]);_0x3b9cc5[_0x6904('0xcc')]=moment()[_0x6904('0x7e')](_0x6904('0xc2'));var _0x578f82=new QueueCallerAbandon(_0x3b9cc5,_0x59c471);if(utils[_0x6904('0x60')](_0x3b9cc5[_0x6904('0xcc')],_0x3b9cc5[_0x6904('0xcd')])>=_0x3b9cc5['dialQueueTimeout']){this[_0x6904('0x22')][_0x59c471['queue']][_0x6904('0xce')]+=0x1;this['voiceQueues'][_0x59c471[_0x6904('0xbd')]][_0x6904('0xcf')]+=0x1;this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xd0')]+=0x1;_0x578f82[_0x6904('0x71')]=0xa;_0x578f82[_0x6904('0x72')]=_0x6904('0xd1');_0x578f82['dropreason']=_0x6904('0xd2');_0x578f82[_0x6904('0xc6')]=this['voiceQueues'][_0x59c471[_0x6904('0xbd')]][_0x6904('0xc7')]?moment()[_0x6904('0x7e')](_0x6904('0xc2')):undefined;_0x578f82[_0x6904('0xd3')]+=0x1;_0x578f82[_0x6904('0xd4')]+=0x1;_0x4f8043=this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xd5')];_0x1477c4=this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x6904('0xd6')](_0x578f82,_0x578f82[_0x6904('0x71')],_0x3b9cc5[_0x6904('0xd7')])[_0x6904('0x41')](function(_0x228b7a){_0x43358d=_0x228b7a[_0x6904('0xd8')]==0x1;if(_0x578f82[_0x6904('0xd3')]>=_0x5f4fe9[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]]['dialDropMaxRetry']){_0x5f4fe9[_0x6904('0xd9')](_0x578f82,_0x228b7a['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x578f82['countdropretry'],'scheduledat':moment()[_0x6904('0xda')](_0x5f4fe9[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xd5')],_0x6904('0xdb'))[_0x6904('0x7e')](_0x6904('0xc2')),'ContactId':_0x3b9cc5[_0x6904('0xdc')],'ListId':_0x3b9cc5[_0x6904('0xdd')],'VoiceQueueId':_0x3b9cc5[_0x6904('0xde')]||undefined,'CampaignId':_0x3b9cc5[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0xe0')));var _0x59cf58=new History(_0x578f82);_0x59cf58[_0x6904('0x71')]=0xa;_0x59cf58[_0x6904('0x72')]=_0x6904('0xd1');_0x59cf58[_0x6904('0x73')]=moment()['format'](_0x6904('0xc2'));_0x59cf58[_0x6904('0xe1')]=_0x59cf58[_0x6904('0x73')];_0x59cf58[_0x6904('0xe2')]=_0x578f82[_0x6904('0xe2')];_0x59cf58['calleridnum']=_0x578f82[_0x6904('0xe3')];hopperUtils[_0x6904('0xe4')](_0x59cf58)[_0x6904('0xa5')](loggerCatch(_0x6904('0xe5')));}})['then'](function(){if(_0x43358d)hopperUtils['swapAdditionalPhones'](_0x578f82,_0x4f8043,_0x1477c4)['then'](function(){return 0x1;});});}else{this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xe6')]+=0x1;this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xe7')]+=0x1;_0x578f82[_0x6904('0x71')]=0xb;_0x578f82[_0x6904('0x72')]=_0x6904('0xe8');_0x578f82[_0x6904('0xe9')]=_0x6904('0xea');_0x578f82[_0x6904('0xeb')]+=0x1;_0x578f82['countglobal']+=0x1;_0x4f8043=this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xec')];_0x1477c4=this[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xed')];hopperUtils[_0x6904('0xd6')](_0x578f82,_0x578f82['state'],_0x3b9cc5[_0x6904('0xd7')])['then'](function(_0x5d996d){if(_0x578f82[_0x6904('0xeb')]>=_0x5f4fe9[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xee')]){_0x5f4fe9[_0x6904('0xd9')](_0x578f82,_0x5d996d[_0x6904('0xd8')]);}else{hopperUtils[_0x6904('0xef')]({'active':![],'countabandonedretry':_0x578f82[_0x6904('0xeb')],'scheduledat':moment()[_0x6904('0xda')](_0x5f4fe9[_0x6904('0x22')][_0x59c471[_0x6904('0xbd')]][_0x6904('0xec')],_0x6904('0xdb'))[_0x6904('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b9cc5[_0x6904('0xdc')],'ListId':_0x3b9cc5[_0x6904('0xdd')],'VoiceQueueId':_0x3b9cc5[_0x6904('0xde')]||undefined,'CampaignId':_0x3b9cc5['CampaignId']||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0xf0')));var _0x1bc766=new History(_0x578f82);_0x1bc766[_0x6904('0x71')]=0xb;_0x1bc766['statedesc']=_0x6904('0xe8');_0x1bc766[_0x6904('0x73')]=moment()['format'](_0x6904('0xc2'));_0x1bc766[_0x6904('0xe1')]=_0x1bc766['starttime'];_0x1bc766[_0x6904('0xe2')]=_0x578f82['calleridname'];_0x1bc766[_0x6904('0xe3')]=_0x578f82['calleridnum'];hopperUtils[_0x6904('0xe4')](_0x1bc766)[_0x6904('0xa5')](loggerCatch(_0x6904('0xf1')));}})[_0x6904('0x41')](function(){if(_0x43358d)hopperUtils['swapAdditionalPhones'](_0x578f82,_0x4f8043,_0x1477c4)[_0x6904('0x41')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x6904('0x3a')]=function(_0x29e492){if(this[_0x6904('0xf2')][_0x29e492['uniqueid']]){this[_0x6904('0xf2')][_0x29e492[_0x6904('0xbe')]][_0x6904('0xf3')]=_0x29e492[_0x6904('0xf3')];}if(this[_0x6904('0x28')][_0x29e492[_0x6904('0xbe')]]){this['uniqueId'][_0x29e492[_0x6904('0xbe')]][_0x6904('0xf3')]=_0x29e492[_0x6904('0xf3')];}};Dialer[_0x6904('0x1c')][_0x6904('0x3d')]=function(_0x672a2c){if(!this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]]){return;}var _0x3610ff=this[_0x6904('0x22')][this['actions'][_0x672a2c[_0x6904('0xf4')]]['queue']][_0x6904('0xf5')]||'rrmemory';if(_0x3610ff===_0x6904('0xf6')){if(this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]]&&_[_0x6904('0xf7')](this['actions'][_0x672a2c[_0x6904('0xf4')]][_0x6904('0xf8')])&&_0x672a2c[_0x6904('0x88')]==='1'&&_0x672a2c[_0x6904('0xf9')]==='0'){if(this[_0x6904('0x24')][_0x672a2c[_0x6904('0xfa')]]){if(!this[_0x6904('0x24')][_0x672a2c['stateinterface']][_0x6904('0xf8')]){this[_0x6904('0x24')][_0x672a2c[_0x6904('0xfa')]][_0x6904('0xf8')]=!![];this[_0x6904('0xf2')][_0x672a2c['actionid']]['locked']=!![];this[_0x6904('0xf2')][_0x672a2c['actionid']][_0x6904('0xfa')]=_0x672a2c[_0x6904('0xfa')];}}}}else if(_0x3610ff===_0x6904('0xfb')){if(this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]]){if(this[_0x6904('0x24')][_0x672a2c[_0x6904('0xfa')]]){this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]]['stateinterface']=_0x672a2c[_0x6904('0xfa')];if(_[_0x6904('0xf7')](this[_0x6904('0x2c')][this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]][_0x6904('0xbd')]])){this[_0x6904('0x2c')][this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]][_0x6904('0xbd')]]=[];}this[_0x6904('0x2c')][this[_0x6904('0xf2')][_0x672a2c['actionid']][_0x6904('0xbd')]][_0x6904('0x9d')](_[_0x6904('0xfc')](_[_0x6904('0xfd')](this[_0x6904('0xf2')][_0x672a2c[_0x6904('0xf4')]],['idHopper',_0x6904('0xfa')]),{'status':_0x672a2c[_0x6904('0x88')],'paused':_0x672a2c[_0x6904('0xf9')]}));}}}};Dialer[_0x6904('0x1c')][_0x6904('0x3f')]=function(_0x558f12){if(!this[_0x6904('0xf2')][_0x558f12['actionid']]){return;}var _0x3c6c00=this;var _0x220c75=this[_0x6904('0x22')][this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]]['queue']];var _0x5c7572=_0x220c75[_0x6904('0xf5')]||_0x6904('0xfb');if(_0x5c7572===_0x6904('0xf6')){if(this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]]&&this['actions'][_0x558f12[_0x6904('0xf4')]]['stateinterface']){this[_0x6904('0x21')][_0x6904('0xfe')](this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xff')],this['actions'][_0x558f12[_0x6904('0xf4')]][_0x6904('0xfa')])['catch'](function(_0x171b4f){logger[_0x6904('0x75')](_0x6904('0x100'),util[_0x6904('0x67')](_0x171b4f,{'showHidden':![],'depth':null}));})[_0x6904('0x1f')](function(){_0x3c6c00[_0x6904('0xc0')](_0x3c6c00[_0x6904('0x22')][_0x3c6c00[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]]);_0x3c6c00['agents'][_0x3c6c00[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xfa')]]['locked']=![];delete _0x3c6c00['actions'][_0x558f12[_0x6904('0xf4')]];unlockQueueStatus(_0x220c75);});}else{this[_0x6904('0xc0')](this[_0x6904('0x22')][this['actions'][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x558f12[_0x6904('0xf4')]][_0x6904('0xdc')],'ListId':this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xdd')],'VoiceQueueId':this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x101')));delete this[_0x6904('0xf2')][_0x558f12['actionid']];unlockQueueStatus(_0x220c75);}}else if(_0x5c7572===_0x6904('0xfb')){var _0x45cb7d;if(this['actions'][_0x558f12[_0x6904('0xf4')]]&&!_[_0x6904('0x49')](this[_0x6904('0x2c')][this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]])){if(this[_0x6904('0x2d')][_0x3c6c00['actions'][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]]){this[_0x6904('0x2d')][_0x3c6c00[_0x6904('0xf2')][_0x558f12['actionid']][_0x6904('0xbd')]]=this[_0x6904('0x2d')][this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]]?this['queueBookedRR'][this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]]:this[_0x6904('0x2c')][this['actions'][_0x558f12['actionid']][_0x6904('0xbd')]]?this['queueBooked'][this['actions'][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]]['_rr']||0x0:0x0;}this[_0x6904('0x2c')][this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]][_0x6904('0x102')]=this[_0x6904('0x2d')][this[_0x6904('0xf2')][_0x558f12[_0x6904('0xf4')]][_0x6904('0xbd')]];for(var _0x39ade7=0x0;_0x39ade7=_0x1b2cc1[_0x6904('0x125')]){_0x2a85e4['stateGlobal'](_0x3f2a0b,_0x1b8f83,_0x13ba1b,'reason19\x20machine....');}else{if(_0x3f2a0b[_0x6904('0x11f')]>=_0x1b2cc1[_0x6904('0x126')]){_0x2a85e4[_0x6904('0x127')](_0x3f2a0b,_0x1b8f83,_0x13ba1b,_0x6904('0x128'));}else{hopperUtils[_0x6904('0xef')]({'active':![],'countmachineretry':_0x3f2a0b[_0x6904('0x11f')],'scheduledat':moment()['add'](_0x1b2cc1[_0x6904('0x129')],_0x6904('0xdb'))[_0x6904('0x7e')](_0x6904('0xc2')),'ContactId':_0x3f2a0b['ContactId'],'ListId':_0x3f2a0b[_0x6904('0xdd')],'VoiceQueueId':_0x3f2a0b['VoiceQueueId']||undefined,'CampaignId':_0x3f2a0b[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x12a')));_0x1b8f83({'reschedule':0x1});}}});}if(_0x385725[_0x6904('0x44')]===_0x6904('0xbf')&&this[_0x6904('0x23')][_0x385725['queue']]['dialAMDActive']&&_0x279365[_0x6904('0x112')]===_0x6904('0x113')){delete this[_0x6904('0x28')][_0x279365[_0x6904('0xbe')]];this[_0x6904('0xc0')](this[_0x6904('0x23')][_0x385725['queue']]);_0x3bc9da=new Hangup(_0x385725,_0x279365);_0x3bc9da['state']=0x12;_0x3bc9da[_0x6904('0x72')]=_0x6904('0x12b');_0x3bc9da[_0x6904('0x115')]='AMD';ami[_0x6904('0x43')](_0x6904('0x117'),ut['buildObj'](_0x3bc9da,_0x6904('0x118')));this[_0x6904('0x119')](_0x3bc9da,_0x6904('0x12c'),_0x6904('0x12d'));}if(_0x385725[_0x6904('0x44')]==='ivr'&&this['campaigns'][_0x385725[_0x6904('0xbd')]]['dialAMDActive']&&_0x279365[_0x6904('0x112')]===_0x6904('0x11d')){return new Promise(function(_0x2625b9,_0x5a61dd){delete _0x2a85e4['uniqueId'][_0x279365[_0x6904('0xbe')]];_0x2a85e4[_0x6904('0xc0')](_0x2a85e4[_0x6904('0x23')][_0x385725['queue']]);_0x2a85e4[_0x6904('0x23')][_0x385725[_0x6904('0xbd')]]['outboundAnswerCallsDay']+=0x1;_0x2a85e4['campaigns'][_0x385725['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x39be3e=_0x2a85e4['campaigns'][_0x385725['queue']];var _0x594096=new Hangup(_0x385725,_0x279365);_0x594096['state']=0x13;_0x594096[_0x6904('0x72')]=_0x6904('0x11e');_0x594096['membername']=_0x6904('0x116');_0x594096[_0x6904('0x11f')]+=0x1;_0x594096['countglobal']+=0x1;_0x594096[_0x6904('0x118')]=!![];ami[_0x6904('0x43')]('custom:amd',ut[_0x6904('0x120')](_0x594096,_0x6904('0x118')));hopperUtils[_0x6904('0xe4')](_0x594096)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x594096['countbusyretry']+_0x594096['countcongestionretry']+_0x594096['countnoanswerretry']+_0x594096[_0x6904('0x123')]+_0x594096[_0x6904('0xd3')]+_0x594096[_0x6904('0xeb')]+_0x594096[_0x6904('0x11f')]+_0x594096[_0x6904('0x124')]>=_0x39be3e['dialGlobalMaxRetry']){_0x2a85e4[_0x6904('0x12e')](_0x594096,_0x2625b9,_0x5a61dd,'reason19\x20machine....');}else{if(_0x594096[_0x6904('0x11f')]>=_0x39be3e['dialMachineMaxRetry']){_0x2a85e4[_0x6904('0x127')](_0x594096,_0x2625b9,_0x5a61dd,_0x6904('0x128'));}else{hopperUtils[_0x6904('0xef')]({'active':![],'countmachineretry':_0x594096[_0x6904('0x11f')],'scheduledat':moment()[_0x6904('0xda')](_0x39be3e['dialMachineRetryFrequency'],'minutes')[_0x6904('0x7e')](_0x6904('0xc2')),'ContactId':_0x594096[_0x6904('0xdc')],'ListId':_0x594096[_0x6904('0xdd')],'VoiceQueueId':_0x594096[_0x6904('0xde')]||undefined,'CampaignId':_0x594096[_0x6904('0xdf')]||undefined})['catch'](loggerCatch(_0x6904('0x12a')));_0x2625b9({'reschedule':0x1});}}});}}};Dialer[_0x6904('0x1c')]['syncHangup']=function(_0x4a4d85){var _0x16ccb8=this[_0x6904('0x28')][_0x4a4d85[_0x6904('0xbe')]];var _0x18d113;if(_0x16ccb8&&_0x16ccb8['type']===_0x6904('0xbf')){delete this[_0x6904('0x28')][_0x4a4d85['uniqueid']];this['updateOriginated'](this[_0x6904('0x23')][_0x16ccb8[_0x6904('0xbd')]]);this[_0x6904('0x23')][_0x16ccb8[_0x6904('0xbd')]][_0x6904('0x12f')]+=0x1;_0x18d113=new Hangup(_0x16ccb8,_0x4a4d85);hopperUtils['createHistory'](_0x18d113)[_0x6904('0xa5')](loggerCatch(_0x6904('0x130')));hopperUtils['moveContactManagedDialer'](_0x18d113)['catch'](loggerCatch(_0x6904('0x131')));}if(_0x16ccb8&&_0x16ccb8[_0x6904('0x44')]!=='ivr'&&isNotNull(this[_0x6904('0x22')][_0x16ccb8[_0x6904('0xbd')]][_0x6904('0x132')])){delete this[_0x6904('0x28')][_0x4a4d85[_0x6904('0xbe')]];this[_0x6904('0xc0')](this[_0x6904('0x22')][_0x16ccb8[_0x6904('0xbd')]]);this[_0x6904('0x22')][_0x16ccb8['queue']][_0x6904('0xc3')]+=0x1;this[_0x6904('0x22')][_0x16ccb8[_0x6904('0xbd')]][_0x6904('0x114')]+=0x1;_0x18d113=new Hangup(_0x16ccb8,_0x4a4d85);_0x18d113[_0x6904('0x71')]=0x10;_0x18d113[_0x6904('0x72')]=_0x6904('0x133');_0x18d113[_0x6904('0x115')]=_0x6904('0x134');hopperUtils['createHistory'](_0x18d113)[_0x6904('0xa5')](loggerCatch(_0x6904('0x130')));hopperUtils['moveContactManagedDialer'](_0x18d113)[_0x6904('0xa5')](loggerCatch(_0x6904('0x131')));}if(_0x16ccb8&&_0x16ccb8[_0x6904('0x44')]!==_0x6904('0xbf')&&!isNotNull(this[_0x6904('0x22')][_0x16ccb8[_0x6904('0xbd')]]['dialQueueProject'])){if(_0x4a4d85['cause-txt']===_0x6904('0x135')){delete this[_0x6904('0x28')][_0x4a4d85[_0x6904('0xbe')]];this[_0x6904('0x22')][_0x16ccb8[_0x6904('0xbd')]]['outboundAnswerCallsDay']+=0x1;const _0x4db67d=new AgentComplete(_0x16ccb8,_0x4a4d85);_0x4db67d['CampaignId']=this[_0x6904('0x22')][_0x16ccb8['queue']]['id'];hopperUtils['createHistory'](_0x4db67d)[_0x6904('0xa5')](loggerCatch(_0x6904('0xc9')));hopperUtils[_0x6904('0xca')](_0x4db67d)[_0x6904('0xa5')](loggerCatch(_0x6904('0xcb')));}else{delete this[_0x6904('0x28')][_0x4a4d85['uniqueid']];this[_0x6904('0xc0')](this['voiceQueues'][_0x16ccb8[_0x6904('0xbd')]]);this[_0x6904('0x22')][_0x16ccb8[_0x6904('0xbd')]][_0x6904('0x136')]+=0x1;_0x18d113=new Hangup(_0x16ccb8,_0x4a4d85);_0x18d113['state']=0xc;_0x18d113[_0x6904('0x72')]=_0x4a4d85[_0x6904('0x137')];_0x18d113[_0x6904('0x115')]='Unknow';hopperUtils[_0x6904('0xe4')](_0x18d113)[_0x6904('0xa5')](loggerCatch(_0x6904('0x130')));hopperUtils[_0x6904('0xca')](_0x18d113)[_0x6904('0xa5')](loggerCatch(_0x6904('0x131')));}}};Dialer[_0x6904('0x1c')][_0x6904('0xd')]=function(_0x53c6a3){var _0x1fd2d4=this;if(!_0x1fd2d4['queuesSummary'][_0x53c6a3[_0x6904('0x62')]]){_0x1fd2d4[_0x6904('0x2e')][_0x53c6a3[_0x6904('0x62')]]={'running':![]};}else if(_0x1fd2d4[_0x6904('0x2e')][_0x53c6a3[_0x6904('0x62')]]['running']===!![]){return;}else if(_0x1fd2d4[_0x6904('0x2e')][_0x53c6a3['name']][_0x6904('0x138')]===![]){_0x1fd2d4['queuesSummary'][_0x53c6a3[_0x6904('0x62')]]['running']=!![];}var _0x3b53b4=_0x1fd2d4[_0x6904('0x22')][_0x53c6a3[_0x6904('0x62')]];var _0x26d53e=_0x3b53b4[_0x6904('0x6b')]!==utils['CAMPAIGN_STATUS'][_0x6904('0x7b')];var _0x5cf9ba=utils['isPreviewCampaign'](_0x3b53b4);_0x3b53b4[_0x6904('0x139')]=utils['getQueueCampaignStatusMessage'](_0x3b53b4,_0x1fd2d4['trunks']);Promise['resolve']()[_0x6904('0x41')](function(){if(_0x3b53b4['statusMessage']===utils[_0x6904('0x6c')][_0x6904('0x7b')]){if(_0x26d53e){clearPredictiveAttributes(_0x3b53b4);_0x53c6a3[_0x6904('0x2a')]=undefined;_0x53c6a3[_0x6904('0x61')]=undefined;}if(_0x3b53b4[_0x6904('0x139')]===utils['CAMPAIGN_STATUS'][_0x6904('0x7b')]){_0x53c6a3[_0x6904('0x13a')]=0x0;_0x53c6a3['paused']=0x0;_0x53c6a3['inUse']=0x0;_0x53c6a3[_0x6904('0x13b')]=0x0;_0x53c6a3['pTalking']=0x0;}}else if(_0x3b53b4['statusMessage']===utils[_0x6904('0x6c')][_0x6904('0x13c')]&&!_0x5cf9ba){return _0x1fd2d4['ifTime'](_0x3b53b4,!![])[_0x6904('0x41')](function(){return _0x1fd2d4['ifTime'](_0x3b53b4,![]);})[_0x6904('0x41')](function(){return _0x1fd2d4['checkDialMethod'](_0x3b53b4);})[_0x6904('0xa5')](function(_0x4fa2ce){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x6904('0x67')](_0x4fa2ce,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3b53b4);});}else{clearPredictiveAttributes(_0x3b53b4);}})[_0x6904('0x41')](function(){var _0x10a7cc=_0x53c6a3['compareToOutboundQueue'](_0x3b53b4);if(_0x10a7cc||_0x3b53b4[_0x6904('0x13d')]){_0x3b53b4[_0x6904('0x13d')]=![];_0x53c6a3['updateReportFromOutboundQueue'](_0x3b53b4);Object[_0x6904('0x13e')](_0x3b53b4,_0x53c6a3);emitOutboundVoiceQueueSummary(_0x53c6a3);}_0x1fd2d4[_0x6904('0x2e')][_0x3b53b4['name']][_0x6904('0x138')]=![];})[_0x6904('0xa5')](function(_0x3b547e){logger[_0x6904('0x75')](_0x6904('0x13f'),util[_0x6904('0x67')](_0x3b547e,{'showHidden':![],'depth':null}));_0x1fd2d4[_0x6904('0x2e')][_0x3b53b4[_0x6904('0x62')]][_0x6904('0x138')]=![];});};Dialer['prototype'][_0x6904('0x140')]=_[_0x6904('0x141')](function(){var _0x2462b1=_['filter'](this[_0x6904('0x22')],function(_0x3faed8){return _0x3faed8['dialPreviewRecallmeReminder'];});var _0x1b797b=_['filter'](this[_0x6904('0x24')],function(_0x255006){return _0x255006['online']&&_0x255006[_0x6904('0x88')]===_0x6904('0x142');});if(_0x2462b1[_0x6904('0x103')]>0x0&&_0x1b797b[_0x6904('0x103')]>0x0){return Promise[_0x6904('0x143')]()[_0x6904('0x41')](cmHopper[_0x6904('0x144')](_[_0x6904('0x145')](_0x2462b1,'id'),previewRecallmeReminderInterval,_[_0x6904('0x145')](_0x1b797b,'id')))[_0x6904('0x41')](function(_0x2ba929){for(var _0x21e3ee=0x0;_0x21e3ee<_0x2ba929[_0x6904('0x103')];_0x21e3ee++){var _0x11ce42=_0x2ba929[_0x21e3ee][_0x6904('0x146')][_0x6904('0x62')];if(_0x11ce42)io['to'](util[_0x6904('0x7e')](_0x6904('0x147'),_0x11ce42))[_0x6904('0x43')](_0x6904('0x148'),{'hopper':_0x2ba929[_0x21e3ee]});}})[_0x6904('0xa5')](function(_0x573e6e){logger['error'](_0x6904('0x149'),_0x573e6e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x6904('0x1c')][_0x6904('0x14a')]=function(){var _0x25881e=this;setInterval(function(){_0x25881e[_0x6904('0x14b')](_0x25881e[_0x6904('0x28')],_0x6904('0x14c'));_0x25881e[_0x6904('0x14b')](_0x25881e[_0x6904('0xf2')],_0x6904('0x14d'));},0x32c8);};Dialer[_0x6904('0x1c')][_0x6904('0x14b')]=function(_0x490859,_0x1d6a48){var _0x382a50=this;for(var _0x3802f1 in _0x490859){if(typeof _0x490859[_0x3802f1]!==_0x6904('0x14e')){this[_0x6904('0x20')][_0x6904('0x1d')](function(){if(!_[_0x6904('0xf7')](_0x490859[_0x3802f1])){return ami[_0x6904('0x99')]({'action':_0x6904('0x88'),'channel':_0x490859[_0x3802f1]['channel']})[_0x6904('0xa5')](function(_0x35db85){if(_0x35db85[_0x6904('0x6b')]===_0x6904('0x14f')){setTimeout(function(){if(_0x490859[_0x3802f1]&&_0x490859[_0x3802f1][_0x6904('0x44')]!==_0x6904('0xbf')){_0x382a50[_0x6904('0xc0')](_0x382a50['voiceQueues'][_0x490859[_0x3802f1][_0x6904('0xbd')]]);logger['error'](_0x6904('0x150'),_0x1d6a48,_0x3802f1,_0x490859[_0x3802f1]['queue']);delete _0x490859[_0x3802f1];}if(_0x490859[_0x3802f1]&&_0x490859[_0x3802f1][_0x6904('0x44')]===_0x6904('0xbf')){_0x382a50[_0x6904('0xc0')](_0x382a50['campaigns'][_0x490859[_0x3802f1][_0x6904('0xbd')]]);logger[_0x6904('0x75')](_0x6904('0x151'),_0x1d6a48,_0x3802f1,_0x490859[_0x3802f1]['queue']);delete _0x490859[_0x3802f1];}},0x2328);}});}});}}};Dialer[_0x6904('0x1c')][_0x6904('0x152')]=function(_0x16904f){return Promise[_0x6904('0x143')]()[_0x6904('0x41')](voiceQueueRt[_0x6904('0x152')](_0x16904f))[_0x6904('0xa5')](loggerCatch(_0x6904('0x153')));};Dialer[_0x6904('0x1c')]['updateOriginated']=function(_0x3d5b8d){if(!_[_0x6904('0x42')](_0x3d5b8d)&&_0x3d5b8d!==null){if(typeof _0x3d5b8d[_0x6904('0x81')]!==_0x6904('0x14e')){if(_0x3d5b8d[_0x6904('0x81')]>0x0){_0x3d5b8d[_0x6904('0x81')]-=0x1;}else{logger['error'](_0x6904('0x154'));}}}else{logger[_0x6904('0x75')](_0x6904('0x155'));}};Dialer[_0x6904('0x1c')][_0x6904('0x156')]=function(_0x10061d,_0x1cdfec){var _0x5119e9=this;return function(_0x544138){_0x5119e9[_0x6904('0xc0')](_0x1cdfec);logger['error'](_0x10061d,util[_0x6904('0x67')](_0x544138,{'showHidden':![],'depth':null}));};};Dialer[_0x6904('0x1c')][_0x6904('0x157')]=function(_0x1bd8d6,_0x40a031,_0x22b197){var _0x4be499={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x40a031);this[_0x6904('0x119')](_[_0x6904('0xfc')](_0x4be499,_['pick'](_0x22b197,[_0x6904('0xdc'),_0x6904('0xdd'),_0x6904('0x158'),'VoiceQueueId','CampaignId'])),_0x6904('0x159'),'[emptyContact]');logger['error'](_0x1bd8d6);};Dialer[_0x6904('0x1c')][_0x6904('0x119')]=function(_0x1ad2db,_0x32abf1,_0x5b4a99){hopperUtils[_0x6904('0xe4')](_0x1ad2db)[_0x6904('0xa5')](loggerCatch(_0x32abf1));hopperUtils[_0x6904('0xca')](_0x1ad2db)[_0x6904('0xa5')](loggerCatch(_0x5b4a99));};Dialer[_0x6904('0x1c')][_0x6904('0xd9')]=function(_0x26ce97,_0x374c2e){hopperUtils['createHistory'](_0x26ce97)[_0x6904('0xa5')](loggerCatch(_0x6904('0xc9')));if(_0x374c2e==0x0){hopperUtils['moveContactManagedDialer'](_0x26ce97)[_0x6904('0xa5')](loggerCatch(_0x6904('0x15a')));}};Dialer[_0x6904('0x1c')][_0x6904('0x149')]=function(_0x2dac8d){return Promise['resolve']()['then'](cmHopper[_0x6904('0x144')](_0x2dac8d['id'],previewRecallmeReminderInterval))['then'](function(_0x5dc772){for(var _0x46144f=0x0;_0x46144f<_0x5dc772[_0x6904('0x103')];_0x46144f++){var _0x13ebaa=_0x5dc772[_0x46144f][_0x6904('0x146')]['name'];if(_0x13ebaa)io['to'](util[_0x6904('0x7e')](_0x6904('0x147'),_0x13ebaa))[_0x6904('0x43')](_0x6904('0x148'),{'hopper':_0x5dc772[_0x46144f]});}})['catch'](function(){});};Dialer[_0x6904('0x1c')][_0x6904('0xaa')]=function(_0x453f09){var _0x36a7fb=this;return function(){_0x36a7fb['handleIvr'](_0x453f09);};};Dialer['prototype'][_0x6904('0x15b')]=function(_0xee8898,_0x51d0c3){var _0x10cf73=this;var _0xfd6577=uuid['v4']();this[_0x6904('0xf2')][_0xfd6577]=new Action(_0xee8898,_0x51d0c3,_0xfd6577);return new Promise(function(_0x1efac8,_0x217ced){if(_[_0x6904('0x42')](_0xee8898)&&typeof _0xee8898!==_0x6904('0x15c')){return _0x217ced(msgResponse(_0x6904('0x15d'),_0x6904('0x92'),_0x6904('0x15e')));}if(_[_0x6904('0x42')](_0x51d0c3[_0x6904('0x15f')])||_0x51d0c3[_0x6904('0x15f')]===null){return _0x217ced(msgResponse(_0x6904('0x15d'),_0x6904('0x92'),'contact\x20is\x20undefine'));}var _0x1d5dcd={'XMD-CALLERID':_0x10cf73[_0x6904('0xf2')][_0xfd6577]['getCaller'](),'XMD-AGI':_0xee8898[_0x6904('0x132')]?util[_0x6904('0x7e')](_0x6904('0x160'),ipAgi,_0xee8898[_0x6904('0x132')]):'NONE','XMD-AGIAFTER':_0xee8898[_0x6904('0xc7')]?util[_0x6904('0x7e')](_0x6904('0x160'),ipAgi,_0xee8898['dialQueueProject2']):_0x6904('0x161'),'XMD-QUEUE':utils[_0x6904('0x162')](_0xee8898)?util['format'](_0x6904('0x163'),_0xee8898[_0x6904('0x62')],_0xee8898['dialQueueOptions']||'',_0xee8898['dialAgiAfterHangupAgent']?'c':'',_0xee8898[_0x6904('0x164')]||0x3):_0x6904('0x161'),'XMD-CONTACTID':_0x51d0c3[_0x6904('0xdc')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x10cf73[_0x6904('0xf2')][_0xfd6577][_0x6904('0x165')](),'XMD-AMD':_0xee8898[_0x6904('0x11c')]?_0x6904('0x13c'):_0x6904('0x161'),'XMD-DESTINATION':_0x6904('0x111')};if(_0xee8898['dialAMDActive']){_0x1d5dcd[_0x6904('0x166')]=_0xee8898[_0x6904('0x167')]||0x9c4;_0x1d5dcd['XMD-AMDGREETING']=_0xee8898[_0x6904('0x168')]||0x5dc;_0x1d5dcd['XMD-AMDAFTERGREETINGSILENCE']=_0xee8898['dialAMDAfterGreetingSilence']||0x320;_0x1d5dcd[_0x6904('0x169')]=_0xee8898['dialAMDTotalAnalysisTime']||0x1388;_0x1d5dcd['XMD-AMDMINWORDLENGTH']=_0xee8898['dialAMDMinWordLength']||0x64;_0x1d5dcd[_0x6904('0x16a')]=_0xee8898['dialAMDBetweenWordsSilence']||0x32;_0x1d5dcd[_0x6904('0x16b')]=_0xee8898['dialAMDMaximumNumberOfWords']||0x3;_0x1d5dcd[_0x6904('0x16c')]=_0xee8898[_0x6904('0x16d')]||0x100;_0x1d5dcd['XMD-AMDMAXIMUMWORDLENGTH']=_0xee8898[_0x6904('0x16e')]||0x1388;}if(utils['isOutboundQueue'](_0xee8898)){_0x1d5dcd[_0x6904('0x16f')]=_0x51d0c3[_0x6904('0xde')];}else{_0x1d5dcd['XMD-CAMPAIGNID']=_0x51d0c3[_0x6904('0xdf')];}var _0xf9b1bb=utils['setXMDContactVariables'](_0x51d0c3[_0x6904('0x170')]);Object[_0x6904('0x13e')](_0x1d5dcd,_0xf9b1bb);var _0x2247f8=_0x10cf73[_0x6904('0x86')](_0xee8898[_0x6904('0x8b')])?utils[_0x6904('0x171')](_0xee8898[_0x6904('0x8b')][_0x6904('0x172')],_0xee8898[_0x6904('0x173')],_0xee8898[_0x6904('0x174')]>0x0?utils[_0x6904('0x175')](_0xee8898[_0x6904('0x176')],_0xee8898[_0x6904('0x174')]):_0xee8898[_0x6904('0x176')]):utils[_0x6904('0x171')](_[_0x6904('0xf7')](_0xee8898[_0x6904('0x8c')])?_0xee8898[_0x6904('0x8b')][_0x6904('0x172')]:_0xee8898['TrunkBackup'][_0x6904('0x172')],_0xee8898[_0x6904('0x173')],_0xee8898[_0x6904('0x174')]>0x0?utils[_0x6904('0x175')](_0xee8898[_0x6904('0x176')],_0xee8898[_0x6904('0x174')]):_0xee8898[_0x6904('0x176')]);if(_0x2247f8){_0x1d5dcd['XMD-ORIGINATECALLERIDNAME']=_0x10cf73[_0x6904('0xf2')][_0xfd6577][_0x6904('0x177')]=utils[_0x6904('0x178')](_0x2247f8);_0x1d5dcd['XMD-ORIGINATECALLERIDNUM']=_0x51d0c3['phone'];}_0xee8898[_0x6904('0x179')]=_0x1d5dcd;return ami[_0x6904('0x99')]({'actionid':_0xfd6577,'action':'originate','channel':_0x10cf73[_0x6904('0x86')](_0xee8898[_0x6904('0x8b')])?util[_0x6904('0x7e')](_0x6904('0x17a'),_0xee8898[_0x6904('0x8b')][_0x6904('0x62')],isNotNull(_0xee8898['dialPrefix'])?_0xee8898[_0x6904('0x17b')][_0x6904('0x17c')]()||'':'',_0xee8898[_0x6904('0x17d')]>0x0?_0x51d0c3[_0x6904('0x15f')][_0x6904('0x17e')](_0xee8898[_0x6904('0x17d')]):_0x51d0c3[_0x6904('0x15f')]):util[_0x6904('0x7e')]('SIP/%s/%s%s',_[_0x6904('0xf7')](_0xee8898[_0x6904('0x8c')])?_0xee8898[_0x6904('0x8b')][_0x6904('0x62')]:_0xee8898[_0x6904('0x8c')][_0x6904('0x62')],isNotNull(_0xee8898[_0x6904('0x17b')])?_0xee8898[_0x6904('0x17b')][_0x6904('0x17c')]()||'':'',_0xee8898['dialCutDigit']>0x0?_0x51d0c3[_0x6904('0x15f')][_0x6904('0x17e')](_0xee8898[_0x6904('0x17d')]):_0x51d0c3['phone']),'callerid':_0x2247f8,'Exten':'xcally-motion-dialer','Context':_0x6904('0x17f'),'Priority':'1','variable':_0x1d5dcd,'timeout':(_0xee8898[_0x6904('0x180')]||0x1e)*0x3e8,'async':!![],'channelid':_0xfd6577})[_0x6904('0x41')](function(_0x30dba7){return _0x1efac8(_0x30dba7);})[_0x6904('0xa5')](function(_0x17d865){_0xee8898[_0x6904('0x181')]+=0x1;var _0x12ede9=new History(_0x10cf73['actions'][_0xfd6577]);logger[_0x6904('0x75')](util[_0x6904('0x7e')](_0x6904('0x182'),JSON['stringify'](_0x17d865)));_0x12ede9['state']=0xe;_0x12ede9[_0x6904('0x72')]=_0x6904('0x183');_0x12ede9[_0x6904('0x73')]=moment()[_0x6904('0x7e')](_0x6904('0xc2'));_0x12ede9[_0x6904('0xe1')]=_0x12ede9[_0x6904('0x73')];hopperUtils[_0x6904('0xe4')](_0x12ede9)['catch'](loggerCatch(_0x6904('0x184')));_0x10cf73['moveContactManagedDialer'](_0x12ede9)[_0x6904('0xa5')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x10cf73[_0x6904('0xf2')][_0xfd6577];return _0x217ced(msgResponse(_0x6904('0x15d'),_0x6904('0x85'),_0x6904('0x185')));});});});};Dialer[_0x6904('0x1c')][_0x6904('0x186')]=function(_0x2f8bea,_0x26b922,_0x1e6744){var _0x3ecc93=new History(_0x26b922);if(_0x3ecc93[_0x6904('0x187')]+_0x3ecc93[_0x6904('0x121')]+_0x3ecc93[_0x6904('0x122')]+_0x3ecc93[_0x6904('0x123')]+_0x3ecc93['countdropretry']+_0x3ecc93[_0x6904('0xeb')]+_0x3ecc93[_0x6904('0x11f')]+_0x3ecc93[_0x6904('0x124')]>=_0x1e6744[_0x6904('0x125')]-0x1){return!![];}switch(_0x2f8bea){case 0x3:if(_0x3ecc93[_0x6904('0x122')]>=_0x1e6744[_0x6904('0x188')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3ecc93[_0x6904('0x122')]+=0x1,'scheduledat':moment()['add'](_0x1e6744[_0x6904('0x189')],'minutes')[_0x6904('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ecc93[_0x6904('0xdc')],'ListId':_0x3ecc93[_0x6904('0xdd')],'VoiceQueueId':_0x3ecc93[_0x6904('0xde')]||undefined,'CampaignId':_0x3ecc93[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3ecc93[_0x6904('0x187')]>=_0x1e6744[_0x6904('0x18a')]-0x1){return!![];}hopperUtils[_0x6904('0xef')]({'active':![],'countbusyretry':_0x3ecc93['countbusyretry']+=0x1,'scheduledat':moment()[_0x6904('0xda')](_0x1e6744['dialBusyRetryFrequency'],'minutes')[_0x6904('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ecc93['ContactId'],'ListId':_0x3ecc93[_0x6904('0xdd')],'VoiceQueueId':_0x3ecc93['VoiceQueueId']||undefined,'CampaignId':_0x3ecc93[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x18b')));break;case 0x8:if(_0x3ecc93[_0x6904('0x121')]>=_0x1e6744[_0x6904('0x18c')]-0x1){return!![];}hopperUtils[_0x6904('0xef')]({'active':![],'countcongestionretry':_0x3ecc93[_0x6904('0x121')]+=0x1,'scheduledat':moment()[_0x6904('0xda')](_0x1e6744[_0x6904('0x18d')],_0x6904('0xdb'))[_0x6904('0x7e')](_0x6904('0xc2')),'ContactId':_0x3ecc93[_0x6904('0xdc')],'ListId':_0x3ecc93[_0x6904('0xdd')],'VoiceQueueId':_0x3ecc93[_0x6904('0xde')]||undefined,'CampaignId':_0x3ecc93['CampaignId']||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x18e')));break;case 0x0:if(_0x3ecc93[_0x6904('0x123')]>=_0x1e6744['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x3ecc93[_0x6904('0x123')]+=0x1,'scheduledat':moment()[_0x6904('0xda')](_0x1e6744[_0x6904('0x18f')],_0x6904('0xdb'))[_0x6904('0x7e')](_0x6904('0xc2')),'ContactId':_0x3ecc93[_0x6904('0xdc')],'ListId':_0x3ecc93[_0x6904('0xdd')],'VoiceQueueId':_0x3ecc93[_0x6904('0xde')]||undefined,'CampaignId':_0x3ecc93[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3ecc93[_0x6904('0xd3')]>=_0x1e6744[_0x6904('0x190')]-0x1){return!![];}hopperUtils[_0x6904('0xef')]({'active':![],'countdropretry':_0x3ecc93[_0x6904('0xd3')]+=0x1,'scheduledat':moment()['add'](_0x1e6744[_0x6904('0xd5')],_0x6904('0xdb'))[_0x6904('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ecc93[_0x6904('0xdc')],'ListId':_0x3ecc93['ListId'],'VoiceQueueId':_0x3ecc93[_0x6904('0xde')]||undefined,'CampaignId':_0x3ecc93[_0x6904('0xdf')]||undefined})['catch'](loggerCatch(_0x6904('0xe0')));break;case 0xb:if(_0x3ecc93[_0x6904('0xeb')]>=_0x1e6744[_0x6904('0xee')]-0x1){return!![];}hopperUtils[_0x6904('0xef')]({'active':![],'countabandonedretry':_0x3ecc93['countabandonedretry']+=0x1,'scheduledat':moment()[_0x6904('0xda')](_0x1e6744['dialAbandonedRetryFrequency'],_0x6904('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ecc93[_0x6904('0xdc')],'ListId':_0x3ecc93[_0x6904('0xdd')],'VoiceQueueId':_0x3ecc93[_0x6904('0xde')]||undefined,'CampaignId':_0x3ecc93[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0xf0')));break;case 0x13:if(_0x3ecc93[_0x6904('0x11f')]>=_0x1e6744[_0x6904('0x126')]-0x1){return!![];}hopperUtils[_0x6904('0xef')]({'active':![],'countmachineretry':_0x3ecc93[_0x6904('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x1e6744['dialMachineRetryFrequency'],'minutes')[_0x6904('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ecc93['ContactId'],'ListId':_0x3ecc93['ListId'],'VoiceQueueId':_0x3ecc93['VoiceQueueId']||undefined,'CampaignId':_0x3ecc93['CampaignId']||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x12a')));break;case 0x14:if(_0x3ecc93['countagentrejectretry']>=_0x1e6744[_0x6904('0x191')]-0x1){return!![];}hopperUtils[_0x6904('0xef')]({'active':![],'countagentrejectretry':_0x3ecc93[_0x6904('0x124')]+=0x1,'scheduledat':moment()[_0x6904('0xda')](_0x1e6744[_0x6904('0x192')],_0x6904('0xdb'))[_0x6904('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ecc93[_0x6904('0xdc')],'ListId':_0x3ecc93[_0x6904('0xdd')],'VoiceQueueId':_0x3ecc93[_0x6904('0xde')]||undefined,'CampaignId':_0x3ecc93[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x193')));break;default:return!![];}};Dialer[_0x6904('0x1c')]['callProgressDetecting']=function(_0x4a7e3a,_0x36ec77,_0x717646){var _0x4de6fd=this;var _0x2c3edb=new History(_0x4a7e3a);var _0x3b4492=![];var _0x2fdc1d;var _0x544ded;return new Promise(function(_0x57cb56,_0x31a435){if(_['isUndefined'](_0x36ec77)&&typeof _0x36ec77!==_0x6904('0x15c')){return _0x31a435(msgResponse(_0x6904('0x194'),_0x6904('0x92'),_0x6904('0x195')));}if(_[_0x6904('0x42')](_0x717646)&&typeof _0x717646!==_0x6904('0x15c')){return _0x31a435(msgResponse('[callProgressDetecting]',_0x6904('0x92'),_0x6904('0x196')));}hopperUtils[_0x6904('0xd6')](_0x2c3edb,_0x717646[_0x6904('0xc4')],_0x36ec77)[_0x6904('0x41')](function(_0x10fc28){if(_0x10fc28[_0x6904('0xd8')]==0x1)_0x3b4492=!![];switch(_0x717646[_0x6904('0xc4')]){case'0':_0x36ec77['outboundNoSuchCallsDay']+=0x1;_0x2c3edb[_0x6904('0x71')]=0x0;_0x2c3edb['statedesc']='NoSuchNumber';_0x2c3edb[_0x6904('0x123')]+=0x1;_0x2c3edb['countglobal']+=0x1;ami[_0x6904('0x43')](_0x6904('0x197'),ut[_0x6904('0x120')](_0x4a7e3a,_0x6904('0x198')));_0x2fdc1d=_0x36ec77[_0x6904('0x18f')];_0x544ded=_0x36ec77[_0x6904('0xed')];hopperUtils[_0x6904('0xe4')](_0x2c3edb)[_0x6904('0xa5')](loggerCatch(_0x6904('0x199')));if(_0x4de6fd[_0x6904('0x186')](0x0,_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0x123')]>=_0x36ec77[_0x6904('0x19a')]){_0x4de6fd[_0x6904('0x127')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x19b'));}else{_0x4de6fd[_0x6904('0x12e')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x19b'));}}break;case'3':_0x36ec77['outboundNoAnswerCallsDay']+=0x1;_0x2c3edb['state']=0x3;_0x2c3edb[_0x6904('0x72')]=_0x6904('0x19c');_0x2c3edb['countnoanswerretry']+=0x1;_0x2c3edb[_0x6904('0xd4')]+=0x1;var _0x3148e9=ut[_0x6904('0x19d')](_0x4a7e3a,_0x36ec77);ami['emit']('custom:agentnoanswer',_0x3148e9);_0x2fdc1d=_0x36ec77[_0x6904('0x189')];_0x544ded=_0x36ec77[_0x6904('0xed')];hopperUtils[_0x6904('0xe4')](_0x2c3edb)[_0x6904('0xa5')](loggerCatch(_0x6904('0x19e')));if(_0x4de6fd['checkRetriveMax'](0x3,_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0x122')]>=_0x36ec77['dialNoAnswerMaxRetry']){_0x4de6fd[_0x6904('0x127')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x19f'));}else{_0x4de6fd[_0x6904('0x12e')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x19f'));}}break;case'5':_0x36ec77[_0x6904('0x1a0')]+=0x1;_0x2c3edb[_0x6904('0x71')]=0x5;_0x2c3edb[_0x6904('0x72')]=_0x6904('0x1a1');_0x2c3edb['countbusyretry']+=0x1;_0x2c3edb['countglobal']+=0x1;ami['emit'](_0x6904('0x1a2'),ut['buildObj'](_0x4a7e3a,'busy'));_0x2fdc1d=_0x36ec77['dialBusyRetryFrequency'];_0x544ded=_0x36ec77[_0x6904('0xed')];hopperUtils[_0x6904('0xe4')](_0x2c3edb)[_0x6904('0xa5')](loggerCatch(_0x6904('0x1a3')));if(_0x4de6fd[_0x6904('0x186')](0x5,_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0x187')]>=_0x36ec77[_0x6904('0x18a')]){_0x4de6fd[_0x6904('0x127')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x1a4'));}else{_0x4de6fd[_0x6904('0x12e')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x1a4'));}}break;case'8':_0x36ec77[_0x6904('0x1a5')]+=0x1;_0x2c3edb[_0x6904('0x71')]=0x8;_0x2c3edb[_0x6904('0x72')]=_0x6904('0x1a6');_0x2c3edb[_0x6904('0x121')]+=0x1;_0x2c3edb[_0x6904('0xd4')]+=0x1;_0x2fdc1d=_0x36ec77['dialCongestionRetryFrequency'];_0x544ded=_0x36ec77[_0x6904('0xed')];ami[_0x6904('0x43')]('custom:agentcongestion',ut[_0x6904('0x120')](_0x4a7e3a,'congestion'));hopperUtils[_0x6904('0xe4')](_0x2c3edb)[_0x6904('0xa5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4de6fd[_0x6904('0x186')](0x8,_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0x121')]>=_0x36ec77[_0x6904('0x18c')]){_0x4de6fd[_0x6904('0x127')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x1a7'));}else{_0x4de6fd[_0x6904('0x12e')](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x1a7'));}}break;case'11':_0x36ec77['outboundAbandonedCallsDay']+=0x1;_0x2c3edb['state']=0xb;_0x2c3edb[_0x6904('0x72')]=_0x6904('0xe8');_0x2c3edb[_0x6904('0xeb')]+=0x1;_0x2c3edb[_0x6904('0xd4')]+=0x1;_0x2fdc1d=_0x36ec77['dialAbandonedRetryFrequency'];_0x544ded=_0x36ec77[_0x6904('0xed')];hopperUtils[_0x6904('0xe4')](_0x2c3edb)[_0x6904('0xa5')](loggerCatch(_0x6904('0xf1')));if(_0x4de6fd['checkRetriveMax'](0xb,_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0xeb')]>=_0x36ec77[_0x6904('0xee')]){_0x4de6fd['createStateFinal'](_0x2c3edb,_0x57cb56,_0x31a435,'reason\x2011\x20abandoned');}else{_0x4de6fd['stateGlobal'](_0x2c3edb,_0x57cb56,_0x31a435,_0x6904('0x1a8'));}}break;case'20':_0x36ec77[_0x6904('0x1a9')]+=0x1;_0x2c3edb[_0x6904('0x71')]=0x14;_0x2c3edb[_0x6904('0x72')]=_0x6904('0x1aa');_0x2c3edb[_0x6904('0x124')]+=0x1;_0x2c3edb['countglobal']+=0x1;_0x2fdc1d=_0x36ec77[_0x6904('0x192')];_0x544ded=_0x36ec77[_0x6904('0xed')];ami[_0x6904('0x43')]('custom:agentreject',ut[_0x6904('0x120')](_0x4a7e3a,_0x6904('0x1ab')));hopperUtils[_0x6904('0xe4')](_0x2c3edb)[_0x6904('0xa5')](loggerCatch(_0x6904('0x1ac')));if(_0x4de6fd['checkRetriveMax'](0x14,_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0x124')]>=_0x36ec77[_0x6904('0x191')]){_0x4de6fd[_0x6904('0x127')](_0x2c3edb,_0x57cb56,_0x31a435,'reason\x2020\x20agentreject');}else{_0x4de6fd[_0x6904('0x12e')](_0x2c3edb,_0x57cb56,_0x31a435,'reason\x2020\x20agentreject');}}break;default:_0x36ec77[_0x6904('0x136')]+=0x1;_0x2c3edb['state']=0xc;_0x2c3edb[_0x6904('0x72')]=_0x717646[_0x6904('0xc4')];_0x2fdc1d=_0x36ec77['dialAgentRejectRetryFrequency'];_0x544ded=_0x36ec77['callAdditionalPhoneAfterMin'];hopperUtils[_0x6904('0xe4')](_0x2c3edb)['catch'](loggerCatch(_0x6904('0x1ad')));if(_0x4de6fd[_0x6904('0x186')](_0x717646[_0x6904('0xc4')],_0x4a7e3a,_0x36ec77)&&!_0x3b4492){if(_0x2c3edb[_0x6904('0x187')]+_0x2c3edb[_0x6904('0x121')]+_0x2c3edb[_0x6904('0x122')]+_0x2c3edb['countnosuchnumberretry']+_0x2c3edb['countdropretry']+_0x2c3edb['countabandonedretry']+_0x2c3edb[_0x6904('0x11f')]+_0x2c3edb['countagentrejectretry']>=_0x36ec77[_0x6904('0x125')]){_0x4de6fd[_0x6904('0x12e')](_0x2c3edb,_0x57cb56,_0x31a435,_0x717646['reason']);}else{_0x4de6fd[_0x6904('0x127')](_0x2c3edb,_0x57cb56,_0x31a435,_0x717646[_0x6904('0xc4')]);}}}})[_0x6904('0x41')](function(){if(_0x3b4492){hopperUtils[_0x6904('0x1ae')](_0x2c3edb,_0x2fdc1d,_0x544ded)[_0x6904('0x41')](function(){return _0x57cb56(0x1);});}});});};Dialer[_0x6904('0x1c')]['stateGlobal']=function(_0x1c2d0b,_0x497489,_0x1ea029,_0x38980f){var _0x519f1e=new Final(_0x1c2d0b);_0x519f1e[_0x6904('0x71')]=0xf;_0x519f1e[_0x6904('0x72')]=_0x6904('0x1af');this[_0x6904('0x127')](_0x519f1e,_0x497489,_0x1ea029,_0x38980f);};Dialer[_0x6904('0x1c')][_0x6904('0x127')]=function(_0x13afa1,_0xe95650,_0x1d32c0,_0x3d0361){hopperUtils['moveContactManagedDialer'](_0x13afa1)[_0x6904('0x41')](function(){return _0xe95650(msgResponse(_0x6904('0x194'),_0x6904('0x10d'),_0x3d0361));})[_0x6904('0xa5')](function(){return _0x1d32c0(msgResponse('[moveContactManagedDialer][0]','Failure',_0x6904('0x1b0')));});};Dialer[_0x6904('0x1c')]['predictive']=function(_0x4f323c){var _0x40c19e=_0x4f323c[_0x6904('0x1b1')]/0x64;var _0x93ed78=_0x4f323c[_0x6904('0xcf')]/(_0x4f323c[_0x6904('0xcf')]+_0x4f323c[_0x6904('0xc3')]);var _0x330b82=Math[_0x6904('0x1b2')](_0x4f323c[_0x6904('0x1b3')]*(_0x4f323c[_0x6904('0x1b4')]/0x64));var _0x57c94a=Math[_0x6904('0x1b2')](_0x4f323c[_0x6904('0x1b3')]*(_0x4f323c['predictiveIntervalMinThreshold']/0x64));var _0x102486=_0x4f323c[_0x6904('0x13a')]+_0x4f323c['talking'];var _0x26cad9=Math[_0x6904('0x1b5')](_0x4f323c[_0x6904('0x59')]*_0x4f323c['erlangAbandonmentRate']*_0x4f323c['predictiveIntervalHitRate']*_0x4f323c['predictiveIntervalMultiplicativeFactor']);if(_[_0x6904('0x42')](_0x4f323c['startProgressive'])){if(!_['isUndefined'](_0x4f323c[_0x6904('0x2a')])){_0x4f323c[_0x6904('0x2a')]=undefined;loggerPredictive[_0x6904('0x75')]('[startMethodPredictive][StartProgressive]',_0x6904('0x1b6'));}if(!_[_0x6904('0x42')](_0x4f323c[_0x6904('0x64')])){loggerPredictive[_0x6904('0x75')](_0x6904('0x1b7'),_0x6904('0x1b8'));clearInterval(_0x4f323c[_0x6904('0x64')]);_0x4f323c[_0x6904('0x64')]=undefined;}_0x4f323c[_0x6904('0x61')]=moment()['format'](_0x6904('0xc2'));loggerPredictive[_0x6904('0x4a')](_0x4f323c['name'],_0x6904('0x1b9'),_0x4f323c[_0x6904('0x61')]);this[_0x6904('0xaf')](_0x4f323c,0x1);}else if(ifInterval(_0x4f323c['dialPredictiveInterval'],_0x4f323c[_0x6904('0x61')])){this[_0x6904('0xaf')](_0x4f323c,0x1);loggerPredictiveCalls[_0x6904('0x4a')](_0x6904('0x1ba'),_0x4f323c[_0x6904('0x61')],_0x4f323c[_0x6904('0x62')]);_0x4f323c[_0x6904('0x59')]=0x0;_0x4f323c[_0x6904('0xd0')]=0x0;}else if(_0x40c19e<_0x93ed78&&_0x4f323c[_0x6904('0x1bb')]===_0x6904('0x1bc')){clearPredictiveAttributes(_0x4f323c);loggerPredictive[_0x6904('0x4a')](_0x6904('0x1bd'),_0x6904('0x1be'),_0x93ed78,'startProgressive',_0x4f323c['name']);}else if(_0x26cad9<_0x4f323c[_0x6904('0xd0')]&&_0x4f323c[_0x6904('0x1bb')]===_0x6904('0x1bc')){clearPredictiveAttributes(_0x4f323c);loggerPredictive['info'](_0x6904('0x1bf'),_0x6904('0x1c0'),_0x26cad9,_0x6904('0x1c1'),_0x4f323c[_0x6904('0xd0')],_0x6904('0x61'),_0x4f323c[_0x6904('0x62')]);}else if(!ifInterval(_0x4f323c[_0x6904('0x1c2')],_0x4f323c[_0x6904('0x61')])&&_[_0x6904('0x42')](_0x4f323c[_0x6904('0x2a')])&&!_[_0x6904('0x42')](_0x4f323c[_0x6904('0x61')])){_0x4f323c[_0x6904('0x2a')]=moment()[_0x6904('0x7e')](_0x6904('0xc2'));loggerPredictive[_0x6904('0x4a')](_0x4f323c['name'],'started\x20in\x20predictive\x20at',_0x4f323c['startPredictive']);hopperUtils[_0x6904('0x1c3')](_0x4f323c[_0x6904('0x1c2')])['then'](this[_0x6904('0x1c4')](_0x4f323c))[_0x6904('0x41')](mergeDataErlangB(_0x4f323c))[_0x6904('0x41')](this[_0x6904('0x1c5')](_0x4f323c))['catch'](loggerCatchPredictive(_0x6904('0x1c6'),_0x4f323c));}else if(!ifInterval(_0x4f323c[_0x6904('0x1c2')],_0x4f323c[_0x6904('0x2a')])){_0x4f323c['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4f323c['startPredictive']=moment()[_0x6904('0x7e')](_0x6904('0xc2'));loggerPredictive[_0x6904('0x4a')](_0x4f323c['name'],_0x6904('0x1c7'),_0x4f323c[_0x6904('0x2a')]);clearInterval(_0x4f323c[_0x6904('0x64')]);_0x4f323c[_0x6904('0x64')]=undefined;hopperUtils['avgHandleTime'](_0x4f323c[_0x6904('0x1c2')])[_0x6904('0x41')](this[_0x6904('0x1c4')](_0x4f323c))[_0x6904('0x41')](mergeDataErlangB(_0x4f323c))[_0x6904('0x41')](this[_0x6904('0x1c5')](_0x4f323c))[_0x6904('0xa5')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4f323c));}else if(_0x4f323c[_0x6904('0x1b3')]&&_0x102486<_0x4f323c[_0x6904('0x1b3')]-_0x57c94a){clearPredictiveAttributes(_0x4f323c);loggerPredictive['info'](_0x4f323c[_0x6904('0x62')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x102486,_0x6904('0x1c8'),_0x4f323c[_0x6904('0x1b3')],'-',_0x57c94a,'=',_0x4f323c['predictiveIntervalAvailable']-_0x57c94a,')');}else if(_0x4f323c[_0x6904('0x1b3')]&&_0x102486>_0x4f323c['predictiveIntervalAvailable']+_0x330b82){clearPredictiveAttributes(_0x4f323c);loggerPredictive[_0x6904('0x4a')](_0x4f323c['name'],_0x6904('0x1c9'),_0x102486,_0x6904('0x1ca'),_0x4f323c['predictiveIntervalAvailable'],'+',_0x330b82,'=',_0x4f323c[_0x6904('0x1b3')]+_0x330b82,')');}};Dialer[_0x6904('0x1c')][_0x6904('0x1c4')]=function(_0x2af440){var _0x35cac8=this;return function(_0x58505e){return new Promise(function(_0x4bfa27,_0x44d284){_['merge'](_0x2af440,_0x58505e[0x0]);if(checkGetDataPredictive(_0x58505e[0x0])){var _0x2c24f0=_0x2af440[_0x6904('0x1b3')]=_0x2af440[_0x6904('0x13b')]+_0x2af440[_0x6904('0x13a')];var _0x43d070=_0x2af440[_0x6904('0x1c2')]*0x3c;var _0x4d676b=_0x58505e[0x0][_0x6904('0x53')]+_0x58505e[0x0]['predictiveIntervalAvgHoldtime'];var _0x21d3bb=(_0x58505e[0x0][_0x6904('0x4c')]+_0x58505e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x58505e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x58505e[0x0][_0x6904('0x1cb')];_0x2af440[_0x6904('0x1cc')]=_0x21d3bb>0x0?_0x21d3bb:0x1;switch(_0x2af440[_0x6904('0x1bb')]){case _0x6904('0x1bc'):var _0x3534db=_0x2af440[_0x6904('0x1b1')]/0x64;return _0x35cac8[_0x6904('0x1cd')](_0x2c24f0,_0x43d070,_0x4d676b,_0x21d3bb,_0x3534db)['then'](function(_0x1c93ff){return _0x4bfa27(_0x1c93ff);});case _0x6904('0x1ce'):var _0x3e8467=_0x2af440[_0x6904('0x1b1')]/0x64;return _0x35cac8[_0x6904('0x1cf')](_0x2c24f0,_0x43d070,_0x4d676b,_0x21d3bb,_0x3e8467)[_0x6904('0x41')](function(_0x459499){return _0x4bfa27(_0x459499);});default:return _0x44d284(msgResponse(_0x6904('0x1d0'),_0x6904('0x92'),'Unknown\x20Predictive'));}}else{return _0x44d284(msgResponse(_0x6904('0x1d0'),_0x6904('0x92'),'check\x20failure'));}});};};Dialer[_0x6904('0x1c')][_0x6904('0x1d1')]=function(_0xc04f25){var _0x31e3d9=this;return function(_0x427d38){return new Promise(function(_0x28f765,_0x135617){_['merge'](_0xc04f25,_0x427d38[0x0]);if(checkGetDataPredictive(_0x427d38[0x0])){loggerPredictive['info'](JSON[_0x6904('0x76')](_0x427d38[0x0]));if(_0xc04f25['dialPredictiveOptimization']===_0x6904('0x1bc')){return _0x31e3d9[_0x6904('0x152')](_0xc04f25['id'])[_0x6904('0x41')](function(_0x47e8b2){var _0x35c016=_0xc04f25[_0x6904('0x1d2')]-_0x47e8b2[0x0]['outboundQueuePauses'];var _0x138ea9=_0xc04f25[_0x6904('0x1c2')]*0x3c;var _0x40d813=_0x427d38[0x0][_0x6904('0x53')]+_0x427d38[0x0][_0x6904('0x50')];var _0x4d4e2a=(_0x427d38[0x0][_0x6904('0x4c')]+_0x427d38[0x0][_0x6904('0xce')]+_0x427d38[0x0][_0x6904('0xe6')])/_0x427d38[0x0]['predictiveIntervalTotalCalls'];var _0x2f9bf4=_0xc04f25[_0x6904('0x1b1')]/0x64;_0xc04f25[_0x6904('0x1d3')]=_0x47e8b2[0x0][_0x6904('0x1d4')]||0x0;_0xc04f25['predictiveIntervalHitRate']=_0x4d4e2a>0x0?_0x4d4e2a:0x1;return _0x31e3d9['abandonmentRate'](_0x35c016,_0x138ea9,_0x40d813,_0x4d4e2a,_0x2f9bf4);})[_0x6904('0x41')](function(_0x3a27fa){return _0x28f765(_0x3a27fa);})[_0x6904('0xa5')](function(_0xc440cb){return _0x135617(msgResponse(_0x6904('0x1d5'),_0x6904('0x92'),JSON[_0x6904('0x76')](_0xc440cb)));});}if(_0xc04f25[_0x6904('0x1bb')]===_0x6904('0x1ce')){return _0x31e3d9['getVoiceQueueRtPauses'](_0xc04f25['id'])['then'](function(_0x3f70be){var _0x322c35=_0xc04f25[_0x6904('0x1d2')]-_0x3f70be[0x0]['outboundQueuePauses'];var _0x22d44e=_0xc04f25[_0x6904('0x1c2')]*0x3c;var _0x4e2e3f=_0x427d38[0x0][_0x6904('0x53')]+_0x427d38[0x0]['predictiveIntervalAvgHoldtime'];var _0x42923b=(_0x427d38[0x0][_0x6904('0x4c')]+_0x427d38[0x0][_0x6904('0xce')]+_0x427d38[0x0][_0x6904('0xe6')])/_0x427d38[0x0][_0x6904('0x1cb')];var _0x941474=_0xc04f25[_0x6904('0x1b1')]/0x64;_0xc04f25['predictiveIntervalPauses']=_0x3f70be[0x0][_0x6904('0x1d4')]||0x0;_0xc04f25['predictiveIntervalHitRate']=_0x42923b>0x0?_0x42923b:0x1;return _0x31e3d9[_0x6904('0x1cf')](_0x322c35,_0x22d44e,_0x4e2e3f,_0x42923b,_0x941474);})[_0x6904('0x41')](function(_0x5342c8){return _0x28f765(_0x5342c8);})[_0x6904('0xa5')](function(_0x5691ad){return _0x135617(msgResponse(_0x6904('0x1d5'),_0x6904('0x92'),JSON['stringify'](_0x5691ad)));});}}else{return _0x135617(msgResponse(_0x6904('0x1d0'),_0x6904('0x92'),_0x6904('0x1d6')));}});};};Dialer[_0x6904('0x1c')][_0x6904('0x1c5')]=function(_0x5b1cfb){var _0x4cf1c5=this;return function(){var _0x11d885=0x0;var _0x15d9d9=Math[_0x6904('0x1b5')](_0x5b1cfb[_0x6904('0x5b')]*0x3e8);if(_0x15d9d9>0x0){_0x15d9d9=_0x15d9d9<0x64?0x64:_0x15d9d9;loggerPredictive[_0x6904('0x4a')](_0x5b1cfb['name'],_0x6904('0x1d7'),_0x15d9d9,_0x6904('0x1d8'));_0x5b1cfb[_0x6904('0x64')]=setInterval(function(){_0x4cf1c5['handlePredictive'](_0x5b1cfb);loggerPredictiveCalls['info'](_0x6904('0x1d9'),_0x11d885+=0x1);},_0x15d9d9);}else{loggerPredictive[_0x6904('0x4a')](_0x5b1cfb[_0x6904('0x62')],_0x6904('0x1da'));}};};Dialer[_0x6904('0x1c')][_0x6904('0x1db')]=function(_0x1fb7d2,_0xdf450a){var _0x2e0842=this;return function(_0x13a9a8){if(_[_0x6904('0x49')](_0x13a9a8)){if(_[_0x6904('0xf7')](_0xdf450a[_0x6904('0x158')])||!_0xdf450a[_0x6904('0x1dc')]){if(_0x1fb7d2[_0x6904('0xad')]===_0x6904('0xa')){_0x1fb7d2[_0x6904('0x74')]=_[_0x6904('0x42')](_0x1fb7d2[_0x6904('0x74')])?!![]:_0x1fb7d2[_0x6904('0x74')];var _0x5be744=uuid['v4']();_0x2e0842[_0x6904('0xf2')][_0x5be744]=new Action(_0x1fb7d2,_0xdf450a,_0x5be744);loggerBooked[_0x6904('0x4a')](_0x6904('0x1dd'),_0x5be744,_0x6904('0x1de'),JSON[_0x6904('0x76')](_0x1fb7d2[_0x6904('0x74')]),_0x6904('0x1df'),_0x1fb7d2[_0x6904('0x62')]);if(_0x1fb7d2[_0x6904('0x74')]){_0x1fb7d2[_0x6904('0x74')]=![];_0x2e0842[_0x6904('0x2c')][_0x2e0842['actions'][_0x5be744][_0x6904('0xbd')]]=[];ami[_0x6904('0x99')]({'actionid':_0x5be744,'action':_0x6904('0x1e0'),'queue':_0x1fb7d2[_0x6904('0x62')]})[_0x6904('0xa5')](function(){_0x2e0842[_0x6904('0xc0')](_0x1fb7d2);hopperUtils[_0x6904('0xef')]({'active':![],'ContactId':_0x2e0842['actions'][_0x5be744][_0x6904('0xdc')],'ListId':_0x2e0842[_0x6904('0xf2')][_0x5be744]['ListId'],'VoiceQueueId':_0x2e0842[_0x6904('0xf2')][_0x5be744][_0x6904('0xde')]||undefined,'CampaignId':_0x2e0842['actions'][_0x5be744]['CampaignId']||undefined})[_0x6904('0xa5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2e0842[_0x6904('0xf2')][_0x5be744];});}else{loggerBooked[_0x6904('0x4a')](_0x6904('0x1e1'),JSON[_0x6904('0x76')](_0x1fb7d2['queueStatusComplete']),_0x6904('0x1df'),_0x1fb7d2[_0x6904('0x62')]);_0x2e0842[_0x6904('0xc0')](_0x1fb7d2);hopperUtils[_0x6904('0xef')]({'active':![],'ContactId':_0x2e0842[_0x6904('0xf2')][_0x5be744]['ContactId'],'ListId':_0x2e0842[_0x6904('0xf2')][_0x5be744]['ListId'],'VoiceQueueId':_0x2e0842[_0x6904('0xf2')][_0x5be744][_0x6904('0xde')]||undefined,'CampaignId':_0x2e0842['actions'][_0x5be744][_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x1e2')));delete _0x2e0842['actions'][_0x5be744];}}else{return _0x2e0842['actionOriginate'](_0x1fb7d2,_0xdf450a);}}else{if(utils['getSeconds'](undefined,_0xdf450a[_0x6904('0x1e3')])<_0x1fb7d2[_0x6904('0x1e4')]*0x3c){if(_0xdf450a[_0x6904('0x146')]&&!_0xdf450a[_0x6904('0x146')][_0x6904('0x1e5')]){_0x2e0842[_0x6904('0x21')][_0x6904('0xfe')](_0xdf450a['id'])[_0x6904('0x1f')](function(){_0x2e0842[_0x6904('0xc0')](_0x1fb7d2);});}else{hopperUtils['unlockContact']({'active':![]},_0xdf450a['id'],0x1)['finally'](function(){_0x2e0842['updateOriginated'](_0x1fb7d2);});}}else{_0x1fb7d2[_0x6904('0x1e6')]+=0x1;_0x2e0842['updateOriginated'](_0x1fb7d2);if(_0x1fb7d2[_0x6904('0x1e7')]){hopperUtils[_0x6904('0xef')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xdf450a[_0x6904('0xdc')],'ListId':_0xdf450a[_0x6904('0xdd')],'VoiceQueueId':_0xdf450a[_0x6904('0xde')]||undefined,'CampaignId':_0xdf450a[_0x6904('0xdf')]||undefined})[_0x6904('0xa5')](loggerCatch(_0x6904('0x1e8')));hopperUtils[_0x6904('0xe4')](createObjHistory(_0x1fb7d2,_0xdf450a,utils[_0x6904('0x6c')]['QUEUE_RECALL'],0x17,_0x6904('0x1e9')))[_0x6904('0xa5')](loggerCatch(_0x6904('0x1ea')));}else{_0x2e0842['saveInDb'](createObjHistory(_0x1fb7d2,_0xdf450a,utils[_0x6904('0x6c')][_0x6904('0x1eb')],0x16,_0x6904('0x1ec')),'[Originate][HistoryRecallClose][historyCatch]',_0x6904('0x1ed'));}}}}else{_0x1fb7d2[_0x6904('0x1ee')]+=0x1;_0x2e0842[_0x6904('0x119')](createObjHistory(_0x1fb7d2,_0xdf450a,utils[_0x6904('0x6c')][_0x6904('0x1ef')],0xd,_0x6904('0x1f0')),_0x6904('0x1f1'),_0x6904('0x1f2'));throw _0x6904('0x1f3');}};};Dialer['prototype']['handleIvr']=function(_0x3724e6){var _0x117032=this;var _0x2e31f6=_0x3724e6[_0x6904('0x1f4')]-_0x3724e6[_0x6904('0x81')];emitCampaignSummary(_0x3724e6);if(_0x2e31f6>0x0&&_0x3724e6[_0x6904('0x69')]==0x0){if(_0x2e31f6>this[_0x6904('0x26')]){_0x2e31f6=this['maxNumberOriginate'];}_0x3724e6[_0x6904('0x69')]=0x1;hopperUtils[_0x6904('0x1f5')](_0x3724e6,_0x2e31f6)[_0x6904('0x41')](function(_0x432ae6){_0x3724e6[_0x6904('0x69')]=0x0;if(_0x432ae6){if(!utils[_0x6904('0x1f6')](_0x432ae6)){_0x3724e6['message']=utils[_0x6904('0x6c')][_0x6904('0x6f')];logger['info'](_0x6904('0x1f7')+_0x3724e6['name']);}else{_0x3724e6[_0x6904('0x81')]+=_0x432ae6[_0x6904('0x103')];_0x3724e6['message']=utils['CAMPAIGN_STATUS'][_0x6904('0x1f8')];for(var _0xc76a2f=0x0;_0xc76a2f<_0x432ae6['length'];_0xc76a2f+=0x1){_0x3724e6[_0x6904('0x1f9')]+=0x1;if(_[_0x6904('0xf7')](_0x432ae6[_0xc76a2f])||_['isNil'](_0x432ae6[_0xc76a2f]['Contact'])||_[_0x6904('0xf7')](_0x432ae6[_0xc76a2f]['phone'])){_0x117032[_0x6904('0x157')](_0x6904('0x1fa'),_0x3724e6,_0x432ae6[_0xc76a2f]);}else{hopperUtils[_0x6904('0x1fb')](_['pick'](_0x432ae6[_0xc76a2f],[_0x6904('0xdf'),_0x6904('0x15f')]))['then'](_0x117032['checkContactBlack'](_0x3724e6,_0x432ae6[_0xc76a2f]))[_0x6904('0xa5')](_0x117032[_0x6904('0x156')](_0x6904('0x1fc'),_0x3724e6));}}}}})[_0x6904('0xa5')](loggerGetContactDialer('[getContactCampaign2]',_0x3724e6,_0x2e31f6));}};Dialer[_0x6904('0x1c')]['handlePower']=function(_0x494d29,_0x356593){var _0x50a439=this;var _0x514a04=[];if(_0x356593<0x1||_0x494d29[_0x6904('0xad')]===_0x6904('0xa')){_0x356593=0x1;}var _0x434418=Math['floor'](_0x494d29[_0x6904('0x13a')]*_0x356593)-_0x494d29[_0x6904('0x81')];if(_0x494d29[_0x6904('0x1fd')]>0x0){var _0x22f322=_0x494d29[_0x6904('0x1fd')]-_0x494d29[_0x6904('0x81')]-_0x494d29[_0x6904('0x13b')]-_0x494d29[_0x6904('0x1fe')];if(_0x434418>_0x22f322){_0x434418=_0x22f322;}}if(_0x434418>0x0&&_0x494d29[_0x6904('0x69')]==0x0){if(_0x494d29[_0x6904('0xad')]===_0x6904('0xa')){_0x434418=0x1;}if(_0x434418>this[_0x6904('0x26')]){_0x434418=this[_0x6904('0x26')];}for(var _0x1b0291 in this[_0x6904('0x24')]){if(typeof this[_0x6904('0x24')][_0x1b0291]!=='undefined'){if(this[_0x6904('0x24')][_0x1b0291]['state']===_0x6904('0x1ff')&&this[_0x6904('0x24')][_0x1b0291][_0x6904('0x88')]==='reachable'){_0x514a04[_0x6904('0x9d')](this[_0x6904('0x24')][_0x1b0291]['id']);}}}_0x494d29['temp']=0x1;hopperUtils[_0x6904('0x200')](_0x494d29,_0x514a04,_0x434418)[_0x6904('0x41')](function(_0x238b2d){_0x494d29['temp']=0x0;if(_0x238b2d){if(!utils[_0x6904('0x1f6')](_0x238b2d)){hopperUtils[_0x6904('0x201')](_0x494d29)[_0x6904('0x41')](sendMessageReschedule(_0x494d29))[_0x6904('0xa5')](loggerCatch(_0x6904('0x202')));}else{_0x494d29[_0x6904('0x81')]+=_0x238b2d[_0x6904('0x103')];_0x494d29[_0x6904('0x6b')]=_0x494d29[_0x6904('0xad')]==='booked'?utils['CAMPAIGN_STATUS'][_0x6904('0x13c')]:utils[_0x6904('0x6c')]['RUNNING'];for(var _0x420bb2=0x0;_0x420bb2<_0x238b2d[_0x6904('0x103')];_0x420bb2+=0x1){if(_[_0x6904('0xf7')](_0x238b2d[_0x420bb2])||_[_0x6904('0xf7')](_0x238b2d[_0x420bb2][_0x6904('0x170')])||_[_0x6904('0xf7')](_0x238b2d[_0x420bb2][_0x6904('0x15f')])){_0x50a439[_0x6904('0x157')](_0x6904('0x1fa'),_0x494d29,_0x238b2d[_0x420bb2]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x238b2d[_0x420bb2],[_0x6904('0xde'),_0x6904('0x15f')]))['then'](_0x50a439[_0x6904('0x1db')](_0x494d29,_0x238b2d[_0x420bb2]))[_0x6904('0xa5')](_0x50a439[_0x6904('0x156')](_0x6904('0x1fa'),_0x494d29));}}}}})[_0x6904('0xa5')](loggerGetContactDialer('[getContactDialer2]',_0x494d29,_0x434418));}};Dialer[_0x6904('0x1c')]['handlePredictive']=function(_0x1f5a29){if(_0x1f5a29[_0x6904('0x1fd')]>0x0){var _0x4654cb=_0x1f5a29[_0x6904('0x1fd')]-_0x1f5a29['originated']-_0x1f5a29[_0x6904('0x13b')];if(_0x4654cb>0x0&&_0x1f5a29[_0x6904('0x69')]==0x0){this[_0x6904('0x203')](_0x1f5a29);}else{loggerPredictiveCalls['info'](_0x6904('0x204'));}}else{this['tryOriginatePredictive'](_0x1f5a29);}};Dialer[_0x6904('0x1c')]['tryOriginatePredictive']=function(_0x1e730f){var _0x3fa426=this;var _0xeb1fa2=[];_0x1e730f[_0x6904('0x81')]+=0x1;for(var _0xe6e8de in this['agents']){if(typeof this[_0x6904('0x24')][_0xe6e8de]!==_0x6904('0x14e')){if(this[_0x6904('0x24')][_0xe6e8de]['state']===_0x6904('0x1ff')&&this[_0x6904('0x24')][_0xe6e8de][_0x6904('0x88')]===_0x6904('0x142')){_0xeb1fa2[_0x6904('0x9d')](this[_0x6904('0x24')][_0xe6e8de]['id']);}}}_0x1e730f['temp']=0x1;return this[_0x6904('0x200')](_0x1e730f['id'],_0xeb1fa2,0x1,_0x1e730f[_0x6904('0x205')],_0x1e730f)[_0x6904('0x41')](function(_0x180aac){_0x1e730f['temp']=0x1;if(_0x180aac){if(!utils[_0x6904('0x1f6')](_0x180aac)){utils[_0x6904('0x68')](_0x1e730f,0x1,0x0);return hopperUtils[_0x6904('0x201')](_0x1e730f)[_0x6904('0x41')](sendMessageReschedule(_0x1e730f))[_0x6904('0xa5')](loggerCatch(_0x6904('0x202')));}else{_0x1e730f['message']=utils[_0x6904('0x6c')]['RUNNING'];if(_['isNil'](_0x180aac[0x0])||_[_0x6904('0xf7')](_0x180aac[0x0][_0x6904('0x170')])||_[_0x6904('0xf7')](_0x180aac[0x0]['phone'])){_0x3fa426[_0x6904('0x157')]('[actionOriginate]\x20',_0x1e730f,_0x180aac[0x0]);}else{return hopperUtils[_0x6904('0x206')](_[_0x6904('0xfd')](_0x180aac[0x0],[_0x6904('0xde'),_0x6904('0x15f')]))[_0x6904('0x41')](_0x3fa426[_0x6904('0x1db')](_0x1e730f,_0x180aac[0x0]))[_0x6904('0xa5')](_0x3fa426[_0x6904('0x156')]('[actionOriginatePredictive]\x20',_0x1e730f));}}}})[_0x6904('0xa5')](loggerGetContactDialer(_0x6904('0x207'),_0x1e730f,0x1));};Dialer[_0x6904('0x1c')][_0x6904('0x1cd')]=function(_0x287617,_0x5c22c4,_0x302945,_0x49982e,_0x479272,_0x1e8e57){loggerPredictive[_0x6904('0x4a')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x6904('0x4a')](_0x6904('0x208'),_0x287617);loggerPredictive['info'](_0x6904('0x209'),_0x5c22c4);loggerPredictive[_0x6904('0x4a')](_0x6904('0x20a'),_0x302945);loggerPredictive[_0x6904('0x4a')]('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',_0x49982e);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x479272);loggerPredictive[_0x6904('0x4a')](_0x6904('0x52'));return new Promise(function(_0x2eb73b,_0x13f0d9){if(_0x287617<=0x0||isNaN(_0x287617)){return _0x13f0d9(msgResponse('[abandonmentRate]',_0x6904('0x85'),_0x6904('0x20b')+_0x287617));}if(_0x302945<=0x0||isNaN(_0x302945)){return _0x13f0d9(msgResponse('[abandonmentRate]','Error',_0x6904('0x20c')+_0x302945));}if(_0x49982e<=0x0||isNaN(_0x49982e)){return _0x13f0d9(msgResponse(_0x6904('0x20d'),_0x6904('0x85'),_0x6904('0x20e')+_0x49982e));}if(_0x5c22c4<=0x0||isNaN(_0x5c22c4)){return _0x13f0d9(msgResponse('[abandonmentRate]',_0x6904('0x85'),'interval\x20=\x20'+_0x5c22c4));}if(_0x479272<=0x0||isNaN(_0x479272)){return _0x13f0d9(msgResponse('[abandonmentRate]','Error',_0x6904('0x20f')+_0x479272));}_0x1e8e57=_0x1e8e57||0x0;var _0x380c38=0x1/_0x302945;var _0x3602ee=0x0;var _0x4d3184=0x0;var _0x46ab61=0x0;var _0x3b575e=0x0;for(var _0x582722=0x0;_0x46ab61<_0x479272;_0x582722+=0x1){_0x4d3184=_0x582722/_0x5c22c4;_0x3602ee=(_0x49982e*_0x4d3184+_0x1e8e57)/_0x380c38;_0x46ab61=utils['erlangb'](_0x3602ee,_0x287617);_0x3b575e=_0x3602ee/_0x287617*(0x1-utils[_0x6904('0x210')](_0x3602ee,_0x287617));}return _0x2eb73b({'erlangCalls':_0x582722,'erlangCallToSecond':_0x5c22c4/_0x582722,'erlangAbandonmentRate':_0x46ab61,'erlangBusyFactor':_0x3b575e});});};Dialer[_0x6904('0x1c')][_0x6904('0x1cf')]=function(_0xc72940,_0x1c3cad,_0x5a72d3,_0x385457,_0x199d73,_0x25880d){loggerPredictive[_0x6904('0x4a')](_0x6904('0x211'));loggerPredictive['info'](_0x6904('0x208'),_0xc72940);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c3cad);loggerPredictive[_0x6904('0x4a')]('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',_0x5a72d3);loggerPredictive[_0x6904('0x4a')](_0x6904('0x212'),_0x385457);loggerPredictive[_0x6904('0x4a')](_0x6904('0x213'),_0x199d73);loggerPredictive['info'](_0x6904('0x52'));return new Promise(function(_0x360b8d,_0x3c59d7){if(_0xc72940<=0x0||isNaN(_0xc72940)){return _0x3c59d7(msgResponse(_0x6904('0x214'),_0x6904('0x85'),'m\x20=\x20'+_0xc72940));}if(_0x5a72d3<=0x0||isNaN(_0x5a72d3)){return _0x3c59d7(msgResponse(_0x6904('0x214'),'Error',_0x6904('0x20c')+_0x5a72d3));}if(_0x385457<=0x0||isNaN(_0x385457)){return _0x3c59d7(msgResponse(_0x6904('0x214'),_0x6904('0x85'),_0x6904('0x20e')+_0x385457));}if(_0x1c3cad<=0x0||isNaN(_0x1c3cad)){return _0x3c59d7(msgResponse(_0x6904('0x214'),_0x6904('0x85'),_0x6904('0x215')+_0x1c3cad));}if(_0x199d73<=0x0||isNaN(_0x199d73)){return _0x3c59d7(msgResponse(_0x6904('0x214'),_0x6904('0x85'),'Umin\x20=\x20'+_0x199d73));}_0x25880d=_0x25880d||0x0;var _0xe85af0=0x1/_0x5a72d3;var _0x10fcf7=0x0;var _0xdc1fa9=0x0;var _0x22537a=0x0;var _0x42f7dd=0x0;for(var _0xa51af=0x0;_0x42f7dd<_0x199d73;_0xa51af+=0x1){_0xdc1fa9=_0xa51af/_0x1c3cad;_0x10fcf7=(_0x385457*_0xdc1fa9+_0x25880d)/_0xe85af0;_0x22537a=utils['erlangb'](_0x10fcf7,_0xc72940);_0x42f7dd=_0x10fcf7/_0xc72940*(0x1-utils['erlangb'](_0x10fcf7,_0xc72940));}return _0x360b8d({'erlangCalls':_0xa51af,'erlangCallToSecond':_0x1c3cad/_0xa51af,'erlangAbandonmentRate':_0x22537a,'erlangBusyFactor':_0x42f7dd});});};module[_0x6904('0x216')]=Dialer; \ No newline at end of file +var _0x78e7=['error','stack','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','Action','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','type','updateOriginated','answertime','ivr','outboundAnswerCallsDay','agent','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countglobal','callAdditionalPhoneAfterMin','additional','queueCallerAbandonCreateState','countdropretry','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','voiceQueue','dialAbandonedMaxRetry','rescheduleContact','[rescheduleContact][Abandoned]','calleridnum','createHistory','[syncAgentComplete][createHistory][11]','actions','channel','actionid','rrmemory','roundrobin','isNil','locked','paused','stateinterface','push','idHopper','run','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countnoanswerretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknow','[syncHangupIvr][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','merge','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','Trunk','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','loggedIn','predictiveIntervalPauses','outboundQueuePauses','startMethodPredictive','erlangCallToSecond','one\x20call\x20every:','milliseconds','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','getSeconds','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','ACTIVE','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','predictiveIntervalAvgTalktime','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','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78e7,0x1cb));var _0x778e=function(_0x2875ac,_0x481cac){_0x2875ac=_0x2875ac-0x0;var _0x1ec6ba=_0x78e7[_0x2875ac];return _0x1ec6ba;};'use strict';var util=require(_0x778e('0x0'));var _=require(_0x778e('0x1'));var uuid=require(_0x778e('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x778e('0x3'));var utils=require('./utils');var hopperUtils=require(_0x778e('0x4'));var ut=require(_0x778e('0x5'));var config=require('../../../config/environment/');var logger=require(_0x778e('0x6'))(_0x778e('0x7'));var loggerBooked=require(_0x778e('0x6'))('booked');var loggerPredictive=require('../../../config/logger')(_0x778e('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x778e('0x9'));var loggerSyncQueueSummary=require(_0x778e('0x6'))('syncQueueSummary');var ami=require(_0x778e('0xa'));config[_0x778e('0xb')]=_[_0x778e('0xc')](config[_0x778e('0xb')],{'host':_0x778e('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x778e('0xb')]));var cmHopper=require(_0x778e('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x778e('0xf'));var Interval=require(_0x778e('0x10'));var Action=require(_0x778e('0x11'));var History=require(_0x778e('0x12'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x778e('0x13'));var Hangup=require(_0x778e('0x14'));var ipAgi=process[_0x778e('0x15')]['XCALLY_IP_AGI']||_0x778e('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x27765a){this[_0x778e('0x17')]=this[_0x778e('0x17')]?this[_0x778e('0x17')][_0x778e('0x18')](_0x27765a):_0x27765a();};function Dialer(_0x8f3e2b,_0x5ee40a){this['sequence']=new Sequence();this[_0x778e('0x19')]=_0x5ee40a;this['voiceQueues']=_0x8f3e2b[_0x778e('0x1a')];this[_0x778e('0x1b')]=_0x8f3e2b['campaigns'];this[_0x778e('0x1c')]=_0x8f3e2b[_0x778e('0x1c')];this[_0x778e('0x1d')]=_0x8f3e2b[_0x778e('0x1d')];this['maxNumberOriginate']=config[_0x778e('0x1e')]||0x2;this[_0x778e('0x1f')]={};this['actions']={};this[_0x778e('0x20')]={};this[_0x778e('0x21')]={};this[_0x778e('0x22')]={};this[_0x778e('0x23')]={};this[_0x778e('0x24')]={};this['ivrOriginated']={};this[_0x778e('0x25')]={};this[_0x778e('0x26')]={};this['queuesSummary']={};ami['on'](_0x778e('0x27'),this[_0x778e('0x28')][_0x778e('0x29')](this));ami['on']('queuecallerabandon',this[_0x778e('0x2a')]['bind'](this));ami['on'](_0x778e('0x2b'),this[_0x778e('0x2c')][_0x778e('0x29')](this));ami['on']('agentcomplete',this[_0x778e('0x2d')]['bind'](this));ami['on'](_0x778e('0x2e'),this[_0x778e('0x2f')]['bind'](this));ami['on'](_0x778e('0x30'),this[_0x778e('0x31')]['bind'](this));ami['on'](_0x778e('0x32'),this[_0x778e('0x33')][_0x778e('0x29')](this));ami['on'](_0x778e('0x34'),this[_0x778e('0x35')][_0x778e('0x29')](this));ami['on'](_0x778e('0x36'),this[_0x778e('0x37')]['bind'](this));ami['on'](_0x778e('0x38'),this[_0x778e('0x39')]['bind'](this));ami['on'](_0x778e('0x3a'),this[_0x778e('0x3b')][_0x778e('0x29')](this));this[_0x778e('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0x778e('0x3d')]()['then'](function(_0x56167b){previewRecallmeReminderInterval=_0x56167b[_0x778e('0x3e')];});}function isNotNull(_0x3764b5){return _0x3764b5!==null&&!_['isUndefined'](_0x3764b5);}function msgResponse(_0x4de829,_0x5dd3f6,_0x2994cf){return{'action':_0x4de829,'response':_0x5dd3f6,'message':_0x2994cf,'stack':_0x2994cf};}function emit(_0x380cf5,_0x46791c,_0x54e838){io['to'](_0x380cf5)[_0x778e('0x3f')](_0x46791c,_0x54e838);}function emitOutboundVoiceQueueSummary(_0x49a7e5){if(_0x49a7e5['type']===_0x778e('0x40')){logger[_0x778e('0x41')](_0x778e('0x42'),util[_0x778e('0x43')](_0x49a7e5,{'showHidden':![],'depth':null}));emit(util['format'](_0x778e('0x44'),_0x49a7e5[_0x778e('0x45')]),_0x778e('0x46'),_0x49a7e5);}}function checkGetDataPredictive(_0x484714){if(isNotNull(_0x484714)&&!_['isEmpty'](_0x484714)){loggerPredictive['info'](_0x778e('0x47'));loggerPredictive[_0x778e('0x48')](_0x778e('0x49'),_0x484714[_0x778e('0x4a')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x4b'),_0x484714[_0x778e('0x4c')]);loggerPredictive['info'](_0x778e('0x4d'),_0x484714[_0x778e('0x4e')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x4f'),_0x484714[_0x778e('0x50')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x51'),_0x484714[_0x778e('0x52')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x53'),_0x484714['predictiveIntervalAvgTalktime']);loggerPredictive[_0x778e('0x48')]('---------------------------');if(_0x484714[_0x778e('0x4a')]>0x0){if(!_[_0x778e('0x54')](_0x484714[_0x778e('0x55')])&&_0x484714['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x778e('0x48')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x778e('0x54')](_0x484714['predictiveIntervalAvgHoldtime'])&&_0x484714[_0x778e('0x52')]>0x0){return!![];}loggerPredictive[_0x778e('0x48')](_0x778e('0x56'));}else{loggerPredictive['info'](_0x778e('0x57'));}}else{loggerPredictive[_0x778e('0x48')](_0x778e('0x58'));}return![];}function mergeDataErlangB(_0x24a6a4){return function(_0x3efb13){loggerPredictive[_0x778e('0x48')](_0x778e('0x59'));loggerPredictive[_0x778e('0x48')](_0x778e('0x5a'),_0x3efb13[_0x778e('0x5b')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x5c'),_0x3efb13['erlangCallToSecond']);loggerPredictive['info'](_0x778e('0x5d'),_0x3efb13[_0x778e('0x5e')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3efb13[_0x778e('0x5f')]);loggerPredictive[_0x778e('0x48')](_0x778e('0x5d'),_0x3efb13[_0x778e('0x5e')]);loggerPredictive[_0x778e('0x48')]('---------------------------');_['merge'](_0x24a6a4,_0x3efb13);};}function ifInterval(_0x796951,_0x2dea4d){if(_['isUndefined'](_0x2dea4d)){return![];}return utils['getSeconds'](undefined,_0x2dea4d)<_0x796951*0x3c;}function clearPredictiveAttributes(_0x4f33a6){if(_0x4f33a6[_0x778e('0x24')]){_0x4f33a6[_0x778e('0x24')]=undefined;loggerPredictive[_0x778e('0x41')](_0x4f33a6[_0x778e('0x45')],_0x778e('0x60'));}if(_0x4f33a6[_0x778e('0x23')]){_0x4f33a6[_0x778e('0x23')]=undefined;loggerPredictive['debug'](_0x4f33a6['name'],_0x778e('0x61'));}if(_0x4f33a6[_0x778e('0x62')]){clearInterval(_0x4f33a6['handlePredictive']);_0x4f33a6[_0x778e('0x62')]=undefined;loggerPredictive[_0x778e('0x41')](_0x4f33a6[_0x778e('0x45')],_0x778e('0x63'));}}function loggerCatchPredictive(_0x8a0ed3,_0x2f0e65){return function(_0x5b6d78){loggerPredictive[_0x778e('0x64')](_0x2f0e65[_0x778e('0x45')],_0x8a0ed3);loggerPredictive[_0x778e('0x64')](_0x5b6d78[_0x778e('0x65')]);clearPredictiveAttributes(_0x2f0e65);};}function loggerCatch(_0x2191b8){return function(_0x223b62){logger[_0x778e('0x64')](_0x2191b8,util[_0x778e('0x43')](_0x223b62,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4fdb70,_0x14ae47,_0x5b1ba8){return function(_0x496371){utils[_0x778e('0x66')](_0x14ae47,_0x5b1ba8,0x0);_0x14ae47['temp']=0x0;logger['error'](_0x4fdb70,util[_0x778e('0x43')](_0x496371,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3c9387){return function(_0x1dc99b){if(isNotNull(_0x1dc99b)&&isNotNull(_0x1dc99b[0x0])){if(_0x1dc99b[0x0][_0x778e('0x67')]>0x0){_0x3c9387['message']=utils[_0x778e('0x68')][_0x778e('0x69')];logger[_0x778e('0x48')](_0x778e('0x6a')+_0x3c9387['name'],_0x1dc99b[0x0][_0x778e('0x67')],_0x778e('0x6b'));}else{_0x3c9387[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x6d')];logger[_0x778e('0x48')](_0x778e('0x6e')+_0x3c9387[_0x778e('0x45')]);}}};}function createObjHistory(_0xaebcf9,_0x24d075,_0x244dc7,_0x1eac4e,_0x458948){_0xaebcf9[_0x778e('0x6c')]=_0x244dc7;var _0x1ab025=new Action(_0xaebcf9,_0x24d075);var _0x552eac=new History(_0x1ab025);_0x552eac[_0x778e('0x6f')]=_0x1eac4e;_0x552eac[_0x778e('0x70')]=_0x458948;_0x552eac[_0x778e('0x71')]=_0x1ab025[_0x778e('0x72')];return _0x552eac;}function unlockQueueStatus(_0x42e294,_0x537b6d){setTimeout(function(){if(_[_0x778e('0x54')](_0x42e294[_0x778e('0x73')])){loggerBooked[_0x778e('0x64')](_0x778e('0x74'),_0x537b6d);}_0x42e294[_0x778e('0x73')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x537b6d,JSON[_0x778e('0x75')](_[_0x778e('0x76')](_0x42e294,[_0x778e('0x45'),_0x778e('0x73')])));},0x1f3);}function checkInterval(_0x2addcf){return function(){if(!isNotNull(_0x2addcf[_0x778e('0x77')])){_0x2addcf[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];throw _0x2addcf[_0x778e('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2addcf[_0x778e('0x77')][_0x778e('0x79')])){_0x2addcf[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];throw _0x2addcf[_0x778e('0x45')]+_0x778e('0x7a');}if(!isNotNull(_['isEmpty'](_0x2addcf['Interval'][_0x778e('0x79')]))){_0x2addcf[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];throw _0x2addcf[_0x778e('0x45')]+_0x778e('0x7a');}};}function checkIsIVRCampaignActive(_0x2c4f2c){return function(){if(!utils[_0x778e('0x7b')](_0x2c4f2c)){_0x2c4f2c['message']=utils['CAMPAIGN_STATUS'][_0x778e('0x7c')];throw _0x2c4f2c[_0x778e('0x45')]+_0x778e('0x7d');}};}function emitCampaignSummary(_0x5f4e23){if(utils[_0x778e('0x7e')](_0x5f4e23)){emit(util[_0x778e('0x7f')](_0x778e('0x80'),_0x5f4e23['name']),'campaign:save',_0x5f4e23);}}function loggerCatchQueueSummary(_0x4703e6,_0x240034){return function(_0x1b2699){clearPredictiveAttributes(_0x240034);emitCampaignSummary(_0x240034);loggerSyncQueueSummary['debug'](_0x4703e6,util[_0x778e('0x43')](_0x1b2699,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x28acf1){if(_0x28acf1[_0x778e('0x81')]){if(_0x28acf1[_0x778e('0x82')]===0x0){_0x28acf1[_0x778e('0x81')]=![];_0x28acf1['message']=utils[_0x778e('0x68')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x778e('0x83'),_0x28acf1[_0x778e('0x45')],_0x778e('0x84'));}else{_0x28acf1[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x85')];loggerSyncQueueSummary[_0x778e('0x41')](_0x778e('0x83'),_0x28acf1['name'],_0x778e('0x86'));}emitCampaignSummary(_0x28acf1);}}function myreject(_0x3e9595){return function(_0x55e1b0){return _0x3e9595(msgResponse(_0x778e('0x87'),_0x778e('0x88'),JSON[_0x778e('0x75')](_0x55e1b0)));};}Dialer[_0x778e('0x89')][_0x778e('0x8a')]=function(_0x376689){return!_[_0x778e('0x54')](_0x376689)&&_0x376689&&!_['isUndefined'](_0x376689[_0x778e('0x45')])&&!_['isUndefined'](_0x376689[_0x778e('0x8b')])&&_0x376689['active']&&(this[_0x778e('0x1d')][util[_0x778e('0x7f')](_0x778e('0x8c'),_0x376689[_0x778e('0x45')])][_0x778e('0x8d')]===_0x778e('0x8e')||this[_0x778e('0x1d')][util[_0x778e('0x7f')]('SIP/%s',_0x376689[_0x778e('0x45')])]['status']===_0x778e('0x8f'));};Dialer[_0x778e('0x89')][_0x778e('0x90')]=function(_0x5e36e1){var _0x34ea52=this;return function(){if(!_0x34ea52[_0x778e('0x8a')](_0x5e36e1['Trunk'])){if(!_0x34ea52[_0x778e('0x8a')](_0x5e36e1['TrunkBackup'])){_0x5e36e1['message']=utils[_0x778e('0x68')][_0x778e('0x91')];throw _0x5e36e1['name']+_0x778e('0x92');}}};};Dialer['prototype'][_0x778e('0x93')]=function(_0x417a01,_0x28a839,_0x1c2800,_0x2a12a9){var _0x5a3f70=this;return function(){var _0x305d97=!![];return _0x5a3f70[_0x778e('0x94')](_0x417a01,_0x28a839,_0x1c2800,_0x2a12a9,_0x305d97);};};Dialer[_0x778e('0x89')][_0x778e('0x95')]=function(_0x343086,_0x24acac,_0x353be3,_0xd2d5c0){var _0x11b51c=this;return function(){var _0x1a18ba=![];return _0x11b51c[_0x778e('0x94')](_0x343086[_0x778e('0x79')],_0x24acac,_0x353be3,_0xd2d5c0,_0x1a18ba);};};Dialer[_0x778e('0x89')][_0x778e('0x94')]=function(_0x580125,_0x5d7bbf,_0x32de7f,_0x2986c2,_0x25d63f){var _0x594483=[];return new Promise(function(_0x546cb3,_0x383899){if(!isNotNull(_0x580125)){_0x2986c2[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x78')];return _0x383899(msgResponse(_0x778e('0x96'),'Failure',_0x32de7f+_0x778e('0x97')));}if(_[_0x778e('0x98')](_0x580125)){_0x2986c2[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x99')];return _0x383899(msgResponse(_0x778e('0x96'),_0x778e('0x9a'),_0x32de7f+_0x778e('0x9b')));}if(_0x5d7bbf&&_[_0x778e('0x54')](config[_0x778e('0x9c')][_0x5d7bbf])){_0x2986c2[_0x778e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x778e('0x9d')];return _0x383899(msgResponse('ifTime','Failure',_0x32de7f+_0x778e('0x9e')+_0x5d7bbf));}if(_[_0x778e('0x9f')](_0x580125)){for(var _0x41a02e=0x0;_0x41a02e<_0x580125[_0x778e('0xa0')];_0x41a02e+=0x1){_0x594483['push'](ami['Action']({'action':_0x778e('0xa1'),'command':util[_0x778e('0x7f')](_0x778e('0xa2'),_0x580125[_0x41a02e][_0x778e('0xa3')],!_[_0x778e('0x54')](config[_0x778e('0x9c')][_0x5d7bbf])?_0x5d7bbf:'')})[_0x778e('0xa4')](function(_0x3d5bcc){return _0x3d5bcc[_0x778e('0xa5')][_0x778e('0xa6')](_0x778e('0xa7'))>=0x0;})[_0x778e('0xa8')](myreject(_0x383899)));}}else{_0x594483['push'](ami[_0x778e('0xa9')]({'action':_0x778e('0xa1'),'command':util[_0x778e('0x7f')](_0x778e('0xa2'),_0x580125,!_[_0x778e('0x54')](config[_0x778e('0x9c')][_0x5d7bbf])?_0x5d7bbf:'')})[_0x778e('0xa4')](function(_0x43557e){return _0x43557e['content'][_0x778e('0xa6')]('true')>=0x0;})[_0x778e('0xa8')](myreject(_0x383899)));}Promise[_0x778e('0xaa')](_0x594483)['then'](function(_0x22726b){var _0x13b3f2=_[_0x778e('0xab')](_0x22726b);if(_0x13b3f2){return _0x546cb3(_0x13b3f2);}else{_0x2986c2[_0x778e('0x6c')]=_0x25d63f?utils[_0x778e('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x778e('0x68')][_0x778e('0xac')];return _0x383899(msgResponse(_0x778e('0xad'),'Failure',_0x778e('0xae')+_0x25d63f+'\x20'+_0x32de7f+_0x778e('0xaf')+util[_0x778e('0x43')](_0x580125,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5d7bbf));}})[_0x778e('0xa8')](function(_0x26a068){return _0x383899(msgResponse(_0x778e('0x96'),_0x778e('0x9a'),JSON[_0x778e('0x75')](_0x26a068)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x1d0016=this;return cmHopper[_0x778e('0xb0')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x1d0016['syncCampaigns']();},0x3e8);});};Dialer[_0x778e('0x89')][_0x778e('0xb1')]=function(){var _0x491eda=this;var _0x1ea5df;for(var _0x1d4bd3 in this[_0x778e('0x1b')]){if(typeof this[_0x778e('0x1b')][_0x1d4bd3]!=='undefined'){_0x1ea5df=this[_0x778e('0x1b')][_0x1d4bd3];if(utils[_0x778e('0x7e')](_0x1ea5df)&&utils[_0x778e('0x7b')](_0x1ea5df)){_0x1ea5df[_0x778e('0x81')]=!![];Promise['resolve']()[_0x778e('0xa4')](checkIsIVRCampaignActive(_0x1ea5df))[_0x778e('0xa4')](checkInterval(_0x1ea5df))[_0x778e('0xa4')](_0x491eda[_0x778e('0x90')](_0x1ea5df))[_0x778e('0xa4')](_0x491eda[_0x778e('0x93')](_0x1ea5df['dialGlobalInterval'],_0x1ea5df[_0x778e('0xb2')],_0x1ea5df[_0x778e('0x45')],_0x1ea5df))['then'](_0x491eda[_0x778e('0x95')](_0x1ea5df[_0x778e('0x77')],_0x1ea5df['dialTimezone'],_0x1ea5df[_0x778e('0x45')],_0x1ea5df))[_0x778e('0xa4')](_0x491eda[_0x778e('0xb3')](_0x1ea5df))[_0x778e('0xa8')](loggerCatchQueueSummary(_0x778e('0xb4'),_0x1ea5df));}else{notSendMessagesCampaign(_0x1ea5df);}}}};Dialer[_0x778e('0x89')]['checkDialMethod']=function(_0x373508){if(_0x373508[_0x778e('0xb5')]!==_0x778e('0x8')){clearPredictiveAttributes(_0x373508);}switch(_0x373508[_0x778e('0xb5')]){case _0x778e('0xb6'):this[_0x778e('0xb7')](_0x373508,0x1);break;case'power':this[_0x778e('0xb7')](_0x373508,_0x373508[_0x778e('0xb8')]);break;case _0x778e('0x8'):this['predictive'](_0x373508);break;case'booked':this[_0x778e('0xb7')](_0x373508,0x1);break;default:logger[_0x778e('0x64')](_0x778e('0xb9'),_0x373508[_0x778e('0x45')],_0x778e('0xba'));}};Dialer[_0x778e('0x89')]['ifTime']=function(_0x26ed66,_0x126189){var _0x50635d=_0x26ed66[_0x778e('0xb2')];var _0x32493c=_0x126189?_0x26ed66['dialGlobalInterval']:_0x26ed66[_0x778e('0x77')][_0x778e('0x79')];logger[_0x778e('0xbb')](_0x778e('0xbc'),_0x32493c,_0x50635d,_0x26ed66['name'],util[_0x778e('0x7f')](_0x778e('0xbd'),_0x26ed66[_0x778e('0x45')],_0x26ed66['id']));var _0x1d8a5c=null;return Interval[_0x778e('0xbe')](_0x32493c,_0x50635d)[_0x778e('0xa4')](function(_0xbf20f4){if(_0xbf20f4===!![]){return _0xbf20f4;}else{_0x26ed66[_0x778e('0x6c')]=_0x126189?utils[_0x778e('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x778e('0xac')];_0x1d8a5c=msgResponse(_0x778e('0xad'),_0x778e('0x9a'),'Global:\x20'+_0x126189+'\x20'+_0x26ed66[_0x778e('0x45')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x778e('0x43')](_0x32493c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x50635d);}if(_0x1d8a5c!==null){logger[_0x778e('0xbb')](_0x778e('0xbf'),_0x1d8a5c);_0x1d8a5c[_0x778e('0xc0')]=_0x126189;throw _0x1d8a5c;}})[_0x778e('0xa8')](function(_0x4d77c2){logger['error']('AMI\x20IfTime',_0x4d77c2);throw msgResponse('[ifTime][Action]',_0x778e('0x88'),util[_0x778e('0x43')](_0x4d77c2,{'showHidden':![],'depth':null}));});};Dialer[_0x778e('0x89')][_0x778e('0x28')]=function(_0x24a20c){if(this[_0x778e('0x1a')][_0x24a20c[_0x778e('0xc1')]]){if(this[_0x778e('0x21')][_0x24a20c[_0x778e('0xc2')]]&&this['uniqueId'][_0x24a20c[_0x778e('0xc2')]][_0x778e('0xc3')]!=='ivr'){this[_0x778e('0xc4')](this[_0x778e('0x1a')][_0x24a20c[_0x778e('0xc1')]]);this[_0x778e('0x21')][_0x24a20c['uniqueid']][_0x778e('0xc5')]=moment()[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x778e('0x89')]['syncAgentComplete']=function(_0x261e23){var _0xc15f0e=this['uniqueId'][_0x261e23['uniqueid']];if(this[_0x778e('0x1a')][_0x261e23[_0x778e('0xc1')]]){if(_0xc15f0e&&_0xc15f0e['type']!==_0x778e('0xc6')){delete this[_0x778e('0x21')][_0x261e23['uniqueid']];this[_0x778e('0x1a')][_0x261e23['queue']][_0x778e('0xc7')]+=0x1;var _0x1019a2=new AgentComplete(_0xc15f0e,_0x261e23);if(_0x261e23['reason']===_0x778e('0xc8')){_0x1019a2['agiafterat']=this[_0x778e('0x1a')][_0x261e23[_0x778e('0xc1')]][_0x778e('0xc9')]&&this[_0x778e('0x1a')][_0x261e23['queue']][_0x778e('0xca')]?moment()[_0x778e('0x7f')](_0x778e('0xcb')):undefined;}hopperUtils['createHistory'](_0x1019a2)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x778e('0xcc')](_0x1019a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0xcd')));}}};Dialer[_0x778e('0x89')][_0x778e('0x2a')]=function(_0x30daea){var _0xbde01f=this['uniqueId'][_0x30daea[_0x778e('0xc2')]];var _0x7139a6=this;var _0x5cffe1=![];var _0x3b689e;var _0x35fab2;if(this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]]){if(_0xbde01f&&_0xbde01f[_0x778e('0xc3')]!==_0x778e('0xc6')){delete this['uniqueId'][_0x30daea['uniqueid']];this['updateOriginated'](this[_0x778e('0x1a')][_0x30daea['queue']]);_0xbde01f[_0x778e('0xce')]=moment()[_0x778e('0x7f')](_0x778e('0xcb'));var _0x1c5a48=new QueueCallerAbandon(_0xbde01f,_0x30daea);if(utils['getSeconds'](_0xbde01f['droptime'],_0xbde01f[_0x778e('0xcf')])>=_0xbde01f[_0x778e('0xd0')]){this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0x4e')]+=0x1;this[_0x778e('0x1a')][_0x30daea['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xd1')]+=0x1;_0x1c5a48[_0x778e('0x6f')]=0xa;_0x1c5a48[_0x778e('0x70')]=_0x778e('0xd2');_0x1c5a48[_0x778e('0xd3')]='TIMEOUT';_0x1c5a48['agiafterat']=this['voiceQueues'][_0x30daea['queue']][_0x778e('0xc9')]?moment()['format'](_0x778e('0xcb')):undefined;_0x1c5a48['countdropretry']+=0x1;_0x1c5a48[_0x778e('0xd4')]+=0x1;_0x3b689e=this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]]['dialDropRetryFrequency'];_0x35fab2=this[_0x778e('0x1a')][_0x30daea['queue']][_0x778e('0xd5')];hopperUtils['verifyAdditionalPhones'](_0x1c5a48,_0x1c5a48[_0x778e('0x6f')],_0xbde01f['voiceQueue'])['then'](function(_0x3e9b74){_0x5cffe1=_0x3e9b74[_0x778e('0xd6')]==0x1;if(_0x1c5a48['countdropretry']>=_0x7139a6[_0x778e('0x1a')][_0x30daea['queue']]['dialDropMaxRetry']){_0x7139a6[_0x778e('0xd7')](_0x1c5a48,_0x3e9b74['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1c5a48[_0x778e('0xd8')],'scheduledat':moment()[_0x778e('0xd9')](_0x7139a6[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xda')],_0x778e('0xdb'))[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbde01f[_0x778e('0xdc')],'ListId':_0xbde01f[_0x778e('0xdd')],'VoiceQueueId':_0xbde01f[_0x778e('0xde')]||undefined,'CampaignId':_0xbde01f[_0x778e('0xdf')]||undefined})['catch'](loggerCatch(_0x778e('0xe0')));var _0x3cb838=new History(_0x1c5a48);_0x3cb838['state']=0xa;_0x3cb838[_0x778e('0x70')]=_0x778e('0xd2');_0x3cb838['starttime']=moment()[_0x778e('0x7f')](_0x778e('0xcb'));_0x3cb838['endtime']=_0x3cb838[_0x778e('0x72')];_0x3cb838['calleridname']=_0x1c5a48[_0x778e('0xe1')];_0x3cb838['calleridnum']=_0x1c5a48['calleridnum'];hopperUtils['createHistory'](_0x3cb838)[_0x778e('0xa8')](loggerCatch(_0x778e('0xe2')));}})['then'](function(){if(_0x5cffe1)hopperUtils[_0x778e('0xe3')](_0x1c5a48,_0x3b689e,_0x35fab2)[_0x778e('0xa4')](function(){return 0x1;});});}else{this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xe4')]+=0x1;_0x1c5a48[_0x778e('0x6f')]=0xb;_0x1c5a48[_0x778e('0x70')]=_0x778e('0xe5');_0x1c5a48[_0x778e('0xd3')]=_0x778e('0xe6');_0x1c5a48[_0x778e('0xe7')]+=0x1;_0x1c5a48['countglobal']+=0x1;_0x3b689e=this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xe8')];_0x35fab2=this[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xd5')];hopperUtils[_0x778e('0xe9')](_0x1c5a48,_0x1c5a48[_0x778e('0x6f')],_0xbde01f[_0x778e('0xea')])['then'](function(_0x23483c){if(_0x1c5a48[_0x778e('0xe7')]>=_0x7139a6[_0x778e('0x1a')][_0x30daea[_0x778e('0xc1')]][_0x778e('0xeb')]){_0x7139a6[_0x778e('0xd7')](_0x1c5a48,_0x23483c[_0x778e('0xd6')]);}else{hopperUtils[_0x778e('0xec')]({'active':![],'countabandonedretry':_0x1c5a48[_0x778e('0xe7')],'scheduledat':moment()[_0x778e('0xd9')](_0x7139a6[_0x778e('0x1a')][_0x30daea['queue']][_0x778e('0xe8')],_0x778e('0xdb'))[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0xbde01f[_0x778e('0xdc')],'ListId':_0xbde01f['ListId'],'VoiceQueueId':_0xbde01f[_0x778e('0xde')]||undefined,'CampaignId':_0xbde01f[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0xed')));var _0x1af204=new History(_0x1c5a48);_0x1af204[_0x778e('0x6f')]=0xb;_0x1af204['statedesc']=_0x778e('0xe5');_0x1af204['starttime']=moment()[_0x778e('0x7f')](_0x778e('0xcb'));_0x1af204[_0x778e('0x71')]=_0x1af204[_0x778e('0x72')];_0x1af204[_0x778e('0xe1')]=_0x1c5a48[_0x778e('0xe1')];_0x1af204[_0x778e('0xee')]=_0x1c5a48[_0x778e('0xee')];hopperUtils[_0x778e('0xef')](_0x1af204)[_0x778e('0xa8')](loggerCatch(_0x778e('0xf0')));}})[_0x778e('0xa4')](function(){if(_0x5cffe1)hopperUtils['swapAdditionalPhones'](_0x1c5a48,_0x3b689e,_0x35fab2)[_0x778e('0xa4')](function(){return 0x1;});});}}}};Dialer[_0x778e('0x89')][_0x778e('0x35')]=function(_0x1ab4e4){if(this[_0x778e('0xf1')][_0x1ab4e4['uniqueid']]){this[_0x778e('0xf1')][_0x1ab4e4[_0x778e('0xc2')]][_0x778e('0xf2')]=_0x1ab4e4['channel'];}if(this['uniqueId'][_0x1ab4e4[_0x778e('0xc2')]]){this['uniqueId'][_0x1ab4e4[_0x778e('0xc2')]][_0x778e('0xf2')]=_0x1ab4e4[_0x778e('0xf2')];}};Dialer[_0x778e('0x89')][_0x778e('0x39')]=function(_0xf021bf){if(!this['actions'][_0xf021bf[_0x778e('0xf3')]]){return;}var _0x3f89d5=this[_0x778e('0x1a')][this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]]['queue']]['strategy']||_0x778e('0xf4');if(_0x3f89d5===_0x778e('0xf5')){if(this[_0x778e('0xf1')][_0xf021bf['actionid']]&&_[_0x778e('0xf6')](this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf7')])&&_0xf021bf[_0x778e('0x8d')]==='1'&&_0xf021bf[_0x778e('0xf8')]==='0'){if(this[_0x778e('0x1c')][_0xf021bf[_0x778e('0xf9')]]){if(!this['agents'][_0xf021bf[_0x778e('0xf9')]][_0x778e('0xf7')]){this[_0x778e('0x1c')][_0xf021bf['stateinterface']][_0x778e('0xf7')]=!![];this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf7')]=!![];this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf9')]=_0xf021bf[_0x778e('0xf9')];}}}}else if(_0x3f89d5===_0x778e('0xf4')){if(this['actions'][_0xf021bf[_0x778e('0xf3')]]){if(this[_0x778e('0x1c')][_0xf021bf[_0x778e('0xf9')]]){this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xf9')]=_0xf021bf[_0x778e('0xf9')];if(_[_0x778e('0xf6')](this[_0x778e('0x25')][this['actions'][_0xf021bf['actionid']]['queue']])){this[_0x778e('0x25')][this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xc1')]]=[];}this[_0x778e('0x25')][this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]][_0x778e('0xc1')]][_0x778e('0xfa')](_['merge'](_[_0x778e('0x76')](this[_0x778e('0xf1')][_0xf021bf[_0x778e('0xf3')]],[_0x778e('0xfb'),'stateinterface']),{'status':_0xf021bf[_0x778e('0x8d')],'paused':_0xf021bf[_0x778e('0xf8')]}));}}}};Dialer[_0x778e('0x89')][_0x778e('0x3b')]=function(_0x34c405){if(!this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]){return;}var _0x2b0f09=this;var _0x2c7fe8=this[_0x778e('0x1a')][this['actions'][_0x34c405[_0x778e('0xf3')]]['queue']];var _0x500857=_0x2c7fe8['strategy']||_0x778e('0xf4');if(_0x500857===_0x778e('0xf5')){if(this['actions'][_0x34c405[_0x778e('0xf3')]]&&this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xf9')]){this[_0x778e('0x19')][_0x778e('0xfc')](this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['idHopper'],this['actions'][_0x34c405[_0x778e('0xf3')]][_0x778e('0xf9')])['catch'](function(_0x131982){logger[_0x778e('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x778e('0x43')](_0x131982,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2b0f09[_0x778e('0xc4')](_0x2b0f09['voiceQueues'][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['queue']]);_0x2b0f09[_0x778e('0x1c')][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xf9')]]['locked']=![];delete _0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]];unlockQueueStatus(_0x2c7fe8);});}else{this[_0x778e('0xc4')](this[_0x778e('0x1a')][this['actions'][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]);hopperUtils[_0x778e('0xec')]({'active':![],'ContactId':this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xdc')],'ListId':this['actions'][_0x34c405[_0x778e('0xf3')]][_0x778e('0xdd')],'VoiceQueueId':this['actions'][_0x34c405['actionid']][_0x778e('0xde')]||undefined,'CampaignId':this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xdf')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x778e('0xf1')][_0x34c405['actionid']];unlockQueueStatus(_0x2c7fe8);}}else if(_0x500857===_0x778e('0xf4')){var _0x47ed19;if(this['actions'][_0x34c405[_0x778e('0xf3')]]&&!_[_0x778e('0x98')](this[_0x778e('0x25')][this[_0x778e('0xf1')][_0x34c405['actionid']][_0x778e('0xc1')]])){if(this[_0x778e('0x26')][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]){this['queueBookedRR'][_0x2b0f09[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['queue']]=this[_0x778e('0x26')][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]?this['queueBookedRR'][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]]:this[_0x778e('0x25')][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]]['queue']]?this[_0x778e('0x25')][this['actions'][_0x34c405['actionid']][_0x778e('0xc1')]][_0x778e('0xfd')]||0x0:0x0;}this[_0x778e('0x25')][this[_0x778e('0xf1')][_0x34c405[_0x778e('0xf3')]][_0x778e('0xc1')]][_0x778e('0xfd')]=this[_0x778e('0x26')][this['actions'][_0x34c405['actionid']][_0x778e('0xc1')]];for(var _0x55fcc5=0x0;_0x55fcc5=_0x132b3b['dialGlobalMaxRetry']){_0xa8e75d[_0x778e('0x124')](_0x22d1ff,_0x35f654,_0x17c959,_0x778e('0x125'));}else{if(_0x22d1ff[_0x778e('0x11f')]>=_0x132b3b[_0x778e('0x126')]){_0xa8e75d[_0x778e('0x127')](_0x22d1ff,_0x35f654,_0x17c959,'reason\x2019\x20machine....');}else{hopperUtils[_0x778e('0xec')]({'active':![],'countmachineretry':_0x22d1ff[_0x778e('0x11f')],'scheduledat':moment()['add'](_0x132b3b[_0x778e('0x128')],_0x778e('0xdb'))['format'](_0x778e('0xcb')),'ContactId':_0x22d1ff[_0x778e('0xdc')],'ListId':_0x22d1ff[_0x778e('0xdd')],'VoiceQueueId':_0x22d1ff[_0x778e('0xde')]||undefined,'CampaignId':_0x22d1ff[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x129')));_0x35f654({'reschedule':0x1});}}});}if(_0x3e47b4[_0x778e('0xc3')]===_0x778e('0xc6')&&this[_0x778e('0x1b')][_0x3e47b4[_0x778e('0xc1')]][_0x778e('0x112')]&&_0x1531d8[_0x778e('0x113')]===_0x778e('0x114')){delete this['uniqueId'][_0x1531d8['uniqueid']];this[_0x778e('0xc4')](this[_0x778e('0x1b')][_0x3e47b4['queue']]);_0x52bc5d=new Hangup(_0x3e47b4,_0x1531d8);_0x52bc5d[_0x778e('0x6f')]=0x12;_0x52bc5d[_0x778e('0x70')]=_0x778e('0x116');_0x52bc5d[_0x778e('0x117')]=_0x778e('0x118');ami[_0x778e('0x3f')](_0x778e('0x119'),ut[_0x778e('0x120')](_0x52bc5d,_0x778e('0x11a')));this[_0x778e('0x11b')](_0x52bc5d,_0x778e('0x12a'),_0x778e('0x12b'));}if(_0x3e47b4[_0x778e('0xc3')]===_0x778e('0xc6')&&this['campaigns'][_0x3e47b4[_0x778e('0xc1')]][_0x778e('0x112')]&&_0x1531d8[_0x778e('0x113')]===_0x778e('0x11d')){return new Promise(function(_0x42f0e4,_0x4be50f){delete _0xa8e75d[_0x778e('0x21')][_0x1531d8[_0x778e('0xc2')]];_0xa8e75d[_0x778e('0xc4')](_0xa8e75d['campaigns'][_0x3e47b4[_0x778e('0xc1')]]);_0xa8e75d[_0x778e('0x1b')][_0x3e47b4[_0x778e('0xc1')]][_0x778e('0xc7')]+=0x1;_0xa8e75d['campaigns'][_0x3e47b4['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x1755e7=_0xa8e75d[_0x778e('0x1b')][_0x3e47b4['queue']];var _0x101eac=new Hangup(_0x3e47b4,_0x1531d8);_0x101eac[_0x778e('0x6f')]=0x13;_0x101eac['statedesc']=_0x778e('0x11e');_0x101eac[_0x778e('0x117')]=_0x778e('0x118');_0x101eac[_0x778e('0x11f')]+=0x1;_0x101eac[_0x778e('0xd4')]+=0x1;_0x101eac[_0x778e('0x11a')]=!![];ami[_0x778e('0x3f')]('custom:amd',ut[_0x778e('0x120')](_0x101eac,_0x778e('0x11a')));hopperUtils['createHistory'](_0x101eac)[_0x778e('0xa8')](loggerCatch(_0x778e('0x121')));if(_0x101eac[_0x778e('0x12c')]+_0x101eac[_0x778e('0x12d')]+_0x101eac[_0x778e('0x122')]+_0x101eac[_0x778e('0x12e')]+_0x101eac[_0x778e('0xd8')]+_0x101eac[_0x778e('0xe7')]+_0x101eac[_0x778e('0x11f')]+_0x101eac[_0x778e('0x123')]>=_0x1755e7[_0x778e('0x12f')]){_0xa8e75d[_0x778e('0x124')](_0x101eac,_0x42f0e4,_0x4be50f,_0x778e('0x125'));}else{if(_0x101eac['countmachineretry']>=_0x1755e7['dialMachineMaxRetry']){_0xa8e75d[_0x778e('0x127')](_0x101eac,_0x42f0e4,_0x4be50f,_0x778e('0x130'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x101eac[_0x778e('0x11f')],'scheduledat':moment()[_0x778e('0xd9')](_0x1755e7[_0x778e('0x128')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x101eac['ContactId'],'ListId':_0x101eac['ListId'],'VoiceQueueId':_0x101eac[_0x778e('0xde')]||undefined,'CampaignId':_0x101eac[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x129')));_0x42f0e4({'reschedule':0x1});}}});}}};Dialer[_0x778e('0x89')][_0x778e('0x33')]=function(_0x4831b3){var _0x4d0149=this['uniqueId'][_0x4831b3['uniqueid']];var _0x4b09a2;if(_0x4d0149&&_0x4d0149[_0x778e('0xc3')]==='ivr'){delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this[_0x778e('0xc4')](this[_0x778e('0x1b')][_0x4d0149[_0x778e('0xc1')]]);this[_0x778e('0x1b')][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x131')]+=0x1;_0x4b09a2=new Hangup(_0x4d0149,_0x4831b3);hopperUtils[_0x778e('0xef')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x778e('0xcc')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0x132')));}if(_0x4d0149&&_0x4d0149[_0x778e('0xc3')]!==_0x778e('0xc6')&&isNotNull(this[_0x778e('0x1a')][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x133')])){delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this[_0x778e('0xc4')](this[_0x778e('0x1a')][_0x4d0149['queue']]);this[_0x778e('0x1a')][_0x4d0149['queue']][_0x778e('0xc7')]+=0x1;this[_0x778e('0x1a')][_0x4d0149['queue']][_0x778e('0x115')]+=0x1;_0x4b09a2=new Hangup(_0x4d0149,_0x4831b3);_0x4b09a2[_0x778e('0x6f')]=0x10;_0x4b09a2['statedesc']=_0x778e('0x134');_0x4b09a2[_0x778e('0x117')]=_0x778e('0x135');hopperUtils[_0x778e('0xef')](_0x4b09a2)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x778e('0xcc')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0x132')));}if(_0x4d0149&&_0x4d0149[_0x778e('0xc3')]!==_0x778e('0xc6')&&!isNotNull(this['voiceQueues'][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x133')])){if(_0x4831b3[_0x778e('0x136')]===_0x778e('0x137')){delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this['voiceQueues'][_0x4d0149['queue']][_0x778e('0xc7')]+=0x1;const _0x13c7bc=new AgentComplete(_0x4d0149,_0x4831b3);_0x13c7bc[_0x778e('0xdf')]=this[_0x778e('0x1a')][_0x4d0149[_0x778e('0xc1')]]['id'];hopperUtils[_0x778e('0xef')](_0x13c7bc)[_0x778e('0xa8')](loggerCatch(_0x778e('0x138')));hopperUtils[_0x778e('0xcc')](_0x13c7bc)[_0x778e('0xa8')](loggerCatch(_0x778e('0xcd')));}else{delete this[_0x778e('0x21')][_0x4831b3[_0x778e('0xc2')]];this['updateOriginated'](this['voiceQueues'][_0x4d0149[_0x778e('0xc1')]]);this['voiceQueues'][_0x4d0149[_0x778e('0xc1')]][_0x778e('0x139')]+=0x1;_0x4b09a2=new Hangup(_0x4d0149,_0x4831b3);_0x4b09a2[_0x778e('0x6f')]=0xc;_0x4b09a2[_0x778e('0x70')]=_0x4831b3[_0x778e('0x136')];_0x4b09a2['membername']=_0x778e('0x13a');hopperUtils[_0x778e('0xef')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch(_0x778e('0x13b')));hopperUtils[_0x778e('0xcc')](_0x4b09a2)[_0x778e('0xa8')](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0x778e('0x89')][_0x778e('0x2f')]=function(_0xf2d280){var _0xda2ff=this;if(!_0xda2ff[_0x778e('0x13c')][_0xf2d280['name']]){_0xda2ff[_0x778e('0x13c')][_0xf2d280[_0x778e('0x45')]]={'running':![]};}else if(_0xda2ff[_0x778e('0x13c')][_0xf2d280['name']][_0x778e('0x13d')]===!![]){return;}else if(_0xda2ff[_0x778e('0x13c')][_0xf2d280[_0x778e('0x45')]][_0x778e('0x13d')]===![]){_0xda2ff[_0x778e('0x13c')][_0xf2d280['name']]['running']=!![];}var _0xed070b=_0xda2ff[_0x778e('0x1a')][_0xf2d280[_0x778e('0x45')]];var _0x40631e=_0xed070b[_0x778e('0x6c')]!==utils[_0x778e('0x68')][_0x778e('0x7c')];var _0x2d711c=utils[_0x778e('0x13e')](_0xed070b);_0xed070b[_0x778e('0x13f')]=utils[_0x778e('0x140')](_0xed070b,_0xda2ff[_0x778e('0x1d')]);Promise[_0x778e('0x141')]()[_0x778e('0xa4')](function(){if(_0xed070b[_0x778e('0x13f')]===utils[_0x778e('0x68')][_0x778e('0x7c')]){if(_0x40631e){clearPredictiveAttributes(_0xed070b);_0xf2d280['startPredictive']=undefined;_0xf2d280[_0x778e('0x24')]=undefined;}if(_0xed070b[_0x778e('0x13f')]===utils[_0x778e('0x68')][_0x778e('0x7c')]){_0xf2d280[_0x778e('0x142')]=0x0;_0xf2d280[_0x778e('0xf8')]=0x0;_0xf2d280[_0x778e('0x143')]=0x0;_0xf2d280[_0x778e('0x144')]=0x0;_0xf2d280[_0x778e('0x145')]=0x0;}}else if(_0xed070b[_0x778e('0x13f')]===utils[_0x778e('0x68')]['ACTIVE']&&!_0x2d711c){return _0xda2ff[_0x778e('0x96')](_0xed070b,!![])[_0x778e('0xa4')](function(){return _0xda2ff[_0x778e('0x96')](_0xed070b,![]);})[_0x778e('0xa4')](function(){return _0xda2ff['checkDialMethod'](_0xed070b);})['catch'](function(_0x57f0c0){loggerSyncQueueSummary[_0x778e('0x41')](_0x778e('0x146'),util[_0x778e('0x43')](_0x57f0c0,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xed070b);});}else{clearPredictiveAttributes(_0xed070b);}})[_0x778e('0xa4')](function(){var _0x2b51fa=_0xf2d280[_0x778e('0x147')](_0xed070b);if(_0x2b51fa||_0xed070b['queueSummaryCountersUpdated']){_0xed070b[_0x778e('0x148')]=![];_0xf2d280['updateReportFromOutboundQueue'](_0xed070b);Object['assign'](_0xed070b,_0xf2d280);emitOutboundVoiceQueueSummary(_0xf2d280);}_0xda2ff[_0x778e('0x13c')][_0xed070b['name']]['running']=![];})[_0x778e('0xa8')](function(_0x151f74){logger[_0x778e('0x64')]('[syncQueueSummary]',util[_0x778e('0x43')](_0x151f74,{'showHidden':![],'depth':null}));_0xda2ff[_0x778e('0x13c')][_0xed070b[_0x778e('0x45')]][_0x778e('0x13d')]=![];});};Dialer[_0x778e('0x89')]['syncQueueSummaryComplete']=_[_0x778e('0x149')](function(){var _0x59da6b=_['filter'](this[_0x778e('0x1a')],function(_0x47fccb){return _0x47fccb[_0x778e('0x14a')];});var _0x3e5738=_[_0x778e('0x14b')](this[_0x778e('0x1c')],function(_0x535202){return _0x535202[_0x778e('0x14c')]&&_0x535202[_0x778e('0x8d')]===_0x778e('0x8e');});if(_0x59da6b[_0x778e('0xa0')]>0x0&&_0x3e5738[_0x778e('0xa0')]>0x0){return Promise[_0x778e('0x141')]()[_0x778e('0xa4')](cmHopper[_0x778e('0x14d')](_[_0x778e('0x14e')](_0x59da6b,'id'),previewRecallmeReminderInterval,_['map'](_0x3e5738,'id')))[_0x778e('0xa4')](function(_0x4f5079){for(var _0x1e7ee8=0x0;_0x1e7ee8<_0x4f5079[_0x778e('0xa0')];_0x1e7ee8++){var _0xc2b958=_0x4f5079[_0x1e7ee8][_0x778e('0x14f')]['name'];if(_0xc2b958)io['to'](util[_0x778e('0x7f')](_0x778e('0x150'),_0xc2b958))[_0x778e('0x3f')]('user:dialPreviewRecallReminder',{'hopper':_0x4f5079[_0x1e7ee8]});}})[_0x778e('0xa8')](function(_0x2a569e){logger[_0x778e('0x64')]('checkPreviewRecallReminder',_0x2a569e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x778e('0x89')][_0x778e('0x151')]=function(){var _0x289ea9=this;setInterval(function(){_0x289ea9['clearZombieChannels'](_0x289ea9['uniqueId'],_0x778e('0x152'));_0x289ea9[_0x778e('0x153')](_0x289ea9[_0x778e('0xf1')],_0x778e('0x154'));},0x32c8);};Dialer[_0x778e('0x89')]['clearZombieChannels']=function(_0xa3d19e,_0x5ec2e2){var _0xdf89c1=this;for(var _0x60268a in _0xa3d19e){if(typeof _0xa3d19e[_0x60268a]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x778e('0xf6')](_0xa3d19e[_0x60268a])){return ami[_0x778e('0xa9')]({'action':_0x778e('0x8d'),'channel':_0xa3d19e[_0x60268a]['channel']})[_0x778e('0xa8')](function(_0x569530){if(_0x569530[_0x778e('0x6c')]===_0x778e('0x155')){setTimeout(function(){if(_0xa3d19e[_0x60268a]&&_0xa3d19e[_0x60268a][_0x778e('0xc3')]!=='ivr'){_0xdf89c1['updateOriginated'](_0xdf89c1[_0x778e('0x1a')][_0xa3d19e[_0x60268a]['queue']]);logger['error'](_0x778e('0x156'),_0x5ec2e2,_0x60268a,_0xa3d19e[_0x60268a][_0x778e('0xc1')]);delete _0xa3d19e[_0x60268a];}if(_0xa3d19e[_0x60268a]&&_0xa3d19e[_0x60268a][_0x778e('0xc3')]===_0x778e('0xc6')){_0xdf89c1['updateOriginated'](_0xdf89c1[_0x778e('0x1b')][_0xa3d19e[_0x60268a][_0x778e('0xc1')]]);logger[_0x778e('0x64')](_0x778e('0x157'),_0x5ec2e2,_0x60268a,_0xa3d19e[_0x60268a]['queue']);delete _0xa3d19e[_0x60268a];}},0x2328);}});}});}}};Dialer[_0x778e('0x89')][_0x778e('0x158')]=function(_0xfdb7e1){return Promise[_0x778e('0x141')]()['then'](voiceQueueRt[_0x778e('0x158')](_0xfdb7e1))[_0x778e('0xa8')](loggerCatch(_0x778e('0x159')));};Dialer['prototype']['updateOriginated']=function(_0x4a279c){if(!_['isUndefined'](_0x4a279c)&&_0x4a279c!==null){if(typeof _0x4a279c[_0x778e('0x82')]!==_0x778e('0x15a')){if(_0x4a279c['originated']>0x0){_0x4a279c['originated']-=0x1;}else{logger[_0x778e('0x64')](_0x778e('0x15b'));}}}else{logger['error'](_0x778e('0x15c'));}};Dialer[_0x778e('0x89')]['loggerHandler']=function(_0x46fe2a,_0x1c8b0a){var _0x7048b7=this;return function(_0x2494e7){_0x7048b7['updateOriginated'](_0x1c8b0a);logger[_0x778e('0x64')](_0x46fe2a,util[_0x778e('0x43')](_0x2494e7,{'showHidden':![],'depth':null}));};};Dialer[_0x778e('0x89')]['emptyContact']=function(_0x57c0fb,_0x35b8b7,_0x3885a8){var _0x588a0d={'state':0x19,'statedesc':_0x778e('0x15d')};this[_0x778e('0xc4')](_0x35b8b7);this[_0x778e('0x11b')](_[_0x778e('0x15e')](_0x588a0d,_[_0x778e('0x76')](_0x3885a8,['ContactId','ListId',_0x778e('0x15f'),_0x778e('0xde'),_0x778e('0xdf')])),_0x778e('0x160'),_0x778e('0x161'));logger[_0x778e('0x64')](_0x57c0fb);};Dialer[_0x778e('0x89')][_0x778e('0x11b')]=function(_0x45b929,_0x499e70,_0x1bd1cf){hopperUtils[_0x778e('0xef')](_0x45b929)['catch'](loggerCatch(_0x499e70));hopperUtils['moveContactManagedDialer'](_0x45b929)[_0x778e('0xa8')](loggerCatch(_0x1bd1cf));};Dialer[_0x778e('0x89')][_0x778e('0xd7')]=function(_0x13d130,_0xfc25e1){hopperUtils['createHistory'](_0x13d130)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0xfc25e1==0x0){hopperUtils[_0x778e('0xcc')](_0x13d130)[_0x778e('0xa8')](loggerCatch(_0x778e('0x162')));}};Dialer[_0x778e('0x89')]['checkPreviewRecallReminder']=function(_0x485092){return Promise[_0x778e('0x141')]()['then'](cmHopper[_0x778e('0x14d')](_0x485092['id'],previewRecallmeReminderInterval))[_0x778e('0xa4')](function(_0x4b8047){for(var _0x405034=0x0;_0x405034<_0x4b8047['length'];_0x405034++){var _0x2842ef=_0x4b8047[_0x405034]['Agent'][_0x778e('0x45')];if(_0x2842ef)io['to'](util['format'](_0x778e('0x150'),_0x2842ef))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x4b8047[_0x405034]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x424558){var _0x54705e=this;return function(){_0x54705e[_0x778e('0x163')](_0x424558);};};Dialer[_0x778e('0x89')][_0x778e('0x164')]=function(_0x36830a,_0x38763b){var _0x5941c4=this;var _0x41e2a2=uuid['v4']();this[_0x778e('0xf1')][_0x41e2a2]=new Action(_0x36830a,_0x38763b,_0x41e2a2);return new Promise(function(_0x4801ef,_0x487f26){if(_[_0x778e('0x54')](_0x36830a)&&typeof _0x36830a!==_0x778e('0x165')){return _0x487f26(msgResponse(_0x778e('0x166'),_0x778e('0x9a'),_0x778e('0x167')));}if(_[_0x778e('0x54')](_0x38763b[_0x778e('0x168')])||_0x38763b['phone']===null){return _0x487f26(msgResponse(_0x778e('0x166'),_0x778e('0x9a'),_0x778e('0x169')));}var _0x1a27e8={'XMD-CALLERID':_0x5941c4[_0x778e('0xf1')][_0x41e2a2]['getCaller'](),'XMD-AGI':_0x36830a['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x36830a[_0x778e('0x133')]):_0x778e('0x16a'),'XMD-AGIAFTER':_0x36830a['dialQueueProject2']?util[_0x778e('0x7f')](_0x778e('0x16b'),ipAgi,_0x36830a[_0x778e('0xc9')]):_0x778e('0x16a'),'XMD-QUEUE':utils[_0x778e('0x16c')](_0x36830a)?util['format'](_0x778e('0x16d'),_0x36830a[_0x778e('0x45')],_0x36830a[_0x778e('0x16e')]||'',_0x36830a[_0x778e('0xca')]?'c':'',_0x36830a[_0x778e('0xd0')]||0x3):'NONE','XMD-CONTACTID':_0x38763b['ContactId'],'XMD-CDRTYPE':_0x778e('0x7'),'CALLERID(all)':_0x5941c4[_0x778e('0xf1')][_0x41e2a2][_0x778e('0x16f')](),'XMD-AMD':_0x36830a[_0x778e('0x112')]?'ACTIVE':_0x778e('0x16a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x36830a[_0x778e('0x112')]){_0x1a27e8[_0x778e('0x170')]=_0x36830a['dialAMDInitialSilence']||0x9c4;_0x1a27e8['XMD-AMDGREETING']=_0x36830a[_0x778e('0x171')]||0x5dc;_0x1a27e8[_0x778e('0x172')]=_0x36830a[_0x778e('0x173')]||0x320;_0x1a27e8[_0x778e('0x174')]=_0x36830a[_0x778e('0x175')]||0x1388;_0x1a27e8['XMD-AMDMINWORDLENGTH']=_0x36830a[_0x778e('0x176')]||0x64;_0x1a27e8[_0x778e('0x177')]=_0x36830a[_0x778e('0x178')]||0x32;_0x1a27e8[_0x778e('0x179')]=_0x36830a['dialAMDMaximumNumberOfWords']||0x3;_0x1a27e8['XMD-AMDSILENCETHRESHOLD']=_0x36830a['dialAMDSilenceThreshold']||0x100;_0x1a27e8[_0x778e('0x17a')]=_0x36830a['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x778e('0x16c')](_0x36830a)){_0x1a27e8[_0x778e('0x17b')]=_0x38763b[_0x778e('0xde')];}else{_0x1a27e8[_0x778e('0x17c')]=_0x38763b[_0x778e('0xdf')];}var _0xebf88f=utils[_0x778e('0x17d')](_0x38763b[_0x778e('0x17e')]);Object[_0x778e('0x17f')](_0x1a27e8,_0xebf88f);var _0x7574ce=_0x5941c4[_0x778e('0x8a')](_0x36830a['Trunk'])?utils[_0x778e('0x180')](_0x36830a['Trunk'][_0x778e('0x181')],_0x36830a[_0x778e('0x182')],_0x36830a[_0x778e('0x183')]>0x0?utils['getCallerIdRandom'](_0x36830a[_0x778e('0x184')],_0x36830a[_0x778e('0x183')]):_0x36830a[_0x778e('0x184')]):utils[_0x778e('0x180')](_[_0x778e('0xf6')](_0x36830a[_0x778e('0x185')])?_0x36830a[_0x778e('0x186')]['callerid']:_0x36830a[_0x778e('0x185')][_0x778e('0x181')],_0x36830a['dialOriginateCallerIdName'],_0x36830a[_0x778e('0x183')]>0x0?utils[_0x778e('0x187')](_0x36830a['dialOriginateCallerIdNumber'],_0x36830a[_0x778e('0x183')]):_0x36830a[_0x778e('0x184')]);if(_0x7574ce){_0x1a27e8[_0x778e('0x188')]=_0x5941c4[_0x778e('0xf1')][_0x41e2a2]['originatecalleridname']=utils[_0x778e('0x189')](_0x7574ce);_0x1a27e8[_0x778e('0x18a')]=_0x38763b[_0x778e('0x168')];}_0x36830a[_0x778e('0x18b')]=_0x1a27e8;return ami[_0x778e('0xa9')]({'actionid':_0x41e2a2,'action':_0x778e('0x166'),'channel':_0x5941c4[_0x778e('0x8a')](_0x36830a[_0x778e('0x186')])?util['format']('SIP/%s/%s%s',_0x36830a[_0x778e('0x186')]['name'],isNotNull(_0x36830a[_0x778e('0x18c')])?_0x36830a[_0x778e('0x18c')][_0x778e('0x18d')]()||'':'',_0x36830a[_0x778e('0x18e')]>0x0?_0x38763b[_0x778e('0x168')][_0x778e('0x18f')](_0x36830a['dialCutDigit']):_0x38763b[_0x778e('0x168')]):util[_0x778e('0x7f')](_0x778e('0x190'),_['isNil'](_0x36830a['TrunkBackup'])?_0x36830a['Trunk'][_0x778e('0x45')]:_0x36830a['TrunkBackup']['name'],isNotNull(_0x36830a[_0x778e('0x18c')])?_0x36830a[_0x778e('0x18c')][_0x778e('0x18d')]()||'':'',_0x36830a['dialCutDigit']>0x0?_0x38763b[_0x778e('0x168')][_0x778e('0x18f')](_0x36830a[_0x778e('0x18e')]):_0x38763b[_0x778e('0x168')]),'callerid':_0x7574ce,'Exten':_0x778e('0x111'),'Context':_0x778e('0x191'),'Priority':'1','variable':_0x1a27e8,'timeout':(_0x36830a[_0x778e('0x192')]||0x1e)*0x3e8,'async':!![],'channelid':_0x41e2a2})['then'](function(_0x239ad1){return _0x4801ef(_0x239ad1);})[_0x778e('0xa8')](function(_0x26dfb3){_0x36830a[_0x778e('0x193')]+=0x1;var _0x20bdaf=new History(_0x5941c4[_0x778e('0xf1')][_0x41e2a2]);logger['error'](util[_0x778e('0x7f')](_0x778e('0x194'),JSON[_0x778e('0x75')](_0x26dfb3)));_0x20bdaf[_0x778e('0x6f')]=0xe;_0x20bdaf['statedesc']=_0x778e('0x195');_0x20bdaf['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20bdaf[_0x778e('0x71')]=_0x20bdaf[_0x778e('0x72')];hopperUtils[_0x778e('0xef')](_0x20bdaf)[_0x778e('0xa8')](loggerCatch(_0x778e('0x196')));_0x5941c4[_0x778e('0xcc')](_0x20bdaf)['catch'](loggerCatch(_0x778e('0x196')))['finally'](function(){delete _0x5941c4['actions'][_0x41e2a2];return _0x487f26(msgResponse('originate',_0x778e('0x88'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x778e('0x197')]=function(_0x2d3b3c,_0x389a67,_0x3d7240){var _0x42a00d=new History(_0x389a67);if(_0x42a00d[_0x778e('0x12c')]+_0x42a00d[_0x778e('0x12d')]+_0x42a00d[_0x778e('0x122')]+_0x42a00d[_0x778e('0x12e')]+_0x42a00d['countdropretry']+_0x42a00d[_0x778e('0xe7')]+_0x42a00d['countmachineretry']+_0x42a00d[_0x778e('0x123')]>=_0x3d7240[_0x778e('0x12f')]-0x1){return!![];}switch(_0x2d3b3c){case 0x3:if(_0x42a00d[_0x778e('0x122')]>=_0x3d7240[_0x778e('0x198')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countnoanswerretry':_0x42a00d[_0x778e('0x122')]+=0x1,'scheduledat':moment()['add'](_0x3d7240[_0x778e('0x199')],_0x778e('0xdb'))[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x42a00d[_0x778e('0x12c')]>=_0x3d7240['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x42a00d[_0x778e('0x12c')]+=0x1,'scheduledat':moment()['add'](_0x3d7240[_0x778e('0x19a')],_0x778e('0xdb'))[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d[_0x778e('0xdd')],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x19b')));break;case 0x8:if(_0x42a00d[_0x778e('0x12d')]>=_0x3d7240[_0x778e('0x19c')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countcongestionretry':_0x42a00d[_0x778e('0x12d')]+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240[_0x778e('0x19d')],'minutes')[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d[_0x778e('0xdd')],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x19e')));break;case 0x0:if(_0x42a00d[_0x778e('0x12e')]>=_0x3d7240['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x778e('0xec')]({'active':![],'countnosuchnumberretry':_0x42a00d[_0x778e('0x12e')]+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240[_0x778e('0x19f')],_0x778e('0xdb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d[_0x778e('0xdd')],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x42a00d['countdropretry']>=_0x3d7240[_0x778e('0x1a0')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countdropretry':_0x42a00d['countdropretry']+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240['dialDropRetryFrequency'],_0x778e('0xdb'))[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0x42a00d['ContactId'],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d['CampaignId']||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0xe0')));break;case 0xb:if(_0x42a00d['countabandonedretry']>=_0x3d7240[_0x778e('0xeb')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countabandonedretry':_0x42a00d['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x3d7240['dialAbandonedRetryFrequency'],_0x778e('0xdb'))['format'](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x42a00d[_0x778e('0x11f')]>=_0x3d7240[_0x778e('0x126')]-0x1){return!![];}hopperUtils[_0x778e('0xec')]({'active':![],'countmachineretry':_0x42a00d[_0x778e('0x11f')]+=0x1,'scheduledat':moment()['add'](_0x3d7240[_0x778e('0x128')],_0x778e('0xdb'))[_0x778e('0x7f')](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x129')));break;case 0x14:if(_0x42a00d['countagentrejectretry']>=_0x3d7240[_0x778e('0x1a1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x42a00d[_0x778e('0x123')]+=0x1,'scheduledat':moment()[_0x778e('0xd9')](_0x3d7240['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x778e('0xcb')),'ContactId':_0x42a00d[_0x778e('0xdc')],'ListId':_0x42a00d['ListId'],'VoiceQueueId':_0x42a00d[_0x778e('0xde')]||undefined,'CampaignId':_0x42a00d[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1a2')));break;default:return!![];}};Dialer[_0x778e('0x89')][_0x778e('0x10c')]=function(_0x3897ba,_0x170cb7,_0x2f7e00){var _0x58e3af=this;var _0x46626e=new History(_0x3897ba);var _0x578bb5=![];var _0x3d33d6;var _0x1f1860;return new Promise(function(_0x54fa0e,_0x1adede){if(_[_0x778e('0x54')](_0x170cb7)&&typeof _0x170cb7!=='object'){return _0x1adede(msgResponse('[callProgressDetecting]',_0x778e('0x9a'),_0x778e('0x1a3')));}if(_['isUndefined'](_0x2f7e00)&&typeof _0x2f7e00!=='object'){return _0x1adede(msgResponse(_0x778e('0x1a4'),'Failure',_0x778e('0x1a5')));}hopperUtils[_0x778e('0xe9')](_0x46626e,_0x2f7e00[_0x778e('0x1a6')],_0x170cb7)[_0x778e('0xa4')](function(_0x3a3aee){if(_0x3a3aee[_0x778e('0xd6')]==0x1)_0x578bb5=!![];switch(_0x2f7e00[_0x778e('0x1a6')]){case'0':_0x170cb7[_0x778e('0x1a7')]+=0x1;_0x46626e[_0x778e('0x6f')]=0x0;_0x46626e['statedesc']=_0x778e('0x1a8');_0x46626e[_0x778e('0x12e')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;ami[_0x778e('0x3f')](_0x778e('0x1a9'),ut[_0x778e('0x120')](_0x3897ba,_0x778e('0x1aa')));_0x3d33d6=_0x170cb7['dialNoSuchNumberRetryFrequency'];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch(_0x778e('0x121')));if(_0x58e3af['checkRetriveMax'](0x0,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e['countnosuchnumberretry']>=_0x170cb7['dialNoSuchNumberMaxRetry']){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1ab'));}else{_0x58e3af['stateGlobal'](_0x46626e,_0x54fa0e,_0x1adede,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x170cb7['outboundNoAnswerCallsDay']+=0x1;_0x46626e[_0x778e('0x6f')]=0x3;_0x46626e[_0x778e('0x70')]=_0x778e('0x1ac');_0x46626e[_0x778e('0x122')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;var _0x2373dc=ut[_0x778e('0x1ad')](_0x3897ba,_0x170cb7);ami['emit']('custom:agentnoanswer',_0x2373dc);_0x3d33d6=_0x170cb7[_0x778e('0x199')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch(_0x778e('0x1ae')));if(_0x58e3af['checkRetriveMax'](0x3,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x122')]>=_0x170cb7[_0x778e('0x198')]){_0x58e3af['createStateFinal'](_0x46626e,_0x54fa0e,_0x1adede,'reason\x203\x20ringing\x20no\x20answer');}else{_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1af'));}}break;case'5':_0x170cb7[_0x778e('0x1b0')]+=0x1;_0x46626e['state']=0x5;_0x46626e['statedesc']=_0x778e('0x1b1');_0x46626e[_0x778e('0x12c')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;ami[_0x778e('0x3f')](_0x778e('0x1b2'),ut[_0x778e('0x120')](_0x3897ba,_0x778e('0x1b3')));_0x3d33d6=_0x170cb7[_0x778e('0x19a')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)['catch'](loggerCatch(_0x778e('0x1b4')));if(_0x58e3af[_0x778e('0x197')](0x5,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x12c')]>=_0x170cb7[_0x778e('0x1b5')]){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1b6'));}else{_0x58e3af['stateGlobal'](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1b6'));}}break;case'8':_0x170cb7[_0x778e('0x1b7')]+=0x1;_0x46626e[_0x778e('0x6f')]=0x8;_0x46626e['statedesc']='Congestion';_0x46626e[_0x778e('0x12d')]+=0x1;_0x46626e['countglobal']+=0x1;_0x3d33d6=_0x170cb7[_0x778e('0x19d')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];ami[_0x778e('0x3f')](_0x778e('0x1b8'),ut[_0x778e('0x120')](_0x3897ba,_0x778e('0x1b9')));hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x58e3af[_0x778e('0x197')](0x8,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x12d')]>=_0x170cb7['dialCongestionMaxRetry']){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1ba'));}else{_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1ba'));}}break;case'11':_0x170cb7['outboundAbandonedCallsDay']+=0x1;_0x46626e[_0x778e('0x6f')]=0xb;_0x46626e['statedesc']=_0x778e('0xe5');_0x46626e['countabandonedretry']+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;_0x3d33d6=_0x170cb7[_0x778e('0xe8')];_0x1f1860=_0x170cb7['callAdditionalPhoneAfterMin'];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch(_0x778e('0xf0')));if(_0x58e3af[_0x778e('0x197')](0xb,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0xe7')]>=_0x170cb7[_0x778e('0xeb')]){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1bb'));}else{_0x58e3af['stateGlobal'](_0x46626e,_0x54fa0e,_0x1adede,'reason\x2011\x20abandoned');}}break;case'20':_0x170cb7[_0x778e('0x1bc')]+=0x1;_0x46626e[_0x778e('0x6f')]=0x14;_0x46626e['statedesc']=_0x778e('0x1bd');_0x46626e[_0x778e('0x123')]+=0x1;_0x46626e[_0x778e('0xd4')]+=0x1;_0x3d33d6=_0x170cb7[_0x778e('0x1be')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];ami[_0x778e('0x3f')](_0x778e('0x1bf'),ut['buildObj'](_0x3897ba,_0x778e('0x1c0')));hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x58e3af[_0x778e('0x197')](0x14,_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e['countagentrejectretry']>=_0x170cb7[_0x778e('0x1a1')]){_0x58e3af[_0x778e('0x127')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1c1'));}else{_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x778e('0x1c1'));}}break;default:_0x170cb7[_0x778e('0x139')]+=0x1;_0x46626e[_0x778e('0x6f')]=0xc;_0x46626e[_0x778e('0x70')]=_0x2f7e00[_0x778e('0x1a6')];_0x3d33d6=_0x170cb7[_0x778e('0x1be')];_0x1f1860=_0x170cb7[_0x778e('0xd5')];hopperUtils[_0x778e('0xef')](_0x46626e)[_0x778e('0xa8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x58e3af['checkRetriveMax'](_0x2f7e00[_0x778e('0x1a6')],_0x3897ba,_0x170cb7)&&!_0x578bb5){if(_0x46626e[_0x778e('0x12c')]+_0x46626e['countcongestionretry']+_0x46626e[_0x778e('0x122')]+_0x46626e[_0x778e('0x12e')]+_0x46626e[_0x778e('0xd8')]+_0x46626e['countabandonedretry']+_0x46626e[_0x778e('0x11f')]+_0x46626e[_0x778e('0x123')]>=_0x170cb7[_0x778e('0x12f')]){_0x58e3af[_0x778e('0x124')](_0x46626e,_0x54fa0e,_0x1adede,_0x2f7e00[_0x778e('0x1a6')]);}else{_0x58e3af['createStateFinal'](_0x46626e,_0x54fa0e,_0x1adede,_0x2f7e00[_0x778e('0x1a6')]);}}}})['then'](function(){if(_0x578bb5){hopperUtils[_0x778e('0xe3')](_0x46626e,_0x3d33d6,_0x1f1860)[_0x778e('0xa4')](function(){return _0x54fa0e(0x1);});}});});};Dialer[_0x778e('0x89')][_0x778e('0x124')]=function(_0xb2268c,_0x14169b,_0x2701db,_0x1a1cf3){var _0x37097d=new Final(_0xb2268c);_0x37097d[_0x778e('0x6f')]=0xf;_0x37097d['statedesc']=_0x778e('0x1c2');this[_0x778e('0x127')](_0x37097d,_0x14169b,_0x2701db,_0x1a1cf3);};Dialer[_0x778e('0x89')][_0x778e('0x127')]=function(_0x889dcb,_0x32b173,_0x5be05c,_0x5e7a3e){hopperUtils['moveContactManagedDialer'](_0x889dcb)[_0x778e('0xa4')](function(){return _0x32b173(msgResponse('[callProgressDetecting]',_0x778e('0x10b'),_0x5e7a3e));})['catch'](function(){return _0x5be05c(msgResponse('[moveContactManagedDialer][0]',_0x778e('0x9a'),_0x778e('0x1c3')));});};Dialer['prototype'][_0x778e('0x8')]=function(_0x53dec7){var _0x139f75=_0x53dec7[_0x778e('0x1c4')]/0x64;var _0x17f8f2=_0x53dec7[_0x778e('0x1c5')]/(_0x53dec7[_0x778e('0x1c5')]+_0x53dec7[_0x778e('0xc7')]);var _0x551167=Math['round'](_0x53dec7[_0x778e('0x1c6')]*(_0x53dec7['predictiveIntervalMaxThreshold']/0x64));var _0x4d9450=Math[_0x778e('0x1c7')](_0x53dec7[_0x778e('0x1c6')]*(_0x53dec7[_0x778e('0x1c8')]/0x64));var _0x4e3882=_0x53dec7[_0x778e('0x142')]+_0x53dec7['talking'];var _0x25c9ec=Math['floor'](_0x53dec7[_0x778e('0x5b')]*_0x53dec7[_0x778e('0x5e')]*_0x53dec7['predictiveIntervalHitRate']*_0x53dec7[_0x778e('0x1c9')]);if(_[_0x778e('0x54')](_0x53dec7[_0x778e('0x24')])){if(!_['isUndefined'](_0x53dec7[_0x778e('0x23')])){_0x53dec7[_0x778e('0x23')]=undefined;loggerPredictive[_0x778e('0x64')](_0x778e('0x1ca'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x53dec7[_0x778e('0x62')])){loggerPredictive['error'](_0x778e('0x1ca'),_0x778e('0x1cb'));clearInterval(_0x53dec7[_0x778e('0x62')]);_0x53dec7[_0x778e('0x62')]=undefined;}_0x53dec7[_0x778e('0x24')]=moment()[_0x778e('0x7f')](_0x778e('0xcb'));loggerPredictive[_0x778e('0x48')](_0x53dec7['name'],_0x778e('0x1cc'),_0x53dec7[_0x778e('0x24')]);this[_0x778e('0xb7')](_0x53dec7,0x1);}else if(ifInterval(_0x53dec7[_0x778e('0x1cd')],_0x53dec7[_0x778e('0x24')])){this[_0x778e('0xb7')](_0x53dec7,0x1);loggerPredictiveCalls[_0x778e('0x48')](_0x778e('0x1ce'),_0x53dec7[_0x778e('0x24')],_0x53dec7[_0x778e('0x45')]);_0x53dec7[_0x778e('0x5b')]=0x0;_0x53dec7[_0x778e('0xd1')]=0x0;}else if(_0x139f75<_0x17f8f2&&_0x53dec7['dialPredictiveOptimization']===_0x778e('0x1cf')){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x778e('0x1d0'),_0x17f8f2,_0x778e('0x24'),_0x53dec7[_0x778e('0x45')]);}else if(_0x25c9ec<_0x53dec7[_0x778e('0xd1')]&&_0x53dec7[_0x778e('0x1d1')]===_0x778e('0x1cf')){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')](_0x778e('0x1d2'),_0x778e('0x1d3'),_0x25c9ec,_0x778e('0x1d4'),_0x53dec7[_0x778e('0xd1')],_0x778e('0x24'),_0x53dec7[_0x778e('0x45')]);}else if(!ifInterval(_0x53dec7['dialPredictiveInterval'],_0x53dec7[_0x778e('0x24')])&&_[_0x778e('0x54')](_0x53dec7[_0x778e('0x23')])&&!_[_0x778e('0x54')](_0x53dec7[_0x778e('0x24')])){_0x53dec7[_0x778e('0x23')]=moment()[_0x778e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x53dec7[_0x778e('0x45')],'started\x20in\x20predictive\x20at',_0x53dec7[_0x778e('0x23')]);hopperUtils[_0x778e('0x1d5')](_0x53dec7['dialPredictiveInterval'])[_0x778e('0xa4')](this['getDataPredictive'](_0x53dec7))[_0x778e('0xa4')](mergeDataErlangB(_0x53dec7))[_0x778e('0xa4')](this['startMethodPredictive'](_0x53dec7))['catch'](loggerCatchPredictive(_0x778e('0x1d6'),_0x53dec7));}else if(!ifInterval(_0x53dec7[_0x778e('0x1cd')],_0x53dec7[_0x778e('0x23')])){_0x53dec7[_0x778e('0xd1')]=0x0;_0x53dec7[_0x778e('0x23')]=moment()[_0x778e('0x7f')](_0x778e('0xcb'));loggerPredictive['info'](_0x53dec7[_0x778e('0x45')],_0x778e('0x1d7'),_0x53dec7[_0x778e('0x23')]);clearInterval(_0x53dec7['handlePredictive']);_0x53dec7[_0x778e('0x62')]=undefined;hopperUtils[_0x778e('0x1d5')](_0x53dec7[_0x778e('0x1cd')])[_0x778e('0xa4')](this[_0x778e('0x1d8')](_0x53dec7))['then'](mergeDataErlangB(_0x53dec7))[_0x778e('0xa4')](this['startMethodPredictive'](_0x53dec7))['catch'](loggerCatchPredictive(_0x778e('0x1d9'),_0x53dec7));}else if(_0x53dec7[_0x778e('0x1c6')]&&_0x4e3882<_0x53dec7[_0x778e('0x1c6')]-_0x4d9450){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')](_0x53dec7[_0x778e('0x45')],_0x778e('0x1da'),_0x4e3882,_0x778e('0x1db'),_0x53dec7['predictiveIntervalAvailable'],'-',_0x4d9450,'=',_0x53dec7['predictiveIntervalAvailable']-_0x4d9450,')');}else if(_0x53dec7['predictiveIntervalAvailable']&&_0x4e3882>_0x53dec7[_0x778e('0x1c6')]+_0x551167){clearPredictiveAttributes(_0x53dec7);loggerPredictive[_0x778e('0x48')](_0x53dec7[_0x778e('0x45')],_0x778e('0x1da'),_0x4e3882,')\x20are\x20more\x20than\x20threshold\x20(',_0x53dec7[_0x778e('0x1c6')],'+',_0x551167,'=',_0x53dec7['predictiveIntervalAvailable']+_0x551167,')');}};Dialer[_0x778e('0x89')][_0x778e('0x1d8')]=function(_0x3e2f17){var _0x2afa50=this;return function(_0x32b023){return new Promise(function(_0x488514,_0x284236){_[_0x778e('0x15e')](_0x3e2f17,_0x32b023[0x0]);if(checkGetDataPredictive(_0x32b023[0x0])){var _0x18b5ba=_0x3e2f17[_0x778e('0x1c6')]=_0x3e2f17[_0x778e('0x144')]+_0x3e2f17['available'];var _0x4f531b=_0x3e2f17['dialPredictiveInterval']*0x3c;var _0xc2b7f4=_0x32b023[0x0][_0x778e('0x55')]+_0x32b023[0x0][_0x778e('0x52')];var _0x4b6920=(_0x32b023[0x0][_0x778e('0x4c')]+_0x32b023[0x0][_0x778e('0x4e')]+_0x32b023[0x0][_0x778e('0x50')])/_0x32b023[0x0][_0x778e('0x4a')];_0x3e2f17[_0x778e('0x1dc')]=_0x4b6920>0x0?_0x4b6920:0x1;switch(_0x3e2f17['dialPredictiveOptimization']){case'dropRate':var _0x33e95e=_0x3e2f17[_0x778e('0x1c4')]/0x64;return _0x2afa50[_0x778e('0x1dd')](_0x18b5ba,_0x4f531b,_0xc2b7f4,_0x4b6920,_0x33e95e)[_0x778e('0xa4')](function(_0x52de44){return _0x488514(_0x52de44);});case _0x778e('0x1de'):var _0x53dfdd=_0x3e2f17[_0x778e('0x1c4')]/0x64;return _0x2afa50[_0x778e('0x1df')](_0x18b5ba,_0x4f531b,_0xc2b7f4,_0x4b6920,_0x53dfdd)[_0x778e('0xa4')](function(_0x4e5769){return _0x488514(_0x4e5769);});default:return _0x284236(msgResponse(_0x778e('0x1e0'),_0x778e('0x9a'),'Unknown\x20Predictive'));}}else{return _0x284236(msgResponse(_0x778e('0x1e0'),'Failure',_0x778e('0x1e1')));}});};};Dialer[_0x778e('0x89')]['getDataPredictiveOld']=function(_0x42f100){var _0x1c411e=this;return function(_0x7e4105){return new Promise(function(_0x3c42bb,_0x3db313){_[_0x778e('0x15e')](_0x42f100,_0x7e4105[0x0]);if(checkGetDataPredictive(_0x7e4105[0x0])){loggerPredictive[_0x778e('0x48')](JSON[_0x778e('0x75')](_0x7e4105[0x0]));if(_0x42f100[_0x778e('0x1d1')]===_0x778e('0x1cf')){return _0x1c411e[_0x778e('0x158')](_0x42f100['id'])[_0x778e('0xa4')](function(_0x5d4f13){var _0x26a384=_0x42f100[_0x778e('0x1e2')]-_0x5d4f13[0x0]['outboundQueuePauses'];var _0x102556=_0x42f100[_0x778e('0x1cd')]*0x3c;var _0x14ab99=_0x7e4105[0x0][_0x778e('0x55')]+_0x7e4105[0x0]['predictiveIntervalAvgHoldtime'];var _0xb0f51d=(_0x7e4105[0x0]['predictiveIntervalAnsweredCalls']+_0x7e4105[0x0][_0x778e('0x4e')]+_0x7e4105[0x0][_0x778e('0x50')])/_0x7e4105[0x0][_0x778e('0x4a')];var _0x50febd=_0x42f100['dialPredictiveOptimizationPercentage']/0x64;_0x42f100[_0x778e('0x1e3')]=_0x5d4f13[0x0]['outboundQueuePauses']||0x0;_0x42f100[_0x778e('0x1dc')]=_0xb0f51d>0x0?_0xb0f51d:0x1;return _0x1c411e[_0x778e('0x1dd')](_0x26a384,_0x102556,_0x14ab99,_0xb0f51d,_0x50febd);})['then'](function(_0x11fd5c){return _0x3c42bb(_0x11fd5c);})[_0x778e('0xa8')](function(_0x1dabd4){return _0x3db313(msgResponse('[CatchErlangB]',_0x778e('0x9a'),JSON[_0x778e('0x75')](_0x1dabd4)));});}if(_0x42f100[_0x778e('0x1d1')]===_0x778e('0x1de')){return _0x1c411e['getVoiceQueueRtPauses'](_0x42f100['id'])['then'](function(_0x4f3514){var _0x402824=_0x42f100['loggedIn']-_0x4f3514[0x0]['outboundQueuePauses'];var _0x23b39f=_0x42f100[_0x778e('0x1cd')]*0x3c;var _0x72667c=_0x7e4105[0x0]['predictiveIntervalAvgTalktime']+_0x7e4105[0x0][_0x778e('0x52')];var _0x124cd2=(_0x7e4105[0x0]['predictiveIntervalAnsweredCalls']+_0x7e4105[0x0][_0x778e('0x4e')]+_0x7e4105[0x0][_0x778e('0x50')])/_0x7e4105[0x0][_0x778e('0x4a')];var _0x453e9f=_0x42f100['dialPredictiveOptimizationPercentage']/0x64;_0x42f100[_0x778e('0x1e3')]=_0x4f3514[0x0][_0x778e('0x1e4')]||0x0;_0x42f100[_0x778e('0x1dc')]=_0x124cd2>0x0?_0x124cd2:0x1;return _0x1c411e['busyFactor'](_0x402824,_0x23b39f,_0x72667c,_0x124cd2,_0x453e9f);})[_0x778e('0xa4')](function(_0x1174b4){return _0x3c42bb(_0x1174b4);})[_0x778e('0xa8')](function(_0x860cff){return _0x3db313(msgResponse('[CatchErlangB]',_0x778e('0x9a'),JSON['stringify'](_0x860cff)));});}}else{return _0x3db313(msgResponse(_0x778e('0x1e0'),'Failure','check\x20failure'));}});};};Dialer[_0x778e('0x89')][_0x778e('0x1e5')]=function(_0x3e116b){var _0xcb02a0=this;return function(){var _0x24cf67=0x0;var _0x283c6c=Math['floor'](_0x3e116b[_0x778e('0x1e6')]*0x3e8);if(_0x283c6c>0x0){_0x283c6c=_0x283c6c<0x64?0x64:_0x283c6c;loggerPredictive[_0x778e('0x48')](_0x3e116b[_0x778e('0x45')],_0x778e('0x1e7'),_0x283c6c,_0x778e('0x1e8'));_0x3e116b[_0x778e('0x62')]=setInterval(function(){_0xcb02a0[_0x778e('0x62')](_0x3e116b);loggerPredictiveCalls[_0x778e('0x48')]('[handlePredictive]',_0x24cf67+=0x1);},_0x283c6c);}else{loggerPredictive[_0x778e('0x48')](_0x3e116b[_0x778e('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x778e('0x89')]['checkContactBlack']=function(_0x5f4033,_0x4650f7){var _0x5d8eb9=this;return function(_0x19a21f){if(_[_0x778e('0x98')](_0x19a21f)){if(_[_0x778e('0xf6')](_0x4650f7[_0x778e('0x15f')])||!_0x4650f7[_0x778e('0x1e9')]){if(_0x5f4033[_0x778e('0xb5')]===_0x778e('0x1ea')){_0x5f4033[_0x778e('0x73')]=_[_0x778e('0x54')](_0x5f4033['queueStatusComplete'])?!![]:_0x5f4033[_0x778e('0x73')];var _0x370416=uuid['v4']();_0x5d8eb9[_0x778e('0xf1')][_0x370416]=new Action(_0x5f4033,_0x4650f7,_0x370416);loggerBooked[_0x778e('0x48')](_0x778e('0x1eb'),_0x370416,_0x778e('0x1ec'),JSON[_0x778e('0x75')](_0x5f4033[_0x778e('0x73')]),_0x778e('0x1ed'),_0x5f4033[_0x778e('0x45')]);if(_0x5f4033[_0x778e('0x73')]){_0x5f4033['queueStatusComplete']=![];_0x5d8eb9[_0x778e('0x25')][_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xc1')]]=[];ami[_0x778e('0xa9')]({'actionid':_0x370416,'action':_0x778e('0x1ee'),'queue':_0x5f4033[_0x778e('0x45')]})[_0x778e('0xa8')](function(){_0x5d8eb9[_0x778e('0xc4')](_0x5f4033);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5d8eb9[_0x778e('0xf1')][_0x370416]['ContactId'],'ListId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdd')],'VoiceQueueId':_0x5d8eb9['actions'][_0x370416][_0x778e('0xde')]||undefined,'CampaignId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1ef')));delete _0x5d8eb9['actions'][_0x370416];});}else{loggerBooked[_0x778e('0x48')](_0x778e('0x1f0'),JSON['stringify'](_0x5f4033[_0x778e('0x73')]),_0x778e('0x1ed'),_0x5f4033[_0x778e('0x45')]);_0x5d8eb9[_0x778e('0xc4')](_0x5f4033);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdc')],'ListId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xdd')],'VoiceQueueId':_0x5d8eb9[_0x778e('0xf1')][_0x370416][_0x778e('0xde')]||undefined,'CampaignId':_0x5d8eb9[_0x778e('0xf1')][_0x370416]['CampaignId']||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1ef')));delete _0x5d8eb9[_0x778e('0xf1')][_0x370416];}}else{return _0x5d8eb9['actionOriginate'](_0x5f4033,_0x4650f7);}}else{if(utils[_0x778e('0x1f1')](undefined,_0x4650f7['scheduledat'])<_0x5f4033[_0x778e('0x1f2')]*0x3c){if(_0x4650f7['Agent']&&!_0x4650f7['Agent'][_0x778e('0x1f3')]){_0x5d8eb9[_0x778e('0x19')][_0x778e('0xfc')](_0x4650f7['id'])['finally'](function(){_0x5d8eb9[_0x778e('0xc4')](_0x5f4033);});}else{hopperUtils[_0x778e('0x1f4')]({'active':![]},_0x4650f7['id'],0x1)[_0x778e('0x18')](function(){_0x5d8eb9['updateOriginated'](_0x5f4033);});}}else{_0x5f4033[_0x778e('0x1f5')]+=0x1;_0x5d8eb9['updateOriginated'](_0x5f4033);if(_0x5f4033[_0x778e('0x1f6')]){hopperUtils[_0x778e('0xec')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4650f7[_0x778e('0xdc')],'ListId':_0x4650f7[_0x778e('0xdd')],'VoiceQueueId':_0x4650f7[_0x778e('0xde')]||undefined,'CampaignId':_0x4650f7[_0x778e('0xdf')]||undefined})[_0x778e('0xa8')](loggerCatch(_0x778e('0x1f7')));hopperUtils[_0x778e('0xef')](createObjHistory(_0x5f4033,_0x4650f7,utils['CAMPAIGN_STATUS'][_0x778e('0x1f8')],0x17,_0x778e('0x1f9')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5d8eb9['saveInDb'](createObjHistory(_0x5f4033,_0x4650f7,utils[_0x778e('0x68')][_0x778e('0x1fa')],0x16,_0x778e('0x1fb')),_0x778e('0x1fc'),_0x778e('0x1fd'));}}}}else{_0x5f4033['outboundBlacklistCallsDay']+=0x1;_0x5d8eb9['saveInDb'](createObjHistory(_0x5f4033,_0x4650f7,utils[_0x778e('0x68')][_0x778e('0x1fe')],0xd,'Blacklist'),_0x778e('0x1ff'),_0x778e('0x200'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x40bcbe){var _0x2501cc=this;var _0x42dac6=_0x40bcbe[_0x778e('0x201')]-_0x40bcbe[_0x778e('0x82')];emitCampaignSummary(_0x40bcbe);if(_0x42dac6>0x0&&_0x40bcbe['temp']==0x0){if(_0x42dac6>this[_0x778e('0x1e')]){_0x42dac6=this[_0x778e('0x1e')];}_0x40bcbe[_0x778e('0x202')]=0x1;hopperUtils[_0x778e('0x203')](_0x40bcbe,_0x42dac6)[_0x778e('0xa4')](function(_0x3215ca){_0x40bcbe['temp']=0x0;if(_0x3215ca){if(!utils[_0x778e('0x204')](_0x3215ca)){_0x40bcbe[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x6d')];logger[_0x778e('0x48')](_0x778e('0x205')+_0x40bcbe['name']);}else{_0x40bcbe[_0x778e('0x82')]+=_0x3215ca['length'];_0x40bcbe['message']=utils[_0x778e('0x68')][_0x778e('0x206')];for(var _0x5f4443=0x0;_0x5f4443<_0x3215ca[_0x778e('0xa0')];_0x5f4443+=0x1){_0x40bcbe[_0x778e('0x207')]+=0x1;if(_[_0x778e('0xf6')](_0x3215ca[_0x5f4443])||_[_0x778e('0xf6')](_0x3215ca[_0x5f4443][_0x778e('0x17e')])||_[_0x778e('0xf6')](_0x3215ca[_0x5f4443]['phone'])){_0x2501cc[_0x778e('0x208')](_0x778e('0x209'),_0x40bcbe,_0x3215ca[_0x5f4443]);}else{hopperUtils[_0x778e('0x20a')](_[_0x778e('0x76')](_0x3215ca[_0x5f4443],[_0x778e('0xdf'),_0x778e('0x168')]))[_0x778e('0xa4')](_0x2501cc[_0x778e('0x20b')](_0x40bcbe,_0x3215ca[_0x5f4443]))['catch'](_0x2501cc[_0x778e('0x20c')](_0x778e('0x20d'),_0x40bcbe));}}}}})[_0x778e('0xa8')](loggerGetContactDialer(_0x778e('0x20e'),_0x40bcbe,_0x42dac6));}};Dialer[_0x778e('0x89')][_0x778e('0xb7')]=function(_0x9c916a,_0x278f2f){var _0x3740a4=this;var _0x4163a9=[];if(_0x278f2f<0x1||_0x9c916a[_0x778e('0xb5')]==='booked'){_0x278f2f=0x1;}var _0x3ead66=Math[_0x778e('0x20f')](_0x9c916a[_0x778e('0x142')]*_0x278f2f)-_0x9c916a[_0x778e('0x82')];if(_0x9c916a[_0x778e('0x210')]>0x0){var _0x4af21b=_0x9c916a[_0x778e('0x210')]-_0x9c916a[_0x778e('0x82')]-_0x9c916a['talking']-_0x9c916a[_0x778e('0x145')];if(_0x3ead66>_0x4af21b){_0x3ead66=_0x4af21b;}}if(_0x3ead66>0x0&&_0x9c916a[_0x778e('0x202')]==0x0){if(_0x9c916a['dialMethod']===_0x778e('0x1ea')){_0x3ead66=0x1;}if(_0x3ead66>this[_0x778e('0x1e')]){_0x3ead66=this[_0x778e('0x1e')];}for(var _0x4df6a6 in this[_0x778e('0x1c')]){if(typeof this['agents'][_0x4df6a6]!==_0x778e('0x15a')){if(this['agents'][_0x4df6a6][_0x778e('0x6f')]==='not_inuse'&&this[_0x778e('0x1c')][_0x4df6a6][_0x778e('0x8d')]===_0x778e('0x8e')){_0x4163a9['push'](this[_0x778e('0x1c')][_0x4df6a6]['id']);}}}_0x9c916a['temp']=0x1;hopperUtils[_0x778e('0x211')](_0x9c916a,_0x4163a9,_0x3ead66)[_0x778e('0xa4')](function(_0x6be584){_0x9c916a['temp']=0x0;if(_0x6be584){if(!utils[_0x778e('0x204')](_0x6be584)){hopperUtils[_0x778e('0x212')](_0x9c916a)[_0x778e('0xa4')](sendMessageReschedule(_0x9c916a))['catch'](loggerCatch(_0x778e('0x213')));}else{_0x9c916a[_0x778e('0x82')]+=_0x6be584[_0x778e('0xa0')];_0x9c916a[_0x778e('0x6c')]=_0x9c916a['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0x778e('0x214')]:utils[_0x778e('0x68')][_0x778e('0x206')];for(var _0x2fe9fa=0x0;_0x2fe9fa<_0x6be584['length'];_0x2fe9fa+=0x1){if(_[_0x778e('0xf6')](_0x6be584[_0x2fe9fa])||_[_0x778e('0xf6')](_0x6be584[_0x2fe9fa]['Contact'])||_[_0x778e('0xf6')](_0x6be584[_0x2fe9fa][_0x778e('0x168')])){_0x3740a4[_0x778e('0x208')](_0x778e('0x209'),_0x9c916a,_0x6be584[_0x2fe9fa]);}else{hopperUtils[_0x778e('0x215')](_[_0x778e('0x76')](_0x6be584[_0x2fe9fa],['VoiceQueueId','phone']))['then'](_0x3740a4[_0x778e('0x20b')](_0x9c916a,_0x6be584[_0x2fe9fa]))['catch'](_0x3740a4[_0x778e('0x20c')](_0x778e('0x209'),_0x9c916a));}}}}})[_0x778e('0xa8')](loggerGetContactDialer(_0x778e('0x216'),_0x9c916a,_0x3ead66));}};Dialer[_0x778e('0x89')][_0x778e('0x62')]=function(_0x480b18){if(_0x480b18[_0x778e('0x210')]>0x0){var _0xefbf3=_0x480b18[_0x778e('0x210')]-_0x480b18[_0x778e('0x82')]-_0x480b18[_0x778e('0x144')];if(_0xefbf3>0x0&&_0x480b18['temp']==0x0){this[_0x778e('0x217')](_0x480b18);}else{loggerPredictiveCalls[_0x778e('0x48')](_0x778e('0x218'));}}else{this[_0x778e('0x217')](_0x480b18);}};Dialer[_0x778e('0x89')][_0x778e('0x217')]=function(_0x2be8ad){var _0x41d9ad=this;var _0x32c6bc=[];_0x2be8ad['originated']+=0x1;for(var _0x1f630d in this[_0x778e('0x1c')]){if(typeof this[_0x778e('0x1c')][_0x1f630d]!==_0x778e('0x15a')){if(this[_0x778e('0x1c')][_0x1f630d][_0x778e('0x6f')]===_0x778e('0x219')&&this['agents'][_0x1f630d][_0x778e('0x8d')]===_0x778e('0x8e')){_0x32c6bc['push'](this[_0x778e('0x1c')][_0x1f630d]['id']);}}}_0x2be8ad[_0x778e('0x202')]=0x1;return this[_0x778e('0x211')](_0x2be8ad['id'],_0x32c6bc,0x1,_0x2be8ad[_0x778e('0x21a')],_0x2be8ad)['then'](function(_0x2145e9){_0x2be8ad[_0x778e('0x202')]=0x1;if(_0x2145e9){if(!utils['checkContactEmpty'](_0x2145e9)){utils[_0x778e('0x66')](_0x2be8ad,0x1,0x0);return hopperUtils['countReScheduled'](_0x2be8ad)['then'](sendMessageReschedule(_0x2be8ad))[_0x778e('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x2be8ad[_0x778e('0x6c')]=utils[_0x778e('0x68')][_0x778e('0x206')];if(_[_0x778e('0xf6')](_0x2145e9[0x0])||_['isNil'](_0x2145e9[0x0][_0x778e('0x17e')])||_['isNil'](_0x2145e9[0x0][_0x778e('0x168')])){_0x41d9ad[_0x778e('0x208')](_0x778e('0x209'),_0x2be8ad,_0x2145e9[0x0]);}else{return hopperUtils[_0x778e('0x215')](_[_0x778e('0x76')](_0x2145e9[0x0],[_0x778e('0xde'),_0x778e('0x168')]))[_0x778e('0xa4')](_0x41d9ad[_0x778e('0x20b')](_0x2be8ad,_0x2145e9[0x0]))[_0x778e('0xa8')](_0x41d9ad[_0x778e('0x20c')](_0x778e('0x21b'),_0x2be8ad));}}}})['catch'](loggerGetContactDialer(_0x778e('0x21c'),_0x2be8ad,0x1));};Dialer[_0x778e('0x89')][_0x778e('0x1dd')]=function(_0x1369a3,_0x1c96f9,_0x517995,_0x4914ba,_0x42fab6,_0x2d0c76){loggerPredictive[_0x778e('0x48')](_0x778e('0x21d'));loggerPredictive['info'](_0x778e('0x21e'),_0x1369a3);loggerPredictive['info'](_0x778e('0x21f'),_0x1c96f9);loggerPredictive[_0x778e('0x48')](_0x778e('0x220'),_0x517995);loggerPredictive['info'](_0x778e('0x221'),_0x4914ba);loggerPredictive['info'](_0x778e('0x222'),_0x42fab6);loggerPredictive['info'](_0x778e('0x223'));return new Promise(function(_0x4334ee,_0x5290c0){if(_0x1369a3<=0x0||isNaN(_0x1369a3)){return _0x5290c0(msgResponse(_0x778e('0x224'),_0x778e('0x88'),'m\x20=\x20'+_0x1369a3));}if(_0x517995<=0x0||isNaN(_0x517995)){return _0x5290c0(msgResponse(_0x778e('0x224'),'Error',_0x778e('0x225')+_0x517995));}if(_0x4914ba<=0x0||isNaN(_0x4914ba)){return _0x5290c0(msgResponse(_0x778e('0x224'),_0x778e('0x88'),_0x778e('0x226')+_0x4914ba));}if(_0x1c96f9<=0x0||isNaN(_0x1c96f9)){return _0x5290c0(msgResponse('[abandonmentRate]',_0x778e('0x88'),_0x778e('0x227')+_0x1c96f9));}if(_0x42fab6<=0x0||isNaN(_0x42fab6)){return _0x5290c0(msgResponse(_0x778e('0x224'),_0x778e('0x88'),_0x778e('0x228')+_0x42fab6));}_0x2d0c76=_0x2d0c76||0x0;var _0x226c88=0x1/_0x517995;var _0x473ce6=0x0;var _0x72193e=0x0;var _0x84b5fc=0x0;var _0xa74663=0x0;for(var _0x6b33d7=0x0;_0x84b5fc<_0x42fab6;_0x6b33d7+=0x1){_0x72193e=_0x6b33d7/_0x1c96f9;_0x473ce6=(_0x4914ba*_0x72193e+_0x2d0c76)/_0x226c88;_0x84b5fc=utils[_0x778e('0x229')](_0x473ce6,_0x1369a3);_0xa74663=_0x473ce6/_0x1369a3*(0x1-utils[_0x778e('0x229')](_0x473ce6,_0x1369a3));}return _0x4334ee({'erlangCalls':_0x6b33d7,'erlangCallToSecond':_0x1c96f9/_0x6b33d7,'erlangAbandonmentRate':_0x84b5fc,'erlangBusyFactor':_0xa74663});});};Dialer[_0x778e('0x89')]['busyFactor']=function(_0x41e71c,_0x207a2c,_0x390edb,_0x14d73c,_0x9e4d6f,_0x160873){loggerPredictive[_0x778e('0x48')](_0x778e('0x22a'));loggerPredictive[_0x778e('0x48')](_0x778e('0x21e'),_0x41e71c);loggerPredictive[_0x778e('0x48')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x207a2c);loggerPredictive[_0x778e('0x48')](_0x778e('0x220'),_0x390edb);loggerPredictive[_0x778e('0x48')](_0x778e('0x221'),_0x14d73c);loggerPredictive[_0x778e('0x48')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9e4d6f);loggerPredictive[_0x778e('0x48')]('---------------------------');return new Promise(function(_0x3ad406,_0x4b4556){if(_0x41e71c<=0x0||isNaN(_0x41e71c)){return _0x4b4556(msgResponse(_0x778e('0x22b'),_0x778e('0x88'),_0x778e('0x22c')+_0x41e71c));}if(_0x390edb<=0x0||isNaN(_0x390edb)){return _0x4b4556(msgResponse(_0x778e('0x22b'),_0x778e('0x88'),_0x778e('0x225')+_0x390edb));}if(_0x14d73c<=0x0||isNaN(_0x14d73c)){return _0x4b4556(msgResponse(_0x778e('0x22b'),_0x778e('0x88'),'p\x20=\x20'+_0x14d73c));}if(_0x207a2c<=0x0||isNaN(_0x207a2c)){return _0x4b4556(msgResponse('[busyFactor]',_0x778e('0x88'),_0x778e('0x227')+_0x207a2c));}if(_0x9e4d6f<=0x0||isNaN(_0x9e4d6f)){return _0x4b4556(msgResponse(_0x778e('0x22b'),'Error',_0x778e('0x22d')+_0x9e4d6f));}_0x160873=_0x160873||0x0;var _0x4d11d1=0x1/_0x390edb;var _0x1aa945=0x0;var _0x1bbf43=0x0;var _0x5d91d7=0x0;var _0x5739e5=0x0;for(var _0x4e2257=0x0;_0x5739e5<_0x9e4d6f;_0x4e2257+=0x1){_0x1bbf43=_0x4e2257/_0x207a2c;_0x1aa945=(_0x14d73c*_0x1bbf43+_0x160873)/_0x4d11d1;_0x5d91d7=utils['erlangb'](_0x1aa945,_0x41e71c);_0x5739e5=_0x1aa945/_0x41e71c*(0x1-utils[_0x778e('0x229')](_0x1aa945,_0x41e71c));}return _0x3ad406({'erlangCalls':_0x4e2257,'erlangCallToSecond':_0x207a2c/_0x4e2257,'erlangAbandonmentRate':_0x5d91d7,'erlangBusyFactor':_0x5739e5});});};module[_0x778e('0x22e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 2c26549..78abdfb 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe71=['name','phone','Contact','firstName','lastName','number','active','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','dialCutDigit','prototype','getQueue','queue','exports','moment','isNil','string','voiceQueue','uniqueid'];(function(_0x1eb775,_0x2df8c9){var _0x5e0dd8=function(_0x48473e){while(--_0x48473e){_0x1eb775['push'](_0x1eb775['shift']());}};_0x5e0dd8(++_0x2df8c9);}(_0xfe71,0x163));var _0x1fe7=function(_0x2eb2da,_0x13c13f){_0x2eb2da=_0x2eb2da-0x0;var _0x3b90d3=_0xfe71[_0x2eb2da];return _0x3b90d3;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1fe7('0x0'));function checkNameSurname(_0x4a02e2,_0x3573f4,_0x2216b3){var _0x2c41a6='';if(!_[_0x1fe7('0x1')](_0x3573f4)&&_0x1fe7('0x2')===typeof _0x3573f4){_0x2c41a6+=_0x3573f4;}if(!_[_0x1fe7('0x1')](_0x2216b3)&&_0x1fe7('0x2')===typeof _0x2216b3){_0x2c41a6+='\x20'+_0x2216b3;}if(_0x2c41a6!==''){return _0x2c41a6;}return _0x4a02e2;}function Action(_0x3ce55a,_0x160739,_0x2fe91e){this[_0x1fe7('0x3')]=_0x3ce55a;this[_0x1fe7('0x4')]=_0x2fe91e||undefined;this[_0x1fe7('0x5')]=checkNameSurname(_0x160739['Contact'][_0x1fe7('0x6')],_0x160739[_0x1fe7('0x7')][_0x1fe7('0x8')],_0x160739[_0x1fe7('0x7')][_0x1fe7('0x9')]);this[_0x1fe7('0xa')]=_0x160739['phone'];this['queue']=_0x3ce55a[_0x1fe7('0x5')];this[_0x1fe7('0xb')]=_0x160739[_0x1fe7('0xb')]||![];this['type']=_0x3ce55a['type'];this[_0x1fe7('0xc')]=_0x3ce55a[_0x1fe7('0xc')]||0x3;this[_0x1fe7('0xd')]=_0x160739[_0x1fe7('0xd')];this[_0x1fe7('0xe')]=_0x160739['countbusyretry'];this['countcongestionretry']=_0x160739['countcongestionretry'];this[_0x1fe7('0xf')]=_0x160739['countnoanswerretry'];this['countnosuchnumberretry']=_0x160739[_0x1fe7('0x10')];this[_0x1fe7('0x11')]=_0x160739['countdropretry'];this[_0x1fe7('0x12')]=_0x160739[_0x1fe7('0x12')];this[_0x1fe7('0x13')]=_0x160739[_0x1fe7('0x13')];this[_0x1fe7('0x14')]=_0x160739['countagentrejectretry'];this['ContactId']=_0x160739[_0x1fe7('0x15')];this[_0x1fe7('0x16')]=_0x160739[_0x1fe7('0x16')];this[_0x1fe7('0x17')]=_0x160739[_0x1fe7('0x17')];this[_0x1fe7('0x18')]=_0x160739[_0x1fe7('0x18')];this['CampaignId']=_0x160739[_0x1fe7('0x19')];this[_0x1fe7('0x1a')]=_0x160739['id'];this[_0x1fe7('0x1b')]=_0x160739[_0x1fe7('0x7')]['firstName']||'';this['starttime']=moment()[_0x1fe7('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1fe7('0x1d')]=_0x160739[_0x1fe7('0x1d')];this[_0x1fe7('0x1e')]=_0x160739[_0x1fe7('0x1e')];this[_0x1fe7('0x1f')]=_0x160739[_0x1fe7('0x1f')];this[_0x1fe7('0x20')]=_0x160739[_0x1fe7('0x20')];this[_0x1fe7('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0x1fe7('0x22')]=function(){return util[_0x1fe7('0x1c')]('\x22%s\x22\x20<%s>',this[_0x1fe7('0x5')],this[_0x1fe7('0x3')][_0x1fe7('0x23')]>0x0?this[_0x1fe7('0xa')]['substring'](this[_0x1fe7('0x3')]['dialCutDigit']):this[_0x1fe7('0xa')]);};Action[_0x1fe7('0x24')][_0x1fe7('0x25')]=function(){return this[_0x1fe7('0x26')];};module[_0x1fe7('0x27')]=Action; \ No newline at end of file +var _0xea47=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId'];(function(_0x141589,_0xa39315){var _0x30012a=function(_0x111ecf){while(--_0x111ecf){_0x141589['push'](_0x141589['shift']());}};_0x30012a(++_0xa39315);}(_0xea47,0x1ca));var _0x7ea4=function(_0x5e7b1a,_0x440b26){_0x5e7b1a=_0x5e7b1a-0x0;var _0x2a8f71=_0xea47[_0x5e7b1a];return _0x2a8f71;};'use strict';var util=require(_0x7ea4('0x0'));var _=require(_0x7ea4('0x1'));var moment=require(_0x7ea4('0x2'));function checkNameSurname(_0x162c74,_0x492f25,_0x9aecb9){var _0x204272='';if(!_[_0x7ea4('0x3')](_0x492f25)&&_0x7ea4('0x4')===typeof _0x492f25){_0x204272+=_0x492f25;}if(!_[_0x7ea4('0x3')](_0x9aecb9)&&_0x7ea4('0x4')===typeof _0x9aecb9){_0x204272+='\x20'+_0x9aecb9;}if(_0x204272!==''){return _0x204272;}return _0x162c74;}function Action(_0x505244,_0x486eb2,_0x562944){this['voiceQueue']=_0x505244;this[_0x7ea4('0x5')]=_0x562944||undefined;this[_0x7ea4('0x6')]=checkNameSurname(_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0x8')],_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0x9')],_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0xa')]);this[_0x7ea4('0xb')]=_0x486eb2['phone'];this['queue']=_0x505244[_0x7ea4('0x6')];this[_0x7ea4('0xc')]=_0x486eb2[_0x7ea4('0xc')]||![];this[_0x7ea4('0xd')]=_0x505244[_0x7ea4('0xd')];this[_0x7ea4('0xe')]=_0x505244['dialQueueTimeout']||0x3;this[_0x7ea4('0xf')]=_0x486eb2[_0x7ea4('0xf')];this[_0x7ea4('0x10')]=_0x486eb2[_0x7ea4('0x10')];this[_0x7ea4('0x11')]=_0x486eb2[_0x7ea4('0x11')];this[_0x7ea4('0x12')]=_0x486eb2['countnoanswerretry'];this[_0x7ea4('0x13')]=_0x486eb2[_0x7ea4('0x13')];this['countdropretry']=_0x486eb2[_0x7ea4('0x14')];this[_0x7ea4('0x15')]=_0x486eb2[_0x7ea4('0x15')];this['countmachineretry']=_0x486eb2[_0x7ea4('0x16')];this[_0x7ea4('0x17')]=_0x486eb2['countagentrejectretry'];this[_0x7ea4('0x18')]=_0x486eb2[_0x7ea4('0x18')];this['ListId']=_0x486eb2['ListId'];this[_0x7ea4('0x19')]=_0x486eb2['UserId'];this[_0x7ea4('0x1a')]=_0x486eb2[_0x7ea4('0x1a')];this[_0x7ea4('0x1b')]=_0x486eb2[_0x7ea4('0x1b')];this[_0x7ea4('0x1c')]=_0x486eb2['id'];this[_0x7ea4('0x1d')]=_0x486eb2[_0x7ea4('0x7')][_0x7ea4('0x9')]||'';this[_0x7ea4('0x1e')]=moment()['format'](_0x7ea4('0x1f'));this['callback']=_0x486eb2[_0x7ea4('0x20')];this[_0x7ea4('0x21')]=_0x486eb2['callbackuniqueid'];this['callbackat']=_0x486eb2[_0x7ea4('0x22')];this[_0x7ea4('0x23')]=_0x486eb2[_0x7ea4('0x23')];this['originatecalleridnum']='';this[_0x7ea4('0x24')]='';}Action[_0x7ea4('0x25')]['getCaller']=function(){return util[_0x7ea4('0x26')](_0x7ea4('0x27'),this[_0x7ea4('0x6')],this['voiceQueue'][_0x7ea4('0x28')]>0x0?this[_0x7ea4('0xb')][_0x7ea4('0x29')](this['voiceQueue']['dialCutDigit']):this['number']);};Action[_0x7ea4('0x25')][_0x7ea4('0x2a')]=function(){return this[_0x7ea4('0x2b')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 2b9dac6..b6b0c9d 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a3=['ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','Answer','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','responsetime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb9a3,0xb7));var _0x3b9a=function(_0x1e93dc,_0x1457ad){_0x1e93dc=_0x1e93dc-0x0;var _0x160131=_0xb9a3[_0x1e93dc];return _0x160131;};'use strict';var moment=require(_0x3b9a('0x0'));var utils=require(_0x3b9a('0x1'));function AgentComplete(_0x2af0d3,_0x5a844e){this['state']=0x4;this[_0x3b9a('0x2')]=_0x3b9a('0x3');this[_0x3b9a('0x4')]=_0x2af0d3['scheduledat'];this[_0x3b9a('0x5')]=_0x2af0d3[_0x3b9a('0x5')];this['campaigntype']=_0x2af0d3[_0x3b9a('0x5')]==='outbound'?_0x3b9a('0x6'):_0x2af0d3[_0x3b9a('0x5')];this['countbusyretry']=_0x2af0d3[_0x3b9a('0x7')];this[_0x3b9a('0x8')]=_0x2af0d3[_0x3b9a('0x8')];this['countnoanswerretry']=_0x2af0d3[_0x3b9a('0x9')];this[_0x3b9a('0xa')]=_0x2af0d3[_0x3b9a('0x7')]+_0x2af0d3[_0x3b9a('0x8')]+_0x2af0d3[_0x3b9a('0x9')]+_0x2af0d3[_0x3b9a('0xb')]+_0x2af0d3[_0x3b9a('0xc')]+_0x2af0d3[_0x3b9a('0xd')]+_0x2af0d3[_0x3b9a('0xe')]+_0x2af0d3[_0x3b9a('0xf')];this[_0x3b9a('0xb')]=_0x2af0d3[_0x3b9a('0xb')];this[_0x3b9a('0xc')]=_0x2af0d3['countdropretry'];this[_0x3b9a('0xd')]=_0x2af0d3[_0x3b9a('0xd')];this[_0x3b9a('0xe')]=_0x2af0d3['countmachineretry'];this[_0x3b9a('0xf')]=_0x2af0d3['countagentrejectretry'];this[_0x3b9a('0x10')]=_0x5a844e[_0x3b9a('0x10')];this[_0x3b9a('0x11')]=_0x2af0d3[_0x3b9a('0x12')];this[_0x3b9a('0x13')]=_0x2af0d3[_0x3b9a('0x14')];this[_0x3b9a('0x15')]=_0x2af0d3[_0x3b9a('0x15')];this['responsetime']=_0x2af0d3['responsetime'];this[_0x3b9a('0x16')]=_0x2af0d3['answertime'];this['endtime']=moment()[_0x3b9a('0x17')](_0x3b9a('0x18'));this['ringtime']=utils[_0x3b9a('0x19')](_0x2af0d3['responsetime'],_0x2af0d3[_0x3b9a('0x15')]);this[_0x3b9a('0x1a')]=utils['getSeconds'](_0x2af0d3[_0x3b9a('0x16')],_0x2af0d3[_0x3b9a('0x1b')]);this[_0x3b9a('0x1c')]=utils[_0x3b9a('0x19')](this[_0x3b9a('0x1d')],_0x2af0d3[_0x3b9a('0x16')]);this[_0x3b9a('0x6')]=_0x5a844e['queue'];this[_0x3b9a('0x1e')]=_0x5a844e['membername'];this[_0x3b9a('0x1f')]=_0x5a844e[_0x3b9a('0x1f')];this[_0x3b9a('0x20')]=_0x2af0d3[_0x3b9a('0x20')];this[_0x3b9a('0x21')]=_0x2af0d3[_0x3b9a('0x21')];this['callbackat']=_0x2af0d3[_0x3b9a('0x22')];this[_0x3b9a('0x23')]=_0x2af0d3['recallme'];this[_0x3b9a('0x24')]=_0x2af0d3[_0x3b9a('0x24')];this[_0x3b9a('0x25')]=_0x2af0d3['ListId'];this['UserId']=_0x2af0d3['UserId'];this[_0x3b9a('0x26')]=_0x2af0d3[_0x3b9a('0x26')];this[_0x3b9a('0x27')]=_0x2af0d3[_0x3b9a('0x27')];this[_0x3b9a('0x28')]=_0x2af0d3[_0x3b9a('0x28')]||'';this[_0x3b9a('0x29')]=_0x2af0d3[_0x3b9a('0x29')]||'';this[_0x3b9a('0x2a')]=_0x2af0d3[_0x3b9a('0x2a')];}module[_0x3b9a('0x2b')]=AgentComplete; \ No newline at end of file +var _0x557b=['../utils','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','starttime','holdtime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','agiafterat','exports'];(function(_0x118617,_0x24e482){var _0x2a7f46=function(_0xea56dc){while(--_0xea56dc){_0x118617['push'](_0x118617['shift']());}};_0x2a7f46(++_0x24e482);}(_0x557b,0xcd));var _0xb557=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x557b[_0x4e6ae6];return _0x23c108;};'use strict';var moment=require('moment');var utils=require(_0xb557('0x0'));function AgentComplete(_0x1e251f,_0x56487b){this['state']=0x4;this[_0xb557('0x1')]=_0xb557('0x2');this[_0xb557('0x3')]=_0x1e251f[_0xb557('0x3')];this['type']=_0x1e251f['type'];this[_0xb557('0x4')]=_0x1e251f[_0xb557('0x5')]===_0xb557('0x6')?_0xb557('0x7'):_0x1e251f[_0xb557('0x5')];this[_0xb557('0x8')]=_0x1e251f[_0xb557('0x8')];this[_0xb557('0x9')]=_0x1e251f['countcongestionretry'];this[_0xb557('0xa')]=_0x1e251f[_0xb557('0xa')];this[_0xb557('0xb')]=_0x1e251f['countbusyretry']+_0x1e251f[_0xb557('0x9')]+_0x1e251f[_0xb557('0xa')]+_0x1e251f['countnosuchnumberretry']+_0x1e251f[_0xb557('0xc')]+_0x1e251f[_0xb557('0xd')]+_0x1e251f[_0xb557('0xe')]+_0x1e251f['countagentrejectretry'];this['countnosuchnumberretry']=_0x1e251f[_0xb557('0xf')];this[_0xb557('0xc')]=_0x1e251f[_0xb557('0xc')];this['countabandonedretry']=_0x1e251f['countabandonedretry'];this['countmachineretry']=_0x1e251f[_0xb557('0xe')];this[_0xb557('0x10')]=_0x1e251f[_0xb557('0x10')];this[_0xb557('0x11')]=_0x56487b[_0xb557('0x11')];this[_0xb557('0x12')]=_0x1e251f[_0xb557('0x13')];this['calleridnum']=_0x1e251f[_0xb557('0x14')];this['starttime']=_0x1e251f['starttime'];this[_0xb557('0x15')]=_0x1e251f[_0xb557('0x15')];this[_0xb557('0x16')]=_0x1e251f[_0xb557('0x16')];this[_0xb557('0x17')]=moment()[_0xb557('0x18')](_0xb557('0x19'));this['ringtime']=utils[_0xb557('0x1a')](_0x1e251f[_0xb557('0x15')],_0x1e251f[_0xb557('0x1b')]);this[_0xb557('0x1c')]=utils[_0xb557('0x1a')](_0x1e251f[_0xb557('0x16')],_0x1e251f[_0xb557('0x15')]);this['talktime']=utils[_0xb557('0x1a')](this[_0xb557('0x17')],_0x1e251f[_0xb557('0x16')]);this[_0xb557('0x7')]=_0x56487b[_0xb557('0x7')];this[_0xb557('0x1d')]=_0x56487b[_0xb557('0x1d')];this[_0xb557('0x1e')]=_0x56487b['reason'];this['callback']=_0x1e251f['callback'];this[_0xb557('0x1f')]=_0x1e251f[_0xb557('0x1f')];this['callbackat']=_0x1e251f[_0xb557('0x20')];this[_0xb557('0x21')]=_0x1e251f[_0xb557('0x21')];this[_0xb557('0x22')]=_0x1e251f[_0xb557('0x22')];this['ListId']=_0x1e251f[_0xb557('0x23')];this['UserId']=_0x1e251f[_0xb557('0x24')];this['VoiceQueueId']=_0x1e251f['VoiceQueueId'];this['CampaignId']=_0x1e251f[_0xb557('0x25')];this['originatecalleridnum']=_0x1e251f[_0xb557('0x26')]||'';this['originatecalleridname']=_0x1e251f['originatecalleridname']||'';this['agiafterat']=_0x1e251f[_0xb557('0x27')];}module[_0xb557('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index b06df13..98ebe2c 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2d8=['starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum'];(function(_0x35a441,_0x3a2ec6){var _0x571ce3=function(_0x161827){while(--_0x161827){_0x35a441['push'](_0x35a441['shift']());}};_0x571ce3(++_0x3a2ec6);}(_0xb2d8,0x170));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0x31363e){this[_0x8b2d('0x0')]=_0x31363e[_0x8b2d('0x0')];this[_0x8b2d('0x1')]=_0x31363e[_0x8b2d('0x1')];this[_0x8b2d('0x2')]=_0x31363e['type'];this[_0x8b2d('0x3')]=_0x31363e['type']===_0x8b2d('0x4')?_0x8b2d('0x5'):_0x31363e[_0x8b2d('0x2')];this[_0x8b2d('0x6')]=_0x31363e[_0x8b2d('0x6')];this['countcongestionretry']=_0x31363e['countcongestionretry'];this[_0x8b2d('0x7')]=_0x31363e[_0x8b2d('0x7')];this[_0x8b2d('0x8')]=_0x31363e[_0x8b2d('0x6')]+_0x31363e[_0x8b2d('0x9')]+_0x31363e['countnoanswerretry']+_0x31363e['countnosuchnumberretry']+_0x31363e[_0x8b2d('0xa')]+_0x31363e[_0x8b2d('0xb')]+_0x31363e[_0x8b2d('0xc')]+_0x31363e['countagentrejectretry'];this[_0x8b2d('0xd')]=_0x31363e[_0x8b2d('0xd')];this['countdropretry']=_0x31363e['countdropretry'];this[_0x8b2d('0xb')]=_0x31363e[_0x8b2d('0xb')];this[_0x8b2d('0xc')]=_0x31363e[_0x8b2d('0xc')];this[_0x8b2d('0xe')]=_0x31363e['countagentrejectretry'];this[_0x8b2d('0x5')]=_0x31363e[_0x8b2d('0x5')];this[_0x8b2d('0xf')]=_0x31363e[_0x8b2d('0xf')];this[_0x8b2d('0x10')]=_0x31363e['calleridnum'];this['starttime']=_0x31363e[_0x8b2d('0x11')];this[_0x8b2d('0x12')]=_0x31363e[_0x8b2d('0x12')];this[_0x8b2d('0x13')]=_0x31363e[_0x8b2d('0x12')];this['ringtime']=_0x31363e['ringtime']||0x0;this['holdtime']=_0x31363e[_0x8b2d('0x14')]||0x0;this[_0x8b2d('0x15')]=_0x31363e[_0x8b2d('0x15')]||0x0;this[_0x8b2d('0x16')]=_0x31363e['callback'];this[_0x8b2d('0x17')]=_0x31363e[_0x8b2d('0x17')];this[_0x8b2d('0x18')]=_0x31363e[_0x8b2d('0x18')];this['recallme']=_0x31363e[_0x8b2d('0x19')];this[_0x8b2d('0x1a')]=_0x31363e[_0x8b2d('0x1a')];this[_0x8b2d('0x1b')]=_0x31363e[_0x8b2d('0x1b')];this[_0x8b2d('0x1c')]=_0x31363e[_0x8b2d('0x1c')];this[_0x8b2d('0x1d')]=_0x31363e[_0x8b2d('0x1d')];this[_0x8b2d('0x1e')]=_0x31363e[_0x8b2d('0x1e')];this['originatecalleridnum']=_0x31363e['originatecalleridnum']||'';this[_0x8b2d('0x1f')]=_0x31363e['originatecalleridname']||'';this['state']=_0x31363e[_0x8b2d('0x20')];this['statedesc']=_0x31363e[_0x8b2d('0x21')];}module[_0x8b2d('0x22')]=Final; \ No newline at end of file +var _0x5055=['CampaignId','originatecalleridnum','originatecalleridname','state','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3f7e42,_0x47fafe){var _0x3bfbe8=function(_0x415f62){while(--_0x415f62){_0x3f7e42['push'](_0x3f7e42['shift']());}};_0x3bfbe8(++_0x47fafe);}(_0x5055,0x1e1));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0x6e0d24){this[_0x5505('0x0')]=_0x6e0d24['uniqueid'];this['scheduledat']=_0x6e0d24[_0x5505('0x1')];this[_0x5505('0x2')]=_0x6e0d24[_0x5505('0x2')];this['campaigntype']=_0x6e0d24[_0x5505('0x2')]===_0x5505('0x3')?_0x5505('0x4'):_0x6e0d24[_0x5505('0x2')];this[_0x5505('0x5')]=_0x6e0d24['countbusyretry'];this[_0x5505('0x6')]=_0x6e0d24[_0x5505('0x6')];this['countnoanswerretry']=_0x6e0d24['countnoanswerretry'];this[_0x5505('0x7')]=_0x6e0d24[_0x5505('0x5')]+_0x6e0d24[_0x5505('0x6')]+_0x6e0d24['countnoanswerretry']+_0x6e0d24[_0x5505('0x8')]+_0x6e0d24['countdropretry']+_0x6e0d24[_0x5505('0x9')]+_0x6e0d24['countmachineretry']+_0x6e0d24[_0x5505('0xa')];this[_0x5505('0x8')]=_0x6e0d24[_0x5505('0x8')];this[_0x5505('0xb')]=_0x6e0d24['countdropretry'];this[_0x5505('0x9')]=_0x6e0d24[_0x5505('0x9')];this[_0x5505('0xc')]=_0x6e0d24[_0x5505('0xc')];this[_0x5505('0xa')]=_0x6e0d24[_0x5505('0xa')];this[_0x5505('0x4')]=_0x6e0d24[_0x5505('0x4')];this[_0x5505('0xd')]=_0x6e0d24['calleridname'];this[_0x5505('0xe')]=_0x6e0d24[_0x5505('0xe')];this[_0x5505('0xf')]=_0x6e0d24['starttime'];this[_0x5505('0x10')]=_0x6e0d24[_0x5505('0x10')];this[_0x5505('0x11')]=_0x6e0d24[_0x5505('0x10')];this[_0x5505('0x12')]=_0x6e0d24[_0x5505('0x12')]||0x0;this['holdtime']=_0x6e0d24[_0x5505('0x13')]||0x0;this[_0x5505('0x14')]=_0x6e0d24[_0x5505('0x14')]||0x0;this[_0x5505('0x15')]=_0x6e0d24[_0x5505('0x15')];this[_0x5505('0x16')]=_0x6e0d24['callbackuniqueid'];this[_0x5505('0x17')]=_0x6e0d24[_0x5505('0x17')];this[_0x5505('0x18')]=_0x6e0d24['recallme'];this[_0x5505('0x19')]=_0x6e0d24[_0x5505('0x19')];this['ListId']=_0x6e0d24[_0x5505('0x1a')];this[_0x5505('0x1b')]=_0x6e0d24['UserId'];this[_0x5505('0x1c')]=_0x6e0d24[_0x5505('0x1c')];this[_0x5505('0x1d')]=_0x6e0d24[_0x5505('0x1d')];this[_0x5505('0x1e')]=_0x6e0d24[_0x5505('0x1e')]||'';this[_0x5505('0x1f')]=_0x6e0d24['originatecalleridname']||'';this['state']=_0x6e0d24[_0x5505('0x20')];this['statedesc']=_0x6e0d24['statedesc'];}module[_0x5505('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index f6b8ea2..9efb668 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58ef=['moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','queue','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','exports'];(function(_0x4b18c0,_0x7c2a1d){var _0x559cde=function(_0x17a845){while(--_0x17a845){_0x4b18c0['push'](_0x4b18c0['shift']());}};_0x559cde(++_0x7c2a1d);}(_0x58ef,0x75));var _0xf58e=function(_0xbc6b35,_0xbc5116){_0xbc6b35=_0xbc6b35-0x0;var _0x1ecb7b=_0x58ef[_0xbc6b35];return _0x1ecb7b;};'use strict';var moment=require(_0xf58e('0x0'));var utils=require(_0xf58e('0x1'));function Hangup(_0x150ec8,_0x2a11a3){this['state']=0x4;this[_0xf58e('0x2')]=_0xf58e('0x3');this[_0xf58e('0x4')]=_0x150ec8[_0xf58e('0x4')];this[_0xf58e('0x5')]=_0x150ec8[_0xf58e('0x5')];this[_0xf58e('0x6')]=_0x150ec8[_0xf58e('0x5')]===_0xf58e('0x7')?'queue':_0x150ec8['type'];this['amd']=_0x150ec8['amd']||![];this['countbusyretry']=_0x150ec8['countbusyretry'];this[_0xf58e('0x8')]=_0x150ec8[_0xf58e('0x8')];this[_0xf58e('0x9')]=_0x150ec8[_0xf58e('0x9')];this[_0xf58e('0xa')]=_0x150ec8['countbusyretry']+_0x150ec8[_0xf58e('0x8')]+_0x150ec8[_0xf58e('0x9')]+_0x150ec8[_0xf58e('0xb')]+_0x150ec8[_0xf58e('0xc')]+_0x150ec8[_0xf58e('0xd')]+_0x150ec8[_0xf58e('0xe')]+_0x150ec8[_0xf58e('0xf')];this[_0xf58e('0xb')]=_0x150ec8[_0xf58e('0xb')];this[_0xf58e('0xc')]=_0x150ec8[_0xf58e('0xc')];this['countabandonedretry']=_0x150ec8['countabandonedretry'];this[_0xf58e('0xe')]=_0x150ec8['countmachineretry'];this['countagentrejectretry']=_0x150ec8[_0xf58e('0xf')];this['uniqueid']=_0x2a11a3[_0xf58e('0x10')];this[_0xf58e('0x11')]=_0x150ec8[_0xf58e('0x12')];this[_0xf58e('0x13')]=_0x150ec8[_0xf58e('0x14')];this[_0xf58e('0x15')]=_0x150ec8[_0xf58e('0x15')];this['responsetime']=_0x150ec8[_0xf58e('0x16')];this['endtime']=moment()[_0xf58e('0x17')](_0xf58e('0x18'));this[_0xf58e('0x19')]=utils[_0xf58e('0x1a')](_0x150ec8['responsetime'],_0x150ec8['starttime']);this[_0xf58e('0x1b')]=0x0;this[_0xf58e('0x1c')]=utils[_0xf58e('0x1a')](this[_0xf58e('0x1d')],_0x150ec8['responsetime']);this[_0xf58e('0x1e')]=_0x150ec8[_0xf58e('0x1e')];this['membername']='IVR';this['reason']=_0x2a11a3['cause-txt'];this[_0xf58e('0x1f')]=_0x150ec8[_0xf58e('0x1f')];this[_0xf58e('0x20')]=_0x150ec8[_0xf58e('0x20')];this['callbackat']=_0x150ec8['callbackat'];this['recallme']=_0x150ec8[_0xf58e('0x21')];this[_0xf58e('0x22')]=_0x150ec8[_0xf58e('0x22')];this[_0xf58e('0x23')]=_0x150ec8['ListId'];this['UserId']=_0x150ec8[_0xf58e('0x24')];this[_0xf58e('0x25')]=_0x150ec8[_0xf58e('0x25')];this['CampaignId']=_0x150ec8['CampaignId'];}module[_0xf58e('0x26')]=Hangup; \ No newline at end of file +var _0x3a80=['statedesc','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3a80,0x166));var _0x03a8=function(_0xdc1eb,_0x37a9d2){_0xdc1eb=_0xdc1eb-0x0;var _0x27c55e=_0x3a80[_0xdc1eb];return _0x27c55e;};'use strict';var moment=require(_0x03a8('0x0'));var utils=require(_0x03a8('0x1'));function Hangup(_0x5c57bc,_0x3ffb70){this['state']=0x4;this[_0x03a8('0x2')]='Answer';this[_0x03a8('0x3')]=_0x5c57bc[_0x03a8('0x3')];this[_0x03a8('0x4')]=_0x5c57bc[_0x03a8('0x4')];this[_0x03a8('0x5')]=_0x5c57bc[_0x03a8('0x4')]===_0x03a8('0x6')?'queue':_0x5c57bc[_0x03a8('0x4')];this['amd']=_0x5c57bc[_0x03a8('0x7')]||![];this[_0x03a8('0x8')]=_0x5c57bc[_0x03a8('0x8')];this[_0x03a8('0x9')]=_0x5c57bc[_0x03a8('0x9')];this[_0x03a8('0xa')]=_0x5c57bc[_0x03a8('0xa')];this['countglobal']=_0x5c57bc[_0x03a8('0x8')]+_0x5c57bc[_0x03a8('0x9')]+_0x5c57bc[_0x03a8('0xa')]+_0x5c57bc[_0x03a8('0xb')]+_0x5c57bc[_0x03a8('0xc')]+_0x5c57bc[_0x03a8('0xd')]+_0x5c57bc[_0x03a8('0xe')]+_0x5c57bc[_0x03a8('0xf')];this[_0x03a8('0xb')]=_0x5c57bc[_0x03a8('0xb')];this[_0x03a8('0xc')]=_0x5c57bc[_0x03a8('0xc')];this[_0x03a8('0xd')]=_0x5c57bc[_0x03a8('0xd')];this[_0x03a8('0xe')]=_0x5c57bc[_0x03a8('0xe')];this[_0x03a8('0xf')]=_0x5c57bc[_0x03a8('0xf')];this[_0x03a8('0x10')]=_0x3ffb70[_0x03a8('0x10')];this[_0x03a8('0x11')]=_0x5c57bc[_0x03a8('0x12')];this[_0x03a8('0x13')]=_0x5c57bc[_0x03a8('0x14')];this[_0x03a8('0x15')]=_0x5c57bc[_0x03a8('0x15')];this['responsetime']=_0x5c57bc[_0x03a8('0x16')];this[_0x03a8('0x17')]=moment()[_0x03a8('0x18')](_0x03a8('0x19'));this[_0x03a8('0x1a')]=utils[_0x03a8('0x1b')](_0x5c57bc['responsetime'],_0x5c57bc[_0x03a8('0x15')]);this[_0x03a8('0x1c')]=0x0;this[_0x03a8('0x1d')]=utils['getSeconds'](this[_0x03a8('0x17')],_0x5c57bc[_0x03a8('0x16')]);this[_0x03a8('0x1e')]=_0x5c57bc[_0x03a8('0x1e')];this[_0x03a8('0x1f')]=_0x03a8('0x20');this[_0x03a8('0x21')]=_0x3ffb70[_0x03a8('0x22')];this['callback']=_0x5c57bc[_0x03a8('0x23')];this[_0x03a8('0x24')]=_0x5c57bc[_0x03a8('0x24')];this[_0x03a8('0x25')]=_0x5c57bc[_0x03a8('0x25')];this['recallme']=_0x5c57bc[_0x03a8('0x26')];this[_0x03a8('0x27')]=_0x5c57bc[_0x03a8('0x27')];this[_0x03a8('0x28')]=_0x5c57bc[_0x03a8('0x28')];this[_0x03a8('0x29')]=_0x5c57bc['UserId'];this[_0x03a8('0x2a')]=_0x5c57bc[_0x03a8('0x2a')];this[_0x03a8('0x2b')]=_0x5c57bc[_0x03a8('0x2b')];}module[_0x03a8('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index fabe591..ce6fbe8 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x330a=['callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback'];(function(_0x40278c,_0x5aaf49){var _0x186e5c=function(_0x14eae2){while(--_0x14eae2){_0x40278c['push'](_0x40278c['shift']());}};_0x186e5c(++_0x5aaf49);}(_0x330a,0x6e));var _0xa330=function(_0x5dbb3e,_0x4b494d){_0x5dbb3e=_0x5dbb3e-0x0;var _0x138d23=_0x330a[_0x5dbb3e];return _0x138d23;};'use strict';var utils=require('../utils');function History(_0x43cfa4){this['uniqueid']=_0x43cfa4['uniqueid'];this['scheduledat']=_0x43cfa4[_0xa330('0x0')]||undefined;this[_0xa330('0x1')]=_0x43cfa4[_0xa330('0x1')];this['campaigntype']=_0x43cfa4[_0xa330('0x1')]===_0xa330('0x2')?_0xa330('0x3'):_0x43cfa4[_0xa330('0x1')];this['countbusyretry']=_0x43cfa4[_0xa330('0x4')];this[_0xa330('0x5')]=_0x43cfa4[_0xa330('0x5')];this[_0xa330('0x6')]=_0x43cfa4['countnoanswerretry'];this['countglobal']=_0x43cfa4[_0xa330('0x4')]+_0x43cfa4[_0xa330('0x5')]+_0x43cfa4[_0xa330('0x6')]+_0x43cfa4[_0xa330('0x7')]+_0x43cfa4['countdropretry']+_0x43cfa4[_0xa330('0x8')]+_0x43cfa4['countmachineretry']+_0x43cfa4[_0xa330('0x9')];this[_0xa330('0x7')]=_0x43cfa4['countnosuchnumberretry'];this['countdropretry']=_0x43cfa4[_0xa330('0xa')];this['countabandonedretry']=_0x43cfa4[_0xa330('0x8')];this['countmachineretry']=_0x43cfa4[_0xa330('0xb')];this[_0xa330('0x9')]=_0x43cfa4[_0xa330('0x9')];this['queue']=_0x43cfa4['queue'];this[_0xa330('0xc')]=_0x43cfa4['name'];this[_0xa330('0xd')]=_0x43cfa4[_0xa330('0xe')];this[_0xa330('0xf')]=_0x43cfa4[_0xa330('0xf')];this[_0xa330('0x10')]=_0x43cfa4['responsetime'];this[_0xa330('0x11')]=_0x43cfa4[_0xa330('0x10')];this[_0xa330('0x12')]=utils[_0xa330('0x13')](_0x43cfa4[_0xa330('0x10')],_0x43cfa4['starttime']);this[_0xa330('0x14')]=0x0;this['talktime']=0x0;this[_0xa330('0x15')]=_0x43cfa4['callback'];this[_0xa330('0x16')]=_0x43cfa4[_0xa330('0x16')];this['callbackat']=_0x43cfa4[_0xa330('0x17')];this['recallme']=_0x43cfa4['recallme'];this[_0xa330('0x18')]=_0x43cfa4[_0xa330('0x18')];this[_0xa330('0x19')]=_0x43cfa4[_0xa330('0x19')];this['UserId']=_0x43cfa4[_0xa330('0x1a')];this['VoiceQueueId']=_0x43cfa4[_0xa330('0x1b')];this[_0xa330('0x1c')]=_0x43cfa4[_0xa330('0x1c')];this[_0xa330('0x1d')]=_0x43cfa4['originatecalleridnum']||'';this['originatecalleridname']=_0x43cfa4['originatecalleridname']||'';this[_0xa330('0x1e')]=_0x43cfa4[_0xa330('0x1e')];this['statedesc']=_0x43cfa4[_0xa330('0x1f')];}module[_0xa330('0x20')]=History; \ No newline at end of file +var _0x2be2=['statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0xd08465,_0x35e4fa){var _0x1046cf=function(_0x1b811a){while(--_0x1b811a){_0xd08465['push'](_0xd08465['shift']());}};_0x1046cf(++_0x35e4fa);}(_0x2be2,0x129));var _0x22be=function(_0x1173d0,_0x37fe43){_0x1173d0=_0x1173d0-0x0;var _0x24b2a3=_0x2be2[_0x1173d0];return _0x24b2a3;};'use strict';var utils=require(_0x22be('0x0'));function History(_0x20191c){this['uniqueid']=_0x20191c[_0x22be('0x1')];this['scheduledat']=_0x20191c[_0x22be('0x2')]||undefined;this['type']=_0x20191c[_0x22be('0x3')];this[_0x22be('0x4')]=_0x20191c[_0x22be('0x3')]===_0x22be('0x5')?_0x22be('0x6'):_0x20191c['type'];this[_0x22be('0x7')]=_0x20191c[_0x22be('0x7')];this[_0x22be('0x8')]=_0x20191c[_0x22be('0x8')];this['countnoanswerretry']=_0x20191c[_0x22be('0x9')];this[_0x22be('0xa')]=_0x20191c['countbusyretry']+_0x20191c[_0x22be('0x8')]+_0x20191c['countnoanswerretry']+_0x20191c[_0x22be('0xb')]+_0x20191c[_0x22be('0xc')]+_0x20191c[_0x22be('0xd')]+_0x20191c[_0x22be('0xe')]+_0x20191c[_0x22be('0xf')];this[_0x22be('0xb')]=_0x20191c[_0x22be('0xb')];this['countdropretry']=_0x20191c[_0x22be('0xc')];this['countabandonedretry']=_0x20191c[_0x22be('0xd')];this['countmachineretry']=_0x20191c[_0x22be('0xe')];this['countagentrejectretry']=_0x20191c[_0x22be('0xf')];this[_0x22be('0x6')]=_0x20191c[_0x22be('0x6')];this[_0x22be('0x10')]=_0x20191c[_0x22be('0x11')];this[_0x22be('0x12')]=_0x20191c[_0x22be('0x13')];this[_0x22be('0x14')]=_0x20191c[_0x22be('0x14')];this['responsetime']=_0x20191c['responsetime'];this[_0x22be('0x15')]=_0x20191c[_0x22be('0x16')];this['ringtime']=utils[_0x22be('0x17')](_0x20191c[_0x22be('0x16')],_0x20191c[_0x22be('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x22be('0x18')]=_0x20191c['callback'];this[_0x22be('0x19')]=_0x20191c[_0x22be('0x19')];this['callbackat']=_0x20191c[_0x22be('0x1a')];this[_0x22be('0x1b')]=_0x20191c['recallme'];this[_0x22be('0x1c')]=_0x20191c[_0x22be('0x1c')];this[_0x22be('0x1d')]=_0x20191c[_0x22be('0x1d')];this['UserId']=_0x20191c[_0x22be('0x1e')];this[_0x22be('0x1f')]=_0x20191c[_0x22be('0x1f')];this['CampaignId']=_0x20191c[_0x22be('0x20')];this[_0x22be('0x21')]=_0x20191c[_0x22be('0x21')]||'';this[_0x22be('0x22')]=_0x20191c['originatecalleridname']||'';this['state']=_0x20191c[_0x22be('0x23')];this[_0x22be('0x24')]=_0x20191c[_0x22be('0x24')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 6585e9b..0d404dc 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc59e=['starttime','responsetime','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','droptime','dropreason','endtime','ringtime','getSeconds'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc59e,0x1b6));var _0xec59=function(_0x5a7744,_0x19fba7){_0x5a7744=_0x5a7744-0x0;var _0x6abf68=_0xc59e[_0x5a7744];return _0x6abf68;};'use strict';var utils=require(_0xec59('0x0'));function QueueCallerAbandon(_0x5c8f71,_0x53bba4){this[_0xec59('0x1')]=_0x5c8f71[_0xec59('0x1')];this[_0xec59('0x2')]=_0x5c8f71[_0xec59('0x2')];this[_0xec59('0x3')]=_0x5c8f71[_0xec59('0x2')]===_0xec59('0x4')?_0xec59('0x5'):_0x5c8f71[_0xec59('0x2')];this[_0xec59('0x6')]=_0x5c8f71[_0xec59('0x6')];this[_0xec59('0x7')]=_0x5c8f71[_0xec59('0x7')];this['countnoanswerretry']=_0x5c8f71[_0xec59('0x8')];this[_0xec59('0x9')]=_0x5c8f71[_0xec59('0x6')]+_0x5c8f71[_0xec59('0x7')]+_0x5c8f71[_0xec59('0x8')]+_0x5c8f71[_0xec59('0xa')]+_0x5c8f71[_0xec59('0xb')]+_0x5c8f71[_0xec59('0xc')]+_0x5c8f71['countmachineretry']+_0x5c8f71['countagentrejectretry'];this[_0xec59('0xa')]=_0x5c8f71[_0xec59('0xa')];this['countdropretry']=_0x5c8f71[_0xec59('0xb')];this[_0xec59('0xc')]=_0x5c8f71[_0xec59('0xc')];this[_0xec59('0xd')]=_0x5c8f71[_0xec59('0xd')];this[_0xec59('0xe')]=_0x5c8f71[_0xec59('0xe')];this[_0xec59('0xf')]=_0x53bba4[_0xec59('0xf')];this[_0xec59('0x10')]=_0x5c8f71[_0xec59('0x11')];this[_0xec59('0x12')]=_0x5c8f71['number'];this['starttime']=_0x5c8f71['starttime'];this['responsetime']=_0x5c8f71['responsetime'];this[_0xec59('0x13')]=_0x5c8f71[_0xec59('0x13')];this[_0xec59('0x14')]=_0x5c8f71['dropreason'];this[_0xec59('0x15')]=this[_0xec59('0x13')];this[_0xec59('0x16')]=utils[_0xec59('0x17')](_0x5c8f71['responsetime'],_0x5c8f71[_0xec59('0x18')]);this['holdtime']=utils[_0xec59('0x17')](this['droptime'],_0x5c8f71[_0xec59('0x19')]);this['talktime']=0x0;this[_0xec59('0x5')]=_0x53bba4[_0xec59('0x5')];this['membername']=_0x53bba4[_0xec59('0x1a')];this[_0xec59('0x1b')]=_0x53bba4['reason'];this['callback']=_0x5c8f71[_0xec59('0x1c')];this['callbackuniqueid']=_0x5c8f71['callbackuniqueid'];this['callbackat']=_0x5c8f71[_0xec59('0x1d')];this[_0xec59('0x1e')]=_0x5c8f71['recallme'];this[_0xec59('0x1f')]=_0x5c8f71[_0xec59('0x1f')];this[_0xec59('0x20')]=_0x5c8f71['ListId'];this[_0xec59('0x21')]=_0x5c8f71[_0xec59('0x21')];this['VoiceQueueId']=_0x5c8f71[_0xec59('0x22')];this[_0xec59('0x23')]=_0x5c8f71[_0xec59('0x23')];this[_0xec59('0x24')]=_0x5c8f71[_0xec59('0x24')]||'';this[_0xec59('0x25')]=_0x5c8f71['originatecalleridname']||'';this[_0xec59('0x26')]=_0x5c8f71[_0xec59('0x26')];this[_0xec59('0x27')]=_0x5c8f71['state'];this[_0xec59('0x28')]=_0x5c8f71['statedesc'];}module[_0xec59('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x23c5=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','dropreason','droptime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry'];(function(_0x49b7ac,_0x1bd651){var _0x54f677=function(_0x553049){while(--_0x553049){_0x49b7ac['push'](_0x49b7ac['shift']());}};_0x54f677(++_0x1bd651);}(_0x23c5,0xfc));var _0x523c=function(_0x5508f7,_0x1a8b25){_0x5508f7=_0x5508f7-0x0;var _0x815f38=_0x23c5[_0x5508f7];return _0x815f38;};'use strict';var utils=require(_0x523c('0x0'));function QueueCallerAbandon(_0x49cbec,_0x2c5a8b){this[_0x523c('0x1')]=_0x49cbec[_0x523c('0x1')];this[_0x523c('0x2')]=_0x49cbec[_0x523c('0x2')];this[_0x523c('0x3')]=_0x49cbec[_0x523c('0x2')]==='outbound'?_0x523c('0x4'):_0x49cbec[_0x523c('0x2')];this[_0x523c('0x5')]=_0x49cbec['countbusyretry'];this[_0x523c('0x6')]=_0x49cbec[_0x523c('0x6')];this[_0x523c('0x7')]=_0x49cbec[_0x523c('0x7')];this[_0x523c('0x8')]=_0x49cbec[_0x523c('0x5')]+_0x49cbec[_0x523c('0x6')]+_0x49cbec[_0x523c('0x7')]+_0x49cbec[_0x523c('0x9')]+_0x49cbec[_0x523c('0xa')]+_0x49cbec[_0x523c('0xb')]+_0x49cbec['countmachineretry']+_0x49cbec[_0x523c('0xc')];this[_0x523c('0x9')]=_0x49cbec[_0x523c('0x9')];this[_0x523c('0xa')]=_0x49cbec['countdropretry'];this['countabandonedretry']=_0x49cbec[_0x523c('0xb')];this['countmachineretry']=_0x49cbec[_0x523c('0xd')];this[_0x523c('0xc')]=_0x49cbec[_0x523c('0xc')];this['uniqueid']=_0x2c5a8b[_0x523c('0xe')];this[_0x523c('0xf')]=_0x49cbec[_0x523c('0x10')];this[_0x523c('0x11')]=_0x49cbec[_0x523c('0x12')];this[_0x523c('0x13')]=_0x49cbec['starttime'];this[_0x523c('0x14')]=_0x49cbec['responsetime'];this['droptime']=_0x49cbec['droptime'];this[_0x523c('0x15')]=_0x49cbec[_0x523c('0x15')];this['endtime']=this[_0x523c('0x16')];this[_0x523c('0x17')]=utils[_0x523c('0x18')](_0x49cbec[_0x523c('0x14')],_0x49cbec['starttime']);this[_0x523c('0x19')]=utils['getSeconds'](this[_0x523c('0x16')],_0x49cbec[_0x523c('0x14')]);this[_0x523c('0x1a')]=0x0;this[_0x523c('0x4')]=_0x2c5a8b['queue'];this['membername']=_0x2c5a8b[_0x523c('0x1b')];this[_0x523c('0x1c')]=_0x2c5a8b[_0x523c('0x1c')];this[_0x523c('0x1d')]=_0x49cbec[_0x523c('0x1d')];this[_0x523c('0x1e')]=_0x49cbec[_0x523c('0x1e')];this['callbackat']=_0x49cbec[_0x523c('0x1f')];this['recallme']=_0x49cbec[_0x523c('0x20')];this[_0x523c('0x21')]=_0x49cbec[_0x523c('0x21')];this[_0x523c('0x22')]=_0x49cbec[_0x523c('0x22')];this[_0x523c('0x23')]=_0x49cbec['UserId'];this[_0x523c('0x24')]=_0x49cbec['VoiceQueueId'];this[_0x523c('0x25')]=_0x49cbec[_0x523c('0x25')];this[_0x523c('0x26')]=_0x49cbec[_0x523c('0x26')]||'';this['originatecalleridname']=_0x49cbec['originatecalleridname']||'';this['agiafterat']=_0x49cbec[_0x523c('0x27')];this[_0x523c('0x28')]=_0x49cbec[_0x523c('0x28')];this[_0x523c('0x29')]=_0x49cbec[_0x523c('0x29')];}module[_0x523c('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 891a0d6..1d5b636 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27a0=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0x2ad510,_0x2f2757){var _0x3d9c99=function(_0x1b0d90){while(--_0x1b0d90){_0x2ad510['push'](_0x2ad510['shift']());}};_0x3d9c99(++_0x2f2757);}(_0x27a0,0xbf));var _0x027a=function(_0x39573f,_0x2126b2){_0x39573f=_0x39573f-0x0;var _0x21f15f=_0x27a0[_0x39573f];return _0x21f15f;};'use strict';var util=require('util');var logger=require(_0x027a('0x0'))(_0x027a('0x1'));var cmHopper=require(_0x027a('0x2'));var cmHopperAdditionalPhone=require(_0x027a('0x3'));var cmHopperBlack=require(_0x027a('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x58a58b){return util['inspect'](_0x58a58b,{'showHidden':![],'depth':null});}function getContactDialer(_0x47cd65,_0x30a54d,_0x2a409a){return cmHopper[_0x027a('0x5')](_0x47cd65['id'],_0x30a54d,_0x2a409a,_0x47cd65[_0x027a('0x6')])[_0x027a('0x7')](function(_0x3c7d67){_0x47cd65['temp']=0x0;logger[_0x027a('0x8')](_0x027a('0x9'),inspectError(_0x3c7d67));});}exports[_0x027a('0x5')]=getContactDialer;function getContactDialerIvr(_0x4ccee2,_0x44c56a){return cmHopper[_0x027a('0xa')](_0x4ccee2['id'],_0x44c56a,_0x4ccee2[_0x027a('0x6')])['catch'](function(_0x6d5b04){_0x4ccee2[_0x027a('0xb')]=0x0;logger[_0x027a('0x8')](_0x027a('0xc'),inspectError(_0x6d5b04));});}exports[_0x027a('0xa')]=getContactDialerIvr;function countReScheduled(_0x267afc){return cmHopper[_0x027a('0xd')](_0x267afc)[_0x027a('0x7')](function(_0x351d7e){logger[_0x027a('0x8')](_0x027a('0xe'),inspectError(_0x351d7e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0xe64d3a){return cmHopper[_0x027a('0xf')](_0xe64d3a)[_0x027a('0x7')](function(_0x21da53){logger[_0x027a('0x8')]('[rescheduleContact]',inspectError(_0x21da53));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x1d680d,_0x5cfc6d,_0x2b3870){return cmHopper['unlockContact'](_0x1d680d,_0x5cfc6d,_0x2b3870)[_0x027a('0x7')](function(_0x5a1224){logger['error']('[unlockContact]',inspectError(_0x5a1224));});}exports[_0x027a('0x10')]=unlockContact;function moveContactManagedDialer(_0x2f04e9){return cmHopper[_0x027a('0x11')](_0x2f04e9)[_0x027a('0x7')](function(_0x52125e){logger[_0x027a('0x8')](_0x027a('0x12'),inspectError(_0x52125e));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x4f8c3d){return cmHopperBlack[_0x027a('0x13')](_0x4f8c3d)['catch'](function(_0x1d4a7a){logger['error']('[checkIsBlackList]',inspectError(_0x1d4a7a));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4b4f90){return cmHopperBlack[_0x027a('0x14')](_0x4b4f90)[_0x027a('0x7')](function(_0x266c9e){logger[_0x027a('0x8')]('[checkIsBlackListIvr]',inspectError(_0x266c9e));});}exports[_0x027a('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x119a5c,_0x20e2da,_0x3dee99){return cmHopperAdditionalPhone[_0x027a('0x15')](_0x119a5c,_0x20e2da,_0x3dee99)[_0x027a('0x7')](function(_0x595f0e){logger[_0x027a('0x8')]('[verifyAdditionalPhone]',inspectError(_0x595f0e));});}exports[_0x027a('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2e97c5,_0x1b1a13,_0x83fe3e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2e97c5,_0x1b1a13,_0x83fe3e)['catch'](function(_0x18458f){logger[_0x027a('0x8')](_0x027a('0x16'),inspectError(_0x18458f));});}exports[_0x027a('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x511c7a){return cmHopperHistory[_0x027a('0x18')](_0x511c7a)['catch'](function(_0x953887){logger['error'](_0x027a('0x19'),inspectError(_0x953887));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x578ea5){return cmHopperHistory[_0x027a('0x1a')](_0x578ea5)['catch'](function(_0x47a365){logger[_0x027a('0x8')]('[createHistory]',inspectError(_0x47a365));});}exports[_0x027a('0x1a')]=createHistory; \ No newline at end of file +var _0x4819=['[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','catch','rescheduleContact','[rescheduleContact]','unlockContact'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x4819,0xcd));var _0x9481=function(_0x4eb0b1,_0x1621ac){_0x4eb0b1=_0x4eb0b1-0x0;var _0x1b58bd=_0x4819[_0x4eb0b1];return _0x1b58bd;};'use strict';var util=require('util');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var cmHopper=require(_0x9481('0x2'));var cmHopperAdditionalPhone=require(_0x9481('0x3'));var cmHopperBlack=require(_0x9481('0x4'));var cmHopperHistory=require(_0x9481('0x5'));function inspectError(_0x40a703){return util[_0x9481('0x6')](_0x40a703,{'showHidden':![],'depth':null});}function getContactDialer(_0xc39edf,_0x16c617,_0x5ac51c){return cmHopper[_0x9481('0x7')](_0xc39edf['id'],_0x16c617,_0x5ac51c,_0xc39edf['dialOrderByScheduledAt'])['catch'](function(_0x14e05a){_0xc39edf[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xa'),inspectError(_0x14e05a));});}exports[_0x9481('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c7d9c,_0x1818cf){return cmHopper['getContactDialerIvr'](_0x4c7d9c['id'],_0x1818cf,_0x4c7d9c[_0x9481('0xb')])['catch'](function(_0x411d24){_0x4c7d9c[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xc'),inspectError(_0x411d24));});}exports[_0x9481('0xd')]=getContactDialerIvr;function countReScheduled(_0x29515a){return cmHopper[_0x9481('0xe')](_0x29515a)[_0x9481('0xf')](function(_0xed8e9){logger['error']('[countReScheduled]',inspectError(_0xed8e9));});}exports[_0x9481('0xe')]=countReScheduled;function rescheduleContact(_0x150276){return cmHopper[_0x9481('0x10')](_0x150276)[_0x9481('0xf')](function(_0x3d23c2){logger[_0x9481('0x9')](_0x9481('0x11'),inspectError(_0x3d23c2));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4220f1,_0x7a7ee,_0x5b1fe6){return cmHopper[_0x9481('0x12')](_0x4220f1,_0x7a7ee,_0x5b1fe6)['catch'](function(_0x34108d){logger[_0x9481('0x9')](_0x9481('0x13'),inspectError(_0x34108d));});}exports[_0x9481('0x12')]=unlockContact;function moveContactManagedDialer(_0x546fce){return cmHopper['moveContactManagedDialer'](_0x546fce)[_0x9481('0xf')](function(_0x50a559){logger['error'](_0x9481('0x14'),inspectError(_0x50a559));});}exports[_0x9481('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x18c6f5){return cmHopperBlack[_0x9481('0x16')](_0x18c6f5)[_0x9481('0xf')](function(_0x3dc33f){logger['error'](_0x9481('0x17'),inspectError(_0x3dc33f));});}exports[_0x9481('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x45f9df){return cmHopperBlack[_0x9481('0x18')](_0x45f9df)[_0x9481('0xf')](function(_0x56da97){logger[_0x9481('0x9')](_0x9481('0x19'),inspectError(_0x56da97));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bcf37,_0xd1cd1a,_0x352b3a){return cmHopperAdditionalPhone[_0x9481('0x1a')](_0x2bcf37,_0xd1cd1a,_0x352b3a)[_0x9481('0xf')](function(_0x49ecfa){logger[_0x9481('0x9')](_0x9481('0x1b'),inspectError(_0x49ecfa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x5eb4f5,_0x12b0c3,_0x299e28){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5eb4f5,_0x12b0c3,_0x299e28)[_0x9481('0xf')](function(_0x20ff9a){logger[_0x9481('0x9')](_0x9481('0x1c'),inspectError(_0x20ff9a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x14f03e){return cmHopperHistory[_0x9481('0x1d')](_0x14f03e)[_0x9481('0xf')](function(_0x587706){logger[_0x9481('0x9')]('[avgHandleTime]',inspectError(_0x587706));});}exports[_0x9481('0x1d')]=avgHandleTime;function createHistory(_0xe153ab){return cmHopperHistory[_0x9481('0x1e')](_0xe153ab)[_0x9481('0xf')](function(_0x2e5e63){logger['error'](_0x9481('0x1f'),inspectError(_0x2e5e63));});}exports[_0x9481('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 22c5162..61c8287 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e09=['status','TrunkBackup','INACTIVE','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','toUpperCase','toString','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','includes'];(function(_0x3afa16,_0x3320be){var _0x5e2a4a=function(_0x5c122f){while(--_0x5c122f){_0x3afa16['push'](_0x3afa16['shift']());}};_0x5e2a4a(++_0x3320be);}(_0x2e09,0x6f));var _0x92e0=function(_0x19980b,_0x23bf9d){_0x19980b=_0x19980b-0x0;var _0x83817d=_0x2e09[_0x19980b];return _0x83817d;};'use strict';var _=require(_0x92e0('0x0'));var moment=require(_0x92e0('0x1'));var util=require(_0x92e0('0x2'));var logger=require(_0x92e0('0x3'))('dialer');var timezones=require(_0x92e0('0x4'))[_0x92e0('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x92e0('0x6'),'BLACKLIST':_0x92e0('0x7'),'CONTACTS_RESCHEDULED':_0x92e0('0x8'),'DEACTIVATED':_0x92e0('0x9'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x92e0('0xa'),'INACTIVE':_0x92e0('0xb'),'NO_AGENTS_LOGGED':_0x92e0('0xc'),'NO_AVAILABLE_CONTACTS':_0x92e0('0xd'),'NULL_INTERVAL':_0x92e0('0xe'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x92e0('0xf'),'QUEUE_RECALL':_0x92e0('0x10'),'RECALL_TIMEOUT':_0x92e0('0x11'),'RUNNING':_0x92e0('0x12'),'UNKNOWN_TIMEZONE':_0x92e0('0x13'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x92e0('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3d32c3){return _0x3d32c3[_0x92e0('0x15')]===_0x92e0('0x16');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x506aaf){return _0x506aaf[_0x92e0('0x17')]===_0x92e0('0x18');}exports[_0x92e0('0x19')]=isIVRCampaign;function isOutboundQueue(_0x72d4bf){return _0x72d4bf[_0x92e0('0x17')]===_0x92e0('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x542d48){return _0x542d48[_0x92e0('0x1b')];}exports[_0x92e0('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4ab0a6){return _0x4ab0a6[_0x92e0('0x1d')];}exports[_0x92e0('0x1e')]=isIVRCampaignActive;function getSeconds(_0x1c128d,_0x12c9f7){var _0x219c14=moment(_0x1c128d)[_0x92e0('0x1f')](0x0);var _0x20bead=moment(_0x12c9f7)['milliseconds'](0x0);return _0x219c14[_0x92e0('0x20')](_0x20bead,_0x92e0('0x21'));}exports[_0x92e0('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0x2fb000,_0x4ffea5){var _0x58ec89=![];var _0x3bb937=_0x2fb000[_0x92e0('0x15')]!==_0x4ffea5[_0x92e0('0x15')]||_0x2fb000[_0x92e0('0x1b')]!==_0x4ffea5[_0x92e0('0x1b')]||_0x2fb000['message']!==_0x4ffea5[_0x92e0('0x23')];var _0x47a822=_0x2fb000[_0x92e0('0x24')]!==_0x4ffea5[_0x92e0('0x24')]||_0x2fb000['loggedIn']!==_0x4ffea5[_0x92e0('0x25')]||_0x2fb000[_0x92e0('0x26')]!==_0x4ffea5[_0x92e0('0x26')]||_0x2fb000[_0x92e0('0x27')]!==_0x4ffea5['paused']||_0x2fb000[_0x92e0('0x28')]!==_0x4ffea5[_0x92e0('0x28')]||_0x2fb000[_0x92e0('0x29')]!==_0x4ffea5[_0x92e0('0x29')]||_0x2fb000[_0x92e0('0x2a')]!==_0x4ffea5['waiting']||_0x2fb000[_0x92e0('0x2b')]!==_0x4ffea5[_0x92e0('0x2b')]||_0x2fb000[_0x92e0('0x2c')]!==_0x4ffea5[_0x92e0('0x2c')];if(_0x2fb000[_0x92e0('0x2d')]&&_0x4ffea5[_0x92e0('0x2d')]){_0x58ec89=_0x2fb000['Trunk']['name']!==_0x4ffea5[_0x92e0('0x2d')][_0x92e0('0x2e')]||_0x2fb000[_0x92e0('0x2d')][_0x92e0('0x1d')]!==_0x4ffea5[_0x92e0('0x2d')][_0x92e0('0x1d')];}return _0x3bb937||_0x47a822||_0x58ec89;}exports[_0x92e0('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xe37ef9){var _0x262340=null;var _0x37f66c=_0xe37ef9[_0x92e0('0x30')];if(_[_0x92e0('0x31')](_0xe37ef9['dialGlobalInterval'])||_['isNil'](_0xe37ef9[_0x92e0('0x32')])||_[_0x92e0('0x31')](_0xe37ef9[_0x92e0('0x32')][_0x92e0('0x33')])){_0x262340=CAMPAIGN_STATUS[_0x92e0('0x34')];}else if(_['isEmpty'](_0xe37ef9[_0x92e0('0x35')])||_['isEmpty'](_0xe37ef9['Interval']['Intervals'])){_0x262340=CAMPAIGN_STATUS[_0x92e0('0x36')];}else if(_0x37f66c&&!timezones[_0x37f66c]){_0x262340=CAMPAIGN_STATUS[_0x92e0('0x37')];}return _0x262340;}function checkAnyValidTrunk(_0x236ca8,_0x416ec0){var _0x2a5d68=null;var _0x42390a='SIP/';var _0x58cea8=['reachable','unmonitored'];var _0x595b25=!![];if(_0x236ca8['Trunk']&&_0x236ca8[_0x92e0('0x2d')]['active']){_0x42390a+=_0x236ca8['Trunk'][_0x92e0('0x2e')];_0x2a5d68=_0x416ec0[_0x42390a];_0x595b25=_0x58cea8[_0x92e0('0x38')](_0x2a5d68[_0x92e0('0x39')]);}else if(_0x236ca8[_0x92e0('0x3a')]&&_0x236ca8[_0x92e0('0x3a')][_0x92e0('0x1d')]){_0x42390a+=_0x236ca8[_0x92e0('0x3a')][_0x92e0('0x2e')];_0x2a5d68=_0x416ec0[_0x42390a];_0x595b25=_0x58cea8[_0x92e0('0x38')](_0x2a5d68[_0x92e0('0x39')]);}return _0x595b25;}function getQueueCampaignStatusMessage(_0x3094cc,_0x4b430f){var _0x36792b=CAMPAIGN_STATUS[_0x92e0('0x6')];var _0x35ccb4=isPreviewCampaign(_0x3094cc);if(!isQueueCampaignActive(_0x3094cc)){if(_0x35ccb4){_0x36792b=CAMPAIGN_STATUS[_0x92e0('0x3b')];}else{if(_0x3094cc[_0x92e0('0x2c')]===0x0&&_0x3094cc['talking']===0x0&&_0x3094cc['waiting']===0x0&&(_0x3094cc[_0x92e0('0x29')]||0x0)===0x0){_0x36792b=CAMPAIGN_STATUS[_0x92e0('0x3b')];}else{_0x36792b=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x3094cc[_0x92e0('0x25')]===0x0){_0x36792b=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x3094cc,_0x4b430f)){_0x36792b=CAMPAIGN_STATUS[_0x92e0('0x3c')];}else if(!isPreviewCampaign(_0x3094cc)){var _0x52e684=checkAnyValidQueueCampaignInterval(_0x3094cc);if(_0x52e684){_0x36792b=_0x52e684;}}return _0x36792b;}exports[_0x92e0('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x12b3ca){var _0x780788=CAMPAIGN_STATUS['DISACTIVED'];if(_0x12b3ca[_0x92e0('0x2c')]===0x0&&_0x12b3ca[_0x92e0('0x28')]===0x0&&_0x12b3ca[_0x92e0('0x2a')]===0x0&&(_0x12b3ca[_0x92e0('0x29')]||0x0)===0x0){_0x780788=CAMPAIGN_STATUS[_0x92e0('0x3b')];}return _0x780788;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5877ab){var _0xcdeac4=_0x5877ab['match'](/"(.*?)"/);return _0xcdeac4?_0xcdeac4[0x1]:_0x5877ab;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x430ca4,_0x5360a4,_0x300967){if(!_[_0x92e0('0x3e')](_0x300967)&&typeof _0x300967===_0x92e0('0x3f')&&!_[_0x92e0('0x40')](_0x300967)){if(!_[_0x92e0('0x3e')](_0x5360a4)&&typeof _0x5360a4==='string'&&!_[_0x92e0('0x40')](_0x5360a4)){return util[_0x92e0('0x41')](_0x92e0('0x42'),_0x5360a4,_0x300967);}return util[_0x92e0('0x41')](_0x92e0('0x42'),_0x300967,_0x300967);}if(!_[_0x92e0('0x3e')](_0x430ca4)&&typeof _0x430ca4==='string'&&!_[_0x92e0('0x40')](_0x430ca4)){return _0x430ca4;}return'\x22\x22\x20<>';}exports[_0x92e0('0x43')]=getCallerId;function getCallerIdRandom(_0x19d8d9,_0xc36ea0){var _0x37c0a5;var _0x18e82a;var _0x39e0b3;if(_0xc36ea0<=0x0){_0xc36ea0=0x1;}_0x37c0a5=new RegExp(_0x92e0('0x44')+_0xc36ea0+'}$');_0x18e82a=Math['pow'](0xa,_0xc36ea0-0x1);_0x39e0b3=Math[_0x92e0('0x45')](0xa,_0xc36ea0)-0x1;return util[_0x92e0('0x41')]('%s',_[_0x92e0('0x46')](_0x19d8d9,_0x37c0a5,_[_0x92e0('0x47')](_0x18e82a,_0x39e0b3)['toString']()));}exports[_0x92e0('0x48')]=getCallerIdRandom;function decrementOriginate(_0x269c0b){if(_0x269c0b[_0x92e0('0x2c')]&&_0x269c0b[_0x92e0('0x2c')]>0x0){_0x269c0b[_0x92e0('0x2c')]-=0x1;}else{logger[_0x92e0('0x49')](_0x92e0('0x4a'));}}exports[_0x92e0('0x4b')]=decrementOriginate;function checkContactEmpty(_0xaa1532){return _0xaa1532&&_0xaa1532[_0x92e0('0x4c')]>0x0;}exports[_0x92e0('0x4d')]=checkContactEmpty;function erlangb(_0x37bf7b,_0x3b4cb0){if(_0x3b4cb0===0x0){return 0x0;}var _0x1cc961=0x1;for(var _0x2941b3=0x1;_0x2941b3<=_0x3b4cb0;_0x2941b3+=0x1){_0x1cc961=0x1+_0x1cc961*_0x2941b3/_0x37bf7b;}return 0x1/_0x1cc961;}exports[_0x92e0('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x5c3374,_0x460c89,_0x4cde51){if(_0x460c89>_0x4cde51){for(var _0x90b4b4=0x0;_0x90b4b4<_0x460c89-_0x4cde51;_0x90b4b4+=0x1){decrementOriginate(_0x5c3374);}}}exports[_0x92e0('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3bd43d){var _0x38d501={};var _0x349b93=['id',_0x92e0('0x50'),_0x92e0('0x51'),'updatedAt'];const _0x4e9fce=0xfa;if(_0x3bd43d){for(var _0x444122 in _0x3bd43d){if(typeof _0x3bd43d[_0x444122]!=='undefined'){if(!_['isNil'](_0x3bd43d[_0x444122])&&!_0x349b93[_0x92e0('0x38')](_0x444122)){if(_0x444122==='description'&&_0x3bd43d[_0x444122][_0x92e0('0x4c')]>_0x4e9fce){_0x38d501['XMD-'+_0x444122[_0x92e0('0x52')]()]=_0x3bd43d[_0x444122][_0x92e0('0x53')]()['substring'](0x0,_0x4e9fce);}else{_0x38d501['XMD-'+_0x444122[_0x92e0('0x52')]()]=_0x3bd43d[_0x444122];}}}}}return _0x38d501;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0xd78a=['loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','unmonitored','status','TrunkBackup','includes','INACTIVE','originated','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn'];(function(_0x414568,_0x38ea14){var _0x2bccba=function(_0x28e773){while(--_0x28e773){_0x414568['push'](_0x414568['shift']());}};_0x2bccba(++_0x38ea14);}(_0xd78a,0x13d));var _0xad78=function(_0x4b92cd,_0x382484){_0x4b92cd=_0x4b92cd-0x0;var _0x264e66=_0xd78a[_0x4b92cd];return _0x264e66;};'use strict';var _=require(_0xad78('0x0'));var moment=require(_0xad78('0x1'));var util=require(_0xad78('0x2'));var logger=require(_0xad78('0x3'))('dialer');var timezones=require(_0xad78('0x4'))[_0xad78('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xad78('0x6'),'BLACKLIST':_0xad78('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xad78('0x8'),'DISACTIVED':_0xad78('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xad78('0xa'),'NO_AGENTS_LOGGED':_0xad78('0xb'),'NO_AVAILABLE_CONTACTS':_0xad78('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xad78('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xad78('0xe'),'QUEUE_RECALL':_0xad78('0xf'),'RECALL_TIMEOUT':_0xad78('0x10'),'RUNNING':_0xad78('0x11'),'UNKNOWN_TIMEZONE':_0xad78('0x12'),'UNREACHABLE_TRUNK':_0xad78('0x13')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3f3e42){return _0x3f3e42[_0xad78('0x14')]==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x402650){return _0x402650[_0xad78('0x15')]===_0xad78('0x16');}exports[_0xad78('0x17')]=isIVRCampaign;function isOutboundQueue(_0x2d3265){return _0x2d3265[_0xad78('0x15')]==='outbound';}exports[_0xad78('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x3e7380){return _0x3e7380[_0xad78('0x19')];}exports[_0xad78('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5527c3){return _0x5527c3[_0xad78('0x1b')];}exports[_0xad78('0x1c')]=isIVRCampaignActive;function getSeconds(_0x235275,_0x5dcc47){var _0x3c8ef3=moment(_0x235275)['milliseconds'](0x0);var _0x1ceca8=moment(_0x5dcc47)[_0xad78('0x1d')](0x0);return _0x3c8ef3[_0xad78('0x1e')](_0x1ceca8,'seconds');}exports[_0xad78('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x53ad7b,_0xe2f554){var _0x3a2526=![];var _0x5b8c4b=_0x53ad7b[_0xad78('0x14')]!==_0xe2f554[_0xad78('0x14')]||_0x53ad7b['dialActive']!==_0xe2f554[_0xad78('0x19')]||_0x53ad7b[_0xad78('0x20')]!==_0xe2f554[_0xad78('0x20')];var _0x275191=_0x53ad7b[_0xad78('0x21')]!==_0xe2f554[_0xad78('0x21')]||_0x53ad7b[_0xad78('0x22')]!==_0xe2f554[_0xad78('0x22')]||_0x53ad7b[_0xad78('0x23')]!==_0xe2f554[_0xad78('0x23')]||_0x53ad7b[_0xad78('0x24')]!==_0xe2f554[_0xad78('0x24')]||_0x53ad7b[_0xad78('0x25')]!==_0xe2f554[_0xad78('0x25')]||_0x53ad7b['pTalking']!==_0xe2f554[_0xad78('0x26')]||_0x53ad7b[_0xad78('0x27')]!==_0xe2f554[_0xad78('0x27')]||_0x53ad7b[_0xad78('0x28')]!==_0xe2f554[_0xad78('0x28')]||_0x53ad7b['originated']!==_0xe2f554['originated'];if(_0x53ad7b[_0xad78('0x29')]&&_0xe2f554[_0xad78('0x29')]){_0x3a2526=_0x53ad7b['Trunk']['name']!==_0xe2f554[_0xad78('0x29')][_0xad78('0x2a')]||_0x53ad7b['Trunk'][_0xad78('0x1b')]!==_0xe2f554[_0xad78('0x29')]['active'];}return _0x5b8c4b||_0x275191||_0x3a2526;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1e2cc8){var _0x5c69a3=null;var _0x30f196=_0x1e2cc8[_0xad78('0x2b')];if(_[_0xad78('0x2c')](_0x1e2cc8[_0xad78('0x2d')])||_['isNil'](_0x1e2cc8[_0xad78('0x2e')])||_[_0xad78('0x2c')](_0x1e2cc8[_0xad78('0x2e')][_0xad78('0x2f')])){_0x5c69a3=CAMPAIGN_STATUS[_0xad78('0x30')];}else if(_[_0xad78('0x31')](_0x1e2cc8[_0xad78('0x2d')])||_['isEmpty'](_0x1e2cc8[_0xad78('0x2e')][_0xad78('0x2f')])){_0x5c69a3=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x30f196&&!timezones[_0x30f196]){_0x5c69a3=CAMPAIGN_STATUS[_0xad78('0x32')];}return _0x5c69a3;}function checkAnyValidTrunk(_0x25885f,_0x428657){var _0x4710cf=null;var _0xb5676c='SIP/';var _0xaf48ed=['reachable',_0xad78('0x33')];var _0x53053a=!![];if(_0x25885f[_0xad78('0x29')]&&_0x25885f[_0xad78('0x29')][_0xad78('0x1b')]){_0xb5676c+=_0x25885f[_0xad78('0x29')][_0xad78('0x2a')];_0x4710cf=_0x428657[_0xb5676c];_0x53053a=_0xaf48ed['includes'](_0x4710cf[_0xad78('0x34')]);}else if(_0x25885f[_0xad78('0x35')]&&_0x25885f[_0xad78('0x35')][_0xad78('0x1b')]){_0xb5676c+=_0x25885f[_0xad78('0x35')][_0xad78('0x2a')];_0x4710cf=_0x428657[_0xb5676c];_0x53053a=_0xaf48ed[_0xad78('0x36')](_0x4710cf['status']);}return _0x53053a;}function getQueueCampaignStatusMessage(_0x51d8af,_0x49a7f7){var _0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x6')];var _0x410d0f=isPreviewCampaign(_0x51d8af);if(!isQueueCampaignActive(_0x51d8af)){if(_0x410d0f){_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x37')];}else{if(_0x51d8af[_0xad78('0x38')]===0x0&&_0x51d8af[_0xad78('0x25')]===0x0&&_0x51d8af[_0xad78('0x27')]===0x0&&(_0x51d8af[_0xad78('0x26')]||0x0)===0x0){_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x37')];}else{_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x39')];}}}else if(_0x51d8af['loggedIn']===0x0){_0x4d72fe=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x51d8af,_0x49a7f7)){_0x4d72fe=CAMPAIGN_STATUS[_0xad78('0x3a')];}else if(!isPreviewCampaign(_0x51d8af)){var _0x5a5b3e=checkAnyValidQueueCampaignInterval(_0x51d8af);if(_0x5a5b3e){_0x4d72fe=_0x5a5b3e;}}return _0x4d72fe;}exports[_0xad78('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1250d5){var _0x4242c1=CAMPAIGN_STATUS[_0xad78('0x39')];if(_0x1250d5['originated']===0x0&&_0x1250d5[_0xad78('0x25')]===0x0&&_0x1250d5[_0xad78('0x27')]===0x0&&(_0x1250d5[_0xad78('0x26')]||0x0)===0x0){_0x4242c1=CAMPAIGN_STATUS[_0xad78('0x37')];}return _0x4242c1;}exports[_0xad78('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x43ba29){var _0x542896=_0x43ba29[_0xad78('0x3d')](/"(.*?)"/);return _0x542896?_0x542896[0x1]:_0x43ba29;}exports[_0xad78('0x3e')]=extractCalleridName;function getCallerId(_0x1710da,_0x532368,_0x421691){if(!_[_0xad78('0x3f')](_0x421691)&&typeof _0x421691===_0xad78('0x40')&&!_[_0xad78('0x31')](_0x421691)){if(!_[_0xad78('0x3f')](_0x532368)&&typeof _0x532368==='string'&&!_[_0xad78('0x31')](_0x532368)){return util[_0xad78('0x41')](_0xad78('0x42'),_0x532368,_0x421691);}return util[_0xad78('0x41')](_0xad78('0x42'),_0x421691,_0x421691);}if(!_[_0xad78('0x3f')](_0x1710da)&&typeof _0x1710da===_0xad78('0x40')&&!_[_0xad78('0x31')](_0x1710da)){return _0x1710da;}return _0xad78('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x56b3a9,_0x97f62a){var _0x4f1915;var _0x1352b6;var _0x457574;if(_0x97f62a<=0x0){_0x97f62a=0x1;}_0x4f1915=new RegExp(_0xad78('0x44')+_0x97f62a+'}$');_0x1352b6=Math['pow'](0xa,_0x97f62a-0x1);_0x457574=Math[_0xad78('0x45')](0xa,_0x97f62a)-0x1;return util['format']('%s',_['replace'](_0x56b3a9,_0x4f1915,_[_0xad78('0x46')](_0x1352b6,_0x457574)[_0xad78('0x47')]()));}exports[_0xad78('0x48')]=getCallerIdRandom;function decrementOriginate(_0x14012d){if(_0x14012d[_0xad78('0x38')]&&_0x14012d[_0xad78('0x38')]>0x0){_0x14012d[_0xad78('0x38')]-=0x1;}else{logger[_0xad78('0x49')](_0xad78('0x4a'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x57beec){return _0x57beec&&_0x57beec[_0xad78('0x4b')]>0x0;}exports[_0xad78('0x4c')]=checkContactEmpty;function erlangb(_0x3a646b,_0x32de18){if(_0x32de18===0x0){return 0x0;}var _0x1e96ad=0x1;for(var _0x116b85=0x1;_0x116b85<=_0x32de18;_0x116b85+=0x1){_0x1e96ad=0x1+_0x1e96ad*_0x116b85/_0x3a646b;}return 0x1/_0x1e96ad;}exports[_0xad78('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x42dc45,_0x1389fd,_0x5e2e21){if(_0x1389fd>_0x5e2e21){for(var _0x5f29e2=0x0;_0x5f29e2<_0x1389fd-_0x5e2e21;_0x5f29e2+=0x1){decrementOriginate(_0x42dc45);}}}exports[_0xad78('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x495096){var _0x7c904e={};var _0x1a74fc=['id',_0xad78('0x4f'),_0xad78('0x50'),_0xad78('0x51')];const _0x3266e7=0xfa;if(_0x495096){for(var _0x20c160 in _0x495096){if(typeof _0x495096[_0x20c160]!==_0xad78('0x52')){if(!_[_0xad78('0x2c')](_0x495096[_0x20c160])&&!_0x1a74fc[_0xad78('0x36')](_0x20c160)){if(_0x20c160===_0xad78('0x53')&&_0x495096[_0x20c160][_0xad78('0x4b')]>_0x3266e7){_0x7c904e[_0xad78('0x54')+_0x20c160[_0xad78('0x55')]()]=_0x495096[_0x20c160][_0xad78('0x47')]()[_0xad78('0x56')](0x0,_0x3266e7);}else{_0x7c904e[_0xad78('0x54')+_0x20c160['toUpperCase']()]=_0x495096[_0x20c160];}}}}}return _0x7c904e;}exports[_0xad78('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index c4f8e9d..e751682 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(_0x25c0fd,_0x545050){var _0x4a03f9=function(_0x13e4b7){while(--_0x13e4b7){_0x25c0fd['push'](_0x25c0fd['shift']());}};_0x4a03f9(++_0x545050);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0xd09f34,_0x13d8db){var _0x283d91=function(_0x519d53){while(--_0x519d53){_0xd09f34['push'](_0xd09f34['shift']());}};_0x283d91(++_0x13d8db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 0ebf5e0..88def32 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 _0x65b9=['faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','Trunk\x20Reachable','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','fax','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','prototype','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','calleridnum','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x65b9,0x179));var _0x965b=function(_0x1ed8d7,_0x17c89c){_0x1ed8d7=_0x1ed8d7-0x0;var _0x1c9f4e=_0x65b9[_0x1ed8d7];return _0x1c9f4e;};'use strict';var util=require(_0x965b('0x0'));var _=require('lodash');var BPromise=require(_0x965b('0x1'));var uuid=require(_0x965b('0x2'));var moment=require(_0x965b('0x3'));var path=require(_0x965b('0x4'));var tiff2pdf=require(_0x965b('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x965b('0x6'));var ami=require('../ami');var rpcDb=require(_0x965b('0x7'));var Channel=require('./channel');var ut=require(_0x965b('0x8'));var Action=require(_0x965b('0x9'));var faxAccount=require(_0x965b('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x965b('0xb'));function Fax(_0x423d89){this[_0x965b('0xc')]={};this[_0x965b('0xd')]=_0x423d89['faxAccounts'];this[_0x965b('0xe')]=_0x423d89[_0x965b('0xe')];this[_0x965b('0xf')]={};ami['on'](_0x965b('0x10'),this[_0x965b('0x11')][_0x965b('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x965b('0x12')](this));ami['on'](_0x965b('0x13'),this[_0x965b('0x14')][_0x965b('0x12')](this));ami['on']('newexten',this[_0x965b('0x15')][_0x965b('0x12')](this));ami['on']('faxstatus',this[_0x965b('0x16')][_0x965b('0x12')](this));ami['on'](_0x965b('0x17'),this[_0x965b('0x18')][_0x965b('0x12')](this));ami['on']('hangup',this['syncHangup'][_0x965b('0x12')](this));ami['on'](_0x965b('0x19'),this[_0x965b('0x1a')]['bind'](this));}Fax['prototype'][_0x965b('0x11')]=function(_0x40827f){if(_0x40827f[_0x965b('0x1b')]===_0x965b('0x1c')){for(var _0xa53cfb in this[_0x965b('0xd')]){if(this[_0x965b('0xd')][_0x965b('0x1d')](_0xa53cfb)){if(_0x40827f[_0x965b('0x1e')]===this[_0x965b('0xd')][_0xa53cfb][_0x965b('0x1f')]){this['channels'][_0x40827f[_0x965b('0x20')]]={};this[_0x965b('0xc')][_0x40827f['uniqueid']][_0x965b('0x21')]=_0x40827f[_0x965b('0x21')];this[_0x965b('0xc')][_0x40827f[_0x965b('0x20')]]['id']=this[_0x965b('0xd')][_0xa53cfb]['id'];this[_0x965b('0xc')][_0x40827f[_0x965b('0x20')]][_0x965b('0x22')]=this['faxAccounts'][_0xa53cfb][_0x965b('0x22')];logger[_0x965b('0x23')](_0x40827f['uniqueid'],_0x965b('0x24'));}}}}if(this[_0x965b('0xf')][_0x40827f[_0x965b('0x20')]]){this[_0x965b('0xc')][_0x40827f[_0x965b('0x20')]]={};this[_0x965b('0xc')][_0x40827f[_0x965b('0x20')]][_0x965b('0x21')]=_0x40827f[_0x965b('0x21')];logger[_0x965b('0x23')](_0x40827f['uniqueid'],_0x965b('0x24'));}};Fax['prototype'][_0x965b('0x25')]=function(_0x57b7bb){if(this[_0x965b('0xc')][_0x57b7bb[_0x965b('0x20')]]){for(var _0x31576a in _0x57b7bb[_0x965b('0x26')]){if(_0x57b7bb['variable'][_0x965b('0x1d')](_0x31576a)){this[_0x965b('0xc')][_0x57b7bb['uniqueid']][_0x31576a]=_0x57b7bb[_0x965b('0x27')];}}}};Fax[_0x965b('0x28')][_0x965b('0x14')]=function(_0x1d6014){if(this[_0x965b('0xc')][_0x1d6014['uniqueid']]){this[_0x965b('0xc')][_0x1d6014[_0x965b('0x20')]][_0x965b('0x29')]=_0x1d6014[_0x965b('0x29')];this['channels'][_0x1d6014[_0x965b('0x20')]]['channelstatedesc']=_0x1d6014[_0x965b('0x2a')];}};Fax[_0x965b('0x28')][_0x965b('0x15')]=function(_0x79b661){if(this[_0x965b('0xc')][_0x79b661[_0x965b('0x20')]]){for(var _0x2d2e2d in _0x79b661[_0x965b('0x26')]){if(_0x79b661[_0x965b('0x26')][_0x965b('0x1d')](_0x2d2e2d)){this[_0x965b('0xc')][_0x79b661[_0x965b('0x20')]][_0x2d2e2d]=_0x79b661[_0x965b('0x27')];}}}};Fax[_0x965b('0x28')][_0x965b('0x16')]=function(_0x9aa4e6){if(this[_0x965b('0xc')][_0x9aa4e6['uniqueid']]){this[_0x965b('0xc')][_0x9aa4e6[_0x965b('0x20')]]['operation']=_0x9aa4e6[_0x965b('0x2b')];this[_0x965b('0xc')][_0x9aa4e6[_0x965b('0x20')]][_0x965b('0x2c')]=_0x9aa4e6[_0x965b('0x2c')];this['channels'][_0x9aa4e6[_0x965b('0x20')]][_0x965b('0x1f')]=_0x9aa4e6[_0x965b('0x1f')];this[_0x965b('0xc')][_0x9aa4e6['uniqueid']]['filename']=_0x9aa4e6[_0x965b('0x2d')];logger[_0x965b('0x23')](_0x9aa4e6[_0x965b('0x20')],_0x965b('0x2e'));}};Fax[_0x965b('0x28')]['syncReceiveFax']=function(_0xb56657){var _0x38c842=this;if(this[_0x965b('0xc')][_0xb56657['uniqueid']]){var _0x1f68cd=this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]]['id'];this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]][_0x965b('0x2f')]=_0xb56657[_0x965b('0x2f')];this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]][_0x965b('0x30')]=_0xb56657[_0x965b('0x30')];this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]]['localstationid']=_0xb56657[_0x965b('0x1f')];this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]][_0x965b('0x31')]=_0xb56657[_0x965b('0x31')];this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]][_0x965b('0x32')]=_0xb56657[_0x965b('0x32')];this[_0x965b('0xc')][_0xb56657['uniqueid']][_0x965b('0x2d')]=_0xb56657[_0x965b('0x2d')];this[_0x965b('0xc')][_0xb56657[_0x965b('0x20')]]['calleridnum']=_0xb56657['calleridnum'];if(this[_0x965b('0xc')][_0xb56657['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0xb56657[_0x965b('0x2d')],_0x965b('0x33'),function(_0x20d9c6){logger[_0x965b('0x23')](_0xb56657[_0x965b('0x20')],'\x20result\x20conversion\x20file\x20',_0x20d9c6[_0x965b('0x34')]);attachment[_0x965b('0x35')]({'name':path['parse'](_0xb56657['filename'])[_0x965b('0x22')],'basename':path[_0x965b('0x36')](_0xb56657[_0x965b('0x2d')])[_0x965b('0x22')]+_0x965b('0x37'),'type':_0x965b('0x38')})[_0x965b('0x39')](function(_0x523e14){faxAccount['notify'](_0x1f68cd,{'from':_0xb56657[_0x965b('0x3a')],'mapKey':_0x965b('0x6'),'body':path[_0x965b('0x36')](_0xb56657[_0x965b('0x2d')])[_0x965b('0x22')]+_0x965b('0x37'),'AttachmentId':_0x523e14['id']})[_0x965b('0x3b')](function(_0x27683b){logger[_0x965b('0x3c')](_0xb56657[_0x965b('0x20')],'\x20notify\x20',JSON[_0x965b('0x3d')](_0x27683b));});})[_0x965b('0x3b')](function(_0x100525){logger[_0x965b('0x3c')](_0xb56657[_0x965b('0x20')],_0x965b('0x3e'),JSON[_0x965b('0x3d')](_0x100525));});});}logger[_0x965b('0x23')](_0xb56657[_0x965b('0x20')],_0x965b('0x3e'));}};Fax[_0x965b('0x28')][_0x965b('0x1a')]=function(_0x453118){if(this[_0x965b('0xf')][_0x453118[_0x965b('0x20')]]){_[_0x965b('0x3f')](this[_0x965b('0xc')][_0x453118['uniqueid']],_[_0x965b('0x40')](_0x453118,[_0x965b('0x41'),_0x965b('0x42')]));}};function updateStatus(_0x7d7a3b){if(_0x7d7a3b['AttachmentId']){faxMessage[_0x965b('0x43')](_0x7d7a3b['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x965b('0x39')](function(_0x269099){ut[_0x965b('0x44')]('[Fax][Message][Error][Updated]',_0x269099);})['catch'](function(_0xbbca50){ut['logger'](_0x965b('0x45'),_0xbbca50);});}else{ut['logger'](_0x965b('0x46'));}}Fax[_0x965b('0x28')][_0x965b('0x47')]=function(_0x208eb3,_0x5ec97c,_0x10907d){var _0x544c33=this;var _0x255605={};if(_0x5ec97c){_0x255605={'read':_0x5ec97c};}else{_0x255605={'failMessage':_0x10907d};}if(this[_0x965b('0xf')][_0x208eb3][_0x965b('0x48')]){faxMessage['update'](this[_0x965b('0xf')][_0x208eb3][_0x965b('0x48')],_0x255605)[_0x965b('0x39')](function(_0x50a681){ut[_0x965b('0x44')]('[Fax][Message][Updated]',_0x50a681);})['catch'](function(_0x397d57){ut[_0x965b('0x44')]('[Fax][Message][NoUpdate1]',_0x397d57);})[_0x965b('0x49')](function(){delete _0x544c33[_0x965b('0xc')][_0x208eb3];delete _0x544c33['actions'][_0x208eb3];});}else{ut['logger'](_0x965b('0x4a'));this[_0x965b('0x4b')](_0x208eb3);delete this[_0x965b('0xf')][_0x208eb3];}};Fax[_0x965b('0x28')][_0x965b('0x4c')]=function(_0x4f45c3){var _0x2ecd23=this;if(this['channels'][_0x4f45c3['uniqueid']]){if(this[_0x965b('0xf')][_0x4f45c3[_0x965b('0x20')]]){this[_0x965b('0xc')][_0x4f45c3[_0x965b('0x20')]]['id']=this[_0x965b('0xf')][_0x4f45c3[_0x965b('0x20')]]['id'];this['channels'][_0x4f45c3[_0x965b('0x20')]]['name']=this[_0x965b('0xf')][_0x4f45c3[_0x965b('0x20')]]['name'];}logger['info'](_0x4f45c3[_0x965b('0x20')],this[_0x965b('0xf')][_0x4f45c3[_0x965b('0x20')]]?'\x20hangup\x20sendFile\x20':_0x965b('0x4d'),JSON[_0x965b('0x3d')](this[_0x965b('0xc')][_0x4f45c3[_0x965b('0x20')]]));if(this[_0x965b('0xf')][_0x4f45c3[_0x965b('0x20')]]){if(this[_0x965b('0xc')][_0x4f45c3[_0x965b('0x20')]][_0x965b('0x4e')]>0x0&&this['channels'][_0x4f45c3[_0x965b('0x20')]][_0x965b('0x4f')]===_0x965b('0x50')){this['updateStatus'](_0x4f45c3[_0x965b('0x20')],!![]);}else{this[_0x965b('0x47')](_0x4f45c3[_0x965b('0x20')],![],this[_0x965b('0xc')][_0x4f45c3[_0x965b('0x20')]][_0x965b('0x51')]?_0x965b('0x52')+this['channels'][_0x4f45c3[_0x965b('0x20')]][_0x965b('0x51')]:_0x965b('0x53'));}}}};Fax['prototype'][_0x965b('0x54')]=function(_0x77a0b6){var _0x2ff831=this;return new BPromise(function(_0xe8ef05,_0x3183ee){_0x2ff831[_0x965b('0x55')](_0x77a0b6,_0x2ff831[_0x965b('0xd')][_0x77a0b6[_0x965b('0x56')]])[_0x965b('0x39')](function(_0x3f0167){ut[_0x965b('0x44')](_0x965b('0x57'),_0x3f0167);_0xe8ef05(ut[_0x965b('0x34')](_0x965b('0x58')));})[_0x965b('0x3b')](function(_0x23bac1){ut[_0x965b('0x44')](_0x965b('0x59'),_0x23bac1);updateStatus(_0x77a0b6);_0x3183ee(ut['message'](_0x965b('0x5a')));});});};Fax[_0x965b('0x28')]['checkAfterSend']=function(_0x50c42d){var _0x7a16da=this;return new BPromise(function(_0x5e50c9,_0x373e66){var _0x1840f6=_0x7a16da[_0x965b('0x5b')](_0x7a16da['faxAccounts'][_0x50c42d[_0x965b('0x56')]][_0x965b('0x5c')],_0x50c42d);if(_0x1840f6['isValid']){_0x5e50c9(ut[_0x965b('0x34')](_0x965b('0x5d')));}else{_0x373e66(ut[_0x965b('0x34')](_0x1840f6[_0x965b('0x34')]));}});};function originate(_0x3effa6,_0x35f1ae,_0x2bebea){return new BPromise(function(_0x22fc57,_0x310f49){if(_0x2bebea){var _0x3d5363=util[_0x965b('0x5e')]('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[_0x965b('0x36')](_0x3effa6[_0x965b('0x4')])[_0x965b('0x22')],_0x3effa6[_0x965b('0x4')]);gs['execute'](_0x3d5363)[_0x965b('0x39')](function(){_0x3effa6[_0x965b('0x4')]=util[_0x965b('0x5e')](_0x965b('0x5f'),path[_0x965b('0x36')](_0x3effa6[_0x965b('0x4')])[_0x965b('0x60')],path[_0x965b('0x36')](_0x3effa6[_0x965b('0x4')])[_0x965b('0x22')]);_0x35f1ae['XMF-PATH']=_0x3effa6[_0x965b('0x4')];ut['logger'](_0x965b('0x61'),'');ami[_0x965b('0x62')](ut[_0x965b('0x63')](_0x3effa6,_0x35f1ae))[_0x965b('0x39')](function(_0x2ab259){_0x22fc57(_0x2ab259);})[_0x965b('0x3b')](function(_0x107c9d){_0x310f49(_0x107c9d);});})['catch'](function(_0x3ea58f){_0x310f49(_0x3ea58f);});}else{ami['Action'](ut['variablesAction'](_0x3effa6,_0x35f1ae))[_0x965b('0x39')](function(_0x27455b){_0x22fc57(_0x27455b);})[_0x965b('0x3b')](function(_0x4545f2){_0x310f49(_0x4545f2);});}});}Fax[_0x965b('0x28')][_0x965b('0x55')]=function(_0x1c8f9a,_0x4e32dd){var _0x11d07b=this;return new BPromise(function(_0x5f307f,_0x436d5d){var _0x373c6b=uuid['v4']();var _0x1e4373=ut['addVariables'](_0x1c8f9a,_0x4e32dd);_0x11d07b[_0x965b('0xf')][_0x373c6b]=new Action(_0x373c6b,_0x4e32dd,_0x1c8f9a);var _0x1ea75c=_0x11d07b[_0x965b('0xf')][_0x373c6b];if(path['parse'](_0x1c8f9a[_0x965b('0x4')])[_0x965b('0x64')]===_0x965b('0x37')){originate(_0x1ea75c,_0x1e4373,!![])[_0x965b('0x39')](function(_0x3fcb92){_0x5f307f(_0x3fcb92);})['catch'](function(_0x56e917){_0x436d5d(_0x56e917);});}else{originate(_0x1ea75c,_0x1e4373,![])[_0x965b('0x39')](function(_0x3c8e71){_0x5f307f(_0x3c8e71);})[_0x965b('0x3b')](function(_0x5ba94d){_0x436d5d(_0x5ba94d);});}});};Fax[_0x965b('0x28')][_0x965b('0x65')]=function(_0x2e9925){return!_['isNil'](_0x2e9925)&&!_[_0x965b('0x66')](_0x2e9925['name'])&&!_['isNil'](_0x2e9925[_0x965b('0x67')])&&_0x2e9925[_0x965b('0x67')]&&!_[_0x965b('0x66')](this[_0x965b('0xe')][util[_0x965b('0x5e')](_0x965b('0x68'),_0x2e9925['name'])])&&!_[_0x965b('0x66')](this[_0x965b('0xe')][util[_0x965b('0x5e')]('SIP/%s',_0x2e9925[_0x965b('0x22')])]['status'])&&(this['trunks'][util[_0x965b('0x5e')](_0x965b('0x68'),_0x2e9925[_0x965b('0x22')])]['status']===_0x965b('0x69')||this[_0x965b('0xe')][util[_0x965b('0x5e')]('SIP/%s',_0x2e9925[_0x965b('0x22')])]['status']==='unmonitored');};Fax[_0x965b('0x28')][_0x965b('0x5b')]=function(_0x303dfc,_0x339146){if(!this['isTrunkReachable'](_0x303dfc)){ut[_0x965b('0x44')](_0x965b('0x6a'),_[_0x965b('0x66')](_0x303dfc)?'':_0x303dfc[_0x965b('0x22')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x965b('0x6b')};}if(_[_0x965b('0x66')](_0x339146[_0x965b('0x6')])){ut[_0x965b('0x44')](_0x965b('0x6c'),JSON['stringify'](_0x339146));return{'isValid':![],'message':_0x965b('0x6d')};}if(_['isNil'](_0x339146[_0x965b('0x4')])){ut[_0x965b('0x44')](_0x965b('0x6e'),JSON[_0x965b('0x3d')](_0x339146));return{'isValid':![],'message':_0x965b('0x6f')};}return{'isValid':!![],'message':_0x965b('0x70')};};Fax[_0x965b('0x28')]['deleteChannelAfterTimeout']=function(_0x257b7e,_0xcfeb83=0x2710){if(this[_0x965b('0xc')][_0x257b7e]){setTimeout(()=>{delete this[_0x965b('0xc')][_0x257b7e];},_0xcfeb83);}};module[_0x965b('0x71')]=Fax; \ No newline at end of file +var _0x24ba=['newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate'];(function(_0x2d585b,_0x3ae9f6){var _0x4a8321=function(_0x1e0aaf){while(--_0x1e0aaf){_0x2d585b['push'](_0x2d585b['shift']());}};_0x4a8321(++_0x3ae9f6);}(_0x24ba,0x15b));var _0xa24b=function(_0x29057b,_0xefa313){_0x29057b=_0x29057b-0x0;var _0x4fc5c7=_0x24ba[_0x29057b];return _0x4fc5c7;};'use strict';var util=require(_0xa24b('0x0'));var _=require('lodash');var BPromise=require(_0xa24b('0x1'));var uuid=require('uuid');var moment=require(_0xa24b('0x2'));var path=require(_0xa24b('0x3'));var tiff2pdf=require(_0xa24b('0x4'));var gs=require(_0xa24b('0x5'));var logger=require(_0xa24b('0x6'))(_0xa24b('0x7'));var ami=require(_0xa24b('0x8'));var rpcDb=require(_0xa24b('0x9'));var Channel=require(_0xa24b('0xa'));var ut=require(_0xa24b('0xb'));var Action=require('./action');var faxAccount=require(_0xa24b('0xc'));var attachment=require(_0xa24b('0xd'));var faxMessage=require(_0xa24b('0xe'));function Fax(_0x533d85){this[_0xa24b('0xf')]={};this[_0xa24b('0x10')]=_0x533d85['faxAccounts'];this[_0xa24b('0x11')]=_0x533d85[_0xa24b('0x11')];this[_0xa24b('0x12')]={};ami['on'](_0xa24b('0x13'),this[_0xa24b('0x14')][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x16'),this[_0xa24b('0x17')][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x18'),this['syncNewState']['bind'](this));ami['on'](_0xa24b('0x19'),this[_0xa24b('0x1a')][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x1b'),this['syncFaxStatus'][_0xa24b('0x15')](this));ami['on'](_0xa24b('0x1c'),this[_0xa24b('0x1d')][_0xa24b('0x15')](this));ami['on']('hangup',this[_0xa24b('0x1e')]['bind'](this));ami['on'](_0xa24b('0x1f'),this['syncOriginateResponse'][_0xa24b('0x15')](this));}Fax[_0xa24b('0x20')][_0xa24b('0x14')]=function(_0x240aaa){if(_0x240aaa[_0xa24b('0x21')]==='from-voip-provider'){for(var _0x3978dc in this[_0xa24b('0x10')]){if(this[_0xa24b('0x10')][_0xa24b('0x22')](_0x3978dc)){if(_0x240aaa[_0xa24b('0x23')]===this['faxAccounts'][_0x3978dc][_0xa24b('0x24')]){this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]]={};this['channels'][_0x240aaa[_0xa24b('0x25')]][_0xa24b('0x26')]=_0x240aaa['channel'];this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]]['id']=this[_0xa24b('0x10')][_0x3978dc]['id'];this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]]['name']=this['faxAccounts'][_0x3978dc][_0xa24b('0x27')];logger[_0xa24b('0x28')](_0x240aaa[_0xa24b('0x25')],_0xa24b('0x29'));}}}}if(this[_0xa24b('0x12')][_0x240aaa[_0xa24b('0x25')]]){this['channels'][_0x240aaa['uniqueid']]={};this[_0xa24b('0xf')][_0x240aaa[_0xa24b('0x25')]][_0xa24b('0x26')]=_0x240aaa[_0xa24b('0x26')];logger['info'](_0x240aaa[_0xa24b('0x25')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0xa24b('0x17')]=function(_0x5c8851){if(this[_0xa24b('0xf')][_0x5c8851[_0xa24b('0x25')]]){for(var _0x4975ab in _0x5c8851['variable']){if(_0x5c8851[_0xa24b('0x2a')][_0xa24b('0x22')](_0x4975ab)){this[_0xa24b('0xf')][_0x5c8851[_0xa24b('0x25')]][_0x4975ab]=_0x5c8851[_0xa24b('0x2b')];}}}};Fax[_0xa24b('0x20')][_0xa24b('0x2c')]=function(_0x28b09b){if(this[_0xa24b('0xf')][_0x28b09b['uniqueid']]){this['channels'][_0x28b09b[_0xa24b('0x25')]][_0xa24b('0x2d')]=_0x28b09b[_0xa24b('0x2d')];this[_0xa24b('0xf')][_0x28b09b[_0xa24b('0x25')]][_0xa24b('0x2e')]=_0x28b09b[_0xa24b('0x2e')];}};Fax[_0xa24b('0x20')][_0xa24b('0x1a')]=function(_0x43472e){if(this[_0xa24b('0xf')][_0x43472e[_0xa24b('0x25')]]){for(var _0x13a644 in _0x43472e[_0xa24b('0x2a')]){if(_0x43472e[_0xa24b('0x2a')][_0xa24b('0x22')](_0x13a644)){this['channels'][_0x43472e[_0xa24b('0x25')]][_0x13a644]=_0x43472e['value'];}}}};Fax[_0xa24b('0x20')]['syncFaxStatus']=function(_0x455d3c){if(this[_0xa24b('0xf')][_0x455d3c['uniqueid']]){this['channels'][_0x455d3c[_0xa24b('0x25')]][_0xa24b('0x2f')]=_0x455d3c[_0xa24b('0x2f')];this['channels'][_0x455d3c[_0xa24b('0x25')]]['status']=_0x455d3c['status'];this['channels'][_0x455d3c[_0xa24b('0x25')]][_0xa24b('0x24')]=_0x455d3c[_0xa24b('0x24')];this[_0xa24b('0xf')][_0x455d3c['uniqueid']][_0xa24b('0x30')]=_0x455d3c[_0xa24b('0x30')];logger[_0xa24b('0x28')](_0x455d3c[_0xa24b('0x25')],_0xa24b('0x31'));}};Fax['prototype'][_0xa24b('0x1d')]=function(_0x4fb01b){var _0x3910cd=this;if(this['channels'][_0x4fb01b[_0xa24b('0x25')]]){var _0x7857a3=this['channels'][_0x4fb01b[_0xa24b('0x25')]]['id'];this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x32')]=_0x4fb01b[_0xa24b('0x32')];this[_0xa24b('0xf')][_0x4fb01b['uniqueid']][_0xa24b('0x33')]=_0x4fb01b[_0xa24b('0x33')];this[_0xa24b('0xf')][_0x4fb01b['uniqueid']]['localstationid']=_0x4fb01b[_0xa24b('0x24')];this['channels'][_0x4fb01b['uniqueid']]['resolution']=_0x4fb01b[_0xa24b('0x34')];this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x35')]=_0x4fb01b[_0xa24b('0x35')];this['channels'][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x30')]=_0x4fb01b[_0xa24b('0x30')];this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]][_0xa24b('0x36')]=_0x4fb01b[_0xa24b('0x36')];if(this[_0xa24b('0xf')][_0x4fb01b[_0xa24b('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x4fb01b[_0xa24b('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x2738cb){logger[_0xa24b('0x28')](_0x4fb01b[_0xa24b('0x25')],_0xa24b('0x37'),_0x2738cb[_0xa24b('0x38')]);attachment[_0xa24b('0x39')]({'name':path[_0xa24b('0x3a')](_0x4fb01b[_0xa24b('0x30')])['name'],'basename':path[_0xa24b('0x3a')](_0x4fb01b[_0xa24b('0x30')])[_0xa24b('0x27')]+_0xa24b('0x3b'),'type':'application/pdf'})[_0xa24b('0x3c')](function(_0x31c3f9){faxAccount[_0xa24b('0x3d')](_0x7857a3,{'from':_0x4fb01b[_0xa24b('0x36')],'mapKey':'fax','body':path[_0xa24b('0x3a')](_0x4fb01b[_0xa24b('0x30')])[_0xa24b('0x27')]+_0xa24b('0x3b'),'AttachmentId':_0x31c3f9['id']})['catch'](function(_0x1e9b06){logger[_0xa24b('0x3e')](_0x4fb01b[_0xa24b('0x25')],_0xa24b('0x3f'),JSON[_0xa24b('0x40')](_0x1e9b06));});})[_0xa24b('0x41')](function(_0x8c3df8){logger[_0xa24b('0x3e')](_0x4fb01b[_0xa24b('0x25')],_0xa24b('0x42'),JSON[_0xa24b('0x40')](_0x8c3df8));});});}logger[_0xa24b('0x28')](_0x4fb01b['uniqueid'],_0xa24b('0x42'));}};Fax[_0xa24b('0x20')][_0xa24b('0x43')]=function(_0x3d73a4){if(this[_0xa24b('0x12')][_0x3d73a4['uniqueid']]){_[_0xa24b('0x44')](this['channels'][_0x3d73a4[_0xa24b('0x25')]],_[_0xa24b('0x45')](_0x3d73a4,[_0xa24b('0x46'),_0xa24b('0x47')]));}};function updateStatus(_0x3eb125){if(_0x3eb125[_0xa24b('0x48')]){faxMessage[_0xa24b('0x49')](_0x3eb125[_0xa24b('0x48')],{'failMessage':_0xa24b('0x4a')})['then'](function(_0x477567){ut[_0xa24b('0x4b')](_0xa24b('0x4c'),_0x477567);})['catch'](function(_0xc16e1){ut[_0xa24b('0x4b')](_0xa24b('0x4d'),_0xc16e1);});}else{ut[_0xa24b('0x4b')](_0xa24b('0x4e'));}}Fax[_0xa24b('0x20')]['updateStatus']=function(_0x36cf5c,_0x39a448,_0x5bc94c){var _0x597d32=this;var _0x19ba33={};if(_0x39a448){_0x19ba33={'read':_0x39a448};}else{_0x19ba33={'failMessage':_0x5bc94c};}if(this[_0xa24b('0x12')][_0x36cf5c][_0xa24b('0x48')]){faxMessage[_0xa24b('0x49')](this[_0xa24b('0x12')][_0x36cf5c]['AttachmentId'],_0x19ba33)['then'](function(_0x2feab3){ut[_0xa24b('0x4b')](_0xa24b('0x4f'),_0x2feab3);})[_0xa24b('0x41')](function(_0x508ffc){ut['logger'](_0xa24b('0x50'),_0x508ffc);})[_0xa24b('0x51')](function(){delete _0x597d32[_0xa24b('0xf')][_0x36cf5c];delete _0x597d32[_0xa24b('0x12')][_0x36cf5c];});}else{ut[_0xa24b('0x4b')](_0xa24b('0x52'));this['deleteChannelAfterTimeout'](_0x36cf5c);delete this[_0xa24b('0x12')][_0x36cf5c];}};Fax[_0xa24b('0x20')]['syncHangup']=function(_0x2df0c9){var _0x2c0b9b=this;if(this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]]){if(this[_0xa24b('0x12')][_0x2df0c9[_0xa24b('0x25')]]){this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]]['id']=this['actions'][_0x2df0c9[_0xa24b('0x25')]]['id'];this['channels'][_0x2df0c9['uniqueid']][_0xa24b('0x27')]=this[_0xa24b('0x12')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x27')];}logger['info'](_0x2df0c9[_0xa24b('0x25')],this['actions'][_0x2df0c9[_0xa24b('0x25')]]?'\x20hangup\x20sendFile\x20':_0xa24b('0x53'),JSON[_0xa24b('0x40')](this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]]));if(this[_0xa24b('0x12')][_0x2df0c9[_0xa24b('0x25')]]){if(this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x54')]>0x0&&this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x1b')]===_0xa24b('0x55')){this['updateStatus'](_0x2df0c9['uniqueid'],!![]);}else{this[_0xa24b('0x56')](_0x2df0c9[_0xa24b('0x25')],![],this['channels'][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x57')]?_0xa24b('0x58')+this[_0xa24b('0xf')][_0x2df0c9[_0xa24b('0x25')]][_0xa24b('0x57')]:'SENDING\x20FAILED');}}}};Fax[_0xa24b('0x20')]['send']=function(_0x398cf1){var _0x22ada6=this;return new BPromise(function(_0x3d46eb,_0x2465e3){_0x22ada6[_0xa24b('0x59')](_0x398cf1,_0x22ada6[_0xa24b('0x10')][_0x398cf1[_0xa24b('0x5a')]])[_0xa24b('0x3c')](function(_0x499fd9){ut[_0xa24b('0x4b')](_0xa24b('0x5b'),_0x499fd9);_0x3d46eb(ut[_0xa24b('0x38')](_0xa24b('0x5c')));})[_0xa24b('0x41')](function(_0x53f664){ut[_0xa24b('0x4b')](_0xa24b('0x5d'),_0x53f664);updateStatus(_0x398cf1);_0x2465e3(ut[_0xa24b('0x38')](_0xa24b('0x5e')));});});};Fax[_0xa24b('0x20')]['checkAfterSend']=function(_0x4b2610){var _0x9a9030=this;return new BPromise(function(_0x84731,_0x4b39aa){var _0xab1bf2=_0x9a9030[_0xa24b('0x5f')](_0x9a9030['faxAccounts'][_0x4b2610[_0xa24b('0x5a')]][_0xa24b('0x60')],_0x4b2610);if(_0xab1bf2[_0xa24b('0x61')]){_0x84731(ut[_0xa24b('0x38')](_0xa24b('0x62')));}else{_0x4b39aa(ut['message'](_0xab1bf2[_0xa24b('0x38')]));}});};function originate(_0x445bba,_0x1b2b1a,_0x137116){return new BPromise(function(_0x4a8b4d,_0x1edcec){if(_0x137116){var _0x5d5ace=util['format'](_0xa24b('0x63'),path[_0xa24b('0x3a')](_0x445bba[_0xa24b('0x3')])[_0xa24b('0x27')],_0x445bba[_0xa24b('0x3')]);gs[_0xa24b('0x64')](_0x5d5ace)['then'](function(){_0x445bba[_0xa24b('0x3')]=util[_0xa24b('0x65')]('%s/%s.tif',path[_0xa24b('0x3a')](_0x445bba['path'])[_0xa24b('0x66')],path[_0xa24b('0x3a')](_0x445bba[_0xa24b('0x3')])[_0xa24b('0x27')]);_0x1b2b1a[_0xa24b('0x67')]=_0x445bba[_0xa24b('0x3')];ut[_0xa24b('0x4b')](_0xa24b('0x68'),'');ami[_0xa24b('0x69')](ut['variablesAction'](_0x445bba,_0x1b2b1a))[_0xa24b('0x3c')](function(_0x3c5016){_0x4a8b4d(_0x3c5016);})[_0xa24b('0x41')](function(_0xab9c15){_0x1edcec(_0xab9c15);});})[_0xa24b('0x41')](function(_0x18fb08){_0x1edcec(_0x18fb08);});}else{ami[_0xa24b('0x69')](ut[_0xa24b('0x6a')](_0x445bba,_0x1b2b1a))[_0xa24b('0x3c')](function(_0x17f284){_0x4a8b4d(_0x17f284);})[_0xa24b('0x41')](function(_0x3d6127){_0x1edcec(_0x3d6127);});}});}Fax['prototype'][_0xa24b('0x59')]=function(_0x52fb05,_0x5b1a87){var _0x2c2b86=this;return new BPromise(function(_0x1427eb,_0x990674){var _0x56b426=uuid['v4']();var _0x17287e=ut[_0xa24b('0x6b')](_0x52fb05,_0x5b1a87);_0x2c2b86[_0xa24b('0x12')][_0x56b426]=new Action(_0x56b426,_0x5b1a87,_0x52fb05);var _0x227169=_0x2c2b86[_0xa24b('0x12')][_0x56b426];if(path[_0xa24b('0x3a')](_0x52fb05[_0xa24b('0x3')])['ext']===_0xa24b('0x3b')){originate(_0x227169,_0x17287e,!![])[_0xa24b('0x3c')](function(_0x16be4a){_0x1427eb(_0x16be4a);})['catch'](function(_0x349488){_0x990674(_0x349488);});}else{originate(_0x227169,_0x17287e,![])[_0xa24b('0x3c')](function(_0x236688){_0x1427eb(_0x236688);})[_0xa24b('0x41')](function(_0x4ac8cd){_0x990674(_0x4ac8cd);});}});};Fax['prototype'][_0xa24b('0x6c')]=function(_0x1535fa){return!_[_0xa24b('0x6d')](_0x1535fa)&&!_[_0xa24b('0x6d')](_0x1535fa['name'])&&!_[_0xa24b('0x6d')](_0x1535fa['active'])&&_0x1535fa[_0xa24b('0x6e')]&&!_[_0xa24b('0x6d')](this[_0xa24b('0x11')][util[_0xa24b('0x65')](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])])&&!_['isNil'](this[_0xa24b('0x11')][util[_0xa24b('0x65')](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])]['status'])&&(this[_0xa24b('0x11')][util[_0xa24b('0x65')](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])][_0xa24b('0x70')]===_0xa24b('0x71')||this['trunks'][util['format'](_0xa24b('0x6f'),_0x1535fa[_0xa24b('0x27')])][_0xa24b('0x70')]===_0xa24b('0x72'));};Fax['prototype'][_0xa24b('0x5f')]=function(_0x33ce77,_0x1f7166){if(!this[_0xa24b('0x6c')](_0x33ce77)){ut['logger'](_0xa24b('0x73'),_[_0xa24b('0x6d')](_0x33ce77)?'':_0x33ce77[_0xa24b('0x27')]+_0xa24b('0x74'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xa24b('0x6d')](_0x1f7166[_0xa24b('0x7')])){ut[_0xa24b('0x4b')](_0xa24b('0x75'),JSON[_0xa24b('0x40')](_0x1f7166));return{'isValid':![],'message':_0xa24b('0x76')};}if(_['isNil'](_0x1f7166['path'])){ut['logger'](_0xa24b('0x77'),JSON[_0xa24b('0x40')](_0x1f7166));return{'isValid':![],'message':_0xa24b('0x78')};}return{'isValid':!![],'message':_0xa24b('0x79')};};Fax[_0xa24b('0x20')][_0xa24b('0x7a')]=function(_0x3c2b5d,_0x422e2a=0x2710){if(this[_0xa24b('0xf')][_0x3c2b5d]){setTimeout(()=>{delete this['channels'][_0x3c2b5d];},_0x422e2a);}};module[_0xa24b('0x7b')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d8534d8..5489302 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 _0x4121=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','resolve','then','catch','[Notify]\x20'];(function(_0x5bdd5d,_0x5042c5){var _0x37d28c=function(_0x2a3c15){while(--_0x2a3c15){_0x5bdd5d['push'](_0x5bdd5d['shift']());}};_0x37d28c(++_0x5042c5);}(_0x4121,0x1a2));var _0x1412=function(_0x177181,_0x90babf){_0x177181=_0x177181-0x0;var _0x14870f=_0x4121[_0x177181];return _0x14870f;};'use strict';var util=require(_0x1412('0x0'));var BPromise=require(_0x1412('0x1'));var logger=require(_0x1412('0x2'))(_0x1412('0x3'));var _=require(_0x1412('0x4'));var faxAccount=require(_0x1412('0x5'));function loggerCatch(_0x1e731b){return function(_0x22e126){logger[_0x1412('0x6')](_0x1e731b,util['inspect'](_0x22e126,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x15ae10,_0x4f0a63){return BPromise[_0x1412('0x7')]()[_0x1412('0x8')](faxAccount['notify'](_0x15ae10,_0x4f0a63))[_0x1412('0x9')](loggerCatch(_0x1412('0xa')));}; \ No newline at end of file +var _0xea64=['notify','catch','util','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0xa1f5c4,_0x247496){var _0x3f2f74=function(_0x3dae53){while(--_0x3dae53){_0xa1f5c4['push'](_0xa1f5c4['shift']());}};_0x3f2f74(++_0x247496);}(_0xea64,0xd4));var _0x4ea6=function(_0x29e5b8,_0xeb28de){_0x29e5b8=_0x29e5b8-0x0;var _0x18bbac=_0xea64[_0x29e5b8];return _0x18bbac;};'use strict';var util=require(_0x4ea6('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x4ea6('0x1'));var _=require(_0x4ea6('0x2'));var faxAccount=require(_0x4ea6('0x3'));function loggerCatch(_0x337e94){return function(_0x27ccfd){logger[_0x4ea6('0x4')](_0x337e94,util[_0x4ea6('0x5')](_0x27ccfd,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x555d39,_0x14824c){return BPromise[_0x4ea6('0x6')]()[_0x4ea6('0x7')](faxAccount[_0x4ea6('0x8')](_0x555d39,_0x14824c))[_0x4ea6('0x9')](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 3a53ea2..907494e 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 _0xb0aa=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x137b18,_0x4e7c8e){var _0x367153=function(_0x5934da){while(--_0x5934da){_0x137b18['push'](_0x137b18['shift']());}};_0x367153(++_0x4e7c8e);}(_0xb0aa,0x18a));var _0xab0a=function(_0x7c955c,_0x3b8b6c){_0x7c955c=_0x7c955c-0x0;var _0xc8ba7a=_0xb0aa[_0x7c955c];return _0xc8ba7a;};'use strict';var util=require(_0xab0a('0x0'));var logger=require(_0xab0a('0x1'))(_0xab0a('0x2'));var BPromise=require(_0xab0a('0x3'));var exec=require(_0xab0a('0x4'))[_0xab0a('0x5')];exports[_0xab0a('0x6')]=function(_0x27c835){return new BPromise(function(_0x56eb55,_0x126b7a){exec(_0x27c835,function(_0x37162c,_0x527263,_0x71278d){logger[_0xab0a('0x7')](_0xab0a('0x8'),_0x527263);if(_0x37162c){logger[_0xab0a('0x7')](_0xab0a('0x8'),_0xab0a('0x9'),util['inspect'](_0x37162c,{'showHidden':![],'depth':null}),_0x527263,_0x71278d);_0x126b7a(_0x37162c);}_0x56eb55(_0x527263);});});}; \ No newline at end of file +var _0x7ef2=['fax','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x4a6e77,_0x4a677c){var _0x1c137e=function(_0x3ecd59){while(--_0x3ecd59){_0x4a6e77['push'](_0x4a6e77['shift']());}};_0x1c137e(++_0x4a677c);}(_0x7ef2,0x1e4));var _0x27ef=function(_0x202201,_0x13db5b){_0x202201=_0x202201-0x0;var _0x19f36f=_0x7ef2[_0x202201];return _0x19f36f;};'use strict';var util=require(_0x27ef('0x0'));var logger=require(_0x27ef('0x1'))(_0x27ef('0x2'));var BPromise=require(_0x27ef('0x3'));var exec=require(_0x27ef('0x4'))['exec'];exports['execute']=function(_0x2daa88){return new BPromise(function(_0x9abea1,_0x5518be){exec(_0x2daa88,function(_0x559176,_0x20be11,_0xf227b8){logger[_0x27ef('0x5')](_0x27ef('0x6'),_0x20be11);if(_0x559176){logger[_0x27ef('0x5')](_0x27ef('0x6'),_0x27ef('0x7'),util[_0x27ef('0x8')](_0x559176,{'showHidden':![],'depth':null}),_0x20be11,_0xf227b8);_0x5518be(_0x559176);}_0x9abea1(_0x20be11);});});}; \ 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 085c6f0..cfb9881 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 _0xaefd=['channel','from-sip','uniqueid','util','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate'];(function(_0x5e2887,_0x23908f){var _0xe043b1=function(_0x4d8bf0){while(--_0x4d8bf0){_0x5e2887['push'](_0x5e2887['shift']());}};_0xe043b1(++_0x23908f);}(_0xaefd,0x1de));var _0xdaef=function(_0x4c25b7,_0x12f821){_0x4c25b7=_0x4c25b7-0x0;var _0x28a773=_0xaefd[_0x4c25b7];return _0x28a773;};'use strict';var util=require(_0xdaef('0x0'));var _=require('lodash');var moment=require(_0xdaef('0x1'));var logger=require(_0xdaef('0x2'))(_0xdaef('0x3'));exports[_0xdaef('0x4')]=function(_0x45a5cf){return{'message':_0x45a5cf};};exports[_0xdaef('0x5')]=function(_0x3221e6,_0x41e586){logger['info'](_0x3221e6,util[_0xdaef('0x6')](_0x41e586,{'showHidden':![],'depth':null}));};exports[_0xdaef('0x7')]=function(_0x2be4e0,_0x2047f9){var _0x5b63fe={'XMF-ECM':_0x2047f9[_0xdaef('0x8')],'XMF-HEADERINFO':_0x2047f9[_0xdaef('0x9')],'XMF-MINRATE':_0x2047f9[_0xdaef('0xa')],'XMF-MAXRATE':_0x2047f9[_0xdaef('0xb')],'XMF-MODEM':util[_0xdaef('0xc')](_0xdaef('0xd'),_0x2047f9[_0xdaef('0xe')]),'XMF-GATEWAY':_0x2047f9[_0xdaef('0xf')],'XMF-FAXDETECT':_0x2047f9[_0xdaef('0x10')],'XMF-T38TIMEOUT':_0x2047f9[_0xdaef('0x11')],'XMF-LOCALSTATIONID':_0x2047f9[_0xdaef('0x12')],'XMF-PATH':_0x2be4e0[_0xdaef('0x13')]};return _0x5b63fe;};exports[_0xdaef('0x14')]=function(_0x461b6e,_0x1e057b){return{'actionid':_0x461b6e['uniqueid'],'action':_0xdaef('0x15'),'channel':_0x461b6e[_0xdaef('0x16')],'Exten':'xcally-motion-fax','Context':_0xdaef('0x17'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x461b6e[_0xdaef('0x9')]?_0x461b6e[_0xdaef('0x9')]:'',_0x461b6e[_0xdaef('0x12')]),'variable':_0x1e057b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x461b6e[_0xdaef('0x18')]};}; \ No newline at end of file +var _0x6b60=['message','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','localstationid','originate','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','lodash','../../../../config/logger','fax'];(function(_0x3e3e5e,_0x27ce4d){var _0x43a528=function(_0x4ced7d){while(--_0x4ced7d){_0x3e3e5e['push'](_0x3e3e5e['shift']());}};_0x43a528(++_0x27ce4d);}(_0x6b60,0x1be));var _0x06b6=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x6b60[_0x3fc97b];return _0x3a0c82;};'use strict';var util=require(_0x06b6('0x0'));var _=require(_0x06b6('0x1'));var moment=require('moment');var logger=require(_0x06b6('0x2'))(_0x06b6('0x3'));exports[_0x06b6('0x4')]=function(_0x15bdad){return{'message':_0x15bdad};};exports['logger']=function(_0x160af1,_0x501b34){logger['info'](_0x160af1,util[_0x06b6('0x5')](_0x501b34,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5a6ce4,_0x3085d1){var _0x119c0d={'XMF-ECM':_0x3085d1[_0x06b6('0x6')],'XMF-HEADERINFO':_0x3085d1['headerinfo'],'XMF-MINRATE':_0x3085d1[_0x06b6('0x7')],'XMF-MAXRATE':_0x3085d1[_0x06b6('0x8')],'XMF-MODEM':util[_0x06b6('0x9')](_0x06b6('0xa'),_0x3085d1[_0x06b6('0xb')]),'XMF-GATEWAY':_0x3085d1[_0x06b6('0xc')],'XMF-FAXDETECT':_0x3085d1['faxdetect'],'XMF-T38TIMEOUT':_0x3085d1['t38timeout'],'XMF-LOCALSTATIONID':_0x3085d1[_0x06b6('0xd')],'XMF-PATH':_0x5a6ce4['path']};return _0x119c0d;};exports['variablesAction']=function(_0x4d3d26,_0x168514){return{'actionid':_0x4d3d26['uniqueid'],'action':_0x06b6('0xe'),'channel':_0x4d3d26['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x06b6('0x9')](_0x06b6('0xf'),_0x4d3d26[_0x06b6('0x10')]?_0x4d3d26[_0x06b6('0x10')]:'',_0x4d3d26[_0x06b6('0xd')]),'variable':_0x168514,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4d3d26[_0x06b6('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 86c3e71..a83ca47 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 _0xb785=['initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./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/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','get','hour','resolve','getAgents','initAgents','getTelephones','then','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts'];(function(_0x4b6643,_0x9e4308){var _0x3dc376=function(_0x39aab1){while(--_0x39aab1){_0x4b6643['push'](_0x4b6643['shift']());}};_0x3dc376(++_0x9e4308);}(_0xb785,0x1f2));var _0x5b78=function(_0x4bca7b,_0x2638b3){_0x4bca7b=_0x4bca7b-0x0;var _0x2efd76=_0xb785[_0x4bca7b];return _0x2efd76;};'use strict';var util=require(_0x5b78('0x0'));var moment=require(_0x5b78('0x1'));var server=require(_0x5b78('0x2'));var Realtime=require(_0x5b78('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x5b78('0x4'));var Dialer=require(_0x5b78('0x5'));var Preview=require(_0x5b78('0x6'));var Fax=require(_0x5b78('0x7'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x5b78('0x8'));var trunk=require(_0x5b78('0x9'));var trigger=require(_0x5b78('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x5b78('0xb'));var campaign=require(_0x5b78('0xc'));var voiceExtension=require(_0x5b78('0xd'));var faxAccount=require(_0x5b78('0xe'));var zendesk=require(_0x5b78('0xf'));var salesforce=require(_0x5b78('0x10'));var sugarcrm=require(_0x5b78('0x11'));var freshdesk=require(_0x5b78('0x12'));var desk=require(_0x5b78('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x5b78('0x14'));var freshsales=require(_0x5b78('0x15'));var servicenow=require(_0x5b78('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5b78('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5b78('0x18')](_0x5b78('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x5b78('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x5b78('0x1a')]()['then'](user[_0x5b78('0x1b')]())['then'](realtime[_0x5b78('0x1c')]())['then'](user[_0x5b78('0x1d')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x1f')]())['then'](trunk['getTrunks']())[_0x5b78('0x1e')](realtime[_0x5b78('0x20')]())[_0x5b78('0x1e')](voiceQueue[_0x5b78('0x21')]())['then'](realtime[_0x5b78('0x22')]())[_0x5b78('0x1e')](trigger[_0x5b78('0x23')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x24')]())[_0x5b78('0x1e')](template['getTemplates']())[_0x5b78('0x1e')](realtime['initTemplates']())[_0x5b78('0x1e')](zendesk[_0x5b78('0x25')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x26')]())[_0x5b78('0x1e')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x5b78('0x27')]())[_0x5b78('0x1e')](sugarcrm['getSugarcrmAccounts']())[_0x5b78('0x1e')](realtime[_0x5b78('0x28')]())[_0x5b78('0x1e')](freshdesk[_0x5b78('0x29')]())[_0x5b78('0x1e')](realtime['initFreshdeskAccounts']())[_0x5b78('0x1e')](desk[_0x5b78('0x2a')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x2b')]())[_0x5b78('0x1e')](zoho[_0x5b78('0x2c')]())[_0x5b78('0x1e')](realtime['initZohoAccounts']())[_0x5b78('0x1e')](vtiger[_0x5b78('0x2d')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x2e')]())[_0x5b78('0x1e')](freshsales[_0x5b78('0x2f')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x30')]())[_0x5b78('0x1e')](servicenow['getServicenowAccounts']())['then'](realtime[_0x5b78('0x31')]())[_0x5b78('0x1e')](dynamics365[_0x5b78('0x32')]())['then'](realtime['initDynamics365Accounts']())['then'](campaign[_0x5b78('0x33')]())[_0x5b78('0x1e')](realtime['initCampaigns']())[_0x5b78('0x1e')](voiceExtension[_0x5b78('0x34')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x35')]())[_0x5b78('0x1e')](faxAccount[_0x5b78('0x36')]())['then'](realtime[_0x5b78('0x37')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x5b78('0x1a')]()[_0x5b78('0x1e')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x5b78('0x38')]())[_0x5b78('0x1e')](cmHopperHistory[_0x5b78('0x39')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x3a')]())['then'](cmHopperHistory[_0x5b78('0x3b')]())[_0x5b78('0x1e')](realtime[_0x5b78('0x3c')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x5b78('0x1e')](realtime[_0x5b78('0x3d')]())[_0x5b78('0x3e')](function(_0x503b09){logger['error'](_0x5b78('0x3f'),util[_0x5b78('0x40')](_0x503b09,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5b78('0x41')](realtime,preview,fax)[_0x5b78('0x1e')](function(){return initRealtime();})[_0x5b78('0x1e')](function(){return initParams();})[_0x5b78('0x1e')](function(){report[_0x5b78('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x439200){logger['error'](_0x5b78('0x43'),util[_0x5b78('0x40')](_0x439200,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x6b92=['inspect','moment','./realtime','./acw','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','listen','sync','catch','[index.js][main]'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0x6b92,0x1cf));var _0x26b9=function(_0x144d3c,_0x1c8394){_0x144d3c=_0x144d3c-0x0;var _0x25af78=_0x6b92[_0x144d3c];return _0x25af78;};'use strict';var util=require('util');var moment=require(_0x26b9('0x0'));var server=require('./server');var Realtime=require(_0x26b9('0x1'));var Report=require('./report');var Acw=require(_0x26b9('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x26b9('0x3'));var Preview=require('./preview');var Fax=require(_0x26b9('0x4'));var user=require(_0x26b9('0x5'));var voiceQueue=require(_0x26b9('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x26b9('0x7'));var trigger=require(_0x26b9('0x8'));var template=require(_0x26b9('0x9'));var cmHopperHistory=require(_0x26b9('0xa'));var campaign=require(_0x26b9('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x26b9('0xc'));var zendesk=require(_0x26b9('0xd'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x26b9('0xe'));var freshdesk=require(_0x26b9('0xf'));var desk=require(_0x26b9('0x10'));var zoho=require(_0x26b9('0x11'));var vtiger=require(_0x26b9('0x12'));var freshsales=require(_0x26b9('0x13'));var servicenow=require(_0x26b9('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x26b9('0x15'))(_0x26b9('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x26b9('0x17')](_0x26b9('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x26b9('0x17')](_0x26b9('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x26b9('0x19')]()['then'](user[_0x26b9('0x1a')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x1c')]())[_0x26b9('0x1b')](user['getTelephones']())[_0x26b9('0x1b')](realtime['initTelephones']())['then'](trunk[_0x26b9('0x1d')]())[_0x26b9('0x1b')](realtime['initTrunks']())[_0x26b9('0x1b')](voiceQueue[_0x26b9('0x1e')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x1f')]())[_0x26b9('0x1b')](trigger['getTriggers']())[_0x26b9('0x1b')](realtime[_0x26b9('0x20')]())[_0x26b9('0x1b')](template[_0x26b9('0x21')]())[_0x26b9('0x1b')](realtime['initTemplates']())['then'](zendesk[_0x26b9('0x22')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x23')]())['then'](salesforce[_0x26b9('0x24')]())['then'](realtime[_0x26b9('0x25')]())[_0x26b9('0x1b')](sugarcrm[_0x26b9('0x26')]())['then'](realtime['initSugarcrmAccounts']())[_0x26b9('0x1b')](freshdesk[_0x26b9('0x27')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x28')]())[_0x26b9('0x1b')](desk[_0x26b9('0x29')]())['then'](realtime['initDeskAccounts']())[_0x26b9('0x1b')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0x26b9('0x1b')](vtiger[_0x26b9('0x2a')]())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0x26b9('0x2b')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x2c')]())[_0x26b9('0x1b')](servicenow[_0x26b9('0x2d')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x2e')]())[_0x26b9('0x1b')](dynamics365[_0x26b9('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x26b9('0x1b')](campaign[_0x26b9('0x30')]())['then'](realtime[_0x26b9('0x31')]())[_0x26b9('0x1b')](voiceExtension['getVoiceExtensions']())[_0x26b9('0x1b')](realtime['initVoiceExtensions']())[_0x26b9('0x1b')](faxAccount[_0x26b9('0x32')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x33')]())[_0x26b9('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x26b9('0x19')]()[_0x26b9('0x1b')](voiceQueueReport[_0x26b9('0x34')]())['then'](realtime[_0x26b9('0x35')]())[_0x26b9('0x1b')](cmHopperHistory[_0x26b9('0x36')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x37')]())[_0x26b9('0x1b')](cmHopperHistory[_0x26b9('0x38')]())[_0x26b9('0x1b')](realtime[_0x26b9('0x39')]())['then'](voiceCallReport[_0x26b9('0x3a')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x9f7436){logger[_0x26b9('0x3b')](_0x26b9('0x3c'),util['inspect'](_0x9f7436,{'showHidden':![],'depth':null}));});}function main(){return server[_0x26b9('0x3d')](realtime,preview,fax)[_0x26b9('0x1b')](function(){return initRealtime();})[_0x26b9('0x1b')](function(){return initParams();})[_0x26b9('0x1b')](function(){report[_0x26b9('0x3e')]();setInterval(initRealtime,0x1388);})[_0x26b9('0x3f')](function(_0xb395b0){logger[_0x26b9('0x3b')](_0x26b9('0x40'),util[_0x26b9('0x41')](_0xb395b0,{'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 9264deb..68eb85a 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 _0xc4a1=['../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state','unknown','address','phone','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','talking','voiceStatus','statePause','voiceStatusTime','toNumber','format','stateTime','status','user:%s','emit','user:ami:update','omit','user:presence','exports','util','md5','ioredis'];(function(_0x409da6,_0x192c6e){var _0x23eca0=function(_0x3f2206){while(--_0x3f2206){_0x409da6['push'](_0x409da6['shift']());}};_0x23eca0(++_0x192c6e);}(_0xc4a1,0xc0));var _0x1c4a=function(_0x508e6c,_0x42af4f){_0x508e6c=_0x508e6c-0x0;var _0x23f8d9=_0xc4a1[_0x508e6c];return _0x23f8d9;};'use strict';var _=require('lodash');var util=require(_0x1c4a('0x0'));var moment=require('moment');var md5=require(_0x1c4a('0x1'));var Redis=require(_0x1c4a('0x2'));var config=require(_0x1c4a('0x3'));config[_0x1c4a('0x4')]=_[_0x1c4a('0x5')](config[_0x1c4a('0x4')],{'host':_0x1c4a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c4a('0x4')]));function Agent(_0x1366e6){this['id']=_0x1366e6['id']||0x0;this[_0x1c4a('0x7')]=_0x1366e6[_0x1c4a('0x7')]||'';this[_0x1c4a('0x8')]=_0x1366e6[_0x1c4a('0x8')]||'';this['accountcode']=_0x1366e6[_0x1c4a('0x9')]||'';this[_0x1c4a('0xa')]=_0x1366e6[_0x1c4a('0xa')]||'';this[_0x1c4a('0xb')]=_0x1c4a('0xc');this['stateTime']=0x0;this['status']=_0x1c4a('0xc');this[_0x1c4a('0xd')]='';this[_0x1c4a('0xe')]='';this['mobile']='';this[_0x1c4a('0xf')]='';this[_0x1c4a('0x10')]=_0x1366e6[_0x1c4a('0x10')]||![];this['voiceStatus']=_0x1c4a('0xc');this['voiceStatusTime']=0x0;this[_0x1c4a('0x11')]='';this[_0x1c4a('0x12')]='';this[_0x1c4a('0x13')]=![];this[_0x1c4a('0x14')]=![];this['md5']='';}Agent[_0x1c4a('0x15')][_0x1c4a('0x16')]=function(_0x1ec705){var _0x3fd535;if(_0x1ec705&&_0x1ec705[_0x1c4a('0xb')]){_0x3fd535=_0x1ec705[_0x1c4a('0xb')]['toLowerCase']();switch(_0x3fd535){case _0x1c4a('0x17'):_0x3fd535=_0x1c4a('0x18');break;case'inuse':_0x3fd535=_0x1c4a('0x19');break;}}if(_0x3fd535&&this[_0x1c4a('0x1a')]!==_0x3fd535||_0x1ec705[_0x1c4a('0x1b')]){this[_0x1c4a('0x1c')]=_[_0x1c4a('0x1d')](moment()[_0x1c4a('0x1e')]('x'));}if(_0x3fd535){this['voiceStatus']=_0x3fd535;}var _0x153b25={'id':this['id'],'name':this[_0x1c4a('0x7')],'email':this[_0x1c4a('0x8')],'accountcode':this[_0x1c4a('0x9')],'fullname':this[_0x1c4a('0xa')],'state':this[_0x1c4a('0xb')],'stateTime':this[_0x1c4a('0x1f')],'status':this[_0x1c4a('0x20')],'address':this[_0x1c4a('0xd')],'online':this[_0x1c4a('0x10')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1c4a('0x1c')],'voiceStatusCallerIdNumber':this[_0x1c4a('0x11')],'voiceStatusQueue':this[_0x1c4a('0x12')],'interface':this[_0x1c4a('0xf')],'onhold':this[_0x1c4a('0x13')]};var _0x53cede=md5(JSON['stringify'](_0x153b25));if(this[_0x1c4a('0x1')]!==_0x53cede){this[_0x1c4a('0x1')]=_0x53cede;io['to'](util[_0x1c4a('0x1e')](_0x1c4a('0x21'),_0x153b25[_0x1c4a('0x7')]))[_0x1c4a('0x22')](_0x1c4a('0x23'),_[_0x1c4a('0x24')](_0x153b25,[_0x1c4a('0x10')]));io[_0x1c4a('0x22')](_0x1c4a('0x25'),_0x153b25);}};module[_0x1c4a('0x26')]=Agent; \ No newline at end of file +var _0xa918=['inuse','talking','toNumber','format','onhold','stringify','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','idle'];(function(_0x7b2c5a,_0x486e8c){var _0x199677=function(_0x163137){while(--_0x163137){_0x7b2c5a['push'](_0x7b2c5a['shift']());}};_0x199677(++_0x486e8c);}(_0xa918,0x11c));var _0x8a91=function(_0x776dd3,_0x438790){_0x776dd3=_0x776dd3-0x0;var _0xcef491=_0xa918[_0x776dd3];return _0xcef491;};'use strict';var _=require(_0x8a91('0x0'));var util=require(_0x8a91('0x1'));var moment=require(_0x8a91('0x2'));var md5=require(_0x8a91('0x3'));var Redis=require(_0x8a91('0x4'));var config=require(_0x8a91('0x5'));config['redis']=_[_0x8a91('0x6')](config[_0x8a91('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8a91('0x8'))(new Redis(config[_0x8a91('0x7')]));function Agent(_0x427381){this['id']=_0x427381['id']||0x0;this[_0x8a91('0x9')]=_0x427381[_0x8a91('0x9')]||'';this[_0x8a91('0xa')]=_0x427381['email']||'';this[_0x8a91('0xb')]=_0x427381[_0x8a91('0xb')]||'';this[_0x8a91('0xc')]=_0x427381[_0x8a91('0xc')]||'';this[_0x8a91('0xd')]='unknown';this[_0x8a91('0xe')]=0x0;this[_0x8a91('0xf')]=_0x8a91('0x10');this[_0x8a91('0x11')]='';this['phone']='';this['mobile']='';this[_0x8a91('0x12')]='';this[_0x8a91('0x13')]=_0x427381[_0x8a91('0x13')]||![];this[_0x8a91('0x14')]=_0x8a91('0x10');this[_0x8a91('0x15')]=0x0;this[_0x8a91('0x16')]='';this[_0x8a91('0x17')]='';this['onhold']=![];this['local']=![];this[_0x8a91('0x3')]='';}Agent[_0x8a91('0x18')][_0x8a91('0x19')]=function(_0x39e82b){var _0x57b7b1;if(_0x39e82b&&_0x39e82b[_0x8a91('0xd')]){_0x57b7b1=_0x39e82b['state'][_0x8a91('0x1a')]();switch(_0x57b7b1){case'not_inuse':_0x57b7b1=_0x8a91('0x1b');break;case _0x8a91('0x1c'):_0x57b7b1=_0x8a91('0x1d');break;}}if(_0x57b7b1&&this[_0x8a91('0x14')]!==_0x57b7b1||_0x39e82b['statePause']){this[_0x8a91('0x15')]=_[_0x8a91('0x1e')](moment()[_0x8a91('0x1f')]('x'));}if(_0x57b7b1){this[_0x8a91('0x14')]=_0x57b7b1;}var _0x531f08={'id':this['id'],'name':this[_0x8a91('0x9')],'email':this[_0x8a91('0xa')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x8a91('0xd')],'stateTime':this[_0x8a91('0xe')],'status':this['status'],'address':this['address'],'online':this[_0x8a91('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x8a91('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x8a91('0x17')],'interface':this[_0x8a91('0x12')],'onhold':this[_0x8a91('0x20')]};var _0x393956=md5(JSON[_0x8a91('0x21')](_0x531f08));if(this[_0x8a91('0x3')]!==_0x393956){this['md5']=_0x393956;io['to'](util[_0x8a91('0x1f')](_0x8a91('0x22'),_0x531f08[_0x8a91('0x9')]))[_0x8a91('0x23')](_0x8a91('0x24'),_['omit'](_0x531f08,[_0x8a91('0x13')]));io[_0x8a91('0x23')](_0x8a91('0x25'),_0x531f08);}};module[_0x8a91('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 c10181b..cb79046 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 _0xde58=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x4099bb,_0x101c2a){var _0x448596=function(_0x78bb0d){while(--_0x78bb0d){_0x4099bb['push'](_0x4099bb['shift']());}};_0x448596(++_0x101c2a);}(_0xde58,0x17a));var _0x8de5=function(_0x35aed5,_0x3e1ecf){_0x35aed5=_0x35aed5-0x0;var _0xc6893d=_0xde58[_0x35aed5];return _0xc6893d;};'use strict';function Campaign(_0x369879){this['id']=_0x369879['id']||0x0;this[_0x8de5('0x0')]=_0x369879['name']||'';this['type']=_0x369879['type']||_0x8de5('0x1');this[_0x8de5('0x2')]=0x0;this['temp']=0x0;this[_0x8de5('0x3')]=0x0;this[_0x8de5('0x4')]=0x0;this[_0x8de5('0x5')]='';this[_0x8de5('0x6')]=!![];this[_0x8de5('0x7')]=_0x369879[_0x8de5('0x7')];this[_0x8de5('0x8')]=_0x369879[_0x8de5('0x8')];this[_0x8de5('0x9')]=_0x369879[_0x8de5('0x9')]||null;this['dialGlobalInterval']=_0x369879[_0x8de5('0xa')]?_0x369879[_0x8de5('0xa')]:null;this[_0x8de5('0xb')]=_0x369879[_0x8de5('0xb')];this[_0x8de5('0xc')]=_0x369879[_0x8de5('0xc')];this[_0x8de5('0xd')]=_0x369879[_0x8de5('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x369879[_0x8de5('0xe')];this[_0x8de5('0xf')]=_0x369879[_0x8de5('0xf')];this[_0x8de5('0x10')]=_0x369879[_0x8de5('0x10')];this[_0x8de5('0x11')]=_0x369879[_0x8de5('0x11')];this[_0x8de5('0x12')]=_0x369879[_0x8de5('0x12')];this[_0x8de5('0x13')]=_0x369879[_0x8de5('0x13')];this[_0x8de5('0x14')]=_0x369879['dialGlobalMaxRetry'];this[_0x8de5('0x15')]=_0x369879[_0x8de5('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x369879[_0x8de5('0x16')]||0x96;this[_0x8de5('0x17')]=_0x369879[_0x8de5('0x17')]||0x3;this['dialDropRetryFrequency']=_0x369879[_0x8de5('0x18')]||0x96;this[_0x8de5('0x19')]=_0x369879[_0x8de5('0x19')]||0x3;this[_0x8de5('0x1a')]=_0x369879['dialAbandonedRetryFrequency']||0x96;this[_0x8de5('0x1b')]=_0x369879['dialMachineMaxRetry']||0x3;this[_0x8de5('0x1c')]=_0x369879[_0x8de5('0x1c')]||0x96;this[_0x8de5('0x1d')]=_0x369879['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x369879[_0x8de5('0x1e')]||0x96;this[_0x8de5('0x1f')]=_0x369879[_0x8de5('0x1f')]||'DESC';this[_0x8de5('0x20')]=_0x369879[_0x8de5('0x20')]||undefined;this[_0x8de5('0x21')]=_0x369879[_0x8de5('0x21')]||undefined;this[_0x8de5('0x22')]=_0x369879[_0x8de5('0x22')]||undefined;this[_0x8de5('0x23')]=_0x369879[_0x8de5('0x23')]?_0x369879[_0x8de5('0x23')]:undefined;this['Trunk']=_0x369879[_0x8de5('0x24')]?_0x369879[_0x8de5('0x24')]:undefined;this['Interval']=_0x369879[_0x8de5('0x25')]?_0x369879['Interval']:undefined;this[_0x8de5('0x26')]=_0x369879[_0x8de5('0x26')]?_0x369879[_0x8de5('0x26')]:undefined;this['dialQueueProject']=_0x369879[_0x8de5('0x26')]?_0x369879[_0x8de5('0x26')][_0x8de5('0x0')]:undefined;this[_0x8de5('0x27')]=_0x369879[_0x8de5('0x27')]||![];this[_0x8de5('0x28')]=_0x369879['dialAMDInitialSilence'];this[_0x8de5('0x29')]=_0x369879[_0x8de5('0x29')];this['dialAMDAfterGreetingSilence']=_0x369879[_0x8de5('0x2a')];this[_0x8de5('0x2b')]=_0x369879[_0x8de5('0x2b')];this[_0x8de5('0x2c')]=_0x369879[_0x8de5('0x2c')];this[_0x8de5('0x2d')]=_0x369879['dialAMDBetweenWordsSilence'];this[_0x8de5('0x2e')]=_0x369879[_0x8de5('0x2e')];this['dialAMDSilenceThreshold']=_0x369879[_0x8de5('0x2f')];this[_0x8de5('0x30')]=_0x369879[_0x8de5('0x30')];}module[_0x8de5('0x31')]=Campaign; \ No newline at end of file +var _0xf55a=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x3ef6bb,_0x1bb97f){var _0xa5f12a=function(_0x23f548){while(--_0x23f548){_0x3ef6bb['push'](_0x3ef6bb['shift']());}};_0xa5f12a(++_0x1bb97f);}(_0xf55a,0x1c3));var _0xaf55=function(_0x5bd398,_0x49513f){_0x5bd398=_0x5bd398-0x0;var _0x3f9528=_0xf55a[_0x5bd398];return _0x3f9528;};'use strict';function Campaign(_0x308b5f){this['id']=_0x308b5f['id']||0x0;this[_0xaf55('0x0')]=_0x308b5f['name']||'';this[_0xaf55('0x1')]=_0x308b5f[_0xaf55('0x1')]||'campaign';this[_0xaf55('0x2')]=0x0;this['temp']=0x0;this[_0xaf55('0x3')]=0x0;this[_0xaf55('0x4')]=0x0;this[_0xaf55('0x5')]='';this[_0xaf55('0x6')]=!![];this[_0xaf55('0x7')]=_0x308b5f[_0xaf55('0x7')];this[_0xaf55('0x8')]=_0x308b5f['limitCalls'];this[_0xaf55('0x9')]=_0x308b5f['dialTimezone']||null;this['dialGlobalInterval']=_0x308b5f[_0xaf55('0xa')]?_0x308b5f[_0xaf55('0xa')]:null;this['dialOriginateCallerIdName']=_0x308b5f['dialOriginateCallerIdName'];this[_0xaf55('0xb')]=_0x308b5f[_0xaf55('0xb')];this[_0xaf55('0xc')]=_0x308b5f[_0xaf55('0xc')]||0x1e;this[_0xaf55('0xd')]=_0x308b5f[_0xaf55('0xd')];this[_0xaf55('0xe')]=_0x308b5f[_0xaf55('0xe')];this[_0xaf55('0xf')]=_0x308b5f[_0xaf55('0xf')];this['dialBusyRetryFrequency']=_0x308b5f[_0xaf55('0x10')];this[_0xaf55('0x11')]=_0x308b5f[_0xaf55('0x11')];this['dialNoAnswerRetryFrequency']=_0x308b5f[_0xaf55('0x12')];this[_0xaf55('0x13')]=_0x308b5f[_0xaf55('0x13')];this[_0xaf55('0x14')]=_0x308b5f['dialNoSuchNumberMaxRetry']||0x3;this[_0xaf55('0x15')]=_0x308b5f[_0xaf55('0x15')]||0x96;this[_0xaf55('0x16')]=_0x308b5f['dialDropMaxRetry']||0x3;this[_0xaf55('0x17')]=_0x308b5f[_0xaf55('0x17')]||0x96;this[_0xaf55('0x18')]=_0x308b5f[_0xaf55('0x18')]||0x3;this[_0xaf55('0x19')]=_0x308b5f[_0xaf55('0x19')]||0x96;this[_0xaf55('0x1a')]=_0x308b5f[_0xaf55('0x1a')]||0x3;this[_0xaf55('0x1b')]=_0x308b5f['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x308b5f[_0xaf55('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x308b5f[_0xaf55('0x1d')]||0x96;this[_0xaf55('0x1e')]=_0x308b5f['dialOrderByScheduledAt']||'DESC';this[_0xaf55('0x1f')]=_0x308b5f[_0xaf55('0x1f')]||undefined;this[_0xaf55('0x20')]=_0x308b5f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xaf55('0x21')]=_0x308b5f[_0xaf55('0x21')]||undefined;this['TrunkBackup']=_0x308b5f[_0xaf55('0x22')]?_0x308b5f[_0xaf55('0x22')]:undefined;this[_0xaf55('0x23')]=_0x308b5f[_0xaf55('0x23')]?_0x308b5f[_0xaf55('0x23')]:undefined;this[_0xaf55('0x24')]=_0x308b5f[_0xaf55('0x24')]?_0x308b5f['Interval']:undefined;this['SquareProject']=_0x308b5f[_0xaf55('0x25')]?_0x308b5f[_0xaf55('0x25')]:undefined;this['dialQueueProject']=_0x308b5f[_0xaf55('0x25')]?_0x308b5f[_0xaf55('0x25')]['name']:undefined;this['dialAMDActive']=_0x308b5f[_0xaf55('0x26')]||![];this['dialAMDInitialSilence']=_0x308b5f['dialAMDInitialSilence'];this[_0xaf55('0x27')]=_0x308b5f[_0xaf55('0x27')];this[_0xaf55('0x28')]=_0x308b5f['dialAMDAfterGreetingSilence'];this[_0xaf55('0x29')]=_0x308b5f[_0xaf55('0x29')];this[_0xaf55('0x2a')]=_0x308b5f[_0xaf55('0x2a')];this['dialAMDBetweenWordsSilence']=_0x308b5f['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x308b5f[_0xaf55('0x2b')];this[_0xaf55('0x2c')]=_0x308b5f[_0xaf55('0x2c')];this['dialAMDMaximumWordLength']=_0x308b5f[_0xaf55('0x2d')];}module[_0xaf55('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 978b0f8..f329f85 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 _0xbc7a=['type','tag','disposition','queue','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','billableseconds','holdtime'];(function(_0x4f34e3,_0x23a654){var _0x1b4aee=function(_0x26e5e4){while(--_0x26e5e4){_0x4f34e3['push'](_0x4f34e3['shift']());}};_0x1b4aee(++_0x23a654);}(_0xbc7a,0xa4));var _0xabc7=function(_0x4c101e,_0x5b4f56){_0x4c101e=_0x4c101e-0x0;var _0x13b1c6=_0xbc7a[_0x4c101e];return _0x13b1c6;};'use strict';function Channel(){this[_0xabc7('0x0')]=null;this[_0xabc7('0x1')]='';this[_0xabc7('0x2')]='';this['calleridnum']=0x0;this[_0xabc7('0x3')]='';this[_0xabc7('0x4')]=undefined;this[_0xabc7('0x5')]=undefined;this[_0xabc7('0x6')]=0x0;this[_0xabc7('0x7')]='';this[_0xabc7('0x8')]=0x0;this['linkedid']=0x0;this[_0xabc7('0x9')]=0x0;this[_0xabc7('0xa')]=![];this[_0xabc7('0xb')]=null;this[_0xabc7('0xc')]=null;this[_0xabc7('0xd')]=![];this[_0xabc7('0xe')]=![];this['lastapplication']='';this[_0xabc7('0xf')]='';this['duration']=0x0;this[_0xabc7('0x10')]=0x0;this[_0xabc7('0x11')]=0x0;this[_0xabc7('0x12')]=null;this[_0xabc7('0x13')]=null;this[_0xabc7('0x14')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xabc7('0x15')]=null;this['monitors']=[];this[_0xabc7('0x16')]=undefined;this[_0xabc7('0x17')]=undefined;this[_0xabc7('0x18')]=undefined;this['mohtime']=0x0;}module[_0xabc7('0x19')]=Channel; \ No newline at end of file +var _0x7d29=['exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','monitor','monitors','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','context','uniqueid','linkedid'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7d29,0x1a0));var _0x97d2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7d29[_0x465028];return _0xb783d4;};'use strict';function Channel(){this[_0x97d2('0x0')]=null;this[_0x97d2('0x1')]='';this[_0x97d2('0x2')]='';this[_0x97d2('0x3')]=0x0;this[_0x97d2('0x4')]='';this[_0x97d2('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x97d2('0x6')]='';this[_0x97d2('0x7')]=0x0;this[_0x97d2('0x8')]=0x0;this[_0x97d2('0x9')]=0x0;this[_0x97d2('0xa')]=![];this[_0x97d2('0xb')]=null;this[_0x97d2('0xc')]=null;this[_0x97d2('0xd')]=![];this[_0x97d2('0xe')]=![];this['lastapplication']='';this[_0x97d2('0xf')]='';this[_0x97d2('0x10')]=0x0;this[_0x97d2('0x11')]=0x0;this[_0x97d2('0x12')]=0x0;this['type']=null;this[_0x97d2('0x13')]=null;this['disposition']=null;this[_0x97d2('0x14')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x97d2('0x15')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x97d2('0x16')]=undefined;this[_0x97d2('0x17')]=0x0;}module[_0x97d2('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 1f671c0..2440881 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 _0xdb58=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x134557,_0x19ea33){var _0x1ab4eb=function(_0x39231d){while(--_0x39231d){_0x134557['push'](_0x134557['shift']());}};_0x1ab4eb(++_0x19ea33);}(_0xdb58,0x198));var _0x8db5=function(_0x4860aa,_0x461adb){_0x4860aa=_0x4860aa-0x0;var _0x38d168=_0xdb58[_0x4860aa];return _0x38d168;};'use strict';function DeskAccount(_0xf6807c){this['id']=_0xf6807c['id']||0x0;this[_0x8db5('0x0')]=_0xf6807c[_0x8db5('0x0')]||'';this['username']=_0xf6807c[_0x8db5('0x1')]||'';this[_0x8db5('0x2')]=_0xf6807c[_0x8db5('0x2')]||'';this['authType']=_0xf6807c[_0x8db5('0x3')]||'';this[_0x8db5('0x4')]=_0xf6807c[_0x8db5('0x4')]||'';this[_0x8db5('0x5')]=_0xf6807c[_0x8db5('0x5')]||'';this[_0x8db5('0x6')]=_0xf6807c['consumerSecret']||'';this[_0x8db5('0x7')]=_0xf6807c[_0x8db5('0x7')]||'';this[_0x8db5('0x8')]=_0xf6807c[_0x8db5('0x8')]||'';this[_0x8db5('0x9')]=_0xf6807c['type']||'';this[_0x8db5('0xa')]=_0xf6807c[_0x8db5('0xa')]||'';this[_0x8db5('0xb')]=_0xf6807c['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xc9b4=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','name','username'];(function(_0x516118,_0x26acb7){var _0x4922a8=function(_0x1780d6){while(--_0x1780d6){_0x516118['push'](_0x516118['shift']());}};_0x4922a8(++_0x26acb7);}(_0xc9b4,0x142));var _0x4c9b=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xc9b4[_0x3c4f1f];return _0x19cb69;};'use strict';function DeskAccount(_0x3e0f51){this['id']=_0x3e0f51['id']||0x0;this[_0x4c9b('0x0')]=_0x3e0f51[_0x4c9b('0x0')]||'';this[_0x4c9b('0x1')]=_0x3e0f51[_0x4c9b('0x1')]||'';this[_0x4c9b('0x2')]=_0x3e0f51[_0x4c9b('0x2')]||'';this[_0x4c9b('0x3')]=_0x3e0f51['authType']||'';this[_0x4c9b('0x4')]=_0x3e0f51[_0x4c9b('0x4')]||'';this[_0x4c9b('0x5')]=_0x3e0f51[_0x4c9b('0x5')]||'';this[_0x4c9b('0x6')]=_0x3e0f51['consumerSecret']||'';this['token']=_0x3e0f51[_0x4c9b('0x7')]||'';this['tokenSecret']=_0x3e0f51[_0x4c9b('0x8')]||'';this['type']=_0x3e0f51[_0x4c9b('0x9')]||'';this['serverUrl']=_0x3e0f51['serverUrl']||'';this['Configurations']=_0x3e0f51[_0x4c9b('0xa')]||{};}module[_0x4c9b('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 b654f0f..0f5fd45 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 _0x97f5=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x457fba,_0x595c5a){var _0x4bf61c=function(_0x3597d4){while(--_0x3597d4){_0x457fba['push'](_0x457fba['shift']());}};_0x4bf61c(++_0x595c5a);}(_0x97f5,0xe2));var _0x597f=function(_0x33ff03,_0x29aba0){_0x33ff03=_0x33ff03-0x0;var _0x350433=_0x97f5[_0x33ff03];return _0x350433;};'use strict';function Dynamics365Account(_0xd834d6){this['id']=_0xd834d6['id']||0x0;this[_0x597f('0x0')]=_0xd834d6['name']||'';this[_0x597f('0x1')]=_0xd834d6[_0x597f('0x1')]||'';this[_0x597f('0x2')]=_0xd834d6[_0x597f('0x2')]||'';this[_0x597f('0x3')]=_0xd834d6[_0x597f('0x3')]||'';this['tenantId']=_0xd834d6[_0x597f('0x4')]||'';this[_0x597f('0x5')]=_0xd834d6[_0x597f('0x5')]||'';this[_0x597f('0x6')]=_0xd834d6[_0x597f('0x6')]||{};this[_0x597f('0x7')]=_0xd834d6[_0x597f('0x7')]||'';this[_0x597f('0x8')]=_0xd834d6[_0x597f('0x8')]||![];this[_0x597f('0x9')]=_0xd834d6['Configurations']||{};this[_0x597f('0xa')]=_0xd834d6['CloudProvider']||{};}module[_0x597f('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x46d4=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3e5cb1,_0x4e998a){var _0x5056d9=function(_0x1650a9){while(--_0x1650a9){_0x3e5cb1['push'](_0x3e5cb1['shift']());}};_0x5056d9(++_0x4e998a);}(_0x46d4,0x1a9));var _0x446d=function(_0xacfd9e,_0xa9035c){_0xacfd9e=_0xacfd9e-0x0;var _0x39f473=_0x46d4[_0xacfd9e];return _0x39f473;};'use strict';function Dynamics365Account(_0x13e50f){this['id']=_0x13e50f['id']||0x0;this[_0x446d('0x0')]=_0x13e50f[_0x446d('0x0')]||'';this[_0x446d('0x1')]=_0x13e50f['username']||'';this[_0x446d('0x2')]=_0x13e50f[_0x446d('0x2')]||'';this['remoteUri']=_0x13e50f[_0x446d('0x3')]||'';this[_0x446d('0x4')]=_0x13e50f[_0x446d('0x4')]||'';this[_0x446d('0x5')]=_0x13e50f['clientId']||'';this[_0x446d('0x6')]=_0x13e50f[_0x446d('0x6')]||{};this[_0x446d('0x7')]=_0x13e50f['serverUrl']||'';this['modernAuthentication']=_0x13e50f[_0x446d('0x8')]||![];this[_0x446d('0x9')]=_0x13e50f['Configurations']||{};this[_0x446d('0xa')]=_0x13e50f[_0x446d('0xa')]||{};}module[_0x446d('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c79a049..1037a77 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 _0x5f2e=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29'];(function(_0x3be582,_0x41bac8){var _0x23a48b=function(_0x1990ac){while(--_0x1990ac){_0x3be582['push'](_0x3be582['shift']());}};_0x23a48b(++_0x41bac8);}(_0x5f2e,0x178));var _0xe5f2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f2e[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x2931b1){this['id']=_0x2931b1['id']||0x0;this['name']=_0x2931b1[_0xe5f2('0x0')]||'';this[_0xe5f2('0x1')]=_0x2931b1[_0xe5f2('0x1')];this['ecm']=_0x2931b1[_0xe5f2('0x2')];this[_0xe5f2('0x3')]=_0x2931b1[_0xe5f2('0x3')];this[_0xe5f2('0x4')]=_0x2931b1[_0xe5f2('0x4')];this['minrate']=_0x2931b1['minrate']||0x960;this[_0xe5f2('0x5')]=_0x2931b1[_0xe5f2('0x5')]||0x3840;this[_0xe5f2('0x6')]=_0x2931b1[_0xe5f2('0x6')]||_0xe5f2('0x7');this[_0xe5f2('0x8')]=_0x2931b1['gateway']||'no';this[_0xe5f2('0x9')]=_0x2931b1['faxdetect']||'no';this[_0xe5f2('0xa')]=_0x2931b1[_0xe5f2('0xa')]||0x1388;this[_0xe5f2('0xb')]=_0x2931b1[_0xe5f2('0xb')]||_0xe5f2('0xc');this[_0xe5f2('0xd')]=_0x2931b1['Trunk']?_0x2931b1[_0xe5f2('0xd')]:undefined;this[_0xe5f2('0xe')]=_0x2931b1['ListId'];this['key']=_0x2931b1['key'];}module[_0xe5f2('0xf')]=FaxAccount; \ No newline at end of file +var _0x69d4=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x2dfba2,_0x46a178){var _0x66d228=function(_0x5727ee){while(--_0x5727ee){_0x2dfba2['push'](_0x2dfba2['shift']());}};_0x66d228(++_0x46a178);}(_0x69d4,0x1a6));var _0x469d=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x69d4[_0x1678c8];return _0x387aa9;};'use strict';function FaxAccount(_0x50c9d0){this['id']=_0x50c9d0['id']||0x0;this[_0x469d('0x0')]=_0x50c9d0['name']||'';this[_0x469d('0x1')]=_0x50c9d0[_0x469d('0x1')];this['ecm']=_0x50c9d0[_0x469d('0x2')];this[_0x469d('0x3')]=_0x50c9d0[_0x469d('0x3')];this['localstationid']=_0x50c9d0['localstationid'];this['minrate']=_0x50c9d0['minrate']||0x960;this[_0x469d('0x4')]=_0x50c9d0['maxrate']||0x3840;this['modem']=_0x50c9d0[_0x469d('0x5')]||_0x469d('0x6');this[_0x469d('0x7')]=_0x50c9d0['gateway']||'no';this[_0x469d('0x8')]=_0x50c9d0[_0x469d('0x8')]||'no';this[_0x469d('0x9')]=_0x50c9d0[_0x469d('0x9')]||0x1388;this[_0x469d('0xa')]=_0x50c9d0['tech']||_0x469d('0xb');this[_0x469d('0xc')]=_0x50c9d0[_0x469d('0xc')]?_0x50c9d0[_0x469d('0xc')]:undefined;this['ListId']=_0x50c9d0[_0x469d('0xd')];this[_0x469d('0xe')]=_0x50c9d0[_0x469d('0xe')];}module[_0x469d('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c89151d..009e2a4 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 _0xb787=['token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x10f0a3,_0x4a75a9){var _0x2af3cf=function(_0x1b3f84){while(--_0x1b3f84){_0x10f0a3['push'](_0x10f0a3['shift']());}};_0x2af3cf(++_0x4a75a9);}(_0xb787,0x178));var _0x7b78=function(_0x5ce411,_0x49a3ba){_0x5ce411=_0x5ce411-0x0;var _0x346a6d=_0xb787[_0x5ce411];return _0x346a6d;};'use strict';function FreshdeskAccount(_0x4762fe){this['id']=_0x4762fe['id']||0x0;this[_0x7b78('0x0')]=_0x4762fe[_0x7b78('0x0')]||'';this['username']=_0x4762fe[_0x7b78('0x1')]||'';this['apiKey']=_0x4762fe[_0x7b78('0x2')]||'';this[_0x7b78('0x3')]=_0x4762fe[_0x7b78('0x3')]||'';this['serverUrl']=_0x4762fe[_0x7b78('0x4')]||'';this['Configurations']=_0x4762fe[_0x7b78('0x5')]||{};}module[_0x7b78('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x810a=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x25b46a,_0x31e5fe){var _0x33d48d=function(_0x5bbfb1){while(--_0x5bbfb1){_0x25b46a['push'](_0x25b46a['shift']());}};_0x33d48d(++_0x31e5fe);}(_0x810a,0x1c1));var _0xa810=function(_0x37b9a8,_0x3b146d){_0x37b9a8=_0x37b9a8-0x0;var _0x301244=_0x810a[_0x37b9a8];return _0x301244;};'use strict';function FreshdeskAccount(_0x55ead3){this['id']=_0x55ead3['id']||0x0;this[_0xa810('0x0')]=_0x55ead3[_0xa810('0x0')]||'';this[_0xa810('0x1')]=_0x55ead3[_0xa810('0x1')]||'';this[_0xa810('0x2')]=_0x55ead3[_0xa810('0x3')]||'';this[_0xa810('0x4')]=_0x55ead3[_0xa810('0x4')]||'';this[_0xa810('0x5')]=_0x55ead3[_0xa810('0x5')]||'';this[_0xa810('0x6')]=_0x55ead3[_0xa810('0x6')]||{};}module[_0xa810('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 69e3c40..861472a 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 _0x5292=['serverUrl','name','username','apiKey','token','remoteUri'];(function(_0x146214,_0x13482f){var _0x2c2acb=function(_0xb0ad23){while(--_0xb0ad23){_0x146214['push'](_0x146214['shift']());}};_0x2c2acb(++_0x13482f);}(_0x5292,0xf7));var _0x2529=function(_0x284d33,_0x5b003f){_0x284d33=_0x284d33-0x0;var _0x225cf8=_0x5292[_0x284d33];return _0x225cf8;};'use strict';function FreshsalesAccount(_0x2697a8){this['id']=_0x2697a8['id']||0x0;this[_0x2529('0x0')]=_0x2697a8['name']||'';this[_0x2529('0x1')]=_0x2697a8['username']||'';this[_0x2529('0x2')]=_0x2697a8[_0x2529('0x3')]||'';this[_0x2529('0x4')]=_0x2697a8[_0x2529('0x4')]||'';this['serverUrl']=_0x2697a8[_0x2529('0x5')]||'';this['Configurations']=_0x2697a8['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x943c=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x62bc50){this['id']=_0x62bc50['id']||0x0;this[_0xc943('0x0')]=_0x62bc50[_0xc943('0x0')]||'';this[_0xc943('0x1')]=_0x62bc50['username']||'';this['apiKey']=_0x62bc50[_0xc943('0x2')]||'';this[_0xc943('0x3')]=_0x62bc50[_0xc943('0x3')]||'';this['serverUrl']=_0x62bc50[_0xc943('0x4')]||'';this[_0xc943('0x5')]=_0x62bc50[_0xc943('0x5')]||{};}module[_0xc943('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 43daf45..5b3e62c 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 _0xd526=['accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinenum','connectedlinename'];(function(_0xa40210,_0x51c664){var _0xae0140=function(_0x259735){while(--_0x259735){_0xa40210['push'](_0xa40210['shift']());}};_0xae0140(++_0x51c664);}(_0xd526,0xa1));var _0x6d52=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd526[_0x126558];return _0x1f6d14;};'use strict';function QueueReport(){this[_0x6d52('0x0')]=_0x6d52('0x1');this[_0x6d52('0x2')]='';this['calleridnum']='';this[_0x6d52('0x3')]='';this[_0x6d52('0x4')]='';this[_0x6d52('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x6d52('0x6')]=0x1;this[_0x6d52('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x6d52('0x8')]=null;this['queuecallercomplete']=![];this[_0x6d52('0x9')]=null;this[_0x6d52('0xa')]=![];this['queuecallerexitAt']=null;this[_0x6d52('0xb')]=0x1;this['channel']='';this[_0x6d52('0xc')]='';this[_0x6d52('0xd')]='';this[_0x6d52('0xe')]='';this[_0x6d52('0xf')]='';this[_0x6d52('0x10')]='';this[_0x6d52('0x11')]='';this[_0x6d52('0x12')]=0x0;this['assigned']=![];this[_0x6d52('0x13')]='';this[_0x6d52('0x14')]=_0x6d52('0x15');this[_0x6d52('0x16')]=0x0;this[_0x6d52('0x17')]={};}module[_0x6d52('0x18')]=QueueReport; \ No newline at end of file +var _0x97f9=['holdtime','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority'];(function(_0x42a318,_0x4d20ed){var _0x254625=function(_0x13b3c9){while(--_0x13b3c9){_0x42a318['push'](_0x42a318['shift']());}};_0x254625(++_0x4d20ed);}(_0x97f9,0x1e5));var _0x997f=function(_0x41bc32,_0x406204){_0x41bc32=_0x41bc32-0x0;var _0x33cc5b=_0x97f9[_0x41bc32];return _0x33cc5b;};'use strict';function QueueReport(){this[_0x997f('0x0')]='inbound';this[_0x997f('0x1')]='';this[_0x997f('0x2')]='';this[_0x997f('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x997f('0x4')]=null;this[_0x997f('0x5')]=0x1;this[_0x997f('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x997f('0x7')]=null;this[_0x997f('0x8')]=![];this[_0x997f('0x9')]=null;this[_0x997f('0xa')]=![];this[_0x997f('0xb')]=null;this[_0x997f('0xc')]=0x1;this[_0x997f('0xd')]='';this[_0x997f('0xe')]='';this[_0x997f('0xf')]='';this['accountcode']='';this[_0x997f('0x10')]='';this[_0x997f('0x11')]='';this[_0x997f('0x12')]='';this[_0x997f('0x13')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['motionChannel']=_0x997f('0x14');this[_0x997f('0x15')]=0x0;this[_0x997f('0x16')]={};}module[_0x997f('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a026ddb..854027f 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 _0x8b71=['password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x1874c4,_0xccec01){var _0xdbeb11=function(_0x2f2279){while(--_0x2f2279){_0x1874c4['push'](_0x1874c4['shift']());}};_0xdbeb11(++_0xccec01);}(_0x8b71,0x1c0));var _0x18b7=function(_0x25f29e,_0x2938e5){_0x25f29e=_0x25f29e-0x0;var _0xd85583=_0x8b71[_0x25f29e];return _0xd85583;};'use strict';function SalesforceAccount(_0x2294a7){this['id']=_0x2294a7['id']||0x0;this[_0x18b7('0x0')]=_0x2294a7[_0x18b7('0x0')]||'';this[_0x18b7('0x1')]=_0x2294a7[_0x18b7('0x1')]||'';this[_0x18b7('0x2')]=_0x2294a7[_0x18b7('0x2')]||'';this[_0x18b7('0x3')]=_0x2294a7[_0x18b7('0x3')]||'';this[_0x18b7('0x4')]=_0x2294a7[_0x18b7('0x4')]||'';this[_0x18b7('0x5')]=_0x2294a7['clientSecret']||'';this['securityToken']=_0x2294a7['securityToken']||'';this['type']=_0x2294a7[_0x18b7('0x6')]||_0x18b7('0x7');this[_0x18b7('0x8')]=_0x2294a7['serverUrl']||'';this[_0x18b7('0x9')]=_0x2294a7[_0x18b7('0x9')]||{};}module[_0x18b7('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xda34=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','clientId','clientSecret','type'];(function(_0x1279f2,_0x428198){var _0x372389=function(_0xe5c416){while(--_0xe5c416){_0x1279f2['push'](_0x1279f2['shift']());}};_0x372389(++_0x428198);}(_0xda34,0x14e));var _0x4da3=function(_0x275f64,_0x499f01){_0x275f64=_0x275f64-0x0;var _0x23523a=_0xda34[_0x275f64];return _0x23523a;};'use strict';function SalesforceAccount(_0x5d3900){this['id']=_0x5d3900['id']||0x0;this['name']=_0x5d3900[_0x4da3('0x0')]||'';this[_0x4da3('0x1')]=_0x5d3900['username']||'';this[_0x4da3('0x2')]=_0x5d3900[_0x4da3('0x2')]||'';this['password']=_0x5d3900['password']||'';this[_0x4da3('0x3')]=_0x5d3900[_0x4da3('0x3')]||'';this[_0x4da3('0x4')]=_0x5d3900['clientSecret']||'';this['securityToken']=_0x5d3900['securityToken']||'';this['type']=_0x5d3900[_0x4da3('0x5')]||_0x4da3('0x6');this[_0x4da3('0x7')]=_0x5d3900['serverUrl']||'';this[_0x4da3('0x8')]=_0x5d3900['Configurations']||{};}module[_0x4da3('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 973896b..aae313c 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 _0x2130=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2130,0xcd));var _0x0213=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x2130[_0x32d457];return _0x338386;};'use strict';function ServicenowAccount(_0x5ed542){this['id']=_0x5ed542['id']||0x0;this[_0x0213('0x0')]=_0x5ed542[_0x0213('0x0')]||'';this[_0x0213('0x1')]=_0x5ed542['username']||'';this[_0x0213('0x2')]=_0x5ed542[_0x0213('0x2')]||'';this[_0x0213('0x3')]=_0x5ed542[_0x0213('0x3')]||'';this['serverUrl']=_0x5ed542[_0x0213('0x4')]||'';this['Configurations']=_0x5ed542[_0x0213('0x5')]||{};}module[_0x0213('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x13ba=['name','username','password','serverUrl'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x13ba,0x90));var _0xa13b=function(_0x24ca1f,_0x3d2164){_0x24ca1f=_0x24ca1f-0x0;var _0x5f4222=_0x13ba[_0x24ca1f];return _0x5f4222;};'use strict';function ServicenowAccount(_0x2b7c05){this['id']=_0x2b7c05['id']||0x0;this[_0xa13b('0x0')]=_0x2b7c05[_0xa13b('0x0')]||'';this[_0xa13b('0x1')]=_0x2b7c05[_0xa13b('0x1')]||'';this[_0xa13b('0x2')]=_0x2b7c05[_0xa13b('0x2')]||'';this['remoteUri']=_0x2b7c05['remoteUri']||'';this[_0xa13b('0x3')]=_0x2b7c05[_0xa13b('0x3')]||'';this['Configurations']=_0x2b7c05['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a724f48..e91aead 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 _0x46b7=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x37dd9d,_0x317c54){var _0x33ec83=function(_0x243af0){while(--_0x243af0){_0x37dd9d['push'](_0x37dd9d['shift']());}};_0x33ec83(++_0x317c54);}(_0x46b7,0xf0));var _0x746b=function(_0x33b0ab,_0x2478f4){_0x33b0ab=_0x33b0ab-0x0;var _0x477be1=_0x46b7[_0x33b0ab];return _0x477be1;};'use strict';function SugarcrmAccount(_0x160079){this['id']=_0x160079['id']||0x0;this[_0x746b('0x0')]=_0x160079[_0x746b('0x0')]||'';this[_0x746b('0x1')]=_0x160079[_0x746b('0x1')]||'';this[_0x746b('0x2')]=_0x160079[_0x746b('0x2')]||'';this['remoteUri']=_0x160079[_0x746b('0x3')]||'';this[_0x746b('0x4')]=_0x160079[_0x746b('0x4')]||'';this['Configurations']=_0x160079[_0x746b('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xbc19=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x1f1159,_0x93c141){var _0x32e8fa=function(_0x44a1a9){while(--_0x44a1a9){_0x1f1159['push'](_0x1f1159['shift']());}};_0x32e8fa(++_0x93c141);}(_0xbc19,0x184));var _0x9bc1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc19[_0x321bb2];return _0x9c12ed;};'use strict';function SugarcrmAccount(_0x315773){this['id']=_0x315773['id']||0x0;this[_0x9bc1('0x0')]=_0x315773[_0x9bc1('0x0')]||'';this['username']=_0x315773['username']||'';this[_0x9bc1('0x1')]=_0x315773['password']||'';this[_0x9bc1('0x2')]=_0x315773[_0x9bc1('0x2')]||'';this[_0x9bc1('0x3')]=_0x315773[_0x9bc1('0x3')]||'';this[_0x9bc1('0x4')]=_0x315773[_0x9bc1('0x4')]||{};}module[_0x9bc1('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 10351d3..d2fec8c 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 _0xd732=['unknown','exports','name','state'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd732,0x18e));var _0x2d73=function(_0x47f113,_0x122064){_0x47f113=_0x47f113-0x0;var _0x38f734=_0xd732[_0x47f113];return _0x38f734;};'use strict';function Telephone(_0x45bd01){this['id']=_0x45bd01['id']||0x0;this['name']=_0x45bd01[_0x2d73('0x0')]||'';this['accountcode']=_0x45bd01['accountcode']||'';this[_0x2d73('0x1')]=_0x2d73('0x2');this['stateTime']=0x0;this['status']=_0x2d73('0x2');this['address']='';}module[_0x2d73('0x3')]=Telephone; \ No newline at end of file +var _0xbc48=['unknown','address','exports','name','accountcode','state','stateTime','status'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0xbc48,0x16b));var _0x8bc4=function(_0x27e044,_0x103854){_0x27e044=_0x27e044-0x0;var _0x49f8b4=_0xbc48[_0x27e044];return _0x49f8b4;};'use strict';function Telephone(_0x3cfa93){this['id']=_0x3cfa93['id']||0x0;this[_0x8bc4('0x0')]=_0x3cfa93[_0x8bc4('0x0')]||'';this[_0x8bc4('0x1')]=_0x3cfa93['accountcode']||'';this[_0x8bc4('0x2')]='unknown';this[_0x8bc4('0x3')]=0x0;this[_0x8bc4('0x4')]=_0x8bc4('0x5');this[_0x8bc4('0x6')]='';}module[_0x8bc4('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 24dee7c..0d2eb54 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x1f1474,_0x20e897){var _0x3c5c2d=function(_0x2ad3f3){while(--_0x2ad3f3){_0x1f1474['push'](_0x1f1474['shift']());}};_0x3c5c2d(++_0x20e897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x3de587,_0x273d2c){var _0x2acc49=function(_0x382b9f){while(--_0x382b9f){_0x3de587['push'](_0x3de587['shift']());}};_0x2acc49(++_0x273d2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 3d1cbd7..5f17b7f 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x55ccc7,_0x48149c){var _0x132989=function(_0x3a545f){while(--_0x3a545f){_0x55ccc7['push'](_0x55ccc7['shift']());}};_0x132989(++_0x48149c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x24fd1f,_0x1e38bd){_0x24fd1f=_0x24fd1f-0x0;var _0x3c0329=_0x9ffd[_0x24fd1f];return _0x3c0329;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x2c00ac,_0x200c26){var _0x33e2f8=function(_0x257ab0){while(--_0x257ab0){_0x2c00ac['push'](_0x2c00ac['shift']());}};_0x33e2f8(++_0x200c26);}(_0xda2d,0x102));var _0xdda2=function(_0x348e1d,_0x3ad622){_0x348e1d=_0x348e1d-0x0;var _0x1fe9c2=_0xda2d[_0x348e1d];return _0x1fe9c2;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7049d73..af8ddca 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 _0xc345=['registrationtime','address','defaultuser','active','name','state','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc345,0x73));var _0x5c34=function(_0x496ee9,_0x4dba12){_0x496ee9=_0x496ee9-0x0;var _0xb7016a=_0xc345[_0x496ee9];return _0xb7016a;};'use strict';function Trunk(_0x397943){this['id']=_0x397943['id']||0x0;this[_0x5c34('0x0')]=_0x397943['active']||![];this[_0x5c34('0x1')]=_0x397943[_0x5c34('0x1')]||'';this[_0x5c34('0x2')]=_0x5c34('0x3');this['stateTime']=0x0;this['status']=_0x5c34('0x3');this['registry']=_0x397943[_0x5c34('0x4')]&&_0x397943[_0x5c34('0x4')][_0x5c34('0x5')](':')?_0x397943[_0x5c34('0x4')][_0x5c34('0x6')](':')[0x0]:'';this[_0x5c34('0x7')]='';this[_0x5c34('0x8')]='';this[_0x5c34('0x9')]='';this[_0x5c34('0xa')]='';this[_0x5c34('0xb')]='';this[_0x5c34('0xc')]='unknown';this[_0x5c34('0xd')]='';this[_0x5c34('0xe')]='';this[_0x5c34('0xf')]=_0x397943[_0x5c34('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xc683=['stateRegistry','address','defaultuser','active','name','state','unknown','stateTime','registry','split','host','port','domain','domainport','refresh'];(function(_0x30d119,_0x1f250b){var _0x4aad53=function(_0x4d6352){while(--_0x4d6352){_0x30d119['push'](_0x30d119['shift']());}};_0x4aad53(++_0x1f250b);}(_0xc683,0xe4));var _0x3c68=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xc683[_0x48b810];return _0x23c17d;};'use strict';function Trunk(_0xd9374d){this['id']=_0xd9374d['id']||0x0;this[_0x3c68('0x0')]=_0xd9374d[_0x3c68('0x0')]||![];this[_0x3c68('0x1')]=_0xd9374d['name']||'';this[_0x3c68('0x2')]=_0x3c68('0x3');this[_0x3c68('0x4')]=0x0;this['status']=_0x3c68('0x3');this[_0x3c68('0x5')]=_0xd9374d[_0x3c68('0x5')]&&_0xd9374d[_0x3c68('0x5')]['indexOf'](':')?_0xd9374d['registry'][_0x3c68('0x6')](':')[0x0]:'';this[_0x3c68('0x7')]='';this[_0x3c68('0x8')]='';this[_0x3c68('0x9')]='';this[_0x3c68('0xa')]='';this[_0x3c68('0xb')]='';this[_0x3c68('0xc')]=_0x3c68('0x3');this['registrationtime']='';this[_0x3c68('0xd')]='';this[_0x3c68('0xe')]=_0xd9374d[_0x3c68('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d355162..ebf4749 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 _0x6dcc=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6dcc,0x1ee));var _0xc6dc=function(_0x3c3002,_0x1b4de1){_0x3c3002=_0x3c3002-0x0;var _0x4fe4f5=_0x6dcc[_0x3c3002];return _0x4fe4f5;};'use strict';function voiceExtension(_0x2b7e1c){this['id']=_0x2b7e1c['id']||0x0;this['exten']=_0x2b7e1c[_0xc6dc('0x0')]||'';this[_0xc6dc('0x1')]=_0x2b7e1c['recordingFormat']||_0xc6dc('0x2');this['mandatoryDisposition']=_0x2b7e1c[_0xc6dc('0x3')]||![];}module[_0xc6dc('0x4')]=voiceExtension; \ No newline at end of file +var _0x4937=['mandatoryDisposition','exports','recordingFormat','none'];(function(_0x11bbd5,_0x441a32){var _0x1d4986=function(_0x543f24){while(--_0x543f24){_0x11bbd5['push'](_0x11bbd5['shift']());}};_0x1d4986(++_0x441a32);}(_0x4937,0x1b2));var _0x7493=function(_0x3b1481,_0x52bcd4){_0x3b1481=_0x3b1481-0x0;var _0x1fe2a9=_0x4937[_0x3b1481];return _0x1fe2a9;};'use strict';function voiceExtension(_0x3aabc5){this['id']=_0x3aabc5['id']||0x0;this['exten']=_0x3aabc5['exten']||'';this[_0x7493('0x0')]=_0x3aabc5[_0x7493('0x0')]||_0x7493('0x1');this[_0x7493('0x2')]=_0x3aabc5[_0x7493('0x2')]||![];}module[_0x7493('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index b779635..18e1a6d 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 _0x8b8e=['dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','gsm','leastrecent','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','sumDuration','sumHoldTime','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x8b8e,0x108));var _0xe8b8=function(_0x481821,_0x4814e8){_0x481821=_0x481821-0x0;var _0x4f008d=_0x8b8e[_0x481821];return _0x4f008d;};'use strict';var monitorFormat={'wav':_0xe8b8('0x0'),'wav49':'wav49','gsm':_0xe8b8('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xe8b8('0x2'),'linear':'linear','random':'random','ringall':_0xe8b8('0x3'),'rr':_0xe8b8('0x4'),'rrmemory':_0xe8b8('0x5'),'rrordered':_0xe8b8('0x6'),'wrandom':_0xe8b8('0x7')};function VoiceQueue(_0x3f5dd7){this['id']=_0x3f5dd7['id']||0x0;this[_0xe8b8('0x8')]=_0x3f5dd7[_0xe8b8('0x8')]||'';this[_0xe8b8('0x9')]=_0x3f5dd7[_0xe8b8('0x9')]||'';this['type']=_0x3f5dd7[_0xe8b8('0xa')]||'inbound';this[_0xe8b8('0xb')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xe8b8('0xc')]=0x0;this[_0xe8b8('0xd')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xe8b8('0xe')]=0x0;this[_0xe8b8('0xf')]=0x0;this[_0xe8b8('0x10')]=0x0;this[_0xe8b8('0x11')]=0x0;this[_0xe8b8('0x12')]=0x0;this[_0xe8b8('0x13')]=0x0;this[_0xe8b8('0x14')]=0x0;this[_0xe8b8('0x15')]=0x0;this[_0xe8b8('0x16')]=0x0;this[_0xe8b8('0x17')]=0x0;this[_0xe8b8('0x18')]=0x0;this[_0xe8b8('0x19')]=0x0;this[_0xe8b8('0x1a')]=0x0;this[_0xe8b8('0x1b')]=0x0;this['acw']=_0x3f5dd7[_0xe8b8('0x1c')]||![];this['acwTimeout']=_0x3f5dd7[_0xe8b8('0x1d')]||0xa;this[_0xe8b8('0x1e')]=_0x3f5dd7[_0xe8b8('0x1e')]||'no';this[_0xe8b8('0x1f')]=!![];this[_0xe8b8('0x20')]='';this[_0xe8b8('0x21')]='';this[_0xe8b8('0x22')]=0x0;this[_0xe8b8('0x23')]=0x0;this[_0xe8b8('0x24')]=_0x3f5dd7[_0xe8b8('0x24')]||null;this['dialGlobalInterval']=_0x3f5dd7[_0xe8b8('0x25')]?_0x3f5dd7[_0xe8b8('0x25')]:null;this['dialActive']=_0x3f5dd7[_0xe8b8('0x26')];this[_0xe8b8('0x27')]=_0x3f5dd7[_0xe8b8('0x27')]||_0xe8b8('0x28');this[_0xe8b8('0x29')]=_0x3f5dd7[_0xe8b8('0x29')]||0x0;this[_0xe8b8('0x2a')]=_0x3f5dd7[_0xe8b8('0x2a')]||0x0;this[_0xe8b8('0x2b')]=_0x3f5dd7[_0xe8b8('0x2b')]||0x1;this[_0xe8b8('0x2c')]=_0x3f5dd7[_0xe8b8('0x2c')]||_0xe8b8('0x2d');this[_0xe8b8('0x2e')]=_0x3f5dd7[_0xe8b8('0x2e')]||0.03;this[_0xe8b8('0x2f')]=_0x3f5dd7[_0xe8b8('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x3f5dd7['dialOriginateCallerIdName']||'anonymous';this[_0xe8b8('0x30')]=_0x3f5dd7['dialOriginateCallerIdNumber']||_0xe8b8('0x31');this['dialOriginateTimeout']=_0x3f5dd7[_0xe8b8('0x32')]||0x1e;this[_0xe8b8('0x33')]=_0x3f5dd7['dialQueueOptions']||'tTxX';this[_0xe8b8('0x34')]=_0x3f5dd7[_0xe8b8('0x34')]||0x3;this['dialQueueProject']=_0x3f5dd7[_0xe8b8('0x35')]||undefined;this[_0xe8b8('0x36')]=_0x3f5dd7[_0xe8b8('0x36')]||0x3;this[_0xe8b8('0x37')]=_0x3f5dd7[_0xe8b8('0x37')]||0x96;this['dialBusyMaxRetry']=_0x3f5dd7[_0xe8b8('0x38')]||0x3;this['dialBusyRetryFrequency']=_0x3f5dd7[_0xe8b8('0x39')]||0x96;this[_0xe8b8('0x3a')]=_0x3f5dd7[_0xe8b8('0x3a')]||0x3;this[_0xe8b8('0x3b')]=_0x3f5dd7['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x3f5dd7[_0xe8b8('0x3c')]||0x3;this[_0xe8b8('0x3d')]=_0x3f5dd7[_0xe8b8('0x3d')]||0x96;this[_0xe8b8('0x3e')]=_0x3f5dd7[_0xe8b8('0x3e')]||0x3;this['dialDropRetryFrequency']=_0x3f5dd7[_0xe8b8('0x3f')]||0x96;this[_0xe8b8('0x40')]=_0x3f5dd7[_0xe8b8('0x40')]||0x3;this[_0xe8b8('0x41')]=_0x3f5dd7[_0xe8b8('0x41')]||0x96;this[_0xe8b8('0x42')]=_0x3f5dd7[_0xe8b8('0x42')]||0x3;this[_0xe8b8('0x43')]=_0x3f5dd7[_0xe8b8('0x43')]||0x96;this[_0xe8b8('0x44')]=_0x3f5dd7[_0xe8b8('0x44')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3f5dd7[_0xe8b8('0x45')]||0x96;this[_0xe8b8('0x46')]=_0x3f5dd7[_0xe8b8('0x46')]||0x3;this['dialGlobalMaxRetry']=_0x3f5dd7[_0xe8b8('0x47')]||0x4;this[_0xe8b8('0x48')]=_0x3f5dd7[_0xe8b8('0x48')]?_0x3f5dd7[_0xe8b8('0x48')]:undefined;this[_0xe8b8('0x49')]=_0x3f5dd7[_0xe8b8('0x49')]?_0x3f5dd7[_0xe8b8('0x49')]:undefined;this[_0xe8b8('0x4a')]=_0x3f5dd7[_0xe8b8('0x4a')]||undefined;this['Interval']=_0x3f5dd7[_0xe8b8('0x4b')]?_0x3f5dd7[_0xe8b8('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0x3f5dd7[_0xe8b8('0x4c')]||_0xe8b8('0x4d');this[_0xe8b8('0x4e')]=_0x3f5dd7[_0xe8b8('0x4e')]||undefined;this[_0xe8b8('0x4f')]=_0x3f5dd7['dialCutDigit']||undefined;this[_0xe8b8('0x50')]=strategy[_0x3f5dd7[_0xe8b8('0x50')]];this[_0xe8b8('0x51')]=!![];this[_0xe8b8('0x52')]=_0x3f5dd7[_0xe8b8('0x52')]||![];this[_0xe8b8('0x53')]=_0x3f5dd7['dialAMDInitialSilence'];this[_0xe8b8('0x54')]=_0x3f5dd7['dialAMDGreeting'];this[_0xe8b8('0x55')]=_0x3f5dd7[_0xe8b8('0x55')];this['dialAMDTotalAnalysisTime']=_0x3f5dd7['dialAMDTotalAnalysisTime'];this[_0xe8b8('0x56')]=_0x3f5dd7[_0xe8b8('0x56')];this[_0xe8b8('0x57')]=_0x3f5dd7[_0xe8b8('0x57')];this['dialAMDMaximumNumberOfWords']=_0x3f5dd7[_0xe8b8('0x58')];this[_0xe8b8('0x59')]=_0x3f5dd7[_0xe8b8('0x59')];this[_0xe8b8('0x5a')]=_0x3f5dd7[_0xe8b8('0x5a')];this[_0xe8b8('0x5b')]=0x0;this[_0xe8b8('0x5c')]=0x0;this[_0xe8b8('0x5d')]=_0x3f5dd7['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xe8b8('0x5e')]=0x0;this[_0xe8b8('0x5f')]=0x0;this[_0xe8b8('0x60')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xe8b8('0x61')]=0x0;this[_0xe8b8('0x62')]=0x0;this[_0xe8b8('0x63')]=0x0;this[_0xe8b8('0x64')]=0x0;this[_0xe8b8('0x65')]=0x0;this[_0xe8b8('0x66')]=0x0;this[_0xe8b8('0x67')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xe8b8('0x68')]=undefined;this[_0xe8b8('0x69')]=undefined;this[_0xe8b8('0x6a')]=1.05;this[_0xe8b8('0x6b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xe8b8('0x6c')]=0x0;this[_0xe8b8('0x6d')]=0x0;this[_0xe8b8('0x6e')]=0x0;this[_0xe8b8('0x6f')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xe8b8('0x70')]=_0x3f5dd7[_0xe8b8('0x71')]||0x14;this[_0xe8b8('0x72')]=_0x3f5dd7['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xe8b8('0x73')]=0x0;this[_0xe8b8('0x74')]=0x0;this[_0xe8b8('0x75')]=0x1;this[_0xe8b8('0x76')]=0x0;this['erlangCallToSecond']=0x0;this[_0xe8b8('0x77')]=0x0;this[_0xe8b8('0x78')]=0x0;this[_0xe8b8('0x79')]=_0x3f5dd7[_0xe8b8('0x79')]||0x1e;this[_0xe8b8('0x7a')]=_0x3f5dd7[_0xe8b8('0x7a')]||![];this[_0xe8b8('0x7b')]=!!_0x3f5dd7[_0xe8b8('0x7b')]||![];this[_0xe8b8('0x7c')]=!!_0x3f5dd7[_0xe8b8('0x7c')]||![];this[_0xe8b8('0x7d')]=_0x3f5dd7[_0xe8b8('0x7d')]||undefined;this['dialAgiAfterHangupClient']=_0x3f5dd7['dialAgiAfterHangupClient']||![];this[_0xe8b8('0x7e')]=_0x3f5dd7[_0xe8b8('0x7e')]||![];this[_0xe8b8('0x9')]=monitorFormat[_0x3f5dd7[_0xe8b8('0x9')]]?monitorFormat[_0x3f5dd7[_0xe8b8('0x9')]]:undefined;this[_0xe8b8('0x7f')]=_0x3f5dd7[_0xe8b8('0x7f')]||![];this['mandatoryDispositionPause']=_0x3f5dd7['mandatoryDispositionPause']?_0x3f5dd7[_0xe8b8('0x80')]:undefined;this[_0xe8b8('0x81')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x559f=['ringall','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','random'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x559f,0x102));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':_0xf559('0x0'),'wav49':'wav49','gsm':_0xf559('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xf559('0x2'),'linear':'linear','random':_0xf559('0x3'),'ringall':_0xf559('0x4'),'rr':_0xf559('0x5'),'rrmemory':_0xf559('0x6'),'rrordered':_0xf559('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x2bbd1a){this['id']=_0x2bbd1a['id']||0x0;this[_0xf559('0x8')]=_0x2bbd1a['name']||'';this['monitor_format']=_0x2bbd1a[_0xf559('0x9')]||'';this['type']=_0x2bbd1a[_0xf559('0xa')]||_0xf559('0xb');this[_0xf559('0xc')]=0x0;this[_0xf559('0xd')]=0x0;this[_0xf559('0xe')]=0x0;this[_0xf559('0xf')]=0x0;this[_0xf559('0x10')]=0x0;this[_0xf559('0x11')]=0x0;this['unmanaged']=0x0;this[_0xf559('0x12')]=0x0;this[_0xf559('0x13')]=0x0;this['busy']=0x0;this[_0xf559('0x14')]=0x0;this[_0xf559('0x15')]=0x0;this['loggedIn']=0x0;this[_0xf559('0x16')]=0x0;this[_0xf559('0x17')]=0x0;this[_0xf559('0x18')]=0x0;this['ringing']=0x0;this[_0xf559('0x19')]=0x0;this[_0xf559('0x1a')]=0x0;this[_0xf559('0x1b')]=0x0;this[_0xf559('0x1c')]=0x0;this[_0xf559('0x1d')]=_0x2bbd1a[_0xf559('0x1d')]||![];this[_0xf559('0x1e')]=_0x2bbd1a[_0xf559('0x1e')]||0xa;this[_0xf559('0x1f')]=_0x2bbd1a[_0xf559('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xf559('0x20')]='';this[_0xf559('0x21')]=0x0;this[_0xf559('0x22')]=0x0;this[_0xf559('0x23')]=_0x2bbd1a['dialTimezone']||null;this[_0xf559('0x24')]=_0x2bbd1a[_0xf559('0x24')]?_0x2bbd1a[_0xf559('0x24')]:null;this[_0xf559('0x25')]=_0x2bbd1a[_0xf559('0x25')];this['dialMethod']=_0x2bbd1a[_0xf559('0x26')]||'progressive';this[_0xf559('0x27')]=_0x2bbd1a['dialLimitChannel']||0x0;this[_0xf559('0x28')]=_0x2bbd1a[_0xf559('0x28')]||0x0;this[_0xf559('0x29')]=_0x2bbd1a[_0xf559('0x29')]||0x1;this[_0xf559('0x2a')]=_0x2bbd1a[_0xf559('0x2a')]||_0xf559('0x2b');this[_0xf559('0x2c')]=_0x2bbd1a[_0xf559('0x2c')]||0.03;this['dialPredictiveInterval']=_0x2bbd1a[_0xf559('0x2d')]||0x258;this['dialOriginateCallerIdName']=_0x2bbd1a[_0xf559('0x2e')]||_0xf559('0x2f');this[_0xf559('0x30')]=_0x2bbd1a['dialOriginateCallerIdNumber']||'anonymous';this[_0xf559('0x31')]=_0x2bbd1a[_0xf559('0x31')]||0x1e;this[_0xf559('0x32')]=_0x2bbd1a['dialQueueOptions']||_0xf559('0x33');this[_0xf559('0x34')]=_0x2bbd1a[_0xf559('0x34')]||0x3;this['dialQueueProject']=_0x2bbd1a[_0xf559('0x35')]||undefined;this[_0xf559('0x36')]=_0x2bbd1a[_0xf559('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x2bbd1a[_0xf559('0x37')]||0x96;this[_0xf559('0x38')]=_0x2bbd1a['dialBusyMaxRetry']||0x3;this[_0xf559('0x39')]=_0x2bbd1a[_0xf559('0x39')]||0x96;this['dialNoAnswerMaxRetry']=_0x2bbd1a[_0xf559('0x3a')]||0x3;this[_0xf559('0x3b')]=_0x2bbd1a['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x2bbd1a['dialNoSuchNumberMaxRetry']||0x3;this[_0xf559('0x3c')]=_0x2bbd1a[_0xf559('0x3c')]||0x96;this['dialDropMaxRetry']=_0x2bbd1a[_0xf559('0x3d')]||0x3;this[_0xf559('0x3e')]=_0x2bbd1a[_0xf559('0x3e')]||0x96;this[_0xf559('0x3f')]=_0x2bbd1a[_0xf559('0x3f')]||0x3;this[_0xf559('0x40')]=_0x2bbd1a[_0xf559('0x40')]||0x96;this['dialMachineMaxRetry']=_0x2bbd1a[_0xf559('0x41')]||0x3;this[_0xf559('0x42')]=_0x2bbd1a[_0xf559('0x42')]||0x96;this[_0xf559('0x43')]=_0x2bbd1a[_0xf559('0x43')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2bbd1a[_0xf559('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x2bbd1a[_0xf559('0x45')]||0x3;this[_0xf559('0x46')]=_0x2bbd1a[_0xf559('0x46')]||0x4;this[_0xf559('0x47')]=_0x2bbd1a[_0xf559('0x47')]?_0x2bbd1a[_0xf559('0x47')]:undefined;this[_0xf559('0x48')]=_0x2bbd1a[_0xf559('0x48')]?_0x2bbd1a[_0xf559('0x48')]:undefined;this[_0xf559('0x49')]=_0x2bbd1a[_0xf559('0x49')]||undefined;this['Interval']=_0x2bbd1a[_0xf559('0x4a')]?_0x2bbd1a['Interval']:undefined;this[_0xf559('0x4b')]=_0x2bbd1a[_0xf559('0x4b')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x2bbd1a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xf559('0x4c')]=_0x2bbd1a[_0xf559('0x4c')]||undefined;this[_0xf559('0x4d')]=strategy[_0x2bbd1a[_0xf559('0x4d')]];this[_0xf559('0x4e')]=!![];this[_0xf559('0x4f')]=_0x2bbd1a['dialAMDActive']||![];this[_0xf559('0x50')]=_0x2bbd1a['dialAMDInitialSilence'];this[_0xf559('0x51')]=_0x2bbd1a['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2bbd1a[_0xf559('0x52')];this[_0xf559('0x53')]=_0x2bbd1a[_0xf559('0x53')];this[_0xf559('0x54')]=_0x2bbd1a[_0xf559('0x54')];this['dialAMDBetweenWordsSilence']=_0x2bbd1a[_0xf559('0x55')];this[_0xf559('0x56')]=_0x2bbd1a[_0xf559('0x56')];this[_0xf559('0x57')]=_0x2bbd1a[_0xf559('0x57')];this[_0xf559('0x58')]=_0x2bbd1a[_0xf559('0x58')];this[_0xf559('0x59')]=0x0;this['pTalking']=0x0;this['timeout']=_0x2bbd1a['timeout'];this[_0xf559('0x5a')]=0x0;this[_0xf559('0x5b')]=0x0;this[_0xf559('0x5c')]=0x0;this[_0xf559('0x5d')]=0x0;this[_0xf559('0x5e')]=0x0;this[_0xf559('0x5f')]=0x0;this[_0xf559('0x60')]=0x0;this[_0xf559('0x61')]=0x0;this[_0xf559('0x62')]=0x0;this[_0xf559('0x63')]=0x0;this[_0xf559('0x64')]=0x0;this[_0xf559('0x65')]=0x0;this[_0xf559('0x66')]=0x0;this[_0xf559('0x67')]=0x0;this[_0xf559('0x68')]=undefined;this[_0xf559('0x69')]=undefined;this[_0xf559('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xf559('0x6b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xf559('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf559('0x6d')]=0x0;this[_0xf559('0x6e')]=0x0;this[_0xf559('0x6f')]=0x0;this[_0xf559('0x70')]=_0x2bbd1a[_0xf559('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x2bbd1a[_0xf559('0x71')]||0xa;this[_0xf559('0x72')]=0x0;this[_0xf559('0x73')]=0x0;this[_0xf559('0x74')]=0x1;this[_0xf559('0x75')]=0x0;this[_0xf559('0x76')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xf559('0x77')]=0x0;this['dialRecallMeTimeout']=_0x2bbd1a[_0xf559('0x78')]||0x1e;this[_0xf559('0x79')]=_0x2bbd1a[_0xf559('0x79')]||![];this['dialPreviewAutoRecallMe']=!!_0x2bbd1a[_0xf559('0x7a')]||![];this[_0xf559('0x7b')]=!!_0x2bbd1a['dialPreviewRecallmeReminder']||![];this[_0xf559('0x7c')]=_0x2bbd1a['dialQueueProject2']||undefined;this[_0xf559('0x7d')]=_0x2bbd1a[_0xf559('0x7d')]||![];this[_0xf559('0x7e')]=_0x2bbd1a[_0xf559('0x7e')]||![];this[_0xf559('0x9')]=monitorFormat[_0x2bbd1a[_0xf559('0x9')]]?monitorFormat[_0x2bbd1a[_0xf559('0x9')]]:undefined;this[_0xf559('0x7f')]=_0x2bbd1a[_0xf559('0x7f')]||![];this['mandatoryDispositionPause']=_0x2bbd1a[_0xf559('0x80')]?_0x2bbd1a[_0xf559('0x80')]:undefined;this[_0xf559('0x81')]=![];}module[_0xf559('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2aa03c8..b5f7fc9 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['createReport','callers','length','online','incall','includes','status','booked','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','dialActive','updateReportFromOutboundQueue','outboundNoAnswerCallsDay','preview','available','loggedIn','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','strategy','abandoned','busy','invalid','loggedInDb','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','name','active','callerid'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0xa41a,0x6b));var _0xaa41=function(_0x23bb94,_0x250cb1){_0x23bb94=_0x23bb94-0x0;var _0x138821=_0xa41a[_0x23bb94];return _0x138821;};'use strict';var INBOUND_COUNTERS=[_0xaa41('0x0'),_0xaa41('0x1'),'loggedInDb',_0xaa41('0x2'),_0xaa41('0x3'),_0xaa41('0x4'),_0xaa41('0x5')];var OUTBOUND_COUNTERS=[_0xaa41('0x0'),_0xaa41('0x6'),_0xaa41('0x7'),_0xaa41('0x1'),'loggedInDb',_0xaa41('0x8'),_0xaa41('0x9'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0xaa41('0xa'),_0xaa41('0xb'),'outboundNoAnswerCallsDay',_0xaa41('0xc'),_0xaa41('0xd'),_0xaa41('0xe'),_0xaa41('0xf'),_0xaa41('0x2'),_0xaa41('0x10'),_0xaa41('0x4'),_0xaa41('0x11'),_0xaa41('0x12'),'total',_0xaa41('0x5')];function VoiceQueueSummary(_0x10cda9){this['id']=_0x10cda9['id'];this['name']=_0x10cda9['name'];this[_0xaa41('0x13')]=_0x10cda9['strategy'];this[_0xaa41('0x14')]=_0x10cda9[_0xaa41('0x14')]||0x0;this[_0xaa41('0x6')]=_0x10cda9[_0xaa41('0x6')]||0x0;this[_0xaa41('0x0')]=_0x10cda9['available']||0x0;this[_0xaa41('0x15')]=_0x10cda9[_0xaa41('0x15')]||0x0;this[_0xaa41('0x7')]=_0x10cda9[_0xaa41('0x7')]||0x0;this[_0xaa41('0x16')]=_0x10cda9[_0xaa41('0x16')]||0x0;this[_0xaa41('0x1')]=_0x10cda9['loggedIn']||0x0;this[_0xaa41('0x17')]=_0x10cda9[_0xaa41('0x17')]||0x0;this[_0xaa41('0x18')]=_0x10cda9[_0xaa41('0x18')]||0x0;this[_0xaa41('0x19')]=_0x10cda9[_0xaa41('0x19')]||0x0;this[_0xaa41('0x2')]=_0x10cda9[_0xaa41('0x2')]||0x0;this[_0xaa41('0x3')]=_0x10cda9['ringing']||0x0;this['ringInUse']=_0x10cda9[_0xaa41('0x1a')];this[_0xaa41('0x11')]=_0x10cda9[_0xaa41('0x11')];this['sumDuration']=_0x10cda9[_0xaa41('0x12')];this[_0xaa41('0x1b')]=_0x10cda9['sumHoldTime']||0x0;this['talking']=_0x10cda9[_0xaa41('0x4')]||0x0;this['total']=_0x10cda9[_0xaa41('0x1c')]||0x0;this[_0xaa41('0x1d')]=_0x10cda9[_0xaa41('0x1d')];this[_0xaa41('0x1e')]=_0x10cda9[_0xaa41('0x1e')]||0x0;this['unknown']=_0x10cda9[_0xaa41('0x1f')]||0x0;this[_0xaa41('0x20')]=_0x10cda9[_0xaa41('0x20')]||0x0;this[_0xaa41('0x5')]=_0x10cda9[_0xaa41('0x5')]||0x0;if(_0x10cda9[_0xaa41('0x1d')]==='outbound'){this['pTalking']=_0x10cda9[_0xaa41('0x10')]||0x0;this['dialActive']=_0x10cda9['dialActive'];this[_0xaa41('0x21')]=_0x10cda9['dialMethod'];this['dialOriginateCallerIdName']=_0x10cda9[_0xaa41('0x22')];this[_0xaa41('0x23')]=_0x10cda9[_0xaa41('0x23')];this[_0xaa41('0x24')]=_0x10cda9[_0xaa41('0x24')];this[_0xaa41('0x25')]=_0x10cda9['dialPrefix'];this[_0xaa41('0x26')]=_0x10cda9[_0xaa41('0x26')];this[_0xaa41('0x27')]=_0x10cda9[_0xaa41('0x27')];this[_0xaa41('0x28')]=_0x10cda9[_0xaa41('0x28')];this[_0xaa41('0x29')]=_0x10cda9[_0xaa41('0x29')];this['outboundBusyCallsDay']=_0x10cda9[_0xaa41('0xa')];this['outboundCongestionCallsDay']=_0x10cda9['outboundCongestionCallsDay'];this[_0xaa41('0x2a')]=_0x10cda9[_0xaa41('0x2a')];this['outboundDropCallsDayCallersExit']=_0x10cda9[_0xaa41('0x2b')];this[_0xaa41('0x2c')]=_0x10cda9['outboundDropCallsDayTimeout'];this['outboundNoAnswerCallsDay']=_0x10cda9['outboundNoAnswerCallsDay'];this[_0xaa41('0xc')]=_0x10cda9[_0xaa41('0xc')];this[_0xaa41('0x2d')]=_0x10cda9[_0xaa41('0x2d')];this['outboundReCallsDay']=_0x10cda9[_0xaa41('0xd')];this[_0xaa41('0xe')]=_0x10cda9[_0xaa41('0xe')];this['outboundUnknownCallsDay']=_0x10cda9[_0xaa41('0xf')];this[_0xaa41('0x2e')]=_0x10cda9[_0xaa41('0x2e')];this['predictiveIntervalAvgHoldtime']=_0x10cda9[_0xaa41('0x2f')];this[_0xaa41('0x30')]=_0x10cda9['predictiveIntervalAvgTalktime'];this[_0xaa41('0x31')]=_0x10cda9[_0xaa41('0x31')];this[_0xaa41('0x32')]=_0x10cda9['predictiveIntervalDroppedCallsTimeout'];this[_0xaa41('0x33')]=_0x10cda9['predictiveIntervalErlangCalls'];this[_0xaa41('0x34')]=_0x10cda9[_0xaa41('0x34')];this[_0xaa41('0x35')]=_0x10cda9['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x10cda9['predictiveIntervalMultiplicativeFactor'];this[_0xaa41('0x36')]=_0x10cda9[_0xaa41('0x36')];this[_0xaa41('0x37')]=_0x10cda9[_0xaa41('0x37')];this['predictiveIntervalTotalCalls']=_0x10cda9['predictiveIntervalTotalCalls'];this[_0xaa41('0x8')]=_0x10cda9[_0xaa41('0x8')];this[_0xaa41('0x38')]=_0x10cda9[_0xaa41('0x38')];this[_0xaa41('0x39')]=_0x10cda9[_0xaa41('0x39')];this[_0xaa41('0x3a')]=_0x10cda9['erlangAbandonmentRate'];this[_0xaa41('0x3b')]=_0x10cda9[_0xaa41('0x3b')];this[_0xaa41('0x3c')]=_0x10cda9[_0xaa41('0x3c')];this['startProgressive']=_0x10cda9['startProgressive'];this[_0xaa41('0x3d')]=_0x10cda9[_0xaa41('0x3d')];this['statusMessage']=_0x10cda9[_0xaa41('0x3e')];}if(_0x10cda9['Trunk']){this[_0xaa41('0x3f')]={'id':_0x10cda9[_0xaa41('0x3f')]['id'],'name':_0x10cda9[_0xaa41('0x3f')][_0xaa41('0x40')],'active':_0x10cda9[_0xaa41('0x3f')][_0xaa41('0x41')],'callerid':_0x10cda9[_0xaa41('0x3f')][_0xaa41('0x42')]};}}VoiceQueueSummary['prototype'][_0xaa41('0x43')]=function(_0x2abf39,_0x35c685,_0x398c35,_0xc84fb8){this[_0xaa41('0x17')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0xaa41('0x1f')]=0x0;this['notInUse']=0x0;this[_0xaa41('0x7')]=0x0;this[_0xaa41('0x15')]=0x0;this[_0xaa41('0x16')]=0x0;this[_0xaa41('0x1e')]=0x0;this[_0xaa41('0x3')]=0x0;this[_0xaa41('0x1a')]=0x0;this[_0xaa41('0x18')]=0x0;if(_0x398c35){if(_0x398c35['available']){this[_0xaa41('0x0')]=Number(_0x398c35['available']);}if(_0x398c35['loggedin']){this[_0xaa41('0x1')]=Number(_0x398c35['loggedin']);}if(_0x398c35['callers']){this['waiting']=Number(_0x398c35[_0xaa41('0x44')]);}}for(var _0x525b09=0x0;_0x525b09<_0x2abf39[_0xaa41('0x45')];_0x525b09++){var _0x198716=_0x35c685['SIP/'+_0x2abf39[_0x525b09]['name']];if(_0x198716&&_0x198716[_0xaa41('0x46')]){this[_0xaa41('0x17')]+=0x1;}if(_0x2abf39[_0x525b09][_0xaa41('0x47')]==='1'){this[_0xaa41('0x4')]+=0x1;}if(_0x2abf39[_0x525b09][_0xaa41('0x2')]==='1'&&!['2','7','8'][_0xaa41('0x48')](_0x2abf39[_0x525b09][_0xaa41('0x49')])){this[_0xaa41('0x2')]+=0x1;}switch(_0x2abf39[_0x525b09][_0xaa41('0x49')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xaa41('0x19')]+=0x1;break;case'2':this[_0xaa41('0x7')]+=0x1;break;case'3':this[_0xaa41('0x15')]+=0x1;break;case'4':this[_0xaa41('0x16')]+=0x1;break;case'5':this[_0xaa41('0x1e')]+=0x1;break;case'6':this[_0xaa41('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xaa41('0x18')]+=0x1;break;}}if(this[_0xaa41('0x21')]===_0xaa41('0x4a')){var _0x2288f8=Object['keys'](_0xc84fb8);for(var _0x23bc61=0x0;_0x23bc61<_0x2288f8['length'];_0x23bc61++){var _0x49fedd=_0x2288f8[_0x23bc61];var _0x1415f5=_0xc84fb8[_0x49fedd];if(_0x1415f5[_0xaa41('0x4b')]===this[_0xaa41('0x40')]&&_0x1415f5['type']===_0xaa41('0x4c')&&_0x1415f5[_0xaa41('0x4d')]===_0xaa41('0x4e')){this['talking']+=0x1;}}if(this[_0xaa41('0x4')]>this[_0xaa41('0x7')]){this[_0xaa41('0x4')]=this[_0xaa41('0x7')];}this[_0xaa41('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xaa41('0x4f')][_0xaa41('0x50')]=function(_0x16caf9){var _0x4eab60=![];if(_0x16caf9){_0x4eab60=INBOUND_COUNTERS[_0xaa41('0x51')](function(_0x5bef5f){return this[_0x5bef5f]!==_0x16caf9[_0x5bef5f];},this);}return _0x4eab60;};VoiceQueueSummary['prototype'][_0xaa41('0x52')]=function(_0x446b){var _0x3fef3e=![];var _0x11f7d9=![];var _0x14aab0=![];if(_0x446b){_0x3fef3e=this[_0xaa41('0x21')]!==_0x446b[_0xaa41('0x21')]||this[_0xaa41('0x53')]!==_0x446b['dialActive']||this[_0xaa41('0x3d')]!==_0x446b[_0xaa41('0x3d')]||this[_0xaa41('0x3e')]!==_0x446b['statusMessage'];_0x11f7d9=OUTBOUND_COUNTERS[_0xaa41('0x51')](function(_0x35f664){return this[_0x35f664]!==_0x446b[_0x35f664];},this);if(this['Trunk']&&_0x446b[_0xaa41('0x3f')]){_0x14aab0=this[_0xaa41('0x3f')][_0xaa41('0x40')]!==_0x446b['Trunk'][_0xaa41('0x40')]||this[_0xaa41('0x3f')]['active']!==_0x446b['Trunk'][_0xaa41('0x41')];}}return _0x3fef3e||_0x11f7d9||_0x14aab0;};VoiceQueueSummary[_0xaa41('0x4f')][_0xaa41('0x54')]=function(_0x4d20c6){this[_0xaa41('0x6')]=_0x4d20c6[_0xaa41('0x6')];this[_0xaa41('0x3d')]=_0x4d20c6[_0xaa41('0x3d')];this[_0xaa41('0x3e')]=_0x4d20c6['statusMessage'];this[_0xaa41('0x8')]=_0x4d20c6['originated'];this['outboundAbandonedCallsDay']=_0x4d20c6[_0xaa41('0x9')];this['outboundAnswerCallsDay']=_0x4d20c6[_0xaa41('0x28')];this[_0xaa41('0x29')]=_0x4d20c6[_0xaa41('0x29')];this['outboundBusyCallsDay']=_0x4d20c6[_0xaa41('0xa')];this[_0xaa41('0xb')]=_0x4d20c6[_0xaa41('0xb')];this[_0xaa41('0x55')]=_0x4d20c6[_0xaa41('0x55')];this[_0xaa41('0xc')]=_0x4d20c6[_0xaa41('0xc')];this[_0xaa41('0xd')]=_0x4d20c6[_0xaa41('0xd')];this['outboundRejectCallsDay']=_0x4d20c6[_0xaa41('0xe')];this[_0xaa41('0xf')]=_0x4d20c6[_0xaa41('0xf')];this['sumBillable']=_0x4d20c6[_0xaa41('0x11')];this[_0xaa41('0x12')]=_0x4d20c6[_0xaa41('0x12')];this[_0xaa41('0x1c')]=_0x4d20c6[_0xaa41('0x1c')];if(this[_0xaa41('0x21')]===_0xaa41('0x56')){this['pTalking']=_0x4d20c6['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x1c9a=['dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','talking','waiting','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x15876c,_0x510dd4){var _0x39d91b=function(_0x2a692c){while(--_0x2a692c){_0x15876c['push'](_0x15876c['shift']());}};_0x39d91b(++_0x510dd4);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x36cb1e,_0x3ae2d0){_0x36cb1e=_0x36cb1e-0x0;var _0x253b39=_0x1c9a[_0x36cb1e];return _0x253b39;};'use strict';var INBOUND_COUNTERS=[_0xa1c9('0x0'),_0xa1c9('0x1'),'loggedInDb',_0xa1c9('0x2'),_0xa1c9('0x3'),_0xa1c9('0x4'),_0xa1c9('0x5')];var OUTBOUND_COUNTERS=[_0xa1c9('0x0'),'answered',_0xa1c9('0x6'),'loggedIn',_0xa1c9('0x7'),_0xa1c9('0x8'),_0xa1c9('0x9'),_0xa1c9('0xa'),_0xa1c9('0xb'),_0xa1c9('0xc'),_0xa1c9('0xd'),_0xa1c9('0xe'),_0xa1c9('0xf'),_0xa1c9('0x10'),_0xa1c9('0x11'),_0xa1c9('0x12'),'paused','pTalking',_0xa1c9('0x4'),'sumBillable',_0xa1c9('0x13'),_0xa1c9('0x14'),_0xa1c9('0x5')];function VoiceQueueSummary(_0x3ba437){this['id']=_0x3ba437['id'];this[_0xa1c9('0x15')]=_0x3ba437[_0xa1c9('0x15')];this[_0xa1c9('0x16')]=_0x3ba437[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3ba437[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3ba437[_0xa1c9('0x18')]||0x0;this[_0xa1c9('0x0')]=_0x3ba437[_0xa1c9('0x0')]||0x0;this[_0xa1c9('0x19')]=_0x3ba437[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x6')]=_0x3ba437[_0xa1c9('0x6')]||0x0;this[_0xa1c9('0x1a')]=_0x3ba437[_0xa1c9('0x1a')]||0x0;this['loggedIn']=_0x3ba437[_0xa1c9('0x1')]||0x0;this['loggedInDb']=_0x3ba437[_0xa1c9('0x7')]||0x0;this[_0xa1c9('0x1b')]=_0x3ba437[_0xa1c9('0x1b')]||0x0;this[_0xa1c9('0x1c')]=_0x3ba437[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x2')]=_0x3ba437[_0xa1c9('0x2')]||0x0;this[_0xa1c9('0x3')]=_0x3ba437[_0xa1c9('0x3')]||0x0;this[_0xa1c9('0x1d')]=_0x3ba437[_0xa1c9('0x1d')];this[_0xa1c9('0x1e')]=_0x3ba437['sumBillable'];this[_0xa1c9('0x13')]=_0x3ba437[_0xa1c9('0x13')];this[_0xa1c9('0x1f')]=_0x3ba437[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x4')]=_0x3ba437[_0xa1c9('0x4')]||0x0;this[_0xa1c9('0x14')]=_0x3ba437[_0xa1c9('0x14')]||0x0;this['type']=_0x3ba437[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3ba437['unavailable']||0x0;this[_0xa1c9('0x22')]=_0x3ba437[_0xa1c9('0x22')]||0x0;this[_0xa1c9('0x23')]=_0x3ba437[_0xa1c9('0x23')]||0x0;this[_0xa1c9('0x5')]=_0x3ba437['waiting']||0x0;if(_0x3ba437[_0xa1c9('0x20')]===_0xa1c9('0x24')){this[_0xa1c9('0x25')]=_0x3ba437['pTalking']||0x0;this[_0xa1c9('0x26')]=_0x3ba437[_0xa1c9('0x26')];this[_0xa1c9('0x27')]=_0x3ba437[_0xa1c9('0x27')];this[_0xa1c9('0x28')]=_0x3ba437[_0xa1c9('0x28')];this[_0xa1c9('0x29')]=_0x3ba437[_0xa1c9('0x29')];this[_0xa1c9('0x2a')]=_0x3ba437[_0xa1c9('0x2a')];this[_0xa1c9('0x2b')]=_0x3ba437[_0xa1c9('0x2b')];this[_0xa1c9('0x2c')]=_0x3ba437[_0xa1c9('0x2c')];this[_0xa1c9('0x2d')]=_0x3ba437[_0xa1c9('0x2d')];this['outboundAnswerCallsDay']=_0x3ba437[_0xa1c9('0xa')];this[_0xa1c9('0xb')]=_0x3ba437[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x3ba437[_0xa1c9('0xc')];this['outboundCongestionCallsDay']=_0x3ba437[_0xa1c9('0xd')];this[_0xa1c9('0x2e')]=_0x3ba437['outboundDropCallsDayACS'];this[_0xa1c9('0x2f')]=_0x3ba437[_0xa1c9('0x2f')];this[_0xa1c9('0x30')]=_0x3ba437[_0xa1c9('0x30')];this[_0xa1c9('0xe')]=_0x3ba437[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x3ba437[_0xa1c9('0xf')];this[_0xa1c9('0x31')]=_0x3ba437[_0xa1c9('0x31')];this[_0xa1c9('0x10')]=_0x3ba437[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x3ba437[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x3ba437['outboundUnknownCallsDay'];this[_0xa1c9('0x32')]=_0x3ba437[_0xa1c9('0x32')];this[_0xa1c9('0x33')]=_0x3ba437[_0xa1c9('0x33')];this['predictiveIntervalAvgTalktime']=_0x3ba437[_0xa1c9('0x34')];this[_0xa1c9('0x35')]=_0x3ba437['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x3ba437[_0xa1c9('0x36')];this[_0xa1c9('0x37')]=_0x3ba437[_0xa1c9('0x37')];this[_0xa1c9('0x38')]=_0x3ba437[_0xa1c9('0x38')];this[_0xa1c9('0x39')]=_0x3ba437[_0xa1c9('0x39')];this[_0xa1c9('0x3a')]=_0x3ba437[_0xa1c9('0x3a')];this[_0xa1c9('0x3b')]=_0x3ba437[_0xa1c9('0x3b')];this['predictiveIntervalAvailable']=_0x3ba437[_0xa1c9('0x3c')];this[_0xa1c9('0x3d')]=_0x3ba437[_0xa1c9('0x3d')];this[_0xa1c9('0x8')]=_0x3ba437[_0xa1c9('0x8')];this[_0xa1c9('0x3e')]=_0x3ba437[_0xa1c9('0x3e')];this[_0xa1c9('0x3f')]=_0x3ba437['erlangCallToSecond'];this[_0xa1c9('0x40')]=_0x3ba437[_0xa1c9('0x40')];this[_0xa1c9('0x41')]=_0x3ba437['erlangBusyFactor'];this[_0xa1c9('0x42')]=_0x3ba437[_0xa1c9('0x42')];this[_0xa1c9('0x43')]=_0x3ba437[_0xa1c9('0x43')];this[_0xa1c9('0x44')]=_0x3ba437[_0xa1c9('0x44')];this[_0xa1c9('0x45')]=_0x3ba437['statusMessage'];}if(_0x3ba437[_0xa1c9('0x46')]){this['Trunk']={'id':_0x3ba437[_0xa1c9('0x46')]['id'],'name':_0x3ba437['Trunk'][_0xa1c9('0x15')],'active':_0x3ba437[_0xa1c9('0x46')][_0xa1c9('0x47')],'callerid':_0x3ba437['Trunk'][_0xa1c9('0x48')]};}}VoiceQueueSummary['prototype'][_0xa1c9('0x49')]=function(_0x57ed69,_0x5c1cc6,_0x174f76,_0x5a6c4d){this[_0xa1c9('0x7')]=0x0;this['talking']=0x0;this['paused']=0x0;this[_0xa1c9('0x22')]=0x0;this[_0xa1c9('0x1c')]=0x0;this[_0xa1c9('0x6')]=0x0;this[_0xa1c9('0x19')]=0x0;this['invalid']=0x0;this[_0xa1c9('0x21')]=0x0;this['ringing']=0x0;this[_0xa1c9('0x1d')]=0x0;this[_0xa1c9('0x1b')]=0x0;if(_0x174f76){if(_0x174f76[_0xa1c9('0x0')]){this[_0xa1c9('0x0')]=Number(_0x174f76[_0xa1c9('0x0')]);}if(_0x174f76[_0xa1c9('0x4a')]){this[_0xa1c9('0x1')]=Number(_0x174f76[_0xa1c9('0x4a')]);}if(_0x174f76[_0xa1c9('0x4b')]){this[_0xa1c9('0x5')]=Number(_0x174f76['callers']);}}for(var _0x46b234=0x0;_0x46b234<_0x57ed69[_0xa1c9('0x4c')];_0x46b234++){var _0xf80047=_0x5c1cc6[_0xa1c9('0x4d')+_0x57ed69[_0x46b234][_0xa1c9('0x15')]];if(_0xf80047&&_0xf80047[_0xa1c9('0x4e')]){this[_0xa1c9('0x7')]+=0x1;}if(_0x57ed69[_0x46b234][_0xa1c9('0x4f')]==='1'){this[_0xa1c9('0x4')]+=0x1;}if(_0x57ed69[_0x46b234]['paused']==='1'&&!['2','7','8'][_0xa1c9('0x50')](_0x57ed69[_0x46b234][_0xa1c9('0x51')])){this['paused']+=0x1;}switch(_0x57ed69[_0x46b234][_0xa1c9('0x51')]){case'0':this[_0xa1c9('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xa1c9('0x6')]+=0x1;break;case'3':this[_0xa1c9('0x19')]+=0x1;break;case'4':this[_0xa1c9('0x1a')]+=0x1;break;case'5':this[_0xa1c9('0x21')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xa1c9('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xa1c9('0x27')]==='booked'){var _0x3656bd=Object[_0xa1c9('0x52')](_0x5a6c4d);for(var _0x6d28a1=0x0;_0x6d28a1<_0x3656bd[_0xa1c9('0x4c')];_0x6d28a1++){var _0x226a65=_0x3656bd[_0x6d28a1];var _0x3b530e=_0x5a6c4d[_0x226a65];if(_0x3b530e[_0xa1c9('0x53')]===this[_0xa1c9('0x15')]&&_0x3b530e[_0xa1c9('0x20')]===_0xa1c9('0x54')&&_0x3b530e[_0xa1c9('0x55')]===_0xa1c9('0x56')){this[_0xa1c9('0x4')]+=0x1;}}if(this[_0xa1c9('0x4')]>this[_0xa1c9('0x6')]){this['talking']=this[_0xa1c9('0x6')];}this[_0xa1c9('0x25')]=0x0;}return this;};VoiceQueueSummary[_0xa1c9('0x57')][_0xa1c9('0x58')]=function(_0x524a47){var _0x31f814=![];if(_0x524a47){_0x31f814=INBOUND_COUNTERS[_0xa1c9('0x59')](function(_0x2cfba4){return this[_0x2cfba4]!==_0x524a47[_0x2cfba4];},this);}return _0x31f814;};VoiceQueueSummary[_0xa1c9('0x57')]['compareToOutboundQueue']=function(_0x2aa6a1){var _0x1aadc5=![];var _0x143471=![];var _0xe6ce7c=![];if(_0x2aa6a1){_0x1aadc5=this[_0xa1c9('0x27')]!==_0x2aa6a1[_0xa1c9('0x27')]||this['dialActive']!==_0x2aa6a1[_0xa1c9('0x26')]||this[_0xa1c9('0x44')]!==_0x2aa6a1[_0xa1c9('0x44')]||this[_0xa1c9('0x45')]!==_0x2aa6a1[_0xa1c9('0x45')];_0x143471=OUTBOUND_COUNTERS[_0xa1c9('0x59')](function(_0x50448a){return this[_0x50448a]!==_0x2aa6a1[_0x50448a];},this);if(this['Trunk']&&_0x2aa6a1[_0xa1c9('0x46')]){_0xe6ce7c=this['Trunk']['name']!==_0x2aa6a1[_0xa1c9('0x46')][_0xa1c9('0x15')]||this[_0xa1c9('0x46')]['active']!==_0x2aa6a1['Trunk'][_0xa1c9('0x47')];}}return _0x1aadc5||_0x143471||_0xe6ce7c;};VoiceQueueSummary['prototype'][_0xa1c9('0x5a')]=function(_0x6a9ac5){this[_0xa1c9('0x18')]=_0x6a9ac5['answered'];this[_0xa1c9('0x44')]=_0x6a9ac5[_0xa1c9('0x44')];this[_0xa1c9('0x45')]=_0x6a9ac5[_0xa1c9('0x45')];this[_0xa1c9('0x8')]=_0x6a9ac5['originated'];this[_0xa1c9('0x9')]=_0x6a9ac5['outboundAbandonedCallsDay'];this[_0xa1c9('0xa')]=_0x6a9ac5['outboundAnswerCallsDay'];this[_0xa1c9('0xb')]=_0x6a9ac5[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x6a9ac5[_0xa1c9('0xc')];this['outboundCongestionCallsDay']=_0x6a9ac5[_0xa1c9('0xd')];this['outboundNoAnswerCallsDay']=_0x6a9ac5[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x6a9ac5[_0xa1c9('0xf')];this[_0xa1c9('0x10')]=_0x6a9ac5[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x6a9ac5[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x6a9ac5[_0xa1c9('0x12')];this[_0xa1c9('0x1e')]=_0x6a9ac5[_0xa1c9('0x1e')];this[_0xa1c9('0x13')]=_0x6a9ac5[_0xa1c9('0x13')];this[_0xa1c9('0x14')]=_0x6a9ac5['total'];if(this['dialMethod']===_0xa1c9('0x5b')){this[_0xa1c9('0x25')]=_0x6a9ac5[_0xa1c9('0x25')];}};module[_0xa1c9('0x5c')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 86f6de7..0df8f84 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 _0x1bbe=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1bbe,0xbe));var _0xe1bb=function(_0x1694f3,_0x58d6ba){_0x1694f3=_0x1694f3-0x0;var _0x27372c=_0x1bbe[_0x1694f3];return _0x27372c;};'use strict';function VtigerAccount(_0x1cf1b6){this['id']=_0x1cf1b6['id']||0x0;this[_0xe1bb('0x0')]=_0x1cf1b6[_0xe1bb('0x0')]||'';this[_0xe1bb('0x1')]=_0x1cf1b6[_0xe1bb('0x1')]||'';this[_0xe1bb('0x2')]=_0x1cf1b6[_0xe1bb('0x2')]||'';this[_0xe1bb('0x3')]=_0x1cf1b6[_0xe1bb('0x3')]||'';this[_0xe1bb('0x4')]=_0x1cf1b6['serverUrl']||'';this[_0xe1bb('0x5')]=_0x1cf1b6[_0xe1bb('0x5')]||{};}module[_0xe1bb('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8549=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x2eba76,_0xf6c299){var _0x4f1012=function(_0x4cdb25){while(--_0x4cdb25){_0x2eba76['push'](_0x2eba76['shift']());}};_0x4f1012(++_0xf6c299);}(_0x8549,0x1ad));var _0x9854=function(_0x58361c,_0x54c6a4){_0x58361c=_0x58361c-0x0;var _0x3d3860=_0x8549[_0x58361c];return _0x3d3860;};'use strict';function VtigerAccount(_0x17072c){this['id']=_0x17072c['id']||0x0;this[_0x9854('0x0')]=_0x17072c[_0x9854('0x0')]||'';this[_0x9854('0x1')]=_0x17072c['username']||'';this[_0x9854('0x2')]=_0x17072c[_0x9854('0x2')]||'';this[_0x9854('0x3')]=_0x17072c[_0x9854('0x3')]||'';this[_0x9854('0x4')]=_0x17072c[_0x9854('0x4')]||'';this[_0x9854('0x5')]=_0x17072c[_0x9854('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 501716d..0401c52 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 _0xd6ee=['username','password','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0xd6ee,0x8b));var _0xed6e=function(_0x4e06f3,_0x5c35db){_0x4e06f3=_0x4e06f3-0x0;var _0x1ed6f1=_0xd6ee[_0x4e06f3];return _0x1ed6f1;};'use strict';function ZendeskAccount(_0x39e9f8){this['id']=_0x39e9f8['id']||0x0;this[_0xed6e('0x0')]=_0x39e9f8[_0xed6e('0x0')]||'';this[_0xed6e('0x1')]=_0x39e9f8[_0xed6e('0x1')]||'';this[_0xed6e('0x2')]=_0x39e9f8['password']||'';this['token']=_0x39e9f8['token']||'';this[_0xed6e('0x3')]=_0x39e9f8[_0xed6e('0x3')]||'';this[_0xed6e('0x4')]=_0x39e9f8['authType']||'';this['type']=_0x39e9f8[_0xed6e('0x5')]||_0xed6e('0x6');this[_0xed6e('0x7')]=_0x39e9f8[_0xed6e('0x7')]||'';this['Configurations']=_0x39e9f8[_0xed6e('0x8')]||{};}module[_0xed6e('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x6a52=['password','token','remoteUri','authType','integrationTab','serverUrl','Configurations','name','username'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6a52,0xf1));var _0x26a5=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0x6a52[_0x307086];return _0x699043;};'use strict';function ZendeskAccount(_0x3e20bc){this['id']=_0x3e20bc['id']||0x0;this[_0x26a5('0x0')]=_0x3e20bc[_0x26a5('0x0')]||'';this[_0x26a5('0x1')]=_0x3e20bc['username']||'';this[_0x26a5('0x2')]=_0x3e20bc[_0x26a5('0x2')]||'';this[_0x26a5('0x3')]=_0x3e20bc[_0x26a5('0x3')]||'';this[_0x26a5('0x4')]=_0x3e20bc[_0x26a5('0x4')]||'';this[_0x26a5('0x5')]=_0x3e20bc[_0x26a5('0x5')]||'';this['type']=_0x3e20bc['type']||_0x26a5('0x6');this[_0x26a5('0x7')]=_0x3e20bc[_0x26a5('0x7')]||'';this[_0x26a5('0x8')]=_0x3e20bc[_0x26a5('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b360aab..23bf409 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 _0xdc82=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xdc82,0x158));var _0x2dc8=function(_0x3407ef,_0x1fa136){_0x3407ef=_0x3407ef-0x0;var _0x560f33=_0xdc82[_0x3407ef];return _0x560f33;};'use strict';function ZohoAccount(_0x5f1511){this['id']=_0x5f1511['id']||0x0;this[_0x2dc8('0x0')]=_0x5f1511[_0x2dc8('0x0')]||'';this[_0x2dc8('0x1')]=_0x5f1511[_0x2dc8('0x1')]||'';this[_0x2dc8('0x2')]=_0x5f1511['host']||'';this[_0x2dc8('0x3')]=_0x5f1511[_0x2dc8('0x3')]||'';this[_0x2dc8('0x4')]=_0x5f1511[_0x2dc8('0x4')]||'';this[_0x2dc8('0x5')]=_0x5f1511[_0x2dc8('0x5')]||'';this['serverUrl']=_0x5f1511['serverUrl']||'';this[_0x2dc8('0x6')]=_0x5f1511[_0x2dc8('0x6')]||'';this[_0x2dc8('0x7')]=_0x5f1511[_0x2dc8('0x7')]||'';this[_0x2dc8('0x8')]=_0x5f1511[_0x2dc8('0x8')]||{};}module[_0x2dc8('0x9')]=ZohoAccount; \ No newline at end of file +var _0x1c15=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x2bcbf9,_0x237bcc){var _0x2e9992=function(_0x363433){while(--_0x363433){_0x2bcbf9['push'](_0x2bcbf9['shift']());}};_0x2e9992(++_0x237bcc);}(_0x1c15,0x1b8));var _0x51c1=function(_0x12a32a,_0x200871){_0x12a32a=_0x12a32a-0x0;var _0x45c462=_0x1c15[_0x12a32a];return _0x45c462;};'use strict';function ZohoAccount(_0x219a46){this['id']=_0x219a46['id']||0x0;this[_0x51c1('0x0')]=_0x219a46[_0x51c1('0x0')]||'';this[_0x51c1('0x1')]=_0x219a46[_0x51c1('0x1')]||'';this[_0x51c1('0x2')]=_0x219a46[_0x51c1('0x2')]||'';this[_0x51c1('0x3')]=_0x219a46['zone']||'';this[_0x51c1('0x4')]=_0x219a46[_0x51c1('0x4')]||'';this['clientSecret']=_0x219a46[_0x51c1('0x5')]||'';this[_0x51c1('0x6')]=_0x219a46[_0x51c1('0x6')]||'';this[_0x51c1('0x7')]=_0x219a46[_0x51c1('0x7')]||'';this[_0x51c1('0x8')]=_0x219a46[_0x51c1('0x8')]||'';this[_0x51c1('0x9')]=_0x219a46[_0x51c1('0x9')]||{};}module[_0x51c1('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ec47176..218a9b5 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 _0x896e=['Contact','phone','firstName','lastName','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','queue','membername','Agent','format','SIP/%s','calleridname'];(function(_0x556a83,_0x56897c){var _0x1f89bf=function(_0x5d7028){while(--_0x5d7028){_0x556a83['push'](_0x556a83['shift']());}};_0x1f89bf(++_0x56897c);}(_0x896e,0x1e9));var _0xe896=function(_0x50caf3,_0x19aee4){_0x50caf3=_0x50caf3-0x0;var _0x5bcb7d=_0x896e[_0x50caf3];return _0x5bcb7d;};'use strict';var util=require(_0xe896('0x0'));var _=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));function checkNameSurname(_0x229b59,_0x36085e,_0x26d296){var _0x2af995='';if(!_[_0xe896('0x3')](_0x36085e)&&_0xe896('0x4')===typeof _0x36085e){_0x2af995+=_0x36085e;}if(!_[_0xe896('0x3')](_0x26d296)&&_0xe896('0x4')===typeof _0x26d296){_0x2af995+='\x20'+_0x26d296;}if(_0x2af995!==''){return _0x2af995;}return _0x229b59;}function Action(_0x318a7b,_0x52ac80,_0x24c430,_0x7a0721,_0x3b902c){this[_0xe896('0x5')]=_0x24c430||undefined;this[_0xe896('0x6')]=_0x318a7b['id'];this['queue']=_0x52ac80[_0xe896('0x7')];this[_0xe896('0x8')]=_0x52ac80[_0xe896('0x8')];this['campaigntype']=_0xe896('0x9');this['dialAnswer']=![];this[_0xe896('0xa')]=_['isNil'](_0x318a7b[_0xe896('0xb')])?undefined:_0x318a7b[_0xe896('0xb')][_0xe896('0x7')];this['channelAgent']=this[_0xe896('0xa')]?util[_0xe896('0xc')](_0xe896('0xd'),this['membername']):_0x7a0721||undefined;this[_0xe896('0xe')]=checkNameSurname(_0x318a7b[_0xe896('0xf')][_0xe896('0x10')],_0x318a7b['Contact'][_0xe896('0x11')],_0x318a7b[_0xe896('0xf')][_0xe896('0x12')]);this['active']=_0x318a7b['active']||![];this[_0xe896('0x13')]=_0x318a7b[_0xe896('0x10')];this['scheduledat']=_0x318a7b['scheduledat'];this[_0xe896('0x14')]=_0x318a7b[_0xe896('0x14')]||0x0;this['countcongestionretry']=_0x318a7b[_0xe896('0x15')]||0x0;this['countnoanswerretry']=_0x318a7b[_0xe896('0x16')]||0x0;this[_0xe896('0x17')]=(_0x318a7b[_0xe896('0x14')]||0x0)+(_0x318a7b['countcongestionretry']||0x0)+(_0x318a7b[_0xe896('0x16')]||0x0)+(_0x318a7b[_0xe896('0x18')]||0x0)+(_0x318a7b[_0xe896('0x19')]||0x0)+(_0x318a7b[_0xe896('0x1a')]||0x0)+(_0x318a7b[_0xe896('0x1b')]||0x0)+(_0x318a7b[_0xe896('0x1c')]||0x0);this[_0xe896('0x18')]=_0x318a7b[_0xe896('0x18')]||0x0;this['countdropretry']=_0x318a7b[_0xe896('0x19')]||0x0;this['countabandonedretry']=_0x318a7b['countabandonedretry']||0x0;this[_0xe896('0x1b')]=_0x318a7b[_0xe896('0x1b')]||0x0;this[_0xe896('0x1c')]=_0x318a7b[_0xe896('0x1c')]||0x0;this['callback']=_0x318a7b[_0xe896('0x1d')];this['callbackuniqueid']=_0x318a7b['callbackuniqueid'];this[_0xe896('0x1e')]=_0x318a7b[_0xe896('0x1e')];this[_0xe896('0x1f')]=_0x318a7b[_0xe896('0x1f')];this[_0xe896('0x20')]=_0x318a7b[_0xe896('0x20')];this[_0xe896('0x21')]=_0x318a7b['ListId'];this[_0xe896('0x22')]=_[_0xe896('0x3')](_0x318a7b[_0xe896('0xb')])?_0x318a7b['UserId']:_0x318a7b[_0xe896('0xb')]['id'];this[_0xe896('0x23')]=_0x318a7b[_0xe896('0x23')];this[_0xe896('0x24')]='';this[_0xe896('0x25')]='';}Action[_0xe896('0x26')]['getCaller']=function(){return util[_0xe896('0xc')](_0xe896('0x27'),this[_0xe896('0xe')],this[_0xe896('0x28')]);};module[_0xe896('0x29')]=Action; \ No newline at end of file +var _0x47c5=['originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x5c2cfc,_0x225457){var _0x39ef01=function(_0x2b507b){while(--_0x2b507b){_0x5c2cfc['push'](_0x5c2cfc['shift']());}};_0x39ef01(++_0x225457);}(_0x47c5,0x165));var _0x547c=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0x47c5[_0x99facc];return _0xd39ed0;};'use strict';var util=require(_0x547c('0x0'));var _=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));function checkNameSurname(_0x123697,_0x5fe74c,_0x3260c8){var _0x500b86='';if(!_[_0x547c('0x3')](_0x5fe74c)&&_0x547c('0x4')===typeof _0x5fe74c){_0x500b86+=_0x5fe74c;}if(!_['isNil'](_0x3260c8)&&_0x547c('0x4')===typeof _0x3260c8){_0x500b86+='\x20'+_0x3260c8;}if(_0x500b86!==''){return _0x500b86;}return _0x123697;}function Action(_0x468220,_0x51ab7f,_0x2e5b57,_0x439f25,_0x381f2e){this[_0x547c('0x5')]=_0x2e5b57||undefined;this[_0x547c('0x6')]=_0x468220['id'];this[_0x547c('0x7')]=_0x51ab7f[_0x547c('0x8')];this[_0x547c('0x9')]=_0x51ab7f[_0x547c('0x9')];this[_0x547c('0xa')]=_0x547c('0x7');this[_0x547c('0xb')]=![];this[_0x547c('0xc')]=_[_0x547c('0x3')](_0x468220[_0x547c('0xd')])?undefined:_0x468220[_0x547c('0xd')][_0x547c('0x8')];this['channelAgent']=this[_0x547c('0xc')]?util[_0x547c('0xe')]('SIP/%s',this[_0x547c('0xc')]):_0x439f25||undefined;this[_0x547c('0xf')]=checkNameSurname(_0x468220[_0x547c('0x10')][_0x547c('0x11')],_0x468220[_0x547c('0x10')][_0x547c('0x12')],_0x468220[_0x547c('0x10')][_0x547c('0x13')]);this[_0x547c('0x14')]=_0x468220[_0x547c('0x14')]||![];this[_0x547c('0x15')]=_0x468220[_0x547c('0x11')];this[_0x547c('0x16')]=_0x468220[_0x547c('0x16')];this[_0x547c('0x17')]=_0x468220[_0x547c('0x17')]||0x0;this[_0x547c('0x18')]=_0x468220[_0x547c('0x18')]||0x0;this['countnoanswerretry']=_0x468220['countnoanswerretry']||0x0;this[_0x547c('0x19')]=(_0x468220[_0x547c('0x17')]||0x0)+(_0x468220[_0x547c('0x18')]||0x0)+(_0x468220['countnoanswerretry']||0x0)+(_0x468220[_0x547c('0x1a')]||0x0)+(_0x468220[_0x547c('0x1b')]||0x0)+(_0x468220[_0x547c('0x1c')]||0x0)+(_0x468220['countmachineretry']||0x0)+(_0x468220[_0x547c('0x1d')]||0x0);this[_0x547c('0x1a')]=_0x468220['countnosuchnumberretry']||0x0;this['countdropretry']=_0x468220[_0x547c('0x1b')]||0x0;this[_0x547c('0x1c')]=_0x468220['countabandonedretry']||0x0;this[_0x547c('0x1e')]=_0x468220[_0x547c('0x1e')]||0x0;this['countagentrejectretry']=_0x468220[_0x547c('0x1d')]||0x0;this[_0x547c('0x1f')]=_0x468220[_0x547c('0x1f')];this['callbackuniqueid']=_0x468220[_0x547c('0x20')];this[_0x547c('0x21')]=_0x468220[_0x547c('0x21')];this[_0x547c('0x22')]=_0x468220[_0x547c('0x22')];this[_0x547c('0x23')]=_0x468220[_0x547c('0x23')];this[_0x547c('0x24')]=_0x468220['ListId'];this[_0x547c('0x25')]=_['isNil'](_0x468220['Agent'])?_0x468220['UserId']:_0x468220['Agent']['id'];this[_0x547c('0x26')]=_0x468220['VoiceQueueId'];this[_0x547c('0x27')]='';this['originatecalleridname']='';}Action[_0x547c('0x28')]['getCaller']=function(){return util[_0x547c('0xe')](_0x547c('0x29'),this[_0x547c('0xf')],this[_0x547c('0x2a')]);};module[_0x547c('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 18e8470..18890ca 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x16f6af,_0x20a361){var _0x54a4a4=function(_0x500cba){while(--_0x500cba){_0x16f6af['push'](_0x16f6af['shift']());}};_0x54a4a4(++_0x20a361);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x37845e,_0x21070e){var _0x452beb=function(_0x5f4355){while(--_0x5f4355){_0x37845e['push'](_0x37845e['shift']());}};_0x452beb(++_0x21070e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4004a54..05d4d4e 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 _0x396e=['error','inspect','catch','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','../../../config/logger','../rpc/cmHopperBlack','../rpc/voiceQueueReport'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x396e,0x18c));var _0xe396=function(_0x3f2b68,_0x5ab321){_0x3f2b68=_0x3f2b68-0x0;var _0x322146=_0x396e[_0x3f2b68];return _0x322146;};'use strict';var util=require(_0xe396('0x0'));var BPromise=require('bluebird');var logger=require(_0xe396('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xe396('0x2'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xe396('0x3'));function loggerCatch(_0x381ecb){return function(_0x3b5efd){logger[_0xe396('0x4')](_0x381ecb,util[_0xe396('0x5')](_0x3b5efd,{'showHidden':![],'depth':null}));};}function create(_0x2ff47e){return cmHopperHistory['createHistory'](_0x2ff47e)[_0xe396('0x6')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x455eee){return BPromise[_0xe396('0x7')]()[_0xe396('0x8')](agentReportPreview[_0xe396('0x9')](_0x455eee))['catch'](loggerCatch(_0xe396('0xa')));}function moveContact(_0xd0537b){return cmHopper[_0xe396('0xb')](_0xd0537b,!![])[_0xe396('0x6')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe396('0xc')]=function(_0x460f1d){return cmHopperBlack[_0xe396('0xc')](_0x460f1d)[_0xe396('0x6')](loggerCatch(_0xe396('0xd')));};exports[_0xe396('0xe')]=function(_0x9f4b35){return BPromise[_0xe396('0x7')]()[_0xe396('0x8')](cmHopper[_0xe396('0xe')](_0x9f4b35))[_0xe396('0x6')](loggerCatch('[getContactPreview]\x20'));};exports[_0xe396('0x9')]=function(_0x43fae3,_0x3bc86b){create(_0x43fae3)['catch'](loggerCatch(_0x3bc86b));moveContact(_0x43fae3)[_0xe396('0x6')](loggerCatch(_0x3bc86b));};exports[_0xe396('0xf')]=function(_0x1751df,_0x37d458){createAgent(_0x1751df)[_0xe396('0x6')](loggerCatch(_0x37d458));};exports[_0xe396('0x10')]=function(_0xc44b84,_0x2c3b2b){create(_0xc44b84)[_0xe396('0x6')](loggerCatch(_0x2c3b2b));};exports[_0xe396('0x11')]=function(_0x35be46,_0x315871){moveContact(_0x35be46)[_0xe396('0x6')](loggerCatch(_0x315871));};exports[_0xe396('0x12')]=function(_0x42f29b,_0x125eca,_0xd8acf5){if(_0x125eca){_0x42f29b[_0xe396('0x13')]=null;}if(_0xd8acf5){_0x42f29b['active']=![];}return cmHopper[_0xe396('0x12')](_0x42f29b)[_0xe396('0x6')](loggerCatch(_0xe396('0x14')));};exports[_0xe396('0x15')]=function(_0x26c60c){return cmHopper[_0xe396('0x15')](_0x26c60c)['catch'](loggerCatch(_0xe396('0x16')));};exports[_0xe396('0x17')]=function(_0x2afea7){return cmHopper[_0xe396('0x17')]({'UserId':null},_0x2afea7,0x1)['catch'](loggerCatch(_0xe396('0x18')));};exports[_0xe396('0x19')]=function(_0x241430){return cmHopper['unlockContact']({'active':![]},_0x241430,0x1)[_0xe396('0x6')](loggerCatch(_0xe396('0x1a')));};exports[_0xe396('0x1b')]=function(_0x2b555f){var _0x38fc24={};_0x38fc24[_0xe396('0x1c')]=_0x2b555f['type'];_0x38fc24['uniqueid']=_0x2b555f['uniqueid'];_0x38fc24[_0xe396('0x1d')]=_0x2b555f[_0xe396('0x1d')];_0x38fc24[_0xe396('0x1e')]=_0x2b555f[_0xe396('0x1e')];_0x38fc24[_0xe396('0x1f')]=_0x2b555f[_0xe396('0x1f')];_0x38fc24[_0xe396('0x20')]=_0x2b555f[_0xe396('0x21')];_0x38fc24[_0xe396('0x22')]=_0x2b555f[_0xe396('0x21')];_0x38fc24['queuecallercomplete']=0x1;_0x38fc24[_0xe396('0x23')]=_0x2b555f['endtime'];_0x38fc24[_0xe396('0x24')]=_0x2b555f[_0xe396('0x25')];_0x38fc24[_0xe396('0x26')]='from-sip';_0x38fc24[_0xe396('0x27')]=_0xe396('0x28');_0x38fc24[_0xe396('0x29')]=0x0;_0x38fc24[_0xe396('0x2a')]=0x1;_0x38fc24[_0xe396('0x2b')]=_0x2b555f[_0xe396('0x25')];_0x38fc24[_0xe396('0x2c')]=_0xe396('0x2d');return BPromise[_0xe396('0x7')]()[_0xe396('0x8')](voiceQueueReport[_0xe396('0x2e')](_0x38fc24))[_0xe396('0x6')](loggerCatch(_0xe396('0x2f')));};exports[_0xe396('0x30')]=function(_0x122a5c,_0xd4cc06){return BPromise[_0xe396('0x7')]()[_0xe396('0x8')](cmHopper[_0xe396('0x30')](_0x122a5c,_0xd4cc06))[_0xe396('0x6')](loggerCatch(_0xe396('0x31')));};exports['rescheduleContactInQueue']=function(_0x4d31e3){return cmHopper['rescheduleContact'](_0x4d31e3,!![],!![])[_0xe396('0x6')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x6250=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x28fa06,_0x351ff9){var _0x2e6b5f=function(_0x3f15ca){while(--_0x3f15ca){_0x28fa06['push'](_0x28fa06['shift']());}};_0x2e6b5f(++_0x351ff9);}(_0x6250,0x68));var _0x0625=function(_0x357e9e,_0x5d580f){_0x357e9e=_0x357e9e-0x0;var _0x11e0c5=_0x6250[_0x357e9e];return _0x11e0c5;};'use strict';var util=require(_0x0625('0x0'));var BPromise=require('bluebird');var logger=require(_0x0625('0x1'))(_0x0625('0x2'));var cmHopper=require(_0x0625('0x3'));var cmHopperHistory=require(_0x0625('0x4'));var cmHopperBlack=require(_0x0625('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0625('0x6'));function loggerCatch(_0x4b9e8c){return function(_0xdad4d6){logger[_0x0625('0x7')](_0x4b9e8c,util['inspect'](_0xdad4d6,{'showHidden':![],'depth':null}));};}function create(_0x13ba57){return cmHopperHistory[_0x0625('0x8')](_0x13ba57)[_0x0625('0x9')](loggerCatch(_0x0625('0xa')));}function createAgent(_0x4271a2){return BPromise[_0x0625('0xb')]()['then'](agentReportPreview[_0x0625('0x8')](_0x4271a2))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x57259c){return cmHopper[_0x0625('0xc')](_0x57259c,!![])[_0x0625('0x9')](loggerCatch(_0x0625('0xd')));}exports[_0x0625('0xe')]=function(_0x4b34e8){return cmHopperBlack[_0x0625('0xe')](_0x4b34e8)[_0x0625('0x9')](loggerCatch(_0x0625('0xf')));};exports[_0x0625('0x10')]=function(_0xd317dc){return BPromise[_0x0625('0xb')]()['then'](cmHopper['getContactPreview'](_0xd317dc))[_0x0625('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x0625('0x8')]=function(_0x30371d,_0x1bbfcd){create(_0x30371d)[_0x0625('0x9')](loggerCatch(_0x1bbfcd));moveContact(_0x30371d)[_0x0625('0x9')](loggerCatch(_0x1bbfcd));};exports[_0x0625('0x11')]=function(_0x229af6,_0x3d14f5){createAgent(_0x229af6)['catch'](loggerCatch(_0x3d14f5));};exports[_0x0625('0x12')]=function(_0x326a1a,_0x1c2ba2){create(_0x326a1a)[_0x0625('0x9')](loggerCatch(_0x1c2ba2));};exports[_0x0625('0x13')]=function(_0x4b344f,_0x3fe801){moveContact(_0x4b344f)[_0x0625('0x9')](loggerCatch(_0x3fe801));};exports[_0x0625('0x14')]=function(_0x120a79,_0x45c17c,_0x16ce4d){if(_0x45c17c){_0x120a79['UserId']=null;}if(_0x16ce4d){_0x120a79[_0x0625('0x15')]=![];}return cmHopper[_0x0625('0x14')](_0x120a79)[_0x0625('0x9')](loggerCatch(_0x0625('0x16')));};exports[_0x0625('0x17')]=function(_0xe948f7){return cmHopper['countReScheduled'](_0xe948f7)[_0x0625('0x9')](loggerCatch('[countReScheduled]\x20'));};exports[_0x0625('0x18')]=function(_0x1dd831){return cmHopper[_0x0625('0x18')]({'UserId':null},_0x1dd831,0x1)[_0x0625('0x9')](loggerCatch(_0x0625('0x19')));};exports[_0x0625('0x1a')]=function(_0x4daabe){return cmHopper[_0x0625('0x18')]({'active':![]},_0x4daabe,0x1)['catch'](loggerCatch(_0x0625('0x1b')));};exports['crateCustomerReportQueue']=function(_0x5909b7){var _0x52ace2={};_0x52ace2[_0x0625('0x1c')]=_0x5909b7[_0x0625('0x1c')];_0x52ace2['uniqueid']=_0x5909b7[_0x0625('0x1d')];_0x52ace2['calleridnum']=_0x5909b7[_0x0625('0x1e')];_0x52ace2[_0x0625('0x1f')]=_0x5909b7[_0x0625('0x1f')];_0x52ace2[_0x0625('0x20')]=_0x5909b7['queue'];_0x52ace2[_0x0625('0x21')]=_0x5909b7[_0x0625('0x22')];_0x52ace2[_0x0625('0x23')]=_0x5909b7[_0x0625('0x22')];_0x52ace2[_0x0625('0x24')]=0x1;_0x52ace2['queuecallercompleteAt']=_0x5909b7['endtime'];_0x52ace2[_0x0625('0x25')]=_0x5909b7['membername'];_0x52ace2['context']=_0x0625('0x26');_0x52ace2[_0x0625('0x27')]=_0x0625('0x28');_0x52ace2['holdtime']=0x0;_0x52ace2[_0x0625('0x29')]=0x1;_0x52ace2[_0x0625('0x2a')]=_0x5909b7[_0x0625('0x2b')];_0x52ace2[_0x0625('0x2c')]=_0x0625('0x2d');return BPromise[_0x0625('0xb')]()['then'](voiceQueueReport[_0x0625('0x2e')](_0x52ace2))[_0x0625('0x9')](loggerCatch(_0x0625('0x2f')));};exports[_0x0625('0x30')]=function(_0x2a41ff,_0x56c152){return BPromise['resolve']()['then'](cmHopper[_0x0625('0x30')](_0x2a41ff,_0x56c152))['catch'](loggerCatch(_0x0625('0x31')));};exports[_0x0625('0x32')]=function(_0x2f79de){return cmHopper['rescheduleContact'](_0x2f79de,!![],!![])[_0x0625('0x9')](loggerCatch(_0x0625('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 3fec149..8694f2c 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 _0x8f31=['U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','isNil','originated','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','endtime','logAgent','state','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','idContact','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','variables','keys','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','isActive','addVariables','Queue','name','calleridname','calleridnum','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format'];(function(_0x477b8a,_0x2a198d){var _0x4183f9=function(_0x35df23){while(--_0x35df23){_0x477b8a['push'](_0x477b8a['shift']());}};_0x4183f9(++_0x2a198d);}(_0x8f31,0xf4));var _0x18f3=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x8f31[_0x1e3c16];return _0x47a0c9;};'use strict';var util=require(_0x18f3('0x0'));var _=require(_0x18f3('0x1'));var moment=require(_0x18f3('0x2'));var logger=require(_0x18f3('0x3'))(_0x18f3('0x4'));var ipAgi=process[_0x18f3('0x5')][_0x18f3('0x6')]||_0x18f3('0x7');var utils=require(_0x18f3('0x8'));exports[_0x18f3('0x9')]=function(_0x2eff5e){return function(_0x1a17c1){logger[_0x18f3('0xa')](_0x2eff5e,util['inspect'](_0x1a17c1,{'showHidden':![],'depth':null}));};};exports[_0x18f3('0xb')]=function(_0x149725,_0x12d98d){logger[_0x18f3('0xc')](_0x149725,util['inspect'](_0x12d98d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x58fe73,_0x5d6299){logger[_0x18f3('0xa')](_0x58fe73,util[_0x18f3('0xd')](_0x5d6299,{'showHidden':![],'depth':null}));};exports[_0x18f3('0xe')]=function(_0x1b953c){return function(_0x343368){logger['info'](_0x1b953c,util['inspect'](_0x343368,{'showHidden':![],'depth':null}));};};exports[_0x18f3('0xf')]=function(_0x4e13af,_0x505ea6,_0xd93b71){return{'message':_0x4e13af,'unlock':_0x505ea6,'active':_0xd93b71};};exports[_0x18f3('0x10')]=function(_0x31bc95,_0x356933,_0x28626d){if(!_[_0x18f3('0x11')](_0x28626d)&&'string'===typeof _0x28626d&&!_[_0x18f3('0x12')](_0x28626d)){if(!_[_0x18f3('0x11')](_0x356933)&&'string'===typeof _0x356933&&!_[_0x18f3('0x12')](_0x356933)){return util[_0x18f3('0x13')]('\x22%s\x22\x20<%s>',_0x356933,_0x28626d);}return util[_0x18f3('0x13')](_0x18f3('0x14'),_0x28626d,_0x28626d);}if(!_[_0x18f3('0x11')](_0x31bc95)&&_0x18f3('0x15')===typeof _0x31bc95&&!_['isEmpty'](_0x31bc95)){return _0x31bc95;}return'\x22\x22\x20<>';};exports[_0x18f3('0x16')]=function(_0x4534a7){if(_['isNil'](_0x4534a7)){return![];}return _0x4534a7;};exports[_0x18f3('0x17')]=function(_0x3250b9,_0x491d17,_0x290c04,_0x43b443,_0x1d4d41,_0x3c57c4){var _0x11e9d9={'XMD-QUEUE':_0x491d17['Queue']?_0x491d17[_0x18f3('0x18')][_0x18f3('0x19')]:'','XMD-CALLERID':_0x43b443,'XMD-CALLERID-PREVIEW':_0x3c57c4?util[_0x18f3('0x13')](_0x18f3('0x14'),_0x3c57c4[_0x18f3('0x1a')],_0x3c57c4[_0x18f3('0x1b')]):_0x43b443,'XMD-DIALID':_0x1d4d41,'XMD-CONTACTID':_0x491d17['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x43b443,'XMD-VOICEQUEUEID':_0x491d17['VoiceQueueId'],'XMD-DIALCHANNEL':_0x290c04,'XMD-DIALTIMEOUT':_0x3250b9[_0x18f3('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x18f3('0x1d'),_0x3250b9[_0x18f3('0x1e')]?'g':'',_[_0x18f3('0x12')](_0x3250b9[_0x18f3('0x1f')])?'':_0x18f3('0x20')),'XMD-DIALURL':_0x3250b9[_0x18f3('0x21')]||'','XMD-AGI':_0x3250b9[_0x18f3('0x22')]?util[_0x18f3('0x13')](_0x18f3('0x23'),ipAgi,_0x3250b9['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3250b9[_0x18f3('0x1e')]?util[_0x18f3('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3250b9[_0x18f3('0x1e')]):_0x18f3('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x3c57c4?_0x3c57c4[_0x18f3('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x3c57c4?_0x3c57c4[_0x18f3('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x18f3('0x27')};if(!_['isEmpty'](_0x3250b9['monitor_format'])){_0x11e9d9[util[_0x18f3('0x13')]('%s',_0x18f3('0x28'))]=_0x3250b9[_0x18f3('0x1f')];_0x11e9d9[util[_0x18f3('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1d4d41;}return _0x11e9d9;};exports['toLowerVariables']=function(_0x2263d8){var _0x20378f={};for(var _0xdf9ce7 in _0x2263d8){if(_0x2263d8[_0x18f3('0x29')](_0xdf9ce7)){_0x20378f[util[_0x18f3('0x13')]('%s',_[_0x18f3('0x2a')](_0xdf9ce7))]=_0x2263d8[_0xdf9ce7];}}return{'variables':_0x20378f};};exports['updateOriginated']=function(_0x251977,_0x4e946a){if(!_[_0x18f3('0x2b')](_0x251977)){if(_0x251977[_0x18f3('0x29')]('originated')){if(_0x251977[_0x18f3('0x2c')]>0x0){_0x251977[_0x18f3('0x2c')]-=0x1;}else{logger[_0x18f3('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4e946a);}}}else{logger[_0x18f3('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4e946a);}};exports['logBlacklist']=function(_0x46528c){var _0x539390=moment()['format'](_0x18f3('0x2d'));_0x46528c['state']=0xd;_0x46528c[_0x18f3('0x2e')]=_0x18f3('0x2f');_0x46528c[_0x18f3('0x30')]=_0x539390;_0x46528c['responsetime']=_0x539390;_0x46528c[_0x18f3('0x31')]=_0x539390;};exports[_0x18f3('0x32')]=function(_0x291db9,_0x1e38da,_0x5d786c){var _0x13aba4=moment()[_0x18f3('0x13')](_0x18f3('0x2d'));_0x291db9[_0x18f3('0x33')]=_0x1e38da;_0x291db9[_0x18f3('0x2e')]=_0x5d786c;_0x291db9[_0x18f3('0x34')]=_0x13aba4;_0x291db9[_0x18f3('0x35')]=utils['getSeconds'](_0x291db9[_0x18f3('0x34')],_0x291db9['starttime']);};exports[_0x18f3('0x36')]=function(_0x222320,_0x293093,_0x4cb34c){_0x222320[_0x18f3('0x37')]=_0x293093;_0x222320[_0x18f3('0x38')]=_0x4cb34c;};exports[_0x18f3('0x39')]=function(_0x145045,_0x8c1579,_0x3b8ba0){var _0x194739=moment()[_0x18f3('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x145045[_0x18f3('0x33')]=_0x8c1579;_0x145045[_0x18f3('0x2e')]=_0x3b8ba0;_0x145045['responsetime']=_0x145045[_0x18f3('0x34')]?_0x145045[_0x18f3('0x34')]:_0x194739;_0x145045[_0x18f3('0x31')]=_0x145045[_0x18f3('0x31')]?_0x145045[_0x18f3('0x31')]:_0x194739;_0x145045[_0x18f3('0x35')]=utils[_0x18f3('0x3a')](_0x145045[_0x18f3('0x34')]||0x0,_0x145045[_0x18f3('0x30')]||0x0);_0x145045[_0x18f3('0x3b')]=_0x145045['answertime']?utils[_0x18f3('0x3a')](_0x145045[_0x18f3('0x31')],_0x145045[_0x18f3('0x3c')]):0x0;};exports[_0x18f3('0x3d')]=function(_0x4f5288){return _0x4f5288===_0x18f3('0x3e');};exports[_0x18f3('0x3f')]=function(_0x288b12,_0x18aebc,_0x100a37,_0x1a7b94,_0x3fc5b2){var _0x57b3ab=_0x1a7b94?'RECALL':_0x288b12['calleridname'];_0x57b3ab=_0x3fc5b2?_0x18f3('0x40'):_0x57b3ab;return{'actionid':_0x288b12[_0x18f3('0x41')],'action':_0x18f3('0x42'),'channel':_0x288b12[_0x18f3('0x43')],'callerid':util['format'](_0x18f3('0x14'),_0x57b3ab,_0x288b12['calleridnum']),'Exten':_0x18f3('0x44'),'Context':_0x18f3('0x45'),'Priority':'1','variable':_0x100a37,'timeout':(_0x18aebc[_0x18f3('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x288b12['uniqueid']};};exports['totalGlobal']=function(_0x5562bb){return _0x5562bb['countbusyretry']+_0x5562bb[_0x18f3('0x47')]+_0x5562bb[_0x18f3('0x48')]+_0x5562bb[_0x18f3('0x49')]+_0x5562bb[_0x18f3('0x4a')];};exports[_0x18f3('0x4b')]=function(_0x43b551){var _0x49e6f6=_['clone'](_0x43b551);_0x49e6f6[_0x18f3('0x33')]=0xf;_0x49e6f6[_0x18f3('0x2e')]=_0x18f3('0x4c');return _0x49e6f6;};exports[_0x18f3('0x4d')]=function(_0x430d58,_0x26f687,_0x431fdd){var _0x24f801={};_0x24f801[_0x26f687]=_0x430d58[_0x26f687];_0x24f801['active']=![];_0x24f801[_0x18f3('0x4e')]=moment()['add'](_0x431fdd,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x24f801[_0x18f3('0x4f')]=_0x430d58[_0x18f3('0x4f')];_0x24f801[_0x18f3('0x50')]=_0x430d58[_0x18f3('0x50')];_0x24f801[_0x18f3('0x51')]=_0x430d58[_0x18f3('0x51')]||undefined;return _0x24f801;};exports['decrementTalkink']=function(_0x131c70,_0x3a972b){if(!_[_0x18f3('0x2b')](_0x131c70)){if(_0x131c70[_0x18f3('0x52')]>0x0){_0x131c70[_0x18f3('0x52')]-=0x1;}else{logger['error'](_0x3a972b,_0x18f3('0x53'));}}else{logger[_0x18f3('0xa')](_0x3a972b,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x18f3('0x54')]=function(_0x2d94a9){if(_0x2d94a9<=0x0){return!![];}return![];};function buildObj(_0x32825c,_0x13406a,_0x3047f6){_0x32825c[_0x18f3('0x55')]=_0x13406a;_0x32825c[_0x18f3('0x19')]=_0x32825c[_0x18f3('0x56')];_0x32825c[_0x18f3('0x57')]=_0x32825c[_0x18f3('0x43')];_0x32825c['motionChannel']=_0x18f3('0x58');if(_0x3047f6){_0x32825c[_0x18f3('0x59')]=_0x3047f6[_0x18f3('0x59')];}return _0x32825c;}exports[_0x18f3('0x5a')]=buildObj;exports[_0x18f3('0x5b')]=function(_0x10c06c){var _0x5cdda=[];for(var _0x3c0033 in _0x10c06c){if(_0x10c06c[_0x18f3('0x29')](_0x3c0033)){if(!_[_0x18f3('0x2b')](_0x10c06c[_0x3c0033])&&_0x10c06c[_0x3c0033][_0x18f3('0x33')]==='not_inuse'&&_0x10c06c[_0x3c0033][_0x18f3('0x5c')]===_0x18f3('0x5d')){_0x5cdda[_0x18f3('0x5e')](_0x10c06c[_0x3c0033]['id']);}}}return _0x5cdda;};exports['getDiff']=function(_0x46a27a){var _0x44965c=moment()[_0x18f3('0x5f')](0x0);var _0x27c369=moment(_0x46a27a)[_0x18f3('0x5f')](0x0);return _0x44965c[_0x18f3('0x60')](_0x27c369,_0x18f3('0x61'));};exports[_0x18f3('0x62')]=function(_0x4d89d9){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d89d9['ContactId'],'ListId':_0x4d89d9[_0x18f3('0x50')],'VoiceQueueId':_0x4d89d9[_0x18f3('0x51')]||undefined,'CampaignId':_0x4d89d9[_0x18f3('0x63')]||undefined};};exports['filterKey']=function(_0x11850d){if(_0x11850d==='uniqueid'||_0x11850d===_0x18f3('0x64')||_0x11850d===_0x18f3('0x56')||_0x11850d==='type'||_0x11850d===_0x18f3('0x65')||_0x11850d===_0x18f3('0x66')||_0x11850d===_0x18f3('0x37')||_0x11850d===_0x18f3('0x43')||_0x11850d===_0x18f3('0x1a')||_0x11850d===_0x18f3('0x67')||_0x11850d===_0x18f3('0x1b')||_0x11850d===_0x18f3('0x4e')||_0x11850d==='countbusyretry'||_0x11850d===_0x18f3('0x47')||_0x11850d==='countnoanswerretry'||_0x11850d===_0x18f3('0x68')||_0x11850d===_0x18f3('0x69')||_0x11850d===_0x18f3('0x6a')||_0x11850d==='callbackat'||_0x11850d==='recallme'||_0x11850d===_0x18f3('0x4f')||_0x11850d===_0x18f3('0x50')||_0x11850d===_0x18f3('0x38')||_0x11850d===_0x18f3('0x51')||_0x11850d===_0x18f3('0x6b')||_0x11850d===_0x18f3('0x6c')||_0x11850d===_0x18f3('0x6d')||_0x11850d==='xmd-phone'||_0x11850d===_0x18f3('0x6e')||_0x11850d===_0x18f3('0x6f')||_0x11850d===_0x18f3('0x70')||_0x11850d===_0x18f3('0x71')||_0x11850d==='xmd-dialid'||_0x11850d===_0x18f3('0x72')||_0x11850d==='xmd-contactid'||_0x11850d===_0x18f3('0x73')||_0x11850d===_0x18f3('0x74')||_0x11850d===_0x18f3('0x75')||_0x11850d===_0x18f3('0x76')||_0x11850d===_0x18f3('0x77')||_0x11850d==='rtpaudioqosbridged'||_0x11850d===_0x18f3('0x78')||_0x11850d===_0x18f3('0x79')||_0x11850d===_0x18f3('0x7a')||_0x11850d===_0x18f3('0x7b')||_0x11850d===_0x18f3('0x7c')||_0x11850d===_0x18f3('0x7d')||_0x11850d===_0x18f3('0x77')||_0x11850d==='rtpaudioqosbridged'||_0x11850d==='rtpaudioqosjitter'||_0x11850d===_0x18f3('0x79')||_0x11850d==='rtpaudioqosloss'||_0x11850d===_0x18f3('0x7b')||_0x11850d==='rtpaudioqosrtt'||_0x11850d==='rtpaudioqosrttbridged'||_0x11850d===_0x18f3('0x7e')||_0x11850d==='bridgepvtcallid'||_0x11850d===_0x18f3('0x33')||_0x11850d==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4dba1e,_0x444661){var _0x47d1de,_0x226643,_0x2eb959;if(_0x444661<=0x0){_0x444661=0x1;}_0x47d1de=new RegExp(_0x18f3('0x7f')+_0x444661+'}$');_0x226643=Math[_0x18f3('0x80')](0xa,_0x444661-0x1);_0x2eb959=Math[_0x18f3('0x80')](0xa,_0x444661)-0x1;return util[_0x18f3('0x13')]('%s',_[_0x18f3('0x81')](_0x4dba1e,_0x47d1de,_[_0x18f3('0x82')](_0x226643,_0x2eb959)));};exports[_0x18f3('0x83')]=function(_0x330285){var _0x153cf0=_0x330285['match'](/"(.*?)"/);return _0x153cf0?_0x153cf0[0x1]:_0x330285;};exports[_0x18f3('0x84')]=function(_0x17ad7a){var _0x175873=_0x17ad7a[_0x18f3('0x85')](/<(.*?)>/);return _0x175873?_0x175873[0x1]:_0x17ad7a;};function buildNoAnswerEventPayload(_0x3f66fe,_0x27b87d){var _0x5b5212=buildObj(_0x3f66fe,'noanswer');if(!_[_0x18f3('0x12')](_0x27b87d[_0x18f3('0x86')])){Object[_0x18f3('0x87')](_0x27b87d['variables'])[_0x18f3('0x88')](function(_0x4f71cf){_0x5b5212[_0x4f71cf[_0x18f3('0x89')]()]=_0x27b87d[_0x18f3('0x86')][_0x4f71cf];});}return _0x5b5212;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0xd494=['originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','starttime','responsetime','logAgent','state','ringtime','getSeconds','UserId','logCustomer','statedesc','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','CampaignId','filterKey','type','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','hasOwnProperty','toLower','updateOriginated'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0xd494,0xdf));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var _=require(_0x4d49('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x4d49('0x1'));var ipAgi=process[_0x4d49('0x2')][_0x4d49('0x3')]||_0x4d49('0x4');var utils=require(_0x4d49('0x5'));exports[_0x4d49('0x6')]=function(_0x532888){return function(_0x2931ea){logger[_0x4d49('0x7')](_0x532888,util['inspect'](_0x2931ea,{'showHidden':![],'depth':null}));};};exports[_0x4d49('0x8')]=function(_0x64299a,_0x15cbcf){logger[_0x4d49('0x9')](_0x64299a,util[_0x4d49('0xa')](_0x15cbcf,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5c3917,_0x58947e){logger['error'](_0x5c3917,util[_0x4d49('0xa')](_0x58947e,{'showHidden':![],'depth':null}));};exports[_0x4d49('0xb')]=function(_0x35068a){return function(_0x57f9e8){logger[_0x4d49('0x9')](_0x35068a,util['inspect'](_0x57f9e8,{'showHidden':![],'depth':null}));};};exports[_0x4d49('0xc')]=function(_0x3c217a,_0x4a1c53,_0x251d81){return{'message':_0x3c217a,'unlock':_0x4a1c53,'active':_0x251d81};};exports[_0x4d49('0xd')]=function(_0x33e5a5,_0x43fbde,_0x2889ac){if(!_['isUndefined'](_0x2889ac)&&_0x4d49('0xe')===typeof _0x2889ac&&!_['isEmpty'](_0x2889ac)){if(!_[_0x4d49('0xf')](_0x43fbde)&&'string'===typeof _0x43fbde&&!_[_0x4d49('0x10')](_0x43fbde)){return util[_0x4d49('0x11')](_0x4d49('0x12'),_0x43fbde,_0x2889ac);}return util['format'](_0x4d49('0x12'),_0x2889ac,_0x2889ac);}if(!_[_0x4d49('0xf')](_0x33e5a5)&&_0x4d49('0xe')===typeof _0x33e5a5&&!_[_0x4d49('0x10')](_0x33e5a5)){return _0x33e5a5;}return _0x4d49('0x13');};exports[_0x4d49('0x14')]=function(_0x2adcf4){if(_[_0x4d49('0x15')](_0x2adcf4)){return![];}return _0x2adcf4;};exports[_0x4d49('0x16')]=function(_0x45f44a,_0x30d3e1,_0x14b734,_0x3e83c3,_0xc76a9e,_0x2f3fb9){var _0x50dce4={'XMD-QUEUE':_0x30d3e1[_0x4d49('0x17')]?_0x30d3e1[_0x4d49('0x17')][_0x4d49('0x18')]:'','XMD-CALLERID':_0x3e83c3,'XMD-CALLERID-PREVIEW':_0x2f3fb9?util[_0x4d49('0x11')](_0x4d49('0x12'),_0x2f3fb9[_0x4d49('0x19')],_0x2f3fb9[_0x4d49('0x1a')]):_0x3e83c3,'XMD-DIALID':_0xc76a9e,'XMD-CONTACTID':_0x30d3e1[_0x4d49('0x1b')],'XMD-CDRTYPE':_0x4d49('0x1c'),'CALLERID(all)':_0x3e83c3,'XMD-VOICEQUEUEID':_0x30d3e1[_0x4d49('0x1d')],'XMD-DIALCHANNEL':_0x14b734,'XMD-DIALTIMEOUT':_0x45f44a[_0x4d49('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x4d49('0x11')]('\x22rtTxX%s%s\x22',_0x45f44a[_0x4d49('0x1f')]?'g':'',_['isEmpty'](_0x45f44a[_0x4d49('0x20')])?'':_0x4d49('0x21')),'XMD-DIALURL':_0x45f44a[_0x4d49('0x22')]||'','XMD-AGI':_0x45f44a[_0x4d49('0x23')]?util[_0x4d49('0x11')](_0x4d49('0x24'),ipAgi,_0x45f44a[_0x4d49('0x23')]):_0x4d49('0x25'),'XMD-AGIAFTER':_0x45f44a[_0x4d49('0x1f')]?util[_0x4d49('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x45f44a[_0x4d49('0x1f')]):_0x4d49('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2f3fb9?_0x2f3fb9[_0x4d49('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f3fb9?_0x2f3fb9['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x4d49('0x27')};if(!_[_0x4d49('0x10')](_0x45f44a[_0x4d49('0x20')])){_0x50dce4[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x45f44a[_0x4d49('0x20')];_0x50dce4[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xc76a9e;}return _0x50dce4;};exports['toLowerVariables']=function(_0x269eb6){var _0x2e9acc={};for(var _0x552f0b in _0x269eb6){if(_0x269eb6[_0x4d49('0x28')](_0x552f0b)){_0x2e9acc[util[_0x4d49('0x11')]('%s',_[_0x4d49('0x29')](_0x552f0b))]=_0x269eb6[_0x552f0b];}}return{'variables':_0x2e9acc};};exports[_0x4d49('0x2a')]=function(_0x90b71b,_0xbe6a63){if(!_[_0x4d49('0x15')](_0x90b71b)){if(_0x90b71b[_0x4d49('0x28')]('originated')){if(_0x90b71b[_0x4d49('0x2b')]>0x0){_0x90b71b['originated']-=0x1;}else{logger[_0x4d49('0x7')](_0x4d49('0x2c'),_0xbe6a63);}}}else{logger[_0x4d49('0x7')](_0x4d49('0x2d'),_0xbe6a63);}};exports['logBlacklist']=function(_0x23ceaf){var _0x327123=moment()[_0x4d49('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x23ceaf['state']=0xd;_0x23ceaf['statedesc']='Blacklist';_0x23ceaf[_0x4d49('0x2e')]=_0x327123;_0x23ceaf[_0x4d49('0x2f')]=_0x327123;_0x23ceaf['endtime']=_0x327123;};exports[_0x4d49('0x30')]=function(_0x275f14,_0x53fce1,_0x2cf593){var _0x4161b1=moment()[_0x4d49('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x275f14[_0x4d49('0x31')]=_0x53fce1;_0x275f14['statedesc']=_0x2cf593;_0x275f14['responsetime']=_0x4161b1;_0x275f14[_0x4d49('0x32')]=utils[_0x4d49('0x33')](_0x275f14[_0x4d49('0x2f')],_0x275f14[_0x4d49('0x2e')]);};exports['logLookAgent']=function(_0x128518,_0x53917b,_0x1e92a7){_0x128518['membername']=_0x53917b;_0x128518[_0x4d49('0x34')]=_0x1e92a7;};exports[_0x4d49('0x35')]=function(_0x3dac49,_0x5f12d0,_0x241aea){var _0x1217b6=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3dac49[_0x4d49('0x31')]=_0x5f12d0;_0x3dac49[_0x4d49('0x36')]=_0x241aea;_0x3dac49[_0x4d49('0x2f')]=_0x3dac49['responsetime']?_0x3dac49['responsetime']:_0x1217b6;_0x3dac49[_0x4d49('0x37')]=_0x3dac49[_0x4d49('0x37')]?_0x3dac49['endtime']:_0x1217b6;_0x3dac49[_0x4d49('0x32')]=utils[_0x4d49('0x33')](_0x3dac49[_0x4d49('0x2f')]||0x0,_0x3dac49['starttime']||0x0);_0x3dac49[_0x4d49('0x38')]=_0x3dac49[_0x4d49('0x39')]?utils[_0x4d49('0x33')](_0x3dac49[_0x4d49('0x37')],_0x3dac49[_0x4d49('0x39')]):0x0;};exports['isFailure']=function(_0x1f062e){return _0x1f062e===_0x4d49('0x3a');};exports[_0x4d49('0x3b')]=function(_0x27b942,_0x54381a,_0x5db35e,_0x55a901,_0x5d566c){var _0x10d194=_0x55a901?_0x4d49('0x3c'):_0x27b942[_0x4d49('0x19')];_0x10d194=_0x5d566c?_0x4d49('0x3d'):_0x10d194;return{'actionid':_0x27b942[_0x4d49('0x3e')],'action':_0x4d49('0x3f'),'channel':_0x27b942[_0x4d49('0x40')],'callerid':util[_0x4d49('0x11')](_0x4d49('0x12'),_0x10d194,_0x27b942[_0x4d49('0x1a')]),'Exten':_0x4d49('0x41'),'Context':_0x4d49('0x42'),'Priority':'1','variable':_0x5db35e,'timeout':(_0x54381a[_0x4d49('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x27b942[_0x4d49('0x3e')]};};exports['totalGlobal']=function(_0x2bb1d3){return _0x2bb1d3[_0x4d49('0x44')]+_0x2bb1d3[_0x4d49('0x45')]+_0x2bb1d3['countnoanswerretry']+_0x2bb1d3[_0x4d49('0x46')]+_0x2bb1d3[_0x4d49('0x47')];};exports['cloneAction']=function(_0x3789a3){var _0x38154e=_['clone'](_0x3789a3);_0x38154e['state']=0xf;_0x38154e[_0x4d49('0x36')]=_0x4d49('0x48');return _0x38154e;};exports[_0x4d49('0x49')]=function(_0x9534a7,_0x572ab0,_0x26bd4d){var _0x2f4f30={};_0x2f4f30[_0x572ab0]=_0x9534a7[_0x572ab0];_0x2f4f30['active']=![];_0x2f4f30[_0x4d49('0x4a')]=moment()[_0x4d49('0x4b')](_0x26bd4d,'minutes')[_0x4d49('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f4f30[_0x4d49('0x1b')]=_0x9534a7['ContactId'];_0x2f4f30[_0x4d49('0x4c')]=_0x9534a7[_0x4d49('0x4c')];_0x2f4f30['VoiceQueueId']=_0x9534a7[_0x4d49('0x1d')]||undefined;return _0x2f4f30;};exports[_0x4d49('0x4d')]=function(_0x25d5eb,_0x161f60){if(!_['isNil'](_0x25d5eb)){if(_0x25d5eb['pTalking']>0x0){_0x25d5eb['pTalking']-=0x1;}else{logger[_0x4d49('0x7')](_0x161f60,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x4d49('0x7')](_0x161f60,_0x4d49('0x4e'));}};exports[_0x4d49('0x4f')]=function(_0x13ed2f){if(_0x13ed2f<=0x0){return!![];}return![];};function buildObj(_0x22240b,_0x46d0a3,_0x309964){_0x22240b['lastevent']=_0x46d0a3;_0x22240b[_0x4d49('0x18')]=_0x22240b[_0x4d49('0x50')];_0x22240b['interface']=_0x22240b[_0x4d49('0x40')];_0x22240b[_0x4d49('0x51')]=_0x4d49('0x52');if(_0x309964){_0x22240b['mandatoryDisposition']=_0x309964[_0x4d49('0x53')];}return _0x22240b;}exports[_0x4d49('0x54')]=buildObj;exports[_0x4d49('0x55')]=function(_0x23d59e){var _0xa7c53f=[];for(var _0x3e7102 in _0x23d59e){if(_0x23d59e[_0x4d49('0x28')](_0x3e7102)){if(!_[_0x4d49('0x15')](_0x23d59e[_0x3e7102])&&_0x23d59e[_0x3e7102][_0x4d49('0x31')]===_0x4d49('0x56')&&_0x23d59e[_0x3e7102][_0x4d49('0x57')]===_0x4d49('0x58')){_0xa7c53f[_0x4d49('0x59')](_0x23d59e[_0x3e7102]['id']);}}}return _0xa7c53f;};exports[_0x4d49('0x5a')]=function(_0x492d87){var _0x4088a0=moment()[_0x4d49('0x5b')](0x0);var _0x397282=moment(_0x492d87)[_0x4d49('0x5b')](0x0);return _0x4088a0['diff'](_0x397282,_0x4d49('0x5c'));};exports['createBody']=function(_0x36d1c1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x36d1c1[_0x4d49('0x1b')],'ListId':_0x36d1c1[_0x4d49('0x4c')],'VoiceQueueId':_0x36d1c1['VoiceQueueId']||undefined,'CampaignId':_0x36d1c1[_0x4d49('0x5d')]||undefined};};exports[_0x4d49('0x5e')]=function(_0x325e76){if(_0x325e76===_0x4d49('0x3e')||_0x325e76==='idContact'||_0x325e76===_0x4d49('0x50')||_0x325e76===_0x4d49('0x5f')||_0x325e76===_0x4d49('0x60')||_0x325e76===_0x4d49('0x61')||_0x325e76==='membername'||_0x325e76==='channelAgent'||_0x325e76==='calleridname'||_0x325e76===_0x4d49('0x62')||_0x325e76==='calleridnum'||_0x325e76===_0x4d49('0x4a')||_0x325e76===_0x4d49('0x44')||_0x325e76===_0x4d49('0x45')||_0x325e76==='countnoanswerretry'||_0x325e76===_0x4d49('0x63')||_0x325e76===_0x4d49('0x64')||_0x325e76===_0x4d49('0x65')||_0x325e76===_0x4d49('0x66')||_0x325e76===_0x4d49('0x67')||_0x325e76===_0x4d49('0x1b')||_0x325e76===_0x4d49('0x4c')||_0x325e76===_0x4d49('0x34')||_0x325e76==='VoiceQueueId'||_0x325e76===_0x4d49('0x68')||_0x325e76===_0x4d49('0x69')||_0x325e76==='xmd-queue'||_0x325e76==='xmd-phone'||_0x325e76==='xmd-listid'||_0x325e76==='xmd-dialurl'||_0x325e76==='xmd-dialtimeout'||_0x325e76===_0x4d49('0x6a')||_0x325e76===_0x4d49('0x6b')||_0x325e76==='xmd-dialchannel'||_0x325e76===_0x4d49('0x6c')||_0x325e76==='xmd-cdrtype'||_0x325e76===_0x4d49('0x6d')||_0x325e76===_0x4d49('0x6e')||_0x325e76===_0x4d49('0x6f')||_0x325e76===_0x4d49('0x70')||_0x325e76===_0x4d49('0x71')||_0x325e76===_0x4d49('0x72')||_0x325e76===_0x4d49('0x73')||_0x325e76===_0x4d49('0x74')||_0x325e76==='rtpaudioqoslossbridged'||_0x325e76===_0x4d49('0x75')||_0x325e76==='rtpaudioqosrttbridged'||_0x325e76===_0x4d49('0x70')||_0x325e76===_0x4d49('0x71')||_0x325e76===_0x4d49('0x72')||_0x325e76==='rtpaudioqosjitterbridged'||_0x325e76===_0x4d49('0x74')||_0x325e76===_0x4d49('0x76')||_0x325e76===_0x4d49('0x75')||_0x325e76===_0x4d49('0x77')||_0x325e76===_0x4d49('0x78')||_0x325e76==='bridgepvtcallid'||_0x325e76===_0x4d49('0x31')||_0x325e76==='statedesc'){return![];}return!![];};exports[_0x4d49('0x79')]=function(_0x36d21e,_0x351393){var _0x387e2f,_0x1591d3,_0x580bb4;if(_0x351393<=0x0){_0x351393=0x1;}_0x387e2f=new RegExp(_0x4d49('0x7a')+_0x351393+'}$');_0x1591d3=Math[_0x4d49('0x7b')](0xa,_0x351393-0x1);_0x580bb4=Math[_0x4d49('0x7b')](0xa,_0x351393)-0x1;return util[_0x4d49('0x11')]('%s',_[_0x4d49('0x7c')](_0x36d21e,_0x387e2f,_['random'](_0x1591d3,_0x580bb4)));};exports[_0x4d49('0x7d')]=function(_0x5134af){var _0x40eff0=_0x5134af[_0x4d49('0x7e')](/"(.*?)"/);return _0x40eff0?_0x40eff0[0x1]:_0x5134af;};exports['extractCalleridNumber']=function(_0x497993){var _0x263023=_0x497993[_0x4d49('0x7e')](/<(.*?)>/);return _0x263023?_0x263023[0x1]:_0x497993;};function buildNoAnswerEventPayload(_0x4d52d9,_0x44c202){var _0x4f80e1=buildObj(_0x4d52d9,_0x4d49('0x7f'));if(!_['isEmpty'](_0x44c202[_0x4d49('0x80')])){Object[_0x4d49('0x81')](_0x44c202[_0x4d49('0x80')])[_0x4d49('0x82')](function(_0x2b7b0f){_0x4f80e1[_0x2b7b0f[_0x4d49('0x83')]()]=_0x44c202[_0x4d49('0x80')][_0x2b7b0f];});}return _0x4f80e1;}exports[_0x4d49('0x84')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 151601a..0f0a10f 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 _0x9c79=['queueadd','string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x3e0593,_0x296acd){var _0x36dd6b=function(_0x3cd977){while(--_0x3cd977){_0x3e0593['push'](_0x3e0593['shift']());}};_0x36dd6b(++_0x296acd);}(_0x9c79,0xb4));var _0x99c7=function(_0xb093,_0x5403c4){_0xb093=_0xb093-0x0;var _0x516bac=_0x9c79[_0xb093];return _0x516bac;};'use strict';exports[_0x99c7('0x0')]={'queue':{'type':_0x99c7('0x1'),'required':!![]},'interface':{'type':_0x99c7('0x1'),'required':!![]},'membername':{'type':_0x99c7('0x1'),'required':!![]},'penalty':{'type':_0x99c7('0x2'),'required':![]},'paused':{'type':_0x99c7('0x3'),'required':![]}};exports[_0x99c7('0x4')]={'queue':{'type':_0x99c7('0x1'),'required':!![]},'interface':{'type':_0x99c7('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x99c7('0x1'),'required':!![]},'paused':{'type':_0x99c7('0x3')},'reason':{'type':'string','required':![]}};exports[_0x99c7('0x5')]={'module':{'type':_0x99c7('0x1'),'required':![]}};exports[_0x99c7('0x6')]={'uniqueid':{'type':_0x99c7('0x1'),'required':!![]}};exports[_0x99c7('0x7')]={'uniqueid':{'type':_0x99c7('0x1'),'required':!![]},'filename':{'type':_0x99c7('0x1')},'format':{'type':_0x99c7('0x1')},'mixmonitorid':{'type':_0x99c7('0x1')}};exports[_0x99c7('0x8')]={'uniqueid':{'type':_0x99c7('0x1'),'required':!![]}};exports[_0x99c7('0x9')]={'uniqueid':{'type':_0x99c7('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x4925=['voicequeuechannelredirect','queueadd','string','number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x139eeb,_0x1de53e){var _0x53bf0a=function(_0x55f6e0){while(--_0x55f6e0){_0x139eeb['push'](_0x139eeb['shift']());}};_0x53bf0a(++_0x1de53e);}(_0x4925,0x8d));var _0x5492=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x4925[_0x590b61];return _0x1a14dc;};'use strict';exports[_0x5492('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x5492('0x1'),'required':!![]},'penalty':{'type':_0x5492('0x2'),'required':![]},'paused':{'type':_0x5492('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x5492('0x1'),'required':!![]},'interface':{'type':_0x5492('0x1'),'required':!![]}};exports[_0x5492('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x5492('0x3')},'reason':{'type':_0x5492('0x1'),'required':![]}};exports[_0x5492('0x5')]={'module':{'type':'string','required':![]}};exports[_0x5492('0x6')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]}};exports[_0x5492('0x7')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x5492('0x1')},'mixmonitorid':{'type':_0x5492('0x1')}};exports[_0x5492('0x8')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]}};exports[_0x5492('0x9')]={'uniqueid':{'type':_0x5492('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x5492('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 70823c3..6f44f3e 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x3711e2,_0x1468e1){var _0x18a556=function(_0x5e0923){while(--_0x5e0923){_0x3711e2['push'](_0x3711e2['shift']());}};_0x18a556(++_0x1468e1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e731e,_0x25acd5){_0x1e731e=_0x1e731e-0x0;var _0x37ba4c=_0x5f2f[_0x1e731e];return _0x37ba4c;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x5d3a22,_0x59ffcd){var _0xefcb06=function(_0x45a634){while(--_0x45a634){_0x5d3a22['push'](_0x5d3a22['shift']());}};_0xefcb06(++_0x59ffcd);}(_0x757a,0xde));var _0xa757=function(_0x424c1a,_0x364333){_0x424c1a=_0x424c1a-0x0;var _0x543c7e=_0x757a[_0x424c1a];return _0x543c7e;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index af21077..9c2f5c6 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4ff=['mergeDBDataToRealtime','assign'];(function(_0x19d673,_0x28e318){var _0x1c349f=function(_0x3b2819){while(--_0x3b2819){_0x19d673['push'](_0x19d673['shift']());}};_0x1c349f(++_0x28e318);}(_0xb4ff,0x1b7));var _0xfb4f=function(_0x24edf6,_0x4362fd){_0x24edf6=_0x24edf6-0x0;var _0x56e4ae=_0xb4ff[_0x24edf6];return _0x56e4ae;};'use strict';function mergeDBDataToRealtime(_0x9b4052,_0x4059ce){var _0xeaaa3b=Object[_0xfb4f('0x0')]({},_0x9b4052);for(var _0x3aea6 in _0x4059ce){if(_0xeaaa3b['hasOwnProperty'](_0x3aea6)){_0xeaaa3b[_0x3aea6]=_0x4059ce[_0x3aea6];}}return _0xeaaa3b;}exports[_0xfb4f('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x8975=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x2fe780,_0x3ff71b){var _0x3b67cc=function(_0xbb4782){while(--_0xbb4782){_0x2fe780['push'](_0x2fe780['shift']());}};_0x3b67cc(++_0x3ff71b);}(_0x8975,0xb0));var _0x5897=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8975[_0x1cc8fe];return _0x230054;};'use strict';function mergeDBDataToRealtime(_0x2fb38c,_0x4f6693){var _0xeb2cfc=Object[_0x5897('0x0')]({},_0x2fb38c);for(var _0x3ec850 in _0x4f6693){if(_0xeb2cfc[_0x5897('0x1')](_0x3ec850)){_0xeb2cfc[_0x3ec850]=_0x4f6693[_0x3ec850];}}return _0xeb2cfc;}exports[_0x5897('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8bd8a44..1bf7c32 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 _0x8b30=['disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','channel','startsWith','Local','indexOf','mobile','phone','lastIndexOf','findAgent','lodash','moment','util','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','split','calleridnum','internal','destination','exten','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel'];(function(_0x510347,_0xdf770a){var _0x5cb84f=function(_0x4c35d7){while(--_0x4c35d7){_0x510347['push'](_0x510347['shift']());}};_0x5cb84f(++_0xdf770a);}(_0x8b30,0x19b));var _0x08b3=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x8b30[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x08b3('0x0'));var moment=require(_0x08b3('0x1'));var util=require(_0x08b3('0x2'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x08b3('0x3'));var RpcVoiceDialReport=require(_0x08b3('0x4'));var RpcMemberReport=require(_0x08b3('0x5'));var RpcVoiceQueueReport=require(_0x08b3('0x6'));var RpcVoiceRecording=require(_0x08b3('0x7'));var RpcVoiceTransferReport=require(_0x08b3('0x8'));var VoiceQueueReport=require(_0x08b3('0x9'));var VoiceCallReport=require(_0x08b3('0xa'));var VoiceAgentReport=require(_0x08b3('0xb'));var VoiceDialReport=require(_0x08b3('0xc'));var UserReport=require('./userReport');function Report(_0x57f50d){this[_0x08b3('0xd')]=_0x57f50d;this['agents']=_0x57f50d[_0x08b3('0xe')];this[_0x08b3('0xf')]=_0x57f50d['telephones'];}Report[_0x08b3('0x10')][_0x08b3('0x11')]=function(_0x979054){var _0x5b38ee=new VoiceQueueReport(this[_0x08b3('0xd')]);var _0x59fd6f=new VoiceAgentReport(this[_0x08b3('0xd')]);var _0x1c8df6=new VoiceDialReport(this[_0x08b3('0xd')]);var _0x2c8364=new VoiceCallReport(this[_0x08b3('0xd')]);var _0x3ee873=new UserReport(this[_0x08b3('0xd')]);if(config[_0x08b3('0x12')]&&config[_0x08b3('0x12')][_0x08b3('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x08b3('0x14')][_0x08b3('0x15')](this));ami['on'](_0x08b3('0x16'),this[_0x08b3('0x17')][_0x08b3('0x15')](this));ami['on'](_0x08b3('0x18'),this[_0x08b3('0x19')][_0x08b3('0x15')](this));ami['on'](_0x08b3('0x1a'),this['voiceDialReport'][_0x08b3('0x15')](this));ami['on'](_0x08b3('0x1b'),this[_0x08b3('0x1c')][_0x08b3('0x15')](this));ami['on'](_0x08b3('0x1d'),this[_0x08b3('0x1e')]['bind'](this));}};Report[_0x08b3('0x10')]['findAgent']=function(_0x21f2cf){var _0x5ef9ac;_0x5ef9ac=_[_0x08b3('0x1f')](this[_0x08b3('0xe')],function(_0x4be057){return _0x4be057[_0x08b3('0x20')]==_0x21f2cf||_0x4be057[_0x08b3('0x21')]==_0x21f2cf;});if(_['isNil'](_0x5ef9ac)){var _0x282bf8=_[_0x08b3('0x1f')](this[_0x08b3('0xf')],function(_0x4ecbce){return _0x4ecbce[_0x08b3('0x20')]==_0x21f2cf||_0x4ecbce[_0x08b3('0x21')]==_0x21f2cf;});if(_0x282bf8){_0x5ef9ac=_[_0x08b3('0x1f')](this[_0x08b3('0xe')],function(_0x5660f6){return _0x5660f6[_0x08b3('0x22')]==util[_0x08b3('0x23')](_0x08b3('0x24'),_0x282bf8[_0x08b3('0x21')]);});}}return _0x5ef9ac;};Report['prototype'][_0x08b3('0x14')]=function(_0x41c6ae){for(var _0x267fa0=0x0;_0x267fa0<_0x41c6ae[_0x08b3('0x25')];_0x267fa0+=0x1){var _0x1da2a9=this['findAgent'](_0x41c6ae[_0x267fa0][_0x08b3('0x26')]);if(_0x1da2a9){_0x41c6ae[_0x267fa0]['accountcode']=_0x1da2a9[_0x08b3('0x20')];_0x41c6ae[_0x267fa0][_0x08b3('0x27')]=!![];_0x41c6ae[_0x267fa0][_0x08b3('0x28')]=_0x1da2a9[_0x08b3('0x21')];_0x41c6ae[_0x267fa0][_0x08b3('0x22')]=_['isNil'](_0x1da2a9[_0x08b3('0x22')])?util[_0x08b3('0x23')](_0x08b3('0x24'),_0x1da2a9[_0x08b3('0x21')]):_0x1da2a9[_0x08b3('0x22')];if(_0x41c6ae[_0x267fa0][_0x08b3('0x29')]){_0x41c6ae[_0x267fa0][_0x08b3('0x2a')]=moment()[_0x08b3('0x23')](_0x08b3('0x2b'));}if(_0x41c6ae[_0x267fa0]['queuecallerexit']){_0x41c6ae[_0x267fa0][_0x08b3('0x2c')]=moment()[_0x08b3('0x23')](_0x08b3('0x2b'));}RpcMemberReport[_0x08b3('0x14')](_0x41c6ae[_0x267fa0]);}RpcVoiceQueueReport[_0x08b3('0x2d')](_0x41c6ae[_0x267fa0]);}};function extractCalleridNumber(_0x5add8f){var _0x1fa78c=_0x5add8f['match'](/<(.*?)>/);return _0x1fa78c?_0x1fa78c[0x1]:_0x5add8f;}Report[_0x08b3('0x10')][_0x08b3('0x2e')]=function(_0x5dfce8){for(var _0x5bda0e=0x0;_0x5bda0e/);return _0x2e7637?_0x2e7637[0x1]:_0x2c2f3b;}Report['prototype'][_0x34a6('0x2c')]=function(_0x47f477){for(var _0x19d19f=0x0;_0x19d19f',_0x1f67aa[_0x34a6('0x43')],_0x1f67aa[_0x34a6('0x31')]);}if(RpcVoiceTransferReport[_0x34a6('0x44')][_0x1f67aa[_0x34a6('0x45')]]){var _0x231ac4=RpcVoiceTransferReport[_0x34a6('0x44')][_0x1f67aa[_0x34a6('0x45')]];_0x231ac4['transfereelinkedid']=_0x1f67aa['uniqueid'];RpcVoiceTransferReport[_0x34a6('0x1a')](_0x231ac4);delete RpcVoiceTransferReport[_0x34a6('0x44')][_0x1f67aa['linkedid']];}if(_['isNil'](_0x1f67aa[_0x34a6('0x35')])){_0x1f67aa[_0x34a6('0x35')]=this[_0x34a6('0x2e')](_0x1f67aa);}if(_[_0x34a6('0x21')](_0x1f67aa[_0x34a6('0x46')])){var _0x18b103=_0x1f67aa['channel'][_0x34a6('0x30')]('-')[0x0];var _0x2ba453=this[_0x34a6('0xc')][_0x18b103];if(!_0x2ba453)_0x2ba453=this[_0x34a6('0x2c')](_0x1f67aa[_0x34a6('0x1f')]);if(_0x2ba453){_0x1f67aa['UserId']=_0x2ba453['id'];_0x1f67aa[_0x34a6('0x47')]=_0x2ba453[_0x34a6('0x20')];}}RpcVoiceCallReport[_0x34a6('0x48')](_0x1f67aa);if(_0x1f67aa[_0x34a6('0x49')]){for(var _0x19b90f=0x0;_0x19b90f<_0x1f67aa[_0x34a6('0x4a')][_0x34a6('0x24')];_0x19b90f+=0x1){_0x1f67aa['monitorFilename']=_0x1f67aa[_0x34a6('0x4a')][_0x19b90f][_0x34a6('0x4b')];_0x1f67aa[_0x34a6('0x4c')]=_0x1f67aa[_0x34a6('0x4a')][_0x19b90f]['createdAt'];if(_0x1f67aa[_0x34a6('0x4d')]==_0x34a6('0x3c')){_0x1f67aa[_0x34a6('0x31')]=_0x1f67aa['connectedlinenum'];_0x1f67aa[_0x34a6('0x43')]=_0x1f67aa['connectedlinename'];_0x1f67aa[_0x34a6('0x42')]=_0x1f67aa[_0x34a6('0x1f')];_0x1f67aa[_0x34a6('0x4e')]=_0x1f67aa[_0x34a6('0x47')];_0x1f67aa['exten']=_0x1f67aa['originatecalleridnum'];}else if(_0x1f67aa['exten']==_0x34a6('0x4f')){_0x1f67aa[_0x34a6('0x31')]=_0x1f67aa[_0x34a6('0x34')];_0x1f67aa[_0x34a6('0x4d')]=_0x1f67aa[_0x34a6('0x40')];}RpcVoiceRecording[_0x34a6('0x48')](_0x1f67aa);}}};Report[_0x34a6('0xe')][_0x34a6('0x16')]=function(_0x470085){if(_[_0x34a6('0x50')](_0x470085)){_0x470085[_0x34a6('0x51')](function(_0xeb7e33){RpcVoiceAgentReport[_0x34a6('0x48')](_0xeb7e33);});}else{RpcVoiceAgentReport[_0x34a6('0x48')](_0x470085);}};Report[_0x34a6('0xe')][_0x34a6('0x18')]=function(_0x3f3a79){RpcVoiceDialReport[_0x34a6('0x48')](_0x3f3a79);var _0x104520;var _0x17d0e9;var _0x1093d3=_0x3f3a79[_0x34a6('0x2f')];if(_[_0x34a6('0x52')](_0x1093d3,_0x34a6('0x53'))){_0x17d0e9=_0x1093d3[_0x34a6('0x54')](_0x1093d3[_0x34a6('0x55')]('/')+0x1,_0x1093d3[_0x34a6('0x55')]('@'));_0x104520=_[_0x34a6('0x1e')](this[_0x34a6('0xc')],function(_0x11d89e){return _0x11d89e[_0x34a6('0x56')]==_0x17d0e9||_0x11d89e[_0x34a6('0x57')]==_0x17d0e9||_0x11d89e[_0x34a6('0x1f')]==_0x17d0e9;});}else{_0x17d0e9=_0x1093d3[_0x34a6('0x54')](_0x1093d3[_0x34a6('0x55')]('/')+0x1,_0x1093d3[_0x34a6('0x58')]('-'));_0x104520=this[_0x34a6('0x1d')](_0x17d0e9);}if(_0x104520){_0x3f3a79['interface']=_[_0x34a6('0x21')](_0x104520[_0x34a6('0x22')])?util[_0x34a6('0x23')](_0x34a6('0x27'),_0x104520[_0x34a6('0x20')]):_0x104520['interface'];_0x3f3a79['membername']=_0x104520[_0x34a6('0x20')];_0x3f3a79[_0x34a6('0x1f')]=_0x104520[_0x34a6('0x1f')];RpcMemberReport[_0x34a6('0x18')](_0x3f3a79);}};Report[_0x34a6('0xe')][_0x34a6('0x1a')]=function(_0x289799){RpcVoiceTransferReport['transfers'][_0x289799[_0x34a6('0x59')]]=_0x289799;};Report[_0x34a6('0xe')]['attendedTransfer']=function(_0x3c021c){RpcVoiceTransferReport['attendedTransfer'](_0x3c021c);};module[_0x34a6('0x5a')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 1cf09e8..299d3ae 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01c7=['trunk:save','[userReport][registry]','syncDeviceState','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','indexOf','find','mobile','phone','accountcode','syncPeerStatus','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','lodash','moment','ioredis','bluebird','../../../config/environment','redis','defaults','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name'];(function(_0x2b3821,_0x58db6c){var _0x24d7e3=function(_0x30f250){while(--_0x30f250){_0x2b3821['push'](_0x2b3821['shift']());}};_0x24d7e3(++_0x58db6c);}(_0x01c7,0x12a));var _0x701c=function(_0x54dc2,_0xa77a2f){_0x54dc2=_0x54dc2-0x0;var _0x1ca1b4=_0x01c7[_0x54dc2];return _0x1ca1b4;};'use strict';var _=require(_0x701c('0x0'));var moment=require(_0x701c('0x1'));var util=require('util');var Redis=require(_0x701c('0x2'));var BPromise=require(_0x701c('0x3'));var config=require(_0x701c('0x4'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x701c('0x5')]=_[_0x701c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x701c('0x5')]));function UserReport(_0x1b0bcc){this[_0x701c('0x7')]=_0x1b0bcc[_0x701c('0x7')];this[_0x701c('0x8')]=_0x1b0bcc['agents'];this[_0x701c('0x9')]=_0x1b0bcc[_0x701c('0x9')];ami['on'](_0x701c('0xa'),this[_0x701c('0xb')][_0x701c('0xc')](this));ami['on']('registry',this[_0x701c('0xb')][_0x701c('0xc')](this));ami['on'](_0x701c('0xd'),this['syncDeviceState'][_0x701c('0xc')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x701c('0xc')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x701c('0xe')]()[_0x701c('0xf')](ami[_0x701c('0x10')]())['catch'](function(_0x3b1cc0){logger[_0x701c('0x11')](_0x701c('0x12'),util[_0x701c('0x13')](_0x3b1cc0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x701c('0xe')]()['then'](ami[_0x701c('0x14')]())[_0x701c('0x15')](function(_0x37cdba){logger[_0x701c('0x11')]('[userReport][devicestatelist]',util[_0x701c('0x13')](_0x37cdba,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x701c('0xf')](ami[_0x701c('0x16')]())[_0x701c('0x15')](function(_0x3f5e81){logger[_0x701c('0x11')](_0x701c('0x17'),util[_0x701c('0x13')](_0x3f5e81,{'showHidden':![],'depth':null}));});}UserReport[_0x701c('0x18')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x701c('0xe')]()[_0x701c('0xf')](showSipRegistrations())[_0x701c('0xf')](listDeviceStates())[_0x701c('0xf')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x701c('0x19')]=function(_0x2b5a66){return _0x2b5a66!==null&&!_['isUndefined'](_0x2b5a66);};UserReport[_0x701c('0x18')][_0x701c('0x1a')]=function(_0x4b6504,_0x77b579,_0x500702){io['to'](_0x4b6504)['emit'](_0x77b579,_0x500702);};UserReport[_0x701c('0x18')][_0x701c('0xb')]=function(_0x30add2){try{if(this[_0x701c('0x19')](_0x30add2)){logger[_0x701c('0x1b')](_0x701c('0x1c'),_0x30add2[_0x701c('0x1d')],_0x30add2[_0x701c('0x1e')]);logger[_0x701c('0x1f')]('[userReport][registry]',util['inspect'](_0x30add2,{'showHidden':![],'depth':null}));var _0x474c88=_['find'](this[_0x701c('0x7')],{'defaultuser':_0x30add2[_0x701c('0x1d')]});if(_0x474c88){_0x30add2['stateRegistry']=_0x30add2[_0x701c('0x1e')];_['merge'](_0x474c88,_[_0x701c('0x20')](_0x30add2,[_0x701c('0x21'),'actionid','username',_0x701c('0x1e')]));logger[_0x701c('0x1f')](_0x701c('0x22'),util['inspect'](_0x474c88,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x701c('0x23'),_0x474c88[_0x701c('0x24')]),_0x701c('0x25'),_0x474c88);}}}catch(_0x85a3fe){logger['error'](_0x701c('0x26'),util[_0x701c('0x13')](_0x85a3fe,{'showHidden':![],'depth':null}));}};UserReport[_0x701c('0x18')][_0x701c('0x27')]=function(_0x434598){try{if(this[_0x701c('0x19')](_0x434598)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x434598['device'],_0x434598[_0x701c('0x1e')]);logger[_0x701c('0x1f')](_0x701c('0x28'),util['inspect'](_0x434598,{'showHidden':![],'depth':null}));if(this[_0x701c('0x8')][_0x434598[_0x701c('0x29')]]){if(!this['agents'][_0x434598[_0x701c('0x29')]]['local']||_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]()==_0x701c('0x2b')){this[_0x701c('0x8')][_0x434598['device']][_0x701c('0x2c')]=![];if(this['agents'][_0x434598[_0x701c('0x29')]][_0x701c('0x1e')]!==_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]()){this[_0x701c('0x8')][_0x434598[_0x701c('0x29')]][_0x701c('0x2d')]=_[_0x701c('0x2e')](moment()[_0x701c('0x2f')]('x'));}this[_0x701c('0x8')][_0x434598[_0x701c('0x29')]][_0x701c('0x1e')]=_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]();this[_0x701c('0x8')][_0x434598[_0x701c('0x29')]][_0x701c('0x30')](_0x434598);}}else if(this['telephones'][_0x434598[_0x701c('0x29')]]){if(this[_0x701c('0x9')][_0x434598[_0x701c('0x29')]]['state']!==_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]()){this[_0x701c('0x9')][_0x434598['device']][_0x701c('0x2d')]=_[_0x701c('0x2e')](moment()[_0x701c('0x2f')]('x'));}this[_0x701c('0x9')][_0x434598['device']][_0x701c('0x1e')]=_0x434598['state'][_0x701c('0x2a')]();logger[_0x701c('0x1f')](_0x701c('0x31'),util[_0x701c('0x13')](this['telephones'][_0x434598['device']],{'showHidden':![],'depth':null}));this[_0x701c('0x1a')](util[_0x701c('0x2f')]('telephone:%s',this['telephones'][_0x434598[_0x701c('0x29')]][_0x701c('0x24')]),_0x701c('0x32'),this[_0x701c('0x9')][_0x434598[_0x701c('0x29')]]);}else if(this[_0x701c('0x7')][_0x434598['device']]){if(this[_0x701c('0x7')][_0x434598[_0x701c('0x29')]]['state']!==_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]()){this[_0x701c('0x7')][_0x434598[_0x701c('0x29')]][_0x701c('0x2d')]=_[_0x701c('0x2e')](moment()['format']('x'));}this['trunks'][_0x434598[_0x701c('0x29')]][_0x701c('0x1e')]=_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]();logger[_0x701c('0x1f')](_0x701c('0x33'),util[_0x701c('0x13')](this[_0x701c('0x7')][_0x434598[_0x701c('0x29')]],{'showHidden':![],'depth':null}));this[_0x701c('0x1a')](util[_0x701c('0x2f')](_0x701c('0x23'),this[_0x701c('0x7')][_0x434598[_0x701c('0x29')]]['name']),'trunk:save',this[_0x701c('0x7')][_0x434598['device']]);}else if(_[_0x701c('0x34')](_0x434598[_0x701c('0x29')],'Local')){var _0x217668=_0x434598[_0x701c('0x29')];var _0x11b508=_0x217668['substring'](_0x217668[_0x701c('0x35')]('/')+0x1,_0x217668[_0x701c('0x35')]('@'));var _0x2fcdb1=_[_0x701c('0x36')](this[_0x701c('0x8')],function(_0x390c3a){return _0x390c3a[_0x701c('0x37')]==_0x11b508||_0x390c3a[_0x701c('0x38')]==_0x11b508||_0x390c3a[_0x701c('0x39')]==_0x11b508;});if(_0x2fcdb1){if(_0x2fcdb1[_0x701c('0x1e')]!==_0x434598['state'][_0x701c('0x2a')]()){_0x2fcdb1[_0x701c('0x2d')]=_[_0x701c('0x2e')](moment()[_0x701c('0x2f')]('x'));}_0x2fcdb1[_0x701c('0x1e')]=_0x434598[_0x701c('0x1e')][_0x701c('0x2a')]();_0x2fcdb1[_0x701c('0x2c')]=!![];_0x2fcdb1['updateStatusRealtime'](_0x434598);}}}}catch(_0x4cd447){logger[_0x701c('0x11')](_0x701c('0x28'),util[_0x701c('0x13')](_0x4cd447,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x701c('0x3a')]=function(_0xd6770a){try{if(this[_0x701c('0x19')](_0xd6770a)&&this[_0x701c('0x19')](_0xd6770a[_0x701c('0x3b')])){logger[_0x701c('0x1b')](_0x701c('0x3c'),_0xd6770a['peer'],_0xd6770a[_0x701c('0x3d')],_0xd6770a['peerstatus']);logger['debug'](_0x701c('0x3e'),util[_0x701c('0x13')](_0xd6770a,{'showHidden':![],'depth':null}));if(this[_0x701c('0x8')][_0xd6770a[_0x701c('0x3f')]]){if(!this[_0x701c('0x8')][_0xd6770a[_0x701c('0x3f')]][_0x701c('0x2c')]||_0xd6770a[_0x701c('0x3b')][_0x701c('0x2a')]()==_0x701c('0x40')){this[_0x701c('0x8')][_0xd6770a['peer']][_0x701c('0x2c')]=![];this[_0x701c('0x8')][_0xd6770a['peer']]['status']=_0xd6770a[_0x701c('0x3b')][_0x701c('0x2a')]();this[_0x701c('0x8')][_0xd6770a['peer']]['address']=_0xd6770a[_0x701c('0x3d')];this[_0x701c('0x8')][_0xd6770a[_0x701c('0x3f')]][_0x701c('0x30')](_0xd6770a);}}else if(this[_0x701c('0x9')][_0xd6770a['peer']]){this[_0x701c('0x9')][_0xd6770a[_0x701c('0x3f')]]['status']=_0xd6770a[_0x701c('0x3b')][_0x701c('0x2a')]();this[_0x701c('0x9')][_0xd6770a[_0x701c('0x3f')]]['address']=_0xd6770a['address'];logger[_0x701c('0x1f')](_0x701c('0x41'),util['inspect'](this['telephones'][_0xd6770a[_0x701c('0x3f')]],{'showHidden':![],'depth':null}));this[_0x701c('0x1a')](util[_0x701c('0x2f')](_0x701c('0x42'),this[_0x701c('0x9')][_0xd6770a['peer']][_0x701c('0x24')]),_0x701c('0x32'),this[_0x701c('0x9')][_0xd6770a[_0x701c('0x3f')]]);}else if(this[_0x701c('0x7')][_0xd6770a[_0x701c('0x3f')]]){this[_0x701c('0x7')][_0xd6770a[_0x701c('0x3f')]]['status']=_0xd6770a[_0x701c('0x3b')]['toLowerCase']();this[_0x701c('0x7')][_0xd6770a[_0x701c('0x3f')]][_0x701c('0x3d')]=_0xd6770a[_0x701c('0x3d')];logger[_0x701c('0x1f')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x701c('0x13')](this[_0x701c('0x7')][_0xd6770a[_0x701c('0x3f')]],{'showHidden':![],'depth':null}));this[_0x701c('0x1a')](util[_0x701c('0x2f')]('trunk:%s',this[_0x701c('0x7')][_0xd6770a['peer']][_0x701c('0x24')]),_0x701c('0x25'),this['trunks'][_0xd6770a[_0x701c('0x3f')]]);}}}catch(_0x5d1308){logger[_0x701c('0x11')](_0x701c('0x3e'),util['inspect'](_0x5d1308,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x32d8=['toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','Local','substring','indexOf','find','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','[userReport][peerstatus]','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','[userReport][sipshowregistry]','actionDeviceStateList','catch','error','[userReport][devicestatelist]','inspect','[userReport][sippeerstatus]','prototype','isNotNull','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','state','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local'];(function(_0x4ac005,_0x551222){var _0x36b43a=function(_0x23c0a9){while(--_0x23c0a9){_0x4ac005['push'](_0x4ac005['shift']());}};_0x36b43a(++_0x551222);}(_0x32d8,0x1e6));var _0x832d=function(_0x7fd4eb,_0x3a3d90){_0x7fd4eb=_0x7fd4eb-0x0;var _0x42e5e3=_0x32d8[_0x7fd4eb];return _0x42e5e3;};'use strict';var _=require(_0x832d('0x0'));var moment=require(_0x832d('0x1'));var util=require(_0x832d('0x2'));var Redis=require(_0x832d('0x3'));var BPromise=require(_0x832d('0x4'));var config=require('../../../config/environment');var logger=require(_0x832d('0x5'))(_0x832d('0x6'));var ami=require(_0x832d('0x7'));config['redis']=_[_0x832d('0x8')](config[_0x832d('0x9')],{'host':_0x832d('0xa'),'port':0x18eb});var io=require(_0x832d('0xb'))(new Redis(config[_0x832d('0x9')]));function UserReport(_0xa9cb58){this[_0x832d('0xc')]=_0xa9cb58[_0x832d('0xc')];this[_0x832d('0xd')]=_0xa9cb58['agents'];this[_0x832d('0xe')]=_0xa9cb58[_0x832d('0xe')];ami['on']('registryentry',this[_0x832d('0xf')][_0x832d('0x10')](this));ami['on'](_0x832d('0x11'),this[_0x832d('0xf')][_0x832d('0x10')](this));ami['on'](_0x832d('0x12'),this[_0x832d('0x13')]['bind'](this));ami['on'](_0x832d('0x14'),this[_0x832d('0x15')][_0x832d('0x10')](this));return this[_0x832d('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0x832d('0x17')](ami[_0x832d('0x18')]())['catch'](function(_0x272555){logger['error'](_0x832d('0x19'),util['inspect'](_0x272555,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x832d('0x1a')]())[_0x832d('0x1b')](function(_0xee1d09){logger[_0x832d('0x1c')](_0x832d('0x1d'),util[_0x832d('0x1e')](_0xee1d09,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x832d('0x17')](ami['actionSipPeerStatus']())[_0x832d('0x1b')](function(_0x4d396c){logger[_0x832d('0x1c')](_0x832d('0x1f'),util[_0x832d('0x1e')](_0x4d396c,{'showHidden':![],'depth':null}));});}UserReport[_0x832d('0x20')][_0x832d('0x16')]=function(){setInterval(function(){BPromise['resolve']()[_0x832d('0x17')](showSipRegistrations())[_0x832d('0x17')](listDeviceStates())[_0x832d('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x832d('0x20')][_0x832d('0x21')]=function(_0x36b6b0){return _0x36b6b0!==null&&!_['isUndefined'](_0x36b6b0);};UserReport[_0x832d('0x20')]['emit']=function(_0x2e9b7a,_0x3f90eb,_0x3dfe41){io['to'](_0x2e9b7a)[_0x832d('0x22')](_0x3f90eb,_0x3dfe41);};UserReport[_0x832d('0x20')][_0x832d('0xf')]=function(_0x3d91b8){try{if(this[_0x832d('0x21')](_0x3d91b8)){logger[_0x832d('0x23')](_0x832d('0x24'),_0x3d91b8[_0x832d('0x25')],_0x3d91b8['state']);logger[_0x832d('0x26')](_0x832d('0x27'),util[_0x832d('0x1e')](_0x3d91b8,{'showHidden':![],'depth':null}));var _0x12ce52=_['find'](this['trunks'],{'defaultuser':_0x3d91b8[_0x832d('0x25')]});if(_0x12ce52){_0x3d91b8['stateRegistry']=_0x3d91b8[_0x832d('0x28')];_[_0x832d('0x29')](_0x12ce52,_['omit'](_0x3d91b8,[_0x832d('0x2a'),_0x832d('0x2b'),'username',_0x832d('0x28')]));logger[_0x832d('0x26')](_0x832d('0x2c'),util['inspect'](_0x12ce52,{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x2e'),_0x12ce52[_0x832d('0x2f')]),_0x832d('0x30'),_0x12ce52);}}}catch(_0x2b3f93){logger[_0x832d('0x1c')](_0x832d('0x27'),util[_0x832d('0x1e')](_0x2b3f93,{'showHidden':![],'depth':null}));}};UserReport[_0x832d('0x20')][_0x832d('0x13')]=function(_0x595e3f){try{if(this[_0x832d('0x21')](_0x595e3f)){logger[_0x832d('0x23')](_0x832d('0x31'),_0x595e3f['device'],_0x595e3f[_0x832d('0x28')]);logger[_0x832d('0x26')](_0x832d('0x32'),util[_0x832d('0x1e')](_0x595e3f,{'showHidden':![],'depth':null}));if(this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]]){if(!this[_0x832d('0xd')][_0x595e3f['device']][_0x832d('0x34')]||_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]()==_0x832d('0x36')){this['agents'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x34')]=![];if(this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]]['state']!==_0x595e3f[_0x832d('0x28')]['toLowerCase']()){this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x37')]=_[_0x832d('0x38')](moment()[_0x832d('0x2d')]('x'));}this['agents'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x28')]=_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]();this[_0x832d('0xd')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x39')](_0x595e3f);}}else if(this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]]){if(this[_0x832d('0xe')][_0x595e3f['device']][_0x832d('0x28')]!==_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]()){this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x37')]=_[_0x832d('0x38')](moment()['format']('x'));}this['telephones'][_0x595e3f[_0x832d('0x33')]]['state']=_0x595e3f[_0x832d('0x28')]['toLowerCase']();logger[_0x832d('0x26')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x832d('0x1e')](this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]],{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x3a'),this['telephones'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x2f')]),'telephone:save',this[_0x832d('0xe')][_0x595e3f[_0x832d('0x33')]]);}else if(this[_0x832d('0xc')][_0x595e3f[_0x832d('0x33')]]){if(this[_0x832d('0xc')][_0x595e3f[_0x832d('0x33')]][_0x832d('0x28')]!==_0x595e3f['state'][_0x832d('0x35')]()){this['trunks'][_0x595e3f[_0x832d('0x33')]][_0x832d('0x37')]=_[_0x832d('0x38')](moment()[_0x832d('0x2d')]('x'));}this['trunks'][_0x595e3f['device']][_0x832d('0x28')]=_0x595e3f['state'][_0x832d('0x35')]();logger[_0x832d('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this['trunks'][_0x595e3f['device']],{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x2e'),this['trunks'][_0x595e3f[_0x832d('0x33')]]['name']),'trunk:save',this[_0x832d('0xc')][_0x595e3f[_0x832d('0x33')]]);}else if(_[_0x832d('0x3b')](_0x595e3f[_0x832d('0x33')],_0x832d('0x3c'))){var _0x496161=_0x595e3f[_0x832d('0x33')];var _0x175edf=_0x496161[_0x832d('0x3d')](_0x496161[_0x832d('0x3e')]('/')+0x1,_0x496161[_0x832d('0x3e')]('@'));var _0x72d337=_[_0x832d('0x3f')](this[_0x832d('0xd')],function(_0xc89b5f){return _0xc89b5f[_0x832d('0x40')]==_0x175edf||_0xc89b5f[_0x832d('0x41')]==_0x175edf||_0xc89b5f[_0x832d('0x42')]==_0x175edf;});if(_0x72d337){if(_0x72d337[_0x832d('0x28')]!==_0x595e3f[_0x832d('0x28')]['toLowerCase']()){_0x72d337[_0x832d('0x37')]=_[_0x832d('0x38')](moment()['format']('x'));}_0x72d337[_0x832d('0x28')]=_0x595e3f[_0x832d('0x28')][_0x832d('0x35')]();_0x72d337[_0x832d('0x34')]=!![];_0x72d337[_0x832d('0x39')](_0x595e3f);}}}}catch(_0x342fdd){logger[_0x832d('0x1c')](_0x832d('0x32'),util['inspect'](_0x342fdd,{'showHidden':![],'depth':null}));}};UserReport[_0x832d('0x20')][_0x832d('0x15')]=function(_0x2513c2){try{if(this['isNotNull'](_0x2513c2)&&this[_0x832d('0x21')](_0x2513c2[_0x832d('0x14')])){logger[_0x832d('0x23')](_0x832d('0x43'),_0x2513c2['peer'],_0x2513c2['address'],_0x2513c2[_0x832d('0x14')]);logger[_0x832d('0x26')](_0x832d('0x44'),util[_0x832d('0x1e')](_0x2513c2,{'showHidden':![],'depth':null}));if(this[_0x832d('0xd')][_0x2513c2[_0x832d('0x45')]]){if(!this[_0x832d('0xd')][_0x2513c2['peer']][_0x832d('0x34')]||_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]()==_0x832d('0x46')){this['agents'][_0x2513c2[_0x832d('0x45')]][_0x832d('0x34')]=![];this[_0x832d('0xd')][_0x2513c2['peer']][_0x832d('0x47')]=_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]();this[_0x832d('0xd')][_0x2513c2['peer']]['address']=_0x2513c2[_0x832d('0x48')];this[_0x832d('0xd')][_0x2513c2[_0x832d('0x45')]][_0x832d('0x39')](_0x2513c2);}}else if(this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]]){this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]][_0x832d('0x47')]=_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]();this['telephones'][_0x2513c2[_0x832d('0x45')]][_0x832d('0x48')]=_0x2513c2[_0x832d('0x48')];logger[_0x832d('0x26')](_0x832d('0x49'),util[_0x832d('0x1e')](this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]],{'showHidden':![],'depth':null}));this[_0x832d('0x22')](util[_0x832d('0x2d')](_0x832d('0x3a'),this['telephones'][_0x2513c2[_0x832d('0x45')]][_0x832d('0x2f')]),_0x832d('0x4a'),this[_0x832d('0xe')][_0x2513c2[_0x832d('0x45')]]);}else if(this[_0x832d('0xc')][_0x2513c2['peer']]){this[_0x832d('0xc')][_0x2513c2['peer']][_0x832d('0x47')]=_0x2513c2[_0x832d('0x14')][_0x832d('0x35')]();this[_0x832d('0xc')][_0x2513c2['peer']][_0x832d('0x48')]=_0x2513c2[_0x832d('0x48')];logger[_0x832d('0x26')](_0x832d('0x4b'),util[_0x832d('0x1e')](this['trunks'][_0x2513c2[_0x832d('0x45')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x832d('0x2d')](_0x832d('0x2e'),this[_0x832d('0xc')][_0x2513c2[_0x832d('0x45')]][_0x832d('0x2f')]),_0x832d('0x30'),this[_0x832d('0xc')][_0x2513c2[_0x832d('0x45')]]);}}}catch(_0x1a19a8){logger[_0x832d('0x1c')](_0x832d('0x44'),util['inspect'](_0x1a19a8,{'showHidden':![],'depth':null}));}};module[_0x832d('0x4c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 544391c..6d05aa0 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd96f=['[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','accountcode','exten','custom:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:%s','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','deleteChannelAfterTimeout','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isNotNull','info','uniqueid','membername','destuniqueid','debug','inspect','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','assign','omit','event','privilege','emit','custom:agentcalled','calleridnum','user:called','error'];(function(_0x44120d,_0x22671b){var _0xa01cb0=function(_0x170d7e){while(--_0x170d7e){_0x44120d['push'](_0x44120d['shift']());}};_0xa01cb0(++_0x22671b);}(_0xd96f,0xfd));var _0xfd96=function(_0x34a6f0,_0x1474f6){_0x34a6f0=_0x34a6f0-0x0;var _0x13e92f=_0xd96f[_0x34a6f0];return _0x13e92f;};'use strict';var _=require('lodash');var moment=require(_0xfd96('0x0'));var util=require(_0xfd96('0x1'));var Redis=require(_0xfd96('0x2'));var config=require(_0xfd96('0x3'));var logger=require(_0xfd96('0x4'))(_0xfd96('0x5'));var ami=require(_0xfd96('0x6'));config[_0xfd96('0x7')]=_[_0xfd96('0x8')](config[_0xfd96('0x7')],{'host':_0xfd96('0x9'),'port':0x18eb});var io=require(_0xfd96('0xa'))(new Redis(config[_0xfd96('0x7')]));function VoiceAgentReport(_0x3b5d80){this[_0xfd96('0xb')]={};this[_0xfd96('0xc')]=_0x3b5d80[_0xfd96('0xb')];this[_0xfd96('0xd')]=_0x3b5d80[_0xfd96('0xd')];this[_0xfd96('0xe')]=_0x3b5d80[_0xfd96('0xe')];this[_0xfd96('0xf')]={};ami['on'](_0xfd96('0x10'),this[_0xfd96('0x11')][_0xfd96('0x12')](this));ami['on'](_0xfd96('0x13'),this[_0xfd96('0x14')][_0xfd96('0x12')](this));ami['on'](_0xfd96('0x15'),this[_0xfd96('0x16')]['bind'](this));ami['on'](_0xfd96('0x17'),this[_0xfd96('0x18')]['bind'](this));ami['on']('agentcomplete',this[_0xfd96('0x19')][_0xfd96('0x12')](this));ami['on'](_0xfd96('0x1a'),this[_0xfd96('0x1b')][_0xfd96('0x12')](this));ami['on'](_0xfd96('0x1c'),this[_0xfd96('0x1d')][_0xfd96('0x12')](this));ami['on'](_0xfd96('0x1e'),this[_0xfd96('0x1f')][_0xfd96('0x12')](this));ami['on'](_0xfd96('0x20'),this[_0xfd96('0x21')]['bind'](this));ami['on'](_0xfd96('0x22'),this[_0xfd96('0x23')]['bind'](this));ami['on'](_0xfd96('0x24'),this[_0xfd96('0x25')][_0xfd96('0x12')](this));}VoiceAgentReport[_0xfd96('0x26')]['emit']=function(_0x204337,_0x330d85,_0x415e05){io['to'](_0x204337)['emit'](_0x330d85,_0x415e05);};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x27')]=function(_0x10c5a9){return _0x10c5a9!==null&&!_['isUndefined'](_0x10c5a9);};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x11')]=function(_0x23a565){try{if(this['isNotNull'](_0x23a565)){logger[_0xfd96('0x28')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x23a565[_0xfd96('0x29')],_0x23a565[_0xfd96('0x2a')],_0x23a565[_0xfd96('0x2b')]);logger[_0xfd96('0x2c')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x23a565[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x23a565,{'showHidden':![],'depth':null}));if(_[_0xfd96('0x2e')](this[_0xfd96('0xb')][_0x23a565['uniqueid']])){this['channels'][_0x23a565[_0xfd96('0x29')]]={};}var _0x5f09c1=this[_0xfd96('0xe')][_0x23a565[_0xfd96('0x2f')]];var _0x546083=this[_0xfd96('0xb')][_0x23a565[_0xfd96('0x29')]][_0x23a565['destuniqueid']];var _0x47ba40=this['voiceQueues'][_0x23a565[_0xfd96('0x30')]];var _0x49ab3b=this['variables'][_0x23a565[_0xfd96('0x29')]];if(_[_0xfd96('0x2e')](_0x546083)){_0x546083={'agentcalledAt':moment()[_0xfd96('0x31')](_0xfd96('0x32')),'lastevent':'called','mandatoryDisposition':_0x47ba40&&_0x47ba40[_0xfd96('0x33')]?_0x47ba40[_0xfd96('0x33')]:![],'type':_0x47ba40&&_0x47ba40[_0xfd96('0x34')]?_0x47ba40[_0xfd96('0x34')]:_0xfd96('0x35'),'variables':_0x49ab3b,'motionChannel':'voice'};}Object[_0xfd96('0x36')](_0x546083,_[_0xfd96('0x37')](_0x23a565,[_0xfd96('0x38'),_0xfd96('0x39')]));this[_0xfd96('0xb')][_0x23a565[_0xfd96('0x29')]][_0x23a565[_0xfd96('0x2b')]]=_0x546083;logger[_0xfd96('0x2c')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x23a565['uniqueid'],util[_0xfd96('0x2d')](_0x546083,{'showHidden':![],'depth':null}));ami[_0xfd96('0x3a')](_0xfd96('0x3b'),_0x546083);var _0x48cc96={'id':_0x5f09c1['id'],'calleridnum':_0x546083[_0xfd96('0x3c')],'queue':_0x546083[_0xfd96('0x30')],'variables':_0x546083['variables'],'uniqueid':_0x23a565[_0xfd96('0x29')]};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x23a565[_0xfd96('0x29')],util['inspect'](_0x48cc96,{'showHidden':![],'depth':null}));this['emit'](util[_0xfd96('0x31')]('user:%s',_0x23a565['membername']),_0xfd96('0x3d'),_0x48cc96);}}catch(_0x20f64d){logger[_0xfd96('0x3e')](_0xfd96('0x3f'),_0x23a565[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x20f64d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x395dc7){try{if(this[_0xfd96('0x27')](_0x395dc7)){if(this[_0xfd96('0xb')][_0x395dc7['uniqueid']]){for(var _0x27da28 in this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]]){if(this['channels'][_0x395dc7['uniqueid']]['hasOwnProperty'](_0x27da28)){if(_0x395dc7[_0xfd96('0x2b')]===_0x27da28){logger[_0xfd96('0x28')](_0xfd96('0x40'),_0x395dc7['uniqueid'],_0x395dc7[_0xfd96('0x2a')],_0x395dc7[_0xfd96('0x2b')]);this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x41')]=moment()[_0xfd96('0x31')](_0xfd96('0x32'));this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x42')]=_0x395dc7[_0xfd96('0x42')];this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28]['connectedlinenum']=_0x395dc7['connectedlinenum'];this['channels'][_0x395dc7[_0xfd96('0x29')]][_0x27da28]['destchannelstate']=_0x395dc7['destchannelstate'];this[_0xfd96('0xb')][_0x395dc7['uniqueid']][_0x27da28]['destchannelstatedesc']=_0x395dc7[_0xfd96('0x43')];this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x44')]=_0x395dc7[_0xfd96('0x44')];this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x45')]=_0xfd96('0x46');_[_0xfd96('0x47')](this[_0xfd96('0xe')][_0x395dc7['interface']],_[_0xfd96('0x48')](_0x395dc7,[_0xfd96('0x30'),_0xfd96('0x49')]));var _0x54c86d=this['agents'][_0x395dc7[_0xfd96('0x2f')]];var _0x4af913={'id':_0x54c86d['id'],'name':_0x54c86d['name'],'agentconnected':!![],'destaccountcode':_0x54c86d[_0xfd96('0x4a')],'destconnectedlinenum':this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x395dc7[_0xfd96('0x2b')]][_0xfd96('0x4b')],'queue':this[_0xfd96('0xb')][_0x395dc7['uniqueid']][_0x395dc7[_0xfd96('0x2b')]][_0xfd96('0x30')],'uniqueid':this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x395dc7[_0xfd96('0x2b')]]['uniqueid']};ami[_0xfd96('0x3a')](_0xfd96('0x4c'),this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x395dc7['destuniqueid']]);this['emit'](util[_0xfd96('0x31')]('user:%s',_0x395dc7[_0xfd96('0x2a')]),'user:agentconnect',_0x4af913);}else if(!this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x15')]&&!this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x4d')]){logger[_0xfd96('0x28')](_0xfd96('0x4e'),_0x395dc7[_0xfd96('0x29')],this[_0xfd96('0xb')][_0x395dc7['uniqueid']][_0x27da28][_0xfd96('0x2a')],_0x27da28);this[_0xfd96('0xb')][_0x395dc7['uniqueid']][_0x27da28][_0xfd96('0x15')]=!![];this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x4f')]=moment()[_0xfd96('0x31')](_0xfd96('0x32'));this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x50')]=_0x395dc7[_0xfd96('0x2b')];this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x51')]=_0x395dc7[_0xfd96('0x2a')];this[_0xfd96('0xb')][_0x395dc7['uniqueid']][_0x27da28][_0xfd96('0x45')]=_0xfd96('0x52');this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28][_0xfd96('0x53')]=_0xfd96('0x52');logger['debug'](_0xfd96('0x54'),_0x395dc7[_0xfd96('0x29')],util[_0xfd96('0x2d')](this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28],{'showHidden':![],'depth':null}));ami[_0xfd96('0x3a')]('custom:agentansweredelsewhere',this[_0xfd96('0xb')][_0x395dc7[_0xfd96('0x29')]][_0x27da28]);}else{logger[_0xfd96('0x2c')](_0xfd96('0x55'),_0x395dc7[_0xfd96('0x29')]);}}}}}}catch(_0x54ae33){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x395dc7['uniqueid'],util['inspect'](_0x54ae33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd96('0x26')]['syncAgentRingNoAnswer']=function(_0x3ccbc9){try{if(this[_0xfd96('0x27')](_0x3ccbc9)){logger[_0xfd96('0x2c')](_0xfd96('0x56'),_0x3ccbc9[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x3ccbc9,{'showHidden':![],'depth':null}));if(this[_0xfd96('0xb')][_0x3ccbc9[_0xfd96('0x29')]]&&this['channels'][_0x3ccbc9[_0xfd96('0x29')]][_0x3ccbc9[_0xfd96('0x2b')]]){logger[_0xfd96('0x28')](_0xfd96('0x57'),_0x3ccbc9[_0xfd96('0x29')],_0x3ccbc9['membername'],_0x3ccbc9[_0xfd96('0x2b')]);var _0x40dcf5=this[_0xfd96('0xe')][_0x3ccbc9['interface']];var _0x14edce=this[_0xfd96('0xb')][_0x3ccbc9[_0xfd96('0x29')]][_0x3ccbc9[_0xfd96('0x2b')]];_0x14edce['agentringnoanswer']=!![];_0x14edce[_0xfd96('0x4f')]=moment()[_0xfd96('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x14edce[_0xfd96('0x45')]=_0xfd96('0x58');_0x14edce['reason']=_0xfd96('0x58');var _0x2dc522={'id':_0x40dcf5['id'],'name':_0x40dcf5[_0xfd96('0x59')],'queue':_0x14edce['queue'],'uniqueid':_0x14edce['uniqueid']};logger['debug'](_0xfd96('0x5a'),_0x3ccbc9[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x2dc522,{'showHidden':![],'depth':null}));this[_0xfd96('0x3a')](util[_0xfd96('0x31')](_0xfd96('0x5b'),_0x40dcf5['name']),'user:agentringnoanswer',_0x2dc522);ami[_0xfd96('0x3a')](_0xfd96('0x5c'),_0x14edce);this['channels'][_0x3ccbc9[_0xfd96('0x29')]][_0x3ccbc9['destuniqueid']]=Object[_0xfd96('0x36')]({},_0x14edce);}}}catch(_0x23fbbe){logger[_0xfd96('0x3e')]('[%s][voiceAgentReport][agentringnoanswer]',_0x3ccbc9[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x23fbbe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x18')]=function(_0x2fffac){try{if(this[_0xfd96('0x27')](_0x2fffac)){logger[_0xfd96('0x2c')](_0xfd96('0x5d'),_0x2fffac[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x2fffac,{'showHidden':![],'depth':null}));if(this[_0xfd96('0xb')][_0x2fffac[_0xfd96('0x29')]]){for(var _0x555b4e in this[_0xfd96('0xb')][_0x2fffac[_0xfd96('0x29')]]){if(this[_0xfd96('0xb')][_0x2fffac['uniqueid']][_0xfd96('0x5e')](_0x555b4e)&&!this[_0xfd96('0xb')][_0x2fffac[_0xfd96('0x29')]][_0x555b4e][_0xfd96('0x15')]&&!this[_0xfd96('0xb')][_0x2fffac['uniqueid']][_0x555b4e][_0xfd96('0x4d')]){logger[_0xfd96('0x28')](_0xfd96('0x5f'),_0x2fffac['uniqueid'],this[_0xfd96('0xb')][_0x2fffac[_0xfd96('0x29')]][_0x555b4e][_0xfd96('0x2a')],_0x555b4e);this[_0xfd96('0xb')][_0x2fffac[_0xfd96('0x29')]][_0x555b4e][_0xfd96('0x15')]=!![];this['channels'][_0x2fffac['uniqueid']][_0x555b4e]['agentringnoanswerAt']=moment()['format'](_0xfd96('0x32'));this['channels'][_0x2fffac[_0xfd96('0x29')]][_0x555b4e][_0xfd96('0x45')]=_0xfd96('0x60');this['channels'][_0x2fffac[_0xfd96('0x29')]][_0x555b4e]['reason']=_0xfd96('0x60');logger[_0xfd96('0x2c')](_0xfd96('0x61'),_0x2fffac[_0xfd96('0x29')],util[_0xfd96('0x2d')](this['channels'][_0x2fffac[_0xfd96('0x29')]][_0x555b4e],{'showHidden':![],'depth':null}));ami[_0xfd96('0x3a')](_0xfd96('0x62'),this[_0xfd96('0xb')][_0x2fffac[_0xfd96('0x29')]][_0x555b4e]);}}}}}catch(_0x48d301){logger['error'](_0xfd96('0x63'),_0x2fffac['uniqueid'],util[_0xfd96('0x2d')](_0x48d301,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x19')]=function(_0x4cec22){try{if(this[_0xfd96('0x27')](_0x4cec22)){logger[_0xfd96('0x2c')](_0xfd96('0x64'),_0x4cec22['uniqueid'],util['inspect'](_0x4cec22,{'showHidden':![],'depth':null}));if(this[_0xfd96('0xb')][_0x4cec22[_0xfd96('0x29')]]){for(var _0x10cf93 in this[_0xfd96('0xb')][_0x4cec22['uniqueid']]){if(this['channels'][_0x4cec22[_0xfd96('0x29')]][_0xfd96('0x5e')](_0x10cf93)){if(this[_0xfd96('0xb')][_0x4cec22['uniqueid']][_0x10cf93][_0xfd96('0x41')]&&!this['channels'][_0x4cec22[_0xfd96('0x29')]][_0x10cf93]['agentcomplete']){logger[_0xfd96('0x28')](_0xfd96('0x65'),_0x4cec22[_0xfd96('0x29')],this['channels'][_0x4cec22[_0xfd96('0x29')]][_0x10cf93]['membername'],_0x10cf93);this[_0xfd96('0xb')][_0x4cec22[_0xfd96('0x29')]][_0x10cf93][_0xfd96('0x4d')]=!![];this['channels'][_0x4cec22[_0xfd96('0x29')]][_0x10cf93]['agentcompleteAt']=moment()[_0xfd96('0x31')](_0xfd96('0x32'));this[_0xfd96('0xb')][_0x4cec22[_0xfd96('0x29')]][_0x10cf93][_0xfd96('0x45')]=_0xfd96('0x66');this[_0xfd96('0xb')][_0x4cec22['uniqueid']][_0x10cf93]['reason']=_0x4cec22[_0xfd96('0x53')]==_0xfd96('0x67')?_0xfd96('0x68'):_0x4cec22[_0xfd96('0x53')];this[_0xfd96('0xb')][_0x4cec22[_0xfd96('0x29')]][_0x10cf93][_0xfd96('0x69')]=_0x4cec22[_0xfd96('0x69')];if(this[_0xfd96('0xd')][_0x4cec22['queue']]&&this[_0xfd96('0xd')][_0x4cec22['queue']][_0xfd96('0x6a')]){this['channels'][_0x4cec22[_0xfd96('0x29')]][_0x10cf93][_0xfd96('0x6b')]=this['voiceQueues'][_0x4cec22[_0xfd96('0x30')]][_0xfd96('0x6c')];this[_0xfd96('0xb')][_0x4cec22[_0xfd96('0x29')]][_0x10cf93][_0xfd96('0x6d')]=!![];}this[_0xfd96('0xe')][_0x4cec22['interface']]=_[_0xfd96('0x37')](this['agents'][_0x4cec22['interface']],[_0xfd96('0x30'),_0xfd96('0x49')]);logger[_0xfd96('0x2c')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x4cec22[_0xfd96('0x29')],util[_0xfd96('0x2d')](this[_0xfd96('0xb')][_0x4cec22[_0xfd96('0x29')]][_0x10cf93],{'showHidden':![],'depth':null}));ami[_0xfd96('0x3a')]('custom:agentcomplete',this['channels'][_0x4cec22[_0xfd96('0x29')]][_0x10cf93]);logger[_0xfd96('0x2c')](_0xfd96('0x6e'),_0x4cec22[_0xfd96('0x29')],util['inspect']({'id':this[_0xfd96('0xe')][_0x4cec22[_0xfd96('0x2f')]]['id'],'destaccountcode':_0x4cec22[_0xfd96('0x6f')]},{'showHidden':![],'depth':null}));this[_0xfd96('0x3a')](util[_0xfd96('0x31')](_0xfd96('0x5b'),_0x4cec22[_0xfd96('0x2a')]),_0xfd96('0x70'),{'id':this[_0xfd96('0xe')][_0x4cec22[_0xfd96('0x2f')]]['id'],'destaccountcode':Number(_0x4cec22[_0xfd96('0x6f')])});}}}}}}catch(_0x188dee){logger[_0xfd96('0x3e')]('[%s][voiceAgentReport][agentcomplete]',_0x4cec22[_0xfd96('0x29')],util['inspect'](_0x188dee,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfd96('0x1b')]=function(_0x529da8){try{if(this['isNotNull'](_0x529da8)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x529da8[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x529da8,{'showHidden':![],'depth':null}));this['addVariable'](_0x529da8[_0xfd96('0x29')],_[_0xfd96('0x71')](_0x529da8[_0xfd96('0x72')])[0x0],_0x529da8[_0xfd96('0x73')]);if(this['channels'][_0x529da8[_0xfd96('0x29')]]){for(var _0x40a7d8 in this['channels'][_0x529da8[_0xfd96('0x29')]]){if(this[_0xfd96('0xb')][_0x529da8[_0xfd96('0x29')]][_0xfd96('0x5e')](_0x40a7d8)){logger[_0xfd96('0x28')](_0xfd96('0x74'),_0x529da8[_0xfd96('0x29')],_0x40a7d8,_['keys'](_0x529da8[_0xfd96('0x72')])[0x0],_0x529da8['value']);if(_[_0xfd96('0x2e')](this[_0xfd96('0xb')][_0x529da8[_0xfd96('0x29')]][_0x40a7d8][_0xfd96('0xf')])){this[_0xfd96('0xb')][_0x529da8['uniqueid']][_0x40a7d8][_0xfd96('0xf')]={};}this[_0xfd96('0xb')][_0x529da8[_0xfd96('0x29')]][_0x40a7d8][_0xfd96('0xf')]=this[_0xfd96('0xf')][_0x529da8['uniqueid']];}}}}}catch(_0x3f93b3){logger['error'](_0xfd96('0x75'),_0x529da8[_0xfd96('0x29')],util['inspect'](_0x3f93b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x76')]=function(_0x29ee95,_0x18b729,_0x3653b4){var _0x7814c0=[_0xfd96('0x77'),_0xfd96('0x78'),_0xfd96('0x79'),_0xfd96('0x7a'),_0xfd96('0x7b'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xfd96('0x7c'),'sipcallid',_0xfd96('0x7d'),_0xfd96('0x7e'),_0xfd96('0x7f'),_0xfd96('0x80'),_0xfd96('0x81'),_0xfd96('0x82'),'memberlastcall',_0xfd96('0x2a'),_0xfd96('0x83'),'memberrealtime'];if(!_['isNil'](_0x18b729)&&!_[_0xfd96('0x84')](_0x7814c0,_0x18b729)){if(_['isUndefined'](this['variables'][_0x29ee95])){this[_0xfd96('0xf')][_0x29ee95]={};}this[_0xfd96('0xf')][_0x29ee95][_0x18b729]=_0x3653b4;}};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x1d')]=function(_0x554ca4){try{if(this[_0xfd96('0x27')](_0x554ca4)){logger[_0xfd96('0x2c')](_0xfd96('0x85'),_0x554ca4[_0xfd96('0x29')],util['inspect'](_0x554ca4,{'showHidden':![],'depth':null}));if(this[_0xfd96('0xb')][_0x554ca4[_0xfd96('0x29')]]){for(var _0x4b6a36 in this[_0xfd96('0xb')][_0x554ca4['uniqueid']]){if(this[_0xfd96('0xb')][_0x554ca4['uniqueid']]['hasOwnProperty'](_0x4b6a36)){if(this['channels'][_0x554ca4[_0xfd96('0x29')]][_0x4b6a36][_0xfd96('0x53')]==_0xfd96('0x67')&&this[_0xfd96('0xb')][_0x554ca4[_0xfd96('0x29')]][_0x4b6a36][_0xfd96('0x4d')]){logger[_0xfd96('0x28')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x554ca4[_0xfd96('0x29')],_0x4b6a36);this[_0xfd96('0xb')][_0x554ca4[_0xfd96('0x29')]][_0x4b6a36][_0xfd96('0x86')]=moment()['format'](_0xfd96('0x32'));}}}logger[_0xfd96('0x2c')](_0xfd96('0x87'),_0x554ca4[_0xfd96('0x29')],util[_0xfd96('0x2d')](_['values'](this[_0xfd96('0xb')][_0x554ca4[_0xfd96('0x29')]]),{'showHidden':![],'depth':null}));ami[_0xfd96('0x3a')](_0xfd96('0x88'),_['values'](this[_0xfd96('0xb')][_0x554ca4['uniqueid']]));this['deleteChannelAfterTimeout'](_0x554ca4[_0xfd96('0x29')]);}if(this[_0xfd96('0xf')][_0x554ca4['uniqueid']]){delete this[_0xfd96('0xf')][_0x554ca4[_0xfd96('0x29')]];}}}catch(_0xcce90a){logger[_0xfd96('0x3e')](_0xfd96('0x89'),_0x554ca4[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0xcce90a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x23')]=function(_0x3451cb){try{if(this[_0xfd96('0x27')](_0x3451cb)){logger['debug'](_0xfd96('0x8a'),_0x3451cb[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x3451cb,{'showHidden':![],'depth':null}));if(this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]]){for(var _0x268d42 in this['channels'][_0x3451cb['transfereeuniqueid']]){if(this[_0xfd96('0xb')][_0x3451cb['transfereeuniqueid']]['hasOwnProperty'](_0x268d42)){if(_0x3451cb[_0xfd96('0x8c')]===_0x268d42){logger[_0xfd96('0x28')](_0xfd96('0x8d'),_0x3451cb[_0xfd96('0x29')],this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]][_0x268d42][_0xfd96('0x2a')],_0x268d42);var _0x4c3ce5=moment();this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]][_0x268d42][_0xfd96('0x4d')]=!![];this[_0xfd96('0xb')][_0x3451cb['transfereeuniqueid']][_0x268d42]['agentcompleteAt']=moment()['format'](_0xfd96('0x32'));this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]][_0x268d42][_0xfd96('0x45')]=_0xfd96('0x66');this['channels'][_0x3451cb[_0xfd96('0x8b')]][_0x268d42][_0xfd96('0x53')]=_0xfd96('0x67');this['channels'][_0x3451cb[_0xfd96('0x8b')]][_0x268d42]['talktime']=_0x4c3ce5['diff'](this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]][_0x268d42][_0xfd96('0x41')],_0xfd96('0x8e'));}}}}if(this['channels'][_0x3451cb[_0xfd96('0x8f')]]){var _0x5aab0d=this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8f')]];this['channels'][_0x3451cb['secondtransfereruniqueid']]=this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]];this[_0xfd96('0xb')][_0x3451cb[_0xfd96('0x8b')]]=_0x5aab0d;}}}catch(_0x1c9924){logger['error'](_0xfd96('0x90'),_0x3451cb[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x1c9924,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncBlindTransfer']=function(_0x4e6063){try{if(this[_0xfd96('0x27')](_0x4e6063)){logger[_0xfd96('0x2c')](_0xfd96('0x91'),_0x4e6063[_0xfd96('0x29')],util['inspect'](_0x4e6063,{'showHidden':![],'depth':null}));if(this[_0xfd96('0xb')][_0x4e6063[_0xfd96('0x8b')]]){for(var _0x276927 in this[_0xfd96('0xb')][_0x4e6063[_0xfd96('0x8b')]]){if(this['channels'][_0x4e6063[_0xfd96('0x8b')]]['hasOwnProperty'](_0x276927)){if(_0x4e6063[_0xfd96('0x92')]===_0x276927){logger[_0xfd96('0x28')](_0xfd96('0x93'),_0x4e6063[_0xfd96('0x29')],this[_0xfd96('0xb')][_0x4e6063[_0xfd96('0x8b')]][_0x276927][_0xfd96('0x2a')],_0x276927);var _0x10a1e2=moment();this[_0xfd96('0xb')][_0x4e6063[_0xfd96('0x8b')]][_0x276927][_0xfd96('0x4d')]=!![];this['channels'][_0x4e6063[_0xfd96('0x8b')]][_0x276927][_0xfd96('0x86')]=_0x10a1e2;this['channels'][_0x4e6063[_0xfd96('0x8b')]][_0x276927][_0xfd96('0x45')]=_0xfd96('0x66');this['channels'][_0x4e6063[_0xfd96('0x8b')]][_0x276927]['reason']=_0xfd96('0x67');this[_0xfd96('0xb')][_0x4e6063[_0xfd96('0x8b')]][_0x276927][_0xfd96('0x69')]=_0x10a1e2[_0xfd96('0x94')](this['channels'][_0x4e6063[_0xfd96('0x8b')]][_0x276927][_0xfd96('0x41')],_0xfd96('0x8e'));}}}}}}catch(_0x46fedc){logger['error'](_0xfd96('0x95'),_0x4e6063[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x46fedc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd96('0x26')][_0xfd96('0x1f')]=function(_0x1bf1b8){var _0x4ea874='';try{if(this['isNotNull'](_0x1bf1b8)){logger[_0xfd96('0x2c')](_0xfd96('0x96'),_0x1bf1b8[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x1bf1b8,{'showHidden':![],'depth':null}));if(_0x1bf1b8[_0xfd96('0x97')]){_0x4ea874=_0x1bf1b8[_0xfd96('0x97')][_0xfd96('0x98')](0x0,_0x1bf1b8[_0xfd96('0x97')][_0xfd96('0x99')]('-'));if(this[_0xfd96('0xe')][_0x4ea874]){logger[_0xfd96('0x28')](_0xfd96('0x9a'),_0x1bf1b8[_0xfd96('0x29')],_0x4ea874);this[_0xfd96('0xe')][_0x4ea874]['onhold']=!![];}}}}catch(_0x5f3b7c){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x1bf1b8[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x5f3b7c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfd96('0x21')]=function(_0x13cdb0){var _0x1865dd='';try{if(this[_0xfd96('0x27')](_0x13cdb0)){logger['debug'](_0xfd96('0x9b'),_0x13cdb0['uniqueid'],util[_0xfd96('0x2d')](_0x13cdb0,{'showHidden':![],'depth':null}));if(_0x13cdb0['channel']){_0x1865dd=_0x13cdb0[_0xfd96('0x97')][_0xfd96('0x98')](0x0,_0x13cdb0[_0xfd96('0x97')][_0xfd96('0x99')]('-'));if(this[_0xfd96('0xe')][_0x1865dd]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x13cdb0[_0xfd96('0x29')],_0x1865dd);this[_0xfd96('0xe')][_0x1865dd][_0xfd96('0x9c')]=![];}}}}catch(_0x843239){logger[_0xfd96('0x3e')]('[%s][voiceAgentReport][musiconholdstop]',_0x13cdb0[_0xfd96('0x29')],util[_0xfd96('0x2d')](_0x843239,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfd96('0x9d')]=function(_0x32a1c7,_0x12bbd6=0x2710){if(this[_0xfd96('0xb')][_0x32a1c7]){setTimeout(()=>{delete this['channels'][_0x32a1c7];},_0x12bbd6);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xd2f0=['custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','uniqueid','inspect','interface','destuniqueid','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','emit','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','accountcode','exten','custom:agentconnect','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0xd2f0,0x183));var _0x0d2f=function(_0x4aa480,_0x9561ce){_0x4aa480=_0x4aa480-0x0;var _0x3ba7cc=_0xd2f0[_0x4aa480];return _0x3ba7cc;};'use strict';var _=require('lodash');var moment=require(_0x0d2f('0x0'));var util=require(_0x0d2f('0x1'));var Redis=require(_0x0d2f('0x2'));var config=require(_0x0d2f('0x3'));var logger=require(_0x0d2f('0x4'))(_0x0d2f('0x5'));var ami=require(_0x0d2f('0x6'));config[_0x0d2f('0x7')]=_[_0x0d2f('0x8')](config[_0x0d2f('0x7')],{'host':_0x0d2f('0x9'),'port':0x18eb});var io=require(_0x0d2f('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x1a09e8){this[_0x0d2f('0xb')]={};this[_0x0d2f('0xc')]=_0x1a09e8[_0x0d2f('0xb')];this[_0x0d2f('0xd')]=_0x1a09e8['voiceQueues'];this['agents']=_0x1a09e8[_0x0d2f('0xe')];this[_0x0d2f('0xf')]={};ami['on'](_0x0d2f('0x10'),this[_0x0d2f('0x11')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x13'),this['syncAgentConnect'][_0x0d2f('0x12')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x14'),this[_0x0d2f('0x15')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x16'),this[_0x0d2f('0x17')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x18'),this['syncVarSet'][_0x0d2f('0x12')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on']('musiconholdstart',this[_0x0d2f('0x19')]['bind'](this));ami['on'](_0x0d2f('0x1a'),this[_0x0d2f('0x1b')]['bind'](this));ami['on'](_0x0d2f('0x1c'),this[_0x0d2f('0x1d')][_0x0d2f('0x12')](this));ami['on'](_0x0d2f('0x1e'),this[_0x0d2f('0x1f')]['bind'](this));}VoiceAgentReport[_0x0d2f('0x20')]['emit']=function(_0x57e8ff,_0x37eb6c,_0x22fede){io['to'](_0x57e8ff)['emit'](_0x37eb6c,_0x22fede);};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x21')]=function(_0x5cd5e9){return _0x5cd5e9!==null&&!_[_0x0d2f('0x22')](_0x5cd5e9);};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x11')]=function(_0x2872f7){try{if(this[_0x0d2f('0x21')](_0x2872f7)){logger[_0x0d2f('0x23')](_0x0d2f('0x24'),_0x2872f7['uniqueid'],_0x2872f7[_0x0d2f('0x25')],_0x2872f7['destuniqueid']);logger[_0x0d2f('0x26')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x2872f7,{'showHidden':![],'depth':null}));if(_[_0x0d2f('0x22')](this[_0x0d2f('0xb')][_0x2872f7[_0x0d2f('0x27')]])){this['channels'][_0x2872f7[_0x0d2f('0x27')]]={};}var _0xb228d5=this[_0x0d2f('0xe')][_0x2872f7[_0x0d2f('0x29')]];var _0x2f4fb2=this['channels'][_0x2872f7['uniqueid']][_0x2872f7[_0x0d2f('0x2a')]];var _0x33c8ee=this[_0x0d2f('0xd')][_0x2872f7[_0x0d2f('0x2b')]];var _0x454d61=this[_0x0d2f('0xf')][_0x2872f7[_0x0d2f('0x27')]];if(_['isUndefined'](_0x2f4fb2)){_0x2f4fb2={'agentcalledAt':moment()[_0x0d2f('0x2c')](_0x0d2f('0x2d')),'lastevent':_0x0d2f('0x2e'),'mandatoryDisposition':_0x33c8ee&&_0x33c8ee[_0x0d2f('0x2f')]?_0x33c8ee[_0x0d2f('0x2f')]:![],'type':_0x33c8ee&&_0x33c8ee[_0x0d2f('0x30')]?_0x33c8ee[_0x0d2f('0x30')]:_0x0d2f('0x31'),'variables':_0x454d61,'motionChannel':'voice'};}Object[_0x0d2f('0x32')](_0x2f4fb2,_[_0x0d2f('0x33')](_0x2872f7,[_0x0d2f('0x34'),_0x0d2f('0x35')]));this['channels'][_0x2872f7['uniqueid']][_0x2872f7['destuniqueid']]=_0x2f4fb2;logger['debug'](_0x0d2f('0x36'),_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x2f4fb2,{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')]('custom:agentcalled',_0x2f4fb2);var _0x45c67f={'id':_0xb228d5['id'],'calleridnum':_0x2f4fb2['calleridnum'],'queue':_0x2f4fb2[_0x0d2f('0x2b')],'variables':_0x2f4fb2[_0x0d2f('0xf')],'uniqueid':_0x2872f7['uniqueid']};logger[_0x0d2f('0x26')](_0x0d2f('0x38'),_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x45c67f,{'showHidden':![],'depth':null}));this[_0x0d2f('0x37')](util[_0x0d2f('0x2c')](_0x0d2f('0x39'),_0x2872f7[_0x0d2f('0x25')]),'user:called',_0x45c67f);}}catch(_0x36ab03){logger[_0x0d2f('0x3a')]('[%s][voiceAgentReport][agentcalled]',_0x2872f7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x36ab03,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')]['syncAgentConnect']=function(_0x26e229){try{if(this[_0x0d2f('0x21')](_0x26e229)){if(this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]]){for(var _0x1d96e1 in this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x0d2f('0x3b')](_0x1d96e1)){if(_0x26e229[_0x0d2f('0x2a')]===_0x1d96e1){logger['info'](_0x0d2f('0x3c'),_0x26e229[_0x0d2f('0x27')],_0x26e229[_0x0d2f('0x25')],_0x26e229[_0x0d2f('0x2a')]);this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x3d')]=moment()[_0x0d2f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x3e')]=_0x26e229['connectedlinename'];this['channels'][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x3f')]=_0x26e229['connectedlinenum'];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1]['destchannelstate']=_0x26e229['destchannelstate'];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x40')]=_0x26e229['destchannelstatedesc'];this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x41')]=_0x26e229['holdtime'];this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x42')]=_0x0d2f('0x43');_[_0x0d2f('0x44')](this[_0x0d2f('0xe')][_0x26e229[_0x0d2f('0x29')]],_[_0x0d2f('0x45')](_0x26e229,[_0x0d2f('0x2b'),_0x0d2f('0x46')]));var _0xde113d=this[_0x0d2f('0xe')][_0x26e229['interface']];var _0xe7a338={'id':_0xde113d['id'],'name':_0xde113d['name'],'agentconnected':!![],'destaccountcode':_0xde113d[_0x0d2f('0x47')],'destconnectedlinenum':this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x26e229[_0x0d2f('0x2a')]][_0x0d2f('0x48')],'queue':this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x26e229['destuniqueid']][_0x0d2f('0x2b')],'uniqueid':this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x26e229['destuniqueid']]['uniqueid']};ami['emit'](_0x0d2f('0x49'),this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x26e229[_0x0d2f('0x2a')]]);this[_0x0d2f('0x37')](util['format'](_0x0d2f('0x39'),_0x26e229[_0x0d2f('0x25')]),_0x0d2f('0x4a'),_0xe7a338);}else if(!this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x4b')]&&!this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x16')]){logger[_0x0d2f('0x23')](_0x0d2f('0x4c'),_0x26e229[_0x0d2f('0x27')],this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x25')],_0x1d96e1);this['channels'][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x4b')]=!![];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x4d')]=moment()['format'](_0x0d2f('0x2d'));this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x4e')]=_0x26e229[_0x0d2f('0x2a')];this[_0x0d2f('0xb')][_0x26e229['uniqueid']][_0x1d96e1][_0x0d2f('0x4f')]=_0x26e229[_0x0d2f('0x25')];this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x42')]=_0x0d2f('0x50');this[_0x0d2f('0xb')][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1][_0x0d2f('0x51')]=_0x0d2f('0x50');logger[_0x0d2f('0x26')](_0x0d2f('0x52'),_0x26e229[_0x0d2f('0x27')],util[_0x0d2f('0x28')](this['channels'][_0x26e229[_0x0d2f('0x27')]][_0x1d96e1],{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x53'),this['channels'][_0x26e229['uniqueid']][_0x1d96e1]);}else{logger[_0x0d2f('0x26')](_0x0d2f('0x54'),_0x26e229['uniqueid']);}}}}}}catch(_0x1fbd3e){logger[_0x0d2f('0x3a')](_0x0d2f('0x55'),_0x26e229[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x1fbd3e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x56')]=function(_0x401a52){try{if(this['isNotNull'](_0x401a52)){logger['debug'](_0x0d2f('0x57'),_0x401a52[_0x0d2f('0x27')],util['inspect'](_0x401a52,{'showHidden':![],'depth':null}));if(this['channels'][_0x401a52['uniqueid']]&&this['channels'][_0x401a52[_0x0d2f('0x27')]][_0x401a52[_0x0d2f('0x2a')]]){logger[_0x0d2f('0x23')](_0x0d2f('0x58'),_0x401a52[_0x0d2f('0x27')],_0x401a52[_0x0d2f('0x25')],_0x401a52[_0x0d2f('0x2a')]);var _0x49c2bf=this['agents'][_0x401a52[_0x0d2f('0x29')]];var _0x4937c9=this[_0x0d2f('0xb')][_0x401a52[_0x0d2f('0x27')]][_0x401a52[_0x0d2f('0x2a')]];_0x4937c9['agentringnoanswer']=!![];_0x4937c9[_0x0d2f('0x4d')]=moment()[_0x0d2f('0x2c')](_0x0d2f('0x2d'));_0x4937c9[_0x0d2f('0x42')]=_0x0d2f('0x59');_0x4937c9[_0x0d2f('0x51')]=_0x0d2f('0x59');var _0x4558ee={'id':_0x49c2bf['id'],'name':_0x49c2bf[_0x0d2f('0x5a')],'queue':_0x4937c9['queue'],'uniqueid':_0x4937c9[_0x0d2f('0x27')]};logger[_0x0d2f('0x26')](_0x0d2f('0x5b'),_0x401a52[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x4558ee,{'showHidden':![],'depth':null}));this[_0x0d2f('0x37')](util[_0x0d2f('0x2c')]('user:%s',_0x49c2bf[_0x0d2f('0x5a')]),_0x0d2f('0x5c'),_0x4558ee);ami[_0x0d2f('0x37')](_0x0d2f('0x5d'),_0x4937c9);this[_0x0d2f('0xb')][_0x401a52['uniqueid']][_0x401a52[_0x0d2f('0x2a')]]=Object[_0x0d2f('0x32')]({},_0x4937c9);}}}catch(_0x2e1c8c){logger['error'](_0x0d2f('0x5e'),_0x401a52[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x2e1c8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x15')]=function(_0x37eca0){try{if(this[_0x0d2f('0x21')](_0x37eca0)){logger['debug'](_0x0d2f('0x5f'),_0x37eca0[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x37eca0,{'showHidden':![],'depth':null}));if(this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]]){for(var _0x56ae42 in this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x0d2f('0x3b')](_0x56ae42)&&!this[_0x0d2f('0xb')][_0x37eca0['uniqueid']][_0x56ae42][_0x0d2f('0x4b')]&&!this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42][_0x0d2f('0x16')]){logger[_0x0d2f('0x23')](_0x0d2f('0x60'),_0x37eca0['uniqueid'],this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42]['membername'],_0x56ae42);this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42][_0x0d2f('0x4b')]=!![];this['channels'][_0x37eca0['uniqueid']][_0x56ae42][_0x0d2f('0x4d')]=moment()[_0x0d2f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d2f('0xb')][_0x37eca0['uniqueid']][_0x56ae42][_0x0d2f('0x42')]='abandoned';this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42]['reason']=_0x0d2f('0x61');logger[_0x0d2f('0x26')](_0x0d2f('0x62'),_0x37eca0[_0x0d2f('0x27')],util[_0x0d2f('0x28')](this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42],{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x63'),this[_0x0d2f('0xb')][_0x37eca0[_0x0d2f('0x27')]][_0x56ae42]);}}}}}catch(_0x2649e3){logger[_0x0d2f('0x3a')](_0x0d2f('0x64'),_0x37eca0['uniqueid'],util[_0x0d2f('0x28')](_0x2649e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x17')]=function(_0x47afc1){try{if(this[_0x0d2f('0x21')](_0x47afc1)){logger[_0x0d2f('0x26')](_0x0d2f('0x65'),_0x47afc1[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x47afc1,{'showHidden':![],'depth':null}));if(this['channels'][_0x47afc1['uniqueid']]){for(var _0x2604e9 in this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x0d2f('0x3b')](_0x2604e9)){if(this['channels'][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x3d')]&&!this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x16')]){logger[_0x0d2f('0x23')](_0x0d2f('0x66'),_0x47afc1[_0x0d2f('0x27')],this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x25')],_0x2604e9);this[_0x0d2f('0xb')][_0x47afc1['uniqueid']][_0x2604e9]['agentcomplete']=!![];this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x67')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9]['lastevent']='complete';this[_0x0d2f('0xb')][_0x47afc1['uniqueid']][_0x2604e9][_0x0d2f('0x51')]=_0x47afc1[_0x0d2f('0x51')]==_0x0d2f('0x68')?_0x0d2f('0x69'):_0x47afc1[_0x0d2f('0x51')];this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x6a')]=_0x47afc1[_0x0d2f('0x6a')];if(this[_0x0d2f('0xd')][_0x47afc1[_0x0d2f('0x2b')]]&&this[_0x0d2f('0xd')][_0x47afc1['queue']]['acw']){this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x6b')]=this['voiceQueues'][_0x47afc1['queue']]['acwTimeout'];this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9][_0x0d2f('0x6c')]=!![];}this[_0x0d2f('0xe')][_0x47afc1[_0x0d2f('0x29')]]=_[_0x0d2f('0x33')](this[_0x0d2f('0xe')][_0x47afc1[_0x0d2f('0x29')]],[_0x0d2f('0x2b'),_0x0d2f('0x46')]);logger['debug'](_0x0d2f('0x6d'),_0x47afc1[_0x0d2f('0x27')],util['inspect'](this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9],{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x6e'),this[_0x0d2f('0xb')][_0x47afc1[_0x0d2f('0x27')]][_0x2604e9]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x47afc1[_0x0d2f('0x27')],util[_0x0d2f('0x28')]({'id':this[_0x0d2f('0xe')][_0x47afc1['interface']]['id'],'destaccountcode':_0x47afc1[_0x0d2f('0x6f')]},{'showHidden':![],'depth':null}));this[_0x0d2f('0x37')](util[_0x0d2f('0x2c')]('user:%s',_0x47afc1['membername']),_0x0d2f('0x70'),{'id':this[_0x0d2f('0xe')][_0x47afc1[_0x0d2f('0x29')]]['id'],'destaccountcode':Number(_0x47afc1['destaccountcode'])});}}}}}}catch(_0x2fe60e){logger['error'](_0x0d2f('0x71'),_0x47afc1['uniqueid'],util['inspect'](_0x2fe60e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x72')]=function(_0x24731e){try{if(this['isNotNull'](_0x24731e)){logger[_0x0d2f('0x26')](_0x0d2f('0x73'),_0x24731e['uniqueid'],util['inspect'](_0x24731e,{'showHidden':![],'depth':null}));this[_0x0d2f('0x74')](_0x24731e[_0x0d2f('0x27')],_[_0x0d2f('0x75')](_0x24731e[_0x0d2f('0x76')])[0x0],_0x24731e[_0x0d2f('0x77')]);if(this[_0x0d2f('0xb')][_0x24731e[_0x0d2f('0x27')]]){for(var _0xad193a in this[_0x0d2f('0xb')][_0x24731e[_0x0d2f('0x27')]]){if(this['channels'][_0x24731e[_0x0d2f('0x27')]]['hasOwnProperty'](_0xad193a)){logger[_0x0d2f('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x24731e['uniqueid'],_0xad193a,_[_0x0d2f('0x75')](_0x24731e[_0x0d2f('0x76')])[0x0],_0x24731e[_0x0d2f('0x77')]);if(_[_0x0d2f('0x22')](this['channels'][_0x24731e[_0x0d2f('0x27')]][_0xad193a]['variables'])){this[_0x0d2f('0xb')][_0x24731e['uniqueid']][_0xad193a][_0x0d2f('0xf')]={};}this[_0x0d2f('0xb')][_0x24731e['uniqueid']][_0xad193a][_0x0d2f('0xf')]=this[_0x0d2f('0xf')][_0x24731e[_0x0d2f('0x27')]];}}}}}catch(_0x3869b9){logger[_0x0d2f('0x3a')](_0x0d2f('0x78'),_0x24731e[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x3869b9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x56c751,_0x422b70,_0x379a3b){var _0x471f30=[_0x0d2f('0x79'),_0x0d2f('0x7a'),'rtpaudioqosjitter',_0x0d2f('0x7b'),'rtpaudioqosloss',_0x0d2f('0x7c'),_0x0d2f('0x7d'),'rtpaudioqosrttbridged',_0x0d2f('0x7e'),_0x0d2f('0x7f'),_0x0d2f('0x80'),'bridgepvtcallid','membercalls','memberdynamic',_0x0d2f('0x81'),_0x0d2f('0x82'),_0x0d2f('0x25'),_0x0d2f('0x83'),_0x0d2f('0x84')];if(!_['isNil'](_0x422b70)&&!_[_0x0d2f('0x85')](_0x471f30,_0x422b70)){if(_[_0x0d2f('0x22')](this[_0x0d2f('0xf')][_0x56c751])){this[_0x0d2f('0xf')][_0x56c751]={};}this[_0x0d2f('0xf')][_0x56c751][_0x422b70]=_0x379a3b;}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x86')]=function(_0x54a860){try{if(this[_0x0d2f('0x21')](_0x54a860)){logger[_0x0d2f('0x26')](_0x0d2f('0x87'),_0x54a860[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x54a860,{'showHidden':![],'depth':null}));if(this[_0x0d2f('0xb')][_0x54a860['uniqueid']]){for(var _0x5a0e88 in this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]]){if(this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]]['hasOwnProperty'](_0x5a0e88)){if(this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]][_0x5a0e88][_0x0d2f('0x51')]==_0x0d2f('0x68')&&this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]][_0x5a0e88]['agentcomplete']){logger[_0x0d2f('0x23')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x54a860[_0x0d2f('0x27')],_0x5a0e88);this['channels'][_0x54a860[_0x0d2f('0x27')]][_0x5a0e88][_0x0d2f('0x67')]=moment()[_0x0d2f('0x2c')](_0x0d2f('0x2d'));}}}logger['debug'](_0x0d2f('0x88'),_0x54a860[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_[_0x0d2f('0x89')](this[_0x0d2f('0xb')][_0x54a860[_0x0d2f('0x27')]]),{'showHidden':![],'depth':null}));ami[_0x0d2f('0x37')](_0x0d2f('0x8a'),_[_0x0d2f('0x89')](this[_0x0d2f('0xb')][_0x54a860['uniqueid']]));this[_0x0d2f('0x8b')](_0x54a860[_0x0d2f('0x27')]);}if(this['variables'][_0x54a860[_0x0d2f('0x27')]]){delete this['variables'][_0x54a860[_0x0d2f('0x27')]];}}}catch(_0x48a254){logger[_0x0d2f('0x3a')](_0x0d2f('0x8c'),_0x54a860[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x48a254,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x1d')]=function(_0x1204cd){try{if(this['isNotNull'](_0x1204cd)){logger[_0x0d2f('0x26')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1204cd[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x1204cd,{'showHidden':![],'depth':null}));if(this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]]){for(var _0x313763 in this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]]){if(this[_0x0d2f('0xb')][_0x1204cd['transfereeuniqueid']]['hasOwnProperty'](_0x313763)){if(_0x1204cd[_0x0d2f('0x8e')]===_0x313763){logger[_0x0d2f('0x23')](_0x0d2f('0x8f'),_0x1204cd[_0x0d2f('0x27')],this['channels'][_0x1204cd[_0x0d2f('0x8d')]][_0x313763]['membername'],_0x313763);var _0x1cee6d=moment();this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x16')]=!![];this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x67')]=moment()[_0x0d2f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x42')]=_0x0d2f('0x90');this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x51')]='transfer';this['channels'][_0x1204cd['transfereeuniqueid']][_0x313763][_0x0d2f('0x6a')]=_0x1cee6d[_0x0d2f('0x91')](this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x8d')]][_0x313763][_0x0d2f('0x3d')],_0x0d2f('0x92'));}}}}if(this[_0x0d2f('0xb')][_0x1204cd[_0x0d2f('0x93')]]){var _0x3a7006=this[_0x0d2f('0xb')][_0x1204cd['secondtransfereruniqueid']];this[_0x0d2f('0xb')][_0x1204cd['secondtransfereruniqueid']]=this['channels'][_0x1204cd[_0x0d2f('0x8d')]];this['channels'][_0x1204cd[_0x0d2f('0x8d')]]=_0x3a7006;}}}catch(_0x2291fa){logger[_0x0d2f('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0x1204cd['uniqueid'],util[_0x0d2f('0x28')](_0x2291fa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0d2f('0x20')][_0x0d2f('0x1f')]=function(_0x223a93){try{if(this[_0x0d2f('0x21')](_0x223a93)){logger['debug'](_0x0d2f('0x94'),_0x223a93[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x223a93,{'showHidden':![],'depth':null}));if(this['channels'][_0x223a93[_0x0d2f('0x8d')]]){for(var _0x471d5c in this['channels'][_0x223a93[_0x0d2f('0x8d')]]){if(this['channels'][_0x223a93[_0x0d2f('0x8d')]][_0x0d2f('0x3b')](_0x471d5c)){if(_0x223a93[_0x0d2f('0x95')]===_0x471d5c){logger[_0x0d2f('0x23')](_0x0d2f('0x96'),_0x223a93[_0x0d2f('0x27')],this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c]['membername'],_0x471d5c);var _0x343eef=moment();this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c]['agentcomplete']=!![];this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x67')]=_0x343eef;this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x42')]=_0x0d2f('0x90');this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x51')]=_0x0d2f('0x68');this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c]['talktime']=_0x343eef[_0x0d2f('0x91')](this[_0x0d2f('0xb')][_0x223a93[_0x0d2f('0x8d')]][_0x471d5c][_0x0d2f('0x3d')],_0x0d2f('0x92'));}}}}}}catch(_0x1033e0){logger['error'](_0x0d2f('0x97'),_0x223a93[_0x0d2f('0x27')],util['inspect'](_0x1033e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x19')]=function(_0x520931){var _0x7b8574='';try{if(this[_0x0d2f('0x21')](_0x520931)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x520931['uniqueid'],util['inspect'](_0x520931,{'showHidden':![],'depth':null}));if(_0x520931[_0x0d2f('0x98')]){_0x7b8574=_0x520931[_0x0d2f('0x98')]['substring'](0x0,_0x520931[_0x0d2f('0x98')][_0x0d2f('0x99')]('-'));if(this[_0x0d2f('0xe')][_0x7b8574]){logger['info']('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x520931['uniqueid'],_0x7b8574);this['agents'][_0x7b8574][_0x0d2f('0x9a')]=!![];}}}}catch(_0x146c67){logger[_0x0d2f('0x3a')]('[%s][voiceAgentReport][musiconholdstart]',_0x520931['uniqueid'],util[_0x0d2f('0x28')](_0x146c67,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x1b')]=function(_0x38d0a7){var _0xa87e70='';try{if(this[_0x0d2f('0x21')](_0x38d0a7)){logger['debug'](_0x0d2f('0x9b'),_0x38d0a7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x38d0a7,{'showHidden':![],'depth':null}));if(_0x38d0a7[_0x0d2f('0x98')]){_0xa87e70=_0x38d0a7['channel'][_0x0d2f('0x9c')](0x0,_0x38d0a7[_0x0d2f('0x98')][_0x0d2f('0x99')]('-'));if(this[_0x0d2f('0xe')][_0xa87e70]){logger['info'](_0x0d2f('0x9d'),_0x38d0a7['uniqueid'],_0xa87e70);this[_0x0d2f('0xe')][_0xa87e70][_0x0d2f('0x9a')]=![];}}}}catch(_0x58b3c2){logger[_0x0d2f('0x3a')](_0x0d2f('0x9e'),_0x38d0a7[_0x0d2f('0x27')],util[_0x0d2f('0x28')](_0x58b3c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0d2f('0x8b')]=function(_0x5a3bda,_0x220693=0x2710){if(this[_0x0d2f('0xb')][_0x5a3bda]){setTimeout(()=>{delete this[_0x0d2f('0xb')][_0x5a3bda];},_0x220693);}};module[_0x0d2f('0x9f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 49020b8..939ba1b 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8da1=['seconds','disposition','includes','lastdata','match','type','isNil','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','calleridnum','destinationchannel','toNumber','membername','diff','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','set','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','bind','syncNewExten','newchannel','syncNewChannel','newstate','varset','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','accountcode','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8da1,0x140));var _0x18da=function(_0xf5b712,_0x5487bf){_0xf5b712=_0xf5b712-0x0;var _0x410413=_0x8da1[_0xf5b712];return _0x410413;};'use strict';var _=require(_0x18da('0x0'));var moment=require(_0x18da('0x1'));var util=require(_0x18da('0x2'));var path=require(_0x18da('0x3'));var Redis=require(_0x18da('0x4'));var config=require(_0x18da('0x5'));var logger=require(_0x18da('0x6'))(_0x18da('0x7'));var ami=require('../ami');var Channel=require(_0x18da('0x8'));var RpcSetting=require('../rpc/setting');var applications=[_0x18da('0x9'),'queue','agi',_0x18da('0xa'),_0x18da('0xb'),'voicemail'];var dispositions=[_0x18da('0xc'),_0x18da('0xd'),_0x18da('0xd'),_0x18da('0xc'),_0x18da('0xc'),_0x18da('0xc'),_0x18da('0xe'),_0x18da('0xf'),_0x18da('0xd'),_0x18da('0xd'),_0x18da('0xd')];config[_0x18da('0x10')]=_['defaults'](config[_0x18da('0x10')],{'host':_0x18da('0x11'),'port':0x18eb});var io=require(_0x18da('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x5a689b){this['channels']=_0x5a689b[_0x18da('0x13')];this[_0x18da('0x14')]=_0x5a689b['agents'];this[_0x18da('0x15')]={};ami['on']('coreshowchannel',this['syncNewExten'][_0x18da('0x16')](this));ami['on']('newexten',this[_0x18da('0x17')][_0x18da('0x16')](this));ami['on'](_0x18da('0x18'),this[_0x18da('0x19')]['bind'](this));ami['on'](_0x18da('0x1a'),this['syncNewState'][_0x18da('0x16')](this));ami['on'](_0x18da('0x1b'),this['syncVarSet'][_0x18da('0x16')](this));ami['on'](_0x18da('0x1c'),this[_0x18da('0x1d')][_0x18da('0x16')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x18da('0x16')](this));ami['on'](_0x18da('0x1e'),this[_0x18da('0x1f')][_0x18da('0x16')](this));ami['on'](_0x18da('0x20'),this[_0x18da('0x21')]['bind'](this));ami['on'](_0x18da('0x22'),this[_0x18da('0x23')][_0x18da('0x16')](this));ami['on'](_0x18da('0x24'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x18da('0x25')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x18da('0x26')]();}catch(_0x451c88){logger[_0x18da('0x27')](_0x18da('0x28'),util[_0x18da('0x29')](_0x451c88,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x18da('0x2a')][_0x18da('0x2b')]=function(_0x78c991){return _0x78c991!==null&&!_[_0x18da('0x2c')](_0x78c991);};VoiceCallReport[_0x18da('0x2a')][_0x18da('0x2d')]=function(_0x564f04,_0x3117f2,_0x33d25f){io['to'](_0x564f04)[_0x18da('0x2d')](_0x3117f2,_0x33d25f);};VoiceCallReport[_0x18da('0x2a')]['syncNewCallerId']=function(_0x5bb050){try{if(this['isNotNull'](_0x5bb050)){logger[_0x18da('0x25')](_0x18da('0x2e'),_0x5bb050[_0x18da('0x2f')],_0x5bb050[_0x18da('0x30')],_0x5bb050['calleridnum']);logger[_0x18da('0x31')](_0x18da('0x32'),_0x5bb050[_0x18da('0x2f')],util[_0x18da('0x29')](_0x5bb050,{'showHidden':![],'depth':null}));if(_0x5bb050[_0x18da('0x2f')]===_0x5bb050[_0x18da('0x33')]){if(!_[_0x18da('0x2c')](this[_0x18da('0x13')][_0x5bb050[_0x18da('0x2f')]])){_[_0x18da('0x34')](this[_0x18da('0x13')][_0x5bb050[_0x18da('0x2f')]],_[_0x18da('0x35')](_0x5bb050,_[_0x18da('0x36')](this[_0x18da('0x13')][_0x5bb050['uniqueid']])));}}if(_0x5bb050[_0x18da('0x37')]===_0x18da('0x38')){var _0x210aa1=this[_0x18da('0x14')][_0x5bb050[_0x18da('0x39')][_0x18da('0x3a')]('-')[0x0]];if(_0x210aa1){if(_0x5bb050[_0x18da('0x3b')]==_0x18da('0x3c')){_0x210aa1[_0x18da('0x3d')]=_0x5bb050[_0x18da('0x3e')];this['emit'](util[_0x18da('0x3f')](_0x18da('0x40'),_0x210aa1[_0x18da('0x41')]),'user:agentconnect',{'id':_0x210aa1['id'],'destaccountcode':_0x210aa1[_0x18da('0x42')],'destconnectedlinenum':_0x5bb050[_0x18da('0x3e')]});}}}}}catch(_0x566a4d){logger['error']('[%s][voiceCallReport][newcallerid]',_0x5bb050[_0x18da('0x2f')],util[_0x18da('0x29')](_0x566a4d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x18da('0x2a')][_0x18da('0x19')]=function(_0x530ef8){try{if(this[_0x18da('0x2b')](_0x530ef8)){logger[_0x18da('0x31')](_0x18da('0x43'),_0x530ef8[_0x18da('0x2f')],util[_0x18da('0x29')](_0x530ef8,{'showHidden':![],'depth':null}));if(this[_0x18da('0x13')][_0x530ef8['uniqueid']]){return;}if(_0x530ef8[_0x18da('0x39')]==='OutgoingSpoolFailed'){return;}if(_0x530ef8[_0x18da('0x2f')]!==_0x530ef8['linkedid']&&!this['blindTransfers'][_0x530ef8[_0x18da('0x33')]]){return;}logger[_0x18da('0x25')](_0x18da('0x44'),_0x530ef8[_0x18da('0x2f')],_0x530ef8[_0x18da('0x37')],_0x530ef8[_0x18da('0x3b')]);this['channels'][_0x530ef8['uniqueid']]=new Channel();this['channels'][_0x530ef8[_0x18da('0x2f')]][_0x18da('0x45')]=moment()[_0x18da('0x3f')](_0x18da('0x46'));this[_0x18da('0x13')][_0x530ef8[_0x18da('0x2f')]]['disposition']=dispositions[_['toNumber'](_0x530ef8['channelstate'])];_[_0x18da('0x34')](this[_0x18da('0x13')][_0x530ef8[_0x18da('0x2f')]],_['pick'](_0x530ef8,_['keys'](this['channels'][_0x530ef8[_0x18da('0x2f')]])));if(_0x530ef8[_0x18da('0x37')]===_0x18da('0x38')){var _0x40ff4d=this[_0x18da('0x14')][_0x530ef8[_0x18da('0x39')][_0x18da('0x3a')]('-')[0x0]];if(_0x40ff4d&&typeof _0x40ff4d[_0x18da('0x3d')]===_0x18da('0x47')){_0x40ff4d[_0x18da('0x3d')]=_0x530ef8[_0x18da('0x3b')];logger[_0x18da('0x31')](_0x18da('0x48'),_0x530ef8[_0x18da('0x2f')],util['inspect']({'id':_0x40ff4d['id'],'destaccountcode':_0x40ff4d[_0x18da('0x42')],'destconnectedlinenum':_0x530ef8[_0x18da('0x3b')]},{'showHidden':![],'depth':null}));this[_0x18da('0x2d')](util['format']('user:%s',_0x40ff4d[_0x18da('0x41')]),'user:agentconnect',{'id':_0x40ff4d['id'],'destaccountcode':_0x40ff4d['accountcode'],'destconnectedlinenum':_0x530ef8[_0x18da('0x3b')]});}}}}catch(_0x4c5010){logger[_0x18da('0x27')](_0x18da('0x49'),_0x530ef8[_0x18da('0x2f')],util['inspect'](_0x4c5010,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x18da('0x2a')]['syncNewExten']=function(_0x4cf9e7){try{if(this['isNotNull'](_0x4cf9e7)){logger[_0x18da('0x31')](_0x18da('0x4a'),_0x4cf9e7[_0x18da('0x2f')],util[_0x18da('0x29')](_0x4cf9e7,{'showHidden':![],'depth':null}));if(_0x4cf9e7['channel']===_0x18da('0x4b')||_0x4cf9e7[_0x18da('0x3b')]==='h')return;if(_0x4cf9e7[_0x18da('0x2f')]===_0x4cf9e7[_0x18da('0x33')]||this[_0x18da('0x15')][_0x4cf9e7[_0x18da('0x33')]]){_0x4cf9e7[_0x18da('0x4c')]=_0x4cf9e7[_0x18da('0x4c')]?_0x4cf9e7[_0x18da('0x4c')]['toLowerCase']():undefined;_0x4cf9e7['applicationdata']=_0x4cf9e7[_0x18da('0x4d')]||_0x4cf9e7[_0x18da('0x4e')];if(_0x4cf9e7['appdata']&&_0x4cf9e7[_0x18da('0x4c')]!=='queue'){_0x4cf9e7[_0x18da('0x4e')]=_0x4cf9e7[_0x18da('0x4e')][_0x18da('0x4f')]();}logger[_0x18da('0x25')](_0x18da('0x50'),_0x4cf9e7[_0x18da('0x2f')],_0x4cf9e7[_0x18da('0x4c')],_0x4cf9e7['applicationdata']);if(_['isUndefined'](this['channels'][_0x4cf9e7[_0x18da('0x2f')]])){this['channels'][_0x4cf9e7[_0x18da('0x2f')]]=new Channel();this[_0x18da('0x13')][_0x4cf9e7['uniqueid']][_0x18da('0x45')]=_0x4cf9e7[_0x18da('0x51')]?moment()['subtract'](moment[_0x18da('0x51')](_0x4cf9e7[_0x18da('0x51')])[_0x18da('0x52')](),'seconds')[_0x18da('0x3f')](_0x18da('0x46')):moment()[_0x18da('0x3f')](_0x18da('0x46'));this[_0x18da('0x13')][_0x4cf9e7[_0x18da('0x2f')]][_0x18da('0x53')]=_0x18da('0xc');}_[_0x18da('0x34')](this[_0x18da('0x13')][_0x4cf9e7[_0x18da('0x2f')]],_['pick'](_0x4cf9e7,_[_0x18da('0x36')](this[_0x18da('0x13')][_0x4cf9e7[_0x18da('0x2f')]])));if(_[_0x18da('0x54')](applications,_0x4cf9e7[_0x18da('0x4c')])){this[_0x18da('0x13')][_0x4cf9e7['uniqueid']]['lastapplication']=_0x4cf9e7[_0x18da('0x4c')];this[_0x18da('0x13')][_0x4cf9e7['uniqueid']][_0x18da('0x55')]=_0x4cf9e7[_0x18da('0x4e')];if(_0x4cf9e7['application']===_0x18da('0x9')&&_['startsWith'](_0x4cf9e7[_0x18da('0x4e')][_0x18da('0x4f')](),'cdr(')){var _0x52d8e2=_0x4cf9e7['applicationdata'][_0x18da('0x3a')]('=');var _0x4e6a4b=_0x52d8e2[0x0]['toLowerCase']()[_0x18da('0x56')](/cdr\((.*)\)/);if(_0x4e6a4b){if(_0x4e6a4b[0x1]===_0x18da('0x57')&&!_[_0x18da('0x58')](this[_0x18da('0x13')][_0x4cf9e7[_0x18da('0x2f')]][_0x4e6a4b[0x1]]))return;this['channels'][_0x4cf9e7[_0x18da('0x2f')]][_0x4e6a4b[0x1]]=_0x52d8e2[0x1];}}else if(_0x4cf9e7[_0x18da('0x4c')]===_0x18da('0x59')){this[_0x18da('0x13')][_0x4cf9e7[_0x18da('0x2f')]][_0x18da('0x59')]=_0x4cf9e7['applicationdata'][_0x18da('0x3a')](',')[0x0];}}}}}catch(_0x3230c3){logger[_0x18da('0x27')](_0x18da('0x5a'),_0x4cf9e7[_0x18da('0x2f')],util[_0x18da('0x29')](_0x3230c3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x18da('0x2a')][_0x18da('0x5b')]=function(_0x525683){try{if(this['isNotNull'](_0x525683)){logger[_0x18da('0x25')](_0x18da('0x5c'),_0x525683[_0x18da('0x2f')],_0x525683['linkedid'],_0x525683['calleridname'],_0x525683['calleridnum']);logger[_0x18da('0x31')](_0x18da('0x5d'),_0x525683[_0x18da('0x2f')],util[_0x18da('0x29')](_0x525683,{'showHidden':![],'depth':null}));if(_0x525683[_0x18da('0x5e')]!=='6')return;var _0x419c27=this[_0x18da('0x14')][_0x525683['channel'][_0x18da('0x3a')]('-')[0x0]];if(_0x525683[_0x18da('0x2f')]!==_0x525683[_0x18da('0x33')]){var _0x181698=moment();if(this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]]){if(!this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x5f')]){this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x5f')]=!![];this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x60')]=_0x181698[_0x18da('0x3f')](_0x18da('0x46'));if(this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x45')]){this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x61')]=_0x181698['diff'](this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]]['starttime'],_0x18da('0x52'));}}this[_0x18da('0x13')][_0x525683['linkedid']][_0x18da('0x33')]=_0x525683[_0x18da('0x2f')];if(_0x525683[_0x18da('0x62')]!==_0x18da('0x3c')){this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x3e')]=_0x525683['calleridnum'];}this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]]['connectedlinename']=_0x525683[_0x18da('0x30')];this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]][_0x18da('0x63')]=_0x525683[_0x18da('0x39')];this[_0x18da('0x13')][_0x525683['linkedid']]['disposition']=dispositions[_[_0x18da('0x64')](_0x525683[_0x18da('0x5e')])];if(_0x419c27){this['channels'][_0x525683[_0x18da('0x33')]]['UserId']=_0x419c27['id'];this[_0x18da('0x13')][_0x525683['linkedid']][_0x18da('0x65')]=_0x419c27[_0x18da('0x41')];}}if(this[_0x18da('0x13')][_0x525683['uniqueid']]){if(!this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x5f')]){this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x5f')]=!![];this[_0x18da('0x13')][_0x525683['uniqueid']][_0x18da('0x60')]=_0x181698[_0x18da('0x3f')](_0x18da('0x46'));if(this[_0x18da('0x13')][_0x525683['uniqueid']][_0x18da('0x45')]){this['channels'][_0x525683[_0x18da('0x2f')]][_0x18da('0x61')]=_0x181698[_0x18da('0x66')](this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x45')],'seconds');}}if(_0x525683[_0x18da('0x62')]!=='xcally-motion-preview'){this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x3e')]=_0x525683[_0x18da('0x62')];}this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x67')]=_0x525683['calleridname'];this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]]['destinationchannel']=_0x525683[_0x18da('0x39')];this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x53')]=dispositions[_[_0x18da('0x64')](_0x525683[_0x18da('0x5e')])];}}else{if(this['channels'][_0x525683[_0x18da('0x2f')]]){if(_0x419c27){this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]]['UserId']=_0x419c27['id'];this[_0x18da('0x13')][_0x525683['uniqueid']][_0x18da('0x65')]=_0x419c27[_0x18da('0x41')];}}}if(_0x525683['context']===_0x18da('0x38')){if(_0x419c27){_0x419c27[_0x18da('0x3d')]=_0x525683['exten'];var _0x21f47b;if(this['channels'][_0x525683[_0x18da('0x2f')]]){_0x21f47b=this[_0x18da('0x13')][_0x525683[_0x18da('0x2f')]][_0x18da('0x59')];}else if(this[_0x18da('0x13')][_0x525683[_0x18da('0x33')]]){_0x21f47b=this[_0x18da('0x13')][_0x525683['linkedid']][_0x18da('0x59')];}_0x419c27[_0x18da('0x59')]=_0x21f47b;var _0x4d8f5d={'id':_0x419c27['id'],'name':_0x419c27[_0x18da('0x41')],'agentconnected':!![],'destaccountcode':_0x419c27[_0x18da('0x42')],'destconnectedlinenum':_0x525683[_0x18da('0x3b')],'queue':_0x21f47b||undefined,'uniqueid':_0x525683[_0x18da('0x33')]};logger[_0x18da('0x31')](_0x18da('0x68'),_0x525683['uniqueid'],util[_0x18da('0x29')](_0x4d8f5d,{'showHidden':![],'depth':null}));this[_0x18da('0x2d')](util[_0x18da('0x3f')](_0x18da('0x40'),_0x419c27[_0x18da('0x41')]),_0x18da('0x69'),_0x4d8f5d);}}}}catch(_0x2a29c0){logger[_0x18da('0x27')](_0x18da('0x6a'),_0x525683[_0x18da('0x2f')],util[_0x18da('0x29')](_0x2a29c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x18da('0x2a')]['syncMixMonitorFilename']=function(_0x3fbf6f,_0x42a75a){try{if(this['channels'][_0x3fbf6f]){logger['info'](_0x18da('0x6b'),_0x3fbf6f,_0x42a75a);this[_0x18da('0x13')][_0x3fbf6f][_0x18da('0x6c')]=!![];if(_[_0x18da('0x6d')](_0x42a75a,'.wav49')){_0x42a75a=_0x42a75a[_0x18da('0x6e')](_0x18da('0x6f'),_0x18da('0x70'));}this[_0x18da('0x13')][_0x3fbf6f][_0x18da('0x71')]=_0x42a75a;var _0x37849a=_[_0x18da('0x72')](this[_0x18da('0x13')][_0x3fbf6f][_0x18da('0x73')],{'filename':_0x42a75a});if(_[_0x18da('0x58')](_0x37849a)){this[_0x18da('0x13')][_0x3fbf6f][_0x18da('0x73')][_0x18da('0x74')]({'filename':_0x42a75a,'createdAt':moment()[_0x18da('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x18da('0x75')});}}}catch(_0x8546d3){logger[_0x18da('0x27')](_0x18da('0x76'),_0x3fbf6f,util['inspect'](_0x8546d3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x18da('0x77')]=function(_0x205d41){try{if(this[_0x18da('0x2b')](_0x205d41)){logger[_0x18da('0x31')](_0x18da('0x78'),_0x205d41[_0x18da('0x2f')],util['inspect'](_0x205d41,{'showHidden':![],'depth':null}));if(this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]]&&_0x205d41[_0x18da('0x39')]!=_0x18da('0x4b')){if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')])){if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')][_0x18da('0x7a')])){logger['info'](_0x18da('0x7b'),_0x205d41[_0x18da('0x2f')],_0x205d41['value']);this[_0x18da('0x7c')](_0x205d41[_0x18da('0x2f')],_0x205d41[_0x18da('0x7d')]);}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')][_0x18da('0x7e')])){logger[_0x18da('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x205d41[_0x18da('0x2f')],_0x205d41[_0x18da('0x7d')]);this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]][_0x18da('0x62')]=_0x205d41['value'];}else if(this['isNotNull'](_0x205d41[_0x18da('0x79')][_0x18da('0x7f')])){logger[_0x18da('0x25')](_0x18da('0x80'),_0x205d41[_0x18da('0x2f')],_0x205d41['value']);this['channels'][_0x205d41[_0x18da('0x2f')]][_0x18da('0x81')]=_0x205d41[_0x18da('0x7d')];}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')]['xmd-cdrtype'])){logger['info'](_0x18da('0x82'),_0x205d41[_0x18da('0x2f')],_0x205d41[_0x18da('0x7d')]);this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]][_0x18da('0x57')]=_0x205d41[_0x18da('0x7d')];}else if(this['isNotNull'](_0x205d41['variable'][_0x18da('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x205d41['uniqueid'],_0x205d41['value'][_0x18da('0x3a')](',')[0x0]);this[_0x18da('0x13')][_0x205d41['uniqueid']][_0x18da('0x59')]=_0x205d41['value'][_0x18da('0x3a')](',')[0x0];}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')][_0x18da('0x84')])){logger['info'](_0x18da('0x85'),_0x205d41[_0x18da('0x2f')],_0x205d41[_0x18da('0x7d')]);this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]][_0x18da('0x86')]=_0x205d41[_0x18da('0x7d')];}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')][_0x18da('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x205d41[_0x18da('0x2f')],_0x205d41['value']);this[_0x18da('0x13')][_0x205d41['uniqueid']][_0x18da('0x88')]=_0x205d41[_0x18da('0x7d')];}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')]['xmd-callerid-preview'])){logger[_0x18da('0x25')](_0x18da('0x89'),_0x205d41['uniqueid'],_0x205d41['value']);this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]][_0x18da('0x8a')]=_0x205d41['value'];}else if(this['isNotNull'](_0x205d41[_0x18da('0x79')][_0x18da('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x205d41[_0x18da('0x2f')],_0x205d41[_0x18da('0x7d')]);this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]][_0x18da('0x59')]=_0x205d41[_0x18da('0x7d')];}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')][_0x18da('0x8c')])){logger['info'](_0x18da('0x8d'),_0x205d41['uniqueid'],_0x205d41[_0x18da('0x7d')]);this[_0x18da('0x13')][_0x205d41[_0x18da('0x2f')]][_0x18da('0x8e')]=_0x205d41[_0x18da('0x7d')];}}}else if(this[_0x18da('0x2b')](_0x205d41[_0x18da('0x79')]['mixmonitor_filename'])){if(_0x205d41['value']){var _0x53b1fd=path[_0x18da('0x8f')](_0x205d41[_0x18da('0x7d')])['name'];logger[_0x18da('0x25')](_0x18da('0x7b'),_0x53b1fd,_0x205d41[_0x18da('0x7d')]);this[_0x18da('0x7c')](_0x53b1fd,_0x205d41[_0x18da('0x7d')]);}}else if(this['channels'][_0x205d41[_0x18da('0x33')]]){if(this['isNotNull'](_0x205d41['variable'])){if(this['isNotNull'](_0x205d41[_0x18da('0x79')][_0x18da('0x8c')])){logger[_0x18da('0x25')](_0x18da('0x8d'),_0x205d41[_0x18da('0x33')],_0x205d41['value']);this[_0x18da('0x13')][_0x205d41['linkedid']][_0x18da('0x90')]=_0x205d41[_0x18da('0x7d')];}}}}}catch(_0x2e31c6){logger['error'](_0x18da('0x91'),_0x205d41['uniqueid'],util[_0x18da('0x29')](_0x2e31c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x18da('0x2a')][_0x18da('0x1d')]=function(_0x42fac8){try{if(this['isNotNull'](_0x42fac8)){logger[_0x18da('0x31')]('[%s][voiceCallReport][hangup]\x20event:',_0x42fac8[_0x18da('0x2f')],util[_0x18da('0x29')](_0x42fac8,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x42fac8[_0x18da('0x33')]]){if(this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]]['linkedid']]){this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]][_0x18da('0x2f')]=_0x42fac8[_0x18da('0x2f')];this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]][_0x18da('0x5f')]=this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x5f')];this[_0x18da('0x13')][this['blindTransfers'][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]][_0x18da('0x60')]=this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x60')];this[_0x18da('0x13')][this['blindTransfers'][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]][_0x18da('0x63')]=this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]][_0x18da('0x39')];this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]]['disposition']=this['channels'][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x53')];this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]]=this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]];this[_0x18da('0x92')](this['blindTransfers'][_0x42fac8[_0x18da('0x33')]][_0x18da('0x33')]);}else if(this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]]){this['channels'][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]][_0x18da('0x2f')]=[this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]]['linkedid'],this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8['linkedid']][_0x18da('0x2f')]][_0x18da('0x33')]=this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]][_0x18da('0x2f')]][0x0];this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]]['uniqueid']][_0x18da('0x5f')]=this[_0x18da('0x13')][_0x42fac8['uniqueid']][_0x18da('0x5f')];this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8['linkedid']][_0x18da('0x2f')]][_0x18da('0x60')]=this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x60')];this['channels'][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]][_0x18da('0x63')]=this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8['linkedid']][_0x18da('0x2f')]][_0x18da('0x39')];this[_0x18da('0x13')][this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]]['disposition']=this['channels'][_0x42fac8[_0x18da('0x2f')]]['disposition'];this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]]=this['channels'][this['blindTransfers'][_0x42fac8['linkedid']][_0x18da('0x2f')]];this['deleteChannelAfterTimeout'](this[_0x18da('0x15')][_0x42fac8[_0x18da('0x33')]][_0x18da('0x2f')]);}}if(this['channels'][_0x42fac8[_0x18da('0x2f')]]){logger[_0x18da('0x25')](_0x18da('0x93'),_0x42fac8[_0x18da('0x2f')],_0x42fac8['cause-txt']);var _0x5d40e6=moment();this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x94')]=_0x5d40e6['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x18da('0x13')][_0x42fac8['uniqueid']][_0x18da('0x51')]=_0x5d40e6[_0x18da('0x66')](this['channels'][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x45')],'seconds');if(this[_0x18da('0x13')][_0x42fac8['uniqueid']]['answered']){this['channels'][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x95')]=_0x5d40e6['diff'](this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]]['answertime'],_0x18da('0x52'));this['channels'][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x61')]=this[_0x18da('0x13')][_0x42fac8['uniqueid']][_0x18da('0x51')]-this[_0x18da('0x13')][_0x42fac8[_0x18da('0x2f')]][_0x18da('0x95')];}if(_0x42fac8[_0x18da('0x37')]===_0x18da('0x38')){if(this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')][_0x18da('0x3a')]('-')[0x0]]){this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')][_0x18da('0x3a')]('-')[0x0]]=_[_0x18da('0x96')](this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x18da('0x31')](_0x18da('0x97'),_0x42fac8[_0x18da('0x2f')],util[_0x18da('0x29')]({'id':this['agents'][_0x42fac8['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')][_0x18da('0x3a')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x18da('0x2d')](util[_0x18da('0x3f')](_0x18da('0x40'),this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')]['split']('-')[0x0]][_0x18da('0x41')]),_0x18da('0x98'),{'id':this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')][_0x18da('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x18da('0x14')][_0x42fac8[_0x18da('0x39')]['split']('-')[0x0]][_0x18da('0x42')]});for(var _0x41e559=0x0;_0x41e559{delete this[_0x18da('0x13')][_0x2cf170];},_0x3f562a);}};module[_0x18da('0xc8')]=VoiceCallReport; \ No newline at end of file +var _0xda40=['queue','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','toNumber','destinationchannel','UserId','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','xmd-phone','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','omit','user:agentcomplete','resolve','then','transferType','undefined','transferToInternal','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','BLIND','syncHangup','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','merge','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata'];(function(_0x440e2e,_0x1e7080){var _0x15e54a=function(_0x31ed15){while(--_0x31ed15){_0x440e2e['push'](_0x440e2e['shift']());}};_0x15e54a(++_0x1e7080);}(_0xda40,0x134));var _0x0da4=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0xda40[_0x5fe7ce];return _0x3b5793;};'use strict';var _=require('lodash');var moment=require(_0x0da4('0x0'));var util=require(_0x0da4('0x1'));var path=require(_0x0da4('0x2'));var Redis=require('ioredis');var config=require(_0x0da4('0x3'));var logger=require(_0x0da4('0x4'))(_0x0da4('0x5'));var ami=require(_0x0da4('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x0da4('0x7'));var applications=[_0x0da4('0x8'),'queue',_0x0da4('0x9'),_0x0da4('0xa'),_0x0da4('0xb'),_0x0da4('0xc')];var dispositions=[_0x0da4('0xd'),_0x0da4('0xe'),_0x0da4('0xe'),_0x0da4('0xd'),_0x0da4('0xd'),_0x0da4('0xd'),_0x0da4('0xf'),_0x0da4('0x10'),'FAILED',_0x0da4('0xe'),_0x0da4('0xe')];config[_0x0da4('0x11')]=_[_0x0da4('0x12')](config['redis'],{'host':_0x0da4('0x13'),'port':0x18eb});var io=require(_0x0da4('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0x4a7716){this[_0x0da4('0x15')]=_0x4a7716[_0x0da4('0x15')];this[_0x0da4('0x16')]=_0x4a7716[_0x0da4('0x16')];this[_0x0da4('0x17')]={};ami['on'](_0x0da4('0x18'),this[_0x0da4('0x19')][_0x0da4('0x1a')](this));ami['on']('newexten',this[_0x0da4('0x19')][_0x0da4('0x1a')](this));ami['on']('newchannel',this[_0x0da4('0x1b')][_0x0da4('0x1a')](this));ami['on'](_0x0da4('0x1c'),this[_0x0da4('0x1d')][_0x0da4('0x1a')](this));ami['on']('varset',this[_0x0da4('0x1e')]['bind'](this));ami['on'](_0x0da4('0x1f'),this['syncHangup']['bind'](this));ami['on'](_0x0da4('0x20'),this[_0x0da4('0x21')][_0x0da4('0x1a')](this));ami['on'](_0x0da4('0x22'),this[_0x0da4('0x23')][_0x0da4('0x1a')](this));ami['on']('blindtransfer',this[_0x0da4('0x24')][_0x0da4('0x1a')](this));ami['on'](_0x0da4('0x25'),this[_0x0da4('0x26')]['bind'](this));ami['on'](_0x0da4('0x27'),this['syncMusicOnHoldStop'][_0x0da4('0x1a')](this));try{logger[_0x0da4('0x28')](_0x0da4('0x29'));ami['actionCoreShowChannels']();}catch(_0x26e980){logger[_0x0da4('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0x0da4('0x2b')](_0x26e980,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x2d')]=function(_0x1ba5a6){return _0x1ba5a6!==null&&!_[_0x0da4('0x2e')](_0x1ba5a6);};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x2f')]=function(_0x29cbad,_0x4ead66,_0x1c590e){io['to'](_0x29cbad)[_0x0da4('0x2f')](_0x4ead66,_0x1c590e);};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x21')]=function(_0x5a9b34){try{if(this['isNotNull'](_0x5a9b34)){logger[_0x0da4('0x28')](_0x0da4('0x30'),_0x5a9b34[_0x0da4('0x31')],_0x5a9b34[_0x0da4('0x32')],_0x5a9b34['calleridnum']);logger[_0x0da4('0x33')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5a9b34['uniqueid'],util[_0x0da4('0x2b')](_0x5a9b34,{'showHidden':![],'depth':null}));if(_0x5a9b34[_0x0da4('0x31')]===_0x5a9b34[_0x0da4('0x34')]){if(!_[_0x0da4('0x2e')](this['channels'][_0x5a9b34[_0x0da4('0x31')]])){_[_0x0da4('0x35')](this[_0x0da4('0x15')][_0x5a9b34[_0x0da4('0x31')]],_['pick'](_0x5a9b34,_[_0x0da4('0x36')](this[_0x0da4('0x15')][_0x5a9b34[_0x0da4('0x31')]])));}}if(_0x5a9b34[_0x0da4('0x37')]==='from-sip'){var _0x5c878d=this[_0x0da4('0x16')][_0x5a9b34[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]];if(_0x5c878d){if(_0x5a9b34[_0x0da4('0x3a')]==_0x0da4('0x3b')){_0x5c878d[_0x0da4('0x3c')]=_0x5a9b34[_0x0da4('0x3d')];this[_0x0da4('0x2f')](util[_0x0da4('0x3e')](_0x0da4('0x3f'),_0x5c878d[_0x0da4('0x40')]),_0x0da4('0x41'),{'id':_0x5c878d['id'],'destaccountcode':_0x5c878d[_0x0da4('0x42')],'destconnectedlinenum':_0x5a9b34[_0x0da4('0x3d')]});}}}}}catch(_0x161774){logger[_0x0da4('0x2a')]('[%s][voiceCallReport][newcallerid]',_0x5a9b34['uniqueid'],util[_0x0da4('0x2b')](_0x161774,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x1b')]=function(_0x25afa8){try{if(this['isNotNull'](_0x25afa8)){logger['debug'](_0x0da4('0x43'),_0x25afa8[_0x0da4('0x31')],util['inspect'](_0x25afa8,{'showHidden':![],'depth':null}));if(this['channels'][_0x25afa8[_0x0da4('0x31')]]){return;}if(_0x25afa8[_0x0da4('0x38')]==='OutgoingSpoolFailed'){return;}if(_0x25afa8['uniqueid']!==_0x25afa8[_0x0da4('0x34')]&&!this[_0x0da4('0x17')][_0x25afa8[_0x0da4('0x34')]]){return;}logger['info'](_0x0da4('0x44'),_0x25afa8['uniqueid'],_0x25afa8[_0x0da4('0x37')],_0x25afa8[_0x0da4('0x3a')]);this[_0x0da4('0x15')][_0x25afa8[_0x0da4('0x31')]]=new Channel();this[_0x0da4('0x15')][_0x25afa8['uniqueid']][_0x0da4('0x45')]=moment()[_0x0da4('0x3e')](_0x0da4('0x46'));this['channels'][_0x25afa8[_0x0da4('0x31')]][_0x0da4('0x47')]=dispositions[_['toNumber'](_0x25afa8[_0x0da4('0x48')])];_[_0x0da4('0x35')](this[_0x0da4('0x15')][_0x25afa8['uniqueid']],_[_0x0da4('0x49')](_0x25afa8,_[_0x0da4('0x36')](this[_0x0da4('0x15')][_0x25afa8[_0x0da4('0x31')]])));if(_0x25afa8['context']==='from-sip'){var _0x1f95bb=this[_0x0da4('0x16')][_0x25afa8[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]];if(_0x1f95bb&&typeof _0x1f95bb[_0x0da4('0x3c')]==='undefined'){_0x1f95bb['destconnectedlinenum']=_0x25afa8[_0x0da4('0x3a')];logger[_0x0da4('0x33')](_0x0da4('0x4a'),_0x25afa8[_0x0da4('0x31')],util['inspect']({'id':_0x1f95bb['id'],'destaccountcode':_0x1f95bb[_0x0da4('0x42')],'destconnectedlinenum':_0x25afa8[_0x0da4('0x3a')]},{'showHidden':![],'depth':null}));this[_0x0da4('0x2f')](util['format'](_0x0da4('0x3f'),_0x1f95bb[_0x0da4('0x40')]),_0x0da4('0x41'),{'id':_0x1f95bb['id'],'destaccountcode':_0x1f95bb[_0x0da4('0x42')],'destconnectedlinenum':_0x25afa8[_0x0da4('0x3a')]});}}}}catch(_0x689a25){logger[_0x0da4('0x2a')](_0x0da4('0x4b'),_0x25afa8[_0x0da4('0x31')],util['inspect'](_0x689a25,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0da4('0x19')]=function(_0x17db8e){try{if(this['isNotNull'](_0x17db8e)){logger['debug'](_0x0da4('0x4c'),_0x17db8e[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x17db8e,{'showHidden':![],'depth':null}));if(_0x17db8e[_0x0da4('0x38')]===_0x0da4('0x4d')||_0x17db8e[_0x0da4('0x3a')]==='h')return;if(_0x17db8e[_0x0da4('0x31')]===_0x17db8e[_0x0da4('0x34')]||this[_0x0da4('0x17')][_0x17db8e[_0x0da4('0x34')]]){_0x17db8e[_0x0da4('0x4e')]=_0x17db8e[_0x0da4('0x4e')]?_0x17db8e[_0x0da4('0x4e')][_0x0da4('0x4f')]():undefined;_0x17db8e[_0x0da4('0x50')]=_0x17db8e['appdata']||_0x17db8e[_0x0da4('0x50')];if(_0x17db8e[_0x0da4('0x51')]&&_0x17db8e[_0x0da4('0x4e')]!==_0x0da4('0x52')){_0x17db8e['applicationdata']=_0x17db8e[_0x0da4('0x50')][_0x0da4('0x4f')]();}logger[_0x0da4('0x28')](_0x0da4('0x53'),_0x17db8e[_0x0da4('0x31')],_0x17db8e[_0x0da4('0x4e')],_0x17db8e[_0x0da4('0x50')]);if(_[_0x0da4('0x2e')](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]])){this['channels'][_0x17db8e[_0x0da4('0x31')]]=new Channel();this[_0x0da4('0x15')][_0x17db8e['uniqueid']][_0x0da4('0x45')]=_0x17db8e['duration']?moment()[_0x0da4('0x54')](moment['duration'](_0x17db8e[_0x0da4('0x55')])[_0x0da4('0x56')](),_0x0da4('0x56'))['format'](_0x0da4('0x46')):moment()[_0x0da4('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0da4('0x15')][_0x17db8e['uniqueid']]['disposition']=_0x0da4('0xd');}_['merge'](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]],_[_0x0da4('0x49')](_0x17db8e,_['keys'](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]])));if(_[_0x0da4('0x57')](applications,_0x17db8e[_0x0da4('0x4e')])){this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x0da4('0x58')]=_0x17db8e[_0x0da4('0x4e')];this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x0da4('0x59')]=_0x17db8e[_0x0da4('0x50')];if(_0x17db8e[_0x0da4('0x4e')]==='set'&&_[_0x0da4('0x5a')](_0x17db8e[_0x0da4('0x50')][_0x0da4('0x4f')](),_0x0da4('0x5b'))){var _0x1ab520=_0x17db8e[_0x0da4('0x50')][_0x0da4('0x39')]('=');var _0x1622a3=_0x1ab520[0x0][_0x0da4('0x4f')]()[_0x0da4('0x5c')](/cdr\((.*)\)/);if(_0x1622a3){if(_0x1622a3[0x1]===_0x0da4('0x5d')&&!_[_0x0da4('0x5e')](this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x1622a3[0x1]]))return;this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x1622a3[0x1]]=_0x1ab520[0x1];}}else if(_0x17db8e[_0x0da4('0x4e')]===_0x0da4('0x52')){this[_0x0da4('0x15')][_0x17db8e[_0x0da4('0x31')]][_0x0da4('0x52')]=_0x17db8e[_0x0da4('0x50')]['split'](',')[0x0];}}}}}catch(_0x5032ee){logger[_0x0da4('0x2a')](_0x0da4('0x5f'),_0x17db8e[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x5032ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0da4('0x2c')][_0x0da4('0x1d')]=function(_0x56f5a6){try{if(this[_0x0da4('0x2d')](_0x56f5a6)){logger[_0x0da4('0x28')](_0x0da4('0x60'),_0x56f5a6[_0x0da4('0x31')],_0x56f5a6[_0x0da4('0x34')],_0x56f5a6[_0x0da4('0x32')],_0x56f5a6[_0x0da4('0x61')]);logger[_0x0da4('0x33')](_0x0da4('0x62'),_0x56f5a6[_0x0da4('0x31')],util['inspect'](_0x56f5a6,{'showHidden':![],'depth':null}));if(_0x56f5a6['channelstate']!=='6')return;var _0xa5c2c=this['agents'][_0x56f5a6[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]];if(_0x56f5a6['uniqueid']!==_0x56f5a6[_0x0da4('0x34')]){var _0x1d60b4=moment();if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]){if(!this['channels'][_0x56f5a6[_0x0da4('0x34')]]['answered']){this['channels'][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x63')]=!![];this['channels'][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x64')]=_0x1d60b4['format'](_0x0da4('0x46'));if(this['channels'][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x45')]){this['channels'][_0x56f5a6['linkedid']][_0x0da4('0x65')]=_0x1d60b4[_0x0da4('0x66')](this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x45')],_0x0da4('0x56'));}}this[_0x0da4('0x15')][_0x56f5a6['linkedid']][_0x0da4('0x34')]=_0x56f5a6[_0x0da4('0x31')];if(_0x56f5a6['calleridnum']!==_0x0da4('0x3b')){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x3d')]=_0x56f5a6[_0x0da4('0x61')];}this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]][_0x0da4('0x67')]=_0x56f5a6[_0x0da4('0x32')];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['destinationchannel']=_0x56f5a6[_0x0da4('0x38')];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['disposition']=dispositions[_[_0x0da4('0x68')](_0x56f5a6[_0x0da4('0x48')])];if(_0xa5c2c){this['channels'][_0x56f5a6['linkedid']]['UserId']=_0xa5c2c['id'];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['membername']=_0xa5c2c[_0x0da4('0x40')];}}if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]]){if(!this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x63')]){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x63')]=!![];this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x64')]=_0x1d60b4[_0x0da4('0x3e')](_0x0da4('0x46'));if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x45')]){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x65')]=_0x1d60b4['diff'](this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x45')],_0x0da4('0x56'));}}if(_0x56f5a6[_0x0da4('0x61')]!==_0x0da4('0x3b')){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x3d')]=_0x56f5a6[_0x0da4('0x61')];}this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x67')]=_0x56f5a6[_0x0da4('0x32')];this[_0x0da4('0x15')][_0x56f5a6['uniqueid']][_0x0da4('0x69')]=_0x56f5a6[_0x0da4('0x38')];this[_0x0da4('0x15')][_0x56f5a6['uniqueid']][_0x0da4('0x47')]=dispositions[_['toNumber'](_0x56f5a6[_0x0da4('0x48')])];}}else{if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]]){if(_0xa5c2c){this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x6a')]=_0xa5c2c['id'];this[_0x0da4('0x15')][_0x56f5a6['uniqueid']]['membername']=_0xa5c2c[_0x0da4('0x40')];}}}if(_0x56f5a6['context']===_0x0da4('0x6b')){if(_0xa5c2c){_0xa5c2c[_0x0da4('0x3c')]=_0x56f5a6[_0x0da4('0x3a')];var _0x71e331;if(this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x31')]]){_0x71e331=this['channels'][_0x56f5a6[_0x0da4('0x31')]][_0x0da4('0x52')];}else if(this[_0x0da4('0x15')][_0x56f5a6['linkedid']]){_0x71e331=this[_0x0da4('0x15')][_0x56f5a6[_0x0da4('0x34')]]['queue'];}_0xa5c2c['queue']=_0x71e331;var _0x173297={'id':_0xa5c2c['id'],'name':_0xa5c2c[_0x0da4('0x40')],'agentconnected':!![],'destaccountcode':_0xa5c2c[_0x0da4('0x42')],'destconnectedlinenum':_0x56f5a6[_0x0da4('0x3a')],'queue':_0x71e331||undefined,'uniqueid':_0x56f5a6[_0x0da4('0x34')]};logger['debug'](_0x0da4('0x6c'),_0x56f5a6[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x173297,{'showHidden':![],'depth':null}));this[_0x0da4('0x2f')](util[_0x0da4('0x3e')](_0x0da4('0x3f'),_0xa5c2c['name']),_0x0da4('0x41'),_0x173297);}}}}catch(_0x1ca005){logger[_0x0da4('0x2a')](_0x0da4('0x6d'),_0x56f5a6[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x1ca005,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0da4('0x6e')]=function(_0x5e3790,_0x1a3489){try{if(this[_0x0da4('0x15')][_0x5e3790]){logger[_0x0da4('0x28')](_0x0da4('0x6f'),_0x5e3790,_0x1a3489);this[_0x0da4('0x15')][_0x5e3790][_0x0da4('0x70')]=!![];if(_[_0x0da4('0x71')](_0x1a3489,_0x0da4('0x72'))){_0x1a3489=_0x1a3489[_0x0da4('0x73')]('.wav49',_0x0da4('0x74'));}this[_0x0da4('0x15')][_0x5e3790][_0x0da4('0x75')]=_0x1a3489;var _0x405155=_[_0x0da4('0x76')](this['channels'][_0x5e3790][_0x0da4('0x77')],{'filename':_0x1a3489});if(_[_0x0da4('0x5e')](_0x405155)){this['channels'][_0x5e3790]['monitors']['push']({'filename':_0x1a3489,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x342a45){logger[_0x0da4('0x2a')](_0x0da4('0x78'),_0x5e3790,util[_0x0da4('0x2b')](_0x342a45,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0da4('0x1e')]=function(_0x4ba138){try{if(this['isNotNull'](_0x4ba138)){logger[_0x0da4('0x33')](_0x0da4('0x79'),_0x4ba138[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x4ba138,{'showHidden':![],'depth':null}));if(this['channels'][_0x4ba138[_0x0da4('0x31')]]&&_0x4ba138[_0x0da4('0x38')]!=_0x0da4('0x4d')){if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')])){if(this[_0x0da4('0x2d')](_0x4ba138['variable'][_0x0da4('0x7b')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138['value']);this['syncMixMonitorFilename'](_0x4ba138['uniqueid'],_0x4ba138['value']);}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x7c')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this['channels'][_0x4ba138[_0x0da4('0x31')]]['calleridnum']=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x7e')])){logger[_0x0da4('0x28')](_0x0da4('0x7f'),_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x80')]=_0x4ba138[_0x0da4('0x7d')];}else if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x81')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138['uniqueid']][_0x0da4('0x5d')]=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x82')])){logger[_0x0da4('0x28')](_0x0da4('0x83'),_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]['split'](',')[0x0]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x52')]=_0x4ba138['value'][_0x0da4('0x39')](',')[0x0];}else if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x84')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]]['originatecalleridnum']=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')]['xmd-destination'])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x85')]=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')]['xmd-callerid-preview'])){logger[_0x0da4('0x28')](_0x0da4('0x86'),_0x4ba138[_0x0da4('0x31')],_0x4ba138['value']);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]]['calleridpreview']=_0x4ba138[_0x0da4('0x7d')];}else if(this['isNotNull'](_0x4ba138['variable'][_0x0da4('0x87')])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4ba138[_0x0da4('0x31')],_0x4ba138['value']);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x52')]=_0x4ba138[_0x0da4('0x7d')];}else if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')][_0x0da4('0x88')])){logger[_0x0da4('0x28')](_0x0da4('0x89'),_0x4ba138['uniqueid'],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x31')]][_0x0da4('0x8a')]=_0x4ba138['value'];}}}else if(this['isNotNull'](_0x4ba138[_0x0da4('0x7a')]['mixmonitor_filename'])){if(_0x4ba138['value']){var _0x21771d=path[_0x0da4('0x8b')](_0x4ba138[_0x0da4('0x7d')])[_0x0da4('0x40')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x21771d,_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x6e')](_0x21771d,_0x4ba138[_0x0da4('0x7d')]);}}else if(this['channels'][_0x4ba138[_0x0da4('0x34')]]){if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')])){if(this[_0x0da4('0x2d')](_0x4ba138[_0x0da4('0x7a')]['sipcallid'])){logger[_0x0da4('0x28')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x4ba138[_0x0da4('0x34')],_0x4ba138[_0x0da4('0x7d')]);this[_0x0da4('0x15')][_0x4ba138[_0x0da4('0x34')]][_0x0da4('0x8c')]=_0x4ba138['value'];}}}}}catch(_0x2c0340){logger['error'](_0x0da4('0x8d'),_0x4ba138[_0x0da4('0x31')],util[_0x0da4('0x2b')](_0x2c0340,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x192688){try{if(this['isNotNull'](_0x192688)){logger[_0x0da4('0x33')](_0x0da4('0x8e'),_0x192688['uniqueid'],util['inspect'](_0x192688,{'showHidden':![],'depth':null}));if(this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]]){if(this['channels'][this['blindTransfers'][_0x192688[_0x0da4('0x34')]]['linkedid']]){this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x31')]=_0x192688[_0x0da4('0x31')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688['linkedid']][_0x0da4('0x34')]][_0x0da4('0x63')]=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['answered'];this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x64')]=this['channels'][_0x192688[_0x0da4('0x31')]][_0x0da4('0x64')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x69')]=this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]]['linkedid']]['channel'];this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]][_0x0da4('0x47')]=this['channels'][_0x192688[_0x0da4('0x31')]][_0x0da4('0x47')];this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]=this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688['linkedid']][_0x0da4('0x34')]];this[_0x0da4('0x8f')](this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x34')]);}else if(this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]]){this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]]['uniqueid']=[this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688['linkedid']][_0x0da4('0x31')]][_0x0da4('0x34')],this['channels'][this['blindTransfers'][_0x192688['linkedid']]['uniqueid']][_0x0da4('0x34')]=this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]][_0x0da4('0x31')]][0x0];this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]][_0x0da4('0x63')]=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['answered'];this[_0x0da4('0x15')][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]]['uniqueid']]['answertime']=this['channels'][_0x192688['uniqueid']][_0x0da4('0x64')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688['linkedid']]['uniqueid']][_0x0da4('0x69')]=this['channels'][this[_0x0da4('0x17')][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]][_0x0da4('0x38')];this[_0x0da4('0x15')][this['blindTransfers'][_0x192688['linkedid']][_0x0da4('0x31')]]['disposition']=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x47')];this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]=this[_0x0da4('0x15')][this['blindTransfers'][_0x192688[_0x0da4('0x34')]][_0x0da4('0x31')]];this[_0x0da4('0x8f')](this[_0x0da4('0x17')][_0x192688['linkedid']][_0x0da4('0x31')]);}}if(this['channels'][_0x192688['uniqueid']]){logger['info'](_0x0da4('0x90'),_0x192688[_0x0da4('0x31')],_0x192688[_0x0da4('0x91')]);var _0x24359b=moment();this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x92')]=_0x24359b[_0x0da4('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x55')]=_0x24359b['diff'](this['channels'][_0x192688[_0x0da4('0x31')]]['starttime'],_0x0da4('0x56'));if(this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x63')]){this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['billableseconds']=_0x24359b['diff'](this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x64')],_0x0da4('0x56'));this['channels'][_0x192688[_0x0da4('0x31')]][_0x0da4('0x65')]=this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]][_0x0da4('0x55')]-this[_0x0da4('0x15')][_0x192688[_0x0da4('0x31')]]['billableseconds'];}if(_0x192688[_0x0da4('0x37')]===_0x0da4('0x6b')){if(this['agents'][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]]){this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]]=_[_0x0da4('0x93')](this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]],[_0x0da4('0x3c')]);logger[_0x0da4('0x33')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x192688['uniqueid'],util[_0x0da4('0x2b')]({'id':this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x192688['channel'][_0x0da4('0x39')]('-')[0x0]][_0x0da4('0x42')]},{'showHidden':![],'depth':null}));this[_0x0da4('0x2f')](util[_0x0da4('0x3e')](_0x0da4('0x3f'),this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')][_0x0da4('0x39')]('-')[0x0]][_0x0da4('0x40')]),'user:agentcomplete',{'id':this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x0da4('0x16')][_0x192688[_0x0da4('0x38')]['split']('-')[0x0]][_0x0da4('0x42')]});for(var _0x255e8a=0x0;_0x255e8a{delete this[_0x0da4('0x15')][_0x1f69af];},_0x444aff);}};module[_0x0da4('0xc2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 5efb529..1917315 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2707=['debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','channels','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','lastIndexOf','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','isUndefined','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','endtime','diff','starttime','seconds','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','ioredis','../../../config/logger','ami','redis','localhost','outboundChannels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2707,0x65));var _0x7270=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x2707[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x7270('0x0'));var moment=require(_0x7270('0x1'));var util=require('util');var Redis=require(_0x7270('0x2'));var config=require('../../../config/environment');var logger=require(_0x7270('0x3'))(_0x7270('0x4'));var ami=require('../ami');config[_0x7270('0x5')]=_['defaults'](config['redis'],{'host':_0x7270('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7270('0x5')]));function VoiceDialReport(_0xf4705e){this['channels']=_0xf4705e[_0x7270('0x7')];this[_0x7270('0x8')]=_0xf4705e[_0x7270('0x8')];this[_0x7270('0x9')]={};this[_0x7270('0xa')]={};ami['on']('dialbegin',this[_0x7270('0xb')][_0x7270('0xc')](this));ami['on'](_0x7270('0xd'),this[_0x7270('0xe')][_0x7270('0xc')](this));ami['on']('varset',this[_0x7270('0xf')]['bind'](this));ami['on'](_0x7270('0x10'),this[_0x7270('0x11')]['bind'](this));}VoiceDialReport[_0x7270('0x12')][_0x7270('0x13')]=function(_0x4b4742){return _0x4b4742!==null&&!_['isUndefined'](_0x4b4742);};VoiceDialReport['prototype'][_0x7270('0x14')]=function(_0x423afd,_0x1196af,_0x1a6973){io['to'](_0x423afd)[_0x7270('0x14')](_0x1196af,_0x1a6973);};VoiceDialReport[_0x7270('0x12')]['syncDialBegin']=function(_0x3f7cd7){try{if(this[_0x7270('0x13')](_0x3f7cd7)){logger[_0x7270('0x15')](_0x7270('0x16'),_0x3f7cd7[_0x7270('0x17')],util[_0x7270('0x18')](_0x3f7cd7,{'showHidden':![],'depth':null}));if(this['channels'][_0x3f7cd7[_0x7270('0x17')]]){_[_0x7270('0x19')](this[_0x7270('0x1a')][_0x3f7cd7[_0x7270('0x17')]],{'starttime':moment()['format'](_0x7270('0x1b')),'lastevent':_0x7270('0x1c'),'interface':_0x3f7cd7[_0x7270('0x1d')]['substring'](0x0,_0x3f7cd7[_0x7270('0x1d')]['lastIndexOf']('-')),'membername':_0x3f7cd7[_0x7270('0x1d')][_0x7270('0x1e')](_0x3f7cd7[_0x7270('0x1d')]['lastIndexOf']('/')+0x1,_0x3f7cd7[_0x7270('0x1d')]['lastIndexOf']('-'))},_['omit'](_0x3f7cd7,[_0x7270('0x1f'),_0x7270('0x20')]));logger[_0x7270('0x21')](_0x7270('0x22'),_0x3f7cd7['uniqueid'],this[_0x7270('0x1a')][_0x3f7cd7[_0x7270('0x17')]][_0x7270('0x23')],this[_0x7270('0x1a')][_0x3f7cd7[_0x7270('0x17')]]['interface']);logger[_0x7270('0x15')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3f7cd7[_0x7270('0x17')],util[_0x7270('0x18')](this['channels'][_0x3f7cd7[_0x7270('0x17')]],{'showHidden':![],'depth':null}));if(this[_0x7270('0x9')][_0x3f7cd7[_0x7270('0x17')]])_['merge'](this[_0x7270('0x1a')][_0x3f7cd7[_0x7270('0x17')]],this[_0x7270('0x9')][_0x3f7cd7[_0x7270('0x17')]]);this[_0x7270('0x14')](_0x7270('0x24'),_0x7270('0x25'),this[_0x7270('0x1a')][_0x3f7cd7[_0x7270('0x17')]]);logger[_0x7270('0x15')](_0x7270('0x26'),_0x3f7cd7['uniqueid'],util[_0x7270('0x18')](this[_0x7270('0x1a')][_0x3f7cd7['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7270('0x14')](_0x7270('0x27'),this[_0x7270('0x1a')][_0x3f7cd7[_0x7270('0x17')]]);}}}catch(_0x5e44a6){logger[_0x7270('0x28')](_0x7270('0x29'),_0x3f7cd7['uniqueid'],util[_0x7270('0x18')](_0x5e44a6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7270('0x12')][_0x7270('0xe')]=function(_0x45461a){try{if(this['isNotNull'](_0x45461a)){logger['debug'](_0x7270('0x2a'),_0x45461a[_0x7270('0x17')],util[_0x7270('0x18')](_0x45461a,{'showHidden':![],'depth':null}));if(this[_0x7270('0x1a')][_0x45461a['uniqueid']]){this[_0x7270('0x1a')][_0x45461a[_0x7270('0x17')]][_0x7270('0x2b')]=_0x45461a[_0x7270('0x2b')];if(_0x45461a[_0x7270('0x2b')]===_0x7270('0x2c')){this[_0x7270('0x1a')][_0x45461a[_0x7270('0x17')]][_0x7270('0x2d')]=_0x45461a[_0x7270('0x2d')];this[_0x7270('0x1a')][_0x45461a[_0x7270('0x17')]][_0x7270('0x2e')]=_0x45461a[_0x7270('0x2e')];this['channels'][_0x45461a['uniqueid']][_0x7270('0x2f')]=moment()[_0x7270('0x30')](_0x7270('0x1b'));this[_0x7270('0x1a')][_0x45461a['uniqueid']][_0x7270('0x31')]=_0x7270('0x32');logger[_0x7270('0x21')](_0x7270('0x33'),_0x45461a[_0x7270('0x17')],_0x45461a[_0x7270('0x1d')][_0x7270('0x1e')](_0x45461a[_0x7270('0x1d')]['lastIndexOf']('/')+0x1,_0x45461a[_0x7270('0x1d')][_0x7270('0x34')]('-')));logger['debug'](_0x7270('0x35'),_0x45461a[_0x7270('0x17')],util[_0x7270('0x18')](this['channels'][_0x45461a[_0x7270('0x17')]],{'showHidden':![],'depth':null}));ami[_0x7270('0x14')](_0x7270('0x36'),this[_0x7270('0x1a')][_0x45461a[_0x7270('0x17')]]);}logger['debug'](_0x7270('0x37'),_0x45461a[_0x7270('0x17')],util['inspect'](this[_0x7270('0x1a')][_0x45461a[_0x7270('0x17')]],{'showHidden':![],'depth':null}));this[_0x7270('0x14')]('voice:outbound',_0x7270('0x25'),this[_0x7270('0x1a')][_0x45461a[_0x7270('0x17')]]);}}}catch(_0x4d8b3f){logger['error'](_0x7270('0x38'),_0x45461a[_0x7270('0x17')],util[_0x7270('0x18')](_0x4d8b3f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7270('0x12')][_0x7270('0xf')]=function(_0x533cc6){try{if(this[_0x7270('0x13')](_0x533cc6)){logger[_0x7270('0x15')](_0x7270('0x39'),_0x533cc6['uniqueid'],util[_0x7270('0x18')](_0x533cc6,{'showHidden':![],'depth':null}));this[_0x7270('0x3a')](_0x533cc6['uniqueid'],_[_0x7270('0x3b')](_0x533cc6['variable'])[0x0],_0x533cc6[_0x7270('0x3c')]);if(this[_0x7270('0x13')](_0x533cc6[_0x7270('0x3d')])&&this[_0x7270('0x13')](_0x533cc6[_0x7270('0x3d')]['outboundrouteid'])){if(_[_0x7270('0x3e')](this[_0x7270('0x1a')][_0x533cc6[_0x7270('0x17')]])){this[_0x7270('0x1a')][_0x533cc6['uniqueid']]={'routeId':_0x533cc6[_0x7270('0x3c')],'variables':this[_0x7270('0xa')][_0x533cc6[_0x7270('0x17')]],'motionChannel':_0x7270('0x3f')};logger['info'](_0x7270('0x40'),_0x533cc6[_0x7270('0x17')],_0x533cc6[_0x7270('0x3d')][_0x7270('0x41')],_[_0x7270('0x3b')](_0x533cc6[_0x7270('0x3d')])[0x0],_0x533cc6['value']);logger[_0x7270('0x15')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x533cc6[_0x7270('0x17')],util[_0x7270('0x18')](this[_0x7270('0x1a')][_0x533cc6[_0x7270('0x17')]],{'showHidden':![],'depth':null}));this[_0x7270('0x14')](_0x7270('0x24'),_0x7270('0x25'),this['channels'][_0x533cc6['uniqueid']]);}}}}catch(_0x43960f){logger[_0x7270('0x28')](_0x7270('0x42'),_0x533cc6[_0x7270('0x17')],util['inspect'](_0x43960f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7270('0x3a')]=function(_0x14882e,_0x18dcc4,_0x2ce215){var _0x47db47=[_0x7270('0x43'),_0x7270('0x44'),_0x7270('0x45'),_0x7270('0x46'),_0x7270('0x47'),_0x7270('0x48'),_0x7270('0x49'),_0x7270('0x4a'),_0x7270('0x4b'),_0x7270('0x4c'),_0x7270('0x4d'),_0x7270('0x4e'),'membercalls','memberdynamic','memberinterface',_0x7270('0x4f'),_0x7270('0x23'),_0x7270('0x50'),_0x7270('0x51')];if(!_[_0x7270('0x52')](_0x18dcc4)&&!_[_0x7270('0x53')](_0x47db47,_0x18dcc4)){if(_[_0x7270('0x3e')](this[_0x7270('0xa')][_0x14882e])){this[_0x7270('0xa')][_0x14882e]={};}this[_0x7270('0xa')][_0x14882e][_0x18dcc4]=_0x2ce215;}};VoiceDialReport[_0x7270('0x12')][_0x7270('0x11')]=function(_0x347123){try{if(this[_0x7270('0x13')](_0x347123)){logger['debug'](_0x7270('0x54'),_0x347123[_0x7270('0x17')],util['inspect'](_0x347123,{'showHidden':![],'depth':null}));if(this['channels'][_0x347123['uniqueid']]){logger[_0x7270('0x21')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x347123[_0x7270('0x17')],_0x347123['cause-txt']);this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]][_0x7270('0x55')]=moment()[_0x7270('0x30')](_0x7270('0x1b'));this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]['duration']=moment(this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]['endtime'])[_0x7270('0x56')](this['channels'][_0x347123[_0x7270('0x17')]][_0x7270('0x57')],_0x7270('0x58'));this['channels'][_0x347123['uniqueid']]['lastevent']='complete';this[_0x7270('0x8')][_0x7270('0x59')]+=0x1;if(this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]][_0x7270('0x2f')]){this['outbound'][_0x7270('0x5a')]+=0x1;this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]][_0x7270('0x5b')]=moment(this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]][_0x7270('0x2f')])[_0x7270('0x56')](this[_0x7270('0x1a')][_0x347123['uniqueid']][_0x7270('0x57')],_0x7270('0x58'));this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]['billableseconds']=moment(this['channels'][_0x347123['uniqueid']][_0x7270('0x55')])[_0x7270('0x56')](this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]][_0x7270('0x2f')],_0x7270('0x58'));this[_0x7270('0x8')][_0x7270('0x5c')]+=this[_0x7270('0x1a')][_0x347123['uniqueid']][_0x7270('0x5b')]||0x0;this[_0x7270('0x8')][_0x7270('0x5d')]+=this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]][_0x7270('0x5e')];}this[_0x7270('0x8')][_0x7270('0x5f')]+=this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]['duration'];logger[_0x7270('0x15')](_0x7270('0x60'),_0x347123['uniqueid'],util[_0x7270('0x18')](this[_0x7270('0x1a')][_0x347123['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7270('0x14')](_0x7270('0x61'),this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]);logger[_0x7270('0x15')](_0x7270('0x62'),_0x347123[_0x7270('0x17')],util[_0x7270('0x18')](this['channels'][_0x347123[_0x7270('0x17')]],{'showHidden':![],'depth':null}));ami[_0x7270('0x14')](_0x7270('0x63'),this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]);logger[_0x7270('0x15')](_0x7270('0x64'),_0x347123['uniqueid'],util[_0x7270('0x18')](this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]],{'showHidden':![],'depth':null}));this[_0x7270('0x14')](_0x7270('0x24'),_0x7270('0x65'),this[_0x7270('0x8')]);logger[_0x7270('0x21')](_0x7270('0x66'),JSON[_0x7270('0x67')](this[_0x7270('0x1a')][_0x347123['uniqueid']]));logger['debug'](_0x7270('0x68'),_0x347123['uniqueid'],util[_0x7270('0x18')](this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]],{'showHidden':![],'depth':null}));this[_0x7270('0x14')]('voice:outbound',_0x7270('0x69'),this[_0x7270('0x1a')][_0x347123[_0x7270('0x17')]]);this[_0x7270('0x6a')](_0x347123['uniqueid']);}else if(this['channels'][_0x347123['linkedid']]){this[_0x7270('0x1a')][_0x347123[_0x7270('0x6b')]][_0x7270('0x17')]=this['channels'][_0x347123[_0x7270('0x6b')]][_0x7270('0x6c')];}if(this['variables'][_0x347123['uniqueid']]){delete this['variables'][_0x347123['uniqueid']];}}}catch(_0x16d178){logger[_0x7270('0x28')](_0x7270('0x6d'),_0x347123[_0x7270('0x17')],util['inspect'](_0x16d178,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x47635c){try{if(this['isNotNull'](_0x47635c)){logger[_0x7270('0x15')](_0x7270('0x6e'),_0x47635c['uniqueid'],util['inspect'](_0x47635c,{'showHidden':![],'depth':null}));if(_0x47635c[_0x7270('0x6f')]['toLowerCase']()===_0x7270('0x70')){_0x47635c[_0x7270('0x71')]=(_0x47635c[_0x7270('0x72')]||_0x47635c[_0x7270('0x71')])[_0x7270('0x73')]();if(_[_0x7270('0x74')](_0x47635c[_0x7270('0x71')],_0x7270('0x75'))){if(_[_0x7270('0x3e')](this[_0x7270('0x9')][_0x47635c[_0x7270('0x17')]]))this['applications'][_0x47635c['uniqueid']]={};logger[_0x7270('0x21')](_0x7270('0x76'),_0x47635c[_0x7270('0x17')],_0x47635c[_0x7270('0x6f')],_0x47635c['applicationdata']);var _0x5f2c1b=_0x47635c[_0x7270('0x71')][_0x7270('0x77')]('=');var _0x2da8fb=_0x5f2c1b[0x0][_0x7270('0x78')](/cdr\((.*)\)/);if(_0x2da8fb)this[_0x7270('0x9')][_0x47635c['uniqueid']][_0x2da8fb[0x1]]=_0x5f2c1b[0x1];}}}}catch(_0x4f5a59){logger[_0x7270('0x28')]('[%s][voiceDialReport][newexten]',_0x47635c[_0x7270('0x17')],util['inspect'](_0x4f5a59,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7270('0x12')][_0x7270('0x6a')]=function(_0x393c77,_0x445725=0x2710){if(this[_0x7270('0x1a')][_0x393c77]){setTimeout(()=>{delete this[_0x7270('0x1a')][_0x393c77];},_0x445725);}};module[_0x7270('0x79')]=VoiceDialReport; \ No newline at end of file +var _0x2080=['syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','keys','value','variable','outboundrouteid','variables','voice','voice_outbound_channel:save','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','complete','total','answertime','answered','starttime','seconds','sumHoldTime','holdtime','billableseconds','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','deleteChannelAfterTimeout','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd'];(function(_0x32ced1,_0x3dbc12){var _0x1b3cb=function(_0x24efb6){while(--_0x24efb6){_0x32ced1['push'](_0x32ced1['shift']());}};_0x1b3cb(++_0x3dbc12);}(_0x2080,0x1c6));var _0x0208=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x2080[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x0208('0x0'));var moment=require(_0x0208('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x0208('0x2'));var logger=require(_0x0208('0x3'))(_0x0208('0x4'));var ami=require(_0x0208('0x5'));config[_0x0208('0x6')]=_[_0x0208('0x7')](config[_0x0208('0x6')],{'host':_0x0208('0x8'),'port':0x18eb});var io=require(_0x0208('0x9'))(new Redis(config[_0x0208('0x6')]));function VoiceDialReport(_0x1e1dea){this[_0x0208('0xa')]=_0x1e1dea['outboundChannels'];this[_0x0208('0xb')]=_0x1e1dea[_0x0208('0xb')];this[_0x0208('0xc')]={};this['variables']={};ami['on'](_0x0208('0xd'),this[_0x0208('0xe')][_0x0208('0xf')](this));ami['on'](_0x0208('0x10'),this[_0x0208('0x11')]['bind'](this));ami['on']('varset',this[_0x0208('0x12')]['bind'](this));ami['on'](_0x0208('0x13'),this[_0x0208('0x14')][_0x0208('0xf')](this));}VoiceDialReport['prototype'][_0x0208('0x15')]=function(_0x5df728){return _0x5df728!==null&&!_[_0x0208('0x16')](_0x5df728);};VoiceDialReport[_0x0208('0x17')]['emit']=function(_0xc26fe9,_0x2d2e2b,_0x115d2b){io['to'](_0xc26fe9)[_0x0208('0x18')](_0x2d2e2b,_0x115d2b);};VoiceDialReport[_0x0208('0x17')][_0x0208('0xe')]=function(_0x410bba){try{if(this[_0x0208('0x15')](_0x410bba)){logger[_0x0208('0x19')](_0x0208('0x1a'),_0x410bba['uniqueid'],util['inspect'](_0x410bba,{'showHidden':![],'depth':null}));if(this['channels'][_0x410bba['uniqueid']]){_[_0x0208('0x1b')](this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]],{'starttime':moment()[_0x0208('0x1d')](_0x0208('0x1e')),'lastevent':'called','interface':_0x410bba[_0x0208('0x1f')][_0x0208('0x20')](0x0,_0x410bba[_0x0208('0x1f')][_0x0208('0x21')]('-')),'membername':_0x410bba['channel']['substring'](_0x410bba[_0x0208('0x1f')][_0x0208('0x21')]('/')+0x1,_0x410bba['channel'][_0x0208('0x21')]('-'))},_[_0x0208('0x22')](_0x410bba,[_0x0208('0x23'),_0x0208('0x24')]));logger['info'](_0x0208('0x25'),_0x410bba[_0x0208('0x1c')],this[_0x0208('0xa')][_0x410bba['uniqueid']]['membername'],this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]][_0x0208('0x26')]);logger[_0x0208('0x19')](_0x0208('0x27'),_0x410bba[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x410bba['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x0208('0xc')][_0x410bba['uniqueid']])_['merge'](this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]],this[_0x0208('0xc')][_0x410bba[_0x0208('0x1c')]]);this[_0x0208('0x18')]('voice:outbound','voice_outbound_channel:save',this[_0x0208('0xa')][_0x410bba['uniqueid']]);logger[_0x0208('0x19')](_0x0208('0x29'),_0x410bba[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x410bba[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')](_0x0208('0x2a'),this[_0x0208('0xa')][_0x410bba['uniqueid']]);}}}catch(_0x12ae5f){logger[_0x0208('0x2b')]('[%s][voiceDialReport][dialbegin]',_0x410bba[_0x0208('0x1c')],util['inspect'](_0x12ae5f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x11')]=function(_0x55a33b){try{if(this[_0x0208('0x15')](_0x55a33b)){logger['debug'](_0x0208('0x2c'),_0x55a33b['uniqueid'],util[_0x0208('0x28')](_0x55a33b,{'showHidden':![],'depth':null}));if(this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]){this['channels'][_0x55a33b['uniqueid']][_0x0208('0x2d')]=_0x55a33b[_0x0208('0x2d')];if(_0x55a33b[_0x0208('0x2d')]==='ANSWER'){this[_0x0208('0xa')][_0x55a33b['uniqueid']]['connectedlinenum']=_0x55a33b[_0x0208('0x2e')];this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]['connectedlinename']=_0x55a33b[_0x0208('0x2f')];this[_0x0208('0xa')][_0x55a33b['uniqueid']]['answertime']=moment()[_0x0208('0x1d')](_0x0208('0x1e'));this['channels'][_0x55a33b[_0x0208('0x1c')]][_0x0208('0x30')]=_0x0208('0x31');logger[_0x0208('0x32')](_0x0208('0x33'),_0x55a33b[_0x0208('0x1c')],_0x55a33b[_0x0208('0x1f')]['substring'](_0x55a33b['channel'][_0x0208('0x21')]('/')+0x1,_0x55a33b[_0x0208('0x1f')][_0x0208('0x21')]('-')));logger['debug'](_0x0208('0x34'),_0x55a33b[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x55a33b['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')](_0x0208('0x35'),this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]);}logger['debug'](_0x0208('0x36'),_0x55a33b[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x0208('0x37'),'voice_outbound_channel:save',this[_0x0208('0xa')][_0x55a33b[_0x0208('0x1c')]]);}}}catch(_0x1d335b){logger[_0x0208('0x2b')](_0x0208('0x38'),_0x55a33b[_0x0208('0x1c')],util[_0x0208('0x28')](_0x1d335b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x0208('0x12')]=function(_0x41948a){try{if(this[_0x0208('0x15')](_0x41948a)){logger[_0x0208('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x41948a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x41948a,{'showHidden':![],'depth':null}));this['addVariable'](_0x41948a['uniqueid'],_[_0x0208('0x39')](_0x41948a['variable'])[0x0],_0x41948a[_0x0208('0x3a')]);if(this[_0x0208('0x15')](_0x41948a[_0x0208('0x3b')])&&this['isNotNull'](_0x41948a[_0x0208('0x3b')][_0x0208('0x3c')])){if(_[_0x0208('0x16')](this[_0x0208('0xa')][_0x41948a[_0x0208('0x1c')]])){this[_0x0208('0xa')][_0x41948a[_0x0208('0x1c')]]={'routeId':_0x41948a[_0x0208('0x3a')],'variables':this[_0x0208('0x3d')][_0x41948a[_0x0208('0x1c')]],'motionChannel':_0x0208('0x3e')};logger[_0x0208('0x32')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x41948a['uniqueid'],_0x41948a['variable']['outboundrouteid'],_[_0x0208('0x39')](_0x41948a[_0x0208('0x3b')])[0x0],_0x41948a[_0x0208('0x3a')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x41948a[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x41948a[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this[_0x0208('0x18')](_0x0208('0x37'),_0x0208('0x3f'),this['channels'][_0x41948a['uniqueid']]);}}}}catch(_0x10fe2e){logger[_0x0208('0x2b')](_0x0208('0x40'),_0x41948a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x10fe2e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x41')]=function(_0x1f60bc,_0x27e52a,_0x5d2597){var _0x260f5d=[_0x0208('0x42'),_0x0208('0x43'),_0x0208('0x44'),'rtpaudioqosjitterbridged',_0x0208('0x45'),_0x0208('0x46'),_0x0208('0x47'),_0x0208('0x48'),'sipcallid','sipuri',_0x0208('0x49'),_0x0208('0x4a'),_0x0208('0x4b'),_0x0208('0x4c'),_0x0208('0x4d'),_0x0208('0x4e'),_0x0208('0x4f'),_0x0208('0x50'),_0x0208('0x51')];if(!_[_0x0208('0x52')](_0x27e52a)&&!_[_0x0208('0x53')](_0x260f5d,_0x27e52a)){if(_[_0x0208('0x16')](this['variables'][_0x1f60bc])){this['variables'][_0x1f60bc]={};}this[_0x0208('0x3d')][_0x1f60bc][_0x27e52a]=_0x5d2597;}};VoiceDialReport[_0x0208('0x17')]['syncHangup']=function(_0x54c2b2){try{if(this['isNotNull'](_0x54c2b2)){logger['debug'](_0x0208('0x54'),_0x54c2b2[_0x0208('0x1c')],util[_0x0208('0x28')](_0x54c2b2,{'showHidden':![],'depth':null}));if(this[_0x0208('0xa')][_0x54c2b2['uniqueid']]){logger[_0x0208('0x32')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x54c2b2['uniqueid'],_0x54c2b2[_0x0208('0x55')]);this[_0x0208('0xa')][_0x54c2b2['uniqueid']][_0x0208('0x56')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['duration']=moment(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['endtime'])[_0x0208('0x57')](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['starttime'],'seconds');this[_0x0208('0xa')][_0x54c2b2['uniqueid']][_0x0208('0x30')]=_0x0208('0x58');this[_0x0208('0xb')][_0x0208('0x59')]+=0x1;if(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5a')]){this[_0x0208('0xb')][_0x0208('0x5b')]+=0x1;this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['holdtime']=moment(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5a')])['diff'](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5c')],_0x0208('0x5d'));this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]['billableseconds']=moment(this['channels'][_0x54c2b2[_0x0208('0x1c')]]['endtime'])[_0x0208('0x57')](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5a')],_0x0208('0x5d'));this[_0x0208('0xb')][_0x0208('0x5e')]+=this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x5f')]||0x0;this['outbound']['sumBillable']+=this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]][_0x0208('0x60')];}this[_0x0208('0xb')][_0x0208('0x61')]+=this[_0x0208('0xa')][_0x54c2b2['uniqueid']][_0x0208('0x62')];logger['debug'](_0x0208('0x63'),_0x54c2b2[_0x0208('0x1c')],util['inspect'](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')]('custom:voiceDialReport',this['channels'][_0x54c2b2['uniqueid']]);logger[_0x0208('0x19')](_0x0208('0x64'),_0x54c2b2[_0x0208('0x1c')],util[_0x0208('0x28')](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x0208('0x18')](_0x0208('0x65'),this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]);logger[_0x0208('0x19')](_0x0208('0x66'),_0x54c2b2[_0x0208('0x1c')],util[_0x0208('0x28')](this['channels'][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this[_0x0208('0x18')](_0x0208('0x37'),'voice_outbound:save',this['outbound']);logger[_0x0208('0x32')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]));logger[_0x0208('0x19')](_0x0208('0x67'),_0x54c2b2['uniqueid'],util[_0x0208('0x28')](this['channels'][_0x54c2b2[_0x0208('0x1c')]],{'showHidden':![],'depth':null}));this[_0x0208('0x18')]('voice:outbound',_0x0208('0x68'),this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x1c')]]);this['deleteChannelAfterTimeout'](_0x54c2b2[_0x0208('0x1c')]);}else if(this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x69')]]){this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x69')]]['uniqueid']=this[_0x0208('0xa')][_0x54c2b2[_0x0208('0x69')]]['destuniqueid'];}if(this[_0x0208('0x3d')][_0x54c2b2[_0x0208('0x1c')]]){delete this[_0x0208('0x3d')][_0x54c2b2[_0x0208('0x1c')]];}}}catch(_0x363da7){logger['error']('[%s][voiceDialReport][hangup]',_0x54c2b2[_0x0208('0x1c')],util['inspect'](_0x363da7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x6a')]=function(_0x272d8a){try{if(this[_0x0208('0x15')](_0x272d8a)){logger[_0x0208('0x19')](_0x0208('0x6b'),_0x272d8a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x272d8a,{'showHidden':![],'depth':null}));if(_0x272d8a[_0x0208('0x6c')]['toLowerCase']()==='set'){_0x272d8a[_0x0208('0x6d')]=(_0x272d8a[_0x0208('0x6e')]||_0x272d8a['applicationdata'])['toLowerCase']();if(_[_0x0208('0x6f')](_0x272d8a[_0x0208('0x6d')],_0x0208('0x70'))){if(_['isUndefined'](this['applications'][_0x272d8a[_0x0208('0x1c')]]))this['applications'][_0x272d8a[_0x0208('0x1c')]]={};logger[_0x0208('0x32')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x272d8a[_0x0208('0x1c')],_0x272d8a[_0x0208('0x6c')],_0x272d8a[_0x0208('0x6d')]);var _0x3b2617=_0x272d8a[_0x0208('0x6d')][_0x0208('0x71')]('=');var _0x4d3e40=_0x3b2617[0x0][_0x0208('0x72')](/cdr\((.*)\)/);if(_0x4d3e40)this[_0x0208('0xc')][_0x272d8a[_0x0208('0x1c')]][_0x4d3e40[0x1]]=_0x3b2617[0x1];}}}}catch(_0x5c9086){logger['error'](_0x0208('0x73'),_0x272d8a[_0x0208('0x1c')],util[_0x0208('0x28')](_0x5c9086,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x0208('0x17')][_0x0208('0x74')]=function(_0xc85d0b,_0x5a6fd6=0x2710){if(this[_0x0208('0xa')][_0xc85d0b]){setTimeout(()=>{delete this[_0x0208('0xa')][_0xc85d0b];},_0x5a6fd6);}};module[_0x0208('0x75')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 34de8ad..6cb0709 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfab8=['custom:queuesummary','statusRequests','completeEvent','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','membername','queuecallerexitAt','transfer','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','reason','toUpperCase','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','variable','value','TIMEOUT','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','diff','ATTENDEDTRANSFER','queuecallerjoinAt','total','answered','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','cause','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../model/queueReport','../model/voiceQueueSummary','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','realtime','agents','channels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','hasOwnProperty','talking','pTalking','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','isNil','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','uniqueid','format','voice:queue:%s','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','catch','[voiceQueueReport][queues]','isRunning','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','compareToInboundQueue','assign','name','syncQueueStatusComplete','queuestatus','queue','handleInboundQueueSummaryReport','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfab8,0x171));var _0x8fab=function(_0x244d81,_0x66b49c){_0x244d81=_0x244d81-0x0;var _0x5a3dc7=_0xfab8[_0x244d81];return _0x5a3dc7;};'use strict';var _=require(_0x8fab('0x0'));var moment=require(_0x8fab('0x1'));var util=require(_0x8fab('0x2'));var Redis=require(_0x8fab('0x3'));var config=require(_0x8fab('0x4'));var logger=require('../../../config/logger')(_0x8fab('0x5'));var ami=require('../ami');var QueueReport=require(_0x8fab('0x6'));var VoiceQueueSummary=require(_0x8fab('0x7'));config['redis']=_['defaults'](config[_0x8fab('0x8')],{'host':_0x8fab('0x9'),'port':0x18eb});var io=require(_0x8fab('0xa'))(new Redis(config[_0x8fab('0x8')]));var Sequence=function(){};Sequence[_0x8fab('0xb')][_0x8fab('0xc')]=function(_0x110e7f){this['tail']=this[_0x8fab('0xd')]?this['tail']['finally'](_0x110e7f):_0x110e7f();};function VoiceQueueReport(_0xb5f564){this[_0x8fab('0xe')]=new Sequence();this[_0x8fab('0xf')]={};this[_0x8fab('0x10')]=_0xb5f564;this[_0x8fab('0x11')]=_0xb5f564[_0x8fab('0x11')];this[_0x8fab('0x12')]=_0xb5f564['queueChannels'];this[_0x8fab('0x13')]=_0xb5f564[_0x8fab('0x13')];this['campaigns']=_0xb5f564[_0x8fab('0x14')];this[_0x8fab('0x15')]=initializeSummary();this[_0x8fab('0x16')]={};ami['on'](_0x8fab('0x17'),this[_0x8fab('0x18')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x1a'),this[_0x8fab('0x1b')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x1c'),this[_0x8fab('0x1d')]['bind'](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));ami['on'](_0x8fab('0x1e'),this[_0x8fab('0x1f')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x20'),this[_0x8fab('0x21')]['bind'](this));ami['on']('queuecallerleave',this[_0x8fab('0x22')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x23'),this[_0x8fab('0x24')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x25'),this[_0x8fab('0x26')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x27'),this[_0x8fab('0x28')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x29'),this[_0x8fab('0x2a')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x2b'),this['syncFullyBooted'][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x2c'),this[_0x8fab('0x2d')]['bind'](this));ami['on'](_0x8fab('0x2e'),this[_0x8fab('0x2f')][_0x8fab('0x19')](this));ami['on'](_0x8fab('0x30'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x8fab('0x31'),this[_0x8fab('0x32')][_0x8fab('0x19')](this));this[_0x8fab('0x33')]();this[_0x8fab('0x34')]();}function clearChannels(_0x304b40){if(!_[_0x8fab('0x35')](_0x304b40)){for(var _0x1686d1 in _0x304b40){if(_0x304b40['hasOwnProperty'](_0x1686d1)){delete _0x304b40[_0x1686d1];}}}}function clearCampaigns(_0x35bf38){if(!_[_0x8fab('0x35')](_0x35bf38)){for(var _0x41c6e4 in _0x35bf38){if(_0x35bf38['hasOwnProperty'](_0x41c6e4)){_0x35bf38[_0x41c6e4][_0x8fab('0x36')]=0x0;}}}}function clearVoiceQueues(_0x3904ce){if(!_['isEmpty'](_0x3904ce)){for(var _0x5202e5 in _0x3904ce){if(_0x3904ce[_0x8fab('0x37')](_0x5202e5)){_0x3904ce[_0x5202e5][_0x8fab('0x36')]=0x0;_0x3904ce[_0x5202e5][_0x8fab('0x38')]=0x0;_0x3904ce[_0x5202e5][_0x8fab('0x39')]=0x0;_0x3904ce[_0x5202e5]['waiting']=0x0;_0x3904ce[_0x5202e5][_0x8fab('0x3a')]=!![];}}}}function clearAgentBooked(_0x15a5f0){if(!_[_0x8fab('0x35')](_0x15a5f0)){for(var _0x36919d in _0x15a5f0){if(_0x15a5f0[_0x8fab('0x37')](_0x36919d)){_0x15a5f0[_0x36919d][_0x8fab('0x3b')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x2a0a56){return _0x2a0a56[_0x8fab('0x3c')]||_0x2a0a56[_0x8fab('0x20')]||_0x2a0a56[_0x8fab('0x3d')];}VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x3e')]=function(){var _0x3d469f=this;for(var _0x420624 in this['channels']){if(this['channels'][_0x8fab('0x37')](_0x420624)&&!this[_0x8fab('0x12')][_0x420624][_0x8fab('0x3f')]){this[_0x8fab('0xe')][_0x8fab('0xc')](function(){if(!_[_0x8fab('0x40')](_0x3d469f[_0x8fab('0x12')][_0x420624])){return ami[_0x8fab('0x41')]({'action':_0x8fab('0x42'),'channel':_0x3d469f['channels'][_0x420624][_0x8fab('0x43')]})['catch'](function(_0x26de9e){if(_0x26de9e[_0x8fab('0x44')]===_0x8fab('0x45')){setTimeout(function(){if(_0x3d469f[_0x8fab('0x12')][_0x420624]){delete _0x3d469f[_0x8fab('0x12')][_0x420624];logger[_0x8fab('0x46')](_0x8fab('0x47'),_0x420624,util[_0x8fab('0x48')](_0x26de9e,{'showHidden':![],'depth':null}));}if(_0x3d469f[_0x8fab('0xf')][_0x420624]){delete _0x3d469f[_0x8fab('0xf')][_0x420624];logger[_0x8fab('0x46')](_0x8fab('0x49'),_0x420624,util[_0x8fab('0x48')](_0x26de9e,{'showHidden':![],'depth':null}));}if(_0x3d469f[_0x8fab('0x16')][_0x420624]){delete _0x3d469f[_0x8fab('0x16')][_0x420624];logger['error'](_0x8fab('0x4a'),_0x420624,util['inspect'](_0x26de9e,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x4b')]=function(){logger['error'](_0x8fab('0x4c'));clearChannels(this[_0x8fab('0x12')]);this[_0x8fab('0x4d')](this[_0x8fab('0xf')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x8fab('0x13')]);clearCampaigns(this[_0x8fab('0x14')]);this[_0x8fab('0x15')]=initializeSummary();};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x4d')]=function(_0x4180ee){var _0x33cfad=this;if(!_[_0x8fab('0x35')](_0x4180ee)){for(var _0xcaed44 in _0x4180ee){if(_0x4180ee['hasOwnProperty'](_0xcaed44)){_0x33cfad[_0x8fab('0x4e')](_0x4180ee[_0xcaed44],_0x8fab('0x4f'));delete _0x4180ee[_0xcaed44];}}}};VoiceQueueReport[_0x8fab('0xb')]['emit']=function(_0x8dbab7,_0x4ea831,_0x2beeba){io['to'](_0x8dbab7)[_0x8fab('0x50')](_0x4ea831,_0x2beeba);};VoiceQueueReport['prototype'][_0x8fab('0x51')]=function(_0x8c8df5,_0x15dff0){logger[_0x8fab('0x52')]('[%s][voiceQueueReport]['+_0x15dff0+']\x20sending\x20voice_queue_channel:save\x20event:',_0x8c8df5[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x8c8df5,{'showHidden':![],'depth':null}));this['emit'](util[_0x8fab('0x54')](_0x8fab('0x55'),_0x8c8df5['queue']),'voice_queue_channel:save',_0x8c8df5);io[_0x8fab('0x50')](_0x8fab('0x56'),_0x8c8df5);};VoiceQueueReport[_0x8fab('0xb')]['emitVoiceQueueChannelRemove']=function(_0x2d2f49,_0x3448cb){logger[_0x8fab('0x52')](_0x8fab('0x57')+_0x3448cb+_0x8fab('0x58'),_0x2d2f49[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x2d2f49,{'showHidden':![],'depth':null}));if(_0x2d2f49[_0x8fab('0x59')]==='ATTENDEDTRANSFER'){return;}this['emit'](util[_0x8fab('0x54')]('voice:queue:%s',_0x2d2f49['queue']),_0x8fab('0x5a'),_0x2d2f49);io[_0x8fab('0x50')](_0x8fab('0x5b'),_0x2d2f49);};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x5c')]=function(_0x52a2ea){if(_0x52a2ea[_0x8fab('0x5d')]===_0x8fab('0x5e')){logger[_0x8fab('0x52')](_0x8fab('0x5f'),util['inspect'](_0x52a2ea,{'showHidden':![],'depth':null}));this[_0x8fab('0x50')](util[_0x8fab('0x54')](_0x8fab('0x55'),_0x52a2ea['name']),_0x8fab('0x60'),_0x52a2ea);}};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x61')]=function(_0x278fb5){return _0x278fb5!==null&&!_[_0x8fab('0x62')](_0x278fb5);};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x34')]=function(){var _0x27087d=this;setInterval(function(){_0x27087d['clearZombieChannels']();ami[_0x8fab('0x41')]({'action':_0x8fab('0x63')})[_0x8fab('0x64')](function(_0x4856f4){logger[_0x8fab('0x46')](_0x8fab('0x65'),util[_0x8fab('0x48')](_0x4856f4,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x8fab('0xb')]['loopQueueSummary']=function(){var _0xd43d64=this;setInterval(function(){if(!_0xd43d64[_0x8fab('0x15')][_0x8fab('0x66')]){return ami[_0x8fab('0x41')]({'action':_0x8fab('0x17')})[_0x8fab('0x67')](function(_0x2613ce){_0xd43d64[_0x8fab('0x15')]['id']=_0x2613ce['actionid'];_0xd43d64[_0x8fab('0x15')][_0x8fab('0x66')]=!![];_0xd43d64[_0x8fab('0x15')]['queuestatus'][_0x2613ce[_0x8fab('0x68')]]={};})[_0x8fab('0x64')](function(_0x2a32dc){logger[_0x8fab('0x46')](_0x8fab('0x69'),util[_0x8fab('0x48')](_0x2a32dc,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x6a')]=function(_0x108d4c,_0x206b5b){var _0x5ed649;if(this[_0x8fab('0x15')]&&this['summary'][_0x8fab('0x63')]&&this['summary'][_0x8fab('0x63')][_0x108d4c['name']]){_0x5ed649=this['summary']['queues'][_0x108d4c['name']][_0x8fab('0x6b')];}var _0x3700a4=new VoiceQueueSummary(_0x108d4c);return _0x3700a4[_0x8fab('0x6c')](_0x206b5b[_0x8fab('0x11')],this['agents'],_0x5ed649,this['realtime'][_0x8fab('0x12')]);};VoiceQueueReport[_0x8fab('0xb')]['handleInboundQueueSummaryReport']=function(_0x5f1b04,_0x23283a){var _0x472af6=this[_0x8fab('0x6a')](_0x5f1b04,_0x23283a);var _0x3d7b91=![];_0x3d7b91=_0x472af6[_0x8fab('0x6d')](_0x5f1b04);if(_0x3d7b91){Object[_0x8fab('0x6e')](_0x5f1b04,_0x472af6);this[_0x8fab('0x10')]['voiceQueues'][_0x5f1b04[_0x8fab('0x6f')]]=_0x5f1b04;this[_0x8fab('0x5c')](_0x472af6);}};VoiceQueueReport['prototype'][_0x8fab('0x70')]=function(_0x1e4748){var _0x3597b3=null;var _0x205c73=this[_0x8fab('0x15')]['id'];if(this['summary'][_0x8fab('0x71')][_0x205c73]){_0x3597b3=this[_0x8fab('0x15')][_0x8fab('0x71')][_0x205c73][_0x1e4748[_0x8fab('0x68')]];}if(!_0x3597b3){this[_0x8fab('0x15')]=initializeSummary();return;}var _0x504a3b=this[_0x8fab('0x13')][_0x3597b3[_0x8fab('0x72')]];if(_0x504a3b['type']===_0x8fab('0x5e')){this[_0x8fab('0x73')](_0x504a3b,_0x3597b3);}else if(_0x504a3b[_0x8fab('0x5d')]===_0x8fab('0x74')){var _0x5b0ec7=this['createQueueSummaryReport'](_0x504a3b,_0x3597b3);ami['emit'](_0x8fab('0x75'),_0x5b0ec7);}this['summary'][_0x8fab('0x76')]-=0x1;var _0x35fb5e=this['summary'][_0x8fab('0x76')]>0x0?!![]:![];if(!_0x35fb5e){return this[_0x8fab('0x1b')](this[_0x8fab('0x15')][_0x8fab('0x77')]);}};VoiceQueueReport[_0x8fab('0xb')]['syncQueueMember']=function(_0xff1ff9){var _0x7d5be2=this[_0x8fab('0x15')]['id'];if(this[_0x8fab('0x15')][_0x8fab('0x71')][_0x7d5be2]&&this[_0x8fab('0x15')][_0x8fab('0x71')][_0x7d5be2][_0xff1ff9['actionid']]){this['summary']['queuestatus'][_0x7d5be2][_0xff1ff9[_0x8fab('0x68')]]['agents']['push'](_0xff1ff9);}};VoiceQueueReport[_0x8fab('0xb')]['syncQueueSummary']=function(_0x30afa3){var _0x2958ae=this;try{if(this[_0x8fab('0x61')](_0x30afa3)&&this['isNotNull'](_0x30afa3[_0x8fab('0x72')])){logger[_0x8fab('0x52')](_0x8fab('0x78'),util['inspect'](_0x30afa3,{'showHidden':![],'depth':null}));var _0x4ec1d4=this[_0x8fab('0x13')][_0x30afa3[_0x8fab('0x72')]];if(_0x4ec1d4){logger[_0x8fab('0x52')](_0x8fab('0x79'),_0x4ec1d4[_0x8fab('0x6f')]);this[_0x8fab('0x15')][_0x8fab('0x63')][_0x4ec1d4[_0x8fab('0x6f')]]={'summaryEvent':_0x30afa3};this[_0x8fab('0x15')][_0x8fab('0x76')]+=0x1;return ami[_0x8fab('0x41')]({'action':'queuestatus','queue':_0x4ec1d4[_0x8fab('0x6f')]})[_0x8fab('0x67')](function(_0x393481){if(!_0x2958ae[_0x8fab('0x15')][_0x8fab('0x71')][_0x30afa3[_0x8fab('0x68')]]){_0x2958ae['summary'][_0x8fab('0x71')][_0x30afa3[_0x8fab('0x68')]]={};}_0x2958ae[_0x8fab('0x15')]['queuestatus'][_0x30afa3[_0x8fab('0x68')]][_0x393481[_0x8fab('0x68')]]={'queue':_0x4ec1d4[_0x8fab('0x6f')],'agents':[]};})['catch'](function(_0x132d7a){throw _0x132d7a;});}}}catch(_0x519e2c){logger[_0x8fab('0x46')](_0x8fab('0x69'),util[_0x8fab('0x48')](_0x519e2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x1b')]=function(_0x1fa70c){if(this[_0x8fab('0x15')]['statusRequests']>0x0){this['summary'][_0x8fab('0x77')]=_0x1fa70c;return;}logger[_0x8fab('0x52')](_0x8fab('0x7a'),util[_0x8fab('0x48')](_0x1fa70c,{'showHidden':![],'depth':null}));this[_0x8fab('0x15')]=initializeSummary();ami[_0x8fab('0x50')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x1f')]=function(_0x467b9d){try{if(this['isNotNull'](_0x467b9d)){logger['debug'](_0x8fab('0x7b'),_0x467b9d['uniqueid'],util['inspect'](_0x467b9d,{'showHidden':![],'depth':null}));if(_[_0x8fab('0x62')](this[_0x8fab('0xf')][_0x467b9d[_0x8fab('0x53')]])){this[_0x8fab('0xf')][_0x467b9d[_0x8fab('0x53')]]=[];}if(_[_0x8fab('0x62')](this['channels'][_0x467b9d['uniqueid']])){this[_0x8fab('0x12')][_0x467b9d[_0x8fab('0x53')]]={};}var _0x5b5a44=new QueueReport();_0x5b5a44['queue']=_0x467b9d[_0x8fab('0x72')];_0x5b5a44[_0x8fab('0x5d')]=this[_0x8fab('0x13')][_0x5b5a44[_0x8fab('0x72')]]&&this[_0x8fab('0x13')][_0x5b5a44['queue']][_0x8fab('0x5d')]?this[_0x8fab('0x13')][_0x5b5a44[_0x8fab('0x72')]]['type']||_0x8fab('0x5e'):_0x8fab('0x5e');_0x5b5a44['queuecallerjoinAt']=moment()[_0x8fab('0x54')](_0x8fab('0x7c'));_0x5b5a44[_0x8fab('0x7d')]=_0x467b9d[_0x8fab('0x7d')];_0x5b5a44['count']=_0x467b9d[_0x8fab('0x7e')];_0x5b5a44['uniqueid']=_0x467b9d[_0x8fab('0x53')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x5b5a44[_0x8fab('0x72')],_0x5b5a44[_0x8fab('0x5d')]);Object[_0x8fab('0x6e')](_0x5b5a44,_[_0x8fab('0x7f')](_0x467b9d,_[_0x8fab('0x80')](_0x5b5a44)));this['queueReports'][_0x467b9d['uniqueid']][_0x8fab('0x81')](_0x5b5a44);this[_0x8fab('0x12')][_0x467b9d[_0x8fab('0x53')]]=_0x5b5a44;this[_0x8fab('0x51')](_0x5b5a44,_0x8fab('0x1e'));}}catch(_0x43966e){logger['error'](_0x8fab('0x7b'),_0x467b9d[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x43966e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8fab('0x21')]=function(_0x18a5d8){try{if(this[_0x8fab('0x61')](_0x18a5d8)){logger[_0x8fab('0x52')](_0x8fab('0x82'),_0x18a5d8[_0x8fab('0x53')],util['inspect'](_0x18a5d8,{'showHidden':![],'depth':null}));if(this[_0x8fab('0xf')][_0x18a5d8[_0x8fab('0x53')]]){var _0xe01c84=_[_0x8fab('0x83')](this[_0x8fab('0xf')][_0x18a5d8[_0x8fab('0x53')]]);_0xe01c84[_0x8fab('0x3d')]=![];_0xe01c84[_0x8fab('0x84')]=null;_0xe01c84[_0x8fab('0x85')]=_0x18a5d8['holdtime'];_0xe01c84[_0x8fab('0x86')]=_0x18a5d8[_0x8fab('0x86')];_0xe01c84[_0x8fab('0x20')]=!![];_0xe01c84[_0x8fab('0x87')]=moment()[_0x8fab('0x54')](_0x8fab('0x7c'));_0xe01c84['queuecallerexitreason']=_0x8fab('0x88');_0xe01c84[_0x8fab('0x89')]=null;logger[_0x8fab('0x8a')](_0x8fab('0x8b'),_0xe01c84[_0x8fab('0x72')],_0xe01c84['type']);this[_0x8fab('0x12')][_0x18a5d8[_0x8fab('0x53')]]=_0xe01c84;this['emitVoiceQueueChannelRemove'](_0xe01c84,_0x8fab('0x20'));}}}catch(_0x5dc5d4){logger[_0x8fab('0x46')](_0x8fab('0x82'),_0x18a5d8[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x5dc5d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x22')]=function(_0xf28579){try{if(this[_0x8fab('0x61')](_0xf28579)){logger['debug'](_0x8fab('0x8c'),_0xf28579[_0x8fab('0x53')],util[_0x8fab('0x48')](_0xf28579,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xf28579[_0x8fab('0x53')]]){var _0x24671b=_['last'](this[_0x8fab('0xf')][_0xf28579[_0x8fab('0x53')]]);_0x24671b['queuecallerleaveAt']=moment()[_0x8fab('0x54')](_0x8fab('0x7c'));_0x24671b[_0x8fab('0x8d')]=_0xf28579[_0x8fab('0x8d')];_0x24671b[_0x8fab('0x8e')]=_0xf28579[_0x8fab('0x8e')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x24671b[_0x8fab('0x72')],_0x24671b[_0x8fab('0x5d')],_0xf28579[_0x8fab('0x8d')],_0xf28579[_0x8fab('0x8e')]);this[_0x8fab('0x12')][_0xf28579[_0x8fab('0x53')]]=_0x24671b;this[_0x8fab('0x51')](_0x24671b,_0x8fab('0x8f'));}}}catch(_0x5ddfc7){logger[_0x8fab('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0xf28579[_0x8fab('0x53')],util['inspect'](_0x5ddfc7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8fab('0xb')]['syncAgentConnect']=function(_0x4ec2eb){try{if(this[_0x8fab('0x61')](_0x4ec2eb)){logger[_0x8fab('0x52')](_0x8fab('0x90'),_0x4ec2eb[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x4ec2eb,{'showHidden':![],'depth':null}));if(this[_0x8fab('0xf')][_0x4ec2eb[_0x8fab('0x53')]]){var _0x256b04=_['last'](this[_0x8fab('0xf')][_0x4ec2eb[_0x8fab('0x53')]]);_0x256b04[_0x8fab('0x3d')]=!![];_0x256b04[_0x8fab('0x59')]=_0x8fab('0x91');logger['info'](_0x8fab('0x92'),_0x256b04[_0x8fab('0x72')],_0x256b04[_0x8fab('0x5d')]);}}}catch(_0x38e82d){logger[_0x8fab('0x46')](_0x8fab('0x90'),_0x4ec2eb[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x38e82d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8fab('0xb')]['syncAgentComplete']=function(_0x70bb69){try{if(this[_0x8fab('0x61')](_0x70bb69)){logger[_0x8fab('0x52')]('[%s][voiceQueueReport][agentcomplete]',_0x70bb69[_0x8fab('0x53')],util[_0x8fab('0x48')](_0x70bb69,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x70bb69[_0x8fab('0x53')]]){var _0x561844=_[_0x8fab('0x83')](this['queueReports'][_0x70bb69[_0x8fab('0x53')]]);_0x561844['queuecallerabandon']=![];_0x561844[_0x8fab('0x87')]=null;_0x561844['assigned']=!![];_0x561844[_0x8fab('0x89')]=_0x70bb69[_0x8fab('0x93')];_0x561844[_0x8fab('0x85')]=_0x70bb69['holdtime'];_0x561844[_0x8fab('0x3d')]=!![];_0x561844[_0x8fab('0x3c')]=![];_0x561844[_0x8fab('0x94')]=null;if(!_0x561844[_0x8fab('0x95')]){if(_0x70bb69['reason']==_0x8fab('0x95')){_0x561844[_0x8fab('0x59')]=_0x8fab('0x96');logger[_0x8fab('0x8a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x561844['queue'],_0x561844[_0x8fab('0x5d')]);}else{if(_[_0x8fab('0x97')](_0x70bb69['channel'][_0x8fab('0x98')](),_0x8fab('0x99'))){if(this[_0x8fab('0xf')][_0x70bb69[_0x8fab('0x9a')]]){var _0x5e6548=_['last'](this[_0x8fab('0xf')][_0x70bb69[_0x8fab('0x9a')]]);_0x5e6548[_0x8fab('0x3d')]=![];_0x5e6548[_0x8fab('0x3c')]=!![];_0x5e6548[_0x8fab('0x94')]=moment(_0x561844['queuecallerjoinAt'])[_0x8fab('0x9b')](_0x70bb69[_0x8fab('0x85')],_0x8fab('0x9c'))[_0x8fab('0x54')](_0x8fab('0x7c'));_0x5e6548[_0x8fab('0x59')]=_0x8fab('0x9d');_0x5e6548['transfer']=!![];_0x5e6548[_0x8fab('0x9e')]='FORWARD';_0x5e6548[_0x8fab('0x9f')]=_0x70bb69[_0x8fab('0xa0')];_0x5e6548[_0x8fab('0xa1')]=_0x70bb69['uniqueid'];logger[_0x8fab('0x8a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x5e6548['queue'],_0x5e6548[_0x8fab('0x5d')]);var _0x1471b7=this[_0x8fab('0xf')][_0x70bb69['linkedid']];this[_0x8fab('0xf')][_0x70bb69[_0x8fab('0x9a')]]=this[_0x8fab('0xf')][_0x70bb69[_0x8fab('0x53')]];this[_0x8fab('0xf')][_0x70bb69[_0x8fab('0x53')]]=_0x1471b7;}}else{_0x561844[_0x8fab('0x59')]=_0x8fab('0xa2')+_0x70bb69[_0x8fab('0xa3')][_0x8fab('0xa4')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x561844[_0x8fab('0x72')],_0x561844[_0x8fab('0x5d')],_0x561844['queuecallerexitreason']);}}}this[_0x8fab('0x12')][_0x70bb69[_0x8fab('0x53')]]=_0x561844;}}}catch(_0x3d0d5d){logger[_0x8fab('0x46')](_0x8fab('0xa5'),_0x70bb69[_0x8fab('0x53')],util['inspect'](_0x3d0d5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0x28')]=function(_0x4f1456){try{if(this[_0x8fab('0x61')](_0x4f1456)){logger[_0x8fab('0x52')](_0x8fab('0xa6'),_0x4f1456['uniqueid'],util[_0x8fab('0x48')](_0x4f1456,{'showHidden':![],'depth':null}));this[_0x8fab('0xa7')](_0x4f1456[_0x8fab('0x53')],_[_0x8fab('0x80')](_0x4f1456[_0x8fab('0xa8')])[0x0],_0x4f1456[_0x8fab('0xa9')]);if(this[_0x8fab('0xf')][_0x4f1456[_0x8fab('0x53')]]){var _0x2774a0=_[_0x8fab('0x83')](this[_0x8fab('0xf')][_0x4f1456['uniqueid']]);if(_0x2774a0){if(this[_0x8fab('0x61')](_0x4f1456['variable'])&&this['isNotNull'](_0x4f1456['variable'][_0x8fab('0x71')])){switch(_0x4f1456[_0x8fab('0xa9')]){case'CONTINUE':_0x2774a0[_0x8fab('0x3c')]=![];_0x2774a0[_0x8fab('0x94')]=null;break;case _0x8fab('0xaa'):_0x2774a0[_0x8fab('0xab')]=_0x8fab('0xac');_0x2774a0['queuecallerexit']=!![];_0x2774a0[_0x8fab('0x94')]=moment()['format'](_0x8fab('0x7c'));_0x2774a0[_0x8fab('0xad')]=moment()['format'](_0x8fab('0x7c'));logger['debug'](_0x8fab('0xae'),_0x4f1456['uniqueid'],util[_0x8fab('0x48')](_0x2774a0,{'showHidden':![],'depth':null}));ami[_0x8fab('0x50')](_0x8fab('0xaf'),_0x2774a0);break;default:_0x2774a0['queuecallerexit']=!![];_0x2774a0[_0x8fab('0x94')]=moment()[_0x8fab('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x2774a0['queuecallerleaveAt']=moment()[_0x8fab('0x54')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2774a0[_0x8fab('0x20')]=![];_0x2774a0[_0x8fab('0x87')]=null;_0x2774a0[_0x8fab('0x59')]=_0x4f1456[_0x8fab('0xa9')];this['channels'][_0x4f1456[_0x8fab('0x53')]]=_0x2774a0;this['emitVoiceQueueChannelRemove'](_0x2774a0,_0x8fab('0x27'));}else if(this['isNotNull'](_0x4f1456[_0x8fab('0xa8')])&&this[_0x8fab('0x61')](_0x4f1456[_0x8fab('0xa8')]['queueposition'])){if(!_0x2774a0[_0x8fab('0x20')]){_0x2774a0[_0x8fab('0x3c')]=!![];_0x2774a0[_0x8fab('0x94')]=moment()['format'](_0x8fab('0x7c'));_0x2774a0[_0x8fab('0x59')]=_0x8fab('0xb0');_0x2774a0['queuecallerleaveAt']=moment()[_0x8fab('0x54')](_0x8fab('0x7c'));this[_0x8fab('0x12')][_0x4f1456[_0x8fab('0x53')]]=_0x2774a0;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4f1456[_0x8fab('0x53')],_0x2774a0[_0x8fab('0x72')],_0x2774a0[_0x8fab('0x5d')],_['keys'](_0x4f1456['variable'])[0x0],_0x4f1456[_0x8fab('0xa9')]);_0x2774a0[_0x8fab('0x16')]=this[_0x8fab('0x16')][_0x4f1456[_0x8fab('0x53')]];}}}}catch(_0x3e51f2){logger['error'](_0x8fab('0xa6'),_0x4f1456['uniqueid'],util[_0x8fab('0x48')](_0x3e51f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8fab('0xa7')]=function(_0x267ec5,_0x592ba3,_0x464b02){var _0x39f3c8=[_0x8fab('0xb1'),'rtpaudioqosbridged',_0x8fab('0xb2'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x8fab('0xb3'),_0x8fab('0xb4'),'rtpaudioqosrttbridged','sipcallid',_0x8fab('0xb5'),_0x8fab('0xb6'),_0x8fab('0xb7'),'membercalls','memberdynamic',_0x8fab('0xb8'),_0x8fab('0xb9'),'membername',_0x8fab('0xba'),_0x8fab('0xbb')];if(!_[_0x8fab('0x40')](_0x592ba3)&&!_['includes'](_0x39f3c8,_0x592ba3)){if(_[_0x8fab('0x62')](this[_0x8fab('0x16')][_0x267ec5])){this[_0x8fab('0x16')][_0x267ec5]={};}this[_0x8fab('0x16')][_0x267ec5][_0x592ba3]=_0x464b02;}};VoiceQueueReport[_0x8fab('0xb')][_0x8fab('0xbc')]=function(_0x2c4700,_0x23a079,_0x4ff5c4){try{var _0x3aa43f={};if(this[_0x8fab('0xf')][_0x2c4700]){for(var _0xad957d=0x0;_0xad957d{delete this[_0x8fab('0x12')][_0x146f97];},_0x3b8612);}};module[_0x8fab('0xf2')]=VoiceQueueReport; \ No newline at end of file +var _0xe1d8=['queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','keys','value','variable','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queuecallerleaveAt','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','handleHangup','length','diff','total','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','assign','custom:voiceQueueReport','deleteChannelAfterTimeout','syncHangup','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','toLowerCase','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','ioredis','../../../config/environment','ami','../ami','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','queuecallerabandon','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','format','voice:queue:%s','queue','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','queues','isRunning','then','summary','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','handleInboundQueueSummaryReport','compareToInboundQueue','type','outbound','custom:queuesummary','statusRequests','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexit'];(function(_0x68da0b,_0x470a6a){var _0x2671a4=function(_0x5975f1){while(--_0x5975f1){_0x68da0b['push'](_0x68da0b['shift']());}};_0x2671a4(++_0x470a6a);}(_0xe1d8,0x71));var _0x8e1d=function(_0x438e21,_0x340aad){_0x438e21=_0x438e21-0x0;var _0xd8845d=_0xe1d8[_0x438e21];return _0xd8845d;};'use strict';var _=require(_0x8e1d('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x8e1d('0x1'));var config=require(_0x8e1d('0x2'));var logger=require('../../../config/logger')(_0x8e1d('0x3'));var ami=require(_0x8e1d('0x4'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x8e1d('0x5'));config[_0x8e1d('0x6')]=_[_0x8e1d('0x7')](config[_0x8e1d('0x6')],{'host':_0x8e1d('0x8'),'port':0x18eb});var io=require(_0x8e1d('0x9'))(new Redis(config[_0x8e1d('0x6')]));var Sequence=function(){};Sequence[_0x8e1d('0xa')][_0x8e1d('0xb')]=function(_0x8ecd04){this['tail']=this[_0x8e1d('0xc')]?this[_0x8e1d('0xc')][_0x8e1d('0xd')](_0x8ecd04):_0x8ecd04();};function VoiceQueueReport(_0x5d24c2){this[_0x8e1d('0xe')]=new Sequence();this[_0x8e1d('0xf')]={};this[_0x8e1d('0x10')]=_0x5d24c2;this[_0x8e1d('0x11')]=_0x5d24c2[_0x8e1d('0x11')];this['channels']=_0x5d24c2[_0x8e1d('0x12')];this[_0x8e1d('0x13')]=_0x5d24c2[_0x8e1d('0x13')];this['campaigns']=_0x5d24c2[_0x8e1d('0x14')];this['summary']=initializeSummary();this[_0x8e1d('0x15')]={};ami['on']('queuesummary',this[_0x8e1d('0x16')][_0x8e1d('0x17')](this));ami['on']('queuesummarycomplete',this[_0x8e1d('0x18')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x19'),this[_0x8e1d('0x1a')][_0x8e1d('0x17')](this));ami['on']('queuestatuscomplete',this[_0x8e1d('0x1b')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x1c'),this[_0x8e1d('0x1d')][_0x8e1d('0x17')](this));ami['on']('queuecallerabandon',this[_0x8e1d('0x1e')][_0x8e1d('0x17')](this));ami['on']('queuecallerleave',this[_0x8e1d('0x1f')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x20'),this[_0x8e1d('0x21')]['bind'](this));ami['on'](_0x8e1d('0x22'),this[_0x8e1d('0x23')][_0x8e1d('0x17')](this));ami['on']('varset',this[_0x8e1d('0x24')]['bind'](this));ami['on'](_0x8e1d('0x25'),this['syncHangup']['bind'](this));ami['on'](_0x8e1d('0x26'),this[_0x8e1d('0x27')][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x28'),this[_0x8e1d('0x29')][_0x8e1d('0x17')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x8e1d('0x17')](this));ami['on'](_0x8e1d('0x2a'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0x8e1d('0x2b')]();this[_0x8e1d('0x2c')]();}function clearChannels(_0x1947c0){if(!_[_0x8e1d('0x2d')](_0x1947c0)){for(var _0x1e6833 in _0x1947c0){if(_0x1947c0[_0x8e1d('0x2e')](_0x1e6833)){delete _0x1947c0[_0x1e6833];}}}}function clearCampaigns(_0x313e6b){if(!_['isEmpty'](_0x313e6b)){for(var _0x56a984 in _0x313e6b){if(_0x313e6b[_0x8e1d('0x2e')](_0x56a984)){_0x313e6b[_0x56a984][_0x8e1d('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x5918f0){if(!_['isEmpty'](_0x5918f0)){for(var _0x522beb in _0x5918f0){if(_0x5918f0[_0x8e1d('0x2e')](_0x522beb)){_0x5918f0[_0x522beb][_0x8e1d('0x2f')]=0x0;_0x5918f0[_0x522beb]['talking']=0x0;_0x5918f0[_0x522beb][_0x8e1d('0x30')]=0x0;_0x5918f0[_0x522beb][_0x8e1d('0x31')]=0x0;_0x5918f0[_0x522beb][_0x8e1d('0x32')]=!![];}}}}function clearAgentBooked(_0x4e8f24){if(!_[_0x8e1d('0x2d')](_0x4e8f24)){for(var _0x16d585 in _0x4e8f24){if(_0x4e8f24[_0x8e1d('0x2e')](_0x16d585)){_0x4e8f24[_0x16d585]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x26d391){return _0x26d391['queuecallerexit']||_0x26d391[_0x8e1d('0x33')]||_0x26d391[_0x8e1d('0x34')];}VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x35')]=function(){var _0xff1299=this;for(var _0x4b93f1 in this[_0x8e1d('0x36')]){if(this[_0x8e1d('0x36')][_0x8e1d('0x2e')](_0x4b93f1)&&!this[_0x8e1d('0x36')][_0x4b93f1][_0x8e1d('0x37')]){this['sequence']['enqueue'](function(){if(!_[_0x8e1d('0x38')](_0xff1299[_0x8e1d('0x36')][_0x4b93f1])){return ami[_0x8e1d('0x39')]({'action':_0x8e1d('0x3a'),'channel':_0xff1299[_0x8e1d('0x36')][_0x4b93f1][_0x8e1d('0x3b')]})[_0x8e1d('0x3c')](function(_0x4c3f8a){if(_0x4c3f8a[_0x8e1d('0x3d')]===_0x8e1d('0x3e')){setTimeout(function(){if(_0xff1299[_0x8e1d('0x36')][_0x4b93f1]){delete _0xff1299[_0x8e1d('0x36')][_0x4b93f1];logger[_0x8e1d('0x3f')](_0x8e1d('0x40'),_0x4b93f1,util[_0x8e1d('0x41')](_0x4c3f8a,{'showHidden':![],'depth':null}));}if(_0xff1299[_0x8e1d('0xf')][_0x4b93f1]){delete _0xff1299[_0x8e1d('0xf')][_0x4b93f1];logger[_0x8e1d('0x3f')](_0x8e1d('0x42'),_0x4b93f1,util[_0x8e1d('0x41')](_0x4c3f8a,{'showHidden':![],'depth':null}));}if(_0xff1299[_0x8e1d('0x15')][_0x4b93f1]){delete _0xff1299[_0x8e1d('0x15')][_0x4b93f1];logger[_0x8e1d('0x3f')](_0x8e1d('0x43'),_0x4b93f1,util[_0x8e1d('0x41')](_0x4c3f8a,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x8e1d('0xa')]['syncFullyBooted']=function(){logger[_0x8e1d('0x3f')](_0x8e1d('0x44'));clearChannels(this['channels']);this[_0x8e1d('0x45')](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x8e1d('0x13')]);clearCampaigns(this[_0x8e1d('0x14')]);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0x8e1d('0x45')]=function(_0x27c946){var _0x4f58c2=this;if(!_[_0x8e1d('0x2d')](_0x27c946)){for(var _0x383ae3 in _0x27c946){if(_0x27c946[_0x8e1d('0x2e')](_0x383ae3)){_0x4f58c2[_0x8e1d('0x46')](_0x27c946[_0x383ae3],_0x8e1d('0x47'));delete _0x27c946[_0x383ae3];}}}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x48')]=function(_0xd8db3c,_0x4323f6,_0x495e4e){io['to'](_0xd8db3c)[_0x8e1d('0x48')](_0x4323f6,_0x495e4e);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x4e1c2a,_0x4d0106){logger['debug']('[%s][voiceQueueReport]['+_0x4d0106+']\x20sending\x20voice_queue_channel:save\x20event:',_0x4e1c2a['uniqueid'],util['inspect'](_0x4e1c2a,{'showHidden':![],'depth':null}));this[_0x8e1d('0x48')](util[_0x8e1d('0x49')](_0x8e1d('0x4a'),_0x4e1c2a[_0x8e1d('0x4b')]),'voice_queue_channel:save',_0x4e1c2a);io[_0x8e1d('0x48')](_0x8e1d('0x4c'),_0x4e1c2a);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x46')]=function(_0x583931,_0x392786){logger[_0x8e1d('0x4d')]('[%s][voiceQueueReport]['+_0x392786+_0x8e1d('0x4e'),_0x583931[_0x8e1d('0x4f')],util['inspect'](_0x583931,{'showHidden':![],'depth':null}));if(_0x583931[_0x8e1d('0x50')]===_0x8e1d('0x51')){return;}this[_0x8e1d('0x48')](util[_0x8e1d('0x49')](_0x8e1d('0x4a'),_0x583931[_0x8e1d('0x4b')]),_0x8e1d('0x52'),_0x583931);io[_0x8e1d('0x48')]('voice_queue_presence:remove',_0x583931);};VoiceQueueReport['prototype'][_0x8e1d('0x53')]=function(_0x431c5a){if(_0x431c5a['type']===_0x8e1d('0x54')){logger[_0x8e1d('0x4d')](_0x8e1d('0x55'),util[_0x8e1d('0x41')](_0x431c5a,{'showHidden':![],'depth':null}));this['emit'](util[_0x8e1d('0x49')](_0x8e1d('0x4a'),_0x431c5a[_0x8e1d('0x56')]),_0x8e1d('0x57'),_0x431c5a);}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x58')]=function(_0x46a373){return _0x46a373!==null&&!_[_0x8e1d('0x59')](_0x46a373);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x2c')]=function(){var _0x323d81=this;setInterval(function(){_0x323d81['clearZombieChannels']();ami[_0x8e1d('0x39')]({'action':_0x8e1d('0x5a')})[_0x8e1d('0x3c')](function(_0x1580c9){logger[_0x8e1d('0x3f')]('[voiceQueueReport][queues]',util[_0x8e1d('0x41')](_0x1580c9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x8e1d('0xa')]['loopQueueSummary']=function(){var _0x91b4a=this;setInterval(function(){if(!_0x91b4a['summary'][_0x8e1d('0x5b')]){return ami[_0x8e1d('0x39')]({'action':'queuesummary'})[_0x8e1d('0x5c')](function(_0x2cb955){_0x91b4a[_0x8e1d('0x5d')]['id']=_0x2cb955[_0x8e1d('0x5e')];_0x91b4a[_0x8e1d('0x5d')]['isRunning']=!![];_0x91b4a[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x2cb955[_0x8e1d('0x5e')]]={};})['catch'](function(_0x170478){logger[_0x8e1d('0x3f')](_0x8e1d('0x60'),util[_0x8e1d('0x41')](_0x170478,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x61')]=function(_0x2177de,_0x5ea955){var _0x3de98c;if(this[_0x8e1d('0x5d')]&&this[_0x8e1d('0x5d')][_0x8e1d('0x5a')]&&this[_0x8e1d('0x5d')][_0x8e1d('0x5a')][_0x2177de[_0x8e1d('0x56')]]){_0x3de98c=this[_0x8e1d('0x5d')]['queues'][_0x2177de[_0x8e1d('0x56')]][_0x8e1d('0x62')];}var _0x197e86=new VoiceQueueSummary(_0x2177de);return _0x197e86['createReport'](_0x5ea955[_0x8e1d('0x11')],this[_0x8e1d('0x11')],_0x3de98c,this[_0x8e1d('0x10')][_0x8e1d('0x36')]);};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x63')]=function(_0xa5d1f2,_0x2149cc){var _0x34f00b=this[_0x8e1d('0x61')](_0xa5d1f2,_0x2149cc);var _0x4b46db=![];_0x4b46db=_0x34f00b[_0x8e1d('0x64')](_0xa5d1f2);if(_0x4b46db){Object['assign'](_0xa5d1f2,_0x34f00b);this[_0x8e1d('0x10')][_0x8e1d('0x13')][_0xa5d1f2[_0x8e1d('0x56')]]=_0xa5d1f2;this['emitInboundVoiceQueueSummary'](_0x34f00b);}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1b')]=function(_0xf66e8e){var _0x447dc1=null;var _0x2d89a0=this[_0x8e1d('0x5d')]['id'];if(this[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x2d89a0]){_0x447dc1=this['summary']['queuestatus'][_0x2d89a0][_0xf66e8e[_0x8e1d('0x5e')]];}if(!_0x447dc1){this['summary']=initializeSummary();return;}var _0xd41517=this[_0x8e1d('0x13')][_0x447dc1[_0x8e1d('0x4b')]];if(_0xd41517[_0x8e1d('0x65')]===_0x8e1d('0x54')){this['handleInboundQueueSummaryReport'](_0xd41517,_0x447dc1);}else if(_0xd41517[_0x8e1d('0x65')]===_0x8e1d('0x66')){var _0x39c0a7=this[_0x8e1d('0x61')](_0xd41517,_0x447dc1);ami[_0x8e1d('0x48')](_0x8e1d('0x67'),_0x39c0a7);}this[_0x8e1d('0x5d')][_0x8e1d('0x68')]-=0x1;var _0x1f8511=this[_0x8e1d('0x5d')]['statusRequests']>0x0?!![]:![];if(!_0x1f8511){return this[_0x8e1d('0x18')](this[_0x8e1d('0x5d')]['completeEvent']);}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1a')]=function(_0x483941){var _0xd9c01a=this['summary']['id'];if(this[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0xd9c01a]&&this[_0x8e1d('0x5d')]['queuestatus'][_0xd9c01a][_0x483941[_0x8e1d('0x5e')]]){this[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0xd9c01a][_0x483941[_0x8e1d('0x5e')]][_0x8e1d('0x11')]['push'](_0x483941);}};VoiceQueueReport[_0x8e1d('0xa')]['syncQueueSummary']=function(_0x6e8c1a){var _0x12be76=this;try{if(this[_0x8e1d('0x58')](_0x6e8c1a)&&this[_0x8e1d('0x58')](_0x6e8c1a['queue'])){logger['debug'](_0x8e1d('0x69'),util[_0x8e1d('0x41')](_0x6e8c1a,{'showHidden':![],'depth':null}));var _0x28f04b=this[_0x8e1d('0x13')][_0x6e8c1a[_0x8e1d('0x4b')]];if(_0x28f04b){logger['debug'](_0x8e1d('0x6a'),_0x28f04b[_0x8e1d('0x56')]);this[_0x8e1d('0x5d')][_0x8e1d('0x5a')][_0x28f04b['name']]={'summaryEvent':_0x6e8c1a};this[_0x8e1d('0x5d')][_0x8e1d('0x68')]+=0x1;return ami[_0x8e1d('0x39')]({'action':_0x8e1d('0x5f'),'queue':_0x28f04b[_0x8e1d('0x56')]})['then'](function(_0x4323aa){if(!_0x12be76[_0x8e1d('0x5d')]['queuestatus'][_0x6e8c1a[_0x8e1d('0x5e')]]){_0x12be76[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x6e8c1a[_0x8e1d('0x5e')]]={};}_0x12be76[_0x8e1d('0x5d')][_0x8e1d('0x5f')][_0x6e8c1a[_0x8e1d('0x5e')]][_0x4323aa[_0x8e1d('0x5e')]]={'queue':_0x28f04b[_0x8e1d('0x56')],'agents':[]};})[_0x8e1d('0x3c')](function(_0x4039b7){throw _0x4039b7;});}}}catch(_0x5dcf20){logger[_0x8e1d('0x3f')](_0x8e1d('0x60'),util[_0x8e1d('0x41')](_0x5dcf20,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x18')]=function(_0x4b88db){if(this['summary'][_0x8e1d('0x68')]>0x0){this[_0x8e1d('0x5d')]['completeEvent']=_0x4b88db;return;}logger[_0x8e1d('0x4d')](_0x8e1d('0x6b'),util[_0x8e1d('0x41')](_0x4b88db,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0x8e1d('0x6c'),{});};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1d')]=function(_0x2a2a7b){try{if(this['isNotNull'](_0x2a2a7b)){logger[_0x8e1d('0x4d')](_0x8e1d('0x6d'),_0x2a2a7b['uniqueid'],util[_0x8e1d('0x41')](_0x2a2a7b,{'showHidden':![],'depth':null}));if(_[_0x8e1d('0x59')](this[_0x8e1d('0xf')][_0x2a2a7b['uniqueid']])){this[_0x8e1d('0xf')][_0x2a2a7b[_0x8e1d('0x4f')]]=[];}if(_[_0x8e1d('0x59')](this['channels'][_0x2a2a7b[_0x8e1d('0x4f')]])){this[_0x8e1d('0x36')][_0x2a2a7b['uniqueid']]={};}var _0x3f4e75=new QueueReport();_0x3f4e75['queue']=_0x2a2a7b['queue'];_0x3f4e75[_0x8e1d('0x65')]=this[_0x8e1d('0x13')][_0x3f4e75[_0x8e1d('0x4b')]]&&this['voiceQueues'][_0x3f4e75[_0x8e1d('0x4b')]]['type']?this[_0x8e1d('0x13')][_0x3f4e75[_0x8e1d('0x4b')]][_0x8e1d('0x65')]||'inbound':_0x8e1d('0x54');_0x3f4e75[_0x8e1d('0x6e')]=moment()['format'](_0x8e1d('0x6f'));_0x3f4e75[_0x8e1d('0x70')]=_0x2a2a7b['position'];_0x3f4e75[_0x8e1d('0x71')]=_0x2a2a7b[_0x8e1d('0x71')];_0x3f4e75['uniqueid']=_0x2a2a7b[_0x8e1d('0x4f')];logger[_0x8e1d('0x72')](_0x8e1d('0x73'),_0x3f4e75[_0x8e1d('0x4b')],_0x3f4e75[_0x8e1d('0x65')]);Object['assign'](_0x3f4e75,_['pick'](_0x2a2a7b,_['keys'](_0x3f4e75)));this[_0x8e1d('0xf')][_0x2a2a7b[_0x8e1d('0x4f')]][_0x8e1d('0x74')](_0x3f4e75);this['channels'][_0x2a2a7b['uniqueid']]=_0x3f4e75;this[_0x8e1d('0x75')](_0x3f4e75,_0x8e1d('0x1c'));}}catch(_0x187f7c){logger[_0x8e1d('0x3f')](_0x8e1d('0x6d'),_0x2a2a7b[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x187f7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1e')]=function(_0x31b790){try{if(this[_0x8e1d('0x58')](_0x31b790)){logger[_0x8e1d('0x4d')](_0x8e1d('0x76'),_0x31b790[_0x8e1d('0x4f')],util['inspect'](_0x31b790,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0x31b790[_0x8e1d('0x4f')]]){var _0x333075=_[_0x8e1d('0x77')](this['queueReports'][_0x31b790[_0x8e1d('0x4f')]]);_0x333075[_0x8e1d('0x34')]=![];_0x333075[_0x8e1d('0x78')]=null;_0x333075[_0x8e1d('0x79')]=_0x31b790[_0x8e1d('0x79')];_0x333075[_0x8e1d('0x7a')]=_0x31b790[_0x8e1d('0x7a')];_0x333075['queuecallerabandon']=!![];_0x333075[_0x8e1d('0x7b')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x333075[_0x8e1d('0x50')]=_0x8e1d('0x7c');_0x333075['lastAssignedTo']=null;logger['info'](_0x8e1d('0x7d'),_0x333075[_0x8e1d('0x4b')],_0x333075[_0x8e1d('0x65')]);this[_0x8e1d('0x36')][_0x31b790[_0x8e1d('0x4f')]]=_0x333075;this[_0x8e1d('0x46')](_0x333075,_0x8e1d('0x33'));}}}catch(_0x9a7e49){logger[_0x8e1d('0x3f')](_0x8e1d('0x76'),_0x31b790[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x9a7e49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x1f')]=function(_0xc06701){try{if(this['isNotNull'](_0xc06701)){logger['debug'](_0x8e1d('0x7e'),_0xc06701[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0xc06701,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0xc06701[_0x8e1d('0x4f')]]){var _0x32ab27=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0xc06701['uniqueid']]);_0x32ab27['queuecallerleaveAt']=moment()[_0x8e1d('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x32ab27[_0x8e1d('0x7f')]=_0xc06701[_0x8e1d('0x7f')];_0x32ab27[_0x8e1d('0x80')]=_0xc06701[_0x8e1d('0x80')];logger[_0x8e1d('0x72')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x32ab27['queue'],_0x32ab27[_0x8e1d('0x65')],_0xc06701[_0x8e1d('0x7f')],_0xc06701['connectedlinename']);this[_0x8e1d('0x36')][_0xc06701[_0x8e1d('0x4f')]]=_0x32ab27;this[_0x8e1d('0x75')](_0x32ab27,_0x8e1d('0x81'));}}}catch(_0x38822b){logger[_0x8e1d('0x3f')](_0x8e1d('0x7e'),_0xc06701['uniqueid'],util[_0x8e1d('0x41')](_0x38822b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')]['syncAgentConnect']=function(_0x447a31){try{if(this['isNotNull'](_0x447a31)){logger[_0x8e1d('0x4d')](_0x8e1d('0x82'),_0x447a31[_0x8e1d('0x4f')],util['inspect'](_0x447a31,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0x447a31[_0x8e1d('0x4f')]]){var _0xf58193=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0x447a31[_0x8e1d('0x4f')]]);_0xf58193[_0x8e1d('0x34')]=!![];_0xf58193[_0x8e1d('0x50')]=_0x8e1d('0x83');logger[_0x8e1d('0x72')](_0x8e1d('0x84'),_0xf58193['queue'],_0xf58193[_0x8e1d('0x65')]);}}}catch(_0xc11ed0){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x447a31[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0xc11ed0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0x21')]=function(_0xfb528a){try{if(this[_0x8e1d('0x58')](_0xfb528a)){logger[_0x8e1d('0x4d')](_0x8e1d('0x85'),_0xfb528a[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0xfb528a,{'showHidden':![],'depth':null}));if(this[_0x8e1d('0xf')][_0xfb528a['uniqueid']]){var _0x1efa04=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x4f')]]);_0x1efa04[_0x8e1d('0x33')]=![];_0x1efa04[_0x8e1d('0x7b')]=null;_0x1efa04[_0x8e1d('0x86')]=!![];_0x1efa04['lastAssignedTo']=_0xfb528a['membername'];_0x1efa04[_0x8e1d('0x79')]=_0xfb528a[_0x8e1d('0x79')];_0x1efa04[_0x8e1d('0x34')]=!![];_0x1efa04[_0x8e1d('0x87')]=![];_0x1efa04[_0x8e1d('0x88')]=null;if(!_0x1efa04[_0x8e1d('0x89')]){if(_0xfb528a[_0x8e1d('0x8a')]==_0x8e1d('0x89')){_0x1efa04[_0x8e1d('0x50')]=_0x8e1d('0x8b');logger[_0x8e1d('0x72')](_0x8e1d('0x8c'),_0x1efa04[_0x8e1d('0x4b')],_0x1efa04['type']);}else{if(_[_0x8e1d('0x8d')](_0xfb528a[_0x8e1d('0x3b')]['toLowerCase'](),_0x8e1d('0x8e'))){if(this['queueReports'][_0xfb528a[_0x8e1d('0x8f')]]){var _0x25059d=_[_0x8e1d('0x77')](this[_0x8e1d('0xf')][_0xfb528a['linkedid']]);_0x25059d[_0x8e1d('0x34')]=![];_0x25059d[_0x8e1d('0x87')]=!![];_0x25059d['queuecallerexitAt']=moment(_0x1efa04[_0x8e1d('0x6e')])['add'](_0xfb528a[_0x8e1d('0x79')],_0x8e1d('0x90'))[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x25059d['queuecallerexitreason']=_0x8e1d('0x91');_0x25059d[_0x8e1d('0x89')]=!![];_0x25059d[_0x8e1d('0x92')]=_0x8e1d('0x93');_0x25059d[_0x8e1d('0x94')]=_0xfb528a['destexten'];_0x25059d[_0x8e1d('0x95')]=_0xfb528a[_0x8e1d('0x4f')];logger['info'](_0x8e1d('0x96'),_0x25059d['queue'],_0x25059d[_0x8e1d('0x65')]);var _0x4762cd=this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x8f')]];this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x8f')]]=this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x4f')]];this[_0x8e1d('0xf')][_0xfb528a[_0x8e1d('0x4f')]]=_0x4762cd;}}else{_0x1efa04[_0x8e1d('0x50')]='COMPLETEDBY'+_0xfb528a[_0x8e1d('0x8a')][_0x8e1d('0x97')]();logger[_0x8e1d('0x72')](_0x8e1d('0x98'),_0x1efa04[_0x8e1d('0x4b')],_0x1efa04[_0x8e1d('0x65')],_0x1efa04[_0x8e1d('0x50')]);}}}this['channels'][_0xfb528a[_0x8e1d('0x4f')]]=_0x1efa04;}}}catch(_0x305134){logger[_0x8e1d('0x3f')]('[%s][voiceQueueReport][agentcomplete]',_0xfb528a[_0x8e1d('0x4f')],util['inspect'](_0x305134,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8e1d('0x24')]=function(_0x2c3b41){try{if(this[_0x8e1d('0x58')](_0x2c3b41)){logger['debug'](_0x8e1d('0x99'),_0x2c3b41[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x2c3b41,{'showHidden':![],'depth':null}));this['addVariable'](_0x2c3b41['uniqueid'],_[_0x8e1d('0x9a')](_0x2c3b41['variable'])[0x0],_0x2c3b41[_0x8e1d('0x9b')]);if(this[_0x8e1d('0xf')][_0x2c3b41['uniqueid']]){var _0x9768c5=_[_0x8e1d('0x77')](this['queueReports'][_0x2c3b41[_0x8e1d('0x4f')]]);if(_0x9768c5){if(this['isNotNull'](_0x2c3b41['variable'])&&this['isNotNull'](_0x2c3b41[_0x8e1d('0x9c')][_0x8e1d('0x5f')])){switch(_0x2c3b41[_0x8e1d('0x9b')]){case _0x8e1d('0x9d'):_0x9768c5[_0x8e1d('0x87')]=![];_0x9768c5['queuecallerexitAt']=null;break;case _0x8e1d('0x9e'):_0x9768c5[_0x8e1d('0x9f')]=_0x8e1d('0xa0');_0x9768c5['queuecallerexit']=!![];_0x9768c5[_0x8e1d('0x88')]=moment()['format'](_0x8e1d('0x6f'));_0x9768c5['queuecallerleaveAt']=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));logger[_0x8e1d('0x4d')](_0x8e1d('0xa1'),_0x2c3b41['uniqueid'],util['inspect'](_0x9768c5,{'showHidden':![],'depth':null}));ami[_0x8e1d('0x48')](_0x8e1d('0xa2'),_0x9768c5);break;default:_0x9768c5[_0x8e1d('0x87')]=!![];_0x9768c5[_0x8e1d('0x88')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x9768c5[_0x8e1d('0xa3')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));}_0x9768c5[_0x8e1d('0x33')]=![];_0x9768c5[_0x8e1d('0x7b')]=null;_0x9768c5[_0x8e1d('0x50')]=_0x2c3b41[_0x8e1d('0x9b')];this['channels'][_0x2c3b41['uniqueid']]=_0x9768c5;this[_0x8e1d('0x46')](_0x9768c5,_0x8e1d('0xa4'));}else if(this['isNotNull'](_0x2c3b41[_0x8e1d('0x9c')])&&this[_0x8e1d('0x58')](_0x2c3b41[_0x8e1d('0x9c')][_0x8e1d('0xa5')])){if(!_0x9768c5[_0x8e1d('0x33')]){_0x9768c5['queuecallerexit']=!![];_0x9768c5[_0x8e1d('0x88')]=moment()[_0x8e1d('0x49')](_0x8e1d('0x6f'));_0x9768c5[_0x8e1d('0x50')]=_0x8e1d('0xa6');_0x9768c5[_0x8e1d('0xa3')]=moment()['format'](_0x8e1d('0x6f'));this[_0x8e1d('0x36')][_0x2c3b41[_0x8e1d('0x4f')]]=_0x9768c5;}}logger[_0x8e1d('0x72')](_0x8e1d('0xa7'),_0x2c3b41['uniqueid'],_0x9768c5[_0x8e1d('0x4b')],_0x9768c5['type'],_[_0x8e1d('0x9a')](_0x2c3b41['variable'])[0x0],_0x2c3b41[_0x8e1d('0x9b')]);_0x9768c5[_0x8e1d('0x15')]=this[_0x8e1d('0x15')][_0x2c3b41[_0x8e1d('0x4f')]];}}}}catch(_0x46ac1c){logger['error']('[%s][voiceQueueReport][varset]',_0x2c3b41[_0x8e1d('0x4f')],util[_0x8e1d('0x41')](_0x46ac1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0xa8')]=function(_0x2b0511,_0x12c133,_0x27f519){var _0x570b46=[_0x8e1d('0xa9'),_0x8e1d('0xaa'),_0x8e1d('0xab'),_0x8e1d('0xac'),_0x8e1d('0xad'),_0x8e1d('0xae'),_0x8e1d('0xaf'),_0x8e1d('0xb0'),'sipcallid',_0x8e1d('0xb1'),_0x8e1d('0xb2'),_0x8e1d('0xb3'),_0x8e1d('0xb4'),_0x8e1d('0xb5'),_0x8e1d('0xb6'),_0x8e1d('0xb7'),_0x8e1d('0xb8'),_0x8e1d('0xb9'),_0x8e1d('0xba')];if(!_['isNil'](_0x12c133)&&!_[_0x8e1d('0xbb')](_0x570b46,_0x12c133)){if(_['isUndefined'](this[_0x8e1d('0x15')][_0x2b0511])){this[_0x8e1d('0x15')][_0x2b0511]={};}this[_0x8e1d('0x15')][_0x2b0511][_0x12c133]=_0x27f519;}};VoiceQueueReport[_0x8e1d('0xa')][_0x8e1d('0xbc')]=function(_0x1571c1,_0x522278,_0x1f520f){try{var _0x183a4d={};if(this['queueReports'][_0x1571c1]){for(var _0x4529f8=0x0;_0x4529f8{delete this[_0x8e1d('0x36')][_0x207529];},_0x426503);}};module[_0x8e1d('0xf8')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 5b9174c..db5ab99 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e7=['campaign','queue','CreateReportAgentPreview','../client','createHistory'];(function(_0x44f9ba,_0x225358){var _0x29812b=function(_0x5dca99){while(--_0x5dca99){_0x44f9ba['push'](_0x44f9ba['shift']());}};_0x29812b(++_0x225358);}(_0xd4e7,0xfd));var _0x7d4e=function(_0x5df13d,_0x3eeeab){_0x5df13d=_0x5df13d-0x0;var _0x3d4b27=_0xd4e7[_0x5df13d];return _0x3d4b27;};'use strict';var client=require(_0x7d4e('0x0'));exports[_0x7d4e('0x1')]=function(_0x502a7c){return function(){_0x502a7c[_0x7d4e('0x2')]=_0x502a7c[_0x7d4e('0x3')];return client['Request']('CreateReportAgentPreview',{'body':_0x502a7c,'log':_0x7d4e('0x4')});};}; \ No newline at end of file +var _0x53e1=['CreateReportAgentPreview','createHistory','campaign','queue','Request'];(function(_0x4cbdb7,_0x1b82f6){var _0x4ecb18=function(_0x48271f){while(--_0x48271f){_0x4cbdb7['push'](_0x4cbdb7['shift']());}};_0x4ecb18(++_0x1b82f6);}(_0x53e1,0x128));var _0x153e=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x53e1[_0x2a1b33];return _0x4c50e7;};'use strict';var client=require('../client');exports[_0x153e('0x0')]=function(_0x137443){return function(){_0x137443[_0x153e('0x1')]=_0x137443[_0x153e('0x2')];return client[_0x153e('0x3')]('CreateReportAgentPreview',{'body':_0x137443,'log':_0x153e('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 668fd6f..ba58508 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9dd=['Request','CreateAttachment'];(function(_0x184427,_0x496977){var _0x3aa4ea=function(_0x307574){while(--_0x307574){_0x184427['push'](_0x184427['shift']());}};_0x3aa4ea(++_0x496977);}(_0xd9dd,0x134));var _0xdd9d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd9dd[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports['create']=function(_0x2c6921){return client[_0xdd9d('0x0')](_0xdd9d('0x1'),{'body':_0x2c6921,'log':'CreateAttachment'});}; \ No newline at end of file +var _0xbdff=['../client','create','Request','CreateAttachment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbdff,0x114));var _0xfbdf=function(_0x1313e9,_0x5775bd){_0x1313e9=_0x1313e9-0x0;var _0x2d8856=_0xbdff[_0x1313e9];return _0x2d8856;};'use strict';var client=require(_0xfbdf('0x0'));exports[_0xfbdf('0x1')]=function(_0x399a18){return client[_0xfbdf('0x2')](_0xfbdf('0x3'),{'body':_0x399a18,'log':_0xfbdf('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index e0afe45..ebe7bb4 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x316667,_0x63223c){var _0xfa412c=function(_0x4e74fd){while(--_0x4e74fd){_0x316667['push'](_0x316667['shift']());}};_0xfa412c(++_0x63223c);}(_0x326f,0xd1));var _0xf326=function(_0x296042,_0xa2325e){_0x296042=_0x296042-0x0;var _0x371461=_0x326f[_0x296042];return _0x371461;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0xdb28=['dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','name','callerid','Interval','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','type','active','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialTimezone','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt'];(function(_0x57f803,_0x20c22c){var _0x200ae3=function(_0x3f8728){while(--_0x3f8728){_0x57f803['push'](_0x57f803['shift']());}};_0x200ae3(++_0x20c22c);}(_0xdb28,0x106));var _0x8db2=function(_0xf8ab66,_0x3e8c0e){_0xf8ab66=_0xf8ab66-0x0;var _0x526281=_0xdb28[_0xf8ab66];return _0x526281;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(){return client[_0x8db2('0x2')](_0x8db2('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'dialOriginateTimeout',_0x8db2('0x9'),_0x8db2('0xa'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'dialAbandonedMaxRetry',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'dialAgentRejectMaxRetry',_0x8db2('0x15'),_0x8db2('0x16'),'dialGlobalInterval',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22')],'include':[{'model':_0x8db2('0x23'),'as':_0x8db2('0x23'),'attributes':['id',_0x8db2('0x24'),'callerid',_0x8db2('0x5')]},{'model':_0x8db2('0x23'),'as':'TrunkBackup','attributes':['id',_0x8db2('0x24'),_0x8db2('0x25'),_0x8db2('0x5')]},{'model':_0x8db2('0x26'),'as':_0x8db2('0x26'),'attributes':['id',_0x8db2('0x24')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8db2('0x24'),_0x8db2('0x27')]}]},{'model':_0x8db2('0x28'),'as':_0x8db2('0x28'),'attributes':['id','name']}]},'log':_0x8db2('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 623c798..6fb076a 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45e8=['getContacts','GetCmContact','../client','createContact','Request','CreateCmContact'];(function(_0x2d1377,_0x3f9909){var _0x341028=function(_0x5a39e7){while(--_0x5a39e7){_0x2d1377['push'](_0x2d1377['shift']());}};_0x341028(++_0x3f9909);}(_0x45e8,0x176));var _0x845e=function(_0x5ab232,_0x570056){_0x5ab232=_0x5ab232-0x0;var _0x457b86=_0x45e8[_0x5ab232];return _0x457b86;};'use strict';var client=require(_0x845e('0x0'));exports[_0x845e('0x1')]=function(_0x4a03ec){return function(){return client[_0x845e('0x2')](_0x845e('0x3'),{'body':_0x4a03ec,'log':_0x845e('0x3')});};};exports[_0x845e('0x4')]=function(_0x151d77){return function(){return client[_0x845e('0x2')]('GetCmContact',{'options':_0x151d77,'log':_0x845e('0x5')});};}; \ No newline at end of file +var _0x1379=['Request','getContacts','GetCmContact','../client','createContact'];(function(_0x50cc5c,_0x53af09){var _0x55cfc1=function(_0x335faa){while(--_0x335faa){_0x50cc5c['push'](_0x50cc5c['shift']());}};_0x55cfc1(++_0x53af09);}(_0x1379,0x1e3));var _0x9137=function(_0x5a18ed,_0x9936d2){_0x5a18ed=_0x5a18ed-0x0;var _0x12d357=_0x1379[_0x5a18ed];return _0x12d357;};'use strict';var client=require(_0x9137('0x0'));exports[_0x9137('0x1')]=function(_0x5adf98){return function(){return client[_0x9137('0x2')]('CreateCmContact',{'body':_0x5adf98,'log':'CreateCmContact'});};};exports[_0x9137('0x3')]=function(_0x5b9bf5){return function(){return client[_0x9137('0x2')](_0x9137('0x4'),{'options':_0x5b9bf5,'log':'GetCmContact'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 2a7bf36..f1d6b92 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2975=['handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','moment','getContacts','Request','GetCmHopper','updateContacts','UpdateCmHopper','format','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','YYYY-MM-DD\x20HH:mm:ss','Contact','GetContactDialerIvr','moveContactManagedDialer','queue','ContactId','MoveContactManagedDialer','CountReScheduled','GetCmHopperPreview','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','CmContact','User','voicePause','db.CmHopper.UserId','ResetActiveCalls'];(function(_0x4bde94,_0x2a3ad8){var _0x179aff=function(_0x2b783c){while(--_0x2b783c){_0x4bde94['push'](_0x4bde94['shift']());}};_0x179aff(++_0x2a3ad8);}(_0x2975,0x1c5));var _0x5297=function(_0xbee3eb,_0x3cb1e0){_0xbee3eb=_0xbee3eb-0x0;var _0x463529=_0x2975[_0xbee3eb];return _0x463529;};'use strict';var client=require('../client');var moment=require(_0x5297('0x0'));exports[_0x5297('0x1')]=function(_0x44137e,_0x1a511b){return function(){return client[_0x5297('0x2')](_0x5297('0x3'),{'options':{'where':{'VoiceQueueId':_0x44137e},'include':[{'model':'CmContact','as':'Contact'}],'limit':_0x1a511b,'raw':![]},'log':'getCmHopper'});};};exports[_0x5297('0x4')]=function(_0x15d62b,_0x11a43d,_0x3da9c6){return function(){return client[_0x5297('0x2')](_0x5297('0x5'),{'body':_0x15d62b,'options':{'where':{'VoiceQueueId':_0x11a43d,'scheduledat':{'$lte':moment()[_0x5297('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x3da9c6},'log':_0x5297('0x5')});};};exports[_0x5297('0x7')]=function(_0x3f7368){return client[_0x5297('0x2')](_0x5297('0x5'),{'body':_0x3f7368,'options':{'where':{'ContactId':_0x3f7368['ContactId'],'ListId':_0x3f7368[_0x5297('0x8')],'VoiceQueueId':_0x3f7368[_0x5297('0x9')],'CampaignId':_0x3f7368[_0x5297('0xa')]}},'log':'rescheduleContact'});};exports[_0x5297('0xb')]=function(_0x30d068,_0x34c97a,_0x4a8879){return function(){return client[_0x5297('0x2')](_0x5297('0xc'),{'options':{'where':{'VoiceQueueId':_0x30d068,'ListId':_0x34c97a,'ContactId':_0x4a8879}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x185bf1,_0x43c441,_0x5cd992,_0x7e3417){return client['Request'](_0x5297('0xd'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x185bf1,'active':![],'scheduledat':{'$lte':moment()[_0x5297('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x43c441}}]},'order':[[_0x5297('0xe'),_0x5297('0xf')],[_0x5297('0x10'),_0x7e3417],['id',_0x5297('0x11')]],'raw':!![],'limit':_0x5cd992},'log':_0x5297('0xd')});};exports[_0x5297('0x12')]=function(_0x1fb138,_0x262a9f,_0x4ae2fe){return client[_0x5297('0x2')](_0x5297('0xd'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1fb138,'active':![],'scheduledat':{'$lte':moment()[_0x5297('0x6')](_0x5297('0x13'))}},'include':[{'model':'CmContact','as':_0x5297('0x14')}],'order':[[_0x5297('0xe'),'DESC'],[_0x5297('0x10'),_0x4ae2fe],['id','ASC']],'raw':!![],'limit':_0x262a9f},'log':_0x5297('0x15')});};exports[_0x5297('0x16')]=function(_0x39b675,_0xc33c){_0x39b675['campaign']=_0x39b675[_0x5297('0x17')];return client[_0x5297('0x2')]('MoveContactManagedDialer',{'body':_0x39b675,'options':{'where':{'ContactId':_0x39b675[_0x5297('0x18')],'ListId':_0x39b675[_0x5297('0x8')],'VoiceQueueId':_0x39b675['VoiceQueueId'],'CampaignId':_0x39b675[_0x5297('0xa')],'active':_0xc33c?undefined:!![]}},'log':_0x5297('0x19')});};exports['countReScheduled']=function(_0x28df2d){return client[_0x5297('0x2')](_0x5297('0x1a'),{'options':{'where':{'VoiceQueueId':_0x28df2d['id']?_0x28df2d['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x35fdc9){return function(){return client[_0x5297('0x2')](_0x5297('0x1b'),{'options':{'where':{'id':_0x35fdc9},'include':[{'model':'CmContact','as':_0x5297('0x14')},{'model':'User','as':'Agent','attributes':['id',_0x5297('0x1c')]},{'model':_0x5297('0x1d'),'as':_0x5297('0x1e'),'attributes':['id',_0x5297('0x1c')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x5297('0x1f')]=function(_0x31ac79,_0x2775f4,_0xee5f9c){return client[_0x5297('0x2')](_0x5297('0x5'),{'body':_0x31ac79,'options':{'where':{'id':_0x2775f4},'limit':_0xee5f9c},'log':_0x5297('0x5')});};exports[_0x5297('0x20')]=function(_0x62d992,_0x51d0fd){return function(){return client[_0x5297('0x2')](_0x5297('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x62d992,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x5297('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x51d0fd}},'order':[[_0x5297('0xe'),_0x5297('0xf')],['scheduledat',_0x5297('0xf')],['id',_0x5297('0x11')]],'include':[{'model':_0x5297('0x22'),'as':_0x5297('0x14')},{'model':_0x5297('0x23'),'as':'Agent','attributes':['id',_0x5297('0x1c'),_0x5297('0x24')]}],'group':_0x5297('0x25'),'raw':!![]},'log':_0x5297('0xd')});};};exports['resetActiveCalls']=function(_0x48e008,_0x509114){return client[_0x5297('0x2')](_0x5297('0x26'),{'body':_0x48e008,'options':_0x509114||{},'log':'ResetActiveCalls'});};exports[_0x5297('0x27')]=function(_0x20d588,_0x4470cc,_0x339e20){return function(){return client['Request'](_0x5297('0x28'),{'body':{'where':{'voiceQueueIds':_0x20d588,'interval':_0x4470cc,'availableAgentsIds':_0x339e20}},'log':_0x5297('0x27')});};}; \ No newline at end of file +var _0x2087=['Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User'];(function(_0x141d2e,_0x4d5885){var _0x535b21=function(_0x4554cd){while(--_0x4554cd){_0x141d2e['push'](_0x141d2e['shift']());}};_0x535b21(++_0x4d5885);}(_0x2087,0xf3));var _0x7208=function(_0x3b5e9f,_0x11a60b){_0x3b5e9f=_0x3b5e9f-0x0;var _0x3a6998=_0x2087[_0x3b5e9f];return _0x3a6998;};'use strict';var client=require(_0x7208('0x0'));var moment=require(_0x7208('0x1'));exports[_0x7208('0x2')]=function(_0x1773d0,_0x5eea11){return function(){return client[_0x7208('0x3')](_0x7208('0x4'),{'options':{'where':{'VoiceQueueId':_0x1773d0},'include':[{'model':_0x7208('0x5'),'as':_0x7208('0x6')}],'limit':_0x5eea11,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x232693,_0x5cc93f,_0x3c7d9d){return function(){return client['Request'](_0x7208('0x7'),{'body':_0x232693,'options':{'where':{'VoiceQueueId':_0x5cc93f,'scheduledat':{'$lte':moment()[_0x7208('0x8')](_0x7208('0x9'))}},'limit':_0x3c7d9d},'log':_0x7208('0x7')});};};exports[_0x7208('0xa')]=function(_0x25b01b){return client[_0x7208('0x3')]('UpdateCmHopper',{'body':_0x25b01b,'options':{'where':{'ContactId':_0x25b01b[_0x7208('0xb')],'ListId':_0x25b01b[_0x7208('0xc')],'VoiceQueueId':_0x25b01b[_0x7208('0xd')],'CampaignId':_0x25b01b[_0x7208('0xe')]}},'log':_0x7208('0xa')});};exports[_0x7208('0xf')]=function(_0x5b30f8,_0x330d9f,_0x26de84){return function(){return client[_0x7208('0x3')](_0x7208('0x10'),{'options':{'where':{'VoiceQueueId':_0x5b30f8,'ListId':_0x330d9f,'ContactId':_0x26de84}},'log':_0x7208('0x10')});};};exports[_0x7208('0x11')]=function(_0x4e59c1,_0xde3407,_0x415e8e,_0x234927){return client[_0x7208('0x3')](_0x7208('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4e59c1,'active':![],'scheduledat':{'$lte':moment()[_0x7208('0x8')](_0x7208('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0xde3407}}]},'order':[[_0x7208('0x13'),_0x7208('0x14')],[_0x7208('0x15'),_0x234927],['id',_0x7208('0x16')]],'raw':!![],'limit':_0x415e8e},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x5a7b8d,_0x476598,_0x5b22d6){return client[_0x7208('0x3')](_0x7208('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5a7b8d,'active':![],'scheduledat':{'$lte':moment()['format'](_0x7208('0x9'))}},'include':[{'model':_0x7208('0x5'),'as':_0x7208('0x6')}],'order':[[_0x7208('0x13'),_0x7208('0x14')],[_0x7208('0x15'),_0x5b22d6],['id',_0x7208('0x16')]],'raw':!![],'limit':_0x476598},'log':_0x7208('0x17')});};exports[_0x7208('0x18')]=function(_0x41cd3a,_0x3c17db){_0x41cd3a[_0x7208('0x19')]=_0x41cd3a[_0x7208('0x1a')];return client[_0x7208('0x3')](_0x7208('0x1b'),{'body':_0x41cd3a,'options':{'where':{'ContactId':_0x41cd3a['ContactId'],'ListId':_0x41cd3a['ListId'],'VoiceQueueId':_0x41cd3a[_0x7208('0xd')],'CampaignId':_0x41cd3a[_0x7208('0xe')],'active':_0x3c17db?undefined:!![]}},'log':_0x7208('0x1b')});};exports['countReScheduled']=function(_0x1b95dc){return client[_0x7208('0x3')](_0x7208('0x1c'),{'options':{'where':{'VoiceQueueId':_0x1b95dc['id']?_0x1b95dc['id']||null:null}},'log':_0x7208('0x1d')});};exports[_0x7208('0x1e')]=function(_0x245ee8){return function(){return client[_0x7208('0x3')](_0x7208('0x1f'),{'options':{'where':{'id':_0x245ee8},'include':[{'model':_0x7208('0x5'),'as':_0x7208('0x6')},{'model':_0x7208('0x20'),'as':_0x7208('0x21'),'attributes':['id',_0x7208('0x22')]},{'model':_0x7208('0x23'),'as':_0x7208('0x24'),'attributes':['id',_0x7208('0x22')]}],'raw':!![]},'log':_0x7208('0x25')});};};exports[_0x7208('0x26')]=function(_0x1416a4,_0x51bec2,_0x1c8c3f){return client['Request']('UpdateCmHopper',{'body':_0x1416a4,'options':{'where':{'id':_0x51bec2},'limit':_0x1c8c3f},'log':_0x7208('0x7')});};exports[_0x7208('0x27')]=function(_0x480ce3,_0x21f63d){return function(){return client[_0x7208('0x3')](_0x7208('0x28'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x480ce3,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x7208('0x8')](_0x7208('0x9'))},'UserId':{'$in':_0x21f63d}},'order':[[_0x7208('0x13'),_0x7208('0x14')],['scheduledat',_0x7208('0x14')],['id',_0x7208('0x16')]],'include':[{'model':_0x7208('0x5'),'as':'Contact'},{'model':'User','as':_0x7208('0x21'),'attributes':['id',_0x7208('0x22'),_0x7208('0x29')]}],'group':_0x7208('0x2a'),'raw':!![]},'log':_0x7208('0x12')});};};exports[_0x7208('0x2b')]=function(_0x212a67,_0x5b7da4){return client['Request']('ResetActiveCalls',{'body':_0x212a67,'options':_0x5b7da4||{},'log':_0x7208('0x2c')});};exports[_0x7208('0x2d')]=function(_0xb6da62,_0x31432e,_0x3d449e){return function(){return client[_0x7208('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0xb6da62,'interval':_0x31432e,'availableAgentsIds':_0x3d449e}},'log':_0x7208('0x2d')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 4b8ff7e..4f06590 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c81=['Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones'];(function(_0x41ce34,_0x22932a){var _0x580c63=function(_0x46a806){while(--_0x46a806){_0x41ce34['push'](_0x41ce34['shift']());}};_0x580c63(++_0x22932a);}(_0x1c81,0x196));var _0x11c8=function(_0x41a648,_0x19c878){_0x41a648=_0x41a648-0x0;var _0x108c52=_0x1c81[_0x41a648];return _0x108c52;};'use strict';var client=require(_0x11c8('0x0'));exports[_0x11c8('0x1')]=function(_0xdcce5a,_0x5367e1,_0xc7468b){return client[_0x11c8('0x2')](_0x11c8('0x3'),{'body':_0xdcce5a,'reason':_0x5367e1,'entity':_0xc7468b,'log':'VerifyAdditionalPhones'});};exports[_0x11c8('0x4')]=function(_0x57e089,_0x55c3f6,_0x6a87f0){return client[_0x11c8('0x2')](_0x11c8('0x5'),{'body':_0x57e089,'duration':_0x55c3f6,'waitTime':_0x6a87f0,'log':_0x11c8('0x5')});};exports[_0x11c8('0x6')]=function(_0x4ea3bb){return function(){return client[_0x11c8('0x2')](_0x11c8('0x7'),{'body':_0x4ea3bb,'log':_0x11c8('0x7')});};}; \ No newline at end of file +var _0x9b0a=['SwapAdditionalPhones','incrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9b0a,0x144));var _0xa9b0=function(_0x216e07,_0x59581a){_0x216e07=_0x216e07-0x0;var _0x73b29f=_0x9b0a[_0x216e07];return _0x73b29f;};'use strict';var client=require(_0xa9b0('0x0'));exports[_0xa9b0('0x1')]=function(_0x416442,_0x365b59,_0x11e9d3){return client[_0xa9b0('0x2')](_0xa9b0('0x3'),{'body':_0x416442,'reason':_0x365b59,'entity':_0x11e9d3,'log':'VerifyAdditionalPhones'});};exports[_0xa9b0('0x4')]=function(_0x1481fb,_0x319f1c,_0x1d882c){return client[_0xa9b0('0x2')](_0xa9b0('0x5'),{'body':_0x1481fb,'duration':_0x319f1c,'waitTime':_0x1d882c,'log':_0xa9b0('0x5')});};exports[_0xa9b0('0x6')]=function(_0x59237b){return function(){return client[_0xa9b0('0x2')]('IncrementPreviewCounters',{'body':_0x59237b,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index eb0b4d4..aea44f7 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9adc=['checkIsBlackList','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client'];(function(_0x576786,_0x54d8bc){var _0xd52613=function(_0x30b3d7){while(--_0x30b3d7){_0x576786['push'](_0x576786['shift']());}};_0xd52613(++_0x54d8bc);}(_0x9adc,0x19d));var _0xc9ad=function(_0x1df9fc,_0x34d224){_0x1df9fc=_0x1df9fc-0x0;var _0x5cf40c=_0x9adc[_0x1df9fc];return _0x5cf40c;};'use strict';var client=require(_0xc9ad('0x0'));exports[_0xc9ad('0x1')]=function(_0x25e3d6){return client['Request'](_0xc9ad('0x2'),{'options':{'where':{'VoiceQueueId':_0x25e3d6[_0xc9ad('0x3')],'phone':_0x25e3d6[_0xc9ad('0x4')]},'raw':![]},'log':_0xc9ad('0x2')});};exports[_0xc9ad('0x5')]=function(_0x37f134){return client[_0xc9ad('0x6')](_0xc9ad('0x2'),{'options':{'where':{'CampaignId':_0x37f134[_0xc9ad('0x7')],'phone':_0x37f134[_0xc9ad('0x4')]},'raw':![]},'log':_0xc9ad('0x8')});}; \ No newline at end of file +var _0x541a=['GetCmHopperBlack','checkIsBlackListIvr','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','VoiceQueueId','phone'];(function(_0x4c9c5b,_0x210cbb){var _0x4088ab=function(_0x3f1d0a){while(--_0x3f1d0a){_0x4c9c5b['push'](_0x4c9c5b['shift']());}};_0x4088ab(++_0x210cbb);}(_0x541a,0x16b));var _0xa541=function(_0x5f139c,_0x34abe0){_0x5f139c=_0x5f139c-0x0;var _0xd3bd61=_0x541a[_0x5f139c];return _0xd3bd61;};'use strict';var client=require(_0xa541('0x0'));exports[_0xa541('0x1')]=function(_0x5d002e){return client[_0xa541('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x5d002e[_0xa541('0x3')],'phone':_0x5d002e[_0xa541('0x4')]},'raw':![]},'log':_0xa541('0x5')});};exports[_0xa541('0x6')]=function(_0x2dd410){return client[_0xa541('0x2')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x2dd410['CampaignId'],'phone':_0x2dd410['phone']},'raw':![]},'log':_0xa541('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index ac4f97c..a9d5982 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19de=['createContact','campaign','queue','Request'];(function(_0x2d453d,_0x5a0266){var _0x29649b=function(_0x19bbe6){while(--_0x19bbe6){_0x2d453d['push'](_0x2d453d['shift']());}};_0x29649b(++_0x5a0266);}(_0x19de,0xc4));var _0xe19d=function(_0x4bd70c,_0x1e2eed){_0x4bd70c=_0x4bd70c-0x0;var _0x1b1c00=_0x19de[_0x4bd70c];return _0x1b1c00;};'use strict';var client=require('../client');exports[_0xe19d('0x0')]=function(_0x2cc5a3){return function(){_0x2cc5a3[_0xe19d('0x1')]=_0x2cc5a3[_0xe19d('0x2')];return client[_0xe19d('0x3')]('CreateCmHopperFinal',{'body':_0x2cc5a3,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0x9a55=['../client','campaign','queue','Request','CreateCmHopperFinal'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x9a55,0x13b));var _0x59a5=function(_0x43ecc4,_0x565ff6){_0x43ecc4=_0x43ecc4-0x0;var _0x39c2cd=_0x9a55[_0x43ecc4];return _0x39c2cd;};'use strict';var client=require(_0x59a5('0x0'));exports['createContact']=function(_0x1f490c){return function(){_0x1f490c[_0x59a5('0x1')]=_0x1f490c[_0x59a5('0x2')];return client[_0x59a5('0x3')](_0x59a5('0x4'),{'body':_0x1f490c,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 1e3caf8..0248dd9 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc97b=['getCampaignHopperHistory','GetCampaignHopperHistory','moment','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0xc97b,0xac));var _0xbc97=function(_0xd308f,_0x3d0a33){_0xd308f=_0xd308f-0x0;var _0x24595c=_0xc97b[_0xd308f];return _0x24595c;};'use strict';var client=require('../client');var moment=require(_0xbc97('0x0'));exports['createHistory']=function(_0x3fd6d0){_0x3fd6d0[_0xbc97('0x1')]=_0x3fd6d0[_0xbc97('0x2')];return client[_0xbc97('0x3')](_0xbc97('0x4'),{'body':_0x3fd6d0,'log':_0xbc97('0x4')});};exports[_0xbc97('0x5')]=function(_0x1822c8){return client[_0xbc97('0x3')](_0xbc97('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x1822c8,_0xbc97('0x7'))[_0xbc97('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xbc97('0x8')](_0xbc97('0x9'))]}},'raw':![]},'log':_0xbc97('0xa')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0xbc97('0x3')](_0xbc97('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xbc97('0xc')](_0xbc97('0xd'))[_0xbc97('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xbc97('0xe')](_0xbc97('0xd'))[_0xbc97('0x8')](_0xbc97('0x9'))]},'campaigntype':_0xbc97('0x2')},'raw':![]},'log':_0xbc97('0xb')});};};exports[_0xbc97('0xf')]=function(){return function(){return client[_0xbc97('0x3')](_0xbc97('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xbc97('0xd'))[_0xbc97('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xbc97('0xe')](_0xbc97('0xd'))[_0xbc97('0x8')](_0xbc97('0x9'))]},'campaigntype':'ivr'},'raw':![]},'log':_0xbc97('0x10')});};}; \ No newline at end of file +var _0x986e=['format','YYYY-MM-DD\x20HH:mm:ss','getVoiceQueueHopperHistory','startOf','day','endOf','queue','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','../client','moment','createHistory','campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x986e,0xb4));var _0xe986=function(_0x635036,_0x5e542d){_0x635036=_0x635036-0x0;var _0x477e47=_0x986e[_0x635036];return _0x477e47;};'use strict';var client=require(_0xe986('0x0'));var moment=require(_0xe986('0x1'));exports[_0xe986('0x2')]=function(_0x2a1e79){_0x2a1e79[_0xe986('0x3')]=_0x2a1e79['queue'];return client[_0xe986('0x4')](_0xe986('0x5'),{'body':_0x2a1e79,'log':_0xe986('0x5')});};exports[_0xe986('0x6')]=function(_0x4d8b4d){return client[_0xe986('0x4')](_0xe986('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0xe986('0x8')](_0x4d8b4d,_0xe986('0x9'))[_0xe986('0xa')](_0xe986('0xb')),moment()[_0xe986('0xa')](_0xe986('0xb'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0xe986('0xc')]=function(){return function(){return client['Request']('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xe986('0xd')](_0xe986('0xe'))['format'](_0xe986('0xb')),moment()[_0xe986('0xf')](_0xe986('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xe986('0x10')},'raw':![]},'log':_0xe986('0x11')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0xe986('0x4')](_0xe986('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xe986('0xe'))[_0xe986('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xe986('0xe'))[_0xe986('0xa')](_0xe986('0xb'))]},'campaigntype':'ivr'},'raw':![]},'log':_0xe986('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 03b9bdd..51d08ae 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bab=['../client','getFaxAccounts','Request','GetFaxAccount','description','ecm','headerinfo','minrate','maxrate','t38timeout','TrunkId','Trunk','name','callerid','getFaxAccount','notify','NotifyFaxAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x1a4818,_0x477221){_0x1a4818=_0x1a4818-0x0;var _0x54ccb6=_0x2bab[_0x1a4818];return _0x54ccb6;};'use strict';var client=require(_0xb2ba('0x0'));exports[_0xb2ba('0x1')]=function(){return function(){return client[_0xb2ba('0x2')](_0xb2ba('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb2ba('0x4'),_0xb2ba('0x5'),_0xb2ba('0x6'),'localstationid',_0xb2ba('0x7'),_0xb2ba('0x8'),'modem','gateway','faxdetect',_0xb2ba('0x9'),'tech',_0xb2ba('0xa'),'ListId','key'],'include':[{'model':_0xb2ba('0xb'),'as':_0xb2ba('0xb'),'attributes':['id',_0xb2ba('0xc'),_0xb2ba('0xd'),'active']}]},'log':_0xb2ba('0xe')});};};exports[_0xb2ba('0xf')]=function(_0x4a9bf4,_0x4edce7){return client[_0xb2ba('0x2')](_0xb2ba('0x10'),{'account':{'id':_0x4a9bf4},'body':_0x4edce7,'log':'NotifyFaxAccount'});}; \ No newline at end of file +var _0xef4d=['modem','gateway','t38timeout','tech','TrunkId','ListId','key','Trunk','callerid','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xef4d,0x165));var _0xdef4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xef4d[_0x3c2a69];return _0x596bc8;};'use strict';var client=require(_0xdef4('0x0'));exports[_0xdef4('0x1')]=function(){return function(){return client[_0xdef4('0x2')](_0xdef4('0x3'),{'options':{'raw':![],'attributes':['id',_0xdef4('0x4'),_0xdef4('0x5'),_0xdef4('0x6'),_0xdef4('0x7'),_0xdef4('0x8'),_0xdef4('0x9'),_0xdef4('0xa'),_0xdef4('0xb'),_0xdef4('0xc'),'faxdetect',_0xdef4('0xd'),_0xdef4('0xe'),_0xdef4('0xf'),_0xdef4('0x10'),_0xdef4('0x11')],'include':[{'model':_0xdef4('0x12'),'as':_0xdef4('0x12'),'attributes':['id',_0xdef4('0x4'),_0xdef4('0x13'),'active']}]},'log':_0xdef4('0x14')});};};exports[_0xdef4('0x15')]=function(_0x35c826,_0x3fa15d){return client[_0xdef4('0x2')](_0xdef4('0x16'),{'account':{'id':_0x35c826},'body':_0x3fa15d,'log':_0xdef4('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index ded90d5..403f3be 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4e3=['UpdateFaxMessage','../client','Request'];(function(_0x34caea,_0x52a020){var _0x11d044=function(_0x5a2df2){while(--_0x5a2df2){_0x34caea['push'](_0x34caea['shift']());}};_0x11d044(++_0x52a020);}(_0xc4e3,0x73));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3c4e('0x0'));exports['update']=function(_0x43a4,_0x3d26bd){return client[_0x3c4e('0x1')]('UpdateFaxMessage',{'body':_0x3d26bd,'options':{'where':{'AttachmentId':_0x43a4}},'log':_0x3c4e('0x2')});}; \ No newline at end of file +var _0x028a=['../client','update','UpdateFaxMessage'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x028a,0x84));var _0xa028=function(_0x489efc,_0x2449eb){_0x489efc=_0x489efc-0x0;var _0x44c521=_0x028a[_0x489efc];return _0x44c521;};'use strict';var client=require(_0xa028('0x0'));exports[_0xa028('0x1')]=function(_0x5926bd,_0x5b48f2){return client['Request'](_0xa028('0x2'),{'body':_0x5b48f2,'options':{'where':{'AttachmentId':_0x5926bd}},'log':_0xa028('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index c16a70d..fb0c409 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x183f=['Variable','Descriptions','keyType','keyContent','Fields','nameField','Tag','Tags','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration','Configurations','DeskField','content','variableName'];(function(_0x27bee8,_0x452b2f){var _0xfa823f=function(_0x3fc8a1){while(--_0x3fc8a1){_0x27bee8['push'](_0x27bee8['shift']());}};_0xfa823f(++_0x452b2f);}(_0x183f,0xe0));var _0xf183=function(_0x46489b,_0x102a92){_0x46489b=_0x46489b-0x0;var _0xcef4e=_0x183f[_0x46489b];return _0xcef4e;};'use strict';var client=require('../../client');exports[_0xf183('0x0')]=function(){return function(_0x49de60){return client[_0xf183('0x1')](_0xf183('0x2'),{'options':{'raw':![],'attributes':['id',_0xf183('0x3'),_0xf183('0x4'),_0xf183('0x5'),_0xf183('0x6'),_0xf183('0x7'),_0xf183('0x8'),_0xf183('0x9'),_0xf183('0xa')],'include':[{'model':_0xf183('0xb'),'as':_0xf183('0xc'),'attributes':['id',_0xf183('0x3')],'include':[{'model':_0xf183('0xd'),'as':'Subjects','attributes':['id',_0xf183('0x9'),_0xf183('0xe'),_0xf183('0xf')],'include':[{'model':'Variable','as':_0xf183('0x10'),'attributes':['id',_0xf183('0x3')]}]},{'model':_0xf183('0xd'),'as':_0xf183('0x11'),'attributes':['id','type',_0xf183('0xe'),'key',_0xf183('0x12'),_0xf183('0x13'),_0xf183('0xf')],'include':[{'model':_0xf183('0x10'),'as':_0xf183('0x10'),'attributes':['id',_0xf183('0x3')]}]},{'model':_0xf183('0xd'),'as':_0xf183('0x14'),'attributes':['id',_0xf183('0x9'),_0xf183('0xe'),'idField',_0xf183('0x15'),'customField',_0xf183('0xf')],'include':[{'model':_0xf183('0x10'),'as':_0xf183('0x10'),'attributes':['id',_0xf183('0x3')]}]},{'model':_0xf183('0x16'),'as':_0xf183('0x17'),'attributes':['id',_0xf183('0x3')]}]}]},'log':_0xf183('0x2')});};}; \ No newline at end of file +var _0xbdeb=['content','variableName','Variable','DeskField','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','Tags','../../client','getDeskAccounts','Request','name','description','username','remoteUri','serverUrl','DeskConfiguration','Configurations','Subjects','type'];(function(_0x51019f,_0x57c7b1){var _0x354cc0=function(_0x97cd6c){while(--_0x97cd6c){_0x51019f['push'](_0x51019f['shift']());}};_0x354cc0(++_0x57c7b1);}(_0xbdeb,0x194));var _0xbbde=function(_0x5638cc,_0x240781){_0x5638cc=_0x5638cc-0x0;var _0x475e9a=_0xbdeb[_0x5638cc];return _0x475e9a;};'use strict';var client=require(_0xbbde('0x0'));exports[_0xbbde('0x1')]=function(){return function(_0x2bfeb5){return client[_0xbbde('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xbbde('0x3'),_0xbbde('0x4'),_0xbbde('0x5'),'password',_0xbbde('0x6'),'authType','type',_0xbbde('0x7')],'include':[{'model':_0xbbde('0x8'),'as':_0xbbde('0x9'),'attributes':['id',_0xbbde('0x3')],'include':[{'model':'DeskField','as':_0xbbde('0xa'),'attributes':['id',_0xbbde('0xb'),_0xbbde('0xc'),_0xbbde('0xd')],'include':[{'model':_0xbbde('0xe'),'as':_0xbbde('0xe'),'attributes':['id','name']}]},{'model':_0xbbde('0xf'),'as':_0xbbde('0x10'),'attributes':['id',_0xbbde('0xb'),'content',_0xbbde('0x11'),_0xbbde('0x12'),_0xbbde('0x13'),_0xbbde('0xd')],'include':[{'model':_0xbbde('0xe'),'as':_0xbbde('0xe'),'attributes':['id',_0xbbde('0x3')]}]},{'model':_0xbbde('0xf'),'as':_0xbbde('0x14'),'attributes':['id','type',_0xbbde('0xc'),_0xbbde('0x15'),_0xbbde('0x16'),_0xbbde('0x17'),_0xbbde('0xd')],'include':[{'model':_0xbbde('0xe'),'as':'Variable','attributes':['id','name']}]},{'model':_0xbbde('0x18'),'as':_0xbbde('0x19'),'attributes':['id',_0xbbde('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index db65234..421501b 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb03e=['data7','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','openNewTab','Dynamics365Field','Subjects','content','Variable','Descriptions','type','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','CloudProvider','data2','data5'];(function(_0x479f47,_0x3d619a){var _0xc3fac2=function(_0x351634){while(--_0x351634){_0x479f47['push'](_0x479f47['shift']());}};_0xc3fac2(++_0x3d619a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x105052,_0x58b430){_0x105052=_0x105052-0x0;var _0x36c4a0=_0xb03e[_0x105052];return _0x36c4a0;};'use strict';var client=require('../../client');exports[_0xeb03('0x0')]=function(){return function(_0x399504){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'options':{'raw':![],'attributes':['id',_0xeb03('0x3'),_0xeb03('0x4'),_0xeb03('0x5'),_0xeb03('0x6'),_0xeb03('0x7'),_0xeb03('0x8'),_0xeb03('0x9'),_0xeb03('0xa'),'description',_0xeb03('0xb')],'include':[{'model':_0xeb03('0xc'),'as':_0xeb03('0xd'),'attributes':['id',_0xeb03('0x3'),_0xeb03('0xe'),_0xeb03('0xf'),'additionalSearchContact',_0xeb03('0x10')],'include':[{'model':_0xeb03('0x11'),'as':_0xeb03('0x12'),'attributes':['id','type',_0xeb03('0x13'),'variableName'],'include':[{'model':_0xeb03('0x14'),'as':_0xeb03('0x14'),'attributes':['id',_0xeb03('0x3')]}]},{'model':_0xeb03('0x11'),'as':_0xeb03('0x15'),'attributes':['id',_0xeb03('0x16'),_0xeb03('0x13'),_0xeb03('0x17'),_0xeb03('0x18'),_0xeb03('0x19'),_0xeb03('0x1a')],'include':[{'model':_0xeb03('0x14'),'as':'Variable','attributes':['id',_0xeb03('0x3')]}]},{'model':_0xeb03('0x11'),'as':_0xeb03('0x1b'),'attributes':['id',_0xeb03('0x16'),'content',_0xeb03('0x1c'),_0xeb03('0x1d'),_0xeb03('0x1e'),'variableName'],'include':[{'model':_0xeb03('0x14'),'as':_0xeb03('0x14'),'attributes':['id',_0xeb03('0x3')]}]}]},{'model':_0xeb03('0x1f'),'as':_0xeb03('0x1f'),'attributes':['id',_0xeb03('0x20'),_0xeb03('0x21'),_0xeb03('0x22')]}]},'log':_0xeb03('0x2')});};}; \ No newline at end of file +var _0xfd6f=['tenantId','clientSecret','serverUrl','description','modernAuthentication','Configurations','name','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','content','Variable','type','keyType','keyContent','variableName','Fields','idField','nameField','CloudProvider','data2','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','username','password','remoteUri'];(function(_0x5b78f3,_0x3d9ed7){var _0x8c221=function(_0x2d7e5e){while(--_0x2d7e5e){_0x5b78f3['push'](_0x5b78f3['shift']());}};_0x8c221(++_0x3d9ed7);}(_0xfd6f,0x19d));var _0xffd6=function(_0x5ed58e,_0x5477ee){_0x5ed58e=_0x5ed58e-0x0;var _0x318863=_0xfd6f[_0x5ed58e];return _0x318863;};'use strict';var client=require(_0xffd6('0x0'));exports[_0xffd6('0x1')]=function(){return function(_0x29b163){return client[_0xffd6('0x2')](_0xffd6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xffd6('0x4'),_0xffd6('0x5'),_0xffd6('0x6'),_0xffd6('0x7'),'clientId',_0xffd6('0x8'),_0xffd6('0x9'),_0xffd6('0xa'),_0xffd6('0xb')],'include':[{'model':'Dynamics365Configuration','as':_0xffd6('0xc'),'attributes':['id',_0xffd6('0xd'),'ticketType','moduleCreate',_0xffd6('0xe'),_0xffd6('0xf')],'include':[{'model':_0xffd6('0x10'),'as':_0xffd6('0x11'),'attributes':['id','type',_0xffd6('0x12'),'variableName'],'include':[{'model':'Variable','as':_0xffd6('0x13'),'attributes':['id',_0xffd6('0xd')]}]},{'model':_0xffd6('0x10'),'as':'Descriptions','attributes':['id',_0xffd6('0x14'),_0xffd6('0x12'),'key',_0xffd6('0x15'),_0xffd6('0x16'),_0xffd6('0x17')],'include':[{'model':_0xffd6('0x13'),'as':'Variable','attributes':['id','name']}]},{'model':_0xffd6('0x10'),'as':_0xffd6('0x18'),'attributes':['id',_0xffd6('0x14'),'content',_0xffd6('0x19'),_0xffd6('0x1a'),'customField',_0xffd6('0x17')],'include':[{'model':'Variable','as':_0xffd6('0x13'),'attributes':['id',_0xffd6('0xd')]}]}]},{'model':_0xffd6('0x1b'),'as':_0xffd6('0x1b'),'attributes':['id',_0xffd6('0x1c'),'data5',_0xffd6('0x1d')]}]},'log':_0xffd6('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index cbcc6ed..8119e1f 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4345=['Variable','FreshdeskField','Descriptions','key','keyType','keyContent','Fields','idField','nameField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','remoteUri','FreshdeskConfiguration','Configurations','Subjects','type','content','variableName'];(function(_0xf03f9e,_0x2f85e8){var _0x2326a7=function(_0x44702b){while(--_0x44702b){_0xf03f9e['push'](_0xf03f9e['shift']());}};_0x2326a7(++_0x2f85e8);}(_0x4345,0x77));var _0x5434=function(_0x1d2971,_0x2c6753){_0x1d2971=_0x1d2971-0x0;var _0x264286=_0x4345[_0x1d2971];return _0x264286;};'use strict';var client=require(_0x5434('0x0'));exports[_0x5434('0x1')]=function(){return function(_0x590a0e){return client[_0x5434('0x2')](_0x5434('0x3'),{'options':{'raw':![],'attributes':['id',_0x5434('0x4'),_0x5434('0x5'),'apiKey',_0x5434('0x6'),'serverUrl'],'include':[{'model':_0x5434('0x7'),'as':_0x5434('0x8'),'attributes':['id',_0x5434('0x4')],'include':[{'model':'Tag','attributes':['id',_0x5434('0x4')]},{'model':'FreshdeskField','as':_0x5434('0x9'),'attributes':['id',_0x5434('0xa'),_0x5434('0xb'),_0x5434('0xc')],'include':[{'model':_0x5434('0xd'),'as':_0x5434('0xd'),'attributes':['id',_0x5434('0x4')]}]},{'model':_0x5434('0xe'),'as':_0x5434('0xf'),'attributes':['id',_0x5434('0xa'),_0x5434('0xb'),_0x5434('0x10'),_0x5434('0x11'),_0x5434('0x12'),'variableName'],'include':[{'model':_0x5434('0xd'),'as':'Variable','attributes':['id',_0x5434('0x4')]}]},{'model':_0x5434('0xe'),'as':_0x5434('0x13'),'attributes':['id',_0x5434('0xa'),'content',_0x5434('0x14'),_0x5434('0x15'),'customField',_0x5434('0xc')],'include':[{'model':_0x5434('0xd'),'as':_0x5434('0xd'),'attributes':['id',_0x5434('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0xeffd=['FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','nameField','customField','../../client','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xeffd,0x6b));var _0xdeff=function(_0x4bf174,_0x2fc65a){_0x4bf174=_0x4bf174-0x0;var _0x5853fc=_0xeffd[_0x4bf174];return _0x5853fc;};'use strict';var client=require(_0xdeff('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x1f45fd){return client[_0xdeff('0x1')](_0xdeff('0x2'),{'options':{'raw':![],'attributes':['id',_0xdeff('0x3'),_0xdeff('0x4'),_0xdeff('0x5'),_0xdeff('0x6'),_0xdeff('0x7')],'include':[{'model':_0xdeff('0x8'),'as':_0xdeff('0x9'),'attributes':['id',_0xdeff('0x3')],'include':[{'model':_0xdeff('0xa'),'attributes':['id',_0xdeff('0x3')]},{'model':_0xdeff('0xb'),'as':_0xdeff('0xc'),'attributes':['id',_0xdeff('0xd'),_0xdeff('0xe'),'variableName'],'include':[{'model':_0xdeff('0xf'),'as':_0xdeff('0xf'),'attributes':['id',_0xdeff('0x3')]}]},{'model':'FreshdeskField','as':_0xdeff('0x10'),'attributes':['id',_0xdeff('0xd'),_0xdeff('0xe'),_0xdeff('0x11'),_0xdeff('0x12'),_0xdeff('0x13'),_0xdeff('0x14')],'include':[{'model':_0xdeff('0xf'),'as':'Variable','attributes':['id',_0xdeff('0x3')]}]},{'model':_0xdeff('0xb'),'as':'Fields','attributes':['id',_0xdeff('0xd'),'content','idField',_0xdeff('0x15'),_0xdeff('0x16'),_0xdeff('0x14')],'include':[{'model':_0xdeff('0xf'),'as':'Variable','attributes':['id',_0xdeff('0x3')]}]}]}]},'log':_0xdeff('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 29c6513..b44a8a8 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b65=['getFreshsalesAccounts','Request','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','Variable','key','keyType','keyContent','variableName','../../client'];(function(_0x794330,_0x14bab4){var _0x41feda=function(_0x2daac7){while(--_0x2daac7){_0x794330['push'](_0x794330['shift']());}};_0x41feda(++_0x14bab4);}(_0x1b65,0x1b4));var _0x51b6=function(_0xeb901,_0x3e292e){_0xeb901=_0xeb901-0x0;var _0x645bad=_0x1b65[_0xeb901];return _0x645bad;};'use strict';var client=require(_0x51b6('0x0'));exports[_0x51b6('0x1')]=function(){return function(_0x3e4953){return client[_0x51b6('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x51b6('0x3'),_0x51b6('0x4'),_0x51b6('0x5'),_0x51b6('0x6'),_0x51b6('0x7')],'include':[{'model':_0x51b6('0x8'),'as':_0x51b6('0x9'),'attributes':['id','name'],'include':[{'model':_0x51b6('0xa'),'as':_0x51b6('0xb'),'attributes':['id',_0x51b6('0xc'),_0x51b6('0xd'),'variableName'],'include':[{'model':_0x51b6('0xe'),'as':_0x51b6('0xe'),'attributes':['id','name']}]},{'model':_0x51b6('0xa'),'as':'Descriptions','attributes':['id','type',_0x51b6('0xd'),_0x51b6('0xf'),_0x51b6('0x10'),_0x51b6('0x11'),_0x51b6('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x51b6('0x3')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0xdf98=['type','content','variableName','Descriptions','key','keyType','keyContent','Variable','GetFreshsalesccount','../../client','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xdf98,0xcf));var _0x8df9=function(_0x1ffff7,_0x2f9ff6){_0x1ffff7=_0x1ffff7-0x0;var _0x49d017=_0xdf98[_0x1ffff7];return _0x49d017;};'use strict';var client=require(_0x8df9('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x1f9abd){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x8df9('0x1'),_0x8df9('0x2'),_0x8df9('0x3'),_0x8df9('0x4'),_0x8df9('0x5')],'include':[{'model':_0x8df9('0x6'),'as':_0x8df9('0x7'),'attributes':['id',_0x8df9('0x1')],'include':[{'model':_0x8df9('0x8'),'as':'Subjects','attributes':['id',_0x8df9('0x9'),_0x8df9('0xa'),_0x8df9('0xb')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x8df9('0x1')]}]},{'model':'FreshsalesField','as':_0x8df9('0xc'),'attributes':['id',_0x8df9('0x9'),_0x8df9('0xa'),_0x8df9('0xd'),_0x8df9('0xe'),_0x8df9('0xf'),_0x8df9('0xb')],'include':[{'model':_0x8df9('0x10'),'as':'Variable','attributes':['id',_0x8df9('0x1')]}]}]}]},'log':_0x8df9('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 086929d..81c8b3d 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x505d=['SalesforceField','Variable','Fields','Request','GetSalesforceAccount','name','username','remoteUri','clientId','clientSecret','securityToken','type','Configurations','moduleCreate','ticketType','additionalSearchContact'];(function(_0x11e172,_0x527865){var _0x1828e0=function(_0x5d96cb){while(--_0x5d96cb){_0x11e172['push'](_0x11e172['shift']());}};_0x1828e0(++_0x527865);}(_0x505d,0x93));var _0xd505=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x505d[_0xfcbcb8];return _0x1b1f97;};'use strict';var client=require('../../client');exports['getSalesforceAccounts']=function(){return function(_0x441c2b){return client[_0xd505('0x0')](_0xd505('0x1'),{'options':{'raw':![],'attributes':['id',_0xd505('0x2'),_0xd505('0x3'),'password',_0xd505('0x4'),_0xd505('0x5'),_0xd505('0x6'),_0xd505('0x7'),'serverUrl',_0xd505('0x8')],'include':[{'model':'SalesforceConfiguration','as':_0xd505('0x9'),'attributes':['id',_0xd505('0x2'),'moduleSearch',_0xd505('0xa'),_0xd505('0xb'),'leadId','additionalSearchAccount',_0xd505('0xc'),'additionalSearchLead'],'include':[{'model':_0xd505('0xd'),'as':'Subjects','include':[{'model':_0xd505('0xe'),'as':'Variable','attributes':['id',_0xd505('0x2')]}]},{'model':'SalesforceField','as':'Descriptions','include':[{'model':'Variable','as':_0xd505('0xe'),'attributes':['id','name']}]},{'model':_0xd505('0xd'),'as':_0xd505('0xf'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xd505('0x2')]}]}]}]},'log':_0xd505('0x1')});};}; \ No newline at end of file +var _0x349f=['clientSecret','securityToken','serverUrl','type','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','SalesforceField','Subjects','Variable','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','name','username','password','remoteUri','clientId'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x349f,0xa8));var _0xf349=function(_0x24a992,_0x5c49eb){_0x24a992=_0x24a992-0x0;var _0x26e1d4=_0x349f[_0x24a992];return _0x26e1d4;};'use strict';var client=require(_0xf349('0x0'));exports[_0xf349('0x1')]=function(){return function(_0x3a3487){return client['Request'](_0xf349('0x2'),{'options':{'raw':![],'attributes':['id',_0xf349('0x3'),_0xf349('0x4'),_0xf349('0x5'),_0xf349('0x6'),_0xf349('0x7'),_0xf349('0x8'),_0xf349('0x9'),_0xf349('0xa'),_0xf349('0xb')],'include':[{'model':'SalesforceConfiguration','as':_0xf349('0xc'),'attributes':['id',_0xf349('0x3'),_0xf349('0xd'),_0xf349('0xe'),_0xf349('0xf'),_0xf349('0x10'),_0xf349('0x11'),'additionalSearchContact','additionalSearchLead'],'include':[{'model':_0xf349('0x12'),'as':_0xf349('0x13'),'include':[{'model':_0xf349('0x14'),'as':_0xf349('0x14'),'attributes':['id',_0xf349('0x3')]}]},{'model':'SalesforceField','as':'Descriptions','include':[{'model':'Variable','as':_0xf349('0x14'),'attributes':['id',_0xf349('0x3')]}]},{'model':_0xf349('0x12'),'as':_0xf349('0x15'),'include':[{'model':_0xf349('0x14'),'as':'Variable','attributes':['id',_0xf349('0x3')]}]}]}]},'log':_0xf349('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index e35c52d..78d799f 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524e=['name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','Request','GetServicenowAccount'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x524e,0x15e));var _0xe524=function(_0x2d9ac4,_0x194d56){_0x2d9ac4=_0x2d9ac4-0x0;var _0xf51bfe=_0x524e[_0x2d9ac4];return _0xf51bfe;};'use strict';var client=require('../../client');exports['getServicenowAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0xe524('0x9'),'attributes':['id',_0xe524('0x2')],'include':[{'model':_0xe524('0xa'),'as':'Subjects','attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0xa'),'as':_0xe524('0xf'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xe524('0x13'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x14'),_0xe524('0x15'),'customField',_0xe524('0xd')],'include':[{'model':'Variable','as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0xf494=['idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','type','content','variableName','Variable','ServicenowField','Descriptions','key','keyContent','Fields'];(function(_0x4e33c0,_0x555fda){var _0x1f7aa3=function(_0x2b688b){while(--_0x2b688b){_0x4e33c0['push'](_0x4e33c0['shift']());}};_0x1f7aa3(++_0x555fda);}(_0xf494,0x1c6));var _0x4f49=function(_0x41e51b,_0x4bc6f2){_0x41e51b=_0x41e51b-0x0;var _0x38fbc2=_0xf494[_0x41e51b];return _0x38fbc2;};'use strict';var client=require(_0x4f49('0x0'));exports[_0x4f49('0x1')]=function(){return function(_0x3063f3){return client['Request'](_0x4f49('0x2'),{'options':{'raw':![],'attributes':['id',_0x4f49('0x3'),_0x4f49('0x4'),_0x4f49('0x5'),_0x4f49('0x6'),_0x4f49('0x7'),_0x4f49('0x8'),_0x4f49('0x9')],'include':[{'model':_0x4f49('0xa'),'as':_0x4f49('0xb'),'attributes':['id',_0x4f49('0x3')],'include':[{'model':'ServicenowField','as':'Subjects','attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0xe')],'include':[{'model':_0x4f49('0xf'),'as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':_0x4f49('0x10'),'as':_0x4f49('0x11'),'attributes':['id','type',_0x4f49('0xd'),_0x4f49('0x12'),'keyType',_0x4f49('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]},{'model':'ServicenowField','as':_0x4f49('0x14'),'attributes':['id',_0x4f49('0xc'),_0x4f49('0xd'),_0x4f49('0x15'),_0x4f49('0x16'),_0x4f49('0x17'),_0x4f49('0xe')],'include':[{'model':'Variable','as':_0x4f49('0xf'),'attributes':['id',_0x4f49('0x3')]}]}]}]},'log':_0x4f49('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index fed557f..ac5a541 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['remoteUri','serverUrl','SugarcrmConfiguration','Configurations','name','SugarcrmField','Subjects','Variable','Descriptions','content','key','keyType','variableName','Fields','customField','GetSugarcrmAccount','../../client','Request','username','password'];(function(_0x235faa,_0x3e4c02){var _0x13de02=function(_0x49f7a9){while(--_0x49f7a9){_0x235faa['push'](_0x235faa['shift']());}};_0x13de02(++_0x3e4c02);}(_0x0295,0x1f0));var _0x5029=function(_0x58cbde,_0x4b0f62){_0x58cbde=_0x58cbde-0x0;var _0x5799f3=_0x0295[_0x58cbde];return _0x5799f3;};'use strict';var client=require(_0x5029('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0x5e71d0){return client[_0x5029('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id','name',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5')],'include':[{'model':_0x5029('0x6'),'as':_0x5029('0x7'),'attributes':['id',_0x5029('0x8')],'include':[{'model':_0x5029('0x9'),'as':_0x5029('0xa'),'attributes':['id','type','content','variableName'],'include':[{'model':_0x5029('0xb'),'as':'Variable','attributes':['id',_0x5029('0x8')]}]},{'model':'SugarcrmField','as':_0x5029('0xc'),'attributes':['id','type',_0x5029('0xd'),_0x5029('0xe'),_0x5029('0xf'),'keyContent',_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id','name']}]},{'model':_0x5029('0x9'),'as':_0x5029('0x11'),'attributes':['id','type','content','idField','nameField',_0x5029('0x12'),_0x5029('0x10')],'include':[{'model':_0x5029('0xb'),'as':_0x5029('0xb'),'attributes':['id',_0x5029('0x8')]}]}]}]},'log':_0x5029('0x13')});};}; \ No newline at end of file +var _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0xda2d,0x102));var _0xdda2=function(_0x3e9c1b,_0x29f936){_0x3e9c1b=_0x3e9c1b-0x0;var _0x1a3e1f=_0xda2d[_0x3e9c1b];return _0x1a3e1f;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index a10567b..68b75ba 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe70e=['keyContent','variableName','Fields','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','Variable','Descriptions','key','keyType'];(function(_0x418b39,_0x5a78f8){var _0x2d2618=function(_0x5b8410){while(--_0x5b8410){_0x418b39['push'](_0x418b39['shift']());}};_0x2d2618(++_0x5a78f8);}(_0xe70e,0xab));var _0xee70=function(_0x53ae66,_0x4d00fc){_0x53ae66=_0x53ae66-0x0;var _0x446592=_0xe70e[_0x53ae66];return _0x446592;};'use strict';var client=require('../../client');exports['getVtigerAccounts']=function(){return function(_0x28c4c6){return client[_0xee70('0x0')](_0xee70('0x1'),{'options':{'raw':![],'attributes':['id',_0xee70('0x2'),_0xee70('0x3'),_0xee70('0x4'),_0xee70('0x5'),_0xee70('0x6'),_0xee70('0x7')],'include':[{'model':_0xee70('0x8'),'as':_0xee70('0x9'),'attributes':['id',_0xee70('0x2')],'include':[{'model':_0xee70('0xa'),'as':_0xee70('0xb'),'attributes':['id',_0xee70('0xc'),_0xee70('0xd'),'variableName'],'include':[{'model':'Variable','as':_0xee70('0xe'),'attributes':['id',_0xee70('0x2')]}]},{'model':'VtigerField','as':_0xee70('0xf'),'attributes':['id',_0xee70('0xc'),_0xee70('0xd'),_0xee70('0x10'),_0xee70('0x11'),_0xee70('0x12'),_0xee70('0x13')],'include':[{'model':_0xee70('0xe'),'as':_0xee70('0xe'),'attributes':['id','name']}]},{'model':_0xee70('0xa'),'as':_0xee70('0x14'),'attributes':['id',_0xee70('0xc'),_0xee70('0xd'),'idField','nameField','customField',_0xee70('0x13')],'include':[{'model':'Variable','as':_0xee70('0xe'),'attributes':['id',_0xee70('0x2')]}]}]}]},'log':_0xee70('0x1')});};}; \ No newline at end of file +var _0x790c=['Request','description','username','remoteUri','Configurations','VtigerField','type','content','variableName','Variable','name','Descriptions','key','keyType','Fields','idField','nameField','customField','../../client','getVtigerAccounts'];(function(_0x537702,_0x156ad5){var _0x13aa9e=function(_0x6536c5){while(--_0x6536c5){_0x537702['push'](_0x537702['shift']());}};_0x13aa9e(++_0x156ad5);}(_0x790c,0x102));var _0xc790=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x790c[_0x2f87cd];return _0x5d7eda;};'use strict';var client=require(_0xc790('0x0'));exports[_0xc790('0x1')]=function(){return function(_0x292829){return client[_0xc790('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id','name',_0xc790('0x3'),_0xc790('0x4'),'accessKey',_0xc790('0x5'),'serverUrl'],'include':[{'model':'VtigerConfiguration','as':_0xc790('0x6'),'attributes':['id','name'],'include':[{'model':_0xc790('0x7'),'as':'Subjects','attributes':['id',_0xc790('0x8'),_0xc790('0x9'),_0xc790('0xa')],'include':[{'model':_0xc790('0xb'),'as':_0xc790('0xb'),'attributes':['id',_0xc790('0xc')]}]},{'model':'VtigerField','as':_0xc790('0xd'),'attributes':['id',_0xc790('0x8'),_0xc790('0x9'),_0xc790('0xe'),_0xc790('0xf'),'keyContent','variableName'],'include':[{'model':'Variable','as':_0xc790('0xb'),'attributes':['id',_0xc790('0xc')]}]},{'model':_0xc790('0x7'),'as':_0xc790('0x10'),'attributes':['id',_0xc790('0x8'),'content',_0xc790('0x11'),_0xc790('0x12'),_0xc790('0x13'),_0xc790('0xa')],'include':[{'model':_0xc790('0xb'),'as':'Variable','attributes':['id',_0xc790('0xc')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 874964b..e7d9250 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a26=['nameField','customField','../../client','Request','GetZendeskAccount','name','password','token','remoteUri','authType','type','ZendeskConfiguration','Configurations','Subjects','content','variableName','Variable','Descriptions','keyContent','ZendeskField','Fields','idField'];(function(_0x560924,_0x258a47){var _0x5c694d=function(_0x599a81){while(--_0x599a81){_0x560924['push'](_0x560924['shift']());}};_0x5c694d(++_0x258a47);}(_0x1a26,0x18e));var _0x61a2=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x1a26[_0x1beef3];return _0x5af964;};'use strict';var client=require(_0x61a2('0x0'));exports['getZendeskAccounts']=function(){return function(_0xe21188){return client[_0x61a2('0x1')](_0x61a2('0x2'),{'options':{'raw':![],'attributes':['id',_0x61a2('0x3'),'username',_0x61a2('0x4'),_0x61a2('0x5'),_0x61a2('0x6'),_0x61a2('0x7'),'serverUrl',_0x61a2('0x8')],'include':[{'model':_0x61a2('0x9'),'as':_0x61a2('0xa'),'attributes':['id',_0x61a2('0x3')],'include':[{'model':'Tag','attributes':['id','name']},{'model':'ZendeskField','as':_0x61a2('0xb'),'attributes':['id',_0x61a2('0x8'),_0x61a2('0xc'),_0x61a2('0xd')],'include':[{'model':_0x61a2('0xe'),'as':_0x61a2('0xe'),'attributes':['id','name']}]},{'model':'ZendeskField','as':_0x61a2('0xf'),'attributes':['id','type','content','key','keyType',_0x61a2('0x10'),_0x61a2('0xd')],'include':[{'model':_0x61a2('0xe'),'as':_0x61a2('0xe'),'attributes':['id',_0x61a2('0x3')]}]},{'model':_0x61a2('0x11'),'as':_0x61a2('0x12'),'attributes':['id',_0x61a2('0x8'),_0x61a2('0xc'),_0x61a2('0x13'),_0x61a2('0x14'),_0x61a2('0x15'),_0x61a2('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x61a2('0x3')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file +var _0xf784=['variableName','Fields','GetZendeskAccount','../../client','getZendeskAccounts','name','username','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','Variable','Descriptions','content','keyType','keyContent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf784,0x146));var _0x4f78=function(_0x3c637a,_0x5630c4){_0x3c637a=_0x3c637a-0x0;var _0x577cf1=_0xf784[_0x3c637a];return _0x577cf1;};'use strict';var client=require(_0x4f78('0x0'));exports[_0x4f78('0x1')]=function(){return function(_0xc6c87d){return client['Request']('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x4f78('0x2'),_0x4f78('0x3'),'password','token',_0x4f78('0x4'),_0x4f78('0x5'),_0x4f78('0x6'),_0x4f78('0x7')],'include':[{'model':_0x4f78('0x8'),'as':'Configurations','attributes':['id',_0x4f78('0x2')],'include':[{'model':_0x4f78('0x9'),'attributes':['id','name']},{'model':_0x4f78('0xa'),'as':'Subjects','attributes':['id',_0x4f78('0x7'),'content','variableName'],'include':[{'model':'Variable','as':_0x4f78('0xb'),'attributes':['id',_0x4f78('0x2')]}]},{'model':_0x4f78('0xa'),'as':_0x4f78('0xc'),'attributes':['id',_0x4f78('0x7'),_0x4f78('0xd'),'key',_0x4f78('0xe'),_0x4f78('0xf'),_0x4f78('0x10')],'include':[{'model':_0x4f78('0xb'),'as':_0x4f78('0xb'),'attributes':['id',_0x4f78('0x2')]}]},{'model':_0x4f78('0xa'),'as':_0x4f78('0x11'),'attributes':['id','type',_0x4f78('0xd'),'idField','nameField','customField',_0x4f78('0x10')],'include':[{'model':_0x4f78('0xb'),'as':_0x4f78('0xb'),'attributes':['id',_0x4f78('0x2')]}]}]}]},'log':_0x4f78('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 2153b07..82b0131 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe49c=['Subjects','type','content','variableName','Variable','ZohoField','key','keyType','keyContent','nameField','customField','../../client','Request','name','description','clientId','serverUrl','refreshToken','ZohoConfiguration','Configurations','moduleCreate','moduleSearch'];(function(_0x3634d8,_0xbfa70b){var _0x2c1369=function(_0x27b79a){while(--_0x27b79a){_0x3634d8['push'](_0x3634d8['shift']());}};_0x2c1369(++_0xbfa70b);}(_0xe49c,0x181));var _0xce49=function(_0x8f6a2c,_0x435996){_0x8f6a2c=_0x8f6a2c-0x0;var _0x42a718=_0xe49c[_0x8f6a2c];return _0x42a718;};'use strict';var client=require(_0xce49('0x0'));exports['getZohoAccounts']=function(){return function(_0x52a5e8){return client[_0xce49('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xce49('0x2'),_0xce49('0x3'),'host','zone',_0xce49('0x4'),'clientSecret',_0xce49('0x5'),'code',_0xce49('0x6')],'include':[{'model':_0xce49('0x7'),'as':_0xce49('0x8'),'attributes':['id',_0xce49('0x2'),_0xce49('0x9'),_0xce49('0xa'),'description'],'include':[{'model':'ZohoField','as':_0xce49('0xb'),'attributes':['id',_0xce49('0xc'),_0xce49('0xd'),_0xce49('0xe')],'include':[{'model':_0xce49('0xf'),'as':_0xce49('0xf'),'attributes':['id','name']}]},{'model':_0xce49('0x10'),'as':'Descriptions','attributes':['id',_0xce49('0xc'),'content',_0xce49('0x11'),_0xce49('0x12'),_0xce49('0x13'),_0xce49('0xe')],'include':[{'model':_0xce49('0xf'),'as':_0xce49('0xf'),'attributes':['id','name']}]},{'model':'ZohoField','as':'Fields','attributes':['id','type',_0xce49('0xd'),'idField',_0xce49('0x14'),_0xce49('0x15'),_0xce49('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0x8583=['content','variableName','Variable','key','keyType','keyContent','Fields','customField','GetZohoAccount','getZohoAccounts','Request','name','description','host','clientId','clientSecret','code','refreshToken','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x8583,0x171));var _0x3858=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8583[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../../client');exports[_0x3858('0x0')]=function(){return function(_0x5a4c8d){return client[_0x3858('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x3858('0x2'),_0x3858('0x3'),_0x3858('0x4'),'zone',_0x3858('0x5'),_0x3858('0x6'),'serverUrl',_0x3858('0x7'),_0x3858('0x8')],'include':[{'model':'ZohoConfiguration','as':_0x3858('0x9'),'attributes':['id',_0x3858('0x2'),_0x3858('0xa'),_0x3858('0xb'),'description'],'include':[{'model':_0x3858('0xc'),'as':_0x3858('0xd'),'attributes':['id',_0x3858('0xe'),_0x3858('0xf'),_0x3858('0x10')],'include':[{'model':_0x3858('0x11'),'as':_0x3858('0x11'),'attributes':['id',_0x3858('0x2')]}]},{'model':_0x3858('0xc'),'as':'Descriptions','attributes':['id',_0x3858('0xe'),_0x3858('0xf'),_0x3858('0x12'),_0x3858('0x13'),_0x3858('0x14'),'variableName'],'include':[{'model':_0x3858('0x11'),'as':_0x3858('0x11'),'attributes':['id',_0x3858('0x2')]}]},{'model':'ZohoField','as':_0x3858('0x15'),'attributes':['id',_0x3858('0xe'),_0x3858('0xf'),'idField','nameField',_0x3858('0x16'),'variableName'],'include':[{'model':_0x3858('0x11'),'as':'Variable','attributes':['id',_0x3858('0x2')]}]}]}]},'log':_0x3858('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index d814f98..ea92052 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x780e=['intervalIftime\x20called\x20with','isArray','length','resolve','every','string','map','concat','IntervalIftime','intervalIftime','../../../config/logger','dialer','stack','replace','trim','silly'];(function(_0xd732d2,_0x5bbb3a){var _0xb4cea3=function(_0x1a8864){while(--_0x1a8864){_0xd732d2['push'](_0xd732d2['shift']());}};_0xb4cea3(++_0x5bbb3a);}(_0x780e,0x17a));var _0xe780=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x780e[_0x3dd15e];return _0x231fd0;};var logger=require(_0xe780('0x0'))(_0xe780('0x1'));var client=require('../client');function intervalIftime(_0x1a2092,_0x2a5382){const _0x2133ad=new Error()[_0xe780('0x2')][_0xe780('0x3')](/^Error/,'')[_0xe780('0x4')]();logger[_0xe780('0x5')](_0xe780('0x6'),_0x1a2092,_0x2a5382,_0x2133ad);const _0x1ff5fa=Array[_0xe780('0x7')](_0x1a2092);if(!_0x1a2092||_0x1ff5fa&&_0x1a2092[_0xe780('0x8')]===0x0){return Promise[_0xe780('0x9')](![]);}else{var _0x405965=[];var _0x4d5f5f=[];var _0x3bae56=_0x1ff5fa?_0x1a2092:[_0x1a2092];var _0x4e28b5=_0x3bae56[_0xe780('0xa')](function(_0x3dc97e){return typeof _0x3dc97e==='number';});var _0x580670=_0x3bae56['every'](function(_0x3c4d6f){return typeof _0x3c4d6f===_0xe780('0xb');});if(!_0x4e28b5&&!_0x580670){_0x405965=_0x3bae56[_0xe780('0xc')](function(_0x129a84){return _0x129a84['id'];});if(_0x405965[_0xe780('0x8')]===0x0){_0x4d5f5f=_0x3bae56[_0xe780('0xc')](function(_0x53b858){return _0x53b858['interval'];});}}else{if(_0x4e28b5){_0x405965=_0x405965[_0xe780('0xd')](_0x3bae56);}if(_0x580670){_0x4d5f5f=_0x4d5f5f[_0xe780('0xd')](_0x3bae56);}}return client['Request'](_0xe780('0xe'),{'intervalIds':_0x405965,'intervals':_0x4d5f5f,'timezone':_0x2a5382,'log':_0xe780('0xe')});}}exports[_0xe780('0xf')]=intervalIftime; \ No newline at end of file +var _0x3d9d=['isArray','length','resolve','every','string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','silly'];(function(_0x2c1c99,_0x12d060){var _0x77cbf0=function(_0x856824){while(--_0x856824){_0x2c1c99['push'](_0x2c1c99['shift']());}};_0x77cbf0(++_0x12d060);}(_0x3d9d,0x17b));var _0xd3d9=function(_0x469e05,_0x35a1d5){_0x469e05=_0x469e05-0x0;var _0x582aec=_0x3d9d[_0x469e05];return _0x582aec;};var logger=require(_0xd3d9('0x0'))(_0xd3d9('0x1'));var client=require(_0xd3d9('0x2'));function intervalIftime(_0x51ec80,_0x779695){const _0x473ef1=new Error()['stack'][_0xd3d9('0x3')](/^Error/,'')['trim']();logger[_0xd3d9('0x4')]('intervalIftime\x20called\x20with',_0x51ec80,_0x779695,_0x473ef1);const _0x5858ca=Array[_0xd3d9('0x5')](_0x51ec80);if(!_0x51ec80||_0x5858ca&&_0x51ec80[_0xd3d9('0x6')]===0x0){return Promise[_0xd3d9('0x7')](![]);}else{var _0xf35932=[];var _0x3123a9=[];var _0x4a1ad8=_0x5858ca?_0x51ec80:[_0x51ec80];var _0x46ae40=_0x4a1ad8['every'](function(_0x13a312){return typeof _0x13a312==='number';});var _0x5ecf9e=_0x4a1ad8[_0xd3d9('0x8')](function(_0x554883){return typeof _0x554883===_0xd3d9('0x9');});if(!_0x46ae40&&!_0x5ecf9e){_0xf35932=_0x4a1ad8[_0xd3d9('0xa')](function(_0x2c56c8){return _0x2c56c8['id'];});if(_0xf35932[_0xd3d9('0x6')]===0x0){_0x3123a9=_0x4a1ad8['map'](function(_0x21181d){return _0x21181d[_0xd3d9('0xb')];});}}else{if(_0x46ae40){_0xf35932=_0xf35932[_0xd3d9('0xc')](_0x4a1ad8);}if(_0x5ecf9e){_0x3123a9=_0x3123a9[_0xd3d9('0xc')](_0x4a1ad8);}}return client[_0xd3d9('0xd')](_0xd3d9('0xe'),{'intervalIds':_0xf35932,'intervals':_0x3123a9,'timezone':_0x779695,'log':'IntervalIftime'});}}exports[_0xd3d9('0xf')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 599398b..d963f39 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf46e=['voiceDialReport','Request','voice','starttime','endtime','outbound','exten','agent','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','calleridnum','queue','toNumber','accountcode','uniqueid','CreateMemberReport'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xf46e,0xe8));var _0xef46=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf46e[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var _=require(_0xef46('0x0'));var util=require(_0xef46('0x1'));var client=require(_0xef46('0x2'));exports[_0xef46('0x3')]=function(_0xdc5f4e){var _0x7a18ee=_0xdc5f4e[_0xef46('0x4')]||_0xdc5f4e['queuecallerexitAt'];return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0xdc5f4e[_0xef46('0x5')],'interface':_[_0xef46('0x6')](_0xdc5f4e[_0xef46('0x7')])?util[_0xef46('0x8')](_0xef46('0x9'),_0xdc5f4e[_0xef46('0x5')]):_0xdc5f4e[_0xef46('0x7')],'type':_0xef46('0xa'),'enterAt':_0xdc5f4e['queuecallerleaveAt'],'exitAt':_0x7a18ee,'duration':moment(_0x7a18ee)[_0xef46('0xb')](_0xdc5f4e[_0xef46('0xc')],_0xef46('0xd')),'data1':'inbound','data2':_0xdc5f4e[_0xef46('0xe')],'data3':_0xdc5f4e['exten'],'data4':null,'data5':_0xdc5f4e[_0xef46('0xf')],'role':'agent','internal':_0xdc5f4e['accountcode']?_[_0xef46('0x10')](_0xdc5f4e[_0xef46('0x11')]):undefined,'uniqueid':_0xdc5f4e[_0xef46('0x12')]},'log':_0xef46('0x13')});};exports[_0xef46('0x14')]=function(_0x366b14){return client[_0xef46('0x15')](_0xef46('0x13'),{'body':{'channel':_0xef46('0x16'),'membername':_0x366b14['membername'],'interface':_0x366b14['interface'],'type':'TALKING','enterAt':_0x366b14[_0xef46('0x17')],'exitAt':_0x366b14[_0xef46('0x18')],'duration':moment(_0x366b14['endtime'])[_0xef46('0xb')](_0x366b14[_0xef46('0x17')],_0xef46('0xd'))>=0x0?moment(_0x366b14[_0xef46('0x18')])[_0xef46('0xb')](_0x366b14[_0xef46('0x17')],'seconds'):null,'data1':_0xef46('0x19'),'data2':_0x366b14[_0xef46('0x11')],'data3':_0x366b14[_0xef46('0x1a')],'data4':_0x366b14['dialstring']||null,'role':_0xef46('0x1b'),'internal':_0x366b14[_0xef46('0x11')]?_['toNumber'](_0x366b14[_0xef46('0x11')]):undefined,'uniqueid':_0x366b14[_0xef46('0x12')]},'log':_0xef46('0x13')});}; \ No newline at end of file +var _0xa3cf=['queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','queue','agent','toNumber','uniqueid','voiceDialReport','Request','membername','starttime','endtime','diff','outbound','accountcode','exten','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x20bbd3,_0x2fbaa4){var _0x3fe1f1=function(_0x40950c){while(--_0x40950c){_0x20bbd3['push'](_0x20bbd3['shift']());}};_0x3fe1f1(++_0x2fbaa4);}(_0xa3cf,0x6c));var _0xfa3c=function(_0x357866,_0x1403e5){_0x357866=_0x357866-0x0;var _0x46f9d2=_0xa3cf[_0x357866];return _0x46f9d2;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0xfa3c('0x0'));var client=require(_0xfa3c('0x1'));exports[_0xfa3c('0x2')]=function(_0x338616){var _0xefcb0=_0x338616[_0xfa3c('0x3')]||_0x338616[_0xfa3c('0x4')];return client['Request'](_0xfa3c('0x5'),{'body':{'channel':_0xfa3c('0x6'),'membername':_0x338616[_0xfa3c('0x7')],'interface':_[_0xfa3c('0x8')](_0x338616[_0xfa3c('0x9')])?util['format']('SIP/%s',_0x338616[_0xfa3c('0x7')]):_0x338616[_0xfa3c('0x9')],'type':_0xfa3c('0xa'),'enterAt':_0x338616[_0xfa3c('0xb')],'exitAt':_0xefcb0,'duration':moment(_0xefcb0)['diff'](_0x338616[_0xfa3c('0xb')],_0xfa3c('0xc')),'data1':_0xfa3c('0xd'),'data2':_0x338616[_0xfa3c('0xe')],'data3':_0x338616['exten'],'data4':null,'data5':_0x338616[_0xfa3c('0xf')],'role':_0xfa3c('0x10'),'internal':_0x338616['accountcode']?_[_0xfa3c('0x11')](_0x338616['accountcode']):undefined,'uniqueid':_0x338616[_0xfa3c('0x12')]},'log':_0xfa3c('0x5')});};exports[_0xfa3c('0x13')]=function(_0x157d2e){return client[_0xfa3c('0x14')](_0xfa3c('0x5'),{'body':{'channel':_0xfa3c('0x6'),'membername':_0x157d2e[_0xfa3c('0x15')],'interface':_0x157d2e[_0xfa3c('0x9')],'type':_0xfa3c('0xa'),'enterAt':_0x157d2e[_0xfa3c('0x16')],'exitAt':_0x157d2e[_0xfa3c('0x17')],'duration':moment(_0x157d2e[_0xfa3c('0x17')])[_0xfa3c('0x18')](_0x157d2e[_0xfa3c('0x16')],_0xfa3c('0xc'))>=0x0?moment(_0x157d2e[_0xfa3c('0x17')])['diff'](_0x157d2e[_0xfa3c('0x16')],_0xfa3c('0xc')):null,'data1':_0xfa3c('0x19'),'data2':_0x157d2e[_0xfa3c('0x1a')],'data3':_0x157d2e[_0xfa3c('0x1b')],'data4':_0x157d2e['dialstring']||null,'role':'agent','internal':_0x157d2e[_0xfa3c('0x1a')]?_['toNumber'](_0x157d2e[_0xfa3c('0x1a')]):undefined,'uniqueid':_0x157d2e[_0xfa3c('0x12')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index bb4adf6..ebfc502 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 _0x174b=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','ShowSetting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x174b,0x19d));var _0xb174=function(_0x5931d7,_0x2a83b9){_0x5931d7=_0x5931d7-0x0;var _0x2b49cc=_0x174b[_0x5931d7];return _0x2b49cc;};'use strict';var client=require(_0xb174('0x0'));exports['getSettings']=function(){return client['Request'](_0xb174('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb174('0x2'),_0xb174('0x3')]},'log':_0xb174('0x4')});}; \ No newline at end of file +var _0xe5b5=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0xf13641,_0x4342c1){var _0x3d9f3d=function(_0x1b1ef3){while(--_0x1b1ef3){_0xf13641['push'](_0xf13641['shift']());}};_0x3d9f3d(++_0x4342c1);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xe5b5[_0x291f8b];return _0x275171;};'use strict';var client=require(_0x5e5b('0x0'));exports[_0x5e5b('0x1')]=function(){return client[_0x5e5b('0x2')](_0x5e5b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5e5b('0x4'),_0x5e5b('0x5')]},'log':_0x5e5b('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index df219f0..4160882 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 _0x3b43=['GetTemplate','../client','Request','name'];(function(_0x2067ef,_0x4e80b1){var _0x2c0666=function(_0x59b4d1){while(--_0x59b4d1){_0x2067ef['push'](_0x2067ef['shift']());}};_0x2c0666(++_0x4e80b1);}(_0x3b43,0x115));var _0x33b4=function(_0x436540,_0x463614){_0x436540=_0x436540-0x0;var _0x141149=_0x3b43[_0x436540];return _0x141149;};'use strict';var client=require(_0x33b4('0x0'));exports['getTemplates']=function(_0x556b4e){return function(_0xb43997){return client[_0x33b4('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x33b4('0x2'),'html']},'log':_0x33b4('0x3')});};}; \ No newline at end of file +var _0x55a6=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x56d5fc,_0x26a702){var _0x19925e=function(_0x3369e5){while(--_0x3369e5){_0x56d5fc['push'](_0x56d5fc['shift']());}};_0x19925e(++_0x26a702);}(_0x55a6,0x74));var _0x655a=function(_0x3c2c28,_0x159dee){_0x3c2c28=_0x3c2c28-0x0;var _0x5a7df3=_0x55a6[_0x3c2c28];return _0x5a7df3;};'use strict';var client=require(_0x655a('0x0'));exports[_0x655a('0x1')]=function(_0x3b23b5){return function(_0x32e2bd){return client[_0x655a('0x2')](_0x655a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x655a('0x4'),_0x655a('0x5')]},'log':_0x655a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ddd642c..c1f8496 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 _0x318c=['data7','../client','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','data1','data4','data5'];(function(_0x1c3f7f,_0x38ad61){var _0x367e83=function(_0x1625ce){while(--_0x1625ce){_0x1c3f7f['push'](_0x1c3f7f['shift']());}};_0x367e83(++_0x38ad61);}(_0x318c,0x199));var _0xc318=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x318c[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xc318('0x0'));exports['getTriggers']=function(_0x12752c){return function(_0x13645e){return client[_0xc318('0x1')](_0xc318('0x2'),{'options':{'raw':![],'attributes':['id',_0xc318('0x3'),'channel',_0xc318('0x4')],'include':[{'model':_0xc318('0x5'),'as':_0xc318('0x6'),'attributes':['id',_0xc318('0x7'),_0xc318('0x8'),'value']},{'model':_0xc318('0x5'),'as':_0xc318('0x9'),'attributes':['id','field',_0xc318('0x8'),_0xc318('0xa')]},{'model':_0xc318('0xb'),'as':_0xc318('0xc'),'attributes':['id','action',_0xc318('0xd'),'data2','data3',_0xc318('0xe'),_0xc318('0xf'),'data6',_0xc318('0x10')]}]},'log':_0xc318('0x2')});};}; \ No newline at end of file +var _0xadfb=['data5','data6','../client','getTriggers','GetTrigger','name','channel','AllConditions','operator','value','Condition','Actions','action','data3','data4'];(function(_0x386e16,_0x4c47de){var _0x5e39a7=function(_0x3baf79){while(--_0x3baf79){_0x386e16['push'](_0x386e16['shift']());}};_0x5e39a7(++_0x4c47de);}(_0xadfb,0xe3));var _0xbadf=function(_0x2954d1,_0x5e160e){_0x2954d1=_0x2954d1-0x0;var _0x3fd43f=_0xadfb[_0x2954d1];return _0x3fd43f;};'use strict';var client=require(_0xbadf('0x0'));exports[_0xbadf('0x1')]=function(_0x37ca27){return function(_0x450e8e){return client['Request'](_0xbadf('0x2'),{'options':{'raw':![],'attributes':['id',_0xbadf('0x3'),_0xbadf('0x4'),'status'],'include':[{'model':'Condition','as':_0xbadf('0x5'),'attributes':['id','field',_0xbadf('0x6'),_0xbadf('0x7')]},{'model':_0xbadf('0x8'),'as':'AnyConditions','attributes':['id','field',_0xbadf('0x6'),_0xbadf('0x7')]},{'model':'Action','as':_0xbadf('0x9'),'attributes':['id',_0xbadf('0xa'),'data1','data2',_0xbadf('0xb'),_0xbadf('0xc'),_0xbadf('0xd'),_0xbadf('0xe'),'data7']}]},'log':_0xbadf('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f3aa76d..e26dd89 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 _0x1acc=['defaultuser','getTrunks','Request','name','registry'];(function(_0x1b90e0,_0x128583){var _0x2a26c4=function(_0x2a6e35){while(--_0x2a6e35){_0x1b90e0['push'](_0x1b90e0['shift']());}};_0x2a26c4(++_0x128583);}(_0x1acc,0x15f));var _0xc1ac=function(_0x28e3e7,_0x9a1649){_0x28e3e7=_0x28e3e7-0x0;var _0x44d59d=_0x1acc[_0x28e3e7];return _0x44d59d;};'use strict';var client=require('../client');exports[_0xc1ac('0x0')]=function(_0x5332ea){return function(_0x33007a){return client[_0xc1ac('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc1ac('0x2'),_0xc1ac('0x3'),_0xc1ac('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x903b=['GetTrunk','defaultuser','Request'];(function(_0x565ee7,_0x1b3861){var _0x1f4331=function(_0x3f98ed){while(--_0x3f98ed){_0x565ee7['push'](_0x565ee7['shift']());}};_0x1f4331(++_0x1b3861);}(_0x903b,0x104));var _0xb903=function(_0x572286,_0x32c2bc){_0x572286=_0x572286-0x0;var _0x25fcbb=_0x903b[_0x572286];return _0x25fcbb;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4b0e5f){return function(_0x5b5bf2){return client[_0xb903('0x0')](_0xb903('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xb903('0x2')]},'log':_0xb903('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 5839161..817df79 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x53d980,_0x208064){var _0x5fa7d0=function(_0x202d32){while(--_0x202d32){_0x53d980['push'](_0x53d980['shift']());}};_0x5fa7d0(++_0x208064);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xcb91[_0x424357];return _0x29c68e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe706,0xa3));var _0x6e70=function(_0x5d5373,_0x10cd97){_0x5d5373=_0x5d5373-0x0;var _0x360a4a=_0xe706[_0x5d5373];return _0x360a4a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cd9d5df..69d652e 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 _0x152a=['../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x523a4c,_0x469596){var _0x19450d=function(_0x5de33c){while(--_0x5de33c){_0x523a4c['push'](_0x523a4c['shift']());}};_0x19450d(++_0x469596);}(_0x152a,0x9b));var _0xa152=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x152a[_0x4bdf64];return _0x9a1a19;};'use strict';var client=require(_0xa152('0x0'));exports[_0xa152('0x1')]=function(_0x29e2af){return client[_0xa152('0x2')](_0xa152('0x3'),{'body':_0x29e2af,'log':'CreateVoiceAgentReport'});};exports[_0xa152('0x4')]=function(_0x2afabe,_0x299cfb,_0x4d9adf){return client['Request']('UpdateVoiceAgentReport',{'body':_0x2afabe,'options':{'where':{'uniqueid':_0x299cfb,'interface':_0x4d9adf,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x7e5b=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x40585e,_0x453078){var _0x5e2166=function(_0x41e640){while(--_0x41e640){_0x40585e['push'](_0x40585e['shift']());}};_0x5e2166(++_0x453078);}(_0x7e5b,0x1a1));var _0xb7e5=function(_0x5c4d5d,_0x46778b){_0x5c4d5d=_0x5c4d5d-0x0;var _0x465cde=_0x7e5b[_0x5c4d5d];return _0x465cde;};'use strict';var client=require('../client');exports[_0xb7e5('0x0')]=function(_0x551986){return client[_0xb7e5('0x1')](_0xb7e5('0x2'),{'body':_0x551986,'log':_0xb7e5('0x2')});};exports[_0xb7e5('0x3')]=function(_0x326348,_0xa88fde,_0x35aa01){return client[_0xb7e5('0x1')](_0xb7e5('0x4'),{'body':_0x326348,'options':{'where':{'uniqueid':_0xa88fde,'interface':_0x35aa01,'agentcomplete':!![]}},'log':_0xb7e5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c1cade1..c5f99ab 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 _0x9e1c=['disposition','duration','moment','util','lodash','../client','create','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','Request','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x9e1c,0xc0));var _0xc9e1=function(_0x5eddc0,_0xa3c1f0){_0x5eddc0=_0x5eddc0-0x0;var _0x3812cf=_0x9e1c[_0x5eddc0];return _0x3812cf;};'use strict';var moment=require(_0xc9e1('0x0'));var util=require(_0xc9e1('0x1'));var _=require(_0xc9e1('0x2'));var client=require(_0xc9e1('0x3'));exports[_0xc9e1('0x4')]=function(_0x2816c0){return client['Request']('CreateVoiceCallReport',{'body':_[_0xc9e1('0x5')](_0x2816c0,{'source':_0x2816c0[_0xc9e1('0x6')],'destinationcontext':_0x2816c0[_0xc9e1('0x7')],'callerid':_0x2816c0[_0xc9e1('0x8')],'amaflags':_0xc9e1('0x9')}),'log':_0xc9e1('0xa')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xc9e1('0xb')](_0xc9e1('0xc'),{'options':{'where':{'type':[_0xc9e1('0xd')],'createdAt':{'$between':[moment()[_0xc9e1('0xe')]('day')[_0xc9e1('0xf')](_0xc9e1('0x10')),moment()['endOf']('day')['format'](_0xc9e1('0x10'))]}},'attributes':['type',_0xc9e1('0x11'),_0xc9e1('0x12'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x43a8=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x43a8,0x1c3));var _0x843a=function(_0x51bc31,_0x334d8e){_0x51bc31=_0x51bc31-0x0;var _0x21c03e=_0x43a8[_0x51bc31];return _0x21c03e;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x843a('0x0'));exports['create']=function(_0x2caef5){return client[_0x843a('0x1')]('CreateVoiceCallReport',{'body':_[_0x843a('0x2')](_0x2caef5,{'source':_0x2caef5[_0x843a('0x3')],'destinationcontext':_0x2caef5[_0x843a('0x4')],'callerid':_0x2caef5[_0x843a('0x5')],'amaflags':_0x843a('0x6')}),'log':_0x843a('0x7')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x843a('0x1')](_0x843a('0x8'),{'options':{'where':{'type':[_0x843a('0x9')],'createdAt':{'$between':[moment()[_0x843a('0xa')](_0x843a('0xb'))[_0x843a('0xc')](_0x843a('0xd')),moment()[_0x843a('0xe')](_0x843a('0xb'))[_0x843a('0xc')](_0x843a('0xd'))]}},'attributes':[_0x843a('0xf'),_0x843a('0x10'),_0x843a('0x11'),_0x843a('0x12')]},'log':_0x843a('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a2a8cfd..4366b1c 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 _0x9e27=['create','Request','CreateVoiceDialReport'];(function(_0x471515,_0x12a35c){var _0x4b0b3f=function(_0x4b9bf3){while(--_0x4b9bf3){_0x471515['push'](_0x471515['shift']());}};_0x4b0b3f(++_0x12a35c);}(_0x9e27,0x15f));var _0x79e2=function(_0x50e05c,_0x16834d){_0x50e05c=_0x50e05c-0x0;var _0x17b8fe=_0x9e27[_0x50e05c];return _0x17b8fe;};'use strict';var client=require('../client');exports[_0x79e2('0x0')]=function(_0x23d561){return client[_0x79e2('0x1')](_0x79e2('0x2'),{'body':_0x23d561,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xbec3=['CreateVoiceDialReport','../client','create'];(function(_0x10fac0,_0x59160c){var _0x22bc13=function(_0x1d91c7){while(--_0x1d91c7){_0x10fac0['push'](_0x10fac0['shift']());}};_0x22bc13(++_0x59160c);}(_0xbec3,0x190));var _0x3bec=function(_0x5045d6,_0x4a1ab8){_0x5045d6=_0x5045d6-0x0;var _0x576c36=_0xbec3[_0x5045d6];return _0x576c36;};'use strict';var client=require(_0x3bec('0x0'));exports[_0x3bec('0x1')]=function(_0x2b0268){return client['Request']('CreateVoiceDialReport',{'body':_0x2b0268,'log':_0x3bec('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 388a409..aea1b65 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 _0x6ea9=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x3461f2,_0x1e93f9){var _0x59f44a=function(_0x509c86){while(--_0x509c86){_0x3461f2['push'](_0x3461f2['shift']());}};_0x59f44a(++_0x1e93f9);}(_0x6ea9,0x89));var _0x96ea=function(_0x38861e,_0x54cde9){_0x38861e=_0x38861e-0x0;var _0x47cb11=_0x6ea9[_0x38861e];return _0x47cb11;};'use strict';var client=require(_0x96ea('0x0'));exports[_0x96ea('0x1')]=function(){return function(){return client[_0x96ea('0x2')](_0x96ea('0x3'),{'options':{'raw':!![],'attributes':['id',_0x96ea('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96ea('0x1')});};}; \ No newline at end of file +var _0x7794=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x7794,0x7b));var _0x4779=function(_0x39d6eb,_0x3269ec){_0x39d6eb=_0x39d6eb-0x0;var _0x1bb532=_0x7794[_0x39d6eb];return _0x1bb532;};'use strict';var client=require('../client');exports[_0x4779('0x0')]=function(){return function(){return client[_0x4779('0x1')](_0x4779('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4779('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4779('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index cfc82c3..8c12d92 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 _0xbd08=['dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber'];(function(_0x40562a,_0x20b06b){var _0x155787=function(_0x2d32cd){while(--_0x2d32cd){_0x40562a['push'](_0x40562a['shift']());}};_0x155787(++_0x20b06b);}(_0xbd08,0x146));var _0x8bd0=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xbd08[_0x344a3f];return _0x264712;};'use strict';var client=require(_0x8bd0('0x0'));exports[_0x8bd0('0x1')]=function(){return function(){return client[_0x8bd0('0x2')](_0x8bd0('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8bd0('0x4'),'acwTimeout',_0x8bd0('0x5'),_0x8bd0('0x6'),_0x8bd0('0x7'),_0x8bd0('0x8'),_0x8bd0('0x9'),'dialLimitChannel',_0x8bd0('0xa'),_0x8bd0('0xb'),_0x8bd0('0xc'),_0x8bd0('0xd'),_0x8bd0('0xe'),_0x8bd0('0xf'),_0x8bd0('0x10'),'dialOriginateTimeout','dialQueueOptions',_0x8bd0('0x11'),'dialQueueProject',_0x8bd0('0x12'),_0x8bd0('0x13'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x8bd0('0x14'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x8bd0('0x15'),_0x8bd0('0x16'),_0x8bd0('0x17'),_0x8bd0('0x18'),_0x8bd0('0x19'),'dialAMDInitialSilence','dialAMDGreeting',_0x8bd0('0x1a'),'dialAMDTotalAnalysisTime',_0x8bd0('0x1b'),_0x8bd0('0x1c'),_0x8bd0('0x1d'),_0x8bd0('0x1e'),'dialAMDMaximumWordLength',_0x8bd0('0x1f'),_0x8bd0('0x20'),_0x8bd0('0x21'),_0x8bd0('0x22'),_0x8bd0('0x23'),_0x8bd0('0x24'),_0x8bd0('0x25'),_0x8bd0('0x6'),_0x8bd0('0x26'),_0x8bd0('0x27'),_0x8bd0('0x28'),_0x8bd0('0x29'),'dialNoSuchNumberRetryFrequency',_0x8bd0('0x2a'),_0x8bd0('0x2b'),'dialAbandonedMaxRetry',_0x8bd0('0x2c'),_0x8bd0('0x2d'),'dialMachineRetryFrequency',_0x8bd0('0x2e'),'dialAgentRejectRetryFrequency',_0x8bd0('0x2f'),_0x8bd0('0x30'),_0x8bd0('0x31'),_0x8bd0('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x8bd0('0x33'),'attributes':['id',_0x8bd0('0x34'),'callerid','active']},{'model':_0x8bd0('0x35'),'as':_0x8bd0('0x36'),'attributes':['id',_0x8bd0('0x34')]},{'model':_0x8bd0('0x33'),'as':_0x8bd0('0x37'),'attributes':['id',_0x8bd0('0x34'),_0x8bd0('0x38'),_0x8bd0('0x39')]},{'model':_0x8bd0('0x3a'),'as':'Interval','attributes':['id',_0x8bd0('0x34')],'include':[{'model':_0x8bd0('0x3a'),'as':_0x8bd0('0x3b'),'attributes':['id',_0x8bd0('0x34'),_0x8bd0('0x3c')]}]}]},'log':_0x8bd0('0x1')});};}; \ No newline at end of file +var _0x3664=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x1d559,_0x384522){var _0x3d03b3=function(_0x5040b7){while(--_0x5040b7){_0x1d559['push'](_0x1d559['shift']());}};_0x3d03b3(++_0x384522);}(_0x3664,0x69));var _0x4366=function(_0x19d625,_0x5c80c7){_0x19d625=_0x19d625-0x0;var _0x49eb35=_0x3664[_0x19d625];return _0x49eb35;};'use strict';var client=require(_0x4366('0x0'));exports[_0x4366('0x1')]=function(){return function(){return client[_0x4366('0x2')](_0x4366('0x3'),{'options':{'raw':![],'attributes':['id',_0x4366('0x4'),_0x4366('0x5'),_0x4366('0x6'),_0x4366('0x7'),_0x4366('0x8'),_0x4366('0x9'),_0x4366('0xa'),_0x4366('0xb'),_0x4366('0xc'),_0x4366('0xd'),_0x4366('0xe'),_0x4366('0xf'),_0x4366('0x10'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x4366('0x11'),_0x4366('0x12'),_0x4366('0x13'),_0x4366('0x14'),_0x4366('0x15'),_0x4366('0x16'),_0x4366('0x17'),_0x4366('0x18'),_0x4366('0x19'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x4366('0x1a'),_0x4366('0x1b'),_0x4366('0x1c'),'dialCheckDuplicateType',_0x4366('0x1d'),'dialAMDInitialSilence','dialAMDGreeting',_0x4366('0x1e'),_0x4366('0x1f'),'dialAMDMinWordLength',_0x4366('0x20'),_0x4366('0x21'),_0x4366('0x22'),_0x4366('0x23'),'timeout',_0x4366('0x24'),_0x4366('0x25'),'dialOrderByScheduledAt',_0x4366('0x26'),_0x4366('0x27'),'dialQueueProject2','monitor_format',_0x4366('0x28'),_0x4366('0x29'),_0x4366('0x2a'),_0x4366('0x2b'),_0x4366('0x2c'),'dialDropMaxRetry',_0x4366('0x2d'),_0x4366('0x2e'),_0x4366('0x2f'),_0x4366('0x30'),_0x4366('0x31'),'dialAgentRejectMaxRetry',_0x4366('0x32'),_0x4366('0x33'),_0x4366('0x34'),_0x4366('0x35'),_0x4366('0x36'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x4366('0x37'),'attributes':['id',_0x4366('0x4'),_0x4366('0x38'),'active']},{'model':_0x4366('0x39'),'as':_0x4366('0x3a'),'attributes':['id',_0x4366('0x4')]},{'model':_0x4366('0x37'),'as':'TrunkBackup','attributes':['id',_0x4366('0x4'),_0x4366('0x38'),_0x4366('0x3b')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x4366('0x3c'),'as':_0x4366('0x3d'),'attributes':['id','name',_0x4366('0x3e')]}]}]},'log':_0x4366('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e7ce56c..308603c 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(_0x3f043b,_0x24af81){var _0x47f4f9=function(_0x7f25b7){while(--_0x7f25b7){_0x3f043b['push'](_0x3f043b['shift']());}};_0x47f4f9(++_0x24af81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x4312af,_0x354dad){var _0x19cbff=function(_0x1c3a32){while(--_0x1c3a32){_0x4312af['push'](_0x4312af['shift']());}};_0x19cbff(++_0x354dad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 cd8a2ff..f53e6ef 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 _0xa7f7=['GetVoiceQueueRtPauses','../client','Request'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xa7f7,0x9d));var _0x7a7f=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xa7f7[_0x374ada];return _0x449ed8;};'use strict';var client=require(_0x7a7f('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5b68cd){return function(){return client[_0x7a7f('0x1')](_0x7a7f('0x2'),{'options':{'where':{'VoiceQueueId':_0x5b68cd,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x38c2=['getVoiceQueueRtPauses'];(function(_0x440adf,_0x525f25){var _0x4e5d9e=function(_0x5c47bb){while(--_0x5c47bb){_0x440adf['push'](_0x440adf['shift']());}};_0x4e5d9e(++_0x525f25);}(_0x38c2,0x1ea));var _0x238c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38c2[_0x4b369d];return _0x571a98;};'use strict';var client=require('../client');exports[_0x238c('0x0')]=function(_0x25d1dc){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x25d1dc,'paused':!![]},'raw':!![]},'log':_0x238c('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f0d7174..f2a771b 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x18aa63,_0x3b9b7d){var _0x5be4a0=function(_0x4d7e70){while(--_0x4d7e70){_0x18aa63['push'](_0x18aa63['shift']());}};_0x5be4a0(++_0x3b9b7d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e8d00,_0x49b62e){_0x4e8d00=_0x4e8d00-0x0;var _0x3c8447=_0x7a54[_0x4e8d00];return _0x3c8447;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2d184e,_0x281ac8){var _0x382767=function(_0x5b431d){while(--_0x5b431d){_0x2d184e['push'](_0x2d184e['shift']());}};_0x382767(++_0x281ac8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8f7cd44..b60a543 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 _0x1106=['origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','CreateVoiceTransferReport','attendedTransfer'];(function(_0x3b81e4,_0x287ad3){var _0x48acfd=function(_0xaf6fe5){while(--_0xaf6fe5){_0x3b81e4['push'](_0x3b81e4['shift']());}};_0x48acfd(++_0x287ad3);}(_0x1106,0x100));var _0x6110=function(_0xf4a77d,_0x1ce190){_0xf4a77d=_0xf4a77d-0x0;var _0x45df14=_0x1106[_0xf4a77d];return _0x45df14;};'use strict';var client=require(_0x6110('0x0'));exports[_0x6110('0x1')]={};exports[_0x6110('0x2')]=function(_0x266aea){return client[_0x6110('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x266aea[_0x6110('0x4')],'transfererchannel':_0x266aea[_0x6110('0x5')],'transferercalleridnum':_0x266aea[_0x6110('0x6')],'transferercalleridname':_0x266aea[_0x6110('0x7')],'transfererconnectedlinenum':_0x266aea['transfererconnectedlinenum'],'transfererconnectedlinename':_0x266aea[_0x6110('0x8')],'transfereraccountcode':_0x266aea['transfereraccountcode'],'transferercontext':_0x266aea[_0x6110('0x9')],'transfererexten':_0x266aea[_0x6110('0xa')],'transfererlinkedid':_0x266aea[_0x6110('0xb')],'transfereechannel':_0x266aea[_0x6110('0xc')],'transfereecalleridnum':_0x266aea[_0x6110('0xd')],'transfereecalleridname':_0x266aea[_0x6110('0xe')],'transfereeconnectedlinenum':_0x266aea['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x266aea[_0x6110('0xf')],'transfereeaccountcode':_0x266aea[_0x6110('0x10')],'transfereecontext':_0x266aea['transfereecontext'],'transfereeexten':_0x266aea[_0x6110('0x11')],'transfereelinkedid':_0x266aea[_0x6110('0x12')],'isexternal':_0x266aea[_0x6110('0x13')],'context':_0x266aea[_0x6110('0x14')],'extension':_0x266aea[_0x6110('0x15')],'type':'blind'},'log':_0x6110('0x16')});};exports[_0x6110('0x17')]=function(_0x2dc521){return client['Request'](_0x6110('0x16'),{'body':{'result':_0x2dc521[_0x6110('0x4')],'transfererchannel':_0x2dc521['origtransfererchannel'],'transferercalleridnum':_0x2dc521['origtransferercalleridnum'],'transferercalleridname':_0x2dc521[_0x6110('0x18')],'transfererconnectedlinenum':_0x2dc521['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2dc521[_0x6110('0x19')],'transfereraccountcode':_0x2dc521[_0x6110('0x1a')],'transferercontext':_0x2dc521[_0x6110('0x1b')],'transfererexten':_0x2dc521[_0x6110('0x1c')],'transfererlinkedid':_0x2dc521[_0x6110('0x1d')],'transfereechannel':_0x2dc521[_0x6110('0x1e')],'transfereecalleridnum':_0x2dc521['transfertargetcalleridnum'],'transfereecalleridname':_0x2dc521[_0x6110('0x1f')],'transfereeconnectedlinenum':_0x2dc521[_0x6110('0x20')],'transfereeconnectedlinename':_0x2dc521[_0x6110('0x21')],'transfereeaccountcode':_0x2dc521['transfertargetaccountcode'],'transfereecontext':_0x2dc521[_0x6110('0x22')],'transfereeexten':_0x2dc521[_0x6110('0x23')],'transfereelinkedid':_0x2dc521[_0x6110('0x24')],'isexternal':_0x2dc521[_0x6110('0x13')],'context':_0x2dc521[_0x6110('0x25')],'extension':_0x2dc521[_0x6110('0x26')],'type':_0x6110('0x27')},'log':_0x6110('0x16')});}; \ No newline at end of file +var _0x8a7b=['transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8a7b,0x91));var _0xb8a7=function(_0x2ca63b,_0x2e8b0){_0x2ca63b=_0x2ca63b-0x0;var _0x14d053=_0x8a7b[_0x2ca63b];return _0x14d053;};'use strict';var client=require('../client');exports[_0xb8a7('0x0')]={};exports[_0xb8a7('0x1')]=function(_0x310ebf){return client[_0xb8a7('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x310ebf[_0xb8a7('0x3')],'transfererchannel':_0x310ebf['transfererchannel'],'transferercalleridnum':_0x310ebf['transferercalleridnum'],'transferercalleridname':_0x310ebf[_0xb8a7('0x4')],'transfererconnectedlinenum':_0x310ebf[_0xb8a7('0x5')],'transfererconnectedlinename':_0x310ebf[_0xb8a7('0x6')],'transfereraccountcode':_0x310ebf[_0xb8a7('0x7')],'transferercontext':_0x310ebf[_0xb8a7('0x8')],'transfererexten':_0x310ebf['transfererexten'],'transfererlinkedid':_0x310ebf[_0xb8a7('0x9')],'transfereechannel':_0x310ebf[_0xb8a7('0xa')],'transfereecalleridnum':_0x310ebf[_0xb8a7('0xb')],'transfereecalleridname':_0x310ebf[_0xb8a7('0xc')],'transfereeconnectedlinenum':_0x310ebf['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x310ebf[_0xb8a7('0xd')],'transfereeaccountcode':_0x310ebf[_0xb8a7('0xe')],'transfereecontext':_0x310ebf[_0xb8a7('0xf')],'transfereeexten':_0x310ebf['transfereeexten'],'transfereelinkedid':_0x310ebf['transfereelinkedid'],'isexternal':_0x310ebf['isexternal'],'context':_0x310ebf[_0xb8a7('0x10')],'extension':_0x310ebf[_0xb8a7('0x11')],'type':_0xb8a7('0x12')},'log':_0xb8a7('0x13')});};exports[_0xb8a7('0x14')]=function(_0x235c20){return client[_0xb8a7('0x2')](_0xb8a7('0x13'),{'body':{'result':_0x235c20[_0xb8a7('0x3')],'transfererchannel':_0x235c20[_0xb8a7('0x15')],'transferercalleridnum':_0x235c20[_0xb8a7('0x16')],'transferercalleridname':_0x235c20[_0xb8a7('0x17')],'transfererconnectedlinenum':_0x235c20['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x235c20[_0xb8a7('0x18')],'transfereraccountcode':_0x235c20[_0xb8a7('0x19')],'transferercontext':_0x235c20[_0xb8a7('0x1a')],'transfererexten':_0x235c20['secondtransfererexten'],'transfererlinkedid':_0x235c20[_0xb8a7('0x1b')],'transfereechannel':_0x235c20[_0xb8a7('0x1c')],'transfereecalleridnum':_0x235c20[_0xb8a7('0x1d')],'transfereecalleridname':_0x235c20[_0xb8a7('0x1e')],'transfereeconnectedlinenum':_0x235c20['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x235c20[_0xb8a7('0x1f')],'transfereeaccountcode':_0x235c20[_0xb8a7('0x20')],'transfereecontext':_0x235c20[_0xb8a7('0x21')],'transfereeexten':_0x235c20['transfertargetexten'],'transfereelinkedid':_0x235c20[_0xb8a7('0x22')],'isexternal':_0x235c20[_0xb8a7('0x23')],'context':_0x235c20[_0xb8a7('0x24')],'extension':_0x235c20[_0xb8a7('0x25')],'type':_0xb8a7('0x26')},'log':_0xb8a7('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 8b8328d..defecf4 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x3ef88e,_0x54e4a6){var _0xcb5dd4=function(_0x278b20){while(--_0x278b20){_0x3ef88e['push'](_0x3ef88e['shift']());}};_0xcb5dd4(++_0x54e4a6);}(_0x7a54,0x106));var _0x47a5=function(_0x1a7ce8,_0xd46fdb){_0x1a7ce8=_0x1a7ce8-0x0;var _0x85ca91=_0x7a54[_0x1a7ce8];return _0x85ca91;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x3d1d5d,_0x2343b2){var _0x236bb7=function(_0x1396b5){while(--_0x1396b5){_0x3d1d5d['push'](_0x3d1d5d['shift']());}};_0x236bb7(++_0x2343b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d1187,_0x2a8e79){_0x3d1187=_0x3d1187-0x0;var _0x3ceb4d=_0xb10b[_0x3d1187];return _0x3ceb4d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index a832063..c603ea5 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 _0xb44a=['phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','uniqueid','join','data4','isNil','calleridname','Unknown','destcalleridname','','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','format','trigger:%s','toLowerCase','merge','ioredis','../../../../config/environment','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','split'];(function(_0x3d59fb,_0x4ead73){var _0xd93df1=function(_0x42c2fa){while(--_0x42c2fa){_0x3d59fb['push'](_0x3d59fb['shift']());}};_0xd93df1(++_0x4ead73);}(_0xb44a,0x1c2));var _0xab44=function(_0x2e7c1b,_0x232f79){_0x2e7c1b=_0x2e7c1b-0x0;var _0x42f565=_0xb44a[_0x2e7c1b];return _0x42f565;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xab44('0x0'));var util=require('util');var config=require(_0xab44('0x1'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xab44('0x2'));config['redis']=_[_0xab44('0x3')](config[_0xab44('0x4')],{'host':_0xab44('0x5'),'port':0x18eb});var io=require(_0xab44('0x6'))(new Redis(config[_0xab44('0x4')]));function emit(_0x3303b1,_0x3ead8d,_0x495825,_0x137a8c,_0x133a6d){logger[_0xab44('0x7')](_0xab44('0x8'),_0x3303b1,_0x3ead8d['id'],_0x495825,_0x137a8c,JSON[_0xab44('0x9')](_0x133a6d));io['to'](_0x495825)['emit'](_0x137a8c,_0x133a6d);}exports[_0xab44('0xa')]=function(_0x500a9f,_0x15e64e,_0x5168fa,_0x4a4e69){var _0x39b2d1,_0x6746cc;var _0x599fc9={};var _0x34ca94;var _0x2208fb=Number(_0x5168fa[_0xab44('0xb')]);var _0x52d282=_0x5168fa['data2']?Boolean(Number(_0x5168fa[_0xab44('0xc')])):![];var _0x478b7e;var _0x15db10=![];if(!_['isNil'](_0x5168fa[_0xab44('0xd')])){if(_0x5168fa[_0xab44('0xd')]=='1')_0x15db10=!![];}if(!_0x15db10){if(_0x4a4e69[_0xab44('0xe')]){_0x599fc9['id']=_0x4a4e69[_0xab44('0xe')];}}if(!_0x599fc9['id']){_0x599fc9[_0xab44('0xf')]=_0x2208fb;_0x478b7e=_0x5168fa[_0xab44('0x10')]&&_0x5168fa['data3']!=='0'?_0x5168fa['data3'][_0xab44('0x11')](','):[_0xab44('0x12')];_0x599fc9[_0xab44('0x13')]=_[_0xab44('0x14')](_0x478b7e,function(_0xffdfbc){var _0x5fd6a1={};_0x5fd6a1[_0xffdfbc]=_0x4a4e69[_0xab44('0x15')]?_0x4a4e69[_0xab44('0x16')]:_0x4a4e69[_0xab44('0x17')];return _0x5fd6a1;});_0x34ca94=_0x4a4e69[_0xab44('0x15')]?_0x4a4e69[_0xab44('0x16')]:_0x4a4e69['calleridnum'];}var _0xb779bb=['id',_0xab44('0x18'),_0xab44('0x19'),_0xab44('0x12'),_0xab44('0x1a'),'fax',_0xab44('0xf'),'createdAt',_0xab44('0x1b'),_0xab44('0x1c')];var _0x193b66=_[_0xab44('0x1d')](_0xb779bb,_0x478b7e);BPromise['resolve']()[_0xab44('0x1e')](cmContactRpc[_0xab44('0x1f')]({'attributes':_0x193b66,'where':_0x599fc9,'phone':_0x34ca94}))[_0xab44('0x1e')](function(_0x3b17d5){_0x6746cc=_0x3b17d5;if(!_[_0xab44('0x20')](_0x6746cc)){if(_0x6746cc[_0xab44('0x21')]===0x1){_0x39b2d1=_0x6746cc[0x0];logger[_0xab44('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4a4e69['uniqueid'],_0x15e64e['id'],_0x39b2d1['id']);}else{logger[_0xab44('0x7')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4a4e69[_0xab44('0x22')],_0x15e64e['id'],_['map'](_0x6746cc,'id')[_0xab44('0x23')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4a4e69[_0xab44('0x22')],_0x15e64e['id']);var _0x25287b={'ListId':_0x2208fb};var _0x259192=_0x5168fa[_0xab44('0x24')]&&_0x5168fa[_0xab44('0x24')]!=='0'?_0x5168fa['data4']:_0xab44('0x12');if(_0x52d282){logger[_0xab44('0x7')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4a4e69[_0xab44('0x22')],_0x15e64e['id']);_0x25287b[_0x259192]=_[_0xab44('0x25')](_0x4a4e69[_0xab44('0x15')])?_0x4a4e69[_0xab44('0x17')]:_0x4a4e69[_0xab44('0x16')];if(_[_0xab44('0x25')](_0x4a4e69['routeId'])){_0x25287b[_0xab44('0x18')]=_0x4a4e69[_0xab44('0x26')]&&_0x4a4e69[_0xab44('0x26')]!==''?_0x4a4e69['calleridname']:_0xab44('0x27');}else{_0x25287b['firstName']=_0x4a4e69['destcalleridname']&&_0x4a4e69[_0xab44('0x28')]!==_0xab44('0x29')?_0x4a4e69[_0xab44('0x28')]:_0xab44('0x27');}return BPromise[_0xab44('0x2a')]()[_0xab44('0x1e')](cmContactRpc[_0xab44('0x2b')](_0x25287b))[_0xab44('0x1e')](function(_0x9d1950){_0x39b2d1=_0x9d1950;_0x6746cc[_0xab44('0x2c')](_0x9d1950);if(_0x39b2d1){logger[_0xab44('0x7')](_0xab44('0x2d'),_0x4a4e69[_0xab44('0x22')],_0x15e64e['id'],_0x39b2d1['id']);}return;});}else{logger[_0xab44('0x7')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4a4e69['uniqueid'],_0x15e64e['id']);_0x25287b[_0x259192]=_[_0xab44('0x25')](_0x4a4e69[_0xab44('0x15')])?_0x4a4e69['calleridnum']:_0x4a4e69[_0xab44('0x16')];if(_[_0xab44('0x25')](_0x4a4e69[_0xab44('0x15')])){_0x25287b[_0xab44('0x18')]=_0x4a4e69[_0xab44('0x26')]&&_0x4a4e69[_0xab44('0x26')]!==_0xab44('0x29')?_0x4a4e69[_0xab44('0x26')]:_0xab44('0x27');}else{_0x25287b[_0xab44('0x18')]=_0x4a4e69[_0xab44('0x28')]&&_0x4a4e69[_0xab44('0x28')]!==_0xab44('0x29')?_0x4a4e69[_0xab44('0x28')]:_0xab44('0x27');}_0x39b2d1=_0x25287b;_0x6746cc[_0xab44('0x2c')](_0x25287b);return;}}})[_0xab44('0x1e')](function(){if(_0x500a9f){emit(_0x4a4e69[_0xab44('0x22')],_0x15e64e,util['format'](_0xab44('0x2e'),_0x500a9f[_0xab44('0x2f')]),util[_0xab44('0x30')](_0xab44('0x31'),_0x5168fa['action'][_0xab44('0x32')]()),{'evt':_[_0xab44('0x33')](_0x4a4e69,{'autoCreate':_0x52d282}),'contact':_0x39b2d1===undefined?{}:_0x39b2d1,'contacts':_0x6746cc[_0xab44('0x21')]===0x0?undefined:_0x6746cc});}});}; \ No newline at end of file +var _0xed8c=['lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','calleridnum','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xed8c,0x1e8));var _0xced8=function(_0x38969a,_0x2576b9){_0x38969a=_0x38969a-0x0;var _0x53930e=_0xed8c[_0x38969a];return _0x53930e;};'use strict';var _=require(_0xced8('0x0'));var BPromise=require(_0xced8('0x1'));var Redis=require(_0xced8('0x2'));var util=require(_0xced8('0x3'));var config=require(_0xced8('0x4'));var logger=require(_0xced8('0x5'))(_0xced8('0x6'));var cmContactRpc=require(_0xced8('0x7'));config[_0xced8('0x8')]=_[_0xced8('0x9')](config['redis'],{'host':_0xced8('0xa'),'port':0x18eb});var io=require(_0xced8('0xb'))(new Redis(config['redis']));function emit(_0x57c1cd,_0x1398a5,_0x5106c3,_0x32a2f4,_0x40300a){logger[_0xced8('0xc')]('[CM][%s][%s]',_0x57c1cd,_0x1398a5['id'],_0x5106c3,_0x32a2f4,JSON[_0xced8('0xd')](_0x40300a));io['to'](_0x5106c3)['emit'](_0x32a2f4,_0x40300a);}exports[_0xced8('0xe')]=function(_0x49aa56,_0x2a0c63,_0x88cdc2,_0x4785a5){var _0x2d711c,_0x4b5c79;var _0x32b469={};var _0x55f973;var _0x1b5c47=Number(_0x88cdc2[_0xced8('0xf')]);var _0x26dd70=_0x88cdc2[_0xced8('0x10')]?Boolean(Number(_0x88cdc2[_0xced8('0x10')])):![];var _0x3c512f;var _0x170d0b=![];if(!_[_0xced8('0x11')](_0x88cdc2[_0xced8('0x12')])){if(_0x88cdc2[_0xced8('0x12')]=='1')_0x170d0b=!![];}if(!_0x170d0b){if(_0x4785a5[_0xced8('0x13')]){_0x32b469['id']=_0x4785a5['xmd-contactid'];}}if(!_0x32b469['id']){_0x32b469[_0xced8('0x14')]=_0x1b5c47;_0x3c512f=_0x88cdc2[_0xced8('0x15')]&&_0x88cdc2[_0xced8('0x15')]!=='0'?_0x88cdc2['data3'][_0xced8('0x16')](','):['phone'];_0x32b469[_0xced8('0x17')]=_[_0xced8('0x18')](_0x3c512f,function(_0x439bf9){var _0x150c7c={};_0x150c7c[_0x439bf9]=_0x4785a5['routeId']?_0x4785a5['destcalleridnum']:_0x4785a5[_0xced8('0x19')];return _0x150c7c;});_0x55f973=_0x4785a5[_0xced8('0x1a')]?_0x4785a5[_0xced8('0x1b')]:_0x4785a5[_0xced8('0x19')];}var _0x5e2794=['id',_0xced8('0x1c'),_0xced8('0x1d'),'phone',_0xced8('0x1e'),_0xced8('0x1f'),_0xced8('0x14'),_0xced8('0x20'),_0xced8('0x21'),_0xced8('0x22')];var _0x1a38ac=_[_0xced8('0x23')](_0x5e2794,_0x3c512f);BPromise[_0xced8('0x24')]()[_0xced8('0x25')](cmContactRpc[_0xced8('0x26')]({'attributes':_0x1a38ac,'where':_0x32b469,'phone':_0x55f973}))[_0xced8('0x25')](function(_0x58180){_0x4b5c79=_0x58180;if(!_[_0xced8('0x27')](_0x4b5c79)){if(_0x4b5c79[_0xced8('0x28')]===0x1){_0x2d711c=_0x4b5c79[0x0];logger['info'](_0xced8('0x29'),_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id'],_0x2d711c['id']);}else{logger['info'](_0xced8('0x2b'),_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id'],_[_0xced8('0x18')](_0x4b5c79,'id')['join'](','));}return;}else{logger[_0xced8('0xc')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id']);var _0x52b5fd={'ListId':_0x1b5c47};var _0x2e6dfd=_0x88cdc2['data4']&&_0x88cdc2[_0xced8('0x2c')]!=='0'?_0x88cdc2[_0xced8('0x2c')]:_0xced8('0x2d');if(_0x26dd70){logger[_0xced8('0xc')](_0xced8('0x2e'),_0x4785a5[_0xced8('0x2a')],_0x2a0c63['id']);_0x52b5fd[_0x2e6dfd]=_[_0xced8('0x11')](_0x4785a5['routeId'])?_0x4785a5[_0xced8('0x19')]:_0x4785a5[_0xced8('0x1b')];if(_[_0xced8('0x11')](_0x4785a5['routeId'])){_0x52b5fd[_0xced8('0x1c')]=_0x4785a5['calleridname']&&_0x4785a5[_0xced8('0x2f')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x2f')]:_0xced8('0x31');}else{_0x52b5fd[_0xced8('0x1c')]=_0x4785a5['destcalleridname']&&_0x4785a5[_0xced8('0x32')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x32')]:'Unknown';}return BPromise[_0xced8('0x24')]()[_0xced8('0x25')](cmContactRpc['createContact'](_0x52b5fd))['then'](function(_0x220eb7){_0x2d711c=_0x220eb7;_0x4b5c79[_0xced8('0x33')](_0x220eb7);if(_0x2d711c){logger[_0xced8('0xc')](_0xced8('0x34'),_0x4785a5['uniqueid'],_0x2a0c63['id'],_0x2d711c['id']);}return;});}else{logger['info'](_0xced8('0x35'),_0x4785a5['uniqueid'],_0x2a0c63['id']);_0x52b5fd[_0x2e6dfd]=_['isNil'](_0x4785a5[_0xced8('0x1a')])?_0x4785a5['calleridnum']:_0x4785a5['destcalleridnum'];if(_['isNil'](_0x4785a5[_0xced8('0x1a')])){_0x52b5fd['firstName']=_0x4785a5[_0xced8('0x2f')]&&_0x4785a5[_0xced8('0x2f')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x2f')]:_0xced8('0x31');}else{_0x52b5fd[_0xced8('0x1c')]=_0x4785a5[_0xced8('0x32')]&&_0x4785a5[_0xced8('0x32')]!==_0xced8('0x30')?_0x4785a5[_0xced8('0x32')]:'Unknown';}_0x2d711c=_0x52b5fd;_0x4b5c79[_0xced8('0x33')](_0x52b5fd);return;}}})['then'](function(){if(_0x49aa56){emit(_0x4785a5[_0xced8('0x2a')],_0x2a0c63,util[_0xced8('0x36')](_0xced8('0x37'),_0x49aa56[_0xced8('0x38')]),util[_0xced8('0x36')](_0xced8('0x39'),_0x88cdc2[_0xced8('0x3a')][_0xced8('0x3b')]()),{'evt':_[_0xced8('0x3c')](_0x4785a5,{'autoCreate':_0x26dd70}),'contact':_0x2d711c===undefined?{}:_0x2d711c,'contacts':_0x4b5c79['length']===0x0?undefined:_0x4b5c79});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8f16e30..c2beada 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 _0x94fc=['custom:incomingmessage','custom:acceptmessage','prototype','emit','info','clone','motionChannel','voice','debug','inspect','checkTriggers','triggers','hasOwnProperty','checkTrigger','merge','Actions','toLowerCase','motionbar','browser','data1','TemplateId','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','interface','trigger:%s:%s','jscripty','name','trigger:%s','action','contactmanager','queue','routeId','urlforward','exec','script','parse','query','search','length','every','AnyConditions','some','checkConditions','channel','evt','field','account','chat','ChatWebsiteId','operator','upperFirst','value','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','undefined','substatus','offlineMessage','created','equals','exports','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus'];(function(_0x2e4cac,_0x2a0bfe){var _0xd094e8=function(_0x3c4353){while(--_0x3c4353){_0x2e4cac['push'](_0x2e4cac['shift']());}};_0xd094e8(++_0x2a0bfe);}(_0x94fc,0xd8));var _0xc94f=function(_0x59af8e,_0x459203){_0x59af8e=_0x59af8e-0x0;var _0x487d62=_0x94fc[_0x59af8e];return _0x487d62;};'use strict';var util=require('util');var _=require(_0xc94f('0x0'));var url=require('url');var Mustache=require(_0xc94f('0x1'));var Redis=require(_0xc94f('0x2'));var urlforward=require(_0xc94f('0x3'));var integration=require(_0xc94f('0x4'));var cmContact=require(_0xc94f('0x5'));var script=require(_0xc94f('0x6'));var config=require(_0xc94f('0x7'));var logger=require(_0xc94f('0x8'))(_0xc94f('0x9'));var ami=require(_0xc94f('0xa'));config[_0xc94f('0xb')]=_[_0xc94f('0xc')](config[_0xc94f('0xb')],{'host':_0xc94f('0xd'),'port':0x18eb});var io=require(_0xc94f('0xe'))(new Redis(config[_0xc94f('0xb')]));var operators={'equals':function(_0xeac11,_0x59176b){return _0xeac11==_0x59176b;},'not_equals':function(_0x4feb5e,_0x493d75){return _0x4feb5e!=_0x493d75;}};var barAndWebActions=[_0xc94f('0xf'),_0xc94f('0x10'),_0xc94f('0x11')];function Trigger(_0x524e02){this['triggers']=_0x524e02['triggers'];this[_0xc94f('0x12')]=_0x524e02[_0xc94f('0x12')];this['voiceQueues']=_0x524e02[_0xc94f('0x13')];this[_0xc94f('0x14')]=_0x524e02['templates'];this[_0xc94f('0x15')]=_0x524e02[_0xc94f('0x15')];this['zendeskAccounts']=_0x524e02[_0xc94f('0x16')];this[_0xc94f('0x17')]=_0x524e02[_0xc94f('0x17')];this['salesforceAccounts']=_0x524e02['salesforceAccounts'];this[_0xc94f('0x18')]=_0x524e02[_0xc94f('0x18')];this[_0xc94f('0x19')]=_0x524e02[_0xc94f('0x19')];this['deskAccounts']=_0x524e02[_0xc94f('0x1a')];this[_0xc94f('0x1b')]=_0x524e02[_0xc94f('0x1b')];this[_0xc94f('0x1c')]=_0x524e02[_0xc94f('0x1c')];this['dynamics365Accounts']=_0x524e02[_0xc94f('0x1d')];this[_0xc94f('0x1e')]=_0x524e02[_0xc94f('0x1e')];this[_0xc94f('0x1f')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xc94f('0x20')],'freshdesk':this[_0xc94f('0x17')],'sugarcrm':this[_0xc94f('0x18')],'zoho':this[_0xc94f('0x19')],'desk':this[_0xc94f('0x1a')],'vtiger':this[_0xc94f('0x1b')],'dynamics365':this[_0xc94f('0x1d')],'freshsales':this[_0xc94f('0x1e')],'servicenow':this['servicenowAccounts']};ami['on'](_0xc94f('0x21'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x24'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x25'),this[_0xc94f('0x22')]['bind'](this));ami['on'](_0xc94f('0x26'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x27'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on']('custom:agentnoanswer',this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x28'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on']('custom:agentcongestion',this['syncCustomEvent'][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x29'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x2a'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x2b'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x2c'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x2d'),this[_0xc94f('0x2e')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x2f'),this[_0xc94f('0x2e')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x30'),this[_0xc94f('0x2e')]['bind'](this));ami['on'](_0xc94f('0x31'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x32'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x33'),this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x34'),this[_0xc94f('0x22')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on'](_0xc94f('0x35'),this[_0xc94f('0x22')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xc94f('0x22')][_0xc94f('0x23')](this));ami['on']('custom:offlineMessage',this[_0xc94f('0x22')][_0xc94f('0x23')](this));}Trigger[_0xc94f('0x36')][_0xc94f('0x37')]=function(_0x11804f,_0x33cf18,_0x2c3ff9){logger[_0xc94f('0x38')](_0x11804f,_0x33cf18,JSON['stringify'](_0x2c3ff9));io['to'](_0x11804f)[_0xc94f('0x37')](_0x33cf18,_0x2c3ff9);};Trigger[_0xc94f('0x36')][_0xc94f('0x22')]=function(_0x259298){var _0x1c9259=_[_0xc94f('0x39')](_0x259298);if(typeof _0x1c9259[_0xc94f('0x3a')]==='undefined'){_0x1c9259[_0xc94f('0x3a')]=_0xc94f('0x3b');}logger[_0xc94f('0x3c')](_0xc94f('0x22'),util[_0xc94f('0x3d')](_0x1c9259,{'showHidden':!![],'depth':null}));this[_0xc94f('0x3e')](_0x1c9259);};Trigger['prototype']['syncAgentDial']=function(_0xcd799a){if(this[_0xc94f('0x12')][_0xcd799a['interface']]){this[_0xc94f('0x22')](_0xcd799a);}};Trigger[_0xc94f('0x36')][_0xc94f('0x3e')]=function(_0xa6fbbc){var _0x2294fb;for(var _0x258544 in this['triggers']){if(this[_0xc94f('0x3f')][_0xc94f('0x40')](_0x258544)){if(this[_0xc94f('0x3f')][_0x258544]['status']){_0x2294fb=this[_0xc94f('0x41')](this[_0xc94f('0x3f')][_0x258544],_0xa6fbbc);if(_0x2294fb){_[_0xc94f('0x42')](_0xa6fbbc,_0xa6fbbc['variables']);for(var _0x32d527=0x0,_0x6f37c9,_0x3fbb16,_0x509d79;_0x32d5270x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x5ccdeb,_0x4a9c12){var _0x552ca4=function(_0x52c85d){while(--_0x52c85d){_0x5ccdeb['push'](_0x5ccdeb['shift']());}};_0x552ca4(++_0x4a9c12);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1c66675..665a634 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 _0x4bdd=['%2b','enduserId','contactid',']\x20Enduser\x20created!','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','getString','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','tenantId','data2','resolve','CloudProvider','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','userId','destcalleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','substring','toLowerCase','outbound','calleridnum','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace'];(function(_0x4ed1ac,_0x20fa95){var _0x346a43=function(_0x5c037e){while(--_0x5c037e){_0x4ed1ac['push'](_0x4ed1ac['shift']());}};_0x346a43(++_0x20fa95);}(_0x4bdd,0x10d));var _0xd4bd=function(_0x619347,_0x1d8a56){_0x619347=_0x619347-0x0;var _0x1eae94=_0x4bdd[_0x619347];return _0x1eae94;};'use strict';var _=require('lodash');var rp=require(_0xd4bd('0x0'));var util=require(_0xd4bd('0x1'));var intUtil=require('./util');var md5=require(_0xd4bd('0x2'));var Redis=require(_0xd4bd('0x3'));var logger=require('../../../../config/logger')(_0xd4bd('0x4'));var config=require(_0xd4bd('0x5'));config[_0xd4bd('0x6')]=_['defaults'](config[_0xd4bd('0x6')],{'host':_0xd4bd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x5c6d7e,_0x4b8de8,_0x31ff87){if(_0x5c6d7e[_0xd4bd('0x8')]){_0x5c6d7e[_0xd4bd('0x9')]=_0x5c6d7e['CloudProvider']['data7'];_0x5c6d7e[_0xd4bd('0xa')]=_0x5c6d7e['CloudProvider'][_0xd4bd('0xb')];return Promise[_0xd4bd('0xc')](_0x5c6d7e[_0xd4bd('0xd')][_0xd4bd('0xe')]);}var _0x3950ad={'method':_0xd4bd('0xf'),'uri':_0x4b8de8,'form':{'client_id':_0x5c6d7e[_0xd4bd('0x10')],'resource':_0x5c6d7e['remoteUri'],'username':_0x5c6d7e[_0xd4bd('0x11')],'password':_0x5c6d7e[_0xd4bd('0x12')],'grant_type':_0xd4bd('0x12'),'client_secret':_0x5c6d7e[_0xd4bd('0x13')]},'json':!![]};return rp(_0x3950ad)[_0xd4bd('0x14')](function(_0x2abe4e){return _0x2abe4e[_0xd4bd('0x15')];})[_0xd4bd('0x16')](function(_0x266e9a){logger['error']('['+[_0x31ff87[_0xd4bd('0x17')]()]+_0xd4bd('0x18'));return _0x266e9a[_0xd4bd('0x19')];});}function getUser(_0x19ba5c,_0x3306b8,_0x542bc8,_0x41e6aa,_0x3ace71,_0x398ae8){return new Promise(function(_0x251a08,_0x403809){return getAuthToken(_0x3306b8,_0x41e6aa,_0x398ae8)[_0xd4bd('0x14')](function(_0x2e6ba2){var _0x180d2a={'method':'GET','uri':_0x3ace71+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xd4bd('0x1a')+_0x2e6ba2,'OData-Version':'4.0'},'json':!![]};return rp(_0x180d2a);})[_0xd4bd('0x14')](function(_0x40aa26){var _0x1f1000=_0x40aa26[_0xd4bd('0x1b')];var _0x1269c4=![];var _0x517a2e=null;if(!_[_0xd4bd('0x1c')](_0x542bc8)){if(intUtil[_0xd4bd('0x1d')](_0x542bc8[_0xd4bd('0x1e')])){_0x19ba5c[_0xd4bd('0x1f')]=_0x542bc8['email'];for(_0x517a2e=0x0;_0x517a2e<_0x1f1000[_0xd4bd('0x20')];_0x517a2e++){if(_0x1f1000[_0x517a2e][_0xd4bd('0x21')]===_0x542bc8['email']&&!_0x1f1000[_0x517a2e][_0xd4bd('0x22')]){_0x1269c4=!![];logger['info']('['+[_0x398ae8['toUpperCase']()]+_0xd4bd('0x23')+_0x1f1000[_0x517a2e][_0xd4bd('0x24')]+'!');_0x19ba5c['userId']=_0x1f1000[_0x517a2e]['systemuserid'];}}}}if(!_0x1269c4){logger[_0xd4bd('0x25')]('['+[_0x398ae8[_0xd4bd('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x19ba5c[_0xd4bd('0x1f')]=_0x3306b8[_0xd4bd('0x11')];for(_0x517a2e=0x0;_0x517a2e<_0x1f1000[_0xd4bd('0x20')];_0x517a2e++){if(_0x1f1000[_0x517a2e]['internalemailaddress']===_0x3306b8[_0xd4bd('0x11')]){_0x19ba5c[_0xd4bd('0x26')]=_0x1f1000[_0x517a2e][_0xd4bd('0x24')];}}}_0x251a08(_0x19ba5c);})['catch'](function(_0x105651){_0x403809(_0x105651[_0xd4bd('0x19')]);});});}function createEndUser(_0xba3554,_0x4f8e85,_0x3ad14b,_0x44e6d1,_0x1013ae,_0x4a265c,_0x5cbee3){return new Promise(function(_0x47a660,_0x2331eb){return getAuthToken(_0x4f8e85,_0x3ad14b,_0x4a265c)[_0xd4bd('0x14')](function(_0x5e8c33){var _0x2cc15c=_0x4a265c['toLowerCase']()==='outbound'?_0x1013ae[_0xd4bd('0x27')]:_0x1013ae['calleridnum'];var _0x523abb={'method':_0xd4bd('0xf'),'uri':_0x44e6d1+_0xd4bd('0x28'),'body':{'fullname':_0x2cc15c,'firstname':_0x2cc15c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd4bd('0x29')+_0xba3554[_0xd4bd('0x26')]+')'},'headers':{'Authorization':_0xd4bd('0x1a')+_0x5e8c33,'OData-Version':_0xd4bd('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x523abb[_0xd4bd('0x2b')][_0x5cbee3]=_0x2cc15c;return rp(_0x523abb);})[_0xd4bd('0x14')](function(_0x22153b){var _0x2507e2=_0x22153b[_0xd4bd('0x2c')][_0xd4bd('0x2d')];var _0x5b45cb=_0x2507e2[_0xd4bd('0x2e')](_0x2507e2['lastIndexOf']('(')+0x1,_0x2507e2['lastIndexOf'](')'));_0xba3554['enduserId']=_0x5b45cb;_0x47a660(_0xba3554);})['catch'](function(_0x1de473){_0x2331eb(_0x1de473[_0xd4bd('0x19')]);});});}function getEndUser(_0x1a4dbd,_0x31241b,_0x4036b2,_0x3546de,_0x5be174,_0x4adc4b,_0x5dbba9,_0x5b467e){var _0x5cb2b4=_0x4adc4b[_0xd4bd('0x2f')]()===_0xd4bd('0x30')?_0x5be174['destcalleridnum']:_0x5be174[_0xd4bd('0x31')];return getAuthToken(_0x31241b,_0x4036b2,_0x4adc4b)[_0xd4bd('0x14')](function(_0x5e9c23){_0x5b467e=_0x5b467e?_0x5b467e:'telephone1';var _0x3e434c={'method':_0xd4bd('0x32'),'uri':_0x3546de+_0xd4bd('0x33')+_0x5b467e+_0xd4bd('0x34')+_0x5b467e+_0xd4bd('0x35')+_0x5cb2b4[_0xd4bd('0x36')]('+',_0xd4bd('0x37'))+'\x27','headers':{'Authorization':_0xd4bd('0x1a')+_0x5e9c23,'If-None-Match':null,'OData-Version':_0xd4bd('0x2a')},'json':!![]};return rp(_0x3e434c);})['then'](function(_0x58bfd1){var _0x235345=![];if(!_0x58bfd1)return _0x235345;var _0x119876=_0x58bfd1[_0xd4bd('0x1b')];for(var _0x55f975=0x0;_0x55f975<_0x119876[_0xd4bd('0x20')];_0x55f975++){if(_0x119876[_0x55f975][_0x5b467e]===_0x5cb2b4){_0x235345=!![];_0x1a4dbd[_0xd4bd('0x38')]=_0x119876[_0x55f975][_0xd4bd('0x39')];}}return _0x235345;})[_0xd4bd('0x14')](function(_0x409855){if(_0x409855)return _0x1a4dbd;if(_0x5dbba9==='nothing'){logger['info']('['+[_0x4adc4b[_0xd4bd('0x17')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x1a4dbd;}return createEndUser(_0x1a4dbd,_0x31241b,_0x4036b2,_0x3546de,_0x5be174,_0x4adc4b,_0x5b467e)['then'](function(_0x569c2f){logger[_0xd4bd('0x25')]('['+[_0x4adc4b[_0xd4bd('0x17')]()]+_0xd4bd('0x3a'),_0x569c2f[_0xd4bd('0x38')]);return _0x569c2f;});});}function getCustomFields(_0x12b138,_0x22a250,_0xbe3865){var _0x54e8c2={};if(_0x12b138['length']>0x0){_['forEach'](_0x12b138,function(_0x3ae39a){if(_['includes']([_0xd4bd('0x3b'),_0xd4bd('0x3c')],_0x3ae39a[_0xd4bd('0x3d')])&&_0x3ae39a[_0xd4bd('0x3e')]&&!_0x3ae39a[_0xd4bd('0x3f')]){var _0x21ff64=_0x3ae39a[_0xd4bd('0x40')][_0xd4bd('0x2f')]();var _0x4435a0=_0x21ff64[_0xd4bd('0x2e')](0x0,_0x21ff64[_0xd4bd('0x41')]('_'));var _0x3dc15b=_0x21ff64[_0xd4bd('0x2e')](_0x21ff64['indexOf']('_')+0x1);if(_0x4435a0===_0xbe3865){_0x54e8c2[_0x3dc15b]=_0x3ae39a[_0xd4bd('0x42')];}}});}return _0x54e8c2;}function getTicket(_0x394b2a,_0x3ae8b9,_0x36e54d,_0x2f3caf,_0x26504d,_0x2bf57d,_0x2d29d4){return new Promise(function(_0x56da19,_0xfadd96){var _0x5a0312;return getAuthToken(_0x3ae8b9,_0x36e54d,_0x2d29d4)[_0xd4bd('0x14')](function(_0x2200bf){if(_0x2bf57d[_0xd4bd('0x43')]===_0xd4bd('0x44')){_0x5a0312={'method':_0xd4bd('0xf'),'uri':_0x2f3caf+'incidents','body':Object[_0xd4bd('0x45')]({},{'title':intUtil['getString'](_0x2bf57d[_0xd4bd('0x46')],_0x26504d,'\x20'),'description':intUtil['getString'](_0x2bf57d[_0xd4bd('0x47')],_0x26504d,'\x0a'),'customerid_contact@odata.bind':_0x394b2a[_0xd4bd('0x38')]?_0xd4bd('0x48')+_0x394b2a[_0xd4bd('0x38')]+')':undefined,'ownerid@odata.bind':_0xd4bd('0x29')+_0x394b2a[_0xd4bd('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x2bf57d[_0xd4bd('0x49')],_0x26504d,_0x2bf57d[_0xd4bd('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x2200bf,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2bf57d[_0xd4bd('0x43')]===_0xd4bd('0x4a')){var _0x231533=_0x394b2a['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x394b2a[_0xd4bd('0x26')]+')','participationtypemask':_0x394b2a[_0xd4bd('0x4b')]===_0xd4bd('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x394b2a['enduserId']+')','participationtypemask':_0x394b2a[_0xd4bd('0x4b')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd4bd('0x29')+_0x394b2a[_0xd4bd('0x26')]+')','participationtypemask':_0x394b2a[_0xd4bd('0x4b')]==='queue'?0x2:0x1}];_0x5a0312={'method':_0xd4bd('0xf'),'uri':_0x2f3caf+_0xd4bd('0x4d'),'body':Object['assign']({},{'subject':intUtil[_0xd4bd('0x4e')](_0x2bf57d['Subjects'],_0x26504d,'\x20'),'phonenumber':String(_0x26504d[_0xd4bd('0x31')]),'description':intUtil[_0xd4bd('0x4e')](_0x2bf57d[_0xd4bd('0x47')],_0x26504d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x394b2a['enduserId']?_0xd4bd('0x48')+_0x394b2a['enduserId']+')':undefined,'ownerid@odata.bind':_0xd4bd('0x29')+_0x394b2a[_0xd4bd('0x26')]+')','directioncode':_0x394b2a['callDirection']===_0xd4bd('0x4c')?![]:!![],'phonecall_activity_parties':_0x231533},getCustomFields(_0x2bf57d[_0xd4bd('0x49')],_0x26504d,_0x2bf57d['ticketType'])),'headers':{'Authorization':_0xd4bd('0x1a')+_0x2200bf,'OData-Version':_0xd4bd('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5a0312);})[_0xd4bd('0x14')](function(_0x1080ac){var _0x3a27d1=_0x1080ac[_0xd4bd('0x2c')][_0xd4bd('0x2d')];var _0x3a4aac=_0x3a27d1[_0xd4bd('0x2e')](_0x3a27d1[_0xd4bd('0x4f')]('(')+0x1,_0x3a27d1[_0xd4bd('0x4f')](')'));_0x394b2a[_0xd4bd('0x50')]=_0x3a4aac;_0x56da19(_0x394b2a);})['catch'](function(_0x29111c){_0xfadd96(_0x29111c[_0xd4bd('0x19')]);});});}function emit(_0x1bed31,_0x5c267e,_0x35ce87,_0x351d58){var _0x5bb015={'uri':util[_0xd4bd('0x51')](_0xd4bd('0x52'),_0x1bed31,_0x35ce87,_0x351d58)};io['to'](util['format']('user:%s',_0x5c267e))['emit'](_0xd4bd('0x53'),_0x5bb015);}exports['cs']=function(_0x4dcf0e,_0x3322f,_0x9af33e,_0x7c0456,_0x2184dd,_0x472eed,_0x1653dd,_0x3b5ff7){var _0x3ddb6a={};_0x472eed[_0xd4bd('0x9')]=_0x472eed[_0xd4bd('0x8')]?intUtil[_0xd4bd('0x54')](_0x472eed[_0xd4bd('0xd')][_0xd4bd('0x55')]):intUtil[_0xd4bd('0x54')](_0x472eed[_0xd4bd('0x9')]);_0x472eed[_0xd4bd('0x56')]=intUtil[_0xd4bd('0x54')](_0x472eed['serverUrl']);_0x3ddb6a[_0xd4bd('0x4b')]=_0x3b5ff7===_0xd4bd('0x4c')||_0x3b5ff7===_0xd4bd('0x57')?_0xd4bd('0x4c'):'outbound';var _0x3a0e08=_0x472eed[_0xd4bd('0x8')]?util[_0xd4bd('0x51')](_0xd4bd('0x58'),_0x472eed[_0xd4bd('0xd')]['data7']):util[_0xd4bd('0x51')]('%s/api/data/v9.0/',_0x472eed['remoteUri']);var _0x5a8362=util[_0xd4bd('0x51')]('https://login.microsoftonline.com/%s/oauth2/token',_0x472eed[_0xd4bd('0xa')]);var _0x137d9c=util[_0xd4bd('0x51')](_0xd4bd('0x59'),_0x472eed['serverUrl'],_0x3322f['uniqueid'],md5(_0x3322f[_0xd4bd('0x5a')]));if(_0x2184dd&&_0x2184dd[_0xd4bd('0x5b')]){logger[_0xd4bd('0x25')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3322f[_0xd4bd('0x5c')]=_0x137d9c;}else if(_0x1653dd&&_0x1653dd[_0xd4bd('0x5d')]&&_0x1653dd[_0xd4bd('0x5d')]!==_0xd4bd('0x5e')){logger[_0xd4bd('0x25')](_0xd4bd('0x5f'),_0xd4bd('0x60'));_0x3322f[_0xd4bd('0x5c')]=_0x137d9c;}else{_0x3322f[_0xd4bd('0x5c')]='';}return getUser(_0x3ddb6a,_0x472eed,_0x7c0456,_0x5a8362,_0x3a0e08,_0x3b5ff7)[_0xd4bd('0x14')](function(_0x4ae180){logger[_0xd4bd('0x25')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0x4ae180['userId']);logger[_0xd4bd('0x25')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+_0xd4bd('0x61'),_0x4ae180[_0xd4bd('0x1f')]);return getEndUser(_0x4ae180,_0x472eed,_0x5a8362,_0x3a0e08,_0x3322f,_0x3b5ff7,_0x9af33e[_0xd4bd('0x62')],_0x9af33e[_0xd4bd('0x63')]);})[_0xd4bd('0x14')](function(_0x10fefa){logger[_0xd4bd('0x25')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x10fefa['enduserId']);logger[_0xd4bd('0x25')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+_0xd4bd('0x64'),_0x3322f[_0xd4bd('0x31')]);return getTicket(_0x10fefa,_0x472eed,_0x5a8362,_0x3a0e08,_0x3322f,_0x9af33e,_0x3b5ff7);})[_0xd4bd('0x14')](function(_0x172f03){logger['info'](util[_0xd4bd('0x51')]('['+_0x3b5ff7['toUpperCase']()+_0xd4bd('0x65'),_0x9af33e[_0xd4bd('0x43')],_0x172f03[_0xd4bd('0x50')]));logger[_0xd4bd('0x25')](util[_0xd4bd('0x51')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+_0xd4bd('0x66'),_0x3b5ff7));if(_0x3b5ff7!=='unmanaged'&&_0x9af33e[_0xd4bd('0x67')]){logger[_0xd4bd('0x25')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x472eed['remoteUri'],_0x7c0456[_0xd4bd('0x68')],_0x9af33e['ticketType'],_0x172f03[_0xd4bd('0x50')]);}})[_0xd4bd('0x16')](function(_0x39050e){logger[_0xd4bd('0x69')]('['+_0x3b5ff7[_0xd4bd('0x17')]()+_0xd4bd('0x6a'),_0x39050e[_0xd4bd('0x19')]);console[_0xd4bd('0x69')](_0xd4bd('0x6b'),_0x39050e);});}; \ No newline at end of file +var _0xe853=['serverUrl','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','ioredis','../../../../config/logger','dynamics365','redis','socket.io-emitter','CloudProvider','tenantId','data2','data5','POST','clientId','remoteUri','password','then','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','userId','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','nothing','toUpperCase',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','customField','idField','indexOf','incident','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','assign','Subjects','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe853,0x87));var _0x3e85=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe853[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3e85('0x0'));var rp=require(_0x3e85('0x1'));var util=require(_0x3e85('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x3e85('0x3'));var logger=require(_0x3e85('0x4'))(_0x3e85('0x5'));var config=require('../../../../config/environment');config[_0x3e85('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3e85('0x7'))(new Redis(config['redis']));function getAuthToken(_0xaa2c17,_0x468f62,_0xff9c4f){if(_0xaa2c17['modernAuthentication']){_0xaa2c17['remoteUri']=_0xaa2c17[_0x3e85('0x8')]['data7'];_0xaa2c17[_0x3e85('0x9')]=_0xaa2c17[_0x3e85('0x8')][_0x3e85('0xa')];return Promise['resolve'](_0xaa2c17[_0x3e85('0x8')][_0x3e85('0xb')]);}var _0x372caa={'method':_0x3e85('0xc'),'uri':_0x468f62,'form':{'client_id':_0xaa2c17[_0x3e85('0xd')],'resource':_0xaa2c17[_0x3e85('0xe')],'username':_0xaa2c17['username'],'password':_0xaa2c17[_0x3e85('0xf')],'grant_type':'password','client_secret':_0xaa2c17['clientSecret']},'json':!![]};return rp(_0x372caa)[_0x3e85('0x10')](function(_0x51f13d){return _0x51f13d['access_token'];})[_0x3e85('0x11')](function(_0x4cc3e4){logger[_0x3e85('0x12')]('['+[_0xff9c4f['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x4cc3e4[_0x3e85('0x13')];});}function getUser(_0x509c51,_0x164fe3,_0x1cd339,_0x1145a2,_0x5c39ec,_0x2adecf){return new Promise(function(_0x4eb885,_0x484456){return getAuthToken(_0x164fe3,_0x1145a2,_0x2adecf)['then'](function(_0x5c2b03){var _0x366dbf={'method':_0x3e85('0x14'),'uri':_0x5c39ec+_0x3e85('0x15'),'headers':{'Authorization':_0x3e85('0x16')+_0x5c2b03,'OData-Version':_0x3e85('0x17')},'json':!![]};return rp(_0x366dbf);})[_0x3e85('0x10')](function(_0x183c2f){var _0x3acfb4=_0x183c2f[_0x3e85('0x18')];var _0x21e266=![];var _0x5c09f6=null;if(!_['isNil'](_0x1cd339)){if(intUtil[_0x3e85('0x19')](_0x1cd339['email'])){_0x509c51['userEmail']=_0x1cd339[_0x3e85('0x1a')];for(_0x5c09f6=0x0;_0x5c09f6<_0x3acfb4[_0x3e85('0x1b')];_0x5c09f6++){if(_0x3acfb4[_0x5c09f6][_0x3e85('0x1c')]===_0x1cd339[_0x3e85('0x1a')]&&!_0x3acfb4[_0x5c09f6][_0x3e85('0x1d')]){_0x21e266=!![];logger[_0x3e85('0x1e')]('['+[_0x2adecf['toUpperCase']()]+_0x3e85('0x1f')+_0x3acfb4[_0x5c09f6][_0x3e85('0x20')]+'!');_0x509c51['userId']=_0x3acfb4[_0x5c09f6]['systemuserid'];}}}}if(!_0x21e266){logger[_0x3e85('0x1e')]('['+[_0x2adecf['toUpperCase']()]+_0x3e85('0x21'));_0x509c51[_0x3e85('0x22')]=_0x164fe3[_0x3e85('0x23')];for(_0x5c09f6=0x0;_0x5c09f6<_0x3acfb4['length'];_0x5c09f6++){if(_0x3acfb4[_0x5c09f6][_0x3e85('0x1c')]===_0x164fe3[_0x3e85('0x23')]){_0x509c51[_0x3e85('0x24')]=_0x3acfb4[_0x5c09f6]['systemuserid'];}}}_0x4eb885(_0x509c51);})[_0x3e85('0x11')](function(_0x286258){_0x484456(_0x286258[_0x3e85('0x13')]);});});}function createEndUser(_0x41cb79,_0x9aabf1,_0x71f4cb,_0x50b467,_0x57d70b,_0xf49b5a,_0x481340){return new Promise(function(_0x2d6127,_0x1d79d5){return getAuthToken(_0x9aabf1,_0x71f4cb,_0xf49b5a)[_0x3e85('0x10')](function(_0x583c80){var _0x152a1a=_0xf49b5a['toLowerCase']()==='outbound'?_0x57d70b[_0x3e85('0x25')]:_0x57d70b[_0x3e85('0x26')];var _0xcf5e2b={'method':_0x3e85('0xc'),'uri':_0x50b467+_0x3e85('0x27'),'body':{'fullname':_0x152a1a,'firstname':_0x152a1a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3e85('0x28')+_0x41cb79[_0x3e85('0x24')]+')'},'headers':{'Authorization':_0x3e85('0x16')+_0x583c80,'OData-Version':_0x3e85('0x17')},'json':!![],'resolveWithFullResponse':!![]};_0xcf5e2b['body'][_0x481340]=_0x152a1a;return rp(_0xcf5e2b);})[_0x3e85('0x10')](function(_0x4c7243){var _0x2e6d3b=_0x4c7243[_0x3e85('0x29')][_0x3e85('0x2a')];var _0x3cd9d0=_0x2e6d3b[_0x3e85('0x2b')](_0x2e6d3b[_0x3e85('0x2c')]('(')+0x1,_0x2e6d3b[_0x3e85('0x2c')](')'));_0x41cb79[_0x3e85('0x2d')]=_0x3cd9d0;_0x2d6127(_0x41cb79);})['catch'](function(_0x1f0721){_0x1d79d5(_0x1f0721[_0x3e85('0x13')]);});});}function getEndUser(_0xe268e0,_0xa1c0fa,_0x24ddcb,_0x3a832a,_0x260026,_0x37e982,_0x2a4bc1,_0x205753){var _0x25163d=_0x37e982[_0x3e85('0x2e')]()===_0x3e85('0x2f')?_0x260026[_0x3e85('0x25')]:_0x260026[_0x3e85('0x26')];return getAuthToken(_0xa1c0fa,_0x24ddcb,_0x37e982)[_0x3e85('0x10')](function(_0x5a92b2){_0x205753=_0x205753?_0x205753:_0x3e85('0x30');var _0x32a204={'method':_0x3e85('0x14'),'uri':_0x3a832a+'contacts?$select='+_0x205753+_0x3e85('0x31')+_0x205753+_0x3e85('0x32')+_0x25163d[_0x3e85('0x33')]('+',_0x3e85('0x34'))+'\x27','headers':{'Authorization':_0x3e85('0x16')+_0x5a92b2,'If-None-Match':null,'OData-Version':_0x3e85('0x17')},'json':!![]};return rp(_0x32a204);})[_0x3e85('0x10')](function(_0x28221a){var _0x468c43=![];if(!_0x28221a)return _0x468c43;var _0x37ebcd=_0x28221a['value'];for(var _0xb37f31=0x0;_0xb37f31<_0x37ebcd[_0x3e85('0x1b')];_0xb37f31++){if(_0x37ebcd[_0xb37f31][_0x205753]===_0x25163d){_0x468c43=!![];_0xe268e0[_0x3e85('0x2d')]=_0x37ebcd[_0xb37f31]['contactid'];}}return _0x468c43;})['then'](function(_0x45e5ab){if(_0x45e5ab)return _0xe268e0;if(_0x2a4bc1===_0x3e85('0x35')){logger['info']('['+[_0x37e982[_0x3e85('0x36')]()]+_0x3e85('0x37'));return _0xe268e0;}return createEndUser(_0xe268e0,_0xa1c0fa,_0x24ddcb,_0x3a832a,_0x260026,_0x37e982,_0x205753)['then'](function(_0x1a3a80){logger[_0x3e85('0x1e')]('['+[_0x37e982[_0x3e85('0x36')]()]+_0x3e85('0x38'),_0x1a3a80[_0x3e85('0x2d')]);return _0x1a3a80;});});}function getCustomFields(_0x46bbc9,_0x429c81,_0x1ce598){var _0x2a26c1={};if(_0x46bbc9[_0x3e85('0x1b')]>0x0){_[_0x3e85('0x39')](_0x46bbc9,function(_0x30c7a5){if(_['includes']([_0x3e85('0x3a'),_0x3e85('0x3b')],_0x30c7a5['type'])&&_0x30c7a5['nameField']&&!_0x30c7a5[_0x3e85('0x3c')]){var _0x1213ff=_0x30c7a5[_0x3e85('0x3d')][_0x3e85('0x2e')]();var _0x5972cc=_0x1213ff[_0x3e85('0x2b')](0x0,_0x1213ff[_0x3e85('0x3e')]('_'));var _0x46ef6a=_0x1213ff[_0x3e85('0x2b')](_0x1213ff[_0x3e85('0x3e')]('_')+0x1);if(_0x5972cc===_0x1ce598){_0x2a26c1[_0x46ef6a]=_0x30c7a5['content'];}}});}return _0x2a26c1;}function getTicket(_0x32d40c,_0x45ca5b,_0x4effef,_0x385ee3,_0x4cafed,_0x433d93,_0x145ae4){return new Promise(function(_0x2c13cd,_0x3e22b7){var _0x1e22a7;return getAuthToken(_0x45ca5b,_0x4effef,_0x145ae4)[_0x3e85('0x10')](function(_0x37cde3){if(_0x433d93['ticketType']===_0x3e85('0x3f')){_0x1e22a7={'method':_0x3e85('0xc'),'uri':_0x385ee3+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x433d93['Subjects'],_0x4cafed,'\x20'),'description':intUtil[_0x3e85('0x40')](_0x433d93[_0x3e85('0x41')],_0x4cafed,'\x0a'),'customerid_contact@odata.bind':_0x32d40c[_0x3e85('0x2d')]?_0x3e85('0x42')+_0x32d40c[_0x3e85('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x32d40c[_0x3e85('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x433d93[_0x3e85('0x43')],_0x4cafed,_0x433d93[_0x3e85('0x44')])),'headers':{'Authorization':_0x3e85('0x16')+_0x37cde3,'OData-Version':_0x3e85('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x433d93['ticketType']===_0x3e85('0x45')){var _0x2bd161=_0x32d40c[_0x3e85('0x2d')]?[{'partyid_systemuser@odata.bind':_0x3e85('0x28')+_0x32d40c[_0x3e85('0x24')]+')','participationtypemask':_0x32d40c[_0x3e85('0x46')]===_0x3e85('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x3e85('0x42')+_0x32d40c[_0x3e85('0x2d')]+')','participationtypemask':_0x32d40c[_0x3e85('0x46')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x32d40c['userId']+')','participationtypemask':_0x32d40c[_0x3e85('0x46')]===_0x3e85('0x47')?0x2:0x1}];_0x1e22a7={'method':_0x3e85('0xc'),'uri':_0x385ee3+_0x3e85('0x48'),'body':Object[_0x3e85('0x49')]({},{'subject':intUtil[_0x3e85('0x40')](_0x433d93[_0x3e85('0x4a')],_0x4cafed,'\x20'),'phonenumber':String(_0x4cafed[_0x3e85('0x26')]),'description':intUtil['getString'](_0x433d93[_0x3e85('0x41')],_0x4cafed,'\x0a'),'regardingobjectid_contact@odata.bind':_0x32d40c[_0x3e85('0x2d')]?_0x3e85('0x42')+_0x32d40c['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x32d40c[_0x3e85('0x24')]+')','directioncode':_0x32d40c[_0x3e85('0x46')]==='queue'?![]:!![],'phonecall_activity_parties':_0x2bd161},getCustomFields(_0x433d93[_0x3e85('0x43')],_0x4cafed,_0x433d93['ticketType'])),'headers':{'Authorization':_0x3e85('0x16')+_0x37cde3,'OData-Version':_0x3e85('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e22a7);})[_0x3e85('0x10')](function(_0x3b1572){var _0x178b09=_0x3b1572[_0x3e85('0x29')][_0x3e85('0x2a')];var _0x41a5a2=_0x178b09[_0x3e85('0x2b')](_0x178b09['lastIndexOf']('(')+0x1,_0x178b09[_0x3e85('0x2c')](')'));_0x32d40c[_0x3e85('0x4b')]=_0x41a5a2;_0x2c13cd(_0x32d40c);})['catch'](function(_0x3e7481){_0x3e22b7(_0x3e7481['message']);});});}function emit(_0x5b5684,_0x342fd0,_0x2b3f0a,_0x1361aa){var _0x353660={'uri':util['format'](_0x3e85('0x4c'),_0x5b5684,_0x2b3f0a,_0x1361aa)};io['to'](util[_0x3e85('0x4d')](_0x3e85('0x4e'),_0x342fd0))[_0x3e85('0x4f')](_0x3e85('0x50'),_0x353660);}exports['cs']=function(_0x4f6d25,_0x59b91,_0xfe0a4b,_0x11208f,_0x24c1d5,_0x263774,_0x21c231,_0x42de16){var _0xcd3bf0={};_0x263774['remoteUri']=_0x263774['modernAuthentication']?intUtil[_0x3e85('0x51')](_0x263774[_0x3e85('0x8')][_0x3e85('0x52')]):intUtil['stripTrailingSlash'](_0x263774[_0x3e85('0xe')]);_0x263774['serverUrl']=intUtil[_0x3e85('0x51')](_0x263774[_0x3e85('0x53')]);_0xcd3bf0[_0x3e85('0x46')]=_0x42de16==='queue'||_0x42de16==='unmanaged'?_0x3e85('0x47'):'outbound';var _0x29a05b=_0x263774[_0x3e85('0x54')]?util['format'](_0x3e85('0x55'),_0x263774['CloudProvider'][_0x3e85('0x52')]):util[_0x3e85('0x4d')](_0x3e85('0x55'),_0x263774[_0x3e85('0xe')]);var _0x194cf4=util[_0x3e85('0x4d')](_0x3e85('0x56'),_0x263774[_0x3e85('0x9')]);var _0x3bb170=util[_0x3e85('0x4d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x263774[_0x3e85('0x53')],_0x59b91['uniqueid'],md5(_0x59b91[_0x3e85('0x57')]));if(_0x24c1d5&&_0x24c1d5[_0x3e85('0x58')]){logger[_0x3e85('0x1e')](_0x3e85('0x59'),_0x3e85('0x5a'));_0x59b91[_0x3e85('0x5b')]=_0x3bb170;}else if(_0x21c231&&_0x21c231[_0x3e85('0x5c')]&&_0x21c231[_0x3e85('0x5c')]!==_0x3e85('0x5d')){logger[_0x3e85('0x1e')](_0x3e85('0x5e'),_0x3e85('0x5a'));_0x59b91[_0x3e85('0x5b')]=_0x3bb170;}else{_0x59b91['recordingURL']='';}return getUser(_0xcd3bf0,_0x263774,_0x11208f,_0x194cf4,_0x29a05b,_0x42de16)['then'](function(_0x1ba06b){logger['info']('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x5f'),_0x1ba06b[_0x3e85('0x24')]);logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x60'),_0x1ba06b[_0x3e85('0x22')]);return getEndUser(_0x1ba06b,_0x263774,_0x194cf4,_0x29a05b,_0x59b91,_0x42de16,_0xfe0a4b[_0x3e85('0x61')],_0xfe0a4b[_0x3e85('0x62')]);})[_0x3e85('0x10')](function(_0x43bbad){logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x63'),_0x43bbad['enduserId']);logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x64'),_0x59b91[_0x3e85('0x26')]);return getTicket(_0x43bbad,_0x263774,_0x194cf4,_0x29a05b,_0x59b91,_0xfe0a4b,_0x42de16);})[_0x3e85('0x10')](function(_0x3c5bef){logger[_0x3e85('0x1e')](util[_0x3e85('0x4d')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x65'),_0xfe0a4b[_0x3e85('0x44')],_0x3c5bef[_0x3e85('0x4b')]));logger[_0x3e85('0x1e')](util[_0x3e85('0x4d')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x66'),_0x42de16));if(_0x42de16!==_0x3e85('0x67')&&_0xfe0a4b[_0x3e85('0x68')]){logger[_0x3e85('0x1e')]('['+_0x42de16[_0x3e85('0x36')]()+']',_0x3e85('0x69'));emit(_0x263774['remoteUri'],_0x11208f[_0x3e85('0x6a')],_0xfe0a4b[_0x3e85('0x44')],_0x3c5bef[_0x3e85('0x4b')]);}})['catch'](function(_0x227ba5){logger[_0x3e85('0x12')]('['+_0x42de16[_0x3e85('0x36')]()+_0x3e85('0x6b'),_0x227ba5[_0x3e85('0x13')]);console['error'](_0x3e85('0x6c'),_0x227ba5);});}; \ 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 ba11327..3cabd83 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 _0x7006=['idField','push','type','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','[QUEUE]','outbound','serverUrl','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','catch','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content'];(function(_0x5dca06,_0x507d61){var _0x35443b=function(_0x38d37d){while(--_0x38d37d){_0x5dca06['push'](_0x5dca06['shift']());}};_0x35443b(++_0x507d61);}(_0x7006,0xe9));var _0x6700=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7006[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6700('0x0'));var rp=require(_0x6700('0x1'));var md5=require(_0x6700('0x2'));var util=require(_0x6700('0x3'));var Redis=require(_0x6700('0x4'));var intUtil=require(_0x6700('0x5'));var config=require('../../../../config/environment');var logger=require(_0x6700('0x6'))(_0x6700('0x7'));config[_0x6700('0x8')]=_[_0x6700('0x9')](config[_0x6700('0x8')],{'host':_0x6700('0xa'),'port':0x18eb});var io=require(_0x6700('0xb'))(new Redis(config[_0x6700('0x8')]));var headers={'Content-Type':_0x6700('0xc'),'Accept':_0x6700('0xc')};function emit(_0x2396fc,_0x17a439,_0x25f9d7){io['to'](_0x2396fc)[_0x6700('0xd')](_0x17a439,_0x25f9d7);}function getTicket(_0x4509de,_0x10e49f,_0x23aac6,_0x56805a,_0x3a4e93){logger[_0x6700('0xe')](_0x6700('0xf'));var _0x4aae03=_[_0x6700('0x10')]({'responder_id':_0x10e49f['id'],'requester_id':_0x23aac6['id'],'name':util[_0x6700('0x11')](_0x6700('0x12'),_0x3a4e93[_0x6700('0x13')]),'phone':_0x3a4e93['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6700('0x14')](_0x56805a[_0x6700('0x15')],_0x3a4e93,'\x20'),'description':intUtil[_0x6700('0x14')](_0x56805a[_0x6700('0x16')],_0x3a4e93,_0x6700('0x17')),'tags':getTags(_0x56805a[_0x6700('0x18')],_0x6700('0x19'))},getCustomFields(_0x56805a[_0x6700('0x1a')],_0x3a4e93));_0x4aae03[_0x6700('0x1b')]=_[_0x6700('0x1c')](_[_0x6700('0x1d')](_0x4aae03['custom_fields'],'id'),_0x6700('0x1e'));return request({'uri':util['format'](_0x6700('0x1f'),_0x4509de[_0x6700('0x20')]),'method':'POST','body':_0x4aae03})[_0x6700('0x21')](function(_0x1a2a1d){logger[_0x6700('0xe')](_0x6700('0x22'));return _0x1a2a1d;});}function getUser(_0x20e6ce,_0x42077a){if(intUtil[_0x6700('0x23')](_0x42077a)){return request({'uri':util[_0x6700('0x11')]('%s/api/v2/agents',_0x20e6ce[_0x6700('0x20')]),'qs':{'email':_0x42077a}})[_0x6700('0x21')](function(_0x40d3c7){if(_0x40d3c7[_0x6700('0x24')]){logger[_0x6700('0xe')](_0x6700('0x25'));return _[_0x6700('0x26')](_0x40d3c7,function(_0x4d45af){return _0x4d45af['contact'][_0x6700('0x27')]===_0x42077a;});}else{logger['info'](_0x6700('0x28'));return request({'uri':util[_0x6700('0x11')]('%s/api/v2/agents/me',_0x20e6ce[_0x6700('0x20')])})[_0x6700('0x21')](function(_0x170b55){logger['info'](_0x6700('0x29'));return _0x170b55;});}});}else{logger[_0x6700('0xe')](_0x6700('0x2a'));return request({'uri':util['format'](_0x6700('0x2b'),_0x20e6ce[_0x6700('0x20')])})[_0x6700('0x21')](function(_0x2490e2){logger['info'](_0x6700('0x29'));return _0x2490e2;});}}function getEndUser(_0x53183f,_0x5ca46c,_0x16e343){logger[_0x6700('0xe')](_0x6700('0x2c'),_0x16e343);return request({'uri':util['format']('%s/api/v2/contacts',_0x53183f[_0x6700('0x20')]),'qs':{'phone':_0x16e343}})['then'](function(_0x15e4a4){if(_0x15e4a4[_0x6700('0x24')]){logger['info'](_0x6700('0x2d'));return _[_0x6700('0x26')](_0x15e4a4,{'phone':_0x16e343});}else{logger['info'](_0x6700('0x2e'));return request({'uri':util[_0x6700('0x11')](_0x6700('0x2f'),_0x53183f[_0x6700('0x20')]),'method':'POST','body':{'name':_0x5ca46c,'phone':_0x16e343}})[_0x6700('0x21')](function(_0x399ed5){logger[_0x6700('0xe')](_0x6700('0x30'));return _0x399ed5;});}});}function getAuth(_0x2adbad){return util['format']('Basic\x20%s',new Buffer(_0x2adbad[_0x6700('0x31')]+':X')[_0x6700('0x32')](_0x6700('0x33')));}function request(_0x2defbb){logger[_0x6700('0x34')](_0x6700('0x35'),JSON[_0x6700('0x36')](_0x2defbb));return rp(_[_0x6700('0x9')](_0x2defbb,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x320c3c,_0x46ff46){var _0x415867=[];if(_0x320c3c&&_0x320c3c[_0x6700('0x24')]>0x0){_0x415867=_[_0x6700('0x37')](_0x320c3c,_0x46ff46);}return _0x415867;}function getCustomFields(_0x49122e,_0xb35a7){var _0x112729=[];var _0x4b510b={'custom_fields':[]};if(_0x49122e[_0x6700('0x24')]>0x0){_[_0x6700('0x38')](_0x49122e,function(_0x167e1a){if(_[_0x6700('0x39')]([_0x6700('0x3a'),_0x6700('0x3b')],_0x167e1a['type'])&&_0x167e1a[_0x6700('0x3c')]&&!_0x167e1a[_0x6700('0x3d')]){_0x4b510b[_0x167e1a['nameField'][_0x6700('0x3e')]()]=_0x167e1a[_0x6700('0x3f')]['toString']();}else if(_[_0x6700('0x39')]([_0x6700('0x3a'),_0x6700('0x3b')],_0x167e1a['type'])&&_0x167e1a[_0x6700('0x40')]&&_0x167e1a[_0x6700('0x3d')]){_0x4b510b[_0x6700('0x1b')][_0x6700('0x41')]({'id':_0x167e1a[_0x6700('0x40')],'value':_0x167e1a[_0x6700('0x3f')]['toString']()});}else if(_0x167e1a[_0x6700('0x42')]===_0x6700('0x43')&&_0x167e1a[_0x6700('0x44')]&&_0x167e1a[_0x6700('0x40')]&&_0x167e1a[_0x6700('0x3d')]){_0xb35a7[_0x167e1a[_0x6700('0x44')]]&&_0x4b510b['custom_fields'][_0x6700('0x41')]({'id':_0x167e1a['idField'],'value':_0xb35a7[_0x167e1a['variableName']][_0x6700('0x32')]()});}else if(_0x167e1a[_0x6700('0x42')]===_0x6700('0x45')&&_0x167e1a[_0x6700('0x46')]&&_0x167e1a['Variable'][_0x6700('0x19')]&&_0x167e1a[_0x6700('0x40')]&&_0x167e1a[_0x6700('0x3d')]){_0xb35a7[_0x167e1a[_0x6700('0x46')][_0x6700('0x19')][_0x6700('0x3e')]()]&&_0x4b510b[_0x6700('0x1b')][_0x6700('0x41')]({'id':_0x167e1a[_0x6700('0x40')],'value':_0xb35a7[_0x167e1a['Variable']['name'][_0x6700('0x3e')]()][_0x6700('0x32')]()});}});}return _0x4b510b;}exports[_0x6700('0x47')]=function(_0x3b787a,_0x2dfdd5,_0x110dc7,_0x2c4f06,_0x433191,_0x11c520){var _0x182e06,_0x172ce8;_0x11c520[_0x6700('0x20')]=intUtil['stripTrailingSlash'](_0x11c520['remoteUri']);_0x11c520['serverUrl']=intUtil[_0x6700('0x48')](_0x11c520['serverUrl']);if(_0x433191&&_0x433191[_0x6700('0x49')]){logger[_0x6700('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2dfdd5[_0x6700('0x4a')]=util[_0x6700('0x11')](_0x6700('0x4b'),_0x11c520['serverUrl'],_0x2dfdd5['uniqueid'],md5(_0x2dfdd5[_0x6700('0x4c')]));}else{_0x2dfdd5['recordingURL']='';}headers[_0x6700('0x4d')]=getAuth(_0x11c520);return getUser(_0x11c520,_0x2c4f06[_0x6700('0x27')])[_0x6700('0x21')](function(_0x4f408d){_0x182e06=_0x4f408d;logger[_0x6700('0xe')]('The\x20User\x20ID\x20is:',_0x182e06['id']);return getEndUser(_0x11c520,_0x2dfdd5['calleridname'],_0x2dfdd5[_0x6700('0x4e')]);})[_0x6700('0x21')](function(_0xd7ff73){_0x172ce8=_0xd7ff73;logger[_0x6700('0xe')](_0x6700('0x4f'),_0x172ce8['id']);return getTicket(_0x11c520,_0x182e06,_0x172ce8,_0x110dc7,_0x2dfdd5);})[_0x6700('0x21')](function(_0x350c21){if(_0x350c21&&_0x350c21['id']){logger[_0x6700('0xe')](_0x6700('0x22'));logger[_0x6700('0xe')](_0x6700('0x50'),_0x350c21['id']);logger[_0x6700('0xe')]('[QUEUE]',_0x6700('0x51'));emit(util[_0x6700('0x11')](_0x6700('0x52'),_0x2c4f06[_0x6700('0x19')]),_0x6700('0x53'),{'uri':util['format'](_0x6700('0x54'),_0x11c520[_0x6700('0x20')],_0x350c21['id'])});}})['catch'](function(_0x18d7b8){logger['error'](_0x6700('0x55'),JSON[_0x6700('0x36')](_0x18d7b8));});};exports[_0x6700('0x56')]=function(_0x2151a2,_0x44dc0a,_0x390121,_0x25b1cf,_0x1460ce,_0x15aa1a,_0x18e51a){var _0x12cd4e,_0xb2608c;_0x15aa1a[_0x6700('0x20')]=intUtil[_0x6700('0x48')](_0x15aa1a[_0x6700('0x20')]);_0x15aa1a[_0x6700('0x57')]=intUtil['stripTrailingSlash'](_0x15aa1a['serverUrl']);if(_0x18e51a&&_0x18e51a[_0x6700('0x58')]&&_0x18e51a['recordingFormat']!==_0x6700('0x59')){logger[_0x6700('0xe')]('[OUTBOUND]',_0x6700('0x5a'));_0x44dc0a[_0x6700('0x4a')]=util[_0x6700('0x11')](_0x6700('0x4b'),_0x15aa1a[_0x6700('0x57')],_0x44dc0a[_0x6700('0x4c')],md5(_0x44dc0a[_0x6700('0x4c')]));}headers[_0x6700('0x4d')]=getAuth(_0x15aa1a);return getUser(_0x15aa1a,_0x25b1cf[_0x6700('0x27')])[_0x6700('0x21')](function(_0x2f8e2b){_0x12cd4e=_0x2f8e2b;logger[_0x6700('0xe')](_0x6700('0x5b'),_0x12cd4e['id']);return getEndUser(_0x15aa1a,_0x44dc0a[_0x6700('0x5c')],_0x44dc0a['destcalleridnum']);})[_0x6700('0x21')](function(_0x21a8fc){_0xb2608c=_0x21a8fc;logger[_0x6700('0xe')](_0x6700('0x4f'),_0xb2608c['id']);return getTicket(_0x15aa1a,_0x12cd4e,_0xb2608c,_0x390121,_0x44dc0a);})[_0x6700('0x21')](function(_0x4b5130){if(_0x4b5130&&_0x4b5130['id']){logger['info'](_0x6700('0x22'));logger['info'](_0x6700('0x50'),_0x4b5130['id']);logger[_0x6700('0xe')]('[OUTBOUND]',_0x6700('0x51'));emit(util[_0x6700('0x11')](_0x6700('0x52'),_0x25b1cf[_0x6700('0x19')]),'trigger:browser:url',{'uri':util[_0x6700('0x11')](_0x6700('0x54'),_0x15aa1a[_0x6700('0x20')],_0x4b5130['id'])});}})[_0x6700('0x5d')](function(_0x4304c4){logger[_0x6700('0x5e')](_0x6700('0x5f'),JSON[_0x6700('0x36')](_0x4304c4));});};exports[_0x6700('0x60')]=function(_0x547c26,_0x2f4b51,_0x4d1499,_0x49fe25,_0x4231f9,_0x4e61c0){var _0x58af82,_0x3dbeac;_0x4e61c0[_0x6700('0x20')]=intUtil[_0x6700('0x48')](_0x4e61c0[_0x6700('0x20')]);_0x4e61c0['serverUrl']=intUtil[_0x6700('0x48')](_0x4e61c0[_0x6700('0x57')]);if(_0x4231f9&&_0x4231f9['monitor_format']){logger[_0x6700('0xe')]('['+_0x2f4b51[_0x6700('0x61')][_0x6700('0x62')]()+']',_0x6700('0x5a'));_0x2f4b51[_0x6700('0x4a')]=util['format'](_0x6700('0x4b'),_0x4e61c0[_0x6700('0x57')],_0x2f4b51[_0x6700('0x4c')],md5(_0x2f4b51[_0x6700('0x4c')]));}else{_0x2f4b51[_0x6700('0x4a')]='';}headers[_0x6700('0x4d')]=getAuth(_0x4e61c0);return getUser(_0x4e61c0,'')[_0x6700('0x21')](function(_0x56044){_0x58af82=_0x56044;logger[_0x6700('0xe')](_0x6700('0x5b'),_0x58af82['id']);return getEndUser(_0x4e61c0,_0x2f4b51['calleridname'],_0x2f4b51[_0x6700('0x4e')]);})[_0x6700('0x21')](function(_0x59c720){_0x3dbeac=_0x59c720;logger[_0x6700('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3dbeac['id']);return getTicket(_0x4e61c0,_0x58af82,_0x3dbeac,_0x4d1499,_0x2f4b51);})[_0x6700('0x21')](function(_0x573a3d){if(_0x573a3d){logger['info'](_0x6700('0x22'));logger[_0x6700('0xe')](_0x6700('0x50'),_0x573a3d['id']);}})[_0x6700('0x5d')](function(_0x1365af){logger[_0x6700('0x5e')]('['+_0x2f4b51[_0x6700('0x61')][_0x6700('0x62')]()+']',JSON[_0x6700('0x36')](_0x1365af));});}; \ No newline at end of file +var _0xa7e2=['socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','toString','base64','stringify','map','includes','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','type','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','catch','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost'];(function(_0xa80ac,_0x250812){var _0x3b64cf=function(_0x47773e){while(--_0x47773e){_0xa80ac['push'](_0xa80ac['shift']());}};_0x3b64cf(++_0x250812);}(_0xa7e2,0x10c));var _0x2a7e=function(_0x3a6eda,_0x3a0cd4){_0x3a6eda=_0x3a6eda-0x0;var _0x322bcd=_0xa7e2[_0x3a6eda];return _0x322bcd;};'use strict';var _=require(_0x2a7e('0x0'));var rp=require(_0x2a7e('0x1'));var md5=require(_0x2a7e('0x2'));var util=require('util');var Redis=require(_0x2a7e('0x3'));var intUtil=require(_0x2a7e('0x4'));var config=require(_0x2a7e('0x5'));var logger=require(_0x2a7e('0x6'))(_0x2a7e('0x7'));config['redis']=_[_0x2a7e('0x8')](config[_0x2a7e('0x9')],{'host':_0x2a7e('0xa'),'port':0x18eb});var io=require(_0x2a7e('0xb'))(new Redis(config['redis']));var headers={'Content-Type':_0x2a7e('0xc'),'Accept':'application/json'};function emit(_0x314059,_0x105ff5,_0x429780){io['to'](_0x314059)[_0x2a7e('0xd')](_0x105ff5,_0x429780);}function getTicket(_0x36ec34,_0x59457c,_0x3be733,_0x2135ea,_0x356c8d){logger[_0x2a7e('0xe')](_0x2a7e('0xf'));var _0x43e0bb=_[_0x2a7e('0x10')]({'responder_id':_0x59457c['id'],'requester_id':_0x3be733['id'],'name':util[_0x2a7e('0x11')](_0x2a7e('0x12'),_0x356c8d[_0x2a7e('0x13')]),'phone':_0x356c8d[_0x2a7e('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2a7e('0x15')](_0x2135ea[_0x2a7e('0x16')],_0x356c8d,'\x20'),'description':intUtil[_0x2a7e('0x15')](_0x2135ea[_0x2a7e('0x17')],_0x356c8d,'
'),'tags':getTags(_0x2135ea[_0x2a7e('0x18')],_0x2a7e('0x19'))},getCustomFields(_0x2135ea[_0x2a7e('0x1a')],_0x356c8d));_0x43e0bb[_0x2a7e('0x1b')]=_[_0x2a7e('0x1c')](_[_0x2a7e('0x1d')](_0x43e0bb[_0x2a7e('0x1b')],'id'),_0x2a7e('0x1e'));return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x1f'),_0x36ec34[_0x2a7e('0x20')]),'method':'POST','body':_0x43e0bb})[_0x2a7e('0x21')](function(_0x1f93a1){logger[_0x2a7e('0xe')](_0x2a7e('0x22'));return _0x1f93a1;});}function getUser(_0x23b639,_0x25c4ae){if(intUtil[_0x2a7e('0x23')](_0x25c4ae)){return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x24'),_0x23b639[_0x2a7e('0x20')]),'qs':{'email':_0x25c4ae}})[_0x2a7e('0x21')](function(_0x125ef3){if(_0x125ef3[_0x2a7e('0x25')]){logger['info'](_0x2a7e('0x26'));return _[_0x2a7e('0x27')](_0x125ef3,function(_0x33e9d5){return _0x33e9d5['contact'][_0x2a7e('0x28')]===_0x25c4ae;});}else{logger['info'](_0x2a7e('0x29'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x23b639[_0x2a7e('0x20')])})[_0x2a7e('0x21')](function(_0x7983ac){logger[_0x2a7e('0xe')](_0x2a7e('0x2a'));return _0x7983ac;});}});}else{logger[_0x2a7e('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x2b'),_0x23b639[_0x2a7e('0x20')])})[_0x2a7e('0x21')](function(_0x2ace1e){logger['info'](_0x2a7e('0x2a'));return _0x2ace1e;});}}function getEndUser(_0x324b44,_0x47b456,_0x1e0834){logger[_0x2a7e('0xe')](_0x2a7e('0x2c'),_0x1e0834);return request({'uri':util[_0x2a7e('0x11')]('%s/api/v2/contacts',_0x324b44[_0x2a7e('0x20')]),'qs':{'phone':_0x1e0834}})[_0x2a7e('0x21')](function(_0x4789f9){if(_0x4789f9[_0x2a7e('0x25')]){logger[_0x2a7e('0xe')](_0x2a7e('0x2d'));return _['find'](_0x4789f9,{'phone':_0x1e0834});}else{logger[_0x2a7e('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2a7e('0x11')](_0x2a7e('0x2e'),_0x324b44[_0x2a7e('0x20')]),'method':_0x2a7e('0x2f'),'body':{'name':_0x47b456,'phone':_0x1e0834}})['then'](function(_0x5677f1){logger[_0x2a7e('0xe')](_0x2a7e('0x30'));return _0x5677f1;});}});}function getAuth(_0x4cb83d){return util[_0x2a7e('0x11')](_0x2a7e('0x31'),new Buffer(_0x4cb83d['apiKey']+':X')[_0x2a7e('0x32')](_0x2a7e('0x33')));}function request(_0x46d8e2){logger['debug']('[HTTP]',JSON[_0x2a7e('0x34')](_0x46d8e2));return rp(_['defaults'](_0x46d8e2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3e2c93,_0x4e2719){var _0x1bb4e6=[];if(_0x3e2c93&&_0x3e2c93['length']>0x0){_0x1bb4e6=_[_0x2a7e('0x35')](_0x3e2c93,_0x4e2719);}return _0x1bb4e6;}function getCustomFields(_0x327986,_0x2c4b29){var _0x368956=[];var _0x116e84={'custom_fields':[]};if(_0x327986[_0x2a7e('0x25')]>0x0){_['forEach'](_0x327986,function(_0x5b6b59){if(_[_0x2a7e('0x36')]([_0x2a7e('0x37'),'picklist'],_0x5b6b59['type'])&&_0x5b6b59[_0x2a7e('0x38')]&&!_0x5b6b59[_0x2a7e('0x39')]){_0x116e84[_0x5b6b59[_0x2a7e('0x38')][_0x2a7e('0x3a')]()]=_0x5b6b59[_0x2a7e('0x3b')][_0x2a7e('0x32')]();}else if(_['includes'](['string','picklist'],_0x5b6b59['type'])&&_0x5b6b59[_0x2a7e('0x3c')]&&_0x5b6b59[_0x2a7e('0x39')]){_0x116e84['custom_fields'][_0x2a7e('0x3d')]({'id':_0x5b6b59['idField'],'value':_0x5b6b59[_0x2a7e('0x3b')]['toString']()});}else if(_0x5b6b59['type']===_0x2a7e('0x3e')&&_0x5b6b59[_0x2a7e('0x3f')]&&_0x5b6b59['idField']&&_0x5b6b59['customField']){_0x2c4b29[_0x5b6b59['variableName']]&&_0x116e84[_0x2a7e('0x1b')][_0x2a7e('0x3d')]({'id':_0x5b6b59[_0x2a7e('0x3c')],'value':_0x2c4b29[_0x5b6b59[_0x2a7e('0x3f')]]['toString']()});}else if(_0x5b6b59[_0x2a7e('0x40')]==='customVariable'&&_0x5b6b59['Variable']&&_0x5b6b59[_0x2a7e('0x41')]['name']&&_0x5b6b59[_0x2a7e('0x3c')]&&_0x5b6b59[_0x2a7e('0x39')]){_0x2c4b29[_0x5b6b59[_0x2a7e('0x41')]['name'][_0x2a7e('0x3a')]()]&&_0x116e84[_0x2a7e('0x1b')][_0x2a7e('0x3d')]({'id':_0x5b6b59[_0x2a7e('0x3c')],'value':_0x2c4b29[_0x5b6b59[_0x2a7e('0x41')]['name'][_0x2a7e('0x3a')]()][_0x2a7e('0x32')]()});}});}return _0x116e84;}exports[_0x2a7e('0x42')]=function(_0x470c77,_0x35fc68,_0x1baaad,_0x560934,_0x4338c3,_0x3fa188){var _0x732b37,_0x33749b;_0x3fa188[_0x2a7e('0x20')]=intUtil['stripTrailingSlash'](_0x3fa188[_0x2a7e('0x20')]);_0x3fa188['serverUrl']=intUtil[_0x2a7e('0x43')](_0x3fa188[_0x2a7e('0x44')]);if(_0x4338c3&&_0x4338c3[_0x2a7e('0x45')]){logger[_0x2a7e('0xe')]('[QUEUE]',_0x2a7e('0x46'));_0x35fc68[_0x2a7e('0x47')]=util['format'](_0x2a7e('0x48'),_0x3fa188['serverUrl'],_0x35fc68[_0x2a7e('0x49')],md5(_0x35fc68[_0x2a7e('0x49')]));}else{_0x35fc68[_0x2a7e('0x47')]='';}headers[_0x2a7e('0x4a')]=getAuth(_0x3fa188);return getUser(_0x3fa188,_0x560934['email'])[_0x2a7e('0x21')](function(_0x3b3ec2){_0x732b37=_0x3b3ec2;logger[_0x2a7e('0xe')](_0x2a7e('0x4b'),_0x732b37['id']);return getEndUser(_0x3fa188,_0x35fc68[_0x2a7e('0x13')],_0x35fc68[_0x2a7e('0x14')]);})[_0x2a7e('0x21')](function(_0x2cbbbd){_0x33749b=_0x2cbbbd;logger[_0x2a7e('0xe')](_0x2a7e('0x4c'),_0x33749b['id']);return getTicket(_0x3fa188,_0x732b37,_0x33749b,_0x1baaad,_0x35fc68);})[_0x2a7e('0x21')](function(_0x105fb5){if(_0x105fb5&&_0x105fb5['id']){logger['info'](_0x2a7e('0x22'));logger[_0x2a7e('0xe')](_0x2a7e('0x4d'),_0x105fb5['id']);logger[_0x2a7e('0xe')](_0x2a7e('0x4e'),_0x2a7e('0x4f'));emit(util[_0x2a7e('0x11')](_0x2a7e('0x50'),_0x560934[_0x2a7e('0x19')]),_0x2a7e('0x51'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3fa188['remoteUri'],_0x105fb5['id'])});}})['catch'](function(_0x4c66f8){logger['error'](_0x2a7e('0x4e'),JSON[_0x2a7e('0x34')](_0x4c66f8));});};exports[_0x2a7e('0x52')]=function(_0x16289d,_0x53f397,_0x6bc56,_0x5af831,_0x43c85b,_0x3213dc,_0x1d4aaf){var _0x2b9b26,_0x2ec70b;_0x3213dc[_0x2a7e('0x20')]=intUtil[_0x2a7e('0x43')](_0x3213dc[_0x2a7e('0x20')]);_0x3213dc['serverUrl']=intUtil['stripTrailingSlash'](_0x3213dc['serverUrl']);if(_0x1d4aaf&&_0x1d4aaf['recordingFormat']&&_0x1d4aaf[_0x2a7e('0x53')]!=='none'){logger[_0x2a7e('0xe')](_0x2a7e('0x54'),_0x2a7e('0x46'));_0x53f397[_0x2a7e('0x47')]=util[_0x2a7e('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3213dc['serverUrl'],_0x53f397[_0x2a7e('0x49')],md5(_0x53f397[_0x2a7e('0x49')]));}headers['Authorization']=getAuth(_0x3213dc);return getUser(_0x3213dc,_0x5af831['email'])[_0x2a7e('0x21')](function(_0x2578d6){_0x2b9b26=_0x2578d6;logger[_0x2a7e('0xe')](_0x2a7e('0x4b'),_0x2b9b26['id']);return getEndUser(_0x3213dc,_0x53f397[_0x2a7e('0x55')],_0x53f397[_0x2a7e('0x56')]);})[_0x2a7e('0x21')](function(_0x196c9e){_0x2ec70b=_0x196c9e;logger[_0x2a7e('0xe')](_0x2a7e('0x4c'),_0x2ec70b['id']);return getTicket(_0x3213dc,_0x2b9b26,_0x2ec70b,_0x6bc56,_0x53f397);})['then'](function(_0x520e7e){if(_0x520e7e&&_0x520e7e['id']){logger[_0x2a7e('0xe')](_0x2a7e('0x22'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x520e7e['id']);logger['info'](_0x2a7e('0x54'),_0x2a7e('0x4f'));emit(util[_0x2a7e('0x11')](_0x2a7e('0x50'),_0x5af831['name']),_0x2a7e('0x51'),{'uri':util[_0x2a7e('0x11')](_0x2a7e('0x57'),_0x3213dc[_0x2a7e('0x20')],_0x520e7e['id'])});}})[_0x2a7e('0x58')](function(_0x420c19){logger[_0x2a7e('0x59')](_0x2a7e('0x54'),JSON[_0x2a7e('0x34')](_0x420c19));});};exports[_0x2a7e('0x5a')]=function(_0x237f08,_0x551ac2,_0x422282,_0x4268f0,_0x48d945,_0x1ec964){var _0x2a5401,_0x3f71dc;_0x1ec964[_0x2a7e('0x20')]=intUtil[_0x2a7e('0x43')](_0x1ec964[_0x2a7e('0x20')]);_0x1ec964[_0x2a7e('0x44')]=intUtil[_0x2a7e('0x43')](_0x1ec964[_0x2a7e('0x44')]);if(_0x48d945&&_0x48d945['monitor_format']){logger[_0x2a7e('0xe')]('['+_0x551ac2[_0x2a7e('0x5b')][_0x2a7e('0x5c')]()+']','Recording\x20is\x20enabled!');_0x551ac2[_0x2a7e('0x47')]=util[_0x2a7e('0x11')](_0x2a7e('0x48'),_0x1ec964[_0x2a7e('0x44')],_0x551ac2[_0x2a7e('0x49')],md5(_0x551ac2[_0x2a7e('0x49')]));}else{_0x551ac2[_0x2a7e('0x47')]='';}headers[_0x2a7e('0x4a')]=getAuth(_0x1ec964);return getUser(_0x1ec964,'')['then'](function(_0x5eb7dc){_0x2a5401=_0x5eb7dc;logger['info'](_0x2a7e('0x4b'),_0x2a5401['id']);return getEndUser(_0x1ec964,_0x551ac2[_0x2a7e('0x13')],_0x551ac2['calleridnum']);})[_0x2a7e('0x21')](function(_0x17ad8a){_0x3f71dc=_0x17ad8a;logger['info'](_0x2a7e('0x4c'),_0x3f71dc['id']);return getTicket(_0x1ec964,_0x2a5401,_0x3f71dc,_0x422282,_0x551ac2);})[_0x2a7e('0x21')](function(_0x395650){if(_0x395650){logger['info'](_0x2a7e('0x22'));logger[_0x2a7e('0xe')](_0x2a7e('0x4d'),_0x395650['id']);}})[_0x2a7e('0x58')](function(_0x4d85e5){logger[_0x2a7e('0x59')]('['+_0x551ac2[_0x2a7e('0x5b')]['toUpperCase']()+']',JSON['stringify'](_0x4d85e5));});}; \ 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 ddc0716..36f9c47 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 _0x5497=['headers','users','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','adminEmail','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','GET','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners'];(function(_0x24806b,_0x4c86b5){var _0xdf4e11=function(_0xe7e9ba){while(--_0xe7e9ba){_0x24806b['push'](_0x24806b['shift']());}};_0xdf4e11(++_0x4c86b5);}(_0x5497,0xdf));var _0x7549=function(_0x419912,_0x988212){_0x419912=_0x419912-0x0;var _0x5c0ff3=_0x5497[_0x419912];return _0x5c0ff3;};'use strict';var _=require('lodash');var rp=require(_0x7549('0x0'));var md5=require(_0x7549('0x1'));var util=require(_0x7549('0x2'));var moment=require(_0x7549('0x3'));var Promise=require(_0x7549('0x4'));var Redis=require(_0x7549('0x5'));var intUtil=require(_0x7549('0x6'));var config=require(_0x7549('0x7'));var logger=require(_0x7549('0x8'))('freshsales');config[_0x7549('0x9')]=_[_0x7549('0xa')](config[_0x7549('0x9')],{'host':_0x7549('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7549('0x9')]));function getAdminId(_0x561f60,_0x3917c0,_0x93f5f9,_0x5e044d){return new Promise(function(_0x556c05,_0x2d7a42){var _0x58c0d2=![];var _0x2d4544={'method':_0x7549('0xc'),'uri':_0x5e044d+'/api/selector/owners','json':!![]};_0x2d4544['headers']=_0x93f5f9;logger[_0x7549('0xd')](_0x7549('0xe'));return rp(_0x2d4544)[_0x7549('0xf')](function(_0x3a64e8){if(_0x3a64e8){var _0x215f59=_0x3a64e8['users'];var _0x3335c2=null;for(_0x3335c2=0x0;_0x3335c2<_0x215f59[_0x7549('0x10')];_0x3335c2++){if(_0x215f59[_0x3335c2][_0x7549('0x11')]===_0x561f60['adminEmail']){_0x561f60[_0x7549('0x12')]=_0x215f59[_0x3335c2]['id'];_0x58c0d2=!![];}}if(_0x58c0d2){logger[_0x7549('0xd')](_0x7549('0x13'),_0x561f60['adminId']);_0x556c05(_0x561f60);}else{_0x2d7a42({'statusCode':0x194,'message':_0x7549('0x14')});}}else{_0x2d7a42({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7549('0x15')](function(_0x5bdb60){logger[_0x7549('0x16')]('['+[_0x3917c0[_0x7549('0x17')]()]+']',_0x5bdb60[_0x7549('0x18')]);_0x2d7a42(_0x5bdb60);});});}function getUser(_0x2ad3e9,_0x47db5,_0x44eec3){return function(_0x149bf1){return new Promise(function(_0x1bd1c5,_0x48bd3e){var _0x342240={'method':_0x7549('0xc'),'uri':_0x44eec3+_0x7549('0x19'),'json':!![]};_0x342240[_0x7549('0x1a')]=_0x47db5;logger['info']('Getting\x20user\x20list');return rp(_0x342240)[_0x7549('0xf')](function(_0x3433f1){if(_0x3433f1){var _0x3b414f=_0x3433f1[_0x7549('0x1b')];var _0x5a4d50=![];var _0x5152db=null;if(_0x149bf1[_0x7549('0x1c')]!==null){logger[_0x7549('0xd')]('Getting\x20user\x20with\x20email',_0x149bf1['agentEmail']);_0x149bf1[_0x7549('0x1d')]=_0x149bf1[_0x7549('0x1c')];for(_0x5152db=0x0;_0x5152db<_0x3b414f[_0x7549('0x10')];_0x5152db++){if(_0x3b414f[_0x5152db]['email']===_0x149bf1['agentEmail']){_0x5a4d50=!![];_0x149bf1['userId']=_0x3b414f[_0x5152db]['id'];logger['info'](_0x7549('0x1e'),_0x149bf1[_0x7549('0x1f')]);}}}if(!_0x5a4d50){logger[_0x7549('0xd')](_0x7549('0x20'));_0x149bf1[_0x7549('0x1d')]=_0x149bf1[_0x7549('0x21')];_0x149bf1[_0x7549('0x1f')]=_0x149bf1[_0x7549('0x12')];_0x5a4d50=!![];}if(_0x5a4d50){_0x1bd1c5(_0x149bf1);}else{_0x48bd3e({'statusCode':0x194,'message':_0x7549('0x14')});}}else{_0x48bd3e({'statusCode':0x194,'message':_0x7549('0x14')});}})[_0x7549('0x15')](function(_0x4497fc){logger[_0x7549('0x16')]('['+[_0x2ad3e9[_0x7549('0x17')]()]+']',_0x4497fc[_0x7549('0x18')]);_0x48bd3e(_0x4497fc);});});};}function searchContact(_0x4284a5,_0x5c560a,_0x2de75d,_0xcfd9fc){return new Promise(function(_0x550e66,_0x100337){var _0x54f681={'method':_0x7549('0xc'),'headers':_0x5c560a,'uri':_0x4284a5+'/api/lookup?q='+_0xcfd9fc+_0x7549('0x22')+_0x2de75d+_0x7549('0x23'),'json':!![]};rp(_0x54f681)['then'](function(_0x22bb8d){var _0x4aeb8b=_['find'](_0x22bb8d[_0x7549('0x24')]['contacts'],[_0x2de75d,_0xcfd9fc]);_0x550e66(_0x4aeb8b);})[_0x7549('0x15')](function(_0x434d43){_0x100337(_0x434d43);});});}function getEndUser(_0x67c38,_0x3c44e6,_0x266f54){return function(_0x6ffee){return new Promise(function(_0x5706ec,_0x2b036d){logger['info'](util[_0x7549('0x25')](_0x7549('0x26'),_0x6ffee[_0x7549('0x27')]));searchContact(_0x266f54,_0x3c44e6,_0x7549('0x28'),_0x6ffee['contactNumber'])['then'](function(_0x4b5cf7){if(_0x4b5cf7){_0x6ffee[_0x7549('0x29')]=_0x4b5cf7['id'];logger[_0x7549('0xd')](_0x7549('0x2a'),_0x6ffee[_0x7549('0x29')]);return _0x5706ec(_0x6ffee);}searchContact(_0x266f54,_0x3c44e6,_0x7549('0x2b'),_0x6ffee[_0x7549('0x27')])[_0x7549('0xf')](function(_0x506314){if(_0x506314){_0x6ffee['endUserId']=_0x506314['id'];logger[_0x7549('0xd')]('Contact\x20found\x20work_number:',_0x6ffee['endUserId']);return _0x5706ec(_0x6ffee);}createEndUser(_0x6ffee,_0x67c38,_0x3c44e6,_0x266f54)[_0x7549('0xf')](function(_0x2f665a){logger[_0x7549('0xd')](_0x7549('0x2c'),_0x2f665a[_0x7549('0x29')]);return _0x5706ec(_0x2f665a);});});})['catch'](function(_0xa8268a){_0x2b036d(_0xa8268a);});});};}function createEndUser(_0xb6b82c,_0x1be2ec,_0x4608cf,_0x1db8e2){return new Promise(function(_0x2f6a6c,_0x145836){var _0x3c3cd0=moment();var _0x52a023={'method':_0x7549('0x2d'),'uri':_0x1db8e2+_0x7549('0x2e'),'body':{'contact':{'last_name':_0xb6b82c[_0x7549('0x27')],'work_number':_0xb6b82c[_0x7549('0x27')],'mobile_number':_0xb6b82c[_0x7549('0x27')],'owner_id':_0xb6b82c[_0x7549('0x1f')],'created_at':_0x3c3cd0['format'](_0x7549('0x2f'))}},'json':!![]};_0x52a023['headers']=_0x4608cf;logger[_0x7549('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x52a023)[_0x7549('0xf')](function(_0x158611){_0xb6b82c['endUserId']=_0x158611[_0x7549('0x30')]['id'];_0x2f6a6c(_0xb6b82c);})['catch'](function(_0x1777f3){logger[_0x7549('0x16')]('['+[_0x1be2ec[_0x7549('0x17')]()]+']',_0x1777f3[_0x7549('0x18')]);_0x145836(_0x1777f3['message']);});});}function getTicket(_0x312a23,_0x3a515e,_0x36aa27,_0x1de8ff,_0x19a032){return function(_0x3228e0){logger[_0x7549('0xd')](_0x7549('0x31'));return new Promise(function(_0x16a4c1,_0x3959f3){var _0x1087db=moment();var _0x19a194={'method':_0x7549('0x2d'),'uri':_0x36aa27+_0x7549('0x32'),'body':{'title':intUtil['getString'](_0x1de8ff[_0x7549('0x33')],_0x19a032,'\x20'),'description':intUtil[_0x7549('0x34')](_0x1de8ff[_0x7549('0x35')],_0x19a032,'\x0a'),'owner_id':_0x3228e0['userId'],'creater_id':_0x3228e0['adminId'],'targetable_id':_0x3228e0[_0x7549('0x29')],'targetable_type':_0x7549('0x36'),'created_at':_0x1087db[_0x7549('0x25')](_0x7549('0x2f')),'due_date':_0x1087db[_0x7549('0x37')](0x1e,'m')[_0x7549('0x25')](_0x7549('0x2f'))},'json':!![]};_0x19a194[_0x7549('0x1a')]=_0x3a515e;return rp(_0x19a194)['then'](function(_0x58c21e){_0x3228e0[_0x7549('0x38')]=_0x58c21e[_0x7549('0x39')]['id'];logger['info']('Task\x20created:',_0x3228e0[_0x7549('0x38')]);_0x16a4c1(_0x3228e0);})[_0x7549('0x15')](function(_0x4f941e){logger[_0x7549('0x16')]('['+[_0x312a23[_0x7549('0x17')]()]+']',_0x4f941e['message']);_0x3959f3(_0x4f941e['message']);});});};}function emit(_0x54da87,_0x1b802f,_0x3c0d81){var _0x5d06a1={'uri':_0x54da87+_0x7549('0x3a')+_0x3c0d81};io['to'](util[_0x7549('0x25')](_0x7549('0x3b'),_0x1b802f))['emit']('trigger:browser:url',_0x5d06a1);}exports['cs']=function(_0x269b67,_0x1c309a,_0x54cbcb,_0x2addbf,_0x5f3504,_0x297777,_0x202b07,_0x28ca5a){var _0x322646={};var _0x62ce82={'Authorization':_0x7549('0x3c')+_0x297777[_0x7549('0x3d')]};_0x297777['remoteUri']=intUtil[_0x7549('0x3e')](_0x297777['remoteUri']);_0x297777[_0x7549('0x3f')]=intUtil[_0x7549('0x3e')](_0x297777[_0x7549('0x3f')]);var _0x18cc6b=_0x297777[_0x7549('0x40')];_0x322646['adminEmail']=_0x297777[_0x7549('0x41')];_0x322646['contactNumber']=_0x28ca5a['toLowerCase']()===_0x7549('0x42')?_0x1c309a[_0x7549('0x43')]:_0x1c309a[_0x7549('0x44')];_0x322646[_0x7549('0x45')]=_0x28ca5a===_0x7549('0x46')||_0x28ca5a===_0x7549('0x47')?_0x7549('0x46'):_0x7549('0x42');if(_0x2addbf){_0x322646[_0x7549('0x1c')]=_0x2addbf['email'];}var _0x174b3a=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x297777[_0x7549('0x3f')],_0x1c309a['uniqueid'],md5(_0x1c309a[_0x7549('0x48')]));if(_0x5f3504&&_0x5f3504[_0x7549('0x49')]){logger[_0x7549('0xd')](_0x7549('0x4a'),_0x7549('0x4b'));_0x1c309a[_0x7549('0x4c')]=_0x174b3a;}else if(_0x202b07&&_0x202b07[_0x7549('0x4d')]&&_0x202b07[_0x7549('0x4d')]!=='none'){logger['info']('[OUTBOUND]',_0x7549('0x4b'));_0x1c309a[_0x7549('0x4c')]=_0x174b3a;}else{_0x1c309a['recordingURL']='';}return getAdminId(_0x322646,_0x28ca5a,_0x62ce82,_0x18cc6b)[_0x7549('0xf')](getUser(_0x28ca5a,_0x62ce82,_0x18cc6b))[_0x7549('0xf')](getEndUser(_0x28ca5a,_0x62ce82,_0x18cc6b))[_0x7549('0xf')](getTicket(_0x28ca5a,_0x62ce82,_0x18cc6b,_0x54cbcb,_0x1c309a))[_0x7549('0xf')](function(_0xc2641c){logger[_0x7549('0xd')](util['format'](_0x7549('0x4e'),_0xc2641c[_0x7549('0x38')]));if(_0x28ca5a!==_0x7549('0x47')){logger[_0x7549('0xd')]('['+[_0x28ca5a[_0x7549('0x17')]()]+']',_0x7549('0x4f'));emit(_0x18cc6b,_0x2addbf[_0x7549('0x50')],_0xc2641c[_0x7549('0x29')]);}})[_0x7549('0x15')](function(_0x1eb802){logger[_0x7549('0x16')]('['+[_0x28ca5a['toUpperCase']()]+_0x7549('0x51'),util[_0x7549('0x52')](_0x1eb802,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8925=['contacts','format','mobile_number','endUserId','work_number','contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','info','Getting\x20user\x20with\x20email','length','email','userId','User\x20found:','Admin\x20selected','userEmail','message','/api/lookup?q=','&f=','find'];(function(_0xadaf72,_0x190c5e){var _0x3c9164=function(_0x1f56fd){while(--_0x1f56fd){_0xadaf72['push'](_0xadaf72['shift']());}};_0x3c9164(++_0x190c5e);}(_0x8925,0x1c8));var _0x5892=function(_0x47c6b9,_0x210b3c){_0x47c6b9=_0x47c6b9-0x0;var _0x34f34d=_0x8925[_0x47c6b9];return _0x34f34d;};'use strict';var _=require(_0x5892('0x0'));var rp=require('request-promise');var md5=require(_0x5892('0x1'));var util=require(_0x5892('0x2'));var moment=require('moment');var Promise=require(_0x5892('0x3'));var Redis=require(_0x5892('0x4'));var intUtil=require(_0x5892('0x5'));var config=require(_0x5892('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x5892('0x7')]=_[_0x5892('0x8')](config[_0x5892('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5892('0x7')]));function getAdminId(_0x430ea3,_0x4612c5,_0x1f16f3,_0x48b615){return new Promise(function(_0x2799f5,_0x56524a){var _0x2ab9a9=![];var _0x6f7137={'method':_0x5892('0x9'),'uri':_0x48b615+_0x5892('0xa'),'json':!![]};_0x6f7137[_0x5892('0xb')]=_0x1f16f3;logger['info'](_0x5892('0xc'));return rp(_0x6f7137)[_0x5892('0xd')](function(_0x37fedf){if(_0x37fedf){var _0x1dfcae=_0x37fedf[_0x5892('0xe')];var _0x2482d1=null;for(_0x2482d1=0x0;_0x2482d1<_0x1dfcae['length'];_0x2482d1++){if(_0x1dfcae[_0x2482d1]['email']===_0x430ea3[_0x5892('0xf')]){_0x430ea3[_0x5892('0x10')]=_0x1dfcae[_0x2482d1]['id'];_0x2ab9a9=!![];}}if(_0x2ab9a9){logger['info'](_0x5892('0x11'),_0x430ea3[_0x5892('0x10')]);_0x2799f5(_0x430ea3);}else{_0x56524a({'statusCode':0x194,'message':_0x5892('0x12')});}}else{_0x56524a({'statusCode':0x194,'message':_0x5892('0x12')});}})[_0x5892('0x13')](function(_0xbc1e29){logger[_0x5892('0x14')]('['+[_0x4612c5[_0x5892('0x15')]()]+']',_0xbc1e29['message']);_0x56524a(_0xbc1e29);});});}function getUser(_0x2549b3,_0x3b710a,_0x5272ad){return function(_0x4fe48f){return new Promise(function(_0x451d73,_0x34cdc1){var _0x4e8321={'method':_0x5892('0x9'),'uri':_0x5272ad+'/api/selector/owners','json':!![]};_0x4e8321['headers']=_0x3b710a;logger['info'](_0x5892('0x16'));return rp(_0x4e8321)['then'](function(_0x54d1c3){if(_0x54d1c3){var _0xf47873=_0x54d1c3[_0x5892('0xe')];var _0xb79684=![];var _0x3f3ccb=null;if(_0x4fe48f[_0x5892('0x17')]!==null){logger[_0x5892('0x18')](_0x5892('0x19'),_0x4fe48f[_0x5892('0x17')]);_0x4fe48f['userEmail']=_0x4fe48f[_0x5892('0x17')];for(_0x3f3ccb=0x0;_0x3f3ccb<_0xf47873[_0x5892('0x1a')];_0x3f3ccb++){if(_0xf47873[_0x3f3ccb][_0x5892('0x1b')]===_0x4fe48f[_0x5892('0x17')]){_0xb79684=!![];_0x4fe48f[_0x5892('0x1c')]=_0xf47873[_0x3f3ccb]['id'];logger[_0x5892('0x18')](_0x5892('0x1d'),_0x4fe48f['userId']);}}}if(!_0xb79684){logger[_0x5892('0x18')](_0x5892('0x1e'));_0x4fe48f[_0x5892('0x1f')]=_0x4fe48f[_0x5892('0xf')];_0x4fe48f[_0x5892('0x1c')]=_0x4fe48f[_0x5892('0x10')];_0xb79684=!![];}if(_0xb79684){_0x451d73(_0x4fe48f);}else{_0x34cdc1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x34cdc1({'statusCode':0x194,'message':_0x5892('0x12')});}})[_0x5892('0x13')](function(_0x13d141){logger[_0x5892('0x14')]('['+[_0x2549b3['toUpperCase']()]+']',_0x13d141[_0x5892('0x20')]);_0x34cdc1(_0x13d141);});});};}function searchContact(_0x50de47,_0x13c281,_0x264559,_0xe09b26){return new Promise(function(_0x4a21a9,_0xa74282){var _0x44b821={'method':_0x5892('0x9'),'headers':_0x13c281,'uri':_0x50de47+_0x5892('0x21')+_0xe09b26+_0x5892('0x22')+_0x264559+'&entities=contact','json':!![]};rp(_0x44b821)['then'](function(_0x25c6d1){var _0x2f4df3=_[_0x5892('0x23')](_0x25c6d1['contacts'][_0x5892('0x24')],[_0x264559,_0xe09b26]);_0x4a21a9(_0x2f4df3);})[_0x5892('0x13')](function(_0x4afa2c){_0xa74282(_0x4afa2c);});});}function getEndUser(_0x30ee4f,_0x48db0a,_0x61635b){return function(_0x1de1a9){return new Promise(function(_0x42cf11,_0x181d0e){logger[_0x5892('0x18')](util[_0x5892('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x1de1a9['contactNumber']));searchContact(_0x61635b,_0x48db0a,_0x5892('0x26'),_0x1de1a9['contactNumber'])[_0x5892('0xd')](function(_0x3b3428){if(_0x3b3428){_0x1de1a9[_0x5892('0x27')]=_0x3b3428['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x1de1a9[_0x5892('0x27')]);return _0x42cf11(_0x1de1a9);}searchContact(_0x61635b,_0x48db0a,_0x5892('0x28'),_0x1de1a9[_0x5892('0x29')])[_0x5892('0xd')](function(_0x3a81e2){if(_0x3a81e2){_0x1de1a9[_0x5892('0x27')]=_0x3a81e2['id'];logger['info'](_0x5892('0x2a'),_0x1de1a9['endUserId']);return _0x42cf11(_0x1de1a9);}createEndUser(_0x1de1a9,_0x30ee4f,_0x48db0a,_0x61635b)[_0x5892('0xd')](function(_0x26e6bf){logger[_0x5892('0x18')](_0x5892('0x2b'),_0x26e6bf[_0x5892('0x27')]);return _0x42cf11(_0x26e6bf);});});})[_0x5892('0x13')](function(_0x4261c7){_0x181d0e(_0x4261c7);});});};}function createEndUser(_0x1e1c29,_0x2fb061,_0x4861c8,_0x36d76f){return new Promise(function(_0x8a9694,_0x107032){var _0x47c611=moment();var _0x3fbd25={'method':_0x5892('0x2c'),'uri':_0x36d76f+_0x5892('0x2d'),'body':{'contact':{'last_name':_0x1e1c29[_0x5892('0x29')],'work_number':_0x1e1c29[_0x5892('0x29')],'mobile_number':_0x1e1c29[_0x5892('0x29')],'owner_id':_0x1e1c29[_0x5892('0x1c')],'created_at':_0x47c611[_0x5892('0x25')](_0x5892('0x2e'))}},'json':!![]};_0x3fbd25[_0x5892('0xb')]=_0x4861c8;logger[_0x5892('0x18')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3fbd25)[_0x5892('0xd')](function(_0x1b8c53){_0x1e1c29['endUserId']=_0x1b8c53[_0x5892('0x2f')]['id'];_0x8a9694(_0x1e1c29);})[_0x5892('0x13')](function(_0x31b716){logger[_0x5892('0x14')]('['+[_0x2fb061['toUpperCase']()]+']',_0x31b716[_0x5892('0x20')]);_0x107032(_0x31b716[_0x5892('0x20')]);});});}function getTicket(_0x6857fe,_0x2b06b1,_0x1121ee,_0x29815e,_0x27bdfd){return function(_0x47e19b){logger[_0x5892('0x18')]('Creating\x20new\x20task');return new Promise(function(_0xf1dce6,_0x302f85){var _0x426cdb=moment();var _0x579cc2={'method':_0x5892('0x2c'),'uri':_0x1121ee+_0x5892('0x30'),'body':{'title':intUtil[_0x5892('0x31')](_0x29815e['Subjects'],_0x27bdfd,'\x20'),'description':intUtil['getString'](_0x29815e[_0x5892('0x32')],_0x27bdfd,'\x0a'),'owner_id':_0x47e19b[_0x5892('0x1c')],'creater_id':_0x47e19b[_0x5892('0x10')],'targetable_id':_0x47e19b[_0x5892('0x27')],'targetable_type':_0x5892('0x33'),'created_at':_0x426cdb[_0x5892('0x25')](_0x5892('0x2e')),'due_date':_0x426cdb[_0x5892('0x34')](0x1e,'m')[_0x5892('0x25')](_0x5892('0x2e'))},'json':!![]};_0x579cc2[_0x5892('0xb')]=_0x2b06b1;return rp(_0x579cc2)[_0x5892('0xd')](function(_0x4c0f9a){_0x47e19b['ticketId']=_0x4c0f9a[_0x5892('0x35')]['id'];logger['info'](_0x5892('0x36'),_0x47e19b['ticketId']);_0xf1dce6(_0x47e19b);})[_0x5892('0x13')](function(_0x28b06e){logger['error']('['+[_0x6857fe[_0x5892('0x15')]()]+']',_0x28b06e[_0x5892('0x20')]);_0x302f85(_0x28b06e['message']);});});};}function emit(_0x16ff60,_0x2a1c10,_0x127b48){var _0x2f182f={'uri':_0x16ff60+'/contacts/'+_0x127b48};io['to'](util['format'](_0x5892('0x37'),_0x2a1c10))[_0x5892('0x38')](_0x5892('0x39'),_0x2f182f);}exports['cs']=function(_0x4b8fd5,_0x2dd4e9,_0x429817,_0x1f6988,_0x34aa8d,_0x1bd691,_0x3e1c3f,_0x1dff9f){var _0x4a2121={};var _0x54eb43={'Authorization':'Token\x20token='+_0x1bd691[_0x5892('0x3a')]};_0x1bd691[_0x5892('0x3b')]=intUtil[_0x5892('0x3c')](_0x1bd691[_0x5892('0x3b')]);_0x1bd691[_0x5892('0x3d')]=intUtil[_0x5892('0x3c')](_0x1bd691[_0x5892('0x3d')]);var _0x450cae=_0x1bd691[_0x5892('0x3b')];_0x4a2121[_0x5892('0xf')]=_0x1bd691[_0x5892('0x3e')];_0x4a2121[_0x5892('0x29')]=_0x1dff9f[_0x5892('0x3f')]()===_0x5892('0x40')?_0x2dd4e9[_0x5892('0x41')]:_0x2dd4e9['calleridnum'];_0x4a2121['callDirection']=_0x1dff9f==='queue'||_0x1dff9f==='unmanaged'?'queue':_0x5892('0x40');if(_0x1f6988){_0x4a2121[_0x5892('0x17')]=_0x1f6988[_0x5892('0x1b')];}var _0x60cd18=util[_0x5892('0x25')](_0x5892('0x42'),_0x1bd691[_0x5892('0x3d')],_0x2dd4e9[_0x5892('0x43')],md5(_0x2dd4e9[_0x5892('0x43')]));if(_0x34aa8d&&_0x34aa8d[_0x5892('0x44')]){logger[_0x5892('0x18')](_0x5892('0x45'),_0x5892('0x46'));_0x2dd4e9[_0x5892('0x47')]=_0x60cd18;}else if(_0x3e1c3f&&_0x3e1c3f[_0x5892('0x48')]&&_0x3e1c3f[_0x5892('0x48')]!==_0x5892('0x49')){logger[_0x5892('0x18')](_0x5892('0x4a'),_0x5892('0x46'));_0x2dd4e9[_0x5892('0x47')]=_0x60cd18;}else{_0x2dd4e9[_0x5892('0x47')]='';}return getAdminId(_0x4a2121,_0x1dff9f,_0x54eb43,_0x450cae)[_0x5892('0xd')](getUser(_0x1dff9f,_0x54eb43,_0x450cae))[_0x5892('0xd')](getEndUser(_0x1dff9f,_0x54eb43,_0x450cae))[_0x5892('0xd')](getTicket(_0x1dff9f,_0x54eb43,_0x450cae,_0x429817,_0x2dd4e9))[_0x5892('0xd')](function(_0x443ca7){logger['info'](util['format'](_0x5892('0x4b'),_0x443ca7[_0x5892('0x4c')]));if(_0x1dff9f!==_0x5892('0x4d')){logger[_0x5892('0x18')]('['+[_0x1dff9f[_0x5892('0x15')]()]+']',_0x5892('0x4e'));emit(_0x450cae,_0x1f6988[_0x5892('0x4f')],_0x443ca7[_0x5892('0x27')]);}})[_0x5892('0x13')](function(_0x2e7991){logger[_0x5892('0x14')]('['+[_0x1dff9f[_0x5892('0x15')]()]+_0x5892('0x50'),util[_0x5892('0x51')](_0x2e7991,{'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 4430af3..292401b 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 _0xd3df=['data2','lodash','util','./zendesk','./salesforce','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','toLowerCase','find','Configurations','routeId','outbound','log','unmanaged','sugarcrm','unknown\x20integration','../../../../config/logger','data1','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found'];(function(_0x1b999f,_0xada878){var _0x51d27a=function(_0x1ba354){while(--_0x1ba354){_0x1b999f['push'](_0x1b999f['shift']());}};_0x51d27a(++_0xada878);}(_0xd3df,0xab));var _0xfd3d=function(_0x42c809,_0x5860eb){_0x42c809=_0x42c809-0x0;var _0x37f369=_0xd3df[_0x42c809];return _0x37f369;};'use strict';var _=require(_0xfd3d('0x0'));var util=require(_0xfd3d('0x1'));var zendesk=require(_0xfd3d('0x2'));var salesforce=require(_0xfd3d('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xfd3d('0x4'));var servicenow=require(_0xfd3d('0x5'));var dynamics365=require(_0xfd3d('0x6'));var freshsales=require('./freshsales');var integrations=[_0xfd3d('0x7'),_0xfd3d('0x8'),'sugarcrm',_0xfd3d('0x9'),_0xfd3d('0xa'),_0xfd3d('0xb'),_0xfd3d('0xc'),_0xfd3d('0xd'),_0xfd3d('0xe'),_0xfd3d('0xf')];exports['exec']=function(_0x587fe4,_0x50941c,_0x40d12f,_0x4cde36,_0x2f0e88,_0x3639fc){if(_0x40d12f){if(_[_0xfd3d('0x10')](integrations,_0x587fe4['data1'][_0xfd3d('0x11')]())){try{var _0x7ccb1d=null;var _0x30926d='';var _0x3a1e18=_0x40d12f[_0x587fe4['data1'][_0xfd3d('0x11')]()];if(_0x3a1e18){var _0x4b1b6c=_0x3a1e18[_0x587fe4['data2']];if(_0x4b1b6c){var _0x19d1d3=_[_0xfd3d('0x12')](_0x4b1b6c[_0xfd3d('0x13')],{'id':parseInt(_0x587fe4['data3'],0xa)});if(_0x19d1d3){if(_0x4cde36){if(_0x2f0e88&&_0x50941c['queue']){_0x30926d='queue';}else if(_0x50941c[_0xfd3d('0x14')]){_0x30926d=_0xfd3d('0x15');}else{console[_0xfd3d('0x16')]('EVENT\x20UNKNOWN',_0x50941c);}}else{_0x30926d=_0xfd3d('0x17');}switch(_0x587fe4['data1'][_0xfd3d('0x11')]()){case _0xfd3d('0x7'):zendesk[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0x8'):salesforce[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0x18'):sugarcrm[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0x9'):freshdesk[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0xa'):zoho[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0xb'):desk[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0xc'):vtiger[_0x30926d](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc);break;case _0xfd3d('0xe'):freshsales['cs'](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc,_0x30926d);break;case'servicenow':servicenow['cs'](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc,_0x30926d);break;case _0xfd3d('0xd'):dynamics365['cs'](_0x587fe4,_0x50941c,_0x19d1d3,_0x4cde36,_0x2f0e88,_0x4b1b6c,_0x3639fc,_0x30926d);break;default:console[_0xfd3d('0x16')](_0xfd3d('0x19'));}}else{_0x7ccb1d=require(_0xfd3d('0x1a'))(_0x587fe4[_0xfd3d('0x1b')][_0xfd3d('0x11')]());_0x7ccb1d[_0xfd3d('0x1c')](_0xfd3d('0x1d'),util['format'](_0xfd3d('0x1e'),_0x587fe4['data1'][_0xfd3d('0x11')](),_0x587fe4[_0xfd3d('0x1f')]));}}else{_0x7ccb1d=require(_0xfd3d('0x1a'))(_0x587fe4[_0xfd3d('0x1b')][_0xfd3d('0x11')]());_0x7ccb1d[_0xfd3d('0x1c')](_0xfd3d('0x1d'),util['format'](_0xfd3d('0x20'),_0x587fe4[_0xfd3d('0x1b')][_0xfd3d('0x11')](),_0x587fe4[_0xfd3d('0x21')]));}}else{}}catch(_0x2ae625){console[_0xfd3d('0x1c')](_0x2ae625);}}}}; \ No newline at end of file +var _0xe209=['dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe209,0xce));var _0x9e20=function(_0x32c39a,_0x569b40){_0x32c39a=_0x32c39a-0x0;var _0x5ce9dc=_0xe209[_0x32c39a];return _0x5ce9dc;};'use strict';var _=require(_0x9e20('0x0'));var util=require('util');var zendesk=require(_0x9e20('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9e20('0x2'));var freshdesk=require(_0x9e20('0x3'));var zoho=require(_0x9e20('0x4'));var desk=require(_0x9e20('0x5'));var vtiger=require(_0x9e20('0x6'));var servicenow=require(_0x9e20('0x7'));var dynamics365=require(_0x9e20('0x8'));var freshsales=require(_0x9e20('0x9'));var integrations=[_0x9e20('0xa'),_0x9e20('0xb'),'sugarcrm',_0x9e20('0xc'),_0x9e20('0xd'),_0x9e20('0xe'),_0x9e20('0xf'),_0x9e20('0x10'),_0x9e20('0x11'),_0x9e20('0x12')];exports['exec']=function(_0x46b320,_0x3e39d8,_0x5f01f1,_0x5c4b7a,_0x5b18ff,_0x1bb3b9){if(_0x5f01f1){if(_['includes'](integrations,_0x46b320[_0x9e20('0x13')][_0x9e20('0x14')]())){try{var _0x40c2b7=null;var _0x3a770d='';var _0x25e74b=_0x5f01f1[_0x46b320[_0x9e20('0x13')][_0x9e20('0x14')]()];if(_0x25e74b){var _0x4a1c75=_0x25e74b[_0x46b320[_0x9e20('0x15')]];if(_0x4a1c75){var _0x10d7a0=_[_0x9e20('0x16')](_0x4a1c75[_0x9e20('0x17')],{'id':parseInt(_0x46b320[_0x9e20('0x18')],0xa)});if(_0x10d7a0){if(_0x5c4b7a){if(_0x5b18ff&&_0x3e39d8[_0x9e20('0x19')]){_0x3a770d='queue';}else if(_0x3e39d8[_0x9e20('0x1a')]){_0x3a770d='outbound';}else{console[_0x9e20('0x1b')](_0x9e20('0x1c'),_0x3e39d8);}}else{_0x3a770d=_0x9e20('0x1d');}switch(_0x46b320[_0x9e20('0x13')]['toLowerCase']()){case _0x9e20('0xa'):zendesk[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xb'):salesforce[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case'sugarcrm':sugarcrm[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xc'):freshdesk[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xd'):zoho[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0xe'):desk[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case'vtiger':vtiger[_0x3a770d](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9);break;case _0x9e20('0x11'):freshsales['cs'](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9,_0x3a770d);break;case'servicenow':servicenow['cs'](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9,_0x3a770d);break;case'dynamics365':dynamics365['cs'](_0x46b320,_0x3e39d8,_0x10d7a0,_0x5c4b7a,_0x5b18ff,_0x4a1c75,_0x1bb3b9,_0x3a770d);break;default:console['log'](_0x9e20('0x1e'));}}else{_0x40c2b7=require('../../../../config/logger')(_0x46b320[_0x9e20('0x13')]['toLowerCase']());_0x40c2b7[_0x9e20('0x1f')](_0x9e20('0x20'),util[_0x9e20('0x21')](_0x9e20('0x22'),_0x46b320[_0x9e20('0x13')]['toLowerCase'](),_0x46b320[_0x9e20('0x18')]));}}else{_0x40c2b7=require(_0x9e20('0x23'))(_0x46b320['data1'][_0x9e20('0x14')]());_0x40c2b7[_0x9e20('0x1f')](_0x9e20('0x20'),util[_0x9e20('0x21')](_0x9e20('0x24'),_0x46b320['data1'][_0x9e20('0x14')](),_0x46b320[_0x9e20('0x15')]));}}else{}}catch(_0x55eb8c){console[_0x9e20('0x1f')](_0x55eb8c);}}}}; \ 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 3e68b76..94f24aa 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 _0xa107=['../../../../config/environment','salesforce','redis','defaults','localhost','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','ContactId','AccountId','leadId','sobject','create','isNil','User','execute','then','find','Email','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','length','Account','first','attributes','type','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','upperFirst','string','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis'];(function(_0x5cd6d3,_0x4a1789){var _0x48c8cd=function(_0x498636){while(--_0x498636){_0x5cd6d3['push'](_0x5cd6d3['shift']());}};_0x48c8cd(++_0x4a1789);}(_0xa107,0x163));var _0x7a10=function(_0x101de4,_0x35d413){_0x101de4=_0x101de4-0x0;var _0x4e5c1a=_0xa107[_0x101de4];return _0x4e5c1a;};'use strict';var _=require(_0x7a10('0x0'));var rp=require(_0x7a10('0x1'));var moment=require(_0x7a10('0x2'));var BPromise=require(_0x7a10('0x3'));var md5=require(_0x7a10('0x4'));var jsforce=require(_0x7a10('0x5'));var util=require(_0x7a10('0x6'));var Redis=require(_0x7a10('0x7'));var intUtil=require('./util');var config=require(_0x7a10('0x8'));var logger=require('../../../../config/logger')(_0x7a10('0x9'));config[_0x7a10('0xa')]=_[_0x7a10('0xb')](config[_0x7a10('0xa')],{'host':_0x7a10('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a10('0xa')]));function emit(_0x54dc02,_0x5127fe,_0x4e29d0){io['to'](_0x54dc02)['emit'](_0x5127fe,_0x4e29d0);}function getTicket(_0x3627dd,_0x5337e7,_0x49b669,_0x229b49,_0x4990ff,_0x3d43e8,_0x3573da,_0x4a2305){var _0x59626c=Object['assign']({},{'OwnerId':_0x5337e7['id'],'Subject':intUtil[_0x7a10('0xd')](_0x229b49[_0x7a10('0xe')],_0x4990ff,'\x20'),'Description':intUtil[_0x7a10('0xd')](_0x229b49[_0x7a10('0xf')],_0x4990ff,'\x0a')},getCustomFields(_0x3d43e8,_0x4990ff));if(_0x49b669){if(_0x229b49[_0x7a10('0x10')]===_0x7a10('0x11')){_0x59626c[_0x7a10('0x12')]=moment['utc']();_0x59626c[_0x7a10('0x13')]=![];_0x59626c[_0x7a10('0x14')]=![];if(_0x49b669['endUserType']==='contact'||_0x49b669[_0x7a10('0x15')]===_0x7a10('0x16')){_0x59626c[_0x7a10('0x17')]=_0x49b669['id'];}else if(_0x49b669['endUserType']===_0x7a10('0x18')){_0x59626c[_0x7a10('0x19')]=_0x49b669['id'];}}else if(_0x229b49[_0x7a10('0x10')]==='Case'){if(_0x49b669[_0x7a10('0x15')]===_0x7a10('0x1a')){_0x59626c[_0x7a10('0x1b')]=_0x49b669['id'];}else if(_0x49b669[_0x7a10('0x15')]===_0x7a10('0x18')){_0x59626c[_0x7a10('0x1c')]=_0x49b669['id'];}else if(_0x49b669[_0x7a10('0x15')]===_0x7a10('0x16')&&_0x229b49[_0x7a10('0x1d')]){_0x59626c[_0x229b49[_0x7a10('0x1d')]]=_0x49b669['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3573da[_0x7a10('0x1e')](_0x229b49['ticketType'])[_0x7a10('0x1f')](_0x59626c);}function getUser(_0x4f22b9,_0x2bad10,_0x521af4){if(!_[_0x7a10('0x20')](_0x2bad10)&&intUtil['validateEmail'](_0x2bad10)){var _0x25c910={'Email':_0x2bad10};var _0x2bb6fc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x521af4[_0x7a10('0x1e')](_0x7a10('0x21'))['find'](_0x25c910,_0x2bb6fc)[_0x7a10('0x22')]()[_0x7a10('0x23')](function(_0x144ae6){if(_0x144ae6['length']){var _0x7bfd87=_[_0x7a10('0x24')](_0x144ae6,function(_0x56d988){return _0x56d988[_0x7a10('0x25')]===_0x2bad10;});if(_0x7bfd87){logger['info']('Agent\x20%s\x20found.',_0x2bad10);return BPromise['resolve']({'id':_0x7bfd87['Id'],'name':_0x7bfd87[_0x7a10('0x26')]});}}else{logger[_0x7a10('0x27')](_0x7a10('0x28'),_0x2bad10);return _0x521af4[_0x7a10('0x29')]()[_0x7a10('0x23')](function(_0x1adb3f){return BPromise[_0x7a10('0x2a')]({'id':_0x1adb3f[_0x7a10('0x2b')],'name':_0x1adb3f['display_name']});});}});}else{logger[_0x7a10('0x27')](_0x7a10('0x28'),_0x2bad10);return _0x521af4[_0x7a10('0x29')]()['then'](function(_0x52c541){return BPromise[_0x7a10('0x2a')]({'id':_0x52c541['user_id'],'name':_0x52c541[_0x7a10('0x2c')]});});}}function getEndUser(_0x4daf04,_0x5c14c3,_0x4ac43b,_0x27042d,_0x565006){var _0x5ecbc1={'$or':{'Phone':_0x27042d}};var _0x21f676={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7a10('0x2a')]()[_0x7a10('0x23')](function(){logger[_0x7a10('0x27')](_0x7a10('0x2d'),_0x27042d,_0x5c14c3['moduleSearch']);switch(_0x5c14c3[_0x7a10('0x2e')]){case _0x7a10('0x2f'):var _0x2255bf=_['cloneDeep'](_0x5ecbc1);if(_0x5c14c3['additionalSearchContact']){var _0x1a41d4={};_0x1a41d4[_0x5c14c3[_0x7a10('0x30')]]=_0x27042d;_[_0x7a10('0x31')](_0x2255bf[_0x7a10('0x32')],_0x1a41d4);}return _0x565006[_0x7a10('0x1e')](_0x7a10('0x33'))['find'](_0x2255bf,_0x21f676)[_0x7a10('0x22')]()['then'](function(_0x3103d8){if(_0x3103d8&&_0x3103d8['length']){return _0x3103d8;}else{var _0x2787a7=_['cloneDeep'](_0x5ecbc1);if(_0x5c14c3[_0x7a10('0x34')]){var _0x4f9160={};_0x4f9160[_0x5c14c3[_0x7a10('0x34')]]=_0x27042d;_['merge'](_0x2787a7[_0x7a10('0x32')],_0x4f9160);}return _0x565006[_0x7a10('0x1e')](_0x7a10('0x35'))['find'](_0x2787a7,_0x21f676);}});case _0x7a10('0x36'):var _0x82c27e=_[_0x7a10('0x37')](_0x5ecbc1);if(_0x5c14c3[_0x7a10('0x38')]){var _0x1a41d4={};_0x1a41d4[_0x5c14c3[_0x7a10('0x38')]]=_0x27042d;_['merge'](_0x82c27e['$or'],_0x1a41d4);}return _0x565006[_0x7a10('0x1e')]('Account')[_0x7a10('0x24')](_0x82c27e,_0x21f676)[_0x7a10('0x22')]()[_0x7a10('0x23')](function(_0x23caed){if(_0x23caed&&_0x23caed[_0x7a10('0x39')]){return _0x23caed;}else{var _0x188368=_[_0x7a10('0x37')](_0x5ecbc1);if(_0x5c14c3['additionalSearchContact']){var _0x55227f={};_0x55227f[_0x5c14c3[_0x7a10('0x30')]]=_0x27042d;_[_0x7a10('0x31')](_0x188368[_0x7a10('0x32')],_0x55227f);}return _0x565006[_0x7a10('0x1e')](_0x7a10('0x33'))[_0x7a10('0x24')](_0x188368,_0x21f676)['then'](function(_0x45d8a3){if(_0x45d8a3&&_0x45d8a3[_0x7a10('0x39')]){return _0x45d8a3;}else{var _0x50a477=_[_0x7a10('0x37')](_0x5ecbc1);if(_0x5c14c3['additionalSearchLead']){var _0x1ddbd7={};_0x1ddbd7[_0x5c14c3[_0x7a10('0x34')]]=_0x27042d;_[_0x7a10('0x31')](_0x50a477['$or'],_0x1ddbd7);}return _0x565006[_0x7a10('0x1e')](_0x7a10('0x35'))[_0x7a10('0x24')](_0x50a477,_0x21f676);}});}});case _0x7a10('0x1a'):var _0x2255bf=_[_0x7a10('0x37')](_0x5ecbc1);if(_0x5c14c3[_0x7a10('0x30')]){var _0x1a41d4={};_0x1a41d4[_0x5c14c3['additionalSearchContact']]=_0x27042d;_['merge'](_0x2255bf[_0x7a10('0x32')],_0x1a41d4);}return _0x565006[_0x7a10('0x1e')](_0x7a10('0x33'))['find'](_0x2255bf,_0x21f676)[_0x7a10('0x22')]();case'lead':var _0x150e7a=_[_0x7a10('0x37')](_0x5ecbc1);if(_0x5c14c3[_0x7a10('0x34')]){var _0x1a41d4={};_0x1a41d4[_0x5c14c3[_0x7a10('0x34')]]=_0x27042d;_['merge'](_0x150e7a[_0x7a10('0x32')],_0x1a41d4);}return _0x565006['sobject'](_0x7a10('0x35'))[_0x7a10('0x24')](_0x150e7a,_0x21f676);case _0x7a10('0x18'):var _0x82c27e=_[_0x7a10('0x37')](_0x5ecbc1);if(_0x5c14c3['additionalSearchAccount']){var _0x1a41d4={};_0x1a41d4[_0x5c14c3[_0x7a10('0x38')]]=_0x27042d;_[_0x7a10('0x31')](_0x82c27e[_0x7a10('0x32')],_0x1a41d4);}return _0x565006[_0x7a10('0x1e')](_0x7a10('0x3a'))['find'](_0x82c27e,_0x21f676);default:return null;}})[_0x7a10('0x23')](function(_0x2963f4){if(_0x2963f4&&_0x2963f4[_0x7a10('0x39')]){var _0x18ede8=_[_0x7a10('0x3b')](_0x2963f4);if(_0x18ede8){return BPromise[_0x7a10('0x2a')]({'id':_0x18ede8['Id'],'name':_0x18ede8[_0x7a10('0x26')],'phone':_0x18ede8['Phone'],'endUserType':_0x18ede8[_0x7a10('0x3c')][_0x7a10('0x3d')]['toLowerCase']()});}}})[_0x7a10('0x23')](function(_0x4d64b3){if(_0x4d64b3){logger[_0x7a10('0x27')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4d64b3[_0x7a10('0x15')],_0x27042d);return BPromise['resolve'](_0x4d64b3);}else{logger['info'](_0x7a10('0x3e'),_0x27042d);var _0x40b35c={'Phone':_0x27042d};if(_0x5c14c3[_0x7a10('0x3f')]){if(_0x5c14c3[_0x7a10('0x3f')]===_0x7a10('0x1a')){logger[_0x7a10('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x27042d,_0x5c14c3['moduleCreate']);_0x40b35c[_0x7a10('0x40')]=_0x4ac43b!==_0x7a10('0x41')?_0x4ac43b:util[_0x7a10('0x42')](_0x7a10('0x43'),_0x27042d);}else if(_0x5c14c3[_0x7a10('0x3f')]===_0x7a10('0x16')){logger[_0x7a10('0x27')](_0x7a10('0x44'),_0x27042d,_0x5c14c3[_0x7a10('0x3f')]);_0x40b35c[_0x7a10('0x40')]=_0x4ac43b!==_0x7a10('0x41')?_0x4ac43b:util[_0x7a10('0x42')]('Caller\x20-\x20%s',_0x27042d);_0x40b35c[_0x7a10('0x45')]='No\x20Company';}else if(_0x5c14c3['moduleCreate']==='account'){logger[_0x7a10('0x27')](_0x7a10('0x44'),_0x27042d,_0x5c14c3[_0x7a10('0x3f')]);_0x40b35c[_0x7a10('0x26')]=_0x4ac43b!==''?_0x4ac43b:util[_0x7a10('0x42')]('Caller\x20-\x20%s',_0x27042d);}else{return null;}}return _0x565006['sobject'](_[_0x7a10('0x46')](_0x5c14c3[_0x7a10('0x3f')]))['create'](_0x40b35c)[_0x7a10('0x23')](function(_0x265ef4){return BPromise[_0x7a10('0x2a')]({'id':_0x265ef4['id'],'endUserType':_0x5c14c3[_0x7a10('0x3f')]});});}});}function getCustomFields(_0x241b11,_0x24c04e){var _0x171ef1={};if(_0x241b11['length']>0x0){_['forEach'](_0x241b11,function(_0x3ed572){if(_['includes']([_0x7a10('0x47'),'picklist'],_0x3ed572[_0x7a10('0x3d')])&&_0x3ed572[_0x7a10('0x48')]){_0x171ef1[_0x3ed572[_0x7a10('0x48')]]=_0x3ed572['content']['toString']();}else if(_0x3ed572[_0x7a10('0x3d')]===_0x7a10('0x49')&&_0x3ed572['variableName']&&_0x3ed572['idField']){_0x24c04e[_0x3ed572[_0x7a10('0x4a')]]&&(_0x171ef1[_0x3ed572[_0x7a10('0x48')]]=_0x24c04e[_0x3ed572['variableName']][_0x7a10('0x4b')]());}else if(_0x3ed572[_0x7a10('0x3d')]===_0x7a10('0x4c')&&_0x3ed572[_0x7a10('0x4d')]&&_0x3ed572['Variable'][_0x7a10('0x4e')]&&_0x3ed572[_0x7a10('0x48')]){_0x24c04e[_0x3ed572[_0x7a10('0x4d')]['name'][_0x7a10('0x4f')]()]&&(_0x171ef1[_0x3ed572[_0x7a10('0x48')]]=_0x24c04e[_0x3ed572['Variable'][_0x7a10('0x4e')][_0x7a10('0x4f')]()]['toString']());}});}return _0x171ef1;}function getConnection(_0x2854bd){var _0x465cf2=_0x2854bd[_0x7a10('0x50')]['concat'](_0x2854bd[_0x7a10('0x51')]);var _0x557310=new jsforce[(_0x7a10('0x52'))]({'oauth2':{'loginUrl':_0x2854bd[_0x7a10('0x53')]||_0x7a10('0x54'),'clientId':_0x2854bd['clientId'],'clientSecret':_0x2854bd['clientSecret']}});return _0x557310[_0x7a10('0x55')](_0x2854bd[_0x7a10('0x56')],_0x465cf2)[_0x7a10('0x23')](function(){logger['info'](_0x7a10('0x57'));return _0x557310;});}exports[_0x7a10('0x58')]=function(_0xfbccc7,_0x5aa527,_0x2c9c06,_0x5109c3,_0x3acc1d,_0x4913fb){var _0x36ce42,_0x120585,_0x6149df,_0x23ad00;_0x4913fb['serverUrl']=intUtil['stripTrailingSlash'](_0x4913fb[_0x7a10('0x59')]);_0x4913fb[_0x7a10('0x53')]=intUtil[_0x7a10('0x5a')](_0x4913fb[_0x7a10('0x53')]);if(_0x3acc1d&&_0x3acc1d[_0x7a10('0x5b')]){logger[_0x7a10('0x27')]('[QUEUE]',_0x7a10('0x5c'));_0x5aa527[_0x7a10('0x5d')]=util[_0x7a10('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4913fb[_0x7a10('0x59')],_0x5aa527[_0x7a10('0x5e')],md5(_0x5aa527['uniqueid']));}else{_0x5aa527[_0x7a10('0x5d')]='';}return getConnection(_0x4913fb)[_0x7a10('0x23')](function(_0x45d23d){_0x23ad00=_0x45d23d;return getUser(_0x4913fb,_0x5109c3['email'],_0x23ad00);})[_0x7a10('0x23')](function(_0xbddb4d){_0x36ce42=_0xbddb4d;return getEndUser(_0x4913fb,_0x2c9c06,_0x5aa527['calleridname'],_0x5aa527[_0x7a10('0x5f')],_0x23ad00);})[_0x7a10('0x23')](function(_0x5ec553){_0x120585=_0x5ec553;return getTicket(_0x4913fb,_0x36ce42,_0x120585,_0x2c9c06,_0x5aa527,_0x2c9c06[_0x7a10('0x60')],_0x23ad00,'queue');})[_0x7a10('0x23')](function(_0x236c52){_0x6149df=_0x236c52;logger[_0x7a10('0x27')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x6149df['id']);logger[_0x7a10('0x27')](_0x7a10('0x61'),_0x6149df['id'],_0x5109c3[_0x7a10('0x4e')],_0x4913fb[_0x7a10('0x3d')]);switch(_0x4913fb[_0x7a10('0x3d')]){case _0x7a10('0x62'):emit(util[_0x7a10('0x42')](_0x7a10('0x63'),_0x5109c3[_0x7a10('0x4e')]),_0x7a10('0x64'),{'recordId':_0x6149df['id']});break;case _0x7a10('0x65'):emit(util[_0x7a10('0x42')](_0x7a10('0x63'),_0x5109c3[_0x7a10('0x4e')]),_0x7a10('0x66'),{'uri':util['format']('%s/%s/e',_0x23ad00['instanceUrl'],_0x6149df['id'])});break;default:logger[_0x7a10('0x67')](_0x7a10('0x68'));}})['catch'](function(_0x1127e0){logger[_0x7a10('0x67')](_0x7a10('0x69'),_0x1127e0);});};exports['outbound']=function(_0x243efd,_0x3eb6a5,_0x4d1dea,_0x5ed005,_0x5916bb,_0x26eac5,_0x3ad95d){var _0x124ba0,_0x49cc09,_0x2802f6,_0x5b57c2;_0x26eac5['serverUrl']=intUtil[_0x7a10('0x5a')](_0x26eac5[_0x7a10('0x59')]);_0x26eac5['remoteUri']=intUtil[_0x7a10('0x5a')](_0x26eac5[_0x7a10('0x53')]);if(_0x3ad95d&&_0x3ad95d['recordingFormat']&&_0x3ad95d['recordingFormat']!=='none'){logger[_0x7a10('0x27')](_0x7a10('0x6a'),_0x7a10('0x5c'));_0x3eb6a5[_0x7a10('0x5d')]=util[_0x7a10('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x26eac5['serverUrl'],_0x3eb6a5['uniqueid'],md5(_0x3eb6a5[_0x7a10('0x5e')]));}return getConnection(_0x26eac5)[_0x7a10('0x23')](function(_0x198530){_0x5b57c2=_0x198530;return getUser(_0x26eac5,_0x5ed005['email'],_0x5b57c2);})[_0x7a10('0x23')](function(_0xaee6b){_0x124ba0=_0xaee6b;return getEndUser(_0x26eac5,_0x4d1dea,_0x3eb6a5[_0x7a10('0x6b')],_0x3eb6a5[_0x7a10('0x6c')],_0x5b57c2);})[_0x7a10('0x23')](function(_0x799d55){_0x49cc09=_0x799d55;return getTicket(_0x26eac5,_0x124ba0,_0x49cc09,_0x4d1dea,_0x3eb6a5,_0x4d1dea[_0x7a10('0x60')],_0x5b57c2,_0x7a10('0x6d'));})[_0x7a10('0x23')](function(_0x3318cf){_0x2802f6=_0x3318cf;logger['info'](_0x7a10('0x6e'),_0x2802f6['id']);logger[_0x7a10('0x27')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2802f6['id'],_0x5ed005[_0x7a10('0x4e')],_0x26eac5[_0x7a10('0x3d')]);switch(_0x26eac5[_0x7a10('0x3d')]){case _0x7a10('0x62'):emit(util[_0x7a10('0x42')]('user:%s',_0x5ed005[_0x7a10('0x4e')]),_0x7a10('0x64'),{'recordId':_0x2802f6['id']});break;case'newTab':emit(util[_0x7a10('0x42')](_0x7a10('0x63'),_0x5ed005[_0x7a10('0x4e')]),'trigger:browser:url',{'uri':util[_0x7a10('0x42')](_0x7a10('0x6f'),_0x5b57c2[_0x7a10('0x70')],_0x2802f6['id'])});break;default:logger['error'](_0x7a10('0x6a'),_0x7a10('0x71'));}})[_0x7a10('0x72')](function(_0x1748a7){logger[_0x7a10('0x67')]('[OUTBOUND]',_0x1748a7);});};exports['unmanaged']=function(_0x30b44d,_0x370dc4,_0x599b27,_0x1a9938,_0x489eae,_0x4ff231){var _0x435b2e,_0x10e355,_0x30a71e,_0x58a7ea;_0x4ff231['serverUrl']=intUtil['stripTrailingSlash'](_0x4ff231[_0x7a10('0x59')]);_0x4ff231['remoteUri']=intUtil[_0x7a10('0x5a')](_0x4ff231[_0x7a10('0x53')]);if(_0x489eae&&_0x489eae['monitor_format']){logger[_0x7a10('0x27')]('['+_0x370dc4[_0x7a10('0x73')][_0x7a10('0x74')]()+']',_0x7a10('0x5c'));_0x370dc4[_0x7a10('0x5d')]=util[_0x7a10('0x42')](_0x7a10('0x75'),_0x4ff231[_0x7a10('0x59')],_0x370dc4[_0x7a10('0x5e')],md5(_0x370dc4[_0x7a10('0x5e')]));}else{_0x370dc4['recordingURL']='';}return getConnection(_0x4ff231)[_0x7a10('0x23')](function(_0xd851e8){_0x58a7ea=_0xd851e8;if(!_[_0x7a10('0x20')](_0x1a9938)){return getUser(_0x4ff231,_0x1a9938[_0x7a10('0x4e')],_0x58a7ea);}else{return getUser(_0x4ff231,null,_0x58a7ea);}})[_0x7a10('0x23')](function(_0x9e4ba){_0x435b2e=_0x9e4ba;return getEndUser(_0x4ff231,_0x599b27,_0x370dc4[_0x7a10('0x76')],_0x370dc4[_0x7a10('0x5f')],_0x58a7ea);})[_0x7a10('0x23')](function(_0x5bd8e3){_0x10e355=_0x5bd8e3;return getTicket(_0x4ff231,_0x435b2e,_0x10e355,_0x599b27,_0x370dc4,_0x599b27[_0x7a10('0x60')],_0x58a7ea);})[_0x7a10('0x23')](function(_0x14629c){_0x30a71e=_0x14629c;logger[_0x7a10('0x27')]('['+_0x370dc4[_0x7a10('0x73')][_0x7a10('0x74')]()+_0x7a10('0x77'),_0x30a71e['id']);logger[_0x7a10('0x27')]('['+_0x370dc4[_0x7a10('0x73')][_0x7a10('0x74')]()+_0x7a10('0x78'),_0x4ff231['type']);})[_0x7a10('0x72')](function(_0x443734){logger[_0x7a10('0x67')]('['+_0x370dc4[_0x7a10('0x73')][_0x7a10('0x74')]()+']',_0x443734);});}; \ No newline at end of file +var _0x675a=['endUserType','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','additionalSearchAccount','merge','Lead','Account','first','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Company','No\x20Company','Caller\x20-\x20%s','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','Fields','trigger:browser:url','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact'];(function(_0x5865b9,_0x4e5ca2){var _0x183404=function(_0x391a23){while(--_0x391a23){_0x5865b9['push'](_0x5865b9['shift']());}};_0x183404(++_0x4e5ca2);}(_0x675a,0x68));var _0xa675=function(_0x3f1068,_0x2d4f61){_0x3f1068=_0x3f1068-0x0;var _0x54c89c=_0x675a[_0x3f1068];return _0x54c89c;};'use strict';var _=require(_0xa675('0x0'));var rp=require(_0xa675('0x1'));var moment=require(_0xa675('0x2'));var BPromise=require(_0xa675('0x3'));var md5=require(_0xa675('0x4'));var jsforce=require(_0xa675('0x5'));var util=require('util');var Redis=require(_0xa675('0x6'));var intUtil=require(_0xa675('0x7'));var config=require(_0xa675('0x8'));var logger=require(_0xa675('0x9'))(_0xa675('0xa'));config[_0xa675('0xb')]=_[_0xa675('0xc')](config[_0xa675('0xb')],{'host':_0xa675('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x44b339,_0xbce3e0,_0x6adde){io['to'](_0x44b339)[_0xa675('0xe')](_0xbce3e0,_0x6adde);}function getTicket(_0x1caa35,_0x3c2fc3,_0x275939,_0x26b8f7,_0x137f36,_0x1fd06d,_0x9f5eb7,_0x2952a9){var _0x135682=Object['assign']({},{'OwnerId':_0x3c2fc3['id'],'Subject':intUtil[_0xa675('0xf')](_0x26b8f7[_0xa675('0x10')],_0x137f36,'\x20'),'Description':intUtil[_0xa675('0xf')](_0x26b8f7[_0xa675('0x11')],_0x137f36,'\x0a')},getCustomFields(_0x1fd06d,_0x137f36));if(_0x275939){if(_0x26b8f7[_0xa675('0x12')]===_0xa675('0x13')){_0x135682[_0xa675('0x14')]=moment[_0xa675('0x15')]();_0x135682[_0xa675('0x16')]=![];_0x135682[_0xa675('0x17')]=![];if(_0x275939['endUserType']===_0xa675('0x18')||_0x275939[_0xa675('0x19')]===_0xa675('0x1a')){_0x135682[_0xa675('0x1b')]=_0x275939['id'];}else if(_0x275939[_0xa675('0x19')]===_0xa675('0x1c')){_0x135682[_0xa675('0x1d')]=_0x275939['id'];}}else if(_0x26b8f7['ticketType']==='Case'){if(_0x275939[_0xa675('0x19')]===_0xa675('0x18')){_0x135682[_0xa675('0x1e')]=_0x275939['id'];}else if(_0x275939[_0xa675('0x19')]==='account'){_0x135682[_0xa675('0x1f')]=_0x275939['id'];}else if(_0x275939[_0xa675('0x19')]==='lead'&&_0x26b8f7['leadId']){_0x135682[_0x26b8f7[_0xa675('0x20')]]=_0x275939['id'];}else{logger[_0xa675('0x21')](_0xa675('0x22'));}}}return _0x9f5eb7[_0xa675('0x23')](_0x26b8f7[_0xa675('0x12')])[_0xa675('0x24')](_0x135682);}function getUser(_0x58b46e,_0x5b0784,_0x47ee7a){if(!_[_0xa675('0x25')](_0x5b0784)&&intUtil[_0xa675('0x26')](_0x5b0784)){var _0x14f2d0={'Email':_0x5b0784};var _0x2f9ca3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x47ee7a['sobject']('User')[_0xa675('0x27')](_0x14f2d0,_0x2f9ca3)[_0xa675('0x28')]()[_0xa675('0x29')](function(_0x502cf3){if(_0x502cf3[_0xa675('0x2a')]){var _0x120e71=_[_0xa675('0x27')](_0x502cf3,function(_0x331821){return _0x331821['Email']===_0x5b0784;});if(_0x120e71){logger[_0xa675('0x21')](_0xa675('0x2b'),_0x5b0784);return BPromise[_0xa675('0x2c')]({'id':_0x120e71['Id'],'name':_0x120e71[_0xa675('0x2d')]});}}else{logger[_0xa675('0x21')](_0xa675('0x2e'),_0x5b0784);return _0x47ee7a[_0xa675('0x2f')]()[_0xa675('0x29')](function(_0x52eed1){return BPromise[_0xa675('0x2c')]({'id':_0x52eed1[_0xa675('0x30')],'name':_0x52eed1[_0xa675('0x31')]});});}});}else{logger[_0xa675('0x21')](_0xa675('0x2e'),_0x5b0784);return _0x47ee7a[_0xa675('0x2f')]()[_0xa675('0x29')](function(_0x11b418){return BPromise[_0xa675('0x2c')]({'id':_0x11b418[_0xa675('0x30')],'name':_0x11b418[_0xa675('0x31')]});});}}function getEndUser(_0x325d98,_0x414509,_0x544921,_0x4fcf10,_0x3c22de){var _0x59fb39={'$or':{'Phone':_0x4fcf10}};var _0x17a0f3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa675('0x29')](function(){logger[_0xa675('0x21')](_0xa675('0x32'),_0x4fcf10,_0x414509[_0xa675('0x33')]);switch(_0x414509[_0xa675('0x33')]){case _0xa675('0x34'):var _0x751f7d=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x36')]){var _0x63aeb1={};_0x63aeb1[_0x414509['additionalSearchContact']]=_0x4fcf10;_['merge'](_0x751f7d[_0xa675('0x37')],_0x63aeb1);}return _0x3c22de['sobject'](_0xa675('0x38'))[_0xa675('0x27')](_0x751f7d,_0x17a0f3)[_0xa675('0x28')]()['then'](function(_0x1bfc90){if(_0x1bfc90&&_0x1bfc90['length']){return _0x1bfc90;}else{var _0x37e5b0=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x39')]){var _0x371240={};_0x371240[_0x414509['additionalSearchLead']]=_0x4fcf10;_['merge'](_0x37e5b0['$or'],_0x371240);}return _0x3c22de[_0xa675('0x23')]('Lead')['find'](_0x37e5b0,_0x17a0f3);}});case'account_contact_lead':var _0x39b18f=_['cloneDeep'](_0x59fb39);if(_0x414509['additionalSearchAccount']){var _0x63aeb1={};_0x63aeb1[_0x414509[_0xa675('0x3a')]]=_0x4fcf10;_['merge'](_0x39b18f[_0xa675('0x37')],_0x63aeb1);}return _0x3c22de[_0xa675('0x23')]('Account')[_0xa675('0x27')](_0x39b18f,_0x17a0f3)[_0xa675('0x28')]()[_0xa675('0x29')](function(_0x38842c){if(_0x38842c&&_0x38842c[_0xa675('0x2a')]){return _0x38842c;}else{var _0x5e2456=_[_0xa675('0x35')](_0x59fb39);if(_0x414509['additionalSearchContact']){var _0x14c14={};_0x14c14[_0x414509[_0xa675('0x36')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x5e2456['$or'],_0x14c14);}return _0x3c22de['sobject'](_0xa675('0x38'))[_0xa675('0x27')](_0x5e2456,_0x17a0f3)[_0xa675('0x29')](function(_0x10cbfc){if(_0x10cbfc&&_0x10cbfc[_0xa675('0x2a')]){return _0x10cbfc;}else{var _0x815d1a=_[_0xa675('0x35')](_0x59fb39);if(_0x414509['additionalSearchLead']){var _0x178455={};_0x178455[_0x414509[_0xa675('0x39')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x815d1a[_0xa675('0x37')],_0x178455);}return _0x3c22de[_0xa675('0x23')](_0xa675('0x3c'))[_0xa675('0x27')](_0x815d1a,_0x17a0f3);}});}});case _0xa675('0x18'):var _0x751f7d=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x36')]){var _0x63aeb1={};_0x63aeb1[_0x414509['additionalSearchContact']]=_0x4fcf10;_['merge'](_0x751f7d['$or'],_0x63aeb1);}return _0x3c22de[_0xa675('0x23')](_0xa675('0x38'))[_0xa675('0x27')](_0x751f7d,_0x17a0f3)[_0xa675('0x28')]();case _0xa675('0x1a'):var _0x9bda98=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x39')]){var _0x63aeb1={};_0x63aeb1[_0x414509[_0xa675('0x39')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x9bda98[_0xa675('0x37')],_0x63aeb1);}return _0x3c22de[_0xa675('0x23')]('Lead')[_0xa675('0x27')](_0x9bda98,_0x17a0f3);case _0xa675('0x1c'):var _0x39b18f=_[_0xa675('0x35')](_0x59fb39);if(_0x414509[_0xa675('0x3a')]){var _0x63aeb1={};_0x63aeb1[_0x414509[_0xa675('0x3a')]]=_0x4fcf10;_[_0xa675('0x3b')](_0x39b18f['$or'],_0x63aeb1);}return _0x3c22de['sobject'](_0xa675('0x3d'))[_0xa675('0x27')](_0x39b18f,_0x17a0f3);default:return null;}})[_0xa675('0x29')](function(_0xc009af){if(_0xc009af&&_0xc009af[_0xa675('0x2a')]){var _0x3fd5b1=_[_0xa675('0x3e')](_0xc009af);if(_0x3fd5b1){return BPromise[_0xa675('0x2c')]({'id':_0x3fd5b1['Id'],'name':_0x3fd5b1[_0xa675('0x2d')],'phone':_0x3fd5b1[_0xa675('0x3f')],'endUserType':_0x3fd5b1['attributes'][_0xa675('0x40')]['toLowerCase']()});}}})[_0xa675('0x29')](function(_0x13b428){if(_0x13b428){logger['info'](_0xa675('0x41'),_0x13b428[_0xa675('0x19')],_0x4fcf10);return BPromise['resolve'](_0x13b428);}else{logger[_0xa675('0x21')](_0xa675('0x42'),_0x4fcf10);var _0x3a9301={'Phone':_0x4fcf10};if(_0x414509['moduleCreate']){if(_0x414509[_0xa675('0x43')]==='contact'){logger[_0xa675('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4fcf10,_0x414509[_0xa675('0x43')]);_0x3a9301[_0xa675('0x44')]=_0x544921!==''?_0x544921:util[_0xa675('0x45')]('Caller\x20-\x20%s',_0x4fcf10);}else if(_0x414509[_0xa675('0x43')]==='lead'){logger[_0xa675('0x21')](_0xa675('0x46'),_0x4fcf10,_0x414509[_0xa675('0x43')]);_0x3a9301[_0xa675('0x44')]=_0x544921!==_0xa675('0x47')?_0x544921:util[_0xa675('0x45')]('Caller\x20-\x20%s',_0x4fcf10);_0x3a9301[_0xa675('0x48')]=_0xa675('0x49');}else if(_0x414509[_0xa675('0x43')]==='account'){logger['info'](_0xa675('0x46'),_0x4fcf10,_0x414509[_0xa675('0x43')]);_0x3a9301[_0xa675('0x2d')]=_0x544921!==_0xa675('0x47')?_0x544921:util[_0xa675('0x45')](_0xa675('0x4a'),_0x4fcf10);}else{return null;}}return _0x3c22de[_0xa675('0x23')](_['upperFirst'](_0x414509[_0xa675('0x43')]))[_0xa675('0x24')](_0x3a9301)['then'](function(_0x286a79){return BPromise['resolve']({'id':_0x286a79['id'],'endUserType':_0x414509[_0xa675('0x43')]});});}});}function getCustomFields(_0x3e28ce,_0x1424ad){var _0x2867fe={};if(_0x3e28ce[_0xa675('0x2a')]>0x0){_[_0xa675('0x4b')](_0x3e28ce,function(_0x8c4d48){if(_[_0xa675('0x4c')]([_0xa675('0x4d'),_0xa675('0x4e')],_0x8c4d48[_0xa675('0x40')])&&_0x8c4d48[_0xa675('0x4f')]){_0x2867fe[_0x8c4d48[_0xa675('0x4f')]]=_0x8c4d48[_0xa675('0x50')][_0xa675('0x51')]();}else if(_0x8c4d48[_0xa675('0x40')]===_0xa675('0x52')&&_0x8c4d48[_0xa675('0x53')]&&_0x8c4d48[_0xa675('0x4f')]){_0x1424ad[_0x8c4d48[_0xa675('0x53')]]&&(_0x2867fe[_0x8c4d48['idField']]=_0x1424ad[_0x8c4d48[_0xa675('0x53')]]['toString']());}else if(_0x8c4d48['type']===_0xa675('0x54')&&_0x8c4d48['Variable']&&_0x8c4d48[_0xa675('0x55')][_0xa675('0x56')]&&_0x8c4d48[_0xa675('0x4f')]){_0x1424ad[_0x8c4d48[_0xa675('0x55')]['name'][_0xa675('0x57')]()]&&(_0x2867fe[_0x8c4d48['idField']]=_0x1424ad[_0x8c4d48[_0xa675('0x55')][_0xa675('0x56')][_0xa675('0x57')]()][_0xa675('0x51')]());}});}return _0x2867fe;}function getConnection(_0x5a0a01){var _0x322431=_0x5a0a01[_0xa675('0x58')][_0xa675('0x59')](_0x5a0a01[_0xa675('0x5a')]);var _0x5c43e5=new jsforce[(_0xa675('0x5b'))]({'oauth2':{'loginUrl':_0x5a0a01[_0xa675('0x5c')]||'https://login.salesforce.com','clientId':_0x5a0a01[_0xa675('0x5d')],'clientSecret':_0x5a0a01[_0xa675('0x5e')]}});return _0x5c43e5['login'](_0x5a0a01['username'],_0x322431)[_0xa675('0x29')](function(){logger[_0xa675('0x21')](_0xa675('0x5f'));return _0x5c43e5;});}exports[_0xa675('0x60')]=function(_0x591e96,_0x3ce8fd,_0xb6b187,_0x10a344,_0x26f41d,_0x51601d){var _0x1492ea,_0x4893d6,_0x91047e,_0x11c733;_0x51601d[_0xa675('0x61')]=intUtil[_0xa675('0x62')](_0x51601d['serverUrl']);_0x51601d[_0xa675('0x5c')]=intUtil[_0xa675('0x62')](_0x51601d[_0xa675('0x5c')]);if(_0x26f41d&&_0x26f41d[_0xa675('0x63')]){logger[_0xa675('0x21')](_0xa675('0x64'),_0xa675('0x65'));_0x3ce8fd[_0xa675('0x66')]=util[_0xa675('0x45')](_0xa675('0x67'),_0x51601d[_0xa675('0x61')],_0x3ce8fd['uniqueid'],md5(_0x3ce8fd['uniqueid']));}else{_0x3ce8fd['recordingURL']='';}return getConnection(_0x51601d)[_0xa675('0x29')](function(_0x3d1881){_0x11c733=_0x3d1881;return getUser(_0x51601d,_0x10a344[_0xa675('0x68')],_0x11c733);})[_0xa675('0x29')](function(_0x4c6381){_0x1492ea=_0x4c6381;return getEndUser(_0x51601d,_0xb6b187,_0x3ce8fd['calleridname'],_0x3ce8fd[_0xa675('0x69')],_0x11c733);})['then'](function(_0x28a98f){_0x4893d6=_0x28a98f;return getTicket(_0x51601d,_0x1492ea,_0x4893d6,_0xb6b187,_0x3ce8fd,_0xb6b187['Fields'],_0x11c733,'queue');})[_0xa675('0x29')](function(_0x662fa1){_0x91047e=_0x662fa1;logger[_0xa675('0x21')](_0xa675('0x6a'),_0x91047e['id']);logger[_0xa675('0x21')](_0xa675('0x6b'),_0x91047e['id'],_0x10a344[_0xa675('0x56')],_0x51601d[_0xa675('0x40')]);switch(_0x51601d['type']){case _0xa675('0x6c'):emit(util['format']('user:%s',_0x10a344['name']),_0xa675('0x6d'),{'recordId':_0x91047e['id']});break;case _0xa675('0x6e'):emit(util[_0xa675('0x45')](_0xa675('0x6f'),_0x10a344[_0xa675('0x56')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x11c733[_0xa675('0x70')],_0x91047e['id'])});break;default:logger[_0xa675('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa675('0x72')](function(_0x473ff9){logger[_0xa675('0x71')](_0xa675('0x64'),_0x473ff9);});};exports[_0xa675('0x73')]=function(_0x4f20c7,_0x1f4d52,_0x48ff48,_0x345e8a,_0x40ca50,_0x59568e,_0x57ee18){var _0x6eaa09,_0x440df5,_0x41eb8a,_0x2b69f2;_0x59568e['serverUrl']=intUtil['stripTrailingSlash'](_0x59568e[_0xa675('0x61')]);_0x59568e[_0xa675('0x5c')]=intUtil[_0xa675('0x62')](_0x59568e[_0xa675('0x5c')]);if(_0x57ee18&&_0x57ee18[_0xa675('0x74')]&&_0x57ee18['recordingFormat']!==_0xa675('0x75')){logger[_0xa675('0x21')](_0xa675('0x76'),_0xa675('0x65'));_0x1f4d52[_0xa675('0x66')]=util[_0xa675('0x45')](_0xa675('0x67'),_0x59568e[_0xa675('0x61')],_0x1f4d52[_0xa675('0x77')],md5(_0x1f4d52[_0xa675('0x77')]));}return getConnection(_0x59568e)[_0xa675('0x29')](function(_0x78b998){_0x2b69f2=_0x78b998;return getUser(_0x59568e,_0x345e8a['email'],_0x2b69f2);})[_0xa675('0x29')](function(_0x261e10){_0x6eaa09=_0x261e10;return getEndUser(_0x59568e,_0x48ff48,_0x1f4d52[_0xa675('0x78')],_0x1f4d52['destcalleridnum'],_0x2b69f2);})[_0xa675('0x29')](function(_0x1297a2){_0x440df5=_0x1297a2;return getTicket(_0x59568e,_0x6eaa09,_0x440df5,_0x48ff48,_0x1f4d52,_0x48ff48[_0xa675('0x79')],_0x2b69f2,_0xa675('0x73'));})['then'](function(_0x442ad8){_0x41eb8a=_0x442ad8;logger[_0xa675('0x21')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x41eb8a['id']);logger[_0xa675('0x21')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x41eb8a['id'],_0x345e8a[_0xa675('0x56')],_0x59568e[_0xa675('0x40')]);switch(_0x59568e[_0xa675('0x40')]){case _0xa675('0x6c'):emit(util[_0xa675('0x45')](_0xa675('0x6f'),_0x345e8a['name']),_0xa675('0x6d'),{'recordId':_0x41eb8a['id']});break;case'newTab':emit(util[_0xa675('0x45')](_0xa675('0x6f'),_0x345e8a[_0xa675('0x56')]),_0xa675('0x7a'),{'uri':util['format'](_0xa675('0x7b'),_0x2b69f2['instanceUrl'],_0x41eb8a['id'])});break;default:logger[_0xa675('0x71')]('[OUTBOUND]',_0xa675('0x7c'));}})[_0xa675('0x72')](function(_0x5bc5eb){logger['error']('[OUTBOUND]',_0x5bc5eb);});};exports[_0xa675('0x7d')]=function(_0x512820,_0x2678a1,_0x4f252,_0x5bab1f,_0xe3045b,_0x43b50a){var _0x26baa1,_0x36ba3b,_0x4b5fa9,_0x41d0ae;_0x43b50a[_0xa675('0x61')]=intUtil[_0xa675('0x62')](_0x43b50a[_0xa675('0x61')]);_0x43b50a[_0xa675('0x5c')]=intUtil[_0xa675('0x62')](_0x43b50a[_0xa675('0x5c')]);if(_0xe3045b&&_0xe3045b[_0xa675('0x63')]){logger[_0xa675('0x21')]('['+_0x2678a1[_0xa675('0x7e')][_0xa675('0x7f')]()+']',_0xa675('0x65'));_0x2678a1[_0xa675('0x66')]=util['format'](_0xa675('0x67'),_0x43b50a[_0xa675('0x61')],_0x2678a1[_0xa675('0x77')],md5(_0x2678a1[_0xa675('0x77')]));}else{_0x2678a1['recordingURL']='';}return getConnection(_0x43b50a)[_0xa675('0x29')](function(_0x539c1d){_0x41d0ae=_0x539c1d;if(!_[_0xa675('0x25')](_0x5bab1f)){return getUser(_0x43b50a,_0x5bab1f[_0xa675('0x56')],_0x41d0ae);}else{return getUser(_0x43b50a,null,_0x41d0ae);}})[_0xa675('0x29')](function(_0x59b344){_0x26baa1=_0x59b344;return getEndUser(_0x43b50a,_0x4f252,_0x2678a1[_0xa675('0x80')],_0x2678a1['calleridnum'],_0x41d0ae);})[_0xa675('0x29')](function(_0x4e6258){_0x36ba3b=_0x4e6258;return getTicket(_0x43b50a,_0x26baa1,_0x36ba3b,_0x4f252,_0x2678a1,_0x4f252['Fields'],_0x41d0ae);})[_0xa675('0x29')](function(_0x307b8e){_0x4b5fa9=_0x307b8e;logger[_0xa675('0x21')]('['+_0x2678a1[_0xa675('0x7e')][_0xa675('0x7f')]()+']\x20Ticket\x20%s\x20created.',_0x4b5fa9['id']);logger[_0xa675('0x21')]('['+_0x2678a1[_0xa675('0x7e')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x43b50a[_0xa675('0x40')]);})[_0xa675('0x72')](function(_0x306802){logger[_0xa675('0x71')]('['+_0x2678a1[_0xa675('0x7e')][_0xa675('0x7f')]()+']',_0x306802);});}; \ 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 54bdfe6..cd2ec75 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 _0xc85b=['type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','util','md5','ioredis','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','],\x20getAdminUser\x20crm','catch','toUpperCase','message','info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist'];(function(_0x40b070,_0x20cfac){var _0x10c8b7=function(_0xbee9a2){while(--_0xbee9a2){_0x40b070['push'](_0x40b070['shift']());}};_0x10c8b7(++_0x20cfac);}(_0xc85b,0x189));var _0xbc85=function(_0x4bb567,_0x549dc1){_0x4bb567=_0x4bb567-0x0;var _0x567d2b=_0xc85b[_0x4bb567];return _0x567d2b;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xbc85('0x0'));var md5=require(_0xbc85('0x1'));var Redis=require(_0xbc85('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xbc85('0x3'))(_0xbc85('0x4'));config[_0xbc85('0x5')]=_[_0xbc85('0x6')](config[_0xbc85('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbc85('0x7'))(new Redis(config[_0xbc85('0x5')]));function getAdminUser(_0x2d2d42,_0x10a21b,_0x41cd7c,_0x19f5c8,_0x4096d8,_0x4f8597){return new Promise(function(_0x2138e2,_0x35e9e5){var _0x3481d4={'method':_0xbc85('0x8'),'uri':_0x19f5c8+_0xbc85('0x9')+'&'+_0x4096d8+'&'+_0x4f8597,'auth':_0x10a21b,'json':!![]};return rp(_0x3481d4)[_0xbc85('0xa')](function(_0x46679f){if(_0x46679f[_0xbc85('0xb')][_0xbc85('0xc')]>0x0){_0x41cd7c[_0xbc85('0xd')]=_0x46679f[_0xbc85('0xb')][0x0][_0xbc85('0xe')];}logger['info']('['+[_0x2d2d42['toUpperCase']()]+_0xbc85('0xf'),_0x41cd7c);_0x2138e2(_0x41cd7c);})[_0xbc85('0x10')](function(_0xee00ff){logger['error']('['+[_0x2d2d42[_0xbc85('0x11')]()]+']',_0xee00ff[_0xbc85('0x12')]);_0x35e9e5(_0xee00ff[_0xbc85('0x12')]);});});}function getUser(_0x4740b5,_0x4cd6dd,_0x17d36d,_0x781a7,_0x42b721){return function(_0x257d53){logger[_0xbc85('0x13')]('['+[_0x4740b5[_0xbc85('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x257d53);return new Promise(function(_0x1b0e66,_0x540343){if(intUtil[_0xbc85('0x14')](_0x257d53[_0xbc85('0x15')])){var _0x4739c6={'method':'GET','uri':_0x17d36d+_0xbc85('0x16')+_0x257d53[_0xbc85('0x15')]+'&'+_0x781a7+'&'+_0x42b721,'auth':_0x4cd6dd,'json':!![]};logger[_0xbc85('0x13')]('['+[_0x4740b5[_0xbc85('0x11')]()]+_0xbc85('0x17'),_0x4739c6);return rp(_0x4739c6)['then'](function(_0x52b969){logger['info']('['+[_0x4740b5[_0xbc85('0x11')]()]+_0xbc85('0x18'),_0x52b969);if(_0x52b969[_0xbc85('0xb')][_0xbc85('0xc')]>0x0&&String(_0x52b969['result'][0x0]['active'])===_0xbc85('0x19')){_0x257d53['userId']=_0x52b969['result'][0x0][_0xbc85('0xe')];}else{_0x257d53[_0xbc85('0x1a')]=_0x257d53[_0xbc85('0xd')];_0x257d53['userEmail']=_0x257d53[_0xbc85('0x1b')];}logger['info']('['+[_0x4740b5[_0xbc85('0x11')]()]+_0xbc85('0x1c'),_0x257d53);_0x1b0e66(_0x257d53);})['catch'](function(_0x5c9d1c){logger[_0xbc85('0x1d')]('['+[_0x4740b5[_0xbc85('0x11')]()]+']',_0x5c9d1c[_0xbc85('0x12')]);_0x540343(_0x5c9d1c[_0xbc85('0x12')]);});}else{logger[_0xbc85('0x13')]('['+[_0x4740b5[_0xbc85('0x11')]()]+_0xbc85('0x1e'));_0x257d53['userId']=_0x257d53['adminId'];_0x257d53[_0xbc85('0x15')]=_0x257d53[_0xbc85('0x1b')];_0x1b0e66(_0x257d53);}});};}function createEndUser(_0x2636b3,_0x536945,_0x5be72f,_0x3679a0,_0x81ad0f){logger[_0xbc85('0x13')]('['+[_0x2636b3[_0xbc85('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x5be72f);return new Promise(function(_0x3444b3,_0x3bbfb2){var _0x229839={'method':'POST','uri':_0x3679a0+_0xbc85('0x1f')+_0x81ad0f,'body':{'user_name':_0x5be72f['endUserNumber'],'roles':_0xbc85('0x20'),'first_name':_0x5be72f[_0xbc85('0x21')],'active':'true','date_format':_0xbc85('0x22'),'phone':_0x5be72f['endUserNumber']},'auth':_0x536945,'json':!![]};return rp(_0x229839)[_0xbc85('0xa')](function(_0x1b7278){logger[_0xbc85('0x13')]('['+[_0x2636b3['toUpperCase']()]+_0xbc85('0x23'),_0x1b7278[_0xbc85('0xb')]);_0x5be72f['endUserId']=_0x1b7278[_0xbc85('0xb')][_0xbc85('0xe')];_0x3444b3(_0x5be72f);})[_0xbc85('0x10')](function(_0x12ff51){logger[_0xbc85('0x1d')]('['+[_0x2636b3['toUpperCase']()]+']',_0x12ff51['message']);_0x3bbfb2(_0x12ff51[_0xbc85('0x12')]);});});}function getEndUser(_0x1f41a4,_0x447a50,_0x175944,_0x1a8e06,_0x1db94d){return function(_0x4319cc){logger[_0xbc85('0x13')]('['+[_0x1f41a4['toUpperCase']()]+_0xbc85('0x24'),_0x4319cc);return new Promise(function(_0x190486,_0x2da6a9){var _0x5459dd={'method':_0xbc85('0x8'),'uri':_0x175944+_0xbc85('0x25')+_0x4319cc[_0xbc85('0x21')]+'&'+_0x1a8e06+'&'+_0x1db94d,'auth':_0x447a50,'json':!![]};return rp(_0x5459dd)[_0xbc85('0xa')](function(_0x43ae2e){if(_0x43ae2e[_0xbc85('0xb')][_0xbc85('0xc')]>0x0){_0x4319cc['endUserId']=_0x43ae2e[_0xbc85('0xb')][0x0][_0xbc85('0xe')];logger['info']('['+[_0x1f41a4[_0xbc85('0x11')]()]+_0xbc85('0x26'),_0x4319cc);_0x190486(_0x4319cc);}else{return createEndUser(_0x1f41a4,_0x447a50,_0x4319cc,_0x175944,_0x1a8e06)['then'](function(_0x4b2239){logger['info']('['+[_0x1f41a4[_0xbc85('0x11')]()]+_0xbc85('0x27'),_0x4b2239);_0x190486(_0x4b2239);});}})[_0xbc85('0x10')](function(_0x5ec445){logger[_0xbc85('0x1d')]('['+[_0x1f41a4['toUpperCase']()]+']',_0x5ec445[_0xbc85('0x12')]);_0x2da6a9(_0x5ec445[_0xbc85('0x12')]);});});};}function getCustomFields(_0x5d9f1d,_0x2bb46e){var _0x59b8ad={};if(_0x5d9f1d[_0xbc85('0xc')]>0x0){_[_0xbc85('0x28')](_0x5d9f1d,function(_0x15d01e){if(_[_0xbc85('0x29')](['string',_0xbc85('0x2a')],_0x15d01e[_0xbc85('0x2b')])&&_0x15d01e[_0xbc85('0x2c')]&&!_0x15d01e[_0xbc85('0x2d')]){_0x59b8ad[_0x15d01e[_0xbc85('0x2c')][_0xbc85('0x2e')]()]=_0x15d01e[_0xbc85('0x2f')][_0xbc85('0x30')]();}else if(_[_0xbc85('0x29')]([_0xbc85('0x31'),'picklist'],_0x15d01e[_0xbc85('0x2b')])&&_0x15d01e[_0xbc85('0x32')]&&_0x15d01e[_0xbc85('0x2d')]){_0x59b8ad[_0x15d01e[_0xbc85('0x32')][_0xbc85('0x2e')]()]=_0x15d01e[_0xbc85('0x2f')][_0xbc85('0x30')]();}else if(_0x15d01e[_0xbc85('0x2b')]===_0xbc85('0x33')&&_0x15d01e['variableName']&&_0x15d01e[_0xbc85('0x32')]&&_0x15d01e[_0xbc85('0x2d')]){_0x59b8ad[_0x15d01e[_0xbc85('0x32')]['toLowerCase']()]=_0x2bb46e[_0x15d01e[_0xbc85('0x34')]][_0xbc85('0x30')]();}else if(_0x15d01e[_0xbc85('0x2b')]==='customVariable'&&_0x15d01e['Variable']&&_0x15d01e[_0xbc85('0x35')][_0xbc85('0x36')]&&_0x15d01e[_0xbc85('0x32')]&&_0x15d01e[_0xbc85('0x2d')]){_0x59b8ad[_0x15d01e[_0xbc85('0x32')][_0xbc85('0x2e')]()]=_0x2bb46e[_0x15d01e[_0xbc85('0x35')][_0xbc85('0x36')]['toLowerCase']()][_0xbc85('0x30')]();}});}return _0x59b8ad;}function getTicket(_0x4d282d,_0x74c5ea,_0x31e9e6,_0x49e66a,_0x587d52,_0x15b23f){return function(_0xeaf644){logger['info']('['+[_0x4d282d[_0xbc85('0x11')]()]+_0xbc85('0x37'),_0xeaf644);return new Promise(function(_0x4316b6,_0x2284e9){var _0x2a6ea9=_0x4d282d['toLowerCase']()===_0xbc85('0x38')?_0xeaf644[_0xbc85('0x1a')]:_0xeaf644[_0xbc85('0x39')];var _0x5f156b={'method':'POST','uri':_0x31e9e6+_0xbc85('0x3a')+'?'+_0x15b23f,'body':Object[_0xbc85('0x3b')]({},{'active':_0xbc85('0x19'),'caller_id':_0x2a6ea9,'assigned_to':_0xeaf644[_0xbc85('0x1a')],'short_description':intUtil[_0xbc85('0x3c')](_0x49e66a['Subjects'],_0x587d52,'\x20'),'description':intUtil['getString'](_0x49e66a[_0xbc85('0x3d')],_0x587d52,'\x0a')},getCustomFields(_0x49e66a[_0xbc85('0x3e')],_0x587d52)),'auth':_0x74c5ea,'json':!![]};return rp(_0x5f156b)['then'](function(_0x361c2d){logger[_0xbc85('0x13')]('['+[_0x4d282d[_0xbc85('0x11')]()]+_0xbc85('0x3f'),_0x361c2d[_0xbc85('0xb')]);_0xeaf644[_0xbc85('0x40')]=_0x361c2d['result'][_0xbc85('0xe')];_0xeaf644[_0xbc85('0x41')]=_0x361c2d[_0xbc85('0xb')][_0xbc85('0x42')];logger[_0xbc85('0x13')]('['+[_0x4d282d[_0xbc85('0x11')]()]+_0xbc85('0x43'),_0xeaf644);_0x4316b6(_0xeaf644);})['catch'](function(_0x2efe9f){logger[_0xbc85('0x1d')]('['+[_0x4d282d[_0xbc85('0x11')]()]+']',_0x2efe9f['message']);_0x2284e9(_0x2efe9f[_0xbc85('0x12')]);});});};}function createRemoteTag(_0x506c45,_0x342013,_0x1478b0,_0x49cdc4){return new Promise(function(_0xefedf5,_0x24d737){var _0x5d6228={'method':_0xbc85('0x44'),'uri':_0x1478b0+_0xbc85('0x45')+'?'+_0x49cdc4,'body':{'short_description':_0x506c45,'global':!![],'active':!![],'name':_0x506c45},'auth':_0x342013,'json':!![]};return rp(_0x5d6228)[_0xbc85('0xa')](function(_0x2bca6b){var _0x5e7c85=_0x2bca6b[_0xbc85('0xb')]['sys_id'];_0xefedf5(_0x5e7c85);});});}function getRemoteTag(_0x492c74,_0x1d3053,_0x2f0a36,_0x4fd8a9,_0x134135){return new Promise(function(_0x555584,_0x3b3897){var _0x368581={'method':_0xbc85('0x8'),'uri':_0x2f0a36+'label'+'?sysparm_query=name%3D'+_0x492c74+'&'+_0x4fd8a9,'auth':_0x1d3053,'json':!![]};return rp(_0x368581)[_0xbc85('0xa')](function(_0x5c1026){if(_0x5c1026[_0xbc85('0xb')]['length']>0x0){var _0x5baad3=_0x5c1026[_0xbc85('0xb')][0x0][_0xbc85('0xe')];_0x555584(_0x5baad3);}else{return createRemoteTag(_0x492c74,_0x1d3053,_0x2f0a36,_0x4fd8a9)[_0xbc85('0xa')](function(_0x7fc9b6){_0x555584(_0x7fc9b6);});}});});}function assignTagToIncident(_0x361e18,_0x333950,_0x20b6e3,_0x22113d,_0x3c55d3){return new Promise(function(_0x28c149,_0x296bb2){var _0x23758a={'method':'POST','uri':_0x20b6e3+_0xbc85('0x46')+'?'+_0x3c55d3,'body':{'label':_0x361e18,'table':'incident','id_type':'Incident','table_key':_0x22113d['ticketId'],'title':'Incident\x20-\x20'+_0x22113d['ticketNumber'],'id_display':_0x22113d[_0xbc85('0x41')]},'auth':_0x333950,'json':!![]};return rp(_0x23758a)[_0xbc85('0xa')](function(_0x15e71a){_0x28c149();})[_0xbc85('0x10')](function(){_0x28c149();});});}function manageTags(_0x5a6a55,_0x57e1ee,_0x468111,_0x338d79,_0x4136f5,_0x4310fe,_0x5c0a74){return new Promise(function(_0x4c440b,_0x47c232){var _0x2b9731=[];_0x57e1ee['forEach'](function(_0x571c64){_0x2b9731[_0xbc85('0x47')](getRemoteTag(_0x571c64,_0x468111,_0x338d79,_0x4310fe,_0x5c0a74));});return Promise[_0xbc85('0x48')](_0x2b9731)['then'](function(_0x409753){if(_0x409753[_0xbc85('0xc')]){logger['info']('['+[_0x5a6a55[_0xbc85('0x11')]()]+_0xbc85('0x49'),_0x409753);var _0x2d6095=[];_0x409753[_0xbc85('0x28')](function(_0x1b8b81){_0x2d6095['push'](assignTagToIncident(_0x1b8b81,_0x468111,_0x338d79,_0x4136f5,_0x4310fe));});return Promise[_0xbc85('0x48')](_0x2d6095)['then'](function(){_0x4c440b();})[_0xbc85('0x10')](function(){_0x4c440b();});}else{_0x4c440b();}});});}function getTags(_0x5b8bde,_0x52fd86,_0x23b3f8,_0x5a73a2,_0x458360,_0x3cdbe5){return function(_0x2b8c81){return new Promise(function(_0x12c3ec,_0x423ef5){var _0x510803=[];var _0x161618=_0x5a73a2[_0xbc85('0x4a')];if(_0x161618&&_0x161618[_0xbc85('0xc')]>0x0){_0x510803=_['map'](_0x161618,_0xbc85('0x36'));}if(_0x510803[_0xbc85('0xc')]>0x0){return manageTags(_0x5b8bde,_0x510803,_0x52fd86,_0x23b3f8,_0x2b8c81,_0x458360,_0x3cdbe5)[_0xbc85('0xa')](function(){_0x12c3ec(_0x2b8c81);});}else{_0x12c3ec(_0x2b8c81);}});};}function emit(_0x229a0b,_0x11b0c7,_0x2fef33){var _0x7b1569='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xbc85('0x4b')+_0xbc85('0x4c');var _0x502368={'uri':_0x229a0b+_0xbc85('0x4d')+_0x2fef33+_0x7b1569};io['to'](util[_0xbc85('0x4e')](_0xbc85('0x4f'),_0x11b0c7))[_0xbc85('0x50')](_0xbc85('0x51'),_0x502368);}exports['cs']=function(_0x4a271c,_0x49ac9a,_0x4369e6,_0x3f2a33,_0x534335,_0x2786bf,_0x4d8652,_0x2513cb){var _0x393604={};var _0x365fd2={'user':_0x2786bf[_0xbc85('0x52')],'pass':_0x2786bf[_0xbc85('0x53')]};var _0x159bb8=_0xbc85('0x54');var _0x55c9f2=_0xbc85('0x55');_0x2786bf[_0xbc85('0x56')]=intUtil[_0xbc85('0x57')](_0x2786bf[_0xbc85('0x56')]);_0x2786bf[_0xbc85('0x58')]=intUtil['stripTrailingSlash'](_0x2786bf[_0xbc85('0x58')]);var _0x19c114=util[_0xbc85('0x4e')](_0xbc85('0x59'),_0x2786bf[_0xbc85('0x56')]);_0x393604[_0xbc85('0x15')]=!_[_0xbc85('0x5a')](_0x3f2a33)?_0x3f2a33[_0xbc85('0x5b')]:null;_0x393604['adminEmail']=_0x2786bf[_0xbc85('0x5b')];_0x393604[_0xbc85('0x21')]=_0x2513cb['toLowerCase']()===_0xbc85('0x38')?_0x49ac9a[_0xbc85('0x5c')]:_0x49ac9a[_0xbc85('0x5d')];_0x393604[_0xbc85('0x5e')]=_0x2513cb===_0xbc85('0x5f')||_0x2513cb===_0xbc85('0x60')?_0xbc85('0x5f'):_0xbc85('0x38');var _0x4763f6=util[_0xbc85('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2786bf[_0xbc85('0x58')],_0x49ac9a['uniqueid'],md5(_0x49ac9a[_0xbc85('0x61')]));if(_0x534335&&_0x534335[_0xbc85('0x62')]){logger['info'](_0xbc85('0x63'),_0xbc85('0x64'));_0x49ac9a['recordingURL']=_0x4763f6;}else if(_0x4d8652&&_0x4d8652[_0xbc85('0x65')]&&_0x4d8652[_0xbc85('0x65')]!==_0xbc85('0x66')){logger['info'](_0xbc85('0x67'),'Recording\x20is\x20enabled!');_0x49ac9a[_0xbc85('0x68')]=_0x4763f6;}else{_0x49ac9a['recordingURL']='';}return getAdminUser(_0x2513cb,_0x365fd2,_0x393604,_0x19c114,_0x55c9f2,_0x159bb8)[_0xbc85('0xa')](getUser(_0x2513cb,_0x365fd2,_0x19c114,_0x55c9f2,_0x159bb8))[_0xbc85('0xa')](getEndUser(_0x2513cb,_0x365fd2,_0x19c114,_0x55c9f2,_0x159bb8))[_0xbc85('0xa')](getTicket(_0x2513cb,_0x365fd2,_0x19c114,_0x4369e6,_0x49ac9a,_0x55c9f2))[_0xbc85('0xa')](function(_0x40fc8f){logger[_0xbc85('0x13')](util[_0xbc85('0x4e')](_0xbc85('0x69'),_0x40fc8f['ticketId']));logger[_0xbc85('0x13')](util[_0xbc85('0x4e')](_0xbc85('0x6a'),_0x2513cb));if(_0x2513cb!==_0xbc85('0x60')){logger[_0xbc85('0x13')]('['+[_0x2513cb['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2786bf[_0xbc85('0x56')],_0x3f2a33[_0xbc85('0x36')],_0x40fc8f[_0xbc85('0x40')]);}})[_0xbc85('0x10')](function(_0x394e69){logger[_0xbc85('0x1d')]('['+[_0x2513cb[_0xbc85('0x11')]()]+_0xbc85('0x6b'),util[_0xbc85('0x6c')](_0x394e69,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc924=[']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','adminEmail','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','content','toString','string','picklist','idField','variable','variableName','toLowerCase','Variable','name'];(function(_0x27354f,_0x2972a5){var _0x573b7e=function(_0x401665){while(--_0x401665){_0x27354f['push'](_0x27354f['shift']());}};_0x573b7e(++_0x2972a5);}(_0xc924,0x1e0));var _0x4c92=function(_0x5babf9,_0x51b7be){_0x5babf9=_0x5babf9-0x0;var _0x42f6f4=_0xc924[_0x5babf9];return _0x42f6f4;};'use strict';var _=require(_0x4c92('0x0'));var Promise=require(_0x4c92('0x1'));var rp=require(_0x4c92('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x4c92('0x3'));var intUtil=require(_0x4c92('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4c92('0x5'))(_0x4c92('0x6'));config[_0x4c92('0x7')]=_[_0x4c92('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4c92('0x9'))(new Redis(config[_0x4c92('0x7')]));function getAdminUser(_0x4d7f2a,_0x24830a,_0x72fb5b,_0x33d42d,_0xf0700f,_0x5bb597){return new Promise(function(_0x3840bb,_0x3ea092){var _0x1bdc6e={'method':_0x4c92('0xa'),'uri':_0x33d42d+_0x4c92('0xb')+'&'+_0xf0700f+'&'+_0x5bb597,'auth':_0x24830a,'json':!![]};return rp(_0x1bdc6e)[_0x4c92('0xc')](function(_0x333f73){if(_0x333f73['result'][_0x4c92('0xd')]>0x0){_0x72fb5b[_0x4c92('0xe')]=_0x333f73[_0x4c92('0xf')][0x0]['sys_id'];}logger[_0x4c92('0x10')]('['+[_0x4d7f2a[_0x4c92('0x11')]()]+_0x4c92('0x12'),_0x72fb5b);_0x3840bb(_0x72fb5b);})[_0x4c92('0x13')](function(_0x16b107){logger[_0x4c92('0x14')]('['+[_0x4d7f2a[_0x4c92('0x11')]()]+']',_0x16b107[_0x4c92('0x15')]);_0x3ea092(_0x16b107[_0x4c92('0x15')]);});});}function getUser(_0x30251f,_0x438ce1,_0xc12dc1,_0x3c1f9c,_0xa37464){return function(_0xb07ae2){logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+'],\x20getUser\x20input\x20crm',_0xb07ae2);return new Promise(function(_0x85cbc7,_0x45f1d7){if(intUtil['validateEmail'](_0xb07ae2[_0x4c92('0x16')])){var _0x12f1a1={'method':'GET','uri':_0xc12dc1+_0x4c92('0x17')+_0xb07ae2[_0x4c92('0x16')]+'&'+_0x3c1f9c+'&'+_0xa37464,'auth':_0x438ce1,'json':!![]};logger[_0x4c92('0x10')]('['+[_0x30251f['toUpperCase']()]+_0x4c92('0x18'),_0x12f1a1);return rp(_0x12f1a1)[_0x4c92('0xc')](function(_0xd3c2e6){logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+_0x4c92('0x19'),_0xd3c2e6);if(_0xd3c2e6[_0x4c92('0xf')][_0x4c92('0xd')]>0x0&&String(_0xd3c2e6[_0x4c92('0xf')][0x0]['active'])==='true'){_0xb07ae2[_0x4c92('0x1a')]=_0xd3c2e6[_0x4c92('0xf')][0x0][_0x4c92('0x1b')];}else{_0xb07ae2[_0x4c92('0x1a')]=_0xb07ae2[_0x4c92('0xe')];_0xb07ae2[_0x4c92('0x16')]=_0xb07ae2['adminEmail'];}logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+_0x4c92('0x1c'),_0xb07ae2);_0x85cbc7(_0xb07ae2);})['catch'](function(_0x3313a5){logger[_0x4c92('0x14')]('['+[_0x30251f[_0x4c92('0x11')]()]+']',_0x3313a5['message']);_0x45f1d7(_0x3313a5['message']);});}else{logger[_0x4c92('0x10')]('['+[_0x30251f[_0x4c92('0x11')]()]+_0x4c92('0x1d'));_0xb07ae2['userId']=_0xb07ae2[_0x4c92('0xe')];_0xb07ae2[_0x4c92('0x16')]=_0xb07ae2['adminEmail'];_0x85cbc7(_0xb07ae2);}});};}function createEndUser(_0xf56ba,_0x2b193b,_0x166c5b,_0x10f255,_0x4358fa){logger['info']('['+[_0xf56ba['toUpperCase']()]+_0x4c92('0x1e'),_0x166c5b);return new Promise(function(_0x5bbdc0,_0x5789cb){var _0x314d52={'method':_0x4c92('0x1f'),'uri':_0x10f255+_0x4c92('0x20')+_0x4358fa,'body':{'user_name':_0x166c5b['endUserNumber'],'roles':_0x4c92('0x21'),'first_name':_0x166c5b[_0x4c92('0x22')],'active':_0x4c92('0x23'),'date_format':'System','phone':_0x166c5b['endUserNumber']},'auth':_0x2b193b,'json':!![]};return rp(_0x314d52)[_0x4c92('0xc')](function(_0x55137a){logger['info']('['+[_0xf56ba['toUpperCase']()]+'],\x20EndUser\x20schema',_0x55137a['result']);_0x166c5b[_0x4c92('0x24')]=_0x55137a['result'][_0x4c92('0x1b')];_0x5bbdc0(_0x166c5b);})[_0x4c92('0x13')](function(_0x30bd09){logger[_0x4c92('0x14')]('['+[_0xf56ba['toUpperCase']()]+']',_0x30bd09[_0x4c92('0x15')]);_0x5789cb(_0x30bd09[_0x4c92('0x15')]);});});}function getEndUser(_0x1b7502,_0x8205df,_0x2de63b,_0x271e39,_0x296b93){return function(_0x1272a9){logger['info']('['+[_0x1b7502[_0x4c92('0x11')]()]+_0x4c92('0x25'),_0x1272a9);return new Promise(function(_0x1aaef3,_0x3d8b74){var _0x218e99={'method':'GET','uri':_0x2de63b+_0x4c92('0x26')+_0x1272a9[_0x4c92('0x22')]+'&'+_0x271e39+'&'+_0x296b93,'auth':_0x8205df,'json':!![]};return rp(_0x218e99)[_0x4c92('0xc')](function(_0x188a98){if(_0x188a98[_0x4c92('0xf')]['length']>0x0){_0x1272a9[_0x4c92('0x24')]=_0x188a98[_0x4c92('0xf')][0x0][_0x4c92('0x1b')];logger[_0x4c92('0x10')]('['+[_0x1b7502['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x1272a9);_0x1aaef3(_0x1272a9);}else{return createEndUser(_0x1b7502,_0x8205df,_0x1272a9,_0x2de63b,_0x271e39)['then'](function(_0x378bd3){logger[_0x4c92('0x10')]('['+[_0x1b7502[_0x4c92('0x11')]()]+_0x4c92('0x27'),_0x378bd3);_0x1aaef3(_0x378bd3);});}})[_0x4c92('0x13')](function(_0x27a9ae){logger['error']('['+[_0x1b7502[_0x4c92('0x11')]()]+']',_0x27a9ae[_0x4c92('0x15')]);_0x3d8b74(_0x27a9ae[_0x4c92('0x15')]);});});};}function getCustomFields(_0x3fa8b6,_0x4868ad){var _0xa68d2e={};if(_0x3fa8b6[_0x4c92('0xd')]>0x0){_[_0x4c92('0x28')](_0x3fa8b6,function(_0x465458){if(_[_0x4c92('0x29')](['string','picklist'],_0x465458[_0x4c92('0x2a')])&&_0x465458[_0x4c92('0x2b')]&&!_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458[_0x4c92('0x2b')]['toLowerCase']()]=_0x465458[_0x4c92('0x2d')][_0x4c92('0x2e')]();}else if(_[_0x4c92('0x29')]([_0x4c92('0x2f'),_0x4c92('0x30')],_0x465458[_0x4c92('0x2a')])&&_0x465458[_0x4c92('0x31')]&&_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458[_0x4c92('0x31')]['toLowerCase']()]=_0x465458[_0x4c92('0x2d')][_0x4c92('0x2e')]();}else if(_0x465458[_0x4c92('0x2a')]===_0x4c92('0x32')&&_0x465458[_0x4c92('0x33')]&&_0x465458['idField']&&_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458[_0x4c92('0x31')][_0x4c92('0x34')]()]=_0x4868ad[_0x465458[_0x4c92('0x33')]]['toString']();}else if(_0x465458[_0x4c92('0x2a')]==='customVariable'&&_0x465458[_0x4c92('0x35')]&&_0x465458['Variable'][_0x4c92('0x36')]&&_0x465458[_0x4c92('0x31')]&&_0x465458[_0x4c92('0x2c')]){_0xa68d2e[_0x465458['idField'][_0x4c92('0x34')]()]=_0x4868ad[_0x465458[_0x4c92('0x35')][_0x4c92('0x36')][_0x4c92('0x34')]()]['toString']();}});}return _0xa68d2e;}function getTicket(_0x56da95,_0x3562ae,_0x3272c2,_0x84cc75,_0x1fcca0,_0x58c245){return function(_0x3469b0){logger[_0x4c92('0x10')]('['+[_0x56da95[_0x4c92('0x11')]()]+_0x4c92('0x37'),_0x3469b0);return new Promise(function(_0x6169d9,_0x343e29){var _0x3c4b23=_0x56da95['toLowerCase']()==='outbound'?_0x3469b0[_0x4c92('0x1a')]:_0x3469b0[_0x4c92('0x24')];var _0x21311f={'method':'POST','uri':_0x3272c2+_0x4c92('0x38')+'?'+_0x58c245,'body':Object[_0x4c92('0x39')]({},{'active':_0x4c92('0x23'),'caller_id':_0x3c4b23,'assigned_to':_0x3469b0['userId'],'short_description':intUtil['getString'](_0x84cc75['Subjects'],_0x1fcca0,'\x20'),'description':intUtil[_0x4c92('0x3a')](_0x84cc75[_0x4c92('0x3b')],_0x1fcca0,'\x0a')},getCustomFields(_0x84cc75['Fields'],_0x1fcca0)),'auth':_0x3562ae,'json':!![]};return rp(_0x21311f)[_0x4c92('0xc')](function(_0x576f93){logger[_0x4c92('0x10')]('['+[_0x56da95[_0x4c92('0x11')]()]+_0x4c92('0x3c'),_0x576f93['result']);_0x3469b0[_0x4c92('0x3d')]=_0x576f93['result']['sys_id'];_0x3469b0[_0x4c92('0x3e')]=_0x576f93[_0x4c92('0xf')][_0x4c92('0x3f')];logger[_0x4c92('0x10')]('['+[_0x56da95['toUpperCase']()]+_0x4c92('0x40'),_0x3469b0);_0x6169d9(_0x3469b0);})[_0x4c92('0x13')](function(_0x59d511){logger['error']('['+[_0x56da95[_0x4c92('0x11')]()]+']',_0x59d511['message']);_0x343e29(_0x59d511['message']);});});};}function createRemoteTag(_0x579e93,_0x5ab655,_0xd343c8,_0x1bfd83){return new Promise(function(_0x5e247c,_0x58f03a){var _0x2d20ce={'method':_0x4c92('0x1f'),'uri':_0xd343c8+_0x4c92('0x41')+'?'+_0x1bfd83,'body':{'short_description':_0x579e93,'global':!![],'active':!![],'name':_0x579e93},'auth':_0x5ab655,'json':!![]};return rp(_0x2d20ce)[_0x4c92('0xc')](function(_0x5ad824){var _0x7238b2=_0x5ad824[_0x4c92('0xf')][_0x4c92('0x1b')];_0x5e247c(_0x7238b2);});});}function getRemoteTag(_0x3cf9d1,_0x278e81,_0x3c0035,_0x59aa38,_0x3f034){return new Promise(function(_0x3e08df,_0x9e64b1){var _0x5c2403={'method':_0x4c92('0xa'),'uri':_0x3c0035+'label'+'?sysparm_query=name%3D'+_0x3cf9d1+'&'+_0x59aa38,'auth':_0x278e81,'json':!![]};return rp(_0x5c2403)[_0x4c92('0xc')](function(_0x3103f9){if(_0x3103f9['result']['length']>0x0){var _0x55049d=_0x3103f9[_0x4c92('0xf')][0x0]['sys_id'];_0x3e08df(_0x55049d);}else{return createRemoteTag(_0x3cf9d1,_0x278e81,_0x3c0035,_0x59aa38)[_0x4c92('0xc')](function(_0x47d7fd){_0x3e08df(_0x47d7fd);});}});});}function assignTagToIncident(_0xbdfdfa,_0x487219,_0x347d02,_0x4f145e,_0x57bf08){return new Promise(function(_0x311703,_0x193368){var _0x1769c4={'method':_0x4c92('0x1f'),'uri':_0x347d02+'label_entry'+'?'+_0x57bf08,'body':{'label':_0xbdfdfa,'table':'incident','id_type':_0x4c92('0x42'),'table_key':_0x4f145e[_0x4c92('0x3d')],'title':'Incident\x20-\x20'+_0x4f145e[_0x4c92('0x3e')],'id_display':_0x4f145e[_0x4c92('0x3e')]},'auth':_0x487219,'json':!![]};return rp(_0x1769c4)[_0x4c92('0xc')](function(_0x89a56c){_0x311703();})[_0x4c92('0x13')](function(){_0x311703();});});}function manageTags(_0x21171e,_0x26f416,_0x45fe79,_0x41e677,_0xb5c1ee,_0x4f126d,_0x5dd103){return new Promise(function(_0x1a679d,_0x3e31ec){var _0x3b3015=[];_0x26f416[_0x4c92('0x28')](function(_0x3a90d4){_0x3b3015[_0x4c92('0x43')](getRemoteTag(_0x3a90d4,_0x45fe79,_0x41e677,_0x4f126d,_0x5dd103));});return Promise[_0x4c92('0x44')](_0x3b3015)[_0x4c92('0xc')](function(_0x48fa5f){if(_0x48fa5f['length']){logger[_0x4c92('0x10')]('['+[_0x21171e[_0x4c92('0x11')]()]+_0x4c92('0x45'),_0x48fa5f);var _0xec997b=[];_0x48fa5f['forEach'](function(_0x21f113){_0xec997b[_0x4c92('0x43')](assignTagToIncident(_0x21f113,_0x45fe79,_0x41e677,_0xb5c1ee,_0x4f126d));});return Promise[_0x4c92('0x44')](_0xec997b)['then'](function(){_0x1a679d();})[_0x4c92('0x13')](function(){_0x1a679d();});}else{_0x1a679d();}});});}function getTags(_0x536d29,_0xb66ca7,_0x2eecf9,_0x1ea2ea,_0xb8932c,_0x790070){return function(_0xd07822){return new Promise(function(_0x389c43,_0x15a047){var _0x219c67=[];var _0x10804d=_0x1ea2ea[_0x4c92('0x46')];if(_0x10804d&&_0x10804d[_0x4c92('0xd')]>0x0){_0x219c67=_[_0x4c92('0x47')](_0x10804d,_0x4c92('0x36'));}if(_0x219c67[_0x4c92('0xd')]>0x0){return manageTags(_0x536d29,_0x219c67,_0xb66ca7,_0x2eecf9,_0xd07822,_0xb8932c,_0x790070)[_0x4c92('0xc')](function(){_0x389c43(_0xd07822);});}else{_0x389c43(_0xd07822);}});};}function emit(_0x216dde,_0x12c6e3,_0x38a716){var _0x3067b6=_0x4c92('0x48')+_0x4c92('0x49')+_0x4c92('0x4a')+_0x4c92('0x4b');var _0x3429da={'uri':_0x216dde+_0x4c92('0x4c')+_0x38a716+_0x3067b6};io['to'](util[_0x4c92('0x4d')](_0x4c92('0x4e'),_0x12c6e3))[_0x4c92('0x4f')](_0x4c92('0x50'),_0x3429da);}exports['cs']=function(_0x423753,_0x558340,_0x37ff01,_0x55e471,_0x394683,_0x2da286,_0x1254e4,_0x8aedf0){var _0x37fb91={};var _0x5649da={'user':_0x2da286['username'],'pass':_0x2da286[_0x4c92('0x51')]};var _0x567233=_0x4c92('0x52');var _0x125703=_0x4c92('0x53');_0x2da286[_0x4c92('0x54')]=intUtil[_0x4c92('0x55')](_0x2da286[_0x4c92('0x54')]);_0x2da286['serverUrl']=intUtil[_0x4c92('0x55')](_0x2da286['serverUrl']);var _0x367d47=util['format'](_0x4c92('0x56'),_0x2da286[_0x4c92('0x54')]);_0x37fb91[_0x4c92('0x16')]=!_[_0x4c92('0x57')](_0x55e471)?_0x55e471['email']:null;_0x37fb91[_0x4c92('0x58')]=_0x2da286['email'];_0x37fb91['endUserNumber']=_0x8aedf0['toLowerCase']()===_0x4c92('0x59')?_0x558340['destcalleridnum']:_0x558340[_0x4c92('0x5a')];_0x37fb91[_0x4c92('0x5b')]=_0x8aedf0===_0x4c92('0x5c')||_0x8aedf0===_0x4c92('0x5d')?_0x4c92('0x5c'):_0x4c92('0x59');var _0x177b05=util[_0x4c92('0x4d')](_0x4c92('0x5e'),_0x2da286[_0x4c92('0x5f')],_0x558340[_0x4c92('0x60')],md5(_0x558340[_0x4c92('0x60')]));if(_0x394683&&_0x394683['monitor_format']){logger['info'](_0x4c92('0x61'),'Recording\x20is\x20enabled!');_0x558340[_0x4c92('0x62')]=_0x177b05;}else if(_0x1254e4&&_0x1254e4[_0x4c92('0x63')]&&_0x1254e4[_0x4c92('0x63')]!==_0x4c92('0x64')){logger[_0x4c92('0x10')](_0x4c92('0x65'),'Recording\x20is\x20enabled!');_0x558340['recordingURL']=_0x177b05;}else{_0x558340[_0x4c92('0x62')]='';}return getAdminUser(_0x8aedf0,_0x5649da,_0x37fb91,_0x367d47,_0x125703,_0x567233)[_0x4c92('0xc')](getUser(_0x8aedf0,_0x5649da,_0x367d47,_0x125703,_0x567233))[_0x4c92('0xc')](getEndUser(_0x8aedf0,_0x5649da,_0x367d47,_0x125703,_0x567233))['then'](getTicket(_0x8aedf0,_0x5649da,_0x367d47,_0x37ff01,_0x558340,_0x125703))[_0x4c92('0xc')](function(_0x2730db){logger[_0x4c92('0x10')](util[_0x4c92('0x4d')](_0x4c92('0x66'),_0x2730db['ticketId']));logger['info'](util['format'](_0x4c92('0x67'),_0x8aedf0));if(_0x8aedf0!=='unmanaged'){logger[_0x4c92('0x10')]('['+[_0x8aedf0[_0x4c92('0x11')]()]+']',_0x4c92('0x68'));emit(_0x2da286[_0x4c92('0x54')],_0x55e471[_0x4c92('0x36')],_0x2730db[_0x4c92('0x3d')]);}})['catch'](function(_0x2a74be){logger[_0x4c92('0x14')]('['+[_0x8aedf0[_0x4c92('0x11')]()]+_0x4c92('0x69'),util[_0x4c92('0x6a')](_0x2a74be,{'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 87d79f3..d259b81 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 _0xe2b9=['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','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','map','type','string','nameField','toLowerCase','customField','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Inbound','Ticket\x20created!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','uri','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','users','monitor_format','lastevent','toUpperCase','calleridnum','The\x20Ticket\x20ID\x20is:','error','lodash','request-promise','md5','util','./util','../../../../config/environment','sugarcrm','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','entry_list'];(function(_0x4eda22,_0x3d2db4){var _0x4a5706=function(_0x4345e3){while(--_0x4345e3){_0x4eda22['push'](_0x4eda22['shift']());}};_0x4a5706(++_0x3d2db4);}(_0xe2b9,0x1b1));var _0x9e2b=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0xe2b9[_0x12aaee];return _0x37c350;};'use strict';var _=require(_0x9e2b('0x0'));var rp=require(_0x9e2b('0x1'));var BPromise=require('bluebird');var md5=require(_0x9e2b('0x2'));var util=require(_0x9e2b('0x3'));var Redis=require('ioredis');var intUtil=require(_0x9e2b('0x4'));var config=require(_0x9e2b('0x5'));var logger=require('../../../../config/logger')(_0x9e2b('0x6'));config['redis']=_['defaults'](config[_0x9e2b('0x7')],{'host':_0x9e2b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9e2b('0x7')]));var def={'method':_0x9e2b('0x9'),'json':!![]};function emit(_0x569958,_0x35c036,_0x422b67){io['to'](_0x569958)[_0x9e2b('0xa')](_0x35c036,_0x422b67);}function getTicket(_0x27788e,_0x44f0d7,_0xe783fa,_0xf4f1b6,_0x4f4591,_0x48ec69,_0x48c61d,_0x13ec85){logger[_0x9e2b('0xb')](_0x9e2b('0xc'));var _0x20c5e8=new Date();var _0xb0c1=[{'name':_0x9e2b('0xd'),'value':intUtil[_0x9e2b('0xe')](_0xf4f1b6[_0x9e2b('0xf')],_0x4f4591,'\x20')},{'name':_0x9e2b('0x10'),'value':_0x44f0d7['id']},{'name':_0x9e2b('0x11'),'value':_0x44f0d7['id']},{'name':_0x9e2b('0x12'),'value':intUtil['getString'](_0xf4f1b6[_0x9e2b('0x13')],_0x4f4591,'\x0a')},{'name':_0x9e2b('0x14'),'value':_0x20c5e8[_0x9e2b('0x15')]()[_0x9e2b('0x16')](0x0,0x13)[_0x9e2b('0x17')]('T','\x20')},{'name':_0x9e2b('0x18'),'value':'0'},{'name':_0x9e2b('0x19'),'value':'15'},{'name':_0x9e2b('0x1a'),'value':_0xe783fa['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0xe783fa[_0x9e2b('0xd')]},{'name':_0x9e2b('0x1b'),'value':_0x13ec85}];if(_0x48ec69[_0x9e2b('0x1c')]){_[_0x9e2b('0x1d')](_0x48ec69,function(_0x33963b){if(_0x4f4591[_0x33963b[_0x9e2b('0x1e')]]){_0xb0c1[_0x9e2b('0x1f')]({'name':_0x33963b[_0x9e2b('0x20')],'value':_0x4f4591[_0x33963b[_0x9e2b('0x1e')]]});}});}return request({'form':{'method':_0x9e2b('0x21'),'input_type':_0x9e2b('0x22'),'response_type':_0x9e2b('0x22'),'rest_data':JSON[_0x9e2b('0x23')]({'session':_0x48c61d['id'],'module_name':'Calls','name_value_list':_0xb0c1})}});}function getAuth(_0x96cfd1){return util[_0x9e2b('0x24')](_0x9e2b('0x25'),new Buffer(_0x96cfd1[_0x9e2b('0x26')]+':X')[_0x9e2b('0x27')]('base64'));}function getServerInfo(_0x2eafa2){return request({'form':{'method':_0x9e2b('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9e2b('0x23')]({'session':_0x2eafa2['id']})}});}function getUser(_0x56fd74,_0x371151,_0x1b9277){if(!_[_0x9e2b('0x29')](_0x371151)){logger[_0x9e2b('0xb')](_0x9e2b('0x2a'),_0x371151);return request({'form':{'method':_0x9e2b('0x2b'),'input_type':'JSON','response_type':_0x9e2b('0x22'),'rest_data':JSON[_0x9e2b('0x23')]({'session':_0x1b9277['id'],'module_name':'Employees','query':util[_0x9e2b('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x371151),'order_by':'','offset':'0','select_fields':['id',_0x9e2b('0xd'),_0x9e2b('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9e2b('0x2d')](function(_0x10ad13){if(_0x10ad13[_0x9e2b('0x2e')][_0x9e2b('0x1c')]){var _0x47be5a=_['find'](_0x10ad13[_0x9e2b('0x2e')],function(_0x2d1432){return _0x2d1432['name_value_list'][_0x9e2b('0x2c')][_0x9e2b('0x2f')]===_0x371151;});if(_0x47be5a){logger[_0x9e2b('0xb')](_0x9e2b('0x30'));return BPromise[_0x9e2b('0x31')]({'id':_0x47be5a['name_value_list']['id'][_0x9e2b('0x2f')],'name':_0x47be5a[_0x9e2b('0x32')][_0x9e2b('0xd')]['value']});}}logger[_0x9e2b('0xb')](_0x9e2b('0x33'));return BPromise['resolve']({'id':_0x1b9277[_0x9e2b('0x32')][_0x9e2b('0x34')][_0x9e2b('0x2f')],'name':_0x1b9277[_0x9e2b('0x32')][_0x9e2b('0x2c')][_0x9e2b('0x2f')]});});}else{logger['info'](_0x9e2b('0x35'));return BPromise[_0x9e2b('0x31')]({'id':_0x1b9277[_0x9e2b('0x32')][_0x9e2b('0x34')][_0x9e2b('0x2f')],'name':_0x1b9277[_0x9e2b('0x32')]['user_name'][_0x9e2b('0x2f')]});}}function getEndUser(_0x2d67e0,_0x44e34e,_0x2c186a,_0x15eb5c){logger[_0x9e2b('0xb')](_0x9e2b('0x36'),_0x2c186a);return request({'form':{'method':'get_entry_list','input_type':_0x9e2b('0x22'),'response_type':_0x9e2b('0x22'),'rest_data':JSON[_0x9e2b('0x23')]({'session':_0x15eb5c['id'],'module_name':_0x9e2b('0x37'),'query':util['format'](_0x9e2b('0x38'),_0x2c186a),'order_by':'','offset':'0','select_fields':['id',_0x9e2b('0xd'),_0x9e2b('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9e2b('0x2d')](function(_0xa0150d){if(_0xa0150d[_0x9e2b('0x2e')][_0x9e2b('0x1c')]){var _0x56b1dc=_[_0x9e2b('0x3a')](_0xa0150d[_0x9e2b('0x2e')],function(_0x5ac475){return _0x5ac475[_0x9e2b('0x32')][_0x9e2b('0x39')][_0x9e2b('0x2f')]===_0x2c186a;});if(_0x56b1dc){logger[_0x9e2b('0xb')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x56b1dc[_0x9e2b('0x32')]['id'][_0x9e2b('0x2f')],'name':_0x56b1dc[_0x9e2b('0x32')][_0x9e2b('0xd')][_0x9e2b('0x2f')],'phone':_0x56b1dc['name_value_list']['phone_home'][_0x9e2b('0x2f')]});}}else{logger[_0x9e2b('0xb')](_0x9e2b('0x3b'));return request({'form':{'method':_0x9e2b('0x21'),'input_type':_0x9e2b('0x22'),'response_type':_0x9e2b('0x22'),'rest_data':JSON[_0x9e2b('0x23')]({'session':_0x15eb5c['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9e2b('0x3c'),'value':_0x44e34e!==_0x9e2b('0x3d')?_0x44e34e:util[_0x9e2b('0x24')](_0x9e2b('0x3e'),_0x2c186a)},{'name':_0x9e2b('0x39'),'value':_0x2c186a}]})}})[_0x9e2b('0x2d')](function(_0x55ab34){logger['info'](_0x9e2b('0x3f'));return BPromise[_0x9e2b('0x31')]({'id':_0x55ab34['id'],'name':_0x55ab34['entry_list']['first_name']['value'],'phone':_0x55ab34[_0x9e2b('0x2e')][_0x9e2b('0x39')][_0x9e2b('0x2f')]});});}});}function request(_0x430870){logger['debug']('[HTTP]',JSON['stringify'](_0x430870));return rp(_[_0x9e2b('0x40')](def,_0x430870));}function getTags(_0x5a0ed1,_0x2aa4f6){var _0xab60db=[];if(_0x5a0ed1&&_0x5a0ed1[_0x9e2b('0x1c')]>0x0){_0xab60db=_[_0x9e2b('0x41')](_0x5a0ed1,_0x2aa4f6);}return _0xab60db;}function getCustomFields(_0x13ccd3,_0x1f839e){var _0x2dfe90=[];var _0x1fddc9={'custom_fields':[]};if(_0x13ccd3['length']>0x0){_[_0x9e2b('0x1d')](_0x13ccd3,function(_0x535ef1){if(_0x535ef1[_0x9e2b('0x42')]===_0x9e2b('0x43')&&_0x535ef1[_0x9e2b('0x44')]&&!_0x535ef1['customField']){_0x1fddc9[_0x535ef1[_0x9e2b('0x44')][_0x9e2b('0x45')]()]=_0x535ef1['content']['toString']();}else if(_0x535ef1[_0x9e2b('0x42')]===_0x9e2b('0x43')&&_0x535ef1[_0x9e2b('0x20')]&&_0x535ef1[_0x9e2b('0x46')]){_0x1fddc9[_0x9e2b('0x47')][_0x9e2b('0x1f')]({'id':_0x535ef1['idField'],'value':_0x535ef1['content'][_0x9e2b('0x27')]()});}else if(_0x535ef1[_0x9e2b('0x42')]==='variable'&&_0x535ef1[_0x9e2b('0x1e')]&&_0x535ef1[_0x9e2b('0x20')]&&_0x535ef1[_0x9e2b('0x46')]){_0x1f839e[_0x535ef1[_0x9e2b('0x1e')]]&&_0x1fddc9[_0x9e2b('0x47')][_0x9e2b('0x1f')]({'id':_0x535ef1[_0x9e2b('0x20')],'value':_0x1f839e[_0x535ef1['variableName']]['toString']()});}else if(_0x535ef1[_0x9e2b('0x42')]===_0x9e2b('0x48')&&_0x535ef1[_0x9e2b('0x49')]&&_0x535ef1[_0x9e2b('0x49')]['name']&&_0x535ef1[_0x9e2b('0x20')]&&_0x535ef1[_0x9e2b('0x46')]){_0x1f839e[_0x535ef1[_0x9e2b('0x49')][_0x9e2b('0xd')][_0x9e2b('0x45')]()]&&_0x1fddc9[_0x9e2b('0x47')][_0x9e2b('0x1f')]({'id':_0x535ef1['idField'],'value':_0x1f839e[_0x535ef1[_0x9e2b('0x49')][_0x9e2b('0xd')][_0x9e2b('0x45')]()][_0x9e2b('0x27')]()});}});}return _0x1fddc9;}function getConnection(_0x30fcd4){return request({'method':_0x9e2b('0x9'),'form':{'method':_0x9e2b('0x4a'),'input_type':_0x9e2b('0x22'),'response_type':_0x9e2b('0x22'),'rest_data':JSON[_0x9e2b('0x23')]({'user_auth':{'user_name':_0x30fcd4[_0x9e2b('0x4b')],'password':_0x30fcd4[_0x9e2b('0x4c')],'encryption':_0x9e2b('0x4d')},'application':_0x9e2b('0x4e')})}})['then'](function(_0x2ca908){var _0x1f1288=_0x2ca908;if(_0x1f1288['id']){def[_0x9e2b('0x4f')]=_0x1f1288['id'];return BPromise[_0x9e2b('0x31')](_0x1f1288);}else{throw new Error(util[_0x9e2b('0x24')](_0x9e2b('0x50'),_0x30fcd4['id']));}});}function setRelationship(_0x1d682d,_0x44749b,_0x4c1357,_0x57ee27){return request({'form':{'method':_0x9e2b('0x51'),'input_type':_0x9e2b('0x22'),'response_type':_0x9e2b('0x22'),'rest_data':JSON[_0x9e2b('0x23')]({'session':_0x1d682d['id'],'module_name':_0x9e2b('0x52'),'module_id':_0x4c1357['id'],'link_field_name':_0x57ee27,'related_ids':[_0x44749b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9e2b('0x53')]=function(_0x275e9f,_0x2234dd,_0x52f95f,_0x107652,_0x98914a,_0x4efe21){var _0x14d37d,_0xbfc90d,_0x454aec,_0x4555cf;_0x4efe21[_0x9e2b('0x54')]=intUtil[_0x9e2b('0x55')](_0x4efe21[_0x9e2b('0x54')]);_0x4efe21[_0x9e2b('0x56')]=intUtil[_0x9e2b('0x55')](_0x4efe21[_0x9e2b('0x56')]);def['uri']=util[_0x9e2b('0x24')](_0x9e2b('0x57'),_0x4efe21[_0x9e2b('0x54')]);if(_0x98914a&&_0x98914a['monitor_format']){logger[_0x9e2b('0xb')](_0x9e2b('0x58'),'Recording\x20is\x20enabled!');_0x2234dd[_0x9e2b('0x59')]=util[_0x9e2b('0x24')](_0x9e2b('0x5a'),_0x4efe21[_0x9e2b('0x56')],_0x2234dd['uniqueid'],md5(_0x2234dd[_0x9e2b('0x5b')]));}else{_0x2234dd[_0x9e2b('0x59')]='';}return getConnection(_0x4efe21)[_0x9e2b('0x2d')](function(_0x2e048c){_0x4555cf=_0x2e048c;return getUser(_0x4efe21,_0x107652[_0x9e2b('0xd')],_0x4555cf);})[_0x9e2b('0x2d')](function(_0x104b96){_0x14d37d=_0x104b96;logger[_0x9e2b('0xb')](_0x9e2b('0x5c'),_0x14d37d['id']);return getEndUser(_0x4efe21,_0x2234dd[_0x9e2b('0x5d')],_0x2234dd['calleridnum'],_0x4555cf);})[_0x9e2b('0x2d')](function(_0x16df55){_0xbfc90d=_0x16df55;logger[_0x9e2b('0xb')]('The\x20Enduser\x20ID\x20is:',_0xbfc90d['id']);return getTicket(_0x4efe21,_0x14d37d,_0xbfc90d,_0x52f95f,_0x2234dd,_0x52f95f['Fields'],_0x4555cf,_0x9e2b('0x5e'));})[_0x9e2b('0x2d')](function(_0x3ea738){_0x454aec=_0x3ea738;logger[_0x9e2b('0xb')](_0x9e2b('0x5f'));logger[_0x9e2b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x454aec['id']);return setRelationship(_0x4555cf,_0x14d37d,_0x454aec,'users');})['then'](function(){return setRelationship(_0x4555cf,_0xbfc90d,_0x454aec,_0x9e2b('0x60'));})[_0x9e2b('0x2d')](function(){return getServerInfo(_0x4555cf);})['then'](function(_0x675158){var _0x3bd04f=parseInt(_0x675158[_0x9e2b('0x61')][_0x9e2b('0x62')](0x0));var _0x331470=util[_0x9e2b('0x24')](_0x9e2b('0x63'),_0x4efe21[_0x9e2b('0x54')],_0x454aec['id']);if(_0x3bd04f>0x6){_0x331470=util[_0x9e2b('0x24')](_0x9e2b('0x64'),_0x4efe21['remoteUri'],_0x454aec['id']);}logger[_0x9e2b('0xb')]('[QUEUE]',_0x9e2b('0x65'));emit(util['format']('user:%s',_0x107652['name']),_0x9e2b('0x66'),{'uri':_0x331470});})[_0x9e2b('0x67')](function(_0xc665bc){logger['error'](_0x9e2b('0x58'),JSON['stringify'](_0xc665bc));});};exports[_0x9e2b('0x68')]=function(_0x735280,_0x36d8ca,_0x2c1cbc,_0x42c909,_0x24f70e,_0x339451,_0x40bd0d){var _0x55a88e,_0x534e80,_0x23a801,_0x42c8ea;_0x339451['remoteUri']=intUtil[_0x9e2b('0x55')](_0x339451[_0x9e2b('0x54')]);_0x339451[_0x9e2b('0x56')]=intUtil[_0x9e2b('0x55')](_0x339451['serverUrl']);def[_0x9e2b('0x69')]=util['format'](_0x9e2b('0x57'),_0x339451[_0x9e2b('0x54')]);if(_0x40bd0d&&_0x40bd0d[_0x9e2b('0x6a')]&&_0x40bd0d[_0x9e2b('0x6a')]!==_0x9e2b('0x6b')){logger[_0x9e2b('0xb')](_0x9e2b('0x6c'),_0x9e2b('0x6d'));_0x36d8ca[_0x9e2b('0x59')]=util['format'](_0x9e2b('0x5a'),_0x339451[_0x9e2b('0x56')],_0x36d8ca[_0x9e2b('0x5b')],md5(_0x36d8ca[_0x9e2b('0x5b')]));}return getConnection(_0x339451)[_0x9e2b('0x2d')](function(_0x21921f){_0x42c8ea=_0x21921f;return getUser(_0x339451,_0x42c909[_0x9e2b('0xd')],_0x42c8ea);})['then'](function(_0x350df4){_0x55a88e=_0x350df4;logger[_0x9e2b('0xb')](_0x9e2b('0x5c'),_0x55a88e['id']);return getEndUser(_0x339451,_0x36d8ca['destcalleridname'],_0x36d8ca[_0x9e2b('0x6e')],_0x42c8ea);})[_0x9e2b('0x2d')](function(_0x27b968){_0x534e80=_0x27b968;logger[_0x9e2b('0xb')](_0x9e2b('0x6f'),_0x534e80['id']);return getTicket(_0x339451,_0x55a88e,_0x534e80,_0x2c1cbc,_0x36d8ca,_0x2c1cbc[_0x9e2b('0x70')],_0x42c8ea,'Outbound');})[_0x9e2b('0x2d')](function(_0x2783f2){_0x23a801=_0x2783f2;logger['info'](_0x9e2b('0x5f'));logger[_0x9e2b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x23a801['id']);return setRelationship(_0x42c8ea,_0x55a88e,_0x23a801,_0x9e2b('0x71'));})[_0x9e2b('0x2d')](function(){return setRelationship(_0x42c8ea,_0x534e80,_0x23a801,_0x9e2b('0x60'));})[_0x9e2b('0x2d')](function(){return getServerInfo(_0x42c8ea);})['then'](function(_0xff04ad){var _0x20fa0e=parseInt(_0xff04ad[_0x9e2b('0x61')][_0x9e2b('0x62')](0x0));var _0x55ac19=util[_0x9e2b('0x24')](_0x9e2b('0x63'),_0x339451[_0x9e2b('0x54')],_0x23a801['id']);if(_0x20fa0e>0x6){_0x55ac19=util[_0x9e2b('0x24')](_0x9e2b('0x64'),_0x339451[_0x9e2b('0x54')],_0x23a801['id']);}logger[_0x9e2b('0xb')]('[OUTBOUND]',_0x9e2b('0x65'));emit(util['format']('user:%s',_0x42c909[_0x9e2b('0xd')]),'trigger:browser:url',{'uri':_0x55ac19});})[_0x9e2b('0x67')](function(_0x7937b7){logger['error'](_0x9e2b('0x6c'),JSON['stringify'](_0x7937b7));});};exports['unmanaged']=function(_0x4bc083,_0x3e8cc2,_0x5309f6,_0x19a5c3,_0x14cd22,_0x319cd8){var _0xc8c60c,_0x15dd98,_0x3d3ef5,_0x1131cf;_0x319cd8['remoteUri']=intUtil['stripTrailingSlash'](_0x319cd8[_0x9e2b('0x54')]);_0x319cd8[_0x9e2b('0x56')]=intUtil[_0x9e2b('0x55')](_0x319cd8['serverUrl']);def[_0x9e2b('0x69')]=util[_0x9e2b('0x24')](_0x9e2b('0x57'),_0x319cd8[_0x9e2b('0x54')]);if(_0x14cd22&&_0x14cd22[_0x9e2b('0x72')]){logger['info']('['+_0x3e8cc2[_0x9e2b('0x73')][_0x9e2b('0x74')]()+']','Recording\x20is\x20enabled!');_0x3e8cc2[_0x9e2b('0x59')]=util[_0x9e2b('0x24')](_0x9e2b('0x5a'),_0x319cd8[_0x9e2b('0x56')],_0x3e8cc2[_0x9e2b('0x5b')],md5(_0x3e8cc2['uniqueid']));}else{_0x3e8cc2[_0x9e2b('0x59')]='';}return getConnection(_0x319cd8)[_0x9e2b('0x2d')](function(_0x5bbe2e){_0x1131cf=_0x5bbe2e;if(!_[_0x9e2b('0x29')](_0x19a5c3)){return getUser(_0x319cd8,_0x19a5c3[_0x9e2b('0xd')],_0x1131cf);}else{return getUser(_0x319cd8,null,_0x1131cf);}})[_0x9e2b('0x2d')](function(_0x7fca32){_0xc8c60c=_0x7fca32;logger[_0x9e2b('0xb')](_0x9e2b('0x5c'),_0xc8c60c['id']);return getEndUser(_0x319cd8,_0x3e8cc2[_0x9e2b('0x5d')],_0x3e8cc2[_0x9e2b('0x75')],_0x1131cf);})['then'](function(_0x1c5963){_0x15dd98=_0x1c5963;logger[_0x9e2b('0xb')](_0x9e2b('0x6f'),_0x15dd98['id']);return getTicket(_0x319cd8,_0xc8c60c,_0x15dd98,_0x5309f6,_0x3e8cc2,_0x5309f6[_0x9e2b('0x70')],_0x1131cf,_0x9e2b('0x5e'));})[_0x9e2b('0x2d')](function(_0x588b1b){_0x3d3ef5=_0x588b1b;logger['info'](_0x9e2b('0x5f'));logger[_0x9e2b('0xb')](_0x9e2b('0x76'),_0x3d3ef5['id']);return setRelationship(_0x1131cf,_0xc8c60c,_0x3d3ef5,'users');})[_0x9e2b('0x2d')](function(){return setRelationship(_0x1131cf,_0x15dd98,_0x3d3ef5,_0x9e2b('0x60'));})[_0x9e2b('0x2d')](function(){return getServerInfo(_0x1131cf);})[_0x9e2b('0x67')](function(_0x5a92aa){logger[_0x9e2b('0x77')]('['+_0x3e8cc2[_0x9e2b('0x73')][_0x9e2b('0x74')]()+']',JSON[_0x9e2b('0x23')](_0x5a92aa));});}; \ No newline at end of file +var _0xc115=['get_entry_list','Employees','format','entry_list','name_value_list','user_name','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','first_name','','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','push','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','replace','duration_hours','duration_minutes','parent_type','direction','length','forEach','idField','variableName','set_entry','JSON','stringify','Basic\x20%s','toString','get_server_info','isNil','info','Getting\x20agent\x20with\x20name'];(function(_0x2fe7f5,_0x3ec1db){var _0x106f34=function(_0xcdebda){while(--_0xcdebda){_0x2fe7f5['push'](_0x2fe7f5['shift']());}};_0x106f34(++_0x3ec1db);}(_0xc115,0xd4));var _0x5c11=function(_0x477824,_0x50597f){_0x477824=_0x477824-0x0;var _0x285e56=_0xc115[_0x477824];return _0x285e56;};'use strict';var _=require(_0x5c11('0x0'));var rp=require(_0x5c11('0x1'));var BPromise=require(_0x5c11('0x2'));var md5=require(_0x5c11('0x3'));var util=require('util');var Redis=require(_0x5c11('0x4'));var intUtil=require(_0x5c11('0x5'));var config=require(_0x5c11('0x6'));var logger=require(_0x5c11('0x7'))(_0x5c11('0x8'));config[_0x5c11('0x9')]=_[_0x5c11('0xa')](config[_0x5c11('0x9')],{'host':_0x5c11('0xb'),'port':0x18eb});var io=require(_0x5c11('0xc'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x2d2f9c,_0x32073a,_0x3e3bb7){io['to'](_0x2d2f9c)[_0x5c11('0xd')](_0x32073a,_0x3e3bb7);}function getTicket(_0x325e37,_0x49edb7,_0x547736,_0x750b75,_0x206f6b,_0x2b9291,_0x30e03c,_0x13e72b){logger['info']('Creating\x20new\x20ticket...');var _0x374c96=new Date();var _0x1ada3e=[{'name':_0x5c11('0xe'),'value':intUtil['getString'](_0x750b75[_0x5c11('0xf')],_0x206f6b,'\x20')},{'name':_0x5c11('0x10'),'value':_0x49edb7['id']},{'name':_0x5c11('0x11'),'value':_0x49edb7['id']},{'name':_0x5c11('0x12'),'value':intUtil[_0x5c11('0x13')](_0x750b75[_0x5c11('0x14')],_0x206f6b,'\x0a')},{'name':_0x5c11('0x15'),'value':_0x374c96['toISOString']()['slice'](0x0,0x13)[_0x5c11('0x16')]('T','\x20')},{'name':_0x5c11('0x17'),'value':'0'},{'name':_0x5c11('0x18'),'value':'15'},{'name':'parent_id','value':_0x547736['id']},{'name':_0x5c11('0x19'),'value':'Contacts'},{'name':'parent_name','value':_0x547736['name']},{'name':_0x5c11('0x1a'),'value':_0x13e72b}];if(_0x2b9291[_0x5c11('0x1b')]){_[_0x5c11('0x1c')](_0x2b9291,function(_0x1815f7){if(_0x206f6b[_0x1815f7['variableName']]){_0x1ada3e['push']({'name':_0x1815f7[_0x5c11('0x1d')],'value':_0x206f6b[_0x1815f7[_0x5c11('0x1e')]]});}});}return request({'form':{'method':_0x5c11('0x1f'),'input_type':'JSON','response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x30e03c['id'],'module_name':'Calls','name_value_list':_0x1ada3e})}});}function getAuth(_0x12e971){return util['format'](_0x5c11('0x22'),new Buffer(_0x12e971['apiKey']+':X')[_0x5c11('0x23')]('base64'));}function getServerInfo(_0x1acdf2){return request({'form':{'method':_0x5c11('0x24'),'input_type':'JSON','response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x1acdf2['id']})}});}function getUser(_0x13cc28,_0x8d97bf,_0x26a2a8){if(!_[_0x5c11('0x25')](_0x8d97bf)){logger[_0x5c11('0x26')](_0x5c11('0x27'),_0x8d97bf);return request({'form':{'method':_0x5c11('0x28'),'input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x26a2a8['id'],'module_name':_0x5c11('0x29'),'query':util[_0x5c11('0x2a')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x8d97bf),'order_by':'','offset':'0','select_fields':['id',_0x5c11('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x419e73){if(_0x419e73['entry_list'][_0x5c11('0x1b')]){var _0x24cb46=_['find'](_0x419e73[_0x5c11('0x2b')],function(_0x122b8f){return _0x122b8f[_0x5c11('0x2c')][_0x5c11('0x2d')]['value']===_0x8d97bf;});if(_0x24cb46){logger[_0x5c11('0x26')](_0x5c11('0x2e'));return BPromise['resolve']({'id':_0x24cb46[_0x5c11('0x2c')]['id'][_0x5c11('0x2f')],'name':_0x24cb46[_0x5c11('0x2c')][_0x5c11('0xe')][_0x5c11('0x2f')]});}}logger['info'](_0x5c11('0x30'));return BPromise[_0x5c11('0x31')]({'id':_0x26a2a8[_0x5c11('0x2c')]['user_id']['value'],'name':_0x26a2a8['name_value_list'][_0x5c11('0x2d')]['value']});});}else{logger[_0x5c11('0x26')](_0x5c11('0x32'));return BPromise[_0x5c11('0x31')]({'id':_0x26a2a8[_0x5c11('0x2c')][_0x5c11('0x33')][_0x5c11('0x2f')],'name':_0x26a2a8['name_value_list'][_0x5c11('0x2d')]['value']});}}function getEndUser(_0x292b48,_0x56e9f6,_0x1de3af,_0x52cb34){logger[_0x5c11('0x26')](_0x5c11('0x34'),_0x1de3af);return request({'form':{'method':_0x5c11('0x28'),'input_type':'JSON','response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x52cb34['id'],'module_name':'Contacts','query':util[_0x5c11('0x2a')](_0x5c11('0x35'),_0x1de3af),'order_by':'','offset':'0','select_fields':['id',_0x5c11('0xe'),_0x5c11('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5c11('0x37')](function(_0x56ae50){if(_0x56ae50[_0x5c11('0x2b')][_0x5c11('0x1b')]){var _0x12adcc=_[_0x5c11('0x38')](_0x56ae50['entry_list'],function(_0x286bc2){return _0x286bc2['name_value_list'][_0x5c11('0x36')][_0x5c11('0x2f')]===_0x1de3af;});if(_0x12adcc){logger[_0x5c11('0x26')](_0x5c11('0x39'));return BPromise[_0x5c11('0x31')]({'id':_0x12adcc[_0x5c11('0x2c')]['id']['value'],'name':_0x12adcc[_0x5c11('0x2c')][_0x5c11('0xe')][_0x5c11('0x2f')],'phone':_0x12adcc[_0x5c11('0x2c')]['phone_home']['value']});}}else{logger['info'](_0x5c11('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'session':_0x52cb34['id'],'module_name':_0x5c11('0x3b'),'name_value_list':[{'name':_0x5c11('0x3c'),'value':_0x56e9f6!==_0x5c11('0x3d')?_0x56e9f6:util[_0x5c11('0x2a')]('Caller\x20-\x20%s',_0x1de3af)},{'name':_0x5c11('0x36'),'value':_0x1de3af}]})}})[_0x5c11('0x37')](function(_0x245b82){logger[_0x5c11('0x26')]('Enduser\x20created.');return BPromise[_0x5c11('0x31')]({'id':_0x245b82['id'],'name':_0x245b82[_0x5c11('0x2b')]['first_name'][_0x5c11('0x2f')],'phone':_0x245b82[_0x5c11('0x2b')]['phone_home'][_0x5c11('0x2f')]});});}});}function request(_0x5b444d){logger[_0x5c11('0x3e')](_0x5c11('0x3f'),JSON[_0x5c11('0x21')](_0x5b444d));return rp(_[_0x5c11('0x40')](def,_0x5b444d));}function getTags(_0x458566,_0x3bd5c3){var _0x149969=[];if(_0x458566&&_0x458566[_0x5c11('0x1b')]>0x0){_0x149969=_[_0x5c11('0x41')](_0x458566,_0x3bd5c3);}return _0x149969;}function getCustomFields(_0x49e6fe,_0x30235d){var _0x357fd9=[];var _0xc41b7f={'custom_fields':[]};if(_0x49e6fe[_0x5c11('0x1b')]>0x0){_['forEach'](_0x49e6fe,function(_0x2ed77a){if(_0x2ed77a[_0x5c11('0x42')]===_0x5c11('0x43')&&_0x2ed77a[_0x5c11('0x44')]&&!_0x2ed77a[_0x5c11('0x45')]){_0xc41b7f[_0x2ed77a[_0x5c11('0x44')][_0x5c11('0x46')]()]=_0x2ed77a[_0x5c11('0x47')][_0x5c11('0x23')]();}else if(_0x2ed77a[_0x5c11('0x42')]==='string'&&_0x2ed77a[_0x5c11('0x1d')]&&_0x2ed77a[_0x5c11('0x45')]){_0xc41b7f[_0x5c11('0x48')]['push']({'id':_0x2ed77a[_0x5c11('0x1d')],'value':_0x2ed77a['content']['toString']()});}else if(_0x2ed77a['type']===_0x5c11('0x49')&&_0x2ed77a[_0x5c11('0x1e')]&&_0x2ed77a[_0x5c11('0x1d')]&&_0x2ed77a[_0x5c11('0x45')]){_0x30235d[_0x2ed77a[_0x5c11('0x1e')]]&&_0xc41b7f[_0x5c11('0x48')][_0x5c11('0x4a')]({'id':_0x2ed77a[_0x5c11('0x1d')],'value':_0x30235d[_0x2ed77a['variableName']][_0x5c11('0x23')]()});}else if(_0x2ed77a[_0x5c11('0x42')]===_0x5c11('0x4b')&&_0x2ed77a[_0x5c11('0x4c')]&&_0x2ed77a['Variable'][_0x5c11('0xe')]&&_0x2ed77a['idField']&&_0x2ed77a['customField']){_0x30235d[_0x2ed77a[_0x5c11('0x4c')][_0x5c11('0xe')][_0x5c11('0x46')]()]&&_0xc41b7f[_0x5c11('0x48')]['push']({'id':_0x2ed77a[_0x5c11('0x1d')],'value':_0x30235d[_0x2ed77a[_0x5c11('0x4c')]['name'][_0x5c11('0x46')]()]['toString']()});}});}return _0xc41b7f;}function getConnection(_0x3f0d5){return request({'method':_0x5c11('0x4d'),'form':{'method':_0x5c11('0x4e'),'input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON[_0x5c11('0x21')]({'user_auth':{'user_name':_0x3f0d5[_0x5c11('0x4f')],'password':_0x3f0d5[_0x5c11('0x50')],'encryption':_0x5c11('0x51')},'application':_0x5c11('0x52')})}})[_0x5c11('0x37')](function(_0x2e46fd){var _0x348862=_0x2e46fd;if(_0x348862['id']){def[_0x5c11('0x53')]=_0x348862['id'];return BPromise['resolve'](_0x348862);}else{throw new Error(util[_0x5c11('0x2a')](_0x5c11('0x54'),_0x3f0d5['id']));}});}function setRelationship(_0x5d7de5,_0x4b7fb9,_0x3ca334,_0x761d4d){return request({'form':{'method':_0x5c11('0x55'),'input_type':_0x5c11('0x20'),'response_type':_0x5c11('0x20'),'rest_data':JSON['stringify']({'session':_0x5d7de5['id'],'module_name':_0x5c11('0x56'),'module_id':_0x3ca334['id'],'link_field_name':_0x761d4d,'related_ids':[_0x4b7fb9['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3b3834,_0x21da0f,_0x59372d,_0x1e74e0,_0x1dd39a,_0x195378){var _0x5273f1,_0x2b031c,_0x1f35a1,_0x19f27e;_0x195378[_0x5c11('0x57')]=intUtil[_0x5c11('0x58')](_0x195378[_0x5c11('0x57')]);_0x195378[_0x5c11('0x59')]=intUtil['stripTrailingSlash'](_0x195378[_0x5c11('0x59')]);def[_0x5c11('0x5a')]=util['format'](_0x5c11('0x5b'),_0x195378['remoteUri']);if(_0x1dd39a&&_0x1dd39a[_0x5c11('0x5c')]){logger[_0x5c11('0x26')]('[QUEUE]',_0x5c11('0x5d'));_0x21da0f[_0x5c11('0x5e')]=util[_0x5c11('0x2a')](_0x5c11('0x5f'),_0x195378[_0x5c11('0x59')],_0x21da0f[_0x5c11('0x60')],md5(_0x21da0f[_0x5c11('0x60')]));}else{_0x21da0f[_0x5c11('0x5e')]='';}return getConnection(_0x195378)[_0x5c11('0x37')](function(_0x253211){_0x19f27e=_0x253211;return getUser(_0x195378,_0x1e74e0[_0x5c11('0xe')],_0x19f27e);})[_0x5c11('0x37')](function(_0x205503){_0x5273f1=_0x205503;logger['info'](_0x5c11('0x61'),_0x5273f1['id']);return getEndUser(_0x195378,_0x21da0f[_0x5c11('0x62')],_0x21da0f[_0x5c11('0x63')],_0x19f27e);})['then'](function(_0x2d661e){_0x2b031c=_0x2d661e;logger[_0x5c11('0x26')](_0x5c11('0x64'),_0x2b031c['id']);return getTicket(_0x195378,_0x5273f1,_0x2b031c,_0x59372d,_0x21da0f,_0x59372d[_0x5c11('0x65')],_0x19f27e,_0x5c11('0x66'));})[_0x5c11('0x37')](function(_0x89ab1d){_0x1f35a1=_0x89ab1d;logger[_0x5c11('0x26')](_0x5c11('0x67'));logger[_0x5c11('0x26')](_0x5c11('0x68'),_0x1f35a1['id']);return setRelationship(_0x19f27e,_0x5273f1,_0x1f35a1,'users');})[_0x5c11('0x37')](function(){return setRelationship(_0x19f27e,_0x2b031c,_0x1f35a1,_0x5c11('0x69'));})[_0x5c11('0x37')](function(){return getServerInfo(_0x19f27e);})[_0x5c11('0x37')](function(_0x733add){var _0x8f66a5=parseInt(_0x733add[_0x5c11('0x6a')][_0x5c11('0x6b')](0x0));var _0x8caaad=util[_0x5c11('0x2a')](_0x5c11('0x6c'),_0x195378[_0x5c11('0x57')],_0x1f35a1['id']);if(_0x8f66a5>0x6){_0x8caaad=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x195378[_0x5c11('0x57')],_0x1f35a1['id']);}logger[_0x5c11('0x26')](_0x5c11('0x6d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5c11('0x6e'),_0x1e74e0[_0x5c11('0xe')]),_0x5c11('0x6f'),{'uri':_0x8caaad});})[_0x5c11('0x70')](function(_0x54e627){logger[_0x5c11('0x71')](_0x5c11('0x6d'),JSON[_0x5c11('0x21')](_0x54e627));});};exports[_0x5c11('0x72')]=function(_0x44c5bb,_0xf5e531,_0x212df0,_0x11edbe,_0x2d3088,_0x530db3,_0x43e0ff){var _0x146e4b,_0x3c04e5,_0x161a8b,_0x300142;_0x530db3[_0x5c11('0x57')]=intUtil[_0x5c11('0x58')](_0x530db3[_0x5c11('0x57')]);_0x530db3[_0x5c11('0x59')]=intUtil[_0x5c11('0x58')](_0x530db3[_0x5c11('0x59')]);def[_0x5c11('0x5a')]=util['format'](_0x5c11('0x5b'),_0x530db3[_0x5c11('0x57')]);if(_0x43e0ff&&_0x43e0ff['recordingFormat']&&_0x43e0ff[_0x5c11('0x73')]!==_0x5c11('0x74')){logger[_0x5c11('0x26')](_0x5c11('0x75'),_0x5c11('0x5d'));_0xf5e531[_0x5c11('0x5e')]=util[_0x5c11('0x2a')](_0x5c11('0x5f'),_0x530db3[_0x5c11('0x59')],_0xf5e531[_0x5c11('0x60')],md5(_0xf5e531[_0x5c11('0x60')]));}return getConnection(_0x530db3)[_0x5c11('0x37')](function(_0x40b1e7){_0x300142=_0x40b1e7;return getUser(_0x530db3,_0x11edbe[_0x5c11('0xe')],_0x300142);})[_0x5c11('0x37')](function(_0x1268df){_0x146e4b=_0x1268df;logger[_0x5c11('0x26')](_0x5c11('0x61'),_0x146e4b['id']);return getEndUser(_0x530db3,_0xf5e531[_0x5c11('0x76')],_0xf5e531[_0x5c11('0x77')],_0x300142);})[_0x5c11('0x37')](function(_0x5b1f08){_0x3c04e5=_0x5b1f08;logger['info'](_0x5c11('0x64'),_0x3c04e5['id']);return getTicket(_0x530db3,_0x146e4b,_0x3c04e5,_0x212df0,_0xf5e531,_0x212df0[_0x5c11('0x65')],_0x300142,_0x5c11('0x78'));})['then'](function(_0x264e9f){_0x161a8b=_0x264e9f;logger[_0x5c11('0x26')](_0x5c11('0x67'));logger[_0x5c11('0x26')](_0x5c11('0x68'),_0x161a8b['id']);return setRelationship(_0x300142,_0x146e4b,_0x161a8b,'users');})[_0x5c11('0x37')](function(){return setRelationship(_0x300142,_0x3c04e5,_0x161a8b,_0x5c11('0x69'));})[_0x5c11('0x37')](function(){return getServerInfo(_0x300142);})[_0x5c11('0x37')](function(_0x4da324){var _0x56192a=parseInt(_0x4da324[_0x5c11('0x6a')][_0x5c11('0x6b')](0x0));var _0xcdcbd=util['format'](_0x5c11('0x6c'),_0x530db3[_0x5c11('0x57')],_0x161a8b['id']);if(_0x56192a>0x6){_0xcdcbd=util['format'](_0x5c11('0x79'),_0x530db3[_0x5c11('0x57')],_0x161a8b['id']);}logger[_0x5c11('0x26')]('[OUTBOUND]',_0x5c11('0x7a'));emit(util['format'](_0x5c11('0x6e'),_0x11edbe[_0x5c11('0xe')]),_0x5c11('0x6f'),{'uri':_0xcdcbd});})['catch'](function(_0x21d4cb){logger[_0x5c11('0x71')](_0x5c11('0x75'),JSON['stringify'](_0x21d4cb));});};exports[_0x5c11('0x7b')]=function(_0x16bc65,_0x1c6fff,_0x29cfe4,_0x243d41,_0x1f3fd1,_0x441561){var _0x3ec9b1,_0x75bfac,_0x2752d8,_0x1ca859;_0x441561['remoteUri']=intUtil[_0x5c11('0x58')](_0x441561[_0x5c11('0x57')]);_0x441561['serverUrl']=intUtil[_0x5c11('0x58')](_0x441561[_0x5c11('0x59')]);def[_0x5c11('0x5a')]=util[_0x5c11('0x2a')](_0x5c11('0x5b'),_0x441561[_0x5c11('0x57')]);if(_0x1f3fd1&&_0x1f3fd1[_0x5c11('0x5c')]){logger['info']('['+_0x1c6fff[_0x5c11('0x7c')][_0x5c11('0x7d')]()+']',_0x5c11('0x5d'));_0x1c6fff[_0x5c11('0x5e')]=util[_0x5c11('0x2a')](_0x5c11('0x5f'),_0x441561['serverUrl'],_0x1c6fff[_0x5c11('0x60')],md5(_0x1c6fff[_0x5c11('0x60')]));}else{_0x1c6fff['recordingURL']='';}return getConnection(_0x441561)[_0x5c11('0x37')](function(_0x53ced2){_0x1ca859=_0x53ced2;if(!_['isNil'](_0x243d41)){return getUser(_0x441561,_0x243d41['name'],_0x1ca859);}else{return getUser(_0x441561,null,_0x1ca859);}})[_0x5c11('0x37')](function(_0x255f22){_0x3ec9b1=_0x255f22;logger[_0x5c11('0x26')](_0x5c11('0x61'),_0x3ec9b1['id']);return getEndUser(_0x441561,_0x1c6fff[_0x5c11('0x62')],_0x1c6fff[_0x5c11('0x63')],_0x1ca859);})['then'](function(_0x3fe0b3){_0x75bfac=_0x3fe0b3;logger[_0x5c11('0x26')](_0x5c11('0x64'),_0x75bfac['id']);return getTicket(_0x441561,_0x3ec9b1,_0x75bfac,_0x29cfe4,_0x1c6fff,_0x29cfe4[_0x5c11('0x65')],_0x1ca859,_0x5c11('0x66'));})[_0x5c11('0x37')](function(_0x20269e){_0x2752d8=_0x20269e;logger[_0x5c11('0x26')](_0x5c11('0x67'));logger[_0x5c11('0x26')](_0x5c11('0x68'),_0x2752d8['id']);return setRelationship(_0x1ca859,_0x3ec9b1,_0x2752d8,'users');})[_0x5c11('0x37')](function(){return setRelationship(_0x1ca859,_0x75bfac,_0x2752d8,_0x5c11('0x69'));})[_0x5c11('0x37')](function(){return getServerInfo(_0x1ca859);})['catch'](function(_0x56f684){logger[_0x5c11('0x71')]('['+_0x1c6fff[_0x5c11('0x7c')][_0x5c11('0x7d')]()+']',JSON[_0x5c11('0x21')](_0x56f684));});}; \ 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 321012d..03739d6 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 _0xd6e6=['Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','keyContent','customVariable','key','join','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString'];(function(_0xab4be,_0x4ad3b6){var _0x5552d6=function(_0x29f8b7){while(--_0x29f8b7){_0xab4be['push'](_0xab4be['shift']());}};_0x5552d6(++_0x4ad3b6);}(_0xd6e6,0x113));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d6e('0x0'));var util=require(_0x6d6e('0x1'));exports[_0x6d6e('0x2')]=function(_0x395e2b,_0x534d72,_0x1dbbfb){var _0x4dda98=[];if(_0x395e2b[_0x6d6e('0x3')]>0x0){var _0x4cbb7d=_[_0x6d6e('0x4')](_0x395e2b,['id']);for(var _0xad5f10=0x0;_0xad5f10<_0x4cbb7d[_0x6d6e('0x3')];_0xad5f10++){var _0x489fcb=_0x4cbb7d[_0xad5f10];if(_0x489fcb[_0x6d6e('0x5')]===_0x6d6e('0x6')){_0x4dda98[_0x6d6e('0x7')](_0x489fcb['content']);}else if(_0x489fcb[_0x6d6e('0x5')]===_0x6d6e('0x8')&&_0x489fcb[_0x6d6e('0x9')]){_0x534d72[_0x489fcb['variableName']]&&_0x4dda98[_0x6d6e('0x7')](_0x534d72[_0x489fcb['variableName']][_0x6d6e('0xa')]());}else if(_0x489fcb[_0x6d6e('0x5')]==='customVariable'&&_0x489fcb[_0x6d6e('0xb')]&&_0x489fcb['Variable']['name']){_0x534d72[_0x489fcb[_0x6d6e('0xb')][_0x6d6e('0xc')][_0x6d6e('0xd')]()]&&_0x4dda98['push'](_0x534d72[_0x489fcb[_0x6d6e('0xb')][_0x6d6e('0xc')]['toLowerCase']()][_0x6d6e('0xa')]());}else if(_0x489fcb[_0x6d6e('0x5')]===_0x6d6e('0xe')){if(_0x489fcb[_0x6d6e('0xf')]===_0x6d6e('0x6')&&_0x489fcb['key']){_0x4dda98[_0x6d6e('0x7')](util[_0x6d6e('0x10')](_0x6d6e('0x11'),_0x489fcb['key'],_0x489fcb[_0x6d6e('0x12')]));}else if(_0x489fcb[_0x6d6e('0xf')]===_0x6d6e('0x8')&&_0x489fcb[_0x6d6e('0x9')]&&_0x489fcb['key']){_0x534d72[_0x489fcb['variableName']]&&_0x4dda98['push'](util[_0x6d6e('0x10')]('%s:\x20%s',_0x489fcb['key'],_0x534d72[_0x489fcb['variableName']]));}else if(_0x489fcb[_0x6d6e('0xf')]===_0x6d6e('0x13')&&_0x489fcb[_0x6d6e('0xb')]&&_0x489fcb[_0x6d6e('0xb')][_0x6d6e('0xc')]&&_0x489fcb[_0x6d6e('0x14')]){_0x534d72[_0x489fcb[_0x6d6e('0xb')][_0x6d6e('0xc')][_0x6d6e('0xd')]()]&&_0x4dda98[_0x6d6e('0x7')](util[_0x6d6e('0x10')]('%s:\x20%s',_0x489fcb['key'],_0x534d72[_0x489fcb['Variable'][_0x6d6e('0xc')]['toLowerCase']()]));}}}}return _0x4dda98[_0x6d6e('0x15')](_0x1dbbfb);};exports['stripTrailingSlash']=function(_0x591efd){var _0x4c97da=_0x591efd['slice'](-0x1);if(_0x4c97da==='/'){_0x591efd=_0x591efd[_0x6d6e('0x16')](0x0,_0x591efd[_0x6d6e('0x17')](_0x4c97da));}return _0x591efd;};exports[_0x6d6e('0x18')]=function(_0x4542dc){if(!_[_0x6d6e('0x19')](_0x4542dc)&&_0x4542dc!==''){var _0x8b12ca=/^(([^<>()\[\]\\.,;:\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 _0x8b12ca['test'](String(_0x4542dc)[_0x6d6e('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xc030=['string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type'];(function(_0x41cf15,_0x3fe936){var _0x12e427=function(_0x18534c){while(--_0x18534c){_0x41cf15['push'](_0x41cf15['shift']());}};_0x12e427(++_0x3fe936);}(_0xc030,0x180));var _0x0c03=function(_0x411064,_0x5ce362){_0x411064=_0x411064-0x0;var _0x26cc42=_0xc030[_0x411064];return _0x26cc42;};'use strict';var _=require(_0x0c03('0x0'));var util=require(_0x0c03('0x1'));exports[_0x0c03('0x2')]=function(_0x475818,_0x3a1afe,_0x4afa8b){var _0x3f874b=[];if(_0x475818[_0x0c03('0x3')]>0x0){var _0x3e8c42=_[_0x0c03('0x4')](_0x475818,['id']);for(var _0x4a975e=0x0;_0x4a975e<_0x3e8c42[_0x0c03('0x3')];_0x4a975e++){var _0x2a4f9f=_0x3e8c42[_0x4a975e];if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0x6')){_0x3f874b[_0x0c03('0x7')](_0x2a4f9f[_0x0c03('0x8')]);}else if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0x9')&&_0x2a4f9f[_0x0c03('0xa')]){_0x3a1afe[_0x2a4f9f['variableName']]&&_0x3f874b[_0x0c03('0x7')](_0x3a1afe[_0x2a4f9f[_0x0c03('0xa')]][_0x0c03('0xb')]());}else if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0xc')&&_0x2a4f9f[_0x0c03('0xd')]&&_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')]){_0x3a1afe[_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')][_0x0c03('0xf')]()]&&_0x3f874b[_0x0c03('0x7')](_0x3a1afe[_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')][_0x0c03('0xf')]()][_0x0c03('0xb')]());}else if(_0x2a4f9f[_0x0c03('0x5')]===_0x0c03('0x10')){if(_0x2a4f9f[_0x0c03('0x11')]===_0x0c03('0x6')&&_0x2a4f9f[_0x0c03('0x12')]){_0x3f874b[_0x0c03('0x7')](util[_0x0c03('0x13')]('%s:\x20%s',_0x2a4f9f[_0x0c03('0x12')],_0x2a4f9f[_0x0c03('0x14')]));}else if(_0x2a4f9f[_0x0c03('0x11')]==='variable'&&_0x2a4f9f[_0x0c03('0xa')]&&_0x2a4f9f[_0x0c03('0x12')]){_0x3a1afe[_0x2a4f9f['variableName']]&&_0x3f874b[_0x0c03('0x7')](util['format'](_0x0c03('0x15'),_0x2a4f9f[_0x0c03('0x12')],_0x3a1afe[_0x2a4f9f[_0x0c03('0xa')]]));}else if(_0x2a4f9f[_0x0c03('0x11')]===_0x0c03('0xc')&&_0x2a4f9f[_0x0c03('0xd')]&&_0x2a4f9f[_0x0c03('0xd')]['name']&&_0x2a4f9f[_0x0c03('0x12')]){_0x3a1afe[_0x2a4f9f['Variable'][_0x0c03('0xe')]['toLowerCase']()]&&_0x3f874b[_0x0c03('0x7')](util[_0x0c03('0x13')](_0x0c03('0x15'),_0x2a4f9f[_0x0c03('0x12')],_0x3a1afe[_0x2a4f9f[_0x0c03('0xd')][_0x0c03('0xe')][_0x0c03('0xf')]()]));}}}}return _0x3f874b[_0x0c03('0x16')](_0x4afa8b);};exports[_0x0c03('0x17')]=function(_0x13ae45){var _0x166343=_0x13ae45[_0x0c03('0x18')](-0x1);if(_0x166343==='/'){_0x13ae45=_0x13ae45[_0x0c03('0x19')](0x0,_0x13ae45[_0x0c03('0x1a')](_0x166343));}return _0x13ae45;};exports[_0x0c03('0x1b')]=function(_0x2767f0){if(!_[_0x0c03('0x1c')](_0x2767f0)&&_0x2767f0!==''){var _0x410441=/^(([^<>()\[\]\\.,;:\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 _0x410441[_0x0c03('0x1d')](String(_0x2767f0)[_0x0c03('0xf')]());}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 586d6ab..c2bbc5a 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x181a59,_0x48ad57){var _0x4d374b=function(_0x566da0){while(--_0x566da0){_0x181a59['push'](_0x181a59['shift']());}};_0x4d374b(++_0x48ad57);}(_0x34e8,0x12c));var _0x834e=function(_0x362f22,_0x1424f1){_0x362f22=_0x362f22-0x0;var _0x10af1b=_0x34e8[_0x362f22];return _0x10af1b;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _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(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 e208461..312e65d 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 _0x203b=['nameField','toLowerCase','content','toString','string','idField','customField','push','variable','variableName','custom_fields','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','./util','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Fields','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','base64','debug','[HTTP]','GET','map','forEach','includes','picklist','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x203b,0xa5));var _0xb203=function(_0x3fbd72,_0x4efc9a){_0x3fbd72=_0x3fbd72-0x0;var _0x2fcdc5=_0x203b[_0x3fbd72];return _0x2fcdc5;};'use strict';var _=require(_0xb203('0x0'));var rp=require(_0xb203('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xb203('0x2'));var config=require('../../../../config/environment');var logger=require(_0xb203('0x3'))(_0xb203('0x4'));config[_0xb203('0x5')]=_[_0xb203('0x6')](config['redis'],{'host':_0xb203('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4bf360,_0x5d7864,_0x3695e1){io['to'](_0x4bf360)[_0xb203('0x8')](_0x5d7864,_0x3695e1);}var headers={'Content-Type':'application/json','Accept':_0xb203('0x9')};function getTicket(_0xa676f7,_0x52c4de,_0x4b738a,_0x5229f3,_0x23e554){logger[_0xb203('0xa')](_0xb203('0xb'));return request({'uri':util[_0xb203('0xc')](_0xb203('0xd'),_0xa676f7[_0xb203('0xe')]),'method':_0xb203('0xf'),'body':{'ticket':_[_0xb203('0x10')]({'requester_id':_0x4b738a['id'],'submitter_id':_0x52c4de?_0x52c4de['id']:undefined,'assignee_id':_0x52c4de?_0x52c4de['id']:undefined,'tags':getTags(_0x5229f3[_0xb203('0x11')],_0xb203('0x12')),'subject':intUtil[_0xb203('0x13')](_0x5229f3[_0xb203('0x14')],_0x23e554,'\x20'),'description':intUtil['getString'](_0x5229f3['Descriptions'],_0x23e554,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5229f3['Descriptions'],_0x23e554,'\x0a')}},getCustomFields(_0x5229f3[_0xb203('0x15')],_0x23e554))}})['then'](function(_0x25ef57){logger['info'](_0xb203('0x16'));return _0x25ef57[_0xb203('0x17')];});}function getUser(_0x5ad9dd,_0x234d9c){if(intUtil[_0xb203('0x18')](_0x234d9c)){logger['info']('Getting\x20agent\x20with\x20email',_0x234d9c);return request({'uri':util['format'](_0xb203('0x19'),_0x5ad9dd[_0xb203('0xe')]),'qs':{'query':util[_0xb203('0xc')](_0xb203('0x1a'),_0x234d9c)}})[_0xb203('0x1b')](function(_0x99a7ac){if(_0x99a7ac[_0xb203('0x1c')]){logger[_0xb203('0xa')]('Agent\x20found!');return _[_0xb203('0x1d')](_0x99a7ac['results'],{'email':_0x234d9c,'role':'agent'});}else{logger['info'](_0xb203('0x1e'));return request({'uri':util['format'](_0xb203('0x1f'),_0x5ad9dd[_0xb203('0xe')])})[_0xb203('0x1b')](function(_0x575795){logger['info'](_0xb203('0x20'));return _0x575795[_0xb203('0x21')];});}});}else{logger[_0xb203('0xa')](_0xb203('0x1e'));return request({'uri':util[_0xb203('0xc')](_0xb203('0x1f'),_0x5ad9dd[_0xb203('0xe')])})['then'](function(_0x102acb){logger[_0xb203('0xa')](_0xb203('0x20'));return _0x102acb[_0xb203('0x21')];});}}function getEndUser(_0x5a6f60,_0x274827,_0x2df22f){logger[_0xb203('0xa')](_0xb203('0x22'),_0x2df22f);return request({'uri':util[_0xb203('0xc')]('%s/search.json',_0x5a6f60[_0xb203('0xe')]),'qs':{'query':util[_0xb203('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x2df22f)}})[_0xb203('0x1b')](function(_0x3b4919){var _0x5aac1f;if(_0x3b4919[_0xb203('0x23')][_0xb203('0x24')]){_0x3b4919[_0xb203('0x23')]=_[_0xb203('0x25')](_0x3b4919['results'],{'suspended':![],'role':_0xb203('0x26')});if(_0x3b4919[_0xb203('0x23')]['length']){_0x5aac1f=_['first'](_0x3b4919[_0xb203('0x23')]);}}if(_0x5aac1f){logger['info'](_0xb203('0x27'));return _0x5aac1f;}else{logger[_0xb203('0xa')](_0xb203('0x28'));return request({'uri':util[_0xb203('0xc')](_0xb203('0x29'),_0x5a6f60[_0xb203('0xe')]),'method':'POST','body':{'user':{'role':_0xb203('0x26'),'name':util['format'](_0xb203('0x2a'),_0x274827||_0x2df22f),'phone':_0x2df22f}}})[_0xb203('0x1b')](function(_0x2b6767){logger[_0xb203('0xa')]('Enduser\x20created.');return _0x2b6767[_0xb203('0x21')];});}});}function getAuth(_0x24c714){var _0x47cf9e;if(_0x24c714[_0xb203('0x2b')]===_0xb203('0x2c')){_0x47cf9e=util[_0xb203('0xc')](_0xb203('0x2d'),_0x24c714[_0xb203('0x2e')],_0x24c714[_0xb203('0x2c')]);}else if(_0x24c714[_0xb203('0x2b')]==='token'){_0x47cf9e=util[_0xb203('0xc')](_0xb203('0x2f'),_0x24c714[_0xb203('0x2e')],_0x24c714[_0xb203('0x30')]);}return util[_0xb203('0xc')](_0xb203('0x31'),new Buffer(_0x47cf9e)['toString'](_0xb203('0x32')));}function request(_0x61449e){logger[_0xb203('0x33')](_0xb203('0x34'),JSON['stringify'](_0x61449e));return rp(_[_0xb203('0x6')](_0x61449e,{'method':_0xb203('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x4247fb,_0x2c2efe){var _0x250c9d=[];if(_0x4247fb&&_0x4247fb[_0xb203('0x24')]>0x0){_0x250c9d=_[_0xb203('0x36')](_0x4247fb,_0x2c2efe);}return _0x250c9d;}function getCustomFields(_0x587dab,_0x4bd088){var _0x42a654=[];var _0x113444={'custom_fields':[]};if(_0x587dab[_0xb203('0x24')]>0x0){_[_0xb203('0x37')](_0x587dab,function(_0x2518df){if(_[_0xb203('0x38')](['string',_0xb203('0x39')],_0x2518df[_0xb203('0x3a')])&&_0x2518df[_0xb203('0x3b')]&&!_0x2518df['customField']){_0x113444[_0x2518df[_0xb203('0x3b')][_0xb203('0x3c')]()]=_0x2518df[_0xb203('0x3d')][_0xb203('0x3e')]();}else if(_[_0xb203('0x38')]([_0xb203('0x3f'),_0xb203('0x39')],_0x2518df['type'])&&_0x2518df[_0xb203('0x40')]&&_0x2518df[_0xb203('0x41')]){_0x113444['custom_fields'][_0xb203('0x42')]({'id':_0x2518df[_0xb203('0x40')],'value':_0x2518df[_0xb203('0x3d')][_0xb203('0x3e')]()});}else if(_0x2518df[_0xb203('0x3a')]===_0xb203('0x43')&&_0x2518df[_0xb203('0x44')]&&_0x2518df[_0xb203('0x40')]&&_0x2518df[_0xb203('0x41')]){_0x4bd088[_0x2518df['variableName']]&&_0x113444[_0xb203('0x45')][_0xb203('0x42')]({'id':_0x2518df[_0xb203('0x40')],'value':_0x4bd088[_0x2518df['variableName']][_0xb203('0x3e')]()});}else if(_0x2518df[_0xb203('0x3a')]==='customVariable'&&_0x2518df[_0xb203('0x46')]&&_0x2518df['Variable'][_0xb203('0x12')]&&_0x2518df[_0xb203('0x40')]&&_0x2518df[_0xb203('0x41')]){_0x4bd088[_0x2518df[_0xb203('0x46')]['name']['toLowerCase']()]&&_0x113444[_0xb203('0x45')][_0xb203('0x42')]({'id':_0x2518df[_0xb203('0x40')],'value':_0x4bd088[_0x2518df['Variable']['name'][_0xb203('0x3c')]()][_0xb203('0x3e')]()});}});}return _0x113444;}exports[_0xb203('0x47')]=function(_0x380167,_0x25c932,_0x502086,_0x5e5ed4,_0x460887,_0x395fe2){var _0x4cd127,_0x1b225b;_0x395fe2[_0xb203('0xe')]=intUtil[_0xb203('0x48')](_0x395fe2[_0xb203('0xe')]);_0x395fe2['serverUrl']=intUtil[_0xb203('0x48')](_0x395fe2['serverUrl']);if(_0x460887&&_0x460887[_0xb203('0x49')]){logger[_0xb203('0xa')](_0xb203('0x4a'),_0xb203('0x4b'));_0x25c932[_0xb203('0x4c')]=util[_0xb203('0xc')](_0xb203('0x4d'),_0x395fe2[_0xb203('0x4e')],_0x25c932[_0xb203('0x4f')],md5(_0x25c932[_0xb203('0x4f')]));}else{_0x25c932[_0xb203('0x4c')]='';}headers[_0xb203('0x50')]=getAuth(_0x395fe2);return getUser(_0x395fe2,_0x5e5ed4[_0xb203('0x51')])[_0xb203('0x1b')](function(_0x4c4dba){_0x4cd127=_0x4c4dba;logger[_0xb203('0xa')](_0xb203('0x52'),_0x4cd127['id']);return getEndUser(_0x395fe2,_0x25c932[_0xb203('0x53')],_0x25c932[_0xb203('0x54')]);})[_0xb203('0x1b')](function(_0x3f1fbb){_0x1b225b=_0x3f1fbb;logger[_0xb203('0xa')](_0xb203('0x55'),_0x1b225b['id']);return getTicket(_0x395fe2,_0x4cd127,_0x1b225b,_0x502086,_0x25c932);})['then'](function(_0x1b4908){if(_0x1b4908){logger[_0xb203('0xa')](_0xb203('0x56'),_0x1b4908['id']);switch(_0x395fe2[_0xb203('0x3a')]){case _0xb203('0x57'):logger[_0xb203('0xa')]('[QUEUE]',_0xb203('0x58'));return request({'uri':util['format'](_0xb203('0x59'),_0x395fe2['remoteUri'],_0x4cd127['id'],_0x1b4908['id']),'method':'POST'});case _0xb203('0x5a'):logger[_0xb203('0xa')]('[QUEUE]',_0xb203('0x5b'));emit(util[_0xb203('0xc')]('user:%s',_0x5e5ed4[_0xb203('0x12')]),'trigger:browser:url',{'uri':util[_0xb203('0xc')](_0xb203('0x5c'),_0x395fe2['remoteUri'][_0xb203('0x5d')]('/api/v2',''),_0x1b4908['id'])});break;default:logger[_0xb203('0x5e')]('[QUEUE]',_0xb203('0x5f'));}}})[_0xb203('0x60')](function(_0x140c01){logger[_0xb203('0x5e')](_0xb203('0x61'),util[_0xb203('0x62')](_0x140c01,{'showHidden':!![],'depth':null}));});};exports[_0xb203('0x63')]=function(_0x50509f,_0x8abee4,_0x25868c,_0x3c012e,_0x449144,_0x56f468,_0x582eed){var _0x4ea14d,_0x464c50;_0x56f468['remoteUri']=intUtil[_0xb203('0x48')](_0x56f468[_0xb203('0xe')]);_0x56f468[_0xb203('0x4e')]=intUtil[_0xb203('0x48')](_0x56f468[_0xb203('0x4e')]);if(_0x582eed&&_0x582eed[_0xb203('0x64')]&&_0x582eed['recordingFormat']!==_0xb203('0x65')){logger[_0xb203('0xa')]('[OUTBOUND]',_0xb203('0x4b'));_0x8abee4[_0xb203('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56f468[_0xb203('0x4e')],_0x8abee4[_0xb203('0x4f')],md5(_0x8abee4[_0xb203('0x4f')]));}headers['Authorization']=getAuth(_0x56f468);return getUser(_0x56f468,_0x3c012e[_0xb203('0x51')])[_0xb203('0x1b')](function(_0x355b74){_0x4ea14d=_0x355b74;logger['info'](_0xb203('0x52'),_0x4ea14d['id']);return getEndUser(_0x56f468,_0x8abee4[_0xb203('0x66')],_0x8abee4[_0xb203('0x67')]);})['then'](function(_0x53a4ff){_0x464c50=_0x53a4ff;logger['info'](_0xb203('0x55'),_0x464c50['id']);return getTicket(_0x56f468,_0x4ea14d,_0x464c50,_0x25868c,_0x8abee4);})['then'](function(_0x2b0af7){if(_0x2b0af7){logger[_0xb203('0xa')](_0xb203('0x56'),_0x2b0af7['id']);switch(_0x56f468[_0xb203('0x3a')]){case'integrationTab':logger[_0xb203('0xa')](_0xb203('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb203('0xc')](_0xb203('0x59'),_0x56f468[_0xb203('0xe')],_0x4ea14d['id'],_0x2b0af7['id']),'method':_0xb203('0xf')});case _0xb203('0x5a'):logger['info'](_0xb203('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb203('0xc')](_0xb203('0x69'),_0x3c012e[_0xb203('0x12')]),_0xb203('0x6a'),{'uri':util['format']('%s/agent/tickets/%s',_0x56f468['remoteUri'][_0xb203('0x5d')]('/api/v2',''),_0x2b0af7['id'])});break;default:logger[_0xb203('0x5e')](_0xb203('0x68'),_0xb203('0x5f'));}}})[_0xb203('0x60')](function(_0x5b31e0){logger['error'](_0xb203('0x6b'),util[_0xb203('0x62')](_0x5b31e0,{'showHidden':!![],'depth':null}));});};exports[_0xb203('0x6c')]=function(_0x3a2add,_0x42f4f0,_0x37e07f,_0xc2403d,_0x5a3300,_0x2bf06b){var _0xe0dd97,_0x2d228f;_0x2bf06b[_0xb203('0xe')]=intUtil[_0xb203('0x48')](_0x2bf06b[_0xb203('0xe')]);_0x2bf06b[_0xb203('0x4e')]=intUtil[_0xb203('0x48')](_0x2bf06b[_0xb203('0x4e')]);if(_0x5a3300&&_0x5a3300[_0xb203('0x49')]){logger['info']('['+_0x42f4f0['lastevent'][_0xb203('0x6d')]()+']',_0xb203('0x4b'));_0x42f4f0[_0xb203('0x4c')]=util[_0xb203('0xc')](_0xb203('0x4d'),_0x2bf06b[_0xb203('0x4e')],_0x42f4f0[_0xb203('0x4f')],md5(_0x42f4f0[_0xb203('0x4f')]));}else{_0x42f4f0[_0xb203('0x4c')]='';}headers[_0xb203('0x50')]=getAuth(_0x2bf06b);return getUser(_0x2bf06b)[_0xb203('0x1b')](function(_0x16fb9b){_0xe0dd97=_0x16fb9b;logger[_0xb203('0xa')](_0xb203('0x52'),_0xe0dd97['id']);return getEndUser(_0x2bf06b,_0x42f4f0[_0xb203('0x53')],_0x42f4f0[_0xb203('0x54')]);})[_0xb203('0x1b')](function(_0x24ac03){_0x2d228f=_0x24ac03;logger[_0xb203('0xa')](_0xb203('0x55'),_0x2d228f['id']);return getTicket(_0x2bf06b,_0xe0dd97,_0x2d228f,_0x37e07f,_0x42f4f0);})[_0xb203('0x1b')](function(_0x4894e6){if(_0x4894e6){logger[_0xb203('0xa')](_0xb203('0x56'),_0x4894e6['id']);}})['catch'](function(_0x286dc6){logger[_0xb203('0x5e')]('['+_0x42f4f0[_0xb203('0x6e')][_0xb203('0x6d')]()+']'+_0xb203('0x6f'),util['inspect'](_0x286dc6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4b0a=['picklist','nameField','customField','toLowerCase','content','type','idField','variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','The\x20User\x20ID\x20is:','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','../../../../config/logger','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','results','length','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','includes','string'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0x4b0a,0xa1));var _0xa4b0=function(_0x543544,_0x282b66){_0x543544=_0x543544-0x0;var _0x19f200=_0x4b0a[_0x543544];return _0x19f200;};'use strict';var _=require(_0xa4b0('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xa4b0('0x1'));var Redis=require(_0xa4b0('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa4b0('0x3'))('zendesk');config['redis']=_['defaults'](config[_0xa4b0('0x4')],{'host':_0xa4b0('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4b0('0x4')]));function emit(_0x7ded08,_0x3c67ee,_0x119d27){io['to'](_0x7ded08)[_0xa4b0('0x6')](_0x3c67ee,_0x119d27);}var headers={'Content-Type':_0xa4b0('0x7'),'Accept':_0xa4b0('0x7')};function getTicket(_0x23691d,_0x43a794,_0x3b99bd,_0x15a94d,_0x4d3827){logger[_0xa4b0('0x8')](_0xa4b0('0x9'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0xb'),_0x23691d[_0xa4b0('0xc')]),'method':_0xa4b0('0xd'),'body':{'ticket':_[_0xa4b0('0xe')]({'requester_id':_0x3b99bd['id'],'submitter_id':_0x43a794?_0x43a794['id']:undefined,'assignee_id':_0x43a794?_0x43a794['id']:undefined,'tags':getTags(_0x15a94d['Tags'],_0xa4b0('0xf')),'subject':intUtil['getString'](_0x15a94d['Subjects'],_0x4d3827,'\x20'),'description':intUtil['getString'](_0x15a94d[_0xa4b0('0x10')],_0x4d3827,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x15a94d[_0xa4b0('0x10')],_0x4d3827,'\x0a')}},getCustomFields(_0x15a94d[_0xa4b0('0x11')],_0x4d3827))}})[_0xa4b0('0x12')](function(_0x69c484){logger[_0xa4b0('0x8')]('Ticket\x20created!');return _0x69c484[_0xa4b0('0x13')];});}function getUser(_0x50cfd5,_0x644b74){if(intUtil['validateEmail'](_0x644b74)){logger[_0xa4b0('0x8')](_0xa4b0('0x14'),_0x644b74);return request({'uri':util['format'](_0xa4b0('0x15'),_0x50cfd5[_0xa4b0('0xc')]),'qs':{'query':util[_0xa4b0('0xa')](_0xa4b0('0x16'),_0x644b74)}})['then'](function(_0x283e56){if(_0x283e56[_0xa4b0('0x17')]){logger[_0xa4b0('0x8')](_0xa4b0('0x18'));return _['find'](_0x283e56['results'],{'email':_0x644b74,'role':'agent'});}else{logger[_0xa4b0('0x8')](_0xa4b0('0x19'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x1a'),_0x50cfd5[_0xa4b0('0xc')])})[_0xa4b0('0x12')](function(_0x3bad9f){logger[_0xa4b0('0x8')](_0xa4b0('0x1b'));return _0x3bad9f['user'];});}});}else{logger[_0xa4b0('0x8')](_0xa4b0('0x19'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x1a'),_0x50cfd5[_0xa4b0('0xc')])})[_0xa4b0('0x12')](function(_0x4fb8de){logger[_0xa4b0('0x8')]('Admin\x20account\x20selected.');return _0x4fb8de['user'];});}}function getEndUser(_0x161e8a,_0x45ec0f,_0x1f5975){logger[_0xa4b0('0x8')]('Searching\x20enduser\x20with\x20phone',_0x1f5975);return request({'uri':util['format'](_0xa4b0('0x15'),_0x161e8a[_0xa4b0('0xc')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1f5975)}})[_0xa4b0('0x12')](function(_0x44d80f){var _0x46e3ae;if(_0x44d80f[_0xa4b0('0x1c')][_0xa4b0('0x1d')]){_0x44d80f[_0xa4b0('0x1c')]=_['filter'](_0x44d80f[_0xa4b0('0x1c')],{'suspended':![],'role':_0xa4b0('0x1e')});if(_0x44d80f['results'][_0xa4b0('0x1d')]){_0x46e3ae=_['first'](_0x44d80f[_0xa4b0('0x1c')]);}}if(_0x46e3ae){logger[_0xa4b0('0x8')](_0xa4b0('0x1f'));return _0x46e3ae;}else{logger['info'](_0xa4b0('0x20'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x21'),_0x161e8a[_0xa4b0('0xc')]),'method':_0xa4b0('0xd'),'body':{'user':{'role':_0xa4b0('0x1e'),'name':util[_0xa4b0('0xa')](_0xa4b0('0x22'),_0x45ec0f||_0x1f5975),'phone':_0x1f5975}}})[_0xa4b0('0x12')](function(_0x2671b0){logger['info'](_0xa4b0('0x23'));return _0x2671b0[_0xa4b0('0x24')];});}});}function getAuth(_0x38f73d){var _0x51ebbf;if(_0x38f73d[_0xa4b0('0x25')]===_0xa4b0('0x26')){_0x51ebbf=util[_0xa4b0('0xa')](_0xa4b0('0x27'),_0x38f73d[_0xa4b0('0x28')],_0x38f73d[_0xa4b0('0x26')]);}else if(_0x38f73d[_0xa4b0('0x25')]===_0xa4b0('0x29')){_0x51ebbf=util[_0xa4b0('0xa')](_0xa4b0('0x2a'),_0x38f73d['username'],_0x38f73d[_0xa4b0('0x29')]);}return util[_0xa4b0('0xa')]('Basic\x20%s',new Buffer(_0x51ebbf)[_0xa4b0('0x2b')](_0xa4b0('0x2c')));}function request(_0x5edd1d){logger[_0xa4b0('0x2d')](_0xa4b0('0x2e'),JSON[_0xa4b0('0x2f')](_0x5edd1d));return rp(_[_0xa4b0('0x30')](_0x5edd1d,{'method':_0xa4b0('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x2db6cd,_0x2e0e89){var _0x34f778=[];if(_0x2db6cd&&_0x2db6cd[_0xa4b0('0x1d')]>0x0){_0x34f778=_[_0xa4b0('0x32')](_0x2db6cd,_0x2e0e89);}return _0x34f778;}function getCustomFields(_0x4a0660,_0x59be17){var _0x4a3ad2=[];var _0x6e8250={'custom_fields':[]};if(_0x4a0660[_0xa4b0('0x1d')]>0x0){_['forEach'](_0x4a0660,function(_0x351624){if(_[_0xa4b0('0x33')]([_0xa4b0('0x34'),_0xa4b0('0x35')],_0x351624['type'])&&_0x351624[_0xa4b0('0x36')]&&!_0x351624[_0xa4b0('0x37')]){_0x6e8250[_0x351624[_0xa4b0('0x36')][_0xa4b0('0x38')]()]=_0x351624[_0xa4b0('0x39')][_0xa4b0('0x2b')]();}else if(_[_0xa4b0('0x33')]([_0xa4b0('0x34'),'picklist'],_0x351624[_0xa4b0('0x3a')])&&_0x351624[_0xa4b0('0x3b')]&&_0x351624[_0xa4b0('0x37')]){_0x6e8250['custom_fields']['push']({'id':_0x351624[_0xa4b0('0x3b')],'value':_0x351624[_0xa4b0('0x39')][_0xa4b0('0x2b')]()});}else if(_0x351624[_0xa4b0('0x3a')]===_0xa4b0('0x3c')&&_0x351624[_0xa4b0('0x3d')]&&_0x351624[_0xa4b0('0x3b')]&&_0x351624['customField']){_0x59be17[_0x351624[_0xa4b0('0x3d')]]&&_0x6e8250[_0xa4b0('0x3e')][_0xa4b0('0x3f')]({'id':_0x351624[_0xa4b0('0x3b')],'value':_0x59be17[_0x351624[_0xa4b0('0x3d')]][_0xa4b0('0x2b')]()});}else if(_0x351624['type']===_0xa4b0('0x40')&&_0x351624[_0xa4b0('0x41')]&&_0x351624[_0xa4b0('0x41')][_0xa4b0('0xf')]&&_0x351624[_0xa4b0('0x3b')]&&_0x351624[_0xa4b0('0x37')]){_0x59be17[_0x351624['Variable'][_0xa4b0('0xf')][_0xa4b0('0x38')]()]&&_0x6e8250[_0xa4b0('0x3e')][_0xa4b0('0x3f')]({'id':_0x351624['idField'],'value':_0x59be17[_0x351624[_0xa4b0('0x41')][_0xa4b0('0xf')][_0xa4b0('0x38')]()]['toString']()});}});}return _0x6e8250;}exports[_0xa4b0('0x42')]=function(_0x186b62,_0x271e48,_0x170c54,_0x574333,_0x589f8e,_0x364a57){var _0x4f12e8,_0x11fa1e;_0x364a57[_0xa4b0('0xc')]=intUtil[_0xa4b0('0x43')](_0x364a57[_0xa4b0('0xc')]);_0x364a57[_0xa4b0('0x44')]=intUtil[_0xa4b0('0x43')](_0x364a57['serverUrl']);if(_0x589f8e&&_0x589f8e[_0xa4b0('0x45')]){logger[_0xa4b0('0x8')](_0xa4b0('0x46'),_0xa4b0('0x47'));_0x271e48['recordingURL']=util[_0xa4b0('0xa')](_0xa4b0('0x48'),_0x364a57[_0xa4b0('0x44')],_0x271e48[_0xa4b0('0x49')],md5(_0x271e48[_0xa4b0('0x49')]));}else{_0x271e48[_0xa4b0('0x4a')]='';}headers[_0xa4b0('0x4b')]=getAuth(_0x364a57);return getUser(_0x364a57,_0x574333['email'])[_0xa4b0('0x12')](function(_0x125995){_0x4f12e8=_0x125995;logger[_0xa4b0('0x8')]('The\x20User\x20ID\x20is:',_0x4f12e8['id']);return getEndUser(_0x364a57,_0x271e48['calleridname'],_0x271e48[_0xa4b0('0x4c')]);})[_0xa4b0('0x12')](function(_0x31de93){_0x11fa1e=_0x31de93;logger['info'](_0xa4b0('0x4d'),_0x11fa1e['id']);return getTicket(_0x364a57,_0x4f12e8,_0x11fa1e,_0x170c54,_0x271e48);})[_0xa4b0('0x12')](function(_0x2943dd){if(_0x2943dd){logger[_0xa4b0('0x8')](_0xa4b0('0x4e'),_0x2943dd['id']);switch(_0x364a57['type']){case _0xa4b0('0x4f'):logger['info']('[QUEUE]',_0xa4b0('0x50'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x51'),_0x364a57[_0xa4b0('0xc')],_0x4f12e8['id'],_0x2943dd['id']),'method':_0xa4b0('0xd')});case _0xa4b0('0x52'):logger[_0xa4b0('0x8')](_0xa4b0('0x46'),_0xa4b0('0x53'));emit(util[_0xa4b0('0xa')](_0xa4b0('0x54'),_0x574333[_0xa4b0('0xf')]),_0xa4b0('0x55'),{'uri':util[_0xa4b0('0xa')](_0xa4b0('0x56'),_0x364a57[_0xa4b0('0xc')]['replace'](_0xa4b0('0x57'),''),_0x2943dd['id'])});break;default:logger[_0xa4b0('0x58')](_0xa4b0('0x46'),_0xa4b0('0x59'));}}})['catch'](function(_0x44c029){logger['error'](_0xa4b0('0x5a'),util[_0xa4b0('0x5b')](_0x44c029,{'showHidden':!![],'depth':null}));});};exports[_0xa4b0('0x5c')]=function(_0x446881,_0x114b5f,_0x510407,_0x393f7e,_0x5a76e5,_0x58101a,_0x59d4bf){var _0x3f7049,_0x1870f2;_0x58101a[_0xa4b0('0xc')]=intUtil[_0xa4b0('0x43')](_0x58101a['remoteUri']);_0x58101a[_0xa4b0('0x44')]=intUtil[_0xa4b0('0x43')](_0x58101a[_0xa4b0('0x44')]);if(_0x59d4bf&&_0x59d4bf[_0xa4b0('0x5d')]&&_0x59d4bf[_0xa4b0('0x5d')]!==_0xa4b0('0x5e')){logger['info'](_0xa4b0('0x5f'),_0xa4b0('0x47'));_0x114b5f[_0xa4b0('0x4a')]=util[_0xa4b0('0xa')](_0xa4b0('0x48'),_0x58101a[_0xa4b0('0x44')],_0x114b5f['uniqueid'],md5(_0x114b5f[_0xa4b0('0x49')]));}headers[_0xa4b0('0x4b')]=getAuth(_0x58101a);return getUser(_0x58101a,_0x393f7e[_0xa4b0('0x60')])[_0xa4b0('0x12')](function(_0x3dfa11){_0x3f7049=_0x3dfa11;logger['info']('The\x20User\x20ID\x20is:',_0x3f7049['id']);return getEndUser(_0x58101a,_0x114b5f[_0xa4b0('0x61')],_0x114b5f[_0xa4b0('0x62')]);})[_0xa4b0('0x12')](function(_0x436e9d){_0x1870f2=_0x436e9d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1870f2['id']);return getTicket(_0x58101a,_0x3f7049,_0x1870f2,_0x510407,_0x114b5f);})[_0xa4b0('0x12')](function(_0x394df9){if(_0x394df9){logger[_0xa4b0('0x8')](_0xa4b0('0x4e'),_0x394df9['id']);switch(_0x58101a[_0xa4b0('0x3a')]){case _0xa4b0('0x4f'):logger[_0xa4b0('0x8')](_0xa4b0('0x5f'),_0xa4b0('0x50'));return request({'uri':util[_0xa4b0('0xa')](_0xa4b0('0x51'),_0x58101a['remoteUri'],_0x3f7049['id'],_0x394df9['id']),'method':_0xa4b0('0xd')});case _0xa4b0('0x52'):logger[_0xa4b0('0x8')](_0xa4b0('0x5f'),_0xa4b0('0x53'));emit(util['format'](_0xa4b0('0x54'),_0x393f7e[_0xa4b0('0xf')]),_0xa4b0('0x55'),{'uri':util[_0xa4b0('0xa')](_0xa4b0('0x56'),_0x58101a[_0xa4b0('0xc')][_0xa4b0('0x63')](_0xa4b0('0x57'),''),_0x394df9['id'])});break;default:logger[_0xa4b0('0x58')](_0xa4b0('0x5f'),_0xa4b0('0x59'));}}})[_0xa4b0('0x64')](function(_0x3211e4){logger['error'](_0xa4b0('0x65'),util[_0xa4b0('0x5b')](_0x3211e4,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2b21da,_0x37ea0e,_0x13f6e6,_0x29192f,_0x3d4893,_0x2136fe){var _0x31c44e,_0x5ef6f6;_0x2136fe[_0xa4b0('0xc')]=intUtil[_0xa4b0('0x43')](_0x2136fe[_0xa4b0('0xc')]);_0x2136fe[_0xa4b0('0x44')]=intUtil[_0xa4b0('0x43')](_0x2136fe[_0xa4b0('0x44')]);if(_0x3d4893&&_0x3d4893['monitor_format']){logger[_0xa4b0('0x8')]('['+_0x37ea0e['lastevent'][_0xa4b0('0x66')]()+']','Recording\x20is\x20enabled!');_0x37ea0e[_0xa4b0('0x4a')]=util[_0xa4b0('0xa')](_0xa4b0('0x48'),_0x2136fe[_0xa4b0('0x44')],_0x37ea0e[_0xa4b0('0x49')],md5(_0x37ea0e['uniqueid']));}else{_0x37ea0e[_0xa4b0('0x4a')]='';}headers[_0xa4b0('0x4b')]=getAuth(_0x2136fe);return getUser(_0x2136fe)[_0xa4b0('0x12')](function(_0x12911a){_0x31c44e=_0x12911a;logger[_0xa4b0('0x8')](_0xa4b0('0x67'),_0x31c44e['id']);return getEndUser(_0x2136fe,_0x37ea0e[_0xa4b0('0x68')],_0x37ea0e['calleridnum']);})['then'](function(_0x1b3242){_0x5ef6f6=_0x1b3242;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5ef6f6['id']);return getTicket(_0x2136fe,_0x31c44e,_0x5ef6f6,_0x13f6e6,_0x37ea0e);})[_0xa4b0('0x12')](function(_0xaa750f){if(_0xaa750f){logger[_0xa4b0('0x8')]('The\x20Ticket\x20ID\x20is:',_0xaa750f['id']);}})[_0xa4b0('0x64')](function(_0x3b3cd2){logger['error']('['+_0x37ea0e[_0xa4b0('0x69')][_0xa4b0('0x66')]()+']'+_0xa4b0('0x6a'),util[_0xa4b0('0x5b')](_0x3b3cd2,{'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 e6931d4..db0a1e9 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 _0xa863=['none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','unmanaged','toUpperCase','request-promise','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','stringify','length','forEach','includes','string','picklist','type','idField','toString','Variable','name','toLowerCase','split','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','clientSecret','refresh_token','then','access_token','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','isNil','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Owner','administrator','getString','Subjects','Descriptions','enduserType','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','format','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat'];(function(_0x45dedf,_0x382360){var _0x1e4758=function(_0x525dce){while(--_0x525dce){_0x45dedf['push'](_0x45dedf['shift']());}};_0x1e4758(++_0x382360);}(_0xa863,0x1d0));var _0x3a86=function(_0x4fd608,_0xa6b0bc){_0x4fd608=_0x4fd608-0x0;var _0x420c72=_0xa863[_0x4fd608];return _0x420c72;};'use strict';var _=require('lodash');var rp=require(_0x3a86('0x0'));var md5=require('md5');var util=require(_0x3a86('0x1'));var intUtil=require(_0x3a86('0x2'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x3a86('0x3'));var config=require(_0x3a86('0x4'));var logger=require(_0x3a86('0x5'))(_0x3a86('0x6'));config[_0x3a86('0x7')]=_[_0x3a86('0x8')](config[_0x3a86('0x7')],{'host':_0x3a86('0x9'),'port':0x18eb});var io=require(_0x3a86('0xa'))(new Redis(config[_0x3a86('0x7')]));function emit(_0x4bbc1c,_0x4e090c,_0x1ac042){io['to'](_0x4bbc1c)[_0x3a86('0xb')](_0x4e090c,_0x1ac042);}function request(_0x29d1da){logger['debug']('[HTTP]',JSON[_0x3a86('0xc')](_0x29d1da));return rp(_0x29d1da);}function getCustomFields(_0x5dff85,_0x35a717){var _0x42ad3a={};if(_0x5dff85[_0x3a86('0xd')]>0x0){_[_0x3a86('0xe')](_0x5dff85,function(_0x4107bb){if(_[_0x3a86('0xf')]([_0x3a86('0x10'),_0x3a86('0x11')],_0x4107bb[_0x3a86('0x12')])&&_0x4107bb[_0x3a86('0x13')]){_0x42ad3a[_0x4107bb[_0x3a86('0x13')]]=_0x4107bb['content'][_0x3a86('0x14')]();}else if(_0x4107bb['type']==='variable'&&_0x4107bb['variableName']&&_0x4107bb['idField']&&_0x35a717[_0x4107bb['variableName']]){_0x42ad3a[_0x4107bb[_0x3a86('0x13')]]=_0x35a717[_0x4107bb['variableName']][_0x3a86('0x14')]();}else if(_0x4107bb[_0x3a86('0x12')]==='customVariable'&&_0x4107bb['Variable']&&_0x4107bb[_0x3a86('0x15')][_0x3a86('0x16')]&&_0x4107bb['idField']&&_0x35a717[_0x4107bb['Variable'][_0x3a86('0x16')][_0x3a86('0x17')]()]){_0x42ad3a[_0x4107bb[_0x3a86('0x13')]]=_0x35a717[_0x4107bb['Variable'][_0x3a86('0x16')][_0x3a86('0x17')]()][_0x3a86('0x14')]();}});}return _0x42ad3a;}function getName(_0x2fc287){if(_0x2fc287['indexOf']('\x20')>0x0){var _0x2039d2=_0x2fc287[_0x3a86('0x18')](/ (.+)/);if(_0x2039d2[0x1]){return _0x2039d2;}}return[_0x2fc287,_0x2fc287];}var accountsTokens={};function getAccessToken(_0x4fb5b8){return new Promise(function(_0xa290b9,_0x458dbd){if(!_['isNil'](accountsTokens[_0x4fb5b8['id']])&&!_['isNil'](accountsTokens[_0x4fb5b8['id']]['access_token'])){if(moment()[_0x3a86('0x19')](accountsTokens[_0x4fb5b8['id']][_0x3a86('0x1a')])){_0xa290b9(accountsTokens[_0x4fb5b8['id']]['access_token']);}}var _0x36e796;switch(_0x4fb5b8['zone']){case'US':_0x36e796=_0x3a86('0x1b');break;case'AU':_0x36e796=_0x3a86('0x1c');break;case'EU':_0x36e796=_0x3a86('0x1d');break;case'IN':_0x36e796='https://accounts.zoho.in';break;case'CN':_0x36e796=_0x3a86('0x1e');break;default:_0x36e796=_0x3a86('0x1d');break;}var _0x1bb6a4={'method':_0x3a86('0x1f'),'uri':_0x36e796+_0x3a86('0x20'),'qs':{'refresh_token':_0x4fb5b8['refreshToken'],'client_id':_0x4fb5b8['clientId'],'client_secret':_0x4fb5b8[_0x3a86('0x21')],'grant_type':_0x3a86('0x22')},'json':!![]};return rp(_0x1bb6a4)[_0x3a86('0x23')](function(_0x3017e7){accountsTokens[_0x4fb5b8['id']]={'access_token':_0x3017e7[_0x3a86('0x24')],'expires_in':moment()['add'](_0x3017e7[_0x3a86('0x1a')],_0x3a86('0x25'))};_0xa290b9(_0x3017e7[_0x3a86('0x24')]);})[_0x3a86('0x26')](function(_0x1d4838){logger['error'](_0x3a86('0x27'),_0x1d4838[_0x3a86('0x28')]);_0x458dbd(_0x1d4838);});});}function getUser(_0x3c150c,_0x5460e5,_0x77612f,_0x38b54e){logger[_0x3a86('0x29')](_0x3a86('0x2a'));return request({'method':_0x3a86('0x2b'),'uri':util['format'](_0x3a86('0x2c'),_0x5460e5),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x3a86('0x2d')+_0x3c150c},'json':!![]})['then'](function(_0x16c06e){if(_0x16c06e[_0x3a86('0x2e')]){var _0x5c6ae8=-0x1;if(_[_0x3a86('0x2f')](_0x16c06e[_0x3a86('0x2e')])){if(!_['isNil'](_0x38b54e)){_0x5c6ae8=_['findIndex'](_0x16c06e[_0x3a86('0x2e')],function(_0x57f6fe){return _0x57f6fe['email']===_0x38b54e;});}if(_0x5c6ae8>=0x0){logger['info'](_0x3a86('0x30'));}else{logger[_0x3a86('0x29')](_0x3a86('0x31'));_0x5c6ae8=_[_0x3a86('0x32')](_0x16c06e[_0x3a86('0x2e')],function(_0x23c9ce){return _0x23c9ce[_0x3a86('0x33')][_0x3a86('0x16')]===_0x3a86('0x34');});}return _0x16c06e[_0x3a86('0x2e')][_0x5c6ae8];}else{if(_0x16c06e['user'][_0x3a86('0x33')][_0x3a86('0x16')]===_0x3a86('0x34')){logger[_0x3a86('0x29')](_0x3a86('0x31'));user=_0x16c06e[_0x3a86('0x35')];return user;}else{logger[_0x3a86('0x36')](_0x3a86('0x37'),JSON[_0x3a86('0xc')](_0x16c06e));throw new Error(_0x3a86('0x38')+JSON[_0x3a86('0xc')](_0x16c06e));}}}else{logger[_0x3a86('0x36')](_0x3a86('0x37'),JSON[_0x3a86('0xc')](_0x16c06e));throw new Error(_0x3a86('0x38')+JSON['stringify'](_0x16c06e));}})[_0x3a86('0x26')](function(_0x48839d){console[_0x3a86('0x36')](_0x48839d);});}function getZohoUser(_0x389df4,_0x4a64bb){return new BPromise(function(_0x4fe4db,_0x4efe67){request(_0x389df4)[_0x3a86('0x23')](function(_0x48973f){var _0x664aa=null;if(_0x48973f){_0x664aa=_0x48973f[_0x3a86('0x39')][0x0];_0x664aa['enduserType']=_0x4a64bb;}_0x4fe4db(_0x664aa);})[_0x3a86('0x26')](function(_0x364bb2){_0x4efe67(_0x364bb2);});});}function createEndUser(_0x3907ae,_0x2b7ea9,_0x31efbe,_0x5b6352,_0x1421e2,_0x269fd6){var _0x31efbe=getName(_0x31efbe);return request({'method':'POST','uri':_0x3a86('0x3a')+_0x2b7ea9+_0x3a86('0x3b')+_[_0x3a86('0x3c')](_0x269fd6[_0x3a86('0x3d')])+'s','body':{'data':[{'Last_Name':_0x31efbe[0x1],'First_Name':_0x31efbe[0x0],'Phone':_0x5b6352,'Owner':{'name':!_[_0x3a86('0x3e')](_0x1421e2[_0x3a86('0x3f')]['name'])?_0x1421e2[_0x3a86('0x3f')][_0x3a86('0x16')]:!_[_0x3a86('0x3e')](_0x1421e2[_0x3a86('0x40')])?_0x1421e2[_0x3a86('0x40')]+'\x20'+_0x1421e2[_0x3a86('0x41')]:_0x1421e2['last_name'],'id':_0x1421e2['id']}}]},'headers':{'Authorization':_0x3a86('0x2d')+_0x3907ae},'json':!![]})['then'](function(_0x19e4f9){if(_0x19e4f9&&_0x19e4f9[_0x3a86('0x39')][0x0][_0x3a86('0x42')]==='SUCCESS'){var _0x10e3f9=_0x19e4f9[_0x3a86('0x39')][0x0][_0x3a86('0x43')];_0x10e3f9['enduserType']=_['startCase'](_0x269fd6[_0x3a86('0x3d')])+'s';return _0x10e3f9;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x3a86('0xc')](data));throw new Error(_0x3a86('0x44')+JSON[_0x3a86('0xc')](data));})[_0x3a86('0x26')](function(_0x4995b6){console[_0x3a86('0x45')](_0x3a86('0x46'),_0x4995b6);});}function getEndUser(_0x47c155,_0xe46f67,_0x439ac1,_0x5eea4b,_0x2e356b,_0x42e0a9,_0x2079fc){var _0x48557b={'method':_0x3a86('0x2b'),'uri':'','headers':{'Authorization':_0x3a86('0x2d')+_0x47c155},'json':!![]};switch(_0x2079fc[_0x3a86('0x47')]){case _0x3a86('0x48'):_0x48557b[_0x3a86('0x49')]=_0x3a86('0x3a')+_0xe46f67+_0x3a86('0x4a')+_0x2e356b+'))';return getZohoUser(_0x48557b,_0x3a86('0x4b'))['then'](function(_0x5caada){if(_0x5caada)return _0x5caada;_0x48557b[_0x3a86('0x49')]='https://www.zohoapis.'+_0xe46f67+_0x3a86('0x4c')+_0x2e356b+'))';return getZohoUser(_0x48557b,_0x3a86('0x4d'))[_0x3a86('0x23')](function(_0x4f4857){if(_0x4f4857)return _0x4f4857;if(_0x2079fc['moduleCreate']!=_0x3a86('0x4e')){return createEndUser(_0x47c155,_0xe46f67,_0x5eea4b,_0x2e356b,_0x42e0a9,_0x2079fc);}else{return{};}});});break;case'contact':_0x48557b[_0x3a86('0x49')]=_0x3a86('0x3a')+_0xe46f67+_0x3a86('0x4a')+_0x2e356b+'))';return getZohoUser(_0x48557b,_0x3a86('0x4b'))[_0x3a86('0x23')](function(_0x166a2e){if(_0x166a2e)return _0x166a2e;if(_0x2079fc['moduleCreate']!=_0x3a86('0x4e')){return createEndUser(_0x47c155,_0xe46f67,_0x5eea4b,_0x2e356b,_0x42e0a9,_0x2079fc);}else{return{};}});break;case _0x3a86('0x4f'):_0x48557b[_0x3a86('0x49')]='https://www.zohoapis.'+_0xe46f67+_0x3a86('0x4c')+_0x2e356b+'))';return getZohoUser(_0x48557b,'Leads')[_0x3a86('0x23')](function(_0x195888){if(_0x195888)return _0x195888;if(_0x2079fc[_0x3a86('0x3d')]!='nothing'){return createEndUser(_0x47c155,_0xe46f67,_0x5eea4b,_0x2e356b,_0x42e0a9,_0x2079fc);}else{return{};}});break;}}function getCall(_0x21fece,_0xca20b1,_0x4906b0,_0x4b4ddf,_0x11448f,_0x2f8c66,_0x11dade,_0x14659d){logger[_0x3a86('0x29')]('Creating\x20new\x20call...');var _0x3b5982={};_0x3b5982[_0x3a86('0x50')]={'name':!_[_0x3a86('0x3e')](_0x4b4ddf[_0x3a86('0x3f')][_0x3a86('0x16')])&&!_['isNil'](_0x4b4ddf[_0x3a86('0x33')][_0x3a86('0x16')])&&_0x4b4ddf[_0x3a86('0x33')][_0x3a86('0x16')]===_0x3a86('0x51')?_0x4b4ddf[_0x3a86('0x3f')]['name']:!_['isNil'](_0x4b4ddf[_0x3a86('0x40')])?_0x4b4ddf[_0x3a86('0x40')]+'\x20'+_0x4b4ddf[_0x3a86('0x41')]:_0x4b4ddf[_0x3a86('0x41')],'id':_0x4b4ddf['id']};_0x3b5982['Subject']=intUtil[_0x3a86('0x52')](_0x2f8c66[_0x3a86('0x53')],_0x11dade,'\x20');_0x3b5982['Description']=intUtil[_0x3a86('0x52')](_0x2f8c66[_0x3a86('0x54')],_0x11dade,'\x0a');if(_0x11448f[_0x3a86('0x55')]==='Contacts'){_0x3b5982[_0x3a86('0x56')]={'name':!_['isNil'](_0x11448f[_0x3a86('0x57')])?_0x11448f['Full_Name']:!_['isNil'](_0x11448f['First_Name'])?_0x11448f['First_Name']+'\x20'+_0x11448f[_0x3a86('0x58')]:_0x11448f[_0x3a86('0x58')],'id':_0x11448f['id']};}if(_0x11448f[_0x3a86('0x55')]===_0x3a86('0x4d')){_0x3b5982[_0x3a86('0x59')]={'name':!_[_0x3a86('0x3e')](_0x11448f['Full_Name'])?_0x11448f[_0x3a86('0x57')]:!_[_0x3a86('0x3e')](_0x11448f[_0x3a86('0x5a')])?_0x11448f[_0x3a86('0x5a')]+'\x20'+_0x11448f[_0x3a86('0x58')]:_0x11448f[_0x3a86('0x58')],'id':_0x11448f['id']};_0x3b5982[_0x3a86('0x5b')]=_[_0x3a86('0x3c')](_0x11448f[_0x3a86('0x55')]);}if(_0x11dade[_0x3a86('0x5c')]){_0x3b5982[_0x3a86('0x5d')]=moment[_0x3a86('0x5e')](parseInt(_0x11dade[_0x3a86('0x5c')])*0x3e8)[_0x3a86('0x5f')]('mm:ss');}else if(_0x11dade['answertime']&&_0x11dade['endtime']){_0x3b5982[_0x3a86('0x5d')]=moment[_0x3a86('0x5e')](moment(_0x11dade[_0x3a86('0x60')],_0x3a86('0x61'))[_0x3a86('0x62')](moment(_0x11dade[_0x3a86('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0x3a86('0x5f')](_0x3a86('0x64'));}switch(_0x11dade[_0x3a86('0x65')]){case _0x3a86('0x66'):_0x3b5982[_0x3a86('0x67')]=_0x3a86('0x68');break;case _0x3a86('0x69'):case _0x3a86('0x6a'):_0x3b5982[_0x3a86('0x67')]='Answered';break;case _0x3a86('0x6b'):_0x3b5982[_0x3a86('0x67')]=_0x3a86('0x6c');break;case'abandoned':_0x3b5982[_0x3a86('0x67')]=_0x3a86('0x6d');break;case _0x3a86('0x6e'):_0x3b5982['Call_Result']='Timeout';default:}_0x3b5982[_0x3a86('0x6f')]=(_0x14659d===_0x3a86('0x70')?moment(_0x11dade[_0x3a86('0x63')])[_0x3a86('0x5f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x11dade[_0x3a86('0x71')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3a86('0x5f')](_0x3a86('0x61'));_0x3b5982[_0x3a86('0x72')]=_0x14659d||_0x3a86('0x73');_0x3b5982=_[_0x3a86('0x74')](_0x3b5982,getCustomFields(_0x2f8c66[_0x3a86('0x75')],_0x11dade));return request({'method':_0x3a86('0x1f'),'uri':_0x3a86('0x3a')+_0xca20b1+'/crm/v2/Calls','headers':{'Authorization':_0x3a86('0x2d')+_0x21fece},'body':{'data':[_0x3b5982]},'json':!![]})[_0x3a86('0x23')](function(_0x3accfb){if(_0x3accfb&&_0x3accfb[_0x3a86('0x39')][0x0][_0x3a86('0x42')]===_0x3a86('0x76')){logger[_0x3a86('0x29')](_0x3a86('0x77'));return{'id':_0x3accfb['data'][0x0][_0x3a86('0x43')]['id']};}})[_0x3a86('0x26')](function(_0x4a4591){logger[_0x3a86('0x29')](_0x3a86('0x78'),_0x4a4591[_0x3a86('0x28')]);console[_0x3a86('0x45')](_0x3a86('0x78'),_0x4a4591);});}exports[_0x3a86('0x79')]=function(_0x3151ca,_0x28f166,_0x45cb69,_0x566322,_0xefa9e1,_0x40ff26){var _0x1e6bbf,_0x51a645,_0x518cc7;_0x40ff26[_0x3a86('0x7a')]=intUtil[_0x3a86('0x7b')](_0x40ff26[_0x3a86('0x7a')]);_0x40ff26[_0x3a86('0x7c')]=intUtil[_0x3a86('0x7b')](_0x40ff26[_0x3a86('0x7c')]);if(_0xefa9e1&&_0xefa9e1[_0x3a86('0x7d')]){logger[_0x3a86('0x29')](_0x3a86('0x7e'),_0x3a86('0x7f'));_0x28f166[_0x3a86('0x80')]=_0x40ff26[_0x3a86('0x7c')]+_0x3a86('0x81')+_0x28f166[_0x3a86('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x28f166[_0x3a86('0x82')]);}else{_0x28f166[_0x3a86('0x80')]='';}var _0x26a437=_0x40ff26['host']===_0x3a86('0x83')?'eu':_0x3a86('0x84');return getAccessToken(_0x40ff26)[_0x3a86('0x23')](function(_0x3f0a99){_0x518cc7=_0x3f0a99;return getUser(_0x518cc7,_0x26a437,_0x40ff26,_0x566322[_0x3a86('0x85')]);})[_0x3a86('0x23')](function(_0x431ff9){_0x1e6bbf=_0x431ff9;logger[_0x3a86('0x29')](_0x3a86('0x86'),_0x1e6bbf['id']);return getEndUser(_0x518cc7,_0x26a437,_0x40ff26,_0x28f166[_0x3a86('0x87')],_0x28f166[_0x3a86('0x88')],_0x1e6bbf,_0x45cb69);})['then'](function(_0x4409ad){_0x51a645=_0x4409ad;return getCall(_0x518cc7,_0x26a437,_0x40ff26,_0x1e6bbf,_0x51a645,_0x45cb69,_0x28f166,'Inbound');})['then'](function(_0x2d5142){if(_0x2d5142){logger[_0x3a86('0x29')]('The\x20Call\x20ID\x20is:',_0x2d5142['id']);logger[_0x3a86('0x29')](_0x3a86('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3a86('0x5f')](_0x3a86('0x89'),_0x566322[_0x3a86('0x16')]),'trigger:browser:url',{'uri':'https://crm.'+_0x40ff26['host']+_0x3a86('0x8a')+_0x2d5142['id']});}})['catch'](function(_0x5cb14c){logger[_0x3a86('0x36')](_0x3a86('0x7e'),JSON[_0x3a86('0xc')](_0x5cb14c));});};exports[_0x3a86('0x70')]=function(_0x20f875,_0x4ef855,_0x9014ca,_0x2a1970,_0x32c304,_0x254457,_0x4589ad){var _0x531820,_0x5dcc2c,_0x3f2ea9;_0x254457[_0x3a86('0x7a')]=intUtil['stripTrailingSlash'](_0x254457[_0x3a86('0x7a')]);_0x254457[_0x3a86('0x7c')]=intUtil['stripTrailingSlash'](_0x254457['serverUrl']);if(_0x4589ad&&_0x4589ad['recordingFormat']&&_0x4589ad[_0x3a86('0x8b')]!==_0x3a86('0x8c')){logger['info'](_0x3a86('0x8d'),'Recording\x20is\x20enabled!');_0x4ef855[_0x3a86('0x80')]=_0x254457[_0x3a86('0x7c')]+_0x3a86('0x81')+_0x4ef855[_0x3a86('0x82')]+_0x3a86('0x8e')+md5(_0x4ef855[_0x3a86('0x82')]);}var _0x4d4b5e=_0x254457['host']===_0x3a86('0x83')?'eu':'com';return getAccessToken(_0x254457)[_0x3a86('0x23')](function(_0x3dbd76){_0x3f2ea9=_0x3dbd76;return getUser(_0x3f2ea9,_0x4d4b5e,_0x254457,_0x2a1970[_0x3a86('0x85')]);})['then'](function(_0x5313fb){_0x531820=_0x5313fb;logger[_0x3a86('0x29')](_0x3a86('0x86'),_0x531820['id']);return getEndUser(_0x3f2ea9,_0x4d4b5e,_0x254457,_0x4ef855[_0x3a86('0x8f')],_0x4ef855['destcalleridnum'],_0x531820,_0x9014ca);})[_0x3a86('0x23')](function(_0x40e486){_0x5dcc2c=_0x40e486;return getCall(_0x3f2ea9,_0x4d4b5e,_0x254457,_0x531820,_0x5dcc2c,_0x9014ca,_0x4ef855,_0x3a86('0x90'));})['then'](function(_0x30e6ba){if(_0x30e6ba){logger[_0x3a86('0x29')](_0x3a86('0x91'),_0x30e6ba['id']);logger[_0x3a86('0x29')](_0x3a86('0x8d'),_0x3a86('0x92'));emit(util[_0x3a86('0x5f')](_0x3a86('0x89'),_0x2a1970[_0x3a86('0x16')]),_0x3a86('0x93'),{'uri':_0x3a86('0x94')+_0x254457[_0x3a86('0x7a')]+_0x3a86('0x8a')+_0x30e6ba['id']});}})[_0x3a86('0x26')](function(_0x3772ba){logger[_0x3a86('0x36')](_0x3a86('0x8d'),JSON['stringify'](_0x3772ba));});};exports[_0x3a86('0x95')]=function(_0x2439d5,_0x574f31,_0x5e1caa,_0x940186,_0x568940,_0x2a5d5a){var _0x2a39b9,_0x4cdabb,_0x402e21;_0x2a5d5a['host']=intUtil[_0x3a86('0x7b')](_0x2a5d5a[_0x3a86('0x7a')]);_0x2a5d5a['serverUrl']=intUtil['stripTrailingSlash'](_0x2a5d5a[_0x3a86('0x7c')]);if(_0x568940&&_0x568940[_0x3a86('0x7d')]){logger[_0x3a86('0x29')]('['+_0x574f31['lastevent'][_0x3a86('0x96')]()+']',_0x3a86('0x7f'));_0x574f31['recordingURL']=_0x2a5d5a[_0x3a86('0x7c')]+_0x3a86('0x81')+_0x574f31['uniqueid']+_0x3a86('0x8e')+md5(_0x574f31[_0x3a86('0x82')]);}else{_0x574f31[_0x3a86('0x80')]='';}var _0x22cb4b=_0x2a5d5a['host']===_0x3a86('0x83')?'eu':_0x3a86('0x84');return getAccessToken(_0x2a5d5a)[_0x3a86('0x23')](function(_0x3317c1){_0x402e21=_0x3317c1;return getUser(_0x402e21,_0x22cb4b,_0x2a5d5a);})[_0x3a86('0x23')](function(_0x182ab5){_0x2a39b9=_0x182ab5;logger['info'](_0x3a86('0x86'),_0x2a39b9['id']);return getEndUser(_0x402e21,_0x22cb4b,_0x2a5d5a,_0x574f31[_0x3a86('0x87')],_0x574f31[_0x3a86('0x88')],_0x2a39b9,_0x5e1caa);})[_0x3a86('0x23')](function(_0x38001a){_0x4cdabb=_0x38001a;return getCall(_0x402e21,_0x22cb4b,_0x2a5d5a,_0x2a39b9,_0x4cdabb,_0x5e1caa,_0x574f31,_0x3a86('0x73'));})['then'](function(_0x1da064){if(_0x1da064){logger['info'](_0x3a86('0x91'),_0x1da064['id']);}})[_0x3a86('0x26')](function(_0x39c893){logger[_0x3a86('0x36')]('['+_0x574f31[_0x3a86('0x65')][_0x3a86('0x96')]()+']',JSON['stringify'](_0x39c893));});}; \ No newline at end of file +var _0x9de3=['Contacts','https://www.zohoapis.','Leads','nothing','contact','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','lodash','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:'];(function(_0x4a47fc,_0x25208f){var _0x30f1ee=function(_0x33ea17){while(--_0x33ea17){_0x4a47fc['push'](_0x4a47fc['shift']());}};_0x30f1ee(++_0x25208f);}(_0x9de3,0xea));var _0x39de=function(_0x580c7f,_0x5a4519){_0x580c7f=_0x580c7f-0x0;var _0x4d35cc=_0x9de3[_0x580c7f];return _0x4d35cc;};'use strict';var _=require(_0x39de('0x0'));var rp=require('request-promise');var md5=require(_0x39de('0x1'));var util=require(_0x39de('0x2'));var intUtil=require(_0x39de('0x3'));var moment=require('moment');var Redis=require(_0x39de('0x4'));var BPromise=require('bluebird');var config=require(_0x39de('0x5'));var logger=require(_0x39de('0x6'))(_0x39de('0x7'));config[_0x39de('0x8')]=_['defaults'](config[_0x39de('0x8')],{'host':_0x39de('0x9'),'port':0x18eb});var io=require(_0x39de('0xa'))(new Redis(config[_0x39de('0x8')]));function emit(_0x2604fa,_0x59ce28,_0x4e7204){io['to'](_0x2604fa)['emit'](_0x59ce28,_0x4e7204);}function request(_0x27e596){logger[_0x39de('0xb')](_0x39de('0xc'),JSON[_0x39de('0xd')](_0x27e596));return rp(_0x27e596);}function getCustomFields(_0x4450ec,_0x31a203){var _0x431b4a={};if(_0x4450ec[_0x39de('0xe')]>0x0){_['forEach'](_0x4450ec,function(_0x27772d){if(_['includes'](['string',_0x39de('0xf')],_0x27772d[_0x39de('0x10')])&&_0x27772d[_0x39de('0x11')]){_0x431b4a[_0x27772d['idField']]=_0x27772d[_0x39de('0x12')][_0x39de('0x13')]();}else if(_0x27772d[_0x39de('0x10')]===_0x39de('0x14')&&_0x27772d[_0x39de('0x15')]&&_0x27772d[_0x39de('0x11')]&&_0x31a203[_0x27772d[_0x39de('0x15')]]){_0x431b4a[_0x27772d[_0x39de('0x11')]]=_0x31a203[_0x27772d[_0x39de('0x15')]][_0x39de('0x13')]();}else if(_0x27772d['type']===_0x39de('0x16')&&_0x27772d[_0x39de('0x17')]&&_0x27772d[_0x39de('0x17')][_0x39de('0x18')]&&_0x27772d['idField']&&_0x31a203[_0x27772d['Variable'][_0x39de('0x18')]['toLowerCase']()]){_0x431b4a[_0x27772d[_0x39de('0x11')]]=_0x31a203[_0x27772d[_0x39de('0x17')]['name'][_0x39de('0x19')]()]['toString']();}});}return _0x431b4a;}function getName(_0x440201){if(_0x440201[_0x39de('0x1a')]('\x20')>0x0){var _0x4933ff=_0x440201['split'](/ (.+)/);if(_0x4933ff[0x1]){return _0x4933ff;}}return[_0x440201,_0x440201];}var accountsTokens={};function getAccessToken(_0xab6f89){return new Promise(function(_0x5e4ab2,_0x552590){if(!_[_0x39de('0x1b')](accountsTokens[_0xab6f89['id']])&&!_[_0x39de('0x1b')](accountsTokens[_0xab6f89['id']][_0x39de('0x1c')])){if(moment()[_0x39de('0x1d')](accountsTokens[_0xab6f89['id']][_0x39de('0x1e')])){_0x5e4ab2(accountsTokens[_0xab6f89['id']][_0x39de('0x1c')]);}}var _0x510765;switch(_0xab6f89[_0x39de('0x1f')]){case'US':_0x510765=_0x39de('0x20');break;case'AU':_0x510765=_0x39de('0x21');break;case'EU':_0x510765='https://accounts.zoho.eu';break;case'IN':_0x510765=_0x39de('0x22');break;case'CN':_0x510765='https://accounts.zoho.com.cn';break;default:_0x510765=_0x39de('0x23');break;}var _0x102c5b={'method':_0x39de('0x24'),'uri':_0x510765+_0x39de('0x25'),'qs':{'refresh_token':_0xab6f89[_0x39de('0x26')],'client_id':_0xab6f89['clientId'],'client_secret':_0xab6f89[_0x39de('0x27')],'grant_type':_0x39de('0x28')},'json':!![]};return rp(_0x102c5b)[_0x39de('0x29')](function(_0x73b579){accountsTokens[_0xab6f89['id']]={'access_token':_0x73b579['access_token'],'expires_in':moment()[_0x39de('0x2a')](_0x73b579['expires_in'],'seconds')};_0x5e4ab2(_0x73b579[_0x39de('0x1c')]);})[_0x39de('0x2b')](function(_0xfd80c8){logger[_0x39de('0x2c')](_0x39de('0x2d'),_0xfd80c8['stack']);_0x552590(_0xfd80c8);});});}function getUser(_0x352060,_0xe979d1,_0x46dfd2,_0x1037c9){logger[_0x39de('0x2e')](_0x39de('0x2f'));return request({'method':_0x39de('0x30'),'uri':util['format'](_0x39de('0x31'),_0xe979d1),'qs':{'type':_0x39de('0x32')},'headers':{'Authorization':_0x39de('0x33')+_0x352060},'json':!![]})[_0x39de('0x29')](function(_0x4b12d9){if(_0x4b12d9[_0x39de('0x34')]){var _0x3d6562=-0x1;if(_[_0x39de('0x35')](_0x4b12d9[_0x39de('0x34')])){if(!_['isNil'](_0x1037c9)){_0x3d6562=_[_0x39de('0x36')](_0x4b12d9[_0x39de('0x34')],function(_0x2b09b1){return _0x2b09b1[_0x39de('0x37')]===_0x1037c9;});}if(_0x3d6562>=0x0){logger[_0x39de('0x2e')]('Agent\x20found!');}else{logger['info'](_0x39de('0x38'));_0x3d6562=_[_0x39de('0x36')](_0x4b12d9[_0x39de('0x34')],function(_0x34cfd3){return _0x34cfd3['profile'][_0x39de('0x18')]==='Administrator';});}return _0x4b12d9[_0x39de('0x34')][_0x3d6562];}else{if(_0x4b12d9[_0x39de('0x39')][_0x39de('0x3a')]['name']===_0x39de('0x3b')){logger[_0x39de('0x2e')](_0x39de('0x38'));user=_0x4b12d9[_0x39de('0x39')];return user;}else{logger[_0x39de('0x2c')](_0x39de('0x3c'),JSON[_0x39de('0xd')](_0x4b12d9));throw new Error(_0x39de('0x3d')+JSON[_0x39de('0xd')](_0x4b12d9));}}}else{logger['error'](_0x39de('0x3c'),JSON[_0x39de('0xd')](_0x4b12d9));throw new Error(_0x39de('0x3d')+JSON[_0x39de('0xd')](_0x4b12d9));}})[_0x39de('0x2b')](function(_0x4ca613){console[_0x39de('0x2c')](_0x4ca613);});}function getZohoUser(_0x543bc4,_0x10c6c3){return new BPromise(function(_0x51f1a3,_0x1b841e){request(_0x543bc4)[_0x39de('0x29')](function(_0x342c0f){var _0x124bdb=null;if(_0x342c0f){_0x124bdb=_0x342c0f[_0x39de('0x3e')][0x0];_0x124bdb[_0x39de('0x3f')]=_0x10c6c3;}_0x51f1a3(_0x124bdb);})[_0x39de('0x2b')](function(_0x52d527){_0x1b841e(_0x52d527);});});}function createEndUser(_0x155451,_0x3dd32d,_0x208f24,_0x4b55ea,_0x6f1636,_0x443ab7){var _0x208f24=getName(_0x208f24);return request({'method':_0x39de('0x24'),'uri':'https://www.zohoapis.'+_0x3dd32d+'/crm/v2/'+_[_0x39de('0x40')](_0x443ab7[_0x39de('0x41')])+'s','body':{'data':[{'Last_Name':_0x208f24[0x1],'First_Name':_0x208f24[0x0],'Phone':_0x4b55ea,'Owner':{'name':!_[_0x39de('0x1b')](_0x6f1636[_0x39de('0x42')]['name'])?_0x6f1636[_0x39de('0x42')][_0x39de('0x18')]:!_[_0x39de('0x1b')](_0x6f1636[_0x39de('0x43')])?_0x6f1636[_0x39de('0x43')]+'\x20'+_0x6f1636[_0x39de('0x44')]:_0x6f1636[_0x39de('0x44')],'id':_0x6f1636['id']}}]},'headers':{'Authorization':_0x39de('0x33')+_0x155451},'json':!![]})['then'](function(_0x42ba71){if(_0x42ba71&&_0x42ba71[_0x39de('0x3e')][0x0][_0x39de('0x45')]==='SUCCESS'){var _0x1bfc75=_0x42ba71[_0x39de('0x3e')][0x0][_0x39de('0x46')];_0x1bfc75['enduserType']=_[_0x39de('0x40')](_0x443ab7[_0x39de('0x41')])+'s';return _0x1bfc75;}logger[_0x39de('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x39de('0xd')](data));throw new Error(_0x39de('0x47')+JSON[_0x39de('0xd')](data));})[_0x39de('0x2b')](function(_0x496d3f){console[_0x39de('0x48')](_0x39de('0x49'),_0x496d3f);});}function getEndUser(_0x494f19,_0x5cd01a,_0x5dfbdf,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f){var _0x2ce9c8={'method':_0x39de('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x494f19},'json':!![]};switch(_0xeb763f[_0x39de('0x4a')]){case _0x39de('0x4b'):_0x2ce9c8[_0x39de('0x4c')]='https://www.zohoapis.'+_0x5cd01a+_0x39de('0x4d')+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x4e'))['then'](function(_0x5ee1a6){if(_0x5ee1a6)return _0x5ee1a6;_0x2ce9c8[_0x39de('0x4c')]=_0x39de('0x4f')+_0x5cd01a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x50'))[_0x39de('0x29')](function(_0x49514c){if(_0x49514c)return _0x49514c;if(_0xeb763f[_0x39de('0x41')]!=_0x39de('0x51')){return createEndUser(_0x494f19,_0x5cd01a,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f);}else{return{};}});});break;case _0x39de('0x52'):_0x2ce9c8[_0x39de('0x4c')]=_0x39de('0x4f')+_0x5cd01a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x4e'))[_0x39de('0x29')](function(_0x5064c8){if(_0x5064c8)return _0x5064c8;if(_0xeb763f[_0x39de('0x41')]!=_0x39de('0x51')){return createEndUser(_0x494f19,_0x5cd01a,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f);}else{return{};}});break;case'lead':_0x2ce9c8['uri']=_0x39de('0x4f')+_0x5cd01a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x285dff+'))';return getZohoUser(_0x2ce9c8,_0x39de('0x50'))['then'](function(_0x20c9a2){if(_0x20c9a2)return _0x20c9a2;if(_0xeb763f[_0x39de('0x41')]!=_0x39de('0x51')){return createEndUser(_0x494f19,_0x5cd01a,_0x270da3,_0x285dff,_0x3f0c82,_0xeb763f);}else{return{};}});break;}}function getCall(_0x58a177,_0x34130d,_0xacad75,_0x3b5d57,_0x511d4c,_0x303bcc,_0x216d9d,_0x5670a4){logger['info'](_0x39de('0x53'));var _0x292fc4={};_0x292fc4[_0x39de('0x54')]={'name':!_[_0x39de('0x1b')](_0x3b5d57[_0x39de('0x42')][_0x39de('0x18')])&&!_[_0x39de('0x1b')](_0x3b5d57[_0x39de('0x3a')][_0x39de('0x18')])&&_0x3b5d57['profile'][_0x39de('0x18')]==='administrator'?_0x3b5d57[_0x39de('0x42')][_0x39de('0x18')]:!_[_0x39de('0x1b')](_0x3b5d57[_0x39de('0x43')])?_0x3b5d57['first_name']+'\x20'+_0x3b5d57[_0x39de('0x44')]:_0x3b5d57[_0x39de('0x44')],'id':_0x3b5d57['id']};_0x292fc4[_0x39de('0x55')]=intUtil[_0x39de('0x56')](_0x303bcc[_0x39de('0x57')],_0x216d9d,'\x20');_0x292fc4['Description']=intUtil['getString'](_0x303bcc[_0x39de('0x58')],_0x216d9d,'\x0a');if(_0x511d4c['enduserType']===_0x39de('0x4e')){_0x292fc4[_0x39de('0x59')]={'name':!_[_0x39de('0x1b')](_0x511d4c[_0x39de('0x5a')])?_0x511d4c[_0x39de('0x5a')]:!_[_0x39de('0x1b')](_0x511d4c[_0x39de('0x5b')])?_0x511d4c[_0x39de('0x5b')]+'\x20'+_0x511d4c['Last_Name']:_0x511d4c['Last_Name'],'id':_0x511d4c['id']};}if(_0x511d4c[_0x39de('0x3f')]===_0x39de('0x50')){_0x292fc4[_0x39de('0x5c')]={'name':!_[_0x39de('0x1b')](_0x511d4c['Full_Name'])?_0x511d4c[_0x39de('0x5a')]:!_[_0x39de('0x1b')](_0x511d4c[_0x39de('0x5b')])?_0x511d4c[_0x39de('0x5b')]+'\x20'+_0x511d4c[_0x39de('0x5d')]:_0x511d4c[_0x39de('0x5d')],'id':_0x511d4c['id']};_0x292fc4['$se_module']=_[_0x39de('0x40')](_0x511d4c[_0x39de('0x3f')]);}if(_0x216d9d[_0x39de('0x5e')]){_0x292fc4[_0x39de('0x5f')]=moment[_0x39de('0x60')](parseInt(_0x216d9d[_0x39de('0x5e')])*0x3e8)[_0x39de('0x61')](_0x39de('0x62'));}else if(_0x216d9d['answertime']&&_0x216d9d['endtime']){_0x292fc4[_0x39de('0x5f')]=moment[_0x39de('0x60')](moment(_0x216d9d[_0x39de('0x63')],_0x39de('0x64'))[_0x39de('0x65')](moment(_0x216d9d[_0x39de('0x66')],'YYYY-MM-DDTHH:mm:ss')))['format']('mm:ss');}switch(_0x216d9d[_0x39de('0x67')]){case _0x39de('0x68'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x6a');break;case _0x39de('0x6b'):case _0x39de('0x6c'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x6d');break;case _0x39de('0x6e'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x6f');break;case'abandoned':_0x292fc4['Call_Result']=_0x39de('0x70');break;case _0x39de('0x71'):_0x292fc4[_0x39de('0x69')]=_0x39de('0x72');default:}_0x292fc4[_0x39de('0x73')]=(_0x5670a4===_0x39de('0x74')?moment(_0x216d9d[_0x39de('0x66')])[_0x39de('0x61')](_0x39de('0x64')):moment(_0x216d9d[_0x39de('0x75')])[_0x39de('0x61')](_0x39de('0x64')))||moment()[_0x39de('0x61')](_0x39de('0x64'));_0x292fc4[_0x39de('0x76')]=_0x5670a4||_0x39de('0x77');_0x292fc4=_[_0x39de('0x78')](_0x292fc4,getCustomFields(_0x303bcc['Fields'],_0x216d9d));return request({'method':_0x39de('0x24'),'uri':_0x39de('0x4f')+_0x34130d+_0x39de('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x58a177},'body':{'data':[_0x292fc4]},'json':!![]})[_0x39de('0x29')](function(_0x2a2932){if(_0x2a2932&&_0x2a2932[_0x39de('0x3e')][0x0][_0x39de('0x45')]===_0x39de('0x7a')){logger[_0x39de('0x2e')](_0x39de('0x7b'));return{'id':_0x2a2932['data'][0x0][_0x39de('0x46')]['id']};}})[_0x39de('0x2b')](function(_0x445cd1){logger[_0x39de('0x2e')](_0x39de('0x7c'),_0x445cd1[_0x39de('0x7d')]);console[_0x39de('0x48')](_0x39de('0x7c'),_0x445cd1);});}exports[_0x39de('0x7e')]=function(_0x15bd17,_0x41a3e6,_0xb7d5be,_0x40a4c4,_0x1ff0b1,_0x4123a2){var _0x2873bc,_0x5ebbbb,_0x58a180;_0x4123a2['host']=intUtil[_0x39de('0x7f')](_0x4123a2[_0x39de('0x80')]);_0x4123a2[_0x39de('0x81')]=intUtil[_0x39de('0x7f')](_0x4123a2[_0x39de('0x81')]);if(_0x1ff0b1&&_0x1ff0b1[_0x39de('0x82')]){logger[_0x39de('0x2e')]('[QUEUE]',_0x39de('0x83'));_0x41a3e6[_0x39de('0x84')]=_0x4123a2['serverUrl']+_0x39de('0x85')+_0x41a3e6[_0x39de('0x86')]+_0x39de('0x87')+md5(_0x41a3e6['uniqueid']);}else{_0x41a3e6[_0x39de('0x84')]='';}var _0x1e8274=_0x4123a2[_0x39de('0x80')]===_0x39de('0x88')?'eu':_0x39de('0x89');return getAccessToken(_0x4123a2)[_0x39de('0x29')](function(_0x36f03a){_0x58a180=_0x36f03a;return getUser(_0x58a180,_0x1e8274,_0x4123a2,_0x40a4c4['email']);})[_0x39de('0x29')](function(_0xa676ee){_0x2873bc=_0xa676ee;logger[_0x39de('0x2e')](_0x39de('0x8a'),_0x2873bc['id']);return getEndUser(_0x58a180,_0x1e8274,_0x4123a2,_0x41a3e6[_0x39de('0x8b')],_0x41a3e6[_0x39de('0x8c')],_0x2873bc,_0xb7d5be);})[_0x39de('0x29')](function(_0x59252f){_0x5ebbbb=_0x59252f;return getCall(_0x58a180,_0x1e8274,_0x4123a2,_0x2873bc,_0x5ebbbb,_0xb7d5be,_0x41a3e6,'Inbound');})['then'](function(_0x1d41e2){if(_0x1d41e2){logger[_0x39de('0x2e')](_0x39de('0x8d'),_0x1d41e2['id']);logger['info'](_0x39de('0x8e'),_0x39de('0x8f'));emit(util['format'](_0x39de('0x90'),_0x40a4c4[_0x39de('0x18')]),'trigger:browser:url',{'uri':_0x39de('0x91')+_0x4123a2[_0x39de('0x80')]+_0x39de('0x92')+_0x1d41e2['id']});}})[_0x39de('0x2b')](function(_0x48a024){logger[_0x39de('0x2c')]('[QUEUE]',JSON[_0x39de('0xd')](_0x48a024));});};exports['outbound']=function(_0x451025,_0x46aa4d,_0x4d0920,_0x474d7b,_0x3a1d87,_0x1c0243,_0x5812e6){var _0x11a5f4,_0x451e5d,_0x5bf505;_0x1c0243[_0x39de('0x80')]=intUtil[_0x39de('0x7f')](_0x1c0243[_0x39de('0x80')]);_0x1c0243[_0x39de('0x81')]=intUtil[_0x39de('0x7f')](_0x1c0243[_0x39de('0x81')]);if(_0x5812e6&&_0x5812e6[_0x39de('0x93')]&&_0x5812e6[_0x39de('0x93')]!==_0x39de('0x94')){logger[_0x39de('0x2e')](_0x39de('0x95'),'Recording\x20is\x20enabled!');_0x46aa4d[_0x39de('0x84')]=_0x1c0243['serverUrl']+_0x39de('0x85')+_0x46aa4d['uniqueid']+_0x39de('0x87')+md5(_0x46aa4d[_0x39de('0x86')]);}var _0x564d6d=_0x1c0243[_0x39de('0x80')]===_0x39de('0x88')?'eu':_0x39de('0x89');return getAccessToken(_0x1c0243)[_0x39de('0x29')](function(_0x4ab7ee){_0x5bf505=_0x4ab7ee;return getUser(_0x5bf505,_0x564d6d,_0x1c0243,_0x474d7b[_0x39de('0x37')]);})[_0x39de('0x29')](function(_0x6acc5c){_0x11a5f4=_0x6acc5c;logger['info'](_0x39de('0x8a'),_0x11a5f4['id']);return getEndUser(_0x5bf505,_0x564d6d,_0x1c0243,_0x46aa4d[_0x39de('0x96')],_0x46aa4d[_0x39de('0x97')],_0x11a5f4,_0x4d0920);})[_0x39de('0x29')](function(_0x159189){_0x451e5d=_0x159189;return getCall(_0x5bf505,_0x564d6d,_0x1c0243,_0x11a5f4,_0x451e5d,_0x4d0920,_0x46aa4d,_0x39de('0x98'));})['then'](function(_0x57f085){if(_0x57f085){logger[_0x39de('0x2e')](_0x39de('0x8d'),_0x57f085['id']);logger[_0x39de('0x2e')](_0x39de('0x95'),_0x39de('0x8f'));emit(util[_0x39de('0x61')](_0x39de('0x90'),_0x474d7b[_0x39de('0x18')]),_0x39de('0x99'),{'uri':_0x39de('0x91')+_0x1c0243[_0x39de('0x80')]+_0x39de('0x92')+_0x57f085['id']});}})[_0x39de('0x2b')](function(_0x33ab49){logger[_0x39de('0x2c')](_0x39de('0x95'),JSON[_0x39de('0xd')](_0x33ab49));});};exports[_0x39de('0x9a')]=function(_0x374709,_0x384206,_0x10a5a4,_0x1d5197,_0x4d360b,_0x21e284){var _0x5331eb,_0x20696e,_0x21ba5e;_0x21e284[_0x39de('0x80')]=intUtil['stripTrailingSlash'](_0x21e284[_0x39de('0x80')]);_0x21e284['serverUrl']=intUtil[_0x39de('0x7f')](_0x21e284[_0x39de('0x81')]);if(_0x4d360b&&_0x4d360b[_0x39de('0x82')]){logger[_0x39de('0x2e')]('['+_0x384206[_0x39de('0x67')][_0x39de('0x9b')]()+']',_0x39de('0x83'));_0x384206[_0x39de('0x84')]=_0x21e284[_0x39de('0x81')]+_0x39de('0x85')+_0x384206[_0x39de('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x384206[_0x39de('0x86')]);}else{_0x384206[_0x39de('0x84')]='';}var _0x265edb=_0x21e284[_0x39de('0x80')]===_0x39de('0x88')?'eu':_0x39de('0x89');return getAccessToken(_0x21e284)['then'](function(_0x2b2dae){_0x21ba5e=_0x2b2dae;return getUser(_0x21ba5e,_0x265edb,_0x21e284);})[_0x39de('0x29')](function(_0x3e5dfa){_0x5331eb=_0x3e5dfa;logger[_0x39de('0x2e')](_0x39de('0x8a'),_0x5331eb['id']);return getEndUser(_0x21ba5e,_0x265edb,_0x21e284,_0x384206[_0x39de('0x8b')],_0x384206[_0x39de('0x8c')],_0x5331eb,_0x10a5a4);})[_0x39de('0x29')](function(_0x343ead){_0x20696e=_0x343ead;return getCall(_0x21ba5e,_0x265edb,_0x21e284,_0x5331eb,_0x20696e,_0x10a5a4,_0x384206,_0x39de('0x77'));})[_0x39de('0x29')](function(_0x1e8e2d){if(_0x1e8e2d){logger['info'](_0x39de('0x8d'),_0x1e8e2d['id']);}})['catch'](function(_0x44a809){logger[_0x39de('0x2c')]('['+_0x384206[_0x39de('0x67')]['toUpperCase']()+']',JSON[_0x39de('0xd')](_0x44a809));});}; \ 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 2109340..7e4360d 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 _0x5927=['%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x36576b,_0x46285f){var _0x3ec36f=function(_0x20971f){while(--_0x20971f){_0x36576b['push'](_0x36576b['shift']());}};_0x3ec36f(++_0x46285f);}(_0x5927,0xef));var _0x7592=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0x5927[_0x17fea7];return _0x3150c3;};'use strict';var util=require(_0x7592('0x0'));var sh=require(_0x7592('0x1'));var Mustache=require(_0x7592('0x2'));var logger=require(_0x7592('0x3'))(_0x7592('0x4'));exports[_0x7592('0x5')]=function(_0x444bb3,_0x97f91f){var _0x45003c=_0x444bb3[_0x7592('0x6')]?_0x444bb3['data2']:'Script';var _0x1c084e=_0x444bb3['data3']?Mustache[_0x7592('0x7')](_0x444bb3[_0x7592('0x8')],_0x97f91f):_0x97f91f;sh[_0x7592('0x5')](_0x1c084e,function(_0x23d92c,_0x21341f,_0x2119fd){if(_0x23d92c!==0x0){logger[_0x7592('0x9')](util[_0x7592('0xa')](_0x7592('0xb'),_0x45003c,_0x1c084e,_0x23d92c,_0x2119fd));}else{logger[_0x7592('0xc')](util[_0x7592('0xa')](_0x7592('0xd'),_0x45003c,_0x1c084e,_0x21341f));}});}; \ No newline at end of file +var _0xa26d=['format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','../../../../config/logger','exec','data2','Script','data3','render'];(function(_0xa81ad1,_0x3c10b8){var _0xb9d9f=function(_0x20f06a){while(--_0x20f06a){_0xa81ad1['push'](_0xa81ad1['shift']());}};_0xb9d9f(++_0x3c10b8);}(_0xa26d,0x14f));var _0xda26=function(_0x15c692,_0x414976){_0x15c692=_0x15c692-0x0;var _0x39abf4=_0xa26d[_0x15c692];return _0x39abf4;};'use strict';var util=require('util');var sh=require(_0xda26('0x0'));var Mustache=require('mustache');var logger=require(_0xda26('0x1'))('trigger');exports[_0xda26('0x2')]=function(_0x3d9f3e,_0x209506){var _0x4a6193=_0x3d9f3e[_0xda26('0x3')]?_0x3d9f3e[_0xda26('0x3')]:_0xda26('0x4');var _0x261e4e=_0x3d9f3e[_0xda26('0x5')]?Mustache[_0xda26('0x6')](_0x3d9f3e[_0xda26('0x5')],_0x209506):_0x209506;sh[_0xda26('0x2')](_0x261e4e,function(_0x33b46d,_0x33bc66,_0x5d6da1){if(_0x33b46d!==0x0){logger['error'](util[_0xda26('0x7')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4a6193,_0x261e4e,_0x33b46d,_0x5d6da1));}else{logger['info'](util['format'](_0xda26('0x8'),_0x4a6193,_0x261e4e,_0x33bc66));}});}; \ 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 942f283..4a6f22d 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 _0x8279=['format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data2','data5','headers','data6','parse','error','GET','POST','PUT','data7','stack','body','info'];(function(_0x3a6b11,_0x274c1e){var _0x149496=function(_0x19bba5){while(--_0x19bba5){_0x3a6b11['push'](_0x3a6b11['shift']());}};_0x149496(++_0x274c1e);}(_0x8279,0xab));var _0x9827=function(_0x2bf00b,_0xc27791){_0x2bf00b=_0x2bf00b-0x0;var _0x1bc255=_0x8279[_0x2bf00b];return _0x1bc255;};'use strict';var rp=require('request-promise');var util=require(_0x9827('0x0'));var _=require(_0x9827('0x1'));var Mustache=require(_0x9827('0x2'));var logger=require(_0x9827('0x3'))(_0x9827('0x4'));exports['exec']=function(_0xa61f80,_0x2c6281){var _0x4d5d97,_0x1e6e56;var _0x4bcb6f={'method':_0xa61f80[_0x9827('0x5')][_0x9827('0x6')](),'uri':Mustache[_0x9827('0x7')](_0xa61f80[_0x9827('0x8')],_0x2c6281),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xa61f80[_0x9827('0x9')])==='number'&&parseInt(_0xa61f80[_0x9827('0x9')])>=0x1&&parseInt(_0xa61f80['data5'])<=0xa?parseInt(_0xa61f80[_0x9827('0x9')])*0x3e8:0x5*0x3e8};try{_0x4bcb6f[_0x9827('0xa')]=_0xa61f80[_0x9827('0xb')]?JSON[_0x9827('0xc')](Mustache['render'](_0xa61f80[_0x9827('0xb')],_0x2c6281)):{};}catch(_0x3bceb8){logger[_0x9827('0xd')](_0x3bceb8['stack']);}switch(_0xa61f80[_0x9827('0x5')]['toUpperCase']()){case _0x9827('0xe'):case'DELETE':_0x4d5d97=null;_0x4bcb6f['qs']=_0x2c6281;break;case _0x9827('0xf'):case _0x9827('0x10'):if(_0xa61f80[_0x9827('0x11')]){try{_0x4d5d97=JSON[_0x9827('0xc')](Mustache[_0x9827('0x7')](_0xa61f80['data7'],_0x2c6281));_0x4bcb6f['body']=_0x4d5d97;}catch(_0x166d66){logger[_0x9827('0xd')](_0x166d66[_0x9827('0x12')]);logger[_0x9827('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4d5d97=_0x2c6281;_0x4bcb6f[_0x9827('0x13')]=_0x4d5d97;}break;}logger[_0x9827('0x14')](util[_0x9827('0x15')](_0x9827('0x16'),_0xa61f80['data1'],_0xa61f80[_0x9827('0x8')],JSON[_0x9827('0x17')](_0x4bcb6f)));rp(_0x4bcb6f)[_0x9827('0x18')](function(_0x1feba5){_0x4d5d97=!_[_0x9827('0x19')](_0x4d5d97)?_0x9827('0x1a')+_0x4d5d97:'';_0x1e6e56=typeof _0x1feba5[_0x9827('0x13')]===_0x9827('0x1b')?JSON[_0x9827('0x17')](_0x1feba5[_0x9827('0x13')]):_0x1feba5[_0x9827('0x13')];logger[_0x9827('0x14')](util[_0x9827('0x15')](_0x9827('0x1c'),_0xa61f80[_0x9827('0x5')],_0xa61f80[_0x9827('0x8')],_0x1feba5['statusCode'],_0x1e6e56));})[_0x9827('0x1d')](function(_0x4f976d){logger[_0x9827('0xd')](util[_0x9827('0x15')](_0x9827('0x1e'),_0xa61f80[_0x9827('0x5')],_0xa61f80['data2'],_0x4f976d[_0x9827('0x1f')],_0x4f976d['name'],_0x4f976d['message']));});}; \ No newline at end of file +var _0x491a=['data6','data1','GET','POST','PUT','data7','parse','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','statusCode','error','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','trigger','exec','toUpperCase','render','data5','number'];(function(_0x227edb,_0x54f5d7){var _0xe0abd1=function(_0x488448){while(--_0x488448){_0x227edb['push'](_0x227edb['shift']());}};_0xe0abd1(++_0x54f5d7);}(_0x491a,0x124));var _0xa491=function(_0x3c4f40,_0x302e0b){_0x3c4f40=_0x3c4f40-0x0;var _0x12032f=_0x491a[_0x3c4f40];return _0x12032f;};'use strict';var rp=require(_0xa491('0x0'));var util=require('util');var _=require(_0xa491('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xa491('0x2'));exports[_0xa491('0x3')]=function(_0x43510f,_0x340479){var _0x3a2fa7,_0x5147e6;var _0xb280a4={'method':_0x43510f['data1'][_0xa491('0x4')](),'uri':Mustache[_0xa491('0x5')](_0x43510f['data2'],_0x340479),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x43510f[_0xa491('0x6')])===_0xa491('0x7')&&parseInt(_0x43510f['data5'])>=0x1&&parseInt(_0x43510f[_0xa491('0x6')])<=0xa?parseInt(_0x43510f[_0xa491('0x6')])*0x3e8:0x5*0x3e8};try{_0xb280a4['headers']=_0x43510f[_0xa491('0x8')]?JSON['parse'](Mustache['render'](_0x43510f[_0xa491('0x8')],_0x340479)):{};}catch(_0x5771f1){logger['error'](_0x5771f1['stack']);}switch(_0x43510f[_0xa491('0x9')][_0xa491('0x4')]()){case _0xa491('0xa'):case'DELETE':_0x3a2fa7=null;_0xb280a4['qs']=_0x340479;break;case _0xa491('0xb'):case _0xa491('0xc'):if(_0x43510f[_0xa491('0xd')]){try{_0x3a2fa7=JSON[_0xa491('0xe')](Mustache[_0xa491('0x5')](_0x43510f[_0xa491('0xd')],_0x340479));_0xb280a4[_0xa491('0xf')]=_0x3a2fa7;}catch(_0xa89047){logger['error'](_0xa89047[_0xa491('0x10')]);logger['error'](_0xa491('0x11'));}}else{_0x3a2fa7=_0x340479;_0xb280a4[_0xa491('0xf')]=_0x3a2fa7;}break;}logger[_0xa491('0x12')](util[_0xa491('0x13')](_0xa491('0x14'),_0x43510f[_0xa491('0x9')],_0x43510f[_0xa491('0x15')],JSON[_0xa491('0x16')](_0xb280a4)));rp(_0xb280a4)[_0xa491('0x17')](function(_0x1de759){_0x3a2fa7=!_[_0xa491('0x18')](_0x3a2fa7)?',\x20request\x20body:\x20'+_0x3a2fa7:'';_0x5147e6=typeof _0x1de759[_0xa491('0xf')]===_0xa491('0x19')?JSON[_0xa491('0x16')](_0x1de759[_0xa491('0xf')]):_0x1de759['body'];logger[_0xa491('0x12')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x43510f['data1'],_0x43510f['data2'],_0x1de759[_0xa491('0x1a')],_0x5147e6));})['catch'](function(_0x1829cc){logger[_0xa491('0x1b')](util[_0xa491('0x13')](_0xa491('0x1c'),_0x43510f['data1'],_0x43510f[_0xa491('0x15')],_0x1829cc[_0xa491('0x1a')],_0x1829cc[_0xa491('0x1d')],_0x1829cc['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f52157f..40b0dd4 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 _0xe452=['request','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing','client','http','Request'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe452,0xcc));var _0x2e45=function(_0x58e124,_0x1fcd8c){_0x58e124=_0x58e124-0x0;var _0x5f3b5d=_0xe452[_0x58e124];return _0x5f3b5d;};'use strict';var jayson=require(_0x2e45('0x0'));var BPromise=require(_0x2e45('0x1'));var logger=require('../../config/logger')(_0x2e45('0x2'));var client=jayson[_0x2e45('0x3')][_0x2e45('0x4')]({'port':0x2329});client[_0x2e45('0x5')]=function(_0x49a077,_0x17ccd3){return new BPromise(function(_0x214b70,_0x56c1f7){return client[_0x2e45('0x6')](_0x49a077,_0x17ccd3)['then'](function(_0x211fb1){logger[_0x2e45('0x7')](_0x2e45('0x8'),_0x2e45('0x2'),_0x49a077,_0x17ccd3,_0x211fb1);if(_0x211fb1['error']){logger[_0x2e45('0x9')]('rpc',_0x2e45('0x2'),_0x49a077,_0x211fb1[_0x2e45('0x9')]['message'],_0x17ccd3);return _0x56c1f7(_0x211fb1[_0x2e45('0x9')][_0x2e45('0xa')]);}else{return _0x214b70(_0x211fb1[_0x2e45('0xb')]);}})[_0x2e45('0xc')](function(_0x399813){logger[_0x2e45('0x9')](_0x2e45('0x8'),'routing',_0x49a077,_0x399813,_0x17ccd3);return _0x56c1f7(_0x399813);});});};module[_0x2e45('0xd')]=client; \ No newline at end of file +var _0x07a3=['exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','rpc','error','result','catch'];(function(_0x5bdd93,_0x208ccb){var _0x2caf5e=function(_0x3a8a9b){while(--_0x3a8a9b){_0x5bdd93['push'](_0x5bdd93['shift']());}};_0x2caf5e(++_0x208ccb);}(_0x07a3,0x11f));var _0x307a=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x07a3[_0x1ddedd];return _0xa3e1ac;};'use strict';var jayson=require(_0x307a('0x0'));var BPromise=require(_0x307a('0x1'));var logger=require(_0x307a('0x2'))(_0x307a('0x3'));var client=jayson['client'][_0x307a('0x4')]({'port':0x2329});client[_0x307a('0x5')]=function(_0x2e3eeb,_0x104f49){return new BPromise(function(_0x5860d6,_0x53aced){return client[_0x307a('0x6')](_0x2e3eeb,_0x104f49)[_0x307a('0x7')](function(_0x16ec3e){logger['debug'](_0x307a('0x8'),'routing',_0x2e3eeb,_0x104f49,_0x16ec3e);if(_0x16ec3e[_0x307a('0x9')]){logger[_0x307a('0x9')](_0x307a('0x8'),_0x307a('0x3'),_0x2e3eeb,_0x16ec3e['error']['message'],_0x104f49);return _0x53aced(_0x16ec3e[_0x307a('0x9')]['message']);}else{return _0x5860d6(_0x16ec3e[_0x307a('0xa')]);}})[_0x307a('0xb')](function(_0xb0d975){logger[_0x307a('0x9')]('rpc',_0x307a('0x3'),_0x2e3eeb,_0xb0d975,_0x104f49);return _0x53aced(_0xb0d975);});});};module[_0x307a('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1bc8add..086bb1f 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 _0x419e=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x419e,0x156));var _0xe419=function(_0xd25b59,_0x217f8a){_0xd25b59=_0xd25b59-0x0;var _0x4cab47=_0x419e[_0xd25b59];return _0x4cab47;};'use strict';var server=require(_0xe419('0x0'));var Realtime=require(_0xe419('0x1'));var EmailChannel=require(_0xe419('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xe419('0x3'));var logger=require(_0xe419('0x4'))(_0xe419('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe419('0x6')]()[_0xe419('0x7')](mailAccount[_0xe419('0x8')]())[_0xe419('0x7')](realtime[_0xe419('0x9')]())[_0xe419('0x7')](function(){email[_0xe419('0xa')](realtime[_0xe419('0xb')]);return realtime;});}function main(){return server[_0xe419('0xc')](realtime,email)[_0xe419('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0xe419('0xd')]();})['then'](function(_0x217108){return setInterval(initRealtime,_0x217108[_0xe419('0xe')]*0x3e8);})['catch'](function(_0x52d895){logger[_0xe419('0xf')](_0xe419('0x10'),_0x52d895);});}main(); \ No newline at end of file +var _0x7387=['resolve','then','getMailAccounts','refresh','listen','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0x7387,0x140));var _0x7738=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7387[_0x122ef9];return _0x42fba0;};'use strict';var server=require(_0x7738('0x0'));var Realtime=require(_0x7738('0x1'));var EmailChannel=require(_0x7738('0x2'));var mailAccount=require(_0x7738('0x3'));var setting=require(_0x7738('0x4'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7738('0x5')]()[_0x7738('0x6')](mailAccount[_0x7738('0x7')]())['then'](realtime['initMailAccounts']())[_0x7738('0x6')](function(){email[_0x7738('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x7738('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x7738('0x6')](function(){return setting['getSettings']();})[_0x7738('0x6')](function(_0x194290){return setInterval(initRealtime,_0x194290['loginMailFrequency']*0x3e8);})[_0x7738('0xa')](function(_0x507c11){logger[_0x7738('0xb')](_0x7738('0xc'),_0x507c11);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8421c3a..7723281 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 _0x2c37=['isNil','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','verifySmtp','Smtp','verified','verify','exports','lodash','bluebird','md5','ioredis','../../../config/logger','redis','defaults','socket.io-emitter','./imap','./smtp','info','mailAccounts','prototype','emit','name','key','active','Imap','status','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end','error'];(function(_0xe6b826,_0x1c2e60){var _0x41d1e4=function(_0x38a449){while(--_0x38a449){_0xe6b826['push'](_0xe6b826['shift']());}};_0x41d1e4(++_0x1c2e60);}(_0x2c37,0xb9));var _0x72c3=function(_0x440d40,_0x14b603){_0x440d40=_0x440d40-0x0;var _0x24abce=_0x2c37[_0x440d40];return _0x24abce;};'use strict';var _=require(_0x72c3('0x0'));var moment=require('moment');var BPromise=require(_0x72c3('0x1'));var md5=require(_0x72c3('0x2'));var Redis=require(_0x72c3('0x3'));var config=require('../../../config/environment');var logger=require(_0x72c3('0x4'))('email');config[_0x72c3('0x5')]=_[_0x72c3('0x6')](config[_0x72c3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x72c3('0x7'))(new Redis(config[_0x72c3('0x5')]));var EmailImap=require(_0x72c3('0x8'));var EmailSmtp=require(_0x72c3('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x547acb){logger[_0x72c3('0xa')]('start\x20email\x20channel');this[_0x72c3('0xb')]=_0x547acb[_0x72c3('0xb')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x72c3('0xc')][_0x72c3('0xd')]=function(_0x3cbac5){var _0x5f11fa=this['mailAccounts'][_0x3cbac5];var _0x25352c={'id':_0x5f11fa['id'],'name':_0x5f11fa[_0x72c3('0xe')],'key':_0x5f11fa[_0x72c3('0xf')],'active':_0x5f11fa[_0x72c3('0x10')],'Imap':{'status':_0x5f11fa[_0x72c3('0x11')][_0x72c3('0x12')],'messageStatus':_0x5f11fa[_0x72c3('0x11')]['messageStatus'],'total':_0x5f11fa[_0x72c3('0x11')][_0x72c3('0x13')]}};if(_['isNil'](md5Accounts[_0x3cbac5])){md5Accounts[_0x3cbac5]={};}var _0x19af9d=md5(JSON[_0x72c3('0x14')](_0x25352c));if(md5Accounts[_0x3cbac5][_0x72c3('0x2')]!==_0x19af9d){md5Accounts[_0x3cbac5][_0x72c3('0x2')]=_0x19af9d;io['emit'](_0x72c3('0x15'),_0x25352c);}};EmailChannel[_0x72c3('0xc')][_0x72c3('0x16')]=function(_0x4e2bcf){for(var _0x3e46ab in _0x4e2bcf){if(_0x4e2bcf[_0x72c3('0x17')](_0x3e46ab)){if(_0x4e2bcf[_0x3e46ab][_0x72c3('0x11')]&&_0x4e2bcf[_0x3e46ab][_0x72c3('0x10')]){var _0x11121c=_0x4e2bcf[_0x3e46ab][_0x72c3('0x11')];if(!_0x11121c[_0x72c3('0x18')]&&_0x4e2bcf[_0x3e46ab][_0x72c3('0x19')]!==_0x72c3('0x1a'))_0x11121c['service']=_0x4e2bcf[_0x3e46ab][_0x72c3('0x19')];if(!this[_0x72c3('0x1b')]['hasOwnProperty'](_0x11121c['id'])){this[_0x72c3('0x1b')][_0x11121c['id']]=new EmailImap(_0x11121c,_0x4e2bcf[_0x3e46ab][_0x72c3('0x1c')]);this[_0x72c3('0x1b')][_0x11121c['id']]['on'](_0x72c3('0x1d'),this[_0x72c3('0x1e')][_0x72c3('0x1f')](this,_0x3e46ab));this['imapAccounts'][_0x11121c['id']]['on']('email',this[_0x72c3('0x20')][_0x72c3('0x1f')](this,_0x3e46ab));this['imapAccounts'][_0x11121c['id']]['on'](_0x72c3('0x21'),this['handleImapEnd'][_0x72c3('0x1f')](this,_0x3e46ab));this[_0x72c3('0x1b')][_0x11121c['id']]['on'](_0x72c3('0x22'),this['handleImapError'][_0x72c3('0x1f')](this,_0x3e46ab));}}else{if(_[_0x72c3('0x23')](this[_0x72c3('0xb')][_0x3e46ab]['Imap'])){this[_0x72c3('0xb')][_0x3e46ab][_0x72c3('0x11')]={};}this['mailAccounts'][_0x3e46ab][_0x72c3('0x11')][_0x72c3('0x12')]=_0x72c3('0x24');this['mailAccounts'][_0x3e46ab][_0x72c3('0x11')][_0x72c3('0x25')]='';this[_0x72c3('0xd')](_0x3e46ab);}}}};EmailChannel['prototype'][_0x72c3('0x1e')]=function(_0x5aa3a6,_0x1e9c14){if(this[_0x72c3('0xb')][_0x5aa3a6]){this['mailAccounts'][_0x5aa3a6]['Imap'][_0x72c3('0x12')]=_0x72c3('0x26');this[_0x72c3('0xb')][_0x5aa3a6][_0x72c3('0x11')][_0x72c3('0x25')]=_0x1e9c14[_0x72c3('0xe')];if(_0x1e9c14[_0x72c3('0x27')]){this[_0x72c3('0xb')][_0x5aa3a6][_0x72c3('0x11')]['total']=_0x1e9c14[_0x72c3('0x27')][_0x72c3('0x13')];}return this[_0x72c3('0xd')](_0x5aa3a6);}};EmailChannel[_0x72c3('0xc')][_0x72c3('0x20')]=function(_0x4922ad,_0x5a796f){logger[_0x72c3('0xa')](_0x72c3('0x28'),_0x5a796f[_0x72c3('0x29')],_0x5a796f['lastName'],_0x5a796f[_0x72c3('0x2a')],_0x4922ad);if(this['mailAccounts'][_0x4922ad]){return mailAccount[_0x72c3('0x2b')](_0x4922ad,_0x5a796f)[_0x72c3('0x2c')](function(_0x3e7fa2){if(_0x3e7fa2){logger[_0x72c3('0xa')]('Mail\x20accepted\x20from\x20routing');}})[_0x72c3('0x2d')](function(_0x228f88){logger[_0x72c3('0x22')](_0x72c3('0x2e'),JSON[_0x72c3('0x14')](_0x228f88));});}};EmailChannel[_0x72c3('0xc')]['handleImapEnd']=function(_0x328756){if(this[_0x72c3('0xb')][_0x328756]&&this[_0x72c3('0xb')][_0x328756]['Imap']){if(this[_0x72c3('0x1b')][this[_0x72c3('0xb')][_0x328756][_0x72c3('0x11')]['id']]){delete this['imapAccounts'][this[_0x72c3('0xb')][_0x328756][_0x72c3('0x11')]['id']];}this['mailAccounts'][_0x328756][_0x72c3('0x11')][_0x72c3('0x2f')]=moment();this[_0x72c3('0xd')](_0x328756);}};EmailChannel['prototype']['handleImapError']=function(_0x1791d7,_0x3a745d){if(this[_0x72c3('0xb')][_0x1791d7]){this[_0x72c3('0xb')][_0x1791d7][_0x72c3('0x11')][_0x72c3('0x12')]=_0x72c3('0x22');this[_0x72c3('0xb')][_0x1791d7][_0x72c3('0x11')][_0x72c3('0x25')]=_0x3a745d;return this[_0x72c3('0xd')](_0x1791d7);}};EmailChannel['prototype']['sendMail']=function(_0x2ec40c,_0x4557df){return this[_0x72c3('0x30')][_0x72c3('0x31')](_0x2ec40c,_0x4557df);};EmailChannel[_0x72c3('0xc')][_0x72c3('0x32')]=function(_0x5befb7){var _0x239a1a=this;if(this[_0x72c3('0xb')][_0x5befb7['id']]){if(_['isNil'](this[_0x72c3('0xb')][_0x5befb7['id']][_0x72c3('0x33')])){this[_0x72c3('0xb')][_0x5befb7['id']]['Smtp']={};}this['mailAccounts'][_0x5befb7['id']][_0x72c3('0x33')][_0x72c3('0x2f')]=moment();return new BPromise(function(_0x540756,_0x1dfccf){return _0x239a1a[_0x72c3('0x30')]['verify'](_0x5befb7)['then'](function(_0x3b939c){_0x239a1a['mailAccounts'][_0x5befb7['id']]['Smtp'][_0x72c3('0x12')]=_0x72c3('0x34');_0x239a1a[_0x72c3('0xb')][_0x5befb7['id']][_0x72c3('0x33')][_0x72c3('0x25')]='';_0x239a1a['emit'](_0x5befb7['id']);_0x540756(_0x3b939c);})[_0x72c3('0x2d')](function(_0x5ab1b9){_0x239a1a[_0x72c3('0xb')][_0x5befb7['id']]['Smtp'][_0x72c3('0x12')]='error';_0x239a1a['mailAccounts'][_0x5befb7['id']][_0x72c3('0x33')][_0x72c3('0x25')]=_0x5ab1b9;_0x239a1a[_0x72c3('0xd')](_0x5befb7['id']);_0x1dfccf(_0x5ab1b9);});});}return this[_0x72c3('0x30')][_0x72c3('0x35')](_0x5befb7);};module[_0x72c3('0x36')]=EmailChannel; \ No newline at end of file +var _0x11fa=['redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','name','Imap','isNil','stringify','emit','mailAccount:update','hasOwnProperty','active','service','provider','custom','email','bind','handleImapEmail','end','error','handleImapError','disabled','messageStatus','handleImapBox','status','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment'];(function(_0x3a9cf3,_0xb6541b){var _0x1df4a8=function(_0x3b04f0){while(--_0x3b04f0){_0x3a9cf3['push'](_0x3a9cf3['shift']());}};_0x1df4a8(++_0xb6541b);}(_0x11fa,0x189));var _0xa11f=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x11fa[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0xa11f('0x0'));var moment=require(_0xa11f('0x1'));var BPromise=require(_0xa11f('0x2'));var md5=require(_0xa11f('0x3'));var Redis=require(_0xa11f('0x4'));var config=require(_0xa11f('0x5'));var logger=require('../../../config/logger')('email');config[_0xa11f('0x6')]=_[_0xa11f('0x7')](config[_0xa11f('0x6')],{'host':_0xa11f('0x8'),'port':0x18eb});var io=require(_0xa11f('0x9'))(new Redis(config[_0xa11f('0x6')]));var EmailImap=require(_0xa11f('0xa'));var EmailSmtp=require(_0xa11f('0xb'));var mailAccount=require(_0xa11f('0xc'));var md5Accounts={};function EmailChannel(_0x26bb2c){logger[_0xa11f('0xd')]('start\x20email\x20channel');this[_0xa11f('0xe')]=_0x26bb2c['mailAccounts'];this[_0xa11f('0xf')]={};this[_0xa11f('0x10')]=new EmailSmtp();}EmailChannel[_0xa11f('0x11')]['emit']=function(_0x2e750a){var _0xc76654=this[_0xa11f('0xe')][_0x2e750a];var _0x5a5e08={'id':_0xc76654['id'],'name':_0xc76654[_0xa11f('0x12')],'key':_0xc76654['key'],'active':_0xc76654['active'],'Imap':{'status':_0xc76654[_0xa11f('0x13')]['status'],'messageStatus':_0xc76654[_0xa11f('0x13')]['messageStatus'],'total':_0xc76654[_0xa11f('0x13')]['total']}};if(_[_0xa11f('0x14')](md5Accounts[_0x2e750a])){md5Accounts[_0x2e750a]={};}var _0x46494b=md5(JSON[_0xa11f('0x15')](_0x5a5e08));if(md5Accounts[_0x2e750a][_0xa11f('0x3')]!==_0x46494b){md5Accounts[_0x2e750a]['md5']=_0x46494b;io[_0xa11f('0x16')](_0xa11f('0x17'),_0x5a5e08);}};EmailChannel[_0xa11f('0x11')]['refresh']=function(_0x5143cd){for(var _0x1b2068 in _0x5143cd){if(_0x5143cd[_0xa11f('0x18')](_0x1b2068)){if(_0x5143cd[_0x1b2068]['Imap']&&_0x5143cd[_0x1b2068][_0xa11f('0x19')]){var _0x14be8f=_0x5143cd[_0x1b2068][_0xa11f('0x13')];if(!_0x14be8f[_0xa11f('0x1a')]&&_0x5143cd[_0x1b2068][_0xa11f('0x1b')]!==_0xa11f('0x1c'))_0x14be8f[_0xa11f('0x1a')]=_0x5143cd[_0x1b2068][_0xa11f('0x1b')];if(!this[_0xa11f('0xf')][_0xa11f('0x18')](_0x14be8f['id'])){this[_0xa11f('0xf')][_0x14be8f['id']]=new EmailImap(_0x14be8f,_0x5143cd[_0x1b2068][_0xa11f('0x1d')]);this[_0xa11f('0xf')][_0x14be8f['id']]['on']('box',this['handleImapBox'][_0xa11f('0x1e')](this,_0x1b2068));this['imapAccounts'][_0x14be8f['id']]['on'](_0xa11f('0x1d'),this[_0xa11f('0x1f')]['bind'](this,_0x1b2068));this['imapAccounts'][_0x14be8f['id']]['on'](_0xa11f('0x20'),this['handleImapEnd'][_0xa11f('0x1e')](this,_0x1b2068));this['imapAccounts'][_0x14be8f['id']]['on'](_0xa11f('0x21'),this[_0xa11f('0x22')][_0xa11f('0x1e')](this,_0x1b2068));}}else{if(_[_0xa11f('0x14')](this[_0xa11f('0xe')][_0x1b2068][_0xa11f('0x13')])){this[_0xa11f('0xe')][_0x1b2068]['Imap']={};}this[_0xa11f('0xe')][_0x1b2068]['Imap']['status']=_0xa11f('0x23');this[_0xa11f('0xe')][_0x1b2068][_0xa11f('0x13')][_0xa11f('0x24')]='';this['emit'](_0x1b2068);}}}};EmailChannel[_0xa11f('0x11')][_0xa11f('0x25')]=function(_0x5710ec,_0x2ba5b1){if(this[_0xa11f('0xe')][_0x5710ec]){this[_0xa11f('0xe')][_0x5710ec]['Imap'][_0xa11f('0x26')]=_0xa11f('0x27');this[_0xa11f('0xe')][_0x5710ec][_0xa11f('0x13')][_0xa11f('0x24')]=_0x2ba5b1[_0xa11f('0x12')];if(_0x2ba5b1['messages']){this[_0xa11f('0xe')][_0x5710ec][_0xa11f('0x13')]['total']=_0x2ba5b1[_0xa11f('0x28')][_0xa11f('0x29')];}return this[_0xa11f('0x16')](_0x5710ec);}};EmailChannel[_0xa11f('0x11')][_0xa11f('0x1f')]=function(_0x2ebef8,_0x13c629){logger['info'](_0xa11f('0x2a'),_0x13c629[_0xa11f('0x2b')],_0x13c629[_0xa11f('0x2c')],_0x13c629[_0xa11f('0x2d')],_0x2ebef8);if(this[_0xa11f('0xe')][_0x2ebef8]){return mailAccount['notify'](_0x2ebef8,_0x13c629)[_0xa11f('0x2e')](function(_0x21c133){if(_0x21c133){logger[_0xa11f('0xd')](_0xa11f('0x2f'));}})[_0xa11f('0x30')](function(_0x3bcace){logger[_0xa11f('0x21')](_0xa11f('0x31'),JSON[_0xa11f('0x15')](_0x3bcace));});}};EmailChannel[_0xa11f('0x11')]['handleImapEnd']=function(_0x4b8a12){if(this['mailAccounts'][_0x4b8a12]&&this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')]){if(this[_0xa11f('0xf')][this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')]['id']]){delete this[_0xa11f('0xf')][this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')]['id']];}this[_0xa11f('0xe')][_0x4b8a12][_0xa11f('0x13')][_0xa11f('0x32')]=moment();this[_0xa11f('0x16')](_0x4b8a12);}};EmailChannel[_0xa11f('0x11')]['handleImapError']=function(_0x496885,_0x18edc0){if(this[_0xa11f('0xe')][_0x496885]){this[_0xa11f('0xe')][_0x496885]['Imap'][_0xa11f('0x26')]=_0xa11f('0x21');this[_0xa11f('0xe')][_0x496885][_0xa11f('0x13')][_0xa11f('0x24')]=_0x18edc0;return this[_0xa11f('0x16')](_0x496885);}};EmailChannel[_0xa11f('0x11')][_0xa11f('0x33')]=function(_0x124715,_0x21d1cb){return this[_0xa11f('0x10')][_0xa11f('0x34')](_0x124715,_0x21d1cb);};EmailChannel[_0xa11f('0x11')][_0xa11f('0x35')]=function(_0x1d1176){var _0x376c8e=this;if(this['mailAccounts'][_0x1d1176['id']]){if(_['isNil'](this[_0xa11f('0xe')][_0x1d1176['id']]['Smtp'])){this[_0xa11f('0xe')][_0x1d1176['id']]['Smtp']={};}this[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x32')]=moment();return new BPromise(function(_0x36964b,_0x1cf10a){return _0x376c8e[_0xa11f('0x10')][_0xa11f('0x37')](_0x1d1176)[_0xa11f('0x2e')](function(_0x53e9ff){_0x376c8e[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x26')]='verified';_0x376c8e[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x24')]='';_0x376c8e['emit'](_0x1d1176['id']);_0x36964b(_0x53e9ff);})[_0xa11f('0x30')](function(_0x5557cb){_0x376c8e[_0xa11f('0xe')][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x26')]=_0xa11f('0x21');_0x376c8e['mailAccounts'][_0x1d1176['id']][_0xa11f('0x36')][_0xa11f('0x24')]=_0x5557cb;_0x376c8e[_0xa11f('0x16')](_0x1d1176['id']);_0x1cf10a(_0x5557cb);});});}return this[_0xa11f('0x10')]['verify'](_0x1d1176);};module[_0xa11f('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index bca6177..b9d30c0 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 _0xe62b=['password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageBody','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','email','mailbox','account','once','bind','end','handleEnd','error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5'];(function(_0x2c15fa,_0x3b91b4){var _0x3727cd=function(_0x1b04e2){while(--_0x1b04e2){_0x2c15fa['push'](_0x2c15fa['shift']());}};_0x3727cd(++_0x3b91b4);}(_0xe62b,0x180));var _0xbe62=function(_0x517ad3,_0x6181f5){_0x517ad3=_0x517ad3-0x0;var _0x4dbff4=_0xe62b[_0x517ad3];return _0x4dbff4;};'use strict';var _=require(_0xbe62('0x0'));var util=require('util');var Imap=require(_0xbe62('0x1'));var simpleParser=require(_0xbe62('0x2'))[_0xbe62('0x3')];var Iconv=require(_0xbe62('0x4'))['Iconv'];var EventEmitter=require(_0xbe62('0x5'))[_0xbe62('0x6')];var utils=require(_0xbe62('0x7'));var logger=require('../../../config/logger')(_0xbe62('0x8'));function EmailImap(_0x163b9c,_0x4afc7a){this[_0xbe62('0x9')]=_0x163b9c['mailbox'];this[_0xbe62('0xa')]=this['getAccount'](_0x163b9c,_0x4afc7a);this[_0xbe62('0x1')]=new Imap(this['account']);this[_0xbe62('0x1')][_0xbe62('0xb')]('ready',this['handleReady'][_0xbe62('0xc')](this));this[_0xbe62('0x1')]['once'](_0xbe62('0xd'),this[_0xbe62('0xe')][_0xbe62('0xc')](this));this[_0xbe62('0x1')]['on'](_0xbe62('0xf'),this[_0xbe62('0x10')][_0xbe62('0xc')](this));this[_0xbe62('0x1')][_0xbe62('0x11')]();}util[_0xbe62('0x12')](EmailImap,EventEmitter);EmailImap[_0xbe62('0x13')][_0xbe62('0x14')]=function(_0xfbd8ce,_0x2d7f68){var _0x4a7af7={'connTimeout':_0xfbd8ce[_0xbe62('0x15')]?_0xfbd8ce[_0xbe62('0x15')]*0x3e8:0x2710,'authTimeout':_0xfbd8ce[_0xbe62('0x16')]?_0xfbd8ce['authTimeout']*0x3e8:0x1388};if(_0xfbd8ce[_0xbe62('0x17')]){_0x4a7af7[_0xbe62('0x18')]=_0xfbd8ce[_0xbe62('0x18')];if(_0xfbd8ce[_0xbe62('0x19')]){_0x4a7af7[_0xbe62('0x1a')]=utils[_0xbe62('0x1b')](_0xfbd8ce['CloudProvider'][_0xbe62('0x1c')],_0xfbd8ce[_0xbe62('0x18')]);}else{_0x4a7af7[_0xbe62('0x1d')]=_0xfbd8ce['password'];}}else{if(_0xfbd8ce[_0xbe62('0x1e')]){_0x4a7af7[_0xbe62('0x18')]=_0xfbd8ce[_0xbe62('0x18')];_0x4a7af7[_0xbe62('0x1d')]=_0xfbd8ce['password'];}}_0x4a7af7['email']=_0x2d7f68||_0xfbd8ce[_0xbe62('0x18')]||_0xbe62('0x1f');_0x4a7af7['host']=_0xfbd8ce[_0xbe62('0x20')];_0x4a7af7[_0xbe62('0x21')]=_0xfbd8ce[_0xbe62('0x21')]||0x3e1;if(_0xfbd8ce[_0xbe62('0x22')]){_0x4a7af7['tls']=!![];}else{_0x4a7af7[_0xbe62('0x22')]=![];_0x4a7af7[_0xbe62('0x23')]=_0xbe62('0x24');}return _0x4a7af7;};EmailImap[_0xbe62('0x13')]['handleReady']=function(){this[_0xbe62('0x1')][_0xbe62('0x25')](this[_0xbe62('0x9')],![],this['handleOpenBox'][_0xbe62('0xc')](this));};EmailImap['prototype'][_0xbe62('0x26')]=function(_0x283dcd,_0x109f3b){if(_0x283dcd){this[_0xbe62('0x10')](_0x283dcd,!![]);}else{this[_0xbe62('0x27')](_0xbe62('0x28'),_0x109f3b);this[_0xbe62('0x29')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x199e30){if(_0x199e30){this['handleError'](_0x199e30,!![]);}else{this['imap'][_0xbe62('0xd')]();}};EmailImap['prototype'][_0xbe62('0x29')]=function(){this['imap'][_0xbe62('0x2a')]([_0xbe62('0x2b')],this[_0xbe62('0x2c')][_0xbe62('0xc')](this));};EmailImap[_0xbe62('0x13')]['handleReadUnseen']=function(_0x1b9e7d,_0x61cb76){if(_0x1b9e7d){this[_0xbe62('0x10')](_0x1b9e7d,!![]);}else{if(_0x61cb76['length']){try{var _0x251d4c=this[_0xbe62('0x1')][_0xbe62('0x2d')](_0x61cb76,{'bodies':'','markSeen':!![]});_0x251d4c['on']('message',this[_0xbe62('0x2e')]['bind'](this));_0x251d4c[_0xbe62('0xb')](_0xbe62('0xf'),this['handleFetchError'][_0xbe62('0xc')](this));_0x251d4c[_0xbe62('0xb')](_0xbe62('0xd'),this[_0xbe62('0x2f')][_0xbe62('0xc')](this));}catch(_0x30c5d3){logger[_0xbe62('0xf')](_0x30c5d3);}}else{this[_0xbe62('0x1')][_0xbe62('0x30')](!![],this[_0xbe62('0x31')]['bind'](this));}}};EmailImap[_0xbe62('0x13')][_0xbe62('0x2e')]=function(_0x4fb8d7){_0x4fb8d7['on'](_0xbe62('0x32'),this['handleMessageBody'][_0xbe62('0xc')](this));_0x4fb8d7['once'](_0xbe62('0x33'),this['handleMessageAttributes'][_0xbe62('0xc')](this));_0x4fb8d7[_0xbe62('0xb')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0xbe62('0x13')][_0xbe62('0x34')]=function(_0x553988){simpleParser(_0x553988,{'Iconv':Iconv},this[_0xbe62('0x35')]['bind'](this));};EmailImap[_0xbe62('0x13')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xbe62('0x13')][_0xbe62('0x35')]=function(_0x58d589,_0x4d7ac9){if(_0x58d589){logger[_0xbe62('0xf')](_0x58d589);}else{var _0x48780c=this;utils[_0xbe62('0x36')](this['account'],_0x4d7ac9,function(_0x5b5be1){_0x48780c['emit']('email',_0x5b5be1);});}};EmailImap[_0xbe62('0x13')][_0xbe62('0x2f')]=function(){this[_0xbe62('0x1')][_0xbe62('0x30')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xbe62('0x13')]['handleFetchError']=function(_0x5892cf){this[_0xbe62('0x10')](_0x5892cf);this[_0xbe62('0x1')][_0xbe62('0x30')](!![],this[_0xbe62('0x31')]['bind'](this));};EmailImap[_0xbe62('0x13')]['handleEnd']=function(){this[_0xbe62('0x27')]('end');};EmailImap[_0xbe62('0x13')][_0xbe62('0x10')]=function(_0x4388f1,_0x26b8de){logger['error'](_0xbe62('0x10'),this['account']['email'],JSON[_0xbe62('0x37')](_0x4388f1));var _0x26e425='';if(_0x4388f1){if(_0x4388f1[_0xbe62('0x38')]){_0x26e425=_0x4388f1[_0xbe62('0x38')];}else{for(var _0xc8c331 in _0x4388f1){if(_0x4388f1['hasOwnProperty'](_0xc8c331)){_0x26e425+=_[_0xbe62('0x39')](_0xc8c331)+':\x20'+_0x4388f1[_0xc8c331]+'\x0a';}}}}if(_0x26b8de){this[_0xbe62('0x1')][_0xbe62('0xd')]();}else{this[_0xbe62('0x27')]('error',_0x26e425);this[_0xbe62('0x27')](_0xbe62('0xd'));}};module[_0xbe62('0x3a')]=EmailImap; \ No newline at end of file +var _0x70e4=['error','handleError','connect','inherits','getAccount','connTimeout','authTimeout','xoauth2','generateXOAuth2Token','CloudProvider','data5','user','password','authentication','anonymous@xcally.com','host','port','tls','autotls','prototype','handleOpenBox','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchError','closeBox','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','account','ready','handleReady','once','end','handleEnd','bind'];(function(_0x4d98fe,_0x2bac74){var _0x2d9e01=function(_0x4b2be7){while(--_0x4b2be7){_0x4d98fe['push'](_0x4d98fe['shift']());}};_0x2d9e01(++_0x2bac74);}(_0x70e4,0x15d));var _0x470e=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x70e4[_0x16a223];return _0x5ded66;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var Imap=require(_0x470e('0x2'));var simpleParser=require(_0x470e('0x3'))['simpleParser'];var Iconv=require(_0x470e('0x4'))[_0x470e('0x5')];var EventEmitter=require('events')[_0x470e('0x6')];var utils=require('./utils');var logger=require(_0x470e('0x7'))(_0x470e('0x8'));function EmailImap(_0x28cde0,_0x227fcf){this['mailbox']=_0x28cde0[_0x470e('0x9')];this[_0x470e('0xa')]=this['getAccount'](_0x28cde0,_0x227fcf);this[_0x470e('0x2')]=new Imap(this[_0x470e('0xa')]);this[_0x470e('0x2')]['once'](_0x470e('0xb'),this[_0x470e('0xc')]['bind'](this));this[_0x470e('0x2')][_0x470e('0xd')](_0x470e('0xe'),this[_0x470e('0xf')][_0x470e('0x10')](this));this[_0x470e('0x2')]['on'](_0x470e('0x11'),this[_0x470e('0x12')][_0x470e('0x10')](this));this[_0x470e('0x2')][_0x470e('0x13')]();}util[_0x470e('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x470e('0x15')]=function(_0x507559,_0x559157){var _0x4ea05c={'connTimeout':_0x507559[_0x470e('0x16')]?_0x507559[_0x470e('0x16')]*0x3e8:0x2710,'authTimeout':_0x507559['authTimeout']?_0x507559[_0x470e('0x17')]*0x3e8:0x1388};if(_0x507559['service']){_0x4ea05c['user']=_0x507559['user'];if(_0x507559['modernAuthentication']){_0x4ea05c[_0x470e('0x18')]=utils[_0x470e('0x19')](_0x507559[_0x470e('0x1a')][_0x470e('0x1b')],_0x507559[_0x470e('0x1c')]);}else{_0x4ea05c[_0x470e('0x1d')]=_0x507559[_0x470e('0x1d')];}}else{if(_0x507559[_0x470e('0x1e')]){_0x4ea05c['user']=_0x507559['user'];_0x4ea05c['password']=_0x507559[_0x470e('0x1d')];}}_0x4ea05c['email']=_0x559157||_0x507559[_0x470e('0x1c')]||_0x470e('0x1f');_0x4ea05c[_0x470e('0x20')]=_0x507559[_0x470e('0x20')];_0x4ea05c[_0x470e('0x21')]=_0x507559[_0x470e('0x21')]||0x3e1;if(_0x507559['tls']){_0x4ea05c[_0x470e('0x22')]=!![];}else{_0x4ea05c['tls']=![];_0x4ea05c[_0x470e('0x23')]='required';}return _0x4ea05c;};EmailImap[_0x470e('0x24')][_0x470e('0xc')]=function(){this[_0x470e('0x2')]['openBox'](this[_0x470e('0x9')],![],this[_0x470e('0x25')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')][_0x470e('0x25')]=function(_0x1d310f,_0x4f9363){if(_0x1d310f){this['handleError'](_0x1d310f,!![]);}else{this['emit']('box',_0x4f9363);this[_0x470e('0x26')]();}};EmailImap[_0x470e('0x24')][_0x470e('0x27')]=function(_0x7f2439){if(_0x7f2439){this['handleError'](_0x7f2439,!![]);}else{this[_0x470e('0x2')][_0x470e('0xe')]();}};EmailImap[_0x470e('0x24')][_0x470e('0x26')]=function(){this[_0x470e('0x2')][_0x470e('0x28')](['UNSEEN'],this[_0x470e('0x29')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')]['handleReadUnseen']=function(_0x5ba804,_0x5dfecc){if(_0x5ba804){this['handleError'](_0x5ba804,!![]);}else{if(_0x5dfecc[_0x470e('0x2a')]){try{var _0x2b2fbe=this[_0x470e('0x2')][_0x470e('0x2b')](_0x5dfecc,{'bodies':'','markSeen':!![]});_0x2b2fbe['on'](_0x470e('0x2c'),this[_0x470e('0x2d')][_0x470e('0x10')](this));_0x2b2fbe['once']('error',this['handleFetchError']['bind'](this));_0x2b2fbe[_0x470e('0xd')](_0x470e('0xe'),this[_0x470e('0x2e')][_0x470e('0x10')](this));}catch(_0x1fb3b5){logger['error'](_0x1fb3b5);}}else{this[_0x470e('0x2')]['closeBox'](!![],this[_0x470e('0x27')][_0x470e('0x10')](this));}}};EmailImap[_0x470e('0x24')][_0x470e('0x2d')]=function(_0x2cdec6){_0x2cdec6['on'](_0x470e('0x2f'),this[_0x470e('0x30')][_0x470e('0x10')](this));_0x2cdec6['once'](_0x470e('0x31'),this[_0x470e('0x32')][_0x470e('0x10')](this));_0x2cdec6[_0x470e('0xd')]('end',this[_0x470e('0x33')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')][_0x470e('0x30')]=function(_0x171e1c){simpleParser(_0x171e1c,{'Iconv':Iconv},this[_0x470e('0x34')][_0x470e('0x10')](this));};EmailImap[_0x470e('0x24')][_0x470e('0x32')]=function(){};EmailImap[_0x470e('0x24')][_0x470e('0x33')]=function(){};EmailImap[_0x470e('0x24')][_0x470e('0x34')]=function(_0x230e56,_0x2414bb){if(_0x230e56){logger[_0x470e('0x11')](_0x230e56);}else{var _0x5087a1=this;utils[_0x470e('0x35')](this['account'],_0x2414bb,function(_0x174c93){_0x5087a1[_0x470e('0x36')](_0x470e('0x8'),_0x174c93);});}};EmailImap['prototype'][_0x470e('0x2e')]=function(){this[_0x470e('0x2')]['closeBox'](!![],this[_0x470e('0x27')]['bind'](this));};EmailImap[_0x470e('0x24')][_0x470e('0x37')]=function(_0x193e28){this[_0x470e('0x12')](_0x193e28);this[_0x470e('0x2')][_0x470e('0x38')](!![],this[_0x470e('0x27')]['bind'](this));};EmailImap[_0x470e('0x24')][_0x470e('0xf')]=function(){this[_0x470e('0x36')]('end');};EmailImap[_0x470e('0x24')][_0x470e('0x12')]=function(_0x4920b1,_0x447f38){logger['error'](_0x470e('0x12'),this[_0x470e('0xa')][_0x470e('0x8')],JSON['stringify'](_0x4920b1));var _0x41e53a='';if(_0x4920b1){if(_0x4920b1[_0x470e('0x39')]){_0x41e53a=_0x4920b1['textCode'];}else{for(var _0x17e92e in _0x4920b1){if(_0x4920b1[_0x470e('0x3a')](_0x17e92e)){_0x41e53a+=_[_0x470e('0x3b')](_0x17e92e)+':\x20'+_0x4920b1[_0x17e92e]+'\x0a';}}}}if(_0x447f38){this[_0x470e('0x2')]['end']();}else{this[_0x470e('0x36')](_0x470e('0x11'),_0x41e53a);this[_0x470e('0x36')](_0x470e('0xe'));}};module[_0x470e('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8234d5d..d22463f 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 _0x4c37=['toString','prototype','verify','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','sendMail'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0x4c37,0x67));var _0x74c3=function(_0x43eace,_0x3a3132){_0x43eace=_0x43eace-0x0;var _0x504ce8=_0x4c37[_0x43eace];return _0x504ce8;};'use strict';var nodemailer=require(_0x74c3('0x0'));var inlineBase64=require(_0x74c3('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x74c3('0x2')]=function(_0x1eba76,_0x1fbb32){return new Promise(function(_0x67e5bd,_0x34925a){var _0x1df83e=nodemailer[_0x74c3('0x3')](_0x1eba76);_0x1df83e[_0x74c3('0x4')](_0x74c3('0x5'),inlineBase64());_0x1df83e[_0x74c3('0x6')](_0x1fbb32,function(_0x512508,_0x45b04a){if(_0x512508){_0x34925a(_0x512508[_0x74c3('0x7')]());}else{_0x67e5bd(_0x45b04a);}});});};EmailSmtp[_0x74c3('0x8')][_0x74c3('0x9')]=function(_0x4aebf8){return new Promise(function(_0x36ba97,_0x475452){var _0x3ccaac=nodemailer[_0x74c3('0x3')](_0x4aebf8);_0x3ccaac[_0x74c3('0x9')](function(_0x1860a1,_0x401e53){if(_0x1860a1){_0x475452(_0x1860a1['toString']());}else{if(_0x401e53){_0x36ba97(_0x401e53);}else{_0x475452('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x5047=['prototype','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','toString'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5047,0x10b));var _0x7504=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x5047[_0x2c96f6];return _0x6d4808;};'use strict';var nodemailer=require(_0x7504('0x0'));var inlineBase64=require(_0x7504('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x7504('0x2')]=function(_0xa344db,_0x41e920){return new Promise(function(_0x952637,_0x167435){var _0x46875b=nodemailer[_0x7504('0x3')](_0xa344db);_0x46875b['use']('compile',inlineBase64());_0x46875b['sendMail'](_0x41e920,function(_0x3e619f,_0x22dbac){if(_0x3e619f){_0x167435(_0x3e619f[_0x7504('0x4')]());}else{_0x952637(_0x22dbac);}});});};EmailSmtp[_0x7504('0x5')][_0x7504('0x6')]=function(_0x2e4767){return new Promise(function(_0x16508d,_0x32c2f8){var _0x2c18a8=nodemailer[_0x7504('0x3')](_0x2e4767);_0x2c18a8['verify'](function(_0x21ef3c,_0x50eb3a){if(_0x21ef3c){_0x32c2f8(_0x21ef3c[_0x7504('0x4')]());}else{if(_0x50eb3a){_0x16508d(_0x50eb3a);}else{_0x32c2f8(_0x7504('0x7'));}}});});};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 83e3c22..9043a6e 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 _0x1aa0=['format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','push','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','originTo','message','originCc','email','bcc','attach','type','attachment-','%s-%s','now','join','root','writeFileSync','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','date'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x1aa0,0xff));var _0x01aa=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x1aa0[_0x1551af];return _0xd8eb82;};'use strict';var _=require(_0x01aa('0x0'));var moment=require(_0x01aa('0x1'));var random=require(_0x01aa('0x2'));var fs=require('fs');var path=require(_0x01aa('0x3'));var util=require(_0x01aa('0x4'));var tnef=require(_0x01aa('0x5'));var logger=require(_0x01aa('0x6'))('email');var config=require(_0x01aa('0x7'));function getAddress(_0x29873c){var _0x473024=_[_0x01aa('0x8')](_0x29873c[_0x01aa('0x9')]);return _0x473024&&_0x473024[_0x01aa('0xa')]?_0x473024[_0x01aa('0xa')]:_0x01aa('0xb')+random['generate'](0x6)+_0x01aa('0xc');}function getFirstName(_0x275cda){var _0x5ec8ed=_[_0x01aa('0x8')](_0x275cda['value']);if(_0x5ec8ed&&_0x5ec8ed[_0x01aa('0xd')]){if(_0x5ec8ed[_0x01aa('0xd')]==_0x5ec8ed[_0x01aa('0xa')]){return _0x5ec8ed[_0x01aa('0xd')][_0x01aa('0xe')](0x0,_0x5ec8ed['name'][_0x01aa('0xf')]('@'));}var _0x56ed32=_0x5ec8ed[_0x01aa('0xd')][_0x01aa('0x10')](/\s+/);return _0x56ed32[_0x01aa('0x11')]>0x1?_0x56ed32[_0x01aa('0x12')](0x0,-0x1)['join']('\x20'):_0x5ec8ed[_0x01aa('0xd')];}return _0x01aa('0x13');}function getLastName(_0x3d7085){var _0x2f1f62=_[_0x01aa('0x8')](_0x3d7085[_0x01aa('0x9')]);if(_0x2f1f62&&_0x2f1f62[_0x01aa('0xd')]){var _0x2c6c65=_0x2f1f62[_0x01aa('0xd')]['split'](/\s+/);return _0x2c6c65[_0x01aa('0x11')]>0x1?_0x2c6c65[_0x01aa('0x14')]():'';}return'';}function getMails(_0x20ad9e,_0x2babe9){var _0x21785f='';for(var _0x579b1a=0x0;_0x579b1a<_0x2babe9['value']['length'];_0x579b1a+=0x1){if(_0x2babe9[_0x01aa('0x9')][_0x579b1a][_0x01aa('0xa')]!==_0x20ad9e){if(!_[_0x01aa('0x15')](_0x21785f)){_0x21785f+=',';}_0x21785f+=_0x2babe9['value'][_0x579b1a][_0x01aa('0xd')]||_0x2babe9[_0x01aa('0x9')][_0x579b1a][_0x01aa('0xa')]||'';_0x21785f+='\x20<';_0x21785f+=_0x2babe9[_0x01aa('0x9')][_0x579b1a]['address']?_0x2babe9[_0x01aa('0x9')][_0x579b1a][_0x01aa('0xa')]:_0x01aa('0xb')+random['generate'](0x6)+_0x01aa('0xc');_0x21785f+='>';}}return _0x21785f;}function parseEmail(_0x5e237a,_0x153b41,_0x28a85c){if(_0x153b41[_0x01aa('0x16')]){var _0x174346=/)<[^<]*)*<\/script>/gi;while(_0x174346[_0x01aa('0x17')](_0x153b41[_0x01aa('0x16')])){_0x153b41[_0x01aa('0x16')]=_0x153b41['html']['replace'](_0x174346,'');}if(_0x153b41[_0x01aa('0x16')][_0x01aa('0x18')](_0x01aa('0x19'))){var _0xee7b8e=[];_0x153b41[_0x01aa('0x1a')][_0x01aa('0x1b')](_0x489608=>{_0xee7b8e['push'](_0x489608[_0x01aa('0x1c')]);});var _0x26ca28=/]+>/g;var _0x8f10fd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x19e65f=_0x153b41[_0x01aa('0x16')]['replace'](_0x8f10fd,_0x01aa('0x1d'));var _0x487de6=_0x19e65f[_0x01aa('0x1e')](_0x26ca28,_0x01aa('0x1f'));for(let _0x32008f=0x0;_0x32008f<_0xee7b8e[_0x01aa('0x11')];_0x32008f++){var _0x1eeba1=_0x487de6['replace'](_0x01aa('0x1f'),_0x01aa('0x20')+_0xee7b8e[_0x32008f]+_0x01aa('0x21'));_0x487de6=_0x1eeba1;}_0x153b41[_0x01aa('0x16')]=_0x487de6;}_0x28a85c[_0x01aa('0x22')]=_0x153b41['html'];}else{_0x28a85c[_0x01aa('0x22')]=_0x153b41[_0x01aa('0x23')];}if(_0x28a85c[_0x01aa('0x22')]){_0x28a85c[_0x01aa('0x22')]=_0x28a85c[_0x01aa('0x22')][_0x01aa('0x1e')](/0x0){var _0x50e4a9=[_0x01aa('0x33'),_0x01aa('0x34'),_0x01aa('0x35')];for(var _0x5acc63=0x0;_0x5acc63<_0x153b41['headerLines']['length'];_0x5acc63++){var _0x2126d7=_['indexOf'](_0x50e4a9,_0x153b41[_0x01aa('0x32')][_0x5acc63][_0x01aa('0x36')]);if(_0x2126d7>=0x0){_0x28a85c[_0x01aa('0x37')]=!![];}}}return _0x28a85c;}exports[_0x01aa('0x38')]=function(_0xb7c26c,_0x5c7ccc,_0x3e3e1b){var _0x25a85a={'from':getAddress(_0x5c7ccc[_0x01aa('0x39')]),'firstName':getFirstName(_0x5c7ccc['from']),'lastName':getLastName(_0x5c7ccc[_0x01aa('0x39')]),'mapKey':_0x01aa('0x27'),'message':{'from':getMails(_0xb7c26c[_0x01aa('0x27')],_0x5c7ccc[_0x01aa('0x39')]),'to':_0xb7c26c[_0x01aa('0x27')],'cc':'','subject':_0x5c7ccc[_0x01aa('0x3a')]||'','messageId':_0x5c7ccc[_0x01aa('0x3b')],'inReplyTo':_0x5c7ccc['inReplyTo'],'sentAt':moment(_0x5c7ccc[_0x01aa('0x3c')])[_0x01aa('0x3d')](_0x01aa('0x3e')),'attach':![],'attachments':[]}};if(!_0x5c7ccc[_0x01aa('0x16')]&&!_0x5c7ccc[_0x01aa('0x23')]){var _0x4bd9c5=_[_0x01aa('0x3f')](_0x5c7ccc[_0x01aa('0x1a')],{'contentType':_0x01aa('0x40')});if(_0x4bd9c5[_0x01aa('0x11')]){logger[_0x01aa('0x41')](util['format'](_0x01aa('0x42'),_0x5c7ccc[_0x01aa('0x3b')]));tnef[_0x01aa('0x43')](_[_0x01aa('0x44')](_0x4bd9c5)[_0x01aa('0x31')],function(_0x5f5571,_0x287348){if(_0x287348){_0x5c7ccc[_0x01aa('0x16')]=_0x287348['BodyHTML']||_0x01aa('0x45');if(_0x287348[_0x01aa('0x46')]){for(var _0x263ca5=0x0;_0x263ca5<_0x287348[_0x01aa('0x46')]['length'];_0x263ca5++){var _0x34f0ec=_0x287348[_0x01aa('0x46')][_0x263ca5];_0x25a85a[_0x01aa('0x25')][_0x01aa('0x1a')][_0x01aa('0x47')]({'filename':_0x34f0ec[_0x01aa('0x48')],'content':Buffer['from'](_0x34f0ec[_0x01aa('0x49')])});}}}_0x3e3e1b(parseEmail(_0xb7c26c,_0x5c7ccc,_0x25a85a));});}else{_0x5c7ccc[_0x01aa('0x16')]=_0x01aa('0x45');_0x3e3e1b(parseEmail(_0xb7c26c,_0x5c7ccc,_0x25a85a));}}else{_0x3e3e1b(parseEmail(_0xb7c26c,_0x5c7ccc,_0x25a85a));}};exports['generateXOAuth2Token']=function(_0x3e7878,_0x21f946){var _0x74b068=[_0x01aa('0x4a')+(_0x21f946||''),_0x01aa('0x4b')+_0x3e7878,'',''];return Buffer['from'](_0x74b068['join'](''),_0x01aa('0x4c'))[_0x01aa('0x4d')](_0x01aa('0x4e'));}; \ No newline at end of file +var _0x3edc=['indexOf','split','length','slice','join','pop','isEmpty','html','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','toString','base64','lodash','moment','randomstring','path','node-tnef','email','../../../config/environment','head','address','anonymous','generate','value','name'];(function(_0x9353e9,_0x569417){var _0x23341e=function(_0x11bb7c){while(--_0x11bb7c){_0x9353e9['push'](_0x9353e9['shift']());}};_0x23341e(++_0x569417);}(_0x3edc,0x160));var _0xc3ed=function(_0x3e751a,_0x4804ae){_0x3e751a=_0x3e751a-0x0;var _0x1d5aa1=_0x3edc[_0x3e751a];return _0x1d5aa1;};'use strict';var _=require(_0xc3ed('0x0'));var moment=require(_0xc3ed('0x1'));var random=require(_0xc3ed('0x2'));var fs=require('fs');var path=require(_0xc3ed('0x3'));var util=require('util');var tnef=require(_0xc3ed('0x4'));var logger=require('../../../config/logger')(_0xc3ed('0x5'));var config=require(_0xc3ed('0x6'));function getAddress(_0x526d98){var _0x3f15f5=_[_0xc3ed('0x7')](_0x526d98['value']);return _0x3f15f5&&_0x3f15f5[_0xc3ed('0x8')]?_0x3f15f5[_0xc3ed('0x8')]:_0xc3ed('0x9')+random[_0xc3ed('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x2aa130){var _0x4a55c4=_[_0xc3ed('0x7')](_0x2aa130[_0xc3ed('0xb')]);if(_0x4a55c4&&_0x4a55c4[_0xc3ed('0xc')]){if(_0x4a55c4[_0xc3ed('0xc')]==_0x4a55c4['address']){return _0x4a55c4[_0xc3ed('0xc')]['substring'](0x0,_0x4a55c4[_0xc3ed('0xc')][_0xc3ed('0xd')]('@'));}var _0x348b64=_0x4a55c4[_0xc3ed('0xc')][_0xc3ed('0xe')](/\s+/);return _0x348b64[_0xc3ed('0xf')]>0x1?_0x348b64[_0xc3ed('0x10')](0x0,-0x1)[_0xc3ed('0x11')]('\x20'):_0x4a55c4[_0xc3ed('0xc')];}return'Anonymous';}function getLastName(_0x5ef050){var _0x337df8=_['head'](_0x5ef050['value']);if(_0x337df8&&_0x337df8[_0xc3ed('0xc')]){var _0x13863b=_0x337df8[_0xc3ed('0xc')][_0xc3ed('0xe')](/\s+/);return _0x13863b[_0xc3ed('0xf')]>0x1?_0x13863b[_0xc3ed('0x12')]():'';}return'';}function getMails(_0x442337,_0x2fb91f){var _0x4a42b1='';for(var _0x1c404c=0x0;_0x1c404c<_0x2fb91f[_0xc3ed('0xb')]['length'];_0x1c404c+=0x1){if(_0x2fb91f[_0xc3ed('0xb')][_0x1c404c][_0xc3ed('0x8')]!==_0x442337){if(!_[_0xc3ed('0x13')](_0x4a42b1)){_0x4a42b1+=',';}_0x4a42b1+=_0x2fb91f[_0xc3ed('0xb')][_0x1c404c][_0xc3ed('0xc')]||_0x2fb91f[_0xc3ed('0xb')][_0x1c404c]['address']||'';_0x4a42b1+='\x20<';_0x4a42b1+=_0x2fb91f[_0xc3ed('0xb')][_0x1c404c][_0xc3ed('0x8')]?_0x2fb91f['value'][_0x1c404c][_0xc3ed('0x8')]:_0xc3ed('0x9')+random[_0xc3ed('0xa')](0x6)+'@xcally.com';_0x4a42b1+='>';}}return _0x4a42b1;}function parseEmail(_0x28983d,_0x422f6d,_0x33f7cb){if(_0x422f6d['html']){var _0x27a78d=/)<[^<]*)*<\/script>/gi;while(_0x27a78d['test'](_0x422f6d['html'])){_0x422f6d[_0xc3ed('0x14')]=_0x422f6d['html'][_0xc3ed('0x15')](_0x27a78d,'');}if(_0x422f6d[_0xc3ed('0x14')]['includes'](_0xc3ed('0x16'))){var _0x309c73=[];_0x422f6d[_0xc3ed('0x17')][_0xc3ed('0x18')](_0xa5d923=>{_0x309c73[_0xc3ed('0x19')](_0xa5d923['filename']);});var _0x2156d8=/]+>/g;var _0x1fa221=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1382b3=_0x422f6d[_0xc3ed('0x14')]['replace'](_0x1fa221,_0xc3ed('0x1a'));var _0x4a728f=_0x1382b3[_0xc3ed('0x15')](_0x2156d8,'_IMG');for(let _0x302b69=0x0;_0x302b69<_0x309c73[_0xc3ed('0xf')];_0x302b69++){var _0x52843f=_0x4a728f['replace'](_0xc3ed('0x1b'),_0xc3ed('0x1c')+_0x309c73[_0x302b69]+_0xc3ed('0x1d'));_0x4a728f=_0x52843f;}_0x422f6d[_0xc3ed('0x14')]=_0x4a728f;}_0x33f7cb[_0xc3ed('0x1e')]=_0x422f6d[_0xc3ed('0x14')];}else{_0x33f7cb[_0xc3ed('0x1e')]=_0x422f6d['textAsHtml'];}if(_0x33f7cb[_0xc3ed('0x1e')]){_0x33f7cb[_0xc3ed('0x1e')]=_0x33f7cb['body']['replace'](/0x0){var _0x404ee1=[_0xc3ed('0x30'),_0xc3ed('0x31'),_0xc3ed('0x32')];for(var _0x352eef=0x0;_0x352eef<_0x422f6d[_0xc3ed('0x2f')]['length'];_0x352eef++){var _0x1f6cc0=_[_0xc3ed('0xd')](_0x404ee1,_0x422f6d[_0xc3ed('0x2f')][_0x352eef]['line']);if(_0x1f6cc0>=0x0){_0x33f7cb[_0xc3ed('0x33')]=!![];}}}return _0x33f7cb;}exports[_0xc3ed('0x34')]=function(_0x42f51d,_0x5c40c1,_0x33b058){var _0x1a0e13={'from':getAddress(_0x5c40c1['from']),'firstName':getFirstName(_0x5c40c1[_0xc3ed('0x35')]),'lastName':getLastName(_0x5c40c1[_0xc3ed('0x35')]),'mapKey':_0xc3ed('0x5'),'message':{'from':getMails(_0x42f51d[_0xc3ed('0x5')],_0x5c40c1['from']),'to':_0x42f51d[_0xc3ed('0x5')],'cc':'','subject':_0x5c40c1[_0xc3ed('0x36')]||'','messageId':_0x5c40c1[_0xc3ed('0x37')],'inReplyTo':_0x5c40c1[_0xc3ed('0x38')],'sentAt':moment(_0x5c40c1[_0xc3ed('0x39')])[_0xc3ed('0x28')](_0xc3ed('0x3a')),'attach':![],'attachments':[]}};if(!_0x5c40c1[_0xc3ed('0x14')]&&!_0x5c40c1[_0xc3ed('0x3b')]){var _0x3d3214=_[_0xc3ed('0x3c')](_0x5c40c1[_0xc3ed('0x17')],{'contentType':_0xc3ed('0x3d')});if(_0x3d3214[_0xc3ed('0xf')]){logger['info'](util['format'](_0xc3ed('0x3e'),_0x5c40c1[_0xc3ed('0x37')]));tnef['parseBuffer'](_[_0xc3ed('0x3f')](_0x3d3214)[_0xc3ed('0x2d')],function(_0x278957,_0x5c1b69){if(_0x5c1b69){_0x5c40c1[_0xc3ed('0x14')]=_0x5c1b69[_0xc3ed('0x40')]||_0xc3ed('0x41');if(_0x5c1b69['Attachments']){for(var _0xec0eb8=0x0;_0xec0eb8<_0x5c1b69[_0xc3ed('0x42')][_0xc3ed('0xf')];_0xec0eb8++){var _0x28c00d=_0x5c1b69[_0xc3ed('0x42')][_0xec0eb8];_0x1a0e13['message']['attachments'][_0xc3ed('0x19')]({'filename':_0x28c00d[_0xc3ed('0x43')],'content':Buffer['from'](_0x28c00d[_0xc3ed('0x44')])});}}}_0x33b058(parseEmail(_0x42f51d,_0x5c40c1,_0x1a0e13));});}else{_0x5c40c1[_0xc3ed('0x14')]=_0xc3ed('0x41');_0x33b058(parseEmail(_0x42f51d,_0x5c40c1,_0x1a0e13));}}else{_0x33b058(parseEmail(_0x42f51d,_0x5c40c1,_0x1a0e13));}};exports[_0xc3ed('0x45')]=function(_0x5ddcc8,_0x231a09){var _0x31e63a=[_0xc3ed('0x46')+(_0x231a09||''),'auth=Bearer\x20'+_0x5ddcc8,'',''];return Buffer[_0xc3ed('0x35')](_0x31e63a['join'](''),'utf-8')[_0xc3ed('0x47')](_0xc3ed('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6b36aef..14b279a 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 _0x0a7d=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x5c25ed,_0x270687){var _0x350217=function(_0x9e7dcc){while(--_0x9e7dcc){_0x5c25ed['push'](_0x5c25ed['shift']());}};_0x350217(++_0x270687);}(_0x0a7d,0x107));var _0xd0a7=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x0a7d[_0xd1b4d7];return _0x3002ec;};'use strict';var _=require(_0xd0a7('0x0'));function MailAccount(_0x3f44ca){this['id']=_0x3f44ca['id']||0x0;this[_0xd0a7('0x1')]=_0x3f44ca['name']||_0xd0a7('0x2');this[_0xd0a7('0x3')]=_0x3f44ca[_0xd0a7('0x3')]||_0xd0a7('0x4');this[_0xd0a7('0x5')]=_0x3f44ca['active']||![];this['Imap']=_0x3f44ca[_0xd0a7('0x6')]||[];this[_0xd0a7('0x7')]=_0x3f44ca[_0xd0a7('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xa7c6=['key','SERV','active','Imap','Smtp','exports','name','Service'];(function(_0x51c211,_0x1d7385){var _0x35a5a5=function(_0x37eca3){while(--_0x37eca3){_0x51c211['push'](_0x51c211['shift']());}};_0x35a5a5(++_0x1d7385);}(_0xa7c6,0x9e));var _0x6a7c=function(_0x45d920,_0x5d4b26){_0x45d920=_0x45d920-0x0;var _0x5c8138=_0xa7c6[_0x45d920];return _0x5c8138;};'use strict';var _=require('lodash');function MailAccount(_0x20f93a){this['id']=_0x20f93a['id']||0x0;this[_0x6a7c('0x0')]=_0x20f93a[_0x6a7c('0x0')]||_0x6a7c('0x1');this['key']=_0x20f93a[_0x6a7c('0x2')]||_0x6a7c('0x3');this[_0x6a7c('0x4')]=_0x20f93a[_0x6a7c('0x4')]||![];this['Imap']=_0x20f93a[_0x6a7c('0x5')]||[];this[_0x6a7c('0x6')]=_0x20f93a[_0x6a7c('0x6')]||[];}module[_0x6a7c('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 5e4c0d3..0e8daf0 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 _0xceab=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xceab,0x19b));var _0xbcea=function(_0x4e0425,_0x543b2f){_0x4e0425=_0x4e0425-0x0;var _0x1cc28f=_0xceab[_0x4e0425];return _0x1cc28f;};'use strict';var _=require('lodash');var MailAccount=require(_0xbcea('0x0'));var Realtime=function(){this[_0xbcea('0x1')]={};};function freeIsNotKey(_0xf5bb1c,_0xa71e28,_0x49dcb3){var _0x2cb304=_[_0xbcea('0x2')](_0xf5bb1c,function(_0x4a409d,_0x1cf26d){return _0x4a409d[_0x49dcb3];});for(var _0x14411e in _0xa71e28){if(_0xa71e28[_0xbcea('0x3')](_0x14411e)){if(!_0x2cb304[_0x14411e]){delete _0xa71e28[_0x14411e];}}}}Realtime[_0xbcea('0x4')][_0xbcea('0x5')]=function(_0x55af33,_0x246115){for(var _0x5e7729 in _0x246115){if(_0x55af33['hasOwnProperty'](_0x5e7729)){_0x55af33[_0x5e7729]=_0x246115[_0x5e7729];}}};Realtime[_0xbcea('0x4')][_0xbcea('0x6')]=function(){var _0x8e2387=this;return function(_0x611137){if(_0x611137){freeIsNotKey(_0x611137,_0x8e2387['mailAccounts'],'id');for(var _0xb7abb=0x0,_0x2b14f5={},_0x1c4018={};_0xb7abb<_0x611137[_0xbcea('0x7')];_0xb7abb+=0x1){_0x2b14f5=_0x611137[_0xb7abb];if(_[_0xbcea('0x8')](_0x8e2387[_0xbcea('0x1')][_0x2b14f5['id']])){_0x8e2387['mailAccounts'][_0x2b14f5['id']]=new MailAccount(_0x2b14f5);}else{_['merge'](_0x8e2387['mailAccounts'][_0x2b14f5['id']],_0x2b14f5);}}}return _0x8e2387[_0xbcea('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xb8db=['prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb8db,0x1aa));var _0xbb8d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb8db[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbb8d('0x0'));var MailAccount=require(_0xbb8d('0x1'));var Realtime=function(){this[_0xbb8d('0x2')]={};};function freeIsNotKey(_0x4fc986,_0x390721,_0x315dec){var _0x336364=_[_0xbb8d('0x3')](_0x4fc986,function(_0x1141ad,_0x3523d7){return _0x1141ad[_0x315dec];});for(var _0x53c021 in _0x390721){if(_0x390721[_0xbb8d('0x4')](_0x53c021)){if(!_0x336364[_0x53c021]){delete _0x390721[_0x53c021];}}}}Realtime['prototype'][_0xbb8d('0x5')]=function(_0x39bfcc,_0x17625b){for(var _0x50226a in _0x17625b){if(_0x39bfcc[_0xbb8d('0x4')](_0x50226a)){_0x39bfcc[_0x50226a]=_0x17625b[_0x50226a];}}};Realtime[_0xbb8d('0x6')][_0xbb8d('0x7')]=function(){var _0x109207=this;return function(_0x5b79df){if(_0x5b79df){freeIsNotKey(_0x5b79df,_0x109207[_0xbb8d('0x2')],'id');for(var _0x413058=0x0,_0x8a1a6={},_0x4bec06={};_0x413058<_0x5b79df[_0xbb8d('0x8')];_0x413058+=0x1){_0x8a1a6=_0x5b79df[_0x413058];if(_[_0xbb8d('0x9')](_0x109207['mailAccounts'][_0x8a1a6['id']])){_0x109207['mailAccounts'][_0x8a1a6['id']]=new MailAccount(_0x8a1a6);}else{_[_0xbb8d('0xa')](_0x109207['mailAccounts'][_0x8a1a6['id']],_0x8a1a6);}}}return _0x109207[_0xbb8d('0x2')];};};module[_0xbb8d('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 535b7d5..284ed05 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 _0x46cb=['getMailAccounts','Request','GetMailAccount','provider','service','email','active','ListId','TemplateId','MailServerIn','CloudProvider','type','MailServerOut','Smtp','name','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x221a11,_0x6eddb3){var _0x5b4779=function(_0x34ab09){while(--_0x34ab09){_0x221a11['push'](_0x221a11['shift']());}};_0x5b4779(++_0x6eddb3);}(_0x46cb,0x84));var _0xb46c=function(_0x1c413e,_0x51788b){_0x1c413e=_0x1c413e-0x0;var _0x1d8309=_0x46cb[_0x1c413e];return _0x1d8309;};'use strict';var client=require(_0xb46c('0x0'));exports[_0xb46c('0x1')]=function(){return function(){return client[_0xb46c('0x2')](_0xb46c('0x3'),{'options':{'attributes':['id','name',_0xb46c('0x4'),_0xb46c('0x5'),_0xb46c('0x6'),_0xb46c('0x7'),'key',_0xb46c('0x8'),_0xb46c('0x9')],'raw':![],'include':[{'model':_0xb46c('0xa'),'as':'Imap','include':[{'model':_0xb46c('0xb'),'attributes':['id','name',_0xb46c('0x5'),_0xb46c('0xc'),'data5'],'as':'CloudProvider'}]},{'model':_0xb46c('0xd'),'as':_0xb46c('0xe'),'include':[{'model':_0xb46c('0xb'),'attributes':['id',_0xb46c('0xf'),_0xb46c('0x5'),_0xb46c('0xc'),'data5'],'as':_0xb46c('0xb')}]}]},'log':_0xb46c('0x10')});};};exports[_0xb46c('0x11')]=function(_0x2c288d,_0x5b69e2){return client[_0xb46c('0x2')](_0xb46c('0x12'),{'account':{'id':_0x2c288d},'body':_0x5b69e2,'log':_0xb46c('0x12')});}; \ No newline at end of file +var _0x377e=['active','key','ListId','TemplateId','MailServerIn','Imap','type','data5','Smtp','CloudProvider','getMailAccount','notify','Request','NotifyMailAccount','../client','name','provider','service','email'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x377e,0x1e9));var _0xe377=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x377e[_0x2850c0];return _0x21e830;};'use strict';var client=require(_0xe377('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0xe377('0x1'),_0xe377('0x2'),_0xe377('0x3'),_0xe377('0x4'),_0xe377('0x5'),_0xe377('0x6'),_0xe377('0x7'),_0xe377('0x8')],'raw':![],'include':[{'model':_0xe377('0x9'),'as':_0xe377('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0xe377('0x1'),'service',_0xe377('0xb'),_0xe377('0xc')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0xe377('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0xe377('0x1'),_0xe377('0x3'),_0xe377('0xb'),'data5'],'as':_0xe377('0xe')}]}]},'log':_0xe377('0xf')});};};exports[_0xe377('0x10')]=function(_0x2bdf60,_0x1abf8a){return client[_0xe377('0x11')]('NotifyMailAccount',{'account':{'id':_0x2bdf60},'body':_0x1abf8a,'log':_0xe377('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 98177aa..63835df 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 _0x209f=['Request','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x31061a,_0x5ab647){var _0x48d92a=function(_0x421130){while(--_0x421130){_0x31061a['push'](_0x31061a['shift']());}};_0x48d92a(++_0x5ab647);}(_0x209f,0xfd));var _0xf209=function(_0x3f074b,_0x4219c9){_0x3f074b=_0x3f074b-0x0;var _0x200812=_0x209f[_0x3f074b];return _0x200812;};'use strict';var client=require(_0xf209('0x0'));exports[_0xf209('0x1')]=function(){return client[_0xf209('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf209('0x3')]},'log':_0xf209('0x4')});}; \ No newline at end of file +var _0x6ac4=['Request','ShowSetting','GetSettings'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0x6ac4,0x177));var _0x46ac=function(_0x57d0ac,_0xf5f513){_0x57d0ac=_0x57d0ac-0x0;var _0x3adbb4=_0x6ac4[_0x57d0ac];return _0x3adbb4;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x46ac('0x0')](_0x46ac('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x46ac('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 55c69d1..773e9f3 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 da1c3a2..4231ffc 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 _0xee6c=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once'];(function(_0x38469e,_0x146613){var _0x59219c=function(_0x160411){while(--_0x160411){_0x38469e['push'](_0x38469e['shift']());}};_0x59219c(++_0x146613);}(_0xee6c,0x71));var _0xcee6=function(_0x2efa62,_0x52e12b){_0x2efa62=_0x2efa62-0x0;var _0x12e9c0=_0xee6c[_0x2efa62];return _0x12e9c0;};'use strict';var _=require('lodash');var http=require(_0xcee6('0x0'));var express=require('express');var sticky=require(_0xcee6('0x1'));var Redis=require('ioredis');var config=require(_0xcee6('0x2'));var app=express();var server=http[_0xcee6('0x3')](app);server[_0xcee6('0x4')]=0xdbba0;if(sticky[_0xcee6('0x5')](server,config[_0xcee6('0x6')])){var socketio=require(_0xcee6('0x7'))(server,{'transports':[_0xcee6('0x8'),_0xcee6('0x9')]});config[_0xcee6('0xa')]=_['defaults'](config['redis'],{'host':_0xcee6('0xb'),'port':0x18eb});socketio['adapter'](require(_0xcee6('0xc'))({'pubClient':new Redis(config[_0xcee6('0xa')]),'subClient':new Redis(config[_0xcee6('0xa')])}));require(_0xcee6('0xd'))[_0xcee6('0xe')]();require(_0xcee6('0xf'))['default'](socketio);require(_0xcee6('0x10'))[_0xcee6('0xe')](app);require(_0xcee6('0x11'))[_0xcee6('0xe')](app);}else{server[_0xcee6('0x12')](_0xcee6('0x13'),function(){console[_0xcee6('0x14')](_0xcee6('0x15'),config[_0xcee6('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x0853=['../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','adapter','default','../../config/express'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x0853,0x194));var _0x3085=function(_0x2e68e4,_0x288073){_0x2e68e4=_0x2e68e4-0x0;var _0x33caa2=_0x0853[_0x2e68e4];return _0x33caa2;};'use strict';var _=require(_0x3085('0x0'));var http=require(_0x3085('0x1'));var express=require('express');var sticky=require(_0x3085('0x2'));var Redis=require(_0x3085('0x3'));var config=require(_0x3085('0x4'));var app=express();var server=http[_0x3085('0x5')](app);server[_0x3085('0x6')]=0xdbba0;if(sticky[_0x3085('0x7')](server,config[_0x3085('0x8')])){var socketio=require(_0x3085('0x9'))(server,{'transports':[_0x3085('0xa'),'polling']});config[_0x3085('0xb')]=_[_0x3085('0xc')](config[_0x3085('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x3085('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x3085('0xb')]),'subClient':new Redis(config[_0x3085('0xb')])}));require('../../config/triggers')[_0x3085('0xe')]();require('../../config/socketio')[_0x3085('0xe')](socketio);require(_0x3085('0xf'))[_0x3085('0xe')](app);require(_0x3085('0x10'))[_0x3085('0xe')](app);}else{server[_0x3085('0x11')]('listening',function(){console[_0x3085('0x12')](_0x3085('0x13'),config[_0x3085('0x8')]);});}exports=module[_0x3085('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c7a4be5..069bda4 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 _0xc058=['../../config/logger','routing','client','http','Request','request','then','rpc','error','result','jayson/promise','bluebird'];(function(_0x5b55b7,_0x393df8){var _0x5da27c=function(_0x582ee0){while(--_0x582ee0){_0x5b55b7['push'](_0x5b55b7['shift']());}};_0x5da27c(++_0x393df8);}(_0xc058,0x12a));var _0x8c05=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xc058[_0x13d07a];return _0x5ee0ee;};'use strict';var jayson=require(_0x8c05('0x0'));var BPromise=require(_0x8c05('0x1'));var logger=require(_0x8c05('0x2'))(_0x8c05('0x3'));var client=jayson[_0x8c05('0x4')][_0x8c05('0x5')]({'port':0x2329});client[_0x8c05('0x6')]=function(_0x542fdc,_0x26b48e){return new BPromise(function(_0x18ab2a,_0x4db64a){return client[_0x8c05('0x7')](_0x542fdc,_0x26b48e)[_0x8c05('0x8')](function(_0xe681bb){logger['debug'](_0x8c05('0x9'),'routing',_0x542fdc,_0x26b48e,_0xe681bb);if(_0xe681bb[_0x8c05('0xa')]){logger['error']('rpc',_0x8c05('0x3'),_0x542fdc,_0xe681bb[_0x8c05('0xa')]['message'],_0x26b48e);return _0x4db64a(_0xe681bb[_0x8c05('0xa')]['message']);}else{return _0x18ab2a(_0xe681bb[_0x8c05('0xb')]);}})['catch'](function(_0x453fcc){logger[_0x8c05('0xa')](_0x8c05('0x9'),'routing',_0x542fdc,_0x453fcc,_0x26b48e);return _0x4db64a(_0x453fcc);});});};module['exports']=client; \ No newline at end of file +var _0xd854=['routing','client','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd854,0x1bf));var _0x4d85=function(_0x467093,_0x2fb2bb){_0x467093=_0x467093-0x0;var _0xb401f2=_0xd854[_0x467093];return _0xb401f2;};'use strict';var jayson=require(_0x4d85('0x0'));var BPromise=require(_0x4d85('0x1'));var logger=require(_0x4d85('0x2'))(_0x4d85('0x3'));var client=jayson[_0x4d85('0x4')]['http']({'port':0x2329});client[_0x4d85('0x5')]=function(_0x4e1956,_0x5a71a0){return new BPromise(function(_0x3a22d8,_0x2c6b54){return client[_0x4d85('0x6')](_0x4e1956,_0x5a71a0)[_0x4d85('0x7')](function(_0x528b19){logger[_0x4d85('0x8')](_0x4d85('0x9'),_0x4d85('0x3'),_0x4e1956,_0x5a71a0,_0x528b19);if(_0x528b19[_0x4d85('0xa')]){logger[_0x4d85('0xa')](_0x4d85('0x9'),'routing',_0x4e1956,_0x528b19[_0x4d85('0xa')][_0x4d85('0xb')],_0x5a71a0);return _0x2c6b54(_0x528b19[_0x4d85('0xa')][_0x4d85('0xb')]);}else{return _0x3a22d8(_0x528b19[_0x4d85('0xc')]);}})[_0x4d85('0xd')](function(_0x4a7e46){logger[_0x4d85('0xa')](_0x4d85('0x9'),'routing',_0x4e1956,_0x4a7e46,_0x5a71a0);return _0x2c6b54(_0x4a7e46);});});};module[_0x4d85('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ef41a83..60c8611 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 _0xbd38=['log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xbd38,0xe9));var _0x8bd3=function(_0xffd9e8,_0x165d2a){_0xffd9e8=_0xffd9e8-0x0;var _0x5d6c6e=_0xbd38[_0xffd9e8];return _0x5d6c6e;};'use strict';var BPromise=require(_0x8bd3('0x0'));var server=require('./server');var Realtime=require(_0x8bd3('0x1'));var user=require(_0x8bd3('0x2'));var interval=require(_0x8bd3('0x3'));var openchannelQueue=require(_0x8bd3('0x4'));var chatQueue=require(_0x8bd3('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8bd3('0x6'));var faxQueue=require(_0x8bd3('0x7'));var whatsappQueue=require(_0x8bd3('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8bd3('0x9')]()['then'](user[_0x8bd3('0xa')]())[_0x8bd3('0xb')](realtime[_0x8bd3('0xc')]())[_0x8bd3('0xb')](interval[_0x8bd3('0xd')]())['then'](realtime['initIntervals']())[_0x8bd3('0xb')](openchannelQueue[_0x8bd3('0xe')]())[_0x8bd3('0xb')](realtime[_0x8bd3('0xf')]())[_0x8bd3('0xb')](chatQueue[_0x8bd3('0x10')]())[_0x8bd3('0xb')](realtime[_0x8bd3('0x11')]())[_0x8bd3('0xb')](smsQueue[_0x8bd3('0x12')]())[_0x8bd3('0xb')](realtime[_0x8bd3('0x13')]())['then'](mailQueue[_0x8bd3('0x14')]())[_0x8bd3('0xb')](realtime[_0x8bd3('0x15')]())[_0x8bd3('0xb')](faxQueue[_0x8bd3('0x16')]())['then'](realtime[_0x8bd3('0x17')]())[_0x8bd3('0xb')](whatsappQueue[_0x8bd3('0x18')]())[_0x8bd3('0xb')](realtime[_0x8bd3('0x19')]())['then'](function(){return realtime;});}function main(){return server[_0x8bd3('0x1a')](realtime)[_0x8bd3('0xb')](function(_0x14b1fc){return initRealtime();})[_0x8bd3('0xb')](function(_0x51bb66){return setInterval(initRealtime,0x1388);})[_0x8bd3('0x1b')](function(_0x2d7ce5){console[_0x8bd3('0x1c')](_0x2d7ce5);});}main(); \ No newline at end of file +var _0xb53e=['./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0x183664,_0x235864){var _0x564963=function(_0x5c36c7){while(--_0x5c36c7){_0x183664['push'](_0x183664['shift']());}};_0x564963(++_0x235864);}(_0xb53e,0xbd));var _0xeb53=function(_0x166bd2,_0x142b0b){_0x166bd2=_0x166bd2-0x0;var _0x4da1ee=_0xb53e[_0x166bd2];return _0x4da1ee;};'use strict';var BPromise=require('bluebird');var server=require(_0xeb53('0x0'));var Realtime=require(_0xeb53('0x1'));var user=require(_0xeb53('0x2'));var interval=require(_0xeb53('0x3'));var openchannelQueue=require(_0xeb53('0x4'));var chatQueue=require(_0xeb53('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xeb53('0x6'));var faxQueue=require(_0xeb53('0x7'));var whatsappQueue=require(_0xeb53('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xeb53('0x9')]()[_0xeb53('0xa')](user[_0xeb53('0xb')]())['then'](realtime[_0xeb53('0xc')]())[_0xeb53('0xa')](interval['getIntervals']())['then'](realtime[_0xeb53('0xd')]())[_0xeb53('0xa')](openchannelQueue[_0xeb53('0xe')]())[_0xeb53('0xa')](realtime[_0xeb53('0xf')]())[_0xeb53('0xa')](chatQueue[_0xeb53('0x10')]())['then'](realtime[_0xeb53('0x11')]())[_0xeb53('0xa')](smsQueue['getSmsQueues']())['then'](realtime[_0xeb53('0x12')]())[_0xeb53('0xa')](mailQueue[_0xeb53('0x13')]())['then'](realtime[_0xeb53('0x14')]())[_0xeb53('0xa')](faxQueue[_0xeb53('0x15')]())[_0xeb53('0xa')](realtime[_0xeb53('0x16')]())[_0xeb53('0xa')](whatsappQueue[_0xeb53('0x17')]())['then'](realtime[_0xeb53('0x18')]())[_0xeb53('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x1ea8fe){return initRealtime();})[_0xeb53('0xa')](function(_0x3449cc){return setInterval(initRealtime,0x1388);})[_0xeb53('0x19')](function(_0xba5e80){console[_0xeb53('0x1a')](_0xba5e80);});}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 bd9af11..3978e7f 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x396952,_0x56b463){var _0x53d27c=function(_0xe5d83f){while(--_0xe5d83f){_0x396952['push'](_0x396952['shift']());}};_0x53d27c(++_0x56b463);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0x5fc3[_0x3fe042];return _0x7d4a1f;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x1f9a44,_0x572d0f){var _0xed2749=function(_0x39546e){while(--_0x39546e){_0x1f9a44['push'](_0x1f9a44['shift']());}};_0xed2749(++_0x572d0f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x5fc3[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3f5fdf3..de642a4 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 _0x7a96=['http','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x261962,_0x2c99e5){var _0x42d00e=function(_0x5b9a62){while(--_0x5b9a62){_0x261962['push'](_0x261962['shift']());}};_0x42d00e(++_0x2c99e5);}(_0x7a96,0x8d));var _0x67a9=function(_0x59659d,_0xb17019){_0x59659d=_0x59659d-0x0;var _0x2adbb5=_0x7a96[_0x59659d];return _0x2adbb5;};'use strict';var BPromise=require(_0x67a9('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x67a9('0x1')][_0x67a9('0x2')]({'port':0x232b});function request(_0x3d83b7,_0x3bb978){return new BPromise(function(_0x5623a8,_0x4d120f){return client[_0x67a9('0x3')](_0x3d83b7,_0x3bb978)[_0x67a9('0x4')](function(_0x29b3e3){if(_0x29b3e3[_0x67a9('0x5')]){return _0x4d120f(_0x29b3e3['error'][_0x67a9('0x6')]);}else{return _0x5623a8(_0x29b3e3[_0x67a9('0x7')]);}})[_0x67a9('0x8')](function(_0x2cc050){return _0x4d120f(_0x2cc050);});});}exports[_0x67a9('0x9')]=function(_0x206b83,_0x5e8b8d){return request(_0x67a9('0xa'),{'account':_0x206b83,'message':_0x5e8b8d});}; \ No newline at end of file +var _0x3525=['message','result','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error'];(function(_0x22146f,_0x3490c9){var _0xc35a1f=function(_0x23f3a8){while(--_0x23f3a8){_0x22146f['push'](_0x22146f['shift']());}};_0xc35a1f(++_0x3490c9);}(_0x3525,0xe0));var _0x5352=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0x3525[_0x25d6ce];return _0x1aef15;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5352('0x0'));var client=jayson[_0x5352('0x1')][_0x5352('0x2')]({'port':0x232b});function request(_0x1bc367,_0x119e5b){return new BPromise(function(_0x77109b,_0x9b1873){return client[_0x5352('0x3')](_0x1bc367,_0x119e5b)[_0x5352('0x4')](function(_0x4cff07){if(_0x4cff07[_0x5352('0x5')]){return _0x9b1873(_0x4cff07[_0x5352('0x5')][_0x5352('0x6')]);}else{return _0x77109b(_0x4cff07[_0x5352('0x7')]);}})['catch'](function(_0x3caa49){return _0x9b1873(_0x3caa49);});});}exports[_0x5352('0x8')]=function(_0x1845e2,_0x3721d1){return request(_0x5352('0x9'),{'account':_0x1845e2,'message':_0x3721d1});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 07e1d38..9a1bea7 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 _0x3d04=['chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','chat','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','online','faxPause','mailStatus','faxStatusTime','smsStatusTime','stringify','emit','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime'];(function(_0x429878,_0x5c3d35){var _0x15041d=function(_0x441ca0){while(--_0x441ca0){_0x429878['push'](_0x429878['shift']());}};_0x15041d(++_0x5c3d35);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x43d0('0x0'));var md5=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var Redis=require(_0x43d0('0x3'));var config=require(_0x43d0('0x4'));config[_0x43d0('0x5')]=_[_0x43d0('0x6')](config[_0x43d0('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x43d0('0x7'))(new Redis(config[_0x43d0('0x5')]));function Agent(_0x746f5e){this['id']=_0x746f5e['id']||0x0;this[_0x43d0('0x8')]=_0x746f5e['name']||'';this['online']=_0x746f5e['online']||!![];this['voicePause']=_0x746f5e[_0x43d0('0x9')]||![];this[_0x43d0('0xa')]=_0x746f5e[_0x43d0('0xa')]||![];this[_0x43d0('0xb')]=_0x746f5e[_0x43d0('0xb')]||![];this['faxPause']=_0x746f5e['faxPause']||![];this[_0x43d0('0xc')]=_0x746f5e['smsPause']||![];this['openchannelPause']=_0x746f5e[_0x43d0('0xd')]||![];this[_0x43d0('0xe')]=_0x43d0('0xf');this[_0x43d0('0x10')]=0x0;this['chatCapacity']=_0x746f5e[_0x43d0('0x11')]||0x0;this[_0x43d0('0x12')]=0x0;this['mailStatus']=_0x43d0('0xf');this[_0x43d0('0x13')]=0x0;this[_0x43d0('0x14')]=_0x746f5e['mailCapacity']||0x0;this[_0x43d0('0x15')]=0x0;this[_0x43d0('0x16')]=_0x43d0('0xf');this['faxStatusTime']=0x0;this[_0x43d0('0x17')]=_0x746f5e[_0x43d0('0x17')]||0x0;this[_0x43d0('0x18')]=0x0;this[_0x43d0('0x19')]=_0x43d0('0xf');this['smsStatusTime']=0x0;this['smsCapacity']=_0x746f5e[_0x43d0('0x1a')]||0x0;this[_0x43d0('0x1b')]=0x0;this[_0x43d0('0x1c')]='unknown';this[_0x43d0('0x1d')]=0x0;this['whatsappCapacity']=_0x746f5e[_0x43d0('0x1e')]||0x0;this[_0x43d0('0x1f')]=0x0;this[_0x43d0('0x20')]='unknown';this[_0x43d0('0x21')]=0x0;this[_0x43d0('0x22')]=_0x746f5e['openchannelCapacity']||0x0;this[_0x43d0('0x23')]=0x0;this[_0x43d0('0x24')]=![];this[_0x43d0('0x25')]=undefined;this[_0x43d0('0x1')]='';this[_0x43d0('0x26')]={};this[_0x43d0('0x27')]={};this[_0x43d0('0x28')]={};this[_0x43d0('0x29')]={};this[_0x43d0('0x2a')]={};this[_0x43d0('0x2b')]={};this[_0x43d0('0x2c')]();}Agent[_0x43d0('0x2d')][_0x43d0('0x2e')]=function(_0xbc72e6){if(this[_0xbc72e6+_0x43d0('0x2f')]>0x0){if(this[_0xbc72e6+'Capacity']>0x0&&this[_0xbc72e6+_0x43d0('0x2f')]>=this[_0xbc72e6+_0x43d0('0x30')]){return'maxcapacity';}else{return _0x43d0('0x31');}}else{return'idle';}};Agent[_0x43d0('0x2d')][_0x43d0('0x2c')]=function(){var _0x5dd310=[_0x43d0('0x32'),_0x43d0('0x33'),'openchannel',_0x43d0('0x34'),_0x43d0('0x35'),_0x43d0('0x36')];for(var _0x5f16ac=0x0;_0x5f16ac<_0x5dd310[_0x43d0('0x37')];_0x5f16ac+=0x1){var _0x38e89e=this[_0x43d0('0x2e')](_0x5dd310[_0x5f16ac]);if(this[_0x5dd310[_0x5f16ac]+_0x43d0('0x38')]!==_0x38e89e){this[_0x5dd310[_0x5f16ac]+_0x43d0('0x39')]=_[_0x43d0('0x3a')](moment()[_0x43d0('0x3b')]('x'));}this[_0x5dd310[_0x5f16ac]+'Status']=_0x38e89e;}var _0x2b0784={'id':this['id'],'name':this[_0x43d0('0x8')],'online':this[_0x43d0('0x3c')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x43d0('0xc')],'faxPause':this[_0x43d0('0x3d')],'openchannelPause':this[_0x43d0('0xd')],'chatStatus':this[_0x43d0('0xe')],'chatStatusTime':this[_0x43d0('0x10')],'chatCapacity':this[_0x43d0('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x43d0('0x3e')],'mailStatusTime':this[_0x43d0('0x13')],'mailCapacity':this[_0x43d0('0x14')],'mailCurrentCapacity':this[_0x43d0('0x15')],'faxStatus':this[_0x43d0('0x16')],'faxStatusTime':this[_0x43d0('0x3f')],'faxCapacity':this[_0x43d0('0x17')],'faxCurrentCapacity':this[_0x43d0('0x18')],'smsStatus':this[_0x43d0('0x19')],'smsStatusTime':this[_0x43d0('0x40')],'smsCapacity':this[_0x43d0('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x43d0('0x1c')],'whatsappStatusTime':this[_0x43d0('0x1d')],'whatsappCapacity':this[_0x43d0('0x1e')],'whatsappCurrentCapacity':this[_0x43d0('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x43d0('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x43d0('0x23')],'busy':this[_0x43d0('0x24')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x43d0('0x26')],'faxWaitingInteractions':this[_0x43d0('0x27')],'mailWaitingInteractions':this[_0x43d0('0x28')],'openchannelWaitingInteractions':this[_0x43d0('0x29')],'smsWaitingInteractions':this[_0x43d0('0x2a')],'whatsappWaitingInteractions':this[_0x43d0('0x2b')]};var _0x35a375=md5(JSON[_0x43d0('0x41')](_0x2b0784));if(this[_0x43d0('0x1')]!==_0x35a375){this[_0x43d0('0x1')]=_0x35a375;io[_0x43d0('0x42')]('user:routing:update',_[_0x43d0('0x43')](_0x2b0784,[_0x43d0('0x3c')]));}};module[_0x43d0('0x44')]=Agent; \ No newline at end of file +var _0x583c=['busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','chatStatus','smsStatus','whatsappStatus','whatsappCurrentCapacity','stringify','emit','user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity'];(function(_0x206a16,_0x2dd251){var _0x3f58b0=function(_0xe394b8){while(--_0xe394b8){_0x206a16['push'](_0x206a16['shift']());}};_0x3f58b0(++_0x2dd251);}(_0x583c,0x12b));var _0xc583=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x583c[_0x367336];return _0x3423a7;};'use strict';var _=require(_0xc583('0x0'));var md5=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var Redis=require(_0xc583('0x3'));var config=require('../../../config/environment');config[_0xc583('0x4')]=_[_0xc583('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc583('0x6'))(new Redis(config[_0xc583('0x4')]));function Agent(_0x5b7292){this['id']=_0x5b7292['id']||0x0;this[_0xc583('0x7')]=_0x5b7292[_0xc583('0x7')]||'';this[_0xc583('0x8')]=_0x5b7292[_0xc583('0x8')]||!![];this['voicePause']=_0x5b7292[_0xc583('0x9')]||![];this[_0xc583('0xa')]=_0x5b7292['chatPause']||![];this[_0xc583('0xb')]=_0x5b7292[_0xc583('0xb')]||![];this[_0xc583('0xc')]=_0x5b7292[_0xc583('0xc')]||![];this[_0xc583('0xd')]=_0x5b7292['smsPause']||![];this[_0xc583('0xe')]=_0x5b7292[_0xc583('0xe')]||![];this['chatStatus']=_0xc583('0xf');this[_0xc583('0x10')]=0x0;this['chatCapacity']=_0x5b7292[_0xc583('0x11')]||0x0;this[_0xc583('0x12')]=0x0;this[_0xc583('0x13')]=_0xc583('0xf');this[_0xc583('0x14')]=0x0;this[_0xc583('0x15')]=_0x5b7292[_0xc583('0x15')]||0x0;this[_0xc583('0x16')]=0x0;this[_0xc583('0x17')]='unknown';this[_0xc583('0x18')]=0x0;this['faxCapacity']=_0x5b7292[_0xc583('0x19')]||0x0;this[_0xc583('0x1a')]=0x0;this['smsStatus']=_0xc583('0xf');this[_0xc583('0x1b')]=0x0;this['smsCapacity']=_0x5b7292[_0xc583('0x1c')]||0x0;this[_0xc583('0x1d')]=0x0;this['whatsappStatus']=_0xc583('0xf');this[_0xc583('0x1e')]=0x0;this[_0xc583('0x1f')]=_0x5b7292[_0xc583('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xc583('0x20')]='unknown';this[_0xc583('0x21')]=0x0;this[_0xc583('0x22')]=_0x5b7292[_0xc583('0x22')]||0x0;this[_0xc583('0x23')]=0x0;this[_0xc583('0x24')]=![];this[_0xc583('0x25')]=undefined;this[_0xc583('0x1')]='';this[_0xc583('0x26')]={};this[_0xc583('0x27')]={};this[_0xc583('0x28')]={};this[_0xc583('0x29')]={};this[_0xc583('0x2a')]={};this[_0xc583('0x2b')]={};this['updateRealtime']();}Agent['prototype'][_0xc583('0x2c')]=function(_0x3e075c){if(this[_0x3e075c+_0xc583('0x2d')]>0x0){if(this[_0x3e075c+'Capacity']>0x0&&this[_0x3e075c+_0xc583('0x2d')]>=this[_0x3e075c+_0xc583('0x2e')]){return _0xc583('0x2f');}else{return _0xc583('0x30');}}else{return _0xc583('0x31');}};Agent['prototype']['updateRealtime']=function(){var _0x45871c=['mail',_0xc583('0x32'),_0xc583('0x33'),_0xc583('0x34'),_0xc583('0x35'),_0xc583('0x36')];for(var _0x4b1c18=0x0;_0x4b1c18<_0x45871c[_0xc583('0x37')];_0x4b1c18+=0x1){var _0x44f76a=this['getChannelStatus'](_0x45871c[_0x4b1c18]);if(this[_0x45871c[_0x4b1c18]+_0xc583('0x38')]!==_0x44f76a){this[_0x45871c[_0x4b1c18]+'StatusTime']=_[_0xc583('0x39')](moment()[_0xc583('0x3a')]('x'));}this[_0x45871c[_0x4b1c18]+_0xc583('0x38')]=_0x44f76a;}var _0x3ed083={'id':this['id'],'name':this[_0xc583('0x7')],'online':this[_0xc583('0x8')],'voicePause':this[_0xc583('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xc583('0xb')],'smsPause':this[_0xc583('0xd')],'faxPause':this[_0xc583('0xc')],'openchannelPause':this[_0xc583('0xe')],'chatStatus':this[_0xc583('0x3b')],'chatStatusTime':this[_0xc583('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc583('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xc583('0x15')],'mailCurrentCapacity':this[_0xc583('0x16')],'faxStatus':this[_0xc583('0x17')],'faxStatusTime':this[_0xc583('0x18')],'faxCapacity':this[_0xc583('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xc583('0x3c')],'smsStatusTime':this[_0xc583('0x1b')],'smsCapacity':this[_0xc583('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xc583('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xc583('0x1f')],'whatsappCurrentCapacity':this[_0xc583('0x3e')],'openchannelStatus':this[_0xc583('0x20')],'openchannelStatusTime':this[_0xc583('0x21')],'openchannelCapacity':this[_0xc583('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xc583('0x24')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xc583('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xc583('0x28')],'openchannelWaitingInteractions':this[_0xc583('0x29')],'smsWaitingInteractions':this[_0xc583('0x2a')],'whatsappWaitingInteractions':this[_0xc583('0x2b')]};var _0xa44825=md5(JSON[_0xc583('0x3f')](_0x3ed083));if(this['md5']!==_0xa44825){this['md5']=_0xa44825;io[_0xc583('0x40')](_0xc583('0x41'),_['omit'](_0x3ed083,[_0xc583('0x8')]));}};module[_0xc583('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1937cfb..aeef926 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 _0x4cd8=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause','available','format','chat:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','redis','name'];(function(_0x2d53d1,_0x5a7a2f){var _0x32eff2=function(_0x347116){while(--_0x347116){_0x2d53d1['push'](_0x2d53d1['shift']());}};_0x32eff2(++_0x5a7a2f);}(_0x4cd8,0x19b));var _0x84cd=function(_0x58e8eb,_0x2ac0c7){_0x58e8eb=_0x58e8eb-0x0;var _0x168540=_0x4cd8[_0x58e8eb];return _0x168540;};'use strict';var _=require(_0x84cd('0x0'));var md5=require(_0x84cd('0x1'));var util=require(_0x84cd('0x2'));var Redis=require(_0x84cd('0x3'));var config=require(_0x84cd('0x4'));config['redis']=_[_0x84cd('0x5')](config['redis'],{'host':_0x84cd('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x84cd('0x7')]));function ChatQueue(_0x66cb78){this['id']=_0x66cb78['id']||0x0;this[_0x84cd('0x8')]=_0x66cb78[_0x84cd('0x8')]||'';this['timeout']=_0x66cb78[_0x84cd('0x9')]||0xa;this[_0x84cd('0xa')]=_0x66cb78[_0x84cd('0xa')]||_0x84cd('0xb');this[_0x84cd('0xc')]=_0x66cb78[_0x84cd('0xc')];this['mapAgentsId']={};this[_0x84cd('0xd')]=0x0;this[_0x84cd('0x1')]='';this[_0x84cd('0xe')]();this[_0x84cd('0xf')]();}ChatQueue[_0x84cd('0x10')]['updateRouting']=function(){var _0x13aa30=this[_0x84cd('0x11')][_0x84cd('0x12')];this[_0x84cd('0x11')]=_[_0x84cd('0x13')](this[_0x84cd('0xc')],'id');this[_0x84cd('0x11')]['_rr']=_0x13aa30;};ChatQueue[_0x84cd('0x10')][_0x84cd('0xf')]=function(){this[_0x84cd('0x14')]=0x0;this[_0x84cd('0x15')]=0x0;for(var _0x3cdeef=0x0;_0x3cdeef=0x0?this[_0x84cd('0x18')]:0x0;var _0x5a31bc={'id':this['id'],'available':this[_0x84cd('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x84cd('0x15')],'waiting':this[_0x84cd('0xd')]};var _0x4280bf=md5(JSON['stringify'](_0x5a31bc));if(this[_0x84cd('0x1')]!==_0x4280bf){this['md5']=_0x4280bf;io['to'](util[_0x84cd('0x19')](_0x84cd('0x1a'),_0x5a31bc['name']))['emit']('chat_queue:save',_0x5a31bc);}};module[_0x84cd('0x1b')]=ChatQueue; \ No newline at end of file +var _0xa26a=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','md5','chat:queue:%s','emit','chat_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x4da3de,_0x532168){var _0x5ac4c0=function(_0x313ab5){while(--_0x313ab5){_0x4da3de['push'](_0x4da3de['shift']());}};_0x5ac4c0(++_0x532168);}(_0xa26a,0x147));var _0xaa26=function(_0x55b49a,_0x31c0c6){_0x55b49a=_0x55b49a-0x0;var _0x4ec8f2=_0xa26a[_0x55b49a];return _0x4ec8f2;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xaa26('0x0'));var Redis=require(_0xaa26('0x1'));var config=require(_0xaa26('0x2'));config[_0xaa26('0x3')]=_[_0xaa26('0x4')](config[_0xaa26('0x3')],{'host':_0xaa26('0x5'),'port':0x18eb});var io=require(_0xaa26('0x6'))(new Redis(config[_0xaa26('0x3')]));function ChatQueue(_0x4a10ac){this['id']=_0x4a10ac['id']||0x0;this['name']=_0x4a10ac[_0xaa26('0x7')]||'';this[_0xaa26('0x8')]=_0x4a10ac[_0xaa26('0x8')]||0xa;this[_0xaa26('0x9')]=_0x4a10ac[_0xaa26('0x9')]||_0xaa26('0xa');this[_0xaa26('0xb')]=_0x4a10ac['Agents'];this[_0xaa26('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xaa26('0xd')]();this[_0xaa26('0xe')]();}ChatQueue['prototype'][_0xaa26('0xd')]=function(){var _0x3cc1bd=this['mapAgentsId'][_0xaa26('0xf')];this[_0xaa26('0xc')]=_[_0xaa26('0x10')](this[_0xaa26('0xb')],'id');this['mapAgentsId'][_0xaa26('0xf')]=_0x3cc1bd;};ChatQueue[_0xaa26('0x11')]['updateRealtime']=function(){this[_0xaa26('0x12')]=0x0;this[_0xaa26('0x13')]=0x0;for(var _0x43c568=0x0;_0x43c568=0x0?this[_0xaa26('0x16')]:0x0;var _0x47d2ff={'id':this['id'],'available':this[_0xaa26('0x16')],'loggedIn':this[_0xaa26('0x12')],'name':this[_0xaa26('0x7')],'paused':this[_0xaa26('0x13')],'waiting':this['waiting']};var _0x87bd17=md5(JSON[_0xaa26('0x17')](_0x47d2ff));if(this[_0xaa26('0x18')]!==_0x87bd17){this[_0xaa26('0x18')]=_0x87bd17;io['to'](util['format'](_0xaa26('0x19'),_0x47d2ff[_0xaa26('0x7')]))[_0xaa26('0x1a')](_0xaa26('0x1b'),_0x47d2ff);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 89cfe03..1c05458 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 _0x0212=['exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','faxPause','available','paused','format','fax:queue:%s','fax_queue:save'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x0212,0xfd));var _0x2021=function(_0x53a7f3,_0x102923){_0x53a7f3=_0x53a7f3-0x0;var _0x5e8e66=_0x0212[_0x53a7f3];return _0x5e8e66;};'use strict';var _=require(_0x2021('0x0'));var md5=require(_0x2021('0x1'));var util=require(_0x2021('0x2'));var Redis=require('ioredis');var config=require(_0x2021('0x3'));config[_0x2021('0x4')]=_[_0x2021('0x5')](config[_0x2021('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2021('0x6'))(new Redis(config[_0x2021('0x4')]));function FaxQueue(_0x3004db){this['id']=_0x3004db['id']||0x0;this['name']=_0x3004db[_0x2021('0x7')]||'';this[_0x2021('0x8')]=_0x3004db[_0x2021('0x8')]||0xa;this['strategy']=_0x3004db[_0x2021('0x9')]||_0x2021('0xa');this['Agents']=_0x3004db[_0x2021('0xb')];this[_0x2021('0xc')]={};this[_0x2021('0xd')]=0x0;this[_0x2021('0x1')]='';this[_0x2021('0xe')]();this[_0x2021('0xf')]();}FaxQueue['prototype'][_0x2021('0xe')]=function(){var _0x46c848=this[_0x2021('0xc')][_0x2021('0x10')];this[_0x2021('0xc')]=_[_0x2021('0x11')](this[_0x2021('0xb')],'id');this['mapAgentsId']['_rr']=_0x46c848;};FaxQueue[_0x2021('0x12')]['updateRealtime']=function(){this[_0x2021('0x13')]=0x0;this['paused']=0x0;for(var _0x5dd753=0x0;_0x5dd753=0x0?this[_0x2021('0x16')]:0x0;var _0x4def85={'id':this['id'],'available':this[_0x2021('0x16')],'loggedIn':this[_0x2021('0x13')],'name':this[_0x2021('0x7')],'paused':this[_0x2021('0x17')],'waiting':this[_0x2021('0xd')]};var _0x2bbf41=md5(JSON['stringify'](_0x4def85));if(this['md5']!==_0x2bbf41){this[_0x2021('0x1')]=_0x2bbf41;io['to'](util[_0x2021('0x18')](_0x2021('0x19'),_0x4def85[_0x2021('0x7')]))['emit'](_0x2021('0x1a'),_0x4def85);}};module[_0x2021('0x1b')]=FaxQueue; \ No newline at end of file +var _0xf092=['updateRealtime','paused','length','online','loggedIn','available','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xf092,0xe3));var _0x2f09=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xf092[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0x2f09('0x0'));var md5=require(_0x2f09('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x2f09('0x2')]=_[_0x2f09('0x3')](config[_0x2f09('0x2')],{'host':_0x2f09('0x4'),'port':0x18eb});var io=require(_0x2f09('0x5'))(new Redis(config[_0x2f09('0x2')]));function FaxQueue(_0x18a6fb){this['id']=_0x18a6fb['id']||0x0;this[_0x2f09('0x6')]=_0x18a6fb[_0x2f09('0x6')]||'';this[_0x2f09('0x7')]=_0x18a6fb['timeout']||0xa;this['strategy']=_0x18a6fb['strategy']||_0x2f09('0x8');this[_0x2f09('0x9')]=_0x18a6fb['Agents'];this[_0x2f09('0xa')]={};this[_0x2f09('0xb')]=0x0;this[_0x2f09('0x1')]='';this[_0x2f09('0xc')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x1c8388=this[_0x2f09('0xa')][_0x2f09('0xd')];this['mapAgentsId']=_[_0x2f09('0xe')](this[_0x2f09('0x9')],'id');this['mapAgentsId'][_0x2f09('0xd')]=_0x1c8388;};FaxQueue[_0x2f09('0xf')][_0x2f09('0x10')]=function(){this['loggedIn']=0x0;this[_0x2f09('0x11')]=0x0;for(var _0x446287=0x0;_0x446287=0x0?this[_0x2f09('0x15')]:0x0;var _0x53f48a={'id':this['id'],'available':this[_0x2f09('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x2f09('0x11')],'waiting':this[_0x2f09('0xb')]};var _0x56415c=md5(JSON[_0x2f09('0x16')](_0x53f48a));if(this[_0x2f09('0x1')]!==_0x56415c){this[_0x2f09('0x1')]=_0x56415c;io['to'](util[_0x2f09('0x17')](_0x2f09('0x18'),_0x53f48a['name']))[_0x2f09('0x19')](_0x2f09('0x1a'),_0x53f48a);}};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 2f308fd..41f5330 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 _0xf7a9=['exports','Intervals'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xf7a9,0xe5));var _0x9f7a=function(_0x34b795,_0x45458c){_0x34b795=_0x34b795-0x0;var _0x37968b=_0xf7a9[_0x34b795];return _0x37968b;};'use strict';function Interval(_0x1eca85){this['id']=_0x1eca85['id']||0x0;this['name']=_0x1eca85['name']||'';this[_0x9f7a('0x0')]=_0x1eca85[_0x9f7a('0x0')]||{};}module[_0x9f7a('0x1')]=Interval; \ No newline at end of file +var _0xe663=['name','Intervals','exports'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xe663,0x16b));var _0x3e66=function(_0x42a563,_0x16291e){_0x42a563=_0x42a563-0x0;var _0x2ee5fe=_0xe663[_0x42a563];return _0x2ee5fe;};'use strict';function Interval(_0xe7567e){this['id']=_0xe7567e['id']||0x0;this['name']=_0xe7567e[_0x3e66('0x0')]||'';this[_0x3e66('0x1')]=_0xe7567e[_0x3e66('0x1')]||{};}module[_0x3e66('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 32ed210..62fe302 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 _0xe320=['Agents','mapAgentsId','waiting','md5','updateRouting','prototype','map','_rr','updateRealtime','paused','online','loggedIn','mailPause','available','format','mail:queue:%s','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x49279c,_0x56da65){var _0x472c04=function(_0x6b5a3d){while(--_0x6b5a3d){_0x49279c['push'](_0x49279c['shift']());}};_0x472c04(++_0x56da65);}(_0xe320,0x17d));var _0x0e32=function(_0x2ce274,_0x5e853e){_0x2ce274=_0x2ce274-0x0;var _0x173f95=_0xe320[_0x2ce274];return _0x173f95;};'use strict';var _=require(_0x0e32('0x0'));var md5=require('md5');var util=require(_0x0e32('0x1'));var Redis=require(_0x0e32('0x2'));var config=require('../../../config/environment');config[_0x0e32('0x3')]=_[_0x0e32('0x4')](config[_0x0e32('0x3')],{'host':_0x0e32('0x5'),'port':0x18eb});var io=require(_0x0e32('0x6'))(new Redis(config['redis']));function MailQueue(_0x516d92){this['id']=_0x516d92['id']||0x0;this[_0x0e32('0x7')]=_0x516d92[_0x0e32('0x7')]||'';this[_0x0e32('0x8')]=_0x516d92['timeout']||0xa;this['strategy']=_0x516d92[_0x0e32('0x9')]||_0x0e32('0xa');this[_0x0e32('0xb')]=_0x516d92['Agents'];this[_0x0e32('0xc')]={};this[_0x0e32('0xd')]=0x0;this[_0x0e32('0xe')]='';this[_0x0e32('0xf')]();this['updateRealtime']();}MailQueue[_0x0e32('0x10')][_0x0e32('0xf')]=function(){var _0x257813=this[_0x0e32('0xc')]['_rr'];this['mapAgentsId']=_[_0x0e32('0x11')](this[_0x0e32('0xb')],'id');this[_0x0e32('0xc')][_0x0e32('0x12')]=_0x257813;};MailQueue[_0x0e32('0x10')][_0x0e32('0x13')]=function(){this['loggedIn']=0x0;this[_0x0e32('0x14')]=0x0;for(var _0x37aab1=0x0;_0x37aab1=0x0?this['available']:0x0;var _0xafb478={'id':this['id'],'available':this[_0x0e32('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x0e32('0x7')],'paused':this['paused'],'waiting':this[_0x0e32('0xd')]};var _0x432ec4=md5(JSON['stringify'](_0xafb478));if(this[_0x0e32('0xe')]!==_0x432ec4){this[_0x0e32('0xe')]=_0x432ec4;io['to'](util[_0x0e32('0x19')](_0x0e32('0x1a'),_0xafb478['name']))['emit']('mail_queue:save',_0xafb478);}};module[_0x0e32('0x1b')]=MailQueue; \ No newline at end of file +var _0x2a03=['format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','updateRouting','map','Agents','_rr','prototype','paused','length','online','loggedIn','mailPause','available','waiting','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a03,0xb8));var _0x32a0=function(_0x299027,_0x5d2e4f){_0x299027=_0x299027-0x0;var _0x1bc622=_0x2a03[_0x299027];return _0x1bc622;};'use strict';var _=require(_0x32a0('0x0'));var md5=require(_0x32a0('0x1'));var util=require(_0x32a0('0x2'));var Redis=require(_0x32a0('0x3'));var config=require(_0x32a0('0x4'));config['redis']=_[_0x32a0('0x5')](config[_0x32a0('0x6')],{'host':_0x32a0('0x7'),'port':0x18eb});var io=require(_0x32a0('0x8'))(new Redis(config[_0x32a0('0x6')]));function MailQueue(_0x1d90e9){this['id']=_0x1d90e9['id']||0x0;this[_0x32a0('0x9')]=_0x1d90e9[_0x32a0('0x9')]||'';this[_0x32a0('0xa')]=_0x1d90e9['timeout']||0xa;this['strategy']=_0x1d90e9['strategy']||_0x32a0('0xb');this['Agents']=_0x1d90e9['Agents'];this[_0x32a0('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x32a0('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0x32a0('0xd')]=function(){var _0x49fe09=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x32a0('0xe')](this[_0x32a0('0xf')],'id');this['mapAgentsId'][_0x32a0('0x10')]=_0x49fe09;};MailQueue[_0x32a0('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32a0('0x12')]=0x0;for(var _0x1fcbb1=0x0;_0x1fcbb1=0x0?this['available']:0x0;var _0x31c5df={'id':this['id'],'available':this[_0x32a0('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x32a0('0x9')],'paused':this[_0x32a0('0x12')],'waiting':this[_0x32a0('0x18')]};var _0x5584b4=md5(JSON[_0x32a0('0x19')](_0x31c5df));if(this[_0x32a0('0x1')]!==_0x5584b4){this[_0x32a0('0x1')]=_0x5584b4;io['to'](util[_0x32a0('0x1a')](_0x32a0('0x1b'),_0x31c5df[_0x32a0('0x9')]))['emit'](_0x32a0('0x1c'),_0x31c5df);}};module[_0x32a0('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9741621..d109559 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x1261,0x144));var _0x1126=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0x1261[_0x11503f];return _0x34caab;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d43cc,_0x23227d){_0x5d43cc=_0x5d43cc-0x0;var _0x270ecb=_0x2ef3[_0x5d43cc];return _0x270ecb;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index fde68cb..507990f 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 _0xd845=['exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','updateRealtime','paused','length','loggedIn','smsPause','available','format','sms:queue:%s','emit','sms_queue:save'];(function(_0x3b76e9,_0x39efb2){var _0x43489c=function(_0x1040a9){while(--_0x1040a9){_0x3b76e9['push'](_0x3b76e9['shift']());}};_0x43489c(++_0x39efb2);}(_0xd845,0x135));var _0x5d84=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xd845[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x5d84('0x0'));var md5=require(_0x5d84('0x1'));var util=require(_0x5d84('0x2'));var Redis=require(_0x5d84('0x3'));var config=require('../../../config/environment');config[_0x5d84('0x4')]=_[_0x5d84('0x5')](config[_0x5d84('0x4')],{'host':_0x5d84('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5d84('0x4')]));function SmsQueue(_0x134828){this['id']=_0x134828['id']||0x0;this[_0x5d84('0x7')]=_0x134828[_0x5d84('0x7')]||'';this[_0x5d84('0x8')]=_0x134828[_0x5d84('0x8')]||0xa;this['strategy']=_0x134828[_0x5d84('0x9')]||'beepall';this[_0x5d84('0xa')]=_0x134828[_0x5d84('0xa')];this['mapAgentsId']={};this[_0x5d84('0xb')]=0x0;this[_0x5d84('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x5d84('0xc')][_0x5d84('0xd')]=function(){var _0x227990=this[_0x5d84('0xe')][_0x5d84('0xf')];this['mapAgentsId']=_[_0x5d84('0x10')](this[_0x5d84('0xa')],'id');this[_0x5d84('0xe')][_0x5d84('0xf')]=_0x227990;};SmsQueue[_0x5d84('0xc')][_0x5d84('0x11')]=function(){this['loggedIn']=0x0;this[_0x5d84('0x12')]=0x0;for(var _0x56aa9c=0x0;_0x56aa9c=0x0?this['available']:0x0;var _0x3b3f63={'id':this['id'],'available':this[_0x5d84('0x16')],'loggedIn':this[_0x5d84('0x14')],'name':this[_0x5d84('0x7')],'paused':this[_0x5d84('0x12')],'waiting':this[_0x5d84('0xb')]};var _0x4a6b43=md5(JSON['stringify'](_0x3b3f63));if(this['md5']!==_0x4a6b43){this['md5']=_0x4a6b43;io['to'](util[_0x5d84('0x17')](_0x5d84('0x18'),_0x3b3f63[_0x5d84('0x7')]))[_0x5d84('0x19')](_0x5d84('0x1a'),_0x3b3f63);}};module[_0x5d84('0x1b')]=SmsQueue; \ No newline at end of file +var _0x9567=['updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9567,0xdc));var _0x7956=function(_0x49f73d,_0x5cb41e){_0x49f73d=_0x49f73d-0x0;var _0x372d74=_0x9567[_0x49f73d];return _0x372d74;};'use strict';var _=require(_0x7956('0x0'));var md5=require(_0x7956('0x1'));var util=require(_0x7956('0x2'));var Redis=require(_0x7956('0x3'));var config=require(_0x7956('0x4'));config['redis']=_['defaults'](config[_0x7956('0x5')],{'host':_0x7956('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7956('0x5')]));function SmsQueue(_0x518f0a){this['id']=_0x518f0a['id']||0x0;this[_0x7956('0x7')]=_0x518f0a['name']||'';this[_0x7956('0x8')]=_0x518f0a[_0x7956('0x8')]||0xa;this['strategy']=_0x518f0a[_0x7956('0x9')]||'beepall';this[_0x7956('0xa')]=_0x518f0a[_0x7956('0xa')];this['mapAgentsId']={};this[_0x7956('0xb')]=0x0;this[_0x7956('0x1')]='';this['updateRouting']();this[_0x7956('0xc')]();}SmsQueue[_0x7956('0xd')][_0x7956('0xe')]=function(){var _0x4bfc14=this[_0x7956('0xf')][_0x7956('0x10')];this[_0x7956('0xf')]=_[_0x7956('0x11')](this['Agents'],'id');this[_0x7956('0xf')][_0x7956('0x10')]=_0x4bfc14;};SmsQueue[_0x7956('0xd')]['updateRealtime']=function(){this[_0x7956('0x12')]=0x0;this[_0x7956('0x13')]=0x0;for(var _0x248b79=0x0;_0x248b79=0x0?this['available']:0x0;var _0x5c3afb={'id':this['id'],'available':this[_0x7956('0x17')],'loggedIn':this[_0x7956('0x12')],'name':this['name'],'paused':this[_0x7956('0x13')],'waiting':this['waiting']};var _0x635d5b=md5(JSON[_0x7956('0x18')](_0x5c3afb));if(this['md5']!==_0x635d5b){this[_0x7956('0x1')]=_0x635d5b;io['to'](util[_0x7956('0x19')](_0x7956('0x1a'),_0x5c3afb['name']))[_0x7956('0x1b')]('sms_queue:save',_0x5c3afb);}};module[_0x7956('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1dc5a73..b4555ef 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 _0x197d=['ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','_rr','prototype','paused','length','online','loggedIn','whatsappPause','available','waiting','stringify','whatsapp_queue:save','lodash','md5','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x197d,0x10b));var _0xd197=function(_0xff2171,_0x5b175a){_0xff2171=_0xff2171-0x0;var _0x542c67=_0x197d[_0xff2171];return _0x542c67;};'use strict';var _=require(_0xd197('0x0'));var md5=require(_0xd197('0x1'));var util=require(_0xd197('0x2'));var Redis=require(_0xd197('0x3'));var config=require(_0xd197('0x4'));config['redis']=_[_0xd197('0x5')](config[_0xd197('0x6')],{'host':_0xd197('0x7'),'port':0x18eb});var io=require(_0xd197('0x8'))(new Redis(config['redis']));function WhatsappQueue(_0x14400d){this['id']=_0x14400d['id']||0x0;this[_0xd197('0x9')]=_0x14400d[_0xd197('0x9')]||'';this['timeout']=_0x14400d[_0xd197('0xa')]||0xa;this[_0xd197('0xb')]=_0x14400d[_0xd197('0xb')]||_0xd197('0xc');this[_0xd197('0xd')]=_0x14400d[_0xd197('0xd')];this[_0xd197('0xe')]={};this['waiting']=0x0;this['md5']='';this[_0xd197('0xf')]();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x4bd5db=this['mapAgentsId'][_0xd197('0x10')];this['mapAgentsId']=_['map'](this[_0xd197('0xd')],'id');this[_0xd197('0xe')]['_rr']=_0x4bd5db;};WhatsappQueue[_0xd197('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xd197('0x12')]=0x0;for(var _0x109d0a=0x0;_0x109d0a=0x0?this['available']:0x0;var _0x510705={'id':this['id'],'available':this[_0xd197('0x17')],'loggedIn':this[_0xd197('0x15')],'name':this[_0xd197('0x9')],'paused':this[_0xd197('0x12')],'waiting':this[_0xd197('0x18')]};var _0x2524c3=md5(JSON[_0xd197('0x19')](_0x510705));if(this[_0xd197('0x1')]!==_0x2524c3){this[_0xd197('0x1')]=_0x2524c3;io['to'](util['format']('whatsapp:queue:%s',_0x510705[_0xd197('0x9')]))['emit'](_0xd197('0x1a'),_0x510705);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x65b6=['Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall'];(function(_0x152afe,_0x2ff8cb){var _0x23a369=function(_0x3dee1c){while(--_0x3dee1c){_0x152afe['push'](_0x152afe['shift']());}};_0x23a369(++_0x2ff8cb);}(_0x65b6,0x122));var _0x665b=function(_0x944e7,_0x5722a4){_0x944e7=_0x944e7-0x0;var _0x3cb03a=_0x65b6[_0x944e7];return _0x3cb03a;};'use strict';var _=require('lodash');var md5=require(_0x665b('0x0'));var util=require(_0x665b('0x1'));var Redis=require(_0x665b('0x2'));var config=require('../../../config/environment');config[_0x665b('0x3')]=_[_0x665b('0x4')](config[_0x665b('0x3')],{'host':_0x665b('0x5'),'port':0x18eb});var io=require(_0x665b('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x38e86a){this['id']=_0x38e86a['id']||0x0;this['name']=_0x38e86a[_0x665b('0x7')]||'';this['timeout']=_0x38e86a['timeout']||0xa;this[_0x665b('0x8')]=_0x38e86a['strategy']||_0x665b('0x9');this['Agents']=_0x38e86a[_0x665b('0xa')];this[_0x665b('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x665b('0xc')]();this[_0x665b('0xd')]();}WhatsappQueue[_0x665b('0xe')][_0x665b('0xc')]=function(){var _0x5496d8=this['mapAgentsId']['_rr'];this[_0x665b('0xb')]=_[_0x665b('0xf')](this[_0x665b('0xa')],'id');this['mapAgentsId'][_0x665b('0x10')]=_0x5496d8;};WhatsappQueue[_0x665b('0xe')][_0x665b('0xd')]=function(){this['loggedIn']=0x0;this[_0x665b('0x11')]=0x0;for(var _0x3b2b16=0x0;_0x3b2b16=0x0?this[_0x665b('0x15')]:0x0;var _0x3e9f78={'id':this['id'],'available':this[_0x665b('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x665b('0x7')],'paused':this[_0x665b('0x11')],'waiting':this['waiting']};var _0x3578be=md5(JSON[_0x665b('0x16')](_0x3e9f78));if(this['md5']!==_0x3578be){this[_0x665b('0x0')]=_0x3578be;io['to'](util['format'](_0x665b('0x17'),_0x3e9f78[_0x665b('0x7')]))['emit'](_0x665b('0x18'),_0x3e9f78);}};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 98c66d7..4f41d55 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x315655,_0xb3bb5e){var _0x493db7=function(_0x2cc0d0){while(--_0x2cc0d0){_0x315655['push'](_0x315655['shift']());}};_0x493db7(++_0xb3bb5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0xb10b[_0x40348a];return _0x290d46;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ef4102d..1e5fa49 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 _0x08c7=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0xa86296,_0x5d47b5){var _0x2a9c33=function(_0x1d3a54){while(--_0x1d3a54){_0xa86296['push'](_0xa86296['shift']());}};_0x2a9c33(++_0x5d47b5);}(_0x08c7,0x19f));var _0x708c=function(_0x105864,_0x48552a){_0x105864=_0x105864-0x0;var _0x1d1371=_0x08c7[_0x105864];return _0x1d1371;};'use strict';var client=require(_0x708c('0x0'));exports[_0x708c('0x1')]=function(_0x110d93,_0x42887f){return client[_0x708c('0x2')](_0x708c('0x3'),{'body':_0x42887f,'options':{'where':{'id':_0x110d93}},'log':_0x708c('0x4')});};exports['addTags']=function(_0x446d1c,_0x421b99){return client[_0x708c('0x2')](_0x708c('0x5'),{'body':_0x421b99,'options':{'where':{'id':_0x446d1c}},'log':_0x708c('0x6')});}; \ No newline at end of file +var _0x1d49=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d49,0x154));var _0x91d4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1d49[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x91d4('0x0'));exports['update']=function(_0x14e2ae,_0x2ef400){return client[_0x91d4('0x1')](_0x91d4('0x2'),{'body':_0x2ef400,'options':{'where':{'id':_0x14e2ae}},'log':_0x91d4('0x3')});};exports[_0x91d4('0x4')]=function(_0x1a5207,_0x519f4d){return client[_0x91d4('0x1')](_0x91d4('0x5'),{'body':_0x519f4d,'options':{'where':{'id':_0x1a5207}},'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 2db2cf2..0a34eac 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 _0x362f=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x81eff,_0x2ffe39){var _0x4826aa=function(_0x1d0f82){while(--_0x1d0f82){_0x81eff['push'](_0x81eff['shift']());}};_0x4826aa(++_0x2ffe39);}(_0x362f,0x79));var _0xf362=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x362f[_0x110c3d];return _0x226d67;};'use strict';var client=require(_0xf362('0x0'));exports[_0xf362('0x1')]=function(_0x3dd6be){return client[_0xf362('0x2')](_0xf362('0x3'),{'body':_0x3dd6be,'log':_0xf362('0x4')});}; \ No newline at end of file +var _0x795d=['create','CreateChatMessage'];(function(_0x55308f,_0x1b86e0){var _0xfa9b65=function(_0x312317){while(--_0x312317){_0x55308f['push'](_0x55308f['shift']());}};_0xfa9b65(++_0x1b86e0);}(_0x795d,0x9a));var _0xd795=function(_0x95a001,_0xe13511){_0x95a001=_0x95a001-0x0;var _0x31c10a=_0x795d[_0x95a001];return _0x31c10a;};'use strict';var client=require('../client');exports[_0xd795('0x0')]=function(_0x3fec3f){return client['Request'](_0xd795('0x1'),{'body':_0x3fec3f,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 68a87b5..a071d22 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 _0x943c=['../client','getChatQueues','Request','GetChatQueue','strategy','User','Agents','online','chatPause'];(function(_0x4be0dd,_0x25d777){var _0x1e6225=function(_0x2cb775){while(--_0x2cb775){_0x4be0dd['push'](_0x4be0dd['shift']());}};_0x1e6225(++_0x25d777);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc943('0x0'));exports[_0xc943('0x1')]=function(){return function(){return client[_0xc943('0x2')](_0xc943('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc943('0x4')],'include':[{'model':_0xc943('0x5'),'as':_0xc943('0x6'),'attributes':['id','name',_0xc943('0x7'),_0xc943('0x8')]}]},'log':_0xc943('0x1')});};}; \ No newline at end of file +var _0x36bb=['../client','getChatQueues','Request','name','timeout','strategy','User','Agents','online','chatPause'];(function(_0x27ca91,_0x5f5359){var _0x59e0fc=function(_0x2c7aba){while(--_0x2c7aba){_0x27ca91['push'](_0x27ca91['shift']());}};_0x59e0fc(++_0x5f5359);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb36b('0x0'));exports[_0xb36b('0x1')]=function(){return function(){return client[_0xb36b('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xb36b('0x3'),_0xb36b('0x4'),_0xb36b('0x5')],'include':[{'model':_0xb36b('0x6'),'as':_0xb36b('0x7'),'attributes':['id',_0xb36b('0x3'),_0xb36b('0x8'),_0xb36b('0x9')]}]},'log':_0xb36b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2b3d711..27c523c 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 _0xdab2=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x4a8f7c,_0x1ce89d){var _0x3811d6=function(_0x2a1fd7){while(--_0x2a1fd7){_0x4a8f7c['push'](_0x4a8f7c['shift']());}};_0x3811d6(++_0x1ce89d);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2dab('0x0'));exports[_0x2dab('0x1')]=function(_0x50addb){return client[_0x2dab('0x2')](_0x2dab('0x3'),{'body':_0x50addb,'log':_0x2dab('0x3')});};exports[_0x2dab('0x4')]=function(_0x56a9cc,_0x2078be){return client[_0x2dab('0x2')](_0x2dab('0x5'),{'body':_0x2078be,'options':{'where':{'uniqueid':_0x56a9cc},'order':[['id',_0x2dab('0x6')]],'limit':0x1},'log':_0x2dab('0x5')});}; \ No newline at end of file +var _0x544a=['create','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client'];(function(_0x2dc252,_0x3da532){var _0x189959=function(_0x360e49){while(--_0x360e49){_0x2dc252['push'](_0x2dc252['shift']());}};_0x189959(++_0x3da532);}(_0x544a,0xbd));var _0xa544=function(_0xae6bc8,_0x11049e){_0xae6bc8=_0xae6bc8-0x0;var _0x1b2cd7=_0x544a[_0xae6bc8];return _0x1b2cd7;};'use strict';var client=require(_0xa544('0x0'));exports[_0xa544('0x1')]=function(_0x311c86){return client['Request']('CreateChatQueueReport',{'body':_0x311c86,'log':_0xa544('0x2')});};exports['update']=function(_0x42b8f1,_0xdca212){return client['Request'](_0xa544('0x3'),{'body':_0xdca212,'options':{'where':{'uniqueid':_0x42b8f1},'order':[['id',_0xa544('0x4')]],'limit':0x1},'log':_0xa544('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index db2b4e9..20d41e2 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(_0xbc107a,_0x2cf678){var _0x102943=function(_0x3432af){while(--_0x3432af){_0xbc107a['push'](_0xbc107a['shift']());}};_0x102943(++_0x2cf678);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4559c1,_0x276738){var _0x10510f=function(_0x163979){while(--_0x163979){_0x4559c1['push'](_0x4559c1['shift']());}};_0x10510f(++_0x276738);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7e9b5d1..4e09acd 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 _0x2411=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x176637,_0x5810f8){var _0x447a7c=function(_0x739398){while(--_0x739398){_0x176637['push'](_0x176637['shift']());}};_0x447a7c(++_0x5810f8);}(_0x2411,0xfb));var _0x1241=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x2411[_0x5c9307];return _0x373e29;};'use strict';var client=require(_0x1241('0x0'));exports['create']=function(_0x3a376b){return client[_0x1241('0x1')](_0x1241('0x2'),{'body':_0x3a376b,'log':_0x1241('0x3')});}; \ No newline at end of file +var _0x17c0=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x4345ef,_0x40d76b){var _0x52e0f8=function(_0x49b5cd){while(--_0x49b5cd){_0x4345ef['push'](_0x4345ef['shift']());}};_0x52e0f8(++_0x40d76b);}(_0x17c0,0x1d6));var _0x017c=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x17c0[_0x4c5c97];return _0xd5d2cb;};'use strict';var client=require(_0x017c('0x0'));exports[_0x017c('0x1')]=function(_0x3bf225){return client[_0x017c('0x2')](_0x017c('0x3'),{'body':_0x3bf225,'log':_0x017c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1112d6c..50da8f1 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 _0x6ffe=['getFaxQueues','../client','Request','GetFaxQueue','name','strategy','User','Agents','online','faxPause'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6ffe,0xfb));var _0xe6ff=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0x6ffe[_0x22d7bb];return _0x40a737;};'use strict';var client=require(_0xe6ff('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xe6ff('0x1')](_0xe6ff('0x2'),{'options':{'raw':![],'attributes':['id',_0xe6ff('0x3'),'timeout',_0xe6ff('0x4')],'include':[{'model':_0xe6ff('0x5'),'as':_0xe6ff('0x6'),'attributes':['id',_0xe6ff('0x3'),_0xe6ff('0x7'),_0xe6ff('0x8')]}]},'log':_0xe6ff('0x9')});};}; \ No newline at end of file +var _0xc69c=['strategy','User','Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x280419,_0x265ab0){var _0x513d83=function(_0x1545cd){while(--_0x1545cd){_0x280419['push'](_0x280419['shift']());}};_0x513d83(++_0x265ab0);}(_0xc69c,0xcc));var _0xcc69=function(_0x357be4,_0x3bc32f){_0x357be4=_0x357be4-0x0;var _0xa8b73d=_0xc69c[_0x357be4];return _0xa8b73d;};'use strict';var client=require(_0xcc69('0x0'));exports[_0xcc69('0x1')]=function(){return function(){return client[_0xcc69('0x2')](_0xcc69('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xcc69('0x4'),_0xcc69('0x5')],'include':[{'model':_0xcc69('0x6'),'as':_0xcc69('0x7'),'attributes':['id',_0xcc69('0x8'),_0xcc69('0x9'),_0xcc69('0xa')]}]},'log':_0xcc69('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index fc1f1f8..5481d36 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 _0xaf40=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0x44dee8,_0x55f584){var _0x12419b=function(_0x178595){while(--_0x178595){_0x44dee8['push'](_0x44dee8['shift']());}};_0x12419b(++_0x55f584);}(_0xaf40,0x75));var _0x0af4=function(_0x478597,_0x273a3d){_0x478597=_0x478597-0x0;var _0x13e66b=_0xaf40[_0x478597];return _0x13e66b;};'use strict';var client=require('../client');exports[_0x0af4('0x0')]=function(_0x1e1a16){return client[_0x0af4('0x1')](_0x0af4('0x2'),{'body':_0x1e1a16,'log':_0x0af4('0x2')});};exports[_0x0af4('0x3')]=function(_0x2e367a,_0x35be09){return client[_0x0af4('0x1')](_0x0af4('0x4'),{'body':_0x35be09,'options':{'where':{'uniqueid':_0x2e367a},'order':[['id',_0x0af4('0x5')]],'limit':0x1},'log':_0x0af4('0x4')});}; \ No newline at end of file +var _0x570c=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x1f3295,_0x111dcd){var _0x209c64=function(_0x299e61){while(--_0x299e61){_0x1f3295['push'](_0x1f3295['shift']());}};_0x209c64(++_0x111dcd);}(_0x570c,0x1ad));var _0xc570=function(_0x2e7c3b,_0x14b816){_0x2e7c3b=_0x2e7c3b-0x0;var _0x2ef798=_0x570c[_0x2e7c3b];return _0x2ef798;};'use strict';var client=require(_0xc570('0x0'));exports[_0xc570('0x1')]=function(_0x1aa14a){return client[_0xc570('0x2')]('CreateFaxQueueReport',{'body':_0x1aa14a,'log':_0xc570('0x3')});};exports['update']=function(_0x1f9812,_0x53afed){return client[_0xc570('0x2')](_0xc570('0x4'),{'body':_0x53afed,'options':{'where':{'uniqueid':_0x1f9812},'order':[['id',_0xc570('0x5')]],'limit':0x1},'log':_0xc570('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 67a69c7..fe923a3 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 _0x8ced=['GetInterval','name','Interval','Intervals','getIntervals','Request'];(function(_0x3d6b2c,_0x1f864b){var _0x525fc0=function(_0x3b0ec5){while(--_0x3b0ec5){_0x3d6b2c['push'](_0x3d6b2c['shift']());}};_0x525fc0(++_0x1f864b);}(_0x8ced,0x119));var _0xd8ce=function(_0x154f66,_0x116f85){_0x154f66=_0x154f66-0x0;var _0x3f947a=_0x8ced[_0x154f66];return _0x3f947a;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xd8ce('0x0')](_0xd8ce('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd8ce('0x2')],'include':[{'model':_0xd8ce('0x3'),'as':_0xd8ce('0x4'),'attributes':['id','name','interval']}]},'log':_0xd8ce('0x5')});};}; \ No newline at end of file +var _0xbd96=['../client','getIntervals','Request','name','Interval','interval'];(function(_0x48b25d,_0x3b0205){var _0x15fc99=function(_0x488da8){while(--_0x488da8){_0x48b25d['push'](_0x48b25d['shift']());}};_0x15fc99(++_0x3b0205);}(_0xbd96,0x1c2));var _0x6bd9=function(_0x10cadc,_0x5e9bb2){_0x10cadc=_0x10cadc-0x0;var _0x45aaa0=_0xbd96[_0x10cadc];return _0x45aaa0;};'use strict';var client=require(_0x6bd9('0x0'));exports[_0x6bd9('0x1')]=function(){return function(){return client[_0x6bd9('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6bd9('0x3')],'include':[{'model':_0x6bd9('0x4'),'as':'Intervals','attributes':['id','name',_0x6bd9('0x5')]}]},'log':_0x6bd9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 6199406..a9062a0 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 _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xf61e,0x191));var _0xef61=function(_0x1dfe33,_0x52da21){_0x1dfe33=_0x1dfe33-0x0;var _0x26971b=_0xf61e[_0x1dfe33];return _0x26971b;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xa456=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0xd8e9f5,_0x29df60){var _0x4b915e=function(_0xb395cb){while(--_0xb395cb){_0xd8e9f5['push'](_0xd8e9f5['shift']());}};_0x4b915e(++_0x29df60);}(_0xa456,0x142));var _0x6a45=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa456[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(_0x56dfe8,_0xd5464e){return client['Request'](_0x6a45('0x2'),{'body':_0xd5464e,'options':{'where':{'id':_0x56dfe8}},'log':_0x6a45('0x3')});};exports[_0x6a45('0x4')]=function(_0x500c72,_0x1f0701){return client[_0x6a45('0x5')](_0x6a45('0x6'),{'body':_0x1f0701,'options':{'where':{'id':_0x500c72}},'log':_0x6a45('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3a6bd65..b61f84e 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 _0x8627=['createMailMessage','../client','create','Request'];(function(_0x588db5,_0x14b05d){var _0x355c5d=function(_0x1f5e14){while(--_0x1f5e14){_0x588db5['push'](_0x588db5['shift']());}};_0x355c5d(++_0x14b05d);}(_0x8627,0xed));var _0x7862=function(_0x74c39e,_0x10e068){_0x74c39e=_0x74c39e-0x0;var _0x5a81a5=_0x8627[_0x74c39e];return _0x5a81a5;};'use strict';var client=require(_0x7862('0x0'));exports[_0x7862('0x1')]=function(_0x12bfea){return client[_0x7862('0x2')]('CreateMailMessage',{'body':_0x12bfea,'log':_0x7862('0x3')});}; \ No newline at end of file +var _0x1102=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x1b96c6,_0x45e55a){var _0x4a20fa=function(_0x2b6da4){while(--_0x2b6da4){_0x1b96c6['push'](_0x1b96c6['shift']());}};_0x4a20fa(++_0x45e55a);}(_0x1102,0x1f3));var _0x2110=function(_0x1329eb,_0x486a85){_0x1329eb=_0x1329eb-0x0;var _0x7a2e77=_0x1102[_0x1329eb];return _0x7a2e77;};'use strict';var client=require(_0x2110('0x0'));exports[_0x2110('0x1')]=function(_0x539fd9){return client[_0x2110('0x2')](_0x2110('0x3'),{'body':_0x539fd9,'log':_0x2110('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 17af30d..d88c329 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 _0xa402=['GetMailQueue','name','strategy','User','Agents','online','getMailQueues','Request'];(function(_0x3ba12b,_0x12ef40){var _0x3b796c=function(_0x3c91af){while(--_0x3c91af){_0x3ba12b['push'](_0x3ba12b['shift']());}};_0x3b796c(++_0x12ef40);}(_0xa402,0x76));var _0x2a40=function(_0x27064e,_0x34e92b){_0x27064e=_0x27064e-0x0;var _0x270d37=_0xa402[_0x27064e];return _0x270d37;};'use strict';var client=require('../client');exports[_0x2a40('0x0')]=function(){return function(){return client[_0x2a40('0x1')](_0x2a40('0x2'),{'options':{'raw':![],'attributes':['id',_0x2a40('0x3'),'timeout',_0x2a40('0x4')],'include':[{'model':_0x2a40('0x5'),'as':_0x2a40('0x6'),'attributes':['id','name',_0x2a40('0x7'),'mailPause']}]},'log':_0x2a40('0x0')});};}; \ No newline at end of file +var _0x1246=['Agents','name','online','mailPause','getMailQueues','../client','Request','GetMailQueue','strategy'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0x1246,0x17f));var _0x6124=function(_0x1bdba0,_0x305c9d){_0x1bdba0=_0x1bdba0-0x0;var _0x3f2686=_0x1246[_0x1bdba0];return _0x3f2686;};'use strict';var client=require(_0x6124('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x6124('0x1')](_0x6124('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x6124('0x3')],'include':[{'model':'User','as':_0x6124('0x4'),'attributes':['id',_0x6124('0x5'),_0x6124('0x6'),_0x6124('0x7')]}]},'log':_0x6124('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index eb236c7..b09c0bf 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 _0xeff4=['DESC','UpdateMailQueueReport','create','CreateMailQueueReport','update'];(function(_0x49ac90,_0x4ad5d6){var _0x31282f=function(_0x23d334){while(--_0x23d334){_0x49ac90['push'](_0x49ac90['shift']());}};_0x31282f(++_0x4ad5d6);}(_0xeff4,0xd9));var _0x4eff=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0xeff4[_0x4a209a];return _0x4b3c20;};'use strict';var client=require('../client');exports[_0x4eff('0x0')]=function(_0x4dda97){return client['Request']('CreateMailQueueReport',{'body':_0x4dda97,'log':_0x4eff('0x1')});};exports[_0x4eff('0x2')]=function(_0x590fc2,_0x376b51){return client['Request']('UpdateMailQueueReport',{'body':_0x376b51,'options':{'where':{'uniqueid':_0x590fc2},'order':[['id',_0x4eff('0x3')]],'limit':0x1},'log':_0x4eff('0x4')});}; \ No newline at end of file +var _0x29a4=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','create'];(function(_0x5dc670,_0x52fb7b){var _0x39acb=function(_0x31dcef){while(--_0x31dcef){_0x5dc670['push'](_0x5dc670['shift']());}};_0x39acb(++_0x52fb7b);}(_0x29a4,0x11f));var _0x429a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x29a4[_0xbd08b4];return _0x314f1e;};'use strict';var client=require('../client');exports[_0x429a('0x0')]=function(_0x1d6b2b){return client['Request'](_0x429a('0x1'),{'body':_0x1d6b2b,'log':'CreateMailQueueReport'});};exports[_0x429a('0x2')]=function(_0x3c4f78,_0x3ddf3e){return client[_0x429a('0x3')](_0x429a('0x4'),{'body':_0x3ddf3e,'options':{'where':{'uniqueid':_0x3c4f78},'order':[['id',_0x429a('0x5')]],'limit':0x1},'log':_0x429a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c7f4f26..84bb663 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 _0x70b0=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x420bc5,_0x12cb6d){var _0x5ac5fb=function(_0x1f064f){while(--_0x1f064f){_0x420bc5['push'](_0x420bc5['shift']());}};_0x5ac5fb(++_0x12cb6d);}(_0x70b0,0xe1));var _0x070b=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0x70b0[_0x51f4fc];return _0x4d96fc;};'use strict';var client=require(_0x070b('0x0'));exports[_0x070b('0x1')]=function(_0x27c9ab,_0x571034){return client[_0x070b('0x2')]('UpdateOpenchannelInteraction',{'body':_0x571034,'options':{'where':{'id':_0x27c9ab}},'log':_0x070b('0x3')});};exports[_0x070b('0x4')]=function(_0x19bf85,_0x4eeb69){return client[_0x070b('0x2')](_0x070b('0x5'),{'body':_0x4eeb69,'options':{'where':{'id':_0x19bf85}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xef89=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xef89,0xeb));var _0x9ef8=function(_0x468a4b,_0x46be00){_0x468a4b=_0x468a4b-0x0;var _0x174e06=_0xef89[_0x468a4b];return _0x174e06;};'use strict';var client=require(_0x9ef8('0x0'));exports[_0x9ef8('0x1')]=function(_0x2282bd,_0x253726){return client[_0x9ef8('0x2')](_0x9ef8('0x3'),{'body':_0x253726,'options':{'where':{'id':_0x2282bd}},'log':_0x9ef8('0x4')});};exports['addTags']=function(_0x42f895,_0x562995){return client[_0x9ef8('0x2')](_0x9ef8('0x5'),{'body':_0x562995,'options':{'where':{'id':_0x42f895}},'log':_0x9ef8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c54381c..0988b45 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 _0xd8e1=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x323708,_0x4bebf2){var _0x3da3d7=function(_0x5aa71c){while(--_0x5aa71c){_0x323708['push'](_0x323708['shift']());}};_0x3da3d7(++_0x4bebf2);}(_0xd8e1,0x143));var _0x1d8e=function(_0x414297,_0x18578e){_0x414297=_0x414297-0x0;var _0x51ea47=_0xd8e1[_0x414297];return _0x51ea47;};'use strict';var client=require('../client');exports[_0x1d8e('0x0')]=function(_0x5d38cd){return client[_0x1d8e('0x1')](_0x1d8e('0x2'),{'body':_0x5d38cd,'log':_0x1d8e('0x3')});}; \ No newline at end of file +var _0xb5d6=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xb5d6,0x194));var _0x6b5d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb5d6[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports['create']=function(_0xaac1b0){return client[_0x6b5d('0x0')](_0x6b5d('0x1'),{'body':_0xaac1b0,'log':_0x6b5d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3e0fbab..afc28f7 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 _0xc9d9=['online','../client','getOpenchannelQueues','Request','name','timeout','strategy','Agents'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xc9d9,0x141));var _0x9c9d=function(_0x50f8d1,_0x20029d){_0x50f8d1=_0x50f8d1-0x0;var _0x631016=_0xc9d9[_0x50f8d1];return _0x631016;};'use strict';var client=require(_0x9c9d('0x0'));exports[_0x9c9d('0x1')]=function(){return function(){return client[_0x9c9d('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x9c9d('0x3'),_0x9c9d('0x4'),_0x9c9d('0x5')],'include':[{'model':'User','as':_0x9c9d('0x6'),'attributes':['id',_0x9c9d('0x3'),_0x9c9d('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x2f76=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','online'];(function(_0x104d83,_0x97aa07){var _0x31d84e=function(_0x5c9560){while(--_0x5c9560){_0x104d83['push'](_0x104d83['shift']());}};_0x31d84e(++_0x97aa07);}(_0x2f76,0x1a5));var _0x62f7=function(_0x1a536b,_0x1f275e){_0x1a536b=_0x1a536b-0x0;var _0x10a2d5=_0x2f76[_0x1a536b];return _0x10a2d5;};'use strict';var client=require(_0x62f7('0x0'));exports[_0x62f7('0x1')]=function(){return function(){return client[_0x62f7('0x2')](_0x62f7('0x3'),{'options':{'raw':![],'attributes':['id',_0x62f7('0x4'),_0x62f7('0x5'),'strategy'],'include':[{'model':_0x62f7('0x6'),'as':_0x62f7('0x7'),'attributes':['id','name',_0x62f7('0x8'),_0x62f7('0x9')]}]},'log':_0x62f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e3ba140..1fd8917 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 _0xa0f2=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x10e1d5,_0x38f4ac){var _0x472678=function(_0x213ec4){while(--_0x213ec4){_0x10e1d5['push'](_0x10e1d5['shift']());}};_0x472678(++_0x38f4ac);}(_0xa0f2,0x19a));var _0x2a0f=function(_0x574c51,_0x17628b){_0x574c51=_0x574c51-0x0;var _0x233481=_0xa0f2[_0x574c51];return _0x233481;};'use strict';var client=require(_0x2a0f('0x0'));exports[_0x2a0f('0x1')]=function(_0x28558d){return client[_0x2a0f('0x2')](_0x2a0f('0x3'),{'body':_0x28558d,'log':_0x2a0f('0x3')});};exports[_0x2a0f('0x4')]=function(_0x263674,_0xe8e7e5){return client[_0x2a0f('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xe8e7e5,'options':{'where':{'uniqueid':_0x263674},'order':[['id',_0x2a0f('0x5')]],'limit':0x1},'log':_0x2a0f('0x6')});}; \ No newline at end of file +var _0x6ebe=['update','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x507c91,_0x3eb556){var _0x274171=function(_0xe67bb6){while(--_0xe67bb6){_0x507c91['push'](_0x507c91['shift']());}};_0x274171(++_0x3eb556);}(_0x6ebe,0x146));var _0xe6eb=function(_0x4761cc,_0x35f634){_0x4761cc=_0x4761cc-0x0;var _0x1198d1=_0x6ebe[_0x4761cc];return _0x1198d1;};'use strict';var client=require(_0xe6eb('0x0'));exports[_0xe6eb('0x1')]=function(_0x1f1250){return client[_0xe6eb('0x2')](_0xe6eb('0x3'),{'body':_0x1f1250,'log':_0xe6eb('0x3')});};exports[_0xe6eb('0x4')]=function(_0x1ab014,_0x2c1381){return client[_0xe6eb('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2c1381,'options':{'where':{'uniqueid':_0x1ab014},'order':[['id',_0xe6eb('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index fcaef38..08985fb 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 _0x269f=['Request','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update'];(function(_0x4a8832,_0x54ed9a){var _0x4084e6=function(_0x3830cb){while(--_0x3830cb){_0x4a8832['push'](_0x4a8832['shift']());}};_0x4084e6(++_0x54ed9a);}(_0x269f,0xee));var _0xf269=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x269f[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xf269('0x0'));exports[_0xf269('0x1')]=function(_0x31447d,_0x501fb4){return client[_0xf269('0x2')]('UpdateSmsInteraction',{'body':_0x501fb4,'options':{'where':{'id':_0x31447d}},'log':_0xf269('0x3')});};exports[_0xf269('0x4')]=function(_0x230d12,_0x22032a){return client[_0xf269('0x2')]('AddTagsToSmsInteraction',{'body':_0x22032a,'options':{'where':{'id':_0x230d12}},'log':_0xf269('0x5')});}; \ No newline at end of file +var _0x4abf=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','addTags'];(function(_0x95af52,_0x23ca0c){var _0x5101d2=function(_0x59e6bc){while(--_0x59e6bc){_0x95af52['push'](_0x95af52['shift']());}};_0x5101d2(++_0x23ca0c);}(_0x4abf,0xac));var _0xf4ab=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0x4abf[_0x49a57f];return _0x2fa2a5;};'use strict';var client=require(_0xf4ab('0x0'));exports[_0xf4ab('0x1')]=function(_0x5cddfe,_0x321a54){return client['Request']('UpdateSmsInteraction',{'body':_0x321a54,'options':{'where':{'id':_0x5cddfe}},'log':'updateSmsInteraction'});};exports[_0xf4ab('0x2')]=function(_0x4599f6,_0x592623){return client['Request'](_0xf4ab('0x3'),{'body':_0x592623,'options':{'where':{'id':_0x4599f6}},'log':_0xf4ab('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 7fce165..70877d0 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 _0x6deb=['../client','create','Request','CreateSmsMessage'];(function(_0x116378,_0x484a53){var _0x3161c1=function(_0xcd5de5){while(--_0xcd5de5){_0x116378['push'](_0x116378['shift']());}};_0x3161c1(++_0x484a53);}(_0x6deb,0xe8));var _0xb6de=function(_0x4629ff,_0x2e12ac){_0x4629ff=_0x4629ff-0x0;var _0x52dff1=_0x6deb[_0x4629ff];return _0x52dff1;};'use strict';var client=require(_0xb6de('0x0'));exports[_0xb6de('0x1')]=function(_0x4dde27){return client[_0xb6de('0x2')](_0xb6de('0x3'),{'body':_0x4dde27,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xa29a=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa29a,0x1ee));var _0xaa29=function(_0x3319c9,_0x15c3c4){_0x3319c9=_0x3319c9-0x0;var _0x4d21fe=_0xa29a[_0x3319c9];return _0x4d21fe;};'use strict';var client=require(_0xaa29('0x0'));exports['create']=function(_0x41e9b2){return client[_0xaa29('0x1')](_0xaa29('0x2'),{'body':_0x41e9b2,'log':_0xaa29('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e7b0a14..1e717ed 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x4c403d,_0x5ef49f){var _0x5a0c35=function(_0x40ba5a){while(--_0x40ba5a){_0x4c403d['push'](_0x4c403d['shift']());}};_0x5a0c35(++_0x5ef49f);}(_0x70e0,0x17b));var _0x070e=function(_0x276152,_0x25b911){_0x276152=_0x276152-0x0;var _0x5b7b74=_0x70e0[_0x276152];return _0x5b7b74;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x20550a,_0x4d59f4){var _0x3e58f9=function(_0x29d06b){while(--_0x29d06b){_0x20550a['push'](_0x20550a['shift']());}};_0x3e58f9(++_0x4d59f4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1a3b82b..b0c48f3 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xedd9,0xfc));var _0x9edd=function(_0x270659,_0x411894){_0x270659=_0x270659-0x0;var _0x4b9caa=_0xedd9[_0x270659];return _0x4b9caa;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0xb7203e,_0x97d39c){var _0x29e8df=function(_0x763660){while(--_0x763660){_0xb7203e['push'](_0xb7203e['shift']());}};_0x29e8df(++_0x97d39c);}(_0x34e8,0x12c));var _0x834e=function(_0x4c98f0,_0x19486d){_0x4c98f0=_0x4c98f0-0x0;var _0x360374=_0x34e8[_0x4c98f0];return _0x360374;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index a4563ca..585a26b 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(_0x225881,_0x29bc58){var _0x15a70e=function(_0x19ede4){while(--_0x19ede4){_0x225881['push'](_0x225881['shift']());}};_0x15a70e(++_0x29bc58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x32bddc,_0x5d3e25){var _0x4cdc30=function(_0x4659f1){while(--_0x4659f1){_0x32bddc['push'](_0x32bddc['shift']());}};_0x4cdc30(++_0x5d3e25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 5fe5a90..f927209 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 _0x398a=['../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x398a,0x11a));var _0xa398=function(_0x29a9ac,_0x48964d){_0x29a9ac=_0x29a9ac-0x0;var _0x1fdc95=_0x398a[_0x29a9ac];return _0x1fdc95;};'use strict';var client=require(_0xa398('0x0'));exports[_0xa398('0x1')]=function(_0x279618,_0x1930a3){return client[_0xa398('0x2')](_0xa398('0x3'),{'body':_0x1930a3,'options':{'where':{'id':_0x279618}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x51a35c,_0x29c575){return client[_0xa398('0x2')](_0xa398('0x4'),{'body':_0x29c575,'options':{'where':{'id':_0x51a35c}},'log':_0xa398('0x5')});}; \ No newline at end of file +var _0x326f=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x716faa,_0x43dca4){var _0x50e13b=function(_0x374872){while(--_0x374872){_0x716faa['push'](_0x716faa['shift']());}};_0x50e13b(++_0x43dca4);}(_0x326f,0xd1));var _0xf326=function(_0x518c06,_0x3d1a05){_0x518c06=_0x518c06-0x0;var _0x28d642=_0x326f[_0x518c06];return _0x28d642;};'use strict';var client=require(_0xf326('0x0'));exports['update']=function(_0x5452cc,_0x1d7a51){return client[_0xf326('0x1')](_0xf326('0x2'),{'body':_0x1d7a51,'options':{'where':{'id':_0x5452cc}},'log':_0xf326('0x3')});};exports[_0xf326('0x4')]=function(_0x120a26,_0x9445c6){return client[_0xf326('0x1')](_0xf326('0x5'),{'body':_0x9445c6,'options':{'where':{'id':_0x120a26}},'log':_0xf326('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index cb6b3df..d2e820d 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 _0x7765=['create','Request','createWhatsappMessage','../client'];(function(_0x1f9e6e,_0xfb021){var _0x5308ff=function(_0x22e596){while(--_0x22e596){_0x1f9e6e['push'](_0x1f9e6e['shift']());}};_0x5308ff(++_0xfb021);}(_0x7765,0xfb));var _0x5776=function(_0x239496,_0xcf4b0c){_0x239496=_0x239496-0x0;var _0xefea8f=_0x7765[_0x239496];return _0xefea8f;};'use strict';var client=require(_0x5776('0x0'));exports[_0x5776('0x1')]=function(_0x4ec1f7){return client[_0x5776('0x2')]('CreateWhatsappMessage',{'body':_0x4ec1f7,'log':_0x5776('0x3')});}; \ No newline at end of file +var _0x5f46=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x364df5,_0x34c8cc){var _0xef86ef=function(_0x519e5b){while(--_0x519e5b){_0x364df5['push'](_0x364df5['shift']());}};_0xef86ef(++_0x34c8cc);}(_0x5f46,0x159));var _0x65f4=function(_0x247583,_0x5a8133){_0x247583=_0x247583-0x0;var _0x23562b=_0x5f46[_0x247583];return _0x23562b;};'use strict';var client=require(_0x65f4('0x0'));exports[_0x65f4('0x1')]=function(_0x468458){return client[_0x65f4('0x2')](_0x65f4('0x3'),{'body':_0x468458,'log':_0x65f4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 89d6941..11e8647 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 _0xcf10=['online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','timeout','User','Agents','name'];(function(_0x28c047,_0x5e77fa){var _0x442057=function(_0x5ec790){while(--_0x5ec790){_0x28c047['push'](_0x28c047['shift']());}};_0x442057(++_0x5e77fa);}(_0xcf10,0x1d6));var _0x0cf1=function(_0x3cae30,_0x5d8b99){_0x3cae30=_0x3cae30-0x0;var _0x263f77=_0xcf10[_0x3cae30];return _0x263f77;};'use strict';var client=require('../client');exports[_0x0cf1('0x0')]=function(){return function(){return client[_0x0cf1('0x1')](_0x0cf1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0cf1('0x3'),'strategy'],'include':[{'model':_0x0cf1('0x4'),'as':_0x0cf1('0x5'),'attributes':['id',_0x0cf1('0x6'),_0x0cf1('0x7'),_0x0cf1('0x8')]}]},'log':_0x0cf1('0x0')});};}; \ No newline at end of file +var _0x461f=['Request','GetWhatsappQueue','name','strategy','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x461f,0x177));var _0xf461=function(_0x5f4777,_0x1df9ba){_0x5f4777=_0x5f4777-0x0;var _0x187998=_0x461f[_0x5f4777];return _0x187998;};'use strict';var client=require('../client');exports[_0xf461('0x0')]=function(){return function(){return client[_0xf461('0x1')](_0xf461('0x2'),{'options':{'raw':![],'attributes':['id',_0xf461('0x3'),'timeout',_0xf461('0x4')],'include':[{'model':'User','as':_0xf461('0x5'),'attributes':['id',_0xf461('0x3'),_0xf461('0x6'),_0xf461('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 e3b3ef7..0007335 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 _0x9f01=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x5a32b9,_0x154d11){var _0x23c709=function(_0x457328){while(--_0x457328){_0x5a32b9['push'](_0x5a32b9['shift']());}};_0x23c709(++_0x154d11);}(_0x9f01,0x1c1));var _0x19f0=function(_0x50d9cc,_0xa18a88){_0x50d9cc=_0x50d9cc-0x0;var _0x142e45=_0x9f01[_0x50d9cc];return _0x142e45;};'use strict';var client=require(_0x19f0('0x0'));exports[_0x19f0('0x1')]=function(_0x10f92a){return client[_0x19f0('0x2')](_0x19f0('0x3'),{'body':_0x10f92a,'log':_0x19f0('0x3')});};exports['update']=function(_0x10d688,_0xd81d23){return client['Request'](_0x19f0('0x4'),{'body':_0xd81d23,'options':{'where':{'uniqueid':_0x10d688},'order':[['id',_0x19f0('0x5')]],'limit':0x1},'log':_0x19f0('0x4')});}; \ No newline at end of file +var _0xd443=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xd443,0x122));var _0x3d44=function(_0x439a95,_0x3f2636){_0x439a95=_0x439a95-0x0;var _0x16393f=_0xd443[_0x439a95];return _0x16393f;};'use strict';var client=require(_0x3d44('0x0'));exports[_0x3d44('0x1')]=function(_0x24c1a6){return client[_0x3d44('0x2')](_0x3d44('0x3'),{'body':_0x24c1a6,'log':'CreateWhatsappQueueReport'});};exports[_0x3d44('0x4')]=function(_0x406e55,_0x48a4d0){return client[_0x3d44('0x2')](_0x3d44('0x5'),{'body':_0x48a4d0,'options':{'where':{'uniqueid':_0x406e55},'order':[['id','DESC']],'limit':0x1},'log':_0x3d44('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index fb6a35e..5caf3aa 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 _0xdfb2=['rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','find','agents','timeout','createQueue','atimeout','channel','format','end','close'];(function(_0x37e6b0,_0x3bd7ab){var _0x4f381f=function(_0x481a28){while(--_0x481a28){_0x37e6b0['push'](_0x37e6b0['shift']());}};_0x4f381f(++_0x3bd7ab);}(_0xdfb2,0xe8));var _0x2dfb=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xdfb2[_0x13ea00];return _0x1f7347;};'use strict';var schema=require(_0x2dfb('0x0'));var _=require('lodash');var util=require(_0x2dfb('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x2dfb('0x2'))(_0x2dfb('0x3'));var strategy=require(_0x2dfb('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x2dfb('0x5')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x34dc77,_0x306c6c,_0x54254b){return logger[_0x2dfb('0x6')](util['format'](_0x2dfb('0x7'),_0x34dc77,_0x306c6c[_0x2dfb('0x8')],_0x54254b));}function handleFindAgent(_0x897fe5){return function(_0x2ccf87){return _0x2ccf87['name'][_0x2dfb('0x9')]()===_0x897fe5[_0x2dfb('0x9')]();};}exports[_0x2dfb('0xa')]=function(_0x489e92,_0x40eb9a,_0x9b073a,_0x1467c5){return function(_0x15b0be){try{var _0x3e1d3c={'name':_0x40eb9a[0x0],'timeout':_0x40eb9a[0x1]};var _0x13a174=queue[_0x2dfb('0x0')](_0x3e1d3c,{'typecast':!![]});if(_0x13a174[_0x2dfb('0xb')]){logger['error'](_0x2dfb('0xc'),_0x489e92,_[_0x2dfb('0xd')](_0x13a174,_0x2dfb('0xe'))['join'](',\x20'));_0x15b0be['stop']();}else{var _0x4166e3=_[_0x2dfb('0xf')](_0x9b073a[_0x2dfb('0x10')],handleFindAgent(_0x3e1d3c['name']));if(_0x4166e3){var _0x32e743=(_0x3e1d3c[_0x2dfb('0x11')]||0xa)*0x3e8;var _0x11ed58,_0x1797f4;var _0x128876=seqqueue[_0x2dfb('0x12')](_0x32e743);_0x128876['id']=_0x489e92;_0x128876[_0x2dfb('0x13')]=_0x32e743;_0x128876['channel']=_0x1467c5[_0x2dfb('0x14')];writeLog(_0x489e92,_0x4166e3,util[_0x2dfb('0x15')]('START:%s',_0x32e743));_0x9b073a['rules'][_0x489e92]['on'](_0x2dfb('0x16'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x489e92);clearTimeout(_0x1797f4);_0x1797f4=undefined;_0x128876[_0x2dfb('0x17')]();if(_0x9b073a[_0x2dfb('0x18')][_0x489e92]){delete _0x9b073a['rules'][_0x489e92];}_0x15b0be[_0x2dfb('0x19')]();});_0x9b073a[_0x2dfb('0x18')][_0x489e92]['on'](_0x2dfb('0x1a'),function(){if(_0x9b073a[_0x2dfb('0x18')][_0x489e92]){delete _0x9b073a[_0x2dfb('0x18')][_0x489e92];}});_0x1797f4=setTimeout(function(){logger[_0x2dfb('0x6')](_0x2dfb('0x1b'),_0x489e92);clearTimeout(_0x1797f4);_0x128876[_0x2dfb('0x17')]();_0x15b0be['next']();},_0x32e743);strategy[_0x2dfb('0x1c')](_0x128876,_0x4166e3,_0x9b073a,_0x1467c5);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x489e92,_0x3e1d3c[_0x2dfb('0x8')]);_0x15b0be[_0x2dfb('0x19')]();}}}catch(_0x461c6e){console[_0x2dfb('0x1d')](_0x461c6e);logger['error'](_0x2dfb('0x1e'),_0x489e92,_0x461c6e[_0x2dfb('0x1f')]);_0x15b0be[_0x2dfb('0x19')]();}};}; \ No newline at end of file +var _0xc9f9=['error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length'];(function(_0x56bb19,_0x4f2136){var _0x1d1475=function(_0x4e7762){while(--_0x4e7762){_0x56bb19['push'](_0x56bb19['shift']());}};_0x1d1475(++_0x4f2136);}(_0xc9f9,0x1d1));var _0x9c9f=function(_0x37be14,_0x3d78de){_0x37be14=_0x37be14-0x0;var _0x4a089e=_0xc9f9[_0x37be14];return _0x4a089e;};'use strict';var schema=require('validate');var _=require(_0x9c9f('0x0'));var util=require(_0x9c9f('0x1'));var seqqueue=require(_0x9c9f('0x2'));var logger=require(_0x9c9f('0x3'))(_0x9c9f('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9c9f('0x5')},'timeout':{'type':_0x9c9f('0x6'),'message':_0x9c9f('0x7')}});function writeLog(_0x138903,_0x1dc695,_0x4018a0){return logger[_0x9c9f('0x8')](util[_0x9c9f('0x9')](_0x9c9f('0xa'),_0x138903,_0x1dc695[_0x9c9f('0xb')],_0x4018a0));}function handleFindAgent(_0x411f3a){return function(_0x3290d0){return _0x3290d0['name'][_0x9c9f('0xc')]()===_0x411f3a['toLowerCase']();};}exports[_0x9c9f('0xd')]=function(_0x15879c,_0x33c8e1,_0x588085,_0x4a0e6b){return function(_0x259afe){try{var _0x7ac1={'name':_0x33c8e1[0x0],'timeout':_0x33c8e1[0x1]};var _0x9e6bd0=queue[_0x9c9f('0xe')](_0x7ac1,{'typecast':!![]});if(_0x9e6bd0[_0x9c9f('0xf')]){logger[_0x9c9f('0x10')](_0x9c9f('0x11'),_0x15879c,_[_0x9c9f('0x12')](_0x9e6bd0,_0x9c9f('0x13'))[_0x9c9f('0x14')](',\x20'));_0x259afe[_0x9c9f('0x15')]();}else{var _0x3e8091=_['find'](_0x588085[_0x9c9f('0x16')],handleFindAgent(_0x7ac1[_0x9c9f('0xb')]));if(_0x3e8091){var _0x15f949=(_0x7ac1[_0x9c9f('0x17')]||0xa)*0x3e8;var _0x3abdac,_0x2a5445;var _0xe8b881=seqqueue[_0x9c9f('0x18')](_0x15f949);_0xe8b881['id']=_0x15879c;_0xe8b881[_0x9c9f('0x19')]=_0x15f949;_0xe8b881[_0x9c9f('0x1a')]=_0x4a0e6b['channel'];writeLog(_0x15879c,_0x3e8091,util[_0x9c9f('0x9')](_0x9c9f('0x1b'),_0x15f949));_0x588085[_0x9c9f('0x1c')][_0x15879c]['on']('end',function(){logger[_0x9c9f('0x8')](_0x9c9f('0x1d'),_0x15879c);clearTimeout(_0x2a5445);_0x2a5445=undefined;_0xe8b881[_0x9c9f('0x1e')]();if(_0x588085[_0x9c9f('0x1c')][_0x15879c]){delete _0x588085[_0x9c9f('0x1c')][_0x15879c];}_0x259afe[_0x9c9f('0x15')]();});_0x588085[_0x9c9f('0x1c')][_0x15879c]['on']('complete',function(){if(_0x588085['rules'][_0x15879c]){delete _0x588085['rules'][_0x15879c];}});_0x2a5445=setTimeout(function(){logger[_0x9c9f('0x8')](_0x9c9f('0x1f'),_0x15879c);clearTimeout(_0x2a5445);_0xe8b881[_0x9c9f('0x1e')]();_0x259afe['next']();},_0x15f949);strategy[_0x9c9f('0x20')](_0xe8b881,_0x3e8091,_0x588085,_0x4a0e6b);}else{logger[_0x9c9f('0x10')](_0x9c9f('0x21'),_0x15879c,_0x7ac1['name']);_0x259afe['stop']();}}}catch(_0x3e2ebc){console[_0x9c9f('0x22')](_0x3e2ebc);logger[_0x9c9f('0x10')](_0x9c9f('0x23'),_0x15879c,_0x3e2ebc[_0x9c9f('0x24')]);_0x259afe[_0x9c9f('0x15')]();}};}; \ 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 fa432ac..47eac4a 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 _0x1c65=['catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','message','amazonlex','providerName','providerResponse','Message','dialogState','Failed','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%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','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info'];(function(_0x5aaf93,_0x5c0001){var _0x17d307=function(_0x21d77a){while(--_0x21d77a){_0x5aaf93['push'](_0x5aaf93['shift']());}};_0x17d307(++_0x5c0001);}(_0x1c65,0x1b9));var _0x51c6=function(_0x55d089,_0xb24c07){_0x55d089=_0x55d089-0x0;var _0x4ff4e2=_0x1c65[_0x55d089];return _0x4ff4e2;};'use strict';var _=require(_0x51c6('0x0'));var moment=require(_0x51c6('0x1'));var AWS=require(_0x51c6('0x2'));var utils=require(_0x51c6('0x3'));var logger=require(_0x51c6('0x4'))('routing');var rpc={'chatMessage':require(_0x51c6('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x51c6('0x6')),'smsMessage':require(_0x51c6('0x7')),'faxMessage':require(_0x51c6('0x8')),'whatsappMessage':require(_0x51c6('0x9'))};exports[_0x51c6('0xa')]=function(_0x41469f,_0x2fb0b2){return function(_0x14d58a){try{if(!_[_0x51c6('0xb')](this[_0x51c6('0xc')][_0x51c6('0xd')])){logger['info'](_0x51c6('0xe'),_0x41469f,_0x51c6('0xf'));return _0x14d58a[_0x51c6('0x10')]();}var _0x547297={'ContactId':this[_0x51c6('0x11')]['id'],'sentAt':moment()[_0x51c6('0x12')](_0x51c6('0x13')),'direction':_0x51c6('0x14')};if(this[_0x51c6('0x15')]===_0x51c6('0x16')||this[_0x51c6('0x15')]==='whatsapp'){_0x547297[_0x51c6('0x17')]=this[_0x51c6('0xc')][_0x51c6('0x17')];}var _0x5741e4=this[_0x51c6('0x15')];if(_0x5741e4===_0x51c6('0x18')){_0x547297[_0x51c6('0x19')]=this[_0x51c6('0x1a')]['id'];}else{_0x547297[_[_0x51c6('0x1b')](_0x5741e4)+'AccountId']=this[_0x51c6('0x1a')]['id'];}_0x547297[_[_0x51c6('0x1b')](_0x5741e4)+_0x51c6('0x1c')]=this[_0x51c6('0xc')]['id'];if(this[_0x51c6('0xc')][_0x51c6('0x1d')]){var _0x3a355c=_0x2fb0b2[0x4];if(!_[_0x51c6('0x1e')](_0x3a355c)){_0x547297[_0x51c6('0x1f')]=utils[_0x51c6('0x20')](_0x3a355c,this);return rpc[_0x5741e4+'Message'][_0x51c6('0x21')](_0x547297)[_0x51c6('0x22')](function(_0x197fc3){logger[_0x51c6('0x23')](_0x51c6('0xe'),_0x41469f,_0x547297[_0x51c6('0x1f')]);})[_0x51c6('0x24')](function(_0x54d9b4){logger[_0x51c6('0x25')]('[%s][AMAZONLEX]\x20%s',_0x41469f,JSON[_0x51c6('0x26')](_0x54d9b4));})[_0x51c6('0x27')](function(){logger[_0x51c6('0x23')](_0x51c6('0x28'),_0x41469f);_0x14d58a['stop']();});}else{logger[_0x51c6('0x23')](_0x51c6('0x29'),_0x41469f);_0x14d58a['stop']();}}else{var _0x55cb22=this;var _0x2e518d=new AWS[(_0x51c6('0x2a'))]({'accessKeyId':_0x2fb0b2[0x0],'secretAccessKey':_0x2fb0b2[0x1],'region':_0x2fb0b2[0x2]});var _0x3cc225={'botAlias':_0x51c6('0x2b'),'botName':_0x2fb0b2[0x3],'inputText':this['message'][_0x51c6('0x1f')],'userId':this['channel']+':'+this[_0x51c6('0xc')]['id'][_0x51c6('0x2c')]()};_0x2e518d['postText'](_0x3cc225,function(_0xfda46d,_0x405bf7){if(_0xfda46d){logger[_0x51c6('0x25')](_0x51c6('0xe'),_0x41469f,_0xfda46d[_0x51c6('0x2d')]);_0x14d58a[_0x51c6('0x10')]();}else if(_0x405bf7&&_0x405bf7[_0x51c6('0x2d')]){_0x55cb22[_0x51c6('0x1f')][_0x51c6('0x2e')]=_0x405bf7;_0x547297[_0x51c6('0x1f')]=_0x405bf7[_0x51c6('0x2d')];_0x547297[_0x51c6('0x2f')]=_0x51c6('0x2e');_0x547297[_0x51c6('0x30')]=JSON['stringify'](_0x405bf7);return rpc[_0x5741e4+_0x51c6('0x31')][_0x51c6('0x21')](_0x547297)[_0x51c6('0x22')](function(_0x41a6e1){logger[_0x51c6('0x23')](_0x51c6('0xe'),_0x41469f,_0x547297[_0x51c6('0x1f')]);if(_0x405bf7[_0x51c6('0x32')]==_0x51c6('0x33')){_0x14d58a[_0x51c6('0x10')]();}else{_0x14d58a[_0x51c6('0x34')]();}})[_0x51c6('0x24')](function(_0x201008){logger[_0x51c6('0x25')](_0x51c6('0xe'),_0x41469f,JSON[_0x51c6('0x26')](_0x201008));_0x14d58a['next']();});}else{_0x14d58a[_0x51c6('0x10')]();}});}}catch(_0x334563){logger['error'](_0x51c6('0xe'),_0x41469f,JSON['stringify'](_0x334563));_0x14d58a['stop']();}};}; \ No newline at end of file +var _0x6a49=['create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','then','dialogState','lodash','moment','aws-sdk','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x6a49,0x9b));var _0x96a4=function(_0x3bc509,_0x4b208f){_0x3bc509=_0x3bc509-0x0;var _0x21c169=_0x6a49[_0x3bc509];return _0x21c169;};'use strict';var _=require(_0x96a4('0x0'));var moment=require(_0x96a4('0x1'));var AWS=require(_0x96a4('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x96a4('0x3')),'mailMessage':require(_0x96a4('0x4')),'smsMessage':require(_0x96a4('0x5')),'faxMessage':require(_0x96a4('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x96a4('0x7')]=function(_0x293689,_0x574ba8){return function(_0xf3fb03){try{if(!_[_0x96a4('0x8')](this['interaction'][_0x96a4('0x9')])){logger[_0x96a4('0xa')](_0x96a4('0xb'),_0x293689,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xf3fb03[_0x96a4('0xc')]();}var _0x59034a={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x96a4('0xd')),'direction':_0x96a4('0xe')};if(this[_0x96a4('0xf')]===_0x96a4('0x10')||this[_0x96a4('0xf')]===_0x96a4('0x11')){_0x59034a[_0x96a4('0x12')]=this[_0x96a4('0x13')]['phone'];}var _0xdcdb57=this[_0x96a4('0xf')];if(_0xdcdb57==='chat'){_0x59034a[_0x96a4('0x14')]=this[_0x96a4('0x15')]['id'];}else{_0x59034a[_[_0x96a4('0x16')](_0xdcdb57)+_0x96a4('0x17')]=this['account']['id'];}_0x59034a[_[_0x96a4('0x16')](_0xdcdb57)+'InteractionId']=this[_0x96a4('0x13')]['id'];if(this[_0x96a4('0x13')][_0x96a4('0x18')]){var _0x55baee=_0x574ba8[0x4];if(!_[_0x96a4('0x19')](_0x55baee)){_0x59034a[_0x96a4('0x1a')]=utils[_0x96a4('0x1b')](_0x55baee,this);return rpc[_0xdcdb57+_0x96a4('0x1c')][_0x96a4('0x1d')](_0x59034a)['then'](function(_0x21b1d1){logger[_0x96a4('0xa')](_0x96a4('0xb'),_0x293689,_0x59034a['body']);})[_0x96a4('0x1e')](function(_0x4aab87){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,JSON[_0x96a4('0x20')](_0x4aab87));})[_0x96a4('0x21')](function(){logger[_0x96a4('0xa')](_0x96a4('0x22'),_0x293689);_0xf3fb03[_0x96a4('0x23')]();});}else{logger[_0x96a4('0xa')](_0x96a4('0x24'),_0x293689);_0xf3fb03[_0x96a4('0x23')]();}}else{var _0x5dc779=this;var _0x1db6c3=new AWS['LexRuntime']({'accessKeyId':_0x574ba8[0x0],'secretAccessKey':_0x574ba8[0x1],'region':_0x574ba8[0x2]});var _0x2c68f4={'botAlias':_0x96a4('0x25'),'botName':_0x574ba8[0x3],'inputText':this[_0x96a4('0x26')][_0x96a4('0x1a')],'userId':this['channel']+':'+this[_0x96a4('0x13')]['id'][_0x96a4('0x27')]()};_0x1db6c3[_0x96a4('0x28')](_0x2c68f4,function(_0x3160af,_0x5a12f2){if(_0x3160af){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,_0x3160af[_0x96a4('0x26')]);_0xf3fb03[_0x96a4('0xc')]();}else if(_0x5a12f2&&_0x5a12f2['message']){_0x5dc779[_0x96a4('0x1a')][_0x96a4('0x29')]=_0x5a12f2;_0x59034a[_0x96a4('0x1a')]=_0x5a12f2['message'];_0x59034a[_0x96a4('0x2a')]=_0x96a4('0x29');_0x59034a[_0x96a4('0x2b')]=JSON['stringify'](_0x5a12f2);return rpc[_0xdcdb57+_0x96a4('0x1c')]['create'](_0x59034a)[_0x96a4('0x2c')](function(_0x2693cb){logger['info']('[%s][AMAZONLEX]\x20%s',_0x293689,_0x59034a[_0x96a4('0x1a')]);if(_0x5a12f2[_0x96a4('0x2d')]=='Failed'){_0xf3fb03[_0x96a4('0xc')]();}else{_0xf3fb03[_0x96a4('0x23')]();}})['catch'](function(_0xfda478){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,JSON['stringify'](_0xfda478));_0xf3fb03[_0x96a4('0xc')]();});}else{_0xf3fb03[_0x96a4('0xc')]();}});}}catch(_0x34f5f0){logger[_0x96a4('0x1f')](_0x96a4('0xb'),_0x293689,JSON[_0x96a4('0x20')](_0x34f5f0));_0xf3fb03['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 295d9a6..59bbe04 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 _0xf56d=['Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','Autoreply\x20already\x20sent','next','autoreplyExecuted','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','body','message','from','phone','read','subject'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf56d,0x176));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdf56('0x0'));var moment=require(_0xdf56('0x1'));var utils=require(_0xdf56('0x2'));var logger=require(_0xdf56('0x3'))(_0xdf56('0x4'));var rpc={'chatMessage':require(_0xdf56('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xdf56('0x6')),'mailInteraction':require(_0xdf56('0x7')),'smsInteraction':require(_0xdf56('0x8')),'faxInteraction':require(_0xdf56('0x9')),'whatsappInteraction':require(_0xdf56('0xa'))};var mailRpc=require(_0xdf56('0xb'));exports[_0xdf56('0xc')]=function(_0x27fe8f,_0x13a288,_0x42d953,_0x15dff5){return function(_0x1c4ee0){try{var _0x1820fe=this[_0xdf56('0xd')];if(_0x1820fe===_0xdf56('0xe')&&_0x15dff5['body'][_0xdf56('0xf')]){logger[_0xdf56('0x10')](_0xdf56('0x11'),_0x27fe8f,_0xdf56('0x12'));return _0x1c4ee0['next']();}if(_0x13a288[0x0]==='1'&&(_[_0xdf56('0x13')](this['interaction'][_0xdf56('0x14')])||!this[_0xdf56('0x15')][_0xdf56('0x14')])){logger[_0xdf56('0x10')](_0xdf56('0x11'),_0x27fe8f,_0xdf56('0x16'));return _0x1c4ee0[_0xdf56('0x17')]();}if(_0x13a288[0x0]==='2'&&this[_0xdf56('0x15')][_0xdf56('0x18')]){logger[_0xdf56('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x27fe8f,_0xdf56('0x19'));return _0x1c4ee0[_0xdf56('0x17')]();}var _0x57583f={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xdf56('0x1a')),'direction':_0xdf56('0x1b')};if(this['channel']===_0xdf56('0xe')){_0x57583f[_0xdf56('0x1c')]=utils['getMustacheRender'](_0x13a288[0x2],this);}else{_0x57583f['body']=utils['getMustacheRender'](_0x13a288[0x1],this);}if(this[_0xdf56('0x1d')]){_0x57583f['to']=this['message'][_0xdf56('0x1e')]||'';if(this['channel']===_0xdf56('0xe')&&_0x13a288[0x1]==='1'){_0x57583f['cc']=this[_0xdf56('0x1d')]['cc']||'';}_0x57583f[_0xdf56('0x1e')]=this[_0xdf56('0x1d')]['to']||'';_0x57583f[_0xdf56('0x1f')]=this['message'][_0xdf56('0x1f')]||'';_0x57583f[_0xdf56('0x20')]=!![];if(this['message'][_0xdf56('0x21')]){_0x57583f['subject']='';_0x57583f[_0xdf56('0x21')]+=_['startsWith'](this[_0xdf56('0x1d')][_0xdf56('0x21')],_0xdf56('0x22'))?'':_0xdf56('0x23');_0x57583f['subject']+=this['message']['subject'];}}if(this[_0xdf56('0xd')]==='chat'){_0x57583f['ChatWebsiteId']=this[_0xdf56('0x24')]['id'];}else{_0x57583f[_[_0xdf56('0x25')](this['channel'])+_0xdf56('0x26')]=this[_0xdf56('0x24')]['id'];}_0x57583f[_['upperFirst'](this[_0xdf56('0xd')])+_0xdf56('0x27')]=this[_0xdf56('0x15')]['id'];var _0x3c55db=this[_0xdf56('0x15')];if(rpc[this[_0xdf56('0xd')]+'Message']){if(this['channel']===_0xdf56('0xe')){_0x57583f[_0xdf56('0x28')]=this['message'][_0xdf56('0x29')];_0x57583f[_0xdf56('0x2a')]=_0xdf56('0x2b')+_[_0xdf56('0x2c')](_0x57583f[_0xdf56('0x1c')],_0xdf56('0x2d'),_0xdf56('0x2e'))+_0xdf56('0x2f');_0x57583f['headers']={'Auto-Submitted':_0xdf56('0x30'),'X-Auto-Response-Suppress':_0xdf56('0x31'),'Precedence':_0xdf56('0x32')};return mailRpc[_0xdf56('0x33')](this[_0xdf56('0x24')][_0xdf56('0x34')],_0x57583f)[_0xdf56('0x35')](function(_0x1188e3){logger['info'](_0xdf56('0x36'),_0x27fe8f);_0x57583f[_0xdf56('0x29')]=_0x1188e3[_0xdf56('0x1d')][_0xdf56('0x29')];return rpc[_0x1820fe+_0xdf56('0x37')][_0xdf56('0x38')](_0x57583f);})[_0xdf56('0x35')](function(_0x451cc0){logger[_0xdf56('0x10')](_0xdf56('0x11'),_0x27fe8f,JSON[_0xdf56('0x39')](_0x451cc0));})[_0xdf56('0x3a')](function(_0x341a64){logger['error'](_0xdf56('0x3b'),_0x27fe8f,JSON[_0xdf56('0x39')](_0x341a64));})[_0xdf56('0x3c')](function(){Promise[_0xdf56('0x3d')]()[_0xdf56('0x35')](function(){if(_0x13a288[0x0]!=='2'||_0x3c55db[_0xdf56('0x18')])return;return rpc[_0x1820fe+'Interaction'][_0xdf56('0x3e')](_0x3c55db['id'],{'autoreplyExecuted':!![]})[_0xdf56('0x35')](function(_0x339f7a){logger[_0xdf56('0x10')](_0xdf56('0x3f'),_0x27fe8f,JSON['stringify'](_0x339f7a));})[_0xdf56('0x3a')](function(_0x2c51c1){logger[_0xdf56('0x40')](_0xdf56('0x41'),_0x27fe8f,JSON[_0xdf56('0x39')](_0x2c51c1));});})[_0xdf56('0x35')](function(){_0x1c4ee0[_0xdf56('0x17')]();});});}else{return rpc[this[_0xdf56('0xd')]+'Message'][_0xdf56('0x38')](_0x57583f)[_0xdf56('0x35')](function(){logger[_0xdf56('0x10')](_0xdf56('0x11'),_0x27fe8f,_0x57583f['body']);})['catch'](function(_0x1529da){logger[_0xdf56('0x40')](_0xdf56('0x11'),_0x27fe8f,JSON[_0xdf56('0x39')](_0x1529da));})[_0xdf56('0x3c')](function(){Promise['resolve']()['then'](function(){if(_0x13a288[0x0]!=='2'||_0x3c55db[_0xdf56('0x18')])return;return rpc[_0x1820fe+_0xdf56('0x42')][_0xdf56('0x3e')](_0x3c55db['id'],{'autoreplyExecuted':!![]})[_0xdf56('0x35')](function(_0x6cf7e9){logger[_0xdf56('0x10')](_0xdf56('0x3f'),_0x27fe8f,JSON[_0xdf56('0x39')](_0x6cf7e9));})['catch'](function(_0x57939c){logger[_0xdf56('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x27fe8f,JSON[_0xdf56('0x39')](_0x57939c));});})['then'](function(){_0x1c4ee0[_0xdf56('0x17')]();});});}}}catch(_0x577ecc){logger['error']('[%s][AUTOREPLY]\x20%s',_0x27fe8f,JSON[_0xdf56('0x39')](_0x577ecc));_0x1c4ee0[_0xdf56('0x43')]();}};}; \ No newline at end of file +var _0xf313=['[%s][AUTOREPLY]\x20%s','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','inReplyTo','html','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf313,0xe6));var _0x3f31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf313[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x3f31('0x0'));var moment=require(_0x3f31('0x1'));var utils=require(_0x3f31('0x2'));var logger=require(_0x3f31('0x3'))(_0x3f31('0x4'));var rpc={'chatMessage':require(_0x3f31('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3f31('0x6')),'smsMessage':require(_0x3f31('0x7')),'faxMessage':require(_0x3f31('0x8')),'whatsappMessage':require(_0x3f31('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x3f31('0xa')),'faxInteraction':require(_0x3f31('0xb')),'whatsappInteraction':require(_0x3f31('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3b3a3b,_0x5d6b9d,_0x5cc77b,_0x29cf1e){return function(_0xced047){try{var _0x19da82=this[_0x3f31('0xd')];if(_0x19da82===_0x3f31('0xe')&&_0x29cf1e[_0x3f31('0xf')][_0x3f31('0x10')]){logger[_0x3f31('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,_0x3f31('0x12'));return _0xced047[_0x3f31('0x13')]();}if(_0x5d6b9d[0x0]==='1'&&(_[_0x3f31('0x14')](this['interaction'][_0x3f31('0x15')])||!this['interaction'][_0x3f31('0x15')])){logger[_0x3f31('0x11')]('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,_0x3f31('0x16'));return _0xced047['next']();}if(_0x5d6b9d[0x0]==='2'&&this['interaction'][_0x3f31('0x17')]){logger['info'](_0x3f31('0x18'),_0x3b3a3b,_0x3f31('0x19'));return _0xced047[_0x3f31('0x13')]();}var _0x5137e9={'ContactId':this[_0x3f31('0x1a')]['id'],'sentAt':moment()[_0x3f31('0x1b')](_0x3f31('0x1c')),'direction':_0x3f31('0x1d')};if(this[_0x3f31('0xd')]==='mail'){_0x5137e9[_0x3f31('0xf')]=utils[_0x3f31('0x1e')](_0x5d6b9d[0x2],this);}else{_0x5137e9[_0x3f31('0xf')]=utils[_0x3f31('0x1e')](_0x5d6b9d[0x1],this);}if(this[_0x3f31('0x1f')]){_0x5137e9['to']=this['message'][_0x3f31('0x20')]||'';if(this[_0x3f31('0xd')]===_0x3f31('0xe')&&_0x5d6b9d[0x1]==='1'){_0x5137e9['cc']=this[_0x3f31('0x1f')]['cc']||'';}_0x5137e9[_0x3f31('0x20')]=this[_0x3f31('0x1f')]['to']||'';_0x5137e9['phone']=this['message'][_0x3f31('0x21')]||'';_0x5137e9['read']=!![];if(this[_0x3f31('0x1f')][_0x3f31('0x22')]){_0x5137e9[_0x3f31('0x22')]='';_0x5137e9[_0x3f31('0x22')]+=_[_0x3f31('0x23')](this[_0x3f31('0x1f')][_0x3f31('0x22')],_0x3f31('0x24'))?'':_0x3f31('0x25');_0x5137e9[_0x3f31('0x22')]+=this['message']['subject'];}}if(this[_0x3f31('0xd')]===_0x3f31('0x26')){_0x5137e9[_0x3f31('0x27')]=this[_0x3f31('0x28')]['id'];}else{_0x5137e9[_[_0x3f31('0x29')](this[_0x3f31('0xd')])+_0x3f31('0x2a')]=this[_0x3f31('0x28')]['id'];}_0x5137e9[_[_0x3f31('0x29')](this['channel'])+_0x3f31('0x2b')]=this[_0x3f31('0x2c')]['id'];var _0x390ee9=this['interaction'];if(rpc[this[_0x3f31('0xd')]+_0x3f31('0x2d')]){if(this[_0x3f31('0xd')]===_0x3f31('0xe')){_0x5137e9[_0x3f31('0x2e')]=this[_0x3f31('0x1f')]['messageId'];_0x5137e9[_0x3f31('0x2f')]=_0x3f31('0x30')+_[_0x3f31('0x31')](_0x5137e9[_0x3f31('0xf')],_0x3f31('0x32'),_0x3f31('0x33'))+_0x3f31('0x34');_0x5137e9[_0x3f31('0x35')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x3f31('0x36'),'Precedence':_0x3f31('0x37')};return mailRpc[_0x3f31('0x38')](this[_0x3f31('0x28')][_0x3f31('0x39')],_0x5137e9)[_0x3f31('0x3a')](function(_0xde0ff7){logger['info'](_0x3f31('0x3b'),_0x3b3a3b);_0x5137e9[_0x3f31('0x3c')]=_0xde0ff7[_0x3f31('0x1f')][_0x3f31('0x3c')];return rpc[_0x19da82+'Message'][_0x3f31('0x3d')](_0x5137e9);})[_0x3f31('0x3a')](function(_0x36d5c3){logger[_0x3f31('0x11')](_0x3f31('0x3e'),_0x3b3a3b,JSON['stringify'](_0x36d5c3));})[_0x3f31('0x3f')](function(_0x2ca3bd){logger[_0x3f31('0x40')](_0x3f31('0x41'),_0x3b3a3b,JSON[_0x3f31('0x42')](_0x2ca3bd));})[_0x3f31('0x43')](function(){Promise[_0x3f31('0x44')]()['then'](function(){if(_0x5d6b9d[0x0]!=='2'||_0x390ee9['autoreplyExecuted'])return;return rpc[_0x19da82+'Interaction'][_0x3f31('0x45')](_0x390ee9['id'],{'autoreplyExecuted':!![]})[_0x3f31('0x3a')](function(_0x37cce1){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x37cce1));})[_0x3f31('0x3f')](function(_0x565d49){logger[_0x3f31('0x40')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x565d49));});})[_0x3f31('0x3a')](function(){_0xced047[_0x3f31('0x13')]();});});}else{return rpc[this[_0x3f31('0xd')]+'Message'][_0x3f31('0x3d')](_0x5137e9)[_0x3f31('0x3a')](function(){logger[_0x3f31('0x11')](_0x3f31('0x3e'),_0x3b3a3b,_0x5137e9['body']);})[_0x3f31('0x3f')](function(_0x19c39f){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x19c39f));})[_0x3f31('0x43')](function(){Promise['resolve']()[_0x3f31('0x3a')](function(){if(_0x5d6b9d[0x0]!=='2'||_0x390ee9[_0x3f31('0x17')])return;return rpc[_0x19da82+_0x3f31('0x46')][_0x3f31('0x45')](_0x390ee9['id'],{'autoreplyExecuted':!![]})['then'](function(_0x240a2a){logger[_0x3f31('0x11')](_0x3f31('0x18'),_0x3b3a3b,JSON['stringify'](_0x240a2a));})['catch'](function(_0x27b41a){logger[_0x3f31('0x40')](_0x3f31('0x47'),_0x3b3a3b,JSON['stringify'](_0x27b41a));});})[_0x3f31('0x3a')](function(){_0xced047['next']();});});}}}catch(_0x33d524){logger[_0x3f31('0x40')]('[%s][AUTOREPLY]\x20%s',_0x3b3a3b,JSON[_0x3f31('0x42')](_0x33d524));_0xced047[_0x3f31('0x48')]();}};}; \ 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 4cbcc8a..bf83ca7 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 _0x329b=['interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','Interaction','channel','update'];(function(_0x37ed0e,_0x193c4c){var _0x3bd6b7=function(_0xb1dacb){while(--_0xb1dacb){_0x37ed0e['push'](_0x37ed0e['shift']());}};_0x3bd6b7(++_0x193c4c);}(_0x329b,0x1d1));var _0xb329=function(_0x1f1305,_0x2435f5){_0x1f1305=_0x1f1305-0x0;var _0x571a9d=_0x329b[_0x1f1305];return _0x571a9d;};'use strict';var moment=require(_0xb329('0x0'));var logger=require(_0xb329('0x1'))(_0xb329('0x2'));var rpc={'chatInteraction':require(_0xb329('0x3')),'openchannelInteraction':require(_0xb329('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xb329('0x5')),'faxInteraction':require(_0xb329('0x6')),'whatsappInteraction':require(_0xb329('0x7'))};exports[_0xb329('0x8')]=function(_0x23806c,_0x17f0a0,_0x51c9fd,_0x5a5243){return function(_0x14fb9b){try{logger['info'](_0xb329('0x9'),_0x23806c,_0x17f0a0[0x0]);var _0x2bb487={'closed':0x1,'closedAt':moment()[_0xb329('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xb329('0xb'),'disposition':_0x17f0a0[0x0]};if(rpc[_0x5a5243['channel']+_0xb329('0xc')]){rpc[_0x5a5243[_0xb329('0xd')]+_0xb329('0xc')][_0xb329('0xe')](_0x5a5243[_0xb329('0xf')]['id'],_0x2bb487)[_0xb329('0x10')](function(_0x506c98){logger['info'](_0xb329('0x11'),_0x23806c,_0x5a5243[_0xb329('0xf')]['id']);})[_0xb329('0x12')](function(_0x136df8){logger['error'](_0xb329('0x13'),_0x23806c,JSON[_0xb329('0x14')](_0x136df8));})[_0xb329('0x15')](function(){_0x14fb9b[_0xb329('0x16')]();});}}catch(_0x56dc48){logger[_0xb329('0x17')](_0xb329('0x13'),_0x23806c,JSON[_0xb329('0x14')](_0x56dc48));_0x14fb9b[_0xb329('0x16')]();}};}; \ No newline at end of file +var _0xa651=['../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa651,0xb7));var _0x1a65=function(_0xdbce8,_0x550d11){_0xdbce8=_0xdbce8-0x0;var _0x4e8866=_0xa651[_0xdbce8];return _0x4e8866;};'use strict';var moment=require(_0x1a65('0x0'));var logger=require(_0x1a65('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x1a65('0x2')),'smsInteraction':require(_0x1a65('0x3')),'mailInteraction':require(_0x1a65('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1a65('0x5'))};exports[_0x1a65('0x6')]=function(_0x31fd42,_0x19e3e6,_0x5a6965,_0x5314fb){return function(_0x2ed055){try{logger[_0x1a65('0x7')](_0x1a65('0x8'),_0x31fd42,_0x19e3e6[0x0]);var _0x1c2001={'closed':0x1,'closedAt':moment()[_0x1a65('0x9')](_0x1a65('0xa')),'closeReason':_0x1a65('0xb'),'disposition':_0x19e3e6[0x0]};if(rpc[_0x5314fb['channel']+_0x1a65('0xc')]){rpc[_0x5314fb[_0x1a65('0xd')]+'Interaction']['update'](_0x5314fb[_0x1a65('0xe')]['id'],_0x1c2001)[_0x1a65('0xf')](function(_0x7768b0){logger['info'](_0x1a65('0x10'),_0x31fd42,_0x5314fb[_0x1a65('0xe')]['id']);})[_0x1a65('0x11')](function(_0x538d57){logger[_0x1a65('0x12')](_0x1a65('0x13'),_0x31fd42,JSON[_0x1a65('0x14')](_0x538d57));})[_0x1a65('0x15')](function(){_0x2ed055[_0x1a65('0x16')]();});}}catch(_0x5e02b2){logger[_0x1a65('0x12')](_0x1a65('0x13'),_0x31fd42,JSON[_0x1a65('0x14')](_0x5e02b2));_0x2ed055['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 2d29d90..a4996b6 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 _0xba18=['sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','info','catch','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','result','providerName','create','metadata','endConversation','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var moment=require(_0x8ba1('0x1'));var apiai=require(_0x8ba1('0x2'));var md5=require(_0x8ba1('0x3'));var utils=require(_0x8ba1('0x4'));var logger=require(_0x8ba1('0x5'))(_0x8ba1('0x6'));var rpc={'chatMessage':require(_0x8ba1('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8ba1('0x8')),'smsMessage':require(_0x8ba1('0x9')),'faxMessage':require(_0x8ba1('0xa')),'whatsappMessage':require(_0x8ba1('0xb'))};exports[_0x8ba1('0xc')]=function(_0x2ffa15,_0x51a988){return function(_0x3a87eb){try{if(!_[_0x8ba1('0xd')](this['interaction']['UserId'])){logger['info'](_0x8ba1('0xe'),_0x2ffa15,_0x8ba1('0xf'));return _0x3a87eb['next']();}var _0x457158={'ContactId':this[_0x8ba1('0x10')]['id'],'sentAt':moment()[_0x8ba1('0x11')](_0x8ba1('0x12')),'direction':_0x8ba1('0x13')};if(this['channel']===_0x8ba1('0x14')||this[_0x8ba1('0x15')]===_0x8ba1('0x16')){_0x457158[_0x8ba1('0x17')]=this[_0x8ba1('0x18')][_0x8ba1('0x17')];}var _0x58e32b=this[_0x8ba1('0x15')];if(_0x58e32b===_0x8ba1('0x19')){_0x457158[_0x8ba1('0x1a')]=this[_0x8ba1('0x1b')]['id'];}else{_0x457158[_['upperFirst'](_0x58e32b)+'AccountId']=this['account']['id'];}_0x457158[_[_0x8ba1('0x1c')](_0x58e32b)+_0x8ba1('0x1d')]=this[_0x8ba1('0x18')]['id'];if(this[_0x8ba1('0x18')][_0x8ba1('0x1e')]){var _0x3880aa=_0x51a988[0x2];if(!_[_0x8ba1('0x1f')](_0x3880aa)){_0x457158[_0x8ba1('0x20')]=utils[_0x8ba1('0x21')](_0x3880aa,this);return rpc[_0x58e32b+_0x8ba1('0x22')]['create'](_0x457158)['then'](function(_0x1a48fa){logger[_0x8ba1('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x2ffa15,_0x457158[_0x8ba1('0x20')]);})[_0x8ba1('0x24')](function(_0x3fadfc){logger[_0x8ba1('0x25')](_0x8ba1('0xe'),_0x2ffa15,JSON[_0x8ba1('0x26')](_0x3fadfc));})['finally'](function(){logger[_0x8ba1('0x23')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2ffa15);_0x3a87eb[_0x8ba1('0x27')]();});}else{logger[_0x8ba1('0x23')](_0x8ba1('0x28'),_0x2ffa15);_0x3a87eb[_0x8ba1('0x27')]();}}else{var _0x4e66e1=this;var _0x1d619c=apiai(_0x51a988[0x0],{'language':_0x51a988[0x1]||'en'});return _0x1d619c[_0x8ba1('0x29')](this[_0x8ba1('0x2a')][_0x8ba1('0x20')],{'sessionId':md5(this[_0x8ba1('0x18')]['id'])})[_0x8ba1('0x2b')](function(_0x845108){_0x4e66e1[_0x8ba1('0x20')][_0x8ba1('0x2c')]=_0x845108;_0x457158[_0x8ba1('0x20')]=_0x845108[_0x8ba1('0x2d')]['fulfillment']['speech'];_0x457158[_0x8ba1('0x2e')]=_0x8ba1('0x2c');_0x457158['providerResponse']=JSON[_0x8ba1('0x26')](_0x845108);return rpc[_0x58e32b+_0x8ba1('0x22')][_0x8ba1('0x2f')](_0x457158)[_0x8ba1('0x2b')](function(_0x15e419){logger[_0x8ba1('0x23')](_0x8ba1('0xe'),_0x2ffa15,_0x457158[_0x8ba1('0x20')]);if(_0x845108[_0x8ba1('0x2d')][_0x8ba1('0x30')][_0x8ba1('0x31')]){_0x3a87eb[_0x8ba1('0x32')]();}else{_0x3a87eb[_0x8ba1('0x27')]();}})[_0x8ba1('0x24')](function(_0x5e28b7){logger[_0x8ba1('0x25')](_0x8ba1('0xe'),_0x2ffa15,JSON[_0x8ba1('0x26')](_0x5e28b7));_0x3a87eb[_0x8ba1('0x32')]();});})[_0x8ba1('0x24')](function(_0x24bf95){logger['error'](_0x8ba1('0xe'),_0x2ffa15,_0x24bf95[_0x8ba1('0x2a')]);_0x3a87eb['next']();});}}catch(_0x1015c8){logger['error'](_0x8ba1('0xe'),_0x2ffa15,JSON[_0x8ba1('0x26')](_0x1015c8));_0x3a87eb['stop']();}};}; \ No newline at end of file +var _0x31f0=['interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','then','info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','speech','providerName','metadata','endConversation','message','lodash','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','isNil'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x31f0,0xb7));var _0x031f=function(_0x29e11d,_0xb8f5a2){_0x29e11d=_0x29e11d-0x0;var _0x432d25=_0x31f0[_0x29e11d];return _0x432d25;};'use strict';var _=require(_0x031f('0x0'));var moment=require('moment');var apiai=require(_0x031f('0x1'));var md5=require('md5');var utils=require(_0x031f('0x2'));var logger=require(_0x031f('0x3'))(_0x031f('0x4'));var rpc={'chatMessage':require(_0x031f('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x031f('0x6')),'smsMessage':require(_0x031f('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3dc98e,_0x487e65){return function(_0x365f59){try{if(!_[_0x031f('0x8')](this[_0x031f('0x9')][_0x031f('0xa')])){logger['info'](_0x031f('0xb'),_0x3dc98e,_0x031f('0xc'));return _0x365f59[_0x031f('0xd')]();}var _0x439940={'ContactId':this[_0x031f('0xe')]['id'],'sentAt':moment()[_0x031f('0xf')](_0x031f('0x10')),'direction':_0x031f('0x11')};if(this['channel']===_0x031f('0x12')||this[_0x031f('0x13')]===_0x031f('0x14')){_0x439940[_0x031f('0x15')]=this[_0x031f('0x9')][_0x031f('0x15')];}var _0x1c230d=this['channel'];if(_0x1c230d===_0x031f('0x16')){_0x439940[_0x031f('0x17')]=this[_0x031f('0x18')]['id'];}else{_0x439940[_[_0x031f('0x19')](_0x1c230d)+_0x031f('0x1a')]=this['account']['id'];}_0x439940[_['upperFirst'](_0x1c230d)+_0x031f('0x1b')]=this[_0x031f('0x9')]['id'];if(this[_0x031f('0x9')][_0x031f('0x1c')]){var _0x5196b1=_0x487e65[0x2];if(!_[_0x031f('0x1d')](_0x5196b1)){_0x439940[_0x031f('0x1e')]=utils['getMustacheRender'](_0x5196b1,this);return rpc[_0x1c230d+_0x031f('0x1f')]['create'](_0x439940)[_0x031f('0x20')](function(_0x5f2199){logger[_0x031f('0x21')](_0x031f('0xb'),_0x3dc98e,_0x439940[_0x031f('0x1e')]);})[_0x031f('0x22')](function(_0x1b76d6){logger[_0x031f('0x23')](_0x031f('0xb'),_0x3dc98e,JSON[_0x031f('0x24')](_0x1b76d6));})[_0x031f('0x25')](function(){logger['info'](_0x031f('0x26'),_0x3dc98e);_0x365f59[_0x031f('0x27')]();});}else{logger[_0x031f('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3dc98e);_0x365f59['stop']();}}else{var _0xa11a2b=this;var _0x4d0f92=apiai(_0x487e65[0x0],{'language':_0x487e65[0x1]||'en'});return _0x4d0f92[_0x031f('0x28')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0x031f('0x20')](function(_0x12c406){_0xa11a2b[_0x031f('0x1e')][_0x031f('0x29')]=_0x12c406;_0x439940['body']=_0x12c406[_0x031f('0x2a')]['fulfillment'][_0x031f('0x2b')];_0x439940[_0x031f('0x2c')]=_0x031f('0x29');_0x439940['providerResponse']=JSON[_0x031f('0x24')](_0x12c406);return rpc[_0x1c230d+_0x031f('0x1f')]['create'](_0x439940)[_0x031f('0x20')](function(_0x28a617){logger[_0x031f('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x3dc98e,_0x439940[_0x031f('0x1e')]);if(_0x12c406[_0x031f('0x2a')][_0x031f('0x2d')][_0x031f('0x2e')]){_0x365f59[_0x031f('0xd')]();}else{_0x365f59[_0x031f('0x27')]();}})['catch'](function(_0x1f62eb){logger[_0x031f('0x23')](_0x031f('0xb'),_0x3dc98e,JSON[_0x031f('0x24')](_0x1f62eb));_0x365f59[_0x031f('0xd')]();});})[_0x031f('0x22')](function(_0x378692){logger[_0x031f('0x23')](_0x031f('0xb'),_0x3dc98e,_0x378692[_0x031f('0x2f')]);_0x365f59[_0x031f('0xd')]();});}}catch(_0x5ec564){logger[_0x031f('0x23')](_0x031f('0xb'),_0x3dc98e,JSON[_0x031f('0x24')](_0x5ec564));_0x365f59[_0x031f('0x27')]();}};}; \ 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 054cb9c..c06bc7a 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 _0x3779=['SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','all','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3779,0x190));var _0x9377=function(_0x381a28,_0x4eb359){_0x381a28=_0x381a28-0x0;var _0x5e572d=_0x3779[_0x381a28];return _0x5e572d;};'use strict';var _=require(_0x9377('0x0'));var dialogflow=require(_0x9377('0x1'));var md5=require(_0x9377('0x2'));var moment=require(_0x9377('0x3'));var Promise=require('bluebird');var logger=require(_0x9377('0x4'))(_0x9377('0x5'));var utils=require(_0x9377('0x6'));var rpc={'chatMessage':require(_0x9377('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9377('0x8')),'smsMessage':require(_0x9377('0x9')),'faxMessage':require(_0x9377('0xa')),'whatsappMessage':require(_0x9377('0xb'))};function createMessage(_0x3ef913,_0x6444c2,_0x4925a8,_0x2447b8){return new Promise(function(_0x22b118,_0x198625){var _0x3e4ae9=_['clone'](_0x4925a8);_0x3e4ae9[_0x9377('0xc')]=_0x2447b8;return rpc[_0x6444c2+_0x9377('0xd')][_0x9377('0xe')](_0x3e4ae9)[_0x9377('0xf')](function(){logger[_0x9377('0x10')](_0x9377('0x11'),_0x3ef913,_0x3e4ae9[_0x9377('0xc')]);_0x22b118();})['catch'](function(_0x49f54d){logger[_0x9377('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x3ef913,JSON[_0x9377('0x13')](_0x49f54d));_0x198625(_0x49f54d);});});}exports[_0x9377('0x14')]=function(_0x97d5d8,_0x95ad4d){return function(_0x1833a5){try{if(!_[_0x9377('0x15')](this[_0x9377('0x16')][_0x9377('0x17')])){logger['info'](_0x9377('0x11'),_0x97d5d8,_0x9377('0x18'));return _0x1833a5[_0x9377('0x19')]();}var _0x162346={'ContactId':this[_0x9377('0x1a')]['id'],'sentAt':moment()[_0x9377('0x1b')](_0x9377('0x1c')),'direction':_0x9377('0x1d')};if(this[_0x9377('0x1e')]===_0x9377('0x1f')||this[_0x9377('0x1e')]==='whatsapp'){_0x162346['phone']=this[_0x9377('0x16')]['phone'];}var _0xa799e8=this[_0x9377('0x1e')];if(_0xa799e8===_0x9377('0x20')){_0x162346[_0x9377('0x21')]=this[_0x9377('0x22')]['id'];}else{_0x162346[_[_0x9377('0x23')](_0xa799e8)+'AccountId']=this[_0x9377('0x22')]['id'];}_0x162346[_[_0x9377('0x23')](_0xa799e8)+_0x9377('0x24')]=this[_0x9377('0x16')]['id'];if(this[_0x9377('0x16')][_0x9377('0x25')]){var _0x31603d=_0x95ad4d[0x4];if(!_['isEmpty'](_0x31603d)){_0x162346[_0x9377('0xc')]=utils[_0x9377('0x26')](_0x31603d,this);return rpc[_0xa799e8+_0x9377('0xd')][_0x9377('0xe')](_0x162346)['then'](function(_0x2ee5c3){logger[_0x9377('0x10')](_0x9377('0x11'),_0x97d5d8,_0x162346['body']);})[_0x9377('0x27')](function(_0x4d4e23){logger['error'](_0x9377('0x11'),_0x97d5d8,JSON[_0x9377('0x13')](_0x4d4e23));})[_0x9377('0x28')](function(){logger[_0x9377('0x10')](_0x9377('0x29'),_0x97d5d8);_0x1833a5[_0x9377('0x2a')]();});}else{logger[_0x9377('0x10')](_0x9377('0x2b'),_0x97d5d8);_0x1833a5[_0x9377('0x2a')]();}}else{var _0x1c9f2e=this;var _0x34eaf7=_0x95ad4d[0x2]['replace'](/\\n/g,'\x0a');var _0x25bf67={'credentials':{'private_key':_0x34eaf7,'client_email':_0x95ad4d[0x1]}};var _0x230e77=new dialogflow[(_0x9377('0x2c'))](_0x25bf67);var _0x31fdaf=_0x230e77[_0x9377('0x2d')](_0x95ad4d[0x0],md5(_0x1c9f2e[_0x9377('0x16')]['id']));var _0x4f6fc7={'session':_0x31fdaf,'queryInput':{'text':{'text':_0x1c9f2e[_0x9377('0x2e')][_0x9377('0xc')],'languageCode':_0x95ad4d[0x3]||'en'}}};return _0x230e77[_0x9377('0x2f')](_0x4f6fc7)[_0x9377('0xf')](function(_0x188284){if(_0x188284&&_0x188284[_0x9377('0x30')]){_0x1c9f2e[_0x9377('0xc')]['dialogflowV2']=_0x188284;var _0x18c308=_0x188284[0x0];var _0x4473de=_0x18c308[_0x9377('0x31')]['diagnosticInfo']&&_0x18c308[_0x9377('0x31')][_0x9377('0x32')][_0x9377('0x33')]?_0x18c308[_0x9377('0x31')][_0x9377('0x32')][_0x9377('0x33')][_0x9377('0x34')][_0x9377('0x35')]:![];_0x1c9f2e[_0x9377('0xc')][_0x9377('0x36')]=_0x18c308[_0x9377('0x31')][_0x9377('0x37')];_0x1c9f2e[_0x9377('0xc')][_0x9377('0x38')]=_0x18c308[_0x9377('0x31')][_0x9377('0x39')];_0x1c9f2e[_0x9377('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x18c308['queryResult'][_0x9377('0x32')]&&_0x18c308[_0x9377('0x31')][_0x9377('0x32')]['fields']?_0x18c308[_0x9377('0x31')][_0x9377('0x32')][_0x9377('0x33')]['end_conversation']['boolValue']:![];_0x1c9f2e['body'][_0x9377('0x3a')]=_0x18c308[_0x9377('0x31')][_0x9377('0x3b')]['name'];_0x1c9f2e['body'][_0x9377('0x3c')]=_0x18c308[_0x9377('0x31')]['intent'][_0x9377('0x3d')];_0x1c9f2e[_0x9377('0xc')][_0x9377('0x3e')]=_0x18c308[_0x9377('0x31')][_0x9377('0x3b')][_0x9377('0x3f')];_0x1c9f2e[_0x9377('0xc')][_0x9377('0x40')]=_0x18c308[_0x9377('0x31')][_0x9377('0x41')];_0x1c9f2e[_0x9377('0xc')][_0x9377('0x42')]=_0x18c308[_0x9377('0x31')]['queryText'];_0x1c9f2e[_0x9377('0xc')][_0x9377('0x43')]=_0x18c308[_0x9377('0x31')][_0x9377('0x44')];_0x162346[_0x9377('0x45')]=_0x9377('0x46');_0x162346[_0x9377('0x47')]=JSON[_0x9377('0x13')](_0x188284);var _0x119694=[];for(var _0x7c5336=0x0;_0x7c5336<_0x188284['length'];_0x7c5336++){var _0x39c7a3=_0x188284[_0x7c5336];if(_0x39c7a3&&_0x39c7a3[_0x9377('0x31')]&&_0x39c7a3['queryResult'][_0x9377('0x48')]){_0x119694['push'](createMessage(_0x97d5d8,_0xa799e8,_0x162346,_0x39c7a3[_0x9377('0x31')][_0x9377('0x48')]));}}return Promise[_0x9377('0x49')](_0x119694)[_0x9377('0xf')](function(){if(_0x4473de){_0x1833a5[_0x9377('0x19')]();}else{_0x1833a5[_0x9377('0x2a')]();}})['catch'](function(_0x337b8b){logger['error'](_0x9377('0x11'),_0x97d5d8,JSON[_0x9377('0x13')](_0x337b8b));_0x1833a5[_0x9377('0x19')]();});}})[_0x9377('0x27')](function(_0x3a5dd1){logger[_0x9377('0x12')](_0x9377('0x11'),_0x97d5d8,_0x3a5dd1[_0x9377('0x2e')],_0x3a5dd1['stack']);_0x1833a5[_0x9377('0x19')]();});}}catch(_0x2a5fe3){logger[_0x9377('0x12')](_0x9377('0x11'),_0x97d5d8,JSON[_0x9377('0x13')](_0x2a5fe3));_0x1833a5[_0x9377('0x2a')]();}};}; \ No newline at end of file +var _0x4a4a=['./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','queryResult','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','message','lodash','md5','moment','../../../../config/logger','routing'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a4a,0xd6));var _0xa4a4=function(_0x394c17,_0x292c8d){_0x394c17=_0x394c17-0x0;var _0x3785ee=_0x4a4a[_0x394c17];return _0x3785ee;};'use strict';var _=require(_0xa4a4('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xa4a4('0x1'));var moment=require(_0xa4a4('0x2'));var Promise=require('bluebird');var logger=require(_0xa4a4('0x3'))(_0xa4a4('0x4'));var utils=require(_0xa4a4('0x5'));var rpc={'chatMessage':require(_0xa4a4('0x6')),'openchannelMessage':require(_0xa4a4('0x7')),'mailMessage':require(_0xa4a4('0x8')),'smsMessage':require(_0xa4a4('0x9')),'faxMessage':require(_0xa4a4('0xa')),'whatsappMessage':require(_0xa4a4('0xb'))};function createMessage(_0x1024a8,_0x5d6079,_0x50ae85,_0x411303){return new Promise(function(_0x51bb43,_0xa863f1){var _0x1e5857=_[_0xa4a4('0xc')](_0x50ae85);_0x1e5857[_0xa4a4('0xd')]=_0x411303;return rpc[_0x5d6079+_0xa4a4('0xe')][_0xa4a4('0xf')](_0x1e5857)[_0xa4a4('0x10')](function(){logger[_0xa4a4('0x11')](_0xa4a4('0x12'),_0x1024a8,_0x1e5857['body']);_0x51bb43();})[_0xa4a4('0x13')](function(_0x5140a1){logger[_0xa4a4('0x14')](_0xa4a4('0x12'),_0x1024a8,JSON[_0xa4a4('0x15')](_0x5140a1));_0xa863f1(_0x5140a1);});});}exports[_0xa4a4('0x16')]=function(_0x2a38ea,_0x5a9111){return function(_0x149ecd){try{if(!_[_0xa4a4('0x17')](this[_0xa4a4('0x18')][_0xa4a4('0x19')])){logger[_0xa4a4('0x11')](_0xa4a4('0x12'),_0x2a38ea,_0xa4a4('0x1a'));return _0x149ecd[_0xa4a4('0x1b')]();}var _0x1fed58={'ContactId':this[_0xa4a4('0x1c')]['id'],'sentAt':moment()['format'](_0xa4a4('0x1d')),'direction':_0xa4a4('0x1e')};if(this[_0xa4a4('0x1f')]===_0xa4a4('0x20')||this[_0xa4a4('0x1f')]==='whatsapp'){_0x1fed58[_0xa4a4('0x21')]=this[_0xa4a4('0x18')][_0xa4a4('0x21')];}var _0x195c61=this[_0xa4a4('0x1f')];if(_0x195c61===_0xa4a4('0x22')){_0x1fed58[_0xa4a4('0x23')]=this['account']['id'];}else{_0x1fed58[_['upperFirst'](_0x195c61)+_0xa4a4('0x24')]=this[_0xa4a4('0x25')]['id'];}_0x1fed58[_['upperFirst'](_0x195c61)+_0xa4a4('0x26')]=this[_0xa4a4('0x18')]['id'];if(this['interaction'][_0xa4a4('0x27')]){var _0x620921=_0x5a9111[0x4];if(!_[_0xa4a4('0x28')](_0x620921)){_0x1fed58[_0xa4a4('0xd')]=utils[_0xa4a4('0x29')](_0x620921,this);return rpc[_0x195c61+_0xa4a4('0xe')][_0xa4a4('0xf')](_0x1fed58)[_0xa4a4('0x10')](function(_0x1e5484){logger['info'](_0xa4a4('0x12'),_0x2a38ea,_0x1fed58['body']);})[_0xa4a4('0x13')](function(_0x4d595c){logger[_0xa4a4('0x14')](_0xa4a4('0x12'),_0x2a38ea,JSON['stringify'](_0x4d595c));})[_0xa4a4('0x2a')](function(){logger['info'](_0xa4a4('0x2b'),_0x2a38ea);_0x149ecd[_0xa4a4('0x2c')]();});}else{logger[_0xa4a4('0x11')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2a38ea);_0x149ecd[_0xa4a4('0x2c')]();}}else{var _0x53e677=this;var _0x3704a9=_0x5a9111[0x2][_0xa4a4('0x2d')](/\\n/g,'\x0a');var _0xe5104e={'credentials':{'private_key':_0x3704a9,'client_email':_0x5a9111[0x1]}};var _0x3ca0f4=new dialogflow['SessionsClient'](_0xe5104e);var _0x635c28=_0x3ca0f4['sessionPath'](_0x5a9111[0x0],md5(_0x53e677['interaction']['id']));var _0x4362a0={'session':_0x635c28,'queryInput':{'text':{'text':_0x53e677['message']['body'],'languageCode':_0x5a9111[0x3]||'en'}}};return _0x3ca0f4['detectIntent'](_0x4362a0)['then'](function(_0x46f143){if(_0x46f143&&_0x46f143[_0xa4a4('0x2e')]){_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x2f')]=_0x46f143;var _0x791508=_0x46f143[0x0];var _0x273c21=_0x791508['queryResult'][_0xa4a4('0x30')]&&_0x791508['queryResult']['diagnosticInfo'][_0xa4a4('0x31')]?_0x791508['queryResult']['diagnosticInfo'][_0xa4a4('0x31')][_0xa4a4('0x32')][_0xa4a4('0x33')]:![];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x34')]=_0x791508[_0xa4a4('0x35')]['action'];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x36')]=_0x791508[_0xa4a4('0x35')][_0xa4a4('0x37')];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x38')]=_0x791508[_0xa4a4('0x35')][_0xa4a4('0x30')]&&_0x791508['queryResult'][_0xa4a4('0x30')][_0xa4a4('0x31')]?_0x791508[_0xa4a4('0x35')][_0xa4a4('0x30')]['fields'][_0xa4a4('0x32')][_0xa4a4('0x33')]:![];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x39')]=_0x791508[_0xa4a4('0x35')][_0xa4a4('0x3a')]['name'];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x3b')]=_0x791508[_0xa4a4('0x35')][_0xa4a4('0x3a')][_0xa4a4('0x3c')];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x3d')]=_0x791508['queryResult'][_0xa4a4('0x3a')]['isFallback'];_0x53e677[_0xa4a4('0xd')][_0xa4a4('0x3e')]=_0x791508[_0xa4a4('0x35')]['languageCode'];_0x53e677['body'][_0xa4a4('0x3f')]=_0x791508['queryResult'][_0xa4a4('0x40')];_0x53e677['body'][_0xa4a4('0x41')]=_0x791508[_0xa4a4('0x35')][_0xa4a4('0x42')];_0x1fed58[_0xa4a4('0x43')]=_0xa4a4('0x2f');_0x1fed58[_0xa4a4('0x44')]=JSON[_0xa4a4('0x15')](_0x46f143);var _0x448330=[];for(var _0x2f7dab=0x0;_0x2f7dab<_0x46f143['length'];_0x2f7dab++){var _0x6e6171=_0x46f143[_0x2f7dab];if(_0x6e6171&&_0x6e6171[_0xa4a4('0x35')]&&_0x6e6171[_0xa4a4('0x35')][_0xa4a4('0x45')]){_0x448330[_0xa4a4('0x46')](createMessage(_0x2a38ea,_0x195c61,_0x1fed58,_0x6e6171[_0xa4a4('0x35')][_0xa4a4('0x45')]));}}return Promise[_0xa4a4('0x47')](_0x448330)[_0xa4a4('0x10')](function(){if(_0x273c21){_0x149ecd[_0xa4a4('0x1b')]();}else{_0x149ecd['stop']();}})['catch'](function(_0x1a7d7f){logger[_0xa4a4('0x14')](_0xa4a4('0x12'),_0x2a38ea,JSON[_0xa4a4('0x15')](_0x1a7d7f));_0x149ecd[_0xa4a4('0x1b')]();});}})['catch'](function(_0x44895e){logger[_0xa4a4('0x14')](_0xa4a4('0x12'),_0x2a38ea,_0x44895e[_0xa4a4('0x48')],_0x44895e['stack']);_0x149ecd[_0xa4a4('0x1b')]();});}}catch(_0x19b970){logger['error'](_0xa4a4('0x12'),_0x2a38ea,JSON['stringify'](_0x19b970));_0x149ecd[_0xa4a4('0x2c')]();}};}; \ 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 86ed259..9ef3e48 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 _0x98c7=['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','message','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0x98c7,0xc7));var _0x798c=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0x98c7[_0x243bba];return _0x12e696;};'use strict';var schema=require(_0x798c('0x0'));var _=require(_0x798c('0x1'));var htmlToText=require(_0x798c('0x2'));var utils=require('./utils');var logger=require(_0x798c('0x3'))(_0x798c('0x4'));var gotoif=schema({'condition':{'type':_0x798c('0x5'),'required':!![],'message':_0x798c('0x6')},'priorityTrue':{'type':_0x798c('0x7'),'message':_0x798c('0x8')},'priorityFalse':{'type':_0x798c('0x7'),'message':_0x798c('0x9')}});exports['consequence']=function(_0x271f5b,_0x3fc91e){return function(_0x3b356e){try{var _0x5bfa6e={'condition':htmlToText[_0x798c('0xa')](utils[_0x798c('0xb')](_0x3fc91e[0x0],this),{'wordwrap':![]})[_0x798c('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3fc91e[0x1],'priorityFalse':_0x3fc91e[0x2]};var _0x2f0276=gotoif[_0x798c('0x0')](_0x5bfa6e,{'typecast':!![]});if(_0x2f0276[_0x798c('0xd')]){logger['error'](_0x798c('0xe'),_0x271f5b,_[_0x798c('0xf')](_0x2f0276,'message')[_0x798c('0x10')](',\x20'));_0x3b356e[_0x798c('0x11')]();}else{try{var _0x9653a7=eval('('+_0x5bfa6e[_0x798c('0x12')]+')');var _0x305ee7=_0x9653a7?_0x5bfa6e[_0x798c('0x13')]:_0x5bfa6e[_0x798c('0x14')];logger[_0x798c('0x15')](_0x798c('0x16'),_0x271f5b,_0x5bfa6e[_0x798c('0x12')],_0x9653a7,_0x305ee7||_0x798c('0x17'));if(_0x305ee7){var _0x55d533=_[_0x798c('0x18')](_0x3b356e[_0x798c('0x19')](),{'p':_0x305ee7});if(_0x55d533>=0x0){logger[_0x798c('0x15')](_0x798c('0x1a'),_0x271f5b,_0x305ee7||'next',_0x55d533);_0x3b356e['next'](_0x55d533);}else{logger[_0x798c('0x15')](_0x798c('0x1b'),_0x271f5b,_0x305ee7||_0x798c('0x17'));_0x3b356e[_0x798c('0x11')]();}}else{_0x3b356e[_0x798c('0x17')]();}}catch(_0x7582e1){logger[_0x798c('0x1c')](_0x798c('0x1d'),_0x271f5b,_0x7582e1[_0x798c('0x1e')]);_0x3b356e['stop']();}}}catch(_0x1f317e){logger[_0x798c('0x1c')]('[%s][GOTOIF]\x20%s',_0x271f5b,JSON[_0x798c('0x1f')](_0x1f317e));_0x3b356e[_0x798c('0x11')]();}};}; \ No newline at end of file +var _0x6c9e=['next','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','validate','length','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x5bb5c0,_0x274eff){var _0x404bcb=function(_0x3a1da6){while(--_0x3a1da6){_0x5bb5c0['push'](_0x5bb5c0['shift']());}};_0x404bcb(++_0x274eff);}(_0x6c9e,0xe3));var _0xe6c9=function(_0x426a4f,_0xaedea5){_0x426a4f=_0x426a4f-0x0;var _0x50e5fa=_0x6c9e[_0x426a4f];return _0x50e5fa;};'use strict';var schema=require('validate');var _=require(_0xe6c9('0x0'));var htmlToText=require(_0xe6c9('0x1'));var utils=require(_0xe6c9('0x2'));var logger=require('../../../../config/logger')(_0xe6c9('0x3'));var gotoif=schema({'condition':{'type':_0xe6c9('0x4'),'required':!![],'message':_0xe6c9('0x5')},'priorityTrue':{'type':_0xe6c9('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xe6c9('0x6'),'message':_0xe6c9('0x7')}});exports[_0xe6c9('0x8')]=function(_0x1f5e80,_0x137d14){return function(_0x1e3765){try{var _0x32ac14={'condition':htmlToText[_0xe6c9('0x9')](utils[_0xe6c9('0xa')](_0x137d14[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x137d14[0x1],'priorityFalse':_0x137d14[0x2]};var _0x41331a=gotoif[_0xe6c9('0xb')](_0x32ac14,{'typecast':!![]});if(_0x41331a[_0xe6c9('0xc')]){logger['error'](_0xe6c9('0xd'),_0x1f5e80,_['map'](_0x41331a,_0xe6c9('0xe'))[_0xe6c9('0xf')](',\x20'));_0x1e3765[_0xe6c9('0x10')]();}else{try{var _0x3cf382=eval('('+_0x32ac14[_0xe6c9('0x11')]+')');var _0x5e292c=_0x3cf382?_0x32ac14[_0xe6c9('0x12')]:_0x32ac14[_0xe6c9('0x13')];logger['info'](_0xe6c9('0x14'),_0x1f5e80,_0x32ac14[_0xe6c9('0x11')],_0x3cf382,_0x5e292c||'next');if(_0x5e292c){var _0x2685f7=_[_0xe6c9('0x15')](_0x1e3765[_0xe6c9('0x16')](),{'p':_0x5e292c});if(_0x2685f7>=0x0){logger[_0xe6c9('0x17')](_0xe6c9('0x18'),_0x1f5e80,_0x5e292c||_0xe6c9('0x19'),_0x2685f7);_0x1e3765[_0xe6c9('0x19')](_0x2685f7);}else{logger[_0xe6c9('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1f5e80,_0x5e292c||_0xe6c9('0x19'));_0x1e3765[_0xe6c9('0x10')]();}}else{_0x1e3765['next']();}}catch(_0x527751){logger[_0xe6c9('0x1a')](_0xe6c9('0x1b'),_0x1f5e80,_0x527751[_0xe6c9('0xe')]);_0x1e3765[_0xe6c9('0x10')]();}}}catch(_0x1946b2){logger[_0xe6c9('0x1a')](_0xe6c9('0xd'),_0x1f5e80,JSON['stringify'](_0x1946b2));_0x1e3765[_0xe6c9('0x10')]();}};}; \ 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 2c3d62f..37ca930 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 _0xec87=['join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','validate','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','message'];(function(_0x1c1aac,_0x4f424e){var _0x3d88e5=function(_0x39d261){while(--_0x39d261){_0x1c1aac['push'](_0x1c1aac['shift']());}};_0x3d88e5(++_0x4f424e);}(_0xec87,0x125));var _0x7ec8=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xec87[_0x2d91c6];return _0x3a8d19;};'use strict';var schema=require(_0x7ec8('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x7ec8('0x1'),'required':!![],'message':_0x7ec8('0x2')}});exports['consequence']=function(_0x243dfd,_0x1783b5){return function(_0x448387){try{var _0x58ed44={'priority':_0x1783b5[0x0]};var _0x4d7422=gotop['validate'](_0x58ed44,{'typecast':!![]});if(_0x4d7422[_0x7ec8('0x3')]){logger[_0x7ec8('0x4')](_0x7ec8('0x5'),_0x243dfd,_['map'](_0x4d7422,_0x7ec8('0x6'))[_0x7ec8('0x7')](',\x20'));_0x448387['stop']();}else{logger[_0x7ec8('0x8')](_0x7ec8('0x9'),_0x243dfd,_0x58ed44['priority']);if(_0x58ed44[_0x7ec8('0xa')]){var _0x4dfeb3=_[_0x7ec8('0xb')](_0x448387['rules'](),{'p':_0x58ed44['priority']});if(_0x4dfeb3>=0x0){logger[_0x7ec8('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x243dfd,_0x58ed44['priority']||_0x7ec8('0xc'),_0x4dfeb3);_0x448387[_0x7ec8('0xc')](_0x4dfeb3);}else{logger[_0x7ec8('0x8')](_0x7ec8('0xd'),_0x243dfd,_0x58ed44['priority']||_0x7ec8('0xc'));_0x448387[_0x7ec8('0xe')]();}}else{_0x448387[_0x7ec8('0xc')]();}}}catch(_0x59a432){logger[_0x7ec8('0x4')](_0x7ec8('0x5'),_0x243dfd,JSON['stringify'](_0x59a432));_0x448387['stop']();}};}; \ No newline at end of file +var _0x0b5c=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','routing','number'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x0b5c,0x15d));var _0xc0b5=function(_0xb0267,_0x5bfd39){_0xb0267=_0xb0267-0x0;var _0x305232=_0x0b5c[_0xb0267];return _0x305232;};'use strict';var schema=require('validate');var _=require(_0xc0b5('0x0'));var logger=require('../../../../config/logger')(_0xc0b5('0x1'));var gotop=schema({'priority':{'type':_0xc0b5('0x2'),'required':!![],'message':_0xc0b5('0x3')}});exports[_0xc0b5('0x4')]=function(_0x2c3aaf,_0x377460){return function(_0x51682a){try{var _0x45abf6={'priority':_0x377460[0x0]};var _0xa16f1=gotop[_0xc0b5('0x5')](_0x45abf6,{'typecast':!![]});if(_0xa16f1[_0xc0b5('0x6')]){logger[_0xc0b5('0x7')](_0xc0b5('0x8'),_0x2c3aaf,_[_0xc0b5('0x9')](_0xa16f1,_0xc0b5('0xa'))[_0xc0b5('0xb')](',\x20'));_0x51682a[_0xc0b5('0xc')]();}else{logger[_0xc0b5('0xd')](_0xc0b5('0xe'),_0x2c3aaf,_0x45abf6[_0xc0b5('0xf')]);if(_0x45abf6[_0xc0b5('0xf')]){var _0x1286e6=_[_0xc0b5('0x10')](_0x51682a[_0xc0b5('0x11')](),{'p':_0x45abf6[_0xc0b5('0xf')]});if(_0x1286e6>=0x0){logger['info'](_0xc0b5('0x12'),_0x2c3aaf,_0x45abf6['priority']||_0xc0b5('0x13'),_0x1286e6);_0x51682a[_0xc0b5('0x13')](_0x1286e6);}else{logger[_0xc0b5('0xd')](_0xc0b5('0x14'),_0x2c3aaf,_0x45abf6[_0xc0b5('0xf')]||'next');_0x51682a[_0xc0b5('0xc')]();}}else{_0x51682a[_0xc0b5('0x13')]();}}}catch(_0x28be3a){logger[_0xc0b5('0x7')](_0xc0b5('0x8'),_0x2c3aaf,JSON[_0xc0b5('0x15')](_0x28be3a));_0x51682a['stop']();}};}; \ 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 b854fdb..fa70e38 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 _0x20a1=['catch','error','stringify','stop','lodash','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next'];(function(_0x8ed228,_0x136e9f){var _0x1ed1cf=function(_0xbc4ae1){while(--_0xbc4ae1){_0x8ed228['push'](_0x8ed228['shift']());}};_0x1ed1cf(++_0x136e9f);}(_0x20a1,0x101));var _0x120a=function(_0x4b1408,_0x454aff){_0x4b1408=_0x4b1408-0x0;var _0x412ae2=_0x20a1[_0x4b1408];return _0x412ae2;};'use strict';var _=require(_0x120a('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x120a('0x1')),'mailMessage':require(_0x120a('0x2')),'smsMessage':require(_0x120a('0x3')),'faxMessage':require(_0x120a('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x120a('0x5')]=function(_0x465e2f,_0x205722){return function(_0x11cab3){try{var _0x164def={'body':utils['getMustacheRender'](_0x205722[0x0],this),'ContactId':this['contact']['id']};if(this[_0x120a('0x6')]===_0x120a('0x7')){_0x164def[_0x120a('0x8')]=this[_0x120a('0x9')]['id'];}else{_0x164def[_[_0x120a('0xa')](this[_0x120a('0x6')])+'AccountId']=this[_0x120a('0x9')]['id'];}_0x164def[_[_0x120a('0xa')](this[_0x120a('0x6')])+_0x120a('0xb')]=this[_0x120a('0xc')]['id'];if(rpc[this[_0x120a('0x6')]+'Message']){return rpc[this[_0x120a('0x6')]+_0x120a('0xd')][_0x120a('0xe')](_0x164def)[_0x120a('0xf')](function(_0x152082){logger['info'](_0x120a('0x10'),_0x465e2f,_0x164def[_0x120a('0x11')]);_0x11cab3[_0x120a('0x12')]();})[_0x120a('0x13')](function(_0x2dad0f){logger[_0x120a('0x14')](_0x120a('0x10'),_0x465e2f,JSON[_0x120a('0x15')](_0x2dad0f));_0x11cab3['stop']();});}}catch(_0xd32ae7){logger[_0x120a('0x14')](_0x120a('0x10'),_0x465e2f,JSON[_0x120a('0x15')](_0xd32ae7));_0x11cab3[_0x120a('0x16')]();}};}; \ No newline at end of file +var _0x367e=['./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','lodash'];(function(_0x132849,_0x191063){var _0x17ebcf=function(_0x5ceb6a){while(--_0x5ceb6a){_0x132849['push'](_0x132849['shift']());}};_0x17ebcf(++_0x191063);}(_0x367e,0xa1));var _0xe367=function(_0x33a999,_0x31508b){_0x33a999=_0x33a999-0x0;var _0x1e4345=_0x367e[_0x33a999];return _0x1e4345;};'use strict';var _=require(_0xe367('0x0'));var utils=require(_0xe367('0x1'));var logger=require('../../../../config/logger')(_0xe367('0x2'));var rpc={'chatMessage':require(_0xe367('0x3')),'openchannelMessage':require(_0xe367('0x4')),'mailMessage':require(_0xe367('0x5')),'smsMessage':require(_0xe367('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe367('0x7'))};exports['consequence']=function(_0x340e90,_0x55656a){return function(_0x3e9517){try{var _0x3a3434={'body':utils[_0xe367('0x8')](_0x55656a[0x0],this),'ContactId':this[_0xe367('0x9')]['id']};if(this[_0xe367('0xa')]===_0xe367('0xb')){_0x3a3434[_0xe367('0xc')]=this[_0xe367('0xd')]['id'];}else{_0x3a3434[_[_0xe367('0xe')](this[_0xe367('0xa')])+_0xe367('0xf')]=this[_0xe367('0xd')]['id'];}_0x3a3434[_[_0xe367('0xe')](this[_0xe367('0xa')])+_0xe367('0x10')]=this[_0xe367('0x11')]['id'];if(rpc[this['channel']+_0xe367('0x12')]){return rpc[this[_0xe367('0xa')]+'Message'][_0xe367('0x13')](_0x3a3434)[_0xe367('0x14')](function(_0xc15758){logger[_0xe367('0x15')](_0xe367('0x16'),_0x340e90,_0x3a3434[_0xe367('0x17')]);_0x3e9517['next']();})[_0xe367('0x18')](function(_0x2b9fc4){logger[_0xe367('0x19')]('[%s][MESSAGE]\x20%s',_0x340e90,JSON[_0xe367('0x1a')](_0x2b9fc4));_0x3e9517['stop']();});}}catch(_0x567104){logger[_0xe367('0x19')]('[%s][MESSAGE]\x20%s',_0x340e90,JSON[_0xe367('0x1a')](_0x567104));_0x3e9517['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index a487dff..b93e2a0 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 _0xab50=['next','[%s][NOOP]\x20%s','stringify','./utils','routing','consequence','info'];(function(_0x200177,_0x45fbbc){var _0x297415=function(_0x3c37ea){while(--_0x3c37ea){_0x200177['push'](_0x200177['shift']());}};_0x297415(++_0x45fbbc);}(_0xab50,0x65));var _0x0ab5=function(_0x277284,_0x35280f){_0x277284=_0x277284-0x0;var _0xc177a3=_0xab50[_0x277284];return _0xc177a3;};'use strict';var utils=require(_0x0ab5('0x0'));var logger=require('../../../../config/logger')(_0x0ab5('0x1'));exports[_0x0ab5('0x2')]=function(_0x52e8c9,_0x419def){return function(_0x47e7e8){try{logger[_0x0ab5('0x3')]('[%s][NOOP]\x20%s',_0x52e8c9,utils['getMustacheRender'](_0x419def[0x0],this));_0x47e7e8[_0x0ab5('0x4')]();}catch(_0x385639){logger['error'](_0x0ab5('0x5'),_0x52e8c9,JSON[_0x0ab5('0x6')](_0x385639));_0x47e7e8['stop']();}};}; \ No newline at end of file +var _0xa841=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa841,0x14b));var _0x1a84=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa841[_0x1cc8fe];return _0x230054;};'use strict';var utils=require(_0x1a84('0x0'));var logger=require(_0x1a84('0x1'))('routing');exports[_0x1a84('0x2')]=function(_0x3de2f0,_0x3270a0){return function(_0x523a6f){try{logger[_0x1a84('0x3')](_0x1a84('0x4'),_0x3de2f0,utils[_0x1a84('0x5')](_0x3270a0[0x0],this));_0x523a6f[_0x1a84('0x6')]();}catch(_0x482946){logger[_0x1a84('0x7')](_0x1a84('0x4'),_0x3de2f0,JSON[_0x1a84('0x8')](_0x482946));_0x523a6f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e21e19e..0490678 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 _0xfb1f=['push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','account','queue','from','joinAt','clone','queue_id'];(function(_0x5108aa,_0x60c97f){var _0x3069b1=function(_0x1dcc0c){while(--_0x1dcc0c){_0x5108aa['push'](_0x5108aa['shift']());}};_0x3069b1(++_0x60c97f);}(_0xfb1f,0x17e));var _0xffb1=function(_0xa5356d,_0x43851e){_0xa5356d=_0xa5356d-0x0;var _0x7fd0b0=_0xfb1f[_0xa5356d];return _0x7fd0b0;};'use strict';var schema=require('validate');var _=require(_0xffb1('0x0'));var util=require(_0xffb1('0x1'));var seqqueue=require(_0xffb1('0x2'));var moment=require(_0xffb1('0x3'));var Redis=require(_0xffb1('0x4'));var config=require(_0xffb1('0x5'));var logger=require(_0xffb1('0x6'))(_0xffb1('0x7'));var strategy=require(_0xffb1('0x8'));config[_0xffb1('0x9')]=_[_0xffb1('0xa')](config[_0xffb1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xffb1('0xb'))(new Redis(config[_0xffb1('0x9')]));var attributes=['id','queue_id',_0xffb1('0xc'),_0xffb1('0xd'),_0xffb1('0xe'),_0xffb1('0xf')];function emit(_0x388dfa,_0x2b3e81,_0x1521ce){io['to'](_0x388dfa)['emit'](_0x2b3e81,_0x1521ce);}function emitChannelQueueInteraction(_0x2c0410,_0x175b20,_0x3da386,_0x1079b8,_0xfa3cd0,_0x85a502,_0xb098df,_0x5c43d5){var _0x4a62cb=_[_0xffb1('0x10')](_0x3da386);_0x4a62cb[_0xffb1('0x11')]=_0x5c43d5;_0x4a62cb[_0xffb1('0xd')]=_0x175b20;_0x4a62cb[_0xffb1('0xc')]=_0x1079b8;_0x4a62cb['id']=_0xfa3cd0;if(_0x85a502){attributes[_0xffb1('0x12')](_[_0xffb1('0x13')](_0x2c0410)+_0xffb1('0x14'));_0xb098df[util[_0xffb1('0x15')](_0xffb1('0x16'),_0x2c0410)][_0xfa3cd0]=_[_0xffb1('0x17')](_0x4a62cb,attributes);}else{delete _0xb098df[util[_0xffb1('0x15')](_0xffb1('0x16'),_0x2c0410)][_0xfa3cd0];}emit(util[_0xffb1('0x15')](_0xffb1('0x18'),_0x2c0410,_0x175b20),util[_0xffb1('0x15')]('%s_queue_waiting_interaction:%s',_0x2c0410,_0x85a502?_0xffb1('0x19'):_0xffb1('0x1a')),_[_0xffb1('0x17')](_0x4a62cb,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xffb1('0x1b')),'chatQueueReport':require(_0xffb1('0x1c')),'smsQueueReport':require(_0xffb1('0x1d')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xffb1('0x1e')),'chatInteraction':require(_0xffb1('0x1f')),'faxInteraction':require(_0xffb1('0x20')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xffb1('0x21')),'whatsappInteraction':require(_0xffb1('0x22'))};var queue=schema({'name':{'type':_0xffb1('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xffb1('0x24')}});function startRouting(_0x48cea8,_0x1216cf,_0x572fc6,_0x236d9a){if(_0x48cea8&&_0x1216cf&&_0x572fc6){_0x1216cf[_0xffb1('0x25')]+=0x1;var _0x33c46c={'uniqueid':_0x48cea8,'from':_0x572fc6[_0xffb1('0x26')]?_0x572fc6[_0xffb1('0x26')][_0xffb1('0xe')]:'','joinAt':moment()['format'](_0xffb1('0x27')),'ContactId':_0x572fc6[_0xffb1('0x28')]?_0x572fc6[_0xffb1('0x28')]['id']:null,'ListId':_0x572fc6[_0xffb1('0x29')]?_0x572fc6[_0xffb1('0x29')]['id']:null};_0x33c46c[_['upperFirst'](_0x572fc6[_0xffb1('0x2a')])+_0xffb1('0x2b')]=_0x1216cf['id']||null;_0x33c46c[_[_0xffb1('0x2c')](_0x572fc6[_0xffb1('0x2a')])+_0xffb1('0x14')]=_0x572fc6['interaction']?_0x572fc6[_0xffb1('0x2d')]['id']:null;_0x33c46c[_['upperFirst'](_0x572fc6['channel'])+_0xffb1('0x2e')]=_0x572fc6['message']?_0x572fc6[_0xffb1('0x2f')]['id']:null;_0x33c46c[_['upperFirst'](_0x572fc6[_0xffb1('0x2a')])+(_0x572fc6[_0xffb1('0x2a')]!==_0xffb1('0x30')?'AccountId':_0xffb1('0x31'))]=_0x572fc6['account']?_0x572fc6[_0xffb1('0xc')]['id']:null;logger[_0xffb1('0x32')](util[_0xffb1('0x15')](_0xffb1('0x33'),_0x48cea8,_0x1216cf[_0xffb1('0x34')]));emitChannelQueueInteraction(_0x572fc6['channel'],_0x1216cf[_0xffb1('0x34')],_0x33c46c,_0x572fc6[_0xffb1('0xc')][_0xffb1('0x34')],_0x572fc6[_0xffb1('0x2f')]['id'],!![],_0x236d9a,_0x1216cf['id']);if(rpc[_0x572fc6['channel']+_0xffb1('0x35')]){return rpc[_0x572fc6[_0xffb1('0x2a')]+'QueueReport'][_0xffb1('0x36')](_0x33c46c)[_0xffb1('0x37')](function(_0x407739){logger['error']('create\x20queue\x20report',_0x407739);});}}}function stopRouting(_0x4e066e,_0x3e6843,_0x32d424,_0x255c00){if(_0x4e066e&&_0x3e6843){_0x3e6843[_0xffb1('0x25')]-=0x1;var _0xe9659f={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xffb1('0x15')](_0xffb1('0x27')),'reason':_0xffb1('0x38')};logger[_0xffb1('0x32')](util[_0xffb1('0x15')](_0xffb1('0x39'),_0x4e066e,_0x3e6843[_0xffb1('0x34')]));emitChannelQueueInteraction(_0x32d424['channel'],_0x3e6843['name'],_0x32d424['body'],_0x32d424['account'][_0xffb1('0x34')],_0x32d424[_0xffb1('0x2f')]['id'],![],_0x255c00,_0x3e6843['id']);return rpc[_0x32d424[_0xffb1('0x2a')]+'Interaction'][_0xffb1('0x3a')](_0x32d424[_0xffb1('0x2d')]['id'],{'queueId':_0x3e6843['id']})['then'](function(){if(rpc[_0x32d424[_0xffb1('0x2a')]+'QueueReport']){return rpc[_0x32d424['channel']+_0xffb1('0x35')][_0xffb1('0x3a')](_0x4e066e,_0xe9659f)['catch'](function(_0x1e9a39){logger[_0xffb1('0x3b')](_0xffb1('0x3c'),_0x1e9a39);});}});}}function endRouting(_0x29b2fd,_0x4b7dcb,_0x52279d,_0x301a2a){if(_0x29b2fd&&_0x4b7dcb){_0x4b7dcb[_0xffb1('0x25')]-=0x1;var _0x285778={'leaveAt':moment()['format'](_0xffb1('0x27')),'exitAt':moment()[_0xffb1('0x15')](_0xffb1('0x27')),'reason':'timeout'};logger[_0xffb1('0x32')](util[_0xffb1('0x15')](_0xffb1('0x3d'),_0x29b2fd,_0x4b7dcb[_0xffb1('0x34')]));emitChannelQueueInteraction(_0x52279d[_0xffb1('0x2a')],_0x4b7dcb[_0xffb1('0x34')],_0x52279d['body'],_0x52279d[_0xffb1('0xc')][_0xffb1('0x34')],_0x52279d[_0xffb1('0x2f')]['id'],![],_0x301a2a);if(rpc[_0x52279d[_0xffb1('0x2a')]+_0xffb1('0x35')]){return rpc[_0x52279d[_0xffb1('0x2a')]+_0xffb1('0x35')]['update'](_0x29b2fd,_0x285778)[_0xffb1('0x37')](function(_0x543d84){logger['error']('update\x20queue\x20report',_0x543d84);});}}}function handleFindQueue(_0x2837c7){return function(_0x2f7bcc){return _0x2f7bcc[_0xffb1('0x34')][_0xffb1('0x3e')]()===_0x2837c7[_0xffb1('0x3e')]();};}exports['consequence']=function(_0x21748b,_0x2b35fa,_0x3a2435,_0x4dac60){return function(_0x3d50d5){try{var _0x293d8a={'name':_0x2b35fa[0x0],'timeout':_0x2b35fa[0x1]};var _0x454500=queue['validate'](_0x293d8a,{'typecast':!![]});if(_0x454500[_0xffb1('0x3f')]){logger[_0xffb1('0x3b')](_0xffb1('0x40'),_0x21748b,_[_0xffb1('0x41')](_0x454500,_0xffb1('0x2f'))[_0xffb1('0x42')](',\x20'));_0x3d50d5[_0xffb1('0x43')]();}else{var _0x5b4fdc=_['find'](_0x3a2435[_0x4dac60[_0xffb1('0x2a')]+'Queues'],handleFindQueue(_0x293d8a[_0xffb1('0x34')]));if(_0x5b4fdc){startRouting(_0x21748b,_0x5b4fdc,_0x4dac60,_0x3a2435);var _0x44ab8a=(_0x5b4fdc[_0xffb1('0x44')]||0xa)*0x3e8;var _0x6e030d=(_0x293d8a[_0xffb1('0x44')]||0x14)*0x3e8;var _0x425093;if(_0x44ab8a>_0x6e030d){_0x6e030d=_0x44ab8a;}var _0x285068=seqqueue[_0xffb1('0x45')](_0x44ab8a);_0x285068['id']=_0x21748b;_0x285068[_0xffb1('0x46')]=_0x44ab8a;_0x285068['qtimeout']=_0x6e030d;_0x285068[_0xffb1('0x2a')]=_0x4dac60[_0xffb1('0x2a')];_0x3a2435[_0xffb1('0x47')][_0x21748b]['on'](_0xffb1('0x48'),function(){logger[_0xffb1('0x32')](_0xffb1('0x49'),_0x21748b);stopRouting(_0x21748b,_0x5b4fdc,_0x4dac60,_0x3a2435);clearTimeout(_0x425093);_0x425093=undefined;_0x285068[_0xffb1('0x4a')](!![]);if(_0x3a2435[_0xffb1('0x47')][_0x21748b]){delete _0x3a2435[_0xffb1('0x47')][_0x21748b];}_0x3d50d5[_0xffb1('0x43')]();});_0x3a2435[_0xffb1('0x47')][_0x21748b]['on'](_0xffb1('0x4b'),function(){if(_0x3a2435[_0xffb1('0x47')][_0x21748b]){delete _0x3a2435[_0xffb1('0x47')][_0x21748b];}});_0x425093=setTimeout(function(){logger[_0xffb1('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x21748b);endRouting(_0x21748b,_0x5b4fdc,_0x4dac60,_0x3a2435);clearTimeout(_0x425093);_0x285068[_0xffb1('0x4a')](!![]);_0x3d50d5['next']();},_0x6e030d);switch(_0x5b4fdc[_0xffb1('0x4c')]){case'rrmemory':strategy['rrmemory'](_0x285068,_0x5b4fdc,_0x3a2435,_0x4dac60);break;default:strategy[_0xffb1('0x4d')](_0x285068,_0x5b4fdc,_0x3a2435,_0x4dac60);}}else{logger[_0xffb1('0x3b')](_0xffb1('0x4e'),_0x21748b,_0x293d8a[_0xffb1('0x34')]);_0x3d50d5['stop']();}}}catch(_0x50dd06){logger[_0xffb1('0x3b')]('[%s][QUEUE]\x20%s',_0x21748b,_0x50dd06[_0xffb1('0x4f')]);_0x3d50d5['stop']();}};}; \ No newline at end of file +var _0x0580=['update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','clone','account','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x0580,0x1d0));var _0x0058=function(_0x3b5f36,_0x20330b){_0x3b5f36=_0x3b5f36-0x0;var _0xbb061e=_0x0580[_0x3b5f36];return _0xbb061e;};'use strict';var schema=require(_0x0058('0x0'));var _=require(_0x0058('0x1'));var util=require(_0x0058('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x0058('0x3'));var Redis=require(_0x0058('0x4'));var config=require(_0x0058('0x5'));var logger=require('../../../../config/logger')(_0x0058('0x6'));var strategy=require(_0x0058('0x7'));config[_0x0058('0x8')]=_[_0x0058('0x9')](config[_0x0058('0x8')],{'host':_0x0058('0xa'),'port':0x18eb});var io=require(_0x0058('0xb'))(new Redis(config[_0x0058('0x8')]));var attributes=['id','queue_id','account',_0x0058('0xc'),_0x0058('0xd'),_0x0058('0xe')];function emit(_0x57d2aa,_0x117d9a,_0xbf9687){io['to'](_0x57d2aa)[_0x0058('0xf')](_0x117d9a,_0xbf9687);}function emitChannelQueueInteraction(_0x571dbd,_0x139c33,_0x1ac2fe,_0x7451da,_0x4d1135,_0x1c2daa,_0x5b9782,_0x45940d){var _0x367d21=_[_0x0058('0x10')](_0x1ac2fe);_0x367d21['queue_id']=_0x45940d;_0x367d21[_0x0058('0xc')]=_0x139c33;_0x367d21[_0x0058('0x11')]=_0x7451da;_0x367d21['id']=_0x4d1135;if(_0x1c2daa){attributes[_0x0058('0x12')](_['capitalize'](_0x571dbd)+_0x0058('0x13'));_0x5b9782[util[_0x0058('0x14')](_0x0058('0x15'),_0x571dbd)][_0x4d1135]=_['pick'](_0x367d21,attributes);}else{delete _0x5b9782[util[_0x0058('0x14')](_0x0058('0x15'),_0x571dbd)][_0x4d1135];}emit(util['format'](_0x0058('0x16'),_0x571dbd,_0x139c33),util[_0x0058('0x14')](_0x0058('0x17'),_0x571dbd,_0x1c2daa?_0x0058('0x18'):_0x0058('0x19')),_[_0x0058('0x1a')](_0x367d21,attributes));}var rpc={'openchannelQueueReport':require(_0x0058('0x1b')),'mailQueueReport':require(_0x0058('0x1c')),'chatQueueReport':require(_0x0058('0x1d')),'smsQueueReport':require(_0x0058('0x1e')),'faxQueueReport':require(_0x0058('0x1f')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x0058('0x20')),'mailInteraction':require(_0x0058('0x21')),'openchannelInteraction':require(_0x0058('0x22')),'smsInteraction':require(_0x0058('0x23')),'whatsappInteraction':require(_0x0058('0x24'))};var queue=schema({'name':{'type':_0x0058('0x25'),'required':!![],'message':_0x0058('0x26')},'timeout':{'type':_0x0058('0x27'),'message':_0x0058('0x28')}});function startRouting(_0x4fc5c9,_0xd36342,_0x5ab123,_0x23825e){if(_0x4fc5c9&&_0xd36342&&_0x5ab123){_0xd36342[_0x0058('0x29')]+=0x1;var _0x35b0fa={'uniqueid':_0x4fc5c9,'from':_0x5ab123['body']?_0x5ab123[_0x0058('0x2a')][_0x0058('0xd')]:'','joinAt':moment()[_0x0058('0x14')](_0x0058('0x2b')),'ContactId':_0x5ab123[_0x0058('0x2c')]?_0x5ab123[_0x0058('0x2c')]['id']:null,'ListId':_0x5ab123['list']?_0x5ab123['list']['id']:null};_0x35b0fa[_['upperFirst'](_0x5ab123[_0x0058('0x2d')])+_0x0058('0x2e')]=_0xd36342['id']||null;_0x35b0fa[_[_0x0058('0x2f')](_0x5ab123[_0x0058('0x2d')])+_0x0058('0x13')]=_0x5ab123['interaction']?_0x5ab123[_0x0058('0x30')]['id']:null;_0x35b0fa[_[_0x0058('0x2f')](_0x5ab123['channel'])+_0x0058('0x31')]=_0x5ab123[_0x0058('0x32')]?_0x5ab123[_0x0058('0x32')]['id']:null;_0x35b0fa[_[_0x0058('0x2f')](_0x5ab123[_0x0058('0x2d')])+(_0x5ab123[_0x0058('0x2d')]!=='chat'?_0x0058('0x33'):_0x0058('0x34'))]=_0x5ab123[_0x0058('0x11')]?_0x5ab123[_0x0058('0x11')]['id']:null;logger['info'](util[_0x0058('0x14')](_0x0058('0x35'),_0x4fc5c9,_0xd36342[_0x0058('0x36')]));emitChannelQueueInteraction(_0x5ab123[_0x0058('0x2d')],_0xd36342[_0x0058('0x36')],_0x35b0fa,_0x5ab123[_0x0058('0x11')]['name'],_0x5ab123[_0x0058('0x32')]['id'],!![],_0x23825e,_0xd36342['id']);if(rpc[_0x5ab123['channel']+_0x0058('0x37')]){return rpc[_0x5ab123[_0x0058('0x2d')]+_0x0058('0x37')][_0x0058('0x38')](_0x35b0fa)[_0x0058('0x39')](function(_0x43355a){logger[_0x0058('0x3a')]('create\x20queue\x20report',_0x43355a);});}}}function stopRouting(_0x1d8338,_0x206de4,_0x2c5b5e,_0x5d9c2c){if(_0x1d8338&&_0x206de4){_0x206de4[_0x0058('0x29')]-=0x1;var _0xa74779={'leaveAt':moment()[_0x0058('0x14')](_0x0058('0x2b')),'acceptAt':moment()[_0x0058('0x14')](_0x0058('0x2b')),'reason':_0x0058('0x3b')};logger[_0x0058('0x3c')](util[_0x0058('0x14')](_0x0058('0x3d'),_0x1d8338,_0x206de4[_0x0058('0x36')]));emitChannelQueueInteraction(_0x2c5b5e[_0x0058('0x2d')],_0x206de4[_0x0058('0x36')],_0x2c5b5e['body'],_0x2c5b5e['account'][_0x0058('0x36')],_0x2c5b5e[_0x0058('0x32')]['id'],![],_0x5d9c2c,_0x206de4['id']);return rpc[_0x2c5b5e[_0x0058('0x2d')]+_0x0058('0x3e')]['update'](_0x2c5b5e['interaction']['id'],{'queueId':_0x206de4['id']})[_0x0058('0x3f')](function(){if(rpc[_0x2c5b5e['channel']+_0x0058('0x37')]){return rpc[_0x2c5b5e[_0x0058('0x2d')]+_0x0058('0x37')][_0x0058('0x40')](_0x1d8338,_0xa74779)[_0x0058('0x39')](function(_0x186c9b){logger[_0x0058('0x3a')](_0x0058('0x41'),_0x186c9b);});}});}}function endRouting(_0x212dc3,_0x44e7b1,_0x342405,_0x23e9f6){if(_0x212dc3&&_0x44e7b1){_0x44e7b1[_0x0058('0x29')]-=0x1;var _0x1a0ebf={'leaveAt':moment()[_0x0058('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x0058('0x2b')),'reason':_0x0058('0x42')};logger[_0x0058('0x3c')](util['format'](_0x0058('0x43'),_0x212dc3,_0x44e7b1['name']));emitChannelQueueInteraction(_0x342405[_0x0058('0x2d')],_0x44e7b1[_0x0058('0x36')],_0x342405[_0x0058('0x2a')],_0x342405['account'][_0x0058('0x36')],_0x342405[_0x0058('0x32')]['id'],![],_0x23e9f6);if(rpc[_0x342405['channel']+'QueueReport']){return rpc[_0x342405[_0x0058('0x2d')]+_0x0058('0x37')]['update'](_0x212dc3,_0x1a0ebf)['catch'](function(_0x2d28c3){logger[_0x0058('0x3a')]('update\x20queue\x20report',_0x2d28c3);});}}}function handleFindQueue(_0x4f86f1){return function(_0x4976b4){return _0x4976b4['name'][_0x0058('0x44')]()===_0x4f86f1['toLowerCase']();};}exports[_0x0058('0x45')]=function(_0x4b77e0,_0x3459bc,_0x4d1e0f,_0x320d68){return function(_0x32ad97){try{var _0x367627={'name':_0x3459bc[0x0],'timeout':_0x3459bc[0x1]};var _0x1d573c=queue[_0x0058('0x0')](_0x367627,{'typecast':!![]});if(_0x1d573c[_0x0058('0x46')]){logger[_0x0058('0x3a')](_0x0058('0x47'),_0x4b77e0,_['map'](_0x1d573c,'message')[_0x0058('0x48')](',\x20'));_0x32ad97[_0x0058('0x49')]();}else{var _0x3137b1=_[_0x0058('0x4a')](_0x4d1e0f[_0x320d68['channel']+_0x0058('0x4b')],handleFindQueue(_0x367627[_0x0058('0x36')]));if(_0x3137b1){startRouting(_0x4b77e0,_0x3137b1,_0x320d68,_0x4d1e0f);var _0x443f79=(_0x3137b1[_0x0058('0x42')]||0xa)*0x3e8;var _0x416172=(_0x367627['timeout']||0x14)*0x3e8;var _0x1a1e72;if(_0x443f79>_0x416172){_0x416172=_0x443f79;}var _0x3f651a=seqqueue[_0x0058('0x4c')](_0x443f79);_0x3f651a['id']=_0x4b77e0;_0x3f651a[_0x0058('0x4d')]=_0x443f79;_0x3f651a[_0x0058('0x4e')]=_0x416172;_0x3f651a[_0x0058('0x2d')]=_0x320d68[_0x0058('0x2d')];_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]['on']('end',function(){logger[_0x0058('0x3c')](_0x0058('0x50'),_0x4b77e0);stopRouting(_0x4b77e0,_0x3137b1,_0x320d68,_0x4d1e0f);clearTimeout(_0x1a1e72);_0x1a1e72=undefined;_0x3f651a[_0x0058('0x51')](!![]);if(_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]){delete _0x4d1e0f['rules'][_0x4b77e0];}_0x32ad97[_0x0058('0x49')]();});_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]['on'](_0x0058('0x52'),function(){if(_0x4d1e0f[_0x0058('0x4f')][_0x4b77e0]){delete _0x4d1e0f[_0x0058('0x4f')][_0x4b77e0];}});_0x1a1e72=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4b77e0);endRouting(_0x4b77e0,_0x3137b1,_0x320d68,_0x4d1e0f);clearTimeout(_0x1a1e72);_0x3f651a[_0x0058('0x51')](!![]);_0x32ad97[_0x0058('0x53')]();},_0x416172);switch(_0x3137b1['strategy']){case'rrmemory':strategy[_0x0058('0x54')](_0x3f651a,_0x3137b1,_0x4d1e0f,_0x320d68);break;default:strategy[_0x0058('0x55')](_0x3f651a,_0x3137b1,_0x4d1e0f,_0x320d68);}}else{logger[_0x0058('0x3a')](_0x0058('0x56'),_0x4b77e0,_0x367627[_0x0058('0x36')]);_0x32ad97[_0x0058('0x49')]();}}}catch(_0x47bc0b){logger['error'](_0x0058('0x47'),_0x4b77e0,_0x47bc0b[_0x0058('0x57')]);_0x32ad97['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 d1c171a..bdf845a 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 _0xf2ca=['channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','handleRun','bind','timeout','drained','handleDrained','push','prototype','handleTimeout','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership'];(function(_0x47e5ad,_0x4a1a3e){var _0x34203f=function(_0x24506d){while(--_0x24506d){_0x47e5ad['push'](_0x47e5ad['shift']());}};_0x34203f(++_0x4a1a3e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xf2ca[_0x4cd690];return _0x4a74a9;};'use strict';var _=require(_0xaf2c('0x0'));var uuid=require(_0xaf2c('0x1'));var util=require(_0xaf2c('0x2'));var logger=require('../../../../../config/logger')(_0xaf2c('0x3'));var Agent=function(_0x2102e2,_0x1271a9,_0x219511,_0x3a724c){this[_0xaf2c('0x4')]=uuid['v4']();this['squeue']=_0x2102e2;this[_0xaf2c('0x5')]=_0x1271a9;this[_0xaf2c('0x6')]=_0x219511;this[_0xaf2c('0x3')]=_0x3a724c;this[_0xaf2c('0x7')]['push'](this[_0xaf2c('0x8')][_0xaf2c('0x9')](this),this['handleTimeout'][_0xaf2c('0x9')](this));this['squeue']['on'](_0xaf2c('0xa'),this['handleTimeout'][_0xaf2c('0x9')](this));this[_0xaf2c('0x7')]['on'](_0xaf2c('0xb'),this[_0xaf2c('0xc')]['bind'](this));};Agent['prototype'][_0xaf2c('0xd')]=function(){this[_0xaf2c('0x7')][_0xaf2c('0xd')](this[_0xaf2c('0x8')][_0xaf2c('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0xaf2c('0xe')][_0xaf2c('0xc')]=function(){this[_0xaf2c('0xf')](!![]);};Agent[_0xaf2c('0xe')][_0xaf2c('0x8')]=function(){logger[_0xaf2c('0x10')](_0xaf2c('0x11'),this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);if(_[_0xaf2c('0x12')](this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']])){logger[_0xaf2c('0x10')](_0xaf2c('0x14'),this['squeue']['id'],this[_0xaf2c('0x5')]['id']);setTimeout(this['push'][_0xaf2c('0x9')](this),0x3e8);}else{if(this[_0xaf2c('0x3')][_0xaf2c('0x15')]||util['isAgentAvailable'](this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']],this[_0xaf2c('0x7')][_0xaf2c('0x16')],![])){this['realtime'][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x17')]=!![];this[_0xaf2c('0x6')][_0xaf2c('0x13')][this['agent']['id']][_0xaf2c('0x18')]=undefined;util[_0xaf2c('0x19')](this[_0xaf2c('0x6')],this['routing'],this['agent'],this[_0xaf2c('0x7')][_0xaf2c('0x16')]);util[_0xaf2c('0x1a')](this[_0xaf2c('0x4')],this['squeue']['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']],null,this[_0xaf2c('0x3')]);util[_0xaf2c('0x1b')](this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x6')]['agents'][this[_0xaf2c('0x5')]['id']],_0xaf2c('0x1c')+(this[_0xaf2c('0x3')][_0xaf2c('0x15')]?':FORCED':''));}else{logger[_0xaf2c('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);setTimeout(this[_0xaf2c('0xd')]['bind'](this),0x3e8);}}};Agent[_0xaf2c('0xe')][_0xaf2c('0xf')]=function(_0x3baee2){if(_['isNil'](this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']])){return logger[_0xaf2c('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xaf2c('0x7')]['id'],this[_0xaf2c('0x5')]['id']);}else{logger[_0xaf2c('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xaf2c('0x5')]['id']);util['hideNotification'](this[_0xaf2c('0x4')],this['squeue']['id'],this[_0xaf2c('0x6')][_0xaf2c('0x13')][this['agent']['id']],null,this[_0xaf2c('0x3')]);this[_0xaf2c('0x6')]['agents'][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x17')]=![];this[_0xaf2c('0x6')][_0xaf2c('0x13')][this[_0xaf2c('0x5')]['id']][_0xaf2c('0x18')]=undefined;util['removeWaitingNotification'](this[_0xaf2c('0x6')],this['routing'],this[_0xaf2c('0x5')],this['squeue'][_0xaf2c('0x16')]);util['writeLog'](this[_0xaf2c('0x7')]['id'],this['realtime'][_0xaf2c('0x13')][this['agent']['id']],_0x3baee2?_0xaf2c('0x1d'):_0xaf2c('0x1e'));}if(!_0x3baee2){setTimeout(this[_0xaf2c('0xd')][_0xaf2c('0x9')](this),0x3e8);}};function agent(_0x470aff,_0x598adb,_0x4cba13,_0x6f428d){return new Agent(_0x470aff,_0x598adb,_0x4cba13,_0x6f428d);}module[_0xaf2c('0x1f')]=agent; \ No newline at end of file +var _0xd0bb=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x2fc5d4,_0x514199){_0x2fc5d4=_0x2fc5d4-0x0;var _0x3b273c=_0xd0bb[_0x2fc5d4];return _0x3b273c;};'use strict';var _=require(_0xbd0b('0x0'));var uuid=require(_0xbd0b('0x1'));var util=require(_0xbd0b('0x2'));var logger=require('../../../../../config/logger')(_0xbd0b('0x3'));var Agent=function(_0x4ab08f,_0x39b03a,_0x1f6ec3,_0x53e6ce){this[_0xbd0b('0x4')]=uuid['v4']();this['squeue']=_0x4ab08f;this[_0xbd0b('0x5')]=_0x39b03a;this[_0xbd0b('0x6')]=_0x1f6ec3;this[_0xbd0b('0x3')]=_0x53e6ce;this[_0xbd0b('0x7')][_0xbd0b('0x8')](this['handleRun'][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xb'),this['handleTimeout']['bind'](this));this[_0xbd0b('0x7')]['on'](_0xbd0b('0xc'),this['handleDrained'][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')]['push']=function(){this[_0xbd0b('0x7')][_0xbd0b('0x8')](this[_0xbd0b('0xe')][_0xbd0b('0x9')](this),this[_0xbd0b('0xa')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xd')][_0xbd0b('0xf')]=function(){this[_0xbd0b('0xa')](!![]);};Agent[_0xbd0b('0xd')][_0xbd0b('0xe')]=function(){logger['debug'](_0xbd0b('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']])){logger[_0xbd0b('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xbd0b('0x5')]['id']);setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}else{if(this[_0xbd0b('0x3')][_0xbd0b('0x14')]||util[_0xbd0b('0x15')](this['squeue']['id'],this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']],this[_0xbd0b('0x7')][_0xbd0b('0x16')],![])){this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=!![];this[_0xbd0b('0x6')]['agents'][this[_0xbd0b('0x5')]['id']]['busyQueue']=undefined;util[_0xbd0b('0x18')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x19')](this['notificationId'],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],null,this[_0xbd0b('0x3')]);util[_0xbd0b('0x1a')](this['squeue']['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xbd0b('0x1b')+(this[_0xbd0b('0x3')][_0xbd0b('0x14')]?':FORCED':''));}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1c'),this[_0xbd0b('0x7')]['id'],this['agent']['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xd')][_0xbd0b('0xa')]=function(_0xf4ba04){if(_[_0xbd0b('0x11')](this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']])){return logger[_0xbd0b('0x13')](_0xbd0b('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xbd0b('0x13')](_0xbd0b('0x1e'),this['squeue']['id'],this[_0xbd0b('0x5')]['id']);util[_0xbd0b('0x1f')](this[_0xbd0b('0x4')],this[_0xbd0b('0x7')]['id'],this[_0xbd0b('0x6')][_0xbd0b('0x12')][this['agent']['id']],null,this[_0xbd0b('0x3')]);this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x17')]=![];this[_0xbd0b('0x6')][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']][_0xbd0b('0x20')]=undefined;util[_0xbd0b('0x21')](this[_0xbd0b('0x6')],this[_0xbd0b('0x3')],this[_0xbd0b('0x5')],this[_0xbd0b('0x7')]['channel']);util[_0xbd0b('0x1a')](this[_0xbd0b('0x7')]['id'],this['realtime'][_0xbd0b('0x12')][this[_0xbd0b('0x5')]['id']],_0xf4ba04?_0xbd0b('0x22'):_0xbd0b('0x23'));}if(!_0xf4ba04){setTimeout(this[_0xbd0b('0x8')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098){return new Agent(_0x4c8ff5,_0x327425,_0x11cf5a,_0x3b5098);}module[_0xbd0b('0x24')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index b83870c..3feaa34 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 _0x87ee=['timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout'];(function(_0x406d90,_0x3fcf44){var _0x10780d=function(_0x143fdb){while(--_0x143fdb){_0x406d90['push'](_0x406d90['shift']());}};_0x10780d(++_0x3fcf44);}(_0x87ee,0x174));var _0xe87e=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x87ee[_0x125ff8];return _0x2d9ef;};'use strict';var _=require(_0xe87e('0x0'));var uuid=require(_0xe87e('0x1'));var util=require(_0xe87e('0x2'));var logger=require(_0xe87e('0x3'))(_0xe87e('0x4'));var Beepall=function(_0xd5af9a,_0x399408,_0x3925db,_0x29e05c){this[_0xe87e('0x5')]=uuid['v4']();this[_0xe87e('0x6')]=_0xd5af9a;this[_0xe87e('0x7')]=_0x399408;this[_0xe87e('0x8')]=_0x3925db;this[_0xe87e('0x4')]=_0x29e05c;this[_0xe87e('0x6')][_0xe87e('0x9')](this[_0xe87e('0xa')][_0xe87e('0xb')](this),this[_0xe87e('0xc')]['bind'](this));this[_0xe87e('0x6')]['on'](_0xe87e('0xd'),this['handleTimeout'][_0xe87e('0xb')](this));this[_0xe87e('0x6')]['on'](_0xe87e('0xe'),this['handleDrained'][_0xe87e('0xb')](this));};Beepall['prototype'][_0xe87e('0x9')]=function(){this[_0xe87e('0x6')][_0xe87e('0x9')](this[_0xe87e('0xa')]['bind'](this),this['handleTimeout'][_0xe87e('0xb')](this));};Beepall['prototype'][_0xe87e('0xf')]=function(){this[_0xe87e('0xc')](!![]);};Beepall[_0xe87e('0x10')][_0xe87e('0xa')]=function(){var _0x22c09e=!![];if(!_['isNil'](this[_0xe87e('0x7')])&&!_[_0xe87e('0x11')](this[_0xe87e('0x7')][_0xe87e('0x12')])&&this[_0xe87e('0x7')][_0xe87e('0x12')]['length']>0x0){for(var _0x1a3a13=0x0,_0x2cb009;_0x1a3a130x0){for(var _0x4f7978=0x0,_0x402111;_0x4f79780x0&&_0x46bde2[_0x408db6+_0x2573('0x21')]>=_0x46bde2[_0x408db6+_0x2573('0x22')]){writeLog(_0x4c44f2,_0x46bde2,_0x408db6['toUpperCase']()+_0x2573('0x23'));return![];}}return!![];};exports[_0x2573('0x24')]=function(_0x30dda3,_0x51195c,_0x26f8a6,_0x2dd6ee,_0x3434d7){return sendNotification(!![],_0x30dda3,_0x51195c,_0x26f8a6,_0x2dd6ee,_0x3434d7);};exports[_0x2573('0x25')]=function(_0x19c055,_0x818cd7,_0x2a9a2b,_0x4512e2,_0x31e57e){return sendNotification(![],_0x19c055,_0x818cd7,_0x2a9a2b,_0x4512e2,_0x31e57e);};exports['checkWaitingNotifications']=function(_0x7e68a3,_0x2d03f9,_0x437c32){var _0x1f8620=_0x2d03f9[_0x2573('0x26')][_0x2573('0x27')];if(!_0x1f8620&&_0x437c32){_0x1f8620=_0x437c32['id'];}var _0x183a89=_['some'](_0x7e68a3[_0x2d03f9[_0x2573('0x28')]+_0x2573('0x29')],function(_0x249902){var _0x1182af=_[_0x2573('0x2a')](_0x2d03f9['channel'])+_0x2573('0x2b');return _0x249902[_0x1182af]===_0x2d03f9[_0x2573('0x26')]['id'];});if(!_0x183a89&&_0x1f8620&&_0x7e68a3[_0x2573('0x2c')][_0x1f8620]){_0x183a89=_[_0x2573('0x2d')](_0x7e68a3[_0x2573('0x2c')][_0x1f8620][_0x2d03f9[_0x2573('0x28')]+_0x2573('0x2e')],function(_0x5872d5){return _0x5872d5['id']===_0x2d03f9['interaction']['id'];});}return _0x183a89;};exports[_0x2573('0x2f')]=function(_0x3f9699,_0x314aab,_0x5ce45c,_0x13d6a0){if(_0x5ce45c&&_0x5ce45c['id']&&_0x3f9699[_0x2573('0x2c')]&&_0x3f9699[_0x2573('0x2c')][_0x5ce45c['id']]){_0x3f9699[_0x2573('0x2c')][_0x5ce45c['id']][_0x13d6a0+_0x2573('0x2e')][_0x314aab[_0x2573('0x14')]['id']]={'id':_0x314aab[_0x2573('0x26')]['id']};}};exports['removeWaitingNotification']=function(_0x3cd1b6,_0x9ce98a,_0x5cdd4c,_0x19098b){if(_0x5cdd4c&&_0x5cdd4c['id']&&_0x3cd1b6[_0x2573('0x2c')]&&_0x3cd1b6[_0x2573('0x2c')][_0x5cdd4c['id']]){delete _0x3cd1b6[_0x2573('0x2c')][_0x5cdd4c['id']][_0x19098b+_0x2573('0x2e')][_0x9ce98a[_0x2573('0x14')]['id']];}};exports[_0x2573('0x30')]=writeLog; \ No newline at end of file +var _0x8135=['msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','emit','save','remove','debug','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','interaction','some','channel','capitalize','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','util','ioredis','../../../../../config/environment','redis','defaults','localhost','\x20interaction','name','notificationSound','account','body','queue','getMustacheRender','notificationTemplate'];(function(_0x598a86,_0x448bdf){var _0x4e19b6=function(_0x135fdb){while(--_0x135fdb){_0x598a86['push'](_0x598a86['shift']());}};_0x4e19b6(++_0x448bdf);}(_0x8135,0x171));var _0x5813=function(_0x326634,_0x4dd6e8){_0x326634=_0x326634-0x0;var _0x5cef96=_0x8135[_0x326634];return _0x5cef96;};'use strict';var _=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var utils=require('../utils');var Redis=require(_0x5813('0x2'));var config=require(_0x5813('0x3'));var logger=require('../../../../../config/logger')('routing');config[_0x5813('0x4')]=_[_0x5813('0x5')](config[_0x5813('0x4')],{'host':_0x5813('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5813('0x4')]));function sendNotification(_0x4bc5de,_0x517898,_0x4fd2c8,_0x5c6798,_0x32f39e,_0x209cb3){var _0xdbe55d=_0x209cb3||{};var _0x88b635=_0x4fd2c8['split']('.');var _0x97ddbc={'uniqueid':_0x517898,'channel':_0x88b635[0x0],'id':_0x88b635[0x1],'title':_0x88b635[0x0]+_0x5813('0x7'),'interactionId':_0x88b635[0x2],'queue':_0x32f39e?_0x32f39e[_0x5813('0x8')]:null,'sound':_0xdbe55d['account'][_0x5813('0x9')],'shake':_0xdbe55d[_0x5813('0xa')]['notificationShake']};try{if(!_0xdbe55d[_0x5813('0xb')]){_0xdbe55d[_0x5813('0xb')]={};}if(_0x32f39e){_0xdbe55d[_0x5813('0xb')]['queue']=_0x32f39e;}else if(_0xdbe55d[_0x5813('0xb')][_0x5813('0xc')]){delete _0xdbe55d['body'][_0x5813('0xc')];}_0x97ddbc['msg']=utils[_0x5813('0xd')](_0xdbe55d[_0x5813('0xa')][_0x5813('0xe')],_0xdbe55d);}catch(_0x5d6fe2){_0x97ddbc[_0x5813('0xf')]=_0x5813('0x10');logger[_0x5813('0x11')](util[_0x5813('0x12')](_0x5813('0x13'),_0x517898,_0x5d6fe2[_0x5813('0x14')]));}io['to'](util['format'](_0x5813('0x15'),_0x5c6798[_0x5813('0x8')]))[_0x5813('0x16')](util[_0x5813('0x12')]('notification:%s',_0x4bc5de?_0x5813('0x17'):_0x5813('0x18')),_0x97ddbc);}function writeLog(_0x30f9ff,_0x3efa13,_0x1718fc){return logger[_0x5813('0x19')](util[_0x5813('0x12')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x30f9ff,_0x3efa13[_0x5813('0x8')],_0x1718fc));}exports[_0x5813('0x1a')]=function(_0x1debe5,_0x7919ab,_0x2f5b24,_0xb6a8be){if(_0x7919ab[_0x5813('0x1b')]){writeLog(_0x1debe5,_0x7919ab,_0x5813('0x1c'));return![];}if(!_0x7919ab[_0x5813('0x1d')]){writeLog(_0x1debe5,_0x7919ab,_0x5813('0x1e'));return![];}if(_0x7919ab[_0x2f5b24+_0x5813('0x1f')]){writeLog(_0x1debe5,_0x7919ab,'PAUSE');return![];}if(_0xb6a8be&&_0x7919ab[_0x5813('0x20')](_0x2f5b24+'Capacity')&&_0x7919ab[_0x5813('0x20')](_0x2f5b24+_0x5813('0x21'))){if(_0x7919ab[_0x2f5b24+_0x5813('0x22')]>0x0&&_0x7919ab[_0x2f5b24+_0x5813('0x21')]>=_0x7919ab[_0x2f5b24+_0x5813('0x22')]){writeLog(_0x1debe5,_0x7919ab,_0x2f5b24[_0x5813('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5813('0x24')]=function(_0x4e3744,_0x44af32,_0x203a77,_0x69cf30,_0x16372c){return sendNotification(!![],_0x4e3744,_0x44af32,_0x203a77,_0x69cf30,_0x16372c);};exports[_0x5813('0x25')]=function(_0xd1fed9,_0x347c19,_0x31aa3d,_0xb80317,_0x1ea914){return sendNotification(![],_0xd1fed9,_0x347c19,_0x31aa3d,_0xb80317,_0x1ea914);};exports['checkWaitingNotifications']=function(_0x1a2ac9,_0x199120,_0x1b946a){var _0x2090b5=_0x199120[_0x5813('0x26')]['UserId'];if(!_0x2090b5&&_0x1b946a){_0x2090b5=_0x1b946a['id'];}var _0x32688c=_[_0x5813('0x27')](_0x1a2ac9[_0x199120[_0x5813('0x28')]+'QueuesWaitingInteractions'],function(_0x25db63){var _0x2ba613=_[_0x5813('0x29')](_0x199120['channel'])+_0x5813('0x2a');return _0x25db63[_0x2ba613]===_0x199120['interaction']['id'];});if(!_0x32688c&&_0x2090b5&&_0x1a2ac9['agents'][_0x2090b5]){_0x32688c=_['some'](_0x1a2ac9['agents'][_0x2090b5][_0x199120[_0x5813('0x28')]+_0x5813('0x2b')],function(_0x25f850){return _0x25f850['id']===_0x199120[_0x5813('0x26')]['id'];});}return _0x32688c;};exports[_0x5813('0x2c')]=function(_0x5758ff,_0x250f09,_0x56941c,_0x2fdd2a){if(_0x56941c&&_0x56941c['id']&&_0x5758ff[_0x5813('0x2d')]&&_0x5758ff[_0x5813('0x2d')][_0x56941c['id']]){_0x5758ff[_0x5813('0x2d')][_0x56941c['id']][_0x2fdd2a+_0x5813('0x2b')][_0x250f09[_0x5813('0x14')]['id']]={'id':_0x250f09[_0x5813('0x26')]['id']};}};exports[_0x5813('0x2e')]=function(_0x2578a1,_0x43ca12,_0x11844e,_0x10ad59){if(_0x11844e&&_0x11844e['id']&&_0x2578a1['agents']&&_0x2578a1['agents'][_0x11844e['id']]){delete _0x2578a1[_0x5813('0x2d')][_0x11844e['id']][_0x10ad59+'WaitingInteractions'][_0x43ca12['message']['id']];}};exports[_0x5813('0x2f')]=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 b623ad8..61491dd 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 _0xfa8d=['stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject'];(function(_0x44d1b8,_0x3a2cf3){var _0x2b811f=function(_0x1a24f2){while(--_0x1a24f2){_0x44d1b8['push'](_0x44d1b8['shift']());}};_0x2b811f(++_0x3a2cf3);}(_0xfa8d,0x9d));var _0xdfa8=function(_0x508acd,_0x441448){_0x508acd=_0x508acd-0x0;var _0x364271=_0xfa8d[_0x508acd];return _0x364271;};'use strict';var schema=require(_0xdfa8('0x0'));var sh=require(_0xdfa8('0x1'));var _=require(_0xdfa8('0x2'));var utils=require(_0xdfa8('0x3'));var logger=require(_0xdfa8('0x4'))(_0xdfa8('0x5'));var system=schema({'command':{'type':_0xdfa8('0x6'),'required':!![],'message':_0xdfa8('0x7')}});exports[_0xdfa8('0x8')]=function(_0x1e0bd1,_0x3e9b08){return function(_0x124e63){try{var _0x39088d={'command':_0x3e9b08[0x0]};var _0x4add37=system[_0xdfa8('0x0')](_0x39088d,{'typecast':!![]});if(_0x4add37[_0xdfa8('0x9')]){logger[_0xdfa8('0xa')]('[%s][SYSTEM]\x20%s',_0x1e0bd1,_[_0xdfa8('0xb')](_0x4add37,'message')['join'](',\x20'));logger[_0xdfa8('0xc')](_0xdfa8('0xd'),_0x1e0bd1);_0x124e63[_0xdfa8('0xe')]();}else{var _0x27cd6b=this;var _0x4c8c5e=utils[_0xdfa8('0xf')](_0x3e9b08[0x0],this);logger[_0xdfa8('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1e0bd1,_0x4c8c5e);sh['exec'](_[_0xdfa8('0x10')](_0x4c8c5e),function(_0x502223,_0x42bf8e){logger['info'](_0xdfa8('0x11'),_0x1e0bd1,_0x502223);if(_0x502223==0x0){var _0x308905=_0x42bf8e[_0xdfa8('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xdfa8('0x13')](_0x3e9b08[0x1])||_[_0xdfa8('0x14')](_0x3e9b08[0x1])){logger['info'](_0xdfa8('0x15'),_0x1e0bd1);_0x27cd6b['body'][_0x3e9b08[0x1]]=_0x308905;}else{logger[_0xdfa8('0xc')](_0xdfa8('0x16'),_0x1e0bd1,_0x3e9b08[0x1],_0x308905);_0x27cd6b[_0xdfa8('0x17')][_0x3e9b08[0x1]]=_0x308905;}}_0x124e63[_0xdfa8('0xe')]();});}}catch(_0x59399f){logger[_0xdfa8('0xa')]('[%s][SYSTEM]\x20%s',_0x1e0bd1,_[_0xdfa8('0x18')](_0x59399f)?JSON[_0xdfa8('0x19')](_0x59399f):_0x59399f);logger[_0xdfa8('0xc')](_0xdfa8('0xd'),_0x1e0bd1);_0x124e63['next']();}};}; \ No newline at end of file +var _0x0738=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','next'];(function(_0x28ee69,_0xac3a4f){var _0x175b38=function(_0x16ec94){while(--_0x16ec94){_0x28ee69['push'](_0x28ee69['shift']());}};_0x175b38(++_0xac3a4f);}(_0x0738,0xb9));var _0x8073=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0738[_0x57b54c];return _0x59cc19;};'use strict';var schema=require(_0x8073('0x0'));var sh=require(_0x8073('0x1'));var _=require(_0x8073('0x2'));var utils=require(_0x8073('0x3'));var logger=require(_0x8073('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x8073('0x5')}});exports[_0x8073('0x6')]=function(_0x1133f4,_0x683b93){return function(_0x323d7b){try{var _0xb545c5={'command':_0x683b93[0x0]};var _0x3844f7=system[_0x8073('0x0')](_0xb545c5,{'typecast':!![]});if(_0x3844f7[_0x8073('0x7')]){logger[_0x8073('0x8')](_0x8073('0x9'),_0x1133f4,_['map'](_0x3844f7,'message')[_0x8073('0xa')](',\x20'));logger[_0x8073('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1133f4);_0x323d7b[_0x8073('0xc')]();}else{var _0x33674f=this;var _0x28031e=utils[_0x8073('0xd')](_0x683b93[0x0],this);logger['info'](_0x8073('0xe'),_0x1133f4,_0x28031e);sh['exec'](_[_0x8073('0xf')](_0x28031e),function(_0x4fc66e,_0x503250){logger[_0x8073('0xb')](_0x8073('0x10'),_0x1133f4,_0x4fc66e);if(_0x4fc66e==0x0){var _0x4bfe3d=_0x503250[_0x8073('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x8073('0x12')](_0x683b93[0x1])||_['isEmpty'](_0x683b93[0x1])){logger[_0x8073('0xb')](_0x8073('0x13'),_0x1133f4);_0x33674f[_0x8073('0x14')][_0x683b93[0x1]]=_0x4bfe3d;}else{logger[_0x8073('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1133f4,_0x683b93[0x1],_0x4bfe3d);_0x33674f[_0x8073('0x14')][_0x683b93[0x1]]=_0x4bfe3d;}}_0x323d7b[_0x8073('0xc')]();});}}catch(_0x1507df){logger[_0x8073('0x8')](_0x8073('0x9'),_0x1133f4,_[_0x8073('0x15')](_0x1507df)?JSON['stringify'](_0x1507df):_0x1507df);logger[_0x8073('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1133f4);_0x323d7b[_0x8073('0xc')]();}};}; \ 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 c169bd7..b3b309e 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 _0x1511=['[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','next','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error'];(function(_0x579bc0,_0x34c0cc){var _0x379218=function(_0x1afd20){while(--_0x1afd20){_0x579bc0['push'](_0x579bc0['shift']());}};_0x379218(++_0x34c0cc);}(_0x1511,0x144));var _0x1151=function(_0x27324a,_0x3f87a5){_0x27324a=_0x27324a-0x0;var _0xb26b19=_0x1511[_0x27324a];return _0xb26b19;};'use strict';var schema=require('validate');var _=require(_0x1151('0x0'));var rpc={'chatInteraction':require(_0x1151('0x1')),'openchannelInteraction':require(_0x1151('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x1151('0x3')),'faxInteraction':require(_0x1151('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1151('0x5'))(_0x1151('0x6'));var tag=schema({'tag':{'type':_0x1151('0x7'),'required':!![],'message':_0x1151('0x8')}});exports[_0x1151('0x9')]=function(_0x2252fa,_0x183197,_0x2e81fa,_0x4d7126){return function(_0x2eb2ff){try{var _0x1be995={'tag':_0x183197[0x0]};var _0x4e21c3=tag[_0x1151('0xa')](_0x1be995,{'typecast':!![]});if(_0x4e21c3['length']){logger[_0x1151('0xb')](_0x1151('0xc'),_0x2252fa,_[_0x1151('0xd')](_0x4e21c3,_0x1151('0xe'))[_0x1151('0xf')](',\x20'));logger[_0x1151('0x10')](_0x1151('0x11'),_0x2252fa);_0x2eb2ff['next']();}else{var _0x1421e3={'ids':[_0x183197[0x0]]};if(rpc[_0x4d7126['channel']+_0x1151('0x12')]){rpc[_0x4d7126[_0x1151('0x13')]+_0x1151('0x12')][_0x1151('0x14')](_0x4d7126[_0x1151('0x15')]['id'],_0x1421e3)[_0x1151('0x16')](function(_0x49d21c){logger['info'](_0x1151('0x17'),_0x2252fa,_0x183197[0x1],_0x4d7126['channel'],_0x4d7126['interaction']['id']);})['catch'](function(_0xe05106){logger[_0x1151('0xb')](_0x1151('0xc'),_0x2252fa,JSON[_0x1151('0x18')](_0xe05106));logger[_0x1151('0x10')](_0x1151('0x11'),_0x2252fa);})[_0x1151('0x19')](function(){_0x2eb2ff['next']();});}}}catch(_0x495aee){logger[_0x1151('0xb')](_0x1151('0xc'),_0x2252fa,_[_0x1151('0x1a')](_0x495aee)?JSON[_0x1151('0x18')](_0x495aee):_0x495aee);logger[_0x1151('0x10')](_0x1151('0x11'),_0x2252fa);_0x2eb2ff[_0x1151('0x1b')]();}};}; \ No newline at end of file +var _0x41fb=['next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../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','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x41fb,0x12d));var _0xb41f=function(_0x197576,_0xf4aa75){_0x197576=_0x197576-0x0;var _0x3e6603=_0x41fb[_0x197576];return _0x3e6603;};'use strict';var schema=require(_0xb41f('0x0'));var _=require(_0xb41f('0x1'));var rpc={'chatInteraction':require(_0xb41f('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb41f('0x3')),'mailInteraction':require(_0xb41f('0x4')),'faxInteraction':require(_0xb41f('0x5')),'whatsappInteraction':require(_0xb41f('0x6'))};var logger=require(_0xb41f('0x7'))(_0xb41f('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb41f('0x9')}});exports[_0xb41f('0xa')]=function(_0x4fe848,_0x4f2e85,_0x3ab2ff,_0x4a3b22){return function(_0x202ea4){try{var _0xc0a7f={'tag':_0x4f2e85[0x0]};var _0x3657dc=tag[_0xb41f('0x0')](_0xc0a7f,{'typecast':!![]});if(_0x3657dc[_0xb41f('0xb')]){logger['error'](_0xb41f('0xc'),_0x4fe848,_[_0xb41f('0xd')](_0x3657dc,_0xb41f('0xe'))[_0xb41f('0xf')](',\x20'));logger[_0xb41f('0x10')](_0xb41f('0x11'),_0x4fe848);_0x202ea4[_0xb41f('0x12')]();}else{var _0x2dc513={'ids':[_0x4f2e85[0x0]]};if(rpc[_0x4a3b22[_0xb41f('0x13')]+_0xb41f('0x14')]){rpc[_0x4a3b22[_0xb41f('0x13')]+_0xb41f('0x14')][_0xb41f('0x15')](_0x4a3b22['interaction']['id'],_0x2dc513)[_0xb41f('0x16')](function(_0x3946c3){logger['info'](_0xb41f('0x17'),_0x4fe848,_0x4f2e85[0x1],_0x4a3b22['channel'],_0x4a3b22[_0xb41f('0x18')]['id']);})[_0xb41f('0x19')](function(_0x123eef){logger['error'](_0xb41f('0xc'),_0x4fe848,JSON[_0xb41f('0x1a')](_0x123eef));logger[_0xb41f('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4fe848);})[_0xb41f('0x1b')](function(){_0x202ea4[_0xb41f('0x12')]();});}}}catch(_0x3ec825){logger[_0xb41f('0x1c')]('[%s][TAG]\x20%s',_0x4fe848,_['isObject'](_0x3ec825)?JSON[_0xb41f('0x1a')](_0x3ec825):_0x3ec825);logger[_0xb41f('0x10')](_0xb41f('0x11'),_0x4fe848);_0x202ea4[_0xb41f('0x12')]();}};}; \ 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 f925566..2adbdf0 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 _0x0723=['../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','stringify','POST','application/json-rpc','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x115eb3,_0x507044){var _0x329f10=function(_0x1c2d8c){while(--_0x1c2d8c){_0x115eb3['push'](_0x115eb3['shift']());}};_0x329f10(++_0x507044);}(_0x0723,0x1dc));var _0x3072=function(_0x3668f8,_0x15ec30){_0x3668f8=_0x3668f8-0x0;var _0x3569e0=_0x0723[_0x3668f8];return _0x3569e0;};'use strict';var rp=require('request-promise');var logger=require(_0x3072('0x0'))(_0x3072('0x1'));var _=require(_0x3072('0x2'));var arr=[];exports[_0x3072('0x3')]=function(_0x5bb3ef,_0x5f359a){return function(_0x3c36bf){var _0x440754=_0x5f359a[0xa];var _0x488afb=_0x5f359a[0xb];var _0x27febb=_0x5f359a[0xc];var _0x109526=_0x5f359a[0xd];var _0x261ac0=_0x5f359a[0xe];var _0x31d3cf=_0x5f359a[0xf]['replace'](/\n/g,_0x3072('0x4'));var _0x205b77=_0x5f359a[0x10][_0x3072('0x5')](/\n/g,'\x20');if(!arr[_0x3072('0x6')](_0x488afb)){arr[_0x3072('0x7')](_0x488afb);var _0x25e85b=_0x5f359a[0x3];var _0xa51f6f=_0x5f359a[0x4];var _0x47703b=_0x5f359a[0x1];var _0x3bc9dc=_0x5f359a[0x0];var _0x5d2bb8={};_0x5d2bb8[_0x3072('0x8')]=_0x5f359a[0x8]+_0x3072('0x9')+_0x27febb+'|'+_0x440754+'|'+_0x109526+'|'+_0x488afb+'|'+_0x261ac0;_0x5d2bb8[_0x3072('0xa')]=_0x5f359a[0x7]+'?params='+_0x27febb+'|'+_0x440754+'|'+_0x109526+'|'+_0x488afb+'|'+_0x261ac0+'|'+_0x31d3cf+'|'+_0x205b77;_0x5d2bb8[_0x3072('0xb')]=_0x5f359a[0x9];var _0x30834c={};_0x30834c[_0x3072('0xc')]=_0x3072('0xd');_0x30834c[_0x3072('0xe')]=_0x3072('0xf');var _0xe2f5fd=[];_0xe2f5fd[_0x3072('0x7')](_0x5f359a[0x2]);_0xe2f5fd[_0x3072('0x7')](_0x5f359a[0x5]);_0xe2f5fd[_0x3072('0x7')](_0x5f359a[0x6]);_0x30834c['params']=_0xe2f5fd;_0x30834c['id']=0x1;var _0x1f8972=JSON[_0x3072('0x10')](_0x30834c);var _0x1e9346={'encoding':'utf8','method':_0x3072('0x11'),'timeout':0x2710,'url':_0x25e85b,'headers':{'Content-Type':_0x3072('0x12')},'body':_0x1f8972};return rp(_0x1e9346)['then'](function(_0xad74f9){const _0x3a8f43=JSON[_0x3072('0x13')](_0xad74f9);if(!_0x3a8f43[_0x3072('0x14')]['logged']){throw new Error(_0x3072('0x15'));}var _0xeaab4f=_0x488afb;var _0x33e5cb=_0x3072('0x16')+_0x47703b+_0x3072('0x17')+_0x3bc9dc+_0x3072('0x18')+_0xeaab4f+_0x3072('0x19')+JSON[_0x3072('0x10')](_0x5d2bb8);var _0x28f394=_0xa51f6f+'?'+_0x33e5cb;return rp(_0x28f394);})['then'](function(_0x233fbe){logger[_0x3072('0x1a')](_0x3072('0x1b'),_0x5bb3ef,_0x233fbe);_0x3c36bf['stop']();})['catch'](function(_0x35e958){logger[_0x3072('0x1c')](_0x3072('0x1d'),_0x5bb3ef,_[_0x3072('0x1e')](_0x35e958)?JSON['stringify'](_0x35e958):_0x35e958);_0x3c36bf[_0x3072('0x1f')]();});}else{logger['info'](_0x3072('0x20'),_0x5bb3ef);_0x3c36bf[_0x3072('0x21')]();}};}; \ No newline at end of file +var _0x79e3=['stringify','utf8','POST','then','parse','result','logged','&serviceId=','info','stop','catch','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','push','params'];(function(_0xdfcfd1,_0x1ec03b){var _0x4e8035=function(_0x18d1c9){while(--_0x18d1c9){_0xdfcfd1['push'](_0xdfcfd1['shift']());}};_0x4e8035(++_0x1ec03b);}(_0x79e3,0xb6));var _0x379e=function(_0xed166d,_0x293da6){_0xed166d=_0xed166d-0x0;var _0x1dac5f=_0x79e3[_0xed166d];return _0x1dac5f;};'use strict';var rp=require(_0x379e('0x0'));var logger=require(_0x379e('0x1'))('routing');var _=require(_0x379e('0x2'));var arr=[];exports['consequence']=function(_0x56cb22,_0x148da8){return function(_0x513ba3){var _0x777754=_0x148da8[0xa];var _0x137b7a=_0x148da8[0xb];var _0x4705c0=_0x148da8[0xc];var _0x5caa66=_0x148da8[0xd];var _0x1430bc=_0x148da8[0xe];var _0x4ea8d9=_0x148da8[0xf][_0x379e('0x3')](/\n/g,_0x379e('0x4'));var _0x12b5a1=_0x148da8[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x379e('0x5')](_0x137b7a)){arr['push'](_0x137b7a);var _0x22f703=_0x148da8[0x3];var _0x58af78=_0x148da8[0x4];var _0x2c6dc6=_0x148da8[0x1];var _0x8d72a2=_0x148da8[0x0];var _0x9f2f58={};_0x9f2f58[_0x379e('0x6')]=_0x148da8[0x8]+_0x379e('0x7')+_0x4705c0+'|'+_0x777754+'|'+_0x5caa66+'|'+_0x137b7a+'|'+_0x1430bc;_0x9f2f58[_0x379e('0x8')]=_0x148da8[0x7]+_0x379e('0x7')+_0x4705c0+'|'+_0x777754+'|'+_0x5caa66+'|'+_0x137b7a+'|'+_0x1430bc+'|'+_0x4ea8d9+'|'+_0x12b5a1;_0x9f2f58['title']=_0x148da8[0x9];var _0x3d43b3={};_0x3d43b3[_0x379e('0x9')]=_0x379e('0xa');_0x3d43b3[_0x379e('0xb')]='login';var _0x1718c5=[];_0x1718c5[_0x379e('0xc')](_0x148da8[0x2]);_0x1718c5[_0x379e('0xc')](_0x148da8[0x5]);_0x1718c5[_0x379e('0xc')](_0x148da8[0x6]);_0x3d43b3[_0x379e('0xd')]=_0x1718c5;_0x3d43b3['id']=0x1;var _0x1fbc82=JSON[_0x379e('0xe')](_0x3d43b3);var _0x20165a={'encoding':_0x379e('0xf'),'method':_0x379e('0x10'),'timeout':0x2710,'url':_0x22f703,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1fbc82};return rp(_0x20165a)[_0x379e('0x11')](function(_0x3baa86){const _0x4f36b3=JSON[_0x379e('0x12')](_0x3baa86);if(!_0x4f36b3[_0x379e('0x13')][_0x379e('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x291db2=_0x137b7a;var _0x55340d='channelId='+_0x2c6dc6+_0x379e('0x15')+_0x8d72a2+'&sessionId='+_0x291db2+'&data='+JSON[_0x379e('0xe')](_0x9f2f58);var _0xe500fa=_0x58af78+'?'+_0x55340d;return rp(_0xe500fa);})[_0x379e('0x11')](function(_0x33756b){logger[_0x379e('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x56cb22,_0x33756b);_0x513ba3[_0x379e('0x17')]();})[_0x379e('0x18')](function(_0x58c450){logger['error']('[%s][TVOX]\x20%s',_0x56cb22,_[_0x379e('0x19')](_0x58c450)?JSON[_0x379e('0xe')](_0x58c450):_0x58c450);_0x513ba3[_0x379e('0x17')]();});}else{logger['info'](_0x379e('0x1a'),_0x56cb22);_0x513ba3[_0x379e('0x1b')]();}};}; \ 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 c4a2639..263c051 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x641af0,_0x11b2be){var _0x319d81=function(_0x1306a2){while(--_0x1306a2){_0x641af0['push'](_0x641af0['shift']());}};_0x319d81(++_0x11b2be);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x5a064a,_0x29c990){var _0x33b4a5=function(_0x2565d4){while(--_0x2565d4){_0x5a064a['push'](_0x5a064a['shift']());}};_0x33b4a5(++_0x29c990);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index d3a3dd5..e5b7274 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 _0x090a=['openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','condition','intervals','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','catch','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions'];(function(_0xfd0d70,_0x4e32d3){var _0x3304eb=function(_0x30c3d4){while(--_0x30c3d4){_0xfd0d70['push'](_0xfd0d70['shift']());}};_0x3304eb(++_0x4e32d3);}(_0x090a,0x133));var _0xa090=function(_0xf1f874,_0x303911){_0xf1f874=_0xf1f874-0x0;var _0x208fc2=_0x090a[_0xf1f874];return _0x208fc2;};'use strict';var _=require(_0xa090('0x0'));var util=require(_0xa090('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xa090('0x2'));var BPromise=require(_0xa090('0x3'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0xa090('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0xa090('0x5')),'mailQueueReport':require(_0xa090('0x6')),'chatQueueReport':require(_0xa090('0x7')),'smsQueueReport':require(_0xa090('0x8')),'faxQueueReport':require(_0xa090('0x9')),'whatsappQueueReport':require(_0xa090('0xa'))};var RuleEngine=require(_0xa090('0xb'));function getId(_0x1bc038,_0x39f0db,_0x9566e1){return util[_0xa090('0xc')](_0xa090('0xd'),_0x1bc038,_0x39f0db||0x0,_0x9566e1||0x0);}function getIntervals(_0x134f90,_0xf64ab9){var _0x4359a9=[];if(!_[_0xa090('0xe')](_0xf64ab9['IntervalId'])&&!_[_0xa090('0xe')](_0x134f90[_0xf64ab9['IntervalId']])&&!_[_0xa090('0xe')](_0x134f90[_0xf64ab9[_0xa090('0xf')]]['Intervals'])){_0x4359a9=_[_0xa090('0x10')](_0x134f90[_0xf64ab9[_0xa090('0xf')]][_0xa090('0x11')],_0xa090('0x12'));}else if(!_[_0xa090('0xe')](_0xf64ab9[_0xa090('0x12')])){_0x4359a9=[_0xf64ab9['interval']];}return _0x4359a9;}exports[_0xa090('0x13')]=function(_0x26d9c7){_0x26d9c7[_0xa090('0x14')]={};return new BPromise(function(_0x25601e,_0x41f33e){var _0x373680={'Start':function(_0xe1f5c9){var _0x297e21=this;return new Promise(function(_0x1a7314,_0x48c5b2){if(_0xe1f5c9){try{var _0x4da1f3=[];var _0x40b53f=getId(_0xe1f5c9[_0xa090('0x15')],_0xe1f5c9[_0xa090('0x16')]?_0xe1f5c9[_0xa090('0x16')]['id']:0x0,_0xe1f5c9['interaction']?_0xe1f5c9[_0xa090('0x17')]['id']:0x0);var _0x133842=sUtils[_0xa090('0x18')](_0x26d9c7,_0xe1f5c9);if(_0xe1f5c9[_0xa090('0x19')]||!_0x133842&&_0xe1f5c9['applications']&&_['isArray'](_0xe1f5c9[_0xa090('0x1a')])&&_0xe1f5c9[_0xa090('0x1a')][_0xa090('0x1b')]){for(var _0xea9234=0x0;_0xea9234<_0xe1f5c9[_0xa090('0x1a')]['length'];_0xea9234+=0x1){var _0x479a66=_0xe1f5c9[_0xa090('0x1a')][_0xea9234];if(fs['existsSync'](path['join'](__dirname,_0xa090('0x1a'),_0x479a66[_0xa090('0x1c')]+_0xa090('0x1d')))){var _0x17693f=[];switch(_0x479a66[_0xa090('0x1c')][_0xa090('0x1e')]()){case _0xa090('0x1f'):var _0xc60bfd=_0x479a66[_0xa090('0x20')][_0xa090('0x21')](',');if(_0xe1f5c9[_0xa090('0x15')]===_0xa090('0x22')){_0x17693f[_0xa090('0x23')](_0xc60bfd[0x0]);_0x17693f['push'](_0xc60bfd[0x1]);_0x17693f['push'](_0xc60bfd[_0xa090('0x24')](0x2,_0xc60bfd[_0xa090('0x1b')])[_0xa090('0x25')](','));}else{_0x17693f[_0xa090('0x23')](_0xc60bfd[0x0]);_0x17693f[_0xa090('0x23')](_0xc60bfd[_0xa090('0x24')](0x1,_0xc60bfd[_0xa090('0x1b')])[_0xa090('0x25')](','));}break;case _0xa090('0x26'):var _0x91d866=_0x479a66[_0xa090('0x20')][_0xa090('0x21')](',');_0x17693f[_0xa090('0x23')](_0x91d866[0x0]);_0x17693f[_0xa090('0x23')](_0x91d866[0x1]);_0x17693f['push'](_0x91d866[_0xa090('0x24')](0x2,_0x91d866[_0xa090('0x1b')])[_0xa090('0x25')](','));break;case _0xa090('0x27'):var _0x39a0c0=_0x479a66[_0xa090('0x20')][_0xa090('0x21')](',');_0x17693f[_0xa090('0x23')](_0x39a0c0[0x0]);_0x17693f[_0xa090('0x23')](_0x39a0c0[0x1]);_0x17693f[_0xa090('0x23')](_0x39a0c0[0x2]);_0x17693f['push'](_0x39a0c0[0x3]);_0x17693f['push'](_0x39a0c0[_0xa090('0x24')](0x4,_0x39a0c0[_0xa090('0x1b')])[_0xa090('0x25')](','));break;case _0xa090('0x28'):var _0x32768=_0x479a66[_0xa090('0x20')][_0xa090('0x21')](',');_0x17693f[_0xa090('0x23')](_0x32768[0x0]);_0x17693f[_0xa090('0x23')](_0x32768[0x1]);_0x17693f[_0xa090('0x23')](_0x32768[0x2]);_0x17693f[_0xa090('0x23')](_0x32768[0x3]);_0x17693f[_0xa090('0x23')](_0x32768[_0xa090('0x24')](0x4,_0x32768['length'])[_0xa090('0x25')](','));break;case'message':_0x17693f[_0xa090('0x23')](_0x479a66[_0xa090('0x20')]);break;case _0xa090('0x29'):_0x17693f['push'](_0x479a66[_0xa090('0x2a')]);_0x17693f['push'](_0x479a66[_0xa090('0x20')]);break;case'tvox':var _0x50491f=utils[_0xa090('0x2b')](_0xe1f5c9[_0xa090('0x2c')][_0xa090('0x2d')],_0xe1f5c9);var _0x5ad490=_0x479a66[_0xa090('0x20')]['split'](',');_0x17693f[_0xa090('0x23')](_0x5ad490[0x0]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x1]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x2]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x3]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x4]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x5]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x6]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x7]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x8]);_0x17693f[_0xa090('0x23')](_0x5ad490[0x9]);_0x17693f[_0xa090('0x23')](_0x5ad490[0xa]);_0x17693f[_0xa090('0x23')](_0xe1f5c9[_0xa090('0x17')]['id']);_0x17693f['push'](_0xe1f5c9[_0xa090('0x16')]['id']);_0x17693f[_0xa090('0x23')](_0x479a66[_0xa090('0x2e')]);_0x17693f[_0xa090('0x23')](_0xe1f5c9['interaction']['ContactId']);_0x17693f[_0xa090('0x23')](_0xe1f5c9[_0xa090('0x2f')]['body']);_0x17693f[_0xa090('0x23')](_0x50491f);break;default:_0x17693f=_[_0xa090('0xe')](_0x479a66[_0xa090('0x20')])?[]:_0x479a66['appdata']['split'](',');}var _0x24ad93={'id':util[_0xa090('0xc')](_0xa090('0x30'),_0x40b53f,_0x479a66['id'],_0x479a66[_0xa090('0x1c')]),'condition':require('./interval')[_0xa090('0x31')](_0x40b53f,getIntervals(_0x26d9c7[_0xa090('0x32')],_0x479a66),_0x26d9c7),'consequence':require('./applications/'+_0x479a66[_0xa090('0x1c')])[_0xa090('0x33')](_0x40b53f,_0x17693f,_0x26d9c7,_0xe1f5c9),'p':_0x479a66[_0xa090('0x34')]||0x0};logger['info'](_0xa090('0x35'),_0x24ad93['id'],_0xa090('0x36'),getIntervals(_0x26d9c7['intervals'],_0x479a66)[_0xa090('0x25')](_0xa090('0x37')));_0x4da1f3[_0xa090('0x23')](_0x24ad93);}else{logger[_0xa090('0x38')](_0xa090('0x39'),path[_0xa090('0x25')](__dirname,_0xa090('0x1a'),_0x479a66['app']+'.js'));}}_0x26d9c7[_0xa090('0x14')][_0x40b53f]=new RuleEngine(_0x4da1f3);_0x26d9c7[_0xa090('0x14')][_0x40b53f][_0xa090('0x3a')](_0xe1f5c9,function(_0x6c7b84){logger[_0xa090('0x3b')]('Applications\x20executed',JSON[_0xa090('0x3c')](_0x6c7b84[_0xa090('0x3d')]));if(_0x26d9c7[_0xa090('0x14')][_0x40b53f]){_0x26d9c7['rules'][_0x40b53f][_0xa090('0x3e')](_0xa090('0x3f'));}});return _0x1a7314({'code':0xc8,'message':_0xe1f5c9});}else{if(_0x133842){logger[_0xa090('0x3b')](util[_0xa090('0xc')](_0xa090('0x40'),_0x40b53f));}else{logger['info'](_0xa090('0x41'));}return _0x1a7314({'code':0xc8,'message':_0xe1f5c9});}}catch(_0x18c0e1){logger[_0xa090('0x38')](_0x18c0e1[_0xa090('0x42')]);return _0x48c5b2(_0x297e21[_0xa090('0x38')](0x1f4,_0x18c0e1));}}return _0x48c5b2(_0xa090('0x43'));});},'AcceptMessage':function(_0x10059a){var _0xa2928e=this;return new Promise(function(_0x2bfcf1,_0x51a660){if(_0x10059a[_0xa090('0x44')]&&_0x10059a['agent']['id']){if(_0x26d9c7[_0xa090('0x45')][_0x10059a[_0xa090('0x44')]['id']]){_0x26d9c7[_0xa090('0x45')][_0x10059a['agent']['id']][_0xa090('0x46')]=![];_0x26d9c7[_0xa090('0x45')][_0x10059a[_0xa090('0x44')]['id']][_0xa090('0x47')]=undefined;}}if(_0x10059a['message']&&_0x10059a[_0xa090('0x16')]['id']){try{var _0x2377bc=getId(_0x10059a[_0xa090('0x15')],_0x10059a[_0xa090('0x16')]?_0x10059a['message']['id']:0x0,_0x10059a[_0xa090('0x17')]?_0x10059a[_0xa090('0x17')]['id']:0x0);if(_0x26d9c7[_0xa090('0x14')][_0x2377bc]){_0x26d9c7['rules'][_0x2377bc][_0xa090('0x3e')](_0xa090('0x48'));if(rpc[_0x10059a[_0xa090('0x15')]+_0xa090('0x49')]){rpc[_0x10059a[_0xa090('0x15')]+_0xa090('0x49')]['update'](_0x2377bc,{'UserId':_0x10059a[_0xa090('0x16')]['UserId']})[_0xa090('0x4a')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2bfcf1({'code':0xc8,'message':_0x10059a});}catch(_0x4625b3){logger[_0xa090('0x38')](_0x4625b3[_0xa090('0x42')]);return _0x51a660(_0xa2928e[_0xa090('0x38')](0x1f4,_0x4625b3));}}logger[_0xa090('0x38')](_0xa090('0x4b'));return _0x51a660(_0xa2928e[_0xa090('0x38')](0x1f4,_0xa090('0x4b')));});},'RejectMessage':function(_0x368deb){var _0x42dec5=this;return new Promise(function(_0x28b032,_0x458abd){if(_0x368deb[_0xa090('0x44')]&&_0x368deb[_0xa090('0x44')]['id']){try{if(_0x26d9c7[_0xa090('0x45')][_0x368deb[_0xa090('0x44')]['id']]){_0x26d9c7[_0xa090('0x45')][_0x368deb['agent']['id']]['busy']=![];_0x26d9c7[_0xa090('0x45')][_0x368deb[_0xa090('0x44')]['id']]['busyQueue']=undefined;}return _0x28b032({'code':0xc8,'message':_0x368deb});}catch(_0x10047e){logger['error'](_0x10047e[_0xa090('0x42')]);return _0x458abd(_0x42dec5[_0xa090('0x38')](0x1f4,_0x10047e));}}logger[_0xa090('0x38')](_0xa090('0x4b'));return _0x458abd(_0x42dec5['error'](0x1f4,_0xa090('0x4b')));});},'AbandonInteraction':function(_0x16e48b){var _0x8404d0=this;return new Promise(function(_0x50431e,_0x135614){if(_0x16e48b[_0xa090('0x15')]&&_0x16e48b['interaction']&&_0x16e48b[_0xa090('0x17')]['id']){try{var _0x3d6e54=getId(_0x16e48b[_0xa090('0x15')],_0x16e48b['message']?_0x16e48b[_0xa090('0x16')]['id']:0x0,_0x16e48b['interaction']?_0x16e48b[_0xa090('0x17')]['id']:0x0);if(_0x26d9c7[_0xa090('0x14')][_0x3d6e54]){_0x26d9c7[_0xa090('0x14')][_0x3d6e54][_0xa090('0x3e')]('end');}return _0x50431e({'code':0xc8,'message':_0x16e48b});}catch(_0x3a42e3){logger['error'](_0x3a42e3['stack']);return _0x135614(_0x8404d0[_0xa090('0x38')](0x1f4,_0x3a42e3));}}logger[_0xa090('0x38')](_0xa090('0x4b'));return _0x135614(_0x8404d0[_0xa090('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x467676){var _0x5e99b0=this;return new Promise(function(_0x4753bf,_0x33071e){if(_0x26d9c7[_0xa090('0x45')]['hasOwnProperty'](_0x467676['id'])){for(var _0x356d82 in _0x467676[_0xa090('0x4c')]){if(_0x467676[_0xa090('0x4c')]['hasOwnProperty'](_0x356d82)){if(_0x26d9c7[_0xa090('0x45')][_0x467676['id']][_0xa090('0x4d')](_0x356d82+'CurrentCapacity')){_0x26d9c7['agents'][_0x467676['id']][_0x356d82+_0xa090('0x4e')]=parseInt(_0x467676[_0xa090('0x4c')][_0x356d82],0xa);}}}_0x26d9c7['agents'][_0x467676['id']][_0xa090('0x4f')]();return _0x4753bf({'code':0xc8,'message':_0x26d9c7[_0xa090('0x45')][_0x467676['id']]});}else{return _0x33071e(_0x5e99b0['error'](0x1f4,_0xa090('0x50')));}});},'Agents':function(_0x5dbd37){return new Promise(function(_0x82e3be){var _0x84aeb9=_[_0xa090('0x51')](_0x26d9c7['agents']);if(_0x5dbd37&&_0x5dbd37['id']){var _0x120ea8=_['find'](_0x84aeb9,function(_0x330b42){return _0x330b42['id']===_0x5dbd37['id'];});_0x82e3be(_0x120ea8);}else{_0x82e3be({'count':_0x84aeb9[_0xa090('0x1b')],'rows':_0x84aeb9});}});},'ChatQueues':function(){return new Promise(function(_0x32c19f){var _0x445b49=[];for(var _0x9c462e in _0x26d9c7['chatQueues']){if(_0x26d9c7[_0xa090('0x52')][_0xa090('0x4d')](_0x9c462e)){var _0x348c8c=_0x26d9c7[_0xa090('0x52')][_0x9c462e];var _0x163576={'id':_0x348c8c['id'],'available':_0x348c8c[_0xa090('0x53')],'loggedIn':_0x348c8c[_0xa090('0x54')],'name':_0x348c8c[_0xa090('0x55')],'paused':_0x348c8c[_0xa090('0x56')],'waiting':_0x348c8c[_0xa090('0x57')]};_0x445b49[_0xa090('0x23')](_0x163576);}}_0x32c19f({'count':_0x445b49['length'],'rows':_0x445b49});});},'MailQueues':function(){return new Promise(function(_0x54a0cb){var _0x266d27=[];for(var _0x4b987f in _0x26d9c7[_0xa090('0x58')]){if(_0x26d9c7[_0xa090('0x58')][_0xa090('0x4d')](_0x4b987f)){var _0x30d3bd=_0x26d9c7[_0xa090('0x58')][_0x4b987f];var _0x283d00={'id':_0x30d3bd['id'],'available':_0x30d3bd[_0xa090('0x53')],'loggedIn':_0x30d3bd[_0xa090('0x54')],'name':_0x30d3bd[_0xa090('0x55')],'paused':_0x30d3bd['paused'],'waiting':_0x30d3bd[_0xa090('0x57')]};_0x266d27[_0xa090('0x23')](_0x283d00);}}_0x54a0cb({'count':_0x266d27['length'],'rows':_0x266d27});});},'OpenchannelQueues':function(){return new Promise(function(_0x2dd80e){var _0x48f35a=[];for(var _0xf33693 in _0x26d9c7[_0xa090('0x59')]){if(_0x26d9c7[_0xa090('0x59')][_0xa090('0x4d')](_0xf33693)){var _0x425cb8=_0x26d9c7['openchannelQueues'][_0xf33693];var _0x331e4e={'id':_0x425cb8['id'],'available':_0x425cb8[_0xa090('0x53')],'loggedIn':_0x425cb8[_0xa090('0x54')],'name':_0x425cb8[_0xa090('0x55')],'paused':_0x425cb8[_0xa090('0x56')],'waiting':_0x425cb8[_0xa090('0x57')]};_0x48f35a[_0xa090('0x23')](_0x331e4e);}}_0x2dd80e({'count':_0x48f35a['length'],'rows':_0x48f35a});});},'SmsQueues':function(){return new Promise(function(_0x9bd6a6){var _0x33114f=[];for(var _0x560eda in _0x26d9c7['smsQueues']){if(_0x26d9c7[_0xa090('0x5a')]['hasOwnProperty'](_0x560eda)){var _0x1442d1=_0x26d9c7[_0xa090('0x5a')][_0x560eda];var _0x4b846e={'id':_0x1442d1['id'],'available':_0x1442d1['available'],'loggedIn':_0x1442d1['loggedIn'],'name':_0x1442d1[_0xa090('0x55')],'paused':_0x1442d1[_0xa090('0x56')],'waiting':_0x1442d1[_0xa090('0x57')]};_0x33114f[_0xa090('0x23')](_0x4b846e);}}_0x9bd6a6({'count':_0x33114f[_0xa090('0x1b')],'rows':_0x33114f});});},'FaxQueues':function(){return new Promise(function(_0x4b4154){var _0x1f81fb=[];for(var _0x211c20 in _0x26d9c7[_0xa090('0x5b')]){if(_0x26d9c7['faxQueues']['hasOwnProperty'](_0x211c20)){var _0x16c56b=_0x26d9c7['faxQueues'][_0x211c20];var _0x1ab7af={'id':_0x16c56b['id'],'available':_0x16c56b[_0xa090('0x53')],'loggedIn':_0x16c56b['loggedIn'],'name':_0x16c56b['name'],'paused':_0x16c56b[_0xa090('0x56')],'waiting':_0x16c56b[_0xa090('0x57')]};_0x1f81fb['push'](_0x1ab7af);}}_0x4b4154({'count':_0x1f81fb[_0xa090('0x1b')],'rows':_0x1f81fb});});},'WhatsappQueues':function(){return new Promise(function(_0x48039c){var _0x542955=[];for(var _0x415023 in _0x26d9c7['whatsappQueues']){if(_0x26d9c7['whatsappQueues'][_0xa090('0x4d')](_0x415023)){var _0x26f5d1=_0x26d9c7['whatsappQueues'][_0x415023];var _0x504cb3={'id':_0x26f5d1['id'],'available':_0x26f5d1[_0xa090('0x53')],'loggedIn':_0x26f5d1[_0xa090('0x54')],'name':_0x26f5d1[_0xa090('0x55')],'paused':_0x26f5d1[_0xa090('0x56')],'waiting':_0x26f5d1[_0xa090('0x57')]};_0x542955[_0xa090('0x23')](_0x504cb3);}}_0x48039c({'count':_0x542955[_0xa090('0x1b')],'rows':_0x542955});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xbd5419){var _0x177075=_[_0xa090('0x51')](_0x26d9c7['chatQueuesWaitingInteractions']);_0xbd5419({'count':_0x177075[_0xa090('0x1b')],'rows':_0x177075});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1b9ef0){var _0x12a046=_[_0xa090('0x51')](_0x26d9c7[_0xa090('0x5c')]);_0x1b9ef0({'count':_0x12a046[_0xa090('0x1b')],'rows':_0x12a046});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x30ffec){var _0x23c801=_[_0xa090('0x51')](_0x26d9c7[_0xa090('0x5d')]);_0x30ffec({'count':_0x23c801['length'],'rows':_0x23c801});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xab440){var _0x51f912=_[_0xa090('0x51')](_0x26d9c7['smsQueuesWaitingInteractions']);_0xab440({'count':_0x51f912['length'],'rows':_0x51f912});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5c6c3d){var _0x274199=_[_0xa090('0x51')](_0x26d9c7[_0xa090('0x5e')]);_0x5c6c3d({'count':_0x274199[_0xa090('0x1b')],'rows':_0x274199});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x68f8e5){var _0x68d701=_[_0xa090('0x51')](_0x26d9c7['whatsappQueuesWaitingInteractions']);_0x68f8e5({'count':_0x68d701['length'],'rows':_0x68d701});});}};var _0x313106=jayson[_0xa090('0x5f')](_0x373680)[_0xa090('0x60')]();_0x313106['on'](_0xa090('0x38'),function(_0xac0904){logger[_0xa090('0x38')](JSON['stringify'](_0xac0904));return _0x41f33e(_0xac0904);});_0x313106[_0xa090('0x13')](0x232c,_0xa090('0x61'),function(){console['log'](_0xa090('0x62'),0x232c);return _0x25601e(_0xa090('0x63')+0x232c);});});}; \ No newline at end of file +var _0x52a1=['error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','join','.js','app','toLowerCase','split','channel','mail','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x52a1,0x1b7));var _0x152a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52a1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x152a('0x0'));var util=require(_0x152a('0x1'));var path=require(_0x152a('0x2'));var fs=require('fs');var jayson=require(_0x152a('0x3'));var BPromise=require(_0x152a('0x4'));var utils=require(_0x152a('0x5'));var sUtils=require(_0x152a('0x6'));var logger=require('../../../config/logger')(_0x152a('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x152a('0x8')),'chatQueueReport':require(_0x152a('0x9')),'smsQueueReport':require(_0x152a('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x520d61,_0x4221d3,_0x578506){return util['format'](_0x152a('0xb'),_0x520d61,_0x4221d3||0x0,_0x578506||0x0);}function getIntervals(_0x22bf70,_0x5ce978){var _0x5810e9=[];if(!_[_0x152a('0xc')](_0x5ce978[_0x152a('0xd')])&&!_['isNil'](_0x22bf70[_0x5ce978[_0x152a('0xd')]])&&!_[_0x152a('0xc')](_0x22bf70[_0x5ce978[_0x152a('0xd')]][_0x152a('0xe')])){_0x5810e9=_[_0x152a('0xf')](_0x22bf70[_0x5ce978[_0x152a('0xd')]]['Intervals'],_0x152a('0x10'));}else if(!_[_0x152a('0xc')](_0x5ce978[_0x152a('0x10')])){_0x5810e9=[_0x5ce978['interval']];}return _0x5810e9;}exports[_0x152a('0x11')]=function(_0x2f8817){_0x2f8817['rules']={};return new BPromise(function(_0x40a8d0,_0x5a76e4){var _0x6e4b4f={'Start':function(_0x404bb8){var _0x1c4b71=this;return new Promise(function(_0x40e403,_0x1e411c){if(_0x404bb8){try{var _0x1ec269=[];var _0xd1d182=getId(_0x404bb8['channel'],_0x404bb8[_0x152a('0x12')]?_0x404bb8[_0x152a('0x12')]['id']:0x0,_0x404bb8['interaction']?_0x404bb8[_0x152a('0x13')]['id']:0x0);var _0x3bc038=sUtils[_0x152a('0x14')](_0x2f8817,_0x404bb8);if(_0x404bb8[_0x152a('0x15')]||!_0x3bc038&&_0x404bb8[_0x152a('0x16')]&&_[_0x152a('0x17')](_0x404bb8[_0x152a('0x16')])&&_0x404bb8['applications']['length']){for(var _0xcc7805=0x0;_0xcc7805<_0x404bb8['applications'][_0x152a('0x18')];_0xcc7805+=0x1){var _0x2b94d4=_0x404bb8[_0x152a('0x16')][_0xcc7805];if(fs['existsSync'](path[_0x152a('0x19')](__dirname,_0x152a('0x16'),_0x2b94d4['app']+_0x152a('0x1a')))){var _0x53e96e=[];switch(_0x2b94d4[_0x152a('0x1b')][_0x152a('0x1c')]()){case'autoreply':var _0x2b99c2=_0x2b94d4['appdata'][_0x152a('0x1d')](',');if(_0x404bb8[_0x152a('0x1e')]===_0x152a('0x1f')){_0x53e96e[_0x152a('0x20')](_0x2b99c2[0x0]);_0x53e96e[_0x152a('0x20')](_0x2b99c2[0x1]);_0x53e96e[_0x152a('0x20')](_0x2b99c2[_0x152a('0x21')](0x2,_0x2b99c2[_0x152a('0x18')])[_0x152a('0x19')](','));}else{_0x53e96e[_0x152a('0x20')](_0x2b99c2[0x0]);_0x53e96e[_0x152a('0x20')](_0x2b99c2[_0x152a('0x21')](0x1,_0x2b99c2[_0x152a('0x18')])[_0x152a('0x19')](','));}break;case _0x152a('0x22'):var _0x21cc4e=_0x2b94d4[_0x152a('0x23')][_0x152a('0x1d')](',');_0x53e96e[_0x152a('0x20')](_0x21cc4e[0x0]);_0x53e96e[_0x152a('0x20')](_0x21cc4e[0x1]);_0x53e96e[_0x152a('0x20')](_0x21cc4e['slice'](0x2,_0x21cc4e['length'])[_0x152a('0x19')](','));break;case _0x152a('0x24'):var _0x20589b=_0x2b94d4[_0x152a('0x23')][_0x152a('0x1d')](',');_0x53e96e[_0x152a('0x20')](_0x20589b[0x0]);_0x53e96e[_0x152a('0x20')](_0x20589b[0x1]);_0x53e96e[_0x152a('0x20')](_0x20589b[0x2]);_0x53e96e['push'](_0x20589b[0x3]);_0x53e96e[_0x152a('0x20')](_0x20589b[_0x152a('0x21')](0x4,_0x20589b[_0x152a('0x18')])['join'](','));break;case'amazonlex':var _0x20fed9=_0x2b94d4[_0x152a('0x23')][_0x152a('0x1d')](',');_0x53e96e[_0x152a('0x20')](_0x20fed9[0x0]);_0x53e96e['push'](_0x20fed9[0x1]);_0x53e96e[_0x152a('0x20')](_0x20fed9[0x2]);_0x53e96e[_0x152a('0x20')](_0x20fed9[0x3]);_0x53e96e[_0x152a('0x20')](_0x20fed9[_0x152a('0x21')](0x4,_0x20fed9[_0x152a('0x18')])[_0x152a('0x19')](','));break;case'message':_0x53e96e[_0x152a('0x20')](_0x2b94d4[_0x152a('0x23')]);break;case _0x152a('0x25'):_0x53e96e['push'](_0x2b94d4[_0x152a('0x26')]);_0x53e96e[_0x152a('0x20')](_0x2b94d4[_0x152a('0x23')]);break;case _0x152a('0x27'):var _0x4ce720=utils['getMustacheRender'](_0x404bb8[_0x152a('0x28')][_0x152a('0x29')],_0x404bb8);var _0x1be122=_0x2b94d4[_0x152a('0x23')]['split'](',');_0x53e96e['push'](_0x1be122[0x0]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x1]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x2]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x3]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x4]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x5]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x6]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x7]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x8]);_0x53e96e[_0x152a('0x20')](_0x1be122[0x9]);_0x53e96e[_0x152a('0x20')](_0x1be122[0xa]);_0x53e96e[_0x152a('0x20')](_0x404bb8['interaction']['id']);_0x53e96e[_0x152a('0x20')](_0x404bb8[_0x152a('0x12')]['id']);_0x53e96e[_0x152a('0x20')](_0x2b94d4[_0x152a('0x2a')]);_0x53e96e[_0x152a('0x20')](_0x404bb8[_0x152a('0x13')][_0x152a('0x2b')]);_0x53e96e['push'](_0x404bb8[_0x152a('0x2c')][_0x152a('0x2c')]);_0x53e96e[_0x152a('0x20')](_0x4ce720);break;default:_0x53e96e=_['isNil'](_0x2b94d4[_0x152a('0x23')])?[]:_0x2b94d4[_0x152a('0x23')]['split'](',');}var _0x5e69ae={'id':util[_0x152a('0x2d')](_0x152a('0x2e'),_0xd1d182,_0x2b94d4['id'],_0x2b94d4[_0x152a('0x1b')]),'condition':require(_0x152a('0x2f'))['condition'](_0xd1d182,getIntervals(_0x2f8817[_0x152a('0x30')],_0x2b94d4),_0x2f8817),'consequence':require(_0x152a('0x31')+_0x2b94d4['app'])[_0x152a('0x32')](_0xd1d182,_0x53e96e,_0x2f8817,_0x404bb8),'p':_0x2b94d4[_0x152a('0x33')]||0x0};logger['info'](_0x152a('0x34'),_0x5e69ae['id'],'on\x20interval',getIntervals(_0x2f8817['intervals'],_0x2b94d4)[_0x152a('0x19')](_0x152a('0x35')));_0x1ec269[_0x152a('0x20')](_0x5e69ae);}else{logger[_0x152a('0x36')](_0x152a('0x37'),path['join'](__dirname,_0x152a('0x16'),_0x2b94d4[_0x152a('0x1b')]+_0x152a('0x1a')));}}_0x2f8817[_0x152a('0x38')][_0xd1d182]=new RuleEngine(_0x1ec269);_0x2f8817[_0x152a('0x38')][_0xd1d182][_0x152a('0x39')](_0x404bb8,function(_0xc2473b){logger['info'](_0x152a('0x3a'),JSON[_0x152a('0x3b')](_0xc2473b[_0x152a('0x3c')]));if(_0x2f8817[_0x152a('0x38')][_0xd1d182]){_0x2f8817[_0x152a('0x38')][_0xd1d182][_0x152a('0x3d')](_0x152a('0x3e'));}});return _0x40e403({'code':0xc8,'message':_0x404bb8});}else{if(_0x3bc038){logger['info'](util[_0x152a('0x2d')](_0x152a('0x3f'),_0xd1d182));}else{logger[_0x152a('0x40')](_0x152a('0x41'));}return _0x40e403({'code':0xc8,'message':_0x404bb8});}}catch(_0xdee60e){logger[_0x152a('0x36')](_0xdee60e[_0x152a('0x42')]);return _0x1e411c(_0x1c4b71[_0x152a('0x36')](0x1f4,_0xdee60e));}}return _0x1e411c(_0x152a('0x43'));});},'AcceptMessage':function(_0x4e346f){var _0x415a58=this;return new Promise(function(_0x26ce9c,_0x3e9583){if(_0x4e346f['agent']&&_0x4e346f[_0x152a('0x44')]['id']){if(_0x2f8817[_0x152a('0x45')][_0x4e346f[_0x152a('0x44')]['id']]){_0x2f8817['agents'][_0x4e346f[_0x152a('0x44')]['id']][_0x152a('0x46')]=![];_0x2f8817[_0x152a('0x45')][_0x4e346f['agent']['id']][_0x152a('0x47')]=undefined;}}if(_0x4e346f[_0x152a('0x12')]&&_0x4e346f['message']['id']){try{var _0x504d18=getId(_0x4e346f[_0x152a('0x1e')],_0x4e346f[_0x152a('0x12')]?_0x4e346f[_0x152a('0x12')]['id']:0x0,_0x4e346f[_0x152a('0x13')]?_0x4e346f[_0x152a('0x13')]['id']:0x0);if(_0x2f8817[_0x152a('0x38')][_0x504d18]){_0x2f8817[_0x152a('0x38')][_0x504d18][_0x152a('0x3d')]('end');if(rpc[_0x4e346f[_0x152a('0x1e')]+_0x152a('0x48')]){rpc[_0x4e346f[_0x152a('0x1e')]+_0x152a('0x48')][_0x152a('0x49')](_0x504d18,{'UserId':_0x4e346f['message'][_0x152a('0x4a')]})[_0x152a('0x4b')](function(){logger[_0x152a('0x36')](_0x152a('0x4c'));});}}return _0x26ce9c({'code':0xc8,'message':_0x4e346f});}catch(_0x12fee5){logger[_0x152a('0x36')](_0x12fee5[_0x152a('0x42')]);return _0x3e9583(_0x415a58['error'](0x1f4,_0x12fee5));}}logger[_0x152a('0x36')](_0x152a('0x4d'));return _0x3e9583(_0x415a58[_0x152a('0x36')](0x1f4,_0x152a('0x4d')));});},'RejectMessage':function(_0x5599ed){var _0x34fe06=this;return new Promise(function(_0x3f1938,_0x349426){if(_0x5599ed[_0x152a('0x44')]&&_0x5599ed[_0x152a('0x44')]['id']){try{if(_0x2f8817[_0x152a('0x45')][_0x5599ed[_0x152a('0x44')]['id']]){_0x2f8817['agents'][_0x5599ed[_0x152a('0x44')]['id']][_0x152a('0x46')]=![];_0x2f8817[_0x152a('0x45')][_0x5599ed[_0x152a('0x44')]['id']][_0x152a('0x47')]=undefined;}return _0x3f1938({'code':0xc8,'message':_0x5599ed});}catch(_0x4cd9fa){logger[_0x152a('0x36')](_0x4cd9fa[_0x152a('0x42')]);return _0x349426(_0x34fe06[_0x152a('0x36')](0x1f4,_0x4cd9fa));}}logger[_0x152a('0x36')](_0x152a('0x4d'));return _0x349426(_0x34fe06[_0x152a('0x36')](0x1f4,_0x152a('0x4d')));});},'AbandonInteraction':function(_0x32fb5c){var _0x17205e=this;return new Promise(function(_0x418a91,_0x483b80){if(_0x32fb5c[_0x152a('0x1e')]&&_0x32fb5c[_0x152a('0x13')]&&_0x32fb5c[_0x152a('0x13')]['id']){try{var _0x118fea=getId(_0x32fb5c[_0x152a('0x1e')],_0x32fb5c['message']?_0x32fb5c[_0x152a('0x12')]['id']:0x0,_0x32fb5c[_0x152a('0x13')]?_0x32fb5c[_0x152a('0x13')]['id']:0x0);if(_0x2f8817['rules'][_0x118fea]){_0x2f8817[_0x152a('0x38')][_0x118fea][_0x152a('0x3d')](_0x152a('0x4e'));}return _0x418a91({'code':0xc8,'message':_0x32fb5c});}catch(_0xc861f4){logger['error'](_0xc861f4[_0x152a('0x42')]);return _0x483b80(_0x17205e[_0x152a('0x36')](0x1f4,_0xc861f4));}}logger[_0x152a('0x36')](_0x152a('0x4d'));return _0x483b80(_0x17205e[_0x152a('0x36')](0x1f4,_0x152a('0x4d')));});},'AgentCapacity':function(_0x533110){var _0xe9fc75=this;return new Promise(function(_0x104803,_0x526f12){if(_0x2f8817[_0x152a('0x45')][_0x152a('0x4f')](_0x533110['id'])){for(var _0x3274d7 in _0x533110[_0x152a('0x50')]){if(_0x533110[_0x152a('0x50')][_0x152a('0x4f')](_0x3274d7)){if(_0x2f8817[_0x152a('0x45')][_0x533110['id']][_0x152a('0x4f')](_0x3274d7+_0x152a('0x51'))){_0x2f8817[_0x152a('0x45')][_0x533110['id']][_0x3274d7+_0x152a('0x51')]=parseInt(_0x533110['capacity'][_0x3274d7],0xa);}}}_0x2f8817[_0x152a('0x45')][_0x533110['id']][_0x152a('0x52')]();return _0x104803({'code':0xc8,'message':_0x2f8817[_0x152a('0x45')][_0x533110['id']]});}else{return _0x526f12(_0xe9fc75[_0x152a('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x571683){return new Promise(function(_0x1906e8){var _0x3d61c2=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x45')]);if(_0x571683&&_0x571683['id']){var _0x47551d=_['find'](_0x3d61c2,function(_0x265476){return _0x265476['id']===_0x571683['id'];});_0x1906e8(_0x47551d);}else{_0x1906e8({'count':_0x3d61c2[_0x152a('0x18')],'rows':_0x3d61c2});}});},'ChatQueues':function(){return new Promise(function(_0x4db35b){var _0x3e4c7c=[];for(var _0x447ba4 in _0x2f8817[_0x152a('0x54')]){if(_0x2f8817[_0x152a('0x54')]['hasOwnProperty'](_0x447ba4)){var _0x4410ac=_0x2f8817[_0x152a('0x54')][_0x447ba4];var _0x1b5784={'id':_0x4410ac['id'],'available':_0x4410ac[_0x152a('0x55')],'loggedIn':_0x4410ac[_0x152a('0x56')],'name':_0x4410ac[_0x152a('0x57')],'paused':_0x4410ac[_0x152a('0x58')],'waiting':_0x4410ac[_0x152a('0x59')]};_0x3e4c7c[_0x152a('0x20')](_0x1b5784);}}_0x4db35b({'count':_0x3e4c7c['length'],'rows':_0x3e4c7c});});},'MailQueues':function(){return new Promise(function(_0x12a033){var _0x5014c7=[];for(var _0xbe601b in _0x2f8817[_0x152a('0x5a')]){if(_0x2f8817[_0x152a('0x5a')][_0x152a('0x4f')](_0xbe601b)){var _0x553b0d=_0x2f8817['mailQueues'][_0xbe601b];var _0xebbfa1={'id':_0x553b0d['id'],'available':_0x553b0d[_0x152a('0x55')],'loggedIn':_0x553b0d['loggedIn'],'name':_0x553b0d[_0x152a('0x57')],'paused':_0x553b0d[_0x152a('0x58')],'waiting':_0x553b0d['waiting']};_0x5014c7[_0x152a('0x20')](_0xebbfa1);}}_0x12a033({'count':_0x5014c7[_0x152a('0x18')],'rows':_0x5014c7});});},'OpenchannelQueues':function(){return new Promise(function(_0x3d7848){var _0xd93b86=[];for(var _0xde7ed2 in _0x2f8817['openchannelQueues']){if(_0x2f8817[_0x152a('0x5b')][_0x152a('0x4f')](_0xde7ed2)){var _0x459760=_0x2f8817['openchannelQueues'][_0xde7ed2];var _0x486471={'id':_0x459760['id'],'available':_0x459760[_0x152a('0x55')],'loggedIn':_0x459760['loggedIn'],'name':_0x459760[_0x152a('0x57')],'paused':_0x459760[_0x152a('0x58')],'waiting':_0x459760['waiting']};_0xd93b86[_0x152a('0x20')](_0x486471);}}_0x3d7848({'count':_0xd93b86[_0x152a('0x18')],'rows':_0xd93b86});});},'SmsQueues':function(){return new Promise(function(_0x1610ad){var _0x41ac07=[];for(var _0x2071b1 in _0x2f8817['smsQueues']){if(_0x2f8817['smsQueues']['hasOwnProperty'](_0x2071b1)){var _0x472576=_0x2f8817['smsQueues'][_0x2071b1];var _0x33b52a={'id':_0x472576['id'],'available':_0x472576[_0x152a('0x55')],'loggedIn':_0x472576[_0x152a('0x56')],'name':_0x472576[_0x152a('0x57')],'paused':_0x472576[_0x152a('0x58')],'waiting':_0x472576['waiting']};_0x41ac07[_0x152a('0x20')](_0x33b52a);}}_0x1610ad({'count':_0x41ac07[_0x152a('0x18')],'rows':_0x41ac07});});},'FaxQueues':function(){return new Promise(function(_0x55941f){var _0x40b01f=[];for(var _0x140815 in _0x2f8817[_0x152a('0x5c')]){if(_0x2f8817[_0x152a('0x5c')]['hasOwnProperty'](_0x140815)){var _0x2e6c58=_0x2f8817[_0x152a('0x5c')][_0x140815];var _0x1a08d5={'id':_0x2e6c58['id'],'available':_0x2e6c58[_0x152a('0x55')],'loggedIn':_0x2e6c58['loggedIn'],'name':_0x2e6c58[_0x152a('0x57')],'paused':_0x2e6c58[_0x152a('0x58')],'waiting':_0x2e6c58['waiting']};_0x40b01f[_0x152a('0x20')](_0x1a08d5);}}_0x55941f({'count':_0x40b01f[_0x152a('0x18')],'rows':_0x40b01f});});},'WhatsappQueues':function(){return new Promise(function(_0x135f8e){var _0x317526=[];for(var _0x22be06 in _0x2f8817[_0x152a('0x5d')]){if(_0x2f8817[_0x152a('0x5d')][_0x152a('0x4f')](_0x22be06)){var _0x427996=_0x2f8817['whatsappQueues'][_0x22be06];var _0x43e738={'id':_0x427996['id'],'available':_0x427996[_0x152a('0x55')],'loggedIn':_0x427996[_0x152a('0x56')],'name':_0x427996['name'],'paused':_0x427996[_0x152a('0x58')],'waiting':_0x427996[_0x152a('0x59')]};_0x317526[_0x152a('0x20')](_0x43e738);}}_0x135f8e({'count':_0x317526[_0x152a('0x18')],'rows':_0x317526});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1fe51b){var _0x12c6fa=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x5e')]);_0x1fe51b({'count':_0x12c6fa[_0x152a('0x18')],'rows':_0x12c6fa});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x6532b3){var _0x2cef87=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x5f')]);_0x6532b3({'count':_0x2cef87[_0x152a('0x18')],'rows':_0x2cef87});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xea03e1){var _0x1c272b=_['values'](_0x2f8817['openchannelQueuesWaitingInteractions']);_0xea03e1({'count':_0x1c272b[_0x152a('0x18')],'rows':_0x1c272b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x214551){var _0x29bbba=_[_0x152a('0x53')](_0x2f8817['smsQueuesWaitingInteractions']);_0x214551({'count':_0x29bbba[_0x152a('0x18')],'rows':_0x29bbba});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1c5739){var _0x4af1ec=_[_0x152a('0x53')](_0x2f8817[_0x152a('0x60')]);_0x1c5739({'count':_0x4af1ec[_0x152a('0x18')],'rows':_0x4af1ec});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xc4514d){var _0x2bbd7e=_['values'](_0x2f8817[_0x152a('0x61')]);_0xc4514d({'count':_0x2bbd7e[_0x152a('0x18')],'rows':_0x2bbd7e});});}};var _0x29eeaa=jayson[_0x152a('0x62')](_0x6e4b4f)[_0x152a('0x63')]();_0x29eeaa['on'](_0x152a('0x36'),function(_0x1f6d55){logger['error'](JSON[_0x152a('0x3b')](_0x1f6d55));return _0x5a76e4(_0x1f6d55);});_0x29eeaa['listen'](0x232c,_0x152a('0x64'),function(){console[_0x152a('0x65')](_0x152a('0x66'),0x232c);return _0x40a8d0('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 37f33a7..6a89e43 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 _0xa39a=['[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','jayson/promise','../../../config/logger','routing','client','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','format','iftime\x20%s','indexOf','true'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa39a,0x1c8));var _0xaa39=function(_0x51b77f,_0x4a28dd){_0x51b77f=_0x51b77f-0x0;var _0x1ee7b6=_0xa39a[_0x51b77f];return _0x1ee7b6;};'use strict';var util=require(_0xaa39('0x0'));var BPromise=require('bluebird');var jayson=require(_0xaa39('0x1'));var _=require('lodash');var logger=require(_0xaa39('0x2'))(_0xaa39('0x3'));var client=jayson[_0xaa39('0x4')]['http']({'port':0x232a});function request(_0x1ec976,_0x333822){return new BPromise(function(_0x3f8e76,_0x560560){return client[_0xaa39('0x5')](_0x1ec976,_0x333822)[_0xaa39('0x6')](function(_0x40ce06){if(_0x40ce06[_0xaa39('0x7')]){return _0x560560(_0x40ce06[_0xaa39('0x7')][_0xaa39('0x8')]);}else{return _0x3f8e76(_0x40ce06[_0xaa39('0x9')]);}})[_0xaa39('0xa')](function(_0xbfb616){return _0x560560(_0xbfb616);});});}exports[_0xaa39('0xb')]=function(_0x5685f6,_0x499f56,_0x1130f9){return function(_0x3ef505){if(_0x1130f9[_0xaa39('0xc')]&&!_0x1130f9[_0xaa39('0xc')][_0x5685f6]){logger['info'](_0xaa39('0xd'),_0x5685f6);return _0x3ef505[_0xaa39('0xe')]();}var _0x1748bf=[];for(var _0x25dc9e=0x0;_0x25dc9e<_0x499f56['length'];_0x25dc9e+=0x1){_0x1748bf['push'](request('Command',{'command':util[_0xaa39('0xf')](_0xaa39('0x10'),_0x499f56[_0x25dc9e])})[_0xaa39('0x6')](function(_0x5b3c6f){return _0x5b3c6f&&_0x5b3c6f[_0xaa39('0x8')]&&_0x5b3c6f[_0xaa39('0x8')][_0xaa39('0x11')](_0xaa39('0x12'))>=0x0?!![]:![];})[_0xaa39('0xa')](function(){logger[_0xaa39('0x7')](_0xaa39('0x13'),_0x5685f6,_0x499f56[_0x25dc9e]);}));}BPromise['all'](_0x1748bf)[_0xaa39('0x6')](function(_0x23daa0){var _0x11f56=_[_0xaa39('0x14')](_0x23daa0);logger['info'](_0xaa39('0x15'),_0x5685f6,_0x499f56[_0xaa39('0x16')]('\x20|\x20'),_0x11f56);_0x3ef505['when'](_0x11f56);})[_0xaa39('0xa')](function(_0x4b05c1){logger[_0xaa39('0x7')](_0xaa39('0x15'),_0x5685f6,_0x499f56['join'](_0xaa39('0x17')),_0x4b05c1[_0xaa39('0x18')]);_0x3ef505[_0xaa39('0xe')]();});};}; \ No newline at end of file +var _0x6b84=['routing','http','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','lodash'];(function(_0x2e5e02,_0x34b6d6){var _0x1670c1=function(_0x52031a){while(--_0x52031a){_0x2e5e02['push'](_0x2e5e02['shift']());}};_0x1670c1(++_0x34b6d6);}(_0x6b84,0x84));var _0x46b8=function(_0x50e71c,_0x4e4649){_0x50e71c=_0x50e71c-0x0;var _0x29c891=_0x6b84[_0x50e71c];return _0x29c891;};'use strict';var util=require(_0x46b8('0x0'));var BPromise=require(_0x46b8('0x1'));var jayson=require('jayson/promise');var _=require(_0x46b8('0x2'));var logger=require('../../../config/logger')(_0x46b8('0x3'));var client=jayson['client'][_0x46b8('0x4')]({'port':0x232a});function request(_0x15dcaf,_0x4c6385){return new BPromise(function(_0x37bd48,_0x32564b){return client['request'](_0x15dcaf,_0x4c6385)[_0x46b8('0x5')](function(_0x3f5f76){if(_0x3f5f76[_0x46b8('0x6')]){return _0x32564b(_0x3f5f76[_0x46b8('0x6')][_0x46b8('0x7')]);}else{return _0x37bd48(_0x3f5f76['result']);}})[_0x46b8('0x8')](function(_0x2754d5){return _0x32564b(_0x2754d5);});});}exports[_0x46b8('0x9')]=function(_0x5c7c34,_0x3622fc,_0x338c81){return function(_0x3c79d0){if(_0x338c81[_0x46b8('0xa')]&&!_0x338c81[_0x46b8('0xa')][_0x5c7c34]){logger[_0x46b8('0xb')](_0x46b8('0xc'),_0x5c7c34);return _0x3c79d0[_0x46b8('0xd')]();}var _0x29739c=[];for(var _0x2a5116=0x0;_0x2a5116<_0x3622fc[_0x46b8('0xe')];_0x2a5116+=0x1){_0x29739c[_0x46b8('0xf')](request(_0x46b8('0x10'),{'command':util[_0x46b8('0x11')](_0x46b8('0x12'),_0x3622fc[_0x2a5116])})[_0x46b8('0x5')](function(_0x379bbf){return _0x379bbf&&_0x379bbf[_0x46b8('0x7')]&&_0x379bbf['message']['indexOf'](_0x46b8('0x13'))>=0x0?!![]:![];})['catch'](function(){logger[_0x46b8('0x6')](_0x46b8('0x14'),_0x5c7c34,_0x3622fc[_0x2a5116]);}));}BPromise[_0x46b8('0x15')](_0x29739c)[_0x46b8('0x5')](function(_0xd3ecb2){var _0x2d47d1=_['some'](_0xd3ecb2);logger['info'](_0x46b8('0x16'),_0x5c7c34,_0x3622fc[_0x46b8('0x17')](_0x46b8('0x18')),_0x2d47d1);_0x3c79d0[_0x46b8('0x19')](_0x2d47d1);})['catch'](function(_0x402ee3){logger[_0x46b8('0x6')](_0x46b8('0x16'),_0x5c7c34,_0x3622fc[_0x46b8('0x17')]('\x20|\x20'),_0x402ee3[_0x46b8('0x1a')]);_0x3c79d0['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4d604b1..bbe7a73 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 _0x1be1=['destuniqueid','agentcalled','debug','called','error','[%s][agents][agentcalled]','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','lastevent','timeout','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','reason','holdtime','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request'];(function(_0x407071,_0x491886){var _0x53fcd7=function(_0x146279){while(--_0x146279){_0x407071['push'](_0x407071['shift']());}};_0x53fcd7(++_0x491886);}(_0x1be1,0x192));var _0x11be=function(_0x3e0353,_0x3219ff){_0x3e0353=_0x3e0353-0x0;var _0x3f989a=_0x1be1[_0x3e0353];return _0x3f989a;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x11be('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33a55d,_0x5527b3){utils[_0x11be('0x1')](util[_0x11be('0x2')](_0x11be('0x3'),_0x33a55d[_0x11be('0x4')],_0x33a55d['channel'],_0x33a55d[_0x11be('0x5')],_0x33a55d[_0x11be('0x6')],_0x33a55d[_0x11be('0x7')],_0x33a55d['calleridnum'],_0x33a55d[_0x11be('0x8')],_0x33a55d['lastevent']));if(_0x33a55d[_0x11be('0x5')]){utils[_0x11be('0x9')](_0x33a55d[_0x11be('0x5')])[_0x11be('0xa')](function(_0x162eaa){if(_0x162eaa){_0x33a55d['type']=_0x162eaa[_0x11be('0xb')];_0x33a55d[_0x11be('0xc')]=_0x33a55d['agentcomplete']?_0x162eaa[_0x11be('0xd')]:![];_0x33a55d[_0x11be('0xe')]=_0x33a55d[_0x11be('0xc')]?_0x162eaa[_0x11be('0xf')]:0x0;}utils['request'](_0x11be('0x10'),_0x33a55d);});}else{utils[_0x11be('0x11')](_0x11be('0x10'),_0x33a55d);}if(_0x5527b3){delete transfers[_0x33a55d['uniqueid']];}else{delete agents[_0x33a55d[_0x11be('0x12')]];}}exports[_0x11be('0x13')]=function(_0x4ce3ae){try{utils[_0x11be('0x14')](util['format']('[%s][agents][agentcalled]',_0x4ce3ae['uniqueid']),_0x4ce3ae);agents[_0x4ce3ae['destuniqueid']]=_0x4ce3ae;agents[_0x4ce3ae['destuniqueid']]['agentcalledAt']=utils['now']();agents[_0x4ce3ae[_0x11be('0x12')]]['lastevent']=_0x11be('0x15');agents[_0x4ce3ae[_0x11be('0x12')]][_0x11be('0x8')]=null;agents[_0x4ce3ae[_0x11be('0x12')]]['connectedlinename']=null;utils[_0x11be('0x1')](util[_0x11be('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4ce3ae[_0x11be('0x4')],agents[_0x4ce3ae[_0x11be('0x12')]][_0x11be('0x6')],_0x4ce3ae['destuniqueid']));}catch(_0x51ba82){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x17'),_0x4ce3ae[_0x11be('0x4')]),_0x51ba82);}};exports['agentringnoanswer']=function(_0x12a5bd){try{if(!_[_0x11be('0x18')](agents[_0x12a5bd[_0x11be('0x12')]])){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x19'),_0x12a5bd[_0x11be('0x4')]),_0x12a5bd);utils[_0x11be('0x1')](util[_0x11be('0x2')](_0x11be('0x1a'),_0x12a5bd['uniqueid'],agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x6')],_0x12a5bd[_0x11be('0x12')]));agents[_0x12a5bd['destuniqueid']]['agentringnoanswer']=!![];agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x1b')]=utils[_0x11be('0x1c')]();agents[_0x12a5bd['destuniqueid']][_0x11be('0x1d')]='timeout';agents[_0x12a5bd[_0x11be('0x12')]]['reason']=_0x11be('0x1e');agents[_0x12a5bd[_0x11be('0x12')]]['holdtime']=_0x12a5bd[_0x11be('0x1f')]?parseInt(_0x12a5bd[_0x11be('0x1f')])/0x3e8:0x0;agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x20')]=0x0;unanswered[_0x11be('0x21')](_0x12a5bd[_0x11be('0x12')]);}}catch(_0xf5a6ac){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][agentringnoanswer]',_0x12a5bd[_0x11be('0x4')]),_0xf5a6ac);}};exports['queuecallerabandon']=function(_0x182f6b){try{_[_0x11be('0x22')](agents,function(_0x510476,_0x584d4c){if(_0x510476[_0x11be('0x4')]==_0x182f6b[_0x11be('0x4')]&&!_[_0x11be('0x23')](unanswered,_0x510476[_0x11be('0x12')])){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x24'),_0x182f6b[_0x11be('0x4')]),_0x182f6b);utils[_0x11be('0x1')](util['format'](_0x11be('0x25'),_0x182f6b[_0x11be('0x4')],_0x510476[_0x11be('0x6')],_0x510476[_0x11be('0x12')]));_0x510476[_0x11be('0x26')]=!![];_0x510476[_0x11be('0x1b')]=utils['now']();_0x510476[_0x11be('0x1d')]=_0x11be('0x27');_0x510476[_0x11be('0x28')]=_0x11be('0x27');_0x510476[_0x11be('0x29')]=_0x182f6b['holdtime'];_0x510476[_0x11be('0x20')]=0x0;writeDB(_0x510476);}});}catch(_0x254be5){utils[_0x11be('0x16')](util['format'](_0x11be('0x24'),_0x182f6b['uniqueid']),_0x254be5);}};exports['agentconnect']=function(_0x4c1f4d){try{if(agents[_0x4c1f4d['destuniqueid']]){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x2a'),_0x4c1f4d['uniqueid']),_0x4c1f4d);utils[_0x11be('0x1')](util[_0x11be('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4c1f4d[_0x11be('0x4')],agents[_0x4c1f4d['destuniqueid']][_0x11be('0x6')],_0x4c1f4d['destuniqueid']));agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();agents[_0x4c1f4d[_0x11be('0x12')]]['connectedlinenum']=_0x4c1f4d[_0x11be('0x8')];agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x2c')]=_0x4c1f4d[_0x11be('0x2c')];agents[_0x4c1f4d['destuniqueid']][_0x11be('0x29')]=_0x4c1f4d[_0x11be('0x1f')];agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x1d')]=_0x11be('0x2d');_[_0x11be('0x22')](agents,function(_0x5742d1,_0x5ee47c){if(_0x5742d1[_0x11be('0x12')]!=_0x4c1f4d[_0x11be('0x12')]&&_0x5742d1['uniqueid']==_0x4c1f4d[_0x11be('0x4')]){_0x5742d1[_0x11be('0x20')]=0x0;_0x5742d1['holdtime']=_0x4c1f4d[_0x11be('0x1f')];_0x5742d1['agentringnoanswer']=!![];_0x5742d1[_0x11be('0x1b')]=utils['now']();_0x5742d1[_0x11be('0x1d')]=_0x11be('0x2e');_0x5742d1['reason']=_0x11be('0x2e');_0x5742d1['answeredelsewheredestinationuniqueid']=_0x4c1f4d[_0x11be('0x12')];_0x5742d1[_0x11be('0x2f')]=_0x4c1f4d[_0x11be('0x6')];writeDB(_0x5742d1);}});}}catch(_0x383604){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x2a'),_0x4c1f4d['uniqueid']),_0x383604);}};exports[_0x11be('0x30')]=function(_0x18cddf){try{if(!_[_0x11be('0x18')](agents[_0x18cddf[_0x11be('0x12')]])){utils['debug'](util['format']('[%s][agents][agentcomplete]',_0x18cddf[_0x11be('0x4')]),_0x18cddf);utils['info'](util[_0x11be('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x18cddf[_0x11be('0x4')],agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x6')],_0x18cddf[_0x11be('0x12')]));agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x30')]=!![];agents[_0x18cddf[_0x11be('0x12')]]['agentcompleteAt']=utils[_0x11be('0x1c')]();agents[_0x18cddf['destuniqueid']][_0x11be('0x20')]=utils[_0x11be('0x31')](agents[_0x18cddf[_0x11be('0x12')]]['agentcompleteAt'],agents[_0x18cddf['destuniqueid']]['agentconnectAt']);agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x28')]=_0x18cddf['reason'];agents[_0x18cddf['destuniqueid']]['lastevent']=_0x11be('0x32');writeDB(agents[_0x18cddf[_0x11be('0x12')]]);}}catch(_0x2cdf2a){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x33'),_0x18cddf[_0x11be('0x4')]),_0x2cdf2a);}};exports[_0x11be('0x34')]=function(_0x2ce110){try{if(!_[_0x11be('0x18')](agents[_0x2ce110[_0x11be('0x35')]])){utils['debug'](util[_0x11be('0x2')](_0x11be('0x36'),_0x2ce110['uniqueid']),_0x2ce110);utils['info'](util['format'](_0x11be('0x37'),_0x2ce110['uniqueid'],agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x6')],agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x4')]));agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x38')]=!![];agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x39')]=_0x11be('0x3a');agents[_0x2ce110['transfereruniqueid']][_0x11be('0x3b')]=_0x2ce110['extension'];agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x3c')]=agents[_0x2ce110['transfereruniqueid']][_0x11be('0x4')];}}catch(_0x1164a4){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x36'),_0x2ce110['uniqueid']),_0x1164a4);}};exports['attendedtransfer']=function(_0x46764d){try{utils[_0x11be('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x46764d[_0x11be('0x3d')]),_0x46764d);if(_0x46764d[_0x11be('0x3d')]==_0x46764d[_0x11be('0x3e')]){if(!_['isNil'](agents[_0x46764d['secondtransfereruniqueid']])){utils['info'](util[_0x11be('0x2')](_0x11be('0x3f'),_0x46764d[_0x11be('0x3d')],agents[_0x46764d['secondtransfereruniqueid']]['membername']));agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x38')]=!![];agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x39')]='ATTENDED';agents[_0x46764d[_0x11be('0x40')]]['transferexten']=_0x46764d['origtransfererexten'];agents[_0x46764d['secondtransfereruniqueid']]['transferuniqueid']=_0x46764d[_0x11be('0x3d')];}if(_0x46764d[_0x11be('0x41')]&&agents[_0x46764d[_0x11be('0x41')]]){agents[_0x46764d[_0x11be('0x41')]][_0x11be('0x42')]=0x1;transfers[_0x46764d[_0x11be('0x41')]]=_[_0x11be('0x43')](agents[_0x46764d['transfereeuniqueid']]);transfers[_0x46764d['transfereeuniqueid']][_0x11be('0x44')]=agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x44')];transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x45')]=agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x45')];transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x46')]=utils['now']();transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();transfers[_0x46764d['transfereeuniqueid']][_0x11be('0x29')]=0x0;transfers[_0x46764d[_0x11be('0x41')]]['agententerreason']=0x2;}}else if(_0x46764d['secondtransfereruniqueid']==_0x46764d[_0x11be('0x47')]){if(!_[_0x11be('0x18')](agents[_0x46764d[_0x11be('0x3d')]])){utils[_0x11be('0x1')](util['format'](_0x11be('0x3f'),_0x46764d[_0x11be('0x3d')],agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x6')]));agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x38')]=!![];agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x39')]=_0x11be('0x48');agents[_0x46764d['origtransfereruniqueid']]['transferexten']=_0x46764d[_0x11be('0x49')];agents[_0x46764d[_0x11be('0x3d')]]['transferuniqueid']=_0x46764d[_0x11be('0x40')];}if(_0x46764d[_0x11be('0x4a')]&&agents[_0x46764d[_0x11be('0x4a')]]){agents[_0x46764d[_0x11be('0x4a')]][_0x11be('0x42')]=0x1;transfers[_0x46764d[_0x11be('0x4a')]]=_[_0x11be('0x43')](agents[_0x46764d['transfertargetuniqueid']]);transfers[_0x46764d['transfertargetuniqueid']][_0x11be('0x44')]=agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x44')];transfers[_0x46764d['transfertargetuniqueid']][_0x11be('0x45')]=agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x45')];transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x46')]=utils[_0x11be('0x1c')]();transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x29')]=0x0;transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x42')]=0x2;}}}catch(_0x464459){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][attendedtransfer]',_0x46764d['origtransfereruniqueid']),_0x464459);}};exports[_0x11be('0x4b')]=function(_0x554aba){try{utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x4c'),_0x554aba[_0x11be('0x4')]),_0x554aba);if(agents[_0x554aba[_0x11be('0x4')]]&&agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')]===_0x11be('0x1e')){if(_0x554aba[_0x11be('0x4d')]==='21'){agents[_0x554aba['uniqueid']][_0x11be('0x28')]=_0x11be('0x4e');agents[_0x554aba[_0x11be('0x4')]]['lastevent']=_0x11be('0x4e');}utils[_0x11be('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x554aba['uniqueid'],agents[_0x554aba['uniqueid']][_0x11be('0x6')],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]));writeDB(agents[_0x554aba['uniqueid']]);var _0x2c80b7=unanswered[_0x11be('0x4f')](_0x554aba[_0x11be('0x4')]);if(_0x2c80b7>-0x1){unanswered[_0x11be('0x50')](_0x2c80b7,0x1);}}if(transfers[_0x554aba[_0x11be('0x4')]]){transfers[_0x554aba['uniqueid']][_0x11be('0x30')]=!![];transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')]=utils[_0x11be('0x1c')]();transfers[_0x554aba['uniqueid']][_0x11be('0x20')]=utils[_0x11be('0x31')](transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')],transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x2b')]);transfers[_0x554aba['uniqueid']][_0x11be('0x28')]=_0x11be('0x52');transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]='complete';utils[_0x11be('0x1')](util['format'](_0x11be('0x53'),_0x554aba[_0x11be('0x4')],transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x6')],transfers[_0x554aba['uniqueid']][_0x11be('0x28')],transfers[_0x554aba[_0x11be('0x4')]]['lastevent']));writeDB(transfers[_0x554aba[_0x11be('0x4')]],!![]);}if(agents[_0x554aba[_0x11be('0x4')]]&&agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x2b')]){agents[_0x554aba['uniqueid']][_0x11be('0x30')]=!![];agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')]=utils[_0x11be('0x1c')]();agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x20')]=utils[_0x11be('0x31')](agents[_0x554aba[_0x11be('0x4')]]['agentcompleteAt'],agents[_0x554aba[_0x11be('0x4')]]['agentconnectAt']);agents[_0x554aba['uniqueid']][_0x11be('0x28')]=agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x38')]?_0x11be('0x38'):_0x11be('0x52');agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]='complete';utils['info'](util[_0x11be('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x554aba['uniqueid'],agents[_0x554aba[_0x11be('0x4')]]['membername'],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')],agents[_0x554aba['uniqueid']][_0x11be('0x1d')]));writeDB(agents[_0x554aba[_0x11be('0x4')]]);}}catch(_0x56d8d7){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][hangup]',_0x554aba[_0x11be('0x4')]),_0x56d8d7);}}; \ No newline at end of file +var _0x5ec6=['connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agentcompleteAt','agent','lodash','util','./utils','format','uniqueid','queue','interface','calleridnum','lastevent','then','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]'];(function(_0x12c676,_0x4e075b){var _0x1d2c8d=function(_0x5e3a41){while(--_0x5e3a41){_0x12c676['push'](_0x12c676['shift']());}};_0x1d2c8d(++_0x4e075b);}(_0x5ec6,0x7f));var _0x65ec=function(_0xb1c7c3,_0x1a6502){_0xb1c7c3=_0xb1c7c3-0x0;var _0x40c15c=_0x5ec6[_0xb1c7c3];return _0x40c15c;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var utils=require(_0x65ec('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5c0775,_0x1b924d){utils['info'](util[_0x65ec('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5c0775[_0x65ec('0x4')],_0x5c0775['channel'],_0x5c0775[_0x65ec('0x5')],_0x5c0775['membername'],_0x5c0775[_0x65ec('0x6')],_0x5c0775[_0x65ec('0x7')],_0x5c0775['connectedlinenum'],_0x5c0775[_0x65ec('0x8')]));if(_0x5c0775[_0x65ec('0x5')]){utils['getVoiceQueueByName'](_0x5c0775[_0x65ec('0x5')])[_0x65ec('0x9')](function(_0x300f83){if(_0x300f83){_0x5c0775['type']=_0x300f83['type'];_0x5c0775[_0x65ec('0xa')]=_0x5c0775['agentcomplete']?_0x300f83[_0x65ec('0xb')]:![];_0x5c0775[_0x65ec('0xc')]=_0x5c0775['agentacw']?_0x300f83[_0x65ec('0xd')]:0x0;}utils[_0x65ec('0xe')]('CreateVoiceAgentReport',_0x5c0775);});}else{utils[_0x65ec('0xe')](_0x65ec('0xf'),_0x5c0775);}if(_0x1b924d){delete transfers[_0x5c0775['uniqueid']];}else{delete agents[_0x5c0775[_0x65ec('0x10')]];}}exports[_0x65ec('0x11')]=function(_0x411a7b){try{utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x13'),_0x411a7b[_0x65ec('0x4')]),_0x411a7b);agents[_0x411a7b[_0x65ec('0x10')]]=_0x411a7b;agents[_0x411a7b['destuniqueid']][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();agents[_0x411a7b[_0x65ec('0x10')]]['lastevent']='called';agents[_0x411a7b[_0x65ec('0x10')]][_0x65ec('0x16')]=null;agents[_0x411a7b[_0x65ec('0x10')]]['connectedlinename']=null;utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x18'),_0x411a7b[_0x65ec('0x4')],agents[_0x411a7b[_0x65ec('0x10')]][_0x65ec('0x19')],_0x411a7b[_0x65ec('0x10')]));}catch(_0x3ef058){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x13'),_0x411a7b[_0x65ec('0x4')]),_0x3ef058);}};exports[_0x65ec('0x1b')]=function(_0x1467ac){try{if(!_[_0x65ec('0x1c')](agents[_0x1467ac[_0x65ec('0x10')]])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x1d'),_0x1467ac['uniqueid']),_0x1467ac);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x1e'),_0x1467ac[_0x65ec('0x4')],agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x19')],_0x1467ac[_0x65ec('0x10')]));agents[_0x1467ac['destuniqueid']][_0x65ec('0x1b')]=!![];agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x1f')]=utils[_0x65ec('0x15')]();agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x8')]=_0x65ec('0x20');agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x21')]='timeout';agents[_0x1467ac[_0x65ec('0x10')]][_0x65ec('0x22')]=_0x1467ac[_0x65ec('0x23')]?parseInt(_0x1467ac[_0x65ec('0x23')])/0x3e8:0x0;agents[_0x1467ac['destuniqueid']][_0x65ec('0x24')]=0x0;unanswered['push'](_0x1467ac[_0x65ec('0x10')]);}}catch(_0x1ada47){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x1d'),_0x1467ac[_0x65ec('0x4')]),_0x1ada47);}};exports[_0x65ec('0x25')]=function(_0x39410f){try{_[_0x65ec('0x26')](agents,function(_0xeec5d4,_0x3c97e2){if(_0xeec5d4['uniqueid']==_0x39410f['uniqueid']&&!_[_0x65ec('0x27')](unanswered,_0xeec5d4['destuniqueid'])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')]('[%s][agents][queuecallerabandon]',_0x39410f[_0x65ec('0x4')]),_0x39410f);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x28'),_0x39410f['uniqueid'],_0xeec5d4[_0x65ec('0x19')],_0xeec5d4[_0x65ec('0x10')]));_0xeec5d4[_0x65ec('0x1b')]=!![];_0xeec5d4[_0x65ec('0x1f')]=utils[_0x65ec('0x15')]();_0xeec5d4[_0x65ec('0x8')]=_0x65ec('0x29');_0xeec5d4[_0x65ec('0x21')]=_0x65ec('0x29');_0xeec5d4[_0x65ec('0x22')]=_0x39410f['holdtime'];_0xeec5d4[_0x65ec('0x24')]=0x0;writeDB(_0xeec5d4);}});}catch(_0x1e20c4){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x2a'),_0x39410f[_0x65ec('0x4')]),_0x1e20c4);}};exports[_0x65ec('0x2b')]=function(_0x134cce){try{if(agents[_0x134cce[_0x65ec('0x10')]]){utils[_0x65ec('0x12')](util['format'](_0x65ec('0x2c'),_0x134cce[_0x65ec('0x4')]),_0x134cce);utils[_0x65ec('0x17')](util[_0x65ec('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x134cce[_0x65ec('0x4')],agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x19')],_0x134cce[_0x65ec('0x10')]));agents[_0x134cce['destuniqueid']]['agentconnectAt']=utils[_0x65ec('0x15')]();agents[_0x134cce['destuniqueid']][_0x65ec('0x16')]=_0x134cce[_0x65ec('0x16')];agents[_0x134cce['destuniqueid']][_0x65ec('0x2d')]=_0x134cce[_0x65ec('0x2d')];agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x22')]=_0x134cce[_0x65ec('0x23')];agents[_0x134cce[_0x65ec('0x10')]][_0x65ec('0x8')]=_0x65ec('0x2e');_[_0x65ec('0x26')](agents,function(_0x2ce56f,_0x3561ef){if(_0x2ce56f['destuniqueid']!=_0x134cce[_0x65ec('0x10')]&&_0x2ce56f['uniqueid']==_0x134cce[_0x65ec('0x4')]){_0x2ce56f[_0x65ec('0x24')]=0x0;_0x2ce56f[_0x65ec('0x22')]=_0x134cce[_0x65ec('0x23')];_0x2ce56f[_0x65ec('0x1b')]=!![];_0x2ce56f[_0x65ec('0x1f')]=utils['now']();_0x2ce56f[_0x65ec('0x8')]='answered_elsewhere';_0x2ce56f['reason']=_0x65ec('0x2f');_0x2ce56f[_0x65ec('0x30')]=_0x134cce[_0x65ec('0x10')];_0x2ce56f[_0x65ec('0x31')]=_0x134cce[_0x65ec('0x19')];writeDB(_0x2ce56f);}});}}catch(_0x524235){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x2c'),_0x134cce[_0x65ec('0x4')]),_0x524235);}};exports[_0x65ec('0x32')]=function(_0x11edd1){try{if(!_['isNil'](agents[_0x11edd1['destuniqueid']])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x33'),_0x11edd1[_0x65ec('0x4')]),_0x11edd1);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x34'),_0x11edd1['uniqueid'],agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x19')],_0x11edd1[_0x65ec('0x10')]));agents[_0x11edd1['destuniqueid']][_0x65ec('0x32')]=!![];agents[_0x11edd1[_0x65ec('0x10')]]['agentcompleteAt']=utils[_0x65ec('0x15')]();agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x24')]=utils[_0x65ec('0x35')](agents[_0x11edd1[_0x65ec('0x10')]]['agentcompleteAt'],agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x36')]);agents[_0x11edd1[_0x65ec('0x10')]][_0x65ec('0x21')]=_0x11edd1['reason'];agents[_0x11edd1[_0x65ec('0x10')]]['lastevent']=_0x65ec('0x37');writeDB(agents[_0x11edd1[_0x65ec('0x10')]]);}}catch(_0x3095f5){utils['error'](util['format'](_0x65ec('0x33'),_0x11edd1[_0x65ec('0x4')]),_0x3095f5);}};exports[_0x65ec('0x38')]=function(_0x2111af){try{if(!_[_0x65ec('0x1c')](agents[_0x2111af[_0x65ec('0x39')]])){utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x3a'),_0x2111af[_0x65ec('0x4')]),_0x2111af);utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x3b'),_0x2111af[_0x65ec('0x4')],agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x19')],agents[_0x2111af[_0x65ec('0x39')]]['uniqueid']));agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x3c')]=!![];agents[_0x2111af['transfereruniqueid']][_0x65ec('0x3d')]=_0x65ec('0x3e');agents[_0x2111af[_0x65ec('0x39')]]['transferexten']=_0x2111af[_0x65ec('0x3f')];agents[_0x2111af[_0x65ec('0x39')]][_0x65ec('0x40')]=agents[_0x2111af['transfereruniqueid']][_0x65ec('0x4')];}}catch(_0x5e5e48){utils['error'](util[_0x65ec('0x3')](_0x65ec('0x3a'),_0x2111af[_0x65ec('0x4')]),_0x5e5e48);}};exports['attendedtransfer']=function(_0x2df855){try{utils[_0x65ec('0x12')](util[_0x65ec('0x3')](_0x65ec('0x41'),_0x2df855[_0x65ec('0x42')]),_0x2df855);if(_0x2df855[_0x65ec('0x42')]==_0x2df855[_0x65ec('0x43')]){if(!_[_0x65ec('0x1c')](agents[_0x2df855[_0x65ec('0x44')]])){utils['info'](util['format'](_0x65ec('0x45'),_0x2df855['origtransfereruniqueid'],agents[_0x2df855[_0x65ec('0x44')]]['membername']));agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x3c')]=!![];agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x3d')]=_0x65ec('0x46');agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x47')]=_0x2df855['origtransfererexten'];agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x40')]=_0x2df855[_0x65ec('0x42')];}if(_0x2df855[_0x65ec('0x48')]&&agents[_0x2df855[_0x65ec('0x48')]]){agents[_0x2df855['transfereeuniqueid']][_0x65ec('0x49')]=0x1;transfers[_0x2df855[_0x65ec('0x48')]]=_[_0x65ec('0x4a')](agents[_0x2df855[_0x65ec('0x48')]]);transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x7')]=agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x7')];transfers[_0x2df855['transfereeuniqueid']][_0x65ec('0x4b')]=agents[_0x2df855[_0x65ec('0x44')]][_0x65ec('0x4b')];transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();transfers[_0x2df855[_0x65ec('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x2df855[_0x65ec('0x48')]]['holdtime']=0x0;transfers[_0x2df855[_0x65ec('0x48')]][_0x65ec('0x49')]=0x2;}}else if(_0x2df855['secondtransfereruniqueid']==_0x2df855[_0x65ec('0x4c')]){if(!_[_0x65ec('0x1c')](agents[_0x2df855[_0x65ec('0x42')]])){utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x45'),_0x2df855[_0x65ec('0x42')],agents[_0x2df855['origtransfereruniqueid']]['membername']));agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x3c')]=!![];agents[_0x2df855[_0x65ec('0x42')]]['transfertype']=_0x65ec('0x46');agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x47')]=_0x2df855[_0x65ec('0x4d')];agents[_0x2df855[_0x65ec('0x42')]][_0x65ec('0x40')]=_0x2df855[_0x65ec('0x44')];}if(_0x2df855['transfertargetuniqueid']&&agents[_0x2df855[_0x65ec('0x4e')]]){agents[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x49')]=0x1;transfers[_0x2df855[_0x65ec('0x4e')]]=_[_0x65ec('0x4a')](agents[_0x2df855[_0x65ec('0x4e')]]);transfers[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x7')]=agents[_0x2df855[_0x65ec('0x42')]]['calleridnum'];transfers[_0x2df855['transfertargetuniqueid']][_0x65ec('0x4b')]=agents[_0x2df855['origtransfereruniqueid']]['calleridname'];transfers[_0x2df855[_0x65ec('0x4e')]][_0x65ec('0x14')]=utils[_0x65ec('0x15')]();transfers[_0x2df855['transfertargetuniqueid']]['agentconnectAt']=utils[_0x65ec('0x15')]();transfers[_0x2df855['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x2df855['transfertargetuniqueid']][_0x65ec('0x49')]=0x2;}}}catch(_0x4f52ed){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x41'),_0x2df855['origtransfereruniqueid']),_0x4f52ed);}};exports['hangup']=function(_0x258e14){try{utils['debug'](util[_0x65ec('0x3')](_0x65ec('0x4f'),_0x258e14[_0x65ec('0x4')]),_0x258e14);if(agents[_0x258e14[_0x65ec('0x4')]]&&agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]===_0x65ec('0x20')){if(_0x258e14[_0x65ec('0x50')]==='21'){agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]='rejected';agents[_0x258e14[_0x65ec('0x4')]]['lastevent']=_0x65ec('0x51');}utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14['uniqueid'],agents[_0x258e14[_0x65ec('0x4')]]['membername'],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(agents[_0x258e14['uniqueid']]);var _0x5307ac=unanswered['indexOf'](_0x258e14[_0x65ec('0x4')]);if(_0x5307ac>-0x1){unanswered[_0x65ec('0x53')](_0x5307ac,0x1);}}if(transfers[_0x258e14[_0x65ec('0x4')]]){transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x32')]=!![];transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')]=utils[_0x65ec('0x15')]();transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x24')]=utils[_0x65ec('0x35')](transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')],transfers[_0x258e14['uniqueid']][_0x65ec('0x36')]);transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]=_0x65ec('0x55');transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]=_0x65ec('0x37');utils[_0x65ec('0x17')](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14['uniqueid'],transfers[_0x258e14[_0x65ec('0x4')]]['membername'],transfers[_0x258e14['uniqueid']][_0x65ec('0x21')],transfers[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(transfers[_0x258e14[_0x65ec('0x4')]],!![]);}if(agents[_0x258e14[_0x65ec('0x4')]]&&agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x36')]){agents[_0x258e14[_0x65ec('0x4')]]['agentcomplete']=!![];agents[_0x258e14[_0x65ec('0x4')]]['agentcompleteAt']=utils[_0x65ec('0x15')]();agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x24')]=utils['diffTime'](agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x54')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x36')]);agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x21')]=agents[_0x258e14[_0x65ec('0x4')]]['transfer']?_0x65ec('0x3c'):_0x65ec('0x55');agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]='complete';utils['info'](util[_0x65ec('0x3')](_0x65ec('0x52'),_0x258e14[_0x65ec('0x4')],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x19')],agents[_0x258e14[_0x65ec('0x4')]]['reason'],agents[_0x258e14[_0x65ec('0x4')]][_0x65ec('0x8')]));writeDB(agents[_0x258e14[_0x65ec('0x4')]]);}}catch(_0x127e67){utils[_0x65ec('0x1a')](util[_0x65ec('0x3')](_0x65ec('0x4f'),_0x258e14[_0x65ec('0x4')]),_0x127e67);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 251def1..76e169d 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 _0xd2c1=['format','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','[%s][calls][newchannel]','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','noop','gotoif','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info'];(function(_0x5d06ca,_0x14f1f7){var _0x38aec7=function(_0x607c97){while(--_0x607c97){_0x5d06ca['push'](_0x5d06ca['shift']());}};_0x38aec7(++_0x14f1f7);}(_0xd2c1,0xc3));var _0x1d2c=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xd2c1[_0x523adf];return _0x283870;};'use strict';var _=require('lodash');var util=require(_0x1d2c('0x0'));var utils=require(_0x1d2c('0x1'));var dispositions=[_0x1d2c('0x2'),'FAILED',_0x1d2c('0x3'),_0x1d2c('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x1d2c('0x4'),_0x1d2c('0x5'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x16a752){utils[_0x1d2c('0x6')](util[_0x1d2c('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x16a752['uniqueid'],_0x16a752[_0x1d2c('0x8')],_0x16a752[_0x1d2c('0x9')],_0x16a752[_0x1d2c('0xa')],_0x16a752[_0x1d2c('0xb')],_0x16a752[_0x1d2c('0xc')],_0x16a752['connectedlinenum'],_0x16a752[_0x1d2c('0xd')]));if(_0x16a752[_0x1d2c('0xe')]){utils[_0x1d2c('0xf')](_0x16a752[_0x1d2c('0xe')])['then'](function(_0x2b0ce8){if(_0x2b0ce8){_0x16a752[_0x1d2c('0x10')]=_0x2b0ce8['id'];}utils[_0x1d2c('0x11')](_0x1d2c('0x12'),_0x16a752);});}else{utils[_0x1d2c('0x11')](_0x1d2c('0x12'),_0x16a752);}if(channels[_0x16a752[_0x1d2c('0x13')]]){delete channels[_0x16a752[_0x1d2c('0x13')]];}}exports['newchannel']=function(_0x55adde){try{utils['debug'](util[_0x1d2c('0x7')]('[%s][calls][newchannel]',_0x55adde['uniqueid']),_0x55adde);if(_0x55adde[_0x1d2c('0x13')]==_0x55adde[_0x1d2c('0x14')]&&_0x55adde[_0x1d2c('0x8')]!='OutgoingSpoolFailed'){utils[_0x1d2c('0x6')](util[_0x1d2c('0x7')](_0x1d2c('0x15'),_0x55adde[_0x1d2c('0x13')],_0x55adde[_0x1d2c('0x16')],_0x55adde[_0x1d2c('0x17')]));channels[_0x55adde[_0x1d2c('0x13')]]={'uniqueid':_0x55adde[_0x1d2c('0x13')],'accountcode':_0x55adde[_0x1d2c('0xe')],'source':_0x55adde['calleridnum'],'destination':_0x55adde['exten'],'destinationcontext':_0x55adde[_0x1d2c('0x16')],'channel':_0x55adde[_0x1d2c('0x8')],'starttime':utils[_0x1d2c('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1d2c('0x2'),'amaflags':_0x1d2c('0x19')};}}catch(_0x1d15e4){utils['error'](util[_0x1d2c('0x7')](_0x1d2c('0x1a'),_0x55adde[_0x1d2c('0x13')]),_0x1d15e4);}};exports[_0x1d2c('0x1b')]=function(_0x54234b){try{utils[_0x1d2c('0x1c')](util[_0x1d2c('0x7')]('[%s][calls][newstate]',_0x54234b[_0x1d2c('0x13')]),_0x54234b);if(!_[_0x1d2c('0x1d')](channels[_0x54234b['uniqueid']])&&_0x54234b[_0x1d2c('0x1e')]==0x6){utils[_0x1d2c('0x6')](util['format'](_0x1d2c('0x1f'),_0x54234b[_0x1d2c('0x13')],_0x54234b['context'],_0x54234b['channel']));if(_[_0x1d2c('0x1d')](channels[_0x54234b['uniqueid']][_0x1d2c('0x20')])){channels[_0x54234b['uniqueid']][_0x1d2c('0x20')]=utils[_0x1d2c('0x18')]();}}else if(!_[_0x1d2c('0x1d')](channels[_0x54234b[_0x1d2c('0x14')]])&&_0x54234b['channelstate']==0x6&&_0x54234b[_0x1d2c('0x16')]!=_0x1d2c('0x21')){utils['info'](util[_0x1d2c('0x7')](_0x1d2c('0x22'),_0x54234b[_0x1d2c('0x13')],_0x54234b['linkedid'],_0x54234b['context'],_0x54234b[_0x1d2c('0x8')]));channels[_0x54234b[_0x1d2c('0x14')]][_0x1d2c('0xe')]=_0x54234b[_0x1d2c('0xe')];channels[_0x54234b[_0x1d2c('0x14')]][_0x1d2c('0x23')]=_0x54234b[_0x1d2c('0x8')];if(_[_0x1d2c('0x1d')](channels[_0x54234b[_0x1d2c('0x14')]][_0x1d2c('0x24')])){channels[_0x54234b[_0x1d2c('0x14')]]['answertime']=utils['now']();}channels[_0x54234b['linkedid']][_0x1d2c('0x25')]=dispositions[_[_0x1d2c('0x26')](_0x54234b[_0x1d2c('0x1e')])]||_0x1d2c('0x4');}}catch(_0x11a081){utils[_0x1d2c('0x27')](util[_0x1d2c('0x7')](_0x1d2c('0x28'),_0x54234b['uniqueid']),_0x11a081);}};exports[_0x1d2c('0x29')]=function(_0x2acb5d){try{if(!_[_0x1d2c('0x1d')](channels[_0x2acb5d['uniqueid']])){utils[_0x1d2c('0x1c')](util[_0x1d2c('0x7')](_0x1d2c('0x2a'),_0x2acb5d['uniqueid']),_0x2acb5d);if(_[_0x1d2c('0x1d')](channels[_0x2acb5d[_0x1d2c('0x13')]]['callerid'])){channels[_0x2acb5d['uniqueid']][_0x1d2c('0x2b')]=_0x2acb5d['calleridname']+'\x20<'+_0x2acb5d[_0x1d2c('0xc')]+'>';}utils[_0x1d2c('0x6')](util['format'](_0x1d2c('0x2c'),_0x2acb5d[_0x1d2c('0x13')],channels[_0x2acb5d[_0x1d2c('0x13')]][_0x1d2c('0x2b')],_0x2acb5d['cause-txt']));channels[_0x2acb5d['uniqueid']][_0x1d2c('0x2d')]=utils['now']();channels[_0x2acb5d['uniqueid']][_0x1d2c('0x2e')]=utils[_0x1d2c('0x2f')](channels[_0x2acb5d[_0x1d2c('0x13')]][_0x1d2c('0x2d')],channels[_0x2acb5d[_0x1d2c('0x13')]]['starttime']);channels[_0x2acb5d[_0x1d2c('0x13')]]['billableseconds']=channels[_0x2acb5d['uniqueid']]['answertime']?utils[_0x1d2c('0x2f')](channels[_0x2acb5d[_0x1d2c('0x13')]]['endtime'],channels[_0x2acb5d[_0x1d2c('0x13')]][_0x1d2c('0x24')]):0x0;writeDB(channels[_0x2acb5d[_0x1d2c('0x13')]]);}}catch(_0x182b9c){utils[_0x1d2c('0x27')](util['format'](_0x1d2c('0x2a'),_0x2acb5d[_0x1d2c('0x13')]),_0x182b9c);}};exports[_0x1d2c('0x30')]=function(_0x46dc18){try{if(!_[_0x1d2c('0x1d')](channels[_0x46dc18[_0x1d2c('0x31')]])){utils[_0x1d2c('0x1c')](util[_0x1d2c('0x7')]('[%s][calls][attendedtransfer]',_0x46dc18['origtransfereruniqueid']),_0x46dc18);if(channels[_0x46dc18['localtwolinkedid']][_0x1d2c('0x8')]==_0x46dc18[_0x1d2c('0x32')]){utils['info'](util['format'](_0x1d2c('0x33'),_0x46dc18[_0x1d2c('0x34')],_0x46dc18[_0x1d2c('0x31')],_0x46dc18[_0x1d2c('0x35')]));channels[_0x46dc18['localtwolinkedid']]['destinationchannel']=_0x46dc18['secondtransfererchannel'];channels[_0x46dc18[_0x1d2c('0x31')]][_0x1d2c('0x36')]=_0x1d2c('0x37');}else if(channels[_0x46dc18[_0x1d2c('0x31')]][_0x1d2c('0x8')]=_0x46dc18['transfertargetchannel']){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x46dc18[_0x1d2c('0x34')],_0x46dc18[_0x1d2c('0x31')],_0x46dc18[_0x1d2c('0x38')]));channels[_0x46dc18['localtwolinkedid']]['destinationchannel']=_0x46dc18[_0x1d2c('0x38')];channels[_0x46dc18[_0x1d2c('0x31')]][_0x1d2c('0x36')]=_0x1d2c('0x37');}}}catch(_0x59bed6){utils['error'](util[_0x1d2c('0x7')]('[%s][calls][attendedtransfer]',_0x46dc18[_0x1d2c('0x34')]),_0x59bed6);}};exports[_0x1d2c('0x39')]=function(_0x3eca87){try{if(!_[_0x1d2c('0x1d')](channels[_0x3eca87['uniqueid']])){utils['debug'](util[_0x1d2c('0x7')](_0x1d2c('0x3a'),_0x3eca87[_0x1d2c('0x13')]),_0x3eca87);channels[_0x3eca87['uniqueid']][_0x1d2c('0x3b')]=utils['now']();utils['info'](util[_0x1d2c('0x7')](_0x1d2c('0x3c'),_0x3eca87['uniqueid'],channels[_0x3eca87[_0x1d2c('0x13')]][_0x1d2c('0x3b')]));}}catch(_0x343da2){utils[_0x1d2c('0x27')](util[_0x1d2c('0x7')](_0x1d2c('0x3a'),_0x3eca87[_0x1d2c('0x13')]),_0x343da2);}};exports['musiconholdstop']=function(_0x1a6c84){try{if(!_[_0x1d2c('0x1d')](channels[_0x1a6c84[_0x1d2c('0x13')]])){utils['debug'](util[_0x1d2c('0x7')](_0x1d2c('0x3d'),_0x1a6c84[_0x1d2c('0x13')]),_0x1a6c84);if(!_[_0x1d2c('0x1d')](channels[_0x1a6c84[_0x1d2c('0x13')]]['musiconholdstartAt'])){channels[_0x1a6c84[_0x1d2c('0x13')]][_0x1d2c('0x3e')]+=utils[_0x1d2c('0x2f')](utils[_0x1d2c('0x18')](),channels[_0x1a6c84[_0x1d2c('0x13')]][_0x1d2c('0x3b')]);utils[_0x1d2c('0x6')](util['format'](_0x1d2c('0x3f'),_0x1a6c84[_0x1d2c('0x13')],channels[_0x1a6c84[_0x1d2c('0x13')]][_0x1d2c('0x3e')]));delete channels[_0x1a6c84[_0x1d2c('0x13')]][_0x1d2c('0x3b')];}}}catch(_0x395336){utils['error'](util[_0x1d2c('0x7')](_0x1d2c('0x3d'),_0x1a6c84[_0x1d2c('0x13')]),_0x395336);}};exports[_0x1d2c('0x40')]=function(_0x1494d8){try{if(!_['isNil'](channels[_0x1494d8[_0x1d2c('0x13')]])){utils[_0x1d2c('0x1c')](util[_0x1d2c('0x7')]('[%s][calls][varset]',_0x1494d8[_0x1d2c('0x13')]),_0x1494d8);if(!_['isNil'](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x42')])){utils[_0x1d2c('0x6')](util[_0x1d2c('0x7')](_0x1d2c('0x43'),_0x1494d8['uniqueid'],_0x1494d8[_0x1d2c('0x44')]));channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x45')]=_0x1494d8[_0x1d2c('0x44')];}if(!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x46')])){utils[_0x1d2c('0x6')](util[_0x1d2c('0x7')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1494d8['uniqueid'],_0x1494d8[_0x1d2c('0x44')]));channels[_0x1494d8[_0x1d2c('0x13')]]['destination']=_0x1494d8[_0x1d2c('0x44')];channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x2b')]='\x22'+_0x1494d8[_0x1d2c('0x44')]+_0x1d2c('0x47')+_0x1494d8[_0x1d2c('0x44')]+'>';}if(!_['isNil'](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x48')])||!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x49')])){utils[_0x1d2c('0x6')](util['format'](_0x1d2c('0x4a'),_0x1494d8[_0x1d2c('0x13')],!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x48')])?_0x1d2c('0x48'):'xmd-callerid',_0x1494d8['value']));channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x2b')]=_0x1494d8[_0x1d2c('0x44')];}if(!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x4b')])||!_['isNil'](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x4c')])){utils[_0x1d2c('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1494d8[_0x1d2c('0x13')],!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x4b')])?'xmd-queue':_0x1d2c('0x4c'),_0x1494d8[_0x1d2c('0x44')]));channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x4d')]=_0x1d2c('0x4e');channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x4f')]=_0x1494d8[_0x1d2c('0x44')];channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x9')]=!![];}if(!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x50')])){utils['info'](util[_0x1d2c('0x7')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1494d8['uniqueid'],_0x1494d8[_0x1d2c('0x44')]));channels[_0x1494d8[_0x1d2c('0x13')]]['ContactId']=_0x1494d8[_0x1d2c('0x44')];}if(!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x51')])){utils[_0x1d2c('0x6')](util['format'](_0x1d2c('0x52'),_0x1494d8[_0x1d2c('0x13')],_0x1494d8[_0x1d2c('0x44')]));channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x53')]=_0x1494d8['value'];}if(!_[_0x1d2c('0x1d')](_0x1494d8['variable']['outboundrouteid'])){utils[_0x1d2c('0x6')](util[_0x1d2c('0x7')](_0x1d2c('0x54'),_0x1494d8[_0x1d2c('0x13')],_0x1494d8['value']));channels[_0x1494d8['uniqueid']][_0x1d2c('0x55')]=_0x1494d8[_0x1d2c('0x44')];}if(!_[_0x1d2c('0x1d')](_0x1494d8[_0x1d2c('0x41')][_0x1d2c('0x56')])){utils['info'](util[_0x1d2c('0x7')](_0x1d2c('0x57'),_0x1494d8[_0x1d2c('0x13')],_0x1494d8['value']));channels[_0x1494d8[_0x1d2c('0x13')]][_0x1d2c('0x56')]=_0x1494d8['value'];}}}catch(_0x1a255a){utils[_0x1d2c('0x27')](util[_0x1d2c('0x7')](_0x1d2c('0x58'),_0x1494d8[_0x1d2c('0x13')]),_0x1a255a);}};exports['newexten']=function(_0x128ac1){try{if(!_[_0x1d2c('0x1d')](channels[_0x128ac1[_0x1d2c('0x13')]])){utils[_0x1d2c('0x1c')](util[_0x1d2c('0x7')]('[%s][calls][newexten]',_0x128ac1[_0x1d2c('0x13')]),_0x128ac1);utils[_0x1d2c('0x6')](util[_0x1d2c('0x7')](_0x1d2c('0x59'),_0x128ac1['uniqueid'],_0x128ac1[_0x1d2c('0x5a')],_0x128ac1[_0x1d2c('0x5b')]));if(_0x128ac1[_0x1d2c('0x5a')][_0x1d2c('0x5c')]()==_0x1d2c('0x5d')&&_['startsWith'](_0x128ac1[_0x1d2c('0x5b')][_0x1d2c('0x5c')](),_0x1d2c('0x5e'))){var _0x343998=_0x128ac1[_0x1d2c('0x5b')][_0x1d2c('0x5f')]('=');var _0x28dcce=_0x343998[0x0][_0x1d2c('0x60')](_0x343998[0x0]['lastIndexOf']('(')+0x1,_0x343998[0x0][_0x1d2c('0x61')](')'));var _0x13b99b=_0x343998[0x1];channels[_0x128ac1[_0x1d2c('0x13')]][_0x28dcce]=_0x13b99b;}if(!_['includes']([_0x1d2c('0x29'),_0x1d2c('0x62'),'execif',_0x1d2c('0x5d'),_0x1d2c('0x63')],_0x128ac1[_0x1d2c('0x5a')]['toLowerCase']())){channels[_0x128ac1['uniqueid']][_0x1d2c('0x4d')]=_0x128ac1[_0x1d2c('0x5a')];channels[_0x128ac1['uniqueid']][_0x1d2c('0x4f')]=_0x128ac1[_0x1d2c('0x5b')];}}}catch(_0x4c8025){utils[_0x1d2c('0x27')](util[_0x1d2c('0x7')](_0x1d2c('0x64'),_0x128ac1['uniqueid']),_0x4c8025);}}; \ No newline at end of file +var _0x11da=['NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','UserId','CreateVoiceCallReport','request','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','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','set','startsWith','split','substring','lastIndexOf','noop','lodash','util','./utils'];(function(_0x273040,_0x4f8bb4){var _0x522882=function(_0x34e1da){while(--_0x34e1da){_0x273040['push'](_0x273040['shift']());}};_0x522882(++_0x4f8bb4);}(_0x11da,0x195));var _0xa11d=function(_0x2ba1c7,_0x2e4a24){_0x2ba1c7=_0x2ba1c7-0x0;var _0x1ff608=_0x11da[_0x2ba1c7];return _0x1ff608;};'use strict';var _=require(_0xa11d('0x0'));var util=require(_0xa11d('0x1'));var utils=require(_0xa11d('0x2'));var dispositions=[_0xa11d('0x3'),_0xa11d('0x4'),_0xa11d('0x4'),'NO\x20ANSWER',_0xa11d('0x3'),'NO\x20ANSWER',_0xa11d('0x5'),_0xa11d('0x6'),'FAILED',_0xa11d('0x4'),_0xa11d('0x4')];var channels={};function writeDB(_0x273cc9){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x9'),_0x273cc9[_0xa11d('0xa')],_0x273cc9[_0xa11d('0xb')],_0x273cc9[_0xa11d('0xc')],_0x273cc9[_0xa11d('0xd')],_0x273cc9[_0xa11d('0xe')],_0x273cc9[_0xa11d('0xf')],_0x273cc9['connectedlinenum'],_0x273cc9[_0xa11d('0x10')]));if(_0x273cc9[_0xa11d('0x11')]){utils[_0xa11d('0x12')](_0x273cc9[_0xa11d('0x11')])['then'](function(_0x102b06){if(_0x102b06){_0x273cc9[_0xa11d('0x13')]=_0x102b06['id'];}utils['request'](_0xa11d('0x14'),_0x273cc9);});}else{utils[_0xa11d('0x15')](_0xa11d('0x14'),_0x273cc9);}if(channels[_0x273cc9[_0xa11d('0xa')]]){delete channels[_0x273cc9[_0xa11d('0xa')]];}}exports['newchannel']=function(_0x3bffd7){try{utils[_0xa11d('0x16')](util[_0xa11d('0x8')]('[%s][calls][newchannel]',_0x3bffd7[_0xa11d('0xa')]),_0x3bffd7);if(_0x3bffd7[_0xa11d('0xa')]==_0x3bffd7[_0xa11d('0x17')]&&_0x3bffd7[_0xa11d('0xb')]!=_0xa11d('0x18')){utils[_0xa11d('0x7')](util['format'](_0xa11d('0x19'),_0x3bffd7[_0xa11d('0xa')],_0x3bffd7['context'],_0x3bffd7[_0xa11d('0x1a')]));channels[_0x3bffd7['uniqueid']]={'uniqueid':_0x3bffd7['uniqueid'],'accountcode':_0x3bffd7[_0xa11d('0x11')],'source':_0x3bffd7[_0xa11d('0xf')],'destination':_0x3bffd7['exten'],'destinationcontext':_0x3bffd7[_0xa11d('0x1b')],'channel':_0x3bffd7[_0xa11d('0xb')],'starttime':utils[_0xa11d('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa11d('0x3'),'amaflags':_0xa11d('0x1d')};}}catch(_0x359ba2){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x1f'),_0x3bffd7[_0xa11d('0xa')]),_0x359ba2);}};exports[_0xa11d('0x20')]=function(_0x17f371){try{utils[_0xa11d('0x16')](util[_0xa11d('0x8')](_0xa11d('0x21'),_0x17f371[_0xa11d('0xa')]),_0x17f371);if(!_['isNil'](channels[_0x17f371[_0xa11d('0xa')]])&&_0x17f371[_0xa11d('0x22')]==0x6){utils[_0xa11d('0x7')](util[_0xa11d('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x17f371['uniqueid'],_0x17f371[_0xa11d('0x1b')],_0x17f371[_0xa11d('0xb')]));if(_[_0xa11d('0x23')](channels[_0x17f371[_0xa11d('0xa')]][_0xa11d('0x24')])){channels[_0x17f371[_0xa11d('0xa')]][_0xa11d('0x24')]=utils[_0xa11d('0x1c')]();}}else if(!_[_0xa11d('0x23')](channels[_0x17f371[_0xa11d('0x17')]])&&_0x17f371['channelstate']==0x6&&_0x17f371['context']!=_0xa11d('0x25')){utils[_0xa11d('0x7')](util['format'](_0xa11d('0x26'),_0x17f371[_0xa11d('0xa')],_0x17f371[_0xa11d('0x17')],_0x17f371[_0xa11d('0x1b')],_0x17f371['channel']));channels[_0x17f371[_0xa11d('0x17')]][_0xa11d('0x11')]=_0x17f371[_0xa11d('0x11')];channels[_0x17f371[_0xa11d('0x17')]][_0xa11d('0x27')]=_0x17f371[_0xa11d('0xb')];if(_[_0xa11d('0x23')](channels[_0x17f371['linkedid']][_0xa11d('0x28')])){channels[_0x17f371[_0xa11d('0x17')]][_0xa11d('0x28')]=utils[_0xa11d('0x1c')]();}channels[_0x17f371[_0xa11d('0x17')]]['disposition']=dispositions[_[_0xa11d('0x29')](_0x17f371[_0xa11d('0x22')])]||_0xa11d('0x5');}}catch(_0x1e1a98){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x21'),_0x17f371[_0xa11d('0xa')]),_0x1e1a98);}};exports[_0xa11d('0x2a')]=function(_0x583c5b){try{if(!_[_0xa11d('0x23')](channels[_0x583c5b[_0xa11d('0xa')]])){utils[_0xa11d('0x16')](util[_0xa11d('0x8')]('[%s][calls][hangup]',_0x583c5b['uniqueid']),_0x583c5b);if(_[_0xa11d('0x23')](channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2b')])){channels[_0x583c5b['uniqueid']][_0xa11d('0x2b')]=_0x583c5b[_0xa11d('0x2c')]+'\x20<'+_0x583c5b[_0xa11d('0xf')]+'>';}utils[_0xa11d('0x7')](util['format'](_0xa11d('0x2d'),_0x583c5b['uniqueid'],channels[_0x583c5b[_0xa11d('0xa')]]['callerid'],_0x583c5b[_0xa11d('0x2e')]));channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2f')]=utils[_0xa11d('0x1c')]();channels[_0x583c5b[_0xa11d('0xa')]]['duration']=utils[_0xa11d('0x30')](channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2f')],channels[_0x583c5b['uniqueid']][_0xa11d('0x31')]);channels[_0x583c5b[_0xa11d('0xa')]]['billableseconds']=channels[_0x583c5b[_0xa11d('0xa')]]['answertime']?utils['diffTime'](channels[_0x583c5b[_0xa11d('0xa')]][_0xa11d('0x2f')],channels[_0x583c5b['uniqueid']][_0xa11d('0x28')]):0x0;writeDB(channels[_0x583c5b[_0xa11d('0xa')]]);}}catch(_0x1b14f7){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x32'),_0x583c5b[_0xa11d('0xa')]),_0x1b14f7);}};exports[_0xa11d('0x33')]=function(_0x4df244){try{if(!_['isNil'](channels[_0x4df244['localtwolinkedid']])){utils['debug'](util['format'](_0xa11d('0x34'),_0x4df244[_0xa11d('0x35')]),_0x4df244);if(channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0xb')]==_0x4df244[_0xa11d('0x37')]){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x38'),_0x4df244['origtransfereruniqueid'],_0x4df244[_0xa11d('0x36')],_0x4df244[_0xa11d('0x39')]));channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0x27')]=_0x4df244['secondtransfererchannel'];channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0x3a')]=_0xa11d('0x3b');}else if(channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0xb')]=_0x4df244[_0xa11d('0x3c')]){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x38'),_0x4df244[_0xa11d('0x35')],_0x4df244[_0xa11d('0x36')],_0x4df244[_0xa11d('0x3d')]));channels[_0x4df244[_0xa11d('0x36')]][_0xa11d('0x27')]=_0x4df244[_0xa11d('0x3d')];channels[_0x4df244[_0xa11d('0x36')]]['userfield']='_attended';}}}catch(_0x2dda6c){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x34'),_0x4df244['origtransfereruniqueid']),_0x2dda6c);}};exports['musiconholdstart']=function(_0x32e226){try{if(!_[_0xa11d('0x23')](channels[_0x32e226['uniqueid']])){utils[_0xa11d('0x16')](util[_0xa11d('0x8')](_0xa11d('0x3e'),_0x32e226[_0xa11d('0xa')]),_0x32e226);channels[_0x32e226[_0xa11d('0xa')]][_0xa11d('0x3f')]=utils[_0xa11d('0x1c')]();utils[_0xa11d('0x7')](util[_0xa11d('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x32e226['uniqueid'],channels[_0x32e226[_0xa11d('0xa')]][_0xa11d('0x3f')]));}}catch(_0x2c7f79){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x3e'),_0x32e226[_0xa11d('0xa')]),_0x2c7f79);}};exports[_0xa11d('0x40')]=function(_0x495e4b){try{if(!_['isNil'](channels[_0x495e4b['uniqueid']])){utils[_0xa11d('0x16')](util['format']('[%s][calls][musiconholdstop]',_0x495e4b[_0xa11d('0xa')]),_0x495e4b);if(!_[_0xa11d('0x23')](channels[_0x495e4b[_0xa11d('0xa')]]['musiconholdstartAt'])){channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x41')]+=utils[_0xa11d('0x30')](utils[_0xa11d('0x1c')](),channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x3f')]);utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x42'),_0x495e4b[_0xa11d('0xa')],channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x41')]));delete channels[_0x495e4b[_0xa11d('0xa')]][_0xa11d('0x3f')];}}}catch(_0x202719){utils['error'](util[_0xa11d('0x8')]('[%s][calls][musiconholdstop]',_0x495e4b[_0xa11d('0xa')]),_0x202719);}};exports[_0xa11d('0x43')]=function(_0x1fcabb){try{if(!_[_0xa11d('0x23')](channels[_0x1fcabb[_0xa11d('0xa')]])){utils[_0xa11d('0x16')](util[_0xa11d('0x8')](_0xa11d('0x44'),_0x1fcabb[_0xa11d('0xa')]),_0x1fcabb);if(!_['isNil'](_0x1fcabb[_0xa11d('0x45')]['xmd-originatecalleridnum'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x46'),_0x1fcabb['uniqueid'],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['source']=_0x1fcabb[_0xa11d('0x47')];}if(!_[_0xa11d('0x23')](_0x1fcabb['variable']['xmd-phone'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1fcabb[_0xa11d('0xa')],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x48')]=_0x1fcabb['value'];channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x2b')]='\x22'+_0x1fcabb['value']+_0xa11d('0x49')+_0x1fcabb[_0xa11d('0x47')]+'>';}if(!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4a')])||!_[_0xa11d('0x23')](_0x1fcabb['variable'][_0xa11d('0x4b')])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x4c'),_0x1fcabb['uniqueid'],!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4a')])?_0xa11d('0x4a'):_0xa11d('0x4b'),_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['callerid']=_0x1fcabb[_0xa11d('0x47')];}if(!_['isNil'](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4d')])||!_[_0xa11d('0x23')](_0x1fcabb['variable']['xmcs-queue'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x4c'),_0x1fcabb[_0xa11d('0xa')],!_['isNil'](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x4d')])?_0xa11d('0x4d'):_0xa11d('0x4e'),_0x1fcabb['value']));channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x4f')]=_0xa11d('0x50');channels[_0x1fcabb['uniqueid']][_0xa11d('0x51')]=_0x1fcabb[_0xa11d('0x47')];channels[_0x1fcabb['uniqueid']][_0xa11d('0xc')]=!![];}if(!_['isNil'](_0x1fcabb['variable'][_0xa11d('0x52')])){utils['info'](util[_0xa11d('0x8')](_0xa11d('0x53'),_0x1fcabb[_0xa11d('0xa')],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['ContactId']=_0x1fcabb[_0xa11d('0x47')];}if(!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')]['xmd-cdrtype'])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x54'),_0x1fcabb[_0xa11d('0xa')],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb[_0xa11d('0xa')]]['type']=_0x1fcabb['value'];}if(!_[_0xa11d('0x23')](_0x1fcabb[_0xa11d('0x45')][_0xa11d('0x55')])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x56'),_0x1fcabb['uniqueid'],_0x1fcabb[_0xa11d('0x47')]));channels[_0x1fcabb['uniqueid']][_0xa11d('0x57')]=_0x1fcabb['value'];}if(!_[_0xa11d('0x23')](_0x1fcabb['variable'][_0xa11d('0x58')])){utils[_0xa11d('0x7')](util[_0xa11d('0x8')](_0xa11d('0x59'),_0x1fcabb[_0xa11d('0xa')],_0x1fcabb['value']));channels[_0x1fcabb[_0xa11d('0xa')]][_0xa11d('0x58')]=_0x1fcabb['value'];}}}catch(_0x3c8166){utils[_0xa11d('0x1e')](util[_0xa11d('0x8')](_0xa11d('0x44'),_0x1fcabb[_0xa11d('0xa')]),_0x3c8166);}};exports[_0xa11d('0x5a')]=function(_0x255dca){try{if(!_[_0xa11d('0x23')](channels[_0x255dca[_0xa11d('0xa')]])){utils[_0xa11d('0x16')](util['format'](_0xa11d('0x5b'),_0x255dca[_0xa11d('0xa')]),_0x255dca);utils[_0xa11d('0x7')](util['format'](_0xa11d('0x5c'),_0x255dca[_0xa11d('0xa')],_0x255dca['application'],_0x255dca[_0xa11d('0x5d')]));if(_0x255dca[_0xa11d('0x5e')][_0xa11d('0x5f')]()==_0xa11d('0x60')&&_[_0xa11d('0x61')](_0x255dca[_0xa11d('0x5d')][_0xa11d('0x5f')](),'cdr')){var _0x450f6c=_0x255dca[_0xa11d('0x5d')][_0xa11d('0x62')]('=');var _0x2deb33=_0x450f6c[0x0][_0xa11d('0x63')](_0x450f6c[0x0][_0xa11d('0x64')]('(')+0x1,_0x450f6c[0x0]['lastIndexOf'](')'));var _0x59db9b=_0x450f6c[0x1];channels[_0x255dca['uniqueid']][_0x2deb33]=_0x59db9b;}if(!_['includes']([_0xa11d('0x2a'),_0xa11d('0x65'),'execif','set','gotoif'],_0x255dca[_0xa11d('0x5e')][_0xa11d('0x5f')]())){channels[_0x255dca[_0xa11d('0xa')]][_0xa11d('0x4f')]=_0x255dca[_0xa11d('0x5e')];channels[_0x255dca[_0xa11d('0xa')]][_0xa11d('0x51')]=_0x255dca[_0xa11d('0x5d')];}}}catch(_0x18ee9e){utils[_0xa11d('0x1e')](util['format'](_0xa11d('0x5b'),_0x255dca['uniqueid']),_0x18ee9e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b7c98a1..e8e1899 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 _0x5e2f=['managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x4b1a42,_0xe56669){var _0x2f92b7=function(_0x4b2dcd){while(--_0x4b2dcd){_0x4b1a42['push'](_0x4b1a42['shift']());}};_0x2f92b7(++_0xe56669);}(_0x5e2f,0x14b));var _0xf5e2=function(_0x1b3e44,_0x3bb9e3){_0x1b3e44=_0x1b3e44-0x0;var _0x21ca9f=_0x5e2f[_0x1b3e44];return _0x21ca9f;};'use strict';var utils=require(_0xf5e2('0x0'));exports['connect']=function(){utils[_0xf5e2('0x1')](_0xf5e2('0x2'));};exports[_0xf5e2('0x3')]=function(){utils['info'](_0xf5e2('0x4'));};exports['fullybooted']=function(){utils['info'](_0xf5e2('0x5'));};exports[_0xf5e2('0x6')]=function(_0x101de3){utils['error'](_0xf5e2('0x7'),_0x101de3);};exports[_0xf5e2('0x8')]=function(){utils['info'](_0xf5e2('0x9'));};exports[_0xf5e2('0xa')]=function(_0x2138ee){}; \ No newline at end of file +var _0x649b=['[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','info','[core]\x20connected'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x649b,0x166));var _0xb649=function(_0x4020c3,_0x4314ee){_0x4020c3=_0x4020c3-0x0;var _0x11df1a=_0x649b[_0x4020c3];return _0x11df1a;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0xb649('0x0')](_0xb649('0x1'));};exports['shutdown']=function(){utils['info'](_0xb649('0x2'));};exports['fullybooted']=function(){utils[_0xb649('0x0')](_0xb649('0x3'));};exports[_0xb649('0x4')]=function(_0x4b30c5){utils[_0xb649('0x4')](_0xb649('0x5'),_0x4b30c5);};exports[_0xb649('0x6')]=function(){utils['info']('[core]\x20close');};exports[_0xb649('0x7')]=function(_0x4c5c97){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2f3a88c..a161bb9 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 _0xa0ef=['variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','calleridnum','calleridname','cause-txt','assign','diffTime','holdtime','endtime','billableseconds','[%s][dials][hangup]','lodash','./utils','info','format','uniqueid','channel','dialstring','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','isNil'];(function(_0x53a0b5,_0x2f10d6){var _0x3774fb=function(_0x54dd87){while(--_0x54dd87){_0x53a0b5['push'](_0x53a0b5['shift']());}};_0x3774fb(++_0x2f10d6);}(_0xa0ef,0xb0));var _0xfa0e=function(_0x52fa77,_0x2b381b){_0x52fa77=_0x52fa77-0x0;var _0x477535=_0xa0ef[_0x52fa77];return _0x477535;};'use strict';var _=require(_0xfa0e('0x0'));var util=require('util');var utils=require(_0xfa0e('0x1'));var dials={};function writeDB(_0x4876d5){utils[_0xfa0e('0x2')](util[_0xfa0e('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x4876d5[_0xfa0e('0x4')],_0x4876d5[_0xfa0e('0x5')],_0x4876d5[_0xfa0e('0x6')],_0x4876d5['calleridnum'],_0x4876d5['connectedlinenum'],_0x4876d5[_0xfa0e('0x7')]));utils[_0xfa0e('0x8')](_0xfa0e('0x9'),_0x4876d5);delete dials[_0x4876d5[_0xfa0e('0x4')]];}exports[_0xfa0e('0xa')]=function(_0xdaa030){try{utils[_0xfa0e('0xb')](util['format'](_0xfa0e('0xc'),_0xdaa030[_0xfa0e('0x4')]),_0xdaa030);utils[_0xfa0e('0x2')](util[_0xfa0e('0x3')](_0xfa0e('0xd'),_0xdaa030[_0xfa0e('0x4')],_0xdaa030[_0xfa0e('0xe')],_0xdaa030[_0xfa0e('0xf')]));if(_0xdaa030[_0xfa0e('0xe')][_0xfa0e('0x10')]()==_0xfa0e('0x11')&&_[_0xfa0e('0x12')](_0xdaa030[_0xfa0e('0xf')][_0xfa0e('0x10')](),_0xfa0e('0x13'))){var _0x239f2c=_0xdaa030[_0xfa0e('0xf')][_0xfa0e('0x14')]('=');dials[_0xdaa030['uniqueid']]={'routeId':_0x239f2c[0x1]};}}catch(_0x3b5f76){utils[_0xfa0e('0x15')](util['format'](_0xfa0e('0xc'),_0xdaa030[_0xfa0e('0x4')]),_0x3b5f76);}};exports[_0xfa0e('0x16')]=function(_0x2e9e8b){try{utils['debug'](util['format']('[%s][dials][varset]',_0x2e9e8b[_0xfa0e('0x4')]),_0x2e9e8b);if(!_[_0xfa0e('0x17')](_0x2e9e8b[_0xfa0e('0x18')]['outboundrouteid'])){utils['info'](util[_0xfa0e('0x3')](_0xfa0e('0x19'),_0x2e9e8b[_0xfa0e('0x4')],_0x2e9e8b[_0xfa0e('0x1a')]));dials[_0x2e9e8b['uniqueid']]={'routeId':_0x2e9e8b[_0xfa0e('0x1a')]};}}catch(_0x5a613c){utils['error'](util['format'](_0xfa0e('0x1b'),_0x2e9e8b[_0xfa0e('0x4')]),_0x5a613c);}};exports[_0xfa0e('0x1c')]=function(_0x3c8e7e){try{if(!_[_0xfa0e('0x17')](dials[_0x3c8e7e[_0xfa0e('0x4')]])){utils['debug'](util[_0xfa0e('0x3')]('[%s][dials][dialbegin]',_0x3c8e7e['uniqueid']),_0x3c8e7e);dials[_0x3c8e7e['uniqueid']]=_['assign'](dials[_0x3c8e7e['uniqueid']],_0x3c8e7e);dials[_0x3c8e7e[_0xfa0e('0x4')]][_0xfa0e('0x1d')]=utils[_0xfa0e('0x1e')]();dials[_0x3c8e7e[_0xfa0e('0x4')]][_0xfa0e('0x1f')]=_0xfa0e('0x20');utils[_0xfa0e('0x2')](util['format'](_0xfa0e('0x21'),_0x3c8e7e['uniqueid'],dials[_0x3c8e7e[_0xfa0e('0x4')]][_0xfa0e('0x1d')]));}}catch(_0x5e7e9a){utils[_0xfa0e('0x15')](util[_0xfa0e('0x3')](_0xfa0e('0x22'),_0x3c8e7e[_0xfa0e('0x4')]),_0x5e7e9a);}};exports[_0xfa0e('0x23')]=function(_0x10b7f6){try{if(!_[_0xfa0e('0x17')](dials[_0x10b7f6[_0xfa0e('0x4')]])){utils[_0xfa0e('0xb')](util['format']('[%s][dials][dialend]',_0x10b7f6['uniqueid']),_0x10b7f6);dials[_0x10b7f6[_0xfa0e('0x4')]][_0xfa0e('0x7')]=_0x10b7f6[_0xfa0e('0x7')];if(_0x10b7f6['dialstatus']==_0xfa0e('0x24')){dials[_0x10b7f6['uniqueid']]=_['assign'](dials[_0x10b7f6[_0xfa0e('0x4')]],_0x10b7f6);dials[_0x10b7f6[_0xfa0e('0x4')]][_0xfa0e('0x25')]=utils[_0xfa0e('0x1e')]();dials[_0x10b7f6[_0xfa0e('0x4')]]['lastevent']=_0xfa0e('0x26');utils[_0xfa0e('0x2')](util['format'](_0xfa0e('0x27'),_0x10b7f6['uniqueid'],_0x10b7f6[_0xfa0e('0x7')],dials[_0x10b7f6[_0xfa0e('0x4')]][_0xfa0e('0x25')]));}else{utils[_0xfa0e('0x2')](util[_0xfa0e('0x3')](_0xfa0e('0x28'),_0x10b7f6['uniqueid'],_0x10b7f6[_0xfa0e('0x7')]));}}}catch(_0x3cf656){utils[_0xfa0e('0x15')](util[_0xfa0e('0x3')]('[%s][dials][dialend]',_0x10b7f6[_0xfa0e('0x4')]),_0x3cf656);}};exports['hangup']=function(_0x4d2b63){try{if(!_[_0xfa0e('0x17')](dials[_0x4d2b63['uniqueid']])){utils['debug'](util[_0xfa0e('0x3')]('[%s][dials][hangup]',_0x4d2b63[_0xfa0e('0x4')]),_0x4d2b63);utils[_0xfa0e('0x2')](util[_0xfa0e('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4d2b63[_0xfa0e('0x4')],_0x4d2b63[_0xfa0e('0x29')],_0x4d2b63[_0xfa0e('0x2a')],_0x4d2b63[_0xfa0e('0x2b')]));dials[_0x4d2b63[_0xfa0e('0x4')]]=_[_0xfa0e('0x2c')](dials[_0x4d2b63[_0xfa0e('0x4')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x4d2b63[_0xfa0e('0x4')]]['duration']=utils[_0xfa0e('0x2d')](dials[_0x4d2b63[_0xfa0e('0x4')]]['endtime'],dials[_0x4d2b63[_0xfa0e('0x4')]][_0xfa0e('0x1d')]);dials[_0x4d2b63['uniqueid']][_0xfa0e('0x2e')]=utils[_0xfa0e('0x2d')](dials[_0x4d2b63['uniqueid']][_0xfa0e('0x25')]||dials[_0x4d2b63[_0xfa0e('0x4')]][_0xfa0e('0x2f')],dials[_0x4d2b63[_0xfa0e('0x4')]][_0xfa0e('0x1d')]);dials[_0x4d2b63[_0xfa0e('0x4')]][_0xfa0e('0x30')]=dials[_0x4d2b63[_0xfa0e('0x4')]][_0xfa0e('0x25')]?utils[_0xfa0e('0x2d')](dials[_0x4d2b63[_0xfa0e('0x4')]]['endtime'],dials[_0x4d2b63[_0xfa0e('0x4')]][_0xfa0e('0x25')]):0x0;writeDB(dials[_0x4d2b63[_0xfa0e('0x4')]]);}}catch(_0xfda822){utils[_0xfa0e('0x15')](util['format'](_0xfa0e('0x31'),_0x4d2b63['uniqueid']),_0xfda822);}}; \ No newline at end of file +var _0x94f0=['[%s][dials][dialbegin]','starttime','now','called','dialend','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','[%s][dials][hangup]','lodash','util','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','format','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin'];(function(_0x176a61,_0x451421){var _0xa3aedd=function(_0x5d26ab){while(--_0x5d26ab){_0x176a61['push'](_0x176a61['shift']());}};_0xa3aedd(++_0x451421);}(_0x94f0,0xae));var _0x094f=function(_0x47b99a,_0x5719f9){_0x47b99a=_0x47b99a-0x0;var _0x47aa79=_0x94f0[_0x47b99a];return _0x47aa79;};'use strict';var _=require(_0x094f('0x0'));var util=require(_0x094f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x37d26e){utils[_0x094f('0x2')](util['format'](_0x094f('0x3'),_0x37d26e['uniqueid'],_0x37d26e[_0x094f('0x4')],_0x37d26e['dialstring'],_0x37d26e[_0x094f('0x5')],_0x37d26e['connectedlinenum'],_0x37d26e[_0x094f('0x6')]));utils[_0x094f('0x7')](_0x094f('0x8'),_0x37d26e);delete dials[_0x37d26e[_0x094f('0x9')]];}exports[_0x094f('0xa')]=function(_0x56af58){try{utils[_0x094f('0xb')](util['format']('[%s][dials][newexten]',_0x56af58[_0x094f('0x9')]),_0x56af58);utils[_0x094f('0x2')](util['format'](_0x094f('0xc'),_0x56af58[_0x094f('0x9')],_0x56af58[_0x094f('0xd')],_0x56af58[_0x094f('0xe')]));if(_0x56af58[_0x094f('0xd')][_0x094f('0xf')]()==_0x094f('0x10')&&_[_0x094f('0x11')](_0x56af58[_0x094f('0xe')][_0x094f('0xf')](),'cdr(routeid)')){var _0x444bbb=_0x56af58['appdata'][_0x094f('0x12')]('=');dials[_0x56af58[_0x094f('0x9')]]={'routeId':_0x444bbb[0x1]};}}catch(_0x463327){utils[_0x094f('0x13')](util[_0x094f('0x14')](_0x094f('0x15'),_0x56af58[_0x094f('0x9')]),_0x463327);}};exports[_0x094f('0x16')]=function(_0x16f660){try{utils[_0x094f('0xb')](util[_0x094f('0x14')](_0x094f('0x17'),_0x16f660[_0x094f('0x9')]),_0x16f660);if(!_[_0x094f('0x18')](_0x16f660[_0x094f('0x19')][_0x094f('0x1a')])){utils['info'](util[_0x094f('0x14')](_0x094f('0x1b'),_0x16f660[_0x094f('0x9')],_0x16f660[_0x094f('0x1c')]));dials[_0x16f660[_0x094f('0x9')]]={'routeId':_0x16f660[_0x094f('0x1c')]};}}catch(_0x4408ac){utils[_0x094f('0x13')](util['format'](_0x094f('0x17'),_0x16f660['uniqueid']),_0x4408ac);}};exports[_0x094f('0x1d')]=function(_0x4e7e2a){try{if(!_[_0x094f('0x18')](dials[_0x4e7e2a[_0x094f('0x9')]])){utils[_0x094f('0xb')](util['format'](_0x094f('0x1e'),_0x4e7e2a[_0x094f('0x9')]),_0x4e7e2a);dials[_0x4e7e2a[_0x094f('0x9')]]=_['assign'](dials[_0x4e7e2a['uniqueid']],_0x4e7e2a);dials[_0x4e7e2a[_0x094f('0x9')]][_0x094f('0x1f')]=utils[_0x094f('0x20')]();dials[_0x4e7e2a[_0x094f('0x9')]]['lastevent']=_0x094f('0x21');utils[_0x094f('0x2')](util[_0x094f('0x14')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4e7e2a[_0x094f('0x9')],dials[_0x4e7e2a[_0x094f('0x9')]][_0x094f('0x1f')]));}}catch(_0x4cc4f0){utils[_0x094f('0x13')](util[_0x094f('0x14')](_0x094f('0x1e'),_0x4e7e2a[_0x094f('0x9')]),_0x4cc4f0);}};exports[_0x094f('0x22')]=function(_0x14d1e4){try{if(!_['isNil'](dials[_0x14d1e4['uniqueid']])){utils[_0x094f('0xb')](util[_0x094f('0x14')]('[%s][dials][dialend]',_0x14d1e4[_0x094f('0x9')]),_0x14d1e4);dials[_0x14d1e4[_0x094f('0x9')]][_0x094f('0x6')]=_0x14d1e4['dialstatus'];if(_0x14d1e4[_0x094f('0x6')]==_0x094f('0x23')){dials[_0x14d1e4['uniqueid']]=_[_0x094f('0x24')](dials[_0x14d1e4[_0x094f('0x9')]],_0x14d1e4);dials[_0x14d1e4[_0x094f('0x9')]][_0x094f('0x25')]=utils['now']();dials[_0x14d1e4[_0x094f('0x9')]]['lastevent']=_0x094f('0x26');utils[_0x094f('0x2')](util[_0x094f('0x14')](_0x094f('0x27'),_0x14d1e4[_0x094f('0x9')],_0x14d1e4[_0x094f('0x6')],dials[_0x14d1e4[_0x094f('0x9')]][_0x094f('0x25')]));}else{utils['info'](util['format'](_0x094f('0x28'),_0x14d1e4[_0x094f('0x9')],_0x14d1e4[_0x094f('0x6')]));}}}catch(_0x13c468){utils['error'](util[_0x094f('0x14')]('[%s][dials][dialend]',_0x14d1e4['uniqueid']),_0x13c468);}};exports[_0x094f('0x29')]=function(_0x4db937){try{if(!_['isNil'](dials[_0x4db937[_0x094f('0x9')]])){utils['debug'](util[_0x094f('0x14')]('[%s][dials][hangup]',_0x4db937[_0x094f('0x9')]),_0x4db937);utils['info'](util[_0x094f('0x14')](_0x094f('0x2a'),_0x4db937[_0x094f('0x9')],_0x4db937[_0x094f('0x5')],_0x4db937[_0x094f('0x2b')],_0x4db937[_0x094f('0x2c')]));dials[_0x4db937['uniqueid']]=_[_0x094f('0x24')](dials[_0x4db937['uniqueid']],{'endtime':utils[_0x094f('0x20')](),'lastevent':_0x094f('0x2d')});dials[_0x4db937['uniqueid']][_0x094f('0x2e')]=utils[_0x094f('0x2f')](dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x30')],dials[_0x4db937[_0x094f('0x9')]]['starttime']);dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x31')]=utils[_0x094f('0x2f')](dials[_0x4db937['uniqueid']]['answertime']||dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x30')],dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x1f')]);dials[_0x4db937[_0x094f('0x9')]]['billableseconds']=dials[_0x4db937[_0x094f('0x9')]]['answertime']?utils[_0x094f('0x2f')](dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x30')],dials[_0x4db937[_0x094f('0x9')]][_0x094f('0x25')]):0x0;writeDB(dials[_0x4db937['uniqueid']]);}}catch(_0x3c6d40){utils[_0x094f('0x13')](util[_0x094f('0x14')](_0x094f('0x32'),_0x4db937[_0x094f('0x9')]),_0x3c6d40);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 83044a0..1019f4e 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 _0x587c=['hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','./utils','util','disabled','xdr','env','production','local','asterisk','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','debug','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]'];(function(_0x38b9fd,_0x263607){var _0xbb6a98=function(_0x388bd7){while(--_0x388bd7){_0x38b9fd['push'](_0x38b9fd['shift']());}};_0xbb6a98(++_0x263607);}(_0x587c,0x1e7));var _0xc587=function(_0xa76208,_0xd46fa0){_0xa76208=_0xa76208-0x0;var _0x17ff8c=_0x587c[_0xa76208];return _0x17ff8c;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xc587('0x0'));var util=require(_0xc587('0x1'));var isXDREnabled=config['xdr']&&config['xdr'][_0xc587('0x2')]?!config[_0xc587('0x3')][_0xc587('0x2')]:!![];var isProduction=config[_0xc587('0x4')]===_0xc587('0x5')||![];var isLocalAsterisk=config[_0xc587('0x3')]&&config[_0xc587('0x3')][_0xc587('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0xc587('0x7')]['ip'],config['asterisk']['username'],config[_0xc587('0x7')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xc587('0x8')](_0xc587('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xc587('0x8')](_0xc587('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0xc587('0xb'));var queues=require(_0xc587('0xc'));var recordings=require('./recordings.controller');var members=require(_0xc587('0xd'));var dials=require('./dials.controller');var transfers=require(_0xc587('0xe'));var core=require(_0xc587('0xf'));ami['on'](_0xc587('0x10'),core['connect']);ami['on'](_0xc587('0x11'),core[_0xc587('0x11')]);ami['on'](_0xc587('0x12'),core[_0xc587('0x12')]);ami['on'](_0xc587('0x13'),core[_0xc587('0x13')]);ami['on'](_0xc587('0x14'),core[_0xc587('0x14')]);ami['on'](_0xc587('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0x2e1b69){try{utils['debug'](util[_0xc587('0x16')]('[%s][index][devicestatechange]',_0x2e1b69[_0xc587('0x17')]),_0x2e1b69);members[_0xc587('0x18')](_0x2e1b69);}catch(_0x5058cf){utils['error'](util['format'](_0xc587('0x19'),_0x2e1b69[_0xc587('0x17')]),_0x5058cf);}});ami['on'](_0xc587('0x1a'),function(_0x580ada){try{utils[_0xc587('0x1b')](util['format']('[%s][index][agentcalled]',_0x580ada[_0xc587('0x1c')]),_0x580ada);agents[_0xc587('0x1a')](_0x580ada);}catch(_0x19427f){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x1d'),_0x580ada[_0xc587('0x1c')]),_0x19427f);}});ami['on'](_0xc587('0x1e'),function(_0x406dad){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')]('[%s][index][agentringnoanswer]',_0x406dad[_0xc587('0x1c')]),_0x406dad);agents[_0xc587('0x1e')](_0x406dad);}catch(_0x10d46d){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x1f'),_0x406dad[_0xc587('0x1c')]),_0x10d46d);}});ami['on']('agentconnect',function(_0x44afe0){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x20'),_0x44afe0['uniqueid']),_0x44afe0);agents[_0xc587('0x21')](_0x44afe0);queues['agentconnect'](_0x44afe0);}catch(_0x2fbb8d){utils[_0xc587('0x13')](util['format'](_0xc587('0x20'),_0x44afe0[_0xc587('0x1c')]),_0x2fbb8d);}});ami['on'](_0xc587('0x22'),function(_0x4e56eb){try{utils['debug'](util[_0xc587('0x16')](_0xc587('0x23'),_0x4e56eb[_0xc587('0x1c')]),_0x4e56eb);agents[_0xc587('0x22')](_0x4e56eb);queues[_0xc587('0x22')](_0x4e56eb);members['agentcomplete'](_0x4e56eb);}catch(_0x2cb508){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x23'),_0x4e56eb['uniqueid']),_0x2cb508);}});ami['on'](_0xc587('0x24'),function(_0x370cf9){try{utils['debug'](util[_0xc587('0x16')](_0xc587('0x25'),_0x370cf9['uniqueid']),_0x370cf9);agents['queuecallerabandon'](_0x370cf9);queues[_0xc587('0x24')](_0x370cf9);}catch(_0x535498){utils[_0xc587('0x13')](util[_0xc587('0x16')]('[%s][index][queuecallerabandon]',_0x370cf9[_0xc587('0x1c')]),_0x535498);}});ami['on'](_0xc587('0x26'),function(_0x25e0cb){try{utils['debug'](util[_0xc587('0x16')](_0xc587('0x27'),_0x25e0cb[_0xc587('0x1c')]),_0x25e0cb);queues[_0xc587('0x26')](_0x25e0cb);recordings['queuecallerjoin'](_0x25e0cb);}catch(_0x19d74d){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x27'),_0x25e0cb['uniqueid']),_0x19d74d);}});ami['on'](_0xc587('0x28'),function(_0xb18201){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x29'),_0xb18201[_0xc587('0x1c')]),_0xb18201);queues[_0xc587('0x28')](_0xb18201);}catch(_0x183cae){utils[_0xc587('0x13')](util[_0xc587('0x16')]('[%s][index][queuecallerleave]',_0xb18201['uniqueid']),_0x183cae);}});ami['on'](_0xc587('0x2a'),function(_0x13eb9c){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')]('[%s][index][musiconholdstart]',_0x13eb9c['uniqueid']),_0x13eb9c);queues[_0xc587('0x2a')](_0x13eb9c);calls[_0xc587('0x2a')](_0x13eb9c);}catch(_0x228d45){utils[_0xc587('0x13')](util['format'](_0xc587('0x2b'),_0x13eb9c['uniqueid']),_0x228d45);}});ami['on'](_0xc587('0x2c'),function(_0x19bd8a){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x2d'),_0x19bd8a[_0xc587('0x1c')]),_0x19bd8a);queues['musiconholdstop'](_0x19bd8a);calls[_0xc587('0x2c')](_0x19bd8a);}catch(_0x3bbe39){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x2d'),_0x19bd8a['uniqueid']),_0x3bbe39);}});ami['on'](_0xc587('0x2e'),function(_0x37f77e){try{utils['debug'](util[_0xc587('0x16')](_0xc587('0x2f'),_0x37f77e[_0xc587('0x1c')]),_0x37f77e);calls[_0xc587('0x2e')](_0x37f77e);recordings['newstate'](_0x37f77e);}catch(_0x1251bd){utils['error'](util[_0xc587('0x16')](_0xc587('0x2f'),_0x37f77e[_0xc587('0x1c')]),_0x1251bd);}});ami['on']('hangup',function(_0x34c829){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x30'),_0x34c829[_0xc587('0x1c')]),_0x34c829);calls['hangup'](_0x34c829);recordings['hangup'](_0x34c829);dials[_0xc587('0x31')](_0x34c829);agents['hangup'](_0x34c829);queues[_0xc587('0x31')](_0x34c829);}catch(_0x33e657){utils['error'](util[_0xc587('0x16')]('[%s][index][hangup]',_0x34c829[_0xc587('0x1c')]),_0x33e657);}});ami['on'](_0xc587('0x32'),function(_0x5d3ff2){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x33'),_0x5d3ff2[_0xc587('0x1c')]),_0x5d3ff2);members[_0xc587('0x32')](_0x5d3ff2);}catch(_0x27922b){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x33'),_0x5d3ff2[_0xc587('0x1c')]),_0x27922b);}});ami['on']('blindtransfer',function(_0x243222){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x34'),_0x243222[_0xc587('0x1c')]),_0x243222);queues[_0xc587('0x35')](_0x243222);agents[_0xc587('0x35')](_0x243222);transfers['blindtransfer'](_0x243222);}catch(_0x308426){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x34'),_0x243222[_0xc587('0x1c')]),_0x308426);}});ami['on'](_0xc587('0x36'),function(_0x229479){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')]('[%s][index][attendedtransfer]',_0x229479[_0xc587('0x37')]),_0x229479);queues[_0xc587('0x36')](_0x229479);transfers['attendedtransfer'](_0x229479);agents[_0xc587('0x36')](_0x229479);calls[_0xc587('0x36')](_0x229479);}catch(_0x5ef9cf){utils['error'](util[_0xc587('0x16')](_0xc587('0x38'),_0x229479[_0xc587('0x37')]),_0x5ef9cf);}});ami['on']('varset',function(_0x1d08f6){try{utils['debug'](util[_0xc587('0x16')]('[%s][index][varset]',_0x1d08f6[_0xc587('0x1c')]),_0x1d08f6);queues[_0xc587('0x39')](_0x1d08f6);recordings['varset'](_0x1d08f6);calls[_0xc587('0x39')](_0x1d08f6);dials['varset'](_0x1d08f6);}catch(_0x3c4aaf){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x3a'),_0x1d08f6['uniqueid']),_0x3c4aaf);}});ami['on']('newexten',function(_0x402d80){try{utils[_0xc587('0x1b')](util[_0xc587('0x16')](_0xc587('0x3b'),_0x402d80[_0xc587('0x1c')]),_0x402d80);calls[_0xc587('0x3c')](_0x402d80);recordings['newexten'](_0x402d80);dials['newexten'](_0x402d80);}catch(_0x4a9521){utils['error'](util['format']('[%s][index][newexten]',_0x402d80[_0xc587('0x1c')]),_0x4a9521);}});ami['on']('newchannel',function(_0x2e9549){try{utils[_0xc587('0x1b')](util['format']('[%s][index][newchannel]',_0x2e9549[_0xc587('0x1c')]),_0x2e9549);calls[_0xc587('0x3d')](_0x2e9549);recordings[_0xc587('0x3d')](_0x2e9549);}catch(_0x8393b2){utils[_0xc587('0x13')](util[_0xc587('0x16')](_0xc587('0x3e'),_0x2e9549[_0xc587('0x1c')]),_0x8393b2);}});ami['on'](_0xc587('0x3f'),function(_0x59001a){try{utils[_0xc587('0x1b')](util['format']('[%s][index][dialbegin]',_0x59001a['uniqueid']),_0x59001a);dials[_0xc587('0x3f')](_0x59001a);}catch(_0x1ecca5){utils[_0xc587('0x13')](util['format'](_0xc587('0x40'),_0x59001a[_0xc587('0x1c')]),_0x1ecca5);}});ami['on']('dialend',function(_0x2797df){try{utils[_0xc587('0x1b')](util['format'](_0xc587('0x41'),_0x2797df['uniqueid']),_0x2797df);dials[_0xc587('0x42')](_0x2797df);}catch(_0xb79619){utils[_0xc587('0x13')](util['format'](_0xc587('0x41'),_0x2797df['uniqueid']),_0xb79619);}});} \ No newline at end of file +var _0x7865=['uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','xdr','disabled','production','asterisk','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','format','device','debug'];(function(_0x2ea93c,_0x571de5){var _0xf0070f=function(_0x2bb51e){while(--_0x2bb51e){_0x2ea93c['push'](_0x2ea93c['shift']());}};_0xf0070f(++_0x571de5);}(_0x7865,0x166));var _0x5786=function(_0x1d1a87,_0x51d145){_0x1d1a87=_0x1d1a87-0x0;var _0x142f90=_0x7865[_0x1d1a87];return _0x142f90;};var AsteriskManager=require(_0x5786('0x0'));var config=require('../../config/environment');var utils=require(_0x5786('0x1'));var util=require('util');var isXDREnabled=config[_0x5786('0x2')]&&config[_0x5786('0x2')]['disabled']?!config[_0x5786('0x2')][_0x5786('0x3')]:!![];var isProduction=config['env']===_0x5786('0x4')||![];var isLocalAsterisk=config['xdr']&&config[_0x5786('0x2')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x5786('0x5')]['port'],config['asterisk']['ip'],config[_0x5786('0x5')]['username'],config[_0x5786('0x5')][_0x5786('0x6')],!![]);ami[_0x5786('0x7')]();if(!isXDREnabled){utils['info'](_0x5786('0x8'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5786('0x9')](_0x5786('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x5786('0xb'));var queues=require(_0x5786('0xc'));var recordings=require('./recordings.controller');var members=require(_0x5786('0xd'));var dials=require(_0x5786('0xe'));var transfers=require(_0x5786('0xf'));var core=require(_0x5786('0x10'));ami['on'](_0x5786('0x11'),core[_0x5786('0x11')]);ami['on'](_0x5786('0x12'),core[_0x5786('0x12')]);ami['on']('fullybooted',core[_0x5786('0x13')]);ami['on']('error',core[_0x5786('0x14')]);ami['on'](_0x5786('0x15'),core[_0x5786('0x15')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x5786('0x16'),function(_0x486d25){try{utils['debug'](util[_0x5786('0x17')]('[%s][index][devicestatechange]',_0x486d25[_0x5786('0x18')]),_0x486d25);members[_0x5786('0x16')](_0x486d25);}catch(_0x159812){utils[_0x5786('0x14')](util['format']('[%s][index][devicestatechange]',_0x486d25['device']),_0x159812);}});ami['on']('agentcalled',function(_0x423b7e){try{utils[_0x5786('0x19')](util[_0x5786('0x17')]('[%s][index][agentcalled]',_0x423b7e[_0x5786('0x1a')]),_0x423b7e);agents[_0x5786('0x1b')](_0x423b7e);}catch(_0x1f8a85){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][agentcalled]',_0x423b7e[_0x5786('0x1a')]),_0x1f8a85);}});ami['on'](_0x5786('0x1c'),function(_0x45e480){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x1d'),_0x45e480[_0x5786('0x1a')]),_0x45e480);agents[_0x5786('0x1c')](_0x45e480);}catch(_0x481001){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x1d'),_0x45e480[_0x5786('0x1a')]),_0x481001);}});ami['on'](_0x5786('0x1e'),function(_0x576b20){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x1f'),_0x576b20[_0x5786('0x1a')]),_0x576b20);agents['agentconnect'](_0x576b20);queues[_0x5786('0x1e')](_0x576b20);}catch(_0x53b0af){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x1f'),_0x576b20[_0x5786('0x1a')]),_0x53b0af);}});ami['on'](_0x5786('0x20'),function(_0x427ef6){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x21'),_0x427ef6['uniqueid']),_0x427ef6);agents[_0x5786('0x20')](_0x427ef6);queues[_0x5786('0x20')](_0x427ef6);members[_0x5786('0x20')](_0x427ef6);}catch(_0x434e5d){utils[_0x5786('0x14')](util['format'](_0x5786('0x21'),_0x427ef6[_0x5786('0x1a')]),_0x434e5d);}});ami['on'](_0x5786('0x22'),function(_0x4db6f6){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x23'),_0x4db6f6[_0x5786('0x1a')]),_0x4db6f6);agents[_0x5786('0x22')](_0x4db6f6);queues[_0x5786('0x22')](_0x4db6f6);}catch(_0x26c9ca){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x23'),_0x4db6f6[_0x5786('0x1a')]),_0x26c9ca);}});ami['on']('queuecallerjoin',function(_0x1cfaf2){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x1cfaf2[_0x5786('0x1a')]),_0x1cfaf2);queues[_0x5786('0x24')](_0x1cfaf2);recordings[_0x5786('0x24')](_0x1cfaf2);}catch(_0x3159fc){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][queuecallerjoin]',_0x1cfaf2[_0x5786('0x1a')]),_0x3159fc);}});ami['on'](_0x5786('0x25'),function(_0x737a7d){try{utils['debug'](util[_0x5786('0x17')](_0x5786('0x26'),_0x737a7d[_0x5786('0x1a')]),_0x737a7d);queues['queuecallerleave'](_0x737a7d);}catch(_0x4a509d){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x26'),_0x737a7d[_0x5786('0x1a')]),_0x4a509d);}});ami['on'](_0x5786('0x27'),function(_0xd103e6){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x28'),_0xd103e6[_0x5786('0x1a')]),_0xd103e6);queues['musiconholdstart'](_0xd103e6);calls['musiconholdstart'](_0xd103e6);}catch(_0x247206){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][musiconholdstart]',_0xd103e6[_0x5786('0x1a')]),_0x247206);}});ami['on'](_0x5786('0x29'),function(_0x2edf92){try{utils[_0x5786('0x19')](util[_0x5786('0x17')]('[%s][index][musiconholdstop]',_0x2edf92[_0x5786('0x1a')]),_0x2edf92);queues[_0x5786('0x29')](_0x2edf92);calls[_0x5786('0x29')](_0x2edf92);}catch(_0x5bff20){utils[_0x5786('0x14')](util['format'](_0x5786('0x2a'),_0x2edf92[_0x5786('0x1a')]),_0x5bff20);}});ami['on'](_0x5786('0x2b'),function(_0x629f4){try{utils['debug'](util[_0x5786('0x17')](_0x5786('0x2c'),_0x629f4['uniqueid']),_0x629f4);calls[_0x5786('0x2b')](_0x629f4);recordings[_0x5786('0x2b')](_0x629f4);}catch(_0x7d7703){utils['error'](util[_0x5786('0x17')](_0x5786('0x2c'),_0x629f4[_0x5786('0x1a')]),_0x7d7703);}});ami['on'](_0x5786('0x2d'),function(_0x59ec38){try{utils[_0x5786('0x19')](util['format'](_0x5786('0x2e'),_0x59ec38[_0x5786('0x1a')]),_0x59ec38);calls['hangup'](_0x59ec38);recordings[_0x5786('0x2d')](_0x59ec38);dials[_0x5786('0x2d')](_0x59ec38);agents[_0x5786('0x2d')](_0x59ec38);queues[_0x5786('0x2d')](_0x59ec38);}catch(_0x3af329){utils['error'](util[_0x5786('0x17')](_0x5786('0x2e'),_0x59ec38[_0x5786('0x1a')]),_0x3af329);}});ami['on'](_0x5786('0x2f'),function(_0x4e30c1){try{utils['debug'](util[_0x5786('0x17')](_0x5786('0x30'),_0x4e30c1['uniqueid']),_0x4e30c1);members[_0x5786('0x2f')](_0x4e30c1);}catch(_0x5df205){utils[_0x5786('0x14')](util['format'](_0x5786('0x30'),_0x4e30c1[_0x5786('0x1a')]),_0x5df205);}});ami['on'](_0x5786('0x31'),function(_0x4549a0){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x32'),_0x4549a0[_0x5786('0x1a')]),_0x4549a0);queues[_0x5786('0x31')](_0x4549a0);agents[_0x5786('0x31')](_0x4549a0);transfers['blindtransfer'](_0x4549a0);}catch(_0x3e8c7b){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x32'),_0x4549a0[_0x5786('0x1a')]),_0x3e8c7b);}});ami['on'](_0x5786('0x33'),function(_0x3ee999){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x34'),_0x3ee999['origtransfereruniqueid']),_0x3ee999);queues[_0x5786('0x33')](_0x3ee999);transfers[_0x5786('0x33')](_0x3ee999);agents[_0x5786('0x33')](_0x3ee999);calls[_0x5786('0x33')](_0x3ee999);}catch(_0x480664){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x34'),_0x3ee999[_0x5786('0x35')]),_0x480664);}});ami['on']('varset',function(_0x44c298){try{utils[_0x5786('0x19')](util['format'](_0x5786('0x36'),_0x44c298[_0x5786('0x1a')]),_0x44c298);queues['varset'](_0x44c298);recordings[_0x5786('0x37')](_0x44c298);calls['varset'](_0x44c298);dials[_0x5786('0x37')](_0x44c298);}catch(_0x222415){utils[_0x5786('0x14')](util['format'](_0x5786('0x36'),_0x44c298['uniqueid']),_0x222415);}});ami['on'](_0x5786('0x38'),function(_0x202096){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x39'),_0x202096['uniqueid']),_0x202096);calls['newexten'](_0x202096);recordings[_0x5786('0x38')](_0x202096);dials[_0x5786('0x38')](_0x202096);}catch(_0x16ca57){utils['error'](util[_0x5786('0x17')](_0x5786('0x39'),_0x202096[_0x5786('0x1a')]),_0x16ca57);}});ami['on']('newchannel',function(_0x1ff690){try{utils[_0x5786('0x19')](util[_0x5786('0x17')]('[%s][index][newchannel]',_0x1ff690[_0x5786('0x1a')]),_0x1ff690);calls[_0x5786('0x3a')](_0x1ff690);recordings[_0x5786('0x3a')](_0x1ff690);}catch(_0x584c98){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x3b'),_0x1ff690[_0x5786('0x1a')]),_0x584c98);}});ami['on']('dialbegin',function(_0x349d29){try{utils[_0x5786('0x19')](util[_0x5786('0x17')](_0x5786('0x3c'),_0x349d29[_0x5786('0x1a')]),_0x349d29);dials['dialbegin'](_0x349d29);}catch(_0x1cbd17){utils[_0x5786('0x14')](util[_0x5786('0x17')](_0x5786('0x3d'),_0x349d29['uniqueid']),_0x1cbd17);}});ami['on'](_0x5786('0x3e'),function(_0x1966b5){try{utils[_0x5786('0x19')](util['format'](_0x5786('0x3f'),_0x1966b5[_0x5786('0x1a')]),_0x1966b5);dials[_0x5786('0x3e')](_0x1966b5);}catch(_0x295ddd){utils[_0x5786('0x14')](util[_0x5786('0x17')]('[%s][index][dialend]',_0x1966b5[_0x5786('0x1a')]),_0x295ddd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7ae2af6..4ceaa66 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 _0x0879=['some','startsWith','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','[%s][members][cdr]','channel','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0879,0x1e9));var _0x9087=function(_0x547b5e,_0x1f8cfb){_0x547b5e=_0x547b5e-0x0;var _0x19a52f=_0x0879[_0x547b5e];return _0x19a52f;};'use strict';var _=require(_0x9087('0x0'));var util=require(_0x9087('0x1'));var utils=require('./utils');var members={};var exclude=[_0x9087('0x2'),_0x9087('0x3')];function writeDB(_0xcb07f0){utils['info'](util[_0x9087('0x4')](_0x9087('0x5'),_0xcb07f0[_0x9087('0x6')],_0xcb07f0[_0x9087('0x7')],_0xcb07f0['channel'],_0xcb07f0[_0x9087('0x8')],_0xcb07f0[_0x9087('0x9')],_0xcb07f0[_0x9087('0xa')]));if(_0xcb07f0[_0x9087('0x7')]){utils[_0x9087('0xb')](_0xcb07f0[_0x9087('0x7')])[_0x9087('0xc')](function(_0x5773ac){if(_0x5773ac){_0xcb07f0[_0x9087('0x9')]=_0x5773ac['name'];_0xcb07f0[_0x9087('0xd')]=_0x5773ac['internal'];utils['request'](_0x9087('0xe'),_0xcb07f0);}else{utils[_0x9087('0xf')](_0xcb07f0['interface'][_0x9087('0x10')]('/')[0x1])[_0x9087('0xc')](function(_0x922232){if(_0x922232){_0xcb07f0[_0x9087('0x9')]=_0x922232['name'];_0xcb07f0[_0x9087('0xd')]=_0x922232[_0x9087('0xd')];utils[_0x9087('0x11')]('CreateMemberReport',_0xcb07f0);}});}})[_0x9087('0x12')](function(_0x2a4b52){utils[_0x9087('0x13')](util['format'](_0x9087('0x14'),_0xcb07f0[_0x9087('0x6')]),_0x2a4b52);});}delete members[_0xcb07f0[_0x9087('0x7')]];}function startsWith(_0x1e52c7,_0x48192d){return _[_0x9087('0x15')](_0x1e52c7,function(_0x144521){return _[_0x9087('0x16')](_0x48192d,_0x144521);});}exports['devicestatechange']=function(_0x364d17){try{utils['debug'](util['format'](_0x9087('0x17'),members[_0x364d17['device']]?members[_0x364d17[_0x9087('0x18')]][_0x9087('0x6')]:_0x364d17[_0x9087('0x18')]),_0x364d17);utils[_0x9087('0x19')](util[_0x9087('0x4')](_0x9087('0x1a'),members[_0x364d17[_0x9087('0x18')]]?members[_0x364d17[_0x9087('0x18')]]['uniqueid']:_0x364d17['device'],_0x364d17[_0x9087('0x1b')],_0x364d17[_0x9087('0x18')]));switch(_0x364d17[_0x9087('0x1b')]){case _0x9087('0x1c'):case _0x9087('0x1d'):if(!startsWith(exclude,_0x364d17[_0x9087('0x18')])){members[_0x364d17['device']]={'channel':_0x9087('0x1e'),'interface':_0x364d17['device'],'type':_0x9087('0x1f'),'enterAt':utils[_0x9087('0x20')](),'role':_0x9087('0x21')};}break;case _0x9087('0x22'):if(!_[_0x9087('0x23')](members[_0x364d17['device']])){members[_0x364d17[_0x9087('0x18')]][_0x9087('0x24')]=utils[_0x9087('0x20')]();members[_0x364d17[_0x9087('0x18')]]['duration']=utils[_0x9087('0x25')](members[_0x364d17['device']][_0x9087('0x24')],members[_0x364d17[_0x9087('0x18')]][_0x9087('0x26')]);if(members[_0x364d17[_0x9087('0x18')]][_0x9087('0x6')]){writeDB(members[_0x364d17['device']]);}}break;default:break;}}catch(_0xd5cc4f){utils[_0x9087('0x13')](util['format'](_0x9087('0x17'),members[_0x364d17[_0x9087('0x18')]]?members[_0x364d17[_0x9087('0x18')]][_0x9087('0x6')]:_0x364d17[_0x9087('0x18')]),_0xd5cc4f);}};exports[_0x9087('0x27')]=function(_0x306386){try{if(!_[_0x9087('0x23')](members[_0x306386['interface']])){utils[_0x9087('0x28')](util[_0x9087('0x4')]('[%s][members][agentcomplete]',_0x306386[_0x9087('0x6')]),_0x306386);utils[_0x9087('0x19')](util['format'](_0x9087('0x29'),_0x306386['uniqueid'],_0x306386[_0x9087('0x7')],_0x306386['queue']));members[_0x306386[_0x9087('0x7')]]=_['assign'](members[_0x306386[_0x9087('0x7')]],{'data4':_0x306386['queue'],'uniqueid':_0x306386[_0x9087('0x6')]});}}catch(_0x4aa9b2){utils['error'](util[_0x9087('0x4')]('[%s][members][agentcomplete]',_0x306386[_0x9087('0x6')]),_0x4aa9b2);}};exports['cdr']=function(_0x44607d){try{utils['debug'](util['format'](_0x9087('0x2a'),_0x44607d[_0x9087('0x6')]),_0x44607d);if(_0x44607d[_0x9087('0x2b')]){var _0x293e4c=_0x44607d[_0x9087('0x2b')]['split']('-')[0x0];if(!_['isNil'](members[_0x293e4c])){members[_0x293e4c]=_[_0x9087('0x2c')](members[_0x293e4c],{'data1':members[_0x293e4c][_0x9087('0x2d')]||_0x44607d[_0x9087('0xa')],'data2':members[_0x293e4c][_0x9087('0x8')]||_0x44607d[_0x9087('0x2e')],'data3':members[_0x293e4c][_0x9087('0x2f')]||_0x44607d[_0x9087('0x30')],'uniqueid':members[_0x293e4c][_0x9087('0x6')]||_0x44607d['uniqueid']});utils[_0x9087('0x19')](util['format'](_0x9087('0x31'),_0x44607d[_0x9087('0x6')],members[_0x293e4c]['data1'],members[_0x293e4c][_0x9087('0x8')],members[_0x293e4c][_0x9087('0x2f')]));if(members[_0x293e4c][_0x9087('0x24')]){writeDB(members[_0x293e4c]);}}}if(_0x44607d[_0x9087('0x32')]){var _0x54fdf3=_0x44607d[_0x9087('0x32')]['split']('-')[0x0];if(!_[_0x9087('0x23')](members[_0x54fdf3])){members[_0x54fdf3]=_[_0x9087('0x2c')](members[_0x54fdf3],{'data1':members[_0x54fdf3][_0x9087('0x2d')]||_0x44607d[_0x9087('0xa')],'data2':members[_0x54fdf3][_0x9087('0x8')]||_0x44607d['source'],'data3':members[_0x54fdf3][_0x9087('0x2f')]||_0x44607d['destination'],'uniqueid':members[_0x54fdf3]['uniqueid']||_0x44607d['uniqueid']});utils[_0x9087('0x19')](util[_0x9087('0x4')](_0x9087('0x31'),_0x44607d[_0x9087('0x6')],members[_0x54fdf3][_0x9087('0x2d')],members[_0x54fdf3][_0x9087('0x8')],members[_0x54fdf3][_0x9087('0x2f')]));if(members[_0x54fdf3]['exitAt']){writeDB(members[_0x54fdf3]);}}}}catch(_0x5af51b){utils[_0x9087('0x13')](util[_0x9087('0x4')](_0x9087('0x2a'),_0x44607d[_0x9087('0x6')]),_0x5af51b);}}; \ No newline at end of file +var _0xe650=['./utils','Queue:','info','uniqueid','interface','channel','data2','membername','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','name','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','split','type','source','lodash','util'];(function(_0x6499bc,_0xf81042){var _0x39d373=function(_0xbf0d99){while(--_0xbf0d99){_0x6499bc['push'](_0x6499bc['shift']());}};_0x39d373(++_0xf81042);}(_0xe650,0xfd));var _0x0e65=function(_0x36e059,_0x19ee27){_0x36e059=_0x36e059-0x0;var _0x52ee13=_0xe650[_0x36e059];return _0x52ee13;};'use strict';var _=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var utils=require(_0x0e65('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x0e65('0x3')];function writeDB(_0xf80e84){utils[_0x0e65('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0xf80e84[_0x0e65('0x5')],_0xf80e84[_0x0e65('0x6')],_0xf80e84[_0x0e65('0x7')],_0xf80e84[_0x0e65('0x8')],_0xf80e84[_0x0e65('0x9')],_0xf80e84['type']));if(_0xf80e84[_0x0e65('0x6')]){utils[_0x0e65('0xa')](_0xf80e84[_0x0e65('0x6')])[_0x0e65('0xb')](function(_0x10b833){if(_0x10b833){_0xf80e84['membername']=_0x10b833['name'];_0xf80e84[_0x0e65('0xc')]=_0x10b833[_0x0e65('0xc')];utils[_0x0e65('0xd')](_0x0e65('0xe'),_0xf80e84);}else{utils[_0x0e65('0xf')](_0xf80e84[_0x0e65('0x6')]['split']('/')[0x1])[_0x0e65('0xb')](function(_0x29b1fb){if(_0x29b1fb){_0xf80e84[_0x0e65('0x9')]=_0x29b1fb[_0x0e65('0x10')];_0xf80e84[_0x0e65('0xc')]=_0x29b1fb[_0x0e65('0xc')];utils[_0x0e65('0xd')](_0x0e65('0xe'),_0xf80e84);}});}})['catch'](function(_0x545844){utils[_0x0e65('0x11')](util[_0x0e65('0x12')](_0x0e65('0x13'),_0xf80e84[_0x0e65('0x5')]),_0x545844);});}delete members[_0xf80e84[_0x0e65('0x6')]];}function startsWith(_0x23e22b,_0x19d095){return _[_0x0e65('0x14')](_0x23e22b,function(_0x58dc35){return _[_0x0e65('0x15')](_0x19d095,_0x58dc35);});}exports[_0x0e65('0x16')]=function(_0x149688){try{utils[_0x0e65('0x17')](util[_0x0e65('0x12')](_0x0e65('0x18'),members[_0x149688[_0x0e65('0x19')]]?members[_0x149688['device']][_0x0e65('0x5')]:_0x149688[_0x0e65('0x19')]),_0x149688);utils[_0x0e65('0x4')](util[_0x0e65('0x12')](_0x0e65('0x1a'),members[_0x149688[_0x0e65('0x19')]]?members[_0x149688['device']][_0x0e65('0x5')]:_0x149688[_0x0e65('0x19')],_0x149688[_0x0e65('0x1b')],_0x149688[_0x0e65('0x19')]));switch(_0x149688[_0x0e65('0x1b')]){case'INUSE':case _0x0e65('0x1c'):if(!startsWith(exclude,_0x149688['device'])){members[_0x149688['device']]={'channel':'voice','interface':_0x149688['device'],'type':_0x0e65('0x1d'),'enterAt':utils[_0x0e65('0x1e')](),'role':_0x0e65('0x1f')};}break;case _0x0e65('0x20'):if(!_[_0x0e65('0x21')](members[_0x149688[_0x0e65('0x19')]])){members[_0x149688[_0x0e65('0x19')]]['exitAt']=utils[_0x0e65('0x1e')]();members[_0x149688[_0x0e65('0x19')]][_0x0e65('0x22')]=utils[_0x0e65('0x23')](members[_0x149688['device']][_0x0e65('0x24')],members[_0x149688['device']][_0x0e65('0x25')]);if(members[_0x149688[_0x0e65('0x19')]][_0x0e65('0x5')]){writeDB(members[_0x149688[_0x0e65('0x19')]]);}}break;default:break;}}catch(_0xaa601){utils[_0x0e65('0x11')](util['format'](_0x0e65('0x18'),members[_0x149688[_0x0e65('0x19')]]?members[_0x149688[_0x0e65('0x19')]]['uniqueid']:_0x149688[_0x0e65('0x19')]),_0xaa601);}};exports['agentcomplete']=function(_0x3e4cdf){try{if(!_[_0x0e65('0x21')](members[_0x3e4cdf[_0x0e65('0x6')]])){utils['debug'](util[_0x0e65('0x12')](_0x0e65('0x26'),_0x3e4cdf[_0x0e65('0x5')]),_0x3e4cdf);utils['info'](util[_0x0e65('0x12')](_0x0e65('0x27'),_0x3e4cdf[_0x0e65('0x5')],_0x3e4cdf[_0x0e65('0x6')],_0x3e4cdf[_0x0e65('0x28')]));members[_0x3e4cdf[_0x0e65('0x6')]]=_[_0x0e65('0x29')](members[_0x3e4cdf['interface']],{'data4':_0x3e4cdf[_0x0e65('0x28')],'uniqueid':_0x3e4cdf[_0x0e65('0x5')]});}}catch(_0x6d53f2){utils['error'](util[_0x0e65('0x12')](_0x0e65('0x26'),_0x3e4cdf[_0x0e65('0x5')]),_0x6d53f2);}};exports[_0x0e65('0x2a')]=function(_0x28c725){try{utils[_0x0e65('0x17')](util[_0x0e65('0x12')]('[%s][members][cdr]',_0x28c725[_0x0e65('0x5')]),_0x28c725);if(_0x28c725[_0x0e65('0x7')]){var _0x10a93a=_0x28c725[_0x0e65('0x7')]['split']('-')[0x0];if(!_[_0x0e65('0x21')](members[_0x10a93a])){members[_0x10a93a]=_[_0x0e65('0x29')](members[_0x10a93a],{'data1':members[_0x10a93a][_0x0e65('0x2b')]||_0x28c725['type'],'data2':members[_0x10a93a][_0x0e65('0x8')]||_0x28c725['source'],'data3':members[_0x10a93a]['data3']||_0x28c725[_0x0e65('0x2c')],'uniqueid':members[_0x10a93a][_0x0e65('0x5')]||_0x28c725[_0x0e65('0x5')]});utils[_0x0e65('0x4')](util[_0x0e65('0x12')](_0x0e65('0x2d'),_0x28c725[_0x0e65('0x5')],members[_0x10a93a][_0x0e65('0x2b')],members[_0x10a93a]['data2'],members[_0x10a93a][_0x0e65('0x2e')]));if(members[_0x10a93a]['exitAt']){writeDB(members[_0x10a93a]);}}}if(_0x28c725[_0x0e65('0x2f')]){var _0x55094c=_0x28c725[_0x0e65('0x2f')][_0x0e65('0x30')]('-')[0x0];if(!_[_0x0e65('0x21')](members[_0x55094c])){members[_0x55094c]=_[_0x0e65('0x29')](members[_0x55094c],{'data1':members[_0x55094c]['data1']||_0x28c725[_0x0e65('0x31')],'data2':members[_0x55094c]['data2']||_0x28c725[_0x0e65('0x32')],'data3':members[_0x55094c]['data3']||_0x28c725[_0x0e65('0x2c')],'uniqueid':members[_0x55094c][_0x0e65('0x5')]||_0x28c725[_0x0e65('0x5')]});utils[_0x0e65('0x4')](util[_0x0e65('0x12')](_0x0e65('0x2d'),_0x28c725[_0x0e65('0x5')],members[_0x55094c][_0x0e65('0x2b')],members[_0x55094c][_0x0e65('0x8')],members[_0x55094c][_0x0e65('0x2e')]));if(members[_0x55094c][_0x0e65('0x24')]){writeDB(members[_0x55094c]);}}}}catch(_0x573728){utils[_0x0e65('0x11')](util[_0x0e65('0x12')]('[%s][members][cdr]',_0x28c725[_0x0e65('0x5')]),_0x573728);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2535457..21bd08e 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 _0xd6a2=['info','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','queuecallerjoin','format','[%s][queues][queuecallerjoin]','assign','position','now','error','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','transfereduniqueid','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transfertype','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util'];(function(_0x4873d5,_0xfde78b){var _0x208bb4=function(_0x4e3c9c){while(--_0x4e3c9c){_0x4873d5['push'](_0x4873d5['shift']());}};_0x208bb4(++_0xfde78b);}(_0xd6a2,0xcc));var _0x2d6a=function(_0x5b9c3c,_0x3a6d8f){_0x5b9c3c=_0x5b9c3c-0x0;var _0x45a450=_0xd6a2[_0x5b9c3c];return _0x45a450;};'use strict';var _=require(_0x2d6a('0x0'));var util=require(_0x2d6a('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x10bf37){utils[_0x2d6a('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x10bf37[_0x2d6a('0x3')],_0x10bf37['channel'],_0x10bf37['queue'],_0x10bf37[_0x2d6a('0x4')],_0x10bf37[_0x2d6a('0x5')],_0x10bf37[_0x2d6a('0x6')],_0x10bf37[_0x2d6a('0x7')]));if(_0x10bf37['queue']){utils[_0x2d6a('0x8')](_0x10bf37[_0x2d6a('0x9')])[_0x2d6a('0xa')](function(_0x21e43f){if(_0x21e43f){_0x10bf37[_0x2d6a('0xb')]=_0x21e43f[_0x2d6a('0xb')];}utils[_0x2d6a('0xc')](_0x2d6a('0xd'),_0x10bf37);});}else{utils['request']('CreateVoiceQueueReport',_0x10bf37);}if(_0x10bf37['transfereduniqueid']){delete queues[_0x10bf37['transfereduniqueid']];}else{delete queues[_0x10bf37[_0x2d6a('0x3')]];}}exports[_0x2d6a('0xe')]=function(_0x45c142){try{utils['debug'](util[_0x2d6a('0xf')](_0x2d6a('0x10'),_0x45c142[_0x2d6a('0x3')]),_0x45c142);utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x45c142[_0x2d6a('0x3')],_0x45c142[_0x2d6a('0x9')],_0x45c142['position']));queues[_0x45c142[_0x2d6a('0x3')]]=_[_0x2d6a('0x11')](_0x45c142,{'originalposition':_0x45c142[_0x2d6a('0x12')],'queuecallerjoinAt':utils[_0x2d6a('0x13')](),'mohtime':0x0});}catch(_0x44e321){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')](_0x2d6a('0x10'),_0x45c142[_0x2d6a('0x3')]),_0x44e321);}};exports[_0x2d6a('0x15')]=function(_0x8e6762){try{if(!_[_0x2d6a('0x16')](queues[_0x8e6762[_0x2d6a('0x3')]])){utils[_0x2d6a('0x17')](util[_0x2d6a('0xf')]('[%s][queues][hangup]',_0x8e6762[_0x2d6a('0x3')]),_0x8e6762);if(queues[_0x8e6762[_0x2d6a('0x3')]][_0x2d6a('0x18')]){if(!queues[_0x8e6762[_0x2d6a('0x3')]][_0x2d6a('0x19')]&&!queues[_0x8e6762['uniqueid']]['queuecallerexit']){queues[_0x8e6762['uniqueid']][_0x2d6a('0x1a')]=!![];queues[_0x8e6762[_0x2d6a('0x3')]]['queuecallercompleteAt']=utils[_0x2d6a('0x13')]();queues[_0x8e6762[_0x2d6a('0x3')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x2d6a('0x2')](util['format'](_0x2d6a('0x1b'),_0x8e6762[_0x2d6a('0x3')],queues[_0x8e6762['uniqueid']]['name'],queues[_0x8e6762['uniqueid']][_0x2d6a('0x7')]));writeDB(queues[_0x8e6762[_0x2d6a('0x3')]]);}else if(queues[_0x8e6762[_0x2d6a('0x3')]][_0x2d6a('0x1c')]){utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x8e6762['uniqueid'],queues[_0x8e6762[_0x2d6a('0x3')]][_0x2d6a('0x1d')],queues[_0x8e6762[_0x2d6a('0x3')]][_0x2d6a('0x1c')]));queues[queues[_0x8e6762['uniqueid']][_0x2d6a('0x1c')]]=queues[_0x8e6762[_0x2d6a('0x3')]];queues[queues[_0x8e6762[_0x2d6a('0x3')]][_0x2d6a('0x1c')]][_0x2d6a('0x1e')]=0x2;delete queues[_0x8e6762[_0x2d6a('0x3')]];}}}catch(_0x42b0c1){utils[_0x2d6a('0x14')](util['format'](_0x2d6a('0x1f'),_0x8e6762[_0x2d6a('0x3')]),_0x42b0c1);}};exports['varset']=function(_0x4cd7a3){try{utils[_0x2d6a('0x17')](util['format'](_0x2d6a('0x20'),_0x4cd7a3[_0x2d6a('0x3')]),_0x4cd7a3);if(!_[_0x2d6a('0x16')](_0x4cd7a3[_0x2d6a('0x21')]['queuestatus'])&&_0x4cd7a3[_0x2d6a('0x22')][_0x2d6a('0x23')]()!==_0x2d6a('0x24')){if(!_['isNil'](queues[_0x4cd7a3['uniqueid']])){queues[_0x4cd7a3[_0x2d6a('0x3')]]['queuecallerabandon']=![];queues[_0x4cd7a3['uniqueid']][_0x2d6a('0x25')]=null;queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x26')]=!![];queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x27')]=utils[_0x2d6a('0x13')]();queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x7')]=_0x4cd7a3[_0x2d6a('0x22')]['toUpperCase']();utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x28'),_0x4cd7a3[_0x2d6a('0x3')],queues[_0x4cd7a3[_0x2d6a('0x3')]]['name'],_0x4cd7a3[_0x2d6a('0x22')],queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x7')]));writeDB(queues[_0x4cd7a3['uniqueid']]);}}else if(!_[_0x2d6a('0x16')](_0x4cd7a3[_0x2d6a('0x21')][_0x2d6a('0x29')])){if(!_[_0x2d6a('0x16')](queues[_0x4cd7a3[_0x2d6a('0x3')]])&&!queues[_0x4cd7a3['uniqueid']]['queuecallerabandon']){queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x19')]=![];queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x25')]=null;queues[_0x4cd7a3['uniqueid']][_0x2d6a('0x26')]=!![];queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x27')]=utils[_0x2d6a('0x13')]();queues[_0x4cd7a3['uniqueid']][_0x2d6a('0x7')]=_0x2d6a('0x2a');utils[_0x2d6a('0x2')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4cd7a3['uniqueid'],queues[_0x4cd7a3[_0x2d6a('0x3')]][_0x2d6a('0x1d')],_0x4cd7a3['value'],queues[_0x4cd7a3['uniqueid']][_0x2d6a('0x7')]));}}}catch(_0x3db817){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')]('[%s][queues][varset]',_0x4cd7a3[_0x2d6a('0x3')]),_0x3db817);}};exports[_0x2d6a('0x19')]=function(_0x2bf3f8){try{if(!_[_0x2d6a('0x16')](queues[_0x2bf3f8[_0x2d6a('0x3')]])){utils['debug'](util[_0x2d6a('0xf')](_0x2d6a('0x2b'),_0x2bf3f8[_0x2d6a('0x3')]),_0x2bf3f8);queues[_0x2bf3f8[_0x2d6a('0x3')]][_0x2d6a('0x26')]=![];queues[_0x2bf3f8['uniqueid']][_0x2d6a('0x27')]=null;queues[_0x2bf3f8[_0x2d6a('0x3')]][_0x2d6a('0x19')]=!![];queues[_0x2bf3f8[_0x2d6a('0x3')]][_0x2d6a('0x25')]=utils[_0x2d6a('0x13')]();queues[_0x2bf3f8[_0x2d6a('0x3')]][_0x2d6a('0x7')]=_0x2d6a('0x2c');utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2bf3f8['uniqueid'],queues[_0x2bf3f8['uniqueid']][_0x2d6a('0x1d')],queues[_0x2bf3f8[_0x2d6a('0x3')]][_0x2d6a('0x7')]));}}catch(_0x3b7dcd){utils['error'](util['format'](_0x2d6a('0x2b'),_0x2bf3f8[_0x2d6a('0x3')]),_0x3b7dcd);}};exports[_0x2d6a('0x2d')]=function(_0x32c4ee){try{if(!_['isNil'](queues[_0x32c4ee[_0x2d6a('0x3')]])){utils['debug'](util['format'](_0x2d6a('0x2e'),_0x32c4ee[_0x2d6a('0x3')]),_0x32c4ee);utils[_0x2d6a('0x2')](util['format'](_0x2d6a('0x2f'),_0x32c4ee[_0x2d6a('0x3')],queues[_0x32c4ee['uniqueid']][_0x2d6a('0x1d')],_0x32c4ee[_0x2d6a('0x30')],_0x32c4ee['connectedlinename']));queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x2d')]=!![];queues[_0x32c4ee[_0x2d6a('0x3')]]['queuecallerleaveAt']=utils[_0x2d6a('0x13')]();queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x31')]=utils[_0x2d6a('0x32')](queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x18')],queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x33')]);queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x12')]=_0x32c4ee[_0x2d6a('0x12')];queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x34')]=_0x32c4ee[_0x2d6a('0x34')];queues[_0x32c4ee[_0x2d6a('0x3')]][_0x2d6a('0x30')]=_0x32c4ee[_0x2d6a('0x30')];queues[_0x32c4ee['uniqueid']][_0x2d6a('0x35')]=_0x32c4ee[_0x2d6a('0x35')];}}catch(_0x60989b){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')](_0x2d6a('0x2e'),_0x32c4ee[_0x2d6a('0x3')]),_0x60989b);}};exports['agentconnect']=function(_0x4a7570){try{if(!_[_0x2d6a('0x16')](queues[_0x4a7570[_0x2d6a('0x3')]])){utils[_0x2d6a('0x17')](util[_0x2d6a('0xf')](_0x2d6a('0x36'),_0x4a7570[_0x2d6a('0x3')]),_0x4a7570);utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x37'),_0x4a7570[_0x2d6a('0x3')],queues[_0x4a7570[_0x2d6a('0x3')]][_0x2d6a('0x1d')],_0x4a7570['membername'],_0x4a7570[_0x2d6a('0x38')]));queues[_0x4a7570[_0x2d6a('0x3')]][_0x2d6a('0x19')]=![];queues[_0x4a7570['uniqueid']][_0x2d6a('0x19')]=![];queues[_0x4a7570['uniqueid']][_0x2d6a('0x25')]=null;queues[_0x4a7570[_0x2d6a('0x3')]][_0x2d6a('0x26')]=![];queues[_0x4a7570[_0x2d6a('0x3')]]['queuecallerexitreason']=null;queues[_0x4a7570[_0x2d6a('0x3')]]['queuecallerexitAt']=null;queues[_0x4a7570['uniqueid']]['assigned']=!![];queues[_0x4a7570[_0x2d6a('0x3')]][_0x2d6a('0x6')]=_0x4a7570['destaccountcode'];queues[_0x4a7570['uniqueid']][_0x2d6a('0x4')]=_0x4a7570[_0x2d6a('0x39')];}}catch(_0x3f6d46){utils[_0x2d6a('0x14')](util['format'](_0x2d6a('0x36'),_0x4a7570[_0x2d6a('0x3')]),_0x3f6d46);}};exports[_0x2d6a('0x3a')]=function(_0x19fad6){try{if(!_[_0x2d6a('0x16')](queues[_0x19fad6[_0x2d6a('0x3')]])){if(queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x18')]){utils[_0x2d6a('0x17')](util[_0x2d6a('0xf')](_0x2d6a('0x3b'),_0x19fad6[_0x2d6a('0x3')]),_0x19fad6);queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x19')]=![];queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x19')]=![];queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x25')]=null;queues[_0x19fad6[_0x2d6a('0x3')]]['queuecallerexit']=![];queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x27')]=null;queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x3c')]=!![];queues[_0x19fad6['uniqueid']][_0x2d6a('0x4')]=_0x19fad6['membername'];queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x1a')]=!![];queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x3d')]=utils[_0x2d6a('0x13')]();if(_0x19fad6[_0x2d6a('0x3e')]==_0x2d6a('0x3f')){if(!queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x3f')]){queues[_0x19fad6['uniqueid']][_0x2d6a('0x7')]=_0x2d6a('0x40');}}else{queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x7')]=_0x2d6a('0x41')+_0x19fad6[_0x2d6a('0x3e')][_0x2d6a('0x23')]();}utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x19fad6['uniqueid'],queues[_0x19fad6[_0x2d6a('0x3')]][_0x2d6a('0x1d')],_0x19fad6[_0x2d6a('0x39')],queues[_0x19fad6['uniqueid']][_0x2d6a('0x7')]));writeDB(queues[_0x19fad6[_0x2d6a('0x3')]]);}}}catch(_0x5e5232){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')]('[%s][queues][agentcomplete]',_0x19fad6[_0x2d6a('0x3')]),_0x5e5232);}};exports[_0x2d6a('0x42')]=function(_0x37f45b){try{if(!_[_0x2d6a('0x16')](queues[_0x37f45b['transfereeuniqueid']])){utils[_0x2d6a('0x17')](util[_0x2d6a('0xf')](_0x2d6a('0x43'),_0x37f45b['uniqueid']),_0x37f45b);queues[_0x37f45b[_0x2d6a('0x44')]][_0x2d6a('0x3f')]=!![];queues[_0x37f45b[_0x2d6a('0x44')]]['transfertype']=_0x2d6a('0x45');queues[_0x37f45b['transfereeuniqueid']]['transferexten']=_0x37f45b[_0x2d6a('0x46')];queues[_0x37f45b[_0x2d6a('0x44')]]['transferuniqueid']=_0x37f45b['transfereeuniqueid'];queues[_0x37f45b['transfereeuniqueid']][_0x2d6a('0x7')]=_0x2d6a('0x47');utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x48'),_0x37f45b[_0x2d6a('0x3')],queues[_0x37f45b[_0x2d6a('0x44')]][_0x2d6a('0x1d')],_0x37f45b[_0x2d6a('0x44')],_0x37f45b[_0x2d6a('0x46')]));}}catch(_0x4e8b53){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')](_0x2d6a('0x43'),_0x37f45b[_0x2d6a('0x3')]),_0x4e8b53);}};exports[_0x2d6a('0x49')]=function(_0x5e49c8){try{utils[_0x2d6a('0x17')](util[_0x2d6a('0xf')](_0x2d6a('0x4a'),_0x5e49c8['origtransfereruniqueid']),_0x5e49c8);if(_0x5e49c8[_0x2d6a('0x4b')]==_0x5e49c8[_0x2d6a('0x4c')]){if(!_[_0x2d6a('0x16')](queues[_0x5e49c8['secondtransfererlinkedid']])){utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x4d'),_0x5e49c8[_0x2d6a('0x4b')],queues[_0x5e49c8[_0x2d6a('0x4e')]]['name'],_0x5e49c8[_0x2d6a('0x4f')]));queues[_0x5e49c8['secondtransfererlinkedid']][_0x2d6a('0x3f')]=!![];queues[_0x5e49c8['secondtransfererlinkedid']][_0x2d6a('0x50')]='ATTENDED';queues[_0x5e49c8['secondtransfererlinkedid']][_0x2d6a('0x51')]=_0x5e49c8[_0x2d6a('0x4f')];queues[_0x5e49c8[_0x2d6a('0x4e')]][_0x2d6a('0x52')]=_0x5e49c8[_0x2d6a('0x4b')];queues[_0x5e49c8['secondtransfererlinkedid']][_0x2d6a('0x7')]=_0x2d6a('0x53');}if(!_[_0x2d6a('0x16')](queues[_0x5e49c8[_0x2d6a('0x4c')]])){if(_0x5e49c8[_0x2d6a('0x54')]&&queues[_0x5e49c8[_0x2d6a('0x54')]]){queues[_0x5e49c8[_0x2d6a('0x54')]][_0x2d6a('0x1e')]=0x1;queues[_0x5e49c8[_0x2d6a('0x44')]]=_[_0x2d6a('0x55')](queues[_0x5e49c8[_0x2d6a('0x54')]]);queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x1c')]=_0x5e49c8[_0x2d6a('0x56')];queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x1e')]=0x2;queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x5')]=queues[_0x5e49c8['secondtransfererlinkedid']][_0x2d6a('0x5')];queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x57')]=queues[_0x5e49c8[_0x2d6a('0x4e')]][_0x2d6a('0x57')];queues[_0x5e49c8[_0x2d6a('0x44')]]['queuecallerjoinAt']=utils[_0x2d6a('0x13')]();queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x18')]=utils[_0x2d6a('0x13')]();queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x31')]=0x0;queues[_0x5e49c8['transfereeuniqueid']][_0x2d6a('0x58')]=0x0;utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x59'),_0x5e49c8['origtransfereruniqueid'],queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x1d')],queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x5')],queues[_0x5e49c8[_0x2d6a('0x44')]][_0x2d6a('0x57')]));}else{utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x5a'),_0x5e49c8[_0x2d6a('0x4b')],queues[_0x5e49c8['origtransfererlinkedid']][_0x2d6a('0x1d')],_0x5e49c8[_0x2d6a('0x4e')]));queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x1c')]=_0x5e49c8[_0x2d6a('0x4e')];}}}else if(_0x5e49c8[_0x2d6a('0x5b')]==_0x5e49c8[_0x2d6a('0x4e')]){if(!_[_0x2d6a('0x16')](queues[_0x5e49c8[_0x2d6a('0x4c')]])){utils['info'](util[_0x2d6a('0xf')](_0x2d6a('0x5c'),_0x5e49c8[_0x2d6a('0x4b')],queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x1d')],_0x5e49c8[_0x2d6a('0x5b')],_0x5e49c8['secondtransfererexten']));queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x3f')]=!![];queues[_0x5e49c8['origtransfererlinkedid']][_0x2d6a('0x50')]='ATTENDED';queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x51')]=_0x5e49c8[_0x2d6a('0x5d')];queues[_0x5e49c8['origtransfererlinkedid']][_0x2d6a('0x52')]=_0x5e49c8[_0x2d6a('0x5b')];queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x7')]=_0x2d6a('0x53');}if(!_[_0x2d6a('0x16')](queues[_0x5e49c8['secondtransfererlinkedid']])){if(_0x5e49c8[_0x2d6a('0x5e')]&&queues[_0x5e49c8['transfertargetlinkedid']]){queues[_0x5e49c8['transfertargetlinkedid']][_0x2d6a('0x1e')]=0x1;queues[_0x5e49c8[_0x2d6a('0x56')]]=_['clone'](queues[_0x5e49c8[_0x2d6a('0x5e')]]);queues[_0x5e49c8['transfertargetuniqueid']][_0x2d6a('0x1c')]=_0x5e49c8[_0x2d6a('0x56')];queues[_0x5e49c8[_0x2d6a('0x56')]][_0x2d6a('0x1e')]=0x2;queues[_0x5e49c8[_0x2d6a('0x56')]][_0x2d6a('0x5')]=queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x5')];queues[_0x5e49c8[_0x2d6a('0x56')]][_0x2d6a('0x57')]=queues[_0x5e49c8[_0x2d6a('0x4c')]][_0x2d6a('0x57')];queues[_0x5e49c8[_0x2d6a('0x56')]][_0x2d6a('0x33')]=utils[_0x2d6a('0x13')]();queues[_0x5e49c8['transfertargetuniqueid']][_0x2d6a('0x18')]=utils[_0x2d6a('0x13')]();queues[_0x5e49c8['transfertargetuniqueid']][_0x2d6a('0x31')]=0x0;queues[_0x5e49c8[_0x2d6a('0x56')]]['mohtime']=0x0;utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')](_0x2d6a('0x5f'),_0x5e49c8[_0x2d6a('0x4b')],queues[_0x5e49c8[_0x2d6a('0x56')]]['name'],queues[_0x5e49c8['transfertargetuniqueid']][_0x2d6a('0x1c')],queues[_0x5e49c8[_0x2d6a('0x56')]][_0x2d6a('0x5')],queues[_0x5e49c8[_0x2d6a('0x56')]][_0x2d6a('0x57')]));}else{utils[_0x2d6a('0x2')](util[_0x2d6a('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5e49c8[_0x2d6a('0x4b')],queues[_0x5e49c8['secondtransfererlinkedid']][_0x2d6a('0x1d')],_0x5e49c8[_0x2d6a('0x4c')]));queues[_0x5e49c8[_0x2d6a('0x4e')]][_0x2d6a('0x1c')]=_0x5e49c8[_0x2d6a('0x4c')];}}}}catch(_0x3b1e86){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')](_0x2d6a('0x4a'),_0x5e49c8[_0x2d6a('0x4b')]),_0x3b1e86);}};exports[_0x2d6a('0x60')]=function(_0xaab2b6){try{if(!_[_0x2d6a('0x16')](queues[_0xaab2b6[_0x2d6a('0x3')]])){utils[_0x2d6a('0x17')](util[_0x2d6a('0xf')](_0x2d6a('0x61'),_0xaab2b6[_0x2d6a('0x3')]),_0xaab2b6);queues[_0xaab2b6['uniqueid']][_0x2d6a('0x62')]=utils[_0x2d6a('0x13')]();utils[_0x2d6a('0x2')](util['format'](_0x2d6a('0x63'),_0xaab2b6[_0x2d6a('0x3')],queues[_0xaab2b6[_0x2d6a('0x3')]][_0x2d6a('0x1d')],queues[_0xaab2b6[_0x2d6a('0x3')]][_0x2d6a('0x62')]));}}catch(_0x22607a){utils['error'](util['format'](_0x2d6a('0x61'),_0xaab2b6['uniqueid']),_0x22607a);}};exports[_0x2d6a('0x64')]=function(_0x329112){try{if(!_[_0x2d6a('0x16')](queues[_0x329112[_0x2d6a('0x3')]])){if(!_[_0x2d6a('0x16')](queues[_0x329112[_0x2d6a('0x3')]][_0x2d6a('0x62')])){utils['debug'](util[_0x2d6a('0xf')](_0x2d6a('0x65'),_0x329112['uniqueid']),_0x329112);queues[_0x329112[_0x2d6a('0x3')]]['mohtime']+=utils[_0x2d6a('0x32')](utils['now'](),queues[_0x329112['uniqueid']][_0x2d6a('0x62')]);utils[_0x2d6a('0x2')](util['format'](_0x2d6a('0x66'),_0x329112['uniqueid'],queues[_0x329112[_0x2d6a('0x3')]]['name'],queues[_0x329112[_0x2d6a('0x3')]]['mohtime']));delete queues[_0x329112[_0x2d6a('0x3')]][_0x2d6a('0x62')];}}}catch(_0x5135a5){utils[_0x2d6a('0x14')](util[_0x2d6a('0xf')]('[%s][queues][musiconholdstop]',_0x329112[_0x2d6a('0x3')]),_0x5135a5);}}; \ No newline at end of file +var _0xcc26=['queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','lastAssignedTo','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','isNil','queuecallerabandonAt'];(function(_0x4b3cc3,_0x22bf1a){var _0x117aa1=function(_0x5b58c2){while(--_0x5b58c2){_0x4b3cc3['push'](_0x4b3cc3['shift']());}};_0x117aa1(++_0x22bf1a);}(_0xcc26,0x15d));var _0x6cc2=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xcc26[_0x546aaf];return _0x1cbf6d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6cc2('0x0'));var queues={};function writeDB(_0x15472a){utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x3'),_0x15472a[_0x6cc2('0x4')],_0x15472a['channel'],_0x15472a[_0x6cc2('0x5')],_0x15472a['lastAssignedTo'],_0x15472a[_0x6cc2('0x6')],_0x15472a[_0x6cc2('0x7')],_0x15472a['queuecallerexitreason']));if(_0x15472a[_0x6cc2('0x5')]){utils[_0x6cc2('0x8')](_0x15472a[_0x6cc2('0x5')])['then'](function(_0x4772db){if(_0x4772db){_0x15472a[_0x6cc2('0x9')]=_0x4772db[_0x6cc2('0x9')];}utils[_0x6cc2('0xa')](_0x6cc2('0xb'),_0x15472a);});}else{utils[_0x6cc2('0xa')](_0x6cc2('0xb'),_0x15472a);}if(_0x15472a[_0x6cc2('0xc')]){delete queues[_0x15472a[_0x6cc2('0xc')]];}else{delete queues[_0x15472a[_0x6cc2('0x4')]];}}exports[_0x6cc2('0xd')]=function(_0x32635){try{utils[_0x6cc2('0xe')](util['format']('[%s][queues][queuecallerjoin]',_0x32635['uniqueid']),_0x32635);utils[_0x6cc2('0x1')](util['format'](_0x6cc2('0xf'),_0x32635[_0x6cc2('0x4')],_0x32635[_0x6cc2('0x5')],_0x32635[_0x6cc2('0x10')]));queues[_0x32635[_0x6cc2('0x4')]]=_[_0x6cc2('0x11')](_0x32635,{'originalposition':_0x32635[_0x6cc2('0x10')],'queuecallerjoinAt':utils[_0x6cc2('0x12')](),'mohtime':0x0});}catch(_0x38ba8a){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][queuecallerjoin]',_0x32635[_0x6cc2('0x4')]),_0x38ba8a);}};exports[_0x6cc2('0x14')]=function(_0x5152b2){try{if(!_['isNil'](queues[_0x5152b2['uniqueid']])){utils['debug'](util['format'](_0x6cc2('0x15'),_0x5152b2[_0x6cc2('0x4')]),_0x5152b2);if(queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x16')]){if(!queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x17')]&&!queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x18')]){queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x19')]=!![];queues[_0x5152b2['uniqueid']][_0x6cc2('0x1a')]=utils['now']();queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]=_0x6cc2('0x1c');}utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x1d'),_0x5152b2[_0x6cc2('0x4')],queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1e')],queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));writeDB(queues[_0x5152b2[_0x6cc2('0x4')]]);}else if(queues[_0x5152b2[_0x6cc2('0x4')]]['transfereduniqueid']){utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5152b2[_0x6cc2('0x4')],queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0x1e')],queues[_0x5152b2[_0x6cc2('0x4')]]['transfereduniqueid']));queues[queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0xc')]]=queues[_0x5152b2[_0x6cc2('0x4')]];queues[queues[_0x5152b2[_0x6cc2('0x4')]][_0x6cc2('0xc')]][_0x6cc2('0x1f')]=0x2;delete queues[_0x5152b2['uniqueid']];}}}catch(_0x58a387){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][hangup]',_0x5152b2[_0x6cc2('0x4')]),_0x58a387);}};exports[_0x6cc2('0x20')]=function(_0x235b8c){try{utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x21'),_0x235b8c[_0x6cc2('0x4')]),_0x235b8c);if(!_['isNil'](_0x235b8c['variable'][_0x6cc2('0x22')])&&_0x235b8c[_0x6cc2('0x23')][_0x6cc2('0x24')]()!=='CONTINUE'){if(!_[_0x6cc2('0x25')](queues[_0x235b8c[_0x6cc2('0x4')]])){queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x26')]=null;queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x18')]=!![];queues[_0x235b8c['uniqueid']][_0x6cc2('0x27')]=utils[_0x6cc2('0x12')]();queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x1b')]=_0x235b8c['value'][_0x6cc2('0x24')]();utils[_0x6cc2('0x1')](util['format'](_0x6cc2('0x28'),_0x235b8c['uniqueid'],queues[_0x235b8c[_0x6cc2('0x4')]]['name'],_0x235b8c[_0x6cc2('0x23')],queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));writeDB(queues[_0x235b8c[_0x6cc2('0x4')]]);}}else if(!_[_0x6cc2('0x25')](_0x235b8c['variable'][_0x6cc2('0x29')])){if(!_['isNil'](queues[_0x235b8c[_0x6cc2('0x4')]])&&!queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x17')]){queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x235b8c[_0x6cc2('0x4')]]['queuecallerabandonAt']=null;queues[_0x235b8c['uniqueid']][_0x6cc2('0x18')]=!![];queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x27')]=utils['now']();queues[_0x235b8c[_0x6cc2('0x4')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x2a'),_0x235b8c[_0x6cc2('0x4')],queues[_0x235b8c[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x235b8c[_0x6cc2('0x23')],queues[_0x235b8c[_0x6cc2('0x4')]]['queuecallerexitreason']));}}}catch(_0x24d2d6){utils['error'](util[_0x6cc2('0x2')](_0x6cc2('0x21'),_0x235b8c[_0x6cc2('0x4')]),_0x24d2d6);}};exports[_0x6cc2('0x17')]=function(_0x572af2){try{if(!_[_0x6cc2('0x25')](queues[_0x572af2[_0x6cc2('0x4')]])){utils['debug'](util[_0x6cc2('0x2')]('[%s][queues][queuecallerabandon]',_0x572af2['uniqueid']),_0x572af2);queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x18')]=![];queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x27')]=null;queues[_0x572af2[_0x6cc2('0x4')]]['queuecallerabandon']=!![];queues[_0x572af2[_0x6cc2('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]='ABANDONED';utils[_0x6cc2('0x1')](util['format'](_0x6cc2('0x2b'),_0x572af2[_0x6cc2('0x4')],queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x1e')],queues[_0x572af2[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));}}catch(_0x3c0f97){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][queuecallerabandon]',_0x572af2[_0x6cc2('0x4')]),_0x3c0f97);}};exports[_0x6cc2('0x2c')]=function(_0x8a56ba){try{if(!_[_0x6cc2('0x25')](queues[_0x8a56ba[_0x6cc2('0x4')]])){utils['debug'](util['format'](_0x6cc2('0x2d'),_0x8a56ba[_0x6cc2('0x4')]),_0x8a56ba);utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x2e'),_0x8a56ba['uniqueid'],queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x8a56ba['connectedlinenum'],_0x8a56ba[_0x6cc2('0x2f')]));queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x2c')]=!![];queues[_0x8a56ba['uniqueid']][_0x6cc2('0x16')]=utils[_0x6cc2('0x12')]();queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x30')]=utils[_0x6cc2('0x31')](queues[_0x8a56ba[_0x6cc2('0x4')]]['queuecallerleaveAt'],queues[_0x8a56ba['uniqueid']][_0x6cc2('0x32')]);queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x10')]=_0x8a56ba[_0x6cc2('0x10')];queues[_0x8a56ba['uniqueid']]['count']=_0x8a56ba['count'];queues[_0x8a56ba[_0x6cc2('0x4')]][_0x6cc2('0x33')]=_0x8a56ba[_0x6cc2('0x33')];queues[_0x8a56ba[_0x6cc2('0x4')]]['connectedlinename']=_0x8a56ba['connectedlinename'];}}catch(_0x37e4b3){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')](_0x6cc2('0x2d'),_0x8a56ba[_0x6cc2('0x4')]),_0x37e4b3);}};exports[_0x6cc2('0x34')]=function(_0x57d418){try{if(!_['isNil'](queues[_0x57d418[_0x6cc2('0x4')]])){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x35'),_0x57d418[_0x6cc2('0x4')]),_0x57d418);utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x36'),_0x57d418[_0x6cc2('0x4')],queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x57d418[_0x6cc2('0x37')],_0x57d418[_0x6cc2('0x38')]));queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x26')]=null;queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x18')]=![];queues[_0x57d418['uniqueid']]['queuecallerexitreason']=null;queues[_0x57d418[_0x6cc2('0x4')]]['queuecallerexitAt']=null;queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x39')]=!![];queues[_0x57d418[_0x6cc2('0x4')]][_0x6cc2('0x7')]=_0x57d418[_0x6cc2('0x38')];queues[_0x57d418['uniqueid']]['lastAssignedTo']=_0x57d418[_0x6cc2('0x37')];}}catch(_0xfc8277){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')]('[%s][queues][agentconnect]',_0x57d418[_0x6cc2('0x4')]),_0xfc8277);}};exports['agentcomplete']=function(_0x2efe4a){try{if(!_[_0x6cc2('0x25')](queues[_0x2efe4a[_0x6cc2('0x4')]])){if(queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x16')]){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x3a'),_0x2efe4a[_0x6cc2('0x4')]),_0x2efe4a);queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x17')]=![];queues[_0x2efe4a[_0x6cc2('0x4')]]['queuecallerabandon']=![];queues[_0x2efe4a['uniqueid']][_0x6cc2('0x26')]=null;queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x18')]=![];queues[_0x2efe4a['uniqueid']][_0x6cc2('0x27')]=null;queues[_0x2efe4a[_0x6cc2('0x4')]]['assigned']=!![];queues[_0x2efe4a['uniqueid']][_0x6cc2('0x3b')]=_0x2efe4a[_0x6cc2('0x37')];queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x19')]=!![];queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x1a')]=utils['now']();if(_0x2efe4a[_0x6cc2('0x3c')]==_0x6cc2('0x3d')){if(!queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x3d')]){queues[_0x2efe4a[_0x6cc2('0x4')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x2efe4a['uniqueid']][_0x6cc2('0x1b')]='COMPLETEDBY'+_0x2efe4a[_0x6cc2('0x3c')]['toUpperCase']();}utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x3e'),_0x2efe4a[_0x6cc2('0x4')],queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x1e')],_0x2efe4a['membername'],queues[_0x2efe4a[_0x6cc2('0x4')]][_0x6cc2('0x1b')]));writeDB(queues[_0x2efe4a['uniqueid']]);}}}catch(_0x1cf559){utils[_0x6cc2('0x13')](util['format'](_0x6cc2('0x3a'),_0x2efe4a[_0x6cc2('0x4')]),_0x1cf559);}};exports[_0x6cc2('0x3f')]=function(_0x77fcef){try{if(!_[_0x6cc2('0x25')](queues[_0x77fcef['transfereeuniqueid']])){utils[_0x6cc2('0xe')](util['format'](_0x6cc2('0x40'),_0x77fcef[_0x6cc2('0x4')]),_0x77fcef);queues[_0x77fcef['transfereeuniqueid']]['transfer']=!![];queues[_0x77fcef[_0x6cc2('0x41')]]['transfertype']=_0x6cc2('0x42');queues[_0x77fcef['transfereeuniqueid']][_0x6cc2('0x43')]=_0x77fcef[_0x6cc2('0x44')];queues[_0x77fcef[_0x6cc2('0x41')]][_0x6cc2('0x45')]=_0x77fcef[_0x6cc2('0x41')];queues[_0x77fcef[_0x6cc2('0x41')]][_0x6cc2('0x1b')]='BLINDTRANSFER';utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x46'),_0x77fcef[_0x6cc2('0x4')],queues[_0x77fcef[_0x6cc2('0x41')]]['name'],_0x77fcef[_0x6cc2('0x41')],_0x77fcef[_0x6cc2('0x44')]));}}catch(_0x13bcaa){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')](_0x6cc2('0x40'),_0x77fcef[_0x6cc2('0x4')]),_0x13bcaa);}};exports[_0x6cc2('0x47')]=function(_0x184754){try{utils[_0x6cc2('0xe')](util['format'](_0x6cc2('0x48'),_0x184754[_0x6cc2('0x49')]),_0x184754);if(_0x184754[_0x6cc2('0x49')]==_0x184754[_0x6cc2('0x4a')]){if(!_[_0x6cc2('0x25')](queues[_0x184754[_0x6cc2('0x4b')]])){utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x4c'),_0x184754['origtransfereruniqueid'],queues[_0x184754['secondtransfererlinkedid']]['name'],_0x184754['origtransfererexten']));queues[_0x184754[_0x6cc2('0x4b')]]['transfer']=!![];queues[_0x184754[_0x6cc2('0x4b')]][_0x6cc2('0x4d')]=_0x6cc2('0x4e');queues[_0x184754[_0x6cc2('0x4b')]][_0x6cc2('0x43')]=_0x184754['origtransfererexten'];queues[_0x184754[_0x6cc2('0x4b')]]['transferuniqueid']=_0x184754[_0x6cc2('0x49')];queues[_0x184754[_0x6cc2('0x4b')]]['queuecallerexitreason']=_0x6cc2('0x4f');}if(!_[_0x6cc2('0x25')](queues[_0x184754[_0x6cc2('0x4a')]])){if(_0x184754[_0x6cc2('0x50')]&&queues[_0x184754[_0x6cc2('0x50')]]){queues[_0x184754[_0x6cc2('0x50')]][_0x6cc2('0x1f')]=0x1;queues[_0x184754['transfereeuniqueid']]=_[_0x6cc2('0x51')](queues[_0x184754['transfereelinkedid']]);queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0xc')]=_0x184754['transfertargetuniqueid'];queues[_0x184754[_0x6cc2('0x41')]]['queuecallerenterreason']=0x2;queues[_0x184754['transfereeuniqueid']][_0x6cc2('0x6')]=queues[_0x184754['secondtransfererlinkedid']][_0x6cc2('0x6')];queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x52')]=queues[_0x184754[_0x6cc2('0x4b')]]['calleridname'];queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x32')]=utils['now']();queues[_0x184754['transfereeuniqueid']][_0x6cc2('0x16')]=utils[_0x6cc2('0x12')]();queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x30')]=0x0;queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x53')]=0x0;utils[_0x6cc2('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x184754[_0x6cc2('0x49')],queues[_0x184754[_0x6cc2('0x41')]]['name'],queues[_0x184754[_0x6cc2('0x41')]][_0x6cc2('0x6')],queues[_0x184754['transfereeuniqueid']][_0x6cc2('0x52')]));}else{utils[_0x6cc2('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x184754['origtransfereruniqueid'],queues[_0x184754[_0x6cc2('0x4a')]]['name'],_0x184754[_0x6cc2('0x4b')]));queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0xc')]=_0x184754[_0x6cc2('0x4b')];}}}else if(_0x184754[_0x6cc2('0x54')]==_0x184754['secondtransfererlinkedid']){if(!_[_0x6cc2('0x25')](queues[_0x184754[_0x6cc2('0x4a')]])){utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x55'),_0x184754[_0x6cc2('0x49')],queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0x1e')],_0x184754[_0x6cc2('0x54')],_0x184754[_0x6cc2('0x56')]));queues[_0x184754['origtransfererlinkedid']][_0x6cc2('0x3d')]=!![];queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0x4d')]=_0x6cc2('0x4e');queues[_0x184754[_0x6cc2('0x4a')]]['transferexten']=_0x184754[_0x6cc2('0x56')];queues[_0x184754['origtransfererlinkedid']]['transferuniqueid']=_0x184754['secondtransfereruniqueid'];queues[_0x184754[_0x6cc2('0x4a')]][_0x6cc2('0x1b')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x184754[_0x6cc2('0x4b')]])){if(_0x184754[_0x6cc2('0x57')]&&queues[_0x184754['transfertargetlinkedid']]){queues[_0x184754['transfertargetlinkedid']][_0x6cc2('0x1f')]=0x1;queues[_0x184754[_0x6cc2('0x58')]]=_['clone'](queues[_0x184754['transfertargetlinkedid']]);queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0xc')]=_0x184754[_0x6cc2('0x58')];queues[_0x184754[_0x6cc2('0x58')]]['queuecallerenterreason']=0x2;queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x6')]=queues[_0x184754[_0x6cc2('0x4a')]]['calleridnum'];queues[_0x184754[_0x6cc2('0x58')]]['calleridname']=queues[_0x184754['origtransfererlinkedid']][_0x6cc2('0x52')];queues[_0x184754[_0x6cc2('0x58')]]['queuecallerjoinAt']=utils['now']();queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x16')]=utils['now']();queues[_0x184754['transfertargetuniqueid']][_0x6cc2('0x30')]=0x0;queues[_0x184754['transfertargetuniqueid']][_0x6cc2('0x53')]=0x0;utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x59'),_0x184754['origtransfereruniqueid'],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x1e')],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0xc')],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x6')],queues[_0x184754[_0x6cc2('0x58')]][_0x6cc2('0x52')]));}else{utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x5a'),_0x184754['origtransfereruniqueid'],queues[_0x184754['secondtransfererlinkedid']]['name'],_0x184754[_0x6cc2('0x4a')]));queues[_0x184754[_0x6cc2('0x4b')]][_0x6cc2('0xc')]=_0x184754[_0x6cc2('0x4a')];}}}}catch(_0x84378c){utils[_0x6cc2('0x13')](util['format']('[%s][queues][attendedtransfer]',_0x184754[_0x6cc2('0x49')]),_0x84378c);}};exports['musiconholdstart']=function(_0x5dae85){try{if(!_[_0x6cc2('0x25')](queues[_0x5dae85[_0x6cc2('0x4')]])){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')]('[%s][queues][musiconholdstart]',_0x5dae85['uniqueid']),_0x5dae85);queues[_0x5dae85[_0x6cc2('0x4')]][_0x6cc2('0x5b')]=utils['now']();utils[_0x6cc2('0x1')](util[_0x6cc2('0x2')](_0x6cc2('0x5c'),_0x5dae85[_0x6cc2('0x4')],queues[_0x5dae85['uniqueid']][_0x6cc2('0x1e')],queues[_0x5dae85[_0x6cc2('0x4')]][_0x6cc2('0x5b')]));}}catch(_0x4d9a80){utils[_0x6cc2('0x13')](util[_0x6cc2('0x2')](_0x6cc2('0x5d'),_0x5dae85[_0x6cc2('0x4')]),_0x4d9a80);}};exports[_0x6cc2('0x5e')]=function(_0x357a11){try{if(!_[_0x6cc2('0x25')](queues[_0x357a11[_0x6cc2('0x4')]])){if(!_[_0x6cc2('0x25')](queues[_0x357a11[_0x6cc2('0x4')]][_0x6cc2('0x5b')])){utils[_0x6cc2('0xe')](util[_0x6cc2('0x2')](_0x6cc2('0x5f'),_0x357a11[_0x6cc2('0x4')]),_0x357a11);queues[_0x357a11[_0x6cc2('0x4')]]['mohtime']+=utils[_0x6cc2('0x31')](utils[_0x6cc2('0x12')](),queues[_0x357a11['uniqueid']][_0x6cc2('0x5b')]);utils['info'](util[_0x6cc2('0x2')](_0x6cc2('0x60'),_0x357a11[_0x6cc2('0x4')],queues[_0x357a11['uniqueid']][_0x6cc2('0x1e')],queues[_0x357a11[_0x6cc2('0x4')]]['mohtime']));delete queues[_0x357a11[_0x6cc2('0x4')]][_0x6cc2('0x5b')];}}}catch(_0x2ee2bf){utils['error'](util[_0x6cc2('0x2')](_0x6cc2('0x5f'),_0x357a11[_0x6cc2('0x4')]),_0x2ee2bf);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c2156de..ae8a035 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 _0xaef5=['monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find'];(function(_0x22f58b,_0x5dd4f8){var _0x4bfc9f=function(_0x38b90e){while(--_0x38b90e){_0x22f58b['push'](_0x22f58b['shift']());}};_0x4bfc9f(++_0x5dd4f8);}(_0xaef5,0xe2));var _0x5aef=function(_0x1462ee,_0x5dccc1){_0x1462ee=_0x1462ee-0x0;var _0x34cf46=_0xaef5[_0x1462ee];return _0x34cf46;};'use strict';var _=require(_0x5aef('0x0'));var util=require(_0x5aef('0x1'));var utils=require(_0x5aef('0x2'));var recordings={};function writeDB(_0xed692){utils[_0x5aef('0x3')](util[_0x5aef('0x4')](_0x5aef('0x5'),_0xed692[_0x5aef('0x6')]));if(_0xed692[_0x5aef('0x7')]){utils[_0x5aef('0x8')](_0xed692[_0x5aef('0x7')])[_0x5aef('0x9')](function(_0x437ac2){if(_0x437ac2){_0xed692[_0x5aef('0xa')]=_0x437ac2[_0x5aef('0xb')];_0xed692[_0x5aef('0xc')]=_0x437ac2['id'];}utils['request'](_0x5aef('0xd'),_0xed692);});}else{utils['request'](_0x5aef('0xd'),_0xed692);}}exports[_0x5aef('0xe')]=function(_0xf21470){try{utils['debug'](util[_0x5aef('0x4')](_0x5aef('0xf'),_0xf21470[_0x5aef('0x6')]),_0xf21470);if(_0xf21470[_0x5aef('0x6')]==_0xf21470[_0x5aef('0x10')]){utils['info'](util[_0x5aef('0x4')](_0x5aef('0x11'),_0xf21470[_0x5aef('0x6')],_0xf21470[_0x5aef('0x12')],_0xf21470[_0x5aef('0x13')]));recordings[_0xf21470[_0x5aef('0x6')]]={'uniqueid':_0xf21470['uniqueid'],'accountcode':_0xf21470[_0x5aef('0x7')],'exten':_0xf21470[_0x5aef('0x13')],'context':_0xf21470['context'],'channel':_0xf21470[_0x5aef('0x14')],'monitors':[]};}}catch(_0x1b79bd){utils[_0x5aef('0x15')](util[_0x5aef('0x4')](_0x5aef('0xf'),_0xf21470[_0x5aef('0x6')]),_0x1b79bd);}};exports['newstate']=function(_0x47afc6){try{utils[_0x5aef('0x16')](util[_0x5aef('0x4')](_0x5aef('0x17'),_0x47afc6[_0x5aef('0x6')]),_0x47afc6);if(!_[_0x5aef('0x18')](recordings[_0x47afc6[_0x5aef('0x6')]])&&_0x47afc6[_0x5aef('0x19')]==0x6){utils['info'](util[_0x5aef('0x4')](_0x5aef('0x1a'),_0x47afc6[_0x5aef('0x6')],_0x47afc6['context'],_0x47afc6[_0x5aef('0x14')]));}else if(!_[_0x5aef('0x18')](recordings[_0x47afc6['linkedid']])&&_0x47afc6[_0x5aef('0x19')]==0x6&&_0x47afc6[_0x5aef('0x12')]!=_0x5aef('0x1b')){utils['info'](util['format'](_0x5aef('0x1c'),_0x47afc6['uniqueid'],_0x47afc6['linkedid'],_0x47afc6[_0x5aef('0x12')],_0x47afc6[_0x5aef('0x14')]));recordings[_0x47afc6['linkedid']][_0x5aef('0x7')]=_0x47afc6[_0x5aef('0x7')];}}catch(_0x24941c){utils[_0x5aef('0x15')](util['format'](_0x5aef('0x17'),_0x47afc6['uniqueid']),_0x24941c);}};exports[_0x5aef('0x1d')]=function(_0x442d1e){try{if(!_[_0x5aef('0x18')](_0x442d1e[_0x5aef('0x1e')])&&!_[_0x5aef('0x18')](_0x442d1e['variable'][_0x5aef('0x1f')])){utils['debug'](util[_0x5aef('0x4')]('[%s][recordings][varset]',_0x442d1e[_0x5aef('0x6')]),_0x442d1e);utils['info'](util[_0x5aef('0x4')](_0x5aef('0x20'),_0x442d1e[_0x5aef('0x6')],_0x442d1e[_0x5aef('0x1e')],_0x442d1e[_0x5aef('0x21')]));if(_[_0x5aef('0x22')](_0x442d1e[_0x5aef('0x21')],_0x5aef('0x23'))){_0x442d1e[_0x5aef('0x21')]=_0x442d1e[_0x5aef('0x21')]['replace'](_0x5aef('0x23'),_0x5aef('0x24'));}if(recordings[_0x442d1e['linkedid']]){var _0xa93105=_[_0x5aef('0x25')](recordings[_0x442d1e[_0x5aef('0x10')]][_0x5aef('0x26')],{'value':_0x442d1e[_0x5aef('0x21')]});if(_[_0x5aef('0x18')](_0xa93105)){recordings[_0x442d1e[_0x5aef('0x10')]][_0x5aef('0x26')][_0x5aef('0x27')]({'value':_0x442d1e[_0x5aef('0x21')]});}}}}catch(_0x276331){utils[_0x5aef('0x15')](util['format']('[%s][recordings][varset]',_0x442d1e[_0x5aef('0x6')]),_0x276331);}};exports[_0x5aef('0x28')]=function(_0x49273f){try{if(!_['isNil'](recordings[_0x49273f[_0x5aef('0x6')]])){utils[_0x5aef('0x16')](util[_0x5aef('0x4')]('[%s][recordings][hangup]',_0x49273f[_0x5aef('0x6')]),_0x49273f);utils[_0x5aef('0x3')](util[_0x5aef('0x4')](_0x5aef('0x29'),_0x49273f[_0x5aef('0x6')],_0x49273f[_0x5aef('0x2a')],_0x49273f[_0x5aef('0x2b')],_0x49273f[_0x5aef('0x2c')]));recordings[_0x49273f[_0x5aef('0x6')]]['calleridnum']=_0x49273f['calleridnum'];recordings[_0x49273f[_0x5aef('0x6')]]['calleridname']=_0x49273f[_0x5aef('0x2b')];recordings[_0x49273f[_0x5aef('0x6')]][_0x5aef('0x2d')]=_0x49273f[_0x5aef('0x2d')];recordings[_0x49273f[_0x5aef('0x6')]]['connectedlinename']=_0x49273f[_0x5aef('0x2e')];if(recordings[_0x49273f[_0x5aef('0x6')]][_0x5aef('0x2f')]==_0x5aef('0x30')&&recordings[_0x49273f[_0x5aef('0x6')]][_0x5aef('0x7')]){recordings[_0x49273f[_0x5aef('0x6')]][_0x5aef('0x2d')]=recordings[_0x49273f['uniqueid']][_0x5aef('0x7')];recordings[_0x49273f[_0x5aef('0x6')]]['connectedlinename']='';}recordings[_0x49273f['uniqueid']]['monitors'][_0x5aef('0x31')](function(_0x3315c3){var _0x528cc5=_['clone'](recordings[_0x49273f[_0x5aef('0x6')]]);_0x528cc5[_0x5aef('0x21')]=_0x3315c3[_0x5aef('0x21')];writeDB(_0x528cc5);});delete recordings[_0x49273f['uniqueid']];}}catch(_0x169a33){utils[_0x5aef('0x15')](util[_0x5aef('0x4')](_0x5aef('0x32'),_0x49273f[_0x5aef('0x6')]),_0x169a33);}};exports['newexten']=function(_0x1066dd){try{if(!_['isNil'](recordings[_0x1066dd[_0x5aef('0x6')]])){utils[_0x5aef('0x16')](util['format'](_0x5aef('0x33'),_0x1066dd[_0x5aef('0x6')]),_0x1066dd);utils['info'](util['format'](_0x5aef('0x34'),_0x1066dd[_0x5aef('0x6')],_0x1066dd['application'],_0x1066dd['appdata']));if(_0x1066dd[_0x5aef('0x35')][_0x5aef('0x36')]()==_0x5aef('0x37')&&_[_0x5aef('0x38')](_0x1066dd[_0x5aef('0x39')][_0x5aef('0x36')](),_0x5aef('0x3a'))){var _0x2c1ad2=_0x1066dd[_0x5aef('0x39')][_0x5aef('0x3b')]('=');var _0x427da7=_0x2c1ad2[0x0][_0x5aef('0x3c')](_0x2c1ad2[0x0]['lastIndexOf']('(')+0x1,_0x2c1ad2[0x0][_0x5aef('0x3d')](')'));var _0x1d6e33=_0x2c1ad2[0x1];recordings[_0x1066dd[_0x5aef('0x6')]][_0x427da7]=_0x1d6e33;}}}catch(_0x437e0a){utils[_0x5aef('0x15')](util[_0x5aef('0x4')](_0x5aef('0x33'),_0x1066dd[_0x5aef('0x6')]),_0x437e0a);}};exports[_0x5aef('0x3e')]=function(_0x816321){try{if(!_[_0x5aef('0x18')](recordings[_0x816321['uniqueid']])){utils[_0x5aef('0x16')](util[_0x5aef('0x4')](_0x5aef('0x3f'),_0x816321['uniqueid']),_0x816321);utils['info'](util[_0x5aef('0x4')](_0x5aef('0x40'),_0x816321['uniqueid'],_0x816321[_0x5aef('0x41')]));recordings[_0x816321['uniqueid']]['queue']=_0x816321[_0x5aef('0x41')];}}catch(_0x50cd73){utils[_0x5aef('0x15')](util[_0x5aef('0x4')](_0x5aef('0x3f'),_0x816321[_0x5aef('0x6')]),_0x50cd73);}}; \ No newline at end of file +var _0xcc2d=['startsWith','toLowerCase','cdr','split','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','isNil','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','monitors','push','debug','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set'];(function(_0x2c6336,_0x1fb3a4){var _0x5b07ec=function(_0x1cbbd9){while(--_0x1cbbd9){_0x2c6336['push'](_0x2c6336['shift']());}};_0x5b07ec(++_0x1fb3a4);}(_0xcc2d,0x7d));var _0xdcc2=function(_0x33a91a,_0x4a2db5){_0x33a91a=_0x33a91a-0x0;var _0x284314=_0xcc2d[_0x33a91a];return _0x284314;};'use strict';var _=require(_0xdcc2('0x0'));var util=require(_0xdcc2('0x1'));var utils=require(_0xdcc2('0x2'));var recordings={};function writeDB(_0x3ad1f2){utils['info'](util[_0xdcc2('0x3')](_0xdcc2('0x4'),_0x3ad1f2['uniqueid']));if(_0x3ad1f2[_0xdcc2('0x5')]){utils['getUserByInternal'](_0x3ad1f2[_0xdcc2('0x5')])['then'](function(_0x179caf){if(_0x179caf){_0x3ad1f2[_0xdcc2('0x6')]=_0x179caf['name'];_0x3ad1f2[_0xdcc2('0x7')]=_0x179caf['id'];}utils[_0xdcc2('0x8')](_0xdcc2('0x9'),_0x3ad1f2);});}else{utils[_0xdcc2('0x8')](_0xdcc2('0x9'),_0x3ad1f2);}}exports[_0xdcc2('0xa')]=function(_0x5c0b96){try{utils['debug'](util[_0xdcc2('0x3')](_0xdcc2('0xb'),_0x5c0b96[_0xdcc2('0xc')]),_0x5c0b96);if(_0x5c0b96[_0xdcc2('0xc')]==_0x5c0b96[_0xdcc2('0xd')]){utils['info'](util[_0xdcc2('0x3')](_0xdcc2('0xe'),_0x5c0b96[_0xdcc2('0xc')],_0x5c0b96[_0xdcc2('0xf')],_0x5c0b96[_0xdcc2('0x10')]));recordings[_0x5c0b96[_0xdcc2('0xc')]]={'uniqueid':_0x5c0b96[_0xdcc2('0xc')],'accountcode':_0x5c0b96['accountcode'],'exten':_0x5c0b96[_0xdcc2('0x10')],'context':_0x5c0b96[_0xdcc2('0xf')],'channel':_0x5c0b96[_0xdcc2('0x11')],'monitors':[]};}}catch(_0x1cf3af){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0xb'),_0x5c0b96[_0xdcc2('0xc')]),_0x1cf3af);}};exports['newstate']=function(_0x37fedb){try{utils['debug'](util[_0xdcc2('0x3')]('[%s][recordings][newstate]',_0x37fedb['uniqueid']),_0x37fedb);if(!_[_0xdcc2('0x13')](recordings[_0x37fedb[_0xdcc2('0xc')]])&&_0x37fedb[_0xdcc2('0x14')]==0x6){utils[_0xdcc2('0x15')](util[_0xdcc2('0x3')](_0xdcc2('0x16'),_0x37fedb['uniqueid'],_0x37fedb['context'],_0x37fedb[_0xdcc2('0x11')]));}else if(!_['isNil'](recordings[_0x37fedb[_0xdcc2('0xd')]])&&_0x37fedb[_0xdcc2('0x14')]==0x6&&_0x37fedb[_0xdcc2('0xf')]!='transfer'){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x37fedb[_0xdcc2('0xc')],_0x37fedb[_0xdcc2('0xd')],_0x37fedb['context'],_0x37fedb[_0xdcc2('0x11')]));recordings[_0x37fedb[_0xdcc2('0xd')]][_0xdcc2('0x5')]=_0x37fedb['accountcode'];}}catch(_0x44ac10){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0x17'),_0x37fedb[_0xdcc2('0xc')]),_0x44ac10);}};exports[_0xdcc2('0x18')]=function(_0x188a71){try{if(!_[_0xdcc2('0x13')](_0x188a71['variable'])&&!_['isNil'](_0x188a71[_0xdcc2('0x19')][_0xdcc2('0x1a')])){utils['debug'](util[_0xdcc2('0x3')](_0xdcc2('0x1b'),_0x188a71[_0xdcc2('0xc')]),_0x188a71);utils[_0xdcc2('0x15')](util[_0xdcc2('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x188a71['uniqueid'],_0x188a71[_0xdcc2('0x19')],_0x188a71[_0xdcc2('0x1c')]));if(_[_0xdcc2('0x1d')](_0x188a71[_0xdcc2('0x1c')],_0xdcc2('0x1e'))){_0x188a71[_0xdcc2('0x1c')]=_0x188a71['value']['replace'](_0xdcc2('0x1e'),_0xdcc2('0x1f'));}if(recordings[_0x188a71[_0xdcc2('0xd')]]){var _0x5c7a1d=_['find'](recordings[_0x188a71['linkedid']][_0xdcc2('0x20')],{'value':_0x188a71[_0xdcc2('0x1c')]});if(_[_0xdcc2('0x13')](_0x5c7a1d)){recordings[_0x188a71['linkedid']][_0xdcc2('0x20')][_0xdcc2('0x21')]({'value':_0x188a71[_0xdcc2('0x1c')]});}}}}catch(_0x23aace){utils['error'](util[_0xdcc2('0x3')](_0xdcc2('0x1b'),_0x188a71[_0xdcc2('0xc')]),_0x23aace);}};exports['hangup']=function(_0x4070c3){try{if(!_[_0xdcc2('0x13')](recordings[_0x4070c3['uniqueid']])){utils[_0xdcc2('0x22')](util[_0xdcc2('0x3')](_0xdcc2('0x23'),_0x4070c3[_0xdcc2('0xc')]),_0x4070c3);utils[_0xdcc2('0x15')](util['format'](_0xdcc2('0x24'),_0x4070c3[_0xdcc2('0xc')],_0x4070c3[_0xdcc2('0x25')],_0x4070c3[_0xdcc2('0x26')],_0x4070c3['cause-txt']));recordings[_0x4070c3[_0xdcc2('0xc')]]['calleridnum']=_0x4070c3['calleridnum'];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x26')]=_0x4070c3['calleridname'];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x27')]=_0x4070c3[_0xdcc2('0x27')];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x28')]=_0x4070c3[_0xdcc2('0x28')];if(recordings[_0x4070c3[_0xdcc2('0xc')]]['type']==_0xdcc2('0x29')&&recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x5')]){recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x27')]=recordings[_0x4070c3[_0xdcc2('0xc')]]['accountcode'];recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x28')]='';}recordings[_0x4070c3[_0xdcc2('0xc')]][_0xdcc2('0x20')][_0xdcc2('0x2a')](function(_0x6b3cc5){var _0x11e54c=_[_0xdcc2('0x2b')](recordings[_0x4070c3[_0xdcc2('0xc')]]);_0x11e54c[_0xdcc2('0x1c')]=_0x6b3cc5[_0xdcc2('0x1c')];writeDB(_0x11e54c);});delete recordings[_0x4070c3[_0xdcc2('0xc')]];}}catch(_0x1ddea0){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0x23'),_0x4070c3[_0xdcc2('0xc')]),_0x1ddea0);}};exports[_0xdcc2('0x2c')]=function(_0x14a62a){try{if(!_['isNil'](recordings[_0x14a62a[_0xdcc2('0xc')]])){utils['debug'](util[_0xdcc2('0x3')]('[%s][recordings][newexten]',_0x14a62a[_0xdcc2('0xc')]),_0x14a62a);utils['info'](util['format'](_0xdcc2('0x2d'),_0x14a62a[_0xdcc2('0xc')],_0x14a62a[_0xdcc2('0x2e')],_0x14a62a[_0xdcc2('0x2f')]));if(_0x14a62a[_0xdcc2('0x2e')]['toLowerCase']()==_0xdcc2('0x30')&&_[_0xdcc2('0x31')](_0x14a62a[_0xdcc2('0x2f')][_0xdcc2('0x32')](),_0xdcc2('0x33'))){var _0x54de02=_0x14a62a[_0xdcc2('0x2f')][_0xdcc2('0x34')]('=');var _0x4cacb2=_0x54de02[0x0]['substring'](_0x54de02[0x0]['lastIndexOf']('(')+0x1,_0x54de02[0x0][_0xdcc2('0x35')](')'));var _0x1dcd08=_0x54de02[0x1];recordings[_0x14a62a[_0xdcc2('0xc')]][_0x4cacb2]=_0x1dcd08;}}}catch(_0x4f19af){utils[_0xdcc2('0x12')](util[_0xdcc2('0x3')](_0xdcc2('0x36'),_0x14a62a[_0xdcc2('0xc')]),_0x4f19af);}};exports['queuecallerjoin']=function(_0x12af14){try{if(!_[_0xdcc2('0x13')](recordings[_0x12af14['uniqueid']])){utils[_0xdcc2('0x22')](util[_0xdcc2('0x3')](_0xdcc2('0x37'),_0x12af14['uniqueid']),_0x12af14);utils[_0xdcc2('0x15')](util['format'](_0xdcc2('0x38'),_0x12af14[_0xdcc2('0xc')],_0x12af14[_0xdcc2('0x39')]));recordings[_0x12af14[_0xdcc2('0xc')]][_0xdcc2('0x39')]=_0x12af14[_0xdcc2('0x39')];}}catch(_0x30f464){utils['error'](util['format'](_0xdcc2('0x37'),_0x12af14[_0xdcc2('0xc')]),_0x30f464);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 72b3b90..a2ae1da 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 _0x4b55=['origtransfereruniqueid','uniqueid','request','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0x33a326,_0x2735b7){var _0x2774bf=function(_0x23ca54){while(--_0x23ca54){_0x33a326['push'](_0x33a326['shift']());}};_0x2774bf(++_0x2735b7);}(_0x4b55,0xcc));var _0x54b5=function(_0x529f39,_0x6e10f5){_0x529f39=_0x529f39-0x0;var _0x3d84c3=_0x4b55[_0x529f39];return _0x3d84c3;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x54b5('0x0'));function writeDB(_0x1aad42){utils[_0x54b5('0x1')](util[_0x54b5('0x2')](_0x54b5('0x3'),_0x1aad42[_0x54b5('0x4')]===_0x54b5('0x5')?_0x1aad42[_0x54b5('0x6')]:_0x1aad42[_0x54b5('0x7')],_0x1aad42[_0x54b5('0x4')]));utils[_0x54b5('0x8')]('CreateVoiceTransferReport',_0x1aad42);}exports[_0x54b5('0x9')]=function(_0x98bc8e){try{utils['debug'](util[_0x54b5('0x2')](_0x54b5('0xa'),_0x98bc8e[_0x54b5('0x7')]),_0x98bc8e);utils[_0x54b5('0x1')](util[_0x54b5('0x2')](_0x54b5('0xb'),_0x98bc8e[_0x54b5('0x7')],_0x98bc8e[_0x54b5('0xc')],_0x98bc8e[_0x54b5('0xd')],_0x98bc8e[_0x54b5('0xe')],_0x98bc8e[_0x54b5('0xf')]));_0x98bc8e[_0x54b5('0x4')]=_0x54b5('0x10');writeDB(_0x98bc8e);}catch(_0x3625f3){utils[_0x54b5('0x11')](util[_0x54b5('0x2')](_0x54b5('0xa'),_0x98bc8e[_0x54b5('0x7')]),_0x3625f3);}};exports[_0x54b5('0x12')]=function(_0x4e0682){try{utils[_0x54b5('0x13')](util[_0x54b5('0x2')](_0x54b5('0x14'),_0x4e0682[_0x54b5('0x6')]),_0x4e0682);utils['info'](util[_0x54b5('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4e0682['origtransfereruniqueid'],_0x4e0682[_0x54b5('0x15')],_0x4e0682[_0x54b5('0x16')],_0x4e0682[_0x54b5('0x17')],_0x4e0682[_0x54b5('0x18')]));_0x4e0682=_[_0x54b5('0x19')](_0x4e0682,{'transfererchannel':_0x4e0682[_0x54b5('0x1a')],'transferercalleridnum':_0x4e0682['origtransferercalleridnum'],'transferercalleridname':_0x4e0682['origtransferercalleridname'],'transfererconnectedlinenum':_0x4e0682[_0x54b5('0x1b')],'transfererconnectedlinename':_0x4e0682['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4e0682[_0x54b5('0x1c')],'transferercontext':_0x4e0682['secondtransferercontext'],'transfererexten':_0x4e0682[_0x54b5('0x1d')],'transfererlinkedid':_0x4e0682[_0x54b5('0x1e')],'context':_0x4e0682[_0x54b5('0x1f')],'extension':_0x4e0682[_0x54b5('0x20')],'type':_0x54b5('0x5')});if(_[_0x54b5('0x21')](_0x4e0682[_0x54b5('0x22')])){_0x4e0682=_[_0x54b5('0x19')](_0x4e0682,{'transfereechannel':_0x4e0682[_0x54b5('0x23')],'transfereecalleridnum':_0x4e0682[_0x54b5('0x17')],'transfereecalleridname':_0x4e0682[_0x54b5('0x18')],'transfereeconnectedlinenum':_0x4e0682[_0x54b5('0x24')],'transfereeconnectedlinename':_0x4e0682[_0x54b5('0x25')],'transfereeaccountcode':_0x4e0682[_0x54b5('0x26')],'transfereecontext':_0x4e0682[_0x54b5('0x27')],'transfereeexten':_0x4e0682[_0x54b5('0x28')],'transfereelinkedid':_0x4e0682[_0x54b5('0x29')]});}writeDB(_0x4e0682);}catch(_0x591fb9){utils[_0x54b5('0x11')](util[_0x54b5('0x2')]('[%s][transfers][attendedtransfer]',_0x4e0682[_0x54b5('0x6')]),_0x591fb9);}}; \ No newline at end of file +var _0xf98e=['transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign'];(function(_0xbfa874,_0x41c78f){var _0x411bca=function(_0x42fd84){while(--_0x42fd84){_0xbfa874['push'](_0xbfa874['shift']());}};_0x411bca(++_0x41c78f);}(_0xf98e,0x1e9));var _0xef98=function(_0x429851,_0xd7de37){_0x429851=_0x429851-0x0;var _0x2f70c8=_0xf98e[_0x429851];return _0x2f70c8;};'use strict';var _=require(_0xef98('0x0'));var util=require('util');var utils=require(_0xef98('0x1'));function writeDB(_0x30debe){utils[_0xef98('0x2')](util[_0xef98('0x3')](_0xef98('0x4'),_0x30debe[_0xef98('0x5')]===_0xef98('0x6')?_0x30debe[_0xef98('0x7')]:_0x30debe[_0xef98('0x8')],_0x30debe[_0xef98('0x5')]));utils['request'](_0xef98('0x9'),_0x30debe);}exports[_0xef98('0xa')]=function(_0x4f773e){try{utils[_0xef98('0xb')](util[_0xef98('0x3')]('[%s][transfers][blindtransfer]',_0x4f773e[_0xef98('0x8')]),_0x4f773e);utils[_0xef98('0x2')](util[_0xef98('0x3')](_0xef98('0xc'),_0x4f773e[_0xef98('0x8')],_0x4f773e[_0xef98('0xd')],_0x4f773e['transferercalleridname'],_0x4f773e['transfereecalleridnum'],_0x4f773e[_0xef98('0xe')]));_0x4f773e[_0xef98('0x5')]=_0xef98('0xf');writeDB(_0x4f773e);}catch(_0x4bfa3b){utils['error'](util[_0xef98('0x3')](_0xef98('0x10'),_0x4f773e[_0xef98('0x8')]),_0x4bfa3b);}};exports[_0xef98('0x11')]=function(_0x1a1dbe){try{utils[_0xef98('0xb')](util[_0xef98('0x3')](_0xef98('0x12'),_0x1a1dbe['origtransfereruniqueid']),_0x1a1dbe);utils[_0xef98('0x2')](util['format'](_0xef98('0x13'),_0x1a1dbe[_0xef98('0x7')],_0x1a1dbe[_0xef98('0x14')],_0x1a1dbe['origtransferercalleridname'],_0x1a1dbe[_0xef98('0x15')],_0x1a1dbe['transfertargetcalleridname']));_0x1a1dbe=_['assign'](_0x1a1dbe,{'transfererchannel':_0x1a1dbe['origtransfererchannel'],'transferercalleridnum':_0x1a1dbe['origtransferercalleridnum'],'transferercalleridname':_0x1a1dbe['origtransferercalleridname'],'transfererconnectedlinenum':_0x1a1dbe['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1a1dbe[_0xef98('0x16')],'transfereraccountcode':_0x1a1dbe[_0xef98('0x17')],'transferercontext':_0x1a1dbe[_0xef98('0x18')],'transfererexten':_0x1a1dbe[_0xef98('0x19')],'transfererlinkedid':_0x1a1dbe['origtransfererlinkedid'],'context':_0x1a1dbe[_0xef98('0x1a')],'extension':_0x1a1dbe[_0xef98('0x1b')],'type':'attended'});if(_[_0xef98('0x1c')](_0x1a1dbe[_0xef98('0x1d')])){_0x1a1dbe=_[_0xef98('0x1e')](_0x1a1dbe,{'transfereechannel':_0x1a1dbe[_0xef98('0x1f')],'transfereecalleridnum':_0x1a1dbe['transfertargetcalleridnum'],'transfereecalleridname':_0x1a1dbe[_0xef98('0x20')],'transfereeconnectedlinenum':_0x1a1dbe[_0xef98('0x21')],'transfereeconnectedlinename':_0x1a1dbe[_0xef98('0x22')],'transfereeaccountcode':_0x1a1dbe[_0xef98('0x23')],'transfereecontext':_0x1a1dbe[_0xef98('0x24')],'transfereeexten':_0x1a1dbe[_0xef98('0x25')],'transfereelinkedid':_0x1a1dbe[_0xef98('0x26')]});}writeDB(_0x1a1dbe);}catch(_0x354026){utils[_0xef98('0x27')](util[_0xef98('0x3')]('[%s][transfers][attendedtransfer]',_0x1a1dbe[_0xef98('0x7')]),_0x354026);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b82b2b9..57fba38 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 _0x89ab=['stringify','result','length','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','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then','catch','GetUser','internal','[utils][getUser]\x20where:%s'];(function(_0x329dd0,_0x47e04f){var _0x4f5b90=function(_0x7d2728){while(--_0x7d2728){_0x329dd0['push'](_0x329dd0['shift']());}};_0x4f5b90(++_0x47e04f);}(_0x89ab,0x16f));var _0xb89a=function(_0x1b10ce,_0x12c2ea){_0x1b10ce=_0x1b10ce-0x0;var _0x3ae82d=_0x89ab[_0x1b10ce];return _0x3ae82d;};'use strict';var BPromise=require(_0xb89a('0x0'));var jayson=require(_0xb89a('0x1'));var moment=require(_0xb89a('0x2'));var util=require(_0xb89a('0x3'));var client=jayson[_0xb89a('0x4')][_0xb89a('0x5')]({'port':0x2329});var logger=require(_0xb89a('0x6'))('xdr');exports[_0xb89a('0x7')]=function(_0x5665db,_0x573e58){logger[_0xb89a('0x7')](_0x5665db,_0x573e58?util[_0xb89a('0x8')](_0x573e58,{'showHidden':![],'depth':null}):'');};exports[_0xb89a('0x9')]=function(_0x19fd43,_0x57a1bd){logger['debug'](_0x19fd43,_0x57a1bd?util[_0xb89a('0x8')](_0x57a1bd,{'showHidden':![],'depth':null}):'');};exports[_0xb89a('0xa')]=function(_0xa2be76,_0x5aef1e){logger['error'](_0xa2be76,_0x5aef1e?util[_0xb89a('0x8')](_0x5aef1e,{'showHidden':![],'depth':null}):'');};exports[_0xb89a('0xb')]=function(_0xdfcff1,_0x14d3cd){return client[_0xb89a('0xb')](_0xdfcff1,{'body':_0x14d3cd})[_0xb89a('0xc')](function(_0x4060fb){logger[_0xb89a('0x9')]('[utils][request]\x20name:%s',_0xdfcff1,_0x4060fb?util['inspect'](_0x4060fb,{'showHidden':![],'depth':null}):'');})[_0xb89a('0xd')](function(_0x550d45){logger[_0xb89a('0xa')]('[utils][request]\x20name:%s',_0xdfcff1,_0x550d45?util['inspect'](_0x550d45,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2e21f4){return client[_0xb89a('0xb')](_0xb89a('0xe'),{'options':{'raw':!![],'attributes':['id',_0xb89a('0xf'),'name','interface'],'where':_0x2e21f4,'limit':0x1}})[_0xb89a('0xc')](function(_0x16d8b7){logger[_0xb89a('0x9')](_0xb89a('0x10'),JSON[_0xb89a('0x11')](_0x2e21f4),_0x16d8b7?util['inspect'](_0x16d8b7,{'showHidden':![],'depth':null}):'');return _0x16d8b7[_0xb89a('0x12')][_0xb89a('0x13')]?_0x16d8b7[_0xb89a('0x12')][0x0]:null;});}exports[_0xb89a('0x14')]=function(_0x5e9fd5){return new BPromise(function(_0x45615f,_0x24829b){if(_0x5e9fd5){return getUser({'internal':_0x5e9fd5})[_0xb89a('0xc')](function(_0x95602b){logger[_0xb89a('0x7')](_0xb89a('0x15'),_0x5e9fd5,_0x95602b?_0xb89a('0x16'):_0xb89a('0x17'));return _0x45615f(_0x95602b);})[_0xb89a('0xd')](function(_0x1b77dd){logger[_0xb89a('0xa')](_0xb89a('0x18'),_0x1b77dd?util[_0xb89a('0x8')](_0x1b77dd,{'showHidden':![],'depth':null}):'');return _0x45615f(null);});}return _0x45615f(null);});};exports['getUserByInterface']=function(_0x326886){return new BPromise(function(_0x46364d,_0x30627d){if(_0x326886){return getUser({'interface':_0x326886})['then'](function(_0x7721e2){logger[_0xb89a('0x7')](_0xb89a('0x19'),_0x326886,_0x7721e2?'found':_0xb89a('0x17'));return _0x46364d(_0x7721e2);})[_0xb89a('0xd')](function(_0x2ba760){logger[_0xb89a('0xa')](_0xb89a('0x1a'),_0x2ba760?util['inspect'](_0x2ba760,{'showHidden':![],'depth':null}):'');return _0x46364d(null);});}return _0x46364d(null);});};exports[_0xb89a('0x1b')]=function(_0x15334a){return new BPromise(function(_0x10222b,_0x560e13){if(_0x15334a){return getUser({'name':_0x15334a})[_0xb89a('0xc')](function(_0x44b073){logger[_0xb89a('0x7')](_0xb89a('0x1c'),_0x15334a,_0x44b073?_0xb89a('0x16'):_0xb89a('0x17'));return _0x10222b(_0x44b073);})[_0xb89a('0xd')](function(_0x320254){logger[_0xb89a('0xa')]('[utils][getUserByName]',_0x320254?util['inspect'](_0x320254,{'showHidden':![],'depth':null}):'');return _0x10222b(null);});}return _0x10222b(null);});};exports[_0xb89a('0x1d')]=function(_0x1b17f1){return new BPromise(function(_0x171d54,_0x311c84){if(_0x1b17f1){return client[_0xb89a('0xb')](_0xb89a('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xb89a('0x1f'),'type',_0xb89a('0x20'),_0xb89a('0x21')],'where':{'name':_0x1b17f1},'limit':0x1}})[_0xb89a('0xc')](function(_0x55d642){logger[_0xb89a('0x9')](_0xb89a('0x22'),_0x1b17f1,_0x55d642?util['inspect'](_0x55d642,{'showHidden':![],'depth':null}):'');logger[_0xb89a('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1b17f1,_0x55d642?_0xb89a('0x16'):_0xb89a('0x17'));return _0x171d54(_0x55d642[_0xb89a('0x12')][_0xb89a('0x13')]?_0x55d642[_0xb89a('0x12')][0x0]:null);})['catch'](function(_0x1d40c1){logger[_0xb89a('0xa')](_0xb89a('0x23'),_0x1d40c1?util[_0xb89a('0x8')](_0x1d40c1,{'showHidden':![],'depth':null}):'');return _0x171d54(null);});}return _0x171d54(null);});};exports[_0xb89a('0x24')]=function(_0x1ec953,_0x14e03d){return moment(_0x1ec953)[_0xb89a('0x25')](_0x14e03d,_0xb89a('0x26'))['format'](_0xb89a('0x27'));};exports[_0xb89a('0x28')]=function(_0x381f1f,_0x2ed91b){return moment(_0x381f1f)['subtract'](_0x2ed91b,_0xb89a('0x26'))[_0xb89a('0x29')](_0xb89a('0x27'));};exports[_0xb89a('0x2a')]=function(_0x222dcc,_0x12f3f3){return moment(_0x222dcc)[_0xb89a('0x2b')](moment(_0x12f3f3),_0xb89a('0x26'));};exports[_0xb89a('0x2c')]=function(_0xc4bf6,_0x480cdb){return parseInt(_0xc4bf6,0xa)+parseInt(_0x480cdb,0xa);};exports[_0xb89a('0x2d')]=function(){return moment()[_0xb89a('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xb89a('0x2e')]=function(_0x14b686,_0x15059e){if(_0x15059e){return moment(_0x14b686)[_0xb89a('0x2e')](_0x15059e);}return!![];};exports[_0xb89a('0x2f')]=function(_0x2097c2,_0x20d14c){if(_0x20d14c){return moment(_0x2097c2)['isBefore'](_0x20d14c);}else if(_0x2097c2){return!![];}return![];}; \ No newline at end of file +var _0x625a=['xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','length','getUserByInternal','found','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http'];(function(_0x4a91c1,_0xe61fec){var _0x10feda=function(_0x453834){while(--_0x453834){_0x4a91c1['push'](_0x4a91c1['shift']());}};_0x10feda(++_0xe61fec);}(_0x625a,0x15a));var _0xa625=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x625a[_0x3cea78];return _0x33b66b;};'use strict';var BPromise=require(_0xa625('0x0'));var jayson=require(_0xa625('0x1'));var moment=require(_0xa625('0x2'));var util=require(_0xa625('0x3'));var client=jayson[_0xa625('0x4')][_0xa625('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xa625('0x6'));exports[_0xa625('0x7')]=function(_0x4f6226,_0x1d3866){logger[_0xa625('0x7')](_0x4f6226,_0x1d3866?util['inspect'](_0x1d3866,{'showHidden':![],'depth':null}):'');};exports[_0xa625('0x8')]=function(_0x597403,_0x18e302){logger['debug'](_0x597403,_0x18e302?util[_0xa625('0x9')](_0x18e302,{'showHidden':![],'depth':null}):'');};exports[_0xa625('0xa')]=function(_0x5e7a27,_0xb414cb){logger[_0xa625('0xa')](_0x5e7a27,_0xb414cb?util[_0xa625('0x9')](_0xb414cb,{'showHidden':![],'depth':null}):'');};exports[_0xa625('0xb')]=function(_0x3ace6d,_0x53e6ee){return client[_0xa625('0xb')](_0x3ace6d,{'body':_0x53e6ee})['then'](function(_0x1df2bf){logger['debug'](_0xa625('0xc'),_0x3ace6d,_0x1df2bf?util[_0xa625('0x9')](_0x1df2bf,{'showHidden':![],'depth':null}):'');})[_0xa625('0xd')](function(_0x86e1b7){logger['error']('[utils][request]\x20name:%s',_0x3ace6d,_0x86e1b7?util['inspect'](_0x86e1b7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4081bd){return client[_0xa625('0xb')](_0xa625('0xe'),{'options':{'raw':!![],'attributes':['id',_0xa625('0xf'),_0xa625('0x10'),_0xa625('0x11')],'where':_0x4081bd,'limit':0x1}})[_0xa625('0x12')](function(_0x1a68a2){logger[_0xa625('0x8')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x4081bd),_0x1a68a2?util['inspect'](_0x1a68a2,{'showHidden':![],'depth':null}):'');return _0x1a68a2['result'][_0xa625('0x13')]?_0x1a68a2['result'][0x0]:null;});}exports[_0xa625('0x14')]=function(_0x2b7a6c){return new BPromise(function(_0x149947,_0x260b57){if(_0x2b7a6c){return getUser({'internal':_0x2b7a6c})['then'](function(_0x210222){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2b7a6c,_0x210222?_0xa625('0x15'):_0xa625('0x16'));return _0x149947(_0x210222);})[_0xa625('0xd')](function(_0xbd9dec){logger[_0xa625('0xa')]('[utils][getUserByInternal]',_0xbd9dec?util[_0xa625('0x9')](_0xbd9dec,{'showHidden':![],'depth':null}):'');return _0x149947(null);});}return _0x149947(null);});};exports['getUserByInterface']=function(_0x412642){return new BPromise(function(_0x313a32,_0x2fb9bf){if(_0x412642){return getUser({'interface':_0x412642})[_0xa625('0x12')](function(_0x1ebda1){logger[_0xa625('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x412642,_0x1ebda1?_0xa625('0x15'):_0xa625('0x16'));return _0x313a32(_0x1ebda1);})[_0xa625('0xd')](function(_0xe308ba){logger['error'](_0xa625('0x17'),_0xe308ba?util['inspect'](_0xe308ba,{'showHidden':![],'depth':null}):'');return _0x313a32(null);});}return _0x313a32(null);});};exports['getUserByName']=function(_0xcffd26){return new BPromise(function(_0x251315,_0x224562){if(_0xcffd26){return getUser({'name':_0xcffd26})[_0xa625('0x12')](function(_0x1b38b1){logger[_0xa625('0x7')](_0xa625('0x18'),_0xcffd26,_0x1b38b1?_0xa625('0x15'):_0xa625('0x16'));return _0x251315(_0x1b38b1);})[_0xa625('0xd')](function(_0x4139b5){logger[_0xa625('0xa')](_0xa625('0x19'),_0x4139b5?util[_0xa625('0x9')](_0x4139b5,{'showHidden':![],'depth':null}):'');return _0x251315(null);});}return _0x251315(null);});};exports[_0xa625('0x1a')]=function(_0x1e6496){return new BPromise(function(_0x271056,_0xb0dad9){if(_0x1e6496){return client[_0xa625('0xb')](_0xa625('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xa625('0x10'),'type',_0xa625('0x1c'),_0xa625('0x1d')],'where':{'name':_0x1e6496},'limit':0x1}})['then'](function(_0xb5ab29){logger[_0xa625('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1e6496,_0xb5ab29?util[_0xa625('0x9')](_0xb5ab29,{'showHidden':![],'depth':null}):'');logger['info'](_0xa625('0x1e'),_0x1e6496,_0xb5ab29?_0xa625('0x15'):_0xa625('0x16'));return _0x271056(_0xb5ab29[_0xa625('0x1f')][_0xa625('0x13')]?_0xb5ab29['result'][0x0]:null);})[_0xa625('0xd')](function(_0x4d4df8){logger[_0xa625('0xa')](_0xa625('0x20'),_0x4d4df8?util[_0xa625('0x9')](_0x4d4df8,{'showHidden':![],'depth':null}):'');return _0x271056(null);});}return _0x271056(null);});};exports['addTime']=function(_0x2821e1,_0x24d579){return moment(_0x2821e1)[_0xa625('0x21')](_0x24d579,_0xa625('0x22'))[_0xa625('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa625('0x24')]=function(_0x2ee683,_0x357160){return moment(_0x2ee683)[_0xa625('0x25')](_0x357160,_0xa625('0x22'))['format'](_0xa625('0x26'));};exports[_0xa625('0x27')]=function(_0x344c57,_0x3816a1){return moment(_0x344c57)[_0xa625('0x28')](moment(_0x3816a1),_0xa625('0x22'));};exports['sumTime']=function(_0x1e9d3b,_0x145740){return parseInt(_0x1e9d3b,0xa)+parseInt(_0x145740,0xa);};exports[_0xa625('0x29')]=function(){return moment()[_0xa625('0x23')](_0xa625('0x26'));};exports[_0xa625('0x2a')]=function(_0x2b6d96,_0xe18013){if(_0xe18013){return moment(_0x2b6d96)[_0xa625('0x2a')](_0xe18013);}return!![];};exports[_0xa625('0x2b')]=function(_0x220080,_0x36e86f){if(_0x36e86f){return moment(_0x220080)[_0xa625('0x2b')](_0x36e86f);}else if(_0x220080){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 20b2af9..112ed6e 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefc7=['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','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','setupLoggers','lodash','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','user','then','no-user','data','timestamp','catch','error','auth','set','client-side-logger','use'];(function(_0x583c66,_0x19d269){var _0x144ca9=function(_0x9ac69){while(--_0x9ac69){_0x583c66['push'](_0x583c66['shift']());}};_0x144ca9(++_0x19d269);}(_0xefc7,0x157));var _0x7efc=function(_0x4f97f6,_0x3124b6){_0x4f97f6=_0x4f97f6-0x0;var _0x5c7177=_0xefc7[_0x4f97f6];return _0x5c7177;};var fs=require('fs-extra');var _=require(_0x7efc('0x0'));var ewinston=require('express-winston');var path=require('path');var util=require(_0x7efc('0x1'));var fileLogger=require(_0x7efc('0x2'))[_0x7efc('0x3')];var safeTemplate=require(_0x7efc('0x4'))['safeTemplate'];var maskSensitiveData=require(_0x7efc('0x5'))[_0x7efc('0x6')];function ClientSideLogger(){function _0x136f2d(_0x50beba){var _0x5ca73d=path[_0x7efc('0x7')](_0x7efc('0x8'),_0x7efc('0x9'),_0x7efc('0xa'));var _0x503c25=path[_0x7efc('0x7')](_0x7efc('0xb'),_0x50beba[_0x7efc('0xc')]+'-'+_0x50beba[_0x7efc('0xd')]);return fs['ensureDir'](path[_0x7efc('0x7')](_0x5ca73d,_0x503c25))['then'](function(){var _0x1ca732=fileLogger(_0x7efc('0xb'),path['join'](_0x5ca73d,_0x503c25));return _0x1ca732;})['catch'](function(_0x2578e7){throw _0x2578e7;});}this[_0x7efc('0x9')]=function(_0x3edd4c,_0x30dbf7,_0x5e867e,_0x13a4c8){return _0x136f2d(_0x3edd4c[_0x7efc('0xe')])[_0x7efc('0xf')](function(_0x38d2ba){var _0xb7baa6=_0x38d2ba[_0x30dbf7];return _0xb7baa6;})[_0x7efc('0xf')](function(_0x2c012b){var _0x5387ea=_0x3edd4c['user']?_0x3edd4c[_0x7efc('0xe')]['id']:_0x7efc('0x10');var _0x56d89f=_0x13a4c8[_0x7efc('0x11')];var _0x473d19=_0x13a4c8[_0x7efc('0x12')];var _0x3e4ed1=new Date(Number(_0x473d19));return _0x2c012b(_0x5387ea,_0x3e4ed1,_0x5e867e,_0x56d89f);})[_0x7efc('0x13')](function(_0x2268c6){fileLogger('client')[_0x7efc('0x14')](_0x2268c6);});};}function setupLoggers(_0x250f1f){return new Promise(function(_0x1c83d5){var _0x2a7e0f=new ClientSideLogger();var _0x5719a7=fileLogger('api');var _0x5daaeb=fileLogger(_0x7efc('0x15'));_0x250f1f[_0x7efc('0x16')](_0x7efc('0x17'),_0x2a7e0f);_0x250f1f[_0x7efc('0x18')](ewinston[_0x7efc('0x19')]({'winstonInstance':_0x5719a7,'meta':![],'statusLevels':!![],'msg':function(_0x112812,_0x57e796){var _0x4fa98f=_0x7efc('0x1a');if(!_[_0x7efc('0x1b')](_0x112812[_0x7efc('0x1c')])){_0x4fa98f+=_0x7efc('0x1d');var _0x58062c=_0x112812[_0x7efc('0x1c')];maskSensitiveData(_0x58062c);}return safeTemplate(util[_0x7efc('0x1e')](_0x4fa98f,_0x112812[_0x7efc('0x1f')],_0x112812[_0x7efc('0x20')]['x-forwarded-for']?_0x112812[_0x7efc('0x20')][_0x7efc('0x21')]:_0x112812[_0x7efc('0x22')][_0x7efc('0x23')]||_0x112812['ip'],_0x112812[_0x7efc('0x24')],_0x57e796[_0x7efc('0x25')],_0x57e796[_0x7efc('0x26')],_0x112812[_0x7efc('0xe')]?_0x112812[_0x7efc('0xe')]['id']:null,_0x112812['user']?_0x112812[_0x7efc('0xe')][_0x7efc('0xd')]:null,_0x112812['user']?_0x112812[_0x7efc('0xe')][_0x7efc('0xc')]:null,_0x58062c?util[_0x7efc('0x27')](_0x58062c,![],null):''));}}));_0x250f1f[_0x7efc('0x18')](ewinston[_0x7efc('0x19')]({'winstonInstance':_0x5daaeb,'meta':![],'statusLevels':!![],'msg':function(_0x1dea93,_0x45f740){var _0x2669b5='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1dea93[_0x7efc('0x1c')]&&_0x1dea93[_0x7efc('0x1c')][_0x7efc('0x28')]&&_0x1dea93[_0x7efc('0x1c')][_0x7efc('0x29')]){_0x2669b5=_0x7efc('0x2a');}return util['format'](_0x2669b5,_0x1dea93[_0x7efc('0x1f')],_0x1dea93['headers'][_0x7efc('0x21')]?_0x1dea93[_0x7efc('0x20')][_0x7efc('0x21')]:_0x1dea93['connection'][_0x7efc('0x23')]||_0x1dea93['ip'],_0x1dea93['url'],_0x45f740[_0x7efc('0x25')],_0x45f740['responseTime'],_0x1dea93['user']?_0x1dea93['user']['id']:null,_0x1dea93['user']?_0x1dea93[_0x7efc('0xe')][_0x7efc('0xd')]:null,_0x1dea93[_0x7efc('0xe')]?_0x1dea93[_0x7efc('0xe')]['role']:null,_0x1dea93[_0x7efc('0x1c')]&&_0x1dea93['body'][_0x7efc('0x28')]?_0x1dea93[_0x7efc('0x1c')][_0x7efc('0x28')]:'other',_0x1dea93[_0x7efc('0x1c')]&&_0x1dea93[_0x7efc('0x1c')]['agent_id']?_0x1dea93['body'][_0x7efc('0x29')]:'',_0x1dea93[_0x7efc('0x1c')]&&_0x1dea93[_0x7efc('0x1c')][_0x7efc('0x2b')]?_0x1dea93[_0x7efc('0x1c')][_0x7efc('0x2b')]:'');},'ignoreRoute':function(_0x566bde){var _0x383179=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x383179[_0x7efc('0x2c')](_0x566bde[_0x7efc('0x24')]);}}));return _0x1c83d5();});}exports[_0x7efc('0x2d')]=setupLoggers; \ No newline at end of file +var _0xd605=['path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','ensureDir','then','catch','user','no-user','data','timestamp','error','api','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','other','agent_name','test','setupLoggers','fs-extra','express-winston'];(function(_0x40e454,_0xfb8102){var _0x4340e9=function(_0x28f1b2){while(--_0x28f1b2){_0x40e454['push'](_0x40e454['shift']());}};_0x4340e9(++_0xfb8102);}(_0xd605,0xf3));var _0x5d60=function(_0x448ae2,_0x309172){_0x448ae2=_0x448ae2-0x0;var _0x2bfa92=_0xd605[_0x448ae2];return _0x2bfa92;};var fs=require(_0x5d60('0x0'));var _=require('lodash');var ewinston=require(_0x5d60('0x1'));var path=require(_0x5d60('0x2'));var util=require('util');var fileLogger=require(_0x5d60('0x3'))[_0x5d60('0x4')];var safeTemplate=require(_0x5d60('0x5'))[_0x5d60('0x6')];var maskSensitiveData=require(_0x5d60('0x7'))[_0x5d60('0x8')];function ClientSideLogger(){function _0x3d856b(_0x41d1fb){var _0x23a905=path[_0x5d60('0x9')](_0x5d60('0xa'),_0x5d60('0xb'),_0x5d60('0xc'));var _0x4ecae5=path['join'](_0x5d60('0xd'),_0x41d1fb[_0x5d60('0xe')]+'-'+_0x41d1fb['name']);return fs[_0x5d60('0xf')](path['join'](_0x23a905,_0x4ecae5))[_0x5d60('0x10')](function(){var _0x39bf4c=fileLogger('client',path[_0x5d60('0x9')](_0x23a905,_0x4ecae5));return _0x39bf4c;})[_0x5d60('0x11')](function(_0x1afa0a){throw _0x1afa0a;});}this[_0x5d60('0xb')]=function(_0x104ac3,_0x21cf1d,_0x591850,_0x1e81df){return _0x3d856b(_0x104ac3[_0x5d60('0x12')])[_0x5d60('0x10')](function(_0x4d65e7){var _0x3e9818=_0x4d65e7[_0x21cf1d];return _0x3e9818;})[_0x5d60('0x10')](function(_0x1c77cc){var _0x256d25=_0x104ac3['user']?_0x104ac3[_0x5d60('0x12')]['id']:_0x5d60('0x13');var _0x3d66d0=_0x1e81df[_0x5d60('0x14')];var _0x23ad17=_0x1e81df[_0x5d60('0x15')];var _0x18294b=new Date(Number(_0x23ad17));return _0x1c77cc(_0x256d25,_0x18294b,_0x591850,_0x3d66d0);})['catch'](function(_0x337b66){fileLogger(_0x5d60('0xd'))[_0x5d60('0x16')](_0x337b66);});};}function setupLoggers(_0x498096){return new Promise(function(_0xd9b38){var _0x4a46ac=new ClientSideLogger();var _0x318042=fileLogger(_0x5d60('0x17'));var _0x45a6ed=fileLogger('auth');_0x498096[_0x5d60('0x18')]('client-side-logger',_0x4a46ac);_0x498096[_0x5d60('0x19')](ewinston['logger']({'winstonInstance':_0x318042,'meta':![],'statusLevels':!![],'msg':function(_0x4ea24f,_0x9fed5b){var _0x58d261=_0x5d60('0x1a');if(!_[_0x5d60('0x1b')](_0x4ea24f[_0x5d60('0x1c')])){_0x58d261+=_0x5d60('0x1d');var _0x139ab0=_0x4ea24f[_0x5d60('0x1c')];maskSensitiveData(_0x139ab0);}return safeTemplate(util[_0x5d60('0x1e')](_0x58d261,_0x4ea24f[_0x5d60('0x1f')],_0x4ea24f['headers']['x-forwarded-for']?_0x4ea24f['headers'][_0x5d60('0x20')]:_0x4ea24f[_0x5d60('0x21')][_0x5d60('0x22')]||_0x4ea24f['ip'],_0x4ea24f[_0x5d60('0x23')],_0x9fed5b[_0x5d60('0x24')],_0x9fed5b[_0x5d60('0x25')],_0x4ea24f['user']?_0x4ea24f[_0x5d60('0x12')]['id']:null,_0x4ea24f['user']?_0x4ea24f[_0x5d60('0x12')]['name']:null,_0x4ea24f['user']?_0x4ea24f[_0x5d60('0x12')][_0x5d60('0xe')]:null,_0x139ab0?util[_0x5d60('0x26')](_0x139ab0,![],null):''));}}));_0x498096[_0x5d60('0x19')](ewinston[_0x5d60('0x27')]({'winstonInstance':_0x45a6ed,'meta':![],'statusLevels':!![],'msg':function(_0x4af388,_0x21a55b){var _0xc1d0f7=_0x5d60('0x28');if(_0x4af388[_0x5d60('0x1c')]&&_0x4af388[_0x5d60('0x1c')][_0x5d60('0x29')]&&_0x4af388[_0x5d60('0x1c')][_0x5d60('0x2a')]){_0xc1d0f7=_0x5d60('0x2b');}return util['format'](_0xc1d0f7,_0x4af388['method'],_0x4af388['headers'][_0x5d60('0x20')]?_0x4af388[_0x5d60('0x2c')][_0x5d60('0x20')]:_0x4af388['connection'][_0x5d60('0x22')]||_0x4af388['ip'],_0x4af388[_0x5d60('0x23')],_0x21a55b[_0x5d60('0x24')],_0x21a55b['responseTime'],_0x4af388[_0x5d60('0x12')]?_0x4af388[_0x5d60('0x12')]['id']:null,_0x4af388['user']?_0x4af388[_0x5d60('0x12')]['name']:null,_0x4af388[_0x5d60('0x12')]?_0x4af388[_0x5d60('0x12')][_0x5d60('0xe')]:null,_0x4af388[_0x5d60('0x1c')]&&_0x4af388[_0x5d60('0x1c')][_0x5d60('0x29')]?_0x4af388[_0x5d60('0x1c')][_0x5d60('0x29')]:_0x5d60('0x2d'),_0x4af388['body']&&_0x4af388['body'][_0x5d60('0x2a')]?_0x4af388[_0x5d60('0x1c')][_0x5d60('0x2a')]:'',_0x4af388[_0x5d60('0x1c')]&&_0x4af388['body'][_0x5d60('0x2e')]?_0x4af388[_0x5d60('0x1c')][_0x5d60('0x2e')]:'');},'ignoreRoute':function(_0x3bebe4){var _0xf4f645=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xf4f645[_0x5d60('0x2f')](_0x3bebe4[_0x5d60('0x23')]);}}));return _0xd9b38();});}exports[_0x5d60('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 6ebcce8..82ff28f 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1ed=['lodash','map','source','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','exports','timeCompare','format','includes','dowCompare','date','daysInMonth','max','min','guess','test','isMoment','padStart','length','iftime'];(function(_0x53c7c2,_0x301e27){var _0x77532=function(_0x1db1d1){while(--_0x1db1d1){_0x53c7c2['push'](_0x53c7c2['shift']());}};_0x77532(++_0x301e27);}(_0xb1ed,0x197));var _0xdb1e=function(_0x598fa0,_0x183280){_0x598fa0=_0x598fa0-0x0;var _0x29a6ab=_0xb1ed[_0x598fa0];return _0x29a6ab;};var _=require(_0xdb1e('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xdb1e('0x1')](function(_0x4c2b83){return _0x4c2b83[_0xdb1e('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xdb1e('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x7233f4){if(!_0x7233f4[_0xdb1e('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4cd601){var _0x424582=_0x4cd601[_0xdb1e('0x5')](':')['map'](function(_0x1b95a1){return parseInt(_0x1b95a1,0xa);});var _0x404c95=_0x424582[0x0];var _0x41317d=_0x424582[0x1];if(_0x404c95<0x0||_0x404c95>0x17||_0x41317d<0x0||_0x41317d>0x3b){throw new Error(EINVALID_DATE);}return[_0x404c95,_0x41317d];}function circularDoWInterval(_0x3225cf,_0x1f3bad){if(_0x3225cf===_0x1f3bad){return[_0x3225cf];}else{var _0x44fd25=moment[_0xdb1e('0x6')]();moment['locale']('en');var _0x23390a=moment[_0xdb1e('0x7')]()[_0xdb1e('0x1')](function(_0x5e8bcb){return _0x5e8bcb['toLowerCase']();});moment[_0xdb1e('0x6')](_0x44fd25);var _0x1fdfb2=_0x23390a[_0xdb1e('0x8')](_0x3225cf);var _0x80d97c=_0x23390a[_0xdb1e('0x8')](_0x1f3bad);if(_0x80d97c>_0x1fdfb2){return _0x23390a[_0xdb1e('0x9')](_0x1fdfb2,_0x80d97c+0x1);}else{var _0x515d7a=_0x23390a[_0xdb1e('0x9')](0x0,_0x80d97c+0x1);var _0x5eaf59=_0x23390a['slice'](_0x1fdfb2);return _0x5eaf59[_0xdb1e('0xa')](_0x515d7a);}}}module['exports'][_0xdb1e('0xb')]=circularDoWInterval;function circularMonthInterval(_0x538068,_0x450780){if(_0x538068===_0x450780){return[_0x538068];}else{var _0x5264b3=moment['locale']();moment[_0xdb1e('0x6')]('en');var _0x10cff6=moment[_0xdb1e('0xc')]()[_0xdb1e('0x1')](function(_0x357ec3){return _0x357ec3[_0xdb1e('0xd')]();});moment[_0xdb1e('0x6')](_0x5264b3);var _0x70f165=_0x10cff6[_0xdb1e('0x8')](_0x538068);var _0x40a0a7=_0x10cff6[_0xdb1e('0x8')](_0x450780);if(_0x40a0a7>_0x70f165){return _0x10cff6['slice'](_0x70f165,_0x40a0a7+0x1);}else{var _0x236d23=_0x10cff6[_0xdb1e('0x9')](0x0,_0x40a0a7+0x1);var _0x4e561b=_0x10cff6[_0xdb1e('0x9')](_0x70f165);return _0x4e561b[_0xdb1e('0xa')](_0x236d23);}}}module['exports'][_0xdb1e('0xe')]=circularMonthInterval;function parseDom(_0x2071fc){var _0xb40943=parseInt(_0x2071fc,0xa);if(_0xb40943<0x1||_0xb40943>0x1f){throw new Error(EINVALID_DATE);}return _0xb40943;}function timeCompare(_0x42a15f,_0x38e33d,_0x1ad376){var _0x38455f=_0x42a15f[_0xdb1e('0xf')]();var _0x3eebf1=extractTime(_0x38e33d);var _0x3493a9=_0x3eebf1[0x0];var _0x457068=_0x3eebf1[0x1];var _0x360df5=_0x42a15f[_0xdb1e('0xf')]()[_0xdb1e('0x10')](_0x3493a9)['minutes'](_0x457068);throwIfDateNotValid(_0x360df5);var _0x239d79=extractTime(_0x1ad376);var _0x136d7e=_0x239d79[0x0];var _0x173041=_0x239d79[0x1];var _0x2d3beb=_0x42a15f[_0xdb1e('0xf')]()[_0xdb1e('0x10')](_0x136d7e)[_0xdb1e('0x11')](_0x173041);throwIfDateNotValid(_0x2d3beb);if(_0x2d3beb['isBefore'](_0x360df5)){var _0x21f661=_0x38455f[_0xdb1e('0xf')]()[_0xdb1e('0x12')](_0xdb1e('0x13'));var _0xc2476=_0x38455f[_0xdb1e('0xf')]()[_0xdb1e('0x14')](_0xdb1e('0x13'));return _0x38455f[_0xdb1e('0x15')](_0x360df5,_0xc2476,undefined,'[]')||_0x38455f[_0xdb1e('0x15')](_0x21f661,_0x2d3beb,undefined,'[]');}else{return _0x38455f[_0xdb1e('0x15')](_0x360df5,_0x2d3beb,undefined,'[]');}}module[_0xdb1e('0x16')][_0xdb1e('0x17')]=timeCompare;function dowCompare(_0x38d979,_0xfd346,_0x1b3b9e){var _0xa6529b=_0x38d979[_0xdb1e('0x6')]('en')[_0xdb1e('0x18')]('ddd')[_0xdb1e('0xd')]();return circularDoWInterval(_0xfd346,_0x1b3b9e)[_0xdb1e('0x19')](_0xa6529b);}module[_0xdb1e('0x16')][_0xdb1e('0x1a')]=dowCompare;function domCompare(_0x6da0d9,_0x39cce0,_0x490af2){var _0x9a7c3f=_0x6da0d9[_0xdb1e('0x1b')]();if(_0x39cce0===_0x490af2){return _0x9a7c3f===_0x39cce0;}else{var _0x14162b=_0x6da0d9[_0xdb1e('0x1c')]();var _0x54d0ef=_0x39cce0<_0x490af2;let _0x7ed37c=![];var _0x102aa5=0x0;var _0x8d433d=0x0;if(_0x54d0ef){_0x102aa5=Math[_0xdb1e('0x1d')](0x1,_0x39cce0);_0x8d433d=Math[_0xdb1e('0x1e')](_0x490af2,_0x14162b);_0x7ed37c=_0x9a7c3f>=_0x102aa5&&_0x9a7c3f<=_0x8d433d;}else{_0x102aa5=Math[_0xdb1e('0x1e')](_0x39cce0,_0x14162b);_0x8d433d=Math['max'](0x1,_0x490af2);_0x7ed37c=_0x9a7c3f>=_0x102aa5||_0x9a7c3f<=_0x8d433d;}return _0x7ed37c;}}module[_0xdb1e('0x16')]['domCompare']=domCompare;function monthCompare(_0x206f87,_0x54c197,_0x26014c){var _0x2e8684=_0x206f87['locale']('en')[_0xdb1e('0x18')]('MMM')[_0xdb1e('0xd')]();return circularMonthInterval(_0x54c197,_0x26014c)[_0xdb1e('0x19')](_0x2e8684);}module[_0xdb1e('0x16')]['monthCompare']=monthCompare;function iftime(_0x38dba0,_0x1a4784=moment['tz'][_0xdb1e('0x1f')](),_0x2cb8e1=moment()){if(!validateRx[_0xdb1e('0x20')](_0x38dba0)){throw new Error(EINVALID_STRING);}else{var _0x5d9e39=(moment[_0xdb1e('0x21')](_0x2cb8e1)?_0x2cb8e1[_0xdb1e('0xf')]():moment(_0x2cb8e1))['tz'](_0x1a4784)[_0xdb1e('0x6')]('en');throwIfDateNotValid(_0x5d9e39);var _0x32e605=_0x38dba0[_0xdb1e('0x5')](',');var _0x3fc802=_0x32e605[0x0];var _0x31891c=_0x32e605[0x1];var _0x544ae0=_0x32e605[0x2];var _0x43fe9c=_0x32e605[0x3];let _0x133133=!![];if(_0x3fc802!=='*'){var _0x4c5578=_0x3fc802[_0xdb1e('0x5')]('-');var _0x3fffa7=_[_0xdb1e('0x22')](_0x4c5578[0x0],0x5,'0');var _0x368c1b=_0x4c5578['length']===0x2?_[_0xdb1e('0x22')](_0x4c5578[0x1],0x5,'0'):_0x3fffa7;_0x133133=timeCompare(_0x5d9e39,_0x3fffa7,_0x368c1b);}let _0x30a343=!![];if(_0x31891c!=='*'){var _0x23ded7=_0x31891c[_0xdb1e('0x5')]('-');var _0x2d1a94=_0x23ded7[0x0];var _0x18ed48=_0x23ded7['length']===0x2?_0x23ded7[0x1]:_0x2d1a94;_0x30a343=dowCompare(_0x5d9e39,_0x2d1a94,_0x18ed48);}let _0x57af56=!![];if(_0x544ae0!=='*'){var _0x1359ff=_0x544ae0[_0xdb1e('0x5')]('-');var _0x4a1ec5=parseDom(_0x1359ff[0x0]);var _0x52c63b=_0x1359ff[_0xdb1e('0x23')]===0x2?parseDom(_0x1359ff[0x1]):_0x4a1ec5;_0x57af56=domCompare(_0x5d9e39,_0x4a1ec5,_0x52c63b);}let _0xcb623d=!![];if(_0x43fe9c!=='*'){var _0x24d61f=_0x43fe9c['split']('-');var _0x58ae5e=_0x24d61f[0x0];var _0x4f74f9=_0x24d61f[_0xdb1e('0x23')]===0x2?_0x24d61f[0x1]:_0x24d61f[0x0];_0xcb623d=monthCompare(_0x5d9e39,_0x58ae5e,_0x4f74f9);}return _0x133133&&_0x30a343&&_0x57af56&&_0xcb623d;}}module[_0xdb1e('0x16')][_0xdb1e('0x24')]=iftime; \ No newline at end of file +var _0x3526=['locale','indexOf','slice','exports','monthsShort','concat','circularMonthInterval','hours','minutes','clone','isBefore','endOf','day','isBetween','format','includes','daysInMonth','max','min','MMM','monthCompare','guess','test','isMoment','split','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','weekdaysShort','toLowerCase'];(function(_0x2f5d63,_0x2f6efe){var _0x7da526=function(_0x583422){while(--_0x583422){_0x2f5d63['push'](_0x2f5d63['shift']());}};_0x7da526(++_0x2f6efe);}(_0x3526,0x65));var _0x6352=function(_0x3703ed,_0x5bb358){_0x3703ed=_0x3703ed-0x0;var _0x1b3809=_0x3526[_0x3703ed];return _0x1b3809;};var _=require(_0x6352('0x0'));var moment=require(_0x6352('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x6352('0x2')](function(_0xd41d28){return _0xd41d28[_0x6352('0x3')];})[_0x6352('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6352('0x5');var EINVALID_DATE=_0x6352('0x6');function throwIfDateNotValid(_0x5ddd08){if(!_0x5ddd08[_0x6352('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x24935e){var _0x254ec7=_0x24935e['split'](':')[_0x6352('0x2')](function(_0x17db18){return parseInt(_0x17db18,0xa);});var _0x3f9e4c=_0x254ec7[0x0];var _0x1264ba=_0x254ec7[0x1];if(_0x3f9e4c<0x0||_0x3f9e4c>0x17||_0x1264ba<0x0||_0x1264ba>0x3b){throw new Error(EINVALID_DATE);}return[_0x3f9e4c,_0x1264ba];}function circularDoWInterval(_0x2c5d82,_0x516a00){if(_0x2c5d82===_0x516a00){return[_0x2c5d82];}else{var _0x1410b3=moment['locale']();moment['locale']('en');var _0x2e1d85=moment[_0x6352('0x8')]()[_0x6352('0x2')](function(_0x3260b6){return _0x3260b6[_0x6352('0x9')]();});moment[_0x6352('0xa')](_0x1410b3);var _0x2b75e6=_0x2e1d85['indexOf'](_0x2c5d82);var _0x56d596=_0x2e1d85[_0x6352('0xb')](_0x516a00);if(_0x56d596>_0x2b75e6){return _0x2e1d85[_0x6352('0xc')](_0x2b75e6,_0x56d596+0x1);}else{var _0x5afcbc=_0x2e1d85[_0x6352('0xc')](0x0,_0x56d596+0x1);var _0x441a9a=_0x2e1d85[_0x6352('0xc')](_0x2b75e6);return _0x441a9a['concat'](_0x5afcbc);}}}module[_0x6352('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0xaecdad,_0x57f987){if(_0xaecdad===_0x57f987){return[_0xaecdad];}else{var _0x2e6671=moment[_0x6352('0xa')]();moment['locale']('en');var _0x4b0607=moment[_0x6352('0xe')]()[_0x6352('0x2')](function(_0x2fbcfd){return _0x2fbcfd['toLowerCase']();});moment['locale'](_0x2e6671);var _0x19c082=_0x4b0607[_0x6352('0xb')](_0xaecdad);var _0x49563f=_0x4b0607[_0x6352('0xb')](_0x57f987);if(_0x49563f>_0x19c082){return _0x4b0607[_0x6352('0xc')](_0x19c082,_0x49563f+0x1);}else{var _0x369174=_0x4b0607[_0x6352('0xc')](0x0,_0x49563f+0x1);var _0x28c274=_0x4b0607[_0x6352('0xc')](_0x19c082);return _0x28c274[_0x6352('0xf')](_0x369174);}}}module['exports'][_0x6352('0x10')]=circularMonthInterval;function parseDom(_0x2af48f){var _0x5ac87b=parseInt(_0x2af48f,0xa);if(_0x5ac87b<0x1||_0x5ac87b>0x1f){throw new Error(EINVALID_DATE);}return _0x5ac87b;}function timeCompare(_0x138a93,_0x898674,_0x192a22){var _0x1cf735=_0x138a93['clone']();var _0x1b0ae0=extractTime(_0x898674);var _0x5e7725=_0x1b0ae0[0x0];var _0x2ac48b=_0x1b0ae0[0x1];var _0x3d8b93=_0x138a93['clone']()[_0x6352('0x11')](_0x5e7725)[_0x6352('0x12')](_0x2ac48b);throwIfDateNotValid(_0x3d8b93);var _0x7d2b94=extractTime(_0x192a22);var _0x12c563=_0x7d2b94[0x0];var _0x559a7e=_0x7d2b94[0x1];var _0x547268=_0x138a93[_0x6352('0x13')]()['hours'](_0x12c563)[_0x6352('0x12')](_0x559a7e);throwIfDateNotValid(_0x547268);if(_0x547268[_0x6352('0x14')](_0x3d8b93)){var _0x1c59a1=_0x1cf735[_0x6352('0x13')]()['startOf']('day');var _0x28b771=_0x1cf735[_0x6352('0x13')]()[_0x6352('0x15')](_0x6352('0x16'));return _0x1cf735['isBetween'](_0x3d8b93,_0x28b771,undefined,'[]')||_0x1cf735[_0x6352('0x17')](_0x1c59a1,_0x547268,undefined,'[]');}else{return _0x1cf735[_0x6352('0x17')](_0x3d8b93,_0x547268,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x2901ee,_0x41b616,_0x2d81ad){var _0x347d54=_0x2901ee[_0x6352('0xa')]('en')[_0x6352('0x18')]('ddd')[_0x6352('0x9')]();return circularDoWInterval(_0x41b616,_0x2d81ad)[_0x6352('0x19')](_0x347d54);}module[_0x6352('0xd')]['dowCompare']=dowCompare;function domCompare(_0x4e4179,_0x14c509,_0x1683bc){var _0xc53fe=_0x4e4179['date']();if(_0x14c509===_0x1683bc){return _0xc53fe===_0x14c509;}else{var _0x33f59e=_0x4e4179[_0x6352('0x1a')]();var _0x35cc11=_0x14c509<_0x1683bc;let _0x54cffe=![];var _0x14fa0b=0x0;var _0x47fd73=0x0;if(_0x35cc11){_0x14fa0b=Math[_0x6352('0x1b')](0x1,_0x14c509);_0x47fd73=Math[_0x6352('0x1c')](_0x1683bc,_0x33f59e);_0x54cffe=_0xc53fe>=_0x14fa0b&&_0xc53fe<=_0x47fd73;}else{_0x14fa0b=Math[_0x6352('0x1c')](_0x14c509,_0x33f59e);_0x47fd73=Math['max'](0x1,_0x1683bc);_0x54cffe=_0xc53fe>=_0x14fa0b||_0xc53fe<=_0x47fd73;}return _0x54cffe;}}module[_0x6352('0xd')]['domCompare']=domCompare;function monthCompare(_0x27af96,_0x1a6f16,_0x2b5c78){var _0x4f546f=_0x27af96[_0x6352('0xa')]('en')[_0x6352('0x18')](_0x6352('0x1d'))[_0x6352('0x9')]();return circularMonthInterval(_0x1a6f16,_0x2b5c78)['includes'](_0x4f546f);}module[_0x6352('0xd')][_0x6352('0x1e')]=monthCompare;function iftime(_0x4426aa,_0x218eab=moment['tz'][_0x6352('0x1f')](),_0x52e94c=moment()){if(!validateRx[_0x6352('0x20')](_0x4426aa)){throw new Error(EINVALID_STRING);}else{var _0x56ad0e=(moment[_0x6352('0x21')](_0x52e94c)?_0x52e94c[_0x6352('0x13')]():moment(_0x52e94c))['tz'](_0x218eab)[_0x6352('0xa')]('en');throwIfDateNotValid(_0x56ad0e);var _0x2dee70=_0x4426aa['split'](',');var _0x2349fd=_0x2dee70[0x0];var _0x2bf4bc=_0x2dee70[0x1];var _0x590750=_0x2dee70[0x2];var _0x2ed757=_0x2dee70[0x3];let _0x5867b6=!![];if(_0x2349fd!=='*'){var _0x460711=_0x2349fd[_0x6352('0x22')]('-');var _0x25312b=_['padStart'](_0x460711[0x0],0x5,'0');var _0x33e4f9=_0x460711[_0x6352('0x23')]===0x2?_['padStart'](_0x460711[0x1],0x5,'0'):_0x25312b;_0x5867b6=timeCompare(_0x56ad0e,_0x25312b,_0x33e4f9);}let _0x36f34c=!![];if(_0x2bf4bc!=='*'){var _0x1199cb=_0x2bf4bc[_0x6352('0x22')]('-');var _0x1480e1=_0x1199cb[0x0];var _0x491f49=_0x1199cb['length']===0x2?_0x1199cb[0x1]:_0x1480e1;_0x36f34c=dowCompare(_0x56ad0e,_0x1480e1,_0x491f49);}let _0x4cc7ad=!![];if(_0x590750!=='*'){var _0x1778fb=_0x590750[_0x6352('0x22')]('-');var _0x7c2e60=parseDom(_0x1778fb[0x0]);var _0x1359d0=_0x1778fb[_0x6352('0x23')]===0x2?parseDom(_0x1778fb[0x1]):_0x7c2e60;_0x4cc7ad=domCompare(_0x56ad0e,_0x7c2e60,_0x1359d0);}let _0x15d32d=!![];if(_0x2ed757!=='*'){var _0x30c9a1=_0x2ed757[_0x6352('0x22')]('-');var _0x2c6810=_0x30c9a1[0x0];var _0x16cf5e=_0x30c9a1[_0x6352('0x23')]===0x2?_0x30c9a1[0x1]:_0x30c9a1[0x0];_0x15d32d=monthCompare(_0x56ad0e,_0x2c6810,_0x16cf5e);}return _0x5867b6&&_0x36f34c&&_0x4cc7ad&&_0x15d32d;}}module['exports'][_0x6352('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 8a1a49d..f8c4769 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ca2=['%s-%s','error','consoleLogger','path','util','winston','../config/environment','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','bold\x20magenta','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','{{{','meta','keys','Logger','transports','Console','warn','File'];(function(_0x1527a9,_0x55feeb){var _0x15b5be=function(_0x1571d8){while(--_0x1571d8){_0x1527a9['push'](_0x1527a9['shift']());}};_0x15b5be(++_0x55feeb);}(_0x0ca2,0x183));var _0x20ca=function(_0x1764fd,_0x256895){_0x1764fd=_0x1764fd-0x0;var _0x13189e=_0x0ca2[_0x1764fd];return _0x13189e;};'use strict';var path=require(_0x20ca('0x0'));var util=require(_0x20ca('0x1'));var moment=require('moment');var winston=require(_0x20ca('0x2'));var config=require(_0x20ca('0x3'));var debugLevel=config['debugLevel']?config['debugLevel'][_0x20ca('0x4')]():_0x20ca('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x20ca('0x6'),'error':_0x20ca('0x7'),'warn':_0x20ca('0x8'),'info':'white','print':'bold\x20white','success':_0x20ca('0x9'),'http':'gray','verbose':_0x20ca('0xa'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0xf272e8,_0x26cff9,_0x2d79c2){var _0x32b0ce=_0xf272e8||_0x20ca('0xb');return path[_0x20ca('0xc')](_0x32b0ce,util[_0x20ca('0xd')](_0x20ca('0xe'),_0x26cff9,_0x2d79c2));}function formatter(_0x56589e,_0x384af0){_0x384af0[_0x20ca('0xf')]=_0x384af0['message'][_0x20ca('0x10')](/@@{/g,'{{{')[_0x20ca('0x10')](/}@@/g,_0x20ca('0x11'))[_0x20ca('0x10')](/@{/g,'{{')[_0x20ca('0x10')](/}@/g,'}}');return util[_0x20ca('0xd')](_0x20ca('0x12'),moment()[_0x20ca('0xd')](_0x20ca('0x13')),_0x384af0[_0x20ca('0x14')]['toUpperCase'](),_0x56589e,_0x384af0[_0x20ca('0xf')]);}function fileFormat(_0x333463,_0x541ccb){_0x541ccb[_0x20ca('0xf')]=_0x541ccb['message'][_0x20ca('0x10')](/@@{/g,_0x20ca('0x15'))[_0x20ca('0x10')](/}@@/g,'}}}')[_0x20ca('0x10')](/@{/g,'{{')[_0x20ca('0x10')](/}@/g,'}}');var _0x3dc9f3=_0x541ccb[_0x20ca('0x16')]&&Object[_0x20ca('0x17')](_0x541ccb['meta'])['length']?'\x0a\x09'+JSON['stringify'](_0x541ccb[_0x20ca('0x16')]):'';return util[_0x20ca('0xd')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x20ca('0xd')](_0x20ca('0x13')),_0x541ccb['level']['toUpperCase'](),_0x333463,_0x541ccb[_0x20ca('0xf')],_0x3dc9f3);}function consoleLogger(){var _0x2f65fc=new winston[(_0x20ca('0x18'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x20ca('0x19'))][(_0x20ca('0x1a'))]({'level':_0x20ca('0x1b'),'json':![],'formatter':function(_0x4de3e0){return formatter('',_0x4de3e0);}})]});return _0x2f65fc;}function fileLogger(_0xfd0490,_0x57d1e9){var _0x3a4a3e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x20ca('0x1c'))]({'name':util[_0x20ca('0xd')](_0x20ca('0x1d'),_0xfd0490,'error'),'filename':getLogFileName(_0x57d1e9,_0xfd0490,_0x20ca('0x1e')),'level':_0x20ca('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3fd240){return fileFormat(_0xfd0490,_0x3fd240);}}),new winston['transports'][(_0x20ca('0x1c'))]({'name':util['format'](_0x20ca('0x1d'),_0xfd0490,debugLevel),'filename':getLogFileName(_0x57d1e9,_0xfd0490,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x32ed14){return fileFormat(_0xfd0490,_0x32ed14);}}),new winston[(_0x20ca('0x19'))][(_0x20ca('0x1a'))]({'level':'warn','json':![],'formatter':function(_0x5217a7){return fileFormat(_0xfd0490,_0x5217a7);}})]});return _0x3a4a3e;}exports[_0x20ca('0x1f')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x5d4b=['{{{','replace','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','Console','warn','transports','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','join','%s-%s.log','message'];(function(_0x38782c,_0x5c9fef){var _0x3708bf=function(_0x595e13){while(--_0x595e13){_0x38782c['push'](_0x38782c['shift']());}};_0x3708bf(++_0x5c9fef);}(_0x5d4b,0x105));var _0xb5d4=function(_0x304d85,_0x3bd383){_0x304d85=_0x304d85-0x0;var _0x570077=_0x5d4b[_0x304d85];return _0x570077;};'use strict';var path=require(_0xb5d4('0x0'));var util=require(_0xb5d4('0x1'));var moment=require(_0xb5d4('0x2'));var winston=require(_0xb5d4('0x3'));var config=require(_0xb5d4('0x4'));var debugLevel=config[_0xb5d4('0x5')]?config[_0xb5d4('0x5')][_0xb5d4('0x6')]():_0xb5d4('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xb5d4('0x8'),'error':_0xb5d4('0x9'),'warn':'bold\x20yellow','info':'white','print':_0xb5d4('0xa'),'success':_0xb5d4('0xb'),'http':_0xb5d4('0xc'),'verbose':_0xb5d4('0xd'),'debug':_0xb5d4('0xe'),'silly':_0xb5d4('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0xf2fc35,_0x3c2fc9,_0x43861b){var _0x45092d=_0xf2fc35||'/var/log/xcally';return path[_0xb5d4('0x10')](_0x45092d,util['format'](_0xb5d4('0x11'),_0x3c2fc9,_0x43861b));}function formatter(_0x3ca85f,_0x52b584){_0x52b584[_0xb5d4('0x12')]=_0x52b584[_0xb5d4('0x12')]['replace'](/@@{/g,_0xb5d4('0x13'))[_0xb5d4('0x14')](/}@@/g,_0xb5d4('0x15'))[_0xb5d4('0x14')](/@{/g,'{{')[_0xb5d4('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xb5d4('0x16')](_0xb5d4('0x17')),_0x52b584[_0xb5d4('0x18')][_0xb5d4('0x19')](),_0x3ca85f,_0x52b584['message']);}function fileFormat(_0x4ecb36,_0x5b9d37){_0x5b9d37['message']=_0x5b9d37['message'][_0xb5d4('0x14')](/@@{/g,_0xb5d4('0x13'))['replace'](/}@@/g,_0xb5d4('0x15'))[_0xb5d4('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x575ba8=_0x5b9d37[_0xb5d4('0x1a')]&&Object[_0xb5d4('0x1b')](_0x5b9d37['meta'])[_0xb5d4('0x1c')]?'\x0a\x09'+JSON[_0xb5d4('0x1d')](_0x5b9d37[_0xb5d4('0x1a')]):'';return util[_0xb5d4('0x16')](_0xb5d4('0x1e'),moment()[_0xb5d4('0x16')](_0xb5d4('0x17')),_0x5b9d37['level'][_0xb5d4('0x19')](),_0x4ecb36,_0x5b9d37['message'],_0x575ba8);}function consoleLogger(){var _0x13f754=new winston[(_0xb5d4('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb5d4('0x20'))]({'level':_0xb5d4('0x21'),'json':![],'formatter':function(_0x54b33f){return formatter('',_0x54b33f);}})]});return _0x13f754;}function fileLogger(_0x830174,_0x38223c){var _0x5214e5=new winston[(_0xb5d4('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb5d4('0x22'))][(_0xb5d4('0x23'))]({'name':util[_0xb5d4('0x16')](_0xb5d4('0x24'),_0x830174,'error'),'filename':getLogFileName(_0x38223c,_0x830174,_0xb5d4('0x25')),'level':_0xb5d4('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb74f04){return fileFormat(_0x830174,_0xb74f04);}}),new winston[(_0xb5d4('0x22'))][(_0xb5d4('0x23'))]({'name':util[_0xb5d4('0x16')](_0xb5d4('0x24'),_0x830174,debugLevel),'filename':getLogFileName(_0x38223c,_0x830174,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x437f33){return fileFormat(_0x830174,_0x437f33);}}),new winston[(_0xb5d4('0x22'))][(_0xb5d4('0x20'))]({'level':'warn','json':![],'formatter':function(_0x593de4){return fileFormat(_0x830174,_0x593de4);}})]});return _0x5214e5;}exports[_0xb5d4('0x26')]=consoleLogger;exports[_0xb5d4('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index bcfeb86..fb7f7bd 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x230930,_0x5ab351){var _0x2a0ea0=function(_0x243853){while(--_0x243853){_0x230930['push'](_0x230930['shift']());}};_0x2a0ea0(++_0x5ab351);}(_0x1261,0x144));var _0x1126=function(_0x871ef5,_0x58880b){_0x871ef5=_0x871ef5-0x0;var _0x1f62ea=_0x1261[_0x871ef5];return _0x1f62ea;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x467884,_0x420ea7){_0x467884=_0x467884-0x0;var _0xe87b89=_0xdb28[_0x467884];return _0xe87b89;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index f80b710..d18c32a 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','\x5c$&','exports'];(function(_0x497f18,_0x3f8ecd){var _0x4c97=function(_0x4ca369){while(--_0x4ca369){_0x497f18['push'](_0x497f18['shift']());}};_0x4c97(++_0x3f8ecd);}(_0x4975,0x86));var _0x5497=function(_0x16484f,_0x25e411){_0x16484f=_0x16484f-0x0;var _0x2f6bd9=_0x4975[_0x16484f];return _0x2f6bd9;};module[_0x5497('0x0')]={'escapeRegExp'(_0x4db539,_0x474989=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4db539[_0x5497('0x1')](_0x474989,_0x5497('0x2'));}}; \ No newline at end of file +var _0x5f2f=['\x5c$&','exports','replace'];(function(_0x33f48b,_0x3c439e){var _0x110e1b=function(_0x31a30f){while(--_0x31a30f){_0x33f48b['push'](_0x33f48b['shift']());}};_0x110e1b(++_0x3c439e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x58b66e,_0x55a3d6){_0x58b66e=_0x58b66e-0x0;var _0x245660=_0x5f2f[_0x58b66e];return _0x245660;};module[_0xf5f2('0x0')]={'escapeRegExp'(_0x423dd9,_0x2dcf60=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x423dd9[_0xf5f2('0x1')](_0x2dcf60,_0xf5f2('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ed98ca2..bfe6913 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb03e=['safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','exports'];(function(_0x594015,_0x20df65){var _0x191df2=function(_0x1e8251){while(--_0x1e8251){_0x594015['push'](_0x594015['shift']());}};_0x191df2(++_0x20df65);}(_0xb03e,0x1eb));var _0xeb03=function(_0x2cb576,_0x1aa800){_0x2cb576=_0x2cb576-0x0;var _0x55e4d9=_0xb03e[_0x2cb576];return _0x55e4d9;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x36351b){return _0x36351b==='{{'?_0xeb03('0x0'):_0xeb03('0x1');}function safeTemplate(_0x3c5e68){var _0x1c58b5=_0x3c5e68;if(typeof _0x3c5e68===_0xeb03('0x2')){_0x1c58b5=_0x3c5e68[_0xeb03('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xeb03('0x4')](_0x3c5e68)){_0x1c58b5=_0x3c5e68[_0xeb03('0x5')](function(_0x3ba4b0){return safeTemplate(_0x3ba4b0);});}else if(_[_0xeb03('0x6')](_0x3c5e68)){_0x1c58b5=Object[_0xeb03('0x7')](_0x3c5e68)['reduce'](function(_0x3b58a2,_0x3d3322){_0x3b58a2[_0x3d3322]=safeTemplate(_0x3c5e68[_0x3d3322]);return _0x3b58a2;},{});}return _0x1c58b5;}module[_0xeb03('0x8')][_0xeb03('0x9')]=safeTemplate; \ No newline at end of file +var _0x5c3c=['\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','{\x20{\x20'];(function(_0x170ab3,_0x1c2083){var _0x265c0b=function(_0x2b7d81){while(--_0x2b7d81){_0x170ab3['push'](_0x170ab3['shift']());}};_0x265c0b(++_0x1c2083);}(_0x5c3c,0x132));var _0xc5c3=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x5c3c[_0x3c2a69];return _0x596bc8;};var _=require(_0xc5c3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x40ad71){return _0x40ad71==='{{'?_0xc5c3('0x1'):_0xc5c3('0x2');}function safeTemplate(_0x4b9233){var _0x400726=_0x4b9233;if(typeof _0x4b9233===_0xc5c3('0x3')){_0x400726=_0x4b9233[_0xc5c3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc5c3('0x5')](_0x4b9233)){_0x400726=_0x4b9233[_0xc5c3('0x6')](function(_0x36525d){return safeTemplate(_0x36525d);});}else if(_[_0xc5c3('0x7')](_0x4b9233)){_0x400726=Object[_0xc5c3('0x8')](_0x4b9233)[_0xc5c3('0x9')](function(_0x5a392b,_0x4b8404){_0x5a392b[_0x4b8404]=safeTemplate(_0x4b9233[_0x4b8404]);return _0x5a392b;},{});}return _0x400726;}module['exports'][_0xc5c3('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 29ac69e..068ea7f 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdc8=['fs-extra','path','../config/environment','root','resolve','server/app.json','apps','findIndex','name','motion2','string','env','pathExists','readJSON','then','info','writeJSON','exports'];(function(_0x195b7b,_0x457329){var _0x33ee64=function(_0x5309b8){while(--_0x5309b8){_0x195b7b['push'](_0x195b7b['shift']());}};_0x33ee64(++_0x457329);}(_0xfdc8,0x6c));var _0x8fdc=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xfdc8[_0x151721];return _0x2deaa7;};var fs=require(_0x8fdc('0x0'));var path=require(_0x8fdc('0x1'));var config=require(_0x8fdc('0x2'));var root=config[_0x8fdc('0x3')];var APP_JSON_PATH=path[_0x8fdc('0x4')](root,_0x8fdc('0x5'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x1198f9){let _0x3a7828=![];if(Array['isArray'](_0x1198f9[_0x8fdc('0x6')])){var _0x4145d9=_0x1198f9[_0x8fdc('0x6')][_0x8fdc('0x7')](function(_0x335db3){return _0x335db3[_0x8fdc('0x8')]===_0x8fdc('0x9');});if(_0x4145d9>-0x1){var _0x2b8f4a=_0x1198f9[_0x8fdc('0x6')][_0x4145d9];if(typeof _0x2b8f4a['env']['NODE_PATH']!==_0x8fdc('0xa')){_0x2b8f4a[_0x8fdc('0xb')]['NODE_PATH']=NODEPATH;_0x3a7828=!![];}}return{'appConfig':_0x1198f9,'updated':_0x3a7828};}}function updateAppConfig(_0x29f469){return fs[_0x8fdc('0xc')](APP_JSON_PATH)['then'](function(_0x613e27){if(_0x613e27){return fs[_0x8fdc('0xd')](APP_JSON_PATH)[_0x8fdc('0xe')](function(_0x288e0d){var _0x3a65e5=setLegacyLibsNodeEnvPath(_0x288e0d);if(_0x3a65e5['updated']){_0x29f469[_0x8fdc('0xf')]('Updating\x20app.json');return fs[_0x8fdc('0x10')](APP_JSON_PATH,_0x288e0d,{'spaces':0x2});}else{return Promise[_0x8fdc('0x4')]();}});}else{return Promise[_0x8fdc('0x4')]();}});}module[_0x8fdc('0x11')]=updateAppConfig; \ No newline at end of file +var _0x95a8=['info','Updating\x20app.json','writeJSON','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','name','env','NODE_PATH','string','pathExists','then','readJSON'];(function(_0x3154a7,_0xbbf0c3){var _0x3a0822=function(_0x567cc6){while(--_0x567cc6){_0x3154a7['push'](_0x3154a7['shift']());}};_0x3a0822(++_0xbbf0c3);}(_0x95a8,0xdb));var _0x895a=function(_0xbbbeae,_0x4a414a){_0xbbbeae=_0xbbbeae-0x0;var _0x1cb9c9=_0x95a8[_0xbbbeae];return _0x1cb9c9;};var fs=require('fs-extra');var path=require(_0x895a('0x0'));var config=require(_0x895a('0x1'));var root=config[_0x895a('0x2')];var APP_JSON_PATH=path[_0x895a('0x3')](root,_0x895a('0x4'));var NODEPATH=path[_0x895a('0x3')](root,_0x895a('0x5'));function setLegacyLibsNodeEnvPath(_0x51a6aa){let _0x2d1dc7=![];if(Array[_0x895a('0x6')](_0x51a6aa['apps'])){var _0x2cf4df=_0x51a6aa[_0x895a('0x7')]['findIndex'](function(_0x2a7900){return _0x2a7900[_0x895a('0x8')]==='motion2';});if(_0x2cf4df>-0x1){var _0x1afe87=_0x51a6aa[_0x895a('0x7')][_0x2cf4df];if(typeof _0x1afe87[_0x895a('0x9')][_0x895a('0xa')]!==_0x895a('0xb')){_0x1afe87[_0x895a('0x9')][_0x895a('0xa')]=NODEPATH;_0x2d1dc7=!![];}}return{'appConfig':_0x51a6aa,'updated':_0x2d1dc7};}}function updateAppConfig(_0x4556bf){return fs[_0x895a('0xc')](APP_JSON_PATH)[_0x895a('0xd')](function(_0x48eb22){if(_0x48eb22){return fs[_0x895a('0xe')](APP_JSON_PATH)[_0x895a('0xd')](function(_0x4987f3){var _0x39331e=setLegacyLibsNodeEnvPath(_0x4987f3);if(_0x39331e['updated']){_0x4556bf[_0x895a('0xf')](_0x895a('0x10'));return fs[_0x895a('0x11')](APP_JSON_PATH,_0x4987f3,{'spaces':0x2});}else{return Promise[_0x895a('0x3')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file